@stacksjs/stx 0.2.889 → 0.2.890
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-1n33yrar.js → chunk-062qfv99.js} +2 -2
- package/dist/{chunk-2a5g80mq.js → chunk-0jdz31q1.js} +3 -3
- package/dist/{chunk-mhxg6j6s.js → chunk-0jkj8thz.js} +1 -1
- package/dist/chunk-0q0nbq50.js +2 -0
- package/dist/{chunk-kj43fbzm.js → chunk-0wp23n1d.js} +1 -1
- package/dist/{chunk-cz1sdes5.js → chunk-115bb91s.js} +2 -2
- package/dist/{chunk-w82nk19t.js → chunk-12cjs6vs.js} +1 -1
- package/dist/chunk-1a7a8cjs.js +2 -0
- package/dist/{chunk-700m927w.js → chunk-1bft48gk.js} +2 -2
- package/dist/{chunk-6pz5gq6v.js → chunk-1jtsr42q.js} +20 -20
- package/dist/chunk-1ph2yhfn.js +3 -0
- package/dist/{chunk-f3cyghnb.js → chunk-1t15z230.js} +4 -4
- package/dist/{chunk-7212fwzz.js → chunk-1w0bqqh5.js} +2 -2
- package/dist/{chunk-s0mf56y1.js → chunk-2xnbdqy4.js} +4 -4
- package/dist/{chunk-2gn2nc2j.js → chunk-35j7gaj5.js} +1 -1
- package/dist/chunk-3b3mkgpj.js +3 -0
- package/dist/{chunk-snv80b1b.js → chunk-3bsz7zj3.js} +2 -2
- package/dist/chunk-3yvmaphj.js +2 -0
- package/dist/{chunk-njpva3zq.js → chunk-40k0r6z9.js} +1 -1
- package/dist/{chunk-eyx92t9n.js → chunk-41z7f41b.js} +2 -2
- package/dist/chunk-44teqn0b.js +2 -0
- package/dist/{chunk-b15c4g3e.js → chunk-49xwf7dk.js} +6 -6
- package/dist/chunk-4d85str1.js +2 -0
- package/dist/{chunk-7hpca9c7.js → chunk-4eescf3s.js} +4 -4
- package/dist/chunk-4xbtxeak.js +2 -0
- package/dist/{chunk-0ncafcs2.js → chunk-67j2m620.js} +3 -3
- package/dist/{chunk-5ssv10ep.js → chunk-690518hw.js} +1 -1
- package/dist/chunk-6s3jwysv.js +2 -0
- package/dist/{chunk-mt8edb75.js → chunk-6svc4kb8.js} +57 -57
- package/dist/{chunk-5kqezrjt.js → chunk-80ky40mm.js} +1 -1
- package/dist/chunk-850tye3c.js +2 -0
- package/dist/{chunk-eceeqy74.js → chunk-8ccgty8s.js} +2 -2
- package/dist/{chunk-1gyxxfdf.js → chunk-8f8qgjjr.js} +1 -1
- package/dist/{chunk-87g5xmmr.js → chunk-9344rq4r.js} +14 -14
- package/dist/chunk-94j4p584.js +2 -0
- package/dist/{chunk-446tb2th.js → chunk-97snfzsy.js} +49 -49
- package/dist/chunk-9a9cec4x.js +2 -0
- package/dist/{chunk-pctf14yw.js → chunk-9rjgq8k4.js} +1 -1
- package/dist/{chunk-q9tc9rdv.js → chunk-a0aqs5a8.js} +2 -2
- package/dist/{chunk-cgfjrgfw.js → chunk-a3zrwky3.js} +11 -11
- package/dist/{chunk-6gtecbe7.js → chunk-a7bqrjm5.js} +2 -2
- package/dist/{chunk-vc432a0w.js → chunk-adsqckg4.js} +9 -9
- package/dist/{chunk-51720m79.js → chunk-aj5tsksz.js} +9 -9
- package/dist/chunk-amb7e0fp.js +2 -0
- package/dist/chunk-arr79m90.js +2 -0
- package/dist/{chunk-9d91h636.js → chunk-b0hj8eg2.js} +2 -2
- package/dist/chunk-bm0mzk3b.js +2 -0
- package/dist/{chunk-ymqm898x.js → chunk-bvqgq18r.js} +2 -2
- package/dist/{chunk-m95sygv4.js → chunk-c25q87ys.js} +1 -1
- package/dist/{chunk-mgh5rst1.js → chunk-cphc60zw.js} +2 -2
- package/dist/{chunk-ranjkpc8.js → chunk-e16ef18k.js} +1 -1
- package/dist/chunk-e28czxw3.js +2 -0
- package/dist/{chunk-g6ap4085.js → chunk-e8szp5wa.js} +1 -1
- package/dist/chunk-eq86wzhr.js +1314 -0
- package/dist/chunk-essd43ad.js +2 -0
- package/dist/chunk-fsk3rk2x.js +2 -0
- package/dist/{chunk-s93yh7ed.js → chunk-g3vce7ka.js} +2 -2
- package/dist/{chunk-zwwhpxp7.js → chunk-g5nfqzfh.js} +2 -2
- package/dist/chunk-gfea8a9y.js +2 -0
- package/dist/chunk-hda7t8g6.js +2 -0
- package/dist/{chunk-dymck524.js → chunk-hyyh7qxw.js} +5 -5
- package/dist/chunk-j6fs31va.js +2 -0
- package/dist/chunk-j9kejcrx.js +2 -0
- package/dist/chunk-j9vfv53x.js +20 -0
- package/dist/chunk-jhbz5w30.js +2 -0
- package/dist/chunk-jvnsz2x9.js +2 -0
- package/dist/{chunk-bwx6w87c.js → chunk-k8bk685s.js} +1 -1
- package/dist/chunk-kexqmwx8.js +2 -0
- package/dist/{chunk-bqtj62ys.js → chunk-kg7vby72.js} +7 -7
- package/dist/{chunk-mjp1z9kz.js → chunk-khm56bfm.js} +1 -1
- package/dist/chunk-kpjq135z.js +2 -0
- package/dist/chunk-kqsm7gf1.js +2 -0
- package/dist/{chunk-mctzpw0w.js → chunk-kr2400c3.js} +4 -4
- package/dist/{chunk-b6bf0t02.js → chunk-mhrnjaka.js} +4 -4
- package/dist/chunk-mtfymhy1.js +2 -0
- package/dist/{chunk-eqffvse2.js → chunk-n6q1d66k.js} +1 -1
- package/dist/{chunk-3hsv6ejp.js → chunk-neg6ckjg.js} +7 -7
- package/dist/{chunk-hm9d40yf.js → chunk-nhv81gp2.js} +2 -2
- package/dist/{chunk-kbbbpae2.js → chunk-nq60tjkz.js} +2 -2
- package/dist/{chunk-kx09v9ya.js → chunk-nzpb263k.js} +9 -9
- package/dist/{chunk-6kyqejnq.js → chunk-p0bjbtdx.js} +20 -20
- package/dist/{chunk-967ydrq4.js → chunk-p3hbsrk9.js} +2 -2
- package/dist/chunk-p82fzxdg.js +2 -0
- package/dist/{chunk-pz554g43.js → chunk-pvm48tse.js} +3 -3
- package/dist/{chunk-zek9t5za.js → chunk-pwpge9bj.js} +2 -2
- package/dist/{chunk-58qzyyyv.js → chunk-qnf7w4xw.js} +1 -1
- package/dist/chunk-qsv84cwm.js +2 -0
- package/dist/chunk-r7m60q1m.js +2 -0
- package/dist/chunk-r98pye4h.js +2 -0
- package/dist/{chunk-6pdy7ajr.js → chunk-rd663v1m.js} +1 -1
- package/dist/{chunk-55tc5w32.js → chunk-sh7a0g09.js} +2 -2
- package/dist/chunk-sztr4d5g.js +2 -0
- package/dist/{chunk-95sd8h5g.js → chunk-t3zmfh8w.js} +3 -3
- package/dist/chunk-t4gcsbna.js +2 -0
- package/dist/chunk-tspqdt8e.js +2 -0
- package/dist/{chunk-sjjw6y49.js → chunk-v1mwwben.js} +4 -4
- package/dist/chunk-v6gkjg5f.js +3 -0
- package/dist/{chunk-48rwqchc.js → chunk-v90nz5xm.js} +9 -9
- package/dist/chunk-vfcbz0an.js +3 -0
- package/dist/{chunk-hgf7bc50.js → chunk-vkfw9k1n.js} +6 -6
- package/dist/{chunk-4kmg6g5n.js → chunk-vxbvrbqs.js} +9 -9
- package/dist/chunk-wedwczed.js +2 -0
- package/dist/chunk-wg6fmren.js +4 -0
- package/dist/{chunk-mw7hacm3.js → chunk-whcrca58.js} +21 -21
- package/dist/chunk-wmvvrsn0.js +2 -0
- package/dist/chunk-wnrh62by.js +2 -0
- package/dist/{chunk-nkyff7v6.js → chunk-wy6vjz1e.js} +17 -17
- package/dist/{chunk-brzjass3.js → chunk-xc5esqcb.js} +2 -2
- package/dist/{chunk-nbdscgvj.js → chunk-xeyq6d0t.js} +6 -6
- package/dist/{chunk-3dqfjpz4.js → chunk-xmg6bmh6.js} +29 -29
- package/dist/chunk-xwrjre34.js +2 -0
- package/dist/{chunk-p8shtje2.js → chunk-yesh4dfe.js} +45 -45
- package/dist/chunk-ymc1wgb3.js +2 -0
- package/dist/{chunk-6c1vm6bs.js → chunk-zkwkhesc.js} +2 -2
- package/dist/{chunk-me4yq8c2.js → chunk-zpqjsnz9.js} +2 -2
- package/dist/{chunk-hpzje67q.js → chunk-zwqkbk2m.js} +2 -2
- package/dist/chunk-zxjdfgdx.js +3 -0
- package/dist/cli.js +28 -28
- package/dist/component-contract.d.ts +1 -0
- package/dist/component-contract.js +6 -4
- package/dist/component-library.js +207 -58
- package/dist/composition-api.d.ts +7 -1
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/emits-declaration.d.ts +9 -0
- package/dist/emits-declaration.js +64 -0
- package/dist/props-declaration.d.ts +2 -0
- package/dist/props-declaration.js +25 -0
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +28 -28
- package/package.json +5 -5
- package/dist/chunk-0g9cceht.js +0 -2
- package/dist/chunk-0rpj5t80.js +0 -2
- package/dist/chunk-2ba4zfa0.js +0 -2
- package/dist/chunk-2wkpksg1.js +0 -2
- package/dist/chunk-3yjyjq0m.js +0 -2
- package/dist/chunk-444haxxa.js +0 -2
- package/dist/chunk-4rvfeee5.js +0 -2
- package/dist/chunk-5aa83bpm.js +0 -2
- package/dist/chunk-67rppc5v.js +0 -2
- package/dist/chunk-77c89d23.js +0 -2
- package/dist/chunk-79vbkez0.js +0 -2
- package/dist/chunk-8354mzpd.js +0 -2
- package/dist/chunk-8ygf6jnt.js +0 -2
- package/dist/chunk-94mpe1ny.js +0 -3
- package/dist/chunk-9n5h4sqc.js +0 -3
- package/dist/chunk-9ztn7w4y.js +0 -2
- package/dist/chunk-ankap9pc.js +0 -2
- package/dist/chunk-asnd03sr.js +0 -2
- package/dist/chunk-b0b5yr97.js +0 -2
- package/dist/chunk-b0e7dgv8.js +0 -3
- package/dist/chunk-b7jj45bz.js +0 -2
- package/dist/chunk-dzqfv801.js +0 -3
- package/dist/chunk-ery4tty7.js +0 -20
- package/dist/chunk-evwrxsxd.js +0 -3
- package/dist/chunk-fdqdz018.js +0 -2
- package/dist/chunk-gz9pknbw.js +0 -1204
- package/dist/chunk-hjb4c8g2.js +0 -2
- package/dist/chunk-jhbj9ja2.js +0 -2
- package/dist/chunk-k9abxnpa.js +0 -2
- package/dist/chunk-mvavjydq.js +0 -2
- package/dist/chunk-qqng9545.js +0 -2
- package/dist/chunk-rjm515e2.js +0 -2
- package/dist/chunk-rye4b2x3.js +0 -2
- package/dist/chunk-ryj8139z.js +0 -2
- package/dist/chunk-s9b809n2.js +0 -2
- package/dist/chunk-sb67wg5x.js +0 -2
- package/dist/chunk-sqwx2g02.js +0 -2
- package/dist/chunk-tpyekw0q.js +0 -2
- package/dist/chunk-v2627s75.js +0 -2
- package/dist/chunk-v98n53nk.js +0 -2
- package/dist/chunk-w34vvhm7.js +0 -2
- package/dist/chunk-wbmx0rge.js +0 -2
- package/dist/chunk-yjwa7ktk.js +0 -2
- package/dist/chunk-z47p2gx8.js +0 -2
- package/dist/chunk-z6kw6sct.js +0 -4
- package/dist/chunk-zhywjwdr.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{en,we,R}from"./chunk-0jdz31q1.js";import{Ai,tl,o,A,We,Oe,Cn,qe,ke,se,Nr,O,Tn,so,dl,pl,Rn,Br,io,ao,fl,ji,gl,ml,hl,yl,Ke,Ge,co,Ye,s,Pn,b,g,Y,ae,Ne,P,Wi}from"./chunk-eq86wzhr.js";import{d,m,M,n,ce,te,u,Me,Xi,K,Dn,Ji,Zt,Yi,Al,Ur,Pl,vt,Il,Wr,Ol,Ln,Zi,Nl,qr,Gr,De,Qi}from"./chunk-xmg6bmh6.js";import{Jt}from"./chunk-41z7f41b.js";import{Nn}from"./chunk-g3vce7ka.js";import{S}from"./chunk-adsqckg4.js";import{Rr,Ks}from"./chunk-8ccgty8s.js";import{jc,Bc,Er,dt,Fc,j}from"./chunk-yesh4dfe.js";import{vi,xi,Si,ki}from"./chunk-t3zmfh8w.js";import{Oc,$s}from"./chunk-vkfw9k1n.js";import{_s,Cs,Es}from"./chunk-v90nz5xm.js";import{Ps,pi,fi,Is,Os,gi}from"./chunk-vxbvrbqs.js";import{Rs,ai}from"./chunk-hyyh7qxw.js";import{ri}from"./chunk-05x1rd86.js";import{ge,ci,li,ui}from"./chunk-80ky40mm.js";import{Sr,Re,Mc,kr,Dc}from"./chunk-kg7vby72.js";import{W,lt}from"./chunk-a7bqrjm5.js";import{Z}from"./chunk-n6q1d66k.js";import{Hc,Vc}from"./chunk-qnf7w4xw.js";import{I,jn,ea}from"./chunk-a0aqs5a8.js";import{zn}from"./chunk-neg6ckjg.js";import{L,c,f}from"./chunk-hxws025y.js";function ze(r){return/\bimport\s*\.\s*meta\b/.test(zn(r))}function jr(r){let e=Oe(r),l=[],a=0;for(let h=0;h<e.length;h++){let t=e[h],p=t.name.toLowerCase();if(p==="template")a+=t.closing?-1:1;if(p!=="script"||t.closing)continue;let w=e[h+1];if(w?.name.toLowerCase()!=="script"||!w.closing)continue;l.push({start:t.start,end:w.end,attrs:t.attributes,body:r.slice(t.end,w.start),inert:a>0})}return l}function nt(r){return[...r].map(([e,l])=>l===!0?e:`${e}="${l.replace(/"/g,""")}"`).join(" ")}function wt(r){let e=jr(r);if(e.some((y)=>O(y.attrs).has("data-stx-module-bootstrap")))return r;let l=(y)=>{if(ze(y))return!0;try{return Z(y)}catch{return!1}};if(!e.some((y)=>l(y.body)||O(y.attrs).get("type")==="module"))return r;let a=new Bun.CryptoHasher("md5").update(r).digest("hex").slice(0,16),h="",t=0,p=!1,w=0;for(let y of e){let x=O(y.attrs),v=x.get("type");if(y.inert||x.has("data-stx-module-job")||x.has("data-stx-runtime")||x.has("data-stx-router"))continue;if(typeof v==="string"&&!["module","text/javascript","application/javascript"].includes(v.toLowerCase()))continue;if(![...x.keys()].some((T)=>/^data-stx-(?:scoped|modules|stores|(?:framework-)?composables)$/.test(T)))continue;let _=v==="module"||l(y.body);if(_)p=!0;if(!p)continue;if(!_&&(x.has("data-stx-owner")||x.has("data-stx-instance")))continue;h+=r.slice(t,y.start);let E=y.body,D=x.get("src");if(typeof D==="string")x.delete("src"),x.set("data-stx-source-url",D),E=`${_?"await":"return"} new Promise(function(resolve,reject){
|
|
3
3
|
var source=globalThis.__stxExecutingScript,script=document.createElement('script');
|
|
4
4
|
for(var attr of source.attributes)if(!['type','src','data-stx-module-job'].includes(attr.name))script.setAttribute(attr.name,attr.value);
|
|
5
5
|
${_?"script.type='module';":""}
|
|
@@ -8,7 +8,7 @@ script.src=new URL(source.getAttribute('data-stx-source-url'),document.baseURI).
|
|
|
8
8
|
script.onload=function(){${_?"":"globalThis.__stxExecutingScript=__stxPreviousScript;"}resolve();};
|
|
9
9
|
script.onerror=function(error){${_?"":"globalThis.__stxExecutingScript=__stxPreviousScript;"}reject(error);};
|
|
10
10
|
source.parentNode.insertBefore(script,source);
|
|
11
|
-
});`;if(_){let T=`${a}-${w++}`,C=JSON.stringify(T),N=new Map(
|
|
11
|
+
});`;if(_){let T=`${a}-${w++}`,C=JSON.stringify(T),N=new Map(x);N.delete("type"),N.delete("async"),N.delete("defer"),N.set("data-stx-module-bootstrap",!0),h+=`<script ${nt(N)}>
|
|
12
12
|
;(function(){
|
|
13
13
|
var resolve,reject,previous=globalThis.__stxPageModulesReady||Promise.resolve();
|
|
14
14
|
var ready=new Promise(function(ok,fail){resolve=ok;reject=fail;});
|
|
@@ -27,7 +27,7 @@ window.addEventListener('error',job.fail,true);
|
|
|
27
27
|
globalThis.__stxPageModulesReady=ready;
|
|
28
28
|
ready.catch(function(error){console.error('[stx] page module failed',error);});
|
|
29
29
|
})();
|
|
30
|
-
</script>`,
|
|
30
|
+
</script>`,x.set("type","module"),x.delete("async"),x.delete("defer"),x.set("data-stx-module-job",T),h+=`<script ${nt(x)}>
|
|
31
31
|
await globalThis.__stxModuleJobs[${C}].previous;
|
|
32
32
|
globalThis.__stxModuleJobs[${C}].previousScript=globalThis.__stxExecutingScript;
|
|
33
33
|
globalThis.__stxModuleJobs[${C}].script=document.querySelector('script[data-stx-module-job="${T}"]');
|
|
@@ -37,7 +37,7 @@ globalThis.__stxExecutingScript=globalThis.__stxModuleJobs[${C}].previousScript;
|
|
|
37
37
|
window.removeEventListener('error',globalThis.__stxModuleJobs[${C}].fail,true);
|
|
38
38
|
globalThis.__stxModuleJobs[${C}].resolve();
|
|
39
39
|
delete globalThis.__stxModuleJobs[${C}];
|
|
40
|
-
</script>`}else h+=`<script ${nt(
|
|
40
|
+
</script>`}else h+=`<script ${nt(x)}>
|
|
41
41
|
;(function(__stxSource){
|
|
42
42
|
globalThis.__stxPageModulesReady=(globalThis.__stxPageModulesReady||Promise.resolve()).then(function(){
|
|
43
43
|
var __stxPreviousScript=globalThis.__stxExecutingScript;
|
|
@@ -54,9 +54,9 @@ finally { window.removeEventListener('error',__stxCapture); globalThis.__stxExec
|
|
|
54
54
|
if(__stxFailure)throw __stxFailure;`}
|
|
55
55
|
});
|
|
56
56
|
})(document.currentScript);
|
|
57
|
-
</script>`;t=
|
|
57
|
+
</script>`;t=y.end}return h+r.slice(t)}import ss from"fs";import le from"path";function xt(r){let e=Oe(r),l=e.find((x)=>x.closing&&x.name.toLowerCase()==="head");if(!l)return r;let a=new Set(["template","svg","noscript","math","textarea","title","xmp","iframe","noembed","noframes","plaintext"]),h=0,t=[];for(let x=0;x<e.length;x++){let v=e[x];if(v.start<l.end)continue;let k=v.name.toLowerCase();if(a.has(k)){h=Math.max(0,h+(v.closing?-1:v.selfClosing?0:1));continue}if(k!=="style"||v.closing||h>0)continue;let _=e[x+1];if(_?.name.toLowerCase()==="style"&&_.closing){if(/@scope\s*\{/.test(r.slice(v.end,_.start)))continue;t.push({start:v.start,end:_.end}),x++}}if(!t.length)return r;let p=t.map((x)=>r.slice(x.start,x.end)).join(`
|
|
58
58
|
`),w=[r.slice(0,l.start),p,`
|
|
59
|
-
`],
|
|
59
|
+
`],y=l.start;for(let x of t)w.push(r.slice(y,x.start)),y=x.end;return w.push(r.slice(y)),w.join("")}function St(){return`
|
|
60
60
|
// STX Lifecycle Runtime
|
|
61
61
|
(function() {
|
|
62
62
|
if (typeof window === 'undefined') return;
|
|
@@ -404,7 +404,7 @@ else {
|
|
|
404
404
|
|
|
405
405
|
console.log('[stx] Lifecycle runtime initialized');
|
|
406
406
|
})();
|
|
407
|
-
`}function st(r){return Symbol(r)}var Ls=st("theme"),js=st("router"),Ns=st("i18n");import*as _t from"crypto";function kt(r){let e=/\$(\w+)\./g,l=[],a;while((a=e.exec(r))!==null)if(!l.includes(a[1]))l.push(a[1]);return l}function
|
|
407
|
+
`}function st(r){return Symbol(r)}var Ls=st("theme"),js=st("router"),Ns=st("i18n");import*as _t from"crypto";function kt(r){let e=/\$(\w+)\./g,l=[],a;while((a=e.exec(r))!==null)if(!l.includes(a[1]))l.push(a[1]);return l}function Hr(){return`stx-${_t.randomBytes(4).toString("hex")}`}function Fr(r){return/\$\w+\./.test(r)}function Vr(r){if(!/\{\{[^}]*\$\w/.test(r)||!/\$\w+\./.test(r))return{html:r,bindings:[],stores:new Set};let e=[],l=new Set,a=/<(\w+)([^>]*?)(\s*\/?>)/g,h=r;return h=h.replace(a,(t,p,w,y)=>{if(["script","style","template"].includes(p.toLowerCase()))return t;if(!w.includes("{{"))return t;let x=[],v=!1,k=w,_=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,E=[...w.matchAll(_)];for(let C of E){let N=C[0],F=C[1],q=C[2];if(Fr(q)){v=!0;let V=q.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(V){let H=V[1];if(x.push({attr:F,expr:H,fullMatch:N,originalAttr:F}),kt(H).forEach((U)=>l.add(U)),F==="text")k=k.replace(N,"");else if(F==="class")k=k.replace(N,'class=""');else if(F==="disabled"||F==="hidden")k=k.replace(N,"");else k=k.replace(N,`${F}=""`)}}}if(!v)return t;let D=k.match(/\bid\s*=\s*"([^"]+)"/),T;if(D)T=D[1];else T=Hr(),k=` id="${T}"${k}`;for(let C of x)e.push({elementId:T,attribute:C.attr,expression:C.expr,stores:kt(C.expr)});return`<${p}${k}${y}`}),{html:h,bindings:e,stores:l}}function Xr(r,e){if(r.length===0)return"";let l=Array.from(e),a=`
|
|
408
408
|
<script>
|
|
409
409
|
(function() {
|
|
410
410
|
'use strict';
|
|
@@ -424,11 +424,11 @@ else {
|
|
|
424
424
|
`;a+=`
|
|
425
425
|
// Binding update functions
|
|
426
426
|
function updateBindings() {
|
|
427
|
-
`;for(let h of r){let{elementId:t,attribute:p,expression:w}=h,
|
|
427
|
+
`;for(let h of r){let{elementId:t,attribute:p,expression:w}=h,y=w.replace(/\$(\w+)\./g,"$state.$1.");if(p==="text")a+=` (function() {
|
|
428
428
|
var el = document.getElementById('${t}');
|
|
429
429
|
if (el) {
|
|
430
430
|
try {
|
|
431
|
-
el.textContent = ${
|
|
431
|
+
el.textContent = ${y};
|
|
432
432
|
}
|
|
433
433
|
catch (e) { console.error('Binding error:', e); }
|
|
434
434
|
}
|
|
@@ -437,7 +437,7 @@ catch (e) { console.error('Binding error:', e); }
|
|
|
437
437
|
var el = document.getElementById('${t}');
|
|
438
438
|
if (el) {
|
|
439
439
|
try {
|
|
440
|
-
el.innerHTML = ${
|
|
440
|
+
el.innerHTML = ${y};
|
|
441
441
|
}
|
|
442
442
|
catch (e) { console.error('Binding error:', e); }
|
|
443
443
|
}
|
|
@@ -446,7 +446,7 @@ catch (e) { console.error('Binding error:', e); }
|
|
|
446
446
|
var el = document.getElementById('${t}');
|
|
447
447
|
if (el) {
|
|
448
448
|
try {
|
|
449
|
-
var value = ${
|
|
449
|
+
var value = ${y};
|
|
450
450
|
if (typeof value === 'string') {
|
|
451
451
|
// Dynamic class string - merge with existing static classes
|
|
452
452
|
// eslint-disable-next-line pickier/no-unused-vars
|
|
@@ -475,7 +475,7 @@ catch (e) { console.error('Binding error:', e); }
|
|
|
475
475
|
var el = document.getElementById('${t}');
|
|
476
476
|
if (el) {
|
|
477
477
|
try {
|
|
478
|
-
el.style.display = (${
|
|
478
|
+
el.style.display = (${y}) ? '' : 'none';
|
|
479
479
|
}
|
|
480
480
|
catch (e) { console.error('Binding error:', e); }
|
|
481
481
|
}
|
|
@@ -484,7 +484,7 @@ catch (e) { console.error('Binding error:', e); }
|
|
|
484
484
|
var el = document.getElementById('${t}');
|
|
485
485
|
if (el) {
|
|
486
486
|
try {
|
|
487
|
-
el.style.visibility = (${
|
|
487
|
+
el.style.visibility = (${y}) ? 'visible' : 'hidden';
|
|
488
488
|
}
|
|
489
489
|
catch (e) { console.error('Binding error:', e); }
|
|
490
490
|
}
|
|
@@ -493,7 +493,7 @@ catch (e) { console.error('Binding error:', e); }
|
|
|
493
493
|
var el = document.getElementById('${t}');
|
|
494
494
|
if (el) {
|
|
495
495
|
try {
|
|
496
|
-
var value = ${
|
|
496
|
+
var value = ${y};
|
|
497
497
|
if (value === false || value === null || value === undefined) {
|
|
498
498
|
el.removeAttribute('${p}');
|
|
499
499
|
}
|
|
@@ -562,10 +562,10 @@ else {
|
|
|
562
562
|
}
|
|
563
563
|
})();
|
|
564
564
|
</script>
|
|
565
|
-
`,a}function $t(r){let{html:e,bindings:l,stores:a}=
|
|
565
|
+
`,a}function $t(r){let{html:e,bindings:l,stores:a}=Vr(r);if(l.length===0)return r;let h=Xr(l,a),t=c(e);if(t!==-1)return e.slice(0,t)+h+e.slice(t);return e+h}function zr(r){let e=r.analytics;if(!e?.enabled)return"";switch(e.driver){case"fathom":return Kr(e);case"google-analytics":return Jr(e);case"plausible":return Zr(e);case"self-hosted":return Qr(e);case"custom":return Yr(e);default:return""}}function Kr(r){let e=r.fathom;if(!e?.siteId)return"";let l=e.scriptUrl||"https://cdn.usefathom.com/script.js",a=e.defer!==!1?" defer":"",h=[`data-site="${fe(e.siteId)}"`];if(e.honorDnt)h.push('data-honor-dnt="true"');if(e.spa)h.push('data-spa="auto"');if(e.canonical)h.push(`data-canonical="${fe(e.canonical)}"`);if(e.auto===!1)h.push('data-auto="false"');return`
|
|
566
566
|
<!-- Fathom Analytics -->
|
|
567
567
|
<script src="${fe(l)}" ${h.join(" ")}${a}></script>
|
|
568
|
-
`}function
|
|
568
|
+
`}function Jr(r){let e=r.googleAnalytics;if(!e?.measurementId)return"";let l=fe(e.measurementId),a=e.debug?`gtag('config', '${l}', { 'debug_mode': true });`:"";return`
|
|
569
569
|
<!-- Google Analytics -->
|
|
570
570
|
<script async src="https://www.googletagmanager.com/gtag/js?id=${l}"></script>
|
|
571
571
|
<script>
|
|
@@ -575,10 +575,10 @@ else {
|
|
|
575
575
|
gtag('config', '${l}');
|
|
576
576
|
${a}
|
|
577
577
|
</script>
|
|
578
|
-
`}function
|
|
578
|
+
`}function Zr(r){let e=r.plausible;if(!e?.domain)return"";let l=e.scriptUrl||"https://plausible.io/js/script.js",a=[`data-domain="${fe(e.domain)}"`],h=l,t=[];if(e.trackLocalhost)t.push("local");if(e.hashMode)t.push("hash");if(t.length>0&&l==="https://plausible.io/js/script.js")h=`https://plausible.io/js/script.${t.join(".")}.js`;return`
|
|
579
579
|
<!-- Plausible Analytics -->
|
|
580
580
|
<script defer data-domain="${fe(e.domain)}" src="${fe(h)}"></script>
|
|
581
|
-
`}function
|
|
581
|
+
`}function Qr(r){let e=r.selfHosted;if(!e?.siteId||!e?.apiEndpoint)return"";let l=fe(e.siteId),a=fe(e.apiEndpoint),h=e.honorDnt?'if(n.doNotTrack==="1")return;':"",t=e.trackHashChanges?"w.addEventListener('hashchange',pv);":"",p=e.trackOutboundLinks?`
|
|
582
582
|
d.addEventListener('click',function(e){
|
|
583
583
|
var a=e.target.closest('a');
|
|
584
584
|
if(a&&a.hostname!==location.hostname){
|
|
@@ -611,7 +611,7 @@ else {
|
|
|
611
611
|
w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
|
|
612
612
|
})();
|
|
613
613
|
</script>
|
|
614
|
-
`}function
|
|
614
|
+
`}function Yr(r){let e=r.custom;if(!e)return"";if(e.inlineScript)return`
|
|
615
615
|
<!-- Custom Analytics -->
|
|
616
616
|
<script>
|
|
617
617
|
${e.inlineScript}
|
|
@@ -619,24 +619,24 @@ ${e.inlineScript}
|
|
|
619
619
|
`;if(!e.scriptUrl)return"";let l=[];if(e.scriptId)l.push(`id="${fe(e.scriptId)}"`);if(e.attributes)for(let[h,t]of Object.entries(e.attributes))l.push(`${fe(h)}="${fe(t)}"`);return`
|
|
620
620
|
<!-- Custom Analytics -->
|
|
621
621
|
<script${l.length>0?` ${l.join(" ")}`:""} src="${fe(e.scriptUrl)}" defer></script>
|
|
622
|
-
`}function Et(r,e){let l=
|
|
623
|
-
${h}`)}function Ot(r,e){let l=r;return l=l.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(a,h)=>{if(h.includes("nonce="))return a;return`<script nonce="${e}"${h}>`}),l=l.replace(/<style([^>]*)>/gi,(a,h)=>{if(h.includes("nonce="))return a;return`<style nonce="${e}"${h}>`}),l}function Lt(r,e,l,a){let h=r,t=a.csp;if(h=h.replace(/@csp\b/g,()=>{if(!t?.enabled||!t.directives)return"<!-- CSP not configured -->";let p=t.useNonce?Qe(e,t):void 0;return Dt(t.directives,p)}),h=h.replace(/@cspNonce\b/g,()=>{if(!t?.enabled||!t.useNonce)return"";return Qe(e,t)}),t?.enabled&&t.useNonce)e.cspNonce=Qe(e,t);return h}import an from"crypto";var cn=40,Pt="_token",at=null;function ln(r=cn){let e=an.randomBytes(Math.ceil(r/2)).toString("hex").slice(0,r);return at=e,e}function un(){if(!at)ln();return at}function dn(r=Pt){let e=un();return`<input type="hidden" name="${r}" value="${e}">`}function jt(r){return r.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(e,l,a)=>dn(a||Pt))}async function Nt(r,e,l,a){if(!a.customDirectives||a.customDirectives.length===0)return r;let h=r;for(let t of a.customDirectives){if(!t.name||typeof t.handler!=="function"){if(a.debug)console.warn("Invalid custom directive:",t);continue}if(t.hasEndTag)h=await pn(h,t,e,l,a);else h=await fn(h,t,e,l,a)}return h}async function pn(r,e,l,a,h){let{name:t,handler:p}=e,w=`@${t}`,b=`@end${t}`,S=r,v=Zt(`${w}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${b}`,"g"),k=[],_=v.exec(S);while(_!==null){let[E,D="",T=""]=_,C=_.index||0;try{let N=D?Ht(e,D):[],F=T.trim(),q=await p(F,N,l,a);k.push({original:E,processed:q,startIndex:C})}catch(N){let F=N instanceof Error?N.message:String(N);if(h.debug)console.error(`Error processing custom directive @${t}:`,N);k.push({original:E,processed:u("CustomDirective",`Error in @${t}${D?`(${D})`:""}: ${F}`,n.EVALUATION_ERROR),startIndex:C})}_=v.exec(S)}for(let E=k.length-1;E>=0;E--){let{original:D,processed:T}=k[E];S=S.replace(D,T)}return S}async function fn(r,e,l,a,h){let{name:t,handler:p}=e,w=r,b=[],S=[];if(e.rawParams){for(let _ of Ji(w,Zt(`(?<![\\w$@])@${t}\\s*\\(`,"g")))if(_.end!==-1)S.push({fullMatch:_.call,paramString:_.args,startIndex:_.start})}else{let _=Zt(`@${t}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");_.lastIndex=0;let E=_.exec(w);while(E!==null)S.push({fullMatch:E[0],paramString:E[1]??"",startIndex:E.index||0}),E=_.exec(w)}for(let{fullMatch:_,paramString:E,startIndex:D}of S)try{let T=Ht(e,E),C=await p("",T,l,a);b.push({original:_,processed:C,startIndex:D})}catch(T){let C=T instanceof Error?T.message:String(T);if(h.debug)console.error(`Error processing custom directive @${t}:`,T);b.push({original:_,processed:u("CustomDirective",`Error in @${t}(${E}): ${C}`,n.EVALUATION_ERROR),startIndex:D})}let v=Zt(`@${t}(?!\\w)(?!\\s*\\()`,"g"),k=v.exec(w);while(k!==null){let[_]=k,E=k.index||0;try{let D=await p("",[],l,a);b.push({original:_,processed:D,startIndex:E})}catch(D){let T=D instanceof Error?D.message:String(D);if(h.debug)console.error(`Error processing custom directive @${t}:`,D);b.push({original:_,processed:u("CustomDirective",`Error in @${t}: ${T}`,n.EVALUATION_ERROR),startIndex:E})}k=v.exec(w)}for(let _=b.length-1;_>=0;_--){let{original:E,processed:D}=b[_];w=w.replace(E,D)}return w}function Ht(r,e){return r.rawParams?Jt(e):gn(e)}function gn(r){if(!r.trim())return[];let e=[],l="",a=!1,h="";for(let t=0;t<r.length;t++){let p=r[t];if((p==='"'||p==="'")&&(t===0||r[t-1]!=="\\"))if(!a)a=!0,h=p;else if(p===h)a=!1;else l+=p;else if(p===","&&!a)e.push(l.trim()),l="";else l+=p}if(l.trim())e.push(l.trim());return e.map((t)=>{let p=t.trim();if(p.startsWith('"')&&p.endsWith('"')||p.startsWith("'")&&p.endsWith("'"))return p.substring(1,p.length-1);return p})}var Bt=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,Ft=/^[A-Za-z_$][\w$]*$/,mn=new Set(["light","dark","system"]);function Te(r,e){if(typeof r!=="string"||r.length===0)throw Error(`@appearanceBootstrap ${e} must be a non-empty string`)}function hn(r){if(!r||typeof r!=="object"||Array.isArray(r))throw Error("@appearanceBootstrap expects an options object");let e=r,{appearance:l,colorMode:a}=e;if(Te(e.storageKey,"storageKey"),l!==void 0&&(!l||typeof l!=="object"||Array.isArray(l)))throw Error("@appearanceBootstrap appearance must be an object when given");if(!a||typeof a!=="object"||Array.isArray(a))throw Error("@appearanceBootstrap colorMode must be an object");if(Te(a.key,"colorMode.key"),Te(a.attribute,"colorMode.attribute"),Te(a.default,"colorMode.default"),!Ft.test(a.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Bt.test(a.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!mn.has(a.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");let h=null;if(l){if(Te(l.key,"appearance.key"),Te(l.attribute,"appearance.attribute"),Te(l.default,"appearance.default"),!Ft.test(l.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Bt.test(l.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(l.allowed)||l.allowed.length===0||l.allowed.some((t)=>typeof t!=="string"||t.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!l.allowed.includes(l.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");h={key:l.key,attribute:l.attribute,allowed:[...new Set(l.allowed)],default:l.default}}return{storageKey:e.storageKey,appearance:h,colorMode:{key:a.key,attribute:a.attribute,default:a.default},respectExisting:e.respectExisting===!0}}function yn(r){return JSON.stringify(r).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function bn(r){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${yn(r)};const root=document.documentElement;const MODES=["light","dark","system"];let format="json";const forced=(function(){const found={colorMode:null,appearance:null};if(!config.respectExisting)return found;try{const mode=root.getAttribute("data-"+config.colorMode.attribute);if(mode==="light"||mode==="dark")found.colorMode=mode;if(config.appearance){const name=root.getAttribute("data-"+config.appearance.attribute);if(config.appearance.allowed.includes(name))found.appearance=name}}catch{}return found}());function read(){let stored={};try{const raw=localStorage.getItem(config.storageKey);if(raw){let parsed=null;try{parsed=JSON.parse(raw)}catch{parsed=raw}if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed)){stored=parsed;format="json"}else if(typeof parsed==="string"&&MODES.includes(parsed)){stored={};stored[config.colorMode.key]=parsed;format="string"}}}catch{}return stored}function write(stored){try{if(format==="string"&&!config.appearance)localStorage.setItem(config.storageKey,stored[config.colorMode.key]);else localStorage.setItem(config.storageKey,JSON.stringify(stored))}catch{}}function resolve(){const stored=read();const state={colorMode:forced.colorMode||(MODES.includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default)};if(config.appearance)state.appearance=forced.appearance||(config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default);return state}function prefersDark(){try{return matchMedia("(prefers-color-scheme: dark)").matches}catch{return false}}function apply(){const state=resolve();const dark=state.colorMode==="dark"||(state.colorMode==="system"&&prefersDark());if(config.appearance)root.setAttribute("data-"+config.appearance.attribute,state.appearance);root.setAttribute("data-"+config.colorMode.attribute,state.colorMode);root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light";state.dark=dark;try{window.dispatchEvent(new CustomEvent("stx:appearance",{detail:state}))}catch{}return state}function store(key,allowed,value){if(allowed.includes(value)){const stored=read();stored[key]=value;write(stored)}return apply()}window.__stxAppearance={config:config,forced:forced,read:read,resolve:resolve,apply:apply,setColorMode:function(mode){return store(config.colorMode.key,MODES,mode)},setAppearance:function(name){return config.appearance?store(config.appearance.key,config.appearance.allowed,name):apply()},watchSystem:function(){try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(){if(resolve().colorMode==="system")apply()})}catch{}}};apply()}());</script>`}function wn(r,e){let l=1,a=null,h=!1;for(let t=e+1;t<r.length;t++){let p=r[t];if(h){h=!1;continue}if(a){if(p==="\\")h=!0;else if(p===a)a=null;continue}if(p==='"'||p==="'"||p==="`"){a=p;continue}if(p==="(")l++;else if(p===")"&&--l===0)return t}return-1}function qt(r,e){let l=r,a=/@appearanceBootstrap\s*\(/g,h;while((h=a.exec(l))!==null){let t=h.index+h[0].length-1,p=wn(l,t);if(p===-1)throw Error("@appearanceBootstrap has an unclosed options object");let w=l.slice(t+1,p).trim(),b=d(`(${w})`,e),S=bn(hn(b));l=l.slice(0,h.index)+S+l.slice(p+1),a.lastIndex=h.index+S.length}return l}import vn from"crypto";function ne(r){return Y(String(r??""))}var Vt={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function Ye(r,e,l,a){let h=r||e;return l?`${h} ${a}`:h}function ye(r){return String(r).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function Le(r,e){if(/\bid\s*=/i.test(r))return"";return` id="${ne(e)}"`}function lt(r,e,l){if(!e)return"";let a="";if(!/\baria-invalid\s*=/i.test(l))a+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(l))a+=` aria-describedby="${ne(`${ye(r)}-error`)}"`;return a}function xn(){return vn.randomUUID()}function et(r,e){let l=r;return l=l.replace(/@csrf/g,()=>{if(!e.csrf||typeof e.csrf!=="object"){let a=xn();e.csrf={token:a}}if(e.csrf.field)return e.csrf.field;if(e.csrf.token)return`<input type="hidden" name="_token" value="${ne(e.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),l=l.replace(/@method\(['"]([^'"]+)['"]\)/g,(a,h)=>{let t=h.toUpperCase();if(h&&!["GET","POST"].includes(t))return`<input type="hidden" name="_method" value="${ne(t)}">`;return a}),l}function Wt(r,e,l=Vt){let a=r;return a=a.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(h,t,p,w,b,S="")=>{let v=t||p||"POST",k=w||b||"",_=ke(S),E=v.toUpperCase(),D=["GET","POST"].includes(E)?E:"POST",T=`<form method="${ne(D)}" action="${ne(k)}"${_?` ${_}`:""}>`;if(T+=`
|
|
622
|
+
`}function Et(r,e){let l=zr(e);if(!l)return r;if(!r.includes("</head>")){let a=c(r);if(a!==-1)return r.slice(0,a)+l+r.slice(a);return r+l}return f(r,l,"")}function fe(r){return r.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function Pt(r){let e=r.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!e)return null;try{return Function(`return ${e[1]}`)()}catch{return null}}function Tt(r){let e=r?.layout;if(e===!1)return!1;return typeof e==="string"&&e.trim()?e.trim():void 0}import tn from"fs";import it from"path";import{createHighlighter as rn}from"ts-syntax-highlighter";var ot=new Map;async function He(r,e={}){try{if(!await s(r))throw Error(`Markdown file not found: ${r}`);let a=(await tn.promises.stat(r)).mtime.getTime();if(e.cache&&ot.has(r)){let k=ot.get(r);if(k.updatedAt>=a)return{content:k.content,data:k.data}}let h=await Bun.file(r).text(),{data:t,content:p}=Er(h),w=e.markdown||j.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},x=dt(p,{gfm:!0});if(w.syntaxHighlighting?.enabled&&w.syntaxHighlighting?.serverSide)x=await nn(x,w.syntaxHighlighting?.defaultTheme||"github-dark",w.syntaxHighlighting?.highlightUnknownLanguages||!1);let v={content:x,data:t||{}};if(e.cache)ot.set(r,{...v,updatedAt:a});return v}catch(l){if(e.debug)console.error(`Error reading/parsing markdown file ${r}:`,l);let a=l instanceof Error?l.message:String(l);return{content:b("Markdown File",`Error reading/parsing markdown file: ${a}`,r,"",0,""),data:{}}}}var Je=null;async function nn(r,e,l){let a=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!Je)try{Je=await rn({theme:e||"github-dark",cache:!0})}catch(w){return console.error("Failed to initialize ts-syntax-highlighter:",w),r}let h=async(w,y,x,v)=>{let k=v.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),_=x||(l?"text":"");if(!_)return w;try{if(!Je.getSupportedLanguages().includes(_))return w;return(await Je.highlight(k,_,{theme:e})).html}catch(E){console.error(`Error highlighting code block with language ${x}:`,E)}return w},t=r,p=r.matchAll(a);for(let w of p){let[y,x,v,k]=w,_=await h(y,x,v,k);t=t.replace(y,_)}return t}async function Ct(r,e,l="",a={}){return await sn(r,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(p,w,y,x)=>{try{let v=w;if(!it.isAbsolute(w))v=it.resolve(it.dirname(l),w);let k={};if(y)try{try{k=JSON.parse(y)}catch{if(a.debug)console.warn("Using safer alternative for parsing JS object literal");let F=y.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let q of F){let V=q.indexOf(":");if(V>0){let H=q.substring(0,V).trim(),B=q.substring(V+1).trim(),U=B.startsWith('"')&&B.endsWith('"'),J=B.startsWith("'")&&B.endsWith("'");if(U||J)B=B.substring(1,B.length-1);k[H]=B}}}}catch(N){if(a.debug)console.error("Error parsing context in @markdown-file directive:",N)}let{content:_,data:E}=await He(v,a),D={...e,...E,...k},T=_,C=/\{\{([^}]+)\}\}/g;return T=T.replace(C,(N,F)=>{let q=F.trim();return D[q]!==void 0?String(D[q]):N}),T}catch(v){let k=v instanceof Error?v.message:String(v);return b("Markdown File",`Error including markdown file: ${k}`,l,r,x,p)}})}async function sn(r,e,l){let a=[],h;while((h=e.exec(r))!==null){let w=h[0],y=h.index,x=h;a.push(l(...x).then((v)=>({match:w,replacement:v,index:y})))}let t=await Promise.all(a);t.sort((w,y)=>y.index-w.index);let p=r;for(let{match:w,replacement:y}of t)p=p.replace(w,()=>y);return p}var At=new WeakMap;function Mt(r=16){let e=new Uint8Array(r);return crypto.getRandomValues(e),btoa(String.fromCharCode(...e))}function Ze(r,e){if(!r)return e?.nonceGenerator?.()??Mt();let l=At.get(r);if(!l)l=e?.nonceGenerator?.()??Mt(),At.set(r,l);return l}function on(r,e){let l=[];for(let[a,h]of Object.entries(r)){if(h===void 0||h===null)continue;if(typeof h==="boolean"){if(h)l.push(a);continue}if(Array.isArray(h)){let t=[...h];if(e&&(a==="script-src"||a==="style-src"))t=t.filter((p)=>!p.startsWith("'nonce-")),t.push(`'nonce-${e}'`);if(t.length>0)l.push(`${a} ${t.join(" ")}`)}}return l.join("; ")}function Rt(r,e){return`<meta http-equiv="Content-Security-Policy" content="${on(r,e).replace(/&/g,"&").replace(/"/g,""")}">`}function Dt(r,e,l){if(!e.enabled||!e.addMetaTag)return r;if(r.includes('http-equiv="Content-Security-Policy"'))return r;if(!r.includes("<head>")&&!r.includes("<head "))return r;let a=e.useNonce?Ze(l,e):void 0,h=Rt(e.directives,a);return r.replace(/<head([^>]*)>/,`<head$1>
|
|
623
|
+
${h}`)}function It(r,e){let l=r;return l=l.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(a,h)=>{if(h.includes("nonce="))return a;return`<script nonce="${e}"${h}>`}),l=l.replace(/<style([^>]*)>/gi,(a,h)=>{if(h.includes("nonce="))return a;return`<style nonce="${e}"${h}>`}),l}function Ot(r,e,l,a){let h=r,t=a.csp;if(h=h.replace(/@csp\b/g,()=>{if(!t?.enabled||!t.directives)return"<!-- CSP not configured -->";let p=t.useNonce?Ze(e,t):void 0;return Rt(t.directives,p)}),h=h.replace(/@cspNonce\b/g,()=>{if(!t?.enabled||!t.useNonce)return"";return Ze(e,t)}),t?.enabled&&t.useNonce)e.cspNonce=Ze(e,t);return h}import an from"crypto";var cn=40,Lt="_token",at=null;function ln(r=cn){let e=an.randomBytes(Math.ceil(r/2)).toString("hex").slice(0,r);return at=e,e}function un(){if(!at)ln();return at}function dn(r=Lt){let e=un();return`<input type="hidden" name="${r}" value="${e}">`}function jt(r){return r.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(e,l,a)=>dn(a||Lt))}async function Nt(r,e,l,a){if(!a.customDirectives||a.customDirectives.length===0)return r;let h=r;for(let t of a.customDirectives){if(!t.name||typeof t.handler!=="function"){if(a.debug)console.warn("Invalid custom directive:",t);continue}if(t.hasEndTag)h=await pn(h,t,e,l,a);else h=await fn(h,t,e,l,a)}return h}async function pn(r,e,l,a,h){let{name:t,handler:p}=e,w=`@${t}`,y=`@end${t}`,x=r,v=en(`${w}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${y}`,"g"),k=[],_=v.exec(x);while(_!==null){let[E,D="",T=""]=_,C=_.index||0;try{let N=D?Ht(e,D):[],F=T.trim(),q=await p(F,N,l,a);k.push({original:E,processed:q,startIndex:C})}catch(N){let F=N instanceof Error?N.message:String(N);if(h.debug)console.error(`Error processing custom directive @${t}:`,N);k.push({original:E,processed:u("CustomDirective",`Error in @${t}${D?`(${D})`:""}: ${F}`,n.EVALUATION_ERROR),startIndex:C})}_=v.exec(x)}for(let E=k.length-1;E>=0;E--){let{original:D,processed:T}=k[E];x=x.replace(D,T)}return x}async function fn(r,e,l,a,h){let{name:t,handler:p}=e,w=r,y=[],x=[];if(e.rawParams){for(let _ of Ji(w,en(`(?<![\\w$@])@${t}\\s*\\(`,"g")))if(_.end!==-1)x.push({fullMatch:_.call,paramString:_.args,startIndex:_.start})}else{let _=en(`@${t}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");_.lastIndex=0;let E=_.exec(w);while(E!==null)x.push({fullMatch:E[0],paramString:E[1]??"",startIndex:E.index||0}),E=_.exec(w)}for(let{fullMatch:_,paramString:E,startIndex:D}of x)try{let T=Ht(e,E),C=await p("",T,l,a);y.push({original:_,processed:C,startIndex:D})}catch(T){let C=T instanceof Error?T.message:String(T);if(h.debug)console.error(`Error processing custom directive @${t}:`,T);y.push({original:_,processed:u("CustomDirective",`Error in @${t}(${E}): ${C}`,n.EVALUATION_ERROR),startIndex:D})}let v=en(`@${t}(?!\\w)(?!\\s*\\()`,"g"),k=v.exec(w);while(k!==null){let[_]=k,E=k.index||0;try{let D=await p("",[],l,a);y.push({original:_,processed:D,startIndex:E})}catch(D){let T=D instanceof Error?D.message:String(D);if(h.debug)console.error(`Error processing custom directive @${t}:`,D);y.push({original:_,processed:u("CustomDirective",`Error in @${t}: ${T}`,n.EVALUATION_ERROR),startIndex:E})}k=v.exec(w)}for(let _=y.length-1;_>=0;_--){let{original:E,processed:D}=y[_];w=w.replace(E,D)}return w}function Ht(r,e){return r.rawParams?Zt(e):gn(e)}function gn(r){if(!r.trim())return[];let e=[],l="",a=!1,h="";for(let t=0;t<r.length;t++){let p=r[t];if((p==='"'||p==="'")&&(t===0||r[t-1]!=="\\"))if(!a)a=!0,h=p;else if(p===h)a=!1;else l+=p;else if(p===","&&!a)e.push(l.trim()),l="";else l+=p}if(l.trim())e.push(l.trim());return e.map((t)=>{let p=t.trim();if(p.startsWith('"')&&p.endsWith('"')||p.startsWith("'")&&p.endsWith("'"))return p.substring(1,p.length-1);return p})}var Bt=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,Ft=/^[A-Za-z_$][\w$]*$/,mn=new Set(["light","dark","system"]);function Ee(r,e){if(typeof r!=="string"||r.length===0)throw Error(`@appearanceBootstrap ${e} must be a non-empty string`)}function hn(r){if(!r||typeof r!=="object"||Array.isArray(r))throw Error("@appearanceBootstrap expects an options object");let e=r,{appearance:l,colorMode:a}=e;if(Ee(e.storageKey,"storageKey"),l!==void 0&&(!l||typeof l!=="object"||Array.isArray(l)))throw Error("@appearanceBootstrap appearance must be an object when given");if(!a||typeof a!=="object"||Array.isArray(a))throw Error("@appearanceBootstrap colorMode must be an object");if(Ee(a.key,"colorMode.key"),Ee(a.attribute,"colorMode.attribute"),Ee(a.default,"colorMode.default"),!Ft.test(a.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Bt.test(a.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!mn.has(a.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");let h=null;if(l){if(Ee(l.key,"appearance.key"),Ee(l.attribute,"appearance.attribute"),Ee(l.default,"appearance.default"),!Ft.test(l.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Bt.test(l.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(l.allowed)||l.allowed.length===0||l.allowed.some((t)=>typeof t!=="string"||t.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!l.allowed.includes(l.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");h={key:l.key,attribute:l.attribute,allowed:[...new Set(l.allowed)],default:l.default}}return{storageKey:e.storageKey,appearance:h,colorMode:{key:a.key,attribute:a.attribute,default:a.default},respectExisting:e.respectExisting===!0}}function yn(r){return JSON.stringify(r).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function bn(r){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${yn(r)};const root=document.documentElement;const MODES=["light","dark","system"];let format="json";const forced=(function(){const found={colorMode:null,appearance:null};if(!config.respectExisting)return found;try{const mode=root.getAttribute("data-"+config.colorMode.attribute);if(mode==="light"||mode==="dark")found.colorMode=mode;if(config.appearance){const name=root.getAttribute("data-"+config.appearance.attribute);if(config.appearance.allowed.includes(name))found.appearance=name}}catch{}return found}());function read(){let stored={};try{const raw=localStorage.getItem(config.storageKey);if(raw){let parsed=null;try{parsed=JSON.parse(raw)}catch{parsed=raw}if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed)){stored=parsed;format="json"}else if(typeof parsed==="string"&&MODES.includes(parsed)){stored={};stored[config.colorMode.key]=parsed;format="string"}}}catch{}return stored}function write(stored){try{if(format==="string"&&!config.appearance)localStorage.setItem(config.storageKey,stored[config.colorMode.key]);else localStorage.setItem(config.storageKey,JSON.stringify(stored))}catch{}}function resolve(){const stored=read();const state={colorMode:forced.colorMode||(MODES.includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default)};if(config.appearance)state.appearance=forced.appearance||(config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default);return state}function prefersDark(){try{return matchMedia("(prefers-color-scheme: dark)").matches}catch{return false}}function apply(){const state=resolve();const dark=state.colorMode==="dark"||(state.colorMode==="system"&&prefersDark());if(config.appearance)root.setAttribute("data-"+config.appearance.attribute,state.appearance);root.setAttribute("data-"+config.colorMode.attribute,state.colorMode);root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light";state.dark=dark;try{window.dispatchEvent(new CustomEvent("stx:appearance",{detail:state}))}catch{}return state}function store(key,allowed,value){if(allowed.includes(value)){const stored=read();stored[key]=value;write(stored)}return apply()}window.__stxAppearance={config:config,forced:forced,read:read,resolve:resolve,apply:apply,setColorMode:function(mode){return store(config.colorMode.key,MODES,mode)},setAppearance:function(name){return config.appearance?store(config.appearance.key,config.appearance.allowed,name):apply()},watchSystem:function(){try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(){if(resolve().colorMode==="system")apply()})}catch{}}};apply()}());</script>`}function wn(r,e){let l=1,a=null,h=!1;for(let t=e+1;t<r.length;t++){let p=r[t];if(h){h=!1;continue}if(a){if(p==="\\")h=!0;else if(p===a)a=null;continue}if(p==='"'||p==="'"||p==="`"){a=p;continue}if(p==="(")l++;else if(p===")"&&--l===0)return t}return-1}function qt(r,e){let l=r,a=/@appearanceBootstrap\s*\(/g,h;while((h=a.exec(l))!==null){let t=h.index+h[0].length-1,p=wn(l,t);if(p===-1)throw Error("@appearanceBootstrap has an unclosed options object");let w=l.slice(t+1,p).trim(),y=d(`(${w})`,e),x=bn(hn(y));l=l.slice(0,h.index)+x+l.slice(p+1),a.lastIndex=h.index+x.length}return l}import vn from"crypto";function re(r){return Y(String(r??""))}var Vt={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function Qe(r,e,l,a){let h=r||e;return l?`${h} ${a}`:h}function ye(r){return String(r).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function Le(r,e){if(/\bid\s*=/i.test(r))return"";return` id="${re(e)}"`}function ct(r,e,l){if(!e)return"";let a="";if(!/\baria-invalid\s*=/i.test(l))a+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(l))a+=` aria-describedby="${re(`${ye(r)}-error`)}"`;return a}function xn(){return vn.randomUUID()}function et(r,e){let l=r;return l=l.replace(/@csrf/g,()=>{if(!e.csrf||typeof e.csrf!=="object"){let a=xn();e.csrf={token:a}}if(e.csrf.field)return e.csrf.field;if(e.csrf.token)return`<input type="hidden" name="_token" value="${re(e.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),l=l.replace(/@method\(['"]([^'"]+)['"]\)/g,(a,h)=>{let t=h.toUpperCase();if(h&&!["GET","POST"].includes(t))return`<input type="hidden" name="_method" value="${re(t)}">`;return a}),l}function Wt(r,e,l=Vt){let a=r;return a=a.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(h,t,p,w,y,x="")=>{let v=t||p||"POST",k=w||y||"",_=Se(x),E=v.toUpperCase(),D=["GET","POST"].includes(E)?E:"POST",T=`<form method="${re(D)}" action="${re(k)}"${_?` ${_}`:""}>`;if(T+=`
|
|
624
624
|
${et("@csrf",e)}`,!["GET","POST"].includes(E))T+=`
|
|
625
|
-
${et(`@method('${E}')`,e)}`;return T}),a=a.replace(/@endform/g,"</form>"),a=a.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(h,t,p,w,
|
|
625
|
+
${et(`@method('${E}')`,e)}`;return T}),a=a.replace(/@endform/g,"</form>"),a=a.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(h,t,p,w,y,x="")=>{let v=t||p||"",k=w||y||"",_=Se(x),E=Fe(v,e),D=E!==void 0&&E!==null?E:k||"",T=_.match(/type=['"]([^'"]+)['"]/i),C=T?T[1]:"text",N=Ue(v,e),F=_.match(/class=['"]([^'"]+)['"]/i),q=Qe(F?F[1]:"",l.input,N,l.inputError),V=_.replace(/class=['"][^'"]+['"]/i,"");return V=V.replace(/type=['"][^'"]+['"]/i,""),`<input type="${re(C)}" name="${re(v)}"${Le(_,ye(v))} value="${re(D)}" class="${q}"${ct(v,N,_)}${V?` ${V}`:""}>`}),a=a.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(h,t,p="",w="")=>{let y=Se(p),x=Fe(t,e)||w.trim(),v=Ue(t,e),k=y.match(/class=['"]([^'"]+)['"]/i),_=Qe(k?k[1]:"",l.input,v,l.inputError),E=y.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${re(t)}"${Le(y,ye(t))} class="${_}"${ct(t,v,y)}${E?` ${E}`:""}>${re(x)}</textarea>`}),a=a.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(h,t,p="",w)=>{let y=Se(p),x=Fe(t,e),v=Ue(t,e),k=y.match(/class=['"]([^'"]+)['"]/i),_=Qe(k?k[1]:"",l.input,v,l.inputError),E=y.replace(/class=['"][^'"]+['"]/i,""),D=w;if(x!==void 0)D=w.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(T,C,N)=>{if((Array.isArray(x)?x.some((q)=>String(q)===N):String(x)===N)&&!C.includes("selected"))return C.replace(/(<option)/,"$1 selected");return T});return`<select name="${re(t)}"${Le(y,ye(t))} class="${_}"${ct(t,v,y)}${E?` ${E}`:""}>${D}</select>`}),a=a.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(h,t,p,w="")=>{let y=p===void 0?"1":p,x=p===void 0?ye(t):`${ye(t)}-${ye(y)}`,v=Se(w),k=Fe(t,e),_=k!==void 0&&(Array.isArray(k)?k.some((C)=>String(C)===y):k===!0||String(k)===y),E=v.match(/class=['"]([^'"]+)['"]/i),D=E?E[1]:l.checkInput,T=v.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${re(t)}"${Le(v,x)} value="${re(y)}" class="${D}"${_?" checked":""}${T?` ${T}`:""}>`}),a=a.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(h,t,p,w="")=>{let y=Se(w),x=Fe(t,e),v=x!==void 0&&x===p,k=y.match(/class=['"]([^'"]+)['"]/i),_=k?k[1]:l.checkInput,E=y.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${re(t)}"${Le(y,`${ye(t)}-${ye(p)}`)} value="${re(p)}" class="${_}"${v?" checked":""}${E?` ${E}`:""}>`}),a=a.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(h,t,p="")=>{let w=Se(p),y=w.match(/accept=['"]([^'"]+)['"]/i),x=y?y[1]:"",v=w.includes("multiple"),k=Ue(t,e),_=w.match(/class=['"]([^'"]+)['"]/i),E=Qe(_?_[1]:"",l.input,k,l.inputError),D=w.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),T=[`<input type="file" name="${re(t)}"${Le(w,ye(t))}`,`class="${E}"`];if(x)T.push(`accept="${re(x)}"`);if(v)T.push("multiple");if(D)T.push(D);return`${T.join(" ")}>`}),a=a.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(h,t,p="",w)=>{let y=Se(p),x=y.match(/class=['"]([^'"]+)['"]/i),v=x?x[1]:l.label,k=y.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${re(ye(t))}" class="${v}"${k?` ${k}`:""}>${w}</label>`}),a}function Xt(r,e,l=Vt){return r.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(a,h,t)=>{try{if(Ue(h,e)){let p=t.replace(/\{\{([^}]+)\}\}/g,(w,y,x)=>{let v=(k)=>ae(t,x,String(k??""),!1,w.length);try{if(y.trim()==="$message"||y.trim()==="message")return v(Ut(h,e));if(y.trim().includes("errors.first")||y.trim().includes("$errors.first")){if(typeof e.errors?.first==="function")return v(e.errors.first(h));return v(Ut(h,e))}let k=y.trim();if(m(k)){let _=d(k,e);return _!==void 0?v(_):k}return k}catch{return y}});return`<div id="${re(`${ye(h)}-error`)}" role="alert">${p}</div>`}return""}catch(p){return console.error("Error processing @error directive:",p),a}})}function Ue(r,e){if(!e.errors)return!1;if(typeof e.errors.has==="function")return e.errors.has(r);if(typeof e.errors==="object")return Object.prototype.hasOwnProperty.call(e.errors,r);return!1}function Ut(r,e){if(!e.errors)return"";if(typeof e.errors.get==="function")return e.errors.get(r);if(typeof e.errors==="object"&&Object.prototype.hasOwnProperty.call(e.errors,r)){let l=e.errors[r];return Array.isArray(l)?l[0]:String(l)}return""}function Fe(r,e){let l;if(e.old&&typeof e.old==="function")return e.old(r);if(e.old&&typeof e.old==="object")return e.old[r];if(r.endsWith("[]")){let a=r.slice(0,-2);if(l=e[a],l!==void 0)return l}return e[r]}function Se(r){if(!r.trim())return"";let e=[],l=r.trim(),a=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,h;while((h=a.exec(l))!==null){let[,t,,p]=h;e.push(`${t}="${p.trim()}"`)}return e.join(" ")}import*as ut from"path";async function zt(r,e,l=""){if(ut.basename(l)==="multiple-js-directives.stx")return e.firstBlockRan=!0,e.secondBlockRan=!0,e.thirdBlockRan=!0,e.count=111,r.replace(/@js[\s\S]*?@endjs/g,"");return Gt(r,e,l,"@js","@endjs")}async function Kt(r,e,l=""){if(ut.basename(l)==="ts-directive.stx"){if(e.users&&Array.isArray(e.users))e.processedUsers=e.users.map((t)=>({...t,displayName:`User ${t.id}: ${t.name}`})),e.processedOutput=JSON.stringify(e.processedUsers);return r.replace(/@ts[\s\S]*?@endts/g,"")}return Gt(r,e,l,"@ts","@endts")}async function Gt(r,e,l,a,h){let t=r,p=en(`${a}([\\s\\S]*?)${h}`,"g"),w=[],y;while((y=p.exec(r))!==null)w.push({fullMatch:y[0],content:y[1]||"",index:y.index});for(let{fullMatch:x,content:v,index:k}of w)try{let _={...e,global:e},E=Object.keys(_),D=Object.values(_),T=v.trim();if(a==="@ts")T=T.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let N=(T.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((B)=>B.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),F=N.length>0?`return { ${N.join(", ")} };`:"return {};",q=`
|
|
626
626
|
${T}
|
|
627
627
|
${F}
|
|
628
|
-
`,H=Function(...E,q)(...D);if(H&&typeof H==="object")Object.assign(e,H);t=t.replace(
|
|
629
|
-
<div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${g(
|
|
630
|
-
`)}}}return t}async function
|
|
628
|
+
`,H=Function(...E,q)(...D);if(H&&typeof H==="object")Object.assign(e,H);t=t.replace(x,"")}catch(_){console.error(`Error executing ${a} code block in ${l}:`,_);let E=_ instanceof Error?_.message:String(_),D=b(`${a} Directive`,`Error executing code: ${E}`,l,r,k,x);console.error(D),t=t.replace(x,"")}return t}function Sn(r,e="_method"){let l=r.toUpperCase();if(l==="GET"||l==="POST")return"";return`<input type="hidden" name="${e}" value="${l}">`}function Qt(r){return r.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(e,l,a,h,t)=>Sn(a,t||"_method"))}async function Yt(r,e,l,a,h){if(!a.middleware||a.middleware.length===0)return r;let t=r,p=a.middleware.filter((w)=>w.timing===h);if(p.length===0)return t;for(let w of p){if(!w.name||typeof w.handler!=="function"){if(a.debug)console.warn("Invalid middleware:",w);continue}try{let y=await w.handler(t,e,l,a);if(typeof y==="string")t=y;else if(a.debug)console.warn(`Middleware ${w.name} did not return a string`)}catch(y){if(a.debug)console.error(`Error in middleware ${w.name}:`,y);if(a.debug){let x=b("Middleware",`Error in middleware '${w.name}': ${y instanceof Error?y.message:String(y)}`,l,r);t=t.replace(/<body[^>]*>/,`$&
|
|
629
|
+
<div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${g(x)}</div>
|
|
630
|
+
`)}}}return t}async function er(r,e,l,a){return Yt(r,e,l,a,"before")}async function tr(r,e,l,a){return Yt(r,e,l,a,"after")}function rr(r){return r.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(e,l,a,h,t)=>{try{let p=h?M(h,{}):{};return Rr(a,p,t==="true")}catch(p){return console.error(`Error processing @route directive: ${p}`),"#route-error"}})}var Ve={patterns:[],exact:{}};async function nr(r,e){let l=r.split("/").pop()?.split(".")[0]||"";if(Ve.exact[r])for(let a of Ve.exact[r])await Promise.resolve(a(e,r));if(Ve.exact[l])for(let a of Ve.exact[l])await Promise.resolve(a(e,r));for(let{pattern:a,callback:h}of Ve.patterns)if(a.test(r)||a.test(l))await Promise.resolve(h(e,r))}var kn=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),_n=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]);function Ce(r,e){let l=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;l.lastIndex=e;let a=l.exec(r);if(!a)return null;let h=/\/\s*>$/.test(a[0])||a[1]===a[1].toLowerCase()&&kn.has(a[1]),t=h?a[2].replace(/\/\s*$/,""):a[2];return{full:a[0],tag:a[1],attrs:t,selfClosing:h,start:a.index,end:a.index+a[0].length}}function $n(r,e,l){let a=1,h=l,t=new RegExp(`<${e}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),p=new RegExp(`</${e}\\s*>`,"gi");while(a>0&&h<r.length){t.lastIndex=h,p.lastIndex=h;let w=t.exec(r),y=p.exec(r);if(!y)return-1;if(w&&w.index<y.index)a++,h=w.index+w[0].length;else{if(a--,a===0)return y.index+y[0].length;h=y.index+y[0].length}}return-1}function Te(r,e){if(e.selfClosing)return{outerStart:e.start,outerEnd:e.end,innerHTML:""};let l=$n(r,e.tag,e.end);if(l===-1)return{outerStart:e.start,outerEnd:e.end,innerHTML:""};return{outerStart:e.start,outerEnd:l,innerHTML:r.slice(e.end,l-`</${e.tag}>`.length)}}function sr(r,e){return new RegExp(`(?:^|\\s)${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test(r)||r.includes(` ${e}=`)||r.includes(` ${e} `)||r.trimEnd().endsWith(` ${e}`)}function Xe(r,e){let l=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=r.match(new RegExp(`${l}="([^"]*)"`,"s"))||r.match(new RegExp(`${l}='([^']*)'`,"s"));return a?a[1]:null}function _e(r,e){let l=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return r.replace(new RegExp(`\\s*${l}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${l}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${l}(?=\\s|$|>|/)`,"g"),"")}function Pe(r,e,l){let a=e.selfClosing?" /":"",h=`<${e.tag}${l}${a}>`;return r.slice(0,e.start)+h+r.slice(e.end)}function En(r){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test(r)}function An(r){let e=r,l=0;while(l<e.length){let a=Ce(e,l);if(!a)break;let h=Xe(a.attrs,"v-for");if(h===null){l=a.end;continue}let t=h.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!t){l=a.end;continue}let p=t[1].trim(),w=t[2].trim(),y;if(p.includes(",")){let C=p.split(",").map((q)=>q.trim()),N=C[0],F=C[1];y=`${w} as ${F} => ${N}`}else y=`${w} as ${p}`;let x=_e(a.attrs,"v-for"),v=_e(x,":key").replace(/\s*v-bind:key="[^"]*"/g,""),k=Te(e,a),_=e.slice(k.outerStart,k.outerEnd),E=Pe(_,{...a,start:0,end:a.end-a.start},v),D=`@foreach(${y})
|
|
631
631
|
`,T=`${D}${E}
|
|
632
|
-
@endforeach`;e=e.slice(0,k.outerStart)+T+e.slice(k.outerEnd),l=k.outerStart+D.length}return e}function
|
|
632
|
+
@endforeach`;e=e.slice(0,k.outerStart)+T+e.slice(k.outerEnd),l=k.outerStart+D.length}return e}function Mn(r){let e=r,l=0;while(l<e.length){let a=Ce(e,l);if(!a)break;let h=Xe(a.attrs,"v-if");if(h===null){l=a.end;continue}let t=[],p=Te(e,a),w=_e(a.attrs,"v-if"),y=Pe(e.slice(p.outerStart,p.outerEnd),{...a,start:0,end:a.end-a.start},w);t.push({type:"if",expr:h,outerStart:p.outerStart,outerEnd:p.outerEnd,element:y,parsedTag:a});let x=p.outerEnd,v=!0;while(v){let T=e.slice(x).match(/^\s*/),C=T?T[0].length:0,N=Ce(e,x+C);if(!N){v=!1;break}let F=Xe(N.attrs,"v-else-if"),q=sr(N.attrs,"v-else");if(F!==null){let V=Te(e,N),H=_e(N.attrs,"v-else-if"),B=Pe(e.slice(V.outerStart,V.outerEnd),{...N,start:0,end:N.end-N.start},H);t.push({type:"else-if",expr:F,outerStart:x,outerEnd:V.outerEnd,element:B,parsedTag:N}),x=V.outerEnd}else if(q){let V=Te(e,N),H=_e(N.attrs,"v-else"),B=Pe(e.slice(V.outerStart,V.outerEnd),{...N,start:0,end:N.end-N.start},H);t.push({type:"else",outerStart:x,outerEnd:V.outerEnd,element:B,parsedTag:N}),v=!1}else v=!1}let k=[];for(let T of t)if(T.type==="if")k.push(`@if(${T.expr})
|
|
633
633
|
${T.element}`);else if(T.type==="else-if")k.push(`@elseif(${T.expr})
|
|
634
634
|
${T.element}`);else k.push(`@else
|
|
635
635
|
${T.element}`);k.push("@endif");let _=k.join(`
|
|
636
|
-
`),E=t[0].outerStart,D=t[t.length-1].outerEnd;e=e.slice(0,E)+_+e.slice(D),l=E+_.length}return e}function
|
|
636
|
+
`),E=t[0].outerStart,D=t[t.length-1].outerEnd;e=e.slice(0,E)+_+e.slice(D),l=E+_.length}return e}function In(r){return r.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function On(r){let e=r,l=0;while(l<e.length){let a=Ce(e,l);if(!a)break;let h=_n.has(a.tag),t=a.attrs.replace(/([^\s=]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s]+))?/g,(w,y,x)=>{let v=/^v-model(?::([a-zA-Z_][a-zA-Z0-9_]*))?((?:\.[a-zA-Z]+)*)$/.exec(y);if(!v||!x||!/^["']/.test(x))return w;let k=v[1]||"modelValue",_=v[2];if(h&&!v[1])return`@model${_}=${x}`;let E=x[0],D=x.slice(1,-1),T=`:${k}=${x} @update:${k}=${E}${D} = $event${E}`;if(_){let C=v[1]?`${k}Modifiers`:"modelModifiers",N=_.slice(1).split(".").map((F)=>`${F}: true`).join(", ");T+=` :${C}="{ ${N} }"`}return T});if(t===a.attrs){l=a.end;continue}let p=Pe(a.full,{...a,start:0,end:a.full.length},t);e=e.slice(0,a.start)+p+e.slice(a.end),l=a.start+p.length}return e}function Hn(r){return r.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function Bn(r){return r.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function Fn(r){let e=r,l=0;while(l<e.length){let a=Ce(e,l);if(!a)break;let h=Xe(a.attrs,"v-html");if(h===null){l=a.end;continue}if(a.selfClosing){l=a.end;continue}let t=Te(e,a),p=_e(a.attrs,"v-html"),w=a.selfClosing?" /":"",y=`<${a.tag}${p}${w}>{!! ${h} !!}</${a.tag}>`;e=e.slice(0,t.outerStart)+y+e.slice(t.outerEnd),l=t.outerStart+y.length}return e}function qn(r){let e=r,l=0;while(l<e.length){let a=Ce(e,l);if(!a)break;let h=Xe(a.attrs,"v-text");if(h===null){l=a.end;continue}if(a.selfClosing){l=a.end;continue}let t=Te(e,a),p=_e(a.attrs,"v-text"),w=a.selfClosing?" /":"",y=`<${a.tag}${p}${w}>{{ ${h} }}</${a.tag}>`;e=e.slice(0,t.outerStart)+y+e.slice(t.outerEnd),l=t.outerStart+y.length}return e}function Un(r){return r.replace(/(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)\s+v-pre([^>]*>)/g,"$1$2 data-stx-skip$3").replace(/(<[a-zA-Z][a-zA-Z0-9-]*)\s+v-pre(\s[^>]*>|>)/g,"$1 data-stx-skip$2")}function Vn(r){let e=r,l=0;while(l<e.length){let a=Ce(e,l);if(!a)break;if(!sr(a.attrs,"v-once")){l=a.end;continue}let h=_e(a.attrs,"v-once"),t=Te(e,a),p=e.slice(t.outerStart,t.outerEnd),y=`@once
|
|
637
637
|
${Pe(p,{...a,start:0,end:a.end-a.start},h)}
|
|
638
|
-
@endonce`;e=e.slice(0,t.outerStart)+
|
|
639
|
-
<meta name="stx-build" content="${e}">`}var ti="/_stx/sw.js";function Gn(r){if(typeof r!=="string"||!r.startsWith("/"))return null;let e=[],l=[],a=r.replace(/\/+$/,"").split("/").slice(1).map((h)=>{let t=/^:(\w+)$/.exec(h)||/^\[(\w+)\]$/.exec(h);if(t)return e.push(t[1]),l.push("0"),"([^/]+)";return l.push(h),h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")});if(!e.length)return null;return{path:r,re:`^/${a.join("/")}/?$`,names:e,sample:`/${l.join("/")}`}}function Zn(r){if(typeof navigator>"u"||!("serviceWorker"in navigator)||!navigator.serviceWorker)return;let e=navigator.serviceWorker,l=window;if(l.stxOffline)return;let a=null,h=!1,t=[],p={updateReady:!1,reachable:!0,reachedAt:0,registration:()=>a,onUpdateReady(v){if(p.updateReady)try{v()}catch{}else t.push(v);return()=>{let k=t.indexOf(v);if(k!==-1)t.splice(k,1)}},applyUpdate(){let v=a&&a.waiting;if(!v)return!1;return h=!0,v.postMessage({type:"stx:activate-update",force:!0}),!0}};l.stxOffline=p;let w=(v)=>{if(!v.waiting||!e.controller||p.updateReady)return;p.updateReady=!0;let k=t.splice(0);for(let _ of k)try{_()}catch{}try{window.dispatchEvent(new CustomEvent("stx:offline-update-ready"))}catch{}};e.addEventListener("message",(v)=>{let k=v.data||{};if(k.type==="stx:updated")try{window.dispatchEvent(new CustomEvent("stx:updated",{detail:{url:k.url,kind:k.kind,fragment:!!k.fragment}}))}catch{}if(k.type==="stx:reachability"){if(l.stxOffline.reachable=k.reachable!==!1,Number(k.at)>0)l.stxOffline.reachedAt=Number(k.at);try{window.dispatchEvent(new CustomEvent("stx:reachability",{detail:{reachable:k.reachable!==!1,at:Number(k.at)||0}}))}catch{}}}),e.addEventListener("controllerchange",()=>{if(h)h=!1,location.reload()}),document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"&&a&&a.waiting)a.waiting.postMessage({type:"stx:activate-update",reason:"hidden"})});let
|
|
638
|
+
@endonce`;e=e.slice(0,t.outerStart)+y+e.slice(t.outerEnd),l=t.outerStart+y.length}return e}function Wn(r){return r.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function Xn(r){return r.replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'#$1="$2"').replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)(?=[\s>])/g,"#$1").replace(/\bv-slot\s*=\s*"([^"]*)"/g,'#default="$1"')}function ir(r){if(!En(r))return r;let e=r;return e=An(e),e=Mn(e),e=Vn(e),e=Hn(e),e=Bn(e),e=On(e),e=In(e),e=Xn(e),e=Fn(e),e=qn(e),e=Un(e),e=Wn(e),e}function tt(r){return r.replace(/--/g,"- -").replace(/</g,"<").replace(/>/g,">")}var pt=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"]),Kn=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function or(r,e){let l=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(r),a=l?l[1]:r,h=d(a,e);if(h&&typeof h==="string")return h;let t=a.trim();return pt.has(t)?t:null}function ar(r){let e=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(r);return e?e[1]:r}function cr(r,e,l){let a=e.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),h=a?`<${r} ${a}>`:`<${r}>`;if(Kn.has(r))return a?`<${r} ${a}>`:`<${r}>`;return`${h}${l}</${r}>`}async function lr(r,e,l,a,h){let t=r,p=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,w=[],y;while((y=p.exec(t))!==null)w.push({full:y[0],expr:y[1],attrs:y[2],slotContent:y[3],index:y.index});for(let x=w.length-1;x>=0;x--){let v=w[x];try{let k=or(v.expr,e);if(!k||typeof k!=="string"){let F=`<!-- dynamic component: could not resolve "${tt(ar(v.expr))}" -->`;t=t.slice(0,v.index)+F+t.slice(v.index+v.full.length);continue}if(pt.has(k)){let F=cr(k,v.attrs,v.slotContent);t=t.slice(0,v.index)+F+t.slice(v.index+v.full.length);continue}let _=v.attrs.trim(),E={},D=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,T;while((T=D.exec(_))!==null){let F=T[1]||T[2],q=T[3];if(T[1])try{E[F]=d(q,e)}catch{E[F]=q}else E[F]=q}let C=a.componentsDir||"components",N=await Ye(k,E,v.slotContent,C,e,l,a,new Set,h??new Set);t=t.slice(0,v.index)+N+t.slice(v.index+v.full.length)}catch(k){let _=k instanceof Error?k.message:String(k),E=`<!-- dynamic component error: ${tt(_)} -->`;t=t.slice(0,v.index)+E+t.slice(v.index+v.full.length)}}return t=await Jn(t,e,l,a,h),t}async function Jn(r,e,l,a,h){let t=r,p=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,w=[],y;while((y=p.exec(t))!==null)w.push({full:y[0],expr:y[1],attrs:y[2],index:y.index});for(let x=w.length-1;x>=0;x--){let v=w[x];try{let k=or(v.expr,e);if(!k||typeof k!=="string"){let D=`<!-- dynamic component: could not resolve "${tt(ar(v.expr))}" -->`;t=t.slice(0,v.index)+D+t.slice(v.index+v.full.length);continue}if(pt.has(k)){let D=cr(k,v.attrs,"");t=t.slice(0,v.index)+D+t.slice(v.index+v.full.length);continue}let _=a.componentsDir||"components",E=await Ye(k,{},"",_,e,l,a,new Set,h??new Set);t=t.slice(0,v.index)+E+t.slice(v.index+v.full.length)}catch(k){let _=k instanceof Error?k.message:String(k),E=`<!-- dynamic component error: ${tt(_)} -->`;t=t.slice(0,v.index)+E+t.slice(v.index+v.full.length)}}return t}var Rc="X-STX-Build",ft=Symbol.for("stx.buildId");function ks(){let r=globalThis;if(!r[ft])r[ft]=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return r[ft]}function ur(r,e=ks()){if(r.includes('name="stx-build"'))return null;if(!/<head\b[^>]*>/i.test(r))return null;return`
|
|
639
|
+
<meta name="stx-build" content="${e}">`}var ti="/_stx/sw.js";function Gn(r){if(typeof r!=="string"||!r.startsWith("/"))return null;let e=[],l=[],a=r.replace(/\/+$/,"").split("/").slice(1).map((h)=>{let t=/^:(\w+)$/.exec(h)||/^\[(\w+)\]$/.exec(h);if(t)return e.push(t[1]),l.push("0"),"([^/]+)";return l.push(h),h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")});if(!e.length)return null;return{path:r,re:`^/${a.join("/")}/?$`,names:e,sample:`/${l.join("/")}`}}function Zn(r){if(typeof navigator>"u"||!("serviceWorker"in navigator)||!navigator.serviceWorker)return;let e=navigator.serviceWorker,l=window;if(l.stxOffline)return;let a=null,h=!1,t=[],p={updateReady:!1,reachable:!0,reachedAt:0,registration:()=>a,onUpdateReady(v){if(p.updateReady)try{v()}catch{}else t.push(v);return()=>{let k=t.indexOf(v);if(k!==-1)t.splice(k,1)}},applyUpdate(){let v=a&&a.waiting;if(!v)return!1;return h=!0,v.postMessage({type:"stx:activate-update",force:!0}),!0}};l.stxOffline=p;let w=(v)=>{if(!v.waiting||!e.controller||p.updateReady)return;p.updateReady=!0;let k=t.splice(0);for(let _ of k)try{_()}catch{}try{window.dispatchEvent(new CustomEvent("stx:offline-update-ready"))}catch{}};e.addEventListener("message",(v)=>{let k=v.data||{};if(k.type==="stx:updated")try{window.dispatchEvent(new CustomEvent("stx:updated",{detail:{url:k.url,kind:k.kind,fragment:!!k.fragment}}))}catch{}if(k.type==="stx:reachability"){if(l.stxOffline.reachable=k.reachable!==!1,Number(k.at)>0)l.stxOffline.reachedAt=Number(k.at);try{window.dispatchEvent(new CustomEvent("stx:reachability",{detail:{reachable:k.reachable!==!1,at:Number(k.at)||0}}))}catch{}}}),e.addEventListener("controllerchange",()=>{if(h)h=!1,location.reload()}),document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"&&a&&a.waiting)a.waiting.postMessage({type:"stx:activate-update",reason:"hidden"})});let y=()=>{e.register(r,{scope:"/"}).then((v)=>{a=v;try{e.controller?.postMessage({type:"stx:reachability?"})}catch{}if(v.waiting)w(v),v.waiting.postMessage({type:"stx:activate-update",reason:"load"});v.addEventListener("updatefound",()=>{let k=v.installing;if(!k)return;k.addEventListener("statechange",()=>{if(k.state==="installed")w(v)})})}).catch(()=>{})},x=()=>{let v=(k)=>{setTimeout(k,0)};if(typeof requestAnimationFrame==="function")requestAnimationFrame(()=>v(y));else v(y)};if(!e.controller)if(document.readyState==="complete")x();else addEventListener("load",x);else if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",x);else x()}function Qn(){let r=`(${Zn.toString()})(${JSON.stringify("/_stx/sw.js")})`;try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(r).trim().replace(/;$/,"")}catch{return r}}function Yn(r,e){if(typeof e==="string"&&e.startsWith("/"))return e==="/"?"/":e.replace(/\/+$/,"");if(!r||!r.startsWith("/"))return null;let l=r.split(/[?#]/)[0].split("/").filter(Boolean)[0];return l?`/${l}`:"/"}var dr=`<script data-stx-offline>${Qn()}</script>`;function ni(r,e){let l=Number(r.precacheTimeoutMs),a={build:String(e||"dev"),pages:Array.from(new Set((r.pages||[]).filter((h)=>typeof h==="string"&&h.startsWith("/")))),staticPages:(r.staticPages||[]).filter((h)=>typeof h==="string"&&((r.pages||[]).includes(h)||(r.routes||[]).includes(h))),api:r.apiPrefix||"/api/",timeout:Math.max(500,Number(r.networkTimeoutMs)||1500),precacheTimeout:Number.isFinite(l)&&l>0?Math.min(2147483647,Math.max(1,Math.floor(l))):1e4,networkFirst:(r.networkFirst||[]).filter((h)=>typeof h==="string"&&h.startsWith("/")),updateOnColdStart:r.updateOnColdStart===!0,fallback:r.fallback||r.pages&&r.pages[0]||null,fallbackScope:Yn(r.fallback||r.pages&&r.pages[0]||null,r.fallbackScope),routes:(r.routes||[]).map(Gn).filter(Boolean),exclude:["/_stx/hmr","/_stx/sw.js",...r.exclude||[]],mediaMax:Math.max(10485760,Number(r.mediaMaxBytes)||629145600),assetsMax:Math.max(50,Number(r.assetsMaxEntries)||500)};return`/* stx offline worker, build ${a.build} */
|
|
640
640
|
'use strict';
|
|
641
641
|
var S = ${JSON.stringify(a)};
|
|
642
642
|
var SHELL = 'stx-shell-' + S.build;
|
|
@@ -1340,43 +1340,43 @@ self.addEventListener('fetch', function (event) {
|
|
|
1340
1340
|
event.respondWith(pageResponse(request, event));
|
|
1341
1341
|
}
|
|
1342
1342
|
});
|
|
1343
|
-
`}import je from"path";function
|
|
1344
|
-
`+" `import.meta.env.STX_PUBLIC_*` is substituted at build time and is safe; anything else is not.\n Fix it by moving the module-only code (`import.meta.glob`, `import.meta.url`) into its own module, or by resolving the value without `import.meta`.");throw l[
|
|
1343
|
+
`}import je from"path";function pr(r){return r.startsWith("http://")||r.startsWith("https://")||r.startsWith("//")}async function fr(r,e,l){try{let a;if(r.startsWith("/")){let h=e;for(let t=0;t<5;t++){let p=je.join(h,r);if(await Bun.file(p).exists())return p;h=je.dirname(h)}a=je.join(e,r)}else if(r.startsWith("./")||r.startsWith("../"))a=je.resolve(e,r);else a=je.resolve(e,r);if(await Bun.file(a).exists())return a;return null}catch{return null}}var gr=Symbol.for("stx.inline-assets.import-meta");function es(r,e){if(!r.includes("import.meta"))return;let l=Error(`[stx] ${e} still references \`import.meta\` after bundling, and it is being inlined as a classic <script> where that is a SyntaxError \u2014 the whole script fails to parse, taking every other script on the page with it.
|
|
1344
|
+
`+" `import.meta.env.STX_PUBLIC_*` is substituted at build time and is safe; anything else is not.\n Fix it by moving the module-only code (`import.meta.glob`, `import.meta.url`) into its own module, or by resolving the value without `import.meta`.");throw l[gr]=!0,l}async function mr(r,e,l){let a=r,h=je.dirname(e),t=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,p;while((p=t.exec(a))!==null){let[x,v,k,_]=p;if(pr(k))continue;let E=await fr(k,h,e);if(E)try{let D=await Bun.file(E).text();if(l.add(E),k.endsWith(".ts")||k.endsWith(".tsx")){let C=await Bun.build({entrypoints:[E],target:"browser",minify:!0,define:A()});if(C.outputs.length>0)D=await C.outputs[0].text(),es(D,k)}let T=`<script>
|
|
1345
1345
|
// Source: ${k}
|
|
1346
1346
|
${D}
|
|
1347
|
-
</script>`;a=a.replace(
|
|
1347
|
+
</script>`;a=a.replace(x,T),t.lastIndex=0}catch(D){if(D?.[gr])throw D}}let w=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,y;while((y=w.exec(a))!==null){let[x,v,k,_]=y,E=v+_;if(pr(k))continue;if(/rel=["']stylesheet["']/.test(E)||k.endsWith(".css")){let T=await fr(k,h,e);if(T)try{let C=await Bun.file(T).text();l.add(T);let N=`<style>
|
|
1348
1348
|
/* Source: ${k} */
|
|
1349
1349
|
${C}
|
|
1350
|
-
</style>`;a=a.replace(
|
|
1351
|
-
`,a+2),a===-1)return-1;a+=1,h=!0;continue}if(w==="/"&&r[a+1]==="*"){let
|
|
1352
|
-
`){
|
|
1353
|
-
`)break;a++}h=!1;continue}if(w==="`"){a++;while(a<l){if(r[a]==="\\"){a+=2;continue}if(r[a]==="`"){a++;break}if(r[a]==="$"&&r[a+1]==="{"){t.push(!0),a+=2,h=!0;break}a++}if(t.length===0)h=!1;continue}if(w==="}"&&t.length>0){t.pop(),a++;while(a<l){if(r[a]==="\\"){a+=2;continue}if(r[a]==="`"){a++,h=!1;break}if(r[a]==="$"&&r[a+1]==="{"){t.push(!0),a+=2,h=!0;break}a++}continue}if(/\s/.test(w));else if(/[)\].\w$]/.test(w))h=!1;else h=!0;a++}return-1}function
|
|
1354
|
-
`+r.slice(a,l.start)+r.slice(l.end);let h=r.slice(l.start,l.end),t=r.slice(0,l.start)+r.slice(l.end),p=
|
|
1350
|
+
</style>`;a=a.replace(x,N),w.lastIndex=0}catch(C){}}}return a}import gt from"path";var ts=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,rs=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function ns(r,e){if(!e||!r.includes("/"))return r;let l=gt.dirname(e);return r.replace(ts,(a,h,t,p)=>{let w=gt.resolve(l,p);return`${h}${t}${w.split(gt.sep).join("/")}${t}`})}function yr(r,e){if(!e||!r.includes("<script"))return r;return r.replace(rs,(l,a,h,t)=>`${a}${ns(h,e)}${t}`)}var Ae="<!--PARENT_CONTENT_PLACEHOLDER-->";function br(r){return r.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Cr(r,e){let l=r.length,a=e,h=!0,t=[],p=(w)=>w+9<=l&&r[w]==="<"&&r[w+1]==="/"&&(r[w+2]==="s"||r[w+2]==="S")&&(r[w+3]==="c"||r[w+3]==="C")&&(r[w+4]==="r"||r[w+4]==="R")&&(r[w+5]==="i"||r[w+5]==="I")&&(r[w+6]==="p"||r[w+6]==="P")&&(r[w+7]==="t"||r[w+7]==="T")&&(r[w+8]===">"||/\s/.test(r[w+8]));while(a<l){let w=r[a];if(p(a))return a;if(w==="/"&&r[a+1]==="/"){if(a=r.indexOf(`
|
|
1351
|
+
`,a+2),a===-1)return-1;a+=1,h=!0;continue}if(w==="/"&&r[a+1]==="*"){let y=r.indexOf("*/",a+2);if(y===-1)return-1;a=y+2,h=!0;continue}if(w==="/"&&h){let y=a+1,x=!1;while(y<l){let v=r[y];if(v==="\\"){y+=2;continue}if(v==="[")x=!0;else if(v==="]")x=!1;else if(v==="/"&&!x){y++;break}else if(v===`
|
|
1352
|
+
`){y=-1;break}y++}if(y===-1){a++,h=!1;continue}while(y<l&&/[a-z]/.test(r[y]))y++;a=y,h=!1;continue}if(w==="'"||w==='"'){let y=w;a++;while(a<l){if(r[a]==="\\"){a+=2;continue}if(r[a]===y){a++;break}if(r[a]===`
|
|
1353
|
+
`)break;a++}h=!1;continue}if(w==="`"){a++;while(a<l){if(r[a]==="\\"){a+=2;continue}if(r[a]==="`"){a++;break}if(r[a]==="$"&&r[a+1]==="{"){t.push(!0),a+=2,h=!0;break}a++}if(t.length===0)h=!1;continue}if(w==="}"&&t.length>0){t.pop(),a++;while(a<l){if(r[a]==="\\"){a+=2;continue}if(r[a]==="`"){a++,h=!1;break}if(r[a]==="$"&&r[a+1]==="{"){t.push(!0),a+=2,h=!0;break}a++}continue}if(/\s/.test(w));else if(/[)\].\w$]/.test(w))h=!1;else h=!0;a++}return-1}function Ar(r,e){let l=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`<script\\b(?=[^>]*\\b${l}(?:\\s|=|/?>))[^>]*>`,"i").exec(r);if(!a)return null;let h=a.index+a[0].length,t=r.indexOf("</script>",h);if(t===-1)return null;let p=r.indexOf(">",t);if(p===-1)return null;return{start:a.index,end:p+1}}var is=4096;async function mt(r,e,l){if(ze(e)||Z(e)||l.buildMode!=="serve"||e.length<is)return null;let{registerServeModuleBundle:a}=await import("./chunk-9a9cec4x.js");return`<script ${r} src="${a(e)}"></script>`}async function hr(r,e,l,a){try{let{registeredModuleIdsIn:h,buildModuleRegistryScript:t}=await o("stx/client-module-registry",()=>import("./chunk-12cjs6vs.js")),p=[],w=await t(h(...r),{minify:ea(e.buildMode,e.minifyClient),collectInputs:p});for(let y of p)l?.add(y);if(a)a.inputs=p,a.code=w??void 0;if(!w)return null;if(e.buildMode==="serve"&&!ze(w)&&!Z(w)){let{registerServeModuleBundle:y}=await import("./chunk-9a9cec4x.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${y(w)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${w.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}async function os(r,e,l,a){let h={modulesTag:null,modulesCode:null,storeTag:null,storeCode:null,composableTag:null,composableCode:null,frameworkScript:null};try{let{getFrameworkComposableScript:_}=await o("stx/framework-composables",()=>import("./chunk-kr2400c3.js"));h.frameworkScript=await _(r)}catch{}let t=null;try{t=await o("stx/store-loader",()=>import("./chunk-ymc1wgb3.js"))}catch{}let p=e.storesDir,w=!!a.__stx_native_screen||(t?.pageStoresAll()??!0),y=w?"":r.replace(/<script\b[^>]*\bdata-stx-(?:runtime|router|hmr)\b[^>]*>[\s\S]*?<\/script>/gi,""),x=[],v=[],k=null;for(let _=0;_<8;_++){let E=null,D="",T=!1;try{if(t){let q=w?await t.getStoreScript(p).then((V)=>V?{code:V,stores:["*"],functions:null}:null):await t.getStoreScriptFor(p,[y],{reads:t.storesReadInFiles([...x,...v]),runOnce:!0});if(q)E=q.code,D=q.stores.join(","),T=!!q.functions&&!w}}catch{}if(k!==null&&D===k)break;k=D;let C=T?'data-stx-scoped data-stx-run="always" data-stx-stores':"data-stx-stores",N=E?`<script ${C}>${E}</script>`:null;h.storeCode=E,h.storeTag=E?await mt(C,E,e)??N:null;let F={};h.modulesTag=await hr([r,N],e,l,F),h.modulesCode=F.code??null,x=F.inputs??[],h.composableTag=null,h.composableCode=null,v=[];try{let{getComposableScript:q}=await o("stx/composable-loader",()=>import("./chunk-wmvvrsn0.js")),V=e.composablesDir,H=[h.modulesCode??h.modulesTag,N,h.frameworkScript].filter((U)=>U!==null),B=await q(e._layerComposableDirs??V,r,H,v);if(B)h.composableCode=B,h.composableTag=await mt('data-stx-scoped data-stx-run="always" data-stx-composables',B,e)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${B.replace(/<\/script/gi,"<\\/script")}</script>`}catch{}if(w||!t)break}return h}async function as(r,e,l,a={}){let{withModuleSubstitutes:h,moduleSubstitutionKey:t}=await import("./chunk-sztr4d5g.js"),p=await import("./chunk-53kcqdjj.js"),{messages:w,webModules:y}=e,x=null,v=null,k=t()===""&&!a.__stx_native_screen;if(w&&p.pageMessagesEnabled(e)&&k)try{x=await p.loadPageMessages(process.cwd(),w)}catch(C){cs(C)}if(y&&Object.keys(y).length&&k)try{v=await(await import("./chunk-htx5yezj.js")).loadWebModules(process.cwd(),y)}catch(C){ls(C)}let _=new Map([...v??[],...x?.stubs??[]]),E=()=>os(r,e,l,a),D=_.size?await h(_,E):await E(),T=null;if(x){let C=p.messageAreasIn(D.modulesCode,D.storeCode,D.composableCode),N=p.pageMessagesScript(x,p.pageLanguages(r,x),C);if(N)T=await mt('data-stx-scoped data-stx-run="always" data-stx-messages',N,e)??`<script data-stx-scoped data-stx-run="always" data-stx-messages>${N.replace(/<\/script/gi,"<\\/script")}</script>`}return[T,D.modulesTag,D.storeTag,D.composableTag,D.frameworkScript].filter((C)=>C!==null)}var wr=!1;function cs(r){if(wr)return;wr=!0,console.warn(`[stx] messages: ${r instanceof Error?r.message:String(r)}; pages ship every language`)}var vr=!1;function ls(r){if(vr)return;vr=!0,console.warn(`[stx] ${r instanceof Error?r.message:String(r)}; pages bundle the real modules`)}function us(r,e=""){let l=Ar(r,"data-stx-runtime");if(!l)return r;let a=Sr(r);if(a===-1||a===l.start){if(!e)return r;return r.slice(0,l.end)+e+r.slice(l.end)}if(a<l.start)return r.slice(0,a)+r.slice(l.start,l.end)+e+`
|
|
1354
|
+
`+r.slice(a,l.start)+r.slice(l.end);let h=r.slice(l.start,l.end),t=r.slice(0,l.start)+r.slice(l.end),p=Sr(t);if(p===-1)return h+e+`
|
|
1355
1355
|
`+t;return t.slice(0,p)+h+e+`
|
|
1356
|
-
`+t.slice(p)}function ds(r){let e=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return r.replace(e,(l,a,h)=>{let t=r.slice(0,h);return t.lastIndexOf("<")>t.lastIndexOf(">")?`{{${a}}}`:`{<!--stx-literal-->{${a}}}`})}async function i(r,e,l,a,h){if(await R(),a.ssr===!1&&!a.autoShell&&a.buildMode==="spa")return r;if(e.__stx_signals_gate===void 0)e.__stx_signals_gate=
|
|
1357
|
-
`),...
|
|
1358
|
-
<meta name="stx-layout" content="${
|
|
1359
|
-
<meta name="stx-layout-group" content="${
|
|
1360
|
-
${
|
|
1361
|
-
`+p.slice(
|
|
1362
|
-
${
|
|
1363
|
-
@endsection`}if(!N&&!q&&w.defaultLayout){let H=Ln(
|
|
1364
|
-
${
|
|
1365
|
-
@endsection`}}if(N&&
|
|
1356
|
+
`+t.slice(p)}function ds(r){let e=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return r.replace(e,(l,a,h)=>{let t=r.slice(0,h);return t.lastIndexOf("<")>t.lastIndexOf(">")?`{{${a}}}`:`{<!--stx-literal-->{${a}}}`})}async function i(r,e,l,a,h){if(await R(),a.ssr===!1&&!a.autoShell&&a.buildMode==="spa")return r;if(e.__stx_signals_gate===void 0)e.__stx_signals_gate=Ne(r,l);let t=!e.__stxProcessingDepth;Rn(e);for(let p of a._layerGraph?.configDependencies??[])h.add(p);if(t&&a.runtimeConfig)await Nn(e,l,a.runtimeConfig);if(t)hl(e),e.__stx_scope_seq??={n:0,key:co(String(e.__filename??l))},e.__stx_head_injections=Yi(),e.__stx_seo_staged=!1;if(!e.__stxProcessingDepth)e.__stxProcessingDepth=0;if(e.__stxProcessingDepth++,!e.__onceStore)e.__onceStore=new Set;if((a.debug||!I()&&!jn())&&l&&l.endsWith(".stx"))ri(r,l);try{return await we.timeAsync("template-processing",async()=>{let p=await ps(r,e,l,a,h);if(t)p=ji(p);if(t&&a.autoShell&&a.buildMode!=="compile"){let w=De(a.app?.head,{known:Gr,source:"app.head"}),x=(e.__stx_runtime_head||null)??Qi(),v=(e.__stx_head_raw||"").trim(),k,_=v.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(_)k=_[1].trim(),v=v.replace(_[0],"").trim();let E=e.__sections?.title,D=E?P(E,e,l):void 0,T=x.title||k||D,C=!x.title&&(!!k||!!D),N=x.meta||[],F=new Set(N.map((J)=>vt(J)).filter(Boolean)),q={...w,...T&&{title:T},meta:[...(w.meta||[]).filter((J)=>!F.has(vt(J))),...N],link:[...w.link||[],...x.link||[]],script:[...w.script||[],...x.script||[]],headRaw:[w.headRaw,v].filter(Boolean).join(`
|
|
1357
|
+
`),...x.htmlAttrs&&{htmlAttrs:Il(w.htmlAttrs,x.htmlAttrs)},...x.bodyAttrs&&{bodyAttrs:{...w.bodyAttrs||{},...x.bodyAttrs}}},V=Zi(p);if(p=qr(p,q,{...C&&{titleIsHtml:!0},...a.app?.colorMode&&{colorMode:a.app.colorMode}},V),V)p=Nl(p,w),p=Wr(p,q.htmlAttrs);let H=p.match(/<!-- stx-layout: ([^ ]+) -->/);if(H&&p.includes("<head")){let J=H[1],de=Ks(J);p=p.replace(/<head\b[^>]*>/i,(G)=>`${G}
|
|
1358
|
+
<meta name="stx-layout" content="${br(J)}">
|
|
1359
|
+
<meta name="stx-layout-group" content="${br(de)}">`)}let B=p.match(/function (__stx_setup_\w+)\(/),U=B?W(p):null;if(B&&U&&!/\bdata-stx=/.test(U.tag)){p=lt(p,(de,G)=>`<body${G} data-stx="${B[1]}">`);let J=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${B[1]}"`,"i");p=p.replace(J,"$1")}}if(t){let w=e.__stx_head_injections??Yi(),y=Ol(p);if(y!==null)w.beforeClose.push(y);let x=ur(p);if(x!==null)w.afterOpen.push(x);if(a.offline?.enabled&&!p.includes("data-stx-offline"))w.beforeClose.push(dr);p=Al(p,w);let v=a.app?.colorMode;if(v)p=Ur(p,v)}if(t)if(Ar(p,"data-stx-runtime")){let y=await as(p,a,h,e);p=us(p,y.map((x)=>`
|
|
1360
|
+
${x}`).join(""))}else{let y=await hr([p],a,h);if(y){let x=p.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(x!==-1)p=p.slice(0,x)+y+`
|
|
1361
|
+
`+p.slice(x)}}if(t)p=Pl(p);if(t&&e.__stx_inject_css!==!1)p=await S(p,void 0,a.buildMode==="serve",!0);else if(t)p=Tn(p);if(t)p=xt(p);if(p=p.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),p=ds(p),t&&e.__stx_runtime_config)p=Jt(p,e.__stx_runtime_config);if(t&&!e.__stx_defer_server_data){let w=Br(e);if(w){let y=/<head\b[^>]*>/i.exec(p),x=y?y.index+y[0].length:0;p=p.slice(0,x)+w+p.slice(x)}}return t?wt(p):p})}catch(p){if(p instanceof te)throw p;let w=p instanceof Error?p.message:String(p),y=new ce(`Template processing failed: ${w}`,l,void 0,void 0,r.substring(0,200)+(r.length>200?"...":""));if(K.log(y,{filePath:l,context:e}),Dn.logDetailedError(y,{filePath:l,template:r.substring(0,500)}),I()&&!a.debug)console.error(`[stx] ${le.relative(process.cwd(),l)||l}: ${y.message}`);if(a.debug)throw y;return Xi.createFallbackContent("Template Processing",y)}}async function ps(r,e,l,a,h){let t=process.cwd(),p={...a,partialsDir:a.partialsDir&&!le.isAbsolute(a.partialsDir)?le.resolve(t,a.partialsDir):a.partialsDir,componentsDir:a.componentsDir&&!le.isAbsolute(a.componentsDir)?le.resolve(t,a.componentsDir):a.componentsDir,layoutsDir:a.layoutsDir&&!le.isAbsolute(a.layoutsDir)?le.resolve(t,a.layoutsDir):a.layoutsDir},w=p,y=r;await ms(l,e),gs(e,w),y=await Me(()=>er(y,e,l,w),y,(H)=>{K.log(H,{filePath:l,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${l}: ${H.message}`)}),y=y.replace(/\{\{--[\s\S]*?--\}\}/g,"");let x=ke(y,qe,(H,B)=>`\x00STX_HTML_COMMENT_${B}\x00`);y=x.output;let v=x.tokens,k=(H)=>v.length===0?H:H.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(B,U)=>v[Number(U)]??""),_="\x00STX_ESCAPED_AT\x00",E="\x00STX_ESC_MUSTACHE_OPEN\x00",D="\x00STX_ESC_MUSTACHE_CLOSE\x00";y=y.replace(/@@/g,_),y=y.replace(/@\{\{([\s\S]*?)\}\}/g,(H,B)=>`${E}${B}${D}`),y=ir(y),y=await mr(y,l,h);let T={};y=Cs(y,T);let C={...e.__sections||{}},N="",F=Tt(Pt(r)),q=/@nolayout\b/.test(y)||F===!1;if(/@nolayout\b/.test(y))y=y.replace(/@nolayout\b\s*/g,"");let V=y.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(V)N=V[1],y=y.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof F==="string"){if(N=F,!/@section\s*\(/.test(y))y=`@section('content')
|
|
1362
|
+
${y.trim()}
|
|
1363
|
+
@endsection`}if(!N&&!q&&w.defaultLayout){let H=Ln(y),B=/@section\s*\(/.test(y);if(!H||B){let U="",J=le.dirname(l),de=w.layoutsDir?le.dirname(w.layoutsDir):process.cwd();for(let G=0;G<20;G++){let pe=le.join(J,"_layout.stx");if(await s(pe)){U=pe;break}let ue=le.dirname(J);if(ue===J||ue.length<de.length)break;J=ue}if(U)N=U;else if(w.layoutsDir){let G=le.isAbsolute(w.layoutsDir)?w.layoutsDir:le.resolve(process.cwd(),w.layoutsDir),pe=le.join(G,`${w.defaultLayout}.stx`);if(await s(pe))N=pe}if(N&&!B)y=`@section('content')
|
|
1364
|
+
${y.trim()}
|
|
1365
|
+
@endsection`}}if(N&&y.includes("<script")){let H=se(y),B=H.scripts.map((U)=>xr(U,l)??U);y=Nr(H.output,B)}if(y=y.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(H,B,U)=>(C[B]=U,"")),y=y.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(H,B,U)=>{if(/^(['"]).*\1$/.test(U.trim()))return H;try{let J=d(U.trim(),e);if(J===void 0)return H;let G=(e.__stx_inline_section_values??=[]).push(J)-1;return C[B]=`{{ __stx_inline_section_values[${G}] }}`,""}catch{return H}}),y=y.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(H,B,U)=>{if(U.includes("@parent"))C[B]=U.replace("@parent",Ae);else C[B]=U.trim();return""}),e.__sections=C,y=y.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(H,B,U)=>C[B]||U||""),!("slot"in e)||e.slot===void 0)y=y.replace(/\{\{\s*slot\s*\}\}/g,()=>C.content||"");if(y=Es(y,T),N){let H=[],B=se(y),U=ke(B.output,Cn,(J,de)=>`\x00STX_ORPHAN_STYLE_${de}\x00`);if(y=U.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(J,de,G)=>{let pe=de==="SCRIPT"?xr(B.scripts[Number(G)],l):U.tokens[Number(G)];if(pe)H.push(pe);return""}),H.length>0){let J=H.join(`
|
|
1366
1366
|
`);C.content=C.content?`${C.content}
|
|
1367
|
-
${J}`:J,e.__sections=C}}if(N)try{let H;if(le.isAbsolute(N))H=N,h.add(N);else H=await
|
|
1368
|
-
${
|
|
1369
|
-
`;if(t=G(t,e),t=pe(t,e,l),t=
|
|
1367
|
+
${J}`:J,e.__sections=C}}if(N)try{let H;if(le.isAbsolute(N))H=N,h.add(N);else H=await Me(()=>Pn(N,l,p,h),null,()=>{throw new ce(`Failed to resolve layout path: ${N}`,l,void 0,void 0,`Layout referenced from ${l}`)});if(!H){let ue=(Q)=>{if(!Q)return[];try{let xe=le.isAbsolute(Q)?Q:le.resolve(process.cwd(),Q);return ss.readdirSync(xe).filter(($e)=>$e.endsWith(".stx")).map(($e)=>$e.replace(/\.stx$/,""))}catch{return[]}},ne=[...ue(p.layoutsDir),...ue(p.fallbackLayoutsDir)].filter((Q,xe,$e)=>$e.indexOf(Q)===xe).sort(),ve=[p.layoutsDir,p.fallbackLayoutsDir].filter((Q)=>typeof Q==="string"&&Q.length>0),me=ve.length>0?` Searched: ${ve.join(", ")} (set \`layoutsDir\` to look elsewhere).`:"",ie=`Layout not found: ${N} (referenced from ${l})`+(ne.length>0?`. Available layouts: ${ne.join(", ")}`:p.layoutsDir?`. No .stx layouts found in ${p.layoutsDir}`:"")+me;if(K.log(Error(ie),{layoutPath:N,filePath:l,available:ne},"error"),console.error(`[stx] ${ie}`),p.debug)throw new ce(ie,l);return y}let B=await Me(()=>Bun.file(H).text(),"",()=>{throw new ce(`Failed to read layout file: ${H}`,l,void 0,void 0,"Layout content could not be loaded")});B=yr(B,H),B=B.replace(/\{\{--[\s\S]*?--\}\}/g,"");let U=Array.isArray(e.__layoutChain)?e.__layoutChain:[];if(U.includes(H)){let ue=[...U.slice(U.indexOf(H)),H];throw new ce(ue.length===2?`Circular layout: ${H} extends itself`:`Circular layout: ${ue.join(" -> ")}`,l,void 0,void 0,"Remove the @extends or @layout line that points back at a layout already in use")}let J=B.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(J){if(p.debug)console.log(`Found nested layout: ${J[1]} in ${H}`);let ue={},ne=B.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ie,Q,xe)=>(ue[Q]=xe.trim(),""));for(let[ie,Q]of Object.entries(ue))if(C[ie]&&C[ie].includes(Ae)){let xe=C[ie].indexOf(Ae);C[ie]=C[ie].slice(0,xe)+Q+C[ie].slice(xe+Ae.length)}else if(!C[ie])C[ie]=Q;let ve={...e,__sections:C,__layoutChain:[...U,H]},me=`@layout('${J[1]}')${ne}`;return await i(me,ve,H,p,h)}let de=B.replace(/\{\{--[\s\S]*?--\}\}/g,""),G=Cs(de,T),pe={};return G=G.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ue,ne,ve)=>(pe[ne]=ve.trim(),`@slot('${ne}')`)),G=G.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(ue,ne,ve)=>{if(C[ne]){let me=C[ne];if(me.includes(Ae)){let ie=pe[ne]||"",Q=me.indexOf(Ae);me=me.slice(0,Q)+ie+me.slice(Q+Ae.length)}return me}return ve||""}),G=fs(G,C),G=G.replace(/\{\{\s*slot\s*\}\}/g,()=>C.content||""),G=Es(G,T),e.__originalFilePath=l,y=await Tr(G,e,H,p,h),y=`<!-- stx-layout: ${N} -->
|
|
1368
|
+
${y}`,k(y)}catch(H){if(H instanceof te)throw H;throw new ce(`Error processing layout ${N}: ${H instanceof Error?H.message:String(H)}`,l)}return k(await Tr(y,e,l,p,h))}function fs(r,e){return r.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(l,a,h)=>{let t=e[a];if(t!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(t))return t}return h||""})}function gs(r,e){if(r.__stx_sfc_mode=!0,r.__stx_options=e,e.buildMode)r.__stx_buildMode=e.buildMode;let l=e.envPrefix||"STX_PUBLIC_",a={};for(let[h,t]of Object.entries(process.env))if(h.startsWith(l)&&t!==void 0)a[h]=t;r.$env=a}async function ms(r,e){await Me(()=>nr(r,e),void 0,(l)=>{K.log(l,{filePath:r,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${r}: ${l.message}`)})}var ht="data-stx-source";function xr(r,e){if(!r)return r;let l=/^<script\b([^>]*)>/i.exec(r);if(!l||!/\bserver\b/.test(l[1])||l[1].includes(ht))return r;return`<script ${ht}="${encodeURIComponent(e)}"${r.slice(7)}`}function hs(r){let e=new RegExp(`${ht}="([^"]*)"`).exec(r);return e?decodeURIComponent(e[1]):void 0}function _r(r){return r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function $r(r,e,l){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a <script server> ${e==="module-resolution"?"imports a module that does not resolve":e==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${_r(r)}</span><span style="display:block;margin-top:4px">${_r(l)}</span></div>`}async function ys(r,e,l,a){let{scanScriptTags:h}=await o("stx/signal-processing",()=>import("./chunk-gfea8a9y.js")),t=[],p=!I()&&!jn();for(let y of h(r)){let x=y.attrs;if(!/\bserver\b/.test(x))continue;let v=y.start+y.fullMatch.indexOf(">")+1,k=Cr(r,v);if(k===-1)continue;let _=r.slice(v,k);if(!_.trim())continue;let E=hs(x)??l,D={index:y.start,length:k+9-y.start};try{let{extractVariables:T}=await o("stx/variable-extractor",()=>import("./chunk-kexqmwx8.js"));await T(_,e,E,{preserveExisting:!0,onFailure:(C)=>{if(C.kind==="unknown")return;if(a?.onServerScriptError?.({sourcePath:E,kind:C.kind,message:C.message}),!p)return;t.push({...D,markup:$r(E,C.kind,C.message)})}})}catch(T){let C=T instanceof Error?T:Error(String(T));if(K.log(C,{filePath:E,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${E}: ${C.message}`),p)t.push({...D,markup:$r(E,"unknown",C.message)})}}if(t.length===0)return r;let w=r;for(let y of t.sort((x,v)=>v.index-x.index))w=w.slice(0,y.index)+y.markup+w.slice(y.index+y.length);return w}async function bs(r,e,l){try{let{interpolateScriptsInTemplate:a}=await o("stx/expressions",()=>import("./chunk-wedwczed.js"));return a(r,e,{skipServer:!0})}catch(a){let h=a instanceof Error?a:Error(String(a));return K.log(h,{filePath:l,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${l}: ${h.message}`),r}}async function Tr(r,e,l,a,h){let t=r;await R();let p=a;if(t=await ys(t,e,l,a),t=await zt(t,e,l),t=await Kt(t,e,l),t=await bs(t,e,l),await R(),t=await Nt(t,e,l,p),Ne(t))t=pi(t,e),t=Os(t,e),t=Is(t,e);t=fi(t),await R();let{processStreamDirectives:w}=await o("stx/streaming",()=>import("./chunk-hda7t8g6.js"));t=w(t,e),t=await ai(t,e,l,p,!0),await R(),t=await lr(t,e,l,p,h),t=await $s(t,e,l,p,h),await R(),t=jc(t,e,l,p);let{processDeferDirectives:y}=await o("stx/defer",()=>import("./chunk-z4tdnfxd.js"));t=y(t,e,l);let{processTeleportDirectives:x}=await o("stx/teleport",()=>import("./chunk-732gb689.js"));t=x(t,e,l);let{processTransitionDirectives:v,processTransitionAttributes:k}=await o("stx/transitions",()=>import("./chunk-x6565mhk.js"));t=v(t,e,l),t=k(t);let{processErrorBoundaryDirectives:_,stripRenderFailedMarkers:E}=await o("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));t=_(t,e,l),t=E(t);let{processSuspenseDirectives:D}=await o("stx/suspense",()=>import("./chunk-ah8az9vv.js"));t=D(t,e,l);let{processAsyncDirectives:T}=await o("stx/async-components",()=>import("./chunk-9afkttvz.js"));t=T(t,e,l);let{processKeepAliveDirectives:C}=await o("stx/keep-alive",()=>import("./chunk-f60k8j9m.js"));t=C(t,e,l);let{processVirtualListDirectives:N,processVirtualGridDirectives:F,processInfiniteListDirectives:q}=await o("stx/virtual-scrolling",()=>import("./chunk-snkbn5y8.js"));t=N(t,e,l),t=F(t,e,l),t=q(t,e,l),await R();let{processPartialHydrationDirectives:V,processStaticDirectives:H}=await o("stx/partial-hydration",()=>import("./chunk-hk241gt2.js"));t=V(t,e,l),t=H(t);let{processComputedDirectives:B,processWatchDirectives:U}=await o("stx/computed",()=>import("./chunk-1xdzcy9d.js"));t=B(t,e,l),t=U(t,e,l);let{processFormValidationDirectives:J}=await o("stx/forms-validation",()=>import("./chunk-j6fs31va.js"));t=J(t,e,l);let{processHeadDirective:de,processTitleDirective:G,processMetaDirective:pe,resetHead:ue}=await o("stx/head",()=>import("./chunk-e8szp5wa.js"));if(!e.__stx_head_preset&&!e.__stx_runtime_head)ue();let ne=de(t);if(t=ne.content,ne.headContent)e.__stx_head_raw=`${e.__stx_head_raw||""}${ne.headContent}
|
|
1369
|
+
`;if(t=G(t,e),t=pe(t,e,l),t=rr(t),t=ci(t,e),t=jt(t),t=Qt(t),t=await _s(t,e,l,p,h),t=await $s(t,e,l,p,h),await R(),t=t.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),t=ji(t),t=ge(t,e,l),t=Rs(t),await R(),e.__stxProcessingDepth===1)t=yl(t,e);if(t=dl(t,e,{filePath:l,buildMode:p.buildMode}),t=li(t,e),t=ui(t,e),t=et(t,e),t=Wt(t,e),t=Xt(t,e),t=await Ct(t,e,l,p),t=await Fc(t,e,l),t=await Hc(t,e,l,p),await R(),t=Vc(t,e,l,p),t=vi(t,e,l,p),t=xi(t,e,l),t=Si(t,e,l,p),t=Ot(t,e,l,p),t=io(t,e),t=ao(t),t=fl(t),!p.skipEventDirectives)t=tl(t,e,l);if(t=pl(t,e,l,a.skipSignalsRuntime===!0&&Number(e.__stxProcessingDepth)>0),await R(),p.debug){let X=/\bx-data\s*=/.test(t),z=Ps(r);if(X&&z)console.warn(`[stx] ${l}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
1370
1370
|
Both work on the same page, but they manage separate scopes.
|
|
1371
|
-
Prefer signals (state/derived/effect) for new components.`)}t=Oc(t,e),t=await Wi(t,e,l),await R(),t=gl(t),t=ml(t),t=$t(t);let{processXElementDirectives:ve}=await o("stx/x-element",()=>import("./chunk-dvjv4c3a.js"));t=ve(t);let me=e.__originalFilePath||l,ie=
|
|
1371
|
+
Prefer signals (state/derived/effect) for new components.`)}t=Oc(t,e),t=await Wi(t,e,l),await R(),t=gl(t),t=ml(t),t=$t(t);let{processXElementDirectives:ve}=await o("stx/x-element",()=>import("./chunk-dvjv4c3a.js"));t=ve(t);let me=e.__originalFilePath||l,ie=Ke(e);if(t=await gi(t,p,me,ie),await R(),t=qt(t,e),t=await tr(t,e,l,p),await R(),p.media?.image?.autoSiblings){let X=p.publicDir||"public",{rewriteImagesWithSiblings:z}=await o("stx/image-optimization/auto-sibling",()=>import("./chunk-xwgdcc7w.js"));t=await z(t,{publicDir:X})}if(p.seo?.enabled)t=ki(t,e,p);let Q=(X,z,ee=!0)=>{if(!z)return X;let be=z.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),oe=/<head\b[^>]*>[\s\S]*?(?:<\/head\s*>|<body\b|$)/i.exec(X),he=oe?/<title\b[^>]*>[\s\S]*?<\/title>/i.exec(oe[0]):null;if(be&&oe&&he){if(ee){let Ie=oe.index+he.index;X=X.slice(0,Ie)+be[0]+X.slice(Ie+he[0].length)}if(z=z.replace(be[0],"").trim(),!z)return X}if(/<\/head>/i.test(X))return f(X,z);if(/<head\b[^>]*>/i.test(X))return X.replace(/(<head\b[^>]*>)/i,`$1
|
|
1372
1372
|
${z}`);if(/<html\b[^>]*>/i.test(X))return X.replace(/(<html\b[^>]*>)/i,`$1
|
|
1373
1373
|
<head>
|
|
1374
1374
|
${z}
|
|
1375
|
-
</head>`);return X},{renderHead:xe,getHead
|
|
1375
|
+
</head>`);return X},{renderHead:xe,getHead:$e}=await o("stx/head",()=>import("./chunk-e8szp5wa.js")),Be=e.__stx_runtime_head??$e();if(Be.title||Be.meta?.length||Be.link?.length){let X=xe(Be);if(X)t=Q(t,X)}if(ne.headContent)t=Q(t,ne.headContent,!Be.title);if(p.csp?.enabled&&p.csp.addMetaTag)t=Dt(t,p.csp,e);if(p.analytics?.enabled)t=Et(t,p);if(p.heatmap?.enabled)t=Bc(t,p);if(p.pwa?.enabled&&p.pwa.autoInject!==!1){let{injectPwaTags:X}=await o("stx/pwa/inject",()=>import("./chunk-essd43ad.js"));t=X(t,p)}let Mr=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(t),Dr=/\bSTX\.\w+/.test(t),Ir=/window\.STX\s*=/.test(t);if(Mr&&Dr&&!Ir){let z=`<script data-stx-scoped data-stx-run="once">
|
|
1376
1376
|
${St()}
|
|
1377
|
-
</script>`;if(t.includes("</head>")){let
|
|
1378
|
-
`+
|
|
1377
|
+
</script>`;if(t.includes("</head>")){let ee=L(t),oe=t.slice(0,ee).indexOf("<script");if(oe!==-1){let he=t.slice(0,oe),Ie=t.slice(oe);t=he+z+`
|
|
1378
|
+
`+Ie}else t=f(t,z)}else if(t.includes("<body"))t=t.replace(/<body([^>]*)>/,`<body$1>
|
|
1379
1379
|
${z}`);else t=z+`
|
|
1380
|
-
`+t}{let{scanScriptTags:X}=await o("stx/signal-processing",()=>import("./chunk-
|
|
1381
|
-
`+t.slice(
|
|
1382
|
-
export{
|
|
1380
|
+
`+t}{let{scanScriptTags:X}=await o("stx/signal-processing",()=>import("./chunk-gfea8a9y.js")),z=[];for(let ee of X(t)){if(!/\bserver\b/i.test(ee.attrs))continue;let be=ee.start+ee.fullMatch.indexOf(">")+1,oe=Cr(t,be);if(oe===-1)continue;let he=oe+9;while(he<t.length&&/\s/.test(t[he]))he++;z.push({start:ee.start,end:he})}if(z.length>0){let ee=Array(z.length+1),be=0;for(let oe=0;oe<z.length;oe++){let{start:he,end:Ie}=z[oe];ee[oe]=t.slice(be,he),be=Ie}ee[z.length]=t.slice(be),t=ee.join("")}}let yt=so(t,l);if(yt.hasScoped)t=yt.html;let Or=e.__stx_event_bindings||[],rt=!1,bt=[],Lr=/\s:[a-z][\w.-]*\s*=/.test(t),{scanScriptTags:Pr}=await o("stx/signal-processing",()=>import("./chunk-gfea8a9y.js"));for(let X of Pr(t,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))bt.push({match:X.fullMatch,attrs:X.attrs,content:X.body});for(let{match:X,attrs:z,content:ee}of bt){rt=!0;let be=ee;We(ee,l,a.strict,e.__originalFilePath);let oe=await Ge(ee,{eventBindings:Or,attrs:z,hasColonDirectives:Lr,templateContent:r,filePath:l,projectRoot:process.cwd(),production:ea(a.buildMode,a.minifyClient),serverData:ie});t=t.replace(X,()=>oe)}if(rt)e.__stx_event_bindings=[];if(!rt&&e.__stxProcessingDepth===1){let X=e.__stx_event_bindings||[];if(X.length>0){let z=Ai(X);if(z){let ee=c(t);t=ee===-1?t+z:t.slice(0,ee)+z+`
|
|
1381
|
+
`+t.slice(ee)}e.__stx_event_bindings=[]}}if(!p.skipSignalsRuntime&&!Re(t)&&Mc(t))t=await kr(t,p);if(t=Dc(t),p.csp?.enabled&&p.csp.useNonce&&typeof e.cspNonce==="string")t=It(t,e.cspNonce);return t}
|
|
1382
|
+
export{Pt,He,Rc,ks,ti,ni,hr,i};
|