@stacksjs/stx 0.2.336 → 0.2.338
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app-shell.js +9 -8
- package/dist/{chunk-9v0fsdsf.js → chunk-066yt1hy.js} +1 -1
- package/dist/{chunk-eth22r93.js → chunk-0xgc5t3y.js} +1 -1
- package/dist/{chunk-vd5xvsnv.js → chunk-18018jkn.js} +1 -1
- package/dist/{chunk-5tefa8qb.js → chunk-1vb2rj09.js} +2 -2
- package/dist/chunk-1wsewc5h.js +2 -0
- package/dist/{chunk-p1hy2bwn.js → chunk-1yj4xd6n.js} +3 -3
- package/dist/{chunk-fqq5k9ve.js → chunk-1z1efvtw.js} +1 -1
- package/dist/{chunk-cdqx2c2h.js → chunk-22hch2me.js} +1 -1
- package/dist/{chunk-kpeqn5tx.js → chunk-2gc4cevb.js} +1 -1
- package/dist/{chunk-mgmn1vxy.js → chunk-39xtzfzf.js} +1 -1
- package/dist/{chunk-zsnrcbw1.js → chunk-3cjvqa0s.js} +2 -2
- package/dist/chunk-3sgdth20.js +2 -0
- package/dist/chunk-41dfsdy9.js +2 -0
- package/dist/{chunk-ymrxpwr8.js → chunk-46tmg3k4.js} +2 -2
- package/dist/{chunk-e1sxe3q4.js → chunk-4904n5v0.js} +2 -2
- package/dist/chunk-4cw0s9f4.js +4 -0
- package/dist/chunk-4jj4kk18.js +2 -0
- package/dist/chunk-4np12rj1.js +2 -0
- package/dist/chunk-4pcjt99d.js +2 -0
- package/dist/{chunk-dvvx1wny.js → chunk-57atgbyq.js} +1 -1
- package/dist/chunk-58j32d7n.js +2 -0
- package/dist/{chunk-hyfjnn7g.js → chunk-5g6rprcy.js} +1 -1
- package/dist/{chunk-mm59b0gg.js → chunk-5qsg9q46.js} +1 -1
- package/dist/{chunk-m8kezfrt.js → chunk-5r7gfwpj.js} +5 -5
- package/dist/chunk-799s9mwc.js +47 -0
- package/dist/{chunk-yxppshfd.js → chunk-7a21q2q4.js} +1 -1
- package/dist/chunk-7d74am4w.js +2 -0
- package/dist/chunk-7ngnyy5k.js +2 -0
- package/dist/{chunk-r8rbf28v.js → chunk-7r79j1hs.js} +1 -1
- package/dist/{chunk-cr8v8k53.js → chunk-7r9vgzg4.js} +1 -1
- package/dist/{chunk-xwxdwqn9.js → chunk-7we3xfde.js} +1 -1
- package/dist/{chunk-fr66xp8q.js → chunk-823h67tv.js} +1 -1
- package/dist/{chunk-42en0cxm.js → chunk-86v2rps7.js} +1 -1
- package/dist/{chunk-xz3evxqp.js → chunk-8bxtvsgm.js} +1 -1
- package/dist/{chunk-09jdvqhg.js → chunk-8cg15rr7.js} +2 -2
- package/dist/chunk-95t7pked.js +2 -0
- package/dist/{chunk-xdmb578h.js → chunk-97ej3abh.js} +1 -1
- package/dist/{chunk-kw98dfza.js → chunk-9btdax2s.js} +1 -1
- package/dist/{chunk-pbexz0d4.js → chunk-9bvgzqw1.js} +2 -2
- package/dist/{chunk-te6qym2g.js → chunk-9jc2z17q.js} +2 -2
- package/dist/chunk-9m5sxaen.js +2 -0
- package/dist/{chunk-tjag2cmm.js → chunk-a26hcag1.js} +1 -1
- package/dist/chunk-a3m7mgjc.js +2 -0
- package/dist/{chunk-9368t9jm.js → chunk-a959m68j.js} +1 -1
- package/dist/{chunk-fkdnfjc2.js → chunk-aftqqqcg.js} +2 -2
- package/dist/chunk-aved735s.js +64 -0
- package/dist/{chunk-q0g5c39d.js → chunk-ay336sqb.js} +1 -1
- package/dist/{chunk-cvphepjb.js → chunk-b3pn6dh5.js} +1 -1
- package/dist/{chunk-5swem3qy.js → chunk-b4cabzk9.js} +1 -1
- package/dist/{chunk-ej8mv2k6.js → chunk-bgrkxzr7.js} +1 -1
- package/dist/{chunk-2cm03y4y.js → chunk-d3kjaae0.js} +1 -1
- package/dist/chunk-d7zxg9bp.js +16 -0
- package/dist/{chunk-1ebyt1ba.js → chunk-dekxwgc2.js} +1 -1
- package/dist/chunk-dvafkj8w.js +2 -0
- package/dist/chunk-e3rgky2r.js +3747 -0
- package/dist/{chunk-t41aaehf.js → chunk-e4g8wz6t.js} +1 -1
- package/dist/chunk-e9y48d60.js +2 -0
- package/dist/{chunk-pbzdjhp8.js → chunk-eq2j7w8p.js} +1 -1
- package/dist/chunk-f08ttkqr.js +2 -0
- package/dist/{chunk-4jdj52c5.js → chunk-f6sejeg3.js} +1 -1
- package/dist/chunk-fha0nyet.js +2 -0
- package/dist/{chunk-6k8h1fj1.js → chunk-fjrkyhm7.js} +1 -1
- package/dist/chunk-fw56y3cb.js +30 -0
- package/dist/chunk-fx5m9d3t.js +2 -0
- package/dist/{chunk-mwh3ymwc.js → chunk-g6czgcg4.js} +1 -1
- package/dist/chunk-gtfcw1gc.js +12 -0
- package/dist/chunk-gz539gk6.js +2 -0
- package/dist/chunk-h0y4mb2m.js +2 -0
- package/dist/chunk-hfzv07az.js +3 -0
- package/dist/{chunk-nat3actx.js → chunk-hrdd26r4.js} +1 -1
- package/dist/{chunk-cdsbxghb.js → chunk-jkyvk4x6.js} +1 -1
- package/dist/{chunk-4ty8j3xn.js → chunk-jx03a693.js} +1 -1
- package/dist/{chunk-vvd659y4.js → chunk-k3dtvay1.js} +1 -1
- package/dist/chunk-kawdj1j7.js +2 -0
- package/dist/{chunk-d4etph79.js → chunk-kdhrk7x5.js} +1 -1
- package/dist/chunk-kdwerx8e.js +2 -0
- package/dist/{chunk-n66k2v2q.js → chunk-kermxyfe.js} +2 -2
- package/dist/{chunk-x7yc7e9v.js → chunk-m11pb9cx.js} +1 -1
- package/dist/{chunk-k6ky5et7.js → chunk-m1p2n3nf.js} +1 -1
- package/dist/chunk-m46edxtt.js +3 -0
- package/dist/chunk-meqz313r.js +2 -0
- package/dist/{chunk-q05eh1n4.js → chunk-mnyehz4t.js} +2 -2
- package/dist/{chunk-0vv5s039.js → chunk-mys0rat0.js} +1 -1
- package/dist/chunk-n0a55zv2.js +2 -0
- package/dist/{chunk-7kw3grq5.js → chunk-nf7k53ap.js} +1 -1
- package/dist/{chunk-kffndzch.js → chunk-nhbc464j.js} +3 -3
- package/dist/{chunk-1hzgxk2m.js → chunk-nvp546bb.js} +1 -1
- package/dist/chunk-p1cddybx.js +2 -0
- package/dist/chunk-q0srntf6.js +2 -0
- package/dist/chunk-q3g4yf5r.js +2 -0
- package/dist/{chunk-c2ta859c.js → chunk-q9ckfwhh.js} +1 -1
- package/dist/chunk-qhdp0ycf.js +2 -0
- package/dist/{chunk-y4nzmkea.js → chunk-qsbjtp60.js} +1 -1
- package/dist/{chunk-1tva0f8f.js → chunk-qtc28zy1.js} +1 -1
- package/dist/{chunk-2vgkc0kg.js → chunk-r10fypcd.js} +1 -1
- package/dist/chunk-rkykwy3z.js +2 -0
- package/dist/{chunk-64djh88a.js → chunk-sqvqwd0p.js} +1 -1
- package/dist/{chunk-67bh5vrj.js → chunk-stbns4bg.js} +1 -1
- package/dist/chunk-szfk6pw6.js +2 -0
- package/dist/{chunk-amxtypkp.js → chunk-t00ga194.js} +1 -1
- package/dist/chunk-temapbqe.js +2 -0
- package/dist/{chunk-9kxfz708.js → chunk-tr1174hz.js} +1 -1
- package/dist/{chunk-q85qp5we.js → chunk-tr41gn5j.js} +1 -1
- package/dist/{chunk-crj19mqr.js → chunk-tr9ynxdw.js} +1 -1
- package/dist/{chunk-71y3bhcw.js → chunk-tsmdmf5h.js} +123 -37
- package/dist/{chunk-gptwwv3c.js → chunk-vaggjvsm.js} +1 -1
- package/dist/{chunk-ya5m5vbn.js → chunk-vgfd9582.js} +1 -1
- package/dist/chunk-vgfnre7b.js +2 -0
- package/dist/{chunk-n9c975db.js → chunk-vhzc08aa.js} +1 -1
- package/dist/{chunk-08w4gtyf.js → chunk-vm5jbgb1.js} +3 -3
- package/dist/{chunk-drqdc0mh.js → chunk-vxt5c5aq.js} +1 -1
- package/dist/{chunk-hzfd8cz0.js → chunk-w0hzaka3.js} +78 -67
- package/dist/{chunk-yk6446kr.js → chunk-w72v0ab1.js} +2 -2
- package/dist/{chunk-c65yrgck.js → chunk-wakb8z5q.js} +10 -10
- package/dist/{chunk-q569zmrr.js → chunk-wb90259a.js} +1 -1
- package/dist/chunk-x01sw9wy.js +2 -0
- package/dist/{chunk-dfejgnny.js → chunk-x48crnwa.js} +1 -1
- package/dist/{chunk-24b4711v.js → chunk-x4vhn880.js} +1 -1
- package/dist/{chunk-j2dj21ay.js → chunk-xe6zmdfq.js} +1 -1
- package/dist/chunk-y8vj3rtt.js +2 -0
- package/dist/chunk-yj1dxdfr.js +2 -0
- package/dist/{chunk-wx5zf66r.js → chunk-yne23w3c.js} +1 -1
- package/dist/{chunk-zz8qgqa1.js → chunk-ypzm47q3.js} +2 -2
- package/dist/chunk-z07knk3p.js +2 -0
- package/dist/{chunk-27xfkzks.js → chunk-zj039s33.js} +1 -1
- package/dist/{chunk-c79nfdyj.js → chunk-zk6ghjnj.js} +1 -1
- package/dist/chunk-zt4pf776.js +2 -0
- package/dist/{chunk-4k0ce745.js → chunk-zye9r15n.js} +2 -2
- package/dist/chunk-zzfpwxpp.js +2 -0
- package/dist/cli.js +14 -14
- package/dist/component-contract-checks.d.ts +18 -15
- package/dist/component-contract.d.ts +6 -14
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/database.js +1 -1
- package/dist/expressions.d.ts +45 -0
- package/dist/expressions.js +60 -11
- package/dist/includes.js +4 -0
- package/dist/loops.js +10 -0
- package/dist/pwa.js +2 -2
- package/dist/server-components.js +2 -1
- package/dist/signals.js +121 -35
- package/dist/slots.js +86 -12
- package/dist/ssg.js +2 -2
- package/dist/stx-virtual-ts.d.ts +205 -95
- package/dist/template-syntax-escape.d.ts +36 -0
- package/dist/template-syntax-escape.js +8 -0
- package/dist/utils.js +9 -2
- package/dist/variable-extractor.d.ts +1 -0
- package/dist/variable-extractor.js +8 -0
- package/dist/visual-testing.js +1 -1
- package/package.json +8 -8
- package/dist/chunk-046dp691.js +0 -2
- package/dist/chunk-1brnvyhv.js +0 -2
- package/dist/chunk-3ntf8f5e.js +0 -2
- package/dist/chunk-4tnxnzja.js +0 -2
- package/dist/chunk-63yfp05p.js +0 -2
- package/dist/chunk-7y4eqkv4.js +0 -2
- package/dist/chunk-7ywnkv1f.js +0 -2
- package/dist/chunk-80zj5516.js +0 -2
- package/dist/chunk-8730k51r.js +0 -2
- package/dist/chunk-907qxn09.js +0 -2
- package/dist/chunk-9fcq5x2r.js +0 -2
- package/dist/chunk-a97tp43x.js +0 -2
- package/dist/chunk-atw841yx.js +0 -2
- package/dist/chunk-c1m1gng4.js +0 -2
- package/dist/chunk-caaenc3w.js +0 -60
- package/dist/chunk-dbfq77qe.js +0 -4
- package/dist/chunk-dnesmvvb.js +0 -2
- package/dist/chunk-eg8ksaft.js +0 -2
- package/dist/chunk-ewsx2qxm.js +0 -2
- package/dist/chunk-farwrdr2.js +0 -3
- package/dist/chunk-fcenm8n1.js +0 -2
- package/dist/chunk-gbz6pfs8.js +0 -2
- package/dist/chunk-gdbkqatx.js +0 -43
- package/dist/chunk-jnahcd4d.js +0 -2
- package/dist/chunk-ke88kpva.js +0 -30
- package/dist/chunk-krpkfndf.js +0 -3
- package/dist/chunk-kxtqbrfr.js +0 -3759
- package/dist/chunk-m1yrakpk.js +0 -2
- package/dist/chunk-q2hvne0v.js +0 -2
- package/dist/chunk-qpbk50xd.js +0 -2
- package/dist/chunk-rxdd3k6n.js +0 -2
- package/dist/chunk-ssd10kje.js +0 -2
- package/dist/chunk-szx6pxh3.js +0 -2
- package/dist/chunk-tpmgq2dx.js +0 -12
- package/dist/chunk-tte4m2s9.js +0 -2
- package/dist/chunk-v7gjsb3f.js +0 -2
- package/dist/chunk-vv289x82.js +0 -2
- package/dist/chunk-vx6mxybh.js +0 -2
- package/dist/chunk-x510wr8z.js +0 -2
- package/dist/chunk-x95sxapm.js +0 -2
- package/dist/chunk-xjrhzkx2.js +0 -2
- package/dist/chunk-y1x2ebhv.js +0 -2
- package/dist/chunk-yvec3f1c.js +0 -2
- package/dist/chunk-yzxm75jp.js +0 -2
|
@@ -0,0 +1,3747 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Sr as E8,Wr as b8,es as T7,fs as k7}from"./chunk-d7zxg9bp.js";import{ks as W0,ls as mZ}from"./chunk-hrdd26r4.js";import{ns as C7,os as S7,ps as Z9,qs as J9}from"./chunk-7r79j1hs.js";import{ws as a2}from"./chunk-ay336sqb.js";import{Bs as o1,Cs as x1,Ds as S8,Es as E1,Gs as W1,Hs as CZ,Is as SZ,Js as G2,Ks as i2,Ls as R9,Ms as E2,Ns as V8,Os as J8,Ps as j1,Qs as c0,Rs as e9,Vs as P8,Ws as x9,ht as v8}from"./chunk-nhbc464j.js";import{it as E7,kt as b7,lt as y7,nt as B2}from"./chunk-vaggjvsm.js";import{pt as W4,qt as U4,rt as H4,ut as B4,vt as V4}from"./chunk-q9ckfwhh.js";import{At as g9}from"./chunk-kermxyfe.js";import{Ct as VZ,Dt as OZ,Et as _Z,Ft as LZ,Gt as FZ,It as C8}from"./chunk-k3dtvay1.js";import{Jt as g8,Kt as h8,Lt as u8,Mt as m8,Nt as P7,Ot as v7}from"./chunk-aved735s.js";import{$t as w0,Eu as I3,Fu as Z6,Gu as Q0,Hu as H0,Iu as d0,Ju as w9,Ku as X2,Lu as q0,Mu as M9,bu as N9,cu as A3,du as D9,ku as b2,nu as I8,pu as R0,tu as y2,uu as T8,wu as n0,xu as k8}from"./chunk-799s9mwc.js";import{Nu as f8,Ru as wZ,Tu as RZ}from"./chunk-7r80apc5.js";import{bv as t0}from"./chunk-2tjk867y.js";import{ev as x8}from"./chunk-t8ctvjqe.js";import{fv as T3,gv as S2,hv as yZ,iv as n1,mv as uZ,nv as W3,ov as Z8,qv as P4,tv as d4}from"./chunk-deqnt1w5.js";import{Ev as S$,Hv as h6,Ov as w$,dw as y8,fw as Gz,gw as U5,jw as W2}from"./chunk-w0hzaka3.js";import{ow as f7}from"./chunk-wb90259a.js";import{tw as f}from"./chunk-5g6rprcy.js";import C1 from"path";import v2 from"fs";var z3=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),K3={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},oZ=new Set(["ctrl","alt","shift","meta"]),U3={left:0,middle:1,right:2};function q3($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let J of $){let X=J.toLowerCase();if(X==="prevent")Z.prevent=!0;else if(X==="stop")Z.stop=!0;else if(X==="once")Z.once=!0;else if(X==="capture")Z.capture=!0;else if(X==="self")Z.self=!0;else if(X==="passive")Z.passive=!0;else if(oZ.has(X))Z.systemKeys.push(X);else if(X in U3)Z.mouse=X;else if(X in K3||/^[a-z]$/.test(X))Z.keys.push(K3[X]||X.toUpperCase());else if(X.startsWith("debounce")){let Y=X.match(/debounce(?:\.(\d+))?/);Z.debounce=Y?.[1]?Number.parseInt(Y[1],10):300}else if(X.startsWith("throttle")){let Y=X.match(/throttle(?:\.(\d+))?/);Z.throttle=Y?.[1]?Number.parseInt(Y[1],10):300}}return Z}function H3($){let Z=[],J=0,X=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Y;while((Y=X.exec($))!==null){let[Q,G,z]=Y,K=Y.index,q=K+Q.length,W=`__stx_evt_${J++}`,U=[],H=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,j;while((j=H.exec(z))!==null){let[,V,L]=j,_=V.split("."),F=_[0];if(!z3.has(F))continue;U.push({attribute:`@${V}`,event:F,handler:L,modifiers:q3(_.slice(1)),elementId:W})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((j=B.exec(z))!==null){let[,V,L]=j,_=V.split("."),F=_[0];if(!z3.has(F))continue;U.push({attribute:`@${V}`,event:F,handler:L,modifiers:q3(_.slice(1)),elementId:W})}if(U.length>0)Z.push({originalTag:Q,elementId:W,events:U,startIndex:K,endIndex:q})}return Z}function sZ($){let Z=[],{modifiers:J}=$;if(J.self)Z.push("if ($event.target !== $el) return");for(let X of J.systemKeys)Z.push(`if (!$event.${X}Key) return`);if(J.keys.length>0){let X=J.keys.map((Y)=>`$event.key === '${Y}'`).join(" || ");Z.push(`if (!(${X})) return`)}if(J.mouse!==null){let X=U3[J.mouse];Z.push(`if ($event.button !== ${X}) return`)}if(J.prevent)Z.push("$event.preventDefault()");if(J.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function rZ($,Z){let J=$;if(Z.debounce!==null)J=`__stx_debounce(() => { ${J} }, ${Z.debounce})`;else if(Z.throttle!==null)J=`__stx_throttle(() => { ${J} }, ${Z.throttle})`;return J}function s9($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function aZ($){let{modifiers:Z}=$,J=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),X=sZ($),Y=rZ(s9($.handler),Z),Q=[];if(Z.once)Q.push("once: true");if(Z.capture)Q.push("capture: true");if(Z.passive)Q.push("passive: true");let G=Q.length>0?`, { ${Q.join(", ")} }`:"",z=Y.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
|
|
3
|
+
(function() {
|
|
4
|
+
var $el = document.getElementById('${J}');
|
|
5
|
+
if (!$el) return;
|
|
6
|
+
// Run mounted handler immediately (DOM is ready)
|
|
7
|
+
var scope = $el.closest('[data-stx-scope]');
|
|
8
|
+
if (scope && scope.__stx_execute) {
|
|
9
|
+
scope.__stx_execute('${z}', null, $el);
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
__stx_runHandler('${z}', null, $el);
|
|
13
|
+
}
|
|
14
|
+
})();`;if($.event==="unmounted")return`
|
|
15
|
+
(function() {
|
|
16
|
+
var $el = document.getElementById('${J}');
|
|
17
|
+
if (!$el) return;
|
|
18
|
+
// Set up MutationObserver to detect removal
|
|
19
|
+
var observer = new MutationObserver(function(mutations) {
|
|
20
|
+
for (var m of mutations) {
|
|
21
|
+
for (var node of m.removedNodes) {
|
|
22
|
+
if (node === $el || (node.contains && node.contains($el))) {
|
|
23
|
+
observer.disconnect();
|
|
24
|
+
var scope = $el.closest('[data-stx-scope]');
|
|
25
|
+
if (scope && scope.__stx_execute) {
|
|
26
|
+
scope.__stx_execute('${z}', null, $el);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
__stx_runHandler('${z}', null, $el);
|
|
30
|
+
}
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
37
|
+
// Store observer for cleanup
|
|
38
|
+
$el.__stx_unmount_observer = observer;
|
|
39
|
+
})();`;return`
|
|
40
|
+
(function() {
|
|
41
|
+
var $el = document.getElementById('${J}');
|
|
42
|
+
if (!$el) return;
|
|
43
|
+
// eslint-disable-next-line pickier/no-unused-vars
|
|
44
|
+
$el.addEventListener('${$.event}', function($event) {
|
|
45
|
+
${X?X+";":""}
|
|
46
|
+
// Find the closest reactive scope and execute within its context
|
|
47
|
+
var scope = $el.closest('[data-stx-scope]');
|
|
48
|
+
if (scope && scope.__stx_execute) {
|
|
49
|
+
scope.__stx_execute('${z}', $event, $el);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
// Fallback for non-reactive context (entity-safe; decoded + run in memory)
|
|
53
|
+
__stx_runHandler('${z}', $event, $el);
|
|
54
|
+
}
|
|
55
|
+
}${G});
|
|
56
|
+
})();`}function r9($){if($.length===0)return"";return`
|
|
57
|
+
<script data-stx-events>
|
|
58
|
+
(function() {
|
|
59
|
+
'use strict';
|
|
60
|
+
|
|
61
|
+
// Utility functions
|
|
62
|
+
function __stx_debounce(fn, delay) {
|
|
63
|
+
var timeout;
|
|
64
|
+
return function() {
|
|
65
|
+
var args = arguments;
|
|
66
|
+
var ctx = this;
|
|
67
|
+
clearTimeout(timeout);
|
|
68
|
+
timeout = setTimeout(function() { fn.apply(ctx, args); }, delay);
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function __stx_throttle(fn, delay) {
|
|
73
|
+
var last = 0;
|
|
74
|
+
return function() {
|
|
75
|
+
var now = Date.now();
|
|
76
|
+
if (now - last >= delay) {
|
|
77
|
+
last = now;
|
|
78
|
+
fn.apply(this, arguments);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Non-reactive fallback runner. The handler is embedded HTML-entity-encoded
|
|
84
|
+
// so the surrounding script element can never contain raw markup, including
|
|
85
|
+
// its own closing tag; we decode it to JS only in memory here, then run it
|
|
86
|
+
// with $event/$el in scope.
|
|
87
|
+
//
|
|
88
|
+
// This comment must not spell that closing tag out. It used to, as an
|
|
89
|
+
// example, and a browser ends the script element at the FIRST one it sees \u2014
|
|
90
|
+
// so everything below this line, __stx_runHandler included, was emitted as
|
|
91
|
+
// page text and no listener was ever bound. The comment about escaping was
|
|
92
|
+
// the thing that needed escaping.
|
|
93
|
+
function __stx_runHandler(h, $event, $el) {
|
|
94
|
+
var code = h
|
|
95
|
+
.replace(/</g, '<')
|
|
96
|
+
.replace(/>/g, '>')
|
|
97
|
+
.replace(/"/g, '"')
|
|
98
|
+
.replace(/'/g, "'")
|
|
99
|
+
.replace(/'/g, "'")
|
|
100
|
+
.replace(/&/g, '&');
|
|
101
|
+
try {
|
|
102
|
+
// eslint-disable-next-line no-new-func
|
|
103
|
+
(new Function('$event', '$el', code)).call($el, $event, $el);
|
|
104
|
+
}
|
|
105
|
+
catch (e) {
|
|
106
|
+
if (typeof console !== 'undefined') console.error('[stx] event handler error:', e);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Event listeners
|
|
111
|
+
${$.map(aZ).join(`
|
|
112
|
+
`)}
|
|
113
|
+
})();
|
|
114
|
+
</script>`}function tZ($){let Z=H3($);if(Z.length===0)return{template:$,bindings:[]};let J=$,X=[];for(let Y=Z.length-1;Y>=0;Y--){let Q=Z[Y],G=Q.originalTag;if(!G.includes(" id="))G=G.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${Q.elementId}"`);else{let z=G.match(/id=["']([^"']+)["']/);if(z)for(let K of Q.events)K.elementId=z[1]}for(let z of Q.events){let K=z.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),q=new RegExp(`\\s*${K}\\s*=\\s*"[^"]*"`,"g"),W=new RegExp(`\\s*${K}\\s*=\\s*'[^']*'`,"g");G=G.replace(q,""),G=G.replace(W,"")}J=J.slice(0,Q.startIndex)+G+J.slice(Q.endIndex),X.push(...Q.events)}return{template:J,bindings:X}}function j3($,Z,J){if(W3($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:z,bindings:K}=tZ($),q=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...q,...K],z}let X=H3($);if(X.length===0)return $;let Y=$;for(let z=X.length-1;z>=0;z--){let K=X[z],q=K.originalTag;if(!q.includes(" id="))q=q.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${K.elementId}"`);else{let W=q.match(/id=["']([^"']+)["']/);if(W)for(let U of K.events)U.elementId=W[1]}for(let W of K.events){let U=W.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),H=new RegExp(`\\s*${U}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${U}\\s*=\\s*'[^']*'`,"g");q=q.replace(H,""),q=q.replace(j,"")}Y=Y.slice(0,K.startIndex)+q+Y.slice(K.endIndex)}let Q=r9(X.flatMap((z)=>z.events)),G=Y.lastIndexOf("</body>");if(G!==-1)Y=Y.slice(0,G)+Q+`
|
|
115
|
+
`+Y.slice(G);else Y+=Q;return Y}function eK($){return/@[a-z]+(?:\.[a-z]+)*\s*=\s*["'][^"']*["']/i.test($)}import PZ from"fs";import x from"path";import{createHash as eZ}from"crypto";var m2="__stx_component_client_factories";function d2($){let Z=$[m2];return Z instanceof Map?Z:null}function V3($){$[m2]=new Map}function a9($,Z){let J=d2($);if(!J)return null;let X=eZ("sha256").update(Z).digest("hex").slice(0,16),Y=J.get(X);if(Y)Y.instances++;else J.set(X,{body:Z,instances:1});return X}function O3($,Z){let J=d2(Z);if(!J?.size)return $;let X=new Map;for(let[W,U]of J)if(U.instances===1)X.set(W,U.body);let Y=[];if(X.size>0){let W=[...X.keys()].map((j)=>JSON.stringify(j).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),U=new RegExp(`window\\.__stxComponentFactories\\[(${W})\\]\\(("[^"]+")\\);`,"g"),H=U.exec($);while(H!==null){let j=X.get(JSON.parse(H[1]));if(j!==void 0)Y.push({start:H.index,end:H.index+H[0].length,replacement:`(${j})(${H[2]});`});H=U.exec($)}}let Q=[...J].filter(([,W])=>W.instances>1);if(Q.length===0)return B3($,Y);let z=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
|
|
116
|
+
(function() {
|
|
117
|
+
const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
|
|
118
|
+
${Q.map(([W,U])=>` try { factories[${JSON.stringify(W)}] = factories[${JSON.stringify(W)}] || ${U.body}; }
|
|
119
|
+
catch (e) { console.error('[stx] component factory ' + ${JSON.stringify(W)} + ' failed to register; instances of it will not hydrate.', e); }`).join(`
|
|
120
|
+
`)}
|
|
121
|
+
})();
|
|
122
|
+
</script>`,K=$.search(/<script\b(?=[^>]*\bdata-stx-scoped\b)/i),q=K<0?0:K;return Y.push({start:q,end:q,replacement:`${z}
|
|
123
|
+
`}),B3($,Y)}function B3($,Z){if(Z.length===0)return $;Z.sort((Q,G)=>Q.start-G.start||Q.end-G.end);let J=Array(Z.length*2+1),X=0,Y=0;for(let Q of Z)J[Y++]=$.slice(X,Q.start),J[Y++]=Q.replacement,X=Q.end;return J[Y]=$.slice(X),J.join("")}function _3($){let Z=d2($),J=new Map;if(Z)for(let[X,Y]of Z)J.set(X,Y.instances);return J}function L3($,Z){let J=d2($);if(!J)return[];let X=[];for(let[Y,Q]of J){let G=Q.instances-(Z.get(Y)??0);if(G>0)X.push({body:Q.body,count:G})}return X}function F3($,Z){for(let{body:J,count:X}of Z)for(let Y=0;Y<X;Y++)a9($,J)}import N3 from"fs";var w3=0,l2=new Map;function Xq(){w3=0,l2.clear()}function c2($,Z){let J=w3++,X=`<!--__STX_${$.toUpperCase()}_${J}__-->`;return l2.set(X,{type:$,expression:Z}),X}function Yq(){let $={};for(let[Z,J]of l2)$[Z]={type:J.type,expression:J.expression};return $}function Qq($){let Z={},J=/<!--__STX_(EXPR|COND|RAW)_(\d+)__-->/g,X;while((X=J.exec($))!==null){let Y=X[0],Q=X[1].toLowerCase(),G=l2.get(Y);Z[Y]={type:Q,expression:G?.expression||""}}return Z}function Gq($,Z){let J=$;for(let[X,Y]of Z)J=J.split(X).join(Y);return J}function zq($){return $.includes("<!--__STX_")}var $J=/@(?=[a-zA-Z_]\w*\s*\(|end[a-zA-Z]*\b|else(?:if)?\b|empty\b|case\b|default\b|break\b|continue\b|fallback\b)/g;function ZJ($){return Array.from({length:$},()=>"{").join("⁠")}function R3($){return $.replace(/\{{2,}/g,(Z)=>ZJ(Z.length)).replace(/\{(?=!)/g,"{⁠").replace($J,"@")}var z2={},D3=new Map;function JJ($){let Z=D3.get($);if(!Z){let J=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${J}(?!\\w)`,"g"),D3.set($,Z)}return Z.lastIndex=0,Z}var n2={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let J=String($);return J.charAt(0).toUpperCase()+J.slice(1)},number:($,Z,J=0)=>{if($===void 0||$===null)return"";try{let X=Number($);return Number.isNaN(X)?"":X.toFixed(Number.parseInt(String(J),10))}catch{return""}},fmt:($,Z,J="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return X.toLocaleString(J)}catch{return String($)}},join:($,Z,J=",")=>{if(!Array.isArray($))return"";return $.join(String(J))},escape:($,Z)=>{if($===void 0||$===null)return"";return Z5(String($))},translate:($,Z,J={})=>{if(!Z||!Z.__translations)return $;let X=Z.__translations,Y=Z.__i18nConfig?.fallbackToKey??!0,Q=String($).split("."),G=X;for(let K of Q){if(G===void 0||G===null)break;G=G[K]}if(G===void 0||G===null)return Y?$:"";let z=String(G);return Object.entries(J).forEach(([K,q])=>{z=z.replace(JJ(K),String(q))}),z},t:($,Z,J={})=>{return n2.translate($,Z,J)},truncate:($,Z,J=50,X="...")=>{if($===void 0||$===null)return"";let Y=String($);if(Y.length<=J)return Y;if(J<=X.length)return X.substring(0,J);return Y.substring(0,J-X.length)+X},date:($,Z,J="short",X="en-US")=>{if($===void 0||$===null)return"";try{let Y=$ instanceof Date?$:new Date($);if(Number.isNaN(Y.getTime()))return String($);let Q={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(J==="iso")return Y.toISOString();return new Intl.DateTimeFormat(X,Q[J]||Q.short).format(Y)}catch{return String($)}},currency:($,Z,J="USD",X="en-US")=>{if($===void 0||$===null)return"";try{let Y=Number($);if(Number.isNaN(Y))return String($);return new Intl.NumberFormat(X,{style:"currency",currency:J}).format(Y)}catch{return String($)}},pluralize:($,Z,J,X)=>{let Y=Number($);if(Number.isNaN(Y))return J;let Q=X||`${J}s`;return Y===1?J:Q},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let J=String($);return J.charAt(J.length-1)},length:($,Z)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,Z,J=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return J?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,J="")=>{return $===void 0||$===null||$===""?J:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,J=0,X)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(J,X);return $},replace:($,Z,J,X="")=>{if($===void 0||$===null)return"";let Y=J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Y,"g"),()=>X)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let J=Number($);return Number.isNaN(J)?0:Math.abs(J)},round:($,Z,J=0)=>{let X=Number($);if(Number.isNaN(X))return 0;let Y=10**J;return Math.round(X*Y)/Y}};function XJ($,Z){if($ in n2)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);z2[$]=Z}function Fq($){for(let[Z,J]of Object.entries($))XJ(Z,J)}function YJ(){return{...n2,...z2}}function wq(){for(let $ of Object.keys(z2))delete z2[$]}function QJ($,Z,J=2){let X=0,Y=null;for(let Q=Z+J;Q<$.length;Q++){let G=$[Q];if(Y){if(G==="\\"){Q++;continue}if(G===Y)Y=null;continue}if(G==='"'||G==="'"||G==="`"){Y=G;continue}if(G==="{"){X++;continue}if(G==="}"){if(X>0){X--;continue}let z=0;while($[Q+z]==="}")z++;if(z>=J)return Q}}return-1}function p2($,Z,J=2){let X="{".repeat(J);if(!$.includes(X))return $;let Y="",Q=0;for(;;){let G=$.indexOf(X,Q);if(G===-1)break;let z=QJ($,G,J);if(z===-1)break;Y+=$.slice(Q,G)+Z($.slice(G,z+J),$.slice(G+J,z),G),Q=z+J}return Q===0?$:Y+$.slice(Q)}function $5($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Z5($){return R3($5($))}function J1($,Z){let{scripts:J}=c0($);for(let X of J){let Y=X.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!Y||/\bserver\b|\bsrc\s*=/.test(Y[1]))continue;let Q=Y[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(Q))return!0;if(T3(Q,Z))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function M3($,Z){let J=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","URL","URLSearchParams","Intl","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console","new","typeof","instanceof","in","void"],X=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Y="",Q=!1,G=0;for(let q=0;q<X.length;q++){let W=X[q];if(!Q&&W==="`"){Q=!0,G=0;continue}if(Q){if(W==="`"&&G===0){Q=!1;continue}if(W==="$"&&X[q+1]==="{"){G++,q++,Y+=" ";continue}if(W==="}"&&G>0){G--;continue}if(G>0){Y+=W;continue}continue}Y+=W}X=Y;let z=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,K;while((K=z.exec(X))!==null){let q=K[1];if(!X.substring(0,K.index).trimEnd().endsWith(".")){if(!J.includes(q)&&!(q in Z))return!1}}return!0}function GJ($,Z){let J=Z.__stx_serverDeclared;if(!J||J.size===0)return!1;let X=W0($);for(let Y of J)if(new RegExp(`(?<![.#\\w$])${Y}(?![\\w$])`).test(X))return!0;return!1}function J5($,Z){let J=$;return J=J.replace(/\{!!([\s\S]*?)!!\}/g,(X,Y)=>{try{let Q=f0(Y,Z);if(Q===void 0)return X;return Q===null?"":String(Q)}catch{return X}}),J=p2(J,(X,Y)=>{let Q=Y.trim();if(/^__[A-Z_]+__$/.test(Q))return X;try{let G=f0(Y,Z);if(G===void 0)return X;return JSON.stringify(G).replace(/</g,"\\u003c")}catch{return X}}),J}function zJ($,Z){if(!$.includes("{"))return $;let J=$;return J=J.replace(/\{!!([\s\S]*?)!!\}/g,(X,Y)=>{try{let Q=f0(Y,Z);if(Q===void 0)return X;return Q===null?"":String(Q)}catch{return X}}),J=p2(J,(X,Y)=>{let Q=Y.trim();if(/^__[A-Z_]+__$/.test(Q))return X;try{let G=f0(Y,Z);if(G===void 0)return X;if(G===null)return"";return Z5(String(G))}catch{return X}}),J}function Rq($,Z,J={}){let{output:X,scripts:Y}=c0($),Q=Y.map((G)=>{let z=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),K=G.match(/^<script\b[^>]*>/i),q=G.search(/<\/script\s*>$/i);if(!z||!K||q===-1)return G;let W=z[1],U=z[2];if(/\bdata-raw\b/.test(W))return G;if(J.skipServer&&/\bserver\b/.test(W))return G;let j=`<script${zJ(W,Z)}>`;if(/\bsrc\s*=/.test(W)||/\btype\s*=\s*["']application\/json["']/.test(W))return j+U+G.slice(q);return j+J5(U,Z)+G.slice(q)});return e9(X,Q)}function B1($,Z,J){let X=$,Y=(U,H)=>{let j=i2(U,H);if(j===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(U.slice(H,j))?-1:j},Q=(U,H,j,B)=>{let V=j.length,{output:L,tokens:_}=j1(U,H,(F,O)=>B(V+O));return j.push(..._),L},G=[];X=Q(X,Y,G,(U)=>`<!--__STX_STYLE_${U}__-->`);let z=[];X=Q(X,G2,z,(U)=>`<!--__STX_SCRIPT_EXPR_${U}__-->`);let K=Z?.__stx_signals_gate===!0||J1($),q=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),W=new Set(Array.isArray(Z?.__stx_preserved_client_expressions)?Z.__stx_preserved_client_expressions:[]);if(X=p2(X,(U,H,j)=>{try{let B=f0(H,Z,!1,(V)=>t9(V,U,J,$));return B!==void 0&&B!==null?String(B):""}catch(B){let V=B instanceof Error?B.message:String(B);return _0("Expression",`Error evaluating: {{{ ${H.trim()}}}}: ${V}`,J,$,j,U)}},3),X=X.replace(/\{!!([\s\S]*?)!!\}/g,(U,H,j)=>{try{let B=f0(H,Z,!1,(V)=>t9(V,U,J,$));if(B===void 0&&Z.__stx_buildMode==="compile")return c2("raw",H.trim());return B!==void 0&&B!==null?String(B):""}catch(B){if(Z.__stx_buildMode==="compile")return c2("raw",H.trim());let V=B instanceof Error?B.message:String(B);return _0("Expression",`Error evaluating: {!! ${H.trim()} !!}: ${V}`,J,$,j,U)}}),X=Q(X,G2,z,(U)=>`<!--__STX_SCRIPT_EXPR_${U}__-->`),X=Q(X,Y,G,(U)=>`<!--__STX_STYLE_${U}__-->`),X=p2(X,(U,H,j)=>{let B=H.trim();if(W.has(B))return U;let V=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],L=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,F=B.match(L)?.[1],O=F&&((F in Z)||V.includes(F)),w=Boolean(F&&q.has(F)),N=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,R=B.match(N),M=R&&!V.includes(R[1])&&!(R[1]in Z);if(/^__[A-Z_]+__$/.test(B))return"";let T;try{let D=f0(H,Z,!1,(I)=>{T=I});if(w)return U;if(K&&!M3(B,Z))return U;if(T)t9(T,U,J,$);if(Z.__stx_buildMode==="compile"&&!K&&(D===void 0||GJ(B,Z)))return c2("expr",B);return D!==void 0&&D!==null?Z5(String(D)):""}catch(D){if(w)return U;if(K&&!M3(B,Z))return U;if(M)return U;let I=D instanceof Error?D.message:String(D);return _0("Expression",`Error evaluating: {{ ${B} }}: ${I}`,J,$,j,U)}}),z.length>0)X=X.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(U,H)=>z[Number(H)]??U);if(G.length>0)X=X.replace(/<!--__STX_STYLE_(\d+)__-->/g,(U,H)=>G[Number(H)]??U);return X}function KJ($,Z,J){if(!Z.trim())return $;let X=$,Y=Z.trim();while(Y.length>0){let Q=Y.match(/^(\w+)/);if(!Q)break;let G=Q[1];Y=Y.substring(G.length).trim();let z=z2[G]||n2[G];if(!z)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(YJ()).join(", ")}`);let K=[];if(Y.startsWith(":")){let q=Y.match(/^:([^|\s]+)/);if(q){let W=q[1].trim();try{let U=Number(W);K=[Number.isNaN(U)?W:U]}catch{K=[W]}Y=Y.substring(q[0].length).trim()}}else if(Y.startsWith("(")){let q=1,W=1;while(q>0&&W<Y.length){if(Y[W]==="(")q++;if(Y[W]===")")q--;W++}if(q===0){let U=Y.substring(1,W-1).trim();if(U)try{if(U.startsWith("{")&&U.endsWith("}"))K=[f0(`(${U})`,J,!0)];else{let H=[],j="",B=null,V=0,L=0,_=0,F=!1;for(let O=0;O<U.length;O++){let w=U[O];if(F){j+=w,F=!1;continue}if(w==="\\"){j+=w,F=!0;continue}if(B){if(j+=w,w===B)B=null;continue}if(w==='"'||w==="'"||w==="`"){B=w,j+=w;continue}if(w==="(")V++;else if(w===")")V--;else if(w==="[")L++;else if(w==="]")L--;else if(w==="{")_++;else if(w==="}")_--;if(w===","&&V===0&&L===0&&_===0){H.push(j),j="";continue}j+=w}if(j)H.push(j);K=H.map((O)=>{let w=O.trim();return f0(w,J,!0)})}}catch{K=[U]}Y=Y.substring(W).trim()}}try{X=z(X,J,...K)}catch(q){let W=q instanceof Error?q.message:String(q);throw Error(`Error applying filter '${G}': ${W}`)}if(Y.startsWith("|"))Y=Y.substring(1).trim();else break}return X}function qJ($){let Z=!1,J="",X=0,Y=0,Q=0,G=!1;for(let z=0;z<$.length;z++){let K=$[z],q=$[z+1];if(Z&&G){G=!1;continue}if(Z&&K==="\\"){G=!0;continue}if(G=!1,(K==='"'||K==="'"||K==="`")&&!G){if(!Z)Z=!0,J=K;else if(K===J)Z=!1,J="";continue}if(Z&&J==="`"&&K==="$"&&q==="{"){let W=1;z+=2;while(z<$.length&&W>0){if($[z]==="{")W++;else if($[z]==="}")W--;if(W>0)z++}continue}if(Z)continue;if(K==="(")X++;else if(K===")")X--;else if(K==="[")Y++;else if(K==="]")Y--;else if(K==="{")Q++;else if(K==="}")Q--;if(K==="|"&&X===0&&Y===0&&Q===0){if(q==="|"){z++;continue}if(q==="="){z++;continue}return z}}return-1}var Q2=new Set,WJ=1000;function Nq(){Q2.clear()}function t9($,Z,J,X){if(!A3())return;let Y=`${J}\x00${$.expression}`;if(Q2.has(Y))return;if(Q2.size>=WJ)Q2.clear();Q2.add(Y);let Q=J,G=X;try{if(J&&N3.existsSync(J))G=N3.readFileSync(J,"utf8")}catch{}let z=G.indexOf(Z);if(z>=0)Q=`${J}:${G.slice(0,z).split(`
|
|
124
|
+
`).length}`;console.warn(`${Q}: stx warning: ${Z} rendered as an empty string. The safe evaluator rejected \`${$.expression}\` (${$.rule}). Compute the value in <script server> and interpolate the variable instead.`)}function f0($,Z,J=!1,X){try{let Y=$.trim(),Q=qJ(Y);if(Q>0){let z=Y.substring(0,Q).trim(),K=Y.substring(Q+1).trim(),q=f0(z,Z,!0,X);return KJ(q,K,Z)}let G=I3(Y);if(G!==null){X?.({expression:Y,rule:G});return}try{let z=Object.keys(Z),K=Object.values(Z);return q0(Y,z)(...K)}catch{return Q0(Y,Z)}}catch(Y){if(Y instanceof ReferenceError){let Q=/(\b\w+)\s+is not defined/.exec(Y.message);if(Q){let G=Q[1],z=UJ(G,Object.keys(Z));if(z&&z!==G)Y.message=`${Y.message} \u2014 did you mean '${z}'?`}}if(!J)console.error(`Error evaluating expression: ${$}`,Y);throw Y}}function UJ($,Z){let J=null;for(let Y of Z){if(Y===$)continue;let Q=HJ($,Y);if(J===null||Q<J.dist)J={key:Y,dist:Q}}if(!J)return null;let X=Math.max($.length,J.key.length);if(J.dist<=2||J.dist/X<=0.35)return J.key;return null}function HJ($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[J,X]=$.length<Z.length?[$,Z]:[Z,$],Y=Array(J.length+1),Q=Array(J.length+1);for(let G=0;G<=J.length;G++)Y[G]=G;for(let G=1;G<=X.length;G++){Q[0]=G;for(let z=1;z<=J.length;z++){let K=J[z-1]===X[G-1]?0:1;Q[z]=Math.min(Q[z-1]+1,Y[z]+1,Y[z-1]+K)}for(let z=0;z<=J.length;z++)Y[z]=Q[z]}return Y[J.length]}function Dq($){if(!$)return"";return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}import zz from"fs";import b0 from"path";var X5=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],k3=/<body\b([^>]*)>/gi;function p0($){let Z=0,J,X=X5.map(()=>{return});while(Z<$.length){if(J===void 0||J!==null&&J.index<Z)k3.lastIndex=Z,J=k3.exec($);if(!J)return null;let Y=J.index,Q=-1,G=null;for(let K=0;K<X5.length;K++){let q=X5[K],W=X[K];if(W===void 0||W!==null&&W.index<Z)q.open.lastIndex=Z,W=q.open.exec($),X[K]=W;if(!W)continue;if(W.index<Y&&(Q===-1||W.index<Q))Q=W.index,G=q.close}if(Q===-1||!G)return{index:Y,tag:J[0],attrs:J[1]??""};G.lastIndex=Q;let z=G.exec($);if(!z)return null;Z=z.index+z[0].length}return null}function S1($,Z){let J=p0($);if(!J)return $;return $.slice(0,J.index)+Z(J.tag,J.attrs)+$.slice(J.index+J.tag.length)}var E3=/<style\b[^>]*>/iy,b3=/<\/style>/gi,y3=/<script\b[^>]*>/iy,C3=/<template(?=[\s>/])[^>]*>/iy,S3=/<\/template\s*>/iy;function K2($){let Z=0,J=0,X=-1;while(Z<$.length){let Y=$.indexOf("<",Z);if(Y===-1)return-1;if($.startsWith("<!--",Y)){let K=$.indexOf("-->",Y+4);Z=K===-1?$.length:K+3;continue}E3.lastIndex=Y;let Q=E3.exec($);if(Q){b3.lastIndex=Y+Q[0].length;let K=b3.exec($);Z=K===null?$.length:K.index+8;continue}C3.lastIndex=Y;let G=C3.exec($);if(G){if(J===0)X=Y;J++,Z=Y+G[0].length;continue}S3.lastIndex=Y;let z=S3.exec($);if(z){if(J>0)J--;Z=Y+z[0].length;continue}if(y3.lastIndex=Y,y3.test($))return J>0?X:Y;Z=Y+1}return-1}var P3=null;function jJ($){if(!P3)return console.warn(`[stx] ${$} must be called within a component setup.`),null;return P3}function Tq($){let Z=jJ("onUpdate");if(Z)Z.updateHooks.push($)}function v3(){return`
|
|
125
|
+
// STX Lifecycle Runtime
|
|
126
|
+
(function() {
|
|
127
|
+
if (typeof window === 'undefined') return;
|
|
128
|
+
|
|
129
|
+
const instances = new Map();
|
|
130
|
+
let currentInstance = null;
|
|
131
|
+
let idCounter = 0;
|
|
132
|
+
|
|
133
|
+
function generateId() {
|
|
134
|
+
return 'stx-' + (++idCounter) + '-' + Date.now().toString(36);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function createInstance(element) {
|
|
138
|
+
const instance = {
|
|
139
|
+
id: generateId(),
|
|
140
|
+
element: element,
|
|
141
|
+
mountHooks: [],
|
|
142
|
+
destroyHooks: [],
|
|
143
|
+
updateHooks: [],
|
|
144
|
+
refs: new Map(),
|
|
145
|
+
watchers: [],
|
|
146
|
+
isMounted: false
|
|
147
|
+
};
|
|
148
|
+
instances.set(instance.id, instance);
|
|
149
|
+
return instance;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
window.STX = window.STX || {};
|
|
153
|
+
|
|
154
|
+
// Lifecycle hooks
|
|
155
|
+
window.STX.onMount = function(hook) {
|
|
156
|
+
if (currentInstance) currentInstance.mountHooks.push(hook);
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
window.STX.onDestroy = function(hook) {
|
|
160
|
+
if (currentInstance) currentInstance.destroyHooks.push(hook);
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
window.STX.onUpdate = function(hook) {
|
|
164
|
+
if (currentInstance) currentInstance.updateHooks.push(hook);
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
// Aliases
|
|
168
|
+
window.STX.onMounted = window.STX.onMount;
|
|
169
|
+
window.STX.onUnmounted = window.STX.onDestroy;
|
|
170
|
+
window.STX.onUpdated = window.STX.onUpdate;
|
|
171
|
+
|
|
172
|
+
// Refs
|
|
173
|
+
window.STX.ref = function(initialValue) {
|
|
174
|
+
const r = { value: initialValue || null };
|
|
175
|
+
Object.defineProperty(r, 'current', {
|
|
176
|
+
get: function() { return this.value; }
|
|
177
|
+
});
|
|
178
|
+
if (currentInstance) {
|
|
179
|
+
currentInstance.refs.set('ref-' + currentInstance.refs.size, r);
|
|
180
|
+
}
|
|
181
|
+
return r;
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
// Watch
|
|
185
|
+
window.STX.watch = function(source, callback, options) {
|
|
186
|
+
options = options || {};
|
|
187
|
+
let oldValue;
|
|
188
|
+
let cleanup;
|
|
189
|
+
let isActive = true;
|
|
190
|
+
|
|
191
|
+
function run() {
|
|
192
|
+
if (!isActive) return;
|
|
193
|
+
const newValue = source();
|
|
194
|
+
if (oldValue !== newValue || options.immediate) {
|
|
195
|
+
if (cleanup) cleanup();
|
|
196
|
+
cleanup = callback(newValue, oldValue);
|
|
197
|
+
oldValue = newValue;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if (options.immediate) {
|
|
202
|
+
run();
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
oldValue = source();
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const intervalId = setInterval(run, 16);
|
|
209
|
+
|
|
210
|
+
function stop() {
|
|
211
|
+
isActive = false;
|
|
212
|
+
clearInterval(intervalId);
|
|
213
|
+
if (cleanup) cleanup();
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
if (currentInstance) {
|
|
217
|
+
currentInstance.watchers.push({ stop: stop });
|
|
218
|
+
currentInstance.destroyHooks.push(stop);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return stop;
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
// Computed
|
|
225
|
+
window.STX.computed = function(getter) {
|
|
226
|
+
let cached;
|
|
227
|
+
let dirty = true;
|
|
228
|
+
return {
|
|
229
|
+
get value() {
|
|
230
|
+
if (dirty) {
|
|
231
|
+
cached = getter();
|
|
232
|
+
dirty = false;
|
|
233
|
+
queueMicrotask(function() { dirty = true; });
|
|
234
|
+
}
|
|
235
|
+
return cached;
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
// Component management
|
|
241
|
+
window.STX.setupComponent = function(element, setup) {
|
|
242
|
+
const instance = createInstance(element);
|
|
243
|
+
currentInstance = instance;
|
|
244
|
+
try {
|
|
245
|
+
setup();
|
|
246
|
+
}
|
|
247
|
+
finally {
|
|
248
|
+
currentInstance = null;
|
|
249
|
+
}
|
|
250
|
+
return instance;
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
window.STX.mountComponent = function(instance) {
|
|
254
|
+
if (instance.isMounted) return;
|
|
255
|
+
instance.isMounted = true;
|
|
256
|
+
instance.mountHooks.forEach(function(hook) {
|
|
257
|
+
try {
|
|
258
|
+
const cleanup = hook();
|
|
259
|
+
if (typeof cleanup === 'function') {
|
|
260
|
+
instance.destroyHooks.push(cleanup);
|
|
261
|
+
}
|
|
262
|
+
else if (cleanup && typeof cleanup.then === 'function') {
|
|
263
|
+
cleanup.catch(function(e) { console.error('[stx] onMount error:', e); });
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
catch (e) {
|
|
267
|
+
console.error('[stx] onMount error:', e);
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
window.STX.destroyComponent = function(instance) {
|
|
273
|
+
if (!instance.isMounted) return;
|
|
274
|
+
instance.watchers.forEach(function(w) { w.stop(); });
|
|
275
|
+
instance.destroyHooks.forEach(function(hook) {
|
|
276
|
+
try { hook(); }
|
|
277
|
+
catch (e) { console.error('[stx] onDestroy error:', e); }
|
|
278
|
+
});
|
|
279
|
+
instance.refs.forEach(function(ref) { ref.value = null; });
|
|
280
|
+
instance.isMounted = false;
|
|
281
|
+
instances.delete(instance.id);
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
// ==========================================================================
|
|
285
|
+
// Vue-Style Refs System - No document.** required!
|
|
286
|
+
// ==========================================================================
|
|
287
|
+
|
|
288
|
+
// Internal: Query for ref elements without exposing document API
|
|
289
|
+
function queryRef(name, root) {
|
|
290
|
+
return (root || document).querySelector('[data-stx-ref="' + name + '"], [data-ref="' + name + '"]');
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
function queryAllRefs(root) {
|
|
294
|
+
return (root || document).querySelectorAll('[data-stx-ref], [data-ref]');
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// Auto-bind refs from ref attributes (Vue-style)
|
|
298
|
+
window.STX.bindRefs = function(root, refs) {
|
|
299
|
+
if (!root) return;
|
|
300
|
+
queryAllRefs(root).forEach(function(el) {
|
|
301
|
+
var refName = el.getAttribute('data-stx-ref') || el.getAttribute('data-ref');
|
|
302
|
+
if (refs[refName]) {
|
|
303
|
+
refs[refName].value = el;
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
// Vue-style useRefs() - returns object with all refs as direct elements
|
|
309
|
+
// Usage: const { input, button, container } = STX.useRefs()
|
|
310
|
+
window.STX.useRefs = function(root) {
|
|
311
|
+
var refs = {};
|
|
312
|
+
queryAllRefs(root).forEach(function(el) {
|
|
313
|
+
var refName = el.getAttribute('data-stx-ref') || el.getAttribute('data-ref');
|
|
314
|
+
if (refName) {
|
|
315
|
+
refs[refName] = el;
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
return refs;
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
// Get a single ref by name - Vue's useTemplateRef equivalent
|
|
322
|
+
// Usage: const input = STX.useRef('input')
|
|
323
|
+
window.STX.useRef = function(name, root) {
|
|
324
|
+
return queryRef(name, root);
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
// Two-way binding helper for form elements
|
|
328
|
+
// Usage: STX.model(inputEl, state, 'username')
|
|
329
|
+
window.STX.model = function(el, state, key) {
|
|
330
|
+
if (!el || !state) return;
|
|
331
|
+
|
|
332
|
+
var isCheckbox = el.type === 'checkbox';
|
|
333
|
+
var isRadio = el.type === 'radio';
|
|
334
|
+
var isSelect = el.tagName === 'SELECT';
|
|
335
|
+
|
|
336
|
+
// Set initial value
|
|
337
|
+
if (isCheckbox) {
|
|
338
|
+
el.checked = !!state[key];
|
|
339
|
+
}
|
|
340
|
+
else if (isRadio) {
|
|
341
|
+
el.checked = el.value === state[key];
|
|
342
|
+
}
|
|
343
|
+
else {
|
|
344
|
+
el.value = state[key] || '';
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
// Listen for changes
|
|
348
|
+
var eventType = isCheckbox || isRadio ? 'change' : 'input';
|
|
349
|
+
el.addEventListener(eventType, function() {
|
|
350
|
+
if (isCheckbox) {
|
|
351
|
+
state[key] = el.checked;
|
|
352
|
+
}
|
|
353
|
+
else if (isRadio) {
|
|
354
|
+
if (el.checked) state[key] = el.value;
|
|
355
|
+
}
|
|
356
|
+
else {
|
|
357
|
+
state[key] = el.value;
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
|
|
361
|
+
// Return cleanup function
|
|
362
|
+
return function() {
|
|
363
|
+
el.removeEventListener(eventType, arguments.callee);
|
|
364
|
+
};
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
// Batch event binding helper - cleaner than manual addEventListener
|
|
368
|
+
// Usage: STX.on({ click: [btn1, btn2], input: [textField] }, handler)
|
|
369
|
+
window.STX.on = function(el, event, handler) {
|
|
370
|
+
if (!el) return function() {};
|
|
371
|
+
el.addEventListener(event, handler);
|
|
372
|
+
return function() { el.removeEventListener(event, handler); };
|
|
373
|
+
};
|
|
374
|
+
|
|
375
|
+
// Bind multiple events at once
|
|
376
|
+
// Usage: STX.events(refs.btn, { click: handleClick, mouseenter: handleHover })
|
|
377
|
+
window.STX.events = function(el, eventMap) {
|
|
378
|
+
if (!el) return function() {};
|
|
379
|
+
var cleanups = [];
|
|
380
|
+
Object.keys(eventMap).forEach(function(event) {
|
|
381
|
+
el.addEventListener(event, eventMap[event]);
|
|
382
|
+
cleanups.push(function() { el.removeEventListener(event, eventMap[event]); });
|
|
383
|
+
});
|
|
384
|
+
return function() { cleanups.forEach(function(c) { c(); }); };
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
// ==========================================================================
|
|
388
|
+
// DOM Helpers - Eliminate document.* usage
|
|
389
|
+
// ==========================================================================
|
|
390
|
+
|
|
391
|
+
// Global keyboard event listener
|
|
392
|
+
// Usage: STX.onKey('Escape', () => closeModal())
|
|
393
|
+
window.STX.onKey = function(key, handler, options) {
|
|
394
|
+
var listener = function(e) {
|
|
395
|
+
if (e.key === key) {
|
|
396
|
+
handler(e);
|
|
397
|
+
}
|
|
398
|
+
};
|
|
399
|
+
document.addEventListener('keydown', listener, options);
|
|
400
|
+
return function() { document.removeEventListener('keydown', listener, options); };
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
// Create element helper
|
|
404
|
+
// Usage: STX.el('div', { class: 'foo' }, 'text content')
|
|
405
|
+
window.STX.el = function(tag, attrs, content) {
|
|
406
|
+
var el = document.createElement(tag);
|
|
407
|
+
if (attrs) {
|
|
408
|
+
Object.keys(attrs).forEach(function(key) {
|
|
409
|
+
if (key === 'class') {
|
|
410
|
+
el.className = attrs[key];
|
|
411
|
+
}
|
|
412
|
+
else if (key.startsWith('on')) {
|
|
413
|
+
el.addEventListener(key.slice(2).toLowerCase(), attrs[key]);
|
|
414
|
+
}
|
|
415
|
+
else {
|
|
416
|
+
el.setAttribute(key, attrs[key]);
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
if (content) {
|
|
421
|
+
if (typeof content === 'string') {
|
|
422
|
+
el.textContent = content;
|
|
423
|
+
}
|
|
424
|
+
else if (Array.isArray(content)) {
|
|
425
|
+
content.forEach(function(child) { el.appendChild(child); });
|
|
426
|
+
}
|
|
427
|
+
else {
|
|
428
|
+
el.appendChild(content);
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
return el;
|
|
432
|
+
};
|
|
433
|
+
|
|
434
|
+
// Get currently focused element
|
|
435
|
+
// Usage: const focused = STX.activeElement()
|
|
436
|
+
window.STX.activeElement = function() {
|
|
437
|
+
return document.activeElement;
|
|
438
|
+
};
|
|
439
|
+
|
|
440
|
+
// Escape HTML helper
|
|
441
|
+
// Usage: const safe = STX.escapeHtml(userInput)
|
|
442
|
+
window.STX.escapeHtml = function(text) {
|
|
443
|
+
var div = document.createElement('div');
|
|
444
|
+
div.textContent = text;
|
|
445
|
+
return div.innerHTML;
|
|
446
|
+
};
|
|
447
|
+
|
|
448
|
+
// MutationObserver for automatic lifecycle management
|
|
449
|
+
const observer = new MutationObserver(function(mutations) {
|
|
450
|
+
mutations.forEach(function(mutation) {
|
|
451
|
+
// Handle removed nodes
|
|
452
|
+
mutation.removedNodes.forEach(function(node) {
|
|
453
|
+
if (node.nodeType === 1 && node.__stx_instance__) {
|
|
454
|
+
window.STX.destroyComponent(node.__stx_instance__);
|
|
455
|
+
}
|
|
456
|
+
});
|
|
457
|
+
});
|
|
458
|
+
});
|
|
459
|
+
|
|
460
|
+
// Start observing when DOM is ready
|
|
461
|
+
if (document.readyState === 'loading') {
|
|
462
|
+
document.addEventListener('DOMContentLoaded', function() {
|
|
463
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
else {
|
|
467
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
console.log('[stx] Lifecycle runtime initialized');
|
|
471
|
+
})();
|
|
472
|
+
`}function Y5($){return Symbol($)}var kq=Y5("theme"),Eq=Y5("router"),bq=Y5("i18n");import*as x3 from"crypto";function f3($){let Z=/\$(\w+)\./g,J=[],X;while((X=Z.exec($))!==null)if(!J.includes(X[1]))J.push(X[1]);return J}function BJ(){return`stx-${x3.randomBytes(4).toString("hex")}`}function VJ($){return/\$\w+\./.test($)}function OJ($){if(!$.includes("{{")||!/\$\w+\./.test($))return{html:$,bindings:[],stores:new Set};let Z=[],J=new Set,X=/<(\w+)([^>]*?)(\s*\/?>)/g,Y=$;return Y=Y.replace(X,(Q,G,z,K)=>{if(["script","style","template"].includes(G.toLowerCase()))return Q;let q=[],W=!1,U=z,H=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,j=[...z.matchAll(H)];for(let L of j){let _=L[0],F=L[1],O=L[2];if(VJ(O)){W=!0;let w=O.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(w){let N=w[1];if(q.push({attr:F,expr:N,fullMatch:_,originalAttr:F}),f3(N).forEach((M)=>J.add(M)),F==="text")U=U.replace(_,"");else if(F==="class")U=U.replace(_,'class=""');else if(F==="disabled"||F==="hidden")U=U.replace(_,"");else U=U.replace(_,`${F}=""`)}}}if(!W)return Q;let B=U.match(/\bid\s*=\s*"([^"]+)"/),V;if(B)V=B[1];else V=BJ(),U=` id="${V}"${U}`;for(let L of q)Z.push({elementId:V,attribute:L.attr,expression:L.expr,stores:f3(L.expr)});return`<${G}${U}${K}`}),{html:Y,bindings:Z,stores:J}}function _J($,Z){if($.length===0)return"";let J=Array.from(Z),X=`
|
|
473
|
+
<script>
|
|
474
|
+
(function() {
|
|
475
|
+
'use strict';
|
|
476
|
+
|
|
477
|
+
// Wait for stores to be available
|
|
478
|
+
function initBindings() {
|
|
479
|
+
var stores = window.VoideStores;
|
|
480
|
+
if (!stores) {
|
|
481
|
+
setTimeout(initBindings, 10);
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
// Store references for expressions
|
|
486
|
+
// eslint-disable-next-line pickier/no-unused-vars
|
|
487
|
+
var $state = {};
|
|
488
|
+
`;for(let Y of J)X+=` $state.${Y} = stores.${Y} ? stores.${Y}.get() : {};
|
|
489
|
+
`;X+=`
|
|
490
|
+
// Binding update functions
|
|
491
|
+
function updateBindings() {
|
|
492
|
+
`;for(let Y of $){let{elementId:Q,attribute:G,expression:z}=Y,K=z.replace(/\$(\w+)\./g,"$state.$1.");if(G==="text")X+=` (function() {
|
|
493
|
+
var el = document.getElementById('${Q}');
|
|
494
|
+
if (el) {
|
|
495
|
+
try {
|
|
496
|
+
el.textContent = ${K};
|
|
497
|
+
}
|
|
498
|
+
catch (e) { console.error('Binding error:', e); }
|
|
499
|
+
}
|
|
500
|
+
})();
|
|
501
|
+
`;else if(G==="html")X+=` (function() {
|
|
502
|
+
var el = document.getElementById('${Q}');
|
|
503
|
+
if (el) {
|
|
504
|
+
try {
|
|
505
|
+
el.innerHTML = ${K};
|
|
506
|
+
}
|
|
507
|
+
catch (e) { console.error('Binding error:', e); }
|
|
508
|
+
}
|
|
509
|
+
})();
|
|
510
|
+
`;else if(G==="class")X+=` (function() {
|
|
511
|
+
var el = document.getElementById('${Q}');
|
|
512
|
+
if (el) {
|
|
513
|
+
try {
|
|
514
|
+
var value = ${K};
|
|
515
|
+
if (typeof value === 'string') {
|
|
516
|
+
// Dynamic class string - merge with existing static classes
|
|
517
|
+
// eslint-disable-next-line pickier/no-unused-vars
|
|
518
|
+
var staticClasses = el.getAttribute('data-static-class') || el.className;
|
|
519
|
+
if (!el.hasAttribute('data-static-class')) {
|
|
520
|
+
el.setAttribute('data-static-class', el.className);
|
|
521
|
+
}
|
|
522
|
+
el.className = (el.getAttribute('data-static-class') + ' ' + value).trim();
|
|
523
|
+
}
|
|
524
|
+
else if (typeof value === 'object') {
|
|
525
|
+
// Object syntax: { 'class-name': condition }
|
|
526
|
+
for (var cls in value) {
|
|
527
|
+
if (value[cls]) {
|
|
528
|
+
el.classList.add(cls);
|
|
529
|
+
}
|
|
530
|
+
else {
|
|
531
|
+
el.classList.remove(cls);
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
catch (e) { console.error('Binding error:', e); }
|
|
537
|
+
}
|
|
538
|
+
})();
|
|
539
|
+
`;else if(G==="show")X+=` (function() {
|
|
540
|
+
var el = document.getElementById('${Q}');
|
|
541
|
+
if (el) {
|
|
542
|
+
try {
|
|
543
|
+
el.style.display = (${K}) ? '' : 'none';
|
|
544
|
+
}
|
|
545
|
+
catch (e) { console.error('Binding error:', e); }
|
|
546
|
+
}
|
|
547
|
+
})();
|
|
548
|
+
`;else if(G==="if")X+=` (function() {
|
|
549
|
+
var el = document.getElementById('${Q}');
|
|
550
|
+
if (el) {
|
|
551
|
+
try {
|
|
552
|
+
el.style.visibility = (${K}) ? 'visible' : 'hidden';
|
|
553
|
+
}
|
|
554
|
+
catch (e) { console.error('Binding error:', e); }
|
|
555
|
+
}
|
|
556
|
+
})();
|
|
557
|
+
`;else X+=` (function() {
|
|
558
|
+
var el = document.getElementById('${Q}');
|
|
559
|
+
if (el) {
|
|
560
|
+
try {
|
|
561
|
+
var value = ${K};
|
|
562
|
+
if (value === false || value === null || value === undefined) {
|
|
563
|
+
el.removeAttribute('${G}');
|
|
564
|
+
}
|
|
565
|
+
else if (value === true) {
|
|
566
|
+
el.setAttribute('${G}', '');
|
|
567
|
+
}
|
|
568
|
+
else {
|
|
569
|
+
el.setAttribute('${G}', value);
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
catch (e) { console.error('Binding error:', e); }
|
|
573
|
+
}
|
|
574
|
+
})();
|
|
575
|
+
`}X+=` }
|
|
576
|
+
|
|
577
|
+
// Subscribe to stores and update on changes. Capture the disposers so
|
|
578
|
+
// SPA fragment swaps can tear down old bindings before the next page's
|
|
579
|
+
// runtime takes over \u2014 without this, every navigation between pages
|
|
580
|
+
// using reactive-bindings stacked another subscription on every store,
|
|
581
|
+
// walking detached DOM forever. See stacksjs/stx#1709.
|
|
582
|
+
var _disposers = [];
|
|
583
|
+
`;for(let Y of J)X+=` if (stores.${Y}) {
|
|
584
|
+
var _unsub_${Y} = stores.${Y}.subscribe(function(state) {
|
|
585
|
+
$state.${Y} = state;
|
|
586
|
+
updateBindings();
|
|
587
|
+
});
|
|
588
|
+
// store.subscribe() may return the disposer (preferred) or void; both
|
|
589
|
+
// are tolerated here.
|
|
590
|
+
if (typeof _unsub_${Y} === 'function') _disposers.push(_unsub_${Y});
|
|
591
|
+
}
|
|
592
|
+
`;return X+=`
|
|
593
|
+
// Initial update
|
|
594
|
+
updateBindings();
|
|
595
|
+
|
|
596
|
+
// Register this runtime's cleanup so SPA navigation can run it before
|
|
597
|
+
// swapping pages. The router (and any code) can call
|
|
598
|
+
// window.__stxCleanupBindings() to dispose subscriptions; we also wire
|
|
599
|
+
// 'popstate' and 'beforeunload' as a safety net for browser-driven nav.
|
|
600
|
+
function _cleanup() {
|
|
601
|
+
for (var i = 0; i < _disposers.length; i++) {
|
|
602
|
+
try { _disposers[i](); } catch (e) { /* swallow */ }
|
|
603
|
+
}
|
|
604
|
+
_disposers.length = 0;
|
|
605
|
+
}
|
|
606
|
+
if (!window.__stxBindingsCleanups) window.__stxBindingsCleanups = [];
|
|
607
|
+
window.__stxBindingsCleanups.push(_cleanup);
|
|
608
|
+
if (!window.__stxCleanupBindings) {
|
|
609
|
+
window.__stxCleanupBindings = function() {
|
|
610
|
+
var fns = window.__stxBindingsCleanups || [];
|
|
611
|
+
for (var i = 0; i < fns.length; i++) {
|
|
612
|
+
try { fns[i](); } catch (e) { /* swallow */ }
|
|
613
|
+
}
|
|
614
|
+
window.__stxBindingsCleanups = [];
|
|
615
|
+
};
|
|
616
|
+
window.addEventListener('popstate', window.__stxCleanupBindings);
|
|
617
|
+
window.addEventListener('beforeunload', window.__stxCleanupBindings);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
// Start when DOM is ready
|
|
622
|
+
if (document.readyState === 'loading') {
|
|
623
|
+
document.addEventListener('DOMContentLoaded', initBindings);
|
|
624
|
+
}
|
|
625
|
+
else {
|
|
626
|
+
initBindings();
|
|
627
|
+
}
|
|
628
|
+
})();
|
|
629
|
+
</script>
|
|
630
|
+
`,X}function g3($){let{html:Z,bindings:J,stores:X}=OJ($);if(J.length===0)return $;let Y=_J(J,X),Q=Z.lastIndexOf("</body>");if(Q!==-1)return Z.slice(0,Q)+Y+Z.slice(Q);return Z+Y}function h3($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return LJ(Z);case"google-analytics":return FJ(Z);case"plausible":return wJ(Z);case"self-hosted":return RJ(Z);case"custom":return NJ(Z);default:return""}}function LJ($){let Z=$.fathom;if(!Z?.siteId)return"";let J=Z.scriptUrl||"https://cdn.usefathom.com/script.js",X=Z.defer!==!1?" defer":"",Y=[`data-site="${x0(Z.siteId)}"`];if(Z.honorDnt)Y.push('data-honor-dnt="true"');if(Z.spa)Y.push('data-spa="auto"');if(Z.canonical)Y.push(`data-canonical="${x0(Z.canonical)}"`);if(Z.auto===!1)Y.push('data-auto="false"');return`
|
|
631
|
+
<!-- Fathom Analytics -->
|
|
632
|
+
<script src="${x0(J)}" ${Y.join(" ")}${X}></script>
|
|
633
|
+
`}function FJ($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let J=x0(Z.measurementId),X=Z.debug?`gtag('config', '${J}', { 'debug_mode': true });`:"";return`
|
|
634
|
+
<!-- Google Analytics -->
|
|
635
|
+
<script async src="https://www.googletagmanager.com/gtag/js?id=${J}"></script>
|
|
636
|
+
<script>
|
|
637
|
+
window.dataLayer = window.dataLayer || [];
|
|
638
|
+
function gtag(){dataLayer.push(arguments);}
|
|
639
|
+
gtag('js', new Date());
|
|
640
|
+
gtag('config', '${J}');
|
|
641
|
+
${X}
|
|
642
|
+
</script>
|
|
643
|
+
`}function wJ($){let Z=$.plausible;if(!Z?.domain)return"";let J=Z.scriptUrl||"https://plausible.io/js/script.js",X=[`data-domain="${x0(Z.domain)}"`],Y=J,Q=[];if(Z.trackLocalhost)Q.push("local");if(Z.hashMode)Q.push("hash");if(Q.length>0&&J==="https://plausible.io/js/script.js")Y=`https://plausible.io/js/script.${Q.join(".")}.js`;return`
|
|
644
|
+
<!-- Plausible Analytics -->
|
|
645
|
+
<script defer data-domain="${x0(Z.domain)}" src="${x0(Y)}"></script>
|
|
646
|
+
`}function RJ($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let J=x0(Z.siteId),X=x0(Z.apiEndpoint),Y=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",Q=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
|
|
647
|
+
d.addEventListener('click',function(e){
|
|
648
|
+
var a=e.target.closest('a');
|
|
649
|
+
if(a&&a.hostname!==location.hostname){
|
|
650
|
+
t('outbound',{url:a.href});
|
|
651
|
+
}
|
|
652
|
+
});`:"";return`
|
|
653
|
+
<!-- Self-Hosted Analytics -->
|
|
654
|
+
<script data-site="${J}" data-api="${X}" defer>
|
|
655
|
+
(function(){
|
|
656
|
+
'use strict';
|
|
657
|
+
var d=document,w=window,n=navigator,s=d.currentScript;
|
|
658
|
+
var site=s.dataset.site,api=s.dataset.api;
|
|
659
|
+
${Y}
|
|
660
|
+
var q=[],sid=Math.random().toString(36).slice(2);
|
|
661
|
+
function t(e,p){
|
|
662
|
+
var x=new XMLHttpRequest();
|
|
663
|
+
x.open('POST',api+'/collect',true);
|
|
664
|
+
x.setRequestHeader('Content-Type','application/json');
|
|
665
|
+
x.send(JSON.stringify({
|
|
666
|
+
s:site,sid:sid,e:e,p:p||{},
|
|
667
|
+
u:location.href,r:d.referrer,t:d.title,
|
|
668
|
+
sw:screen.width,sh:screen.height
|
|
669
|
+
}));
|
|
670
|
+
}
|
|
671
|
+
function pv(){t('pageview');}
|
|
672
|
+
${Q}
|
|
673
|
+
${G}
|
|
674
|
+
if(d.readyState==='complete')pv();
|
|
675
|
+
else w.addEventListener('load',pv);
|
|
676
|
+
w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
|
|
677
|
+
})();
|
|
678
|
+
</script>
|
|
679
|
+
`}function NJ($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
|
|
680
|
+
<!-- Custom Analytics -->
|
|
681
|
+
<script>
|
|
682
|
+
${Z.inlineScript}
|
|
683
|
+
</script>
|
|
684
|
+
`;if(!Z.scriptUrl)return"";let J=[];if(Z.scriptId)J.push(`id="${x0(Z.scriptId)}"`);if(Z.attributes)for(let[Y,Q]of Object.entries(Z.attributes))J.push(`${x0(Y)}="${x0(Q)}"`);return`
|
|
685
|
+
<!-- Custom Analytics -->
|
|
686
|
+
<script${J.length>0?` ${J.join(" ")}`:""} src="${x0(Z.scriptUrl)}" defer></script>
|
|
687
|
+
`}function u3($,Z){let J=h3(Z);if(!J)return $;if(!$.includes("</head>")){let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+J+$.slice(X);return $+J}return $.replace("</head>",`${J}</head>`)}function x0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var Sq={name:"analytics",hasEndTag:!1,handler:async($,Z,J,X)=>{let Y=J.__stx_config||{};return h3(Y)}};var DJ={enabled:!1,trackMouse:!0,trackClicks:!0,trackScroll:!0,samplingRate:100,honorDnt:!0,batchSize:50,maxDataPoints:1000,sessionTimeout:30,persistData:!1,storagePrefix:"stx_heatmap",captureAttributes:["data-heatmap-id","data-track"],ignoreSelectors:["[data-heatmap-ignore]",".heatmap-ignore"],debugOverlay:!1};function m3($){let Z=$.heatmap;if(!Z?.enabled)return"";let J={...DJ,...Z};return`
|
|
688
|
+
<!-- stx Heatmap - Privacy-Compliant Tracking -->
|
|
689
|
+
<script>
|
|
690
|
+
(function() {
|
|
691
|
+
'use strict';
|
|
692
|
+
|
|
693
|
+
// Configuration
|
|
694
|
+
var config = ${JSON.stringify({trackMouse:J.trackMouse,trackClicks:J.trackClicks,trackScroll:J.trackScroll,samplingRate:J.samplingRate,honorDnt:J.honorDnt,endpoint:J.endpoint,batchSize:J.batchSize,maxDataPoints:J.maxDataPoints,sessionTimeout:J.sessionTimeout,persistData:J.persistData,storagePrefix:J.storagePrefix,captureAttributes:J.captureAttributes,ignoreSelectors:J.ignoreSelectors,zones:J.zones,debugOverlay:J.debugOverlay,minViewportWidth:J.minViewportWidth,maxViewportWidth:J.maxViewportWidth})};
|
|
695
|
+
|
|
696
|
+
// Check Do Not Track
|
|
697
|
+
if (config.honorDnt && navigator.doNotTrack === '1') {
|
|
698
|
+
return;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
// Check viewport constraints
|
|
702
|
+
var vw = window.innerWidth;
|
|
703
|
+
if (config.minViewportWidth && vw < config.minViewportWidth) return;
|
|
704
|
+
if (config.maxViewportWidth && vw > config.maxViewportWidth) return;
|
|
705
|
+
|
|
706
|
+
// Session management (anonymous, no cookies)
|
|
707
|
+
var session = {
|
|
708
|
+
sid: Math.random().toString(36).slice(2) + Date.now().toString(36),
|
|
709
|
+
page: location.pathname,
|
|
710
|
+
vw: window.innerWidth,
|
|
711
|
+
vh: window.innerHeight,
|
|
712
|
+
points: [],
|
|
713
|
+
started: Date.now(),
|
|
714
|
+
lastActivity: Date.now()
|
|
715
|
+
};
|
|
716
|
+
|
|
717
|
+
// Throttle helper
|
|
718
|
+
var lastMove = 0;
|
|
719
|
+
function throttle(fn, wait) {
|
|
720
|
+
return function() {
|
|
721
|
+
var now = Date.now();
|
|
722
|
+
if (now - lastMove >= wait) {
|
|
723
|
+
lastMove = now;
|
|
724
|
+
fn.apply(this, arguments);
|
|
725
|
+
}
|
|
726
|
+
};
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
// Get relative coordinates (percentage)
|
|
730
|
+
function getRelativeCoords(e) {
|
|
731
|
+
return {
|
|
732
|
+
x: Math.round((e.clientX / window.innerWidth) * 10000) / 100,
|
|
733
|
+
y: Math.round((e.clientY / window.innerHeight) * 10000) / 100
|
|
734
|
+
};
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
// Check if element should be ignored
|
|
738
|
+
function shouldIgnore(el) {
|
|
739
|
+
if (!el || !config.ignoreSelectors) return false;
|
|
740
|
+
for (var i = 0; i < config.ignoreSelectors.length; i++) {
|
|
741
|
+
if (el.matches && el.matches(config.ignoreSelectors[i])) return true;
|
|
742
|
+
if (el.closest && el.closest(config.ignoreSelectors[i])) return true;
|
|
743
|
+
}
|
|
744
|
+
return false;
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
// Get element selector (simplified, no IDs to preserve privacy)
|
|
748
|
+
function getSelector(el) {
|
|
749
|
+
if (!el || !el.tagName) return null;
|
|
750
|
+
var tag = el.tagName.toLowerCase();
|
|
751
|
+
var classes = el.className && typeof el.className === 'string'
|
|
752
|
+
? '.' + el.className.trim().split(/\\s+/).slice(0, 2).join('.')
|
|
753
|
+
: '';
|
|
754
|
+
return tag + classes;
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
// Find zone for element
|
|
758
|
+
function findZone(el) {
|
|
759
|
+
if (!config.zones || !el) return null;
|
|
760
|
+
for (var i = 0; i < config.zones.length; i++) {
|
|
761
|
+
var zone = config.zones[i];
|
|
762
|
+
if (el.closest && el.closest(zone.selector)) {
|
|
763
|
+
return zone.id;
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
return null;
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
// Capture custom attributes
|
|
770
|
+
function captureAttributes(el) {
|
|
771
|
+
if (!config.captureAttributes || !el) return null;
|
|
772
|
+
var attrs = {};
|
|
773
|
+
var hasAttrs = false;
|
|
774
|
+
for (var i = 0; i < config.captureAttributes.length; i++) {
|
|
775
|
+
var attr = config.captureAttributes[i];
|
|
776
|
+
var value = el.getAttribute && el.getAttribute(attr);
|
|
777
|
+
if (value) {
|
|
778
|
+
attrs[attr] = value;
|
|
779
|
+
hasAttrs = true;
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
return hasAttrs ? attrs : null;
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
// Add data point
|
|
786
|
+
function addPoint(point) {
|
|
787
|
+
session.lastActivity = Date.now();
|
|
788
|
+
if (session.points.length >= config.maxDataPoints) {
|
|
789
|
+
session.points.shift();
|
|
790
|
+
}
|
|
791
|
+
session.points.push(point);
|
|
792
|
+
|
|
793
|
+
// Send batch if threshold reached
|
|
794
|
+
if (config.endpoint && session.points.length >= config.batchSize) {
|
|
795
|
+
sendData();
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
// Send data to endpoint
|
|
800
|
+
function sendData() {
|
|
801
|
+
if (!config.endpoint || session.points.length === 0) return;
|
|
802
|
+
|
|
803
|
+
var data = {
|
|
804
|
+
sid: session.sid,
|
|
805
|
+
page: session.page,
|
|
806
|
+
vw: session.vw,
|
|
807
|
+
vh: session.vh,
|
|
808
|
+
points: session.points.splice(0, config.batchSize)
|
|
809
|
+
};
|
|
810
|
+
|
|
811
|
+
// Use sendBeacon for reliability
|
|
812
|
+
if (navigator.sendBeacon) {
|
|
813
|
+
navigator.sendBeacon(config.endpoint, JSON.stringify(data));
|
|
814
|
+
}
|
|
815
|
+
else {
|
|
816
|
+
var xhr = new XMLHttpRequest();
|
|
817
|
+
xhr.open('POST', config.endpoint, true);
|
|
818
|
+
xhr.setRequestHeader('Content-Type', 'application/json');
|
|
819
|
+
xhr.send(JSON.stringify(data));
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
// Mouse move handler
|
|
824
|
+
if (config.trackMouse) {
|
|
825
|
+
document.addEventListener('mousemove', throttle(function(e) {
|
|
826
|
+
if (shouldIgnore(e.target)) return;
|
|
827
|
+
var coords = getRelativeCoords(e);
|
|
828
|
+
addPoint({
|
|
829
|
+
x: coords.x,
|
|
830
|
+
y: coords.y,
|
|
831
|
+
type: 'move',
|
|
832
|
+
t: Date.now(),
|
|
833
|
+
zone: findZone(e.target)
|
|
834
|
+
});
|
|
835
|
+
}, config.samplingRate), { passive: true });
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
// Click handler
|
|
839
|
+
if (config.trackClicks) {
|
|
840
|
+
document.addEventListener('click', function(e) {
|
|
841
|
+
if (shouldIgnore(e.target)) return;
|
|
842
|
+
var coords = getRelativeCoords(e);
|
|
843
|
+
var point = {
|
|
844
|
+
x: coords.x,
|
|
845
|
+
y: coords.y,
|
|
846
|
+
type: 'click',
|
|
847
|
+
t: Date.now(),
|
|
848
|
+
el: getSelector(e.target),
|
|
849
|
+
zone: findZone(e.target)
|
|
850
|
+
};
|
|
851
|
+
var attrs = captureAttributes(e.target);
|
|
852
|
+
if (attrs) point.attrs = attrs;
|
|
853
|
+
addPoint(point);
|
|
854
|
+
}, { passive: true });
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
// Scroll handler
|
|
858
|
+
if (config.trackScroll) {
|
|
859
|
+
var lastScrollDepth = 0;
|
|
860
|
+
document.addEventListener('scroll', throttle(function() {
|
|
861
|
+
var scrollTop = window.pageYOffset || document.documentElement.scrollTop;
|
|
862
|
+
var scrollHeight = document.documentElement.scrollHeight - window.innerHeight;
|
|
863
|
+
var depth = scrollHeight > 0 ? Math.round((scrollTop / scrollHeight) * 100) : 0;
|
|
864
|
+
|
|
865
|
+
// Only track significant scroll changes (every 10%)
|
|
866
|
+
if (Math.abs(depth - lastScrollDepth) >= 10) {
|
|
867
|
+
lastScrollDepth = depth;
|
|
868
|
+
addPoint({
|
|
869
|
+
x: 50,
|
|
870
|
+
y: depth,
|
|
871
|
+
type: 'scroll',
|
|
872
|
+
t: Date.now(),
|
|
873
|
+
depth: depth
|
|
874
|
+
});
|
|
875
|
+
}
|
|
876
|
+
}, config.samplingRate * 2), { passive: true });
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
// Send remaining data on page unload
|
|
880
|
+
window.addEventListener('beforeunload', sendData);
|
|
881
|
+
window.addEventListener('visibilitychange', function() {
|
|
882
|
+
if (document.visibilityState === 'hidden') {
|
|
883
|
+
sendData();
|
|
884
|
+
}
|
|
885
|
+
});
|
|
886
|
+
|
|
887
|
+
// Persist data to localStorage if enabled
|
|
888
|
+
if (config.persistData) {
|
|
889
|
+
var storageKey = config.storagePrefix + '_' + session.page.replace(/\\//g, '_');
|
|
890
|
+
|
|
891
|
+
// Load existing data
|
|
892
|
+
try {
|
|
893
|
+
var stored = localStorage.getItem(storageKey);
|
|
894
|
+
if (stored) {
|
|
895
|
+
var parsed = JSON.parse(stored);
|
|
896
|
+
if (Date.now() - parsed.lastActivity < config.sessionTimeout * 60000) {
|
|
897
|
+
session.points = parsed.points || [];
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
catch (e) {}
|
|
902
|
+
|
|
903
|
+
// Save periodically
|
|
904
|
+
setInterval(function() {
|
|
905
|
+
try {
|
|
906
|
+
localStorage.setItem(storageKey, JSON.stringify({
|
|
907
|
+
points: session.points,
|
|
908
|
+
lastActivity: session.lastActivity
|
|
909
|
+
}));
|
|
910
|
+
}
|
|
911
|
+
catch (e) {}
|
|
912
|
+
}, 5000);
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
// Debug overlay
|
|
916
|
+
if (config.debugOverlay) {
|
|
917
|
+
var overlay = document.createElement('div');
|
|
918
|
+
overlay.id = 'stx-heatmap-overlay';
|
|
919
|
+
overlay.style.cssText = 'position:fixed;top:0;left:0;width:100%;height:100%;pointer-events:none;z-index:999999;';
|
|
920
|
+
document.body.appendChild(overlay);
|
|
921
|
+
|
|
922
|
+
var canvas = document.createElement('canvas');
|
|
923
|
+
canvas.width = window.innerWidth;
|
|
924
|
+
canvas.height = window.innerHeight;
|
|
925
|
+
canvas.style.cssText = 'width:100%;height:100%;';
|
|
926
|
+
overlay.appendChild(canvas);
|
|
927
|
+
var ctx = canvas.getContext('2d');
|
|
928
|
+
|
|
929
|
+
function renderOverlay() {
|
|
930
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
931
|
+
session.points.forEach(function(p) {
|
|
932
|
+
var x = (p.x / 100) * canvas.width;
|
|
933
|
+
var y = (p.y / 100) * canvas.height;
|
|
934
|
+
ctx.beginPath();
|
|
935
|
+
ctx.arc(x, y, p.type === 'click' ? 8 : 3, 0, Math.PI * 2);
|
|
936
|
+
ctx.fillStyle = p.type === 'click' ? 'rgba(255,0,0,0.5)' : 'rgba(0,0,255,0.2)';
|
|
937
|
+
ctx.fill();
|
|
938
|
+
});
|
|
939
|
+
requestAnimationFrame(renderOverlay);
|
|
940
|
+
}
|
|
941
|
+
renderOverlay();
|
|
942
|
+
|
|
943
|
+
window.addEventListener('resize', function() {
|
|
944
|
+
canvas.width = window.innerWidth;
|
|
945
|
+
canvas.height = window.innerHeight;
|
|
946
|
+
});
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
// Expose API for manual tracking and data export
|
|
950
|
+
window.stxHeatmap = {
|
|
951
|
+
// Get current session data
|
|
952
|
+
getData: function() {
|
|
953
|
+
return {
|
|
954
|
+
sid: session.sid,
|
|
955
|
+
page: session.page,
|
|
956
|
+
vw: session.vw,
|
|
957
|
+
vh: session.vh,
|
|
958
|
+
points: session.points.slice(),
|
|
959
|
+
started: session.started,
|
|
960
|
+
lastActivity: session.lastActivity
|
|
961
|
+
};
|
|
962
|
+
},
|
|
963
|
+
// Export data as JSON
|
|
964
|
+
exportJSON: function() {
|
|
965
|
+
return JSON.stringify(this.getData(), null, 2);
|
|
966
|
+
},
|
|
967
|
+
// Export data as CSV
|
|
968
|
+
exportCSV: function() {
|
|
969
|
+
var data = this.getData();
|
|
970
|
+
var lines = ['x,y,type,timestamp,element,zone,depth'];
|
|
971
|
+
data.points.forEach(function(p) {
|
|
972
|
+
lines.push([p.x, p.y, p.type, p.t, p.el || '', p.zone || '', p.depth || ''].join(','));
|
|
973
|
+
});
|
|
974
|
+
return lines.join('\\n');
|
|
975
|
+
},
|
|
976
|
+
// Manual data send
|
|
977
|
+
flush: function() {
|
|
978
|
+
sendData();
|
|
979
|
+
},
|
|
980
|
+
// Clear data
|
|
981
|
+
clear: function() {
|
|
982
|
+
session.points = [];
|
|
983
|
+
if (config.persistData) {
|
|
984
|
+
var storageKey = config.storagePrefix + '_' + session.page.replace(/\\//g, '_');
|
|
985
|
+
try { localStorage.removeItem(storageKey); }
|
|
986
|
+
catch (e) {}
|
|
987
|
+
}
|
|
988
|
+
},
|
|
989
|
+
// Add custom event
|
|
990
|
+
track: function(type, data) {
|
|
991
|
+
addPoint({
|
|
992
|
+
x: data && data.x || 0,
|
|
993
|
+
y: data && data.y || 0,
|
|
994
|
+
type: type,
|
|
995
|
+
t: Date.now(),
|
|
996
|
+
attrs: data
|
|
997
|
+
});
|
|
998
|
+
},
|
|
999
|
+
// Generate heatmap visualization
|
|
1000
|
+
visualize: function(options) {
|
|
1001
|
+
options = options || {};
|
|
1002
|
+
var data = this.getData();
|
|
1003
|
+
var width = options.width || data.vw;
|
|
1004
|
+
var height = options.height || data.vh;
|
|
1005
|
+
var radius = options.radius || 20;
|
|
1006
|
+
var blur = options.blur || 15;
|
|
1007
|
+
var maxOpacity = options.maxOpacity || 0.6;
|
|
1008
|
+
|
|
1009
|
+
var canvas = document.createElement('canvas');
|
|
1010
|
+
canvas.width = width;
|
|
1011
|
+
canvas.height = height;
|
|
1012
|
+
var ctx = canvas.getContext('2d');
|
|
1013
|
+
|
|
1014
|
+
// Create heat points
|
|
1015
|
+
data.points.forEach(function(p) {
|
|
1016
|
+
var x = (p.x / 100) * width;
|
|
1017
|
+
var y = (p.y / 100) * height;
|
|
1018
|
+
var intensity = p.type === 'click' ? 1 : 0.3;
|
|
1019
|
+
|
|
1020
|
+
var gradient = ctx.createRadialGradient(x, y, 0, x, y, radius);
|
|
1021
|
+
gradient.addColorStop(0, 'rgba(255,0,0,' + intensity + ')');
|
|
1022
|
+
gradient.addColorStop(1, 'rgba(255,0,0,0)');
|
|
1023
|
+
ctx.fillStyle = gradient;
|
|
1024
|
+
ctx.fillRect(x - radius, y - radius, radius * 2, radius * 2);
|
|
1025
|
+
});
|
|
1026
|
+
|
|
1027
|
+
// Apply blur
|
|
1028
|
+
ctx.filter = 'blur(' + blur + 'px)';
|
|
1029
|
+
ctx.drawImage(canvas, 0, 0);
|
|
1030
|
+
ctx.filter = 'none';
|
|
1031
|
+
|
|
1032
|
+
// Colorize
|
|
1033
|
+
var imageData = ctx.getImageData(0, 0, width, height);
|
|
1034
|
+
var pixels = imageData.data;
|
|
1035
|
+
for (var i = 0; i < pixels.length; i += 4) {
|
|
1036
|
+
var alpha = pixels[i + 3];
|
|
1037
|
+
if (alpha > 0) {
|
|
1038
|
+
var ratio = alpha / 255;
|
|
1039
|
+
// Gradient: blue -> cyan -> green -> yellow -> red
|
|
1040
|
+
if (ratio < 0.25) {
|
|
1041
|
+
pixels[i] = 0;
|
|
1042
|
+
pixels[i + 1] = Math.round(ratio * 4 * 255);
|
|
1043
|
+
pixels[i + 2] = 255;
|
|
1044
|
+
}
|
|
1045
|
+
else if (ratio < 0.5) {
|
|
1046
|
+
pixels[i] = 0;
|
|
1047
|
+
pixels[i + 1] = 255;
|
|
1048
|
+
pixels[i + 2] = Math.round((1 - (ratio - 0.25) * 4) * 255);
|
|
1049
|
+
}
|
|
1050
|
+
else if (ratio < 0.75) {
|
|
1051
|
+
pixels[i] = Math.round((ratio - 0.5) * 4 * 255);
|
|
1052
|
+
pixels[i + 1] = 255;
|
|
1053
|
+
pixels[i + 2] = 0;
|
|
1054
|
+
}
|
|
1055
|
+
else {
|
|
1056
|
+
pixels[i] = 255;
|
|
1057
|
+
pixels[i + 1] = Math.round((1 - (ratio - 0.75) * 4) * 255);
|
|
1058
|
+
pixels[i + 2] = 0;
|
|
1059
|
+
}
|
|
1060
|
+
pixels[i + 3] = Math.round(alpha * maxOpacity);
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
ctx.putImageData(imageData, 0, 0);
|
|
1064
|
+
|
|
1065
|
+
return canvas;
|
|
1066
|
+
}
|
|
1067
|
+
};
|
|
1068
|
+
})();
|
|
1069
|
+
</script>
|
|
1070
|
+
`}function d3($,Z){let J=m3(Z);if(!J)return $;let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+J+$.slice(X);return $+J}var l3={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,J,X)=>{let Y=J.__stx_config||{};if(Z.length>0){let Q=MJ(Z.join(" "));Y.heatmap={...Y.heatmap,...Q,enabled:!0}}return m3(Y)}};function MJ($){let Z={},J=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let X of J){let[Y,Q]=X.split("="),G=Q?.replace(/["']/g,"");switch(Y){case"endpoint":Z.endpoint=G;break;case"samplingRate":Z.samplingRate=Number.parseInt(G,10);break;case"batchSize":Z.batchSize=Number.parseInt(G,10);break;case"trackMouse":Z.trackMouse=G==="true";break;case"trackClicks":Z.trackClicks=G==="true";break;case"trackScroll":Z.trackScroll=G==="true";break;case"honorDnt":Z.honorDnt=G==="true";break;case"debugOverlay":Z.debugOverlay=G==="true";break}}return Z}class c3{sessions=new Map;addSession($){let Z=this.sessions.get($.sid);if(Z)Z.points.push(...$.points),Z.lastActivity=Math.max(Z.lastActivity,$.lastActivity);else this.sessions.set($.sid,$)}getPageData($){let Z=[];for(let J of this.sessions.values())if(J.page===$)Z.push(...J.points);return Z}getClickData($){return this.getPageData($).filter((Z)=>Z.type==="click")}getMovementData($){return this.getPageData($).filter((Z)=>Z.type==="move")}getScrollData($){let Z=this.getPageData($).filter((X)=>X.type==="scroll"),J=new Map;for(let X of Z)if(X.depth!==void 0)J.set(X.depth,(J.get(X.depth)||0)+1);return Array.from(J.entries()).map(([X,Y])=>({depth:X,count:Y})).sort((X,Y)=>X.depth-Y.depth)}getZoneStats($){let Z=new Map,J=this.getPageData($);for(let X of J)if(X.zone){let Y=Z.get(X.zone)||{clicks:0,hovers:0};if(X.type==="click")Y.clicks++;else if(X.type==="move")Y.hovers++;Z.set(X.zone,Y)}return Z}generateGridData($,Z=20){let J=this.getPageData($),X=[];for(let Q=0;Q<Z;Q++){X[Q]=[];for(let G=0;G<Z;G++)X[Q][G]=0}for(let Q of J){let G=Math.min(Math.floor(Q.x/100*Z),Z-1),z=Math.min(Math.floor(Q.y/100*Z),Z-1);X[z][G]+=Q.type==="click"?3:1}let Y=0;for(let Q of X)for(let G of Q)Y=Math.max(Y,G);return X.map((Q,G)=>Q.map((z,K)=>({x:K,y:G,intensity:Y>0?z/Y:0})))}exportJSON(){return JSON.stringify({sessions:Array.from(this.sessions.values()),exportedAt:new Date().toISOString()},null,2)}clear(){this.sessions.clear()}get sessionCount(){return this.sessions.size}get totalPoints(){let $=0;for(let Z of this.sessions.values())$+=Z.points.length;return $}}function vq(){return new c3}var AJ;((G)=>{G.Fade="fade";G.Slide="slide";G.Scale="scale";G.Flip="flip";G.Rotate="rotate";G.Custom="custom"})(AJ||={});var IJ;((X)=>{X.In="in";X.Out="out";X.Both="both"})(IJ||={});var TJ;((G)=>{G.Linear="linear";G.Ease="ease";G.EaseIn="ease-in";G.EaseOut="ease-out";G.EaseInOut="ease-in-out";G.Spring="spring"})(TJ||={});var r0={duration:300,delay:0,ease:"ease",direction:"both"};function kJ($,Z={}){let{duration:J,delay:X,ease:Y,direction:Q,custom:G}={...r0,...Z};if($==="custom"&&G)return G;switch($){case"fade":return`${Q==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
|
|
1071
|
+
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
|
|
1072
|
+
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }`;case"slide":return`${Q==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="out"?"transform: translateY(0); opacity: 1; animation: slideOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: translateY(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
|
|
1073
|
+
@keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
|
|
1074
|
+
@keyframes slideOut { from { transform: translateY(0); opacity: 1; } to { transform: translateY(20px); opacity: 0; } }`;case"scale":return`${Q==="in"?"transform: scale(0.95); opacity: 0; animation: scaleIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="out"?"transform: scale(1); opacity: 1; animation: scaleOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: scale(1); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
|
|
1075
|
+
@keyframes scaleIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
|
|
1076
|
+
@keyframes scaleOut { from { transform: scale(1); opacity: 1; } to { transform: scale(0.95); opacity: 0; } }`;case"flip":return`${Q==="in"?"transform: perspective(400px) rotateX(-90deg); opacity: 0; animation: flipIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="out"?"transform: perspective(400px) rotateX(0); opacity: 1; animation: flipOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: perspective(400px) rotateX(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
|
|
1077
|
+
@keyframes flipIn { from { transform: perspective(400px) rotateX(-90deg); opacity: 0; } to { transform: perspective(400px) rotateX(0); opacity: 1; } }
|
|
1078
|
+
@keyframes flipOut { from { transform: perspective(400px) rotateX(0); opacity: 1; } to { transform: perspective(400px) rotateX(90deg); opacity: 0; } }`;case"rotate":return`${Q==="in"?"transform: rotate(-90deg); opacity: 0; animation: rotateIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="out"?"transform: rotate(0); opacity: 1; animation: rotateOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: rotate(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
|
|
1079
|
+
@keyframes rotateIn { from { transform: rotate(-90deg); opacity: 0; } to { transform: rotate(0); opacity: 1; } }
|
|
1080
|
+
@keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function EJ(){return`
|
|
1081
|
+
<script data-stx-scoped data-stx-run="once">
|
|
1082
|
+
// Motion preferences handling
|
|
1083
|
+
(function() {
|
|
1084
|
+
const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
1085
|
+
|
|
1086
|
+
if (prefersReducedMotion) {
|
|
1087
|
+
// Apply reduced motion settings
|
|
1088
|
+
document.documentElement.style.setProperty('--stx-transition-duration', '0ms');
|
|
1089
|
+
document.documentElement.setAttribute('data-reduced-motion', 'true');
|
|
1090
|
+
}
|
|
1091
|
+
else {
|
|
1092
|
+
document.documentElement.setAttribute('data-reduced-motion', 'false');
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
// Listen for changes in preference
|
|
1096
|
+
window.matchMedia('(prefers-reduced-motion: reduce)').addEventListener('change', (e) => {
|
|
1097
|
+
if (e.matches) {
|
|
1098
|
+
document.documentElement.style.setProperty('--stx-transition-duration', '0ms');
|
|
1099
|
+
document.documentElement.setAttribute('data-reduced-motion', 'true');
|
|
1100
|
+
}
|
|
1101
|
+
else {
|
|
1102
|
+
document.documentElement.style.setProperty('--stx-transition-duration', '');
|
|
1103
|
+
document.documentElement.setAttribute('data-reduced-motion', 'false');
|
|
1104
|
+
}
|
|
1105
|
+
});
|
|
1106
|
+
})();
|
|
1107
|
+
</script>
|
|
1108
|
+
`}function bJ($){return[/@animate\b/,/@transition\b/,/@scroll(?:Animate)?\b/,/@staggered\b/,/@sequence\b/,/@motion\b/,/@animationGroup\b/,/\bstx-transition\b/,/\bstx-(?:fade|scale|flip|rotate|slide|from-|observe)\b/,/data-animate=['"](?:auto|true|false)['"]/].some((J)=>J.test($))}function yJ($=0.1,Z="0px"){return`
|
|
1109
|
+
<script data-stx-scoped data-stx-run="always">
|
|
1110
|
+
// Intersection Observer for scroll animations
|
|
1111
|
+
(function() {
|
|
1112
|
+
const initObserver = () => {
|
|
1113
|
+
if (!('IntersectionObserver' in window)) {
|
|
1114
|
+
// For browsers that don't support IntersectionObserver, show all elements immediately
|
|
1115
|
+
const elements = document.querySelectorAll('.stx-observe');
|
|
1116
|
+
elements.forEach(el => el.classList.remove('stx-out'));
|
|
1117
|
+
return;
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
// Create the observer
|
|
1121
|
+
const options = {
|
|
1122
|
+
root: null, // Use viewport
|
|
1123
|
+
rootMargin: '${Z}',
|
|
1124
|
+
threshold: ${$}
|
|
1125
|
+
};
|
|
1126
|
+
|
|
1127
|
+
const observer = new IntersectionObserver((entries) => {
|
|
1128
|
+
entries.forEach(entry => {
|
|
1129
|
+
if (entry.isIntersecting) {
|
|
1130
|
+
entry.target.classList.remove('stx-out');
|
|
1131
|
+
// Stop observing after animation is triggered
|
|
1132
|
+
observer.unobserve(entry.target);
|
|
1133
|
+
}
|
|
1134
|
+
});
|
|
1135
|
+
}, options);
|
|
1136
|
+
|
|
1137
|
+
// Start observing elements
|
|
1138
|
+
const elements = document.querySelectorAll('.stx-observe');
|
|
1139
|
+
elements.forEach(el => observer.observe(el));
|
|
1140
|
+
};
|
|
1141
|
+
|
|
1142
|
+
// Initialize observer when DOM is ready
|
|
1143
|
+
if (document.readyState === 'loading') {
|
|
1144
|
+
document.addEventListener('DOMContentLoaded', initObserver);
|
|
1145
|
+
}
|
|
1146
|
+
else {
|
|
1147
|
+
initObserver();
|
|
1148
|
+
}
|
|
1149
|
+
})();
|
|
1150
|
+
</script>
|
|
1151
|
+
`}function CJ(){return`
|
|
1152
|
+
<style id="stx-animation-base">
|
|
1153
|
+
:root {
|
|
1154
|
+
--stx-transition-duration: 300ms;
|
|
1155
|
+
--stx-transition-delay: 0ms;
|
|
1156
|
+
--stx-transition-ease: ease;
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1160
|
+
:root {
|
|
1161
|
+
--stx-transition-duration: 0ms;
|
|
1162
|
+
}
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
[data-animate="false"] * {
|
|
1166
|
+
--stx-transition-duration: 0ms !important;
|
|
1167
|
+
animation-duration: 0ms !important;
|
|
1168
|
+
transition-duration: 0ms !important;
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
/* Base transition classes */
|
|
1172
|
+
.stx-transition {
|
|
1173
|
+
transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
|
|
1174
|
+
transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
|
|
1175
|
+
backface-visibility: hidden; /* Improve animation performance */
|
|
1176
|
+
transform-style: preserve-3d; /* Better 3D transforms */
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
/* Fade animations */
|
|
1180
|
+
.stx-fade {
|
|
1181
|
+
transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
.stx-fade.stx-out {
|
|
1185
|
+
opacity: 0 !important;
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
/* Scale animations */
|
|
1189
|
+
.stx-scale {
|
|
1190
|
+
transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
|
|
1191
|
+
opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
.stx-scale.stx-out {
|
|
1195
|
+
transform: scale(0.85) !important;
|
|
1196
|
+
opacity: 0 !important;
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
/* Flip animations */
|
|
1200
|
+
.stx-flip {
|
|
1201
|
+
transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
|
|
1202
|
+
opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
|
|
1203
|
+
perspective: 600px;
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
.stx-flip.stx-out {
|
|
1207
|
+
transform: perspective(600px) rotateX(-90deg) !important;
|
|
1208
|
+
opacity: 0 !important;
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
/* Rotate animations */
|
|
1212
|
+
.stx-rotate {
|
|
1213
|
+
transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
|
|
1214
|
+
opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
.stx-rotate.stx-out {
|
|
1218
|
+
transform: rotate(-90deg) !important;
|
|
1219
|
+
opacity: 0 !important;
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
/* Direction-based animations */
|
|
1223
|
+
.stx-from-left, .stx-from-right, .stx-from-top, .stx-from-bottom {
|
|
1224
|
+
transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
|
|
1225
|
+
opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1228
|
+
.stx-from-left.stx-out {
|
|
1229
|
+
transform: translateX(-30px) !important;
|
|
1230
|
+
opacity: 0 !important;
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
.stx-from-right.stx-out {
|
|
1234
|
+
transform: translateX(30px) !important;
|
|
1235
|
+
opacity: 0 !important;
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
.stx-from-top.stx-out {
|
|
1239
|
+
transform: translateY(-30px) !important;
|
|
1240
|
+
opacity: 0 !important;
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1243
|
+
.stx-from-bottom.stx-out {
|
|
1244
|
+
transform: translateY(30px) !important;
|
|
1245
|
+
opacity: 0 !important;
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
/* Generic slide animations */
|
|
1249
|
+
.stx-slide {
|
|
1250
|
+
transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
|
|
1251
|
+
opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
.stx-slide.stx-out {
|
|
1255
|
+
transform: translateY(30px) !important;
|
|
1256
|
+
opacity: 0 !important;
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1259
|
+
/* Scroll animation observer class */
|
|
1260
|
+
.stx-observe {
|
|
1261
|
+
will-change: opacity, transform;
|
|
1262
|
+
transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
|
|
1263
|
+
transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
|
|
1264
|
+
}
|
|
1265
|
+
</style>
|
|
1266
|
+
`}function SJ($,Z,J={}){let{staggerDelay:X=50,sequence:Y=!1}=J;return`
|
|
1267
|
+
<script data-stx-scoped data-stx-run="always">
|
|
1268
|
+
// Animation Group: ${$}
|
|
1269
|
+
(function() {
|
|
1270
|
+
const elements = ${JSON.stringify(Z)};
|
|
1271
|
+
const staggerDelay = ${X};
|
|
1272
|
+
const sequence = ${Y};
|
|
1273
|
+
|
|
1274
|
+
function animateGroup() {
|
|
1275
|
+
elements.forEach((selector, index) => {
|
|
1276
|
+
const element = document.querySelector(selector);
|
|
1277
|
+
if (!element) return;
|
|
1278
|
+
|
|
1279
|
+
const delay = sequence ? index * staggerDelay : 0;
|
|
1280
|
+
element.style.setProperty('--stx-transition-delay', delay + 'ms');
|
|
1281
|
+
|
|
1282
|
+
// For elements using animation keyframes
|
|
1283
|
+
element.style.animationDelay = delay + 'ms';
|
|
1284
|
+
|
|
1285
|
+
// If the element is initially hidden, show it
|
|
1286
|
+
if (element.classList.contains('stx-out')) {
|
|
1287
|
+
setTimeout(() => {
|
|
1288
|
+
element.classList.remove('stx-out');
|
|
1289
|
+
}, 10); // Small delay to ensure styles are applied
|
|
1290
|
+
}
|
|
1291
|
+
});
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
// Run when DOM is fully loaded
|
|
1295
|
+
if (document.readyState === 'loading') {
|
|
1296
|
+
document.addEventListener('DOMContentLoaded', animateGroup);
|
|
1297
|
+
}
|
|
1298
|
+
else {
|
|
1299
|
+
animateGroup();
|
|
1300
|
+
}
|
|
1301
|
+
})();
|
|
1302
|
+
</script>
|
|
1303
|
+
`}var Q5={name:"transition",handler:($,Z,J,X)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let Y=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||r0.duration:r0.duration,G=Z.length>2?Z[2]||r0.ease:r0.ease,z=Z.length>3?Number.parseInt(Z[3],10)||r0.delay:r0.delay,K=Z.length>4?Z[4]||r0.direction:r0.direction,q=`stx-transition-${Math.random().toString(36).substr(2,9)}`,W=kJ(Y,{duration:Q,delay:z,ease:G,direction:K}),U="stx-transition",H="";if(Y==="fade")H="stx-fade";else if(Y==="slide")H="stx-slide";else if(Y==="scale")H="stx-scale";else if(Y==="flip")H="stx-flip";else if(Y==="rotate")H="stx-rotate";return`<div id="${q}" class="${U} ${H} ${K==="out"?"stx-out":""}"
|
|
1304
|
+
style="--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${z}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},G5={name:"scrollAnimate",handler:($,Z,J,X)=>{if(Z.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let Y=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||300:300,G=Z.length>2?Z[2]||"ease":"ease",z=Z.length>3?Number.parseFloat(Z[3])||0.2:0.2,K=Z.length>4?Number.parseInt(Z[4],10)||0:0,q=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,W=`--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${K}ms; will-change: opacity, transform;`,U="stx-transition stx-observe stx-out";if(Y==="fade")U+=" stx-fade";else if(Y==="slide-up"||Y==="slide")U+=" stx-from-bottom";else if(Y==="slide-down")U+=" stx-from-top";else if(Y==="slide-left")U+=" stx-from-right";else if(Y==="slide-right")U+=" stx-from-left";else if(Y==="scale")U+=" stx-scale";else if(Y.includes("-"))U+=` stx-${Y}`;else U+=` stx-${Y}`;return`<div id="${q}" class="${U}" style="${W}" data-threshold="${z}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},z5={name:"animationGroup",handler:($,Z,J,X)=>{if(Z.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let Y=Z[0],Q=Z.slice(1).map((q)=>q.startsWith("#")||q.startsWith(".")?q:`#${q}`),G=J.staggerDelay||50,z=J.sequence||!0,K=SJ(Y,Q,{staggerDelay:G,sequence:z});return`${$}
|
|
1305
|
+
${K}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},K5={name:"motion",handler:($,Z,J,X)=>{let Y=Z.length>0?Z[0].toLowerCase()==="true":!0,Q=EJ();return`<div data-animate="${Y?"auto":"true"}">${$}</div>${Q}`},hasEndTag:!0,description:"Controls motion and animation preferences"};function i3($,Z,J,X){let Y=$;if(X.animation?.enabled===!1)return Y;let Q=J.includes("test")&&J.includes("animation");if(!bJ(Y)&&!Q)return Y;if(!Y.includes('<style id="stx-animation-base">')){let z=CJ();Y=Y.replace("</head>",`${z}
|
|
1306
|
+
</head>`)}if(Y.includes("stx-observe")){if(!Y.includes("Intersection Observer for scroll animations")){let K=yJ(),q=Y.lastIndexOf("</body>");if(q!==-1)Y=Y.slice(0,q)+K+`
|
|
1307
|
+
`+Y.slice(q)}}return Y}var p3={default:{stiffness:100,damping:10,mass:1},gentle:{stiffness:120,damping:14,mass:1},wobbly:{stiffness:180,damping:12,mass:1},stiff:{stiffness:210,damping:20,mass:1},slow:{stiffness:280,damping:60,mass:1},molasses:{stiffness:280,damping:120,mass:1}};function PJ($,Z){let J=Z.map((X)=>{let Y=X.offset!==void 0?`${X.offset*100}%`:"from",Q=Object.entries(X.properties).map(([G,z])=>`${G}: ${z}`).join("; ");return`${Y} { ${Q} }`}).join(`
|
|
1308
|
+
`);return`@keyframes ${$} {
|
|
1309
|
+
${J}
|
|
1310
|
+
}`}var vJ={name:"keyframe",hasEndTag:!0,handler:($,Z,J,X)=>{if(Z.length<1)return`<div class="stx-error">@keyframe requires an animation name</div>${$}`;let Y=Z[0].replace(/['"`]/g,""),Q=Z[1]?Number.parseInt(Z[1],10):1000,G=Z[2]?.replace(/['"`]/g,"")||"ease",z=Z[3]||"1",K=Z[4]?.replace(/['"`]/g,"")||"normal",q=Z[5]?.replace(/['"`]/g,"")||"forwards",W=`stx-keyframe-${Math.random().toString(36).slice(2,9)}`,U=`
|
|
1311
|
+
animation-name: ${Y};
|
|
1312
|
+
animation-duration: ${Q}ms;
|
|
1313
|
+
animation-timing-function: ${G};
|
|
1314
|
+
animation-iteration-count: ${z};
|
|
1315
|
+
animation-direction: ${K};
|
|
1316
|
+
animation-fill-mode: ${q};
|
|
1317
|
+
`.trim().replace(/\s+/g," ");return`<div id="${W}" style="${U}">${$}</div>`},description:"Applies a keyframe animation to an element"};function fJ($,Z,J,X,Y){return`
|
|
1318
|
+
<script data-stx-scoped data-stx-run="always">
|
|
1319
|
+
(function() {
|
|
1320
|
+
const container = document.getElementById('${$}');
|
|
1321
|
+
if (!container) return;
|
|
1322
|
+
|
|
1323
|
+
const children = container.querySelectorAll('${Z}');
|
|
1324
|
+
children.forEach((child, index) => {
|
|
1325
|
+
const delay = ${J} + (index * ${X});
|
|
1326
|
+
child.style.setProperty('--stx-stagger-delay', delay + 'ms');
|
|
1327
|
+
child.style.animationDelay = delay + 'ms';
|
|
1328
|
+
child.classList.add('${Y}');
|
|
1329
|
+
});
|
|
1330
|
+
})();
|
|
1331
|
+
</script>`}var xJ={name:"stagger",hasEndTag:!0,handler:($,Z,J,X)=>{let Y=Z[0]?.replace(/['"`]/g,"")||"> *",Q=Z[1]?Number.parseInt(Z[1],10):100,G=Z[2]?Number.parseInt(Z[2],10):0,z=Z[3]?.replace(/['"`]/g,"")||"fade",K=`stx-stagger-${Math.random().toString(36).slice(2,9)}`,q="stx-stagger-item";if(z==="fade")q+=" stx-fade";else if(z==="slide")q+=" stx-from-bottom";else if(z==="scale")q+=" stx-scale";let W=fJ(K,Y,G,Q,q);return`${`
|
|
1332
|
+
<style>
|
|
1333
|
+
#${K} .stx-stagger-item {
|
|
1334
|
+
opacity: 0;
|
|
1335
|
+
animation: staggerIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-stagger-delay, 0ms) forwards;
|
|
1336
|
+
}
|
|
1337
|
+
@keyframes staggerIn {
|
|
1338
|
+
from { opacity: 0; transform: translateY(10px); }
|
|
1339
|
+
to { opacity: 1; transform: translateY(0); }
|
|
1340
|
+
}
|
|
1341
|
+
</style>`}<div id="${K}" class="stx-stagger-container">${$}</div>${W}`},description:"Applies staggered animations to child elements"};function gJ($){let{stiffness:Z,damping:J}=$,X=J/(2*Math.sqrt(Z));if(X<0.5)return"cubic-bezier(0.175, 0.885, 0.32, 1.275)";else if(X<1)return"cubic-bezier(0.34, 1.56, 0.64, 1)";else return"cubic-bezier(0.25, 0.1, 0.25, 1)"}var hJ={name:"spring",hasEndTag:!0,handler:($,Z,J,X)=>{let Y=Z[0]?.replace(/['"`]/g,"")||"default",Q;if(p3[Y])Q=p3[Y];else Q={stiffness:Number.parseInt(Y,10)||100,damping:Z[1]?Number.parseInt(Z[1],10):10,mass:Z[2]?Number.parseFloat(Z[2]):1};let G=Z[3]?Number.parseInt(Z[3],10):500,z=`stx-spring-${Math.random().toString(36).slice(2,9)}`,K=gJ(Q),q=`
|
|
1342
|
+
transition: all ${G}ms ${K};
|
|
1343
|
+
--stx-spring-stiffness: ${Q.stiffness};
|
|
1344
|
+
--stx-spring-damping: ${Q.damping};
|
|
1345
|
+
--stx-spring-mass: ${Q.mass};
|
|
1346
|
+
`.trim().replace(/\s+/g," ");return`<div id="${z}" class="stx-spring" style="${q}">${$}</div>`},description:"Applies spring physics animations to an element"};function xq($){let Z=`stx-timeline-${Math.random().toString(36).slice(2,9)}`;return`
|
|
1347
|
+
<script data-stx-scoped data-stx-run="always">
|
|
1348
|
+
(function() {
|
|
1349
|
+
const timeline = ${JSON.stringify($)};
|
|
1350
|
+
|
|
1351
|
+
function runTimeline() {
|
|
1352
|
+
timeline.forEach((entry, index) => {
|
|
1353
|
+
const element = document.querySelector(entry.selector);
|
|
1354
|
+
if (!element) return;
|
|
1355
|
+
|
|
1356
|
+
const keyframes = entry.keyframes.map(kf => {
|
|
1357
|
+
const frame = { ...kf.properties };
|
|
1358
|
+
if (kf.offset !== undefined) frame.offset = kf.offset;
|
|
1359
|
+
if (kf.easing) frame.easing = kf.easing;
|
|
1360
|
+
return frame;
|
|
1361
|
+
});
|
|
1362
|
+
|
|
1363
|
+
const options = {
|
|
1364
|
+
duration: entry.options.duration || 1000,
|
|
1365
|
+
delay: entry.options.delay || 0,
|
|
1366
|
+
easing: entry.options.easing || 'ease',
|
|
1367
|
+
iterations: entry.options.iterations || 1,
|
|
1368
|
+
direction: entry.options.direction || 'normal',
|
|
1369
|
+
fill: entry.options.fill || 'forwards'
|
|
1370
|
+
};
|
|
1371
|
+
|
|
1372
|
+
element.animate(keyframes, options);
|
|
1373
|
+
});
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
if (document.readyState === 'loading') {
|
|
1377
|
+
document.addEventListener('DOMContentLoaded', runTimeline);
|
|
1378
|
+
}
|
|
1379
|
+
else {
|
|
1380
|
+
runTimeline();
|
|
1381
|
+
}
|
|
1382
|
+
})();
|
|
1383
|
+
</script>`}function gq($,Z,J){let X=PJ($,Z),Y=`
|
|
1384
|
+
.${$}-animation {
|
|
1385
|
+
animation-name: ${$};
|
|
1386
|
+
animation-duration: ${J.duration}ms;
|
|
1387
|
+
animation-timing-function: ${J.easing||"ease"};
|
|
1388
|
+
animation-delay: ${J.delay||0}ms;
|
|
1389
|
+
animation-iteration-count: ${J.iterations==="infinite"?"infinite":J.iterations||1};
|
|
1390
|
+
animation-direction: ${J.direction||"normal"};
|
|
1391
|
+
animation-fill-mode: ${J.fill||"forwards"};
|
|
1392
|
+
}`;return`${X}
|
|
1393
|
+
${Y}`}function hq($){let Z=$.trim().split(/\s+/),J={duration:300};for(let X=0;X<Z.length;X++){let Y=Z[X];if(/^\d+(?:ms|s)?$/.test(Y)){let Q=Number.parseInt(Y,10);if(X===0)J.duration=Y.endsWith("s")&&!Y.endsWith("ms")?Q*1000:Q;else J.delay=Y.endsWith("s")&&!Y.endsWith("ms")?Q*1000:Q}else if(Y==="infinite"||/^\d+$/.test(Y))J.iterations=Y==="infinite"?"infinite":Number.parseInt(Y,10);else if(["normal","reverse","alternate","alternate-reverse"].includes(Y))J.direction=Y;else if(["none","forwards","backwards","both"].includes(Y))J.fill=Y;else J.easing=Y}return J}function uq(){return`
|
|
1394
|
+
<script data-stx-scoped data-stx-run="once">
|
|
1395
|
+
window.__stxAnimation = {
|
|
1396
|
+
// Registry of animations
|
|
1397
|
+
animations: new Map(),
|
|
1398
|
+
|
|
1399
|
+
// Register a reusable animation
|
|
1400
|
+
register(name, keyframes, options) {
|
|
1401
|
+
this.animations.set(name, { keyframes, options });
|
|
1402
|
+
},
|
|
1403
|
+
|
|
1404
|
+
// Run an animation on an element
|
|
1405
|
+
animate(element, nameOrKeyframes, options = {}) {
|
|
1406
|
+
if (typeof element === 'string') {
|
|
1407
|
+
element = document.querySelector(element);
|
|
1408
|
+
}
|
|
1409
|
+
if (!element) return null;
|
|
1410
|
+
|
|
1411
|
+
let keyframes, defaultOptions;
|
|
1412
|
+
|
|
1413
|
+
if (typeof nameOrKeyframes === 'string' && this.animations.has(nameOrKeyframes)) {
|
|
1414
|
+
const registered = this.animations.get(nameOrKeyframes);
|
|
1415
|
+
keyframes = registered.keyframes;
|
|
1416
|
+
defaultOptions = registered.options;
|
|
1417
|
+
}
|
|
1418
|
+
else {
|
|
1419
|
+
keyframes = nameOrKeyframes;
|
|
1420
|
+
defaultOptions = {};
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1423
|
+
const finalOptions = { ...defaultOptions, ...options };
|
|
1424
|
+
return element.animate(keyframes, finalOptions);
|
|
1425
|
+
},
|
|
1426
|
+
|
|
1427
|
+
// Animate multiple elements with stagger
|
|
1428
|
+
stagger(elements, keyframes, options = {}, staggerDelay = 100) {
|
|
1429
|
+
if (typeof elements === 'string') {
|
|
1430
|
+
elements = document.querySelectorAll(elements);
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1433
|
+
const animations = [];
|
|
1434
|
+
Array.from(elements).forEach((el, index) => {
|
|
1435
|
+
const elementOptions = {
|
|
1436
|
+
...options,
|
|
1437
|
+
delay: (options.delay || 0) + (index * staggerDelay)
|
|
1438
|
+
};
|
|
1439
|
+
animations.push(this.animate(el, keyframes, elementOptions));
|
|
1440
|
+
});
|
|
1441
|
+
|
|
1442
|
+
return animations;
|
|
1443
|
+
},
|
|
1444
|
+
|
|
1445
|
+
// Chain animations sequentially
|
|
1446
|
+
async sequence(steps) {
|
|
1447
|
+
for (const step of steps) {
|
|
1448
|
+
const animation = this.animate(step.element, step.keyframes, step.options);
|
|
1449
|
+
if (animation) {
|
|
1450
|
+
await animation.finished;
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
},
|
|
1454
|
+
|
|
1455
|
+
// Run animations in parallel
|
|
1456
|
+
parallel(steps) {
|
|
1457
|
+
return Promise.all(
|
|
1458
|
+
steps.map(step => {
|
|
1459
|
+
const animation = this.animate(step.element, step.keyframes, step.options);
|
|
1460
|
+
return animation ? animation.finished : Promise.resolve();
|
|
1461
|
+
})
|
|
1462
|
+
);
|
|
1463
|
+
}
|
|
1464
|
+
};
|
|
1465
|
+
</script>`}function mq($){let Z=$.customDirectives||[];return Z.push(Q5),Z.push(z5),Z.push(K5),Z.push(G5),Z.push(vJ),Z.push(xJ),Z.push(hJ),{...$,customDirectives:Z}}function n3($){let Z=$.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!Z)return null;try{return Function(`return ${Z[1]}`)()}catch{return null}}function o3($){let Z=$?.layout;if(Z===!1)return!1;return typeof Z==="string"&&Z.trim()?Z.trim():void 0}var uJ=100,mJ=599,W5="__stxResponseStatus",q2="__stxResponseHeaders";function o2($){return typeof $==="number"&&Number.isInteger($)&&$>=uJ&&$<=mJ}function pq($){for(let Z of $.matchAll(/\bdefinePageMeta\s*\(\s*\{([\s\S]*?)\}\s*\)/g)){let J=Z[1].match(/(?:^|,)\s*status\s*:\s*(\d{3})(?=\s*(?:,|$))/);if(!J)continue;let X=Number(J[1]);if(o2(X))return X}return}function q5($,Z){if(!$||typeof $!=="object")return!1;let J=typeof Z==="string"&&/^\d+$/.test(Z.trim())?Number(Z.trim()):Z;if(!o2(J))return!1;return $[W5]=J,!0}function dJ($,Z,J){if(!$||typeof $!=="object")return;let X=String(Z??"").trim();if(!X)return;$[q2]={...$[q2],[X]:String(J)}}function lJ($){let Z=$?.[W5];return o2(Z)?Z:void 0}function cJ($){let Z=$?.[q2];if(!Z||typeof Z!=="object")return;let J=Object.entries(Z).map(([X,Y])=>[X,String(Y)]);return J.length>0?Object.fromEntries(J):void 0}function iq($,Z){if(!$||!Z||$===Z||typeof Z!=="object")return;let J=lJ($);if(J!==void 0)Z[W5]=J;let X=cJ($);if(X)Z[q2]={...Z[q2],...X}}function s3($){return{setResponseStatus:(Z)=>{q5($,Z)},notFound:(Z=404)=>{let J=o2(Z)&&Z>=400?Z:404;q5($,J)},setResponseHeader:(Z,J)=>{dJ($,Z,J)}}}function r3($,Z,J={}){if(!$.includes("@status"))return $;let{filePath:X,buildMode:Y}=J,Q=Y==="compile",G="",z=0,K=/@status\s*\(/g,q;while((q=K.exec($))!==null){let W=pJ($,q.index+q[0].length-1);if(W<0)break;let U=$.slice(q.index+q[0].length,W).trim(),H=/^\d+$/.test(U)?Number(U):Q0(U,Z),j=X?` in ${X}`:"";if(Q)console.warn(`[stx] @status(${U})${j} is skipped when precompiling: the build has no request, so the branch it sits in is not the one a visitor will get. Call notFound() or setResponseStatus(${U}) from <script server> instead \u2014 that runs per request.`);else if(!q5(Z,H))console.warn(`[stx] @status(${U})${j} is not an HTTP status (100-599) \u2014 ignoring it.`);G+=$.slice(z,q.index),z=W+1+($.slice(W+1).match(/^[^\S\n]*\n?/)?.[0].length??0),K.lastIndex=z}return z===0?$:G+$.slice(z)}function pJ($,Z){let J=1,X=null,Y=!1;for(let Q=Z+1;Q<$.length;Q++){let G=$[Q];if(Y){Y=!1;continue}if(X){if(G==="\\")Y=!0;else if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="(")J++;else if(G===")"&&--J===0)return Q}return-1}var iJ=0,nJ=0;function a3($,Z){let J=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(J)return J[1];let X=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(X)return X[1];return null}function oJ($){let Z=[],J=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,X;while((X=J.exec($))!==null){let[Y,Q,G]=X,z=X.index,K=a3(G,"x-data");if(!K)continue;let q=`__stx_scope_${iJ++}`,W=a3(G,"x-init"),U=sJ($,Q,z+Y.length),H=$.slice(z,U.endIndex),j=rJ(H);Z.push({id:q,selector:`[data-stx-scope="${q}"]`,stateExpr:K,initExpr:W,bindings:[],refs:j})}return Z}function sJ($,Z,J){let X=1,Y=J,Q=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),z=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(X>0&&Y<$.length){Q.lastIndex=Y,G.lastIndex=Y,z.lastIndex=Y;let K=Q.exec($),q=G.exec($),W=z.exec($);if(W&&W.index<(K?.index??1/0)){Y=W.index+W[0].length;continue}if(!q)return{endIndex:$.length};if(K&&K.index<q.index)X++,Y=K.index+K[0].length;else{if(X--,X===0)return{endIndex:q.index+q[0].length};Y=q.index+q[0].length}}return{endIndex:$.length}}function rJ($){let Z=new Map,J=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),X=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,Y;while((Y=X.exec(J))!==null){let[,Q,G]=Y,z=aJ(Q);Z.set(G,z)}return Z}function aJ($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${nJ++}`}function tJ(){return`
|
|
1466
|
+
// STX Reactive Runtime - x-cloak and transition CSS
|
|
1467
|
+
(function() {
|
|
1468
|
+
var style = document.createElement('style');
|
|
1469
|
+
style.textContent = [
|
|
1470
|
+
'[x-cloak] { display: none !important; }',
|
|
1471
|
+
// Default transition classes
|
|
1472
|
+
'.stx-enter { opacity: 0; transform: scale(0.95); }',
|
|
1473
|
+
'.stx-enter-start { opacity: 0; transform: scale(0.95); }',
|
|
1474
|
+
'.stx-enter-active { transition: opacity 150ms ease-out, transform 150ms ease-out; }',
|
|
1475
|
+
'.stx-enter-to { opacity: 1; transform: scale(1); }',
|
|
1476
|
+
'.stx-leave { opacity: 1; transform: scale(1); }',
|
|
1477
|
+
'.stx-leave-start { opacity: 1; transform: scale(1); }',
|
|
1478
|
+
'.stx-leave-active { transition: opacity 100ms ease-in, transform 100ms ease-in; }',
|
|
1479
|
+
'.stx-leave-to { opacity: 0; transform: scale(0.95); }'
|
|
1480
|
+
].join('\\n');
|
|
1481
|
+
document.head.appendChild(style);
|
|
1482
|
+
})();
|
|
1483
|
+
|
|
1484
|
+
// STX Reactive Runtime
|
|
1485
|
+
/* eslint-disable pickier/no-unused-vars, no-console, prefer-const */
|
|
1486
|
+
window.__stx_reactive = (function() {
|
|
1487
|
+
'use strict';
|
|
1488
|
+
|
|
1489
|
+
// Deep reactive proxy that triggers onChange for any mutation
|
|
1490
|
+
function reactive(obj, onChange) {
|
|
1491
|
+
if (!obj || typeof obj !== 'object') return obj;
|
|
1492
|
+
return new Proxy(obj, {
|
|
1493
|
+
get(target, prop) {
|
|
1494
|
+
const value = target[prop];
|
|
1495
|
+
if (value && typeof value === 'object' && !Array.isArray(value) && !(value instanceof Promise)) {
|
|
1496
|
+
return reactive(value, onChange);
|
|
1497
|
+
}
|
|
1498
|
+
return value;
|
|
1499
|
+
},
|
|
1500
|
+
set(target, prop, value) {
|
|
1501
|
+
target[prop] = value;
|
|
1502
|
+
onChange(prop, value);
|
|
1503
|
+
return true;
|
|
1504
|
+
}
|
|
1505
|
+
});
|
|
1506
|
+
}
|
|
1507
|
+
|
|
1508
|
+
// Initialize an x-data scope: parse state, run init(), register into window.stx._scopes,
|
|
1509
|
+
// then let the signals runtime handle all directive processing (x-for, x-text, :bind, etc.)
|
|
1510
|
+
function initScope(scopeEl, initialState, bindings, refs, initExpr) {
|
|
1511
|
+
// Parse initial state (may contain methods including async init())
|
|
1512
|
+
var state;
|
|
1513
|
+
try {
|
|
1514
|
+
state = new Function('return (' + initialState + ')')();
|
|
1515
|
+
} catch (e) {
|
|
1516
|
+
console.error('[stx-reactive] Invalid x-data:', initialState, e);
|
|
1517
|
+
return;
|
|
1518
|
+
}
|
|
1519
|
+
|
|
1520
|
+
// Build $refs object
|
|
1521
|
+
var $refs = {};
|
|
1522
|
+
for (var name in refs) {
|
|
1523
|
+
if (Object.prototype.hasOwnProperty.call(refs, name)) {
|
|
1524
|
+
(function(refName, refId) {
|
|
1525
|
+
Object.defineProperty($refs, refName, {
|
|
1526
|
+
get: function() { return document.getElementById(refId); }
|
|
1527
|
+
});
|
|
1528
|
+
})(name, refs[name]);
|
|
1529
|
+
}
|
|
1530
|
+
}
|
|
1531
|
+
|
|
1532
|
+
// Extract init method from state if present (Alpine.js convention)
|
|
1533
|
+
var initMethod = state.init;
|
|
1534
|
+
if (typeof initMethod === 'function') {
|
|
1535
|
+
delete state.init;
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
// Make state reactive \u2014 mutations trigger re-render via signals
|
|
1539
|
+
var scopeId = scopeEl.getAttribute('data-stx-scope');
|
|
1540
|
+
var stx = window.stx;
|
|
1541
|
+
|
|
1542
|
+
// Create signals for each state property so the signals runtime can track dependencies
|
|
1543
|
+
var signalState = {};
|
|
1544
|
+
var rawState = {};
|
|
1545
|
+
for (var key in state) {
|
|
1546
|
+
if (Object.prototype.hasOwnProperty.call(state, key)) {
|
|
1547
|
+
if (typeof state[key] === 'function') {
|
|
1548
|
+
// Methods \u2014 bind to a proxy so 'this.prop = val' triggers signal updates
|
|
1549
|
+
signalState[key] = state[key];
|
|
1550
|
+
} else {
|
|
1551
|
+
// Data properties \u2014 wrap in signals for reactivity
|
|
1552
|
+
signalState[key] = stx.state(state[key]);
|
|
1553
|
+
rawState[key] = true;
|
|
1554
|
+
}
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1558
|
+
// Create a proxy context that auto-unwraps signals and writes back through them.
|
|
1559
|
+
// Methods get 'this' bound to this proxy so this.foo = bar triggers reactivity.
|
|
1560
|
+
var ctx = {};
|
|
1561
|
+
var ctxProxy = new Proxy(ctx, {
|
|
1562
|
+
get: function(target, prop) {
|
|
1563
|
+
if (prop === '$refs') return $refs;
|
|
1564
|
+
if (prop === '$el') return scopeEl;
|
|
1565
|
+
if (prop === '$nextTick') return function(fn) { requestAnimationFrame(fn); };
|
|
1566
|
+
var s = signalState[prop];
|
|
1567
|
+
if (!s) return undefined;
|
|
1568
|
+
if (rawState[prop] && s && typeof s === 'function' && typeof s.value !== 'undefined') {
|
|
1569
|
+
return s.value; // unwrap signal
|
|
1570
|
+
}
|
|
1571
|
+
if (typeof s === 'function' && !rawState[prop]) {
|
|
1572
|
+
return s.bind(ctxProxy); // bind methods to proxy
|
|
1573
|
+
}
|
|
1574
|
+
return s;
|
|
1575
|
+
},
|
|
1576
|
+
set: function(target, prop, value) {
|
|
1577
|
+
var s = signalState[prop];
|
|
1578
|
+
if (rawState[prop] && s && typeof s === 'function') {
|
|
1579
|
+
s.value = value; // write through signal \u2014 triggers effects
|
|
1580
|
+
} else {
|
|
1581
|
+
signalState[prop] = value;
|
|
1582
|
+
}
|
|
1583
|
+
return true;
|
|
1584
|
+
},
|
|
1585
|
+
has: function(target, prop) {
|
|
1586
|
+
return prop in signalState || prop === '$refs' || prop === '$el' || prop === '$nextTick';
|
|
1587
|
+
},
|
|
1588
|
+
ownKeys: function() {
|
|
1589
|
+
return Object.keys(signalState).concat(['$refs', '$el', '$nextTick']);
|
|
1590
|
+
},
|
|
1591
|
+
getOwnPropertyDescriptor: function(target, prop) {
|
|
1592
|
+
if (prop in signalState || prop === '$refs' || prop === '$el' || prop === '$nextTick') {
|
|
1593
|
+
return { configurable: true, enumerable: true, writable: true, value: ctxProxy[prop] };
|
|
1594
|
+
}
|
|
1595
|
+
return undefined;
|
|
1596
|
+
}
|
|
1597
|
+
});
|
|
1598
|
+
|
|
1599
|
+
// Build scope vars for the signals runtime \u2014 it reads these for expression evaluation.
|
|
1600
|
+
// We need to provide getter/setter descriptors so signals track properly.
|
|
1601
|
+
var scopeVars = {};
|
|
1602
|
+
for (var k in signalState) {
|
|
1603
|
+
if (Object.prototype.hasOwnProperty.call(signalState, k)) {
|
|
1604
|
+
if (rawState[k]) {
|
|
1605
|
+
// Data: expose the signal directly so expressions trigger dependency tracking
|
|
1606
|
+
scopeVars[k] = signalState[k];
|
|
1607
|
+
} else {
|
|
1608
|
+
// Method: bind to ctxProxy so 'this' works
|
|
1609
|
+
scopeVars[k] = (typeof signalState[k] === 'function') ? signalState[k].bind(ctxProxy) : signalState[k];
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
scopeVars.$refs = $refs;
|
|
1614
|
+
scopeVars.$el = scopeEl;
|
|
1615
|
+
scopeVars.$nextTick = function(fn) { requestAnimationFrame(fn); };
|
|
1616
|
+
|
|
1617
|
+
// Register scope \u2014 merge with any existing vars from partial signal scripts
|
|
1618
|
+
if (!stx._scopes) stx._scopes = {};
|
|
1619
|
+
stx._scopes[scopeId] = Object.assign(stx._scopes[scopeId] || {}, scopeVars);
|
|
1620
|
+
|
|
1621
|
+
// Store on element for findElementScope
|
|
1622
|
+
scopeEl.__stx_scope = scopeVars;
|
|
1623
|
+
|
|
1624
|
+
// Run init() if present (supports async)
|
|
1625
|
+
function runInit() {
|
|
1626
|
+
var maybePromise;
|
|
1627
|
+
if (initMethod) {
|
|
1628
|
+
maybePromise = initMethod.call(ctxProxy);
|
|
1629
|
+
}
|
|
1630
|
+
if (initExpr) {
|
|
1631
|
+
try {
|
|
1632
|
+
var keys = Object.keys(scopeVars);
|
|
1633
|
+
var vals = keys.map(function(k) { return scopeVars[k]; });
|
|
1634
|
+
var fn = new Function(keys.join(','), initExpr);
|
|
1635
|
+
var result = fn.apply(ctxProxy, vals);
|
|
1636
|
+
if (result && typeof result.then === 'function') maybePromise = result;
|
|
1637
|
+
} catch (e) {
|
|
1638
|
+
console.warn('[stx-reactive] init expression error:', e);
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
// If init is async, signal updates will trigger effects automatically
|
|
1642
|
+
// when init() resolves and sets this.prop = value (writes through signal)
|
|
1643
|
+
if (maybePromise && typeof maybePromise.then === 'function') {
|
|
1644
|
+
maybePromise.catch(function(e) {
|
|
1645
|
+
console.error('[stx-reactive] async init() error:', e);
|
|
1646
|
+
});
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
|
|
1650
|
+
// Run init before the signals runtime processes this scope
|
|
1651
|
+
runInit();
|
|
1652
|
+
|
|
1653
|
+
// Expose for debugging
|
|
1654
|
+
scopeEl.__stx_state = ctxProxy;
|
|
1655
|
+
scopeEl.__stx_execute = function(stmt, $event, $el) {
|
|
1656
|
+
try {
|
|
1657
|
+
// Run the statement with the reactive proxy as the lexical scope.
|
|
1658
|
+
// Wrapping in a with-block on the proxy makes bare reads/writes go
|
|
1659
|
+
// through it (so foo = bar triggers signal.set()) instead of treating
|
|
1660
|
+
// each state key as a local function parameter \u2014 bare assignments
|
|
1661
|
+
// would otherwise just rebind the local and never reach the signal.
|
|
1662
|
+
var fn = new Function('$event', '$el', 'with(this){' + stmt + ';}');
|
|
1663
|
+
fn.call(ctxProxy, $event, $el);
|
|
1664
|
+
} catch (e) {
|
|
1665
|
+
console.warn('[stx-reactive] execute error:', e);
|
|
1666
|
+
}
|
|
1667
|
+
};
|
|
1668
|
+
}
|
|
1669
|
+
|
|
1670
|
+
return { initScope: initScope, reactive: reactive };
|
|
1671
|
+
})();
|
|
1672
|
+
`}function t3($,Z){let J=$.replace(/\{!!([\s\S]*?)!!\}/g,(z,K)=>{try{let q=f0(K,Z,!0);if(q===void 0)return z;return String(q)}catch{return z}}),X="",Y=0,Q=null;while(Y<J.length){let z=J[Y];if(Q&&z==="\\"){X+=z+(J[Y+1]??""),Y+=2;continue}if(z==="{"&&J[Y+1]==="{"){let K=J.indexOf("}}",Y+2);if(K!==-1){let q=J.slice(Y,K+2);X+=G(J.slice(Y+2,K),q,Q),Y=K+2;continue}}if(Q){if(z===Q)Q=null}else if(z==="'"||z==='"'||z==="`")Q=z;X+=z,Y++}return X;function G(z,K,q){let W;try{W=f0(z,Z,!0)}catch{return K}if(W===void 0)return K;if(q){let U=String(W).replace(/\\/g,"\\\\").replace(new RegExp(q==="`"?"`":q,"g"),`\\${q}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return q==="`"?U.replace(/\$\{/g,"\\${"):U}if(typeof W==="string"){let U=W.trim();if(U.startsWith("{")&&U.endsWith("}")||U.startsWith("[")&&U.endsWith("]"))try{return JSON.parse(U),U}catch{}}return JSON.stringify(W)}}function eJ($,Z){if($.length===0)return"";let J=$.map((X)=>{let Y=JSON.stringify(Object.fromEntries(X.refs)),Q=t3(X.stateExpr,Z),G=X.initExpr?t3(X.initExpr,Z):null,z=JSON.stringify(Q),K=G?JSON.stringify(G):"null";return`
|
|
1673
|
+
(function() {
|
|
1674
|
+
var scopeEl = document.querySelector('${X.selector}');
|
|
1675
|
+
if (!scopeEl) return;
|
|
1676
|
+
var refs = ${Y};
|
|
1677
|
+
__stx_reactive.initScope(scopeEl, ${z}, [], refs, ${K});
|
|
1678
|
+
})();`}).join(`
|
|
1679
|
+
`);return`
|
|
1680
|
+
<script data-stx-scoped data-stx-reactive data-stx-run="always">
|
|
1681
|
+
${tJ()}
|
|
1682
|
+
${J}
|
|
1683
|
+
</script>`}function e3($,Z,J){if(!ZX($))return $;let X=oJ($);if(X.length===0)return $;let Y=$X($,X),Q=eJ(X,Z),G=Y.lastIndexOf("</body>");if(G!==-1)Y=Y.slice(0,G)+Q+`
|
|
1684
|
+
`+Y.slice(G);else Y+=Q;return Y}function $X($,Z){let J=0,X=$.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(Y,Q,G)=>{let z=Z[J++];if(!z)return Y;let K=/data-stx-scope="([^"]*)"/.exec(G);if(K)return z.id=K[1],z.selector=`[data-stx-scope="${z.id}"]`,Y;return`<${Q} data-stx-scope="${z.id}"${G}>`});return X=X.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),X=X.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),X=X.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),X=X.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),X}function ZX($){return/x-data\s*=\s*["']/.test($)}import lX from"fs";import k5 from"path";import{createHighlighter as cX}from"ts-syntax-highlighter";import X9 from"fs";import S0 from"path";import{loadConfigWithResult as fX}from"bunfig";W2();async function JX($,Z,J,X){let Y=Z[0]?.replace(/['"]/g,"")||"main",Q=U5();if(Y!=="main")Q=Q.replace("container:'main'",`container:'${Y}'`);return`<script data-stx-router>${Q}</script>`}var $7={name:"stxRouter",handler:JX,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"};function X1($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Z7($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function J7($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,J=$.match(Z);if(!J)return{data:{},content:$.trim()};let X=J[1],Y=$.slice(J[0].length),Q={};for(let G of X.split(`
|
|
1685
|
+
`)){let z=G.trim();if(!z||z.startsWith("#"))continue;let K=z.indexOf(":");if(K===-1)continue;let q=z.slice(0,K).trim(),W=z.slice(K+1).trim();if(typeof W==="string"){if(W.startsWith('"')&&W.endsWith('"')||W.startsWith("'")&&W.endsWith("'"))W=W.slice(1,-1);else if(W.startsWith("[")&&W.endsWith("]"))try{W=JSON.parse(W)}catch{}else if(W==="true")W=!0;else if(W==="false")W=!1;else if(/^-?\d+(?:\.\d+)?$/.test(W))W=Number(W)}Q[q]=W}return{data:Q,content:Y.trim()}}function U2($,Z={}){let{gfm:J=!0,breaks:X=!1}=Z,Y=$,Q=[];if(Y=Y.replace(/```(\w*)\n([\s\S]*?)```/g,(W,U,H)=>{let j=Q.length,B=U?` class="language-${X1(U)}"`:"";return Q.push(`<pre><code${B}>${X1(H.trim())}</code></pre>`),`\x00CODEBLOCK${j}\x00`}),Y=Y.replace(/`([^`]*)`/g,(W,U)=>`<code>${X1(U)}</code>`),Y=Y.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),Y=Y.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),Y=Y.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),Y=Y.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),Y=Y.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),Y=Y.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),Y=Y.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),Y=Y.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),Y=Y.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),Y=Y.replace(/__(.+?)__/g,"<strong>$1</strong>"),Y=Y.replace(/\*(.+?)\*/g,"<em>$1</em>"),Y=Y.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),J)Y=Y.replace(/~~(.+?)~~/g,"<del>$1</del>");if(Y=Y.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(W,U,H)=>{return`<img src="${Z7(H)?X1(H):""}" alt="${X1(U)}" />`}),Y=Y.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(W,U,H)=>{return`<a href="${Z7(H)?X1(H):""}">${U}</a>`}),Y=Y.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),Y=Y.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),Y=Y.replace(/<\/blockquote>\n<blockquote>/g,`
|
|
1686
|
+
`),Y=Y.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),Y=Y.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),Y=Y.replace(/<\/ul>\n<ul>/g,""),Y=Y.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),Y=Y.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),Y=Y.replace(/<\/ol>\n<ol>/g,""),Y=Y.replace(/<li data-ul>/g,"<li>"),Y=Y.replace(/<li data-ol>/g,"<li>"),J)Y=Y.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(W,U,H)=>{let B=`<tr>${U.split("|").map((L)=>L.trim()).filter(Boolean).map((L)=>`<th>${X1(L)}</th>`).join("")}</tr>`,V=H.trim().split(`
|
|
1687
|
+
`).map((L)=>{return`<tr>${L.split("|").map((F)=>F.trim()).filter(Boolean).map((F)=>`<td>${X1(F)}</td>`).join("")}</tr>`}).join(`
|
|
1688
|
+
`);return`<table>
|
|
1689
|
+
<thead>
|
|
1690
|
+
${B}
|
|
1691
|
+
</thead>
|
|
1692
|
+
<tbody>
|
|
1693
|
+
${V}
|
|
1694
|
+
</tbody>
|
|
1695
|
+
</table>`});if(J)Y=Y.replace(/<li>\s*\[\s*\]\s*/g,'<li><input type="checkbox" disabled /> '),Y=Y.replace(/<li>\s*\[x\]\s*/gi,'<li><input type="checkbox" checked disabled /> ');let G=Y.split(`
|
|
1696
|
+
`),z=[],K=!1,q=[];for(let W of G){let U=W.trim();if(/^<(?:h[1-6]|ul|ol|li|blockquote|pre|table|thead|tbody|tr|th|td|hr|div|p)/.test(U)||/^\0CODEBLOCK\d+\0$/.test(U)||U===""){if(K&&q.length>0)z.push(`<p>${q.join(X?`<br />
|
|
1697
|
+
`:`
|
|
1698
|
+
`)}</p>`),q=[],K=!1;z.push(W)}else K=!0,q.push(U)}if(K&&q.length>0)z.push(`<p>${q.join(X?`<br />
|
|
1699
|
+
`:`
|
|
1700
|
+
`)}</p>`);if(Y=z.join(`
|
|
1701
|
+
`),X)Y=Y.replace(/\n/g,`<br />
|
|
1702
|
+
`);for(let W=0;W<Q.length;W++)Y=Y.replace(`\x00CODEBLOCK${W}\x00`,Q[W]);return Y=Y.replace(/<p>\s*<\/p>/g,""),Y.trim()}async function X7($,Z,J=""){let X=$,Y=[],Q=/@markdown(?:\([^)]*\))?/g,G;while((G=Q.exec($))!==null){let z=G.index,K=G[0].match(/@markdown\(([^)]*)\)/),q=K?K[1]:"",W=z+G[0].length,U=1,H=W,j=-1;while(U>0&&H<$.length){let L=$.indexOf("@markdown",H),_=$.indexOf("@endmarkdown",H);if(_===-1)break;if(L!==-1&&L<_&&L!==z){let F=$[L+9];if(F==="("||F===`
|
|
1703
|
+
`||F==="\r"||F===" "||F===void 0)U++;H=L+9}else{if(U--,U===0){j=_;break}H=_+12}}if(j===-1)continue;let B=$.slice(W,j),V=$.slice(z,j+12);Y.push({fullMatch:V,options:q,content:B,index:z}),Q.lastIndex=j+12}for(let{fullMatch:z,options:K,content:q,index:W}of Y)try{let U={};if(K)K.split(",").forEach((B)=>{let V=B.trim();if(V)U[V]=!0});let H={gfm:U.gfm??!0,breaks:U.breaks??!1},j=U2(q.trim(),H);X=X.split(z).join(j)}catch(U){let H=U instanceof Error?U.message:String(U),j=_0("Markdown Directive",`Error processing markdown: ${H}`,J,$,W,z);X=X.split(z).join(j)}return X}async function Y7($,Z,J,X){let Y={gfm:!0,breaks:!1};return Z.forEach((Q)=>{let G=Q.trim().replace(/['"]/g,"");if(G==="breaks")Y.breaks=!0;if(G==="no-gfm")Y.gfm=!1}),U2($.trim(),Y)}var V1=[320,480,640,768,1024,1280,1536,1920,2560],Q7=[1,1.5,2,3],P1=["avif","webp","jpeg"],G7={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"},XX={avif:"avif",webp:"webp",jpeg:"jpg",png:"png",gif:"gif"};function H2($,Z=V1,J={},X){return Z.sort((Y,Q)=>Y-Q).map((Y)=>{return`${Y1($,{...J,w:Y,fm:X})} ${Y}w`}).join(", ")}function QW($,Z=320,J=2560,X=0.08,Y={},Q){let G=YX(Z,J,X);return H2($,G,Y,Q)}function YX($,Z,J=0.08){let X=[],Y=$;while(Y<Z)X.push(Math.round(Y)),Y*=1+J*2;if(X[X.length-1]!==Z)X.push(Z);return X}function H5($,Z,J=Q7,X={},Y){return J.sort((Q,G)=>Q-G).map((Q)=>{let G=Math.round(Z*Q);return`${Y1($,{...X,w:G,dpr:Q,fm:Y})} ${Q}x`}).join(", ")}function GW($,Z,J=Q7,X=80,Y={},Q){let G={1:X,1.5:Math.round(X*0.9),2:Math.round(X*0.8),3:Math.round(X*0.7),4:Math.round(X*0.6),5:Math.round(X*0.5)};return J.sort((z,K)=>z-K).map((z)=>{let K=Math.round(Z*z),q=G[z]||Math.round(X*Math.max(0.5,1-z*0.1));return`${Y1($,{...Y,w:K,q,dpr:z,fm:Q})} ${z}x`}).join(", ")}function j5($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let X=Object.entries($).map(([Y,Q])=>{let G=/^\d+$/.test(Y)?`${Y}px`:Y;return{bp:G,size:Q,numericBp:Number.parseInt(G)||0}}).sort((Y,Q)=>Y.numericBp-Q.numericBp).map(({bp:Y,size:Q})=>`(max-width: ${Y}) ${Q}`);return X.push(Z),X.join(", ")}function zW($,Z="100vw"){if(!$||$.length===0)return Z;let X=[...$].sort((Y,Q)=>(Y.maxWidth||0)-(Q.maxWidth||0)).filter((Y)=>Y.maxWidth).map((Y)=>`(max-width: ${Y.maxWidth}px) ${Y.imageWidth}`);return X.push(Z),X.join(", ")}var KW={fullWidth:"100vw",halfDesktop:"(max-width: 768px) 100vw, 50vw",thirdDesktop:"(max-width: 768px) 100vw, 33.33vw",quarterDesktop:"(max-width: 480px) 100vw, (max-width: 768px) 50vw, 25vw",contentWidth:"(max-width: 768px) 100vw, (max-width: 1200px) 80vw, 960px"};function Y1($,Z={}){let J=Object.entries(Z).filter(([,Q])=>Q!==void 0&&Q!==null).map(([Q,G])=>{if(Array.isArray(G))return[Q,G.join(",")];return[Q,String(G)]});if(J.length===0)return $;let X=J.map(([Q,G])=>`${Q}=${encodeURIComponent(G)}`).join("&"),Y=$.includes("?")?"&":"?";return`${$}${Y}${X}`}function qW($){let[Z,J]=$.split("?"),X={};if(J)new URLSearchParams(J).forEach((Q,G)=>{if(/^\d+$/.test(Q))X[G]=Number.parseInt(Q,10);else if(/^\d+\.\d+$/.test(Q))X[G]=Number.parseFloat(Q);else if(Q==="true")X[G]=!0;else if(Q==="false")X[G]=!1;else X[G]=Q});return{src:Z,params:X}}function WW($){let{src:Z,widths:J,dprValues:X,fixedWidth:Y,formats:Q=P1,baseUrl:G="",params:z={}}=$,K=[];for(let q of Q){let W,U;if(Y!==void 0&&X)W=H5(Z,Y,X,z,q),U=X.map((H)=>({path:"",url:Y1(Z,{...z,w:Math.round(Y*H),fm:q}),width:Math.round(Y*H),height:0,format:q,size:0,dpr:H}));else{let H=J||V1;W=H2(Z,H,z,q),U=H.map((j)=>({path:"",url:Y1(Z,{...z,w:j,fm:q}),width:j,height:0,format:q,size:0}))}K.push({srcset:W,format:q,mimeType:G7[q],variants:U})}return K}function UW($,Z="100vw"){return $.map(({srcset:J,mimeType:X})=>`<source type="${X}" srcset="${J}" sizes="${Z}" />`).join(`
|
|
1704
|
+
`)}function HW($,Z){if($.length===0)return;let J=[...$].sort((Y,Q)=>Y.width-Q.width),X=J.find((Y)=>Y.width>=Z);if(X)return X;return J[J.length-1]}function B5($){return G7[$]||"application/octet-stream"}function jW($){return XX[$]||$}function BW($){switch($.split(".").pop()?.toLowerCase()){case"jpg":case"jpeg":return"jpeg";case"png":return"png";case"webp":return"webp";case"avif":return"avif";case"gif":return"gif";default:return}}var QX={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},V5=`
|
|
1705
|
+
.stx-img-placeholder {
|
|
1706
|
+
position: relative;
|
|
1707
|
+
overflow: hidden;
|
|
1708
|
+
background-size: cover;
|
|
1709
|
+
background-position: center;
|
|
1710
|
+
background-repeat: no-repeat;
|
|
1711
|
+
}
|
|
1712
|
+
|
|
1713
|
+
.stx-img-placeholder img {
|
|
1714
|
+
opacity: 0;
|
|
1715
|
+
transition: opacity var(--stx-img-transition-duration, 300ms) var(--stx-img-transition-easing, ease-out);
|
|
1716
|
+
}
|
|
1717
|
+
|
|
1718
|
+
.stx-img-placeholder.stx-img-loaded img {
|
|
1719
|
+
opacity: 1;
|
|
1720
|
+
}
|
|
1721
|
+
|
|
1722
|
+
.stx-img-blur {
|
|
1723
|
+
filter: blur(20px);
|
|
1724
|
+
transform: scale(1.1);
|
|
1725
|
+
transition: filter var(--stx-img-transition-duration, 300ms) var(--stx-img-transition-easing, ease-out),
|
|
1726
|
+
transform var(--stx-img-transition-duration, 300ms) var(--stx-img-transition-easing, ease-out);
|
|
1727
|
+
}
|
|
1728
|
+
|
|
1729
|
+
.stx-img-loaded .stx-img-blur {
|
|
1730
|
+
filter: blur(0);
|
|
1731
|
+
transform: scale(1);
|
|
1732
|
+
}
|
|
1733
|
+
`.trim();async function O5(){try{return await import("ts-images")}catch{return null}}async function z7($,Z={}){let J={...QX,...Z},X=await O5();if(X)try{return await GX($,J,X)}catch(Y){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Y}`)}return K7($,J)}async function GX($,Z,J){let{generatePlaceholder:X,generateThumbHash:Y}=J,G={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[Z.strategy]||"blur";if(Z.strategy==="thumbhash")return{dataURL:(await Y($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let z=await X($,{width:Z.width,height:Z.height,quality:Z.quality,blurLevel:Z.blurLevel,strategy:G,base64Encode:!0});return{dataURL:z.dataURL,width:z.width,height:z.height,aspectRatio:z.aspectRatio,originalWidth:z.originalWidth,originalHeight:z.originalHeight,strategy:Z.strategy,dominantColor:z.dominantColor,css:z.css}}function K7($,Z){let J=Z.width||20,X=Z.height||J,Y="#e5e7eb",Q=`<svg xmlns="http://www.w3.org/2000/svg" width="${J}" height="${X}" viewBox="0 0 ${J} ${X}"><rect fill="#e5e7eb" width="${J}" height="${X}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(Q)}`,width:J,height:X,aspectRatio:J/X,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}async function OW($){let Z=await O5();if(Z)try{return(await Z.generateThumbHash($)).dataUrl}catch{}return(await K7($,{strategy:"thumbhash",width:32,height:32})).dataURL}function _W($){let Z=$[0]|$[1]<<8|$[2]<<16,J=(Z&63)/63,X=(Z>>6&63)/31.5-1,Y=(Z>>12&63)/31.5-1,Q=(Z>>18&31)/31,G=Z>>23!==0,z=$[3]|$[4]<<8,K=(z>>3&63)/63,q=(z>>9&63)/63,W=z>>15!==0,U=Math.max(3,W?G?5:7:G?5:7),H=Math.max(3,W?G?5:7:G?5:7),j=32,B=32,V=Math.max(0,Math.min(255,Math.round((J+X)*255))),L=Math.max(0,Math.min(255,Math.round(J*255))),_=Math.max(0,Math.min(255,Math.round((J-X)*255))),F=`<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32">
|
|
1734
|
+
<rect fill="rgb(${V},${L},${_})" width="32" height="32"/>
|
|
1735
|
+
</svg>`;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(F)}`}async function LW($,Z=20,J=50){return z7($,{strategy:"blur",width:Z,quality:J,blurLevel:40})}async function FW($){let Z=await O5();if(Z)try{return(await Z.generatePlaceholder($,{strategy:"dominant-color"})).dominantColor||"#e5e7eb"}catch{}return"#e5e7eb"}function wW($,Z=1,J=1){let X=`<svg xmlns="http://www.w3.org/2000/svg" width="${Z}" height="${J}"><rect fill="${$}" width="${Z}" height="${J}"/></svg>`;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(X)}`}function q7($,Z,J={}){let X=J.transitionDuration||300,Y=J.easing||"ease-out";return`
|
|
1736
|
+
#${$} {
|
|
1737
|
+
--stx-img-transition-duration: ${X}ms;
|
|
1738
|
+
--stx-img-transition-easing: ${Y};
|
|
1739
|
+
background-image: url('${Z.dataURL}');
|
|
1740
|
+
background-size: cover;
|
|
1741
|
+
background-position: center;
|
|
1742
|
+
}
|
|
1743
|
+
|
|
1744
|
+
#${$} img {
|
|
1745
|
+
opacity: 0;
|
|
1746
|
+
transition: opacity var(--stx-img-transition-duration) var(--stx-img-transition-easing);
|
|
1747
|
+
}
|
|
1748
|
+
|
|
1749
|
+
#${$}.stx-img-loaded img {
|
|
1750
|
+
opacity: 1;
|
|
1751
|
+
}
|
|
1752
|
+
`.trim()}function RW($){return`background-image: url('${$.dataURL}'); background-size: cover; background-position: center;`}var v1=new Map;async function W7($,Z={}){let J=`${$}:${JSON.stringify(Z)}`;if(v1.has(J))return v1.get(J);let X=await z7($,Z);return v1.set(J,X),X}function NW(){v1.clear()}function DW(){return{size:v1.size,keys:Array.from(v1.keys())}}async function zX(){try{return await import("./chunk-a26hcag1.js")}catch($){if(!U7)console.warn("[stx-media] Image processor not available, some features disabled:",$),U7=!0;return null}}var U7=!1,_5=80,s2="async",r2="lazy",H7=!1;async function j2($,Z={}){let J=Z,X=$;if(X.process&&!X.skipOptimization){if(J.tsImagesConfig?.enabled&&!J.isDev)return HX(X,J)}if(J.processedResult?.processed)return w5($,J.processedResult,Z);if(J.responsiveVariants)return V7($,J.responsiveVariants,Z);let{src:Y,alt:Q,width:G,height:z,sizes:K,widths:q=V1,dpr:W,formats:U=P1,quality:H=_5,params:j={},placeholder:B="none",placeholderOptions:V={},lazy:L=!0,priority:_=!1,loading:F=_?"eager":r2,decoding:O=s2,fetchpriority:w,objectFit:N,objectPosition:R,crossorigin:M,referrerpolicy:T}=$,D=$.class,I=$.style,E=$.id,A=$.data||{},{isDev:k=!1,baseUrl:C=""}=Z;if(k&&!Z.optimize)return WX($);let y,b,P=E||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(B!=="none"&&!_)try{y=await W7(Y,{strategy:B,...V}),b=q7(P,y,V)}catch{}let u=W!==void 0&&G!==void 0,l;if(u)l=qX($,P,y,Z);else l=await KX($,P,y,Z);let g;if(_){let $0=U.includes("webp")?"webp":U[0],c=H2(Y,q,{...j,q:H},$0),K0=typeof K==="object"?j5(K):K||"100vw";g=`<link rel="preload" as="image" imagesrcset="${c}" imagesizes="${K0}" />`}let J0=[];if(!H7&&B!=="none")J0.push(V5),H7=!0;if(b)J0.push(b);let X0=L?B7(P):void 0;return{html:l,preloadLink:g,css:J0.length>0?J0.join(`
|
|
1753
|
+
`):void 0,script:X0}}async function KX($,Z,J,X){let{src:Y,alt:Q,width:G,height:z,sizes:K,widths:q=V1,formats:W=P1,quality:U=_5,params:H={},lazy:j=!0,priority:B=!1,loading:V=B?"eager":r2,decoding:L=s2,fetchpriority:_,objectFit:F,objectPosition:O,crossorigin:w,referrerpolicy:N}=$,R=$.class,M=$.style,T=$.data||{},D=typeof K==="object"?j5(K):K||"100vw",I=[];for(let k of W){let C=H2(Y,q,{...H,q:U},k),y=B5(k);if(j&&!B)I.push(` <source type="${y}" data-srcset="${C}" data-sizes="${D}" />`);else I.push(` <source type="${y}" srcset="${C}" sizes="${D}" />`)}let E=L5({src:Y1(Y,{...H,q:U}),alt:Q,width:G,height:z,loading:B?void 0:V,decoding:L,fetchpriority:B?"high":_,objectFit:F,objectPosition:O,crossorigin:w,referrerpolicy:N,className:j7(R,J),style:F5(M,F,O,J),lazy:j&&!B,data:T}),A;if(J){let k=`background-image: url('${J.dataURL}'); background-size: cover; background-position: center;`;A=`<div id="${Z}" class="stx-img-placeholder" style="${k}">
|
|
1754
|
+
<picture>
|
|
1755
|
+
${I.join(`
|
|
1756
|
+
`)}
|
|
1757
|
+
<img ${E} />
|
|
1758
|
+
</picture>
|
|
1759
|
+
</div>`}else A=`<picture${Z?` id="${Z}"`:""}>
|
|
1760
|
+
${I.join(`
|
|
1761
|
+
`)}
|
|
1762
|
+
<img ${E} />
|
|
1763
|
+
</picture>`;return A}function qX($,Z,J,X){let{src:Y,alt:Q,width:G,height:z,dpr:K=[1,2,3],quality:q=_5,params:W={},lazy:U=!0,priority:H=!1,loading:j=H?"eager":r2,decoding:B=s2,fetchpriority:V,objectFit:L,objectPosition:_,crossorigin:F,referrerpolicy:O}=$,w=$.class,N=$.style,R=$.data||{},M=typeof G==="number"?G:Number.parseInt(String(G),10),T=H5(Y,M,K,{...W,q}),D=L5({src:Y1(Y,{...W,w:M,q}),alt:Q,width:G,height:z,loading:H?void 0:j,decoding:B,fetchpriority:H?"high":V,objectFit:L,objectPosition:_,crossorigin:F,referrerpolicy:O,className:j7(w,J),style:F5(N,L,_,J),lazy:U&&!H,data:R}),I=U&&!H?`data-srcset="${T}"`:`srcset="${T}"`;if(J){let E=`background-image: url('${J.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${E}">
|
|
1764
|
+
<img ${D} ${I} />
|
|
1765
|
+
</div>`}return`<img ${Z?`id="${Z}" `:""}${D} ${I} />`}function WX($){let{src:Z,alt:J,width:X,height:Y,loading:Q=r2,decoding:G=s2,fetchpriority:z,objectFit:K,objectPosition:q,crossorigin:W,referrerpolicy:U,priority:H=!1}=$,j=$.class,B=$.style,V=$.id,L=$.data||{};return{html:`<img ${L5({src:Z,alt:J,width:X,height:Y,loading:H?"eager":Q,decoding:G,fetchpriority:H?"high":z,objectFit:K,objectPosition:q,crossorigin:W,referrerpolicy:U,className:j,style:F5(B,K,q),id:V,data:L})} />`}}function L5($){let Z=[];if($.lazy)Z.push(`data-src="${m0($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${m0($.src)}"`);if(Z.push(`alt="${m0($.alt)}"`),$.width)Z.push(`width="${$.width}"`);if($.height)Z.push(`height="${$.height}"`);if($.loading)Z.push(`loading="${$.loading}"`);if($.decoding)Z.push(`decoding="${$.decoding}"`);if($.fetchpriority)Z.push(`fetchpriority="${$.fetchpriority}"`);if($.crossorigin)Z.push(`crossorigin="${$.crossorigin}"`);if($.referrerpolicy)Z.push(`referrerpolicy="${$.referrerpolicy}"`);if($.className)Z.push(`class="${m0($.className)}"`);if($.style)Z.push(`style="${m0($.style)}"`);if($.id)Z.push(`id="${m0($.id)}"`);if($.data)for(let[J,X]of Object.entries($.data))Z.push(`data-${J}="${m0(X)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function j7($,Z){let J=[];if($)J.push($);if(Z)J.push("stx-img-blur");return J.join(" ")||""}function F5($,Z,J,X){let Y=[];if(Z)Y.push(`object-fit: ${Z}`);if(J)Y.push(`object-position: ${J}`);if(X)Y.push("opacity: 0; transition: opacity 300ms ease-out");if($)Y.push($);return Y.join("; ")}function m0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function B7($){return`
|
|
1766
|
+
(function() {
|
|
1767
|
+
const container = document.getElementById('${$}');
|
|
1768
|
+
if (!container) return;
|
|
1769
|
+
|
|
1770
|
+
const img = container.querySelector('img[data-stx-lazy]') || container;
|
|
1771
|
+
if (!img.dataset.src && !img.dataset.srcset) return;
|
|
1772
|
+
|
|
1773
|
+
const observer = new IntersectionObserver((entries) => {
|
|
1774
|
+
entries.forEach(entry => {
|
|
1775
|
+
if (entry.isIntersecting) {
|
|
1776
|
+
// Load image
|
|
1777
|
+
if (img.dataset.src) img.src = img.dataset.src;
|
|
1778
|
+
if (img.dataset.srcset) img.srcset = img.dataset.srcset;
|
|
1779
|
+
|
|
1780
|
+
// Load sources
|
|
1781
|
+
const sources = container.querySelectorAll('source[data-srcset]');
|
|
1782
|
+
sources.forEach(source => {
|
|
1783
|
+
if (source.dataset.srcset) source.srcset = source.dataset.srcset;
|
|
1784
|
+
if (source.dataset.sizes) source.sizes = source.dataset.sizes;
|
|
1785
|
+
});
|
|
1786
|
+
|
|
1787
|
+
// Handle load completion
|
|
1788
|
+
img.onload = () => {
|
|
1789
|
+
img.style.opacity = '1';
|
|
1790
|
+
if (container.classList.contains('stx-img-placeholder')) {
|
|
1791
|
+
container.classList.add('stx-img-loaded');
|
|
1792
|
+
}
|
|
1793
|
+
};
|
|
1794
|
+
|
|
1795
|
+
observer.disconnect();
|
|
1796
|
+
}
|
|
1797
|
+
});
|
|
1798
|
+
}, { rootMargin: '50px' });
|
|
1799
|
+
|
|
1800
|
+
observer.observe(container);
|
|
1801
|
+
})();
|
|
1802
|
+
`.trim()}function UX($){let Z=$.match(/<Img\s+([^>]*?)\/?>/);if(!Z)return null;let J=Z[1],X={},Y=/(:?)(\w+)(?:=(?:"([^"]*)"|'([^']*)'|\{([^}]+)\}))?/g,Q;while((Q=Y.exec(J))!==null){let[,G,z,K,q,W]=Q,U=K??q??W??!0;if(G===":"&&typeof U==="string")try{X[z]=JSON.parse(U)}catch{X[z]=U}else switch(z){case"src":X.src=String(U);break;case"alt":X.alt=String(U);break;case"width":X.width=Number(U)||U;break;case"height":X.height=Number(U)||U;break;case"sizes":X.sizes=String(U);break;case"quality":X.quality=Number(U);break;case"placeholder":X.placeholder=U;break;case"lazy":X.lazy=U===!0||U==="true";break;case"priority":X.priority=U===!0||U==="true";break;case"class":X.class=String(U);break;case"style":X.style=String(U);break;case"id":X.id=String(U);break;case"loading":X.loading=U;break;case"decoding":X.decoding=U;break;case"fetchpriority":X.fetchpriority=U;break;case"objectFit":X.objectFit=U;break;case"objectPosition":X.objectPosition=String(U);break;case"crossorigin":X.crossorigin=U;break}}if(!X.src||!X.alt)return null;return X}async function TW($,Z={}){let J=/<Img\s+[^>]*?\/?>/g,X=[],Y=[],Q=[],G=$,z=[],K;while((K=J.exec($))!==null)z.push({match:K[0],index:K.index});for(let q=z.length-1;q>=0;q--){let{match:W}=z[q],U=UX(W);if(U){let H=await j2(U,Z);if(G=G.replace(W,H.html),H.preloadLink)X.push(H.preloadLink);if(H.css)Y.push(H.css);if(H.script)Q.push(H.script)}}return{html:G,preloadLinks:X,styles:Y,scripts:Q}}async function HX($,Z){let J=await zX();if(!J)return j2({...$,process:!1},Z);let X=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let Q=await J.generateResponsiveVariants($.src,$,X);if(Q)return V7($,Q,Z)}else{let Q=await J.processImage($.src,$,X);if(Q.processed)return w5($,Q,Z)}return j2({...$,process:!1},Z)}async function w5($,Z,J){let{alt:X,width:Y,height:Q,lazy:G=!0,priority:z=!1,objectFit:K,objectPosition:q,crossorigin:W,referrerpolicy:U}=$,H=$.class,j=$.style,B=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,V=$.data||{},L=Z.variants||[],_=L.find((b)=>b.format==="jpeg")||L.find((b)=>b.format==="webp")||L[0],F=_?.url||$.src,O=L.filter((b)=>b.format===(_?.format||"jpeg")).map((b)=>`${b.url} ${b.width}w`).join(", "),w=new Map;for(let b of L){if(!w.has(b.format))w.set(b.format,[]);w.get(b.format).push(b)}let N=[],R=["avif","webp","jpeg","png"];for(let b of R){let P=w.get(b);if(P&&P.length>0){let u=P.map((g)=>`${g.url} ${g.width}w`).join(", "),l=B5(b);if(G&&!z)N.push(` <source type="${l}" data-srcset="${u}" />`);else N.push(` <source type="${l}" srcset="${u}" />`)}}let M=[];if(G&&!z){if(M.push(`data-src="${m0(F)}"`),M.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),O)M.push(`data-srcset="${O}"`)}else if(M.push(`src="${m0(F)}"`),O)M.push(`srcset="${O}"`);M.push(`alt="${m0(X)}"`);let T=Y||Z.originalWidth,D=Q||Z.originalHeight;if(T)M.push(`width="${T}"`);if(D)M.push(`height="${D}"`);if(!z)M.push(`loading="${G?"lazy":"eager"}"`);if(M.push('decoding="async"'),z)M.push('fetchpriority="high"');if(W)M.push(`crossorigin="${W}"`);if(U)M.push(`referrerpolicy="${U}"`);let I=[];if(K)I.push(`object-fit: ${K}`);if(q)I.push(`object-position: ${q}`);if(Z.placeholder&&G)I.push("opacity: 0; transition: opacity 300ms ease-out");if(j)I.push(j);if(I.length>0)M.push(`style="${I.join("; ")}"`);let E=[];if(H)E.push(H);if(Z.placeholder)E.push("stx-img-blur");if(E.length>0)M.push(`class="${E.join(" ")}"`);if(G&&!z)M.push("data-stx-lazy");for(let[b,P]of Object.entries(V))M.push(`data-${b}="${m0(P)}"`);let A;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let b=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;A=`<div id="${B}" class="stx-img-placeholder" style="${b}">
|
|
1803
|
+
<picture>
|
|
1804
|
+
${N.join(`
|
|
1805
|
+
`)}
|
|
1806
|
+
<img ${M.join(" ")} />
|
|
1807
|
+
</picture>
|
|
1808
|
+
</div>`}else A=`<picture${B?` id="${B}"`:""}>
|
|
1809
|
+
${N.join(`
|
|
1810
|
+
`)}
|
|
1811
|
+
<img ${M.join(" ")} />
|
|
1812
|
+
</picture>`;let k=[];if(Z.placeholder)k.push(V5);let C=G?B7(B):void 0,y;if(z&&O)y=`<link rel="preload" as="image" imagesrcset="${O}" />`;return{html:A,preloadLink:y,css:k.length>0?k.join(`
|
|
1813
|
+
`):void 0,script:C}}async function V7($,Z,J){let X={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[Y,Q]of Object.entries(Z.byFormat))if(Q)X.variants.push(...Q);return w5($,X,J)}function jX(){return a2({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,J,X)=>{let{src:Y,alt:Q,options:G}=BX($,Z,J);if(!Y)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let z={src:Y,alt:Q||"",widths:G.widths||V1,formats:G.formats||P1,quality:G.quality,sizes:G.sizes,dpr:G.dpr,params:G.params,placeholder:G.placeholder,placeholderOptions:G.placeholderOptions,lazy:G.lazy!==!1,priority:G.priority||!1,loading:G.loading,decoding:G.decoding,fetchpriority:G.fetchpriority,objectFit:G.objectFit,objectPosition:G.objectPosition,class:G.class,style:G.style,id:G.id,width:G.width,height:G.height},K=J.__isDev||!1,q=await j2(z,{isDev:K}),W=q.html;if(q.preloadLink)W=q.preloadLink+`
|
|
1814
|
+
`+W;if(q.css)W+=`
|
|
1815
|
+
<style>${q.css}</style>`;if(q.script)W+=`
|
|
1816
|
+
<script>${q.script}</script>`;return W},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function BX($,Z,J){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let X=$.trim();if(X.startsWith("@img(")||X.startsWith("("))X=X.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Y=VX(X),Q=R5(Y[0],J)||"",G=R5(Y[1],J)||"",z={};if(Y[2]){let K=R5(Y[2],J);if(typeof K==="object"&&K!==null)z=K;else if(typeof Y[2]==="string")try{z=JSON.parse(Y[2])}catch{}}return{src:Q,alt:G,options:z}}function VX($){let Z=[],J="",X=!1,Y="",Q=0,G=0;for(let z=0;z<$.length;z++){let K=$[z],q=z>0?$[z-1]:"";if((K==='"'||K==="'"||K==="`")&&q!=="\\"){if(!X)X=!0,Y=K;else if(K===Y)X=!1,Y="";else J+=K;continue}if(!X){if(K==="{")Q++;if(K==="}")Q--;if(K==="[")G++;if(K==="]")G--;if(K===","&&Q===0&&G===0){Z.push(J.trim()),J="";continue}}J+=K}if(J.trim())Z.push(J.trim());return Z}function R5($,Z){if(typeof $!=="string")return $;let J=$.trim();if(J.startsWith('"')&&J.endsWith('"')||J.startsWith("'")&&J.endsWith("'"))return J.slice(1,-1);if(!J.startsWith("/")&&!J.startsWith(".")&&!J.startsWith("http")&&!J.startsWith("{")){let X=Z[J];if(X!==void 0)return X}if(J.startsWith("{")||J.startsWith("["))try{return JSON.parse(J)}catch{}return J}var O7=jX();async function L7(){try{return await import("./chunk-5qsg9q46.js")}catch($){if(!_7)console.warn("[stx-media] Video processor not available, some features disabled:",$),_7=!0;return null}}var _7=!1,F7=!0,w7="metadata",OX="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";async function t2($,Z={}){let J=Z,X=$;if(X.process&&!X.skipProcessing){if(J.tsVideosConfig?.enabled&&!J.isDev)return RX(X,J)}if(J.processedResult?.processed)return N7($,J.processedResult,Z);let Y;if(X.generatePoster&&X.src&&!$.poster)Y=await NX(X,J);let{src:Q,sources:G=[],poster:z,posterPlaceholder:K,controls:q=F7,autoplay:W=!1,muted:U=!1,loop:H=!1,preload:j=w7,playsinline:B=!0,lazy:V=!0,player:L="native",type:_,width:F,height:O,crossorigin:w,disablePictureInPicture:N=!1,disableRemotePlayback:R=!1}=$,M=Y||z,T=$.class,D=$.style,I=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(L==="ts-video")return LX($,Z);if(_&&_!=="video")return _X(Q||"",_,$);let E=G.length>0?G:Q?[{src:Q,type:R7(Q)}]:[],A=[`id="${I}"`];if(q)A.push("controls");if(W)A.push("autoplay");if(U)A.push("muted");if(H)A.push("loop");if(B)A.push("playsinline");if(N)A.push("disablepictureinpicture");if(R)A.push("disableremoteplayback");if(w)A.push(`crossorigin="${w}"`);if(V){if(A.push(`data-preload="${j}"`),A.push('preload="none"'),M)A.push(`data-poster="${k0(M)}"`);A.push("data-stx-lazy")}else if(A.push(`preload="${j}"`),M)A.push(`poster="${k0(M)}"`);if(F)A.push(`width="${F}"`);if(O)A.push(`height="${O}"`);if(T)A.push(`class="${k0(T)}"`);if(D)A.push(`style="${k0(D)}"`);let k=E.map((b)=>{return` <source ${V?`data-src="${k0(b.src)}"`:`src="${k0(b.src)}"`} type="${b.type}"${b.media?` media="${b.media}"`:""} />`}).join(`
|
|
1817
|
+
`),C=`<video ${A.join(" ")}>
|
|
1818
|
+
${k}
|
|
1819
|
+
Your browser does not support the video tag.
|
|
1820
|
+
</video>`,y;if(V)y=`
|
|
1821
|
+
(function() {
|
|
1822
|
+
var video = document.getElementById('${I}');
|
|
1823
|
+
if (!video) return;
|
|
1824
|
+
|
|
1825
|
+
var observer = new IntersectionObserver(function(entries) {
|
|
1826
|
+
entries.forEach(function(entry) {
|
|
1827
|
+
if (entry.isIntersecting) {
|
|
1828
|
+
// Load poster
|
|
1829
|
+
if (video.dataset.poster) {
|
|
1830
|
+
video.poster = video.dataset.poster;
|
|
1831
|
+
delete video.dataset.poster;
|
|
1832
|
+
}
|
|
1833
|
+
|
|
1834
|
+
// Load sources
|
|
1835
|
+
var sources = video.querySelectorAll('source[data-src]');
|
|
1836
|
+
sources.forEach(function(source) {
|
|
1837
|
+
source.src = source.dataset.src;
|
|
1838
|
+
delete source.dataset.src;
|
|
1839
|
+
});
|
|
1840
|
+
|
|
1841
|
+
// Set preload
|
|
1842
|
+
if (video.dataset.preload) {
|
|
1843
|
+
video.preload = video.dataset.preload;
|
|
1844
|
+
delete video.dataset.preload;
|
|
1845
|
+
}
|
|
1846
|
+
|
|
1847
|
+
video.load();
|
|
1848
|
+
observer.disconnect();
|
|
1849
|
+
}
|
|
1850
|
+
});
|
|
1851
|
+
}, { rootMargin: '50px' });
|
|
1852
|
+
|
|
1853
|
+
observer.observe(video);
|
|
1854
|
+
})();
|
|
1855
|
+
`.trim();return{html:C,script:y}}function _X($,Z,J){let{width:X=640,height:Y=360}=J,Q=J.class,G=J.style,z=J.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,K,q=null;switch(Z){case"youtube":q=FX($),K=q?`https://www.youtube-nocookie.com/embed/${q}`:$;break;case"vimeo":q=wX($),K=q?`https://player.vimeo.com/video/${q}`:$;break;case"dailymotion":q=$.split("/").pop()||"",K=`https://www.dailymotion.com/embed/video/${q}`;break;case"twitch":q=$.split("/").pop()||"",K=`https://player.twitch.tv/?video=${q}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:K=$}let W=[`id="${z}"`,`src="${k0(K)}"`,`width="${X}"`,`height="${Y}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(Q)W.push(`class="${k0(Q)}"`);if(G)W.push(`style="${k0(G)}"`);if(J.lazy)W.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
|
|
1856
|
+
<iframe ${W.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
|
|
1857
|
+
</div>`}}function LX($,Z={}){let{src:J,sources:X=[],poster:Y,controls:Q=!0,autoplay:G=!1,muted:z=!1,loop:K=!1,preload:q="metadata",playsinline:W=!0,lazy:U=!0,width:H,height:j}=$,B=$.class,V=$.style,L=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,_={src:X.length>0?X:J,autoplay:G,loop:K,muted:z,playsinline:W,preload:q,poster:Y,controls:Q,title:$.title},F=["position: relative",H?`width: ${typeof H==="number"?H+"px":H}`:"width: 100%",j?`height: ${typeof j==="number"?j+"px":j}`:"",V||""].filter(Boolean).join("; "),O=`
|
|
1858
|
+
<div
|
|
1859
|
+
id="${L}"
|
|
1860
|
+
class="ts-video-player${B?" "+k0(B):""}"
|
|
1861
|
+
style="${F}"
|
|
1862
|
+
data-ts-video-player
|
|
1863
|
+
data-config='${JSON.stringify(_)}'
|
|
1864
|
+
${U?"data-lazy":""}
|
|
1865
|
+
>
|
|
1866
|
+
<div class="ts-video-player__container">
|
|
1867
|
+
${Y?`
|
|
1868
|
+
<div class="ts-video-player__placeholder" style="background-image: url('${k0(Y)}');">
|
|
1869
|
+
<button class="ts-video-player__play-button" aria-label="Play video">
|
|
1870
|
+
<svg viewBox="0 0 24 24" fill="currentColor" width="64" height="64">
|
|
1871
|
+
<path d="M8 5v14l11-7z"/>
|
|
1872
|
+
</svg>
|
|
1873
|
+
</button>
|
|
1874
|
+
</div>
|
|
1875
|
+
`:""}
|
|
1876
|
+
</div>
|
|
1877
|
+
</div>
|
|
1878
|
+
`.trim(),w=`
|
|
1879
|
+
(function() {
|
|
1880
|
+
var container = document.getElementById('${L}');
|
|
1881
|
+
if (!container) return;
|
|
1882
|
+
|
|
1883
|
+
var config = JSON.parse(container.dataset.config || '{}');
|
|
1884
|
+
var isLazy = container.hasAttribute('data-lazy');
|
|
1885
|
+
|
|
1886
|
+
function loadPlayer() {
|
|
1887
|
+
if (typeof TSVideoPlayer !== 'undefined') {
|
|
1888
|
+
initPlayer();
|
|
1889
|
+
return;
|
|
1890
|
+
}
|
|
1891
|
+
|
|
1892
|
+
// Load ts-video-player from CDN
|
|
1893
|
+
var script = document.createElement('script');
|
|
1894
|
+
script.src = '${OX}';
|
|
1895
|
+
script.onload = initPlayer;
|
|
1896
|
+
script.onerror = function() {
|
|
1897
|
+
console.error('[stx] Failed to load ts-video-player');
|
|
1898
|
+
fallbackToNative();
|
|
1899
|
+
};
|
|
1900
|
+
document.head.appendChild(script);
|
|
1901
|
+
}
|
|
1902
|
+
|
|
1903
|
+
function initPlayer() {
|
|
1904
|
+
var player = TSVideoPlayer.createPlayer(container, config);
|
|
1905
|
+
if (config.src) {
|
|
1906
|
+
player.setSrc(config.src);
|
|
1907
|
+
}
|
|
1908
|
+
container.__tsVideoPlayer = player;
|
|
1909
|
+
|
|
1910
|
+
// Remove placeholder
|
|
1911
|
+
var placeholder = container.querySelector('.ts-video-player__placeholder');
|
|
1912
|
+
if (placeholder) {
|
|
1913
|
+
placeholder.style.display = 'none';
|
|
1914
|
+
}
|
|
1915
|
+
}
|
|
1916
|
+
|
|
1917
|
+
function fallbackToNative() {
|
|
1918
|
+
// Fallback to native video element
|
|
1919
|
+
var video = document.createElement('video');
|
|
1920
|
+
video.controls = config.controls !== false;
|
|
1921
|
+
video.autoplay = config.autoplay;
|
|
1922
|
+
video.muted = config.muted;
|
|
1923
|
+
video.loop = config.loop;
|
|
1924
|
+
video.playsInline = config.playsinline;
|
|
1925
|
+
video.preload = config.preload || 'metadata';
|
|
1926
|
+
if (config.poster) video.poster = config.poster;
|
|
1927
|
+
if (config.src) video.src = typeof config.src === 'string' ? config.src : config.src[0]?.src || config.src[0];
|
|
1928
|
+
video.style.width = '100%';
|
|
1929
|
+
video.style.height = '100%';
|
|
1930
|
+
|
|
1931
|
+
var containerEl = container.querySelector('.ts-video-player__container');
|
|
1932
|
+
if (containerEl) {
|
|
1933
|
+
containerEl.innerHTML = '';
|
|
1934
|
+
containerEl.appendChild(video);
|
|
1935
|
+
}
|
|
1936
|
+
}
|
|
1937
|
+
|
|
1938
|
+
if (isLazy) {
|
|
1939
|
+
var observer = new IntersectionObserver(function(entries) {
|
|
1940
|
+
entries.forEach(function(entry) {
|
|
1941
|
+
if (entry.isIntersecting) {
|
|
1942
|
+
loadPlayer();
|
|
1943
|
+
observer.disconnect();
|
|
1944
|
+
}
|
|
1945
|
+
});
|
|
1946
|
+
}, { rootMargin: '50px' });
|
|
1947
|
+
observer.observe(container);
|
|
1948
|
+
}
|
|
1949
|
+
else {
|
|
1950
|
+
if (document.readyState === 'loading') {
|
|
1951
|
+
document.addEventListener('DOMContentLoaded', loadPlayer);
|
|
1952
|
+
}
|
|
1953
|
+
else {
|
|
1954
|
+
loadPlayer();
|
|
1955
|
+
}
|
|
1956
|
+
}
|
|
1957
|
+
|
|
1958
|
+
// Handle play button click
|
|
1959
|
+
var playButton = container.querySelector('.ts-video-player__play-button');
|
|
1960
|
+
if (playButton) {
|
|
1961
|
+
playButton.addEventListener('click', function() {
|
|
1962
|
+
loadPlayer();
|
|
1963
|
+
var check = setInterval(function() {
|
|
1964
|
+
if (container.__tsVideoPlayer && container.__tsVideoPlayer.ready) {
|
|
1965
|
+
container.__tsVideoPlayer.play();
|
|
1966
|
+
clearInterval(check);
|
|
1967
|
+
}
|
|
1968
|
+
}, 100);
|
|
1969
|
+
});
|
|
1970
|
+
}
|
|
1971
|
+
})();
|
|
1972
|
+
`.trim(),N=`
|
|
1973
|
+
.ts-video-player {
|
|
1974
|
+
position: relative;
|
|
1975
|
+
background: #000;
|
|
1976
|
+
}
|
|
1977
|
+
|
|
1978
|
+
.ts-video-player__container {
|
|
1979
|
+
position: relative;
|
|
1980
|
+
width: 100%;
|
|
1981
|
+
padding-bottom: 56.25%;
|
|
1982
|
+
}
|
|
1983
|
+
|
|
1984
|
+
.ts-video-player__container > * {
|
|
1985
|
+
position: absolute;
|
|
1986
|
+
top: 0;
|
|
1987
|
+
left: 0;
|
|
1988
|
+
width: 100%;
|
|
1989
|
+
height: 100%;
|
|
1990
|
+
}
|
|
1991
|
+
|
|
1992
|
+
.ts-video-player__placeholder {
|
|
1993
|
+
display: flex;
|
|
1994
|
+
align-items: center;
|
|
1995
|
+
justify-content: center;
|
|
1996
|
+
background-color: #1a1a1a;
|
|
1997
|
+
background-size: cover;
|
|
1998
|
+
background-position: center;
|
|
1999
|
+
cursor: pointer;
|
|
2000
|
+
}
|
|
2001
|
+
|
|
2002
|
+
.ts-video-player__play-button {
|
|
2003
|
+
display: flex;
|
|
2004
|
+
align-items: center;
|
|
2005
|
+
justify-content: center;
|
|
2006
|
+
width: 80px;
|
|
2007
|
+
height: 80px;
|
|
2008
|
+
background: rgba(0, 0, 0, 0.7);
|
|
2009
|
+
border: none;
|
|
2010
|
+
border-radius: 50%;
|
|
2011
|
+
color: white;
|
|
2012
|
+
cursor: pointer;
|
|
2013
|
+
transition: transform 0.2s, background 0.2s;
|
|
2014
|
+
}
|
|
2015
|
+
|
|
2016
|
+
.ts-video-player__play-button:hover {
|
|
2017
|
+
transform: scale(1.1);
|
|
2018
|
+
background: rgba(0, 0, 0, 0.9);
|
|
2019
|
+
}
|
|
2020
|
+
|
|
2021
|
+
.ts-video-player__play-button svg {
|
|
2022
|
+
margin-left: 4px;
|
|
2023
|
+
}
|
|
2024
|
+
`.trim();return{html:O,script:w,css:N}}function R7($){switch($.split(".").pop()?.toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"mov":return"video/quicktime";case"avi":return"video/x-msvideo";case"mkv":return"video/x-matroska";case"m3u8":return"application/x-mpegURL";default:return"video/mp4"}}function FX($){let Z=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let J of Z){let X=$.match(J);if(X)return X[1]}return null}function wX($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function k0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'")}function SW($,Z,J){if(Z.src)return{src:String(Z.src),...Z};let X=$.trim();if(X.startsWith("@video(")||X.startsWith("("))X=X.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Y=X.indexOf(",");if(Y===-1)return{src:X.replace(/^['"]|['"]$/g,"")};let Q=X.slice(0,Y).trim().replace(/^['"]|['"]$/g,""),G=X.slice(Y+1).trim();try{let z=JSON.parse(G);return{src:Q,...z}}catch{return{src:Q}}}async function RX($,Z){let J=await L7();if(!J)return t2({...$,process:!1},Z);let X=Z.tsVideosConfig,Y=await J.processVideo($.src,$,X,$.onProcessProgress);if(Y.processed)return N7($,Y,Z);return t2({...$,process:!1},Z)}async function NX($,Z){let J=await L7();if(!J||!$.src)return;let X=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},Y=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await J.generatePoster($.src,X,Y.outputDir,Y.baseUrl||"/videos"))?.url}function N7($,Z,J){let{controls:X=F7,autoplay:Y=!1,muted:Q=!1,loop:G=!1,preload:z=w7,playsinline:K=!0,lazy:q=!0,width:W,height:U,crossorigin:H,disablePictureInPicture:j=!1,disableRemotePlayback:B=!1}=$,V=$.class,L=$.style,_=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,F=$.src,O=R7(F);if(Z.transcoded)F=Z.transcoded.url,O="video/mp4";let w=Z.streaming?.hls||Z.streaming?.dash;if(w){if(Z.streaming?.hls)F=Z.streaming.hls.manifestUrl,O="application/x-mpegURL";else if(Z.streaming?.dash)F=Z.streaming.dash.manifestUrl,O="application/dash+xml"}let N=Z.poster?.url||$.poster,R=[`id="${_}"`];if(X)R.push("controls");if(Y)R.push("autoplay");if(Q)R.push("muted");if(G)R.push("loop");if(K)R.push("playsinline");if(j)R.push("disablepictureinpicture");if(B)R.push("disableremoteplayback");if(H)R.push(`crossorigin="${H}"`);if(q){if(R.push(`data-preload="${z}"`),R.push('preload="none"'),N)R.push(`data-poster="${k0(N)}"`);R.push("data-stx-lazy")}else if(R.push(`preload="${z}"`),N)R.push(`poster="${k0(N)}"`);let M=W||Z.metadata?.width,T=U||Z.metadata?.height;if(M)R.push(`width="${M}"`);if(T)R.push(`height="${T}"`);if(V)R.push(`class="${k0(V)}"`);if(L)R.push(`style="${k0(L)}"`);let I=` <source ${q?`data-src="${k0(F)}"`:`src="${k0(F)}"`} type="${O}" />`,E=`<video ${R.join(" ")}>
|
|
2025
|
+
${I}
|
|
2026
|
+
Your browser does not support the video tag.
|
|
2027
|
+
</video>`;if(Z.spriteSheet)E=`<div class="stx-video-wrapper" data-sprite-sheet="${k0(Z.spriteSheet.url)}" data-sprite-cols="${Z.spriteSheet.columns}" data-sprite-interval="${Z.spriteSheet.interval}">
|
|
2028
|
+
${E}
|
|
2029
|
+
</div>`;let A;if(q)A=`
|
|
2030
|
+
(function() {
|
|
2031
|
+
var video = document.getElementById('${_}');
|
|
2032
|
+
if (!video) return;
|
|
2033
|
+
|
|
2034
|
+
var observer = new IntersectionObserver(function(entries) {
|
|
2035
|
+
entries.forEach(function(entry) {
|
|
2036
|
+
if (entry.isIntersecting) {
|
|
2037
|
+
// Load poster
|
|
2038
|
+
if (video.dataset.poster) {
|
|
2039
|
+
video.poster = video.dataset.poster;
|
|
2040
|
+
delete video.dataset.poster;
|
|
2041
|
+
}
|
|
2042
|
+
|
|
2043
|
+
// Load sources
|
|
2044
|
+
var sources = video.querySelectorAll('source[data-src]');
|
|
2045
|
+
sources.forEach(function(source) {
|
|
2046
|
+
source.src = source.dataset.src;
|
|
2047
|
+
delete source.dataset.src;
|
|
2048
|
+
});
|
|
2049
|
+
|
|
2050
|
+
// Set preload
|
|
2051
|
+
if (video.dataset.preload) {
|
|
2052
|
+
video.preload = video.dataset.preload;
|
|
2053
|
+
delete video.dataset.preload;
|
|
2054
|
+
}
|
|
2055
|
+
|
|
2056
|
+
video.load();
|
|
2057
|
+
observer.disconnect();
|
|
2058
|
+
}
|
|
2059
|
+
});
|
|
2060
|
+
}, { rootMargin: '50px' });
|
|
2061
|
+
|
|
2062
|
+
observer.observe(video);
|
|
2063
|
+
})();
|
|
2064
|
+
`.trim();let k;if(w)k=`
|
|
2065
|
+
.stx-video-wrapper {
|
|
2066
|
+
position: relative;
|
|
2067
|
+
width: 100%;
|
|
2068
|
+
}
|
|
2069
|
+
.stx-video-wrapper video {
|
|
2070
|
+
width: 100%;
|
|
2071
|
+
height: auto;
|
|
2072
|
+
}
|
|
2073
|
+
`.trim();return{html:E,script:A,css:k}}function D7(){return a2({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,J,X)=>{let{src:Y,options:Q}=DX($,Z,J);if(!Y)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let G={src:Y,poster:Q.poster,controls:Q.controls!==!1,autoplay:Q.autoplay||!1,muted:Q.muted||!1,loop:Q.loop||!1,preload:Q.preload||"metadata",playsinline:Q.playsinline!==!1,lazy:Q.lazy!==!1,player:Q.player||"native",type:Q.type,width:Q.width,height:Q.height,class:Q.class,style:Q.style,id:Q.id,crossorigin:Q.crossorigin,disablePictureInPicture:Q.disablePictureInPicture,disableRemotePlayback:Q.disableRemotePlayback,title:Q.title,quality:Q.quality,platform:Q.platform,process:Q.process,generatePoster:Q.generatePoster,streaming:Q.streaming,transcode:Q.transcode,spriteSheet:Q.spriteSheet,waveform:Q.waveform},K={isDev:J.__isDev||!1,tsVideosConfig:J.__tsVideosConfig},q=await t2(G,K),W=q.html;if(q.css)W+=`
|
|
2074
|
+
<style>${q.css}</style>`;if(q.script)W+=`
|
|
2075
|
+
<script>${q.script}</script>`;return W},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function DX($,Z,J){if(Z.src)return{src:String(Z.src),options:Z.options||{}};let X=$.trim();if(X.startsWith("@video(")||X.startsWith("("))X=X.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Y=MX(X),Q=M7(Y[0],J)||"",G={};if(Y[1]){let z=M7(Y[1],J);if(typeof z==="object"&&z!==null)G=z;else if(typeof Y[1]==="string")try{G=JSON.parse(Y[1])}catch{}}return{src:Q,options:G}}function MX($){let Z=[],J="",X=!1,Y="",Q=0,G=0;for(let z=0;z<$.length;z++){let K=$[z],q=z>0?$[z-1]:"";if((K==='"'||K==="'"||K==="`")&&q!=="\\"){if(!X)X=!0,Y=K;else if(K===Y)X=!1,Y="";else J+=K;continue}if(!X){if(K==="{")Q++;if(K==="}")Q--;if(K==="[")G++;if(K==="]")G--;if(K===","&&Q===0&&G===0){Z.push(J.trim()),J="";continue}}J+=K}if(J.trim())Z.push(J.trim());return Z}function M7($,Z){if(typeof $!=="string")return $;let J=$.trim();if(J.startsWith('"')&&J.endsWith('"')||J.startsWith("'")&&J.endsWith("'"))return J.slice(1,-1);if(!J.startsWith("/")&&!J.startsWith(".")&&!J.startsWith("http")&&!J.startsWith("{")){let X=Z[J];if(X!==void 0)return X}if(J.startsWith("{")||J.startsWith("["))try{return JSON.parse(J)}catch{}return J}var N5=D7();import AX from"fs";import g0 from"path";async function lW($,Z){if(!$.webComponents?.enabled)return[];let J=$.webComponents.components||[],X=[];if(J.length>0){if($.debug)console.log(`Building ${J.length} web components...`);for(let Y of J)try{let Q=await IX(Y,$,Z);if(Q)X.push(Q)}catch(Q){if(console.error(`Error building web component ${Y.name}:`,Q),$.debug)throw Q}}return X}async function IX($,Z,J){let{name:X,file:Y,tag:Q,extends:G}=$;if(!X||!Y||!Q)return console.error("Invalid web component configuration, missing required fields:",$),null;let z=null;if(g0.isAbsolute(Y)&&await e(Y))z=Y;else if(Z.componentsDir){let V=g0.join(Z.componentsDir,Y);if(await e(V))z=V}if(!z)z=await e2(Y,process.cwd(),Z,J);if(!z)return console.error(`Web component source file not found: ${Y}`),null;let K=await Bun.file(z).text();J.add(z);let W=($.outputFormat||"js")==="ts",U=W?kX({name:X,tag:Q,baseElement:G,source:K,shadowDOM:$.shadowDOM??!0,template:$.template??!0,styleSource:$.styleSource,attributes:$.attributes||[],attributeTypes:$.attributeTypes||{}}):TX({name:X,tag:Q,baseElement:G,source:K,shadowDOM:$.shadowDOM??!0,template:$.template??!0,styleSource:$.styleSource,attributes:$.attributes||[]}),H=Z.webComponents?.outputDir||"dist/web-components";await AX.promises.mkdir(H,{recursive:!0});let j=W?"ts":"js",B=g0.join(H,`${Q}.${j}`);if(await Bun.write(B,U),Z.debug)console.log(`Built web component ${X} -> ${B}`);return B}function TX($){let{name:Z,tag:J,baseElement:X="HTMLElement",source:Y,shadowDOM:Q,template:G,styleSource:z,attributes:K=[]}=$,q=Y.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!Q)q=q.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),q=q.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),q=q.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),q=q.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");let W="";if(z)W=`<link rel="stylesheet" href="${z}">`;return`/**
|
|
2076
|
+
* ${Z} Web Component
|
|
2077
|
+
* Auto-generated from stx component
|
|
2078
|
+
*/
|
|
2079
|
+
class ${Z.replace(/\W/g,"")} extends ${X} {
|
|
2080
|
+
constructor() {
|
|
2081
|
+
super()
|
|
2082
|
+
this._initialized = false
|
|
2083
|
+
${Q?"":"this._slotContent = []"}
|
|
2084
|
+
${Q?'this.attachShadow({ mode: "open" })':""}
|
|
2085
|
+
}
|
|
2086
|
+
|
|
2087
|
+
${G?`
|
|
2088
|
+
_createTemplate() {
|
|
2089
|
+
const template = document.createElement('template')
|
|
2090
|
+
template.innerHTML = \`${W}${q}\`
|
|
2091
|
+
${Q?"this.shadowRoot.appendChild(template.content.cloneNode(true))":"this.appendChild(template.content.cloneNode(true))"}
|
|
2092
|
+
this._processSlots()
|
|
2093
|
+
}
|
|
2094
|
+
`:`
|
|
2095
|
+
_render() {
|
|
2096
|
+
${Q?"this.shadowRoot.innerHTML":"this.innerHTML"} = \`${W}${q}\`
|
|
2097
|
+
this._processSlots()
|
|
2098
|
+
}
|
|
2099
|
+
`}
|
|
2100
|
+
|
|
2101
|
+
_processSlots() {
|
|
2102
|
+
${Q?`// Shadow DOM handles slot assignment automatically
|
|
2103
|
+
// Listen for slot changes if needed
|
|
2104
|
+
const slots = this.shadowRoot.querySelectorAll('slot')
|
|
2105
|
+
slots.forEach(slot => {
|
|
2106
|
+
slot.addEventListener('slotchange', (e) => {
|
|
2107
|
+
const assignedNodes = slot.assignedNodes()
|
|
2108
|
+
this.dispatchEvent(new CustomEvent('slot-changed', {
|
|
2109
|
+
detail: { slotName: slot.name || 'default', assignedNodes }
|
|
2110
|
+
}))
|
|
2111
|
+
})
|
|
2112
|
+
})`:`// Manual slot processing for non-shadow DOM mode
|
|
2113
|
+
const slots = this.querySelectorAll('[data-slot]')
|
|
2114
|
+
|
|
2115
|
+
// Process named slots
|
|
2116
|
+
slots.forEach(slotEl => {
|
|
2117
|
+
const slotName = slotEl.getAttribute('data-slot')
|
|
2118
|
+
const slottedContent = this._slotContent.filter(
|
|
2119
|
+
node => node.nodeType === Node.ELEMENT_NODE && node.getAttribute('slot') === slotName
|
|
2120
|
+
)
|
|
2121
|
+
if (slottedContent.length > 0) {
|
|
2122
|
+
slotEl.innerHTML = ''
|
|
2123
|
+
slottedContent.forEach(content => slotEl.appendChild(content))
|
|
2124
|
+
}
|
|
2125
|
+
})
|
|
2126
|
+
|
|
2127
|
+
// Process default slot
|
|
2128
|
+
const defaultSlot = this.querySelector('[data-slot=""]') || this.querySelector('[data-default-slot]')
|
|
2129
|
+
if (defaultSlot) {
|
|
2130
|
+
const unslottedContent = this._slotContent.filter(
|
|
2131
|
+
node => node.nodeType !== Node.ELEMENT_NODE || !node.hasAttribute('slot')
|
|
2132
|
+
)
|
|
2133
|
+
if (unslottedContent.length > 0) {
|
|
2134
|
+
defaultSlot.innerHTML = ''
|
|
2135
|
+
unslottedContent.forEach(content => defaultSlot.appendChild(content))
|
|
2136
|
+
}
|
|
2137
|
+
}`}
|
|
2138
|
+
}
|
|
2139
|
+
|
|
2140
|
+
${K.length>0?`
|
|
2141
|
+
static get observedAttributes() {
|
|
2142
|
+
return [${K.map((U)=>`'${U}'`).join(", ")}]
|
|
2143
|
+
}
|
|
2144
|
+
|
|
2145
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
2146
|
+
if (oldValue !== newValue) {
|
|
2147
|
+
this[name] = newValue
|
|
2148
|
+
${G?"":"if (this._initialized) this._render()"}
|
|
2149
|
+
}
|
|
2150
|
+
}
|
|
2151
|
+
`:""}
|
|
2152
|
+
|
|
2153
|
+
connectedCallback() {
|
|
2154
|
+
if (this._initialized) return
|
|
2155
|
+
${Q?"":"this._slotContent = Array.from(this.childNodes)"}
|
|
2156
|
+
this._initialized = true
|
|
2157
|
+
${G?"this._createTemplate()":"this._render()"}
|
|
2158
|
+
}
|
|
2159
|
+
|
|
2160
|
+
disconnectedCallback() {
|
|
2161
|
+
// Component removed from the DOM
|
|
2162
|
+
}
|
|
2163
|
+
}
|
|
2164
|
+
|
|
2165
|
+
// Register the web component
|
|
2166
|
+
customElements.define('${J}', ${Z.replace(/\W/g,"")})
|
|
2167
|
+
`}function kX($){let{name:Z,tag:J,baseElement:X="HTMLElement",source:Y,shadowDOM:Q,template:G,styleSource:z,attributes:K=[],attributeTypes:q={}}=$,W=Z.replace(/\W/g,""),U=Y.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!Q)U=U.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),U=U.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),U=U.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),U=U.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");U=U.replace(/`/g,"\\`").replace(/\$\{/g,"\\${");let H=z?`<link rel="stylesheet" href="${z}">`:"",j=(N)=>{switch(q[N]){case"number":return"number";case"boolean":return"boolean";case"object":return"Record<string, unknown>";default:return"string"}},B=(N)=>N.replace(/-([a-z])/g,(R,M)=>M.toUpperCase()),V=K.map((N)=>` private _${B(N)}: ${j(N)} | null = null;`).join(`
|
|
2168
|
+
`),L=K.map((N)=>{let R=j(N),M=B(N);return`
|
|
2169
|
+
get ${M}(): ${R} | null {
|
|
2170
|
+
return this._${M};
|
|
2171
|
+
}
|
|
2172
|
+
|
|
2173
|
+
set ${M}(value: ${R} | null) {
|
|
2174
|
+
this._${M} = value;
|
|
2175
|
+
if (value !== null) {
|
|
2176
|
+
this.setAttribute('${N}', String(value));
|
|
2177
|
+
}
|
|
2178
|
+
else {
|
|
2179
|
+
this.removeAttribute('${N}');
|
|
2180
|
+
}
|
|
2181
|
+
}`}).join(`
|
|
2182
|
+
`),_=K.length>0?`/**
|
|
2183
|
+
* Props interface for ${Z}
|
|
2184
|
+
*/
|
|
2185
|
+
export interface ${W}Props {
|
|
2186
|
+
${K.map((N)=>{let R=j(N);return` ${B(N)}?: ${R};`}).join(`
|
|
2187
|
+
`)}
|
|
2188
|
+
}
|
|
2189
|
+
`:"",F=K.length>0?`
|
|
2190
|
+
static get observedAttributes(): string[] {
|
|
2191
|
+
return [${K.map((N)=>`'${N}'`).join(", ")}];
|
|
2192
|
+
}
|
|
2193
|
+
|
|
2194
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void {
|
|
2195
|
+
if (oldValue !== newValue) {
|
|
2196
|
+
const camelCase = name.replace(/-([a-z])/g, (_: string, letter: string) => letter.toUpperCase());
|
|
2197
|
+
(this as unknown as Record<string, unknown>)[\`_\${camelCase}\`] = this._parseAttributeValue(name, newValue);
|
|
2198
|
+
${G?"":"if (this._initialized) this._render();"}
|
|
2199
|
+
}
|
|
2200
|
+
}
|
|
2201
|
+
|
|
2202
|
+
private _parseAttributeValue(name: string, value: string | null): unknown {
|
|
2203
|
+
if (value === null) return null;
|
|
2204
|
+
const typeMap: Record<string, string> = ${JSON.stringify(q)};
|
|
2205
|
+
const type = typeMap[name] || 'string';
|
|
2206
|
+
switch (type) {
|
|
2207
|
+
case 'number': return Number(value);
|
|
2208
|
+
case 'boolean': return value !== 'false' && value !== '0';
|
|
2209
|
+
case 'object': try { return JSON.parse(value); }
|
|
2210
|
+
catch { return value; }
|
|
2211
|
+
default: return value;
|
|
2212
|
+
}
|
|
2213
|
+
}
|
|
2214
|
+
`:"",O=G?`
|
|
2215
|
+
private _createTemplate(): void {
|
|
2216
|
+
const template = document.createElement('template');
|
|
2217
|
+
template.innerHTML = \`${H}${U}\`;
|
|
2218
|
+
${Q?"this.shadowRoot!.appendChild(template.content.cloneNode(true));":"this.appendChild(template.content.cloneNode(true));"}
|
|
2219
|
+
this._processSlots();
|
|
2220
|
+
}`:`
|
|
2221
|
+
private _render(): void {
|
|
2222
|
+
${Q?"this.shadowRoot!.innerHTML":"this.innerHTML"} = \`${H}${U}\`;
|
|
2223
|
+
this._processSlots();
|
|
2224
|
+
}`;return`/**
|
|
2225
|
+
* ${Z} Web Component
|
|
2226
|
+
* Auto-generated from stx component (TypeScript)
|
|
2227
|
+
*
|
|
2228
|
+
* @example
|
|
2229
|
+
* \`\`\`html
|
|
2230
|
+
* <${J}></${J}>
|
|
2231
|
+
* \`\`\`
|
|
2232
|
+
*/
|
|
2233
|
+
|
|
2234
|
+
/**
|
|
2235
|
+
* Detail type for slot-changed event
|
|
2236
|
+
*/
|
|
2237
|
+
interface SlotChangeDetail {
|
|
2238
|
+
slotName: string;
|
|
2239
|
+
assignedNodes: Node[];
|
|
2240
|
+
}
|
|
2241
|
+
|
|
2242
|
+
${_}
|
|
2243
|
+
/**
|
|
2244
|
+
* ${Z} custom element class
|
|
2245
|
+
* @customElement ${J}
|
|
2246
|
+
*/
|
|
2247
|
+
export class ${W} extends ${X} {
|
|
2248
|
+
${V}
|
|
2249
|
+
private _initialized = false;
|
|
2250
|
+
${Q?"":"private _slotContent: Node[] = [];"}
|
|
2251
|
+
|
|
2252
|
+
constructor() {
|
|
2253
|
+
super();
|
|
2254
|
+
${Q?'this.attachShadow({ mode: "open" });':""}
|
|
2255
|
+
}
|
|
2256
|
+
${O}
|
|
2257
|
+
${Q?`
|
|
2258
|
+
private _processSlots(): void {
|
|
2259
|
+
const slots = this.shadowRoot!.querySelectorAll('slot');
|
|
2260
|
+
slots.forEach((slot) => {
|
|
2261
|
+
slot.addEventListener('slotchange', () => {
|
|
2262
|
+
const assignedNodes = (slot as HTMLSlotElement).assignedNodes();
|
|
2263
|
+
this.dispatchEvent(new CustomEvent<SlotChangeDetail>('slot-changed', {
|
|
2264
|
+
detail: { slotName: slot.getAttribute('name') || 'default', assignedNodes }
|
|
2265
|
+
}));
|
|
2266
|
+
});
|
|
2267
|
+
});
|
|
2268
|
+
}`:`
|
|
2269
|
+
private _processSlots(): void {
|
|
2270
|
+
const slots = this.querySelectorAll('[data-slot]');
|
|
2271
|
+
slots.forEach((slotEl) => {
|
|
2272
|
+
const slotName = slotEl.getAttribute('data-slot');
|
|
2273
|
+
if (slotName) {
|
|
2274
|
+
const slottedContent = this._slotContent.filter(
|
|
2275
|
+
node => node.nodeType === Node.ELEMENT_NODE && (node as Element).getAttribute('slot') === slotName
|
|
2276
|
+
);
|
|
2277
|
+
if (slottedContent.length > 0) {
|
|
2278
|
+
slotEl.innerHTML = '';
|
|
2279
|
+
slottedContent.forEach(content => slotEl.appendChild(content));
|
|
2280
|
+
}
|
|
2281
|
+
}
|
|
2282
|
+
});
|
|
2283
|
+
const defaultSlot = this.querySelector('[data-slot=""]') || this.querySelector('[data-default-slot]');
|
|
2284
|
+
if (defaultSlot) {
|
|
2285
|
+
const unslottedContent = this._slotContent.filter(
|
|
2286
|
+
node => node.nodeType !== Node.ELEMENT_NODE || !(node as Element).hasAttribute('slot')
|
|
2287
|
+
);
|
|
2288
|
+
if (unslottedContent.length > 0) {
|
|
2289
|
+
defaultSlot.innerHTML = '';
|
|
2290
|
+
unslottedContent.forEach(content => defaultSlot.appendChild(content));
|
|
2291
|
+
}
|
|
2292
|
+
}
|
|
2293
|
+
}`}
|
|
2294
|
+
${F}
|
|
2295
|
+
${L}
|
|
2296
|
+
|
|
2297
|
+
connectedCallback(): void {
|
|
2298
|
+
if (this._initialized) return;
|
|
2299
|
+
${Q?"":"this._slotContent = Array.from(this.childNodes);"}
|
|
2300
|
+
this._initialized = true;
|
|
2301
|
+
${G?"this._createTemplate();":"this._render();"}
|
|
2302
|
+
}
|
|
2303
|
+
|
|
2304
|
+
disconnectedCallback(): void {
|
|
2305
|
+
// Component removed from the DOM
|
|
2306
|
+
}
|
|
2307
|
+
|
|
2308
|
+
adoptedCallback(): void {
|
|
2309
|
+
// Component moved to a new document
|
|
2310
|
+
}
|
|
2311
|
+
}
|
|
2312
|
+
|
|
2313
|
+
// Type augmentation for HTMLElementTagNameMap
|
|
2314
|
+
declare global {
|
|
2315
|
+
interface HTMLElementTagNameMap {
|
|
2316
|
+
'${J}': ${W};
|
|
2317
|
+
}
|
|
2318
|
+
}
|
|
2319
|
+
|
|
2320
|
+
// Register the web component
|
|
2321
|
+
customElements.define('${J}', ${W});
|
|
2322
|
+
`}var D5={strategy:"attribute",attributeName:"data-v",preserveOriginal:!0};function M5($){let Z=$.split("").reduce((J,X)=>(J<<5)-J+X.charCodeAt(0)|0,0);return Math.abs(Z).toString(36).slice(0,8)}function EX($,Z,J={}){let X={...D5,...J},Y=M5(Z);switch(X.strategy){case"shadow":return $;case"prefix":return yX($,X.prefix||Z,X.preserveOriginal);case"attribute":return bX($,Y,X.attributeName||"data-v",X.preserveOriginal);case"bem":return CX($,Z,X.preserveOriginal);default:return $}}function bX($,Z,J,X){let Y=`[${J}-${Z}]`;return $.replace(/([.#]?[\w-]+|\*)\s*(\{|,)/g,(Q,G,z)=>{if(G.startsWith("@"))return Q;if(/^(?::root|:host|html|body)$/i.test(G))return Q;return`${X?`${G}${Y}`:`${G}${Y}`}${z}`})}function yX($,Z,J){return $.replace(/\.([a-z_][\w-]*)/gi,(X,Y)=>{if(Y.startsWith(Z))return X;let Q=`${Z}__${Y}`;return J?`.${Q}`:`.${Q}`})}function CX($,Z,J){let X=Z.replace(/[^a-z0-9]/gi,"-");return $.replace(/\.([a-z_][\w-]*)/gi,(Y,Q)=>{if(Q.includes("__")||Q.includes("--")){if(!Q.startsWith(X))return`.${X}__${Q}`;return Y}let G=`${X}__${Q}`;return J?`.${G}`:`.${G}`})}function SX($,Z,J={}){let X={...D5,...J};if(X.strategy==="shadow")return $;if(X.strategy==="attribute"){let Y=M5(Z),G=`${X.attributeName||"data-v"}-${Y}`;return $.replace(/<([a-z][a-z0-9-]*)([^>]*)>/gi,(z,K,q)=>{if(/^(?:script|style|!--)$/i.test(K))return z;let W=q.trimEnd().endsWith("/"),U=W?q.slice(0,-1):q;return`<${K}${U} ${G}${W?"/":""}>`})}if(X.strategy==="prefix"||X.strategy==="bem"){let Y=X.strategy==="bem"?Z.replace(/[^a-z0-9]/gi,"-"):X.prefix||Z;return $.replace(/\bclass\s*=\s*["']([^"']+)["']/gi,(Q,G)=>{return`class="${G.split(/\s+/).map((K)=>{if(!K)return K;if(K.startsWith(Y))return K;return`${Y}__${K}`}).join(" ")}"`})}return $}function cW($,Z={}){let J={...D5,...Z},X=M5($);return`${J.attributeName||"data-v"}-${X}`}function pW($,Z,J={}){let X="",Y=$.replace(/<style([^>]*)>([\s\S]*?)<\/style>/gi,(G,z,K)=>{if(/\bscoped\b/i.test(z)||J.strategy!=="shadow")X+=`${EX(K,Z,J)}
|
|
2323
|
+
`;else X+=`${K}
|
|
2324
|
+
`;return""});return{html:SX(Y,Z,J),css:X.trim()}}function f1($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function iW($){let{name:Z,tag:J,baseElement:X="HTMLElement",template:Y,styles:Q="",shadowDOM:G=!0,properties:z={},lifecycle:K={},events:q={},methods:W={},state:U={}}=$,H=Z.replace(/\W/g,""),j=Object.keys(z),B=j.filter((T)=>z[T].attribute!==!1).map((T)=>z[T].attribute||f1(T)),V=j.map((T)=>{let D=z[T],I=D.default!==void 0?JSON.stringify(D.default):D.type==="string"?'""':D.type==="number"?"0":D.type==="boolean"?"false":D.type==="array"?"[]":"{}";return` this._${T} = ${I};`}).join(`
|
|
2325
|
+
`),L=j.map((T)=>{let D=z[T],I=D.attribute!==!1?D.attribute||f1(T):null,E=D.reflect&&I?`
|
|
2326
|
+
if (value !== null && value !== undefined) {
|
|
2327
|
+
${D.type==="boolean"?`if (value) { this.setAttribute('${I}', ''); }
|
|
2328
|
+
else { this.removeAttribute('${I}'); }`:`this.setAttribute('${I}', ${D.type==="object"||D.type==="array"?"JSON.stringify(value)":"String(value)"});`}
|
|
2329
|
+
}
|
|
2330
|
+
else {
|
|
2331
|
+
this.removeAttribute('${I}');
|
|
2332
|
+
}`:"",A=D.observer?`this.${D.observer}(value, oldValue);`:"",k=D.render!==!1?"this._scheduleRender();":"";return`
|
|
2333
|
+
get ${T}() {
|
|
2334
|
+
return this._${T};
|
|
2335
|
+
}
|
|
2336
|
+
|
|
2337
|
+
set ${T}(value) {
|
|
2338
|
+
const oldValue = this._${T};
|
|
2339
|
+
if (oldValue === value) return;
|
|
2340
|
+
this._${T} = value;${E}
|
|
2341
|
+
${A}
|
|
2342
|
+
${k}
|
|
2343
|
+
this.dispatchEvent(new CustomEvent('${T}-changed', {
|
|
2344
|
+
detail: { value, oldValue },
|
|
2345
|
+
bubbles: true
|
|
2346
|
+
}));
|
|
2347
|
+
}`}).join(`
|
|
2348
|
+
`),_=B.length>0?`
|
|
2349
|
+
static get observedAttributes() {
|
|
2350
|
+
return [${B.map((T)=>`'${T}'`).join(", ")}];
|
|
2351
|
+
}
|
|
2352
|
+
|
|
2353
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
2354
|
+
if (oldValue === newValue) return;
|
|
2355
|
+
const propName = this._attrToProp[name];
|
|
2356
|
+
if (propName) {
|
|
2357
|
+
const propDef = this._propertyDefs[propName];
|
|
2358
|
+
this[propName] = this._deserializeAttribute(newValue, propDef.type);
|
|
2359
|
+
}
|
|
2360
|
+
${K.attributeChanged||""}
|
|
2361
|
+
}`:"",F=Object.entries(q).map(([T,D])=>{return`this._root.addEventListener('${T}', (e) => { ${D} });`}).join(`
|
|
2362
|
+
`),O=Object.entries(W).map(([T,D])=>{return`
|
|
2363
|
+
${T}() {
|
|
2364
|
+
${D}
|
|
2365
|
+
}`}).join(`
|
|
2366
|
+
`),w=JSON.stringify(Object.fromEntries(j.map((T)=>[T,z[T]]))),N=JSON.stringify(Object.fromEntries(j.filter((T)=>z[T].attribute!==!1).map((T)=>[z[T].attribute||f1(T),T]))),R=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),M=Q.replace(/\\/g,"\\\\").replace(/`/g,"\\`");return`/**
|
|
2367
|
+
* ${Z} - Reactive Web Component
|
|
2368
|
+
* Auto-generated with reactive properties and lifecycle management
|
|
2369
|
+
*
|
|
2370
|
+
* @customElement ${J}
|
|
2371
|
+
*/
|
|
2372
|
+
class ${H} extends ${X} {
|
|
2373
|
+
// Property definitions
|
|
2374
|
+
_propertyDefs = ${w};
|
|
2375
|
+
_attrToProp = ${N};
|
|
2376
|
+
|
|
2377
|
+
// Internal state
|
|
2378
|
+
_state = ${JSON.stringify(U)};
|
|
2379
|
+
_renderPending = false;
|
|
2380
|
+
_isConnected = false;
|
|
2381
|
+
|
|
2382
|
+
constructor() {
|
|
2383
|
+
super();
|
|
2384
|
+
${G?'this.attachShadow({ mode: "open" });':""}
|
|
2385
|
+
this._root = ${G?"this.shadowRoot":"this"};
|
|
2386
|
+
|
|
2387
|
+
// Initialize properties with defaults
|
|
2388
|
+
${V}
|
|
2389
|
+
|
|
2390
|
+
// Initial render
|
|
2391
|
+
this._render();
|
|
2392
|
+
}
|
|
2393
|
+
|
|
2394
|
+
// =========================================================================
|
|
2395
|
+
// Reactive Properties
|
|
2396
|
+
// =========================================================================
|
|
2397
|
+
${L}
|
|
2398
|
+
|
|
2399
|
+
// =========================================================================
|
|
2400
|
+
// State Management
|
|
2401
|
+
// =========================================================================
|
|
2402
|
+
|
|
2403
|
+
/**
|
|
2404
|
+
* Get current internal state
|
|
2405
|
+
*/
|
|
2406
|
+
get state() {
|
|
2407
|
+
return { ...this._state };
|
|
2408
|
+
}
|
|
2409
|
+
|
|
2410
|
+
/**
|
|
2411
|
+
* Update internal state and trigger re-render
|
|
2412
|
+
* @param {Object} updates - State updates to merge
|
|
2413
|
+
*/
|
|
2414
|
+
setState(updates) {
|
|
2415
|
+
const oldState = { ...this._state };
|
|
2416
|
+
this._state = { ...this._state, ...updates };
|
|
2417
|
+
this._scheduleRender();
|
|
2418
|
+
this.dispatchEvent(new CustomEvent('state-changed', {
|
|
2419
|
+
detail: { state: this._state, oldState },
|
|
2420
|
+
bubbles: true
|
|
2421
|
+
}));
|
|
2422
|
+
}
|
|
2423
|
+
|
|
2424
|
+
// =========================================================================
|
|
2425
|
+
// Rendering
|
|
2426
|
+
// =========================================================================
|
|
2427
|
+
|
|
2428
|
+
/**
|
|
2429
|
+
* Schedule a render on the next animation frame (batched)
|
|
2430
|
+
*/
|
|
2431
|
+
_scheduleRender() {
|
|
2432
|
+
if (this._renderPending) return;
|
|
2433
|
+
this._renderPending = true;
|
|
2434
|
+
requestAnimationFrame(() => {
|
|
2435
|
+
this._renderPending = false;
|
|
2436
|
+
this._render();
|
|
2437
|
+
});
|
|
2438
|
+
}
|
|
2439
|
+
|
|
2440
|
+
/**
|
|
2441
|
+
* Render the component template
|
|
2442
|
+
*/
|
|
2443
|
+
_render() {
|
|
2444
|
+
const template = \`${M?`<style>${M}</style>`:""}${R}\`;
|
|
2445
|
+
|
|
2446
|
+
// Interpolate template with property values
|
|
2447
|
+
const rendered = template.replace(/\\{\\{\\s*(\\w+)\\s*\\}\\}/g, (match, propName) => {
|
|
2448
|
+
if (propName in this) {
|
|
2449
|
+
const value = this[propName];
|
|
2450
|
+
if (value === null || value === undefined) return '';
|
|
2451
|
+
if (typeof value === 'object') return JSON.stringify(value);
|
|
2452
|
+
return String(value);
|
|
2453
|
+
}
|
|
2454
|
+
if (propName in this._state) {
|
|
2455
|
+
const value = this._state[propName];
|
|
2456
|
+
if (value === null || value === undefined) return '';
|
|
2457
|
+
if (typeof value === 'object') return JSON.stringify(value);
|
|
2458
|
+
return String(value);
|
|
2459
|
+
}
|
|
2460
|
+
return match;
|
|
2461
|
+
});
|
|
2462
|
+
|
|
2463
|
+
this._root.innerHTML = rendered;
|
|
2464
|
+
this._bindEvents();
|
|
2465
|
+
}
|
|
2466
|
+
|
|
2467
|
+
/**
|
|
2468
|
+
* Bind event handlers after render
|
|
2469
|
+
*/
|
|
2470
|
+
_bindEvents() {
|
|
2471
|
+
${F}
|
|
2472
|
+
}
|
|
2473
|
+
|
|
2474
|
+
// =========================================================================
|
|
2475
|
+
// Attribute Handling
|
|
2476
|
+
// =========================================================================
|
|
2477
|
+
|
|
2478
|
+
/**
|
|
2479
|
+
* Deserialize attribute value to property type
|
|
2480
|
+
*/
|
|
2481
|
+
_deserializeAttribute(value, type) {
|
|
2482
|
+
if (value === null) return null;
|
|
2483
|
+
switch (type) {
|
|
2484
|
+
case 'number': return Number(value);
|
|
2485
|
+
case 'boolean': return value !== null && value !== 'false' && value !== '0';
|
|
2486
|
+
case 'object':
|
|
2487
|
+
case 'array':
|
|
2488
|
+
try { return JSON.parse(value); }
|
|
2489
|
+
catch { return type === 'array' ? [] : {}; }
|
|
2490
|
+
default: return value;
|
|
2491
|
+
}
|
|
2492
|
+
}
|
|
2493
|
+
|
|
2494
|
+
${_}
|
|
2495
|
+
|
|
2496
|
+
// =========================================================================
|
|
2497
|
+
// Lifecycle
|
|
2498
|
+
// =========================================================================
|
|
2499
|
+
|
|
2500
|
+
connectedCallback() {
|
|
2501
|
+
this._isConnected = true;
|
|
2502
|
+
${K.connected||"// Component connected to DOM"}
|
|
2503
|
+
}
|
|
2504
|
+
|
|
2505
|
+
disconnectedCallback() {
|
|
2506
|
+
this._isConnected = false;
|
|
2507
|
+
${K.disconnected||"// Component disconnected from DOM"}
|
|
2508
|
+
}
|
|
2509
|
+
|
|
2510
|
+
adoptedCallback() {
|
|
2511
|
+
${K.adopted||"// Component moved to new document"}
|
|
2512
|
+
}
|
|
2513
|
+
|
|
2514
|
+
// =========================================================================
|
|
2515
|
+
// Custom Methods
|
|
2516
|
+
// =========================================================================
|
|
2517
|
+
${O}
|
|
2518
|
+
}
|
|
2519
|
+
|
|
2520
|
+
// Register the custom element
|
|
2521
|
+
customElements.define('${J}', ${H});
|
|
2522
|
+
|
|
2523
|
+
// Export for module usage
|
|
2524
|
+
export { ${H} };
|
|
2525
|
+
export default ${H};
|
|
2526
|
+
`}function nW($){let{name:Z,tag:J,baseElement:X="HTMLElement",template:Y,styles:Q="",shadowDOM:G=!0,properties:z={},lifecycle:K={},events:q={},methods:W={},state:U={}}=$,H=Z.replace(/\W/g,""),j=Object.keys(z),B=j.filter((D)=>z[D].attribute!==!1).map((D)=>z[D].attribute||f1(D)),V=(D)=>{switch(D){case"string":return"string";case"number":return"number";case"boolean":return"boolean";case"object":return"Record<string, unknown>";case"array":return"unknown[]";default:return"unknown"}},L=j.length>0?`
|
|
2527
|
+
/**
|
|
2528
|
+
* Props interface for ${Z}
|
|
2529
|
+
*/
|
|
2530
|
+
export interface ${H}Props {
|
|
2531
|
+
${j.map((D)=>` ${D}?: ${V(z[D].type)};`).join(`
|
|
2532
|
+
`)}
|
|
2533
|
+
}
|
|
2534
|
+
`:"",_=Object.keys(U).length>0?`
|
|
2535
|
+
/**
|
|
2536
|
+
* State interface for ${Z}
|
|
2537
|
+
*/
|
|
2538
|
+
export interface ${H}State {
|
|
2539
|
+
${Object.entries(U).map(([D,I])=>` ${D}: ${typeof I};`).join(`
|
|
2540
|
+
`)}
|
|
2541
|
+
}
|
|
2542
|
+
`:`
|
|
2543
|
+
export interface ${H}State {
|
|
2544
|
+
[key: string]: unknown;
|
|
2545
|
+
}
|
|
2546
|
+
`,F=j.map((D)=>{let I=z[D],E=V(I.type);return` private _${D}: ${E};`}).join(`
|
|
2547
|
+
`),O=j.map((D)=>{let I=z[D],E=V(I.type),A=I.attribute!==!1?I.attribute||f1(D):null,k=I.default!==void 0?JSON.stringify(I.default):I.type==="string"?'""':I.type==="number"?"0":I.type==="boolean"?"false":I.type==="array"?"[]":"{}",C=I.reflect&&A?`
|
|
2548
|
+
if (value !== null && value !== undefined) {
|
|
2549
|
+
${I.type==="boolean"?`if (value) { this.setAttribute('${A}', ''); }
|
|
2550
|
+
else { this.removeAttribute('${A}'); }`:`this.setAttribute('${A}', ${I.type==="object"||I.type==="array"?"JSON.stringify(value)":"String(value)"});`}
|
|
2551
|
+
}
|
|
2552
|
+
else {
|
|
2553
|
+
this.removeAttribute('${A}');
|
|
2554
|
+
}`:"",y=I.observer?`this.${I.observer}(value, oldValue);`:"",b=I.render!==!1?"this._scheduleRender();":"";return`
|
|
2555
|
+
get ${D}(): ${E} {
|
|
2556
|
+
return this._${D};
|
|
2557
|
+
}
|
|
2558
|
+
|
|
2559
|
+
set ${D}(value: ${E}) {
|
|
2560
|
+
const oldValue = this._${D};
|
|
2561
|
+
if (oldValue === value) return;
|
|
2562
|
+
this._${D} = value;${C}
|
|
2563
|
+
${y}
|
|
2564
|
+
${b}
|
|
2565
|
+
this.dispatchEvent(new CustomEvent('${D}-changed', {
|
|
2566
|
+
detail: { value, oldValue },
|
|
2567
|
+
bubbles: true
|
|
2568
|
+
}));
|
|
2569
|
+
}
|
|
2570
|
+
|
|
2571
|
+
// Property default: ${k}`}).join(`
|
|
2572
|
+
`),w=B.length>0?`
|
|
2573
|
+
static get observedAttributes(): string[] {
|
|
2574
|
+
return [${B.map((D)=>`'${D}'`).join(", ")}];
|
|
2575
|
+
}
|
|
2576
|
+
|
|
2577
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void {
|
|
2578
|
+
if (oldValue === newValue) return;
|
|
2579
|
+
const propName = this._attrToProp[name];
|
|
2580
|
+
if (propName) {
|
|
2581
|
+
const propDef = this._propertyDefs[propName];
|
|
2582
|
+
(this as unknown as Record<string, unknown>)[propName] = this._deserializeAttribute(newValue, propDef.type);
|
|
2583
|
+
}
|
|
2584
|
+
${K.attributeChanged||""}
|
|
2585
|
+
}`:"",N=Object.entries(q).map(([D,I])=>{return`this._root.addEventListener('${D}', (e: Event) => { ${I} });`}).join(`
|
|
2586
|
+
`),R=Object.entries(W).map(([D,I])=>{return`
|
|
2587
|
+
${D}(): void {
|
|
2588
|
+
${I}
|
|
2589
|
+
}`}).join(`
|
|
2590
|
+
`),M=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),T=Q.replace(/\\/g,"\\\\").replace(/`/g,"\\`");return`/**
|
|
2591
|
+
* ${Z} - Reactive Web Component (TypeScript)
|
|
2592
|
+
* Auto-generated with reactive properties and lifecycle management
|
|
2593
|
+
*
|
|
2594
|
+
* @customElement ${J}
|
|
2595
|
+
*/
|
|
2596
|
+
|
|
2597
|
+
${L}
|
|
2598
|
+
${_}
|
|
2599
|
+
|
|
2600
|
+
/**
|
|
2601
|
+
* Property definition type
|
|
2602
|
+
*/
|
|
2603
|
+
interface PropertyDefinition {
|
|
2604
|
+
type: 'string' | 'number' | 'boolean' | 'object' | 'array';
|
|
2605
|
+
default?: unknown;
|
|
2606
|
+
reflect?: boolean;
|
|
2607
|
+
attribute?: string | false;
|
|
2608
|
+
observer?: string;
|
|
2609
|
+
render?: boolean;
|
|
2610
|
+
}
|
|
2611
|
+
|
|
2612
|
+
/**
|
|
2613
|
+
* ${Z} custom element
|
|
2614
|
+
*/
|
|
2615
|
+
export class ${H} extends ${X} {
|
|
2616
|
+
// Property definitions
|
|
2617
|
+
private _propertyDefs: Record<string, PropertyDefinition> = ${JSON.stringify(z)};
|
|
2618
|
+
private _attrToProp: Record<string, string> = ${JSON.stringify(Object.fromEntries(j.filter((D)=>z[D].attribute!==!1).map((D)=>[z[D].attribute||f1(D),D])))};
|
|
2619
|
+
|
|
2620
|
+
// Internal state
|
|
2621
|
+
private _state: ${H}State = ${JSON.stringify(U)};
|
|
2622
|
+
private _renderPending = false;
|
|
2623
|
+
private _isConnected = false;
|
|
2624
|
+
private _root: ShadowRoot | HTMLElement;
|
|
2625
|
+
|
|
2626
|
+
// Property backing fields
|
|
2627
|
+
${F}
|
|
2628
|
+
|
|
2629
|
+
constructor() {
|
|
2630
|
+
super();
|
|
2631
|
+
${G?'this.attachShadow({ mode: "open" });':""}
|
|
2632
|
+
this._root = ${G?"this.shadowRoot!":"this"};
|
|
2633
|
+
|
|
2634
|
+
// Initialize properties with defaults
|
|
2635
|
+
${j.map((D)=>{let I=z[D],E=I.default!==void 0?JSON.stringify(I.default):I.type==="string"?'""':I.type==="number"?"0":I.type==="boolean"?"false":I.type==="array"?"[]":"{}";return` this._${D} = ${E};`}).join(`
|
|
2636
|
+
`)}
|
|
2637
|
+
|
|
2638
|
+
// Initial render
|
|
2639
|
+
this._render();
|
|
2640
|
+
}
|
|
2641
|
+
|
|
2642
|
+
// =========================================================================
|
|
2643
|
+
// Reactive Properties
|
|
2644
|
+
// =========================================================================
|
|
2645
|
+
${O}
|
|
2646
|
+
|
|
2647
|
+
// =========================================================================
|
|
2648
|
+
// State Management
|
|
2649
|
+
// =========================================================================
|
|
2650
|
+
|
|
2651
|
+
/**
|
|
2652
|
+
* Get current internal state
|
|
2653
|
+
*/
|
|
2654
|
+
get state(): ${H}State {
|
|
2655
|
+
return { ...this._state };
|
|
2656
|
+
}
|
|
2657
|
+
|
|
2658
|
+
/**
|
|
2659
|
+
* Update internal state and trigger re-render
|
|
2660
|
+
*/
|
|
2661
|
+
setState(updates: Partial<${H}State>): void {
|
|
2662
|
+
const oldState = { ...this._state };
|
|
2663
|
+
this._state = { ...this._state, ...updates };
|
|
2664
|
+
this._scheduleRender();
|
|
2665
|
+
this.dispatchEvent(new CustomEvent('state-changed', {
|
|
2666
|
+
detail: { state: this._state, oldState },
|
|
2667
|
+
bubbles: true
|
|
2668
|
+
}));
|
|
2669
|
+
}
|
|
2670
|
+
|
|
2671
|
+
// =========================================================================
|
|
2672
|
+
// Rendering
|
|
2673
|
+
// =========================================================================
|
|
2674
|
+
|
|
2675
|
+
/**
|
|
2676
|
+
* Schedule a render on the next animation frame (batched)
|
|
2677
|
+
*/
|
|
2678
|
+
private _scheduleRender(): void {
|
|
2679
|
+
if (this._renderPending) return;
|
|
2680
|
+
this._renderPending = true;
|
|
2681
|
+
requestAnimationFrame(() => {
|
|
2682
|
+
this._renderPending = false;
|
|
2683
|
+
this._render();
|
|
2684
|
+
});
|
|
2685
|
+
}
|
|
2686
|
+
|
|
2687
|
+
/**
|
|
2688
|
+
* Render the component template
|
|
2689
|
+
*/
|
|
2690
|
+
private _render(): void {
|
|
2691
|
+
const template = \`${T?`<style>${T}</style>`:""}${M}\`;
|
|
2692
|
+
|
|
2693
|
+
// Interpolate template with property values
|
|
2694
|
+
const rendered = template.replace(/\\{\\{\\s*(\\w+)\\s*\\}\\}/g, (match, propName) => {
|
|
2695
|
+
if (propName in this) {
|
|
2696
|
+
const value = (this as unknown as Record<string, unknown>)[propName];
|
|
2697
|
+
if (value === null || value === undefined) return '';
|
|
2698
|
+
if (typeof value === 'object') return JSON.stringify(value);
|
|
2699
|
+
return String(value);
|
|
2700
|
+
}
|
|
2701
|
+
if (propName in this._state) {
|
|
2702
|
+
const value = this._state[propName as keyof ${H}State];
|
|
2703
|
+
if (value === null || value === undefined) return '';
|
|
2704
|
+
if (typeof value === 'object') return JSON.stringify(value);
|
|
2705
|
+
return String(value);
|
|
2706
|
+
}
|
|
2707
|
+
return match;
|
|
2708
|
+
});
|
|
2709
|
+
|
|
2710
|
+
this._root.innerHTML = rendered;
|
|
2711
|
+
this._bindEvents();
|
|
2712
|
+
}
|
|
2713
|
+
|
|
2714
|
+
/**
|
|
2715
|
+
* Bind event handlers after render
|
|
2716
|
+
*/
|
|
2717
|
+
private _bindEvents(): void {
|
|
2718
|
+
${N}
|
|
2719
|
+
}
|
|
2720
|
+
|
|
2721
|
+
// =========================================================================
|
|
2722
|
+
// Attribute Handling
|
|
2723
|
+
// =========================================================================
|
|
2724
|
+
|
|
2725
|
+
/**
|
|
2726
|
+
* Deserialize attribute value to property type
|
|
2727
|
+
*/
|
|
2728
|
+
private _deserializeAttribute(value: string | null, type: string): unknown {
|
|
2729
|
+
if (value === null) return null;
|
|
2730
|
+
switch (type) {
|
|
2731
|
+
case 'number': return Number(value);
|
|
2732
|
+
case 'boolean': return value !== null && value !== 'false' && value !== '0';
|
|
2733
|
+
case 'object':
|
|
2734
|
+
case 'array':
|
|
2735
|
+
try { return JSON.parse(value); }
|
|
2736
|
+
catch { return type === 'array' ? [] : {}; }
|
|
2737
|
+
default: return value;
|
|
2738
|
+
}
|
|
2739
|
+
}
|
|
2740
|
+
|
|
2741
|
+
${w}
|
|
2742
|
+
|
|
2743
|
+
// =========================================================================
|
|
2744
|
+
// Lifecycle
|
|
2745
|
+
// =========================================================================
|
|
2746
|
+
|
|
2747
|
+
connectedCallback(): void {
|
|
2748
|
+
this._isConnected = true;
|
|
2749
|
+
${K.connected||"// Component connected to DOM"}
|
|
2750
|
+
}
|
|
2751
|
+
|
|
2752
|
+
disconnectedCallback(): void {
|
|
2753
|
+
this._isConnected = false;
|
|
2754
|
+
${K.disconnected||"// Component disconnected from DOM"}
|
|
2755
|
+
}
|
|
2756
|
+
|
|
2757
|
+
adoptedCallback(): void {
|
|
2758
|
+
${K.adopted||"// Component moved to new document"}
|
|
2759
|
+
}
|
|
2760
|
+
|
|
2761
|
+
// =========================================================================
|
|
2762
|
+
// Custom Methods
|
|
2763
|
+
// =========================================================================
|
|
2764
|
+
${R}
|
|
2765
|
+
}
|
|
2766
|
+
|
|
2767
|
+
// Type augmentation for HTMLElementTagNameMap
|
|
2768
|
+
declare global {
|
|
2769
|
+
interface HTMLElementTagNameMap {
|
|
2770
|
+
'${J}': ${H};
|
|
2771
|
+
}
|
|
2772
|
+
}
|
|
2773
|
+
|
|
2774
|
+
// Register the custom element
|
|
2775
|
+
customElements.define('${J}', ${H});
|
|
2776
|
+
|
|
2777
|
+
export default ${H};
|
|
2778
|
+
`}function oW(){return`/**
|
|
2779
|
+
* ReactiveElement Mixin
|
|
2780
|
+
* Adds reactive properties and lifecycle management to web components
|
|
2781
|
+
*/
|
|
2782
|
+
const ReactiveElement = (Base) => class extends Base {
|
|
2783
|
+
static get observedAttributes() {
|
|
2784
|
+
const props = this.properties || {};
|
|
2785
|
+
return Object.keys(props)
|
|
2786
|
+
.filter(prop => props[prop].attribute !== false)
|
|
2787
|
+
.map(prop => props[prop].attribute || prop.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase());
|
|
2788
|
+
}
|
|
2789
|
+
|
|
2790
|
+
constructor() {
|
|
2791
|
+
super();
|
|
2792
|
+
this._state = {};
|
|
2793
|
+
this._renderPending = false;
|
|
2794
|
+
this._propertyValues = new Map();
|
|
2795
|
+
this._initializeProperties();
|
|
2796
|
+
}
|
|
2797
|
+
|
|
2798
|
+
_initializeProperties() {
|
|
2799
|
+
const props = this.constructor.properties || {};
|
|
2800
|
+
for (const [name, def] of Object.entries(props)) {
|
|
2801
|
+
// Set default value
|
|
2802
|
+
if (def.default !== undefined) {
|
|
2803
|
+
this._propertyValues.set(name, def.default);
|
|
2804
|
+
}
|
|
2805
|
+
|
|
2806
|
+
// Define getter/setter
|
|
2807
|
+
Object.defineProperty(this, name, {
|
|
2808
|
+
get: () => this._propertyValues.get(name),
|
|
2809
|
+
set: (value) => {
|
|
2810
|
+
const oldValue = this._propertyValues.get(name);
|
|
2811
|
+
if (oldValue === value) return;
|
|
2812
|
+
this._propertyValues.set(name, value);
|
|
2813
|
+
|
|
2814
|
+
// Reflect to attribute
|
|
2815
|
+
if (def.reflect) {
|
|
2816
|
+
const attrName = def.attribute || name.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
|
|
2817
|
+
if (def.type === 'boolean') {
|
|
2818
|
+
value ? this.setAttribute(attrName, '') : this.removeAttribute(attrName);
|
|
2819
|
+
}
|
|
2820
|
+
else {
|
|
2821
|
+
this.setAttribute(attrName, def.type === 'object' ? JSON.stringify(value) : String(value));
|
|
2822
|
+
}
|
|
2823
|
+
}
|
|
2824
|
+
|
|
2825
|
+
// Call observer
|
|
2826
|
+
if (def.observer && typeof this[def.observer] === 'function') {
|
|
2827
|
+
this[def.observer](value, oldValue);
|
|
2828
|
+
}
|
|
2829
|
+
|
|
2830
|
+
// Schedule render
|
|
2831
|
+
if (def.render !== false) {
|
|
2832
|
+
this._scheduleRender();
|
|
2833
|
+
}
|
|
2834
|
+
|
|
2835
|
+
// Dispatch event
|
|
2836
|
+
this.dispatchEvent(new CustomEvent(\`\${name}-changed\`, {
|
|
2837
|
+
detail: { value, oldValue },
|
|
2838
|
+
bubbles: true
|
|
2839
|
+
}));
|
|
2840
|
+
},
|
|
2841
|
+
enumerable: true,
|
|
2842
|
+
configurable: true
|
|
2843
|
+
});
|
|
2844
|
+
}
|
|
2845
|
+
}
|
|
2846
|
+
|
|
2847
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
2848
|
+
if (oldValue === newValue) return;
|
|
2849
|
+
const props = this.constructor.properties || {};
|
|
2850
|
+
const propName = Object.keys(props).find(p =>
|
|
2851
|
+
(props[p].attribute || p.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase()) === name
|
|
2852
|
+
);
|
|
2853
|
+
if (propName) {
|
|
2854
|
+
const def = props[propName];
|
|
2855
|
+
this[propName] = this._deserialize(newValue, def.type);
|
|
2856
|
+
}
|
|
2857
|
+
}
|
|
2858
|
+
|
|
2859
|
+
_deserialize(value, type) {
|
|
2860
|
+
if (value === null) return null;
|
|
2861
|
+
switch (type) {
|
|
2862
|
+
case 'number': return Number(value);
|
|
2863
|
+
case 'boolean': return value !== null && value !== 'false';
|
|
2864
|
+
case 'object':
|
|
2865
|
+
case 'array':
|
|
2866
|
+
try { return JSON.parse(value); }
|
|
2867
|
+
catch { return type === 'array' ? [] : {}; }
|
|
2868
|
+
default: return value;
|
|
2869
|
+
}
|
|
2870
|
+
}
|
|
2871
|
+
|
|
2872
|
+
get state() {
|
|
2873
|
+
return { ...this._state };
|
|
2874
|
+
}
|
|
2875
|
+
|
|
2876
|
+
setState(updates) {
|
|
2877
|
+
const oldState = { ...this._state };
|
|
2878
|
+
this._state = { ...this._state, ...updates };
|
|
2879
|
+
this._scheduleRender();
|
|
2880
|
+
this.dispatchEvent(new CustomEvent('state-changed', {
|
|
2881
|
+
detail: { state: this._state, oldState },
|
|
2882
|
+
bubbles: true
|
|
2883
|
+
}));
|
|
2884
|
+
}
|
|
2885
|
+
|
|
2886
|
+
_scheduleRender() {
|
|
2887
|
+
if (this._renderPending) return;
|
|
2888
|
+
this._renderPending = true;
|
|
2889
|
+
requestAnimationFrame(() => {
|
|
2890
|
+
this._renderPending = false;
|
|
2891
|
+
if (typeof this.render === 'function') {
|
|
2892
|
+
this.render();
|
|
2893
|
+
}
|
|
2894
|
+
});
|
|
2895
|
+
}
|
|
2896
|
+
};
|
|
2897
|
+
|
|
2898
|
+
export { ReactiveElement };
|
|
2899
|
+
export default ReactiveElement;
|
|
2900
|
+
`}function sW(){return`/**
|
|
2901
|
+
* stx Reactive Web Components Runtime
|
|
2902
|
+
* Provides base classes and utilities for reactive web components
|
|
2903
|
+
*/
|
|
2904
|
+
(function(global) {
|
|
2905
|
+
'use strict';
|
|
2906
|
+
|
|
2907
|
+
/**
|
|
2908
|
+
* Base class for reactive web components
|
|
2909
|
+
*/
|
|
2910
|
+
class StxElement extends HTMLElement {
|
|
2911
|
+
static get observedAttributes() {
|
|
2912
|
+
const props = this.properties || {};
|
|
2913
|
+
return Object.keys(props)
|
|
2914
|
+
.filter(prop => props[prop].attribute !== false)
|
|
2915
|
+
.map(prop => props[prop].attribute || toKebabCase(prop));
|
|
2916
|
+
}
|
|
2917
|
+
|
|
2918
|
+
constructor() {
|
|
2919
|
+
super();
|
|
2920
|
+
this._state = {};
|
|
2921
|
+
this._renderPending = false;
|
|
2922
|
+
this._props = new Map();
|
|
2923
|
+
this._setupShadowDOM();
|
|
2924
|
+
this._initProperties();
|
|
2925
|
+
}
|
|
2926
|
+
|
|
2927
|
+
_setupShadowDOM() {
|
|
2928
|
+
if (this.constructor.useShadowDOM !== false) {
|
|
2929
|
+
this.attachShadow({ mode: 'open' });
|
|
2930
|
+
this._root = this.shadowRoot;
|
|
2931
|
+
}
|
|
2932
|
+
else {
|
|
2933
|
+
this._root = this;
|
|
2934
|
+
}
|
|
2935
|
+
}
|
|
2936
|
+
|
|
2937
|
+
_initProperties() {
|
|
2938
|
+
const props = this.constructor.properties || {};
|
|
2939
|
+
for (const [name, def] of Object.entries(props)) {
|
|
2940
|
+
let value = def.default;
|
|
2941
|
+
this._props.set(name, value);
|
|
2942
|
+
|
|
2943
|
+
Object.defineProperty(this, name, {
|
|
2944
|
+
get: () => this._props.get(name),
|
|
2945
|
+
set: (newValue) => this._setProperty(name, newValue, def),
|
|
2946
|
+
enumerable: true
|
|
2947
|
+
});
|
|
2948
|
+
}
|
|
2949
|
+
}
|
|
2950
|
+
|
|
2951
|
+
_setProperty(name, value, def) {
|
|
2952
|
+
const oldValue = this._props.get(name);
|
|
2953
|
+
if (oldValue === value) return;
|
|
2954
|
+
|
|
2955
|
+
this._props.set(name, value);
|
|
2956
|
+
|
|
2957
|
+
if (def.reflect && def.attribute !== false) {
|
|
2958
|
+
this._reflectToAttribute(name, value, def);
|
|
2959
|
+
}
|
|
2960
|
+
|
|
2961
|
+
if (def.observer && this[def.observer]) {
|
|
2962
|
+
this[def.observer](value, oldValue);
|
|
2963
|
+
}
|
|
2964
|
+
|
|
2965
|
+
if (def.render !== false) {
|
|
2966
|
+
this.requestUpdate();
|
|
2967
|
+
}
|
|
2968
|
+
|
|
2969
|
+
this.dispatchEvent(new CustomEvent(name + '-changed', {
|
|
2970
|
+
detail: { value, oldValue },
|
|
2971
|
+
bubbles: true,
|
|
2972
|
+
composed: true
|
|
2973
|
+
}));
|
|
2974
|
+
}
|
|
2975
|
+
|
|
2976
|
+
_reflectToAttribute(name, value, def) {
|
|
2977
|
+
const attrName = def.attribute || toKebabCase(name);
|
|
2978
|
+
if (value == null || (def.type === 'boolean' && !value)) {
|
|
2979
|
+
this.removeAttribute(attrName);
|
|
2980
|
+
}
|
|
2981
|
+
else if (def.type === 'boolean') {
|
|
2982
|
+
this.setAttribute(attrName, '');
|
|
2983
|
+
}
|
|
2984
|
+
else if (def.type === 'object' || def.type === 'array') {
|
|
2985
|
+
this.setAttribute(attrName, JSON.stringify(value));
|
|
2986
|
+
}
|
|
2987
|
+
else {
|
|
2988
|
+
this.setAttribute(attrName, String(value));
|
|
2989
|
+
}
|
|
2990
|
+
}
|
|
2991
|
+
|
|
2992
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
2993
|
+
if (oldValue === newValue) return;
|
|
2994
|
+
const props = this.constructor.properties || {};
|
|
2995
|
+
const propName = Object.keys(props).find(p => {
|
|
2996
|
+
const def = props[p];
|
|
2997
|
+
return (def.attribute || toKebabCase(p)) === name;
|
|
2998
|
+
});
|
|
2999
|
+
|
|
3000
|
+
if (propName) {
|
|
3001
|
+
const def = props[propName];
|
|
3002
|
+
this[propName] = deserialize(newValue, def.type);
|
|
3003
|
+
}
|
|
3004
|
+
}
|
|
3005
|
+
|
|
3006
|
+
get state() {
|
|
3007
|
+
return { ...this._state };
|
|
3008
|
+
}
|
|
3009
|
+
|
|
3010
|
+
setState(updates) {
|
|
3011
|
+
const oldState = { ...this._state };
|
|
3012
|
+
Object.assign(this._state, updates);
|
|
3013
|
+
this.requestUpdate();
|
|
3014
|
+
this.dispatchEvent(new CustomEvent('state-changed', {
|
|
3015
|
+
detail: { state: this._state, oldState },
|
|
3016
|
+
bubbles: true
|
|
3017
|
+
}));
|
|
3018
|
+
}
|
|
3019
|
+
|
|
3020
|
+
requestUpdate() {
|
|
3021
|
+
if (this._renderPending) return;
|
|
3022
|
+
this._renderPending = true;
|
|
3023
|
+
requestAnimationFrame(() => {
|
|
3024
|
+
this._renderPending = false;
|
|
3025
|
+
this.update();
|
|
3026
|
+
});
|
|
3027
|
+
}
|
|
3028
|
+
|
|
3029
|
+
update() {
|
|
3030
|
+
if (this.render) {
|
|
3031
|
+
const content = this.render();
|
|
3032
|
+
if (typeof content === 'string') {
|
|
3033
|
+
this._root.innerHTML = content;
|
|
3034
|
+
}
|
|
3035
|
+
}
|
|
3036
|
+
}
|
|
3037
|
+
|
|
3038
|
+
connectedCallback() {
|
|
3039
|
+
this.update();
|
|
3040
|
+
if (this.connected) this.connected();
|
|
3041
|
+
}
|
|
3042
|
+
|
|
3043
|
+
disconnectedCallback() {
|
|
3044
|
+
if (this.disconnected) this.disconnected();
|
|
3045
|
+
}
|
|
3046
|
+
|
|
3047
|
+
adoptedCallback() {
|
|
3048
|
+
if (this.adopted) this.adopted();
|
|
3049
|
+
}
|
|
3050
|
+
|
|
3051
|
+
// Template helper
|
|
3052
|
+
html(strings, ...values) {
|
|
3053
|
+
return strings.reduce((result, str, i) => {
|
|
3054
|
+
let value = values[i] || '';
|
|
3055
|
+
if (Array.isArray(value)) value = value.join('');
|
|
3056
|
+
if (typeof value === 'object') value = JSON.stringify(value);
|
|
3057
|
+
return result + str + value;
|
|
3058
|
+
}, '');
|
|
3059
|
+
}
|
|
3060
|
+
}
|
|
3061
|
+
|
|
3062
|
+
// Utility functions
|
|
3063
|
+
function toKebabCase(str) {
|
|
3064
|
+
return str.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
|
|
3065
|
+
}
|
|
3066
|
+
|
|
3067
|
+
function deserialize(value, type) {
|
|
3068
|
+
if (value === null) return null;
|
|
3069
|
+
switch (type) {
|
|
3070
|
+
case 'number': return Number(value);
|
|
3071
|
+
case 'boolean': return value !== null && value !== 'false' && value !== '0';
|
|
3072
|
+
case 'object':
|
|
3073
|
+
case 'array':
|
|
3074
|
+
try { return JSON.parse(value); }
|
|
3075
|
+
catch { return type === 'array' ? [] : {}; }
|
|
3076
|
+
default: return value;
|
|
3077
|
+
}
|
|
3078
|
+
}
|
|
3079
|
+
|
|
3080
|
+
// Export to global
|
|
3081
|
+
global.StxElement = StxElement;
|
|
3082
|
+
global.stxComponents = global.stxComponents || {};
|
|
3083
|
+
|
|
3084
|
+
// Helper to define components
|
|
3085
|
+
global.defineStxComponent = function(tag, config) {
|
|
3086
|
+
const { properties, template, styles, methods, ...options } = config;
|
|
3087
|
+
|
|
3088
|
+
class Component extends StxElement {
|
|
3089
|
+
static get properties() { return properties || {}; }
|
|
3090
|
+
static get useShadowDOM() { return options.shadowDOM !== false; }
|
|
3091
|
+
|
|
3092
|
+
render() {
|
|
3093
|
+
let html = template || '';
|
|
3094
|
+
// Simple interpolation
|
|
3095
|
+
html = html.replace(/\\{\\{\\s*(\\w+)\\s*\\}\\}/g, (match, key) => {
|
|
3096
|
+
if (key in this) return this[key] ?? '';
|
|
3097
|
+
if (key in this._state) return this._state[key] ?? '';
|
|
3098
|
+
return match;
|
|
3099
|
+
});
|
|
3100
|
+
return (styles ? '<style>' + styles + '</style>' : '') + html;
|
|
3101
|
+
}
|
|
3102
|
+
}
|
|
3103
|
+
|
|
3104
|
+
// Add methods
|
|
3105
|
+
if (methods) {
|
|
3106
|
+
for (const [name, fn] of Object.entries(methods)) {
|
|
3107
|
+
Component.prototype[name] = fn;
|
|
3108
|
+
}
|
|
3109
|
+
}
|
|
3110
|
+
|
|
3111
|
+
customElements.define(tag, Component);
|
|
3112
|
+
global.stxComponents[tag] = Component;
|
|
3113
|
+
return Component;
|
|
3114
|
+
};
|
|
3115
|
+
|
|
3116
|
+
})(typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : this);
|
|
3117
|
+
`}function PX($,Z){let J=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),X=J?J[1].trim():"",Y=Z,Q=[],G=!0;if(X){let U=X.match(/export\s+default\s+({[\s\S]*})/);if(U)try{let H=U[1],j=H.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(j)Y=j[1];let B=H.match(/props\s*:\s*\[([\s\S]*?)\]/);if(B)Q=B[1].split(",").map((L)=>L.trim().replace(/['"`]/g,"")).filter((L)=>L.length>0);let V=H.match(/shadowDOM\s*:\s*(true|false)/);if(V)G=V[1]==="true"}catch{}}let z=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),K=z?z[1].trim():"",q=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),W=q?q[1].trim():"";return{tag:Y,props:Q,template:K,styles:W,script:X,shadowDOM:G}}function vX($){let{tag:Z,props:J,template:X,styles:Y,shadowDOM:Q}=$,G=Z.split("-").map((U)=>U.charAt(0).toUpperCase()+U.slice(1)).join(""),z=X.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),K=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),q=J.map((U)=>`'${U}'`).join(", "),W=J.map((U)=>`
|
|
3118
|
+
get ${U}() {
|
|
3119
|
+
return this.getAttribute('${U}') || '';
|
|
3120
|
+
}
|
|
3121
|
+
set ${U}(value) {
|
|
3122
|
+
if (value) {
|
|
3123
|
+
this.setAttribute('${U}', value);
|
|
3124
|
+
}
|
|
3125
|
+
else {
|
|
3126
|
+
this.removeAttribute('${U}');
|
|
3127
|
+
}
|
|
3128
|
+
}`).join(`
|
|
3129
|
+
`);return`/**
|
|
3130
|
+
* ${G} Web Component
|
|
3131
|
+
* Auto-generated from SFC
|
|
3132
|
+
*/
|
|
3133
|
+
class ${G} extends HTMLElement {
|
|
3134
|
+
constructor() {
|
|
3135
|
+
super();
|
|
3136
|
+
${Q?"this.attachShadow({ mode: 'open' });":""}
|
|
3137
|
+
this._render();
|
|
3138
|
+
}
|
|
3139
|
+
|
|
3140
|
+
static get observedAttributes() {
|
|
3141
|
+
return [${q}];
|
|
3142
|
+
}
|
|
3143
|
+
|
|
3144
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
3145
|
+
if (oldValue !== newValue) {
|
|
3146
|
+
this._render();
|
|
3147
|
+
}
|
|
3148
|
+
}
|
|
3149
|
+
${W}
|
|
3150
|
+
|
|
3151
|
+
_render() {
|
|
3152
|
+
const template = \`${K?`<style>${K}</style>`:""}${z}\`;
|
|
3153
|
+
|
|
3154
|
+
// Interpolate {{ prop }} with attribute values
|
|
3155
|
+
const rendered = template.replace(/\\{\\{\\s*(\\w+)\\s*\\}\\}/g, (match, prop) => {
|
|
3156
|
+
return this.getAttribute(prop) || '';
|
|
3157
|
+
});
|
|
3158
|
+
|
|
3159
|
+
${Q?"this.shadowRoot.innerHTML = rendered;":"this.innerHTML = rendered;"}
|
|
3160
|
+
}
|
|
3161
|
+
|
|
3162
|
+
connectedCallback() {
|
|
3163
|
+
this._render();
|
|
3164
|
+
}
|
|
3165
|
+
}
|
|
3166
|
+
|
|
3167
|
+
customElements.define('${Z}', ${G});
|
|
3168
|
+
`}async function A7($,Z,J,X){if(Z.length<1)return R0("WebComponent","@webcomponent directive requires at least the tag name parameter",w0.INVALID_DIRECTIVE_SYNTAX);let Y=Z[0].replace(/['"]/g,""),G=(J.__stx_options||{}).componentsDir||"components",z=g0.isAbsolute(G)?[g0.join(G,`${Y}.stx`),g0.join(g0.dirname(X),`${Y}.stx`)]:[g0.join(g0.dirname(X),G,`${Y}.stx`),g0.join(process.cwd(),G,`${Y}.stx`),g0.join(g0.dirname(X),`${Y}.stx`)],K=null;for(let U of z)if(await e(U)){K=await Bun.file(U).text();break}if(!K)return R0("WebComponent",`Component file not found: ${Y}.stx`,w0.FILE_NOT_FOUND);let q=PX(K,Y);return`<script type="module">
|
|
3169
|
+
${vX(q)}
|
|
3170
|
+
</script>`}var A5={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:E7,cachePath:".stx/cache",cacheVersion:"1.0.0",componentRenderCacheBytes:33554432,build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:Y7,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:A7,hasEndTag:!1,description:"Include a web component in the template"},T7,k7,P7,v7,Q5,z5,K5,G5,$7,l3,O7,N5,...f7],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};function xX($,Z,J){let X=Z||"pages";if($)return{root:$,pagesDir:X};let Y=J||process.cwd(),Q=S0.join(Y,"resources","views"),G=S0.join(Y,"resources","layouts");if(X9.existsSync(Q)&&X9.existsSync(G))return{root:"resources",pagesDir:"views"};let z=S0.join(Y,"resources","views","pages");if(X9.existsSync(z))return{root:"resources/views",pagesDir:X};return{root:".",pagesDir:X}}var I7=new Set,Y9=["partialsDir","componentsDir","layoutsDir"],I5=new WeakMap;function gX($,Z){let J=Z.replace(/[\\/]+$/,"");if(!J||J===".")return!0;let X=$.replace(/\\/g,"/"),Y=J.replace(/\\/g,"/");return X===Y||X.startsWith(`${Y}/`)}function hX($,Z){let J=!$.root,X=xX($.root,$.pagesDir,Z);if($.root=X.root,$.pagesDir=X.pagesDir,J&&X.root!=="."){let Y=`${Z}::${X.root}`;if(!I7.has(Y))I7.add(Y),console.warn(`[stx] No "root" in config \u2014 inferred "${X.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!I5.has($)){let Y={};for(let Q of Y9){let G=$[Q];if(typeof G==="string"&&G)Y[Q]=G}I5.set($,Y)}if($.root&&$.root!=="."){let Y=$.root;for(let Q of Y9){let G=$[Q];if(typeof G!=="string"||!G)continue;if(S0.isAbsolute(G)||gX(G,Y))continue;$[Q]=S0.join(Y,G)}}for(let Y of Y9){let Q=$[Y];if(typeof Q!=="string"||!Q||S0.isAbsolute(Q))continue;$[Y]=S0.resolve(Z,Q)}return $}function uX($,Z){let J=I5.get($);for(let X of Y9){let Y=$[X];if(typeof Y!=="string"||!Y)continue;let Q=S0.isAbsolute(Y)?Y:S0.join(Z,Y);if(X9.existsSync(Q))continue;let G=J?.[X]??Y,z=$.root,K=!!z&&z!==".";console.warn(`[stx] ${String(X)} resolves to "${Q}", which does not exist. Configured as "${G}"`+(K?`, resolved under root "${z}".`:"."))}}function mX($){if($.customDirectives)$.customDirectives=[...$.customDirectives];if($.middleware)$.middleware=[...$.middleware];if($.apiRoutes)$.apiRoutes={...$.apiRoutes}}function dX($){if(b7($.stateDir),$.stateDir=y7(),$.cachePath=B2($.cachePath),$.build)$.build.cacheDir=B2($.build.cacheDir);if($.media?.cache)$.media.cache.directory=B2($.media.cache.directory);if($.story)$.story.outDir=B2($.story.outDir)}var Q1=null,O1=new Map,$9=new Map,V2=null;async function T5($){let Z=$?S0.resolve($):process.cwd(),J=$9.get(Z);if(J&&J.signature!==Z9(J.graph)){let Q=O1.get(Z);if(O1.delete(Z),$9.delete(Z),!$)Q1=null,V2=null;let{clearComponentCache:G}=await import("./chunk-95t7pked.js"),{partialsCache:z}=await import("./chunk-4jj4kk18.js");if(G(),z.clear(),Q&&J.configSignature===J9(J.graph)){let K=Q.then(async(q)=>{let W={...J.graph};await S7(W,Z),$9.set(Z,{graph:W,signature:Z9(W),configSignature:J9(W)});let U={...q,_layerGraph:W};if(!$)Q1=U;return U});return O1.set(Z,K),K}}if(!$){if(Q1)return Q1;if(V2)return V2}let X=O1.get(Z);if(X)return X;let Y=(async()=>{let G=(await fX({name:"stx",alias:"ui",cwd:Z,defaultConfig:A5,verbose:!1})).config;if(G.extends!==void 0||J){let z=await C7(Z,A5);G=z.config,$9.set(Z,{graph:z.graph,signature:Z9(z.graph),configSignature:J9(z.graph)})}if(G.runtimeConfig){let{resolveRuntimeConfig:z}=await import("./chunk-x4vhn880.js");z(G.runtimeConfig,{});let{generateRuntimeConfigTypes:K}=await import("./chunk-9m5sxaen.js");await K(Z,G.runtimeConfig)}if(mX(G),dX(G),hX(G,Z),uX(G,Z),G.plugins&&G.plugins.length>0){let{pluginManager:z}=await import("./chunk-stbns4bg.js"),K=[],q=[];for(let W of G.plugins){let U=typeof W==="string"?W:W[0],H=typeof W==="string"?{}:W[1]||{};try{let j,B;try{j=await import(U),B=S0.dirname(f.resolve(U))}catch{let L=S0.resolve(Z,U);j=await import(L),B=S0.dirname(L)}let V=j.default||j;if(!z.has(V.name))await z.register(V,G);if(V.components){let L=Array.isArray(V.components)?V.components:[V.components];for(let _ of L)K.push(S0.resolve(B,_))}if(V.pages){let L=S0.resolve(B,V.pages),_=H.path||"/";q.push({dir:L,prefix:_})}if(V.setup){let L={addDirective:(_)=>{G.customDirectives=G.customDirectives||[],G.customDirectives.push(_)},addRoute:(_,F)=>{G.apiRoutes=G.apiRoutes||{},G.apiRoutes[_]=F},addMiddleware:(_)=>{G.middleware=G.middleware||[],G.middleware.push(_)},pluginDir:B,config:G};await V.setup(H,L)}console.log(`[stx] Plugin loaded: ${V.name||U}`)}catch(j){console.warn(`[stx] Failed to load plugin ${U}:`,j.message)}}G._pluginComponentDirs=K,G._pluginPageDirs=q}return G})();if(O1.set(Z,Y),Y.catch(()=>{if(O1.get(Z)===Y)O1.delete(Z)}),!$)V2=Y,Y.then((Q)=>{Q1=Q}).catch(()=>{});return Y}var x7=new Proxy(A5,{get($,Z){if(Q1&&Z in Q1)return Q1[Z];if(!V2)T5().catch((J)=>{console.warn("[stx] Failed to load config file:",J?.message||J)});return $[Z]}});function HU($){return $}function jU($){let Z=[],J=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let X=["auto","manual","sections"];if(!X.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${X.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let X=["json","yaml","yml","js"];if(!X.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${X.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let X=["AA","AAA"];if(!X.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${X.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let X=["progressive","islands"];if(!X.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${X.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let X=["none","eager","lazy"];if(!X.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${X.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((X,Y)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`customDirectives[${Y}].name`,message:"Custom directive must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`customDirectives[${Y}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((X,Y)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`middleware[${Y}].name`,message:"Middleware must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`middleware[${Y}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!X.timing||!["before","after"].includes(X.timing))Z.push({path:`middleware[${Y}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)J.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)J.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let X=["fullscreen","standalone","minimal-ui","browser"];if(!X.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let X=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!X.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.routes){let X=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((Y,Q)=>{if(!Y.pattern||typeof Y.pattern!=="string")Z.push({path:`pwa.routes[${Q}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!X.includes(Y.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${X.join(", ")}`,severity:"error"});if(Y.maxAgeSeconds!==void 0&&(typeof Y.maxAgeSeconds!=="number"||Y.maxAgeSeconds<0))Z.push({path:`pwa.routes[${Q}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Y.maxEntries!==void 0&&(typeof Y.maxEntries!=="number"||Y.maxEntries<1))Z.push({path:`pwa.routes[${Q}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((Y)=>typeof Y!=="number"||Y<16||Y>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let X=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((Q)=>!X.includes(Q)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)J.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)J.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:J}}var E5=new Map;async function pX($,Z={}){try{if(!await e($))throw Error(`Markdown file not found: ${$}`);let X=(await lX.promises.stat($)).mtime.getTime();if(Z.cache&&E5.has($)){let U=E5.get($);if(U.updatedAt>=X)return{content:U.content,data:U.data}}let Y=await Bun.file($).text(),{data:Q,content:G}=J7(Y),z=Z.markdown||x7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},q=U2(G,{gfm:!0});if(z.syntaxHighlighting?.enabled&&z.syntaxHighlighting?.serverSide)q=await iX(q,z.syntaxHighlighting?.defaultTheme||"github-dark",z.syntaxHighlighting?.highlightUnknownLanguages||!1);let W={content:q,data:Q||{}};if(Z.cache)E5.set($,{...W,updatedAt:X});return W}catch(J){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,J);let X=J instanceof Error?J.message:String(J);return{content:_0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}var Q9=null;async function iX($,Z,J){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!Q9)try{Q9=await cX({theme:Z||"github-dark",cache:!0})}catch(z){return console.error("Failed to initialize ts-syntax-highlighter:",z),$}let Y=async(z,K,q,W)=>{let U=W.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),H=q||(J?"text":"");if(!H)return z;try{if(!Q9.getSupportedLanguages().includes(H))return z;return(await Q9.highlight(U,H,{theme:Z})).html}catch(j){console.error(`Error highlighting code block with language ${q}:`,j)}return z},Q=$,G=$.matchAll(X);for(let z of G){let[K,q,W,U]=z,H=await Y(K,q,W,U);Q=Q.replace(K,H)}return Q}async function g7($,Z,J="",X={}){return await nX($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,z,K,q)=>{try{let W=z;if(!k5.isAbsolute(z))W=k5.resolve(k5.dirname(J),z);let U={};if(K)try{try{U=JSON.parse(K)}catch{if(X.debug)console.warn("Using safer alternative for parsing JS object literal");let F=K.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let O of F){let w=O.indexOf(":");if(w>0){let N=O.substring(0,w).trim(),R=O.substring(w+1).trim(),M=R.startsWith('"')&&R.endsWith('"'),T=R.startsWith("'")&&R.endsWith("'");if(M||T)R=R.substring(1,R.length-1);U[N]=R}}}}catch(_){if(X.debug)console.error("Error parsing context in @markdown-file directive:",_)}let{content:H,data:j}=await pX(W,X),B={...Z,...j,...U},V=H,L=/\{\{([^}]+)\}\}/g;return V=V.replace(L,(_,F)=>{let O=F.trim();return B[O]!==void 0?String(B[O]):_}),V}catch(W){let U=W instanceof Error?W.message:String(W);return _0("Markdown File",`Error including markdown file: ${U}`,J,$,q,G)}})}async function nX($,Z,J){let X=[],Y;while((Y=Z.exec($))!==null){let z=Y[0],K=Y.index,q=Y;X.push(J(...q).then((W)=>({match:z,replacement:W,index:K})))}let Q=await Promise.all(X);Q.sort((z,K)=>K.index-z.index);let G=$;for(let{match:z,replacement:K}of Q)G=G.replace(z,()=>K);return G}function G1($,Z){try{let J=$.trim();if(H0(J))return q0(J,Object.keys(Z))(...Object.values(Z));else return Q0(J,Z)}catch{return!1}}class G9{source;pos=0;line=1;column=0;tokens=[];constructor($){this.source=$}tokenize(){this.tokens=[],this.pos=0,this.line=1,this.column=0;while(this.pos<this.source.length){let $=this.nextToken();if($)this.tokens.push($)}return this.tokens.push({type:"EOF",value:"",start:this.pos,end:this.pos,line:this.line,column:this.column}),this.tokens}nextToken(){if(this.pos>=this.source.length)return null;let $=this.pos,Z=this.line,J=this.column,X=this.source[this.pos];if(/\s/.test(X))return this.readWhitespace($,Z,J);if(X==="/"&&this.peek(1)==="/")return this.readLineComment($,Z,J);if(X==="/"&&this.peek(1)==="*")return this.readBlockComment($,Z,J);if(X==='"'||X==="'")return this.readString(X,$,Z,J);if(X==="`")return this.readTemplateString($,Z,J);if(/\d/.test(X)||X==="."&&/\d/.test(this.peek(1)||""))return this.readNumber($,Z,J);if(/[a-z_$]/i.test(X))return this.readIdentifier($,Z,J);if(X==="{"){if(this.peek(1)==="{"&&this.peek(2)==="{")return this.advance(3),{type:"RAW_START",value:"{{{",start:$,end:this.pos,line:Z,column:J};if(this.peek(1)==="{")return this.advance(2),{type:"EXPRESSION_START",value:"{{",start:$,end:this.pos,line:Z,column:J};if(this.peek(1)==="!"&&this.peek(2)==="!")return this.advance(3),{type:"RAW_START",value:"{!!",start:$,end:this.pos,line:Z,column:J}}if(X==="}"){if(this.peek(1)==="}"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"}}}",start:$,end:this.pos,line:Z,column:J};if(this.peek(1)==="}")return this.advance(2),{type:"EXPRESSION_END",value:"}}",start:$,end:this.pos,line:Z,column:J}}if(X==="!"&&this.peek(1)==="!"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"!!}",start:$,end:this.pos,line:Z,column:J};if(X==="@"&&/[a-z]/i.test(this.peek(1)||""))return this.readDirective($,Z,J);let Y=["===","!==","==","!=","<=",">=","&&","||","??","++","--","+=","-=","*=","/=","%=","**","=>","?.","...","<<",">>",">>>","&=","|=","^="];for(let Q of Y)if(this.source.slice(this.pos,this.pos+Q.length)===Q)return this.advance(Q.length),{type:"OPERATOR",value:Q,start:$,end:this.pos,line:Z,column:J};if(/[+\-*/%<>=!&|^~?:]/.test(X))return this.advance(),{type:"OPERATOR",value:X,start:$,end:this.pos,line:Z,column:J};if(/[()[\]{},;.]/.test(X))return this.advance(),{type:"PUNCTUATION",value:X,start:$,end:this.pos,line:Z,column:J};return this.advance(),{type:"PUNCTUATION",value:X,start:$,end:this.pos,line:Z,column:J}}readWhitespace($,Z,J){while(this.pos<this.source.length&&/\s/.test(this.source[this.pos]))this.advance();return{type:"WHITESPACE",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:J}}readLineComment($,Z,J){this.advance(2);while(this.pos<this.source.length&&this.source[this.pos]!==`
|
|
3171
|
+
`)this.advance();return{type:"COMMENT",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:J}}readBlockComment($,Z,J){this.advance(2);while(this.pos<this.source.length-1){if(this.source[this.pos]==="*"&&this.source[this.pos+1]==="/"){this.advance(2);break}this.advance()}return{type:"COMMENT",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:J}}readString($,Z,J,X){this.advance();while(this.pos<this.source.length){let Y=this.source[this.pos];if(Y==="\\"){this.advance(2);continue}if(Y===$){this.advance();break}this.advance()}return{type:"STRING",value:this.source.slice(Z,this.pos),start:Z,end:this.pos,line:J,column:X}}readTemplateString($,Z,J){this.advance();let X=0,Y=256;while(this.pos<this.source.length){let Q=this.source[this.pos];if(Q==="\\"){this.advance(2);continue}if(Q==="$"&&this.peek(1)==="{"){if(X>=Y){this.pos=this.source.length;break}this.advance(2),X++;continue}if(Q==="{"&&X>0){X++,this.advance();continue}if(Q==="}"&&X>0){X--,this.advance();continue}if(Q==="`"&&X===0){this.advance();break}this.advance()}return{type:"TEMPLATE_STRING",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:J}}readNumber($,Z,J){if(this.source[this.pos]==="0"){let X=this.peek(1)?.toLowerCase();if(X==="x"||X==="o"||X==="b"){this.advance(2);while(this.pos<this.source.length&&/[\da-f_]/i.test(this.source[this.pos]))this.advance();return{type:"NUMBER",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:J}}}while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance();if(this.source[this.pos]==="."&&/\d/.test(this.peek(1)||"")){this.advance();while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance()}if(/e/i.test(this.source[this.pos]||"")){if(this.advance(),/[+-]/.test(this.source[this.pos]||""))this.advance();while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance()}if(this.source[this.pos]==="n")this.advance();return{type:"NUMBER",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:J}}readIdentifier($,Z,J){while(this.pos<this.source.length&&/[\w$]/.test(this.source[this.pos]))this.advance();return{type:"IDENTIFIER",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:J}}readDirective($,Z,J){this.advance();while(this.pos<this.source.length&&/[a-z]/i.test(this.source[this.pos]))this.advance();return{type:"DIRECTIVE",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:J}}advance($=1){for(let Z=0;Z<$&&this.pos<this.source.length;Z++){if(this.source[this.pos]===`
|
|
3172
|
+
`)this.line++,this.column=0;else this.column++;this.pos++}}peek($){return this.source[this.pos+$]}saveState(){return{pos:this.pos,line:this.line,column:this.column}}restoreState($){this.pos=$.pos,this.line=$.line,this.column=$.column}}function N0($,Z,J,X=0){let Y=0,Q=X,G=null,z=0,K=!1;while(Q<$.length){let q=$[Q];if(G&&K){K=!1,Q++;continue}if(G&&q==="\\"){K=!0,Q++;continue}if(K=!1,(q==='"'||q==="'"||q==="`")&&!G){G=q,Q++;continue}if(q===G&&G!=="`"){G=null,Q++;continue}if(G==="`"&&q==="$"&&$[Q+1]==="{"){z++,Q+=2;continue}if(z>0&&q==="}"){z--,Q++;continue}if(q==="`"&&G==="`"&&z===0){G=null,Q++;continue}if(G){Q++;continue}if(q===Z)Y++;else if(q===J){if(Y--,Y===0)return Q}Q++}return-1}function h7($,Z){let J=Z,X={paren:0,bracket:0,brace:0},Y=null,Q=0;while(J<$.length){let G=$[J];if((J>0?$[J-1]:"")==="\\"&&Y){J++;continue}if((G==='"'||G==="'")&&!Y){Y=G,J++;continue}if(G===Y&&Y!=="`"){Y=null,J++;continue}if(G==="`"&&!Y){Y="`",J++;continue}if(G==="`"&&Y==="`"&&Q===0){Y=null,J++;continue}if(Y==="`"&&G==="$"&&$[J+1]==="{"){Q++,J+=2;continue}if(Q>0){if(G==="{")Q++;else if(G==="}")Q--;J++;continue}if(Y){J++;continue}if(X.paren===0&&X.bracket===0&&X.brace===0){if($.slice(J,J+2)==="}}"||$.slice(J,J+3)==="!!}")break;if(G===","||G===";")break}if(G==="(")X.paren++;else if(G===")"){if(X.paren--,X.paren<0)break}else if(G==="[")X.bracket++;else if(G==="]"){if(X.bracket--,X.bracket<0)break}else if(G==="{")X.brace++;else if(G==="}"){if(X.brace--,X.brace<0)break}J++}return{expression:$.slice(Z,J),endPos:J}}function b5($){let Z=[],J="",X={paren:0,bracket:0,brace:0},Y=null,Q=0;for(let G=0;G<$.length;G++){let z=$[G];if((G>0?$[G-1]:"")==="\\"&&Y){J+=z;continue}if((z==='"'||z==="'")&&!Y){Y=z,J+=z;continue}if(z===Y&&Y!=="`"){Y=null,J+=z;continue}if(z==="`"&&!Y){Y="`",J+=z;continue}if(z==="`"&&Y==="`"&&Q===0){Y=null,J+=z;continue}if(Y==="`"&&z==="$"&&$[G+1]==="{"){Q++,J+=z+$[G+1],G++;continue}if(Q>0&&z==="{"){Q++,J+=z;continue}if(Q>0&&z==="}"){Q--,J+=z;continue}if(Y){J+=z;continue}if(z==="(")X.paren++;else if(z===")")X.paren--;else if(z==="[")X.bracket++;else if(z==="]")X.bracket--;else if(z==="{")X.brace++;else if(z==="}")X.brace--;if(z==="|"&&$[G+1]!=="|"&&(G===0||$[G-1]!=="|")&&$[G-1]!=="\\"&&X.paren===0&&X.bracket===0&&X.brace===0){Z.push(J.trim()),J="";continue}if(z==="|"&&$[G-1]==="\\"&&!Y){J=J.slice(0,-1)+z;continue}J+=z}if(J.trim())Z.push(J.trim());return Z}function z1($,Z){let J=oX($,Z);return J.ok?{expression:J.expression,endPos:J.endPos}:null}function oX($,Z){let J=Z;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return{ok:!1,reason:"missing-open-paren",pos:J};let X=N0($,"(",")",J);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:J};return{ok:!0,expression:$.slice(J+1,X),endPos:X+1}}function sX($,Z){let J=$.lastIndexOf("<",Z);if(J===-1)return!1;return J>$.lastIndexOf(">",Z)}function _1($,Z,J,X){let Y=1,Q=X,G=new RegExp(`@${Z}\\s*\\(`,"g"),z=new RegExp(`@${J}(?![a-z])`,"g");while(Q<$.length&&Y>0){G.lastIndex=Q,z.lastIndex=Q;let K=G.exec($),q=z.exec($),W=K?K.index:1/0,U=q?q.index:1/0;if(W<U)Y++,Q=W+K[0].length;else if(U<1/0){if(Y--,Y===0)return U;Q=U+q[0].length}else break}return-1}function u7($,Z){let J=$.slice(Z).match(/^@if\s*/);if(!J)return null;let X=Z+J[0].length,Y=z1($,X);if(!Y)return null;let Q=Y.endPos,G=_1($,"if","endif",Q);if(G===-1)return null;let z=$.slice(Q,G),K=[],q=0,W="if",U=Y.expression,H=0,j=0;while(q<z.length){let B=z.indexOf("@",q);if(B===-1)break;q=B;let V=z.substring(B);if(sX(z,B)){q++;continue}if(/^@if\s*\(/.test(V)){j++,q++;continue}if(/^@endif(?![a-z])/.test(V)){j--,q+=6;continue}if(j===0){let L=V.match(/^@elseif\s*/);if(L){K.push({type:W,condition:U,content:z.substring(H,q),start:Q+H,end:Q+q});let _=q+L[0].length,F=z1(z,_);if(!F){q++;continue}W="elseif",U=F.expression,q=F.endPos,H=q;continue}else if(/^@else(?![a-z])/.test(V)){K.push({type:W,condition:U,content:z.substring(H,q),start:Q+H,end:Q+q}),W="else",U=void 0,q+=5,H=q;continue}}q++}return K.push({type:W,condition:U,content:z.slice(H),start:Q+H,end:Q+z.length}),{fullMatch:$.slice(Z,G+6),branches:K,start:Z,end:G+6}}function O2($){let Z=[],J=/@if\s*\(/g,X=J.exec($);while(X!==null){if(Z.some((G)=>X.index>G.start&&X.index<G.end)){X=J.exec($);continue}let Q=u7($,X.index);if(Q)Z.push(Q),J.lastIndex=Q.end;X=J.exec($)}return Z}function z9($,Z,J){let X=[],Y=new RegExp(`@${Z}\\s*\\(`,"g"),Q=Y.exec($);while(Q!==null){if(X.some((V)=>Q.index>V.start&&Q.index<V.end)){Q=Y.exec($);continue}let z=Q.index,K=z+Q[0].length-1,q=N0($,"(",")",K);if(q===-1){Q=Y.exec($);continue}let W=$.slice(K+1,q),U=q+1,H=_1($,Z,J,U);if(H===-1){Q=Y.exec($);continue}let j=$.slice(U,H),B=H+`@${J}`.length;X.push({fullMatch:$.slice(z,B),name:Z,params:W,content:j,start:z,end:B}),Y.lastIndex=B,Q=Y.exec($)}return X}function y5($,Z){let J=$.slice(Z).match(/^@switch\s*/);if(!J)return null;let X=Z+J[0].length,Y=z1($,X);if(!Y)return null;let Q=Y.endPos,G=_1($,"switch","endswitch",Q);if(G===-1)return null;let z=$.slice(Q,G),K=[],q=0,W=null,U=0;while(q<z.length){let H=z.slice(q),j=H.match(/^@switch\s*\(/),B=H.match(/^@endswitch(?![a-z])/);if(j){if(U++,W)W.content+=j[0];q+=j[0].length;continue}if(B){if(U--,W)W.content+=B[0];q+=B[0].length;continue}if(U>0){if(W)W.content+=z[q];q++;continue}let V=H.match(/^@case\s*/),L=H.match(/^@default(?![a-z])/),_=H.match(/^@break(?![a-z])/);if(V&&H.startsWith("@case")){if(W)K.push(W);let F=q+V[0].length,O=z1(z,F);if(!O){q++;continue}W={type:"case",value:O.expression,content:""},q=O.endPos}else if(L&&H.startsWith("@default")){if(W)K.push(W);W={type:"default",content:""},q+=L[0].length}else if(_&&H.startsWith("@break"))q+=_[0].length;else{if(W)W.content+=z[q];q++}}if(W)K.push(W);return{fullMatch:$.slice(Z,G+10),expression:Y.expression,cases:K,start:Z,end:G+10}}function rX($){let Z=[],J=0;while(J<$.length){let X=$.indexOf("{{",J),Y=$.indexOf("{!!",J),Q=!1,G;if(X===-1&&Y===-1)break;else if(X===-1)G=Y,Q=!0;else if(Y===-1)G=X,Q=!1;else if(Y<X)G=Y,Q=!0;else G=X,Q=!1;if(!Q&&$.slice(G,G+3)==="{{{")Q=!0;let z=Q?$.slice(G,G+3)==="{{{"?"{{{":"{!!":"{{",K=Q?z==="{{{"?"}}}":"!!}":"}}",q=G+z.length,W=aX($,q,K);if(W===-1){J=G+1;continue}let U=$.slice(q,W).trim(),H=W+K.length;Z.push({fullMatch:$.slice(G,H),expression:U,start:G,end:H,isRaw:Q}),J=H}return Z}function aX($,Z,J){let X=Z,Y=null,Q={paren:0,bracket:0,brace:0},G=0;while(X<$.length){let z=$[X];if((X>0?$[X-1]:"")==="\\"&&Y){X++;continue}if((z==='"'||z==="'")&&!Y){Y=z,X++;continue}if(z===Y&&Y!=="`"){Y=null,X++;continue}if(z==="`"&&!Y){Y="`",X++;continue}if(z==="`"&&Y==="`"&&G===0){Y=null,X++;continue}if(Y==="`"&&z==="$"&&$[X+1]==="{"){G++,X+=2;continue}if(G>0){if(z==="{")G++;else if(z==="}")G--;X++;continue}if(Y){X++;continue}if(z==="(")Q.paren++;else if(z===")")Q.paren--;else if(z==="[")Q.bracket++;else if(z==="]")Q.bracket--;else if(z==="{")Q.brace++;else if(z==="}")Q.brace--;if(Q.paren===0&&Q.bracket===0&&Q.brace<=0){if($.slice(X,X+J.length)===J)return X}X++}return-1}function tX($){let Z=b5($);if(Z.length===0)return{baseExpression:"",filters:[]};let J=Z[0],X=[];for(let Y=1;Y<Z.length;Y++){let Q=eX(Z[Y]);if(Q)X.push(Q)}return{baseExpression:J,filters:X}}function eX($){let Z=$.trim();if(!Z)return null;let J=Z.indexOf("(");if(J===-1)return{name:Z,args:[]};let X=Z.slice(0,J).trim(),Y=J+1,Q=N0(Z,"(",")",J);if(Q===-1)return{name:X,args:[]};let G=Z.slice(Y,Q),z=l7(G);return{name:X,args:z}}function l7($){let Z=[],J="",X={paren:0,bracket:0,brace:0},Y=null,Q=0;for(let G=0;G<$.length;G++){let z=$[G];if((G>0?$[G-1]:"")==="\\"&&Y){J+=z;continue}if((z==='"'||z==="'")&&!Y){Y=z,J+=z;continue}if(z===Y&&Y!=="`"){Y=null,J+=z;continue}if(z==="`"&&!Y){Y="`",J+=z;continue}if(z==="`"&&Y==="`"&&Q===0){Y=null,J+=z;continue}if(Y==="`"&&z==="$"&&$[G+1]==="{"){Q++,J+="${",G++;continue}if(Q>0&&z==="{"){Q++,J+=z;continue}if(Q>0&&z==="}"){Q--,J+=z;continue}if(Y){J+=z;continue}if(z==="(")X.paren++;else if(z===")")X.paren--;else if(z==="[")X.bracket++;else if(z==="]")X.bracket--;else if(z==="{")X.brace++;else if(z==="}")X.brace--;if(z===","&&X.paren===0&&X.bracket===0&&X.brace===0){Z.push(J.trim()),J="";continue}J+=z}if(J.trim())Z.push(J.trim());return Z}function $Y($,Z){let J=Z;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return null;let X=N0($,"(",")",J);if(X===-1)return null;return{params:$.slice(J+1,X),endPos:X+1}}function ZY($){let Z=[],X=new G9($).tokenize().filter((Q)=>Q.type!=="WHITESPACE"&&Q.type!=="COMMENT"),Y=0;while(Y<X.length){let Q=X[Y],G=!1;if(Q.type==="IDENTIFIER"&&Q.value==="export"){if(G=!0,Y++,Y>=X.length)break}let z=X[Y];if(z.type==="IDENTIFIER"&&(z.value==="const"||z.value==="let"||z.value==="var")){let K=z.value;if(Y++,Y>=X.length)break;let q=X[Y];if(q.type==="IDENTIFIER"){let W=q.value;if(Y++,Y<X.length&&X[Y].type==="OPERATOR"&&X[Y].value==="="){Y++;let U=Y<X.length?X[Y].start:$.length,H=m7(X,Y,$);Y=H.nextIndex,Z.push({type:"variable",name:W,value:$.slice(U,H.endPos),exported:G,start:z.start,end:H.endPos})}}else if(q.type==="PUNCTUATION"&&(q.value==="{"||q.value==="[")){let W=q.start,U=q.value==="{"?"}":"]",H=N0($,q.value,U,W);if(H!==-1){let j=$.slice(W,H+1);if(Y=d7(X,H+1),Y<X.length&&X[Y].type==="OPERATOR"&&X[Y].value==="="){Y++;let B=Y<X.length?X[Y].start:$.length,V=m7(X,Y,$);Y=V.nextIndex;let L=`__stx_destructured_${Z.length}`;Z.push({type:"variable",name:L,value:`${$.slice(B,V.endPos)}; ${K} ${j} = ${L}`,exported:G,start:z.start,end:V.endPos})}}}}else if(z.type==="IDENTIFIER"&&z.value==="function"){let K=G?X[Y-1].start:z.start;if(Y++,Y>=X.length)break;let q=X[Y];if(q.type==="IDENTIFIER"){let W=q.value;Y++;let U=-1;while(Y<X.length){if(X[Y].type==="PUNCTUATION"&&X[Y].value==="{"){U=X[Y].start;break}Y++}if(U!==-1){let H=N0($,"{","}",U);if(H!==-1)Z.push({type:"function",name:W,value:$.slice(K,H+1).replace(/^export\s+/,""),exported:G,start:K,end:H+1}),Y=d7(X,H+1)}}}else Y++}return Z}function m7($,Z,J){let X=Z,Y={paren:0,bracket:0,brace:0},Q=Z<$.length?$[Z].start:J.length;while(X<$.length){let G=$[X];if(G.type==="PUNCTUATION"){if(G.value==="(")Y.paren++;else if(G.value===")")Y.paren--;else if(G.value==="[")Y.bracket++;else if(G.value==="]")Y.bracket--;else if(G.value==="{")Y.brace++;else if(G.value==="}")Y.brace--;if(G.value===";"&&Y.paren===0&&Y.bracket===0&&Y.brace===0){Q=G.start,X++;break}}if(G.type==="IDENTIFIER"&&(G.value==="const"||G.value==="let"||G.value==="var"||G.value==="function"||G.value==="export")){if(Y.paren===0&&Y.bracket===0&&Y.brace===0){Q=$[X-1]?.end??G.start;break}}Q=G.end,X++}return{nextIndex:X,endPos:Q}}function d7($,Z){for(let J=0;J<$.length;J++)if($[J].start>=Z)return J;return $.length}function JY($,Z,J){let X=$,Y=!0;while(Y){Y=!1;let Q=X.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,z=y5(X,G);if(!z)break;try{let K;if(H0(z.expression))K=q0(z.expression,Object.keys(Z))(...Object.values(Z));else K=Q0(z.expression,Z);let q="",W=!1;for(let U of z.cases)if(U.type==="default"){if(!W)q=U.content.trim()}else try{let H;if(U.value&&H0(U.value))H=q0(U.value,Object.keys(Z))(...Object.values(Z));else if(U.value)H=Q0(U.value,Z);if(K===H){q=U.content.trim(),W=!0;break}}catch{continue}X=X.substring(0,G)+q+X.substring(z.end),Y=!0}catch(K){let q=K instanceof Error?K.message:String(K),W=R0("Switch",`Error evaluating @switch expression: ${q}`,w0.EVALUATION_ERROR);X=X.substring(0,G)+W+X.substring(z.end);break}}return X}function XY($){let Z=[];return{masked:$.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(X)=>{return Z.push(X),`\x00stx-script-${Z.length-1}\x00`}),scripts:Z}}function YY($,Z){if(Z.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(J,X)=>Z[Number(X)]??J)}function a0($,Z,J){let{masked:X,scripts:Y}=XY($);return YY(QY(X,Z,J),Y)}function QY($,Z,J){let X=$;X=JY(X,Z,J);{let Q=!0;while(Q){Q=!1;let G=X.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let z=G.index,K=z1(X,z+7);if(!K)break;let q=K.endPos,W=_1(X,"unless","endunless",q);if(W===-1){console.warn(`[stx] @unless directive at position ${z} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let U=X.slice(q,W),H=K.expression,j=-1;{let V=0,L=/@(?:if|unless)\s*\(/g,_=/@(?:endif|endunless)(?![a-z])/g,F=/@else(?![a-z])/g,O=[],w;while((w=L.exec(U))!==null)O.push({pos:w.index,type:"open"});while((w=_.exec(U))!==null)O.push({pos:w.index,type:"close"});while((w=F.exec(U))!==null)O.push({pos:w.index,type:"else"});O.sort((N,R)=>N.pos-R.pos);for(let N of O)if(N.type==="open")V++;else if(N.type==="close")V--;else if(N.type==="else"&&V===0){j=N.pos;break}}let B;if(j!==-1){let V=U.slice(0,j),L=U.slice(j+5);B=`@if (${H})${L}@else ${V}@endif`}else B=`@if (!(${H}))${U}@endif`;X=X.substring(0,z)+B+X.substring(W+10),Q=!0}}X=S5(X,Z,J),X=P5(X,Z,J),X=C5(X,Z);let Y=()=>{let Q=O2(X);if(Q.length===0)return!1;let G=Array(Q.length);for(let q=Q.length-1;q>=0;q--){let W=Q[q];try{let U="",H=!1;for(let j of W.branches){if(H)break;if(j.type==="else")U=j.content,H=!0;else try{let B;if(j.condition&&H0(j.condition))B=q0(j.condition,Object.keys(Z))(...Object.values(Z));else if(j.condition)B=Q0(j.condition,Z);if(B)U=j.content,H=!0}catch(B){U=R0(j.type==="if"?"If":"Elseif",`Error in @${j.type}(${j.condition}): ${B instanceof Error?B.message:String(B)}`,w0.EVALUATION_ERROR),H=!0}}G[q]=U}catch(U){let H=U instanceof Error?U.message:String(U);G[q]=R0("If",`Error processing @if block: ${H}`,w0.EVALUATION_ERROR)}}let z=Array(Q.length*2+1),K=0;for(let q=0;q<Q.length;q++){let W=Q[q];z[q*2]=X.slice(K,W.start),z[q*2+1]=G[q],K=W.end}return z[Q.length*2]=X.slice(K),X=z.join(""),!0};while(!0){let Q=X;if(!Y())break;if(X===Q)break}return X}function c7($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let J=$[Z];if(J!=="'"&&J!=='"')return null;Z++;let X=[];while(Z<$.length){let Y=$[Z];if(Y==="\\"&&Z+1<$.length){X.push($[Z+1]),Z+=2;continue}if(Y===J){Z++;break}X.push(Y),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:X.join(""),consumed:Z}}function C5($,Z){let J=$;function X(z,K,q,W){let U=1,H=W,j=new RegExp(`@${K}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${q}(?![a-z])`,"g");while(H<z.length&&U>0){j.lastIndex=H,B.lastIndex=H;let V=j.exec(z),L=B.exec(z),_=V?V.index:1/0,F=L?L.index:1/0;if(_<F)U++,H=_+V[0].length;else if(F<1/0){if(U--,U===0)return F;H=F+L[0].length}else break}return-1}function Y(z,K,q){let W=0,U=new RegExp(`@${K}(?:\\s*\\(|\\s|$)`,"g"),H=new RegExp(`@${q}(?![a-z])`,"g"),j=/@else(?![a-z])/g,B=[],V;while((V=U.exec(z))!==null)B.push({pos:V.index,type:"open"});while((V=H.exec(z))!==null)B.push({pos:V.index,type:"close"});while((V=j.exec(z))!==null)B.push({pos:V.index,type:"else"});B.sort((L,_)=>L.pos-_.pos);for(let L of B)if(L.type==="open")W++;else if(L.type==="close")W--;else if(L.type==="else"&&W===0)return L.pos;return-1}{let z=!0;while(z){z=!1;let K=J.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!K||K.index===void 0)break;let q=K.index,W,U,H=J.slice(q+5),j=c7(H);if(j)W=j.value,U=q+5+j.consumed;else U=q+5;let B=X(J,"auth","endauth",U);if(B===-1){console.warn(`[stx] @auth directive at position ${q} has no matching @endauth \u2014 the block was skipped.`);break}let V=J.slice(U,B),L=Y(V,"auth","endauth"),_;if(!Z.auth)_=!1;else _=W?G1(`auth?.check && auth?.user?.[${W}]`,Z):G1("auth?.check",Z);let F;if(L!==-1){let O=V.slice(0,L),w=V.slice(L+5);F=_?O:w}else F=_?V:"";J=J.substring(0,q)+F+J.substring(B+8),z=!0}}{let z=!0;while(z){z=!1;let K=J.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!K||K.index===void 0)break;let q=K.index,W,U,H=J.slice(q+6),j=c7(H);if(j)W=j.value,U=q+6+j.consumed;else U=q+6;let B=X(J,"guest","endguest",U);if(B===-1){console.warn(`[stx] @guest directive at position ${q} has no matching @endguest \u2014 the block was skipped.`);break}let V=J.slice(U,B),L=Y(V,"guest","endguest"),_;if(!Z.auth)_=!0;else _=W?G1(`!auth?.check || !auth?.user?.[${W}]`,Z):G1("!auth?.check",Z);let F;if(L!==-1){let O=V.slice(0,L),w=V.slice(L+5);F=_?O:w}else F=_?V:"";J=J.substring(0,q)+F+J.substring(B+9),z=!0}}function Q(z,K,q){if(Z.userCan&&typeof Z.userCan[z]==="boolean")return Z.userCan[z];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let W=[z];if(K)W.push(K);if(q){let U=G1(q,Z);W.push(U)}return Z.permissions.check(...W)}catch{return!1}return!1}function G(z){let K=z.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!K)return null;return{ability:K[1],type:K[2],id:K[3]?.trim(),paramsEnd:K[0].length}}for(let z of["can","cannot"]){let K=`end${z}`,q=z==="can"?"elsecan":"elsecannot",W=!0;while(W){W=!1;let U=J.match(new RegExp(`@${z}\\s*\\(`));if(!U||U.index===void 0)break;let H=U.index,j=J.slice(H+`@${z}`.length),B=G(j);if(!B)break;let V=H+`@${z}`.length+B.paramsEnd,L=X(J,z,K,V);if(L===-1){console.warn(`[stx] @${z} directive at position ${H} has no matching @${K} \u2014 the block was skipped.`);break}let _=J.slice(V,L),F=[],O=0,w=new RegExp(`@${z}\\s*\\(`,"g"),N=new RegExp(`@${K}(?![a-z])`,"g"),R=new RegExp(`@${q}\\s*\\(`,"g"),M=/@else(?![a-z])/g,T=[],D;while((D=w.exec(_))!==null)T.push({pos:D.index,type:"open"});while((D=N.exec(_))!==null)T.push({pos:D.index,type:"close"});while((D=R.exec(_))!==null)T.push({pos:D.index,type:"elseDirective"});while((D=M.exec(_))!==null)T.push({pos:D.index,type:"else"});T.sort((y,b)=>y.pos-b.pos);for(let y of T){if(y.type==="open"){O++;continue}if(y.type==="close"){O--;continue}if(O===0)F.push(y)}let I=[],E=0;for(let y=0;y<F.length;y++){let b=F[y];if(I.push({content:_.slice(E,b.pos),ability:void 0}),b.type==="elseDirective"){let P=_.slice(b.pos+`@${q}`.length),u=G(P);if(u){I[I.length-1]={content:_.slice(E,b.pos)},E=b.pos+`@${q}`.length+u.paramsEnd,I.push({content:"",ability:u.ability,type:u.type,id:u.id}),I.pop();let l=F[y+1],g=l?l.pos:_.length;I.push({content:_.slice(E,g),ability:u.ability,type:u.type,id:u.id}),E=g}}else E=b.pos+5}if(E<_.length){let y=I[I.length-1];if(F.length>0&&F[F.length-1].type==="else")I.push({content:_.slice(E),isFinalElse:!0});else if(I.length===0)I.push({content:_.slice(E)})}let A=Q(B.ability,B.type,B.id),k=z==="can"?A:!A,C="";if(k)C=I[0]?.content||"";else{let y=!1;for(let b=1;b<I.length;b++){let P=I[b];if(P.isFinalElse){C=P.content,y=!0;break}if(P.ability){let u=Q(P.ability,P.type,P.id);if(z==="can"?u:!u){C=P.content,y=!0;break}}}if(!y&&I.length>0){let b=I[I.length-1];if(b.isFinalElse)C=b.content}}J=J.substring(0,H)+C+J.substring(L+`@${K}`.length),W=!0}}return J}function S5($,Z,J){let X=$;function Y(Q,G,z,K,q){let W=!0;while(W){W=!1;let U=new RegExp(`@${G}\\s*\\(`),H=Q.match(U);if(!H||H.index===void 0)break;let j=H.index,B=z1(Q,j+`@${G}`.length);if(!B)break;let V=B.endPos,L=_1(Q,G,z,V);if(L===-1){console.warn(`[stx] @${G} directive at position ${j} has no matching @${z} \u2014 the block was skipped.`);break}let _=Q.slice(V,L),F=B.expression,O=-1,w=0,N=0;while(N<_.length){let R=_.indexOf("@",N);if(R===-1)break;let M=_.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(M)){w++,N=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(M)){w--,N=R+1;continue}if(w===0&&/^@else(?![a-z])/.test(M)){O=R;break}N=R+1}try{let R=K(F.trim()),M;if(O!==-1){let T=_.slice(0,O),D=_.slice(O+5);M=R?T:D}else M=R?_:"";Q=Q.substring(0,j)+M+Q.substring(L+`@${z}`.length),W=!0}catch(R){let M=R instanceof Error?R.message:String(R),T=R0(q,`Error processing @${G} directive: ${M}`,w0.EVALUATION_ERROR);Q=Q.substring(0,j)+T+Q.substring(L+`@${z}`.length);break}}return Q}return X=Y(X,"isset","endisset",(Q)=>{let G=G1(Q,Z);return G!==void 0&&G!==null},"Isset"),X=Y(X,"empty","endempty",(Q)=>{let G=G1(Q,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),X}function P5($,Z,J){let X=$,Y="development";function Q(G,z,K,q){let W=new RegExp(`@${z}(?![a-z])`,"g"),U=new RegExp(`@${K}(?![a-z])`,"g"),H=new RegExp(`^@${z}(?![a-z])`),j=new RegExp(`^@${K}(?![a-z])`),B=G,V=!0;while(V){V=!1,W.lastIndex=0;let L=W.exec(B);if(!L)break;let _=L.index,F=_+L[0].length;if(z==="env"){let A=B.substring(F).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!A)break;F+=A[0].length,q=Y===A[2]}let O=1,w=F,N=-1;while(O>0&&w<B.length){W.lastIndex=w,U.lastIndex=w;let A=W.exec(B),k=U.exec(B),C=A?A.index:1/0,y=k?k.index:1/0;if(C<y)O++,w=C+A[0].length;else if(y<1/0){if(O--,O===0){N=y;break}w=y+k[0].length}else break}if(N===-1){console.warn(`[stx] @${z} directive at position ${_} has no matching @${K} \u2014 the block was skipped.`);break}let R=B.substring(F,N),M=-1,T=0,D=0;while(D<R.length){let A=R.indexOf("@",D);if(A===-1)break;let k=R.substring(A);if(H.test(k)){T++,D=A+1;continue}if(j.test(k)){T--,D=A+1;continue}if(T===0&&/^@else(?![a-z])/.test(k)){M=A;break}D=A+1}let I;if(M!==-1){let A=R.slice(0,M),k=R.slice(M+5);I=q?A:k}else I=q?R:"";let E=`@${K}`.length;B=B.substring(0,_)+I+B.substring(N+E),V=!0}return B}return X=Q(X,"env","endenv",!1),X=Q(X,"production","endproduction",Y==="production"),X=Q(X,"development","enddevelopment",Y==="development"),X=Q(X,"staging","endstaging",Y==="staging"),X=Q(X,"testing","endtesting",Y==="testing"),X}var v5=new WeakMap;function p7($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function L1($,Z){if(!$)return Z?.nonceGenerator?.()??p7();let J=v5.get($);if(!J)J=Z?.nonceGenerator?.()??p7(),v5.set($,J);return J}function uU($){v5.delete($)}function i7($,Z){let J=[];for(let[X,Y]of Object.entries($)){if(Y===void 0||Y===null)continue;if(typeof Y==="boolean"){if(Y)J.push(X);continue}if(Array.isArray(Y)){let Q=[...Y];if(Z&&(X==="script-src"||X==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)J.push(`${X} ${Q.join(" ")}`)}}return J.join("; ")}function x5($,Z){return`<meta http-equiv="Content-Security-Policy" content="${i7($,Z).replace(/&/g,"&").replace(/"/g,""")}">`}var GY={"default-src":["'self'"],"script-src":["'self'","'strict-dynamic'"],"style-src":["'self'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'none'"],"base-uri":["'self'"],"form-action":["'self'"],"frame-ancestors":["'self'"],"upgrade-insecure-requests":!0},f5={"default-src":["'self'"],"script-src":["'self'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'","https:"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'self'"],"base-uri":["'self'"],"form-action":["'self'"],"upgrade-insecure-requests":!0},zY={"default-src":["'self'"],"script-src":["'self'","'unsafe-inline'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:","http:"],"font-src":["'self'","https:","http:","data:"],"connect-src":["'self'","https:","http:","ws:","wss:"],"media-src":["'self'","https:","http:"],"object-src":["'none'"],"frame-src":["'self'","https:"],"base-uri":["'self'"]},KY={"default-src":["'none'"],"frame-ancestors":["'none'"]};function mU($){return{enabled:!0,directives:{strict:GY,moderate:f5,relaxed:zY,api:KY}[$]||f5,useNonce:$==="strict",addMetaTag:!0}}function dU($,Z){let J={...$};for(let[X,Y]of Object.entries(Z)){let Q=X,G=J[Q];if(Y===void 0||Y===null)continue;if(typeof Y==="boolean")J[Q]=G||Y;else if(Array.isArray(Y)){let z=Array.isArray(G)?G:[],K=[...new Set([...z,...Y])];J[Q]=K}}return J}function n7($,Z,J){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let X=Z.useNonce?L1(J,Z):void 0,Y=x5(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
|
|
3173
|
+
${Y}`)}function o7($,Z){let J=$;return J=J.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(X,Y)=>{if(Y.includes("nonce="))return X;return`<script nonce="${Z}"${Y}>`}),J=J.replace(/<style([^>]*)>/gi,(X,Y)=>{if(Y.includes("nonce="))return X;return`<style nonce="${Z}"${Y}>`}),J}function s7($,Z,J,X){let Y=$,Q=X.csp;if(Y=Y.replace(/@csp\b/g,()=>{if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?L1(Z,Q):void 0;return x5(Q.directives,G)}),Y=Y.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return L1(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=L1(Z,Q);return Y}var qY={name:"csp",handler:($,Z,J,X)=>{let Q=J.__stx_options?.csp;if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?L1(J,Q):void 0;return x5(Q.directives,G)},hasEndTag:!1,description:"Insert Content-Security-Policy meta tag"},WY={name:"cspNonce",handler:($,Z,J,X)=>{let Q=J.__stx_options?.csp;if(!Q?.enabled||!Q.useNonce)return"";return L1(J,Q)},hasEndTag:!1,description:"Output the current CSP nonce value"};function lU(){return[qY,WY]}function cU($){let Z=[];if($["script-src"]?.includes("'unsafe-inline'"))Z.push("CSP: Using unsafe-inline in script-src significantly reduces XSS protection");if($["script-src"]?.includes("'unsafe-eval'"))Z.push("CSP: Using unsafe-eval in script-src allows eval() and related functions");if(!$["default-src"])Z.push("CSP: No default-src specified. Recommend adding default-src as a fallback");if($["default-src"]?.includes("*"))Z.push("CSP: Using * in default-src provides minimal protection");if(!$["object-src"]&&!$["default-src"]?.includes("'none'"))Z.push("CSP: Consider adding object-src: none to block plugins");if(!$["base-uri"])Z.push("CSP: Consider adding base-uri to prevent base tag injection attacks");for(let[J,X]of Object.entries($))if(Array.isArray(X)&&X.includes("http:"))Z.push(`CSP: Using http: in ${J} allows insecure resources`);return Z}function UY($=!1){return $?"Content-Security-Policy-Report-Only":"Content-Security-Policy"}function pU($,Z){if(!$.enabled)return{};let J=$.useNonce?L1(Z,$):void 0,X=i7($.directives,J);return{[UY($.reportOnly)]:X}}var iU={enabled:!1,reportOnly:!1,directives:f5,useNonce:!1,addMetaTag:!0};import HY from"crypto";var jY=40,r7="_token",g5=null;function BY($=jY){let Z=HY.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return g5=Z,Z}function VY(){if(!g5)BY();return g5}function OY($=r7){let Z=VY();return`<input type="hidden" name="${$}" value="${Z}">`}function a7($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,J,X)=>{return OY(X||r7)})}async function t7($,Z,J,X){if(!X.customDirectives||X.customDirectives.length===0)return $;let Y=$;for(let Q of X.customDirectives){if(!Q.name||typeof Q.handler!=="function"){if(X.debug)console.warn("Invalid custom directive:",Q);continue}if(Q.hasEndTag)Y=await _Y(Y,Q,Z,J,X);else Y=await LY(Y,Q,Z,J,X)}return Y}async function _Y($,Z,J,X,Y){let{name:Q,handler:G}=Z,z=`@${Q}`,K=`@end${Q}`,q=$,W=x1(`${z}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${K}`,"g"),U=[],H=W.exec(q);while(H!==null){let[j,B="",V=""]=H,L=H.index||0;try{let _=B?e7(B):[],F=V.trim(),O=await G(F,_,J,X);U.push({original:j,processed:O,startIndex:L})}catch(_){let F=_ instanceof Error?_.message:String(_);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,_);U.push({original:j,processed:R0("CustomDirective",`Error in @${Q}${B?`(${B})`:""}: ${F}`,w0.EVALUATION_ERROR),startIndex:L})}H=W.exec(q)}for(let j=U.length-1;j>=0;j--){let{original:B,processed:V}=U[j];q=q.replace(B,V)}return q}async function LY($,Z,J,X,Y){let{name:Q,handler:G}=Z,z=$,K=x1(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),q=[],W=K.exec(z);while(W!==null){let[j,B=""]=W,V=W.index||0;try{let L=e7(B),_=await G("",L,J,X);q.push({original:j,processed:_,startIndex:V})}catch(L){let _=L instanceof Error?L.message:String(L);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,L);q.push({original:j,processed:R0("CustomDirective",`Error in @${Q}(${B}): ${_}`,w0.EVALUATION_ERROR),startIndex:V})}W=K.exec(z)}let U=x1(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),H=U.exec(z);while(H!==null){let[j]=H,B=H.index||0;try{let V=await G("",[],J,X);q.push({original:j,processed:V,startIndex:B})}catch(V){let L=V instanceof Error?V.message:String(V);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,V);q.push({original:j,processed:R0("CustomDirective",`Error in @${Q}: ${L}`,w0.EVALUATION_ERROR),startIndex:B})}H=U.exec(z)}for(let j=q.length-1;j>=0;j--){let{original:B,processed:V}=q[j];z=z.replace(B,V)}return z}function e7($){if(!$.trim())return[];let Z=[],J="",X=!1,Y="";for(let Q=0;Q<$.length;Q++){let G=$[Q];if((G==='"'||G==="'")&&(Q===0||$[Q-1]!=="\\"))if(!X)X=!0,Y=G;else if(G===Y)X=!1;else J+=G;else if(G===","&&!X)Z.push(J.trim()),J="";else J+=G}if(J.trim())Z.push(J.trim());return Z.map((Q)=>{let G=Q.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var $4=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,Z4=/^[A-Za-z_$][\w$]*$/,FY=new Set(["light","dark","system"]);function F1($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function wY($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,J=Z.appearance,X=Z.colorMode;if(F1(Z.storageKey,"storageKey"),!J||typeof J!=="object"||Array.isArray(J))throw Error("@appearanceBootstrap appearance must be an object");if(!X||typeof X!=="object"||Array.isArray(X))throw Error("@appearanceBootstrap colorMode must be an object");if(F1(J.key,"appearance.key"),F1(J.attribute,"appearance.attribute"),F1(J.default,"appearance.default"),F1(X.key,"colorMode.key"),F1(X.attribute,"colorMode.attribute"),F1(X.default,"colorMode.default"),!Z4.test(J.key)||!Z4.test(X.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!$4.test(J.attribute)||!$4.test(X.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(J.allowed)||J.allowed.length===0||J.allowed.some((Y)=>typeof Y!=="string"||Y.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!J.allowed.includes(J.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!FY.has(X.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:Z.storageKey,appearance:{key:J.key,attribute:J.attribute,allowed:[...new Set(J.allowed)],default:J.default},colorMode:{key:X.key,attribute:X.attribute,default:X.default}}}function RY($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function NY($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${RY($)};const root=document.documentElement;const MODES=["light","dark","system"];function read(){let stored={};try{const raw=localStorage.getItem(config.storageKey);const parsed=raw?JSON.parse(raw):{};if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed))stored=parsed}catch{}return stored}function write(stored){try{localStorage.setItem(config.storageKey,JSON.stringify(stored))}catch{}}function resolve(){const stored=read();return{appearance:config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default,colorMode:MODES.includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default}}function prefersDark(){try{return matchMedia("(prefers-color-scheme: dark)").matches}catch{return false}}function apply(){const state=resolve();const dark=state.colorMode==="dark"||(state.colorMode==="system"&&prefersDark());root.setAttribute("data-"+config.appearance.attribute,state.appearance);root.setAttribute("data-"+config.colorMode.attribute,state.colorMode);root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light";state.dark=dark;try{window.dispatchEvent(new CustomEvent("stx:appearance",{detail:state}))}catch{}return state}function store(key,allowed,value){if(allowed.includes(value)){const stored=read();stored[key]=value;write(stored)}return apply()}window.__stxAppearance={config:config,read:read,resolve:resolve,apply:apply,setColorMode:function(mode){return store(config.colorMode.key,MODES,mode)},setAppearance:function(name){return store(config.appearance.key,config.appearance.allowed,name)},watchSystem:function(){try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(){if(resolve().colorMode==="system")apply()})}catch{}}};apply()}());</script>`}function DY($,Z){let J=1,X=null,Y=!1;for(let Q=Z+1;Q<$.length;Q++){let G=$[Q];if(Y){Y=!1;continue}if(X){if(G==="\\")Y=!0;else if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="(")J++;else if(G===")"&&--J===0)return Q}return-1}function J4($,Z){let J=$,X=/@appearanceBootstrap\s*\(/g,Y;while((Y=X.exec(J))!==null){let Q=Y.index+Y[0].length-1,G=DY(J,Q);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let z=J.slice(Q+1,G).trim(),K=Q0(`(${z})`,Z),q=NY(wY(K));J=J.slice(0,Y.index)+q+J.slice(G+1),X.lastIndex=Y.index+q.length}return J}import MY from"crypto";function D0($){return String($??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var u5={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function AY($){return{...u5,...$.forms?.classes}}function K9($,Z,J,X){let Y=$||Z;return J?`${Y} ${X}`:Y}function h0($){return String($).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function g1($,Z){if(/\bid\s*=/i.test($))return"";return` id="${D0(Z)}"`}function h5($,Z,J){if(!Z)return"";let X="";if(!/\baria-invalid\s*=/i.test(J))X+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(J))X+=` aria-describedby="${D0(`${h0($)}-error`)}"`;return X}function IY(){return MY.randomUUID()}function XH($,Z,J,X){let Y=AY(X),Q=$;return Q=kY(Q,Z),Q=F2(Q,Z),Q=m5(Q,Z,Y),Q=d5(Q,Z,Y),Q}function F2($,Z){let J=$;return J=J.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let X=IY();Z.csrf={token:X}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${D0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),J=J.replace(/@method\(['"]([^'"]+)['"]\)/g,(X,Y)=>{let Q=Y.toUpperCase();if(Y&&!["GET","POST"].includes(Q))return`<input type="hidden" name="_method" value="${D0(Q)}">`;return X}),J}function m5($,Z,J=u5){let X=$;return X=X.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Y,Q,G,z,K,q="")=>{let W=Q||G||"POST",U=z||K||"",H=K1(q),j=W.toUpperCase(),B=["GET","POST"].includes(j)?j:"POST",V=`<form method="${D0(B)}" action="${D0(U)}"${H?` ${H}`:""}>`;if(V+=`
|
|
3174
|
+
${F2("@csrf",Z)}`,!["GET","POST"].includes(j))V+=`
|
|
3175
|
+
${F2(`@method('${j}')`,Z)}`;return V}),X=X.replace(/@endform/g,"</form>"),X=X.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Y,Q,G,z,K,q="")=>{let W=Q||G||"",U=z||K||"",H=K1(q),j=_2(W,Z),B=j!==void 0&&j!==null?j:U||"",V=H.match(/type=['"]([^'"]+)['"]/i),L=V?V[1]:"text",_=L2(W,Z),F=H.match(/class=['"]([^'"]+)['"]/i),O=K9(F?F[1]:"",J.input,_,J.inputError),w=H.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${D0(L)}" name="${D0(W)}"${g1(H,h0(W))} value="${D0(B)}" class="${O}"${h5(W,_,H)}${w?` ${w}`:""}>`}),X=X.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Y,Q,G="",z="")=>{let K=K1(G),q=_2(Q,Z)||z.trim(),W=L2(Q,Z),U=K.match(/class=['"]([^'"]+)['"]/i),H=K9(U?U[1]:"",J.input,W,J.inputError),j=K.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${D0(Q)}"${g1(K,h0(Q))} class="${H}"${h5(Q,W,K)}${j?` ${j}`:""}>${D0(q)}</textarea>`}),X=X.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Y,Q,G="",z)=>{let K=K1(G),q=_2(Q,Z),W=L2(Q,Z),U=K.match(/class=['"]([^'"]+)['"]/i),H=K9(U?U[1]:"",J.input,W,J.inputError),j=K.replace(/class=['"][^'"]+['"]/i,""),B=z;if(q!==void 0)B=z.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(V,L,_)=>{if((Array.isArray(q)?q.some((O)=>String(O)===_):String(q)===_)&&!L.includes("selected"))return L.replace(/(<option)/,"$1 selected");return V});return`<select name="${D0(Q)}"${g1(K,h0(Q))} class="${H}"${h5(Q,W,K)}${j?` ${j}`:""}>${B}</select>`}),X=X.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G,z="")=>{let K=G===void 0?"1":G,q=G===void 0?h0(Q):`${h0(Q)}-${h0(K)}`,W=K1(z),U=_2(Q,Z),H=U!==void 0&&(Array.isArray(U)?U.some((L)=>String(L)===K):U===!0||String(U)===K),j=W.match(/class=['"]([^'"]+)['"]/i),B=j?j[1]:J.checkInput,V=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${D0(Q)}"${g1(W,q)} value="${D0(K)}" class="${B}"${H?" checked":""}${V?` ${V}`:""}>`}),X=X.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G,z="")=>{let K=K1(z),q=_2(Q,Z),W=q!==void 0&&q===G,U=K.match(/class=['"]([^'"]+)['"]/i),H=U?U[1]:J.checkInput,j=K.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${D0(Q)}"${g1(K,`${h0(Q)}-${h0(G)}`)} value="${D0(G)}" class="${H}"${W?" checked":""}${j?` ${j}`:""}>`}),X=X.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G="")=>{let z=K1(G),K=z.match(/accept=['"]([^'"]+)['"]/i),q=K?K[1]:"",W=z.includes("multiple"),U=L2(Q,Z),H=z.match(/class=['"]([^'"]+)['"]/i),j=K9(H?H[1]:"",J.input,U,J.inputError),B=z.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),V=[`<input type="file" name="${D0(Q)}"${g1(z,h0(Q))}`,`class="${j}"`];if(q)V.push(`accept="${D0(q)}"`);if(W)V.push("multiple");if(B)V.push(B);return`${V.join(" ")}>`}),X=X.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Y,Q,G="",z)=>{let K=K1(G),q=K.match(/class=['"]([^'"]+)['"]/i),W=q?q[1]:J.label,U=K.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${D0(h0(Q))}" class="${W}"${U?` ${U}`:""}>${z}</label>`}),X}function d5($,Z,J=u5){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(X,Y,Q)=>{try{if(L2(Y,Z)){let G=Q.replace(/\{\{([^}]+)\}\}/g,(z,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return X4(Y,Z);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(Y);return X4(Y,Z)}let q=K.trim();if(H0(q)){let W=Q0(q,Z);return W!==void 0?String(W):q}return q}catch{return K}});return`<div id="${D0(`${h0(Y)}-error`)}" role="alert">${G}</div>`}return""}catch(G){return console.error("Error processing @error directive:",G),X}})}function L2($,Z){if(!Z.errors)return!1;if(typeof Z.errors.has==="function")return Z.errors.has($);if(typeof Z.errors==="object")return Object.prototype.hasOwnProperty.call(Z.errors,$);return!1}function X4($,Z){if(!Z.errors)return"";if(typeof Z.errors.get==="function")return Z.errors.get($);if(typeof Z.errors==="object"&&Object.prototype.hasOwnProperty.call(Z.errors,$)){let J=Z.errors[$];return Array.isArray(J)?J[0]:String(J)}return""}function _2($,Z){let J;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let X=$.slice(0,-2);if(J=Z[X],J!==void 0)return J}return Z[$]}function K1($){if(!$.trim())return"";let Z=[],J=$.trim(),X=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Y;while((Y=X.exec(J))!==null){let[,Q,,G]=Y;Z.push(`${Q}="${G.trim()}"`)}return Z.join(" ")}var Y4={required:($,Z,J)=>{if($===void 0||$===null||$===""||Array.isArray($)&&$.length===0)return`The ${J} field is required.`;return null},email:($,Z,J)=>{if(!$)return null;if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($)))return`The ${J} field must be a valid email address.`;return null},min:($,Z,J)=>{if(!$)return null;let X=Number(Z[0]);if(typeof $==="string"&&$.length<X)return`The ${J} field must be at least ${X} characters.`;if(typeof $==="number"&&$<X)return`The ${J} field must be at least ${X}.`;if(Array.isArray($)&&$.length<X)return`The ${J} field must have at least ${X} items.`;return null},max:($,Z,J)=>{if(!$)return null;let X=Number(Z[0]);if(typeof $==="string"&&$.length>X)return`The ${J} field must not exceed ${X} characters.`;if(typeof $==="number"&&$>X)return`The ${J} field must not exceed ${X}.`;if(Array.isArray($)&&$.length>X)return`The ${J} field must not have more than ${X} items.`;return null},confirmed:($,Z,J)=>{if(Z[0]!==void 0&&$!==Z[0])return`The ${J} confirmation does not match.`;return null},numeric:($,Z,J)=>{if(!$)return null;if(Number.isNaN(Number($)))return`The ${J} field must be a number.`;return null},integer:($,Z,J)=>{if(!$)return null;if(!Number.isInteger(Number($)))return`The ${J} field must be an integer.`;return null},alpha:($,Z,J)=>{if(!$)return null;if(!/^[a-z]+$/i.test(String($)))return`The ${J} field must only contain letters.`;return null},alphanumeric:($,Z,J)=>{if(!$)return null;if(!/^[a-z0-9]+$/i.test(String($)))return`The ${J} field must only contain letters and numbers.`;return null},url:($,Z,J)=>{if(!$)return null;try{return new URL(String($))?null:null}catch{return`The ${J} field must be a valid URL.`}},regex:($,Z,J)=>{if(!$)return null;try{if(!new RegExp(Z[0]).test(String($)))return`The ${J} field format is invalid.`;return null}catch{return`The ${J} field has an invalid validation pattern.`}},in:($,Z,J)=>{if(!$)return null;if(!Z.includes(String($)))return`The ${J} field must be one of: ${Z.join(", ")}.`;return null},notIn:($,Z,J)=>{if(!$)return null;if(Z.includes(String($)))return`The ${J} field must not be: ${Z.join(", ")}.`;return null},date:($,Z,J)=>{if(!$)return null;let X=new Date($);if(Number.isNaN(X.getTime()))return`The ${J} field must be a valid date.`;return null},before:($,Z,J)=>{if(!$)return null;let X=new Date($),Y=new Date(Z[0]);if(X>=Y)return`The ${J} field must be before ${Z[0]}.`;return null},after:($,Z,J)=>{if(!$)return null;let X=new Date($),Y=new Date(Z[0]);if(X<=Y)return`The ${J} field must be after ${Z[0]}.`;return null}};function YH($,Z){Y4[$]=Z}function l5($){let[Z,...J]=$.split(":"),X=J.length>0?J.join(":").split(","):[];return{name:Z.trim(),params:X}}function TY($,Z,J,X={}){let Y=[],Q=J.split("|").map((G)=>G.trim()).filter(Boolean);for(let G of Q){let z=l5(G),K=Y4[z.name];if(!K){console.warn(`Unknown validation rule: ${z.name}`);continue}if(z.name==="confirmed"){let W=`${$}_confirmation`;z.params=[X[W]]}let q=K(Z,z.params||[],$);if(q)Y.push(z.message||q)}return{field:$,valid:Y.length===0,errors:Y}}function QH($,Z){let J={};for(let[X,Y]of Object.entries(Z)){let Q=TY(X,$[X],Y,$);if(!Q.valid)J[X]=Q.errors}return J}function kY($,Z){return $.replace(/@validate\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]*)\})?\s*\)/g,(J,X,Y,Q)=>{let G=Y.split("|").map((K)=>K.trim()),z=[];for(let K of G){let q=l5(K);switch(q.name){case"required":z.push("required");break;case"email":z.push('type="email"');break;case"url":z.push('type="url"');break;case"numeric":case"integer":if(z.push('type="number"'),q.name==="integer")z.push('step="1"');break;case"min":if(q.params?.[0])z.push(`minlength="${q.params[0]}"`);break;case"max":if(q.params?.[0])z.push(`maxlength="${q.params[0]}"`);break;case"regex":if(q.params?.[0])z.push(`pattern="${q.params[0]}"`);break}}return`<!-- @validate:${X}:${Y} -->${z.length>0?`<!-- attrs:${z.join(" ")} -->`:""}`})}var Q4={required:{name:"required",validate:($)=>{if($===null||$===void 0||$==="")return"This field is required";if(Array.isArray($)&&$.length===0)return"This field is required";return!0},toHtml5:()=>["required"],message:"This field is required"},email:{name:"email",validate:($)=>{if(!$)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($))||"Please enter a valid email address"},toHtml5:()=>['type="email"'],message:"Please enter a valid email address"},url:{name:"url",validate:($)=>{if(!$)return!0;try{return new URL(String($)).protocol.startsWith("http")||"Please enter a valid URL"}catch{return"Please enter a valid URL"}},toHtml5:()=>['type="url"'],message:"Please enter a valid URL"},numeric:{name:"numeric",validate:($)=>{if(!$)return!0;return!Number.isNaN(Number($))||"Please enter a number"},toHtml5:()=>['type="number"'],message:"Please enter a number"},integer:{name:"integer",validate:($)=>{if(!$)return!0;let Z=Number($);return Number.isInteger(Z)||"Please enter a whole number"},toHtml5:()=>['type="number"','step="1"'],message:"Please enter a whole number"},alpha:{name:"alpha",validate:($)=>{if(!$)return!0;return/^[a-z]+$/i.test(String($))||"Please enter only letters"},toHtml5:()=>['pattern="[a-zA-Z]+"'],message:"Please enter only letters"},alphanumeric:{name:"alphanumeric",validate:($)=>{if(!$)return!0;return/^[a-z0-9]+$/i.test(String($))||"Please enter only letters and numbers"},toHtml5:()=>['pattern="[a-zA-Z0-9]+"'],message:"Please enter only letters and numbers"},min:{name:"min",validate:($,Z)=>{if(!$)return!0;let J=Number(Z[0]);if(typeof $==="string")return $.length>=J||`Must be at least ${J} characters`;if(typeof $==="number")return $>=J||`Must be at least ${J}`;if(Array.isArray($))return $.length>=J||`Must have at least ${J} items`;return!0},toHtml5:($)=>[`minlength="${$[0]}"`,`min="${$[0]}"`],message:"Must be at least {{param}} characters"},max:{name:"max",validate:($,Z)=>{if(!$)return!0;let J=Number(Z[0]);if(typeof $==="string")return $.length<=J||`Must be no more than ${J} characters`;if(typeof $==="number")return $<=J||`Must be no more than ${J}`;if(Array.isArray($))return $.length<=J||`Must have no more than ${J} items`;return!0},toHtml5:($)=>[`maxlength="${$[0]}"`,`max="${$[0]}"`],message:"Must be no more than {{param}} characters"},between:{name:"between",validate:($,Z)=>{if(!$)return!0;let[J,X]=Z.map(Number);if(typeof $==="string")return $.length>=J&&$.length<=X||`Must be between ${J} and ${X} characters`;if(typeof $==="number")return $>=J&&$<=X||`Must be between ${J} and ${X}`;return!0},toHtml5:($)=>[`minlength="${$[0]}"`,`maxlength="${$[1]}"`],message:"Must be between {{min}} and {{max}}"},confirmed:{name:"confirmed",validate:($,Z,J)=>{let X=Object.keys(J);for(let Y of X)if(Y.endsWith("_confirmation")&&J[Y]===$)return!0;return"Confirmation does not match"},message:"Confirmation does not match"},in:{name:"in",validate:($,Z)=>{if(!$)return!0;return Z.includes(String($))||`Must be one of: ${Z.join(", ")}`},message:"Must be one of: {{values}}"},notIn:{name:"notIn",validate:($,Z)=>{if(!$)return!0;return!Z.includes(String($))||`Must not be: ${Z.join(", ")}`},message:"Must not be: {{values}}"},regex:{name:"regex",validate:($,Z)=>{if(!$)return!0;try{return new RegExp(Z[0]).test(String($))||"Invalid format"}catch{return"Invalid format"}},toHtml5:($)=>[`pattern="${$[0]}"`],message:"Invalid format"},date:{name:"date",validate:($)=>{if(!$)return!0;let Z=new Date(String($));return!Number.isNaN(Z.getTime())||"Please enter a valid date"},toHtml5:()=>['type="date"'],message:"Please enter a valid date"},before:{name:"before",validate:($,Z)=>{if(!$)return!0;let J=new Date(String($)),X=new Date(Z[0]);return J<X||`Must be before ${Z[0]}`},toHtml5:($)=>[`max="${$[0]}"`],message:"Must be before {{date}}"},after:{name:"after",validate:($,Z)=>{if(!$)return!0;let J=new Date(String($)),X=new Date(Z[0]);return J>X||`Must be after ${Z[0]}`},toHtml5:($)=>[`min="${$[0]}"`],message:"Must be after {{date}}"},size:{name:"size",validate:($,Z)=>{if(!$)return!0;let J=Number(Z[0]);if(typeof $==="string")return $.length===J||`Must be exactly ${J} characters`;if(Array.isArray($))return $.length===J||`Must have exactly ${J} items`;return!0},message:"Must be exactly {{size}}"},phone:{name:"phone",validate:($)=>{if(!$)return!0;return/^\+?\(?\d{1,4}\)?[-\s./\d]*$/.test(String($))||"Please enter a valid phone number"},toHtml5:()=>['type="tel"','pattern="\\+?\\(?\\d{1,4}\\)?[-\\s./\\d]*"'],message:"Please enter a valid phone number"}};function GH($){Q4[$.name]=$}function EY($,Z,J={}){let X=[],Y=Z.split("|").map((Q)=>Q.trim());for(let Q of Y){let G=l5(Q),z=Q4[G.name];if(!z){console.warn(`Unknown validation rule: ${G.name}`);continue}let K=z.validate($,G.params||[],J);if(K!==!0)X.push(K)}return{valid:X.length===0,errors:X}}function zH($,Z){let J={},X=!0;for(let[Y,Q]of Object.entries(Z)){let G=EY($[Y],Q,$);if(!G.valid)X=!1,J[Y]=G.errors}return{valid:X,errors:J}}function KH($,Z){let J=JSON.stringify(Z);return`
|
|
3176
|
+
<script>
|
|
3177
|
+
(function() {
|
|
3178
|
+
const form = document.getElementById('${$}');
|
|
3179
|
+
if (!form) return;
|
|
3180
|
+
|
|
3181
|
+
const rules = ${J};
|
|
3182
|
+
const validators = {
|
|
3183
|
+
required: (v) => v !== null && v !== undefined && v !== '' ? true : 'This field is required',
|
|
3184
|
+
email: (v) => !v || /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(v) ? true : 'Please enter a valid email',
|
|
3185
|
+
url: (v) => { if (!v) return true; try { new URL(v); return true; }
|
|
3186
|
+
catch { return 'Please enter a valid URL'; } },
|
|
3187
|
+
numeric: (v) => !v || !isNaN(Number(v)) ? true : 'Please enter a number',
|
|
3188
|
+
integer: (v) => !v || Number.isInteger(Number(v)) ? true : 'Please enter a whole number',
|
|
3189
|
+
min: (v, p) => !v || (typeof v === 'string' ? v.length >= p : v >= p) ? true : 'Too short/small',
|
|
3190
|
+
max: (v, p) => !v || (typeof v === 'string' ? v.length <= p : v <= p) ? true : 'Too long/large',
|
|
3191
|
+
regex: (v, p) => !v || new RegExp(p).test(v) ? true : 'Invalid format',
|
|
3192
|
+
};
|
|
3193
|
+
|
|
3194
|
+
form.addEventListener('submit', function(e) {
|
|
3195
|
+
let valid = true;
|
|
3196
|
+
const errors = {};
|
|
3197
|
+
|
|
3198
|
+
for (const [field, fieldRules] of Object.entries(rules)) {
|
|
3199
|
+
const input = form.querySelector('[name="' + field + '"]');
|
|
3200
|
+
if (!input) continue;
|
|
3201
|
+
|
|
3202
|
+
const value = input.value;
|
|
3203
|
+
const ruleList = fieldRules.split('|');
|
|
3204
|
+
|
|
3205
|
+
for (const rule of ruleList) {
|
|
3206
|
+
const [name, param] = rule.split(':');
|
|
3207
|
+
const validator = validators[name];
|
|
3208
|
+
if (validator) {
|
|
3209
|
+
const result = validator(value, param);
|
|
3210
|
+
if (result !== true) {
|
|
3211
|
+
valid = false;
|
|
3212
|
+
errors[field] = errors[field] || [];
|
|
3213
|
+
errors[field].push(result);
|
|
3214
|
+
input.classList.add('is-invalid');
|
|
3215
|
+
break;
|
|
3216
|
+
}
|
|
3217
|
+
}
|
|
3218
|
+
}
|
|
3219
|
+
}
|
|
3220
|
+
|
|
3221
|
+
if (!valid) {
|
|
3222
|
+
e.preventDefault();
|
|
3223
|
+
console.log('Validation errors:', errors);
|
|
3224
|
+
}
|
|
3225
|
+
});
|
|
3226
|
+
})();
|
|
3227
|
+
</script>`.trim()}var w2=/<\/?template\b[^>]*>/gi,bY=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function yY($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return bY.test(Z)}function q9($){w2.lastIndex=0;let Z;while((Z=w2.exec($))!==null){if(Z[0].startsWith("</")||yY(Z[0]))continue;let J=Z.index,X=w2.lastIndex,Y=1,Q;while((Q=w2.exec($))!==null)if(Q[0].startsWith("</")){if(Y--,Y===0){let G=Q.index;return{start:J,openEnd:X,closeStart:G,end:w2.lastIndex,content:$.slice(X,G)}}}else Y++;return null}return null}import z0 from"path";import{existsSync as UQ}from"fs";import W9 from"fs";import B0 from"path";var G4=new Map;function U9($,Z=!0){let J=G4.get($);if(Z&&J)return J;let X=new Map,Y=[B0.join($,"src"),B0.join($,"dist"),$];function Q(G,z){if(z>6)return;let K;try{K=W9.readdirSync(G,{withFileTypes:!0})}catch{return}for(let q of K){let W=B0.join(G,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;Q(W,z+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let U=q.name.slice(0,-4);if(!X.has(U))X.set(U,W);let H=U.toLowerCase();if(!X.has(H))X.set(H,W);let j=U.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!X.has(j))X.set(j,W)}}}for(let G of Y)if(Q(G,0),X.size>0)break;if(Z)G4.set($,X);return X}function H9($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let J=Z;while(!0){let X=B0.join(J,"node_modules",$);try{if(W9.statSync(X).isDirectory())return X}catch{}let Y=B0.dirname(J);if(Y===J)return null;J=Y}}function j9($,Z,J={}){return[B0.resolve(B0.dirname(Z),`${$}.stx`),B0.resolve(B0.dirname(Z),$),B0.resolve(J.componentsDir||"components",`${$}.stx`),B0.resolve(J.componentsDir||"components",$),$.endsWith(".stx")?$:`${$}.stx`]}function z4($){let Z=$.endsWith(".stx")?$.slice(0,-4):$,J=Z.split("-").map((Y)=>Y.charAt(0).toUpperCase()+Y.slice(1)).join(""),X=Z.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return[Z,J,X]}function c5($,Z){let[J,X,Y]=z4($);for(let Q of[J,J.toLowerCase(),X,Y]){let G=Z?.__importedComponents?.get(Q);if(G!==void 0)return G}}function*p5($,Z,J={},X){let Y=z4($);if(Y[0].startsWith("./")||Y[0].startsWith("../")){yield B0.resolve(B0.dirname(Z),`${Y[0]}.stx`);return}let Q=[...new Set(Y.map((K)=>`${K}.stx`))],G=J.projectRoot||process.cwd(),z=[...X?.__originalFilePath?[B0.join(B0.dirname(X.__originalFilePath),"components")]:[],...J.componentsDir?[J.componentsDir]:[],B0.join(B0.dirname(Z),"components"),B0.resolve(G,"src/components"),B0.resolve(G,"components"),...import.meta.dir?[B0.resolve(import.meta.dir,"components")]:[]];for(let K of new Set(z)){for(let q of Q)yield B0.join(K,q);try{for(let q of W9.readdirSync(K,{withFileTypes:!0}))if(q.isDirectory())for(let W of Q)yield B0.join(K,q.name,W)}catch{}}}function K4($,Z,J={},X){let Y=c5($,X);if(Y!==void 0)return Y;for(let Q of p5($,Z,J,X))try{if(W9.statSync(Q,{throwIfNoEntry:!1})?.isFile())return Q}catch{}return null}class q4{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,J,X){let Y=c5($,X);if(Y!==void 0)return Y;for(let Q of p5($,Z,J,X))if(await e(Q))return Q;return null}}var h1=new q4;function I0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var w1="\x00stx-boolean-attribute";function i5($){return $.indexOf("\x00")===-1?$:$.replace(/\0/g,"")}function u1($,Z){let J=[];for(let[X,Y]of Object.entries($.static)){if(Z.has(X))continue;let Q=$.staticNames?.[X]??X;if(typeof Y==="boolean"){if(Y)J.push(I0(Q));continue}if(Y===w1){J.push(I0(Q));continue}J.push(`${I0(Q)}="${I0(i5(String(Y)))}"`)}return J}function m1($,Z){let J=[];for(let[X,Y]of Object.entries($.serverDynamic??{})){if(Z.has(X))continue;if(Y===null||Y===void 0||Y===!1)continue;let Q=$.serverDynamicNames?.[X]??X;if(Y===!0){J.push(I0(Q));continue}if(typeof Y==="object")continue;J.push(`${I0(Q)}="${I0(i5(String(Y)))}"`)}return J}function d1($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function CY($){if($.clientReactive.to)return{value:$.clientReactive.to,reactive:!0};if($.serverDynamic.to!==void 0)return{value:String($.serverDynamic.to),reactive:!1};if(typeof $.static.to==="string")return{value:$.static.to,reactive:!1};return{value:"#",reactive:!1}}var n5={name:"StxLink",aliases:["stx-link"],render($,Z,J){let X=CY($),Y=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),Q=typeof $.static.activeClass==="string"?$.static.activeClass:"active",G=typeof $.static.exactActiveClass==="string"?$.static.exactActiveClass:"exact-active",z=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,K=[];if(X.reactive)K.push(`:href="${d1(X.value)}"`);else K.push(`href="${d1(X.value)}"`);if(Y)K.push(`class="${d1(Y)}"`);if(K.push("data-stx-link"),K.push(`data-stx-active-class="${d1(Q)}"`),K.push(`data-stx-exact-active-class="${d1(G)}"`),z)K.push("data-stx-prefetch");let q=typeof $.static.activeMatch==="string"?$.static.activeMatch.trim():"";if(q)K.push(`data-stx-active-match="${d1(q)}"`);let W=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return K.push(...u1($,W)),K.push(...m1($,W)),`<a ${K.join(" ")}>${Z}</a>`}};import l1 from"fs";import o5 from"path";var SY=new Set([".jpg",".jpeg",".png",".webp",".avif"]),i0=new Map,R1=!1;function s5($){if(!$)return;let Z=$.split("?")[0].split("#")[0];return i0.get(Z)}function kH(){return R1}function EH(){i0.clear(),R1=!1}function bH($,Z){i0.set($,Z),R1=!0}function PY($){for(let Z=3;Z<$.length;Z+=4)if($[Z]<255)return!0;return!1}function vY($){let Z=0,J=0,X=0,Y=0;for(let G=0;G<$.length;G+=4)Z+=$[G],J+=$[G+1],X+=$[G+2],Y++;if(Y===0)return"#e5e7eb";let Q=(G)=>Math.round(G/Y).toString(16).padStart(2,"0");return`#${Q(Z)}${Q(J)}${Q(X)}`}function fY($,Z,J,X=4,Y=3){let Q=[];for(let G=0;G<Y;G++)for(let z=0;z<X;z++){let K=Math.floor(z*Z/X),q=Math.max(K+1,Math.floor((z+1)*Z/X)),W=Math.floor(G*J/Y),U=Math.max(W+1,Math.floor((G+1)*J/Y)),H=0,j=0,B=0,V=0;for(let _=W;_<U;_++)for(let F=K;F<q;F++){let O=(_*Z+F)*4;H+=$[O],j+=$[O+1],B+=$[O+2],V++}let L=(_)=>Math.round(_/V).toString(16).padStart(2,"0");Q.push(`<rect x="${z}" y="${G}" width="1" height="1" fill="#${L(H)}${L(j)}${L(B)}"/>`)}return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${X} ${Y}" preserveAspectRatio="none"><filter id="b"><feGaussianBlur stdDeviation=".6"/></filter><g filter="url(#b)">${Q.join("")}</g></svg>`}function xY($){return`data:image/svg+xml;base64,${Buffer.from($,"utf8").toString("base64")}`}function gY($){try{return JSON.parse(l1.readFileSync($,"utf8"))}catch{return{}}}function hY($,Z){try{l1.mkdirSync(o5.dirname($),{recursive:!0}),l1.writeFileSync($,JSON.stringify(Z))}catch{}}function j4($,Z,J=[]){let X;try{X=l1.readdirSync($,{withFileTypes:!0})}catch{return J}for(let Y of X){let Q=o5.join($,Y.name);if(Y.isDirectory()){j4(Q,`${Z}/${Y.name}`,J);continue}if(!SY.has(o5.extname(Y.name).toLowerCase()))continue;J.push([`${Z}/${Y.name}`,Q])}return J}async function yH($,Z={}){let{cachePath:J,maxBytes:X=33554432,limit:Y=2000,offThread:Q}=Z;if(!$||!l1.existsSync($))return R1=!0,i0.size;if(Q){let H=await H4("placeholders",{publicDir:$,options:{cachePath:J,maxBytes:X,limit:Y}});if(H!==U4){for(let[j,B]of H.placeholders)i0.set(j,B);return R1=!0,i0.size}}let G;try{G=await import("ts-images")}catch{return R1=!0,i0.size}let z=J?gY(J):{},K=!1,q=j4($,"").slice(0,Y),W=8,U=async([H,j])=>{let B;try{B=l1.statSync(j)}catch{return}if(B.size>X)return;let V=z[H];if(V&&V.mtimeMs===B.mtimeMs&&V.size===B.size){let L=V.transparent;if(typeof L!=="boolean"&&W4(j)==="none")L=!1,z[H]={...V,transparent:L},K=!0;if(typeof L==="boolean"){i0.set(H,{dataUrl:V.dataUrl,color:V.color,transparent:L});return}}try{let{hash:L}=await G.generateThumbHash(j);if(!L)return;let{rgba:_,w:F,h:O}=G.thumbHashToRGBA(L),w={dataUrl:xY(fY(_,F,O)),color:vY(_),transparent:PY(_)};i0.set(H,w),z[H]={mtimeMs:B.mtimeMs,size:B.size,...w},K=!0}catch{}};for(let H=0;H<q.length;H+=W)await Promise.all(q.slice(H,H+W).map(U));if(J&&K)hY(J,z);return R1=!0,i0.size}var uY={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},r5=[320,640,768,1024,1280,1536,1920];function L0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function E0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}function B9($,Z,J=!1){let X=$.serverDynamic[Z];if(X!==void 0)return X!==!1&&X!=="false";let Y=$.static[Z];if(Y!==void 0)return Y!=="false"&&Y!==!1;return J}function mY($){let Z=(X)=>$.variants.filter((Y)=>Y.format===X).reduce((Y,Q)=>Y+Q.bytes,0),J=Z($.fallback.format);return["avif","webp"].map((X)=>({format:X,srcset:$.sources[X]||"",bytes:Z(X)})).filter((X)=>X.srcset&&X.bytes>0&&X.bytes<J).sort((X,Y)=>X.bytes-Y.bytes).map(({format:X,srcset:Y})=>({format:X,srcset:Y}))}function a5($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),J=[];for(let X of Z)if(X.includes(":")){let[Y,Q]=X.split(":"),G=uY[Y];if(G)J.push(`(max-width: ${G}px) ${Q}`);else{let z=Number.parseInt(Y);if(!Number.isNaN(z))J.push(`(max-width: ${z}px) ${Q}`)}}else J.push(X);return J.join(", ")}function t5($,Z,J,X){return Z.map((Y)=>`${R2($,Y,void 0,J,X)} ${Y}w`).join(", ")}function dY($,Z,J,X,Y){return Z.map((Q)=>{let G=J?J*Q:void 0;return`${R2($,G,void 0,X,Y)} ${Q}x`}).join(", ")}function R2($,Z,J,X,Y){if(!X||X==="local"||X==="static")return $;if(X==="cloudinary"){let Q=[];if(Z)Q.push(`w_${Z}`);if(J)Q.push(`h_${J}`);if(Y)Q.push(`f_${Y}`);Q.push("q_auto");let G=Q.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(X==="imgix"){let Q=new URLSearchParams;if(Z)Q.set("w",String(Z));if(J)Q.set("h",String(J));if(Y)Q.set("fm",Y);Q.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}if(X==="bunny"){let Q=new URLSearchParams;if(Z)Q.set("width",String(Z));if(J)Q.set("height",String(J));if(Y)Q.set("format",Y);let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}return $}function lY($){return`var s=this.style;${$.map((Z)=>`s.${Z}=''`).join(";")}`}function cY($,Z,J="#e5e7eb"){let X=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${J}"/></svg>`;return`data:image/svg+xml;base64,${btoa(X)}`}var e5={name:"StxImage",aliases:["Image","stx-image","stx-img"],render($,Z,J){let X=E0($,"src")||"",Y=B4(X),Q=E0($,"alt")||"",G=E0($,"width")||(Y?String(Y.source.width):void 0),z=E0($,"height")||(Y?String(Y.source.height):void 0),K=E0($,"sizes"),q=E0($,"srcset"),W=E0($,"densities"),U=E0($,"format"),H=V4(X)||s5(X)?.transparent===!0,j=E0($,"placeholder")||(Y&&!H?"thumbhash":void 0),B=E0($,"placeholderColor")||"#e5e7eb",V=E0($,"provider"),L=E0($,"class")||E0($,"className")||"",_=E0($,"style")||"",F=E0($,"quality"),O=B9($,"lazy",!0),w=B9($,"preload",!1),N=B9($,"priority",!1),R=E0($,"loading"),M=E0($,"decoding")||"async",T=!!Y||B9($,"picture",!1)||!!U,D=G?Number.parseInt(G):void 0,I=z?Number.parseInt(z):void 0,E=q||"",A="";if(Y)E=Y.sources[Y.fallback.format]||"",A=K?a5(K):"100vw";else if(!E&&K&&V&&V!=="local"&&V!=="static")E=t5(X,r5,V,U),A=a5(K);else if(!E&&W){let X0=W.split(/\s+/).map(($0)=>Number.parseFloat($0.replace("x","")));E=dY(X,X0,D,V,U)}else if(K)A=a5(K);let k=[];if(_)k.push(_);if(D&&I)k.push(`aspect-ratio:${D}/${I}`);let C=[],y=j==="blur"||j==="color"||j==="thumbhash";if(y&&!H){let X0=Y?.placeholder?{dataUrl:Y.placeholder.dataUrl,color:B}:s5(X);if(X0&&j==="color")k.push(`background-color:${X0.color}`),C.push("backgroundColor");else if(X0)k.push(`background-color:${X0.color}`),k.push(`background-image:url(${X0.dataUrl})`),k.push("background-size:cover"),k.push("background-repeat:no-repeat"),C.push("backgroundColor","backgroundImage");else{let $0=cY(D||16,I||9,B);k.push(`background-image:url(${$0})`),k.push("background-size:cover"),k.push("background-repeat:no-repeat"),C.push("backgroundImage")}}else if(!y&&j&&j!=="empty"&&j!=="none")k.push(`background-image:url(${L0(j)})`),k.push("background-size:cover"),k.push("background-repeat:no-repeat"),C.push("backgroundImage");let b=Y?.fallback.url||R2(X,D,I,V,U),P=[];if(P.push(`src="${L0(b)}"`),P.push(`alt="${L0(Q)}"`),G)P.push(`width="${L0(G)}"`);if(z)P.push(`height="${L0(z)}"`);let u=R||(N||w?"eager":O?"lazy":"");if(u)P.push(`loading="${L0(u)}"`);if(N)P.push('fetchpriority="high"');if(P.push(`decoding="${L0(M)}"`),L)P.push(`class="${L0(L)}"`);if(k.length>0)P.push(`style="${L0(k.join(";"))}"`);if(E)P.push(`srcset="${L0(E)}"`);if(A)P.push(`sizes="${L0(A)}"`);let l=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(C.length>0){let X0=typeof $.static.onload==="string"?$.static.onload:"",$0=lY(C)+(X0?`;${X0}`:"");P.push(`onload="${L0($0)}"`),l.add("onload")}P.push(...u1($,l)),P.push(...m1($,l));let g=`<img ${P.join(" ")} />`,J0="";if(w){let $0=U==="webp"?"image/webp":U==="avif"?"image/avif":"";J0=`<link rel="preload" as="image" href="${L0(b)}"${$0?` type="${$0}"`:""}${E?` imagesrcset="${L0(E)}"`:""}${A?` imagesizes="${L0(A)}"`:""} />
|
|
3228
|
+
`}if(T){let X0=[];if(Y)for(let $0 of mY(Y))X0.push(`<source type="image/${$0.format}" srcset="${L0($0.srcset)}"${A?` sizes="${L0(A)}"`:""} />`);if(!Y&&(U==="avif"||U==="auto")){let $0=R2(X,D,I,V,"avif"),c=E?t5(X,r5,V,"avif"):`${$0}`;X0.push(`<source type="image/avif" srcset="${L0(c)}"${A?` sizes="${L0(A)}"`:""} />`)}if(!Y&&(U==="webp"||U==="auto")){let $0=R2(X,D,I,V,"webp"),c=E?t5(X,r5,V,"webp"):`${$0}`;X0.push(`<source type="image/webp" srcset="${L0(c)}"${A?` sizes="${L0(A)}"`:""} />`)}return`${J0}<picture>
|
|
3229
|
+
${X0.join(`
|
|
3230
|
+
`)}
|
|
3231
|
+
${g}
|
|
3232
|
+
</picture>`}return`${J0}${g}`}};var O4="/images/safe-image-default.svg";function N2($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function c1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}var pY=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${O4}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,$$={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,J){let X=c1($,"src")||"",Y=c1($,"alt")||"",Q=c1($,"fallback")||O4,G=c1($,"class")||c1($,"className")||"",z=c1($,"fallbackClassName")||"",K=[];if(K.push(`src="${N2(X)}"`),K.push(`alt="${N2(Y)}"`),G)K.push(`class="${N2(G)}"`);if(K.push(`data-fallback="${N2(Q)}"`),z)K.push(`data-fallback-class="${N2(z)}"`);K.push('onerror="window.__stxSafeImageHandler(this)"');let q=new Set(["src","alt","fallback","class","className","fallbackClassName"]);K.push(...u1($,q)),K.push(...m1($,q));let W=`<img ${K.join(" ")} />`,U=J.context;if(!U.__safeImageHandlerEmitted)return U.__safeImageHandlerEmitted=!0,`${pY}${W}`;return W}};function Z$($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function D2($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}function V9($,Z,J){let X=D2($,Z);if(X!==void 0){let Y=Number.parseInt(X,10);if(!Number.isNaN(Y))return Y}return J}var J$={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,J){let X=Z$(D2($,"color")||"#6366f1"),Y=Z$(D2($,"initialColor")||D2($,"initial-color")||""),Q=Z$(D2($,"height")||"3px"),G=V9($,"duration",2000),z=V9($,"throttle",200),K=V9($,"zIndex",999999)||V9($,"z-index",999999),q=Y?`linear-gradient(to right, ${Y}, ${X})`:X;return`
|
|
3233
|
+
<div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${Q};background:${q};z-index:${K};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
|
|
3234
|
+
<div style="position:absolute;top:0;left:0;right:0;bottom:0;background:linear-gradient(90deg,transparent 0%,rgba(255,255,255,0.4) 50%,transparent 100%);animation:stx-shimmer 1.5s infinite"></div>
|
|
3235
|
+
</div>
|
|
3236
|
+
<style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
|
|
3237
|
+
<script>
|
|
3238
|
+
(function(){var el=document.getElementById('stx-loading-indicator'),p=0,l=!1,i=null;function u(v){p=Math.min(Math.max(v,0),100);if(el){el.style.opacity=p>0?'1':'0';el.style.transform='scaleX('+(p/100)+')'}}window.stxLoading={start:function(){l=!0;p=0;u(10);if(i)clearInterval(i);i=setInterval(function(){if(!l)return;var r=90-p,inc=Math.max(0.5,r*0.1);if(p<90)u(p+inc)},${z})},finish:function(){l=!1;if(i){clearInterval(i);i=null}u(100);setTimeout(function(){if(el)el.style.opacity='0';setTimeout(function(){p=0;if(el)el.style.transform='scaleX(0)'},300)},200)},set:function(v){u(v)},clear:function(){l=!1;p=0;if(i){clearInterval(i);i=null}if(el){el.style.opacity='0';el.style.transform='scaleX(0)'}}};document.addEventListener('click',function(e){var a=e.target.closest&&e.target.closest('a');if(!a)return;var h=a.getAttribute('href');if(!h||h.startsWith('http')||h.startsWith('#')||h.startsWith('mailto:')||h.startsWith('tel:')||a.target==='_blank')return;window.stxLoading.start()});window.addEventListener('popstate',function(){window.stxLoading.start()});window.addEventListener('load',function(){window.stxLoading.finish()})})();
|
|
3239
|
+
</script>`}};function L4($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}function iY($,Z,J){let X=L4($,Z);if(X!==void 0){let Y=Number.parseInt(X,10);if(!Number.isNaN(Y))return Y}return J}var _4={"top-right":"top:1rem;right:1rem","top-left":"top:1rem;left:1rem","top-center":"top:1rem;left:50%;transform:translateX(-50%)","bottom-right":"bottom:1rem;right:1rem","bottom-left":"bottom:1rem;left:1rem","bottom-center":"bottom:1rem;left:50%;transform:translateX(-50%)"},X$={name:"StxToast",aliases:["stx-toast"],render($,Z,J){let X=I0(L4($,"position")||"top-right"),Y=iY($,"max",5),Q=_4[X]||_4["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${X}" data-stx-toast-max="${Y}" style="position:fixed;${Q};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
|
|
3240
|
+
<style>
|
|
3241
|
+
@keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
|
|
3242
|
+
@keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
|
|
3243
|
+
@keyframes stx-toast-in-left{from{opacity:0;transform:translateX(-100%)}to{opacity:1;transform:translateX(0)}}
|
|
3244
|
+
@keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
|
|
3245
|
+
@keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
|
|
3246
|
+
@keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
|
|
3247
|
+
</style>`}};function O9($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}var F4={sm:"max-width:24rem",md:"max-width:32rem",lg:"max-width:42rem",xl:"max-width:56rem",full:"max-width:calc(100vw - 2rem);max-height:calc(100vh - 2rem)"},Y$={name:"StxModal",aliases:["stx-modal"],render($,Z,J){let X=O9($,"id");if(!X)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let Y=I0(X),Q=O9($,"size")||"md",G=O9($,"closeOnBackdrop")!=="false",z=O9($,"closeOnEscape")!=="false",K=F4[Q]||F4.md;return`<div id="stx-modal-${Y}" class="stx-modal-backdrop" data-stx-modal="${Y}" data-close-backdrop="${G}" data-close-escape="${z}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
|
|
3248
|
+
<div class="stx-modal-panel" style="${K};width:100%;margin:1rem;border-radius:0.75rem;box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow:hidden;transform:scale(0.95) translateY(8px);transition:transform 0.2s ease,opacity 0.2s ease;opacity:0;background:var(--stx-modal-bg,#fff);color:var(--stx-modal-text,#1f2937)">
|
|
3249
|
+
<div style="padding:1.5rem">${Z}</div>
|
|
3250
|
+
</div>
|
|
3251
|
+
</div>
|
|
3252
|
+
<style>
|
|
3253
|
+
@media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
|
|
3254
|
+
.stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
|
|
3255
|
+
.stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
|
|
3256
|
+
</style>`}};function p1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}var w4={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},Q$={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,J){let X=p1($,"id");if(!X)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let Y=I0(X),Q=p1($,"side")||"right",G=p1($,"size")||"md",z=p1($,"closeOnBackdrop")!=="false",K=p1($,"closeOnEscape")!=="false",q=p1($,"overlay")!=="false",W=w4[G]||w4.md,U=Q==="left",H=U?"left:0":"right:0",j=U?"translateX(-100%)":"translateX(100%)",B=U?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${Y}" class="stx-drawer-backdrop" data-stx-drawer="${Y}" data-close-backdrop="${z}" data-close-escape="${K}" style="display:none;position:fixed;inset:0;z-index:99999;${q?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
|
|
3257
|
+
<div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${H};width:${W};max-width:100vw;transform:${j};transition:transform 0.3s cubic-bezier(0.4,0,0.2,1);background:var(--stx-drawer-bg,#fff);color:var(--stx-drawer-text,#1f2937);box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow-y:auto;pointer-events:auto">
|
|
3258
|
+
<div style="padding:1.5rem">${Z}</div>
|
|
3259
|
+
</div>
|
|
3260
|
+
</div>
|
|
3261
|
+
<style>
|
|
3262
|
+
@media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
|
|
3263
|
+
.stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
|
|
3264
|
+
.stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
|
|
3265
|
+
</style>`}};import{existsSync as nY,readFileSync as oY}from"fs";var N1=new Map,R4=new Set;function N4($){if(R4.has($))return;R4.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function D4($){let Z=process.cwd();for(let J of[`${Z}/node_modules/@iconify-json/${$}/icons.json`,`${Z}/pantry/@iconify-json/${$}/icons.json`,`${Z}/node_modules/@iconify/json/json/${$}.json`,`${Z}/pantry/@iconify/json/json/${$}.json`])if(nY(J))return J;for(let J of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return f.resolve(J)}catch{}return null}function sY($){if(N1.has($))return N1.get($);let Z=D4($);if(!Z)return N4($),null;try{let J=JSON.parse(oY(Z,"utf8"));return N1.set($,J.icons),J.icons}catch{return null}}async function rY($,Z=!1){if(N1.has($))return N1.get($);let J=D4($);if(!J){if(!Z)N4($);return null}try{let X=await Bun.file(J).json();return N1.set($,X.icons),X.icons}catch{return null}}function i1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);if($.static[Z]!==void 0)return String($.static[Z]);if($.clientReactive[Z]!==void 0)return $.clientReactive[Z];return}var G$={name:"Icon",aliases:["icon","stx-icon"],render($,Z,J){let X=i1($,"name")??i1($,"icon");if(!X)return"<!-- Icon: missing name/icon prop -->";let Y="lucide",Q=X;if(X.includes(":")){let F=X.split(":");Y=F[0],Q=F[1]}let G=I0(i1($,"size")||"24"),z=I0(i1($,"color")||"currentColor"),K=I0(i1($,"class")||""),q=I0(i1($,"style")||""),W=N1.get(Y)??sY(Y);if(!W)return`<!-- Icon: collection "${Y}" not loaded -->`;let U=W[Q];if(!U)return`<!-- Icon: "${Q}" not found in ${Y} -->`;let H=U.width||24,j=U.height||24,B=`0 0 ${H} ${j}`,V=U.body;if(z!=="currentColor")V=V.replace(/currentColor/g,z);let L=K?` class="${K}"`:"",_=q?` style="${q}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${B}" fill="none"${L}${_}>${V}</svg>`}};async function aY($="lucide",Z={}){await rY($,Z.speculative??!0)}function z$(){return`
|
|
3266
|
+
(function(){
|
|
3267
|
+
var tip=null,hideTimer=null,currentEl=null;
|
|
3268
|
+
|
|
3269
|
+
function createTip(){
|
|
3270
|
+
tip=document.createElement("div");
|
|
3271
|
+
tip.id="stx-tooltip";
|
|
3272
|
+
tip.style.cssText="position:absolute;background:#1f2937;color:#fff;font-size:12px;line-height:1.4;padding:6px 10px;border-radius:6px;max-width:250px;z-index:999999;pointer-events:none;opacity:0;transition:opacity .15s ease;white-space:pre-wrap;word-wrap:break-word;box-shadow:0 2px 8px rgba(0,0,0,.25)";
|
|
3273
|
+
var arrow=document.createElement("div");
|
|
3274
|
+
arrow.className="stx-tip-arrow";
|
|
3275
|
+
arrow.style.cssText="position:absolute;width:0;height:0;border:5px solid transparent";
|
|
3276
|
+
tip.appendChild(arrow);
|
|
3277
|
+
var text=document.createElement("span");
|
|
3278
|
+
text.className="stx-tip-text";
|
|
3279
|
+
tip.appendChild(text);
|
|
3280
|
+
document.body.appendChild(tip);
|
|
3281
|
+
}
|
|
3282
|
+
|
|
3283
|
+
function position(el){
|
|
3284
|
+
var pos=el.getAttribute("x-tooltip-position")||"top";
|
|
3285
|
+
var r=el.getBoundingClientRect();
|
|
3286
|
+
var sy=window.scrollY,sx=window.scrollX;
|
|
3287
|
+
tip.style.display="block";
|
|
3288
|
+
tip.style.opacity="0";
|
|
3289
|
+
// Force layout so we can measure
|
|
3290
|
+
var tw=tip.offsetWidth,th=tip.offsetHeight;
|
|
3291
|
+
var arrow=tip.querySelector(".stx-tip-arrow");
|
|
3292
|
+
var left,top;
|
|
3293
|
+
|
|
3294
|
+
if(pos==="top"){
|
|
3295
|
+
left=r.left+r.width/2-tw/2+sx;
|
|
3296
|
+
top=r.top-th-8+sy;
|
|
3297
|
+
if(top-sy<0){pos="bottom";}
|
|
3298
|
+
}
|
|
3299
|
+
if(pos==="bottom"){
|
|
3300
|
+
left=r.left+r.width/2-tw/2+sx;
|
|
3301
|
+
top=r.bottom+8+sy;
|
|
3302
|
+
arrow.style.cssText="position:absolute;width:0;height:0;border:5px solid transparent;border-bottom-color:#1f2937;top:-10px;left:50%;transform:translateX(-50%)";
|
|
3303
|
+
}
|
|
3304
|
+
if(pos==="left"){
|
|
3305
|
+
left=r.left-tw-8+sx;
|
|
3306
|
+
top=r.top+r.height/2-th/2+sy;
|
|
3307
|
+
if(left-sx<0){pos="right";}
|
|
3308
|
+
}
|
|
3309
|
+
if(pos==="right"){
|
|
3310
|
+
left=r.right+8+sx;
|
|
3311
|
+
top=r.top+r.height/2-th/2+sy;
|
|
3312
|
+
arrow.style.cssText="position:absolute;width:0;height:0;border:5px solid transparent;border-right-color:#1f2937;left:-10px;top:50%;transform:translateY(-50%)";
|
|
3313
|
+
}
|
|
3314
|
+
|
|
3315
|
+
// Set arrow for top/left after potential flips
|
|
3316
|
+
if(pos==="top"){
|
|
3317
|
+
arrow.style.cssText="position:absolute;width:0;height:0;border:5px solid transparent;border-top-color:#1f2937;bottom:-10px;left:50%;transform:translateX(-50%)";
|
|
3318
|
+
}
|
|
3319
|
+
if(pos==="left"){
|
|
3320
|
+
arrow.style.cssText="position:absolute;width:0;height:0;border:5px solid transparent;border-left-color:#1f2937;right:-10px;top:50%;transform:translateY(-50%)";
|
|
3321
|
+
}
|
|
3322
|
+
|
|
3323
|
+
// Clamp horizontal
|
|
3324
|
+
if(left<sx+4) left=sx+4;
|
|
3325
|
+
if(left+tw>sx+window.innerWidth-4) left=sx+window.innerWidth-tw-4;
|
|
3326
|
+
|
|
3327
|
+
tip.style.left=left+"px";
|
|
3328
|
+
tip.style.top=top+"px";
|
|
3329
|
+
tip.style.opacity="1";
|
|
3330
|
+
}
|
|
3331
|
+
|
|
3332
|
+
function showTip(el){
|
|
3333
|
+
if(hideTimer){clearTimeout(hideTimer);hideTimer=null;}
|
|
3334
|
+
if(!tip) createTip();
|
|
3335
|
+
var text=el.getAttribute("x-tooltip");
|
|
3336
|
+
if(!text) return;
|
|
3337
|
+
tip.querySelector(".stx-tip-text").textContent=text;
|
|
3338
|
+
currentEl=el;
|
|
3339
|
+
position(el);
|
|
3340
|
+
}
|
|
3341
|
+
|
|
3342
|
+
function hideTip(){
|
|
3343
|
+
if(!tip) return;
|
|
3344
|
+
tip.style.opacity="0";
|
|
3345
|
+
hideTimer=setTimeout(function(){
|
|
3346
|
+
if(tip) tip.style.display="none";
|
|
3347
|
+
currentEl=null;
|
|
3348
|
+
},150);
|
|
3349
|
+
}
|
|
3350
|
+
|
|
3351
|
+
document.addEventListener("mouseover",function(e){
|
|
3352
|
+
var el=e.target.closest("[x-tooltip]");
|
|
3353
|
+
if(el) showTip(el);
|
|
3354
|
+
});
|
|
3355
|
+
document.addEventListener("mouseout",function(e){
|
|
3356
|
+
var el=e.target.closest("[x-tooltip]");
|
|
3357
|
+
if(el&&el===currentEl) hideTip();
|
|
3358
|
+
});
|
|
3359
|
+
document.addEventListener("focusin",function(e){
|
|
3360
|
+
var el=e.target.closest("[x-tooltip]");
|
|
3361
|
+
if(el) showTip(el);
|
|
3362
|
+
});
|
|
3363
|
+
document.addEventListener("focusout",function(e){
|
|
3364
|
+
var el=e.target.closest("[x-tooltip]");
|
|
3365
|
+
if(el) hideTip();
|
|
3366
|
+
});
|
|
3367
|
+
})();
|
|
3368
|
+
`}function M4($,...Z){for(let J of Z){if($.serverDynamic[J]!==void 0)return String($.serverDynamic[J]);let X=$.static[J];if(typeof X==="string")return X}return}function A4($,Z){let J=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),X=$.match(J);if(!X)return{region:null,rest:$};return{region:X[2],rest:$.replace(X[0],"")}}var K$={name:"Suspense",aliases:["suspense"],render($,Z,J){let X=A4(Z,"fallback"),Y=X.rest,Q=A4(Y,"error"),G=Q.rest,z=X.region??M4($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',K=Q.region??M4($,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${z}</div><div data-stx-suspense-error hidden>${K}</div><div data-stx-suspense-content hidden>${G}</div></div>`}};function _9($,...Z){for(let J of Z){if($.serverDynamic[J]!==void 0)return String($.serverDynamic[J]);let X=$.static[J];if(typeof X==="string")return X}return}var q$={name:"TransitionGroup",aliases:["transition-group"],render($,Z,J){let X=(_9($,"name")||"v").replace(/["'<>]/g,""),Y=(_9($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",Q=_9($,"class"),G=_9($,"id"),z=[`data-stx-transition-group="${X}"`,Q?`class="${Q}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${Y} ${z}>${Z}</${Y}>`}};function I4($=h1){$.registerBuiltin(n5),$.registerBuiltin(e5),$.registerBuiltin($$),$.registerBuiltin(J$),$.registerBuiltin(X$),$.registerBuiltin(Y$),$.registerBuiltin(Q$),$.registerBuiltin(G$),$.registerBuiltin(K$),$.registerBuiltin(q$)}function L9($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var T4=new Map;function tY($){let Z=T4.get($.source);if(!Z)Z=new RegExp(`(${$.source})(?![\\w.:-])`,"y"),T4.set($.source,Z);return Z}var k4=new WeakMap;function E4($){let Z=k4.get($);if(!Z)Z=new Set([...$].map((X)=>X.toLowerCase())),k4.set($,Z);let J=Z;return(X)=>!/[a-z]/.test(X)&&J.has(X.toLowerCase())}function b4($,Z,J){let X=[],Y=0,Q=typeof J==="function"?J:J?(G)=>J.has(G.toLowerCase()):void 0;while(Y<$.length){let G=$.indexOf("<",Y);if(G===-1)break;let z=tY(Z);z.lastIndex=G+1;let K=z.exec($);if(!K){Y=G+1;continue}let q=K[1];if(Q&&Q(q)){let L=G+1+q.length;while(L<$.length&&$[L]!==">")L++;Y=L+1;continue}let W=G+1+q.length,U=null,H=W,j=-1,B=!1;while(W<$.length){let L=$[W];if(U){if(L==="\\"&&W+1<$.length){W+=2;continue}if(L===U)U=null;W++;continue}if(L==='"'||L==="'"){U=L,W++;continue}if(L==="/"&&W+1<$.length&&$[W+1]===">"){j=W+2,B=!0;break}if(L===">"){j=W+1;break}W++}if(j===-1){Y=G+1;continue}let V=$.slice(H,B?j-2:j-1).trim();if(B)X.push({fullMatch:$.slice(G,j),tagName:q,attributes:V,content:"",startIndex:G,endIndex:j,isSelfClosing:!0}),Y=j;else{let L=`<${q}`,_=`</${q}>`,F=1,O=j,w=-1;while(F>0&&O<$.length){let M=$.indexOf(L,O),T=$.indexOf(_,O);if(T===-1)break;if(M!==-1&&M<T){let D=$[M+L.length];if(D===" "||D===">"||D==="/"||D===`
|
|
3369
|
+
`||D==="\t")F++;O=M+L.length}else{if(F--,F===0){w=T;break}O=T+_.length}}if(w===-1){Y=j;continue}let N=$.slice(j,w),R=w+_.length;X.push({fullMatch:$.slice(G,R),tagName:q,attributes:V,content:N,startIndex:G,endIndex:R,isSelfClosing:!1}),Y=R}}return X}function y4($){return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�?39;/g,"'").replace(/'/gi,"'").replace(/&/g,"&")}function C4($,Z){try{let J=Buffer.from($,"base64").toString("utf8");return JSON.parse(J)}catch{}try{let J=$.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");return JSON.parse(J)}catch(J){if(Z?.debug)console.error("Error decoding __stx_ prop:",J);return $}}function W$($,Z){let J=0,X="",Y=Z;while(Y<$.length){let Q=$[Y];if(X){if(Q==="\\")Y++;else if(Q===X)X=""}else if(Q==='"'||Q==="'"||Q==="`")X=Q;else if(Q==="{")J++;else if(Q==="}"){if(J--,J===0)return $.slice(Z,Y+1)}Y++}return $.slice(Z)}function S4($){let Z=$.trim();if(!Z.startsWith("{")||!Z.endsWith("}"))return null;if(W$(Z,0).length!==Z.length)return null;return Z.slice(1,-1).trim()}var eY=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),$Q=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function U$($){let Z=[],J=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,X;while((X=J.exec($))!==null){let Y=X[2]||"";if(!/(?:^|\s)(?::for|x-for|v-for|@for)\s*=/.test(Y))continue;let Q=X.index,G=Q+X[0].length,z=X[1].toLowerCase();if(X[0].endsWith("/>")||$Q.has(z)){Z.push([Q,G]);continue}let K=z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),q=new RegExp(`<\\/?${K}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");q.lastIndex=G;let W=1,U=G,H;while((H=q.exec($))!==null)if(H[0].startsWith("</")){if(W--,W===0){U=H.index+H[0].length;break}}else if(!H[0].endsWith("/>"))W++;Z.push([Q,U])}return Z}function v4($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>v4(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function f4($,Z){if(!/:[\w-]+=/.test($))return $;let J=$,X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,Y=[],Q;while((Q=X.exec($))!==null)Y.push([Q.index,Q.index+Q[0].length]);Y.push(...U$($));function G(U){return Y.some(([H,j])=>U>=H&&U<j)}let z=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,K=[],q=new Map,W=256;while((Q=z.exec(J))!==null){if(G(Q.index))continue;let U=Q[0],H=Q[2];if(!H||!H.includes(":"))continue;let j=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,B,V=H,L=!1;while((B=j.exec(H))!==null){let _=B[1],F=B[2];if(P4(_))continue;if(F.includes("()")&&!F.includes(".get(")||F.includes("$store")||F.includes("$ref"))continue;try{let O=Object.keys(Z),w=Object.values(Z),N=F.match(/^([a-zA-Z_$][\w$]*)/);if(N&&!O.includes(N[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(N[1]))continue;let R=JSON.stringify([O,F]),M=q.get(R);if(!M){if(M=Function(...O,`return (${F})`),q.size>=W)q.clear();q.set(R,M)}let T=M(...w);if(_==="class"){let D=v4(T);if(D){let I=V.match(/\sclass="([^"]*)"/);if(I)V=V.replace(I[0],` class="${I[1]} ${D}"`);else V=V.replace(B[0],` class="${D}"`)}else V=V.replace(B[0],"");L=!0;continue}if(eY.has(_)){if(T)V=V.replace(B[0],` ${_}`);else V=V.replace(B[0],"");L=!0;continue}if(T===null||T===void 0||T===!1)V=V.replace(B[0],"");else{let D=String(T).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">");V=V.replace(B[0],` ${_}="${D}"`)}L=!0}catch{continue}}if(L){let _=U.endsWith("/>")?" /":"",O=`<${Q[1]}${V}${_}>`;K.push({start:Q.index,end:Q.index+U.length,replacement:O})}}if(K.length>0){let U=Array(K.length*2+1),H=0;for(let j=0;j<K.length;j++){let{start:B,end:V,replacement:L}=K[j];U[j*2]=J.slice(H,B),U[j*2+1]=L,H=V}U[K.length*2]=J.slice(H),J=U.join("")}return J}import x4 from"fs";import g4 from"path";var M2=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);function A2($){if($.includes("-")||$==="component")return!1;if(/^[A-Z]/.test($))return!/[a-z]/.test($)&&[...M2].some((Z)=>Z.toLowerCase()===$.toLowerCase());return M2.has($)||/[A-Z]/.test($)}var h4=!1;function ZQ($,Z,J,X=!1){let Y={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},Q=new Set(Array.isArray(Z.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),G=(W)=>{if(Q.size===0)return!1;let U=W0(W),H=U.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(H&&Q.has(H))return!0;for(let j of Q){let B=j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${B}\\s*\\(`).test(U))return!0}return!1},z=new Set(d4),K=(W)=>{if(!W.includes("-")||W.startsWith("@")||W.startsWith(":")||W.startsWith("x-")||W.startsWith("__"))return W;if(W.startsWith("aria-")||W.startsWith("data-"))return W;return W.replace(/-([a-z0-9])/g,(U,H)=>H.toUpperCase())},q=(W,U)=>{let H=K(W);if(Y.static[H]=U,H!==W)Y.staticNames[H]=W};for(let[W,U]of Object.entries($)){let H=W.startsWith("x-")&&!z.has(W)&&!W.startsWith("x-bind:")&&!W.startsWith("x-on:")?`:${W.slice(2)}`:W;if(H.startsWith("@")){Y.events[H]=U;continue}if(H.startsWith("__stx_")){let j=K(H.slice(6));Y.serverDynamic[j]=C4(U,J);continue}if(H.startsWith(":")){let j=K(H.slice(1)),B=U===w1?j:U;if(j==="if"||j==="for"||j==="show"){Y.clientReactive[j]=B;continue}if(X){Y.clientReactive[j]=B;continue}if(G(B)){Y.clientReactive[j]=B;continue}try{if(!H0(B)){if(J.debug)console.error(`Unsafe expression in :${j} binding: ${B}`);Y.clientReactive[j]=B;continue}let V=Object.keys(Z),_=q0(B,V)(...Object.values(Z));if(_===void 0){let F=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(w9(B).some((w)=>!F.has(w)&&!V.includes(w))){Y.clientReactive[j]=B;continue}}if(Y.serverDynamic[j]=_,j!==H.slice(1)&&Y.serverDynamicNames)Y.serverDynamicNames[j]=H.slice(1)}catch{Y.clientReactive[j]=B}continue}if(typeof U==="string"&&U.includes("{{")&&U.includes("}}")){let j=U.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(j)try{let B=j[1];if(H0(B)){let L=q0(B,Object.keys(Z))(...Object.values(Z));q(H,L!=null?String(L):"")}else{if(J.debug)console.error(`Unsafe expression in ${H}: ${B}`);q(H,U)}}catch(B){if(J.debug)console.error(`Error evaluating expression for ${H}:`,B);q(H,U)}else{let B=U,V=/\{\{\s*([\s\S]+?)\s*\}\}/g,L;while((L=V.exec(U))!==null)try{let _=L[1];if(!H0(_)){if(J.debug)console.error(`Unsafe expression in ${H}: ${_}`);continue}let O=q0(_,Object.keys(Z))(...Object.values(Z));B=B.replace(L[0],String(O??""))}catch(_){if(J.debug)console.error(`Error evaluating expression in ${H}:`,_)}q(H,B)}continue}q(H,U===w1?"true":y4(U))}return Y}var JQ=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function XQ($,Z,J){if(!$.includes("@"))return $;if(!JQ.some(([Y,Q])=>Y.test($)&&$.includes(Q)))return $;try{return a0($,Z,J)}catch{return $}}function YQ($){let Z={},J=0,X=$.length;while(J<X){while(J<X&&/\s/.test($[J]))J++;if(J>=X)break;let Y="";while(J<X&&!/[\s=]/.test($[J]))Y+=$[J],J++;if(!Y)break;while(J<X&&/\s/.test($[J]))J++;if(J<X&&$[J]==="="){J++;while(J<X&&/\s/.test($[J]))J++;let Q="";if(J<X&&($[J]==='"'||$[J]==="'")){let G=$[J];J++;while(J<X){let z=$[J];if(z==="\\"&&J+1<X){J++,Q+=$[J],J++;continue}if(z===G){J++;break}Q+=z,J++}}else if($[J]==="{"){Q=W$($,J),J+=Q.length;let G=S4(Q);if(G!==null){Z[`:${Y}`]=G;continue}}else while(J<X&&!/\s/.test($[J]))Q+=$[J],J++;Z[Y]=Q}else Z[Y]=w1}return Z}function u4($){return Object.entries($).map(([Z,J])=>J===w1?Z:`${Z}="${QQ(J)}"`).join(" ")}function QQ($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function GQ($){let Z=new Set,J=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,X;while((X=J.exec($))!==null){let Y=X[1];if(h1.isBuiltin(Y))Z.add(Y)}return[...Z].sort()}async function zQ($,Z,J,X,Y){if(!/import\s/.test($))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=g4.dirname(J),z=[],K=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let U of $.matchAll(K)){let[H,j,B]=U,V=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,L=B,_,F=[];while((_=V.exec(B))!==null){let[O,w,N,R]=_,M=null,T=null;if(R.startsWith(".")||R.startsWith("/")){let E=g4.resolve(G,R);if(E.endsWith(".stx"))T=E;else{let A=`${E}.stx`;try{if(x4.statSync(A).isFile())T=A}catch{try{if(x4.statSync(E).isDirectory())M=E}catch{}}}}else M=H9(R,G);if(!M&&!T)continue;let D=!1,I=(E,A)=>{Q.set(E,A),Q.set(E.toLowerCase(),A);let k=E.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(k,A),Y.add(A)};if(N&&T)I(N,T),D=!0;else if(w){let E=w.slice(1,-1).split(",").map((k)=>k.trim()).filter(Boolean).map((k)=>{let C=k.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(C)return{source:C[1],local:C[2]};return{source:k,local:k}}),A=M?U9(M):null;for(let{source:k,local:C}of E){let y=null;if(T)y=T;else if(A)y=A.get(k)??A.get(k.toLowerCase())??A.get(k.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(y)I(C,y),D=!0}}if(D)F.push({start:_.index,end:_.index+O.length})}if(F.length===0)continue;for(let O=F.length-1;O>=0;O--)L=L.slice(0,F[O].start)+L.slice(F[O].end);z.push({start:U.index,end:U.index+H.length,value:`<script${j}>${L}</script>`})}if(z.length===0)return $;let q=[],W=0;for(let U of z)q.push($.slice(W,U.start),U.value),W=U.end;return q.push($.slice(W)),q.join("")}async function KQ($,Z,J,X,Y){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,z=/@import\s*\(\s*([^)]+)\s*\)/g,K;while((K=z.exec(Q))!==null){let[q,W]=K,U=W.split(",").map((H)=>H.trim().replace(/^['"]|['"]$/g,"")).filter((H)=>H.length>0);for(let H of U){let j=H.split("/"),V=j[j.length-1].replace(/\.stx$/,""),L=V.includes("-")?V.split("-").map((O)=>O.charAt(0).toUpperCase()+O.slice(1)).join(""):V.charAt(0).toUpperCase()+V.slice(1),_=null,F=j9(H,J,X);for(let O of F)try{if(await Bun.file(O).exists()){_=O;break}}catch{}if(_){G.set(L,_),G.set(V,_),G.set(V.toLowerCase(),_);let O=L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(O,_),Y.add(_),X.debug)console.log(`Imported component: ${L} -> ${_}`)}else if(X.debug)console.warn(`Could not resolve imported component: ${H}`)}Q=Q.replace(q,""),z.lastIndex=0}return Q}async function qQ($,Z,J,X,Y){let Q=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let z=Z.__processedComponents,K=/@component\s*\(/g,q;while((q=K.exec(Q))!==null){let W=q.index,U=W+q[0].length-1,H=1,j=U+1;while(j<Q.length&&H>0){if(Q[j]==="(")H++;else if(Q[j]===")"){if(H--,H===0)break}j++}if(H!==0)break;let B=Q.substring(U+1,j),V=j+1,L=B.match(/^\s*['"]([^'"]+)['"]/);if(!L){K.lastIndex=0;continue}let _=L[1],F,O=B.slice(L[0].length),w=O.match(/^\s*,\s*/);if(w)F=O.slice(w[0].length).trim();let N={};if(F)try{N=d0(F,Z)}catch(E){let A=E instanceof Error?E.message:String(E);Q=Q.replace(Q.substring(W,V),`[Error parsing component props: ${A}]`);continue}let R="",M=V,D=Q.substring(V).match(/^([\s\S]*?)@endcomponent/);if(D)R=D[1].trim(),M=V+D[0].length;let I=await D1(_,N,R,G,Z,J,X,z,Y);Q=Q.substring(0,W)+I+Q.substring(M),K.lastIndex=0}return Q}async function WQ($,Z,J,X,Y){if(!$)return $;let Q=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let z=Z.__processedComponents,K=c0(Q);Q=K.output;let q=U$(Q);return Q=await j(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await j(Q,/[A-Z][a-zA-Z0-9]*/,!0,E4(M2)),Q=await j(Q,/[a-z][a-z0-9]*/,!1,M2),Q=K.restore(Q),Q;async function j(B,V,L,_){if(!B)return B;let F=B,O=b4(F,V,_),w=new Map;for(let M=O.length-1;M>=0;M--){let T=O[M],D=L?L9(T.tagName):T.tagName,I=YQ(XQ(T.attributes,Z,J)),E=q.some(([u,l])=>T.startIndex>=u&&T.startIndex<l),A=ZQ(I,Z,X,E),k=h1.getBuiltin(T.tagName),C=k?await F9(D,G,Z,J,X):!1;if(k&&!C){let u={context:Z,filePath:J,options:X,dependencies:Y},l=k.render(A,T.content,u);if(Object.keys(A.events).length>0){let g=u4(A.events);l=l.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${g}`)}if(Object.keys(A.clientReactive).length>0)l=m4(l,A.clientReactive);w.set(M,l);continue}if(!L&&T.tagName.includes("-")&&!await F9(D,G,Z,J,X))continue;let y={};for(let[u,l]of Object.entries(A.static))y[u]=l;for(let[u,l]of Object.entries(A.serverDynamic))y[u]=l;let P=await D1(D,y,K.restore(T.content),G,Z,J,X,z,Y);if(Object.keys(A.events).length>0){let u=l4(P);if(u){let l=u4(A.events),g=Object.keys(A.events).map((J0)=>J0.replace(/^@/,"").split(".")[0]).join(" ");P=P.substring(0,u.insertPos)+` data-stx-parent-events="${g}" ${l}`+P.substring(u.insertPos)}}if(Object.keys(A.clientReactive).length>0)P=m4(P,A.clientReactive);w.set(M,P)}if(w.size===0)return F;let N="",R=0;for(let M=0;M<O.length;M++){let T=w.get(M);if(T===void 0)continue;N+=F.slice(R,O[M].startIndex),N+=T,R=O[M].endIndex}return N+=F.slice(R),N}}function m4($,Z){let J=new Set(["if","for"]),X=new Set(["show"]),Y=Object.entries(Z).filter(([W])=>!J.has(W)),Q=Y.filter(([W])=>!X.has(W)).map(([W])=>L9(W)).join(" "),G=$,z=Y.length>0?l4(G):null;if(z){let W=Y.map(([H,j])=>`:${L9(H)}="${j.replace(/"/g,""")}"`).join(" "),U=Q?` data-stx-parent-bindings="${Q}"`:"";G=G.substring(0,z.insertPos)+`${U} ${W}`+G.substring(z.insertPos)}let K=Z.if;if(K)G=`<template :if="${K.replace(/"/g,""")}">${G}</template>`;let q=Z.for;if(q)G=`<template :for="${q.replace(/"/g,""")}">${G}</template>`;return G}function l4($){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec($);if(Z)return{insertPos:Z.index+1+Z[1].length};let J=0;while(J<$.length){let X=$.slice(J),Y=X.match(/^\s+/);if(Y){J+=Y[0].length;continue}if(X.startsWith("<!--")){let z=$.indexOf("-->",J+4);if(z===-1)return null;J=z+3;continue}let Q=X.match(/^<(script|style)\b[^>]*>/i);if(Q){let z=`</${Q[1].toLowerCase()}>`,K=$.toLowerCase().indexOf(z,J+Q[0].length);if(K===-1)return null;J=K+z.length;continue}let G=X.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:J+1+G[1].length}}return null}async function H$($,Z,J,X,Y){if(!h4)I4(h1),h4=!0;let Q=await zQ($,Z,J,X,Y);Q=await KQ(Q,Z,J,X,Y),Q=await qQ(Q,Z,J,X,Y);let G=[];for(let z=0;z<3;z++){let K=G.length,q=j1(Q,R9,(U,H)=>`\x00STX_COMPONENT_COMMENT_${K+H}\x00`,`STX_COMPONENT_COMMENT:${K}`);G.push(...q.tokens);let W=Q;if(Q=await WQ(q.output,Z,J,X,Y),Q===W)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(z,K)=>G[Number(K)]??"");if(X.debug){let z=GQ(Q);if(z.length>0)console.warn(`[stx] ${J}: unresolved component tag(s) after render passes: ${z.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}function j$($,Z){let J=0;for(let X=Z;X<$.length;X++){let Y=$[X];if(Y==="("||Y==="["||Y==="{")J++;else if(Y===")"||Y==="]"||Y==="}")J--;else if(Y===","&&J===0)return X}return-1}function HQ($,Z,J){let X=$,Y=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),Q=Y.exec(X);while(Q){let G=Q.index,z=G+Q[0].length-1,K=1,q=z+1;while(q<X.length&&K>0){if(X[q]==="(")K++;else if(X[q]===")")K--;q++}if(K!==0)break;let W=X.substring(z+1,q-1),U=`${J}(${W})`;X=X.substring(0,G)+U+X.substring(q),Y.lastIndex=G+U.length,Q=Y.exec(X)}return X}function jQ($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function n4($){let Z=$,J=[],X=new Set,Y=0,Q=0,G=Z.length,z=(U)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===U){Q++;return}Q++}},K=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let U=1;while(Q<G&&U>0)if(Z[Q]==="{")U++,Q++;else if(Z[Q]==="}")U--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')z(Z[Q]);else if(Z[Q]==="`")K();else Q++;continue}Q++}},q=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
|
|
3370
|
+
`)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},W=()=>{if(Y!==0)return;let U=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let B=U[2];if(!X.has(B))J.push(B),X.add(B);return}let H=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let B=H[1];if(!X.has(B))J.push(B),X.add(B);return}let j=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!X.has(B))J.push(B),X.add(B)}};while(Q<G){if(q())continue;if(Z[Q]==="'"||Z[Q]==='"'){z(Z[Q]);continue}if(Z[Q]==="`"){K();continue}if(Z[Q]==="{"){Y++,Q++;continue}if(Z[Q]==="}"){Y--,Q++;continue}if(Y===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))W();Q++}return J.join(", ")}function BQ($,Z=""){let J=n4($).split(",").map((X)=>X.trim()).filter(Boolean);return`
|
|
3371
|
+
(function() {
|
|
3372
|
+
${n1("var",J)}
|
|
3373
|
+
var __destroyHooks = [];
|
|
3374
|
+
var __origOnDestroy = onDestroy;
|
|
3375
|
+
onDestroy = function(fn) { __origOnDestroy(fn); __destroyHooks.push(fn); };
|
|
3376
|
+
|
|
3377
|
+
${$}
|
|
3378
|
+
${Z}})();
|
|
3379
|
+
`}function VQ($,Z){let Y=n4($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeRegistration[${JSON.stringify(Q)}] = ${Q}; } catch (e) { /* not actually top-level */ }`).join(`
|
|
3380
|
+
`);return`
|
|
3381
|
+
// Register scope variables for STX runtime
|
|
3382
|
+
if (!window.stx._scopes) window.stx._scopes = {};
|
|
3383
|
+
var __scopeRegistration = window.stx._scopes['${Z}'] || { __destroyCallbacks: __destroyHooks };
|
|
3384
|
+
${Y}
|
|
3385
|
+
// #1767: when the bundler renamed a component const that collided with an
|
|
3386
|
+
// inlined import (foo -> foo2), rebind the ORIGINAL template name to the
|
|
3387
|
+
// renamed declaration so it resolves to the component's value, not the
|
|
3388
|
+
// shadowing import. __stxScopeRenames is emitted by bundleClientScript.
|
|
3389
|
+
try { if (typeof __stxScopeRenames !== 'undefined' && __stxScopeRenames) { for (var __stxRK in __stxScopeRenames) __scopeRegistration[__stxRK] = __stxScopeRenames[__stxRK]; } } catch (e) { /* no renames */ }
|
|
3390
|
+
window.stx._scopes['${Z}'] = __scopeRegistration;
|
|
3391
|
+
`}function OQ($,Z){return $.replace(/<script data-stx-scoped data-stx-run="always" data-stx-owner="([^"]*)"/g,(J,X)=>X===Z?J:'<script data-stx-scoped data-stx-run="always"')}function c4($,Z){let J=VQ($,Z);return _Q(BQ($,J),Z)}function _Q($,Z){let J=`
|
|
3392
|
+
(function() {
|
|
3393
|
+
var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${Z}"]') : null;
|
|
3394
|
+
var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
|
|
3395
|
+
if (__stxScopeEl && typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxScopeEl;
|
|
3396
|
+
if (__stxScopeEl && typeof window !== 'undefined' && window.stx) {
|
|
3397
|
+
if (!window.stx._scopes) window.stx._scopes = {};
|
|
3398
|
+
window.stx._scopes['${Z}'] = {};
|
|
3399
|
+
}
|
|
3400
|
+
try {`,X=`
|
|
3401
|
+
} finally {
|
|
3402
|
+
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
3403
|
+
}
|
|
3404
|
+
})();`;return J+$+`
|
|
3405
|
+
} finally {
|
|
3406
|
+
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
3407
|
+
}
|
|
3408
|
+
})();`}function LQ($,Z){if(p0($)){let Y=p0($).tag.match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1],stamped:!0,root:"body"};return{html:S1($,(Q,G)=>`<body${G} data-stx-scope="${Z}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let J=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(J){let X=J[2]+J[3],Y=J[2].slice(1),Q=X.match(/data-stx-scope="([^"]*)"/);if(Q)return{html:$,mergedIntoExisting:Q[1],stamped:!0,root:Y};let G=J[1],z=J[2],K=J[3];return{html:`${G}${z} data-stx-scope="${Z}"${K}${$.slice(J[0].length)}`,mergedIntoExisting:null,stamped:!0,root:Y}}return{html:$,mergedIntoExisting:null,stamped:!1,root:null}}var p4=0,B$=new Set;function zB(){B$.clear()}function i4($){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test($)}var KB=new o1(500),o4=new Set;function qB(){o4.clear()}function FQ($){if($.__onceStore instanceof Set)return $.__onceStore;return o4}async function V$($,Z,J,X,Y,Q=new Set){let G=X.partialsDir||z0.join(z0.dirname(J),"partials");if(G&&!z0.isAbsolute(G))G=z0.resolve(process.cwd(),G);let z=HQ($,"@partial","@include"),K=FQ(Z);z=z.replace(/@once([\s\S]*?)@endonce/g,(V,L,_)=>{let F=L.trim(),O=`${J}:${F}`;if(K.has(O))return"";return K.add(O),L});{let V=/@includeIf\s*\(/g,L;while((L=V.exec(z))!==null){let _=L.index,F=_+L[0].length-1,O=1,w=F+1;while(w<z.length&&O>0){if(z[w]==="(")O++;else if(z[w]===")")O--;w++}if(O!==0)break;let N=z.substring(F+1,w-1),R=N.match(/^\s*['"]([^'"]+)['"]/);if(!R){V.lastIndex=w;continue}let M=R[1],T=q(M,G,J),D="";if(T&&await Bun.file(T).exists())Y.add(T),D=`@include(${N})`;z=z.substring(0,_)+D+z.substring(w),V.lastIndex=0}}for(let[V,L]of[["@includeWhen",!1],["@includeUnless",!0]]){let _=new RegExp(`${V.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=_.exec(z))!==null){let O=F.index,w=O+F[0].length-1,N=1,R=w+1;while(R<z.length&&N>0){if(z[R]==="(")N++;else if(z[R]===")")N--;R++}if(N!==0)break;let M=z.substring(w+1,R-1),T=j$(M,0);if(T===-1){_.lastIndex=R;continue}let D=M.substring(0,T).trim(),I=M.substring(T+1).trim(),E=I.match(/^\s*['"]([^'"]+)['"]/);if(!E){_.lastIndex=R;continue}let A=E[1],k=I.substring(E[0].length),C,y=j$(k,0);if(y!==-1)C=k.substring(y+1).trim();try{let b=`Boolean(${D})`,P;if(H0(b)){let g=q0(b,Object.keys(Z));P=Boolean(g(...Object.values(Z)))}else P=Boolean(Q0(b,Z));let u=L?!P:P,l="";if(u){let g=q(A,G,J);if(g&&await Bun.file(g).exists())Y.add(g);l=`@include('${A}'${C?`, ${C}`:""})`}z=z.substring(0,O)+l+z.substring(R),_.lastIndex=0}catch(b){let P=b instanceof Error?b.message:String(b),u=_0("Include",`Error evaluating ${V} condition: ${P}`,J,$,O);z=z.substring(0,O)+u+z.substring(R),_.lastIndex=0}}}{let V=/@each\s*\(/g,L;while((L=V.exec(z))!==null){let _=L.index,F=_+L[0].length-1,O=1,w=F+1;while(w<z.length&&O>0){if(z[w]==="(")O++;else if(z[w]===")"){if(O--,O===0)break}w++}if(O!==0)break;let N=z.substring(F+1,w),R=z.substring(_,w+1),M=N.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!M){V.lastIndex=0,z=z.replace(R,"");continue}let[,T,D,I,E]=M;try{let A,k=D.trim();if(H0(k))A=q0(k,Object.keys(Z))(...Object.values(Z));else A=Q0(k,Z);let C="";if(Array.isArray(A)&&A.length>0)for(let y of A){let b={...Z,[I]:y},P=await H(T,b,$,_);C+=P}else if(E)C=await H(E,{},$,_);z=z.substring(0,_)+C+z.substring(w+1),V.lastIndex=0}catch(A){let k=A instanceof Error?A.message:String(A);z=z.substring(0,_)+_0("Each",`Error in @each: ${k}`,J,$,_)+z.substring(w+1),V.lastIndex=0}}}{let V=/@includeFirst\s*\(/g,L;while((L=V.exec(z))!==null){let _=L.index,F=_+L[0].length-1,O=1,w=F+1;while(w<z.length&&O>0){if(z[w]==="(")O++;else if(z[w]===")"){if(O--,O===0)break}w++}if(O!==0)break;let N=z.substring(F+1,w),R=z.substring(_,w+1),M=N.match(/^\s*(\[[^\]]+\])/);if(!M){V.lastIndex=0,z=z.replace(R,"");continue}let T=M[1],D=N.slice(M[0].length),I,E=D.match(/^\s*,\s*\{/);if(E){D=D.slice(E[0].length-1);let C=1,y=1;while(y<D.length&&C>0){if(D[y]==="{")C++;else if(D[y]==="}"){if(C--,C===0)break}y++}I=D.substring(0,y+1),D=D.slice(y+1)}let A,k=D.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(k)A=k[1];try{let C=JSON.parse(T.replace(/'/g,'"')),y={};if(I)try{y=d0(I,Z)}catch(P){let u=P instanceof Error?P.message:String(P);if(X.debug){let l=_0("Include",`Error parsing includeFirst variables: ${u}`,J,$,_,R);z=z.replace(R,()=>l)}else z=z.replace(R,()=>A||"");continue}let b=!1;for(let P of C){let u=q(P,G,J);if(!u)continue;if(await e(u)){let l=await H(P,y,$,_);z=z.replace(R,()=>l),b=!0;break}}if(!b)if(A!==void 0)z=z.replace(R,()=>A);else if(X.debug){let P=_0("Include",`None of the includeFirst paths exist: ${T}`,J,$,_,R);z=z.replace(R,()=>P)}else z=z.replace(R,"")}catch(C){let y=C instanceof Error?C.message:String(C),b=_0("Include",`Error processing @includeFirst: ${y}`,J,$,_,R);z=z.replace(R,()=>b)}V.lastIndex=0}}function q(V,L,_){try{let F=V;if(!V.endsWith(".stx"))F=`${V}.stx`;let O=z0.resolve(L),w=z0.resolve(z0.dirname(_)),N;if(!F.startsWith("./")&&!F.startsWith("../")){for(let E of X._layerPartialDirs??[]){let A=z0.resolve(E,F);if(A.startsWith(`${z0.resolve(E)}${z0.sep}`)&&UQ(A))return A}N=z0.resolve(L,F)}else N=z0.resolve(w,F);let R=z0.normalize(N),M=R.startsWith(O+z0.sep)||R===O,T=R.startsWith(w+z0.sep)||R===w,D=!1,I=z0.dirname(w);if(R.startsWith(I+z0.sep)){if(!z0.relative(I,R).split(z0.sep).some((C)=>C.startsWith(".")&&C!=="."&&C!==".."))D=!0}if(!M&&!T&&!D)return console.error(`Security: Path traversal attempt blocked for include path: ${V}`),console.error(` Resolved to: ${R}`),console.error(` Allowed dirs: ${O}, ${w}`),null;return R}catch(F){return console.error(`Error resolving path ${V}: ${F}`),null}}let W=z0.resolve(J);Q.add(W);function U(V,L,_,F){return X.onIncludeError?.({includePath:V,templatePath:J,message:L,partialsDir:G}),_0("Include",L,J,_,F)}async function H(V,L={},_,F){let O=q(V,G,J);if(!O)return U(V,`Could not resolve path for include: ${V}`,_,F);let w=z0.resolve(O);if(Q.has(w)){let N=[...Q,w].map((R)=>z0.basename(R)).join(" -> ");return U(V,`Circular include detected: ${N}`,_,F)}try{Y.add(O);let N;if(!N)try{N=await Bun.file(O).text()}catch(c){let K0=c instanceof Error?c.message:String(c);return U(V,`Error loading include file ${V}: ${K0}`,_,F)}if(N)N=N.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(N&&N.includes("@stream")){let{processStreamDirectives:c}=await import("./chunk-fha0nyet.js");N=c(N,Z)}if(N&&(X.debug||!N9()&&!D9()))try{let{warnUnbalancedTags:c}=await import("./chunk-vhzc08aa.js");c(N,O)}catch{}let R=N;try{let{processESImports:c}=await import("./chunk-dvafkj8w.js");await c(N,Z,O,X,Y)}catch(c){if(X.debug)console.warn(`[stx] partial ES import extraction skipped for ${O}:`,c instanceof Error?c.message:c)}let M=q9(R);if(M)R=M.content.trim();let D=N.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),I="";if(D)I=`<style${D[1]}>${D[2]}</style>`;let E=[];R=R.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(c,K0,r)=>{if(!i4(K0))return"";return E.push({attrs:K0,body:r}),`__STX_DATA_BLOCK_${E.length-1}__`}),R=R.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let A={...Z};A.__stx_signals_gate=J1(N,O);for(let[c,K0]of Object.entries(L))A[c]=K0;let k=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,C=[...N.matchAll(k)],y="",b=null,P=!1;for(let c of C){let K0=c[1]||"",r=c[2]||"";if(i4(K0))continue;let V0=K0.includes("server"),$1=M1(K0);if(!V0&&r.trim()){let{interpolateScriptExpressions:m}=await import("./chunk-4np12rj1.js");r=m(r,A)}let T0="";try{let{extractAndStripCssImports:m,renderVendorStyleTags:i}=await import("./chunk-7ngnyy5k.js"),j0=m(r,{filePath:O,projectRoot:process.cwd()});r=j0.code,T0=i(j0.styles)}catch(m){if(X.debug)console.warn(`[stx] vendor-css extractor skipped for ${O}:`,m instanceof Error?m.message:m)}if($1&&r.trim())r=A1(r);if(!V0){try{let{injectBrowserCoreAutoImports:i}=await import("./chunk-7ngnyy5k.js");r=i(r).code;let{hasUserImports:j0,bundleClientScript:a}=await import("./chunk-f08ttkqr.js");if(j0(r))r=await a(r,O,{projectRoot:process.cwd()})}catch(i){if(X.debug)console.warn(`[stx] bundler skipped for ${O}:`,i instanceof Error?i.message:i)}let{stripStxRuntimeImports:m}=await import("./chunk-kdwerx8e.js");r=m(r)}let p=jQ(r);if(p&&!V0){P=!0,b=`stx_scope_${z0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++p4}`;let m=t0(r),i=c4(m,b);y+=`${T0}<script data-stx-scoped data-stx-run="always" data-stx-owner="${b}">${i}</script>
|
|
3409
|
+
`;continue}if(V0)try{let{extractVariables:m}=await import("./chunk-4pcjt99d.js");await m(r,A,O)}catch(m){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${O}:`,m)}if(!V0&&!p){let m=K0.replace(/\bclient\b/i,"").trim();b=`stx_scope_${z0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++p4}`;let i=t0(r),j0=c4(i,b);y+=`${T0}<script data-stx-scoped data-stx-run="always" data-stx-owner="${b}"${m?` ${m}`:""}>${j0}</script>
|
|
3410
|
+
`}}if(E.length>0){let{interpolateScriptExpressions:c}=await import("./chunk-4np12rj1.js");R=R.replace(/__STX_DATA_BLOCK_(\d+)__/g,(K0,r)=>{let V0=E[Number(r)];return`<script${V0.attrs}>${c(V0.body,A)}</script>`})}if(b){let c=LQ(R,b);if(R=c.html,c.mergedIntoExisting){let r=b,V0=c.mergedIntoExisting;y=y.split(`'${r}'`).join(`'${V0}'`).split(`"${r}"`).join(`"${V0}"`),b=V0}else if(!c.stamped&&P&&!B$.has(O))B$.add(O),console.warn(`[stx] ${z0.relative(process.cwd(),O)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`);let K0=c.stamped&&c.root!==null&&A2(c.root);y=OQ(y,K0?b:null)}if(R.includes("@include")||R.includes("@partial"))R=await V$(R,A,O,X,Y,Q);let{processLoops:u,reportDeferredLoopWarnings:l}=await import("./chunk-41dfsdy9.js"),g=u(R,A,O,void 0,!0);g=a0(g,A,O),g=l(g);let{processMetaDirectives:J0,processSeoDirective:X0,processStructuredData:$0}=await import("./chunk-y8vj3rtt.js");if(g=J0(g,A,O,X),g=$0(g,A,O),g=X0(g,A,O,X),g=B1(g,A,O),I)g+=`
|
|
3411
|
+
`+I;if(y)g+=`
|
|
3412
|
+
`+y;return g}catch(N){let R=N instanceof Error?N.message:String(N);return U(V,`Error processing include ${V}: ${R}`,_,F)}}let j=/@include\s*\(/g,B;while((B=j.exec(z))!==null){let V=B.index,L=V+B[0].length-1,_=1,F=L+1;while(F<z.length&&_>0){if(z[F]==="(")_++;else if(z[F]===")")_--;F++}if(_!==0)break;let O=z.substring(V,F),w=z.substring(L+1,F-1),N=w.match(/^\s*['"]([^'"]+)['"]/);if(!N){j.lastIndex=F;continue}let R=N[1],M,T=w.substring(N[0].length),D=j$(T,0);if(D!==-1)M=T.substring(D+1).trim();let I={};if(M)try{I=d0(M,Z)}catch(A){let k=A instanceof Error?A.message:String(A);z=z.replace(O,_0("Include",`Error parsing include variables for ${R}: ${k}`,J,$,V)),j.lastIndex=0;continue}let E=await H(R,I,$,V);z=z.substring(0,V)+E+z.substring(F),j.lastIndex=0}return z}function O$($,Z){let J=$;function X(Y,Q,G,z){let K=Y,q=!0;while(q){q=!1;let W=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),U=K.match(W);if(!U||U.index===void 0)break;let H=U.index,j=U[1],B=H+U[0].length,V=new RegExp(`@${Q}\\(`),L=new RegExp(`@${G}(?![a-z])`),_=1,F=B,O=-1;while(_>0&&F<K.length){let N=K.slice(F),R=N.match(V),M=N.match(L),T=R?F+R.index:1/0,D=M?F+M.index:1/0;if(T<D)_++,F=T+(R[0].length||1);else if(D<1/0){if(_--,_===0){O=D;break}F=D+G.length+1}else break}if(O===-1)break;let w=K.slice(B,O);if(!Z[j])Z[j]=[];if(z)Z[j].unshift(w);else Z[j].push(w);K=K.substring(0,H)+K.substring(O+`@${G}`.length),q=!0}return K}return J=X(J,"push","endpush",!1),J=X(J,"prepend","endprepend",!0),J}function _$($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(J,X)=>{if(!Z[X]||Z[X].length===0)return"";return Z[X].join(`
|
|
3413
|
+
`)})}import*as L$ from"path";async function s4($,Z,J=""){if(L$.basename(J)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return a4($,Z,J,"@js","@endjs")}async function r4($,Z,J=""){if(L$.basename(J)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((Q)=>({...Q,displayName:`User ${Q.id}: ${Q.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return a4($,Z,J,"@ts","@endts")}async function a4($,Z,J,X,Y){let Q=$,G=x1(`${X}([\\s\\S]*?)${Y}`,"g"),z=[],K;while((K=G.exec($))!==null)z.push({fullMatch:K[0],content:K[1]||"",index:K.index});for(let{fullMatch:q,content:W,index:U}of z)try{let H={...Z,global:Z},j=Object.keys(H),B=Object.values(H),V=W.trim();if(X==="@ts")V=V.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let _=(V.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((R)=>R.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),F=_.length>0?`return { ${_.join(", ")} };`:"return {};",O=`
|
|
3414
|
+
${V}
|
|
3415
|
+
${F}
|
|
3416
|
+
`,N=Function(...j,O)(...B);if(N&&typeof N==="object")Object.assign(Z,N);Q=Q.replace(q,"")}catch(H){console.error(`Error executing ${X} code block in ${J}:`,H);let j=H instanceof Error?H.message:String(H),B=_0(`${X} Directive`,`Error executing code: ${j}`,J,$,U,q);console.error(B),Q=Q.replace(q,"")}return Q}var wQ=1000,RQ=!1;function NQ($,Z){let J=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,X="",Y=0,Q;while((Q=J.exec($))!==null){let G=Q.index+Q[0].length,z=Q.index+Q[0].indexOf("("),K=N0($,"(",")",z);if(K===-1)continue;let q=$.slice(G,K).trim();if(!q)continue;if(!Object.keys(Z).some((H)=>new RegExp(`(?:^|[^\\w$.])${H.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(q)))continue;let U;try{let H=d0(q,Z);if(!H||typeof H!=="object")continue;U=JSON.stringify(H)}catch{continue}X+=$.slice(Y,G)+U,Y=K,J.lastIndex=K}return Y===0?$:X+$.slice(Y)}function DQ($,Z){let J=/@component\s*\(/g,X=$,Y,Q=[];while((Y=J.exec(X))!==null){let G=Y.index,z=G+Y[0].length-1,K=1,q=z+1;while(q<X.length&&K>0){if(X[q]==="(")K++;else if(X[q]===")"){if(K--,K===0)break}q++}if(K!==0)continue;let W=X.substring(z+1,q),U=q+1,H=W.match(/^\s*['"]([^'"]+)['"]/);if(!H)continue;let j=H[1],B=W.slice(H[0].length),V=B.match(/^\s*,\s*/);if(!V)continue;let L=B.slice(V[0].length).trim();if(!L)continue;try{let _=d0(L,Z),F=JSON.stringify(_),O=`@component('${j}', ${F})`;Q.push({start:G,end:U,replacement:O})}catch{continue}}for(let G=Q.length-1;G>=0;G--){let{start:z,end:K,replacement:q}=Q[G];X=X.substring(0,z)+q+X.substring(K)}return X}function A9($,Z,J){let X=$,Y=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),Q;while((Q=Y.exec(X))!==null){let G=Q.index,z=G+Q[0].length-1,K=1,q=z+1,W=null,U=!1;while(q<X.length&&K>0){let B=X[q];if(U){U=!1,q++;continue}if(B==="\\"&&W){U=!0,q++;continue}if(W){if(B===W)W=null;q++;continue}if(B==='"'||B==="'"||B==="`"){W=B,q++;continue}if(B==="(")K++;else if(B===")"){if(K--,K===0)break}q++}if(K!==0)break;let H=X.substring(z+1,q),j=J(H);X=X.substring(0,G)+j+X.substring(q+1)}return X}function MQ($,Z){let J=$;return J=J.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(X,Y)=>{if(Y in Z)return`:${Y}="${Y}"`;return X}),J=J.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(X,Y,Q)=>{try{let G=Object.keys(Z),z=Object.values(Z);Z6(Q);let q=q0(Q,G)(...z),W=JSON.stringify(q);if(W===void 0){if(!w9(Q).some((j)=>!(j in Z)))return"";return X}let U=Buffer.from(W,"utf8").toString("base64");return`__stx_${Y}="${U}"`}catch(G){return X}}),J}var I9="<!--__STX_BREAK__-->",T9="<!--__STX_CONTINUE__-->";function AQ($,Z){let J=$;return J=A9(J,"@break",(X)=>{try{let Q=`!!(${X.trim()})`,G;if(H0(Q)){let z=q0(Q,Object.keys(Z));G=Boolean(z(...Object.values(Z)))}else G=Boolean(Q0(Q,Z));return G?I9:""}catch{return""}}),J=A9(J,"@continue",(X)=>{try{let Q=`!!(${X.trim()})`,G;if(H0(Q)){let z=q0(Q,Object.keys(Z));G=Boolean(z(...Object.values(Z)))}else G=Boolean(Q0(Q,Z));return G?T9:""}catch{return""}}),J}function IQ($){let Z=$;return Z=Z.replace(/@break(?!\()/g,I9),Z=Z.replace(/@continue(?!\()/g,T9),Z}function t4($){let Z=$.includes(I9),J=Z?$.substring(0,$.indexOf(I9)):$;return{hasBreak:Z,content:J}}function e4($){let Z=$.includes(T9),J=Z?$.substring(0,$.indexOf(T9)):$;return{hasContinue:Z,content:J}}function J6($){let Z=$;return Z=A9(Z,"@break",(J)=>{let X=J.trim();if(!M9(X))return"";return`\`; if (${X}) { break; } result += \``}),Z=A9(Z,"@continue",(J)=>{let X=J.trim();if(!M9(X))return"";return`\`; if (${X}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function TQ($){let Z=/@forelse\s*\(/g,J,X=[],Y=/@foreach\s*\(/g,Q=/@endforeach/g,G;while((G=Y.exec($))!==null)X.push({pos:G.index,delta:1});while((G=Q.exec($))!==null)X.push({pos:G.index,delta:-1});X.sort((W,U)=>W.pos-U.pos);let z=[],K=0;for(let W of X)K+=W.delta,z.push({pos:W.pos,depth:K});function q(W){let U=0,H=z.length-1,j=0;while(U<=H){let B=U+H>>1;if(z[B].pos<=W)j=z[B].depth,U=B+1;else H=B-1}return j}while((J=Z.exec($))!==null){if(q(J.index)>0)continue;let W=J.index,U=J.index+J[0].length-1,H=1,j=U+1,B=-1;while(j<$.length&&H>0){if($[j]==="(")H++;else if($[j]===")"){if(H--,H===0){B=j;break}}j++}if(B===-1)continue;let V=$.substring(U+1,B),L=X6(V);if(!L)continue;let{arrayExpr:_,itemVar:F}=L,O=B+1,w=1,N=O,R=/@forelse\s*\(/g,M=/@endforelse/g,T=-1;while(w>0&&N<$.length){R.lastIndex=N,M.lastIndex=N;let C=R.exec($),y=M.exec($);if(!y)break;if(C&&C.index<y.index)w++,N=C.index+C[0].length;else{if(w--,w===0){T=y.index;break}N=y.index+11}}if(T===-1)continue;let D=$.substring(O,T),I=T+11,E=-1,A=0,k=0;while(k<D.length){let C=D.indexOf("@",k);if(C===-1)break;let y=D.substring(C);if(/^@forelse\s*\(/.test(y))A++,k=C+1;else if(y.startsWith("@endforelse"))A--,k=C+11;else if(A===0&&y.startsWith("@empty")){if(D.length<=C+6||!/[a-z]/i.test(D[C+6])){E=C;break}k=C+1}else k=C+1}if(E===-1)continue;return{start:W,end:I,arrayExpr:_,itemVar:F,foreachContent:D.substring(0,E),emptyContent:D.substring(E+6)}}return null}function $6($,Z){let J=$;while(!0){let X=TQ(J);if(!X)break;let{start:Y,end:Q,arrayExpr:G,itemVar:z,foreachContent:K,emptyContent:q}=X;try{let W;if(H0(G))W=q0(G,Object.keys(Z))(...Object.values(Z));else W=Q0(G,Z);let U;if(!Array.isArray(W)||W.length===0)U=q;else U=`@foreach (${G} as ${z})${K}@endforeach`;J=J.substring(0,Y)+U+J.substring(Q)}catch(W){let U=W instanceof Error?W.message:String(W),H=R0("Forelse",`Error in @forelse(${G} as ${z}): ${U}`,w0.EVALUATION_ERROR);J=J.substring(0,Y)+H+J.substring(Q)}}return J}function X6($){let Z=$.indexOf(" as ");if(Z!==-1){let Q=$.slice(0,Z).trim(),G=$.slice(Z+4).trim();return Q&&G?{arrayExpr:Q,itemVar:G}:null}let J=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec($);if(!J)return null;let X=J[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),Y=J[2].trim();return X&&Y?{arrayExpr:Y,itemVar:X}:null}var Y6="<!--stx:foreach-not-iterable:",kQ=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function EQ($,Z){return`${Y6}${encodeURIComponent($)}|${encodeURIComponent(Z)}-->`}function bQ($,Z){console.warn(`[stx] @foreach(${$}) in ${Z}: ${$} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.")}function F$($){if(!$.includes(Y6))return $;return $.replace(kQ,(Z,J,X)=>{return bQ(decodeURIComponent(J),decodeURIComponent(X)),""})}function Q6($,Z,J,X,Y=!1){let Q=$;Q=$6(Q,Z);function G(q){let W=/@foreach\s*\(/g,U;while((U=W.exec(q))!==null){let H=U.index,j=U.index+U[0].length-1,B=1,V=j+1,L=-1;while(V<q.length&&B>0){if(q[V]==="(")B++;else if(q[V]===")"){if(B--,B===0){L=V;break}}V++}if(L===-1)continue;let _=q.substring(j+1,L),F=X6(_);if(!F)continue;let O=H,{arrayExpr:w,itemVar:N}=F,R=L+1,M=1,T=R,D=/@foreach\s*\(/g,I=/@endforeach/g;while(M>0&&T<q.length){D.lastIndex=T,I.lastIndex=T;let E=D.exec(q),A=I.exec(q);if(!A)break;if(E&&E.index<A.index)M++,T=E.index+E[0].length;else{if(M--,M===0){let k=q.substring(R,A.index),C=A.index+11;return{start:O,end:C,arrayExpr:w,itemVar:N,content:k}}T=A.index+11}}}return null}function z(q,W){let U=q;while(!0){let H=G(U);if(!H)break;let{start:j,end:B,arrayExpr:V,itemVar:L,content:_}=H;try{let F=V.trim(),O;if(H0(F))O=q0(F,Object.keys(W))(...Object.values(W));else O=Q0(F,W);let w=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),w=!0;else if(O instanceof Set)O=Array.from(O);else if(typeof O==="string")O=Array.from(O);else if(O&&typeof O==="object"&&!(O instanceof Date)&&!(O instanceof RegExp))O=Object.entries(O),w=!0;else{let A=EQ(F,J)+R0("Foreach",`Error in @foreach: ${F} is not iterable`,w0.TYPE_ERROR);U=U.substring(0,j)+A+U.substring(B);continue}let N=X?.loops?.useAltLoopVariable??RQ,R=L.trim(),M=null,T,D=!1;if(R.includes("=>")){let A=R.split("=>").map((k)=>k.trim());if(A.length===2&&A[0]&&A[1])M=A[0],T=A[1];else T=R}else if(!R.startsWith("[")&&!R.startsWith("{")&&R.includes(",")){let A=R.split(",").map((k)=>k.trim());if(A.length===2&&A[0]&&A[1])T=A[0],M=A[1],D=!0;else T=R}else T=R;let I="",E=O;for(let A=0;A<E.length;A++){let k=E[A],C={index:A,iteration:A+1,first:A===0,last:A===E.length-1,count:E.length},y={...W,loop:C,$loop:C};if(T.startsWith("[")&&T.endsWith("]")){let l=T.slice(1,-1).split(",").map((g)=>g.trim());if(Array.isArray(k))l.forEach((g,J0)=>{if(g)y[g]=k[J0]});else y[T]=k}else if(T.startsWith("{")&&T.endsWith("}")){let l=T.slice(1,-1).split(",").map((g)=>g.trim()).filter(Boolean);if(k!==null&&typeof k==="object")l.forEach((g)=>{let J0=g.indexOf(":"),X0=(J0===-1?g:g.slice(0,J0)).trim(),$0=J0===-1?X0:g.slice(J0+1).trim();if(X0&&$0)y[$0]=k[X0]});else y[T]=k}else y[T]=k;if(M)if(!D&&w&&Array.isArray(k)&&k.length===2)y[M]=k[0],y[T]=k[1];else y[M]=A;let b=AQ(_,y),P=e4(b);if(P.hasContinue){I+=P.content;continue}let u=t4(b);if(u.hasBreak){I+=u.content;break}if(b=$6(b,y),b=z(b,y),b=a0(b,y,J),b=IQ(b),u=t4(b),u.hasBreak){I+=u.content;break}if(P=e4(b),P.hasContinue){I+=P.content;continue}b=B1(b,y,J),b=MQ(b,y),b=DQ(b,y),b=NQ(b,y),I+=b}U=U.substring(0,j)+I+U.substring(B)}catch(F){let O=R0("Foreach",`Error in @foreach(${V.trim()} as ${L.trim()}): ${F instanceof Error?F.message:String(F)}`,w0.EVALUATION_ERROR);U=U.substring(0,j)+O+U.substring(B)}}return U}Q=z(Q,Z),Q=z6(Q,Z,J,X);let K=X?.loops?.maxWhileIterations??wQ;return Q=SQ(Q,Z,K),Y?Q:F$(Q)}function G6($){return M9($)}function z6($,Z,J,X){let Y=$,Q=!0;while(Q){Q=!1;let G=Y.match(/@for\s*\(/);if(!G||G.index===void 0)break;let z=G.index,K=z+G[0].length-1,q=N0(Y,"(",")",K);if(q===-1)break;let W=Y.slice(K+1,q),U=q+1,H=z9(Y.slice(z),"for","endfor");if(H.length===0)break;let j=H[0].content,B=z+H[0].end;if(!G6(W)){let V=R0("For",`Unsafe expression in @for: ${W}`,w0.UNSAFE_EXPRESSION);Y=Y.substring(0,z)+V+Y.substring(B),Q=!0;continue}try{let V=yQ(W),L=/@(?:for|foreach|if|unless)\s*\(/.test(j);if(V.length>0&&L){let R=CQ({forExpr:W,content:j,iterVarNames:V,context:Z,filePath:J,options:X});Y=Y.substring(0,z)+R+Y.substring(B),Q=!0;continue}let _=Object.keys(Z),F=Object.values(Z),O=j.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(R,M)=>{return`\${${M}}`});O=J6(O);let N=Function(..._,`
|
|
3417
|
+
let result = '';
|
|
3418
|
+
for (${W}) {
|
|
3419
|
+
result += \`${O}\`;
|
|
3420
|
+
}
|
|
3421
|
+
return result;
|
|
3422
|
+
`)(...F);Y=Y.substring(0,z)+N+Y.substring(B),Q=!0}catch(V){let L=R0("For",`Error in @for(${W}): ${V instanceof Error?V.message:String(V)}`,w0.EVALUATION_ERROR);Y=Y.substring(0,z)+L+Y.substring(B),Q=!0}}return Y}function yQ($){let Z=$.trim(),J=Z.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(J){let Q=J[1];return Q.slice(1,-1).split(",").map((z)=>{let K=z.trim();if(!K)return"";let q=K.indexOf(":");if(q>=0&&Q.startsWith("{")){let H=K.slice(q+1).trim(),j=H.indexOf("=");return(j>=0?H.slice(0,j):H).trim()}let W=K.indexOf("="),U=(W>=0?K.slice(0,W):K).trim();return/^[A-Za-z_$][\w$]*$/.test(U)?U:""}).filter(Boolean)}let X=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(X)return[X[1]];let Y=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(Y)return[Y[1]];return[]}function CQ($){let{forExpr:Z,content:J,iterVarNames:X,context:Y,filePath:Q,options:G}=$,z=Object.keys(Y),K=Object.values(Y),q=Function(...z,"__pushIter",`
|
|
3423
|
+
for (${Z}) {
|
|
3424
|
+
__pushIter([${X.join(", ")}])
|
|
3425
|
+
}
|
|
3426
|
+
`),W=[];q(...K,(j)=>{W.push(j)});let U=Q??"inline.stx",H="";for(let j of W){let B={...Y};X.forEach((L,_)=>{B[L]=j[_]});let V=z6(J,B,Q,G);V=a0(V,B,U),V=B1(V,B,U),H+=V}return H}function SQ($,Z,J){let X=$,Y=!0;while(Y){Y=!1;let Q=X.match(/@while\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,z=G+Q[0].length-1,K=N0(X,"(",")",z);if(K===-1)break;let q=X.slice(z+1,K),W=z9(X.slice(G),"while","endwhile");if(W.length===0)break;let U=W[0].content,H=G+W[0].end;if(!G6(q)){let j=R0("While",`Unsafe expression in @while: ${q}`,w0.UNSAFE_EXPRESSION);X=X.substring(0,G)+j+X.substring(H),Y=!0;continue}try{let j=Object.keys(Z),B=Object.values(Z),V=U.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(F,O)=>{return`\${${O}}`});V=J6(V);let _=Function(...j,`
|
|
3427
|
+
let result = '';
|
|
3428
|
+
let maxIterations = ${J}; // Configurable safety limit
|
|
3429
|
+
let counter = 0;
|
|
3430
|
+
while (${q} && counter < maxIterations) {
|
|
3431
|
+
counter++;
|
|
3432
|
+
result += \`${V}\`;
|
|
3433
|
+
}
|
|
3434
|
+
if (counter > maxIterations) {
|
|
3435
|
+
result += '<!-- [While Error [1104]]: Maximum iterations (${J}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
|
|
3436
|
+
}
|
|
3437
|
+
return result;
|
|
3438
|
+
`)(...B);X=X.substring(0,G)+_+X.substring(H),Y=!0}catch(j){let B=R0("While",`Error in @while(${q}): ${j instanceof Error?j.message:String(j)}`,w0.EVALUATION_ERROR);X=X.substring(0,G)+B+X.substring(H),Y=!0}}return X}function PQ($,Z="_method"){let J=$.toUpperCase();if(J==="GET"||J==="POST")return"";return`<input type="hidden" name="${Z}" value="${J}">`}function K6($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,J,X,Y,Q)=>{return PQ(X,Q||"_method")})}async function q6($,Z,J,X,Y){if(!X.middleware||X.middleware.length===0)return $;let Q=$,G=X.middleware.filter((z)=>z.timing===Y);if(G.length===0)return Q;for(let z of G){if(!z.name||typeof z.handler!=="function"){if(X.debug)console.warn("Invalid middleware:",z);continue}try{let K=await z.handler(Q,Z,J,X);if(typeof K==="string")Q=K;else if(X.debug)console.warn(`Middleware ${z.name} did not return a string`)}catch(K){if(X.debug)console.error(`Error in middleware ${z.name}:`,K);if(X.debug){let q=_0("Middleware",`Error in middleware '${z.name}': ${K instanceof Error?K.message:String(K)}`,J,$);Q=Q.replace(/<body[^>]*>/,`$&
|
|
3439
|
+
<div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${$5(q)}</div>
|
|
3440
|
+
`)}}}return Q}async function W6($,Z,J,X){return q6($,Z,J,X,"before")}async function U6($,Z,J,X){return q6($,Z,J,X,"after")}W2();W2();function H6($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,J,X,Y,Q)=>{try{let G=Y?d0(Y,{}):{};return w$(X,G,Q==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var l0={patterns:[],exact:{}};function CB($,Z){if(!l0.exact[$])l0.exact[$]=[];l0.exact[$].push(Z)}function SB($,Z){let J=typeof $==="string"?new RegExp($):$;l0.patterns.push({pattern:J,callback:Z})}async function j6($,Z){let J=$.split("/").pop()?.split(".")[0]||"";if(l0.exact[$])for(let X of l0.exact[$])await Promise.resolve(X(Z,$));if(l0.exact[J])for(let X of l0.exact[J])await Promise.resolve(X(Z,$));for(let{pattern:X,callback:Y}of l0.patterns)if(X.test($)||X.test(J))await Promise.resolve(Y(Z,$))}function PB(){l0.patterns=[],l0.exact={}}var vQ=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),fQ=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 T1($,Z){let J=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;J.lastIndex=Z;let X=J.exec($);if(!X)return null;let Y=/\/\s*>$/.test(X[0])||X[1]===X[1].toLowerCase()&&vQ.has(X[1]),Q=Y?X[2].replace(/\/\s*$/,""):X[2];return{full:X[0],tag:X[1],attrs:Q,selfClosing:Y,start:X.index,end:X.index+X[0].length}}function xQ($,Z,J){let X=1,Y=J,Q=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(X>0&&Y<$.length){Q.lastIndex=Y,G.lastIndex=Y;let z=Q.exec($),K=G.exec($);if(!K)return-1;if(z&&z.index<K.index)X++,Y=z.index+z[0].length;else{if(X--,X===0)return K.index+K[0].length;Y=K.index+K[0].length}}return-1}function I1($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let J=xQ($,Z.tag,Z.end);if(J===-1)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};return{outerStart:Z.start,outerEnd:J,innerHTML:$.slice(Z.end,J-`</${Z.tag}>`.length)}}function B6($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function I2($,Z){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=$.match(new RegExp(`${J}="([^"]*)"`,"s"))||$.match(new RegExp(`${J}='([^']*)'`,"s"));return X?X[1]:null}function q1($,Z){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${J}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${J}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${J}(?=\\s|$|>|/)`,"g"),"")}function s1($,Z,J){let X=Z.selfClosing?" /":"",Y=`<${Z.tag}${J}${X}>`;return $.slice(0,Z.start)+Y+$.slice(Z.end)}function gQ($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function hQ($){let Z=$,J=0;while(J<Z.length){let X=T1(Z,J);if(!X)break;let Y=I2(X.attrs,"v-for");if(Y===null){J=X.end;continue}let Q=Y.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!Q){J=X.end;continue}let G=Q[1].trim(),z=Q[2].trim(),K;if(G.includes(",")){let L=G.split(",").map((O)=>O.trim()),_=L[0],F=L[1];K=`${z} as ${F} => ${_}`}else K=`${z} as ${G}`;let q=q1(X.attrs,"v-for"),W=q1(q,":key").replace(/\s*v-bind:key="[^"]*"/g,""),U=I1(Z,X),H=Z.slice(U.outerStart,U.outerEnd),j=s1(H,{...X,start:0,end:X.end-X.start},W),B=`@foreach(${K})
|
|
3441
|
+
`,V=`${B}${j}
|
|
3442
|
+
@endforeach`;Z=Z.slice(0,U.outerStart)+V+Z.slice(U.outerEnd),J=U.outerStart+B.length}return Z}function uQ($){let Z=$,J=0;while(J<Z.length){let X=T1(Z,J);if(!X)break;let Y=I2(X.attrs,"v-if");if(Y===null){J=X.end;continue}let Q=[],G=I1(Z,X),z=q1(X.attrs,"v-if"),K=s1(Z.slice(G.outerStart,G.outerEnd),{...X,start:0,end:X.end-X.start},z);Q.push({type:"if",expr:Y,outerStart:G.outerStart,outerEnd:G.outerEnd,element:K,parsedTag:X});let q=G.outerEnd,W=!0;while(W){let V=Z.slice(q).match(/^\s*/),L=V?V[0].length:0,_=T1(Z,q+L);if(!_){W=!1;break}let F=I2(_.attrs,"v-else-if"),O=B6(_.attrs,"v-else");if(F!==null){let w=I1(Z,_),N=q1(_.attrs,"v-else-if"),R=s1(Z.slice(w.outerStart,w.outerEnd),{..._,start:0,end:_.end-_.start},N);Q.push({type:"else-if",expr:F,outerStart:q,outerEnd:w.outerEnd,element:R,parsedTag:_}),q=w.outerEnd}else if(O){let w=I1(Z,_),N=q1(_.attrs,"v-else"),R=s1(Z.slice(w.outerStart,w.outerEnd),{..._,start:0,end:_.end-_.start},N);Q.push({type:"else",outerStart:q,outerEnd:w.outerEnd,element:R,parsedTag:_}),W=!1}else W=!1}let U=[];for(let V of Q)if(V.type==="if")U.push(`@if(${V.expr})
|
|
3443
|
+
${V.element}`);else if(V.type==="else-if")U.push(`@elseif(${V.expr})
|
|
3444
|
+
${V.element}`);else U.push(`@else
|
|
3445
|
+
${V.element}`);U.push("@endif");let H=U.join(`
|
|
3446
|
+
`),j=Q[0].outerStart,B=Q[Q.length-1].outerEnd;Z=Z.slice(0,j)+H+Z.slice(B),J=j+H.length}return Z}function mQ($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function dQ($){let Z=$,J=0;while(J<Z.length){let X=T1(Z,J);if(!X)break;let Y=fQ.has(X.tag),Q=X.attrs.replace(/([^\s=]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s]+))?/g,(z,K,q)=>{let W=/^v-model(?::([a-zA-Z_][a-zA-Z0-9_]*))?((?:\.[a-zA-Z]+)*)$/.exec(K);if(!W||!q||!/^["']/.test(q))return z;let U=W[1]||"modelValue",H=W[2];if(Y&&!W[1])return`@model${H}=${q}`;let j=q[0],B=q.slice(1,-1),V=`:${U}=${q} @update:${U}=${j}${B} = $event${j}`;if(H){let L=W[1]?`${U}Modifiers`:"modelModifiers",_=H.slice(1).split(".").map((F)=>`${F}: true`).join(", ");V+=` :${L}="{ ${_} }"`}return V});if(Q===X.attrs){J=X.end;continue}let G=s1(X.full,{...X,start:0,end:X.full.length},Q);Z=Z.slice(0,X.start)+G+Z.slice(X.end),J=X.start+G.length}return Z}function lQ($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function cQ($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function pQ($){let Z=$,J=0;while(J<Z.length){let X=T1(Z,J);if(!X)break;let Y=I2(X.attrs,"v-html");if(Y===null){J=X.end;continue}if(X.selfClosing){J=X.end;continue}let Q=I1(Z,X),G=q1(X.attrs,"v-html"),z=X.selfClosing?" /":"",K=`<${X.tag}${G}${z}>{!! ${Y} !!}</${X.tag}>`;Z=Z.slice(0,Q.outerStart)+K+Z.slice(Q.outerEnd),J=Q.outerStart+K.length}return Z}function iQ($){let Z=$,J=0;while(J<Z.length){let X=T1(Z,J);if(!X)break;let Y=I2(X.attrs,"v-text");if(Y===null){J=X.end;continue}if(X.selfClosing){J=X.end;continue}let Q=I1(Z,X),G=q1(X.attrs,"v-text"),z=X.selfClosing?" /":"",K=`<${X.tag}${G}${z}>{{ ${Y} }}</${X.tag}>`;Z=Z.slice(0,Q.outerStart)+K+Z.slice(Q.outerEnd),J=Q.outerStart+K.length}return Z}function nQ($){return $.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 oQ($){let Z=$,J=0;while(J<Z.length){let X=T1(Z,J);if(!X)break;if(!B6(X.attrs,"v-once")){J=X.end;continue}let Y=q1(X.attrs,"v-once"),Q=I1(Z,X),G=Z.slice(Q.outerStart,Q.outerEnd),K=`@once
|
|
3447
|
+
${s1(G,{...X,start:0,end:X.end-X.start},Y)}
|
|
3448
|
+
@endonce`;Z=Z.slice(0,Q.outerStart)+K+Z.slice(Q.outerEnd),J=Q.outerStart+K.length}return Z}function sQ($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function rQ($){return $.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 V6($){if(!gQ($))return $;let Z=$;return Z=hQ(Z),Z=uQ(Z),Z=oQ(Z),Z=lQ(Z),Z=cQ(Z),Z=dQ(Z),Z=mQ(Z),Z=rQ(Z),Z=pQ(Z),Z=iQ(Z),Z=nQ(Z),Z=sQ(Z),Z}function k9($){return $.replace(/--/g,"- -").replace(/</g,"<").replace(/>/g,">")}var R$=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"]),aQ=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function O6($,Z){let J=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($),X=J?J[1]:$,Y=Q0(X,Z);if(Y&&typeof Y==="string")return Y;let Q=X.trim();return R$.has(Q)?Q:null}function _6($){let Z=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($);return Z?Z[1]:$}function L6($,Z,J){let X=Z.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),Y=X?`<${$} ${X}>`:`<${$}>`;if(aQ.has($))return X?`<${$} ${X}>`:`<${$}>`;return`${Y}${J}</${$}>`}async function F6($,Z,J,X,Y){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,z=[],K;while((K=G.exec(Q))!==null)z.push({full:K[0],expr:K[1],attrs:K[2],slotContent:K[3],index:K.index});for(let q=z.length-1;q>=0;q--){let W=z[q];try{let U=O6(W.expr,Z);if(!U||typeof U!=="string"){let F=`<!-- dynamic component: could not resolve "${k9(_6(W.expr))}" -->`;Q=Q.slice(0,W.index)+F+Q.slice(W.index+W.full.length);continue}if(R$.has(U)){let F=L6(U,W.attrs,W.slotContent);Q=Q.slice(0,W.index)+F+Q.slice(W.index+W.full.length);continue}let H=W.attrs.trim(),j={},B=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,V;while((V=B.exec(H))!==null){let F=V[1]||V[2],O=V[3];if(V[1])try{j[F]=Q0(O,Z)}catch{j[F]=O}else j[F]=O}let L=X.componentsDir||"components",_=await D1(U,j,W.slotContent,L,Z,J,X,new Set,Y??new Set);Q=Q.slice(0,W.index)+_+Q.slice(W.index+W.full.length)}catch(U){let H=U instanceof Error?U.message:String(U),j=`<!-- dynamic component error: ${k9(H)} -->`;Q=Q.slice(0,W.index)+j+Q.slice(W.index+W.full.length)}}return Q=await tQ(Q,Z,J,X,Y),Q}async function tQ($,Z,J,X,Y){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,z=[],K;while((K=G.exec(Q))!==null)z.push({full:K[0],expr:K[1],attrs:K[2],index:K.index});for(let q=z.length-1;q>=0;q--){let W=z[q];try{let U=O6(W.expr,Z);if(!U||typeof U!=="string"){let B=`<!-- dynamic component: could not resolve "${k9(_6(W.expr))}" -->`;Q=Q.slice(0,W.index)+B+Q.slice(W.index+W.full.length);continue}if(R$.has(U)){let B=L6(U,W.attrs,"");Q=Q.slice(0,W.index)+B+Q.slice(W.index+W.full.length);continue}let H=X.componentsDir||"components",j=await D1(U,{},"",H,Z,J,X,new Set,Y??new Set);Q=Q.slice(0,W.index)+j+Q.slice(W.index+W.full.length)}catch(U){let H=U instanceof Error?U.message:String(U),j=`<!-- dynamic component error: ${k9(H)} -->`;Q=Q.slice(0,W.index)+j+Q.slice(W.index+W.full.length)}}return Q}function N$(){return{afterOpen:[],beforeClose:[]}}function eQ($){return $.afterOpen.length>0||$.beforeClose.length>0}function R6($,Z){if(!eQ(Z))return $;let J=Z.afterOpen.join(""),X=Z.beforeClose.join(""),Y=$.lastIndexOf("</head>"),Q=J?T2($):null,G=X&&Y!==-1?Y:null;if(Q===null&&G===null)return $;if(Q!==null&&G!==null)return`${$.slice(0,Q)}${J}${$.slice(Q,G)}${X}${$.slice(G)}`;if(Q!==null)return`${$.slice(0,Q)}${J}${$.slice(Q)}`;return`${$.slice(0,G)}${X}${$.slice(G)}`}var w6=/\s*<meta\b[^>]*\bcharset\b[^>]*>/iy;function T2($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return null;let J=Z.index+Z[0].length;w6.lastIndex=J;let X=w6.exec($);return X?J+X[0].length:J}var M$="data-stx-color-mode-boot",$G="__STX_COLOR_MODE__",ZG=new Set(["light","dark","auto","system"]),JG=new Set(["auto","system"]),XG=/^[a-z][\w:-]*$/i,YG=/^[\w-]+$/;function QG($){let Z=$.storageKey??"stx-color-mode",J=$.initialMode??"auto",X=$.darkClass===void 0?"dark":$.darkClass,Y=$.attribute??null,Q=$.autoValue??null;if(typeof Z!=="string"||Z.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!ZG.has(J))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(J)}`);if(X!==null&&(typeof X!=="string"||!YG.test(X)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(X)}`);if(Y!==null&&(typeof Y!=="string"||!XG.test(Y)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(Y)}`);if(Q!==null&&!JG.has(Q))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(Q)}`);if(X===null&&Y===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");return{storageKey:Z,initialMode:J==="system"?"auto":J,darkClass:X,attribute:Y,autoValue:Q}}function GG($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function A$($={}){let Z=QG($),X=`(function(){"use strict";var c=${GG(Z)};var p=c.initialMode;var a=c.autoValue;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"){p=v}else if(v==="auto"||v==="system"){p="auto";if(!a)a=v}}catch(e){}var m=p;if(p==="auto"){try{m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){m="light"}}var r=document.documentElement;if(c.attribute)r.setAttribute(c.attribute,m);if(c.darkClass){if(m==="dark")r.classList.add(c.darkClass);else r.classList.remove(c.darkClass)}try{window.${$G}={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:a||"auto",preference:p,mode:m}}catch(e){}}());`;return`<script ${M$}>${X}</script>`}function M6($,Z={}){if($.includes(M$))return $;let J=D$($);if(J===null)return $;let X=A$(Z);return`${$.slice(0,J)}
|
|
3449
|
+
${X}${$.slice(J)}`}var D$=T2,zG=new RegExp(`<script\\b[^>]*\\b${M$}\\b[^>]*>[\\s\\S]*?<\\/script>`,"i"),N6=/<meta\b[^>]*\bcharset\b[^>]*>/gi,D6=/<\/head>/gi;function KG($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return $;let J=Z.index+Z[0].length;D6.lastIndex=J;let X=D6.exec($),Y=X?X.index:$.length;N6.lastIndex=J;let Q=N6.exec($);if(!Q||Q.index>=Y)return $;if($.slice(J,Q.index).trim()==="")return $;let G=Q.index+Q[0].length;return`${$.slice(0,J)}
|
|
3450
|
+
${Q[0]}${$.slice(J,Q.index)}${$.slice(G,Y)}${$.slice(Y)}`}function A6($){return qG(KG($))}function qG($){let Z=zG.exec($);if(!Z)return $;let J=D$($);if(J===null)return $;if(Z.index<=J||$.slice(J,Z.index).trim()==="")return $;let X=$.slice(0,Z.index)+$.slice(Z.index+Z[0].length),Y=D$(X);if(Y===null)return $;return`${X.slice(0,Y)}
|
|
3451
|
+
${Z[0]}${X.slice(Y)}`}var cB="stx-build",pB="X-STX-Build",k2=Symbol.for("stx.buildId");function I6(){let $=globalThis;if(!$[k2])$[k2]=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return $[k2]}function iB($){let Z=globalThis;if($===null)delete Z[k2];else Z[k2]=$}function nB($,Z=I6()){let J=I$($,Z);if(J===null)return $;let X=/<head\b[^>]*>/i.exec($),Y=X.index+X[0].length;return`${$.slice(0,Y)}${J}${$.slice(Y)}`}function I$($,Z=I6()){if($.includes('name="stx-build"'))return null;if(!/<head\b[^>]*>/i.test($))return null;return`
|
|
3452
|
+
<meta name="stx-build" content="${Z}">`}import{AsyncLocalStorage as WG}from"async_hooks";var T6=new WG;function T$($){return $.__stx_server_data??={pending:new Map,values:new Map}}function k6($,Z){return T6.run(T$($),Z)}async function E6($,Z){let J=T6.getStore();if(!J)throw Error("useServerData must run inside a <script server> render");if(typeof $!=="string"||!$.trim())throw TypeError("useServerData requires a non-empty string key");let X=J.pending.get($);if(X)return X;let Y=Promise.resolve().then(Z).then((Q)=>{let G=JSON.stringify(Q,(K,q)=>{if(q===void 0||typeof q==="function"||typeof q==="symbol"||typeof q==="bigint"||typeof q==="number"&&!Number.isFinite(q))throw TypeError(`useServerData(${JSON.stringify($)}) requires JSON-serializable data`);if(q&&typeof q==="object"&&!Array.isArray(q)&&Object.getPrototypeOf(q)!==Object.prototype&&Object.getPrototypeOf(q)!==null)throw TypeError(`useServerData(${JSON.stringify($)}) requires JSON-serializable data`);return q}),z=JSON.parse(G);return J.values.set($,z),z}).catch((Q)=>{throw J.pending.delete($),Q});return J.pending.set($,Y),Y}function b6($){let Z=$.__stx_server_data;if(!Z?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(Z.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}var S6="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",E9="data-stx-html-attrs",b9="data-stx-html-class",P6=/^[A-Za-z_:][\w:.-]*$/;function e0($){return String($).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function UG($){return String($).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function a1($){if($.name)return`name="${$.name}"`;if($.property)return`property="${$.property}"`;if($.charset!=null)return"charset=";if($["http-equiv"])return`http-equiv="${$["http-equiv"]}"`;return""}function r1($,Z){return Object.entries($).filter(([J])=>!Z?.(J)).map(([J,X])=>`${J}="${e0(String(X))}"`).join(" ")}function HG($={},Z="en"){let J=[],X=[],Y="",Q=Z;for(let[z,K]of Object.entries($||{})){if(K==null)continue;let q=z.trim();if(!P6.test(q))continue;let W=q.toLowerCase();if(W==="lang"){Q=String(K);continue}if(W==="class"){Y=String(K).trim();continue}J.push(` ${q}="${e0(String(K))}"`),X.push(q)}let G=` lang="${e0(Q)}"`;if(Y)G+=` class="${e0(Y)}"`;if(G+=J.join(""),Y)G+=` ${b9}="${e0(Y)}"`;if(X.length)G+=` ${E9}="${e0(X.join(" "))}"`;return G}function v6($={},Z={}){let J={...$,...Z};if($.class&&Z.class){let X=$.class.split(/\s+/).filter(Boolean);for(let Y of Z.class.split(/\s+/).filter(Boolean))if(!X.includes(Y))X.push(Y);J.class=X.join(" ")}return J}function f6($,Z={}){if(!Z||Object.keys(Z).length===0)return $;let J=$.match(/<html\b([^>]*)>/i);if(!J)return $;let X={},Y=[],Q=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,G;while((G=Q.exec(J[1]))!==null){let W=G[1];if(!(W in X))Y.push(W);X[W]=G[2]??G[3]??G[4]??""}let z=[],K=[];for(let[W,U]of Object.entries(Z)){if(U==null)continue;let H=W.trim();if(!P6.test(H))continue;let j=H.toLowerCase();if(j==="class"){let B=(X.class||"").split(/\s+/).filter(Boolean);for(let V of String(U).split(/\s+/).filter(Boolean))if(!B.includes(V))B.push(V),z.push(V);if(!("class"in X))Y.push("class");X.class=B.join(" ");continue}if(!(H in X))Y.push(H);if(X[H]=String(U),j!=="lang")K.push(H)}if(z.length){if(!(b9 in X))Y.push(b9);X[b9]=z.join(" ")}if(K.length){if(!(E9 in X))Y.push(E9);X[E9]=K.join(" ")}let q=Y.map((W)=>` ${W}="${e0(X[W])}"`).join("");return $.replace(J[0],()=>`<html${q}>`)}function tB($){let Z=b$($);if(Z===null)return $;let J=$.lastIndexOf("</head>");return`${$.slice(0,J)}${Z}${$.slice(J)}`}function b$($){if($.includes("data-stx-cloak"))return null;if($.lastIndexOf("</head>")===-1)return null;return`${S6}
|
|
3453
|
+
`}function jG($){let Z=[],J=0;while(J<$.length){let Q=$.slice(J),G=Q.match(/^\s+/);if(G){J+=G[0].length;continue}if(Q.startsWith("<!--")){let U=$.indexOf("-->",J);if(U===-1)break;J=U+3;continue}let z=Q.match(/^<script\b[^>]*>/i);if(z){let U=$.toLowerCase().indexOf("</script>",J+z[0].length);if(U===-1)break;J=U+9;continue}let K=Q.match(/^<link\b[^>]*>/i);if(K){Z.push(K[0]),J+=K[0].length;continue}let q=Q.match(/^<meta\b[^>]*>/i);if(q){Z.push(q[0]),J+=q[0].length;continue}let W=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(W){Z.push(W[0]),J+=W[0].length;continue}break}if(Z.length===0)return{body:$,hoisted:Z};let X="",Y=0;while(Y<$.length&&Y<J){let Q=$.slice(Y),G=Q.match(/^<link\b[^>]*>/i);if(G&&Z.includes(G[0])){Y+=G[0].length;continue}let z=Q.match(/^<meta\b[^>]*>/i);if(z&&Z.includes(z[0])){Y+=z[0].length;continue}let K=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(K&&Z.includes(K[0])){Y+=K[0].length;continue}X+=$[Y],Y++}return X+=$.slice(J),{body:X,hoisted:Z}}function BG($,Z={},J={}){let{title:X="stx App",lang:Y="en",meta:Q=[],link:G=[],script:z=[],headRaw:K="",htmlAttrs:q={},bodyClass:W="",bodyAttrs:U={}}=Z,H=J.title||X,j=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],B=new Set(Q.map(a1).filter(Boolean)),L=[...j.filter((I)=>!B.has(a1(I))),...Q].map((I)=>{return` <meta ${r1(I)}>`}).join(`
|
|
3454
|
+
`),_=G.map((I)=>{return` <link ${r1(I)}>`}).join(`
|
|
3455
|
+
`),F=z.map((I)=>{if(I.src)return` <script ${r1(I,(E)=>E==="content")}></script>`;if(I.content)return` <script>${I.content}</script>`;return""}).filter(Boolean).join(`
|
|
3456
|
+
`),O=HG(q,Y),w=Object.entries(U).map(([I,E])=>` ${I}="${e0(String(E))}"`).join(""),N=W?` class="${e0(W)}"`:"",{body:R,hoisted:M}=jG($),T=[L,J.colorMode?` ${A$(J.colorMode)}`:"",` <title>${J.titleIsHtml?H:UG(H)}</title>`,` ${S6}`,_,F,K?` ${K}`:"",...(J.styles||[]).map((I)=>` ${I}`),...M.map((I)=>` ${I}`),...(J.headScripts||[]).map((I)=>` ${I}`),J.headStack||""].filter(Boolean),D=[R,...(J.bodyScripts||[]).map((I)=>I),J.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
|
|
3457
|
+
<html${O}>
|
|
3458
|
+
<head>
|
|
3459
|
+
${T.join(`
|
|
3460
|
+
`)}
|
|
3461
|
+
</head>
|
|
3462
|
+
<body${N}${w}>
|
|
3463
|
+
${D.join(`
|
|
3464
|
+
`)}
|
|
3465
|
+
</body>
|
|
3466
|
+
</html>`}var k$=/\s+/y,E$=/<(script|style)\b[^>]*>/iy,VG=/<\/script>/gi,OG=/<\/style>/gi,y6=/<!DOCTYPE\b/iy,C6=/<html[\s>]/iy;function y$($){let Z=0;while(Z<$.length){if(k$.lastIndex=Z,k$.exec($)){Z=k$.lastIndex;continue}if($.startsWith("<!--",Z)){let Y=$.indexOf("-->",Z);if(Y===-1)return!1;Z=Y+3;continue}E$.lastIndex=Z;let X=E$.exec($);if(X){let Y=X[1].toLowerCase()==="script"?VG:OG;Y.lastIndex=E$.lastIndex;let Q=Y.exec($);if(Q===null)return!1;Z=Q.index+Q[0].length;continue}if(y6.lastIndex=Z,y6.test($))return!0;return C6.lastIndex=Z,C6.test($)}return!1}function C$($){return y$($)}function x6($,Z={}){let J=$.lastIndexOf("</head>");if(J===-1)return $;let{meta:X=[],link:Y=[],script:Q=[],headRaw:G=""}=Z,z=$.slice(0,J),K=[];for(let q of X){let W=a1(q);if(W&&z.includes(W))continue;K.push(` <meta ${r1(q)}>`)}for(let q of Y){if(q.href&&z.includes(`href="${q.href}"`))continue;K.push(` <link ${r1(q)}>`)}for(let q of Q)if(q.src){if(z.includes(`src="${q.src}"`))continue;K.push(` <script ${r1(q,(W)=>W==="content")}></script>`)}else if(q.content){if(z.includes(q.content))continue;K.push(` <script>${q.content}</script>`)}if(G&&!z.includes(G))K.push(` ${G}`);if(K.length===0)return $;return`${$.slice(0,J)}${K.join(`
|
|
3467
|
+
`)}
|
|
3468
|
+
${$.slice(J)}`}function g6($,Z={},J={},X){if(X??C$($))return $;return BG($,Z,J)}var _G=/<\/(script)/gi;function t1($){if(!$||$.indexOf("</")===-1)return $;return $.replace(_G,"<\\/$1")}var k1=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useDocumentVisibility","useIntervalFn","useObjectUrl","useTimeoutFn"];import m6 from"path";W2();W2();function u6($,Z={}){return new h6($,Z).routes}function zV($,Z){let J=S$($,Z);return J?J.params:null}var d6=new Map;async function l6($,Z){let J=$,X=Z;if(!J||!X)try{let z=await T5();J||=z?.pagesDir||"pages",X||=z?.root||"."}catch{J||="pages",X||="."}let Y=m6.isAbsolute(J)?J:m6.join(X,J),Q=d6.get(Y);if(Q)return Q;let G=[];try{G=u6(".",{pagesDir:Y,emit:!1}).map((z)=>z.regex.source).filter(Boolean)}catch{G=[]}return d6.set(Y,G),G}function LG($){return $.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function c6($){return LG(JSON.stringify($))}function p6($){return $.includes("data-stx-runtime")}function i6($){let Z=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let J=Z.exec($);J!==null;J=Z.exec($)){let X=$.slice(Math.max(0,J.index-80),J.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(X))continue;return!0}return!1}function P$($,Z){let J=K2($),X=$.search(/<!doctype\b/i);if(J!==-1&&(X===-1||J>X))return $.slice(0,J)+Z+`
|
|
3469
|
+
`+$.slice(J);let Y=T2($);if(Y!==null)return`${$.slice(0,Y)}
|
|
3470
|
+
${Z}${$.slice(Y)}`;if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+Z+`
|
|
3471
|
+
`+$.slice(G)}if(p0($))return S1($,(G)=>`${G}
|
|
3472
|
+
${Z}`);return`${Z}
|
|
3473
|
+
${$}`}async function y9($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve"){let{getServeClientAsset:Y}=await import("./chunk-szfk6pw6.js"),{url:Q}=await Y("runtime",Z.debug===!0);return P$($,`<script data-stx-runtime src="${Q}"></script>`)}if(Z.buildMode==="compile")return P$($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:J}=await import("./chunk-szfk6pw6.js"),X=await J(Z.debug);return P$($,`<script data-stx-scoped data-stx-runtime>${X}</script>`)}function FG($){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test($)}function n6($){if($.includes("data-stx-tooltip-runtime")||!FG($))return $;let Z=`<script data-stx-scoped data-stx-tooltip-runtime>${z$()}</script>`,J=$.lastIndexOf("</body>");if(J===-1)return`${$}
|
|
3474
|
+
${Z}`;return`${$.slice(0,J)}${Z}
|
|
3475
|
+
${$.slice(J)}`}var wG=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function RG($){return wG.test($)||$.includes("__stxRouter)return")||$.includes("__stxRouter=true")}async function NG($,Z){if(!$.includes("</body>"))return $;if(RG($))return $;let J=Z?.router,X="";{let K={};if(J){if(J.container)K.container=J.container;if(J.interceptAllLinks!==void 0)K.interceptAllLinks=J.interceptAllLinks;if(J.progress!==void 0)K.progress=J.progress;if(J.viewTransitions!==void 0)K.viewTransitions=J.viewTransitions;if(J.viewTransitionDuration!==void 0)K.viewTransitionDuration=J.viewTransitionDuration;if(J.viewTransitionEasing!==void 0)K.viewTransitionEasing=J.viewTransitionEasing;if(J.scrollToTop!==void 0)K.scrollToTop=J.scrollToTop;if(J.prefetch!==void 0)K.prefetch=J.prefetch;if(J.cache!==void 0)K.cache=J.cache;if(J.progressColor!==void 0)K.progressColor=J.progressColor;if(J.progressHeight!==void 0)K.progressHeight=J.progressHeight}try{let q=await l6(Z?.pagesDir,Z?.root);if(q.length>0)K.ownedRoutes=q}catch{}if(Object.keys(K).length>0)X=`<script>window.__stxRouterConfig=${c6(K)};</script>
|
|
3476
|
+
`}let{getCachedRouterScript:Y,getServeClientAsset:Q}=await import("./chunk-szfk6pw6.js"),G=Z?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':Z?.buildMode==="serve"?`<script data-stx-router src="${(await Q("router")).url}"></script>`:`<script data-stx-router>${await Y()}</script>`,z=$.lastIndexOf("</body>");return $.slice(0,z)+X+G+`
|
|
3477
|
+
</body>`+$.slice(z+7)}var o6=Symbol.for("stx.lazy-module-promises");function DG(){let $=globalThis;return $[o6]??=new Map,$[o6]}function s($,Z){let J=DG(),X=`${import.meta.url}\x00${$}`,Y=J.get(X);if(Y)return Y;let Q=Z();return J.set(X,Q),Q.catch(()=>{if(J.get(X)===Q)J.delete(X)}),Q}var v$=`(?:"[^"]*"|'[^']*'|[^>"'])*`,X8=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,MG=65536,AG=4,S9=new Map;function vV(){S9.clear()}function IG($){let Z=[];for(let J of E2($,G2)){let X=J.token.match(/^<script\b([^>]*)>/i),Y=J.token.match(/<\/script\s*>$/i);if(!X||!Y)continue;let Q=X[0].length,G=J.token.length-Y[0].length;Z.push(Object.freeze({fullMatch:J.token,attrs:X[1],body:J.token.slice(Q,G),start:J.start,end:J.end}))}return Z}function TG($,Z={}){let J=$.length>=MG,X=J?S9.get($):void 0;if(X===void 0){if(X=IG($),J)J8(S9,AG),S9.set($,X)}let Y=Z.skipAttrs;if(!Y)return X.slice();let Q=[];for(let G of X)if(Y.lastIndex=0,!Y.test(G.attrs))Q.push(G);return Q}function Y8($){let Z=$.trim(),J=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(J){let Y=J[1].trim(),Q=J[2].trim(),{itemVar:G,indexVar:z}=s6(Q);if(G)return{style:"as",iterable:Y,itemVar:G,indexVar:z}}let X=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(X){let Y=X[1].trim(),Q=X[2].trim(),{itemVar:G,indexVar:z}=s6(Y);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:z}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function s6($){let Z=$.trim(),J=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(J)return{itemVar:J[2],indexVar:J[1]};let X=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(X)return{itemVar:X[1],indexVar:X[2]||null};let Y=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(Y)return{itemVar:Y[1],indexVar:Y[2]};let Q=Z.match(/^(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:null};return{itemVar:null,indexVar:null}}function g$($,Z){return Z8($,Z)}function kG($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,J=0,X;while((X=Z.exec($))!==null){let Y=X[1];if(Y.startsWith("if"))J++;else if(Y==="endif")J--;else if(J===0)return!0}return!1}function EG($){let Z=new Set,J=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,X=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel)\s*(?:<[^>]*>)?\s*\(/g,Y;while((Y=J.exec($))!==null){let Q=Y[1],G;while((G=X.exec(Q))!==null)Z.add(G[1])}return Z}function bG($){if(!/[:@]for\s*=/.test($)&&!/\bx-for\s*=/.test($))return[];let Z=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${v$})>`,"iy"),J=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,X=E2($,(Q,G)=>{Z.lastIndex=G;let z=Z.exec(Q);if(!z||z.index!==G||!J.test(z[2]))return-1;return Z.lastIndex}),Y=[];for(let Q of X){Z.lastIndex=0;let G=Z.exec(Q.token);if(!G)continue;let z=G[2].match(J),K=Y8(z?.[1]??z?.[2]??""),q=[K.itemVar,K.indexVar].filter(Boolean);if(q.length===0)continue;let W=G[1],H=/\/\s*>$/.test(Q.token)||P9.has(W.toLowerCase())?Q.end:G8($,Q.start,W,Q.end);if(H!==-1)Y.push({start:Q.start,end:H,vars:new Set(q)})}return Y}var r6=new Set(["true","false","null","undefined","NaN","Infinity","typeof","instanceof","in","of","new","void","delete","this","Math","JSON","Date","Number","String","Boolean","Array","Object","RegExp","Map","Set","Symbol","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","window","document","console"]);function yG($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function a6($,Z,J,X){if(!$)return!1;let Y=yG($),Q=!1,G=!1,z=!1,K=/([a-zA-Z_$][\w$]*)/g,q;while((q=K.exec(Y))!==null){let j=q[1];if(Y.slice(0,q.index).trimEnd().endsWith("."))continue;if(r6.has(j))continue;if(Z.has(j)||X?.has(j))Q=!0;else if(J&&j in J)G=!0}let W=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,U;while((U=W.exec(Y))!==null){let j=U[1];if(Y.slice(0,U.index).trimEnd().endsWith("."))continue;if(r6.has(j)||J&&j in J)continue;z=!0}return(Q||z)&&!G}function C9($,Z,J){let X=J===void 0?` ${Z}`:` ${Z}="${J.replace(/"/g,""")}"`,Y=$.trim(),Q=Y.match(X8);if(Q&&CG(Q[3],Q[1])){let[,G,z,K]=Q;return`<${G}${z}${X}>${K}</${G}>`}return`<template${X}>${Y}</template>`}function CG($,Z){let J=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),X=0,Y;while((Y=J.exec($))!==null)if(Y[1]){if(X--,X<0)return!1}else X++;return!0}function Q8($,Z){let J=EG($);function X(Y){let Q=Y,G=bG(Y),z=(U)=>{let H=new Set;for(let j of G)if(U>j.start&&U<j.end)for(let B of j.vars)H.add(B);return H},K=/@if\s*\(/g,q,W=[];while((q=K.exec(Q))!==null){let U=q.index,H=U+q[0].length,j=1,B=H;while(B<Q.length&&j>0){if(Q[B]==="(")j++;else if(Q[B]===")")j--;B++}if(j!==0)continue;let V=Q.substring(H,B-1).trim(),L=B,_=1,F=L,O=/@(if\s*\(|endif)/g;O.lastIndex=L;let w;while((w=O.exec(Q))!==null)if(w[1].startsWith("if"))_++;else if(w[1]==="endif"){if(_--,_===0){F=w.index+w[0].length;break}}if(_!==0)continue;let N=Q.substring(L,F-6).trim(),R;if(kG(N)){let M=O2(Q.substring(U,F));if(M.length===0)continue;let T=M[0].branches.filter((A)=>A.type!=="else"),D=z(U);if(!(T.length>0&&T.every((A)=>a6(A.condition,J,Z,D))))continue;R=M[0].branches.map((A)=>{let k=X(A.content);if(A.type==="elseif")return C9(k,"@else-if",A.condition??"");if(A.type==="else")return C9(k,"@else");return C9(k,"@if",A.condition??"")}).join(`
|
|
3478
|
+
`)}else{if(!a6(V,J,Z,z(U)))continue;R=C9(X(N),"@if",V)}W.push({start:U,end:F,replacement:R}),K.lastIndex=F}for(let U=W.length-1;U>=0;U--){let{start:H,end:j,replacement:B}=W[U];Q=Q.substring(0,H)+B+Q.substring(j)}return Q}return X($)}function SG($){let Z=$.trim();if(Z==="")return;if(Z==="true")return!0;if(Z==="false")return!1;if(Z==="null")return!1;if(Z==="undefined")return!1;if(Z==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(Z)){let Y=Number(Z);return Y!==0&&!Number.isNaN(Y)}let J=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(J)return J[1].length>0;let X=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(X)return X[1].length>0;return}var P9=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),t6=/<(script|style)\b/iy,PG=/<\/script/gi,vG=/<\/style/gi;function G8($,Z,J,X){if(P9.has(J.toLowerCase()))return X;let Y=J.toLowerCase(),Q=$.length,G=1,z=X;while(z<Q){let K=$.indexOf("<",z);if(K===-1)return-1;if(z=K,$.startsWith("<!--",z)){let H=$.indexOf("-->",z+4);if(H===-1)return-1;z=H+3;continue}t6.lastIndex=z;let q=t6.exec($);if(q){let H=$.indexOf(">",z);if(H===-1)return-1;if($[H-1]==="/"){z=H+1;continue}let j=q[1].toLowerCase()==="script"?PG:vG;j.lastIndex=z;let B=j.exec($);if(B===null)return-1;let V=$.indexOf(">",B.index);if(V===-1)return-1;z=V+1;continue}if($[z+1]==="/"){let H=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(z,z+64));if(!H){z++;continue}if(H[1].toLowerCase()===Y){if(G--,z+=H[0].length,G===0)return z;continue}z+=H[0].length;continue}let W=/^<([a-z][\w-]*)\b/i.exec($.slice(z,z+64));if(!W){z++;continue}let U=$.indexOf(">",z);if(U===-1)return-1;if(W[1].toLowerCase()===Y){let H=$.slice(z,U+1);if(!(/\/\s*>$/.test(H)||P9.has(Y)))G++}z=U+1}return-1}var fG=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function xG($,Z){let J=Z,X=$.length;for(;;){while(J<X&&$[J]!=="<")J++;if(J>=X)return!1;if($.startsWith("<!--",J)){let G=$.indexOf("-->",J+4);if(G===-1)return!1;J=G+3;continue}break}if($[J+1]==="/")return!1;let Y=$.indexOf(">",J);if(Y===-1)return!1;let Q=$.slice(J,Y+1);return fG.test(Q)}function z8($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],J=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,X;while((X=J.exec($))!==null)Z.push([X.index,X.index+X[0].length]);let Y=(U)=>Z.some(([H,j])=>U>=H&&U<j),Q=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,G=[],z;while((z=Q.exec($))!==null){if(Y(z.index))continue;let[U,H,j,B,V,L,_]=z,F=SG(V);if(F===void 0)continue;let O=z.index,w=O+U.length,M=!!_||/\/\s*>$/.test(U)||P9.has(H.toLowerCase())?w:G8($,O,H,w);if(M===-1)continue;if((B===":if"||B==="x-if"||B==="@if")&&xG($,M)){Q.lastIndex=w;continue}if(F===!0){let D=`<${H}${j}${L}${_}>`;G.push({start:O,end:w,replacement:D});continue}G.push({start:O,end:M,replacement:""}),Q.lastIndex=M}if(G.length===0)return $;G.sort((U,H)=>U.start-H.start);let K=[],q=-1;for(let U of G){if(U.start<q)continue;K.push(U),q=U.end}let W=$;for(let U=K.length-1;U>=0;U--){let{start:H,end:j,replacement:B}=K[U];W=W.substring(0,H)+B+W.substring(j)}return W}function h$($,Z){let J=$,X=/@(for|foreach)\s*\(/g,Y,Q=[],G=[];while((Y=X.exec(J))!==null){let z=Y[1],K=Y.index,q=K+Y[0].length,W=1,U=q;while(U<J.length&&W>0){if(J[U]==="(")W++;else if(J[U]===")")W--;U++}if(W!==0)continue;let H=J.substring(q,U-1).trim(),j=U,B=Y8(H),V=z==="for"?"@endfor":"@endforeach",L=1,_=j,F=z==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${z}\\s*\\(|end${z})`,"g");F.lastIndex=j;let O;while((O=F.exec(J))!==null)if(O[1].startsWith(z))L++;else if(L--,L===0){_=O.index+O[0].length;break}if(L!==0)continue;let w=()=>{let I=[B.itemVar,B.indexVar].filter(Boolean);if(I.length)G.push({start:K,end:_,vars:I})};if(B.iterable){let I=B.iterable.trim();if(I.startsWith("[")||I.startsWith("{")||I.startsWith("'")||I.startsWith('"')||I.startsWith("`")||/^-?\d/.test(I)){w();continue}let E=I.split(/[.[(]/)[0].trim(),A=Z?E in Z:!1,k=G.some((C)=>K>C.start&&K<C.end&&C.vars.includes(E));if(E&&(A||k)){w();continue}}if(B.style==="as")H=B.indexVar?`(${B.itemVar}, ${B.indexVar}) in ${B.iterable}`:`${B.itemVar} in ${B.iterable}`;let N=J.substring(j,_-V.length).trim(),R=Z?{...Z}:{};if(B.itemVar)delete R[B.itemVar];if(B.indexVar)delete R[B.indexVar];let M=h$(N,R),T=M.match(X8),D;if(T){let[,I,E,A]=T;D=`<${I}${E} @for="${H}">${A}</${I}>`}else D=`<template @for="${H}">${M}</template>`;Q.push({start:K,end:_,replacement:D}),X.lastIndex=_}for(let z=Q.length-1;z>=0;z--){let{start:K,end:q,replacement:W}=Q[z];J=J.substring(0,K)+W+J.substring(q)}return J}function gG($){let Z=new Set,J=[],X=0,Y=0,Q=$.length,G=(W)=>{let U=X+1;while(U<Q){let H=$[U];if(H==="\\"){U+=2;continue}if(H===W)return U+1;U++}return Q},z=()=>{let W=X+2;while(W<Q&&$[W]!==`
|
|
3479
|
+
`)W++;return W},K=()=>{let W=X+2;while(W<Q-1){if($[W]==="*"&&$[W+1]==="/")return W+2;W++}return Q},q=(W)=>{let U=W,H=0;while(U<Q){let j=$[U];if(j==="/"&&$[U+1]==="/"){let B=U+2;while(B<Q&&$[B]!==`
|
|
3480
|
+
`)B++;U=B;continue}if(j==="/"&&$[U+1]==="*"){let B=U+2;while(B<Q-1&&!($[B]==="*"&&$[B+1]==="/"))B++;U=B+2;continue}if(j==='"'||j==="'"||j==="`"){let B=U+1;while(B<Q){if($[B]==="\\"){B+=2;continue}if($[B]===j){B++;break}B++}U=B;continue}if(j==="("||j==="["||j==="{"){H++,U++;continue}if(j===")"||j==="]"||j==="}"){H--,U++;continue}if(j===";"&&H===0)return U+1;U++}return Q};while(X<Q){let W=$[X];if(W==="/"&&$[X+1]==="/"){let U=z();J.push($.slice(X,U)),X=U;continue}if(W==="/"&&$[X+1]==="*"){let U=K();J.push($.slice(X,U)),X=U;continue}if(W==='"'||W==="'"||W==="`"){let U=G(W);J.push($.slice(X,U)),X=U;continue}if(W==="{"){Y++,J.push(W),X++;continue}if(W==="}"){Y--,J.push(W),X++;continue}if(Y===0){let U=X>0?$[X-1]:"";if(U===""||/\s/.test(U)||U===";"||U==="}"||U==="{"){let j=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(j){let B=j[2],V=q(X+j[0].length);if(Z.has(B)){J.push(`/* stx: deduped const ${B} */`),X=V;continue}Z.add(B),J.push($.slice(X,V)),X=V;continue}}}J.push(W),X++}return J.join("")}var hG=new Set(["script","style","html","head","meta","link","title","!doctype"]);function f$($,Z,J){for(let X of J){if(X.start>=Z)return!1;if(X.end>$)return!0}return!1}function uG($,Z,J){let X=0;while(X<$.length){let Y=$.indexOf(Z,X);if(Y===-1)return!1;if(!f$(Y,Y+Z.length,J))return!0;X=Y+Z.length}return!1}function mG($,Z){if(uG($,"<body",Z)){let Y=new RegExp(`<body(${v$})>`,"g"),Q;while((Q=Y.exec($))!==null)if(!f$(Q.index,Q.index+Q[0].length,Z))return Q.index+Q[0].length-1;return null}let J=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${v$})>`,"gi"),X;while((X=J.exec($))!==null){if(f$(X.index,X.index+X[0].length,Z))continue;if(hG.has(X[1].toLowerCase()))continue;return X.index+X[0].length-1}return null}function dG($,Z,J,X){let Y=[],Q=` data-stx="${X}"`,G=0,z=!1,K=(q)=>{if(J!==null&&!z&&J>=G&&J<=q)Y.push($.slice(G,J),Q,$.slice(J,q)),z=!0;else Y.push($.slice(G,q))};for(let q of Z){if(q.start<G)continue;K(q.start),G=q.end}return K($.length),Y.join("")}async function lG($,Z,J){let X=TG($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Y=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useModel|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,Q=[],{hasUserImports:G,bundleClientScript:z}=await s("stx/client-script-bundler",()=>import("./chunk-f08ttkqr.js"));for(let F of X){let O=F.body;if(M1(F.attrs))O=A1(O);if(Y.test(O)){Q.push({content:O,start:F.start,end:F.end});continue}if(!G(O))continue;try{let w=await z(e1(O).code,Z||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(Y.test(w))Q.push({content:O,start:F.start,end:F.end})}catch{}}if(Q.length===0)return{output:$,setupCode:null};let K=`${Z??""}\x00${Q.map((F)=>F.content).join("\x00")}`,q=`__stx_setup_${Bun.hash(K).toString(36).slice(0,10)}`,W=[];for(let F=0;F<Q.length;F++){let O=Q[F].bundled??e1(Q[F].content).code;if(!Q[F].bundled&&G(O))O=await z(O,Z||"",{projectRoot:process.cwd()});O=nG(O);let w=t0(O);W.push(`// \u2500\u2500 merged signal script #${F+1} \u2500\u2500
|
|
3481
|
+
${w}`)}let U=W.join(`
|
|
3482
|
+
|
|
3483
|
+
`);U=gG(U);let H=cG(U),j=H.split(",").map((F)=>F.trim()).filter(Boolean),B=x$(U,J),V=`
|
|
3484
|
+
<script data-stx-scoped>
|
|
3485
|
+
function ${q}() {
|
|
3486
|
+
${n1("const",j)}
|
|
3487
|
+
${t1(`${B}${U}`)}
|
|
3488
|
+
return { ${H} };
|
|
3489
|
+
}
|
|
3490
|
+
window.__stx_latestSetup=${q};
|
|
3491
|
+
if(window.stx)window.stx._latestSetup=${q};
|
|
3492
|
+
</script>`,L=mG($,Q);return{output:dG($,Q,L,q),setupCode:V}}function cG($){let Z=$,J=[],X=new Set,Y=0,Q=0,G=Z.length,z="",K=()=>{Q++;let B=!1;while(Q<G){let V=Z[Q];if(V==="\\"){Q+=2;continue}if(V==="["&&!B){B=!0,Q++;continue}if(V==="]"&&B){B=!1,Q++;continue}if(V==="/"&&!B){Q++;while(Q<G&&/[gimsuyd]/.test(Z[Q]))Q++;return}if(V===`
|
|
3493
|
+
`)return;Q++}},q=()=>{if(!z)return!0;if(/[\w)\]]/.test(z))return!1;return!0},W=(B)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===B){Q++;return}Q++}},U=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let B=1;while(Q<G&&B>0)if(Z[Q]==="{")B++,Q++;else if(Z[Q]==="}")B--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')W(Z[Q]);else if(Z[Q]==="`")U();else Q++;continue}Q++}},H=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
|
|
3494
|
+
`)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},j=()=>{if(Y!==0)return;let B=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(B){let O=B[2];if(!X.has(O))J.push(O),X.add(O);return}let V=Z.slice(Q).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(V){V[1].split(",").forEach((O)=>{let w=O.trim();if(!w)return;let N=w.indexOf(":"),M=(N>=0?w.slice(N+1).trim():w).split(/[\s=]/)[0];if(M&&!X.has(M))J.push(M),X.add(M)});return}let L=Z.slice(Q).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(L){L[1].split(",").forEach((O)=>{let w=O.trim().replace(/^\.\.\./,"");if(!w)return;let N=w.split(/[\s=]/)[0];if(N&&!X.has(N))J.push(N),X.add(N)});return}let _=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let O=_[1];if(!X.has(O))J.push(O),X.add(O);return}let F=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let O=F[1];if(!X.has(O))J.push(O),X.add(O)}};while(Q<G){if(H())continue;if(Z[Q]==="'"||Z[Q]==='"'){W(Z[Q]),z=Z[Q-1];continue}if(Z[Q]==="`"){U(),z="`";continue}if(Z[Q]==="/"&&Z[Q+1]!=="/"&&Z[Q+1]!=="*"&&q()){K(),z="/";continue}if(Z[Q]==="{"){Y++,z="{",Q++;continue}if(Z[Q]==="}"){Y--,z="}",Q++;continue}if(Y===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))j();if(!/\s/.test(Z[Q]))z=Z[Q];Q++}return J.join(", ")}async function K8($,Z,J,X){if(!g$($,J))return $;let Y=$;if(Z.skipSignalsRuntime)return Y;let{output:Q,setupCode:G}=await lG(Y,J,X);if(Y=Q,!G){let z=p0(Y);if(z&&!/data-stx/.test(z.attrs)&&!/data-stx-auto/.test(z.attrs)){let K=z.tag.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>");Y=Y.slice(0,z.index)+K+Y.slice(z.index+z.tag.length)}}if(Y=await y9(Y,Z),G){let z=e6(Y,/<\/head>/i),K=z===-1?e6(Y,/<body[^>]*>/i):-1;if(z!==-1)Y=`${Y.slice(0,z)}${G}
|
|
3495
|
+
${Y.slice(z)}`;else if(K!==-1){let q=/<body[^>]*>/i.exec(Y.slice(K))[0],W=K+q.length;Y=`${Y.slice(0,W)}
|
|
3496
|
+
${G}${Y.slice(W)}`}else Y=`${Y}
|
|
3497
|
+
${G}`}return Y}function e6($,Z){let J=/<(script|style)\b[\s\S]*?<\/\1>/gi,X=[],Y;while((Y=J.exec($))!==null)X.push([Y.index,Y.index+Y[0].length]);let Q=new RegExp(Z.source,Z.flags.replace(/[gy]/g,"")),G=0;while(G<$.length){let z=Q.exec($.slice(G));if(!z)return-1;let K=G+z.index;if(!X.some(([W,U])=>K>=W&&K<U))return K;G=K+Math.max(z[0].length,1)}return-1}var $8="/* [stx import stripped, resolved via window.stx in __stx_setup] */";function pG($){let Z=[];for(let J of $.split(",")){let X=J.trim();if(!X||X.startsWith("type "))continue;let Y=X.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Y&&Y[1]!==Y[2])Z.push(`${Y[2]} = ${Y[1]}`)}if(Z.length===0)return $8;return`var ${Z.join(", ")}; ${$8}`}var iG=/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm;function nG($){return $.replace(iG,(Z,J)=>pG(J))}import Z2 from"path";import q8 from"process";function $2($="STX_PUBLIC_"){let Z={},J={};for(let[X,Y]of Object.entries(q8.env)){if(!X.startsWith($)||Y===void 0)continue;Z[`import.meta.env.${X}`]=JSON.stringify(Y),J[X]=Y}return Z["import.meta.env"]=JSON.stringify(J),Z}function gV($="STX_PUBLIC_"){let Z={};for(let[J,X]of Object.entries(q8.env))if(J.startsWith($)&&X!==void 0)Z[J]=X;return Z}function W8($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function U8($,Z,J){try{let X;if($.startsWith("/")){let Y=Z;for(let Q=0;Q<5;Q++){let G=Z2.join(Y,$);if(await Bun.file(G).exists())return G;Y=Z2.dirname(Y)}X=Z2.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))X=Z2.resolve(Z,$);else X=Z2.resolve(Z,$);if(await Bun.file(X).exists())return X;return null}catch{return null}}var H8=Symbol.for("stx.inline-assets.import-meta");function oG($,Z){if(!$.includes("import.meta"))return;let J=Error(`[stx] ${Z} 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.
|
|
3498
|
+
`+" `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 J[H8]=!0,J}async function j8($,Z,J){let X=$,Y=Z2.dirname(Z),Q=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Q.exec(X))!==null){let[q,W,U,H]=G;if(W8(U))continue;let j=await U8(U,Y,Z);if(j)try{let B=await Bun.file(j).text();if(J.add(j),U.endsWith(".ts")||U.endsWith(".tsx")){let L=await Bun.build({entrypoints:[j],target:"browser",minify:!0,define:$2()});if(L.outputs.length>0)B=await L.outputs[0].text(),oG(B,U)}let V=`<script>
|
|
3499
|
+
// Source: ${U}
|
|
3500
|
+
${B}
|
|
3501
|
+
</script>`;X=X.replace(q,V),Q.lastIndex=0}catch(B){if(B?.[H8])throw B}}let z=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,K;while((K=z.exec(X))!==null){let[q,W,U,H]=K,j=W+H;if(W8(U))continue;if(/rel=["']stylesheet["']/.test(j)||U.endsWith(".css")){let V=await U8(U,Y,Z);if(V)try{let L=await Bun.file(V).text();J.add(V);let _=`<style>
|
|
3502
|
+
/* Source: ${U} */
|
|
3503
|
+
${L}
|
|
3504
|
+
</style>`;X=X.replace(q,_),z.lastIndex=0}catch(L){}}}return X}function u$($,Z){let J=$,X=/@json\s*\(/g,Y;while((Y=X.exec(J))!==null){let Q=Y.index,G=Q+Y[0].length-1,z=1,K=G+1,q=null,W=!1;while(K<J.length&&z>0){let O=J[K];if(W){W=!1,K++;continue}if(O==="\\"&&q){W=!0,K++;continue}if(q){if(O===q)q=null;K++;continue}if(O==='"'||O==="'"||O==="`"){q=O,K++;continue}if(O==="(")z++;else if(O===")"){if(z--,z===0)break}K++}if(z!==0)break;let U=J.substring(G+1,K).trim(),H=J.substring(Q,K+1),j=-1,B=0,V=null,L=!1;for(let O=0;O<U.length;O++){let w=U[O];if(L){L=!1;continue}if(w==="\\"&&V){L=!0;continue}if(V){if(w===V)V=null;continue}if(w==='"'||w==="'"||w==="`"){V=w;continue}if(w==="("||w==="["||w==="{")B++;else if(w===")"||w==="]"||w==="}")B--;if(w===","&&B===0){j=O;break}}let _=j>=0?U.substring(0,j).trim():U,F=j>=0?U.substring(j+1).trim():void 0;try{let O=_.trim(),w;if(H0(O))w=q0(O,Object.keys(Z))(...Object.values(Z));else w=void 0;let N;if(F==="true")N=JSON.stringify(w,null,2);else N=JSON.stringify(w);let R=N.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");J=J.substring(0,Q)+R+J.substring(K+1),X.lastIndex=Q+R.length}catch(O){n0.log(O instanceof Error?O:Error(String(O)),{directive:"@json"},"error"),X.lastIndex=Q+H.length}}return J}function m$($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function O8($){let Z=$,J=/@memo\s*\(/g,X,Y=[];while((X=J.exec(Z))!==null){let Q=X.index,G=Q+X[0].length,z=1,K=G;while(K<Z.length&&z>0){if(Z[K]==="(")z++;else if(Z[K]===")")z--;K++}if(z!==0)continue;let q=Z.slice(G,K-1).trim(),W=K,U=Z.slice(W),H=U.indexOf("@endmemo");if(H===-1)continue;let j=U.slice(0,H),B=W+H+8,V=j.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),L=V?V[0].length:0,_=j.slice(L),F=j.match(/(\s*)$/),O=F?F[0].length:0,w=_.slice(0,_.length-O),N=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),R;if(N){let[M,T,D="",I]=N,E=`<${T}${D} data-stx-memo="${q}"${I}>`;R=j.slice(0,L)+E+w.slice(M.length)+j.slice(L+w.length)}else R=`${j.slice(0,L)}<div data-stx-memo="${q}">${w}</div>${j.slice(L+w.length)}`;Y.push({start:Q,end:B,replacement:R}),J.lastIndex=B}for(let Q=Y.length-1;Q>=0;Q--){let G=Y[Q];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function d$($){let Z=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return Z=Z.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),Z}function _8($,Z){if(!/\bref\s*=/.test($))return $;let J=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,X=E2($,(K,q)=>{J.lastIndex=q;let W=J.exec(K);if(!W||/^(?:script|style)$/i.test(W[1]))return-1;return J.lastIndex}),Y=[],Q=0,G=0,z=[];for(let{start:K,end:q,token:W}of X){let U=/^<\/?([\w-]+)/.exec(W)[1].toLowerCase();if(W.startsWith("</")){let j;while(j=Y.pop()){if(j.scoped)Q--;if(j.name===U)break}continue}let H=/\sdata-stx-scope\s*=/.test(W);if(!Q&&!H&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(W)&&!/\sdata-stx-ref-caller\s*=/.test(W))z.push($.slice(G,K),W.replace(/\s*\/?>$/,(j)=>` data-stx-ref-caller="${Z}"${j}`)),G=q;if(!L8.has(U)&&!/\/>$/.test(W)){if(Y.push({name:U,scoped:H}),H)Q++}}return z.push($.slice(G)),z.join("")}var L8=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),F8=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,B8=/<\/?\s*([a-z][\w-]*)/iy,sG=/\s/;function rG($,Z){let J=Z-1;while(J>=0&&sG.test($[J]))J--;return J>=0&&$[J]==="/"}function aG($,Z){let J=!1,X=!1;for(let Y=Z;Y<$.length;Y++){let Q=$[Y];if(J){if(Q==="'")J=!1}else if(X){if(Q==='"')X=!1}else if(Q==="'")J=!0;else if(Q==='"')X=!0;else if(Q===">")return Y}return-1}function tG($,Z){if($.indexOf("{",Z)===-1||$.indexOf("}",Z)===-1)return!1;let J=0,X=Z,Y=!1,Q=!1,G=!1;while(X<$.length){let z=$.indexOf("<",X),K=z===-1?$.length:z;if(K>X){if(J===0)while(X<K){let U=$.indexOf(Q?"}":"{",X);if(U===-1||U>=K){if(Q)G=!1;else Y=!1;break}if(U>X)if(Q)G=!1;else Y=!1;if(Q){if(G)return!0;G=!0}else if(Y)Q=!0,G=!1;else Y=!0;X=U+1}X=K;continue}if($.startsWith("<!--",X)){let U=$.indexOf("-->",X);X=U===-1?$.length:U+3;continue}let q=aG($,X);if(q===-1)break;B8.lastIndex=X;let W=B8.exec($)?.[1]?.toLowerCase()??"";if($[X+1]==="/"){if(J===0)break;J--}else if(!rG($,q)&&!L8.has(W))J++;X=q+1}return!1}function w8($){if($.length>=32768&&!V8($))return $;let J=new RegExp(`<(${"div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i"})\\b`,"gi"),X="",Y=0,Q;while((Q=J.exec($))!==null){let G=Q.index,z=G+Q[0].length,K=!1,q=!1,W=-1;while(z<$.length){let H=$[z];if(K){if(H==="'")K=!1}else if(q){if(H==='"')q=!1}else if(H==="'")K=!0;else if(H==='"')q=!0;else if(H===">"){W=z;break}z++}if(W===-1)continue;let U=$.slice(G,W+1);if(F8.test(U))continue;if(U.includes("x-cloak"))continue;if(tG($,W+1))X+=$.slice(Y,W)+" x-cloak>",Y=W+1}return X+=$.slice(Y),X}var eG=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,$z=/<\/script>/gi,Zz=/<\/style>/gi;function R8($){let Z=/<[a-z][\w-]*/gi,J="",X=0,Y;while((Y=Z.exec($))!==null){let Q=Y.index,G=Y[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let B=G==="script"?$z:Zz;B.lastIndex=Q;let V=B.exec($);if(V!==null)Z.lastIndex=V.index+V[0].length;continue}let z=Q+Y[0].length,K=!1,q=!1,W=-1;while(z<$.length){let B=$[z];if(K){if(B==="'")K=!1}else if(q){if(B==='"')q=!1}else if(B==="'")K=!0;else if(B==='"')q=!0;else if(B===">"){W=z;break}z++}if(W===-1)continue;let U=$.slice(Q+Y[0].length,W);if(F8.test(U))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(U))continue;if(!eG.test(U))continue;let H=$[W-1]==="/",j=H?W-1:W;J+=`${$.slice(X,j)} x-cloak${H?" ":""}`,X=j}return J+=$.slice(X),J}var l$=E1(256),Jz=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/(?:\bwindow\.)?localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables \u2014 or @appearanceBootstrap if this must run before first paint, where the runtime does not exist yet"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}];function c$($,Z,J,X){let Y=typeof J==="boolean"?{enabled:J,failOnViolation:J}:J??{enabled:!1};if(!Y.enabled)return;let Q=W1($,Z,X,JSON.stringify(Y)),G=l$.get(Q);if(G!==void 0){if(G&&Y.failOnViolation)throw Error(G);return}let z=Y.allowPatterns??[],K=[],q=W0($.replace(/\{\{--[\s\S]*?--\}\}/g,(j)=>j.replace(/[^\n]/g," ")));for(let{pattern:j,message:B,suggestion:V}of Jz){if(z.some((_)=>/\w/.test(_)&&B.includes(_)))continue;j.lastIndex=0;let L=q.match(j);if(L&&L.length>0){let _=q.split(`
|
|
3505
|
+
`),F=$.split(`
|
|
3506
|
+
`),O=[];_.forEach((M,T)=>{if(j.lastIndex=0,j.test(M))O.push(T+1)});let w=O.length>0?` (script line${O.length>1?"s":""} ${O.join(", ")})`:"",N=O.slice(0,3).map((M)=>` ${M} | ${(F[M-1]??"").trim().slice(0,100)}`).join(`
|
|
3507
|
+
`),R=N?`
|
|
3508
|
+
${N}`:"";K.push(` \u2717 ${B}${w}
|
|
3509
|
+
\u2192 ${V}${R}`)}}if(K.length===0){l$.set(Q,"");return}let W=(j)=>{let B=`${process.cwd()}/`;return j.startsWith(B)?j.slice(B.length):j},H=`[STX] DOM API violation in ${X&&X!==Z?`${W(X)} (composed into ${W(Z)})`:W(Z)}:
|
|
3510
|
+
${K.join(`
|
|
3511
|
+
`)}
|
|
3512
|
+
Tip: prefer useRef(), navigate(), and composables for component code`;if(l$.set(Q,H),Y.failOnViolation)throw Error(H);else console.warn(H)}Gz();import p$ from"path";var Xz=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,Yz=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function Qz($,Z){if(!Z||!$.includes("/"))return $;let J=p$.dirname(Z);return $.replace(Xz,(X,Y,Q,G)=>{let z=p$.resolve(J,G);return`${Y}${Q}${z.split(p$.sep).join("/")}${Q}`})}function N8($,Z){if(!Z||!$.includes("<script"))return $;return $.replace(Yz,(J,X,Y,Q)=>`${X}${Qz(Y,Z)}${Q}`)}var b1="<!--PARENT_CONTENT_PLACEHOLDER-->";function D8($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Kz($,Z){let J=$.length,X=Z,Y=!0,Q=[],G=(z)=>z+9<=J&&$[z]==="<"&&$[z+1]==="/"&&($[z+2]==="s"||$[z+2]==="S")&&($[z+3]==="c"||$[z+3]==="C")&&($[z+4]==="r"||$[z+4]==="R")&&($[z+5]==="i"||$[z+5]==="I")&&($[z+6]==="p"||$[z+6]==="P")&&($[z+7]==="t"||$[z+7]==="T")&&($[z+8]===">"||/\s/.test($[z+8]));while(X<J){let z=$[X];if(G(X))return X;if(z==="/"&&$[X+1]==="/"){if(X=$.indexOf(`
|
|
3513
|
+
`,X+2),X===-1)return-1;X+=1,Y=!0;continue}if(z==="/"&&$[X+1]==="*"){let K=$.indexOf("*/",X+2);if(K===-1)return-1;X=K+2,Y=!0;continue}if(z==="/"&&Y){let K=X+1,q=!1;while(K<J){let W=$[K];if(W==="\\"){K+=2;continue}if(W==="[")q=!0;else if(W==="]")q=!1;else if(W==="/"&&!q){K++;break}else if(W===`
|
|
3514
|
+
`){K=-1;break}K++}if(K===-1){X++,Y=!1;continue}while(K<J&&/[a-z]/.test($[K]))K++;X=K,Y=!1;continue}if(z==="'"||z==='"'){let K=z;X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]===K){X++;break}if($[X]===`
|
|
3515
|
+
`)break;X++}Y=!1;continue}if(z==="`"){X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;break}if($[X]==="$"&&$[X+1]==="{"){Q.push(!0),X+=2,Y=!0;break}X++}if(Q.length===0)Y=!1;continue}if(z==="}"&&Q.length>0){Q.pop(),X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++,Y=!1;break}if($[X]==="$"&&$[X+1]==="{"){Q.push(!0),X+=2,Y=!0;break}X++}continue}if(/\s/.test(z));else if(/[)\].\w$]/.test(z))Y=!1;else Y=!0;X++}return-1}function d8($,Z){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=new RegExp(`<script\\b(?=[^>]*\\b${J}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!X)return null;let Y=X.index+X[0].length,Q=$.indexOf("</script>",Y);if(Q===-1)return null;let G=$.indexOf(">",Q);if(G===-1)return null;return{start:X.index,end:G+1}}async function M8($,Z){try{let{registeredModuleIdsIn:J,buildModuleRegistryScript:X}=await s("stx/client-module-registry",()=>import("./chunk-8cg15rr7.js")),Y=await X(J(...$),{minify:Z.buildMode==="compile"});if(!Y)return null;return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${Y.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function qz($,Z=""){let J=d8($,"data-stx-runtime");if(!J)return $;let X=K2($);if(X===-1||X===J.start){if(!Z)return $;return $.slice(0,J.end)+Z+$.slice(J.end)}if(X<J.start)return $.slice(0,X)+$.slice(J.start,J.end)+Z+`
|
|
3516
|
+
`+$.slice(X,J.start)+$.slice(J.end);let Y=$.slice(J.start,J.end),Q=$.slice(0,J.start)+$.slice(J.end),G=K2(Q);if(G===-1)return Y+Z+`
|
|
3517
|
+
`+Q;return Q.slice(0,G)+Y+Z+`
|
|
3518
|
+
`+Q.slice(G)}async function n$($,Z,J,X,Y){if(X.ssr===!1&&!X.autoShell&&X.buildMode==="spa")return $;if(Z.__stx_signals_gate===void 0)Z.__stx_signals_gate=J1($,J);let Q=!Z.__stxProcessingDepth;T$(Z);for(let G of X._layerGraph?.configDependencies??[])Y.add(G);if(Q&&X.runtimeConfig)await g9(Z,J,X.runtimeConfig);if(Q)V3(Z),Z.__stx_head_injections=N$(),Z.__stx_seo_staged=!1;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((X.debug||!N9()&&!D9())&&J&&J.endsWith(".stx"))x8($,J);try{return await S8.timeAsync("template-processing",async()=>{let G=await Wz($,Z,J,X,Y);if(Q)G=d$(G);if(Q&&X.autoShell&&X.buildMode!=="compile"){let z=X.app?.head||{},q=(Z.__stx_runtime_head||null)??f8(),W=(Z.__stx_head_raw||"").trim(),U,H=W.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(H)U=H[1].trim(),W=W.replace(H[0],"").trim();let j=Z.__sections?.title,B=q.title||U||j,V=!q.title&&(!!U||!!j),L=q.meta||[],_=new Set(L.map((M)=>a1(M)).filter(Boolean)),F={...z,...B&&{title:B},meta:[...(z.meta||[]).filter((M)=>!_.has(a1(M))),...L],link:[...z.link||[],...q.link||[]],script:[...z.script||[],...q.script||[]],headRaw:[z.headRaw,W].filter(Boolean).join(`
|
|
3519
|
+
`),...q.htmlAttrs&&{htmlAttrs:v6(z.htmlAttrs,q.htmlAttrs)},...q.bodyAttrs&&{bodyAttrs:{...z.bodyAttrs||{},...q.bodyAttrs}}},O=C$(G);if(G=g6(G,F,{...V&&{titleIsHtml:!0},...X.app?.colorMode&&{colorMode:X.app.colorMode}},O),O)G=x6(G,z),G=f6(G,F.htmlAttrs);let w=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(w&&G.includes("<head")){let M=w[1],T=y8(M);G=G.replace(/<head\b[^>]*>/i,(D)=>`${D}
|
|
3520
|
+
<meta name="stx-layout" content="${D8(M)}">
|
|
3521
|
+
<meta name="stx-layout-group" content="${D8(T)}">`)}let N=G.match(/function (__stx_setup_\w+)\(/),R=N?p0(G):null;if(N&&R&&!/\bdata-stx=/.test(R.tag)){G=S1(G,(T,D)=>`<body${D} data-stx="${N[1]}">`);let M=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${N[1]}"`,"i");G=G.replace(M,"$1")}}if(Q){let z=Z.__stx_head_injections??N$(),K=b$(G);if(K!==null)z.beforeClose.push(K);let q=I$(G);if(q!==null)z.afterOpen.push(q);G=R6(G,z);let W=X.app?.colorMode;if(W)G=M6(G,W)}if(Q)if(d8(G,"data-stx-runtime")){let K=null,q=null,W=null,U=null;try{let{getStoreScript:j}=await s("stx/store-loader",()=>import("./chunk-1wsewc5h.js")),B=X.storesDir,V=await j(B);if(V)q=`<script data-stx-stores>${V}</script>`}catch{}K=await M8([G,q],X);try{let{getFrameworkComposableScript:j}=await s("stx/framework-composables",()=>import("./chunk-gtfcw1gc.js"));U=await j(G)}catch{}try{let{getComposableScript:j}=await s("stx/composable-loader",()=>import("./chunk-kawdj1j7.js")),B=X.composablesDir,V=[K,q,U].filter((_)=>_!==null),L=await j(X._layerComposableDirs??B,G,V);if(L)W=`<script data-stx-scoped data-stx-run="always" data-stx-composables>${L}</script>`}catch{}let H=[K,q,W,U].filter((j)=>j!==null).map((j)=>`
|
|
3522
|
+
${j}`).join("");G=qz(G,H)}else{let K=await M8([G],X);if(K){let q=G.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(q!==-1)G=G.slice(0,q)+K+`
|
|
3523
|
+
`+G.slice(q)}}if(Q)G=A6(G);if(Q&&Z.__stx_inject_css!==!1)G=await v8(G,void 0,X.buildMode==="serve",!0);else if(Q)G=P8(G);if(G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),Q&&Z.__stx_runtime_config)G=C8(G,Z.__stx_runtime_config);if(Q&&!Z.__stx_defer_server_data){let z=b6(Z);if(z){let K=/<head\b[^>]*>/i.exec(G),q=K?K.index+K[0].length:0;G=G.slice(0,q)+z+G.slice(q)}}return G})}catch(G){if(G instanceof I8)throw G;let z=G instanceof Error?G.message:String(G),K=new b2(`Template processing failed: ${z}`,J,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(n0.log(K,{filePath:J,context:Z}),k8.logDetailedError(K,{filePath:J,template:$.substring(0,500)}),X.debug)throw K;return T8.createFallbackContent("Template Processing",K)}}async function Wz($,Z,J,X,Y){let Q=process.cwd(),G={...X,partialsDir:X.partialsDir&&!b0.isAbsolute(X.partialsDir)?b0.resolve(Q,X.partialsDir):X.partialsDir,componentsDir:X.componentsDir&&!b0.isAbsolute(X.componentsDir)?b0.resolve(Q,X.componentsDir):X.componentsDir,layoutsDir:X.layoutsDir&&!b0.isAbsolute(X.layoutsDir)?b0.resolve(Q,X.layoutsDir):X.layoutsDir},z=G,K=$;await jz(J,Z),Hz(Z,z),K=await y2(()=>W6(K,Z,J,z),K,(O)=>{n0.log(O,{filePath:J,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${J}: ${O.message}`)}),K=K.replace(/\{\{--[\s\S]*?--\}\}/g,"");let q=j1(K,R9,(O,w)=>`\x00STX_HTML_COMMENT_${w}\x00`);K=q.output;let W=q.tokens,U=(O)=>W.length===0?O:O.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(w,N)=>W[Number(N)]??""),H="\x00STX_ESCAPED_AT\x00";K=K.replace(/@@/g,H),K=K.replace(/@\{\{([\s\S]*?)\}\}/g,(O,w)=>{return`{{ ${w} }}`}),K=V6(K),K=await j8(K,J,Y);let j={};K=O$(K,j);let B={...Z.__sections||{}},V="",L=o3(n3($)),_=/@nolayout\b/.test(K)||L===!1;if(/@nolayout\b/.test(K))K=K.replace(/@nolayout\b\s*/g,"");let F=K.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F)V=F[1],K=K.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof L==="string"){if(V=L,!/@section\s*\(/.test(K))K=`@section('content')
|
|
3524
|
+
${K.trim()}
|
|
3525
|
+
@endsection`}if(!V&&!_&&z.defaultLayout){let O=y$(K),w=/@section\s*\(/.test(K);if(!O||w){let N="",R=b0.dirname(J),M=z.layoutsDir?b0.dirname(z.layoutsDir):process.cwd();for(let T=0;T<20;T++){let D=b0.join(R,"_layout.stx");if(await e(D)){N=D;break}let I=b0.dirname(R);if(I===R||I.length<M.length)break;R=I}if(N)V=N;else if(z.layoutsDir){let T=b0.isAbsolute(z.layoutsDir)?z.layoutsDir:b0.resolve(process.cwd(),z.layoutsDir),D=b0.join(T,`${z.defaultLayout}.stx`);if(await e(D))V=D}if(V&&!w)K=`@section('content')
|
|
3526
|
+
${K.trim()}
|
|
3527
|
+
@endsection`}}if(K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,w,N)=>{return B[w]=N,""}),K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(O,w,N)=>{if(/^(['"]).*\1$/.test(N.trim()))return O;try{let R=Q0(N.trim(),Z);if(R===void 0)return O;return B[w]=String(R??""),""}catch{return O}}),K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,w,N)=>{if(N.includes("@parent"))B[w]=N.replace("@parent",b1);else B[w]=N.trim();return""}),Z.__sections=B,K=K.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,w,N)=>{return B[w]||N||""}),!("slot"in Z)||Z.slot===void 0)K=K.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""});if(K=_$(K,j),V){let O=[],w=c0(K),N=j1(w.output,i2,(R,M)=>`\x00STX_ORPHAN_STYLE_${M}\x00`);if(K=N.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(R,M,T)=>{let D=M==="SCRIPT"?Bz(w.scripts[Number(T)],J):N.tokens[Number(T)];if(D)O.push(D);return""}),O.length>0){let R=O.join(`
|
|
3528
|
+
`);B.content=B.content?`${B.content}
|
|
3529
|
+
${R}`:R,Z.__sections=B}}if(V)try{let O;if(b0.isAbsolute(V))O=V,Y.add(V);else O=await y2(()=>e2(V,J,G,Y),null,()=>{throw new b2(`Failed to resolve layout path: ${V}`,J,void 0,void 0,`Layout referenced from ${J}`)});if(!O){let D=(A)=>{if(!A)return[];try{let k=b0.isAbsolute(A)?A:b0.resolve(process.cwd(),A);return zz.readdirSync(k).filter((C)=>C.endsWith(".stx")).map((C)=>C.replace(/\.stx$/,""))}catch{return[]}},I=[...D(G.layoutsDir),...D(G.fallbackLayoutsDir)].filter((A,k,C)=>C.indexOf(A)===k).sort(),E=`Layout not found: ${V} (referenced from ${J})`+(I.length>0?`. Available layouts: ${I.join(", ")}`:G.layoutsDir?`. No .stx layouts found in ${G.layoutsDir}`:"");if(n0.log(Error(E),{layoutPath:V,filePath:J,available:I},"error"),console.error(`[stx] ${E}`),G.debug)throw new b2(E,J);return K}let w=await y2(()=>Bun.file(O).text(),"",()=>{throw new b2(`Failed to read layout file: ${O}`,J,void 0,void 0,"Layout content could not be loaded")});w=N8(w,O);let N=w.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(N){if(G.debug)console.log(`Found nested layout: ${N[1]} in ${O}`);let D={},I=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(k,C,y)=>{return D[C]=y.trim(),""});for(let[k,C]of Object.entries(D))if(B[k]&&B[k].includes(b1)){let y=B[k].indexOf(b1);B[k]=B[k].slice(0,y)+C+B[k].slice(y+b1.length)}else if(!B[k])B[k]=C;let E={...Z,__sections:B},A=`@layout('${N[1]}')${I}`;return await n$(A,E,O,G,Y)}let R=w.replace(/\{\{--[\s\S]*?--\}\}/g,""),M=O$(R,j),T={};return M=M.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(D,I,E)=>{return T[I]=E.trim(),`@slot('${I}')`}),M=M.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(D,I,E)=>{if(B[I]){let A=B[I];if(A.includes(b1)){let k=T[I]||"",C=A.indexOf(b1);A=A.slice(0,C)+k+A.slice(C+b1.length)}return A}return E||""}),M=Uz(M,B),M=M.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""}),M=_$(M,j),Z.__originalFilePath=J,K=await A8(M,Z,O,G,Y),K=`<!-- stx-layout: ${V} -->
|
|
3530
|
+
${K}`,U(K)}catch(O){return n0.log(O instanceof Error?O:Error(String(O)),{layoutPath:V,filePath:J},"error"),`[Error processing layout: ${O instanceof Error?O.message:String(O)}]`}return U(await A8(K,Z,J,G,Y))}function Uz($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(J,X,Y)=>{let Q=Z[X];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return Y||""})}function Hz($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let J=Z.envPrefix||"STX_PUBLIC_",X={};for(let[Y,Q]of Object.entries(process.env))if(Y.startsWith(J)&&Q!==void 0)X[Y]=Q;$.$env=X}async function jz($,Z){await y2(()=>j6($,Z),void 0,(J)=>{n0.log(J,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${J.message}`)})}var i$="data-stx-source";function Bz($,Z){if(!$)return $;let J=/^<script\b([^>]*)>/i.exec($);if(!J||!/\bserver\b/.test(J[1])||J[1].includes(i$))return $;return`<script ${i$}="${encodeURIComponent(Z)}"${$.slice(7)}`}function Vz($){let Z=new RegExp(`${i$}="([^"]*)"`).exec($);return Z?decodeURIComponent(Z[1]):void 0}async function Oz($,Z,J){let X=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Y;while((Y=X.exec($))!==null){let Q=Y[1],G=Y[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;let K=Vz(Q)??J;try{let{extractVariables:q}=await s("stx/variable-extractor",()=>import("./chunk-4pcjt99d.js"));await q(G,Z,K,{preserveExisting:!0})}catch(q){let W=q instanceof Error?q:Error(String(q));n0.log(W,{filePath:K,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${K}: ${W.message}`)}}}async function _z($,Z,J){try{let{interpolateScriptsInTemplate:X}=await s("stx/expressions",()=>import("./chunk-4np12rj1.js"));return X($,Z,{skipServer:!0})}catch(X){let Y=X instanceof Error?X:Error(String(X));return n0.log(Y,{filePath:J,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${J}: ${Y.message}`),$}}async function A8($,Z,J,X,Y){let Q=$,G=X;if(await Oz(Q,Z,J),Q=await _z(Q,Z,J),Q=await s4(Q,Z,J),Q=await r4(Q,Z,J),Q=await t7(Q,Z,J,G),J1(Q))Q=Q8(Q,Z),Q=h$(Q,Z);Q=z8(Q);let{processStreamDirectives:z}=await s("stx/streaming",()=>import("./chunk-fha0nyet.js"));Q=z(Q,Z),Q=Q6(Q,Z,J,G,!0),Q=await F6(Q,Z,J,G,Y),Q=await H$(Q,Z,J,G,Y),Q=i3(Q,Z,J,G);let{processDeferDirectives:K}=await s("stx/defer",()=>import("./chunk-p1cddybx.js"));Q=K(Q,Z,J);let{processTeleportDirectives:q}=await s("stx/teleport",()=>import("./chunk-q0srntf6.js"));Q=q(Q,Z,J);let{processTransitionDirectives:W,processTransitionAttributes:U}=await s("stx/transitions",()=>import("./chunk-86v2rps7.js"));Q=W(Q,Z,J),Q=U(Q);let{processErrorBoundaryDirectives:H}=await s("stx/error-boundaries",()=>import("./chunk-kdhrk7x5.js"));Q=H(Q,Z,J);let{processSuspenseDirectives:j}=await s("stx/suspense",()=>import("./chunk-rkykwy3z.js"));Q=j(Q,Z,J);let{processAsyncDirectives:B}=await s("stx/async-components",()=>import("./chunk-tr41gn5j.js"));Q=B(Q,Z,J);let{processKeepAliveDirectives:V}=await s("stx/keep-alive",()=>import("./chunk-mys0rat0.js"));Q=V(Q,Z,J);let{processVirtualListDirectives:L,processVirtualGridDirectives:_,processInfiniteListDirectives:F}=await s("stx/virtual-scrolling",()=>import("./chunk-eq2j7w8p.js"));Q=L(Q,Z,J),Q=_(Q,Z,J),Q=F(Q,Z,J);let{processPartialHydrationDirectives:O,processStaticDirectives:w}=await s("stx/partial-hydration",()=>import("./chunk-tr1174hz.js"));Q=O(Q,Z,J),Q=w(Q);let{processComputedDirectives:N,processWatchDirectives:R}=await s("stx/computed",()=>import("./chunk-dekxwgc2.js"));Q=N(Q,Z,J),Q=R(Q,Z,J);let{processFormValidationDirectives:M}=await s("stx/forms-validation",()=>import("./chunk-h0y4mb2m.js"));Q=M(Q,Z,J);let{processHeadDirective:T,processTitleDirective:D,processMetaDirective:I,resetHead:E}=await s("stx/head",()=>import("./chunk-x48crnwa.js"));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)E();let A=T(Q);if(Q=A.content,A.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${A.headContent}
|
|
3531
|
+
`;if(Q=D(Q,Z),Q=I(Q,Z),Q=H6(Q),Q=C5(Q,Z),Q=a7(Q),Q=K6(Q),Q=await V$(Q,Z,J,G,Y),Q=await H$(Q,Z,J,G,Y),Z.__stxProcessingDepth===1)Q=O3(Q,Z);if(Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=d$(Q),Q=a0(Q,Z,J),Q=F$(Q),Q=r3(Q,Z,{filePath:J,buildMode:G.buildMode}),Q=S5(Q,Z),Q=P5(Q,Z),Q=F2(Q,Z),Q=m5(Q,Z),Q=d5(Q,Z),Q=await g7(Q,Z,J,G),Q=await X7(Q,Z,J),Q=await E8(Q,Z,J,G),Q=b8(Q,Z,J,G),Q=g8(Q,Z,J,G),Q=h8(Q,Z,J),Q=u8(Q,Z,J,G),Q=s7(Q,Z,J,G),Q=u$(Q,Z),Q=m$(Q),Q=O8(Q),!G.skipEventDirectives)Q=j3(Q,Z,J);if(Q=e3(Q,Z,J),G.debug){let p=/\bx-data\s*=/.test(Q),m=g$($);if(p&&m)console.warn(`[stx] ${J}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
3532
|
+
Both work on the same page, but they manage separate scopes.
|
|
3533
|
+
Prefer signals (state/derived/effect) for new components.`)}Q=f4(Q,Z),Q=await B1(Q,Z,J),Q=w8(Q),Q=R8(Q),Q=g3(Q);let{processXElementDirectives:k}=await s("stx/x-element",()=>import("./chunk-0xgc5t3y.js"));Q=k(Q);let C=Z.__originalFilePath||J,y=v9(Z);if(Q=await K8(Q,G,C,y),Q=J4(Q,Z),Q=await U6(Q,Z,J,G),G.media?.image?.autoSiblings){let p=G.publicDir||"public",{rewriteImagesWithSiblings:m}=await s("stx/image-optimization/auto-sibling",()=>import("./chunk-fx5m9d3t.js"));Q=await m(Q,{publicDir:p})}if(G.seo?.enabled)Q=m8(Q,Z,G);let b=(p,m,i=!0)=>{if(!m)return p;let j0=m.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),a=p.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(j0&&a){if(i)p=p.replace(a[0],j0[0]);if(m=m.replace(j0[0],"").trim(),!m)return p}if(/<\/head>/i.test(p))return p.replace(/<\/head>/i,`${m}
|
|
3534
|
+
</head>`);if(/<head\b[^>]*>/i.test(p))return p.replace(/(<head\b[^>]*>)/i,`$1
|
|
3535
|
+
${m}`);if(/<html\b[^>]*>/i.test(p))return p.replace(/(<html\b[^>]*>)/i,`$1
|
|
3536
|
+
<head>
|
|
3537
|
+
${m}
|
|
3538
|
+
</head>`);return p},{renderHead:P,getHead:u}=await s("stx/head",()=>import("./chunk-x48crnwa.js")),g=Z.__stx_runtime_head??u();if(g.title||g.meta?.length||g.link?.length){let p=P(g);if(p)Q=b(Q,p)}if(A.headContent)Q=b(Q,A.headContent,!g.title);if(G.csp?.enabled&&G.csp.addMetaTag)Q=n7(Q,G.csp,Z);if(G.analytics?.enabled)Q=u3(Q,G);if(G.heatmap?.enabled)Q=d3(Q,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:p}=await s("stx/pwa/inject",()=>import("./chunk-a3m7mgjc.js"));Q=p(Q,G)}let J0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(Q),X0=/\bSTX\.\w+/.test(Q),$0=/window\.STX\s*=/.test(Q);if(J0&&X0&&!$0){let m=`<script data-stx-scoped data-stx-run="once">
|
|
3539
|
+
${v3()}
|
|
3540
|
+
</script>`;if(Q.includes("</head>")){let i=Q.indexOf("</head>"),a=Q.slice(0,i).indexOf("<script");if(a!==-1){let y0=Q.slice(0,a),U1=Q.slice(a);Q=y0+m+`
|
|
3541
|
+
`+U1}else Q=Q.replace("</head>",`${m}
|
|
3542
|
+
</head>`)}else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
|
|
3543
|
+
${m}`);else Q=m+`
|
|
3544
|
+
`+Q}{let{scanScriptTags:p}=await s("stx/signal-processing",()=>import("./chunk-kdwerx8e.js")),m=[];for(let i of p(Q)){if(!/\bserver\b/i.test(i.attrs))continue;let j0=i.start+i.fullMatch.indexOf(">")+1,a=Kz(Q,j0);if(a===-1)continue;let y0=a+9;while(y0<Q.length&&/\s/.test(Q[y0]))y0++;m.push({start:i.start,end:y0})}if(m.length>0){let i=Array(m.length+1),j0=0;for(let a=0;a<m.length;a++){let{start:y0,end:U1}=m[a];i[a]=Q.slice(j0,y0),j0=U1}i[m.length]=Q.slice(j0),Q=i.join("")}}let c=x9(Q,J);if(c.hasScoped)Q=c.html;let K0=Z.__stx_event_bindings||[],r=!1,V0=[],$1=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:T0}=await s("stx/signal-processing",()=>import("./chunk-kdwerx8e.js"));for(let p of T0(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))V0.push({match:p.fullMatch,attrs:p.attrs,content:p.body});for(let{match:p,attrs:m,content:i}of V0){r=!0;let j0=i;c$(i,J,X.strict,Z.__originalFilePath);let a=await f9(i,{eventBindings:K0,attrs:m,hasColonDirectives:$1,templateContent:$,filePath:J,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:y});Q=Q.replace(p,()=>a)}if(r)Z.__stx_event_bindings=[];if(!r&&Z.__stxProcessingDepth===1){let p=Z.__stx_event_bindings||[];if(p.length>0){let m=r9(p);if(m){let i=Q.lastIndexOf("</body>");Q=i===-1?Q+m:Q.slice(0,i)+m+`
|
|
3545
|
+
`+Q.slice(i)}Z.__stx_event_bindings=[]}}if(!p6(Q)&&i6(Q))Q=await y9(Q,G);if(Q=n6(Q),G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=o7(Q,Z.cspNonce);return Q}import JZ from"path";import s$ from"fs";import C2 from"path";function l8($,Z,J,X){let Y=0;for(let Q=Z;Q<$.length;Q++)if($[Q]===J)Y++;else if($[Q]===X&&!(X===">"&&$[Q-1]==="=")){if(--Y===0)return Q}return-1}function Lz($){let Z=W0($),J=0,X=0,Y=[];for(let Q=0;Q<Z.length;Q++)if("([{".includes(Z[Q]))J++;else if(")]}".includes(Z[Q]))J--;else if(Z[Q]===","&&J===0)Y.push($.slice(X,Q).trim()),X=Q+1;return Y.push($.slice(X).trim()),Y}function o$($,Z){let J=W0($),X=new RegExp(`\\b(?:${Z.map((Y)=>Y.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let Y of J.matchAll(X)){let Q=Y.index+Y[0].length,G="";if(J[Q]==="<"){let K=l8(J,Q,"<",">");if(K<0)continue;G=$.slice(Q+1,K),Q=K+1;while(/\s/.test(J[Q]||"")&&Q<J.length)Q++}if(J[Q]!=="(")continue;let z=l8(J,Q,"(",")");if(z>=0)return{type:G,args:Lz($.slice(Q+1,z))}}return null}var c8=`
|
|
3546
|
+
type __StxCtor<T> = T extends StringConstructor ? string : T extends NumberConstructor ? number : T extends BooleanConstructor ? boolean : T extends ArrayConstructor ? unknown[] : T extends ObjectConstructor ? object : T extends readonly unknown[] ? __StxCtor<T[number]> : T extends abstract new (...args: any[]) => infer V ? V : unknown;
|
|
3547
|
+
type __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
|
|
3548
|
+
type __StxOption<T> = T extends { type: infer C } ? __StxCtor<C> : T extends { default: infer D } ? D extends (...args: any[]) => infer V ? V : __StxWiden<D> : __StxCtor<T>;
|
|
3549
|
+
type __StxRequired<O> = { [K in keyof O]-?: O[K] extends { required: true } ? K : never }[keyof O];
|
|
3550
|
+
type __StxDefaulted<O> = { [K in keyof O]-?: O[K] extends { default: unknown } ? K : never }[keyof O];
|
|
3551
|
+
type __StxOptions<O> = { [K in Exclude<__StxRequired<O>, __StxDefaulted<O>>]: __StxOption<O[K]> } & { [K in Exclude<keyof O, Exclude<__StxRequired<O>, __StxDefaulted<O>>>]?: __StxOption<O[K]> };
|
|
3552
|
+
type __StxDefaults<P, K> = Omit<P, Extract<keyof P, K>> & Partial<Pick<P, Extract<keyof P, K>>>;
|
|
3553
|
+
`;function p8($,Z){let J=[],X={defineProps:["defineProps"],defineEmits:["defineEmits"],withDefaults:["withDefaults"]},Y=W0($),Q=$.replace(/\bimport\s+(?:type\s+)?(\{[^}]*\}|\*\s+as\s+[\w$]+|[\w$]+)\s+from\s*(['"])([^'"]+)\2\s*;?/g,(H,j,B,V,L)=>{if(Y.slice(L,L+6)!=="import")return H;if(V.endsWith(".stx"))return"";let _=`${Z}Import${J.length}`;if(J.push(`import * as ${_} from ${JSON.stringify(V)};`),j.startsWith("*"))return`import ${j.replace(/^\*\s+as\s+/,"")} = ${_};`;if(!j.startsWith("{"))return`import ${j} = ${_}.default;`;return j.slice(1,-1).split(",").map((F)=>{let[O,w=O]=F.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(!O)return"";if(/^(?:stx|@stacksjs\/stx)(?:\/|$)/.test(V)&&O in X)X[O].push(w);return`import ${w} = ${_}.${O};`}).join(`
|
|
3554
|
+
`)}),G=o$($,X.defineProps),z=o$($,X.defineEmits),K=o$($,X.withDefaults);if(!G&&!z)return{declarations:"",props:null,events:null};let q=[],W=null,U=null;if(G){q.push(`const __options = (${G.args[0]||"{}"}) as const;`),q.push(`const __defaults = (${K?.args[1]||"{}"});`);let H=G.type||"__StxOptions<typeof __options>";q.push(`export type __StxProps = __StxDefaults<${H}, keyof typeof __defaults | __StxDefaulted<typeof __options>>;`),W=`${Z}.__StxProps`}if(z)q.push(`const __events = (${z.args[0]||"[]"}) as const;`),q.push(`export type __StxEvents = ${z.type||"Record<(typeof __events)[number], any[]>"};`),U=`${Z}.__StxEvents`;return{declarations:`${J.join(`
|
|
3555
|
+
`)}
|
|
3556
|
+
namespace ${Z} {
|
|
3557
|
+
${Q}
|
|
3558
|
+
${q.join(`
|
|
3559
|
+
`)}
|
|
3560
|
+
}`,props:W,events:U}}function*Fz($){let Z=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,J;while(J=Z.exec($)){let X=Z.lastIndex,Y=[];while(X<$.length){while(/\s/.test($[X]||""))X++;if($[X]===">"||$.slice(X,X+2)==="/>"){X+=$[X]===">"?1:2;break}let Q=/^[^\s=/>]+/.exec($.slice(X))?.[0];if(!Q){X++;continue}let G=X;X+=Q.length;while(/\s/.test($[X]||""))X++;if($[X]!=="="){Y.push({name:Q,value:!0,offset:G,braced:!1});continue}X++;while(/\s/.test($[X]||""))X++;let z=$[X],K=z==="{",q=z==='"'||z==="'";if(q||K)X++;let W=X;if(K){let U=W0($.slice(X)),H=1,j=0;for(;j<U.length;j++){if(U[j]==="{")H++;if(U[j]==="}"&&--H===0)break}X+=j}else if(q)while(X<$.length&&$[X]!==z)X++;else while(X<$.length&&!/[\s/>]/.test($[X]))X++;if(Y.push({name:Q,value:$.slice(W,X),offset:W,braced:K}),q||K)X++}Z.lastIndex=X,yield{name:J[1],offset:J.index,attributes:Y}}}function i8($,Z,J){let X=[],Y=[c8,"type __StxAssignedValue<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? T extends () => infer V ? V : T : T;","type __StxProp<P, K> = K extends keyof P ? P[K] : unknown;",'type __StxEvent<E, K> = K extends keyof E ? E[K] extends readonly unknown[] ? Exclude<E[K]["length"], 0 | 1> extends never ? E[K][0] : E[K] : E[K] : any;'],Q=new Map,G=new Map,z=new Map,K=J.scriptCode($,J.filePath),q=W0(K);for(let B of K.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(q.slice(B.index,B.index+6)!=="import")continue;let V=B[2],L=C2.isAbsolute(V)||V.startsWith(".")?C2.resolve(C2.dirname(J.filePath),V):H9(V,C2.dirname(J.filePath));if(!L)continue;let _=L.endsWith(".stx")?L:s$.existsSync(`${L}.stx`)?`${L}.stx`:void 0,F=_?null:U9(L,!1),O=B[1].startsWith("{")?B[1].slice(1,-1).split(","):[B[1]];for(let w of O){let[N,R=N]=w.trim().split(/\s+as\s+/),M=_||F?.get(N)||F?.get(N.toLowerCase());if(M)z.set(R,M),z.set(R.toLowerCase(),M),z.set(R.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),M)}}for(let B of Z.matchAll(/@import\s*\(([^)]+)\)/g))for(let V of B[1].matchAll(/['"]([^'"]+)['"]/g)){let L=j9(V[1],J.filePath,J).find((_)=>s$.statSync(_,{throwIfNoEntry:!1})?.isFile());if(L)z.set(C2.basename(V[1]).replace(/\.stx$/,""),L)}let W={__importedComponents:z},U=new Map,H=(B,V,L)=>{let _=$.slice(0,B);return{code:V,offset:B,attribute:L,anchor:!0,kind:"directive",line:_.split(`
|
|
3561
|
+
`).length,column:B-_.lastIndexOf(`
|
|
3562
|
+
`)}},j=(B,V,L)=>X.push({expression:B,statement:{text:V+B.code+L,prefixLength:V.length}});for(let B of Fz(Z)){if(A2(B.name)||B.name==="component")continue;let V=K4(B.name,J.filePath,J,W);if(!V)continue;let L=U.get(V);if(!L){let F;try{F=J.readComponent?J.readComponent(V):s$.readFileSync(V,"utf8")}catch{continue}if(F===void 0)continue;G.set(V,F),L=p8(J.scriptCode(F,V),`__StxComponent${U.size}`),U.set(V,L),Y.push(L.declarations)}let _=[];for(let F of B.attributes){let{name:O,offset:w}=F,N=F.value===!0?"true":F.value;if(O.startsWith("@")||O.startsWith("v-on:")){if(L.events&&F.value!==!0)Q.set(w,`__StxEvent<${L.events}, ${JSON.stringify(O.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let R=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(O);if(O.startsWith("v-")&&!O.startsWith("v-bind:")&&!R)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(O))continue;let M=(R?R[1]||"modelValue":O.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(I,E)=>E.toUpperCase());if(_.push(M),!L.props)continue;let D=O.startsWith(":")||O.startsWith("v-bind:")||!!R||F.braced?N:F.value!==!0?JSON.stringify(N):"true";j(H(w,D,O),";void ((",`) satisfies __StxProp<${L.props}, ${JSON.stringify(M)}>);`)}if(L.props){let F=[...new Set(_)].map((w)=>`${JSON.stringify(w)}: undefined as any`).join(", "),O=H(B.offset,`<${B.name}>`);X.push({expression:O,statement:{text:`;void ({ ${F} } satisfies ${L.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:U.size?Y.join(`
|
|
3563
|
+
`):"",checks:X,events:Q,dependencies:G}}var n8=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function wz($){let Z=(J)=>J.replace(/[^\n]/g," ");return $.replace(/<!--[\s\S]*?-->/g,Z).replace(/\{\{--[\s\S]*?--\}\}/g,Z)}function o8($){let Z=[],J=wz($);n8.lastIndex=0;let X;while((X=n8.exec(J))!==null){let Y=(X[1]||"").trim(),Q=(X[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,G=(X[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,z=X.index+Q,K=X.index+X[0].length-G,q=$.slice(z,K);if(/\bsrc\s*=/.test(Y))continue;let W=Y.match(/\btype\s*=\s*["']([^"']+)["']/i);if(W&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(W[1]))continue;let U=/\bserver\b/.test(Y)?"server":/\bclient\b/.test(Y)?"client":"plain",H=h9($,z);Z.push({kind:U,code:q,startLine:H,attrs:Y})}return Z}function h9($,Z){let J=1;for(let X=0;X<Z&&X<$.length;X++)if($.charCodeAt(X)===10)J++;return J}function r$($,Z){let J=$.lastIndexOf(`
|
|
3564
|
+
`,Z-1)+1;return Z-J+1}function u9($){let Z=$.split(""),J=(Y,Q)=>{for(let G=Y;G<Q&&G<Z.length;G++)if(Z[G]!==`
|
|
3565
|
+
`)Z[G]=" "},X=[/<script(?:\s[^>]*)?>[\s\S]*?<\/script>/gi,/<style(?:\s[^>]*)?>[\s\S]*?<\/style>/gi,/<!--[\s\S]*?-->/g,/\{\{--[\s\S]*?--\}\}/g,/@verbatim\b[\s\S]*?@endverbatim\b/g];for(let Y of X){Y.lastIndex=0;let Q;while((Q=Y.exec($))!==null)J(Q.index,Q.index+Q[0].length)}return Z.join("")}function Rz($){let Z=0,J="";for(let X=0;X<$.length;X++){let Y=$[X];if(J){if(Y==="\\"){X++;continue}if(Y===J)J="";continue}if(Y==='"'||Y==="'"||Y==="`"){J=Y;continue}if(Y==="("||Y==="["||Y==="{"){Z++;continue}if(Y===")"||Y==="]"||Y==="}"){Z--;continue}if(Y==="|"&&Z===0){if($[X+1]==="|"){X++;continue}if($[X-1]==="|")continue;return $.slice(0,X)}}return $}var XZ=new Set([":for","x-for","v-for"]),m9=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,a$="__stx_interpolated",s8="__StxElement",YZ="__StxTemplateValue",Nz=`type ${YZ}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function r8($){return $.replace(/\{\{[\s\S]*?\}\}/g,a$).replace(/\{!![\s\S]*?!!\}/g,a$)}function A_($){return $.replace(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/g,(Z)=>{let J=Z.split(`
|
|
3566
|
+
`).length-1,X=Z.length-J;return`0${" ".repeat(Math.max(0,X-1))}${`
|
|
3567
|
+
`.repeat(J)}`})}var Dz=["foreach","endforeach","forelse","endforelse","for","endfor","while","endwhile","empty","if","elseif","else","endif","unless","endunless","isset","endisset","switch","case","default","endswitch","auth","endauth","guest","endguest","env","endenv","once","endonce","break","continue"],Mz=new RegExp(String.raw`^[ \t]*@(?:${Dz.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function I_($){return $.replace(Mz,(Z)=>Z.replace(/[^\n]/g," "))}var a8=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function Az($){let Z=u9($),J=[],X=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,Y;while((Y=X.exec(Z))!==null){if(Y[1]||Y[3])continue;let G=Y[2]??Y[4]??"",z=Y[2]!==void 0?2:3,K=Rz(G);if(!K.trim())continue;let q=Y.index+z+(K.length-K.trimStart().length);J.push({code:K.trim(),line:h9(Z,q),column:r$(Z,q),offset:q,kind:"interpolation"})}m9.lastIndex=0;while((Y=m9.exec(Z))!==null){let Q=Y[1],G=Y[3]??"",z=Q.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(a8.has(z)||a8.has(Q))continue;if(!G.trim())continue;let K=Y.index+Y[0].indexOf(Y[2],Y[0].indexOf(Q)+Q.length)+1;if(XZ.has(z)){let W=G.match(/\s+(?:in|of)\s+/);if(!W||W.index===void 0)continue;let U=G.slice(W.index+W[0].length),H=W.index+W[0].length+(U.length-U.trimStart().length);J.push({code:r8(U.trim()),line:h9(Z,K+H),column:r$(Z,K+H),offset:K+H,kind:"directive",attribute:z});continue}let q=G.length-G.trimStart().length;J.push({code:r8(G.trim()),line:h9(Z,K+q),column:r$(Z,K+q),offset:K+q,kind:"directive",attribute:z})}return J.sort((Q,G)=>Q.line-G.line||Q.column-G.column),J}var Iz=2000;function Tz($,Z){let J=0,X=Math.min($.length,Z+Iz);for(let Y=Z;Y<X;Y++){let Q=$[Y];if(Q==="(")J++;else if(Q===")"){if(J--,J===0)return $.slice(Z+1,Y)}}return null}function kz($){let Z=new Map,J=(z,K)=>{let q=z.split(/[,[\]{}()\s]+/).filter(Boolean);for(let W of q){let U=W.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(U))continue;let H=q.length===1?K:void 0,j=Z.get(U);if(!j)Z.set(U,{name:U,iterable:H});else if(j.iterable!==H)j.iterable=void 0}},X=/^\$?[A-Z_$][\w$]*$/i,Y=(z)=>{let K=z.trim();return X.test(K)?K:void 0};for(let z of $.matchAll(/@for(?:each|else)\s*\(/g)){let K=Tz($,z.index+z[0].length-1);if(K===null)continue;let q=K.match(/^([\s\S]*?)\bas\b([\s\S]*)$/);if(!q)continue;J(q[2].replace(/=>/g," "),Y(q[1]))}for(let z of $.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)/g))J(z[1]);let Q=u9($);m9.lastIndex=0;let G;while((G=m9.exec(Q))!==null){let z=G[1].replace(/\..*$/,"");if(!XZ.has(z))continue;let K=G[3].match(/\s+(?:in|of)\s+/);if(!K||K.index===void 0)continue;J(G[3].slice(0,K.index),Y(G[3].slice(K.index+K[0].length)))}for(let z of $.matchAll(/@(?:php|js|ts)\b([\s\S]*?)@end(?:php|js|ts)\b/g))for(let K of z[1].matchAll(/\b(?:const|let|var|function|class)\s+([\w$]+)/g))J(K[1]);return[...Z.values()].sort((z,K)=>z.name.localeCompare(K.name))}function y1($){let Z=new Set;for(let J of $.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s+([\w$]+)/gm))Z.add(J[1]);for(let J of $.matchAll(/^\s*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([\w$]+)/gm))Z.add(J[1]);for(let J of $.matchAll(/^\s*(?:export\s+)?class\s+([\w$]+)/gm))Z.add(J[1]);for(let J of $.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s*[[{]([^\]}]*)[\]}]/gm))for(let X of J[1].split(",")){let Y=X.split(":").pop().split("=")[0].replace(/^\.\.\./,"").trim();if(/^[A-Z_$][\w$]*$/i.test(Y))Z.add(Y)}return[...Z].sort()}function Ez(){return["declare var window: any",...S2.map(($)=>`declare var ${$}: any`)].join(`
|
|
3568
|
+
`)}var bz=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"];function yz(){return bz.map(($)=>`declare var ${$}: any`).join(`
|
|
3569
|
+
`)}function QZ($){let Z=/\bdefineClientPayload\s*\(\s*\{([\s\S]*?)\}\s*\)/g,J,X=!1,Y=new Set,Q=W0($);while((J=Z.exec(Q))!==null){X=!0;for(let G of Cz(J[1])){let z=G.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(z))Y.add(z)}}return X?[...Y]:null}function Cz($){let Z=[],J=0,X="";for(let Y of $){if(Y===","&&J===0){Z.push(X),X="";continue}if(Y==="("||Y==="["||Y==="{")J++;else if(Y===")"||Y==="]"||Y==="}")J--;X+=Y}return Z.push(X),Z.filter((Y)=>Y.trim().length>0)}function Sz($){let Z=/^[ \t]*import\b[\s\S]*?(?:from\s*['"][^'"]*['"]|['"][^'"]*['"])[ \t]*;?[ \t]*$/gm,J=[],X=$.replace(Z,(Y)=>{return J.push(Y.trim()),Y.split(`
|
|
3570
|
+
`).map(()=>"").join(`
|
|
3571
|
+
`)});return{imports:J.join(`
|
|
3572
|
+
`),body:X}}function GZ($){let Z=W0($),J=Array(Z.length),X=0;for(let z=0;z<Z.length;z++){let K=Z[z];if(K==="}"||K===")"||K==="]")X=Math.max(0,X-1);if(J[z]=X,K==="{"||K==="("||K==="[")X++}let Y=[],Q=/^[ \t]*(?:export[ \t]+)?(interface|type)[ \t]+([A-Za-z_$][\w$]*)/gm,G;while((G=Q.exec(Z))!==null){if(J[G.index]!==0)continue;let z=G[1],K=G[2],q;if(z==="interface"){let W=Z.indexOf("{",G.index);if(W===-1)continue;let U=0;q=-1;for(let H=W;H<Z.length;H++)if(Z[H]==="{")U++;else if(Z[H]==="}"&&--U===0){q=H+1;break}if(q===-1)continue}else{let W=0;q=Z.length;for(let U=Z.indexOf("=",G.index)+1;U<Z.length;U++){let H=Z[U];if(H==="{"||H==="["||H==="("||H==="<")W++;else if(H==="}"||H==="]"||H===")"||H===">")W--;else if(W<=0&&(H===";"||H===`
|
|
3573
|
+
`&&!/[=|&,<([{]\s*$/.test(Z.slice(Math.max(0,U-40),U)))){q=H===";"?U+1:U;break}}}Y.push({name:K,text:$.slice(G.index,q).replace(/^[ \t]*export[ \t]+/,"")}),Q.lastIndex=q}return Y}function Pz($){return new Set(GZ($).map((Z)=>Z.name))}function T_($,Z=""){let J=QZ($),X=Pz(Z),Y=GZ($).filter((q)=>!X.has(q.name)).map((q)=>q.text);if(!J){let q=y1($);if(q.length===0&&Y.length===0)return"";return["",`// ${fz}`,...Y,...q.map((W)=>`declare var ${W}: any`)].join(`
|
|
3574
|
+
`)}if(J.length===0)return Y.length>0?["",`// ${t8}`,...Y].join(`
|
|
3575
|
+
`):"";let{imports:Q,body:G}=Sz($),z=G.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),K=["",`// ${t8}`];if(Q)K.push(Q);return K.push(...Y),K.push(`async function ${e8}() {`,z,` return { ${J.join(", ")} }`,"}",`type ${$Z} = Awaited<ReturnType<typeof ${e8}>>`,...J.map((q)=>`declare var ${q}: ${$Z}[${JSON.stringify(q)}]`)),K.join(`
|
|
3576
|
+
`)}function vz($){let J=W0($).split(""),X=0;for(let Y=0;Y<J.length;Y++){let Q=J[Y];if(Q==="{"||Q==="("||Q==="["){X++;continue}if(Q==="}"||Q===")"||Q==="]"){X=Math.max(0,X-1);continue}if(X>0&&Q!==`
|
|
3577
|
+
`)J[Y]=" "}return y1(J.join(""))}function k_($,Z){if(QZ($)!==null)return[];let J=W0(Z),X=new Set(S2);return vz($).filter((Y)=>{if(X.has(Y))return!1;if(y1(Z).includes(Y))return!1;return new RegExp(`(?<![.#\\w$])${Y}(?![\\w$])`).test(J)})}var t8="stx: types for the declared client payload (#1868)",fz="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",e8="__stxServerScope",$Z="__StxClientPayload";var xz=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","props","slot"];var gz=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function hz($,Z){let J=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,X=[],Y;while((Y=J.exec($))!==null){if(Y.index>=Z)break;let Q=Y[1];if(Q==="endif"||Q==="endunless"){X.pop();continue}let G="";if(Y[2]==="("){let z=0,K=Y.index+Y[0].length-1,q=K+1;for(;K<$.length;K++){let W=$[K];if(W==="(")z++;else if(W===")"){if(z--,z===0)break}}G=$.slice(q,K).trim(),J.lastIndex=K+1}if(Q==="if")X.push({seen:[],current:G});else if(Q==="unless")X.push({seen:[],current:`!(${G})`});else if(Q==="elseif"||Q==="else"){let z=X[X.length-1];if(!z)continue;if(z.current)z.seen.push(z.current);z.current=Q==="elseif"?G:null}}return X.flatMap((Q)=>[...Q.seen.map((G)=>`!(${G})`),...Q.current?[Q.current]:[]]).filter(Boolean)}function uz($){let Z=$.code.trim();if(!Z)return null;if($.attribute?.startsWith("@")){if(gz.test(Z))return null;let X=";(($event: any): void => { ";return{text:`${X}${Z} });`,prefixLength:X.length}}let J=";void ((";return{text:`${J}${Z}));`,prefixLength:J.length}}var mz=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function ZZ($,Z){if(!Z)return $;return $.replace(mz,(J,X,Y,Q)=>{let G=JZ.resolve(Z,Q).replace(/\\/g,"/");return`${X}${Y}${G}${Y}`})}function E_($,Z={}){let J=o8($),X=$.split(`
|
|
3578
|
+
`),Y=Array.from({length:X.length},()=>""),Q=new Map,G=Z.filePath&&Z.templateExpressions!==!1?i8($,u9($),{filePath:Z.filePath,componentsDir:Z.componentsDir,projectRoot:Z.projectRoot,readComponent:Z.readComponent,scriptCode:(K,q)=>o8(K).map((W)=>ZZ(W.code,JZ.dirname(q))).join(`
|
|
3579
|
+
`)}):void 0;for(let K of J)ZZ(K.code,Z.originDir??"").split(`
|
|
3580
|
+
`).forEach((W,U)=>{let H=K.startLine-1+U;if(H<Y.length)Y[H]=W});let z=(K,q)=>{for(let[W,U]of K.split(`
|
|
3581
|
+
`).entries())if(Y.push(U),q)Q.set(Y.length,W===0?q:{...q,line:q.line+W,column:1,prefixLength:0})};if(Z.globals!==!1){if(z(""),Z.runtimeGlobals!==!1)for(let q of Ez().split(`
|
|
3582
|
+
`))z(q);for(let q of yz().split(`
|
|
3583
|
+
`))z(q);for(let q of k1)z(`declare var ${q}: any`);for(let q of xz)z(`declare var ${q}: any`);z(`declare var ${a$}: any`);let K=new Set(J.flatMap((q)=>y1(q.code)));z(`type ${s8}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let q of kz($)){if(K.has(q.name))continue;let W=q.iterable&&K.has(q.iterable)?`${s8}<typeof ${q.iterable}>`:"any";z(`declare var ${q.name}: ${W}`)}}if(Z.templateExpressions!==!1){if(G?.declarations)for(let q of G.declarations.split(`
|
|
3584
|
+
`))z(q);let K=Az($).map((q)=>{let W=G?.events.get(q.offset??-1);if(W){q.anchor=!0;let U=q.code.trim(),H=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(U),j=H?`void ((${H[2]}) satisfies __StxAssignedValue<typeof ${H[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(U)?`${U}($event)`:U,B=`;(($event: ${W}): void => { `;return{expression:q,statement:{text:`${B}${j} });`,prefixLength:B.length}}}return{expression:q,statement:uz(q)}}).filter((q)=>q.statement!==null);if(K.push(...G?.checks||[]),K.length>0){let q=u9($),U=[...new Set(J.flatMap((j)=>y1(j.code)))].filter((j)=>/^[A-Z_$][\w$]*$/i.test(j)),H=0;if(U.length>0){z(Nz);for(let j of U)z(`type __StxT_${j} = ${YZ}<typeof ${j}>`);z(`;((${U.map((j)=>`${j}: __StxT_${j}`).join(", ")}) => {`),H=1}for(let{expression:j,statement:B}of K){let V=" ".repeat(H),L=j.offset===void 0?[]:hz(q,j.offset),_=L.length>0?`${L.map((O)=>`if (${O}) `).join("")}{ `:"",F=L.length>0?" }":"";z(V+_+B.text+F,{line:j.line,column:j.column,expression:j,prefixLength:B.prefixLength+V.length+_.length})}if(H>0)z("});")}}return z("export {}"),{text:Y.join(`
|
|
3585
|
+
`),lineMap:Q,sourceLineCount:X.length,componentDependencies:G?.dependencies}}function b_($,Z,J){let X=$.lineMap.get(Z);if(!X)return Z<=$.sourceLineCount?{line:Z,column:J}:null;let Y=X.expression?.anchor?0:Math.max(0,J-1-(X.prefixLength??0));return{line:X.line,column:X.column+Y,expression:X.expression}}var dz=[{open:"@if",close:"@endif",name:"if"},{open:"@unless",close:"@endunless",name:"unless"},{open:"@foreach",close:"@endforeach",name:"foreach"},{open:"@for",close:"@endfor",name:"for"},{open:"@while",close:"@endwhile",name:"while"},{open:"@forelse",close:"@endforelse",name:"forelse"},{open:"@switch",close:"@endswitch",name:"switch"},{open:"@isset",close:"@endisset",name:"isset"},{open:"@empty",close:"@endempty",name:"empty"},{open:"@auth",close:"@endauth",name:"auth"},{open:"@guest",close:"@endguest",name:"guest"},{open:"@can",close:"@endcan",name:"can"},{open:"@cannot",close:"@endcannot",name:"cannot"},{open:"@section",close:"@endsection",name:"section",altClose:"@show"},{open:"@push",close:"@endpush",name:"push"},{open:"@prepend",close:"@endprepend",name:"prepend"},{open:"@once",close:"@endonce",name:"once"},{open:"@markdown",close:"@endmarkdown",name:"markdown"},{open:"@component",close:"@endcomponent",name:"component"}],lz=[{pattern:/@if\s*[^(]/,message:"@if directive missing parentheses",suggestion:"Use @if(condition)"},{pattern:/@foreach\s*[^(]/,message:"@foreach directive missing parentheses",suggestion:"Use @foreach(items as item)"},{pattern:/@foreach\([^)]*\)\s*[^@\n<]/,message:"@foreach may have content on same line",suggestion:"Put content on new line after @foreach()"},{pattern:/@include\s*[^(]/,message:"@include directive missing parentheses",suggestion:"Use @include('partial-name')"},{pattern:/@extends\s*[^(]/,message:"@extends directive missing parentheses",suggestion:"Use @extends('layout-name') or @layout('layout-name')"},{pattern:/@layout\s*[^(]/,message:"@layout directive missing parentheses",suggestion:"Use @layout('layout-name')"}],cz=[{pattern:/\{\{\s*constructor\s*\}\}/,message:"Attempting to access constructor property"},{pattern:/\{\{\s*__proto__\s*\}\}/,message:"Attempting to access __proto__ property"},{pattern:/\{\{\s*eval\s*\(/,message:"Attempting to use eval in expression"}];function pz($){let Z=[],J=[];return iz($,Z),nz($,Z,J),oz($,J),sz($,Z),{valid:Z.length===0,errors:Z,warnings:J}}function iz($,Z){let J=($.match(/\{\{/g)||[]).length,X=($.match(/\}\}/g)||[]).length;if(J!==X)Z.push({type:"expression",message:`Unclosed expression brackets: found ${J} opening '{{' and ${X} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function nz($,Z,J){for(let X of dz){let Y=new RegExp(`${X.open}(?:\\s|\\()`,"g"),Q=new RegExp(X.close,"g"),G=($.match(Y)||[]).length,z=($.match(Q)||[]).length;if(X.altClose){let K=new RegExp(X.altClose,"g");z+=($.match(K)||[]).length}if(G>z)Z.push({type:"directive",message:`Unclosed @${X.name} directive: found ${G} opening and ${z} closing`,suggestion:`Add ${G-z} missing ${X.close} tag(s)`});else if(z>G)J.push({type:"directive",message:`Extra ${X.close} found: ${z-G} more closing than opening`,suggestion:`Check for orphaned ${X.close} tags`})}}function oz($,Z){for(let J of lz)if(J.pattern.test($))Z.push({type:"syntax",message:J.message,suggestion:J.suggestion})}function sz($,Z){for(let J of cz)if(J.pattern.test($))Z.push({type:"expression",message:`Security warning: ${J.message}`,suggestion:"Remove dangerous code from template expressions"})}function rz($,Z){let J=$.slice(0,Z).split(`
|
|
3586
|
+
`);return{line:J.length,column:J[J.length-1].length+1}}function az($,Z,J){let X=[];switch($){case"if":case"elseif":case"unless":if(J.length===0)X.push({type:"syntax",message:`@${$} requires a condition`,suggestion:`Use @${$}(condition)`});break;case"foreach":if(J.length===0||!J[0].includes(" as "))X.push({type:"syntax",message:'@foreach requires "items as item" syntax',suggestion:"Use @foreach(items as item) or @foreach(items as key => value)"});break;case"for":if(J.length===0)X.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(J.length===0)X.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(J.length===0)X.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(J.length===0)X.push({type:"syntax",message:`@${$} requires a path`,suggestion:`Use @${$}('path/to/template')`});break}return X}function tz($){return/@[a-z]+/i.test($)||/\{\{/.test($)}function ez($){let Z=$.matchAll(/@([a-z]+)/gi),J=new Set;for(let X of Z){let Y=X[1].toLowerCase();if(!Y.startsWith("end"))J.add(Y)}return Array.from(J)}import o0 from"path";import J2 from"process";var NZ=["module","exports","require","props","$props","defineProps","withDefaults","defineClientPayload","useServerData","useRuntimeConfig","useServerRuntimeConfig","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","setResponseStatus","setResponseHeader","notFound","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params"],zZ=new Set(NZ),$K=new Set(["props","$props","defineProps"]),ZK=new Set(["stx","@stacksjs/stx"]),KZ=E1(128),qZ=E1(64);function JK($){let Z=[],J=0,X=$.split(`
|
|
3587
|
+
`);for(let Y of X){let Q=J,G=null,z=!1;for(let K=0;K<Y.length;K++){let q=Y[K];if(z){z=!1;continue}if(q==="\\"){z=!0;continue}if(G){if(q===G)G=null;continue}if(q==="'"||q==='"'||q==="`"){G=q;continue}if(q==="/"&&K+1<Y.length&&Y[K+1]==="/")break;if(q==="{")J++;else if(q==="}")J--}if(Q===0){let K=Y.match(/(?:const|let|var)\s+(\w+)\s*=/);if(K)Z.push(K[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Y)){let q=Y.match(/(?:const|let|var)\s+(\w+)/);if(q)Z.push(q[1])}else{let q=Y.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(q){let U=q[1].slice(1,-1).split(",").map((H)=>{let j=H.split(":");return(j.length>1?j[1]:j[0]).trim()}).filter((H)=>/^\w+$/.test(H));Z.push(...U)}}}}return[...new Set(Z)]}function XK($){let Z=$;Z=Z.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),Z=Z.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),Z=Z.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function J(X){if(!X.includes(":"))return X;let Y=[],Q="",G=0,z=0,K=null;for(let q=0;q<X.length;q++){let W=X[q];if(K){if(Q+=W,W===K)K=null;continue}if(W==='"'||W==="'"||W==="`"){K=W,Q+=W;continue}if(W==="<")G++;else if(W===">"&&G>0)G--;else if(W==="(")z++;else if(W===")")z--;if(W===","&&G===0&&z===0){Y.push(Q),Q="";continue}Q+=W}if(Q)Y.push(Q);return Y.map((q)=>{let W=q.trim(),U=W.startsWith("..."),H=U?W.slice(3):W,j=-1,B=0;for(let N=0;N<H.length;N++)if(H[N]==="<")B++;else if(H[N]===">")B--;else if(H[N]===":"&&B===0){j=N;break}if(j===-1)return q;let L=H.substring(0,j).trim().replace(/\?$/,""),_=H.substring(j+1),F=-1,O=0;for(let N=0;N<_.length;N++)if(_[N]==="<")O++;else if(_[N]===">")O--;else if(_[N]==="="&&O===0){F=N;break}let w=U?"...":"";if(F!==-1)return`${w}${L} = ${_.substring(F+1).trim()}`;return`${w}${L}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(X,Y,Q)=>{if(!Q.includes(":"))return X;return`${Y}(${J(Q)})`});{let X=/\b(function\s+\w*\s*)\(/g,Y,Q=[];while((Y=X.exec(Z))!==null){let G=Y.index+Y[0].length-1,z=1,K=G+1,q=0,W=null;while(K<Z.length&&z>0){let j=Z[K];if(W){if(j===W)W=null;K++;continue}if(j==='"'||j==="'"||j==="`"){W=j,K++;continue}if(j==="<")q++;else if(j===">"&&q>0)q--;else if(q===0){if(j==="(")z++;else if(j===")")z--}if(z>0)K++}if(z!==0)continue;let U=Z.substring(G+1,K);if(!U.includes(":"))continue;let H=J(U);Q.push({start:G+1,end:K,replacement:H})}for(let G=Q.length-1;G>=0;G--){let{start:z,end:K,replacement:q}=Q[G];Z=Z.substring(0,z)+q+Z.substring(K)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(X,Y)=>{if(!Y.includes(":"))return X;if(Y.includes("{")||Y.includes("}"))return X;return`(${Y.split(",").map((G)=>{let[z,...K]=G.split("="),q=z.split(":")[0].trim();if(K.length>0)return`${q} = ${K.join("=").trim()}`;return q}).join(", ")}) =>`}),Z=Z.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),Z=Z.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),Z=Z.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),Z=Z.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),Z=Z.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),Z=Z.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),Z=Z.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),Z=Z.replace(/\n\s*\n\s*\n/g,`
|
|
3588
|
+
|
|
3589
|
+
`),Z}function YK($){return/cannot find module|could not resolve|module not found|failed to resolve/i.test($)}function QK($){if($ instanceof SyntaxError)return!0;let Z=$ instanceof Error?$.message:String($);return/SyntaxError|Unexpected (token|identifier|string|number|keyword|end of)|Unterminated|Expected .+ but found/i.test(Z)}function GK($){if(!/is not defined|can't find variable/i.test($))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test($)}async function zK($,Z,J,X={}){if(!$.trim())return;let Y=$2(),Q=W1($,JSON.stringify(Y)),G=KZ.get(Q);if(G===void 0){try{let S=e$({loader:"ts",target:"browser",define:Y}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),G=S.transformSync(v)}catch{G=XK($)}KZ.set(Q,G)}let z={exports:{}},K=z.exports,q=J2.cwd(),W={},U=[...G.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((S)=>S[1]).filter((S)=>!S.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(S)),H=new Map;for(let S of U)try{if(S.startsWith(".")){W[S]=await import(o0.resolve(o0.dirname(J),S));continue}let v=o0.resolve(q,"node_modules",S),n=o0.join(v,"package.json"),Y0=JSON.parse(f("fs").readFileSync(n,"utf8")),U0=Y0.main||"index.js";if(Y0.exports){let M0=typeof Y0.exports==="string"?Y0.exports:Y0.exports["."];if(typeof M0==="string")U0=M0;else if(M0?.bun)U0=M0.bun;else if(M0?.import)U0=M0.import;else if(M0?.default)U0=M0.default}W[S]=await import(o0.resolve(v,U0))}catch(v){if(S.startsWith("."))H.set(S,v instanceof Error?v.message:String(v))}let j=(S)=>{if(W[S])return W[S];let v=H.get(S);if(v!==void 0)throw Error(`Cannot require '${S}' from ${J}: ${v}`);return f(S)},B=Z.props||{},V=(S)=>{if(!S)return B;let v={};for(let[n,Y0]of Object.entries(S)){let U0=B[n];if(U0!==void 0)v[n]=U0;else if(typeof Y0==="function")v[n]=Y0();else v[n]=Y0}return v};for(let[S,v]of Object.entries(B))Object.defineProperty(V,S,{value:v,enumerable:!0,configurable:!0,writable:!0});for(let S of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(B,S))continue;try{Object.defineProperty(V,S,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let L=(S)=>{if(!S)return B;let v={...B};for(let[n,Y0]of Object.entries(S)){let U0=Y0&&typeof Y0==="object"&&!Array.isArray(Y0)?Y0:{type:Y0};if(v[n]===void 0&&U0.default!==void 0)v[n]=typeof U0.default==="function"?U0.default():U0.default}return v},_=()=>Z.slots||{},F=(S,v)=>{let n={...S};for(let[Y0,U0]of Object.entries(v))if(n[Y0]===void 0)if(typeof U0==="function")n[Y0]=U0();else n[Y0]=U0;return n},O=(S)=>{let v=()=>S;return v.set=(n)=>{},v.update=(n)=>{},v},w=(S)=>{let v,n=!1;return()=>{if(!n)try{v=S(),n=!0}catch{v=void 0}return v}},N=(S)=>{},R=(S)=>S(),M=(S)=>{},T=(S)=>{},D=s3(Z);function I(S){let v=S||{};if(v.title!==void 0||v.description!==void 0)y({title:v.title,description:v.description})}function E(S){if(!S||typeof S!=="object")return;let v=Z.__stxClientPayload??{};Object.assign(v,S),Z.__stxClientPayload=v}let A=()=>{let S=Z.__stxServeContext,v=Z.__stxServeSearch??S?.search??"",n=S?.path??"",Y0=Object.fromEntries(new URLSearchParams(v)),U0=Z.query,M0=Object.keys(Y0).length>0?Y0:U0??{},Z1=v||(Object.keys(M0).length>0?`?${new URLSearchParams(M0).toString()}`:"");return{params:Z.params??{},query:M0,path:n,name:"",fullPath:n+Z1,hash:"",matched:[]}},k=()=>({push:(S)=>{},replace:(S)=>{},back:()=>{},forward:()=>{},go:(S)=>{}}),C=(S)=>{let v=Z.__stx_runtime_head||{};Z.__stx_runtime_head=wZ(v,S||{})},y=(S)=>{C(RZ(S||{}))},b=(S)=>({value:S}),P=(S)=>S,u=(S)=>({value:typeof S==="function"?S():S}),l=(S,v)=>{},g=(S)=>{},J0=(S)=>{},X0=(S)=>S?S():Promise.resolve(),$0=(S)=>(v,...n)=>{},c=(S)=>{},K0=(S,v)=>{},r=(S,v)=>v,V0=()=>({value:"light"}),$1=()=>O(!1),T0=(S)=>O(!1),p=()=>O(!1),m=()=>T0("(prefers-color-scheme: dark)"),i=()=>T0("(prefers-color-scheme: light)"),j0=()=>T0("(prefers-reduced-motion: reduce)"),a=()=>T0("(prefers-contrast: more)"),y0={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},U1=new Proxy(y0,{get(S,v){if(v in S)return S[v];return},set(S,v,n){return S[v]=n,!0}}),p9={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},Y2=console;try{let S=DZ(G,J),v=new Set(Object.keys(B)),n=Object.keys(Z).filter((t)=>!v.has(t)&&!$K.has(t)&&X2(t)),Y0=n.map((t)=>Z[t]);if(!n.includes("__stxServeContext"))n.push("__stxServeContext"),Y0.push(void 0);let U0=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),M0=[],Z1=[];for(let[t,u0]of Object.entries(B)){if(!X2(t))continue;if(U0.has(t))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${t}\\b`).test(S))continue;M0.push(t),Z1.push(u0)}let P0=JK(S).map((t)=>`module.exports.${t} = typeof ${t} !== 'undefined' ? ${t} : module.exports.${t};`).join(`
|
|
3590
|
+
`),h=Z.params??{},d=[],G0=[];for(let t=0;t<n.length;t++){if(n[t]==="params")continue;d.push(n[t]),G0.push(Y0[t])}let o=[...NZ,...M0,...d],F0=`return (async () => {
|
|
3591
|
+
${S}
|
|
3592
|
+
${P0}
|
|
3593
|
+
return module.exports
|
|
3594
|
+
})()`,O0=W1(F0,o.join("\x00")),C0=qZ.get(O0);if(!C0)C0=Function(...o,F0),qZ.set(O0,C0);let s0=Z.__stx_options?.runtimeConfig;if(s0||/\buse(?:Server)?RuntimeConfig\b/.test(G))await g9(Z,J,s0);let v0=await VZ(Z.__stx_runtime_config??OZ()??FZ(),()=>k6(Z,()=>C0(z,K,j,B,V,L,F,E,E6,LZ,_Z,O,w,N,R,M,T,I,A,k,C,y,D.setResponseStatus,D.setResponseHeader,D.notFound,b,P,u,l,g,J0,X0,$0,c,_,K0,r,V0,$1,T0,p,m,i,j0,a,U1,p9,Y2,y0.confirm,y0.alert,y0.fetch,h,...Z1,...G0)));if(X.preserveExisting){for(let[t,u0]of Object.entries(v0))if(!(t in Z)||Z[t]===void 0)Z[t]=u0}else Object.assign(Z,v0);for(let[t,u0]of Object.entries(B))if(!(t in Z))Z[t]=u0}catch(S){if(Z.__stx_strict_hydration)throw S;let v=S instanceof Error?S.message:String(S);if(YK(v))console.warn(`[stx] server <script> in ${J??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${v}`);else if(QK(S))console.warn(`[stx] server <script> in ${J??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${v}`);else if(GK(v))console.warn(`[stx] server <script> in ${J??"<unknown>"} names something that does not exist, so every variable in that script is undefined. Optional chaining does not help here: an undefined identifier throws before the chain is reached. Cause: ${v}`);else if(J2.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${J??"<unknown>"} \u2014 falling back to static extraction. Cause: ${v}`);try{await VK(G,Z,J)}catch(n){if(J2.env.STX_DEBUG){let Y0=n instanceof Error?n.message:String(n);console.warn(`[stx] fallback extraction also failed in ${J??"<unknown>"}: ${Y0}`)}}}}function KK($){let Z=0,J=null,X=!1,Y=!1;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(J){if(G===J){if(J=null,X||Z===0)Y=!0}continue}if(G==="'"||G==='"'||G==="`"){J=G;continue}if(G==="{")Z++;else if(G==="}")Z--;else if($.startsWith("from",Q)&&Z===0)X=!0}return J===null&&Z===0&&Y}var qK=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function DZ($,Z){let J=Z?o0.dirname(Z):J2.cwd(),X=J2.cwd(),Y=$.split(`
|
|
3595
|
+
`),Q=[],G=0;while(G<Y.length){let z=Y[G].trim();if(z.startsWith("interface ")||z.startsWith("export interface ")||z.startsWith("type ")||z.startsWith("export type ")){if(z.includes("{")&&!z.includes("}")){let K=0;for(;G<Y.length;G++){for(let q of Y[G])if(q==="{")K++;else if(q==="}")K--;if(K<=0)break}}G++;continue}if(z.startsWith("definePageMeta(")){let K=0,q=!1,W=G;for(let j=G;j<Y.length&&!q;j++){let B=null,V=!1,L=Y[j];for(let _=0;_<L.length;_++){let F=L[_];if(V){V=!1;continue}if(F==="\\"){V=!0;continue}if(B){if(F===B)B=null;continue}if(F==='"'||F==="'"||F==="`"){B=F;continue}if(F==="(")K++;else if(F===")"){if(K--,K===0){G=j+1,q=!0;break}}}}if(!q)G=Y.length;let U=Y.slice(W,G).join(`
|
|
3596
|
+
`),H=[];for(let j of["title","description"]){let B=new RegExp(`\\b${j}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(U);if(B)H.push(`${j}: ${JSON.stringify(B[2])}`)}if(H.length>0)Q.push(`useSeoMeta({ ${H.join(", ")} });`);continue}if(z.startsWith("import ")||z==="import"||z.startsWith("import{")){let K=z,q=0;while(!KK(K)&&G+q+1<Y.length)q++,K=`${K} ${Y[G+q].trim()}`;G+=q;let W=K.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),U=K.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),H=K.match(/^import\s+['"](.+?)['"]/),j=K,B=(V)=>{if(V.startsWith("."))return o0.resolve(J,V);if(V.startsWith("~/")||V.startsWith("@/"))return o0.resolve(X,V.slice(2));return V};if(W){let[,V,L]=W,_=B(L);Q.push(`const ${V} = (await import('${_}')).default`),Q.push(`module.exports.${V} = ${V};`)}else if(U){let[,V,L]=U,_=B(L),F=[],O=[],w=ZK.has(L);for(let N of V.split(",")){let R=N.trim();if(!R)continue;let M=R.split(/\s+as\s+/);if(M.length===2){let[T,D]=[M[0].trim(),M[1].trim()];if(w&&zZ.has(T)){Q.push(`const ${D} = ${T};`);continue}F.push(`${T}: ${D}`),O.push(D)}else{if(w&&zZ.has(R))continue;F.push(R),O.push(R)}}if(F.length>0)Q.push(`const { ${F.join(", ")} } = await import('${_}')`);for(let N of O)Q.push(`module.exports.${N} = ${N};`)}else if(H){let V=B(H[1]);Q.push(`await import('${V}')`)}else Q.push(j);G++;continue}if(qK.test(z))Q.push(Y[G]),G++;else if(z.startsWith("export const ")||z.startsWith("export let ")||z.startsWith("export var ")){let K=UZ(Y,G),{type:q,name:W,value:U}=K;Q.push(`${q} ${W} = ${U};`),Q.push(`module.exports.${W} = ${W};`),G=K.nextIndex}else if(z.startsWith("export function ")||z.startsWith("export async function ")){let K=t$(Y,G);Q.push(K.functionCode),Q.push(`module.exports.${K.name} = ${K.name};`),G=K.nextIndex}else if(z.startsWith("const ")||z.startsWith("let ")||z.startsWith("var ")){let K=UZ(Y,G),{type:q,name:W,value:U}=K;Q.push(`${q} ${W} = ${U};`),Q.push(`module.exports.${W} = ${W};`),G=K.nextIndex}else if(z.startsWith("function ")||z.startsWith("async function ")){let K=t$(Y,G);Q.push(K.functionCode),Q.push(`module.exports.${K.name} = ${K.name};`),G=K.nextIndex}else if(z.startsWith("export default function ")||z.startsWith("export default async function ")){let K=Y[G].replace(/^(\s*)export\s+default\s+/,"$1"),q=[...Y];q[G]=K;let W=t$(q,G);if(Q.push(W.functionCode),W.name)Q.push(`module.exports.default = ${W.name};`);G=W.nextIndex}else if(z.startsWith("export default ")){let K=z.replace(/^export\s+default\s+/,"").replace(/;$/,"");Q.push(`module.exports.default = ${K};`),G++}else if(z.startsWith("class ")||z.startsWith("export class ")){let K=z.match(/(?:export\s+)?class\s+(\w+)/);if(K){let q=K[1],W=Y[G].replace(/^export\s+/,""),U=0,H=G;for(;H<Y.length;H++){let j=Y[H];for(let B of j)if(B==="{")U++;else if(B==="}")U--;if(H>G)W+=`
|
|
3597
|
+
`+j;if(U<=0&&H>=G)break}Q.push(W),Q.push(`module.exports.${q} = ${q};`),G=H+1}else Q.push(z),G++}else if(z.includes("module.exports"))Q.push(z),G++;else if(z.trim()&&!z.startsWith("//"))Q.push(z),G++;else G++}return WK(Q.join(`
|
|
3598
|
+
`),J,X)}function WK($,Z,J){let X=$.length,Y="",Q=0,G=null,z=!1,K=!1,q=0;while(Q<X){let W=$[Q],U=$[Q+1];if(z){if(Y+=W,W===`
|
|
3599
|
+
`)z=!1;Q++;continue}if(K){if(Y+=W,W==="*"&&U==="/"){Y+=U,Q+=2,K=!1;continue}Q++;continue}if(!G&&W==="/"&&U==="/"){z=!0,Y+=W,Q++;continue}if(!G&&W==="/"&&U==="*"){K=!0,Y+=W,Q++;continue}if(G){if(Y+=W,W==="\\"){Y+=U,Q+=2;continue}if(W===G&&G!=="`"){G=null,Q++;continue}if(G==="`"){if(W==="$"&&U==="{"){q++,Y+=U,Q+=2;continue}if(W==="`"){G=null,Q++;continue}}Q++;continue}if(q>0){if(W==="{")q++;else if(W==="}")q--}if(W==='"'||W==="'"||W==="`"){G=W,Y+=W,Q++;continue}if(W==="a"&&$.startsWith("await",Q)){let H=UK($,Q);if(H){let{quote:j,path:B,end:V}=H;if(B.startsWith(".")||B.startsWith("~/")||B.startsWith("@/")){let L=B.startsWith(".")?o0.resolve(Z,B):o0.resolve(J,B.slice(2));Y+=`await import(${j}${L}${j})`,Q=V;continue}}}Y+=W,Q++}return Y}function UK($,Z){let J=Z+5;if(J>=$.length)return null;if(!/\s/.test($[J]))return null;while(J<$.length&&/\s/.test($[J]))J++;if(!$.startsWith("import",J))return null;J+=6;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return null;J++;while(J<$.length&&/\s/.test($[J]))J++;let X=$[J];if(X!=="'"&&X!=='"')return null;J++;let Y=J;while(J<$.length&&$[J]!==X)if($[J]==="\\")J+=2;else J++;if(J>=$.length)return null;let Q=$.slice(Y,J);J++;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!==")")return null;return{quote:X,path:Q,end:J+1}}function MZ($,Z){let J=$[Z];if(J!=="{"&&J!=="[")return null;let Y=N0($,J,J==="{"?"}":"]",Z);if(Y===-1)return null;return{pattern:$.slice(Z,Y+1),endPos:Y+1}}function AZ($){let Z=[],J=$.slice(1,-1).trim();if(!J)return Z;let X=0,Y=0,Q="";while(X<J.length){let G=J[X];if(G==="{"||G==="["){let z=Y===0?MZ(J,X):null;if(z){Z.push(...AZ(z.pattern)),X=z.endPos,Q="";continue}Y++}else if(G==="}"||G==="]")Y--;if(Y>0){X++;continue}if(G===","){if(Q.trim())Z.push(Q.trim());Q="",X++;continue}if(G===":"){Q="",X++;continue}if(G==="="){if(Q.trim())Z.push(Q.trim());Q="",X++;while(X<J.length&&J[X]!==","&&Y===0){if(J[X]==="{"||J[X]==="[")Y++;else if(J[X]==="}"||J[X]==="]")Y--;X++}continue}if(/[\w$]/.test(G))Q+=G;X++}if(Q.trim())Z.push(Q.trim());return Z}function HK($){let Z=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec($);if(!Z)return null;let J=Z[0].length,X=(Y)=>Y===" "||Y==="\t";while(J<$.length&&X($[J]))J++;if($[J]===":"){let Y=0,Q=null;J++;for(;J<$.length;J++){let G=$[J];if(Q){if(G==="\\"){J++;continue}if(G===Q)Q=null;continue}if(G==="'"||G==='"'||G==="`"){Q=G;continue}if(G==="("||G==="["||G==="{"||G==="<"){Y++;continue}if(G===")"||G==="]"||G==="}"||G===">"){Y--;continue}if(G==="="&&Y<=0){let z=$[J+1],K=$[J-1];if(z!=="="&&z!==">"&&K!=="="&&K!=="!"&&K!=="<"&&K!==">")break}}if($[J]!=="=")return null}while(J<$.length&&X($[J]))J++;if($[J]!=="=")return null;return{type:Z[1],name:Z[2],value:$.slice(J+1).trim()}}function WZ($,Z,J,X){let Y=null,Q=!1;for(let G of $){if(Q){Q=!1;continue}if(G==="\\"){Q=!0;continue}if(Y){if(G===Y)Y=null;continue}if(G==="'"||G==='"'||G==="`"){Y=G;continue}if(G===Z)X++;else if(G===J)X--}return X}function UZ($,Z){let J=$[Z].trim(),X=HK(J),Y=X?[J,X.type,X.name,X.value]:null;if(!Y){let W=J.match(/^(?:export\s+)?(const|let|var)\s+/);if(W){let U=J.slice(W[0].length),H=Z;if(U.startsWith("{")||U.startsWith("[")){let B=U[0],V=B==="{"?"}":"]",L=WZ(U,B,V,0),_=U;for(let F=Z+1;F<$.length&&L>0;F++)_+=` ${$[F].trim()}`,H=F,L=WZ($[F],B,V,L);if(L>0)_=U,H=Z;U=_}let j=MZ(U,0);if(j){let B=W[1],V=j.pattern,L=U.slice(j.endPos).trim();if(L.startsWith("=")){let _=L.slice(1).trim(),F=_,O=Math.max(H,Z);if(HZ(_)){let M=jZ($,O,_);F=M.value,O=M.nextIndex}else O=O+1;F=F.trim().replace(/;$/,"");let w=AZ(V),N=`__stx_src_${Z}`,R=w.map((M)=>`module.exports.${M} = ${M};`).join(`
|
|
3600
|
+
`);return{type:B,name:N,value:`${F}; ${B} ${V} = ${N};
|
|
3601
|
+
${R}`,nextIndex:O}}}}throw Error(`Failed to parse variable declaration: ${J}`)}let[,Q,G,z]=Y,K=z,q=Z;if(HZ(z)){let W=jZ($,Z,z);K=W.value,q=W.nextIndex}else q=Z+1;while(q<$.length){let W=$[q].trim();if(W.startsWith(".")||W.startsWith("?."))K+=`
|
|
3602
|
+
${$[q]}`,q++;else break}return K=K.trim().replace(/;$/,""),{type:Q,name:G,value:K,nextIndex:q}}function t$($,Z){let J=$[Z].trim(),X=J.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!X)throw Error(`Failed to parse function declaration: ${J}`);let[,Y]=X,Q=J.replace(/^export\s+/,""),G=Z;if(jK(J)){let z=BK($,Z,Q);Q=z.functionCode,G=z.nextIndex}else G=Z+1;return{name:Y,functionCode:Q,nextIndex:G}}function HZ($){let Z=$.trim();if(Z.startsWith("{"))return N0(Z,"{","}",0)===-1;if(Z.startsWith("["))return N0(Z,"[","]",0)===-1;return!IZ(Z)}function IZ($){let Z={paren:0,bracket:0,brace:0},J=null,X=0;for(let Y=0;Y<$.length;Y++){let Q=$[Y];if((Y>0?$[Y-1]:"")==="\\"&&J)continue;if((Q==='"'||Q==="'")&&!J){J=Q;continue}if(Q===J&&J!=="`"){J=null;continue}if(Q==="`"&&!J){J="`";continue}if(Q==="`"&&J==="`"&&X===0){J=null;continue}if(J==="`"&&Q==="$"&&$[Y+1]==="{"){X++,Y++;continue}if(X>0&&Q==="{"){X++;continue}if(X>0&&Q==="}"){X--;continue}if(J)continue;if(Q==="(")Z.paren++;else if(Q===")")Z.paren--;else if(Q==="[")Z.bracket++;else if(Q==="]")Z.bracket--;else if(Q==="{")Z.brace++;else if(Q==="}")Z.brace--}return Z.paren===0&&Z.bracket===0&&Z.brace===0&&J===null}function TZ($){let Z=$.indexOf("(");if(Z===-1)return $.indexOf("{");let J=N0($,"(",")",Z);if(J===-1)return-1;return $.indexOf("{",J)}function jK($){let Z=TZ($);if(Z===-1)return!0;return N0($,"{","}",Z)===-1}function jZ($,Z,J){let X=J,Y=Z+1;while(Y<$.length&&!IZ(X)){let Q=$[Y];X+=`
|
|
3603
|
+
${Q}`,Y++}while(Y<$.length){let Q=$[Y].trim();if(Q.startsWith(".")||Q.startsWith("?."))X+=`
|
|
3604
|
+
${$[Y]}`,Y++;else break}return{value:X,nextIndex:Y}}function BK($,Z,J){let X=J,Y=Z+1;while(Y<$.length){let Q=TZ(X);if(Q!==-1){if(N0(X,"{","}",Q)!==-1)break}let G=$[Y];X+=`
|
|
3605
|
+
${G}`,Y++}return{functionCode:X,nextIndex:Y}}function BZ($,Z){let J=Q0($,Z)??Q0(`(${$})`,Z);if(J!==void 0)return J;if(!/\bprocess\b/.test($))return;let X={...Z,process:Object.freeze({env:{...J2.env}})},Y=Object.keys(X).filter(X2),Q=Y.map((G)=>X[G]);try{return Function(...Y,`'use strict'; return (${$});`)(...Q)}catch{try{return Function(...Y,`'use strict'; return ${$};`)(...Q)}catch{return}}}async function VK($,Z,J){let X=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let Q of X){let[,,G,z]=Q;try{let K=z.trim().replace(/;$/,""),q=BZ(K,Z);if(q!==void 0)Z[G]=q}catch(K){console.warn(`Failed to parse export ${G} in fallback:`,K)}}let Y=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let Q of Y){let[,,G,z]=Q;if(!(G in Z))try{let K=z.trim().replace(/;$/,""),q=BZ(K,Z);if(q!==void 0)Z[G]=q}catch{}}}function OK($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=Z?Z[1]:"",X=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:J,templateWithoutScript:X}}function _K($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var P2=new o1(500),l9=new o1(1000),vZ=33554432,Z3=vZ;function LK($){let Z=$.componentRenderCacheBytes;if(typeof Z!=="number"||Z<0||Z===Z3)return;Z3=Z,c9.setMaxBytes(Z)}var c9=new o1(2000,{maxBytes:vZ,sizeOf:($)=>$.output.length});function FK($){let Z=new WeakSet;try{let J=(X)=>{if(X===void 0)return{__stxType:"undefined"};if(typeof X==="bigint")return{__stxType:"bigint",value:X.toString()};if(typeof X==="function"||typeof X==="symbol")throw TypeError("Non-serializable component input");if(X===null||typeof X!=="object")return X;if(Z.has(X))throw TypeError("Circular component input");if(Z.add(X),X instanceof Date)return{__stxType:"date",value:X.toISOString()};if(Array.isArray(X))return X.map(J);let Y={};for(let Q of Object.keys(X).sort())Y[Q]=J(X[Q]);return Y};return JSON.stringify(J($))}catch{return null}}function kZ($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function wK($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function M1($){return!wK($)}var d9=new Map;function e$($){let Z;try{Z=JSON.stringify($)}catch{return new Bun.Transpiler($)}let J=d9.get(Z);if(J)return J;if(d9.size>=16)d9.clear();let X=new Bun.Transpiler($);return d9.set(Z,X),X}var EZ=new WeakMap,RK=256;function A1($){try{let Z=e$({loader:"ts",target:"browser",define:$2()}),J=EZ.get(Z);if(!J)J=new Map,EZ.set(Z,J);let X=J.get($);if(X!==void 0)return X;let Y=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Y=Y.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Q=[];Y=Y.replace(/\{!![\s\S]*?!!\}/g,(z)=>{let K=Q.length;return Q.push(z),`"__STX_EXPR_${K}__"`}),Y=Y.replace(/\{\{\{[\s\S]*?\}\}\}/g,(z)=>{let K=Q.length;return Q.push(z),`"__STX_EXPR_${K}__"`}),Y=Y.replace(/\{\{[\s\S]*?\}\}/g,(z)=>{let K=Q.length;return Q.push(z),`"__STX_EXPR_${K}__"`});let G=Z.transformSync(Y);for(let z=0;z<Q.length;z++)G=G.replace(`"__STX_EXPR_${z}__"`,Q[z]),G=G.replace(`'__STX_EXPR_${z}__'`,Q[z]);if(J.size>=RK){let z=J.keys().next();if(!z.done)J.delete(z.value)}return J.set($,G),G}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function NK($){let Z=[],J=new Set,X=0,Y=0,Q=$.length,G=(W)=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]===W){Y++;return}Y++}},z=()=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`"){Y++;return}if($[Y]==="$"&&$[Y+1]==="{"){Y+=2;let W=1;while(Y<Q&&W>0)if($[Y]==="{")W++,Y++;else if($[Y]==="}")W--,Y++;else if($[Y]==="'"||$[Y]==='"')G($[Y]);else if($[Y]==="`")z();else Y++;continue}Y++}},K=()=>{if($[Y]==="/"&&$[Y+1]==="/"){while(Y<Q&&$[Y]!==`
|
|
3606
|
+
`)Y++;return!0}if($[Y]==="/"&&$[Y+1]==="*"){Y+=2;while(Y<Q-1&&!($[Y]==="*"&&$[Y+1]==="/"))Y++;return Y+=2,!0}return!1},q=()=>{if(X!==0)return;let W=$.slice(Y).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(W){let B=W[2].split(",").map((V)=>{let L=V.trim().split(":");return L[L.length-1].trim()});for(let V of B)if(V&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(V)&&!J.has(V))Z.push(V),J.add(V);return}let U=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let B=U[2];if(!J.has(B))Z.push(B),J.add(B);return}let H=$.slice(Y).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let B=H[1];if(!J.has(B))Z.push(B),J.add(B);return}let j=$.slice(Y).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!J.has(B))Z.push(B),J.add(B)}};while(Y<Q){if(K())continue;if($[Y]==="'"||$[Y]==='"'){G($[Y]);continue}if($[Y]==="`"){z();continue}if($[Y]==="{"){X++,Y++;continue}if($[Y]==="}"){X--,Y++;continue}if(X===0&&/[a-z]/i.test($[Y])&&(Y===0||/\s|[;{}()]/.test($[Y-1])))q();Y++}return Z}function DK($){let Z=[],J=0,X=0,Y=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(Y){if(G==="\\"){Q++;continue}if(G===Y)Y=null;continue}if(G==='"'||G==="'"||G==="`"){Y=G;continue}if(G==="("||G==="["||G==="{")J++;else if(G===")"||G==="]"||G==="}")J--;else if(G===","&&J===0)Z.push($.slice(X,Q)),X=Q+1}if(X<$.length)Z.push($.slice(X));return Z}function MK($){let Z=0,J=null;for(let X=0;X<$.length;X++){let Y=$[X];if(J){if(Y==="\\"){X++;continue}if(Y===J)J=null;continue}if(Y==='"'||Y==="'"||Y==="`"){J=Y;continue}if(Y==="("||Y==="["||Y==="{")Z++;else if(Y===")"||Y==="]"||Y==="}")Z--;else if(Y==="="&&Z===0){let Q=$[X-1],G=$[X+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return X}}return-1}function AK($,Z){try{let J=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!J)return;let X=J.index-1;while(X>=0&&/\s/.test($[X]))X--;if($[X]!=="}")return;let Y=X,Q=0,G=-1;for(;X>=0;X--){let K=$[X];if(K==="}")Q++;else if(K==="{"){if(Q--,Q===0){G=X;break}}}if(G===-1)return;let z=$.slice(G+1,Y);for(let K of DK(z)){let q=K.trim();if(!q||q.startsWith("..."))continue;let W=MK(q);if(W===-1)continue;let U=q.slice(0,W).trim();if(!/^[A-Z_$][\w$]*$/i.test(U))continue;if(Z[U]!==void 0)continue;let H=q.slice(W+1).trim();if(!H)continue;try{let j=Object.keys(Z).filter(X2),B=Function(...j,`"use strict"; return (${H});`);Z[U]=B(...j.map((V)=>Z[V]))}catch{}}}catch{}}async function F9($,Z,J,X,Y){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(_)=>_.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""),z=(_)=>_.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),K=J.__importedComponents;if(K){for(let _ of[Q,Q.toLowerCase(),G(Q),z(Q)])if(K.has(_))return!0}let q=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${z(Q)}.stx`])],W=typeof Y.root==="string"?x.resolve(Y.root):void 0,U=W??x.dirname(X),H=[],j=(_)=>{if(_&&!H.includes(_))H.push(_)},B=J.__originalFilePath;if(B)j(x.join(x.dirname(B),"components"));if(j(Z),j(Y._rootComponentsDir),j(x.join(x.dirname(X),"components")),j(Y.componentsDir),W)j(x.resolve(W,"resources/views/components")),j(x.resolve(W,"resources/components")),j(x.resolve(W,"src/components")),j(x.resolve(W,"components"));for(let _ of Y._layerComponentDirs??[])j(_);let V=Y._pluginComponentDirs;if(Array.isArray(V))for(let _ of V)j(typeof _==="string"?_:null);if(j(Y.fallbackComponentsDir),Q.startsWith("./")||Q.startsWith("../"))return e(x.resolve(x.dirname(X),`${Q}.stx`));let L=bZ(x.resolve(import.meta.dir,"components"));for(let _ of H){let F=x.isAbsolute(_)?_:x.resolve(U,_);if(bZ(F)===L)continue;for(let O of q)if(await e(x.join(F,O)))return!0}return!1}function bZ($){try{return PZ.realpathSync($)}catch{return $}}function IK($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function TK($){if(!$)return!1;let Z=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z)}function kK($){let Z=new Set,J=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let X of $){let Y;while((Y=J.exec(X))!==null)Z.add(Y[1]);J.lastIndex=0}return[...Z]}async function D1($,Z,J,X,Y,Q,G,z=new Set,K){let{extractVariables:q}=await s("stx/variable-extractor",()=>import("./chunk-4pcjt99d.js")),W=z??new Set;if(W.has($))return`[Circular component reference: ${$}]`;let U=new Set(W);U.add($);let H=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let j=H&&H!=="load"&&IK(H)?H:"";try{let B=(h)=>h.split("-").map((d)=>d.charAt(0).toUpperCase()+d.slice(1)).join(""),V=(h)=>h.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),L=$.endsWith(".stx")?$.slice(0,-4):$,_=null,F=Y.__importedComponents;if(F){let h=[L,L.toLowerCase(),B(L),V(L)];for(let d of h)if(F.has(d)){_=F.get(d);break}}let O=[];if(!_){let h=[`${L}.stx`,`${B(L)}.stx`,`${V(L)}.stx`],d=[...new Set(h)],G0=Y.__originalFilePath,o=[];if(o.push(...G._layerComponentDirs??[]),G0){let A0=x.join(x.dirname(G0),"components");o.push(A0)}if(X)o.push(X);let F0=G._rootComponentsDir;if(typeof F0==="string"&&!o.includes(F0))o.push(F0);let O0=x.join(x.dirname(Q),"components");if(!o.includes(O0))o.push(O0);if(G.componentsDir&&G.componentsDir!==X&&!o.includes(G.componentsDir))o.push(G.componentsDir);let C0=typeof G.root==="string"?x.resolve(G.root):void 0,s0=C0??x.dirname(Q),v0=[];if(C0)v0.push(x.resolve(C0,"resources/views/components")),v0.push(x.resolve(C0,"resources/components")),v0.push(x.resolve(C0,"src/components")),v0.push(x.resolve(C0,"components"));v0.push(x.resolve(import.meta.dir,"components"));for(let A0 of v0)if(!o.includes(A0))o.push(A0);let t=G._pluginComponentDirs;if(Array.isArray(t)){for(let A0 of t)if(typeof A0==="string"&&!o.includes(A0))o.push(A0)}if(G.fallbackComponentsDir&&!o.includes(G.fallbackComponentsDir))o.push(G.fallbackComponentsDir);let u0=[...new Set(o.map((A0)=>{if(!A0)return A0;return x.isAbsolute(A0)?A0:x.resolve(s0,A0)}))];o.length=0,o.push(...u0);let f2=`${L}\x00${Q}\x00${u0.join("\x00")}`,i9=l9.get(f2);if(i9)if(await e(i9))_=i9;else l9.delete(f2);if(!_&&(L.startsWith("./")||L.startsWith("../")))_=x.resolve(x.dirname(Q),`${L}.stx`),O.push(_);else if(!_)for(let A0 of o){if(!A0)continue;for(let x2 of d){let g2=x.join(A0,x2);if(O.push(g2),await e(g2)){_=g2;break}}if(_)break;if(!_)try{let x2=await import("fs");if(!x2.statSync(A0,{throwIfNoEntry:!1})?.isDirectory())continue;let iZ=8,n9=[{path:A0,depth:0}];while(n9.length>0&&!_){let h2=n9.pop();if(h2.depth>=iZ)continue;let Q3;try{Q3=x2.readdirSync(h2.path,{withFileTypes:!0})}catch{continue}for(let u2 of Q3){if(!u2.isDirectory())continue;if(u2.name==="node_modules"||u2.name.startsWith("."))continue;let G3=x.join(h2.path,u2.name);for(let nZ of d){let o9=x.join(G3,nZ);if(O.push(o9),await e(o9)){_=o9;break}}if(_)break;n9.push({path:G3,depth:h2.depth+1})}}}catch{}if(_)break}if(_)l9.set(f2,_)}if(!_||!await e(_)){let h=O.length>0?`
|
|
3607
|
+
Searched paths:
|
|
3608
|
+
${O.map((d)=>` - ${d}`).join(`
|
|
3609
|
+
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${h}`}K.add(_);let w;if(P2.has(_))w=P2.get(_);else try{w=await Bun.file(_).text(),P2.set(_,w)}catch(h){return`[Error loading component: ${h instanceof Error?h.message:String(h)}]`}let N=new Set(["__originalFilePath","__importedComponents",m2,"__stx_client_signal_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),R={};for(let[h,d]of Object.entries(Y))if(!h.startsWith("__")||N.has(h))R[h]=d;let M=J;if(J.includes("@include")){let{processIncludes:h}=await s("stx/includes",()=>import("./chunk-4jj4kk18.js"));M=await h(J,Y,Q,G,K)}let T=c0(M),D=[],I=T.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(h,d)=>{let G0=T.scripts[Number(d)]||"",o=G0.match(/^<script\b([^>]*)>/i)?.[1]||"",F0=o.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),O0=!F0||["module","text/javascript","application/javascript"].includes(F0);if(!/\bserver\b/i.test(o)&&O0)return D.push(G0),"";return G0}),{extractSlotContent:E}=await s("stx/slots",()=>import("./chunk-qhdp0ycf.js")),A=E(I),k={};if(A.defaultSlot?.trim())k.default=A.defaultSlot;for(let[h,d]of A.namedSlots)k[h]=d.content;let C=Y.__stx_scope_seq??={n:0,key:Bun.hash(String(Y.__filename??Q)).toString(36).slice(0,6)},y=`stx_${L.replace(/[^a-zA-Z0-9]/g,"_")}_${++C.n}_${C.key}`,b={...R,$uid:y,...Z,props:Z,slot:I,$slots:k,__processedComponents:U,__sections:{},__stx_signals_gate:J1(w)||TK(J)};AK(w,b);let P=w,u=q9(P);if(u)P=u.content.trim();let l=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g=[...w.matchAll(l)],J0=[],X0=g.some((h)=>/\bserver\b/.test(h[1]||"")&&/\bcache\b/.test(h[1]||"")),$0=null,c=null,K0=null,r=0,V0=null;if(LK(G),X0&&Z3>0){let h=FK({props:Z,slot:J,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0,layers:G._layerGraph?.layers.map((d)=>d.configFile),uid:y});if(h!==null){$0=`${_}\x00${W1(w)}\x00${h}`;let d=c9.get($0);if(d){for(let G0 of d.dependencies)K.add(G0);if(F3(Y,d.clientFactories),C.n+=d.uidsConsumed,d.preservedClientExpressions.length>0){let G0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let o of d.preservedClientExpressions)G0.add(o);Y.__stx_preserved_client_expressions=[...G0]}return d.output}c=new Set(K),K0=_3(Y),r=C.n,V0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[])}}let $1=new Set;for(let h of g){let d=h[1]||"",G0=h[2]||"",o=d.includes("server");if(M1(d)&&G0.trim())G0=A1(G0);if(o&&G0){for(let O0 of y1(G0))$1.add(O0);try{await q(G0,b,_)}catch(O0){}}if(!o){let O0=G0.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),C0=O0.includes("{{")&&O0.includes("}}"),s0=O0.includes("{!!")&&O0.includes("!!}");if(C0||s0)O0=J5(O0,b);let v0=d.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");J0.push(`<script${v0}>${O0}</script>`)}}let T0=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),p=T0?T0[1]:"",m=T0?T0[2]:"",i="",j0=p&&/\bscoped\b/i.test(p);if(T0)i=`<style${p}>${m}</style>`;let a=P;if(a=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),T0)a=a.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let h=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,d=[];if(a=a.replace(h,(G0,o)=>{let F0=o.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(F0)d.push(`<style${F0[1]}>${F0[2]}</style>`);return""}),a=a.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),d.length>0)i=`${i}${d.join(`
|
|
3610
|
+
`)}`}if(J&&a.includes("{{ text || slot }}"))a=a.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>J);let{applySlots:y0}=await s("stx/slots",()=>import("./chunk-qhdp0ycf.js")),{defaultSlot:U1,namedSlots:p9}=A,Y2=J0.some((h)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(h)),S=(h)=>Y2?_8(h,y):h,v=new Map([...p9].map(([h,d])=>[h,{...d,content:S(d.content)}]));a=await y0(a,S(U1),v,b);let n=kK(J0),Y0=(Array.isArray(b.__stx_client_signal_names)?b.__stx_client_signal_names:[]).filter((h)=>!$1.has(h));if(n.length>0||Y0.length>0)b.__stx_client_signal_names=[...new Set([...Y0,...n])];else delete b.__stx_client_signal_names;let U0={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:x.dirname(_),skipSignalsRuntime:!0,skipEventDirectives:Y2||J0.length===0,defaultLayout:void 0};b.__stxProcessingDepth=(Y.__stxProcessingDepth||0)+1;let M0=await n$(a,b,_,U0,K),Z1=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let h of M0.matchAll(/\{\{([\s\S]*?)\}\}/g))Z1.add(h[1].trim());if(Z1.size>0)Y.__stx_preserved_client_expressions=[...Z1];let H1=y,P0=M0;if(Y2){let h="";if(Object.keys(Z).length>0)try{h=` data-stx-props="${kZ(JSON.stringify(Z))}"`}catch{}let d=j?` stx-hydrate="${kZ(j)}"`:"";P0=`<div data-stx-scope="${H1}"${h}${d}>${M0}</div>`;let G0=await Promise.all(J0.map(async(o)=>{let F0=o.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!F0)return o;let[,O0,C0]=F0,{vendorStyleTags:s0,factoryBody:v0}=await yK(C0,_,G.buildMode==="compile"),t=j?null:a9(Y,v0),u0=t?`window.__stxComponentFactories[${JSON.stringify(t)}](${JSON.stringify(H1)});`:`(${v0})(${JSON.stringify(H1)});`;if(j)return`${s0}<script type="stx/island" data-stx-island="${H1}" data-stx-scoped data-stx-owner="${H1}"${O0}>${u0}</script>`;return`${s0}<script data-stx-scoped data-stx-run="always" data-stx-owner="${H1}"${O0}>${u0}</script>`}));if(P0=P0+`
|
|
3611
|
+
`+G0.join(`
|
|
3612
|
+
`),i)P0+=`
|
|
3613
|
+
`+i}else{if(i)P0+=`
|
|
3614
|
+
`+i;if(J0.length>0){let h=b.__stx_event_bindings||[],d=v9(b),G0=await Promise.all(J0.map(async(o)=>{let F0=o.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!F0)return o;return await f9(F0[1],{eventBindings:h,templateContent:P0,filePath:_,projectRoot:process.cwd(),serverData:d,instanceId:y})}));P0+=`
|
|
3615
|
+
`+G0.join(`
|
|
3616
|
+
`),b.__stx_event_bindings=[]}}if(j0){let h=x9(P0,_);if(h.hasScoped)P0=h.html}if($0&&c){let h=Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[];c9.set($0,{output:P0,dependencies:[...K].filter((d)=>!c.has(d)),clientFactories:K0?L3(Y,K0):[],uidsConsumed:C.n-r,preservedClientExpressions:V0?h.filter((d)=>!V0.has(d)):[]})}return D.length>0?`${P0}
|
|
3617
|
+
${D.join(`
|
|
3618
|
+
`)}`:P0}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{W.delete($)}}async function e($){return Bun.file($).exists()}function J3($,Z){let J=x.resolve(Z),X=x.resolve($),Y=J.endsWith(x.sep)?J:J+x.sep;if(X===J||X.startsWith(Y))return X;return null}async function EK($,Z,J,X){let Y=Z.startsWith("layouts/")?Z.slice(8):Z,Q=x.join($,Y);for(let G of Q.endsWith(".stx")?[Q]:[Q,`${Q}.stx`])if(await e(G)){if(X)console.log(`Found layout in ${$}: ${G}`);return J?.add(G),G}return null}async function e2($,Z,J,X){let Y=await bK($,Z,J,X);if(Y===null)return null;let Q=J3(Y,process.cwd());if(Q)return Q;let G=[J.root,J.layoutsDir,J.fallbackLayoutsDir,J.componentsDir,J.partialsDir,J.pagesDir,...J._layerLayoutDirs??[]].filter((z)=>typeof z==="string"&&z.length>0);for(let z of G){let K=x.isAbsolute(z)?z:x.resolve(process.cwd(),z);if(J3(Y,K))return x.resolve(Y)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${Y} (template: ${$}, from: ${Z})`),null}async function bK($,Z,J,X){if(J.debug)console.log(`Resolving template path: ${$} from ${Z}`);let Y=x.dirname(Z),Q=process.cwd();if($.startsWith("/")){let H=x.join(Q,$),j=J3(H,Q);if(!j)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(J.debug)console.log(`Checking absolute path: ${j}`);if(await e(j)&&X)X.add(j);return j}let G=x.join(Y,$);if(await e(G)){if(J.debug)console.log(`Found direct path: ${G}`);if(X)X.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let H of[".stx",".tsx",".jsx"]){let j=`${G}${H}`;if(await e(j)){if(J.debug)console.log(`Found direct path with extension: ${j}`);if(X)X.add(j);return j}}let z=[];if(z.push(...J._layerLayoutDirs??[]),J.layoutsDir)z.push(x.isAbsolute(J.layoutsDir)?J.layoutsDir:x.resolve(process.cwd(),J.layoutsDir));let K=x.resolve(Y),q=process.cwd();for(let H=0;H<10;H++){let j=x.join(K,"layouts"),B=!1;try{B=PZ.statSync(j,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(B){z.push(j);break}let V=x.dirname(K);if(V===K||V.length<q.length)break;K=V}for(let H of z){let j=await EK(H,$,X,J.debug);if(j)return j}if(J.fallbackLayoutsDir){let H=x.isAbsolute(J.fallbackLayoutsDir)?J.fallbackLayoutsDir:x.resolve(process.cwd(),J.fallbackLayoutsDir),j=$.startsWith("layouts/")?$.slice(8):$,B=[x.join(H,j)];if(!$.endsWith(".stx"))B.push(`${B[0]}.stx`);for(let V of B)if(await e(V)){if(J.debug)console.log(`Found in options.fallbackLayoutsDir: ${V}`);if(X)X.add(V);return V}}if($.startsWith("layouts/")||$.includes("/layouts/")){let H=$.split("layouts/"),j=x.join(J.partialsDir||Y,"layouts",H[1]);if(await e(j)){if(J.debug)console.log(`Found in layouts path: ${j}`);if(X)X.add(j);return j}if(!j.endsWith(".stx")){let B=`${j}.stx`;if(await e(B)){if(J.debug)console.log(`Found in layouts path with extension: ${B}`);if(X)X.add(B);return B}}}if(J.partialsDir){let H=x.join(J.partialsDir,"layouts");if(await e(H)){let j=x.join(H,$);if(await e(j)){if(J.debug)console.log(`Found in partials layouts dir: ${j}`);if(X)X.add(j);return j}if(!$.endsWith(".stx")){let B=`${j}.stx`;if(await e(B)){if(J.debug)console.log(`Found in partials layouts dir with extension: ${B}`);if(X)X.add(B);return B}}}}let W=J.partialsDir||x.join(process.cwd(),"views"),U=x.join(W,$);if(await e(U)){if(J.debug)console.log(`Found in views path: ${U}`);if(X)X.add(U);return U}if(!$.endsWith(".stx")){let H=`${U}.stx`;if(await e(H)){if(J.debug)console.log(`Found in views path with extension: ${H}`);if(X)X.add(H);return H}}if(Y.includes("temp")){let H=x.join(x.dirname(Y),"layouts",$);if(await e(H)){if(J.debug)console.log(`Found in temp layouts dir: ${H}`);if(X)X.add(H);return H}if(!$.endsWith(".stx")){let j=`${H}.stx`;if(await e(j)){if(J.debug)console.log(`Found in temp layouts dir with extension: ${j}`);if(X)X.add(j);return j}}}if(J.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${Z})`);else console.warn(`Template not found: ${$} (referenced from ${Z})`);return null}function fZ($,Z,J){let X=0,Y="",Q="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
|
|
3619
|
+
`),z=0;for(let K=0;K<G.length;K++)if(z+=G[K].length+1,z>=Z){X=K+1,Y=G[K].trim();let q=Math.max(0,K-2),W=Math.min(G.length,K+3);Q=G.slice(q,W).map((U,H)=>{let j=q+H+1;return`${j===X?"> ":" "}${j}: ${U}`}).join(`
|
|
3620
|
+
`);break}}else if(J){let G=$.indexOf(J);if(G>=0)return fZ($,G)}}catch{}return{lineNumber:X,lineContent:Y,context:Q}}var Z0={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"};function _0($,Z,J,X,Y,Q){let{lineNumber:G,context:z}=fZ(X,Y,Q),K=J.split("/").pop(),q=0;if(typeof Y==="number"&&Y>=0&&X){let U=X.lastIndexOf(`
|
|
3621
|
+
`,Math.max(0,Y-1));q=Y-(U+1)+1}let W="";if(G>0)W+=`
|
|
3622
|
+
${J}:${G}${q>0?`:${q}`:""}: ${$.toLowerCase()} error: ${Z}
|
|
3623
|
+
`;if(W+=`
|
|
3624
|
+
${Z0.bold}${Z0.red}\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E${Z0.reset}
|
|
3625
|
+
`,W+=`${Z0.bold}${Z0.red}\u2502${Z0.reset} ${Z0.bold}${Z0.bgRed} ERROR ${Z0.reset} ${Z0.red}${$} Error${Z0.reset}${" ".repeat(Math.max(0,43-$.length))}${Z0.bold}${Z0.red}\u2502${Z0.reset}
|
|
3626
|
+
`,W+=`${Z0.bold}${Z0.red}\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F${Z0.reset}
|
|
3627
|
+
`,W+=`
|
|
3628
|
+
${Z0.cyan}${Z0.bold}File:${Z0.reset} ${Z0.dim}${K}${Z0.reset}`,G>0)W+=` ${Z0.gray}(line ${G}${q>0?`, col ${q}`:""})${Z0.reset}`;if(W+=`
|
|
3629
|
+
${Z0.yellow}${Z0.bold}Message:${Z0.reset} ${Z}
|
|
3630
|
+
`,z)W+=`
|
|
3631
|
+
${Z0.blue}${Z0.bold}Context:${Z0.reset}
|
|
3632
|
+
${Z0.dim}${z}${Z0.reset}
|
|
3633
|
+
`;return W}function HL(){P2.clear(),l9.clear(),c9.clear()}function jL(){return{size:P2.size,maxSize:500}}var $3=E1(128);async function yK($,Z,J){let X=W1($,Z,J),Y=$3.get(X);if(Y){if(SZ(Y.deps))return Y;$3.delete(X)}let Q=X3($,{filePath:Z,projectRoot:process.cwd()}),G=Q.code,z=Y3(Q.styles);G=e1(G).code;let{hasUserImports:K,bundleClientScript:q}=await s("stx/client-script-bundler",()=>import("./chunk-f08ttkqr.js")),W=[],U=!1;if(K(G)){let _=G;G=await q(_,Z,{projectRoot:process.cwd(),minify:J,collectInputs:W}),U=G===_}let{stripStxRuntimeImports:H}=await s("stx/signal-processing",()=>import("./chunk-kdwerx8e.js"));G=H(G);let j=t0(G),B=NK(j),V=`function(__scopeId) {
|
|
3634
|
+
${n1("const",[...yZ,...B],j)}
|
|
3635
|
+
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
3636
|
+
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
3637
|
+
__scopeVars.$refs = __scopeVars.$refs || {};
|
|
3638
|
+
const __previousCurrentElement = window.__STX_CURRENT_ELEMENT__;
|
|
3639
|
+
window.__STX_CURRENT_ELEMENT__ = document.querySelector('[data-stx-scope="' + __scopeId + '"]');
|
|
3640
|
+
|
|
3641
|
+
// Scope-specific lifecycle callbacks
|
|
3642
|
+
__scopeVars.__mountCallbacks = __scopeVars.__mountCallbacks || [];
|
|
3643
|
+
__scopeVars.__destroyCallbacks = __scopeVars.__destroyCallbacks || [];
|
|
3644
|
+
const onMount = (fn) => __scopeVars.__mountCallbacks.push(fn);
|
|
3645
|
+
const onDestroy = (fn) => __scopeVars.__destroyCallbacks.push(fn);
|
|
3646
|
+
|
|
3647
|
+
try {
|
|
3648
|
+
${j}
|
|
3649
|
+
|
|
3650
|
+
// Register all defined signals and functions in this scope
|
|
3651
|
+
const __localVars = {};
|
|
3652
|
+
try {
|
|
3653
|
+
${B.map((_)=>`if (typeof ${_} !== 'undefined') __localVars['${_}'] = ${_};`).join(`
|
|
3654
|
+
`)}
|
|
3655
|
+
}
|
|
3656
|
+
catch (e) {}
|
|
3657
|
+
Object.assign(__scopeVars, __localVars);
|
|
3658
|
+
}
|
|
3659
|
+
finally {
|
|
3660
|
+
window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
|
|
3661
|
+
}
|
|
3662
|
+
}`,L={vendorStyleTags:z,factoryBody:V,deps:CZ([...W,...Q.styles.map((_)=>_.resolvedPath)])};if(!U&&Q.unresolved.length===0)$3.set(X,L);return L}var CK=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function SK($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let J=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!J)return null;return{pkg:J[1],subpath:J[2]||""}}let Z=$.match(/^([^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}function PK($,Z){let J=Z;while(!0){let X=C1.join(J,"node_modules",$,"package.json");if(v2.existsSync(X))return C1.dirname(X);let Y=C1.dirname(J);if(Y===J)return null;J=Y}}function vK($,Z){if(!$||typeof $!=="object")return null;let J=(Y)=>{if(typeof Y==="string")return Y;if(Y&&typeof Y==="object"){if(typeof Y.import==="string")return Y.import;if(typeof Y.default==="string")return Y.default;if(typeof Y.import==="object")return J(Y.import);if(typeof Y.default==="object")return J(Y.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return J($[Z]);let X=null;for(let Y of Object.keys($)){let Q=Y.indexOf("*");if(Q===-1)continue;let G=Y.slice(0,Q),z=Y.slice(Q+1);if(!Z.startsWith(G)||!Z.endsWith(z))continue;if(Z.length<G.length+z.length)continue;if(!X||G.length>X.prefix.length)X={pattern:Y,prefix:G,suffix:z}}if(X){let Y=Z.slice(X.prefix.length,Z.length-X.suffix.length),Q=J($[X.pattern]);if(Q)return Q.replace("*",Y)}return null}function fK($,Z){let J=SK($);if(!J||!J.subpath)return null;let X=PK(J.pkg,Z);if(!X)return null;let Y;try{Y=JSON.parse(v2.readFileSync(C1.join(X,"package.json"),"utf8"))}catch{return null}let Q=`.${J.subpath}`,G=vK(Y.exports,Q);if(!G)return null;let z=C1.resolve(X,G);return v2.existsSync(z)?z:null}function X3($,Z){let J=Z.filePath?C1.dirname(Z.filePath):Z.projectRoot||process.cwd(),X=Z.projectRoot||process.cwd(),Y=new Set,Q=[],G=[];return{code:$.replace(CK,(K,q)=>{let W;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(W=q.startsWith("/")?q:C1.resolve(J,q),!v2.existsSync(W))throw Error(`file not found: ${W}`)}else{let U=null;try{U=Bun.resolveSync(q,X)}catch{U=fK(q,X)}if(!U)throw Error(`could not resolve ${q} (Bun.resolveSync + exports fallback both failed)`);W=U}}catch(U){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(q)} (from ${Z.filePath||"<unknown>"}): ${U?.message||U}`),G.push(q),""}if(Y.has(W))return"";Y.add(W);try{let U=v2.readFileSync(W,"utf8");Q.push({source:q,resolvedPath:W,contents:U})}catch(U){console.warn(`[stx:vendor-css] could not read ${W}: ${U?.message||U}`),G.push(q)}return""}),styles:Q,unresolved:G}}function xK($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Y3($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${xK(Z.source)}" data-stx-layer="vendor">
|
|
3663
|
+
@layer vendor {
|
|
3664
|
+
${Z.contents}
|
|
3665
|
+
}
|
|
3666
|
+
</style>`}).join(`
|
|
3667
|
+
`)}
|
|
3668
|
+
`}var gK=S2;function e1($){let Z=W0($),J=new Set;for(let z of $.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let K of z[1].split(",")){let q=K.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(q)J.add(q)}let X=new Set;for(let z of Z.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))X.add(z[1]);for(let z of Z.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let K of z[1].split(",")){let q=K.trim().split(/[:=]/).pop()?.trim();if(q)X.add(q)}let Y=k1.filter((z)=>{if(J.has(z)||X.has(z))return!1;return cZ(Z,z,!0)}),Q=dZ(Z).filter((z)=>!J.has(z)&&!X.has(z));if(Y.length===0&&Q.length===0)return{code:$,imports:Y,models:Q};return{code:`${[Y.length>0?`import { ${Y.join(", ")} } from '@stacksjs/browser'`:"",Q.length>0?"import '@stacksjs/browser'":"",Q.length>0?`const { ${Q.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
|
|
3669
|
+
`)}
|
|
3670
|
+
${$}`,imports:Y,models:Q}}var hK=new Set(["Promise","Object","Array","Map","Set","Date","Error","JSON","Math","Number","String","RegExp","Symbol","WeakMap","WeakSet","Proxy","Reflect","Intl","URL","URLSearchParams","FormData","Headers","Request","Response","AbortController","EventTarget","Element","Document","Node","Window","Console","Storage","Navigator","Blob","File","FileReader","HTMLElement","SVGElement","Event","CustomEvent","DOMParser","XMLSerializer","WebSocket","Worker","SharedWorker","IntersectionObserver","MutationObserver","ResizeObserver","PerformanceObserver","Notification","Bun","Buffer","Process","Modal","Intl"]);function dZ($){let Z=new Set,J=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,X;while((X=J.exec($))!==null)if(!hK.has(X[1]))Z.add(X[1]);return Array.from(Z)}function uK($){let Z=new Set;for(let J of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))Z.add(J[1]);for(let J of $.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let X of J[1].split(",")){let Y=X.trim().split(/[:=]/).pop()?.trim();if(Y&&/^[A-Za-z_$][\w$]*$/.test(Y))Z.add(Y)}return Z}function lZ($){let Z=new Set,J=new Set,X=$;X=X.replace(/^[ \t]*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"][ \t]*;?[ \t]*$/gm,"// [type import stripped]");let Y=new Set,Q=/^[ \t]*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"][ \t]*;?[ \t]*$/gm,G;while((G=Q.exec($))!==null){let U=G[1],H=G[2];if(G[0].includes("import type"))continue;let j=[];for(let V of U.split(",")){let L=V.trim();if(!L||L.startsWith("type "))continue;let _=L.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!_)continue;let F=_[1],O=_[2]||F;if(Y.add(F),Y.add(O),H==="stx"||H==="@stacksjs/stx")Z.add(F);else J.add(F);if(O!==F)j.push(`${O} = ${F}`)}let B=j.length>0?`var ${j.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";X=X.replace(G[0],B)}let z=uK(X);for(let U of gK){if(Y.has(U)||z.has(U))continue;if(new RegExp(`\\b${U}\\s*(?:<[^>]*>)?\\s*\\(`,"g").test(X))Z.add(U)}let K=W0(X),q=new Set;for(let U of X.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let H of U[1].split(",")){let j=H.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let B of j){let V=B.trim();if(V)q.add(V)}}for(let U of k1){if(Y.has(U)||z.has(U)||q.has(U))continue;if(cZ(K,U))J.add(U)}let W=dZ(X);for(let U of W)if(!Y.has(U)&&!z.has(U))J.add(U);return{code:X,stxImports:Array.from(Z),browserImports:Array.from(J)}}function cZ($,Z,J=!1){let X=new RegExp(`\\b${Z.replace(/[$]/g,"\\$")}\\b`,"g");for(let Y of $.matchAll(X)){let Q=Y.index??0,G=Q+Z.length,z=Q-1;while(z>=0&&/\s/.test($[z]))z--;if($[z]==="."&&$.slice(Math.max(0,z-2),z+1)!=="...")continue;let K=G;while(K<$.length&&/\s/.test($[K]))K++;if($[K]===":"&&$[K+1]!==":"&&($[z]==="{"||$[z]===","))continue;if(J&&!/^\s*(?:<[^>]*>)?\s*\(/.test($.slice(G)))continue;return!0}return!1}function pZ($,Z){let J=[];if($.length>0)J.push(` var { ${$.join(", ")} } = window.stx || window;`);if(Z.length>0)J.push(` var { ${Z.join(", ")} } = window.StacksBrowser || {};`);if(J.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
|
|
3671
|
+
${J.join(`
|
|
3672
|
+
`)}
|
|
3673
|
+
${mK($,Z)}`;return""}function EL($,Z=[]){let{browserImports:J}=lZ($),X=new Set(Z);return pZ([],J.filter((Y)=>!X.has(Y)))}function mK($,Z){let J=[...$.map((X)=>`['${X}', typeof ${X}, 'stx']`),...Z.map((X)=>`['${X}', typeof ${X}, '@stacksjs/browser']`)];if(J.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
|
|
3674
|
+
[${J.join(", ")}].forEach(function (e) {
|
|
3675
|
+
if (e[1] !== 'undefined') return;
|
|
3676
|
+
console.error(
|
|
3677
|
+
'[stx] "' + e[0] + '" is used in this client script and auto-imported from ' + e[2] + ', '
|
|
3678
|
+
+ 'but the client runtime does not provide it. Either it is not exported to the browser, '
|
|
3679
|
+
+ 'or it should be imported from a relative path so the bundler includes it.'
|
|
3680
|
+
);
|
|
3681
|
+
});
|
|
3682
|
+
`}function v9($){let Z=$.__stxClientPayload;if(Z&&typeof Z==="object"){let X={};for(let Y in Z){let Q=Z[Y];if(typeof Q==="function")continue;X[Y]=Q}return X.__stxDeclaredPayload=!0,X}let J={};for(let X in $){if(X.startsWith("__")||X.startsWith("$"))continue;let Y=$[X];if(typeof Y==="function")continue;J[X]=Y}return J}function xZ($,Z){let J=new Set;for(let X of $.split(",")){let Y=X.trim().replace(/^\.\.\./,"").trim();if(!Y)continue;if(Z){let Q=Y.lastIndexOf(":");if(Q!==-1)Y=Y.slice(Q+1).trim()}if(Y=Y.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(Y))J.add(Y)}return J}function dK($,Z){let J=W0($),{depths:X,balanced:Y}=mZ(J),Q=(z)=>!Y||X[z]===0,G=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${Z}\\b)`,"g");for(let z of J.matchAll(G)){let K=(z.index??0)+z[0].length-z[1].length;if(Q(K))return!0}for(let z of J.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(Q(z.index??0)&&xZ(z[1],!0).has(Z))return!0;for(let z of J.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(Q(z.index??0)&&xZ(z[1],!1).has(Z))return!0;return!1}function lK($,Z){return new RegExp(`(?<![.#\\w$])${Z}(?![\\w$])`).test($)}var cK=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,gZ=new Set;function pK($,Z){let J=cK.test($),X=Z.length>32768;if(!J&&!X)return;if(gZ.has($))return;if(gZ.add($),J)console.warn(`[stx] server\u2192client bridge is publishing "${$}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(X)console.warn(`[stx] server\u2192client bridge is publishing ${(Z.length/1024).toFixed(1)}KB under "${$}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function x$($,Z){if(!Z)return"";let J=W0($),X=Z.__stxDeclaredPayload===!0,Y=[];for(let[Q,G]of Object.entries(Z)){if(!/^[A-Za-z_$][\w$]*$/.test(Q))continue;if(Q.startsWith("__")||Q.startsWith("$"))continue;if(!X&&!lK(J,Q))continue;if(dK($,Q)){if(X)console.warn(`[stx] defineClientPayload declares "${Q}", but this client block also declares "${Q}" at the top level, so the server value is not published (emitting it would be a duplicate binding). Rename the local, or drop "${Q}" from defineClientPayload.`);continue}let z;try{z=JSON.stringify(G)}catch{continue}if(z===void 0)continue;pK(Q,z),Y.push(` var ${Q} = ${z.replace(/</g,"\\u003c")};`)}if(Y.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
|
|
3683
|
+
${Y.join(`
|
|
3684
|
+
`)}
|
|
3685
|
+
`}var iK={left:0,middle:1,right:2};function nK($){let Z=[];if($.self)Z.push("if ($event.target !== $el) return");for(let J of $.systemKeys)Z.push(`if (!$event.${J}Key) return`);if($.keys.length>0){let J=$.keys.map((X)=>`$event.key === '${X}'`).join(" || ");Z.push(`if (!(${J})) return`)}if($.mouse!==null){let J=iK[$.mouse];Z.push(`if ($event.button !== ${J}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function oK($,Z){let{elementId:J,event:X,modifiers:Y}=$,Q=s9($.handler),G=nK(Y),z=[];if(Y.once)z.push("once: true");if(Y.capture)z.push("capture: true");if(Y.passive)z.push("passive: true");let K=z.length>0?`, { ${z.join(", ")} }`:"",q="";if(G)q+=`${G}; `;let W=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),U=`var $emit = function(name, detail) {
|
|
3686
|
+
$el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
|
|
3687
|
+
};`;function H(j){if(/\$emit\s*\(/.test(j))return`${U}
|
|
3688
|
+
${j}`;return`var scope = $el.closest('[data-stx-scope]');
|
|
3689
|
+
if (scope && scope.__stx_execute) {
|
|
3690
|
+
scope.__stx_execute('${W}', $event, $el);
|
|
3691
|
+
}
|
|
3692
|
+
else {
|
|
3693
|
+
${j}
|
|
3694
|
+
}`}if(Y.debounce!==null)return` ;(function() {
|
|
3695
|
+
// eslint-disable-next-line pickier/no-unused-vars
|
|
3696
|
+
var $el = document.getElementById('${J}')
|
|
3697
|
+
if (!$el) return
|
|
3698
|
+
var __timer
|
|
3699
|
+
$el.addEventListener('${X}', function($event) {
|
|
3700
|
+
${G?G+"; ":""}clearTimeout(__timer)
|
|
3701
|
+
__timer = setTimeout(function() { ${H(Q)} }, ${Y.debounce})
|
|
3702
|
+
}${K})
|
|
3703
|
+
})()`;if(Y.throttle!==null)return` ;(function() {
|
|
3704
|
+
// eslint-disable-next-line pickier/no-unused-vars
|
|
3705
|
+
var $el = document.getElementById('${J}')
|
|
3706
|
+
if (!$el) return
|
|
3707
|
+
var __last = 0
|
|
3708
|
+
$el.addEventListener('${X}', function($event) {
|
|
3709
|
+
${G?G+"; ":""}var __now = Date.now()
|
|
3710
|
+
if (__now - __last >= ${Y.throttle}) {
|
|
3711
|
+
__last = __now
|
|
3712
|
+
${H(Q)}
|
|
3713
|
+
}
|
|
3714
|
+
}${K})
|
|
3715
|
+
})()`;if(/\$emit\s*\(/.test(Q))return` var $el = document.getElementById('${J}')
|
|
3716
|
+
if ($el) $el.addEventListener('${X}', function($event) {
|
|
3717
|
+
${q}${U}
|
|
3718
|
+
${Q}
|
|
3719
|
+
}${K})`;return` var $el = document.getElementById('${J}')
|
|
3720
|
+
if ($el) $el.addEventListener('${X}', function($event) {
|
|
3721
|
+
${q}var scope = $el.closest('[data-stx-scope]');
|
|
3722
|
+
if (scope && scope.__stx_execute) {
|
|
3723
|
+
scope.__stx_execute('${W}', $event, $el);
|
|
3724
|
+
}
|
|
3725
|
+
else {
|
|
3726
|
+
${Q}
|
|
3727
|
+
}
|
|
3728
|
+
}${K})`}function sK($){if($.length===0)return"";return`
|
|
3729
|
+
// STX: auto-generated event bindings
|
|
3730
|
+
${$.map((J,X)=>oK(J,X)).join(`
|
|
3731
|
+
`)}`}function hZ($){let Z=[],J=new Set,X=$.replace(/^\s*import\s+.*$/gm,""),Y=0,Q=X.length,G=0;while(G<Q){let z=X[G];if(z==="'"||z==='"'||z==="`"){let K=z;if(G++,K==="`"){let q=0;while(G<Q){if(X[G]==="\\"){G+=2;continue}if(X[G]==="`"&&q===0){G++;break}if(X[G]==="$"&&X[G+1]==="{"){q++,G+=2;continue}if(X[G]==="}"&&q>0){q--,G++;continue}G++}}else while(G<Q){if(X[G]==="\\"){G+=2;continue}if(X[G]===K){G++;break}G++}continue}if(z==="/"&&X[G+1]==="/"){while(G<Q&&X[G]!==`
|
|
3732
|
+
`)G++;continue}if(z==="/"&&X[G+1]==="*"){G+=2;while(G<Q-1&&!(X[G]==="*"&&X[G+1]==="/"))G++;G+=2;continue}if(z==="{"){Y++,G++;continue}if(z==="}"){Y--,G++;continue}if(Y===0){let K=X.slice(G),q=K.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(q){let H=q[1];if(!H.startsWith("_")&&!J.has(H))Z.push(H),J.add(H);G+=q[0].length;continue}let W=K.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(W){W[1].split(",").forEach((H)=>{let j=H.trim(),B=j.indexOf(":"),V=B>=0?j.slice(B+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(V&&!V.startsWith("_")&&!J.has(V))Z.push(V),J.add(V)}),G+=W[0].length;continue}let U=K.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(U){let H=U[1];if(!H.startsWith("_")&&!J.has(H))Z.push(H),J.add(H);G+=U[0].length;continue}}G++}return Z}var rK=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"]);function aK($){let Z=new Set,J=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function X(H){let j;while((j=J.exec(H))!==null){let B=j[0];if(!rK.has(B))Z.add(B)}}let Y=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=Y.exec($))!==null)X(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)X(Q[1]);let z=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=z.exec($))!==null)X(Q[1]);let K=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=K.exec($))!==null)X(Q[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=q.exec($))!==null)X(Q[1]);let W=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=W.exec($))!==null)X(Q[1]);let U=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=U.exec($))!==null)X(Q[1]);return Z}async function f9($,Z={}){let J=$,X="",Y=!1,Q=[],G=X3(J,{filePath:Z.filePath,projectRoot:Z.projectRoot});J=G.code;let z=Y3(G.styles),K=e1(J);J=K.code,Q=[...K.imports,...K.models];let{hasUserImports:q,bundleClientScript:W}=await s("stx/client-script-bundler",()=>import("./chunk-f08ttkqr.js"));if(q(J))J=await W(J,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Y=!0;if(Z.autoImports!==!1){let O=lZ(J);J=O.code,X=pZ(O.stxImports,O.browserImports.filter((w)=>!Q.includes(w)))}if(X=`${x$(J,Z.serverData)}${X}`,J=t0(J),!Y&&M1(Z.attrs||""))J=A1(J);let U=sK(Z.eventBindings||[]),H=(Z.attrs||"").trim(),j=/\btype\s*=\s*["']module["']/i.test(H),B=Z.instanceId?` data-stx-instance="${Z.instanceId}"`:"";if(j){let O=H.replace(/\btype\s*=\s*["']module["']/i,"").trim(),w=`type="module" data-stx-scoped${B}${O?` ${O}`:""}`;return`${z}<script ${w}>
|
|
3733
|
+
${t1(`${X}${J}
|
|
3734
|
+
${U}`)}
|
|
3735
|
+
</script>`}let V=uZ($),L=/function __stx_setup_/.test(J),_=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function F(O){let w=O.length>0?`
|
|
3736
|
+
return { ${O.join(", ")} };`:"";return`${z}<script data-stx-scoped data-stx-run="always"${B}>
|
|
3737
|
+
window.stx.mount(function() {
|
|
3738
|
+
'use strict';
|
|
3739
|
+
${t1(`${X}${J}
|
|
3740
|
+
${U}${w}`)}
|
|
3741
|
+
})</script>`}if(!_&&!L){if(V)return F(hZ($));if(Z.templateContent){let O=hZ($);if(O.length>0){let w=aK(Z.templateContent);if(O.some((R)=>w.has(R)))return F(O)}}}return`${z}<script data-stx-scoped data-stx-run="always"${B}>
|
|
3742
|
+
;(function() {
|
|
3743
|
+
'use strict';
|
|
3744
|
+
${t1(`${X}${J}
|
|
3745
|
+
${U}`)}
|
|
3746
|
+
})()</script>`}
|
|
3747
|
+
export{AJ as sl,IJ as tl,TJ as ul,r0 as vl,Q5 as wl,G5 as xl,z5 as yl,K5 as zl,i3 as Al,p3 as Bl,vJ as Cl,xJ as Dl,hJ as El,xq as Fl,gq as Gl,hq as Hl,uq as Il,mq as Jl,DJ as Kl,m3 as Ll,d3 as Ml,l3 as Nl,c3 as Ol,vq as Pl,J7 as Ql,U2 as Rl,s9 as Sl,r9 as Tl,tZ as Ul,j3 as Vl,eK as Wl,k1 as Xl,$2 as Yl,gV as Zl,X3 as _l,Y3 as $l,gK as am,e1 as bm,lZ as cm,cZ as dm,pZ as em,EL as fm,v9 as gm,x$ as hm,f9 as im,Xq as jm,c2 as km,Yq as lm,Qq as mm,Gq as nm,zq as om,n2 as pm,XJ as qm,Fq as rm,YJ as sm,wq as tm,QJ as um,p2 as vm,$5 as wm,Z5 as xm,J1 as ym,J5 as zm,zJ as Am,Rq as Bm,B1 as Cm,KJ as Dm,Nq as Em,f0 as Fm,Dq as Gm,Tq as Hm,OJ as Im,_J as Jm,g3 as Km,h3 as Lm,u3 as Mm,Sq as Nm,n3 as Om,W5 as Pm,q2 as Qm,o2 as Rm,pq as Sm,q5 as Tm,dJ as Um,lJ as Vm,cJ as Wm,iq as Xm,s3 as Ym,r3 as Zm,G1 as _m,G9 as $m,N0 as an,h7 as bn,b5 as cn,z1 as dn,_1 as en,u7 as fn,O2 as gn,z9 as hn,y5 as in,rX as jn,tX as kn,l7 as ln,$Y as mn,ZY as nn,p7 as on,L1 as pn,uU as qn,i7 as rn,x5 as sn,GY as tn,f5 as un,zY as vn,KY as wn,mU as xn,dU as yn,n7 as zn,o7 as An,s7 as Bn,qY as Cn,WY as Dn,lU as En,cU as Fn,UY as Gn,pU as Hn,iU as In,t7 as Jn,J4 as Kn,u5 as Ln,XH as Mn,F2 as Nn,m5 as On,d5 as Pn,YH as Qn,TY as Rn,QH as Sn,kY as Tn,Q4 as Un,GH as Vn,EY as Wn,zH as Xn,KH as Yn,q9 as Zn,s5 as _n,kH as $n,EH as ao,bH as bo,yH as co,aY as do,f4 as eo,A2 as fo,zQ as go,H$ as ho,u6 as io,zV as jo,p6 as ko,NG as lo,vV as mo,TG as no,Y8 as oo,g$ as po,Q8 as qo,z8 as ro,h$ as so,lG as to,cG as uo,K8 as vo,e6 as wo,pG as xo,nG as yo,T$ as zo,E6 as Ao,b6 as Bo,NZ as Co,XK as Do,YK as Eo,QK as Fo,GK as Go,zK as Ho,KK as Io,DZ as Jo,HK as Ko,OK as Lo,_K as Mo,X6 as No,F$ as Oo,Q6 as Po,zB as Qo,KB as Ro,o4 as So,qB as To,V$ as Uo,O$ as Vo,_$ as Wo,q6 as Xo,W6 as Yo,U6 as Zo,CB as _o,SB as $o,j6 as ap,PB as bp,gQ as cp,V6 as dp,F6 as ep,M$ as fp,$G as gp,A$ as hp,M6 as ip,A6 as jp,qG as kp,cB as lp,pB as mp,I6 as np,iB as op,nB as pp,I$ as qp,S6 as rp,E9 as sp,b9 as tp,a1 as up,HG as vp,v6 as wp,f6 as xp,tB as yp,b$ as zp,jG as Ap,BG as Bp,y$ as Cp,C$ as Dp,x6 as Ep,g6 as Fp,u$ as Gp,m$ as Hp,c$ as Ip,n$ as Jp,o8 as Kp,A_ as Lp,I_ as Mp,Az as Np,y1 as Op,yz as Pp,T_ as Qp,k_ as Rp,ZZ as Sp,E_ as Tp,b_ as Up,pz as Vp,rz as Wp,az as Xp,tz as Yp,ez as Zp,wK as _p,M1 as $p,e$ as aq,A1 as bq,F9 as cq,IK as dq,TK as eq,kK as fq,D1 as gq,e as hq,e2 as iq,fZ as jq,_0 as kq,HL as lq,jL as mq,X7 as nq,Y7 as oq,V1 as pq,Q7 as qq,P1 as rq,G7 as sq,H2 as tq,QW as uq,YX as vq,H5 as wq,GW as xq,j5 as yq,zW as zq,KW as Aq,Y1 as Bq,qW as Cq,WW as Dq,UW as Eq,HW as Fq,jW as Gq,BW as Hq,QX as Iq,V5 as Jq,z7 as Kq,OW as Lq,_W as Mq,LW as Nq,FW as Oq,wW as Pq,q7 as Qq,RW as Rq,W7 as Sq,NW as Tq,DW as Uq,j2 as Vq,UX as Wq,TW as Xq,jX as Yq,O7 as Zq,t2 as _q,SW as $q,D7 as ar,N5 as br,lW as cr,M5 as dr,EX as er,SX as fr,cW as gr,pW as hr,iW as ir,nW as jr,oW as kr,sW as lr,PX as mr,vX as nr,A7 as or,A5 as pr,hX as qr,T5 as rr,x7 as sr,HU as tr,jU as ur,E5 as vr,pX as wr,g7 as xr};
|