@stacksjs/stx 0.2.904 → 0.2.907
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/app-shell.d.ts +1 -1
- package/dist/app-shell.js +1 -1
- package/dist/{chunk-n3fgrsva.js → chunk-0d3pkkrv.js} +2 -2
- package/dist/{chunk-9y83pdcb.js → chunk-0vyytd9v.js} +3 -3
- package/dist/{chunk-v5y66rwr.js → chunk-13awnyq0.js} +1 -1
- package/dist/chunk-1dc6h93m.js +2 -0
- package/dist/{chunk-ffytbb4x.js → chunk-1ezcxbpg.js} +5 -5
- package/dist/{chunk-eb5v9npc.js → chunk-1hx6dyy9.js} +2 -2
- package/dist/{chunk-a7bqrjm5.js → chunk-1jxkc6d0.js} +2 -2
- package/dist/chunk-20hy5p3p.js +2 -0
- package/dist/chunk-20zx1msx.js +2 -0
- package/dist/chunk-218pnbaf.js +2 -0
- package/dist/chunk-257msenj.js +3 -0
- package/dist/chunk-291860br.js +2 -0
- package/dist/chunk-2fyey6pn.js +2 -0
- package/dist/chunk-2jkq15je.js +2 -0
- package/dist/{chunk-eb5cma4b.js → chunk-2m4d8jkv.js} +2 -2
- package/dist/{chunk-p89rpak1.js → chunk-2qk2ppgm.js} +1 -1
- package/dist/{chunk-arfpzf17.js → chunk-357qjcj1.js} +2 -2
- package/dist/chunk-3611xczp.js +3 -0
- package/dist/chunk-3dy3hr8r.js +2 -0
- package/dist/{chunk-edpsk4bg.js → chunk-3m457a9q.js} +9 -9
- package/dist/{chunk-nc5d3a5r.js → chunk-3syagjd7.js} +5 -5
- package/dist/{chunk-9fcanx7q.js → chunk-3yr0wyc9.js} +2 -2
- package/dist/{chunk-n9axtmxs.js → chunk-42z7zv92.js} +5 -5
- package/dist/chunk-4345d8s9.js +2 -0
- package/dist/chunk-43kz6rx9.js +2 -0
- package/dist/chunk-47ver0g7.js +2 -0
- package/dist/chunk-4a6mptfc.js +2 -0
- package/dist/{chunk-hdfhaddy.js → chunk-4b110x6r.js} +2 -2
- package/dist/chunk-4b9jx2c1.js +2 -0
- package/dist/chunk-4dh1b9yr.js +2 -0
- package/dist/chunk-4nc8vdef.js +2 -0
- package/dist/{chunk-pwpge9bj.js → chunk-5jc9hmwg.js} +2 -2
- package/dist/{chunk-ern5hyvr.js → chunk-5jn2qyv7.js} +1 -1
- package/dist/{chunk-fcqc9yws.js → chunk-5m4zgt4m.js} +14 -14
- package/dist/{chunk-0hcek8nq.js → chunk-6bgerbgh.js} +1 -1
- package/dist/{chunk-n1wn4wvm.js → chunk-6qgrr453.js} +3 -3
- package/dist/{chunk-ayady5ws.js → chunk-6w9av0n9.js} +2 -2
- package/dist/{chunk-hnjeqxqy.js → chunk-6yketqa1.js} +2 -2
- package/dist/{chunk-5yvgzh6n.js → chunk-72pbhpq8.js} +2 -2
- package/dist/chunk-7k1thytm.js +2 -0
- package/dist/{chunk-jwvv842z.js → chunk-83g4169y.js} +19 -19
- package/dist/chunk-8f5x16ht.js +2 -0
- package/dist/{chunk-vfctk20v.js → chunk-8n42epb6.js} +3 -3
- package/dist/{chunk-k3ytyhkr.js → chunk-8p3vqt2q.js} +3 -3
- package/dist/{chunk-p92272k0.js → chunk-8tfpv6zf.js} +2 -2
- package/dist/chunk-94r6mkcy.js +2 -0
- package/dist/chunk-96wdxfn4.js +2 -0
- package/dist/{chunk-rdrstnn9.js → chunk-9atdw0p8.js} +2 -2
- package/dist/chunk-9bc23bv2.js +2 -0
- package/dist/{chunk-5jrpzepc.js → chunk-9bexzgws.js} +2 -2
- package/dist/{chunk-0gc1hez6.js → chunk-9tj16d70.js} +3 -3
- package/dist/chunk-9xzej52j.js +2 -0
- package/dist/{chunk-rzmk73fz.js → chunk-ab1z38gj.js} +2 -2
- package/dist/chunk-abxwggen.js +2 -0
- package/dist/{chunk-n642g6n0.js → chunk-afmmrqee.js} +15 -15
- package/dist/{chunk-68r2zs20.js → chunk-ahf9j8wb.js} +4 -4
- package/dist/chunk-asewbsct.js +2 -0
- package/dist/{chunk-0b57fgpn.js → chunk-b234w3mf.js} +30 -10
- package/dist/chunk-bcspywrd.js +2 -0
- package/dist/chunk-bprjp80g.js +2 -0
- package/dist/{chunk-n7rwbccm.js → chunk-bpx9cys7.js} +6 -6
- package/dist/{chunk-945zygwa.js → chunk-c08jvjqt.js} +27 -27
- package/dist/{chunk-gyqg3xjp.js → chunk-c5cxpkfy.js} +5 -5
- package/dist/chunk-c60egpe6.js +2 -0
- package/dist/chunk-cjq455ve.js +2 -0
- package/dist/chunk-ck4ypzet.js +3 -0
- package/dist/{chunk-46khhke2.js → chunk-cpt9sg6d.js} +1 -1
- package/dist/{chunk-73ebyhqq.js → chunk-cq4cwfqf.js} +2 -2
- package/dist/chunk-cqq68aw8.js +2 -0
- package/dist/{chunk-qs0zk04y.js → chunk-cwcmmgvz.js} +2 -2
- package/dist/{chunk-5gnt3qtn.js → chunk-d4hnj3ct.js} +3 -3
- package/dist/{chunk-6c8s1pax.js → chunk-e4tbq8a0.js} +9 -9
- package/dist/{chunk-qykbjg3z.js → chunk-e5rag6rh.js} +2 -2
- package/dist/{chunk-150cz8qq.js → chunk-eca022er.js} +7 -7
- package/dist/{chunk-fksmr50h.js → chunk-ekyx5z50.js} +6 -6
- package/dist/{chunk-xr1s56k5.js → chunk-eptzpvn0.js} +3 -3
- package/dist/chunk-exc8y30f.js +42 -0
- package/dist/{chunk-ty5frr9t.js → chunk-fds6vvq0.js} +150 -149
- package/dist/{chunk-de61k0ab.js → chunk-fs43342z.js} +2 -2
- package/dist/{chunk-essmq8yb.js → chunk-fwffn130.js} +9 -9
- package/dist/{chunk-54x7h3sb.js → chunk-fycxc75p.js} +1 -1
- package/dist/chunk-fzh73jtc.js +2 -0
- package/dist/{chunk-gnf1e5q7.js → chunk-fznjm7qt.js} +2 -2
- package/dist/{chunk-r0az4z6d.js → chunk-gfp39bzr.js} +2 -2
- package/dist/{chunk-8xb09hnn.js → chunk-gg31th5s.js} +4 -4
- package/dist/chunk-gjnxnfrg.js +2 -0
- package/dist/chunk-gjzs6p2v.js +2 -0
- package/dist/chunk-gmczbe3j.js +2 -0
- package/dist/{chunk-7nf7mp27.js → chunk-gyv2bsmn.js} +2 -2
- package/dist/chunk-h7xqba9k.js +2 -0
- package/dist/{chunk-9w7whtbx.js → chunk-hhspwfva.js} +2 -2
- package/dist/chunk-hpxhxwda.js +2 -0
- package/dist/chunk-j661q889.js +2 -0
- package/dist/chunk-j90sfypd.js +2 -0
- package/dist/{chunk-4hk1mjtv.js → chunk-jhegz7az.js} +5 -5
- package/dist/{chunk-tqm66mh3.js → chunk-jj78m9k1.js} +132 -51
- package/dist/chunk-jnk3nk5k.js +2 -0
- package/dist/{chunk-mry67rsk.js → chunk-jttzrv0w.js} +6 -6
- package/dist/{chunk-5tm1pvt3.js → chunk-jz37h2z0.js} +2 -2
- package/dist/chunk-jzbte09f.js +2 -0
- package/dist/chunk-k5v22gn4.js +2 -0
- package/dist/{chunk-e3svj8ex.js → chunk-kcphqn2k.js} +1 -1
- package/dist/{chunk-50wjk5ap.js → chunk-kmy34he2.js} +2 -2
- package/dist/{chunk-bx5y6qsg.js → chunk-m9cye9t8.js} +43 -43
- package/dist/chunk-mgcakk1m.js +2 -0
- package/dist/chunk-mkm9drk3.js +2 -0
- package/dist/{chunk-vw7crz0z.js → chunk-mpfm5ctr.js} +4 -4
- package/dist/chunk-n3bt1sv5.js +2 -0
- package/dist/chunk-n62nqhey.js +2 -0
- package/dist/{chunk-k3566kgd.js → chunk-nan0ysys.js} +2 -2
- package/dist/{chunk-w96jck0a.js → chunk-nmywrw6v.js} +1 -1
- package/dist/chunk-nrap20qt.js +2 -0
- package/dist/{chunk-4z926gay.js → chunk-nzqr3w35.js} +7 -7
- package/dist/{chunk-g5nts6e0.js → chunk-p3et6xjr.js} +5 -5
- package/dist/{chunk-9hwg13ec.js → chunk-pc89t52s.js} +5 -5
- package/dist/{chunk-7b3dqeyr.js → chunk-phzhmnnm.js} +2 -2
- package/dist/chunk-pp89n1et.js +2 -0
- package/dist/chunk-ptrz5xwt.js +2 -0
- package/dist/chunk-q2jag6wt.js +2 -0
- package/dist/chunk-q9yahsww.js +2 -0
- package/dist/chunk-qgc59a7d.js +2 -0
- package/dist/chunk-qjkpwjg6.js +2 -0
- package/dist/chunk-qq31bcsq.js +2 -0
- package/dist/{chunk-8vbx58s6.js → chunk-qvj0bzw5.js} +10 -10
- package/dist/chunk-r5xt6vdq.js +2 -0
- package/dist/{chunk-5mrt1enm.js → chunk-razwegar.js} +2 -2
- package/dist/chunk-rt6fn071.js +2 -0
- package/dist/{chunk-67pq803s.js → chunk-sdf4c754.js} +2 -2
- package/dist/chunk-se0pjx71.js +2 -0
- package/dist/chunk-senrtnx2.js +2 -0
- package/dist/chunk-sjrx0dj8.js +2 -0
- package/dist/chunk-ta5fpj2a.js +2 -0
- package/dist/{chunk-bgkj0rxe.js → chunk-ta7cwykn.js} +4 -4
- package/dist/{chunk-jj1f1v1r.js → chunk-tszhkmny.js} +7 -7
- package/dist/{chunk-vbmvft7g.js → chunk-v0yay1kw.js} +1 -1
- package/dist/{chunk-2sz1kh9m.js → chunk-va4xam1q.js} +1 -1
- package/dist/chunk-vbh5tknp.js +2 -0
- package/dist/{chunk-q33x40dg.js → chunk-vmphrcaa.js} +2 -2
- package/dist/{chunk-s8v6dxhg.js → chunk-w1pga3s6.js} +4 -4
- package/dist/{chunk-bzd387yx.js → chunk-w3y8408q.js} +4 -4
- package/dist/chunk-w4177qn3.js +3 -0
- package/dist/{chunk-esm0pnpz.js → chunk-w98yt4d4.js} +2 -2
- package/dist/{chunk-7nn5s0c3.js → chunk-wbsbrm6n.js} +30 -30
- package/dist/chunk-wchz1sye.js +2 -0
- package/dist/{chunk-9ze3xvsr.js → chunk-wk6g0b9h.js} +4 -4
- package/dist/{chunk-m0p328a3.js → chunk-wna2herj.js} +3 -3
- package/dist/{chunk-71d353be.js → chunk-wxk0t61p.js} +3 -3
- package/dist/chunk-x1svtz8k.js +2 -0
- package/dist/{chunk-qt2mr3f0.js → chunk-x39v2ch2.js} +5 -5
- package/dist/chunk-xahn0h9f.js +2 -0
- package/dist/{chunk-65c11t6g.js → chunk-xfjp5q2m.js} +15 -15
- package/dist/{chunk-27qkwvbe.js → chunk-xpcqyzdc.js} +2 -2
- package/dist/chunk-ykx4zt07.js +2 -0
- package/dist/{chunk-w10vj4rc.js → chunk-yqs88qj4.js} +6 -6
- package/dist/chunk-yt8k715e.js +2 -0
- package/dist/{chunk-g32hc78c.js → chunk-yzgtsrjb.js} +2 -2
- package/dist/{chunk-btyb4bfz.js → chunk-z0d1asbw.js} +2 -2
- package/dist/{chunk-tx27trcp.js → chunk-zcwx8z8z.js} +5 -5
- package/dist/{chunk-t14bn66j.js → chunk-zk1c6tg7.js} +3 -3
- package/dist/{chunk-9rxxm68c.js → chunk-zrsrhdxw.js} +3 -3
- package/dist/cli.js +21 -21
- package/dist/client-parameter-bindings.js +12 -5
- package/dist/component-renderer.js +2 -24
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/native/runtime/craft-bridge.js +5 -1
- package/dist/native/runtime/craft.d.ts +4 -0
- package/dist/offline/app-service-worker.d.ts +1 -0
- package/dist/offline/app-service-worker.js +99 -17
- package/dist/production-server.d.ts +0 -9
- package/dist/production-server.js +26 -11
- package/dist/pwa.js +3 -3
- package/dist/route-response-cache.js +4 -3
- package/dist/server-bindings.js +3 -1
- package/dist/spa-nav.d.ts +6 -0
- package/dist/spa-nav.js +5 -1
- package/dist/ssg.js +10 -10
- package/dist/stx-virtual-ts.d.ts +4 -0
- package/dist/stx-virtual-ts.js +22 -0
- package/dist/utils.js +22 -2
- package/package.json +5 -5
- package/dist/chunk-0ht6exrv.js +0 -2
- package/dist/chunk-1pbghytr.js +0 -2
- package/dist/chunk-31r1tk86.js +0 -2
- package/dist/chunk-3ahvypx3.js +0 -2
- package/dist/chunk-576wtm6d.js +0 -2
- package/dist/chunk-5astk182.js +0 -2
- package/dist/chunk-5g5khx0m.js +0 -3
- package/dist/chunk-5tvse0vw.js +0 -2
- package/dist/chunk-5zcjcyys.js +0 -2
- package/dist/chunk-6h6aahc8.js +0 -2
- package/dist/chunk-726w7fm2.js +0 -2
- package/dist/chunk-7r294vc9.js +0 -2
- package/dist/chunk-7rn7w53f.js +0 -2
- package/dist/chunk-81qvg3yd.js +0 -2
- package/dist/chunk-96jntfwp.js +0 -3
- package/dist/chunk-9pjzj75t.js +0 -2
- package/dist/chunk-a1k0aj2r.js +0 -2
- package/dist/chunk-am2v9pqa.js +0 -2
- package/dist/chunk-cb9h2wwq.js +0 -2
- package/dist/chunk-cp82351f.js +0 -2
- package/dist/chunk-cvxg2rc1.js +0 -2
- package/dist/chunk-dmc91qke.js +0 -2
- package/dist/chunk-dpgc8wmw.js +0 -2
- package/dist/chunk-dw23nre3.js +0 -2
- package/dist/chunk-dyz7cmf4.js +0 -2
- package/dist/chunk-fznzn35q.js +0 -2
- package/dist/chunk-gyzebnpx.js +0 -2
- package/dist/chunk-hc8ks7y3.js +0 -2
- package/dist/chunk-hs2a040z.js +0 -2
- package/dist/chunk-jr3fmkq7.js +0 -2
- package/dist/chunk-k2fw6paw.js +0 -2
- package/dist/chunk-k79dvx67.js +0 -2
- package/dist/chunk-kf6j1ht4.js +0 -2
- package/dist/chunk-km1k3c4e.js +0 -2
- package/dist/chunk-kvjbpbmw.js +0 -2
- package/dist/chunk-m2dgf6pt.js +0 -2
- package/dist/chunk-mhv84p0x.js +0 -2
- package/dist/chunk-mmk5xqhr.js +0 -2
- package/dist/chunk-pd8ck9p3.js +0 -2
- package/dist/chunk-pjpy86c3.js +0 -3
- package/dist/chunk-q3ztpbz4.js +0 -2
- package/dist/chunk-qchmvwds.js +0 -2
- package/dist/chunk-qx4wkt90.js +0 -2
- package/dist/chunk-qzx6h6af.js +0 -2
- package/dist/chunk-r9rwdg9k.js +0 -3
- package/dist/chunk-s0sxq6ap.js +0 -2
- package/dist/chunk-scdkctdb.js +0 -2
- package/dist/chunk-sxqq3tft.js +0 -2
- package/dist/chunk-tf0feafg.js +0 -2
- package/dist/chunk-tgwwa872.js +0 -2
- package/dist/chunk-tspqdt8e.js +0 -2
- package/dist/chunk-tzebte8p.js +0 -2
- package/dist/chunk-v0r6zb87.js +0 -2
- package/dist/chunk-vbq6vt0e.js +0 -2
- package/dist/chunk-vh9yx344.js +0 -2
- package/dist/chunk-vxtna1b1.js +0 -2
- package/dist/chunk-wh07jf0t.js +0 -2
- package/dist/chunk-x43x2c6v.js +0 -2
- package/dist/chunk-xqx8t9w5.js +0 -2
- package/dist/chunk-xzmsfrez.js +0 -2
- package/dist/chunk-ymeemdg9.js +0 -42
- package/dist/chunk-z33r3pzy.js +0 -2
- package/dist/chunk-z43xcwnk.js +0 -2
- package/dist/chunk-zb6fa26w.js +0 -2
- package/dist/chunk-zkr42285.js +0 -2
- package/dist/chunk-zrs22j09.js +0 -2
- package/dist/chunk-zve1xqvs.js +0 -2
- package/dist/chunk-zw6tgr0s.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{en,we,R}from"./chunk-0jdz31q1.js";import{Z}from"./chunk-
|
|
2
|
+
import{en,we,R}from"./chunk-0jdz31q1.js";import{Z}from"./chunk-13awnyq0.js";import{Mi,ol,o,A,Ke,Ne,Tn,Xe,ke,se,Dr,O,Rn,ao,ml,hl,Pn,zr,lo,uo,yl,Hi,bl,wl,vl,xl,Ge,Je,po,Qe,s,On,b,g,Y,ae,Me,P,Gi}from"./chunk-fds6vvq0.js";import{d,m,M,n,ce,te,u,De,Qi,K,jn,ea,Zt,ta,Nl,qr,Ml,wt,Dl,Kr,Ll,Bn,na,jl,Xr,Jr,Le,ra}from"./chunk-c08jvjqt.js";import{Jt}from"./chunk-w98yt4d4.js";import{Dn}from"./chunk-ab1z38gj.js";import{S}from"./chunk-e4tbq8a0.js";import{Pr,Cn}from"./chunk-b234w3mf.js";import{Hc,Uc,$r,pt,Vc,j}from"./chunk-xfjp5q2m.js";import{ki,_i,Ci,Ei}from"./chunk-eca022er.js";import{kn,Lc,Ps}from"./chunk-exc8y30f.js";import{Ts,$s,Rs}from"./chunk-qvj0bzw5.js";import{Ns,mi,hi,Ms,Ds,yi}from"./chunk-fwffn130.js";import{Is,ui}from"./chunk-w1pga3s6.js";import{ii}from"./chunk-fs43342z.js";import{ge,di,pi,fi}from"./chunk-9bexzgws.js";import{_r,Ae,Bc,Cr,Fc}from"./chunk-nzqr3w35.js";import{W,ut}from"./chunk-1jxkc6d0.js";import{qc,Kc}from"./chunk-6qgrr453.js";import{I,Fn,sa}from"./chunk-e5rag6rh.js";import{Un}from"./chunk-ahf9j8wb.js";import{L,c,f}from"./chunk-8tfpv6zf.js";function Ve(r){return/\bimport\s*\.\s*meta\b/.test(Un(r))}function Br(r){let e=Ne(r),l=[],a=0;for(let h=0;h<e.length;h++){let t=e[h],p=t.name.toLowerCase();if(p==="template")a+=t.closing?-1:1;if(p!=="script"||t.closing)continue;let w=e[h+1];if(w?.name.toLowerCase()!=="script"||!w.closing)continue;l.push({start:t.start,end:w.end,attrs:t.attributes,body:r.slice(t.end,w.start),inert:a>0})}return l}function nt(r){return[...r].map(([e,l])=>l===!0?e:`${e}="${l.replace(/"/g,""")}"`).join(" ")}function vt(r){let e=Br(r);if(e.some((y)=>O(y.attrs).has("data-stx-module-bootstrap")))return r;let l=(y)=>{if(Ve(y))return!0;try{return Z(y)}catch{return!1}};if(!e.some((y)=>l(y.body)||O(y.attrs).get("type")==="module"))return r;let a=new Bun.CryptoHasher("md5").update(r).digest("hex").slice(0,16),h="",t=0,p=!1,w=0;for(let y of e){let v=O(y.attrs),x=v.get("type");if(y.inert||v.has("data-stx-module-job")||v.has("data-stx-runtime")||v.has("data-stx-router"))continue;if(typeof x==="string"&&!["module","text/javascript","application/javascript"].includes(x.toLowerCase()))continue;if(![...v.keys()].some((T)=>/^data-stx-(?:scoped|modules|stores|(?:framework-)?composables)$/.test(T)))continue;let _=x==="module"||l(y.body);if(_)p=!0;if(!p)continue;if(!_&&(v.has("data-stx-owner")||v.has("data-stx-instance")))continue;h+=r.slice(t,y.start);let E=y.body,D=v.get("src");if(typeof D==="string")v.delete("src"),v.set("data-stx-source-url",D),E=`${_?"await":"return"} new Promise(function(resolve,reject){
|
|
3
3
|
var source=globalThis.__stxExecutingScript,script=document.createElement('script');
|
|
4
4
|
for(var attr of source.attributes)if(!['type','src','data-stx-module-job'].includes(attr.name))script.setAttribute(attr.name,attr.value);
|
|
5
5
|
${_?"script.type='module';":""}
|
|
@@ -54,7 +54,7 @@ finally { window.removeEventListener('error',__stxCapture); globalThis.__stxExec
|
|
|
54
54
|
if(__stxFailure)throw __stxFailure;`}
|
|
55
55
|
});
|
|
56
56
|
})(document.currentScript);
|
|
57
|
-
</script>`;t=y.end}return h+r.slice(t)}import
|
|
57
|
+
</script>`;t=y.end}return h+r.slice(t)}import ls from"fs";import le from"path";function xt(r){let e=Ne(r),l=e.find((v)=>v.closing&&v.name.toLowerCase()==="head");if(!l)return r;let a=new Set(["template","svg","noscript","math","textarea","title","xmp","iframe","noembed","noframes","plaintext"]),h=0,t=[];for(let v=0;v<e.length;v++){let x=e[v];if(x.start<l.end)continue;let k=x.name.toLowerCase();if(a.has(k)){h=Math.max(0,h+(x.closing?-1:x.selfClosing?0:1));continue}if(k!=="style"||x.closing||h>0)continue;let _=e[v+1];if(_?.name.toLowerCase()==="style"&&_.closing){if(/@scope\s*\{/.test(r.slice(x.end,_.start)))continue;t.push({start:x.start,end:_.end}),v++}}if(!t.length)return r;let p=t.map((v)=>r.slice(v.start,v.end)).join(`
|
|
58
58
|
`),w=[r.slice(0,l.start),p,`
|
|
59
59
|
`],y=l.start;for(let v of t)w.push(r.slice(y,v.start)),y=v.end;return w.push(r.slice(y)),w.join("")}function St(){return`
|
|
60
60
|
// STX Lifecycle Runtime
|
|
@@ -404,7 +404,7 @@ else {
|
|
|
404
404
|
|
|
405
405
|
console.log('[stx] Lifecycle runtime initialized');
|
|
406
406
|
})();
|
|
407
|
-
`}function st(r){return Symbol(r)}var
|
|
407
|
+
`}function st(r){return Symbol(r)}var Fs=st("theme"),Us=st("router"),qs=st("i18n");import*as _t from"crypto";function kt(r){let e=/\$(\w+)\./g,l=[],a;while((a=e.exec(r))!==null)if(!l.includes(a[1]))l.push(a[1]);return l}function Fr(){return`stx-${_t.randomBytes(4).toString("hex")}`}function Ur(r){return/\$\w+\./.test(r)}function Wr(r){if(!/\{\{[^}]*\$\w/.test(r)||!/\$\w+\./.test(r))return{html:r,bindings:[],stores:new Set};let e=[],l=new Set,a=/<(\w+)([^>]*?)(\s*\/?>)/g,h=r;return h=h.replace(a,(t,p,w,y)=>{if(["script","style","template"].includes(p.toLowerCase()))return t;if(!w.includes("{{"))return t;let v=[],x=!1,k=w,_=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,E=[...w.matchAll(_)];for(let C of E){let N=C[0],F=C[1],q=C[2];if(Ur(q)){x=!0;let V=q.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(V){let H=V[1];if(v.push({attr:F,expr:H,fullMatch:N,originalAttr:F}),kt(H).forEach((U)=>l.add(U)),F==="text")k=k.replace(N,"");else if(F==="class")k=k.replace(N,'class=""');else if(F==="disabled"||F==="hidden")k=k.replace(N,"");else k=k.replace(N,`${F}=""`)}}}if(!x)return t;let D=k.match(/\bid\s*=\s*"([^"]+)"/),T;if(D)T=D[1];else T=Fr(),k=` id="${T}"${k}`;for(let C of v)e.push({elementId:T,attribute:C.attr,expression:C.expr,stores:kt(C.expr)});return`<${p}${k}${y}`}),{html:h,bindings:e,stores:l}}function Vr(r,e){if(r.length===0)return"";let l=Array.from(e),a=`
|
|
408
408
|
<script>
|
|
409
409
|
(function() {
|
|
410
410
|
'use strict';
|
|
@@ -562,7 +562,7 @@ else {
|
|
|
562
562
|
}
|
|
563
563
|
})();
|
|
564
564
|
</script>
|
|
565
|
-
`,a}function $t(r){let{html:e,bindings:l,stores:a}=
|
|
565
|
+
`,a}function $t(r){let{html:e,bindings:l,stores:a}=Wr(r);if(l.length===0)return r;let h=Vr(l,a),t=c(e);if(t!==-1)return e.slice(0,t)+h+e.slice(t);return e+h}function Gr(r){let e=r.analytics;if(!e?.enabled)return"";switch(e.driver){case"fathom":return Zr(e);case"google-analytics":return Qr(e);case"plausible":return Yr(e);case"self-hosted":return tn(e);case"custom":return rn(e);default:return""}}function Zr(r){let e=r.fathom;if(!e?.siteId)return"";let l=e.scriptUrl||"https://cdn.usefathom.com/script.js",a=e.defer!==!1?" defer":"",h=[`data-site="${fe(e.siteId)}"`];if(e.honorDnt)h.push('data-honor-dnt="true"');if(e.spa)h.push('data-spa="auto"');if(e.canonical)h.push(`data-canonical="${fe(e.canonical)}"`);if(e.auto===!1)h.push('data-auto="false"');return`
|
|
566
566
|
<!-- Fathom Analytics -->
|
|
567
567
|
<script src="${fe(l)}" ${h.join(" ")}${a}></script>
|
|
568
568
|
`}function Qr(r){let e=r.googleAnalytics;if(!e?.measurementId)return"";let l=fe(e.measurementId),a=e.debug?`gtag('config', '${l}', { 'debug_mode': true });`:"";return`
|
|
@@ -619,24 +619,24 @@ ${e.inlineScript}
|
|
|
619
619
|
`;if(!e.scriptUrl)return"";let l=[];if(e.scriptId)l.push(`id="${fe(e.scriptId)}"`);if(e.attributes)for(let[h,t]of Object.entries(e.attributes))l.push(`${fe(h)}="${fe(t)}"`);return`
|
|
620
620
|
<!-- Custom Analytics -->
|
|
621
621
|
<script${l.length>0?` ${l.join(" ")}`:""} src="${fe(e.scriptUrl)}" defer></script>
|
|
622
|
-
`}function Et(r,e){let l=Gr(e);if(!l)return r;if(!r.includes("</head>")){let a=c(r);if(a!==-1)return r.slice(0,a)+l+r.slice(a);return r+l}return f(r,l,"")}function fe(r){return r.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function Pt(r){let e=r.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!e)return null;try{return Function(`return ${e[1]}`)()}catch{return null}}function Tt(r){let e=r?.layout;if(e===!1)return!1;return typeof e==="string"&&e.trim()?e.trim():void 0}import nn from"fs";import it from"path";import{createHighlighter as sn}from"ts-syntax-highlighter";var ot=new Map;async function
|
|
623
|
-
${h}`)}function It(r,e){let l=r;return l=l.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(a,h)=>{if(h.includes("nonce="))return a;return`<script nonce="${e}"${h}>`}),l=l.replace(/<style([^>]*)>/gi,(a,h)=>{if(h.includes("nonce="))return a;return`<style nonce="${e}"${h}>`}),l}function Ot(r,e,l,a){let h=r,t=a.csp;if(h=h.replace(/@csp\b/g,()=>{if(!t?.enabled||!t.directives)return"<!-- CSP not configured -->";let p=t.useNonce?Ze(e,t):void 0;return Rt(t.directives,p)}),h=h.replace(/@cspNonce\b/g,()=>{if(!t?.enabled||!t.useNonce)return"";return Ze(e,t)}),t?.enabled&&t.useNonce)e.cspNonce=Ze(e,t);return h}import ln from"crypto";var un=40,Lt="_token",at=null;function dn(r=un){let e=ln.randomBytes(Math.ceil(r/2)).toString("hex").slice(0,r);return at=e,e}function pn(){if(!at)dn();return at}function fn(r=Lt){let e=pn();return`<input type="hidden" name="${r}" value="${e}">`}function jt(r){return r.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(e,l,a)=>fn(a||Lt))}async function Nt(r,e,l,a){if(!a.customDirectives||a.customDirectives.length===0)return r;let h=r;for(let t of a.customDirectives){if(!t.name||typeof t.handler!=="function"){if(a.debug)console.warn("Invalid custom directive:",t);continue}if(t.hasEndTag)h=await gn(h,t,e,l,a);else h=await mn(h,t,e,l,a)}return h}async function gn(r,e,l,a,h){let{name:t,handler:p}=e,w=`@${t}`,y=`@end${t}`,v=r,x=en(`${w}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${y}`,"g"),k=[],_=x.exec(v);while(_!==null){let[E,D="",T=""]=_,C=_.index||0;try{let N=D?Ht(e,D):[],q=T.trim(),U=await p(q,N,l,a);k.push({original:E,processed:U,startIndex:C})}catch(N){let q=N instanceof Error?N.message:String(N);if(h.debug)console.error(`Error processing custom directive @${t}:`,N);k.push({original:E,processed:u("CustomDirective",`Error in @${t}${D?`(${D})`:""}: ${q}`,n.EVALUATION_ERROR),startIndex:C})}_=x.exec(v)}for(let E=k.length-1;E>=0;E--){let{original:D,processed:T}=k[E];v=v.replace(D,T)}return v}async function mn(r,e,l,a,h){let{name:t,handler:p}=e,w=r,y=[],v=[];if(e.rawParams){for(let _ of Yi(w,en(`(?<![\\w$@])@${t}\\s*\\(`,"g")))if(_.end!==-1)v.push({fullMatch:_.call,paramString:_.args,startIndex:_.start})}else{let _=en(`@${t}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");_.lastIndex=0;let E=_.exec(w);while(E!==null)v.push({fullMatch:E[0],paramString:E[1]??"",startIndex:E.index||0}),E=_.exec(w)}for(let{fullMatch:_,paramString:E,startIndex:D}of v)try{let T=Ht(e,E),C=await p("",T,l,a);y.push({original:_,processed:C,startIndex:D})}catch(T){let C=T instanceof Error?T.message:String(T);if(h.debug)console.error(`Error processing custom directive @${t}:`,T);y.push({original:_,processed:u("CustomDirective",`Error in @${t}(${E}): ${C}`,n.EVALUATION_ERROR),startIndex:D})}let x=en(`@${t}(?!\\w)(?!\\s*\\()`,"g"),k=x.exec(w);while(k!==null){let[_]=k,E=k.index||0;try{let D=await p("",[],l,a);y.push({original:_,processed:D,startIndex:E})}catch(D){let T=D instanceof Error?D.message:String(D);if(h.debug)console.error(`Error processing custom directive @${t}:`,D);y.push({original:_,processed:u("CustomDirective",`Error in @${t}: ${T}`,n.EVALUATION_ERROR),startIndex:E})}k=x.exec(w)}for(let _=y.length-1;_>=0;_--){let{original:E,processed:D}=y[_];w=w.replace(E,D)}return w}function Ht(r,e){return r.rawParams?Zt(e):hn(e)}function hn(r){if(!r.trim())return[];let e=[],l="",a=!1,h="";for(let t=0;t<r.length;t++){let p=r[t];if((p==='"'||p==="'")&&(t===0||r[t-1]!=="\\"))if(!a)a=!0,h=p;else if(p===h)a=!1;else l+=p;else if(p===","&&!a)e.push(l.trim()),l="";else l+=p}if(l.trim())e.push(l.trim());return e.map((t)=>{let p=t.trim();if(p.startsWith('"')&&p.endsWith('"')||p.startsWith("'")&&p.endsWith("'"))return p.substring(1,p.length-1);return p})}var Bt=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,qt=/^[A-Za-z_$][\w$]*$/,yn=new Set(["light","dark","system"]);function Ee(r,e){if(typeof r!=="string"||r.length===0)throw Error(`@appearanceBootstrap ${e} must be a non-empty string`)}function bn(r){if(!r||typeof r!=="object"||Array.isArray(r))throw Error("@appearanceBootstrap expects an options object");let e=r,{appearance:l,colorMode:a}=e;if(Ee(e.storageKey,"storageKey"),l!==void 0&&(!l||typeof l!=="object"||Array.isArray(l)))throw Error("@appearanceBootstrap appearance must be an object when given");if(!a||typeof a!=="object"||Array.isArray(a))throw Error("@appearanceBootstrap colorMode must be an object");if(Ee(a.key,"colorMode.key"),Ee(a.attribute,"colorMode.attribute"),Ee(a.default,"colorMode.default"),!qt.test(a.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Bt.test(a.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!yn.has(a.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");let h=null;if(l){if(Ee(l.key,"appearance.key"),Ee(l.attribute,"appearance.attribute"),Ee(l.default,"appearance.default"),!qt.test(l.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Bt.test(l.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(l.allowed)||l.allowed.length===0||l.allowed.some((t)=>typeof t!=="string"||t.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!l.allowed.includes(l.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");h={key:l.key,attribute:l.attribute,allowed:[...new Set(l.allowed)],default:l.default}}return{storageKey:e.storageKey,appearance:h,colorMode:{key:a.key,attribute:a.attribute,default:a.default},respectExisting:e.respectExisting===!0}}function wn(r){return JSON.stringify(r).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function vn(r){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${wn(r)};const root=document.documentElement;const MODES=["light","dark","system"];let format="json";const forced=(function(){const found={colorMode:null,appearance:null};if(!config.respectExisting)return found;try{const mode=root.getAttribute("data-"+config.colorMode.attribute);if(mode==="light"||mode==="dark")found.colorMode=mode;if(config.appearance){const name=root.getAttribute("data-"+config.appearance.attribute);if(config.appearance.allowed.includes(name))found.appearance=name}}catch{}return found}());function read(){let stored={};try{const raw=localStorage.getItem(config.storageKey);if(raw){let parsed=null;try{parsed=JSON.parse(raw)}catch{parsed=raw}if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed)){stored=parsed;format="json"}else if(typeof parsed==="string"&&MODES.includes(parsed)){stored={};stored[config.colorMode.key]=parsed;format="string"}}}catch{}return stored}function write(stored){try{if(format==="string"&&!config.appearance)localStorage.setItem(config.storageKey,stored[config.colorMode.key]);else localStorage.setItem(config.storageKey,JSON.stringify(stored))}catch{}}function resolve(){const stored=read();const state={colorMode:forced.colorMode||(MODES.includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default)};if(config.appearance)state.appearance=forced.appearance||(config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default);return state}function prefersDark(){try{return matchMedia("(prefers-color-scheme: dark)").matches}catch{return false}}function apply(){const state=resolve();const dark=state.colorMode==="dark"||(state.colorMode==="system"&&prefersDark());if(config.appearance)root.setAttribute("data-"+config.appearance.attribute,state.appearance);root.setAttribute("data-"+config.colorMode.attribute,state.colorMode);root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light";state.dark=dark;try{window.dispatchEvent(new CustomEvent("stx:appearance",{detail:state}))}catch{}return state}function store(key,allowed,value){if(allowed.includes(value)){const stored=read();stored[key]=value;write(stored)}return apply()}window.__stxAppearance={config:config,forced:forced,read:read,resolve:resolve,apply:apply,setColorMode:function(mode){return store(config.colorMode.key,MODES,mode)},setAppearance:function(name){return config.appearance?store(config.appearance.key,config.appearance.allowed,name):apply()},watchSystem:function(){try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(){if(resolve().colorMode==="system")apply()})}catch{}}};apply()}());</script>`}function xn(r,e){let l=1,a=null,h=!1;for(let t=e+1;t<r.length;t++){let p=r[t];if(h){h=!1;continue}if(a){if(p==="\\")h=!0;else if(p===a)a=null;continue}if(p==='"'||p==="'"||p==="`"){a=p;continue}if(p==="(")l++;else if(p===")"&&--l===0)return t}return-1}function Ft(r,e){let l=r,a=/@appearanceBootstrap\s*\(/g,h;while((h=a.exec(l))!==null){let t=h.index+h[0].length-1,p=xn(l,t);if(p===-1)throw Error("@appearanceBootstrap has an unclosed options object");let w=l.slice(t+1,p).trim(),y=d(`(${w})`,e),v=vn(bn(y));l=l.slice(0,h.index)+v+l.slice(p+1),a.lastIndex=h.index+v.length}return l}import Sn from"crypto";function re(r){return Y(String(r??""))}var Vt={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function Qe(r,e,l,a){let h=r||e;return l?`${h} ${a}`:h}function ye(r){return String(r).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function Le(r,e){if(/\bid\s*=/i.test(r))return"";return` id="${re(e)}"`}function ct(r,e,l){if(!e)return"";let a="";if(!/\baria-invalid\s*=/i.test(l))a+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(l))a+=` aria-describedby="${re(`${ye(r)}-error`)}"`;return a}function _n(){return Sn.randomUUID()}function et(r,e){let l=r;return l=l.replace(/@csrf/g,()=>{if(!e.csrf||typeof e.csrf!=="object"){let a=_n();e.csrf={token:a}}if(e.csrf.field)return e.csrf.field;if(e.csrf.token)return`<input type="hidden" name="_token" value="${re(e.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),l=l.replace(/@method\(['"]([^'"]+)['"]\)/g,(a,h)=>{let t=h.toUpperCase();if(h&&!["GET","POST"].includes(t))return`<input type="hidden" name="_method" value="${re(t)}">`;return a}),l}function Wt(r,e,l=Vt){let a=r;return a=a.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(h,t,p,w,y,v="")=>{let x=t||p||"POST",k=w||y||"",_=Se(v),E=x.toUpperCase(),D=["GET","POST"].includes(E)?E:"POST",T=`<form method="${re(D)}" action="${re(k)}"${_?` ${_}`:""}>`;if(T+=`
|
|
622
|
+
`}function Et(r,e){let l=Gr(e);if(!l)return r;if(!r.includes("</head>")){let a=c(r);if(a!==-1)return r.slice(0,a)+l+r.slice(a);return r+l}return f(r,l,"")}function fe(r){return r.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function Pt(r){let e=r.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!e)return null;try{return Function(`return ${e[1]}`)()}catch{return null}}function Tt(r){let e=r?.layout;if(e===!1)return!1;return typeof e==="string"&&e.trim()?e.trim():void 0}import nn from"fs";import it from"path";import{createHighlighter as sn}from"ts-syntax-highlighter";var ot=new Map;async function Ue(r,e={}){try{if(!await s(r))throw Error(`Markdown file not found: ${r}`);let a=(await nn.promises.stat(r)).mtime.getTime();if(e.cache&&ot.has(r)){let k=ot.get(r);if(k.updatedAt>=a)return{content:k.content,data:k.data}}let h=await Bun.file(r).text(),{data:t,content:p}=$r(h),w=e.markdown||j.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},v=pt(p,{gfm:!0});if(w.syntaxHighlighting?.enabled&&w.syntaxHighlighting?.serverSide)v=await on(v,w.syntaxHighlighting?.defaultTheme||"github-dark",w.syntaxHighlighting?.highlightUnknownLanguages||!1);let x={content:v,data:t||{}};if(e.cache)ot.set(r,{...x,updatedAt:a});return x}catch(l){if(e.debug)console.error(`Error reading/parsing markdown file ${r}:`,l);let a=l instanceof Error?l.message:String(l);return{content:b("Markdown File",`Error reading/parsing markdown file: ${a}`,r,"",0,""),data:{}}}}var ze=null;async function on(r,e,l){let a=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!ze)try{ze=await sn({theme:e||"github-dark",cache:!0})}catch(w){return console.error("Failed to initialize ts-syntax-highlighter:",w),r}let h=async(w,y,v,x)=>{let k=x.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),_=v||(l?"text":"");if(!_)return w;try{if(!ze.getSupportedLanguages().includes(_))return w;return(await ze.highlight(k,_,{theme:e})).html}catch(E){console.error(`Error highlighting code block with language ${v}:`,E)}return w},t=r,p=r.matchAll(a);for(let w of p){let[y,v,x,k]=w,_=await h(y,v,x,k);t=t.replace(y,_)}return t}async function Ct(r,e,l="",a={}){return await an(r,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(p,w,y,v)=>{try{let x=w;if(!it.isAbsolute(w))x=it.resolve(it.dirname(l),w);let k={};if(y)try{try{k=JSON.parse(y)}catch{if(a.debug)console.warn("Using safer alternative for parsing JS object literal");let F=y.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let q of F){let V=q.indexOf(":");if(V>0){let H=q.substring(0,V).trim(),B=q.substring(V+1).trim(),U=B.startsWith('"')&&B.endsWith('"'),J=B.startsWith("'")&&B.endsWith("'");if(U||J)B=B.substring(1,B.length-1);k[H]=B}}}}catch(N){if(a.debug)console.error("Error parsing context in @markdown-file directive:",N)}let{content:_,data:E}=await Ue(x,a),D={...e,...E,...k},T=_,C=/\{\{([^}]+)\}\}/g;return T=T.replace(C,(N,F)=>{let q=F.trim();return D[q]!==void 0?String(D[q]):N}),T}catch(x){let k=x instanceof Error?x.message:String(x);return b("Markdown File",`Error including markdown file: ${k}`,l,r,v,p)}})}async function an(r,e,l){let a=[],h;while((h=e.exec(r))!==null){let w=h[0],y=h.index,v=h;a.push(l(...v).then((x)=>({match:w,replacement:x,index:y})))}let t=await Promise.all(a);t.sort((w,y)=>y.index-w.index);let p=r;for(let{match:w,replacement:y}of t)p=p.replace(w,()=>y);return p}var At=new WeakMap;function Mt(r=16){let e=new Uint8Array(r);return crypto.getRandomValues(e),btoa(String.fromCharCode(...e))}function Ze(r,e){if(!r)return e?.nonceGenerator?.()??Mt();let l=At.get(r);if(!l)l=e?.nonceGenerator?.()??Mt(),At.set(r,l);return l}function cn(r,e){let l=[];for(let[a,h]of Object.entries(r)){if(h===void 0||h===null)continue;if(typeof h==="boolean"){if(h)l.push(a);continue}if(Array.isArray(h)){let t=[...h];if(e&&(a==="script-src"||a==="style-src"))t=t.filter((p)=>!p.startsWith("'nonce-")),t.push(`'nonce-${e}'`);if(t.length>0)l.push(`${a} ${t.join(" ")}`)}}return l.join("; ")}function Rt(r,e){return`<meta http-equiv="Content-Security-Policy" content="${cn(r,e).replace(/&/g,"&").replace(/"/g,""")}">`}function Dt(r,e,l){if(!e.enabled||!e.addMetaTag)return r;if(r.includes('http-equiv="Content-Security-Policy"'))return r;if(!r.includes("<head>")&&!r.includes("<head "))return r;let a=e.useNonce?Ze(l,e):void 0,h=Rt(e.directives,a);return r.replace(/<head([^>]*)>/,`<head$1>
|
|
623
|
+
${h}`)}function It(r,e){let l=r;return l=l.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(a,h)=>{if(h.includes("nonce="))return a;return`<script nonce="${e}"${h}>`}),l=l.replace(/<style([^>]*)>/gi,(a,h)=>{if(h.includes("nonce="))return a;return`<style nonce="${e}"${h}>`}),l}function Ot(r,e,l,a){let h=r,t=a.csp;if(h=h.replace(/@csp\b/g,()=>{if(!t?.enabled||!t.directives)return"<!-- CSP not configured -->";let p=t.useNonce?Ze(e,t):void 0;return Rt(t.directives,p)}),h=h.replace(/@cspNonce\b/g,()=>{if(!t?.enabled||!t.useNonce)return"";return Ze(e,t)}),t?.enabled&&t.useNonce)e.cspNonce=Ze(e,t);return h}import ln from"crypto";var un=40,Lt="_token",at=null;function dn(r=un){let e=ln.randomBytes(Math.ceil(r/2)).toString("hex").slice(0,r);return at=e,e}function pn(){if(!at)dn();return at}function fn(r=Lt){let e=pn();return`<input type="hidden" name="${r}" value="${e}">`}function jt(r){return r.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(e,l,a)=>fn(a||Lt))}async function Nt(r,e,l,a){if(!a.customDirectives||a.customDirectives.length===0)return r;let h=r;for(let t of a.customDirectives){if(!t.name||typeof t.handler!=="function"){if(a.debug)console.warn("Invalid custom directive:",t);continue}if(t.hasEndTag)h=await gn(h,t,e,l,a);else h=await mn(h,t,e,l,a)}return h}async function gn(r,e,l,a,h){let{name:t,handler:p}=e,w=`@${t}`,y=`@end${t}`,v=r,x=en(`${w}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${y}`,"g"),k=[],_=x.exec(v);while(_!==null){let[E,D="",T=""]=_,C=_.index||0;try{let N=D?Ht(e,D):[],F=T.trim(),q=await p(F,N,l,a);k.push({original:E,processed:q,startIndex:C})}catch(N){let F=N instanceof Error?N.message:String(N);if(h.debug)console.error(`Error processing custom directive @${t}:`,N);k.push({original:E,processed:u("CustomDirective",`Error in @${t}${D?`(${D})`:""}: ${F}`,n.EVALUATION_ERROR),startIndex:C})}_=x.exec(v)}for(let E=k.length-1;E>=0;E--){let{original:D,processed:T}=k[E];v=v.replace(D,T)}return v}async function mn(r,e,l,a,h){let{name:t,handler:p}=e,w=r,y=[],v=[];if(e.rawParams){for(let _ of ea(w,en(`(?<![\\w$@])@${t}\\s*\\(`,"g")))if(_.end!==-1)v.push({fullMatch:_.call,paramString:_.args,startIndex:_.start})}else{let _=en(`@${t}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");_.lastIndex=0;let E=_.exec(w);while(E!==null)v.push({fullMatch:E[0],paramString:E[1]??"",startIndex:E.index||0}),E=_.exec(w)}for(let{fullMatch:_,paramString:E,startIndex:D}of v)try{let T=Ht(e,E),C=await p("",T,l,a);y.push({original:_,processed:C,startIndex:D})}catch(T){let C=T instanceof Error?T.message:String(T);if(h.debug)console.error(`Error processing custom directive @${t}:`,T);y.push({original:_,processed:u("CustomDirective",`Error in @${t}(${E}): ${C}`,n.EVALUATION_ERROR),startIndex:D})}let x=en(`@${t}(?!\\w)(?!\\s*\\()`,"g"),k=x.exec(w);while(k!==null){let[_]=k,E=k.index||0;try{let D=await p("",[],l,a);y.push({original:_,processed:D,startIndex:E})}catch(D){let T=D instanceof Error?D.message:String(D);if(h.debug)console.error(`Error processing custom directive @${t}:`,D);y.push({original:_,processed:u("CustomDirective",`Error in @${t}: ${T}`,n.EVALUATION_ERROR),startIndex:E})}k=x.exec(w)}for(let _=y.length-1;_>=0;_--){let{original:E,processed:D}=y[_];w=w.replace(E,D)}return w}function Ht(r,e){return r.rawParams?Zt(e):hn(e)}function hn(r){if(!r.trim())return[];let e=[],l="",a=!1,h="";for(let t=0;t<r.length;t++){let p=r[t];if((p==='"'||p==="'")&&(t===0||r[t-1]!=="\\"))if(!a)a=!0,h=p;else if(p===h)a=!1;else l+=p;else if(p===","&&!a)e.push(l.trim()),l="";else l+=p}if(l.trim())e.push(l.trim());return e.map((t)=>{let p=t.trim();if(p.startsWith('"')&&p.endsWith('"')||p.startsWith("'")&&p.endsWith("'"))return p.substring(1,p.length-1);return p})}var Bt=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,Ft=/^[A-Za-z_$][\w$]*$/,yn=new Set(["light","dark","system"]);function Ee(r,e){if(typeof r!=="string"||r.length===0)throw Error(`@appearanceBootstrap ${e} must be a non-empty string`)}function bn(r){if(!r||typeof r!=="object"||Array.isArray(r))throw Error("@appearanceBootstrap expects an options object");let e=r,{appearance:l,colorMode:a}=e;if(Ee(e.storageKey,"storageKey"),l!==void 0&&(!l||typeof l!=="object"||Array.isArray(l)))throw Error("@appearanceBootstrap appearance must be an object when given");if(!a||typeof a!=="object"||Array.isArray(a))throw Error("@appearanceBootstrap colorMode must be an object");if(Ee(a.key,"colorMode.key"),Ee(a.attribute,"colorMode.attribute"),Ee(a.default,"colorMode.default"),!Ft.test(a.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Bt.test(a.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!yn.has(a.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");let h=null;if(l){if(Ee(l.key,"appearance.key"),Ee(l.attribute,"appearance.attribute"),Ee(l.default,"appearance.default"),!Ft.test(l.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Bt.test(l.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(l.allowed)||l.allowed.length===0||l.allowed.some((t)=>typeof t!=="string"||t.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!l.allowed.includes(l.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");h={key:l.key,attribute:l.attribute,allowed:[...new Set(l.allowed)],default:l.default}}return{storageKey:e.storageKey,appearance:h,colorMode:{key:a.key,attribute:a.attribute,default:a.default},respectExisting:e.respectExisting===!0}}function wn(r){return JSON.stringify(r).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function vn(r){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${wn(r)};const root=document.documentElement;const MODES=["light","dark","system"];let format="json";const forced=(function(){const found={colorMode:null,appearance:null};if(!config.respectExisting)return found;try{const mode=root.getAttribute("data-"+config.colorMode.attribute);if(mode==="light"||mode==="dark")found.colorMode=mode;if(config.appearance){const name=root.getAttribute("data-"+config.appearance.attribute);if(config.appearance.allowed.includes(name))found.appearance=name}}catch{}return found}());function read(){let stored={};try{const raw=localStorage.getItem(config.storageKey);if(raw){let parsed=null;try{parsed=JSON.parse(raw)}catch{parsed=raw}if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed)){stored=parsed;format="json"}else if(typeof parsed==="string"&&MODES.includes(parsed)){stored={};stored[config.colorMode.key]=parsed;format="string"}}}catch{}return stored}function write(stored){try{if(format==="string"&&!config.appearance)localStorage.setItem(config.storageKey,stored[config.colorMode.key]);else localStorage.setItem(config.storageKey,JSON.stringify(stored))}catch{}}function resolve(){const stored=read();const state={colorMode:forced.colorMode||(MODES.includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default)};if(config.appearance)state.appearance=forced.appearance||(config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default);return state}function prefersDark(){try{return matchMedia("(prefers-color-scheme: dark)").matches}catch{return false}}function apply(){const state=resolve();const dark=state.colorMode==="dark"||(state.colorMode==="system"&&prefersDark());if(config.appearance)root.setAttribute("data-"+config.appearance.attribute,state.appearance);root.setAttribute("data-"+config.colorMode.attribute,state.colorMode);root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light";state.dark=dark;try{window.dispatchEvent(new CustomEvent("stx:appearance",{detail:state}))}catch{}return state}function store(key,allowed,value){if(allowed.includes(value)){const stored=read();stored[key]=value;write(stored)}return apply()}window.__stxAppearance={config:config,forced:forced,read:read,resolve:resolve,apply:apply,setColorMode:function(mode){return store(config.colorMode.key,MODES,mode)},setAppearance:function(name){return config.appearance?store(config.appearance.key,config.appearance.allowed,name):apply()},watchSystem:function(){try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(){if(resolve().colorMode==="system")apply()})}catch{}}};apply()}());</script>`}function xn(r,e){let l=1,a=null,h=!1;for(let t=e+1;t<r.length;t++){let p=r[t];if(h){h=!1;continue}if(a){if(p==="\\")h=!0;else if(p===a)a=null;continue}if(p==='"'||p==="'"||p==="`"){a=p;continue}if(p==="(")l++;else if(p===")"&&--l===0)return t}return-1}function Ut(r,e){let l=r,a=/@appearanceBootstrap\s*\(/g,h;while((h=a.exec(l))!==null){let t=h.index+h[0].length-1,p=xn(l,t);if(p===-1)throw Error("@appearanceBootstrap has an unclosed options object");let w=l.slice(t+1,p).trim(),y=d(`(${w})`,e),v=vn(bn(y));l=l.slice(0,h.index)+v+l.slice(p+1),a.lastIndex=h.index+v.length}return l}import Sn from"crypto";function re(r){return Y(String(r??""))}var Wt={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function Ye(r,e,l,a){let h=r||e;return l?`${h} ${a}`:h}function ye(r){return String(r).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function Oe(r,e){if(/\bid\s*=/i.test(r))return"";return` id="${re(e)}"`}function ct(r,e,l){if(!e)return"";let a="";if(!/\baria-invalid\s*=/i.test(l))a+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(l))a+=` aria-describedby="${re(`${ye(r)}-error`)}"`;return a}function _n(){return Sn.randomUUID()}function et(r,e){let l=r;return l=l.replace(/@csrf/g,()=>{if(!e.csrf||typeof e.csrf!=="object"){let a=_n();e.csrf={token:a}}if(e.csrf.field)return e.csrf.field;if(e.csrf.token)return`<input type="hidden" name="_token" value="${re(e.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),l=l.replace(/@method\(['"]([^'"]+)['"]\)/g,(a,h)=>{let t=h.toUpperCase();if(h&&!["GET","POST"].includes(t))return`<input type="hidden" name="_method" value="${re(t)}">`;return a}),l}function Vt(r,e,l=Wt){let a=r;return a=a.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(h,t,p,w,y,v="")=>{let x=t||p||"POST",k=w||y||"",_=Se(v),E=x.toUpperCase(),D=["GET","POST"].includes(E)?E:"POST",T=`<form method="${re(D)}" action="${re(k)}"${_?` ${_}`:""}>`;if(T+=`
|
|
624
624
|
${et("@csrf",e)}`,!["GET","POST"].includes(E))T+=`
|
|
625
|
-
${et(`@method('${E}')`,e)}`;return T}),a=a.replace(/@endform/g,"</form>"),a=a.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(h,t,p,w,y,v="")=>{let x=t||p||"",k=w||y||"",_=Se(v),E=
|
|
625
|
+
${et(`@method('${E}')`,e)}`;return T}),a=a.replace(/@endform/g,"</form>"),a=a.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(h,t,p,w,y,v="")=>{let x=t||p||"",k=w||y||"",_=Se(v),E=Be(x,e),D=E!==void 0&&E!==null?E:k||"",T=_.match(/type=['"]([^'"]+)['"]/i),C=T?T[1]:"text",N=Fe(x,e),F=_.match(/class=['"]([^'"]+)['"]/i),q=Ye(F?F[1]:"",l.input,N,l.inputError),V=_.replace(/class=['"][^'"]+['"]/i,"");return V=V.replace(/type=['"][^'"]+['"]/i,""),`<input type="${re(C)}" name="${re(x)}"${Oe(_,ye(x))} value="${re(D)}" class="${q}"${ct(x,N,_)}${V?` ${V}`:""}>`}),a=a.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(h,t,p="",w="")=>{let y=Se(p),v=Be(t,e)||w.trim(),x=Fe(t,e),k=y.match(/class=['"]([^'"]+)['"]/i),_=Ye(k?k[1]:"",l.input,x,l.inputError),E=y.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${re(t)}"${Oe(y,ye(t))} class="${_}"${ct(t,x,y)}${E?` ${E}`:""}>${re(v)}</textarea>`}),a=a.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(h,t,p="",w)=>{let y=Se(p),v=Be(t,e),x=Fe(t,e),k=y.match(/class=['"]([^'"]+)['"]/i),_=Ye(k?k[1]:"",l.input,x,l.inputError),E=y.replace(/class=['"][^'"]+['"]/i,""),D=w;if(v!==void 0)D=w.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(T,C,N)=>{if((Array.isArray(v)?v.some((q)=>String(q)===N):String(v)===N)&&!C.includes("selected"))return C.replace(/(<option)/,"$1 selected");return T});return`<select name="${re(t)}"${Oe(y,ye(t))} class="${_}"${ct(t,x,y)}${E?` ${E}`:""}>${D}</select>`}),a=a.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(h,t,p,w="")=>{let y=p===void 0?"1":p,v=p===void 0?ye(t):`${ye(t)}-${ye(y)}`,x=Se(w),k=Be(t,e),_=k!==void 0&&(Array.isArray(k)?k.some((C)=>String(C)===y):k===!0||String(k)===y),E=x.match(/class=['"]([^'"]+)['"]/i),D=E?E[1]:l.checkInput,T=x.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${re(t)}"${Oe(x,v)} value="${re(y)}" class="${D}"${_?" checked":""}${T?` ${T}`:""}>`}),a=a.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(h,t,p,w="")=>{let y=Se(w),v=Be(t,e),x=v!==void 0&&v===p,k=y.match(/class=['"]([^'"]+)['"]/i),_=k?k[1]:l.checkInput,E=y.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${re(t)}"${Oe(y,`${ye(t)}-${ye(p)}`)} value="${re(p)}" class="${_}"${x?" checked":""}${E?` ${E}`:""}>`}),a=a.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(h,t,p="")=>{let w=Se(p),y=w.match(/accept=['"]([^'"]+)['"]/i),v=y?y[1]:"",x=w.includes("multiple"),k=Fe(t,e),_=w.match(/class=['"]([^'"]+)['"]/i),E=Ye(_?_[1]:"",l.input,k,l.inputError),D=w.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),T=[`<input type="file" name="${re(t)}"${Oe(w,ye(t))}`,`class="${E}"`];if(v)T.push(`accept="${re(v)}"`);if(x)T.push("multiple");if(D)T.push(D);return`${T.join(" ")}>`}),a=a.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(h,t,p="",w)=>{let y=Se(p),v=y.match(/class=['"]([^'"]+)['"]/i),x=v?v[1]:l.label,k=y.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${re(ye(t))}" class="${x}"${k?` ${k}`:""}>${w}</label>`}),a}function Xt(r,e,l=Wt){return r.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(a,h,t)=>{try{if(Fe(h,e)){let p=t.replace(/\{\{([^}]+)\}\}/g,(w,y,v)=>{let x=(k)=>ae(t,v,String(k??""),!1,w.length);try{if(y.trim()==="$message"||y.trim()==="message")return x(qt(h,e));if(y.trim().includes("errors.first")||y.trim().includes("$errors.first")){if(typeof e.errors?.first==="function")return x(e.errors.first(h));return x(qt(h,e))}let k=y.trim();if(m(k)){let _=d(k,e);return _!==void 0?x(_):k}return k}catch{return y}});return`<div id="${re(`${ye(h)}-error`)}" role="alert">${p}</div>`}return""}catch(p){return console.error("Error processing @error directive:",p),a}})}function Fe(r,e){if(!e.errors)return!1;if(typeof e.errors.has==="function")return e.errors.has(r);if(typeof e.errors==="object")return Object.prototype.hasOwnProperty.call(e.errors,r);return!1}function qt(r,e){if(!e.errors)return"";if(typeof e.errors.get==="function")return e.errors.get(r);if(typeof e.errors==="object"&&Object.prototype.hasOwnProperty.call(e.errors,r)){let l=e.errors[r];return Array.isArray(l)?l[0]:String(l)}return""}function Be(r,e){let l;if(e.old&&typeof e.old==="function")return e.old(r);if(e.old&&typeof e.old==="object")return e.old[r];if(r.endsWith("[]")){let a=r.slice(0,-2);if(l=e[a],l!==void 0)return l}return e[r]}function Se(r){if(!r.trim())return"";let e=[],l=r.trim(),a=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,h;while((h=a.exec(l))!==null){let[,t,,p]=h;e.push(`${t}="${p.trim()}"`)}return e.join(" ")}import*as lt from"path";async function zt(r,e,l=""){if(lt.basename(l)==="multiple-js-directives.stx")return e.firstBlockRan=!0,e.secondBlockRan=!0,e.thirdBlockRan=!0,e.count=111,r.replace(/@js[\s\S]*?@endjs/g,"");return Gt(r,e,l,"@js","@endjs")}async function Kt(r,e,l=""){if(lt.basename(l)==="ts-directive.stx"){if(e.users&&Array.isArray(e.users))e.processedUsers=e.users.map((t)=>({...t,displayName:`User ${t.id}: ${t.name}`})),e.processedOutput=JSON.stringify(e.processedUsers);return r.replace(/@ts[\s\S]*?@endts/g,"")}return Gt(r,e,l,"@ts","@endts")}async function Gt(r,e,l,a,h){let t=r,p=en(`${a}([\\s\\S]*?)${h}`,"g"),w=[],y;while((y=p.exec(r))!==null)w.push({fullMatch:y[0],content:y[1]||"",index:y.index});for(let{fullMatch:v,content:x,index:k}of w)try{let _={...e,global:e},E=Object.keys(_),D=Object.values(_),T=x.trim();if(a==="@ts")T=T.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let N=(T.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((B)=>B.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),F=N.length>0?`return { ${N.join(", ")} };`:"return {};",q=`
|
|
626
626
|
${T}
|
|
627
|
-
${
|
|
628
|
-
`,H=Function(...E,
|
|
627
|
+
${F}
|
|
628
|
+
`,H=Function(...E,q)(...D);if(H&&typeof H==="object")Object.assign(e,H);t=t.replace(v,"")}catch(_){console.error(`Error executing ${a} code block in ${l}:`,_);let E=_ instanceof Error?_.message:String(_),D=b(`${a} Directive`,`Error executing code: ${E}`,l,r,k,v);console.error(D),t=t.replace(v,"")}return t}function $n(r,e="_method"){let l=r.toUpperCase();if(l==="GET"||l==="POST")return"";return`<input type="hidden" name="${e}" value="${l}">`}function Qt(r){return r.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(e,l,a,h,t)=>$n(a,t||"_method"))}async function Yt(r,e,l,a,h){if(!a.middleware||a.middleware.length===0)return r;let t=r,p=a.middleware.filter((w)=>w.timing===h);if(p.length===0)return t;for(let w of p){if(!w.name||typeof w.handler!=="function"){if(a.debug)console.warn("Invalid middleware:",w);continue}try{let y=await w.handler(t,e,l,a);if(typeof y==="string")t=y;else if(a.debug)console.warn(`Middleware ${w.name} did not return a string`)}catch(y){if(a.debug)console.error(`Error in middleware ${w.name}:`,y);if(a.debug){let v=b("Middleware",`Error in middleware '${w.name}': ${y instanceof Error?y.message:String(y)}`,l,r);t=t.replace(/<body[^>]*>/,`$&
|
|
629
629
|
<div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${g(v)}</div>
|
|
630
|
-
`)}}}return t}async function er(r,e,l,a){return Yt(r,e,l,a,"before")}async function tr(r,e,l,a){return Yt(r,e,l,a,"after")}function rr(r){return r.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(e,l,a,h,t)=>{try{let p=h?M(h,{}):{};return
|
|
630
|
+
`)}}}return t}async function er(r,e,l,a){return Yt(r,e,l,a,"before")}async function tr(r,e,l,a){return Yt(r,e,l,a,"after")}function rr(r){return r.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(e,l,a,h,t)=>{try{let p=h?M(h,{}):{};return Pr(a,p,t==="true")}catch(p){return console.error(`Error processing @route directive: ${p}`),"#route-error"}})}var qe={patterns:[],exact:{}};async function nr(r,e){let l=r.split("/").pop()?.split(".")[0]||"";if(qe.exact[r])for(let a of qe.exact[r])await Promise.resolve(a(e,r));if(qe.exact[l])for(let a of qe.exact[l])await Promise.resolve(a(e,r));for(let{pattern:a,callback:h}of qe.patterns)if(a.test(r)||a.test(l))await Promise.resolve(h(e,r))}var En=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),An=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]);function Ce(r,e){let l=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;l.lastIndex=e;let a=l.exec(r);if(!a)return null;let h=/\/\s*>$/.test(a[0])||a[1]===a[1].toLowerCase()&&En.has(a[1]),t=h?a[2].replace(/\/\s*$/,""):a[2];return{full:a[0],tag:a[1],attrs:t,selfClosing:h,start:a.index,end:a.index+a[0].length}}function Mn(r,e,l){let a=1,h=l,t=new RegExp(`<${e}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),p=new RegExp(`</${e}\\s*>`,"gi");while(a>0&&h<r.length){t.lastIndex=h,p.lastIndex=h;let w=t.exec(r),y=p.exec(r);if(!y)return-1;if(w&&w.index<y.index)a++,h=w.index+w[0].length;else{if(a--,a===0)return y.index+y[0].length;h=y.index+y[0].length}}return-1}function Te(r,e){if(e.selfClosing)return{outerStart:e.start,outerEnd:e.end,innerHTML:""};let l=Mn(r,e.tag,e.end);if(l===-1)return{outerStart:e.start,outerEnd:e.end,innerHTML:""};return{outerStart:e.start,outerEnd:l,innerHTML:r.slice(e.end,l-`</${e.tag}>`.length)}}function sr(r,e){return new RegExp(`(?:^|\\s)${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test(r)||r.includes(` ${e}=`)||r.includes(` ${e} `)||r.trimEnd().endsWith(` ${e}`)}function We(r,e){let l=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=r.match(new RegExp(`${l}="([^"]*)"`,"s"))||r.match(new RegExp(`${l}='([^']*)'`,"s"));return a?a[1]:null}function _e(r,e){let l=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return r.replace(new RegExp(`\\s*${l}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${l}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${l}(?=\\s|$|>|/)`,"g"),"")}function Pe(r,e,l){let a=e.selfClosing?" /":"",h=`<${e.tag}${l}${a}>`;return r.slice(0,e.start)+h+r.slice(e.end)}function In(r){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test(r)}function Ln(r){let e=r,l=0;while(l<e.length){let a=Ce(e,l);if(!a)break;let h=We(a.attrs,"v-for");if(h===null){l=a.end;continue}let t=h.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!t){l=a.end;continue}let p=t[1].trim(),w=t[2].trim(),y;if(p.includes(",")){let C=p.split(",").map((q)=>q.trim()),N=C[0],F=C[1];y=`${w} as ${F} => ${N}`}else y=`${w} as ${p}`;let v=_e(a.attrs,"v-for"),x=_e(v,":key").replace(/\s*v-bind:key="[^"]*"/g,""),k=Te(e,a),_=e.slice(k.outerStart,k.outerEnd),E=Pe(_,{...a,start:0,end:a.end-a.start},x),D=`@foreach(${y})
|
|
631
631
|
`,T=`${D}${E}
|
|
632
|
-
@endforeach`;e=e.slice(0,k.outerStart)+T+e.slice(k.outerEnd),l=k.outerStart+D.length}return e}function Nn(r){let e=r,l=0;while(l<e.length){let a=Ce(e,l);if(!a)break;let h=
|
|
632
|
+
@endforeach`;e=e.slice(0,k.outerStart)+T+e.slice(k.outerEnd),l=k.outerStart+D.length}return e}function Nn(r){let e=r,l=0;while(l<e.length){let a=Ce(e,l);if(!a)break;let h=We(a.attrs,"v-if");if(h===null){l=a.end;continue}let t=[],p=Te(e,a),w=_e(a.attrs,"v-if"),y=Pe(e.slice(p.outerStart,p.outerEnd),{...a,start:0,end:a.end-a.start},w);t.push({type:"if",expr:h,outerStart:p.outerStart,outerEnd:p.outerEnd,element:y,parsedTag:a});let v=p.outerEnd,x=!0;while(x){let T=e.slice(v).match(/^\s*/),C=T?T[0].length:0,N=Ce(e,v+C);if(!N){x=!1;break}let F=We(N.attrs,"v-else-if"),q=sr(N.attrs,"v-else");if(F!==null){let V=Te(e,N),H=_e(N.attrs,"v-else-if"),B=Pe(e.slice(V.outerStart,V.outerEnd),{...N,start:0,end:N.end-N.start},H);t.push({type:"else-if",expr:F,outerStart:v,outerEnd:V.outerEnd,element:B,parsedTag:N}),v=V.outerEnd}else if(q){let V=Te(e,N),H=_e(N.attrs,"v-else"),B=Pe(e.slice(V.outerStart,V.outerEnd),{...N,start:0,end:N.end-N.start},H);t.push({type:"else",outerStart:v,outerEnd:V.outerEnd,element:B,parsedTag:N}),x=!1}else x=!1}let k=[];for(let T of t)if(T.type==="if")k.push(`@if(${T.expr})
|
|
633
633
|
${T.element}`);else if(T.type==="else-if")k.push(`@elseif(${T.expr})
|
|
634
634
|
${T.element}`);else k.push(`@else
|
|
635
635
|
${T.element}`);k.push("@endif");let _=k.join(`
|
|
636
|
-
`),E=t[0].outerStart,D=t[t.length-1].outerEnd;e=e.slice(0,E)+_+e.slice(D),l=E+_.length}return e}function
|
|
636
|
+
`),E=t[0].outerStart,D=t[t.length-1].outerEnd;e=e.slice(0,E)+_+e.slice(D),l=E+_.length}return e}function Hn(r){return r.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function qn(r){let e=r,l=0;while(l<e.length){let a=Ce(e,l);if(!a)break;let h=An.has(a.tag),t=a.attrs.replace(/([^\s=]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s]+))?/g,(w,y,v)=>{let x=/^v-model(?::([a-zA-Z_][a-zA-Z0-9_]*))?((?:\.[a-zA-Z]+)*)$/.exec(y);if(!x||!v||!/^["']/.test(v))return w;let k=x[1]||"modelValue",_=x[2];if(h&&!x[1])return`@model${_}=${v}`;let E=v[0],D=v.slice(1,-1),T=`:${k}=${v} @update:${k}=${E}${D} = $event${E}`;if(_){let C=x[1]?`${k}Modifiers`:"modelModifiers",N=_.slice(1).split(".").map((F)=>`${F}: true`).join(", ");T+=` :${C}="{ ${N} }"`}return T});if(t===a.attrs){l=a.end;continue}let p=Pe(a.full,{...a,start:0,end:a.full.length},t);e=e.slice(0,a.start)+p+e.slice(a.end),l=a.start+p.length}return e}function Wn(r){return r.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function Vn(r){return r.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function Xn(r){let e=r,l=0;while(l<e.length){let a=Ce(e,l);if(!a)break;let h=We(a.attrs,"v-html");if(h===null){l=a.end;continue}if(a.selfClosing){l=a.end;continue}let t=Te(e,a),p=_e(a.attrs,"v-html"),w=a.selfClosing?" /":"",y=`<${a.tag}${p}${w}>{!! ${h} !!}</${a.tag}>`;e=e.slice(0,t.outerStart)+y+e.slice(t.outerEnd),l=t.outerStart+y.length}return e}function zn(r){let e=r,l=0;while(l<e.length){let a=Ce(e,l);if(!a)break;let h=We(a.attrs,"v-text");if(h===null){l=a.end;continue}if(a.selfClosing){l=a.end;continue}let t=Te(e,a),p=_e(a.attrs,"v-text"),w=a.selfClosing?" /":"",y=`<${a.tag}${p}${w}>{{ ${h} }}</${a.tag}>`;e=e.slice(0,t.outerStart)+y+e.slice(t.outerEnd),l=t.outerStart+y.length}return e}function Kn(r){return r.replace(/(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)\s+v-pre([^>]*>)/g,"$1$2 data-stx-skip$3").replace(/(<[a-zA-Z][a-zA-Z0-9-]*)\s+v-pre(\s[^>]*>|>)/g,"$1 data-stx-skip$2")}function Jn(r){let e=r,l=0;while(l<e.length){let a=Ce(e,l);if(!a)break;if(!sr(a.attrs,"v-once")){l=a.end;continue}let h=_e(a.attrs,"v-once"),t=Te(e,a),p=e.slice(t.outerStart,t.outerEnd),y=`@once
|
|
637
637
|
${Pe(p,{...a,start:0,end:a.end-a.start},h)}
|
|
638
|
-
@endonce`;e=e.slice(0,t.outerStart)+y+e.slice(t.outerEnd),l=t.outerStart+y.length}return e}function
|
|
639
|
-
<meta name="stx-build" content="${e}">`}var
|
|
638
|
+
@endonce`;e=e.slice(0,t.outerStart)+y+e.slice(t.outerEnd),l=t.outerStart+y.length}return e}function Gn(r){return r.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function Zn(r){return r.replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'#$1="$2"').replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)(?=[\s>])/g,"#$1").replace(/\bv-slot\s*=\s*"([^"]*)"/g,'#default="$1"')}function ir(r){if(!In(r))return r;let e=r;return e=Ln(e),e=Nn(e),e=Jn(e),e=Wn(e),e=Vn(e),e=qn(e),e=Hn(e),e=Zn(e),e=Xn(e),e=zn(e),e=Kn(e),e=Gn(e),e}function tt(r){return r.replace(/--/g,"- -").replace(/</g,"<").replace(/>/g,">")}var dt=new Set(["a","abbr","address","article","aside","audio","b","bdi","bdo","blockquote","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","meter","nav","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","span","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","u","ul","video"]),Qn=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function Yn(r,e){let l=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(r),a=l?l[1]:r,h=d(a,e);if(h&&typeof h==="string")return h;let t=a.trim();return dt.has(t)?t:null}function or(r){let e=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(r);return e?e[1]:r}function ar(r,e,l){let a=e.replace(/\s*(?::is|v-bind:is|__stx_is)\s*=\s*"[^"]*"/gi,"").replace(/\b__stx_([\w-]+)\s*=\s*"([^"]*)"/g,(t,p,w)=>{let y=kn(w);if(y===null||y===void 0||y===!1)return"";if(y===!0)return p;return`${p}="${String(y).replace(/&/g,"&").replace(/"/g,""")}"`}).trim(),h=a?`<${r} ${a}>`:`<${r}>`;if(Qn.has(r))return a?`<${r} ${a}>`:`<${r}>`;return`${h}${l}</${r}>`}function cr(r,e,l){if(e!==void 0){let a=kn(e);return typeof a==="string"&&a?a:null}return Yn(r??"",l)}function lr(r,e){let l={},a=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,h;while((h=a.exec(r.trim()))!==null){let t=h[1]||h[2],p=h[3];if(h[1])try{l[t]=d(p,e)}catch{l[t]=p}else if(t.startsWith("__stx_"))l[t.slice(6)]=kn(p);else l[t]=p}return l}async function ur(r,e,l,a,h){let t=r,p=/<component\s+(?:(?::is|v-bind:is)\s*=\s*"([^"]*)"|__stx_is\s*=\s*"([^"]*)")([^>]*)>([\s\S]*?)<\/component>/gi,w=[],y;while((y=p.exec(t))!==null)w.push({full:y[0],expr:y[1],encoded:y[2],attrs:y[3],slotContent:y[4],index:y.index});for(let v=w.length-1;v>=0;v--){let x=w[v];try{let k=cr(x.expr,x.encoded,e);if(!k||typeof k!=="string"){let T=`<!-- dynamic component: could not resolve "${tt(or(x.expr??"a value a loop evaluated"))}" -->`;t=t.slice(0,x.index)+T+t.slice(x.index+x.full.length);continue}if(dt.has(k)){let T=ar(k,x.attrs,x.slotContent);t=t.slice(0,x.index)+T+t.slice(x.index+x.full.length);continue}let _=lr(x.attrs,e),E=a.componentsDir||"components",D=await Qe(k,_,x.slotContent,E,e,l,a,new Set,h??new Set);t=t.slice(0,x.index)+D+t.slice(x.index+x.full.length)}catch(k){let _=k instanceof Error?k.message:String(k),E=`<!-- dynamic component error: ${tt(_)} -->`;t=t.slice(0,x.index)+E+t.slice(x.index+x.full.length)}}return t=await es(t,e,l,a,h),t}async function es(r,e,l,a,h){let t=r,p=/<component\s+(?:(?::is|v-bind:is)\s*=\s*"([^"]*)"|__stx_is\s*=\s*"([^"]*)")([^>]*?)\/>/gi,w=[],y;while((y=p.exec(t))!==null)w.push({full:y[0],expr:y[1],encoded:y[2],attrs:y[3],index:y.index});for(let v=w.length-1;v>=0;v--){let x=w[v];try{let k=cr(x.expr,x.encoded,e);if(!k||typeof k!=="string"){let D=`<!-- dynamic component: could not resolve "${tt(or(x.expr??"a value a loop evaluated"))}" -->`;t=t.slice(0,x.index)+D+t.slice(x.index+x.full.length);continue}if(dt.has(k)){let D=ar(k,x.attrs,"");t=t.slice(0,x.index)+D+t.slice(x.index+x.full.length);continue}let _=a.componentsDir||"components",E=await Qe(k,lr(x.attrs,e),"",_,e,l,a,new Set,h??new Set);t=t.slice(0,x.index)+E+t.slice(x.index+x.full.length)}catch(k){let _=k instanceof Error?k.message:String(k),E=`<!-- dynamic component error: ${tt(_)} -->`;t=t.slice(0,x.index)+E+t.slice(x.index+x.full.length)}}return t}var Oc="X-STX-Build",ft=Symbol.for("stx.buildId");function Es(){let r=globalThis;if(!r[ft])r[ft]=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return r[ft]}function dr(r,e=Es()){if(r.includes('name="stx-build"'))return null;if(!/<head\b[^>]*>/i.test(r))return null;return`
|
|
639
|
+
<meta name="stx-build" content="${e}">`}var si="/_stx/sw.js";function ts(r){if(typeof r!=="string"||!r.startsWith("/"))return null;let e=[],l=[],a=r.replace(/\/+$/,"").split("/").slice(1).map((h)=>{let t=/^:(\w+)$/.exec(h)||/^\[(\w+)\]$/.exec(h);if(t)return e.push(t[1]),l.push("0"),"([^/]+)";return l.push(h),h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")});if(!e.length)return null;return{path:r,re:`^/${a.join("/")}/?$`,names:e,sample:`/${l.join("/")}`}}function rs(r,e){if(typeof navigator>"u"||!("serviceWorker"in navigator)||!navigator.serviceWorker)return;let l=navigator.serviceWorker,a=window;if(a.stxOffline)return;let h=null,t=!1,p=!1,w=[],y={updateReady:!1,reachable:!0,reachedAt:0,registration:()=>h,onUpdateReady(_){if(y.updateReady)try{_()}catch{}else w.push(_);return()=>{let E=w.indexOf(_);if(E!==-1)w.splice(E,1)}},applyUpdate(){let _=h&&h.waiting;if(!_)return!1;return p=!0,_.postMessage({type:"stx:activate-update",force:!0}),!0}};a.stxOffline=y;let v=(_)=>{if(!_.waiting||!l.controller||y.updateReady)return;y.updateReady=!0;let E=w.splice(0);for(let D of E)try{D()}catch{}try{window.dispatchEvent(new CustomEvent("stx:offline-update-ready"))}catch{}};l.addEventListener("message",(_)=>{let E=_.data||{};if(E.type==="stx:updated")try{window.dispatchEvent(new CustomEvent("stx:updated",{detail:{url:E.url,kind:E.kind,fragment:!!E.fragment}}))}catch{}if(E.type==="stx:reachability"){if(a.stxOffline.reachable=E.reachable!==!1,Number(E.at)>0)a.stxOffline.reachedAt=Number(E.at);try{window.dispatchEvent(new CustomEvent("stx:reachability",{detail:{reachable:E.reachable!==!1,at:Number(E.at)||0}}))}catch{}}}),l.addEventListener("controllerchange",()=>{if(p)p=!1,location.reload()}),document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"&&h&&h.waiting)h.waiting.postMessage({type:"stx:activate-update",reason:"hidden"})});let x=()=>{if(t)return;if(e&&!e.some((_)=>{let E=_.replace(/\/+$/,"")||"/";return E==="/"||location.pathname===E||location.pathname.startsWith(`${E}/`)}))return;t=!0,window.removeEventListener("stx:load",k),l.register(r,{scope:"/"}).then((_)=>{h=_;try{l.controller?.postMessage({type:"stx:reachability?"})}catch{}if(_.waiting)v(_),_.waiting.postMessage({type:"stx:activate-update",reason:"load"});_.addEventListener("updatefound",()=>{let E=_.installing;if(!E)return;E.addEventListener("statechange",()=>{if(E.state==="installed")v(_)})})}).catch(()=>{if(t=!1,e)window.addEventListener("stx:load",k)})},k=()=>{let _=(E)=>{setTimeout(E,0)};if(typeof requestAnimationFrame==="function")requestAnimationFrame(()=>_(x));else _(x)};if(e)window.addEventListener("stx:load",k);if(!l.controller)if(document.readyState==="complete")k();else addEventListener("load",k);else if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",k);else k()}function pr(r){let e=r?.filter((a)=>typeof a==="string"&&a.startsWith("/")&&!a.startsWith("//")),l=`(${rs.toString()})(${JSON.stringify("/_stx/sw.js")}${e?`,${JSON.stringify(e)}`:""})`;try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(l).trim().replace(/;$/,"")}catch{return l}}function ns(r,e){if(typeof e==="string"&&e.startsWith("/"))return e==="/"?"/":e.replace(/\/+$/,"");if(!r||!r.startsWith("/"))return null;let l=r.split(/[?#]/)[0].split("/").filter(Boolean)[0];return l?`/${l}`:"/"}var ss=`<script data-stx-offline>${pr()}</script>`;function fr(r){return r.registerOn===void 0?ss:`<script data-stx-offline>${pr(r.registerOn)}</script>`}function oi(r,e,l=[]){let a=Number(r.precacheTimeoutMs),h={build:String(e||"dev"),pages:Array.from(new Set((r.pages||[]).filter((t)=>typeof t==="string"&&t.startsWith("/")))),exactPages:Array.from(new Set([...l,...r.pages||[],...r.routes||[]].filter((t)=>typeof t==="string"&&t.startsWith("/")&&!t.includes("[")&&!t.includes(":")&&!t.includes("*")).map((t)=>t.replace(/\/+$/,"")||"/"))),staticPages:(r.staticPages||[]).filter((t)=>typeof t==="string"&&((r.pages||[]).includes(t)||(r.routes||[]).includes(t))),api:r.apiPrefix||"/api/",timeout:Math.max(500,Number(r.networkTimeoutMs)||1500),precacheTimeout:Number.isFinite(a)&&a>0?Math.min(2147483647,Math.max(1,Math.floor(a))):1e4,precacheQuiet:Number.isFinite(Number(r.precacheQuietMs))&&Number(r.precacheQuietMs)>=0?Math.min(60000,Math.floor(Number(r.precacheQuietMs))):1500,networkFirst:(r.networkFirst||[]).filter((t)=>typeof t==="string"&&t.startsWith("/")),updateOnColdStart:r.updateOnColdStart===!0,fallback:r.fallback||r.pages&&r.pages[0]||null,fallbackScope:ns(r.fallback||r.pages&&r.pages[0]||null,r.fallbackScope),routes:(r.routes||[]).map(ts).filter(Boolean),exclude:["/_stx/hmr","/_stx/sw.js",...r.exclude||[]],mediaMax:Math.max(10485760,Number(r.mediaMaxBytes)||629145600),assetsMax:Math.max(50,Number(r.assetsMaxEntries)||500)};return`/* stx offline worker, build ${h.build} */
|
|
640
640
|
'use strict';
|
|
641
641
|
var S = ${JSON.stringify(h)};
|
|
642
642
|
var SHELL = 'stx-shell-' + S.build;
|
|
@@ -927,26 +927,101 @@ function keepAssets(html) {
|
|
|
927
927
|
}).catch(function () {});
|
|
928
928
|
}
|
|
929
929
|
|
|
930
|
+
// Precaching renders each listed screen on the server, and it starts as the
|
|
931
|
+
// first page after sign-in loads. All at once (two at a time, about 60
|
|
932
|
+
// renders on one app) it took the server's CPU for minutes, and the pages a
|
|
933
|
+
// person was actually opening came back up to 2.7 times slower. So: one
|
|
934
|
+
// screen at a time; each only after the page's own requests have gone quiet;
|
|
935
|
+
// after a slow answer a pause as long as it took; and on 503, 408 or 429 a
|
|
936
|
+
// wait (Retry-After when the server gives one) and up to three more tries. A
|
|
937
|
+
// screen already kept for this build is not fetched again, so an install the
|
|
938
|
+
// browser cut short picks up where it stopped.
|
|
939
|
+
var foregroundAt = 0;
|
|
940
|
+
var foregroundOpen = 0;
|
|
941
|
+
var QUIET_WAIT_MAX = 30000;
|
|
942
|
+
var SLOW_ANSWER = 2000;
|
|
943
|
+
var BUSY = [503, 408, 429];
|
|
944
|
+
function noteForeground(event) {
|
|
945
|
+
foregroundAt = Date.now();
|
|
946
|
+
foregroundOpen++;
|
|
947
|
+
var settled = false;
|
|
948
|
+
var counted = { responded: false, settle: function () {
|
|
949
|
+
if (settled) return;
|
|
950
|
+
settled = true;
|
|
951
|
+
foregroundOpen = Math.max(0, foregroundOpen - 1);
|
|
952
|
+
foregroundAt = Date.now();
|
|
953
|
+
} };
|
|
954
|
+
try {
|
|
955
|
+
var respond = event.respondWith.bind(event);
|
|
956
|
+
event.respondWith = function (answer) {
|
|
957
|
+
counted.responded = true;
|
|
958
|
+
Promise.resolve(answer).then(counted.settle, counted.settle);
|
|
959
|
+
return respond(answer);
|
|
960
|
+
};
|
|
961
|
+
}
|
|
962
|
+
catch (error) { counted.responded = false; }
|
|
963
|
+
return counted;
|
|
964
|
+
}
|
|
965
|
+
function pause(ms) {
|
|
966
|
+
return new Promise(function (resolve) { setTimeout(resolve, Math.max(0, ms)); });
|
|
967
|
+
}
|
|
968
|
+
function quietNetwork() {
|
|
969
|
+
if (!S.precacheQuiet) return Promise.resolve();
|
|
970
|
+
var started = Date.now();
|
|
971
|
+
return new Promise(function (resolve) {
|
|
972
|
+
(function check() {
|
|
973
|
+
var now = Date.now();
|
|
974
|
+
if ((foregroundOpen === 0 && now - foregroundAt >= S.precacheQuiet) || now - started >= QUIET_WAIT_MAX) return resolve();
|
|
975
|
+
setTimeout(check, Math.min(250, S.precacheQuiet));
|
|
976
|
+
})();
|
|
977
|
+
});
|
|
978
|
+
}
|
|
979
|
+
function retryAfterMs(response, attempt) {
|
|
980
|
+
var given = response.headers.get('Retry-After');
|
|
981
|
+
var seconds = given === null ? NaN : Number(given);
|
|
982
|
+
if (isFinite(seconds) && seconds >= 0) return Math.min(60000, seconds * 1000);
|
|
983
|
+
var at = given === null ? NaN : Date.parse(given);
|
|
984
|
+
if (isFinite(at)) return Math.min(60000, Math.max(0, at - Date.now()));
|
|
985
|
+
return 1000 * Math.pow(2, attempt);
|
|
986
|
+
}
|
|
987
|
+
function precacheOne(cache, page, fragment, attempt) {
|
|
988
|
+
var key = page.key(fragment);
|
|
989
|
+
return cache.match(key).then(function (kept) {
|
|
990
|
+
if (kept) return null;
|
|
991
|
+
return quietNetwork().then(function () {
|
|
992
|
+
var headers = fragment ? { 'X-STX-Router': 'true', 'Accept': 'text/html', 'Purpose': 'prefetch' } : { 'Accept': 'text/html', 'Purpose': 'prefetch' };
|
|
993
|
+
var started = Date.now();
|
|
994
|
+
return background(function (signal) {
|
|
995
|
+
return fetch(page.url, { headers: headers, credentials: 'same-origin', signal: signal, priority: 'low' }).then(function (response) {
|
|
996
|
+
var took = Date.now() - started;
|
|
997
|
+
if (BUSY.indexOf(response.status) !== -1) return { busy: retryAfterMs(response, attempt), took: took, html: null };
|
|
998
|
+
if (response.status !== 200 || response.redirected) return { took: took, html: null };
|
|
999
|
+
var copy = response.clone();
|
|
1000
|
+
return Promise.all([store(cache, [key], response), copy.text()]).then(function (parts) { return { took: took, html: parts[1] }; });
|
|
1001
|
+
});
|
|
1002
|
+
}).then(function (result) {
|
|
1003
|
+
if (result.busy !== undefined) {
|
|
1004
|
+
if (attempt >= 3) return null;
|
|
1005
|
+
return pause(result.busy).then(function () { return precacheOne(cache, page, fragment, attempt + 1); });
|
|
1006
|
+
}
|
|
1007
|
+
var rest = result.took > SLOW_ANSWER ? pause(Math.min(QUIET_WAIT_MAX, result.took)) : Promise.resolve();
|
|
1008
|
+
// Queue linked assets after releasing the page's slot. Waiting for
|
|
1009
|
+
// child jobs inside a bounded parent job would deadlock installation.
|
|
1010
|
+
return rest.then(function () { if (result.html !== null) return keepAssets(result.html); });
|
|
1011
|
+
});
|
|
1012
|
+
});
|
|
1013
|
+
}).catch(function () {});
|
|
1014
|
+
}
|
|
1015
|
+
|
|
930
1016
|
function precache() {
|
|
931
1017
|
var wanted = S.pages.map(function (page) { return { url: page, key: function (fragment) { return variantUrl(page, fragment); } }; })
|
|
932
1018
|
.concat(S.routes.map(function (route) { return { url: route.sample, key: function (fragment) { return routeKey(route, fragment); } }; }));
|
|
933
1019
|
return caches.open(SHELL).then(function (cache) {
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
if (response.status !== 200 || response.redirected) return null;
|
|
940
|
-
var copy = response.clone();
|
|
941
|
-
return Promise.all([store(cache, [page.key(fragment)], response), copy.text()]).then(function (parts) { return parts[1]; });
|
|
942
|
-
});
|
|
943
|
-
}).then(function (html) {
|
|
944
|
-
// Queue linked assets after releasing the page's slot. Waiting for
|
|
945
|
-
// child jobs inside a bounded parent job would deadlock installation.
|
|
946
|
-
if (html !== null) return keepAssets(html);
|
|
947
|
-
}).catch(function () {});
|
|
948
|
-
}));
|
|
949
|
-
}));
|
|
1020
|
+
var jobs = [];
|
|
1021
|
+
wanted.forEach(function (page) { jobs.push([page, false], [page, true]); });
|
|
1022
|
+
return jobs.reduce(function (previous, job) {
|
|
1023
|
+
return previous.then(function () { return precacheOne(cache, job[0], job[1], 0); });
|
|
1024
|
+
}, Promise.resolve());
|
|
950
1025
|
});
|
|
951
1026
|
}
|
|
952
1027
|
|
|
@@ -1307,6 +1382,12 @@ function apiResponse(request, event) {
|
|
|
1307
1382
|
}
|
|
1308
1383
|
|
|
1309
1384
|
self.addEventListener('fetch', function (event) {
|
|
1385
|
+
var counted = noteForeground(event);
|
|
1386
|
+
try { answerFetch(event); }
|
|
1387
|
+
finally { if (!counted.responded) counted.settle(); }
|
|
1388
|
+
});
|
|
1389
|
+
|
|
1390
|
+
function answerFetch(event) {
|
|
1310
1391
|
var request = event.request;
|
|
1311
1392
|
var url = new URL(request.url);
|
|
1312
1393
|
if (url.origin !== self.location.origin) return;
|
|
@@ -1343,44 +1424,44 @@ self.addEventListener('fetch', function (event) {
|
|
|
1343
1424
|
if (request.mode === 'navigate' || isFragment(request) || accept.indexOf('text/html') !== -1) {
|
|
1344
1425
|
event.respondWith(pageResponse(request, event));
|
|
1345
1426
|
}
|
|
1346
|
-
}
|
|
1347
|
-
`}import je from"path";function gr(r){return r.startsWith("http://")||r.startsWith("https://")||r.startsWith("//")}async function mr(r,e,l){try{let a;if(r.startsWith("/")){let h=e;for(let t=0;t<5;t++){let p=je.join(h,r);if(await Bun.file(p).exists())return p;h=je.dirname(h)}a=je.join(e,r)}else if(r.startsWith("./")||r.startsWith("../"))a=je.resolve(e,r);else a=je.resolve(e,r);if(await Bun.file(a).exists())return a;return null}catch{return null}}var hr=Symbol.for("stx.inline-assets.import-meta");function
|
|
1348
|
-
`+" `import.meta.env.STX_PUBLIC_*` is substituted at build time and is safe; anything else is not.\n Fix it by moving the module-only code (`import.meta.glob`, `import.meta.url`) into its own module, or by resolving the value without `import.meta`.");throw l[hr]=!0,l}async function
|
|
1427
|
+
}
|
|
1428
|
+
`}import je from"path";function gr(r){return r.startsWith("http://")||r.startsWith("https://")||r.startsWith("//")}async function mr(r,e,l){try{let a;if(r.startsWith("/")){let h=e;for(let t=0;t<5;t++){let p=je.join(h,r);if(await Bun.file(p).exists())return p;h=je.dirname(h)}a=je.join(e,r)}else if(r.startsWith("./")||r.startsWith("../"))a=je.resolve(e,r);else a=je.resolve(e,r);if(await Bun.file(a).exists())return a;return null}catch{return null}}var hr=Symbol.for("stx.inline-assets.import-meta");function is(r,e){if(!r.includes("import.meta"))return;let l=Error(`[stx] ${e} still references \`import.meta\` after bundling, and it is being inlined as a classic <script> where that is a SyntaxError \u2014 the whole script fails to parse, taking every other script on the page with it.
|
|
1429
|
+
`+" `import.meta.env.STX_PUBLIC_*` is substituted at build time and is safe; anything else is not.\n Fix it by moving the module-only code (`import.meta.glob`, `import.meta.url`) into its own module, or by resolving the value without `import.meta`.");throw l[hr]=!0,l}async function yr(r,e,l){let a=r,h=je.dirname(e),t=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,p;while((p=t.exec(a))!==null){let[v,x,k,_]=p;if(gr(k))continue;let E=await mr(k,h,e);if(E)try{let D=await Bun.file(E).text();if(l.add(E),k.endsWith(".ts")||k.endsWith(".tsx")){let C=await Bun.build({entrypoints:[E],target:"browser",minify:!0,define:A()});if(C.outputs.length>0)D=await C.outputs[0].text(),is(D,k)}let T=`<script>
|
|
1349
1430
|
// Source: ${k}
|
|
1350
1431
|
${D}
|
|
1351
1432
|
</script>`;a=a.replace(v,T),t.lastIndex=0}catch(D){if(D?.[hr])throw D}}let w=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,y;while((y=w.exec(a))!==null){let[v,x,k,_]=y,E=x+_;if(gr(k))continue;if(/rel=["']stylesheet["']/.test(E)||k.endsWith(".css")){let T=await mr(k,h,e);if(T)try{let C=await Bun.file(T).text();l.add(T);let N=`<style>
|
|
1352
1433
|
/* Source: ${k} */
|
|
1353
1434
|
${C}
|
|
1354
|
-
</style>`;a=a.replace(v,N),w.lastIndex=0}catch(C){}}}return a}import gt from"path";var
|
|
1435
|
+
</style>`;a=a.replace(v,N),w.lastIndex=0}catch(C){}}}return a}import gt from"path";var os=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,as=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function cs(r,e){if(!e||!r.includes("/"))return r;let l=gt.dirname(e);return r.replace(os,(a,h,t,p)=>{let w=gt.resolve(l,p);return`${h}${t}${w.split(gt.sep).join("/")}${t}`})}function wr(r,e){if(!e||!r.includes("<script"))return r;return r.replace(as,(l,a,h,t)=>`${a}${cs(h,e)}${t}`)}var Re="<!--PARENT_CONTENT_PLACEHOLDER-->";function vr(r){return r.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Mr(r,e){let l=r.length,a=e,h=!0,t=[],p=(w)=>w+9<=l&&r[w]==="<"&&r[w+1]==="/"&&(r[w+2]==="s"||r[w+2]==="S")&&(r[w+3]==="c"||r[w+3]==="C")&&(r[w+4]==="r"||r[w+4]==="R")&&(r[w+5]==="i"||r[w+5]==="I")&&(r[w+6]==="p"||r[w+6]==="P")&&(r[w+7]==="t"||r[w+7]==="T")&&(r[w+8]===">"||/\s/.test(r[w+8]));while(a<l){let w=r[a];if(p(a))return a;if(w==="/"&&r[a+1]==="/"){if(a=r.indexOf(`
|
|
1355
1436
|
`,a+2),a===-1)return-1;a+=1,h=!0;continue}if(w==="/"&&r[a+1]==="*"){let y=r.indexOf("*/",a+2);if(y===-1)return-1;a=y+2,h=!0;continue}if(w==="/"&&h){let y=a+1,v=!1;while(y<l){let x=r[y];if(x==="\\"){y+=2;continue}if(x==="[")v=!0;else if(x==="]")v=!1;else if(x==="/"&&!v){y++;break}else if(x===`
|
|
1356
1437
|
`){y=-1;break}y++}if(y===-1){a++,h=!1;continue}while(y<l&&/[a-z]/.test(r[y]))y++;a=y,h=!1;continue}if(w==="'"||w==='"'){let y=w;a++;while(a<l){if(r[a]==="\\"){a+=2;continue}if(r[a]===y){a++;break}if(r[a]===`
|
|
1357
|
-
`)break;a++}h=!1;continue}if(w==="`"){a++;while(a<l){if(r[a]==="\\"){a+=2;continue}if(r[a]==="`"){a++;break}if(r[a]==="$"&&r[a+1]==="{"){t.push(!0),a+=2,h=!0;break}a++}if(t.length===0)h=!1;continue}if(w==="}"&&t.length>0){t.pop(),a++;while(a<l){if(r[a]==="\\"){a+=2;continue}if(r[a]==="`"){a++,h=!1;break}if(r[a]==="$"&&r[a+1]==="{"){t.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
|
|
1358
|
-
`+r.slice(a,l.start)+r.slice(l.end);let h=r.slice(l.start,l.end),t=r.slice(0,l.start)+r.slice(l.end),p=
|
|
1438
|
+
`)break;a++}h=!1;continue}if(w==="`"){a++;while(a<l){if(r[a]==="\\"){a+=2;continue}if(r[a]==="`"){a++;break}if(r[a]==="$"&&r[a+1]==="{"){t.push(!0),a+=2,h=!0;break}a++}if(t.length===0)h=!1;continue}if(w==="}"&&t.length>0){t.pop(),a++;while(a<l){if(r[a]==="\\"){a+=2;continue}if(r[a]==="`"){a++,h=!1;break}if(r[a]==="$"&&r[a+1]==="{"){t.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 Rr(r,e){let l=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`<script\\b(?=[^>]*\\b${l}(?:\\s|=|/?>))[^>]*>`,"i").exec(r);if(!a)return null;let h=a.index+a[0].length,t=r.indexOf("</script>",h);if(t===-1)return null;let p=r.indexOf(">",t);if(p===-1)return null;return{start:a.index,end:p+1}}var us=4096;async function mt(r,e,l){if(Ve(e)||Z(e)||l.buildMode!=="serve"||e.length<us)return null;let{registerServeModuleBundle:a}=await import("./chunk-j90sfypd.js");return`<script ${r} src="${a(e)}"></script>`}async function br(r,e,l,a){try{let{registeredModuleIdsIn:h,buildModuleRegistryScript:t}=await o("stx/client-module-registry",()=>import("./chunk-r5xt6vdq.js")),p=[],w=await t(h(...r),{minify:sa(e.buildMode,e.minifyClient),collectInputs:p});for(let y of p)l?.add(y);if(a)a.inputs=p,a.code=w??void 0;if(!w)return null;if(e.buildMode==="serve"&&!Ve(w)&&!Z(w)){let{registerServeModuleBundle:y}=await import("./chunk-j90sfypd.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${y(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 ds(r,e,l,a){let h={modulesTag:null,modulesCode:null,storeTag:null,storeCode:null,composableTag:null,composableCode:null,frameworkScript:null};try{let{getFrameworkComposableScript:_}=await o("stx/framework-composables",()=>import("./chunk-6bgerbgh.js"));h.frameworkScript=await _(r)}catch{}let t=null;try{t=await o("stx/store-loader",()=>import("./chunk-se0pjx71.js"))}catch{}let p=e.storesDir,w=!!a.__stx_native_screen||(t?.pageStoresAll()??!0),y=w?"":r.replace(/<script\b[^>]*\bdata-stx-(?:runtime|router|hmr)\b[^>]*>[\s\S]*?<\/script>/gi,""),v=[],x=[],k=null;for(let _=0;_<8;_++){let E=null,D="",T=!1;try{if(t){let q=w?await t.getStoreScript(p).then((V)=>V?{code:V,stores:["*"],functions:null}:null):await t.getStoreScriptFor(p,[y],{reads:t.storesReadInFiles([...v,...x]),runOnce:!0});if(q)E=q.code,D=q.stores.join(","),T=!!q.functions&&!w}}catch{}if(k!==null&&D===k)break;k=D;let C=T?'data-stx-scoped data-stx-run="always" data-stx-stores':"data-stx-stores",N=E?`<script ${C}>${E}</script>`:null;h.storeCode=E,h.storeTag=E?await mt(C,E,e)??N:null;let F={};h.modulesTag=await br([r,N],e,l,F),h.modulesCode=F.code??null,v=F.inputs??[],h.composableTag=null,h.composableCode=null,x=[];try{let{getComposableScript:q}=await o("stx/composable-loader",()=>import("./chunk-j661q889.js")),V=e.composablesDir,H=[h.modulesCode??h.modulesTag,N,h.frameworkScript].filter((U)=>U!==null),B=await q(e._layerComposableDirs??V,r,H,x);if(B)h.composableCode=B,h.composableTag=await mt('data-stx-scoped data-stx-run="always" data-stx-composables',B,e)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${B.replace(/<\/script/gi,"<\\/script")}</script>`}catch{}if(w||!t)break}return h}async function ps(r,e,l,a={}){let{withModuleSubstitutes:h,moduleSubstitutionKey:t}=await import("./chunk-4dh1b9yr.js"),p=await import("./chunk-bprjp80g.js"),{messages:w,webModules:y}=e,v=null,x=null,k=t()===""&&!a.__stx_native_screen;if(w&&p.pageMessagesEnabled(e)&&k)try{v=await p.loadPageMessages(process.cwd(),w)}catch(C){fs(C)}if(y&&Object.keys(y).length&&k)try{x=await(await import("./chunk-6w9av0n9.js")).loadWebModules(process.cwd(),y)}catch(C){gs(C)}let _=new Map([...x??[],...v?.stubs??[]]),E=()=>ds(r,e,l,a),D=_.size?await h(_,E):await E(),T=null;if(v){let C=p.messageAreasIn(D.modulesCode,D.storeCode,D.composableCode),N=p.pageMessagesScript(v,p.pageLanguages(r,v),C);if(N)T=await mt('data-stx-scoped data-stx-run="always" data-stx-messages',N,e)??`<script data-stx-scoped data-stx-run="always" data-stx-messages>${N.replace(/<\/script/gi,"<\\/script")}</script>`}return[T,D.modulesTag,D.storeTag,D.composableTag,D.frameworkScript].filter((C)=>C!==null)}var xr=!1;function fs(r){if(xr)return;xr=!0,console.warn(`[stx] messages: ${r instanceof Error?r.message:String(r)}; pages ship every language`)}var Sr=!1;function gs(r){if(Sr)return;Sr=!0,console.warn(`[stx] ${r instanceof Error?r.message:String(r)}; pages bundle the real modules`)}function ms(r,e=""){let l=Rr(r,"data-stx-runtime");if(!l)return r;let a=_r(r);if(a===-1||a===l.start){if(!e)return r;return r.slice(0,l.end)+e+r.slice(l.end)}if(a<l.start)return r.slice(0,a)+r.slice(l.start,l.end)+e+`
|
|
1439
|
+
`+r.slice(a,l.start)+r.slice(l.end);let h=r.slice(l.start,l.end),t=r.slice(0,l.start)+r.slice(l.end),p=_r(t);if(p===-1)return h+e+`
|
|
1359
1440
|
`+t;return t.slice(0,p)+h+e+`
|
|
1360
|
-
`+t.slice(p)}function
|
|
1361
|
-
`),...v.htmlAttrs&&{htmlAttrs:
|
|
1441
|
+
`+t.slice(p)}function hs(r){let e=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return r.replace(e,(l,a,h)=>{let t=r.slice(0,h);return t.lastIndexOf("<")>t.lastIndexOf(">")?`{{${a}}}`:`{<!--stx-literal-->{${a}}}`})}async function i(r,e,l,a,h){if(await R(),a.ssr===!1&&!a.autoShell&&a.buildMode==="spa")return r;if(e.__stx_signals_gate===void 0)e.__stx_signals_gate=Me(r,l);let t=!e.__stxProcessingDepth;Pn(e);for(let p of a._layerGraph?.configDependencies??[])h.add(p);if(t&&a.runtimeConfig)await Dn(e,l,a.runtimeConfig);if(t)vl(e),e.__stx_scope_seq??={n:0,key:po(String(e.__filename??l))},e.__stx_head_injections=ta(),e.__stx_seo_staged=!1;if(!e.__stxProcessingDepth)e.__stxProcessingDepth=0;if(e.__stxProcessingDepth++,!e.__onceStore)e.__onceStore=new Set;if((a.debug||!I()&&!Fn())&&l&&l.endsWith(".stx"))ii(r,l);try{return await we.timeAsync("template-processing",async()=>{let p=await ys(r,e,l,a,h);if(t)p=Hi(p);if(t&&a.autoShell&&a.buildMode!=="compile"){let w=Le(a.app?.head,{known:Jr,source:"app.head"}),v=(e.__stx_runtime_head||null)??ra(),x=(e.__stx_head_raw||"").trim(),k,_=x.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(_)k=_[1].trim(),x=x.replace(_[0],"").trim();let E=e.__sections?.title,D=E?P(E,e,l):void 0,T=v.title||k||D,C=!v.title&&(!!k||!!D),N=v.meta||[],F=new Set(N.map((J)=>wt(J)).filter(Boolean)),q={...w,...T&&{title:T},meta:[...(w.meta||[]).filter((J)=>!F.has(wt(J))),...N],link:[...w.link||[],...v.link||[]],script:[...w.script||[],...v.script||[]],headRaw:[w.headRaw,x].filter(Boolean).join(`
|
|
1442
|
+
`),...v.htmlAttrs&&{htmlAttrs:Dl(w.htmlAttrs,v.htmlAttrs)},...v.bodyAttrs&&{bodyAttrs:{...w.bodyAttrs||{},...v.bodyAttrs}}},V=na(p);if(p=Xr(p,q,{...C&&{titleIsHtml:!0},...a.app?.colorMode&&{colorMode:a.app.colorMode}},V),V)p=jl(p,w),p=Kr(p,q.htmlAttrs);let H=p.match(/<!-- stx-layout: ([^ ]+) -->/);if(H&&p.includes("<head")){let J=H[1],de=Cn(J);p=p.replace(/<head\b[^>]*>/i,(G)=>`${G}
|
|
1362
1443
|
<meta name="stx-layout" content="${vr(J)}">
|
|
1363
|
-
<meta name="stx-layout-group" content="${vr(de)}">`)}let B=p.match(/function (__stx_setup_\w+)\(/),
|
|
1364
|
-
${v}`).join(""))}else{let y=await
|
|
1365
|
-
`+p.slice(v)}}if(t)p=
|
|
1444
|
+
<meta name="stx-layout-group" content="${vr(de)}">`)}let B=p.match(/function (__stx_setup_\w+)\(/),U=B?W(p):null;if(B&&U&&!/\bdata-stx=/.test(U.tag)){p=ut(p,(de,G)=>`<body${G} data-stx="${B[1]}">`);let J=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${B[1]}"`,"i");p=p.replace(J,"$1")}}if(t){let w=e.__stx_head_injections??ta(),y=Ll(p);if(y!==null)w.beforeClose.push(y);let v=dr(p);if(v!==null)w.afterOpen.push(v);let x=a.offline;if(x?.enabled&&!p.includes("data-stx-offline"))w.beforeClose.push(fr(x));p=Nl(p,w);let k=a.app?.colorMode;if(k)p=qr(p,k)}if(t)if(Rr(p,"data-stx-runtime")){let y=await ps(p,a,h,e);p=ms(p,y.map((v)=>`
|
|
1445
|
+
${v}`).join(""))}else{let y=await br([p],a,h);if(y){let v=p.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(v!==-1)p=p.slice(0,v)+y+`
|
|
1446
|
+
`+p.slice(v)}}if(t)p=Ml(p);if(t&&e.__stx_inject_css!==!1)p=await S(p,void 0,a.buildMode==="serve",!0);else if(t)p=Rn(p);if(t)p=xt(p);if(p=p.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),p=hs(p),t&&e.__stx_runtime_config)p=Jt(p,e.__stx_runtime_config);if(t&&!e.__stx_defer_server_data){let w=zr(e);if(w){let y=/<head\b[^>]*>/i.exec(p),v=y?y.index+y[0].length:0;p=p.slice(0,v)+w+p.slice(v)}}return t?vt(p):p})}catch(p){if(p instanceof te)throw p;let w=p instanceof Error?p.message:String(p),y=new ce(`Template processing failed: ${w}`,l,void 0,void 0,r.substring(0,200)+(r.length>200?"...":""));if(K.log(y,{filePath:l,context:e}),jn.logDetailedError(y,{filePath:l,template:r.substring(0,500)}),I()&&!a.debug)console.error(`[stx] ${le.relative(process.cwd(),l)||l}: ${y.message}`);if(a.debug)throw y;return Qi.createFallbackContent("Template Processing",y)}}async function ys(r,e,l,a,h){let t=process.cwd(),p={...a,partialsDir:a.partialsDir&&!le.isAbsolute(a.partialsDir)?le.resolve(t,a.partialsDir):a.partialsDir,componentsDir:a.componentsDir&&!le.isAbsolute(a.componentsDir)?le.resolve(t,a.componentsDir):a.componentsDir,layoutsDir:a.layoutsDir&&!le.isAbsolute(a.layoutsDir)?le.resolve(t,a.layoutsDir):a.layoutsDir},w=p,y=r;await vs(l,e),ws(e,w),y=await De(()=>er(y,e,l,w),y,(H)=>{K.log(H,{filePath:l,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${l}: ${H.message}`)}),y=y.replace(/\{\{--[\s\S]*?--\}\}/g,"");let v=ke(y,Xe,(H,B)=>`\x00STX_HTML_COMMENT_${B}\x00`);y=v.output;let x=v.tokens,k=(H)=>x.length===0?H:H.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(B,U)=>x[Number(U)]??""),_="\x00STX_ESCAPED_AT\x00",E="\x00STX_ESC_MUSTACHE_OPEN\x00",D="\x00STX_ESC_MUSTACHE_CLOSE\x00";y=y.replace(/@@/g,_),y=y.replace(/@\{\{([\s\S]*?)\}\}/g,(H,B)=>`${E}${B}${D}`),y=ir(y),y=await yr(y,l,h);let T={};y=$s(y,T);let C={...e.__sections||{}},N="",F=Tt(Pt(r)),q=/@nolayout\b/.test(y)||F===!1;if(/@nolayout\b/.test(y))y=y.replace(/@nolayout\b\s*/g,"");let V=y.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(V)N=V[1],y=y.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof F==="string"){if(N=F,!/@section\s*\(/.test(y))y=`@section('content')
|
|
1366
1447
|
${y.trim()}
|
|
1367
|
-
@endsection`}if(!N&&!
|
|
1448
|
+
@endsection`}if(!N&&!q&&w.defaultLayout){let H=Bn(y),B=/@section\s*\(/.test(y);if(!H||B){let U="",J=le.dirname(l),de=w.layoutsDir?le.dirname(w.layoutsDir):process.cwd();for(let G=0;G<20;G++){let pe=le.join(J,"_layout.stx");if(await s(pe)){U=pe;break}let ue=le.dirname(J);if(ue===J||ue.length<de.length)break;J=ue}if(U)N=U;else if(w.layoutsDir){let G=le.isAbsolute(w.layoutsDir)?w.layoutsDir:le.resolve(process.cwd(),w.layoutsDir),pe=le.join(G,`${w.defaultLayout}.stx`);if(await s(pe))N=pe}if(N&&!B)y=`@section('content')
|
|
1368
1449
|
${y.trim()}
|
|
1369
|
-
@endsection`}}if(N&&y.includes("<script")){let H=se(y),B=H.scripts.map((
|
|
1450
|
+
@endsection`}}if(N&&y.includes("<script")){let H=se(y),B=H.scripts.map((U)=>kr(U,l)??U);y=Dr(H.output,B)}if(y=y.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(H,B,U)=>(C[B]=U,"")),y=y.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(H,B,U)=>{if(/^(['"]).*\1$/.test(U.trim()))return H;try{let J=d(U.trim(),e);if(J===void 0)return H;let G=(e.__stx_inline_section_values??=[]).push(J)-1;return C[B]=`{{ __stx_inline_section_values[${G}] }}`,""}catch{return H}}),y=y.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(H,B,U)=>{if(U.includes("@parent"))C[B]=U.replace("@parent",Re);else C[B]=U.trim();return""}),e.__sections=C,y=y.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(H,B,U)=>C[B]||U||""),!("slot"in e)||e.slot===void 0)y=y.replace(/\{\{\s*slot\s*\}\}/g,()=>C.content||"");if(y=Rs(y,T),N){let H=[],B=se(y),U=ke(B.output,Tn,(J,de)=>`\x00STX_ORPHAN_STYLE_${de}\x00`);if(y=U.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(J,de,G)=>{let pe=de==="SCRIPT"?kr(B.scripts[Number(G)],l):U.tokens[Number(G)];if(pe)H.push(pe);return""}),H.length>0){let J=H.join(`
|
|
1370
1451
|
`);C.content=C.content?`${C.content}
|
|
1371
|
-
${J}`:J,e.__sections=C}}if(N)try{let H;if(le.isAbsolute(N))H=N,h.add(N);else H=await
|
|
1372
|
-
${y}`,k(y)}catch(H){if(H instanceof te)throw H;throw new ce(`Error processing layout ${N}: ${H instanceof Error?H.message:String(H)}`,l)}return k(await
|
|
1373
|
-
`;if(t=G(t,e),t=pe(t,e,l),t=rr(t),t=
|
|
1452
|
+
${J}`:J,e.__sections=C}}if(N)try{let H;if(le.isAbsolute(N))H=N,h.add(N);else H=await De(()=>On(N,l,p,h),null,()=>{throw new ce(`Failed to resolve layout path: ${N}`,l,void 0,void 0,`Layout referenced from ${l}`)});if(!H){let ue=(Q)=>{if(!Q)return[];try{let xe=le.isAbsolute(Q)?Q:le.resolve(process.cwd(),Q);return ls.readdirSync(xe).filter(($e)=>$e.endsWith(".stx")).map(($e)=>$e.replace(/\.stx$/,""))}catch{return[]}},ne=[...ue(p.layoutsDir),...ue(p.fallbackLayoutsDir)].filter((Q,xe,$e)=>$e.indexOf(Q)===xe).sort(),ve=[p.layoutsDir,p.fallbackLayoutsDir].filter((Q)=>typeof Q==="string"&&Q.length>0),me=ve.length>0?` Searched: ${ve.join(", ")} (set \`layoutsDir\` to look elsewhere).`:"",ie=`Layout not found: ${N} (referenced from ${l})`+(ne.length>0?`. Available layouts: ${ne.join(", ")}`:p.layoutsDir?`. No .stx layouts found in ${p.layoutsDir}`:"")+me;if(K.log(Error(ie),{layoutPath:N,filePath:l,available:ne},"error"),console.error(`[stx] ${ie}`),p.debug)throw new ce(ie,l);return y}let B=await De(()=>Bun.file(H).text(),"",()=>{throw new ce(`Failed to read layout file: ${H}`,l,void 0,void 0,"Layout content could not be loaded")});B=wr(B,H),B=B.replace(/\{\{--[\s\S]*?--\}\}/g,"");let U=Array.isArray(e.__layoutChain)?e.__layoutChain:[];if(U.includes(H)){let ue=[...U.slice(U.indexOf(H)),H];throw new ce(ue.length===2?`Circular layout: ${H} extends itself`:`Circular layout: ${ue.join(" -> ")}`,l,void 0,void 0,"Remove the @extends or @layout line that points back at a layout already in use")}let J=B.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(J){if(p.debug)console.log(`Found nested layout: ${J[1]} in ${H}`);let ue={},ne=B.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ie,Q,xe)=>(ue[Q]=xe.trim(),""));for(let[ie,Q]of Object.entries(ue))if(C[ie]&&C[ie].includes(Re)){let xe=C[ie].indexOf(Re);C[ie]=C[ie].slice(0,xe)+Q+C[ie].slice(xe+Re.length)}else if(!C[ie])C[ie]=Q;let ve={...e,__sections:C,__layoutChain:[...U,H]},me=`@layout('${J[1]}')${ne}`;return await i(me,ve,H,p,h)}let de=B.replace(/\{\{--[\s\S]*?--\}\}/g,""),G=$s(de,T),pe={};return G=G.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ue,ne,ve)=>(pe[ne]=ve.trim(),`@slot('${ne}')`)),G=G.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(ue,ne,ve)=>{if(C[ne]){let me=C[ne];if(me.includes(Re)){let ie=pe[ne]||"",Q=me.indexOf(Re);me=me.slice(0,Q)+ie+me.slice(Q+Re.length)}return me}return ve||""}),G=bs(G,C),G=G.replace(/\{\{\s*slot\s*\}\}/g,()=>C.content||""),G=Rs(G,T),e.__originalFilePath=l,y=await Ar(G,e,H,p,h),y=`<!-- stx-layout: ${N} -->
|
|
1453
|
+
${y}`,k(y)}catch(H){if(H instanceof te)throw H;throw new ce(`Error processing layout ${N}: ${H instanceof Error?H.message:String(H)}`,l)}return k(await Ar(y,e,l,p,h))}function bs(r,e){return r.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(l,a,h)=>{let t=e[a];if(t!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(t))return t}return h||""})}function ws(r,e){if(r.__stx_sfc_mode=!0,r.__stx_options=e,e.buildMode)r.__stx_buildMode=e.buildMode;let l=e.envPrefix||"STX_PUBLIC_",a={};for(let[h,t]of Object.entries(process.env))if(h.startsWith(l)&&t!==void 0)a[h]=t;r.$env=a}async function vs(r,e){await De(()=>nr(r,e),void 0,(l)=>{K.log(l,{filePath:r,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${r}: ${l.message}`)})}var ht="data-stx-source";function kr(r,e){if(!r)return r;let l=/^<script\b([^>]*)>/i.exec(r);if(!l||!/\bserver\b/.test(l[1])||l[1].includes(ht))return r;return`<script ${ht}="${encodeURIComponent(e)}"${r.slice(7)}`}function xs(r){let e=new RegExp(`${ht}="([^"]*)"`).exec(r);return e?decodeURIComponent(e[1]):void 0}function Er(r){return r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Tr(r,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">${Er(r)}</span><span style="display:block;margin-top:4px">${Er(l)}</span></div>`}async function Ss(r,e,l,a){let{scanScriptTags:h}=await o("stx/signal-processing",()=>import("./chunk-ta5fpj2a.js")),t=[],p=!I()&&!Fn();for(let y of h(r)){let v=y.attrs;if(!/\bserver\b/.test(v))continue;let x=y.start+y.fullMatch.indexOf(">")+1,k=Mr(r,x);if(k===-1)continue;let _=r.slice(x,k);if(!_.trim())continue;let E=xs(v)??l,D={index:y.start,length:k+9-y.start};try{let{extractVariables:T}=await o("stx/variable-extractor",()=>import("./chunk-gjnxnfrg.js"));await T(_,e,E,{preserveExisting:!0,onFailure:(C)=>{if(C.kind==="unknown")return;if(a?.onServerScriptError?.({sourcePath:E,kind:C.kind,message:C.message}),!p)return;t.push({...D,markup:Tr(E,C.kind,C.message)})}})}catch(T){let C=T instanceof Error?T:Error(String(T));if(K.log(C,{filePath:E,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${E}: ${C.message}`),p)t.push({...D,markup:Tr(E,"unknown",C.message)})}}if(t.length===0)return r;let w=r;for(let y of t.sort((v,x)=>x.index-v.index))w=w.slice(0,y.index)+y.markup+w.slice(y.index+y.length);return w}async function ks(r,e,l){try{let{interpolateScriptsInTemplate:a}=await o("stx/expressions",()=>import("./chunk-96wdxfn4.js"));return a(r,e,{skipServer:!0})}catch(a){let h=a instanceof Error?a:Error(String(a));return K.log(h,{filePath:l,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${l}: ${h.message}`),r}}async function Ar(r,e,l,a,h){let t=r;await R();let p=a;if(t=await Ss(t,e,l,a),t=await zt(t,e,l),t=await Kt(t,e,l),t=await ks(t,e,l),await R(),t=await Nt(t,e,l,p),Me(t))t=mi(t,e),t=Ds(t,e),t=Ms(t,e);t=hi(t),await R();let{processStreamDirectives:w}=await o("stx/streaming",()=>import("./chunk-4b9jx2c1.js"));t=w(t,e),t=await ui(t,e,l,p,!0),await R(),t=await ur(t,e,l,p,h),t=await Ps(t,e,l,p,h),await R(),t=Hc(t,e,l,p);let{processDeferDirectives:y}=await o("stx/defer",()=>import("./chunk-n62nqhey.js"));t=y(t,e,l);let{processTeleportDirectives:v}=await o("stx/teleport",()=>import("./chunk-2fyey6pn.js"));t=v(t,e,l);let{processTransitionDirectives:x,processTransitionAttributes:k}=await o("stx/transitions",()=>import("./chunk-c60egpe6.js"));t=x(t,e,l),t=k(t);let{processErrorBoundaryDirectives:_,stripRenderFailedMarkers:E}=await o("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));t=_(t,e,l),t=E(t);let{processSuspenseDirectives:D}=await o("stx/suspense",()=>import("./chunk-fzh73jtc.js"));t=D(t,e,l);let{processAsyncDirectives:T}=await o("stx/async-components",()=>import("./chunk-jnk3nk5k.js"));t=T(t,e,l);let{processKeepAliveDirectives:C}=await o("stx/keep-alive",()=>import("./chunk-7k1thytm.js"));t=C(t,e,l);let{processVirtualListDirectives:N,processVirtualGridDirectives:F,processInfiniteListDirectives:q}=await o("stx/virtual-scrolling",()=>import("./chunk-x1svtz8k.js"));t=N(t,e,l),t=F(t,e,l),t=q(t,e,l),await R();let{processPartialHydrationDirectives:V,processStaticDirectives:H}=await o("stx/partial-hydration",()=>import("./chunk-mgcakk1m.js"));t=V(t,e,l),t=H(t);let{processComputedDirectives:B,processWatchDirectives:U}=await o("stx/computed",()=>import("./chunk-1xdzcy9d.js"));t=B(t,e,l),t=U(t,e,l);let{processFormValidationDirectives:J}=await o("stx/forms-validation",()=>import("./chunk-bcspywrd.js"));t=J(t,e,l);let{processHeadDirective:de,processTitleDirective:G,processMetaDirective:pe,resetHead:ue}=await o("stx/head",()=>import("./chunk-qjkpwjg6.js"));if(!e.__stx_head_preset&&!e.__stx_runtime_head)ue();let ne=de(t);if(t=ne.content,ne.headContent)e.__stx_head_raw=`${e.__stx_head_raw||""}${ne.headContent}
|
|
1454
|
+
`;if(t=G(t,e),t=pe(t,e,l),t=rr(t),t=di(t,e),t=jt(t),t=Qt(t),t=await Ts(t,e,l,p,h),t=await Ps(t,e,l,p,h),await R(),t=t.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),t=Hi(t),t=ge(t,e,l),t=Is(t),await R(),e.__stxProcessingDepth===1)t=xl(t,e);if(t=ml(t,e,{filePath:l,buildMode:p.buildMode}),t=pi(t,e),t=fi(t,e),t=et(t,e),t=Vt(t,e),t=Xt(t,e),t=await Ct(t,e,l,p),t=await Vc(t,e,l),t=await qc(t,e,l,p),await R(),t=Kc(t,e,l,p),t=ki(t,e,l,p),t=_i(t,e,l),t=Ci(t,e,l,p),t=Ot(t,e,l,p),t=lo(t,e),t=uo(t),t=yl(t),!p.skipEventDirectives)t=ol(t,e,l);if(t=hl(t,e,l,a.skipSignalsRuntime===!0&&Number(e.__stxProcessingDepth)>0),await R(),p.debug){let X=/\bx-data\s*=/.test(t),z=Ns(r);if(X&&z)console.warn(`[stx] ${l}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
1374
1455
|
Both work on the same page, but they manage separate scopes.
|
|
1375
|
-
Prefer signals (state/derived/effect) for new components.`)}t=
|
|
1456
|
+
Prefer signals (state/derived/effect) for new components.`)}t=Lc(t,e),t=await Gi(t,e,l),await R(),t=bl(t),t=wl(t),t=$t(t);let{processXElementDirectives:ve}=await o("stx/x-element",()=>import("./chunk-va4xam1q.js"));t=ve(t);let me=e.__originalFilePath||l,ie=Ge(e);if(t=await yi(t,p,me,ie),await R(),t=Ut(t,e),t=await tr(t,e,l,p),await R(),p.media?.image?.autoSiblings){let X=p.publicDir||"public",{rewriteImagesWithSiblings:z}=await o("stx/image-optimization/auto-sibling",()=>import("./chunk-abxwggen.js"));t=await z(t,{publicDir:X})}if(p.seo?.enabled)t=Ei(t,e,p);let Q=(X,z,ee=!0)=>{if(!z)return X;let be=z.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),oe=/<head\b[^>]*>[\s\S]*?(?:<\/head\s*>|<body\b|$)/i.exec(X),he=oe?/<title\b[^>]*>[\s\S]*?<\/title>/i.exec(oe[0]):null;if(be&&oe&&he){if(ee){let Ie=oe.index+he.index;X=X.slice(0,Ie)+be[0]+X.slice(Ie+he[0].length)}if(z=z.replace(be[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
|
|
1376
1457
|
${z}`);if(/<html\b[^>]*>/i.test(X))return X.replace(/(<html\b[^>]*>)/i,`$1
|
|
1377
1458
|
<head>
|
|
1378
1459
|
${z}
|
|
1379
|
-
</head>`);return X},{renderHead:xe,getHead:$e}=await o("stx/head",()=>import("./chunk-
|
|
1460
|
+
</head>`);return X},{renderHead:xe,getHead:$e}=await o("stx/head",()=>import("./chunk-qjkpwjg6.js")),He=e.__stx_runtime_head??$e();if(He.title||He.meta?.length||He.link?.length){let X=xe(He);if(X)t=Q(t,X)}if(ne.headContent)t=Q(t,ne.headContent,!He.title);if(p.csp?.enabled&&p.csp.addMetaTag)t=Dt(t,p.csp,e);if(p.analytics?.enabled)t=Et(t,p);if(p.heatmap?.enabled)t=Uc(t,p);if(p.pwa?.enabled&&p.pwa.autoInject!==!1){let{injectPwaTags:X}=await o("stx/pwa/inject",()=>import("./chunk-asewbsct.js"));t=X(t,p)}let Ir=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(t),Or=/\bSTX\.\w+/.test(t),Lr=/window\.STX\s*=/.test(t);if(Ir&&Or&&!Lr){let z=`<script data-stx-scoped data-stx-run="once">
|
|
1380
1461
|
${St()}
|
|
1381
1462
|
</script>`;if(t.includes("</head>")){let ee=L(t),oe=t.slice(0,ee).indexOf("<script");if(oe!==-1){let he=t.slice(0,oe),Ie=t.slice(oe);t=he+z+`
|
|
1382
1463
|
`+Ie}else t=f(t,z)}else if(t.includes("<body"))t=t.replace(/<body([^>]*)>/,`<body$1>
|
|
1383
1464
|
${z}`);else t=z+`
|
|
1384
|
-
`+t}{let{scanScriptTags:X}=await o("stx/signal-processing",()=>import("./chunk-
|
|
1385
|
-
`+t.slice(ee)}e.__stx_event_bindings=[]}}if(!p.skipSignalsRuntime&&!
|
|
1386
|
-
export{Pt,
|
|
1465
|
+
`+t}{let{scanScriptTags:X}=await o("stx/signal-processing",()=>import("./chunk-ta5fpj2a.js")),z=[];for(let ee of X(t)){if(!/\bserver\b/i.test(ee.attrs))continue;let be=ee.start+ee.fullMatch.indexOf(">")+1,oe=Mr(t,be);if(oe===-1)continue;let he=oe+9;while(he<t.length&&/\s/.test(t[he]))he++;z.push({start:ee.start,end:he})}if(z.length>0){let ee=Array(z.length+1),be=0;for(let oe=0;oe<z.length;oe++){let{start:he,end:Ie}=z[oe];ee[oe]=t.slice(be,he),be=Ie}ee[z.length]=t.slice(be),t=ee.join("")}}let yt=ao(t,l);if(yt.hasScoped)t=yt.html;let jr=e.__stx_event_bindings||[],rt=!1,bt=[],Nr=/\s:[a-z][\w.-]*\s*=/.test(t),{scanScriptTags:Hr}=await o("stx/signal-processing",()=>import("./chunk-ta5fpj2a.js"));for(let X of Hr(t,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))bt.push({match:X.fullMatch,attrs:X.attrs,content:X.body});for(let{match:X,attrs:z,content:ee}of bt){rt=!0;let be=ee;Ke(ee,l,a.strict,e.__originalFilePath);let oe=await Je(ee,{eventBindings:jr,attrs:z,hasColonDirectives:Nr,templateContent:r,filePath:l,projectRoot:process.cwd(),production:sa(a.buildMode,a.minifyClient),serverData:ie});t=t.replace(X,()=>oe)}if(rt)e.__stx_event_bindings=[];if(!rt&&e.__stxProcessingDepth===1){let X=e.__stx_event_bindings||[];if(X.length>0){let z=Mi(X);if(z){let ee=c(t);t=ee===-1?t+z:t.slice(0,ee)+z+`
|
|
1466
|
+
`+t.slice(ee)}e.__stx_event_bindings=[]}}if(!p.skipSignalsRuntime&&!Ae(t)&&Bc(t))t=await Cr(t,p);if(t=Fc(t),p.csp?.enabled&&p.csp.useNonce&&typeof e.cspNonce==="string")t=It(t,e.cspNonce);return t}
|
|
1467
|
+
export{Pt,Ue,Oc,Es,si,oi,br,i};
|