@stacksjs/stx 0.2.302 → 0.2.304
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/api-client.d.ts +26 -0
- package/dist/api-client.js +22 -0
- package/dist/api-handler.d.ts +6 -0
- package/dist/api-handler.js +3 -0
- package/dist/app-shell.js +11 -2
- package/dist/application-layers.d.ts +30 -0
- package/dist/application-layers.js +202 -0
- package/dist/build.js +9 -1
- package/dist/chunk-02hm88m5.js +2 -0
- package/dist/{chunk-7eea1cse.js → chunk-09zjty4k.js} +1 -1
- package/dist/{chunk-7nfn7nj9.js → chunk-0gz0rhvs.js} +1 -1
- package/dist/{chunk-jsfch50r.js → chunk-1c2j4eby.js} +1 -1
- package/dist/{chunk-m6wz1hf5.js → chunk-2h94c5hm.js} +2 -2
- package/dist/{chunk-mjpqz66q.js → chunk-2ver2s2y.js} +1 -1
- package/dist/{chunk-2wcd2031.js → chunk-30nbe9hr.js} +2 -2
- package/dist/chunk-39qzhpn6.js +18 -0
- package/dist/chunk-3z6bqqr7.js +2 -0
- package/dist/chunk-43p1qq7g.js +2 -0
- package/dist/{chunk-52rkkkmt.js → chunk-45y8bjrv.js} +287 -352
- package/dist/{chunk-2rp09y5j.js → chunk-4evbx7sz.js} +1 -1
- package/dist/chunk-4jgr954p.js +2 -0
- package/dist/chunk-51j2aqvb.js +2 -0
- package/dist/{chunk-8d15pd4g.js → chunk-54f8bpp6.js} +3 -3
- package/dist/{chunk-cbwp8prr.js → chunk-5k1hznvq.js} +2 -2
- package/dist/chunk-5qfpcgcs.js +2 -0
- package/dist/{chunk-7eg7ep8f.js → chunk-5tefa8qb.js} +2 -2
- package/dist/chunk-5x2fc4vk.js +30 -0
- package/dist/{chunk-683tfkz4.js → chunk-64djh88a.js} +1 -1
- package/dist/{chunk-btrmvj2y.js → chunk-695fkras.js} +1 -1
- package/dist/chunk-6hcc4973.js +2 -0
- package/dist/{chunk-svg37jzs.js → chunk-6vswphz4.js} +2 -2
- package/dist/chunk-7gqbr8nr.js +2 -0
- package/dist/{chunk-x4prtyjs.js → chunk-7kw3grq5.js} +1 -1
- package/dist/{chunk-7jebw3ea.js → chunk-7skk34dh.js} +2 -2
- package/dist/chunk-8215nhej.js +12 -0
- package/dist/chunk-8ee62a9q.js +2 -0
- package/dist/{chunk-jj6yp7gm.js → chunk-8jam44my.js} +1 -1
- package/dist/chunk-8z0n5mtg.js +2 -0
- package/dist/{chunk-3bc8bqw2.js → chunk-9368t9jm.js} +1 -1
- package/dist/chunk-9499k64n.js +6 -0
- package/dist/chunk-976g5qe5.js +2 -0
- package/dist/{chunk-3jwmcf4k.js → chunk-9c835qjn.js} +1 -1
- package/dist/chunk-9px4y692.js +2 -0
- package/dist/{chunk-38t0fxh0.js → chunk-9vqnrcrw.js} +2 -2
- package/dist/chunk-9wrrr7g3.js +4 -0
- package/dist/{chunk-q0y1yxg3.js → chunk-9xzszvn5.js} +1 -1
- package/dist/chunk-a07chbgj.js +2 -0
- package/dist/{chunk-454kar39.js → chunk-ankp4reb.js} +2 -2
- package/dist/{chunk-5d9cy7a0.js → chunk-awj7yy37.js} +1 -1
- package/dist/chunk-b1hd8kvy.js +2 -0
- package/dist/chunk-b4xwbh8a.js +2 -0
- package/dist/{chunk-d6wq91cw.js → chunk-bd9wrcq1.js} +277 -21
- package/dist/{chunk-q25mr70f.js → chunk-c131k3mt.js} +1 -1
- package/dist/chunk-c3tmzx7q.js +2 -0
- package/dist/{chunk-6btbgxh1.js → chunk-c79nfdyj.js} +1 -1
- package/dist/{chunk-cfgpk6bh.js → chunk-cbgh359m.js} +1 -1
- package/dist/chunk-ckzhp09g.js +2 -0
- package/dist/{chunk-weqpt9nt.js → chunk-cr8v8k53.js} +1 -1
- package/dist/{chunk-p3wwm6k4.js → chunk-d19tvdvv.js} +1 -1
- package/dist/{chunk-nb1zdh1y.js → chunk-d3srvh3q.js} +1 -1
- package/dist/{chunk-rqrfq305.js → chunk-d57gb0v2.js} +1 -1
- package/dist/{chunk-1xyhk1wr.js → chunk-d5cqnwdd.js} +1 -1
- package/dist/chunk-dgpjxmhs.js +2 -0
- package/dist/chunk-dvvx1wny.js +3 -0
- package/dist/{chunk-ctz53mbz.js → chunk-ej8mv2k6.js} +1 -1
- package/dist/{chunk-dv3z80gt.js → chunk-env6knrs.js} +1 -1
- package/dist/{chunk-rf10fkrf.js → chunk-ess2pgt5.js} +1 -1
- package/dist/chunk-ez28vck6.js +2 -0
- package/dist/{chunk-0tbgvp70.js → chunk-fczfdsab.js} +21 -5
- package/dist/{chunk-xdq52pwj.js → chunk-fp7ms6e7.js} +1 -1
- package/dist/{chunk-qg6pg6ze.js → chunk-fqq5k9ve.js} +1 -1
- package/dist/chunk-fvtv1s5j.js +3 -0
- package/dist/{chunk-5t0w4h6z.js → chunk-g912mb7x.js} +1 -1
- package/dist/chunk-g97atepq.js +2 -0
- package/dist/{chunk-wj25qt72.js → chunk-gbwhbasw.js} +1 -1
- package/dist/{chunk-38e9wgfc.js → chunk-gfc3qye3.js} +2 -2
- package/dist/{chunk-cratkhhb.js → chunk-ghw5p1yk.js} +1 -1
- package/dist/{chunk-f0g2q51j.js → chunk-gssbag3e.js} +1 -1
- package/dist/{chunk-c9vhtjtr.js → chunk-gt8ja700.js} +2 -2
- package/dist/chunk-hay1rzb0.js +3754 -0
- package/dist/{chunk-q5sw26s7.js → chunk-hg2afckn.js} +1 -1
- package/dist/chunk-hgjjnjas.js +7 -0
- package/dist/{chunk-hhnzd03k.js → chunk-hrcxfvh1.js} +1 -1
- package/dist/chunk-hzav4hyd.js +2 -0
- package/dist/{chunk-29gjwajm.js → chunk-jfzfrmzy.js} +1 -1
- package/dist/chunk-jjq9q9jr.js +2 -0
- package/dist/{chunk-ddqkj56r.js → chunk-jp2f8yzw.js} +1 -1
- package/dist/{chunk-ry3a2674.js → chunk-jsg1rthc.js} +1 -1
- package/dist/chunk-jxxv18a0.js +5 -0
- package/dist/chunk-kbw2qzqx.js +2 -0
- package/dist/chunk-kdxvraec.js +2 -0
- package/dist/chunk-krfjb7b8.js +2 -0
- package/dist/{chunk-6b4k8fay.js → chunk-kxavsh3m.js} +1 -1
- package/dist/{chunk-4tffxxpd.js → chunk-m31n9pkr.js} +1 -1
- package/dist/{chunk-fj6fbqgb.js → chunk-m3a20mmb.js} +1 -1
- package/dist/{chunk-j21csh4j.js → chunk-mbmqpaq1.js} +1 -1
- package/dist/{chunk-y9nyqcha.js → chunk-mwh3ymwc.js} +1 -1
- package/dist/{chunk-51g95yts.js → chunk-mygq61f5.js} +2 -2
- package/dist/chunk-nqq7y7m9.js +3 -0
- package/dist/chunk-nws8fbde.js +2 -0
- package/dist/{chunk-q6xfyasj.js → chunk-pcvayb2f.js} +1 -1
- package/dist/{chunk-nvxv2wxv.js → chunk-ppyz9623.js} +1 -1
- package/dist/chunk-pr14wjkn.js +2 -0
- package/dist/{chunk-jb2r696a.js → chunk-qev11kg8.js} +1 -1
- package/dist/{chunk-6njgsr6w.js → chunk-qeyw5za9.js} +1 -1
- package/dist/chunk-rpfcnq8n.js +2 -0
- package/dist/chunk-rrankpmj.js +3 -0
- package/dist/chunk-rst1rw09.js +2 -0
- package/dist/{chunk-3p0zgfgz.js → chunk-rzevgemj.js} +2 -2
- package/dist/{chunk-aa6kt84c.js → chunk-sart9ehj.js} +1 -1
- package/dist/chunk-sb7ana2z.js +19 -0
- package/dist/chunk-snt2773t.js +2 -0
- package/dist/{chunk-jptkc64r.js → chunk-t3qb9s6s.js} +2 -2
- package/dist/{chunk-w8yac9xp.js → chunk-t41aaehf.js} +1 -1
- package/dist/{chunk-qjkzpd68.js → chunk-t51mwjyq.js} +1 -1
- package/dist/chunk-tt4r8q4v.js +2 -0
- package/dist/chunk-vd3h9z7e.js +2 -0
- package/dist/{chunk-6rzwef28.js → chunk-vd5xvsnv.js} +1 -1
- package/dist/chunk-wbecqx03.js +2 -0
- package/dist/{chunk-dcxtrqfy.js → chunk-wfffa8zm.js} +1 -1
- package/dist/{chunk-22p0ezj6.js → chunk-wx13qmaw.js} +1 -1
- package/dist/chunk-xd5ahrtn.js +2 -0
- package/dist/{chunk-vh0qr8k9.js → chunk-xganfzgn.js} +2 -2
- package/dist/chunk-xq1swv2e.js +2 -0
- package/dist/chunk-xsfwcj6x.js +2 -0
- package/dist/{chunk-91007tan.js → chunk-xwxdwqn9.js} +1 -1
- package/dist/{chunk-634gaa9d.js → chunk-xz3evxqp.js} +1 -1
- package/dist/chunk-xzgvcrnz.js +2 -0
- package/dist/chunk-y2kmm6bt.js +43 -0
- package/dist/{chunk-v8474ah4.js → chunk-y4nzmkea.js} +1 -1
- package/dist/chunk-y7wsk78j.js +3 -0
- package/dist/{chunk-6w8fa3b8.js → chunk-ya5m5vbn.js} +1 -1
- package/dist/{chunk-ps20v1ah.js → chunk-ym3r8ktq.js} +1 -1
- package/dist/chunk-yyebm8q4.js +2 -0
- package/dist/chunk-yyyxt326.js +2 -0
- package/dist/chunk-yz16bgs3.js +28 -0
- package/dist/{chunk-em8p71et.js → chunk-z9ezmjwd.js} +2 -2
- package/dist/chunk-zbtfhxhn.js +2 -0
- package/dist/chunk-zggm7kjd.js +17 -0
- package/dist/{chunk-mdf3jbe6.js → chunk-zhcs8m2a.js} +2 -2
- package/dist/{chunk-f9d27v49.js → chunk-zs5y7xnt.js} +1 -1
- package/dist/cli.js +14 -14
- package/dist/client-script-bundler.js +22 -11
- package/dist/component-contract-checks.d.ts +19 -0
- package/dist/component-contract-checks.js +147 -0
- package/dist/component-contract.d.ts +20 -0
- package/dist/component-contract.js +108 -0
- package/dist/component-model.d.ts +29 -0
- package/dist/component-model.js +59 -0
- package/dist/component-registry.js +7 -64
- package/dist/component-renderer.d.ts +1 -26
- package/dist/component-renderer.js +4 -239
- package/dist/component-resolution.d.ts +21 -0
- package/dist/component-resolution.js +118 -0
- package/dist/component-tags.d.ts +9 -0
- package/dist/component-tags.js +174 -0
- package/dist/composable-loader.d.ts +2 -13
- package/dist/composable-loader.js +15 -26
- package/dist/composables/index.d.ts +1 -0
- package/dist/composables/index.js +1 -0
- package/dist/composables/use-fetch.d.ts +117 -42
- package/dist/composables/use-fetch.js +47 -4
- package/dist/composition-api.d.ts +43 -19
- package/dist/config.d.ts +1 -1
- package/dist/config.js +46 -4
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/database.js +1 -1
- package/dist/dev-server/serve-app.js +57 -17
- package/dist/dev-server/serve-file.js +8 -1
- package/dist/expressions.js +1 -1
- package/dist/imported-signals.js +1 -1
- package/dist/includes.js +8 -2
- package/dist/index.d.ts +11 -0
- package/dist/index.js +7 -0
- package/dist/manifest.d.ts +6 -0
- package/dist/misc-directives.d.ts +2 -0
- package/dist/misc-directives.js +39 -1
- package/dist/process.js +18 -1
- package/dist/production-builder.d.ts +4 -0
- package/dist/production-builder.js +47 -8
- package/dist/production-server.d.ts +4 -1
- package/dist/production-server.js +119 -71
- package/dist/pwa.js +2 -2
- package/dist/render.js +9 -2
- package/dist/route-response-cache.d.ts +7 -0
- package/dist/route-response-cache.js +72 -0
- package/dist/route-rules.d.ts +17 -0
- package/dist/route-rules.js +40 -0
- package/dist/router.d.ts +1 -0
- package/dist/runtime-config-loader.d.ts +5 -0
- package/dist/runtime-config-loader.js +42 -0
- package/dist/runtime-config-server.d.ts +26 -0
- package/dist/runtime-config-server.js +77 -0
- package/dist/runtime-config-types.d.ts +2 -0
- package/dist/runtime-config-types.js +0 -0
- package/dist/runtime-config.d.ts +5 -0
- package/dist/runtime-config.js +9 -0
- package/dist/runtime-globals.js +3 -0
- package/dist/serve.js +32 -10
- package/dist/server-api.d.ts +27 -0
- package/dist/server-api.js +181 -0
- package/dist/server-data.d.ts +17 -0
- package/dist/server-data.js +40 -0
- package/dist/signal-processing.js +2 -2
- package/dist/signals.js +210 -17
- package/dist/ssg.js +2 -2
- package/dist/stx-virtual-ts.d.ts +6 -0
- package/dist/stx-virtual-ts.js +31 -7
- package/dist/stx.d.ts +28 -0
- package/dist/template-compiler.d.ts +1 -0
- package/dist/template-compiler.js +1 -1
- package/dist/template-hydrator.js +15 -4
- package/dist/typecheck.d.ts +1 -0
- package/dist/typecheck.js +4 -3
- package/dist/types/config-types.d.ts +17 -0
- package/dist/utils.js +15 -5
- package/dist/variable-extractor.d.ts +1 -1
- package/dist/variable-extractor.js +12 -1
- package/dist/visual-testing.js +1 -1
- package/dist/vue-template.js +19 -41
- package/package.json +5 -5
- package/stx.d.ts +28 -0
- package/dist/chunk-0p44z42s.js +0 -2
- package/dist/chunk-1na1dvda.js +0 -2
- package/dist/chunk-2yp8ang5.js +0 -2
- package/dist/chunk-35x7s4cr.js +0 -2
- package/dist/chunk-39qnycbc.js +0 -2
- package/dist/chunk-4qj6pq60.js +0 -2
- package/dist/chunk-4r1qdp25.js +0 -19
- package/dist/chunk-4xs545h1.js +0 -2
- package/dist/chunk-70cf5h11.js +0 -2
- package/dist/chunk-7k63nhap.js +0 -28
- package/dist/chunk-7w3dttqh.js +0 -2
- package/dist/chunk-813dt09p.js +0 -2
- package/dist/chunk-9cp3430d.js +0 -2
- package/dist/chunk-ac9vpa5z.js +0 -2
- package/dist/chunk-b26xazrf.js +0 -2
- package/dist/chunk-b2ghmxpj.js +0 -4
- package/dist/chunk-btnky17z.js +0 -12
- package/dist/chunk-c7av0px6.js +0 -2
- package/dist/chunk-cthpzv4p.js +0 -18
- package/dist/chunk-d41b0rqp.js +0 -2
- package/dist/chunk-dkd0bg8g.js +0 -2
- package/dist/chunk-e0s519df.js +0 -2
- package/dist/chunk-ebr2344x.js +0 -3
- package/dist/chunk-ehp6fez3.js +0 -2
- package/dist/chunk-fc5t3cxt.js +0 -2
- package/dist/chunk-g6ttsdz1.js +0 -2
- package/dist/chunk-gd73rpks.js +0 -2
- package/dist/chunk-gv42xz15.js +0 -17
- package/dist/chunk-h3t6fjba.js +0 -2
- package/dist/chunk-h65nep6y.js +0 -2
- package/dist/chunk-h7d01cy7.js +0 -2
- package/dist/chunk-jc57j887.js +0 -2
- package/dist/chunk-k5xtf38q.js +0 -3
- package/dist/chunk-mc4rtf5d.js +0 -2
- package/dist/chunk-me5kq4e6.js +0 -22
- package/dist/chunk-mzf6c0h7.js +0 -2
- package/dist/chunk-n1j7gfe1.js +0 -3
- package/dist/chunk-pczxwdes.js +0 -2
- package/dist/chunk-pq6rabcy.js +0 -3754
- package/dist/chunk-qr59yfq9.js +0 -2
- package/dist/chunk-s454ytp4.js +0 -2
- package/dist/chunk-s4sp78fn.js +0 -2
- package/dist/chunk-shr928nn.js +0 -2
- package/dist/chunk-that7v95.js +0 -2
- package/dist/chunk-vwnnbzsp.js +0 -2
- package/dist/chunk-w63052rn.js +0 -2
- package/dist/chunk-w9kzfesd.js +0 -2
- package/dist/chunk-zwy5e35f.js +0 -30
package/dist/chunk-pq6rabcy.js
DELETED
|
@@ -1,3754 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{$r as Z2,As as m6,Cr as R2,Fr as g6,Hr as G0,Ks as t3,Lr as D2,Ls as e3,Mr as h6,Or as o0,Pr as u6,Wr as L4,Xr as $0,Yr as q0,Zr as T0,_r as G9,as as W0,bs as W9,rr as Q0,tr as q9,vr as K9,ws as d6}from"./chunk-m6wz1hf5.js";import{Rs as u2}from"./chunk-dcxtrqfy.js";import{Zs as x0,_s as M8}from"./chunk-qjkzpd68.js";import{$s as S7}from"./chunk-2rp09y5j.js";import{Kt as i6,ct as i1,dt as v1,et as c6,ft as I1,ht as j1,it as _8,jt as V8,kt as J2,lt as v2,mt as z9,nt as B$,ot as M6,pt as H6,qt as _1,rt as p0,st as S9,wt as p6,xt as A9}from"./chunk-8d15pd4g.js";import{Lt as $7,Nt as Z7,Ot as J7,Qt as K2}from"./chunk-q25mr70f.js";import{Rt as n6,Vt as m2,Xt as Y8}from"./chunk-jsfch50r.js";import{fu as Z1}from"./chunk-6b4k8fay.js";import{iu as o6}from"./chunk-jb2r696a.js";import{ju as s$,ku as N8,lu as B8,mu as p1,qu as A8,ru as f$,su as U6,uu as a7,xu as Y4}from"./chunk-k5xtf38q.js";import{Iu as K$,Lu as r4,Su as a5,hv as l6,jv as hQ,kv as c9,mv as Q2}from"./chunk-0tbgvp70.js";import{rv as X7}from"./chunk-xdq52pwj.js";import{wv as u}from"./chunk-ddqkj56r.js";import E1 from"path";import A2 from"fs";var S$=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"]),P$={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"},y8=new Set(["ctrl","alt","shift","meta"]),x$={left:0,middle:1,right:2};function v$($){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(y8.has(X))Z.systemKeys.push(X);else if(X in x$)Z.mouse=X;else if(X in P$||/^[a-z]$/.test(X))Z.keys.push(P$[X]||X.toUpperCase());else if(X.startsWith("debounce")){let Q=X.match(/debounce(?:\.(\d+))?/);Z.debounce=Q?.[1]?Number.parseInt(Q[1],10):300}else if(X.startsWith("throttle")){let Q=X.match(/throttle(?:\.(\d+))?/);Z.throttle=Q?.[1]?Number.parseInt(Q[1],10):300}}return Z}function g$($){let Z=[],J=0,X=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Q;while((Q=X.exec($))!==null){let[Y,G,z]=Q,q=Q.index,K=q+Y.length,W=`__stx_evt_${J++}`,U=[],H=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,j;while((j=H.exec(z))!==null){let[,_,F]=j,L=_.split("."),O=L[0];if(!S$.has(O))continue;U.push({attribute:`@${_}`,event:O,handler:F,modifiers:v$(L.slice(1)),elementId:W})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((j=B.exec(z))!==null){let[,_,F]=j,L=_.split("."),O=L[0];if(!S$.has(O))continue;U.push({attribute:`@${_}`,event:O,handler:F,modifiers:v$(L.slice(1)),elementId:W})}if(U.length>0)Z.push({originalTag:Y,elementId:W,events:U,startIndex:q,endIndex:K})}return Z}function C8($){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((Q)=>`$event.key === '${Q}'`).join(" || ");Z.push(`if (!(${X})) return`)}if(J.mouse!==null){let X=x$[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 S8($,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 b9($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function P8($){let{modifiers:Z}=$,J=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),X=C8($),Q=S8(b9($.handler),Z),Y=[];if(Z.once)Y.push("once: true");if(Z.capture)Y.push("capture: true");if(Z.passive)Y.push("passive: true");let G=Y.length>0?`, { ${Y.join(", ")} }`:"",z=Q.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 y9($){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(P8).join(`
|
|
112
|
-
`)}
|
|
113
|
-
})();
|
|
114
|
-
</script>`}function v8($){let Z=g$($);if(Z.length===0)return{template:$,bindings:[]};let J=$,X=[];for(let Q=Z.length-1;Q>=0;Q--){let Y=Z[Q],G=Y.originalTag;if(!G.includes(" id="))G=G.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${Y.elementId}"`);else{let z=G.match(/id=["']([^"']+)["']/);if(z)for(let q of Y.events)q.elementId=z[1]}for(let z of Y.events){let q=z.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),K=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),W=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");G=G.replace(K,""),G=G.replace(W,"")}J=J.slice(0,Y.startIndex)+G+J.slice(Y.endIndex),X.push(...Y.events)}return{template:J,bindings:X}}function h$($,Z,J){if(f$($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:z,bindings:q}=v8($),K=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...K,...q],z}let X=g$($);if(X.length===0)return $;let Q=$;for(let z=X.length-1;z>=0;z--){let q=X[z],K=q.originalTag;if(!K.includes(" id="))K=K.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${q.elementId}"`);else{let W=K.match(/id=["']([^"']+)["']/);if(W)for(let U of q.events)U.elementId=W[1]}for(let W of q.events){let U=W.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),H=new RegExp(`\\s*${U}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${U}\\s*=\\s*'[^']*'`,"g");K=K.replace(H,""),K=K.replace(j,"")}Q=Q.slice(0,q.startIndex)+K+Q.slice(q.endIndex)}let Y=y9(X.flatMap((z)=>z.events)),G=Q.lastIndexOf("</body>");if(G!==-1)Q=Q.slice(0,G)+Y+`
|
|
115
|
-
`+Q.slice(G);else Q+=Y;return Q}function Qz($){return/@[a-z]+(?:\.[a-z]+)*\s*=\s*["'][^"']*["']/i.test($)}import L8 from"fs";import h from"path";import{createHash as f8}from"crypto";var y2="__stx_component_client_factories";function C2($){let Z=$[y2];return Z instanceof Map?Z:null}function d$($){$[y2]=new Map}function C9($,Z){let J=C2($);if(!J)return null;let X=f8("sha256").update(Z).digest("hex").slice(0,16),Q=J.get(X);if(Q)Q.instances++;else J.set(X,{body:Z,instances:1});return X}function m$($,Z){let J=C2(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 Q=[];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)Q.push({start:H.index,end:H.index+H[0].length,replacement:`(${j})(${H[2]});`});H=U.exec($)}}let Y=[...J].filter(([,W])=>W.instances>1);if(Y.length===0)return u$($,Q);let z=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
|
|
116
|
-
(function() {
|
|
117
|
-
const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
|
|
118
|
-
${Y.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>`,q=$.search(/<script\b(?=[^>]*\bdata-stx-scoped\b)/i),K=q<0?0:q;return Q.push({start:K,end:K,replacement:`${z}
|
|
123
|
-
`}),u$($,Q)}function u$($,Z){if(Z.length===0)return $;Z.sort((Y,G)=>Y.start-G.start||Y.end-G.end);let J=Array(Z.length*2+1),X=0,Q=0;for(let Y of Z)J[Q++]=$.slice(X,Y.start),J[Q++]=Y.replacement,X=Y.end;return J[Q]=$.slice(X),J.join("")}function l$($){let Z=C2($),J=new Map;if(Z)for(let[X,Q]of Z)J.set(X,Q.instances);return J}function c$($,Z){let J=C2($);if(!J)return[];let X=[];for(let[Q,Y]of J){let G=Y.instances-(Z.get(Q)??0);if(G>0)X.push({body:Y.body,count:G})}return X}function p$($,Z){for(let{body:J,count:X}of Z)for(let Q=0;Q<X;Q++)C9($,J)}var i$=0,S2=new Map;function Kz(){i$=0,S2.clear()}function P2($,Z){let J=i$++,X=`<!--__STX_${$.toUpperCase()}_${J}__-->`;return S2.set(X,{type:$,expression:Z}),X}function Wz(){let $={};for(let[Z,J]of S2)$[Z]={type:J.type,expression:J.expression};return $}function Uz($){let Z={},J=/<!--__STX_(EXPR|COND|RAW)_(\d+)__-->/g,X;while((X=J.exec($))!==null){let Q=X[0],Y=X[1].toLowerCase(),G=S2.get(Q);Z[Q]={type:Y,expression:G?.expression||""}}return Z}function Hz($,Z){let J=$;for(let[X,Q]of Z)J=J.split(X).join(Q);return J}function jz($){return $.includes("<!--__STX_")}var X2={},n$=new Map;function x8($){let Z=n$.get($);if(!Z){let J=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${J}(?!\\w)`,"g"),n$.set($,Z)}return Z.lastIndex=0,Z}var f2={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 r$(String($))},translate:($,Z,J={})=>{if(!Z||!Z.__translations)return $;let X=Z.__translations,Q=Z.__i18nConfig?.fallbackToKey??!0,Y=String($).split("."),G=X;for(let q of Y){if(G===void 0||G===null)break;G=G[q]}if(G===void 0||G===null)return Q?$:"";let z=String(G);return Object.entries(J).forEach(([q,K])=>{z=z.replace(x8(q),String(K))}),z},t:($,Z,J={})=>{return f2.translate($,Z,J)},truncate:($,Z,J=50,X="...")=>{if($===void 0||$===null)return"";let Q=String($);if(Q.length<=J)return Q;if(J<=X.length)return X.substring(0,J);return Q.substring(0,J-X.length)+X},date:($,Z,J="short",X="en-US")=>{if($===void 0||$===null)return"";try{let Q=$ instanceof Date?$:new Date($);if(Number.isNaN(Q.getTime()))return String($);let Y={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 Q.toISOString();return new Intl.DateTimeFormat(X,Y[J]||Y.short).format(Q)}catch{return String($)}},currency:($,Z,J="USD",X="en-US")=>{if($===void 0||$===null)return"";try{let Q=Number($);if(Number.isNaN(Q))return String($);return new Intl.NumberFormat(X,{style:"currency",currency:J}).format(Q)}catch{return String($)}},pluralize:($,Z,J,X)=>{let Q=Number($);if(Number.isNaN(Q))return J;let Y=X||`${J}s`;return Q===1?J:Y},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 Q=J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Q,"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 Q=10**J;return Math.round(X*Q)/Q}};function g8($,Z){if($ in f2)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);X2[$]=Z}function Rz($){for(let[Z,J]of Object.entries($))g8(Z,J)}function h8(){return{...f2,...X2}}function Dz(){for(let $ of Object.keys(X2))delete X2[$]}function P9($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function r$($){return P9($).replace(/\{{2,}/g,(Z)=>u8(Z.length)).replace(/\{(?=!)/g,`{${a$}`)}var a$="⁠";function u8($){return Array.from({length:$},()=>"{").join(a$)}function Y1($,Z){let{scripts:J}=p0($);for(let X of J){let Q=X.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!Q||/\bserver\b|\bsrc\s*=/.test(Q[1]))continue;let Y=Q[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(Y))return!0;if(s$(Y,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 o$($,Z){let J=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],X=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Q="",Y=!1,G=0;for(let K=0;K<X.length;K++){let W=X[K];if(!Y&&W==="`"){Y=!0,G=0;continue}if(Y){if(W==="`"&&G===0){Y=!1;continue}if(W==="$"&&X[K+1]==="{"){G++,K++,Q+=" ";continue}if(W==="}"&&G>0){G--;continue}if(G>0){Q+=W;continue}continue}Q+=W}X=Q;let z=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,q;while((q=z.exec(X))!==null){let K=q[1];if(!X.substring(0,q.index).trimEnd().endsWith(".")){if(!J.includes(K)&&!(K in Z))return!1}}return!0}function d8($,Z){let J=Z.__stx_serverDeclared;if(!J||J.size===0)return!1;let X=x0($);for(let Q of J)if(new RegExp(`(?<![.#\\w$])${Q}(?![\\w$])`).test(X))return!0;return!1}function v9($,Z){let J=$;return J=J.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q)=>{try{let Y=S0(Q,Z);if(Y===void 0)return X;return Y===null?"":String(Y)}catch{return X}}),J=J.replace(/\{\{([\s\S]*?)\}\}/g,(X,Q)=>{let Y=Q.trim();if(/^__[A-Z_]+__$/.test(Y))return X;try{let G=S0(Q,Z);if(G===void 0)return X;return JSON.stringify(G).replace(/</g,"\\u003c")}catch{return X}}),J}function m8($,Z){if(!$.includes("{"))return $;let J=$;return J=J.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q)=>{try{let Y=S0(Q,Z);if(Y===void 0)return X;return Y===null?"":String(Y)}catch{return X}}),J=J.replace(/\{\{([\s\S]*?)\}\}/g,(X,Q)=>{let Y=Q.trim();if(/^__[A-Z_]+__$/.test(Y))return X;try{let G=S0(Q,Z);if(G===void 0)return X;if(G===null)return"";return String(G).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}catch{return X}}),J}function Nz($,Z,J={}){let{output:X,scripts:Q}=p0($),Y=Q.map((G)=>{let z=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),q=G.match(/^<script\b[^>]*>/i),K=G.search(/<\/script\s*>$/i);if(!z||!q||K===-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${m8(W,Z)}>`;if(/\bsrc\s*=/.test(W)||/\btype\s*=\s*["']application\/json["']/.test(W))return j+U+G.slice(K);return j+v9(U,Z)+G.slice(K)});return S9(X,Y)}function V1($,Z,J){let X=$,Q=(U,H)=>{let j=v2(U,H);if(j===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(U.slice(H,j))?-1:j},Y=(U,H,j,B)=>{let _=j.length,{output:F,tokens:L}=_1(U,H,(O,V)=>B(_+V));return j.push(...L),F},G=[];X=Y(X,Q,G,(U)=>`<!--__STX_STYLE_${U}__-->`);let z=[];X=Y(X,J2,z,(U)=>`<!--__STX_SCRIPT_EXPR_${U}__-->`);let q=Z?.__stx_signals_gate===!0||Y1($),K=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=X.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(U,H,j)=>{try{let B=S0(H,Z);return B!==void 0&&B!==null?String(B):""}catch(B){let _=B instanceof Error?B.message:String(B);return H0("Expression",`Error evaluating: {{{ ${H.trim()}}}}: ${_}`,J,$,j,U)}}),X=X.replace(/\{!!([\s\S]*?)!!\}/g,(U,H,j)=>{try{let B=S0(H,Z);if(B===void 0&&Z.__stx_buildMode==="compile")return P2("raw",H.trim());return B!==void 0&&B!==null?String(B):""}catch(B){if(Z.__stx_buildMode==="compile")return P2("raw",H.trim());let _=B instanceof Error?B.message:String(B);return H0("Expression",`Error evaluating: {!! ${H.trim()} !!}: ${_}`,J,$,j,U)}}),X=Y(X,J2,z,(U)=>`<!--__STX_SCRIPT_EXPR_${U}__-->`),X=Y(X,Q,G,(U)=>`<!--__STX_STYLE_${U}__-->`),X=X.replace(/\{\{([\s\S]*?)\}\}/g,(U,H,j)=>{let B=H.trim();if(W.has(B))return U;let _=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],F=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,O=B.match(F)?.[1],V=O&&((O in Z)||_.includes(O)),w=Boolean(O&&K.has(O)),R=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,D=B.match(R),A=D&&!_.includes(D[1])&&!(D[1]in Z);if(/^__[A-Z_]+__$/.test(B))return"";try{let I=S0(H,Z);if(w)return U;if(q&&!o$(B,Z))return U;if(Z.__stx_buildMode==="compile"&&!q&&(I===void 0||d8(B,Z)))return P2("expr",B);return I!==void 0&&I!==null?r$(String(I)):""}catch(I){if(w)return U;if(q&&!o$(B,Z))return U;if(A)return U;let N=I instanceof Error?I.message:String(I);return H0("Expression",`Error evaluating: {{ ${B} }}: ${N}`,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 l8($,Z,J){if(!Z.trim())return $;let X=$,Q=Z.trim();while(Q.length>0){let Y=Q.match(/^(\w+)/);if(!Y)break;let G=Y[1];Q=Q.substring(G.length).trim();let z=X2[G]||f2[G];if(!z)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(h8()).join(", ")}`);let q=[];if(Q.startsWith(":")){let K=Q.match(/^:([^|\s]+)/);if(K){let W=K[1].trim();try{let U=Number(W);q=[Number.isNaN(U)?W:U]}catch{q=[W]}Q=Q.substring(K[0].length).trim()}}else if(Q.startsWith("(")){let K=1,W=1;while(K>0&&W<Q.length){if(Q[W]==="(")K++;if(Q[W]===")")K--;W++}if(K===0){let U=Q.substring(1,W-1).trim();if(U)try{if(U.startsWith("{")&&U.endsWith("}"))q=[S0(`(${U})`,J,!0)];else{let H=[],j="",B=null,_=0,F=0,L=0,O=!1;for(let V=0;V<U.length;V++){let w=U[V];if(O){j+=w,O=!1;continue}if(w==="\\"){j+=w,O=!0;continue}if(B){if(j+=w,w===B)B=null;continue}if(w==='"'||w==="'"||w==="`"){B=w,j+=w;continue}if(w==="(")_++;else if(w===")")_--;else if(w==="[")F++;else if(w==="]")F--;else if(w==="{")L++;else if(w==="}")L--;if(w===","&&_===0&&F===0&&L===0){H.push(j),j="";continue}j+=w}if(j)H.push(j);q=H.map((V)=>{let w=V.trim();return S0(w,J,!0)})}}catch{q=[U]}Q=Q.substring(W).trim()}}try{X=z(X,J,...q)}catch(K){let W=K instanceof Error?K.message:String(K);throw Error(`Error applying filter '${G}': ${W}`)}if(Q.startsWith("|"))Q=Q.substring(1).trim();else break}return X}function c8($){let Z=!1,J="",X=0,Q=0,Y=0,G=!1;for(let z=0;z<$.length;z++){let q=$[z],K=$[z+1];if(Z&&G){G=!1;continue}if(Z&&q==="\\"){G=!0;continue}if(G=!1,(q==='"'||q==="'"||q==="`")&&!G){if(!Z)Z=!0,J=q;else if(q===J)Z=!1,J="";continue}if(Z&&J==="`"&&q==="$"&&K==="{"){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(q==="(")X++;else if(q===")")X--;else if(q==="[")Q++;else if(q==="]")Q--;else if(q==="{")Y++;else if(q==="}")Y--;if(q==="|"&&X===0&&Q===0&&Y===0){if(K==="|"){z++;continue}if(K==="="){z++;continue}return z}}return-1}function S0($,Z,J=!1){try{let X=$.trim(),Q=c8(X);if(Q>0){let Y=X.substring(0,Q).trim(),G=X.substring(Q+1).trim(),z=S0(Y,Z,!0);return l8(z,G,Z)}if(!q0(X)){if(!J)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${X}`);return $0(X,Z)}try{let Y=Object.keys(Z),G=Object.values(Z);return W0(X,Y)(...G)}catch{return $0(X,Z)}}catch(X){if(X instanceof ReferenceError){let Q=/(\b\w+)\s+is not defined/.exec(X.message);if(Q){let Y=Q[1],G=p8(Y,Object.keys(Z));if(G&&G!==Y)X.message=`${X.message} \u2014 did you mean '${G}'?`}}if(!J)console.error(`Error evaluating expression: ${$}`,X);throw X}}function p8($,Z){let J=null;for(let Q of Z){if(Q===$)continue;let Y=i8($,Q);if(J===null||Y<J.dist)J={key:Q,dist:Y}}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 i8($,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,$],Q=Array(J.length+1),Y=Array(J.length+1);for(let G=0;G<=J.length;G++)Q[G]=G;for(let G=1;G<=X.length;G++){Y[0]=G;for(let z=1;z<=J.length;z++){let q=J[z-1]===X[G-1]?0:1;Y[z]=Math.min(Y[z-1]+1,Q[z]+1,Q[z-1]+q)}for(let z=0;z<=J.length;z++)Q[z]=Y[z]}return Q[J.length]}function Az($){if(!$)return"";return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}import uQ from"fs";import A0 from"path";var f9=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],t$=/<body\b([^>]*)>/gi;function i0($){let Z=0,J,X=f9.map(()=>{return});while(Z<$.length){if(J===void 0||J!==null&&J.index<Z)t$.lastIndex=Z,J=t$.exec($);if(!J)return null;let Q=J.index,Y=-1,G=null;for(let q=0;q<f9.length;q++){let K=f9[q],W=X[q];if(W===void 0||W!==null&&W.index<Z)K.open.lastIndex=Z,W=K.open.exec($),X[q]=W;if(!W)continue;if(W.index<Q&&(Y===-1||W.index<Y))Y=W.index,G=K.close}if(Y===-1||!G)return{index:Q,tag:J[0],attrs:J[1]??""};G.lastIndex=Y;let z=G.exec($);if(!z)return null;Z=z.index+z[0].length}return null}function b1($,Z){let J=i0($);if(!J)return $;return $.slice(0,J.index)+Z(J.tag,J.attrs)+$.slice(J.index+J.tag.length)}var e$=null;function n8($){if(!e$)return console.warn(`[stx] ${$} must be called within a component setup.`),null;return e$}function Iz($){let Z=n8("onUpdate");if(Z)Z.updateHooks.push($)}function $3(){return`
|
|
124
|
-
// STX Lifecycle Runtime
|
|
125
|
-
(function() {
|
|
126
|
-
if (typeof window === 'undefined') return;
|
|
127
|
-
|
|
128
|
-
const instances = new Map();
|
|
129
|
-
let currentInstance = null;
|
|
130
|
-
let idCounter = 0;
|
|
131
|
-
|
|
132
|
-
function generateId() {
|
|
133
|
-
return 'stx-' + (++idCounter) + '-' + Date.now().toString(36);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
function createInstance(element) {
|
|
137
|
-
const instance = {
|
|
138
|
-
id: generateId(),
|
|
139
|
-
element: element,
|
|
140
|
-
mountHooks: [],
|
|
141
|
-
destroyHooks: [],
|
|
142
|
-
updateHooks: [],
|
|
143
|
-
refs: new Map(),
|
|
144
|
-
watchers: [],
|
|
145
|
-
isMounted: false
|
|
146
|
-
};
|
|
147
|
-
instances.set(instance.id, instance);
|
|
148
|
-
return instance;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
window.STX = window.STX || {};
|
|
152
|
-
|
|
153
|
-
// Lifecycle hooks
|
|
154
|
-
window.STX.onMount = function(hook) {
|
|
155
|
-
if (currentInstance) currentInstance.mountHooks.push(hook);
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
window.STX.onDestroy = function(hook) {
|
|
159
|
-
if (currentInstance) currentInstance.destroyHooks.push(hook);
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
window.STX.onUpdate = function(hook) {
|
|
163
|
-
if (currentInstance) currentInstance.updateHooks.push(hook);
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
// Aliases
|
|
167
|
-
window.STX.onMounted = window.STX.onMount;
|
|
168
|
-
window.STX.onUnmounted = window.STX.onDestroy;
|
|
169
|
-
window.STX.onUpdated = window.STX.onUpdate;
|
|
170
|
-
|
|
171
|
-
// Refs
|
|
172
|
-
window.STX.ref = function(initialValue) {
|
|
173
|
-
const r = { value: initialValue || null };
|
|
174
|
-
Object.defineProperty(r, 'current', {
|
|
175
|
-
get: function() { return this.value; }
|
|
176
|
-
});
|
|
177
|
-
if (currentInstance) {
|
|
178
|
-
currentInstance.refs.set('ref-' + currentInstance.refs.size, r);
|
|
179
|
-
}
|
|
180
|
-
return r;
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
// Watch
|
|
184
|
-
window.STX.watch = function(source, callback, options) {
|
|
185
|
-
options = options || {};
|
|
186
|
-
let oldValue;
|
|
187
|
-
let cleanup;
|
|
188
|
-
let isActive = true;
|
|
189
|
-
|
|
190
|
-
function run() {
|
|
191
|
-
if (!isActive) return;
|
|
192
|
-
const newValue = source();
|
|
193
|
-
if (oldValue !== newValue || options.immediate) {
|
|
194
|
-
if (cleanup) cleanup();
|
|
195
|
-
cleanup = callback(newValue, oldValue);
|
|
196
|
-
oldValue = newValue;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
if (options.immediate) {
|
|
201
|
-
run();
|
|
202
|
-
}
|
|
203
|
-
else {
|
|
204
|
-
oldValue = source();
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
const intervalId = setInterval(run, 16);
|
|
208
|
-
|
|
209
|
-
function stop() {
|
|
210
|
-
isActive = false;
|
|
211
|
-
clearInterval(intervalId);
|
|
212
|
-
if (cleanup) cleanup();
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
if (currentInstance) {
|
|
216
|
-
currentInstance.watchers.push({ stop: stop });
|
|
217
|
-
currentInstance.destroyHooks.push(stop);
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
return stop;
|
|
221
|
-
};
|
|
222
|
-
|
|
223
|
-
// Computed
|
|
224
|
-
window.STX.computed = function(getter) {
|
|
225
|
-
let cached;
|
|
226
|
-
let dirty = true;
|
|
227
|
-
return {
|
|
228
|
-
get value() {
|
|
229
|
-
if (dirty) {
|
|
230
|
-
cached = getter();
|
|
231
|
-
dirty = false;
|
|
232
|
-
queueMicrotask(function() { dirty = true; });
|
|
233
|
-
}
|
|
234
|
-
return cached;
|
|
235
|
-
}
|
|
236
|
-
};
|
|
237
|
-
};
|
|
238
|
-
|
|
239
|
-
// Component management
|
|
240
|
-
window.STX.setupComponent = function(element, setup) {
|
|
241
|
-
const instance = createInstance(element);
|
|
242
|
-
currentInstance = instance;
|
|
243
|
-
try {
|
|
244
|
-
setup();
|
|
245
|
-
}
|
|
246
|
-
finally {
|
|
247
|
-
currentInstance = null;
|
|
248
|
-
}
|
|
249
|
-
return instance;
|
|
250
|
-
};
|
|
251
|
-
|
|
252
|
-
window.STX.mountComponent = function(instance) {
|
|
253
|
-
if (instance.isMounted) return;
|
|
254
|
-
instance.isMounted = true;
|
|
255
|
-
instance.mountHooks.forEach(function(hook) {
|
|
256
|
-
try {
|
|
257
|
-
const cleanup = hook();
|
|
258
|
-
if (typeof cleanup === 'function') {
|
|
259
|
-
instance.destroyHooks.push(cleanup);
|
|
260
|
-
}
|
|
261
|
-
else if (cleanup && typeof cleanup.then === 'function') {
|
|
262
|
-
cleanup.catch(function(e) { console.error('[stx] onMount error:', e); });
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
catch (e) {
|
|
266
|
-
console.error('[stx] onMount error:', e);
|
|
267
|
-
}
|
|
268
|
-
});
|
|
269
|
-
};
|
|
270
|
-
|
|
271
|
-
window.STX.destroyComponent = function(instance) {
|
|
272
|
-
if (!instance.isMounted) return;
|
|
273
|
-
instance.watchers.forEach(function(w) { w.stop(); });
|
|
274
|
-
instance.destroyHooks.forEach(function(hook) {
|
|
275
|
-
try { hook(); }
|
|
276
|
-
catch (e) { console.error('[stx] onDestroy error:', e); }
|
|
277
|
-
});
|
|
278
|
-
instance.refs.forEach(function(ref) { ref.value = null; });
|
|
279
|
-
instance.isMounted = false;
|
|
280
|
-
instances.delete(instance.id);
|
|
281
|
-
};
|
|
282
|
-
|
|
283
|
-
// ==========================================================================
|
|
284
|
-
// Vue-Style Refs System - No document.** required!
|
|
285
|
-
// ==========================================================================
|
|
286
|
-
|
|
287
|
-
// Internal: Query for ref elements without exposing document API
|
|
288
|
-
function queryRef(name, root) {
|
|
289
|
-
return (root || document).querySelector('[data-stx-ref="' + name + '"], [data-ref="' + name + '"]');
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
function queryAllRefs(root) {
|
|
293
|
-
return (root || document).querySelectorAll('[data-stx-ref], [data-ref]');
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
// Auto-bind refs from ref attributes (Vue-style)
|
|
297
|
-
window.STX.bindRefs = function(root, refs) {
|
|
298
|
-
if (!root) return;
|
|
299
|
-
queryAllRefs(root).forEach(function(el) {
|
|
300
|
-
var refName = el.getAttribute('data-stx-ref') || el.getAttribute('data-ref');
|
|
301
|
-
if (refs[refName]) {
|
|
302
|
-
refs[refName].value = el;
|
|
303
|
-
}
|
|
304
|
-
});
|
|
305
|
-
};
|
|
306
|
-
|
|
307
|
-
// Vue-style useRefs() - returns object with all refs as direct elements
|
|
308
|
-
// Usage: const { input, button, container } = STX.useRefs()
|
|
309
|
-
window.STX.useRefs = function(root) {
|
|
310
|
-
var refs = {};
|
|
311
|
-
queryAllRefs(root).forEach(function(el) {
|
|
312
|
-
var refName = el.getAttribute('data-stx-ref') || el.getAttribute('data-ref');
|
|
313
|
-
if (refName) {
|
|
314
|
-
refs[refName] = el;
|
|
315
|
-
}
|
|
316
|
-
});
|
|
317
|
-
return refs;
|
|
318
|
-
};
|
|
319
|
-
|
|
320
|
-
// Get a single ref by name - Vue's useTemplateRef equivalent
|
|
321
|
-
// Usage: const input = STX.useRef('input')
|
|
322
|
-
window.STX.useRef = function(name, root) {
|
|
323
|
-
return queryRef(name, root);
|
|
324
|
-
};
|
|
325
|
-
|
|
326
|
-
// Two-way binding helper for form elements
|
|
327
|
-
// Usage: STX.model(inputEl, state, 'username')
|
|
328
|
-
window.STX.model = function(el, state, key) {
|
|
329
|
-
if (!el || !state) return;
|
|
330
|
-
|
|
331
|
-
var isCheckbox = el.type === 'checkbox';
|
|
332
|
-
var isRadio = el.type === 'radio';
|
|
333
|
-
var isSelect = el.tagName === 'SELECT';
|
|
334
|
-
|
|
335
|
-
// Set initial value
|
|
336
|
-
if (isCheckbox) {
|
|
337
|
-
el.checked = !!state[key];
|
|
338
|
-
}
|
|
339
|
-
else if (isRadio) {
|
|
340
|
-
el.checked = el.value === state[key];
|
|
341
|
-
}
|
|
342
|
-
else {
|
|
343
|
-
el.value = state[key] || '';
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
// Listen for changes
|
|
347
|
-
var eventType = isCheckbox || isRadio ? 'change' : 'input';
|
|
348
|
-
el.addEventListener(eventType, function() {
|
|
349
|
-
if (isCheckbox) {
|
|
350
|
-
state[key] = el.checked;
|
|
351
|
-
}
|
|
352
|
-
else if (isRadio) {
|
|
353
|
-
if (el.checked) state[key] = el.value;
|
|
354
|
-
}
|
|
355
|
-
else {
|
|
356
|
-
state[key] = el.value;
|
|
357
|
-
}
|
|
358
|
-
});
|
|
359
|
-
|
|
360
|
-
// Return cleanup function
|
|
361
|
-
return function() {
|
|
362
|
-
el.removeEventListener(eventType, arguments.callee);
|
|
363
|
-
};
|
|
364
|
-
};
|
|
365
|
-
|
|
366
|
-
// Batch event binding helper - cleaner than manual addEventListener
|
|
367
|
-
// Usage: STX.on({ click: [btn1, btn2], input: [textField] }, handler)
|
|
368
|
-
window.STX.on = function(el, event, handler) {
|
|
369
|
-
if (!el) return function() {};
|
|
370
|
-
el.addEventListener(event, handler);
|
|
371
|
-
return function() { el.removeEventListener(event, handler); };
|
|
372
|
-
};
|
|
373
|
-
|
|
374
|
-
// Bind multiple events at once
|
|
375
|
-
// Usage: STX.events(refs.btn, { click: handleClick, mouseenter: handleHover })
|
|
376
|
-
window.STX.events = function(el, eventMap) {
|
|
377
|
-
if (!el) return function() {};
|
|
378
|
-
var cleanups = [];
|
|
379
|
-
Object.keys(eventMap).forEach(function(event) {
|
|
380
|
-
el.addEventListener(event, eventMap[event]);
|
|
381
|
-
cleanups.push(function() { el.removeEventListener(event, eventMap[event]); });
|
|
382
|
-
});
|
|
383
|
-
return function() { cleanups.forEach(function(c) { c(); }); };
|
|
384
|
-
};
|
|
385
|
-
|
|
386
|
-
// ==========================================================================
|
|
387
|
-
// DOM Helpers - Eliminate document.* usage
|
|
388
|
-
// ==========================================================================
|
|
389
|
-
|
|
390
|
-
// Global keyboard event listener
|
|
391
|
-
// Usage: STX.onKey('Escape', () => closeModal())
|
|
392
|
-
window.STX.onKey = function(key, handler, options) {
|
|
393
|
-
var listener = function(e) {
|
|
394
|
-
if (e.key === key) {
|
|
395
|
-
handler(e);
|
|
396
|
-
}
|
|
397
|
-
};
|
|
398
|
-
document.addEventListener('keydown', listener, options);
|
|
399
|
-
return function() { document.removeEventListener('keydown', listener, options); };
|
|
400
|
-
};
|
|
401
|
-
|
|
402
|
-
// Create element helper
|
|
403
|
-
// Usage: STX.el('div', { class: 'foo' }, 'text content')
|
|
404
|
-
window.STX.el = function(tag, attrs, content) {
|
|
405
|
-
var el = document.createElement(tag);
|
|
406
|
-
if (attrs) {
|
|
407
|
-
Object.keys(attrs).forEach(function(key) {
|
|
408
|
-
if (key === 'class') {
|
|
409
|
-
el.className = attrs[key];
|
|
410
|
-
}
|
|
411
|
-
else if (key.startsWith('on')) {
|
|
412
|
-
el.addEventListener(key.slice(2).toLowerCase(), attrs[key]);
|
|
413
|
-
}
|
|
414
|
-
else {
|
|
415
|
-
el.setAttribute(key, attrs[key]);
|
|
416
|
-
}
|
|
417
|
-
});
|
|
418
|
-
}
|
|
419
|
-
if (content) {
|
|
420
|
-
if (typeof content === 'string') {
|
|
421
|
-
el.textContent = content;
|
|
422
|
-
}
|
|
423
|
-
else if (Array.isArray(content)) {
|
|
424
|
-
content.forEach(function(child) { el.appendChild(child); });
|
|
425
|
-
}
|
|
426
|
-
else {
|
|
427
|
-
el.appendChild(content);
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
return el;
|
|
431
|
-
};
|
|
432
|
-
|
|
433
|
-
// Get currently focused element
|
|
434
|
-
// Usage: const focused = STX.activeElement()
|
|
435
|
-
window.STX.activeElement = function() {
|
|
436
|
-
return document.activeElement;
|
|
437
|
-
};
|
|
438
|
-
|
|
439
|
-
// Escape HTML helper
|
|
440
|
-
// Usage: const safe = STX.escapeHtml(userInput)
|
|
441
|
-
window.STX.escapeHtml = function(text) {
|
|
442
|
-
var div = document.createElement('div');
|
|
443
|
-
div.textContent = text;
|
|
444
|
-
return div.innerHTML;
|
|
445
|
-
};
|
|
446
|
-
|
|
447
|
-
// MutationObserver for automatic lifecycle management
|
|
448
|
-
const observer = new MutationObserver(function(mutations) {
|
|
449
|
-
mutations.forEach(function(mutation) {
|
|
450
|
-
// Handle removed nodes
|
|
451
|
-
mutation.removedNodes.forEach(function(node) {
|
|
452
|
-
if (node.nodeType === 1 && node.__stx_instance__) {
|
|
453
|
-
window.STX.destroyComponent(node.__stx_instance__);
|
|
454
|
-
}
|
|
455
|
-
});
|
|
456
|
-
});
|
|
457
|
-
});
|
|
458
|
-
|
|
459
|
-
// Start observing when DOM is ready
|
|
460
|
-
if (document.readyState === 'loading') {
|
|
461
|
-
document.addEventListener('DOMContentLoaded', function() {
|
|
462
|
-
observer.observe(document.body, { childList: true, subtree: true });
|
|
463
|
-
});
|
|
464
|
-
}
|
|
465
|
-
else {
|
|
466
|
-
observer.observe(document.body, { childList: true, subtree: true });
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
console.log('[stx] Lifecycle runtime initialized');
|
|
470
|
-
})();
|
|
471
|
-
`}function x9($){return Symbol($)}var Tz=x9("theme"),Ez=x9("router"),bz=x9("i18n");import*as J3 from"crypto";function Z3($){let Z=/\$(\w+)\./g,J=[],X;while((X=Z.exec($))!==null)if(!J.includes(X[1]))J.push(X[1]);return J}function o8(){return`stx-${J3.randomBytes(4).toString("hex")}`}function s8($){return/\$\w+\./.test($)}function r8($){if(!$.includes("{{")||!/\$\w+\./.test($))return{html:$,bindings:[],stores:new Set};let Z=[],J=new Set,X=/<(\w+)([^>]*?)(\s*\/?>)/g,Q=$;return Q=Q.replace(X,(Y,G,z,q)=>{if(["script","style","template"].includes(G.toLowerCase()))return Y;let K=[],W=!1,U=z,H=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,j=[...z.matchAll(H)];for(let F of j){let L=F[0],O=F[1],V=F[2];if(s8(V)){W=!0;let w=V.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(w){let R=w[1];if(K.push({attr:O,expr:R,fullMatch:L,originalAttr:O}),Z3(R).forEach((A)=>J.add(A)),O==="text")U=U.replace(L,"");else if(O==="class")U=U.replace(L,'class=""');else if(O==="disabled"||O==="hidden")U=U.replace(L,"");else U=U.replace(L,`${O}=""`)}}}if(!W)return Y;let B=U.match(/\bid\s*=\s*"([^"]+)"/),_;if(B)_=B[1];else _=o8(),U=` id="${_}"${U}`;for(let F of K)Z.push({elementId:_,attribute:F.attr,expression:F.expr,stores:Z3(F.expr)});return`<${G}${U}${q}`}),{html:Q,bindings:Z,stores:J}}function a8($,Z){if($.length===0)return"";let J=Array.from(Z),X=`
|
|
472
|
-
<script>
|
|
473
|
-
(function() {
|
|
474
|
-
'use strict';
|
|
475
|
-
|
|
476
|
-
// Wait for stores to be available
|
|
477
|
-
function initBindings() {
|
|
478
|
-
var stores = window.VoideStores;
|
|
479
|
-
if (!stores) {
|
|
480
|
-
setTimeout(initBindings, 10);
|
|
481
|
-
return;
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
// Store references for expressions
|
|
485
|
-
// eslint-disable-next-line pickier/no-unused-vars
|
|
486
|
-
var $state = {};
|
|
487
|
-
`;for(let Q of J)X+=` $state.${Q} = stores.${Q} ? stores.${Q}.get() : {};
|
|
488
|
-
`;X+=`
|
|
489
|
-
// Binding update functions
|
|
490
|
-
function updateBindings() {
|
|
491
|
-
`;for(let Q of $){let{elementId:Y,attribute:G,expression:z}=Q,q=z.replace(/\$(\w+)\./g,"$state.$1.");if(G==="text")X+=` (function() {
|
|
492
|
-
var el = document.getElementById('${Y}');
|
|
493
|
-
if (el) {
|
|
494
|
-
try {
|
|
495
|
-
el.textContent = ${q};
|
|
496
|
-
}
|
|
497
|
-
catch (e) { console.error('Binding error:', e); }
|
|
498
|
-
}
|
|
499
|
-
})();
|
|
500
|
-
`;else if(G==="html")X+=` (function() {
|
|
501
|
-
var el = document.getElementById('${Y}');
|
|
502
|
-
if (el) {
|
|
503
|
-
try {
|
|
504
|
-
el.innerHTML = ${q};
|
|
505
|
-
}
|
|
506
|
-
catch (e) { console.error('Binding error:', e); }
|
|
507
|
-
}
|
|
508
|
-
})();
|
|
509
|
-
`;else if(G==="class")X+=` (function() {
|
|
510
|
-
var el = document.getElementById('${Y}');
|
|
511
|
-
if (el) {
|
|
512
|
-
try {
|
|
513
|
-
var value = ${q};
|
|
514
|
-
if (typeof value === 'string') {
|
|
515
|
-
// Dynamic class string - merge with existing static classes
|
|
516
|
-
// eslint-disable-next-line pickier/no-unused-vars
|
|
517
|
-
var staticClasses = el.getAttribute('data-static-class') || el.className;
|
|
518
|
-
if (!el.hasAttribute('data-static-class')) {
|
|
519
|
-
el.setAttribute('data-static-class', el.className);
|
|
520
|
-
}
|
|
521
|
-
el.className = (el.getAttribute('data-static-class') + ' ' + value).trim();
|
|
522
|
-
}
|
|
523
|
-
else if (typeof value === 'object') {
|
|
524
|
-
// Object syntax: { 'class-name': condition }
|
|
525
|
-
for (var cls in value) {
|
|
526
|
-
if (value[cls]) {
|
|
527
|
-
el.classList.add(cls);
|
|
528
|
-
}
|
|
529
|
-
else {
|
|
530
|
-
el.classList.remove(cls);
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
catch (e) { console.error('Binding error:', e); }
|
|
536
|
-
}
|
|
537
|
-
})();
|
|
538
|
-
`;else if(G==="show")X+=` (function() {
|
|
539
|
-
var el = document.getElementById('${Y}');
|
|
540
|
-
if (el) {
|
|
541
|
-
try {
|
|
542
|
-
el.style.display = (${q}) ? '' : 'none';
|
|
543
|
-
}
|
|
544
|
-
catch (e) { console.error('Binding error:', e); }
|
|
545
|
-
}
|
|
546
|
-
})();
|
|
547
|
-
`;else if(G==="if")X+=` (function() {
|
|
548
|
-
var el = document.getElementById('${Y}');
|
|
549
|
-
if (el) {
|
|
550
|
-
try {
|
|
551
|
-
el.style.visibility = (${q}) ? 'visible' : 'hidden';
|
|
552
|
-
}
|
|
553
|
-
catch (e) { console.error('Binding error:', e); }
|
|
554
|
-
}
|
|
555
|
-
})();
|
|
556
|
-
`;else X+=` (function() {
|
|
557
|
-
var el = document.getElementById('${Y}');
|
|
558
|
-
if (el) {
|
|
559
|
-
try {
|
|
560
|
-
var value = ${q};
|
|
561
|
-
if (value === false || value === null || value === undefined) {
|
|
562
|
-
el.removeAttribute('${G}');
|
|
563
|
-
}
|
|
564
|
-
else if (value === true) {
|
|
565
|
-
el.setAttribute('${G}', '');
|
|
566
|
-
}
|
|
567
|
-
else {
|
|
568
|
-
el.setAttribute('${G}', value);
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
catch (e) { console.error('Binding error:', e); }
|
|
572
|
-
}
|
|
573
|
-
})();
|
|
574
|
-
`}X+=` }
|
|
575
|
-
|
|
576
|
-
// Subscribe to stores and update on changes. Capture the disposers so
|
|
577
|
-
// SPA fragment swaps can tear down old bindings before the next page's
|
|
578
|
-
// runtime takes over \u2014 without this, every navigation between pages
|
|
579
|
-
// using reactive-bindings stacked another subscription on every store,
|
|
580
|
-
// walking detached DOM forever. See stacksjs/stx#1709.
|
|
581
|
-
var _disposers = [];
|
|
582
|
-
`;for(let Q of J)X+=` if (stores.${Q}) {
|
|
583
|
-
var _unsub_${Q} = stores.${Q}.subscribe(function(state) {
|
|
584
|
-
$state.${Q} = state;
|
|
585
|
-
updateBindings();
|
|
586
|
-
});
|
|
587
|
-
// store.subscribe() may return the disposer (preferred) or void; both
|
|
588
|
-
// are tolerated here.
|
|
589
|
-
if (typeof _unsub_${Q} === 'function') _disposers.push(_unsub_${Q});
|
|
590
|
-
}
|
|
591
|
-
`;return X+=`
|
|
592
|
-
// Initial update
|
|
593
|
-
updateBindings();
|
|
594
|
-
|
|
595
|
-
// Register this runtime's cleanup so SPA navigation can run it before
|
|
596
|
-
// swapping pages. The router (and any code) can call
|
|
597
|
-
// window.__stxCleanupBindings() to dispose subscriptions; we also wire
|
|
598
|
-
// 'popstate' and 'beforeunload' as a safety net for browser-driven nav.
|
|
599
|
-
function _cleanup() {
|
|
600
|
-
for (var i = 0; i < _disposers.length; i++) {
|
|
601
|
-
try { _disposers[i](); } catch (e) { /* swallow */ }
|
|
602
|
-
}
|
|
603
|
-
_disposers.length = 0;
|
|
604
|
-
}
|
|
605
|
-
if (!window.__stxBindingsCleanups) window.__stxBindingsCleanups = [];
|
|
606
|
-
window.__stxBindingsCleanups.push(_cleanup);
|
|
607
|
-
if (!window.__stxCleanupBindings) {
|
|
608
|
-
window.__stxCleanupBindings = function() {
|
|
609
|
-
var fns = window.__stxBindingsCleanups || [];
|
|
610
|
-
for (var i = 0; i < fns.length; i++) {
|
|
611
|
-
try { fns[i](); } catch (e) { /* swallow */ }
|
|
612
|
-
}
|
|
613
|
-
window.__stxBindingsCleanups = [];
|
|
614
|
-
};
|
|
615
|
-
window.addEventListener('popstate', window.__stxCleanupBindings);
|
|
616
|
-
window.addEventListener('beforeunload', window.__stxCleanupBindings);
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
// Start when DOM is ready
|
|
621
|
-
if (document.readyState === 'loading') {
|
|
622
|
-
document.addEventListener('DOMContentLoaded', initBindings);
|
|
623
|
-
}
|
|
624
|
-
else {
|
|
625
|
-
initBindings();
|
|
626
|
-
}
|
|
627
|
-
})();
|
|
628
|
-
</script>
|
|
629
|
-
`,X}function X3($){let{html:Z,bindings:J,stores:X}=r8($);if(J.length===0)return $;let Q=a8(J,X),Y=Z.lastIndexOf("</body>");if(Y!==-1)return Z.slice(0,Y)+Q+Z.slice(Y);return Z+Q}function Y3($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return t8(Z);case"google-analytics":return e8(Z);case"plausible":return $Z(Z);case"self-hosted":return ZZ(Z);case"custom":return JZ(Z);default:return""}}function t8($){let Z=$.fathom;if(!Z?.siteId)return"";let J=Z.scriptUrl||"https://cdn.usefathom.com/script.js",X=Z.defer!==!1?" defer":"",Q=[`data-site="${P0(Z.siteId)}"`];if(Z.honorDnt)Q.push('data-honor-dnt="true"');if(Z.spa)Q.push('data-spa="auto"');if(Z.canonical)Q.push(`data-canonical="${P0(Z.canonical)}"`);if(Z.auto===!1)Q.push('data-auto="false"');return`
|
|
630
|
-
<!-- Fathom Analytics -->
|
|
631
|
-
<script src="${P0(J)}" ${Q.join(" ")}${X}></script>
|
|
632
|
-
`}function e8($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let J=P0(Z.measurementId),X=Z.debug?`gtag('config', '${J}', { 'debug_mode': true });`:"";return`
|
|
633
|
-
<!-- Google Analytics -->
|
|
634
|
-
<script async src="https://www.googletagmanager.com/gtag/js?id=${J}"></script>
|
|
635
|
-
<script>
|
|
636
|
-
window.dataLayer = window.dataLayer || [];
|
|
637
|
-
function gtag(){dataLayer.push(arguments);}
|
|
638
|
-
gtag('js', new Date());
|
|
639
|
-
gtag('config', '${J}');
|
|
640
|
-
${X}
|
|
641
|
-
</script>
|
|
642
|
-
`}function $Z($){let Z=$.plausible;if(!Z?.domain)return"";let J=Z.scriptUrl||"https://plausible.io/js/script.js",X=[`data-domain="${P0(Z.domain)}"`],Q=J,Y=[];if(Z.trackLocalhost)Y.push("local");if(Z.hashMode)Y.push("hash");if(Y.length>0&&J==="https://plausible.io/js/script.js")Q=`https://plausible.io/js/script.${Y.join(".")}.js`;return`
|
|
643
|
-
<!-- Plausible Analytics -->
|
|
644
|
-
<script defer data-domain="${P0(Z.domain)}" src="${P0(Q)}"></script>
|
|
645
|
-
`}function ZZ($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let J=P0(Z.siteId),X=P0(Z.apiEndpoint),Q=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",Y=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
|
|
646
|
-
d.addEventListener('click',function(e){
|
|
647
|
-
var a=e.target.closest('a');
|
|
648
|
-
if(a&&a.hostname!==location.hostname){
|
|
649
|
-
t('outbound',{url:a.href});
|
|
650
|
-
}
|
|
651
|
-
});`:"";return`
|
|
652
|
-
<!-- Self-Hosted Analytics -->
|
|
653
|
-
<script data-site="${J}" data-api="${X}" defer>
|
|
654
|
-
(function(){
|
|
655
|
-
'use strict';
|
|
656
|
-
var d=document,w=window,n=navigator,s=d.currentScript;
|
|
657
|
-
var site=s.dataset.site,api=s.dataset.api;
|
|
658
|
-
${Q}
|
|
659
|
-
var q=[],sid=Math.random().toString(36).slice(2);
|
|
660
|
-
function t(e,p){
|
|
661
|
-
var x=new XMLHttpRequest();
|
|
662
|
-
x.open('POST',api+'/collect',true);
|
|
663
|
-
x.setRequestHeader('Content-Type','application/json');
|
|
664
|
-
x.send(JSON.stringify({
|
|
665
|
-
s:site,sid:sid,e:e,p:p||{},
|
|
666
|
-
u:location.href,r:d.referrer,t:d.title,
|
|
667
|
-
sw:screen.width,sh:screen.height
|
|
668
|
-
}));
|
|
669
|
-
}
|
|
670
|
-
function pv(){t('pageview');}
|
|
671
|
-
${Y}
|
|
672
|
-
${G}
|
|
673
|
-
if(d.readyState==='complete')pv();
|
|
674
|
-
else w.addEventListener('load',pv);
|
|
675
|
-
w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
|
|
676
|
-
})();
|
|
677
|
-
</script>
|
|
678
|
-
`}function JZ($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
|
|
679
|
-
<!-- Custom Analytics -->
|
|
680
|
-
<script>
|
|
681
|
-
${Z.inlineScript}
|
|
682
|
-
</script>
|
|
683
|
-
`;if(!Z.scriptUrl)return"";let J=[];if(Z.scriptId)J.push(`id="${P0(Z.scriptId)}"`);if(Z.attributes)for(let[Q,Y]of Object.entries(Z.attributes))J.push(`${P0(Q)}="${P0(Y)}"`);return`
|
|
684
|
-
<!-- Custom Analytics -->
|
|
685
|
-
<script${J.length>0?` ${J.join(" ")}`:""} src="${P0(Z.scriptUrl)}" defer></script>
|
|
686
|
-
`}function Q3($,Z){let J=Y3(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 P0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var Sz={name:"analytics",hasEndTag:!1,handler:async($,Z,J,X)=>{let Q=J.__stx_config||{};return Y3(Q)}};var XZ={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 G3($){let Z=$.heatmap;if(!Z?.enabled)return"";let J={...XZ,...Z};return`
|
|
687
|
-
<!-- stx Heatmap - Privacy-Compliant Tracking -->
|
|
688
|
-
<script>
|
|
689
|
-
(function() {
|
|
690
|
-
'use strict';
|
|
691
|
-
|
|
692
|
-
// Configuration
|
|
693
|
-
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})};
|
|
694
|
-
|
|
695
|
-
// Check Do Not Track
|
|
696
|
-
if (config.honorDnt && navigator.doNotTrack === '1') {
|
|
697
|
-
return;
|
|
698
|
-
}
|
|
699
|
-
|
|
700
|
-
// Check viewport constraints
|
|
701
|
-
var vw = window.innerWidth;
|
|
702
|
-
if (config.minViewportWidth && vw < config.minViewportWidth) return;
|
|
703
|
-
if (config.maxViewportWidth && vw > config.maxViewportWidth) return;
|
|
704
|
-
|
|
705
|
-
// Session management (anonymous, no cookies)
|
|
706
|
-
var session = {
|
|
707
|
-
sid: Math.random().toString(36).slice(2) + Date.now().toString(36),
|
|
708
|
-
page: location.pathname,
|
|
709
|
-
vw: window.innerWidth,
|
|
710
|
-
vh: window.innerHeight,
|
|
711
|
-
points: [],
|
|
712
|
-
started: Date.now(),
|
|
713
|
-
lastActivity: Date.now()
|
|
714
|
-
};
|
|
715
|
-
|
|
716
|
-
// Throttle helper
|
|
717
|
-
var lastMove = 0;
|
|
718
|
-
function throttle(fn, wait) {
|
|
719
|
-
return function() {
|
|
720
|
-
var now = Date.now();
|
|
721
|
-
if (now - lastMove >= wait) {
|
|
722
|
-
lastMove = now;
|
|
723
|
-
fn.apply(this, arguments);
|
|
724
|
-
}
|
|
725
|
-
};
|
|
726
|
-
}
|
|
727
|
-
|
|
728
|
-
// Get relative coordinates (percentage)
|
|
729
|
-
function getRelativeCoords(e) {
|
|
730
|
-
return {
|
|
731
|
-
x: Math.round((e.clientX / window.innerWidth) * 10000) / 100,
|
|
732
|
-
y: Math.round((e.clientY / window.innerHeight) * 10000) / 100
|
|
733
|
-
};
|
|
734
|
-
}
|
|
735
|
-
|
|
736
|
-
// Check if element should be ignored
|
|
737
|
-
function shouldIgnore(el) {
|
|
738
|
-
if (!el || !config.ignoreSelectors) return false;
|
|
739
|
-
for (var i = 0; i < config.ignoreSelectors.length; i++) {
|
|
740
|
-
if (el.matches && el.matches(config.ignoreSelectors[i])) return true;
|
|
741
|
-
if (el.closest && el.closest(config.ignoreSelectors[i])) return true;
|
|
742
|
-
}
|
|
743
|
-
return false;
|
|
744
|
-
}
|
|
745
|
-
|
|
746
|
-
// Get element selector (simplified, no IDs to preserve privacy)
|
|
747
|
-
function getSelector(el) {
|
|
748
|
-
if (!el || !el.tagName) return null;
|
|
749
|
-
var tag = el.tagName.toLowerCase();
|
|
750
|
-
var classes = el.className && typeof el.className === 'string'
|
|
751
|
-
? '.' + el.className.trim().split(/\\s+/).slice(0, 2).join('.')
|
|
752
|
-
: '';
|
|
753
|
-
return tag + classes;
|
|
754
|
-
}
|
|
755
|
-
|
|
756
|
-
// Find zone for element
|
|
757
|
-
function findZone(el) {
|
|
758
|
-
if (!config.zones || !el) return null;
|
|
759
|
-
for (var i = 0; i < config.zones.length; i++) {
|
|
760
|
-
var zone = config.zones[i];
|
|
761
|
-
if (el.closest && el.closest(zone.selector)) {
|
|
762
|
-
return zone.id;
|
|
763
|
-
}
|
|
764
|
-
}
|
|
765
|
-
return null;
|
|
766
|
-
}
|
|
767
|
-
|
|
768
|
-
// Capture custom attributes
|
|
769
|
-
function captureAttributes(el) {
|
|
770
|
-
if (!config.captureAttributes || !el) return null;
|
|
771
|
-
var attrs = {};
|
|
772
|
-
var hasAttrs = false;
|
|
773
|
-
for (var i = 0; i < config.captureAttributes.length; i++) {
|
|
774
|
-
var attr = config.captureAttributes[i];
|
|
775
|
-
var value = el.getAttribute && el.getAttribute(attr);
|
|
776
|
-
if (value) {
|
|
777
|
-
attrs[attr] = value;
|
|
778
|
-
hasAttrs = true;
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
return hasAttrs ? attrs : null;
|
|
782
|
-
}
|
|
783
|
-
|
|
784
|
-
// Add data point
|
|
785
|
-
function addPoint(point) {
|
|
786
|
-
session.lastActivity = Date.now();
|
|
787
|
-
if (session.points.length >= config.maxDataPoints) {
|
|
788
|
-
session.points.shift();
|
|
789
|
-
}
|
|
790
|
-
session.points.push(point);
|
|
791
|
-
|
|
792
|
-
// Send batch if threshold reached
|
|
793
|
-
if (config.endpoint && session.points.length >= config.batchSize) {
|
|
794
|
-
sendData();
|
|
795
|
-
}
|
|
796
|
-
}
|
|
797
|
-
|
|
798
|
-
// Send data to endpoint
|
|
799
|
-
function sendData() {
|
|
800
|
-
if (!config.endpoint || session.points.length === 0) return;
|
|
801
|
-
|
|
802
|
-
var data = {
|
|
803
|
-
sid: session.sid,
|
|
804
|
-
page: session.page,
|
|
805
|
-
vw: session.vw,
|
|
806
|
-
vh: session.vh,
|
|
807
|
-
points: session.points.splice(0, config.batchSize)
|
|
808
|
-
};
|
|
809
|
-
|
|
810
|
-
// Use sendBeacon for reliability
|
|
811
|
-
if (navigator.sendBeacon) {
|
|
812
|
-
navigator.sendBeacon(config.endpoint, JSON.stringify(data));
|
|
813
|
-
}
|
|
814
|
-
else {
|
|
815
|
-
var xhr = new XMLHttpRequest();
|
|
816
|
-
xhr.open('POST', config.endpoint, true);
|
|
817
|
-
xhr.setRequestHeader('Content-Type', 'application/json');
|
|
818
|
-
xhr.send(JSON.stringify(data));
|
|
819
|
-
}
|
|
820
|
-
}
|
|
821
|
-
|
|
822
|
-
// Mouse move handler
|
|
823
|
-
if (config.trackMouse) {
|
|
824
|
-
document.addEventListener('mousemove', throttle(function(e) {
|
|
825
|
-
if (shouldIgnore(e.target)) return;
|
|
826
|
-
var coords = getRelativeCoords(e);
|
|
827
|
-
addPoint({
|
|
828
|
-
x: coords.x,
|
|
829
|
-
y: coords.y,
|
|
830
|
-
type: 'move',
|
|
831
|
-
t: Date.now(),
|
|
832
|
-
zone: findZone(e.target)
|
|
833
|
-
});
|
|
834
|
-
}, config.samplingRate), { passive: true });
|
|
835
|
-
}
|
|
836
|
-
|
|
837
|
-
// Click handler
|
|
838
|
-
if (config.trackClicks) {
|
|
839
|
-
document.addEventListener('click', function(e) {
|
|
840
|
-
if (shouldIgnore(e.target)) return;
|
|
841
|
-
var coords = getRelativeCoords(e);
|
|
842
|
-
var point = {
|
|
843
|
-
x: coords.x,
|
|
844
|
-
y: coords.y,
|
|
845
|
-
type: 'click',
|
|
846
|
-
t: Date.now(),
|
|
847
|
-
el: getSelector(e.target),
|
|
848
|
-
zone: findZone(e.target)
|
|
849
|
-
};
|
|
850
|
-
var attrs = captureAttributes(e.target);
|
|
851
|
-
if (attrs) point.attrs = attrs;
|
|
852
|
-
addPoint(point);
|
|
853
|
-
}, { passive: true });
|
|
854
|
-
}
|
|
855
|
-
|
|
856
|
-
// Scroll handler
|
|
857
|
-
if (config.trackScroll) {
|
|
858
|
-
var lastScrollDepth = 0;
|
|
859
|
-
document.addEventListener('scroll', throttle(function() {
|
|
860
|
-
var scrollTop = window.pageYOffset || document.documentElement.scrollTop;
|
|
861
|
-
var scrollHeight = document.documentElement.scrollHeight - window.innerHeight;
|
|
862
|
-
var depth = scrollHeight > 0 ? Math.round((scrollTop / scrollHeight) * 100) : 0;
|
|
863
|
-
|
|
864
|
-
// Only track significant scroll changes (every 10%)
|
|
865
|
-
if (Math.abs(depth - lastScrollDepth) >= 10) {
|
|
866
|
-
lastScrollDepth = depth;
|
|
867
|
-
addPoint({
|
|
868
|
-
x: 50,
|
|
869
|
-
y: depth,
|
|
870
|
-
type: 'scroll',
|
|
871
|
-
t: Date.now(),
|
|
872
|
-
depth: depth
|
|
873
|
-
});
|
|
874
|
-
}
|
|
875
|
-
}, config.samplingRate * 2), { passive: true });
|
|
876
|
-
}
|
|
877
|
-
|
|
878
|
-
// Send remaining data on page unload
|
|
879
|
-
window.addEventListener('beforeunload', sendData);
|
|
880
|
-
window.addEventListener('visibilitychange', function() {
|
|
881
|
-
if (document.visibilityState === 'hidden') {
|
|
882
|
-
sendData();
|
|
883
|
-
}
|
|
884
|
-
});
|
|
885
|
-
|
|
886
|
-
// Persist data to localStorage if enabled
|
|
887
|
-
if (config.persistData) {
|
|
888
|
-
var storageKey = config.storagePrefix + '_' + session.page.replace(/\\//g, '_');
|
|
889
|
-
|
|
890
|
-
// Load existing data
|
|
891
|
-
try {
|
|
892
|
-
var stored = localStorage.getItem(storageKey);
|
|
893
|
-
if (stored) {
|
|
894
|
-
var parsed = JSON.parse(stored);
|
|
895
|
-
if (Date.now() - parsed.lastActivity < config.sessionTimeout * 60000) {
|
|
896
|
-
session.points = parsed.points || [];
|
|
897
|
-
}
|
|
898
|
-
}
|
|
899
|
-
}
|
|
900
|
-
catch (e) {}
|
|
901
|
-
|
|
902
|
-
// Save periodically
|
|
903
|
-
setInterval(function() {
|
|
904
|
-
try {
|
|
905
|
-
localStorage.setItem(storageKey, JSON.stringify({
|
|
906
|
-
points: session.points,
|
|
907
|
-
lastActivity: session.lastActivity
|
|
908
|
-
}));
|
|
909
|
-
}
|
|
910
|
-
catch (e) {}
|
|
911
|
-
}, 5000);
|
|
912
|
-
}
|
|
913
|
-
|
|
914
|
-
// Debug overlay
|
|
915
|
-
if (config.debugOverlay) {
|
|
916
|
-
var overlay = document.createElement('div');
|
|
917
|
-
overlay.id = 'stx-heatmap-overlay';
|
|
918
|
-
overlay.style.cssText = 'position:fixed;top:0;left:0;width:100%;height:100%;pointer-events:none;z-index:999999;';
|
|
919
|
-
document.body.appendChild(overlay);
|
|
920
|
-
|
|
921
|
-
var canvas = document.createElement('canvas');
|
|
922
|
-
canvas.width = window.innerWidth;
|
|
923
|
-
canvas.height = window.innerHeight;
|
|
924
|
-
canvas.style.cssText = 'width:100%;height:100%;';
|
|
925
|
-
overlay.appendChild(canvas);
|
|
926
|
-
var ctx = canvas.getContext('2d');
|
|
927
|
-
|
|
928
|
-
function renderOverlay() {
|
|
929
|
-
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
930
|
-
session.points.forEach(function(p) {
|
|
931
|
-
var x = (p.x / 100) * canvas.width;
|
|
932
|
-
var y = (p.y / 100) * canvas.height;
|
|
933
|
-
ctx.beginPath();
|
|
934
|
-
ctx.arc(x, y, p.type === 'click' ? 8 : 3, 0, Math.PI * 2);
|
|
935
|
-
ctx.fillStyle = p.type === 'click' ? 'rgba(255,0,0,0.5)' : 'rgba(0,0,255,0.2)';
|
|
936
|
-
ctx.fill();
|
|
937
|
-
});
|
|
938
|
-
requestAnimationFrame(renderOverlay);
|
|
939
|
-
}
|
|
940
|
-
renderOverlay();
|
|
941
|
-
|
|
942
|
-
window.addEventListener('resize', function() {
|
|
943
|
-
canvas.width = window.innerWidth;
|
|
944
|
-
canvas.height = window.innerHeight;
|
|
945
|
-
});
|
|
946
|
-
}
|
|
947
|
-
|
|
948
|
-
// Expose API for manual tracking and data export
|
|
949
|
-
window.stxHeatmap = {
|
|
950
|
-
// Get current session data
|
|
951
|
-
getData: function() {
|
|
952
|
-
return {
|
|
953
|
-
sid: session.sid,
|
|
954
|
-
page: session.page,
|
|
955
|
-
vw: session.vw,
|
|
956
|
-
vh: session.vh,
|
|
957
|
-
points: session.points.slice(),
|
|
958
|
-
started: session.started,
|
|
959
|
-
lastActivity: session.lastActivity
|
|
960
|
-
};
|
|
961
|
-
},
|
|
962
|
-
// Export data as JSON
|
|
963
|
-
exportJSON: function() {
|
|
964
|
-
return JSON.stringify(this.getData(), null, 2);
|
|
965
|
-
},
|
|
966
|
-
// Export data as CSV
|
|
967
|
-
exportCSV: function() {
|
|
968
|
-
var data = this.getData();
|
|
969
|
-
var lines = ['x,y,type,timestamp,element,zone,depth'];
|
|
970
|
-
data.points.forEach(function(p) {
|
|
971
|
-
lines.push([p.x, p.y, p.type, p.t, p.el || '', p.zone || '', p.depth || ''].join(','));
|
|
972
|
-
});
|
|
973
|
-
return lines.join('\\n');
|
|
974
|
-
},
|
|
975
|
-
// Manual data send
|
|
976
|
-
flush: function() {
|
|
977
|
-
sendData();
|
|
978
|
-
},
|
|
979
|
-
// Clear data
|
|
980
|
-
clear: function() {
|
|
981
|
-
session.points = [];
|
|
982
|
-
if (config.persistData) {
|
|
983
|
-
var storageKey = config.storagePrefix + '_' + session.page.replace(/\\//g, '_');
|
|
984
|
-
try { localStorage.removeItem(storageKey); }
|
|
985
|
-
catch (e) {}
|
|
986
|
-
}
|
|
987
|
-
},
|
|
988
|
-
// Add custom event
|
|
989
|
-
track: function(type, data) {
|
|
990
|
-
addPoint({
|
|
991
|
-
x: data && data.x || 0,
|
|
992
|
-
y: data && data.y || 0,
|
|
993
|
-
type: type,
|
|
994
|
-
t: Date.now(),
|
|
995
|
-
attrs: data
|
|
996
|
-
});
|
|
997
|
-
},
|
|
998
|
-
// Generate heatmap visualization
|
|
999
|
-
visualize: function(options) {
|
|
1000
|
-
options = options || {};
|
|
1001
|
-
var data = this.getData();
|
|
1002
|
-
var width = options.width || data.vw;
|
|
1003
|
-
var height = options.height || data.vh;
|
|
1004
|
-
var radius = options.radius || 20;
|
|
1005
|
-
var blur = options.blur || 15;
|
|
1006
|
-
var maxOpacity = options.maxOpacity || 0.6;
|
|
1007
|
-
|
|
1008
|
-
var canvas = document.createElement('canvas');
|
|
1009
|
-
canvas.width = width;
|
|
1010
|
-
canvas.height = height;
|
|
1011
|
-
var ctx = canvas.getContext('2d');
|
|
1012
|
-
|
|
1013
|
-
// Create heat points
|
|
1014
|
-
data.points.forEach(function(p) {
|
|
1015
|
-
var x = (p.x / 100) * width;
|
|
1016
|
-
var y = (p.y / 100) * height;
|
|
1017
|
-
var intensity = p.type === 'click' ? 1 : 0.3;
|
|
1018
|
-
|
|
1019
|
-
var gradient = ctx.createRadialGradient(x, y, 0, x, y, radius);
|
|
1020
|
-
gradient.addColorStop(0, 'rgba(255,0,0,' + intensity + ')');
|
|
1021
|
-
gradient.addColorStop(1, 'rgba(255,0,0,0)');
|
|
1022
|
-
ctx.fillStyle = gradient;
|
|
1023
|
-
ctx.fillRect(x - radius, y - radius, radius * 2, radius * 2);
|
|
1024
|
-
});
|
|
1025
|
-
|
|
1026
|
-
// Apply blur
|
|
1027
|
-
ctx.filter = 'blur(' + blur + 'px)';
|
|
1028
|
-
ctx.drawImage(canvas, 0, 0);
|
|
1029
|
-
ctx.filter = 'none';
|
|
1030
|
-
|
|
1031
|
-
// Colorize
|
|
1032
|
-
var imageData = ctx.getImageData(0, 0, width, height);
|
|
1033
|
-
var pixels = imageData.data;
|
|
1034
|
-
for (var i = 0; i < pixels.length; i += 4) {
|
|
1035
|
-
var alpha = pixels[i + 3];
|
|
1036
|
-
if (alpha > 0) {
|
|
1037
|
-
var ratio = alpha / 255;
|
|
1038
|
-
// Gradient: blue -> cyan -> green -> yellow -> red
|
|
1039
|
-
if (ratio < 0.25) {
|
|
1040
|
-
pixels[i] = 0;
|
|
1041
|
-
pixels[i + 1] = Math.round(ratio * 4 * 255);
|
|
1042
|
-
pixels[i + 2] = 255;
|
|
1043
|
-
}
|
|
1044
|
-
else if (ratio < 0.5) {
|
|
1045
|
-
pixels[i] = 0;
|
|
1046
|
-
pixels[i + 1] = 255;
|
|
1047
|
-
pixels[i + 2] = Math.round((1 - (ratio - 0.25) * 4) * 255);
|
|
1048
|
-
}
|
|
1049
|
-
else if (ratio < 0.75) {
|
|
1050
|
-
pixels[i] = Math.round((ratio - 0.5) * 4 * 255);
|
|
1051
|
-
pixels[i + 1] = 255;
|
|
1052
|
-
pixels[i + 2] = 0;
|
|
1053
|
-
}
|
|
1054
|
-
else {
|
|
1055
|
-
pixels[i] = 255;
|
|
1056
|
-
pixels[i + 1] = Math.round((1 - (ratio - 0.75) * 4) * 255);
|
|
1057
|
-
pixels[i + 2] = 0;
|
|
1058
|
-
}
|
|
1059
|
-
pixels[i + 3] = Math.round(alpha * maxOpacity);
|
|
1060
|
-
}
|
|
1061
|
-
}
|
|
1062
|
-
ctx.putImageData(imageData, 0, 0);
|
|
1063
|
-
|
|
1064
|
-
return canvas;
|
|
1065
|
-
}
|
|
1066
|
-
};
|
|
1067
|
-
})();
|
|
1068
|
-
</script>
|
|
1069
|
-
`}function z3($,Z){let J=G3(Z);if(!J)return $;let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+J+$.slice(X);return $+J}var q3={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,J,X)=>{let Q=J.__stx_config||{};if(Z.length>0){let Y=YZ(Z.join(" "));Q.heatmap={...Q.heatmap,...Y,enabled:!0}}return G3(Q)}};function YZ($){let Z={},J=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let X of J){let[Q,Y]=X.split("="),G=Y?.replace(/["']/g,"");switch(Q){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 K3{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,Q])=>({depth:X,count:Q})).sort((X,Q)=>X.depth-Q.depth)}getZoneStats($){let Z=new Map,J=this.getPageData($);for(let X of J)if(X.zone){let Q=Z.get(X.zone)||{clicks:0,hovers:0};if(X.type==="click")Q.clicks++;else if(X.type==="move")Q.hovers++;Z.set(X.zone,Q)}return Z}generateGridData($,Z=20){let J=this.getPageData($),X=[];for(let Y=0;Y<Z;Y++){X[Y]=[];for(let G=0;G<Z;G++)X[Y][G]=0}for(let Y of J){let G=Math.min(Math.floor(Y.x/100*Z),Z-1),z=Math.min(Math.floor(Y.y/100*Z),Z-1);X[z][G]+=Y.type==="click"?3:1}let Q=0;for(let Y of X)for(let G of Y)Q=Math.max(Q,G);return X.map((Y,G)=>Y.map((z,q)=>({x:q,y:G,intensity:Q>0?z/Q: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 vz(){return new K3}var QZ;((G)=>{G.Fade="fade";G.Slide="slide";G.Scale="scale";G.Flip="flip";G.Rotate="rotate";G.Custom="custom"})(QZ||={});var GZ;((X)=>{X.In="in";X.Out="out";X.Both="both"})(GZ||={});var zZ;((G)=>{G.Linear="linear";G.Ease="ease";G.EaseIn="ease-in";G.EaseOut="ease-out";G.EaseInOut="ease-in-out";G.Spring="spring"})(zZ||={});var e0={duration:300,delay:0,ease:"ease",direction:"both"};function qZ($,Z={}){let{duration:J,delay:X,ease:Q,direction:Y,custom:G}={...e0,...Z};if($==="custom"&&G)return G;switch($){case"fade":return`${Y==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Y==="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);"}
|
|
1070
|
-
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
|
|
1071
|
-
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }`;case"slide":return`${Y==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Y==="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);"}
|
|
1072
|
-
@keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
|
|
1073
|
-
@keyframes slideOut { from { transform: translateY(0); opacity: 1; } to { transform: translateY(20px); opacity: 0; } }`;case"scale":return`${Y==="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;":Y==="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);"}
|
|
1074
|
-
@keyframes scaleIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
|
|
1075
|
-
@keyframes scaleOut { from { transform: scale(1); opacity: 1; } to { transform: scale(0.95); opacity: 0; } }`;case"flip":return`${Y==="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;":Y==="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);"}
|
|
1076
|
-
@keyframes flipIn { from { transform: perspective(400px) rotateX(-90deg); opacity: 0; } to { transform: perspective(400px) rotateX(0); opacity: 1; } }
|
|
1077
|
-
@keyframes flipOut { from { transform: perspective(400px) rotateX(0); opacity: 1; } to { transform: perspective(400px) rotateX(90deg); opacity: 0; } }`;case"rotate":return`${Y==="in"?"transform: rotate(-90deg); opacity: 0; animation: rotateIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Y==="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);"}
|
|
1078
|
-
@keyframes rotateIn { from { transform: rotate(-90deg); opacity: 0; } to { transform: rotate(0); opacity: 1; } }
|
|
1079
|
-
@keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function KZ(){return`
|
|
1080
|
-
<script data-stx-scoped data-stx-run="once">
|
|
1081
|
-
// Motion preferences handling
|
|
1082
|
-
(function() {
|
|
1083
|
-
const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
1084
|
-
|
|
1085
|
-
if (prefersReducedMotion) {
|
|
1086
|
-
// Apply reduced motion settings
|
|
1087
|
-
document.documentElement.style.setProperty('--stx-transition-duration', '0ms');
|
|
1088
|
-
document.documentElement.setAttribute('data-reduced-motion', 'true');
|
|
1089
|
-
}
|
|
1090
|
-
else {
|
|
1091
|
-
document.documentElement.setAttribute('data-reduced-motion', 'false');
|
|
1092
|
-
}
|
|
1093
|
-
|
|
1094
|
-
// Listen for changes in preference
|
|
1095
|
-
window.matchMedia('(prefers-reduced-motion: reduce)').addEventListener('change', (e) => {
|
|
1096
|
-
if (e.matches) {
|
|
1097
|
-
document.documentElement.style.setProperty('--stx-transition-duration', '0ms');
|
|
1098
|
-
document.documentElement.setAttribute('data-reduced-motion', 'true');
|
|
1099
|
-
}
|
|
1100
|
-
else {
|
|
1101
|
-
document.documentElement.style.setProperty('--stx-transition-duration', '');
|
|
1102
|
-
document.documentElement.setAttribute('data-reduced-motion', 'false');
|
|
1103
|
-
}
|
|
1104
|
-
});
|
|
1105
|
-
})();
|
|
1106
|
-
</script>
|
|
1107
|
-
`}function WZ($){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 UZ($=0.1,Z="0px"){return`
|
|
1108
|
-
<script data-stx-scoped data-stx-run="always">
|
|
1109
|
-
// Intersection Observer for scroll animations
|
|
1110
|
-
(function() {
|
|
1111
|
-
const initObserver = () => {
|
|
1112
|
-
if (!('IntersectionObserver' in window)) {
|
|
1113
|
-
// For browsers that don't support IntersectionObserver, show all elements immediately
|
|
1114
|
-
const elements = document.querySelectorAll('.stx-observe');
|
|
1115
|
-
elements.forEach(el => el.classList.remove('stx-out'));
|
|
1116
|
-
return;
|
|
1117
|
-
}
|
|
1118
|
-
|
|
1119
|
-
// Create the observer
|
|
1120
|
-
const options = {
|
|
1121
|
-
root: null, // Use viewport
|
|
1122
|
-
rootMargin: '${Z}',
|
|
1123
|
-
threshold: ${$}
|
|
1124
|
-
};
|
|
1125
|
-
|
|
1126
|
-
const observer = new IntersectionObserver((entries) => {
|
|
1127
|
-
entries.forEach(entry => {
|
|
1128
|
-
if (entry.isIntersecting) {
|
|
1129
|
-
entry.target.classList.remove('stx-out');
|
|
1130
|
-
// Stop observing after animation is triggered
|
|
1131
|
-
observer.unobserve(entry.target);
|
|
1132
|
-
}
|
|
1133
|
-
});
|
|
1134
|
-
}, options);
|
|
1135
|
-
|
|
1136
|
-
// Start observing elements
|
|
1137
|
-
const elements = document.querySelectorAll('.stx-observe');
|
|
1138
|
-
elements.forEach(el => observer.observe(el));
|
|
1139
|
-
};
|
|
1140
|
-
|
|
1141
|
-
// Initialize observer when DOM is ready
|
|
1142
|
-
if (document.readyState === 'loading') {
|
|
1143
|
-
document.addEventListener('DOMContentLoaded', initObserver);
|
|
1144
|
-
}
|
|
1145
|
-
else {
|
|
1146
|
-
initObserver();
|
|
1147
|
-
}
|
|
1148
|
-
})();
|
|
1149
|
-
</script>
|
|
1150
|
-
`}function HZ(){return`
|
|
1151
|
-
<style id="stx-animation-base">
|
|
1152
|
-
:root {
|
|
1153
|
-
--stx-transition-duration: 300ms;
|
|
1154
|
-
--stx-transition-delay: 0ms;
|
|
1155
|
-
--stx-transition-ease: ease;
|
|
1156
|
-
}
|
|
1157
|
-
|
|
1158
|
-
@media (prefers-reduced-motion: reduce) {
|
|
1159
|
-
:root {
|
|
1160
|
-
--stx-transition-duration: 0ms;
|
|
1161
|
-
}
|
|
1162
|
-
}
|
|
1163
|
-
|
|
1164
|
-
[data-animate="false"] * {
|
|
1165
|
-
--stx-transition-duration: 0ms !important;
|
|
1166
|
-
animation-duration: 0ms !important;
|
|
1167
|
-
transition-duration: 0ms !important;
|
|
1168
|
-
}
|
|
1169
|
-
|
|
1170
|
-
/* Base transition classes */
|
|
1171
|
-
.stx-transition {
|
|
1172
|
-
transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
|
|
1173
|
-
transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
|
|
1174
|
-
backface-visibility: hidden; /* Improve animation performance */
|
|
1175
|
-
transform-style: preserve-3d; /* Better 3D transforms */
|
|
1176
|
-
}
|
|
1177
|
-
|
|
1178
|
-
/* Fade animations */
|
|
1179
|
-
.stx-fade {
|
|
1180
|
-
transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
|
|
1181
|
-
}
|
|
1182
|
-
|
|
1183
|
-
.stx-fade.stx-out {
|
|
1184
|
-
opacity: 0 !important;
|
|
1185
|
-
}
|
|
1186
|
-
|
|
1187
|
-
/* Scale animations */
|
|
1188
|
-
.stx-scale {
|
|
1189
|
-
transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
|
|
1190
|
-
opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
|
|
1191
|
-
}
|
|
1192
|
-
|
|
1193
|
-
.stx-scale.stx-out {
|
|
1194
|
-
transform: scale(0.85) !important;
|
|
1195
|
-
opacity: 0 !important;
|
|
1196
|
-
}
|
|
1197
|
-
|
|
1198
|
-
/* Flip animations */
|
|
1199
|
-
.stx-flip {
|
|
1200
|
-
transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
|
|
1201
|
-
opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
|
|
1202
|
-
perspective: 600px;
|
|
1203
|
-
}
|
|
1204
|
-
|
|
1205
|
-
.stx-flip.stx-out {
|
|
1206
|
-
transform: perspective(600px) rotateX(-90deg) !important;
|
|
1207
|
-
opacity: 0 !important;
|
|
1208
|
-
}
|
|
1209
|
-
|
|
1210
|
-
/* Rotate animations */
|
|
1211
|
-
.stx-rotate {
|
|
1212
|
-
transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
|
|
1213
|
-
opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
|
|
1214
|
-
}
|
|
1215
|
-
|
|
1216
|
-
.stx-rotate.stx-out {
|
|
1217
|
-
transform: rotate(-90deg) !important;
|
|
1218
|
-
opacity: 0 !important;
|
|
1219
|
-
}
|
|
1220
|
-
|
|
1221
|
-
/* Direction-based animations */
|
|
1222
|
-
.stx-from-left, .stx-from-right, .stx-from-top, .stx-from-bottom {
|
|
1223
|
-
transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
|
|
1224
|
-
opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
|
|
1225
|
-
}
|
|
1226
|
-
|
|
1227
|
-
.stx-from-left.stx-out {
|
|
1228
|
-
transform: translateX(-30px) !important;
|
|
1229
|
-
opacity: 0 !important;
|
|
1230
|
-
}
|
|
1231
|
-
|
|
1232
|
-
.stx-from-right.stx-out {
|
|
1233
|
-
transform: translateX(30px) !important;
|
|
1234
|
-
opacity: 0 !important;
|
|
1235
|
-
}
|
|
1236
|
-
|
|
1237
|
-
.stx-from-top.stx-out {
|
|
1238
|
-
transform: translateY(-30px) !important;
|
|
1239
|
-
opacity: 0 !important;
|
|
1240
|
-
}
|
|
1241
|
-
|
|
1242
|
-
.stx-from-bottom.stx-out {
|
|
1243
|
-
transform: translateY(30px) !important;
|
|
1244
|
-
opacity: 0 !important;
|
|
1245
|
-
}
|
|
1246
|
-
|
|
1247
|
-
/* Generic slide animations */
|
|
1248
|
-
.stx-slide {
|
|
1249
|
-
transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
|
|
1250
|
-
opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
|
|
1251
|
-
}
|
|
1252
|
-
|
|
1253
|
-
.stx-slide.stx-out {
|
|
1254
|
-
transform: translateY(30px) !important;
|
|
1255
|
-
opacity: 0 !important;
|
|
1256
|
-
}
|
|
1257
|
-
|
|
1258
|
-
/* Scroll animation observer class */
|
|
1259
|
-
.stx-observe {
|
|
1260
|
-
will-change: opacity, transform;
|
|
1261
|
-
transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
|
|
1262
|
-
transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
|
|
1263
|
-
}
|
|
1264
|
-
</style>
|
|
1265
|
-
`}function jZ($,Z,J={}){let{staggerDelay:X=50,sequence:Q=!1}=J;return`
|
|
1266
|
-
<script data-stx-scoped data-stx-run="always">
|
|
1267
|
-
// Animation Group: ${$}
|
|
1268
|
-
(function() {
|
|
1269
|
-
const elements = ${JSON.stringify(Z)};
|
|
1270
|
-
const staggerDelay = ${X};
|
|
1271
|
-
const sequence = ${Q};
|
|
1272
|
-
|
|
1273
|
-
function animateGroup() {
|
|
1274
|
-
elements.forEach((selector, index) => {
|
|
1275
|
-
const element = document.querySelector(selector);
|
|
1276
|
-
if (!element) return;
|
|
1277
|
-
|
|
1278
|
-
const delay = sequence ? index * staggerDelay : 0;
|
|
1279
|
-
element.style.setProperty('--stx-transition-delay', delay + 'ms');
|
|
1280
|
-
|
|
1281
|
-
// For elements using animation keyframes
|
|
1282
|
-
element.style.animationDelay = delay + 'ms';
|
|
1283
|
-
|
|
1284
|
-
// If the element is initially hidden, show it
|
|
1285
|
-
if (element.classList.contains('stx-out')) {
|
|
1286
|
-
setTimeout(() => {
|
|
1287
|
-
element.classList.remove('stx-out');
|
|
1288
|
-
}, 10); // Small delay to ensure styles are applied
|
|
1289
|
-
}
|
|
1290
|
-
});
|
|
1291
|
-
}
|
|
1292
|
-
|
|
1293
|
-
// Run when DOM is fully loaded
|
|
1294
|
-
if (document.readyState === 'loading') {
|
|
1295
|
-
document.addEventListener('DOMContentLoaded', animateGroup);
|
|
1296
|
-
}
|
|
1297
|
-
else {
|
|
1298
|
-
animateGroup();
|
|
1299
|
-
}
|
|
1300
|
-
})();
|
|
1301
|
-
</script>
|
|
1302
|
-
`}var g9={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 Q=Z[0],Y=Z.length>1?Number.parseInt(Z[1],10)||e0.duration:e0.duration,G=Z.length>2?Z[2]||e0.ease:e0.ease,z=Z.length>3?Number.parseInt(Z[3],10)||e0.delay:e0.delay,q=Z.length>4?Z[4]||e0.direction:e0.direction,K=`stx-transition-${Math.random().toString(36).substr(2,9)}`,W=qZ(Q,{duration:Y,delay:z,ease:G,direction:q}),U="stx-transition",H="";if(Q==="fade")H="stx-fade";else if(Q==="slide")H="stx-slide";else if(Q==="scale")H="stx-scale";else if(Q==="flip")H="stx-flip";else if(Q==="rotate")H="stx-rotate";return`<div id="${K}" class="${U} ${H} ${q==="out"?"stx-out":""}"
|
|
1303
|
-
style="--stx-transition-duration: ${Y}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${z}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},h9={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 Q=Z[0],Y=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,q=Z.length>4?Number.parseInt(Z[4],10)||0:0,K=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,W=`--stx-transition-duration: ${Y}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${q}ms; will-change: opacity, transform;`,U="stx-transition stx-observe stx-out";if(Q==="fade")U+=" stx-fade";else if(Q==="slide-up"||Q==="slide")U+=" stx-from-bottom";else if(Q==="slide-down")U+=" stx-from-top";else if(Q==="slide-left")U+=" stx-from-right";else if(Q==="slide-right")U+=" stx-from-left";else if(Q==="scale")U+=" stx-scale";else if(Q.includes("-"))U+=` stx-${Q}`;else U+=` stx-${Q}`;return`<div id="${K}" class="${U}" style="${W}" data-threshold="${z}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},u9={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 Q=Z[0],Y=Z.slice(1).map((K)=>K.startsWith("#")||K.startsWith(".")?K:`#${K}`),G=J.staggerDelay||50,z=J.sequence||!0,q=jZ(Q,Y,{staggerDelay:G,sequence:z});return`${$}
|
|
1304
|
-
${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},d9={name:"motion",handler:($,Z,J,X)=>{let Q=Z.length>0?Z[0].toLowerCase()==="true":!0,Y=KZ();return`<div data-animate="${Q?"auto":"true"}">${$}</div>${Y}`},hasEndTag:!0,description:"Controls motion and animation preferences"};function U3($,Z,J,X){let Q=$;if(X.animation?.enabled===!1)return Q;let Y=J.includes("test")&&J.includes("animation");if(!WZ(Q)&&!Y)return Q;if(!Q.includes('<style id="stx-animation-base">')){let z=HZ();Q=Q.replace("</head>",`${z}
|
|
1305
|
-
</head>`)}if(Q.includes("stx-observe")){if(!Q.includes("Intersection Observer for scroll animations")){let q=UZ(),K=Q.lastIndexOf("</body>");if(K!==-1)Q=Q.slice(0,K)+q+`
|
|
1306
|
-
`+Q.slice(K)}}return Q}var W3={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 BZ($,Z){let J=Z.map((X)=>{let Q=X.offset!==void 0?`${X.offset*100}%`:"from",Y=Object.entries(X.properties).map(([G,z])=>`${G}: ${z}`).join("; ");return`${Q} { ${Y} }`}).join(`
|
|
1307
|
-
`);return`@keyframes ${$} {
|
|
1308
|
-
${J}
|
|
1309
|
-
}`}var _Z={name:"keyframe",hasEndTag:!0,handler:($,Z,J,X)=>{if(Z.length<1)return`<div class="stx-error">@keyframe requires an animation name</div>${$}`;let Q=Z[0].replace(/['"`]/g,""),Y=Z[1]?Number.parseInt(Z[1],10):1000,G=Z[2]?.replace(/['"`]/g,"")||"ease",z=Z[3]||"1",q=Z[4]?.replace(/['"`]/g,"")||"normal",K=Z[5]?.replace(/['"`]/g,"")||"forwards",W=`stx-keyframe-${Math.random().toString(36).slice(2,9)}`,U=`
|
|
1310
|
-
animation-name: ${Q};
|
|
1311
|
-
animation-duration: ${Y}ms;
|
|
1312
|
-
animation-timing-function: ${G};
|
|
1313
|
-
animation-iteration-count: ${z};
|
|
1314
|
-
animation-direction: ${q};
|
|
1315
|
-
animation-fill-mode: ${K};
|
|
1316
|
-
`.trim().replace(/\s+/g," ");return`<div id="${W}" style="${U}">${$}</div>`},description:"Applies a keyframe animation to an element"};function VZ($,Z,J,X,Q){return`
|
|
1317
|
-
<script data-stx-scoped data-stx-run="always">
|
|
1318
|
-
(function() {
|
|
1319
|
-
const container = document.getElementById('${$}');
|
|
1320
|
-
if (!container) return;
|
|
1321
|
-
|
|
1322
|
-
const children = container.querySelectorAll('${Z}');
|
|
1323
|
-
children.forEach((child, index) => {
|
|
1324
|
-
const delay = ${J} + (index * ${X});
|
|
1325
|
-
child.style.setProperty('--stx-stagger-delay', delay + 'ms');
|
|
1326
|
-
child.style.animationDelay = delay + 'ms';
|
|
1327
|
-
child.classList.add('${Q}');
|
|
1328
|
-
});
|
|
1329
|
-
})();
|
|
1330
|
-
</script>`}var LZ={name:"stagger",hasEndTag:!0,handler:($,Z,J,X)=>{let Q=Z[0]?.replace(/['"`]/g,"")||"> *",Y=Z[1]?Number.parseInt(Z[1],10):100,G=Z[2]?Number.parseInt(Z[2],10):0,z=Z[3]?.replace(/['"`]/g,"")||"fade",q=`stx-stagger-${Math.random().toString(36).slice(2,9)}`,K="stx-stagger-item";if(z==="fade")K+=" stx-fade";else if(z==="slide")K+=" stx-from-bottom";else if(z==="scale")K+=" stx-scale";let W=VZ(q,Q,G,Y,K);return`${`
|
|
1331
|
-
<style>
|
|
1332
|
-
#${q} .stx-stagger-item {
|
|
1333
|
-
opacity: 0;
|
|
1334
|
-
animation: staggerIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-stagger-delay, 0ms) forwards;
|
|
1335
|
-
}
|
|
1336
|
-
@keyframes staggerIn {
|
|
1337
|
-
from { opacity: 0; transform: translateY(10px); }
|
|
1338
|
-
to { opacity: 1; transform: translateY(0); }
|
|
1339
|
-
}
|
|
1340
|
-
</style>`}<div id="${q}" class="stx-stagger-container">${$}</div>${W}`},description:"Applies staggered animations to child elements"};function OZ($){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 FZ={name:"spring",hasEndTag:!0,handler:($,Z,J,X)=>{let Q=Z[0]?.replace(/['"`]/g,"")||"default",Y;if(W3[Q])Y=W3[Q];else Y={stiffness:Number.parseInt(Q,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)}`,q=OZ(Y),K=`
|
|
1341
|
-
transition: all ${G}ms ${q};
|
|
1342
|
-
--stx-spring-stiffness: ${Y.stiffness};
|
|
1343
|
-
--stx-spring-damping: ${Y.damping};
|
|
1344
|
-
--stx-spring-mass: ${Y.mass};
|
|
1345
|
-
`.trim().replace(/\s+/g," ");return`<div id="${z}" class="stx-spring" style="${K}">${$}</div>`},description:"Applies spring physics animations to an element"};function xz($){let Z=`stx-timeline-${Math.random().toString(36).slice(2,9)}`;return`
|
|
1346
|
-
<script data-stx-scoped data-stx-run="always">
|
|
1347
|
-
(function() {
|
|
1348
|
-
const timeline = ${JSON.stringify($)};
|
|
1349
|
-
|
|
1350
|
-
function runTimeline() {
|
|
1351
|
-
timeline.forEach((entry, index) => {
|
|
1352
|
-
const element = document.querySelector(entry.selector);
|
|
1353
|
-
if (!element) return;
|
|
1354
|
-
|
|
1355
|
-
const keyframes = entry.keyframes.map(kf => {
|
|
1356
|
-
const frame = { ...kf.properties };
|
|
1357
|
-
if (kf.offset !== undefined) frame.offset = kf.offset;
|
|
1358
|
-
if (kf.easing) frame.easing = kf.easing;
|
|
1359
|
-
return frame;
|
|
1360
|
-
});
|
|
1361
|
-
|
|
1362
|
-
const options = {
|
|
1363
|
-
duration: entry.options.duration || 1000,
|
|
1364
|
-
delay: entry.options.delay || 0,
|
|
1365
|
-
easing: entry.options.easing || 'ease',
|
|
1366
|
-
iterations: entry.options.iterations || 1,
|
|
1367
|
-
direction: entry.options.direction || 'normal',
|
|
1368
|
-
fill: entry.options.fill || 'forwards'
|
|
1369
|
-
};
|
|
1370
|
-
|
|
1371
|
-
element.animate(keyframes, options);
|
|
1372
|
-
});
|
|
1373
|
-
}
|
|
1374
|
-
|
|
1375
|
-
if (document.readyState === 'loading') {
|
|
1376
|
-
document.addEventListener('DOMContentLoaded', runTimeline);
|
|
1377
|
-
}
|
|
1378
|
-
else {
|
|
1379
|
-
runTimeline();
|
|
1380
|
-
}
|
|
1381
|
-
})();
|
|
1382
|
-
</script>`}function gz($,Z,J){let X=BZ($,Z),Q=`
|
|
1383
|
-
.${$}-animation {
|
|
1384
|
-
animation-name: ${$};
|
|
1385
|
-
animation-duration: ${J.duration}ms;
|
|
1386
|
-
animation-timing-function: ${J.easing||"ease"};
|
|
1387
|
-
animation-delay: ${J.delay||0}ms;
|
|
1388
|
-
animation-iteration-count: ${J.iterations==="infinite"?"infinite":J.iterations||1};
|
|
1389
|
-
animation-direction: ${J.direction||"normal"};
|
|
1390
|
-
animation-fill-mode: ${J.fill||"forwards"};
|
|
1391
|
-
}`;return`${X}
|
|
1392
|
-
${Q}`}function hz($){let Z=$.trim().split(/\s+/),J={duration:300};for(let X=0;X<Z.length;X++){let Q=Z[X];if(/^\d+(?:ms|s)?$/.test(Q)){let Y=Number.parseInt(Q,10);if(X===0)J.duration=Q.endsWith("s")&&!Q.endsWith("ms")?Y*1000:Y;else J.delay=Q.endsWith("s")&&!Q.endsWith("ms")?Y*1000:Y}else if(Q==="infinite"||/^\d+$/.test(Q))J.iterations=Q==="infinite"?"infinite":Number.parseInt(Q,10);else if(["normal","reverse","alternate","alternate-reverse"].includes(Q))J.direction=Q;else if(["none","forwards","backwards","both"].includes(Q))J.fill=Q;else J.easing=Q}return J}function uz(){return`
|
|
1393
|
-
<script data-stx-scoped data-stx-run="once">
|
|
1394
|
-
window.__stxAnimation = {
|
|
1395
|
-
// Registry of animations
|
|
1396
|
-
animations: new Map(),
|
|
1397
|
-
|
|
1398
|
-
// Register a reusable animation
|
|
1399
|
-
register(name, keyframes, options) {
|
|
1400
|
-
this.animations.set(name, { keyframes, options });
|
|
1401
|
-
},
|
|
1402
|
-
|
|
1403
|
-
// Run an animation on an element
|
|
1404
|
-
animate(element, nameOrKeyframes, options = {}) {
|
|
1405
|
-
if (typeof element === 'string') {
|
|
1406
|
-
element = document.querySelector(element);
|
|
1407
|
-
}
|
|
1408
|
-
if (!element) return null;
|
|
1409
|
-
|
|
1410
|
-
let keyframes, defaultOptions;
|
|
1411
|
-
|
|
1412
|
-
if (typeof nameOrKeyframes === 'string' && this.animations.has(nameOrKeyframes)) {
|
|
1413
|
-
const registered = this.animations.get(nameOrKeyframes);
|
|
1414
|
-
keyframes = registered.keyframes;
|
|
1415
|
-
defaultOptions = registered.options;
|
|
1416
|
-
}
|
|
1417
|
-
else {
|
|
1418
|
-
keyframes = nameOrKeyframes;
|
|
1419
|
-
defaultOptions = {};
|
|
1420
|
-
}
|
|
1421
|
-
|
|
1422
|
-
const finalOptions = { ...defaultOptions, ...options };
|
|
1423
|
-
return element.animate(keyframes, finalOptions);
|
|
1424
|
-
},
|
|
1425
|
-
|
|
1426
|
-
// Animate multiple elements with stagger
|
|
1427
|
-
stagger(elements, keyframes, options = {}, staggerDelay = 100) {
|
|
1428
|
-
if (typeof elements === 'string') {
|
|
1429
|
-
elements = document.querySelectorAll(elements);
|
|
1430
|
-
}
|
|
1431
|
-
|
|
1432
|
-
const animations = [];
|
|
1433
|
-
Array.from(elements).forEach((el, index) => {
|
|
1434
|
-
const elementOptions = {
|
|
1435
|
-
...options,
|
|
1436
|
-
delay: (options.delay || 0) + (index * staggerDelay)
|
|
1437
|
-
};
|
|
1438
|
-
animations.push(this.animate(el, keyframes, elementOptions));
|
|
1439
|
-
});
|
|
1440
|
-
|
|
1441
|
-
return animations;
|
|
1442
|
-
},
|
|
1443
|
-
|
|
1444
|
-
// Chain animations sequentially
|
|
1445
|
-
async sequence(steps) {
|
|
1446
|
-
for (const step of steps) {
|
|
1447
|
-
const animation = this.animate(step.element, step.keyframes, step.options);
|
|
1448
|
-
if (animation) {
|
|
1449
|
-
await animation.finished;
|
|
1450
|
-
}
|
|
1451
|
-
}
|
|
1452
|
-
},
|
|
1453
|
-
|
|
1454
|
-
// Run animations in parallel
|
|
1455
|
-
parallel(steps) {
|
|
1456
|
-
return Promise.all(
|
|
1457
|
-
steps.map(step => {
|
|
1458
|
-
const animation = this.animate(step.element, step.keyframes, step.options);
|
|
1459
|
-
return animation ? animation.finished : Promise.resolve();
|
|
1460
|
-
})
|
|
1461
|
-
);
|
|
1462
|
-
}
|
|
1463
|
-
};
|
|
1464
|
-
</script>`}function dz($){let Z=$.customDirectives||[];return Z.push(g9),Z.push(u9),Z.push(d9),Z.push(h9),Z.push(_Z),Z.push(LZ),Z.push(FZ),{...$,customDirectives:Z}}function H3($){let Z=$.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!Z)return null;try{return Function(`return ${Z[1]}`)()}catch{return null}}function j3($){let Z=$?.layout;if(Z===!1)return!1;return typeof Z==="string"&&Z.trim()?Z.trim():void 0}var wZ=100,RZ=599,l9="__stxResponseStatus",Y2="__stxResponseHeaders";function x2($){return typeof $==="number"&&Number.isInteger($)&&$>=wZ&&$<=RZ}function pz($){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(x2(X))return X}return}function m9($,Z){if(!$||typeof $!=="object")return!1;let J=typeof Z==="string"&&/^\d+$/.test(Z.trim())?Number(Z.trim()):Z;if(!x2(J))return!1;return $[l9]=J,!0}function DZ($,Z,J){if(!$||typeof $!=="object")return;let X=String(Z??"").trim();if(!X)return;$[Y2]={...$[Y2],[X]:String(J)}}function NZ($){let Z=$?.[l9];return x2(Z)?Z:void 0}function AZ($){let Z=$?.[Y2];if(!Z||typeof Z!=="object")return;let J=Object.entries(Z).map(([X,Q])=>[X,String(Q)]);return J.length>0?Object.fromEntries(J):void 0}function iz($,Z){if(!$||!Z||$===Z||typeof Z!=="object")return;let J=NZ($);if(J!==void 0)Z[l9]=J;let X=AZ($);if(X)Z[Y2]={...Z[Y2],...X}}function B3($){return{setResponseStatus:(Z)=>{m9($,Z)},notFound:(Z=404)=>{let J=x2(Z)&&Z>=400?Z:404;m9($,J)},setResponseHeader:(Z,J)=>{DZ($,Z,J)}}}function _3($,Z,J={}){if(!$.includes("@status"))return $;let{filePath:X,buildMode:Q}=J,Y=Q==="compile",G="",z=0,q=/@status\s*\(/g,K;while((K=q.exec($))!==null){let W=MZ($,K.index+K[0].length-1);if(W<0)break;let U=$.slice(K.index+K[0].length,W).trim(),H=/^\d+$/.test(U)?Number(U):$0(U,Z),j=X?` in ${X}`:"";if(Y)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(!m9(Z,H))console.warn(`[stx] @status(${U})${j} is not an HTTP status (100-599) \u2014 ignoring it.`);G+=$.slice(z,K.index),z=W+1+($.slice(W+1).match(/^[^\S\n]*\n?/)?.[0].length??0),q.lastIndex=z}return z===0?$:G+$.slice(z)}function MZ($,Z){let J=1,X=null,Q=!1;for(let Y=Z+1;Y<$.length;Y++){let G=$[Y];if(Q){Q=!1;continue}if(X){if(G==="\\")Q=!0;else if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="(")J++;else if(G===")"&&--J===0)return Y}return-1}var kZ=0,IZ=0;function V3($,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 TZ($){let Z=[],J=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,X;while((X=J.exec($))!==null){let[Q,Y,G]=X,z=X.index,q=V3(G,"x-data");if(!q)continue;let K=`__stx_scope_${kZ++}`,W=V3(G,"x-init"),U=EZ($,Y,z+Q.length),H=$.slice(z,U.endIndex),j=bZ(H);Z.push({id:K,selector:`[data-stx-scope="${K}"]`,stateExpr:q,initExpr:W,bindings:[],refs:j})}return Z}function EZ($,Z,J){let X=1,Q=J,Y=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),z=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(X>0&&Q<$.length){Y.lastIndex=Q,G.lastIndex=Q,z.lastIndex=Q;let q=Y.exec($),K=G.exec($),W=z.exec($);if(W&&W.index<(q?.index??1/0)){Q=W.index+W[0].length;continue}if(!K)return{endIndex:$.length};if(q&&q.index<K.index)X++,Q=q.index+q[0].length;else{if(X--,X===0)return{endIndex:K.index+K[0].length};Q=K.index+K[0].length}}return{endIndex:$.length}}function bZ($){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,Q;while((Q=X.exec(J))!==null){let[,Y,G]=Q,z=yZ(Y);Z.set(G,z)}return Z}function yZ($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${IZ++}`}function CZ(){return`
|
|
1465
|
-
// STX Reactive Runtime - x-cloak and transition CSS
|
|
1466
|
-
(function() {
|
|
1467
|
-
var style = document.createElement('style');
|
|
1468
|
-
style.textContent = [
|
|
1469
|
-
'[x-cloak] { display: none !important; }',
|
|
1470
|
-
// Default transition classes
|
|
1471
|
-
'.stx-enter { opacity: 0; transform: scale(0.95); }',
|
|
1472
|
-
'.stx-enter-start { opacity: 0; transform: scale(0.95); }',
|
|
1473
|
-
'.stx-enter-active { transition: opacity 150ms ease-out, transform 150ms ease-out; }',
|
|
1474
|
-
'.stx-enter-to { opacity: 1; transform: scale(1); }',
|
|
1475
|
-
'.stx-leave { opacity: 1; transform: scale(1); }',
|
|
1476
|
-
'.stx-leave-start { opacity: 1; transform: scale(1); }',
|
|
1477
|
-
'.stx-leave-active { transition: opacity 100ms ease-in, transform 100ms ease-in; }',
|
|
1478
|
-
'.stx-leave-to { opacity: 0; transform: scale(0.95); }'
|
|
1479
|
-
].join('\\n');
|
|
1480
|
-
document.head.appendChild(style);
|
|
1481
|
-
})();
|
|
1482
|
-
|
|
1483
|
-
// STX Reactive Runtime
|
|
1484
|
-
/* eslint-disable pickier/no-unused-vars, no-console, prefer-const */
|
|
1485
|
-
window.__stx_reactive = (function() {
|
|
1486
|
-
'use strict';
|
|
1487
|
-
|
|
1488
|
-
// Deep reactive proxy that triggers onChange for any mutation
|
|
1489
|
-
function reactive(obj, onChange) {
|
|
1490
|
-
if (!obj || typeof obj !== 'object') return obj;
|
|
1491
|
-
return new Proxy(obj, {
|
|
1492
|
-
get(target, prop) {
|
|
1493
|
-
const value = target[prop];
|
|
1494
|
-
if (value && typeof value === 'object' && !Array.isArray(value) && !(value instanceof Promise)) {
|
|
1495
|
-
return reactive(value, onChange);
|
|
1496
|
-
}
|
|
1497
|
-
return value;
|
|
1498
|
-
},
|
|
1499
|
-
set(target, prop, value) {
|
|
1500
|
-
target[prop] = value;
|
|
1501
|
-
onChange(prop, value);
|
|
1502
|
-
return true;
|
|
1503
|
-
}
|
|
1504
|
-
});
|
|
1505
|
-
}
|
|
1506
|
-
|
|
1507
|
-
// Initialize an x-data scope: parse state, run init(), register into window.stx._scopes,
|
|
1508
|
-
// then let the signals runtime handle all directive processing (x-for, x-text, :bind, etc.)
|
|
1509
|
-
function initScope(scopeEl, initialState, bindings, refs, initExpr) {
|
|
1510
|
-
// Parse initial state (may contain methods including async init())
|
|
1511
|
-
var state;
|
|
1512
|
-
try {
|
|
1513
|
-
state = new Function('return (' + initialState + ')')();
|
|
1514
|
-
} catch (e) {
|
|
1515
|
-
console.error('[stx-reactive] Invalid x-data:', initialState, e);
|
|
1516
|
-
return;
|
|
1517
|
-
}
|
|
1518
|
-
|
|
1519
|
-
// Build $refs object
|
|
1520
|
-
var $refs = {};
|
|
1521
|
-
for (var name in refs) {
|
|
1522
|
-
if (Object.prototype.hasOwnProperty.call(refs, name)) {
|
|
1523
|
-
(function(refName, refId) {
|
|
1524
|
-
Object.defineProperty($refs, refName, {
|
|
1525
|
-
get: function() { return document.getElementById(refId); }
|
|
1526
|
-
});
|
|
1527
|
-
})(name, refs[name]);
|
|
1528
|
-
}
|
|
1529
|
-
}
|
|
1530
|
-
|
|
1531
|
-
// Extract init method from state if present (Alpine.js convention)
|
|
1532
|
-
var initMethod = state.init;
|
|
1533
|
-
if (typeof initMethod === 'function') {
|
|
1534
|
-
delete state.init;
|
|
1535
|
-
}
|
|
1536
|
-
|
|
1537
|
-
// Make state reactive \u2014 mutations trigger re-render via signals
|
|
1538
|
-
var scopeId = scopeEl.getAttribute('data-stx-scope');
|
|
1539
|
-
var stx = window.stx;
|
|
1540
|
-
|
|
1541
|
-
// Create signals for each state property so the signals runtime can track dependencies
|
|
1542
|
-
var signalState = {};
|
|
1543
|
-
var rawState = {};
|
|
1544
|
-
for (var key in state) {
|
|
1545
|
-
if (Object.prototype.hasOwnProperty.call(state, key)) {
|
|
1546
|
-
if (typeof state[key] === 'function') {
|
|
1547
|
-
// Methods \u2014 bind to a proxy so 'this.prop = val' triggers signal updates
|
|
1548
|
-
signalState[key] = state[key];
|
|
1549
|
-
} else {
|
|
1550
|
-
// Data properties \u2014 wrap in signals for reactivity
|
|
1551
|
-
signalState[key] = stx.state(state[key]);
|
|
1552
|
-
rawState[key] = true;
|
|
1553
|
-
}
|
|
1554
|
-
}
|
|
1555
|
-
}
|
|
1556
|
-
|
|
1557
|
-
// Create a proxy context that auto-unwraps signals and writes back through them.
|
|
1558
|
-
// Methods get 'this' bound to this proxy so this.foo = bar triggers reactivity.
|
|
1559
|
-
var ctx = {};
|
|
1560
|
-
var ctxProxy = new Proxy(ctx, {
|
|
1561
|
-
get: function(target, prop) {
|
|
1562
|
-
if (prop === '$refs') return $refs;
|
|
1563
|
-
if (prop === '$el') return scopeEl;
|
|
1564
|
-
if (prop === '$nextTick') return function(fn) { requestAnimationFrame(fn); };
|
|
1565
|
-
var s = signalState[prop];
|
|
1566
|
-
if (!s) return undefined;
|
|
1567
|
-
if (rawState[prop] && s && typeof s === 'function' && typeof s.value !== 'undefined') {
|
|
1568
|
-
return s.value; // unwrap signal
|
|
1569
|
-
}
|
|
1570
|
-
if (typeof s === 'function' && !rawState[prop]) {
|
|
1571
|
-
return s.bind(ctxProxy); // bind methods to proxy
|
|
1572
|
-
}
|
|
1573
|
-
return s;
|
|
1574
|
-
},
|
|
1575
|
-
set: function(target, prop, value) {
|
|
1576
|
-
var s = signalState[prop];
|
|
1577
|
-
if (rawState[prop] && s && typeof s === 'function') {
|
|
1578
|
-
s.value = value; // write through signal \u2014 triggers effects
|
|
1579
|
-
} else {
|
|
1580
|
-
signalState[prop] = value;
|
|
1581
|
-
}
|
|
1582
|
-
return true;
|
|
1583
|
-
},
|
|
1584
|
-
has: function(target, prop) {
|
|
1585
|
-
return prop in signalState || prop === '$refs' || prop === '$el' || prop === '$nextTick';
|
|
1586
|
-
},
|
|
1587
|
-
ownKeys: function() {
|
|
1588
|
-
return Object.keys(signalState).concat(['$refs', '$el', '$nextTick']);
|
|
1589
|
-
},
|
|
1590
|
-
getOwnPropertyDescriptor: function(target, prop) {
|
|
1591
|
-
if (prop in signalState || prop === '$refs' || prop === '$el' || prop === '$nextTick') {
|
|
1592
|
-
return { configurable: true, enumerable: true, writable: true, value: ctxProxy[prop] };
|
|
1593
|
-
}
|
|
1594
|
-
return undefined;
|
|
1595
|
-
}
|
|
1596
|
-
});
|
|
1597
|
-
|
|
1598
|
-
// Build scope vars for the signals runtime \u2014 it reads these for expression evaluation.
|
|
1599
|
-
// We need to provide getter/setter descriptors so signals track properly.
|
|
1600
|
-
var scopeVars = {};
|
|
1601
|
-
for (var k in signalState) {
|
|
1602
|
-
if (Object.prototype.hasOwnProperty.call(signalState, k)) {
|
|
1603
|
-
if (rawState[k]) {
|
|
1604
|
-
// Data: expose the signal directly so expressions trigger dependency tracking
|
|
1605
|
-
scopeVars[k] = signalState[k];
|
|
1606
|
-
} else {
|
|
1607
|
-
// Method: bind to ctxProxy so 'this' works
|
|
1608
|
-
scopeVars[k] = (typeof signalState[k] === 'function') ? signalState[k].bind(ctxProxy) : signalState[k];
|
|
1609
|
-
}
|
|
1610
|
-
}
|
|
1611
|
-
}
|
|
1612
|
-
scopeVars.$refs = $refs;
|
|
1613
|
-
scopeVars.$el = scopeEl;
|
|
1614
|
-
scopeVars.$nextTick = function(fn) { requestAnimationFrame(fn); };
|
|
1615
|
-
|
|
1616
|
-
// Register scope \u2014 merge with any existing vars from partial signal scripts
|
|
1617
|
-
if (!stx._scopes) stx._scopes = {};
|
|
1618
|
-
stx._scopes[scopeId] = Object.assign(stx._scopes[scopeId] || {}, scopeVars);
|
|
1619
|
-
|
|
1620
|
-
// Store on element for findElementScope
|
|
1621
|
-
scopeEl.__stx_scope = scopeVars;
|
|
1622
|
-
|
|
1623
|
-
// Run init() if present (supports async)
|
|
1624
|
-
function runInit() {
|
|
1625
|
-
var maybePromise;
|
|
1626
|
-
if (initMethod) {
|
|
1627
|
-
maybePromise = initMethod.call(ctxProxy);
|
|
1628
|
-
}
|
|
1629
|
-
if (initExpr) {
|
|
1630
|
-
try {
|
|
1631
|
-
var keys = Object.keys(scopeVars);
|
|
1632
|
-
var vals = keys.map(function(k) { return scopeVars[k]; });
|
|
1633
|
-
var fn = new Function(keys.join(','), initExpr);
|
|
1634
|
-
var result = fn.apply(ctxProxy, vals);
|
|
1635
|
-
if (result && typeof result.then === 'function') maybePromise = result;
|
|
1636
|
-
} catch (e) {
|
|
1637
|
-
console.warn('[stx-reactive] init expression error:', e);
|
|
1638
|
-
}
|
|
1639
|
-
}
|
|
1640
|
-
// If init is async, signal updates will trigger effects automatically
|
|
1641
|
-
// when init() resolves and sets this.prop = value (writes through signal)
|
|
1642
|
-
if (maybePromise && typeof maybePromise.then === 'function') {
|
|
1643
|
-
maybePromise.catch(function(e) {
|
|
1644
|
-
console.error('[stx-reactive] async init() error:', e);
|
|
1645
|
-
});
|
|
1646
|
-
}
|
|
1647
|
-
}
|
|
1648
|
-
|
|
1649
|
-
// Run init before the signals runtime processes this scope
|
|
1650
|
-
runInit();
|
|
1651
|
-
|
|
1652
|
-
// Expose for debugging
|
|
1653
|
-
scopeEl.__stx_state = ctxProxy;
|
|
1654
|
-
scopeEl.__stx_execute = function(stmt, $event, $el) {
|
|
1655
|
-
try {
|
|
1656
|
-
// Run the statement with the reactive proxy as the lexical scope.
|
|
1657
|
-
// Wrapping in a with-block on the proxy makes bare reads/writes go
|
|
1658
|
-
// through it (so foo = bar triggers signal.set()) instead of treating
|
|
1659
|
-
// each state key as a local function parameter \u2014 bare assignments
|
|
1660
|
-
// would otherwise just rebind the local and never reach the signal.
|
|
1661
|
-
var fn = new Function('$event', '$el', 'with(this){' + stmt + ';}');
|
|
1662
|
-
fn.call(ctxProxy, $event, $el);
|
|
1663
|
-
} catch (e) {
|
|
1664
|
-
console.warn('[stx-reactive] execute error:', e);
|
|
1665
|
-
}
|
|
1666
|
-
};
|
|
1667
|
-
}
|
|
1668
|
-
|
|
1669
|
-
return { initScope: initScope, reactive: reactive };
|
|
1670
|
-
})();
|
|
1671
|
-
`}function L3($,Z){let J=$.replace(/\{!!([\s\S]*?)!!\}/g,(z,q)=>{try{let K=S0(q,Z,!0);if(K===void 0)return z;return String(K)}catch{return z}}),X="",Q=0,Y=null;while(Q<J.length){let z=J[Q];if(Y&&z==="\\"){X+=z+(J[Q+1]??""),Q+=2;continue}if(z==="{"&&J[Q+1]==="{"){let q=J.indexOf("}}",Q+2);if(q!==-1){let K=J.slice(Q,q+2);X+=G(J.slice(Q+2,q),K,Y),Q=q+2;continue}}if(Y){if(z===Y)Y=null}else if(z==="'"||z==='"'||z==="`")Y=z;X+=z,Q++}return X;function G(z,q,K){let W;try{W=S0(z,Z,!0)}catch{return q}if(W===void 0)return q;if(K){let U=String(W).replace(/\\/g,"\\\\").replace(new RegExp(K==="`"?"`":K,"g"),`\\${K}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return K==="`"?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 SZ($,Z){if($.length===0)return"";let J=$.map((X)=>{let Q=JSON.stringify(Object.fromEntries(X.refs)),Y=L3(X.stateExpr,Z),G=X.initExpr?L3(X.initExpr,Z):null,z=JSON.stringify(Y),q=G?JSON.stringify(G):"null";return`
|
|
1672
|
-
(function() {
|
|
1673
|
-
var scopeEl = document.querySelector('${X.selector}');
|
|
1674
|
-
if (!scopeEl) return;
|
|
1675
|
-
var refs = ${Q};
|
|
1676
|
-
__stx_reactive.initScope(scopeEl, ${z}, [], refs, ${q});
|
|
1677
|
-
})();`}).join(`
|
|
1678
|
-
`);return`
|
|
1679
|
-
<script data-stx-scoped data-stx-reactive data-stx-run="always">
|
|
1680
|
-
${CZ()}
|
|
1681
|
-
${J}
|
|
1682
|
-
</script>`}function O3($,Z,J){if(!vZ($))return $;let X=TZ($);if(X.length===0)return $;let Q=PZ($,X),Y=SZ(X,Z),G=Q.lastIndexOf("</body>");if(G!==-1)Q=Q.slice(0,G)+Y+`
|
|
1683
|
-
`+Q.slice(G);else Q+=Y;return Q}function PZ($,Z){let J=0,X=$.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(Q,Y,G)=>{let z=Z[J++];if(!z)return Q;let q=/data-stx-scope="([^"]*)"/.exec(G);if(q)return z.id=q[1],z.selector=`[data-stx-scope="${z.id}"]`,Q;return`<${Y} 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 vZ($){return/x-data\s*=\s*["']/.test($)}import kJ from"fs";import q5 from"path";import{createHighlighter as IJ}from"ts-syntax-highlighter";import c2 from"fs";import E0 from"path";import{loadConfigWithResult as FJ}from"bunfig";Q2();async function fZ($,Z,J,X){let Q=Z[0]?.replace(/['"]/g,"")||"main",Y=c9();if(Q!=="main")Y=Y.replace("container:'main'",`container:'${Q}'`);return`<script data-stx-router>${Y}</script>`}var F3={name:"stxRouter",handler:fZ,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"};function Q1($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function w3($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function R3($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,J=$.match(Z);if(!J)return{data:{},content:$.trim()};let X=J[1],Q=$.slice(J[0].length),Y={};for(let G of X.split(`
|
|
1684
|
-
`)){let z=G.trim();if(!z||z.startsWith("#"))continue;let q=z.indexOf(":");if(q===-1)continue;let K=z.slice(0,q).trim(),W=z.slice(q+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)}Y[K]=W}return{data:Y,content:Q.trim()}}function G2($,Z={}){let{gfm:J=!0,breaks:X=!1}=Z,Q=$,Y=[];if(Q=Q.replace(/```(\w*)\n([\s\S]*?)```/g,(W,U,H)=>{let j=Y.length,B=U?` class="language-${Q1(U)}"`:"";return Y.push(`<pre><code${B}>${Q1(H.trim())}</code></pre>`),`\x00CODEBLOCK${j}\x00`}),Q=Q.replace(/`([^`]*)`/g,(W,U)=>`<code>${Q1(U)}</code>`),Q=Q.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),Q=Q.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),Q=Q.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),Q=Q.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),Q=Q.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),Q=Q.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),Q=Q.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),Q=Q.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),Q=Q.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),Q=Q.replace(/__(.+?)__/g,"<strong>$1</strong>"),Q=Q.replace(/\*(.+?)\*/g,"<em>$1</em>"),Q=Q.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),J)Q=Q.replace(/~~(.+?)~~/g,"<del>$1</del>");if(Q=Q.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(W,U,H)=>{return`<img src="${w3(H)?Q1(H):""}" alt="${Q1(U)}" />`}),Q=Q.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(W,U,H)=>{return`<a href="${w3(H)?Q1(H):""}">${U}</a>`}),Q=Q.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),Q=Q.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),Q=Q.replace(/<\/blockquote>\n<blockquote>/g,`
|
|
1685
|
-
`),Q=Q.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),Q=Q.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),Q=Q.replace(/<\/ul>\n<ul>/g,""),Q=Q.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),Q=Q.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),Q=Q.replace(/<\/ol>\n<ol>/g,""),Q=Q.replace(/<li data-ul>/g,"<li>"),Q=Q.replace(/<li data-ol>/g,"<li>"),J)Q=Q.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(W,U,H)=>{let B=`<tr>${U.split("|").map((F)=>F.trim()).filter(Boolean).map((F)=>`<th>${Q1(F)}</th>`).join("")}</tr>`,_=H.trim().split(`
|
|
1686
|
-
`).map((F)=>{return`<tr>${F.split("|").map((O)=>O.trim()).filter(Boolean).map((O)=>`<td>${Q1(O)}</td>`).join("")}</tr>`}).join(`
|
|
1687
|
-
`);return`<table>
|
|
1688
|
-
<thead>
|
|
1689
|
-
${B}
|
|
1690
|
-
</thead>
|
|
1691
|
-
<tbody>
|
|
1692
|
-
${_}
|
|
1693
|
-
</tbody>
|
|
1694
|
-
</table>`});if(J)Q=Q.replace(/<li>\s*\[\s*\]\s*/g,'<li><input type="checkbox" disabled /> '),Q=Q.replace(/<li>\s*\[x\]\s*/gi,'<li><input type="checkbox" checked disabled /> ');let G=Q.split(`
|
|
1695
|
-
`),z=[],q=!1,K=[];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(q&&K.length>0)z.push(`<p>${K.join(X?`<br />
|
|
1696
|
-
`:`
|
|
1697
|
-
`)}</p>`),K=[],q=!1;z.push(W)}else q=!0,K.push(U)}if(q&&K.length>0)z.push(`<p>${K.join(X?`<br />
|
|
1698
|
-
`:`
|
|
1699
|
-
`)}</p>`);if(Q=z.join(`
|
|
1700
|
-
`),X)Q=Q.replace(/\n/g,`<br />
|
|
1701
|
-
`);for(let W=0;W<Y.length;W++)Q=Q.replace(`\x00CODEBLOCK${W}\x00`,Y[W]);return Q=Q.replace(/<p>\s*<\/p>/g,""),Q.trim()}async function D3($,Z,J=""){let X=$,Q=[],Y=/@markdown(?:\([^)]*\))?/g,G;while((G=Y.exec($))!==null){let z=G.index,q=G[0].match(/@markdown\(([^)]*)\)/),K=q?q[1]:"",W=z+G[0].length,U=1,H=W,j=-1;while(U>0&&H<$.length){let F=$.indexOf("@markdown",H),L=$.indexOf("@endmarkdown",H);if(L===-1)break;if(F!==-1&&F<L&&F!==z){let O=$[F+9];if(O==="("||O===`
|
|
1702
|
-
`||O==="\r"||O===" "||O===void 0)U++;H=F+9}else{if(U--,U===0){j=L;break}H=L+12}}if(j===-1)continue;let B=$.slice(W,j),_=$.slice(z,j+12);Q.push({fullMatch:_,options:K,content:B,index:z}),Y.lastIndex=j+12}for(let{fullMatch:z,options:q,content:K,index:W}of Q)try{let U={};if(q)q.split(",").forEach((B)=>{let _=B.trim();if(_)U[_]=!0});let H={gfm:U.gfm??!0,breaks:U.breaks??!1},j=G2(K.trim(),H);X=X.split(z).join(j)}catch(U){let H=U instanceof Error?U.message:String(U),j=H0("Markdown Directive",`Error processing markdown: ${H}`,J,$,W,z);X=X.split(z).join(j)}return X}async function N3($,Z,J,X){let Q={gfm:!0,breaks:!1};return Z.forEach((Y)=>{let G=Y.trim().replace(/['"]/g,"");if(G==="breaks")Q.breaks=!0;if(G==="no-gfm")Q.gfm=!1}),G2($.trim(),Q)}var L1=[320,480,640,768,1024,1280,1536,1920,2560],A3=[1,1.5,2,3],y1=["avif","webp","jpeg"],M3={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"},xZ={avif:"avif",webp:"webp",jpeg:"jpg",png:"png",gif:"gif"};function z2($,Z=L1,J={},X){return Z.sort((Q,Y)=>Q-Y).map((Q)=>{return`${G1($,{...J,w:Q,fm:X})} ${Q}w`}).join(", ")}function Qq($,Z=320,J=2560,X=0.08,Q={},Y){let G=gZ(Z,J,X);return z2($,G,Q,Y)}function gZ($,Z,J=0.08){let X=[],Q=$;while(Q<Z)X.push(Math.round(Q)),Q*=1+J*2;if(X[X.length-1]!==Z)X.push(Z);return X}function p9($,Z,J=A3,X={},Q){return J.sort((Y,G)=>Y-G).map((Y)=>{let G=Math.round(Z*Y);return`${G1($,{...X,w:G,dpr:Y,fm:Q})} ${Y}x`}).join(", ")}function Gq($,Z,J=A3,X=80,Q={},Y){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,q)=>z-q).map((z)=>{let q=Math.round(Z*z),K=G[z]||Math.round(X*Math.max(0.5,1-z*0.1));return`${G1($,{...Q,w:q,q:K,dpr:z,fm:Y})} ${z}x`}).join(", ")}function i9($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let X=Object.entries($).map(([Q,Y])=>{let G=/^\d+$/.test(Q)?`${Q}px`:Q;return{bp:G,size:Y,numericBp:Number.parseInt(G)||0}}).sort((Q,Y)=>Q.numericBp-Y.numericBp).map(({bp:Q,size:Y})=>`(max-width: ${Q}) ${Y}`);return X.push(Z),X.join(", ")}function zq($,Z="100vw"){if(!$||$.length===0)return Z;let X=[...$].sort((Q,Y)=>(Q.maxWidth||0)-(Y.maxWidth||0)).filter((Q)=>Q.maxWidth).map((Q)=>`(max-width: ${Q.maxWidth}px) ${Q.imageWidth}`);return X.push(Z),X.join(", ")}var qq={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 G1($,Z={}){let J=Object.entries(Z).filter(([,Y])=>Y!==void 0&&Y!==null).map(([Y,G])=>{if(Array.isArray(G))return[Y,G.join(",")];return[Y,String(G)]});if(J.length===0)return $;let X=J.map(([Y,G])=>`${Y}=${encodeURIComponent(G)}`).join("&"),Q=$.includes("?")?"&":"?";return`${$}${Q}${X}`}function Kq($){let[Z,J]=$.split("?"),X={};if(J)new URLSearchParams(J).forEach((Y,G)=>{if(/^\d+$/.test(Y))X[G]=Number.parseInt(Y,10);else if(/^\d+\.\d+$/.test(Y))X[G]=Number.parseFloat(Y);else if(Y==="true")X[G]=!0;else if(Y==="false")X[G]=!1;else X[G]=Y});return{src:Z,params:X}}function Wq($){let{src:Z,widths:J,dprValues:X,fixedWidth:Q,formats:Y=y1,baseUrl:G="",params:z={}}=$,q=[];for(let K of Y){let W,U;if(Q!==void 0&&X)W=p9(Z,Q,X,z,K),U=X.map((H)=>({path:"",url:G1(Z,{...z,w:Math.round(Q*H),fm:K}),width:Math.round(Q*H),height:0,format:K,size:0,dpr:H}));else{let H=J||L1;W=z2(Z,H,z,K),U=H.map((j)=>({path:"",url:G1(Z,{...z,w:j,fm:K}),width:j,height:0,format:K,size:0}))}q.push({srcset:W,format:K,mimeType:M3[K],variants:U})}return q}function Uq($,Z="100vw"){return $.map(({srcset:J,mimeType:X})=>`<source type="${X}" srcset="${J}" sizes="${Z}" />`).join(`
|
|
1703
|
-
`)}function Hq($,Z){if($.length===0)return;let J=[...$].sort((Q,Y)=>Q.width-Y.width),X=J.find((Q)=>Q.width>=Z);if(X)return X;return J[J.length-1]}function n9($){return M3[$]||"application/octet-stream"}function jq($){return xZ[$]||$}function Bq($){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 hZ={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},o9=`
|
|
1704
|
-
.stx-img-placeholder {
|
|
1705
|
-
position: relative;
|
|
1706
|
-
overflow: hidden;
|
|
1707
|
-
background-size: cover;
|
|
1708
|
-
background-position: center;
|
|
1709
|
-
background-repeat: no-repeat;
|
|
1710
|
-
}
|
|
1711
|
-
|
|
1712
|
-
.stx-img-placeholder img {
|
|
1713
|
-
opacity: 0;
|
|
1714
|
-
transition: opacity var(--stx-img-transition-duration, 300ms) var(--stx-img-transition-easing, ease-out);
|
|
1715
|
-
}
|
|
1716
|
-
|
|
1717
|
-
.stx-img-placeholder.stx-img-loaded img {
|
|
1718
|
-
opacity: 1;
|
|
1719
|
-
}
|
|
1720
|
-
|
|
1721
|
-
.stx-img-blur {
|
|
1722
|
-
filter: blur(20px);
|
|
1723
|
-
transform: scale(1.1);
|
|
1724
|
-
transition: filter var(--stx-img-transition-duration, 300ms) var(--stx-img-transition-easing, ease-out),
|
|
1725
|
-
transform var(--stx-img-transition-duration, 300ms) var(--stx-img-transition-easing, ease-out);
|
|
1726
|
-
}
|
|
1727
|
-
|
|
1728
|
-
.stx-img-loaded .stx-img-blur {
|
|
1729
|
-
filter: blur(0);
|
|
1730
|
-
transform: scale(1);
|
|
1731
|
-
}
|
|
1732
|
-
`.trim();async function s9(){try{return await import("ts-images")}catch{return null}}async function k3($,Z={}){let J={...hZ,...Z},X=await s9();if(X)try{return await uZ($,J,X)}catch(Q){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Q}`)}return I3($,J)}async function uZ($,Z,J){let{generatePlaceholder:X,generateThumbHash:Q}=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 Q($)).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 I3($,Z){let J=Z.width||20,X=Z.height||J,Q="#e5e7eb",Y=`<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(Y)}`,width:J,height:X,aspectRatio:J/X,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}async function Vq($){let Z=await s9();if(Z)try{return(await Z.generateThumbHash($)).dataUrl}catch{}return(await I3($,{strategy:"thumbhash",width:32,height:32})).dataURL}function Lq($){let Z=$[0]|$[1]<<8|$[2]<<16,J=(Z&63)/63,X=(Z>>6&63)/31.5-1,Q=(Z>>12&63)/31.5-1,Y=(Z>>18&31)/31,G=Z>>23!==0,z=$[3]|$[4]<<8,q=(z>>3&63)/63,K=(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,_=Math.max(0,Math.min(255,Math.round((J+X)*255))),F=Math.max(0,Math.min(255,Math.round(J*255))),L=Math.max(0,Math.min(255,Math.round((J-X)*255))),O=`<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32">
|
|
1733
|
-
<rect fill="rgb(${_},${F},${L})" width="32" height="32"/>
|
|
1734
|
-
</svg>`;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(O)}`}async function Oq($,Z=20,J=50){return k3($,{strategy:"blur",width:Z,quality:J,blurLevel:40})}async function Fq($){let Z=await s9();if(Z)try{return(await Z.generatePlaceholder($,{strategy:"dominant-color"})).dominantColor||"#e5e7eb"}catch{}return"#e5e7eb"}function wq($,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 T3($,Z,J={}){let X=J.transitionDuration||300,Q=J.easing||"ease-out";return`
|
|
1735
|
-
#${$} {
|
|
1736
|
-
--stx-img-transition-duration: ${X}ms;
|
|
1737
|
-
--stx-img-transition-easing: ${Q};
|
|
1738
|
-
background-image: url('${Z.dataURL}');
|
|
1739
|
-
background-size: cover;
|
|
1740
|
-
background-position: center;
|
|
1741
|
-
}
|
|
1742
|
-
|
|
1743
|
-
#${$} img {
|
|
1744
|
-
opacity: 0;
|
|
1745
|
-
transition: opacity var(--stx-img-transition-duration) var(--stx-img-transition-easing);
|
|
1746
|
-
}
|
|
1747
|
-
|
|
1748
|
-
#${$}.stx-img-loaded img {
|
|
1749
|
-
opacity: 1;
|
|
1750
|
-
}
|
|
1751
|
-
`.trim()}function Rq($){return`background-image: url('${$.dataURL}'); background-size: cover; background-position: center;`}var C1=new Map;async function E3($,Z={}){let J=`${$}:${JSON.stringify(Z)}`;if(C1.has(J))return C1.get(J);let X=await k3($,Z);return C1.set(J,X),X}function Dq(){C1.clear()}function Nq(){return{size:C1.size,keys:Array.from(C1.keys())}}async function dZ(){try{return await import("./chunk-22p0ezj6.js")}catch($){if(!b3)console.warn("[stx-media] Image processor not available, some features disabled:",$),b3=!0;return null}}var b3=!1,r9=80,g2="async",h2="lazy",y3=!1;async function q2($,Z={}){let J=Z,X=$;if(X.process&&!X.skipOptimization){if(J.tsImagesConfig?.enabled&&!J.isDev)return iZ(X,J)}if(J.processedResult?.processed)return e9($,J.processedResult,Z);if(J.responsiveVariants)return P3($,J.responsiveVariants,Z);let{src:Q,alt:Y,width:G,height:z,sizes:q,widths:K=L1,dpr:W,formats:U=y1,quality:H=r9,params:j={},placeholder:B="none",placeholderOptions:_={},lazy:F=!0,priority:L=!1,loading:O=L?"eager":h2,decoding:V=g2,fetchpriority:w,objectFit:R,objectPosition:D,crossorigin:A,referrerpolicy:I}=$,N=$.class,M=$.style,T=$.id,k=$.data||{},{isDev:y=!1,baseUrl:E=""}=Z;if(y&&!Z.optimize)return cZ($);let b,C,v=T||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(B!=="none"&&!L)try{b=await E3(Q,{strategy:B,..._}),C=T3(v,b,_)}catch{}let P=W!==void 0&&G!==void 0,g;if(P)g=lZ($,v,b,Z);else g=await mZ($,v,b,Z);let f;if(L){let M0=U.includes("webp")?"webp":U[0],y0=z2(Q,K,{...j,q:H},M0),Z0=typeof q==="object"?i9(q):q||"100vw";f=`<link rel="preload" as="image" imagesrcset="${y0}" imagesizes="${Z0}" />`}let r=[];if(!y3&&B!=="none")r.push(o9),y3=!0;if(C)r.push(C);let r0=F?S3(v):void 0;return{html:g,preloadLink:f,css:r.length>0?r.join(`
|
|
1752
|
-
`):void 0,script:r0}}async function mZ($,Z,J,X){let{src:Q,alt:Y,width:G,height:z,sizes:q,widths:K=L1,formats:W=y1,quality:U=r9,params:H={},lazy:j=!0,priority:B=!1,loading:_=B?"eager":h2,decoding:F=g2,fetchpriority:L,objectFit:O,objectPosition:V,crossorigin:w,referrerpolicy:R}=$,D=$.class,A=$.style,I=$.data||{},N=typeof q==="object"?i9(q):q||"100vw",M=[];for(let y of W){let E=z2(Q,K,{...H,q:U},y),b=n9(y);if(j&&!B)M.push(` <source type="${b}" data-srcset="${E}" data-sizes="${N}" />`);else M.push(` <source type="${b}" srcset="${E}" sizes="${N}" />`)}let T=a9({src:G1(Q,{...H,q:U}),alt:Y,width:G,height:z,loading:B?void 0:_,decoding:F,fetchpriority:B?"high":L,objectFit:O,objectPosition:V,crossorigin:w,referrerpolicy:R,className:C3(D,J),style:t9(A,O,V,J),lazy:j&&!B,data:I}),k;if(J){let y=`background-image: url('${J.dataURL}'); background-size: cover; background-position: center;`;k=`<div id="${Z}" class="stx-img-placeholder" style="${y}">
|
|
1753
|
-
<picture>
|
|
1754
|
-
${M.join(`
|
|
1755
|
-
`)}
|
|
1756
|
-
<img ${T} />
|
|
1757
|
-
</picture>
|
|
1758
|
-
</div>`}else k=`<picture${Z?` id="${Z}"`:""}>
|
|
1759
|
-
${M.join(`
|
|
1760
|
-
`)}
|
|
1761
|
-
<img ${T} />
|
|
1762
|
-
</picture>`;return k}function lZ($,Z,J,X){let{src:Q,alt:Y,width:G,height:z,dpr:q=[1,2,3],quality:K=r9,params:W={},lazy:U=!0,priority:H=!1,loading:j=H?"eager":h2,decoding:B=g2,fetchpriority:_,objectFit:F,objectPosition:L,crossorigin:O,referrerpolicy:V}=$,w=$.class,R=$.style,D=$.data||{},A=typeof G==="number"?G:Number.parseInt(String(G),10),I=p9(Q,A,q,{...W,q:K}),N=a9({src:G1(Q,{...W,w:A,q:K}),alt:Y,width:G,height:z,loading:H?void 0:j,decoding:B,fetchpriority:H?"high":_,objectFit:F,objectPosition:L,crossorigin:O,referrerpolicy:V,className:C3(w,J),style:t9(R,F,L,J),lazy:U&&!H,data:D}),M=U&&!H?`data-srcset="${I}"`:`srcset="${I}"`;if(J){let T=`background-image: url('${J.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${T}">
|
|
1763
|
-
<img ${N} ${M} />
|
|
1764
|
-
</div>`}return`<img ${Z?`id="${Z}" `:""}${N} ${M} />`}function cZ($){let{src:Z,alt:J,width:X,height:Q,loading:Y=h2,decoding:G=g2,fetchpriority:z,objectFit:q,objectPosition:K,crossorigin:W,referrerpolicy:U,priority:H=!1}=$,j=$.class,B=$.style,_=$.id,F=$.data||{};return{html:`<img ${a9({src:Z,alt:J,width:X,height:Q,loading:H?"eager":Y,decoding:G,fetchpriority:H?"high":z,objectFit:q,objectPosition:K,crossorigin:W,referrerpolicy:U,className:j,style:t9(B,q,K),id:_,data:F})} />`}}function a9($){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 C3($,Z){let J=[];if($)J.push($);if(Z)J.push("stx-img-blur");return J.join(" ")||""}function t9($,Z,J,X){let Q=[];if(Z)Q.push(`object-fit: ${Z}`);if(J)Q.push(`object-position: ${J}`);if(X)Q.push("opacity: 0; transition: opacity 300ms ease-out");if($)Q.push($);return Q.join("; ")}function m0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function S3($){return`
|
|
1765
|
-
(function() {
|
|
1766
|
-
const container = document.getElementById('${$}');
|
|
1767
|
-
if (!container) return;
|
|
1768
|
-
|
|
1769
|
-
const img = container.querySelector('img[data-stx-lazy]') || container;
|
|
1770
|
-
if (!img.dataset.src && !img.dataset.srcset) return;
|
|
1771
|
-
|
|
1772
|
-
const observer = new IntersectionObserver((entries) => {
|
|
1773
|
-
entries.forEach(entry => {
|
|
1774
|
-
if (entry.isIntersecting) {
|
|
1775
|
-
// Load image
|
|
1776
|
-
if (img.dataset.src) img.src = img.dataset.src;
|
|
1777
|
-
if (img.dataset.srcset) img.srcset = img.dataset.srcset;
|
|
1778
|
-
|
|
1779
|
-
// Load sources
|
|
1780
|
-
const sources = container.querySelectorAll('source[data-srcset]');
|
|
1781
|
-
sources.forEach(source => {
|
|
1782
|
-
if (source.dataset.srcset) source.srcset = source.dataset.srcset;
|
|
1783
|
-
if (source.dataset.sizes) source.sizes = source.dataset.sizes;
|
|
1784
|
-
});
|
|
1785
|
-
|
|
1786
|
-
// Handle load completion
|
|
1787
|
-
img.onload = () => {
|
|
1788
|
-
img.style.opacity = '1';
|
|
1789
|
-
if (container.classList.contains('stx-img-placeholder')) {
|
|
1790
|
-
container.classList.add('stx-img-loaded');
|
|
1791
|
-
}
|
|
1792
|
-
};
|
|
1793
|
-
|
|
1794
|
-
observer.disconnect();
|
|
1795
|
-
}
|
|
1796
|
-
});
|
|
1797
|
-
}, { rootMargin: '50px' });
|
|
1798
|
-
|
|
1799
|
-
observer.observe(container);
|
|
1800
|
-
})();
|
|
1801
|
-
`.trim()}function pZ($){let Z=$.match(/<Img\s+([^>]*?)\/?>/);if(!Z)return null;let J=Z[1],X={},Q=/(:?)(\w+)(?:=(?:"([^"]*)"|'([^']*)'|\{([^}]+)\}))?/g,Y;while((Y=Q.exec(J))!==null){let[,G,z,q,K,W]=Y,U=q??K??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 Iq($,Z={}){let J=/<Img\s+[^>]*?\/?>/g,X=[],Q=[],Y=[],G=$,z=[],q;while((q=J.exec($))!==null)z.push({match:q[0],index:q.index});for(let K=z.length-1;K>=0;K--){let{match:W}=z[K],U=pZ(W);if(U){let H=await q2(U,Z);if(G=G.replace(W,H.html),H.preloadLink)X.push(H.preloadLink);if(H.css)Q.push(H.css);if(H.script)Y.push(H.script)}}return{html:G,preloadLinks:X,styles:Q,scripts:Y}}async function iZ($,Z){let J=await dZ();if(!J)return q2({...$,process:!1},Z);let X=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let Y=await J.generateResponsiveVariants($.src,$,X);if(Y)return P3($,Y,Z)}else{let Y=await J.processImage($.src,$,X);if(Y.processed)return e9($,Y,Z)}return q2({...$,process:!1},Z)}async function e9($,Z,J){let{alt:X,width:Q,height:Y,lazy:G=!0,priority:z=!1,objectFit:q,objectPosition:K,crossorigin:W,referrerpolicy:U}=$,H=$.class,j=$.style,B=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,_=$.data||{},F=Z.variants||[],L=F.find((C)=>C.format==="jpeg")||F.find((C)=>C.format==="webp")||F[0],O=L?.url||$.src,V=F.filter((C)=>C.format===(L?.format||"jpeg")).map((C)=>`${C.url} ${C.width}w`).join(", "),w=new Map;for(let C of F){if(!w.has(C.format))w.set(C.format,[]);w.get(C.format).push(C)}let R=[],D=["avif","webp","jpeg","png"];for(let C of D){let v=w.get(C);if(v&&v.length>0){let P=v.map((f)=>`${f.url} ${f.width}w`).join(", "),g=n9(C);if(G&&!z)R.push(` <source type="${g}" data-srcset="${P}" />`);else R.push(` <source type="${g}" srcset="${P}" />`)}}let A=[];if(G&&!z){if(A.push(`data-src="${m0(O)}"`),A.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)A.push(`data-srcset="${V}"`)}else if(A.push(`src="${m0(O)}"`),V)A.push(`srcset="${V}"`);A.push(`alt="${m0(X)}"`);let I=Q||Z.originalWidth,N=Y||Z.originalHeight;if(I)A.push(`width="${I}"`);if(N)A.push(`height="${N}"`);if(!z)A.push(`loading="${G?"lazy":"eager"}"`);if(A.push('decoding="async"'),z)A.push('fetchpriority="high"');if(W)A.push(`crossorigin="${W}"`);if(U)A.push(`referrerpolicy="${U}"`);let M=[];if(q)M.push(`object-fit: ${q}`);if(K)M.push(`object-position: ${K}`);if(Z.placeholder&&G)M.push("opacity: 0; transition: opacity 300ms ease-out");if(j)M.push(j);if(M.length>0)A.push(`style="${M.join("; ")}"`);let T=[];if(H)T.push(H);if(Z.placeholder)T.push("stx-img-blur");if(T.length>0)A.push(`class="${T.join(" ")}"`);if(G&&!z)A.push("data-stx-lazy");for(let[C,v]of Object.entries(_))A.push(`data-${C}="${m0(v)}"`);let k;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let C=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;k=`<div id="${B}" class="stx-img-placeholder" style="${C}">
|
|
1802
|
-
<picture>
|
|
1803
|
-
${R.join(`
|
|
1804
|
-
`)}
|
|
1805
|
-
<img ${A.join(" ")} />
|
|
1806
|
-
</picture>
|
|
1807
|
-
</div>`}else k=`<picture${B?` id="${B}"`:""}>
|
|
1808
|
-
${R.join(`
|
|
1809
|
-
`)}
|
|
1810
|
-
<img ${A.join(" ")} />
|
|
1811
|
-
</picture>`;let y=[];if(Z.placeholder)y.push(o9);let E=G?S3(B):void 0,b;if(z&&V)b=`<link rel="preload" as="image" imagesrcset="${V}" />`;return{html:k,preloadLink:b,css:y.length>0?y.join(`
|
|
1812
|
-
`):void 0,script:E}}async function P3($,Z,J){let X={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[Q,Y]of Object.entries(Z.byFormat))if(Y)X.variants.push(...Y);return e9($,X,J)}function nZ(){return u2({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,J,X)=>{let{src:Q,alt:Y,options:G}=oZ($,Z,J);if(!Q)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let z={src:Q,alt:Y||"",widths:G.widths||L1,formats:G.formats||y1,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},q=J.__isDev||!1,K=await q2(z,{isDev:q}),W=K.html;if(K.preloadLink)W=K.preloadLink+`
|
|
1813
|
-
`+W;if(K.css)W+=`
|
|
1814
|
-
<style>${K.css}</style>`;if(K.script)W+=`
|
|
1815
|
-
<script>${K.script}</script>`;return W},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function oZ($,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 Q=sZ(X),Y=$5(Q[0],J)||"",G=$5(Q[1],J)||"",z={};if(Q[2]){let q=$5(Q[2],J);if(typeof q==="object"&&q!==null)z=q;else if(typeof Q[2]==="string")try{z=JSON.parse(Q[2])}catch{}}return{src:Y,alt:G,options:z}}function sZ($){let Z=[],J="",X=!1,Q="",Y=0,G=0;for(let z=0;z<$.length;z++){let q=$[z],K=z>0?$[z-1]:"";if((q==='"'||q==="'"||q==="`")&&K!=="\\"){if(!X)X=!0,Q=q;else if(q===Q)X=!1,Q="";else J+=q;continue}if(!X){if(q==="{")Y++;if(q==="}")Y--;if(q==="[")G++;if(q==="]")G--;if(q===","&&Y===0&&G===0){Z.push(J.trim()),J="";continue}}J+=q}if(J.trim())Z.push(J.trim());return Z}function $5($,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 v3=nZ();async function x3(){try{return await import("./chunk-nvxv2wxv.js")}catch($){if(!f3)console.warn("[stx-media] Video processor not available, some features disabled:",$),f3=!0;return null}}var f3=!1,g3=!0,h3="metadata",rZ="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";async function d2($,Z={}){let J=Z,X=$;if(X.process&&!X.skipProcessing){if(J.tsVideosConfig?.enabled&&!J.isDev)return ZJ(X,J)}if(J.processedResult?.processed)return d3($,J.processedResult,Z);let Q;if(X.generatePoster&&X.src&&!$.poster)Q=await JJ(X,J);let{src:Y,sources:G=[],poster:z,posterPlaceholder:q,controls:K=g3,autoplay:W=!1,muted:U=!1,loop:H=!1,preload:j=h3,playsinline:B=!0,lazy:_=!0,player:F="native",type:L,width:O,height:V,crossorigin:w,disablePictureInPicture:R=!1,disableRemotePlayback:D=!1}=$,A=Q||z,I=$.class,N=$.style,M=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(F==="ts-video")return tZ($,Z);if(L&&L!=="video")return aZ(Y||"",L,$);let T=G.length>0?G:Y?[{src:Y,type:u3(Y)}]:[],k=[`id="${M}"`];if(K)k.push("controls");if(W)k.push("autoplay");if(U)k.push("muted");if(H)k.push("loop");if(B)k.push("playsinline");if(R)k.push("disablepictureinpicture");if(D)k.push("disableremoteplayback");if(w)k.push(`crossorigin="${w}"`);if(_){if(k.push(`data-preload="${j}"`),k.push('preload="none"'),A)k.push(`data-poster="${D0(A)}"`);k.push("data-stx-lazy")}else if(k.push(`preload="${j}"`),A)k.push(`poster="${D0(A)}"`);if(O)k.push(`width="${O}"`);if(V)k.push(`height="${V}"`);if(I)k.push(`class="${D0(I)}"`);if(N)k.push(`style="${D0(N)}"`);let y=T.map((C)=>{return` <source ${_?`data-src="${D0(C.src)}"`:`src="${D0(C.src)}"`} type="${C.type}"${C.media?` media="${C.media}"`:""} />`}).join(`
|
|
1816
|
-
`),E=`<video ${k.join(" ")}>
|
|
1817
|
-
${y}
|
|
1818
|
-
Your browser does not support the video tag.
|
|
1819
|
-
</video>`,b;if(_)b=`
|
|
1820
|
-
(function() {
|
|
1821
|
-
var video = document.getElementById('${M}');
|
|
1822
|
-
if (!video) return;
|
|
1823
|
-
|
|
1824
|
-
var observer = new IntersectionObserver(function(entries) {
|
|
1825
|
-
entries.forEach(function(entry) {
|
|
1826
|
-
if (entry.isIntersecting) {
|
|
1827
|
-
// Load poster
|
|
1828
|
-
if (video.dataset.poster) {
|
|
1829
|
-
video.poster = video.dataset.poster;
|
|
1830
|
-
delete video.dataset.poster;
|
|
1831
|
-
}
|
|
1832
|
-
|
|
1833
|
-
// Load sources
|
|
1834
|
-
var sources = video.querySelectorAll('source[data-src]');
|
|
1835
|
-
sources.forEach(function(source) {
|
|
1836
|
-
source.src = source.dataset.src;
|
|
1837
|
-
delete source.dataset.src;
|
|
1838
|
-
});
|
|
1839
|
-
|
|
1840
|
-
// Set preload
|
|
1841
|
-
if (video.dataset.preload) {
|
|
1842
|
-
video.preload = video.dataset.preload;
|
|
1843
|
-
delete video.dataset.preload;
|
|
1844
|
-
}
|
|
1845
|
-
|
|
1846
|
-
video.load();
|
|
1847
|
-
observer.disconnect();
|
|
1848
|
-
}
|
|
1849
|
-
});
|
|
1850
|
-
}, { rootMargin: '50px' });
|
|
1851
|
-
|
|
1852
|
-
observer.observe(video);
|
|
1853
|
-
})();
|
|
1854
|
-
`.trim();return{html:E,script:b}}function aZ($,Z,J){let{width:X=640,height:Q=360}=J,Y=J.class,G=J.style,z=J.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,q,K=null;switch(Z){case"youtube":K=eZ($),q=K?`https://www.youtube-nocookie.com/embed/${K}`:$;break;case"vimeo":K=$J($),q=K?`https://player.vimeo.com/video/${K}`:$;break;case"dailymotion":K=$.split("/").pop()||"",q=`https://www.dailymotion.com/embed/video/${K}`;break;case"twitch":K=$.split("/").pop()||"",q=`https://player.twitch.tv/?video=${K}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:q=$}let W=[`id="${z}"`,`src="${D0(q)}"`,`width="${X}"`,`height="${Q}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(Y)W.push(`class="${D0(Y)}"`);if(G)W.push(`style="${D0(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;">
|
|
1855
|
-
<iframe ${W.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
|
|
1856
|
-
</div>`}}function tZ($,Z={}){let{src:J,sources:X=[],poster:Q,controls:Y=!0,autoplay:G=!1,muted:z=!1,loop:q=!1,preload:K="metadata",playsinline:W=!0,lazy:U=!0,width:H,height:j}=$,B=$.class,_=$.style,F=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,L={src:X.length>0?X:J,autoplay:G,loop:q,muted:z,playsinline:W,preload:K,poster:Q,controls:Y,title:$.title},O=["position: relative",H?`width: ${typeof H==="number"?H+"px":H}`:"width: 100%",j?`height: ${typeof j==="number"?j+"px":j}`:"",_||""].filter(Boolean).join("; "),V=`
|
|
1857
|
-
<div
|
|
1858
|
-
id="${F}"
|
|
1859
|
-
class="ts-video-player${B?" "+D0(B):""}"
|
|
1860
|
-
style="${O}"
|
|
1861
|
-
data-ts-video-player
|
|
1862
|
-
data-config='${JSON.stringify(L)}'
|
|
1863
|
-
${U?"data-lazy":""}
|
|
1864
|
-
>
|
|
1865
|
-
<div class="ts-video-player__container">
|
|
1866
|
-
${Q?`
|
|
1867
|
-
<div class="ts-video-player__placeholder" style="background-image: url('${D0(Q)}');">
|
|
1868
|
-
<button class="ts-video-player__play-button" aria-label="Play video">
|
|
1869
|
-
<svg viewBox="0 0 24 24" fill="currentColor" width="64" height="64">
|
|
1870
|
-
<path d="M8 5v14l11-7z"/>
|
|
1871
|
-
</svg>
|
|
1872
|
-
</button>
|
|
1873
|
-
</div>
|
|
1874
|
-
`:""}
|
|
1875
|
-
</div>
|
|
1876
|
-
</div>
|
|
1877
|
-
`.trim(),w=`
|
|
1878
|
-
(function() {
|
|
1879
|
-
var container = document.getElementById('${F}');
|
|
1880
|
-
if (!container) return;
|
|
1881
|
-
|
|
1882
|
-
var config = JSON.parse(container.dataset.config || '{}');
|
|
1883
|
-
var isLazy = container.hasAttribute('data-lazy');
|
|
1884
|
-
|
|
1885
|
-
function loadPlayer() {
|
|
1886
|
-
if (typeof TSVideoPlayer !== 'undefined') {
|
|
1887
|
-
initPlayer();
|
|
1888
|
-
return;
|
|
1889
|
-
}
|
|
1890
|
-
|
|
1891
|
-
// Load ts-video-player from CDN
|
|
1892
|
-
var script = document.createElement('script');
|
|
1893
|
-
script.src = '${rZ}';
|
|
1894
|
-
script.onload = initPlayer;
|
|
1895
|
-
script.onerror = function() {
|
|
1896
|
-
console.error('[stx] Failed to load ts-video-player');
|
|
1897
|
-
fallbackToNative();
|
|
1898
|
-
};
|
|
1899
|
-
document.head.appendChild(script);
|
|
1900
|
-
}
|
|
1901
|
-
|
|
1902
|
-
function initPlayer() {
|
|
1903
|
-
var player = TSVideoPlayer.createPlayer(container, config);
|
|
1904
|
-
if (config.src) {
|
|
1905
|
-
player.setSrc(config.src);
|
|
1906
|
-
}
|
|
1907
|
-
container.__tsVideoPlayer = player;
|
|
1908
|
-
|
|
1909
|
-
// Remove placeholder
|
|
1910
|
-
var placeholder = container.querySelector('.ts-video-player__placeholder');
|
|
1911
|
-
if (placeholder) {
|
|
1912
|
-
placeholder.style.display = 'none';
|
|
1913
|
-
}
|
|
1914
|
-
}
|
|
1915
|
-
|
|
1916
|
-
function fallbackToNative() {
|
|
1917
|
-
// Fallback to native video element
|
|
1918
|
-
var video = document.createElement('video');
|
|
1919
|
-
video.controls = config.controls !== false;
|
|
1920
|
-
video.autoplay = config.autoplay;
|
|
1921
|
-
video.muted = config.muted;
|
|
1922
|
-
video.loop = config.loop;
|
|
1923
|
-
video.playsInline = config.playsinline;
|
|
1924
|
-
video.preload = config.preload || 'metadata';
|
|
1925
|
-
if (config.poster) video.poster = config.poster;
|
|
1926
|
-
if (config.src) video.src = typeof config.src === 'string' ? config.src : config.src[0]?.src || config.src[0];
|
|
1927
|
-
video.style.width = '100%';
|
|
1928
|
-
video.style.height = '100%';
|
|
1929
|
-
|
|
1930
|
-
var containerEl = container.querySelector('.ts-video-player__container');
|
|
1931
|
-
if (containerEl) {
|
|
1932
|
-
containerEl.innerHTML = '';
|
|
1933
|
-
containerEl.appendChild(video);
|
|
1934
|
-
}
|
|
1935
|
-
}
|
|
1936
|
-
|
|
1937
|
-
if (isLazy) {
|
|
1938
|
-
var observer = new IntersectionObserver(function(entries) {
|
|
1939
|
-
entries.forEach(function(entry) {
|
|
1940
|
-
if (entry.isIntersecting) {
|
|
1941
|
-
loadPlayer();
|
|
1942
|
-
observer.disconnect();
|
|
1943
|
-
}
|
|
1944
|
-
});
|
|
1945
|
-
}, { rootMargin: '50px' });
|
|
1946
|
-
observer.observe(container);
|
|
1947
|
-
}
|
|
1948
|
-
else {
|
|
1949
|
-
if (document.readyState === 'loading') {
|
|
1950
|
-
document.addEventListener('DOMContentLoaded', loadPlayer);
|
|
1951
|
-
}
|
|
1952
|
-
else {
|
|
1953
|
-
loadPlayer();
|
|
1954
|
-
}
|
|
1955
|
-
}
|
|
1956
|
-
|
|
1957
|
-
// Handle play button click
|
|
1958
|
-
var playButton = container.querySelector('.ts-video-player__play-button');
|
|
1959
|
-
if (playButton) {
|
|
1960
|
-
playButton.addEventListener('click', function() {
|
|
1961
|
-
loadPlayer();
|
|
1962
|
-
var check = setInterval(function() {
|
|
1963
|
-
if (container.__tsVideoPlayer && container.__tsVideoPlayer.ready) {
|
|
1964
|
-
container.__tsVideoPlayer.play();
|
|
1965
|
-
clearInterval(check);
|
|
1966
|
-
}
|
|
1967
|
-
}, 100);
|
|
1968
|
-
});
|
|
1969
|
-
}
|
|
1970
|
-
})();
|
|
1971
|
-
`.trim(),R=`
|
|
1972
|
-
.ts-video-player {
|
|
1973
|
-
position: relative;
|
|
1974
|
-
background: #000;
|
|
1975
|
-
}
|
|
1976
|
-
|
|
1977
|
-
.ts-video-player__container {
|
|
1978
|
-
position: relative;
|
|
1979
|
-
width: 100%;
|
|
1980
|
-
padding-bottom: 56.25%;
|
|
1981
|
-
}
|
|
1982
|
-
|
|
1983
|
-
.ts-video-player__container > * {
|
|
1984
|
-
position: absolute;
|
|
1985
|
-
top: 0;
|
|
1986
|
-
left: 0;
|
|
1987
|
-
width: 100%;
|
|
1988
|
-
height: 100%;
|
|
1989
|
-
}
|
|
1990
|
-
|
|
1991
|
-
.ts-video-player__placeholder {
|
|
1992
|
-
display: flex;
|
|
1993
|
-
align-items: center;
|
|
1994
|
-
justify-content: center;
|
|
1995
|
-
background-color: #1a1a1a;
|
|
1996
|
-
background-size: cover;
|
|
1997
|
-
background-position: center;
|
|
1998
|
-
cursor: pointer;
|
|
1999
|
-
}
|
|
2000
|
-
|
|
2001
|
-
.ts-video-player__play-button {
|
|
2002
|
-
display: flex;
|
|
2003
|
-
align-items: center;
|
|
2004
|
-
justify-content: center;
|
|
2005
|
-
width: 80px;
|
|
2006
|
-
height: 80px;
|
|
2007
|
-
background: rgba(0, 0, 0, 0.7);
|
|
2008
|
-
border: none;
|
|
2009
|
-
border-radius: 50%;
|
|
2010
|
-
color: white;
|
|
2011
|
-
cursor: pointer;
|
|
2012
|
-
transition: transform 0.2s, background 0.2s;
|
|
2013
|
-
}
|
|
2014
|
-
|
|
2015
|
-
.ts-video-player__play-button:hover {
|
|
2016
|
-
transform: scale(1.1);
|
|
2017
|
-
background: rgba(0, 0, 0, 0.9);
|
|
2018
|
-
}
|
|
2019
|
-
|
|
2020
|
-
.ts-video-player__play-button svg {
|
|
2021
|
-
margin-left: 4px;
|
|
2022
|
-
}
|
|
2023
|
-
`.trim();return{html:V,script:w,css:R}}function u3($){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 eZ($){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 $J($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function D0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'")}function Sq($,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 Q=X.indexOf(",");if(Q===-1)return{src:X.replace(/^['"]|['"]$/g,"")};let Y=X.slice(0,Q).trim().replace(/^['"]|['"]$/g,""),G=X.slice(Q+1).trim();try{let z=JSON.parse(G);return{src:Y,...z}}catch{return{src:Y}}}async function ZJ($,Z){let J=await x3();if(!J)return d2({...$,process:!1},Z);let X=Z.tsVideosConfig,Q=await J.processVideo($.src,$,X,$.onProcessProgress);if(Q.processed)return d3($,Q,Z);return d2({...$,process:!1},Z)}async function JJ($,Z){let J=await x3();if(!J||!$.src)return;let X=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},Q=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await J.generatePoster($.src,X,Q.outputDir,Q.baseUrl||"/videos"))?.url}function d3($,Z,J){let{controls:X=g3,autoplay:Q=!1,muted:Y=!1,loop:G=!1,preload:z=h3,playsinline:q=!0,lazy:K=!0,width:W,height:U,crossorigin:H,disablePictureInPicture:j=!1,disableRemotePlayback:B=!1}=$,_=$.class,F=$.style,L=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,O=$.src,V=u3(O);if(Z.transcoded)O=Z.transcoded.url,V="video/mp4";let w=Z.streaming?.hls||Z.streaming?.dash;if(w){if(Z.streaming?.hls)O=Z.streaming.hls.manifestUrl,V="application/x-mpegURL";else if(Z.streaming?.dash)O=Z.streaming.dash.manifestUrl,V="application/dash+xml"}let R=Z.poster?.url||$.poster,D=[`id="${L}"`];if(X)D.push("controls");if(Q)D.push("autoplay");if(Y)D.push("muted");if(G)D.push("loop");if(q)D.push("playsinline");if(j)D.push("disablepictureinpicture");if(B)D.push("disableremoteplayback");if(H)D.push(`crossorigin="${H}"`);if(K){if(D.push(`data-preload="${z}"`),D.push('preload="none"'),R)D.push(`data-poster="${D0(R)}"`);D.push("data-stx-lazy")}else if(D.push(`preload="${z}"`),R)D.push(`poster="${D0(R)}"`);let A=W||Z.metadata?.width,I=U||Z.metadata?.height;if(A)D.push(`width="${A}"`);if(I)D.push(`height="${I}"`);if(_)D.push(`class="${D0(_)}"`);if(F)D.push(`style="${D0(F)}"`);let M=` <source ${K?`data-src="${D0(O)}"`:`src="${D0(O)}"`} type="${V}" />`,T=`<video ${D.join(" ")}>
|
|
2024
|
-
${M}
|
|
2025
|
-
Your browser does not support the video tag.
|
|
2026
|
-
</video>`;if(Z.spriteSheet)T=`<div class="stx-video-wrapper" data-sprite-sheet="${D0(Z.spriteSheet.url)}" data-sprite-cols="${Z.spriteSheet.columns}" data-sprite-interval="${Z.spriteSheet.interval}">
|
|
2027
|
-
${T}
|
|
2028
|
-
</div>`;let k;if(K)k=`
|
|
2029
|
-
(function() {
|
|
2030
|
-
var video = document.getElementById('${L}');
|
|
2031
|
-
if (!video) return;
|
|
2032
|
-
|
|
2033
|
-
var observer = new IntersectionObserver(function(entries) {
|
|
2034
|
-
entries.forEach(function(entry) {
|
|
2035
|
-
if (entry.isIntersecting) {
|
|
2036
|
-
// Load poster
|
|
2037
|
-
if (video.dataset.poster) {
|
|
2038
|
-
video.poster = video.dataset.poster;
|
|
2039
|
-
delete video.dataset.poster;
|
|
2040
|
-
}
|
|
2041
|
-
|
|
2042
|
-
// Load sources
|
|
2043
|
-
var sources = video.querySelectorAll('source[data-src]');
|
|
2044
|
-
sources.forEach(function(source) {
|
|
2045
|
-
source.src = source.dataset.src;
|
|
2046
|
-
delete source.dataset.src;
|
|
2047
|
-
});
|
|
2048
|
-
|
|
2049
|
-
// Set preload
|
|
2050
|
-
if (video.dataset.preload) {
|
|
2051
|
-
video.preload = video.dataset.preload;
|
|
2052
|
-
delete video.dataset.preload;
|
|
2053
|
-
}
|
|
2054
|
-
|
|
2055
|
-
video.load();
|
|
2056
|
-
observer.disconnect();
|
|
2057
|
-
}
|
|
2058
|
-
});
|
|
2059
|
-
}, { rootMargin: '50px' });
|
|
2060
|
-
|
|
2061
|
-
observer.observe(video);
|
|
2062
|
-
})();
|
|
2063
|
-
`.trim();let y;if(w)y=`
|
|
2064
|
-
.stx-video-wrapper {
|
|
2065
|
-
position: relative;
|
|
2066
|
-
width: 100%;
|
|
2067
|
-
}
|
|
2068
|
-
.stx-video-wrapper video {
|
|
2069
|
-
width: 100%;
|
|
2070
|
-
height: auto;
|
|
2071
|
-
}
|
|
2072
|
-
`.trim();return{html:T,script:k,css:y}}function m3(){return u2({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,J,X)=>{let{src:Q,options:Y}=XJ($,Z,J);if(!Q)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let G={src:Q,poster:Y.poster,controls:Y.controls!==!1,autoplay:Y.autoplay||!1,muted:Y.muted||!1,loop:Y.loop||!1,preload:Y.preload||"metadata",playsinline:Y.playsinline!==!1,lazy:Y.lazy!==!1,player:Y.player||"native",type:Y.type,width:Y.width,height:Y.height,class:Y.class,style:Y.style,id:Y.id,crossorigin:Y.crossorigin,disablePictureInPicture:Y.disablePictureInPicture,disableRemotePlayback:Y.disableRemotePlayback,title:Y.title,quality:Y.quality,platform:Y.platform,process:Y.process,generatePoster:Y.generatePoster,streaming:Y.streaming,transcode:Y.transcode,spriteSheet:Y.spriteSheet,waveform:Y.waveform},q={isDev:J.__isDev||!1,tsVideosConfig:J.__tsVideosConfig},K=await d2(G,q),W=K.html;if(K.css)W+=`
|
|
2073
|
-
<style>${K.css}</style>`;if(K.script)W+=`
|
|
2074
|
-
<script>${K.script}</script>`;return W},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function XJ($,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 Q=YJ(X),Y=l3(Q[0],J)||"",G={};if(Q[1]){let z=l3(Q[1],J);if(typeof z==="object"&&z!==null)G=z;else if(typeof Q[1]==="string")try{G=JSON.parse(Q[1])}catch{}}return{src:Y,options:G}}function YJ($){let Z=[],J="",X=!1,Q="",Y=0,G=0;for(let z=0;z<$.length;z++){let q=$[z],K=z>0?$[z-1]:"";if((q==='"'||q==="'"||q==="`")&&K!=="\\"){if(!X)X=!0,Q=q;else if(q===Q)X=!1,Q="";else J+=q;continue}if(!X){if(q==="{")Y++;if(q==="}")Y--;if(q==="[")G++;if(q==="]")G--;if(q===","&&Y===0&&G===0){Z.push(J.trim()),J="";continue}}J+=q}if(J.trim())Z.push(J.trim());return Z}function l3($,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 Z5=m3();function p3($,Z,J,X){let Q=$;Q=Q.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(z,q,K)=>{if(!K&&q.includes(":")){let W=q.split(":"),U=q,H=W.length>1?W[1]:"";if(H&&Z[H])K=Z[H];else if(U.startsWith("og:")&&Z.openGraph&&Z.openGraph[W[1]])K=Z.openGraph[W[1]];else K="";return K?`<meta property="${p(U)}" content="${p(K)}">`:""}return K?`<meta name="${p(q)}" content="${p(K)}">`:""});let Y=/@metaTag\s*\(/g,G;while((G=Y.exec(Q))!==null){let z=G.index,q=z+G[0].length-1,K=1,W=q+1;while(W<Q.length&&K>0){if(Q[W]==="(")K++;else if(Q[W]===")"){if(K--,K===0)break}W++}if(K!==0)break;let U=Q.substring(q+1,W).trim(),H=W+1,j=(()=>{try{let B=T0(U,Z);if(!B)return"";let _="<meta";if(B.name)_+=` name="${p(String(B.name))}"`;if(B.property)_+=` property="${p(String(B.property))}"`;if(B.httpEquiv)_+=` http-equiv="${p(String(B.httpEquiv))}"`;if(B.content)_+=` content="${p(String(B.content))}"`;return _+=">",_}catch(B){let _=B instanceof Error?B.message:String(B);return G0("MetaTag",_,Q0.EVALUATION_ERROR)}})();Q=Q.substring(0,z)+j+Q.substring(H),Y.lastIndex=0}return Q}function i3($,Z,J){let X=$,Q=/@structuredData\s*\(/g,Y;while((Y=Q.exec(X))!==null){let G=Y.index,z=G+Y[0].length-1,q=1,K=z+1;while(K<X.length&&q>0){if(X[K]==="(")q++;else if(X[K]===")"){if(q--,q===0)break}K++}if(q!==0)break;let W=X.substring(z+1,K).trim(),U=K+1,H=(()=>{try{let j=T0(W,Z);if(!j)return"";if(!j["@context"])j["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(j).replace(/<\//g,"<\\/")}</script>`}catch(j){let B=j instanceof Error?j.message:String(j);return G0("StructuredData",B,Q0.EVALUATION_ERROR)}})();X=X.substring(0,G)+H+X.substring(U),Q.lastIndex=0}return X}function n3($,Z,J,X){let Q=$,Y=/@seo\s*\(\s*\{/g,G;while((G=Y.exec(Q))!==null){let z=Q.indexOf("{",G.index+4),q=1,K=z+1,W=null,U=!1;while(K<Q.length&&q>0){let L=Q[K];if(U){U=!1,K++;continue}if(L==="\\"&&W){U=!0,K++;continue}if(W){if(L===W)W=null;K++;continue}if(L==='"'||L==="'"||L==="`"){W=L,K++;continue}if(L==="{")q++;else if(L==="}")q--;K++}if(q!==0)break;let H=Q.substring(K).match(/^\s*\)/);if(!H)break;let j=K+H[0].length,B=Q.substring(z,K),_=Q.substring(G.index,j),F=((L)=>{try{let O=T0(L,Z);if(!O)return"";let V="";if(O.title)V+=`<title>${p(O.title)}</title>
|
|
2075
|
-
`,V+=`<meta name="title" content="${p(O.title)}">
|
|
2076
|
-
`;if(O.description)V+=`<meta name="description" content="${p(O.description)}">
|
|
2077
|
-
`;if(O.keywords){let w=Array.isArray(O.keywords)?O.keywords.join(", "):O.keywords;V+=`<meta name="keywords" content="${p(w)}">
|
|
2078
|
-
`}if(O.robots)V+=`<meta name="robots" content="${p(O.robots)}">
|
|
2079
|
-
`;if(O.canonical)V+=`<link rel="canonical" href="${p(O.canonical)}">
|
|
2080
|
-
`;if(O.openGraph){let w=O.openGraph;if(V+=`<meta property="og:type" content="${p(w.type||"website")}">
|
|
2081
|
-
`,w.title||O.title){let R=w.title||O.title||"";V+=`<meta property="og:title" content="${p(R)}">
|
|
2082
|
-
`}if(w.description||O.description){let R=w.description||O.description||"";V+=`<meta property="og:description" content="${p(R)}">
|
|
2083
|
-
`}if(w.url||O.canonical){let R=w.url||O.canonical||"";V+=`<meta property="og:url" content="${p(R)}">
|
|
2084
|
-
`}if(w.image){if(V+=`<meta property="og:image" content="${p(w.image)}">
|
|
2085
|
-
`,w.imageAlt)V+=`<meta property="og:image:alt" content="${p(w.imageAlt)}">
|
|
2086
|
-
`;if(w.imageWidth)V+=`<meta property="og:image:width" content="${p(String(w.imageWidth))}">
|
|
2087
|
-
`;if(w.imageHeight)V+=`<meta property="og:image:height" content="${p(String(w.imageHeight))}">
|
|
2088
|
-
`}if(w.siteName)V+=`<meta property="og:site_name" content="${p(w.siteName)}">
|
|
2089
|
-
`}if(O.twitter){let w=O.twitter;if(V+=`<meta name="twitter:card" content="${p(w.card||"summary_large_image")}">
|
|
2090
|
-
`,w.title||O.title){let R=w.title||O.title||"";V+=`<meta name="twitter:title" content="${p(R)}">
|
|
2091
|
-
`}if(w.description||O.description){let R=w.description||O.description||"";V+=`<meta name="twitter:description" content="${p(R)}">
|
|
2092
|
-
`}if(w.image||O.openGraph&&O.openGraph.image){let R=w.image||(O.openGraph?O.openGraph.image:"")||"";V+=`<meta name="twitter:image" content="${p(R)}">
|
|
2093
|
-
`}if(w.site)V+=`<meta name="twitter:site" content="${p(w.site)}">
|
|
2094
|
-
`;if(w.creator)V+=`<meta name="twitter:creator" content="${p(w.creator)}">
|
|
2095
|
-
`}if(O.structuredData){let w=JSON.stringify(O.structuredData).replace(/<\//g,"<\\/");V+=`<script type="application/ld+json">${w}</script>
|
|
2096
|
-
`}return V.trim()}catch(O){let V=O instanceof Error?O.message:String(O);return G0("SEO",`Error processing @seo directive: ${V}`,Q0.EVALUATION_ERROR)}})(B);Q=Q.substring(0,G.index)+F+Q.substring(j),Y.lastIndex=G.index+F.length}return Q}function o3($,Z,J){if(J.seo?.enabled===!1)return $;if($.includes("<!-- stx SEO Tags -->")||Z.__stx_seo_staged===!0||J.skipDefaultSeoTags===!0)return $;let X=Z.__stx_runtime_head;if(!!(X?.title||X?.meta?.some((H)=>H.property==="og:title"||H.name==="og:title"||H.name==="twitter:title"||H.name==="description")))return $;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test($))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let Y=$.includes("<title>")||$.includes("</title>"),G="";if(Z.title)G=Z.title;else if(Z.meta&&Z.meta.title)G=Z.meta.title;else if(J.seo?.defaultConfig?.title)G=J.seo.defaultConfig.title;else G=J.defaultTitle||"stx Project";let z="";if(Z.description)z=Z.description;else if(Z.meta&&Z.meta.description)z=Z.meta.description;else if(J.seo?.defaultConfig?.description)z=J.seo.defaultConfig.description;else z=J.defaultDescription||"A website built with stx templating engine";let q="";if(Z.image)q=Z.image;else if(Z.meta&&Z.meta.image)q=Z.meta.image;else if(Z.openGraph&&Z.openGraph.image)q=Z.openGraph.image;else if(J.seo?.defaultImage)q=J.seo.defaultImage;else if(J.defaultImage)q=J.defaultImage;let K=`
|
|
2097
|
-
<!-- stx SEO Tags -->
|
|
2098
|
-
<meta name="title" content="${p(G)}">
|
|
2099
|
-
<meta name="description" content="${p(z)}">
|
|
2100
|
-
<meta property="og:title" content="${p(G)}">
|
|
2101
|
-
<meta property="og:description" content="${p(z)}">
|
|
2102
|
-
<meta property="og:type" content="website">
|
|
2103
|
-
<meta name="twitter:card" content="summary_large_image">
|
|
2104
|
-
<meta name="twitter:title" content="${p(G)}">
|
|
2105
|
-
<meta name="twitter:description" content="${p(z)}">
|
|
2106
|
-
`;if(q)K+=`
|
|
2107
|
-
<meta property="og:image" content="${p(q)}">
|
|
2108
|
-
<meta name="twitter:image" content="${p(q)}">
|
|
2109
|
-
`;let W=$;if(!Y)W=W.replace(/<head[^>]*>/,`$&
|
|
2110
|
-
<title>${p(G)}</title>`);let U=Z.__stx_head_injections;if(U)return Z.__stx_seo_staged=!0,U.afterOpen.push(`
|
|
2111
|
-
${K}
|
|
2112
|
-
`),W;return W.replace(/<head[^>]*>/,`$&
|
|
2113
|
-
${K}
|
|
2114
|
-
`)}function p($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var QJ=["og:","article:","book:","profile:","fb:","music:","video:"];function c3($){let Z=$.trim(),J=Z[0];if((J==="'"||J==='"'||J==="`")&&Z.length>1&&Z.at(-1)===J)return{value:Z.slice(1,-1),quoted:!0};return{value:Z,quoted:!1}}var J5={name:"meta",handler:($,Z,J,X)=>{if(Z.length<1)return G0("Meta","meta directive requires at least the meta name",Q0.INVALID_DIRECTIVE_SYNTAX);let Q=c3(Z[0]).value,Y;if(Z.length>1){let q=c3(Z[1]);Y=q.quoted?q.value:String(J?.[q.value]??q.value)}else{let q=Q.includes(":")?Q.slice(Q.indexOf(":")+1):Q,K=J?.openGraph;Y=String(J?.[q]??K?.[q]??"")}if(!Y)return"";let z=QJ.some((q)=>Q.startsWith(q))?{property:Q,content:Y}:{name:Q,content:Y};if(J)J.__stx_runtime_head=m2(J.__stx_runtime_head??{},{meta:[z]});return""},hasEndTag:!1},X5={name:"structuredData",handler:($,Z,J,X)=>{if($.trim()==="")return G0("StructuredData","structuredData directive requires JSON-LD content",Q0.INVALID_DIRECTIVE_SYNTAX);try{let Q=JSON.parse($);if(!Q["@context"])Q["@context"]="https://schema.org";if(!Q["@type"])return G0("StructuredData","structuredData requires @type property",Q0.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(Q)}</script>`}catch(Q){let Y=Q instanceof Error?Q.message:String(Q);return G0("StructuredData",Y,Q0.EVALUATION_ERROR)}},hasEndTag:!0};function mq(){return[J5,X5]}function lq($,Z){let J=Z.replace(/\/$/,""),X=new Date().toISOString().split("T")[0];return`<?xml version="1.0" encoding="UTF-8"?>
|
|
2115
|
-
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
2116
|
-
${$.map((Y)=>{let G=Y.startsWith("http")?Y:`${J}${Y.startsWith("/")?"":"/"}${Y}`;return` <sitemap>
|
|
2117
|
-
<loc>${zJ(G)}</loc>
|
|
2118
|
-
<lastmod>${X}</lastmod>
|
|
2119
|
-
</sitemap>`}).join(`
|
|
2120
|
-
`)}
|
|
2121
|
-
</sitemapindex>`}async function cq($,Z){let{extensions:J=[".stx",".html",".htm"],ignore:X=["_*",".*","node_modules","components","partials","layouts"]}=Z,Q=[],Y=J.length===1?`*${J[0]}`:`*{${J.join(",")}}`,G=new Bun.Glob(`**/${Y}`);for await(let z of G.scan($)){if(X.some((H)=>{if(H.startsWith("*"))return z.includes(H.slice(1));return z.startsWith(H)||z.includes(`/${H}`)}))continue;let K=z.replace(/\\/g,"/").replace(/index\.(stx|html|htm)$/,"").replace(/\.(stx|html|htm)$/,"");if(!K.startsWith("/"))K=`/${K}`;if(K!=="/"&&K.endsWith("/"))K=K.slice(0,-1);let W=`${$}/${z}`,U;try{let H=await Bun.file(W).stat();if(H)U=new Date(H.mtime).toISOString().split("T")[0]}catch{}Q.push({loc:K||"/",lastmod:U,priority:K==="/"?1:0.5})}return Q.sort((z,q)=>z.loc.localeCompare(q.loc)),Q}function GJ($){let Z=[];for(let J of $.rules){if(Z.push(`User-agent: ${J.userAgent}`),J.allow)for(let X of J.allow)Z.push(`Allow: ${X}`);if(J.disallow)for(let X of J.disallow)Z.push(`Disallow: ${X}`);if(J.crawlDelay!==void 0)Z.push(`Crawl-delay: ${J.crawlDelay}`);Z.push("")}if($.sitemap){let J=Array.isArray($.sitemap)?$.sitemap:[$.sitemap];for(let X of J)Z.push(`Sitemap: ${X}`)}if($.host)Z.push(`Host: ${$.host}`);return Z.join(`
|
|
2122
|
-
`).trim()}function pq($){return GJ({rules:[{userAgent:"*",allow:["/"]}],sitemap:$})}function zJ($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}import qJ from"fs";import g0 from"path";async function aq($,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 Q of J)try{let Y=await KJ(Q,$,Z);if(Y)X.push(Y)}catch(Y){if(console.error(`Error building web component ${Q.name}:`,Y),$.debug)throw Y}}return X}async function KJ($,Z,J){let{name:X,file:Q,tag:Y,extends:G}=$;if(!X||!Q||!Y)return console.error("Invalid web component configuration, missing required fields:",$),null;let z=null;if(g0.isAbsolute(Q)&&await s(Q))z=Q;else if(Z.componentsDir){let _=g0.join(Z.componentsDir,Q);if(await s(_))z=_}if(!z)z=await l2(Q,process.cwd(),Z,J);if(!z)return console.error(`Web component source file not found: ${Q}`),null;let q=await Bun.file(z).text();J.add(z);let W=($.outputFormat||"js")==="ts",U=W?UJ({name:X,tag:Y,baseElement:G,source:q,shadowDOM:$.shadowDOM??!0,template:$.template??!0,styleSource:$.styleSource,attributes:$.attributes||[],attributeTypes:$.attributeTypes||{}}):WJ({name:X,tag:Y,baseElement:G,source:q,shadowDOM:$.shadowDOM??!0,template:$.template??!0,styleSource:$.styleSource,attributes:$.attributes||[]}),H=Z.webComponents?.outputDir||"dist/web-components";await qJ.promises.mkdir(H,{recursive:!0});let j=W?"ts":"js",B=g0.join(H,`${Y}.${j}`);if(await Bun.write(B,U),Z.debug)console.log(`Built web component ${X} -> ${B}`);return B}function WJ($){let{name:Z,tag:J,baseElement:X="HTMLElement",source:Q,shadowDOM:Y,template:G,styleSource:z,attributes:q=[]}=$,K=Q.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!Y)K=K.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),K=K.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),K=K.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),K=K.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");let W="";if(z)W=`<link rel="stylesheet" href="${z}">`;return`/**
|
|
2123
|
-
* ${Z} Web Component
|
|
2124
|
-
* Auto-generated from stx component
|
|
2125
|
-
*/
|
|
2126
|
-
class ${Z.replace(/\W/g,"")} extends ${X} {
|
|
2127
|
-
constructor() {
|
|
2128
|
-
super()
|
|
2129
|
-
this._initialized = false
|
|
2130
|
-
${Y?"":"this._slotContent = []"}
|
|
2131
|
-
${Y?'this.attachShadow({ mode: "open" })':""}
|
|
2132
|
-
}
|
|
2133
|
-
|
|
2134
|
-
${G?`
|
|
2135
|
-
_createTemplate() {
|
|
2136
|
-
const template = document.createElement('template')
|
|
2137
|
-
template.innerHTML = \`${W}${K}\`
|
|
2138
|
-
${Y?"this.shadowRoot.appendChild(template.content.cloneNode(true))":"this.appendChild(template.content.cloneNode(true))"}
|
|
2139
|
-
this._processSlots()
|
|
2140
|
-
}
|
|
2141
|
-
`:`
|
|
2142
|
-
_render() {
|
|
2143
|
-
${Y?"this.shadowRoot.innerHTML":"this.innerHTML"} = \`${W}${K}\`
|
|
2144
|
-
this._processSlots()
|
|
2145
|
-
}
|
|
2146
|
-
`}
|
|
2147
|
-
|
|
2148
|
-
_processSlots() {
|
|
2149
|
-
${Y?`// Shadow DOM handles slot assignment automatically
|
|
2150
|
-
// Listen for slot changes if needed
|
|
2151
|
-
const slots = this.shadowRoot.querySelectorAll('slot')
|
|
2152
|
-
slots.forEach(slot => {
|
|
2153
|
-
slot.addEventListener('slotchange', (e) => {
|
|
2154
|
-
const assignedNodes = slot.assignedNodes()
|
|
2155
|
-
this.dispatchEvent(new CustomEvent('slot-changed', {
|
|
2156
|
-
detail: { slotName: slot.name || 'default', assignedNodes }
|
|
2157
|
-
}))
|
|
2158
|
-
})
|
|
2159
|
-
})`:`// Manual slot processing for non-shadow DOM mode
|
|
2160
|
-
const slots = this.querySelectorAll('[data-slot]')
|
|
2161
|
-
|
|
2162
|
-
// Process named slots
|
|
2163
|
-
slots.forEach(slotEl => {
|
|
2164
|
-
const slotName = slotEl.getAttribute('data-slot')
|
|
2165
|
-
const slottedContent = this._slotContent.filter(
|
|
2166
|
-
node => node.nodeType === Node.ELEMENT_NODE && node.getAttribute('slot') === slotName
|
|
2167
|
-
)
|
|
2168
|
-
if (slottedContent.length > 0) {
|
|
2169
|
-
slotEl.innerHTML = ''
|
|
2170
|
-
slottedContent.forEach(content => slotEl.appendChild(content))
|
|
2171
|
-
}
|
|
2172
|
-
})
|
|
2173
|
-
|
|
2174
|
-
// Process default slot
|
|
2175
|
-
const defaultSlot = this.querySelector('[data-slot=""]') || this.querySelector('[data-default-slot]')
|
|
2176
|
-
if (defaultSlot) {
|
|
2177
|
-
const unslottedContent = this._slotContent.filter(
|
|
2178
|
-
node => node.nodeType !== Node.ELEMENT_NODE || !node.hasAttribute('slot')
|
|
2179
|
-
)
|
|
2180
|
-
if (unslottedContent.length > 0) {
|
|
2181
|
-
defaultSlot.innerHTML = ''
|
|
2182
|
-
unslottedContent.forEach(content => defaultSlot.appendChild(content))
|
|
2183
|
-
}
|
|
2184
|
-
}`}
|
|
2185
|
-
}
|
|
2186
|
-
|
|
2187
|
-
${q.length>0?`
|
|
2188
|
-
static get observedAttributes() {
|
|
2189
|
-
return [${q.map((U)=>`'${U}'`).join(", ")}]
|
|
2190
|
-
}
|
|
2191
|
-
|
|
2192
|
-
attributeChangedCallback(name, oldValue, newValue) {
|
|
2193
|
-
if (oldValue !== newValue) {
|
|
2194
|
-
this[name] = newValue
|
|
2195
|
-
${G?"":"if (this._initialized) this._render()"}
|
|
2196
|
-
}
|
|
2197
|
-
}
|
|
2198
|
-
`:""}
|
|
2199
|
-
|
|
2200
|
-
connectedCallback() {
|
|
2201
|
-
if (this._initialized) return
|
|
2202
|
-
${Y?"":"this._slotContent = Array.from(this.childNodes)"}
|
|
2203
|
-
this._initialized = true
|
|
2204
|
-
${G?"this._createTemplate()":"this._render()"}
|
|
2205
|
-
}
|
|
2206
|
-
|
|
2207
|
-
disconnectedCallback() {
|
|
2208
|
-
// Component removed from the DOM
|
|
2209
|
-
}
|
|
2210
|
-
}
|
|
2211
|
-
|
|
2212
|
-
// Register the web component
|
|
2213
|
-
customElements.define('${J}', ${Z.replace(/\W/g,"")})
|
|
2214
|
-
`}function UJ($){let{name:Z,tag:J,baseElement:X="HTMLElement",source:Q,shadowDOM:Y,template:G,styleSource:z,attributes:q=[],attributeTypes:K={}}=$,W=Z.replace(/\W/g,""),U=Q.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!Y)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=(R)=>{switch(K[R]){case"number":return"number";case"boolean":return"boolean";case"object":return"Record<string, unknown>";default:return"string"}},B=(R)=>R.replace(/-([a-z])/g,(D,A)=>A.toUpperCase()),_=q.map((R)=>` private _${B(R)}: ${j(R)} | null = null;`).join(`
|
|
2215
|
-
`),F=q.map((R)=>{let D=j(R),A=B(R);return`
|
|
2216
|
-
get ${A}(): ${D} | null {
|
|
2217
|
-
return this._${A};
|
|
2218
|
-
}
|
|
2219
|
-
|
|
2220
|
-
set ${A}(value: ${D} | null) {
|
|
2221
|
-
this._${A} = value;
|
|
2222
|
-
if (value !== null) {
|
|
2223
|
-
this.setAttribute('${R}', String(value));
|
|
2224
|
-
}
|
|
2225
|
-
else {
|
|
2226
|
-
this.removeAttribute('${R}');
|
|
2227
|
-
}
|
|
2228
|
-
}`}).join(`
|
|
2229
|
-
`),L=q.length>0?`/**
|
|
2230
|
-
* Props interface for ${Z}
|
|
2231
|
-
*/
|
|
2232
|
-
export interface ${W}Props {
|
|
2233
|
-
${q.map((R)=>{let D=j(R);return` ${B(R)}?: ${D};`}).join(`
|
|
2234
|
-
`)}
|
|
2235
|
-
}
|
|
2236
|
-
`:"",O=q.length>0?`
|
|
2237
|
-
static get observedAttributes(): string[] {
|
|
2238
|
-
return [${q.map((R)=>`'${R}'`).join(", ")}];
|
|
2239
|
-
}
|
|
2240
|
-
|
|
2241
|
-
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void {
|
|
2242
|
-
if (oldValue !== newValue) {
|
|
2243
|
-
const camelCase = name.replace(/-([a-z])/g, (_: string, letter: string) => letter.toUpperCase());
|
|
2244
|
-
(this as unknown as Record<string, unknown>)[\`_\${camelCase}\`] = this._parseAttributeValue(name, newValue);
|
|
2245
|
-
${G?"":"if (this._initialized) this._render();"}
|
|
2246
|
-
}
|
|
2247
|
-
}
|
|
2248
|
-
|
|
2249
|
-
private _parseAttributeValue(name: string, value: string | null): unknown {
|
|
2250
|
-
if (value === null) return null;
|
|
2251
|
-
const typeMap: Record<string, string> = ${JSON.stringify(K)};
|
|
2252
|
-
const type = typeMap[name] || 'string';
|
|
2253
|
-
switch (type) {
|
|
2254
|
-
case 'number': return Number(value);
|
|
2255
|
-
case 'boolean': return value !== 'false' && value !== '0';
|
|
2256
|
-
case 'object': try { return JSON.parse(value); }
|
|
2257
|
-
catch { return value; }
|
|
2258
|
-
default: return value;
|
|
2259
|
-
}
|
|
2260
|
-
}
|
|
2261
|
-
`:"",V=G?`
|
|
2262
|
-
private _createTemplate(): void {
|
|
2263
|
-
const template = document.createElement('template');
|
|
2264
|
-
template.innerHTML = \`${H}${U}\`;
|
|
2265
|
-
${Y?"this.shadowRoot!.appendChild(template.content.cloneNode(true));":"this.appendChild(template.content.cloneNode(true));"}
|
|
2266
|
-
this._processSlots();
|
|
2267
|
-
}`:`
|
|
2268
|
-
private _render(): void {
|
|
2269
|
-
${Y?"this.shadowRoot!.innerHTML":"this.innerHTML"} = \`${H}${U}\`;
|
|
2270
|
-
this._processSlots();
|
|
2271
|
-
}`;return`/**
|
|
2272
|
-
* ${Z} Web Component
|
|
2273
|
-
* Auto-generated from stx component (TypeScript)
|
|
2274
|
-
*
|
|
2275
|
-
* @example
|
|
2276
|
-
* \`\`\`html
|
|
2277
|
-
* <${J}></${J}>
|
|
2278
|
-
* \`\`\`
|
|
2279
|
-
*/
|
|
2280
|
-
|
|
2281
|
-
/**
|
|
2282
|
-
* Detail type for slot-changed event
|
|
2283
|
-
*/
|
|
2284
|
-
interface SlotChangeDetail {
|
|
2285
|
-
slotName: string;
|
|
2286
|
-
assignedNodes: Node[];
|
|
2287
|
-
}
|
|
2288
|
-
|
|
2289
|
-
${L}
|
|
2290
|
-
/**
|
|
2291
|
-
* ${Z} custom element class
|
|
2292
|
-
* @customElement ${J}
|
|
2293
|
-
*/
|
|
2294
|
-
export class ${W} extends ${X} {
|
|
2295
|
-
${_}
|
|
2296
|
-
private _initialized = false;
|
|
2297
|
-
${Y?"":"private _slotContent: Node[] = [];"}
|
|
2298
|
-
|
|
2299
|
-
constructor() {
|
|
2300
|
-
super();
|
|
2301
|
-
${Y?'this.attachShadow({ mode: "open" });':""}
|
|
2302
|
-
}
|
|
2303
|
-
${V}
|
|
2304
|
-
${Y?`
|
|
2305
|
-
private _processSlots(): void {
|
|
2306
|
-
const slots = this.shadowRoot!.querySelectorAll('slot');
|
|
2307
|
-
slots.forEach((slot) => {
|
|
2308
|
-
slot.addEventListener('slotchange', () => {
|
|
2309
|
-
const assignedNodes = (slot as HTMLSlotElement).assignedNodes();
|
|
2310
|
-
this.dispatchEvent(new CustomEvent<SlotChangeDetail>('slot-changed', {
|
|
2311
|
-
detail: { slotName: slot.getAttribute('name') || 'default', assignedNodes }
|
|
2312
|
-
}));
|
|
2313
|
-
});
|
|
2314
|
-
});
|
|
2315
|
-
}`:`
|
|
2316
|
-
private _processSlots(): void {
|
|
2317
|
-
const slots = this.querySelectorAll('[data-slot]');
|
|
2318
|
-
slots.forEach((slotEl) => {
|
|
2319
|
-
const slotName = slotEl.getAttribute('data-slot');
|
|
2320
|
-
if (slotName) {
|
|
2321
|
-
const slottedContent = this._slotContent.filter(
|
|
2322
|
-
node => node.nodeType === Node.ELEMENT_NODE && (node as Element).getAttribute('slot') === slotName
|
|
2323
|
-
);
|
|
2324
|
-
if (slottedContent.length > 0) {
|
|
2325
|
-
slotEl.innerHTML = '';
|
|
2326
|
-
slottedContent.forEach(content => slotEl.appendChild(content));
|
|
2327
|
-
}
|
|
2328
|
-
}
|
|
2329
|
-
});
|
|
2330
|
-
const defaultSlot = this.querySelector('[data-slot=""]') || this.querySelector('[data-default-slot]');
|
|
2331
|
-
if (defaultSlot) {
|
|
2332
|
-
const unslottedContent = this._slotContent.filter(
|
|
2333
|
-
node => node.nodeType !== Node.ELEMENT_NODE || !(node as Element).hasAttribute('slot')
|
|
2334
|
-
);
|
|
2335
|
-
if (unslottedContent.length > 0) {
|
|
2336
|
-
defaultSlot.innerHTML = '';
|
|
2337
|
-
unslottedContent.forEach(content => defaultSlot.appendChild(content));
|
|
2338
|
-
}
|
|
2339
|
-
}
|
|
2340
|
-
}`}
|
|
2341
|
-
${O}
|
|
2342
|
-
${F}
|
|
2343
|
-
|
|
2344
|
-
connectedCallback(): void {
|
|
2345
|
-
if (this._initialized) return;
|
|
2346
|
-
${Y?"":"this._slotContent = Array.from(this.childNodes);"}
|
|
2347
|
-
this._initialized = true;
|
|
2348
|
-
${G?"this._createTemplate();":"this._render();"}
|
|
2349
|
-
}
|
|
2350
|
-
|
|
2351
|
-
disconnectedCallback(): void {
|
|
2352
|
-
// Component removed from the DOM
|
|
2353
|
-
}
|
|
2354
|
-
|
|
2355
|
-
adoptedCallback(): void {
|
|
2356
|
-
// Component moved to a new document
|
|
2357
|
-
}
|
|
2358
|
-
}
|
|
2359
|
-
|
|
2360
|
-
// Type augmentation for HTMLElementTagNameMap
|
|
2361
|
-
declare global {
|
|
2362
|
-
interface HTMLElementTagNameMap {
|
|
2363
|
-
'${J}': ${W};
|
|
2364
|
-
}
|
|
2365
|
-
}
|
|
2366
|
-
|
|
2367
|
-
// Register the web component
|
|
2368
|
-
customElements.define('${J}', ${W});
|
|
2369
|
-
`}var Y5={strategy:"attribute",attributeName:"data-v",preserveOriginal:!0};function Q5($){let Z=$.split("").reduce((J,X)=>(J<<5)-J+X.charCodeAt(0)|0,0);return Math.abs(Z).toString(36).slice(0,8)}function HJ($,Z,J={}){let X={...Y5,...J},Q=Q5(Z);switch(X.strategy){case"shadow":return $;case"prefix":return BJ($,X.prefix||Z,X.preserveOriginal);case"attribute":return jJ($,Q,X.attributeName||"data-v",X.preserveOriginal);case"bem":return _J($,Z,X.preserveOriginal);default:return $}}function jJ($,Z,J,X){let Q=`[${J}-${Z}]`;return $.replace(/([.#]?[\w-]+|\*)\s*(\{|,)/g,(Y,G,z)=>{if(G.startsWith("@"))return Y;if(/^(?::root|:host|html|body)$/i.test(G))return Y;return`${X?`${G}${Q}`:`${G}${Q}`}${z}`})}function BJ($,Z,J){return $.replace(/\.([a-z_][\w-]*)/gi,(X,Q)=>{if(Q.startsWith(Z))return X;let Y=`${Z}__${Q}`;return J?`.${Y}`:`.${Y}`})}function _J($,Z,J){let X=Z.replace(/[^a-z0-9]/gi,"-");return $.replace(/\.([a-z_][\w-]*)/gi,(Q,Y)=>{if(Y.includes("__")||Y.includes("--")){if(!Y.startsWith(X))return`.${X}__${Y}`;return Q}let G=`${X}__${Y}`;return J?`.${G}`:`.${G}`})}function VJ($,Z,J={}){let X={...Y5,...J};if(X.strategy==="shadow")return $;if(X.strategy==="attribute"){let Q=Q5(Z),G=`${X.attributeName||"data-v"}-${Q}`;return $.replace(/<([a-z][a-z0-9-]*)([^>]*)>/gi,(z,q,K)=>{if(/^(?:script|style|!--)$/i.test(q))return z;let W=K.trimEnd().endsWith("/"),U=W?K.slice(0,-1):K;return`<${q}${U} ${G}${W?"/":""}>`})}if(X.strategy==="prefix"||X.strategy==="bem"){let Q=X.strategy==="bem"?Z.replace(/[^a-z0-9]/gi,"-"):X.prefix||Z;return $.replace(/\bclass\s*=\s*["']([^"']+)["']/gi,(Y,G)=>{return`class="${G.split(/\s+/).map((q)=>{if(!q)return q;if(q.startsWith(Q))return q;return`${Q}__${q}`}).join(" ")}"`})}return $}function tq($,Z={}){let J={...Y5,...Z},X=Q5($);return`${J.attributeName||"data-v"}-${X}`}function eq($,Z,J={}){let X="",Q=$.replace(/<style([^>]*)>([\s\S]*?)<\/style>/gi,(G,z,q)=>{if(/\bscoped\b/i.test(z)||J.strategy!=="shadow")X+=`${HJ(q,Z,J)}
|
|
2370
|
-
`;else X+=`${q}
|
|
2371
|
-
`;return""});return{html:VJ(Q,Z,J),css:X.trim()}}function S1($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function $K($){let{name:Z,tag:J,baseElement:X="HTMLElement",template:Q,styles:Y="",shadowDOM:G=!0,properties:z={},lifecycle:q={},events:K={},methods:W={},state:U={}}=$,H=Z.replace(/\W/g,""),j=Object.keys(z),B=j.filter((I)=>z[I].attribute!==!1).map((I)=>z[I].attribute||S1(I)),_=j.map((I)=>{let N=z[I],M=N.default!==void 0?JSON.stringify(N.default):N.type==="string"?'""':N.type==="number"?"0":N.type==="boolean"?"false":N.type==="array"?"[]":"{}";return` this._${I} = ${M};`}).join(`
|
|
2372
|
-
`),F=j.map((I)=>{let N=z[I],M=N.attribute!==!1?N.attribute||S1(I):null,T=N.reflect&&M?`
|
|
2373
|
-
if (value !== null && value !== undefined) {
|
|
2374
|
-
${N.type==="boolean"?`if (value) { this.setAttribute('${M}', ''); }
|
|
2375
|
-
else { this.removeAttribute('${M}'); }`:`this.setAttribute('${M}', ${N.type==="object"||N.type==="array"?"JSON.stringify(value)":"String(value)"});`}
|
|
2376
|
-
}
|
|
2377
|
-
else {
|
|
2378
|
-
this.removeAttribute('${M}');
|
|
2379
|
-
}`:"",k=N.observer?`this.${N.observer}(value, oldValue);`:"",y=N.render!==!1?"this._scheduleRender();":"";return`
|
|
2380
|
-
get ${I}() {
|
|
2381
|
-
return this._${I};
|
|
2382
|
-
}
|
|
2383
|
-
|
|
2384
|
-
set ${I}(value) {
|
|
2385
|
-
const oldValue = this._${I};
|
|
2386
|
-
if (oldValue === value) return;
|
|
2387
|
-
this._${I} = value;${T}
|
|
2388
|
-
${k}
|
|
2389
|
-
${y}
|
|
2390
|
-
this.dispatchEvent(new CustomEvent('${I}-changed', {
|
|
2391
|
-
detail: { value, oldValue },
|
|
2392
|
-
bubbles: true
|
|
2393
|
-
}));
|
|
2394
|
-
}`}).join(`
|
|
2395
|
-
`),L=B.length>0?`
|
|
2396
|
-
static get observedAttributes() {
|
|
2397
|
-
return [${B.map((I)=>`'${I}'`).join(", ")}];
|
|
2398
|
-
}
|
|
2399
|
-
|
|
2400
|
-
attributeChangedCallback(name, oldValue, newValue) {
|
|
2401
|
-
if (oldValue === newValue) return;
|
|
2402
|
-
const propName = this._attrToProp[name];
|
|
2403
|
-
if (propName) {
|
|
2404
|
-
const propDef = this._propertyDefs[propName];
|
|
2405
|
-
this[propName] = this._deserializeAttribute(newValue, propDef.type);
|
|
2406
|
-
}
|
|
2407
|
-
${q.attributeChanged||""}
|
|
2408
|
-
}`:"",O=Object.entries(K).map(([I,N])=>{return`this._root.addEventListener('${I}', (e) => { ${N} });`}).join(`
|
|
2409
|
-
`),V=Object.entries(W).map(([I,N])=>{return`
|
|
2410
|
-
${I}() {
|
|
2411
|
-
${N}
|
|
2412
|
-
}`}).join(`
|
|
2413
|
-
`),w=JSON.stringify(Object.fromEntries(j.map((I)=>[I,z[I]]))),R=JSON.stringify(Object.fromEntries(j.filter((I)=>z[I].attribute!==!1).map((I)=>[z[I].attribute||S1(I),I]))),D=Q.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),A=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`");return`/**
|
|
2414
|
-
* ${Z} - Reactive Web Component
|
|
2415
|
-
* Auto-generated with reactive properties and lifecycle management
|
|
2416
|
-
*
|
|
2417
|
-
* @customElement ${J}
|
|
2418
|
-
*/
|
|
2419
|
-
class ${H} extends ${X} {
|
|
2420
|
-
// Property definitions
|
|
2421
|
-
_propertyDefs = ${w};
|
|
2422
|
-
_attrToProp = ${R};
|
|
2423
|
-
|
|
2424
|
-
// Internal state
|
|
2425
|
-
_state = ${JSON.stringify(U)};
|
|
2426
|
-
_renderPending = false;
|
|
2427
|
-
_isConnected = false;
|
|
2428
|
-
|
|
2429
|
-
constructor() {
|
|
2430
|
-
super();
|
|
2431
|
-
${G?'this.attachShadow({ mode: "open" });':""}
|
|
2432
|
-
this._root = ${G?"this.shadowRoot":"this"};
|
|
2433
|
-
|
|
2434
|
-
// Initialize properties with defaults
|
|
2435
|
-
${_}
|
|
2436
|
-
|
|
2437
|
-
// Initial render
|
|
2438
|
-
this._render();
|
|
2439
|
-
}
|
|
2440
|
-
|
|
2441
|
-
// =========================================================================
|
|
2442
|
-
// Reactive Properties
|
|
2443
|
-
// =========================================================================
|
|
2444
|
-
${F}
|
|
2445
|
-
|
|
2446
|
-
// =========================================================================
|
|
2447
|
-
// State Management
|
|
2448
|
-
// =========================================================================
|
|
2449
|
-
|
|
2450
|
-
/**
|
|
2451
|
-
* Get current internal state
|
|
2452
|
-
*/
|
|
2453
|
-
get state() {
|
|
2454
|
-
return { ...this._state };
|
|
2455
|
-
}
|
|
2456
|
-
|
|
2457
|
-
/**
|
|
2458
|
-
* Update internal state and trigger re-render
|
|
2459
|
-
* @param {Object} updates - State updates to merge
|
|
2460
|
-
*/
|
|
2461
|
-
setState(updates) {
|
|
2462
|
-
const oldState = { ...this._state };
|
|
2463
|
-
this._state = { ...this._state, ...updates };
|
|
2464
|
-
this._scheduleRender();
|
|
2465
|
-
this.dispatchEvent(new CustomEvent('state-changed', {
|
|
2466
|
-
detail: { state: this._state, oldState },
|
|
2467
|
-
bubbles: true
|
|
2468
|
-
}));
|
|
2469
|
-
}
|
|
2470
|
-
|
|
2471
|
-
// =========================================================================
|
|
2472
|
-
// Rendering
|
|
2473
|
-
// =========================================================================
|
|
2474
|
-
|
|
2475
|
-
/**
|
|
2476
|
-
* Schedule a render on the next animation frame (batched)
|
|
2477
|
-
*/
|
|
2478
|
-
_scheduleRender() {
|
|
2479
|
-
if (this._renderPending) return;
|
|
2480
|
-
this._renderPending = true;
|
|
2481
|
-
requestAnimationFrame(() => {
|
|
2482
|
-
this._renderPending = false;
|
|
2483
|
-
this._render();
|
|
2484
|
-
});
|
|
2485
|
-
}
|
|
2486
|
-
|
|
2487
|
-
/**
|
|
2488
|
-
* Render the component template
|
|
2489
|
-
*/
|
|
2490
|
-
_render() {
|
|
2491
|
-
const template = \`${A?`<style>${A}</style>`:""}${D}\`;
|
|
2492
|
-
|
|
2493
|
-
// Interpolate template with property values
|
|
2494
|
-
const rendered = template.replace(/\\{\\{\\s*(\\w+)\\s*\\}\\}/g, (match, propName) => {
|
|
2495
|
-
if (propName in this) {
|
|
2496
|
-
const value = this[propName];
|
|
2497
|
-
if (value === null || value === undefined) return '';
|
|
2498
|
-
if (typeof value === 'object') return JSON.stringify(value);
|
|
2499
|
-
return String(value);
|
|
2500
|
-
}
|
|
2501
|
-
if (propName in this._state) {
|
|
2502
|
-
const value = this._state[propName];
|
|
2503
|
-
if (value === null || value === undefined) return '';
|
|
2504
|
-
if (typeof value === 'object') return JSON.stringify(value);
|
|
2505
|
-
return String(value);
|
|
2506
|
-
}
|
|
2507
|
-
return match;
|
|
2508
|
-
});
|
|
2509
|
-
|
|
2510
|
-
this._root.innerHTML = rendered;
|
|
2511
|
-
this._bindEvents();
|
|
2512
|
-
}
|
|
2513
|
-
|
|
2514
|
-
/**
|
|
2515
|
-
* Bind event handlers after render
|
|
2516
|
-
*/
|
|
2517
|
-
_bindEvents() {
|
|
2518
|
-
${O}
|
|
2519
|
-
}
|
|
2520
|
-
|
|
2521
|
-
// =========================================================================
|
|
2522
|
-
// Attribute Handling
|
|
2523
|
-
// =========================================================================
|
|
2524
|
-
|
|
2525
|
-
/**
|
|
2526
|
-
* Deserialize attribute value to property type
|
|
2527
|
-
*/
|
|
2528
|
-
_deserializeAttribute(value, type) {
|
|
2529
|
-
if (value === null) return null;
|
|
2530
|
-
switch (type) {
|
|
2531
|
-
case 'number': return Number(value);
|
|
2532
|
-
case 'boolean': return value !== null && value !== 'false' && value !== '0';
|
|
2533
|
-
case 'object':
|
|
2534
|
-
case 'array':
|
|
2535
|
-
try { return JSON.parse(value); }
|
|
2536
|
-
catch { return type === 'array' ? [] : {}; }
|
|
2537
|
-
default: return value;
|
|
2538
|
-
}
|
|
2539
|
-
}
|
|
2540
|
-
|
|
2541
|
-
${L}
|
|
2542
|
-
|
|
2543
|
-
// =========================================================================
|
|
2544
|
-
// Lifecycle
|
|
2545
|
-
// =========================================================================
|
|
2546
|
-
|
|
2547
|
-
connectedCallback() {
|
|
2548
|
-
this._isConnected = true;
|
|
2549
|
-
${q.connected||"// Component connected to DOM"}
|
|
2550
|
-
}
|
|
2551
|
-
|
|
2552
|
-
disconnectedCallback() {
|
|
2553
|
-
this._isConnected = false;
|
|
2554
|
-
${q.disconnected||"// Component disconnected from DOM"}
|
|
2555
|
-
}
|
|
2556
|
-
|
|
2557
|
-
adoptedCallback() {
|
|
2558
|
-
${q.adopted||"// Component moved to new document"}
|
|
2559
|
-
}
|
|
2560
|
-
|
|
2561
|
-
// =========================================================================
|
|
2562
|
-
// Custom Methods
|
|
2563
|
-
// =========================================================================
|
|
2564
|
-
${V}
|
|
2565
|
-
}
|
|
2566
|
-
|
|
2567
|
-
// Register the custom element
|
|
2568
|
-
customElements.define('${J}', ${H});
|
|
2569
|
-
|
|
2570
|
-
// Export for module usage
|
|
2571
|
-
export { ${H} };
|
|
2572
|
-
export default ${H};
|
|
2573
|
-
`}function ZK($){let{name:Z,tag:J,baseElement:X="HTMLElement",template:Q,styles:Y="",shadowDOM:G=!0,properties:z={},lifecycle:q={},events:K={},methods:W={},state:U={}}=$,H=Z.replace(/\W/g,""),j=Object.keys(z),B=j.filter((N)=>z[N].attribute!==!1).map((N)=>z[N].attribute||S1(N)),_=(N)=>{switch(N){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"}},F=j.length>0?`
|
|
2574
|
-
/**
|
|
2575
|
-
* Props interface for ${Z}
|
|
2576
|
-
*/
|
|
2577
|
-
export interface ${H}Props {
|
|
2578
|
-
${j.map((N)=>` ${N}?: ${_(z[N].type)};`).join(`
|
|
2579
|
-
`)}
|
|
2580
|
-
}
|
|
2581
|
-
`:"",L=Object.keys(U).length>0?`
|
|
2582
|
-
/**
|
|
2583
|
-
* State interface for ${Z}
|
|
2584
|
-
*/
|
|
2585
|
-
export interface ${H}State {
|
|
2586
|
-
${Object.entries(U).map(([N,M])=>` ${N}: ${typeof M};`).join(`
|
|
2587
|
-
`)}
|
|
2588
|
-
}
|
|
2589
|
-
`:`
|
|
2590
|
-
export interface ${H}State {
|
|
2591
|
-
[key: string]: unknown;
|
|
2592
|
-
}
|
|
2593
|
-
`,O=j.map((N)=>{let M=z[N],T=_(M.type);return` private _${N}: ${T};`}).join(`
|
|
2594
|
-
`),V=j.map((N)=>{let M=z[N],T=_(M.type),k=M.attribute!==!1?M.attribute||S1(N):null,y=M.default!==void 0?JSON.stringify(M.default):M.type==="string"?'""':M.type==="number"?"0":M.type==="boolean"?"false":M.type==="array"?"[]":"{}",E=M.reflect&&k?`
|
|
2595
|
-
if (value !== null && value !== undefined) {
|
|
2596
|
-
${M.type==="boolean"?`if (value) { this.setAttribute('${k}', ''); }
|
|
2597
|
-
else { this.removeAttribute('${k}'); }`:`this.setAttribute('${k}', ${M.type==="object"||M.type==="array"?"JSON.stringify(value)":"String(value)"});`}
|
|
2598
|
-
}
|
|
2599
|
-
else {
|
|
2600
|
-
this.removeAttribute('${k}');
|
|
2601
|
-
}`:"",b=M.observer?`this.${M.observer}(value, oldValue);`:"",C=M.render!==!1?"this._scheduleRender();":"";return`
|
|
2602
|
-
get ${N}(): ${T} {
|
|
2603
|
-
return this._${N};
|
|
2604
|
-
}
|
|
2605
|
-
|
|
2606
|
-
set ${N}(value: ${T}) {
|
|
2607
|
-
const oldValue = this._${N};
|
|
2608
|
-
if (oldValue === value) return;
|
|
2609
|
-
this._${N} = value;${E}
|
|
2610
|
-
${b}
|
|
2611
|
-
${C}
|
|
2612
|
-
this.dispatchEvent(new CustomEvent('${N}-changed', {
|
|
2613
|
-
detail: { value, oldValue },
|
|
2614
|
-
bubbles: true
|
|
2615
|
-
}));
|
|
2616
|
-
}
|
|
2617
|
-
|
|
2618
|
-
// Property default: ${y}`}).join(`
|
|
2619
|
-
`),w=B.length>0?`
|
|
2620
|
-
static get observedAttributes(): string[] {
|
|
2621
|
-
return [${B.map((N)=>`'${N}'`).join(", ")}];
|
|
2622
|
-
}
|
|
2623
|
-
|
|
2624
|
-
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void {
|
|
2625
|
-
if (oldValue === newValue) return;
|
|
2626
|
-
const propName = this._attrToProp[name];
|
|
2627
|
-
if (propName) {
|
|
2628
|
-
const propDef = this._propertyDefs[propName];
|
|
2629
|
-
(this as unknown as Record<string, unknown>)[propName] = this._deserializeAttribute(newValue, propDef.type);
|
|
2630
|
-
}
|
|
2631
|
-
${q.attributeChanged||""}
|
|
2632
|
-
}`:"",R=Object.entries(K).map(([N,M])=>{return`this._root.addEventListener('${N}', (e: Event) => { ${M} });`}).join(`
|
|
2633
|
-
`),D=Object.entries(W).map(([N,M])=>{return`
|
|
2634
|
-
${N}(): void {
|
|
2635
|
-
${M}
|
|
2636
|
-
}`}).join(`
|
|
2637
|
-
`),A=Q.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),I=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`");return`/**
|
|
2638
|
-
* ${Z} - Reactive Web Component (TypeScript)
|
|
2639
|
-
* Auto-generated with reactive properties and lifecycle management
|
|
2640
|
-
*
|
|
2641
|
-
* @customElement ${J}
|
|
2642
|
-
*/
|
|
2643
|
-
|
|
2644
|
-
${F}
|
|
2645
|
-
${L}
|
|
2646
|
-
|
|
2647
|
-
/**
|
|
2648
|
-
* Property definition type
|
|
2649
|
-
*/
|
|
2650
|
-
interface PropertyDefinition {
|
|
2651
|
-
type: 'string' | 'number' | 'boolean' | 'object' | 'array';
|
|
2652
|
-
default?: unknown;
|
|
2653
|
-
reflect?: boolean;
|
|
2654
|
-
attribute?: string | false;
|
|
2655
|
-
observer?: string;
|
|
2656
|
-
render?: boolean;
|
|
2657
|
-
}
|
|
2658
|
-
|
|
2659
|
-
/**
|
|
2660
|
-
* ${Z} custom element
|
|
2661
|
-
*/
|
|
2662
|
-
export class ${H} extends ${X} {
|
|
2663
|
-
// Property definitions
|
|
2664
|
-
private _propertyDefs: Record<string, PropertyDefinition> = ${JSON.stringify(z)};
|
|
2665
|
-
private _attrToProp: Record<string, string> = ${JSON.stringify(Object.fromEntries(j.filter((N)=>z[N].attribute!==!1).map((N)=>[z[N].attribute||S1(N),N])))};
|
|
2666
|
-
|
|
2667
|
-
// Internal state
|
|
2668
|
-
private _state: ${H}State = ${JSON.stringify(U)};
|
|
2669
|
-
private _renderPending = false;
|
|
2670
|
-
private _isConnected = false;
|
|
2671
|
-
private _root: ShadowRoot | HTMLElement;
|
|
2672
|
-
|
|
2673
|
-
// Property backing fields
|
|
2674
|
-
${O}
|
|
2675
|
-
|
|
2676
|
-
constructor() {
|
|
2677
|
-
super();
|
|
2678
|
-
${G?'this.attachShadow({ mode: "open" });':""}
|
|
2679
|
-
this._root = ${G?"this.shadowRoot!":"this"};
|
|
2680
|
-
|
|
2681
|
-
// Initialize properties with defaults
|
|
2682
|
-
${j.map((N)=>{let M=z[N],T=M.default!==void 0?JSON.stringify(M.default):M.type==="string"?'""':M.type==="number"?"0":M.type==="boolean"?"false":M.type==="array"?"[]":"{}";return` this._${N} = ${T};`}).join(`
|
|
2683
|
-
`)}
|
|
2684
|
-
|
|
2685
|
-
// Initial render
|
|
2686
|
-
this._render();
|
|
2687
|
-
}
|
|
2688
|
-
|
|
2689
|
-
// =========================================================================
|
|
2690
|
-
// Reactive Properties
|
|
2691
|
-
// =========================================================================
|
|
2692
|
-
${V}
|
|
2693
|
-
|
|
2694
|
-
// =========================================================================
|
|
2695
|
-
// State Management
|
|
2696
|
-
// =========================================================================
|
|
2697
|
-
|
|
2698
|
-
/**
|
|
2699
|
-
* Get current internal state
|
|
2700
|
-
*/
|
|
2701
|
-
get state(): ${H}State {
|
|
2702
|
-
return { ...this._state };
|
|
2703
|
-
}
|
|
2704
|
-
|
|
2705
|
-
/**
|
|
2706
|
-
* Update internal state and trigger re-render
|
|
2707
|
-
*/
|
|
2708
|
-
setState(updates: Partial<${H}State>): void {
|
|
2709
|
-
const oldState = { ...this._state };
|
|
2710
|
-
this._state = { ...this._state, ...updates };
|
|
2711
|
-
this._scheduleRender();
|
|
2712
|
-
this.dispatchEvent(new CustomEvent('state-changed', {
|
|
2713
|
-
detail: { state: this._state, oldState },
|
|
2714
|
-
bubbles: true
|
|
2715
|
-
}));
|
|
2716
|
-
}
|
|
2717
|
-
|
|
2718
|
-
// =========================================================================
|
|
2719
|
-
// Rendering
|
|
2720
|
-
// =========================================================================
|
|
2721
|
-
|
|
2722
|
-
/**
|
|
2723
|
-
* Schedule a render on the next animation frame (batched)
|
|
2724
|
-
*/
|
|
2725
|
-
private _scheduleRender(): void {
|
|
2726
|
-
if (this._renderPending) return;
|
|
2727
|
-
this._renderPending = true;
|
|
2728
|
-
requestAnimationFrame(() => {
|
|
2729
|
-
this._renderPending = false;
|
|
2730
|
-
this._render();
|
|
2731
|
-
});
|
|
2732
|
-
}
|
|
2733
|
-
|
|
2734
|
-
/**
|
|
2735
|
-
* Render the component template
|
|
2736
|
-
*/
|
|
2737
|
-
private _render(): void {
|
|
2738
|
-
const template = \`${I?`<style>${I}</style>`:""}${A}\`;
|
|
2739
|
-
|
|
2740
|
-
// Interpolate template with property values
|
|
2741
|
-
const rendered = template.replace(/\\{\\{\\s*(\\w+)\\s*\\}\\}/g, (match, propName) => {
|
|
2742
|
-
if (propName in this) {
|
|
2743
|
-
const value = (this as unknown as Record<string, unknown>)[propName];
|
|
2744
|
-
if (value === null || value === undefined) return '';
|
|
2745
|
-
if (typeof value === 'object') return JSON.stringify(value);
|
|
2746
|
-
return String(value);
|
|
2747
|
-
}
|
|
2748
|
-
if (propName in this._state) {
|
|
2749
|
-
const value = this._state[propName as keyof ${H}State];
|
|
2750
|
-
if (value === null || value === undefined) return '';
|
|
2751
|
-
if (typeof value === 'object') return JSON.stringify(value);
|
|
2752
|
-
return String(value);
|
|
2753
|
-
}
|
|
2754
|
-
return match;
|
|
2755
|
-
});
|
|
2756
|
-
|
|
2757
|
-
this._root.innerHTML = rendered;
|
|
2758
|
-
this._bindEvents();
|
|
2759
|
-
}
|
|
2760
|
-
|
|
2761
|
-
/**
|
|
2762
|
-
* Bind event handlers after render
|
|
2763
|
-
*/
|
|
2764
|
-
private _bindEvents(): void {
|
|
2765
|
-
${R}
|
|
2766
|
-
}
|
|
2767
|
-
|
|
2768
|
-
// =========================================================================
|
|
2769
|
-
// Attribute Handling
|
|
2770
|
-
// =========================================================================
|
|
2771
|
-
|
|
2772
|
-
/**
|
|
2773
|
-
* Deserialize attribute value to property type
|
|
2774
|
-
*/
|
|
2775
|
-
private _deserializeAttribute(value: string | null, type: string): unknown {
|
|
2776
|
-
if (value === null) return null;
|
|
2777
|
-
switch (type) {
|
|
2778
|
-
case 'number': return Number(value);
|
|
2779
|
-
case 'boolean': return value !== null && value !== 'false' && value !== '0';
|
|
2780
|
-
case 'object':
|
|
2781
|
-
case 'array':
|
|
2782
|
-
try { return JSON.parse(value); }
|
|
2783
|
-
catch { return type === 'array' ? [] : {}; }
|
|
2784
|
-
default: return value;
|
|
2785
|
-
}
|
|
2786
|
-
}
|
|
2787
|
-
|
|
2788
|
-
${w}
|
|
2789
|
-
|
|
2790
|
-
// =========================================================================
|
|
2791
|
-
// Lifecycle
|
|
2792
|
-
// =========================================================================
|
|
2793
|
-
|
|
2794
|
-
connectedCallback(): void {
|
|
2795
|
-
this._isConnected = true;
|
|
2796
|
-
${q.connected||"// Component connected to DOM"}
|
|
2797
|
-
}
|
|
2798
|
-
|
|
2799
|
-
disconnectedCallback(): void {
|
|
2800
|
-
this._isConnected = false;
|
|
2801
|
-
${q.disconnected||"// Component disconnected from DOM"}
|
|
2802
|
-
}
|
|
2803
|
-
|
|
2804
|
-
adoptedCallback(): void {
|
|
2805
|
-
${q.adopted||"// Component moved to new document"}
|
|
2806
|
-
}
|
|
2807
|
-
|
|
2808
|
-
// =========================================================================
|
|
2809
|
-
// Custom Methods
|
|
2810
|
-
// =========================================================================
|
|
2811
|
-
${D}
|
|
2812
|
-
}
|
|
2813
|
-
|
|
2814
|
-
// Type augmentation for HTMLElementTagNameMap
|
|
2815
|
-
declare global {
|
|
2816
|
-
interface HTMLElementTagNameMap {
|
|
2817
|
-
'${J}': ${H};
|
|
2818
|
-
}
|
|
2819
|
-
}
|
|
2820
|
-
|
|
2821
|
-
// Register the custom element
|
|
2822
|
-
customElements.define('${J}', ${H});
|
|
2823
|
-
|
|
2824
|
-
export default ${H};
|
|
2825
|
-
`}function JK(){return`/**
|
|
2826
|
-
* ReactiveElement Mixin
|
|
2827
|
-
* Adds reactive properties and lifecycle management to web components
|
|
2828
|
-
*/
|
|
2829
|
-
const ReactiveElement = (Base) => class extends Base {
|
|
2830
|
-
static get observedAttributes() {
|
|
2831
|
-
const props = this.properties || {};
|
|
2832
|
-
return Object.keys(props)
|
|
2833
|
-
.filter(prop => props[prop].attribute !== false)
|
|
2834
|
-
.map(prop => props[prop].attribute || prop.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase());
|
|
2835
|
-
}
|
|
2836
|
-
|
|
2837
|
-
constructor() {
|
|
2838
|
-
super();
|
|
2839
|
-
this._state = {};
|
|
2840
|
-
this._renderPending = false;
|
|
2841
|
-
this._propertyValues = new Map();
|
|
2842
|
-
this._initializeProperties();
|
|
2843
|
-
}
|
|
2844
|
-
|
|
2845
|
-
_initializeProperties() {
|
|
2846
|
-
const props = this.constructor.properties || {};
|
|
2847
|
-
for (const [name, def] of Object.entries(props)) {
|
|
2848
|
-
// Set default value
|
|
2849
|
-
if (def.default !== undefined) {
|
|
2850
|
-
this._propertyValues.set(name, def.default);
|
|
2851
|
-
}
|
|
2852
|
-
|
|
2853
|
-
// Define getter/setter
|
|
2854
|
-
Object.defineProperty(this, name, {
|
|
2855
|
-
get: () => this._propertyValues.get(name),
|
|
2856
|
-
set: (value) => {
|
|
2857
|
-
const oldValue = this._propertyValues.get(name);
|
|
2858
|
-
if (oldValue === value) return;
|
|
2859
|
-
this._propertyValues.set(name, value);
|
|
2860
|
-
|
|
2861
|
-
// Reflect to attribute
|
|
2862
|
-
if (def.reflect) {
|
|
2863
|
-
const attrName = def.attribute || name.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
|
|
2864
|
-
if (def.type === 'boolean') {
|
|
2865
|
-
value ? this.setAttribute(attrName, '') : this.removeAttribute(attrName);
|
|
2866
|
-
}
|
|
2867
|
-
else {
|
|
2868
|
-
this.setAttribute(attrName, def.type === 'object' ? JSON.stringify(value) : String(value));
|
|
2869
|
-
}
|
|
2870
|
-
}
|
|
2871
|
-
|
|
2872
|
-
// Call observer
|
|
2873
|
-
if (def.observer && typeof this[def.observer] === 'function') {
|
|
2874
|
-
this[def.observer](value, oldValue);
|
|
2875
|
-
}
|
|
2876
|
-
|
|
2877
|
-
// Schedule render
|
|
2878
|
-
if (def.render !== false) {
|
|
2879
|
-
this._scheduleRender();
|
|
2880
|
-
}
|
|
2881
|
-
|
|
2882
|
-
// Dispatch event
|
|
2883
|
-
this.dispatchEvent(new CustomEvent(\`\${name}-changed\`, {
|
|
2884
|
-
detail: { value, oldValue },
|
|
2885
|
-
bubbles: true
|
|
2886
|
-
}));
|
|
2887
|
-
},
|
|
2888
|
-
enumerable: true,
|
|
2889
|
-
configurable: true
|
|
2890
|
-
});
|
|
2891
|
-
}
|
|
2892
|
-
}
|
|
2893
|
-
|
|
2894
|
-
attributeChangedCallback(name, oldValue, newValue) {
|
|
2895
|
-
if (oldValue === newValue) return;
|
|
2896
|
-
const props = this.constructor.properties || {};
|
|
2897
|
-
const propName = Object.keys(props).find(p =>
|
|
2898
|
-
(props[p].attribute || p.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase()) === name
|
|
2899
|
-
);
|
|
2900
|
-
if (propName) {
|
|
2901
|
-
const def = props[propName];
|
|
2902
|
-
this[propName] = this._deserialize(newValue, def.type);
|
|
2903
|
-
}
|
|
2904
|
-
}
|
|
2905
|
-
|
|
2906
|
-
_deserialize(value, type) {
|
|
2907
|
-
if (value === null) return null;
|
|
2908
|
-
switch (type) {
|
|
2909
|
-
case 'number': return Number(value);
|
|
2910
|
-
case 'boolean': return value !== null && value !== 'false';
|
|
2911
|
-
case 'object':
|
|
2912
|
-
case 'array':
|
|
2913
|
-
try { return JSON.parse(value); }
|
|
2914
|
-
catch { return type === 'array' ? [] : {}; }
|
|
2915
|
-
default: return value;
|
|
2916
|
-
}
|
|
2917
|
-
}
|
|
2918
|
-
|
|
2919
|
-
get state() {
|
|
2920
|
-
return { ...this._state };
|
|
2921
|
-
}
|
|
2922
|
-
|
|
2923
|
-
setState(updates) {
|
|
2924
|
-
const oldState = { ...this._state };
|
|
2925
|
-
this._state = { ...this._state, ...updates };
|
|
2926
|
-
this._scheduleRender();
|
|
2927
|
-
this.dispatchEvent(new CustomEvent('state-changed', {
|
|
2928
|
-
detail: { state: this._state, oldState },
|
|
2929
|
-
bubbles: true
|
|
2930
|
-
}));
|
|
2931
|
-
}
|
|
2932
|
-
|
|
2933
|
-
_scheduleRender() {
|
|
2934
|
-
if (this._renderPending) return;
|
|
2935
|
-
this._renderPending = true;
|
|
2936
|
-
requestAnimationFrame(() => {
|
|
2937
|
-
this._renderPending = false;
|
|
2938
|
-
if (typeof this.render === 'function') {
|
|
2939
|
-
this.render();
|
|
2940
|
-
}
|
|
2941
|
-
});
|
|
2942
|
-
}
|
|
2943
|
-
};
|
|
2944
|
-
|
|
2945
|
-
export { ReactiveElement };
|
|
2946
|
-
export default ReactiveElement;
|
|
2947
|
-
`}function XK(){return`/**
|
|
2948
|
-
* stx Reactive Web Components Runtime
|
|
2949
|
-
* Provides base classes and utilities for reactive web components
|
|
2950
|
-
*/
|
|
2951
|
-
(function(global) {
|
|
2952
|
-
'use strict';
|
|
2953
|
-
|
|
2954
|
-
/**
|
|
2955
|
-
* Base class for reactive web components
|
|
2956
|
-
*/
|
|
2957
|
-
class StxElement extends HTMLElement {
|
|
2958
|
-
static get observedAttributes() {
|
|
2959
|
-
const props = this.properties || {};
|
|
2960
|
-
return Object.keys(props)
|
|
2961
|
-
.filter(prop => props[prop].attribute !== false)
|
|
2962
|
-
.map(prop => props[prop].attribute || toKebabCase(prop));
|
|
2963
|
-
}
|
|
2964
|
-
|
|
2965
|
-
constructor() {
|
|
2966
|
-
super();
|
|
2967
|
-
this._state = {};
|
|
2968
|
-
this._renderPending = false;
|
|
2969
|
-
this._props = new Map();
|
|
2970
|
-
this._setupShadowDOM();
|
|
2971
|
-
this._initProperties();
|
|
2972
|
-
}
|
|
2973
|
-
|
|
2974
|
-
_setupShadowDOM() {
|
|
2975
|
-
if (this.constructor.useShadowDOM !== false) {
|
|
2976
|
-
this.attachShadow({ mode: 'open' });
|
|
2977
|
-
this._root = this.shadowRoot;
|
|
2978
|
-
}
|
|
2979
|
-
else {
|
|
2980
|
-
this._root = this;
|
|
2981
|
-
}
|
|
2982
|
-
}
|
|
2983
|
-
|
|
2984
|
-
_initProperties() {
|
|
2985
|
-
const props = this.constructor.properties || {};
|
|
2986
|
-
for (const [name, def] of Object.entries(props)) {
|
|
2987
|
-
let value = def.default;
|
|
2988
|
-
this._props.set(name, value);
|
|
2989
|
-
|
|
2990
|
-
Object.defineProperty(this, name, {
|
|
2991
|
-
get: () => this._props.get(name),
|
|
2992
|
-
set: (newValue) => this._setProperty(name, newValue, def),
|
|
2993
|
-
enumerable: true
|
|
2994
|
-
});
|
|
2995
|
-
}
|
|
2996
|
-
}
|
|
2997
|
-
|
|
2998
|
-
_setProperty(name, value, def) {
|
|
2999
|
-
const oldValue = this._props.get(name);
|
|
3000
|
-
if (oldValue === value) return;
|
|
3001
|
-
|
|
3002
|
-
this._props.set(name, value);
|
|
3003
|
-
|
|
3004
|
-
if (def.reflect && def.attribute !== false) {
|
|
3005
|
-
this._reflectToAttribute(name, value, def);
|
|
3006
|
-
}
|
|
3007
|
-
|
|
3008
|
-
if (def.observer && this[def.observer]) {
|
|
3009
|
-
this[def.observer](value, oldValue);
|
|
3010
|
-
}
|
|
3011
|
-
|
|
3012
|
-
if (def.render !== false) {
|
|
3013
|
-
this.requestUpdate();
|
|
3014
|
-
}
|
|
3015
|
-
|
|
3016
|
-
this.dispatchEvent(new CustomEvent(name + '-changed', {
|
|
3017
|
-
detail: { value, oldValue },
|
|
3018
|
-
bubbles: true,
|
|
3019
|
-
composed: true
|
|
3020
|
-
}));
|
|
3021
|
-
}
|
|
3022
|
-
|
|
3023
|
-
_reflectToAttribute(name, value, def) {
|
|
3024
|
-
const attrName = def.attribute || toKebabCase(name);
|
|
3025
|
-
if (value == null || (def.type === 'boolean' && !value)) {
|
|
3026
|
-
this.removeAttribute(attrName);
|
|
3027
|
-
}
|
|
3028
|
-
else if (def.type === 'boolean') {
|
|
3029
|
-
this.setAttribute(attrName, '');
|
|
3030
|
-
}
|
|
3031
|
-
else if (def.type === 'object' || def.type === 'array') {
|
|
3032
|
-
this.setAttribute(attrName, JSON.stringify(value));
|
|
3033
|
-
}
|
|
3034
|
-
else {
|
|
3035
|
-
this.setAttribute(attrName, String(value));
|
|
3036
|
-
}
|
|
3037
|
-
}
|
|
3038
|
-
|
|
3039
|
-
attributeChangedCallback(name, oldValue, newValue) {
|
|
3040
|
-
if (oldValue === newValue) return;
|
|
3041
|
-
const props = this.constructor.properties || {};
|
|
3042
|
-
const propName = Object.keys(props).find(p => {
|
|
3043
|
-
const def = props[p];
|
|
3044
|
-
return (def.attribute || toKebabCase(p)) === name;
|
|
3045
|
-
});
|
|
3046
|
-
|
|
3047
|
-
if (propName) {
|
|
3048
|
-
const def = props[propName];
|
|
3049
|
-
this[propName] = deserialize(newValue, def.type);
|
|
3050
|
-
}
|
|
3051
|
-
}
|
|
3052
|
-
|
|
3053
|
-
get state() {
|
|
3054
|
-
return { ...this._state };
|
|
3055
|
-
}
|
|
3056
|
-
|
|
3057
|
-
setState(updates) {
|
|
3058
|
-
const oldState = { ...this._state };
|
|
3059
|
-
Object.assign(this._state, updates);
|
|
3060
|
-
this.requestUpdate();
|
|
3061
|
-
this.dispatchEvent(new CustomEvent('state-changed', {
|
|
3062
|
-
detail: { state: this._state, oldState },
|
|
3063
|
-
bubbles: true
|
|
3064
|
-
}));
|
|
3065
|
-
}
|
|
3066
|
-
|
|
3067
|
-
requestUpdate() {
|
|
3068
|
-
if (this._renderPending) return;
|
|
3069
|
-
this._renderPending = true;
|
|
3070
|
-
requestAnimationFrame(() => {
|
|
3071
|
-
this._renderPending = false;
|
|
3072
|
-
this.update();
|
|
3073
|
-
});
|
|
3074
|
-
}
|
|
3075
|
-
|
|
3076
|
-
update() {
|
|
3077
|
-
if (this.render) {
|
|
3078
|
-
const content = this.render();
|
|
3079
|
-
if (typeof content === 'string') {
|
|
3080
|
-
this._root.innerHTML = content;
|
|
3081
|
-
}
|
|
3082
|
-
}
|
|
3083
|
-
}
|
|
3084
|
-
|
|
3085
|
-
connectedCallback() {
|
|
3086
|
-
this.update();
|
|
3087
|
-
if (this.connected) this.connected();
|
|
3088
|
-
}
|
|
3089
|
-
|
|
3090
|
-
disconnectedCallback() {
|
|
3091
|
-
if (this.disconnected) this.disconnected();
|
|
3092
|
-
}
|
|
3093
|
-
|
|
3094
|
-
adoptedCallback() {
|
|
3095
|
-
if (this.adopted) this.adopted();
|
|
3096
|
-
}
|
|
3097
|
-
|
|
3098
|
-
// Template helper
|
|
3099
|
-
html(strings, ...values) {
|
|
3100
|
-
return strings.reduce((result, str, i) => {
|
|
3101
|
-
let value = values[i] || '';
|
|
3102
|
-
if (Array.isArray(value)) value = value.join('');
|
|
3103
|
-
if (typeof value === 'object') value = JSON.stringify(value);
|
|
3104
|
-
return result + str + value;
|
|
3105
|
-
}, '');
|
|
3106
|
-
}
|
|
3107
|
-
}
|
|
3108
|
-
|
|
3109
|
-
// Utility functions
|
|
3110
|
-
function toKebabCase(str) {
|
|
3111
|
-
return str.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
|
|
3112
|
-
}
|
|
3113
|
-
|
|
3114
|
-
function deserialize(value, type) {
|
|
3115
|
-
if (value === null) return null;
|
|
3116
|
-
switch (type) {
|
|
3117
|
-
case 'number': return Number(value);
|
|
3118
|
-
case 'boolean': return value !== null && value !== 'false' && value !== '0';
|
|
3119
|
-
case 'object':
|
|
3120
|
-
case 'array':
|
|
3121
|
-
try { return JSON.parse(value); }
|
|
3122
|
-
catch { return type === 'array' ? [] : {}; }
|
|
3123
|
-
default: return value;
|
|
3124
|
-
}
|
|
3125
|
-
}
|
|
3126
|
-
|
|
3127
|
-
// Export to global
|
|
3128
|
-
global.StxElement = StxElement;
|
|
3129
|
-
global.stxComponents = global.stxComponents || {};
|
|
3130
|
-
|
|
3131
|
-
// Helper to define components
|
|
3132
|
-
global.defineStxComponent = function(tag, config) {
|
|
3133
|
-
const { properties, template, styles, methods, ...options } = config;
|
|
3134
|
-
|
|
3135
|
-
class Component extends StxElement {
|
|
3136
|
-
static get properties() { return properties || {}; }
|
|
3137
|
-
static get useShadowDOM() { return options.shadowDOM !== false; }
|
|
3138
|
-
|
|
3139
|
-
render() {
|
|
3140
|
-
let html = template || '';
|
|
3141
|
-
// Simple interpolation
|
|
3142
|
-
html = html.replace(/\\{\\{\\s*(\\w+)\\s*\\}\\}/g, (match, key) => {
|
|
3143
|
-
if (key in this) return this[key] ?? '';
|
|
3144
|
-
if (key in this._state) return this._state[key] ?? '';
|
|
3145
|
-
return match;
|
|
3146
|
-
});
|
|
3147
|
-
return (styles ? '<style>' + styles + '</style>' : '') + html;
|
|
3148
|
-
}
|
|
3149
|
-
}
|
|
3150
|
-
|
|
3151
|
-
// Add methods
|
|
3152
|
-
if (methods) {
|
|
3153
|
-
for (const [name, fn] of Object.entries(methods)) {
|
|
3154
|
-
Component.prototype[name] = fn;
|
|
3155
|
-
}
|
|
3156
|
-
}
|
|
3157
|
-
|
|
3158
|
-
customElements.define(tag, Component);
|
|
3159
|
-
global.stxComponents[tag] = Component;
|
|
3160
|
-
return Component;
|
|
3161
|
-
};
|
|
3162
|
-
|
|
3163
|
-
})(typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : this);
|
|
3164
|
-
`}function LJ($,Z){let J=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),X=J?J[1].trim():"",Q=Z,Y=[],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)Q=j[1];let B=H.match(/props\s*:\s*\[([\s\S]*?)\]/);if(B)Y=B[1].split(",").map((F)=>F.trim().replace(/['"`]/g,"")).filter((F)=>F.length>0);let _=H.match(/shadowDOM\s*:\s*(true|false)/);if(_)G=_[1]==="true"}catch{}}let z=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),q=z?z[1].trim():"",K=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),W=K?K[1].trim():"";return{tag:Q,props:Y,template:q,styles:W,script:X,shadowDOM:G}}function OJ($){let{tag:Z,props:J,template:X,styles:Q,shadowDOM:Y}=$,G=Z.split("-").map((U)=>U.charAt(0).toUpperCase()+U.slice(1)).join(""),z=X.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),q=Q.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),K=J.map((U)=>`'${U}'`).join(", "),W=J.map((U)=>`
|
|
3165
|
-
get ${U}() {
|
|
3166
|
-
return this.getAttribute('${U}') || '';
|
|
3167
|
-
}
|
|
3168
|
-
set ${U}(value) {
|
|
3169
|
-
if (value) {
|
|
3170
|
-
this.setAttribute('${U}', value);
|
|
3171
|
-
}
|
|
3172
|
-
else {
|
|
3173
|
-
this.removeAttribute('${U}');
|
|
3174
|
-
}
|
|
3175
|
-
}`).join(`
|
|
3176
|
-
`);return`/**
|
|
3177
|
-
* ${G} Web Component
|
|
3178
|
-
* Auto-generated from SFC
|
|
3179
|
-
*/
|
|
3180
|
-
class ${G} extends HTMLElement {
|
|
3181
|
-
constructor() {
|
|
3182
|
-
super();
|
|
3183
|
-
${Y?"this.attachShadow({ mode: 'open' });":""}
|
|
3184
|
-
this._render();
|
|
3185
|
-
}
|
|
3186
|
-
|
|
3187
|
-
static get observedAttributes() {
|
|
3188
|
-
return [${K}];
|
|
3189
|
-
}
|
|
3190
|
-
|
|
3191
|
-
attributeChangedCallback(name, oldValue, newValue) {
|
|
3192
|
-
if (oldValue !== newValue) {
|
|
3193
|
-
this._render();
|
|
3194
|
-
}
|
|
3195
|
-
}
|
|
3196
|
-
${W}
|
|
3197
|
-
|
|
3198
|
-
_render() {
|
|
3199
|
-
const template = \`${q?`<style>${q}</style>`:""}${z}\`;
|
|
3200
|
-
|
|
3201
|
-
// Interpolate {{ prop }} with attribute values
|
|
3202
|
-
const rendered = template.replace(/\\{\\{\\s*(\\w+)\\s*\\}\\}/g, (match, prop) => {
|
|
3203
|
-
return this.getAttribute(prop) || '';
|
|
3204
|
-
});
|
|
3205
|
-
|
|
3206
|
-
${Y?"this.shadowRoot.innerHTML = rendered;":"this.innerHTML = rendered;"}
|
|
3207
|
-
}
|
|
3208
|
-
|
|
3209
|
-
connectedCallback() {
|
|
3210
|
-
this._render();
|
|
3211
|
-
}
|
|
3212
|
-
}
|
|
3213
|
-
|
|
3214
|
-
customElements.define('${Z}', ${G});
|
|
3215
|
-
`}async function s3($,Z,J,X){if(Z.length<1)return G0("WebComponent","@webcomponent directive requires at least the tag name parameter",Q0.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),G=(J.__stx_options||{}).componentsDir||"components",z=g0.isAbsolute(G)?[g0.join(G,`${Q}.stx`),g0.join(g0.dirname(X),`${Q}.stx`)]:[g0.join(g0.dirname(X),G,`${Q}.stx`),g0.join(process.cwd(),G,`${Q}.stx`),g0.join(g0.dirname(X),`${Q}.stx`)],q=null;for(let U of z)if(await s(U)){q=await Bun.file(U).text();break}if(!q)return G0("WebComponent",`Component file not found: ${Q}.stx`,Q0.FILE_NOT_FOUND);let K=LJ(q,Q);return`<script type="module">
|
|
3216
|
-
${OJ(K)}
|
|
3217
|
-
</script>`}var Y7={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:$7,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:N3,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:s3,hasEndTag:!1,description:"Include a web component in the template"},t3,e3,J5,X5,g9,u9,d9,h9,F3,q3,v3,Z5,...X7],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 wJ($,Z,J){let X=Z||"pages";if($)return{root:$,pagesDir:X};let Q=J||process.cwd(),Y=E0.join(Q,"resources","views"),G=E0.join(Q,"resources","layouts");if(c2.existsSync(Y)&&c2.existsSync(G))return{root:"resources",pagesDir:"views"};let z=E0.join(Q,"resources","views","pages");if(c2.existsSync(z))return{root:"resources/views",pagesDir:X};return{root:".",pagesDir:X}}var r3=new Set,p2=["partialsDir","componentsDir","layoutsDir"],G5=new WeakMap;function RJ($,Z){let J=Z.replace(/[\\/]+$/,"");if(!J||J===".")return!0;let X=$.replace(/\\/g,"/"),Q=J.replace(/\\/g,"/");return X===Q||X.startsWith(`${Q}/`)}function DJ($,Z){let J=!$.root,X=wJ($.root,$.pagesDir,Z);if($.root=X.root,$.pagesDir=X.pagesDir,J&&X.root!=="."){let Q=`${Z}::${X.root}`;if(!r3.has(Q))r3.add(Q),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(!G5.has($)){let Q={};for(let Y of p2){let G=$[Y];if(typeof G==="string"&&G)Q[Y]=G}G5.set($,Q)}if($.root&&$.root!=="."){let Q=$.root;for(let Y of p2){let G=$[Y];if(typeof G!=="string"||!G)continue;if(E0.isAbsolute(G)||RJ(G,Q))continue;$[Y]=E0.join(Q,G)}}for(let Q of p2){let Y=$[Q];if(typeof Y!=="string"||!Y||E0.isAbsolute(Y))continue;$[Q]=E0.resolve(Z,Y)}return $}function NJ($,Z){let J=G5.get($);for(let X of p2){let Q=$[X];if(typeof Q!=="string"||!Q)continue;let Y=E0.isAbsolute(Q)?Q:E0.join(Z,Q);if(c2.existsSync(Y))continue;let G=J?.[X]??Q,z=$.root,q=!!z&&z!==".";console.warn(`[stx] ${String(X)} resolves to "${Y}", which does not exist. Configured as "${G}"`+(q?`, resolved under root "${z}".`:"."))}}function AJ($){if($.customDirectives)$.customDirectives=[...$.customDirectives];if($.middleware)$.middleware=[...$.middleware];if($.apiRoutes)$.apiRoutes={...$.apiRoutes}}function MJ($){if(Z7($.stateDir),$.stateDir=J7(),$.cachePath=K2($.cachePath),$.build)$.build.cacheDir=K2($.build.cacheDir);if($.media?.cache)$.media.cache.directory=K2($.media.cache.directory);if($.story)$.story.outDir=K2($.story.outDir)}var P1=null,a3=new Map,i2=null;async function z5($){if(!$){if(P1)return P1;if(i2)return i2}let Z=$?E0.resolve($):process.cwd(),J=a3.get(Z);if(J)return J;let X=(async()=>{let Y=(await FJ({name:"stx",alias:"ui",cwd:Z,defaultConfig:Y7,verbose:!1})).config;if(AJ(Y),MJ(Y),DJ(Y,Z),NJ(Y,Z),Y.plugins&&Y.plugins.length>0){let{pluginManager:G}=await import("./chunk-cratkhhb.js"),z=[],q=[];for(let K of Y.plugins){let W=typeof K==="string"?K:K[0],U=typeof K==="string"?{}:K[1]||{};try{let H,j;try{H=await import(W),j=E0.dirname(u.resolve(W))}catch{let _=E0.resolve(process.cwd(),W);H=await import(_),j=E0.dirname(_)}let B=H.default||H;if(!G.has(B.name))await G.register(B,Y);if(B.components){let _=Array.isArray(B.components)?B.components:[B.components];for(let F of _)z.push(E0.resolve(j,F))}if(B.pages){let _=E0.resolve(j,B.pages),F=U.path||"/";q.push({dir:_,prefix:F})}if(B.setup){let _={addDirective:(F)=>{Y.customDirectives=Y.customDirectives||[],Y.customDirectives.push(F)},addRoute:(F,L)=>{Y.apiRoutes=Y.apiRoutes||{},Y.apiRoutes[F]=L},addMiddleware:(F)=>{Y.middleware=Y.middleware||[],Y.middleware.push(F)},pluginDir:j,config:Y};await B.setup(U,_)}console.log(`[stx] Plugin loaded: ${B.name||W}`)}catch(H){console.warn(`[stx] Failed to load plugin ${W}:`,H.message)}}Y._pluginComponentDirs=z,Y._pluginPageDirs=q}return Y})();if(a3.set(Z,X),!$)i2=X,X.then((Q)=>{P1=Q}).catch(()=>{});return X}var Q7=new Proxy(Y7,{get($,Z){if(P1&&Z in P1)return P1[Z];if(!i2)z5().catch((J)=>{console.warn("[stx] Failed to load config file:",J?.message||J)});return $[Z]}});function FK($){return $}function wK($){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,Q)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`customDirectives[${Q}].name`,message:"Custom directive must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`customDirectives[${Q}].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,Q)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`middleware[${Q}].name`,message:"Middleware must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`middleware[${Q}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!X.timing||!["before","after"].includes(X.timing))Z.push({path:`middleware[${Q}].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((Q,Y)=>{if(!Q.pattern||typeof Q.pattern!=="string")Z.push({path:`pwa.routes[${Y}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!X.includes(Q.strategy))Z.push({path:`pwa.routes[${Y}].strategy`,message:`PWA route strategy must be one of: ${X.join(", ")}`,severity:"error"});if(Q.maxAgeSeconds!==void 0&&(typeof Q.maxAgeSeconds!=="number"||Q.maxAgeSeconds<0))Z.push({path:`pwa.routes[${Y}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Q.maxEntries!==void 0&&(typeof Q.maxEntries!=="number"||Q.maxEntries<1))Z.push({path:`pwa.routes[${Y}].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((Q)=>typeof Q!=="number"||Q<16||Q>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((Y)=>!X.includes(Y)).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 K5=new Map;async function TJ($,Z={}){try{if(!await s($))throw Error(`Markdown file not found: ${$}`);let X=(await kJ.promises.stat($)).mtime.getTime();if(Z.cache&&K5.has($)){let U=K5.get($);if(U.updatedAt>=X)return{content:U.content,data:U.data}}let Q=await Bun.file($).text(),{data:Y,content:G}=R3(Q),z=Z.markdown||Q7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},K=G2(G,{gfm:!0});if(z.syntaxHighlighting?.enabled&&z.syntaxHighlighting?.serverSide)K=await EJ(K,z.syntaxHighlighting?.defaultTheme||"github-dark",z.syntaxHighlighting?.highlightUnknownLanguages||!1);let W={content:K,data:Y||{}};if(Z.cache)K5.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:H0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}var n2=null;async function EJ($,Z,J){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!n2)try{n2=await IJ({theme:Z||"github-dark",cache:!0})}catch(z){return console.error("Failed to initialize ts-syntax-highlighter:",z),$}let Q=async(z,q,K,W)=>{let U=W.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),H=K||(J?"text":"");if(!H)return z;try{if(!n2.getSupportedLanguages().includes(H))return z;return(await n2.highlight(U,H,{theme:Z})).html}catch(j){console.error(`Error highlighting code block with language ${K}:`,j)}return z},Y=$,G=$.matchAll(X);for(let z of G){let[q,K,W,U]=z,H=await Q(q,K,W,U);Y=Y.replace(q,H)}return Y}async function G7($,Z,J="",X={}){return await bJ($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,z,q,K)=>{try{let W=z;if(!q5.isAbsolute(z))W=q5.resolve(q5.dirname(J),z);let U={};if(q)try{try{U=JSON.parse(q)}catch{if(X.debug)console.warn("Using safer alternative for parsing JS object literal");let O=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let V of O){let w=V.indexOf(":");if(w>0){let R=V.substring(0,w).trim(),D=V.substring(w+1).trim(),A=D.startsWith('"')&&D.endsWith('"'),I=D.startsWith("'")&&D.endsWith("'");if(A||I)D=D.substring(1,D.length-1);U[R]=D}}}}catch(L){if(X.debug)console.error("Error parsing context in @markdown-file directive:",L)}let{content:H,data:j}=await TJ(W,X),B={...Z,...j,...U},_=H,F=/\{\{([^}]+)\}\}/g;return _=_.replace(F,(L,O)=>{let V=O.trim();return B[V]!==void 0?String(B[V]):L}),_}catch(W){let U=W instanceof Error?W.message:String(W);return H0("Markdown File",`Error including markdown file: ${U}`,J,$,K,G)}})}async function bJ($,Z,J){let X=[],Q;while((Q=Z.exec($))!==null){let z=Q[0],q=Q.index,K=Q;X.push(J(...K).then((W)=>({match:z,replacement:W,index:q})))}let Y=await Promise.all(X);Y.sort((z,q)=>q.index-z.index);let G=$;for(let{match:z,replacement:q}of Y)G=G.replace(z,()=>q);return G}function z1($,Z){try{let J=$.trim();if(q0(J))return W0(J,Object.keys(Z))(...Object.values(Z));else return $0(J,Z)}catch{return!1}}class o2{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 Q=["===","!==","==","!=","<=",">=","&&","||","??","++","--","+=","-=","*=","/=","%=","**","=>","?.","...","<<",">>",">>>","&=","|=","^="];for(let Y of Q)if(this.source.slice(this.pos,this.pos+Y.length)===Y)return this.advance(Y.length),{type:"OPERATOR",value:Y,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]!==`
|
|
3218
|
-
`)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 Q=this.source[this.pos];if(Q==="\\"){this.advance(2);continue}if(Q===$){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,Q=256;while(this.pos<this.source.length){let Y=this.source[this.pos];if(Y==="\\"){this.advance(2);continue}if(Y==="$"&&this.peek(1)==="{"){if(X>=Q){this.pos=this.source.length;break}this.advance(2),X++;continue}if(Y==="{"&&X>0){X++,this.advance();continue}if(Y==="}"&&X>0){X--,this.advance();continue}if(Y==="`"&&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]===`
|
|
3219
|
-
`)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 L0($,Z,J,X=0){let Q=0,Y=X,G=null,z=0,q=!1;while(Y<$.length){let K=$[Y];if(G&&q){q=!1,Y++;continue}if(G&&K==="\\"){q=!0,Y++;continue}if(q=!1,(K==='"'||K==="'"||K==="`")&&!G){G=K,Y++;continue}if(K===G&&G!=="`"){G=null,Y++;continue}if(G==="`"&&K==="$"&&$[Y+1]==="{"){z++,Y+=2;continue}if(z>0&&K==="}"){z--,Y++;continue}if(K==="`"&&G==="`"&&z===0){G=null,Y++;continue}if(G){Y++;continue}if(K===Z)Q++;else if(K===J){if(Q--,Q===0)return Y}Y++}return-1}function z7($,Z){let J=Z,X={paren:0,bracket:0,brace:0},Q=null,Y=0;while(J<$.length){let G=$[J];if((J>0?$[J-1]:"")==="\\"&&Q){J++;continue}if((G==='"'||G==="'")&&!Q){Q=G,J++;continue}if(G===Q&&Q!=="`"){Q=null,J++;continue}if(G==="`"&&!Q){Q="`",J++;continue}if(G==="`"&&Q==="`"&&Y===0){Q=null,J++;continue}if(Q==="`"&&G==="$"&&$[J+1]==="{"){Y++,J+=2;continue}if(Y>0){if(G==="{")Y++;else if(G==="}")Y--;J++;continue}if(Q){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 W5($){let Z=[],J="",X={paren:0,bracket:0,brace:0},Q=null,Y=0;for(let G=0;G<$.length;G++){let z=$[G];if((G>0?$[G-1]:"")==="\\"&&Q){J+=z;continue}if((z==='"'||z==="'")&&!Q){Q=z,J+=z;continue}if(z===Q&&Q!=="`"){Q=null,J+=z;continue}if(z==="`"&&!Q){Q="`",J+=z;continue}if(z==="`"&&Q==="`"&&Y===0){Q=null,J+=z;continue}if(Q==="`"&&z==="$"&&$[G+1]==="{"){Y++,J+=z+$[G+1],G++;continue}if(Y>0&&z==="{"){Y++,J+=z;continue}if(Y>0&&z==="}"){Y--,J+=z;continue}if(Q){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]==="\\"&&!Q){J=J.slice(0,-1)+z;continue}J+=z}if(J.trim())Z.push(J.trim());return Z}function q1($,Z){let J=yJ($,Z);return J.ok?{expression:J.expression,endPos:J.endPos}:null}function yJ($,Z){let J=Z;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return{ok:!1,reason:"missing-open-paren",pos:J};let X=L0($,"(",")",J);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:J};return{ok:!0,expression:$.slice(J+1,X),endPos:X+1}}function CJ($,Z){let J=$.lastIndexOf("<",Z);if(J===-1)return!1;return J>$.lastIndexOf(">",Z)}function O1($,Z,J,X){let Q=1,Y=X,G=new RegExp(`@${Z}\\s*\\(`,"g"),z=new RegExp(`@${J}(?![a-z])`,"g");while(Y<$.length&&Q>0){G.lastIndex=Y,z.lastIndex=Y;let q=G.exec($),K=z.exec($),W=q?q.index:1/0,U=K?K.index:1/0;if(W<U)Q++,Y=W+q[0].length;else if(U<1/0){if(Q--,Q===0)return U;Y=U+K[0].length}else break}return-1}function q7($,Z){let J=$.slice(Z).match(/^@if\s*/);if(!J)return null;let X=Z+J[0].length,Q=q1($,X);if(!Q)return null;let Y=Q.endPos,G=O1($,"if","endif",Y);if(G===-1)return null;let z=$.slice(Y,G),q=[],K=0,W="if",U=Q.expression,H=0,j=0;while(K<z.length){let B=z.indexOf("@",K);if(B===-1)break;K=B;let _=z.substring(B);if(CJ(z,B)){K++;continue}if(/^@if\s*\(/.test(_)){j++,K++;continue}if(/^@endif(?![a-z])/.test(_)){j--,K+=6;continue}if(j===0){let F=_.match(/^@elseif\s*/);if(F){q.push({type:W,condition:U,content:z.substring(H,K),start:Y+H,end:Y+K});let L=K+F[0].length,O=q1(z,L);if(!O){K++;continue}W="elseif",U=O.expression,K=O.endPos,H=K;continue}else if(/^@else(?![a-z])/.test(_)){q.push({type:W,condition:U,content:z.substring(H,K),start:Y+H,end:Y+K}),W="else",U=void 0,K+=5,H=K;continue}}K++}return q.push({type:W,condition:U,content:z.slice(H),start:Y+H,end:Y+z.length}),{fullMatch:$.slice(Z,G+6),branches:q,start:Z,end:G+6}}function W2($){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 Y=q7($,X.index);if(Y)Z.push(Y),J.lastIndex=Y.end;X=J.exec($)}return Z}function s2($,Z,J){let X=[],Q=new RegExp(`@${Z}\\s*\\(`,"g"),Y=Q.exec($);while(Y!==null){if(X.some((_)=>Y.index>_.start&&Y.index<_.end)){Y=Q.exec($);continue}let z=Y.index,q=z+Y[0].length-1,K=L0($,"(",")",q);if(K===-1){Y=Q.exec($);continue}let W=$.slice(q+1,K),U=K+1,H=O1($,Z,J,U);if(H===-1){Y=Q.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}),Q.lastIndex=B,Y=Q.exec($)}return X}function U5($,Z){let J=$.slice(Z).match(/^@switch\s*/);if(!J)return null;let X=Z+J[0].length,Q=q1($,X);if(!Q)return null;let Y=Q.endPos,G=O1($,"switch","endswitch",Y);if(G===-1)return null;let z=$.slice(Y,G),q=[],K=0,W=null,U=0;while(K<z.length){let H=z.slice(K),j=H.match(/^@switch\s*\(/),B=H.match(/^@endswitch(?![a-z])/);if(j){if(U++,W)W.content+=j[0];K+=j[0].length;continue}if(B){if(U--,W)W.content+=B[0];K+=B[0].length;continue}if(U>0){if(W)W.content+=z[K];K++;continue}let _=H.match(/^@case\s*/),F=H.match(/^@default(?![a-z])/),L=H.match(/^@break(?![a-z])/);if(_&&H.startsWith("@case")){if(W)q.push(W);let O=K+_[0].length,V=q1(z,O);if(!V){K++;continue}W={type:"case",value:V.expression,content:""},K=V.endPos}else if(F&&H.startsWith("@default")){if(W)q.push(W);W={type:"default",content:""},K+=F[0].length}else if(L&&H.startsWith("@break"))K+=L[0].length;else{if(W)W.content+=z[K];K++}}if(W)q.push(W);return{fullMatch:$.slice(Z,G+10),expression:Q.expression,cases:q,start:Z,end:G+10}}function SJ($){let Z=[],J=0;while(J<$.length){let X=$.indexOf("{{",J),Q=$.indexOf("{!!",J),Y=!1,G;if(X===-1&&Q===-1)break;else if(X===-1)G=Q,Y=!0;else if(Q===-1)G=X,Y=!1;else if(Q<X)G=Q,Y=!0;else G=X,Y=!1;if(!Y&&$.slice(G,G+3)==="{{{")Y=!0;let z=Y?$.slice(G,G+3)==="{{{"?"{{{":"{!!":"{{",q=Y?z==="{{{"?"}}}":"!!}":"}}",K=G+z.length,W=PJ($,K,q);if(W===-1){J=G+1;continue}let U=$.slice(K,W).trim(),H=W+q.length;Z.push({fullMatch:$.slice(G,H),expression:U,start:G,end:H,isRaw:Y}),J=H}return Z}function PJ($,Z,J){let X=Z,Q=null,Y={paren:0,bracket:0,brace:0},G=0;while(X<$.length){let z=$[X];if((X>0?$[X-1]:"")==="\\"&&Q){X++;continue}if((z==='"'||z==="'")&&!Q){Q=z,X++;continue}if(z===Q&&Q!=="`"){Q=null,X++;continue}if(z==="`"&&!Q){Q="`",X++;continue}if(z==="`"&&Q==="`"&&G===0){Q=null,X++;continue}if(Q==="`"&&z==="$"&&$[X+1]==="{"){G++,X+=2;continue}if(G>0){if(z==="{")G++;else if(z==="}")G--;X++;continue}if(Q){X++;continue}if(z==="(")Y.paren++;else if(z===")")Y.paren--;else if(z==="[")Y.bracket++;else if(z==="]")Y.bracket--;else if(z==="{")Y.brace++;else if(z==="}")Y.brace--;if(Y.paren===0&&Y.bracket===0&&Y.brace<=0){if($.slice(X,X+J.length)===J)return X}X++}return-1}function vJ($){let Z=W5($);if(Z.length===0)return{baseExpression:"",filters:[]};let J=Z[0],X=[];for(let Q=1;Q<Z.length;Q++){let Y=fJ(Z[Q]);if(Y)X.push(Y)}return{baseExpression:J,filters:X}}function fJ($){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(),Q=J+1,Y=L0(Z,"(",")",J);if(Y===-1)return{name:X,args:[]};let G=Z.slice(Q,Y),z=U7(G);return{name:X,args:z}}function U7($){let Z=[],J="",X={paren:0,bracket:0,brace:0},Q=null,Y=0;for(let G=0;G<$.length;G++){let z=$[G];if((G>0?$[G-1]:"")==="\\"&&Q){J+=z;continue}if((z==='"'||z==="'")&&!Q){Q=z,J+=z;continue}if(z===Q&&Q!=="`"){Q=null,J+=z;continue}if(z==="`"&&!Q){Q="`",J+=z;continue}if(z==="`"&&Q==="`"&&Y===0){Q=null,J+=z;continue}if(Q==="`"&&z==="$"&&$[G+1]==="{"){Y++,J+="${",G++;continue}if(Y>0&&z==="{"){Y++,J+=z;continue}if(Y>0&&z==="}"){Y--,J+=z;continue}if(Q){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 xJ($,Z){let J=Z;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return null;let X=L0($,"(",")",J);if(X===-1)return null;return{params:$.slice(J+1,X),endPos:X+1}}function gJ($){let Z=[],X=new o2($).tokenize().filter((Y)=>Y.type!=="WHITESPACE"&&Y.type!=="COMMENT"),Q=0;while(Q<X.length){let Y=X[Q],G=!1;if(Y.type==="IDENTIFIER"&&Y.value==="export"){if(G=!0,Q++,Q>=X.length)break}let z=X[Q];if(z.type==="IDENTIFIER"&&(z.value==="const"||z.value==="let"||z.value==="var")){let q=z.value;if(Q++,Q>=X.length)break;let K=X[Q];if(K.type==="IDENTIFIER"){let W=K.value;if(Q++,Q<X.length&&X[Q].type==="OPERATOR"&&X[Q].value==="="){Q++;let U=Q<X.length?X[Q].start:$.length,H=K7(X,Q,$);Q=H.nextIndex,Z.push({type:"variable",name:W,value:$.slice(U,H.endPos),exported:G,start:z.start,end:H.endPos})}}else if(K.type==="PUNCTUATION"&&(K.value==="{"||K.value==="[")){let W=K.start,U=K.value==="{"?"}":"]",H=L0($,K.value,U,W);if(H!==-1){let j=$.slice(W,H+1);if(Q=W7(X,H+1),Q<X.length&&X[Q].type==="OPERATOR"&&X[Q].value==="="){Q++;let B=Q<X.length?X[Q].start:$.length,_=K7(X,Q,$);Q=_.nextIndex;let F=`__stx_destructured_${Z.length}`;Z.push({type:"variable",name:F,value:`${$.slice(B,_.endPos)}; ${q} ${j} = ${F}`,exported:G,start:z.start,end:_.endPos})}}}}else if(z.type==="IDENTIFIER"&&z.value==="function"){let q=G?X[Q-1].start:z.start;if(Q++,Q>=X.length)break;let K=X[Q];if(K.type==="IDENTIFIER"){let W=K.value;Q++;let U=-1;while(Q<X.length){if(X[Q].type==="PUNCTUATION"&&X[Q].value==="{"){U=X[Q].start;break}Q++}if(U!==-1){let H=L0($,"{","}",U);if(H!==-1)Z.push({type:"function",name:W,value:$.slice(q,H+1).replace(/^export\s+/,""),exported:G,start:q,end:H+1}),Q=W7(X,H+1)}}}else Q++}return Z}function K7($,Z,J){let X=Z,Q={paren:0,bracket:0,brace:0},Y=Z<$.length?$[Z].start:J.length;while(X<$.length){let G=$[X];if(G.type==="PUNCTUATION"){if(G.value==="(")Q.paren++;else if(G.value===")")Q.paren--;else if(G.value==="[")Q.bracket++;else if(G.value==="]")Q.bracket--;else if(G.value==="{")Q.brace++;else if(G.value==="}")Q.brace--;if(G.value===";"&&Q.paren===0&&Q.bracket===0&&Q.brace===0){Y=G.start,X++;break}}if(G.type==="IDENTIFIER"&&(G.value==="const"||G.value==="let"||G.value==="var"||G.value==="function"||G.value==="export")){if(Q.paren===0&&Q.bracket===0&&Q.brace===0){Y=$[X-1]?.end??G.start;break}}Y=G.end,X++}return{nextIndex:X,endPos:Y}}function W7($,Z){for(let J=0;J<$.length;J++)if($[J].start>=Z)return J;return $.length}function hJ($,Z,J){let X=$,Q=!0;while(Q){Q=!1;let Y=X.match(/@switch\s*\(/);if(!Y||Y.index===void 0)break;let G=Y.index,z=U5(X,G);if(!z)break;try{let q;if(q0(z.expression))q=W0(z.expression,Object.keys(Z))(...Object.values(Z));else q=$0(z.expression,Z);let K="",W=!1;for(let U of z.cases)if(U.type==="default"){if(!W)K=U.content.trim()}else try{let H;if(U.value&&q0(U.value))H=W0(U.value,Object.keys(Z))(...Object.values(Z));else if(U.value)H=$0(U.value,Z);if(q===H){K=U.content.trim(),W=!0;break}}catch{continue}X=X.substring(0,G)+K+X.substring(z.end),Q=!0}catch(q){let K=q instanceof Error?q.message:String(q),W=G0("Switch",`Error evaluating @switch expression: ${K}`,Q0.EVALUATION_ERROR);X=X.substring(0,G)+W+X.substring(z.end);break}}return X}function uJ($){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 dJ($,Z){if(Z.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(J,X)=>Z[Number(X)]??J)}function $1($,Z,J){let{masked:X,scripts:Q}=uJ($);return dJ(mJ(X,Z,J),Q)}function mJ($,Z,J){let X=$;X=hJ(X,Z,J);{let Y=!0;while(Y){Y=!1;let G=X.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let z=G.index,q=q1(X,z+7);if(!q)break;let K=q.endPos,W=O1(X,"unless","endunless",K);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(K,W),H=q.expression,j=-1;{let _=0,F=/@(?:if|unless)\s*\(/g,L=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,V=[],w;while((w=F.exec(U))!==null)V.push({pos:w.index,type:"open"});while((w=L.exec(U))!==null)V.push({pos:w.index,type:"close"});while((w=O.exec(U))!==null)V.push({pos:w.index,type:"else"});V.sort((R,D)=>R.pos-D.pos);for(let R of V)if(R.type==="open")_++;else if(R.type==="close")_--;else if(R.type==="else"&&_===0){j=R.pos;break}}let B;if(j!==-1){let _=U.slice(0,j),F=U.slice(j+5);B=`@if (${H})${F}@else ${_}@endif`}else B=`@if (!(${H}))${U}@endif`;X=X.substring(0,z)+B+X.substring(W+10),Y=!0}}X=j5(X,Z,J),X=B5(X,Z,J),X=H5(X,Z);let Q=()=>{let Y=W2(X);if(Y.length===0)return!1;let G=Array(Y.length);for(let K=Y.length-1;K>=0;K--){let W=Y[K];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&&q0(j.condition))B=W0(j.condition,Object.keys(Z))(...Object.values(Z));else if(j.condition)B=$0(j.condition,Z);if(B)U=j.content,H=!0}catch(B){U=G0(j.type==="if"?"If":"Elseif",`Error in @${j.type}(${j.condition}): ${B instanceof Error?B.message:String(B)}`,Q0.EVALUATION_ERROR),H=!0}}G[K]=U}catch(U){let H=U instanceof Error?U.message:String(U);G[K]=G0("If",`Error processing @if block: ${H}`,Q0.EVALUATION_ERROR)}}let z=Array(Y.length*2+1),q=0;for(let K=0;K<Y.length;K++){let W=Y[K];z[K*2]=X.slice(q,W.start),z[K*2+1]=G[K],q=W.end}return z[Y.length*2]=X.slice(q),X=z.join(""),!0};while(!0){let Y=X;if(!Q())break;if(X===Y)break}return X}function H7($){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 Q=$[Z];if(Q==="\\"&&Z+1<$.length){X.push($[Z+1]),Z+=2;continue}if(Q===J){Z++;break}X.push(Q),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:X.join(""),consumed:Z}}function H5($,Z){let J=$;function X(z,q,K,W){let U=1,H=W,j=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${K}(?![a-z])`,"g");while(H<z.length&&U>0){j.lastIndex=H,B.lastIndex=H;let _=j.exec(z),F=B.exec(z),L=_?_.index:1/0,O=F?F.index:1/0;if(L<O)U++,H=L+_[0].length;else if(O<1/0){if(U--,U===0)return O;H=O+F[0].length}else break}return-1}function Q(z,q,K){let W=0,U=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),H=new RegExp(`@${K}(?![a-z])`,"g"),j=/@else(?![a-z])/g,B=[],_;while((_=U.exec(z))!==null)B.push({pos:_.index,type:"open"});while((_=H.exec(z))!==null)B.push({pos:_.index,type:"close"});while((_=j.exec(z))!==null)B.push({pos:_.index,type:"else"});B.sort((F,L)=>F.pos-L.pos);for(let F of B)if(F.type==="open")W++;else if(F.type==="close")W--;else if(F.type==="else"&&W===0)return F.pos;return-1}{let z=!0;while(z){z=!1;let q=J.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let K=q.index,W,U,H=J.slice(K+5),j=H7(H);if(j)W=j.value,U=K+5+j.consumed;else U=K+5;let B=X(J,"auth","endauth",U);if(B===-1){console.warn(`[stx] @auth directive at position ${K} has no matching @endauth \u2014 the block was skipped.`);break}let _=J.slice(U,B),F=Q(_,"auth","endauth"),L;if(!Z.auth)L=!1;else L=W?z1(`auth?.check && auth?.user?.[${W}]`,Z):z1("auth?.check",Z);let O;if(F!==-1){let V=_.slice(0,F),w=_.slice(F+5);O=L?V:w}else O=L?_:"";J=J.substring(0,K)+O+J.substring(B+8),z=!0}}{let z=!0;while(z){z=!1;let q=J.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let K=q.index,W,U,H=J.slice(K+6),j=H7(H);if(j)W=j.value,U=K+6+j.consumed;else U=K+6;let B=X(J,"guest","endguest",U);if(B===-1){console.warn(`[stx] @guest directive at position ${K} has no matching @endguest \u2014 the block was skipped.`);break}let _=J.slice(U,B),F=Q(_,"guest","endguest"),L;if(!Z.auth)L=!0;else L=W?z1(`!auth?.check || !auth?.user?.[${W}]`,Z):z1("!auth?.check",Z);let O;if(F!==-1){let V=_.slice(0,F),w=_.slice(F+5);O=L?V:w}else O=L?_:"";J=J.substring(0,K)+O+J.substring(B+9),z=!0}}function Y(z,q,K){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(q)W.push(q);if(K){let U=z1(K,Z);W.push(U)}return Z.permissions.check(...W)}catch{return!1}return!1}function G(z){let q=z.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!q)return null;return{ability:q[1],type:q[2],id:q[3]?.trim(),paramsEnd:q[0].length}}for(let z of["can","cannot"]){let q=`end${z}`,K=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 _=H+`@${z}`.length+B.paramsEnd,F=X(J,z,q,_);if(F===-1){console.warn(`[stx] @${z} directive at position ${H} has no matching @${q} \u2014 the block was skipped.`);break}let L=J.slice(_,F),O=[],V=0,w=new RegExp(`@${z}\\s*\\(`,"g"),R=new RegExp(`@${q}(?![a-z])`,"g"),D=new RegExp(`@${K}\\s*\\(`,"g"),A=/@else(?![a-z])/g,I=[],N;while((N=w.exec(L))!==null)I.push({pos:N.index,type:"open"});while((N=R.exec(L))!==null)I.push({pos:N.index,type:"close"});while((N=D.exec(L))!==null)I.push({pos:N.index,type:"elseDirective"});while((N=A.exec(L))!==null)I.push({pos:N.index,type:"else"});I.sort((b,C)=>b.pos-C.pos);for(let b of I){if(b.type==="open"){V++;continue}if(b.type==="close"){V--;continue}if(V===0)O.push(b)}let M=[],T=0;for(let b=0;b<O.length;b++){let C=O[b];if(M.push({content:L.slice(T,C.pos),ability:void 0}),C.type==="elseDirective"){let v=L.slice(C.pos+`@${K}`.length),P=G(v);if(P){M[M.length-1]={content:L.slice(T,C.pos)},T=C.pos+`@${K}`.length+P.paramsEnd,M.push({content:"",ability:P.ability,type:P.type,id:P.id}),M.pop();let g=O[b+1],f=g?g.pos:L.length;M.push({content:L.slice(T,f),ability:P.ability,type:P.type,id:P.id}),T=f}}else T=C.pos+5}if(T<L.length){let b=M[M.length-1];if(O.length>0&&O[O.length-1].type==="else")M.push({content:L.slice(T),isFinalElse:!0});else if(M.length===0)M.push({content:L.slice(T)})}let k=Y(B.ability,B.type,B.id),y=z==="can"?k:!k,E="";if(y)E=M[0]?.content||"";else{let b=!1;for(let C=1;C<M.length;C++){let v=M[C];if(v.isFinalElse){E=v.content,b=!0;break}if(v.ability){let P=Y(v.ability,v.type,v.id);if(z==="can"?P:!P){E=v.content,b=!0;break}}}if(!b&&M.length>0){let C=M[M.length-1];if(C.isFinalElse)E=C.content}}J=J.substring(0,H)+E+J.substring(F+`@${q}`.length),W=!0}}return J}function j5($,Z,J){let X=$;function Q(Y,G,z,q,K){let W=!0;while(W){W=!1;let U=new RegExp(`@${G}\\s*\\(`),H=Y.match(U);if(!H||H.index===void 0)break;let j=H.index,B=q1(Y,j+`@${G}`.length);if(!B)break;let _=B.endPos,F=O1(Y,G,z,_);if(F===-1){console.warn(`[stx] @${G} directive at position ${j} has no matching @${z} \u2014 the block was skipped.`);break}let L=Y.slice(_,F),O=B.expression,V=-1,w=0,R=0;while(R<L.length){let D=L.indexOf("@",R);if(D===-1)break;let A=L.substring(D);if(/^@(?:if|unless|isset|empty)\s*\(/.test(A)){w++,R=D+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(A)){w--,R=D+1;continue}if(w===0&&/^@else(?![a-z])/.test(A)){V=D;break}R=D+1}try{let D=q(O.trim()),A;if(V!==-1){let I=L.slice(0,V),N=L.slice(V+5);A=D?I:N}else A=D?L:"";Y=Y.substring(0,j)+A+Y.substring(F+`@${z}`.length),W=!0}catch(D){let A=D instanceof Error?D.message:String(D),I=G0(K,`Error processing @${G} directive: ${A}`,Q0.EVALUATION_ERROR);Y=Y.substring(0,j)+I+Y.substring(F+`@${z}`.length);break}}return Y}return X=Q(X,"isset","endisset",(Y)=>{let G=z1(Y,Z);return G!==void 0&&G!==null},"Isset"),X=Q(X,"empty","endempty",(Y)=>{let G=z1(Y,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 B5($,Z,J){let X=$,Q="development";function Y(G,z,q,K){let W=new RegExp(`@${z}(?![a-z])`,"g"),U=new RegExp(`@${q}(?![a-z])`,"g"),H=new RegExp(`^@${z}(?![a-z])`),j=new RegExp(`^@${q}(?![a-z])`),B=G,_=!0;while(_){_=!1,W.lastIndex=0;let F=W.exec(B);if(!F)break;let L=F.index,O=L+F[0].length;if(z==="env"){let k=B.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!k)break;O+=k[0].length,K=Q===k[2]}let V=1,w=O,R=-1;while(V>0&&w<B.length){W.lastIndex=w,U.lastIndex=w;let k=W.exec(B),y=U.exec(B),E=k?k.index:1/0,b=y?y.index:1/0;if(E<b)V++,w=E+k[0].length;else if(b<1/0){if(V--,V===0){R=b;break}w=b+y[0].length}else break}if(R===-1){console.warn(`[stx] @${z} directive at position ${L} has no matching @${q} \u2014 the block was skipped.`);break}let D=B.substring(O,R),A=-1,I=0,N=0;while(N<D.length){let k=D.indexOf("@",N);if(k===-1)break;let y=D.substring(k);if(H.test(y)){I++,N=k+1;continue}if(j.test(y)){I--,N=k+1;continue}if(I===0&&/^@else(?![a-z])/.test(y)){A=k;break}N=k+1}let M;if(A!==-1){let k=D.slice(0,A),y=D.slice(A+5);M=K?k:y}else M=K?D:"";let T=`@${q}`.length;B=B.substring(0,L)+M+B.substring(R+T),_=!0}return B}return X=Y(X,"env","endenv",!1),X=Y(X,"production","endproduction",Q==="production"),X=Y(X,"development","enddevelopment",Q==="development"),X=Y(X,"staging","endstaging",Q==="staging"),X=Y(X,"testing","endtesting",Q==="testing"),X}var _5=new WeakMap;function j7($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function F1($,Z){if(!$)return Z?.nonceGenerator?.()??j7();let J=_5.get($);if(!J)J=Z?.nonceGenerator?.()??j7(),_5.set($,J);return J}function nK($){_5.delete($)}function B7($,Z){let J=[];for(let[X,Q]of Object.entries($)){if(Q===void 0||Q===null)continue;if(typeof Q==="boolean"){if(Q)J.push(X);continue}if(Array.isArray(Q)){let Y=[...Q];if(Z&&(X==="script-src"||X==="style-src"))Y=Y.filter((G)=>!G.startsWith("'nonce-")),Y.push(`'nonce-${Z}'`);if(Y.length>0)J.push(`${X} ${Y.join(" ")}`)}}return J.join("; ")}function L5($,Z){return`<meta http-equiv="Content-Security-Policy" content="${B7($,Z).replace(/&/g,"&").replace(/"/g,""")}">`}var lJ={"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},V5={"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},cJ={"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'"]},pJ={"default-src":["'none'"],"frame-ancestors":["'none'"]};function oK($){return{enabled:!0,directives:{strict:lJ,moderate:V5,relaxed:cJ,api:pJ}[$]||V5,useNonce:$==="strict",addMetaTag:!0}}function sK($,Z){let J={...$};for(let[X,Q]of Object.entries(Z)){let Y=X,G=J[Y];if(Q===void 0||Q===null)continue;if(typeof Q==="boolean")J[Y]=G||Q;else if(Array.isArray(Q)){let z=Array.isArray(G)?G:[],q=[...new Set([...z,...Q])];J[Y]=q}}return J}function _7($,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?F1(J,Z):void 0,Q=L5(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
|
|
3220
|
-
${Q}`)}function V7($,Z){let J=$;return J=J.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(X,Q)=>{if(Q.includes("nonce="))return X;return`<script nonce="${Z}"${Q}>`}),J=J.replace(/<style([^>]*)>/gi,(X,Q)=>{if(Q.includes("nonce="))return X;return`<style nonce="${Z}"${Q}>`}),J}function L7($,Z,J,X){let Q=$,Y=X.csp;if(Q=Q.replace(/@csp\b/g,()=>{if(!Y?.enabled||!Y.directives)return"<!-- CSP not configured -->";let G=Y.useNonce?F1(Z,Y):void 0;return L5(Y.directives,G)}),Q=Q.replace(/@cspNonce\b/g,()=>{if(!Y?.enabled||!Y.useNonce)return"";return F1(Z,Y)}),Y?.enabled&&Y.useNonce)Z.cspNonce=F1(Z,Y);return Q}var iJ={name:"csp",handler:($,Z,J,X)=>{let Y=J.__stx_options?.csp;if(!Y?.enabled||!Y.directives)return"<!-- CSP not configured -->";let G=Y.useNonce?F1(J,Y):void 0;return L5(Y.directives,G)},hasEndTag:!1,description:"Insert Content-Security-Policy meta tag"},nJ={name:"cspNonce",handler:($,Z,J,X)=>{let Y=J.__stx_options?.csp;if(!Y?.enabled||!Y.useNonce)return"";return F1(J,Y)},hasEndTag:!1,description:"Output the current CSP nonce value"};function rK(){return[iJ,nJ]}function aK($){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 oJ($=!1){return $?"Content-Security-Policy-Report-Only":"Content-Security-Policy"}function tK($,Z){if(!$.enabled)return{};let J=$.useNonce?F1(Z,$):void 0,X=B7($.directives,J);return{[oJ($.reportOnly)]:X}}var eK={enabled:!1,reportOnly:!1,directives:V5,useNonce:!1,addMetaTag:!0};import sJ from"crypto";var rJ=40,O7="_token",O5=null;function aJ($=rJ){let Z=sJ.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return O5=Z,Z}function tJ(){if(!O5)aJ();return O5}function eJ($=O7){let Z=tJ();return`<input type="hidden" name="${$}" value="${Z}">`}function F7($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,J,X)=>{return eJ(X||O7)})}async function w7($,Z,J,X){if(!X.customDirectives||X.customDirectives.length===0)return $;let Q=$;for(let Y of X.customDirectives){if(!Y.name||typeof Y.handler!=="function"){if(X.debug)console.warn("Invalid custom directive:",Y);continue}if(Y.hasEndTag)Q=await $X(Q,Y,Z,J,X);else Q=await ZX(Q,Y,Z,J,X)}return Q}async function $X($,Z,J,X,Q){let{name:Y,handler:G}=Z,z=`@${Y}`,q=`@end${Y}`,K=$,W=v1(`${z}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),U=[],H=W.exec(K);while(H!==null){let[j,B="",_=""]=H,F=H.index||0;try{let L=B?R7(B):[],O=_.trim(),V=await G(O,L,J,X);U.push({original:j,processed:V,startIndex:F})}catch(L){let O=L instanceof Error?L.message:String(L);if(Q.debug)console.error(`Error processing custom directive @${Y}:`,L);U.push({original:j,processed:G0("CustomDirective",`Error in @${Y}${B?`(${B})`:""}: ${O}`,Q0.EVALUATION_ERROR),startIndex:F})}H=W.exec(K)}for(let j=U.length-1;j>=0;j--){let{original:B,processed:_}=U[j];K=K.replace(B,_)}return K}async function ZX($,Z,J,X,Q){let{name:Y,handler:G}=Z,z=$,q=v1(`@${Y}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),K=[],W=q.exec(z);while(W!==null){let[j,B=""]=W,_=W.index||0;try{let F=R7(B),L=await G("",F,J,X);K.push({original:j,processed:L,startIndex:_})}catch(F){let L=F instanceof Error?F.message:String(F);if(Q.debug)console.error(`Error processing custom directive @${Y}:`,F);K.push({original:j,processed:G0("CustomDirective",`Error in @${Y}(${B}): ${L}`,Q0.EVALUATION_ERROR),startIndex:_})}W=q.exec(z)}let U=v1(`@${Y}(?!\\w)(?!\\s*\\()`,"g"),H=U.exec(z);while(H!==null){let[j]=H,B=H.index||0;try{let _=await G("",[],J,X);K.push({original:j,processed:_,startIndex:B})}catch(_){let F=_ instanceof Error?_.message:String(_);if(Q.debug)console.error(`Error processing custom directive @${Y}:`,_);K.push({original:j,processed:G0("CustomDirective",`Error in @${Y}: ${F}`,Q0.EVALUATION_ERROR),startIndex:B})}H=U.exec(z)}for(let j=K.length-1;j>=0;j--){let{original:B,processed:_}=K[j];z=z.replace(B,_)}return z}function R7($){if(!$.trim())return[];let Z=[],J="",X=!1,Q="";for(let Y=0;Y<$.length;Y++){let G=$[Y];if((G==='"'||G==="'")&&(Y===0||$[Y-1]!=="\\"))if(!X)X=!0,Q=G;else if(G===Q)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((Y)=>{let G=Y.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var D7=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,N7=/^[A-Za-z_$][\w$]*$/,JX=new Set(["light","dark","system"]);function w1($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function XX($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,J=Z.appearance,X=Z.colorMode;if(w1(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(w1(J.key,"appearance.key"),w1(J.attribute,"appearance.attribute"),w1(J.default,"appearance.default"),w1(X.key,"colorMode.key"),w1(X.attribute,"colorMode.attribute"),w1(X.default,"colorMode.default"),!N7.test(J.key)||!N7.test(X.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!D7.test(J.attribute)||!D7.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((Q)=>typeof Q!=="string"||Q.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(!JX.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 YX($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function QX($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${YX($)};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 GX($,Z){let J=1,X=null,Q=!1;for(let Y=Z+1;Y<$.length;Y++){let G=$[Y];if(Q){Q=!1;continue}if(X){if(G==="\\")Q=!0;else if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="(")J++;else if(G===")"&&--J===0)return Y}return-1}function A7($,Z){let J=$,X=/@appearanceBootstrap\s*\(/g,Q;while((Q=X.exec(J))!==null){let Y=Q.index+Q[0].length-1,G=GX(J,Y);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let z=J.slice(Y+1,G).trim(),q=$0(`(${z})`,Z),K=QX(XX(q));J=J.slice(0,Q.index)+K+J.slice(G+1),X.lastIndex=Q.index+K.length}return J}import zX from"crypto";function O0($){return String($??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var w5={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function qX($){return{...w5,...$.forms?.classes}}function r2($,Z,J,X){let Q=$||Z;return J?`${Q} ${X}`:Q}function h0($){return String($).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function f1($,Z){if(/\bid\s*=/i.test($))return"";return` id="${O0(Z)}"`}function F5($,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="${O0(`${h0($)}-error`)}"`;return X}function KX(){return zX.randomUUID()}function WW($,Z,J,X){let Q=qX(X),Y=$;return Y=UX(Y,Z),Y=j2(Y,Z),Y=R5(Y,Z,Q),Y=D5(Y,Z,Q),Y}function j2($,Z){let J=$;return J=J.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let X=KX();Z.csrf={token:X}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${O0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),J=J.replace(/@method\(['"]([^'"]+)['"]\)/g,(X,Q)=>{let Y=Q.toUpperCase();if(Q&&!["GET","POST"].includes(Y))return`<input type="hidden" name="_method" value="${O0(Y)}">`;return X}),J}function R5($,Z,J=w5){let X=$;return X=X.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Q,Y,G,z,q,K="")=>{let W=Y||G||"POST",U=z||q||"",H=K1(K),j=W.toUpperCase(),B=["GET","POST"].includes(j)?j:"POST",_=`<form method="${O0(B)}" action="${O0(U)}"${H?` ${H}`:""}>`;if(_+=`
|
|
3221
|
-
${j2("@csrf",Z)}`,!["GET","POST"].includes(j))_+=`
|
|
3222
|
-
${j2(`@method('${j}')`,Z)}`;return _}),X=X.replace(/@endform/g,"</form>"),X=X.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Q,Y,G,z,q,K="")=>{let W=Y||G||"",U=z||q||"",H=K1(K),j=U2(W,Z),B=j!==void 0&&j!==null?j:U||"",_=H.match(/type=['"]([^'"]+)['"]/i),F=_?_[1]:"text",L=H2(W,Z),O=H.match(/class=['"]([^'"]+)['"]/i),V=r2(O?O[1]:"",J.input,L,J.inputError),w=H.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${O0(F)}" name="${O0(W)}"${f1(H,h0(W))} value="${O0(B)}" class="${V}"${F5(W,L,H)}${w?` ${w}`:""}>`}),X=X.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Q,Y,G="",z="")=>{let q=K1(G),K=U2(Y,Z)||z.trim(),W=H2(Y,Z),U=q.match(/class=['"]([^'"]+)['"]/i),H=r2(U?U[1]:"",J.input,W,J.inputError),j=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${O0(Y)}"${f1(q,h0(Y))} class="${H}"${F5(Y,W,q)}${j?` ${j}`:""}>${O0(K)}</textarea>`}),X=X.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Q,Y,G="",z)=>{let q=K1(G),K=U2(Y,Z),W=H2(Y,Z),U=q.match(/class=['"]([^'"]+)['"]/i),H=r2(U?U[1]:"",J.input,W,J.inputError),j=q.replace(/class=['"][^'"]+['"]/i,""),B=z;if(K!==void 0)B=z.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(_,F,L)=>{if((Array.isArray(K)?K.some((V)=>String(V)===L):String(K)===L)&&!F.includes("selected"))return F.replace(/(<option)/,"$1 selected");return _});return`<select name="${O0(Y)}"${f1(q,h0(Y))} class="${H}"${F5(Y,W,q)}${j?` ${j}`:""}>${B}</select>`}),X=X.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Q,Y,G,z="")=>{let q=G===void 0?"1":G,K=G===void 0?h0(Y):`${h0(Y)}-${h0(q)}`,W=K1(z),U=U2(Y,Z),H=U!==void 0&&(Array.isArray(U)?U.some((F)=>String(F)===q):U===!0||String(U)===q),j=W.match(/class=['"]([^'"]+)['"]/i),B=j?j[1]:J.checkInput,_=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${O0(Y)}"${f1(W,K)} value="${O0(q)}" class="${B}"${H?" checked":""}${_?` ${_}`:""}>`}),X=X.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,Y,G,z="")=>{let q=K1(z),K=U2(Y,Z),W=K!==void 0&&K===G,U=q.match(/class=['"]([^'"]+)['"]/i),H=U?U[1]:J.checkInput,j=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${O0(Y)}"${f1(q,`${h0(Y)}-${h0(G)}`)} value="${O0(G)}" class="${H}"${W?" checked":""}${j?` ${j}`:""}>`}),X=X.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,Y,G="")=>{let z=K1(G),q=z.match(/accept=['"]([^'"]+)['"]/i),K=q?q[1]:"",W=z.includes("multiple"),U=H2(Y,Z),H=z.match(/class=['"]([^'"]+)['"]/i),j=r2(H?H[1]:"",J.input,U,J.inputError),B=z.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),_=[`<input type="file" name="${O0(Y)}"${f1(z,h0(Y))}`,`class="${j}"`];if(K)_.push(`accept="${O0(K)}"`);if(W)_.push("multiple");if(B)_.push(B);return`${_.join(" ")}>`}),X=X.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Q,Y,G="",z)=>{let q=K1(G),K=q.match(/class=['"]([^'"]+)['"]/i),W=K?K[1]:J.label,U=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${O0(h0(Y))}" class="${W}"${U?` ${U}`:""}>${z}</label>`}),X}function D5($,Z,J=w5){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(X,Q,Y)=>{try{if(H2(Q,Z)){let G=Y.replace(/\{\{([^}]+)\}\}/g,(z,q)=>{try{if(q.trim()==="$message"||q.trim()==="message")return M7(Q,Z);if(q.trim().includes("errors.first")||q.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(Q);return M7(Q,Z)}let K=q.trim();if(q0(K)){let W=$0(K,Z);return W!==void 0?String(W):K}return K}catch{return q}});return`<div id="${O0(`${h0(Q)}-error`)}" role="alert">${G}</div>`}return""}catch(G){return console.error("Error processing @error directive:",G),X}})}function H2($,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 M7($,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 U2($,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,Q;while((Q=X.exec(J))!==null){let[,Y,,G]=Q;Z.push(`${Y}="${G.trim()}"`)}return Z.join(" ")}var k7={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($),Q=new Date(Z[0]);if(X>=Q)return`The ${J} field must be before ${Z[0]}.`;return null},after:($,Z,J)=>{if(!$)return null;let X=new Date($),Q=new Date(Z[0]);if(X<=Q)return`The ${J} field must be after ${Z[0]}.`;return null}};function UW($,Z){k7[$]=Z}function N5($){let[Z,...J]=$.split(":"),X=J.length>0?J.join(":").split(","):[];return{name:Z.trim(),params:X}}function WX($,Z,J,X={}){let Q=[],Y=J.split("|").map((G)=>G.trim()).filter(Boolean);for(let G of Y){let z=N5(G),q=k7[z.name];if(!q){console.warn(`Unknown validation rule: ${z.name}`);continue}if(z.name==="confirmed"){let W=`${$}_confirmation`;z.params=[X[W]]}let K=q(Z,z.params||[],$);if(K)Q.push(z.message||K)}return{field:$,valid:Q.length===0,errors:Q}}function HW($,Z){let J={};for(let[X,Q]of Object.entries(Z)){let Y=WX(X,$[X],Q,$);if(!Y.valid)J[X]=Y.errors}return J}function UX($,Z){return $.replace(/@validate\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]*)\})?\s*\)/g,(J,X,Q,Y)=>{let G=Q.split("|").map((q)=>q.trim()),z=[];for(let q of G){let K=N5(q);switch(K.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"'),K.name==="integer")z.push('step="1"');break;case"min":if(K.params?.[0])z.push(`minlength="${K.params[0]}"`);break;case"max":if(K.params?.[0])z.push(`maxlength="${K.params[0]}"`);break;case"regex":if(K.params?.[0])z.push(`pattern="${K.params[0]}"`);break}}return`<!-- @validate:${X}:${Q} -->${z.length>0?`<!-- attrs:${z.join(" ")} -->`:""}`})}var I7={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 Q of X)if(Q.endsWith("_confirmation")&&J[Q]===$)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 jW($){I7[$.name]=$}function HX($,Z,J={}){let X=[],Q=Z.split("|").map((Y)=>Y.trim());for(let Y of Q){let G=N5(Y),z=I7[G.name];if(!z){console.warn(`Unknown validation rule: ${G.name}`);continue}let q=z.validate($,G.params||[],J);if(q!==!0)X.push(q)}return{valid:X.length===0,errors:X}}function BW($,Z){let J={},X=!0;for(let[Q,Y]of Object.entries(Z)){let G=HX($[Q],Y,$);if(!G.valid)X=!1,J[Q]=G.errors}return{valid:X,errors:J}}function _W($,Z){let J=JSON.stringify(Z);return`
|
|
3223
|
-
<script>
|
|
3224
|
-
(function() {
|
|
3225
|
-
const form = document.getElementById('${$}');
|
|
3226
|
-
if (!form) return;
|
|
3227
|
-
|
|
3228
|
-
const rules = ${J};
|
|
3229
|
-
const validators = {
|
|
3230
|
-
required: (v) => v !== null && v !== undefined && v !== '' ? true : 'This field is required',
|
|
3231
|
-
email: (v) => !v || /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(v) ? true : 'Please enter a valid email',
|
|
3232
|
-
url: (v) => { if (!v) return true; try { new URL(v); return true; }
|
|
3233
|
-
catch { return 'Please enter a valid URL'; } },
|
|
3234
|
-
numeric: (v) => !v || !isNaN(Number(v)) ? true : 'Please enter a number',
|
|
3235
|
-
integer: (v) => !v || Number.isInteger(Number(v)) ? true : 'Please enter a whole number',
|
|
3236
|
-
min: (v, p) => !v || (typeof v === 'string' ? v.length >= p : v >= p) ? true : 'Too short/small',
|
|
3237
|
-
max: (v, p) => !v || (typeof v === 'string' ? v.length <= p : v <= p) ? true : 'Too long/large',
|
|
3238
|
-
regex: (v, p) => !v || new RegExp(p).test(v) ? true : 'Invalid format',
|
|
3239
|
-
};
|
|
3240
|
-
|
|
3241
|
-
form.addEventListener('submit', function(e) {
|
|
3242
|
-
let valid = true;
|
|
3243
|
-
const errors = {};
|
|
3244
|
-
|
|
3245
|
-
for (const [field, fieldRules] of Object.entries(rules)) {
|
|
3246
|
-
const input = form.querySelector('[name="' + field + '"]');
|
|
3247
|
-
if (!input) continue;
|
|
3248
|
-
|
|
3249
|
-
const value = input.value;
|
|
3250
|
-
const ruleList = fieldRules.split('|');
|
|
3251
|
-
|
|
3252
|
-
for (const rule of ruleList) {
|
|
3253
|
-
const [name, param] = rule.split(':');
|
|
3254
|
-
const validator = validators[name];
|
|
3255
|
-
if (validator) {
|
|
3256
|
-
const result = validator(value, param);
|
|
3257
|
-
if (result !== true) {
|
|
3258
|
-
valid = false;
|
|
3259
|
-
errors[field] = errors[field] || [];
|
|
3260
|
-
errors[field].push(result);
|
|
3261
|
-
input.classList.add('is-invalid');
|
|
3262
|
-
break;
|
|
3263
|
-
}
|
|
3264
|
-
}
|
|
3265
|
-
}
|
|
3266
|
-
}
|
|
3267
|
-
|
|
3268
|
-
if (!valid) {
|
|
3269
|
-
e.preventDefault();
|
|
3270
|
-
console.log('Validation errors:', errors);
|
|
3271
|
-
}
|
|
3272
|
-
});
|
|
3273
|
-
})();
|
|
3274
|
-
</script>`.trim()}var B2=/<\/?template\b[^>]*>/gi,jX=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function BX($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return jX.test(Z)}function a2($){B2.lastIndex=0;let Z;while((Z=B2.exec($))!==null){if(Z[0].startsWith("</")||BX(Z[0]))continue;let J=Z.index,X=B2.lastIndex,Q=1,Y;while((Y=B2.exec($))!==null)if(Y[0].startsWith("</")){if(Q--,Q===0){let G=Y.index;return{start:J,openEnd:X,closeStart:G,end:B2.lastIndex,content:$.slice(X,G)}}}else Q++;return null}return null}import U0 from"path";import u0 from"path";import A5 from"fs";function T7($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function E7($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class b7{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 Q=$.endsWith(".stx")?$.slice(0,-4):$,Y=X?.__importedComponents;if(Y){let j=[Q,Q.toLowerCase(),T7(Q),E7(Q)];for(let B of j)if(Y.has(B))return Y.get(B)}let G=[...new Set([`${Q}.stx`,`${T7(Q)}.stx`,`${E7(Q)}.stx`])];if(Q.startsWith("./")||Q.startsWith("../")){let j=u0.resolve(u0.dirname(Z),`${Q}.stx`);if(await s(j))return j;return null}let z=[],q=J.componentsDir||"",K=X?.__originalFilePath;if(K)z.push(u0.join(u0.dirname(K),"components"));if(q)z.push(q);let W=u0.join(u0.dirname(Z),"components");if(!z.includes(W))z.push(W);let U=process.cwd(),H=[u0.resolve(U,"src/components"),u0.resolve(U,"components"),u0.resolve(import.meta.dir,"components")];for(let j of H)if(!z.includes(j))z.push(j);for(let j of z){if(!j)continue;for(let B of G){let _=u0.join(j,B);if(await s(_))return _}try{if(!A5.statSync(j,{throwIfNoEntry:!1})?.isDirectory())continue;let _=A5.readdirSync(j,{withFileTypes:!0});for(let F of _)if(F.isDirectory()){let L=u0.join(j,F.name);for(let O of G){let V=u0.join(L,O);if(await s(V))return V}}}catch{}}return null}}var x1=new b7;function R0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var R1="\x00stx-boolean-attribute";function M5($){return $.indexOf("\x00")===-1?$:$.replace(/\0/g,"")}function g1($,Z){let J=[];for(let[X,Q]of Object.entries($.static)){if(Z.has(X))continue;let Y=$.staticNames?.[X]??X;if(typeof Q==="boolean"){if(Q)J.push(R0(Y));continue}if(Q===R1){J.push(R0(Y));continue}J.push(`${R0(Y)}="${R0(M5(String(Q)))}"`)}return J}function h1($,Z){let J=[];for(let[X,Q]of Object.entries($.serverDynamic??{})){if(Z.has(X))continue;if(Q===null||Q===void 0||Q===!1)continue;let Y=$.serverDynamicNames?.[X]??X;if(Q===!0){J.push(R0(Y));continue}if(typeof Q==="object")continue;J.push(`${R0(Y)}="${R0(M5(String(Q)))}"`)}return J}function _2($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function _X($){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 k5={name:"StxLink",aliases:["stx-link"],render($,Z,J){let X=_X($),Q=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),Y=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,q=[];if(X.reactive)q.push(`:href="${_2(X.value)}"`);else q.push(`href="${_2(X.value)}"`);if(Q)q.push(`class="${_2(Q)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${_2(Y)}"`),q.push(`data-stx-exact-active-class="${_2(G)}"`),z)q.push("data-stx-prefetch");let K=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return q.push(...g1($,K)),q.push(...h1($,K)),`<a ${q.join(" ")}>${Z}</a>`}};import d1 from"fs";import I5 from"path";var VX=new Set([".jpg",".jpeg",".png",".webp",".avif"]),W1=new Map,u1=!1;function y7($){if(!$)return;let Z=$.split("?")[0].split("#")[0];return W1.get(Z)}function yW(){return u1}function CW(){W1.clear(),u1=!1}function SW($,Z){W1.set($,Z),u1=!0}function LX($){let Z=0,J=0,X=0,Q=0;for(let G=0;G<$.length;G+=4)Z+=$[G],J+=$[G+1],X+=$[G+2],Q++;if(Q===0)return"#e5e7eb";let Y=(G)=>Math.round(G/Q).toString(16).padStart(2,"0");return`#${Y(Z)}${Y(J)}${Y(X)}`}function OX($,Z,J,X=4,Q=3){let Y=[];for(let G=0;G<Q;G++)for(let z=0;z<X;z++){let q=Math.floor(z*Z/X),K=Math.max(q+1,Math.floor((z+1)*Z/X)),W=Math.floor(G*J/Q),U=Math.max(W+1,Math.floor((G+1)*J/Q)),H=0,j=0,B=0,_=0;for(let L=W;L<U;L++)for(let O=q;O<K;O++){let V=(L*Z+O)*4;H+=$[V],j+=$[V+1],B+=$[V+2],_++}let F=(L)=>Math.round(L/_).toString(16).padStart(2,"0");Y.push(`<rect x="${z}" y="${G}" width="1" height="1" fill="#${F(H)}${F(j)}${F(B)}"/>`)}return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${X} ${Q}" preserveAspectRatio="none"><filter id="b"><feGaussianBlur stdDeviation=".6"/></filter><g filter="url(#b)">${Y.join("")}</g></svg>`}function FX($){return`data:image/svg+xml;base64,${Buffer.from($,"utf8").toString("base64")}`}function wX($){try{return JSON.parse(d1.readFileSync($,"utf8"))}catch{return{}}}function RX($,Z){try{d1.mkdirSync(I5.dirname($),{recursive:!0}),d1.writeFileSync($,JSON.stringify(Z))}catch{}}function C7($,Z,J=[]){let X;try{X=d1.readdirSync($,{withFileTypes:!0})}catch{return J}for(let Q of X){let Y=I5.join($,Q.name);if(Q.isDirectory()){C7(Y,`${Z}/${Q.name}`,J);continue}if(!VX.has(I5.extname(Q.name).toLowerCase()))continue;J.push([`${Z}/${Q.name}`,Y])}return J}async function PW($,Z={}){let{cachePath:J,maxBytes:X=33554432,limit:Q=2000}=Z;if(!$||!d1.existsSync($))return u1=!0,W1.size;let Y;try{Y=await import("ts-images")}catch{return u1=!0,W1.size}let G=J?wX(J):{},z=!1,q=C7($,"").slice(0,Q),K=8,W=async([U,H])=>{let j;try{j=d1.statSync(H)}catch{return}if(j.size>X)return;let B=G[U];if(B&&B.mtimeMs===j.mtimeMs&&B.size===j.size){W1.set(U,{dataUrl:B.dataUrl,color:B.color});return}try{let{hash:_}=await Y.generateThumbHash(H);if(!_)return;let{rgba:F,w:L,h:O}=Y.thumbHashToRGBA(_),V={dataUrl:FX(OX(F,L,O)),color:LX(F)};W1.set(U,V),G[U]={mtimeMs:j.mtimeMs,size:j.size,...V},z=!0}catch{}};for(let U=0;U<q.length;U+=K)await Promise.all(q.slice(U,U+K).map(W));if(J&&z)RX(J,G);return u1=!0,W1.size}var DX={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},T5=[320,640,768,1024,1280,1536,1920];function F0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function N0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}function t2($,Z,J=!1){let X=$.serverDynamic[Z];if(X!==void 0)return X!==!1&&X!=="false";let Q=$.static[Z];if(Q!==void 0)return Q!=="false"&&Q!==!1;return J}function NX($){let Z=(X)=>$.variants.filter((Q)=>Q.format===X).reduce((Q,Y)=>Q+Y.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,Q)=>X.bytes-Q.bytes).map(({format:X,srcset:Q})=>({format:X,srcset:Q}))}function E5($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),J=[];for(let X of Z)if(X.includes(":")){let[Q,Y]=X.split(":"),G=DX[Q];if(G)J.push(`(max-width: ${G}px) ${Y}`);else{let z=Number.parseInt(Q);if(!Number.isNaN(z))J.push(`(max-width: ${z}px) ${Y}`)}}else J.push(X);return J.join(", ")}function b5($,Z,J,X){return Z.map((Q)=>`${V2($,Q,void 0,J,X)} ${Q}w`).join(", ")}function AX($,Z,J,X,Q){return Z.map((Y)=>{let G=J?J*Y:void 0;return`${V2($,G,void 0,X,Q)} ${Y}x`}).join(", ")}function V2($,Z,J,X,Q){if(!X||X==="local"||X==="static")return $;if(X==="cloudinary"){let Y=[];if(Z)Y.push(`w_${Z}`);if(J)Y.push(`h_${J}`);if(Q)Y.push(`f_${Q}`);Y.push("q_auto");let G=Y.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(X==="imgix"){let Y=new URLSearchParams;if(Z)Y.set("w",String(Z));if(J)Y.set("h",String(J));if(Q)Y.set("fm",Q);Y.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${Y.toString()}`}if(X==="bunny"){let Y=new URLSearchParams;if(Z)Y.set("width",String(Z));if(J)Y.set("height",String(J));if(Q)Y.set("format",Q);let G=$.includes("?")?"&":"?";return`${$}${G}${Y.toString()}`}return $}function MX($,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 y5={name:"StxImage",aliases:["Image","stx-image","stx-img"],render($,Z,J){let X=N0($,"src")||"",Q=S7(X),Y=N0($,"alt")||"",G=N0($,"width")||(Q?String(Q.source.width):void 0),z=N0($,"height")||(Q?String(Q.source.height):void 0),q=N0($,"sizes"),K=N0($,"srcset"),W=N0($,"densities"),U=N0($,"format"),H=N0($,"placeholder")||(Q?"thumbhash":void 0),j=N0($,"placeholderColor")||"#e5e7eb",B=N0($,"provider"),_=N0($,"class")||N0($,"className")||"",F=N0($,"style")||"",L=N0($,"quality"),O=t2($,"lazy",!0),V=t2($,"preload",!1),w=t2($,"priority",!1),R=N0($,"loading"),D=N0($,"decoding")||"async",A=!!Q||t2($,"picture",!1)||!!U,I=G?Number.parseInt(G):void 0,N=z?Number.parseInt(z):void 0,M=K||"",T="";if(Q)M=Q.sources[Q.fallback.format]||"",T=q?E5(q):"100vw";else if(!M&&q&&B&&B!=="local"&&B!=="static")M=b5(X,T5,B,U),T=E5(q);else if(!M&&W){let g=W.split(/\s+/).map((f)=>Number.parseFloat(f.replace("x","")));M=AX(X,g,I,B,U)}else if(q)T=E5(q);let k=[];if(F)k.push(F);if(I&&N)k.push(`aspect-ratio:${I}/${N}`);if(H==="blur"||H==="color"||H==="thumbhash"){let g=Q?.placeholder?{dataUrl:Q.placeholder.dataUrl,color:j}:y7(X);if(g&&H==="color")k.push(`background-color:${g.color}`);else if(g)k.push(`background-color:${g.color}`),k.push(`background-image:url(${g.dataUrl})`),k.push("background-size:cover"),k.push("background-repeat:no-repeat");else{let f=MX(I||16,N||9,j);k.push(`background-image:url(${f})`),k.push("background-size:cover"),k.push("background-repeat:no-repeat")}}else if(H&&H!=="empty"&&H!=="none")k.push(`background-image:url(${F0(H)})`),k.push("background-size:cover"),k.push("background-repeat:no-repeat");let y=Q?.fallback.url||V2(X,I,N,B,U),E=[];if(E.push(`src="${F0(y)}"`),E.push(`alt="${F0(Y)}"`),G)E.push(`width="${F0(G)}"`);if(z)E.push(`height="${F0(z)}"`);let b=R||(w||V?"eager":O?"lazy":"");if(b)E.push(`loading="${F0(b)}"`);if(w)E.push('fetchpriority="high"');if(E.push(`decoding="${F0(D)}"`),_)E.push(`class="${F0(_)}"`);if(k.length>0)E.push(`style="${F0(k.join(";"))}"`);if(M)E.push(`srcset="${F0(M)}"`);if(T)E.push(`sizes="${F0(T)}"`);let C=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);E.push(...g1($,C)),E.push(...h1($,C));let v=`<img ${E.join(" ")} />`,P="";if(V){let f=U==="webp"?"image/webp":U==="avif"?"image/avif":"";P=`<link rel="preload" as="image" href="${F0(y)}"${f?` type="${f}"`:""}${M?` imagesrcset="${F0(M)}"`:""}${T?` imagesizes="${F0(T)}"`:""} />
|
|
3275
|
-
`}if(A){let g=[];if(Q)for(let f of NX(Q))g.push(`<source type="image/${f.format}" srcset="${F0(f.srcset)}"${T?` sizes="${F0(T)}"`:""} />`);if(!Q&&(U==="avif"||U==="auto")){let f=V2(X,I,N,B,"avif"),r=M?b5(X,T5,B,"avif"):`${f}`;g.push(`<source type="image/avif" srcset="${F0(r)}"${T?` sizes="${F0(T)}"`:""} />`)}if(!Q&&(U==="webp"||U==="auto")){let f=V2(X,I,N,B,"webp"),r=M?b5(X,T5,B,"webp"):`${f}`;g.push(`<source type="image/webp" srcset="${F0(r)}"${T?` sizes="${F0(T)}"`:""} />`)}return`${P}<picture>
|
|
3276
|
-
${g.join(`
|
|
3277
|
-
`)}
|
|
3278
|
-
${v}
|
|
3279
|
-
</picture>`}return`${P}${v}`}};var P7="/images/safe-image-default.svg";function L2($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function m1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}var kX=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${P7}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,C5={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,J){let X=m1($,"src")||"",Q=m1($,"alt")||"",Y=m1($,"fallback")||P7,G=m1($,"class")||m1($,"className")||"",z=m1($,"fallbackClassName")||"",q=[];if(q.push(`src="${L2(X)}"`),q.push(`alt="${L2(Q)}"`),G)q.push(`class="${L2(G)}"`);if(q.push(`data-fallback="${L2(Y)}"`),z)q.push(`data-fallback-class="${L2(z)}"`);q.push('onerror="window.__stxSafeImageHandler(this)"');let K=new Set(["src","alt","fallback","class","className","fallbackClassName"]);q.push(...g1($,K)),q.push(...h1($,K));let W=`<img ${q.join(" ")} />`,U=J.context;if(!U.__safeImageHandlerEmitted)return U.__safeImageHandlerEmitted=!0,`${kX}${W}`;return W}};function S5($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function O2($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}function e2($,Z,J){let X=O2($,Z);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return J}var P5={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,J){let X=S5(O2($,"color")||"#6366f1"),Q=S5(O2($,"initialColor")||O2($,"initial-color")||""),Y=S5(O2($,"height")||"3px"),G=e2($,"duration",2000),z=e2($,"throttle",200),q=e2($,"zIndex",999999)||e2($,"z-index",999999),K=Q?`linear-gradient(to right, ${Q}, ${X})`:X;return`
|
|
3280
|
-
<div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${Y};background:${K};z-index:${q};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
|
|
3281
|
-
<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>
|
|
3282
|
-
</div>
|
|
3283
|
-
<style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
|
|
3284
|
-
<script>
|
|
3285
|
-
(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()})})();
|
|
3286
|
-
</script>`}};function f7($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}function IX($,Z,J){let X=f7($,Z);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return J}var v7={"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%)"},v5={name:"StxToast",aliases:["stx-toast"],render($,Z,J){let X=R0(f7($,"position")||"top-right"),Q=IX($,"max",5),Y=v7[X]||v7["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${X}" data-stx-toast-max="${Q}" style="position:fixed;${Y};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
|
|
3287
|
-
<style>
|
|
3288
|
-
@keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
|
|
3289
|
-
@keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
|
|
3290
|
-
@keyframes stx-toast-in-left{from{opacity:0;transform:translateX(-100%)}to{opacity:1;transform:translateX(0)}}
|
|
3291
|
-
@keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
|
|
3292
|
-
@keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
|
|
3293
|
-
@keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
|
|
3294
|
-
</style>`}};function $9($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}var x7={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)"},f5={name:"StxModal",aliases:["stx-modal"],render($,Z,J){let X=$9($,"id");if(!X)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let Q=R0(X),Y=$9($,"size")||"md",G=$9($,"closeOnBackdrop")!=="false",z=$9($,"closeOnEscape")!=="false",q=x7[Y]||x7.md;return`<div id="stx-modal-${Q}" class="stx-modal-backdrop" data-stx-modal="${Q}" 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">
|
|
3295
|
-
<div class="stx-modal-panel" style="${q};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)">
|
|
3296
|
-
<div style="padding:1.5rem">${Z}</div>
|
|
3297
|
-
</div>
|
|
3298
|
-
</div>
|
|
3299
|
-
<style>
|
|
3300
|
-
@media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
|
|
3301
|
-
.stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
|
|
3302
|
-
.stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
|
|
3303
|
-
</style>`}};function l1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}var g7={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},x5={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,J){let X=l1($,"id");if(!X)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let Q=R0(X),Y=l1($,"side")||"right",G=l1($,"size")||"md",z=l1($,"closeOnBackdrop")!=="false",q=l1($,"closeOnEscape")!=="false",K=l1($,"overlay")!=="false",W=g7[G]||g7.md,U=Y==="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-${Q}" class="stx-drawer-backdrop" data-stx-drawer="${Q}" data-close-backdrop="${z}" data-close-escape="${q}" style="display:none;position:fixed;inset:0;z-index:99999;${K?"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">
|
|
3304
|
-
<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">
|
|
3305
|
-
<div style="padding:1.5rem">${Z}</div>
|
|
3306
|
-
</div>
|
|
3307
|
-
</div>
|
|
3308
|
-
<style>
|
|
3309
|
-
@media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
|
|
3310
|
-
.stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
|
|
3311
|
-
.stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
|
|
3312
|
-
</style>`}};import{existsSync as TX,readFileSync as EX}from"fs";var D1=new Map,h7=new Set;function u7($){if(h7.has($))return;h7.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function d7($){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(TX(J))return J;for(let J of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return u.resolve(J)}catch{}return null}function bX($){if(D1.has($))return D1.get($);let Z=d7($);if(!Z)return u7($),null;try{let J=JSON.parse(EX(Z,"utf8"));return D1.set($,J.icons),J.icons}catch{return null}}async function yX($,Z=!1){if(D1.has($))return D1.get($);let J=d7($);if(!J){if(!Z)u7($);return null}try{let X=await Bun.file(J).json();return D1.set($,X.icons),X.icons}catch{return null}}function c1($,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 g5={name:"Icon",aliases:["icon","stx-icon"],render($,Z,J){let X=c1($,"name")??c1($,"icon");if(!X)return"<!-- Icon: missing name/icon prop -->";let Q="lucide",Y=X;if(X.includes(":")){let O=X.split(":");Q=O[0],Y=O[1]}let G=R0(c1($,"size")||"24"),z=R0(c1($,"color")||"currentColor"),q=R0(c1($,"class")||""),K=R0(c1($,"style")||""),W=D1.get(Q)??bX(Q);if(!W)return`<!-- Icon: collection "${Q}" not loaded -->`;let U=W[Y];if(!U)return`<!-- Icon: "${Y}" not found in ${Q} -->`;let H=U.width||24,j=U.height||24,B=`0 0 ${H} ${j}`,_=U.body;if(z!=="currentColor")_=_.replace(/currentColor/g,z);let F=q?` class="${q}"`:"",L=K?` style="${K}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${B}" fill="none"${F}${L}>${_}</svg>`}};async function CX($="lucide",Z={}){await yX($,Z.speculative??!0)}function h5(){return`
|
|
3313
|
-
(function(){
|
|
3314
|
-
var tip=null,hideTimer=null,currentEl=null;
|
|
3315
|
-
|
|
3316
|
-
function createTip(){
|
|
3317
|
-
tip=document.createElement("div");
|
|
3318
|
-
tip.id="stx-tooltip";
|
|
3319
|
-
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)";
|
|
3320
|
-
var arrow=document.createElement("div");
|
|
3321
|
-
arrow.className="stx-tip-arrow";
|
|
3322
|
-
arrow.style.cssText="position:absolute;width:0;height:0;border:5px solid transparent";
|
|
3323
|
-
tip.appendChild(arrow);
|
|
3324
|
-
var text=document.createElement("span");
|
|
3325
|
-
text.className="stx-tip-text";
|
|
3326
|
-
tip.appendChild(text);
|
|
3327
|
-
document.body.appendChild(tip);
|
|
3328
|
-
}
|
|
3329
|
-
|
|
3330
|
-
function position(el){
|
|
3331
|
-
var pos=el.getAttribute("x-tooltip-position")||"top";
|
|
3332
|
-
var r=el.getBoundingClientRect();
|
|
3333
|
-
var sy=window.scrollY,sx=window.scrollX;
|
|
3334
|
-
tip.style.display="block";
|
|
3335
|
-
tip.style.opacity="0";
|
|
3336
|
-
// Force layout so we can measure
|
|
3337
|
-
var tw=tip.offsetWidth,th=tip.offsetHeight;
|
|
3338
|
-
var arrow=tip.querySelector(".stx-tip-arrow");
|
|
3339
|
-
var left,top;
|
|
3340
|
-
|
|
3341
|
-
if(pos==="top"){
|
|
3342
|
-
left=r.left+r.width/2-tw/2+sx;
|
|
3343
|
-
top=r.top-th-8+sy;
|
|
3344
|
-
if(top-sy<0){pos="bottom";}
|
|
3345
|
-
}
|
|
3346
|
-
if(pos==="bottom"){
|
|
3347
|
-
left=r.left+r.width/2-tw/2+sx;
|
|
3348
|
-
top=r.bottom+8+sy;
|
|
3349
|
-
arrow.style.cssText="position:absolute;width:0;height:0;border:5px solid transparent;border-bottom-color:#1f2937;top:-10px;left:50%;transform:translateX(-50%)";
|
|
3350
|
-
}
|
|
3351
|
-
if(pos==="left"){
|
|
3352
|
-
left=r.left-tw-8+sx;
|
|
3353
|
-
top=r.top+r.height/2-th/2+sy;
|
|
3354
|
-
if(left-sx<0){pos="right";}
|
|
3355
|
-
}
|
|
3356
|
-
if(pos==="right"){
|
|
3357
|
-
left=r.right+8+sx;
|
|
3358
|
-
top=r.top+r.height/2-th/2+sy;
|
|
3359
|
-
arrow.style.cssText="position:absolute;width:0;height:0;border:5px solid transparent;border-right-color:#1f2937;left:-10px;top:50%;transform:translateY(-50%)";
|
|
3360
|
-
}
|
|
3361
|
-
|
|
3362
|
-
// Set arrow for top/left after potential flips
|
|
3363
|
-
if(pos==="top"){
|
|
3364
|
-
arrow.style.cssText="position:absolute;width:0;height:0;border:5px solid transparent;border-top-color:#1f2937;bottom:-10px;left:50%;transform:translateX(-50%)";
|
|
3365
|
-
}
|
|
3366
|
-
if(pos==="left"){
|
|
3367
|
-
arrow.style.cssText="position:absolute;width:0;height:0;border:5px solid transparent;border-left-color:#1f2937;right:-10px;top:50%;transform:translateY(-50%)";
|
|
3368
|
-
}
|
|
3369
|
-
|
|
3370
|
-
// Clamp horizontal
|
|
3371
|
-
if(left<sx+4) left=sx+4;
|
|
3372
|
-
if(left+tw>sx+window.innerWidth-4) left=sx+window.innerWidth-tw-4;
|
|
3373
|
-
|
|
3374
|
-
tip.style.left=left+"px";
|
|
3375
|
-
tip.style.top=top+"px";
|
|
3376
|
-
tip.style.opacity="1";
|
|
3377
|
-
}
|
|
3378
|
-
|
|
3379
|
-
function showTip(el){
|
|
3380
|
-
if(hideTimer){clearTimeout(hideTimer);hideTimer=null;}
|
|
3381
|
-
if(!tip) createTip();
|
|
3382
|
-
var text=el.getAttribute("x-tooltip");
|
|
3383
|
-
if(!text) return;
|
|
3384
|
-
tip.querySelector(".stx-tip-text").textContent=text;
|
|
3385
|
-
currentEl=el;
|
|
3386
|
-
position(el);
|
|
3387
|
-
}
|
|
3388
|
-
|
|
3389
|
-
function hideTip(){
|
|
3390
|
-
if(!tip) return;
|
|
3391
|
-
tip.style.opacity="0";
|
|
3392
|
-
hideTimer=setTimeout(function(){
|
|
3393
|
-
if(tip) tip.style.display="none";
|
|
3394
|
-
currentEl=null;
|
|
3395
|
-
},150);
|
|
3396
|
-
}
|
|
3397
|
-
|
|
3398
|
-
document.addEventListener("mouseover",function(e){
|
|
3399
|
-
var el=e.target.closest("[x-tooltip]");
|
|
3400
|
-
if(el) showTip(el);
|
|
3401
|
-
});
|
|
3402
|
-
document.addEventListener("mouseout",function(e){
|
|
3403
|
-
var el=e.target.closest("[x-tooltip]");
|
|
3404
|
-
if(el&&el===currentEl) hideTip();
|
|
3405
|
-
});
|
|
3406
|
-
document.addEventListener("focusin",function(e){
|
|
3407
|
-
var el=e.target.closest("[x-tooltip]");
|
|
3408
|
-
if(el) showTip(el);
|
|
3409
|
-
});
|
|
3410
|
-
document.addEventListener("focusout",function(e){
|
|
3411
|
-
var el=e.target.closest("[x-tooltip]");
|
|
3412
|
-
if(el) hideTip();
|
|
3413
|
-
});
|
|
3414
|
-
})();
|
|
3415
|
-
`}function m7($,...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 l7($,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 u5={name:"Suspense",aliases:["suspense"],render($,Z,J){let X=l7(Z,"fallback"),Q=X.rest,Y=l7(Q,"error"),G=Y.rest,z=X.region??m7($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',q=Y.region??m7($,"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>${q}</div><div data-stx-suspense-content hidden>${G}</div></div>`}};function Z9($,...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 d5={name:"TransitionGroup",aliases:["transition-group"],render($,Z,J){let X=(Z9($,"name")||"v").replace(/["'<>]/g,""),Q=(Z9($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",Y=Z9($,"class"),G=Z9($,"id"),z=[`data-stx-transition-group="${X}"`,Y?`class="${Y}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${Q} ${z}>${Z}</${Q}>`}};function c7($=x1){$.registerBuiltin(k5),$.registerBuiltin(y5),$.registerBuiltin(C5),$.registerBuiltin(P5),$.registerBuiltin(v5),$.registerBuiltin(f5),$.registerBuiltin(x5),$.registerBuiltin(g5),$.registerBuiltin(u5),$.registerBuiltin(d5)}function J9($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var p7=new Map;function SX($){let Z=p7.get($.source);if(!Z)Z=new RegExp(`(${$.source})(?![\\w.:-])`,"y"),p7.set($.source,Z);return Z}var i7=new WeakMap;function m5($){let Z=i7.get($);if(!Z)Z=new Set([...$].map((X)=>X.toLowerCase())),i7.set($,Z);let J=Z;return(X)=>!/[a-z]/.test(X)&&J.has(X.toLowerCase())}function n7($,Z,J){let X=[],Q=0,Y=typeof J==="function"?J:J?(G)=>J.has(G.toLowerCase()):void 0;while(Q<$.length){let G=$.indexOf("<",Q);if(G===-1)break;let z=SX(Z);z.lastIndex=G+1;let q=z.exec($);if(!q){Q=G+1;continue}let K=q[1];if(Y&&Y(K)){let F=G+1+K.length;while(F<$.length&&$[F]!==">")F++;Q=F+1;continue}let W=G+1+K.length,U=null,H=W,j=-1,B=!1;while(W<$.length){let F=$[W];if(U){if(F==="\\"&&W+1<$.length){W+=2;continue}if(F===U)U=null;W++;continue}if(F==='"'||F==="'"){U=F,W++;continue}if(F==="/"&&W+1<$.length&&$[W+1]===">"){j=W+2,B=!0;break}if(F===">"){j=W+1;break}W++}if(j===-1){Q=G+1;continue}let _=$.slice(H,B?j-2:j-1).trim();if(B)X.push({fullMatch:$.slice(G,j),tagName:K,attributes:_,content:"",startIndex:G,endIndex:j,isSelfClosing:!0}),Q=j;else{let F=`<${K}`,L=`</${K}>`,O=1,V=j,w=-1;while(O>0&&V<$.length){let A=$.indexOf(F,V),I=$.indexOf(L,V);if(I===-1)break;if(A!==-1&&A<I){let N=$[A+F.length];if(N===" "||N===">"||N==="/"||N===`
|
|
3416
|
-
`||N==="\t")O++;V=A+F.length}else{if(O--,O===0){w=I;break}V=I+L.length}}if(w===-1){Q=j;continue}let R=$.slice(j,w),D=w+L.length;X.push({fullMatch:$.slice(G,D),tagName:K,attributes:_,content:R,startIndex:G,endIndex:D,isSelfClosing:!1}),Q=D}}return X}function o7($){return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�?39;/g,"'").replace(/'/gi,"'").replace(/&/g,"&")}function s7($,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 l5($,Z){let J=0,X="",Q=Z;while(Q<$.length){let Y=$[Q];if(X){if(Y==="\\")Q++;else if(Y===X)X=""}else if(Y==='"'||Y==="'"||Y==="`")X=Y;else if(Y==="{")J++;else if(Y==="}"){if(J--,J===0)return $.slice(Z,Q+1)}Q++}return $.slice(Z)}function r7($){let Z=$.trim();if(!Z.startsWith("{")||!Z.endsWith("}"))return null;if(l5(Z,0).length!==Z.length)return null;return Z.slice(1,-1).trim()}var PX=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),vX=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function c5($){let Z=[],J=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,X;while((X=J.exec($))!==null){let Q=X[2]||"";if(!/(?:^|\s)(?::for|x-for|v-for|@for)\s*=/.test(Q))continue;let Y=X.index,G=Y+X[0].length,z=X[1].toLowerCase();if(X[0].endsWith("/>")||vX.has(z)){Z.push([Y,G]);continue}let q=z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),K=new RegExp(`<\\/?${q}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");K.lastIndex=G;let W=1,U=G,H;while((H=K.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([Y,U])}return Z}function t7($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>t7(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function e7($,Z){if(!/:[\w-]+=/.test($))return $;let J=$,X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,Q=[],Y;while((Y=X.exec($))!==null)Q.push([Y.index,Y.index+Y[0].length]);Q.push(...c5($));function G(U){return Q.some(([H,j])=>U>=H&&U<j)}let z=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,q=[],K=new Map,W=256;while((Y=z.exec(J))!==null){if(G(Y.index))continue;let U=Y[0],H=Y[2];if(!H||!H.includes(":"))continue;let j=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,B,_=H,F=!1;while((B=j.exec(H))!==null){let L=B[1],O=B[2];if(a7(L))continue;if(O.includes("()")&&!O.includes(".get(")||O.includes("$store")||O.includes("$ref"))continue;try{let V=Object.keys(Z),w=Object.values(Z),R=O.match(/^([a-zA-Z_$][\w$]*)/);if(R&&!V.includes(R[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(R[1]))continue;let D=JSON.stringify([V,O]),A=K.get(D);if(!A){if(A=Function(...V,`return (${O})`),K.size>=W)K.clear();K.set(D,A)}let I=A(...w);if(L==="class"){let N=t7(I);if(N){let M=_.match(/\sclass="([^"]*)"/);if(M)_=_.replace(M[0],` class="${M[1]} ${N}"`);else _=_.replace(B[0],` class="${N}"`)}else _=_.replace(B[0],"");F=!0;continue}if(PX.has(L)){if(I)_=_.replace(B[0],` ${L}`);else _=_.replace(B[0],"");F=!0;continue}if(I===null||I===void 0||I===!1)_=_.replace(B[0],"");else{let N=String(I).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">");_=_.replace(B[0],` ${L}="${N}"`)}F=!0}catch{continue}}if(F){let L=U.endsWith("/>")?" /":"",V=`<${Y[1]}${_}${L}>`;q.push({start:Y.index,end:Y.index+U.length,replacement:V})}}if(q.length>0){let U=Array(q.length*2+1),H=0;for(let j=0;j<q.length;j++){let{start:B,end:_,replacement:F}=q[j];U[j*2]=J.slice(H,B),U[j*2+1]=F,H=_}U[q.length*2]=J.slice(H),J=U.join("")}return J}import Y9 from"fs";import v0 from"path";var $4=!1,Q9=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 Q4($){if($.includes("-")||$==="component")return!1;if(/^[A-Z]/.test($))return m5(Q9)($);return Q9.has($)||/[A-Z]/.test($)}function fX($,Z,J,X=!1){let Q={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},Y=new Set(Array.isArray(Z.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),G=(W)=>{if(Y.size===0)return!1;let U=x0(W),H=U.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(H&&Y.has(H))return!0;for(let j of Y){let B=j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${B}\\s*\\(`).test(U))return!0}return!1},z=new Set(Y4),q=(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())},K=(W,U)=>{let H=q(W);if(Q.static[H]=U,H!==W)Q.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("@")){Q.events[H]=U;continue}if(H.startsWith("__stx_")){let j=q(H.slice(6));Q.serverDynamic[j]=s7(U,J);continue}if(H.startsWith(":")){let j=q(H.slice(1)),B=U===R1?j:U;if(j==="if"||j==="for"||j==="show"){Q.clientReactive[j]=B;continue}if(X){Q.clientReactive[j]=B;continue}if(G(B)){Q.clientReactive[j]=B;continue}try{if(!q0(B)){if(J.debug)console.error(`Unsafe expression in :${j} binding: ${B}`);Q.clientReactive[j]=B;continue}let _=Object.keys(Z),L=W0(B,_)(...Object.values(Z));if(L===void 0){let O=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(G9(B).some((w)=>!O.has(w)&&!_.includes(w))){Q.clientReactive[j]=B;continue}}if(Q.serverDynamic[j]=L,j!==H.slice(1)&&Q.serverDynamicNames)Q.serverDynamicNames[j]=H.slice(1)}catch{Q.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(q0(B)){let F=W0(B,Object.keys(Z))(...Object.values(Z));K(H,F!=null?String(F):"")}else{if(J.debug)console.error(`Unsafe expression in ${H}: ${B}`);K(H,U)}}catch(B){if(J.debug)console.error(`Error evaluating expression for ${H}:`,B);K(H,U)}else{let B=U,_=/\{\{\s*([\s\S]+?)\s*\}\}/g,F;while((F=_.exec(U))!==null)try{let L=F[1];if(!q0(L)){if(J.debug)console.error(`Unsafe expression in ${H}: ${L}`);continue}let V=W0(L,Object.keys(Z))(...Object.values(Z));B=B.replace(F[0],String(V??""))}catch(L){if(J.debug)console.error(`Error evaluating expression in ${H}:`,L)}K(H,B)}continue}K(H,U===R1?"true":o7(U))}return Q}var xX=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function gX($,Z,J){if(!$.includes("@"))return $;if(!xX.some(([Q,Y])=>Q.test($)&&$.includes(Y)))return $;try{return $1($,Z,J)}catch{return $}}function hX($){let Z={},J=0,X=$.length;while(J<X){while(J<X&&/\s/.test($[J]))J++;if(J>=X)break;let Q="";while(J<X&&!/[\s=]/.test($[J]))Q+=$[J],J++;if(!Q)break;while(J<X&&/\s/.test($[J]))J++;if(J<X&&$[J]==="="){J++;while(J<X&&/\s/.test($[J]))J++;let Y="";if(J<X&&($[J]==='"'||$[J]==="'")){let G=$[J];J++;while(J<X){let z=$[J];if(z==="\\"&&J+1<X){J++,Y+=$[J],J++;continue}if(z===G){J++;break}Y+=z,J++}}else if($[J]==="{"){Y=l5($,J),J+=Y.length;let G=r7(Y);if(G!==null){Z[`:${Q}`]=G;continue}}else while(J<X&&!/\s/.test($[J]))Y+=$[J],J++;Z[Q]=Y}else Z[Q]=R1}return Z}function Z4($){return Object.entries($).map(([Z,J])=>J===R1?Z:`${Z}="${uX(J)}"`).join(" ")}function uX($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function dX($){let Z=new Set,J=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,X;while((X=J.exec($))!==null){let Q=X[1];if(x1.isBuiltin(Q))Z.add(Q)}return[...Z].sort()}var J4=new Map;function mX($){let Z=J4.get($);if(Z)return Z;let J=new Map,X=[v0.join($,"src"),v0.join($,"dist"),$];function Q(Y,G){if(G>6)return;let z;try{z=Y9.readdirSync(Y,{withFileTypes:!0})}catch{return}for(let q of z){let K=v0.join(Y,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;Q(K,G+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let W=q.name.slice(0,-4);if(!J.has(W))J.set(W,K);let U=W.toLowerCase();if(!J.has(U))J.set(U,K);let H=W.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!J.has(H))J.set(H,K)}}}for(let Y of X)if(Q(Y,0),J.size>0)break;return J4.set($,J),J}function lX($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let J=Z;while(!0){let X=v0.join(J,"node_modules",$);try{if(Y9.statSync(X).isDirectory())return X}catch{}let Q=v0.dirname(J);if(Q===J)return null;J=Q}}async function cX($,Z,J,X,Q){if(!/import\s/.test($))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Y=Z.__importedComponents,G=v0.dirname(J),z=[],q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let U of $.matchAll(q)){let[H,j,B]=U,_=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,F=B,L,O=[];while((L=_.exec(B))!==null){let[V,w,R,D]=L,A=null,I=null;if(D.startsWith(".")||D.startsWith("/")){let T=v0.resolve(G,D);if(T.endsWith(".stx"))I=T;else{let k=`${T}.stx`;try{if(Y9.statSync(k).isFile())I=k}catch{try{if(Y9.statSync(T).isDirectory())A=T}catch{}}}}else A=lX(D,G);if(!A&&!I)continue;let N=!1,M=(T,k)=>{Y.set(T,k),Y.set(T.toLowerCase(),k);let y=T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Y.set(y,k),Q.add(k)};if(R&&I)M(R,I),N=!0;else if(w){let T=w.slice(1,-1).split(",").map((y)=>y.trim()).filter(Boolean).map((y)=>{let E=y.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(E)return{source:E[1],local:E[2]};return{source:y,local:y}}),k=A?mX(A):null;for(let{source:y,local:E}of T){let b=null;if(I)b=I;else if(k)b=k.get(y)??k.get(y.toLowerCase())??k.get(y.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(b)M(E,b),N=!0}}if(N)O.push({start:L.index,end:L.index+V.length})}if(O.length===0)continue;for(let V=O.length-1;V>=0;V--)F=F.slice(0,O[V].start)+F.slice(O[V].end);z.push({start:U.index,end:U.index+H.length,value:`<script${j}>${F}</script>`})}if(z.length===0)return $;let K=[],W=0;for(let U of z)K.push($.slice(W,U.start),U.value),W=U.end;return K.push($.slice(W)),K.join("")}async function pX($,Z,J,X,Q){let Y=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,z=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=z.exec(Y))!==null){let[K,W]=q,U=W.split(",").map((H)=>H.trim().replace(/^['"]|['"]$/g,"")).filter((H)=>H.length>0);for(let H of U){let j=H.split("/"),_=j[j.length-1].replace(/\.stx$/,""),F=_.includes("-")?_.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):_.charAt(0).toUpperCase()+_.slice(1),L=null,O=[v0.resolve(v0.dirname(J),`${H}.stx`),v0.resolve(v0.dirname(J),H),v0.resolve(X.componentsDir||"components",`${H}.stx`),v0.resolve(X.componentsDir||"components",H),H.endsWith(".stx")?H:`${H}.stx`];for(let V of O)try{if(await Bun.file(V).exists()){L=V;break}}catch{}if(L){G.set(F,L),G.set(_,L),G.set(_.toLowerCase(),L);let V=F.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,L),Q.add(L),X.debug)console.log(`Imported component: ${F} -> ${L}`)}else if(X.debug)console.warn(`Could not resolve imported component: ${H}`)}Y=Y.replace(K,""),z.lastIndex=0}return Y}async function iX($,Z,J,X,Q){let Y=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let z=Z.__processedComponents,q=/@component\s*\(/g,K;while((K=q.exec(Y))!==null){let W=K.index,U=W+K[0].length-1,H=1,j=U+1;while(j<Y.length&&H>0){if(Y[j]==="(")H++;else if(Y[j]===")"){if(H--,H===0)break}j++}if(H!==0)break;let B=Y.substring(U+1,j),_=j+1,F=B.match(/^\s*['"]([^'"]+)['"]/);if(!F){q.lastIndex=0;continue}let L=F[1],O,V=B.slice(F[0].length),w=V.match(/^\s*,\s*/);if(w)O=V.slice(w[0].length).trim();let R={};if(O)try{R=T0(O,Z)}catch(T){let k=T instanceof Error?T.message:String(T);Y=Y.replace(Y.substring(W,_),`[Error parsing component props: ${k}]`);continue}let D="",A=_,N=Y.substring(_).match(/^([\s\S]*?)@endcomponent/);if(N)D=N[1].trim(),A=_+N[0].length;let M=await N1(L,R,D,G,Z,J,X,z,Q);Y=Y.substring(0,W)+M+Y.substring(A),q.lastIndex=0}return Y}async function nX($,Z,J,X,Q){if(!$)return $;let Y=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let z=Z.__processedComponents,q=p0(Y);Y=q.output;let K=c5(Y);return Y=await j(Y,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Y=await j(Y,/[A-Z][a-zA-Z0-9]*/,!0,m5(Q9)),Y=await j(Y,/[a-z][a-z0-9]*/,!1,Q9),Y=q.restore(Y),Y;async function j(B,_,F,L){if(!B)return B;let O=B,V=n7(O,_,L),w=new Map;for(let A=V.length-1;A>=0;A--){let I=V[A],N=F?J9(I.tagName):I.tagName,M=hX(gX(I.attributes,Z,J)),T=K.some(([P,g])=>I.startIndex>=P&&I.startIndex<g),k=fX(M,Z,X,T),y=x1.getBuiltin(I.tagName),E=y?await X9(N,G,Z,J,X):!1;if(y&&!E){let P={context:Z,filePath:J,options:X,dependencies:Q},g=y.render(k,I.content,P);if(Object.keys(k.events).length>0){let f=Z4(k.events);g=g.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${f}`)}if(Object.keys(k.clientReactive).length>0)g=X4(g,k.clientReactive);w.set(A,g);continue}if(!F&&I.tagName.includes("-")&&!await X9(N,G,Z,J,X))continue;let b={};for(let[P,g]of Object.entries(k.static))b[P]=g;for(let[P,g]of Object.entries(k.serverDynamic))b[P]=g;let v=await N1(N,b,q.restore(I.content),G,Z,J,X,z,Q);if(Object.keys(k.events).length>0){let P=G4(v);if(P){let g=Z4(k.events),f=Object.keys(k.events).map((r)=>r.replace(/^@/,"").split(".")[0]).join(" ");v=v.substring(0,P.insertPos)+` data-stx-parent-events="${f}" ${g}`+v.substring(P.insertPos)}}if(Object.keys(k.clientReactive).length>0)v=X4(v,k.clientReactive);w.set(A,v)}if(w.size===0)return O;let R="",D=0;for(let A=0;A<V.length;A++){let I=w.get(A);if(I===void 0)continue;R+=O.slice(D,V[A].startIndex),R+=I,D=V[A].endIndex}return R+=O.slice(D),R}}function X4($,Z){let J=new Set(["if","for"]),X=new Set(["show"]),Q=Object.entries(Z).filter(([W])=>!J.has(W)),Y=Q.filter(([W])=>!X.has(W)).map(([W])=>J9(W)).join(" "),G=$,z=Q.length>0?G4(G):null;if(z){let W=Q.map(([H,j])=>`:${J9(H)}="${j.replace(/"/g,""")}"`).join(" "),U=Y?` data-stx-parent-bindings="${Y}"`:"";G=G.substring(0,z.insertPos)+`${U} ${W}`+G.substring(z.insertPos)}let q=Z.if;if(q)G=`<template :if="${q.replace(/"/g,""")}">${G}</template>`;let K=Z.for;if(K)G=`<template :for="${K.replace(/"/g,""")}">${G}</template>`;return G}function G4($){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),Q=X.match(/^\s+/);if(Q){J+=Q[0].length;continue}if(X.startsWith("<!--")){let z=$.indexOf("-->",J+4);if(z===-1)return null;J=z+3;continue}let Y=X.match(/^<(script|style)\b[^>]*>/i);if(Y){let z=`</${Y[1].toLowerCase()}>`,q=$.toLowerCase().indexOf(z,J+Y[0].length);if(q===-1)return null;J=q+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 p5($,Z,J,X,Q){if(!$4)c7(x1),$4=!0;let Y=await cX($,Z,J,X,Q);Y=await pX(Y,Z,J,X,Q),Y=await iX(Y,Z,J,X,Q);let G=[];for(let z=0;z<3;z++){let q=G.length,K=_1(Y,z9,(U,H)=>`\x00STX_COMPONENT_COMMENT_${q+H}\x00`,`STX_COMPONENT_COMMENT:${q}`);G.push(...K.tokens);let W=Y;if(Y=await nX(K.output,Z,J,X,Q),Y===W)break}if(G.length>0)Y=Y.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(z,q)=>G[Number(q)]??"");if(X.debug){let z=dX(Y);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 Y}function i5($,Z){let J=0;for(let X=Z;X<$.length;X++){let Q=$[X];if(Q==="("||Q==="["||Q==="{")J++;else if(Q===")"||Q==="]"||Q==="}")J--;else if(Q===","&&J===0)return X}return-1}function oX($,Z,J){let X=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),Y=Q.exec(X);while(Y){let G=Y.index,z=G+Y[0].length-1,q=1,K=z+1;while(K<X.length&&q>0){if(X[K]==="(")q++;else if(X[K]===")")q--;K++}if(q!==0)break;let W=X.substring(z+1,K-1),U=`${J}(${W})`;X=X.substring(0,G)+U+X.substring(K),Q.lastIndex=G+U.length,Y=Q.exec(X)}return X}function sX($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function K4($){let Z=$,J=[],X=new Set,Q=0,Y=0,G=Z.length,z=(U)=>{Y++;while(Y<G){if(Z[Y]==="\\"){Y+=2;continue}if(Z[Y]===U){Y++;return}Y++}},q=()=>{Y++;while(Y<G){if(Z[Y]==="\\"){Y+=2;continue}if(Z[Y]==="`"){Y++;return}if(Z[Y]==="$"&&Z[Y+1]==="{"){Y+=2;let U=1;while(Y<G&&U>0)if(Z[Y]==="{")U++,Y++;else if(Z[Y]==="}")U--,Y++;else if(Z[Y]==="'"||Z[Y]==='"')z(Z[Y]);else if(Z[Y]==="`")q();else Y++;continue}Y++}},K=()=>{if(Z[Y]==="/"&&Z[Y+1]==="/"){while(Y<G&&Z[Y]!==`
|
|
3417
|
-
`)Y++;return!0}if(Z[Y]==="/"&&Z[Y+1]==="*"){Y+=2;while(Y<G-1&&!(Z[Y]==="*"&&Z[Y+1]==="/"))Y++;return Y+=2,!0}return!1},W=()=>{if(Q!==0)return;let U=Z.slice(Y).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(Y).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(Y).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(Y<G){if(K())continue;if(Z[Y]==="'"||Z[Y]==='"'){z(Z[Y]);continue}if(Z[Y]==="`"){q();continue}if(Z[Y]==="{"){Q++,Y++;continue}if(Z[Y]==="}"){Q--,Y++;continue}if(Q===0&&/[a-z]/i.test(Z[Y])&&(Y===0||/\s|[;{}()]/.test(Z[Y-1])))W();Y++}return J.join(", ")}function rX($,Z=""){let J=K4($).split(",").map((X)=>X.trim()).filter(Boolean);return`
|
|
3418
|
-
(function() {
|
|
3419
|
-
${p1("var",J)}
|
|
3420
|
-
var __destroyHooks = [];
|
|
3421
|
-
var __origOnDestroy = onDestroy;
|
|
3422
|
-
onDestroy = function(fn) { __origOnDestroy(fn); __destroyHooks.push(fn); };
|
|
3423
|
-
|
|
3424
|
-
${$}
|
|
3425
|
-
${Z}})();
|
|
3426
|
-
`}function aX($,Z){let Q=K4($).split(",").map((Y)=>Y.trim()).filter(Boolean).map((Y)=>` try { __scopeRegistration[${JSON.stringify(Y)}] = ${Y}; } catch (e) { /* not actually top-level */ }`).join(`
|
|
3427
|
-
`);return`
|
|
3428
|
-
// Register scope variables for STX runtime
|
|
3429
|
-
if (!window.stx._scopes) window.stx._scopes = {};
|
|
3430
|
-
var __scopeRegistration = window.stx._scopes['${Z}'] || { __destroyCallbacks: __destroyHooks };
|
|
3431
|
-
${Q}
|
|
3432
|
-
// #1767: when the bundler renamed a component const that collided with an
|
|
3433
|
-
// inlined import (foo -> foo2), rebind the ORIGINAL template name to the
|
|
3434
|
-
// renamed declaration so it resolves to the component's value, not the
|
|
3435
|
-
// shadowing import. __stxScopeRenames is emitted by bundleClientScript.
|
|
3436
|
-
try { if (typeof __stxScopeRenames !== 'undefined' && __stxScopeRenames) { for (var __stxRK in __stxScopeRenames) __scopeRegistration[__stxRK] = __stxScopeRenames[__stxRK]; } } catch (e) { /* no renames */ }
|
|
3437
|
-
window.stx._scopes['${Z}'] = __scopeRegistration;
|
|
3438
|
-
`}function tX($,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 z4($,Z){let J=aX($,Z);return eX(rX($,J),Z)}function eX($,Z){let J=`
|
|
3439
|
-
(function() {
|
|
3440
|
-
var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${Z}"]') : null;
|
|
3441
|
-
var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
|
|
3442
|
-
if (__stxScopeEl && typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxScopeEl;
|
|
3443
|
-
if (__stxScopeEl && typeof window !== 'undefined' && window.stx) {
|
|
3444
|
-
if (!window.stx._scopes) window.stx._scopes = {};
|
|
3445
|
-
window.stx._scopes['${Z}'] = {};
|
|
3446
|
-
}
|
|
3447
|
-
try {`,X=`
|
|
3448
|
-
} finally {
|
|
3449
|
-
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
3450
|
-
}
|
|
3451
|
-
})();`;return J+$+`
|
|
3452
|
-
} finally {
|
|
3453
|
-
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
3454
|
-
}
|
|
3455
|
-
})();`}function $Y($,Z){if(i0($)){let Q=i0($).tag.match(/data-stx-scope="([^"]*)"/);if(Q)return{html:$,mergedIntoExisting:Q[1],stamped:!0,root:"body"};return{html:b1($,(Y,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],Q=J[2].slice(1),Y=X.match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1],stamped:!0,root:Q};let G=J[1],z=J[2],q=J[3];return{html:`${G}${z} data-stx-scope="${Z}"${q}${$.slice(J[0].length)}`,mergedIntoExisting:null,stamped:!0,root:Q}}return{html:$,mergedIntoExisting:null,stamped:!1,root:null}}var q4=0,QH=new i1(500),W4=new Set;function GH(){W4.clear()}function ZY($){if($.__onceStore instanceof Set)return $.__onceStore;return W4}async function n5($,Z,J,X,Q,Y=new Set){let G=X.partialsDir||U0.join(U0.dirname(J),"partials");if(G&&!U0.isAbsolute(G))G=U0.resolve(process.cwd(),G);let z=oX($,"@partial","@include"),q=ZY(Z);z=z.replace(/@once([\s\S]*?)@endonce/g,(_,F,L)=>{let O=F.trim(),V=`${J}:${O}`;if(q.has(V))return"";return q.add(V),F});{let _=/@includeIf\s*\(/g,F;while((F=_.exec(z))!==null){let L=F.index,O=L+F[0].length-1,V=1,w=O+1;while(w<z.length&&V>0){if(z[w]==="(")V++;else if(z[w]===")")V--;w++}if(V!==0)break;let R=z.substring(O+1,w-1),D=R.match(/^\s*['"]([^'"]+)['"]/);if(!D){_.lastIndex=w;continue}let A=D[1],I=K(A,G,J),N="";if(I&&await Bun.file(I).exists())Q.add(I),N=`@include(${R})`;z=z.substring(0,L)+N+z.substring(w),_.lastIndex=0}}for(let[_,F]of[["@includeWhen",!1],["@includeUnless",!0]]){let L=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),O;while((O=L.exec(z))!==null){let V=O.index,w=V+O[0].length-1,R=1,D=w+1;while(D<z.length&&R>0){if(z[D]==="(")R++;else if(z[D]===")")R--;D++}if(R!==0)break;let A=z.substring(w+1,D-1),I=i5(A,0);if(I===-1){L.lastIndex=D;continue}let N=A.substring(0,I).trim(),M=A.substring(I+1).trim(),T=M.match(/^\s*['"]([^'"]+)['"]/);if(!T){L.lastIndex=D;continue}let k=T[1],y=M.substring(T[0].length),E,b=i5(y,0);if(b!==-1)E=y.substring(b+1).trim();try{let C=`Boolean(${N})`,v;if(q0(C)){let f=W0(C,Object.keys(Z));v=Boolean(f(...Object.values(Z)))}else v=Boolean($0(C,Z));let P=F?!v:v,g="";if(P){let f=K(k,G,J);if(f&&await Bun.file(f).exists())Q.add(f);g=`@include('${k}'${E?`, ${E}`:""})`}z=z.substring(0,V)+g+z.substring(D),L.lastIndex=0}catch(C){let v=C instanceof Error?C.message:String(C),P=H0("Include",`Error evaluating ${_} condition: ${v}`,J,$,V);z=z.substring(0,V)+P+z.substring(D),L.lastIndex=0}}}{let _=/@each\s*\(/g,F;while((F=_.exec(z))!==null){let L=F.index,O=L+F[0].length-1,V=1,w=O+1;while(w<z.length&&V>0){if(z[w]==="(")V++;else if(z[w]===")"){if(V--,V===0)break}w++}if(V!==0)break;let R=z.substring(O+1,w),D=z.substring(L,w+1),A=R.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!A){_.lastIndex=0,z=z.replace(D,"");continue}let[,I,N,M,T]=A;try{let k,y=N.trim();if(q0(y))k=W0(y,Object.keys(Z))(...Object.values(Z));else k=$0(y,Z);let E="";if(Array.isArray(k)&&k.length>0)for(let b of k){let C={...Z,[M]:b},v=await H(I,C,$,L);E+=v}else if(T)E=await H(T,{},$,L);z=z.substring(0,L)+E+z.substring(w+1),_.lastIndex=0}catch(k){let y=k instanceof Error?k.message:String(k);z=z.substring(0,L)+H0("Each",`Error in @each: ${y}`,J,$,L)+z.substring(w+1),_.lastIndex=0}}}{let _=/@includeFirst\s*\(/g,F;while((F=_.exec(z))!==null){let L=F.index,O=L+F[0].length-1,V=1,w=O+1;while(w<z.length&&V>0){if(z[w]==="(")V++;else if(z[w]===")"){if(V--,V===0)break}w++}if(V!==0)break;let R=z.substring(O+1,w),D=z.substring(L,w+1),A=R.match(/^\s*(\[[^\]]+\])/);if(!A){_.lastIndex=0,z=z.replace(D,"");continue}let I=A[1],N=R.slice(A[0].length),M,T=N.match(/^\s*,\s*\{/);if(T){N=N.slice(T[0].length-1);let E=1,b=1;while(b<N.length&&E>0){if(N[b]==="{")E++;else if(N[b]==="}"){if(E--,E===0)break}b++}M=N.substring(0,b+1),N=N.slice(b+1)}let k,y=N.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(y)k=y[1];try{let E=JSON.parse(I.replace(/'/g,'"')),b={};if(M)try{b=T0(M,Z)}catch(v){let P=v instanceof Error?v.message:String(v);if(X.debug){let g=H0("Include",`Error parsing includeFirst variables: ${P}`,J,$,L,D);z=z.replace(D,()=>g)}else z=z.replace(D,()=>k||"");continue}let C=!1;for(let v of E){let P=K(v,G,J);if(!P)continue;if(await s(P)){let g=await H(v,b,$,L);z=z.replace(D,()=>g),C=!0;break}}if(!C)if(k!==void 0)z=z.replace(D,()=>k);else if(X.debug){let v=H0("Include",`None of the includeFirst paths exist: ${I}`,J,$,L,D);z=z.replace(D,()=>v)}else z=z.replace(D,"")}catch(E){let b=E instanceof Error?E.message:String(E),C=H0("Include",`Error processing @includeFirst: ${b}`,J,$,L,D);z=z.replace(D,()=>C)}_.lastIndex=0}}function K(_,F,L){try{let O=_;if(!_.endsWith(".stx"))O=`${_}.stx`;let V=U0.resolve(F),w=U0.resolve(U0.dirname(L)),R;if(!O.startsWith("./")&&!O.startsWith("../"))R=U0.resolve(F,O);else R=U0.resolve(w,O);let D=U0.normalize(R),A=D.startsWith(V+U0.sep)||D===V,I=D.startsWith(w+U0.sep)||D===w,N=!1,M=U0.dirname(w);if(D.startsWith(M+U0.sep)){if(!U0.relative(M,D).split(U0.sep).some((E)=>E.startsWith(".")&&E!=="."&&E!==".."))N=!0}if(!A&&!I&&!N)return console.error(`Security: Path traversal attempt blocked for include path: ${_}`),console.error(` Resolved to: ${D}`),console.error(` Allowed dirs: ${V}, ${w}`),null;return D}catch(O){return console.error(`Error resolving path ${_}: ${O}`),null}}let W=U0.resolve(J);Y.add(W);function U(_,F,L,O){return X.onIncludeError?.({includePath:_,templatePath:J,message:F,partialsDir:G}),H0("Include",F,J,L,O)}async function H(_,F={},L,O){let V=K(_,G,J);if(!V)return U(_,`Could not resolve path for include: ${_}`,L,O);let w=U0.resolve(V);if(Y.has(w)){let R=[...Y,w].map((D)=>U0.basename(D)).join(" -> ");return U(_,`Circular include detected: ${R}`,L,O)}try{Q.add(V);let R;if(!R)try{R=await Bun.file(V).text()}catch(P){let g=P instanceof Error?P.message:String(P);return U(_,`Error loading include file ${_}: ${g}`,L,O)}if(R)R=R.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(R&&R.includes("@stream")){let{processStreamDirectives:P}=await import("./chunk-mzf6c0h7.js");R=P(R,Z)}if(R&&(X.debug||!q9()&&!K9()))try{let{warnUnbalancedTags:P}=await import("./chunk-mc4rtf5d.js");P(R,V)}catch{}let D=R;try{let{processESImports:P}=await import("./chunk-39qnycbc.js");await P(R,Z,V,X,Q)}catch(P){if(X.debug)console.warn(`[stx] partial ES import extraction skipped for ${V}:`,P instanceof Error?P.message:P)}let A=a2(D);if(A)D=A.content.trim();let N=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M="";if(N)M=`<style${N[1]}>${N[2]}</style>`;D=D.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),D=D.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let T={...Z};T.__stx_signals_gate=Y1(R,V);for(let[P,g]of Object.entries(F))T[P]=g;let k=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,y=[...R.matchAll(k)],E="",b=null;for(let P of y){let g=P[1]||"",f=P[2]||"",r=g.includes("server"),r0=A1(g);if(!r&&f.trim()){let{interpolateScriptExpressions:Z0}=await import("./chunk-pczxwdes.js");f=Z0(f,T)}let M0="";try{let{extractAndStripCssImports:Z0,renderVendorStyleTags:j0}=await import("./chunk-fc5t3cxt.js"),k0=Z0(f,{filePath:V,projectRoot:process.cwd()});f=k0.code,M0=j0(k0.styles)}catch(Z0){if(X.debug)console.warn(`[stx] vendor-css extractor skipped for ${V}:`,Z0 instanceof Error?Z0.message:Z0)}if(r0&&f.trim())f=M1(f);if(!r){try{let{injectBrowserCoreAutoImports:j0}=await import("./chunk-fc5t3cxt.js");f=j0(f).code;let{hasUserImports:k0,bundleClientScript:f0}=await import("./chunk-h7d01cy7.js");if(k0(f))f=await f0(f,V,{projectRoot:process.cwd()})}catch(j0){if(X.debug)console.warn(`[stx] bundler skipped for ${V}:`,j0 instanceof Error?j0.message:j0)}let{stripStxRuntimeImports:Z0}=await import("./chunk-4qj6pq60.js");f=Z0(f)}let y0=sX(f);if(y0&&!r){b=`stx_scope_${U0.basename(V,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++q4}`;let Z0=Z1(f),j0=z4(Z0,b);E+=`${M0}<script data-stx-scoped data-stx-run="always" data-stx-owner="${b}">${j0}</script>
|
|
3456
|
-
`;continue}if(r)try{let{extractVariables:Z0}=await import("./chunk-shr928nn.js");await Z0(f,T,V)}catch(Z0){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${V}:`,Z0)}if(!r&&!y0){let Z0=g.replace(/\bclient\b/i,"").trim();b=`stx_scope_${U0.basename(V,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++q4}`;let j0=Z1(f),k0=z4(j0,b);E+=`${M0}<script data-stx-scoped data-stx-run="always" data-stx-owner="${b}"${Z0?` ${Z0}`:""}>${k0}</script>
|
|
3457
|
-
`}}if(b){let P=$Y(D,b);if(D=P.html,P.mergedIntoExisting){let f=b,r=P.mergedIntoExisting;E=E.split(`'${f}'`).join(`'${r}'`).split(`"${f}"`).join(`"${r}"`),b=r}else if(!P.stamped)console.warn(`[stx] ${U0.relative(process.cwd(),V)} 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 g=P.stamped&&P.root!==null&&Q4(P.root);E=tX(E,g?b:null)}if(D.includes("@include")||D.includes("@partial"))D=await n5(D,T,V,X,Q,Y);let{processLoops:C}=await import("./chunk-h65nep6y.js"),v=C(D,T,V);if(v=$1(v,T,V),v=V1(v,T,V),M)v+=`
|
|
3458
|
-
`+M;if(E)v+=`
|
|
3459
|
-
`+E;return v}catch(R){let D=R instanceof Error?R.message:String(R);return U(_,`Error processing include ${_}: ${D}`,L,O)}}let j=/@include\s*\(/g,B;while((B=j.exec(z))!==null){let _=B.index,F=_+B[0].length-1,L=1,O=F+1;while(O<z.length&&L>0){if(z[O]==="(")L++;else if(z[O]===")")L--;O++}if(L!==0)break;let V=z.substring(_,O),w=z.substring(F+1,O-1),R=w.match(/^\s*['"]([^'"]+)['"]/);if(!R){j.lastIndex=O;continue}let D=R[1],A,I=w.substring(R[0].length),N=i5(I,0);if(N!==-1)A=I.substring(N+1).trim();let M={};if(A)try{M=T0(A,Z)}catch(k){let y=k instanceof Error?k.message:String(k);z=z.replace(V,H0("Include",`Error parsing include variables for ${D}: ${y}`,J,$,_)),j.lastIndex=0;continue}let T=await H(D,M,$,_);z=z.substring(0,_)+T+z.substring(O),j.lastIndex=0}return z}function o5($,Z){let J=$;function X(Q,Y,G,z){let q=Q,K=!0;while(K){K=!1;let W=new RegExp(`@${Y}\\(['"]([^'"]+)['"]\\)`),U=q.match(W);if(!U||U.index===void 0)break;let H=U.index,j=U[1],B=H+U[0].length,_=new RegExp(`@${Y}\\(`),F=new RegExp(`@${G}(?![a-z])`),L=1,O=B,V=-1;while(L>0&&O<q.length){let R=q.slice(O),D=R.match(_),A=R.match(F),I=D?O+D.index:1/0,N=A?O+A.index:1/0;if(I<N)L++,O=I+(D[0].length||1);else if(N<1/0){if(L--,L===0){V=N;break}O=N+G.length+1}else break}if(V===-1)break;let w=q.slice(B,V);if(!Z[j])Z[j]=[];if(z)Z[j].unshift(w);else Z[j].push(w);q=q.substring(0,H)+q.substring(V+`@${G}`.length),K=!0}return q}return J=X(J,"push","endpush",!1),J=X(J,"prepend","endprepend",!0),J}function s5($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(J,X)=>{if(!Z[X]||Z[X].length===0)return"";return Z[X].join(`
|
|
3460
|
-
`)})}import*as r5 from"path";async function U4($,Z,J=""){if(r5.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 j4($,Z,J,"@js","@endjs")}async function H4($,Z,J=""){if(r5.basename(J)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((Y)=>({...Y,displayName:`User ${Y.id}: ${Y.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return j4($,Z,J,"@ts","@endts")}async function j4($,Z,J,X,Q){let Y=$,G=v1(`${X}([\\s\\S]*?)${Q}`,"g"),z=[],q;while((q=G.exec($))!==null)z.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:K,content:W,index:U}of z)try{let H={...Z,global:Z},j=Object.keys(H),B=Object.values(H),_=W.trim();if(X==="@ts")_=_.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 L=(_.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((D)=>D.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),O=L.length>0?`return { ${L.join(", ")} };`:"return {};",V=`
|
|
3461
|
-
${_}
|
|
3462
|
-
${O}
|
|
3463
|
-
`,R=Function(...j,V)(...B);if(R&&typeof R==="object")Object.assign(Z,R);Y=Y.replace(K,"")}catch(H){console.error(`Error executing ${X} code block in ${J}:`,H);let j=H instanceof Error?H.message:String(H),B=H0(`${X} Directive`,`Error executing code: ${j}`,J,$,U,K);console.error(B),Y=Y.replace(K,"")}return Y}var JY=1000,XY=!1;function YY($,Z){let J=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,X="",Q=0,Y;while((Y=J.exec($))!==null){let G=Y.index+Y[0].length,z=Y.index+Y[0].indexOf("("),q=L0($,"(",")",z);if(q===-1)continue;let K=$.slice(G,q).trim();if(!K)continue;if(!Object.keys(Z).some((H)=>new RegExp(`(?:^|[^\\w$.])${H.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(K)))continue;let U;try{let H=T0(K,Z);if(!H||typeof H!=="object")continue;U=JSON.stringify(H)}catch{continue}X+=$.slice(Q,G)+U,Q=q,J.lastIndex=q}return Q===0?$:X+$.slice(Q)}function QY($,Z){let J=/@component\s*\(/g,X=$,Q,Y=[];while((Q=J.exec(X))!==null){let G=Q.index,z=G+Q[0].length-1,q=1,K=z+1;while(K<X.length&&q>0){if(X[K]==="(")q++;else if(X[K]===")"){if(q--,q===0)break}K++}if(q!==0)continue;let W=X.substring(z+1,K),U=K+1,H=W.match(/^\s*['"]([^'"]+)['"]/);if(!H)continue;let j=H[1],B=W.slice(H[0].length),_=B.match(/^\s*,\s*/);if(!_)continue;let F=B.slice(_[0].length).trim();if(!F)continue;try{let L=T0(F,Z),O=JSON.stringify(L),V=`@component('${j}', ${O})`;Y.push({start:G,end:U,replacement:V})}catch{continue}}for(let G=Y.length-1;G>=0;G--){let{start:z,end:q,replacement:K}=Y[G];X=X.substring(0,z)+K+X.substring(q)}return X}function U9($,Z,J){let X=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),Y;while((Y=Q.exec(X))!==null){let G=Y.index,z=G+Y[0].length-1,q=1,K=z+1,W=null,U=!1;while(K<X.length&&q>0){let B=X[K];if(U){U=!1,K++;continue}if(B==="\\"&&W){U=!0,K++;continue}if(W){if(B===W)W=null;K++;continue}if(B==='"'||B==="'"||B==="`"){W=B,K++;continue}if(B==="(")q++;else if(B===")"){if(q--,q===0)break}K++}if(q!==0)break;let H=X.substring(z+1,K),j=J(H);X=X.substring(0,G)+j+X.substring(K+1)}return X}function GY($,Z){let J=$;return J=J.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(X,Q)=>{if(Q in Z)return`:${Q}="${Q}"`;return X}),J=J.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(X,Q,Y)=>{try{let G=Object.keys(Z),z=Object.values(Z);L4(Y);let K=W0(Y,G)(...z),W=JSON.stringify(K);if(W===void 0){if(!G9(Y).some((j)=>!(j in Z)))return"";return X}let U=Buffer.from(W,"utf8").toString("base64");return`__stx_${Q}="${U}"`}catch(G){return X}}),J}var H9="<!--__STX_BREAK__-->",j9="<!--__STX_CONTINUE__-->";function zY($,Z){let J=$;return J=U9(J,"@break",(X)=>{try{let Y=`!!(${X.trim()})`,G;if(q0(Y)){let z=W0(Y,Object.keys(Z));G=Boolean(z(...Object.values(Z)))}else G=Boolean($0(Y,Z));return G?H9:""}catch{return""}}),J=U9(J,"@continue",(X)=>{try{let Y=`!!(${X.trim()})`,G;if(q0(Y)){let z=W0(Y,Object.keys(Z));G=Boolean(z(...Object.values(Z)))}else G=Boolean($0(Y,Z));return G?j9:""}catch{return""}}),J}function qY($){let Z=$;return Z=Z.replace(/@break(?!\()/g,H9),Z=Z.replace(/@continue(?!\()/g,j9),Z}function B4($){let Z=$.includes(H9),J=Z?$.substring(0,$.indexOf(H9)):$;return{hasBreak:Z,content:J}}function _4($){let Z=$.includes(j9),J=Z?$.substring(0,$.indexOf(j9)):$;return{hasContinue:Z,content:J}}function O4($){let Z=$;return Z=U9(Z,"@break",(J)=>{let X=J.trim();if(!W9(X))return"";return`\`; if (${X}) { break; } result += \``}),Z=U9(Z,"@continue",(J)=>{let X=J.trim();if(!W9(X))return"";return`\`; if (${X}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function KY($){let Z=/@forelse\s*\(/g,J,X=[],Q=/@foreach\s*\(/g,Y=/@endforeach/g,G;while((G=Q.exec($))!==null)X.push({pos:G.index,delta:1});while((G=Y.exec($))!==null)X.push({pos:G.index,delta:-1});X.sort((W,U)=>W.pos-U.pos);let z=[],q=0;for(let W of X)q+=W.delta,z.push({pos:W.pos,depth:q});function K(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(K(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 _=$.substring(U+1,B),F=F4(_);if(!F)continue;let{arrayExpr:L,itemVar:O}=F,V=B+1,w=1,R=V,D=/@forelse\s*\(/g,A=/@endforelse/g,I=-1;while(w>0&&R<$.length){D.lastIndex=R,A.lastIndex=R;let E=D.exec($),b=A.exec($);if(!b)break;if(E&&E.index<b.index)w++,R=E.index+E[0].length;else{if(w--,w===0){I=b.index;break}R=b.index+11}}if(I===-1)continue;let N=$.substring(V,I),M=I+11,T=-1,k=0,y=0;while(y<N.length){let E=N.indexOf("@",y);if(E===-1)break;let b=N.substring(E);if(/^@forelse\s*\(/.test(b))k++,y=E+1;else if(b.startsWith("@endforelse"))k--,y=E+11;else if(k===0&&b.startsWith("@empty")){if(N.length<=E+6||!/[a-z]/i.test(N[E+6])){T=E;break}y=E+1}else y=E+1}if(T===-1)continue;return{start:W,end:M,arrayExpr:L,itemVar:O,foreachContent:N.substring(0,T),emptyContent:N.substring(T+6)}}return null}function V4($,Z){let J=$;while(!0){let X=KY(J);if(!X)break;let{start:Q,end:Y,arrayExpr:G,itemVar:z,foreachContent:q,emptyContent:K}=X;try{let W;if(q0(G))W=W0(G,Object.keys(Z))(...Object.values(Z));else W=$0(G,Z);let U;if(!Array.isArray(W)||W.length===0)U=K;else U=`@foreach (${G} as ${z})${q}@endforeach`;J=J.substring(0,Q)+U+J.substring(Y)}catch(W){let U=W instanceof Error?W.message:String(W),H=G0("Forelse",`Error in @forelse(${G} as ${z}): ${U}`,Q0.EVALUATION_ERROR);J=J.substring(0,Q)+H+J.substring(Y)}}return J}function F4($){let Z=$.indexOf(" as ");if(Z!==-1){let Y=$.slice(0,Z).trim(),G=$.slice(Z+4).trim();return Y&&G?{arrayExpr:Y,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(),Q=J[2].trim();return X&&Q?{arrayExpr:Q,itemVar:X}:null}function w4($,Z,J,X){let Q=$;Q=V4(Q,Z);function Y(q){let K=/@foreach\s*\(/g,W;while((W=K.exec(q))!==null){let U=W.index,H=W.index+W[0].length-1,j=1,B=H+1,_=-1;while(B<q.length&&j>0){if(q[B]==="(")j++;else if(q[B]===")"){if(j--,j===0){_=B;break}}B++}if(_===-1)continue;let F=q.substring(H+1,_),L=F4(F);if(!L)continue;let O=U,{arrayExpr:V,itemVar:w}=L,R=_+1,D=1,A=R,I=/@foreach\s*\(/g,N=/@endforeach/g;while(D>0&&A<q.length){I.lastIndex=A,N.lastIndex=A;let M=I.exec(q),T=N.exec(q);if(!T)break;if(M&&M.index<T.index)D++,A=M.index+M[0].length;else{if(D--,D===0){let k=q.substring(R,T.index),y=T.index+11;return{start:O,end:y,arrayExpr:V,itemVar:w,content:k}}A=T.index+11}}}return null}function G(q,K){let W=q;while(!0){let U=Y(W);if(!U)break;let{start:H,end:j,arrayExpr:B,itemVar:_,content:F}=U;try{let L=B.trim(),O;if(q0(L))O=W0(L,Object.keys(K))(...Object.values(K));else O=$0(L,K);let V=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),V=!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),V=!0;else{console.warn(`[stx] @foreach(${L}) in ${J}: ${L} 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.");let T=G0("Foreach",`Error in @foreach: ${L} is not iterable`,Q0.TYPE_ERROR);W=W.substring(0,H)+T+W.substring(j);continue}let w=X?.loops?.useAltLoopVariable??XY,R=_.trim(),D=null,A,I=!1;if(R.includes("=>")){let T=R.split("=>").map((k)=>k.trim());if(T.length===2&&T[0]&&T[1])D=T[0],A=T[1];else A=R}else if(!R.startsWith("[")&&!R.startsWith("{")&&R.includes(",")){let T=R.split(",").map((k)=>k.trim());if(T.length===2&&T[0]&&T[1])A=T[0],D=T[1],I=!0;else A=R}else A=R;let N="",M=O;for(let T=0;T<M.length;T++){let k=M[T],y={index:T,iteration:T+1,first:T===0,last:T===M.length-1,count:M.length},E={...K,loop:y,$loop:y};if(A.startsWith("[")&&A.endsWith("]")){let P=A.slice(1,-1).split(",").map((g)=>g.trim());if(Array.isArray(k))P.forEach((g,f)=>{if(g)E[g]=k[f]});else E[A]=k}else E[A]=k;if(D)if(!I&&V&&Array.isArray(k)&&k.length===2)E[D]=k[0],E[A]=k[1];else E[D]=T;let b=zY(F,E),C=_4(b);if(C.hasContinue){N+=C.content;continue}let v=B4(b);if(v.hasBreak){N+=v.content;break}if(b=V4(b,E),b=G(b,E),b=$1(b,E,J),b=qY(b),v=B4(b),v.hasBreak){N+=v.content;break}if(C=_4(b),C.hasContinue){N+=C.content;continue}b=V1(b,E,J),b=GY(b,E),b=QY(b,E),b=YY(b,E),N+=b}W=W.substring(0,H)+N+W.substring(j)}catch(L){let O=G0("Foreach",`Error in @foreach(${B.trim()} as ${_.trim()}): ${L instanceof Error?L.message:String(L)}`,Q0.EVALUATION_ERROR);W=W.substring(0,H)+O+W.substring(j)}}return W}Q=G(Q,Z),Q=D4(Q,Z,J,X);let z=X?.loops?.maxWhileIterations??JY;return Q=HY(Q,Z,z),Q}function R4($){return W9($)}function D4($,Z,J,X){let Q=$,Y=!0;while(Y){Y=!1;let G=Q.match(/@for\s*\(/);if(!G||G.index===void 0)break;let z=G.index,q=z+G[0].length-1,K=L0(Q,"(",")",q);if(K===-1)break;let W=Q.slice(q+1,K),U=K+1,H=s2(Q.slice(z),"for","endfor");if(H.length===0)break;let j=H[0].content,B=z+H[0].end;if(!R4(W)){let _=G0("For",`Unsafe expression in @for: ${W}`,Q0.UNSAFE_EXPRESSION);Q=Q.substring(0,z)+_+Q.substring(B),Y=!0;continue}try{let _=WY(W),F=/@(?:for|foreach|if|unless)\s*\(/.test(j);if(_.length>0&&F){let D=UY({forExpr:W,content:j,iterVarNames:_,context:Z,filePath:J,options:X});Q=Q.substring(0,z)+D+Q.substring(B),Y=!0;continue}let L=Object.keys(Z),O=Object.values(Z),V=j.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(D,A)=>{return`\${${A}}`});V=O4(V);let R=Function(...L,`
|
|
3464
|
-
let result = '';
|
|
3465
|
-
for (${W}) {
|
|
3466
|
-
result += \`${V}\`;
|
|
3467
|
-
}
|
|
3468
|
-
return result;
|
|
3469
|
-
`)(...O);Q=Q.substring(0,z)+R+Q.substring(B),Y=!0}catch(_){let F=G0("For",`Error in @for(${W}): ${_ instanceof Error?_.message:String(_)}`,Q0.EVALUATION_ERROR);Q=Q.substring(0,z)+F+Q.substring(B),Y=!0}}return Q}function WY($){let Z=$.trim(),J=Z.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(J){let Y=J[1];return Y.slice(1,-1).split(",").map((z)=>{let q=z.trim();if(!q)return"";let K=q.indexOf(":");if(K>=0&&Y.startsWith("{")){let H=q.slice(K+1).trim(),j=H.indexOf("=");return(j>=0?H.slice(0,j):H).trim()}let W=q.indexOf("="),U=(W>=0?q.slice(0,W):q).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 Q=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(Q)return[Q[1]];return[]}function UY($){let{forExpr:Z,content:J,iterVarNames:X,context:Q,filePath:Y,options:G}=$,z=Object.keys(Q),q=Object.values(Q),K=Function(...z,"__pushIter",`
|
|
3470
|
-
for (${Z}) {
|
|
3471
|
-
__pushIter([${X.join(", ")}])
|
|
3472
|
-
}
|
|
3473
|
-
`),W=[];K(...q,(j)=>{W.push(j)});let U=Y??"inline.stx",H="";for(let j of W){let B={...Q};X.forEach((F,L)=>{B[F]=j[L]});let _=D4(J,B,Y,G);_=$1(_,B,U),_=V1(_,B,U),H+=_}return H}function HY($,Z,J){let X=$,Q=!0;while(Q){Q=!1;let Y=X.match(/@while\s*\(/);if(!Y||Y.index===void 0)break;let G=Y.index,z=G+Y[0].length-1,q=L0(X,"(",")",z);if(q===-1)break;let K=X.slice(z+1,q),W=s2(X.slice(G),"while","endwhile");if(W.length===0)break;let U=W[0].content,H=G+W[0].end;if(!R4(K)){let j=G0("While",`Unsafe expression in @while: ${K}`,Q0.UNSAFE_EXPRESSION);X=X.substring(0,G)+j+X.substring(H),Q=!0;continue}try{let j=Object.keys(Z),B=Object.values(Z),_=U.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(O,V)=>{return`\${${V}}`});_=O4(_);let L=Function(...j,`
|
|
3474
|
-
let result = '';
|
|
3475
|
-
let maxIterations = ${J}; // Configurable safety limit
|
|
3476
|
-
let counter = 0;
|
|
3477
|
-
while (${K} && counter < maxIterations) {
|
|
3478
|
-
counter++;
|
|
3479
|
-
result += \`${_}\`;
|
|
3480
|
-
}
|
|
3481
|
-
if (counter > maxIterations) {
|
|
3482
|
-
result += '<!-- [While Error [1104]]: Maximum iterations (${J}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
|
|
3483
|
-
}
|
|
3484
|
-
return result;
|
|
3485
|
-
`)(...B);X=X.substring(0,G)+L+X.substring(H),Q=!0}catch(j){let B=G0("While",`Error in @while(${K}): ${j instanceof Error?j.message:String(j)}`,Q0.EVALUATION_ERROR);X=X.substring(0,G)+B+X.substring(H),Q=!0}}return X}function jY($,Z="_method"){let J=$.toUpperCase();if(J==="GET"||J==="POST")return"";return`<input type="hidden" name="${Z}" value="${J}">`}function N4($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,J,X,Q,Y)=>{return jY(X,Y||"_method")})}async function A4($,Z,J,X,Q){if(!X.middleware||X.middleware.length===0)return $;let Y=$,G=X.middleware.filter((z)=>z.timing===Q);if(G.length===0)return Y;for(let z of G){if(!z.name||typeof z.handler!=="function"){if(X.debug)console.warn("Invalid middleware:",z);continue}try{let q=await z.handler(Y,Z,J,X);if(typeof q==="string")Y=q;else if(X.debug)console.warn(`Middleware ${z.name} did not return a string`)}catch(q){if(X.debug)console.error(`Error in middleware ${z.name}:`,q);if(X.debug){let K=H0("Middleware",`Error in middleware '${z.name}': ${q instanceof Error?q.message:String(q)}`,J,$);Y=Y.replace(/<body[^>]*>/,`$&
|
|
3486
|
-
<div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${P9(K)}</div>
|
|
3487
|
-
`)}}}return Y}async function M4($,Z,J,X){return A4($,Z,J,X,"before")}async function k4($,Z,J,X){return A4($,Z,J,X,"after")}Q2();Q2();function I4($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,J,X,Q,Y)=>{try{let G=Q?T0(Q,{}):{};return a5(X,G,Y==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var l0={patterns:[],exact:{}};function EH($,Z){if(!l0.exact[$])l0.exact[$]=[];l0.exact[$].push(Z)}function bH($,Z){let J=typeof $==="string"?new RegExp($):$;l0.patterns.push({pattern:J,callback:Z})}async function T4($,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:Q}of l0.patterns)if(X.test($)||X.test(J))await Promise.resolve(Q(Z,$))}function yH(){l0.patterns=[],l0.exact={}}var BY=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),_Y=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 k1($,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 Q=/\/\s*>$/.test(X[0])||X[1]===X[1].toLowerCase()&&BY.has(X[1]),Y=Q?X[2].replace(/\/\s*$/,""):X[2];return{full:X[0],tag:X[1],attrs:Y,selfClosing:Q,start:X.index,end:X.index+X[0].length}}function VY($,Z,J){let X=1,Q=J,Y=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(X>0&&Q<$.length){Y.lastIndex=Q,G.lastIndex=Q;let z=Y.exec($),q=G.exec($);if(!q)return-1;if(z&&z.index<q.index)X++,Q=z.index+z[0].length;else{if(X--,X===0)return q.index+q[0].length;Q=q.index+q[0].length}}return-1}function n0($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let J=VY($,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 E4($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function n1($,Z){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=$.match(new RegExp(`${J}="([^"]*)"`,"s"))||$.match(new RegExp(`${J}='([^']*)'`,"s"));return X?X[1]:null}function U1($,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 H1($,Z,J){let X=Z.selfClosing?" /":"",Q=`<${Z.tag}${J}${X}>`;return $.slice(0,Z.start)+Q+$.slice(Z.end)}function LY($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function OY($){let Z=$,J=0;while(J<Z.length){let X=k1(Z,J);if(!X)break;let Q=n1(X.attrs,"v-for");if(Q===null){J=X.end;continue}let Y=Q.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!Y){J=X.end;continue}let G=Y[1].trim(),z=Y[2].trim(),q;if(G.includes(",")){let F=G.split(",").map((V)=>V.trim()),L=F[0],O=F[1];q=`${z} as ${O} => ${L}`}else q=`${z} as ${G}`;let K=U1(X.attrs,"v-for"),W=U1(K,":key").replace(/\s*v-bind:key="[^"]*"/g,""),U=n0(Z,X),H=Z.slice(U.outerStart,U.outerEnd),j=H1(H,{...X,start:0,end:X.end-X.start},W),B=`@foreach(${q})
|
|
3488
|
-
`,_=`${B}${j}
|
|
3489
|
-
@endforeach`;Z=Z.slice(0,U.outerStart)+_+Z.slice(U.outerEnd),J=U.outerStart+B.length}return Z}function FY($){let Z=$,J=0;while(J<Z.length){let X=k1(Z,J);if(!X)break;let Q=n1(X.attrs,"v-if");if(Q===null){J=X.end;continue}let Y=[],G=n0(Z,X),z=U1(X.attrs,"v-if"),q=H1(Z.slice(G.outerStart,G.outerEnd),{...X,start:0,end:X.end-X.start},z);Y.push({type:"if",expr:Q,outerStart:G.outerStart,outerEnd:G.outerEnd,element:q,parsedTag:X});let K=G.outerEnd,W=!0;while(W){let _=Z.slice(K).match(/^\s*/),F=_?_[0].length:0,L=k1(Z,K+F);if(!L){W=!1;break}let O=n1(L.attrs,"v-else-if"),V=E4(L.attrs,"v-else");if(O!==null){let w=n0(Z,L),R=U1(L.attrs,"v-else-if"),D=H1(Z.slice(w.outerStart,w.outerEnd),{...L,start:0,end:L.end-L.start},R);Y.push({type:"else-if",expr:O,outerStart:K,outerEnd:w.outerEnd,element:D,parsedTag:L}),K=w.outerEnd}else if(V){let w=n0(Z,L),R=U1(L.attrs,"v-else"),D=H1(Z.slice(w.outerStart,w.outerEnd),{...L,start:0,end:L.end-L.start},R);Y.push({type:"else",outerStart:K,outerEnd:w.outerEnd,element:D,parsedTag:L}),W=!1}else W=!1}let U=[];for(let _ of Y)if(_.type==="if")U.push(`@if(${_.expr})
|
|
3490
|
-
${_.element}`);else if(_.type==="else-if")U.push(`@elseif(${_.expr})
|
|
3491
|
-
${_.element}`);else U.push(`@else
|
|
3492
|
-
${_.element}`);U.push("@endif");let H=U.join(`
|
|
3493
|
-
`),j=Y[0].outerStart,B=Y[Y.length-1].outerEnd;Z=Z.slice(0,j)+H+Z.slice(B),J=j+H.length}return Z}function wY($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function RY($){let Z=$,J=0;while(J<Z.length){let X=k1(Z,J);if(!X)break;let Q=X.attrs,Y=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,z=Q.match(G);while(z){Y=!0;let W=z[1],U=z[2],H=z[3];Q=Q.replace(z[0],""),Q+=` :${W}="${H}" @update:${W}="${H} = $event"`,z=Q.match(G)}if(Y){let W=n0(Z,X),U=Z.slice(W.outerStart,W.outerEnd),H=H1(U,{...X,start:0,end:X.end-X.start},Q);Z=Z.slice(0,W.outerStart)+H+Z.slice(W.outerEnd),J=W.outerStart+H.length;continue}let q=n1(X.attrs,"v-model");if(q===null){J=X.end;continue}if(_Y.has(X.tag)){let W=X.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,U=n0(Z,X),H=Z.slice(U.outerStart,U.outerEnd),j=H1(H,{...X,start:0,end:X.end-X.start},W);Z=Z.slice(0,U.outerStart)+j+Z.slice(U.outerEnd),J=U.outerStart+j.length}else{let W=X.attrs.replace(/\s*v-model="[^"]*"/g,"");W+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let U=n0(Z,X),H=Z.slice(U.outerStart,U.outerEnd),j=H1(H,{...X,start:0,end:X.end-X.start},W);Z=Z.slice(0,U.outerStart)+j+Z.slice(U.outerEnd),J=U.outerStart+j.length}}return Z}function DY($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function NY($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function AY($){let Z=$,J=0;while(J<Z.length){let X=k1(Z,J);if(!X)break;let Q=n1(X.attrs,"v-html");if(Q===null){J=X.end;continue}if(X.selfClosing){J=X.end;continue}let Y=n0(Z,X),G=U1(X.attrs,"v-html"),z=X.selfClosing?" /":"",q=`<${X.tag}${G}${z}>{!! ${Q} !!}</${X.tag}>`;Z=Z.slice(0,Y.outerStart)+q+Z.slice(Y.outerEnd),J=Y.outerStart+q.length}return Z}function MY($){let Z=$,J=0;while(J<Z.length){let X=k1(Z,J);if(!X)break;let Q=n1(X.attrs,"v-text");if(Q===null){J=X.end;continue}if(X.selfClosing){J=X.end;continue}let Y=n0(Z,X),G=U1(X.attrs,"v-text"),z=X.selfClosing?" /":"",q=`<${X.tag}${G}${z}>{{ ${Q} }}</${X.tag}>`;Z=Z.slice(0,Y.outerStart)+q+Z.slice(Y.outerEnd),J=Y.outerStart+q.length}return Z}function kY($){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 IY($){let Z=$,J=0;while(J<Z.length){let X=k1(Z,J);if(!X)break;if(!E4(X.attrs,"v-once")){J=X.end;continue}let Q=U1(X.attrs,"v-once"),Y=n0(Z,X),G=Z.slice(Y.outerStart,Y.outerEnd),q=`@once
|
|
3494
|
-
${H1(G,{...X,start:0,end:X.end-X.start},Q)}
|
|
3495
|
-
@endonce`;Z=Z.slice(0,Y.outerStart)+q+Z.slice(Y.outerEnd),J=Y.outerStart+q.length}return Z}function TY($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function EY($){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 b4($){if(!LY($))return $;let Z=$;return Z=OY(Z),Z=FY(Z),Z=IY(Z),Z=DY(Z),Z=NY(Z),Z=RY(Z),Z=wY(Z),Z=EY(Z),Z=AY(Z),Z=MY(Z),Z=kY(Z),Z=TY(Z),Z}function B9($){return $.replace(/--/g,"- -").replace(/</g,"<").replace(/>/g,">")}var t5=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"]),bY=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function y4($,Z){let J=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($),X=J?J[1]:$,Q=$0(X,Z);if(Q&&typeof Q==="string")return Q;let Y=X.trim();return t5.has(Y)?Y:null}function C4($){let Z=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($);return Z?Z[1]:$}function S4($,Z,J){let X=Z.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),Q=X?`<${$} ${X}>`:`<${$}>`;if(bY.has($))return X?`<${$} ${X}>`:`<${$}>`;return`${Q}${J}</${$}>`}async function P4($,Z,J,X,Q){let Y=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,z=[],q;while((q=G.exec(Y))!==null)z.push({full:q[0],expr:q[1],attrs:q[2],slotContent:q[3],index:q.index});for(let K=z.length-1;K>=0;K--){let W=z[K];try{let U=y4(W.expr,Z);if(!U||typeof U!=="string"){let O=`<!-- dynamic component: could not resolve "${B9(C4(W.expr))}" -->`;Y=Y.slice(0,W.index)+O+Y.slice(W.index+W.full.length);continue}if(t5.has(U)){let O=S4(U,W.attrs,W.slotContent);Y=Y.slice(0,W.index)+O+Y.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,_;while((_=B.exec(H))!==null){let O=_[1]||_[2],V=_[3];if(_[1])try{j[O]=$0(V,Z)}catch{j[O]=V}else j[O]=V}let F=X.componentsDir||"components",L=await N1(U,j,W.slotContent,F,Z,J,X,new Set,Q??new Set);Y=Y.slice(0,W.index)+L+Y.slice(W.index+W.full.length)}catch(U){let H=U instanceof Error?U.message:String(U),j=`<!-- dynamic component error: ${B9(H)} -->`;Y=Y.slice(0,W.index)+j+Y.slice(W.index+W.full.length)}}return Y=await yY(Y,Z,J,X,Q),Y}async function yY($,Z,J,X,Q){let Y=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,z=[],q;while((q=G.exec(Y))!==null)z.push({full:q[0],expr:q[1],attrs:q[2],index:q.index});for(let K=z.length-1;K>=0;K--){let W=z[K];try{let U=y4(W.expr,Z);if(!U||typeof U!=="string"){let B=`<!-- dynamic component: could not resolve "${B9(C4(W.expr))}" -->`;Y=Y.slice(0,W.index)+B+Y.slice(W.index+W.full.length);continue}if(t5.has(U)){let B=S4(U,W.attrs,"");Y=Y.slice(0,W.index)+B+Y.slice(W.index+W.full.length);continue}let H=X.componentsDir||"components",j=await N1(U,{},"",H,Z,J,X,new Set,Q??new Set);Y=Y.slice(0,W.index)+j+Y.slice(W.index+W.full.length)}catch(U){let H=U instanceof Error?U.message:String(U),j=`<!-- dynamic component error: ${B9(H)} -->`;Y=Y.slice(0,W.index)+j+Y.slice(W.index+W.full.length)}}return Y}function e5(){return{afterOpen:[],beforeClose:[]}}function CY($){return $.afterOpen.length>0||$.beforeClose.length>0}function f4($,Z){if(!CY(Z))return $;let J=Z.afterOpen.join(""),X=Z.beforeClose.join(""),Q=$.lastIndexOf("</head>"),Y=J?F2($):null,G=X&&Q!==-1?Q:null;if(Y===null&&G===null)return $;if(Y!==null&&G!==null)return`${$.slice(0,Y)}${J}${$.slice(Y,G)}${X}${$.slice(G)}`;if(Y!==null)return`${$.slice(0,Y)}${J}${$.slice(Y)}`;return`${$.slice(0,G)}${X}${$.slice(G)}`}var v4=/\s*<meta\b[^>]*\bcharset\b[^>]*>/iy;function F2($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return null;let J=Z.index+Z[0].length;v4.lastIndex=J;let X=v4.exec($);return X?J+X[0].length:J}var Z$="data-stx-color-mode-boot",SY="__STX_COLOR_MODE__",PY=new Set(["light","dark","auto","system"]),vY=new Set(["auto","system"]),fY=/^[a-z][\w:-]*$/i,xY=/^[\w-]+$/;function gY($){let Z=$.storageKey??"stx-color-mode",J=$.initialMode??"auto",X=$.darkClass===void 0?"dark":$.darkClass,Q=$.attribute??null,Y=$.autoValue??null;if(typeof Z!=="string"||Z.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!PY.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"||!xY.test(X)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(X)}`);if(Q!==null&&(typeof Q!=="string"||!fY.test(Q)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(Q)}`);if(Y!==null&&!vY.has(Y))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(Y)}`);if(X===null&&Q===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:Q,autoValue:Y}}function hY($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function J$($={}){let Z=gY($),X=`(function(){"use strict";var c=${hY(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.${SY}={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:a||"auto",preference:p,mode:m}}catch(e){}}());`;return`<script ${Z$}>${X}</script>`}function h4($,Z={}){if($.includes(Z$))return $;let J=$$($);if(J===null)return $;let X=J$(Z);return`${$.slice(0,J)}
|
|
3496
|
-
${X}${$.slice(J)}`}var $$=F2,uY=new RegExp(`<script\\b[^>]*\\b${Z$}\\b[^>]*>[\\s\\S]*?<\\/script>`,"i"),x4=/<meta\b[^>]*\bcharset\b[^>]*>/gi,g4=/<\/head>/gi;function dY($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return $;let J=Z.index+Z[0].length;g4.lastIndex=J;let X=g4.exec($),Q=X?X.index:$.length;x4.lastIndex=J;let Y=x4.exec($);if(!Y||Y.index>=Q)return $;if($.slice(J,Y.index).trim()==="")return $;let G=Y.index+Y[0].length;return`${$.slice(0,J)}
|
|
3497
|
-
${Y[0]}${$.slice(J,Y.index)}${$.slice(G,Q)}${$.slice(Q)}`}function u4($){return mY(dY($))}function mY($){let Z=uY.exec($);if(!Z)return $;let J=$$($);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),Q=$$(X);if(Q===null)return $;return`${X.slice(0,Q)}
|
|
3498
|
-
${Z[0]}${X.slice(Q)}`}var dH="stx-build",mH="X-STX-Build",_9=null;function d4(){if(_9===null)_9=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return _9}function lH($){_9=$}function cH($,Z=d4()){let J=X$($,Z);if(J===null)return $;let X=/<head\b[^>]*>/i.exec($),Q=X.index+X[0].length;return`${$.slice(0,Q)}${J}${$.slice(Q)}`}function X$($,Z=d4()){if($.includes('name="stx-build"'))return null;if(!/<head\b[^>]*>/i.test($))return null;return`
|
|
3499
|
-
<meta name="stx-build" content="${Z}">`}var c4="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",V9="data-stx-html-attrs",L9="data-stx-html-class",p4=/^[A-Za-z_:][\w:.-]*$/;function J1($){return String($).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function lY($){return String($).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function s1($){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 o1($,Z){return Object.entries($).filter(([J])=>!Z?.(J)).map(([J,X])=>`${J}="${J1(String(X))}"`).join(" ")}function cY($={},Z="en"){let J=[],X=[],Q="",Y=Z;for(let[z,q]of Object.entries($||{})){if(q==null)continue;let K=z.trim();if(!p4.test(K))continue;let W=K.toLowerCase();if(W==="lang"){Y=String(q);continue}if(W==="class"){Q=String(q).trim();continue}J.push(` ${K}="${J1(String(q))}"`),X.push(K)}let G=` lang="${J1(Y)}"`;if(Q)G+=` class="${J1(Q)}"`;if(G+=J.join(""),Q)G+=` ${L9}="${J1(Q)}"`;if(X.length)G+=` ${V9}="${J1(X.join(" "))}"`;return G}function i4($={},Z={}){let J={...$,...Z};if($.class&&Z.class){let X=$.class.split(/\s+/).filter(Boolean);for(let Q of Z.class.split(/\s+/).filter(Boolean))if(!X.includes(Q))X.push(Q);J.class=X.join(" ")}return J}function n4($,Z={}){if(!Z||Object.keys(Z).length===0)return $;let J=$.match(/<html\b([^>]*)>/i);if(!J)return $;let X={},Q=[],Y=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,G;while((G=Y.exec(J[1]))!==null){let W=G[1];if(!(W in X))Q.push(W);X[W]=G[2]??G[3]??G[4]??""}let z=[],q=[];for(let[W,U]of Object.entries(Z)){if(U==null)continue;let H=W.trim();if(!p4.test(H))continue;let j=H.toLowerCase();if(j==="class"){let B=(X.class||"").split(/\s+/).filter(Boolean);for(let _ of String(U).split(/\s+/).filter(Boolean))if(!B.includes(_))B.push(_),z.push(_);if(!("class"in X))Q.push("class");X.class=B.join(" ");continue}if(!(H in X))Q.push(H);if(X[H]=String(U),j!=="lang")q.push(H)}if(z.length){if(!(L9 in X))Q.push(L9);X[L9]=z.join(" ")}if(q.length){if(!(V9 in X))Q.push(V9);X[V9]=q.join(" ")}let K=Q.map((W)=>` ${W}="${J1(X[W])}"`).join("");return $.replace(J[0],()=>`<html${K}>`)}function nH($){let Z=G$($);if(Z===null)return $;let J=$.lastIndexOf("</head>");return`${$.slice(0,J)}${Z}${$.slice(J)}`}function G$($){if($.includes("data-stx-cloak"))return null;if($.lastIndexOf("</head>")===-1)return null;return`${c4}
|
|
3500
|
-
`}function pY($){let Z=[],J=0;while(J<$.length){let Y=$.slice(J),G=Y.match(/^\s+/);if(G){J+=G[0].length;continue}if(Y.startsWith("<!--")){let U=$.indexOf("-->",J);if(U===-1)break;J=U+3;continue}let z=Y.match(/^<script\b[^>]*>/i);if(z){let U=$.toLowerCase().indexOf("</script>",J+z[0].length);if(U===-1)break;J=U+9;continue}let q=Y.match(/^<link\b[^>]*>/i);if(q){Z.push(q[0]),J+=q[0].length;continue}let K=Y.match(/^<meta\b[^>]*>/i);if(K){Z.push(K[0]),J+=K[0].length;continue}let W=Y.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="",Q=0;while(Q<$.length&&Q<J){let Y=$.slice(Q),G=Y.match(/^<link\b[^>]*>/i);if(G&&Z.includes(G[0])){Q+=G[0].length;continue}let z=Y.match(/^<meta\b[^>]*>/i);if(z&&Z.includes(z[0])){Q+=z[0].length;continue}let q=Y.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(q&&Z.includes(q[0])){Q+=q[0].length;continue}X+=$[Q],Q++}return X+=$.slice(J),{body:X,hoisted:Z}}function iY($,Z={},J={}){let{title:X="stx App",lang:Q="en",meta:Y=[],link:G=[],script:z=[],headRaw:q="",htmlAttrs:K={},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(Y.map(s1).filter(Boolean)),F=[...j.filter((M)=>!B.has(s1(M))),...Y].map((M)=>{return` <meta ${o1(M)}>`}).join(`
|
|
3501
|
-
`),L=G.map((M)=>{return` <link ${o1(M)}>`}).join(`
|
|
3502
|
-
`),O=z.map((M)=>{if(M.src)return` <script ${o1(M,(T)=>T==="content")}></script>`;if(M.content)return` <script>${M.content}</script>`;return""}).filter(Boolean).join(`
|
|
3503
|
-
`),V=cY(K,Q),w=Object.entries(U).map(([M,T])=>` ${M}="${J1(String(T))}"`).join(""),R=W?` class="${J1(W)}"`:"",{body:D,hoisted:A}=pY($),I=[F,J.colorMode?` ${J$(J.colorMode)}`:"",` <title>${J.titleIsHtml?H:lY(H)}</title>`,` ${c4}`,L,O,q?` ${q}`:"",...(J.styles||[]).map((M)=>` ${M}`),...A.map((M)=>` ${M}`),...(J.headScripts||[]).map((M)=>` ${M}`),J.headStack||""].filter(Boolean),N=[D,...(J.bodyScripts||[]).map((M)=>M),J.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
|
|
3504
|
-
<html${V}>
|
|
3505
|
-
<head>
|
|
3506
|
-
${I.join(`
|
|
3507
|
-
`)}
|
|
3508
|
-
</head>
|
|
3509
|
-
<body${R}${w}>
|
|
3510
|
-
${N.join(`
|
|
3511
|
-
`)}
|
|
3512
|
-
</body>
|
|
3513
|
-
</html>`}var Y$=/\s+/y,Q$=/<(script|style)\b[^>]*>/iy,nY=/<\/script>/gi,oY=/<\/style>/gi,m4=/<!DOCTYPE\b/iy,l4=/<html[\s>]/iy;function z$($){let Z=0;while(Z<$.length){if(Y$.lastIndex=Z,Y$.exec($)){Z=Y$.lastIndex;continue}if($.startsWith("<!--",Z)){let Q=$.indexOf("-->",Z);if(Q===-1)return!1;Z=Q+3;continue}Q$.lastIndex=Z;let X=Q$.exec($);if(X){let Q=X[1].toLowerCase()==="script"?nY:oY;Q.lastIndex=Q$.lastIndex;let Y=Q.exec($);if(Y===null)return!1;Z=Y.index+Y[0].length;continue}if(m4.lastIndex=Z,m4.test($))return!0;return l4.lastIndex=Z,l4.test($)}return!1}function q$($){return z$($)}function o4($,Z={}){let J=$.lastIndexOf("</head>");if(J===-1)return $;let{meta:X=[],link:Q=[],script:Y=[],headRaw:G=""}=Z,z=$.slice(0,J),q=[];for(let K of X){let W=s1(K);if(W&&z.includes(W))continue;q.push(` <meta ${o1(K)}>`)}for(let K of Q){if(K.href&&z.includes(`href="${K.href}"`))continue;q.push(` <link ${o1(K)}>`)}for(let K of Y)if(K.src){if(z.includes(`src="${K.src}"`))continue;q.push(` <script ${o1(K,(W)=>W==="content")}></script>`)}else if(K.content){if(z.includes(K.content))continue;q.push(` <script>${K.content}</script>`)}if(G&&!z.includes(G))q.push(` ${G}`);if(q.length===0)return $;return`${$.slice(0,J)}${q.join(`
|
|
3514
|
-
`)}
|
|
3515
|
-
${$.slice(J)}`}function s4($,Z={},J={},X){if(X??q$($))return $;return iY($,Z,J)}var sY=/<\/(script)/gi;function r1($){if(!$||$.indexOf("</")===-1)return $;return $.replace(sY,"<\\/$1")}var w2=["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"];Q2();Q2();function a4($,Z={}){return new r4($,Z).routes}function Jj($,Z){let J=K$($,Z);return J?J.params:null}var t4=new Map;async function e4($){let Z=$;if(!Z)try{Z=(await z5())?.pagesDir||"pages"}catch{Z="pages"}let J=Z,X=t4.get(J);if(X)return X;let Q=[];try{Q=a4(".",{pagesDir:J}).map((Y)=>Y.regex.source).filter(Boolean)}catch{Q=[]}return t4.set(J,Q),Q}function rY($){return $.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function $6($){return rY(JSON.stringify($))}function Z6($){return $.includes("data-stx-runtime")}function J6($){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 W$($,Z){let J=$.indexOf("<script"),X=$.search(/<!doctype\b/i);if(J!==-1&&(X===-1||J>X))return $.slice(0,J)+Z+`
|
|
3516
|
-
`+$.slice(J);let Q=F2($);if(Q!==null)return`${$.slice(0,Q)}
|
|
3517
|
-
${Z}${$.slice(Q)}`;if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+Z+`
|
|
3518
|
-
`+$.slice(G)}if(i0($))return b1($,(G)=>`${G}
|
|
3519
|
-
${Z}`);return`${Z}
|
|
3520
|
-
${$}`}async function O9($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve"){let{getServeClientAsset:Q}=await import("./chunk-d41b0rqp.js"),{url:Y}=await Q("runtime",Z.debug===!0);return W$($,`<script data-stx-runtime src="${Y}"></script>`)}if(Z.buildMode==="compile")return W$($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:J}=await import("./chunk-d41b0rqp.js"),X=await J(Z.debug);return W$($,`<script data-stx-scoped data-stx-runtime>${X}</script>`)}function aY($){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test($)}function X6($){if($.includes("data-stx-tooltip-runtime")||!aY($))return $;let Z=`<script data-stx-scoped data-stx-tooltip-runtime>${h5()}</script>`,J=$.lastIndexOf("</body>");if(J===-1)return`${$}
|
|
3521
|
-
${Z}`;return`${$.slice(0,J)}${Z}
|
|
3522
|
-
${$.slice(J)}`}var tY=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function eY($){return tY.test($)||$.includes("__stxRouter)return")||$.includes("__stxRouter=true")}async function $Q($,Z){if(!$.includes("</body>"))return $;if(eY($))return $;let J=Z?.router,X="";{let q={};if(J){if(J.container)q.container=J.container;if(J.interceptAllLinks!==void 0)q.interceptAllLinks=J.interceptAllLinks;if(J.progress!==void 0)q.progress=J.progress;if(J.viewTransitions!==void 0)q.viewTransitions=J.viewTransitions;if(J.viewTransitionDuration!==void 0)q.viewTransitionDuration=J.viewTransitionDuration;if(J.viewTransitionEasing!==void 0)q.viewTransitionEasing=J.viewTransitionEasing;if(J.scrollToTop!==void 0)q.scrollToTop=J.scrollToTop;if(J.prefetch!==void 0)q.prefetch=J.prefetch;if(J.cache!==void 0)q.cache=J.cache;if(J.progressColor!==void 0)q.progressColor=J.progressColor;if(J.progressHeight!==void 0)q.progressHeight=J.progressHeight}try{let K=await e4(Z?.pagesDir);if(K.length>0)q.ownedRoutes=K}catch{}if(Object.keys(q).length>0)X=`<script>window.__stxRouterConfig=${$6(q)};</script>
|
|
3523
|
-
`}let{getCachedRouterScript:Q,getServeClientAsset:Y}=await import("./chunk-d41b0rqp.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 Y("router")).url}"></script>`:`<script data-stx-router>${await Q()}</script>`,z=$.lastIndexOf("</body>");return $.slice(0,z)+X+G+`
|
|
3524
|
-
</body>`+$.slice(z+7)}var Y6=Symbol.for("stx.lazy-module-promises");function ZQ(){let $=globalThis;return $[Y6]??=new Map,$[Y6]}function n($,Z){let J=ZQ(),X=`${import.meta.url}\x00${$}`,Q=J.get(X);if(Q)return Q;let Y=Z();return J.set(X,Y),Y.catch(()=>{if(J.get(X)===Y)J.delete(X)}),Y}var U$=`(?:"[^"]*"|'[^']*'|[^>"'])*`,j6=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,JQ=65536,XQ=4,w9=new Map;function Tj(){w9.clear()}function YQ($){let Z=[];for(let J of B$($,J2)){let X=J.token.match(/^<script\b([^>]*)>/i),Q=J.token.match(/<\/script\s*>$/i);if(!X||!Q)continue;let Y=X[0].length,G=J.token.length-Q[0].length;Z.push(Object.freeze({fullMatch:J.token,attrs:X[1],body:J.token.slice(Y,G),start:J.start,end:J.end}))}return Z}function QQ($,Z={}){let J=$.length>=JQ,X=J?w9.get($):void 0;if(X===void 0){if(X=YQ($),J)H6(w9,XQ),w9.set($,X)}let Q=Z.skipAttrs;if(!Q)return X.slice();let Y=[];for(let G of X)if(Q.lastIndex=0,!Q.test(G.attrs))Y.push(G);return Y}function B6($){let Z=$.trim(),J=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(J){let Q=J[1].trim(),Y=J[2].trim(),{itemVar:G,indexVar:z}=Q6(Y);if(G)return{style:"as",iterable:Q,itemVar:G,indexVar:z}}let X=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(X){let Q=X[1].trim(),Y=X[2].trim(),{itemVar:G,indexVar:z}=Q6(Q);if(G)return{style:"in",iterable:Y,itemVar:G,indexVar:z}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function Q6($){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 Q=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:Q[2]};let Y=Z.match(/^(\w+)$/);if(Y)return{itemVar:Y[1],indexVar:null};return{itemVar:null,indexVar:null}}function _$($,Z){return U6($,Z)}function GQ($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,J=0,X;while((X=Z.exec($))!==null){let Q=X[1];if(Q.startsWith("if"))J++;else if(Q==="endif")J--;else if(J===0)return!0}return!1}function zQ($){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)\s*(?:<[^>]*>)?\s*\(/g,Q;while((Q=J.exec($))!==null){let Y=Q[1],G;while((G=X.exec(Y))!==null)Z.add(G[1])}return Z}function qQ($){if(!/[:@]for\s*=/.test($)&&!/\bx-for\s*=/.test($))return[];let Z=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${U$})>`,"iy"),J=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,X=B$($,(Y,G)=>{Z.lastIndex=G;let z=Z.exec(Y);if(!z||z.index!==G||!J.test(z[2]))return-1;return Z.lastIndex}),Q=[];for(let Y of X){Z.lastIndex=0;let G=Z.exec(Y.token);if(!G)continue;let z=G[2].match(J),q=B6(z?.[1]??z?.[2]??""),K=[q.itemVar,q.indexVar].filter(Boolean);if(K.length===0)continue;let W=G[1],H=/\/\s*>$/.test(Y.token)||R9.has(W.toLowerCase())?Y.end:V6($,Y.start,W,Y.end);if(H!==-1)Q.push({start:Y.start,end:H,vars:new Set(K)})}return Q}var G6=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 KQ($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function z6($,Z,J,X){if(!$)return!1;let Q=KQ($),Y=!1,G=!1,z=!1,q=/([a-zA-Z_$][\w$]*)/g,K;while((K=q.exec(Q))!==null){let j=K[1];if(Q.slice(0,K.index).trimEnd().endsWith("."))continue;if(G6.has(j))continue;if(Z.has(j)||X?.has(j))Y=!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(Q))!==null){let j=U[1];if(Q.slice(0,U.index).trimEnd().endsWith("."))continue;if(G6.has(j)||J&&j in J)continue;z=!0}return(Y||z)&&!G}function F9($,Z,J){let X=J===void 0?` ${Z}`:` ${Z}="${J.replace(/"/g,""")}"`,Q=$.trim(),Y=Q.match(j6);if(Y&&WQ(Y[3],Y[1])){let[,G,z,q]=Y;return`<${G}${z}${X}>${q}</${G}>`}return`<template${X}>${Q}</template>`}function WQ($,Z){let J=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),X=0,Q;while((Q=J.exec($))!==null)if(Q[1]){if(X--,X<0)return!1}else X++;return!0}function _6($,Z){let J=zQ($);function X(Q){let Y=Q,G=qQ(Q),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},q=/@if\s*\(/g,K,W=[];while((K=q.exec(Y))!==null){let U=K.index,H=U+K[0].length,j=1,B=H;while(B<Y.length&&j>0){if(Y[B]==="(")j++;else if(Y[B]===")")j--;B++}if(j!==0)continue;let _=Y.substring(H,B-1).trim(),F=B,L=1,O=F,V=/@(if\s*\(|endif)/g;V.lastIndex=F;let w;while((w=V.exec(Y))!==null)if(w[1].startsWith("if"))L++;else if(w[1]==="endif"){if(L--,L===0){O=w.index+w[0].length;break}}if(L!==0)continue;let R=Y.substring(F,O-6).trim(),D;if(GQ(R)){let A=W2(Y.substring(U,O));if(A.length===0)continue;let I=A[0].branches.filter((k)=>k.type!=="else"),N=z(U);if(!(I.length>0&&I.every((k)=>z6(k.condition,J,Z,N))))continue;D=A[0].branches.map((k)=>{let y=X(k.content);if(k.type==="elseif")return F9(y,"@else-if",k.condition??"");if(k.type==="else")return F9(y,"@else");return F9(y,"@if",k.condition??"")}).join(`
|
|
3525
|
-
`)}else{if(!z6(_,J,Z,z(U)))continue;D=F9(X(R),"@if",_)}W.push({start:U,end:O,replacement:D}),q.lastIndex=O}for(let U=W.length-1;U>=0;U--){let{start:H,end:j,replacement:B}=W[U];Y=Y.substring(0,H)+B+Y.substring(j)}return Y}return X($)}function UQ($){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 Q=Number(Z);return Q!==0&&!Number.isNaN(Q)}let J=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(J)return J[1].length>0;let X=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(X)return X[1].length>0;return}var R9=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),q6=/<(script|style)\b/iy,HQ=/<\/script/gi,jQ=/<\/style/gi;function V6($,Z,J,X){if(R9.has(J.toLowerCase()))return X;let Q=J.toLowerCase(),Y=$.length,G=1,z=X;while(z<Y){let q=$.indexOf("<",z);if(q===-1)return-1;if(z=q,$.startsWith("<!--",z)){let H=$.indexOf("-->",z+4);if(H===-1)return-1;z=H+3;continue}q6.lastIndex=z;let K=q6.exec($);if(K){let H=$.indexOf(">",z);if(H===-1)return-1;if($[H-1]==="/"){z=H+1;continue}let j=K[1].toLowerCase()==="script"?HQ:jQ;j.lastIndex=z;let B=j.exec($);if(B===null)return-1;let _=$.indexOf(">",B.index);if(_===-1)return-1;z=_+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()===Q){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()===Q){let H=$.slice(z,U+1);if(!(/\/\s*>$/.test(H)||R9.has(Q)))G++}z=U+1}return-1}var BQ=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function _Q($,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 Q=$.indexOf(">",J);if(Q===-1)return!1;let Y=$.slice(J,Q+1);return BQ.test(Y)}function L6($){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 Q=(U)=>Z.some(([H,j])=>U>=H&&U<j),Y=/<([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=Y.exec($))!==null){if(Q(z.index))continue;let[U,H,j,B,_,F,L]=z,O=UQ(_);if(O===void 0)continue;let V=z.index,w=V+U.length,A=!!L||/\/\s*>$/.test(U)||R9.has(H.toLowerCase())?w:V6($,V,H,w);if(A===-1)continue;if((B===":if"||B==="x-if"||B==="@if")&&_Q($,A)){Y.lastIndex=w;continue}if(O===!0){let N=`<${H}${j}${F}${L}>`;G.push({start:V,end:w,replacement:N});continue}G.push({start:V,end:A,replacement:""}),Y.lastIndex=A}if(G.length===0)return $;G.sort((U,H)=>U.start-H.start);let q=[],K=-1;for(let U of G){if(U.start<K)continue;q.push(U),K=U.end}let W=$;for(let U=q.length-1;U>=0;U--){let{start:H,end:j,replacement:B}=q[U];W=W.substring(0,H)+B+W.substring(j)}return W}function V$($,Z){let J=$,X=/@(for|foreach)\s*\(/g,Q,Y=[],G=[];while((Q=X.exec(J))!==null){let z=Q[1],q=Q.index,K=q+Q[0].length,W=1,U=K;while(U<J.length&&W>0){if(J[U]==="(")W++;else if(J[U]===")")W--;U++}if(W!==0)continue;let H=J.substring(K,U-1).trim(),j=U,B=B6(H),_=z==="for"?"@endfor":"@endforeach",F=1,L=j,O=z==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${z}\\s*\\(|end${z})`,"g");O.lastIndex=j;let V;while((V=O.exec(J))!==null)if(V[1].startsWith(z))F++;else if(F--,F===0){L=V.index+V[0].length;break}if(F!==0)continue;let w=()=>{let M=[B.itemVar,B.indexVar].filter(Boolean);if(M.length)G.push({start:q,end:L,vars:M})};if(B.iterable){let M=B.iterable.trim();if(M.startsWith("[")||M.startsWith("{")||M.startsWith("'")||M.startsWith('"')||M.startsWith("`")||/^-?\d/.test(M)){w();continue}let T=M.split(/[.[(]/)[0].trim(),k=Z?T in Z:!1,y=G.some((E)=>q>E.start&&q<E.end&&E.vars.includes(T));if(T&&(k||y)){w();continue}}if(B.style==="as")H=B.indexVar?`(${B.itemVar}, ${B.indexVar}) in ${B.iterable}`:`${B.itemVar} in ${B.iterable}`;let R=J.substring(j,L-_.length).trim(),D=Z?{...Z}:{};if(B.itemVar)delete D[B.itemVar];if(B.indexVar)delete D[B.indexVar];let A=V$(R,D),I=A.match(j6),N;if(I){let[,M,T,k]=I;N=`<${M}${T} @for="${H}">${k}</${M}>`}else N=`<template @for="${H}">${A}</template>`;Y.push({start:q,end:L,replacement:N}),X.lastIndex=L}for(let z=Y.length-1;z>=0;z--){let{start:q,end:K,replacement:W}=Y[z];J=J.substring(0,q)+W+J.substring(K)}return J}function VQ($){let Z=new Set,J=[],X=0,Q=0,Y=$.length,G=(W)=>{let U=X+1;while(U<Y){let H=$[U];if(H==="\\"){U+=2;continue}if(H===W)return U+1;U++}return Y},z=()=>{let W=X+2;while(W<Y&&$[W]!==`
|
|
3526
|
-
`)W++;return W},q=()=>{let W=X+2;while(W<Y-1){if($[W]==="*"&&$[W+1]==="/")return W+2;W++}return Y},K=(W)=>{let U=W,H=0;while(U<Y){let j=$[U];if(j==="/"&&$[U+1]==="/"){let B=U+2;while(B<Y&&$[B]!==`
|
|
3527
|
-
`)B++;U=B;continue}if(j==="/"&&$[U+1]==="*"){let B=U+2;while(B<Y-1&&!($[B]==="*"&&$[B+1]==="/"))B++;U=B+2;continue}if(j==='"'||j==="'"||j==="`"){let B=U+1;while(B<Y){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 Y};while(X<Y){let W=$[X];if(W==="/"&&$[X+1]==="/"){let U=z();J.push($.slice(X,U)),X=U;continue}if(W==="/"&&$[X+1]==="*"){let U=q();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==="{"){Q++,J.push(W),X++;continue}if(W==="}"){Q--,J.push(W),X++;continue}if(Q===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],_=K(X+j[0].length);if(Z.has(B)){J.push(`/* stx: deduped const ${B} */`),X=_;continue}Z.add(B),J.push($.slice(X,_)),X=_;continue}}}J.push(W),X++}return J.join("")}var LQ=new Set(["script","style","html","head","meta","link","title","!doctype"]);function H$($,Z,J){for(let X of J){if(X.start>=Z)return!1;if(X.end>$)return!0}return!1}function OQ($,Z,J){let X=0;while(X<$.length){let Q=$.indexOf(Z,X);if(Q===-1)return!1;if(!H$(Q,Q+Z.length,J))return!0;X=Q+Z.length}return!1}function FQ($,Z){if(OQ($,"<body",Z)){let Q=new RegExp(`<body(${U$})>`,"g"),Y;while((Y=Q.exec($))!==null)if(!H$(Y.index,Y.index+Y[0].length,Z))return Y.index+Y[0].length-1;return null}let J=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${U$})>`,"gi"),X;while((X=J.exec($))!==null){if(H$(X.index,X.index+X[0].length,Z))continue;if(LQ.has(X[1].toLowerCase()))continue;return X.index+X[0].length-1}return null}function wQ($,Z,J,X){let Q=[],Y=` data-stx="${X}"`,G=0,z=!1,q=(K)=>{if(J!==null&&!z&&J>=G&&J<=K)Q.push($.slice(G,J),Y,$.slice(J,K)),z=!0;else Q.push($.slice(G,K))};for(let K of Z){if(K.start<G)continue;q(K.start),G=K.end}return q($.length),Q.join("")}async function RQ($,Z,J){let X=QQ($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Q=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|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*\(/,Y=[],{hasUserImports:G,bundleClientScript:z}=await n("stx/client-script-bundler",()=>import("./chunk-h7d01cy7.js"));for(let O of X){let V=O.body;if(A1(O.attrs))V=M1(V);if(Q.test(V)){Y.push({content:V,start:O.start,end:O.end});continue}if(!G(V))continue;try{let w=await z(a1(V).code,Z||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(Q.test(w))Y.push({content:V,start:O.start,end:O.end})}catch{}}if(Y.length===0)return{output:$,setupCode:null};let q=`${Z??""}\x00${Y.map((O)=>O.content).join("\x00")}`,K=`__stx_setup_${Bun.hash(q).toString(36).slice(0,10)}`,W=[];for(let O=0;O<Y.length;O++){let V=Y[O].bundled??a1(Y[O].content).code;if(!Y[O].bundled&&G(V))V=await z(V,Z||"",{projectRoot:process.cwd()});V=MQ(V);let w=Z1(V);W.push(`// \u2500\u2500 merged signal script #${O+1} \u2500\u2500
|
|
3528
|
-
${w}`)}let U=W.join(`
|
|
3529
|
-
|
|
3530
|
-
`);U=VQ(U);let H=DQ(U),j=H.split(",").map((O)=>O.trim()).filter(Boolean),B=j$(U,J),_=`
|
|
3531
|
-
<script data-stx-scoped>
|
|
3532
|
-
function ${K}() {
|
|
3533
|
-
${p1("const",j)}
|
|
3534
|
-
${r1(`${B}${U}`)}
|
|
3535
|
-
return { ${H} };
|
|
3536
|
-
}
|
|
3537
|
-
window.__stx_latestSetup=${K};
|
|
3538
|
-
if(window.stx)window.stx._latestSetup=${K};
|
|
3539
|
-
</script>`,F=FQ($,Y);return{output:wQ($,Y,F,K),setupCode:_}}function DQ($){let Z=$,J=[],X=new Set,Q=0,Y=0,G=Z.length,z="",q=()=>{Y++;let B=!1;while(Y<G){let _=Z[Y];if(_==="\\"){Y+=2;continue}if(_==="["&&!B){B=!0,Y++;continue}if(_==="]"&&B){B=!1,Y++;continue}if(_==="/"&&!B){Y++;while(Y<G&&/[gimsuyd]/.test(Z[Y]))Y++;return}if(_===`
|
|
3540
|
-
`)return;Y++}},K=()=>{if(!z)return!0;if(/[\w)\]]/.test(z))return!1;return!0},W=(B)=>{Y++;while(Y<G){if(Z[Y]==="\\"){Y+=2;continue}if(Z[Y]===B){Y++;return}Y++}},U=()=>{Y++;while(Y<G){if(Z[Y]==="\\"){Y+=2;continue}if(Z[Y]==="`"){Y++;return}if(Z[Y]==="$"&&Z[Y+1]==="{"){Y+=2;let B=1;while(Y<G&&B>0)if(Z[Y]==="{")B++,Y++;else if(Z[Y]==="}")B--,Y++;else if(Z[Y]==="'"||Z[Y]==='"')W(Z[Y]);else if(Z[Y]==="`")U();else Y++;continue}Y++}},H=()=>{if(Z[Y]==="/"&&Z[Y+1]==="/"){while(Y<G&&Z[Y]!==`
|
|
3541
|
-
`)Y++;return!0}if(Z[Y]==="/"&&Z[Y+1]==="*"){Y+=2;while(Y<G-1&&!(Z[Y]==="*"&&Z[Y+1]==="/"))Y++;return Y+=2,!0}return!1},j=()=>{if(Q!==0)return;let B=Z.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(B){let V=B[2];if(!X.has(V))J.push(V),X.add(V);return}let _=Z.slice(Y).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(_){_[1].split(",").forEach((V)=>{let w=V.trim();if(!w)return;let R=w.indexOf(":"),A=(R>=0?w.slice(R+1).trim():w).split(/[\s=]/)[0];if(A&&!X.has(A))J.push(A),X.add(A)});return}let F=Z.slice(Y).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(F){F[1].split(",").forEach((V)=>{let w=V.trim().replace(/^\.\.\./,"");if(!w)return;let R=w.split(/[\s=]/)[0];if(R&&!X.has(R))J.push(R),X.add(R)});return}let L=Z.slice(Y).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let V=L[1];if(!X.has(V))J.push(V),X.add(V);return}let O=Z.slice(Y).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let V=O[1];if(!X.has(V))J.push(V),X.add(V)}};while(Y<G){if(H())continue;if(Z[Y]==="'"||Z[Y]==='"'){W(Z[Y]),z=Z[Y-1];continue}if(Z[Y]==="`"){U(),z="`";continue}if(Z[Y]==="/"&&Z[Y+1]!=="/"&&Z[Y+1]!=="*"&&K()){q(),z="/";continue}if(Z[Y]==="{"){Q++,z="{",Y++;continue}if(Z[Y]==="}"){Q--,z="}",Y++;continue}if(Q===0&&/[a-z]/i.test(Z[Y])&&(Y===0||/\s|[;{}()]/.test(Z[Y-1])))j();if(!/\s/.test(Z[Y]))z=Z[Y];Y++}return J.join(", ")}async function O6($,Z,J,X){if(!_$($,J))return $;let Q=$;if(Z.skipSignalsRuntime)return Q;let{output:Y,setupCode:G}=await RQ(Q,J,X);if(Q=Y,!G){let z=i0(Q);if(z&&!/data-stx/.test(z.attrs)&&!/data-stx-auto/.test(z.attrs)){let q=z.tag.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>");Q=Q.slice(0,z.index)+q+Q.slice(z.index+z.tag.length)}}if(Q=await O9(Q,Z),G){let z=K6(Q,/<\/head>/i),q=z===-1?K6(Q,/<body[^>]*>/i):-1;if(z!==-1)Q=`${Q.slice(0,z)}${G}
|
|
3542
|
-
${Q.slice(z)}`;else if(q!==-1){let K=/<body[^>]*>/i.exec(Q.slice(q))[0],W=q+K.length;Q=`${Q.slice(0,W)}
|
|
3543
|
-
${G}${Q.slice(W)}`}else Q=`${Q}
|
|
3544
|
-
${G}`}return Q}function K6($,Z){let J=/<(script|style)\b[\s\S]*?<\/\1>/gi,X=[],Q;while((Q=J.exec($))!==null)X.push([Q.index,Q.index+Q[0].length]);let Y=new RegExp(Z.source,Z.flags.replace(/[gy]/g,"")),G=0;while(G<$.length){let z=Y.exec($.slice(G));if(!z)return-1;let q=G+z.index;if(!X.some(([W,U])=>q>=W&&q<U))return q;G=q+Math.max(z[0].length,1)}return-1}var W6="/* [stx import stripped, resolved via window.stx in __stx_setup] */";function NQ($){let Z=[];for(let J of $.split(",")){let X=J.trim();if(!X||X.startsWith("type "))continue;let Q=X.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Q&&Q[1]!==Q[2])Z.push(`${Q[2]} = ${Q[1]}`)}if(Z.length===0)return W6;return`var ${Z.join(", ")}; ${W6}`}var AQ=/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm;function MQ($){return $.replace(AQ,(Z,J)=>NQ(J))}import e1 from"path";import F6 from"process";function t1($="STX_PUBLIC_"){let Z={},J={};for(let[X,Q]of Object.entries(F6.env)){if(!X.startsWith($)||Q===void 0)continue;Z[`import.meta.env.${X}`]=JSON.stringify(Q),J[X]=Q}return Z["import.meta.env"]=JSON.stringify(J),Z}function yj($="STX_PUBLIC_"){let Z={};for(let[J,X]of Object.entries(F6.env))if(J.startsWith($)&&X!==void 0)Z[J]=X;return Z}function w6($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function R6($,Z,J){try{let X;if($.startsWith("/")){let Q=Z;for(let Y=0;Y<5;Y++){let G=e1.join(Q,$);if(await Bun.file(G).exists())return G;Q=e1.dirname(Q)}X=e1.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))X=e1.resolve(Z,$);else X=e1.resolve(Z,$);if(await Bun.file(X).exists())return X;return null}catch{return null}}var D6=Symbol.for("stx.inline-assets.import-meta");function kQ($,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.
|
|
3545
|
-
`+" `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[D6]=!0,J}async function N6($,Z,J){let X=$,Q=e1.dirname(Z),Y=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Y.exec(X))!==null){let[K,W,U,H]=G;if(w6(U))continue;let j=await R6(U,Q,Z);if(j)try{let B=await Bun.file(j).text();if(J.add(j),U.endsWith(".ts")||U.endsWith(".tsx")){let F=await Bun.build({entrypoints:[j],target:"browser",minify:!0,define:t1()});if(F.outputs.length>0)B=await F.outputs[0].text(),kQ(B,U)}let _=`<script>
|
|
3546
|
-
// Source: ${U}
|
|
3547
|
-
${B}
|
|
3548
|
-
</script>`;X=X.replace(K,_),Y.lastIndex=0}catch(B){if(B?.[D6])throw B}}let z=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=z.exec(X))!==null){let[K,W,U,H]=q,j=W+H;if(w6(U))continue;if(/rel=["']stylesheet["']/.test(j)||U.endsWith(".css")){let _=await R6(U,Q,Z);if(_)try{let F=await Bun.file(_).text();J.add(_);let L=`<style>
|
|
3549
|
-
/* Source: ${U} */
|
|
3550
|
-
${F}
|
|
3551
|
-
</style>`;X=X.replace(K,L),z.lastIndex=0}catch(F){}}}return X}function L$($,Z){let J=$,X=/@json\s*\(/g,Q;while((Q=X.exec(J))!==null){let Y=Q.index,G=Y+Q[0].length-1,z=1,q=G+1,K=null,W=!1;while(q<J.length&&z>0){let V=J[q];if(W){W=!1,q++;continue}if(V==="\\"&&K){W=!0,q++;continue}if(K){if(V===K)K=null;q++;continue}if(V==='"'||V==="'"||V==="`"){K=V,q++;continue}if(V==="(")z++;else if(V===")"){if(z--,z===0)break}q++}if(z!==0)break;let U=J.substring(G+1,q).trim(),H=J.substring(Y,q+1),j=-1,B=0,_=null,F=!1;for(let V=0;V<U.length;V++){let w=U[V];if(F){F=!1;continue}if(w==="\\"&&_){F=!0;continue}if(_){if(w===_)_=null;continue}if(w==='"'||w==="'"||w==="`"){_=w;continue}if(w==="("||w==="["||w==="{")B++;else if(w===")"||w==="]"||w==="}")B--;if(w===","&&B===0){j=V;break}}let L=j>=0?U.substring(0,j).trim():U,O=j>=0?U.substring(j+1).trim():void 0;try{let V=L.trim(),w;if(q0(V))w=W0(V,Object.keys(Z))(...Object.values(Z));else w=void 0;let R;if(O==="true")R=JSON.stringify(w,null,2);else R=JSON.stringify(w);let D=R.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");J=J.substring(0,Y)+D+J.substring(q+1),X.lastIndex=Y+D.length}catch(V){o0.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),X.lastIndex=Y+H.length}}return J}function O$($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function k6($){let Z=$,J=/@memo\s*\(/g,X,Q=[];while((X=J.exec(Z))!==null){let Y=X.index,G=Y+X[0].length,z=1,q=G;while(q<Z.length&&z>0){if(Z[q]==="(")z++;else if(Z[q]===")")z--;q++}if(z!==0)continue;let K=Z.slice(G,q-1).trim(),W=q,U=Z.slice(W),H=U.indexOf("@endmemo");if(H===-1)continue;let j=U.slice(0,H),B=W+H+8,_=j.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),F=_?_[0].length:0,L=j.slice(F),O=j.match(/(\s*)$/),V=O?O[0].length:0,w=L.slice(0,L.length-V),R=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),D;if(R){let[A,I,N="",M]=R,T=`<${I}${N} data-stx-memo="${K}"${M}>`;D=j.slice(0,F)+T+w.slice(A.length)+j.slice(F+w.length)}else D=`${j.slice(0,F)}<div data-stx-memo="${K}">${w}</div>${j.slice(F+w.length)}`;Q.push({start:Y,end:B,replacement:D}),J.lastIndex=B}for(let Y=Q.length-1;Y>=0;Y--){let G=Q[Y];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function F$($){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}var IQ=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),I6=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,A6=/<\/?\s*([a-z][\w-]*)/iy,TQ=/\s/;function EQ($,Z){let J=Z-1;while(J>=0&&TQ.test($[J]))J--;return J>=0&&$[J]==="/"}function bQ($,Z){let J=!1,X=!1;for(let Q=Z;Q<$.length;Q++){let Y=$[Q];if(J){if(Y==="'")J=!1}else if(X){if(Y==='"')X=!1}else if(Y==="'")J=!0;else if(Y==='"')X=!0;else if(Y===">")return Q}return-1}function yQ($,Z){if($.indexOf("{",Z)===-1||$.indexOf("}",Z)===-1)return!1;let J=0,X=Z,Q=!1,Y=!1,G=!1;while(X<$.length){let z=$.indexOf("<",X),q=z===-1?$.length:z;if(q>X){if(J===0)while(X<q){let U=$.indexOf(Y?"}":"{",X);if(U===-1||U>=q){if(Y)G=!1;else Q=!1;break}if(U>X)if(Y)G=!1;else Q=!1;if(Y){if(G)return!0;G=!0}else if(Q)Y=!0,G=!1;else Q=!0;X=U+1}X=q;continue}if($.startsWith("<!--",X)){let U=$.indexOf("-->",X);X=U===-1?$.length:U+3;continue}let K=bQ($,X);if(K===-1)break;A6.lastIndex=X;let W=A6.exec($)?.[1]?.toLowerCase()??"";if($[X+1]==="/"){if(J===0)break;J--}else if(!EQ($,K)&&!IQ.has(W))J++;X=K+1}return!1}function T6($){if($.length>=32768&&!M6($))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="",Q=0,Y;while((Y=J.exec($))!==null){let G=Y.index,z=G+Y[0].length,q=!1,K=!1,W=-1;while(z<$.length){let H=$[z];if(q){if(H==="'")q=!1}else if(K){if(H==='"')K=!1}else if(H==="'")q=!0;else if(H==='"')K=!0;else if(H===">"){W=z;break}z++}if(W===-1)continue;let U=$.slice(G,W+1);if(I6.test(U))continue;if(U.includes("x-cloak"))continue;if(yQ($,W+1))X+=$.slice(Q,W)+" x-cloak>",Q=W+1}return X+=$.slice(Q),X}var CQ=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,SQ=/<\/script>/gi,PQ=/<\/style>/gi;function E6($){let Z=/<[a-z][\w-]*/gi,J="",X=0,Q;while((Q=Z.exec($))!==null){let Y=Q.index,G=Q[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let B=G==="script"?SQ:PQ;B.lastIndex=Y;let _=B.exec($);if(_!==null)Z.lastIndex=_.index+_[0].length;continue}let z=Y+Q[0].length,q=!1,K=!1,W=-1;while(z<$.length){let B=$[z];if(q){if(B==="'")q=!1}else if(K){if(B==='"')K=!1}else if(B==="'")q=!0;else if(B==='"')K=!0;else if(B===">"){W=z;break}z++}if(W===-1)continue;let U=$.slice(Y+Q[0].length,W);if(I6.test(U))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(U))continue;if(!CQ.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 w$=I1(256),vQ=[{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 R$($,Z,J,X){let Q=typeof J==="boolean"?{enabled:J,failOnViolation:J}:J??{enabled:!1};if(!Q.enabled)return;let Y=j1($,Z,X,JSON.stringify(Q)),G=w$.get(Y);if(G!==void 0){if(G&&Q.failOnViolation)throw Error(G);return}let z=Q.allowPatterns??[],q=[],K=x0($.replace(/\{\{--[\s\S]*?--\}\}/g,(j)=>j.replace(/[^\n]/g," ")));for(let{pattern:j,message:B,suggestion:_}of vQ){if(z.some((L)=>/\w/.test(L)&&B.includes(L)))continue;j.lastIndex=0;let F=K.match(j);if(F&&F.length>0){let L=K.split(`
|
|
3552
|
-
`),O=$.split(`
|
|
3553
|
-
`),V=[];L.forEach((A,I)=>{if(j.lastIndex=0,j.test(A))V.push(I+1)});let w=V.length>0?` (script line${V.length>1?"s":""} ${V.join(", ")})`:"",R=V.slice(0,3).map((A)=>` ${A} | ${(O[A-1]??"").trim().slice(0,100)}`).join(`
|
|
3554
|
-
`),D=R?`
|
|
3555
|
-
${R}`:"";q.push(` \u2717 ${B}${w}
|
|
3556
|
-
\u2192 ${_}${D}`)}}if(q.length===0){w$.set(Y,"");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)}:
|
|
3557
|
-
${q.join(`
|
|
3558
|
-
`)}
|
|
3559
|
-
Tip: prefer useRef(), navigate(), and composables for component code`;if(w$.set(Y,H),Q.failOnViolation)throw Error(H);else console.warn(H)}hQ();import D$ from"path";var fQ=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,xQ=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function gQ($,Z){if(!Z||!$.includes("/"))return $;let J=D$.dirname(Z);return $.replace(fQ,(X,Q,Y,G)=>{let z=D$.resolve(J,G);return`${Q}${Y}${z.split(D$.sep).join("/")}${Y}`})}function b6($,Z){if(!Z||!$.includes("<script"))return $;return $.replace(xQ,(J,X,Q,Y)=>`${X}${gQ(Q,Z)}${Y}`)}var T1="<!--PARENT_CONTENT_PLACEHOLDER-->";function y6($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function dQ($,Z){let J=$.length,X=Z,Q=!0,Y=[],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(`
|
|
3560
|
-
`,X+2),X===-1)return-1;X+=1,Q=!0;continue}if(z==="/"&&$[X+1]==="*"){let q=$.indexOf("*/",X+2);if(q===-1)return-1;X=q+2,Q=!0;continue}if(z==="/"&&Q){let q=X+1,K=!1;while(q<J){let W=$[q];if(W==="\\"){q+=2;continue}if(W==="[")K=!0;else if(W==="]")K=!1;else if(W==="/"&&!K){q++;break}else if(W===`
|
|
3561
|
-
`){q=-1;break}q++}if(q===-1){X++,Q=!1;continue}while(q<J&&/[a-z]/.test($[q]))q++;X=q,Q=!1;continue}if(z==="'"||z==='"'){let q=z;X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]===q){X++;break}if($[X]===`
|
|
3562
|
-
`)break;X++}Q=!1;continue}if(z==="`"){X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;break}if($[X]==="$"&&$[X+1]==="{"){Y.push(!0),X+=2,Q=!0;break}X++}if(Y.length===0)Q=!1;continue}if(z==="}"&&Y.length>0){Y.pop(),X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++,Q=!1;break}if($[X]==="$"&&$[X+1]==="{"){Y.push(!0),X+=2,Q=!0;break}X++}continue}if(/\s/.test(z));else if(/[)\].\w$]/.test(z))Q=!1;else Q=!0;X++}return-1}function s6($,Z){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=new RegExp(`<script\\b(?=[^>]*\\b${J}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!X)return null;let Q=X.index+X[0].length,Y=$.indexOf("</script>",Q);if(Y===-1)return null;let G=$.indexOf(">",Y);if(G===-1)return null;return{start:X.index,end:G+1}}var C6=/<style\b[^>]*>/iy,S6=/<\/style>/gi,P6=/<script\b[^>]*>/iy;function v6($){let Z=0;while(Z<$.length){let J=$.indexOf("<",Z);if(J===-1)return-1;if($.startsWith("<!--",J)){let Q=$.indexOf("-->",J+4);Z=Q===-1?$.length:Q+3;continue}C6.lastIndex=J;let X=C6.exec($);if(X){S6.lastIndex=J+X[0].length;let Q=S6.exec($);Z=Q===null?$.length:Q.index+8;continue}if(P6.lastIndex=J,P6.test($))return J;Z=J+1}return-1}async function f6($,Z){try{let{registeredModuleIdsIn:J,buildModuleRegistryScript:X}=await n("stx/client-module-registry",()=>import("./chunk-2wcd2031.js")),Q=await X(J(...$),{minify:Z.buildMode==="compile"});if(!Q)return null;return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${Q.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function mQ($,Z=""){let J=s6($,"data-stx-runtime");if(!J)return $;let X=v6($);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+`
|
|
3563
|
-
`+$.slice(X,J.start)+$.slice(J.end);let Q=$.slice(J.start,J.end),Y=$.slice(0,J.start)+$.slice(J.end),G=v6(Y);if(G===-1)return Q+Z+`
|
|
3564
|
-
`+Y;return Y.slice(0,G)+Q+Z+`
|
|
3565
|
-
`+Y.slice(G)}async function N$($,Z,J,X,Q){if(X.ssr===!1&&!X.autoShell&&X.buildMode==="spa")return $;if(Z.__stx_signals_gate===void 0)Z.__stx_signals_gate=Y1($,J);let Y=!Z.__stxProcessingDepth;if(Y)d$(Z),Z.__stx_head_injections=e5(),Z.__stx_seo_staged=!1;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((X.debug||!q9()&&!K9())&&J&&J.endsWith(".stx"))o6($,J);try{return await c6.timeAsync("template-processing",async()=>{let G=await lQ($,Z,J,X,Q);if(Y)G=F$(G);if(Y&&X.autoShell&&X.buildMode!=="compile"){let z=X.app?.head||{},K=(Z.__stx_runtime_head||null)??n6(),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=K.title||U||j,_=!K.title&&(!!U||!!j),F=K.meta||[],L=new Set(F.map((A)=>s1(A)).filter(Boolean)),O={...z,...B&&{title:B},meta:[...(z.meta||[]).filter((A)=>!L.has(s1(A))),...F],link:[...z.link||[],...K.link||[]],script:[...z.script||[],...K.script||[]],headRaw:[z.headRaw,W].filter(Boolean).join(`
|
|
3566
|
-
`),...K.htmlAttrs&&{htmlAttrs:i4(z.htmlAttrs,K.htmlAttrs)},...K.bodyAttrs&&{bodyAttrs:{...z.bodyAttrs||{},...K.bodyAttrs}}},V=q$(G);if(G=s4(G,O,{..._&&{titleIsHtml:!0},...X.app?.colorMode&&{colorMode:X.app.colorMode}},V),V)G=o4(G,z),G=n4(G,O.htmlAttrs);let w=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(w&&G.includes("<head")){let A=w[1],I=l6(A);G=G.replace(/<head\b[^>]*>/i,(N)=>`${N}
|
|
3567
|
-
<meta name="stx-layout" content="${y6(A)}">
|
|
3568
|
-
<meta name="stx-layout-group" content="${y6(I)}">`)}let R=G.match(/function (__stx_setup_\w+)\(/),D=R?i0(G):null;if(R&&D&&!/\bdata-stx=/.test(D.tag)){G=b1(G,(I,N)=>`<body${N} data-stx="${R[1]}">`);let A=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${R[1]}"`,"i");G=G.replace(A,"$1")}}if(Y){let z=Z.__stx_head_injections??e5(),q=G$(G);if(q!==null)z.beforeClose.push(q);let K=X$(G);if(K!==null)z.afterOpen.push(K);G=f4(G,z);let W=X.app?.colorMode;if(W)G=h4(G,W)}if(Y)if(s6(G,"data-stx-runtime")){let q=null,K=null,W=null,U=null;try{let{getStoreScript:j}=await n("stx/store-loader",()=>import("./chunk-813dt09p.js")),B=X.storesDir,_=await j(B);if(_)K=`<script data-stx-stores>${_}</script>`}catch{}q=await f6([G,K],X);try{let{getFrameworkComposableScript:j}=await n("stx/framework-composables",()=>import("./chunk-btnky17z.js"));U=await j(G)}catch{}try{let{getComposableScript:j}=await n("stx/composable-loader",()=>import("./chunk-e0s519df.js")),B=X.composablesDir,_=[q,K,U].filter((L)=>L!==null),F=await j(B,G,_);if(F)W=`<script data-stx-composables>${F}</script>`}catch{}let H=[q,K,W,U].filter((j)=>j!==null).map((j)=>`
|
|
3569
|
-
${j}`).join("");G=mQ(G,H)}else{let q=await f6([G],X);if(q){let K=G.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(K!==-1)G=G.slice(0,K)+q+`
|
|
3570
|
-
`+G.slice(K)}}if(Y)G=u4(G);if(Y&&Z.__stx_inject_css!==!1)G=await i6(G,void 0,X.buildMode==="serve",!0);else if(Y)G=p6(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof g6)throw G;let z=G instanceof Error?G.message:String(G),q=new R2(`Template processing failed: ${z}`,J,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(o0.log(q,{filePath:J,context:Z}),u6.logDetailedError(q,{filePath:J,template:$.substring(0,500)}),X.debug)throw q;return h6.createFallbackContent("Template Processing",q)}}async function lQ($,Z,J,X,Q){let Y=process.cwd(),G={...X,partialsDir:X.partialsDir&&!A0.isAbsolute(X.partialsDir)?A0.resolve(Y,X.partialsDir):X.partialsDir,componentsDir:X.componentsDir&&!A0.isAbsolute(X.componentsDir)?A0.resolve(Y,X.componentsDir):X.componentsDir,layoutsDir:X.layoutsDir&&!A0.isAbsolute(X.layoutsDir)?A0.resolve(Y,X.layoutsDir):X.layoutsDir},z=G,q=$;await iQ(J,Z),pQ(Z,z),q=await D2(()=>M4(q,Z,J,z),q,(V)=>{o0.log(V,{filePath:J,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${J}: ${V.message}`)}),q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let K=_1(q,z9,(V,w)=>`\x00STX_HTML_COMMENT_${w}\x00`);q=K.output;let W=K.tokens,U=(V)=>W.length===0?V:V.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(w,R)=>W[Number(R)]??""),H="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,H),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(V,w)=>{return`{{ ${w} }}`}),q=b4(q),q=await N6(q,J,Q);let j={};q=o5(q,j);let B={...Z.__sections||{}},_="",F=j3(H3($)),L=/@nolayout\b/.test(q)||F===!1;if(/@nolayout\b/.test(q))q=q.replace(/@nolayout\b\s*/g,"");let O=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(O)_=O[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof F==="string"){if(_=F,!/@section\s*\(/.test(q))q=`@section('content')
|
|
3571
|
-
${q.trim()}
|
|
3572
|
-
@endsection`}if(!_&&!L&&z.defaultLayout){let V=z$(q),w=/@section\s*\(/.test(q);if(!V||w){let R="",D=A0.dirname(J),A=z.layoutsDir?A0.dirname(z.layoutsDir):process.cwd();for(let I=0;I<20;I++){let N=A0.join(D,"_layout.stx");if(await s(N)){R=N;break}let M=A0.dirname(D);if(M===D||M.length<A.length)break;D=M}if(R)_=R;else if(z.layoutsDir){let I=A0.isAbsolute(z.layoutsDir)?z.layoutsDir:A0.resolve(process.cwd(),z.layoutsDir),N=A0.join(I,`${z.defaultLayout}.stx`);if(await s(N))_=N}if(_&&!w)q=`@section('content')
|
|
3573
|
-
${q.trim()}
|
|
3574
|
-
@endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(V,w,R)=>{return B[w]=R,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(V,w,R)=>{if(/^(['"]).*\1$/.test(R.trim()))return V;try{let D=$0(R.trim(),Z);if(D===void 0)return V;return B[w]=String(D??""),""}catch{return V}}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(V,w,R)=>{if(R.includes("@parent"))B[w]=R.replace("@parent",T1);else B[w]=R.trim();return""}),Z.__sections=B,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(V,w,R)=>{return B[w]||R||""}),!("slot"in Z)||Z.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""});if(q=s5(q,j),_){let V=[],w=p0(q),R=_1(w.output,v2,(D,A)=>`\x00STX_ORPHAN_STYLE_${A}\x00`);if(q=R.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(D,A,I)=>{let N=A==="SCRIPT"?w.scripts[Number(I)]:R.tokens[Number(I)];if(N)V.push(N);return""}),V.length>0){let D=V.join(`
|
|
3575
|
-
`);B.content=B.content?`${B.content}
|
|
3576
|
-
${D}`:D,Z.__sections=B}}if(_)try{let V;if(A0.isAbsolute(_))V=_,Q.add(_);else V=await D2(()=>l2(_,J,G,Q),null,()=>{throw new R2(`Failed to resolve layout path: ${_}`,J,void 0,void 0,`Layout referenced from ${J}`)});if(!V){let N=(k)=>{if(!k)return[];try{let y=A0.isAbsolute(k)?k:A0.resolve(process.cwd(),k);return uQ.readdirSync(y).filter((E)=>E.endsWith(".stx")).map((E)=>E.replace(/\.stx$/,""))}catch{return[]}},M=[...N(G.layoutsDir),...N(G.fallbackLayoutsDir)].filter((k,y,E)=>E.indexOf(k)===y).sort(),T=`Layout not found: ${_} (referenced from ${J})`+(M.length>0?`. Available layouts: ${M.join(", ")}`:G.layoutsDir?`. No .stx layouts found in ${G.layoutsDir}`:"");if(o0.log(Error(T),{layoutPath:_,filePath:J,available:M},"error"),console.error(`[stx] ${T}`),G.debug)throw new R2(T,J);return q}let w=await D2(()=>Bun.file(V).text(),"",()=>{throw new R2(`Failed to read layout file: ${V}`,J,void 0,void 0,"Layout content could not be loaded")});w=b6(w,V);let R=w.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(R){if(G.debug)console.log(`Found nested layout: ${R[1]} in ${V}`);let N={},M=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(y,E,b)=>{return N[E]=b.trim(),""});for(let[y,E]of Object.entries(N))if(B[y]&&B[y].includes(T1)){let b=B[y].indexOf(T1);B[y]=B[y].slice(0,b)+E+B[y].slice(b+T1.length)}else if(!B[y])B[y]=E;let T={...Z,__sections:B},k=`@layout('${R[1]}')${M}`;return await N$(k,T,V,G,Q)}let D=w.replace(/\{\{--[\s\S]*?--\}\}/g,""),A=o5(D,j),I={};return A=A.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(N,M,T)=>{return I[M]=T.trim(),`@slot('${M}')`}),A=A.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(N,M,T)=>{if(B[M]){let k=B[M];if(k.includes(T1)){let y=I[M]||"",E=k.indexOf(T1);k=k.slice(0,E)+y+k.slice(E+T1.length)}return k}return T||""}),A=cQ(A,B),A=A.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""}),A=s5(A,j),Z.__originalFilePath=J,q=await x6(A,Z,V,G,Q),q=`<!-- stx-layout: ${_} -->
|
|
3577
|
-
${q}`,U(q)}catch(V){return o0.log(V instanceof Error?V:Error(String(V)),{layoutPath:_,filePath:J},"error"),`[Error processing layout: ${V instanceof Error?V.message:String(V)}]`}return U(await x6(q,Z,J,G,Q))}function cQ($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(J,X,Q)=>{let Y=Z[X];if(Y!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Y))return Y}return Q||""})}function pQ($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let J=Z.envPrefix||"STX_PUBLIC_",X={};for(let[Q,Y]of Object.entries(process.env))if(Q.startsWith(J)&&Y!==void 0)X[Q]=Y;$.$env=X}async function iQ($,Z){await D2(()=>T4($,Z),void 0,(J)=>{o0.log(J,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${J.message}`)})}async function nQ($,Z,J){let X=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Q;while((Q=X.exec($))!==null){let Y=Q[1],G=Q[2];if(!/\bserver\b/.test(Y)||!G.trim())continue;try{let{extractVariables:q}=await n("stx/variable-extractor",()=>import("./chunk-shr928nn.js"));await q(G,Z,J,{preserveExisting:!0})}catch(q){let K=q instanceof Error?q:Error(String(q));o0.log(K,{filePath:J,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${J}: ${K.message}`)}}}async function oQ($,Z,J){try{let{interpolateScriptsInTemplate:X}=await n("stx/expressions",()=>import("./chunk-pczxwdes.js"));return X($,Z,{skipServer:!0})}catch(X){let Q=X instanceof Error?X:Error(String(X));return o0.log(Q,{filePath:J,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${J}: ${Q.message}`),$}}async function x6($,Z,J,X,Q){let Y=$,G=X;if(await nQ(Y,Z,J),Y=await oQ(Y,Z,J),Y=await U4(Y,Z,J),Y=await H4(Y,Z,J),Y=await w7(Y,Z,J,G),Y1(Y))Y=_6(Y,Z),Y=V$(Y,Z);Y=L6(Y);let{processStreamDirectives:z}=await n("stx/streaming",()=>import("./chunk-mzf6c0h7.js"));Y=z(Y,Z),Y=w4(Y,Z,J,G),Y=await P4(Y,Z,J,G,Q),Y=await p5(Y,Z,J,G,Q),Y=U3(Y,Z,J,G);let{processDeferDirectives:q}=await n("stx/defer",()=>import("./chunk-jc57j887.js"));Y=q(Y,Z,J);let{processTeleportDirectives:K}=await n("stx/teleport",()=>import("./chunk-h3t6fjba.js"));Y=K(Y,Z,J);let{processTransitionDirectives:W,processTransitionAttributes:U}=await n("stx/transitions",()=>import("./chunk-6njgsr6w.js"));Y=W(Y,Z,J),Y=U(Y);let{processErrorBoundaryDirectives:H}=await n("stx/error-boundaries",()=>import("./chunk-5t0w4h6z.js"));Y=H(Y,Z,J);let{processSuspenseDirectives:j}=await n("stx/suspense",()=>import("./chunk-g6ttsdz1.js"));Y=j(Y,Z,J);let{processAsyncDirectives:B}=await n("stx/async-components",()=>import("./chunk-f9d27v49.js"));Y=B(Y,Z,J);let{processKeepAliveDirectives:_}=await n("stx/keep-alive",()=>import("./chunk-rqrfq305.js"));Y=_(Y,Z,J);let{processVirtualListDirectives:F,processVirtualGridDirectives:L,processInfiniteListDirectives:O}=await n("stx/virtual-scrolling",()=>import("./chunk-1xyhk1wr.js"));Y=F(Y,Z,J),Y=L(Y,Z,J),Y=O(Y,Z,J);let{processPartialHydrationDirectives:V,processStaticDirectives:w}=await n("stx/partial-hydration",()=>import("./chunk-j21csh4j.js"));Y=V(Y,Z,J),Y=w(Y);let{processComputedDirectives:R,processWatchDirectives:D}=await n("stx/computed",()=>import("./chunk-ry3a2674.js"));Y=R(Y,Z,J),Y=D(Y,Z,J);let{processFormValidationDirectives:A}=await n("stx/forms-validation",()=>import("./chunk-70cf5h11.js"));Y=A(Y,Z,J);let{processHeadDirective:I,processTitleDirective:N,processMetaDirective:M,resetHead:T}=await n("stx/head",()=>import("./chunk-29gjwajm.js"));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)T();let k=I(Y);if(Y=k.content,k.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${k.headContent}
|
|
3578
|
-
`;if(Y=N(Y,Z),Y=M(Y,Z),Y=I4(Y),Y=H5(Y,Z),Y=F7(Y),Y=N4(Y),Y=await n5(Y,Z,J,G,Q),Y=await p5(Y,Z,J,G,Q),Z.__stxProcessingDepth===1)Y=m$(Y,Z);if(Y=Y.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Y=F$(Y),Y=$1(Y,Z,J),Y=_3(Y,Z,{filePath:J,buildMode:G.buildMode}),Y=j5(Y,Z),Y=B5(Y,Z),Y=j2(Y,Z),Y=R5(Y,Z),Y=D5(Y,Z),Y=await G7(Y,Z,J,G),Y=await D3(Y,Z,J),Y=await d6(Y,Z,J,G),Y=m6(Y,Z,J,G),Y=p3(Y,Z,J,G),Y=i3(Y,Z,J),Y=n3(Y,Z,J,G),Y=L7(Y,Z,J,G),Y=L$(Y,Z),Y=O$(Y),Y=k6(Y),!G.skipEventDirectives)Y=h$(Y,Z,J);if(Y=O3(Y,Z,J),G.debug){let i=/\bx-data\s*=/.test(Y),l=_$($);if(i&&l)console.warn(`[stx] ${J}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
3579
|
-
Both work on the same page, but they manage separate scopes.
|
|
3580
|
-
Prefer signals (state/derived/effect) for new components.`)}Y=e7(Y,Z),Y=await V1(Y,Z,J),Y=T6(Y),Y=E6(Y),Y=X3(Y);let{processXElementDirectives:y}=await n("stx/x-element",()=>import("./chunk-hhnzd03k.js"));Y=y(Y);let E=Z.__originalFilePath||J,b=D9(Z);if(Y=await O6(Y,G,E,b),Y=A7(Y,Z),Y=await k4(Y,Z,J,G),G.media?.image?.autoSiblings){let i=G.publicDir||"public",{rewriteImagesWithSiblings:l}=await n("stx/image-optimization/auto-sibling",()=>import("./chunk-2yp8ang5.js"));Y=await l(Y,{publicDir:i})}if(G.seo?.enabled)Y=o3(Y,Z,G);let C=(i,l,K0=!0)=>{if(!l)return i;let J0=l.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),B0=i.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(J0&&B0){if(K0)i=i.replace(B0[0],J0[0]);if(l=l.replace(J0[0],"").trim(),!l)return i}if(/<\/head>/i.test(i))return i.replace(/<\/head>/i,`${l}
|
|
3581
|
-
</head>`);if(/<head\b[^>]*>/i.test(i))return i.replace(/(<head\b[^>]*>)/i,`$1
|
|
3582
|
-
${l}`);if(/<html\b[^>]*>/i.test(i))return i.replace(/(<html\b[^>]*>)/i,`$1
|
|
3583
|
-
<head>
|
|
3584
|
-
${l}
|
|
3585
|
-
</head>`);return i},{renderHead:v,getHead:P}=await n("stx/head",()=>import("./chunk-29gjwajm.js")),f=Z.__stx_runtime_head??P();if(f.title||f.meta?.length||f.link?.length){let i=v(f);if(i)Y=C(Y,i)}if(k.headContent)Y=C(Y,k.headContent,!f.title);if(G.csp?.enabled&&G.csp.addMetaTag)Y=_7(Y,G.csp,Z);if(G.analytics?.enabled)Y=Q3(Y,G);if(G.heatmap?.enabled)Y=z3(Y,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:i}=await n("stx/pwa/inject",()=>import("./chunk-35x7s4cr.js"));Y=i(Y,G)}let r=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(Y),r0=/\bSTX\.\w+/.test(Y),M0=/window\.STX\s*=/.test(Y);if(r&&r0&&!M0){let l=`<script data-stx-scoped data-stx-run="once">
|
|
3586
|
-
${$3()}
|
|
3587
|
-
</script>`;if(Y.includes("</head>")){let K0=Y.indexOf("</head>"),B0=Y.slice(0,K0).indexOf("<script");if(B0!==-1){let I0=Y.slice(0,B0),B1=Y.slice(B0);Y=I0+l+`
|
|
3588
|
-
`+B1}else Y=Y.replace("</head>",`${l}
|
|
3589
|
-
</head>`)}else if(Y.includes("<body"))Y=Y.replace(/<body([^>]*)>/,`<body$1>
|
|
3590
|
-
${l}`);else Y=l+`
|
|
3591
|
-
`+Y}{let{scanScriptTags:i}=await n("stx/signal-processing",()=>import("./chunk-4qj6pq60.js")),l=[];for(let K0 of i(Y)){if(!/\bserver\b/i.test(K0.attrs))continue;let J0=K0.start+K0.fullMatch.indexOf(">")+1,B0=dQ(Y,J0);if(B0===-1)continue;let I0=B0+9;while(I0<Y.length&&/\s/.test(Y[I0]))I0++;l.push({start:K0.start,end:I0})}if(l.length>0){let K0=Array(l.length+1),J0=0;for(let B0=0;B0<l.length;B0++){let{start:I0,end:B1}=l[B0];K0[B0]=Y.slice(J0,I0),J0=B1}K0[l.length]=Y.slice(J0),Y=K0.join("")}}let y0=A9(Y,J);if(y0.hasScoped)Y=y0.html;let Z0=Z.__stx_event_bindings||[],j0=!1,k0=[],f0=/\s:[a-z][\w.-]*\s*=/.test(Y),{scanScriptTags:d0}=await n("stx/signal-processing",()=>import("./chunk-4qj6pq60.js"));for(let i of d0(Y,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))k0.push({match:i.fullMatch,attrs:i.attrs,content:i.body});for(let{match:i,attrs:l,content:K0}of k0){j0=!0;let J0=K0;R$(K0,J,X.strict,Z.__originalFilePath);let B0=await N9(K0,{eventBindings:Z0,attrs:l,hasColonDirectives:f0,templateContent:$,filePath:J,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:b});Y=Y.replace(i,()=>B0)}if(j0)Z.__stx_event_bindings=[];if(!j0&&Z.__stxProcessingDepth===1){let i=Z.__stx_event_bindings||[];if(i.length>0){let l=y9(i);if(l){let K0=Y.lastIndexOf("</body>");Y=K0===-1?Y+l:Y.slice(0,K0)+l+`
|
|
3592
|
-
`+Y.slice(K0)}Z.__stx_event_bindings=[]}}if(!Z6(Y)&&J6(Y))Y=await O9(Y,G);if(Y=X6(Y),G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Y=V7(Y,Z.cspNonce);return Y}var sQ=[{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"}],rQ=[{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')"}],aQ=[{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 tQ($){let Z=[],J=[];return eQ($,Z),$G($,Z,J),ZG($,J),JG($,Z),{valid:Z.length===0,errors:Z,warnings:J}}function eQ($,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 $G($,Z,J){for(let X of sQ){let Q=new RegExp(`${X.open}(?:\\s|\\()`,"g"),Y=new RegExp(X.close,"g"),G=($.match(Q)||[]).length,z=($.match(Y)||[]).length;if(X.altClose){let q=new RegExp(X.altClose,"g");z+=($.match(q)||[]).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 ZG($,Z){for(let J of rQ)if(J.pattern.test($))Z.push({type:"syntax",message:J.message,suggestion:J.suggestion})}function JG($,Z){for(let J of aQ)if(J.pattern.test($))Z.push({type:"expression",message:`Security warning: ${J.message}`,suggestion:"Remove dangerous code from template expressions"})}function XG($,Z){let J=$.slice(0,Z).split(`
|
|
3593
|
-
`);return{line:J.length,column:J[J.length-1].length+1}}function YG($,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 QG($){return/@[a-z]+/i.test($)||/\{\{/.test($)}function GG($){let Z=$.matchAll(/@([a-z]+)/gi),J=new Set;for(let X of Z){let Q=X[1].toLowerCase();if(!Q.startsWith("end"))J.add(Q)}return Array.from(J)}import s0 from"path";import $2 from"process";var Q8=["module","exports","require","props","$props","defineProps","withDefaults","defineClientPayload","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"],r6=new Set(Q8),zG=new Set(["props","$props","defineProps"]),qG=new Set(["stx","@stacksjs/stx"]),a6=I1(128),t6=I1(64);function KG($){let Z=[],J=0,X=$.split(`
|
|
3594
|
-
`);for(let Q of X){let Y=J,G=null,z=!1;for(let q=0;q<Q.length;q++){let K=Q[q];if(z){z=!1;continue}if(K==="\\"){z=!0;continue}if(G){if(K===G)G=null;continue}if(K==="'"||K==='"'||K==="`"){G=K;continue}if(K==="/"&&q+1<Q.length&&Q[q+1]==="/")break;if(K==="{")J++;else if(K==="}")J--}if(Y===0){let q=Q.match(/(?:const|let|var)\s+(\w+)\s*=/);if(q)Z.push(q[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Q)){let K=Q.match(/(?:const|let|var)\s+(\w+)/);if(K)Z.push(K[1])}else{let K=Q.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(K){let U=K[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 WG($){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 Q=[],Y="",G=0,z=0,q=null;for(let K=0;K<X.length;K++){let W=X[K];if(q){if(Y+=W,W===q)q=null;continue}if(W==='"'||W==="'"||W==="`"){q=W,Y+=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){Q.push(Y),Y="";continue}Y+=W}if(Y)Q.push(Y);return Q.map((K)=>{let W=K.trim(),U=W.startsWith("..."),H=U?W.slice(3):W,j=-1,B=0;for(let R=0;R<H.length;R++)if(H[R]==="<")B++;else if(H[R]===">")B--;else if(H[R]===":"&&B===0){j=R;break}if(j===-1)return K;let F=H.substring(0,j).trim().replace(/\?$/,""),L=H.substring(j+1),O=-1,V=0;for(let R=0;R<L.length;R++)if(L[R]==="<")V++;else if(L[R]===">")V--;else if(L[R]==="="&&V===0){O=R;break}let w=U?"...":"";if(O!==-1)return`${w}${F} = ${L.substring(O+1).trim()}`;return`${w}${F}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(X,Q,Y)=>{if(!Y.includes(":"))return X;return`${Q}(${J(Y)})`});{let X=/\b(function\s+\w*\s*)\(/g,Q,Y=[];while((Q=X.exec(Z))!==null){let G=Q.index+Q[0].length-1,z=1,q=G+1,K=0,W=null;while(q<Z.length&&z>0){let j=Z[q];if(W){if(j===W)W=null;q++;continue}if(j==='"'||j==="'"||j==="`"){W=j,q++;continue}if(j==="<")K++;else if(j===">"&&K>0)K--;else if(K===0){if(j==="(")z++;else if(j===")")z--}if(z>0)q++}if(z!==0)continue;let U=Z.substring(G+1,q);if(!U.includes(":"))continue;let H=J(U);Y.push({start:G+1,end:q,replacement:H})}for(let G=Y.length-1;G>=0;G--){let{start:z,end:q,replacement:K}=Y[G];Z=Z.substring(0,z)+K+Z.substring(q)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(X,Q)=>{if(!Q.includes(":"))return X;if(Q.includes("{")||Q.includes("}"))return X;return`(${Q.split(",").map((G)=>{let[z,...q]=G.split("="),K=z.split(":")[0].trim();if(q.length>0)return`${K} = ${q.join("=").trim()}`;return K}).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,`
|
|
3595
|
-
|
|
3596
|
-
`),Z}function UG($){return/cannot find module|could not resolve|module not found|failed to resolve/i.test($)}function HG($){if(!/is not defined|can't find variable/i.test($))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test($)}async function jG($,Z,J,X={}){if(!$.trim())return;let Q=t1(),Y=j1($,JSON.stringify(Q)),G=a6.get(Y);if(G===void 0){try{let S=M$({loader:"ts",target:"browser",define:Q}),x=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");x=x.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),G=S.transformSync(x)}catch{G=WG($)}a6.set(Y,G)}let z={exports:{}},q=z.exports,K=$2.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(s0.resolve(s0.dirname(J),S));continue}let x=s0.resolve(K,"node_modules",S),c=s0.join(x,"package.json"),e=JSON.parse(u("fs").readFileSync(c,"utf8")),X0=e.main||"index.js";if(e.exports){let Y0=typeof e.exports==="string"?e.exports:e.exports["."];if(typeof Y0==="string")X0=Y0;else if(Y0?.bun)X0=Y0.bun;else if(Y0?.import)X0=Y0.import;else if(Y0?.default)X0=Y0.default}W[S]=await import(s0.resolve(x,X0))}catch(x){if(S.startsWith("."))H.set(S,x instanceof Error?x.message:String(x))}let j=(S)=>{if(W[S])return W[S];let x=H.get(S);if(x!==void 0)throw Error(`Cannot require '${S}' from ${J}: ${x}`);return u(S)},B=Z.props||{},_=(S)=>{if(!S)return B;let x={};for(let[c,e]of Object.entries(S)){let X0=B[c];if(X0!==void 0)x[c]=X0;else if(typeof e==="function")x[c]=e();else x[c]=e}return x};for(let[S,x]of Object.entries(B))Object.defineProperty(_,S,{value:x,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(_,S,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let F=(S)=>{if(!S)return B;let x={...B};for(let[c,e]of Object.entries(S)){let X0=e&&typeof e==="object"&&!Array.isArray(e)?e:{type:e};if(x[c]===void 0&&X0.default!==void 0)x[c]=typeof X0.default==="function"?X0.default():X0.default}return x},L=()=>Z.slots||{},O=(S,x)=>{let c={...S};for(let[e,X0]of Object.entries(x))if(c[e]===void 0)if(typeof X0==="function")c[e]=X0();else c[e]=X0;return c},V=(S)=>{let x=()=>S;return x.set=(c)=>{},x.update=(c)=>{},x},w=(S)=>{let x,c=!1;return()=>{if(!c)try{x=S(),c=!0}catch{x=void 0}return x}},R=(S)=>{},D=(S)=>S(),A=(S)=>{},I=(S)=>{},N=B3(Z);function M(S){let x=S||{};if(x.title!==void 0||x.description!==void 0)b({title:x.title,description:x.description})}function T(S){if(!S||typeof S!=="object")return;let x=Z.__stxClientPayload??{};Object.assign(x,S),Z.__stxClientPayload=x}let k=()=>{let S=Z.__stxServeContext,x=Z.__stxServeSearch??S?.search??"",c=S?.path??"",e=Object.fromEntries(new URLSearchParams(x)),X0=Z.query,Y0=Object.keys(e).length>0?e:X0??{},d=x||(Object.keys(Y0).length>0?`?${new URLSearchParams(Y0).toString()}`:"");return{params:Z.params??{},query:Y0,path:c,name:"",fullPath:c+d,hash:"",matched:[]}},y=()=>({push:(S)=>{},replace:(S)=>{},back:()=>{},forward:()=>{},go:(S)=>{}}),E=(S)=>{let x=Z.__stx_runtime_head||{};Z.__stx_runtime_head=m2(x,S||{})},b=(S)=>{E(Y8(S||{}))},C=(S)=>({value:S}),v=(S)=>S,P=(S)=>({value:typeof S==="function"?S():S}),g=(S,x)=>{},f=(S)=>{},r=(S)=>{},r0=(S)=>S?S():Promise.resolve(),M0=(S)=>(x,...c)=>{},y0=(S)=>{},Z0=(S,x)=>{},j0=(S,x)=>x,k0=()=>({value:"light"}),f0=()=>V(!1),d0=(S)=>V(!1),i=()=>V(!1),l=()=>d0("(prefers-color-scheme: dark)"),K0=()=>d0("(prefers-color-scheme: light)"),J0=()=>d0("(prefers-reduced-motion: reduce)"),B0=()=>d0("(prefers-contrast: more)"),I0={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:{}},B1=new Proxy(I0,{get(S,x){if(x in S)return S[x];return},set(S,x,c){return S[x]=c,!0}}),M2={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},k2=console;try{let S=G8(G,J),x=new Set(Object.keys(B)),c=Object.keys(Z).filter((a)=>!x.has(a)&&!zG.has(a)&&Z2(a)),e=c.map((a)=>Z[a]);if(!c.includes("__stxServeContext"))c.push("__stxServeContext"),e.push(void 0);let X0=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),Y0=[],d=[];for(let[a,t0]of Object.entries(B)){if(!Z2(a))continue;if(X0.has(a))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${a}\\b`).test(S))continue;Y0.push(a),d.push(t0)}let z0=KG(S).map((a)=>`module.exports.${a} = typeof ${a} !== 'undefined' ? ${a} : module.exports.${a};`).join(`
|
|
3597
|
-
`),o=Z.params??{},_0=[],w0=[];for(let a=0;a<c.length;a++){if(c[a]==="params")continue;_0.push(c[a]),w0.push(e[a])}let C0=[...Q8,...Y0,..._0],a0=`return (async () => {
|
|
3598
|
-
${S}
|
|
3599
|
-
${z0}
|
|
3600
|
-
return module.exports
|
|
3601
|
-
})()`,b0=j1(a0,C0.join("\x00")),c0=t6.get(b0);if(!c0)c0=Function(...C0,a0),t6.set(b0,c0);let X1=await c0(z,q,j,B,_,F,O,T,V,w,R,D,A,I,M,k,y,E,b,N.setResponseStatus,N.setResponseHeader,N.notFound,C,v,P,g,f,r,r0,M0,y0,L,Z0,j0,k0,f0,d0,i,l,K0,J0,B0,B1,M2,k2,I0.confirm,I0.alert,I0.fetch,o,...d,...w0);if(X.preserveExisting){for(let[a,t0]of Object.entries(X1))if(!(a in Z)||Z[a]===void 0)Z[a]=t0}else Object.assign(Z,X1);for(let[a,t0]of Object.entries(B))if(!(a in Z))Z[a]=t0}catch(S){let x=S instanceof Error?S.message:String(S);if(UG(x))console.warn(`[stx] server <script> in ${J??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${x}`);else if(HG(x))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: ${x}`);else if($2.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${J??"<unknown>"} \u2014 falling back to static extraction. Cause: ${x}`);try{await RG(G,Z,J)}catch(c){if($2.env.STX_DEBUG){let e=c instanceof Error?c.message:String(c);console.warn(`[stx] fallback extraction also failed in ${J??"<unknown>"}: ${e}`)}}}}function BG($){let Z=0,J=null,X=!1,Q=!1;for(let Y=0;Y<$.length;Y++){let G=$[Y];if(J){if(G===J){if(J=null,X||Z===0)Q=!0}continue}if(G==="'"||G==='"'||G==="`"){J=G;continue}if(G==="{")Z++;else if(G==="}")Z--;else if($.startsWith("from",Y)&&Z===0)X=!0}return J===null&&Z===0&&Q}var _G=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function G8($,Z){let J=Z?s0.dirname(Z):$2.cwd(),X=$2.cwd(),Q=$.split(`
|
|
3602
|
-
`),Y=[],G=0;while(G<Q.length){let z=Q[G].trim();if(z.startsWith("interface ")||z.startsWith("export interface ")||z.startsWith("type ")||z.startsWith("export type ")){if(z.includes("{")&&!z.includes("}")){let q=0;for(;G<Q.length;G++){for(let K of Q[G])if(K==="{")q++;else if(K==="}")q--;if(q<=0)break}}G++;continue}if(z.startsWith("definePageMeta(")){let q=0,K=!1,W=G;for(let j=G;j<Q.length&&!K;j++){let B=null,_=!1,F=Q[j];for(let L=0;L<F.length;L++){let O=F[L];if(_){_=!1;continue}if(O==="\\"){_=!0;continue}if(B){if(O===B)B=null;continue}if(O==='"'||O==="'"||O==="`"){B=O;continue}if(O==="(")q++;else if(O===")"){if(q--,q===0){G=j+1,K=!0;break}}}}if(!K)G=Q.length;let U=Q.slice(W,G).join(`
|
|
3603
|
-
`),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)Y.push(`useSeoMeta({ ${H.join(", ")} });`);continue}if(z.startsWith("import ")||z==="import"||z.startsWith("import{")){let q=z,K=0;while(!BG(q)&&G+K+1<Q.length)K++,q=`${q} ${Q[G+K].trim()}`;G+=K;let W=q.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),U=q.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),H=q.match(/^import\s+['"](.+?)['"]/),j=q,B=(_)=>{if(_.startsWith("."))return s0.resolve(J,_);if(_.startsWith("~/")||_.startsWith("@/"))return s0.resolve(X,_.slice(2));return _};if(W){let[,_,F]=W,L=B(F);Y.push(`const ${_} = (await import('${L}')).default`),Y.push(`module.exports.${_} = ${_};`)}else if(U){let[,_,F]=U,L=B(F),O=[],V=[],w=qG.has(F);for(let R of _.split(",")){let D=R.trim();if(!D)continue;let A=D.split(/\s+as\s+/);if(A.length===2){let[I,N]=[A[0].trim(),A[1].trim()];if(w&&r6.has(I)){Y.push(`const ${N} = ${I};`);continue}O.push(`${I}: ${N}`),V.push(N)}else{if(w&&r6.has(D))continue;O.push(D),V.push(D)}}if(O.length>0)Y.push(`const { ${O.join(", ")} } = await import('${L}')`);for(let R of V)Y.push(`module.exports.${R} = ${R};`)}else if(H){let _=B(H[1]);Y.push(`await import('${_}')`)}else Y.push(j);G++;continue}if(_G.test(z))Y.push(Q[G]),G++;else if(z.startsWith("export const ")||z.startsWith("export let ")||z.startsWith("export var ")){let q=$8(Q,G),{type:K,name:W,value:U}=q;Y.push(`${K} ${W} = ${U};`),Y.push(`module.exports.${W} = ${W};`),G=q.nextIndex}else if(z.startsWith("export function ")||z.startsWith("export async function ")){let q=A$(Q,G);Y.push(q.functionCode),Y.push(`module.exports.${q.name} = ${q.name};`),G=q.nextIndex}else if(z.startsWith("const ")||z.startsWith("let ")||z.startsWith("var ")){let q=$8(Q,G),{type:K,name:W,value:U}=q;Y.push(`${K} ${W} = ${U};`),Y.push(`module.exports.${W} = ${W};`),G=q.nextIndex}else if(z.startsWith("function ")||z.startsWith("async function ")){let q=A$(Q,G);Y.push(q.functionCode),Y.push(`module.exports.${q.name} = ${q.name};`),G=q.nextIndex}else if(z.startsWith("export default function ")||z.startsWith("export default async function ")){let q=Q[G].replace(/^(\s*)export\s+default\s+/,"$1"),K=[...Q];K[G]=q;let W=A$(K,G);if(Y.push(W.functionCode),W.name)Y.push(`module.exports.default = ${W.name};`);G=W.nextIndex}else if(z.startsWith("export default ")){let q=z.replace(/^export\s+default\s+/,"").replace(/;$/,"");Y.push(`module.exports.default = ${q};`),G++}else if(z.startsWith("class ")||z.startsWith("export class ")){let q=z.match(/(?:export\s+)?class\s+(\w+)/);if(q){let K=q[1],W=Q[G].replace(/^export\s+/,""),U=0,H=G;for(;H<Q.length;H++){let j=Q[H];for(let B of j)if(B==="{")U++;else if(B==="}")U--;if(H>G)W+=`
|
|
3604
|
-
`+j;if(U<=0&&H>=G)break}Y.push(W),Y.push(`module.exports.${K} = ${K};`),G=H+1}else Y.push(z),G++}else if(z.includes("module.exports"))Y.push(z),G++;else if(z.trim()&&!z.startsWith("//"))Y.push(z),G++;else G++}return VG(Y.join(`
|
|
3605
|
-
`),J,X)}function VG($,Z,J){let X=$.length,Q="",Y=0,G=null,z=!1,q=!1,K=0;while(Y<X){let W=$[Y],U=$[Y+1];if(z){if(Q+=W,W===`
|
|
3606
|
-
`)z=!1;Y++;continue}if(q){if(Q+=W,W==="*"&&U==="/"){Q+=U,Y+=2,q=!1;continue}Y++;continue}if(!G&&W==="/"&&U==="/"){z=!0,Q+=W,Y++;continue}if(!G&&W==="/"&&U==="*"){q=!0,Q+=W,Y++;continue}if(G){if(Q+=W,W==="\\"){Q+=U,Y+=2;continue}if(W===G&&G!=="`"){G=null,Y++;continue}if(G==="`"){if(W==="$"&&U==="{"){K++,Q+=U,Y+=2;continue}if(W==="`"){G=null,Y++;continue}}Y++;continue}if(K>0){if(W==="{")K++;else if(W==="}")K--}if(W==='"'||W==="'"||W==="`"){G=W,Q+=W,Y++;continue}if(W==="a"&&$.startsWith("await",Y)){let H=LG($,Y);if(H){let{quote:j,path:B,end:_}=H;if(B.startsWith(".")||B.startsWith("~/")||B.startsWith("@/")){let F=B.startsWith(".")?s0.resolve(Z,B):s0.resolve(J,B.slice(2));Q+=`await import(${j}${F}${j})`,Y=_;continue}}}Q+=W,Y++}return Q}function LG($,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 Q=J;while(J<$.length&&$[J]!==X)if($[J]==="\\")J+=2;else J++;if(J>=$.length)return null;let Y=$.slice(Q,J);J++;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!==")")return null;return{quote:X,path:Y,end:J+1}}function z8($,Z){let J=$[Z];if(J!=="{"&&J!=="[")return null;let Q=L0($,J,J==="{"?"}":"]",Z);if(Q===-1)return null;return{pattern:$.slice(Z,Q+1),endPos:Q+1}}function q8($){let Z=[],J=$.slice(1,-1).trim();if(!J)return Z;let X=0,Q=0,Y="";while(X<J.length){let G=J[X];if(G==="{"||G==="["){let z=Q===0?z8(J,X):null;if(z){Z.push(...q8(z.pattern)),X=z.endPos,Y="";continue}Q++}else if(G==="}"||G==="]")Q--;if(Q>0){X++;continue}if(G===","){if(Y.trim())Z.push(Y.trim());Y="",X++;continue}if(G===":"){Y="",X++;continue}if(G==="="){if(Y.trim())Z.push(Y.trim());Y="",X++;while(X<J.length&&J[X]!==","&&Q===0){if(J[X]==="{"||J[X]==="[")Q++;else if(J[X]==="}"||J[X]==="]")Q--;X++}continue}if(/[\w$]/.test(G))Y+=G;X++}if(Y.trim())Z.push(Y.trim());return Z}function OG($){let Z=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec($);if(!Z)return null;let J=Z[0].length,X=(Q)=>Q===" "||Q==="\t";while(J<$.length&&X($[J]))J++;if($[J]===":"){let Q=0,Y=null;J++;for(;J<$.length;J++){let G=$[J];if(Y){if(G==="\\"){J++;continue}if(G===Y)Y=null;continue}if(G==="'"||G==='"'||G==="`"){Y=G;continue}if(G==="("||G==="["||G==="{"||G==="<"){Q++;continue}if(G===")"||G==="]"||G==="}"||G===">"){Q--;continue}if(G==="="&&Q<=0){let z=$[J+1],q=$[J-1];if(z!=="="&&z!==">"&&q!=="="&&q!=="!"&&q!=="<"&&q!==">")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 e6($,Z,J,X){let Q=null,Y=!1;for(let G of $){if(Y){Y=!1;continue}if(G==="\\"){Y=!0;continue}if(Q){if(G===Q)Q=null;continue}if(G==="'"||G==='"'||G==="`"){Q=G;continue}if(G===Z)X++;else if(G===J)X--}return X}function $8($,Z){let J=$[Z].trim(),X=OG(J),Q=X?[J,X.type,X.name,X.value]:null;if(!Q){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],_=B==="{"?"}":"]",F=e6(U,B,_,0),L=U;for(let O=Z+1;O<$.length&&F>0;O++)L+=` ${$[O].trim()}`,H=O,F=e6($[O],B,_,F);if(F>0)L=U,H=Z;U=L}let j=z8(U,0);if(j){let B=W[1],_=j.pattern,F=U.slice(j.endPos).trim();if(F.startsWith("=")){let L=F.slice(1).trim(),O=L,V=Math.max(H,Z);if(Z8(L)){let A=J8($,V,L);O=A.value,V=A.nextIndex}else V=V+1;O=O.trim().replace(/;$/,"");let w=q8(_),R=`__stx_src_${Z}`,D=w.map((A)=>`module.exports.${A} = ${A};`).join(`
|
|
3607
|
-
`);return{type:B,name:R,value:`${O}; ${B} ${_} = ${R};
|
|
3608
|
-
${D}`,nextIndex:V}}}}throw Error(`Failed to parse variable declaration: ${J}`)}let[,Y,G,z]=Q,q=z,K=Z;if(Z8(z)){let W=J8($,Z,z);q=W.value,K=W.nextIndex}else K=Z+1;while(K<$.length){let W=$[K].trim();if(W.startsWith(".")||W.startsWith("?."))q+=`
|
|
3609
|
-
${$[K]}`,K++;else break}return q=q.trim().replace(/;$/,""),{type:Y,name:G,value:q,nextIndex:K}}function A$($,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[,Q]=X,Y=J.replace(/^export\s+/,""),G=Z;if(FG(J)){let z=wG($,Z,Y);Y=z.functionCode,G=z.nextIndex}else G=Z+1;return{name:Q,functionCode:Y,nextIndex:G}}function Z8($){let Z=$.trim();if(Z.startsWith("{"))return L0(Z,"{","}",0)===-1;if(Z.startsWith("["))return L0(Z,"[","]",0)===-1;return!K8(Z)}function K8($){let Z={paren:0,bracket:0,brace:0},J=null,X=0;for(let Q=0;Q<$.length;Q++){let Y=$[Q];if((Q>0?$[Q-1]:"")==="\\"&&J)continue;if((Y==='"'||Y==="'")&&!J){J=Y;continue}if(Y===J&&J!=="`"){J=null;continue}if(Y==="`"&&!J){J="`";continue}if(Y==="`"&&J==="`"&&X===0){J=null;continue}if(J==="`"&&Y==="$"&&$[Q+1]==="{"){X++,Q++;continue}if(X>0&&Y==="{"){X++;continue}if(X>0&&Y==="}"){X--;continue}if(J)continue;if(Y==="(")Z.paren++;else if(Y===")")Z.paren--;else if(Y==="[")Z.bracket++;else if(Y==="]")Z.bracket--;else if(Y==="{")Z.brace++;else if(Y==="}")Z.brace--}return Z.paren===0&&Z.bracket===0&&Z.brace===0&&J===null}function W8($){let Z=$.indexOf("(");if(Z===-1)return $.indexOf("{");let J=L0($,"(",")",Z);if(J===-1)return-1;return $.indexOf("{",J)}function FG($){let Z=W8($);if(Z===-1)return!0;return L0($,"{","}",Z)===-1}function J8($,Z,J){let X=J,Q=Z+1;while(Q<$.length&&!K8(X)){let Y=$[Q];X+=`
|
|
3610
|
-
${Y}`,Q++}while(Q<$.length){let Y=$[Q].trim();if(Y.startsWith(".")||Y.startsWith("?."))X+=`
|
|
3611
|
-
${$[Q]}`,Q++;else break}return{value:X,nextIndex:Q}}function wG($,Z,J){let X=J,Q=Z+1;while(Q<$.length){let Y=W8(X);if(Y!==-1){if(L0(X,"{","}",Y)!==-1)break}let G=$[Q];X+=`
|
|
3612
|
-
${G}`,Q++}return{functionCode:X,nextIndex:Q}}function X8($,Z){let J=$0($,Z)??$0(`(${$})`,Z);if(J!==void 0)return J;if(!/\bprocess\b/.test($))return;let X={...Z,process:Object.freeze({env:{...$2.env}})},Q=Object.keys(X).filter(Z2),Y=Q.map((G)=>X[G]);try{return Function(...Q,`'use strict'; return (${$});`)(...Y)}catch{try{return Function(...Q,`'use strict'; return ${$};`)(...Y)}catch{return}}}async function RG($,Z,J){let X=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let Y of X){let[,,G,z]=Y;try{let q=z.trim().replace(/;$/,""),K=X8(q,Z);if(K!==void 0)Z[G]=K}catch(q){console.warn(`Failed to parse export ${G} in fallback:`,q)}}let Q=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let Y of Q){let[,,G,z]=Y;if(!(G in Z))try{let q=z.trim().replace(/;$/,""),K=X8(q,Z);if(K!==void 0)Z[G]=K}catch{}}}function DG($){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 NG($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var N2=new i1(500),k9=new i1(1000),O8=33554432,I$=O8;function AG($){let Z=$.componentRenderCacheBytes;if(typeof Z!=="number"||Z<0||Z===I$)return;I$=Z,I9.setMaxBytes(Z)}var I9=new i1(2000,{maxBytes:O8,sizeOf:($)=>$.output.length});function MG($){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 Q={};for(let Y of Object.keys(X).sort())Q[Y]=J(X[Y]);return Q};return JSON.stringify(J($))}catch{return null}}function U8($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function kG($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function A1($){return!kG($)}var M9=new Map;function M$($){let Z;try{Z=JSON.stringify($)}catch{return new Bun.Transpiler($)}let J=M9.get(Z);if(J)return J;if(M9.size>=16)M9.clear();let X=new Bun.Transpiler($);return M9.set(Z,X),X}var H8=new WeakMap,IG=256;function M1($){try{let Z=M$({loader:"ts",target:"browser",define:t1()}),J=H8.get(Z);if(!J)J=new Map,H8.set(Z,J);let X=J.get($);if(X!==void 0)return X;let Q=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Q=Q.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Y=[];Q=Q.replace(/\{!![\s\S]*?!!\}/g,(z)=>{let q=Y.length;return Y.push(z),`"__STX_EXPR_${q}__"`}),Q=Q.replace(/\{\{\{[\s\S]*?\}\}\}/g,(z)=>{let q=Y.length;return Y.push(z),`"__STX_EXPR_${q}__"`}),Q=Q.replace(/\{\{[\s\S]*?\}\}/g,(z)=>{let q=Y.length;return Y.push(z),`"__STX_EXPR_${q}__"`});let G=Z.transformSync(Q);for(let z=0;z<Y.length;z++)G=G.replace(`"__STX_EXPR_${z}__"`,Y[z]),G=G.replace(`'__STX_EXPR_${z}__'`,Y[z]);if(J.size>=IG){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 TG($){let Z=[],J=new Set,X=0,Q=0,Y=$.length,G=(W)=>{Q++;while(Q<Y){if($[Q]==="\\"){Q+=2;continue}if($[Q]===W){Q++;return}Q++}},z=()=>{Q++;while(Q<Y){if($[Q]==="\\"){Q+=2;continue}if($[Q]==="`"){Q++;return}if($[Q]==="$"&&$[Q+1]==="{"){Q+=2;let W=1;while(Q<Y&&W>0)if($[Q]==="{")W++,Q++;else if($[Q]==="}")W--,Q++;else if($[Q]==="'"||$[Q]==='"')G($[Q]);else if($[Q]==="`")z();else Q++;continue}Q++}},q=()=>{if($[Q]==="/"&&$[Q+1]==="/"){while(Q<Y&&$[Q]!==`
|
|
3613
|
-
`)Q++;return!0}if($[Q]==="/"&&$[Q+1]==="*"){Q+=2;while(Q<Y-1&&!($[Q]==="*"&&$[Q+1]==="/"))Q++;return Q+=2,!0}return!1},K=()=>{if(X!==0)return;let W=$.slice(Q).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(W){let B=W[2].split(",").map((_)=>{let F=_.trim().split(":");return F[F.length-1].trim()});for(let _ of B)if(_&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_)&&!J.has(_))Z.push(_),J.add(_);return}let U=$.slice(Q).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(Q).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(Q).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(Q<Y){if(q())continue;if($[Q]==="'"||$[Q]==='"'){G($[Q]);continue}if($[Q]==="`"){z();continue}if($[Q]==="{"){X++,Q++;continue}if($[Q]==="}"){X--,Q++;continue}if(X===0&&/[a-z]/i.test($[Q])&&(Q===0||/\s|[;{}()]/.test($[Q-1])))K();Q++}return Z}function EG($){let Z=[],J=0,X=0,Q=null;for(let Y=0;Y<$.length;Y++){let G=$[Y];if(Q){if(G==="\\"){Y++;continue}if(G===Q)Q=null;continue}if(G==='"'||G==="'"||G==="`"){Q=G;continue}if(G==="("||G==="["||G==="{")J++;else if(G===")"||G==="]"||G==="}")J--;else if(G===","&&J===0)Z.push($.slice(X,Y)),X=Y+1}if(X<$.length)Z.push($.slice(X));return Z}function bG($){let Z=0,J=null;for(let X=0;X<$.length;X++){let Q=$[X];if(J){if(Q==="\\"){X++;continue}if(Q===J)J=null;continue}if(Q==='"'||Q==="'"||Q==="`"){J=Q;continue}if(Q==="("||Q==="["||Q==="{")Z++;else if(Q===")"||Q==="]"||Q==="}")Z--;else if(Q==="="&&Z===0){let Y=$[X-1],G=$[X+1];if(Y==="!"||Y==="<"||Y===">"||Y==="=")continue;if(G==="="||G===">")continue;return X}}return-1}function yG($,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 Q=X,Y=0,G=-1;for(;X>=0;X--){let q=$[X];if(q==="}")Y++;else if(q==="{"){if(Y--,Y===0){G=X;break}}}if(G===-1)return;let z=$.slice(G+1,Q);for(let q of EG(z)){let K=q.trim();if(!K||K.startsWith("..."))continue;let W=bG(K);if(W===-1)continue;let U=K.slice(0,W).trim();if(!/^[A-Z_$][\w$]*$/i.test(U))continue;if(Z[U]!==void 0)continue;let H=K.slice(W+1).trim();if(!H)continue;try{let j=Object.keys(Z).filter(Z2),B=Function(...j,`"use strict"; return (${H});`);Z[U]=B(...j.map((_)=>Z[_]))}catch{}}}catch{}}async function X9($,Z,J,X,Q){let Y=$.endsWith(".stx")?$.slice(0,-4):$,G=(L)=>L.split("-").map((O)=>O.charAt(0).toUpperCase()+O.slice(1)).join(""),z=(L)=>L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q=J.__importedComponents;if(q){for(let L of[Y,Y.toLowerCase(),G(Y),z(Y)])if(q.has(L))return!0}let K=[...new Set([`${Y}.stx`,`${G(Y)}.stx`,`${z(Y)}.stx`])],W=typeof Q.root==="string"?h.resolve(Q.root):void 0,U=W??h.dirname(X),H=[],j=(L)=>{if(L&&!H.includes(L))H.push(L)},B=J.__originalFilePath;if(B)j(h.join(h.dirname(B),"components"));if(j(Z),j(Q._rootComponentsDir),j(h.join(h.dirname(X),"components")),j(Q.componentsDir),W)j(h.resolve(W,"resources/views/components")),j(h.resolve(W,"resources/components")),j(h.resolve(W,"src/components")),j(h.resolve(W,"components"));let _=Q._pluginComponentDirs;if(Array.isArray(_))for(let L of _)j(typeof L==="string"?L:null);if(j(Q.fallbackComponentsDir),Y.startsWith("./")||Y.startsWith("../"))return s(h.resolve(h.dirname(X),`${Y}.stx`));let F=j8(h.resolve(import.meta.dir,"components"));for(let L of H){let O=h.isAbsolute(L)?L:h.resolve(U,L);if(j8(O)===F)continue;for(let V of K)if(await s(h.join(O,V)))return!0}return!1}function j8($){try{return L8.realpathSync($)}catch{return $}}function CG($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function SG($){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 PG($){let Z=new Set,J=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let X of $){let Q;while((Q=J.exec(X))!==null)Z.add(Q[1]);J.lastIndex=0}return[...Z]}async function N1($,Z,J,X,Q,Y,G,z=new Set,q){let{extractVariables:K}=await n("stx/variable-extractor",()=>import("./chunk-shr928nn.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"&&CG(H)?H:"";try{let B=(d)=>d.split("-").map((m)=>m.charAt(0).toUpperCase()+m.slice(1)).join(""),_=(d)=>d.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),F=$.endsWith(".stx")?$.slice(0,-4):$,L=null,O=Q.__importedComponents;if(O){let d=[F,F.toLowerCase(),B(F),_(F)];for(let m of d)if(O.has(m)){L=O.get(m);break}}let V=[];if(!L){let d=[`${F}.stx`,`${B(F)}.stx`,`${_(F)}.stx`],m=[...new Set(d)],z0=Q.__originalFilePath,o=[];if(z0){let V0=h.join(h.dirname(z0),"components");o.push(V0)}if(X)o.push(X);let _0=G._rootComponentsDir;if(typeof _0==="string"&&!o.includes(_0))o.push(_0);let w0=h.join(h.dirname(Y),"components");if(!o.includes(w0))o.push(w0);if(G.componentsDir&&G.componentsDir!==X&&!o.includes(G.componentsDir))o.push(G.componentsDir);let C0=typeof G.root==="string"?h.resolve(G.root):void 0,a0=C0??h.dirname(Y),b0=[];if(C0)b0.push(h.resolve(C0,"resources/views/components")),b0.push(h.resolve(C0,"resources/components")),b0.push(h.resolve(C0,"src/components")),b0.push(h.resolve(C0,"components"));b0.push(h.resolve(import.meta.dir,"components"));for(let V0 of b0)if(!o.includes(V0))o.push(V0);let c0=G._pluginComponentDirs;if(Array.isArray(c0)){for(let V0 of c0)if(typeof V0==="string"&&!o.includes(V0))o.push(V0)}if(G.fallbackComponentsDir&&!o.includes(G.fallbackComponentsDir))o.push(G.fallbackComponentsDir);let X1=[...new Set(o.map((V0)=>{if(!V0)return V0;return h.isAbsolute(V0)?V0:h.resolve(a0,V0)}))];o.length=0,o.push(...X1);let a=`${F}\x00${Y}\x00${X1.join("\x00")}`,t0=k9.get(a);if(t0)if(await s(t0))L=t0;else k9.delete(a);if(!L&&(F.startsWith("./")||F.startsWith("../")))L=h.resolve(h.dirname(Y),`${F}.stx`),V.push(L);else if(!L)for(let V0 of o){if(!V0)continue;for(let I2 of m){let T2=h.join(V0,I2);if(V.push(T2),await s(T2)){L=T2;break}}if(L)break;if(!L)try{let I2=await import("fs");if(!I2.statSync(V0,{throwIfNoEntry:!1})?.isDirectory())continue;let E8=8,T9=[{path:V0,depth:0}];while(T9.length>0&&!L){let E2=T9.pop();if(E2.depth>=E8)continue;let y$;try{y$=I2.readdirSync(E2.path,{withFileTypes:!0})}catch{continue}for(let b2 of y$){if(!b2.isDirectory())continue;if(b2.name==="node_modules"||b2.name.startsWith("."))continue;let C$=h.join(E2.path,b2.name);for(let b8 of m){let E9=h.join(C$,b8);if(V.push(E9),await s(E9)){L=E9;break}}if(L)break;T9.push({path:C$,depth:E2.depth+1})}}}catch{}if(L)break}if(L)k9.set(a,L)}if(!L||!await s(L)){let d=V.length>0?`
|
|
3614
|
-
Searched paths:
|
|
3615
|
-
${V.map((m)=>` - ${m}`).join(`
|
|
3616
|
-
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${d}`}q.add(L);let w;if(N2.has(L))w=N2.get(L);else try{w=await Bun.file(L).text(),N2.set(L,w)}catch(d){return`[Error loading component: ${d instanceof Error?d.message:String(d)}]`}let R=new Set(["__originalFilePath","__importedComponents",y2,"__stx_client_signal_names","__stxServeContext","__stx_scope_seq"]),D={};for(let[d,m]of Object.entries(Q))if(!d.startsWith("__")||R.has(d))D[d]=m;let A=J;if(J.includes("@include")){let{processIncludes:d}=await n("stx/includes",()=>import("./chunk-7w3dttqh.js"));A=await d(J,Q,Y,G,q)}let I=p0(A),N=[],M=I.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(d,m)=>{let z0=I.scripts[Number(m)]||"",o=z0.match(/^<script\b([^>]*)>/i)?.[1]||"",_0=o.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),w0=!_0||["module","text/javascript","application/javascript"].includes(_0);if(!/\bserver\b/i.test(o)&&w0)return N.push(z0),"";return z0}),{extractSlotContent:T}=await n("stx/slots",()=>import("./chunk-b26xazrf.js")),k=T(M),y={};if(k.defaultSlot?.trim())y.default=k.defaultSlot;for(let[d,m]of k.namedSlots)y[d]=m.content;let E=Q.__stx_scope_seq??={n:0,key:Bun.hash(String(Q.__filename??Y)).toString(36).slice(0,6)},b=`stx_${F.replace(/[^a-zA-Z0-9]/g,"_")}_${++E.n}_${E.key}`,C={...D,$uid:b,...Z,props:Z,slot:M,$slots:y,__processedComponents:U,__sections:{},__stx_signals_gate:Y1(w)||SG(J)};yG(w,C);let v=w,P=a2(v);if(P)v=P.content.trim();let g=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,f=[...w.matchAll(g)],r=[],r0=f.some((d)=>/\bserver\b/.test(d[1]||"")&&/\bcache\b/.test(d[1]||"")),M0=null,y0=null,Z0=null,j0=0,k0=null;if(AG(G),r0&&I$>0){let d=MG({props:Z,slot:J,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0,uid:b});if(d!==null){M0=`${L}\x00${j1(w)}\x00${d}`;let m=I9.get(M0);if(m){for(let z0 of m.dependencies)q.add(z0);if(p$(Q,m.clientFactories),E.n+=m.uidsConsumed,m.preservedClientExpressions.length>0){let z0=new Set(Array.isArray(Q.__stx_preserved_client_expressions)?Q.__stx_preserved_client_expressions:[]);for(let o of m.preservedClientExpressions)z0.add(o);Q.__stx_preserved_client_expressions=[...z0]}return m.output}y0=new Set(q),Z0=l$(Q),j0=E.n,k0=new Set(Array.isArray(Q.__stx_preserved_client_expressions)?Q.__stx_preserved_client_expressions:[])}}for(let d of f){let m=d[1]||"",z0=d[2]||"",o=m.includes("server");if(A1(m)&&z0.trim())z0=M1(z0);if(o&&z0)try{await K(z0,C,L)}catch(w0){}if(!o){let w0=z0.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),C0=w0.includes("{{")&&w0.includes("}}"),a0=w0.includes("{!!")&&w0.includes("!!}");if(C0||a0)w0=v9(w0,C);let b0=m.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");r.push(`<script${b0}>${w0}</script>`)}}let f0=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),d0=f0?f0[1]:"",i=f0?f0[2]:"",l="",K0=d0&&/\bscoped\b/i.test(d0);if(f0)l=`<style${d0}>${i}</style>`;let J0=v;if(J0=J0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),f0)J0=J0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let d=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,m=[];if(J0=J0.replace(d,(z0,o)=>{let _0=o.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(_0)m.push(`<style${_0[1]}>${_0[2]}</style>`);return""}),J0=J0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),m.length>0)l=`${l}${m.join(`
|
|
3617
|
-
`)}`}if(J&&J0.includes("{{ text || slot }}"))J0=J0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>J);let{applySlots:B0}=await n("stx/slots",()=>import("./chunk-b26xazrf.js")),{defaultSlot:I0,namedSlots:B1}=k;J0=await B0(J0,I0,B1,C);let M2=r.some((d)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(d)),k2=PG(r),S=Array.isArray(C.__stx_client_signal_names)?C.__stx_client_signal_names:[];if(k2.length>0||S.length>0)C.__stx_client_signal_names=[...new Set([...S,...k2])];let x={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:h.dirname(L),skipSignalsRuntime:!0,skipEventDirectives:M2||r.length===0,defaultLayout:void 0};C.__stxProcessingDepth=(Q.__stxProcessingDepth||0)+1;let c=await N$(J0,C,L,x,q),e=new Set(Array.isArray(Q.__stx_preserved_client_expressions)?Q.__stx_preserved_client_expressions:[]);for(let d of c.matchAll(/\{\{([\s\S]*?)\}\}/g))e.add(d[1].trim());if(e.size>0)Q.__stx_preserved_client_expressions=[...e];let X0=b,Y0=c;if(M2){let d="";if(Object.keys(Z).length>0)try{d=` data-stx-props="${U8(JSON.stringify(Z))}"`}catch{}let m=j?` stx-hydrate="${U8(j)}"`:"";Y0=`<div data-stx-scope="${X0}"${d}${m}>${c}</div>`;let z0=await Promise.all(r.map(async(o)=>{let _0=o.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!_0)return o;let[,w0,C0]=_0,{vendorStyleTags:a0,factoryBody:b0}=await xG(C0,L,G.buildMode==="compile"),c0=j?null:C9(Q,b0),X1=c0?`window.__stxComponentFactories[${JSON.stringify(c0)}](${JSON.stringify(X0)});`:`(${b0})(${JSON.stringify(X0)});`;if(j)return`${a0}<script type="stx/island" data-stx-island="${X0}" data-stx-scoped data-stx-owner="${X0}"${w0}>${X1}</script>`;return`${a0}<script data-stx-scoped data-stx-run="always" data-stx-owner="${X0}"${w0}>${X1}</script>`}));if(Y0=Y0+`
|
|
3618
|
-
`+z0.join(`
|
|
3619
|
-
`),l)Y0+=`
|
|
3620
|
-
`+l}else{if(l)Y0+=`
|
|
3621
|
-
`+l;if(r.length>0){let d=C.__stx_event_bindings||[],m=D9(C),z0=await Promise.all(r.map(async(o)=>{let _0=o.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!_0)return o;return await N9(_0[1],{eventBindings:d,templateContent:Y0,filePath:L,projectRoot:process.cwd(),serverData:m,instanceId:b})}));Y0+=`
|
|
3622
|
-
`+z0.join(`
|
|
3623
|
-
`),C.__stx_event_bindings=[]}}if(K0){let d=A9(Y0,L);if(d.hasScoped)Y0=d.html}if(M0&&y0){let d=Array.isArray(Q.__stx_preserved_client_expressions)?Q.__stx_preserved_client_expressions:[];I9.set(M0,{output:Y0,dependencies:[...q].filter((m)=>!y0.has(m)),clientFactories:Z0?c$(Q,Z0):[],uidsConsumed:E.n-j0,preservedClientExpressions:k0?d.filter((m)=>!k0.has(m)):[]})}return N.length>0?`${Y0}
|
|
3624
|
-
${N.join(`
|
|
3625
|
-
`)}`:Y0}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{W.delete($)}}async function s($){return Bun.file($).exists()}function T$($,Z){let J=h.resolve(Z),X=h.resolve($),Q=J.endsWith(h.sep)?J:J+h.sep;if(X===J||X.startsWith(Q))return X;return null}async function vG($,Z,J,X){let Q=Z.startsWith("layouts/")?Z.slice(8):Z,Y=h.join($,Q);for(let G of Y.endsWith(".stx")?[Y]:[Y,`${Y}.stx`])if(await s(G)){if(X)console.log(`Found layout in ${$}: ${G}`);return J?.add(G),G}return null}async function l2($,Z,J,X){let Q=await fG($,Z,J,X);if(Q===null)return null;let Y=T$(Q,process.cwd());if(Y)return Y;let G=[J.root,J.layoutsDir,J.fallbackLayoutsDir,J.componentsDir,J.partialsDir,J.pagesDir].filter((z)=>typeof z==="string"&&z.length>0);for(let z of G){let q=h.isAbsolute(z)?z:h.resolve(process.cwd(),z);if(T$(Q,q))return h.resolve(Q)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${Q} (template: ${$}, from: ${Z})`),null}async function fG($,Z,J,X){if(J.debug)console.log(`Resolving template path: ${$} from ${Z}`);let Q=h.dirname(Z),Y=process.cwd();if($.startsWith("/")){let H=h.join(Y,$),j=T$(H,Y);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 s(j)&&X)X.add(j);return j}let G=h.join(Q,$);if(await s(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 s(j)){if(J.debug)console.log(`Found direct path with extension: ${j}`);if(X)X.add(j);return j}}let z=[];if(J.layoutsDir)z.push(h.isAbsolute(J.layoutsDir)?J.layoutsDir:h.resolve(process.cwd(),J.layoutsDir));let q=h.resolve(Q),K=process.cwd();for(let H=0;H<10;H++){let j=h.join(q,"layouts"),B=!1;try{B=L8.statSync(j,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(B){z.push(j);break}let _=h.dirname(q);if(_===q||_.length<K.length)break;q=_}for(let H of z){let j=await vG(H,$,X,J.debug);if(j)return j}if(J.fallbackLayoutsDir){let H=h.isAbsolute(J.fallbackLayoutsDir)?J.fallbackLayoutsDir:h.resolve(process.cwd(),J.fallbackLayoutsDir),j=$.startsWith("layouts/")?$.slice(8):$,B=[h.join(H,j)];if(!$.endsWith(".stx"))B.push(`${B[0]}.stx`);for(let _ of B)if(await s(_)){if(J.debug)console.log(`Found in options.fallbackLayoutsDir: ${_}`);if(X)X.add(_);return _}}if($.startsWith("layouts/")||$.includes("/layouts/")){let H=$.split("layouts/"),j=h.join(J.partialsDir||Q,"layouts",H[1]);if(await s(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 s(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=h.join(J.partialsDir,"layouts");if(await s(H)){let j=h.join(H,$);if(await s(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 s(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||h.join(process.cwd(),"views"),U=h.join(W,$);if(await s(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 s(H)){if(J.debug)console.log(`Found in views path with extension: ${H}`);if(X)X.add(H);return H}}if(Q.includes("temp")){let H=h.join(h.dirname(Q),"layouts",$);if(await s(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 s(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 F8($,Z,J){let X=0,Q="",Y="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
|
|
3626
|
-
`),z=0;for(let q=0;q<G.length;q++)if(z+=G[q].length+1,z>=Z){X=q+1,Q=G[q].trim();let K=Math.max(0,q-2),W=Math.min(G.length,q+3);Y=G.slice(K,W).map((U,H)=>{let j=K+H+1;return`${j===X?"> ":" "}${j}: ${U}`}).join(`
|
|
3627
|
-
`);break}}else if(J){let G=$.indexOf(J);if(G>=0)return F8($,G)}}catch{}return{lineNumber:X,lineContent:Q,context:Y}}var t={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 H0($,Z,J,X,Q,Y){let{lineNumber:G,context:z}=F8(X,Q,Y),q=J.split("/").pop(),K=0;if(typeof Q==="number"&&Q>=0&&X){let U=X.lastIndexOf(`
|
|
3628
|
-
`,Math.max(0,Q-1));K=Q-(U+1)+1}let W="";if(G>0)W+=`
|
|
3629
|
-
${J}:${G}${K>0?`:${K}`:""}: ${$.toLowerCase()} error: ${Z}
|
|
3630
|
-
`;if(W+=`
|
|
3631
|
-
${t.bold}${t.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${t.reset}
|
|
3632
|
-
`,W+=`${t.bold}${t.red}\u2502${t.reset} ${t.bold}${t.bgRed} ERROR ${t.reset} ${t.red}${$} Error${t.reset}${" ".repeat(Math.max(0,43-$.length))}${t.bold}${t.red}\u2502${t.reset}
|
|
3633
|
-
`,W+=`${t.bold}${t.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${t.reset}
|
|
3634
|
-
`,W+=`
|
|
3635
|
-
${t.cyan}${t.bold}File:${t.reset} ${t.dim}${q}${t.reset}`,G>0)W+=` ${t.gray}(line ${G}${K>0?`, col ${K}`:""})${t.reset}`;if(W+=`
|
|
3636
|
-
${t.yellow}${t.bold}Message:${t.reset} ${Z}
|
|
3637
|
-
`,z)W+=`
|
|
3638
|
-
${t.blue}${t.bold}Context:${t.reset}
|
|
3639
|
-
${t.dim}${z}${t.reset}
|
|
3640
|
-
`;return W}function E_(){N2.clear(),k9.clear(),I9.clear()}function b_(){return{size:N2.size,maxSize:500}}var k$=I1(128);async function xG($,Z,J){let X=j1($,Z,J),Q=k$.get(X);if(Q){if(V8(Q.deps))return Q;k$.delete(X)}let Y=E$($,{filePath:Z,projectRoot:process.cwd()}),G=Y.code,z=b$(Y.styles);G=a1(G).code;let{hasUserImports:q,bundleClientScript:K}=await n("stx/client-script-bundler",()=>import("./chunk-h7d01cy7.js")),W=[],U=!1;if(q(G)){let L=G;G=await K(L,Z,{projectRoot:process.cwd(),minify:J,collectInputs:W}),U=G===L}let{stripStxRuntimeImports:H}=await n("stx/signal-processing",()=>import("./chunk-4qj6pq60.js"));G=H(G);let j=Z1(G),B=TG(j),_=`function(__scopeId) {
|
|
3641
|
-
${p1("const",[...B8,...B],j)}
|
|
3642
|
-
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
3643
|
-
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
3644
|
-
__scopeVars.$refs = __scopeVars.$refs || {};
|
|
3645
|
-
const __previousCurrentElement = window.__STX_CURRENT_ELEMENT__;
|
|
3646
|
-
window.__STX_CURRENT_ELEMENT__ = document.querySelector('[data-stx-scope="' + __scopeId + '"]');
|
|
3647
|
-
|
|
3648
|
-
// Scope-specific lifecycle callbacks
|
|
3649
|
-
__scopeVars.__mountCallbacks = __scopeVars.__mountCallbacks || [];
|
|
3650
|
-
__scopeVars.__destroyCallbacks = __scopeVars.__destroyCallbacks || [];
|
|
3651
|
-
const onMount = (fn) => __scopeVars.__mountCallbacks.push(fn);
|
|
3652
|
-
const onDestroy = (fn) => __scopeVars.__destroyCallbacks.push(fn);
|
|
3653
|
-
|
|
3654
|
-
try {
|
|
3655
|
-
${j}
|
|
3656
|
-
|
|
3657
|
-
// Register all defined signals and functions in this scope
|
|
3658
|
-
const __localVars = {};
|
|
3659
|
-
try {
|
|
3660
|
-
${B.map((L)=>`if (typeof ${L} !== 'undefined') __localVars['${L}'] = ${L};`).join(`
|
|
3661
|
-
`)}
|
|
3662
|
-
}
|
|
3663
|
-
catch (e) {}
|
|
3664
|
-
Object.assign(__scopeVars, __localVars);
|
|
3665
|
-
}
|
|
3666
|
-
finally {
|
|
3667
|
-
window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
|
|
3668
|
-
}
|
|
3669
|
-
}`,F={vendorStyleTags:z,factoryBody:_,deps:_8([...W,...Y.styles.map((L)=>L.resolvedPath)])};if(!U&&Y.unresolved.length===0)k$.set(X,F);return F}var gG=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function hG($){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 uG($,Z){let J=Z;while(!0){let X=E1.join(J,"node_modules",$,"package.json");if(A2.existsSync(X))return E1.dirname(X);let Q=E1.dirname(J);if(Q===J)return null;J=Q}}function dG($,Z){if(!$||typeof $!=="object")return null;let J=(Q)=>{if(typeof Q==="string")return Q;if(Q&&typeof Q==="object"){if(typeof Q.import==="string")return Q.import;if(typeof Q.default==="string")return Q.default;if(typeof Q.import==="object")return J(Q.import);if(typeof Q.default==="object")return J(Q.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return J($[Z]);let X=null;for(let Q of Object.keys($)){let Y=Q.indexOf("*");if(Y===-1)continue;let G=Q.slice(0,Y),z=Q.slice(Y+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:Q,prefix:G,suffix:z}}if(X){let Q=Z.slice(X.prefix.length,Z.length-X.suffix.length),Y=J($[X.pattern]);if(Y)return Y.replace("*",Q)}return null}function mG($,Z){let J=hG($);if(!J||!J.subpath)return null;let X=uG(J.pkg,Z);if(!X)return null;let Q;try{Q=JSON.parse(A2.readFileSync(E1.join(X,"package.json"),"utf8"))}catch{return null}let Y=`.${J.subpath}`,G=dG(Q.exports,Y);if(!G)return null;let z=E1.resolve(X,G);return A2.existsSync(z)?z:null}function E$($,Z){let J=Z.filePath?E1.dirname(Z.filePath):Z.projectRoot||process.cwd(),X=Z.projectRoot||process.cwd(),Q=new Set,Y=[],G=[];return{code:$.replace(gG,(q,K)=>{let W;try{if(K.startsWith("./")||K.startsWith("../")||K.startsWith("/")){if(W=K.startsWith("/")?K:E1.resolve(J,K),!A2.existsSync(W))throw Error(`file not found: ${W}`)}else{let U=null;try{U=Bun.resolveSync(K,X)}catch{U=mG(K,X)}if(!U)throw Error(`could not resolve ${K} (Bun.resolveSync + exports fallback both failed)`);W=U}}catch(U){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(K)} (from ${Z.filePath||"<unknown>"}): ${U?.message||U}`),G.push(K),""}if(Q.has(W))return"";Q.add(W);try{let U=A2.readFileSync(W,"utf8");Y.push({source:K,resolvedPath:W,contents:U})}catch(U){console.warn(`[stx:vendor-css] could not read ${W}: ${U?.message||U}`),G.push(K)}return""}),styles:Y,unresolved:G}}function lG($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function b$($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${lG(Z.source)}" data-stx-layer="vendor">
|
|
3670
|
-
@layer vendor {
|
|
3671
|
-
${Z.contents}
|
|
3672
|
-
}
|
|
3673
|
-
</style>`}).join(`
|
|
3674
|
-
`)}
|
|
3675
|
-
`}var cG=N8;function a1($){let Z=x0($),J=new Set;for(let z of $.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let q of z[1].split(",")){let K=q.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(K)J.add(K)}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 q of z[1].split(",")){let K=q.trim().split(/[:=]/).pop()?.trim();if(K)X.add(K)}let Q=w2.filter((z)=>{if(J.has(z)||X.has(z))return!1;return new RegExp(`\\b${z}\\s*\\(`).test(Z)}),Y=k8(Z).filter((z)=>!J.has(z)&&!X.has(z));if(Q.length===0&&Y.length===0)return{code:$,imports:Q,models:Y};return{code:`${[Q.length>0?`import { ${Q.join(", ")} } from '@stacksjs/browser'`:"",Y.length>0?"import '@stacksjs/browser'":"",Y.length>0?`const { ${Y.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
|
|
3676
|
-
`)}
|
|
3677
|
-
${$}`,imports:Q,models:Y}}var pG=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 k8($){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(!pG.has(X[1]))Z.add(X[1]);return Array.from(Z)}function iG($){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 Q=X.trim().split(/[:=]/).pop()?.trim();if(Q&&/^[A-Za-z_$][\w$]*$/.test(Q))Z.add(Q)}return Z}function I8($){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 Q=new Set,Y=/^[ \t]*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"][ \t]*;?[ \t]*$/gm,G;while((G=Y.exec($))!==null){let U=G[1],H=G[2];if(G[0].includes("import type"))continue;let j=[];for(let _ of U.split(",")){let F=_.trim();if(!F||F.startsWith("type "))continue;let L=F.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!L)continue;let O=L[1],V=L[2]||O;if(Q.add(O),Q.add(V),H==="stx"||H==="@stacksjs/stx")Z.add(O);else J.add(O);if(V!==O)j.push(`${V} = ${O}`)}let B=j.length>0?`var ${j.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";X=X.replace(G[0],B)}let z=iG(X);for(let U of cG){if(Q.has(U)||z.has(U))continue;if(new RegExp(`\\b${U}\\s*(?:<[^>]*>)?\\s*\\(`,"g").test(X))Z.add(U)}let q=x0(X),K=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 _=B.trim();if(_)K.add(_)}}for(let U of w2){if(Q.has(U)||z.has(U)||K.has(U))continue;if(new RegExp(`\\b${U}\\b`,"g").test(q))J.add(U)}let W=k8(X);for(let U of W)if(!Q.has(U)&&!z.has(U))J.add(U);return{code:X,stxImports:Array.from(Z),browserImports:Array.from(J)}}function T8($,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
|
|
3678
|
-
${J.join(`
|
|
3679
|
-
`)}
|
|
3680
|
-
${nG($,Z)}`;return""}function i_($,Z=[]){let{browserImports:J}=I8($),X=new Set(Z);return T8([],J.filter((Q)=>!X.has(Q)))}function nG($,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
|
|
3681
|
-
[${J.join(", ")}].forEach(function (e) {
|
|
3682
|
-
if (e[1] !== 'undefined') return;
|
|
3683
|
-
console.error(
|
|
3684
|
-
'[stx] "' + e[0] + '" is used in this client script and auto-imported from ' + e[2] + ', '
|
|
3685
|
-
+ 'but the client runtime does not provide it. Either it is not exported to the browser, '
|
|
3686
|
-
+ 'or it should be imported from a relative path so the bundler includes it.'
|
|
3687
|
-
);
|
|
3688
|
-
});
|
|
3689
|
-
`}function D9($){let Z=$.__stxClientPayload;if(Z&&typeof Z==="object"){let X={};for(let Q in Z){let Y=Z[Q];if(typeof Y==="function")continue;X[Q]=Y}return X.__stxDeclaredPayload=!0,X}let J={};for(let X in $){if(X.startsWith("__")||X.startsWith("$"))continue;let Q=$[X];if(typeof Q==="function")continue;J[X]=Q}return J}function w8($,Z){let J=new Set;for(let X of $.split(",")){let Q=X.trim().replace(/^\.\.\./,"").trim();if(!Q)continue;if(Z){let Y=Q.lastIndexOf(":");if(Y!==-1)Q=Q.slice(Y+1).trim()}if(Q=Q.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(Q))J.add(Q)}return J}function oG($,Z){let J=x0($),{depths:X,balanced:Q}=M8(J),Y=(z)=>!Q||X[z]===0,G=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${Z}\\b)`,"g");for(let z of J.matchAll(G)){let q=(z.index??0)+z[0].length-z[1].length;if(Y(q))return!0}for(let z of J.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(Y(z.index??0)&&w8(z[1],!0).has(Z))return!0;for(let z of J.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(Y(z.index??0)&&w8(z[1],!1).has(Z))return!0;return!1}function sG($,Z){return new RegExp(`(?<![.#\\w$])${Z}(?![\\w$])`).test($)}var rG=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,R8=new Set;function aG($,Z){let J=rG.test($),X=Z.length>32768;if(!J&&!X)return;if(R8.has($))return;if(R8.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 j$($,Z){if(!Z)return"";let J=x0($),X=Z.__stxDeclaredPayload===!0,Q=[];for(let[Y,G]of Object.entries(Z)){if(!/^[A-Za-z_$][\w$]*$/.test(Y))continue;if(Y.startsWith("__")||Y.startsWith("$"))continue;if(!X&&!sG(J,Y))continue;if(oG($,Y)){if(X)console.warn(`[stx] defineClientPayload declares "${Y}", but this client block also declares "${Y}" at the top level, so the server value is not published (emitting it would be a duplicate binding). Rename the local, or drop "${Y}" from defineClientPayload.`);continue}let z;try{z=JSON.stringify(G)}catch{continue}if(z===void 0)continue;aG(Y,z),Q.push(` var ${Y} = ${z.replace(/</g,"\\u003c")};`)}if(Q.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
|
|
3690
|
-
${Q.join(`
|
|
3691
|
-
`)}
|
|
3692
|
-
`}var tG={left:0,middle:1,right:2};function eG($){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=tG[$.mouse];Z.push(`if ($event.button !== ${J}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function $z($,Z){let{elementId:J,event:X,modifiers:Q}=$,Y=b9($.handler),G=eG(Q),z=[];if(Q.once)z.push("once: true");if(Q.capture)z.push("capture: true");if(Q.passive)z.push("passive: true");let q=z.length>0?`, { ${z.join(", ")} }`:"",K="";if(G)K+=`${G}; `;let W=Y.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),U=`var $emit = function(name, detail) {
|
|
3693
|
-
$el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
|
|
3694
|
-
};`;function H(j){if(/\$emit\s*\(/.test(j))return`${U}
|
|
3695
|
-
${j}`;return`var scope = $el.closest('[data-stx-scope]');
|
|
3696
|
-
if (scope && scope.__stx_execute) {
|
|
3697
|
-
scope.__stx_execute('${W}', $event, $el);
|
|
3698
|
-
}
|
|
3699
|
-
else {
|
|
3700
|
-
${j}
|
|
3701
|
-
}`}if(Q.debounce!==null)return` ;(function() {
|
|
3702
|
-
// eslint-disable-next-line pickier/no-unused-vars
|
|
3703
|
-
var $el = document.getElementById('${J}')
|
|
3704
|
-
if (!$el) return
|
|
3705
|
-
var __timer
|
|
3706
|
-
$el.addEventListener('${X}', function($event) {
|
|
3707
|
-
${G?G+"; ":""}clearTimeout(__timer)
|
|
3708
|
-
__timer = setTimeout(function() { ${H(Y)} }, ${Q.debounce})
|
|
3709
|
-
}${q})
|
|
3710
|
-
})()`;if(Q.throttle!==null)return` ;(function() {
|
|
3711
|
-
// eslint-disable-next-line pickier/no-unused-vars
|
|
3712
|
-
var $el = document.getElementById('${J}')
|
|
3713
|
-
if (!$el) return
|
|
3714
|
-
var __last = 0
|
|
3715
|
-
$el.addEventListener('${X}', function($event) {
|
|
3716
|
-
${G?G+"; ":""}var __now = Date.now()
|
|
3717
|
-
if (__now - __last >= ${Q.throttle}) {
|
|
3718
|
-
__last = __now
|
|
3719
|
-
${H(Y)}
|
|
3720
|
-
}
|
|
3721
|
-
}${q})
|
|
3722
|
-
})()`;if(/\$emit\s*\(/.test(Y))return` var $el = document.getElementById('${J}')
|
|
3723
|
-
if ($el) $el.addEventListener('${X}', function($event) {
|
|
3724
|
-
${K}${U}
|
|
3725
|
-
${Y}
|
|
3726
|
-
}${q})`;return` var $el = document.getElementById('${J}')
|
|
3727
|
-
if ($el) $el.addEventListener('${X}', function($event) {
|
|
3728
|
-
${K}var scope = $el.closest('[data-stx-scope]');
|
|
3729
|
-
if (scope && scope.__stx_execute) {
|
|
3730
|
-
scope.__stx_execute('${W}', $event, $el);
|
|
3731
|
-
}
|
|
3732
|
-
else {
|
|
3733
|
-
${Y}
|
|
3734
|
-
}
|
|
3735
|
-
}${q})`}function Zz($){if($.length===0)return"";return`
|
|
3736
|
-
// STX: auto-generated event bindings
|
|
3737
|
-
${$.map((J,X)=>$z(J,X)).join(`
|
|
3738
|
-
`)}`}function D8($){let Z=[],J=new Set,X=$.replace(/^\s*import\s+.*$/gm,""),Q=0,Y=X.length,G=0;while(G<Y){let z=X[G];if(z==="'"||z==='"'||z==="`"){let q=z;if(G++,q==="`"){let K=0;while(G<Y){if(X[G]==="\\"){G+=2;continue}if(X[G]==="`"&&K===0){G++;break}if(X[G]==="$"&&X[G+1]==="{"){K++,G+=2;continue}if(X[G]==="}"&&K>0){K--,G++;continue}G++}}else while(G<Y){if(X[G]==="\\"){G+=2;continue}if(X[G]===q){G++;break}G++}continue}if(z==="/"&&X[G+1]==="/"){while(G<Y&&X[G]!==`
|
|
3739
|
-
`)G++;continue}if(z==="/"&&X[G+1]==="*"){G+=2;while(G<Y-1&&!(X[G]==="*"&&X[G+1]==="/"))G++;G+=2;continue}if(z==="{"){Q++,G++;continue}if(z==="}"){Q--,G++;continue}if(Q===0){let q=X.slice(G),K=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(K){let H=K[1];if(!H.startsWith("_")&&!J.has(H))Z.push(H),J.add(H);G+=K[0].length;continue}let W=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(W){W[1].split(",").forEach((H)=>{let j=H.trim(),B=j.indexOf(":"),_=B>=0?j.slice(B+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(_&&!_.startsWith("_")&&!J.has(_))Z.push(_),J.add(_)}),G+=W[0].length;continue}let U=q.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 Jz=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 Xz($){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(!Jz.has(B))Z.add(B)}}let Q=/\{\{([\s\S]*?)\}\}/g,Y;while((Y=Q.exec($))!==null)X(Y[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Y=G.exec($))!==null)X(Y[1]);let z=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Y=z.exec($))!==null)X(Y[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Y=q.exec($))!==null)X(Y[1]);let K=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Y=K.exec($))!==null)X(Y[1]);let W=/@model\s*=\s*["']([^"']*)["']/gi;while((Y=W.exec($))!==null)X(Y[1]);let U=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Y=U.exec($))!==null)X(Y[1]);return Z}async function N9($,Z={}){let J=$,X="",Q=!1,Y=[],G=E$(J,{filePath:Z.filePath,projectRoot:Z.projectRoot});J=G.code;let z=b$(G.styles),q=a1(J);J=q.code,Y=[...q.imports,...q.models];let{hasUserImports:K,bundleClientScript:W}=await n("stx/client-script-bundler",()=>import("./chunk-h7d01cy7.js"));if(K(J))J=await W(J,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Q=!0;if(Z.autoImports!==!1){let V=I8(J);J=V.code,X=T8(V.stxImports,V.browserImports.filter((w)=>!Y.includes(w)))}if(X=`${j$(J,Z.serverData)}${X}`,J=Z1(J),!Q&&A1(Z.attrs||""))J=M1(J);let U=Zz(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 V=H.replace(/\btype\s*=\s*["']module["']/i,"").trim(),w=`type="module" data-stx-scoped${B}${V?` ${V}`:""}`;return`${z}<script ${w}>
|
|
3740
|
-
${r1(`${X}${J}
|
|
3741
|
-
${U}`)}
|
|
3742
|
-
</script>`}let _=A8($),F=/function __stx_setup_/.test(J),L=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function O(V){let w=V.length>0?`
|
|
3743
|
-
return { ${V.join(", ")} };`:"";return`${z}<script data-stx-scoped data-stx-run="always"${B}>
|
|
3744
|
-
window.stx.mount(function() {
|
|
3745
|
-
'use strict';
|
|
3746
|
-
${r1(`${X}${J}
|
|
3747
|
-
${U}${w}`)}
|
|
3748
|
-
})</script>`}if(!L&&!F){if(_)return O(D8($));if(Z.templateContent){let V=D8($);if(V.length>0){let w=Xz(Z.templateContent);if(V.some((D)=>w.has(D)))return O(V)}}}return`${z}<script data-stx-scoped data-stx-run="always"${B}>
|
|
3749
|
-
;(function() {
|
|
3750
|
-
'use strict';
|
|
3751
|
-
${r1(`${X}${J}
|
|
3752
|
-
${U}`)}
|
|
3753
|
-
})()</script>`}
|
|
3754
|
-
export{QZ as pl,GZ as ql,zZ as rl,e0 as sl,g9 as tl,h9 as ul,u9 as vl,d9 as wl,U3 as xl,W3 as yl,_Z as zl,LZ as Al,FZ as Bl,xz as Cl,gz as Dl,hz as El,uz as Fl,dz as Gl,XZ as Hl,G3 as Il,z3 as Jl,q3 as Kl,K3 as Ll,vz as Ml,R3 as Nl,G2 as Ol,b9 as Pl,y9 as Ql,v8 as Rl,h$ as Sl,Qz as Tl,w2 as Ul,t1 as Vl,yj as Wl,E$ as Xl,b$ as Yl,cG as Zl,a1 as _l,I8 as $l,T8 as am,i_ as bm,D9 as cm,j$ as dm,N9 as em,Kz as fm,P2 as gm,Wz as hm,Uz as im,Hz as jm,jz as km,f2 as lm,g8 as mm,Rz as nm,h8 as om,Dz as pm,P9 as qm,r$ as rm,Y1 as sm,v9 as tm,m8 as um,Nz as vm,V1 as wm,l8 as xm,S0 as ym,Az as zm,Iz as Am,r8 as Bm,a8 as Cm,X3 as Dm,Y3 as Em,Q3 as Fm,Sz as Gm,H3 as Hm,l9 as Im,Y2 as Jm,x2 as Km,pz as Lm,m9 as Mm,DZ as Nm,NZ as Om,AZ as Pm,iz as Qm,B3 as Rm,_3 as Sm,z1 as Tm,o2 as Um,L0 as Vm,z7 as Wm,W5 as Xm,q1 as Ym,O1 as Zm,q7 as _m,W2 as $m,s2 as an,U5 as bn,SJ as cn,vJ as dn,U7 as en,xJ as fn,gJ as gn,j7 as hn,F1 as in,nK as jn,B7 as kn,L5 as ln,lJ as mn,V5 as nn,cJ as on,pJ as pn,oK as qn,sK as rn,_7 as sn,V7 as tn,L7 as un,iJ as vn,nJ as wn,rK as xn,aK as yn,oJ as zn,tK as An,eK as Bn,w7 as Cn,A7 as Dn,w5 as En,WW as Fn,j2 as Gn,R5 as Hn,D5 as In,UW as Jn,WX as Kn,HW as Ln,UX as Mn,I7 as Nn,jW as On,HX as Pn,BW as Qn,_W as Rn,a2 as Sn,y7 as Tn,yW as Un,CW as Vn,SW as Wn,PW as Xn,CX as Yn,e7 as Zn,Q4 as _n,cX as $n,p5 as ao,a4 as bo,Jj as co,Z6 as do,$Q as eo,Tj as fo,QQ as go,B6 as ho,_$ as io,_6 as jo,L6 as ko,V$ as lo,RQ as mo,DQ as no,O6 as oo,K6 as po,NQ as qo,MQ as ro,Q8 as so,WG as to,UG as uo,HG as vo,jG as wo,BG as xo,G8 as yo,OG as zo,DG as Ao,NG as Bo,F4 as Co,w4 as Do,QH as Eo,W4 as Fo,GH as Go,n5 as Ho,o5 as Io,s5 as Jo,A4 as Ko,M4 as Lo,k4 as Mo,p3 as No,i3 as Oo,n3 as Po,o3 as Qo,J5 as Ro,X5 as So,mq as To,lq as Uo,cq as Vo,GJ as Wo,pq as Xo,EH as Yo,bH as Zo,T4 as _o,yH as $o,LY as ap,b4 as bp,P4 as cp,Z$ as dp,SY as ep,J$ as fp,h4 as gp,u4 as hp,mY as ip,dH as jp,mH as kp,d4 as lp,lH as mp,cH as np,X$ as op,c4 as pp,V9 as qp,L9 as rp,s1 as sp,cY as tp,i4 as up,n4 as vp,nH as wp,G$ as xp,pY as yp,iY as zp,z$ as Ap,q$ as Bp,o4 as Cp,s4 as Dp,L$ as Ep,O$ as Fp,R$ as Gp,N$ as Hp,tQ as Ip,XG as Jp,YG as Kp,QG as Lp,GG as Mp,kG as Np,A1 as Op,M$ as Pp,M1 as Qp,X9 as Rp,CG as Sp,SG as Tp,PG as Up,N1 as Vp,s as Wp,l2 as Xp,F8 as Yp,H0 as Zp,E_ as _p,b_ as $p,D3 as aq,N3 as bq,L1 as cq,A3 as dq,y1 as eq,M3 as fq,z2 as gq,Qq as hq,gZ as iq,p9 as jq,Gq as kq,i9 as lq,zq as mq,qq as nq,G1 as oq,Kq as pq,Wq as qq,Uq as rq,Hq as sq,jq as tq,Bq as uq,hZ as vq,o9 as wq,k3 as xq,Vq as yq,Lq as zq,Oq as Aq,Fq as Bq,wq as Cq,T3 as Dq,Rq as Eq,E3 as Fq,Dq as Gq,Nq as Hq,q2 as Iq,pZ as Jq,Iq as Kq,nZ as Lq,v3 as Mq,d2 as Nq,Sq as Oq,m3 as Pq,Z5 as Qq,aq as Rq,Q5 as Sq,HJ as Tq,VJ as Uq,tq as Vq,eq as Wq,$K as Xq,ZK as Yq,JK as Zq,XK as _q,LJ as $q,OJ as ar,s3 as br,Y7 as cr,DJ as dr,z5 as er,Q7 as fr,FK as gr,wK as hr,K5 as ir,TJ as jr,G7 as kr};
|