@stacksjs/stx 0.2.753 → 0.2.755
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-qeyjbnpn.js → chunk-024m1xmd.js} +6 -6
- package/dist/{chunk-1bk3t4s1.js → chunk-0dsykna3.js} +5 -5
- package/dist/{chunk-n3t2cd17.js → chunk-0dt7ax79.js} +2 -2
- package/dist/{chunk-qksbf2gt.js → chunk-0fweckq5.js} +6 -6
- package/dist/{chunk-yax8wz93.js → chunk-0md73jp8.js} +2 -2
- package/dist/{chunk-5hrm7rtx.js → chunk-0tgrqhkr.js} +12 -12
- package/dist/{chunk-p4h5c79q.js → chunk-0vvb78yj.js} +5 -5
- package/dist/{chunk-67z3kesf.js → chunk-1a2cwee1.js} +2 -2
- package/dist/chunk-1gan06yr.js +2 -0
- package/dist/chunk-1menbxwb.js +2 -0
- package/dist/chunk-1n2d3cy5.js +2 -0
- package/dist/{chunk-pnpd7gz7.js → chunk-1tmq09ch.js} +3 -3
- package/dist/{chunk-kyk4ekng.js → chunk-236bdf7y.js} +2 -2
- package/dist/chunk-2vc2pkyz.js +2 -0
- package/dist/chunk-33bp9m4c.js +2 -0
- package/dist/chunk-361yezje.js +2 -0
- package/dist/{chunk-7t9wj2m4.js → chunk-3ap06zzx.js} +1 -1
- package/dist/{chunk-c0v9ng82.js → chunk-3z38swhv.js} +7 -7
- package/dist/{chunk-02c0zcaw.js → chunk-41sq06t2.js} +2 -2
- package/dist/chunk-45cvagp1.js +2 -0
- package/dist/{chunk-9hfk5wf1.js → chunk-4fc8zs15.js} +5 -5
- package/dist/{chunk-jq6gggcz.js → chunk-4zta7ay1.js} +2 -2
- package/dist/{chunk-srjhnk6w.js → chunk-5evgz54v.js} +30 -30
- package/dist/chunk-5f0wwwmw.js +2 -0
- package/dist/chunk-5h71xbzk.js +2 -0
- package/dist/{chunk-8qhw7me1.js → chunk-5q2tfrcw.js} +2 -2
- package/dist/{chunk-3yz7fafy.js → chunk-5wcgg5t4.js} +1 -1
- package/dist/chunk-5z9a1vzw.js +2 -0
- package/dist/chunk-67jf2e8x.js +2 -0
- package/dist/chunk-6b7je8dc.js +2 -0
- package/dist/chunk-6fxjs3ay.js +3 -0
- package/dist/chunk-6n5jnd97.js +2 -0
- package/dist/chunk-6wvnfdqq.js +2 -0
- package/dist/{chunk-6z8rdsc6.js → chunk-6ywa41tr.js} +2 -2
- package/dist/{chunk-vzn029zn.js → chunk-73b6sst8.js} +3 -3
- package/dist/chunk-78jkbaz3.js +2 -0
- package/dist/{chunk-g7shwb6q.js → chunk-7djnbbeb.js} +6 -6
- package/dist/chunk-7e9hfrtb.js +2 -0
- package/dist/{chunk-fcp5mde5.js → chunk-7mm5mvg0.js} +2 -2
- package/dist/{chunk-g019qe9x.js → chunk-7r5vhqtz.js} +4 -4
- package/dist/chunk-7tc5fj96.js +2 -0
- package/dist/{chunk-myr79xxf.js → chunk-7ycf8a8d.js} +2 -2
- package/dist/{chunk-r3v1zaj0.js → chunk-81ysx0tc.js} +2 -2
- package/dist/chunk-82q0fy52.js +2 -0
- package/dist/chunk-8q5ec4s1.js +2 -0
- package/dist/{chunk-9d9rn9qs.js → chunk-8w0cwcvk.js} +81 -81
- package/dist/{chunk-80gbx1jn.js → chunk-8wbcy0cn.js} +3 -3
- package/dist/{chunk-k4yjbkgb.js → chunk-8wbgq43c.js} +3 -3
- package/dist/chunk-8ysk095d.js +2 -0
- package/dist/{chunk-hnzfzm0k.js → chunk-90gx5qxn.js} +4 -4
- package/dist/{chunk-h7y2pmd9.js → chunk-9q1kkfv1.js} +6 -6
- package/dist/{chunk-hc6m2t92.js → chunk-9r3ehqtx.js} +2 -2
- package/dist/chunk-9vbrj55v.js +2 -0
- package/dist/chunk-bcefawtc.js +2 -0
- package/dist/chunk-bd6s91p9.js +2 -0
- package/dist/chunk-bhkqzz91.js +2 -0
- package/dist/{chunk-tg8z1h11.js → chunk-bkkwdh13.js} +2 -2
- package/dist/chunk-bx1mjwhb.js +2 -0
- package/dist/{chunk-bd4c8af4.js → chunk-c3dphs36.js} +1 -1
- package/dist/{chunk-rt5as4t6.js → chunk-c85j39f7.js} +3 -3
- package/dist/{chunk-snfmgp7a.js → chunk-cb4ybh7g.js} +4 -4
- package/dist/{chunk-41yjah34.js → chunk-cmaxdd8d.js} +2 -2
- package/dist/{chunk-amwxbvdp.js → chunk-d2vsw1j7.js} +2 -2
- package/dist/{chunk-9b5k0fvr.js → chunk-d73hh5ar.js} +1 -1
- package/dist/{chunk-rzqd4t77.js → chunk-df8cbgf0.js} +2 -2
- package/dist/{chunk-8mkxge3a.js → chunk-dvakr9p9.js} +4 -4
- package/dist/chunk-dw0m259e.js +2 -0
- package/dist/chunk-dx4g2ec9.js +2 -0
- package/dist/chunk-evdskc25.js +2 -0
- package/dist/{chunk-neh3kewg.js → chunk-fa3ygt8c.js} +4 -4
- package/dist/{chunk-s20j5yns.js → chunk-fmxtnva8.js} +2 -2
- package/dist/{chunk-k7p9wkw3.js → chunk-fxftc455.js} +2 -2
- package/dist/{chunk-1sb6z37d.js → chunk-g223zsce.js} +3 -3
- package/dist/{chunk-vfe8xj8g.js → chunk-g22absm0.js} +2 -2
- package/dist/{chunk-dg1h0d9r.js → chunk-g45p4y4v.js} +3 -3
- package/dist/{chunk-37j288h1.js → chunk-g5sctfwa.js} +10 -10
- package/dist/chunk-gppv6fez.js +2 -0
- package/dist/chunk-grjr8shp.js +2 -0
- package/dist/chunk-gz1w4cpp.js +2 -0
- package/dist/chunk-gzbmfwxr.js +42 -0
- package/dist/chunk-h0qtmmq3.js +2 -0
- package/dist/chunk-h6sewvt2.js +20 -0
- package/dist/chunk-hb34m4pp.js +2 -0
- package/dist/chunk-hwvtpx3p.js +2 -0
- package/dist/{chunk-vpzadc7t.js → chunk-j2hm8v8b.js} +4 -4
- package/dist/{chunk-kf80wm87.js → chunk-j3d9zknp.js} +6 -6
- package/dist/{chunk-3h2e5jte.js → chunk-j5p191zq.js} +7 -7
- package/dist/chunk-k3kav39s.js +2 -0
- package/dist/chunk-k46j2maz.js +2 -0
- package/dist/{chunk-mdsrnd6s.js → chunk-k4dn3ry6.js} +4 -4
- package/dist/{chunk-rra9xhgg.js → chunk-k9m36nyw.js} +5 -5
- package/dist/chunk-ka2f844k.js +2 -0
- package/dist/chunk-kh4dr6gd.js +2 -0
- package/dist/{chunk-8q8202pj.js → chunk-kjfzkac7.js} +7 -7
- package/dist/{chunk-ecpr2jsc.js → chunk-m0shnhth.js} +3 -3
- package/dist/{chunk-qeh8f4bk.js → chunk-m6w75sq2.js} +2 -2
- package/dist/{chunk-qmy12s7k.js → chunk-mpmx0n3q.js} +28 -28
- package/dist/chunk-myd82d80.js +2 -0
- package/dist/chunk-nek0q523.js +130 -0
- package/dist/{chunk-4nmb776w.js → chunk-nmy72s6r.js} +2 -2
- package/dist/{chunk-9mtc6m11.js → chunk-np8knskz.js} +1 -1
- package/dist/{chunk-5s8bt976.js → chunk-nsjkmpjf.js} +1 -1
- package/dist/chunk-nvbjcgzd.js +2 -0
- package/dist/{chunk-664tnv9e.js → chunk-nzy4set0.js} +5 -5
- package/dist/chunk-p13dxvaj.js +2 -0
- package/dist/{chunk-6fhcmg96.js → chunk-p2v0r96k.js} +2 -2
- package/dist/{chunk-y1h6z9cy.js → chunk-p33w8zst.js} +3 -3
- package/dist/chunk-pht5z7wa.js +2 -0
- package/dist/{chunk-572rs7vb.js → chunk-ppvdbstz.js} +3 -3
- package/dist/chunk-pwdk7jbx.js +2 -0
- package/dist/{chunk-ecf9tftk.js → chunk-pydmzvpq.js} +1 -1
- package/dist/{chunk-ftk2jdg8.js → chunk-q0f28539.js} +2 -2
- package/dist/chunk-qekyxjy6.js +2 -0
- package/dist/{chunk-fgg1stc0.js → chunk-qpb80r4b.js} +2 -2
- package/dist/{chunk-smpb39kv.js → chunk-qxrsm48h.js} +5 -5
- package/dist/chunk-r10eadgn.js +2 -0
- package/dist/chunk-r8184e10.js +2 -0
- package/dist/{chunk-8zr9xhf3.js → chunk-rshaz0df.js} +1 -1
- package/dist/{chunk-r6s35xw9.js → chunk-sj2a5twe.js} +2 -2
- package/dist/chunk-tcrpa52j.js +2 -0
- package/dist/{chunk-zpqqdyb4.js → chunk-thr1m7k7.js} +18 -18
- package/dist/{chunk-wjtn0ywp.js → chunk-txgd0sj1.js} +5 -5
- package/dist/{chunk-tary163t.js → chunk-v0s52tmv.js} +2 -2
- package/dist/{chunk-3tg9bsbc.js → chunk-vc4jww9y.js} +13 -13
- package/dist/chunk-vp1p250v.js +2 -0
- package/dist/{chunk-mcdwjq8t.js → chunk-vpa4xzz3.js} +1 -1
- package/dist/chunk-vqrg5j83.js +2 -0
- package/dist/chunk-vzdfq3b5.js +2 -0
- package/dist/chunk-wzh4ene8.js +2 -0
- package/dist/{chunk-8x3axvek.js → chunk-x5sy0tym.js} +6 -6
- package/dist/chunk-x5vwkccx.js +2 -0
- package/dist/chunk-x6cmj5sa.js +2 -0
- package/dist/chunk-xnrfz4c3.js +2 -0
- package/dist/{chunk-5bkha4ej.js → chunk-xrzghjvy.js} +2 -2
- package/dist/{chunk-we96m579.js → chunk-xzz36k99.js} +2 -2
- package/dist/chunk-yaabhcss.js +2 -0
- package/dist/chunk-yazqtmq4.js +2 -0
- package/dist/{chunk-5afjh2ms.js → chunk-yd2nj0rv.js} +1 -1
- package/dist/{chunk-0p6fpsw5.js → chunk-z5kdmget.js} +3 -3
- package/dist/{chunk-sva555j3.js → chunk-zqmvhg37.js} +10 -10
- package/dist/chunk-zygpvm1x.js +2 -0
- package/dist/chunk-zz247c1r.js +2 -0
- package/dist/cli.js +19 -19
- package/dist/client-script-bundler.d.ts +3 -2
- package/dist/client-script-bundler.js +2 -2
- package/dist/component-image-usage.d.ts +2 -0
- package/dist/component-image-usage.js +13 -0
- package/dist/component-renderer.js +7 -2
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/native/compiler/inline-style.js +16 -6
- package/dist/native/compiler/ir.d.ts +2 -0
- package/dist/native/compiler/render-screen.js +1 -1
- package/dist/native/components/primitives.d.ts +2 -0
- package/dist/native/prop-names.js +2 -0
- package/dist/native/runtime/browser-renderer.js +6 -0
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +4 -4
- package/dist/utils.js +2 -1
- package/package.json +5 -5
- package/dist/chunk-02kkd7fy.js +0 -2
- package/dist/chunk-051evb5w.js +0 -2
- package/dist/chunk-1019v091.js +0 -2
- package/dist/chunk-1h9mcnvn.js +0 -2
- package/dist/chunk-1kdtapc1.js +0 -2
- package/dist/chunk-1mmtkbhf.js +0 -2
- package/dist/chunk-3a42s01p.js +0 -2
- package/dist/chunk-3t737sdr.js +0 -2
- package/dist/chunk-4jwp2per.js +0 -2
- package/dist/chunk-59512t1y.js +0 -2
- package/dist/chunk-5cyzd17z.js +0 -2
- package/dist/chunk-5q1mnc79.js +0 -2
- package/dist/chunk-6jtjhx7w.js +0 -2
- package/dist/chunk-6x112bw3.js +0 -2
- package/dist/chunk-7ygjbxm8.js +0 -2
- package/dist/chunk-8wnjaz0x.js +0 -2
- package/dist/chunk-af1e9spb.js +0 -2
- package/dist/chunk-bn13c7ma.js +0 -2
- package/dist/chunk-bymeqhjp.js +0 -2
- package/dist/chunk-cgyddqxw.js +0 -2
- package/dist/chunk-cpexmwbs.js +0 -2
- package/dist/chunk-cr12w7hv.js +0 -2
- package/dist/chunk-cs5gf4zp.js +0 -2
- package/dist/chunk-engy7e5m.js +0 -2
- package/dist/chunk-enzptxpw.js +0 -2
- package/dist/chunk-f0kbpzbb.js +0 -2
- package/dist/chunk-f83dksbn.js +0 -2
- package/dist/chunk-fedcrvrm.js +0 -2
- package/dist/chunk-fk7gs41v.js +0 -2
- package/dist/chunk-fmsrzpb4.js +0 -3
- package/dist/chunk-gbve6fgb.js +0 -2
- package/dist/chunk-gsawyk8q.js +0 -2
- package/dist/chunk-gv6w1j3z.js +0 -2
- package/dist/chunk-h3w9sx7w.js +0 -2
- package/dist/chunk-hf0n98x2.js +0 -2
- package/dist/chunk-k83z4nyg.js +0 -2
- package/dist/chunk-kg4zjb7a.js +0 -2
- package/dist/chunk-mjam7gyj.js +0 -2
- package/dist/chunk-nhm3qamb.js +0 -2
- package/dist/chunk-p5hbpmws.js +0 -2
- package/dist/chunk-pe5643ce.js +0 -2
- package/dist/chunk-q82kcwn4.js +0 -2
- package/dist/chunk-rhygq40y.js +0 -2
- package/dist/chunk-rx71g5z4.js +0 -2
- package/dist/chunk-s4fr9cx8.js +0 -2
- package/dist/chunk-sp5c1pgg.js +0 -2
- package/dist/chunk-tcrxk0mv.js +0 -130
- package/dist/chunk-th2ej2dz.js +0 -2
- package/dist/chunk-tkp7npcj.js +0 -42
- package/dist/chunk-tyb22n6n.js +0 -2
- package/dist/chunk-va57s6yw.js +0 -2
- package/dist/chunk-vch68zrs.js +0 -20
- package/dist/chunk-vqjbqm6c.js +0 -2
- package/dist/chunk-vyznvnew.js +0 -2
- package/dist/chunk-wad1w2d2.js +0 -2
- package/dist/chunk-wzb2g38x.js +0 -2
- package/dist/chunk-xe7wyaac.js +0 -2
- package/dist/chunk-y627cbst.js +0 -2
- package/dist/chunk-ycxwf633.js +0 -2
- package/dist/chunk-ydx3j69d.js +0 -2
- package/dist/chunk-yq3p5y7y.js +0 -2
- package/dist/chunk-z3ggbhhc.js +0 -2
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{dr}from"./chunk-
|
|
3
|
-
`+e.slice(t);let n=
|
|
2
|
+
import{dr}from"./chunk-k4dn3ry6.js";import{_r}from"./chunk-0tgrqhkr.js";import{a}from"./chunk-g5sctfwa.js";import{L,Xe}from"./chunk-f4gqzg1y.js";import{ec}from"./chunk-cmaxdd8d.js";var p=/<style\b[^>]*>/iy,x=/<\/style>/gi,R=/<script\b[^>]*>/iy,b=/<template(?=[\s>/])[^>]*>/iy,S=/<\/template\s*>/iy;function or(e){let r=0,t=0,s=-1;while(r<e.length){let n=e.indexOf("<",r);if(n===-1)return-1;if(e.startsWith("<!--",n)){let d=e.indexOf("-->",n+4);r=d===-1?e.length:d+3;continue}p.lastIndex=n;let c=p.exec(e);if(c){x.lastIndex=n+c[0].length;let d=x.exec(e);r=d===null?e.length:d.index+8;continue}b.lastIndex=n;let o=b.exec(e);if(o){if(t===0)s=n;t++,r=n+o[0].length;continue}S.lastIndex=n;let u=S.exec(e);if(u){if(t>0)t--;r=n+u[0].length;continue}if(R.lastIndex=n,R.test(e))return t>0?s:n;r=n+1}return-1}function G(e,r={}){return new dr(e,r).routes}import w from"path";var T=new Map;async function y(e,r){let t=e,s=r;if(!t||!s)try{let u=await a();t||=u?.pagesDir||"pages",s||=u?.root||"."}catch{t||="pages",s||="."}let n=w.isAbsolute(t)?t:w.join(s,t),c=T.get(n);if(c)return c;let o=[];try{o=G(".",{pagesDir:n,emit:!1}).map((u)=>u.regex.source).filter(Boolean)}catch{o=[]}return T.set(n,o),o}function O(e){return e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function l(e){return O(JSON.stringify(e))}function ye(e){return e.includes("data-stx-runtime")}function Za(e){let r=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let t=r.exec(e);t!==null;t=r.exec(e)){let s=e.slice(Math.max(0,t.index-80),t.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(s))continue;return!0}return!1}function f(e,r){let t=or(e),s=e.search(/<!doctype\b/i);if(t!==-1&&(s===-1||t>s))return e.slice(0,t)+r+`
|
|
3
|
+
`+e.slice(t);let n=_r(e);if(n!==null)return`${e.slice(0,n)}
|
|
4
4
|
${r}${e.slice(n)}`;if(e.includes("</head>")){let o=e.indexOf("</head>");return e.slice(0,o)+r+`
|
|
5
5
|
`+e.slice(o)}if(L(e))return Xe(e,(o)=>`${o}
|
|
6
6
|
${r}`);return`${r}
|
|
7
|
-
${e}`}async function ir(e,r){if(e.includes("data-stx-runtime")||e.includes("window.stx.state")||e.includes("STX Signals Runtime"))return e;if(r.buildMode==="serve"){let{getServeClientAsset:n}=await import("./chunk-
|
|
7
|
+
${e}`}async function ir(e,r){if(e.includes("data-stx-runtime")||e.includes("window.stx.state")||e.includes("STX Signals Runtime"))return e;if(r.buildMode==="serve"){let{getServeClientAsset:n}=await import("./chunk-grjr8shp.js"),{url:c}=await n("runtime",r.debug===!0);return f(e,`<script data-stx-runtime src="${c}"></script>`)}if(r.buildMode==="compile")return f(e,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:t}=await import("./chunk-grjr8shp.js"),s=await t(r.debug);return f(e,`<script data-stx-scoped data-stx-runtime>${s}</script>`)}function m(e){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(e)}function Qa(e){if(e.includes("data-stx-tooltip-runtime")||!m(e))return e;let r=`<script data-stx-scoped data-stx-tooltip-runtime>${ec()}</script>`,t=e.lastIndexOf("</body>");if(t===-1)return`${e}
|
|
8
8
|
${r}`;return`${e.slice(0,t)}${r}
|
|
9
|
-
${e.slice(t)}`}var E=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function C(e){return E.test(e)||e.includes("__stxRouter)return")||e.includes("__stxRouter=true")}async function be(e,r){if(!e.includes("</body>"))return e;if(C(e))return e;let t=r?.router,s="",n="";{let i={};if(t){if(t.container)i.container=t.container;if(t.interceptAllLinks!==void 0)i.interceptAllLinks=t.interceptAllLinks;if(t.progress!==void 0)i.progress=t.progress;if(t.viewTransitions!==void 0)i.viewTransitions=t.viewTransitions;if(t.viewTransitionDuration!==void 0)i.viewTransitionDuration=t.viewTransitionDuration;if(t.viewTransitionEasing!==void 0)i.viewTransitionEasing=t.viewTransitionEasing;if(t.scrollToTop!==void 0)i.scrollToTop=t.scrollToTop;if(t.scrollRestoration!==void 0)i.scrollRestoration=t.scrollRestoration;if(t.prefetch!==void 0)i.prefetch=t.prefetch;if(t.cache!==void 0)i.cache=t.cache;if(t.progressColor!==void 0)i.progressColor=t.progressColor;if(t.progressHeight!==void 0)i.progressHeight=t.progressHeight;if(t.prefetchVisible!==void 0)i.prefetchVisible=t.prefetchVisible;if(t.prefetchVisibleMax!==void 0)i.prefetchVisibleMax=t.prefetchVisibleMax;if(t.keepOpening!==void 0)i.keepOpening=t.keepOpening}try{let g=await y(r?.pagesDir,r?.root);if(g.length>0)if(r?.buildMode==="serve"){let{registerServeModuleBundle:h}=await import("./chunk-
|
|
9
|
+
${e.slice(t)}`}var E=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function C(e){return E.test(e)||e.includes("__stxRouter)return")||e.includes("__stxRouter=true")}async function be(e,r){if(!e.includes("</body>"))return e;if(C(e))return e;let t=r?.router,s="",n="";{let i={};if(t){if(t.container)i.container=t.container;if(t.interceptAllLinks!==void 0)i.interceptAllLinks=t.interceptAllLinks;if(t.progress!==void 0)i.progress=t.progress;if(t.viewTransitions!==void 0)i.viewTransitions=t.viewTransitions;if(t.viewTransitionDuration!==void 0)i.viewTransitionDuration=t.viewTransitionDuration;if(t.viewTransitionEasing!==void 0)i.viewTransitionEasing=t.viewTransitionEasing;if(t.scrollToTop!==void 0)i.scrollToTop=t.scrollToTop;if(t.scrollRestoration!==void 0)i.scrollRestoration=t.scrollRestoration;if(t.prefetch!==void 0)i.prefetch=t.prefetch;if(t.cache!==void 0)i.cache=t.cache;if(t.progressColor!==void 0)i.progressColor=t.progressColor;if(t.progressHeight!==void 0)i.progressHeight=t.progressHeight;if(t.prefetchVisible!==void 0)i.prefetchVisible=t.prefetchVisible;if(t.prefetchVisibleMax!==void 0)i.prefetchVisibleMax=t.prefetchVisibleMax;if(t.keepOpening!==void 0)i.keepOpening=t.keepOpening}try{let g=await y(r?.pagesDir,r?.root);if(g.length>0)if(r?.buildMode==="serve"){let{registerServeModuleBundle:h}=await import("./chunk-grjr8shp.js");n=`<script data-stx-owned-routes src="${h(`(window.__stxRouterConfig=window.__stxRouterConfig||{}).ownedRoutes=${l(g)};
|
|
10
10
|
`)}"></script>
|
|
11
11
|
`}else i.ownedRoutes=g}catch{}if(Object.keys(i).length>0)s=`<script>window.__stxRouterConfig=${l(i)};</script>
|
|
12
|
-
`}let{getCachedRouterScript:c,getServeClientAsset:o}=await import("./chunk-
|
|
12
|
+
`}let{getCachedRouterScript:c,getServeClientAsset:o}=await import("./chunk-grjr8shp.js"),u=r?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':r?.buildMode==="serve"?`<script data-stx-router src="${(await o("router")).url}"></script>`:`<script data-stx-router>${await c()}</script>`,d=e.lastIndexOf("</body>");return e.slice(0,d)+s+n+u+`
|
|
13
13
|
</body>`+e.slice(d+7)}
|
|
14
|
-
export{or,G,ye,
|
|
14
|
+
export{or,G,ye,Za,ir,Qa,be};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Sn}from"./chunk-
|
|
3
|
-
`}import P from"path";var Y="stx-page-head:",Z=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,v={dev:null,prod:null};function Q(){let t=K()?"dev":"prod",r=v[t];if(r!==null)return r;try{let e=import.meta.require("./chunk-
|
|
2
|
+
import{Sn}from"./chunk-0tgrqhkr.js";import{W,S,Pt,It,xr,m,Hc,li,V,E}from"./chunk-8w0cwcvk.js";import{Yt}from"./chunk-np8knskz.js";import{n}from"./chunk-6fxjs3ay.js";import{K}from"./chunk-nmy72s6r.js";var z=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function U(t){let r=[],e=/<!--[\s\S]*?(?:-->|$)|<(script|style|textarea|title|template)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,s;while((s=e.exec(t))!==null)r.push({start:s.index,end:s.index+s[0].length});return r}function I(t,r){return r.some((e)=>t>=e.start&&t<e.end)}function G(t){let r=(t||"").trim();if(!r)return null;if(/[\s>+~,:]/.test(r))return null;let e={},s=r,a=s.match(/^[a-z][\w-]*/i);if(a)e.tag=a[0].toLowerCase(),s=s.slice(a[0].length);while(s.length>0){let i=s.match(/^\[([\w-]+)(?:=(["']?)([^\]"']*)\2)?\]/);if(i){if(e.attr=i[1],i[3]!==void 0&&i[3]!=="")e.attrValue=i[3];s=s.slice(i[0].length);continue}let o=s.match(/^#([\w-]+)/);if(o){e.id=o[1],s=s.slice(o[0].length);continue}let c=s.match(/^\.([\w-]+)/);if(c){e.className=c[1],s=s.slice(c[0].length);continue}return null}if(!e.tag&&!e.attr&&!e.id&&!e.className)return null;return e}function X(t,r){if(r.attr){if(!(r.attrValue===void 0?new RegExp(`\\b${r.attr}(?=[\\s=>/]|$)`,"i"):new RegExp(`\\b${r.attr}\\s*=\\s*(["'])\\s*${r.attrValue}\\s*\\1`,"i")).test(t))return!1}if(r.id){if(!new RegExp(`\\bid\\s*=\\s*(["'])\\s*${r.id}\\s*\\1`,"i").test(t))return!1}if(r.className){let e=t.match(/\bclass\s*=\s*(["'])([\s\S]*?)\1/i);if(!e)return!1;if(!e[2].split(/\s+/).includes(r.className))return!1}return!0}function N(t,r="main"){let e=G(r);if(!e)return null;let s=/<([a-z][\w-]*)\b([^>]*)>/gi,a=U(t),i;while((i=s.exec(t))!==null){if(I(i.index,a))continue;let o=i[1].toLowerCase(),c=i[2]||"";if(c.trimEnd().endsWith("/")||z.has(o))continue;if(e.tag&&e.tag!==o)continue;if(!X(c,e))continue;let l=i[0],u=i.index+l.length,f=new RegExp(`<(/?)${o}\\b([^>]*)>`,"gi");f.lastIndex=u;let p=1,h;while((h=f.exec(t))!==null){if(I(h.index,a))continue;let y=h[1]==="/";if(!y&&(h[2]||"").trimEnd().endsWith("/"))continue;if(p+=y?-1:1,p===0)return{openTag:l,openIndex:i.index,start:u,end:h.index,tagName:o}}return null}return null}var dt="private, no-store";function $n(t){return t.replace(/&#(\d+);/g,(r,e)=>D(Number(e),r)).replace(/&#x([0-9a-f]+);/gi,(r,e)=>D(Number.parseInt(e,16),r)).replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/&/g,"&")}function D(t,r){if(!Number.isInteger(t)||t<0||t>1114111)return r;try{return String.fromCodePoint(t)}catch{return r}}function _e(t){return t.headers.get("X-STX-Router")==="true"}function J(t,r){if(!t)return r;return t.split(",").some((s)=>s.trim().toLowerCase()===r.toLowerCase())?t:`${t}, ${r}`}function M(t){return{Vary:J(t,"X-STX-Router")}}function k(t){return t.replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Rn(t){let r=/<head\b[^>]*>([\s\S]*?)<\/head\s*>/i.exec(t)?.[1]??"",e=/<(meta|link)\b(?:[^>"']|"[^"]*"|'[^']*')*>|<title\b[^>]*>[\s\S]*?<\/title\s*>/giy,s=S(r,(i,o)=>(e.lastIndex=o,e.exec(i)?e.lastIndex:-1)),a=[];for(let{token:i}of s){if(/^<title\b/i.test(i)){a.push(`<title>${k(i.replace(/^<title\b[^>]*>|<\/title\s*>$/gi,""))}</title>`);continue}let o=Object.create(null),c=i.replace(/^<\w+\b|>$/g,"");for(let l of c.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g)){let u=l[1].toLowerCase();if(!(u in o))o[u]=l[2]??l[3]??l[4]??""}if(/^<meta\b/i.test(i)){let l=o.property?"property":"name",u=$n(o[l]??"").toLowerCase();if(u==="description"||/^(?:og|twitter):[\w:]+$/.test(u))a.push(`<meta ${l}="${n(u)}" content="${k(o.content??"")}">`)}else{let l=$n(o.rel??"").toLowerCase();if(l==="canonical"||l==="alternate"&&o.hreflang)a.push(`<link rel="${l}" href="${k(o.href??"")}"${l==="alternate"?` hreflang="${k(o.hreflang)}"`:""}>`)}}return`<template data-stx-page-head="1">${a.join("")}</template>
|
|
3
|
+
`}import P from"path";var Y="stx-page-head:",Z=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,v={dev:null,prod:null};function Q(){let t=K()?"dev":"prod",r=v[t];if(r!==null)return r;try{let e=import.meta.require("./chunk-x5vwkccx.js"),s=t==="dev"&&typeof e.getRouterScriptDev==="function"?e.getRouterScriptDev:e.getRouterScript;v[t]=`<script>${s()}</script>`}catch{v[t]=""}return v[t]}async function Yi(t,r){if(r===!1)return null;if(r&&typeof r==="string"){let s=P.resolve(t,r);if(await Bun.file(s).exists())return s;return null}let e=P.join(t,"app.stx");if(await Bun.file(e).exists())return e;return null}async function so(t,r){try{let e=await Bun.file(t).text(),s=e,a=e.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if(a)s=a[1].trim();let i=Yt(e),o=[...i.client.map((g)=>g.fullTag),...i.signals.map((g)=>g.fullTag)],c=[],l=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,u;while((u=l.exec(e))!==null)c.push(u[0]);let f=s;for(let g of i.server)f=f.replace(g.fullTag,"");for(let g of i.client)f=f.replace(g.fullTag,"");f=f.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let p="<!--__STX_PAGE_SLOT__-->";if(f=f.replace(/<slot\s*\/>/gi,p).replace(/<slot\s*>\s*<\/slot>/gi,p),!f.includes(p))return console.warn(`[stx] Shell ${t} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:h,extractVariables:y,defaultConfig:R,loadStxConfig:b}=await import("./chunk-6n5jnd97.js"),A=await b(),d={__filename:t,__dirname:P.dirname(t)};for(let g of o){let C=g.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(C&&!g.includes("client")&&!g.includes('type="module"'))await y(C[1],d,t)}let x=await h(f,d,t,{...R,...A,...r},new Set),w=x.indexOf(p);if(w===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:x.substring(0,w),afterSlot:x.substring(w+p.length),filePath:t,shellScripts:o,shellStyles:c}}catch(e){return console.error(`[stx] Error processing shell ${t}:`,e),null}}function zr(t,r,e){let s,a="",i=r.match(Z);if(i){r=r.replace(i[0],"");try{let f=Buffer.from(i[1],"base64").toString("utf8"),p=f.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(p)s=p[1].trim();a=f.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let o=e||s||"stx App",c=Q(),l="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
|
|
4
4
|
<html lang="en">
|
|
5
5
|
<head>
|
|
6
6
|
<meta charset="UTF-8">
|
|
@@ -23,10 +23,10 @@ ${c}
|
|
|
23
23
|
`),"utf8").toString("base64")}-->`)}let i=e.match(/<body\b[^>]*>/i),o=e.lastIndexOf("</body>");if(i&&o!==-1){let l=i.index+i[0].length,u=e.slice(l,o).trim();if(s.length>0)return s.join(`
|
|
24
24
|
`)+`
|
|
25
25
|
`+u;return u}let c=e;if(c=c.replace(/<!DOCTYPE\b[^>]*>/i,""),c=c.replace(/<html\b[^>]*>/i,""),c=c.replace(/<\/html\s*>/i,""),a)c=c.replace(/<head\b[^>]*>[\s\S]*?<\/head>/i,s.join(`
|
|
26
|
-
`));return c=c.replace(/<body\b[^>]*>/i,""),c=c.replace(/<\/body\s*>/i,""),c.trim()}var F=/^<script\b[^>]*\sdata-stx-(?:owner|instance)(?=[\s=/>])/i;function L(t,r,e,s){if(!F.test(r))return!1;let a=r.slice(0,r.indexOf(">")+1),i=/\sdata-stx-owner="([^"]+)"/i.exec(a)?.[1];if(!i)return!0;let o=`data-stx-scope="${i}"`;for(let c=t.indexOf(o);c!==-1;c=t.indexOf(o,c+o.length))if(c>=e&&c<s)return!1;return!0}function
|
|
26
|
+
`));return c=c.replace(/<body\b[^>]*>/i,""),c=c.replace(/<\/body\s*>/i,""),c.trim()}var F=/^<script\b[^>]*\sdata-stx-(?:owner|instance)(?=[\s=/>])/i;function L(t,r,e,s){if(!F.test(r))return!1;let a=r.slice(0,r.indexOf(">")+1),i=/\sdata-stx-owner="([^"]+)"/i.exec(a)?.[1];if(!i)return!0;let o=`data-stx-scope="${i}"`;for(let c=t.indexOf(o);c!==-1;c=t.indexOf(o,c+o.length))if(c>=e&&c<s)return!1;return!0}function Zi(t){return _e(t)}function tt(t,r){let e=[],s=new Set;for(let a of S(t,W)){if(a.start>=r.start&&a.start<r.end)continue;let i=a.token.match(/^<script\b((?:"[^"]*"|'[^']*'|[^'">])*)>/i)?.[1]??"",o=new Map;for(let u of i.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g))o.set(u[1].toLowerCase(),u[2]??u[3]??u[4]??"");let c=o.get("src")?.trim(),l=o.get("type")?.trim().toLowerCase();if(!c||o.has("server")||l&&!["module","text/javascript","application/javascript"].includes(l))continue;if(o.has("data-stx-runtime")||o.has("data-stx-router")||/^\/_stx\/(?:runtime|router)(?:\.[a-f0-9]{16})?\.js(?:[?#]|$)/i.test(c))continue;if(L(t,a.token,r.start,r.end)||s.has(a.token))continue;s.add(a.token),e.push(a.token)}return e}function Ce(t,r="main",e=!1){let s=t.trim(),a=[],i=[],o=s.match(/<head\b[^>]*>([\s\S]*?)<\/head>/i);if(o){let x=o[1],w=/<style\b[^>]*>[\s\S]*?<\/style>/gi,g;while((g=w.exec(x))!==null)a.push(g[0]);let C=/<script\b[^>]*data-stx-(?:route-params|server-data|scoped|component-factories)[^>]*>[\s\S]*?<\/script>/gi;while((g=C.exec(x))!==null){if(F.test(g[0])||g[0].includes("__stx_early_mounts")||/^<script\b[^>]*\bdata-stx-runtime(?=[\s=>])/i.test(g[0]))continue;i.push(g[0])}}let c=N(s,r);if(!c)return(e?Rn(t):"")+Ue(t);let l=tt(s,c),u=new Set(l),{tagName:f,start:p,end:h}=c,y=s.slice(p,h).trim(),R=[],b=s.match(/<body\b[^>]*>/i),A=s.lastIndexOf("</body>");if(b&&b.index!==void 0&&A!==-1){let w=[[b.index+b[0].length,c.openIndex],[h+`</${f}>`.length,A]],g=/<script\b[^>]*>[\s\S]*?<\/script>/gi;for(let[C,j]of w){if(C>=j)continue;let q=s.slice(C,j),_;g.lastIndex=0;while((_=g.exec(q))!==null){if(L(s,_[0],p,h))continue;R.push(_[0])}}}let d=[];if(e)d.push(Rn(t));if(a.length>0)d.push(a.join(`
|
|
27
27
|
`));if(l.length>0)d.push(l.join(`
|
|
28
28
|
`));if(i.length>0)d.push(i.filter((x)=>!u.has(x)).join(`
|
|
29
29
|
`));if(R.length>0)d.push(R.filter((x)=>!u.has(x)).join(`
|
|
30
30
|
`));return d.push(y),d.join(`
|
|
31
|
-
`)}import O from"fs";import H from"path";function
|
|
32
|
-
export{dt,$n,_e,M,Rn,
|
|
31
|
+
`)}import O from"fs";import H from"path";function Qi(t,r,e){return{version:1,buildTime:new Date().toISOString(),routes:t,assets:r,outputDir:e}}function ea(t,r){let e=H.join(r,"manifest.json");O.writeFileSync(e,JSON.stringify(t,null,2))}function ta(t){let r=H.join(t,"manifest.json");if(!O.existsSync(r))return null;try{let e=O.readFileSync(r,"utf-8"),s=JSON.parse(e);if(s.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${s.version}`),null;return s}catch(e){return console.warn("[stx] Failed to load manifest:",e),null}}function T(t,r,e={}){let s=`${encodeURIComponent(t)}=${encodeURIComponent(r)}`;if(e.maxAge!==void 0)s+=`; Max-Age=${e.maxAge}`;if(e.expires)s+=`; Expires=${e.expires.toUTCString()}`;if(e.path)s+=`; Path=${e.path}`;if(e.domain)s+=`; Domain=${e.domain}`;if(e.secure)s+="; Secure";if(e.httpOnly)s+="; HttpOnly";if(e.sameSite)s+=`; SameSite=${e.sameSite}`;return s}async function et(t){let r=t.headers.get("content-type")||"",e={},s=(a,i)=>{let o=e[a];if(o===void 0)e[a]=i;else if(Array.isArray(o))o.push(i);else e[a]=[o,i]};if(r.includes("multipart/form-data")){let a=await t.formData();for(let[i,o]of a.entries())if(typeof o==="string")s(i,o);return e}if(r.includes("application/x-www-form-urlencoded")){for(let[a,i]of new URLSearchParams(await t.text()).entries())s(a,i);return e}return e}function oo(t){if(!t)return!1;let r=t.toUpperCase();return r!=="GET"&&r!=="HEAD"}async function B(t,r={}){let e=r.request,s=r.method??e?.method;if(!e||!oo(s))return{ran:!1};if(typeof t.action!=="function")return{ran:!1};let a={};try{a=await et(e)}catch{}let i=await t.action({request:e,form:a,params:r.params??{},query:t.query??{},cookies:r.cookies??{}});if(i&&typeof i==="object"){let o=i,c=nt(o.cookies),l=o.redirect;if(typeof l==="string"&&l)return{redirect:l,ran:!0,...c.length>0?{cookies:c}:{}};let{cookies:u,redirect:f,...p}=o;if(Object.assign(t,p),c.length>0)return{ran:!0,cookies:c}}return{ran:!0}}function nt(t){if(!t||typeof t!=="object"||Array.isArray(t))return[];let r=[];for(let[e,s]of Object.entries(t)){if(!e)continue;if(typeof s==="string"){r.push(T(e,s));continue}if(s&&typeof s==="object"){let a=s;if(typeof a.value!=="string")continue;r.push(T(e,a.value,a))}}return r}function na(t,r=[],e){let s=new Headers({Location:t,"Cache-Control":"no-store"});for(let a of r)s.append("Set-Cookie",a);for(let[a,i]of Object.entries(e??{}))if(a.toLowerCase()!=="location")s.set(a,i);return new Response(null,{status:303,headers:s})}async function An(t,r={}){let{html:e,context:s,redirect:a,cookies:i}=await rt(t,r),o=Pt(s),c=It(s);if(a)return{html:e,redirect:a,cookies:i,status:o,headers:c};let{extractStreamBoundaries:l}=await import("./chunk-hb34m4pp.js"),u=l(s),f=t.streamTemplates;if(f&&Object.keys(f).length>0){let{processDirectives:p}=await import("./chunk-33bp9m4c.js"),{defaultConfig:h}=await import("./chunk-bhkqzz91.js"),y=s.streamBoundaries||{},R={...h,autoShell:!1},b=Object.keys(f).map((d)=>({id:d,render:async()=>{let x=typeof y[d]==="function"?await y[d]():void 0;return p(f[d],{...s,$boundary:x},t.sourceFile,R,new Set)}})),A=new Set(b.map((d)=>d.id));u=[...(u||[]).filter((d)=>!A.has(d.id)),...b]}return{html:e,boundaries:u&&u.length>0?u:void 0,cookies:i,status:o,headers:c}}async function rt(t,r){let e={__filename:t.sourceFile,__dirname:t.sourceFile.replace(/[/\\][^/\\]+$/,""),...r};if(!t.hasServerScripts&&!li(t.html))return{html:t.html,context:e};for(let o of t.serverScriptContent)try{await m(o,e,t.sourceFile)}catch(c){if(r.__stx_strict_hydration)throw c;console.warn(`[stx] Server script error in ${t.sourceFile}:`,c)}let s=await B(e,{request:r.request,method:r.method,params:r.params??{},cookies:r.cookies??{}}),a=(o)=>{let c=o.replace(/<script\b[^>]*\bdata-stx-server-data\b[^>]*>[\s\S]*?<\/script>/gi,""),l=xr(e);if(!l)return c;let u=c.indexOf("</head>");return u<0?l+c:c.slice(0,u)+l+c.slice(u)};if(s.redirect)return{html:t.html,context:e,redirect:s.redirect,cookies:s.cookies};if(!li(t.html))return{html:a(t.html),context:e,cookies:s.cookies};let i=new Map;for(let[o,c]of Object.entries(t.placeholders))if(c.expression)try{let l=E(c.expression,e);if(c.type==="raw")i.set(o,l!==void 0&&l!==null?String(l):"");else i.set(o,l!==void 0&&l!==null?V(String(l)):"")}catch(l){if(r.__stx_strict_hydration)throw l;i.set(o,"")}return{html:a(Hc(t.html,i)),context:e,cookies:s.cookies}}
|
|
32
|
+
export{dt,$n,_e,M,Rn,Yi,so,zr,Ue,Zi,Ce,Qi,ea,ta,oo,na,An};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ne}from"./chunk-
|
|
3
|
-
export{
|
|
2
|
+
import{ne}from"./chunk-0md73jp8.js";import R from"fs";import g from"path";import C from"crypto";var S=new Set(["webp","avif","jpeg","png"]),T=new Set(["cover","contain","fill","inside","outside"]),q=new Set([".jpg",".jpeg",".png",".webp",".avif",".gif"]),k=4096,D=80,U="cover";async function ra(e,t){let r=t.routePath??"/_stx/img",h=new URL(e.url);if(h.pathname!==r)return null;let a=A(h,t);if(!a.ok)return new Response(a.error,{status:a.status,headers:{"Content-Type":"text/plain"}});let{srcFsPath:n,srcUrl:d,width:l,height:i,format:s,quality:u,fit:c}=a,m;try{m=R.statSync(n)}catch{return new Response(`Source image not found: ${d}`,{status:404,headers:{"Content-Type":"text/plain"}})}if(!m.isFile())return new Response("Not a file",{status:404,headers:{"Content-Type":"text/plain"}});let w=t.cacheDir??".stx/cache/img";await R.promises.mkdir(w,{recursive:!0});let b=`${n}:${m.mtimeMs}:${m.size}`,I=`${l}x${i}:${s}:${u}:${c}`,f=C.createHash("sha256").update(`${b}|${I}`).digest("hex").slice(0,16),o=g.join(w,`${f}.${s}`),p={"Content-Type":ne(s),"Cache-Control":"public, max-age=31536000, immutable",ETag:`"${f}"`,"X-Stx-Image-Cache":"HIT"};if(e.headers.get("if-none-match")===`"${f}"`)return new Response(null,{status:304,headers:p});let v=Bun.file(o);if(await v.exists())return new Response(v,{headers:p});try{let x=Buffer.from(await Bun.file(n).arrayBuffer()),{resizeAndConvert:P}=await L(),F=await P(x,{width:l,height:i,format:s,quality:u,fit:c});return await Bun.write(o,F),p["X-Stx-Image-Cache"]="MISS",new Response(new Uint8Array(F),{headers:p})}catch(x){let P=x.message;return new Response(`Image processing failed: ${P}`,{status:500,headers:{"Content-Type":"text/plain"}})}}function $l(e){return async(t)=>await ra(t,e)??new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain"}})}function A(e,t){let r=e.searchParams.get("src");if(!r)return{ok:!1,error:"Missing required param: src",status:400};if(!r.startsWith("/"))return{ok:!1,error:"src must be an absolute URL path (start with /)",status:400};if(r.startsWith("//"))return{ok:!1,error:"src must be a local path",status:400};let h=g.extname(r).toLowerCase();if(!q.has(h))return{ok:!1,error:`Unsupported source extension: ${h}`,status:400};let a=g.resolve(t.publicDir),n=g.resolve(a,r.slice(1));if(!n.startsWith(`${a}${g.sep}`)&&n!==a)return{ok:!1,error:"src is outside publicDir",status:400};let d=t.maxWidth??k,l=t.maxHeight??k,i=e.searchParams.get("w"),s=e.searchParams.get("h"),u=i?Number.parseInt(i,10):0,c=s?Number.parseInt(s,10):0;if(i&&(!Number.isFinite(u)||u<=0))return{ok:!1,error:"Invalid w (must be positive integer)",status:400};if(s&&(!Number.isFinite(c)||c<=0))return{ok:!1,error:"Invalid h (must be positive integer)",status:400};if(!i&&!s)return{ok:!1,error:"At least one of w or h is required",status:400};let m=Math.min(u||d,d),w=Math.min(c||l,l),b=e.searchParams.get("f")||"webp";if(!S.has(b))return{ok:!1,error:`Invalid f (must be one of: ${[...S].join(", ")})`,status:400};let I=b,f=e.searchParams.get("q"),o=f?Number.parseInt(f,10):t.defaultQuality??D;if(!Number.isFinite(o)||o<1||o>100)return{ok:!1,error:"Invalid q (must be 1-100)",status:400};let y=e.searchParams.get("fit")||t.defaultFit||U;if(!T.has(y))return{ok:!1,error:`Invalid fit (must be one of: ${[...T].join(", ")})`,status:400};return{ok:!0,srcFsPath:n,srcUrl:r,width:m,height:w,format:I,quality:o,fit:y}}async function L(){return await import("./chunk-67jf2e8x.js")}
|
|
3
|
+
export{ra,$l};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
function
|
|
2
|
+
function oa(v,c){let{itemHeight:l,containerHeight:u,overscan:s=3,keyProperty:b="id",dynamicHeight:d=!1,estimatedItemHeight:g=l,direction:x="vertical"}=c,e=[...v],t=0,n=new Map;function f(){if(d)return h();let i=Math.max(0,Math.floor(t/l)-s),r=Math.ceil(u/l),m=Math.min(e.length-1,i+r+s*2);return{startIndex:i,endIndex:m}}function h(){let i=0,r=0,m=e.length-1;for(let p=0;p<e.length;p++){let M=n.get(p)||g;if(i+M>t){r=Math.max(0,p-s);break}i+=M}i=0;for(let p=0;p<e.length;p++){let M=n.get(p)||g;if(i+=M,i>t+u){m=Math.min(e.length-1,p+s);break}}return{startIndex:r,endIndex:m}}function w(){if(d){let i=0;for(let r=0;r<e.length;r++)i+=n.get(r)||g;return i}return e.length*l}function y(i){if(d){let r=0;for(let m=0;m<i;m++)r+=n.get(m)||g;return r}return i*l}function S(){let{startIndex:i,endIndex:r}=f();return{startIndex:i,endIndex:r,scrollTop:t,totalHeight:w(),visibleItems:e.slice(i,r+1),itemHeights:new Map(n)}}function L(i,r="auto"){let m=y(i);a(m,r)}function a(i,r="auto"){t=Math.max(0,Math.min(i,w()-u))}function o(){f()}function H(i){e=[...i],n.clear(),o()}function I(){e=[],n.clear()}return{scrollToIndex:L,scrollToOffset:a,getState:S,refresh:o,setItems:H,destroy:I}}function ia(v,c={},l){let u=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return v.replace(u,(s,b,d,g)=>{let x=b.trim(),e=c[x];if(!e||!Array.isArray(e))return`<!-- virtualList: items "${x}" not found or not an array -->`;let t={itemHeight:50,containerHeight:400,overscan:3};if(d)try{let a=d.trim(),o=Function(`return ${a}`)();t={...t,...o}}catch{}let n=`vlist-${Math.random().toString(36).substring(2,9)}`,f=Math.ceil(t.containerHeight/t.itemHeight),h=t.overscan||3,w=0,y=Math.min(e.length-1,f+h),S="";for(let a=w;a<=y&&a<e.length;a++){let o=e[a],H=g.replace(/\{\{\s*item\s*\}\}/g,typeof o==="object"?JSON.stringify(o):String(o)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(I,i)=>{if(typeof o==="object"&&o!==null)return String(o[i]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(a));S+=`
|
|
3
3
|
<div class="virtual-item ${t.itemClass||""}"
|
|
4
4
|
style="position: absolute; top: ${a*t.itemHeight}px; height: ${t.itemHeight}px; width: 100%;"
|
|
5
5
|
data-index="${a}">
|
|
@@ -76,7 +76,7 @@ function sa(v,c){let{itemHeight:l,containerHeight:u,overscan:s=3,keyProperty:b="
|
|
|
76
76
|
};
|
|
77
77
|
})();
|
|
78
78
|
</script>
|
|
79
|
-
`})}function
|
|
79
|
+
`})}function Ol(){return`
|
|
80
80
|
.virtual-list-container {
|
|
81
81
|
position: relative;
|
|
82
82
|
overflow-y: auto;
|
|
@@ -124,7 +124,7 @@ function sa(v,c){let{itemHeight:l,containerHeight:u,overscan:s=3,keyProperty:b="
|
|
|
124
124
|
0% { background-position: 200% 0; }
|
|
125
125
|
100% { background-position: -200% 0; }
|
|
126
126
|
}
|
|
127
|
-
`}function
|
|
127
|
+
`}function Nl(v,c){let l=null,u=()=>{if(!l)l=oa(v(),c);return l};return{visibleItems:()=>u().getState().visibleItems,totalHeight:()=>u().getState().totalHeight,containerProps:()=>({style:{height:`${c.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(s)=>{let b=s.target;if(l)l.scrollToOffset(b.scrollTop)}}),itemProps:(s)=>({style:{position:"absolute",top:`${s*c.itemHeight}px`,height:`${c.itemHeight}px`,width:"100%"},"data-index":s}),scrollToIndex:(s)=>{u().scrollToIndex(s)}}}function Dl(v,c={},l){let u=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return v.replace(u,(s,b,d,g,x)=>{let e=b.trim(),t=c[e];if(!t||!Array.isArray(t))return`<!-- infiniteList: items "${e}" not found or not an array -->`;let n={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(d)try{let w=Function(`return ${d.trim()}`)();n={...n,...w}}catch{}let f=`ilist-${Math.random().toString(36).substring(2,9)}`,h=ia(`@virtualList(${e}, ${JSON.stringify({itemHeight:n.itemHeight,containerHeight:n.containerHeight,overscan:n.overscan,containerClass:n.containerClass})})${g}@endvirtualList`,c);return h=h.replace("</script>",`
|
|
128
128
|
// Infinite scroll detection
|
|
129
129
|
container.addEventListener('scroll', function() {
|
|
130
130
|
const scrollBottom = container.scrollTop + container.clientHeight;
|
|
@@ -142,7 +142,7 @@ function sa(v,c){let{itemHeight:l,containerHeight:u,overscan:s=3,keyProperty:b="
|
|
|
142
142
|
${x}
|
|
143
143
|
</div>
|
|
144
144
|
</div>
|
|
145
|
-
`})}function
|
|
145
|
+
`})}function Ml(v,c={},l){let u=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return v.replace(u,(s,b,d,g)=>{let x=b.trim(),e=c[x];if(!e||!Array.isArray(e))return`<!-- virtualGrid: items "${x}" not found or not an array -->`;let t={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(d)try{let o=Function(`return ${d.trim()}`)();t={...t,...o}}catch{}let n=`vgrid-${Math.random().toString(36).substring(2,9)}`,f=Math.ceil(e.length/t.columns),h=f*(t.rowHeight+(t.gap||0)),w=Math.ceil(t.containerHeight/(t.rowHeight+(t.gap||0))),y=t.overscan||2,S=0,L=Math.min(f-1,w+y),a="";for(let o=S;o<=L;o++)for(let H=0;H<t.columns;H++){let I=o*t.columns+H;if(I>=e.length)break;let i=e[I],r=H*(100/t.columns),m=o*(t.rowHeight+(t.gap||0)),p=g.replace(/\{\{\s*item\s*\}\}/g,typeof i==="object"?JSON.stringify(i):String(i)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(M,T)=>{if(typeof i==="object"&&i!==null)return String(i[T]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(I));a+=`
|
|
146
146
|
<div class="virtual-grid-item"
|
|
147
147
|
style="position: absolute; top: ${m}px; left: ${r}%; width: calc(${100/t.columns}% - ${t.gap||0}px); height: ${t.rowHeight}px;"
|
|
148
148
|
data-index="${I}">
|
|
@@ -212,5 +212,5 @@ function sa(v,c){let{itemHeight:l,containerHeight:u,overscan:s=3,keyProperty:b="
|
|
|
212
212
|
});
|
|
213
213
|
})();
|
|
214
214
|
</script>
|
|
215
|
-
`})}var
|
|
216
|
-
export{
|
|
215
|
+
`})}var Yg={createVirtualList:oa,processVirtualListDirectives:ia,processInfiniteListDirectives:Dl,processVirtualGridDirectives:Ml,generateVirtualListCSS:Ol,useVirtualList:Nl};
|
|
216
|
+
export{oa,ia,Ol,Nl,Dl,Ml,Yg};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{We,re,
|
|
3
|
-
export{Q,ee,te,In,me,Ee,
|
|
2
|
+
import{We,re,Fa}from"./chunk-q0f28539.js";import v from"fs";import g from"path";import V from"crypto";import{generatePlaceholder as T,processImage as L}from"ts-images";var Q=[320,640,768,1024,1280,1536,1920],ee=["webp","jpeg"],te=80,D=[".jpg",".jpeg",".png",".webp",".avif",".gif",".svg"],U={webp:"image/webp",avif:"image/avif",jpeg:"image/jpeg",png:"image/png"},I=null,M=!1;async function d(){if(M)return I;M=!0;try{let t=await import("sharp");return I=t.default||t,I}catch{return null}}async function In(){return await d()!==null}async function me(){return!0}async function Ee(t,e={}){let{widths:a=Q,formats:r=ee,quality:n=te,fit:c="cover",placeholder:i="none",outputDir:m=".stx/images",baseUrl:s="/images"}=e,h,l;if(typeof t==="string"){if(l=t,!await Bun.file(t).exists())throw new Vr(`Image not found: ${t}`,"NOT_FOUND");h=await Bun.file(t).arrayBuffer().then((o)=>Buffer.from(o))}else l="buffer-input",h=t;let b=V.createHash("sha256").update(h).digest("hex").slice(0,12),j=await Hr(h),{width:u,height:x}=j,F=u/x;await v.promises.mkdir(m,{recursive:!0});let B=[],A=g.basename(l,g.extname(l)),f=a.filter((o)=>o<=u);if(!f.includes(u)&&u<=Math.max(...a))f.push(u);f.sort((o,p)=>o-p);for(let o of f){let p=Math.round(o/F);for(let w of r){let S=`${A}-${o}w-${b}.${w}`,P=g.join(m,S),q=`${s}/${S}`,E=await Il(h,{width:o,height:p,format:w,quality:n,fit:c});await Bun.write(P,E),B.push({path:P,url:q,width:o,height:p,format:w,size:E.length})}}let y;if(i!=="none")y=await k(h,i);return{src:l,variants:B,placeholder:y,width:u,height:x,aspectRatio:F,hash:b}}async function Hr(t){let e=typeof t==="string"?Buffer.from(await Bun.file(t).arrayBuffer()):t,a=await d();if(a){let n=await a(e).metadata();return{width:n.width||0,height:n.height||0,format:n.format||"unknown",hasAlpha:n.hasAlpha}}return R(e)}function R(t){if(t[0]===137&&t[1]===80&&t[2]===78&&t[3]===71){let e=t.readUInt32BE(16),a=t.readUInt32BE(20);return{width:e,height:a,format:"png",hasAlpha:!0}}if(t[0]===255&&t[1]===216){let e=2;while(e<t.length){if(t[e]!==255)break;let a=t[e+1];if(a>=192&&a<=207&&a!==196&&a!==200&&a!==204){let n=t.readUInt16BE(e+5);return{width:t.readUInt16BE(e+7),height:n,format:"jpeg",hasAlpha:!1}}let r=t.readUInt16BE(e+2);e+=2+r}}if(t.toString("utf8",0,4)==="RIFF"&&t.toString("utf8",8,12)==="WEBP"){let e=t.toString("utf8",12,16);if(e==="VP8 "){let a=t.readUInt16LE(26)&16383,r=t.readUInt16LE(28)&16383;return{width:a,height:r,format:"webp",hasAlpha:!1}}if(e==="VP8L"){let a=t.readUInt32LE(21),r=(a&16383)+1,n=(a>>14&16383)+1;return{width:r,height:n,format:"webp",hasAlpha:!0}}}if(t.toString("utf8",0,3)==="GIF"){let e=t.readUInt16LE(6),a=t.readUInt16LE(8);return{width:e,height:a,format:"gif",hasAlpha:!0}}throw new Vr("Unable to parse image dimensions","PARSE_ERROR")}async function Il(t,e){let a=await d();if(a){let r=a(t).resize(e.width,e.height,{fit:e.fit});switch(e.format){case"webp":r=r.webp({quality:e.quality});break;case"avif":r=r.avif({quality:e.quality});break;case"jpeg":r=r.jpeg({quality:e.quality});break;case"png":r=r.png({quality:e.quality});break}return r.toBuffer()}return await Fa("img",async(r)=>{let n=g.join(r,`out.${e.format}`);return await L({input:t,output:n,format:e.format,quality:e.quality,resize:{width:e.width,height:e.height,fit:e.fit}}),Buffer.from(await Bun.file(n).arrayBuffer())})}async function k(t,e){let a=await d();if(e==="blur"&&a){let m=(await a(t).resize(20).blur(10).toBuffer()).toString("base64"),s=await Hr(t);return`data:${U[s.format]||"image/jpeg"};base64,${m}`}if(e==="dominant-color"&&a){let{dominant:i}=await a(t).resize(1,1).toBuffer().then(async(m)=>{let s=await a(m).metadata();return{dominant:{r:128,g:128,b:128}}}).catch(()=>({dominant:{r:128,g:128,b:128}}));return`rgb(${i.r}, ${i.g}, ${i.b})`}let r=await Hr(t),n=We("ph"),c=g.join(n,`in.${r.format==="unknown"?"bin":r.format}`);try{await Bun.write(c,t);let i=e==="blur"?"blur":e==="thumbhash"?"thumbhash":"dominant-color",s=await T(c,{strategy:i,width:i==="thumbhash"?void 0:32});if(e==="dominant-color"&&s.dominantColor)return s.dominantColor;if(s.dataURL)return s.dataURL;return"rgb(128, 128, 128)"}catch{return"rgb(128, 128, 128)"}finally{re(n)}}function pt(t,e){return(e?t.filter((r)=>r.format===e):t).sort((r,n)=>r.width-n.width).map((r)=>`${r.url} ${r.width}w`).join(", ")}function qt(t){if(!t||Object.keys(t).length===0)return"100vw";return Object.entries(t).sort((a,r)=>{let n=Number.parseInt(a[0].replace(/\D/g,""))||0;return(Number.parseInt(r[0].replace(/\D/g,""))||0)-n}).map(([a,r])=>`(max-width: ${a}) ${r}`).join(", ")+", 100vw"}function On(t){let e=t.filter((r)=>r.format==="jpeg");if(e.length===0)return t[Math.floor(t.length/2)];let a=e.sort((r,n)=>r.width-n.width);return a[Math.floor(a.length/2)]}function Nn(t){let e=new Map;for(let a of t){let r=e.get(a.format)||[];r.push(a),e.set(a.format,r)}return e}function Dn(t){let e=g.extname(t).toLowerCase();return D.includes(e)}function ne(t){return U[t]||"application/octet-stream"}function Mn(t){return t.reduce((e,a)=>e+a.size,0)}function Ln(t){if(t<1024)return`${t} B`;if(t<1048576)return`${(t/1024).toFixed(1)} KB`;return`${(t/1048576).toFixed(2)} MB`}class Vr extends Error{code;constructor(t,e){super(t);this.name="ImageProcessingError",this.code=e}}
|
|
3
|
+
export{Q,ee,te,In,me,Ee,Hr,Il,pt,qt,On,Nn,Dn,ne,Mn,Ln,Vr};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{K}from"./chunk-
|
|
2
|
+
import{K}from"./chunk-nmy72s6r.js";import Le from"path";var t={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603};function Y(e){for(let[n,r]of Object.entries(t))if(r===e)return n;return}import at from"path";var ct={showRelativePaths:!1,enableAutoRecovery:K(),logRecoveryWarnings:!0},J={...ct};function M(){return{...J}}function P(e){if(!J.showRelativePaths||!e)return e;let n=J.baseDir||process.cwd();try{let r=at.relative(n,e);return r.startsWith("..")?e:r}catch{return e}}class L extends Error{code;filePath;line;column;context;numericCode;constructor(e,n,r,i,s,o,a){super(e);this.code=n;this.filePath=r;this.line=i;this.column=s;this.context=o;if(this.name="StxError",this.numericCode=a||t.EVALUATION_ERROR,this.filePath)this.filePath=P(this.filePath)}}class ae extends L{constructor(e,n,r,i,s,o){super(e,"stx_RUNTIME_ERROR",n,r,i,s,o||t.EVALUATION_ERROR);this.name="StxRuntimeError"}}class kr extends L{constructor(e,n,r,i,s,o){super(e,"stx_FILE_ERROR",n,r,i,s,o||t.FILE_NOT_FOUND);this.name="StxFileError"}}class q extends L{isFatal=!0;constructor(e,n,r,i,s,o){super(e,"stx_VALIDATION_ERROR",n,r,i,s,o||t.DOM_API_VIOLATION);this.name="StxValidationError"}}function he(e){let{type:n,message:r,code:i,filePath:s,line:o,column:a,template:l,offset:p,snippet:g,suggestion:h,format:m="text"}=e,y=o,x=a;if(!y&&l&&p!==void 0){let G=dt(l,p);y=G.line,x=G.column}let S=s?P(s):void 0,w=i?Y(i):void 0,C={type:n,code:i,codeName:w,message:r,filePath:S,line:y,column:x,snippet:g,suggestion:h,timestamp:new Date().toISOString()},A;switch(m){case"html":A=ut(C);break;case"json":A=JSON.stringify(C,null,2);break;case"console":A=gt(C,l,p);break;case"text":default:A=lt(C,l,p);break}return{formatted:A,data:C}}function lt(e,n,r){let i=[],s=e.code?` [${e.codeName||e.code}]`:"";if(i.push(`[${e.type} Error${s}]`),e.filePath){let o=e.filePath;if(e.line){if(o+=`:${e.line}`,e.column)o+=`:${e.column}`}i.push(`at ${o}`)}if(i.push(`
|
|
3
3
|
${e.message}`),n&&e.line){let o=pt(n,e.line,2);if(o)i.push(`
|
|
4
4
|
${o}`)}if(e.snippet)i.push(`
|
|
5
5
|
Snippet: ${e.snippet}`);if(e.suggestion)i.push(`
|
|
@@ -17,7 +17,7 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
|
|
|
17
17
|
`)}function ft(e,n,r){let i=e.split(`
|
|
18
18
|
`),s=Math.max(0,n-r-1),o=Math.min(i.length-1,n+r-1),a="\x1B[90m",l="\x1B[31m",p="\x1B[0m",g=[];for(let h=s;h<=o;h++){let m=(h+1).toString().padStart(4),y=h===n-1,x=y?"\x1B[31m>\x1B[0m":" ",S=y?`\x1B[31m${i[h]}\x1B[0m`:`\x1B[90m${i[h]}\x1B[0m`;g.push(`${x}\x1B[90m${m}\x1B[0m | ${S}`)}return g.join(`
|
|
19
19
|
`)}function me(e){return e.replace(/--/g,"- -").replace(/>/g,">")}function dt(e,n){let i=e.substring(0,n).split(`
|
|
20
|
-
`);return{line:i.length,column:i[i.length-1].length}}function c(e,n,r){return he({type:e,message:n,code:r,format:"html"}).formatted}async function Se(e,n,r){try{return await e()}catch(i){if(r&&i instanceof Error)r(i);return n}}var
|
|
20
|
+
`);return{line:i.length,column:i[i.length-1].length}}function c(e,n,r){return he({type:e,message:n,code:r,format:"html"}).formatted}async function Se(e,n,r){try{return await e()}catch(i){if(r&&i instanceof Error)r(i);return n}}var gi={isEnabled(){return M().enableAutoRecovery},fixCommonSyntaxErrors(e){let n=M();if(!n.enableAutoRecovery)return{fixed:e,fixes:[]};let r=e,i=[],s=(r.match(/\{\{/g)||[]).length,o=(r.match(/\}\}/g)||[]).length;if(s>o){let l=s-o;r+="}}".repeat(l),i.push(`Added ${l} missing closing braces '}}'`)}let a=["if","foreach","for","switch","section"];for(let l of a){let p=(r.match(new RegExp(`@${l}\\b`,"g"))||[]).length,g=(r.match(new RegExp(`@end${l}\\b`,"g"))||[]).length;if(p>g){let h=p-g;for(let m=0;m<h;m++)r+=`
|
|
21
21
|
@end${l}`;i.push(`Added ${h} missing @end${l}`)}}if(i.length>0&&n.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),i.forEach((l)=>console.warn(` - ${l}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:r,fixes:i}},createFallbackContent(e,n){if(K())return`<!-- ${e} failed: ${n.message} -->`;return"<!-- stx rendering error -->"}};class Z{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor(e={}){this.maxErrors=e.maxErrors??1000,this.enableFileLogging=e.enableFileLogging??!1,this.logFilePath=e.logFilePath??".stx/errors.log",this.logFormat=e.logFormat??"json",this.maxFileSize=e.maxFileSize??10485760,this.maxLogFiles=e.maxLogFiles??5,this.minLevel=e.minLevel??"all"}configure(e){if(e.maxErrors!==void 0)this.maxErrors=e.maxErrors;if(e.enableFileLogging!==void 0)this.enableFileLogging=e.enableFileLogging;if(e.logFilePath!==void 0)this.logFilePath=e.logFilePath;if(e.logFormat!==void 0)this.logFormat=e.logFormat;if(e.maxFileSize!==void 0)this.maxFileSize=e.maxFileSize;if(e.maxLogFiles!==void 0)this.maxLogFiles=e.maxLogFiles;if(e.minLevel!==void 0)this.minLevel=e.minLevel}log(e,n,r="error"){let i={timestamp:new Date,error:e,context:n,level:r};if(this.errors.push(i),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(r))this.writeToFile(i)}shouldLog(e){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return e==="error"||e==="warning";if(this.minLevel==="error")return e==="error";return!0}formatEntry(e){if(this.logFormat==="json")return JSON.stringify({timestamp:e.timestamp.toISOString(),level:e.level||"error",type:e.error.constructor.name,message:e.error.message,stack:e.error.stack,context:e.context});let n=[`[${e.timestamp.toISOString()}] [${(e.level||"error").toUpperCase()}] ${e.error.constructor.name}: ${e.error.message}`];if(e.error.stack)n.push(` Stack: ${e.error.stack.split(`
|
|
22
22
|
`).slice(1).join(`
|
|
23
23
|
`)}`);if(e.context)n.push(` Context: ${JSON.stringify(e.context)}`);return n.join(`
|
|
@@ -25,7 +25,7 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
|
|
|
25
25
|
`;n.appendFileSync(this.logFilePath,s,"utf-8")}catch(n){if(process.env.STX_DEBUG==="true")console.error("Failed to write to error log:",n)}})}async rotateIfNeeded(e){try{if(!e.existsSync(this.logFilePath))return;if(e.statSync(this.logFilePath).size<this.maxFileSize)return;for(let r=this.maxLogFiles-1;r>=1;r--){let i=`${this.logFilePath}.${r}`,s=`${this.logFilePath}.${r+1}`;if(e.existsSync(i))if(r>=this.maxLogFiles-1)e.unlinkSync(i);else e.renameSync(i,s)}if(this.maxLogFiles<=1)e.writeFileSync(this.logFilePath,"");else e.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch(n){if(process.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",n)}}getRecentErrors(e=10){return this.errors.slice(-e)}getErrorsByType(e){return this.errors.filter((n)=>n.error.constructor.name===e)}getErrorsByLevel(e){return this.errors.filter((n)=>n.level===e)}clear(){this.errors.length=0}async clearLogFile(){try{let e=await import("fs");if(e.existsSync(this.logFilePath))e.writeFileSync(this.logFilePath,"","utf-8")}catch(e){if(process.env.STX_DEBUG==="true")console.error("Failed to clear error log:",e)}}getStats(){let e={},n={error:0,warning:0,info:0};for(let r of this.errors){let i=r.error.constructor.name;e[i]=(e[i]||0)+1;let s=r.level||"error";n[s]=(n[s]||0)+1}return{total:this.errors.length,byType:e,byLevel:n}}async exportToFile(e,n="json"){let r=await import("fs"),i=await import("path"),s=i.dirname(e);if(!r.existsSync(s))r.mkdirSync(s,{recursive:!0});if(n==="json"){let o=this.errors.map((a)=>({timestamp:a.timestamp.toISOString(),level:a.level||"error",type:a.error.constructor.name,message:a.error.message,stack:a.error.stack,context:a.context}));r.writeFileSync(e,JSON.stringify(o,null,2),"utf-8")}else{let o=this.errors.map((a)=>this.formatEntry(a));r.writeFileSync(e,o.join(`
|
|
26
26
|
|
|
27
27
|
`),"utf-8")}}async flush(){await this.writeQueue}}var B=new Z,xn={isDevelopment(){return K()},logDetailedError(e,n){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",e.message),console.error("Stack:",e.stack),n)console.error("Context:",n);console.error("========================")},createErrorReport(e,n){let r=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${e.message}`,`Type: ${e.constructor.name}`,`Stack: ${e.stack}`];if(n)r.push(`Context: ${JSON.stringify(n,null,2)}`);return r.push("========================"),r.join(`
|
|
28
|
-
`)}};function b(e,n,r,i=0){let s=0,o=i,a=null,l=0,p=!1;while(o<e.length){let g=e[o];if(a&&p){p=!1,o++;continue}if(a&&g==="\\"){p=!0,o++;continue}if(p=!1,(g==='"'||g==="'"||g==="`")&&!a){a=g,o++;continue}if(g===a&&a!=="`"){a=null,o++;continue}if(a==="`"&&g==="$"&&e[o+1]==="{"){l++,o+=2;continue}if(l>0&&g==="}"){l--,o++;continue}if(g==="`"&&a==="`"&&l===0){a=null,o++;continue}if(a){o++;continue}if(g===n)s++;else if(g===r){if(s--,s===0)return o}o++}return-1}function
|
|
28
|
+
`)}};function b(e,n,r,i=0){let s=0,o=i,a=null,l=0,p=!1;while(o<e.length){let g=e[o];if(a&&p){p=!1,o++;continue}if(a&&g==="\\"){p=!0,o++;continue}if(p=!1,(g==='"'||g==="'"||g==="`")&&!a){a=g,o++;continue}if(g===a&&a!=="`"){a=null,o++;continue}if(a==="`"&&g==="$"&&e[o+1]==="{"){l++,o+=2;continue}if(l>0&&g==="}"){l--,o++;continue}if(g==="`"&&a==="`"&&l===0){a=null,o++;continue}if(a){o++;continue}if(g===n)s++;else if(g===r){if(s--,s===0)return o}o++}return-1}function Wc(e,n){let r=n,i={paren:0,bracket:0,brace:0},s=null,o=0;while(r<e.length){let a=e[r];if((r>0?e[r-1]:"")==="\\"&&s){r++;continue}if((a==='"'||a==="'")&&!s){s=a,r++;continue}if(a===s&&s!=="`"){s=null,r++;continue}if(a==="`"&&!s){s="`",r++;continue}if(a==="`"&&s==="`"&&o===0){s=null,r++;continue}if(s==="`"&&a==="$"&&e[r+1]==="{"){o++,r+=2;continue}if(o>0){if(a==="{")o++;else if(a==="}")o--;r++;continue}if(s){r++;continue}if(i.paren===0&&i.bracket===0&&i.brace===0){if(e.slice(r,r+2)==="}}"||e.slice(r,r+3)==="!!}")break;if(a===","||a===";")break}if(a==="(")i.paren++;else if(a===")"){if(i.paren--,i.paren<0)break}else if(a==="[")i.bracket++;else if(a==="]"){if(i.bracket--,i.bracket<0)break}else if(a==="{")i.brace++;else if(a==="}"){if(i.brace--,i.brace<0)break}r++}return{expression:e.slice(n,r),endPos:r}}var mt={maxSanitizeDepth:10,allowBracketNotation:!1},ve={...mt};var j=/\bnew\s+/,z="__stx_safe_ctors",$e=["Bun","Deno","Buffer","fetch","atob","btoa","console","Response","Request","Headers","WebAssembly","structuredClone","queueMicrotask","crypto","performance","navigator","Worker","WebSocket","BroadcastChannel","EventSource","XMLHttpRequest","localStorage","sessionStorage"],Q=[...$e,"Function","setTimeout","setInterval","setImmediate","process","require","exports","module","window","document","global","globalThis","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry"],ye=Q.map(()=>{return}),ee=Object.freeze(Object.assign(Object.create(null),{keys:Object.keys,values:Object.values,entries:Object.entries,fromEntries:Object.fromEntries,assign:Object.assign,hasOwn:Object.hasOwn,is:Object.is})),ne=[/\b(eval|Function|setTimeout|setInterval|setImmediate)\b/,/\b(process|require|import|exports|module)\b/,/\b(window|document|global|globalThis)\b/,/\b(constructor|prototype|__proto__)\b/,/\b(Reflect|Proxy)\b/,/\bSymbol\b/,/\b(WeakMap|WeakSet|WeakRef|FinalizationRegistry)\b/,/\b(Generator|AsyncGenerator)\b/,/__\w+__/,/\.(bind|call|apply)\s*\(/,j,/\bdelete\s+/,/\bthis\b/,/\\u(?:\{[\dA-Fa-f]+\}|[\dA-Fa-f]{4})/],re=new Set([...$e,"eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this",z]),ie=new Set(["__proto__","constructor","prototype"]);function Re(e){let n="",r=[],i=null,s=!1;for(let o=0;o<e.length;o++){let a=e[o];if(s){s=!1;continue}if(a==="\\"&&i){s=!0;continue}if(i){if(i==="`"&&a==="$"&&o+1<e.length&&e[o+1]==="{"){let l=1;o+=2;while(o<e.length&&l>0){if(e[o]==="{")l++;else if(e[o]==="}")l--;if(l>0)n+=e[o],r.push(o),o++}continue}if(a===i)i=null;continue}if(a==='"'||a==="'"||a==="`"){i=a;continue}n+=a,r.push(o)}return{text:n,map:r}}function Ce(e){return Re(e).text}var Te=["Collator","DateTimeFormat","DisplayNames","ListFormat","Locale","NumberFormat","PluralRules","RelativeTimeFormat","Segmenter"],Ae=(()=>{let e={Date,URL,URLSearchParams},n=Intl;for(let r of Te)if(typeof n[r]==="function")e[`Intl_${r}`]=n[r];return Object.freeze(Object.assign(Object.create(null),e))})(),ht=/^new(\s+)(Date|URLSearchParams|URL|Intl\s*\.\s*([A-Z_a-z]\w*))\s*\(/,Ee=/(?<![\w$])new(?![\w$])/g,be=`only new Date(), new URL(), new URLSearchParams() and new Intl.{${Te.join(",")}}() are allowed`;function yt(e){let{text:n,map:r}=Re(e),i=[];Ee.lastIndex=0;let s;while((s=Ee.exec(n))!==null){let a=s.index;if(/(?<!\.)\.\s*$/.test(n.slice(0,a)))continue;let l=ht.exec(n.slice(a)),p=l?.[3],g=!l?null:p?`Intl_${p}`:l[2];if(!l||!g||!(g in Ae))throw new k(`matched /${j.source}/; ${be}`,e);let h=a+l[0].length,m=r[a],y=r[h-1]+1;if(e.slice(m,y)!==n.slice(a,h))throw new k(`matched /${j.source}/; ${be}`,e);let x=m+3+l[1].length;i.push({start:x,end:x+l[2].length,key:g})}let o=e;for(let a=i.length-1;a>=0;a--){let l=i[a];o=`${o.slice(0,l.start)}${z}.${l.key}${o.slice(l.end)}`}return{source:o,usesSafeConstructors:i.length>0}}class k extends Error{rule;expression;constructor(e,n,r){super(r??`Potentially unsafe expression (${e}): ${n}`);this.name="UnsafeExpressionError",this.rule=e,this.expression=n}}function js(e){try{return se(e),null}catch(n){return n instanceof k?n.rule:n instanceof Error?n.message:String(n)}}function _e(e,n){let r=/[$A-Z_a-z][$\w]*/g,i;while((i=r.exec(e))!==null){let s=i[0],o=e[i.index-1];if(re.has(s))throw new k(`matched /\\b${s}\\b/; identifier ${s}`,n);if(o==="."&&ie.has(s))throw new k(`matched /.${s}/; property ${s}`,n)}}function Ie(e,n=!0){let r=/(?:[$\w)\].]|\?\.)\s*\[([^\]]*)\]/g,i=new Set,s;while((s=r.exec(e))!==null){let o=s.index+s[0].indexOf("["),a=e.slice(0,o);if(/(?:^|[^$\w])(?:let|const|var)\s*$/.test(a))continue;let l=s[1].trim(),p=/^'(?:[^'\\]|\\.)*'$/.test(l),g=/^"(?:[^"\\]|\\.)*"$/.test(l);if(/^\d+$/.test(l))continue;if(p||g){let m=l.slice(1,-1);if(ie.has(m))throw new k(`bracket key ${m}`,e);if(!ve.allowBracketNotation)throw new k("bracket notation with a string key; enable with configureSafeEvaluator({ allowBracketNotation: true })",e,`Bracket notation with strings not allowed: ${e}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);continue}if(n&&/^[$A-Z_a-z][$\w]*$/.test(l)){i.add(l);continue}throw new k("dynamic bracket notation is not allowed",e)}return[...i]}function se(e){let n=e.trim(),r=Ce(n);_e(r,n);let i=Ie(n);for(let s of ne){if(s===j)continue;if(s.test(r))throw new k(`matched /${s.source}/`,n)}return{...yt(n),dynamicKeys:i}}function fi(e){return se(e),e.trim()}var Bs=Symbol("stx.sanitizeCache"),Et=4000,F=new Map;function bt(e){let n=F.get(e);if(n===void 0){if(n=ne.some((r)=>r.test(e)),F.size>=Et)F.clear();F.set(e,n)}return n}function H(e){let n={},r=e[Bs];n.Math=Math,n.JSON=JSON,n.Date=Date,n.String=String,n.Number=Number,n.Boolean=Boolean,n.Array=Array,n.Object=ee,n.parseInt=Number.parseInt,n.parseFloat=Number.parseFloat,n.isNaN=Number.isNaN,n.isFinite=Number.isFinite,n.encodeURIComponent=encodeURIComponent,n.decodeURIComponent=decodeURIComponent;for(let[i,s]of Object.entries(e)){if(i.startsWith("__")||bt(i))continue;if(s&&typeof s==="object"&&!Array.isArray(s)){let o=r?.get(s);if(o===void 0)o=te(s),r?.set(s,o);n[i]=o}else n[i]=s}return n}function te(e,n=0){if(n>=ve.maxSanitizeDepth)return"[Object too deep]";if(e===null||typeof e!=="object")return e;if(Array.isArray(e))return e.map((i)=>te(i,n+1));if(e instanceof Date||e instanceof RegExp||e instanceof Map||e instanceof Set||e instanceof Error)return e;let r={};for(let[i,s]of Object.entries(e)){if(i.startsWith("__")||i==="constructor"||i==="prototype")continue;if(s&&typeof s==="object")r[i]=te(s,n+1);else r[i]=s}return r}function u(e,n){try{let r=H(n),i=Object.keys(r),s=Object.values(r);return d(e,i)(...s)}catch{return}}function f(e){try{return fi(e),!0}catch{return!1}}function Uc(e,n){try{let r=H(n),i=Object.keys(r),s=Object.values(r),o=!1,l=d(e,i,()=>{o=!0})(...s);return!o&&Boolean(l)}catch{return!1}}function R(e,n){try{let r=u(e,n);if(r&&typeof r==="object"&&!Array.isArray(r))return r;return{}}catch{return{}}}var Oe=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","let","static","implements","interface","package","private","protected","public","arguments","eval","await"]),xt=2000,D=new Map;function xe(e,n){let r=`${e.join(",")}\x00${n}`,i=D.get(r);if(i)return i;let s=Function(...e,n);if(D.size>=xt)D.clear();return D.set(r,s),s}function nt(e){return e.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:)/g,"$1$2").match(/\b[a-zA-Z_$][\w$]*\b/g)||[]}var wt=/^[A-Za-z_$][\w$]*$/;function Mt(e){return wt.test(e)&&!Oe.has(e)}function d(e,n,r){let{source:i,usesSafeConstructors:s,dynamicKeys:o}=se(e),a=[];for(let m=0;m<n.length;m++){if(!Mt(n[m]))continue;if(n[m]===z||n[m]==="Object"||re.has(n[m]))continue;a.push({key:n[m],index:m})}a.sort((m,y)=>m.key<y.key?-1:1);let l=a.map((m)=>m.key),p=a.map((m)=>m.index),g=`
|
|
29
29
|
'use strict';
|
|
30
30
|
try {
|
|
31
31
|
return ${i};
|
|
@@ -36,11 +36,11 @@ catch (e) {
|
|
|
36
36
|
}
|
|
37
37
|
throw e;
|
|
38
38
|
}
|
|
39
|
-
`;return St(kt(s?(m)=>{let y=xe([z,"Object",...Q,...l,...m],g);return(...x)=>y(Ae,ee,...ye,...x)}:(m)=>{let y=xe(["Object",...Q,...l,...m],g);return(...x)=>y(ee,...ye,...x)},l,n,a,p,r),n,o)}function St(e,n,r){if(r.length===0)return e;let i=r.map((s)=>n.indexOf(s));return(...s)=>{for(let o of i){if(o<0)continue;let a=s[o];if(typeof a==="string"&&ie.has(a))return}return e(...s)}}function kt(e,n,r,i,s,o){let a=e([]),l=i.every((g,h)=>g.index===h);if(n.length===r.length&&l)return we(a,n,e,void 0,o);return we((...g)=>{let h=Array(s.length);for(let m=0;m<s.length;m++)h[m]=g[s[m]];return a(...h)},n,e,(g)=>{a=e(g)},o)}function we(e,n,r,i,s){let a=/^(\w+) is not defined$/,l=e,p=[],g=new Set(n);return(...h)=>{for(let m=0;m<=8;m++)try{return l(...h)}catch(y){let x=y instanceof Error?y.message:"",S=a.exec(x);if(!(y instanceof ReferenceError)||!S)return;let w=S[1];if(g.has(w)||Oe.has(w)||re.has(w))return;if(s?.(w),g.add(w),p.push(w),i)i(p);else l=r(p)}return}}function
|
|
40
|
-
`:a==="t"?"\t":a;continue}if(o===r)return null;if(r==="`"&&o==="$"&&n[s+1]==="{")return null;i+=o}return i}var vt=new Set(["true","false","null","undefined","typeof","void","new","in","of","instanceof","this","delete","await","async","function","return","NaN","Infinity"]);function Bt(e,n){let r=e.trim();if(!r)return{ok:!1,message:"the argument is empty",code:t.INVALID_DIRECTIVE_SYNTAX};let i=
|
|
41
|
-
${i}${e.slice(r)}`}var le=
|
|
42
|
-
${o[0]}${e.slice(r,o.index)}${e.slice(a,s)}${e.slice(s)}`}function
|
|
43
|
-
${n[0]}${i.slice(s)}`}var Ue="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",U="data-stx-html-attrs",V="data-stx-html-class",Ve=/^[A-Za-z_:][\w:.-]*$/;function v(e){return String(e).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Ft(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function st(e){if(e.name)return`name="${e.name}"`;if(e.property)return`property="${e.property}"`;if(e.charset!=null)return"charset=";if(e["http-equiv"])return`http-equiv="${e["http-equiv"]}"`;return""}function Dt(e){let n=/^\s*<meta\b([^>]*)>/i.exec(e);if(!n)return null;let r={};for(let i of n[1].matchAll(/([\w:-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g))r[i[1].toLowerCase()]=i[2]??i[3]??i[4]??"";return r}function _(e,n){return Object.entries(e).filter(([r])=>!n?.(r)).map(([r,i])=>`${r}="${v(String(i))}"`).join(" ")}function W(e){let n=String(e.content),r=typeof e.type==="string"?e.type.trim().toLowerCase():"";return/json$|^importmap$/.test(r)?n.replace(/<\//g,"<\\/"):n}function We(e){let n=_(e,(r)=>r==="content");return`<script${n?` ${n}`:""}>${W(e)}</script>`}function zt(e={},n="en"){let r=[],i=[],s="",o=n;for(let[l,p]of Object.entries(e||{})){if(p==null)continue;let g=l.trim();if(!Ve.test(g))continue;let h=g.toLowerCase();if(h==="lang"){o=String(p);continue}if(h==="class"){s=String(p).trim();continue}r.push(` ${g}="${v(String(p))}"`),i.push(g)}let a=` lang="${v(o)}"`;if(s)a+=` class="${v(s)}"`;if(a+=r.join(""),s)a+=` ${V}="${v(s)}"`;if(i.length)a+=` ${U}="${v(i.join(" "))}"`;return a}function
|
|
39
|
+
`;return St(kt(s?(m)=>{let y=xe([z,"Object",...Q,...l,...m],g);return(...x)=>y(Ae,ee,...ye,...x)}:(m)=>{let y=xe(["Object",...Q,...l,...m],g);return(...x)=>y(ee,...ye,...x)},l,n,a,p,r),n,o)}function St(e,n,r){if(r.length===0)return e;let i=r.map((s)=>n.indexOf(s));return(...s)=>{for(let o of i){if(o<0)continue;let a=s[o];if(typeof a==="string"&&ie.has(a))return}return e(...s)}}function kt(e,n,r,i,s,o){let a=e([]),l=i.every((g,h)=>g.index===h);if(n.length===r.length&&l)return we(a,n,e,void 0,o);return we((...g)=>{let h=Array(s.length);for(let m=0;m<s.length;m++)h[m]=g[s[m]];return a(...h)},n,e,(g)=>{a=e(g)},o)}function we(e,n,r,i,s){let a=/^(\w+) is not defined$/,l=e,p=[],g=new Set(n);return(...h)=>{for(let m=0;m<=8;m++)try{return l(...h)}catch(y){let x=y instanceof Error?y.message:"",S=a.exec(x);if(!(y instanceof ReferenceError)||!S)return;let w=S[1];if(g.has(w)||Oe.has(w)||re.has(w))return;if(s?.(w),g.add(w),p.push(w),i)i(p);else l=r(p)}return}}function Fs(e){let n=e.trim();try{let r=Ce(n);if(/\b(?:eval|function|import|require|process|globalthis|window|document|fetch|bun|deno|buffer|console|reflect|proxy|prototype|constructor|this)\b/i.test(r))return!1;_e(r,n),Ie(n);for(let i of ne)if(i.test(r))return!1}catch{return!1}return!0}function mi(e,n){let r=[];n.lastIndex=0;let i;while((i=n.exec(e))!==null){let s=i.index,o=s+i[0].length-1,a=b(e,"(",")",o);if(a===-1){r.push({start:s,end:-1,args:"",call:e.slice(s,Math.min(e.length,s+80))}),n.lastIndex=o+1;continue}r.push({start:s,end:a+1,args:e.slice(o+1,a),call:e.slice(s,a+1)}),n.lastIndex=a+1}return r}function Lt(e,n,r,i){let s="",o=0;for(let a of mi(e,n)){if(s+=e.slice(o,a.start),a.end===-1){s+=i(a.call),o=a.start;continue}s+=r(a.args,a.call),o=a.end}return s+e.slice(o)}function jt(e){let n=[],r=0,i=null,s="";for(let o=0;o<e.length;o++){let a=e[o];if(i){if(s+=a,a==="\\"&&o+1<e.length){s+=e[++o];continue}if(a===i)i=null;continue}if(a==="'"||a==='"'||a==="`")i=a;else if(a==="("||a==="["||a==="{")r++;else if(a===")"||a==="]"||a==="}")r--;else if(a===","&&r===0){n.push(s.trim()),s="";continue}s+=a}if(s.trim())n.push(s.trim());return n}function ce(e){let n=e.trim(),r=n[0];if(r!=="'"&&r!=='"'&&r!=="`"||n.length<2||n.at(-1)!==r)return null;let i="";for(let s=1;s<n.length-1;s++){let o=n[s];if(o==="\\"&&s+1<n.length-1){let a=n[++s];i+=a==="n"?`
|
|
40
|
+
`:a==="t"?"\t":a;continue}if(o===r)return null;if(r==="`"&&o==="$"&&n[s+1]==="{")return null;i+=o}return i}var vt=new Set(["true","false","null","undefined","typeof","void","new","in","of","instanceof","this","delete","await","async","function","return","NaN","Infinity"]);function Bt(e,n){let r=e.trim();if(!r)return{ok:!1,message:"the argument is empty",code:t.INVALID_DIRECTIVE_SYNTAX};let i=js(r);if(i)return{ok:!1,message:`the expression is not allowed (${i})`,code:t.UNSAFE_EXPRESSION};let s=H(n),o;try{o=d(r,Object.keys(s))(...Object.values(s))}catch(l){return{ok:!1,message:`the expression could not be evaluated: ${l instanceof Error?l.message:String(l)}`,code:t.EVALUATION_ERROR}}if(o!==void 0&&o!==null)return{ok:!0,value:o};let a=[...new Set(nt(r))].filter((l)=>!vt.has(l)&&!(l in s)&&!(l in globalThis));if(a.length>0)return{ok:!1,message:`${a.map((p)=>`"${p}"`).join(", ")} ${a.length===1?"is":"are"} not defined here. Values a directive reads must come from <script server> or the render context; a plain <script> runs in the browser. To pass literal text, quote it.`,code:t.UNDEFINED_VARIABLE};if(o===void 0&&(r.startsWith("{")||r.startsWith("[")))return{ok:!1,message:"the expression threw while it was evaluated",code:t.EVALUATION_ERROR};return{ok:!0,value:o}}function ze(e){if(e===null)return"null";if(Array.isArray(e))return"an array";if(typeof e==="object")return"an object";if(typeof e==="string")return`a string ("${e.length>40?`${e.slice(0,40)}...`:e}")`;return`${/^[aeiou]/.test(typeof e)?"an":"a"} ${typeof e}`}function rt(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Ne(e){if(!e)return"";return Le.isAbsolute(e)?Le.relative(process.cwd(),e)||e:e}function oe(e){let n=e.replace(/\s+/g," ").trim();return n.length>80?`${n.slice(0,77)}...`:n}function N(e,n,r,i,s=t.EVALUATION_ERROR){let o=i?` in ${Ne(i)}`:"";return console.warn(`[stx] ${oe(n)}${o}: ${r}`),c(e,`${oe(n)}: ${r}`,s)}function zs(e,n,r){let i=r?` in ${Ne(r)}`:"";console.warn(`[stx] ${oe(e)}${i}: ${n}`)}function hi(){return{afterOpen:[],beforeClose:[]}}function $t(e){return e.afterOpen.length>0||e.beforeClose.length>0}function qc(e,n){if(!$t(n))return e;let r=n.afterOpen.join(""),i=n.beforeClose.join(""),s=e.lastIndexOf("</head>"),o=r?_r(e):null,a=i&&s!==-1?s:null;if(o===null&&a===null)return e;if(o!==null&&a!==null)return`${e.slice(0,o)}${r}${e.slice(o,a)}${i}${e.slice(a)}`;if(o!==null)return`${e.slice(0,o)}${r}${e.slice(o)}`;return`${e.slice(0,a)}${i}${e.slice(a)}`}var Me=/\s*<meta\b[^>]*\bcharset\b[^>]*>/iy;function _r(e){let n=/<head\b[^>]*>/i.exec(e);if(!n)return null;let r=n.index+n[0].length;Me.lastIndex=r;let i=Me.exec(e);return i?r+i[0].length:r}var ue="data-stx-color-mode-boot",Pe="__STX_COLOR_MODE__",Rt=new Set(["light","dark","auto","system"]),Ct=new Set(["auto","system"]),Tt=/^[a-z][\w:-]*$/i,At=/^[\w-]+$/;function _t(e){let n=e.storageKey??"stx-color-mode",r=e.initialMode??"auto",i=e.darkClass===void 0?"dark":e.darkClass,s=e.attribute??null,o=e.autoValue??null,a=e.respectExisting===!0;if(typeof n!=="string"||n.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!Rt.has(r))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(r)}`);if(i!==null&&(typeof i!=="string"||!At.test(i)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(i)}`);if(s!==null&&(typeof s!=="string"||!Tt.test(s)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(s)}`);if(o!==null&&!Ct.has(o))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(o)}`);if(i===null&&s===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");if(a&&s===null)throw Error("colorMode.respectExisting needs an attribute to read \u2014 the dark class alone cannot say whether a mode was chosen");return{storageKey:n,initialMode:r==="system"?"auto":r,darkClass:i,attribute:s,autoValue:o,respectExisting:a}}function It(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function ge(e={}){let n=_t(e),r=It(n),i=`(function(){"use strict";var o=window.${Pe};if(o&&typeof o.sync==="function"){o.sync();return}var c=${r};var r=document.documentElement;function read(){var p=c.initialMode,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){}return{p:p,a:a}}function sys(){try{return matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){return"light"}}function stamp(m){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)}}var s=read();var f=null;if(c.respectExisting&&c.attribute){var x=r.getAttribute(c.attribute);if(x==="light"||x==="dark")f=x}var m=f||(s.p==="auto"?sys():s.p);var p=s.p;stamp(m);var g=null;function sync(){var t=read(),n=f||(t.p==="auto"?sys():t.p);var moved=n!==m,chose=t.p!==p;if(moved){r.style.setProperty("transition","none","important");stamp(n);void r.offsetHeight;r.style.removeProperty("transition")}else stamp(n);m=n;p=t.p;if(g){g.mode=n;g.preference=t.p;if(t.a)g.autoValue=t.a}if(moved||chose){try{window.dispatchEvent(new CustomEvent("stx:color-mode",{detail:{mode:n,preference:t.p}}))}catch(e){}}}try{g=window.${Pe}={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:s.a||"auto",respectExisting:c.respectExisting,forced:f,preference:p,mode:m,watching:true,sync:sync}}catch(e){}try{var q=matchMedia("(prefers-color-scheme: dark)");if(q.addEventListener)q.addEventListener("change",sync);else if(q.addListener)q.addListener(sync)}catch(e){}try{addEventListener("pageshow",sync);addEventListener("storage",function(e){if(e.key===null||e.key===c.storageKey)sync()});document.addEventListener("visibilitychange",function(){if(document.visibilityState==="visible")sync()})}catch(e){}}());`;return`<script ${ue}>${i}</script>`}function Cr(e,n={}){if(e.includes(ue))return e;let r=le(e);if(r===null)return e;let i=ge(n);return`${e.slice(0,r)}
|
|
41
|
+
${i}${e.slice(r)}`}var le=_r,Ot=new RegExp(`<script\\b[^>]*\\b${ue}\\b[^>]*>[\\s\\S]*?<\\/script>`,"i"),Fe=/<meta\b[^>]*\bcharset\b[^>]*>/gi,De=/<\/head>/gi;function Nt(e){let n=/<head\b[^>]*>/i.exec(e);if(!n)return e;let r=n.index+n[0].length;De.lastIndex=r;let i=De.exec(e),s=i?i.index:e.length;Fe.lastIndex=r;let o=Fe.exec(e);if(!o||o.index>=s)return e;if(e.slice(r,o.index).trim()==="")return e;let a=o.index+o[0].length;return`${e.slice(0,r)}
|
|
42
|
+
${o[0]}${e.slice(r,o.index)}${e.slice(a,s)}${e.slice(s)}`}function Kc(e){return Pt(Nt(e))}function Pt(e){let n=Ot.exec(e);if(!n)return e;let r=le(e);if(r===null)return e;if(n.index<=r||e.slice(r,n.index).trim()==="")return e;let i=e.slice(0,n.index)+e.slice(n.index+n[0].length),s=le(i);if(s===null)return e;return`${i.slice(0,s)}
|
|
43
|
+
${n[0]}${i.slice(s)}`}var Ue="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",U="data-stx-html-attrs",V="data-stx-html-class",Ve=/^[A-Za-z_:][\w:.-]*$/;function v(e){return String(e).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Ft(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function st(e){if(e.name)return`name="${e.name}"`;if(e.property)return`property="${e.property}"`;if(e.charset!=null)return"charset=";if(e["http-equiv"])return`http-equiv="${e["http-equiv"]}"`;return""}function Dt(e){let n=/^\s*<meta\b([^>]*)>/i.exec(e);if(!n)return null;let r={};for(let i of n[1].matchAll(/([\w:-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g))r[i[1].toLowerCase()]=i[2]??i[3]??i[4]??"";return r}function _(e,n){return Object.entries(e).filter(([r])=>!n?.(r)).map(([r,i])=>`${r}="${v(String(i))}"`).join(" ")}function W(e){let n=String(e.content),r=typeof e.type==="string"?e.type.trim().toLowerCase():"";return/json$|^importmap$/.test(r)?n.replace(/<\//g,"<\\/"):n}function We(e){let n=_(e,(r)=>r==="content");return`<script${n?` ${n}`:""}>${W(e)}</script>`}function zt(e={},n="en"){let r=[],i=[],s="",o=n;for(let[l,p]of Object.entries(e||{})){if(p==null)continue;let g=l.trim();if(!Ve.test(g))continue;let h=g.toLowerCase();if(h==="lang"){o=String(p);continue}if(h==="class"){s=String(p).trim();continue}r.push(` ${g}="${v(String(p))}"`),i.push(g)}let a=` lang="${v(o)}"`;if(s)a+=` class="${v(s)}"`;if(a+=r.join(""),s)a+=` ${V}="${v(s)}"`;if(i.length)a+=` ${U}="${v(i.join(" "))}"`;return a}function Gc(e={},n={}){let r={...e,...n};if(e.class&&n.class){let i=e.class.split(/\s+/).filter(Boolean);for(let s of n.class.split(/\s+/).filter(Boolean))if(!i.includes(s))i.push(s);r.class=i.join(" ")}return r}function Er(e,n={}){if(!n||Object.keys(n).length===0)return e;let r=e.match(/<html\b([^>]*)>/i);if(!r)return e;let i={},s=[],o=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,a;while((a=o.exec(r[1]))!==null){let h=a[1];if(!(h in i))s.push(h);i[h]=a[2]??a[3]??a[4]??""}let l=[],p=[];for(let[h,m]of Object.entries(n)){if(m==null)continue;let y=h.trim();if(!Ve.test(y))continue;let x=y.toLowerCase();if(x==="class"){let S=(i.class||"").split(/\s+/).filter(Boolean);for(let w of String(m).split(/\s+/).filter(Boolean))if(!S.includes(w))S.push(w),l.push(w);if(!("class"in i))s.push("class");i.class=S.join(" ");continue}if(!(y in i))s.push(y);if(i[y]=String(m),x!=="lang")p.push(y)}if(l.length){if(!(V in i))s.push(V);i[V]=l.join(" ")}if(p.length){if(!(U in i))s.push(U);i[U]=p.join(" ")}let g=s.map((h)=>` ${h}="${v(i[h])}"`).join("");return e.replace(r[0],()=>`<html${g}>`)}function Xc(e){if(e.includes("data-stx-cloak"))return null;if(e.lastIndexOf("</head>")===-1)return null;return`${Ue}
|
|
44
44
|
`}function Ht(e){let n=[],r=0;while(r<e.length){let o=e.slice(r),a=o.match(/^\s+/);if(a){r+=a[0].length;continue}if(o.startsWith("<!--")){let m=e.indexOf("-->",r);if(m===-1)break;r=m+3;continue}let l=o.match(/^<script\b[^>]*>/i);if(l){let m=e.toLowerCase().indexOf("</script>",r+l[0].length);if(m===-1)break;r=m+9;continue}let p=o.match(/^<link\b[^>]*>/i);if(p){n.push(p[0]),r+=p[0].length;continue}let g=o.match(/^<meta\b[^>]*>/i);if(g){n.push(g[0]),r+=g[0].length;continue}let h=o.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(h){n.push(h[0]),r+=h[0].length;continue}break}if(n.length===0)return{body:e,hoisted:n};let i="",s=0;while(s<e.length&&s<r){let o=e.slice(s),a=o.match(/^<link\b[^>]*>/i);if(a&&n.includes(a[0])){s+=a[0].length;continue}let l=o.match(/^<meta\b[^>]*>/i);if(l&&n.includes(l[0])){s+=l[0].length;continue}let p=o.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(p&&n.includes(p[0])){s+=p[0].length;continue}i+=e[s],s++}return i+=e.slice(r),{body:i,hoisted:n}}function Ut(e,n={},r={}){let{title:i="stx App",lang:s="en",meta:o=[],link:a=[],script:l=[],headRaw:p="",htmlAttrs:g={},bodyClass:h="",bodyAttrs:m={}}=n,y=r.title||i,x=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],S=new Set(o.map(st).filter(Boolean)),{body:w,hoisted:C}=Ht(e),A=new Set(C.flatMap((E)=>{let O=Dt(E);return O?[st(O)].filter(Boolean):[]})),Ye=[...x.filter((E)=>!S.has(st(E))),...o].filter((E)=>!A.has(st(E))).map((E)=>` <meta ${_(E)}>`).join(`
|
|
45
45
|
`),Je=a.map((E)=>` <link ${_(E)}>`).join(`
|
|
46
46
|
`),Ze=l.map((E)=>{if(E.src)return` <script ${_(E,(O)=>O==="content")}></script>`;if(E.content)return` ${We(E)}`;return""}).filter(Boolean).join(`
|
|
@@ -54,8 +54,8 @@ ${it.join(`
|
|
|
54
54
|
${ot.join(`
|
|
55
55
|
`)}
|
|
56
56
|
</body>
|
|
57
|
-
</html>`}var pe=/\s+/y,fe=/<(script|style)\b[^>]*>/iy,Vt=/<\/script>/gi,Wt=/<\/style>/gi,je=/<!DOCTYPE\b/iy,Be=/<html[\s>]/iy;function Sn(e){let n=0;while(n<e.length){if(pe.lastIndex=n,pe.exec(e)){n=pe.lastIndex;continue}if(e.startsWith("<!--",n)){let s=e.indexOf("-->",n);if(s===-1)return!1;n=s+3;continue}fe.lastIndex=n;let i=fe.exec(e);if(i){let s=i[1].toLowerCase()==="script"?Vt:Wt;s.lastIndex=fe.lastIndex;let o=s.exec(e);if(o===null)return!1;n=o.index+o[0].length;continue}if(je.lastIndex=n,je.test(e))return!0;return Be.lastIndex=n,Be.test(e)}return!1}function
|
|
57
|
+
</html>`}var pe=/\s+/y,fe=/<(script|style)\b[^>]*>/iy,Vt=/<\/script>/gi,Wt=/<\/style>/gi,je=/<!DOCTYPE\b/iy,Be=/<html[\s>]/iy;function Sn(e){let n=0;while(n<e.length){if(pe.lastIndex=n,pe.exec(e)){n=pe.lastIndex;continue}if(e.startsWith("<!--",n)){let s=e.indexOf("-->",n);if(s===-1)return!1;n=s+3;continue}fe.lastIndex=n;let i=fe.exec(e);if(i){let s=i[1].toLowerCase()==="script"?Vt:Wt;s.lastIndex=fe.lastIndex;let o=s.exec(e);if(o===null)return!1;n=o.index+o[0].length;continue}if(je.lastIndex=n,je.test(e))return!0;return Be.lastIndex=n,Be.test(e)}return!1}function yi(e){return Sn(e)}function Jc(e,n={}){let r=e.lastIndexOf("</head>");if(r===-1)return e;let{meta:i=[],link:s=[],script:o=[],headRaw:a=""}=n,l=e.slice(0,r),p=[];for(let g of i){let h=st(g);if(h&&l.includes(h))continue;p.push(` <meta ${_(g)}>`)}for(let g of s){if(g.href&&l.includes(`href="${g.href}"`))continue;p.push(` <link ${_(g)}>`)}for(let g of o)if(g.src){if(l.includes(`src="${g.src}"`))continue;p.push(` <script ${_(g,(h)=>h==="content")}></script>`)}else if(g.content){if(l.includes(W(g)))continue;p.push(` ${We(g)}`)}if(a&&!l.includes(a))p.push(` ${a}`);if(p.length===0)return e;return`${e.slice(0,r)}${p.join(`
|
|
58
58
|
`)}
|
|
59
|
-
${e.slice(r)}`}function
|
|
60
|
-
`)}function
|
|
61
|
-
`,"")),headContent:n.trim()}}function
|
|
59
|
+
${e.slice(r)}`}function Tr(e,n={},r={},i){if(i??yi(e))return e;return Ut(e,n,r)}var Xt=["og:","article:","book:","profile:","fb:","music:","video:"],Kt=/^[a-z][\w-]*(?::[\w:-]+)?$/i;function $r(e,n){if(e.length<1)return{kind:"error",message:"meta directive requires at least the meta name",code:t.INVALID_DIRECTIVE_SYNTAX};if(e.length>2)return{kind:"error",message:`@meta takes a name and a value, got ${e.length} arguments`,code:t.INVALID_DIRECTIVE_SYNTAX};let r=qt(e[0],n);if(typeof r!=="string")return r;let i;if(e.length===2){let o=Gt(e[1],n);if(typeof o!=="string")return o;i=o}else{let o=r.includes(":")?r.slice(r.indexOf(":")+1):r,a=n.openGraph,l=n[o]??(rt(a)?a[o]:void 0);i=l===void 0||l===null||typeof l==="object"?"":String(l)}if(!i)return{kind:"empty"};return{kind:"tag",tag:Xt.some((o)=>r.startsWith(o))?{property:r,content:i}:{name:r,content:i}}}function qt(e,n){let r=ce(e);if(r!==null)return r.trim()?r:{kind:"error",message:"the meta name is empty",code:t.INVALID_DIRECTIVE_SYNTAX};if(Kt.test(e.trim()))return e.trim();let i=Bt(e,n);if(!i.ok)return{kind:"error",message:`meta name: ${i.message}`,code:i.code};if(typeof i.value!=="string"||!i.value.trim())return{kind:"error",message:`the meta name must be a non-empty string, got ${ze(i.value)}`,code:t.TYPE_ERROR};return i.value}function Gt(e,n){let r=ce(e);if(r!==null)return r;let i=Bt(e,n);if(!i.ok)return{kind:"error",message:i.message,code:i.code};let s=i.value;if(s===void 0||s===null||s===!1)return"";if(Array.isArray(s))return s.filter((o)=>o!==void 0&&o!==null&&o!=="").map(String).join(", ");if(typeof s==="object"&&!(s instanceof Date))return{kind:"error",message:`the content must be text, got ${ze(s)}`,code:t.TYPE_ERROR};return String(s)}var Rr=["title","lang","meta","link","script","headRaw","htmlAttrs","bodyClass","bodyAttrs"],Hs=["title","titleTemplate","base","meta","link","script","style","htmlAttrs","bodyAttrs"],qe={links:"link",metas:"meta",scripts:"script",styles:"style"},Xe=new Set,Ke=new WeakMap;function de(e){if(Xe.has(e))return;Xe.add(e),console.warn(e)}function Yt(e,n){let r=Array.from({length:n.length+1},(i,s)=>s);for(let i=1;i<=e.length;i++){let s=r[0];r[0]=i;for(let o=1;o<=n.length;o++){let a=r[o];r[o]=Math.min(r[o]+1,r[o-1]+1,s+(e[i-1]===n[o-1]?0:1)),s=a}}return r[n.length]}function Jt(e,n){let r=e.toLowerCase(),i=n.find((p)=>p.toLowerCase()===r);if(i)return i;let s=qe[r];if(s&&n.includes(s))return s;let o,a=1/0;for(let p of n){let g=Yt(r,p.toLowerCase());if(g<a)o=p,a=g}let l=Math.min(e.length,o?.length??0)<=4?1:2;return a<=l?o:void 0}function ke(e,n){if(!e||typeof e!=="object"||Array.isArray(e))return e||{};let r=Ke.get(e);if(r)return r;let{known:i,source:s}=n,o=e;for(let a of Object.keys(e)){if(i.includes(a))continue;let l=qe[a];if(l&&i.includes(l)&&Array.isArray(e[a])){if(o===e)o={...e};let g=Array.isArray(o[l])?o[l]:[];o[l]=[...g,...e[a]],delete o[a],de(`[stx] ${s}.${a} is not a head key; reading it as ${s}.${l}. Rename it to \`${l}\`.`);continue}if(/^styles?$/.test(a)&&!i.includes("style")){de(`[stx] ${s}.${a} is not a head key and is ignored. Use \`link\` with rel: 'stylesheet', or \`headRaw\` for an inline <style>.`);continue}let p=Jt(a,i);de(p?`[stx] ${s}.${a} is not a head key and is ignored. Did you mean \`${p}\`?`:`[stx] ${s}.${a} is not a head key and is ignored. Known keys: ${i.join(", ")}.`)}return Ke.set(e,o),o}var T={},Zt=[],X={};function bi(){return T}function Ph(){return X}function Ih(){T={},Zt.length=0,X={}}function Yc(e){T=He(T,ke(e,{known:Hs,source:"useHead()"}))}function Ge(e,n,r){let i=[...e||[]];for(let s of n||[]){let o=r(s),a=o?i.findIndex((l)=>r(l)===o):-1;if(a<0)i.push(s);else i[a]=s}return i}function He(e,n){return{title:n.title??e.title,titleTemplate:n.titleTemplate??e.titleTemplate,base:n.base??e.base,meta:Ge(e.meta,n.meta,(r)=>r.name||r.property||(r.httpEquiv?`http:${r.httpEquiv}`:void 0)),link:Ge(e.link,n.link,(r)=>["icon","apple-touch-icon","canonical"].includes(r.rel||"")?[r.rel,r.type,r.media,r.sizes].join(":"):void 0),script:[...e.script||[],...n.script||[]],style:[...e.style||[],...n.style||[]],htmlAttrs:{...e.htmlAttrs,...n.htmlAttrs},bodyAttrs:{...e.bodyAttrs,...n.bodyAttrs}}}function ig(e){Yc(Vs(e))}function Vs(e){let n=[];if(e.description)n.push({name:"description",content:e.description});if(e.keywords){let p=Array.isArray(e.keywords)?e.keywords.join(", "):e.keywords;n.push({name:"keywords",content:p})}if(e.author)n.push({name:"author",content:e.author});if(e.robots)n.push({name:"robots",content:e.robots});let r=e.ogTitle??e.title,i=e.ogDescription??e.description;if(r)n.push({property:"og:title",content:r});if(i)n.push({property:"og:description",content:i});if(e.ogImage){if(n.push({property:"og:image",content:e.ogImage}),e.ogImageType)n.push({property:"og:image:type",content:e.ogImageType});if(e.ogImageWidth)n.push({property:"og:image:width",content:String(e.ogImageWidth)});if(e.ogImageHeight)n.push({property:"og:image:height",content:String(e.ogImageHeight)});if(e.ogImageAlt)n.push({property:"og:image:alt",content:e.ogImageAlt})}if(e.ogUrl)n.push({property:"og:url",content:e.ogUrl});if(e.ogType)n.push({property:"og:type",content:e.ogType});if(e.ogSiteName)n.push({property:"og:site_name",content:e.ogSiteName});if(e.ogLocale)n.push({property:"og:locale",content:e.ogLocale});if(e.profileFirstName)n.push({property:"profile:first_name",content:e.profileFirstName});if(e.profileLastName)n.push({property:"profile:last_name",content:e.profileLastName});if(e.profileUsername)n.push({property:"profile:username",content:e.profileUsername});let s=e.twitterTitle??e.title,o=e.twitterDescription??e.description,a=e.twitterImage??e.ogImage;if(e.twitterCard)n.push({name:"twitter:card",content:e.twitterCard});if(s)n.push({name:"twitter:title",content:s});if(o)n.push({name:"twitter:description",content:o});if(a){n.push({name:"twitter:image",content:a});let p=e.twitterImageAlt??(e.twitterImage?void 0:e.ogImageAlt);if(p)n.push({name:"twitter:image:alt",content:p})}if(e.twitterSite)n.push({name:"twitter:site",content:e.twitterSite});if(e.twitterCreator)n.push({name:"twitter:creator",content:e.twitterCreator});if(e.articleAuthor)n.push({property:"article:author",content:e.articleAuthor});if(e.articlePublishedTime)n.push({property:"article:published_time",content:e.articlePublishedTime});if(e.articleModifiedTime)n.push({property:"article:modified_time",content:e.articleModifiedTime});if(e.articleSection)n.push({property:"article:section",content:e.articleSection});if(e.articleTags)for(let p of e.articleTags)n.push({property:"article:tag",content:p});let l=[];if(e.canonical)l.push({rel:"canonical",href:e.canonical});return{title:e.title,titleTemplate:e.titleTemplate,meta:n,link:l}}function Oh(e){if(X={...X,...e},e.title||e.description)ig({title:e.title,description:e.description})}function Nh(e){let n=typeof e==="function"?e():e;Yc({title:n})}function Dh(e=T){let n=[];if(e.title){let r=e.title;if(e.titleTemplate)r=typeof e.titleTemplate==="function"?e.titleTemplate(r):e.titleTemplate.replace("%s",r);n.push(`<title>${I(r)}</title>`)}if(e.base){let r=Object.entries(e.base).map(([i,s])=>`${i}="${I(s)}"`).join(" ");n.push(`<base ${r}>`)}for(let r of e.meta||[]){let i=Object.entries(r).filter(([s,o])=>o!==void 0).map(([s,o])=>`${s==="httpEquiv"?"http-equiv":s}="${I(String(o))}"`).join(" ");n.push(`<meta ${i}>`)}for(let r of e.link||[]){let i=Object.entries(r).filter(([s,o])=>o!==void 0).map(([s,o])=>`${s}="${I(String(o))}"`).join(" ");n.push(`<link ${i}>`)}for(let r of e.script||[]){let{content:i,...s}=r,o=Object.entries(s).filter(([a,l])=>l!==void 0).map(([a,l])=>{if(typeof l==="boolean")return l?a:"";return`${a}="${I(String(l))}"`}).filter(Boolean).join(" ");if(i)n.push(`<script ${o}>${W(r)}</script>`);else n.push(`<script ${o}></script>`)}for(let r of e.style||[]){let i=r.type?` type="${r.type}"`:"";n.push(`<style${i}>${r.content}</style>`)}return n.join(`
|
|
60
|
+
`)}function Mh(e=T){if(!e.htmlAttrs)return"";return Object.entries(e.htmlAttrs).map(([n,r])=>`${n}="${I(r)}"`).join(" ")}function Lh(e=T){if(!e.bodyAttrs)return"";return Object.entries(e.bodyAttrs).map(([n,r])=>`${n}="${I(r)}"`).join(" ")}function I(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function jh(e=T){if(typeof document>"u")return;if(e.title){let n=e.title;if(e.titleTemplate)n=typeof e.titleTemplate==="function"?e.titleTemplate(n):e.titleTemplate.replace("%s",n);document.title=n}for(let n of e.meta||[]){let r=n.name?`meta[name="${n.name}"]`:n.property?`meta[property="${n.property}"]`:null;if(r){let i=document.querySelector(r);if(!i){if(i=document.createElement("meta"),n.name)i.setAttribute("name",n.name);if(n.property)i.setAttribute("property",n.property);document.head.appendChild(i)}i.setAttribute("content",n.content)}}for(let n of e.link||[]){let r=`link[rel="${n.rel}"]${n.href?`[href="${n.href}"]`:""}`,i=document.querySelector(r);if(!i)i=document.createElement("link"),document.head.appendChild(i);for(let[s,o]of Object.entries(n))if(o!==void 0)i.setAttribute(s,String(o))}if(e.htmlAttrs)for(let[n,r]of Object.entries(e.htmlAttrs))if(n==="class")for(let i of String(r).split(/\s+/).filter(Boolean))document.documentElement.classList.add(i);else document.documentElement.setAttribute(n,r);if(e.bodyAttrs)for(let[n,r]of Object.entries(e.bodyAttrs))document.body.setAttribute(n,r)}function Bh(e){let n="";return{content:e.replace(/@head\s*([\s\S]*?)@endhead/g,(i,s)=>(n+=s.trim()+`
|
|
61
|
+
`,"")),headContent:n.trim()}}function Fh(e,n){return e.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(r,i,s,o)=>{let a=i?s:n[(o||"").trim()]??o,l=n.__stx_runtime_head??{};return n.__stx_runtime_head=He(l,{title:a}),""})}function zh(e,n,r=""){if(!e.includes("@meta"))return e;return Lt(e,/(?<![\w$@])@meta\s*\(/g,(i,s)=>{let o=$r(jt(i),n);if(o.kind==="error")return N("Meta",s,o.message,r,o.code);if(o.kind==="tag"){let a=n.__stx_runtime_head??{};n.__stx_runtime_head=He(a,{meta:[o.tag]})}return""},(i)=>N("Meta",i,"the call has no closing parenthesis",r,t.INVALID_DIRECTIVE_SYNTAX))}export{js,fi,Bs,u,f,Uc,R,nt,Mt,d,Fs,t,ae,kr,q,c,Se,gi,B,xn,b,Wc,mi,Lt,jt,Bt,ze,rt,N,zs,hi,qc,_r,Cr,Kc,st,Gc,Er,Xc,Sn,yi,Jc,Tr,$r,Rr,Hs,ke,bi,Ph,Ih,Yc,He,ig,Vs,Oh,Nh,Dh,Mh,Lh,jh,Bh,Fh,zh};
|