@stacksjs/stx 0.2.889 → 0.2.891
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-1n33yrar.js → chunk-062qfv99.js} +2 -2
- package/dist/chunk-08kcxz79.js +2 -0
- package/dist/chunk-0fyh29m1.js +2 -0
- package/dist/{chunk-2a5g80mq.js → chunk-0jdz31q1.js} +3 -3
- package/dist/{chunk-mhxg6j6s.js → chunk-0jkj8thz.js} +1 -1
- package/dist/{chunk-nbdscgvj.js → chunk-0t31rf3v.js} +6 -6
- package/dist/chunk-0w578pgv.js +3 -0
- package/dist/{chunk-f3cyghnb.js → chunk-0yxvz6qz.js} +4 -4
- package/dist/chunk-0zynd3x0.js +2 -0
- package/dist/chunk-10c7pg5h.js +2 -0
- package/dist/{chunk-cz1sdes5.js → chunk-115bb91s.js} +2 -2
- package/dist/chunk-12m3qagv.js +2 -0
- package/dist/{chunk-1gyxxfdf.js → chunk-12nmmdnp.js} +1 -1
- package/dist/chunk-1a7a8cjs.js +2 -0
- package/dist/chunk-1ph2yhfn.js +3 -0
- package/dist/{chunk-mt8edb75.js → chunk-1vp0h7d6.js} +57 -57
- package/dist/{chunk-me4yq8c2.js → chunk-29cw0fcr.js} +2 -2
- package/dist/chunk-2eq3aret.js +2 -0
- package/dist/chunk-3b3mkgpj.js +3 -0
- package/dist/{chunk-snv80b1b.js → chunk-3bsz7zj3.js} +2 -2
- package/dist/chunk-3ngbdap1.js +2 -0
- package/dist/chunk-3t30a2nx.js +2 -0
- package/dist/{chunk-eyx92t9n.js → chunk-41z7f41b.js} +2 -2
- package/dist/chunk-484x27q5.js +2 -0
- package/dist/{chunk-87g5xmmr.js → chunk-4f3456ht.js} +14 -14
- package/dist/{chunk-sjjw6y49.js → chunk-4r6hbjx7.js} +4 -4
- package/dist/chunk-4ts8qztg.js +2 -0
- package/dist/{chunk-700m927w.js → chunk-5zs5hrgz.js} +2 -2
- package/dist/{chunk-0ncafcs2.js → chunk-67j2m620.js} +3 -3
- package/dist/{chunk-bwx6w87c.js → chunk-6aq1pv9a.js} +1 -1
- package/dist/chunk-6kkatcka.js +2 -0
- package/dist/{chunk-cgfjrgfw.js → chunk-6kt9wxja.js} +11 -11
- package/dist/{chunk-kx09v9ya.js → chunk-70paeznz.js} +9 -9
- package/dist/{chunk-48rwqchc.js → chunk-7d2j41e3.js} +9 -9
- package/dist/{chunk-b15c4g3e.js → chunk-8ay5r808.js} +6 -6
- package/dist/{chunk-njpva3zq.js → chunk-8hdp4ark.js} +1 -1
- package/dist/chunk-8res5m9x.js +2 -0
- package/dist/{chunk-zf68afyh.js → chunk-8y39f6z3.js} +3 -3
- package/dist/{chunk-4akw3bym.js → chunk-90qwzwsm.js} +1 -1
- package/dist/{chunk-ch9028z3.js → chunk-9f8fda1j.js} +1 -1
- package/dist/chunk-9w6k311w.js +1322 -0
- package/dist/chunk-9zhpv03v.js +2 -0
- package/dist/{chunk-q9tc9rdv.js → chunk-a0aqs5a8.js} +2 -2
- package/dist/chunk-a5d5qveh.js +2 -0
- package/dist/{chunk-6gtecbe7.js → chunk-a7bqrjm5.js} +2 -2
- package/dist/{chunk-7hpca9c7.js → chunk-aasgawa9.js} +5 -5
- package/dist/{chunk-3dqfjpz4.js → chunk-ac3e6nhg.js} +29 -29
- package/dist/chunk-arr79m90.js +2 -0
- package/dist/{chunk-58qzyyyv.js → chunk-b0jk94wx.js} +3 -3
- package/dist/{chunk-mctzpw0w.js → chunk-b18vpz6p.js} +4 -4
- package/dist/chunk-bsbd6y64.js +2 -0
- package/dist/{chunk-ymqm898x.js → chunk-bvqgq18r.js} +2 -2
- package/dist/chunk-cf527twj.js +2 -0
- package/dist/chunk-cgrg6xzg.js +2 -0
- package/dist/{chunk-vc432a0w.js → chunk-dm069acv.js} +9 -9
- package/dist/{chunk-ranjkpc8.js → chunk-e16ef18k.js} +1 -1
- package/dist/chunk-e28czxw3.js +2 -0
- package/dist/{chunk-p8shtje2.js → chunk-e5md1cck.js} +45 -45
- package/dist/chunk-essd43ad.js +2 -0
- package/dist/chunk-fs7tv867.js +20 -0
- package/dist/chunk-fsk3rk2x.js +2 -0
- package/dist/{chunk-zwwhpxp7.js → chunk-g5nfqzfh.js} +2 -2
- package/dist/{chunk-6pz5gq6v.js → chunk-gcjqxvbb.js} +25 -21
- package/dist/{chunk-2gn2nc2j.js → chunk-gk0h2hp7.js} +1 -1
- package/dist/{chunk-9d91h636.js → chunk-gwayvyg5.js} +2 -2
- package/dist/{chunk-bqtj62ys.js → chunk-gydvy8a3.js} +7 -7
- package/dist/{chunk-eceeqy74.js → chunk-gzc16hs8.js} +2 -2
- package/dist/{chunk-xy8smv5e.js → chunk-h7yme97q.js} +2 -2
- package/dist/chunk-h87pjzn7.js +2 -0
- package/dist/chunk-hq03mwtw.js +2 -0
- package/dist/chunk-j9kejcrx.js +2 -0
- package/dist/chunk-jhbz5w30.js +2 -0
- package/dist/chunk-k0mndyb4.js +2 -0
- package/dist/{chunk-hm9d40yf.js → chunk-k89gbytd.js} +2 -2
- package/dist/{chunk-51720m79.js → chunk-kd7k31x3.js} +9 -9
- package/dist/{chunk-t0ttxayz.js → chunk-kfbw96c5.js} +2 -2
- package/dist/chunk-kh3sxa3j.js +2 -0
- package/dist/{chunk-mjp1z9kz.js → chunk-khm56bfm.js} +1 -1
- package/dist/chunk-kr4z3633.js +2 -0
- package/dist/{chunk-6pdy7ajr.js → chunk-kvz7ad7p.js} +1 -1
- package/dist/{chunk-nkyff7v6.js → chunk-kxewj557.js} +27 -27
- package/dist/chunk-mbpz45v9.js +2 -0
- package/dist/{chunk-b6bf0t02.js → chunk-mhrnjaka.js} +4 -4
- package/dist/{chunk-mw7hacm3.js → chunk-mxf6cfbg.js} +23 -23
- package/dist/{chunk-pctf14yw.js → chunk-n64zbwzr.js} +1 -1
- package/dist/{chunk-eqffvse2.js → chunk-n6q1d66k.js} +1 -1
- package/dist/chunk-nd0f11at.js +2 -0
- package/dist/{chunk-3hsv6ejp.js → chunk-neg6ckjg.js} +7 -7
- package/dist/{chunk-kbbbpae2.js → chunk-nq60tjkz.js} +2 -2
- package/dist/{chunk-6kyqejnq.js → chunk-nvre22sw.js} +22 -22
- package/dist/{chunk-967ydrq4.js → chunk-p3hbsrk9.js} +2 -2
- package/dist/chunk-p9cwapm8.js +2 -0
- package/dist/{chunk-w82nk19t.js → chunk-ph4tgp9g.js} +1 -1
- package/dist/{chunk-kj43fbzm.js → chunk-phx820py.js} +1 -1
- package/dist/{chunk-5ssv10ep.js → chunk-pjpf21y9.js} +1 -1
- package/dist/{chunk-7212fwzz.js → chunk-psykt348.js} +2 -2
- package/dist/{chunk-pz554g43.js → chunk-pvm48tse.js} +3 -3
- package/dist/{chunk-zek9t5za.js → chunk-pwpge9bj.js} +2 -2
- package/dist/{chunk-0k437z3q.js → chunk-qn45rk5n.js} +1 -1
- package/dist/{chunk-95sd8h5g.js → chunk-qrk535j6.js} +6 -6
- package/dist/{chunk-446tb2th.js → chunk-rc7djca5.js} +49 -49
- package/dist/{chunk-55tc5w32.js → chunk-sh7a0g09.js} +2 -2
- package/dist/chunk-sydgagr1.js +2 -0
- package/dist/chunk-tspqdt8e.js +2 -0
- package/dist/chunk-v6gkjg5f.js +3 -0
- package/dist/chunk-vm57848v.js +2 -0
- package/dist/{chunk-ankap9pc.js → chunk-vya7cck4.js} +1 -1
- package/dist/{chunk-hgf7bc50.js → chunk-w8djc4qb.js} +9 -9
- package/dist/chunk-wg6fmren.js +4 -0
- package/dist/chunk-wwb6c5rr.js +2 -0
- package/dist/chunk-x691tnkx.js +2 -0
- package/dist/{chunk-mgh5rst1.js → chunk-x9036mfd.js} +2 -2
- package/dist/{chunk-brzjass3.js → chunk-xc5esqcb.js} +2 -2
- package/dist/{chunk-5kqezrjt.js → chunk-xvprhdcb.js} +1 -1
- package/dist/chunk-y7qm1m0e.js +2 -0
- package/dist/{chunk-m95sygv4.js → chunk-ye6ev3qp.js} +1 -1
- package/dist/{chunk-s93yh7ed.js → chunk-ypyezjr0.js} +2 -2
- package/dist/{chunk-4kmg6g5n.js → chunk-yv797v6e.js} +9 -9
- package/dist/{chunk-cmg9x1ka.js → chunk-z012vpdz.js} +3 -3
- package/dist/{chunk-dymck524.js → chunk-z6ndrx2p.js} +5 -5
- package/dist/{chunk-2nqmw4dv.js → chunk-z8sv926e.js} +1 -1
- package/dist/{chunk-s0mf56y1.js → chunk-z92e297r.js} +4 -4
- package/dist/chunk-zd21ntcm.js +2 -0
- package/dist/{chunk-6c1vm6bs.js → chunk-zkwkhesc.js} +2 -2
- package/dist/{chunk-hpzje67q.js → chunk-zwqkbk2m.js} +2 -2
- package/dist/chunk-zxjdfgdx.js +3 -0
- package/dist/cli.js +28 -28
- package/dist/client/signals-timer-runtime.js +4 -0
- package/dist/component-contract.d.ts +1 -0
- package/dist/component-contract.js +6 -4
- package/dist/component-library.js +217 -60
- package/dist/component-renderer.js +23 -10
- package/dist/composition-api.d.ts +7 -1
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/emits-declaration.d.ts +9 -0
- package/dist/emits-declaration.js +64 -0
- package/dist/native/prop-names.js +7 -2
- package/dist/native/runtime/craft-bridge.js +29 -2
- package/dist/native/runtime/craft.d.ts +32 -0
- package/dist/native/runtime/native-host.js +27 -11
- package/dist/props-declaration.d.ts +2 -0
- package/dist/props-declaration.js +25 -0
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +28 -28
- package/package.json +5 -5
- package/stx.d.ts +2 -1
- package/dist/chunk-0g9cceht.js +0 -2
- package/dist/chunk-0rpj5t80.js +0 -2
- package/dist/chunk-2ba4zfa0.js +0 -2
- package/dist/chunk-2wkpksg1.js +0 -2
- package/dist/chunk-3yjyjq0m.js +0 -2
- package/dist/chunk-444haxxa.js +0 -2
- package/dist/chunk-4rvfeee5.js +0 -2
- package/dist/chunk-5aa83bpm.js +0 -2
- package/dist/chunk-67rppc5v.js +0 -2
- package/dist/chunk-77c89d23.js +0 -2
- package/dist/chunk-79vbkez0.js +0 -2
- package/dist/chunk-8354mzpd.js +0 -2
- package/dist/chunk-8ygf6jnt.js +0 -2
- package/dist/chunk-94mpe1ny.js +0 -3
- package/dist/chunk-9n5h4sqc.js +0 -3
- package/dist/chunk-9ztn7w4y.js +0 -2
- package/dist/chunk-asnd03sr.js +0 -2
- package/dist/chunk-b0b5yr97.js +0 -2
- package/dist/chunk-b0e7dgv8.js +0 -3
- package/dist/chunk-b7jj45bz.js +0 -2
- package/dist/chunk-dzqfv801.js +0 -3
- package/dist/chunk-ery4tty7.js +0 -20
- package/dist/chunk-evwrxsxd.js +0 -3
- package/dist/chunk-fdqdz018.js +0 -2
- package/dist/chunk-g6ap4085.js +0 -2
- package/dist/chunk-gz9pknbw.js +0 -1204
- package/dist/chunk-hjb4c8g2.js +0 -2
- package/dist/chunk-jhbj9ja2.js +0 -2
- package/dist/chunk-k9abxnpa.js +0 -2
- package/dist/chunk-mvavjydq.js +0 -2
- package/dist/chunk-qqng9545.js +0 -2
- package/dist/chunk-rjm515e2.js +0 -2
- package/dist/chunk-rye4b2x3.js +0 -2
- package/dist/chunk-ryj8139z.js +0 -2
- package/dist/chunk-s9b809n2.js +0 -2
- package/dist/chunk-sb67wg5x.js +0 -2
- package/dist/chunk-sqwx2g02.js +0 -2
- package/dist/chunk-tbh7r1wh.js +0 -2
- package/dist/chunk-tpyekw0q.js +0 -2
- package/dist/chunk-v2627s75.js +0 -2
- package/dist/chunk-v98n53nk.js +0 -2
- package/dist/chunk-w34vvhm7.js +0 -2
- package/dist/chunk-wbmx0rge.js +0 -2
- package/dist/chunk-yjwa7ktk.js +0 -2
- package/dist/chunk-z47p2gx8.js +0 -2
- package/dist/chunk-z6kw6sct.js +0 -4
- package/dist/chunk-zhywjwdr.js +0 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var w={black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",brightRed:"\x1B[91m",brightGreen:"\x1B[92m",brightYellow:"\x1B[93m",brightBlue:"\x1B[94m",brightMagenta:"\x1B[95m",brightCyan:"\x1B[96m",brightWhite:"\x1B[97m"},R={bold:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",underline:"\x1B[4m",inverse:"\x1B[7m",strikethrough:"\x1B[9m"};function p(e,t){return`${w[t]}${e}\x1B[0m`}function C(e,t){return`${R[t]}${e}\x1B[0m`}var b=(e)=>p(e,"red"),S=(e)=>p(e,"green"),y=(e)=>p(e,"yellow"),O=(e)=>p(e,"blue");var c=(e)=>p(e,"cyan");var a=(e)=>C(e,"bold"),m=(e)=>C(e,"dim");function
|
|
3
|
-
export{
|
|
2
|
+
var w={black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",brightRed:"\x1B[91m",brightGreen:"\x1B[92m",brightYellow:"\x1B[93m",brightBlue:"\x1B[94m",brightMagenta:"\x1B[95m",brightCyan:"\x1B[96m",brightWhite:"\x1B[97m"},R={bold:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",underline:"\x1B[4m",inverse:"\x1B[7m",strikethrough:"\x1B[9m"};function p(e,t){return`${w[t]}${e}\x1B[0m`}function C(e,t){return`${R[t]}${e}\x1B[0m`}var b=(e)=>p(e,"red"),S=(e)=>p(e,"green"),y=(e)=>p(e,"yellow"),O=(e)=>p(e,"blue");var c=(e)=>p(e,"cyan");var a=(e)=>C(e,"bold"),m=(e)=>C(e,"dim");function nn(){console.log(""),console.log(c(" \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")),console.log(c(" \u2551")+a(" \uD83D\uDCD6 STX Story ")+c("\u2551")),console.log(c(" \u2551")+m(" Component Showcase & Testing ")+c("\u2551")),console.log(c(" \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")),console.log("")}function ko(e,t){if(console.log(a(" Server running at:")),console.log(""),console.log(` ${m("\u279C")} ${a("Local:")} ${c(e)}`),t)console.log(` ${m("\u279C")} ${a("Network:")} ${c(t)}`);console.log("")}function rn(e){let t=e>0?"\u2713":"\u25CB",r=e>0?S:y;console.log(` ${r(t)} Found ${a(String(e))} story ${e===1?"file":"files"}`)}function ha(e,t){if(console.log(""),console.log(` ${b("\u2717")} ${a(b("Error:"))} ${e}`),t)console.log(` ${m(t)}`);console.log("")}function St(e){console.log(` ${y("\u26A0")} ${y("Warning:")} ${e}`)}function ya(e){console.log(` ${O("\u2139")} ${e}`)}function ba(e,t,r){console.log(""),console.log(c(" \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")),console.log(c(" \u2551")+a(" Build Complete ")+c("\u2551")),console.log(c(" \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")),console.log(""),console.log(` ${S("\u2713")} Stories: ${a(String(e))}`),console.log(` ${S("\u2713")} Output: ${a(t)}`),console.log(` ${S("\u2713")} Time: ${a(`${r}ms`)}`),console.log("")}function _o(){console.log(""),console.log(a(" Keyboard Shortcuts:")),console.log(""),console.log(` ${c("h")} Show this help`),console.log(` ${c("o")} Open in browser`),console.log(` ${c("r")} Restart server`),console.log(` ${c("c")} Clear console`),console.log(` ${c("q")} Quit`),console.log("")}import h from"fs";import d from"path";async function sn(e){let{root:t,config:r}=e,o=[],i=await P(t,r.storyMatch,r.storyIgnored);for(let s of i){let n=d.resolve(t,s),l=v(s,n);o.push(l)}return o}async function P(e,t,r){let o=[];async function i(s,n){let l=await h.promises.readdir(s,{withFileTypes:!0});for(let g of l){let f=d.join(s,g.name),u=d.relative(n,f);if(T(u,r))continue;if(g.isDirectory())await i(f,n);else if(g.isFile()){if(F(u,t))o.push(u)}}}return await i(e,e),o}function T(e,t){for(let r of t)if(E(e,r))return!0;return!1}function F(e,t){for(let r of t)if(E(e,r))return!0;return!1}function E(e,t){let r=e.replace(/\\/g,"/"),i=t.replace(/\\/g,"/").replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"{{GLOBSTAR}}").replace(/\*/g,"[^/]*").replace(/\?/g,".").replace(/\{\{GLOBSTAR\}\}/g,".*");return i=`^${i}$`,new RegExp(i).test(r)}function v(e,t){let r=d.basename(e,".story.stx");return{id:e.toLowerCase().replace(/\.story\.stx$/,"").replace(/[/\\]/g,"-").replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,""),path:t,relativePath:e,fileName:r,treeFile:{title:r,path:e}}}function wa(e,t){let{root:r,config:o}=e,i=[],s=h.watch(r,{recursive:!0},async(n,l)=>{if(!l)return;let g=l.replace(/\\/g,"/");if(!F(g,o.storyMatch))return;if(T(g,o.storyIgnored))return;let f=d.resolve(r,g);try{await h.promises.access(f);let u=v(g,f);t(n==="rename"?"add":"change",u)}catch{let u=v(g,f);t("unlink",u)}});return i.push(s),()=>{for(let n of i)n.close()}}function N(e,t){let r=t.treeFile||{title:t.fileName,path:t.relativePath};if(e.tree.file==="title")return r.title.split("/");if(e.tree.file==="path")return[...t.relativePath.split("/").slice(0,-1),r.title];if(typeof e.tree.file==="function")return e.tree.file(r);return[r.title]}function on(e,t){for(let n of t)n.treePath=N(e,n);let r=(e.tree.groups||[]).map((n)=>({groupConfig:{id:n.id||n.title,title:n.title,include:n.include},treeObject:{}})),o={treeObject:{}};r.push(o);for(let n=0;n<t.length;n++){let l=t[n],g=j(l,r,o);k(l.treePath,n,g.treeObject)}let i=e.tree.order==="asc"?(n,l)=>n.localeCompare(l):e.tree.order,s=[];for(let n of r)if(n===o)s.push(...x(n.treeObject,i));else if(n.groupConfig&&Object.keys(n.treeObject).length>0)s.push({group:!0,id:n.groupConfig.id,title:n.groupConfig.title,children:x(n.treeObject,i)});return s}function j(e,t,r){let o=e.treeFile||{title:e.fileName,path:e.relativePath};for(let i of t)if(i.groupConfig?.include&&i.groupConfig.include(o))return i;return r}function k(e,t,r){let o=r;for(let i=0;i<e.length;i++){let s=e[i];if(i===e.length-1)if(o[s]!==void 0){let l=1;while(o[`${s}-${l}`]!==void 0)l++;o[`${s}-${l}`]=t}else o[s]=t;else{if(o[s]===void 0)o[s]={};else if(typeof o[s]==="number"){let l=o[s];o[s]={"":l}}o=o[s]}}}function x(e,t){let r=[];for(let[o,i]of Object.entries(e))if(typeof i==="number")r.push({title:o,index:i});else r.push({title:o,children:x(i,t)});return r.sort((o,i)=>t(o.title,i.title)),r}
|
|
3
|
+
export{nn,ko,rn,ha,St,ya,ba,_o,sn,wa,on};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ul,Wl,ql}from"./chunk-mgh5rst1.js";import{ve,rr,sr,zo,ps,gs,or,ir,Ho,ms}from"./chunk-700m927w.js";function z(e,o,l,r,d,y){let s=!0,u=new Set,h=(p)=>r.get?r.get(p):p,a=()=>h(e());return Object.defineProperty(a,"_isSignal",{value:!0}),Object.defineProperty(a,"modifiers",{get:o}),a.set=(p)=>{if(!s)return;let f=o(),t=r.set?r.set(p,f):p;if(f.trim&&typeof t==="string")t=t.trim();if(f.number&&typeof t==="string"&&t!==""){let i=Number(t);if(!Number.isNaN(i))t=i}if(Object.is(e(),t))return;e.set(t),l(t)},a.update=(p)=>a.set(p(a())),a.input=(p)=>{if(!o().lazy)a.set(p)},a.change=(p)=>{if(o().lazy)a.set(p)},a.subscribe=(p)=>{if(!s)return()=>{};let f=e.subscribe((t,i)=>p(h(t),h(i)));return u.add(f),()=>{f(),u.delete(f)}},Object.defineProperty(a,"value",{get:a,set:a.set}),d(()=>{s=!1,u.forEach((p)=>p()),u.clear()}),y?.(()=>{s=!0}),a}function X(e,o=!0,l){if(!o||!e||typeof window>"u")return;let r=window;if(!r.__STX_DATA__){let y=document.querySelector("script[data-stx-server-data]");try{let s=JSON.parse(y?.textContent||"{}");r.__STX_DATA__=s&&typeof s==="object"&&!Array.isArray(s)?s:{}}catch{r.__STX_DATA__={}}}let d=r.__STX_DATA__;if(d&&Object.prototype.hasOwnProperty.call(d,e))try{return{data:l?l(d[e]):d[e]}}catch(y){return{data:null,error:y instanceof Error?y:Error(String(y))}}return}function Q(e){if(typeof window>"u")return;let o=window;if(e===void 0)o.__STX_DATA__={};else{if(!o.__STX_DATA__)try{let l=JSON.parse(document.querySelector("script[data-stx-server-data]")?.textContent||"{}");o.__STX_DATA__=l&&typeof l==="object"&&!Array.isArray(l)?l:{}}catch{o.__STX_DATA__={}}if(o.__STX_DATA__)delete o.__STX_DATA__[e]}}function Y(e){let o=null;try{o=typeof indexedDB<"u"?indexedDB:null}catch{o=null}if(!o)return null;let l=o,r=e||"stx-kept",d=null,y=()=>{if(!d)d=new Promise((u,h)=>{let a=l.open(r,1);a.onupgradeneeded=()=>{a.result.createObjectStore("kv")},a.onsuccess=()=>u(a.result),a.onerror=()=>h(a.error),a.onblocked=()=>h(Error("blocked"))}),d.catch(()=>{d=null});return d},s=(u,h)=>y().then((a)=>new Promise((p,f)=>{let t=a.transaction("kv",u),i=h(t.objectStore("kv"));t.oncomplete=()=>p(i?i.result:void 0),t.onerror=()=>f(t.error),t.onabort=()=>f(t.error)}));return{get:(u)=>s("readonly",(h)=>h.get(u)),set:(u,h)=>s("readwrite",(a)=>{a.put(h,u)}),remove:(u)=>s("readwrite",(h)=>{h.delete(u)}),removePrefix:(u)=>s("readwrite",(h)=>{h.delete(IDBKeyRange.bound(u,`${u}\uFFFF`))})}}function J(e,o){let l=e||{},r=null;if(l.storage!==void 0)r=l.storage;else try{r=typeof localStorage<"u"?localStorage:null}catch{r=null}let d=null,y=l.backend!==void 0;if(y)d=l.backend||null;let s=()=>{if(y)return d;y=!0;try{d=o?o():null}catch{d=null}if(d){let n=d;n.get("__stx_probe__").catch(()=>{if(d===n)d=null})}return d},u=l.limit||32768,h=l.defer||((n)=>{let c=typeof requestIdleCallback==="function"?requestIdleCallback:null;if(c)c(n,{timeout:200});else setTimeout(n,16)}),a=new Map,p=new Set,f=new Map,t=!1,i=Promise.resolve(),g=(n)=>{try{return JSON.parse(n)}catch{return n}},m=(n,c)=>{if(!r)return!1;try{return r.setItem(n,c),!0}catch{return!1}},_=(n)=>{try{if(r)r.removeItem(n)}catch{}},k=()=>{if(t=!1,!f.size)return i;let n=Array.from(f.entries());return f.clear(),i=i.then(()=>Promise.all(n.map(([c,v])=>{if(!d){p.delete(c);try{m(c,JSON.stringify(v===void 0?null:v))}catch{}return}let x;try{return x={v},d.set(c,x).catch(()=>{let S;try{S=JSON.stringify(v)}catch{return}return d?d.set(c,{j:S}).catch(()=>{m(c,S)}):void 0})}catch{return}}))).then(()=>{}),i},N=(n,c)=>{if(f.set(n,c),p.add(n),t)return;t=!0,h(()=>{k()})},P=(n)=>{if(!n||typeof n!=="object")return;let c=n;if("v"in c)return{value:c.v};if(typeof c.j==="string")return{value:g(c.j)};return},E={peek(n){if(a.has(n))return{value:a.get(n)};let c=null;try{c=r?r.getItem(n):null}catch{c=null}if(c===null||c===void 0)return;let v=g(c);return a.set(n,v),{value:v}},load(n){let c=E.peek(n),v=c?null:s();if(c||!v)return Promise.resolve(c);return v.get(n).then((x)=>{if(a.has(n))return{value:a.get(n)};let S=P(x);if(S)a.set(n,S.value),p.add(n);return S},()=>{return})},set(n,c){if(a.set(n,c),d&&p.has(n)){N(n,c);return}let v;try{v=JSON.stringify(c===void 0?null:c)}catch{return}if(v.length<=u&&m(n,v))return;if(!s()){if(v.length>u)m(n,v);return}_(n),N(n,c)},forget(n){for(let v of Array.from(a.keys()))if(v.indexOf(n)===0)a.delete(v);for(let v of Array.from(f.keys()))if(v.indexOf(n)===0)f.delete(v);for(let v of Array.from(p))if(v.indexOf(n)===0)p.delete(v);try{if(r)for(let v=r.length-1;v>=0;v--){let x=r.key(v);if(x&&x.indexOf(n)===0)r.removeItem(x)}}catch{}let c=s();if(!c)return i;return i=i.then(()=>c.removePrefix(n)).catch(()=>{}),i},flush(){return k()}};try{if(typeof document<"u"&&document.addEventListener)document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden")k()});if(typeof addEventListener==="function")addEventListener("pagehide",()=>{k()})}catch{}return E}function Z(e,o){if(!e)return!1;if(e===o.key)return!0;if(!o.url)return!1;if(e===o.url)return!0;try{let l=typeof location<"u"&&location.origin&&location.origin!=="null"?location.origin:"http://localhost",r=new URL(e,l),d=new URL(o.url,l);if(r.origin!==d.origin||r.pathname!==d.pathname)return!1;return!r.search||r.search===d.search}catch{return!1}}function ee(e){let o=e.prefix||"stx:kept:",l=e.matches||((t,i)=>t===i.key||t===i.url),r=new Set,d=new Map,y,s=(t)=>t===void 0?y:t,u=(t,i)=>{let g=s(i);if(g===!1||g===null||g==="")return null;return`${o}${g===void 0?"":`${g}:`}query:${t}`},h=(t)=>{let i=t&&t.value;if(!i||typeof i!=="object"||!("d"in i))return;return{data:i.d,at:Number(i.at)||0}},a=()=>{let t=globalThis;return t.__stx_outboxes instanceof Map?t.__stx_outboxes:null},p={setScope(t){y=t},scope:()=>y,keyFor:u,seed(t,i){let g=u(t,i);return g?h(e.kept.peek(g)):void 0},restore(t,i){let g=u(t,i);return g?e.kept.load(g).then(h):Promise.resolve(void 0)},persist(t,i,g){let m=u(t,g);if(m)e.kept.set(m,{d:i,at:Date.now()})},overlay(t,i,g){let m=a();if(!m||!m.size)return i;let _=i;return m.forEach((k)=>{try{_=k.overlay(t,_,g)}catch{}}),_},watch(t){return r.add(t),()=>{r.delete(t)}},cachedQuery(t,i){let g=d.get(t);if(g){if(i&&g.__options)g.__options(i);return g}let m=i||{},_=m.initial===void 0?null:m.initial,k=()=>typeof m.scope==="function"?m.scope():m.scope,N=()=>(typeof m.url==="function"?m.url():m.url)||null,P=()=>({key:t,url:N()}),E=k(),n=_,c=0,v=e.sharedRequest(),x=0,S=p.seed(t,E);if(S)n=S.data;let C=e.state(p.overlay(P(),n)),U=e.state(!1),q=e.state(!1),K=e.state(null),M=e.state(S?S.at:0),R=0,V=()=>{C.set(p.overlay(P(),n))},W=(w)=>{let b=R;p.restore(t,w).then((T)=>{if(!T||b!==R||c)return;n=T.data,M.set(T.at),V()})};if(!S)W(E);let _t=()=>{let w=k();if(w===E)return;E=w,R++,x=0,q.set(!1),U.set(!1),c=0;let b=p.seed(t,E);if(n=b?b.data:_,M.set(b?b.at:0),V(),!b)W(E)},xt=(w,b)=>{let T=m.timeoutMs||15000,I=typeof AbortController<"u"?new AbortController:null,O=null,j=new Promise((D,H)=>{O=setTimeout(()=>{if(I)I.abort();H(Error("The request took too long."))},T)}),A;if(m.load)A=m.load({force:w,url:b,signal:I?I.signal:void 0});else if(b){let D=m.fetch||((L,F)=>fetch(L,F)),H={method:"GET",headers:{Accept:"application/json"}};if(w)H.cache="no-cache";if(I)H.signal=I.signal;A=D(b,H).then((L)=>{if(!L.ok)return L.json().catch(()=>null).then((F)=>{throw Error(F&&(F.error||F.message)||`Request failed (${L.status})`)});return L.json()})}else return Promise.resolve(C());return Promise.race([A,j]).then((D)=>{if(O)clearTimeout(O);return m.transform?m.transform(D):D},(D)=>{if(O)clearTimeout(O);throw D})},G=(w)=>{let b=R,T=N(),I=()=>{if(b!==R)return Promise.resolve(C());if(x++,q.set(!0),c===0&&!M())U.set(!0);let j=()=>{if(b!==R)return;if(x=Math.max(0,x-1),!x)q.set(!1),U.set(!1)};return xt(w,T).then((A)=>{if(b!==R||T!==N())return j(),C();return n=A,c=Date.now(),M.set(c),K.set(null),p.persist(t,A,E),V(),j(),C()},(A)=>{if(b===R&&T===N())K.set(A&&A.message?A.message:"Could not load.");return j(),C()})},O=`${b} ${T||""}`;return w?v.fresh(O,I):v.run(O,I)},B={data:C,loading:U,isFetching:q,error:K,updatedAt:M,get key(){return t},load(w){if(_t(),!w&&c&&Date.now()-c<(m.staleTime||0))return Promise.resolve(C());return G(!!w)},refresh(){return B.load(!0)},set(w){n=typeof w==="function"?w(n):w,p.persist(t,n,E),V()},invalidate(){c=0},__options(w){m={...m,...w}}};if(r.add({target:P,updated:()=>{if(c||M())G(!1)},outbox:(w)=>{if(w)n=p.overlay(P(),n,w.id),c=0,G(!0);V()}}),d.set(t,B),m.immediate)B.load();return B}},f=typeof window<"u"?window:typeof addEventListener==="function"?globalThis:null;if(e.listen!==!1&&f&&typeof f.addEventListener==="function")f.addEventListener("stx:updated",(t)=>{let i=t.detail||{};if(i.kind!=="api"||typeof i.url!=="string")return;r.forEach((g)=>{if(l(i.url,g.target()))g.updated()})}),f.addEventListener("stx:outbox",(t)=>{let i=t.detail||{},g=i.sent&&typeof i.sent.id==="string"?i.sent:null;r.forEach((m)=>{if(g){let _=Array.isArray(g.affects)?g.affects:[],k=m.target();if(!_.some((N)=>l(N,k)))return}m.outbox(g)})});return p}function te(e){let o=e&&e.covers||((s,u)=>Object.is(s,u)),l=[],r=[],d=0,y=(s,u)=>{let h;try{h=Promise.resolve(u())}catch(f){h=Promise.reject(f)}let a={key:s,promise:h};l.push(a);let p=()=>{let f=l.indexOf(a);if(f!==-1)l.splice(f,1)};return h.then(p,p),h};return{run(s,u){for(let h of l)if(o(h.key,s))return h.promise;for(let h of r)if(o(h.key,s))return h.promise;return y(s,u)},fresh(s,u){for(let f of r)if(o(f.key,s))return f.promise;let h=l.filter((f)=>o(f.key,s)).map((f)=>f.promise);if(!h.length)return y(s,u);let a={key:s,promise:null},p=()=>{};return a.promise=Promise.all(h.map((f)=>f.then(p,p))).then(()=>{let f=r.indexOf(a);if(f!==-1)r.splice(f,1);return y(s,u)}),r.push(a),a.promise},latest(){let s=++d;return()=>s===d},get busy(){return l.length>0||r.length>0}}}function ne(e){let o=!1,l=null,r=null,d=0;async function y(){if(o)return;l=new AbortController;try{let s=await e.request(e.endpoint,{signal:l.signal,cache:"no-store",headers:{Accept:"text/event-stream"}});if(!s.ok||!s.body||!s.headers.get("content-type")?.includes("text/event-stream"))throw Error("Broadcast stream unavailable");if(o){await s.body.cancel();return}let u=s.body.getReader(),h=new TextDecoder,a="";d=0,e.onStatus?.(!0),e.onConnected?.();try{while(!o){let{done:p,value:f}=await u.read();if(p)break;if(a+=h.decode(f,{stream:!0}).replace(/\r\n/g,`
|
|
2
|
+
import{Vl,Wl,ql}from"./chunk-x9036mfd.js";import{xe,sr,or,zo,ps,gs,ir,ar,Ho,ms}from"./chunk-5zs5hrgz.js";function z(e,o,l,r,d,y){let s=!0,u=new Set,h=(p)=>r.get?r.get(p):p,a=()=>h(e());return Object.defineProperty(a,"_isSignal",{value:!0}),Object.defineProperty(a,"modifiers",{get:o}),a.set=(p)=>{if(!s)return;let f=o(),t=r.set?r.set(p,f):p;if(f.trim&&typeof t==="string")t=t.trim();if(f.number&&typeof t==="string"&&t!==""){let i=Number(t);if(!Number.isNaN(i))t=i}if(Object.is(e(),t))return;e.set(t),l(t)},a.update=(p)=>a.set(p(a())),a.input=(p)=>{if(!o().lazy)a.set(p)},a.change=(p)=>{if(o().lazy)a.set(p)},a.subscribe=(p)=>{if(!s)return()=>{};let f=e.subscribe((t,i)=>p(h(t),h(i)));return u.add(f),()=>{f(),u.delete(f)}},Object.defineProperty(a,"value",{get:a,set:a.set}),d(()=>{s=!1,u.forEach((p)=>p()),u.clear()}),y?.(()=>{s=!0}),a}function X(e,o=!0,l){if(!o||!e||typeof window>"u")return;let r=window;if(!r.__STX_DATA__){let y=document.querySelector("script[data-stx-server-data]");try{let s=JSON.parse(y?.textContent||"{}");r.__STX_DATA__=s&&typeof s==="object"&&!Array.isArray(s)?s:{}}catch{r.__STX_DATA__={}}}let d=r.__STX_DATA__;if(d&&Object.prototype.hasOwnProperty.call(d,e))try{return{data:l?l(d[e]):d[e]}}catch(y){return{data:null,error:y instanceof Error?y:Error(String(y))}}return}function Q(e){if(typeof window>"u")return;let o=window;if(e===void 0)o.__STX_DATA__={};else{if(!o.__STX_DATA__)try{let l=JSON.parse(document.querySelector("script[data-stx-server-data]")?.textContent||"{}");o.__STX_DATA__=l&&typeof l==="object"&&!Array.isArray(l)?l:{}}catch{o.__STX_DATA__={}}if(o.__STX_DATA__)delete o.__STX_DATA__[e]}}function Y(e){let o=null;try{o=typeof indexedDB<"u"?indexedDB:null}catch{o=null}if(!o)return null;let l=o,r=e||"stx-kept",d=null,y=()=>{if(!d)d=new Promise((u,h)=>{let a=l.open(r,1);a.onupgradeneeded=()=>{a.result.createObjectStore("kv")},a.onsuccess=()=>u(a.result),a.onerror=()=>h(a.error),a.onblocked=()=>h(Error("blocked"))}),d.catch(()=>{d=null});return d},s=(u,h)=>y().then((a)=>new Promise((p,f)=>{let t=a.transaction("kv",u),i=h(t.objectStore("kv"));t.oncomplete=()=>p(i?i.result:void 0),t.onerror=()=>f(t.error),t.onabort=()=>f(t.error)}));return{get:(u)=>s("readonly",(h)=>h.get(u)),set:(u,h)=>s("readwrite",(a)=>{a.put(h,u)}),remove:(u)=>s("readwrite",(h)=>{h.delete(u)}),removePrefix:(u)=>s("readwrite",(h)=>{h.delete(IDBKeyRange.bound(u,`${u}\uFFFF`))})}}function J(e,o){let l=e||{},r=null;if(l.storage!==void 0)r=l.storage;else try{r=typeof localStorage<"u"?localStorage:null}catch{r=null}let d=null,y=l.backend!==void 0;if(y)d=l.backend||null;let s=()=>{if(y)return d;y=!0;try{d=o?o():null}catch{d=null}if(d){let n=d;n.get("__stx_probe__").catch(()=>{if(d===n)d=null})}return d},u=l.limit||32768,h=l.defer||((n)=>{let c=typeof requestIdleCallback==="function"?requestIdleCallback:null;if(c)c(n,{timeout:200});else setTimeout(n,16)}),a=new Map,p=new Set,f=new Map,t=!1,i=Promise.resolve(),g=(n)=>{try{return JSON.parse(n)}catch{return n}},m=(n,c)=>{if(!r)return!1;try{return r.setItem(n,c),!0}catch{return!1}},_=(n)=>{try{if(r)r.removeItem(n)}catch{}},k=()=>{if(t=!1,!f.size)return i;let n=Array.from(f.entries());return f.clear(),i=i.then(()=>Promise.all(n.map(([c,v])=>{if(!d){p.delete(c);try{m(c,JSON.stringify(v===void 0?null:v))}catch{}return}let x;try{return x={v},d.set(c,x).catch(()=>{let S;try{S=JSON.stringify(v)}catch{return}return d?d.set(c,{j:S}).catch(()=>{m(c,S)}):void 0})}catch{return}}))).then(()=>{}),i},N=(n,c)=>{if(f.set(n,c),p.add(n),t)return;t=!0,h(()=>{k()})},P=(n)=>{if(!n||typeof n!=="object")return;let c=n;if("v"in c)return{value:c.v};if(typeof c.j==="string")return{value:g(c.j)};return},E={peek(n){if(a.has(n))return{value:a.get(n)};let c=null;try{c=r?r.getItem(n):null}catch{c=null}if(c===null||c===void 0)return;let v=g(c);return a.set(n,v),{value:v}},load(n){let c=E.peek(n),v=c?null:s();if(c||!v)return Promise.resolve(c);return v.get(n).then((x)=>{if(a.has(n))return{value:a.get(n)};let S=P(x);if(S)a.set(n,S.value),p.add(n);return S},()=>{return})},set(n,c){if(a.set(n,c),d&&p.has(n)){N(n,c);return}let v;try{v=JSON.stringify(c===void 0?null:c)}catch{return}if(v.length<=u&&m(n,v))return;if(!s()){if(v.length>u)m(n,v);return}_(n),N(n,c)},forget(n){for(let v of Array.from(a.keys()))if(v.indexOf(n)===0)a.delete(v);for(let v of Array.from(f.keys()))if(v.indexOf(n)===0)f.delete(v);for(let v of Array.from(p))if(v.indexOf(n)===0)p.delete(v);try{if(r)for(let v=r.length-1;v>=0;v--){let x=r.key(v);if(x&&x.indexOf(n)===0)r.removeItem(x)}}catch{}let c=s();if(!c)return i;return i=i.then(()=>c.removePrefix(n)).catch(()=>{}),i},flush(){return k()}};try{if(typeof document<"u"&&document.addEventListener)document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden")k()});if(typeof addEventListener==="function")addEventListener("pagehide",()=>{k()})}catch{}return E}function Z(e,o){if(!e)return!1;if(e===o.key)return!0;if(!o.url)return!1;if(e===o.url)return!0;try{let l=typeof location<"u"&&location.origin&&location.origin!=="null"?location.origin:"http://localhost",r=new URL(e,l),d=new URL(o.url,l);if(r.origin!==d.origin||r.pathname!==d.pathname)return!1;return!r.search||r.search===d.search}catch{return!1}}function ee(e){let o=e.prefix||"stx:kept:",l=e.matches||((t,i)=>t===i.key||t===i.url),r=new Set,d=new Map,y,s=(t)=>t===void 0?y:t,u=(t,i)=>{let g=s(i);if(g===!1||g===null||g==="")return null;return`${o}${g===void 0?"":`${g}:`}query:${t}`},h=(t)=>{let i=t&&t.value;if(!i||typeof i!=="object"||!("d"in i))return;return{data:i.d,at:Number(i.at)||0}},a=()=>{let t=globalThis;return t.__stx_outboxes instanceof Map?t.__stx_outboxes:null},p={setScope(t){y=t},scope:()=>y,keyFor:u,seed(t,i){let g=u(t,i);return g?h(e.kept.peek(g)):void 0},restore(t,i){let g=u(t,i);return g?e.kept.load(g).then(h):Promise.resolve(void 0)},persist(t,i,g){let m=u(t,g);if(m)e.kept.set(m,{d:i,at:Date.now()})},overlay(t,i,g){let m=a();if(!m||!m.size)return i;let _=i;return m.forEach((k)=>{try{_=k.overlay(t,_,g)}catch{}}),_},watch(t){return r.add(t),()=>{r.delete(t)}},cachedQuery(t,i){let g=d.get(t);if(g){if(i&&g.__options)g.__options(i);return g}let m=i||{},_=m.initial===void 0?null:m.initial,k=()=>typeof m.scope==="function"?m.scope():m.scope,N=()=>(typeof m.url==="function"?m.url():m.url)||null,P=()=>({key:t,url:N()}),E=k(),n=_,c=0,v=e.sharedRequest(),x=0,S=p.seed(t,E);if(S)n=S.data;let I=e.state(p.overlay(P(),n)),U=e.state(!1),q=e.state(!1),K=e.state(null),M=e.state(S?S.at:0),R=0,j=()=>{I.set(p.overlay(P(),n))},W=(w)=>{let b=R;p.restore(t,w).then((T)=>{if(!T||b!==R||c)return;n=T.data,M.set(T.at),j()})};if(!S)W(E);let _t=()=>{let w=k();if(w===E)return;E=w,R++,x=0,q.set(!1),U.set(!1),c=0;let b=p.seed(t,E);if(n=b?b.data:_,M.set(b?b.at:0),j(),!b)W(E)},xt=(w,b)=>{let T=m.timeoutMs||15000,C=typeof AbortController<"u"?new AbortController:null,O=null,V=new Promise((D,H)=>{O=setTimeout(()=>{if(C)C.abort();H(Error("The request took too long."))},T)}),A;if(m.load)A=m.load({force:w,url:b,signal:C?C.signal:void 0});else if(b){let D=m.fetch||((L,F)=>fetch(L,F)),H={method:"GET",headers:{Accept:"application/json"}};if(w)H.cache="no-cache";if(C)H.signal=C.signal;A=D(b,H).then((L)=>{if(!L.ok)return L.json().catch(()=>null).then((F)=>{throw Error(F&&(F.error||F.message)||`Request failed (${L.status})`)});return L.json()})}else return Promise.resolve(I());return Promise.race([A,V]).then((D)=>{if(O)clearTimeout(O);return m.transform?m.transform(D):D},(D)=>{if(O)clearTimeout(O);throw D})},G=(w)=>{let b=R,T=N(),C=()=>{if(b!==R)return Promise.resolve(I());if(x++,q.set(!0),c===0&&!M())U.set(!0);let V=()=>{if(b!==R)return;if(x=Math.max(0,x-1),!x)q.set(!1),U.set(!1)};return xt(w,T).then((A)=>{if(b!==R||T!==N())return V(),I();return n=A,c=Date.now(),M.set(c),K.set(null),p.persist(t,A,E),j(),V(),I()},(A)=>{if(b===R&&T===N())K.set(A&&A.message?A.message:"Could not load.");return V(),I()})},O=`${b} ${T||""}`;return w?v.fresh(O,C):v.run(O,C)},B={data:I,loading:U,isFetching:q,error:K,updatedAt:M,get key(){return t},load(w){if(_t(),!w&&c&&Date.now()-c<(m.staleTime||0))return Promise.resolve(I());return G(!!w)},refresh(){return B.load(!0)},set(w){n=typeof w==="function"?w(n):w,p.persist(t,n,E),j()},invalidate(){c=0},__options(w){m={...m,...w}}};if(r.add({target:P,updated:()=>{if(c||M())G(!1)},outbox:(w)=>{if(w)n=p.overlay(P(),n,w.id),c=0,G(!0);j()}}),d.set(t,B),m.immediate)B.load();return B}},f=typeof window<"u"?window:typeof addEventListener==="function"?globalThis:null;if(e.listen!==!1&&f&&typeof f.addEventListener==="function")f.addEventListener("stx:updated",(t)=>{let i=t.detail||{};if(i.kind!=="api"||typeof i.url!=="string")return;r.forEach((g)=>{if(l(i.url,g.target()))g.updated()})}),f.addEventListener("stx:outbox",(t)=>{let i=t.detail||{},g=i.sent&&typeof i.sent.id==="string"?i.sent:null;r.forEach((m)=>{if(g){let _=Array.isArray(g.affects)?g.affects:[],k=m.target();if(!_.some((N)=>l(N,k)))return}m.outbox(g)})});return p}function te(e){let o=e&&e.covers||((s,u)=>Object.is(s,u)),l=[],r=[],d=0,y=(s,u)=>{let h;try{h=Promise.resolve(u())}catch(f){h=Promise.reject(f)}let a={key:s,promise:h};l.push(a);let p=()=>{let f=l.indexOf(a);if(f!==-1)l.splice(f,1)};return h.then(p,p),h};return{run(s,u){for(let h of l)if(o(h.key,s))return h.promise;for(let h of r)if(o(h.key,s))return h.promise;return y(s,u)},fresh(s,u){for(let f of r)if(o(f.key,s))return f.promise;let h=l.filter((f)=>o(f.key,s)).map((f)=>f.promise);if(!h.length)return y(s,u);let a={key:s,promise:null},p=()=>{};return a.promise=Promise.all(h.map((f)=>f.then(p,p))).then(()=>{let f=r.indexOf(a);if(f!==-1)r.splice(f,1);return y(s,u)}),r.push(a),a.promise},latest(){let s=++d;return()=>s===d},get busy(){return l.length>0||r.length>0}}}function ne(e){let o=!1,l=null,r=null,d=0;async function y(){if(o)return;l=new AbortController;try{let s=await e.request(e.endpoint,{signal:l.signal,cache:"no-store",headers:{Accept:"text/event-stream"}});if(!s.ok||!s.body||!s.headers.get("content-type")?.includes("text/event-stream"))throw Error("Broadcast stream unavailable");if(o){await s.body.cancel();return}let u=s.body.getReader(),h=new TextDecoder,a="";d=0,e.onStatus?.(!0),e.onConnected?.();try{while(!o){let{done:p,value:f}=await u.read();if(p)break;if(a+=h.decode(f,{stream:!0}).replace(/\r\n/g,`
|
|
3
3
|
`),a.length>1048576)throw Error("Broadcast frame too large");let t;while((t=a.indexOf(`
|
|
4
4
|
|
|
5
5
|
`))!==-1){let i=a.slice(0,t);a=a.slice(t+2);let g=i.split(`
|
|
@@ -1578,7 +1578,7 @@ else {
|
|
|
1578
1578
|
});
|
|
1579
1579
|
return s;
|
|
1580
1580
|
}
|
|
1581
|
-
`;var
|
|
1581
|
+
`;var ve=` // \u2500\u2500 Alert & Confirm dialogs \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
1582
1582
|
// Styled replacements for window.alert() and window.confirm().
|
|
1583
1583
|
// Both return Promises and render into a temporary modal overlay.
|
|
1584
1584
|
|
|
@@ -1772,7 +1772,7 @@ else {
|
|
|
1772
1772
|
function stxConfirm(message, options) {
|
|
1773
1773
|
return _createDialog(message, options, true);
|
|
1774
1774
|
}
|
|
1775
|
-
`;var
|
|
1775
|
+
`;var ye=` // ==========================================================================
|
|
1776
1776
|
// DevTools introspection (stacksjs/stx#1747, Phase 1)
|
|
1777
1777
|
// ==========================================================================
|
|
1778
1778
|
// A read-only, console-usable inspector wired to the live runtime \u2014 no manual
|
|
@@ -1907,7 +1907,7 @@ else {
|
|
|
1907
1907
|
return s ? __stxDevtoolsClassify(s) : null;
|
|
1908
1908
|
},
|
|
1909
1909
|
};
|
|
1910
|
-
`;var
|
|
1910
|
+
`;var we=` // ==========================================================================
|
|
1911
1911
|
// Auto-initialization
|
|
1912
1912
|
// ==========================================================================
|
|
1913
1913
|
|
|
@@ -2235,7 +2235,7 @@ catch (e) {
|
|
|
2235
2235
|
window.__stxDomReadyHandler = stxDomReadyHandler;
|
|
2236
2236
|
console.log('[stx] registering DOMContentLoaded handler');
|
|
2237
2237
|
document.addEventListener('DOMContentLoaded', stxDomReadyHandler);
|
|
2238
|
-
`;var
|
|
2238
|
+
`;var be=` // \u2500\u2500 Drawer system \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
2239
2239
|
// Same pattern as modal but slides from a side
|
|
2240
2240
|
var drawer = {
|
|
2241
2241
|
open: function(id) {
|
|
@@ -2273,7 +2273,7 @@ catch (e) {
|
|
|
2273
2273
|
else drawer.open(id);
|
|
2274
2274
|
}
|
|
2275
2275
|
};
|
|
2276
|
-
`;var
|
|
2276
|
+
`;var _e=` // ==========================================================================
|
|
2277
2277
|
// Effect
|
|
2278
2278
|
// ==========================================================================
|
|
2279
2279
|
|
|
@@ -3972,7 +3972,7 @@ catch (e) {
|
|
|
3972
3972
|
if (tgIsGroup) parent.__stx_tg_init = true;
|
|
3973
3973
|
});
|
|
3974
3974
|
}
|
|
3975
|
-
`;var
|
|
3975
|
+
`;var Ce=` // ==========================================================================
|
|
3976
3976
|
// Native row plans
|
|
3977
3977
|
// ==========================================================================
|
|
3978
3978
|
|
|
@@ -4633,7 +4633,7 @@ catch (e) {
|
|
|
4633
4633
|
var after = row.after.splice(0, row.after.length);
|
|
4634
4634
|
for (var i = 0; i < after.length; i++) after[i]();
|
|
4635
4635
|
}
|
|
4636
|
-
`;var
|
|
4636
|
+
`;var Ie=` // Also expose globally for convenience
|
|
4637
4637
|
window.state = state;
|
|
4638
4638
|
window.derived = derived;
|
|
4639
4639
|
window.memo = memo;
|
|
@@ -5610,7 +5610,7 @@ catch (e) {
|
|
|
5610
5610
|
_exprFailureCount = 0;
|
|
5611
5611
|
}
|
|
5612
5612
|
}
|
|
5613
|
-
`;var
|
|
5613
|
+
`;var je=` // Reactive if/else-if/else chain. A single effect drives mutual exclusion:
|
|
5614
5614
|
// on each run it picks the first branch whose condition is truthy (the
|
|
5615
5615
|
// trailing x-else always matches), inserts that branch, and removes
|
|
5616
5616
|
// whichever branch was previously shown. One effect for the whole chain
|
|
@@ -5896,7 +5896,7 @@ catch (e) { /* a disposer of its own is not this branch's problem */ }
|
|
|
5896
5896
|
// Shown branches whose deferred bind found them off the page: an enclosing
|
|
5897
5897
|
// :if, bound later in the same pass, hid them between the queue and the run.
|
|
5898
5898
|
// Their own condition has not changed, so their effect never runs again to
|
|
5899
|
-
// retry; each resumes here when an enclosing branch puts it back.`;var
|
|
5899
|
+
// retry; each resumes here when an enclosing branch puts it back.`;var Ve=` const detachedBranches = new Set();
|
|
5900
5900
|
function resumeDetachedBranches() {
|
|
5901
5901
|
if (!detachedBranches.size) return;
|
|
5902
5902
|
Array.from(detachedBranches).forEach(function(resume) {
|
|
@@ -11193,6 +11193,10 @@ else if (timer === null) {
|
|
|
11193
11193
|
function useClickOutside(target, handler) {
|
|
11194
11194
|
function resolveTarget() {
|
|
11195
11195
|
if (typeof target === 'string') return document.querySelector(target);
|
|
11196
|
+
// A getter (\`() => box.current\`), as the module composable's MaybeRef reads one.
|
|
11197
|
+
// It used to be taken for the element itself, and every pointerdown threw
|
|
11198
|
+
// "el.contains is not a function" without ever running the handler.
|
|
11199
|
+
if (typeof target === 'function') return target();
|
|
11196
11200
|
if (target && typeof target === 'object') {
|
|
11197
11201
|
if ('current' in target) return target.current;
|
|
11198
11202
|
if ('value' in target) return target.value;
|
|
@@ -11795,14 +11799,14 @@ else if (timer === null) {
|
|
|
11795
11799
|
subscribe: subscribe
|
|
11796
11800
|
};
|
|
11797
11801
|
}
|
|
11798
|
-
`;function
|
|
11802
|
+
`;function At(e={}){let o=St(rr(e));try{let r=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(o);return r=r.replace(/\}(var |let |const |function )/g,"};$1"),r}catch{return o}}function St(e){let o=[],l=0,r="console.log(";while(l<e.length){let d=e.indexOf(r,l);if(d===-1){o.push(e.slice(l));break}o.push(e.slice(l,d));let y=1,s=d+r.length;while(s<e.length&&y>0){let u=e[s];if(u==='"'||u==="'"||u==="`"){let h=u;s++;while(s<e.length&&e[s]!==h){if(e[s]==="\\")s++;s++}s++;continue}if(u==="(")y++;else if(u===")")y--;s++}o.push("0"),l=s}return o.join("")}function rr(e={}){return`${ae}${Pe}
|
|
11799
11803
|
${Ze(ie,ke,Te)}
|
|
11800
11804
|
|
|
11801
11805
|
${De}
|
|
11802
11806
|
${rt}
|
|
11803
11807
|
${tt}
|
|
11804
11808
|
${ut}
|
|
11805
|
-
${
|
|
11809
|
+
${_e}
|
|
11806
11810
|
${Ue}
|
|
11807
11811
|
${bt}
|
|
11808
11812
|
${Ae(X.toString(),Q.toString())}
|
|
@@ -11822,7 +11826,7 @@ ${se}
|
|
|
11822
11826
|
${de}
|
|
11823
11827
|
${he}
|
|
11824
11828
|
${Ge}
|
|
11825
|
-
${nt(Wl(),ql(),
|
|
11829
|
+
${nt(Wl(),ql(),Vl())}
|
|
11826
11830
|
|
|
11827
11831
|
${mt}
|
|
11828
11832
|
${lt}
|
|
@@ -11834,11 +11838,11 @@ ${qe}
|
|
|
11834
11838
|
${ue}
|
|
11835
11839
|
${Ke}
|
|
11836
11840
|
${Ne}
|
|
11837
|
-
${e.native?
|
|
11841
|
+
${e.native?Ce:""}
|
|
11838
11842
|
${Be}
|
|
11839
11843
|
${fe}
|
|
11840
|
-
${Ve}
|
|
11841
11844
|
${je}
|
|
11845
|
+
${Ve}
|
|
11842
11846
|
${ce}
|
|
11843
11847
|
${gt}
|
|
11844
11848
|
${re}
|
|
@@ -11855,8 +11859,8 @@ ${Oe}
|
|
|
11855
11859
|
${yt}
|
|
11856
11860
|
|
|
11857
11861
|
${Qe}
|
|
11858
|
-
${
|
|
11859
|
-
${
|
|
11862
|
+
${ve}
|
|
11863
|
+
${be}
|
|
11860
11864
|
${vt}
|
|
11861
11865
|
${Me}
|
|
11862
11866
|
${ot(pe)}
|
|
@@ -11866,9 +11870,9 @@ ${pt}
|
|
|
11866
11870
|
${We}
|
|
11867
11871
|
});
|
|
11868
11872
|
|
|
11869
|
-
${
|
|
11873
|
+
${Ie}
|
|
11874
|
+
${ye}
|
|
11870
11875
|
${we}
|
|
11871
|
-
${be}
|
|
11872
11876
|
${at}
|
|
11873
11877
|
${Le}
|
|
11874
11878
|
${me}
|
|
@@ -11876,5 +11880,5 @@ ${ct}
|
|
|
11876
11880
|
${dt}
|
|
11877
11881
|
${it}
|
|
11878
11882
|
})();
|
|
11879
|
-
`}var Hh={state:
|
|
11880
|
-
export{
|
|
11883
|
+
`}var Hh={state:xe,derived:sr,effect:or,batch:zo,onMount:ps,onDestroy:gs,isSignal:ir,isDerived:ar,untrack:Ho,peek:ms,generateSignalsRuntime:At,generateSignalsRuntimeDev:rr};
|
|
11884
|
+
export{At,rr,Hh};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Uu,Wo,cr,Vu,Wu,qu,Ku,Gu,Xu,Ju,Yu,Zu,Qu,ed,td,nd,rd,sd,od,id,ad,cd,ld,ud,dd,pd,fd,gd,md,hd,yd,bd,wd,vd,xd,Sd,kd,_d,Cd,Ed,Td,$d,Rd,Ad,Pd,Id,Od,Nd,dn,ec,Md,Dd,Ld,tc,jd,Bd,Fd,zd,Hd,Ud,nc,Vd,Wd,qd,Kd,Gd,Xd,Jd,Yd,Zd,lr,Qd,ep,tp,np,rp,sp,op,ip,ap,cp,lp,up,qo,dp,pp,fp,gp,mp,ys,bs,hp,yp,bp,wp,vp,rc,xp,Sp,kp,sc,Ko,_p,Cp,oc,ic,ws,ac,Ep,pn,Tp,cc,lc,Go,$p,Xo,Rp,Ap,Pp,Ip,Op,Np,Mp,uc,Dp,Lp,dc,jp,Bp,Fp,zp,Hp,Up,Vp,Wp,qp,Kp,Gp,Xp,Jp,Yp,Zp,Qp,ef,tf,nf,rf,sf,of,af,cf,pc,lf,uf,df,pf,ff,gf,mf,hf,yf,bf,wf,ur,fc,gc,vf,dr,xf,Sf,kf,mc,hc,vs,xs,_f,Jo,Cf,Ef,Tf,$f,Rf,Af,Pf,If,Of,Nf,Mf,Df,Lf,jf,Bf,Ff,zf,Hf,Uf,Vf,yc,Wf,qf,bc,wc,Kf,Gf}from"./chunk-mxf6cfbg.js";export{Od as AVAILABLE_COMPONENTS,rc as AutoUpdater,Nd as COMPONENT_STYLES,vs as DEFAULT_WATCH_INTERVAL_MS,hc as MAX_WATCH_INTERVAL_MS,mc as MIN_WATCH_INTERVAL_MS,Ud as MODAL_STYLES,Zu as TOAST_STYLES,Jd as TRAY_MENU_STYLES,oc as UPDATE_MANIFEST_ASSET,Bd as alert,sf as appInfo,Af as appleScript,Gf as applicationDataDirectory,Rf as audio,qf as backgroundDelay,ef as battery,$f as biometric,bf as bluetooth,Mf as bonjour,pn as bundlePathForExecutable,$p as caffeinate,xp as canReplaceBundle,Sp as clearQuarantine,Wp as clipboard,Hd as closeAllModals,up as closeAllWindows,jd as confirm,cf as contextMenu,zf as continuityCamera,Ff as coreml,wp as craftBinaryNotFoundMessage,qo as craftWindowArguments,ur as crashReporter,xd as createAccordion,gd as createAutocomplete,od as createAvatar,sd as createBadge,Qu as createButton,id as createCard,$d as createChart,td as createCheckbox,yd as createChip,Rd as createCodeEditor,dd as createColorPicker,Td as createDataGrid,pd as createDatePicker,bs as createDiskImage,cd as createDropdown,Pd as createFileExplorer,Ep as createGitHubUpdateManifest,ac as createGitHubUpdater,hd as createImageView,zp as createInterval,md as createLabel,_d as createListView,Ad as createMediaPlayer,Vd as createMenubar,kd as createModalComponent,Kf as createNativeUpdateApi,wc as createPantrySelfUpdater,Op as createPreferences,rd as createProgressBar,ud as createRadioButton,ld as createRating,wd as createScrollView,Go as createSelfUpdater,nd as createSlider,vd as createSplitView,Sd as createStepper,nc as createSystemTray,Cd as createTable,ad as createTabs,ed as createTextInput,fd as createTimePicker,Fp as createTimer,bd as createTooltip,Ed as createTreeView,Id as createWebView,dp as createWindow,fp as createWindowWithHTML,Xo as decaffeinate,Qp as deepLinks,Hp as delay,Xu as dismissAlertById,Ju as dismissAllAlerts,Yp as dragOut,kp as extractBundle,Pf as fileAssociations,Jo as focus,Ef as focusShortcutsReady,Vp as formatCompact,Ip as formatDuration,Pp as formatRemainingTime,Dp as formatShortcut,Up as formatTime,Kp as fs,sc as generateUpdateManifest,Yu as getActiveAlertCount,zd as getActiveModalCount,Wd as getActiveTrayInstances,cp as getActiveWindowIds,Ap as getCaffeinateStatus,Vf as getCapabilities,yc as getCapability,ip as getDesktopConfig,sp as getDialogBridgeScript,Bp as getRegisteredHotkeys,Gd as getSimulatedTrayHTML,Xd as getTrayBridgeScript,qd as getTrayInstance,lp as getWindow,mp as getWindowBridgeScript,ic as githubLatestAssetUrl,ws as githubReleaseAssetUrl,Xp as globalShortcuts,dr as handoff,Cf as hasFocusShortcuts,vf as iap,Mp as isAutoLaunchEnabled,Wf as isAvailable,Rp as isCaffeinated,Zp as isDragOutAvailable,gp as isWebviewAvailable,df as keychain,xf as liveActivities,Tf as localServer,Sf as location,Nf as log,hp as macOSRuntimeExecutablePath,af as menu,Bf as midi,gf as nativeAutoLaunch,mf as nativeTray,hf as nativeWindow,tf as network,qp as notifications,Gu as notify,pp as openDevWindow,yp as pack,bp as packageApp,bc as parsePantryUpdateManifest,uc as parseShortcut,Of as pdf,pf as permissions,ff as printing,Fd as prompt,cc as quitLauncher,Ko as readBundleIdentity,fc as redactPII,Lp as registerHotkey,lc as relaunchBundle,Uu as requestNotificationPermission,ap as resetDesktopConfig,vp as resolveCraftBinary,ys as resolveCraftExecutablePath,Tp as runningBundleTeamId,uf as screen,kf as screenCapture,xs as screenSharing,Uf as serial,Hf as serviceMenu,Np as setAutoLaunch,op as setDesktopConfig,Gp as shell,Wo as showAlert,ep as showAlertDialog,Qd as showColorPicker,tp as showConfirmDialog,np as showErrorDialog,Dd as showErrorModal,Ku as showErrorToast,ec as showInfoModal,Vu as showInfoToast,lr as showMessageBox,dn as showModal,Yd as showOpenDialog,tc as showQuestionModal,Zd as showSaveDialog,Ld as showSuccessModal,Wu as showSuccessToast,cr as showToast,rp as showWarningDialog,Md as showWarningModal,qu as showWarningToast,pc as sidebar,gc as signPayload,wf as speech,Lf as speechRecognition,Df as spotlight,of as standardMenus,_p as swapBundle,lf as system,If as tags,Jp as theme,yf as touchbar,Kd as triggerTrayAction,jp as unregisterAllHotkeys,dc as unregisterHotkey,nf as updater,Cp as verifyBundleTrust,jf as vision,_f as watchScreenSharing,rf as windowEvents};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{nl,s,
|
|
3
|
-
export{mg,fy,gy,my,hy,hg,yg,yy,by,hi,wy,
|
|
2
|
+
import{nl,s,Ce}from"./chunk-9w6k311w.js";import{gt}from"./chunk-zkwkhesc.js";import{l}from"./chunk-zxjdfgdx.js";import o from"fs";import u from"path";var mg=new Map,m=new Map;async function fy(e){let n;for(let i=0;i<3;i++)try{let g=(await o.promises.stat(e)).mtime.getTime(),a=m.get(e);if(a&&a.mtime===g)return a.content;let h=await Bun.file(e).text(),w=(await o.promises.stat(e)).mtime.getTime();if(w!==g)continue;return m.set(e,{content:h,mtime:w}),h}catch(r){n=r;break}throw m.delete(e),Error(`File not found: ${e}${n?` (${n.message})`:""}`)}function gy(e){m.delete(e)}function my(e){for(let t of m.keys())if(t.startsWith(e))m.delete(t)}var f=null,B=null,x=null;function hy(e){x=e}async function hg(e=!1){let t=x??await import("./chunk-vm57848v.js");if(e)return t.generateSignalsRuntimeDev();if(f===null)f=t.generateSignalsRuntime();return f}var S=null;async function yg(){if(S===null){let{getRouterScript:e}=await import("./chunk-2eq3aret.js");S=e()}return S}var y={};async function yy(e,t=!1){let n=e==="runtime"?await hg(t):await yg(),i=e==="runtime"&&t?"runtime-debug":e,r=y[i];if(!r||r.content!==n)r={content:n,hash:Bun.hash(n).toString(16).padStart(16,"0").slice(0,16)},y[i]=r;return{content:n,hash:r.hash,url:`/_stx/${e}.${r.hash}.js`}}var E=500,T=33554432,c=new Map,p=0;function C(e){return l(process.cwd(),"module-bundles",`${e}.js`)}function by(e){let t=Bun.hash(e).toString(16).padStart(16,"0").slice(0,16),n=c.get(t),i=n!==void 0;if(i)c.delete(t),p-=n.length*2;c.set(t,e),p+=e.length*2;while(c.size>1&&(c.size>E||p>T)){let r=c.keys().next().value;p-=c.get(r).length*2,c.delete(r)}if(!i)try{let r=C(t);if(!o.existsSync(r))o.mkdirSync(u.dirname(r),{recursive:!0}),o.writeFileSync(r,e)}catch{}return`/_stx/modules.${t}.js`}function hi(e){if(!/^[0-9a-f]{16}$/.test(e))return;let t=c.get(e);if(t!==void 0)return t;try{return o.readFileSync(C(e),"utf8")}catch{return}}function wy(){m.clear(),Ce(),nl(),f=null,B=null,S=null}function v(e){let t={debug:e.debug===!0,middleware:(e.middleware??[]).map((n)=>({name:n.name,timing:n.timing,handler:String(n.handler)})),customDirectives:(e.customDirectives??[]).map((n)=>({name:n.name,hasEndTag:n.hasEndTag===!0,rawParams:n.rawParams===!0,handler:String(n.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(t)).digest("hex")}async function _r(e,t){try{if(!t.cachePath)return null;let n=u.resolve(t.cachePath),i=u.join(n,`${Ds(e)}.html`),r=u.join(n,`${Ds(e)}.meta.json`);if(!await s(i)||!await s(r))return null;let g=await Bun.file(r).text(),a=JSON.parse(g);if(a.cacheVersion!==t.cacheVersion)return null;if(a.engine!==gt())return null;if(a.optionsSignature!==v(t))return null;if((await o.promises.stat(e)).mtime.getTime()>a.mtime)return null;for(let d of a.dependencies)if(await s(d)){if((await o.promises.stat(d)).mtime.getTime()>a.mtime)return null}else return null;return await Bun.file(i).text()}catch(n){return console.warn(`Cache error for ${e}:`,n),null}}async function Cr(e,t,n,i){try{if(!i.cachePath)return;let r=u.resolve(i.cachePath);await o.promises.mkdir(r,{recursive:!0});let g=u.join(r,`${Ds(e)}.html`),a=u.join(r,`${Ds(e)}.meta.json`),h=await o.promises.stat(e);await Bun.write(g,t);let d={sourcePath:e,mtime:h.mtime.getTime(),dependencies:Array.from(n),cacheVersion:i.cacheVersion,engine:gt(),optionsSignature:v(i),generatedAt:Date.now()};await Bun.write(a,JSON.stringify(d,null,2)),mg.set(e,{output:t,mtime:h.mtime.getTime(),dependencies:n})}catch(r){console.warn(`Failed to cache template ${e}:`,r)}}var _=16;function Ds(e){return new Bun.CryptoHasher("sha1").update(e).digest("hex").substring(0,_)}
|
|
3
|
+
export{mg,fy,gy,my,hy,hg,yg,yy,by,hi,wy,_r,Cr,Ds};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
`+e.slice(t);let n=
|
|
2
|
+
import{$r}from"./chunk-gzc16hs8.js";import{Ur}from"./chunk-ac3e6nhg.js";import{a}from"./chunk-e5md1cck.js";import{W,lt}from"./chunk-a7bqrjm5.js";import{Lc}from"./chunk-x5bn2svk.js";import{L,c}from"./chunk-hxws025y.js";var x=/<style\b[^>]*>/iy,R=/<\/style>/gi,b=/<script\b[^>]*>/iy,S=/<template(?=[\s>/])[^>]*>/iy,w=/<\/template\s*>/iy;function Sr(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 g=e.indexOf("-->",n+4);r=g===-1?e.length:g+3;continue}x.lastIndex=n;let u=x.exec(e);if(u){R.lastIndex=n+u[0].length;let g=R.exec(e);r=g===null?e.length:g.index+8;continue}S.lastIndex=n;let o=S.exec(e);if(o){if(t===0)s=n;t++,r=n+o[0].length;continue}w.lastIndex=n;let d=w.exec(e);if(d){if(t>0)t--;r=n+d[0].length;continue}if(b.lastIndex=n,b.test(e))return t>0?s:n;r=n+1}return-1}function re(e,r={}){return new $r(e,r).routes}import y from"path";var T=new Map;async function h(e,r){let t=e,s=r;if(!t||!s)try{let d=await a();t||=d?.pagesDir||"pages",s||=d?.root||"."}catch{t||="pages",s||="."}let n=y.isAbsolute(t)?t:y.join(s,t),u=T.get(n);if(u)return u;let o=[];try{o=re(".",{pagesDir:n,emit:!1}).map((d)=>d.regex.source).filter(Boolean)}catch{o=[]}return T.set(n,o),o}function E(e){return e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function l(e){return E(JSON.stringify(e))}function Re(e){return e.includes("data-stx-runtime")}function Mc(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 p(e,r){let t=Sr(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=Ur(e);if(n!==null)return`${e.slice(0,n)}
|
|
4
4
|
${r}${e.slice(n)}`;if(e.includes("</head>")){let o=L(e);return e.slice(0,o)+r+`
|
|
5
|
-
`+e.slice(o)}if(W(e))return
|
|
5
|
+
`+e.slice(o)}if(W(e))return lt(e,(o)=>`${o}
|
|
6
6
|
${r}`);return`${r}
|
|
7
|
-
${e}`}async function
|
|
7
|
+
${e}`}async function kr(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-08kcxz79.js"),{url:u}=await n("runtime",r.debug===!0);return p(e,`<script data-stx-runtime src="${u}"></script>`)}if(r.buildMode==="compile")return p(e,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:t}=await import("./chunk-08kcxz79.js"),s=await t(r.debug);return p(e,`<script data-stx-scoped data-stx-runtime>${s}</script>`)}function O(e){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(e)}function Dc(e){if(e.includes("data-stx-tooltip-runtime")||!O(e))return e;let r=`<script data-stx-scoped data-stx-tooltip-runtime>${Lc()}</script>`,t=c(e);if(t===-1)return`${e}
|
|
8
8
|
${r}`;return`${e.slice(0,t)}${r}
|
|
9
|
-
${e.slice(t)}`}var C=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function M(e){return C.test(e)||e.includes("__stxRouter)return")||e.includes("__stxRouter=true")}async function
|
|
9
|
+
${e.slice(t)}`}var C=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function M(e){return C.test(e)||e.includes("__stxRouter)return")||e.includes("__stxRouter=true")}async function Ae(e,r){if(!e.includes("</body>"))return e;if(M(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.prefetchBudgetBytes!==void 0)i.prefetchBudgetBytes=t.prefetchBudgetBytes;if(t.keepOpening!==void 0)i.keepOpening=t.keepOpening}try{let f=await h(r?.pagesDir,r?.root);if(f.length>0)if(r?.buildMode==="serve"){let{registerServeModuleBundle:_}=await import("./chunk-08kcxz79.js");n=`<script data-stx-owned-routes src="${_(`(window.__stxRouterConfig=window.__stxRouterConfig||{}).ownedRoutes=${l(f)};
|
|
10
10
|
`)}"></script>
|
|
11
11
|
`}else i.ownedRoutes=f}catch{}if(Object.keys(i).length>0)s=`<script>window.__stxRouterConfig=${l(i)};</script>
|
|
12
|
-
`}let{getCachedRouterScript:u,getServeClientAsset:o}=await import("./chunk-
|
|
12
|
+
`}let{getCachedRouterScript:u,getServeClientAsset:o}=await import("./chunk-08kcxz79.js"),d=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 u()}</script>`,g=c(e);return e.slice(0,g)+s+n+d+`
|
|
13
13
|
</body>`+e.slice(g+7)}
|
|
14
|
-
export{
|
|
14
|
+
export{Sr,re,Re,Mc,kr,Dc,Ae};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import x from"fs";import u from"path";import p from"fs";import w from"path";var y=["components","layouts","partials","emails"];function M(e){return e.split(/[\\/]/).filter(Boolean).slice(0,-1).some((a)=>y.includes(a))}function b(e){return M(e.replace(/^\//,""))}function _i(e,t){let a=e.filter((i)=>!b(i.pattern)),r=["// Auto-generated by STX - do not edit"];if(a.length===0)r.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{r.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let i of a){let c=[];for(let l of i.params){let d=i.pattern.includes(`:${l}?`)?"?":"";c.push(`${l}${d}: string`)}let s=c.join("; ");r.push(` '${i.pattern}': { ${s} }`)}r.push(" }","}","","export {}","")}let n=r.join(`
|
|
3
3
|
`),o=w.join(t,"route-types.d.ts");try{if(p.existsSync(o)&&p.readFileSync(o,"utf8")===n)return;p.mkdirSync(t,{recursive:!0}),p.writeFileSync(o,n)}catch{}}function Ci(e,t,a){let r=process.cwd(),n=w.relative(r,a),o=e.filter((c)=>!b(c.pattern)),i=["// Auto-generated by stx \u2014 do not edit",`// Source: ${n||"pages"}/`,"","export const routes = ["];for(let c of o){let s=w.relative(r,c.filePath).replace(/\\/g,"/"),l=JSON.stringify(c.params),d=c.layout?`, layout: '${w.relative(r,c.layout).replace(/\\/g,"/")}'`:"";i.push(` { pattern: '${c.pattern}', filePath: '${s}', isDynamic: ${c.isDynamic}, params: ${l}${d} },`)}i.push("] as const",""),i.push("export type RouteName = typeof routes[number]['pattern']",""),p.mkdirSync(t,{recursive:!0}),p.writeFileSync(w.join(t,"routes.ts"),i.join(`
|
|
4
|
-
`))}import I from"path";var N=Object.freeze(["ico","png","jpg","jpeg","gif","webp","avif","svg","bmp","tif","tiff","heic","css","js","mjs","cjs","map","wasm","webmanifest","json","xml","txt","rss","atom","woff","woff2","ttf","otf","eot","mp3","mp4","m4a","m4v","mov","webm","ogg","ogv","oga","wav","flac","avi","mkv","pdf","csv","doc","docx","xls","xlsx","ppt","pptx","rtf","odt","zip","gz","tgz","tar","rar","7z","bz2","xz","php","phtml","asp","aspx","jsp","cgi","env","ini","yml","yaml","toml","sql","bak","old","swp","log","conf","cfg","exe","dmg","pkg","apk","ipa","msi","iso","bin","dll"]),D=N.flatMap((e)=>e===e.toUpperCase()?[e]:[e,e.toUpperCase()]).join("|"),G=new RegExp(`\\.(?:${D})$`),E=`(?![^/]*\\.(?:${D})$)`;function Nt(e){let t=e,a=t.search(/[?#]/);if(a!==-1)t=t.slice(0,a);let r=t.slice(t.lastIndexOf("/")+1);return r.length>0&&G.test(r)}function R(e,t){let r=I.relative(t,e).replace(/\.(stx|md)$/,"");if(r=r.split(I.sep).join("/"),r==="index")return"/";if(r.endsWith("/index"))r=r.slice(0,-6);return r=r.replace(/\[\[([^\]]+)\]\]/g,":$1?"),r=r.replace(/\[([^\]]+)\]/g,":$1"),r=r.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${r}`}function xe(e,t={}){let a=t.page?E:"",r=[],n="",o=0;while(o<e.length){let i=e.slice(o),c=/^\/:([^/?*]+)\?/.exec(i);if(c){r.push(c[1]);let d=o+c[0].length===e.length;n+=`(?:/${d?a:""}([^/]+))?`,o+=c[0].length;continue}let s=/^:([^/?*]+)\*/.exec(i);if(s){r.push(s[1]),n+="(.+)",o+=s[0].length;continue}let l=/^:([^/?*]+)/.exec(i);if(l){r.push(l[1]);let d=o+l[0].length===e.length;n+=`${d?a:""}([^/]+)`,o+=l[0].length;continue}n+=e[o].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),o+=1}return{regex:new RegExp(`^${n}$`),params:r}}function Er(e,t){let a=e===""?"/":e;for(let r of t){let n=a.match(r.regex);if(n){let o={};return r.params.forEach((i,c)=>{o[i]=n[c+1]}),{route:r,params:o}}}return null}function Us(e,t={}){let a=e.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return xe(a,t)}import X from"fs";import L from"path";function _(e,t){let a=[],r=L.dirname(e);while(r.startsWith(t)||r===t){let n=L.join(r,"_layout.stx");if(X.existsSync(n))a.unshift(n);if(r===t)break;r=L.dirname(r)}return a}function B(e,t){let a=[];if(!x.existsSync(e))return a;let r=x.readdirSync(e,{withFileTypes:!0});for(let n of r){let o=u.join(e,n.name);if(n.isDirectory()){if(n.name.startsWith("."))continue;if(y.includes(n.name))continue;a.push(...B(o,t))}else if(n.isFile()){let i=u.extname(n.name);if(t.includes(i)){if(n.name.startsWith("_")&&n.name!=="_layout.stx")continue;if(n.name==="_layout.stx")continue;a.push(o)}}}return a}class Tr{routes;pagesDir;pagesDirs;config;constructor(e,t={}){this.config=t;let a=t.pagesDirs&&t.pagesDirs.length>0?t.pagesDirs:[t.pagesDir||"pages"];this.pagesDirs=a.map((s)=>u.resolve(e,s)),this.pagesDir=this.pagesDirs[0];let r=t.extensions||[".stx"],n=(s)=>{let l=u.resolve(e,s);try{return x.realpathSync(l)}catch{return l}},o=(t.exclude??[]).filter((s)=>typeof s==="string"&&s.trim()!=="").map(n),i=(s)=>{if(o.length===0)return!1;let l=n(s);return o.some((d)=>l===d||l.startsWith(`${d}${u.sep}`))},c=new Set;this.routes=[];for(let s of this.pagesDirs){let l=B(s,r).filter((h)=>!i(h)),d=new Map;for(let h of l){let g=R(h,s),m=t.pagesDirs?g.replace(/:[\w]+/g,":param"):g;if(t.pagesDirs&&d.has(m))throw Error(`Conflicting layer pages for ${g}: ${d.get(m)} and ${h}`);if(d.set(m,h),c.has(m))continue;c.add(m);let{regex:j,params:O}=xe(g,{page:!0}),T=t.layouts!==!1?_(h,s):[];this.routes.push({pattern:g,regex:j,params:O,filePath:h,isDynamic:O.length>0,layout:T.length>0?T[T.length-1]:void 0})}}if(this.routes.sort((s,l)=>{if(!s.isDynamic&&l.isDynamic)return-1;if(s.isDynamic&&!l.isDynamic)return 1;let d=s.pattern.split("/").length,h=l.pattern.split("/").length;if(d!==h)return h-d;return s.pattern.localeCompare(l.pattern)}),t.emit!==!1){let s=u.resolve(e,t.stateDir||process.env.STX_DIR?.trim()||".stx");_i(this.routes,s),Ci(this.routes,s,this.pagesDir)}}match(e){let t=e===""?"/":e;for(let a of this.routes){let r=t.match(a.regex);if(r){let n={};return a.params.forEach((o,i)=>{n[o]=r[i+1]}),{route:a,params:n}}}return null}resolve(e,t){let a=this.routes.find((n)=>n.pattern===e||n.filePath.includes(e));if(!a)return"#not-found";let r=a.pattern;if(t)for(let[n,o]of Object.entries(t))r=r.replace(`:${n}`,encodeURIComponent(o));return r}addRoute(e){this.routes.push(e),this.routes.sort((t,a)=>{if(!t.isDynamic&&a.isDynamic)return-1;if(t.isDynamic&&!a.isDynamic)return 1;return t.pattern.localeCompare(a.pattern)})}getLayout(e){return e.layout??null}}function Ws(e,t){let a=[`${t}.stx`,"error.stx"];for(let r of a){let n=u.join(e,r);if(x.existsSync(n))return n}return null}function qs(e,t){return e.map((a)=>{let r=u.relative(t,a.filePath),n=a.isDynamic?" (dynamic)":"";return`${a.pattern} \u2192 ${r}${n}`})}var f={},k="";function vg(e){k=e.replace(/\/$/,"")}function xg(e,t,a={}){f[e]={path:t,name:e,params:a}}function Sg(e){for(let[t,a]of Object.entries(e))if(typeof a==="string")f[t]={path:a,name:t};else f[t]={...a,name:t}}function $r(e,t={},a=!1){let r=f[e];if(!r)return console.warn(`Route [${e}] not defined.`),"#undefined-route";let n={...r.params,...t},o=r.path;o=o.replace(/:(\w+)/g,(c,s)=>{let l=n[s];if(l===void 0)return console.warn(`Missing parameter [${s}] for route [${e}].`),`:${s}`;return delete n[s],encodeURIComponent(String(l))});let i=Object.entries(n);if(i.length>0){let c=i.map(([s,l])=>`${encodeURIComponent(s)}=${encodeURIComponent(String(l))}`).join("&");o+=(o.includes("?")?"&":"?")+c}return a&&k?`${k}${o}`:o}function kg(){for(let e of Object.keys(f))delete f[e];k=""}import F from"fs";import q from"path";function _g(e,t={}){return{type:"redirect",path:e,options:{replace:t.replace??!1,external:t.external??!1,redirectCode:t.redirectCode??302}}}function Cg(e){return{type:"abort",error:typeof e==="string"?{statusCode:500,message:e}:e}}function Eg(e,t={}){return{handler:e,mode:t.mode??"universal"}}function P(e){let t={};if(!e)return t;let a=e.split(";");for(let r of a){let[n,...o]=r.split("=");if(n){let i=n.trim(),c=o.join("=").trim();if(i)t[i]=decodeURIComponent(c)}}return t}function S(e,t,a={}){let r=`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(a.expires){let n=typeof a.expires==="number"?new Date(Date.now()+a.expires*1000):a.expires;r+=`; Expires=${n.toUTCString()}`}if(a.path)r+=`; Path=${a.path}`;if(a.domain)r+=`; Domain=${a.domain}`;if(a.secure)r+="; Secure";if(a.httpOnly)r+="; HttpOnly";if(a.sameSite)r+=`; SameSite=${a.sameSite}`;return r}function Jc(e,t){let a=e.headers.get("cookie")||"",r=P(a);return{get(n){return r[n]},set(n,o,i={}){r[n]=o,t.append("Set-Cookie",S(n,o,i))},delete(n){delete r[n],t.append("Set-Cookie",S(n,"",{expires:new Date(0),path:"/"}))},getAll(){return{...r}}}}function Yc(){return{get(e){if(typeof document>"u")return;return P(document.cookie)[e]},set(e,t,a={}){if(typeof document>"u")return;document.cookie=S(e,t,a)},delete(e){if(typeof document>"u")return;document.cookie=S(e,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return P(document.cookie)}}}function Zc(){let e=typeof window<"u"&&typeof window.localStorage<"u";return{get(t){if(!e)return null;try{return window.localStorage.getItem(t)}catch{return null}},set(t,a){if(!e)return;try{window.localStorage.setItem(t,a)}catch{}},remove(t){if(!e)return;try{window.localStorage.removeItem(t)}catch{}},isAvailable(){return e}}}var v=new Map;function Ei(e,t){v.set(e,t)}function Qc(e){return v.get(e)}function Tg(e){return v.has(e)}function Mt(){v.clear()}function Dt(){return Array.from(v.keys())}async function Lt(e,t="middleware"){let a=q.resolve(e,t);if(!F.existsSync(a))return;let r=F.readdirSync(a);for(let n of r){if(!n.endsWith(".ts")&&!n.endsWith(".js"))continue;if(n.includes(".test.")||n.includes(".spec."))continue;let o=n.replace(/\.(ts|js)$/,""),i=q.join(a,n);try{let s=(await import(i)).default;if(s&&typeof s.handler==="function")Ei(o,s);else if(typeof s==="function")Ei(o,{handler:s,mode:"universal"})}catch(c){console.warn(`Failed to load middleware '${o}' from ${i}:`,c)}}}function K(e){let t={};if(!e)return t;let a=new URLSearchParams(e);for(let[r,n]of a)t[r]=n;return t}function jt(e,t,a,r=""){return{path:e,params:t,query:K(r),fullPath:r?`${e}?${r}`:e,meta:a}}function Bt(e,t,a,r){let n=r?.isServer??typeof window>"u",o=!n,i=new Headers;return{to:e,from:t,isClient:o,isServer:n,cookies:n&&a?Jc(a,i):Yc(),storage:Zc(),state:{},request:a,responseHeaders:i}}async function Ft(e,t){let a=Array.isArray(e)?e:[e],r=t.isServer;for(let n of a){let o=Qc(n);if(!o)return console.error(`Route middleware '${n}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${n}' is not registered`}},state:t.state,responseHeaders:t.responseHeaders};if(o.mode==="server"&&!r)continue;try{let i=await o.handler(t);if(i){if(i.type==="redirect")return{passed:!1,redirect:i,state:t.state,responseHeaders:t.responseHeaders};if(i.type==="abort")return{passed:!1,abort:i,state:t.state,responseHeaders:t.responseHeaders}}}catch(i){return console.error(`Error in middleware '${n}':`,i),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:i instanceof Error?i.message:"Middleware error"}},state:t.state,responseHeaders:t.responseHeaders}}}return{passed:!0,state:t.state,responseHeaders:t.responseHeaders}}function Ks(e){let a=e.replace(/\\/g,"/").split("/").filter(Boolean),r=a.lastIndexOf("layouts"),n=r>=0?a[r+1]:a.at(-1);if(!n)return"app";return n.replace(/\.stx$/i,"")||"app"}function dt(e){let t=e.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),a=e.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),r=e.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),n=t?.[1]||r?.[1]||"";return{layout:n,group:a?.[1]||Ks(n)}}var A,C;function W(e){let t=[],a="log(",r=0;while(r<e.length){let n=e.indexOf("log(",r);if(n===-1){t.push(e.slice(r));break}let o=n>0?e[n-1]:" ",i=/\bfunction\s+$/.test(e.slice(Math.max(0,n-16),n));if(/[\w$.]/.test(o)||i){t.push(e.slice(r,n+4)),r=n+4;continue}t.push(e.slice(r,n));let c=1,s=n+4;while(s<e.length&&c>0){let l=e[s];if(l==='"'||l==="'"||l==="`"){let d=l;s++;while(s<e.length&&e[s]!==d){if(e[s]==="\\")s++;s++}s++;continue}if(l==="(")c++;else if(l===")")c--;s++}t.push("0"),r=s}return t.join("")}function U(e,t=!1){try{return new Bun.Transpiler(t?{loader:"js",minify:{whitespace:!0,identifiers:!0,syntax:!0}}:{loader:"js",minifyWhitespace:!0}).transformSync(e).replace(/\}(var |let |const |function )/g,"};$1").replace(/<\/script/gi,"<\\/script").trim()}catch{return e}}function H(){return`
|
|
4
|
+
`))}import I from"path";var N=Object.freeze(["ico","png","jpg","jpeg","gif","webp","avif","svg","bmp","tif","tiff","heic","css","js","mjs","cjs","map","wasm","webmanifest","json","xml","txt","rss","atom","woff","woff2","ttf","otf","eot","mp3","mp4","m4a","m4v","mov","webm","ogg","ogv","oga","wav","flac","avi","mkv","pdf","csv","doc","docx","xls","xlsx","ppt","pptx","rtf","odt","zip","gz","tgz","tar","rar","7z","bz2","xz","php","phtml","asp","aspx","jsp","cgi","env","ini","yml","yaml","toml","sql","bak","old","swp","log","conf","cfg","exe","dmg","pkg","apk","ipa","msi","iso","bin","dll"]),D=N.flatMap((e)=>e===e.toUpperCase()?[e]:[e,e.toUpperCase()]).join("|"),G=new RegExp(`\\.(?:${D})$`),E=`(?![^/]*\\.(?:${D})$)`;function Dt(e){let t=e,a=t.search(/[?#]/);if(a!==-1)t=t.slice(0,a);let r=t.slice(t.lastIndexOf("/")+1);return r.length>0&&G.test(r)}function R(e,t){let r=I.relative(t,e).replace(/\.(stx|md)$/,"");if(r=r.split(I.sep).join("/"),r==="index")return"/";if(r.endsWith("/index"))r=r.slice(0,-6);return r=r.replace(/\[\[([^\]]+)\]\]/g,":$1?"),r=r.replace(/\[([^\]]+)\]/g,":$1"),r=r.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${r}`}function Se(e,t={}){let a=t.page?E:"",r=[],n="",o=0;while(o<e.length){let i=e.slice(o),c=/^\/:([^/?*]+)\?/.exec(i);if(c){r.push(c[1]);let d=o+c[0].length===e.length;n+=`(?:/${d?a:""}([^/]+))?`,o+=c[0].length;continue}let s=/^:([^/?*]+)\*/.exec(i);if(s){r.push(s[1]),n+="(.+)",o+=s[0].length;continue}let l=/^:([^/?*]+)/.exec(i);if(l){r.push(l[1]);let d=o+l[0].length===e.length;n+=`${d?a:""}([^/]+)`,o+=l[0].length;continue}n+=e[o].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),o+=1}return{regex:new RegExp(`^${n}$`),params:r}}function Tr(e,t){let a=e===""?"/":e;for(let r of t){let n=a.match(r.regex);if(n){let o={};return r.params.forEach((i,c)=>{o[i]=n[c+1]}),{route:r,params:o}}}return null}function Vs(e,t={}){let a=e.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return Se(a,t)}import X from"fs";import L from"path";function _(e,t){let a=[],r=L.dirname(e);while(r.startsWith(t)||r===t){let n=L.join(r,"_layout.stx");if(X.existsSync(n))a.unshift(n);if(r===t)break;r=L.dirname(r)}return a}function B(e,t){let a=[];if(!x.existsSync(e))return a;let r=x.readdirSync(e,{withFileTypes:!0});for(let n of r){let o=u.join(e,n.name);if(n.isDirectory()){if(n.name.startsWith("."))continue;if(y.includes(n.name))continue;a.push(...B(o,t))}else if(n.isFile()){let i=u.extname(n.name);if(t.includes(i)){if(n.name.startsWith("_")&&n.name!=="_layout.stx")continue;if(n.name==="_layout.stx")continue;a.push(o)}}}return a}class $r{routes;pagesDir;pagesDirs;config;constructor(e,t={}){this.config=t;let a=t.pagesDirs&&t.pagesDirs.length>0?t.pagesDirs:[t.pagesDir||"pages"];this.pagesDirs=a.map((s)=>u.resolve(e,s)),this.pagesDir=this.pagesDirs[0];let r=t.extensions||[".stx"],n=(s)=>{let l=u.resolve(e,s);try{return x.realpathSync(l)}catch{return l}},o=(t.exclude??[]).filter((s)=>typeof s==="string"&&s.trim()!=="").map(n),i=(s)=>{if(o.length===0)return!1;let l=n(s);return o.some((d)=>l===d||l.startsWith(`${d}${u.sep}`))},c=new Set;this.routes=[];for(let s of this.pagesDirs){let l=B(s,r).filter((h)=>!i(h)),d=new Map;for(let h of l){let g=R(h,s),m=t.pagesDirs?g.replace(/:[\w]+/g,":param"):g;if(t.pagesDirs&&d.has(m))throw Error(`Conflicting layer pages for ${g}: ${d.get(m)} and ${h}`);if(d.set(m,h),c.has(m))continue;c.add(m);let{regex:j,params:O}=Se(g,{page:!0}),T=t.layouts!==!1?_(h,s):[];this.routes.push({pattern:g,regex:j,params:O,filePath:h,isDynamic:O.length>0,layout:T.length>0?T[T.length-1]:void 0})}}if(this.routes.sort((s,l)=>{if(!s.isDynamic&&l.isDynamic)return-1;if(s.isDynamic&&!l.isDynamic)return 1;let d=s.pattern.split("/").length,h=l.pattern.split("/").length;if(d!==h)return h-d;return s.pattern.localeCompare(l.pattern)}),t.emit!==!1){let s=u.resolve(e,t.stateDir||process.env.STX_DIR?.trim()||".stx");_i(this.routes,s),Ci(this.routes,s,this.pagesDir)}}match(e){let t=e===""?"/":e;for(let a of this.routes){let r=t.match(a.regex);if(r){let n={};return a.params.forEach((o,i)=>{n[o]=r[i+1]}),{route:a,params:n}}}return null}resolve(e,t){let a=this.routes.find((n)=>n.pattern===e||n.filePath.includes(e));if(!a)return"#not-found";let r=a.pattern;if(t)for(let[n,o]of Object.entries(t))r=r.replace(`:${n}`,encodeURIComponent(o));return r}addRoute(e){this.routes.push(e),this.routes.sort((t,a)=>{if(!t.isDynamic&&a.isDynamic)return-1;if(t.isDynamic&&!a.isDynamic)return 1;return t.pattern.localeCompare(a.pattern)})}getLayout(e){return e.layout??null}}function Ws(e,t){let a=[`${t}.stx`,"error.stx"];for(let r of a){let n=u.join(e,r);if(x.existsSync(n))return n}return null}function qs(e,t){return e.map((a)=>{let r=u.relative(t,a.filePath),n=a.isDynamic?" (dynamic)":"";return`${a.pattern} \u2192 ${r}${n}`})}var f={},k="";function vg(e){k=e.replace(/\/$/,"")}function xg(e,t,a={}){f[e]={path:t,name:e,params:a}}function Sg(e){for(let[t,a]of Object.entries(e))if(typeof a==="string")f[t]={path:a,name:t};else f[t]={...a,name:t}}function Rr(e,t={},a=!1){let r=f[e];if(!r)return console.warn(`Route [${e}] not defined.`),"#undefined-route";let n={...r.params,...t},o=r.path;o=o.replace(/:(\w+)/g,(c,s)=>{let l=n[s];if(l===void 0)return console.warn(`Missing parameter [${s}] for route [${e}].`),`:${s}`;return delete n[s],encodeURIComponent(String(l))});let i=Object.entries(n);if(i.length>0){let c=i.map(([s,l])=>`${encodeURIComponent(s)}=${encodeURIComponent(String(l))}`).join("&");o+=(o.includes("?")?"&":"?")+c}return a&&k?`${k}${o}`:o}function kg(){for(let e of Object.keys(f))delete f[e];k=""}import F from"fs";import q from"path";function _g(e,t={}){return{type:"redirect",path:e,options:{replace:t.replace??!1,external:t.external??!1,redirectCode:t.redirectCode??302}}}function Cg(e){return{type:"abort",error:typeof e==="string"?{statusCode:500,message:e}:e}}function Eg(e,t={}){return{handler:e,mode:t.mode??"universal"}}function P(e){let t={};if(!e)return t;let a=e.split(";");for(let r of a){let[n,...o]=r.split("=");if(n){let i=n.trim(),c=o.join("=").trim();if(i)t[i]=decodeURIComponent(c)}}return t}function S(e,t,a={}){let r=`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(a.expires){let n=typeof a.expires==="number"?new Date(Date.now()+a.expires*1000):a.expires;r+=`; Expires=${n.toUTCString()}`}if(a.path)r+=`; Path=${a.path}`;if(a.domain)r+=`; Domain=${a.domain}`;if(a.secure)r+="; Secure";if(a.httpOnly)r+="; HttpOnly";if(a.sameSite)r+=`; SameSite=${a.sameSite}`;return r}function Jc(e,t){let a=e.headers.get("cookie")||"",r=P(a);return{get(n){return r[n]},set(n,o,i={}){r[n]=o,t.append("Set-Cookie",S(n,o,i))},delete(n){delete r[n],t.append("Set-Cookie",S(n,"",{expires:new Date(0),path:"/"}))},getAll(){return{...r}}}}function Yc(){return{get(e){if(typeof document>"u")return;return P(document.cookie)[e]},set(e,t,a={}){if(typeof document>"u")return;document.cookie=S(e,t,a)},delete(e){if(typeof document>"u")return;document.cookie=S(e,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return P(document.cookie)}}}function Zc(){let e=typeof window<"u"&&typeof window.localStorage<"u";return{get(t){if(!e)return null;try{return window.localStorage.getItem(t)}catch{return null}},set(t,a){if(!e)return;try{window.localStorage.setItem(t,a)}catch{}},remove(t){if(!e)return;try{window.localStorage.removeItem(t)}catch{}},isAvailable(){return e}}}var v=new Map;function Ei(e,t){v.set(e,t)}function Qc(e){return v.get(e)}function Tg(e){return v.has(e)}function Lt(){v.clear()}function jt(){return Array.from(v.keys())}async function Bt(e,t="middleware"){let a=q.resolve(e,t);if(!F.existsSync(a))return;let r=F.readdirSync(a);for(let n of r){if(!n.endsWith(".ts")&&!n.endsWith(".js"))continue;if(n.includes(".test.")||n.includes(".spec."))continue;let o=n.replace(/\.(ts|js)$/,""),i=q.join(a,n);try{let s=(await import(i)).default;if(s&&typeof s.handler==="function")Ei(o,s);else if(typeof s==="function")Ei(o,{handler:s,mode:"universal"})}catch(c){console.warn(`Failed to load middleware '${o}' from ${i}:`,c)}}}function K(e){let t={};if(!e)return t;let a=new URLSearchParams(e);for(let[r,n]of a)t[r]=n;return t}function Ft(e,t,a,r=""){return{path:e,params:t,query:K(r),fullPath:r?`${e}?${r}`:e,meta:a}}function zt(e,t,a,r){let n=r?.isServer??typeof window>"u",o=!n,i=new Headers;return{to:e,from:t,isClient:o,isServer:n,cookies:n&&a?Jc(a,i):Yc(),storage:Zc(),state:{},request:a,responseHeaders:i}}async function Ht(e,t){let a=Array.isArray(e)?e:[e],r=t.isServer;for(let n of a){let o=Qc(n);if(!o)return console.error(`Route middleware '${n}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${n}' is not registered`}},state:t.state,responseHeaders:t.responseHeaders};if(o.mode==="server"&&!r)continue;try{let i=await o.handler(t);if(i){if(i.type==="redirect")return{passed:!1,redirect:i,state:t.state,responseHeaders:t.responseHeaders};if(i.type==="abort")return{passed:!1,abort:i,state:t.state,responseHeaders:t.responseHeaders}}}catch(i){return console.error(`Error in middleware '${n}':`,i),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:i instanceof Error?i.message:"Middleware error"}},state:t.state,responseHeaders:t.responseHeaders}}}return{passed:!0,state:t.state,responseHeaders:t.responseHeaders}}function Ks(e){let a=e.replace(/\\/g,"/").split("/").filter(Boolean),r=a.lastIndexOf("layouts"),n=r>=0?a[r+1]:a.at(-1);if(!n)return"app";return n.replace(/\.stx$/i,"")||"app"}function pt(e){let t=e.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),a=e.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),r=e.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),n=t?.[1]||r?.[1]||"";return{layout:n,group:a?.[1]||Ks(n)}}var A,C;function W(e){let t=[],a="log(",r=0;while(r<e.length){let n=e.indexOf("log(",r);if(n===-1){t.push(e.slice(r));break}let o=n>0?e[n-1]:" ",i=/\bfunction\s+$/.test(e.slice(Math.max(0,n-16),n));if(/[\w$.]/.test(o)||i){t.push(e.slice(r,n+4)),r=n+4;continue}t.push(e.slice(r,n));let c=1,s=n+4;while(s<e.length&&c>0){let l=e[s];if(l==='"'||l==="'"||l==="`"){let d=l;s++;while(s<e.length&&e[s]!==d){if(e[s]==="\\")s++;s++}s++;continue}if(l==="(")c++;else if(l===")")c--;s++}t.push("0"),r=s}return t.join("")}function U(e,t=!1){try{return new Bun.Transpiler(t?{loader:"js",minify:{whitespace:!0,identifiers:!0,syntax:!0}}:{loader:"js",minifyWhitespace:!0}).transformSync(e).replace(/\}(var |let |const |function )/g,"};$1").replace(/<\/script/gi,"<\\/script").trim()}catch{return e}}function H(){return`
|
|
5
5
|
;(function(){
|
|
6
6
|
'use strict';
|
|
7
7
|
var ROUTER_REV=8;
|
|
@@ -4216,4 +4216,4 @@ else {
|
|
|
4216
4216
|
|
|
4217
4217
|
if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',init);else init();
|
|
4218
4218
|
})();
|
|
4219
|
-
`}function
|
|
4219
|
+
`}function ft(){if(A)return A;return A=U(W(H()),!0),A}function $g(){if(C)return C;return C=U(H()),C}export{_i,Ci,Dt,Se,Tr,Vs,$r,Ws,qs,vg,xg,Sg,Rr,kg,_g,Cg,Eg,Jc,Yc,Zc,Ei,Qc,Tg,Lt,jt,Bt,Ft,zt,Ht,Ks,pt,ft,$g};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{createHash as g}from"crypto";import{readFile as b,stat as y}from"fs/promises";async function G(e){try{let t=await b(e);return g("sha256").update(t).digest("hex").slice(0,16)}catch{return""}}function l(e){return g("sha256").update(e).digest("hex").slice(0,16)}function m(e,t){let r=JSON.stringify(t,Object.keys(t).sort());return`${l(e)}-${l(r)}`}async function h(e){try{return(await y(e)).mtimeMs}catch{return 0}}async function
|
|
3
|
-
export{G,
|
|
2
|
+
import{createHash as g}from"crypto";import{readFile as b,stat as y}from"fs/promises";async function G(e){try{let t=await b(e);return g("sha256").update(t).digest("hex").slice(0,16)}catch{return""}}function l(e){return g("sha256").update(e).digest("hex").slice(0,16)}function m(e,t){let r=JSON.stringify(t,Object.keys(t).sort());return`${l(e)}-${l(r)}`}async function h(e){try{return(await y(e)).mtimeMs}catch{return 0}}async function U(e){try{return await y(e),!0}catch{return!1}}import{mkdir as v,readFile as A,writeFile as P,readdir as z,rm as k,stat as B}from"fs/promises";import{join as w,dirname as D}from"path";var c=new Map,d={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500};async function E(e){try{await v(e,{recursive:!0})}catch{}}function p(e,t,r){return w(e,r,`${t}.json`)}async function C(e,t,r){if((Date.now()-e.createdAt)/86400000>r)return!1;if(await h(t)!==e.srcMtime)return!1;return!0}async function Yr(e,t,r,a=d){if(!a.enabled)return null;let n=m(e,t),i=c.get(n);if(i){if(await C(i,e,a.maxAge))return i.lastAccessedAt=Date.now(),i.data;c.delete(n)}let o=p(a.directory,n,r);if(await U(o))try{let u=await A(o,"utf-8"),s=JSON.parse(u);if(await C(s,e,a.maxAge))return s.lastAccessedAt=Date.now(),c.set(n,s),s.data}catch{}return null}async function Zr(e,t,r,a,n=d){if(!n.enabled)return;let i=m(e,t),o=await G(e),u=await h(e),s={key:i,src:e,srcHash:o,srcMtime:u,optionsHash:m("",t),data:r,createdAt:Date.now(),lastAccessedAt:Date.now()};c.set(i,s);let f=p(n.directory,i,a);try{await E(D(f)),await P(f,JSON.stringify(s,null,2))}catch(x){console.warn(`[stx-media] Failed to write cache: ${x}`)}}async function Qr(e,t=d){if(e==="all")c.clear();else c.clear();let r=e==="all"?["image","video"]:[e];for(let a of r){let n=w(t.directory,a);try{await k(n,{recursive:!0,force:!0})}catch{}}}
|
|
3
|
+
export{G,U,Yr,Zr,Qr};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Pa,Rm,Mo,Am,pu,fu,Pm,Im}from"./chunk-6kt9wxja.js";import"./chunk-4f3456ht.js";import"./chunk-fs7tv867.js";import"./chunk-z92e297r.js";import"./chunk-115bb91s.js";import"./chunk-yv797v6e.js";import"./chunk-gydvy8a3.js";import"./chunk-n64zbwzr.js";import"./chunk-n6q1d66k.js";import"./chunk-e5md1cck.js";import"./chunk-b0jk94wx.js";import"./chunk-q0y8gv18.js";import"./chunk-rb2zbdqd.js";import"./chunk-qrk535j6.js";import"./chunk-gzc16hs8.js";import{_e,no}from"./chunk-9w6k311w.js";import"./chunk-ypyezjr0.js";import"./chunk-41z7f41b.js";import"./chunk-ac3e6nhg.js";import"./chunk-vk2jy6mn.js";import"./chunk-3b3mkgpj.js";import"./chunk-0jdz31q1.js";import"./chunk-x9036mfd.js";export{Pa as buildScriptVirtualFile,Rm as buildVirtualSource,_e as extractScriptBlocks,no as extractTemplateExpressions,pu as findRuntimeTypeDeclarations,fu as findStxModuleDeclarations,Im as formatTypecheckDiagnostics,Am as sourcePathFor,Pm as typecheckStxFiles,Mo as virtualPathFor};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{iy,lg,ct,Ic,ay,_s,Cs,Es}from"./chunk-7d2j41e3.js";import"./chunk-w8djc4qb.js";import"./chunk-0w578pgv.js";import"./chunk-xvprhdcb.js";import"./chunk-n64zbwzr.js";import"./chunk-9w6k311w.js";import"./chunk-ypyezjr0.js";import"./chunk-41z7f41b.js";import"./chunk-ac3e6nhg.js";import"./chunk-vk2jy6mn.js";import"./chunk-3b3mkgpj.js";import"./chunk-0jdz31q1.js";import"./chunk-x9036mfd.js";export{ay as clearOnceStore,Ic as onceStore,ct as partialsCache,_s as processIncludes,Cs as processStackPushDirectives,Es as processStackReplacements,iy as resetUnscopedSignalWarnings,lg as topLevelElements};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ye,z,Gt}from"./chunk-eyx92t9n.js";import{T}from"./chunk-2a5g80mq.js";import{Ct,Le,U,rt,je,Da,Lo,La,qn}from"./chunk-kx09v9ya.js";import{Nt,xe,dt}from"./chunk-eceeqy74.js";import{Qo}from"./chunk-s0mf56y1.js";import{Kn}from"./chunk-kbbbpae2.js";import{$e}from"./chunk-bqtj62ys.js";import Z from"fs";import P from"path";var{serve:ae}=globalThis.Bun;import O from"zlib";import{promisify as Y}from"util";var K=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],ee=["text/event-stream","multipart/x-mixed-replace"],te=1024;function ne(t){if(!t)return!1;let e=t.toLowerCase();if(ee.some((a)=>e.startsWith(a)))return!1;return K.some((a)=>e.startsWith(a))}function re(t){let e=new Map;for(let a of t.split(",")){let[r,...i]=a.trim().split(";"),f=r.trim().toLowerCase();if(!f)continue;let h=1;for(let g of i){let l=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(g);if(!l)continue;let m=Number.parseFloat(l[1]);if(Number.isFinite(m))h=m}e.set(f,h)}return e}function se(t){if(!t)return null;let e=re(t),a=e.get("*"),r=(i)=>e.get(i)??a??0;if(r("br")>0)return"br";if(r("gzip")>0)return"gzip";return null}var J=33554432,V=new Map,D=0;function oe(t,e){if(e.length>J/8)return;V.set(t,e),D+=e.length;for(let[a,r]of V){if(D<=J)break;V.delete(a),D-=r.length}}async function Hn(t,e,a={}){if(e.headers.get("content-encoding"))return e;if(e.status===204||e.status===304||!e.body)return e;if(!ne(e.headers.get("content-type")))return e;let r=se(t.headers.get("accept-encoding"));if(!r)return e;let i;try{i=new Uint8Array(await e.arrayBuffer())}catch{return e}let f=()=>new Response(i,{status:e.status,statusText:e.statusText,headers:Q(e.headers)});if(i.length<(a.threshold??te))return f();try{let h=a.quality??5,g=`${r}:${h}:${i.length}:${Bun.hash(i)}`,l=V.get(g);if(!l)l=r==="br"?await Y(O.brotliCompress)(i,{params:{[O.constants.BROTLI_PARAM_QUALITY]:h,[O.constants.BROTLI_PARAM_SIZE_HINT]:i.length}}):await Y(O.gzip)(i),oe(g,l);if(l.length>=i.length)return f();let m=Q(e.headers);return m.set("Content-Encoding",r),m.set("Content-Length",String(l.length)),new Response(l,{status:e.status,statusText:e.statusText,headers:m})}catch{return f()}}function Q(t){let e=new Headers(t),a=e.get("Vary");if(!a)return e.set("Vary","Accept-Encoding"),e;if(!a.split(",").some((i)=>i.trim().toLowerCase()==="accept-encoding"))e.set("Vary",`${a}, Accept-Encoding`);return e}class G{now;entries=new T(1000,{maxBytes:33554432,sizeOf:(t)=>t.body.byteLength+JSON.stringify(t.headers).length*2});pending=new Map;generation=0;constructor(t=Date.now){this.now=t}invalidate(t){this.generation++,this.pending.clear();for(let e of Array.from(this.entries.keys()))if(t===void 0||this.entries.get(e)?.path===t)this.entries.delete(e)}async respond(t,e,a){let r,i=async()=>{let s=r??await a();return s.headers.set("Cache-Control","private, no-store"),s.headers.set("Vary",U(s.headers.get("Vary")).Vary),s};if(!e||t.method!=="GET"||t.headers.has("Cookie")||t.headers.has("Authorization")||t.headers.has("Range"))return i();let f=new URL(t.url),h=`${f.origin}${f.pathname}${f.search}|${Le(t)?"fragment":"document"}`,g=this.entries.get(h),l=(s)=>{let b=new Headers(s.headers);return b.set("Cache-Control","private, no-store"),b.set("Age",String(Math.max(0,Math.floor((this.now()-s.created)/1000)))),new Response(s.body.slice(0),{headers:b})},m=g?(this.now()-g.created)/1000:1/0;if(g&&m<e.maxAge)return l(g);let v=this.generation,_=async()=>{let s=await a();r=s;let b=(s.headers.get("Vary")??"").toLowerCase().split(",").map((y)=>y.trim()).filter(Boolean);if(s.status!==200||s.headers.has("Set-Cookie")||/(?:private|no-store|no-cache)/i.test(s.headers.get("Cache-Control")??"")||b.some((y)=>y!=="x-stx-router"&&y!=="accept-encoding"))return null;let E=await s.clone().arrayBuffer();if(E.byteLength>1048576)return null;s.headers.set("Vary",U(s.headers.get("Vary")).Vary);let n={body:E,headers:Array.from(s.headers.entries()),created:this.now(),path:f.pathname};if(this.generation===v)this.entries.set(h,n);return n},x=this.pending.get(h);if(!x){if(this.pending.size>=1000)return i();x=_().finally(()=>{if(this.pending.get(h)===x)this.pending.delete(h)}),this.pending.set(h,x)}if(g&&m<e.maxAge+(e.swr??0))return x.catch(()=>{}),l(g);let M=await x;return M?l(M):i()}}var ie={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".json":"application/json",".html":"text/html",".txt":"text/plain",".xml":"application/xml",".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".svg":"image/svg+xml",".ico":"image/x-icon",".bmp":"image/bmp",".mp4":"video/mp4",".webm":"video/webm",".ogg":"audio/ogg",".mp3":"audio/mpeg",".wav":"audio/wav",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"};async function Cm(t={}){let e=P.resolve(t.outputDir||".output"),a=t.port??3000,r=Da(e);if(!r)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${r.routes.length} routes...`);let i=Kn(r.routeRules),f=new G,h=Qo(e,r.apiRoutes??[]),g=Bun.file(P.join(e,"server/runtime-config.json")),l=t.runtimeConfig??(await g.exists()?await g.json():void 0),m=l?z(l):void 0,v=new Map,_=new Map,x=new Map,M=new Map;for(let n of r.routes)try{let y=P.join(e,n.compiledPath),c=JSON.parse(await Bun.file(y).text());if(m)c.html=Gt(c.html,m);v.set(n.pattern,c),x.set(n.pattern,dt(c.html)),M.set(n.pattern,$e(c.html));let j=P.join(e,n.fragmentPath);if(rt(c.html,r.routerContainer||"main")&&await Bun.file(j).exists()){let A=await Bun.file(j).text();_.set(n.pattern,m?Gt(A,m):A)}}catch(y){console.warn(`[stx] Failed to load route ${n.pattern}:`,y)}let s=new Map,b=[];for(let n of r.routes)if(n.hasParams){let{regex:y,params:c}=xe(n.pattern,{page:!0});b.push({regex:y,route:n,paramNames:c})}else s.set(n.pattern,n);let E=ae({port:a,async fetch(n){return Hn(n,await Ye(m??z(),async()=>{let c=new URL(n.url).pathname;if(t.onRequest){let p=await t.onRequest(n);if(p)return p}if(t.apiRouter){let p=await t.apiRouter.handleRequest(n);if(p.status!==404)return p}if(t.apiRoutes?.[c])return t.apiRoutes[c](n);let j=await h(n);if(j)return j;if((n.method==="GET"||n.method==="HEAD")&&c!=="/"){let p=P.resolve(e,"public"),d;try{d=decodeURIComponent(c)}catch{d=c}if(!d.includes("\x00")){let u=P.resolve(p,`.${d}`);if(u===p||u.startsWith(`${p}${P.sep}`))try{if(Z.existsSync(u)&&Z.statSync(u).isFile()){let R=P.extname(u).toLowerCase(),B=ie[R]||"application/octet-stream",X=c.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(c);return new Response(Bun.file(u),{headers:{"Content-Type":B,"Cache-Control":X?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let A=Le(n),C=null,q={};if(C=s.get(c)||null,!C)for(let{regex:p,route:d,paramNames:u}of b){let o=c.match(p);if(o){C=d,u.forEach((R,B)=>{q[R]=o[B+1]});break}}if(!C){let p=Nt(c)?null:s.get("/404")||null;if(p){let d=v.get(p.pattern);if(d)return new Response(d.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}})}let N=i(c),W=Object.keys(N).length>0;return f.respond(n,N.cache,async()=>{let p=v.get(C.pattern);if(A&&n.method==="GET"&&p&&!p.hasServerScripts&&Object.keys(p.placeholders).length===0){let o=_.get(C.pattern);if(o){let R=x.get(C.pattern);return new Response(o,{status:p.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...M.has(C.pattern)?{"X-STX-Runtime":M.get(C.pattern)?"true":"false"}:{},...R?{"X-STX-Layout":R.layout,"X-STX-Layout-Group":R.group}:{},...U(),...N.cache?{}:{"Cache-Control":Ct}}})}}let d=Lo(n.method),u=v.get(C.pattern);if(!u){let o=s.get("/500")||null;if(o){let R=v.get(o.pattern);if(R)return new Response(R.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(C.prerendered&&d)return new Response("Prerendered pages do not accept actions",{status:405,headers:{Allow:"GET, HEAD"}});if(!d&&!u.hasServerScripts&&Object.keys(u.placeholders).length===0)return new Response(u.html,{status:u.status??200,headers:{"Content-Type":"text/html",...U(),"Cache-Control":"public, max-age=60"}});try{let{html:o,boundaries:R,redirect:B,cookies:X,status:H,headers:F}=await qn(u,{params:q,request:n,method:n.method,__stx_strict_hydration:W,__stx_runtime_config:m});if(B)return La(B,X,F);if(R&&R.length>0){let{renderStreamingPage:S,streamToResponse:I}=await import("./chunk-0g9cceht.js"),L=new Headers({...U(),...F,"Cache-Control":"private, no-store"});for(let k of X??[])L.append("Set-Cookie",k);if(A&&!d&&rt(o,r.routerContainer||"main")){let k=dt(o);L.set("X-STX-Fragment","true"),L.set("X-STX-Runtime",$e(o)?"true":"false"),L.set("X-STX-Layout",k.layout),L.set("X-STX-Layout-Group",k.group)}return I(S(A&&!d&&rt(o,r.routerContainer||"main")?je(o,r.routerContainer||"main",!0):o,R,{timeoutMs:30000}),{status:H??u.status??200,headers:L})}let w=new Headers({"Content-Type":"text/html",...U(),...N.cache?{}:{"Cache-Control":"private, no-store"}});for(let S of X??[])w.append("Set-Cookie",S);for(let[S,I]of Object.entries(F??{}))w.set(S,I);if(w.set("Vary",U(w.get("Vary")).Vary),A&&!d&&rt(o,r.routerContainer||"main")){let S=dt(o);return w.set("X-STX-Fragment","true"),w.set("X-STX-Runtime",$e(o)?"true":"false"),w.set("X-STX-Layout",S.layout),w.set("X-STX-Layout-Group",S.group),new Response(je(o,r.routerContainer||"main",!0),{status:H??u.status??200,headers:w})}return new Response(o,{status:H??u.status??200,headers:w})}catch(o){if(console.error(`[stx] Hydration error for ${c}:`,o),W)return new Response("Internal Server Error",{status:500});return new Response(u.html,{headers:{"Content-Type":"text/html"}})}})}))}});return console.log(`[stx] Production server running at http://localhost:${E.port}`),console.log(`[stx] Serving ${r.routes.length} routes (${v.size} pre-loaded)`),{port:E.port,stop:()=>{f.invalidate(),E.stop()},invalidate:(n)=>f.invalidate(n)}}
|
|
3
|
-
export{
|
|
2
|
+
import{Ze,z,Jt}from"./chunk-41z7f41b.js";import{T}from"./chunk-0jdz31q1.js";import{Tt,je,V,st,Be,Da,Lo,La,Kn}from"./chunk-70paeznz.js";import{Dt,Se,pt}from"./chunk-gzc16hs8.js";import{Qo}from"./chunk-z92e297r.js";import{Gn}from"./chunk-nq60tjkz.js";import{Re}from"./chunk-gydvy8a3.js";import Z from"fs";import P from"path";var{serve:ae}=globalThis.Bun;import O from"zlib";import{promisify as Y}from"util";var K=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],ee=["text/event-stream","multipart/x-mixed-replace"],te=1024;function ne(t){if(!t)return!1;let e=t.toLowerCase();if(ee.some((a)=>e.startsWith(a)))return!1;return K.some((a)=>e.startsWith(a))}function re(t){let e=new Map;for(let a of t.split(",")){let[r,...i]=a.trim().split(";"),f=r.trim().toLowerCase();if(!f)continue;let h=1;for(let g of i){let l=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(g);if(!l)continue;let m=Number.parseFloat(l[1]);if(Number.isFinite(m))h=m}e.set(f,h)}return e}function se(t){if(!t)return null;let e=re(t),a=e.get("*"),r=(i)=>e.get(i)??a??0;if(r("br")>0)return"br";if(r("gzip")>0)return"gzip";return null}var J=33554432,H=new Map,U=0;function oe(t,e){if(e.length>J/8)return;H.set(t,e),U+=e.length;for(let[a,r]of H){if(U<=J)break;H.delete(a),U-=r.length}}async function Un(t,e,a={}){if(e.headers.get("content-encoding"))return e;if(e.status===204||e.status===304||!e.body)return e;if(!ne(e.headers.get("content-type")))return e;let r=se(t.headers.get("accept-encoding"));if(!r)return e;let i;try{i=new Uint8Array(await e.arrayBuffer())}catch{return e}let f=()=>new Response(i,{status:e.status,statusText:e.statusText,headers:Q(e.headers)});if(i.length<(a.threshold??te))return f();try{let h=a.quality??5,g=`${r}:${h}:${i.length}:${Bun.hash(i)}`,l=H.get(g);if(!l)l=r==="br"?await Y(O.brotliCompress)(i,{params:{[O.constants.BROTLI_PARAM_QUALITY]:h,[O.constants.BROTLI_PARAM_SIZE_HINT]:i.length}}):await Y(O.gzip)(i),oe(g,l);if(l.length>=i.length)return f();let m=Q(e.headers);return m.set("Content-Encoding",r),m.set("Content-Length",String(l.length)),new Response(l,{status:e.status,statusText:e.statusText,headers:m})}catch{return f()}}function Q(t){let e=new Headers(t),a=e.get("Vary");if(!a)return e.set("Vary","Accept-Encoding"),e;if(!a.split(",").some((i)=>i.trim().toLowerCase()==="accept-encoding"))e.set("Vary",`${a}, Accept-Encoding`);return e}class G{now;entries=new T(1000,{maxBytes:33554432,sizeOf:(t)=>t.body.byteLength+JSON.stringify(t.headers).length*2});pending=new Map;generation=0;constructor(t=Date.now){this.now=t}invalidate(t){this.generation++,this.pending.clear();for(let e of Array.from(this.entries.keys()))if(t===void 0||this.entries.get(e)?.path===t)this.entries.delete(e)}async respond(t,e,a){let r,i=async()=>{let s=r??await a();return s.headers.set("Cache-Control","private, no-store"),s.headers.set("Vary",V(s.headers.get("Vary")).Vary),s};if(!e||t.method!=="GET"||t.headers.has("Cookie")||t.headers.has("Authorization")||t.headers.has("Range"))return i();let f=new URL(t.url),h=`${f.origin}${f.pathname}${f.search}|${je(t)?"fragment":"document"}`,g=this.entries.get(h),l=(s)=>{let b=new Headers(s.headers);return b.set("Cache-Control","private, no-store"),b.set("Age",String(Math.max(0,Math.floor((this.now()-s.created)/1000)))),new Response(s.body.slice(0),{headers:b})},m=g?(this.now()-g.created)/1000:1/0;if(g&&m<e.maxAge)return l(g);let v=this.generation,_=async()=>{let s=await a();r=s;let b=(s.headers.get("Vary")??"").toLowerCase().split(",").map((y)=>y.trim()).filter(Boolean);if(s.status!==200||s.headers.has("Set-Cookie")||/(?:private|no-store|no-cache)/i.test(s.headers.get("Cache-Control")??"")||b.some((y)=>y!=="x-stx-router"&&y!=="accept-encoding"))return null;let E=await s.clone().arrayBuffer();if(E.byteLength>1048576)return null;s.headers.set("Vary",V(s.headers.get("Vary")).Vary);let n={body:E,headers:Array.from(s.headers.entries()),created:this.now(),path:f.pathname};if(this.generation===v)this.entries.set(h,n);return n},x=this.pending.get(h);if(!x){if(this.pending.size>=1000)return i();x=_().finally(()=>{if(this.pending.get(h)===x)this.pending.delete(h)}),this.pending.set(h,x)}if(g&&m<e.maxAge+(e.swr??0))return x.catch(()=>{}),l(g);let M=await x;return M?l(M):i()}}var ie={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".json":"application/json",".html":"text/html",".txt":"text/plain",".xml":"application/xml",".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".svg":"image/svg+xml",".ico":"image/x-icon",".bmp":"image/bmp",".mp4":"video/mp4",".webm":"video/webm",".ogg":"audio/ogg",".mp3":"audio/mpeg",".wav":"audio/wav",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"};async function Cm(t={}){let e=P.resolve(t.outputDir||".output"),a=t.port??3000,r=Da(e);if(!r)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${r.routes.length} routes...`);let i=Gn(r.routeRules),f=new G,h=Qo(e,r.apiRoutes??[]),g=Bun.file(P.join(e,"server/runtime-config.json")),l=t.runtimeConfig??(await g.exists()?await g.json():void 0),m=l?z(l):void 0,v=new Map,_=new Map,x=new Map,M=new Map;for(let n of r.routes)try{let y=P.join(e,n.compiledPath),c=JSON.parse(await Bun.file(y).text());if(m)c.html=Jt(c.html,m);v.set(n.pattern,c),x.set(n.pattern,pt(c.html)),M.set(n.pattern,Re(c.html));let j=P.join(e,n.fragmentPath);if(st(c.html,r.routerContainer||"main")&&await Bun.file(j).exists()){let A=await Bun.file(j).text();_.set(n.pattern,m?Jt(A,m):A)}}catch(y){console.warn(`[stx] Failed to load route ${n.pattern}:`,y)}let s=new Map,b=[];for(let n of r.routes)if(n.hasParams){let{regex:y,params:c}=Se(n.pattern,{page:!0});b.push({regex:y,route:n,paramNames:c})}else s.set(n.pattern,n);let E=ae({port:a,async fetch(n){return Un(n,await Ze(m??z(),async()=>{let c=new URL(n.url).pathname;if(t.onRequest){let p=await t.onRequest(n);if(p)return p}if(t.apiRouter){let p=await t.apiRouter.handleRequest(n);if(p.status!==404)return p}if(t.apiRoutes?.[c])return t.apiRoutes[c](n);let j=await h(n);if(j)return j;if((n.method==="GET"||n.method==="HEAD")&&c!=="/"){let p=P.resolve(e,"public"),d;try{d=decodeURIComponent(c)}catch{d=c}if(!d.includes("\x00")){let u=P.resolve(p,`.${d}`);if(u===p||u.startsWith(`${p}${P.sep}`))try{if(Z.existsSync(u)&&Z.statSync(u).isFile()){let R=P.extname(u).toLowerCase(),B=ie[R]||"application/octet-stream",X=c.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(c);return new Response(Bun.file(u),{headers:{"Content-Type":B,"Cache-Control":X?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let A=je(n),C=null,q={};if(C=s.get(c)||null,!C)for(let{regex:p,route:d,paramNames:u}of b){let o=c.match(p);if(o){C=d,u.forEach((R,B)=>{q[R]=o[B+1]});break}}if(!C){let p=Dt(c)?null:s.get("/404")||null;if(p){let d=v.get(p.pattern);if(d)return new Response(d.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}})}let N=i(c),W=Object.keys(N).length>0;return f.respond(n,N.cache,async()=>{let p=v.get(C.pattern);if(A&&n.method==="GET"&&p&&!p.hasServerScripts&&Object.keys(p.placeholders).length===0){let o=_.get(C.pattern);if(o){let R=x.get(C.pattern);return new Response(o,{status:p.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...M.has(C.pattern)?{"X-STX-Runtime":M.get(C.pattern)?"true":"false"}:{},...R?{"X-STX-Layout":R.layout,"X-STX-Layout-Group":R.group}:{},...V(),...N.cache?{}:{"Cache-Control":Tt}}})}}let d=Lo(n.method),u=v.get(C.pattern);if(!u){let o=s.get("/500")||null;if(o){let R=v.get(o.pattern);if(R)return new Response(R.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(C.prerendered&&d)return new Response("Prerendered pages do not accept actions",{status:405,headers:{Allow:"GET, HEAD"}});if(!d&&!u.hasServerScripts&&Object.keys(u.placeholders).length===0)return new Response(u.html,{status:u.status??200,headers:{"Content-Type":"text/html",...V(),"Cache-Control":"public, max-age=60"}});try{let{html:o,boundaries:R,redirect:B,cookies:X,status:F,headers:I}=await Kn(u,{params:q,request:n,method:n.method,__stx_strict_hydration:W,__stx_runtime_config:m});if(B)return La(B,X,I);if(R&&R.length>0){let{renderStreamingPage:S,streamToResponse:D}=await import("./chunk-kh3sxa3j.js"),L=new Headers({...V(),...I,"Cache-Control":"private, no-store"});for(let k of X??[])L.append("Set-Cookie",k);if(A&&!d&&st(o,r.routerContainer||"main")){let k=pt(o);L.set("X-STX-Fragment","true"),L.set("X-STX-Runtime",Re(o)?"true":"false"),L.set("X-STX-Layout",k.layout),L.set("X-STX-Layout-Group",k.group)}return D(S(A&&!d&&st(o,r.routerContainer||"main")?Be(o,r.routerContainer||"main",!0):o,R,{timeoutMs:30000}),{status:F??u.status??200,headers:L})}let w=new Headers({"Content-Type":"text/html",...V(),...N.cache?{}:{"Cache-Control":"private, no-store"}});for(let S of X??[])w.append("Set-Cookie",S);for(let[S,D]of Object.entries(I??{}))w.set(S,D);if(w.set("Vary",V(w.get("Vary")).Vary),A&&!d&&st(o,r.routerContainer||"main")){let S=pt(o);return w.set("X-STX-Fragment","true"),w.set("X-STX-Runtime",Re(o)?"true":"false"),w.set("X-STX-Layout",S.layout),w.set("X-STX-Layout-Group",S.group),new Response(Be(o,r.routerContainer||"main",!0),{status:F??u.status??200,headers:w})}return new Response(o,{status:F??u.status??200,headers:w})}catch(o){if(console.error(`[stx] Hydration error for ${c}:`,o),W)return new Response("Internal Server Error",{status:500});return new Response(u.html,{headers:{"Content-Type":"text/html"}})}})}))}});return console.log(`[stx] Production server running at http://localhost:${E.port}`),console.log(`[stx] Serving ${r.routes.length} routes (${v.size} pre-loaded)`),{port:E.port,stop:()=>{f.invalidate(),E.stop()},invalidate:(n)=>f.invalidate(n)}}
|
|
3
|
+
export{Un,Cm};
|