@stacksjs/stx 0.2.872 → 0.2.873
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-kx6y1cqw.js → chunk-0489wcvq.js} +1 -1
- package/dist/{chunk-jnj9s2yw.js → chunk-0g80km93.js} +1 -1
- package/dist/{chunk-q8d0wf0w.js → chunk-1mzfynpk.js} +1 -1
- package/dist/{chunk-y69hhxn8.js → chunk-26s2jxvn.js} +1 -1
- package/dist/{chunk-bfvr4byj.js → chunk-2drcj9wn.js} +2 -2
- package/dist/chunk-36e94whg.js +3 -0
- package/dist/{chunk-pj1znb6y.js → chunk-3t91wwbe.js} +1 -1
- package/dist/{chunk-v4ab2jzz.js → chunk-60ezkjcz.js} +1 -1
- package/dist/{chunk-v99hgmsx.js → chunk-696cdgkg.js} +1 -1
- package/dist/{chunk-tahw02kf.js → chunk-85m8nyk6.js} +1 -1
- package/dist/{chunk-ba86dkhs.js → chunk-8q8xkw02.js} +1 -1
- package/dist/{chunk-1c8j9zdp.js → chunk-8xjj7wjf.js} +1 -1
- package/dist/{chunk-jkevn2jy.js → chunk-9kghtf20.js} +1 -1
- package/dist/{chunk-dv1edvz8.js → chunk-aed45njs.js} +1 -1
- package/dist/{chunk-thyxsg54.js → chunk-are96jcb.js} +1 -1
- package/dist/{chunk-1p9rb7rt.js → chunk-b53rzbrh.js} +1 -1
- package/dist/{chunk-e549f7a9.js → chunk-ct90b523.js} +2 -2
- package/dist/{chunk-bqs9wyje.js → chunk-d3mmnzwy.js} +1 -1
- package/dist/chunk-d8zhtwnw.js +2 -0
- package/dist/{chunk-808fbm83.js → chunk-d9f7zb5p.js} +1 -1
- package/dist/{chunk-teahvty8.js → chunk-df49nnj9.js} +1 -1
- package/dist/chunk-dhjet15m.js +2 -0
- package/dist/chunk-dy1brym3.js +2 -0
- package/dist/{chunk-jf3n1f32.js → chunk-e5xfbcp7.js} +1 -1
- package/dist/{chunk-tc36b3r4.js → chunk-e631k202.js} +4 -4
- package/dist/{chunk-qvxtq5vb.js → chunk-ek5mv2h8.js} +1 -1
- package/dist/{chunk-pnqdwqw9.js → chunk-eprhhrzc.js} +6 -6
- package/dist/{chunk-kkevjppm.js → chunk-eq3mqbcn.js} +1 -1
- package/dist/{chunk-s70e5jbq.js → chunk-f30bpj7a.js} +4 -4
- package/dist/{chunk-ycb07ppz.js → chunk-fbqk2w2k.js} +1 -1
- package/dist/{chunk-9c07p1vq.js → chunk-gynvaceg.js} +2 -2
- package/dist/{chunk-bmbqr2br.js → chunk-h3j2zvms.js} +1 -1
- package/dist/chunk-h8rpk597.js +2 -0
- package/dist/{chunk-vv9anbw1.js → chunk-hmsjjw34.js} +1 -1
- package/dist/{chunk-hd4vn78w.js → chunk-hq0zqaqc.js} +1 -1
- package/dist/{chunk-kzhget9h.js → chunk-hq4d1me0.js} +1 -1
- package/dist/{chunk-rvbw12e1.js → chunk-j7f3h982.js} +1 -1
- package/dist/{chunk-6s7q8kw3.js → chunk-j7q17ws8.js} +1 -1
- package/dist/chunk-jq0zvr43.js +2 -0
- package/dist/{chunk-qk1fkfvj.js → chunk-k0ph8zr7.js} +1 -1
- package/dist/chunk-kp12tsn0.js +2 -0
- package/dist/{chunk-4ay62hs9.js → chunk-mxdapaz2.js} +1 -1
- package/dist/{chunk-832m6nwr.js → chunk-n0d4vbcv.js} +5 -5
- package/dist/{chunk-7q3ar8ay.js → chunk-natvnazg.js} +1 -1
- package/dist/{chunk-2jccw1km.js → chunk-nxqsdt89.js} +1 -1
- package/dist/chunk-p71c1wrw.js +2 -0
- package/dist/{chunk-vf91b9b9.js → chunk-qhczf1wf.js} +1 -1
- package/dist/{chunk-qt4dha3g.js → chunk-rb71xcfw.js} +3 -3
- package/dist/{chunk-pc8jnkb3.js → chunk-sb8qv9wy.js} +1 -1
- package/dist/{chunk-9bnggqhj.js → chunk-scsmp2e5.js} +1 -1
- package/dist/{chunk-jpgc0j8x.js → chunk-tny8mz6q.js} +2 -2
- package/dist/{chunk-my6tp8rn.js → chunk-ts1jwj54.js} +1 -1
- package/dist/{chunk-b8vs32dw.js → chunk-vvddndcm.js} +1 -1
- package/dist/{chunk-mm00bb1p.js → chunk-w3d7pwzg.js} +1 -1
- package/dist/{chunk-2yrd286h.js → chunk-w4a3fqf4.js} +1 -1
- package/dist/{chunk-4p51hk75.js → chunk-wa4w5bcn.js} +4 -4
- package/dist/{chunk-av2vknrs.js → chunk-xpzt4wwb.js} +2 -2
- package/dist/{chunk-jcr69v95.js → chunk-xr1yrdxy.js} +2 -2
- package/dist/{chunk-71hjqg16.js → chunk-xvj6yf0q.js} +4 -4
- package/dist/chunk-y0a8hex3.js +2 -0
- package/dist/chunk-y2ctxchq.js +2 -0
- package/dist/{chunk-f5gg0pxj.js → chunk-z347p6cg.js} +1 -1
- package/dist/{chunk-z2wfgva6.js → chunk-z3afnkan.js} +1 -1
- package/dist/{chunk-y48ykf1n.js → chunk-zktbzwkv.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/ssg.js +2 -2
- package/package.json +5 -5
- package/dist/chunk-2nd3h37q.js +0 -2
- package/dist/chunk-3k5g4tbn.js +0 -2
- package/dist/chunk-3qewdhvh.js +0 -2
- package/dist/chunk-7mqnbn1x.js +0 -2
- package/dist/chunk-b2kkezey.js +0 -2
- package/dist/chunk-c63027nw.js +0 -2
- package/dist/chunk-cv9vmz5x.js +0 -2
- package/dist/chunk-tfsf9pes.js +0 -2
- package/dist/chunk-txjtd4gj.js +0 -2
- package/dist/chunk-z0qxrx9r.js +0 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Vt,ge,E,d,m,O,t,oe,Z,u,$e,Ni,W,Rn,Di,qt,Mi,bl,Dr,wl,pt,vl,Mr,xl,An,Li,Sl,Lr,Br,Re,ji}from"./chunk-csymxc5a.js";import{hi,Hc,o,T,je,Lt,bn,Be,be,te,Er,wn,qs,Zc,Qc,xn,Pr,Xs,Gs,el,ki,tl,nl,rl,sl,ze,He,Js,We,s,_n,y,g,G,se,Te,R,Ai}from"./chunk-
|
|
2
|
+
import{Vt,ge,E,d,m,O,t,oe,Z,u,$e,Ni,W,Rn,Di,qt,Mi,bl,Dr,wl,pt,vl,Mr,xl,An,Li,Sl,Lr,Br,Re,ji}from"./chunk-csymxc5a.js";import{hi,Hc,o,T,je,Lt,bn,Be,be,te,Er,wn,qs,Zc,Qc,xn,Pr,Xs,Gs,el,ki,tl,nl,rl,sl,ze,He,Js,We,s,_n,y,g,G,se,Te,R,Ai}from"./chunk-eprhhrzc.js";import{Ht}from"./chunk-60yppcbb.js";import{Tn}from"./chunk-w3d7pwzg.js";import{x}from"./chunk-xpzt4wwb.js";import{xr,Ls}from"./chunk-hhbt8grm.js";import{Cc,Ec,br,st,Tc,M}from"./chunk-xr1yrdxy.js";import{ii,ai,ci,li}from"./chunk-6mkn81pd.js";import{vc,bs}from"./chunk-0489wcvq.js";import{gs,ms,hs}from"./chunk-f30bpj7a.js";import{xs,Zo,Qo,Ss,ks,ei}from"./chunk-2drcj9wn.js";import{ws,Ko}from"./chunk-zktbzwkv.js";import{Vo}from"./chunk-q1wxgw5s.js";import{de,Xo,Go,Jo}from"./chunk-vvxcebpn.js";import{gr,ke,Sc,mr,kc}from"./chunk-wa4w5bcn.js";import{V,nt}from"./chunk-4068rmzv.js";import{Rc,Ac}from"./chunk-j7q17ws8.js";import{A,Pn,Bi}from"./chunk-9fyw1xkh.js";import{D,c,f}from"./chunk-fd1bpv35.js";import Jn from"fs";import ae from"path";function mt(n){let e=Lt(n),l=e.find((S)=>S.closing&&S.name.toLowerCase()==="head");if(!l)return n;let a=new Set(["template","svg","noscript","math","textarea","title","xmp","iframe","noembed","noframes","plaintext"]),h=0,r=[];for(let S=0;S<e.length;S++){let v=e[S];if(v.start<l.end)continue;let k=v.name.toLowerCase();if(a.has(k)){h=Math.max(0,h+(v.closing?-1:v.selfClosing?0:1));continue}if(k!=="style"||v.closing||h>0)continue;let C=e[S+1];if(C?.name.toLowerCase()==="style"&&C.closing){if(/@scope\s*\{/.test(n.slice(v.end,C.start)))continue;r.push({start:v.start,end:C.end}),S++}}if(!r.length)return n;let p=r.map((S)=>n.slice(S.start,S.end)).join(`
|
|
3
3
|
`),w=[n.slice(0,l.start),p,`
|
|
4
4
|
`],b=l.start;for(let S of r)w.push(n.slice(b,S.start)),b=S.end;return w.push(n.slice(b)),w.join("")}function ht(){return`
|
|
5
5
|
// STX Lifecycle Runtime
|
|
@@ -1295,7 +1295,7 @@ ${L}
|
|
|
1295
1295
|
</style>`;a=a.replace(S,j),w.lastIndex=0}catch(L){}}}return a}import lt from"path";var Kn=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,Gn=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function Zn(n,e){if(!e||!n.includes("/"))return n;let l=lt.dirname(e);return n.replace(Kn,(a,h,r,p)=>{let w=lt.resolve(l,p);return`${h}${r}${w.split(lt.sep).join("/")}${r}`})}function fr(n,e){if(!e||!n.includes("<script"))return n;return n.replace(Gn,(l,a,h,r)=>`${a}${Zn(h,e)}${r}`)}var Me="<!--PARENT_CONTENT_PLACEHOLDER-->";function hr(n){return n.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Cr(n,e){let l=n.length,a=e,h=!0,r=[],p=(w)=>w+9<=l&&n[w]==="<"&&n[w+1]==="/"&&(n[w+2]==="s"||n[w+2]==="S")&&(n[w+3]==="c"||n[w+3]==="C")&&(n[w+4]==="r"||n[w+4]==="R")&&(n[w+5]==="i"||n[w+5]==="I")&&(n[w+6]==="p"||n[w+6]==="P")&&(n[w+7]==="t"||n[w+7]==="T")&&(n[w+8]===">"||/\s/.test(n[w+8]));while(a<l){let w=n[a];if(p(a))return a;if(w==="/"&&n[a+1]==="/"){if(a=n.indexOf(`
|
|
1296
1296
|
`,a+2),a===-1)return-1;a+=1,h=!0;continue}if(w==="/"&&n[a+1]==="*"){let b=n.indexOf("*/",a+2);if(b===-1)return-1;a=b+2,h=!0;continue}if(w==="/"&&h){let b=a+1,S=!1;while(b<l){let v=n[b];if(v==="\\"){b+=2;continue}if(v==="[")S=!0;else if(v==="]")S=!1;else if(v==="/"&&!S){b++;break}else if(v===`
|
|
1297
1297
|
`){b=-1;break}b++}if(b===-1){a++,h=!1;continue}while(b<l&&/[a-z]/.test(n[b]))b++;a=b,h=!1;continue}if(w==="'"||w==='"'){let b=w;a++;while(a<l){if(n[a]==="\\"){a+=2;continue}if(n[a]===b){a++;break}if(n[a]===`
|
|
1298
|
-
`)break;a++}h=!1;continue}if(w==="`"){a++;while(a<l){if(n[a]==="\\"){a+=2;continue}if(n[a]==="`"){a++;break}if(n[a]==="$"&&n[a+1]==="{"){r.push(!0),a+=2,h=!0;break}a++}if(r.length===0)h=!1;continue}if(w==="}"&&r.length>0){r.pop(),a++;while(a<l){if(n[a]==="\\"){a+=2;continue}if(n[a]==="`"){a++,h=!1;break}if(n[a]==="$"&&n[a+1]==="{"){r.push(!0),a+=2,h=!0;break}a++}continue}if(/\s/.test(w));else if(/[)\].\w$]/.test(w))h=!1;else h=!0;a++}return-1}function _r(n,e){let l=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`<script\\b(?=[^>]*\\b${l}(?:\\s|=|/?>))[^>]*>`,"i").exec(n);if(!a)return null;let h=a.index+a[0].length,r=n.indexOf("</script>",h);if(r===-1)return null;let p=n.indexOf(">",r);if(p===-1)return null;return{start:a.index,end:p+1}}var Qn=4096;async function ut(n,e,l){if(l.buildMode!=="serve"||e.length<Qn)return null;let{registerServeModuleBundle:a}=await import("./chunk-
|
|
1298
|
+
`)break;a++}h=!1;continue}if(w==="`"){a++;while(a<l){if(n[a]==="\\"){a+=2;continue}if(n[a]==="`"){a++;break}if(n[a]==="$"&&n[a+1]==="{"){r.push(!0),a+=2,h=!0;break}a++}if(r.length===0)h=!1;continue}if(w==="}"&&r.length>0){r.pop(),a++;while(a<l){if(n[a]==="\\"){a+=2;continue}if(n[a]==="`"){a++,h=!1;break}if(n[a]==="$"&&n[a+1]==="{"){r.push(!0),a+=2,h=!0;break}a++}continue}if(/\s/.test(w));else if(/[)\].\w$]/.test(w))h=!1;else h=!0;a++}return-1}function _r(n,e){let l=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`<script\\b(?=[^>]*\\b${l}(?:\\s|=|/?>))[^>]*>`,"i").exec(n);if(!a)return null;let h=a.index+a[0].length,r=n.indexOf("</script>",h);if(r===-1)return null;let p=n.indexOf(">",r);if(p===-1)return null;return{start:a.index,end:p+1}}var Qn=4096;async function ut(n,e,l){if(l.buildMode!=="serve"||e.length<Qn)return null;let{registerServeModuleBundle:a}=await import("./chunk-60ezkjcz.js");return`<script ${n} src="${a(e)}"></script>`}async function cr(n,e,l,a){try{let{registeredModuleIdsIn:h,buildModuleRegistryScript:r}=await o("stx/client-module-registry",()=>import("./chunk-ts1jwj54.js")),p=[],w=await r(h(...n),{minify:Bi(e.buildMode,e.minifyClient),collectInputs:p});for(let b of p)l?.add(b);if(a)a.inputs=p,a.code=w??void 0;if(!w)return null;if(e.buildMode==="serve"){let{registerServeModuleBundle:b}=await import("./chunk-60ezkjcz.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${b(w)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${w.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}async function Yn(n,e,l,a){let h={modulesTag:null,modulesCode:null,storeTag:null,storeCode:null,composableTag:null,composableCode:null,frameworkScript:null};try{let{getFrameworkComposableScript:C}=await o("stx/framework-composables",()=>import("./chunk-hq4d1me0.js"));h.frameworkScript=await C(n)}catch{}let r=null;try{r=await o("stx/store-loader",()=>import("./chunk-kp12tsn0.js"))}catch{}let p=e.storesDir,w=!!a.__stx_native_screen||(r?.pageStoresAll()??!0),b=w?"":n.replace(/<script\b[^>]*\bdata-stx-(?:runtime|router|hmr)\b[^>]*>[\s\S]*?<\/script>/gi,""),S=[],v=[],k=null;for(let C=0;C<8;C++){let _=null,P="",I=!1;try{if(r){let F=w?await r.getStoreScript(p).then((q)=>q?{code:q,stores:["*"],functions:null}:null):await r.getStoreScriptFor(p,[b],{reads:r.storesReadInFiles([...S,...v]),runOnce:!0});if(F)_=F.code,P=F.stores.join(","),I=!!F.functions&&!w}}catch{}if(k!==null&&P===k)break;k=P;let L=I?'data-stx-scoped data-stx-run="always" data-stx-stores':"data-stx-stores",j=_?`<script ${L}>${_}</script>`:null;h.storeCode=_,h.storeTag=_?await ut(L,_,e)??j:null;let B={};h.modulesTag=await cr([n,j],e,l,B),h.modulesCode=B.code??null,S=B.inputs??[],h.composableTag=null,h.composableCode=null,v=[];try{let{getComposableScript:F}=await o("stx/composable-loader",()=>import("./chunk-y0a8hex3.js")),q=e.composablesDir,H=[h.modulesCode??h.modulesTag,j,h.frameworkScript].filter((U)=>U!==null),N=await F(e._layerComposableDirs??q,n,H,v);if(N)h.composableCode=N,h.composableTag=await ut('data-stx-scoped data-stx-run="always" data-stx-composables',N,e)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${N}</script>`}catch{}if(w||!r)break}return h}async function es(n,e,l,a={}){let{withModuleSubstitutes:h,moduleSubstitutionKey:r}=await import("./chunk-k0ph8zr7.js"),p=await import("./chunk-m9cperj4.js"),{messages:w,webModules:b}=e,S=null,v=null,k=r()===""&&!a.__stx_native_screen;if(w&&p.pageMessagesEnabled(e)&&k)try{S=await p.loadPageMessages(process.cwd(),w)}catch(L){ts(L)}if(b&&Object.keys(b).length&&k)try{v=await(await import("./chunk-8hhhmscy.js")).loadWebModules(process.cwd(),b)}catch(L){rs(L)}let C=new Map([...v??[],...S?.stubs??[]]),_=()=>Yn(n,e,l,a),P=C.size?await h(C,_):await _(),I=null;if(S){let L=p.messageAreasIn(P.modulesCode,P.storeCode,P.composableCode),j=p.pageMessagesScript(S,p.pageLanguages(n,S),L);if(j)I=await ut('data-stx-scoped data-stx-run="always" data-stx-messages',j,e)??`<script data-stx-scoped data-stx-run="always" data-stx-messages>${j.replace(/<\/script/gi,"<\\/script")}</script>`}return[I,P.modulesTag,P.storeTag,P.composableTag,P.frameworkScript].filter((L)=>L!==null)}var yr=!1;function ts(n){if(yr)return;yr=!0,console.warn(`[stx] messages: ${n instanceof Error?n.message:String(n)}; pages ship every language`)}var wr=!1;function rs(n){if(wr)return;wr=!0,console.warn(`[stx] ${n instanceof Error?n.message:String(n)}; pages bundle the real modules`)}function ns(n,e=""){let l=_r(n,"data-stx-runtime");if(!l)return n;let a=gr(n);if(a===-1||a===l.start){if(!e)return n;return n.slice(0,l.end)+e+n.slice(l.end)}if(a<l.start)return n.slice(0,a)+n.slice(l.start,l.end)+e+`
|
|
1299
1299
|
`+n.slice(a,l.start)+n.slice(l.end);let h=n.slice(l.start,l.end),r=n.slice(0,l.start)+n.slice(l.end),p=gr(r);if(p===-1)return h+e+`
|
|
1300
1300
|
`+r;return r.slice(0,p)+h+e+`
|
|
1301
1301
|
`+r.slice(p)}function ss(n){let e=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return n.replace(e,(l,a,h)=>{let r=n.slice(0,h);return r.lastIndexOf("<")>r.lastIndexOf(">")?`{{${a}}}`:`{<!--stx-literal-->{${a}}}`})}async function i(n,e,l,a,h){if(await E(),a.ssr===!1&&!a.autoShell&&a.buildMode==="spa")return n;if(e.__stx_signals_gate===void 0)e.__stx_signals_gate=Te(n,l);let r=!e.__stxProcessingDepth;xn(e);for(let p of a._layerGraph?.configDependencies??[])h.add(p);if(r&&a.runtimeConfig)await Tn(e,l,a.runtimeConfig);if(r)rl(e),e.__stx_scope_seq??={n:0,key:Js(String(e.__filename??l))},e.__stx_head_injections=Mi(),e.__stx_seo_staged=!1;if(!e.__stxProcessingDepth)e.__stxProcessingDepth=0;if(e.__stxProcessingDepth++,!e.__onceStore)e.__onceStore=new Set;if((a.debug||!A()&&!Pn())&&l&&l.endsWith(".stx"))Vo(n,l);try{return await ge.timeAsync("template-processing",async()=>{let p=await is(n,e,l,a,h);if(r)p=ki(p);if(r&&a.autoShell&&a.buildMode!=="compile"){let w=Re(a.app?.head,{known:Br,source:"app.head"}),S=(e.__stx_runtime_head||null)??ji(),v=(e.__stx_head_raw||"").trim(),k,C=v.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(C)k=C[1].trim(),v=v.replace(C[0],"").trim();let _=e.__sections?.title,P=_?R(_,e,l):void 0,I=S.title||k||P,L=!S.title&&(!!k||!!P),j=S.meta||[],B=new Set(j.map((K)=>pt(K)).filter(Boolean)),F={...w,...I&&{title:I},meta:[...(w.meta||[]).filter((K)=>!B.has(pt(K))),...j],link:[...w.link||[],...S.link||[]],script:[...w.script||[],...S.script||[]],headRaw:[w.headRaw,v].filter(Boolean).join(`
|
|
@@ -1310,7 +1310,7 @@ ${b.trim()}
|
|
|
1310
1310
|
@endsection`}}if(j&&b.includes("<script")){let H=te(b),N=H.scripts.map((U)=>vr(U,l)??U);b=Er(H.output,N)}if(b=b.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(H,N,U)=>(L[N]=U,"")),b=b.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(H,N,U)=>{if(/^(['"]).*\1$/.test(U.trim()))return H;try{let K=d(U.trim(),e);if(K===void 0)return H;let J=(e.__stx_inline_section_values??=[]).push(K)-1;return L[N]=`{{ __stx_inline_section_values[${J}] }}`,""}catch{return H}}),b=b.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(H,N,U)=>{if(U.includes("@parent"))L[N]=U.replace("@parent",Me);else L[N]=U.trim();return""}),e.__sections=L,b=b.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(H,N,U)=>L[N]||U||""),!("slot"in e)||e.slot===void 0)b=b.replace(/\{\{\s*slot\s*\}\}/g,()=>L.content||"");if(b=hs(b,I),j){let H=[],N=te(b),U=be(N.output,bn,(K,le)=>`\x00STX_ORPHAN_STYLE_${le}\x00`);if(b=U.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(K,le,J)=>{let ue=le==="SCRIPT"?vr(N.scripts[Number(J)],l):U.tokens[Number(J)];if(ue)H.push(ue);return""}),H.length>0){let K=H.join(`
|
|
1311
1311
|
`);L.content=L.content?`${L.content}
|
|
1312
1312
|
${K}`:K,e.__sections=L}}if(j)try{let H;if(ae.isAbsolute(j))H=j,h.add(j);else H=await $e(()=>_n(j,l,p,h),null,()=>{throw new oe(`Failed to resolve layout path: ${j}`,l,void 0,void 0,`Layout referenced from ${l}`)});if(!H){let ce=(Q)=>{if(!Q)return[];try{let ve=ae.isAbsolute(Q)?Q:ae.resolve(process.cwd(),Q);return Jn.readdirSync(ve).filter((Ee)=>Ee.endsWith(".stx")).map((Ee)=>Ee.replace(/\.stx$/,""))}catch{return[]}},re=[...ce(p.layoutsDir),...ce(p.fallbackLayoutsDir)].filter((Q,ve,Ee)=>Ee.indexOf(Q)===ve).sort(),we=[p.layoutsDir,p.fallbackLayoutsDir].filter((Q)=>typeof Q==="string"&&Q.length>0),fe=we.length>0?` Searched: ${we.join(", ")} (set \`layoutsDir\` to look elsewhere).`:"",ne=`Layout not found: ${j} (referenced from ${l})`+(re.length>0?`. Available layouts: ${re.join(", ")}`:p.layoutsDir?`. No .stx layouts found in ${p.layoutsDir}`:"")+fe;if(W.log(Error(ne),{layoutPath:j,filePath:l,available:re},"error"),console.error(`[stx] ${ne}`),p.debug)throw new oe(ne,l);return b}let N=await $e(()=>Bun.file(H).text(),"",()=>{throw new oe(`Failed to read layout file: ${H}`,l,void 0,void 0,"Layout content could not be loaded")});N=fr(N,H),N=N.replace(/\{\{--[\s\S]*?--\}\}/g,"");let U=Array.isArray(e.__layoutChain)?e.__layoutChain:[];if(U.includes(H)){let ce=[...U.slice(U.indexOf(H)),H];throw new oe(ce.length===2?`Circular layout: ${H} extends itself`:`Circular layout: ${ce.join(" -> ")}`,l,void 0,void 0,"Remove the @extends or @layout line that points back at a layout already in use")}let K=N.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(K){if(p.debug)console.log(`Found nested layout: ${K[1]} in ${H}`);let ce={},re=N.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ne,Q,ve)=>(ce[Q]=ve.trim(),""));for(let[ne,Q]of Object.entries(ce))if(L[ne]&&L[ne].includes(Me)){let ve=L[ne].indexOf(Me);L[ne]=L[ne].slice(0,ve)+Q+L[ne].slice(ve+Me.length)}else if(!L[ne])L[ne]=Q;let we={...e,__sections:L,__layoutChain:[...U,H]},fe=`@layout('${K[1]}')${re}`;return await i(fe,we,H,p,h)}let le=N.replace(/\{\{--[\s\S]*?--\}\}/g,""),J=ms(le,I),ue={};return J=J.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ce,re,we)=>(ue[re]=we.trim(),`@slot('${re}')`)),J=J.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(ce,re,we)=>{if(L[re]){let fe=L[re];if(fe.includes(Me)){let ne=ue[re]||"",Q=fe.indexOf(Me);fe=fe.slice(0,Q)+ne+fe.slice(Q+Me.length)}return fe}return we||""}),J=os(J,L),J=J.replace(/\{\{\s*slot\s*\}\}/g,()=>L.content||""),J=hs(J,I),e.__originalFilePath=l,b=await $r(J,e,H,p,h),b=`<!-- stx-layout: ${j} -->
|
|
1313
|
-
${b}`,k(b)}catch(H){if(H instanceof Z)throw H;throw new oe(`Error processing layout ${j}: ${H instanceof Error?H.message:String(H)}`,l)}return k(await $r(b,e,l,p,h))}function os(n,e){return n.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(l,a,h)=>{let r=e[a];if(r!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(r))return r}return h||""})}function as(n,e){if(n.__stx_sfc_mode=!0,n.__stx_options=e,e.buildMode)n.__stx_buildMode=e.buildMode;let l=e.envPrefix||"STX_PUBLIC_",a={};for(let[h,r]of Object.entries(process.env))if(h.startsWith(l)&&r!==void 0)a[h]=r;n.$env=a}async function cs(n,e){await $e(()=>Yt(n,e),void 0,(l)=>{W.log(l,{filePath:n,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${n}: ${l.message}`)})}var dt="data-stx-source";function vr(n,e){if(!n)return n;let l=/^<script\b([^>]*)>/i.exec(n);if(!l||!/\bserver\b/.test(l[1])||l[1].includes(dt))return n;return`<script ${dt}="${encodeURIComponent(e)}"${n.slice(7)}`}function ls(n){let e=new RegExp(`${dt}="([^"]*)"`).exec(n);return e?decodeURIComponent(e[1]):void 0}function kr(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Sr(n,e,l){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> ${e==="module-resolution"?"imports a module that does not resolve":e==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${kr(n)}</span><span style="display:block;margin-top:4px">${kr(l)}</span></div>`}async function us(n,e,l,a){let{scanScriptTags:h}=await o("stx/signal-processing",()=>import("./chunk-
|
|
1313
|
+
${b}`,k(b)}catch(H){if(H instanceof Z)throw H;throw new oe(`Error processing layout ${j}: ${H instanceof Error?H.message:String(H)}`,l)}return k(await $r(b,e,l,p,h))}function os(n,e){return n.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(l,a,h)=>{let r=e[a];if(r!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(r))return r}return h||""})}function as(n,e){if(n.__stx_sfc_mode=!0,n.__stx_options=e,e.buildMode)n.__stx_buildMode=e.buildMode;let l=e.envPrefix||"STX_PUBLIC_",a={};for(let[h,r]of Object.entries(process.env))if(h.startsWith(l)&&r!==void 0)a[h]=r;n.$env=a}async function cs(n,e){await $e(()=>Yt(n,e),void 0,(l)=>{W.log(l,{filePath:n,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${n}: ${l.message}`)})}var dt="data-stx-source";function vr(n,e){if(!n)return n;let l=/^<script\b([^>]*)>/i.exec(n);if(!l||!/\bserver\b/.test(l[1])||l[1].includes(dt))return n;return`<script ${dt}="${encodeURIComponent(e)}"${n.slice(7)}`}function ls(n){let e=new RegExp(`${dt}="([^"]*)"`).exec(n);return e?decodeURIComponent(e[1]):void 0}function kr(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Sr(n,e,l){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> ${e==="module-resolution"?"imports a module that does not resolve":e==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${kr(n)}</span><span style="display:block;margin-top:4px">${kr(l)}</span></div>`}async function us(n,e,l,a){let{scanScriptTags:h}=await o("stx/signal-processing",()=>import("./chunk-3t91wwbe.js")),r=[],p=!A()&&!Pn();for(let b of h(n)){let S=b.attrs;if(!/\bserver\b/.test(S))continue;let v=b.start+b.fullMatch.indexOf(">")+1,k=Cr(n,v);if(k===-1)continue;let C=n.slice(v,k);if(!C.trim())continue;let _=ls(S)??l,P={index:b.start,length:k+9-b.start};try{let{extractVariables:I}=await o("stx/variable-extractor",()=>import("./chunk-df49nnj9.js"));await I(C,e,_,{preserveExisting:!0,onFailure:(L)=>{if(L.kind==="unknown")return;if(a?.onServerScriptError?.({sourcePath:_,kind:L.kind,message:L.message}),!p)return;r.push({...P,markup:Sr(_,L.kind,L.message)})}})}catch(I){let L=I instanceof Error?I:Error(String(I));if(W.log(L,{filePath:_,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${_}: ${L.message}`),p)r.push({...P,markup:Sr(_,"unknown",L.message)})}}if(r.length===0)return n;let w=n;for(let b of r.sort((S,v)=>v.index-S.index))w=w.slice(0,b.index)+b.markup+w.slice(b.index+b.length);return w}async function ds(n,e,l){try{let{interpolateScriptsInTemplate:a}=await o("stx/expressions",()=>import("./chunk-z347p6cg.js"));return a(n,e,{skipServer:!0})}catch(a){let h=a instanceof Error?a:Error(String(a));return W.log(h,{filePath:l,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${l}: ${h.message}`),n}}async function $r(n,e,l,a,h){let r=n;await E();let p=a;if(r=await us(r,e,l,a),r=await Wt(r,e,l),r=await Xt(r,e,l),r=await ds(r,e,l),await E(),r=await Dt(r,e,l,p),Te(r))r=Zo(r,e),r=ks(r,e),r=Ss(r,e);r=Qo(r),await E();let{processStreamDirectives:w}=await o("stx/streaming",()=>import("./chunk-9kghtf20.js"));r=w(r,e),r=await Ko(r,e,l,p,!0),await E(),r=await ir(r,e,l,p,h),r=await bs(r,e,l,p,h),await E(),r=Cc(r,e,l,p);let{processDeferDirectives:b}=await o("stx/defer",()=>import("./chunk-6pczzq5f.js"));r=b(r,e,l);let{processTeleportDirectives:S}=await o("stx/teleport",()=>import("./chunk-ba91r7q9.js"));r=S(r,e,l);let{processTransitionDirectives:v,processTransitionAttributes:k}=await o("stx/transitions",()=>import("./chunk-7wqevtks.js"));r=v(r,e,l),r=k(r);let{processErrorBoundaryDirectives:C,stripRenderFailedMarkers:_}=await o("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));r=C(r,e,l),r=_(r);let{processSuspenseDirectives:P}=await o("stx/suspense",()=>import("./chunk-j4zrq17p.js"));r=P(r,e,l);let{processAsyncDirectives:I}=await o("stx/async-components",()=>import("./chunk-f52b9hjv.js"));r=I(r,e,l);let{processKeepAliveDirectives:L}=await o("stx/keep-alive",()=>import("./chunk-meqsd5bt.js"));r=L(r,e,l);let{processVirtualListDirectives:j,processVirtualGridDirectives:B,processInfiniteListDirectives:F}=await o("stx/virtual-scrolling",()=>import("./chunk-2asyyky3.js"));r=j(r,e,l),r=B(r,e,l),r=F(r,e,l),await E();let{processPartialHydrationDirectives:q,processStaticDirectives:H}=await o("stx/partial-hydration",()=>import("./chunk-73k579v7.js"));r=q(r,e,l),r=H(r);let{processComputedDirectives:N,processWatchDirectives:U}=await o("stx/computed",()=>import("./chunk-1xdzcy9d.js"));r=N(r,e,l),r=U(r,e,l);let{processFormValidationDirectives:K}=await o("stx/forms-validation",()=>import("./chunk-d3mmnzwy.js"));r=K(r,e,l);let{processHeadDirective:le,processTitleDirective:J,processMetaDirective:ue,resetHead:ce}=await o("stx/head",()=>import("./chunk-4v70bs2q.js"));if(!e.__stx_head_preset&&!e.__stx_runtime_head)ce();let re=le(r);if(r=re.content,re.headContent)e.__stx_head_raw=`${e.__stx_head_raw||""}${re.headContent}
|
|
1314
1314
|
`;if(r=J(r,e),r=ue(r,e,l),r=Qt(r),r=Xo(r,e),r=Mt(r),r=Kt(r),r=await gs(r,e,l,p,h),r=await bs(r,e,l,p,h),await E(),r=r.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),r=ki(r),r=de(r,e,l),r=ws(r),await E(),e.__stxProcessingDepth===1)r=sl(r,e);if(r=Zc(r,e,{filePath:l,buildMode:p.buildMode}),r=Go(r,e),r=Jo(r,e),r=Ze(r,e),r=Ft(r,e),r=Ut(r,e),r=await St(r,e,l,p),r=await Tc(r,e,l),r=await Rc(r,e,l,p),await E(),r=Ac(r,e,l,p),r=ii(r,e,l,p),r=ai(r,e,l),r=ci(r,e,l,p),r=At(r,e,l,p),r=Xs(r,e),r=Gs(r),r=el(r),!p.skipEventDirectives)r=Hc(r,e,l);if(r=Qc(r,e,l,a.skipSignalsRuntime===!0&&Number(e.__stxProcessingDepth)>0),await E(),p.debug){let X=/\bx-data\s*=/.test(r),z=xs(n);if(X&&z)console.warn(`[stx] ${l}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
1315
1315
|
Both work on the same page, but they manage separate scopes.
|
|
1316
1316
|
Prefer signals (state/derived/effect) for new components.`)}r=vc(r,e),r=await Ai(r,e,l),await E(),r=tl(r),r=nl(r),r=wt(r);let{processXElementDirectives:we}=await o("stx/x-element",()=>import("./chunk-b666d8m6.js"));r=we(r);let fe=e.__originalFilePath||l,ne=ze(e);if(r=await ei(r,p,fe,ne),await E(),r=jt(r,e),r=await Jt(r,e,l,p),await E(),p.media?.image?.autoSiblings){let X=p.publicDir||"public",{rewriteImagesWithSiblings:z}=await o("stx/image-optimization/auto-sibling",()=>import("./chunk-ytzzth34.js"));r=await z(r,{publicDir:X})}if(p.seo?.enabled)r=li(r,e,p);let Q=(X,z,Y=!0)=>{if(!z)return X;let ye=z.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),ie=/<head\b[^>]*>[\s\S]*?(?:<\/head\s*>|<body\b|$)/i.exec(X),me=ie?/<title\b[^>]*>[\s\S]*?<\/title>/i.exec(ie[0]):null;if(ye&&ie&&me){if(Y){let De=ie.index+me.index;X=X.slice(0,De)+ye[0]+X.slice(De+me[0].length)}if(z=z.replace(ye[0],"").trim(),!z)return X}if(/<\/head>/i.test(X))return f(X,z);if(/<head\b[^>]*>/i.test(X))return X.replace(/(<head\b[^>]*>)/i,`$1
|
|
@@ -1322,6 +1322,6 @@ ${ht()}
|
|
|
1322
1322
|
</script>`;if(r.includes("</head>")){let Y=D(r),ie=r.slice(0,Y).indexOf("<script");if(ie!==-1){let me=r.slice(0,ie),De=r.slice(ie);r=me+z+`
|
|
1323
1323
|
`+De}else r=f(r,z)}else if(r.includes("<body"))r=r.replace(/<body([^>]*)>/,`<body$1>
|
|
1324
1324
|
${z}`);else r=z+`
|
|
1325
|
-
`+r}{let{scanScriptTags:X}=await o("stx/signal-processing",()=>import("./chunk-
|
|
1325
|
+
`+r}{let{scanScriptTags:X}=await o("stx/signal-processing",()=>import("./chunk-3t91wwbe.js")),z=[];for(let Y of X(r)){if(!/\bserver\b/i.test(Y.attrs))continue;let ye=Y.start+Y.fullMatch.indexOf(">")+1,ie=Cr(r,ye);if(ie===-1)continue;let me=ie+9;while(me<r.length&&/\s/.test(r[me]))me++;z.push({start:Y.start,end:me})}if(z.length>0){let Y=Array(z.length+1),ye=0;for(let ie=0;ie<z.length;ie++){let{start:me,end:De}=z[ie];Y[ie]=r.slice(ye,me),ye=De}Y[z.length]=r.slice(ye),r=Y.join("")}}let ft=qs(r,l);if(ft.hasScoped)r=ft.html;let Ir=e.__stx_event_bindings||[],Qe=!1,gt=[],Or=/\s:[a-z][\w.-]*\s*=/.test(r),{scanScriptTags:jr}=await o("stx/signal-processing",()=>import("./chunk-3t91wwbe.js"));for(let X of jr(r,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))gt.push({match:X.fullMatch,attrs:X.attrs,content:X.body});for(let{match:X,attrs:z,content:Y}of gt){Qe=!0;let ye=Y;je(Y,l,a.strict,e.__originalFilePath);let ie=await He(Y,{eventBindings:Ir,attrs:z,hasColonDirectives:Or,templateContent:n,filePath:l,projectRoot:process.cwd(),production:Bi(a.buildMode,a.minifyClient),serverData:ne});r=r.replace(X,()=>ie)}if(Qe)e.__stx_event_bindings=[];if(!Qe&&e.__stxProcessingDepth===1){let X=e.__stx_event_bindings||[];if(X.length>0){let z=hi(X);if(z){let Y=c(r);r=Y===-1?r+z:r.slice(0,Y)+z+`
|
|
1326
1326
|
`+r.slice(Y)}e.__stx_event_bindings=[]}}if(!p.skipSignalsRuntime&&!ke(r)&&Sc(r))r=await mr(r,p);if(r=kc(r),p.csp?.enabled&&p.csp.useNonce&&typeof e.cspNonce==="string")r=Tt(r,e.cspNonce);return r}
|
|
1327
1327
|
export{kt,Ne,hc,ps,zo,Ho,cr,i};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Tn,Pi}from"./chunk-
|
|
2
|
+
import{Tn,Pi}from"./chunk-w3d7pwzg.js";import"./chunk-60yppcbb.js";export{Pi as generateRuntimeConfigTypes,Tn as prepareRuntimeConfig};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{qe,$n,Zs,Ii,B}from"./chunk-60yppcbb.js";import{Tn}from"./chunk-mm00bb1p.js";import{Fr,C,_l,ft,Fi,Cl}from"./chunk-qjey0jk6.js";import{N}from"./chunk-farh4p7f.js";import{P,E,Qs,d,m,Ut,p,Z,W,k,ro,Re,Xe,so}from"./chunk-csymxc5a.js";import{r,Y}from"./chunk-z9xe3xkg.js";import{b}from"./chunk-94mpe1ny.js";import{Q}from"./chunk-9fyw1xkh.js";import{c}from"./chunk-fd1bpv35.js";import ut from"path";import Vt from"process";import{AsyncLocalStorage as ma}from"async_hooks";var Dr=new ma;function xn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function Mr(e,t){return Dr.run(xn(e),t)}async function jr(e,t){let n=Dr.getStore();if(!n)throw Error("useServerData must run inside a <script server> render");if(typeof e!=="string"||!e.trim())throw TypeError("useServerData requires a non-empty string key");let i=n.pending.get(e);if(i)return i;let a=Promise.resolve().then(t).then((u)=>{let l=JSON.stringify(u,(x,v)=>{if(v===void 0||typeof v==="function"||typeof v==="symbol"||typeof v==="bigint"||typeof v==="number"&&!Number.isFinite(v))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(v&&typeof v==="object"&&!Array.isArray(v)&&Object.getPrototypeOf(v)!==Object.prototype&&Object.getPrototypeOf(v)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return v}),f=JSON.parse(l);return n.values.set(e,f),f}).catch((u)=>{throw n.pending.delete(e),u});return n.pending.set(e,a),a}function Pr(e){let t=e.__stx_server_data;if(!t?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(t.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function K(e,t=!1){let n=r(e),i=[],a=new Set,u=0,l=0,f=n.length,x=()=>{if(u!==0)return;let v=n.slice(l).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(v){if(t&&v[1]==="const")return;let z=v[2];if(!a.has(z))i.push(z),a.add(z);return}let A=n.slice(l).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){if(t&&n.slice(l).startsWith("const"))return;A[1].split(",").forEach((z)=>{let V=z.trim();if(!V)return;let F=V.indexOf(":"),H=(F>=0?V.slice(F+1).trim():V).split(/[\s=]/)[0];if(H&&!a.has(H))i.push(H),a.add(H)});return}let D=n.slice(l).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(D){if(t&&n.slice(l).startsWith("const"))return;D[1].split(",").forEach((z)=>{let V=z.trim().replace(/^\.\.\./,"");if(!V)return;let F=V.split(/[\s=]/)[0];if(F&&!a.has(F))i.push(F),a.add(F)});return}if(t)return;let U=n.slice(l).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(U){let z=U[1];if(!a.has(z))i.push(z),a.add(z);return}let O=n.slice(l).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let z=O[1];if(!a.has(z))i.push(z),a.add(z)}};while(l<f){if(n[l]==="{"){u++,l++;continue}if(n[l]==="}"){u--,l++;continue}if(u===0&&/[a-z]/i.test(n[l])&&(l===0||/\s|[;{}()]/.test(n[l-1])))x();l++}return i.join(", ")}function js(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function ha(e,t=K(e).split(",").map((n)=>n.trim()).filter(Boolean)){let n=new Set(K(e,!0).split(",").map((i)=>i.trim()));return t.map((i)=>n.has(i)?`get ${i}() { return ${i} }, set ${i}(__stxValue_${i}) { ${i} = __stxValue_${i} }`:i).join(", ")}function Bs(e,t){let n=`{ ${ha(e,t)} }`;return K(e).split(",").some((i)=>i.trim()==="__stxLiveBindings")?`Object.defineProperties(${n}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:n}import Ot from"fs";import ve from"path";function X(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var Nr=new Map;function _r(e,t=!0){let n=Nr.get(e);if(t&&n)return n;let i=new Map,a=[ve.join(e,"src"),ve.join(e,"dist"),e];function u(l,f){if(f>6)return;let x;try{x=Ot.readdirSync(l,{withFileTypes:!0})}catch{return}for(let v of x){let A=ve.join(l,v.name);if(v.isDirectory()){if(v.name==="node_modules"||v.name.startsWith("."))continue;u(A,f+1)}else if(v.isFile()&&v.name.endsWith(".stx")){let D=v.name.slice(0,-4);if(!i.has(D))i.set(D,A);let U=D.toLowerCase();if(!i.has(U))i.set(U,A);let O=X(D);if(!i.has(O))i.set(O,A)}}}for(let l of a)if(u(l,0),i.size>0)break;if(t)Nr.set(e,i);return i}function Fs(e,t){if(e.startsWith(".")||e.startsWith("/"))return null;let n=t;while(!0){let i=ve.join(n,"node_modules",e);try{if(Ot.statSync(i).isDirectory())return i}catch{}let a=ve.dirname(n);if(a===n)return null;n=a}}function zs(e,t,n={}){return[ve.resolve(ve.dirname(t),`${e}.stx`),ve.resolve(ve.dirname(t),e),ve.resolve(n.componentsDir||"components",`${e}.stx`),ve.resolve(n.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function Lr(e){let t=e.endsWith(".stx")?e.slice(0,-4):e,n=t.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),i=X(t);return[t,n,i]}function fi(e,t){let[n,i,a]=Lr(e);for(let u of[n,n.toLowerCase(),i,a]){let l=t?.__importedComponents?.get(u);if(l!==void 0)return l}}function gi(e,t){let n=t?ve.resolve(t):void 0,i=ve.dirname(ve.resolve(e));for(;;){if(Ot.existsSync(ve.join(i,"package.json")))return n&&i===n?void 0:i;let a=ve.dirname(i);if(a===i)return;i=a}}var xa=["src/ui","src/components","components","dist"];function zn(e,t){let n=ve.resolve(e);if(!t&&!n.split(ve.sep).includes("node_modules"))return[];let i=gi(n,t);if(!i)return[];let a=[];try{let f=JSON.parse(Ot.readFileSync(ve.join(i,"package.json"),"utf8")).stx?.components;if(Array.isArray(f))a=f.filter((x)=>typeof x==="string")}catch{}let u=a.length?a:xa;return[ve.dirname(ve.resolve(e)),...u.map((l)=>ve.resolve(i,l))]}function*mi(e,t,n={},i){let a=Lr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield ve.resolve(ve.dirname(t),`${a[0]}.stx`);return}let u=[...new Set(a.map((x)=>`${x}.stx`))],l=n.projectRoot||process.cwd(),f=[...zn(t,n.projectRoot),...i?.__originalFilePath?[ve.join(ve.dirname(i.__originalFilePath),"components")]:[],...n.componentsDir?[n.componentsDir]:[],ve.join(ve.dirname(t),"components"),ve.resolve(l,"src/components"),ve.resolve(l,"components"),...import.meta.dir?[ve.resolve(import.meta.dir,"components")]:[]];for(let x of new Set(f)){for(let v of u)yield ve.join(x,v);try{for(let v of Ot.readdirSync(x,{withFileTypes:!0}))if(v.isDirectory())for(let A of u)yield ve.join(x,v.name,A)}catch{}}}function zr(e,t,n={},i){let a=fi(e,i);if(a!==void 0)return a;for(let u of mi(e,t,n,i))try{if(Ot.statSync(u,{throwIfNoEntry:!1})?.isFile())return u}catch{}return null}function Hs(e,t=[],n={}){let i=new Set([...e].map((v)=>v.replace(/[-_]/g,"").toLowerCase()));if(!i.has("src")&&!i.has("source")||!i.has("alt")&&!i.has("decorative"))return!1;let a=new Map(Object.entries(n).map(([v,A])=>[v.replace(/[-_]/g,"").toLowerCase(),A])),u=a.get("alt"),l=a.get("decorative"),f=typeof u==="string"&&!!u.trim(),x=typeof l==="string"?!["false","0","off","no"].includes(l.trim().toLowerCase()):Boolean(l);if(!f&&!x)return!1;if(["defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((v)=>i.has(v)))return!1;if([...t].some((v)=>!["load","error"].includes(v.replace(/^@/,"").split(".")[0].toLowerCase())))return!1;if(i.has("resizemode")&&(i.has("fit")||i.has("objectfit")))return!1;if(i.has("src")&&i.has("source"))return!1;return["fit","objectfit","resizemode","position","objectposition","rounded","aspectratio","zoomonhover","sources","webpsrc","webpsrcset"].some((v)=>i.has(v))}import is from"fs";import ue from"path";import Et from"path";import sn from"fs";var ba=new Set(["touchstart","touchmove","wheel","mousewheel"]);function ys(e,t){if(t.passive)return!0;if(t.prevent||t.nonpassive)return!1;return ba.has(e.toLowerCase())}var Br=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"]),Wr={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"},ya=new Set(["ctrl","alt","shift","meta"]),Hr={left:0,middle:1,right:2};function Vr(e){let t={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let n of e){let i=n.toLowerCase();if(i==="prevent")t.prevent=!0;else if(i==="stop")t.stop=!0;else if(i==="once")t.once=!0;else if(i==="capture")t.capture=!0;else if(i==="self")t.self=!0;else if(i==="passive")t.passive=!0;else if(i==="nonpassive")t.nonpassive=!0;else if(ya.has(i))t.systemKeys.push(i);else if(i in Hr)t.mouse=i;else if(i in Wr||/^[a-z]$/.test(i))t.keys.push(Wr[i]||i.toUpperCase());else if(i.startsWith("debounce")){let a=i.match(/debounce(?:\.(\d+))?/);t.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(i.startsWith("throttle")){let a=i.match(/throttle(?:\.(\d+))?/);t.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return t}function qr(e,t=""){let n=[],i=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,u;while((u=a.exec(e))!==null){let[l,f,x]=u,v=u.index,A=v+l.length,D=`__stx_evt_${t}${i++}`,U=[],O=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,z;while((z=O.exec(x))!==null){let[,F,q]=z,H=F.split("."),M=H[0];if(!Br.has(M))continue;U.push({attribute:`@${F}`,event:M,handler:q,modifiers:Vr(H.slice(1)),elementId:D})}let V=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((z=V.exec(x))!==null){let[,F,q]=z,H=F.split("."),M=H[0];if(!Br.has(M))continue;U.push({attribute:`@${F}`,event:M,handler:q,modifiers:Vr(H.slice(1)),elementId:D})}if(U.length>0)n.push({originalTag:l,elementId:D,events:U,startIndex:v,endIndex:A})}return n}function _a(e){let t=[],{modifiers:n}=e;if(n.self)t.push("if ($event.target !== $el) return");for(let i of n.systemKeys)t.push(`if (!$event.${i}Key) return`);if(n.keys.length>0){let i=n.keys.map((a)=>`$event.key === '${a}'`).join(" || ");t.push(`if (!(${i})) return`)}if(n.mouse!==null){let i=Hr[n.mouse];t.push(`if ($event.button !== ${i}) return`)}if(n.prevent)t.push("$event.preventDefault()");if(n.stop)t.push("$event.stopPropagation()");return t.join("; ")}function wa(e,t){let n=e;if(t.debounce!==null)n=`__stx_debounce(() => { ${n} }, ${t.debounce})`;else if(t.throttle!==null)n=`__stx_throttle(() => { ${n} }, ${t.throttle})`;return n}function _s(e){let t=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(t))return e;return`if (typeof ${t} === 'function' && !${t}._isSignal) ${t}($event);`}function Sa(e){let{modifiers:t}=e,n=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),i=_a(e),a=wa(_s(e.handler),t),u=[];if(t.once)u.push("once: true");if(t.capture)u.push("capture: true");if(ys(e.event,t))u.push("passive: true");let l=u.length>0?`, { ${u.join(", ")} }`:"",f=a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
|
|
2
|
+
import{qe,$n,Zs,Ii,B}from"./chunk-60yppcbb.js";import{Tn}from"./chunk-w3d7pwzg.js";import{Fr,C,_l,ft,Fi,Cl}from"./chunk-qjey0jk6.js";import{N}from"./chunk-farh4p7f.js";import{P,E,Qs,d,m,Ut,p,Z,W,k,ro,Re,Xe,so}from"./chunk-csymxc5a.js";import{r,Y}from"./chunk-z9xe3xkg.js";import{b}from"./chunk-94mpe1ny.js";import{Q}from"./chunk-9fyw1xkh.js";import{c}from"./chunk-fd1bpv35.js";import ut from"path";import Vt from"process";import{AsyncLocalStorage as ma}from"async_hooks";var Dr=new ma;function xn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function Mr(e,t){return Dr.run(xn(e),t)}async function jr(e,t){let n=Dr.getStore();if(!n)throw Error("useServerData must run inside a <script server> render");if(typeof e!=="string"||!e.trim())throw TypeError("useServerData requires a non-empty string key");let i=n.pending.get(e);if(i)return i;let a=Promise.resolve().then(t).then((u)=>{let l=JSON.stringify(u,(x,v)=>{if(v===void 0||typeof v==="function"||typeof v==="symbol"||typeof v==="bigint"||typeof v==="number"&&!Number.isFinite(v))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(v&&typeof v==="object"&&!Array.isArray(v)&&Object.getPrototypeOf(v)!==Object.prototype&&Object.getPrototypeOf(v)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return v}),f=JSON.parse(l);return n.values.set(e,f),f}).catch((u)=>{throw n.pending.delete(e),u});return n.pending.set(e,a),a}function Pr(e){let t=e.__stx_server_data;if(!t?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(t.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function K(e,t=!1){let n=r(e),i=[],a=new Set,u=0,l=0,f=n.length,x=()=>{if(u!==0)return;let v=n.slice(l).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(v){if(t&&v[1]==="const")return;let z=v[2];if(!a.has(z))i.push(z),a.add(z);return}let A=n.slice(l).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){if(t&&n.slice(l).startsWith("const"))return;A[1].split(",").forEach((z)=>{let V=z.trim();if(!V)return;let F=V.indexOf(":"),H=(F>=0?V.slice(F+1).trim():V).split(/[\s=]/)[0];if(H&&!a.has(H))i.push(H),a.add(H)});return}let D=n.slice(l).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(D){if(t&&n.slice(l).startsWith("const"))return;D[1].split(",").forEach((z)=>{let V=z.trim().replace(/^\.\.\./,"");if(!V)return;let F=V.split(/[\s=]/)[0];if(F&&!a.has(F))i.push(F),a.add(F)});return}if(t)return;let U=n.slice(l).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(U){let z=U[1];if(!a.has(z))i.push(z),a.add(z);return}let O=n.slice(l).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let z=O[1];if(!a.has(z))i.push(z),a.add(z)}};while(l<f){if(n[l]==="{"){u++,l++;continue}if(n[l]==="}"){u--,l++;continue}if(u===0&&/[a-z]/i.test(n[l])&&(l===0||/\s|[;{}()]/.test(n[l-1])))x();l++}return i.join(", ")}function js(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function ha(e,t=K(e).split(",").map((n)=>n.trim()).filter(Boolean)){let n=new Set(K(e,!0).split(",").map((i)=>i.trim()));return t.map((i)=>n.has(i)?`get ${i}() { return ${i} }, set ${i}(__stxValue_${i}) { ${i} = __stxValue_${i} }`:i).join(", ")}function Bs(e,t){let n=`{ ${ha(e,t)} }`;return K(e).split(",").some((i)=>i.trim()==="__stxLiveBindings")?`Object.defineProperties(${n}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:n}import Ot from"fs";import ve from"path";function X(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var Nr=new Map;function _r(e,t=!0){let n=Nr.get(e);if(t&&n)return n;let i=new Map,a=[ve.join(e,"src"),ve.join(e,"dist"),e];function u(l,f){if(f>6)return;let x;try{x=Ot.readdirSync(l,{withFileTypes:!0})}catch{return}for(let v of x){let A=ve.join(l,v.name);if(v.isDirectory()){if(v.name==="node_modules"||v.name.startsWith("."))continue;u(A,f+1)}else if(v.isFile()&&v.name.endsWith(".stx")){let D=v.name.slice(0,-4);if(!i.has(D))i.set(D,A);let U=D.toLowerCase();if(!i.has(U))i.set(U,A);let O=X(D);if(!i.has(O))i.set(O,A)}}}for(let l of a)if(u(l,0),i.size>0)break;if(t)Nr.set(e,i);return i}function Fs(e,t){if(e.startsWith(".")||e.startsWith("/"))return null;let n=t;while(!0){let i=ve.join(n,"node_modules",e);try{if(Ot.statSync(i).isDirectory())return i}catch{}let a=ve.dirname(n);if(a===n)return null;n=a}}function zs(e,t,n={}){return[ve.resolve(ve.dirname(t),`${e}.stx`),ve.resolve(ve.dirname(t),e),ve.resolve(n.componentsDir||"components",`${e}.stx`),ve.resolve(n.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function Lr(e){let t=e.endsWith(".stx")?e.slice(0,-4):e,n=t.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),i=X(t);return[t,n,i]}function fi(e,t){let[n,i,a]=Lr(e);for(let u of[n,n.toLowerCase(),i,a]){let l=t?.__importedComponents?.get(u);if(l!==void 0)return l}}function gi(e,t){let n=t?ve.resolve(t):void 0,i=ve.dirname(ve.resolve(e));for(;;){if(Ot.existsSync(ve.join(i,"package.json")))return n&&i===n?void 0:i;let a=ve.dirname(i);if(a===i)return;i=a}}var xa=["src/ui","src/components","components","dist"];function zn(e,t){let n=ve.resolve(e);if(!t&&!n.split(ve.sep).includes("node_modules"))return[];let i=gi(n,t);if(!i)return[];let a=[];try{let f=JSON.parse(Ot.readFileSync(ve.join(i,"package.json"),"utf8")).stx?.components;if(Array.isArray(f))a=f.filter((x)=>typeof x==="string")}catch{}let u=a.length?a:xa;return[ve.dirname(ve.resolve(e)),...u.map((l)=>ve.resolve(i,l))]}function*mi(e,t,n={},i){let a=Lr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield ve.resolve(ve.dirname(t),`${a[0]}.stx`);return}let u=[...new Set(a.map((x)=>`${x}.stx`))],l=n.projectRoot||process.cwd(),f=[...zn(t,n.projectRoot),...i?.__originalFilePath?[ve.join(ve.dirname(i.__originalFilePath),"components")]:[],...n.componentsDir?[n.componentsDir]:[],ve.join(ve.dirname(t),"components"),ve.resolve(l,"src/components"),ve.resolve(l,"components"),...import.meta.dir?[ve.resolve(import.meta.dir,"components")]:[]];for(let x of new Set(f)){for(let v of u)yield ve.join(x,v);try{for(let v of Ot.readdirSync(x,{withFileTypes:!0}))if(v.isDirectory())for(let A of u)yield ve.join(x,v.name,A)}catch{}}}function zr(e,t,n={},i){let a=fi(e,i);if(a!==void 0)return a;for(let u of mi(e,t,n,i))try{if(Ot.statSync(u,{throwIfNoEntry:!1})?.isFile())return u}catch{}return null}function Hs(e,t=[],n={}){let i=new Set([...e].map((v)=>v.replace(/[-_]/g,"").toLowerCase()));if(!i.has("src")&&!i.has("source")||!i.has("alt")&&!i.has("decorative"))return!1;let a=new Map(Object.entries(n).map(([v,A])=>[v.replace(/[-_]/g,"").toLowerCase(),A])),u=a.get("alt"),l=a.get("decorative"),f=typeof u==="string"&&!!u.trim(),x=typeof l==="string"?!["false","0","off","no"].includes(l.trim().toLowerCase()):Boolean(l);if(!f&&!x)return!1;if(["defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((v)=>i.has(v)))return!1;if([...t].some((v)=>!["load","error"].includes(v.replace(/^@/,"").split(".")[0].toLowerCase())))return!1;if(i.has("resizemode")&&(i.has("fit")||i.has("objectfit")))return!1;if(i.has("src")&&i.has("source"))return!1;return["fit","objectfit","resizemode","position","objectposition","rounded","aspectratio","zoomonhover","sources","webpsrc","webpsrcset"].some((v)=>i.has(v))}import is from"fs";import ue from"path";import Et from"path";import sn from"fs";var ba=new Set(["touchstart","touchmove","wheel","mousewheel"]);function ys(e,t){if(t.passive)return!0;if(t.prevent||t.nonpassive)return!1;return ba.has(e.toLowerCase())}var Br=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"]),Wr={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"},ya=new Set(["ctrl","alt","shift","meta"]),Hr={left:0,middle:1,right:2};function Vr(e){let t={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let n of e){let i=n.toLowerCase();if(i==="prevent")t.prevent=!0;else if(i==="stop")t.stop=!0;else if(i==="once")t.once=!0;else if(i==="capture")t.capture=!0;else if(i==="self")t.self=!0;else if(i==="passive")t.passive=!0;else if(i==="nonpassive")t.nonpassive=!0;else if(ya.has(i))t.systemKeys.push(i);else if(i in Hr)t.mouse=i;else if(i in Wr||/^[a-z]$/.test(i))t.keys.push(Wr[i]||i.toUpperCase());else if(i.startsWith("debounce")){let a=i.match(/debounce(?:\.(\d+))?/);t.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(i.startsWith("throttle")){let a=i.match(/throttle(?:\.(\d+))?/);t.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return t}function qr(e,t=""){let n=[],i=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,u;while((u=a.exec(e))!==null){let[l,f,x]=u,v=u.index,A=v+l.length,D=`__stx_evt_${t}${i++}`,U=[],O=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,z;while((z=O.exec(x))!==null){let[,F,q]=z,H=F.split("."),M=H[0];if(!Br.has(M))continue;U.push({attribute:`@${F}`,event:M,handler:q,modifiers:Vr(H.slice(1)),elementId:D})}let V=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((z=V.exec(x))!==null){let[,F,q]=z,H=F.split("."),M=H[0];if(!Br.has(M))continue;U.push({attribute:`@${F}`,event:M,handler:q,modifiers:Vr(H.slice(1)),elementId:D})}if(U.length>0)n.push({originalTag:l,elementId:D,events:U,startIndex:v,endIndex:A})}return n}function _a(e){let t=[],{modifiers:n}=e;if(n.self)t.push("if ($event.target !== $el) return");for(let i of n.systemKeys)t.push(`if (!$event.${i}Key) return`);if(n.keys.length>0){let i=n.keys.map((a)=>`$event.key === '${a}'`).join(" || ");t.push(`if (!(${i})) return`)}if(n.mouse!==null){let i=Hr[n.mouse];t.push(`if ($event.button !== ${i}) return`)}if(n.prevent)t.push("$event.preventDefault()");if(n.stop)t.push("$event.stopPropagation()");return t.join("; ")}function wa(e,t){let n=e;if(t.debounce!==null)n=`__stx_debounce(() => { ${n} }, ${t.debounce})`;else if(t.throttle!==null)n=`__stx_throttle(() => { ${n} }, ${t.throttle})`;return n}function _s(e){let t=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(t))return e;return`if (typeof ${t} === 'function' && !${t}._isSignal) ${t}($event);`}function Sa(e){let{modifiers:t}=e,n=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),i=_a(e),a=wa(_s(e.handler),t),u=[];if(t.once)u.push("once: true");if(t.capture)u.push("capture: true");if(ys(e.event,t))u.push("passive: true");let l=u.length>0?`, { ${u.join(", ")} }`:"",f=a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
|
|
3
3
|
(function() {
|
|
4
4
|
var $el = document.getElementById('${n}');
|
|
5
5
|
if (!$el) return;
|
|
@@ -112,7 +112,7 @@ else {
|
|
|
112
112
|
`)}
|
|
113
113
|
})();
|
|
114
114
|
</script>`}function $a(e,t=""){let n=qr(e,t);if(n.length===0)return{template:e,bindings:[]};let i=e,a=[];for(let u=n.length-1;u>=0;u--){let l=n[u],f=l.originalTag;if(!f.includes(" id="))f=f.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${l.elementId}"`);else{let x=f.match(/id=["']([^"']+)["']/);if(x)for(let v of l.events)v.elementId=x[1]}for(let x of l.events){let v=x.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),A=new RegExp(`\\s*${v}\\s*=\\s*"[^"]*"`,"g"),D=new RegExp(`\\s*${v}\\s*=\\s*'[^']*'`,"g");f=f.replace(A,""),f=f.replace(D,"")}i=i.slice(0,l.startIndex)+f+i.slice(l.endIndex),a.push(...l.events)}return{template:i,bindings:a}}function Ur(e){let t=e.$uid;return typeof t==="string"&&t?`${t}_`:""}function Hc(e,t,n){if(Cl(e))return e;if(t.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:f,bindings:x}=$a(e,Ur(t)),v=t.__stx_event_bindings||[];return t.__stx_event_bindings=[...v,...x],f}let i=qr(e,Ur(t));if(i.length===0)return e;let a=e;for(let f=i.length-1;f>=0;f--){let x=i[f],v=x.originalTag;if(!v.includes(" id="))v=v.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${x.elementId}"`);else{let A=v.match(/id=["']([^"']+)["']/);if(A)for(let D of x.events)D.elementId=A[1]}for(let A of x.events){let D=A.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),U=new RegExp(`\\s*${D}\\s*=\\s*"[^"]*"`,"g"),O=new RegExp(`\\s*${D}\\s*=\\s*'[^']*'`,"g");v=v.replace(U,""),v=v.replace(O,"")}a=a.slice(0,x.startIndex)+v+a.slice(x.endIndex)}let u=hi(i.flatMap((f)=>f.events)),l=c(a);if(l!==-1)a=a.slice(0,l)+u+`
|
|
115
|
-
`+a.slice(l);else a+=u;return a}function Zr(e,t){let n=new Set;for(let i of e.split(",")){let a=i.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(t){let u=a.lastIndexOf(":");if(u!==-1)a=a.slice(u+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))n.add(a)}return n}function Dt(e,t){let n=r(e),{depths:i,balanced:a}=Y(n),u=(f)=>!a||i[f]===0,l=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${t}\\b)`,"g");for(let f of n.matchAll(l)){let x=(f.index??0)+f[0].length-f[1].length;if(u(x))return!0}for(let f of n.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(u(f.index??0)&&Zr(f[1],!0).has(t))return!0;for(let f of n.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(u(f.index??0)&&Zr(f[1],!1).has(t))return!0;return!1}var Kr=new P(32,{maxBytes:2097152,sizeOf:(e)=>e.code.length*4}),wt=/^[A-Za-z_$][\w$]*$/,va=new Set(["if","for","while","switch","with"]),Xr=["(","[","{"],Jr=[")","]","}"],Ea=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function ka(e){let t=r(e),n=[];for(let i of t.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=i.index??0;n.push({text:i[0],start:a,end:a+i[0].length})}return{code:t,tokens:n}}function ws(e){let t=Kr.get(e);if(t)return t;let{code:n,tokens:i}=ka(e),a=new Map,u=[];for(let F=0;F<i.length;F++){let q=i[F].text;if(["(","[","{"].includes(q))u.push(F);else if([")","]","}"].includes(q)){let H=u.at(-1);if(H!==void 0&&["()","[]","{}"].includes(i[H].text+q))u.pop(),a.set(H,F),a.set(F,H)}}function l(F,q){let H=[],M=F;for(let ee=F;ee<q;ee++){if(["(","[","{"].includes(i[ee].text)&&(a.get(ee)??q)<q){ee=a.get(ee);continue}if(i[ee].text===",")H.push([M,ee]),M=ee+1}return H.push([M,q]),H}let f=[];function x(F,q,H,M=!1){if(i[F]?.text==="...")F++;if(F>=q)return;let ee=i[F].text;if(wt.test(ee)){if(H.add(ee),H===D)f.push({name:ee,token:F,functionScoped:M});return}if(ee!=="{"&&ee!=="[")return;let oe=a.get(F);if(oe===void 0||oe>=q)return;for(let[ie,ge]of l(F+1,oe)){let ye=ie;if(ee==="{")for(let me=ie;me<ge;me++){if(i[me].text===":"){ye=me+1;break}if(i[me].text==="=")break;if(["(","[","{"].includes(i[me].text)&&a.has(me))me=a.get(me)}x(ye,ge,H,M)}}function v(F,q){let H=new Set;for(let[M,ee]of l(F,q))x(M,ee,H);return H}function A(F){let q=F;for(;q<i.length;q++){let H=i[q].text;if(["(","[","{"].includes(H)&&a.has(q)){q=a.get(q);continue}if([",",";",")","]","}"].includes(H))break}return i[Math.max(F,q-1)]?.end??n.length}let D=new Set,U=[];for(let F=0;F<i.length;F++)if(i[F].text==="=>"){let q=F-1,H=q,M;if(i[q]?.text===")"&&a.has(q))H=a.get(q),M=v(H+1,q);else if(i[q]&&wt.test(i[q].text))M=new Set([i[q].text]);else continue;let ee=F+1,oe=i[ee]?.text==="{"&&a.has(ee)?i[a.get(ee)].end:A(ee);U.push({start:i[H].start,end:oe,bodyStart:i[ee]?.start??oe,functionBody:!0,names:M})}else if(i[F].text==="("&&a.has(F)){let q=i[F-1]?.text;if(!q||va.has(q)||!wt.test(q)&&q!=="*"&&q!=="]")continue;let H=a.get(F),M=H+1;if(i[M]?.text===":"){M++;while(M<i.length&&!["{","=>",";","="].includes(i[M].text))M++}if(i[M]?.text!=="{"||!a.has(M))continue;U.push({start:i[F].start,end:i[a.get(M)].end,bodyStart:i[M].start,functionBody:q!=="catch",names:v(F+1,H)})}function O(F){let q=F;for(;q<i.length;q++){let H=i[q].text;if(Xr.includes(H)&&a.has(q)){q=a.get(q);continue}if(H===";"||Jr.includes(H))break;let M=i[q-1];if(q>F&&Ea.has(H)&&M.text!==".")break;if(q>F&&/[\n\r]/.test(n.slice(M.end,i[q].start))&&(/^[\w$]+$/.test(M.text)||Jr.includes(M.text)||['"',"'","`"].includes(M.text))&&wt.test(H)&&!["in","of","instanceof"].includes(H))break}return q}let z=[];for(let F=0;F<i.length;F++){if(i[F].text!=="for")continue;let q=i[F+1]?.text==="await"?F+2:F+1;if(i[q]?.text!=="("||!a.has(q))continue;let H=a.get(q),M=H+1,ee=i[M]?.text==="{"&&a.has(M)?a.get(M):O(M),oe=i[ee]?.text===";"||i[ee]?.text==="}"?i[ee].end:i[Math.max(M,ee-1)]?.end??n.length;z.push({headStart:q,headEnd:H,start:i[q].start,end:oe})}for(let F=0;F<i.length;F++){let q=i[F].text,H=i[F-1]?.text;if(H==="."||i[F+1]?.text===":")continue;if(H==="as"||H==="<")continue;if(q==="const"||q==="let"||q==="var"){let M=O(F+1),ee=F+1,oe=!1,ie=!1,ge=0;for(let ye=F+1;ye<=M;ye++){let me=i[ye]?.text;if(ye<M&&Xr.includes(me)&&a.has(ye)&&a.get(ye)<M){ye=a.get(ye);continue}if(ye<M&&me===":"&&!ie)oe=!0;else if(ye<M&&me==="="&&ge===0)oe=!1,ie=!0;else if(ye<M&&oe&&me==="<")ge++;else if(ye<M&&oe&&me===">"&&ge>0)ge--;else if(ye===M||me===","&&ge===0)x(ee,ye,D,q==="var"),ee=ye+1,oe=!1,ie=!1}}else if(q==="function"||q==="class"){let M=F+1;if(i[M]?.text==="*")M++;if(i[M]&&wt.test(i[M].text)&&i[M].text!=="extends")D.add(i[M].text),f.push({name:i[M].text,token:M})}else if(q==="import"){let M=F+1;if(i[M]?.text==="*"&&i[M+1]?.text==="as")M+=2;let ee=i[M]?.text;if(ee&&wt.test(ee)&&ee!=="type"&&i[M+1]?.text!=="("&&i[M+1]?.text!==".")D.add(ee),f.push({name:ee,token:M,file:!0});let oe=i[M]?.text==="{"?M:i[M+1]?.text===","&&i[M+2]?.text==="{"?M+2:-1;if(oe!==-1&&a.has(oe)){let ie=a.get(oe);for(let[ge,ye]of l(oe+1,ie)){let me=ye-1;while(me>=ge&&!wt.test(i[me].text))me--;if(me>=ge&&i[me].text!=="type")f.push({name:i[me].text,token:me,file:!0})}}}}let V={code:n,scopes:U,loops:z,declarations:D,sites:f,tokens:i,pairs:a};return Kr.set(e,V),V}function nn(e){let t=ws(e);return{code:t.code,shadows:(n,i)=>t.scopes.some((a)=>i>=a.start&&i<a.end&&a.names.has(n))}}function Bn(e){return new Set(ws(e).declarations)}function Le(e,t){let{scopes:n,loops:i,sites:a,tokens:u,pairs:l}=ws(e),f=Array.from({length:u.length},()=>-1),x=[];for(let O=0;O<u.length;O++){f[O]=x.length?x[x.length-1]:-1;let z=u[O].text;if(z==="{"&&l.has(O))x.push(O);else if(z==="}"&&x.length&&l.get(O)===x[x.length-1])x.pop()}let v=new Set,A=new Map;for(let O of a){if(!t.has(O.name))continue;v.add(O.token);let z=O.file?-1:f[O.token],V=z===-1?[0,Number.POSITIVE_INFINITY]:[u[z].start,u[l.get(z)].end];if(O.functionScoped){let q=u[O.token].start,H=n.filter((M)=>M.functionBody&&q>=M.bodyStart&&q<M.end).sort((M,ee)=>M.end-M.bodyStart-(ee.end-ee.bodyStart))[0];V=H?[H.bodyStart,H.end]:[0,Number.POSITIVE_INFINITY]}else if(!O.file){let q=i.filter((H)=>O.token>H.headStart&&O.token<H.headEnd).sort((H,M)=>H.headEnd-H.headStart-(M.headEnd-M.headStart))[0];if(q)V=[q.start,q.end]}let F=A.get(O.name);if(F)F.push(V);else A.set(O.name,[V])}let D=new Set;for(let O=0;O<u.length;O++){if(u[O].text!=="import"||u[O-1]?.text===".")continue;let z=O+1;if(u[z]?.text==="type")z++;if(u[z]&&wt.test(u[z].text)&&u[z+1]?.text===",")z+=2;if(u[z]?.text==="{"&&l.has(z))for(let V=z+1;V<l.get(z);V++)D.add(V)}let U=new Set;for(let O=0;O<u.length;O++){let z=u[O].text;if(!t.has(z)||U.has(z)||v.has(O)||D.has(O))continue;let V=u[O-1]?.text;if(V==="#"||V==="."&&u[O-2]?.text!=="..")continue;if(u[O+1]?.text===":"&&(V==="{"||V===","))continue;let F=u[O].start;if(A.get(z)?.some(([q,H])=>F>=q&&F<H))continue;if(n.some((q)=>F>=q.start&&F<q.end&&q.names.has(z)))continue;U.add(z)}return U}var Me="0.2.872";var Gr=Symbol.for(`stx.lazy-module-promises.${Me}`);function Ra(){let e=globalThis;return e[Gr]??=new Map,e[Gr]}function o(e,t){let n=Ra(),i=`${import.meta.url}\x00${e}`,a=n.get(i);if(a)return a;let u=t();return n.set(i,u),u.catch(()=>{if(n.get(i)===u)n.delete(i)}),u}var Ta=/<\/(script)/gi;function pe(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(Ta,"<\\/$1")}import Yr from"fs";var Qr=[];function S(e){let t=new P(e);return Qr.push(t),t}function Vc(){for(let e of Qr)e.clear()}function _(e,...t){return`${t.map((n)=>String(n??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function Cr(e){let t=[];for(let n of new Set(e))try{t.push({path:n,mtimeMs:Yr.statSync(n).mtimeMs})}catch{}return t}function Vs(e){for(let t of e)try{if(Yr.statSync(t.path).mtimeMs!==t.mtimeMs)return!1}catch{return!1}return!0}var Ee=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useIntervalFn","useObjectUrl"];var Aa=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function Ia(e){if(e.startsWith(".")||e.startsWith("/"))return null;if(e.startsWith("@")){let n=e.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!n)return null;return{pkg:n[1],subpath:n[2]||""}}let t=e.match(/^([^/]+)(\/.*)?$/);if(!t)return null;return{pkg:t[1],subpath:t[2]||""}}function Pa(e,t){let n=t;while(!0){let i=Et.join(n,"node_modules",e,"package.json");if(sn.existsSync(i))return Et.dirname(i);let a=Et.dirname(n);if(a===n)return null;n=a}}function Oa(e,t){if(!e||typeof e!=="object")return null;let n=(a)=>{if(typeof a==="string")return a;if(a&&typeof a==="object"){if(typeof a.import==="string")return a.import;if(typeof a.default==="string")return a.default;if(typeof a.import==="object")return n(a.import);if(typeof a.default==="object")return n(a.default)}return null};if(Object.prototype.hasOwnProperty.call(e,t))return n(e[t]);let i=null;for(let a of Object.keys(e)){let u=a.indexOf("*");if(u===-1)continue;let l=a.slice(0,u),f=a.slice(u+1);if(!t.startsWith(l)||!t.endsWith(f))continue;if(t.length<l.length+f.length)continue;if(!i||l.length>i.prefix.length)i={pattern:a,prefix:l,suffix:f}}if(i){let a=t.slice(i.prefix.length,t.length-i.suffix.length),u=n(e[i.pattern]);if(u)return u.replace("*",a)}return null}function Da(e,t){let n=Ia(e);if(!n||!n.subpath)return null;let i=Pa(n.pkg,t);if(!i)return null;let a;try{a=JSON.parse(sn.readFileSync(Et.join(i,"package.json"),"utf8"))}catch{return null}let u=`.${n.subpath}`,l=Oa(a.exports,u);if(!l)return null;let f=Et.resolve(i,l);return sn.existsSync(f)?f:null}function Ci(e,t){let n=t.filePath?Et.dirname(t.filePath):t.projectRoot||process.cwd(),i=t.projectRoot||process.cwd(),a=new Set,u=[],l=[];return{code:e.replace(Aa,(x,v)=>{let A;try{if(v.startsWith("./")||v.startsWith("../")||v.startsWith("/")){if(A=v.startsWith("/")?v:Et.resolve(n,v),!sn.existsSync(A))throw Error(`file not found: ${A}`)}else{let D=null;try{D=Bun.resolveSync(v,i)}catch{D=Da(v,i)}if(!D)throw Error(`could not resolve ${v} (Bun.resolveSync + exports fallback both failed)`);A=D}}catch(D){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(v)} (from ${t.filePath||"<unknown>"}): ${D?.message||D}`),l.push(v),""}if(a.has(A))return"";a.add(A);try{let D=sn.readFileSync(A,"utf8");u.push({source:v,resolvedPath:A,contents:D})}catch(D){console.warn(`[stx:vendor-css] could not read ${A}: ${D?.message||D}`),l.push(v)}return""}),styles:u,unresolved:l}}function Ma(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Ei(e){if(e.length===0)return"";return`${e.map((t)=>`<style data-stx-vendor="${Ma(t.source)}" data-stx-layer="vendor">
|
|
115
|
+
`+a.slice(l);else a+=u;return a}function Zr(e,t){let n=new Set;for(let i of e.split(",")){let a=i.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(t){let u=a.lastIndexOf(":");if(u!==-1)a=a.slice(u+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))n.add(a)}return n}function Dt(e,t){let n=r(e),{depths:i,balanced:a}=Y(n),u=(f)=>!a||i[f]===0,l=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${t}\\b)`,"g");for(let f of n.matchAll(l)){let x=(f.index??0)+f[0].length-f[1].length;if(u(x))return!0}for(let f of n.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(u(f.index??0)&&Zr(f[1],!0).has(t))return!0;for(let f of n.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(u(f.index??0)&&Zr(f[1],!1).has(t))return!0;return!1}var Kr=new P(32,{maxBytes:2097152,sizeOf:(e)=>e.code.length*4}),wt=/^[A-Za-z_$][\w$]*$/,va=new Set(["if","for","while","switch","with"]),Xr=["(","[","{"],Jr=[")","]","}"],Ea=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function ka(e){let t=r(e),n=[];for(let i of t.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=i.index??0;n.push({text:i[0],start:a,end:a+i[0].length})}return{code:t,tokens:n}}function ws(e){let t=Kr.get(e);if(t)return t;let{code:n,tokens:i}=ka(e),a=new Map,u=[];for(let F=0;F<i.length;F++){let q=i[F].text;if(["(","[","{"].includes(q))u.push(F);else if([")","]","}"].includes(q)){let H=u.at(-1);if(H!==void 0&&["()","[]","{}"].includes(i[H].text+q))u.pop(),a.set(H,F),a.set(F,H)}}function l(F,q){let H=[],M=F;for(let ee=F;ee<q;ee++){if(["(","[","{"].includes(i[ee].text)&&(a.get(ee)??q)<q){ee=a.get(ee);continue}if(i[ee].text===",")H.push([M,ee]),M=ee+1}return H.push([M,q]),H}let f=[];function x(F,q,H,M=!1){if(i[F]?.text==="...")F++;if(F>=q)return;let ee=i[F].text;if(wt.test(ee)){if(H.add(ee),H===D)f.push({name:ee,token:F,functionScoped:M});return}if(ee!=="{"&&ee!=="[")return;let oe=a.get(F);if(oe===void 0||oe>=q)return;for(let[ie,ge]of l(F+1,oe)){let ye=ie;if(ee==="{")for(let me=ie;me<ge;me++){if(i[me].text===":"){ye=me+1;break}if(i[me].text==="=")break;if(["(","[","{"].includes(i[me].text)&&a.has(me))me=a.get(me)}x(ye,ge,H,M)}}function v(F,q){let H=new Set;for(let[M,ee]of l(F,q))x(M,ee,H);return H}function A(F){let q=F;for(;q<i.length;q++){let H=i[q].text;if(["(","[","{"].includes(H)&&a.has(q)){q=a.get(q);continue}if([",",";",")","]","}"].includes(H))break}return i[Math.max(F,q-1)]?.end??n.length}let D=new Set,U=[];for(let F=0;F<i.length;F++)if(i[F].text==="=>"){let q=F-1,H=q,M;if(i[q]?.text===")"&&a.has(q))H=a.get(q),M=v(H+1,q);else if(i[q]&&wt.test(i[q].text))M=new Set([i[q].text]);else continue;let ee=F+1,oe=i[ee]?.text==="{"&&a.has(ee)?i[a.get(ee)].end:A(ee);U.push({start:i[H].start,end:oe,bodyStart:i[ee]?.start??oe,functionBody:!0,names:M})}else if(i[F].text==="("&&a.has(F)){let q=i[F-1]?.text;if(!q||va.has(q)||!wt.test(q)&&q!=="*"&&q!=="]")continue;let H=a.get(F),M=H+1;if(i[M]?.text===":"){M++;while(M<i.length&&!["{","=>",";","="].includes(i[M].text))M++}if(i[M]?.text!=="{"||!a.has(M))continue;U.push({start:i[F].start,end:i[a.get(M)].end,bodyStart:i[M].start,functionBody:q!=="catch",names:v(F+1,H)})}function O(F){let q=F;for(;q<i.length;q++){let H=i[q].text;if(Xr.includes(H)&&a.has(q)){q=a.get(q);continue}if(H===";"||Jr.includes(H))break;let M=i[q-1];if(q>F&&Ea.has(H)&&M.text!==".")break;if(q>F&&/[\n\r]/.test(n.slice(M.end,i[q].start))&&(/^[\w$]+$/.test(M.text)||Jr.includes(M.text)||['"',"'","`"].includes(M.text))&&wt.test(H)&&!["in","of","instanceof"].includes(H))break}return q}let z=[];for(let F=0;F<i.length;F++){if(i[F].text!=="for")continue;let q=i[F+1]?.text==="await"?F+2:F+1;if(i[q]?.text!=="("||!a.has(q))continue;let H=a.get(q),M=H+1,ee=i[M]?.text==="{"&&a.has(M)?a.get(M):O(M),oe=i[ee]?.text===";"||i[ee]?.text==="}"?i[ee].end:i[Math.max(M,ee-1)]?.end??n.length;z.push({headStart:q,headEnd:H,start:i[q].start,end:oe})}for(let F=0;F<i.length;F++){let q=i[F].text,H=i[F-1]?.text;if(H==="."||i[F+1]?.text===":")continue;if(H==="as"||H==="<")continue;if(q==="const"||q==="let"||q==="var"){let M=O(F+1),ee=F+1,oe=!1,ie=!1,ge=0;for(let ye=F+1;ye<=M;ye++){let me=i[ye]?.text;if(ye<M&&Xr.includes(me)&&a.has(ye)&&a.get(ye)<M){ye=a.get(ye);continue}if(ye<M&&me===":"&&!ie)oe=!0;else if(ye<M&&me==="="&&ge===0)oe=!1,ie=!0;else if(ye<M&&oe&&me==="<")ge++;else if(ye<M&&oe&&me===">"&&ge>0)ge--;else if(ye===M||me===","&&ge===0)x(ee,ye,D,q==="var"),ee=ye+1,oe=!1,ie=!1}}else if(q==="function"||q==="class"){let M=F+1;if(i[M]?.text==="*")M++;if(i[M]&&wt.test(i[M].text)&&i[M].text!=="extends")D.add(i[M].text),f.push({name:i[M].text,token:M})}else if(q==="import"){let M=F+1;if(i[M]?.text==="*"&&i[M+1]?.text==="as")M+=2;let ee=i[M]?.text;if(ee&&wt.test(ee)&&ee!=="type"&&i[M+1]?.text!=="("&&i[M+1]?.text!==".")D.add(ee),f.push({name:ee,token:M,file:!0});let oe=i[M]?.text==="{"?M:i[M+1]?.text===","&&i[M+2]?.text==="{"?M+2:-1;if(oe!==-1&&a.has(oe)){let ie=a.get(oe);for(let[ge,ye]of l(oe+1,ie)){let me=ye-1;while(me>=ge&&!wt.test(i[me].text))me--;if(me>=ge&&i[me].text!=="type")f.push({name:i[me].text,token:me,file:!0})}}}}let V={code:n,scopes:U,loops:z,declarations:D,sites:f,tokens:i,pairs:a};return Kr.set(e,V),V}function nn(e){let t=ws(e);return{code:t.code,shadows:(n,i)=>t.scopes.some((a)=>i>=a.start&&i<a.end&&a.names.has(n))}}function Bn(e){return new Set(ws(e).declarations)}function Le(e,t){let{scopes:n,loops:i,sites:a,tokens:u,pairs:l}=ws(e),f=Array.from({length:u.length},()=>-1),x=[];for(let O=0;O<u.length;O++){f[O]=x.length?x[x.length-1]:-1;let z=u[O].text;if(z==="{"&&l.has(O))x.push(O);else if(z==="}"&&x.length&&l.get(O)===x[x.length-1])x.pop()}let v=new Set,A=new Map;for(let O of a){if(!t.has(O.name))continue;v.add(O.token);let z=O.file?-1:f[O.token],V=z===-1?[0,Number.POSITIVE_INFINITY]:[u[z].start,u[l.get(z)].end];if(O.functionScoped){let q=u[O.token].start,H=n.filter((M)=>M.functionBody&&q>=M.bodyStart&&q<M.end).sort((M,ee)=>M.end-M.bodyStart-(ee.end-ee.bodyStart))[0];V=H?[H.bodyStart,H.end]:[0,Number.POSITIVE_INFINITY]}else if(!O.file){let q=i.filter((H)=>O.token>H.headStart&&O.token<H.headEnd).sort((H,M)=>H.headEnd-H.headStart-(M.headEnd-M.headStart))[0];if(q)V=[q.start,q.end]}let F=A.get(O.name);if(F)F.push(V);else A.set(O.name,[V])}let D=new Set;for(let O=0;O<u.length;O++){if(u[O].text!=="import"||u[O-1]?.text===".")continue;let z=O+1;if(u[z]?.text==="type")z++;if(u[z]&&wt.test(u[z].text)&&u[z+1]?.text===",")z+=2;if(u[z]?.text==="{"&&l.has(z))for(let V=z+1;V<l.get(z);V++)D.add(V)}let U=new Set;for(let O=0;O<u.length;O++){let z=u[O].text;if(!t.has(z)||U.has(z)||v.has(O)||D.has(O))continue;let V=u[O-1]?.text;if(V==="#"||V==="."&&u[O-2]?.text!=="..")continue;if(u[O+1]?.text===":"&&(V==="{"||V===","))continue;let F=u[O].start;if(A.get(z)?.some(([q,H])=>F>=q&&F<H))continue;if(n.some((q)=>F>=q.start&&F<q.end&&q.names.has(z)))continue;U.add(z)}return U}var Me="0.2.873";var Gr=Symbol.for(`stx.lazy-module-promises.${Me}`);function Ra(){let e=globalThis;return e[Gr]??=new Map,e[Gr]}function o(e,t){let n=Ra(),i=`${import.meta.url}\x00${e}`,a=n.get(i);if(a)return a;let u=t();return n.set(i,u),u.catch(()=>{if(n.get(i)===u)n.delete(i)}),u}var Ta=/<\/(script)/gi;function pe(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(Ta,"<\\/$1")}import Yr from"fs";var Qr=[];function S(e){let t=new P(e);return Qr.push(t),t}function Vc(){for(let e of Qr)e.clear()}function _(e,...t){return`${t.map((n)=>String(n??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function Cr(e){let t=[];for(let n of new Set(e))try{t.push({path:n,mtimeMs:Yr.statSync(n).mtimeMs})}catch{}return t}function Vs(e){for(let t of e)try{if(Yr.statSync(t.path).mtimeMs!==t.mtimeMs)return!1}catch{return!1}return!0}var Ee=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useIntervalFn","useObjectUrl"];var Aa=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function Ia(e){if(e.startsWith(".")||e.startsWith("/"))return null;if(e.startsWith("@")){let n=e.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!n)return null;return{pkg:n[1],subpath:n[2]||""}}let t=e.match(/^([^/]+)(\/.*)?$/);if(!t)return null;return{pkg:t[1],subpath:t[2]||""}}function Pa(e,t){let n=t;while(!0){let i=Et.join(n,"node_modules",e,"package.json");if(sn.existsSync(i))return Et.dirname(i);let a=Et.dirname(n);if(a===n)return null;n=a}}function Oa(e,t){if(!e||typeof e!=="object")return null;let n=(a)=>{if(typeof a==="string")return a;if(a&&typeof a==="object"){if(typeof a.import==="string")return a.import;if(typeof a.default==="string")return a.default;if(typeof a.import==="object")return n(a.import);if(typeof a.default==="object")return n(a.default)}return null};if(Object.prototype.hasOwnProperty.call(e,t))return n(e[t]);let i=null;for(let a of Object.keys(e)){let u=a.indexOf("*");if(u===-1)continue;let l=a.slice(0,u),f=a.slice(u+1);if(!t.startsWith(l)||!t.endsWith(f))continue;if(t.length<l.length+f.length)continue;if(!i||l.length>i.prefix.length)i={pattern:a,prefix:l,suffix:f}}if(i){let a=t.slice(i.prefix.length,t.length-i.suffix.length),u=n(e[i.pattern]);if(u)return u.replace("*",a)}return null}function Da(e,t){let n=Ia(e);if(!n||!n.subpath)return null;let i=Pa(n.pkg,t);if(!i)return null;let a;try{a=JSON.parse(sn.readFileSync(Et.join(i,"package.json"),"utf8"))}catch{return null}let u=`.${n.subpath}`,l=Oa(a.exports,u);if(!l)return null;let f=Et.resolve(i,l);return sn.existsSync(f)?f:null}function Ci(e,t){let n=t.filePath?Et.dirname(t.filePath):t.projectRoot||process.cwd(),i=t.projectRoot||process.cwd(),a=new Set,u=[],l=[];return{code:e.replace(Aa,(x,v)=>{let A;try{if(v.startsWith("./")||v.startsWith("../")||v.startsWith("/")){if(A=v.startsWith("/")?v:Et.resolve(n,v),!sn.existsSync(A))throw Error(`file not found: ${A}`)}else{let D=null;try{D=Bun.resolveSync(v,i)}catch{D=Da(v,i)}if(!D)throw Error(`could not resolve ${v} (Bun.resolveSync + exports fallback both failed)`);A=D}}catch(D){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(v)} (from ${t.filePath||"<unknown>"}): ${D?.message||D}`),l.push(v),""}if(a.has(A))return"";a.add(A);try{let D=sn.readFileSync(A,"utf8");u.push({source:v,resolvedPath:A,contents:D})}catch(D){console.warn(`[stx:vendor-css] could not read ${A}: ${D?.message||D}`),l.push(v)}return""}),styles:u,unresolved:l}}function Ma(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Ei(e){if(e.length===0)return"";return`${e.map((t)=>`<style data-stx-vendor="${Ma(t.source)}" data-stx-layer="vendor">
|
|
116
116
|
@layer vendor {
|
|
117
117
|
${t.contents}
|
|
118
118
|
}
|
|
@@ -182,7 +182,7 @@ else {
|
|
|
182
182
|
// STX: auto-generated event bindings
|
|
183
183
|
${e.map((n,i)=>qa(n,i)).join(`
|
|
184
184
|
`)}`}function si(e){let t=[],n=new Set,i=e.replace(/^\s*import\s+.*$/gm,""),a=0,u=i.length,l=0;while(l<u){let f=i[l];if(f==="'"||f==='"'||f==="`"){let x=f;if(l++,x==="`"){let v=0;while(l<u){if(i[l]==="\\"){l+=2;continue}if(i[l]==="`"&&v===0){l++;break}if(i[l]==="$"&&i[l+1]==="{"){v++,l+=2;continue}if(i[l]==="}"&&v>0){v--,l++;continue}l++}}else while(l<u){if(i[l]==="\\"){l+=2;continue}if(i[l]===x){l++;break}l++}continue}if(f==="/"&&i[l+1]==="/"){while(l<u&&i[l]!==`
|
|
185
|
-
`)l++;continue}if(f==="/"&&i[l+1]==="*"){l+=2;while(l<u-1&&!(i[l]==="*"&&i[l+1]==="/"))l++;l+=2;continue}if(f==="{"){a++,l++;continue}if(f==="}"){a--,l++;continue}if(a===0){let x=i.slice(l),v=x.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(v){let U=v[1];if(!U.startsWith("_")&&!n.has(U))t.push(U),n.add(U);l+=v[0].length;continue}let A=x.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){A[1].split(",").forEach((U)=>{let O=U.trim(),z=O.indexOf(":"),V=z>=0?O.slice(z+1).trim().split(/[\s=]/)[0]:O.split(/[\s=]/)[0];if(V&&!V.startsWith("_")&&!n.has(V))t.push(V),n.add(V)}),l+=A[0].length;continue}let D=x.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(D){let U=D[1];if(!U.startsWith("_")&&!n.has(U))t.push(U),n.add(U);l+=D[0].length;continue}}l++}return t}var Ka=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 Xa(e){let t=new Set,n=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function i(U){let O;while((O=n.exec(U))!==null){let z=O[0];if(!Ka.has(z))t.add(z)}}let a=/\{\{([\s\S]*?)\}\}/g,u;while((u=a.exec(e))!==null)i(u[1]);let l=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((u=l.exec(e))!==null)i(u[1]);let f=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((u=f.exec(e))!==null)i(u[1]);let x=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((u=x.exec(e))!==null)i(u[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((u=v.exec(e))!==null)i(u[1]);let A=/@model\s*=\s*["']([^"']*)["']/gi;while((u=A.exec(e))!==null)i(u[1]);let D=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((u=D.exec(e))!==null)i(u[1]);return t}async function He(e,t={}){let n=e,i="",a=!1,u=[],l=Ci(n,{filePath:t.filePath,projectRoot:t.projectRoot});n=l.code;let f=Ei(l.styles),x=zt(n);n=x.code,u=[...x.imports,...x.models];let{hasUserImports:v,bundleClientScript:A}=await o("stx/client-script-bundler",()=>import("./chunk-
|
|
185
|
+
`)l++;continue}if(f==="/"&&i[l+1]==="*"){l+=2;while(l<u-1&&!(i[l]==="*"&&i[l+1]==="/"))l++;l+=2;continue}if(f==="{"){a++,l++;continue}if(f==="}"){a--,l++;continue}if(a===0){let x=i.slice(l),v=x.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(v){let U=v[1];if(!U.startsWith("_")&&!n.has(U))t.push(U),n.add(U);l+=v[0].length;continue}let A=x.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){A[1].split(",").forEach((U)=>{let O=U.trim(),z=O.indexOf(":"),V=z>=0?O.slice(z+1).trim().split(/[\s=]/)[0]:O.split(/[\s=]/)[0];if(V&&!V.startsWith("_")&&!n.has(V))t.push(V),n.add(V)}),l+=A[0].length;continue}let D=x.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(D){let U=D[1];if(!U.startsWith("_")&&!n.has(U))t.push(U),n.add(U);l+=D[0].length;continue}}l++}return t}var Ka=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 Xa(e){let t=new Set,n=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function i(U){let O;while((O=n.exec(U))!==null){let z=O[0];if(!Ka.has(z))t.add(z)}}let a=/\{\{([\s\S]*?)\}\}/g,u;while((u=a.exec(e))!==null)i(u[1]);let l=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((u=l.exec(e))!==null)i(u[1]);let f=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((u=f.exec(e))!==null)i(u[1]);let x=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((u=x.exec(e))!==null)i(u[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((u=v.exec(e))!==null)i(u[1]);let A=/@model\s*=\s*["']([^"']*)["']/gi;while((u=A.exec(e))!==null)i(u[1]);let D=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((u=D.exec(e))!==null)i(u[1]);return t}async function He(e,t={}){let n=e,i="",a=!1,u=[],l=Ci(n,{filePath:t.filePath,projectRoot:t.projectRoot});n=l.code;let f=Ei(l.styles),x=zt(n);n=x.code,u=[...x.imports,...x.models];let{hasUserImports:v,bundleClientScript:A}=await o("stx/client-script-bundler",()=>import("./chunk-k0ph8zr7.js"));if(v(n))n=await A(n,t.filePath||"",{projectRoot:t.projectRoot,minify:t.production}),a=!0;if(t.autoImports!==!1){let M=al(n);n=M.code,i=cl(M.stxImports,M.browserImports.filter((ee)=>!u.includes(ee)))}if(i=`${kn(n,t.serverData)}${i}`,n=N(n),!a&&Ve(t.attrs||""))n=Ue(n);let D=Za(t.eventBindings||[]),U=(t.attrs||"").trim(),O=/\btype\s*=\s*["']module["']/i.test(U),z=t.instanceId?` data-stx-instance="${t.instanceId}"`:"";if(O){let M=U.replace(/\btype\s*=\s*["']module["']/i,"").trim(),ee=`type="module" data-stx-scoped${z}${M?` ${M}`:""}`;return`${f}<script ${ee}>
|
|
186
186
|
${pe(`${i}${n}
|
|
187
187
|
${D}`)}
|
|
188
188
|
</script>`}let V=Fi(e),F=/function __stx_setup_/.test(n),q=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function H(M){let ee=M.length>0?`
|
|
@@ -573,8 +573,8 @@ ${v.join(`
|
|
|
573
573
|
`){let z=e[a];if(z==="\\"){a+=2;continue}if(z==="[")O=!0;else if(z==="]")O=!1;else if(z==="/"&&!O){a++;while(a<u&&/[a-z]/i.test(e[a]))a++;return}a++}},U=()=>{if(i!==0)return;let O=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(O){let q=O[2].split(",").map((H)=>{let M=H.trim().split(":");return M[M.length-1].trim()});for(let H of q)if(H&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(H)&&!n.has(H))t.push(H),n.add(H);return}let z=e.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let q=z[2];if(!n.has(q))t.push(q),n.add(q);return}let V=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(V){let q=V[1];if(!n.has(q))t.push(q),n.add(q);return}let F=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let q=F[1];if(!n.has(q))t.push(q),n.add(q)}};while(a<u){if(x())continue;if(e[a]==="'"||e[a]==='"'){l(e[a]);continue}if(e[a]==="`"){f();continue}if(e[a]==="/"&&A()){D();continue}if(e[a]==="{"){i++,a++;continue}if(e[a]==="}"){i--,a++;continue}if(i===0&&/[a-z]/i.test(e[a])&&(a===0||/\s|[;{}()]/.test(e[a-1])))U();a++}return t}function xu(e){let t=[],n=0,i=0,a=null;for(let u=0;u<e.length;u++){let l=e[u];if(a){if(l==="\\"){u++;continue}if(l===a)a=null;continue}if(l==='"'||l==="'"||l==="`"){a=l;continue}if(l==="("||l==="["||l==="{")n++;else if(l===")"||l==="]"||l==="}")n--;else if(l===","&&n===0)t.push(e.slice(i,u)),i=u+1}if(i<e.length)t.push(e.slice(i));return t}function bu(e){let t=0,n=null;for(let i=0;i<e.length;i++){let a=e[i];if(n){if(a==="\\"){i++;continue}if(a===n)n=null;continue}if(a==='"'||a==="'"||a==="`"){n=a;continue}if(a==="("||a==="["||a==="{")t++;else if(a===")"||a==="]"||a==="}")t--;else if(a==="="&&t===0){let u=e[i-1],l=e[i+1];if(u==="!"||u==="<"||u===">"||u==="=")continue;if(l==="="||l===">")continue;return i}}return-1}function yu(e,t){try{let n=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(e);if(!n)return;let i=n.index-1;while(i>=0&&/\s/.test(e[i]))i--;if(e[i]!=="}")return;let a=i,u=0,l=-1;for(;i>=0;i--){let x=e[i];if(x==="}")u++;else if(x==="{"){if(u--,u===0){l=i;break}}}if(l===-1)return;let f=e.slice(l+1,a);for(let x of xu(f)){let v=x.trim();if(!v||v.startsWith("..."))continue;let A=bu(v);if(A===-1)continue;let D=v.slice(0,A).trim();if(!/^[A-Z_$][\w$]*$/i.test(D))continue;if(t[D]!==void 0)continue;let U=v.slice(A+1).trim();if(!U)continue;try{let O=Object.keys(t).filter(Ut),z=Function(...O,`"use strict"; return (${U});`);t[D]=z(...O.map((V)=>t[V]))}catch{}}}catch{}}var _u=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function Ag(e,t){let n=Mt(e),i=e.slice(n).match(/^<([a-zA-Z][a-zA-Z0-9-]*)/);if(!i)return null;let a=i[1].toLowerCase();if(!_u.has(a))return null;let u=new RegExp(`<\\/?${a}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),l=w(e,(A,D)=>(u.lastIndex=D,u.exec(A)?.index===D?u.lastIndex:-1));if(a==="span"&&/\sdata-stx-scope\s*=/.test(l[0]?.token||""))return null;let f=0,x=!1;for(let A of l){if(f+=A.token.startsWith("</")?-1:1,f<0)return null;if(f===0){if(e.slice(A.end).trim())return null;x=!0;break}}if(!x)return null;let v=n+i[0].length;return e.slice(0,v)+t+e.slice(v)}function Qo(e,t){if(!e)return!1;return[...t.additionalComponentsDirs??[],...t.fallbackComponentsDir?[t.fallbackComponentsDir]:[]].some((i)=>{let a=ue.relative(ue.resolve(i),ue.resolve(e));return!a.startsWith("..")&&!ue.isAbsolute(a)})}async function Ir(e,t,n,i,a){let u=e.endsWith(".stx")?e.slice(0,-4):e,l=(ie)=>ie.split("-").map((ge)=>ge.charAt(0).toUpperCase()+ge.slice(1)).join(""),f=n.__importedComponents;if(f){for(let ie of[u,u.toLowerCase(),l(u),X(u)])if(f.has(ie))return!0}let x=[...new Set([`${u}.stx`,`${l(u)}.stx`,`${X(u)}.stx`])],v=typeof a.root==="string"?ue.resolve(a.root):void 0,A=v??ue.dirname(i),D=[],U=(ie)=>{if(ie&&!D.includes(ie))D.push(ie)};for(let ie of zn(i,v))U(ie);let O=n.__originalFilePath;if(O)U(ue.join(ue.dirname(O),"components"));if(Qo(t,a))U(a._rootComponentsDir);U(t),U(a._rootComponentsDir),U(ue.join(ue.dirname(i),"components")),U(a.componentsDir);for(let ie of a.additionalComponentsDirs??[])U(ie);let z=a._targetComponentFallbackNames?.some((ie)=>ie.toLowerCase()===u.toLowerCase());if(!z)for(let ie of a._targetComponentDirs??[])U(ie);if(v)U(ue.resolve(v,"resources/views/components")),U(ue.resolve(v,"resources/components")),U(ue.resolve(v,"src/components")),U(ue.resolve(v,"components"));for(let ie of a._layerComponentDirs??[])U(ie);let V=a._pluginComponentDirs;if(Array.isArray(V))for(let ie of V)U(typeof ie==="string"?ie:null);if(U(a.fallbackComponentsDir),z)for(let ie of a._targetComponentDirs??[])U(ie);let F=a._nativePrimitivesFallback;if(F&&!F.except.some((ie)=>ie.toLowerCase()===u.toLowerCase()))U(F.dir);if(u.startsWith("./")||u.startsWith("../"))return s(ue.resolve(ue.dirname(i),`${u}.stx`));let q=Ho(ue.resolve(import.meta.dir,"components")),H=D.map((ie)=>ue.isAbsolute(ie)?ie:ue.resolve(A,ie)),M=`${x.join("\x00")}\x00\x00${H.join("\x00")}`,ee=fr.get(M);if(ee!==void 0)return ee;let oe=!1;e:for(let ie of H){if(Ho(ie)===q)continue;for(let ge of x)if(await s(ue.join(ie,ge))){oe=!0;break e}}return fr.set(M,oe),oe}function Ho(e){let t=pr.get(e);if(t!==void 0)return t;let n=e;try{n=is.realpathSync(e)}catch{}return pr.set(e,n),n}function Pg(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function ll(e){if(!e)return!1;let t=e.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(t)}function wu(e,t,n){if(!e.includes("{{")&&!e.includes("{!!"))return e;let i=(a,u)=>{let l;try{l=I(a,t)}catch{return u}if(l===void 0||l===null)return"";let f=String(l);if(/<\/style/i.test(f))return console.warn(`[stx] a <style> expression in ${n??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return f};return e.replace(/\{!!([\s\S]*?)!!\}/g,(a,u)=>i(u,a)).replace(/\{\{([\s\S]*?)\}\}/g,(a,u)=>i(u,a))}var qo=new Set;function Zo(e,t,n,i){let a=`${e}\x00${t}\x00${i??""}`;if(!process.env.STX_DEBUG&&qo.has(a))return;qo.add(a);let u=t?` used in ${t}`:"",l=i?` Cause: ${i}.`:"",f=n.length>0?`
|
|
574
574
|
searched:
|
|
575
575
|
${n.map((x)=>` - ${x}`).join(`
|
|
576
|
-
`)}`:"";console.error(`[stx] component <${e}> could not be resolved${u}, so it rendered as nothing.${l}${f}`)}function Ko(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var Su=new Set(["for","if","show","key","ref","class","className","style"]),Xo=new Set,ea="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",ul=new RegExp(`\\b(?:${ea})\\s*(?:<[^>]*>)?\\s*\\(`);function Ti(e){let t=new Set,n=new RegExp(`\\b(?:const|let|var)\\s+([a-zA-Z_$][\\w$]*)\\s*=\\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue|${ea})\\s*(?:<[^>]*>)?\\s*\\(`,"g");for(let i of e){let a;while((a=n.exec(i))!==null)t.add(a[1]);n.lastIndex=0}return[...t]}async function We(e,t,n,i,a,u,l,f=new Set,x,v=ct(a),A,D=e){let{extractVariables:U}=await o("stx/variable-extractor",()=>import("./chunk-teahvty8.js")),O=f??new Set;if(O.has(e))return`[Circular component reference: ${e}]`;let z=new Set(O);z.add(e);let V=typeof t.client==="string"?t.client.trim():"";if("client"in t)delete t.client;let F=V&&V!=="load"&&Pg(V)?V:"";try{let q=(ce)=>ce.split("-").map((de)=>de.charAt(0).toUpperCase()+de.slice(1)).join(""),H=D.endsWith(".stx")?D.slice(0,-4):D,M=null,ee=a.__importedComponents;if(ee){let ce=[H,H.toLowerCase(),q(H),X(H)];for(let de of ce)if(ee.has(de)){M=ee.get(de);break}}let oe=[];if(!M){let ce=[`${H}.stx`,`${q(H)}.stx`,`${X(H)}.stx`],de=[...new Set(ce)],Se=a.__originalFilePath,xe=[];for(let _e of zn(u))if(!xe.includes(_e))xe.push(_e);let Ge=xe.length;for(let _e of l._layerComponentDirs??[])if(!xe.includes(_e))xe.push(_e);if(Se){let _e=ue.join(ue.dirname(Se),"components");xe.push(_e)}let Ie=l._rootComponentsDir;if(typeof Ie==="string"&&Qo(i,l)&&!xe.includes(Ie))xe.push(Ie);if(i&&!xe.includes(i))xe.push(i);if(typeof Ie==="string"&&!xe.includes(Ie))xe.push(Ie);let xt=ue.join(ue.dirname(u),"components");if(!xe.includes(xt))xe.push(xt);if(l.componentsDir&&l.componentsDir!==i&&!xe.includes(l.componentsDir))xe.push(l.componentsDir);for(let _e of l.additionalComponentsDirs??[])if(_e&&!xe.includes(_e))xe.push(_e);let Rt=l._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(H),_t=(A?.events??[]).map((_e)=>_e.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),Rn=Object.hasOwn(t,"checked")||Boolean(A?.reactiveProps?.includes("checked")),ps=Object.hasOwn(t,"value")||Boolean(A?.reactiveProps?.includes("value")),ds=!_t.includes("valuechange")&&(Rn||_t.includes("change")&&!ps),$t=l._nativeHostAttrs&&/^textinput$/i.test(H),Tt=_t.includes("update:value")&&!_t.includes("input"),tn=l._nativeHostAttrs&&/^video$/i.test(H),gs=l._nativeHostAttrs&&/^image$/i.test(H),An=Hs([...Object.keys(t),...A?.reactiveProps??[]],A?.events,t),At=Object.hasOwn(t,"src")||Boolean(A?.reactiveProps?.includes("src")),In=Object.hasOwn(t,"source")||Boolean(A?.reactiveProps?.includes("source")),Pn=tn&&(At||In)&&(A?.events??[]).every((_e)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(_e.replace(/^@/,"").split(".")[0])),On=new Set(["","primary","secondary","outline","ghost","danger"]),Dn=typeof t.variant==="string"?t.variant.trim().toLowerCase():"",Mn=l._nativeHostAttrs&&/^button$/i.test(H)&&!On.has(Dn),wr=l._targetComponentFallbackNames?.some((_e)=>_e.toLowerCase()===H.toLowerCase())??!1,ms=wr&&(!Rt||ds)&&(!$t||Tt)&&(!tn||Pn)&&(!gs||An)&&!Mn;for(let _e of ms?[]:l._targetComponentDirs??[])if(_e&&!xe.includes(_e))xe.push(_e);let It=typeof l.root==="string"?ue.resolve(l.root):void 0,Sr=It??ue.dirname(u),Pt=[];if(It)Pt.push(ue.resolve(It,"resources/views/components")),Pt.push(ue.resolve(It,"resources/components")),Pt.push(ue.resolve(It,"src/components")),Pt.push(ue.resolve(It,"components"));Pt.push(ue.resolve(import.meta.dir,"components"));for(let _e of Pt)if(!xe.includes(_e))xe.push(_e);if(wr){let _e=(l._componentPackageDirs??[]).filter((tt)=>typeof tt==="string"&&tt.length>0),bt=(ms?_e.length?_e:l._pluginComponentDirs??[]:l._targetComponentDirs??[]).filter((tt)=>typeof tt==="string"&&tt.length>0);if(bt.length){let tt=xe.slice(Ge).map((Qe)=>ue.isAbsolute(Qe)?Qe:ue.resolve(Sr,Qe)).filter((Qe)=>!bt.includes(Qe)),Nn=`${H}\x00${tt.join("\x00")}`,at=ur.get(Nn);if(at===void 0){at=!1;for(let Qe of tt){for(let vt of de)if(await s(ue.join(Qe,vt))){at=!0;break}if(at)break}ur.set(Nn,at)}if(!at){for(let Qe of bt){let vt=xe.indexOf(Qe);if(vt>=0)xe.splice(vt,1)}xe.splice(Ge,0,...bt)}}}let vr=l._pluginComponentDirs;if(Array.isArray(vr)){for(let _e of vr)if(typeof _e==="string"&&!xe.includes(_e))xe.push(_e)}if(l.fallbackComponentsDir&&!xe.includes(l.fallbackComponentsDir))xe.push(l.fallbackComponentsDir);if(ms){for(let _e of l._targetComponentDirs??[])if(_e&&!xe.includes(_e))xe.push(_e)}let jn=l._nativePrimitivesFallback;if(jn&&!jn.except.some((_e)=>_e.toLowerCase()===H.toLowerCase())&&!xe.includes(jn.dir))xe.push(jn.dir);let kr=[...new Set(xe.map((_e)=>{if(!_e)return _e;return ue.isAbsolute(_e)?_e:ue.resolve(Sr,_e)}))];xe.length=0,xe.push(...kr);let hs=`${H}\x00${u}\x00${kr.join("\x00")}`,xs=ss.get(hs);if(xs)if(await s(xs))M=xs;else ss.delete(hs);if(!M&&(H.startsWith("./")||H.startsWith("../")))M=ue.resolve(ue.dirname(u),`${H}.stx`),oe.push(M);else if(!M)for(let _e of xe){if(!_e)continue;for(let bt of de){let tt=ue.join(_e,bt);if(oe.push(tt),await s(tt)){M=tt;break}}if(M)break;if(!M)try{let bt=await import("fs");if(!bt.statSync(_e,{throwIfNoEntry:!1})?.isDirectory())continue;let Nn=8,at=[{path:_e,depth:0}];while(at.length>0&&!M){let Qe=at.pop();if(Qe.depth>=Nn)continue;let vt;try{vt=bt.readdirSync(Qe.path,{withFileTypes:!0})}catch{continue}for(let Ln of vt){if(!Ln.isDirectory())continue;if(Ln.name==="node_modules"||Ln.name.startsWith("."))continue;let Or=ue.join(Qe.path,Ln.name);for(let ga of de){let bs=ue.join(Or,ga);if(oe.push(bs),await s(bs)){M=bs;break}}if(M)break;at.push({path:Or,depth:Qe.depth+1})}}}catch{}if(M)break}if(M)ss.set(hs,M)}if(!M||!await s(M))return Zo(e,u,oe),Ko(e);x.add(M);let ie;if(fn.has(M)&&lr.get(M)===Fo(M))ie=fn.get(M);else try{let ce=Fo(M);ie=await Bun.file(M).text(),fn.set(M,ie),lr.set(M,ce)}catch(ce){let de=ce instanceof Error?ce.message:String(ce);return Zo(e,u,[M],de),Ko(e)}if(A)for(let ce of new Set([...Object.keys(t),...A.reactiveProps??[]])){let de=ce.toLowerCase();if(de.startsWith("aria-")||de.startsWith("data-"))continue;let Se=ce.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${Se}\\b`).test(ie))A.declaredProps.add(ce);if(new RegExp(`\\$props\\s*(?:\\.\\s*${Se}\\b|\\[\\s*['"]${Se}['"]\\s*\\])`).test(ie)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${Se}['"]`).test(ie))A.consumedProps?.add(ce)}if(A?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(ie))for(let ce of A.reactiveProps){if(Su.has(ce)||A.consumedProps?.has(ce))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${ce.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(ie))continue;let de=`${M}\x00${ce}`;if(Xo.has(de))continue;Xo.add(de),console.warn(`[stx] ${ue.basename(M)} reads \`${ce}\` with defineProps(), which is not live, but ${ue.basename(u)} binds it (:${ce}): the value can arrive empty or stale (on a native screen, and for a :for's rows, it does not arrive at all). Read it with useReactiveProp('${ce}').`)}let ge=new Set(["__originalFilePath","__importedComponents",Hn,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),ye={};for(let[ce,de]of Object.entries(a))if(!ce.startsWith("__")||ge.has(ce))ye[ce]=de;let me=v.length>0?{[Gn]:[...v]}:{},Pe=n;if(n.includes("@include")){let{processIncludes:ce}=await o("stx/includes",()=>import("./chunk-y69hhxn8.js"));Pe=await ce(n,a,u,l,x)}if(/<[A-Z][\w.-]*[\s/>]/.test(Pe)){let{processComponents:ce}=await o("stx/component-renderer",()=>import("./chunk-thyxsg54.js")),de={...a,__processedComponents:O,...me};Pe=await ce(Pe,de,u,l,x);let Se=de.__stx_preserved_client_expressions;if(Array.isArray(Se)&&Se.length>0)a.__stx_preserved_client_expressions=[...new Set([...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Se])]}let Ke=[];if(ll(Pe)){let{processExpressions:ce}=await o("stx/expressions",()=>import("./chunk-f5gg0pxj.js")),de=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...me}:v.length>0?{...a,...me}:a;Pe=ce(Pe,de,u);for(let Se of Pe.matchAll(/\{\{([\s\S]*?)\}\}/g))Ke.push(Se[1].trim())}let Ae=te(Pe),Je=[],et=Ae.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(ce,de)=>{let Se=Ae.scripts[Number(de)]||"",xe=Se.match(/^<script\b([^>]*)>/i)?.[1]||"",Ge=xe.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Ie=!Ge||["module","text/javascript","application/javascript"].includes(Ge),xt=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${xe}`);if(!/\bserver\b/i.test(xe)&&Ie&&!xt)return Je.push(Se),"";return Se}),{extractSlotContent:Ye}=await o("stx/slots",()=>import("./chunk-pc8jnkb3.js")),it=Ye(et),nt={};if(it.defaultSlot?.trim())nt.default=it.defaultSlot;for(let[ce,de]of it.namedSlots)nt[ce]=de.content;let St=a.__stx_scope_seq??={n:0,key:Js(String(a.__filename??u))},Ht=Yo(e,process.cwd()),pt=`stx_${(Ht.endsWith(".stx")?Ht.slice(0,-4):Ht).replace(/[^a-zA-Z0-9]/g,"_")}_${++St.n}_${St.key}`,De={...ye,$uid:pt,$native:l._nativeHostAttrs===!0,...t,props:t,slot:et,$slots:nt,__processedComponents:z,__sections:{},__stx_signals_gate:Te(ie)||ll(n),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Ke]};if(/import\s/.test(ie)){De.__importedComponents=new Map(De.__importedComponents);let{processESImports:ce}=await o("stx/component-renderer",()=>import("./chunk-thyxsg54.js"));ie=await ce(ie,De,M,l,x)}yu(ie,De);let qt=ie,dn=L(qt);if(dn)qt=dn.content.trim();let as=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Zt=[...ie.matchAll(as)];for(let[,ce,de]of Zt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(ce))je(de,M,l.strict);let st=[],Kt=null,cs=Zt.some((ce)=>/\bserver\b/.test(ce[1]||"")&&/\bcache\b/.test(ce[1]||"")),Ct=null,dt=null,Xt=null,gn=0,Jt=null;if(pu(l),cs&&dr>0){let ce=du({props:t,slot:Pe,slotContext:n.trim()?gu(ye):void 0,buildMode:l.buildMode??"",skipEventDirectives:l.skipEventDirectives===!0,native:l._nativeHostAttrs===!0,clientLoopNames:[...v].sort(),layers:l._layerGraph?.layers.map((de)=>de.configFile),uid:pt});if(ce!==null){Ct=`${M}\x00${_(ie)}\x00${ce}`;let de=rs.get(Ct);if(de){for(let Se of de.dependencies)x.add(Se);if(pi(a,de.clientFactories),St.n+=de.uidsConsumed,de.preservedClientExpressions.length>0){let Se=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let xe of de.preservedClientExpressions)Se.add(xe);a.__stx_preserved_client_expressions=[...Se]}return de.output}dt=new Set(x),Xt=li(a),gn=St.n,Jt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let Gt=new Set;for(let ce of Zt){let de=ce[1]||"",Se=ce[2]||"",xe=de.includes("server");if(Ve(de)&&Se.trim())Se=Ue(Se);if(xe&&Se){for(let Ie of Fe(Se))Gt.add(Ie);try{await U(Se,De,M,{onFailure:(Ie)=>{if(Ie.kind!=="unknown")Kt=Ie.kind}})}catch(Ie){}}if(!xe){let Ie=Se.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),xt=Ie.includes("{{")&&Ie.includes("}}"),Rt=Ie.includes("{!!")&&Ie.includes("!!}");if(xt||Rt)Ie=Ri(Ie,De,M);let _t=de.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");st.push(`<script${_t}>${Ie}</script>`)}}let rt=te(ie).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Yt=rt?rt[1]:"",ls=rt?rt[2]:"",gt="",ae=Yt&&/\bscoped\b/i.test(Yt);if(rt)gt=`<style${Yt}>${wu(ls,De,M)}</style>`;let le=qt;if(le=le.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),rt)le=le.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let ce=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,de=[];if(le=le.replace(ce,(Se,xe)=>{let Ge=xe.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Ge)de.push(`<style${Ge[1]}>${Ge[2]}</style>`);return""}),le=le.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),de.length>0)gt=`${gt}${de.join(`
|
|
577
|
-
`)}`}if(n&&le.includes("{{ text || slot }}"))le=le.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>n);let{applySlots:he}=await o("stx/slots",()=>import("./chunk-
|
|
576
|
+
`)}`:"";console.error(`[stx] component <${e}> could not be resolved${u}, so it rendered as nothing.${l}${f}`)}function Ko(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var Su=new Set(["for","if","show","key","ref","class","className","style"]),Xo=new Set,ea="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",ul=new RegExp(`\\b(?:${ea})\\s*(?:<[^>]*>)?\\s*\\(`);function Ti(e){let t=new Set,n=new RegExp(`\\b(?:const|let|var)\\s+([a-zA-Z_$][\\w$]*)\\s*=\\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue|${ea})\\s*(?:<[^>]*>)?\\s*\\(`,"g");for(let i of e){let a;while((a=n.exec(i))!==null)t.add(a[1]);n.lastIndex=0}return[...t]}async function We(e,t,n,i,a,u,l,f=new Set,x,v=ct(a),A,D=e){let{extractVariables:U}=await o("stx/variable-extractor",()=>import("./chunk-df49nnj9.js")),O=f??new Set;if(O.has(e))return`[Circular component reference: ${e}]`;let z=new Set(O);z.add(e);let V=typeof t.client==="string"?t.client.trim():"";if("client"in t)delete t.client;let F=V&&V!=="load"&&Pg(V)?V:"";try{let q=(ce)=>ce.split("-").map((de)=>de.charAt(0).toUpperCase()+de.slice(1)).join(""),H=D.endsWith(".stx")?D.slice(0,-4):D,M=null,ee=a.__importedComponents;if(ee){let ce=[H,H.toLowerCase(),q(H),X(H)];for(let de of ce)if(ee.has(de)){M=ee.get(de);break}}let oe=[];if(!M){let ce=[`${H}.stx`,`${q(H)}.stx`,`${X(H)}.stx`],de=[...new Set(ce)],Se=a.__originalFilePath,xe=[];for(let _e of zn(u))if(!xe.includes(_e))xe.push(_e);let Ge=xe.length;for(let _e of l._layerComponentDirs??[])if(!xe.includes(_e))xe.push(_e);if(Se){let _e=ue.join(ue.dirname(Se),"components");xe.push(_e)}let Ie=l._rootComponentsDir;if(typeof Ie==="string"&&Qo(i,l)&&!xe.includes(Ie))xe.push(Ie);if(i&&!xe.includes(i))xe.push(i);if(typeof Ie==="string"&&!xe.includes(Ie))xe.push(Ie);let xt=ue.join(ue.dirname(u),"components");if(!xe.includes(xt))xe.push(xt);if(l.componentsDir&&l.componentsDir!==i&&!xe.includes(l.componentsDir))xe.push(l.componentsDir);for(let _e of l.additionalComponentsDirs??[])if(_e&&!xe.includes(_e))xe.push(_e);let Rt=l._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(H),_t=(A?.events??[]).map((_e)=>_e.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),Rn=Object.hasOwn(t,"checked")||Boolean(A?.reactiveProps?.includes("checked")),ps=Object.hasOwn(t,"value")||Boolean(A?.reactiveProps?.includes("value")),ds=!_t.includes("valuechange")&&(Rn||_t.includes("change")&&!ps),$t=l._nativeHostAttrs&&/^textinput$/i.test(H),Tt=_t.includes("update:value")&&!_t.includes("input"),tn=l._nativeHostAttrs&&/^video$/i.test(H),gs=l._nativeHostAttrs&&/^image$/i.test(H),An=Hs([...Object.keys(t),...A?.reactiveProps??[]],A?.events,t),At=Object.hasOwn(t,"src")||Boolean(A?.reactiveProps?.includes("src")),In=Object.hasOwn(t,"source")||Boolean(A?.reactiveProps?.includes("source")),Pn=tn&&(At||In)&&(A?.events??[]).every((_e)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(_e.replace(/^@/,"").split(".")[0])),On=new Set(["","primary","secondary","outline","ghost","danger"]),Dn=typeof t.variant==="string"?t.variant.trim().toLowerCase():"",Mn=l._nativeHostAttrs&&/^button$/i.test(H)&&!On.has(Dn),wr=l._targetComponentFallbackNames?.some((_e)=>_e.toLowerCase()===H.toLowerCase())??!1,ms=wr&&(!Rt||ds)&&(!$t||Tt)&&(!tn||Pn)&&(!gs||An)&&!Mn;for(let _e of ms?[]:l._targetComponentDirs??[])if(_e&&!xe.includes(_e))xe.push(_e);let It=typeof l.root==="string"?ue.resolve(l.root):void 0,Sr=It??ue.dirname(u),Pt=[];if(It)Pt.push(ue.resolve(It,"resources/views/components")),Pt.push(ue.resolve(It,"resources/components")),Pt.push(ue.resolve(It,"src/components")),Pt.push(ue.resolve(It,"components"));Pt.push(ue.resolve(import.meta.dir,"components"));for(let _e of Pt)if(!xe.includes(_e))xe.push(_e);if(wr){let _e=(l._componentPackageDirs??[]).filter((tt)=>typeof tt==="string"&&tt.length>0),bt=(ms?_e.length?_e:l._pluginComponentDirs??[]:l._targetComponentDirs??[]).filter((tt)=>typeof tt==="string"&&tt.length>0);if(bt.length){let tt=xe.slice(Ge).map((Qe)=>ue.isAbsolute(Qe)?Qe:ue.resolve(Sr,Qe)).filter((Qe)=>!bt.includes(Qe)),Nn=`${H}\x00${tt.join("\x00")}`,at=ur.get(Nn);if(at===void 0){at=!1;for(let Qe of tt){for(let vt of de)if(await s(ue.join(Qe,vt))){at=!0;break}if(at)break}ur.set(Nn,at)}if(!at){for(let Qe of bt){let vt=xe.indexOf(Qe);if(vt>=0)xe.splice(vt,1)}xe.splice(Ge,0,...bt)}}}let vr=l._pluginComponentDirs;if(Array.isArray(vr)){for(let _e of vr)if(typeof _e==="string"&&!xe.includes(_e))xe.push(_e)}if(l.fallbackComponentsDir&&!xe.includes(l.fallbackComponentsDir))xe.push(l.fallbackComponentsDir);if(ms){for(let _e of l._targetComponentDirs??[])if(_e&&!xe.includes(_e))xe.push(_e)}let jn=l._nativePrimitivesFallback;if(jn&&!jn.except.some((_e)=>_e.toLowerCase()===H.toLowerCase())&&!xe.includes(jn.dir))xe.push(jn.dir);let kr=[...new Set(xe.map((_e)=>{if(!_e)return _e;return ue.isAbsolute(_e)?_e:ue.resolve(Sr,_e)}))];xe.length=0,xe.push(...kr);let hs=`${H}\x00${u}\x00${kr.join("\x00")}`,xs=ss.get(hs);if(xs)if(await s(xs))M=xs;else ss.delete(hs);if(!M&&(H.startsWith("./")||H.startsWith("../")))M=ue.resolve(ue.dirname(u),`${H}.stx`),oe.push(M);else if(!M)for(let _e of xe){if(!_e)continue;for(let bt of de){let tt=ue.join(_e,bt);if(oe.push(tt),await s(tt)){M=tt;break}}if(M)break;if(!M)try{let bt=await import("fs");if(!bt.statSync(_e,{throwIfNoEntry:!1})?.isDirectory())continue;let Nn=8,at=[{path:_e,depth:0}];while(at.length>0&&!M){let Qe=at.pop();if(Qe.depth>=Nn)continue;let vt;try{vt=bt.readdirSync(Qe.path,{withFileTypes:!0})}catch{continue}for(let Ln of vt){if(!Ln.isDirectory())continue;if(Ln.name==="node_modules"||Ln.name.startsWith("."))continue;let Or=ue.join(Qe.path,Ln.name);for(let ga of de){let bs=ue.join(Or,ga);if(oe.push(bs),await s(bs)){M=bs;break}}if(M)break;at.push({path:Or,depth:Qe.depth+1})}}}catch{}if(M)break}if(M)ss.set(hs,M)}if(!M||!await s(M))return Zo(e,u,oe),Ko(e);x.add(M);let ie;if(fn.has(M)&&lr.get(M)===Fo(M))ie=fn.get(M);else try{let ce=Fo(M);ie=await Bun.file(M).text(),fn.set(M,ie),lr.set(M,ce)}catch(ce){let de=ce instanceof Error?ce.message:String(ce);return Zo(e,u,[M],de),Ko(e)}if(A)for(let ce of new Set([...Object.keys(t),...A.reactiveProps??[]])){let de=ce.toLowerCase();if(de.startsWith("aria-")||de.startsWith("data-"))continue;let Se=ce.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${Se}\\b`).test(ie))A.declaredProps.add(ce);if(new RegExp(`\\$props\\s*(?:\\.\\s*${Se}\\b|\\[\\s*['"]${Se}['"]\\s*\\])`).test(ie)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${Se}['"]`).test(ie))A.consumedProps?.add(ce)}if(A?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(ie))for(let ce of A.reactiveProps){if(Su.has(ce)||A.consumedProps?.has(ce))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${ce.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(ie))continue;let de=`${M}\x00${ce}`;if(Xo.has(de))continue;Xo.add(de),console.warn(`[stx] ${ue.basename(M)} reads \`${ce}\` with defineProps(), which is not live, but ${ue.basename(u)} binds it (:${ce}): the value can arrive empty or stale (on a native screen, and for a :for's rows, it does not arrive at all). Read it with useReactiveProp('${ce}').`)}let ge=new Set(["__originalFilePath","__importedComponents",Hn,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),ye={};for(let[ce,de]of Object.entries(a))if(!ce.startsWith("__")||ge.has(ce))ye[ce]=de;let me=v.length>0?{[Gn]:[...v]}:{},Pe=n;if(n.includes("@include")){let{processIncludes:ce}=await o("stx/includes",()=>import("./chunk-26s2jxvn.js"));Pe=await ce(n,a,u,l,x)}if(/<[A-Z][\w.-]*[\s/>]/.test(Pe)){let{processComponents:ce}=await o("stx/component-renderer",()=>import("./chunk-are96jcb.js")),de={...a,__processedComponents:O,...me};Pe=await ce(Pe,de,u,l,x);let Se=de.__stx_preserved_client_expressions;if(Array.isArray(Se)&&Se.length>0)a.__stx_preserved_client_expressions=[...new Set([...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Se])]}let Ke=[];if(ll(Pe)){let{processExpressions:ce}=await o("stx/expressions",()=>import("./chunk-z347p6cg.js")),de=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...me}:v.length>0?{...a,...me}:a;Pe=ce(Pe,de,u);for(let Se of Pe.matchAll(/\{\{([\s\S]*?)\}\}/g))Ke.push(Se[1].trim())}let Ae=te(Pe),Je=[],et=Ae.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(ce,de)=>{let Se=Ae.scripts[Number(de)]||"",xe=Se.match(/^<script\b([^>]*)>/i)?.[1]||"",Ge=xe.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Ie=!Ge||["module","text/javascript","application/javascript"].includes(Ge),xt=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${xe}`);if(!/\bserver\b/i.test(xe)&&Ie&&!xt)return Je.push(Se),"";return Se}),{extractSlotContent:Ye}=await o("stx/slots",()=>import("./chunk-sb8qv9wy.js")),it=Ye(et),nt={};if(it.defaultSlot?.trim())nt.default=it.defaultSlot;for(let[ce,de]of it.namedSlots)nt[ce]=de.content;let St=a.__stx_scope_seq??={n:0,key:Js(String(a.__filename??u))},Ht=Yo(e,process.cwd()),pt=`stx_${(Ht.endsWith(".stx")?Ht.slice(0,-4):Ht).replace(/[^a-zA-Z0-9]/g,"_")}_${++St.n}_${St.key}`,De={...ye,$uid:pt,$native:l._nativeHostAttrs===!0,...t,props:t,slot:et,$slots:nt,__processedComponents:z,__sections:{},__stx_signals_gate:Te(ie)||ll(n),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Ke]};if(/import\s/.test(ie)){De.__importedComponents=new Map(De.__importedComponents);let{processESImports:ce}=await o("stx/component-renderer",()=>import("./chunk-are96jcb.js"));ie=await ce(ie,De,M,l,x)}yu(ie,De);let qt=ie,dn=L(qt);if(dn)qt=dn.content.trim();let as=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Zt=[...ie.matchAll(as)];for(let[,ce,de]of Zt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(ce))je(de,M,l.strict);let st=[],Kt=null,cs=Zt.some((ce)=>/\bserver\b/.test(ce[1]||"")&&/\bcache\b/.test(ce[1]||"")),Ct=null,dt=null,Xt=null,gn=0,Jt=null;if(pu(l),cs&&dr>0){let ce=du({props:t,slot:Pe,slotContext:n.trim()?gu(ye):void 0,buildMode:l.buildMode??"",skipEventDirectives:l.skipEventDirectives===!0,native:l._nativeHostAttrs===!0,clientLoopNames:[...v].sort(),layers:l._layerGraph?.layers.map((de)=>de.configFile),uid:pt});if(ce!==null){Ct=`${M}\x00${_(ie)}\x00${ce}`;let de=rs.get(Ct);if(de){for(let Se of de.dependencies)x.add(Se);if(pi(a,de.clientFactories),St.n+=de.uidsConsumed,de.preservedClientExpressions.length>0){let Se=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let xe of de.preservedClientExpressions)Se.add(xe);a.__stx_preserved_client_expressions=[...Se]}return de.output}dt=new Set(x),Xt=li(a),gn=St.n,Jt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let Gt=new Set;for(let ce of Zt){let de=ce[1]||"",Se=ce[2]||"",xe=de.includes("server");if(Ve(de)&&Se.trim())Se=Ue(Se);if(xe&&Se){for(let Ie of Fe(Se))Gt.add(Ie);try{await U(Se,De,M,{onFailure:(Ie)=>{if(Ie.kind!=="unknown")Kt=Ie.kind}})}catch(Ie){}}if(!xe){let Ie=Se.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),xt=Ie.includes("{{")&&Ie.includes("}}"),Rt=Ie.includes("{!!")&&Ie.includes("!!}");if(xt||Rt)Ie=Ri(Ie,De,M);let _t=de.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");st.push(`<script${_t}>${Ie}</script>`)}}let rt=te(ie).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Yt=rt?rt[1]:"",ls=rt?rt[2]:"",gt="",ae=Yt&&/\bscoped\b/i.test(Yt);if(rt)gt=`<style${Yt}>${wu(ls,De,M)}</style>`;let le=qt;if(le=le.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),rt)le=le.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let ce=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,de=[];if(le=le.replace(ce,(Se,xe)=>{let Ge=xe.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Ge)de.push(`<style${Ge[1]}>${Ge[2]}</style>`);return""}),le=le.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),de.length>0)gt=`${gt}${de.join(`
|
|
577
|
+
`)}`}if(n&&le.includes("{{ text || slot }}"))le=le.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>n);let{applySlots:he}=await o("stx/slots",()=>import("./chunk-sb8qv9wy.js")),{defaultSlot:$e,namedSlots:Oe}=it,Ne=a.__stx_signals_gate===!0&&/\s(?:@[\w:.-]+|x-on:[\w:.-]+)\s*=/.test(et),ot=st.length>0&&Ns(le)||l._nativeHostAttrs===!0&&st.length>0||Ne&&st.length>0||st.some((ce)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(ce)),us=(ce)=>ot?fo(ce,pt):ce,fs=new Map([...Oe].map(([ce,de])=>[ce,{...de,content:us(de.content)}]));le=await he(le,ot?uo(us($e),pt):$e,fs,De,ot?pt:"");let mn=Ti(st),Qt=(Array.isArray(De.__stx_client_signal_names)?De.__stx_client_signal_names:[]).filter((ce)=>!Gt.has(ce));if(mn.length>0||Qt.length>0)De.__stx_client_signal_names=[...new Set([...Qt,...mn])];else delete De.__stx_client_signal_names;let en=v.filter((ce)=>!Gt.has(ce)&&!(ce in t));if(en.length>0)De[Gn]=en;let hn={...l,_rootComponentsDir:l._rootComponentsDir||l.componentsDir,componentsDir:ue.dirname(M),skipSignalsRuntime:!0,skipEventDirectives:l._nativeHostAttrs===!0||ot||st.length===0,defaultLayout:void 0};De.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:yn}=await o("stx/process",()=>import("./chunk-h8rpk597.js")),mt=await yn(le,De,M,hn,x),yt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let ce of mt.matchAll(/\{\{([\s\S]*?)\}\}/g))yt.add(ce[1].trim());if(yt.size>0)a.__stx_preserved_client_expressions=[...yt];let ht=pt,Ze=mt;if(ot){let ce="";if(Object.keys(t).length>0)try{ce=` data-stx-props="${ar(JSON.stringify(t))}"`}catch{}let de=F?` stx-hydrate="${ar(F)}"`:"",Se=Object.fromEntries(Object.entries(nt).map(([$t,Tt])=>[$t,Boolean(Tt)])),xe=Object.keys(Se).length>0?` data-stx-slots="${ar(JSON.stringify(Se))}"`:"",Ge=` data-stx-scope="${ht}"${ce}${xe}${de}`,Ie=mt.slice(Mt(mt)),xt=/^<span(?=[\s/>])/i.test(Ie),Rt=/^<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(Ie),_t=/^<[^>]+\bdata-stx-fill-root(?:\s|=|>)/i.test(Ie),Rn=xt?"span":"div",ps=Rt&&l._nativeHostAttrs?' style="display:flex;flex-direction:column;flex:1;min-height:0;min-width:0"':_t&&l._nativeHostAttrs?' style="width:100%;height:100%"':xt||Rt?' style="display:contents"':"";Ze=Ag(mt,Ge)??`<${Rn}${Ge} data-stx-component-wrapper${ps}>${mt}</${Rn}>`;let ds=await Promise.all(st.map(async($t)=>{let Tt=$t.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!Tt)return $t;let[,tn,gs]=Tt,An=Wo($t,De,M);if(An!==null)return An;let At=await vu(gs,M,l.buildMode==="compile"),In=kn(At.clientCode,ze(De)),{vendorStyleTags:Pn}=At,On=In?`function(__scopeId) {
|
|
578
578
|
${In}
|
|
579
579
|
return (${At.factoryBody})(__scopeId);
|
|
580
580
|
}`:At.factoryBody,Dn=F?null:Ts(a,On),Mn=Dn?`window.__stxComponentFactories[${JSON.stringify(Dn)}](${JSON.stringify(ht)});`:`(${On})(${JSON.stringify(ht)});`;if(F)return`${Pn}<script type="stx/island" data-stx-island="${ht}" data-stx-scoped data-stx-owner="${ht}"${tn}>${pe(Mn)}</script>`;return`${Pn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${ht}"${tn}>${pe(Mn)}</script>`}));if(Ze=Ze+`
|
|
@@ -600,7 +600,7 @@ ${ke.yellow}${ke.bold}Message:${ke.reset} ${t}
|
|
|
600
600
|
`,f)A+=`
|
|
601
601
|
${ke.blue}${ke.bold}Context:${ke.reset}
|
|
602
602
|
${ke.dim}${f}${ke.reset}
|
|
603
|
-
`;return A}function we(){fn.clear(),lr.clear(),ss.clear(),ur.clear(),fr.clear(),pr.clear(),rs.clear()}function gy(){return{size:fn.size,maxSize:500}}var cr=S(128);async function vu(e,t,n){let i=_(e,t,n),a=cr.get(i);if(a){if(Vs(a.deps))return a;cr.delete(i)}let u=Ci(e,{filePath:t,projectRoot:process.cwd()}),l=u.code,f=Ei(u.styles);l=zt(l).code;let{hasUserImports:x,bundleClientScript:v}=await o("stx/client-script-bundler",()=>import("./chunk-
|
|
603
|
+
`;return A}function we(){fn.clear(),lr.clear(),ss.clear(),ur.clear(),fr.clear(),pr.clear(),rs.clear()}function gy(){return{size:fn.size,maxSize:500}}var cr=S(128);async function vu(e,t,n){let i=_(e,t,n),a=cr.get(i);if(a){if(Vs(a.deps))return a;cr.delete(i)}let u=Ci(e,{filePath:t,projectRoot:process.cwd()}),l=u.code,f=Ei(u.styles);l=zt(l).code;let{hasUserImports:x,bundleClientScript:v}=await o("stx/client-script-bundler",()=>import("./chunk-k0ph8zr7.js")),A=[],D=!1;if(x(l)){let H=l;l=await v(H,t,{projectRoot:process.cwd(),minify:n,collectInputs:A}),D=l===H}let{stripStxRuntimeImports:U}=await o("stx/signal-processing",()=>import("./chunk-3t91wwbe.js"));l=U(l);let O=N(l),z=hu(O),V=new Set(K(O,!0).split(",").map((H)=>H.trim())),F=`function(__scopeId) {
|
|
604
604
|
${ft("const",[..._l,...z],O)}
|
|
605
605
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
606
606
|
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import{ye}from"./chunk-hhbt8grm.js";import{qe,B}from"./chunk-60yppcbb.js";import{Nc}from"./chunk-rw5492e2.js";import{l}from"./chunk-46pxmpeb.js";import v from"fs";import m from"path";import{pathToFileURL as I}from"url";var P=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],R=new Set;function fn(s,c={}){let o=m.resolve(s,c.dir??"server/api"),i=[],f=new Map;if(!v.existsSync(o))return i;let t=Array.from(new Bun.Glob("**/*.{ts,js,mts,mjs}").scanSync({cwd:o})).sort();for(let e of t){if(e.endsWith(".d.ts"))continue;let p=e.replace(/\.(?:ts|js|mts|mjs)$/,"").split("/"),n=p.pop(),u=n.lastIndexOf("."),d=u>=0?n.slice(u+1):"get",g=d.toUpperCase();if(!P.includes(g)||d!==d.toLowerCase())throw Error(`Unsupported API method suffix in ${e}; use ${P.map((A)=>A.toLowerCase()).join(", ")}`);if(u>=0)n=n.slice(0,u);if(n!=="index")p.push(n);let r=new Set,h=p.map((A,j)=>{let y=/^\[(\.\.\.)?([A-Za-z_]\w*)\]$/.exec(A);if(y){if(r.has(y[2])||y[1]&&j!==p.length-1)throw Error(`Invalid API parameter in ${e}`);return r.add(y[2]),`:${y[2]}${y[1]?"*":""}`}if(!/^[\w-]+$/.test(A))throw Error(`Unsupported API path segment ${A} in ${e}`);return A}),w=`/api${h.length?`/${h.join("/")}`:""}`,S=`${g} ${w.replace(/:\w+/g,":param")}`;if(f.has(S))throw Error(`Ambiguous API route ${g} ${w}: ${f.get(S)} and ${e}`);f.set(S,e);let x=m.join(o,e);R.add(m.resolve(x)),R.add(v.realpathSync(x)),i.push({pattern:w,method:g,filePath:x})}return i.sort((e,a)=>{let p=e.pattern.split("/"),n=a.pattern.split("/"),u=(d)=>d?.endsWith("*")?0:d?.startsWith(":")?1:2;for(let d=0;d<Math.max(p.length,n.length);d++){let g=u(n[d])-u(p[d]);if(g)return g}return e.pattern.localeCompare(a.pattern)||e.method.localeCompare(a.method)})}async function Lo(s,c){let o=l(s,"api-types.d.ts"),i=["// Generated by stx. Include this file in tsconfig.json.","declare module '@stacksjs/stx/api-client' {"," interface KnownApiRoutes {"];for(let t of c){let e=`./${m.relative(m.dirname(o),t.filePath).replace(/\\/g,"/")}`,{params:a}=ye(t.pattern);i.push(` ${JSON.stringify(`${t.method} ${t.pattern}`)}: { params: { ${a.map((p)=>`${JSON.stringify(p)}: string`).join("; ")} }; response: Awaited<ReturnType<typeof import(${JSON.stringify(e)}).default>> }`)}i.push(" }","}","export {}","");let f=i.join(`
|
|
3
3
|
`);if(!await Bun.file(o).exists()||await Bun.file(o).text()!==f)await Bun.write(o,f);return o}async function jo(s,c,o={}){let i=fn(s,o);await Lo(s,i);let f=[];for(let t of i){let e=await Bun.build({entrypoints:[t.filePath],target:"bun",format:"esm",minify:!1,splitting:!1});if(!e.success)throw Error(`API build failed for ${t.filePath}: ${e.logs.join(`
|
|
4
|
-
`)}`);let a=e.outputs.find((u)=>u.kind==="entry-point");if(!a)throw Error(`No API bundle for ${t.filePath}`);if(e.outputs.length!==1)throw Error(`API endpoint ${t.filePath} emits assets; package those explicitly instead`);let n=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await a.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write(m.join(c,n),a),f.push({...t,filePath:n})}return f}function E(s,c){let o=s.map((i)=>({route:i,...ye(i.pattern)}));return async(i)=>{let f=new URL(i.url).pathname,t=o.filter((r)=>r.regex.test(f));if(!t.length)return null;let e=t[0].route.pattern,a=(r)=>r.replace(/:\w+/g,":param"),p=t.filter((r)=>a(r.route.pattern)===a(e)),n=i.method,u=p.find((r)=>r.route.method===n)??(n==="HEAD"?p.find((r)=>r.route.method==="GET"):void 0);if(!u){let r=new Set(p.map((h)=>h.route.method));if(r.has("GET"))r.add("HEAD");return r.add("OPTIONS"),new Response(null,{status:n==="OPTIONS"?204:405,headers:{Allow:Array.from(r).sort().join(", ")}})}let d=u.regex.exec(f),g=Object.create(null);try{u.params.forEach((r,h)=>{g[r]=decodeURIComponent(d[h+1])})}catch{return new Response("Invalid URL parameter encoding",{status:400})}try{let r=await c(u.route);if(typeof r!=="function")throw Error(`API endpoint ${u.route.filePath} must default-export a handler`);let h=await r(i,{params:g}),w=h instanceof Response?h:h===void 0?new Response(null,{status:204}):Response.json(h);if(n==="HEAD")return new Response(null,{status:w.status,headers:w.headers});return w}catch(r){return console.error(`[stx] API error for ${n} ${e}:`,r),Response.json({error:"Internal Server Error"},{status:500})}}}function Bo(s,c){return E(c,async(o)=>(await import(I(m.resolve(s,o.filePath)).href)).default)}async function Hh(s,c){if(!c)return async()=>null;let o=c===!0?{}:c,i=fn(s,o);return await Lo(s,i),async(f)=>{if(!new URL(f.url).pathname.match(/^\/api(?:\/|$)/))return null;try{let t=fn(s,o);await Lo(s,t);let{loadStxConfig:e}=await import("./chunk-
|
|
4
|
+
`)}`);let a=e.outputs.find((u)=>u.kind==="entry-point");if(!a)throw Error(`No API bundle for ${t.filePath}`);if(e.outputs.length!==1)throw Error(`API endpoint ${t.filePath} emits assets; package those explicitly instead`);let n=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await a.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write(m.join(c,n),a),f.push({...t,filePath:n})}return f}function E(s,c){let o=s.map((i)=>({route:i,...ye(i.pattern)}));return async(i)=>{let f=new URL(i.url).pathname,t=o.filter((r)=>r.regex.test(f));if(!t.length)return null;let e=t[0].route.pattern,a=(r)=>r.replace(/:\w+/g,":param"),p=t.filter((r)=>a(r.route.pattern)===a(e)),n=i.method,u=p.find((r)=>r.route.method===n)??(n==="HEAD"?p.find((r)=>r.route.method==="GET"):void 0);if(!u){let r=new Set(p.map((h)=>h.route.method));if(r.has("GET"))r.add("HEAD");return r.add("OPTIONS"),new Response(null,{status:n==="OPTIONS"?204:405,headers:{Allow:Array.from(r).sort().join(", ")}})}let d=u.regex.exec(f),g=Object.create(null);try{u.params.forEach((r,h)=>{g[r]=decodeURIComponent(d[h+1])})}catch{return new Response("Invalid URL parameter encoding",{status:400})}try{let r=await c(u.route);if(typeof r!=="function")throw Error(`API endpoint ${u.route.filePath} must default-export a handler`);let h=await r(i,{params:g}),w=h instanceof Response?h:h===void 0?new Response(null,{status:204}):Response.json(h);if(n==="HEAD")return new Response(null,{status:w.status,headers:w.headers});return w}catch(r){return console.error(`[stx] API error for ${n} ${e}:`,r),Response.json({error:"Internal Server Error"},{status:500})}}}function Bo(s,c){return E(c,async(o)=>(await import(I(m.resolve(s,o.filePath)).href)).default)}async function Hh(s,c){if(!c)return async()=>null;let o=c===!0?{}:c,i=fn(s,o);return await Lo(s,i),async(f)=>{if(!new URL(f.url).pathname.match(/^\/api(?:\/|$)/))return null;try{let t=fn(s,o);await Lo(s,t);let{loadStxConfig:e}=await import("./chunk-natvnazg.js"),a=B((await e(s)).runtimeConfig);return await qe(a,()=>E(t,async(p)=>{let n=await Bun.build({entrypoints:[p.filePath],target:"bun",format:"esm",splitting:!1});if(!n.success)throw Error(n.logs.join(`
|
|
5
5
|
`));let u=n.outputs.find((d)=>d.kind==="entry-point");if(!u||n.outputs.length!==1)throw Error(`Unsupported API bundle output: ${p.filePath}`);return(await import(`data:text/javascript;base64,${Buffer.from(await u.text()).toString("base64")}`)).default})(f))}catch(t){return console.error("[stx] API discovery failed:",t),Response.json({error:"API discovery failed; check the server log"},{status:500})}}}function Fo(s,c,o){if(Nc(s))return!0;let i=/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/;if(i.test(m.basename(s)))return!0;try{if(i.test(m.basename(v.realpathSync(s))))return!0}catch{}if(R.has(m.resolve(s)))return!0;if(!o)return!1;let f=m.resolve(c,typeof o==="object"?o.dir??"server/api":"server/api"),t=(a)=>{try{return v.realpathSync(a)}catch{return m.resolve(a)}},e=t(s);return[f,m.resolve(c,"server"),m.resolve(c,".output/server")].some((a)=>{let p=t(a);return e===p||e.startsWith(`${p}${m.sep}`)})}
|
|
6
6
|
export{fn,Lo,jo,Bo,Hh,Fo};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{P,d,m,O,p,Z}from"./chunk-csymxc5a.js";import{K,js,je,L,Mt,Ar,Ve,Ue,s,y,Te,R}from"./chunk-
|
|
2
|
+
import{P,d,m,O,p,Z}from"./chunk-csymxc5a.js";import{K,js,je,L,Mt,Ar,Ve,Ue,s,y,Te,R}from"./chunk-eprhhrzc.js";import{ft}from"./chunk-qjey0jk6.js";import{N}from"./chunk-farh4p7f.js";import{de}from"./chunk-vvxcebpn.js";import{V,nt}from"./chunk-4068rmzv.js";import{A,Pn}from"./chunk-9fyw1xkh.js";import M from"path";import{existsSync as ye}from"fs";function ae(c,e){let a=0;for(let r=e;r<c.length;r++){let b=c[r];if(b==="("||b==="["||b==="{")a++;else if(b===")"||b==="]"||b==="}")a--;else if(b===","&&a===0)return r}return-1}function $e(c,e,a){let r=c,b=new RegExp(`${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),n=b.exec(r);while(n){let u=n.index,t=u+n[0].length-1,T=1,W=t+1;while(W<r.length&&T>0){if(r[W]==="(")T++;else if(r[W]===")")T--;W++}if(T!==0)break;let ie=r.substring(t+1,W-1),B=`${a}(${ie})`;r=r.substring(0,u)+B+r.substring(W),b.lastIndex=u+B.length,n=b.exec(r)}return r}function Ee(c){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(c)}function he(c){let e=c,a=[],r=new Set,b=0,n=0,u=e.length,t=(B)=>{n++;while(n<u){if(e[n]==="\\"){n+=2;continue}if(e[n]===B){n++;return}n++}},T=()=>{n++;while(n<u){if(e[n]==="\\"){n+=2;continue}if(e[n]==="`"){n++;return}if(e[n]==="$"&&e[n+1]==="{"){n+=2;let B=1;while(n<u&&B>0)if(e[n]==="{")B++,n++;else if(e[n]==="}")B--,n++;else if(e[n]==="'"||e[n]==='"')t(e[n]);else if(e[n]==="`")T();else n++;continue}n++}},W=()=>{if(e[n]==="/"&&e[n+1]==="/"){while(n<u&&e[n]!==`
|
|
3
3
|
`)n++;return!0}if(e[n]==="/"&&e[n+1]==="*"){n+=2;while(n<u-1&&!(e[n]==="*"&&e[n+1]==="/"))n++;return n+=2,!0}return!1},ie=()=>{if(b!==0)return;let B=e.slice(n).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(B){let H=B[2];if(!r.has(H))a.push(H),r.add(H);return}let se=e.slice(n).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(se){let H=se[1];if(!r.has(H))a.push(H),r.add(H);return}let ee=e.slice(n).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ee){let H=ee[1];if(!r.has(H))a.push(H),r.add(H)}};while(n<u){if(W())continue;if(e[n]==="'"||e[n]==='"'){t(e[n]);continue}if(e[n]==="`"){T();continue}if(e[n]==="{"){b++,n++;continue}if(e[n]==="}"){b--,n++;continue}if(b===0&&/[a-z]/i.test(e[n])&&(n===0||/\s|[;{}()]/.test(e[n-1])))ie();n++}return a.join(", ")}function ve(c,e=""){let a=he(c).split(",").map((r)=>r.trim()).filter(Boolean);return`
|
|
4
4
|
(function() {
|
|
5
5
|
${ft("var",a)}
|
|
@@ -44,10 +44,10 @@ ${n}
|
|
|
44
44
|
}
|
|
45
45
|
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
46
46
|
}
|
|
47
|
-
})();`;return a+c+r}function Me(c,e){if(V(c)){let n=V(c).tag.match(/data-stx-scope="([^"]*)"/);if(n)return{html:c,mergedIntoExisting:n[1],stamped:!0,root:"body"};return{html:nt(c,(u,t)=>`<body${t} data-stx-scope="${e}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let a=Mt(c),r=c.slice(a).match(/^(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(r){let b=r[1]+r[2],n=r[1].slice(1),u=b.match(/data-stx-scope="([^"]*)"/);if(u)return{html:c,mergedIntoExisting:u[1],stamped:!0,root:n};let t=c.slice(0,a),T=r[1],W=r[2];return{html:`${t}${T} data-stx-scope="${e}"${W}${c.slice(a+r[0].length)}`,mergedIntoExisting:null,stamped:!0,root:n}}return{html:c,mergedIntoExisting:null,stamped:!1,root:null}}var Ae=0;function fe(c,e){let a=M.basename(c,".stx").replace(/[^a-zA-Z0-9]/g,"_"),r=e.__stx_scope_seq;return r?`stx_scope_${a}_${++r.n}_${r.key}`:`stx_scope_${a}_${++Ae}`}var le=new Set,pe=new Set;function qh(){le.clear(),pe.clear()}var Ce=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Xf(c){let e=(t)=>t.replace(/[^\n]/g," "),a=c.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,e).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,e).replace(/<!--[\s\S]*?-->/g,e).replace(/\x00STX_HTML_COMMENT_\d+\x00/g,e).replace(/\{\{[\s\S]*?\}\}/g,e).replace(/\{!![\s\S]*?!!\}/g,e),r=[],b=0,n=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,u;while((u=n.exec(a))!==null){let t=u[1]==="/",T=u[2],W=u[3]==="/"||Ce.has(T.toLowerCase());if(t){b=Math.max(0,b-1);continue}if(b===0)r.push(T);if(!W)b++}return r}function me(c){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(c)}var tt=new P(500),wc=new Set;function Kh(){wc.clear()}function De(c){if(c.__onceStore instanceof Set)return c.__onceStore;return wc}async function gs(c,e,a,r,b,n=new Set){let u=r.partialsDir||M.join(M.dirname(a),"partials");if(u&&!M.isAbsolute(u))u=M.resolve(process.cwd(),u);let t=$e(c,"@partial","@include"),T=De(e);t=t.replace(/@once([\s\S]*?)@endonce/g,(f,v,h)=>{let g=v.trim(),i=`${a}:${g}`;if(T.has(i))return"";return T.add(i),v});{let f=/@includeIf\s*\(/g,v;while((v=f.exec(t))!==null){let h=v.index,g=h+v[0].length-1,i=1,x=g+1;while(x<t.length&&i>0){if(t[x]==="(")i++;else if(t[x]===")")i--;x++}if(i!==0)break;let l=t.substring(g+1,x-1),o=l.match(/^\s*['"]([^'"]+)['"]/);if(!o){f.lastIndex=x;continue}let C=o[1],z=W(C,u,a),E="";if(z&&await Bun.file(z).exists())b.add(z),E=`@include(${l})`;t=t.substring(0,h)+E+t.substring(x),f.lastIndex=0}}for(let[f,v]of[["@includeWhen",!1],["@includeUnless",!0]]){let h=new RegExp(`${f.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),g;while((g=h.exec(t))!==null){let i=g.index,x=i+g[0].length-1,l=1,o=x+1;while(o<t.length&&l>0){if(t[o]==="(")l++;else if(t[o]===")")l--;o++}if(l!==0)break;let C=t.substring(x+1,o-1),z=ae(C,0);if(z===-1){h.lastIndex=o;continue}let E=C.substring(0,z).trim(),X=C.substring(z+1).trim(),F=X.match(/^\s*['"]([^'"]+)['"]/);if(!F){h.lastIndex=o;continue}let _=F[1],G=X.substring(F[0].length),D,k=ae(G,0);if(k!==-1)D=G.substring(k+1).trim();try{let I=`Boolean(${E})`,j;if(m(I)){let oe=p(I,Object.keys(e));j=Boolean(oe(...Object.values(e)))}else j=Boolean(d(I,e));let te=v?!j:j,re="";if(te){let oe=W(_,u,a);if(oe&&await Bun.file(oe).exists())b.add(oe);re=`@include('${_}'${D?`, ${D}`:""})`}t=t.substring(0,i)+re+t.substring(o),h.lastIndex=0}catch(I){let j=I instanceof Error?I.message:String(I),te=y("Include",`Error evaluating ${f} condition: ${j}`,a,c,i);t=t.substring(0,i)+te+t.substring(o),h.lastIndex=0}}}{let f=/@each\s*\(/g,v;while((v=f.exec(t))!==null){let h=v.index,g=h+v[0].length-1,i=1,x=g+1;while(x<t.length&&i>0){if(t[x]==="(")i++;else if(t[x]===")"){if(i--,i===0)break}x++}if(i!==0)break;let l=t.substring(g+1,x),o=t.substring(h,x+1),C=l.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!C){f.lastIndex=0,t=t.replace(o,"");continue}let[,z,E,X,F]=C;try{let _,G=E.trim();if(m(G))_=p(G,Object.keys(e))(...Object.values(e));else _=d(G,e);let D="";if(Array.isArray(_)&&_.length>0)for(let k of _){let I={...e,[X]:k},j=await se(z,I,c,h);D+=j}else if(F)D=await se(F,{},c,h);t=t.substring(0,h)+D+t.substring(x+1),f.lastIndex=0}catch(_){let G=_ instanceof Error?_.message:String(_);t=t.substring(0,h)+y("Each",`Error in @each: ${G}`,a,c,h)+t.substring(x+1),f.lastIndex=0}}}{let f=/@includeFirst\s*\(/g,v;while((v=f.exec(t))!==null){let h=v.index,g=h+v[0].length-1,i=1,x=g+1;while(x<t.length&&i>0){if(t[x]==="(")i++;else if(t[x]===")"){if(i--,i===0)break}x++}if(i!==0)break;let l=t.substring(g+1,x),o=t.substring(h,x+1),C=l.match(/^\s*(\[[^\]]+\])/);if(!C){f.lastIndex=0,t=t.replace(o,"");continue}let z=C[1],E=l.slice(C[0].length),X,F=E.match(/^\s*,\s*\{/);if(F){E=E.slice(F[0].length-1);let D=1,k=1;while(k<E.length&&D>0){if(E[k]==="{")D++;else if(E[k]==="}"){if(D--,D===0)break}k++}X=E.substring(0,k+1),E=E.slice(k+1)}let _,G=E.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(G)_=G[1];try{let D=JSON.parse(z.replace(/'/g,'"')),k={};if(X)try{k=O(X,e)}catch(j){let te=j instanceof Error?j.message:String(j);if(r.debug){let re=y("Include",`Error parsing includeFirst variables: ${te}`,a,c,h,o);t=t.replace(o,()=>re)}else t=t.replace(o,()=>_||"");continue}let I=!1;for(let j of D){let te=W(j,u,a);if(!te)continue;if(await s(te)){let re=await se(j,k,c,h);t=t.replace(o,()=>re),I=!0;break}}if(!I)if(_!==void 0)t=t.replace(o,()=>_);else if(r.debug){let j=y("Include",`None of the includeFirst paths exist: ${z}`,a,c,h,o);t=t.replace(o,()=>j)}else t=t.replace(o,"")}catch(D){let k=D instanceof Error?D.message:String(D),I=y("Include",`Error processing @includeFirst: ${k}`,a,c,h,o);t=t.replace(o,()=>I)}f.lastIndex=0}}function W(f,v,h){try{let g=f;if(!f.endsWith(".stx"))g=`${f}.stx`;let i=M.resolve(v),x=M.resolve(M.dirname(h)),l;if(!g.startsWith("./")&&!g.startsWith("../")){for(let F of r._layerPartialDirs??[]){let _=M.resolve(F,g);if(_.startsWith(`${M.resolve(F)}${M.sep}`)&&ye(_))return _}l=M.resolve(v,g)}else l=M.resolve(x,g);let o=M.normalize(l),C=o.startsWith(i+M.sep)||o===i,z=o.startsWith(x+M.sep)||o===x,E=!1,X=M.dirname(x);if(o.startsWith(X+M.sep)){if(!M.relative(X,o).split(M.sep).some((D)=>D.startsWith(".")&&D!=="."&&D!==".."))E=!0}if(!C&&!z&&!E)return console.error(`Security: Path traversal attempt blocked for include path: ${f}`),console.error(` Resolved to: ${o}`),console.error(` Allowed dirs: ${i}, ${x}`),null;return o}catch(g){return console.error(`Error resolving path ${f}: ${g}`),null}}let ie=M.resolve(a);n.add(ie);function B(f,v,h,g){return r.onIncludeError?.({includePath:f,templatePath:a,message:v,partialsDir:u}),y("Include",v,a,h,g)}async function se(f,v={},h,g){let i=W(f,u,a);if(!i)return B(f,`Could not resolve path for include: ${f}`,h,g);let x=M.resolve(i);if(n.has(x)){let l=[...n,x].map((o)=>M.basename(o)).join(" -> ");return B(f,`Circular include detected: ${l}`,h,g)}try{b.add(i);let l;if(!l)try{l=await Bun.file(i).text()}catch(S){let J=S instanceof Error?S.message:String(S);return B(f,`Error loading include file ${f}: ${J}`,h,g)}if(l)l=l.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(l&&l.includes("@stream")){let{processStreamDirectives:S}=await import("./chunk-
|
|
47
|
+
})();`;return a+c+r}function Me(c,e){if(V(c)){let n=V(c).tag.match(/data-stx-scope="([^"]*)"/);if(n)return{html:c,mergedIntoExisting:n[1],stamped:!0,root:"body"};return{html:nt(c,(u,t)=>`<body${t} data-stx-scope="${e}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let a=Mt(c),r=c.slice(a).match(/^(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(r){let b=r[1]+r[2],n=r[1].slice(1),u=b.match(/data-stx-scope="([^"]*)"/);if(u)return{html:c,mergedIntoExisting:u[1],stamped:!0,root:n};let t=c.slice(0,a),T=r[1],W=r[2];return{html:`${t}${T} data-stx-scope="${e}"${W}${c.slice(a+r[0].length)}`,mergedIntoExisting:null,stamped:!0,root:n}}return{html:c,mergedIntoExisting:null,stamped:!1,root:null}}var Ae=0;function fe(c,e){let a=M.basename(c,".stx").replace(/[^a-zA-Z0-9]/g,"_"),r=e.__stx_scope_seq;return r?`stx_scope_${a}_${++r.n}_${r.key}`:`stx_scope_${a}_${++Ae}`}var le=new Set,pe=new Set;function qh(){le.clear(),pe.clear()}var Ce=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Xf(c){let e=(t)=>t.replace(/[^\n]/g," "),a=c.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,e).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,e).replace(/<!--[\s\S]*?-->/g,e).replace(/\x00STX_HTML_COMMENT_\d+\x00/g,e).replace(/\{\{[\s\S]*?\}\}/g,e).replace(/\{!![\s\S]*?!!\}/g,e),r=[],b=0,n=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,u;while((u=n.exec(a))!==null){let t=u[1]==="/",T=u[2],W=u[3]==="/"||Ce.has(T.toLowerCase());if(t){b=Math.max(0,b-1);continue}if(b===0)r.push(T);if(!W)b++}return r}function me(c){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(c)}var tt=new P(500),wc=new Set;function Kh(){wc.clear()}function De(c){if(c.__onceStore instanceof Set)return c.__onceStore;return wc}async function gs(c,e,a,r,b,n=new Set){let u=r.partialsDir||M.join(M.dirname(a),"partials");if(u&&!M.isAbsolute(u))u=M.resolve(process.cwd(),u);let t=$e(c,"@partial","@include"),T=De(e);t=t.replace(/@once([\s\S]*?)@endonce/g,(f,v,h)=>{let g=v.trim(),i=`${a}:${g}`;if(T.has(i))return"";return T.add(i),v});{let f=/@includeIf\s*\(/g,v;while((v=f.exec(t))!==null){let h=v.index,g=h+v[0].length-1,i=1,x=g+1;while(x<t.length&&i>0){if(t[x]==="(")i++;else if(t[x]===")")i--;x++}if(i!==0)break;let l=t.substring(g+1,x-1),o=l.match(/^\s*['"]([^'"]+)['"]/);if(!o){f.lastIndex=x;continue}let C=o[1],z=W(C,u,a),E="";if(z&&await Bun.file(z).exists())b.add(z),E=`@include(${l})`;t=t.substring(0,h)+E+t.substring(x),f.lastIndex=0}}for(let[f,v]of[["@includeWhen",!1],["@includeUnless",!0]]){let h=new RegExp(`${f.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),g;while((g=h.exec(t))!==null){let i=g.index,x=i+g[0].length-1,l=1,o=x+1;while(o<t.length&&l>0){if(t[o]==="(")l++;else if(t[o]===")")l--;o++}if(l!==0)break;let C=t.substring(x+1,o-1),z=ae(C,0);if(z===-1){h.lastIndex=o;continue}let E=C.substring(0,z).trim(),X=C.substring(z+1).trim(),F=X.match(/^\s*['"]([^'"]+)['"]/);if(!F){h.lastIndex=o;continue}let _=F[1],G=X.substring(F[0].length),D,k=ae(G,0);if(k!==-1)D=G.substring(k+1).trim();try{let I=`Boolean(${E})`,j;if(m(I)){let oe=p(I,Object.keys(e));j=Boolean(oe(...Object.values(e)))}else j=Boolean(d(I,e));let te=v?!j:j,re="";if(te){let oe=W(_,u,a);if(oe&&await Bun.file(oe).exists())b.add(oe);re=`@include('${_}'${D?`, ${D}`:""})`}t=t.substring(0,i)+re+t.substring(o),h.lastIndex=0}catch(I){let j=I instanceof Error?I.message:String(I),te=y("Include",`Error evaluating ${f} condition: ${j}`,a,c,i);t=t.substring(0,i)+te+t.substring(o),h.lastIndex=0}}}{let f=/@each\s*\(/g,v;while((v=f.exec(t))!==null){let h=v.index,g=h+v[0].length-1,i=1,x=g+1;while(x<t.length&&i>0){if(t[x]==="(")i++;else if(t[x]===")"){if(i--,i===0)break}x++}if(i!==0)break;let l=t.substring(g+1,x),o=t.substring(h,x+1),C=l.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!C){f.lastIndex=0,t=t.replace(o,"");continue}let[,z,E,X,F]=C;try{let _,G=E.trim();if(m(G))_=p(G,Object.keys(e))(...Object.values(e));else _=d(G,e);let D="";if(Array.isArray(_)&&_.length>0)for(let k of _){let I={...e,[X]:k},j=await se(z,I,c,h);D+=j}else if(F)D=await se(F,{},c,h);t=t.substring(0,h)+D+t.substring(x+1),f.lastIndex=0}catch(_){let G=_ instanceof Error?_.message:String(_);t=t.substring(0,h)+y("Each",`Error in @each: ${G}`,a,c,h)+t.substring(x+1),f.lastIndex=0}}}{let f=/@includeFirst\s*\(/g,v;while((v=f.exec(t))!==null){let h=v.index,g=h+v[0].length-1,i=1,x=g+1;while(x<t.length&&i>0){if(t[x]==="(")i++;else if(t[x]===")"){if(i--,i===0)break}x++}if(i!==0)break;let l=t.substring(g+1,x),o=t.substring(h,x+1),C=l.match(/^\s*(\[[^\]]+\])/);if(!C){f.lastIndex=0,t=t.replace(o,"");continue}let z=C[1],E=l.slice(C[0].length),X,F=E.match(/^\s*,\s*\{/);if(F){E=E.slice(F[0].length-1);let D=1,k=1;while(k<E.length&&D>0){if(E[k]==="{")D++;else if(E[k]==="}"){if(D--,D===0)break}k++}X=E.substring(0,k+1),E=E.slice(k+1)}let _,G=E.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(G)_=G[1];try{let D=JSON.parse(z.replace(/'/g,'"')),k={};if(X)try{k=O(X,e)}catch(j){let te=j instanceof Error?j.message:String(j);if(r.debug){let re=y("Include",`Error parsing includeFirst variables: ${te}`,a,c,h,o);t=t.replace(o,()=>re)}else t=t.replace(o,()=>_||"");continue}let I=!1;for(let j of D){let te=W(j,u,a);if(!te)continue;if(await s(te)){let re=await se(j,k,c,h);t=t.replace(o,()=>re),I=!0;break}}if(!I)if(_!==void 0)t=t.replace(o,()=>_);else if(r.debug){let j=y("Include",`None of the includeFirst paths exist: ${z}`,a,c,h,o);t=t.replace(o,()=>j)}else t=t.replace(o,"")}catch(D){let k=D instanceof Error?D.message:String(D),I=y("Include",`Error processing @includeFirst: ${k}`,a,c,h,o);t=t.replace(o,()=>I)}f.lastIndex=0}}function W(f,v,h){try{let g=f;if(!f.endsWith(".stx"))g=`${f}.stx`;let i=M.resolve(v),x=M.resolve(M.dirname(h)),l;if(!g.startsWith("./")&&!g.startsWith("../")){for(let F of r._layerPartialDirs??[]){let _=M.resolve(F,g);if(_.startsWith(`${M.resolve(F)}${M.sep}`)&&ye(_))return _}l=M.resolve(v,g)}else l=M.resolve(x,g);let o=M.normalize(l),C=o.startsWith(i+M.sep)||o===i,z=o.startsWith(x+M.sep)||o===x,E=!1,X=M.dirname(x);if(o.startsWith(X+M.sep)){if(!M.relative(X,o).split(M.sep).some((D)=>D.startsWith(".")&&D!=="."&&D!==".."))E=!0}if(!C&&!z&&!E)return console.error(`Security: Path traversal attempt blocked for include path: ${f}`),console.error(` Resolved to: ${o}`),console.error(` Allowed dirs: ${i}, ${x}`),null;return o}catch(g){return console.error(`Error resolving path ${f}: ${g}`),null}}let ie=M.resolve(a);n.add(ie);function B(f,v,h,g){return r.onIncludeError?.({includePath:f,templatePath:a,message:v,partialsDir:u}),y("Include",v,a,h,g)}async function se(f,v={},h,g){let i=W(f,u,a);if(!i)return B(f,`Could not resolve path for include: ${f}`,h,g);let x=M.resolve(i);if(n.has(x)){let l=[...n,x].map((o)=>M.basename(o)).join(" -> ");return B(f,`Circular include detected: ${l}`,h,g)}try{b.add(i);let l;if(!l)try{l=await Bun.file(i).text()}catch(S){let J=S instanceof Error?S.message:String(S);return B(f,`Error loading include file ${f}: ${J}`,h,g)}if(l)l=l.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(l&&l.includes("@stream")){let{processStreamDirectives:S}=await import("./chunk-9kghtf20.js");l=S(l,e)}if(l&&(r.debug||!A()&&!Pn()))try{let{warnUnbalancedTags:S}=await import("./chunk-vk98r75z.js");S(l,i)}catch{}try{let{processESImports:S}=await import("./chunk-are96jcb.js");l=await S(l,e,i,r,b)}catch(S){if(r.debug)console.warn(`[stx] partial ES import extraction skipped for ${i}:`,S instanceof Error?S.message:S)}let o=l,C=L(o);if(C)o=C.content.trim();let E=l.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),X="";if(E)X=`<style${E[1]}>${E[2]}</style>`;let F=[];o=o.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(S,J,w)=>{if(!me(J))return"";return F.push({attrs:J,body:w}),`__STX_DATA_BLOCK_${F.length-1}__`}),o=o.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let _={...e};_.__stx_signals_gate=Te(l,i);for(let[S,J]of Object.entries(v))_[S]=J;let G=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,D=[...l.matchAll(G)].sort((S,J)=>{let w=(S[1]||"").includes("server"),q=(J[1]||"").includes("server");return Number(q)-Number(w)}),k="",I=null,j=!1,te=!1;for(let S of D){let J=S[1]||"",w=S[2]||"";if(me(J))continue;let q=J.includes("server"),be=Ve(J);if(!q&&!/\bsrc\s*=/i.test(J))je(w,i,r.strict);if(!q&&w.trim()){let{interpolateScriptExpressions:U}=await import("./chunk-z347p6cg.js");w=U(w,_,f)}let ce="";try{let{extractAndStripCssImports:U,renderVendorStyleTags:Y}=await import("./chunk-0g80km93.js"),ne=U(w,{filePath:i,projectRoot:process.cwd()});w=ne.code,ce=Y(ne.styles)}catch(U){if(r.debug)console.warn(`[stx] vendor-css extractor skipped for ${i}:`,U instanceof Error?U.message:U)}if(be&&w.trim())w=Ue(w);if(!q){try{let{injectBrowserCoreAutoImports:Y}=await import("./chunk-0g80km93.js");w=Y(w).code;let{hasUserImports:ne,bundleClientScript:Se}=await import("./chunk-k0ph8zr7.js");if(ne(w))w=await Se(w,i,{projectRoot:process.cwd()})}catch(Y){if(r.debug)console.warn(`[stx] bundler skipped for ${i}:`,Y instanceof Error?Y.message:Y)}let{stripStxRuntimeImports:U}=await import("./chunk-3t91wwbe.js");w=U(w)}let ge=Ee(w);if(!q){let{extractBridgeData:U,generateServerDataBridge:Y}=await import("./chunk-0g80km93.js"),ne=Y(w,U(_));if(ne)w=`${ne}
|
|
48
48
|
${w}`}if(ge&&!q){j=!0,I=fe(i,e);let U=N(w),Y=ue(U,I);k+=`${ce}<script data-stx-scoped data-stx-run="always" data-stx-owner="${I}">${Y}</script>
|
|
49
|
-
`;continue}if(q)try{let{extractVariables:U}=await import("./chunk-
|
|
50
|
-
`}}if(F.length>0){let{interpolateScriptExpressions:S}=await import("./chunk-
|
|
49
|
+
`;continue}if(q)try{let{extractVariables:U}=await import("./chunk-df49nnj9.js");await U(w,_,i)}catch(U){if(r.debug)console.warn(`Warning: Could not extract variables from server script in ${i}:`,U)}if(!q&&!ge){let U=J.replace(/\bclient\b/i,"").trim();I=fe(i,e);let Y=N(w),ne=ue(Y,I);if(/__scopeRegistration\["(?!__stx)[^"]+"\]\s*=|Object\.defineProperty\(__scopeRegistration, "(?!__stx)/.test(ne))te=!0;k+=`${ce}<script data-stx-scoped data-stx-run="always" data-stx-owner="${I}"${U?` ${U}`:""}>${ne}</script>
|
|
50
|
+
`}}if(F.length>0){let{interpolateScriptExpressions:S}=await import("./chunk-z347p6cg.js");o=o.replace(/__STX_DATA_BLOCK_(\d+)__/g,(J,w)=>{let q=F[Number(w)];return`<script${q.attrs}>${S(q.body,_,f)}</script>`})}if(I){let S=Me(o,I);if(o=S.html,S.mergedIntoExisting){let w=I,q=S.mergedIntoExisting;k=k.split(`'${w}'`).join(`'${q}'`).split(`"${w}"`).join(`"${q}"`),I=q}else if(!S.stamped&&j&&!le.has(i))le.add(i),console.warn(`[stx] ${M.relative(process.cwd(),i)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`);if(S.stamped&&S.root!=="body"&&(j||te)&&!pe.has(i)){let w=Xf(o);if(w.length>1)pe.add(i),console.warn(`[stx] ${M.relative(process.cwd(),i)} declares ${j?"signals":"bindings"} and has ${w.length} top-level elements (${w.map((q)=>`<${q}>`).join(", ")}). Only the first is scoped, so bindings in the others cannot see what this partial's script declares. Wrap the partial's markup in a single root element.`)}let J=S.stamped&&S.root!==null&&Ar(S.root);k=ke(k,J?I:null)}if(o.includes("@include")||o.includes("@partial"))o=await gs(o,_,i,r,b,n);let{processLoops:re,reportDeferredLoopWarnings:oe}=await import("./chunk-z3afnkan.js"),Q=re(o,_,i,void 0,!0);Q=de(Q,_,i),Q=oe(Q);let{processMetaDirectives:xe,processSeoDirective:_e,processStructuredData:we}=await import("./chunk-d0h18m2r.js");if(Q=xe(Q,_,i,r),Q=we(Q,_,i),Q=_e(Q,_,i,r),Q=R(Q,_,i),X)Q+=`
|
|
51
51
|
`+X;if(k)Q+=`
|
|
52
52
|
`+k;return Q}catch(l){if(l instanceof Z)throw l;let o=l instanceof Error?l.message:String(l);return B(f,`Error processing include ${f}: ${o}`,h,g)}}let ee=/@include\s*\(/g,H;while((H=ee.exec(t))!==null){let f=H.index,v=f+H[0].length-1,h=1,g=v+1;while(g<t.length&&h>0){if(t[g]==="(")h++;else if(t[g]===")")h--;g++}if(h!==0)break;let i=t.substring(f,g),x=t.substring(v+1,g-1),l=x.match(/^\s*['"]([^'"]+)['"]/);if(!l){ee.lastIndex=g;continue}let o=l[1],C,z=x.substring(l[0].length),E=ae(z,0);if(E!==-1)C=z.substring(E+1).trim();let X={};if(C)try{X=O(C,e)}catch(_){let G=_ instanceof Error?_.message:String(_);t=t.replace(i,y("Include",`Error parsing include variables for ${o}: ${G}`,a,c,f)),ee.lastIndex=0;continue}let F=await se(o,X,c,f);t=t.substring(0,f)+F+t.substring(g),ee.lastIndex=0}return t}function ms(c,e){let a=c;function r(b,n,u,t){let T=b,W=!0;while(W){W=!1;let ie=new RegExp(`@${n}\\(['"]([^'"]+)['"]\\)`),B=T.match(ie);if(!B||B.index===void 0)break;let se=B.index,ee=B[1],H=se+B[0].length,f=new RegExp(`@${n}\\(`),v=new RegExp(`@${u}(?![a-z])`),h=1,g=H,i=-1;while(h>0&&g<T.length){let l=T.slice(g),o=l.match(f),C=l.match(v),z=o?g+o.index:1/0,E=C?g+C.index:1/0;if(z<E)h++,g=z+(o[0].length||1);else if(E<1/0){if(h--,h===0){i=E;break}g=E+u.length+1}else break}if(i===-1)break;let x=T.slice(H,i);if(!e[ee])e[ee]=[];if(t)e[ee].unshift(x);else e[ee].push(x);T=T.substring(0,se)+T.substring(i+`@${u}`.length),W=!0}return T}return a=r(a,"push","endpush",!1),a=r(a,"prepend","endprepend",!0),a}function hs(c,e){return c.replace(/@stack\(['"]([^'"]+)['"]\)/g,(a,r)=>{if(!e[r]||e[r].length===0)return"";return e[r].join(`
|
|
53
53
|
`)})}
|