@stacksjs/stx 0.2.837 → 0.2.839
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/builtins/image-delivery.js +7 -3
- package/dist/chunk-02cntwd8.js +2 -0
- package/dist/chunk-07hvjvj1.js +2 -0
- package/dist/{chunk-gh62p9mx.js → chunk-11y84h2d.js} +2 -2
- package/dist/{chunk-3bjnrmha.js → chunk-1b1ntgt7.js} +2 -2
- package/dist/{chunk-z25w7kmr.js → chunk-1m16mvt4.js} +4 -4
- package/dist/{chunk-rj68w7em.js → chunk-1zfxmjrf.js} +55 -55
- package/dist/{chunk-4ntm3dtk.js → chunk-23r3rby6.js} +2 -2
- package/dist/chunk-23zzbsms.js +2 -0
- package/dist/{chunk-ya6bp08c.js → chunk-2fj5zev7.js} +1 -1
- package/dist/{chunk-29f6vmyz.js → chunk-2j5yane9.js} +4 -4
- package/dist/chunk-2pgc087j.js +2 -0
- package/dist/{chunk-yeg4cahs.js → chunk-31cnrpd1.js} +9 -9
- package/dist/{chunk-ac9ncbfw.js → chunk-321e41ck.js} +3 -3
- package/dist/{chunk-hrcpq9k1.js → chunk-3tydmgwh.js} +5 -5
- package/dist/chunk-41sh9y5w.js +2 -0
- package/dist/chunk-4654xm1h.js +2 -0
- package/dist/{chunk-amg6kr1p.js → chunk-4657mnht.js} +4 -4
- package/dist/{chunk-s33andzg.js → chunk-4dxq7ft1.js} +2 -2
- package/dist/chunk-4eagsz5d.js +2 -0
- package/dist/{chunk-f7jgda7x.js → chunk-4j08cbjd.js} +5 -5
- package/dist/{chunk-ykyf7513.js → chunk-4w3qpewn.js} +3 -3
- package/dist/{chunk-tx8wk6h7.js → chunk-4y6hes3h.js} +2 -2
- package/dist/chunk-53j9wakh.js +2 -0
- package/dist/{chunk-j97zjjkh.js → chunk-5hmm01av.js} +5 -5
- package/dist/chunk-5t93dqft.js +2 -0
- package/dist/{chunk-2x9zhezb.js → chunk-6wrf6302.js} +2 -2
- package/dist/chunk-78nsbzcm.js +2 -0
- package/dist/{chunk-vpnyqf0h.js → chunk-7cg2f588.js} +4 -4
- package/dist/chunk-7ka7pvj9.js +2 -0
- package/dist/chunk-7m0r7mq9.js +2 -0
- package/dist/chunk-7mz6ze0x.js +2 -0
- package/dist/{chunk-ckg6q98b.js → chunk-7t57cnz9.js} +5 -5
- package/dist/chunk-7t9951at.js +2 -0
- package/dist/{chunk-jr0r5pzw.js → chunk-7vhm0jj5.js} +2 -2
- package/dist/{chunk-vfj9wp11.js → chunk-8370x30n.js} +2 -2
- package/dist/chunk-8913k8g7.js +3 -0
- package/dist/{chunk-txd2js5v.js → chunk-89d3h8mp.js} +14 -14
- package/dist/chunk-8byydry7.js +2 -0
- package/dist/chunk-8c363c2r.js +2 -0
- package/dist/chunk-8em568fw.js +2 -0
- package/dist/{chunk-n0zdxcfh.js → chunk-8h0pnn5p.js} +6 -6
- package/dist/{chunk-em8tv6nz.js → chunk-8pj4v1eh.js} +2 -2
- package/dist/{chunk-8z1p3mag.js → chunk-8q3pyq6a.js} +3 -3
- package/dist/{chunk-z0ynyz62.js → chunk-8qbp5skx.js} +7 -7
- package/dist/chunk-8w0n2rae.js +2 -0
- package/dist/{chunk-9snk4mzf.js → chunk-8y3f5fyg.js} +6 -6
- package/dist/chunk-8z3yjex0.js +2 -0
- package/dist/chunk-8zzepd7g.js +2 -0
- package/dist/{chunk-c3dg8qdn.js → chunk-97k72dfh.js} +2 -2
- package/dist/chunk-98258444.js +2 -0
- package/dist/{chunk-s53wjw7y.js → chunk-9xps62ek.js} +2 -2
- package/dist/{chunk-52g026sc.js → chunk-a1s5wqw4.js} +2 -2
- package/dist/{chunk-myje6fhm.js → chunk-a9tzjqny.js} +5 -5
- package/dist/{chunk-ztkd6mxj.js → chunk-aekq1zyn.js} +6 -6
- package/dist/chunk-aywvbcae.js +2 -0
- package/dist/chunk-aza2zrhk.js +54 -0
- package/dist/chunk-b0fkvrat.js +2 -0
- package/dist/chunk-b6w3457c.js +2 -0
- package/dist/{chunk-fvgk1w9s.js → chunk-bp918end.js} +2 -2
- package/dist/chunk-bq7qcndg.js +3 -0
- package/dist/chunk-c18pafmf.js +3 -0
- package/dist/chunk-c2v38ghp.js +2 -0
- package/dist/{chunk-c9vxm8yq.js → chunk-ca3c5qx2.js} +31 -31
- package/dist/chunk-cax1wts7.js +2 -0
- package/dist/{chunk-vkynagtn.js → chunk-cw1ar3dq.js} +4 -4
- package/dist/{chunk-bky02g7k.js → chunk-d0dzzpfx.js} +2 -2
- package/dist/{chunk-sz88tmbm.js → chunk-d1vkjxb1.js} +5 -5
- package/dist/chunk-d2mdh669.js +2 -0
- package/dist/chunk-d44g9sek.js +2 -0
- package/dist/chunk-d5vr9g4b.js +2 -0
- package/dist/{chunk-yw1s8kyj.js → chunk-dgn87554.js} +4 -4
- package/dist/{chunk-8q7ah3ct.js → chunk-efdfkfp1.js} +3 -3
- package/dist/{chunk-33czswpt.js → chunk-f1hkagxk.js} +3 -3
- package/dist/chunk-f69cmsz9.js +2 -0
- package/dist/{chunk-55e46spy.js → chunk-g7rsd8st.js} +5 -5
- package/dist/chunk-gaxx0z19.js +2 -0
- package/dist/chunk-gft9pg9n.js +2 -0
- package/dist/{chunk-3y9jtfzr.js → chunk-gpschnvk.js} +12 -12
- package/dist/chunk-h8h79939.js +2 -0
- package/dist/{chunk-q5pwvr98.js → chunk-jc5y35b7.js} +1 -1
- package/dist/{chunk-3r65z9vs.js → chunk-jjyt3tsv.js} +2 -2
- package/dist/{chunk-q14j0wsq.js → chunk-jzh0n2ct.js} +9 -9
- package/dist/{chunk-vfxkn1pe.js → chunk-kd6r7z27.js} +3 -3
- package/dist/chunk-ksc83y9t.js +2 -0
- package/dist/{chunk-02kycznh.js → chunk-ksr6c2kh.js} +5 -5
- package/dist/{chunk-rnm8ejpz.js → chunk-m5bj2jnb.js} +2 -2
- package/dist/chunk-mad4g0yx.js +2 -0
- package/dist/{chunk-b7tb00nz.js → chunk-mhyd24bg.js} +2 -2
- package/dist/chunk-mtjt2z77.js +2 -0
- package/dist/{chunk-0psdpeq8.js → chunk-mv49hr9y.js} +1 -1
- package/dist/chunk-mzj71r0m.js +3 -0
- package/dist/chunk-n7pvz99f.js +2 -0
- package/dist/chunk-n8a4jm0p.js +3 -0
- package/dist/chunk-nb2tedk0.js +2 -0
- package/dist/chunk-ndyj1d0z.js +2 -0
- package/dist/{chunk-n4qznmkm.js → chunk-ngnr831a.js} +5 -5
- package/dist/chunk-nhk0aat9.js +2 -0
- package/dist/{chunk-vntth7mg.js → chunk-nk7nxzxf.js} +2 -2
- package/dist/chunk-np6h1ct6.js +2 -0
- package/dist/{chunk-50w73wey.js → chunk-nsnzgdjt.js} +1 -1
- package/dist/{chunk-7y78ffds.js → chunk-p83h2dbg.js} +52 -52
- package/dist/{chunk-dv11h4f0.js → chunk-p9d2txcg.js} +1 -1
- package/dist/chunk-phxkmjnw.js +2 -0
- package/dist/chunk-pjkdn8zf.js +2 -0
- package/dist/{chunk-64b0yzrm.js → chunk-pqg6j26p.js} +3 -3
- package/dist/{chunk-xtqapjz3.js → chunk-q0s0kc66.js} +2 -2
- package/dist/chunk-q88w2rv9.js +2 -0
- package/dist/{chunk-v3xyb3ws.js → chunk-qfvddpcg.js} +2 -2
- package/dist/{chunk-e75dntfb.js → chunk-qk079ca7.js} +2 -2
- package/dist/{chunk-a40hrcq2.js → chunk-r0ssa1xd.js} +2 -2
- package/dist/chunk-r5bhgyes.js +2 -0
- package/dist/chunk-rdn1d4bf.js +42 -0
- package/dist/{chunk-7bvvv74e.js → chunk-rk2ex6qx.js} +3 -3
- package/dist/chunk-rmc6dfj4.js +2 -0
- package/dist/chunk-rsn9rh07.js +2 -0
- package/dist/chunk-rt29w5ns.js +2 -0
- package/dist/chunk-ryrdx5mw.js +2 -0
- package/dist/chunk-rzfbffnv.js +2 -0
- package/dist/chunk-s85chp3w.js +2 -0
- package/dist/chunk-s92f8w68.js +2 -0
- package/dist/chunk-sm9f980t.js +2 -0
- package/dist/chunk-st75663x.js +2 -0
- package/dist/chunk-sv2d6nfe.js +2 -0
- package/dist/{chunk-7k9yahng.js → chunk-t0jed809.js} +6 -6
- package/dist/{chunk-s5dhvnnd.js → chunk-t3p0jy0s.js} +6 -6
- package/dist/{chunk-f49x34sr.js → chunk-v3q126ys.js} +2 -2
- package/dist/{chunk-ees0kc6z.js → chunk-v49rvx9y.js} +114 -114
- package/dist/{chunk-kw5gra2z.js → chunk-v4ybemgb.js} +2 -2
- package/dist/chunk-vcx6dy59.js +2 -0
- package/dist/{chunk-q3pw43jm.js → chunk-vr6qa0g2.js} +14 -14
- package/dist/chunk-w5h67xec.js +2 -0
- package/dist/{chunk-vyv76w55.js → chunk-wbgc2n04.js} +2 -2
- package/dist/{chunk-p5r2p459.js → chunk-whmqfr3y.js} +6 -6
- package/dist/{chunk-nyg0nbjj.js → chunk-x110ssw2.js} +3 -3
- package/dist/{chunk-fwktw49p.js → chunk-x4f7efgp.js} +6 -6
- package/dist/chunk-x5wkbcsf.js +2 -0
- package/dist/{chunk-w0a6yz73.js → chunk-xbcnnk8x.js} +5 -5
- package/dist/{chunk-84nw3921.js → chunk-xmsf1bnx.js} +3 -3
- package/dist/{chunk-af50ebx1.js → chunk-xvhxxj4g.js} +92 -92
- package/dist/{chunk-dhdezdt2.js → chunk-xx3reejx.js} +2 -2
- package/dist/chunk-y64qhgv1.js +2 -0
- package/dist/{chunk-52t0qpx6.js → chunk-y68xstqy.js} +1 -1
- package/dist/chunk-yg5a54pj.js +2 -0
- package/dist/chunk-yjskeqaj.js +2 -0
- package/dist/{chunk-qmqc9p98.js → chunk-yn17484y.js} +6 -6
- package/dist/{chunk-dc0cde6n.js → chunk-ynf16yz4.js} +3 -3
- package/dist/chunk-yxqzarzh.js +2 -0
- package/dist/chunk-z4g64re8.js +3 -0
- package/dist/{chunk-ms3v5nat.js → chunk-zg44cf8a.js} +7 -7
- package/dist/{chunk-s6r54dyf.js → chunk-zjqvbcwa.js} +2 -2
- package/dist/{chunk-0rvntfhj.js → chunk-zvy88beh.js} +3 -3
- package/dist/{chunk-ycf2qbmz.js → chunk-zyeg9t2t.js} +2 -2
- package/dist/cli.js +20 -20
- package/dist/compression.js +3 -3
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/dev-server/port-utils.js +2 -1
- package/dist/expressions.js +1 -1
- package/dist/html-masking.d.ts +2 -0
- package/dist/html-masking.js +23 -0
- package/dist/image-optimization/processor.js +2 -2
- package/dist/includes.js +5 -4
- package/dist/misc-directives.js +2 -2
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +16 -16
- package/dist/utils.js +37 -7
- package/package.json +5 -5
- package/dist/chunk-0a36jnq4.js +0 -2
- package/dist/chunk-0rnfywsx.js +0 -2
- package/dist/chunk-1bpx9b0m.js +0 -2
- package/dist/chunk-1n04yp1x.js +0 -2
- package/dist/chunk-205gzszh.js +0 -54
- package/dist/chunk-29ptxt2j.js +0 -2
- package/dist/chunk-2nxxhcyy.js +0 -2
- package/dist/chunk-3ahpedfv.js +0 -3
- package/dist/chunk-68f2xqw4.js +0 -2
- package/dist/chunk-6aak0b7c.js +0 -2
- package/dist/chunk-6cv4kv7w.js +0 -2
- package/dist/chunk-72n804gy.js +0 -2
- package/dist/chunk-7efkc3gk.js +0 -2
- package/dist/chunk-830s2hfc.js +0 -2
- package/dist/chunk-87599134.js +0 -2
- package/dist/chunk-91zpxwx0.js +0 -2
- package/dist/chunk-9w3r1ch2.js +0 -3
- package/dist/chunk-a1hxz8q4.js +0 -2
- package/dist/chunk-a4k7neqx.js +0 -2
- package/dist/chunk-a579jdwb.js +0 -2
- package/dist/chunk-ahd8jdzx.js +0 -2
- package/dist/chunk-ay7ggc4k.js +0 -2
- package/dist/chunk-bc4x45vx.js +0 -2
- package/dist/chunk-c7hw37ww.js +0 -2
- package/dist/chunk-ca8bj7ga.js +0 -2
- package/dist/chunk-cfrgrnej.js +0 -2
- package/dist/chunk-chcvz6y7.js +0 -42
- package/dist/chunk-cw8vpk41.js +0 -2
- package/dist/chunk-d75s3a90.js +0 -2
- package/dist/chunk-db1c0c3c.js +0 -2
- package/dist/chunk-dkh794nh.js +0 -2
- package/dist/chunk-f6vzn90z.js +0 -2
- package/dist/chunk-gcxtgezg.js +0 -2
- package/dist/chunk-gtj8wy95.js +0 -2
- package/dist/chunk-h4tbpr7p.js +0 -2
- package/dist/chunk-hjvv9dbw.js +0 -2
- package/dist/chunk-hqp6cj7g.js +0 -2
- package/dist/chunk-j0w048sj.js +0 -2
- package/dist/chunk-jd5e3s4e.js +0 -2
- package/dist/chunk-k761q7s7.js +0 -2
- package/dist/chunk-k79ftcxh.js +0 -2
- package/dist/chunk-m3tnxk01.js +0 -2
- package/dist/chunk-mad9bbcp.js +0 -2
- package/dist/chunk-mca71wrp.js +0 -2
- package/dist/chunk-mdtysd2d.js +0 -2
- package/dist/chunk-mjf4naae.js +0 -3
- package/dist/chunk-nmtya57z.js +0 -3
- package/dist/chunk-nxfyjw59.js +0 -2
- package/dist/chunk-pe5qqem0.js +0 -2
- package/dist/chunk-ptcvxx5v.js +0 -2
- package/dist/chunk-pvab0bq4.js +0 -2
- package/dist/chunk-pwv77cyb.js +0 -2
- package/dist/chunk-qaswy58a.js +0 -2
- package/dist/chunk-qgrhcg7f.js +0 -2
- package/dist/chunk-ra967vfn.js +0 -3
- package/dist/chunk-s3j5vxy9.js +0 -3
- package/dist/chunk-t612xpa4.js +0 -2
- package/dist/chunk-tesbhpbp.js +0 -2
- package/dist/chunk-tvw571ab.js +0 -2
- package/dist/chunk-txzap6yn.js +0 -2
- package/dist/chunk-vqpypnys.js +0 -2
- package/dist/chunk-w39cfxa6.js +0 -2
- package/dist/chunk-wrr61y84.js +0 -2
- package/dist/chunk-x50xn4w1.js +0 -2
- package/dist/chunk-xefcgvy6.js +0 -2
- package/dist/chunk-xhabjf42.js +0 -2
- package/dist/chunk-xrspzeqx.js +0 -2
- package/dist/chunk-y191vfqa.js +0 -2
- package/dist/chunk-y2sdtw2t.js +0 -2
- package/dist/chunk-zrrxw94h.js +0 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
`),y=[
|
|
4
|
-
`],m=c.start;for(let x of
|
|
2
|
+
import{Bt,ae,A,u,f,P,t,ce,K,l,_e,Ei,z,Cn,Ti,Ht,$i,al,Ar,cl,at,ll,Pr,ul,En,Ri,dl,Ir,Nr,Ce,Ai}from"./chunk-89d3h8mp.js";import{ui,Pc,o,C,Ne,gn,mn,Me,fe,J,xr,hn,zs,zc,Hc,bn,Er,Vs,Us,Vc,hi,Uc,Wc,qc,Kc,Le,je,Ws,ze,r,xn,h,p,W,Q,ke,_}from"./chunk-xvhxxj4g.js";import{jt}from"./chunk-8370x30n.js";import{kn}from"./chunk-jjyt3tsv.js";import{b}from"./chunk-31cnrpd1.js";import{hr,Is}from"./chunk-2j5yane9.js";import{mc,hc,fr,et,yc,O}from"./chunk-p83h2dbg.js";import{ti,ni,ri,si}from"./chunk-zg44cf8a.js";import{uc,ps}from"./chunk-rdn1d4bf.js";import{cs,ls,us}from"./chunk-aza2zrhk.js";import{hs,Ko,Xo,ys,bs,Go}from"./chunk-jzh0n2ct.js";import{gs,Ho}from"./chunk-4w3qpewn.js";import{jo}from"./chunk-4dxq7ft1.js";import{oe,Vo,Uo,Wo}from"./chunk-1b1ntgt7.js";import{lr,we,pc,ur,fc}from"./chunk-aekq1zyn.js";import{B,Ze}from"./chunk-ybq56wam.js";import{bc,wc}from"./chunk-efdfkfp1.js";import{E,Tn,Pi}from"./chunk-7vhm0jj5.js";import Kn from"fs";import ie from"path";function dt(s){let e=gn(s),c=e.find((x)=>x.closing&&x.name.toLowerCase()==="head");if(!c)return s;let a=new Set(["template","svg","noscript","math","textarea","title","xmp","iframe","noembed","noframes","plaintext"]),g=0,n=[];for(let x=0;x<e.length;x++){let w=e[x];if(w.start<c.end)continue;let v=w.name.toLowerCase();if(a.has(v)){g=Math.max(0,g+(w.closing?-1:w.selfClosing?0:1));continue}if(v!=="style"||w.closing||g>0)continue;let k=e[x+1];if(k?.name.toLowerCase()==="style"&&k.closing){if(/@scope\s*\{/.test(s.slice(w.end,k.start)))continue;n.push({start:w.start,end:k.end}),x++}}if(!n.length)return s;let d=n.map((x)=>s.slice(x.start,x.end)).join(`
|
|
3
|
+
`),y=[s.slice(0,c.start),d,`
|
|
4
|
+
`],m=c.start;for(let x of n)y.push(s.slice(m,x.start)),m=x.end;return y.push(s.slice(m)),y.join("")}function pt(){return`
|
|
5
5
|
// STX Lifecycle Runtime
|
|
6
6
|
(function() {
|
|
7
7
|
if (typeof window === 'undefined') return;
|
|
@@ -349,7 +349,7 @@ else {
|
|
|
349
349
|
|
|
350
350
|
console.log('[stx] Lifecycle runtime initialized');
|
|
351
351
|
})();
|
|
352
|
-
`}function Ge(
|
|
352
|
+
`}function Ge(s){return Symbol(s)}var xs=Ge("theme"),ks=Ge("router"),Ss=Ge("i18n");import*as gt from"crypto";function ft(s){let e=/\$(\w+)\./g,c=[],a;while((a=e.exec(s))!==null)if(!c.includes(a[1]))c.push(a[1]);return c}function Dr(){return`stx-${gt.randomBytes(4).toString("hex")}`}function Or(s){return/\$\w+\./.test(s)}function Lr(s){if(!/\{\{[^}]*\$\w/.test(s)||!/\$\w+\./.test(s))return{html:s,bindings:[],stores:new Set};let e=[],c=new Set,a=/<(\w+)([^>]*?)(\s*\/?>)/g,g=s;return g=g.replace(a,(n,d,y,m)=>{if(["script","style","template"].includes(d.toLowerCase()))return n;if(!y.includes("{{"))return n;let x=[],w=!1,v=y,k=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,S=[...y.matchAll(k)];for(let R of S){let D=R[0],j=R[1],N=R[2];if(Or(N)){w=!0;let F=N.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(F){let I=F[1];if(x.push({attr:j,expr:I,fullMatch:D,originalAttr:j}),ft(I).forEach((H)=>c.add(H)),j==="text")v=v.replace(D,"");else if(j==="class")v=v.replace(D,'class=""');else if(j==="disabled"||j==="hidden")v=v.replace(D,"");else v=v.replace(D,`${j}=""`)}}}if(!w)return n;let M=v.match(/\bid\s*=\s*"([^"]+)"/),T;if(M)T=M[1];else T=Dr(),v=` id="${T}"${v}`;for(let R of x)e.push({elementId:T,attribute:R.attr,expression:R.expr,stores:ft(R.expr)});return`<${d}${v}${m}`}),{html:g,bindings:e,stores:c}}function jr(s,e){if(s.length===0)return"";let c=Array.from(e),a=`
|
|
353
353
|
<script>
|
|
354
354
|
(function() {
|
|
355
355
|
'use strict';
|
|
@@ -369,8 +369,8 @@ else {
|
|
|
369
369
|
`;a+=`
|
|
370
370
|
// Binding update functions
|
|
371
371
|
function updateBindings() {
|
|
372
|
-
`;for(let g of
|
|
373
|
-
var el = document.getElementById('${
|
|
372
|
+
`;for(let g of s){let{elementId:n,attribute:d,expression:y}=g,m=y.replace(/\$(\w+)\./g,"$state.$1.");if(d==="text")a+=` (function() {
|
|
373
|
+
var el = document.getElementById('${n}');
|
|
374
374
|
if (el) {
|
|
375
375
|
try {
|
|
376
376
|
el.textContent = ${m};
|
|
@@ -379,7 +379,7 @@ catch (e) { console.error('Binding error:', e); }
|
|
|
379
379
|
}
|
|
380
380
|
})();
|
|
381
381
|
`;else if(d==="html")a+=` (function() {
|
|
382
|
-
var el = document.getElementById('${
|
|
382
|
+
var el = document.getElementById('${n}');
|
|
383
383
|
if (el) {
|
|
384
384
|
try {
|
|
385
385
|
el.innerHTML = ${m};
|
|
@@ -388,7 +388,7 @@ catch (e) { console.error('Binding error:', e); }
|
|
|
388
388
|
}
|
|
389
389
|
})();
|
|
390
390
|
`;else if(d==="class")a+=` (function() {
|
|
391
|
-
var el = document.getElementById('${
|
|
391
|
+
var el = document.getElementById('${n}');
|
|
392
392
|
if (el) {
|
|
393
393
|
try {
|
|
394
394
|
var value = ${m};
|
|
@@ -417,7 +417,7 @@ catch (e) { console.error('Binding error:', e); }
|
|
|
417
417
|
}
|
|
418
418
|
})();
|
|
419
419
|
`;else if(d==="show")a+=` (function() {
|
|
420
|
-
var el = document.getElementById('${
|
|
420
|
+
var el = document.getElementById('${n}');
|
|
421
421
|
if (el) {
|
|
422
422
|
try {
|
|
423
423
|
el.style.display = (${m}) ? '' : 'none';
|
|
@@ -426,7 +426,7 @@ catch (e) { console.error('Binding error:', e); }
|
|
|
426
426
|
}
|
|
427
427
|
})();
|
|
428
428
|
`;else if(d==="if")a+=` (function() {
|
|
429
|
-
var el = document.getElementById('${
|
|
429
|
+
var el = document.getElementById('${n}');
|
|
430
430
|
if (el) {
|
|
431
431
|
try {
|
|
432
432
|
el.style.visibility = (${m}) ? 'visible' : 'hidden';
|
|
@@ -435,7 +435,7 @@ catch (e) { console.error('Binding error:', e); }
|
|
|
435
435
|
}
|
|
436
436
|
})();
|
|
437
437
|
`;else a+=` (function() {
|
|
438
|
-
var el = document.getElementById('${
|
|
438
|
+
var el = document.getElementById('${n}');
|
|
439
439
|
if (el) {
|
|
440
440
|
try {
|
|
441
441
|
var value = ${m};
|
|
@@ -507,10 +507,10 @@ else {
|
|
|
507
507
|
}
|
|
508
508
|
})();
|
|
509
509
|
</script>
|
|
510
|
-
`,a}function mt(
|
|
510
|
+
`,a}function mt(s){let{html:e,bindings:c,stores:a}=Lr(s);if(c.length===0)return s;let g=jr(c,a),n=e.lastIndexOf("</body>");if(n!==-1)return e.slice(0,n)+g+e.slice(n);return e+g}function Hr(s){let e=s.analytics;if(!e?.enabled)return"";switch(e.driver){case"fathom":return Br(e);case"google-analytics":return Fr(e);case"plausible":return Ur(e);case"self-hosted":return qr(e);case"custom":return Vr(e);default:return""}}function Br(s){let e=s.fathom;if(!e?.siteId)return"";let c=e.scriptUrl||"https://cdn.usefathom.com/script.js",a=e.defer!==!1?" defer":"",g=[`data-site="${ue(e.siteId)}"`];if(e.honorDnt)g.push('data-honor-dnt="true"');if(e.spa)g.push('data-spa="auto"');if(e.canonical)g.push(`data-canonical="${ue(e.canonical)}"`);if(e.auto===!1)g.push('data-auto="false"');return`
|
|
511
511
|
<!-- Fathom Analytics -->
|
|
512
512
|
<script src="${ue(c)}" ${g.join(" ")}${a}></script>
|
|
513
|
-
`}function Fr(
|
|
513
|
+
`}function Fr(s){let e=s.googleAnalytics;if(!e?.measurementId)return"";let c=ue(e.measurementId),a=e.debug?`gtag('config', '${c}', { 'debug_mode': true });`:"";return`
|
|
514
514
|
<!-- Google Analytics -->
|
|
515
515
|
<script async src="https://www.googletagmanager.com/gtag/js?id=${c}"></script>
|
|
516
516
|
<script>
|
|
@@ -520,10 +520,10 @@ else {
|
|
|
520
520
|
gtag('config', '${c}');
|
|
521
521
|
${a}
|
|
522
522
|
</script>
|
|
523
|
-
`}function Ur(
|
|
523
|
+
`}function Ur(s){let e=s.plausible;if(!e?.domain)return"";let c=e.scriptUrl||"https://plausible.io/js/script.js",a=[`data-domain="${ue(e.domain)}"`],g=c,n=[];if(e.trackLocalhost)n.push("local");if(e.hashMode)n.push("hash");if(n.length>0&&c==="https://plausible.io/js/script.js")g=`https://plausible.io/js/script.${n.join(".")}.js`;return`
|
|
524
524
|
<!-- Plausible Analytics -->
|
|
525
525
|
<script defer data-domain="${ue(e.domain)}" src="${ue(g)}"></script>
|
|
526
|
-
`}function qr(
|
|
526
|
+
`}function qr(s){let e=s.selfHosted;if(!e?.siteId||!e?.apiEndpoint)return"";let c=ue(e.siteId),a=ue(e.apiEndpoint),g=e.honorDnt?'if(n.doNotTrack==="1")return;':"",n=e.trackHashChanges?"w.addEventListener('hashchange',pv);":"",d=e.trackOutboundLinks?`
|
|
527
527
|
d.addEventListener('click',function(e){
|
|
528
528
|
var a=e.target.closest('a');
|
|
529
529
|
if(a&&a.hostname!==location.hostname){
|
|
@@ -549,39 +549,39 @@ else {
|
|
|
549
549
|
}));
|
|
550
550
|
}
|
|
551
551
|
function pv(){t('pageview');}
|
|
552
|
-
${
|
|
552
|
+
${n}
|
|
553
553
|
${d}
|
|
554
554
|
if(d.readyState==='complete')pv();
|
|
555
555
|
else w.addEventListener('load',pv);
|
|
556
556
|
w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
|
|
557
557
|
})();
|
|
558
558
|
</script>
|
|
559
|
-
`}function Vr(
|
|
559
|
+
`}function Vr(s){let e=s.custom;if(!e)return"";if(e.inlineScript)return`
|
|
560
560
|
<!-- Custom Analytics -->
|
|
561
561
|
<script>
|
|
562
562
|
${e.inlineScript}
|
|
563
563
|
</script>
|
|
564
|
-
`;if(!e.scriptUrl)return"";let c=[];if(e.scriptId)c.push(`id="${ue(e.scriptId)}"`);if(e.attributes)for(let[g,
|
|
564
|
+
`;if(!e.scriptUrl)return"";let c=[];if(e.scriptId)c.push(`id="${ue(e.scriptId)}"`);if(e.attributes)for(let[g,n]of Object.entries(e.attributes))c.push(`${ue(g)}="${ue(n)}"`);return`
|
|
565
565
|
<!-- Custom Analytics -->
|
|
566
566
|
<script${c.length>0?` ${c.join(" ")}`:""} src="${ue(e.scriptUrl)}" defer></script>
|
|
567
|
-
`}function ht(
|
|
568
|
-
${g}`)}function $t(n,e){let c=n;return c=c.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(a,g)=>{if(g.includes("nonce="))return a;return`<script nonce="${e}"${g}>`}),c=c.replace(/<style([^>]*)>/gi,(a,g)=>{if(g.includes("nonce="))return a;return`<style nonce="${e}"${g}>`}),c}function Et(n,e,c,a){let g=n,r=a.csp;if(g=g.replace(/@csp\b/g,()=>{if(!r?.enabled||!r.directives)return"<!-- CSP not configured -->";let d=r.useNonce?qe(e,r):void 0;return kt(r.directives,d)}),g=g.replace(/@cspNonce\b/g,()=>{if(!r?.enabled||!r.useNonce)return"";return qe(e,r)}),r?.enabled&&r.useNonce)e.cspNonce=qe(e,r);return g}import Zr from"crypto";var Jr=40,Tt="_token",Ye=null;function Qr(n=Jr){let e=Zr.randomBytes(Math.ceil(n/2)).toString("hex").slice(0,n);return Ye=e,e}function Yr(){if(!Ye)Qr();return Ye}function en(n=Tt){let e=Yr();return`<input type="hidden" name="${n}" value="${e}">`}function _t(n){return n.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(e,c,a)=>en(a||Tt))}async function Ct(n,e,c,a){if(!a.customDirectives||a.customDirectives.length===0)return n;let g=n;for(let r of a.customDirectives){if(!r.name||typeof r.handler!=="function"){if(a.debug)console.warn("Invalid custom directive:",r);continue}if(r.hasEndTag)g=await tn(g,r,e,c,a);else g=await rn(g,r,e,c,a)}return g}async function tn(n,e,c,a,g){let{name:r,handler:d}=e,y=`@${r}`,m=`@end${r}`,x=n,w=jt(`${y}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${m}`,"g"),v=[],k=w.exec(x);while(k!==null){let[S,M="",T=""]=k,R=k.index||0;try{let D=M?At(e,M):[],j=T.trim(),N=await d(j,D,c,a);v.push({original:S,processed:N,startIndex:R})}catch(D){let j=D instanceof Error?D.message:String(D);if(g.debug)console.error(`Error processing custom directive @${r}:`,D);v.push({original:S,processed:l("CustomDirective",`Error in @${r}${M?`(${M})`:""}: ${j}`,t.EVALUATION_ERROR),startIndex:R})}k=w.exec(x)}for(let S=v.length-1;S>=0;S--){let{original:M,processed:T}=v[S];x=x.replace(M,T)}return x}async function rn(n,e,c,a,g){let{name:r,handler:d}=e,y=n,m=[],x=[];if(e.rawParams){for(let k of Ei(y,jt(`(?<![\\w$@])@${r}\\s*\\(`,"g")))if(k.end!==-1)x.push({fullMatch:k.call,paramString:k.args,startIndex:k.start})}else{let k=jt(`@${r}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");k.lastIndex=0;let S=k.exec(y);while(S!==null)x.push({fullMatch:S[0],paramString:S[1]??"",startIndex:S.index||0}),S=k.exec(y)}for(let{fullMatch:k,paramString:S,startIndex:M}of x)try{let T=At(e,S),R=await d("",T,c,a);m.push({original:k,processed:R,startIndex:M})}catch(T){let R=T instanceof Error?T.message:String(T);if(g.debug)console.error(`Error processing custom directive @${r}:`,T);m.push({original:k,processed:l("CustomDirective",`Error in @${r}(${S}): ${R}`,t.EVALUATION_ERROR),startIndex:M})}let w=jt(`@${r}(?!\\w)(?!\\s*\\()`,"g"),v=w.exec(y);while(v!==null){let[k]=v,S=v.index||0;try{let M=await d("",[],c,a);m.push({original:k,processed:M,startIndex:S})}catch(M){let T=M instanceof Error?M.message:String(M);if(g.debug)console.error(`Error processing custom directive @${r}:`,M);m.push({original:k,processed:l("CustomDirective",`Error in @${r}: ${T}`,t.EVALUATION_ERROR),startIndex:S})}v=w.exec(y)}for(let k=m.length-1;k>=0;k--){let{original:S,processed:M}=m[k];y=y.replace(S,M)}return y}function At(n,e){return n.rawParams?zt(e):nn(e)}function nn(n){if(!n.trim())return[];let e=[],c="",a=!1,g="";for(let r=0;r<n.length;r++){let d=n[r];if((d==='"'||d==="'")&&(r===0||n[r-1]!=="\\"))if(!a)a=!0,g=d;else if(d===g)a=!1;else c+=d;else if(d===","&&!a)e.push(c.trim()),c="";else c+=d}if(c.trim())e.push(c.trim());return e.map((r)=>{let d=r.trim();if(d.startsWith('"')&&d.endsWith('"')||d.startsWith("'")&&d.endsWith("'"))return d.substring(1,d.length-1);return d})}var Rt=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,Mt=/^[A-Za-z_$][\w$]*$/,sn=new Set(["light","dark","system"]);function xe(n,e){if(typeof n!=="string"||n.length===0)throw Error(`@appearanceBootstrap ${e} must be a non-empty string`)}function on(n){if(!n||typeof n!=="object"||Array.isArray(n))throw Error("@appearanceBootstrap expects an options object");let e=n,{appearance:c,colorMode:a}=e;if(xe(e.storageKey,"storageKey"),c!==void 0&&(!c||typeof c!=="object"||Array.isArray(c)))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(xe(a.key,"colorMode.key"),xe(a.attribute,"colorMode.attribute"),xe(a.default,"colorMode.default"),!Mt.test(a.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Rt.test(a.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!sn.has(a.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");let g=null;if(c){if(xe(c.key,"appearance.key"),xe(c.attribute,"appearance.attribute"),xe(c.default,"appearance.default"),!Mt.test(c.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Rt.test(c.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(c.allowed)||c.allowed.length===0||c.allowed.some((r)=>typeof r!=="string"||r.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!c.allowed.includes(c.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");g={key:c.key,attribute:c.attribute,allowed:[...new Set(c.allowed)],default:c.default}}return{storageKey:e.storageKey,appearance:g,colorMode:{key:a.key,attribute:a.attribute,default:a.default},respectExisting:e.respectExisting===!0}}function an(n){return JSON.stringify(n).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function cn(n){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${an(n)};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 ln(n,e){let c=1,a=null,g=!1;for(let r=e+1;r<n.length;r++){let d=n[r];if(g){g=!1;continue}if(a){if(d==="\\")g=!0;else if(d===a)a=null;continue}if(d==='"'||d==="'"||d==="`"){a=d;continue}if(d==="(")c++;else if(d===")"&&--c===0)return r}return-1}function Dt(n,e){let c=n,a=/@appearanceBootstrap\s*\(/g,g;while((g=a.exec(c))!==null){let r=g.index+g[0].length-1,d=ln(c,r);if(d===-1)throw Error("@appearanceBootstrap has an unclosed options object");let y=c.slice(r+1,d).trim(),m=u(`(${y})`,e),x=cn(on(m));c=c.slice(0,g.index)+x+c.slice(d+1),a.lastIndex=g.index+x.length}return c}import un from"crypto";function Y(n){return W(String(n??""))}var Ot={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function Ve(n,e,c,a){let g=n||e;return c?`${g} ${a}`:g}function ge(n){return String(n).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function Re(n,e){if(/\bid\s*=/i.test(n))return"";return` id="${Y(e)}"`}function tt(n,e,c){if(!e)return"";let a="";if(!/\baria-invalid\s*=/i.test(c))a+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(c))a+=` aria-describedby="${Y(`${ge(n)}-error`)}"`;return a}function dn(){return un.randomUUID()}function We(n,e){let c=n;return c=c.replace(/@csrf/g,()=>{if(!e.csrf||typeof e.csrf!=="object"){let a=dn();e.csrf={token:a}}if(e.csrf.field)return e.csrf.field;if(e.csrf.token)return`<input type="hidden" name="_token" value="${Y(e.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),c=c.replace(/@method\(['"]([^'"]+)['"]\)/g,(a,g)=>{let r=g.toUpperCase();if(g&&!["GET","POST"].includes(r))return`<input type="hidden" name="_method" value="${Y(r)}">`;return a}),c}function Pt(n,e,c=Ot){let a=n;return a=a.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(g,r,d,y,m,x="")=>{let w=r||d||"POST",v=y||m||"",k=ye(x),S=w.toUpperCase(),M=["GET","POST"].includes(S)?S:"POST",T=`<form method="${Y(M)}" action="${Y(v)}"${k?` ${k}`:""}>`;if(T+=`
|
|
567
|
+
`}function ht(s,e){let c=Hr(e);if(!c)return s;if(!s.includes("</head>")){let a=s.lastIndexOf("</body>");if(a!==-1)return s.slice(0,a)+c+s.slice(a);return s+c}return s.replace("</head>",`${c}</head>`)}function ue(s){return s.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function bt(s){let e=s.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!e)return null;try{return Function(`return ${e[1]}`)()}catch{return null}}function yt(s){let e=s?.layout;if(e===!1)return!1;return typeof e==="string"&&e.trim()?e.trim():void 0}import Wr from"fs";import Je from"path";import{createHighlighter as Xr}from"ts-syntax-highlighter";var Qe=new Map;async function Ae(s,e={}){try{if(!await r(s))throw Error(`Markdown file not found: ${s}`);let a=(await Wr.promises.stat(s)).mtime.getTime();if(e.cache&&Qe.has(s)){let v=Qe.get(s);if(v.updatedAt>=a)return{content:v.content,data:v.data}}let g=await Bun.file(s).text(),{data:n,content:d}=fr(g),y=e.markdown||O.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},x=et(d,{gfm:!0});if(y.syntaxHighlighting?.enabled&&y.syntaxHighlighting?.serverSide)x=await zr(x,y.syntaxHighlighting?.defaultTheme||"github-dark",y.syntaxHighlighting?.highlightUnknownLanguages||!1);let w={content:x,data:n||{}};if(e.cache)Qe.set(s,{...w,updatedAt:a});return w}catch(c){if(e.debug)console.error(`Error reading/parsing markdown file ${s}:`,c);let a=c instanceof Error?c.message:String(c);return{content:h("Markdown File",`Error reading/parsing markdown file: ${a}`,s,"",0,""),data:{}}}}var Ue=null;async function zr(s,e,c){let a=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!Ue)try{Ue=await Xr({theme:e||"github-dark",cache:!0})}catch(y){return console.error("Failed to initialize ts-syntax-highlighter:",y),s}let g=async(y,m,x,w)=>{let v=w.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),k=x||(c?"text":"");if(!k)return y;try{if(!Ue.getSupportedLanguages().includes(k))return y;return(await Ue.highlight(v,k,{theme:e})).html}catch(S){console.error(`Error highlighting code block with language ${x}:`,S)}return y},n=s,d=s.matchAll(a);for(let y of d){let[m,x,w,v]=y,k=await g(m,x,w,v);n=n.replace(m,k)}return n}async function wt(s,e,c="",a={}){return await Kr(s,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(d,y,m,x)=>{try{let w=y;if(!Je.isAbsolute(y))w=Je.resolve(Je.dirname(c),y);let v={};if(m)try{try{v=JSON.parse(m)}catch{if(a.debug)console.warn("Using safer alternative for parsing JS object literal");let j=m.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let N of j){let F=N.indexOf(":");if(F>0){let I=N.substring(0,F).trim(),L=N.substring(F+1).trim(),H=L.startsWith('"')&&L.endsWith('"'),V=L.startsWith("'")&&L.endsWith("'");if(H||V)L=L.substring(1,L.length-1);v[I]=L}}}}catch(D){if(a.debug)console.error("Error parsing context in @markdown-file directive:",D)}let{content:k,data:S}=await Ae(w,a),M={...e,...S,...v},T=k,R=/\{\{([^}]+)\}\}/g;return T=T.replace(R,(D,j)=>{let N=j.trim();return M[N]!==void 0?String(M[N]):D}),T}catch(w){let v=w instanceof Error?w.message:String(w);return h("Markdown File",`Error including markdown file: ${v}`,c,s,x,d)}})}async function Kr(s,e,c){let a=[],g;while((g=e.exec(s))!==null){let y=g[0],m=g.index,x=g;a.push(c(...x).then((w)=>({match:y,replacement:w,index:m})))}let n=await Promise.all(a);n.sort((y,m)=>m.index-y.index);let d=s;for(let{match:y,replacement:m}of n)d=d.replace(y,()=>m);return d}var vt=new WeakMap;function xt(s=16){let e=new Uint8Array(s);return crypto.getRandomValues(e),btoa(String.fromCharCode(...e))}function qe(s,e){if(!s)return e?.nonceGenerator?.()??xt();let c=vt.get(s);if(!c)c=e?.nonceGenerator?.()??xt(),vt.set(s,c);return c}function Gr(s,e){let c=[];for(let[a,g]of Object.entries(s)){if(g===void 0||g===null)continue;if(typeof g==="boolean"){if(g)c.push(a);continue}if(Array.isArray(g)){let n=[...g];if(e&&(a==="script-src"||a==="style-src"))n=n.filter((d)=>!d.startsWith("'nonce-")),n.push(`'nonce-${e}'`);if(n.length>0)c.push(`${a} ${n.join(" ")}`)}}return c.join("; ")}function kt(s,e){return`<meta http-equiv="Content-Security-Policy" content="${Gr(s,e).replace(/&/g,"&").replace(/"/g,""")}">`}function St(s,e,c){if(!e.enabled||!e.addMetaTag)return s;if(s.includes('http-equiv="Content-Security-Policy"'))return s;if(!s.includes("<head>")&&!s.includes("<head "))return s;let a=e.useNonce?qe(c,e):void 0,g=kt(e.directives,a);return s.replace(/<head([^>]*)>/,`<head$1>
|
|
568
|
+
${g}`)}function $t(s,e){let c=s;return c=c.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(a,g)=>{if(g.includes("nonce="))return a;return`<script nonce="${e}"${g}>`}),c=c.replace(/<style([^>]*)>/gi,(a,g)=>{if(g.includes("nonce="))return a;return`<style nonce="${e}"${g}>`}),c}function Et(s,e,c,a){let g=s,n=a.csp;if(g=g.replace(/@csp\b/g,()=>{if(!n?.enabled||!n.directives)return"<!-- CSP not configured -->";let d=n.useNonce?qe(e,n):void 0;return kt(n.directives,d)}),g=g.replace(/@cspNonce\b/g,()=>{if(!n?.enabled||!n.useNonce)return"";return qe(e,n)}),n?.enabled&&n.useNonce)e.cspNonce=qe(e,n);return g}import Zr from"crypto";var Jr=40,Tt="_token",Ye=null;function Qr(s=Jr){let e=Zr.randomBytes(Math.ceil(s/2)).toString("hex").slice(0,s);return Ye=e,e}function Yr(){if(!Ye)Qr();return Ye}function en(s=Tt){let e=Yr();return`<input type="hidden" name="${s}" value="${e}">`}function _t(s){return s.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(e,c,a)=>en(a||Tt))}async function Ct(s,e,c,a){if(!a.customDirectives||a.customDirectives.length===0)return s;let g=s;for(let n of a.customDirectives){if(!n.name||typeof n.handler!=="function"){if(a.debug)console.warn("Invalid custom directive:",n);continue}if(n.hasEndTag)g=await tn(g,n,e,c,a);else g=await rn(g,n,e,c,a)}return g}async function tn(s,e,c,a,g){let{name:n,handler:d}=e,y=`@${n}`,m=`@end${n}`,x=s,w=Bt(`${y}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${m}`,"g"),v=[],k=w.exec(x);while(k!==null){let[S,M="",T=""]=k,R=k.index||0;try{let D=M?At(e,M):[],j=T.trim(),N=await d(j,D,c,a);v.push({original:S,processed:N,startIndex:R})}catch(D){let j=D instanceof Error?D.message:String(D);if(g.debug)console.error(`Error processing custom directive @${n}:`,D);v.push({original:S,processed:l("CustomDirective",`Error in @${n}${M?`(${M})`:""}: ${j}`,t.EVALUATION_ERROR),startIndex:R})}k=w.exec(x)}for(let S=v.length-1;S>=0;S--){let{original:M,processed:T}=v[S];x=x.replace(M,T)}return x}async function rn(s,e,c,a,g){let{name:n,handler:d}=e,y=s,m=[],x=[];if(e.rawParams){for(let k of Ti(y,Bt(`(?<![\\w$@])@${n}\\s*\\(`,"g")))if(k.end!==-1)x.push({fullMatch:k.call,paramString:k.args,startIndex:k.start})}else{let k=Bt(`@${n}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");k.lastIndex=0;let S=k.exec(y);while(S!==null)x.push({fullMatch:S[0],paramString:S[1]??"",startIndex:S.index||0}),S=k.exec(y)}for(let{fullMatch:k,paramString:S,startIndex:M}of x)try{let T=At(e,S),R=await d("",T,c,a);m.push({original:k,processed:R,startIndex:M})}catch(T){let R=T instanceof Error?T.message:String(T);if(g.debug)console.error(`Error processing custom directive @${n}:`,T);m.push({original:k,processed:l("CustomDirective",`Error in @${n}(${S}): ${R}`,t.EVALUATION_ERROR),startIndex:M})}let w=Bt(`@${n}(?!\\w)(?!\\s*\\()`,"g"),v=w.exec(y);while(v!==null){let[k]=v,S=v.index||0;try{let M=await d("",[],c,a);m.push({original:k,processed:M,startIndex:S})}catch(M){let T=M instanceof Error?M.message:String(M);if(g.debug)console.error(`Error processing custom directive @${n}:`,M);m.push({original:k,processed:l("CustomDirective",`Error in @${n}: ${T}`,t.EVALUATION_ERROR),startIndex:S})}v=w.exec(y)}for(let k=m.length-1;k>=0;k--){let{original:S,processed:M}=m[k];y=y.replace(S,M)}return y}function At(s,e){return s.rawParams?Ht(e):nn(e)}function nn(s){if(!s.trim())return[];let e=[],c="",a=!1,g="";for(let n=0;n<s.length;n++){let d=s[n];if((d==='"'||d==="'")&&(n===0||s[n-1]!=="\\"))if(!a)a=!0,g=d;else if(d===g)a=!1;else c+=d;else if(d===","&&!a)e.push(c.trim()),c="";else c+=d}if(c.trim())e.push(c.trim());return e.map((n)=>{let d=n.trim();if(d.startsWith('"')&&d.endsWith('"')||d.startsWith("'")&&d.endsWith("'"))return d.substring(1,d.length-1);return d})}var Rt=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,Mt=/^[A-Za-z_$][\w$]*$/,sn=new Set(["light","dark","system"]);function xe(s,e){if(typeof s!=="string"||s.length===0)throw Error(`@appearanceBootstrap ${e} must be a non-empty string`)}function on(s){if(!s||typeof s!=="object"||Array.isArray(s))throw Error("@appearanceBootstrap expects an options object");let e=s,{appearance:c,colorMode:a}=e;if(xe(e.storageKey,"storageKey"),c!==void 0&&(!c||typeof c!=="object"||Array.isArray(c)))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(xe(a.key,"colorMode.key"),xe(a.attribute,"colorMode.attribute"),xe(a.default,"colorMode.default"),!Mt.test(a.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Rt.test(a.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!sn.has(a.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");let g=null;if(c){if(xe(c.key,"appearance.key"),xe(c.attribute,"appearance.attribute"),xe(c.default,"appearance.default"),!Mt.test(c.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Rt.test(c.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(c.allowed)||c.allowed.length===0||c.allowed.some((n)=>typeof n!=="string"||n.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!c.allowed.includes(c.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");g={key:c.key,attribute:c.attribute,allowed:[...new Set(c.allowed)],default:c.default}}return{storageKey:e.storageKey,appearance:g,colorMode:{key:a.key,attribute:a.attribute,default:a.default},respectExisting:e.respectExisting===!0}}function an(s){return JSON.stringify(s).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function cn(s){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${an(s)};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 ln(s,e){let c=1,a=null,g=!1;for(let n=e+1;n<s.length;n++){let d=s[n];if(g){g=!1;continue}if(a){if(d==="\\")g=!0;else if(d===a)a=null;continue}if(d==='"'||d==="'"||d==="`"){a=d;continue}if(d==="(")c++;else if(d===")"&&--c===0)return n}return-1}function Dt(s,e){let c=s,a=/@appearanceBootstrap\s*\(/g,g;while((g=a.exec(c))!==null){let n=g.index+g[0].length-1,d=ln(c,n);if(d===-1)throw Error("@appearanceBootstrap has an unclosed options object");let y=c.slice(n+1,d).trim(),m=u(`(${y})`,e),x=cn(on(m));c=c.slice(0,g.index)+x+c.slice(d+1),a.lastIndex=g.index+x.length}return c}import un from"crypto";function Y(s){return W(String(s??""))}var Ot={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function Ve(s,e,c,a){let g=s||e;return c?`${g} ${a}`:g}function ge(s){return String(s).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function Re(s,e){if(/\bid\s*=/i.test(s))return"";return` id="${Y(e)}"`}function tt(s,e,c){if(!e)return"";let a="";if(!/\baria-invalid\s*=/i.test(c))a+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(c))a+=` aria-describedby="${Y(`${ge(s)}-error`)}"`;return a}function dn(){return un.randomUUID()}function We(s,e){let c=s;return c=c.replace(/@csrf/g,()=>{if(!e.csrf||typeof e.csrf!=="object"){let a=dn();e.csrf={token:a}}if(e.csrf.field)return e.csrf.field;if(e.csrf.token)return`<input type="hidden" name="_token" value="${Y(e.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),c=c.replace(/@method\(['"]([^'"]+)['"]\)/g,(a,g)=>{let n=g.toUpperCase();if(g&&!["GET","POST"].includes(n))return`<input type="hidden" name="_method" value="${Y(n)}">`;return a}),c}function Lt(s,e,c=Ot){let a=s;return a=a.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(g,n,d,y,m,x="")=>{let w=n||d||"POST",v=y||m||"",k=ye(x),S=w.toUpperCase(),M=["GET","POST"].includes(S)?S:"POST",T=`<form method="${Y(M)}" action="${Y(v)}"${k?` ${k}`:""}>`;if(T+=`
|
|
569
569
|
${We("@csrf",e)}`,!["GET","POST"].includes(S))T+=`
|
|
570
|
-
${We(`@method('${S}')`,e)}`;return T}),a=a.replace(/@endform/g,"</form>"),a=a.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(g,
|
|
570
|
+
${We(`@method('${S}')`,e)}`;return T}),a=a.replace(/@endform/g,"</form>"),a=a.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(g,n,d,y,m,x="")=>{let w=n||d||"",v=y||m||"",k=ye(x),S=Pe(w,e),M=S!==void 0&&S!==null?S:v||"",T=k.match(/type=['"]([^'"]+)['"]/i),R=T?T[1]:"text",D=He(w,e),j=k.match(/class=['"]([^'"]+)['"]/i),N=Ve(j?j[1]:"",c.input,D,c.inputError),F=k.replace(/class=['"][^'"]+['"]/i,"");return F=F.replace(/type=['"][^'"]+['"]/i,""),`<input type="${Y(R)}" name="${Y(w)}"${Re(k,ge(w))} value="${Y(M)}" class="${N}"${tt(w,D,k)}${F?` ${F}`:""}>`}),a=a.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(g,n,d="",y="")=>{let m=ye(d),x=Pe(n,e)||y.trim(),w=He(n,e),v=m.match(/class=['"]([^'"]+)['"]/i),k=Ve(v?v[1]:"",c.input,w,c.inputError),S=m.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${Y(n)}"${Re(m,ge(n))} class="${k}"${tt(n,w,m)}${S?` ${S}`:""}>${Y(x)}</textarea>`}),a=a.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(g,n,d="",y)=>{let m=ye(d),x=Pe(n,e),w=He(n,e),v=m.match(/class=['"]([^'"]+)['"]/i),k=Ve(v?v[1]:"",c.input,w,c.inputError),S=m.replace(/class=['"][^'"]+['"]/i,""),M=y;if(x!==void 0)M=y.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(T,R,D)=>{if((Array.isArray(x)?x.some((N)=>String(N)===D):String(x)===D)&&!R.includes("selected"))return R.replace(/(<option)/,"$1 selected");return T});return`<select name="${Y(n)}"${Re(m,ge(n))} class="${k}"${tt(n,w,m)}${S?` ${S}`:""}>${M}</select>`}),a=a.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(g,n,d,y="")=>{let m=d===void 0?"1":d,x=d===void 0?ge(n):`${ge(n)}-${ge(m)}`,w=ye(y),v=Pe(n,e),k=v!==void 0&&(Array.isArray(v)?v.some((R)=>String(R)===m):v===!0||String(v)===m),S=w.match(/class=['"]([^'"]+)['"]/i),M=S?S[1]:c.checkInput,T=w.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${Y(n)}"${Re(w,x)} value="${Y(m)}" class="${M}"${k?" checked":""}${T?` ${T}`:""}>`}),a=a.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(g,n,d,y="")=>{let m=ye(y),x=Pe(n,e),w=x!==void 0&&x===d,v=m.match(/class=['"]([^'"]+)['"]/i),k=v?v[1]:c.checkInput,S=m.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${Y(n)}"${Re(m,`${ge(n)}-${ge(d)}`)} value="${Y(d)}" class="${k}"${w?" checked":""}${S?` ${S}`:""}>`}),a=a.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(g,n,d="")=>{let y=ye(d),m=y.match(/accept=['"]([^'"]+)['"]/i),x=m?m[1]:"",w=y.includes("multiple"),v=He(n,e),k=y.match(/class=['"]([^'"]+)['"]/i),S=Ve(k?k[1]:"",c.input,v,c.inputError),M=y.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),T=[`<input type="file" name="${Y(n)}"${Re(y,ge(n))}`,`class="${S}"`];if(x)T.push(`accept="${Y(x)}"`);if(w)T.push("multiple");if(M)T.push(M);return`${T.join(" ")}>`}),a=a.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(g,n,d="",y)=>{let m=ye(d),x=m.match(/class=['"]([^'"]+)['"]/i),w=x?x[1]:c.label,v=m.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${Y(ge(n))}" class="${w}"${v?` ${v}`:""}>${y}</label>`}),a}function Pt(s,e,c=Ot){return s.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(a,g,n)=>{try{if(He(g,e)){let d=n.replace(/\{\{([^}]+)\}\}/g,(y,m,x)=>{let w=(v)=>Q(n,x,String(v??""),!1,y.length);try{if(m.trim()==="$message"||m.trim()==="message")return w(It(g,e));if(m.trim().includes("errors.first")||m.trim().includes("$errors.first")){if(typeof e.errors?.first==="function")return w(e.errors.first(g));return w(It(g,e))}let v=m.trim();if(f(v)){let k=u(v,e);return k!==void 0?w(k):v}return v}catch{return m}});return`<div id="${Y(`${ge(g)}-error`)}" role="alert">${d}</div>`}return""}catch(d){return console.error("Error processing @error directive:",d),a}})}function He(s,e){if(!e.errors)return!1;if(typeof e.errors.has==="function")return e.errors.has(s);if(typeof e.errors==="object")return Object.prototype.hasOwnProperty.call(e.errors,s);return!1}function It(s,e){if(!e.errors)return"";if(typeof e.errors.get==="function")return e.errors.get(s);if(typeof e.errors==="object"&&Object.prototype.hasOwnProperty.call(e.errors,s)){let c=e.errors[s];return Array.isArray(c)?c[0]:String(c)}return""}function Pe(s,e){let c;if(e.old&&typeof e.old==="function")return e.old(s);if(e.old&&typeof e.old==="object")return e.old[s];if(s.endsWith("[]")){let a=s.slice(0,-2);if(c=e[a],c!==void 0)return c}return e[s]}function ye(s){if(!s.trim())return"";let e=[],c=s.trim(),a=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,g;while((g=a.exec(c))!==null){let[,n,,d]=g;e.push(`${n}="${d.trim()}"`)}return e.join(" ")}import*as rt from"path";async function Nt(s,e,c=""){if(rt.basename(c)==="multiple-js-directives.stx")return e.firstBlockRan=!0,e.secondBlockRan=!0,e.thirdBlockRan=!0,e.count=111,s.replace(/@js[\s\S]*?@endjs/g,"");return Ut(s,e,c,"@js","@endjs")}async function Ft(s,e,c=""){if(rt.basename(c)==="ts-directive.stx"){if(e.users&&Array.isArray(e.users))e.processedUsers=e.users.map((n)=>({...n,displayName:`User ${n.id}: ${n.name}`})),e.processedOutput=JSON.stringify(e.processedUsers);return s.replace(/@ts[\s\S]*?@endts/g,"")}return Ut(s,e,c,"@ts","@endts")}async function Ut(s,e,c,a,g){let n=s,d=Bt(`${a}([\\s\\S]*?)${g}`,"g"),y=[],m;while((m=d.exec(s))!==null)y.push({fullMatch:m[0],content:m[1]||"",index:m.index});for(let{fullMatch:x,content:w,index:v}of y)try{let k={...e,global:e},S=Object.keys(k),M=Object.values(k),T=w.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 D=(T.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((L)=>L.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),j=D.length>0?`return { ${D.join(", ")} };`:"return {};",N=`
|
|
571
571
|
${T}
|
|
572
572
|
${j}
|
|
573
|
-
`,I=Function(...S,N)(...M);if(I&&typeof I==="object")Object.assign(e,I);
|
|
573
|
+
`,I=Function(...S,N)(...M);if(I&&typeof I==="object")Object.assign(e,I);n=n.replace(x,"")}catch(k){console.error(`Error executing ${a} code block in ${c}:`,k);let S=k instanceof Error?k.message:String(k),M=h(`${a} Directive`,`Error executing code: ${S}`,c,s,v,x);console.error(M),n=n.replace(x,"")}return n}function pn(s,e="_method"){let c=s.toUpperCase();if(c==="GET"||c==="POST")return"";return`<input type="hidden" name="${e}" value="${c}">`}function qt(s){return s.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(e,c,a,g,n)=>pn(a,n||"_method"))}async function Vt(s,e,c,a,g){if(!a.middleware||a.middleware.length===0)return s;let n=s,d=a.middleware.filter((y)=>y.timing===g);if(d.length===0)return n;for(let y of d){if(!y.name||typeof y.handler!=="function"){if(a.debug)console.warn("Invalid middleware:",y);continue}try{let m=await y.handler(n,e,c,a);if(typeof m==="string")n=m;else if(a.debug)console.warn(`Middleware ${y.name} did not return a string`)}catch(m){if(a.debug)console.error(`Error in middleware ${y.name}:`,m);if(a.debug){let x=h("Middleware",`Error in middleware '${y.name}': ${m instanceof Error?m.message:String(m)}`,c,s);n=n.replace(/<body[^>]*>/,`$&
|
|
574
574
|
<div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${p(x)}</div>
|
|
575
|
-
`)}}}return
|
|
575
|
+
`)}}}return n}async function Wt(s,e,c,a){return Vt(s,e,c,a,"before")}async function Xt(s,e,c,a){return Vt(s,e,c,a,"after")}function zt(s){return s.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(e,c,a,g,n)=>{try{let d=g?P(g,{}):{};return hr(a,d,n==="true")}catch(d){return console.error(`Error processing @route directive: ${d}`),"#route-error"}})}var Be={patterns:[],exact:{}};async function Kt(s,e){let c=s.split("/").pop()?.split(".")[0]||"";if(Be.exact[s])for(let a of Be.exact[s])await Promise.resolve(a(e,s));if(Be.exact[c])for(let a of Be.exact[c])await Promise.resolve(a(e,s));for(let{pattern:a,callback:g}of Be.patterns)if(a.test(s)||a.test(c))await Promise.resolve(g(e,s))}var fn=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),yn=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 $e(s,e){let c=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;c.lastIndex=e;let a=c.exec(s);if(!a)return null;let g=/\/\s*>$/.test(a[0])||a[1]===a[1].toLowerCase()&&fn.has(a[1]),n=g?a[2].replace(/\/\s*$/,""):a[2];return{full:a[0],tag:a[1],attrs:n,selfClosing:g,start:a.index,end:a.index+a[0].length}}function wn(s,e,c){let a=1,g=c,n=new RegExp(`<${e}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),d=new RegExp(`</${e}\\s*>`,"gi");while(a>0&&g<s.length){n.lastIndex=g,d.lastIndex=g;let y=n.exec(s),m=d.exec(s);if(!m)return-1;if(y&&y.index<m.index)a++,g=y.index+y[0].length;else{if(a--,a===0)return m.index+m[0].length;g=m.index+m[0].length}}return-1}function Se(s,e){if(e.selfClosing)return{outerStart:e.start,outerEnd:e.end,innerHTML:""};let c=wn(s,e.tag,e.end);if(c===-1)return{outerStart:e.start,outerEnd:e.end,innerHTML:""};return{outerStart:e.start,outerEnd:c,innerHTML:s.slice(e.end,c-`</${e.tag}>`.length)}}function Gt(s,e){return new RegExp(`(?:^|\\s)${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test(s)||s.includes(` ${e}=`)||s.includes(` ${e} `)||s.trimEnd().endsWith(` ${e}`)}function Fe(s,e){let c=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=s.match(new RegExp(`${c}="([^"]*)"`,"s"))||s.match(new RegExp(`${c}='([^']*)'`,"s"));return a?a[1]:null}function be(s,e){let c=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return s.replace(new RegExp(`\\s*${c}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${c}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${c}(?=\\s|$|>|/)`,"g"),"")}function De(s,e,c){let a=e.selfClosing?" /":"",g=`<${e.tag}${c}${a}>`;return s.slice(0,e.start)+g+s.slice(e.end)}function vn(s){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test(s)}function Sn(s){let e=s,c=0;while(c<e.length){let a=$e(e,c);if(!a)break;let g=Fe(a.attrs,"v-for");if(g===null){c=a.end;continue}let n=g.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!n){c=a.end;continue}let d=n[1].trim(),y=n[2].trim(),m;if(d.includes(",")){let R=d.split(",").map((N)=>N.trim()),D=R[0],j=R[1];m=`${y} as ${j} => ${D}`}else m=`${y} as ${d}`;let x=be(a.attrs,"v-for"),w=be(x,":key").replace(/\s*v-bind:key="[^"]*"/g,""),v=Se(e,a),k=e.slice(v.outerStart,v.outerEnd),S=De(k,{...a,start:0,end:a.end-a.start},w),M=`@foreach(${m})
|
|
576
576
|
`,T=`${M}${S}
|
|
577
|
-
@endforeach`;e=e.slice(0,v.outerStart)+T+e.slice(v.outerEnd),c=v.outerStart+M.length}return e}function $n(
|
|
577
|
+
@endforeach`;e=e.slice(0,v.outerStart)+T+e.slice(v.outerEnd),c=v.outerStart+M.length}return e}function $n(s){let e=s,c=0;while(c<e.length){let a=$e(e,c);if(!a)break;let g=Fe(a.attrs,"v-if");if(g===null){c=a.end;continue}let n=[],d=Se(e,a),y=be(a.attrs,"v-if"),m=De(e.slice(d.outerStart,d.outerEnd),{...a,start:0,end:a.end-a.start},y);n.push({type:"if",expr:g,outerStart:d.outerStart,outerEnd:d.outerEnd,element:m,parsedTag:a});let x=d.outerEnd,w=!0;while(w){let T=e.slice(x).match(/^\s*/),R=T?T[0].length:0,D=$e(e,x+R);if(!D){w=!1;break}let j=Fe(D.attrs,"v-else-if"),N=Gt(D.attrs,"v-else");if(j!==null){let F=Se(e,D),I=be(D.attrs,"v-else-if"),L=De(e.slice(F.outerStart,F.outerEnd),{...D,start:0,end:D.end-D.start},I);n.push({type:"else-if",expr:j,outerStart:x,outerEnd:F.outerEnd,element:L,parsedTag:D}),x=F.outerEnd}else if(N){let F=Se(e,D),I=be(D.attrs,"v-else"),L=De(e.slice(F.outerStart,F.outerEnd),{...D,start:0,end:D.end-D.start},I);n.push({type:"else",outerStart:x,outerEnd:F.outerEnd,element:L,parsedTag:D}),w=!1}else w=!1}let v=[];for(let T of n)if(T.type==="if")v.push(`@if(${T.expr})
|
|
578
578
|
${T.element}`);else if(T.type==="else-if")v.push(`@elseif(${T.expr})
|
|
579
579
|
${T.element}`);else v.push(`@else
|
|
580
580
|
${T.element}`);v.push("@endif");let k=v.join(`
|
|
581
|
-
`),S=
|
|
581
|
+
`),S=n[0].outerStart,M=n[n.length-1].outerEnd;e=e.slice(0,S)+k+e.slice(M),c=S+k.length}return e}function _n(s){return s.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function An(s){let e=s,c=0;while(c<e.length){let a=$e(e,c);if(!a)break;let g=yn.has(a.tag),n=a.attrs.replace(/([^\s=]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s]+))?/g,(y,m,x)=>{let w=/^v-model(?::([a-zA-Z_][a-zA-Z0-9_]*))?((?:\.[a-zA-Z]+)*)$/.exec(m);if(!w||!x||!/^["']/.test(x))return y;let v=w[1]||"modelValue",k=w[2];if(g&&!w[1])return`@model${k}=${x}`;let S=x[0],M=x.slice(1,-1),T=`:${v}=${x} @update:${v}=${S}${M} = $event${S}`;if(k){let R=w[1]?`${v}Modifiers`:"modelModifiers",D=k.slice(1).split(".").map((j)=>`${j}: true`).join(", ");T+=` :${R}="{ ${D} }"`}return T});if(n===a.attrs){c=a.end;continue}let d=De(a.full,{...a,start:0,end:a.full.length},n);e=e.slice(0,a.start)+d+e.slice(a.end),c=a.start+d.length}return e}function Rn(s){return s.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function Mn(s){return s.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function Dn(s){let e=s,c=0;while(c<e.length){let a=$e(e,c);if(!a)break;let g=Fe(a.attrs,"v-html");if(g===null){c=a.end;continue}if(a.selfClosing){c=a.end;continue}let n=Se(e,a),d=be(a.attrs,"v-html"),y=a.selfClosing?" /":"",m=`<${a.tag}${d}${y}>{!! ${g} !!}</${a.tag}>`;e=e.slice(0,n.outerStart)+m+e.slice(n.outerEnd),c=n.outerStart+m.length}return e}function In(s){let e=s,c=0;while(c<e.length){let a=$e(e,c);if(!a)break;let g=Fe(a.attrs,"v-text");if(g===null){c=a.end;continue}if(a.selfClosing){c=a.end;continue}let n=Se(e,a),d=be(a.attrs,"v-text"),y=a.selfClosing?" /":"",m=`<${a.tag}${d}${y}>{{ ${g} }}</${a.tag}>`;e=e.slice(0,n.outerStart)+m+e.slice(n.outerEnd),c=n.outerStart+m.length}return e}function On(s){return s.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 Ln(s){let e=s,c=0;while(c<e.length){let a=$e(e,c);if(!a)break;if(!Gt(a.attrs,"v-once")){c=a.end;continue}let g=be(a.attrs,"v-once"),n=Se(e,a),d=e.slice(n.outerStart,n.outerEnd),m=`@once
|
|
582
582
|
${De(d,{...a,start:0,end:a.end-a.start},g)}
|
|
583
|
-
@endonce`;e=e.slice(0,
|
|
584
|
-
<meta name="stx-build" content="${e}">`}var
|
|
583
|
+
@endonce`;e=e.slice(0,n.outerStart)+m+e.slice(n.outerEnd),c=n.outerStart+m.length}return e}function Pn(s){return s.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function jn(s){return s.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 Zt(s){if(!vn(s))return s;let e=s;return e=Sn(e),e=$n(e),e=Ln(e),e=Rn(e),e=Mn(e),e=An(e),e=_n(e),e=jn(e),e=Dn(e),e=In(e),e=On(e),e=Pn(e),e}function Xe(s){return s.replace(/--/g,"- -").replace(/</g,"<").replace(/>/g,">")}var nt=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"]),Nn=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function Jt(s,e){let c=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(s),a=c?c[1]:s,g=u(a,e);if(g&&typeof g==="string")return g;let n=a.trim();return nt.has(n)?n:null}function Qt(s){let e=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(s);return e?e[1]:s}function Yt(s,e,c){let a=e.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),g=a?`<${s} ${a}>`:`<${s}>`;if(Nn.has(s))return a?`<${s} ${a}>`:`<${s}>`;return`${g}${c}</${s}>`}async function er(s,e,c,a,g){let n=s,d=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,y=[],m;while((m=d.exec(n))!==null)y.push({full:m[0],expr:m[1],attrs:m[2],slotContent:m[3],index:m.index});for(let x=y.length-1;x>=0;x--){let w=y[x];try{let v=Jt(w.expr,e);if(!v||typeof v!=="string"){let j=`<!-- dynamic component: could not resolve "${Xe(Qt(w.expr))}" -->`;n=n.slice(0,w.index)+j+n.slice(w.index+w.full.length);continue}if(nt.has(v)){let j=Yt(v,w.attrs,w.slotContent);n=n.slice(0,w.index)+j+n.slice(w.index+w.full.length);continue}let k=w.attrs.trim(),S={},M=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,T;while((T=M.exec(k))!==null){let j=T[1]||T[2],N=T[3];if(T[1])try{S[j]=u(N,e)}catch{S[j]=N}else S[j]=N}let R=a.componentsDir||"components",D=await ze(v,S,w.slotContent,R,e,c,a,new Set,g??new Set);n=n.slice(0,w.index)+D+n.slice(w.index+w.full.length)}catch(v){let k=v instanceof Error?v.message:String(v),S=`<!-- dynamic component error: ${Xe(k)} -->`;n=n.slice(0,w.index)+S+n.slice(w.index+w.full.length)}}return n=await Hn(n,e,c,a,g),n}async function Hn(s,e,c,a,g){let n=s,d=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,y=[],m;while((m=d.exec(n))!==null)y.push({full:m[0],expr:m[1],attrs:m[2],index:m.index});for(let x=y.length-1;x>=0;x--){let w=y[x];try{let v=Jt(w.expr,e);if(!v||typeof v!=="string"){let M=`<!-- dynamic component: could not resolve "${Xe(Qt(w.expr))}" -->`;n=n.slice(0,w.index)+M+n.slice(w.index+w.full.length);continue}if(nt.has(v)){let M=Yt(v,w.attrs,"");n=n.slice(0,w.index)+M+n.slice(w.index+w.full.length);continue}let k=a.componentsDir||"components",S=await ze(v,{},"",k,e,c,a,new Set,g??new Set);n=n.slice(0,w.index)+S+n.slice(w.index+w.full.length)}catch(v){let k=v instanceof Error?v.message:String(v),S=`<!-- dynamic component error: ${Xe(k)} -->`;n=n.slice(0,w.index)+S+n.slice(w.index+w.full.length)}}return n}var ic="X-STX-Build",st=Symbol.for("stx.buildId");function as(){let s=globalThis;if(!s[st])s[st]=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return s[st]}function tr(s,e=as()){if(s.includes('name="stx-build"'))return null;if(!/<head\b[^>]*>/i.test(s))return null;return`
|
|
584
|
+
<meta name="stx-build" content="${e}">`}var Do="/_stx/sw.js";function Bn(s){if(typeof s!=="string"||!s.startsWith("/"))return null;let e=[],c=[],a=s.replace(/\/+$/,"").split("/").slice(1).map((g)=>{let n=/^:(\w+)$/.exec(g)||/^\[(\w+)\]$/.exec(g);if(n)return e.push(n[1]),c.push("0"),"([^/]+)";return c.push(g),g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")});if(!e.length)return null;return{path:s,re:`^/${a.join("/")}/?$`,names:e,sample:`/${c.join("/")}`}}function Fn(s){if(typeof navigator>"u"||!("serviceWorker"in navigator)||!navigator.serviceWorker)return;let e=navigator.serviceWorker,c=window;if(c.stxOffline)return;let a=null,g=!1,n=[],d={updateReady:!1,reachable:!0,reachedAt:0,registration:()=>a,onUpdateReady(w){if(d.updateReady)try{w()}catch{}else n.push(w);return()=>{let v=n.indexOf(w);if(v!==-1)n.splice(v,1)}},applyUpdate(){let w=a&&a.waiting;if(!w)return!1;return g=!0,w.postMessage({type:"stx:activate-update",force:!0}),!0}};c.stxOffline=d;let y=(w)=>{if(!w.waiting||!e.controller||d.updateReady)return;d.updateReady=!0;let v=n.splice(0);for(let k of v)try{k()}catch{}try{window.dispatchEvent(new CustomEvent("stx:offline-update-ready"))}catch{}};e.addEventListener("message",(w)=>{let v=w.data||{};if(v.type==="stx:updated")try{window.dispatchEvent(new CustomEvent("stx:updated",{detail:{url:v.url,kind:v.kind,fragment:!!v.fragment}}))}catch{}if(v.type==="stx:reachability"){if(c.stxOffline.reachable=v.reachable!==!1,Number(v.at)>0)c.stxOffline.reachedAt=Number(v.at);try{window.dispatchEvent(new CustomEvent("stx:reachability",{detail:{reachable:v.reachable!==!1,at:Number(v.at)||0}}))}catch{}}}),e.addEventListener("controllerchange",()=>{if(g)g=!1,location.reload()}),document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"&&a&&a.waiting)a.waiting.postMessage({type:"stx:activate-update",reason:"hidden"})});let m=()=>{e.register(s,{scope:"/"}).then((w)=>{a=w;try{e.controller?.postMessage({type:"stx:reachability?"})}catch{}if(w.waiting)y(w),w.waiting.postMessage({type:"stx:activate-update",reason:"load"});w.addEventListener("updatefound",()=>{let v=w.installing;if(!v)return;v.addEventListener("statechange",()=>{if(v.state==="installed")y(w)})})}).catch(()=>{})},x=()=>{let w=(v)=>{setTimeout(v,0)};if(typeof requestAnimationFrame==="function")requestAnimationFrame(()=>w(m));else w(m)};if(!e.controller)if(document.readyState==="complete")x();else addEventListener("load",x);else if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",x);else x()}function Un(){let s=`(${Fn.toString()})(${JSON.stringify("/_stx/sw.js")})`;try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(s).trim().replace(/;$/,"")}catch{return s}}function qn(s,e){if(typeof e==="string"&&e.startsWith("/"))return e==="/"?"/":e.replace(/\/+$/,"");if(!s||!s.startsWith("/"))return null;let c=s.split(/[?#]/)[0].split("/").filter(Boolean)[0];return c?`/${c}`:"/"}var rr=`<script data-stx-offline>${Un()}</script>`;function Lo(s,e){let c=Number(s.precacheTimeoutMs),a={build:String(e||"dev"),pages:Array.from(new Set((s.pages||[]).filter((g)=>typeof g==="string"&&g.startsWith("/")))),staticPages:(s.staticPages||[]).filter((g)=>typeof g==="string"&&((s.pages||[]).includes(g)||(s.routes||[]).includes(g))),api:s.apiPrefix||"/api/",timeout:Math.max(500,Number(s.networkTimeoutMs)||1500),precacheTimeout:Number.isFinite(c)&&c>0?Math.min(2147483647,Math.max(1,Math.floor(c))):1e4,networkFirst:(s.networkFirst||[]).filter((g)=>typeof g==="string"&&g.startsWith("/")),updateOnColdStart:s.updateOnColdStart===!0,fallback:s.fallback||s.pages&&s.pages[0]||null,fallbackScope:qn(s.fallback||s.pages&&s.pages[0]||null,s.fallbackScope),routes:(s.routes||[]).map(Bn).filter(Boolean),exclude:["/_stx/hmr","/_stx/sw.js",...s.exclude||[]],mediaMax:Math.max(10485760,Number(s.mediaMaxBytes)||629145600),assetsMax:Math.max(50,Number(s.assetsMaxEntries)||500)};return`/* stx offline worker, build ${a.build} */
|
|
585
585
|
'use strict';
|
|
586
586
|
var S = ${JSON.stringify(a)};
|
|
587
587
|
var SHELL = 'stx-shell-' + S.build;
|
|
@@ -1285,45 +1285,45 @@ self.addEventListener('fetch', function (event) {
|
|
|
1285
1285
|
event.respondWith(pageResponse(request, event));
|
|
1286
1286
|
}
|
|
1287
1287
|
});
|
|
1288
|
-
`}import Ie from"path";function
|
|
1289
|
-
`+" `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 c[or]=!0,c}async function ar(
|
|
1288
|
+
`}import Ie from"path";function nr(s){return s.startsWith("http://")||s.startsWith("https://")||s.startsWith("//")}async function ir(s,e,c){try{let a;if(s.startsWith("/")){let g=e;for(let n=0;n<5;n++){let d=Ie.join(g,s);if(await Bun.file(d).exists())return d;g=Ie.dirname(g)}a=Ie.join(e,s)}else if(s.startsWith("./")||s.startsWith("../"))a=Ie.resolve(e,s);else a=Ie.resolve(e,s);if(await Bun.file(a).exists())return a;return null}catch{return null}}var or=Symbol.for("stx.inline-assets.import-meta");function Vn(s,e){if(!s.includes("import.meta"))return;let c=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.
|
|
1289
|
+
`+" `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 c[or]=!0,c}async function ar(s,e,c){let a=s,g=Ie.dirname(e),n=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,d;while((d=n.exec(a))!==null){let[x,w,v,k]=d;if(nr(v))continue;let S=await ir(v,g,e);if(S)try{let M=await Bun.file(S).text();if(c.add(S),v.endsWith(".ts")||v.endsWith(".tsx")){let R=await Bun.build({entrypoints:[S],target:"browser",minify:!0,define:C()});if(R.outputs.length>0)M=await R.outputs[0].text(),Vn(M,v)}let T=`<script>
|
|
1290
1290
|
// Source: ${v}
|
|
1291
1291
|
${M}
|
|
1292
|
-
</script>`;a=a.replace(x,T),
|
|
1292
|
+
</script>`;a=a.replace(x,T),n.lastIndex=0}catch(M){if(M?.[or])throw M}}let y=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,m;while((m=y.exec(a))!==null){let[x,w,v,k]=m,S=w+k;if(nr(v))continue;if(/rel=["']stylesheet["']/.test(S)||v.endsWith(".css")){let T=await ir(v,g,e);if(T)try{let R=await Bun.file(T).text();c.add(T);let D=`<style>
|
|
1293
1293
|
/* Source: ${v} */
|
|
1294
1294
|
${R}
|
|
1295
|
-
</style>`;a=a.replace(x,D),y.lastIndex=0}catch(R){}}}return a}import it from"path";var Wn=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,Xn=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function zn(
|
|
1296
|
-
`,a+2),a===-1)return-1;a+=1,g=!0;continue}if(y==="/"&&
|
|
1297
|
-
`){m=-1;break}m++}if(m===-1){a++,g=!1;continue}while(m<c&&/[a-z]/.test(
|
|
1298
|
-
`)break;a++}g=!1;continue}if(y==="`"){a++;while(a<c){if(
|
|
1299
|
-
`+
|
|
1300
|
-
`+
|
|
1301
|
-
`+
|
|
1302
|
-
`),...x.htmlAttrs&&{htmlAttrs:
|
|
1295
|
+
</style>`;a=a.replace(x,D),y.lastIndex=0}catch(R){}}}return a}import it from"path";var Wn=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,Xn=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function zn(s,e){if(!e||!s.includes("/"))return s;let c=it.dirname(e);return s.replace(Wn,(a,g,n,d)=>{let y=it.resolve(c,d);return`${g}${n}${y.split(it.sep).join("/")}${n}`})}function cr(s,e){if(!e||!s.includes("<script"))return s;return s.replace(Xn,(c,a,g,n)=>`${a}${zn(g,e)}${n}`)}var Ee="<!--PARENT_CONTENT_PLACEHOLDER-->";function dr(s){return s.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function vr(s,e){let c=s.length,a=e,g=!0,n=[],d=(y)=>y+9<=c&&s[y]==="<"&&s[y+1]==="/"&&(s[y+2]==="s"||s[y+2]==="S")&&(s[y+3]==="c"||s[y+3]==="C")&&(s[y+4]==="r"||s[y+4]==="R")&&(s[y+5]==="i"||s[y+5]==="I")&&(s[y+6]==="p"||s[y+6]==="P")&&(s[y+7]==="t"||s[y+7]==="T")&&(s[y+8]===">"||/\s/.test(s[y+8]));while(a<c){let y=s[a];if(d(a))return a;if(y==="/"&&s[a+1]==="/"){if(a=s.indexOf(`
|
|
1296
|
+
`,a+2),a===-1)return-1;a+=1,g=!0;continue}if(y==="/"&&s[a+1]==="*"){let m=s.indexOf("*/",a+2);if(m===-1)return-1;a=m+2,g=!0;continue}if(y==="/"&&g){let m=a+1,x=!1;while(m<c){let w=s[m];if(w==="\\"){m+=2;continue}if(w==="[")x=!0;else if(w==="]")x=!1;else if(w==="/"&&!x){m++;break}else if(w===`
|
|
1297
|
+
`){m=-1;break}m++}if(m===-1){a++,g=!1;continue}while(m<c&&/[a-z]/.test(s[m]))m++;a=m,g=!1;continue}if(y==="'"||y==='"'){let m=y;a++;while(a<c){if(s[a]==="\\"){a+=2;continue}if(s[a]===m){a++;break}if(s[a]===`
|
|
1298
|
+
`)break;a++}g=!1;continue}if(y==="`"){a++;while(a<c){if(s[a]==="\\"){a+=2;continue}if(s[a]==="`"){a++;break}if(s[a]==="$"&&s[a+1]==="{"){n.push(!0),a+=2,g=!0;break}a++}if(n.length===0)g=!1;continue}if(y==="}"&&n.length>0){n.pop(),a++;while(a<c){if(s[a]==="\\"){a+=2;continue}if(s[a]==="`"){a++,g=!1;break}if(s[a]==="$"&&s[a+1]==="{"){n.push(!0),a+=2,g=!0;break}a++}continue}if(/\s/.test(y));else if(/[)\].\w$]/.test(y))g=!1;else g=!0;a++}return-1}function kr(s,e){let c=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`<script\\b(?=[^>]*\\b${c}(?:\\s|=|/?>))[^>]*>`,"i").exec(s);if(!a)return null;let g=a.index+a[0].length,n=s.indexOf("</script>",g);if(n===-1)return null;let d=s.indexOf(">",n);if(d===-1)return null;return{start:a.index,end:d+1}}var Gn=4096;async function ot(s,e,c){if(c.buildMode!=="serve"||e.length<Gn)return null;let{registerServeModuleBundle:a}=await import("./chunk-7mz6ze0x.js");return`<script ${s} src="${a(e)}"></script>`}async function sr(s,e,c,a){try{let{registeredModuleIdsIn:g,buildModuleRegistryScript:n}=await o("stx/client-module-registry",()=>import("./chunk-53j9wakh.js")),d=[],y=await n(g(...s),{minify:Pi(e.buildMode,e.minifyClient),collectInputs:d});for(let m of d)c?.add(m);if(a)a.inputs=d,a.code=y??void 0;if(!y)return null;if(e.buildMode==="serve"){let{registerServeModuleBundle:m}=await import("./chunk-7mz6ze0x.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${m(y)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${y.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}async function Zn(s,e,c,a){let g={modulesTag:null,modulesCode:null,storeTag:null,storeCode:null,composableTag:null,composableCode:null,frameworkScript:null};try{let{getFrameworkComposableScript:k}=await o("stx/framework-composables",()=>import("./chunk-mv49hr9y.js"));g.frameworkScript=await k(s)}catch{}let n=null;try{n=await o("stx/store-loader",()=>import("./chunk-phxkmjnw.js"))}catch{}let d=e.storesDir,y=!!a.__stx_native_screen||(n?.pageStoresAll()??!0),m=y?"":s.replace(/<script\b[^>]*\bdata-stx-(?:runtime|router|hmr)\b[^>]*>[\s\S]*?<\/script>/gi,""),x=[],w=[],v=null;for(let k=0;k<8;k++){let S=null,M="",T=!1;try{if(n){let N=y?await n.getStoreScript(d).then((F)=>F?{code:F,stores:["*"],functions:null}:null):await n.getStoreScriptFor(d,[m],{reads:n.storesReadInFiles([...x,...w]),runOnce:!0});if(N)S=N.code,M=N.stores.join(","),T=!!N.functions&&!y}}catch{}if(v!==null&&M===v)break;v=M;let R=T?'data-stx-scoped data-stx-run="always" data-stx-stores':"data-stx-stores",D=S?`<script ${R}>${S}</script>`:null;g.storeCode=S,g.storeTag=S?await ot(R,S,e)??D:null;let j={};g.modulesTag=await sr([s,D],e,c,j),g.modulesCode=j.code??null,x=j.inputs??[],g.composableTag=null,g.composableCode=null,w=[];try{let{getComposableScript:N}=await o("stx/composable-loader",()=>import("./chunk-7t9951at.js")),F=e.composablesDir,I=[g.modulesCode??g.modulesTag,D,g.frameworkScript].filter((H)=>H!==null),L=await N(e._layerComposableDirs??F,s,I,w);if(L)g.composableCode=L,g.composableTag=await ot('data-stx-scoped data-stx-run="always" data-stx-composables',L,e)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${L}</script>`}catch{}if(y||!n)break}return g}async function Jn(s,e,c,a={}){let{withModuleSubstitutes:g,moduleSubstitutionKey:n}=await import("./chunk-8byydry7.js"),d=await import("./chunk-sv2d6nfe.js"),{messages:y,webModules:m}=e,x=null,w=null,v=n()===""&&!a.__stx_native_screen;if(y&&d.pageMessagesEnabled(e)&&v)try{x=await d.loadPageMessages(process.cwd(),y)}catch(R){Qn(R)}if(m&&Object.keys(m).length&&v)try{w=await(await import("./chunk-97k72dfh.js")).loadWebModules(process.cwd(),m)}catch(R){Yn(R)}let k=new Map([...w??[],...x?.stubs??[]]),S=()=>Zn(s,e,c,a),M=k.size?await g(k,S):await S(),T=null;if(x){let R=d.messageAreasIn(M.modulesCode,M.storeCode,M.composableCode),D=d.pageMessagesScript(x,d.pageLanguages(s,x),R);if(D)T=await ot('data-stx-scoped data-stx-run="always" data-stx-messages',D,e)??`<script data-stx-scoped data-stx-run="always" data-stx-messages>${D.replace(/<\/script/gi,"<\\/script")}</script>`}return[T,M.modulesTag,M.storeTag,M.composableTag,M.frameworkScript].filter((R)=>R!==null)}var pr=!1;function Qn(s){if(pr)return;pr=!0,console.warn(`[stx] messages: ${s instanceof Error?s.message:String(s)}; pages ship every language`)}var gr=!1;function Yn(s){if(gr)return;gr=!0,console.warn(`[stx] ${s instanceof Error?s.message:String(s)}; pages bundle the real modules`)}function es(s,e=""){let c=kr(s,"data-stx-runtime");if(!c)return s;let a=lr(s);if(a===-1||a===c.start){if(!e)return s;return s.slice(0,c.end)+e+s.slice(c.end)}if(a<c.start)return s.slice(0,a)+s.slice(c.start,c.end)+e+`
|
|
1299
|
+
`+s.slice(a,c.start)+s.slice(c.end);let g=s.slice(c.start,c.end),n=s.slice(0,c.start)+s.slice(c.end),d=lr(n);if(d===-1)return g+e+`
|
|
1300
|
+
`+n;return n.slice(0,d)+g+e+`
|
|
1301
|
+
`+n.slice(d)}function ts(s){let e=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return s.replace(e,(c,a,g)=>{let n=s.slice(0,g);return n.lastIndexOf("<")>n.lastIndexOf(">")?`{{${a}}}`:`{<!--stx-literal-->{${a}}}`})}async function i(s,e,c,a,g){if(await A(),a.ssr===!1&&!a.autoShell&&a.buildMode==="spa")return s;if(e.__stx_signals_gate===void 0)e.__stx_signals_gate=ke(s,c);let n=!e.__stxProcessingDepth;bn(e);for(let d of a._layerGraph?.configDependencies??[])g.add(d);if(n&&a.runtimeConfig)await kn(e,c,a.runtimeConfig);if(n)qc(e),e.__stx_scope_seq??={n:0,key:Ws(String(e.__filename??c))},e.__stx_head_injections=$i(),e.__stx_seo_staged=!1;if(!e.__stxProcessingDepth)e.__stxProcessingDepth=0;if(e.__stxProcessingDepth++,!e.__onceStore)e.__onceStore=new Set;if((a.debug||!E()&&!Tn())&&c&&c.endsWith(".stx"))jo(s,c);try{return await ae.timeAsync("template-processing",async()=>{let d=await rs(s,e,c,a,g);if(n)d=hi(d);if(n&&a.autoShell&&a.buildMode!=="compile"){let y=Ce(a.app?.head,{known:Nr,source:"app.head"}),x=(e.__stx_runtime_head||null)??Ai(),w=(e.__stx_head_raw||"").trim(),v,k=w.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(k)v=k[1].trim(),w=w.replace(k[0],"").trim();let S=e.__sections?.title,M=S?_(S,e,c):void 0,T=x.title||v||M,R=!x.title&&(!!v||!!M),D=x.meta||[],j=new Set(D.map((V)=>at(V)).filter(Boolean)),N={...y,...T&&{title:T},meta:[...(y.meta||[]).filter((V)=>!j.has(at(V))),...D],link:[...y.link||[],...x.link||[]],script:[...y.script||[],...x.script||[]],headRaw:[y.headRaw,w].filter(Boolean).join(`
|
|
1302
|
+
`),...x.htmlAttrs&&{htmlAttrs:ll(y.htmlAttrs,x.htmlAttrs)},...x.bodyAttrs&&{bodyAttrs:{...y.bodyAttrs||{},...x.bodyAttrs}}},F=Ri(d);if(d=Ir(d,N,{...R&&{titleIsHtml:!0},...a.app?.colorMode&&{colorMode:a.app.colorMode}},F),F)d=dl(d,y),d=Pr(d,N.htmlAttrs);let I=d.match(/<!-- stx-layout: ([^ ]+) -->/);if(I&&d.includes("<head")){let V=I[1],X=Is(V);d=d.replace(/<head\b[^>]*>/i,(ee)=>`${ee}
|
|
1303
1303
|
<meta name="stx-layout" content="${dr(V)}">
|
|
1304
|
-
<meta name="stx-layout-group" content="${dr(X)}">`)}let L=d.match(/function (__stx_setup_\w+)\(/),H=L?B(d):null;if(L&&H&&!/\bdata-stx=/.test(H.tag)){d=Ze(d,(X,ee)=>`<body${ee} data-stx="${L[1]}">`);let V=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${L[1]}"`,"i");d=d.replace(V,"$1")}}if(
|
|
1305
|
-
${x}`).join(""))}else{let m=await
|
|
1306
|
-
`+d.slice(x)}}if(
|
|
1304
|
+
<meta name="stx-layout-group" content="${dr(X)}">`)}let L=d.match(/function (__stx_setup_\w+)\(/),H=L?B(d):null;if(L&&H&&!/\bdata-stx=/.test(H.tag)){d=Ze(d,(X,ee)=>`<body${ee} data-stx="${L[1]}">`);let V=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${L[1]}"`,"i");d=d.replace(V,"$1")}}if(n){let y=e.__stx_head_injections??$i(),m=ul(d);if(m!==null)y.beforeClose.push(m);let x=tr(d);if(x!==null)y.afterOpen.push(x);if(a.offline?.enabled&&!d.includes("data-stx-offline"))y.beforeClose.push(rr);d=al(d,y);let w=a.app?.colorMode;if(w)d=Ar(d,w)}if(n)if(kr(d,"data-stx-runtime")){let m=await Jn(d,a,g,e);d=es(d,m.map((x)=>`
|
|
1305
|
+
${x}`).join(""))}else{let m=await sr([d],a,g);if(m){let x=d.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(x!==-1)d=d.slice(0,x)+m+`
|
|
1306
|
+
`+d.slice(x)}}if(n)d=cl(d);if(n&&e.__stx_inject_css!==!1)d=await b(d,void 0,a.buildMode==="serve",!0);else if(n)d=hn(d);if(n)d=dt(d);if(d=d.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),d=ts(d),n&&e.__stx_runtime_config)d=jt(d,e.__stx_runtime_config);if(n&&!e.__stx_defer_server_data){let y=Er(e);if(y){let m=/<head\b[^>]*>/i.exec(d),x=m?m.index+m[0].length:0;d=d.slice(0,x)+y+d.slice(x)}}return d})}catch(d){if(d instanceof K)throw d;let y=d instanceof Error?d.message:String(d),m=new ce(`Template processing failed: ${y}`,c,void 0,void 0,s.substring(0,200)+(s.length>200?"...":""));if(z.log(m,{filePath:c,context:e}),Cn.logDetailedError(m,{filePath:c,template:s.substring(0,500)}),E()&&!a.debug)console.error(`[stx] ${ie.relative(process.cwd(),c)||c}: ${m.message}`);if(a.debug)throw m;return Ei.createFallbackContent("Template Processing",m)}}async function rs(s,e,c,a,g){let n=process.cwd(),d={...a,partialsDir:a.partialsDir&&!ie.isAbsolute(a.partialsDir)?ie.resolve(n,a.partialsDir):a.partialsDir,componentsDir:a.componentsDir&&!ie.isAbsolute(a.componentsDir)?ie.resolve(n,a.componentsDir):a.componentsDir,layoutsDir:a.layoutsDir&&!ie.isAbsolute(a.layoutsDir)?ie.resolve(n,a.layoutsDir):a.layoutsDir},y=d,m=s;await is(c,e),ss(e,y),m=await _e(()=>Wt(m,e,c,y),m,(I)=>{z.log(I,{filePath:c,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${c}: ${I.message}`)}),m=m.replace(/\{\{--[\s\S]*?--\}\}/g,"");let x=fe(m,Me,(I,L)=>`\x00STX_HTML_COMMENT_${L}\x00`);m=x.output;let w=x.tokens,v=(I)=>w.length===0?I:I.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(L,H)=>w[Number(H)]??""),k="\x00STX_ESCAPED_AT\x00",S="\x00STX_ESC_MUSTACHE_OPEN\x00",M="\x00STX_ESC_MUSTACHE_CLOSE\x00";m=m.replace(/@@/g,k),m=m.replace(/@\{\{([\s\S]*?)\}\}/g,(I,L)=>`${S}${L}${M}`),m=Zt(m),m=await ar(m,c,g);let T={};m=ls(m,T);let R={...e.__sections||{}},D="",j=yt(bt(s)),N=/@nolayout\b/.test(m)||j===!1;if(/@nolayout\b/.test(m))m=m.replace(/@nolayout\b\s*/g,"");let F=m.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F)D=F[1],m=m.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof j==="string"){if(D=j,!/@section\s*\(/.test(m))m=`@section('content')
|
|
1307
1307
|
${m.trim()}
|
|
1308
|
-
@endsection`}if(!D&&!N&&y.defaultLayout){let I=
|
|
1308
|
+
@endsection`}if(!D&&!N&&y.defaultLayout){let I=En(m),L=/@section\s*\(/.test(m);if(!I||L){let H="",V=ie.dirname(c),X=y.layoutsDir?ie.dirname(y.layoutsDir):process.cwd();for(let ee=0;ee<20;ee++){let te=ie.join(V,"_layout.stx");if(await r(te)){H=te;break}let re=ie.dirname(V);if(re===V||re.length<X.length)break;V=re}if(H)D=H;else if(y.layoutsDir){let ee=ie.isAbsolute(y.layoutsDir)?y.layoutsDir:ie.resolve(process.cwd(),y.layoutsDir),te=ie.join(ee,`${y.defaultLayout}.stx`);if(await r(te))D=te}if(D&&!L)m=`@section('content')
|
|
1309
1309
|
${m.trim()}
|
|
1310
|
-
@endsection`}}if(D&&m.includes("<script")){let I=J(m),L=I.scripts.map((H)=>
|
|
1310
|
+
@endsection`}}if(D&&m.includes("<script")){let I=J(m),L=I.scripts.map((H)=>mr(H,c)??H);m=xr(I.output,L)}if(m=m.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(I,L,H)=>(R[L]=H,"")),m=m.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(I,L,H)=>{if(/^(['"]).*\1$/.test(H.trim()))return I;try{let V=u(H.trim(),e);if(V===void 0)return I;let ee=(e.__stx_inline_section_values??=[]).push(V)-1;return R[L]=`{{ __stx_inline_section_values[${ee}] }}`,""}catch{return I}}),m=m.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(I,L,H)=>{if(H.includes("@parent"))R[L]=H.replace("@parent",Ee);else R[L]=H.trim();return""}),e.__sections=R,m=m.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(I,L,H)=>R[L]||H||""),!("slot"in e)||e.slot===void 0)m=m.replace(/\{\{\s*slot\s*\}\}/g,()=>R.content||"");if(m=us(m,T),D){let I=[],L=J(m),H=fe(L.output,mn,(V,X)=>`\x00STX_ORPHAN_STYLE_${X}\x00`);if(m=H.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(V,X,ee)=>{let te=X==="SCRIPT"?mr(L.scripts[Number(ee)],c):H.tokens[Number(ee)];if(te)I.push(te);return""}),I.length>0){let V=I.join(`
|
|
1311
1311
|
`);R.content=R.content?`${R.content}
|
|
1312
|
-
${V}`:V,e.__sections=R}}if(D)try{let I;if(ie.isAbsolute(D))I=D,g.add(D);else I=await _e(()=>
|
|
1313
|
-
${m}`,v(m)}catch(I){if(I instanceof K)throw I;throw new ce(`Error processing layout ${D}: ${I instanceof Error?I.message:String(I)}`,c)}return v(await wr(m,e,c,d,g))}function ns(
|
|
1314
|
-
`;if(
|
|
1312
|
+
${V}`:V,e.__sections=R}}if(D)try{let I;if(ie.isAbsolute(D))I=D,g.add(D);else I=await _e(()=>xn(D,c,d,g),null,()=>{throw new ce(`Failed to resolve layout path: ${D}`,c,void 0,void 0,`Layout referenced from ${c}`)});if(!I){let te=(G)=>{if(!G)return[];try{let me=ie.isAbsolute(G)?G:ie.resolve(process.cwd(),G);return Kn.readdirSync(me).filter((ve)=>ve.endsWith(".stx")).map((ve)=>ve.replace(/\.stx$/,""))}catch{return[]}},re=[...te(d.layoutsDir),...te(d.fallbackLayoutsDir)].filter((G,me,ve)=>ve.indexOf(G)===me).sort(),le=[d.layoutsDir,d.fallbackLayoutsDir].filter((G)=>typeof G==="string"&&G.length>0),de=le.length>0?` Searched: ${le.join(", ")} (set \`layoutsDir\` to look elsewhere).`:"",se=`Layout not found: ${D} (referenced from ${c})`+(re.length>0?`. Available layouts: ${re.join(", ")}`:d.layoutsDir?`. No .stx layouts found in ${d.layoutsDir}`:"")+de;if(z.log(Error(se),{layoutPath:D,filePath:c,available:re},"error"),console.error(`[stx] ${se}`),d.debug)throw new ce(se,c);return m}let L=await _e(()=>Bun.file(I).text(),"",()=>{throw new ce(`Failed to read layout file: ${I}`,c,void 0,void 0,"Layout content could not be loaded")});L=cr(L,I);let H=L.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(H){if(d.debug)console.log(`Found nested layout: ${H[1]} in ${I}`);let te={},re=L.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(se,G,me)=>(te[G]=me.trim(),""));for(let[se,G]of Object.entries(te))if(R[se]&&R[se].includes(Ee)){let me=R[se].indexOf(Ee);R[se]=R[se].slice(0,me)+G+R[se].slice(me+Ee.length)}else if(!R[se])R[se]=G;let le={...e,__sections:R},de=`@layout('${H[1]}')${re}`;return await i(de,le,I,d,g)}let V=L.replace(/\{\{--[\s\S]*?--\}\}/g,""),X=ls(V,T),ee={};return X=X.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(te,re,le)=>(ee[re]=le.trim(),`@slot('${re}')`)),X=X.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(te,re,le)=>{if(R[re]){let de=R[re];if(de.includes(Ee)){let se=ee[re]||"",G=de.indexOf(Ee);de=de.slice(0,G)+se+de.slice(G+Ee.length)}return de}return le||""}),X=ns(X,R),X=X.replace(/\{\{\s*slot\s*\}\}/g,()=>R.content||""),X=us(X,T),e.__originalFilePath=c,m=await wr(X,e,I,d,g),m=`<!-- stx-layout: ${D} -->
|
|
1313
|
+
${m}`,v(m)}catch(I){if(I instanceof K)throw I;throw new ce(`Error processing layout ${D}: ${I instanceof Error?I.message:String(I)}`,c)}return v(await wr(m,e,c,d,g))}function ns(s,e){return s.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(c,a,g)=>{let n=e[a];if(n!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(n))return n}return g||""})}function ss(s,e){if(s.__stx_sfc_mode=!0,s.__stx_options=e,e.buildMode)s.__stx_buildMode=e.buildMode;let c=e.envPrefix||"STX_PUBLIC_",a={};for(let[g,n]of Object.entries(process.env))if(g.startsWith(c)&&n!==void 0)a[g]=n;s.$env=a}async function is(s,e){await _e(()=>Kt(s,e),void 0,(c)=>{z.log(c,{filePath:s,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${s}: ${c.message}`)})}var ct="data-stx-source";function mr(s,e){if(!s)return s;let c=/^<script\b([^>]*)>/i.exec(s);if(!c||!/\bserver\b/.test(c[1])||c[1].includes(ct))return s;return`<script ${ct}="${encodeURIComponent(e)}"${s.slice(7)}`}function os(s){let e=new RegExp(`${ct}="([^"]*)"`).exec(s);return e?decodeURIComponent(e[1]):void 0}function yr(s){return s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function br(s,e,c){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">${yr(s)}</span><span style="display:block;margin-top:4px">${yr(c)}</span></div>`}async function ds(s,e,c,a){let{scanScriptTags:g}=await o("stx/signal-processing",()=>import("./chunk-sm9f980t.js")),n=[],d=!E()&&!Tn();for(let m of g(s)){let x=m.attrs;if(!/\bserver\b/.test(x))continue;let w=m.start+m.fullMatch.indexOf(">")+1,v=vr(s,w);if(v===-1)continue;let k=s.slice(w,v);if(!k.trim())continue;let S=os(x)??c,M={index:m.start,length:v+9-m.start};try{let{extractVariables:T}=await o("stx/variable-extractor",()=>import("./chunk-aywvbcae.js"));await T(k,e,S,{preserveExisting:!0,onFailure:(R)=>{if(R.kind==="unknown")return;if(a?.onServerScriptError?.({sourcePath:S,kind:R.kind,message:R.message}),!d)return;n.push({...M,markup:br(S,R.kind,R.message)})}})}catch(T){let R=T instanceof Error?T:Error(String(T));if(z.log(R,{filePath:S,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${S}: ${R.message}`),d)n.push({...M,markup:br(S,"unknown",R.message)})}}if(n.length===0)return s;let y=s;for(let m of n.sort((x,w)=>w.index-x.index))y=y.slice(0,m.index)+m.markup+y.slice(m.index+m.length);return y}async function fs(s,e,c){try{let{interpolateScriptsInTemplate:a}=await o("stx/expressions",()=>import("./chunk-nb2tedk0.js"));return a(s,e,{skipServer:!0})}catch(a){let g=a instanceof Error?a:Error(String(a));return z.log(g,{filePath:c,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${c}: ${g.message}`),s}}async function wr(s,e,c,a,g){let n=s;await A();let d=a;if(n=await ds(n,e,c,a),n=await Nt(n,e,c),n=await Ft(n,e,c),n=await fs(n,e,c),await A(),n=await Ct(n,e,c,d),ke(n))n=Ko(n,e),n=bs(n,e),n=ys(n,e);n=Xo(n),await A();let{processStreamDirectives:y}=await o("stx/streaming",()=>import("./chunk-s85chp3w.js"));n=y(n,e),n=await Ho(n,e,c,d,!0),await A(),n=await er(n,e,c,d,g),n=await ps(n,e,c,d,g),await A(),n=mc(n,e,c,d);let{processDeferDirectives:m}=await o("stx/defer",()=>import("./chunk-d5vr9g4b.js"));n=m(n,e,c);let{processTeleportDirectives:x}=await o("stx/teleport",()=>import("./chunk-r5bhgyes.js"));n=x(n,e,c);let{processTransitionDirectives:w,processTransitionAttributes:v}=await o("stx/transitions",()=>import("./chunk-y64qhgv1.js"));n=w(n,e,c),n=v(n);let{processErrorBoundaryDirectives:k,stripRenderFailedMarkers:S}=await o("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));n=k(n,e,c),n=S(n);let{processSuspenseDirectives:M}=await o("stx/suspense",()=>import("./chunk-d44g9sek.js"));n=M(n,e,c);let{processAsyncDirectives:T}=await o("stx/async-components",()=>import("./chunk-41sh9y5w.js"));n=T(n,e,c);let{processKeepAliveDirectives:R}=await o("stx/keep-alive",()=>import("./chunk-gaxx0z19.js"));n=R(n,e,c);let{processVirtualListDirectives:D,processVirtualGridDirectives:j,processInfiniteListDirectives:N}=await o("stx/virtual-scrolling",()=>import("./chunk-yjskeqaj.js"));n=D(n,e,c),n=j(n,e,c),n=N(n,e,c),await A();let{processPartialHydrationDirectives:F,processStaticDirectives:I}=await o("stx/partial-hydration",()=>import("./chunk-h8h79939.js"));n=F(n,e,c),n=I(n);let{processComputedDirectives:L,processWatchDirectives:H}=await o("stx/computed",()=>import("./chunk-1xdzcy9d.js"));n=L(n,e,c),n=H(n,e,c);let{processFormValidationDirectives:V}=await o("stx/forms-validation",()=>import("./chunk-cax1wts7.js"));n=V(n,e,c);let{processHeadDirective:X,processTitleDirective:ee,processMetaDirective:te,resetHead:re}=await o("stx/head",()=>import("./chunk-ksc83y9t.js"));if(!e.__stx_head_preset&&!e.__stx_runtime_head)re();let le=X(n);if(n=le.content,le.headContent)e.__stx_head_raw=`${e.__stx_head_raw||""}${le.headContent}
|
|
1314
|
+
`;if(n=ee(n,e),n=te(n,e,c),n=zt(n),n=Vo(n,e),n=_t(n),n=qt(n),n=await cs(n,e,c,d,g),n=await ps(n,e,c,d,g),await A(),n=n.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),n=hi(n),n=oe(n,e,c),n=gs(n),await A(),e.__stxProcessingDepth===1)n=Kc(n,e);if(n=zc(n,e,{filePath:c,buildMode:d.buildMode}),n=Uo(n,e),n=Wo(n,e),n=We(n,e),n=Lt(n,e),n=Pt(n,e),n=await wt(n,e,c,d),n=await yc(n,e,c),n=await bc(n,e,c,d),await A(),n=wc(n,e,c,d),n=ti(n,e,c,d),n=ni(n,e,c),n=ri(n,e,c,d),n=Et(n,e,c,d),n=Vs(n,e),n=Us(n),n=Vc(n),!d.skipEventDirectives)n=Pc(n,e,c);if(n=Hc(n,e,c,a.skipSignalsRuntime===!0&&Number(e.__stxProcessingDepth)>0),await A(),d.debug){let U=/\bx-data\s*=/.test(n),q=hs(s);if(U&&q)console.warn(`[stx] ${c}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
1315
1315
|
Both work on the same page, but they manage separate scopes.
|
|
1316
|
-
Prefer signals (state/derived/effect) for new components.`)}
|
|
1316
|
+
Prefer signals (state/derived/effect) for new components.`)}n=uc(n,e),n=await _(n,e,c),await A(),n=Uc(n),n=Wc(n),n=mt(n);let{processXElementDirectives:de}=await o("stx/x-element",()=>import("./chunk-zhxdpzga.js"));n=de(n);let se=e.__originalFilePath||c,G=Le(e);if(n=await Go(n,d,se,G),await A(),n=Dt(n,e),n=await Xt(n,e,c,d),await A(),d.media?.image?.autoSiblings){let U=d.publicDir||"public",{rewriteImagesWithSiblings:q}=await o("stx/image-optimization/auto-sibling",()=>import("./chunk-rzfbffnv.js"));n=await q(n,{publicDir:U})}if(d.seo?.enabled)n=si(n,e,d);let me=(U,q,Z=!0)=>{if(!q)return U;let he=q.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),ne=/<head\b[^>]*>[\s\S]*?(?:<\/head\s*>|<body\b|$)/i.exec(U),pe=ne?/<title\b[^>]*>[\s\S]*?<\/title>/i.exec(ne[0]):null;if(he&&ne&&pe){if(Z){let Te=ne.index+pe.index;U=U.slice(0,Te)+he[0]+U.slice(Te+pe[0].length)}if(q=q.replace(he[0],"").trim(),!q)return U}if(/<\/head>/i.test(U))return U.replace(/<\/head>/i,`${q}
|
|
1317
1317
|
</head>`);if(/<head\b[^>]*>/i.test(U))return U.replace(/(<head\b[^>]*>)/i,`$1
|
|
1318
1318
|
${q}`);if(/<html\b[^>]*>/i.test(U))return U.replace(/(<html\b[^>]*>)/i,`$1
|
|
1319
1319
|
<head>
|
|
1320
1320
|
${q}
|
|
1321
|
-
</head>`);return U},{renderHead:ve,getHead:Sr}=await o("stx/head",()=>import("./chunk-
|
|
1321
|
+
</head>`);return U},{renderHead:ve,getHead:Sr}=await o("stx/head",()=>import("./chunk-ksc83y9t.js")),Oe=e.__stx_runtime_head??Sr();if(Oe.title||Oe.meta?.length||Oe.link?.length){let U=ve(Oe);if(U)n=me(n,U)}if(le.headContent)n=me(n,le.headContent,!Oe.title);if(d.csp?.enabled&&d.csp.addMetaTag)n=St(n,d.csp,e);if(d.analytics?.enabled)n=ht(n,d);if(d.heatmap?.enabled)n=hc(n,d);if(d.pwa?.enabled&&d.pwa.autoInject!==!1){let{injectPwaTags:U}=await o("stx/pwa/inject",()=>import("./chunk-b6w3457c.js"));n=U(n,d)}let $r=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(n),Tr=/\bSTX\.\w+/.test(n),_r=/window\.STX\s*=/.test(n);if($r&&Tr&&!_r){let q=`<script data-stx-scoped data-stx-run="once">
|
|
1322
1322
|
${pt()}
|
|
1323
|
-
</script>`;if(
|
|
1324
|
-
`+Te}else
|
|
1325
|
-
</head>`)}else if(
|
|
1326
|
-
${q}`);else
|
|
1327
|
-
`+
|
|
1328
|
-
`+
|
|
1329
|
-
export{bt,Ae,
|
|
1323
|
+
</script>`;if(n.includes("</head>")){let Z=n.indexOf("</head>"),ne=n.slice(0,Z).indexOf("<script");if(ne!==-1){let pe=n.slice(0,ne),Te=n.slice(ne);n=pe+q+`
|
|
1324
|
+
`+Te}else n=n.replace("</head>",`${q}
|
|
1325
|
+
</head>`)}else if(n.includes("<body"))n=n.replace(/<body([^>]*)>/,`<body$1>
|
|
1326
|
+
${q}`);else n=q+`
|
|
1327
|
+
`+n}{let{scanScriptTags:U}=await o("stx/signal-processing",()=>import("./chunk-sm9f980t.js")),q=[];for(let Z of U(n)){if(!/\bserver\b/i.test(Z.attrs))continue;let he=Z.start+Z.fullMatch.indexOf(">")+1,ne=vr(n,he);if(ne===-1)continue;let pe=ne+9;while(pe<n.length&&/\s/.test(n[pe]))pe++;q.push({start:Z.start,end:pe})}if(q.length>0){let Z=Array(q.length+1),he=0;for(let ne=0;ne<q.length;ne++){let{start:pe,end:Te}=q[ne];Z[ne]=n.slice(he,pe),he=Te}Z[q.length]=n.slice(he),n=Z.join("")}}let lt=zs(n,c);if(lt.hasScoped)n=lt.html;let Cr=e.__stx_event_bindings||[],Ke=!1,ut=[],Rr=/\s:[a-z][\w.-]*\s*=/.test(n),{scanScriptTags:Mr}=await o("stx/signal-processing",()=>import("./chunk-sm9f980t.js"));for(let U of Mr(n,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))ut.push({match:U.fullMatch,attrs:U.attrs,content:U.body});for(let{match:U,attrs:q,content:Z}of ut){Ke=!0;let he=Z;Ne(Z,c,a.strict,e.__originalFilePath);let ne=await je(Z,{eventBindings:Cr,attrs:q,hasColonDirectives:Rr,templateContent:s,filePath:c,projectRoot:process.cwd(),production:Pi(a.buildMode,a.minifyClient),serverData:G});n=n.replace(U,()=>ne)}if(Ke)e.__stx_event_bindings=[];if(!Ke&&e.__stxProcessingDepth===1){let U=e.__stx_event_bindings||[];if(U.length>0){let q=ui(U);if(q){let Z=n.lastIndexOf("</body>");n=Z===-1?n+q:n.slice(0,Z)+q+`
|
|
1328
|
+
`+n.slice(Z)}e.__stx_event_bindings=[]}}if(!d.skipSignalsRuntime&&!we(n)&&pc(n))n=await ur(n,d);if(n=fc(n),d.csp?.enabled&&d.csp.useNonce&&typeof e.cspNonce==="string")n=$t(n,e.cspNonce);return n}
|
|
1329
|
+
export{bt,Ae,ic,as,Do,Lo,sr,i};
|