@stacksjs/stx 0.2.759 → 0.2.761
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-00nz3pas.js +2 -0
- package/dist/{chunk-3nxe5xmy.js → chunk-0fs9kx0h.js} +3 -3
- package/dist/{chunk-42hcspws.js → chunk-0kq0k4pg.js} +2 -2
- package/dist/chunk-0nynnmya.js +2 -0
- package/dist/{chunk-wp9y6x33.js → chunk-0q5dm9r2.js} +5 -5
- package/dist/{chunk-f4gqzg1y.js → chunk-0wj31pqy.js} +2 -2
- package/dist/chunk-13v3vgb6.js +2 -0
- package/dist/chunk-18gazs55.js +2 -0
- package/dist/chunk-1a9h6r9f.js +2 -0
- package/dist/chunk-1p8t2ekg.js +2 -0
- package/dist/chunk-1rcntvgx.js +2 -0
- package/dist/chunk-1w5gtkd6.js +2 -0
- package/dist/{chunk-fpagqrd1.js → chunk-23t9anc0.js} +75 -75
- package/dist/chunk-298gj90a.js +2 -0
- package/dist/{chunk-m5fjhrpd.js → chunk-2cbd1ew6.js} +101 -101
- package/dist/{chunk-h692k9xn.js → chunk-2typf9dh.js} +4 -4
- package/dist/chunk-2wnfqrv5.js +26 -0
- package/dist/chunk-2wq0h5ye.js +2 -0
- package/dist/{chunk-prej5pk6.js → chunk-2zd51tj4.js} +2 -2
- package/dist/chunk-2zg3jmy7.js +2 -0
- package/dist/{chunk-ztdjdxjt.js → chunk-319aez2f.js} +3 -3
- package/dist/{chunk-7g9vd5fv.js → chunk-37y8sg48.js} +2 -2
- package/dist/{chunk-j2mpqa4p.js → chunk-3csfmhg0.js} +2 -2
- package/dist/{chunk-jb1dk0w7.js → chunk-3mz088mb.js} +2 -2
- package/dist/chunk-3wxb7mfb.js +2 -0
- package/dist/{chunk-cehjp06v.js → chunk-42zqmcnc.js} +3 -3
- package/dist/{chunk-5ge5h2y3.js → chunk-45g1w1ct.js} +5 -5
- package/dist/{chunk-89h4snzd.js → chunk-4833k99b.js} +2 -2
- package/dist/{chunk-jevd16gq.js → chunk-48g9wez2.js} +30 -30
- package/dist/{chunk-t5gabs4x.js → chunk-4c0qcjac.js} +2 -2
- package/dist/{chunk-hmae7ha6.js → chunk-4rxmxc1p.js} +2 -2
- package/dist/chunk-4tgn1frg.js +3 -0
- package/dist/chunk-5fg8hqq0.js +2 -0
- package/dist/chunk-5x0g7e9y.js +2 -0
- package/dist/{chunk-83ezv8yz.js → chunk-5yhv5eqq.js} +3 -3
- package/dist/{chunk-6n195hvc.js → chunk-61qh74q1.js} +5 -5
- package/dist/chunk-64pdwfef.js +177 -0
- package/dist/{chunk-mcynmrbe.js → chunk-6fz2n9w6.js} +43 -43
- package/dist/chunk-72ns4q88.js +2 -0
- package/dist/chunk-7fwcnech.js +2 -0
- package/dist/{chunk-x9haxcsj.js → chunk-7y1rpd4g.js} +8 -8
- package/dist/chunk-7z2mebp5.js +2 -0
- package/dist/chunk-803qm5tk.js +2 -0
- package/dist/chunk-86cg9qqm.js +2 -0
- package/dist/{chunk-gs6wc7sr.js → chunk-89801pjp.js} +5 -5
- package/dist/chunk-8h5mqs28.js +2 -0
- package/dist/chunk-8jh2b5k2.js +2 -0
- package/dist/{chunk-yp6w740k.js → chunk-8rk79ha1.js} +2 -2
- package/dist/{chunk-2x112fxs.js → chunk-8vs5y4h7.js} +14 -14
- package/dist/{chunk-kpr09x3g.js → chunk-8y54tpbr.js} +7 -7
- package/dist/{chunk-s4y26fk6.js → chunk-8yyq3nfg.js} +2 -2
- package/dist/chunk-927ta2dn.js +2 -0
- package/dist/chunk-940wny2b.js +2 -0
- package/dist/{chunk-93j4atq9.js → chunk-98t1cv8x.js} +2 -2
- package/dist/{chunk-sgm6tg8h.js → chunk-9k8ztdcc.js} +2 -2
- package/dist/{chunk-4npabwne.js → chunk-9nhyq39s.js} +3 -3
- package/dist/{chunk-gz38jt5j.js → chunk-aa1y9j3p.js} +2 -2
- package/dist/chunk-ad9dt9rk.js +2 -0
- package/dist/chunk-ak4w2emd.js +2 -0
- package/dist/{chunk-tb56j1zt.js → chunk-ak93e1zz.js} +5 -5
- package/dist/{chunk-jt28zh50.js → chunk-b0z2n941.js} +2 -2
- package/dist/{chunk-qwds327k.js → chunk-b51p56k5.js} +2 -2
- package/dist/{chunk-r4sawwmp.js → chunk-b7x8b83z.js} +1 -1
- package/dist/chunk-b8dtz3v8.js +2 -0
- package/dist/{chunk-0e9xdrzx.js → chunk-bjhesw78.js} +8 -8
- package/dist/{chunk-w8p1y4c0.js → chunk-bvctccab.js} +4 -4
- package/dist/chunk-c5tkxjb0.js +2 -0
- package/dist/{chunk-hk98vptc.js → chunk-cdcrd33m.js} +2 -2
- package/dist/chunk-cgh0k52q.js +2 -0
- package/dist/chunk-ctdw7fh4.js +2 -0
- package/dist/{chunk-asp7ett1.js → chunk-dnsf934e.js} +9 -9
- package/dist/{chunk-7r7j7vwt.js → chunk-ds6mbfdq.js} +3 -3
- package/dist/chunk-e2q79dfs.js +2 -0
- package/dist/chunk-e5vn76f5.js +2 -0
- package/dist/{chunk-9s1qnf90.js → chunk-eb6p3p62.js} +2 -2
- package/dist/chunk-emhbj3xd.js +2 -0
- package/dist/{chunk-3cn9y08d.js → chunk-evxp3wmv.js} +7 -7
- package/dist/{chunk-z8k3fx4r.js → chunk-f8p8ggvw.js} +4 -4
- package/dist/chunk-fjfrgef4.js +2 -0
- package/dist/chunk-fke4s0kk.js +33 -0
- package/dist/{chunk-0dkd26t4.js → chunk-frybxj35.js} +7 -7
- package/dist/{chunk-4s9kytdz.js → chunk-fxmc5006.js} +2 -2
- package/dist/chunk-fxnk5ee8.js +2 -0
- package/dist/chunk-fys1patf.js +2 -0
- package/dist/{chunk-6ts3sthp.js → chunk-g4k0svq6.js} +2 -2
- package/dist/chunk-g9efdc5v.js +2 -0
- package/dist/chunk-gpvfswgj.js +2 -0
- package/dist/chunk-hnen9b45.js +2 -0
- package/dist/chunk-jacb7aw1.js +2 -0
- package/dist/{chunk-4zw118tn.js → chunk-jgk5j35w.js} +4 -4
- package/dist/{chunk-geb6zyxg.js → chunk-jn78c13y.js} +13 -13
- package/dist/chunk-jq1698j4.js +2 -0
- package/dist/{chunk-pwmkhs7z.js → chunk-jyp2mmts.js} +2 -2
- package/dist/{chunk-76fcwbe1.js → chunk-jzajpmke.js} +7 -7
- package/dist/chunk-k0jkpw0q.js +2 -0
- package/dist/{chunk-3kfbs0mw.js → chunk-k2ex94n8.js} +1 -1
- package/dist/{chunk-m00c7sh0.js → chunk-k9247v28.js} +1 -1
- package/dist/chunk-kdqnest3.js +2 -0
- package/dist/{chunk-1mfj2j5g.js → chunk-kj9m0vc6.js} +3 -3
- package/dist/chunk-krsg6dgz.js +3 -0
- package/dist/chunk-m5740sd3.js +2 -0
- package/dist/{chunk-myynywry.js → chunk-mdvtermb.js} +2 -2
- package/dist/chunk-mebf9vwb.js +2 -0
- package/dist/chunk-nm2r4se1.js +2 -0
- package/dist/chunk-p2j38381.js +2 -0
- package/dist/{chunk-3ajnrfa2.js → chunk-p88yh4wt.js} +2 -2
- package/dist/{chunk-fjxhga6w.js → chunk-pqbxa0r7.js} +2 -2
- package/dist/chunk-q245q8z1.js +2 -0
- package/dist/{chunk-5q9ss7ty.js → chunk-q3azy64b.js} +4 -4
- package/dist/chunk-qm3jbse5.js +2 -0
- package/dist/{chunk-yftw25sa.js → chunk-qx0np0hy.js} +2 -2
- package/dist/{chunk-qwsgc5rc.js → chunk-qystt1qc.js} +1 -1
- package/dist/{chunk-v20cwjgz.js → chunk-qyzjkvme.js} +6 -6
- package/dist/chunk-r13fwtas.js +2 -0
- package/dist/{chunk-dh9aagwm.js → chunk-r1tp2gnr.js} +1 -1
- package/dist/chunk-r5tsewzd.js +2 -0
- package/dist/{chunk-v2egd4zh.js → chunk-r6yb0540.js} +5 -5
- package/dist/{chunk-pes27snj.js → chunk-r8zhed35.js} +3 -3
- package/dist/{chunk-hmydy949.js → chunk-rh2qth8r.js} +5 -5
- package/dist/chunk-rha8sv1h.js +3 -0
- package/dist/{chunk-vh1d5eqk.js → chunk-t2cq4bpe.js} +6 -6
- package/dist/chunk-tfy1m821.js +2 -0
- package/dist/{chunk-465resq9.js → chunk-tpfxvw4q.js} +17 -17
- package/dist/{chunk-t6qn1374.js → chunk-tshpcvcy.js} +2 -2
- package/dist/{chunk-spjpdymh.js → chunk-ttqs99jj.js} +2 -2
- package/dist/chunk-v1ff2dfp.js +7 -0
- package/dist/chunk-vc3ppphz.js +2 -0
- package/dist/{chunk-x1q2ape8.js → chunk-vv8dn70r.js} +14 -14
- package/dist/{chunk-06zn167b.js → chunk-vvs28yqw.js} +8 -8
- package/dist/chunk-w2pch5xn.js +4 -0
- package/dist/chunk-w512gnft.js +2 -0
- package/dist/{chunk-j4snweyz.js → chunk-wby7qzha.js} +3 -3
- package/dist/{chunk-b6g24qj0.js → chunk-wghtdgwj.js} +2 -2
- package/dist/chunk-wk8y89q2.js +25 -0
- package/dist/{chunk-19safa6y.js → chunk-wmnzapn8.js} +2 -2
- package/dist/chunk-wmxsaxt0.js +2 -0
- package/dist/chunk-wq1vs94k.js +2 -0
- package/dist/chunk-wwnqbv9j.js +3 -0
- package/dist/{chunk-a5d888es.js → chunk-wycrtkw4.js} +6 -6
- package/dist/chunk-x1q7b7jg.js +2 -0
- package/dist/chunk-x1x69g3s.js +2 -0
- package/dist/{chunk-gs373714.js → chunk-x5seqmrv.js} +2 -2
- package/dist/{chunk-r5jytt0f.js → chunk-x7q4tp3f.js} +4 -4
- package/dist/{chunk-bsq9zg9j.js → chunk-xt034729.js} +6 -6
- package/dist/chunk-y5emxzbt.js +2 -0
- package/dist/chunk-y6mqq78g.js +2 -0
- package/dist/{chunk-11kejz35.js → chunk-yh5658q8.js} +1 -1
- package/dist/chunk-yhbsvf65.js +54 -0
- package/dist/{chunk-00ns0516.js → chunk-yjzk7rwt.js} +6 -6
- package/dist/chunk-yn3kff5k.js +2 -0
- package/dist/chunk-ynjm2tm0.js +2 -0
- package/dist/chunk-yp80rx17.js +2 -0
- package/dist/chunk-z5xermzg.js +2 -0
- package/dist/{chunk-j04v4rgf.js → chunk-zhrz4zvw.js} +5 -5
- package/dist/cli.js +20 -20
- package/dist/composable-loader.d.ts +1 -1
- package/dist/composable-loader.js +47 -10
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/message-catalogs.d.ts +39 -0
- package/dist/message-catalogs.js +128 -0
- package/dist/native/compiler/bundle.js +11 -36
- package/dist/native/compiler/html-to-ir.js +32 -0
- package/dist/native/compiler/render-screen.js +1 -1
- package/dist/native/compiler/setup-script.d.ts +1 -0
- package/dist/native/compiler/shared-scripts.js +10 -0
- package/dist/native/runtime/compact-document.d.ts +20 -0
- package/dist/native/runtime/compact-document.js +101 -0
- package/dist/process.d.ts +1 -1
- package/dist/process.js +87 -22
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +14 -14
- package/dist/store-loader.d.ts +27 -3
- package/dist/store-loader.js +144 -4
- package/dist/types/config-types.d.ts +1 -0
- package/package.json +5 -5
- package/dist/chunk-055v5qz2.js +0 -2
- package/dist/chunk-0b7f2mby.js +0 -2
- package/dist/chunk-0j7e56zm.js +0 -2
- package/dist/chunk-0jn79fkt.js +0 -25
- package/dist/chunk-0y44f9rk.js +0 -2
- package/dist/chunk-3h2yz805.js +0 -2
- package/dist/chunk-3jfes9b0.js +0 -2
- package/dist/chunk-4m8bexrn.js +0 -33
- package/dist/chunk-4tz00fkp.js +0 -2
- package/dist/chunk-52q8184e.js +0 -2
- package/dist/chunk-59ytzyp1.js +0 -2
- package/dist/chunk-5ffdtfwg.js +0 -2
- package/dist/chunk-5q551m4w.js +0 -2
- package/dist/chunk-6ndeycxk.js +0 -2
- package/dist/chunk-6xt3kvq1.js +0 -2
- package/dist/chunk-75r09rqt.js +0 -2
- package/dist/chunk-79y41h1d.js +0 -2
- package/dist/chunk-7h5d35bf.js +0 -2
- package/dist/chunk-82ybmdqk.js +0 -2
- package/dist/chunk-8frs2dtp.js +0 -2
- package/dist/chunk-8n2gj4q2.js +0 -11
- package/dist/chunk-8prq9t3b.js +0 -2
- package/dist/chunk-8sxngenk.js +0 -2
- package/dist/chunk-90er677t.js +0 -2
- package/dist/chunk-aakkjjgr.js +0 -2
- package/dist/chunk-abs1k04e.js +0 -2
- package/dist/chunk-c05r0rzw.js +0 -3
- package/dist/chunk-c7yjhjr2.js +0 -2
- package/dist/chunk-cpep999n.js +0 -2
- package/dist/chunk-cvwn6mga.js +0 -2
- package/dist/chunk-davr7z73.js +0 -2
- package/dist/chunk-dqs4bgec.js +0 -2
- package/dist/chunk-e30kgg28.js +0 -2
- package/dist/chunk-e3fkq9gb.js +0 -2
- package/dist/chunk-eab8na0z.js +0 -2
- package/dist/chunk-exg7ry7b.js +0 -2
- package/dist/chunk-f4mmk2cx.js +0 -2
- package/dist/chunk-fhwn8j9p.js +0 -2
- package/dist/chunk-fj105fff.js +0 -2
- package/dist/chunk-g387j1qv.js +0 -2
- package/dist/chunk-gefpzry6.js +0 -2
- package/dist/chunk-ghzycypz.js +0 -2
- package/dist/chunk-gvaee1w0.js +0 -170
- package/dist/chunk-k37472gm.js +0 -2
- package/dist/chunk-k3wnmpt3.js +0 -2
- package/dist/chunk-kb8654dp.js +0 -4
- package/dist/chunk-kfqdx75m.js +0 -2
- package/dist/chunk-mgx71bfg.js +0 -2
- package/dist/chunk-mmhbn7xt.js +0 -2
- package/dist/chunk-mzcbfra0.js +0 -2
- package/dist/chunk-nv9dy71x.js +0 -54
- package/dist/chunk-ny2qzraq.js +0 -2
- package/dist/chunk-pg15tx9c.js +0 -2
- package/dist/chunk-ppc5s12t.js +0 -2
- package/dist/chunk-ptzzpf97.js +0 -2
- package/dist/chunk-qgsrxyh9.js +0 -2
- package/dist/chunk-qmxcs806.js +0 -2
- package/dist/chunk-qn4gt8sx.js +0 -3
- package/dist/chunk-qryg0hgn.js +0 -2
- package/dist/chunk-qt17792g.js +0 -2
- package/dist/chunk-qz9fzz5k.js +0 -2
- package/dist/chunk-rh90yh1c.js +0 -2
- package/dist/chunk-rvc0pb16.js +0 -2
- package/dist/chunk-sj5t0tnv.js +0 -2
- package/dist/chunk-t4mpq6t0.js +0 -3
- package/dist/chunk-tb6jcr2v.js +0 -2
- package/dist/chunk-tn40nh9e.js +0 -3
- package/dist/chunk-xcq41ah8.js +0 -2
- package/dist/chunk-y3jbkk7a.js +0 -2
- package/dist/chunk-yme43vbp.js +0 -2
- package/dist/chunk-yv8jeqdn.js +0 -2
- package/dist/chunk-zq7g0687.js +0 -2
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
`).length;s.push({line:
|
|
4
|
-
`)+1)+1,offset:f,length:r.length,name:r,kind:u.kind,message:
|
|
5
|
-
`.repeat(e.startLine-1):"",i=
|
|
2
|
+
import{k}from"./chunk-b51p56k5.js";import{xe,Pt,ri,si,Ec,Tc,$c,Rc,Os,ii,Ac,Pc,Ic,mn}from"./chunk-2cbd1ew6.js";import{a}from"./chunk-vv8dn70r.js";import{go}from"./chunk-fke4s0kk.js";import{l}from"./chunk-4tgn1frg.js";import{existsSync as M,readFileSync as K}from"fs";import h from"path";var ge=new Set(["module","exports","require","$bool","$num","window","document","console","confirm","alert","fetch"]),ee=mn.filter((e)=>!ge.has(e)).sort(),te=[...k].sort(),me=[...new Set([...ee,...te])].sort(),he=new Set(ee),be=new Set(te),ye=new Set(me),Y=/\bimport\s+(?!type[\s{])\{([^}]*)\}\s*from\s*(['"])stx\2/g;function Se(e,t){if(t==="server")return`'${e}' is not provided by 'stx' in a <script server> block. The engine binds only its own names there (defineProps, state, useHead, ...); any other name becomes \`await import('stx')\`, which does not resolve, so the whole script fails when the page renders. Import it from '@stacksjs/stx' instead.`;return`'${e}' is not provided by 'stx' in a client <script> block. The import is replaced by the window.stx runtime, which has no '${e}', so it is undefined in the browser.`}function ne(e,t){let s=[];for(let u of t){if(u.offset===void 0)continue;let i=u.kind==="server"?he:be;Y.lastIndex=0;for(let c of u.code.matchAll(Y)){let g=c.index+c[0].indexOf("{")+1;for(let m of c[1].matchAll(/[^,]+/g)){let x=m[0];if(/^\s*type\s/.test(x))continue;let y=/^\s*([A-Za-z_$][\w$]*)/.exec(x);if(!y)continue;let r=y[1];if(!ye.has(r)||i.has(r))continue;let f=u.offset+g+m.index+y[0].length-r.length,p=e.slice(0,f),w=p.split(`
|
|
3
|
+
`).length;s.push({line:w,column:f-(p.lastIndexOf(`
|
|
4
|
+
`)+1)+1,offset:f,length:r.length,name:r,kind:u.kind,message:Se(r,u.kind)})}}}return s}import T from"path";var ke="@stacksjs/stx-typescript-plugin";function we(e,t){let s=T.resolve(e);for(;;){let u=T.join(s,"tsconfig.json");if(t(u))return u;let i=T.dirname(s);if(i===s)return;s=i}}function ie(e,t,s){let u=we(e,s);if(!u)return;let i=new Set,c=(g)=>{if(i.has(g))return;i.add(g);let m=t(g);if(!m)return;let x=m.compilerOptions?.plugins;if(Array.isArray(x)){let r=x.find((p)=>p?.name===ke),f=Array.isArray(r?.libs)?r.libs.filter((p)=>typeof p==="string"):[];return r?{configPath:g,libs:f.map((p)=>T.resolve(T.dirname(g),p))}:null}let y=typeof m.extends==="string"?[m.extends]:Array.isArray(m.extends)?m.extends:[];for(let r of[...y].reverse()){if(typeof r!=="string"||!r.startsWith("."))continue;let f=T.resolve(T.dirname(g),r.endsWith(".json")?r:`${r}.json`),p=c(f);if(p!==void 0)return p}return};return c(u)??void 0}function Pl(e,t="",s=""){let u=e.startLine>1?`
|
|
5
|
+
`.repeat(e.startLine-1):"",i=ii(e)+si(ri(e.code)),c=e.kind==="client"||e.kind==="plain"?$c(t,e.code):"";return Os(`${u+i}
|
|
6
6
|
${c}
|
|
7
7
|
export {}
|
|
8
|
-
`,s)}var $e=new Set(["name","status","length","location","history","origin","closed","close","open","focus","blur","print","scroll","scrollTo","scrollBy","stop","top","parent","self","frames","event","external","menubar","toolbar"]);function ve(e){if(e.length===0)return"";let t=["// Generated \u2014 the composables the runtime publishes as bare globals."],s=new Set(
|
|
9
|
-
`)}function
|
|
8
|
+
`,s)}var $e=new Set(["name","status","length","location","history","origin","closed","close","open","focus","blur","print","scroll","scrollTo","scrollBy","stop","top","parent","self","frames","event","external","menubar","toolbar"]);function ve(e){if(e.length===0)return"";let t=["// Generated \u2014 the composables the runtime publishes as bare globals."],s=new Set(k),u=[];for(let{file:i,names:c}of e){let g=JSON.stringify(i.replace(/\\/g,"/").replace(/\.ts$/,""));u.push(` export * from ${g}`);for(let m of c){if(s.has(m)||$e.has(m))continue;s.add(m),t.push(`declare const ${m}: typeof import(${g})[${JSON.stringify(m)}]`)}}return t.push("declare module '@composables' {",...u,"}"),t.join(`
|
|
9
|
+
`)}function ta(e,t,s){return`${e}.__stx_${t}${s}.ts`}function Ug(e){return e.replace(/\.__stx_(?:server|client|plain|template)\d+\.ts$/,"")}function Il(){return se("stx.d.ts")}function Ol(){return se("stx-module.d.ts")}function se(e){for(let t of[h.resolve(import.meta.dir,"..",e),h.resolve(import.meta.dir,"..","..",e)])if(M(t))return t;return null}var Te=/^(.*?)\((\d+),(\d+)\):\s+(error|warning)\s+TS(\d+):\s+(.*)$/;function De(e){return e>=1000&&e<2000}function re(e){let t="",s=!1,u=!1;for(let i=0;i<e.length;i++){let c=e[i];if(s){if(t+=c,u)u=!1;else if(c==="\\")u=!0;else if(c==='"')s=!1;continue}if(c==='"'){s=!0,t+=c;continue}if(c==="/"&&e[i+1]==="/"){while(i<e.length&&e[i]!==`
|
|
10
10
|
`)i++;t+=`
|
|
11
|
-
`;continue}if(c==="/"&&e[i+1]==="*"){i+=2;while(i<e.length&&!(e[i]==="*"&&e[i+1]==="/"))i++;i++;continue}t+=c}return t.replace(/,(\s*[}\]])/g,"$1")}function Ee(e){try{return JSON.parse(re(K(e,"utf8")))}catch{return}}function Oe(e){let t=h.resolve(e),s;for(;;){let r=h.join(t,"tsconfig.json");if(M(r)){s=r;break}let f=h.dirname(t);if(f===t)break;t=f}if(!s)return{};let u=new Set,i=s,c,g,m=s;while(i&&!u.has(i)){u.add(i);let r;try{r=JSON.parse(re(K(i,"utf8")))}catch{break}let f=r?.compilerOptions??{};if(!c&&f.paths&&typeof f.paths==="object")c=f.paths,m=i;if(!g&&typeof f.baseUrl==="string")g=h.resolve(h.dirname(i),f.baseUrl);if(c&&g)break;i=typeof r?.extends==="string"?h.resolve(h.dirname(i),r.extends.endsWith(".json")?r.extends:`${r.extends}.json`):void 0}if(!c)return{};let x=g??h.dirname(m),y={};for(let[r,f]of Object.entries(c)){if(!Array.isArray(f))continue;y[r]=f.map((p)=>typeof p==="string"&&!h.isAbsolute(p)?h.resolve(x,p):p)}return{paths:y}}async function
|
|
12
|
-
`);for(let d of ne(o,b))x.push({file:n,line:d.line,column:d.column,code:0,message:d.message,category:"error",blockKind:d.kind});if(s&&S){let d=b.filter((
|
|
13
|
-
`),ve(await
|
|
14
|
-
`),
|
|
15
|
-
`)){let b=o.match(Te);if(!b)continue;if(W++,ue.has(b[1].split("/").pop()))z++;let[,S,
|
|
11
|
+
`;continue}if(c==="/"&&e[i+1]==="*"){i+=2;while(i<e.length&&!(e[i]==="*"&&e[i+1]==="/"))i++;i++;continue}t+=c}return t.replace(/,(\s*[}\]])/g,"$1")}function Ee(e){try{return JSON.parse(re(K(e,"utf8")))}catch{return}}function Oe(e){let t=h.resolve(e),s;for(;;){let r=h.join(t,"tsconfig.json");if(M(r)){s=r;break}let f=h.dirname(t);if(f===t)break;t=f}if(!s)return{};let u=new Set,i=s,c,g,m=s;while(i&&!u.has(i)){u.add(i);let r;try{r=JSON.parse(re(K(i,"utf8")))}catch{break}let f=r?.compilerOptions??{};if(!c&&f.paths&&typeof f.paths==="object")c=f.paths,m=i;if(!g&&typeof f.baseUrl==="string")g=h.resolve(h.dirname(i),f.baseUrl);if(c&&g)break;i=typeof r?.extends==="string"?h.resolve(h.dirname(i),r.extends.endsWith(".json")?r.extends:`${r.extends}.json`):void 0}if(!c)return{};let x=g??h.dirname(m),y={};for(let[r,f]of Object.entries(c)){if(!Array.isArray(f))continue;y[r]=f.map((p)=>typeof p==="string"&&!h.isAbsolute(p)?h.resolve(x,p):p)}return{paths:y}}async function Wg(e,t={}){let s=t.client!==!1,u=t.server!==!1,i=t.templates!==!1,c=t.componentsDir??(i?(await a()).componentsDir:void 0),g=new Map,m=new Map,x=[],y=[],r=0,f=0,p=Il();for(let n of e){let o=await Bun.file(n).text(),b=Pt(o).filter((d)=>{if(d.kind==="server")return u;return s}),S=Pt(o).filter((d)=>d.kind==="server").map((d)=>d.code).join(`
|
|
12
|
+
`);for(let d of ne(o,b))x.push({file:n,line:d.line,column:d.column,code:0,message:d.message,category:"error",blockKind:d.kind});if(s&&S){let d=b.filter((O)=>O.kind!=="server"),E=[...new Set(d.flatMap((O)=>Rc(S,O.code)))];if(E.length>0)m.set(n,{names:E,line:d[0].startLine,kind:d[0].kind})}let D=h.dirname(h.resolve(n)),v=i?Ac(o,{runtimeGlobals:!p,originDir:D,filePath:h.resolve(n),componentsDir:c}):null,R=v?[...v.lineMap.values()].filter((d)=>d.expression).length:0;if(b.length===0&&R===0)continue;if(y.push(n),r+=b.length,f+=R,b.forEach((d,E)=>{g.set(ta(n,d.kind,E),{source:Pl(d,S,D),origin:n,kind:d.kind})}),v&&R>0)g.set(ta(n,"template",0),{source:v.text,origin:n,kind:"template",virtual:v})}if(g.size===0)return{diagnostics:x,checkedFiles:y,blockCount:0,expressionCount:0};let w=(t.extraLibs??[]).map((n)=>h.resolve(n)),oe=ie(e.length>0?h.dirname(h.resolve(e[0])):process.cwd(),Ee,M);for(let n of oe?.libs??[])if(!w.includes(n)&&M(n))w.push(n);if(p)w.push(p);let G=p?Ol():null;if(G)w.push(G);let X=`${l()}/typecheck/__stx_globals.d.ts`,ce=["// Generated \u2014 the context serve.ts injects into <script server> blocks.",Ec(p?Tc(K(p,"utf8")):void 0),...p?[]:["declare const window: any",...k.map((n)=>`declare const ${n}: any`)],["// Generated \u2014 the names stx auto-imports from @stacksjs/browser.",...xe.map((n)=>`declare const ${n}: any`)].join(`
|
|
13
|
+
`),ve(await go())].filter(Boolean).join(`
|
|
14
|
+
`),_=`${l()}/typecheck`;await Bun.$`rm -rf ${_}`.quiet().nothrow(),await Bun.$`mkdir -p ${_}`.quiet().nothrow(),await Bun.write(X,ce);let N=new Map,ae=0;for(let[n,o]of g){let b=`${ae++}_${n.replace(/[^\w.-]+/g,"_")}`;await Bun.write(`${_}/${b}`,o.source),N.set(b,o)}let le={target:"ESNext",module:"ESNext",moduleResolution:"bundler",strict:!0,noEmit:!0,skipLibCheck:!0,allowJs:!0,esModuleInterop:!0,resolveJsonModule:!0,lib:["ESNext","DOM","DOM.Iterable"],types:[],...Oe(e.length>0?h.dirname(h.resolve(e[0])):process.cwd()),...t.compilerOptions??{}},F=async(n,o)=>{let b=`${_}/tsconfig${o===1?"":`.${o}`}.json`;await Bun.write(b,JSON.stringify({compilerOptions:le,files:n.map((D)=>`${_}/${D}`).concat(X,...w)},null,2));let S=Bun.spawnSync(["bun","x","tsc","-p",b,"--pretty","false"],{stdout:"pipe",stderr:"pipe"});return{output:new TextDecoder().decode(S.stdout)+new TextDecoder().decode(S.stderr),exitCode:S.exitCode??0}},V=await F([...N.keys()],1),J=V.output,I=[],U=V.exitCode,W=0,ue=new Set(w.map((n)=>n.split("/").pop())),z=0,B=new Set,q=(n)=>{for(let o of n.replace(/\n[\t ]+([^\n]*)/g," $1").split(`
|
|
15
|
+
`)){let b=o.match(Te);if(!b)continue;if(W++,ue.has(b[1].split("/").pop()))z++;let[,S,D,v,R,d,E]=b,O=S.split("/").pop(),C=N.get(O);if(!C)continue;if(De(Number(d)))B.add(O);let A=Number(D),L=Number(v),Q;if(C.virtual){let P=Ic(C.virtual,A,L);if(!P?.expression)continue;if(Pc(P,Number(d)))continue;A=P.line,L=P.column,Q=P.expression.code.trim()}I.push({file:C.origin,line:A,column:L,code:Number(d),message:E,category:R==="error"?"error":"warning",blockKind:C.kind,expression:Q})}};q(J);let pe=W,de=z;if(B.size>0&&B.size<N.size){let n=[...N.keys()].filter((o)=>!B.has(o));q((await F(n,2)).output)}if(s)for(let[n,o]of m){if(o.names.length===0)continue;I.push({file:n,line:o.line,column:1,code:0,message:`${o.names.length===1?"1 value reaches":`${o.names.length} values reach`} this block on the implicit bridge and ${o.names.length===1?"is":"are"} untyped: ${o.names.join(", ")}. Declare them with defineClientPayload({ ${o.names.join(", ")} }) in the server block to have them checked.`,category:"warning",blockKind:o.kind})}I.push(...x);let H=new Set,j=I.filter((n)=>{let o=`${n.file}:${n.line}:${n.column}:${n.code}:${n.message}`;if(H.has(o))return!1;return H.add(o),!0});j.sort((n,o)=>n.file.localeCompare(o.file)||n.line-o.line||n.column-o.column);let Z=de>0&&j.length===0,fe=Z||U!==0&&pe===0?`${Z?"a file passed with --lib has errors of its own, so nothing in your code was checked":`tsc exited ${U} without reporting any diagnostic, so nothing was checked`}. `+"A syntax error in an ambient declaration file does this \u2014 skipLibCheck suppresses "+`SEMANTIC diagnostics only. tsc said:
|
|
16
16
|
${J.trim().split(`
|
|
17
17
|
`).slice(0,12).join(`
|
|
18
|
-
`)||"(no output)"}`:void 0;return{diagnostics:j,checkedFiles:y,blockCount:r,expressionCount:f,failure:fe}}function
|
|
18
|
+
`)||"(no output)"}`:void 0;return{diagnostics:j,checkedFiles:y,blockCount:r,expressionCount:f,failure:fe}}function qg(e){return e.map((t)=>{let s=t.blockKind==="template"?`[template: ${t.expression??""}]`:`[${t.blockKind==="plain"?"<script>":`<script ${t.blockKind}>`}]`;return`${t.file}:${t.line}:${t.column} ${t.category} TS${t.code} ${t.message} ${s}`}).join(`
|
|
19
19
|
`)}
|
|
20
|
-
export{
|
|
20
|
+
export{Pl,ta,Ug,Il,Ol,Wg,qg};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var f=null,D=[],v=0,g=new Set;function x(){return f}function S(e){let n=f;return D.push(e),f=e,n}function h(e){D.pop(),f=e}var A=new WeakMap;function w(e,n){A.set(e,n)}function p(e,n){for(let r of e){let i=A.get(r);if(i)i(n);else n.add(r)}}function b(e){if(v>0){p(e,g);return}let n=new Set;p(e,n);for(let r of n)r()}function C(e){v++;try{e()}finally{if(v--,v===0){let n=[...g];g.clear();for(let r of n)r()}}}function m(e){let n=f;f=null;try{return e()}finally{f=n}}var k=[],T=[];function le(e){let n=e,r=new Set,i=new Set,o=()=>{let t=x();if(t)i.add(t);return n};return o.set=(t)=>{if(!Object.is(t,n)){let c=n;n=t,r.forEach((u)=>{try{u(n,c)}catch(l){console.error("[stx] subscriber error:",l)}}),b(i)}},o.update=(t)=>{o.set(t(n))},o.subscribe=(t)=>(r.add(t),()=>r.delete(t)),Object.defineProperty(o,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(o,"value",{get:()=>o(),set:(t)=>o.set(t),configurable:!0}),o}function
|
|
3
|
-
export{le,
|
|
2
|
+
var f=null,D=[],v=0,g=new Set;function x(){return f}function S(e){let n=f;return D.push(e),f=e,n}function h(e){D.pop(),f=e}var A=new WeakMap;function w(e,n){A.set(e,n)}function p(e,n){for(let r of e){let i=A.get(r);if(i)i(n);else n.add(r)}}function b(e){if(v>0){p(e,g);return}let n=new Set;p(e,n);for(let r of n)r()}function C(e){v++;try{e()}finally{if(v--,v===0){let n=[...g];g.clear();for(let r of n)r()}}}function m(e){let n=f;f=null;try{return e()}finally{f=n}}var k=[],T=[];function le(e){let n=e,r=new Set,i=new Set,o=()=>{let t=x();if(t)i.add(t);return n};return o.set=(t)=>{if(!Object.is(t,n)){let c=n;n=t,r.forEach((u)=>{try{u(n,c)}catch(l){console.error("[stx] subscriber error:",l)}}),b(i)}},o.update=(t)=>{o.set(t(n))},o.subscribe=(t)=>(r.add(t),()=>r.delete(t)),Object.defineProperty(o,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(o,"value",{get:()=>o(),set:(t)=>o.set(t),configurable:!0}),o}function Hn(e,n={}){let r,i=!0,o=!1,t=new Set,c=typeof n.equals==="function"?n.equals:null,u=()=>{let s=S(d);try{r=e(),o=!0}finally{h(s)}i=!1},l=()=>{let s=r,y=o;try{u()}catch{return i=!0,!0}return!y||!c(s,r)},d=()=>{if(i)return;if(c&&t.size){if(l())b(t);return}i=!0,b(t)};w(d,(s)=>{if(i)return;if(c&&t.size){if(l())p(t,s);return}i=!0,p(t,s)});let a=()=>{let s=x();if(s)t.add(s);if(i)u();return r};return Object.defineProperty(a,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(a,"value",{get:()=>a(),configurable:!0}),a}function rh(e,n=Object.is){return Hn(e,{equals:n})}function Vn(e,n={}){let r,i=!1,o=()=>{if(i)return;if(r){let c=r;r=void 0;try{c()}catch(u){console.error("[stx] effect cleanup error:",u)}}let t=S(o);try{let c=e();r=typeof c==="function"?c:void 0}catch(c){i=!0,console.error("[stx] effect error (the effect is disposed):",c)}finally{h(t)}};if(n.immediate!==!1)o();return()=>{if(i=!0,r){let t=r;r=void 0,t()}}}function mo(e){C(e)}function qr(e){k.push(e)}function Kr(e){T.push(e)}function sh(){O(k,"onMount",T)}function oh(){O(T,"onDestroy")}function O(e,n,r){let i=e.splice(0,e.length);for(let o of i)try{let t=o();if(r&&typeof t==="function")r.push(t)}catch(t){console.error(`[stx] ${n} callback threw:`,t)}}function ih(){return{mount:k.length,destroy:T.length}}function Un(e){return typeof e==="function"&&e._isSignal===!0}function Wn(e){return typeof e==="function"&&e._isDerived===!0}function ho(e){if(Un(e)||Wn(e))return m(()=>e());return e}function Gr(e){return m(e)}function ah(e,n){let r=typeof e==="function"?e:()=>e,i=le([]),o=Hn(()=>i().reduce((u,l)=>n(u,l.action),r())),t=!1;return Vn(()=>{if(r(),!t){t=!0;return}if(Gr(()=>i().length))i.set([])}),[o,(u,l)=>{let d={action:u};i.set([...i(),d]);let a=()=>{let s=i().filter((y)=>y!==d);if(s.length!==i().length)i.set(s)};if(l&&typeof l.then==="function")Promise.resolve(l).then(a,a);return a}]}
|
|
3
|
+
export{le,Hn,rh,Vn,mo,qr,Kr,sh,oh,ih,Un,Wn,ho,Gr,ah};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{cl,ll,ul}from"./chunk-qwds327k.js";import{le,zn,Hn,fo,Wr,qr,Vn,Un,go,Kr}from"./chunk-pwmkhs7z.js";function z(e,s,i,a,d,y){let r=!0,u=new Set,f=(p)=>a.get?a.get(p):p,o=()=>f(e());return Object.defineProperty(o,"_isSignal",{value:!0}),Object.defineProperty(o,"modifiers",{get:s}),o.set=(p)=>{if(!r)return;let h=s(),t=a.set?a.set(p,h):p;if(h.trim&&typeof t==="string")t=t.trim();if(h.number&&typeof t==="string"&&t!==""){let l=Number(t);if(!Number.isNaN(l))t=l}if(Object.is(e(),t))return;e.set(t),i(t)},o.update=(p)=>o.set(p(o())),o.input=(p)=>{if(!s().lazy)o.set(p)},o.change=(p)=>{if(s().lazy)o.set(p)},o.subscribe=(p)=>{if(!r)return()=>{};let h=e.subscribe((t,l)=>p(f(t),f(l)));return u.add(h),()=>{h(),u.delete(h)}},Object.defineProperty(o,"value",{get:o,set:o.set}),d(()=>{r=!1,u.forEach((p)=>p()),u.clear()}),y?.(()=>{r=!0}),o}function X(e,s=!0,i){if(!s||!e||typeof window>"u")return;let a=window;if(!a.__STX_DATA__){let y=document.querySelector("script[data-stx-server-data]");try{let r=JSON.parse(y?.textContent||"{}");a.__STX_DATA__=r&&typeof r==="object"&&!Array.isArray(r)?r:{}}catch{a.__STX_DATA__={}}}let d=a.__STX_DATA__;if(d&&Object.prototype.hasOwnProperty.call(d,e))try{return{data:i?i(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 s=window;if(e===void 0)s.__STX_DATA__={};else{if(!s.__STX_DATA__)try{let i=JSON.parse(document.querySelector("script[data-stx-server-data]")?.textContent||"{}");s.__STX_DATA__=i&&typeof i==="object"&&!Array.isArray(i)?i:{}}catch{s.__STX_DATA__={}}if(s.__STX_DATA__)delete s.__STX_DATA__[e]}}function Y(e){let s=null;try{s=typeof indexedDB<"u"?indexedDB:null}catch{s=null}if(!s)return null;let i=s,a=e||"stx-kept",d=null,y=()=>{if(!d)d=new Promise((u,f)=>{let o=i.open(a,1);o.onupgradeneeded=()=>{o.result.createObjectStore("kv")},o.onsuccess=()=>u(o.result),o.onerror=()=>f(o.error),o.onblocked=()=>f(Error("blocked"))}),d.catch(()=>{d=null});return d},r=(u,f)=>y().then((o)=>new Promise((p,h)=>{let t=o.transaction("kv",u),l=f(t.objectStore("kv"));t.oncomplete=()=>p(l?l.result:void 0),t.onerror=()=>h(t.error),t.onabort=()=>h(t.error)}));return{get:(u)=>r("readonly",(f)=>f.get(u)),set:(u,f)=>r("readwrite",(o)=>{o.put(f,u)}),remove:(u)=>r("readwrite",(f)=>{f.delete(u)}),removePrefix:(u)=>r("readwrite",(f)=>{f.delete(IDBKeyRange.bound(u,`${u}\uFFFF`))})}}function J(e,s){let i=e||{},a=null;if(i.storage!==void 0)a=i.storage;else try{a=typeof localStorage<"u"?localStorage:null}catch{a=null}let d=null,y=i.backend!==void 0;if(y)d=i.backend||null;let r=()=>{if(y)return d;y=!0;try{d=s?s():null}catch{d=null}if(d){let n=d;n.get("__stx_probe__").catch(()=>{if(d===n)d=null})}return d},u=i.limit||32768,f=i.defer||((n)=>{let c=typeof requestIdleCallback==="function"?requestIdleCallback:null;if(c)c(n,{timeout:200});else setTimeout(n,16)}),o=new Map,p=new Set,h=new Map,t=!1,l=Promise.resolve(),g=(n)=>{try{return JSON.parse(n)}catch{return n}},m=(n,c)=>{if(!a)return!1;try{return a.setItem(n,c),!0}catch{return!1}},_=(n)=>{try{if(a)a.removeItem(n)}catch{}},k=()=>{if(t=!1,!h.size)return l;let n=Array.from(h.entries());return h.clear(),l=l.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(()=>{}),l},N=(n,c)=>{if(h.set(n,c),p.add(n),t)return;t=!0,f(()=>{k()})},D=(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(o.has(n))return{value:o.get(n)};let c=null;try{c=a?a.getItem(n):null}catch{c=null}if(c===null||c===void 0)return;let v=g(c);return o.set(n,v),{value:v}},load(n){let c=E.peek(n),v=c?null:r();if(c||!v)return Promise.resolve(c);return v.get(n).then((x)=>{if(o.has(n))return{value:o.get(n)};let S=D(x);if(S)o.set(n,S.value),p.add(n);return S},()=>{return})},set(n,c){if(o.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(!r()){if(v.length>u)m(n,v);return}_(n),N(n,c)},forget(n){for(let v of Array.from(o.keys()))if(v.indexOf(n)===0)o.delete(v);for(let v of Array.from(h.keys()))if(v.indexOf(n)===0)h.delete(v);for(let v of Array.from(p))if(v.indexOf(n)===0)p.delete(v);try{if(a)for(let v=a.length-1;v>=0;v--){let x=a.key(v);if(x&&x.indexOf(n)===0)a.removeItem(x)}}catch{}let c=r();if(!c)return l;return l=l.then(()=>c.removePrefix(n)).catch(()=>{}),l},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,s){if(!e)return!1;if(e===s.key)return!0;if(!s.url)return!1;if(e===s.url)return!0;try{let i=typeof location<"u"&&location.origin&&location.origin!=="null"?location.origin:"http://localhost",a=new URL(e,i),d=new URL(s.url,i);if(a.origin!==d.origin||a.pathname!==d.pathname)return!1;return!a.search||a.search===d.search}catch{return!1}}function ee(e){let s=e.prefix||"stx:kept:",i=e.matches||((t,l)=>t===l.key||t===l.url),a=new Set,d=new Map,y,r=(t)=>t===void 0?y:t,u=(t,l)=>{let g=r(l);if(g===!1||g===null||g==="")return null;return`${s}${g===void 0?"":`${g}:`}query:${t}`},f=(t)=>{let l=t&&t.value;if(!l||typeof l!=="object"||!("d"in l))return;return{data:l.d,at:Number(l.at)||0}},o=()=>{let t=globalThis;return t.__stx_outboxes instanceof Map?t.__stx_outboxes:null},p={setScope(t){y=t},scope:()=>y,keyFor:u,seed(t,l){let g=u(t,l);return g?f(e.kept.peek(g)):void 0},restore(t,l){let g=u(t,l);return g?e.kept.load(g).then(f):Promise.resolve(void 0)},persist(t,l,g){let m=u(t,g);if(m)e.kept.set(m,{d:l,at:Date.now()})},overlay(t,l,g){let m=o();if(!m||!m.size)return l;let _=l;return m.forEach((k)=>{try{_=k.overlay(t,_,g)}catch{}}),_},watch(t){return a.add(t),()=>{a.delete(t)}},cachedQuery(t,l){let g=d.get(t);if(g){if(l&&g.__options)g.__options(l);return g}let m=l||{},_=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,D=()=>({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(D(),n)),U=e.state(!1),q=e.state(!1),K=e.state(null),P=e.state(S?S.at:0),R=0,F=()=>{I.set(p.overlay(D(),n))},W=(b)=>{let w=R;p.restore(t,b).then((T)=>{if(!T||w!==R||c)return;n=T.data,P.set(T.at),F()})};if(!S)W(E);let _t=()=>{let b=k();if(b===E)return;E=b,R++,x=0,q.set(!1),U.set(!1),c=0;let w=p.seed(t,E);if(n=w?w.data:_,P.set(w?w.at:0),F(),!w)W(E)},xt=(b,w)=>{let T=m.timeoutMs||15000,C=typeof AbortController<"u"?new AbortController:null,O=null,V=new Promise((M,j)=>{O=setTimeout(()=>{if(C)C.abort();j(Error("The request took too long."))},T)}),A;if(m.load)A=m.load({force:b,url:w,signal:C?C.signal:void 0});else if(w){let M=m.fetch||((L,H)=>fetch(L,H)),j={method:"GET",headers:{Accept:"application/json"}};if(b)j.cache="no-cache";if(C)j.signal=C.signal;A=M(w,j).then((L)=>{if(!L.ok)return L.json().catch(()=>null).then((H)=>{throw Error(H&&(H.error||H.message)||`Request failed (${L.status})`)});return L.json()})}else return Promise.resolve(I());return Promise.race([A,V]).then((M)=>{if(O)clearTimeout(O);return m.transform?m.transform(M):M},(M)=>{if(O)clearTimeout(O);throw M})},G=(b)=>{let w=R,T=N(),C=()=>{if(w!==R)return Promise.resolve(I());if(x++,q.set(!0),c===0&&!P())U.set(!0);let V=()=>{if(w!==R)return;if(x=Math.max(0,x-1),!x)q.set(!1),U.set(!1)};return xt(b,T).then((A)=>{if(w!==R||T!==N())return V(),I();return n=A,c=Date.now(),P.set(c),K.set(null),p.persist(t,A,E),F(),V(),I()},(A)=>{if(w===R&&T===N())K.set(A&&A.message?A.message:"Could not load.");return V(),I()})},O=`${w} ${T||""}`;return b?v.fresh(O,C):v.run(O,C)},B={data:I,loading:U,isFetching:q,error:K,updatedAt:P,get key(){return t},load(b){if(_t(),!b&&c&&Date.now()-c<(m.staleTime||0))return Promise.resolve(I());return G(!!b)},refresh(){return B.load(!0)},set(b){n=typeof b==="function"?b(n):b,p.persist(t,n,E),F()},invalidate(){c=0},__options(b){m={...m,...b}}};if(a.add({target:D,updated:()=>{if(c||P())G(!1)},outbox:(b)=>{if(b)n=p.overlay(D(),n,b.id),c=0,G(!0);F()}}),d.set(t,B),m.immediate)B.load();return B}},h=typeof window<"u"?window:typeof addEventListener==="function"?globalThis:null;if(e.listen!==!1&&h&&typeof h.addEventListener==="function")h.addEventListener("stx:updated",(t)=>{let l=t.detail||{};if(l.kind!=="api"||typeof l.url!=="string")return;a.forEach((g)=>{if(i(l.url,g.target()))g.updated()})}),h.addEventListener("stx:outbox",(t)=>{let l=t.detail||{},g=l.sent&&typeof l.sent.id==="string"?l.sent:null;a.forEach((m)=>{if(g){let _=Array.isArray(g.affects)?g.affects:[],k=m.target();if(!_.some((N)=>i(N,k)))return}m.outbox(g)})});return p}function te(e){let s=e&&e.covers||((r,u)=>Object.is(r,u)),i=[],a=[],d=0,y=(r,u)=>{let f;try{f=Promise.resolve(u())}catch(h){f=Promise.reject(h)}let o={key:r,promise:f};i.push(o);let p=()=>{let h=i.indexOf(o);if(h!==-1)i.splice(h,1)};return f.then(p,p),f};return{run(r,u){for(let f of i)if(s(f.key,r))return f.promise;for(let f of a)if(s(f.key,r))return f.promise;return y(r,u)},fresh(r,u){for(let h of a)if(s(h.key,r))return h.promise;let f=i.filter((h)=>s(h.key,r)).map((h)=>h.promise);if(!f.length)return y(r,u);let o={key:r,promise:null},p=()=>{};return o.promise=Promise.all(f.map((h)=>h.then(p,p))).then(()=>{let h=a.indexOf(o);if(h!==-1)a.splice(h,1);return y(r,u)}),a.push(o),o.promise},latest(){let r=++d;return()=>r===d},get busy(){return i.length>0||a.length>0}}}function ne(e){let s=!1,i=null,a=null,d=0;async function y(){if(s)return;i=new AbortController;try{let r=await e.request(e.endpoint,{signal:i.signal,cache:"no-store",headers:{Accept:"text/event-stream"}});if(!r.ok||!r.body||!r.headers.get("content-type")?.includes("text/event-stream"))throw Error("Broadcast stream unavailable");if(s){await r.body.cancel();return}let u=r.body.getReader(),f=new TextDecoder,o="";d=0,e.onStatus?.(!0),e.onConnected?.();try{while(!s){let{done:p,value:h}=await u.read();if(p)break;if(o+=f.decode(h,{stream:!0}).replace(/\r\n/g,`
|
|
2
|
+
import{ll,ul,dl}from"./chunk-b51p56k5.js";import{le,Hn,Vn,mo,qr,Kr,Un,Wn,ho,Gr}from"./chunk-jyp2mmts.js";function z(e,s,i,a,d,y){let r=!0,u=new Set,f=(p)=>a.get?a.get(p):p,o=()=>f(e());return Object.defineProperty(o,"_isSignal",{value:!0}),Object.defineProperty(o,"modifiers",{get:s}),o.set=(p)=>{if(!r)return;let h=s(),t=a.set?a.set(p,h):p;if(h.trim&&typeof t==="string")t=t.trim();if(h.number&&typeof t==="string"&&t!==""){let l=Number(t);if(!Number.isNaN(l))t=l}if(Object.is(e(),t))return;e.set(t),i(t)},o.update=(p)=>o.set(p(o())),o.input=(p)=>{if(!s().lazy)o.set(p)},o.change=(p)=>{if(s().lazy)o.set(p)},o.subscribe=(p)=>{if(!r)return()=>{};let h=e.subscribe((t,l)=>p(f(t),f(l)));return u.add(h),()=>{h(),u.delete(h)}},Object.defineProperty(o,"value",{get:o,set:o.set}),d(()=>{r=!1,u.forEach((p)=>p()),u.clear()}),y?.(()=>{r=!0}),o}function X(e,s=!0,i){if(!s||!e||typeof window>"u")return;let a=window;if(!a.__STX_DATA__){let y=document.querySelector("script[data-stx-server-data]");try{let r=JSON.parse(y?.textContent||"{}");a.__STX_DATA__=r&&typeof r==="object"&&!Array.isArray(r)?r:{}}catch{a.__STX_DATA__={}}}let d=a.__STX_DATA__;if(d&&Object.prototype.hasOwnProperty.call(d,e))try{return{data:i?i(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 s=window;if(e===void 0)s.__STX_DATA__={};else{if(!s.__STX_DATA__)try{let i=JSON.parse(document.querySelector("script[data-stx-server-data]")?.textContent||"{}");s.__STX_DATA__=i&&typeof i==="object"&&!Array.isArray(i)?i:{}}catch{s.__STX_DATA__={}}if(s.__STX_DATA__)delete s.__STX_DATA__[e]}}function Y(e){let s=null;try{s=typeof indexedDB<"u"?indexedDB:null}catch{s=null}if(!s)return null;let i=s,a=e||"stx-kept",d=null,y=()=>{if(!d)d=new Promise((u,f)=>{let o=i.open(a,1);o.onupgradeneeded=()=>{o.result.createObjectStore("kv")},o.onsuccess=()=>u(o.result),o.onerror=()=>f(o.error),o.onblocked=()=>f(Error("blocked"))}),d.catch(()=>{d=null});return d},r=(u,f)=>y().then((o)=>new Promise((p,h)=>{let t=o.transaction("kv",u),l=f(t.objectStore("kv"));t.oncomplete=()=>p(l?l.result:void 0),t.onerror=()=>h(t.error),t.onabort=()=>h(t.error)}));return{get:(u)=>r("readonly",(f)=>f.get(u)),set:(u,f)=>r("readwrite",(o)=>{o.put(f,u)}),remove:(u)=>r("readwrite",(f)=>{f.delete(u)}),removePrefix:(u)=>r("readwrite",(f)=>{f.delete(IDBKeyRange.bound(u,`${u}\uFFFF`))})}}function J(e,s){let i=e||{},a=null;if(i.storage!==void 0)a=i.storage;else try{a=typeof localStorage<"u"?localStorage:null}catch{a=null}let d=null,y=i.backend!==void 0;if(y)d=i.backend||null;let r=()=>{if(y)return d;y=!0;try{d=s?s():null}catch{d=null}if(d){let n=d;n.get("__stx_probe__").catch(()=>{if(d===n)d=null})}return d},u=i.limit||32768,f=i.defer||((n)=>{let c=typeof requestIdleCallback==="function"?requestIdleCallback:null;if(c)c(n,{timeout:200});else setTimeout(n,16)}),o=new Map,p=new Set,h=new Map,t=!1,l=Promise.resolve(),g=(n)=>{try{return JSON.parse(n)}catch{return n}},m=(n,c)=>{if(!a)return!1;try{return a.setItem(n,c),!0}catch{return!1}},_=(n)=>{try{if(a)a.removeItem(n)}catch{}},k=()=>{if(t=!1,!h.size)return l;let n=Array.from(h.entries());return h.clear(),l=l.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(()=>{}),l},N=(n,c)=>{if(h.set(n,c),p.add(n),t)return;t=!0,f(()=>{k()})},D=(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(o.has(n))return{value:o.get(n)};let c=null;try{c=a?a.getItem(n):null}catch{c=null}if(c===null||c===void 0)return;let v=g(c);return o.set(n,v),{value:v}},load(n){let c=E.peek(n),v=c?null:r();if(c||!v)return Promise.resolve(c);return v.get(n).then((x)=>{if(o.has(n))return{value:o.get(n)};let S=D(x);if(S)o.set(n,S.value),p.add(n);return S},()=>{return})},set(n,c){if(o.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(!r()){if(v.length>u)m(n,v);return}_(n),N(n,c)},forget(n){for(let v of Array.from(o.keys()))if(v.indexOf(n)===0)o.delete(v);for(let v of Array.from(h.keys()))if(v.indexOf(n)===0)h.delete(v);for(let v of Array.from(p))if(v.indexOf(n)===0)p.delete(v);try{if(a)for(let v=a.length-1;v>=0;v--){let x=a.key(v);if(x&&x.indexOf(n)===0)a.removeItem(x)}}catch{}let c=r();if(!c)return l;return l=l.then(()=>c.removePrefix(n)).catch(()=>{}),l},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,s){if(!e)return!1;if(e===s.key)return!0;if(!s.url)return!1;if(e===s.url)return!0;try{let i=typeof location<"u"&&location.origin&&location.origin!=="null"?location.origin:"http://localhost",a=new URL(e,i),d=new URL(s.url,i);if(a.origin!==d.origin||a.pathname!==d.pathname)return!1;return!a.search||a.search===d.search}catch{return!1}}function ee(e){let s=e.prefix||"stx:kept:",i=e.matches||((t,l)=>t===l.key||t===l.url),a=new Set,d=new Map,y,r=(t)=>t===void 0?y:t,u=(t,l)=>{let g=r(l);if(g===!1||g===null||g==="")return null;return`${s}${g===void 0?"":`${g}:`}query:${t}`},f=(t)=>{let l=t&&t.value;if(!l||typeof l!=="object"||!("d"in l))return;return{data:l.d,at:Number(l.at)||0}},o=()=>{let t=globalThis;return t.__stx_outboxes instanceof Map?t.__stx_outboxes:null},p={setScope(t){y=t},scope:()=>y,keyFor:u,seed(t,l){let g=u(t,l);return g?f(e.kept.peek(g)):void 0},restore(t,l){let g=u(t,l);return g?e.kept.load(g).then(f):Promise.resolve(void 0)},persist(t,l,g){let m=u(t,g);if(m)e.kept.set(m,{d:l,at:Date.now()})},overlay(t,l,g){let m=o();if(!m||!m.size)return l;let _=l;return m.forEach((k)=>{try{_=k.overlay(t,_,g)}catch{}}),_},watch(t){return a.add(t),()=>{a.delete(t)}},cachedQuery(t,l){let g=d.get(t);if(g){if(l&&g.__options)g.__options(l);return g}let m=l||{},_=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,D=()=>({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(D(),n)),U=e.state(!1),q=e.state(!1),K=e.state(null),P=e.state(S?S.at:0),R=0,F=()=>{I.set(p.overlay(D(),n))},W=(b)=>{let w=R;p.restore(t,b).then((T)=>{if(!T||w!==R||c)return;n=T.data,P.set(T.at),F()})};if(!S)W(E);let _t=()=>{let b=k();if(b===E)return;E=b,R++,x=0,q.set(!1),U.set(!1),c=0;let w=p.seed(t,E);if(n=w?w.data:_,P.set(w?w.at:0),F(),!w)W(E)},xt=(b,w)=>{let T=m.timeoutMs||15000,C=typeof AbortController<"u"?new AbortController:null,O=null,V=new Promise((M,j)=>{O=setTimeout(()=>{if(C)C.abort();j(Error("The request took too long."))},T)}),A;if(m.load)A=m.load({force:b,url:w,signal:C?C.signal:void 0});else if(w){let M=m.fetch||((L,H)=>fetch(L,H)),j={method:"GET",headers:{Accept:"application/json"}};if(b)j.cache="no-cache";if(C)j.signal=C.signal;A=M(w,j).then((L)=>{if(!L.ok)return L.json().catch(()=>null).then((H)=>{throw Error(H&&(H.error||H.message)||`Request failed (${L.status})`)});return L.json()})}else return Promise.resolve(I());return Promise.race([A,V]).then((M)=>{if(O)clearTimeout(O);return m.transform?m.transform(M):M},(M)=>{if(O)clearTimeout(O);throw M})},G=(b)=>{let w=R,T=N(),C=()=>{if(w!==R)return Promise.resolve(I());if(x++,q.set(!0),c===0&&!P())U.set(!0);let V=()=>{if(w!==R)return;if(x=Math.max(0,x-1),!x)q.set(!1),U.set(!1)};return xt(b,T).then((A)=>{if(w!==R||T!==N())return V(),I();return n=A,c=Date.now(),P.set(c),K.set(null),p.persist(t,A,E),F(),V(),I()},(A)=>{if(w===R&&T===N())K.set(A&&A.message?A.message:"Could not load.");return V(),I()})},O=`${w} ${T||""}`;return b?v.fresh(O,C):v.run(O,C)},B={data:I,loading:U,isFetching:q,error:K,updatedAt:P,get key(){return t},load(b){if(_t(),!b&&c&&Date.now()-c<(m.staleTime||0))return Promise.resolve(I());return G(!!b)},refresh(){return B.load(!0)},set(b){n=typeof b==="function"?b(n):b,p.persist(t,n,E),F()},invalidate(){c=0},__options(b){m={...m,...b}}};if(a.add({target:D,updated:()=>{if(c||P())G(!1)},outbox:(b)=>{if(b)n=p.overlay(D(),n,b.id),c=0,G(!0);F()}}),d.set(t,B),m.immediate)B.load();return B}},h=typeof window<"u"?window:typeof addEventListener==="function"?globalThis:null;if(e.listen!==!1&&h&&typeof h.addEventListener==="function")h.addEventListener("stx:updated",(t)=>{let l=t.detail||{};if(l.kind!=="api"||typeof l.url!=="string")return;a.forEach((g)=>{if(i(l.url,g.target()))g.updated()})}),h.addEventListener("stx:outbox",(t)=>{let l=t.detail||{},g=l.sent&&typeof l.sent.id==="string"?l.sent:null;a.forEach((m)=>{if(g){let _=Array.isArray(g.affects)?g.affects:[],k=m.target();if(!_.some((N)=>i(N,k)))return}m.outbox(g)})});return p}function te(e){let s=e&&e.covers||((r,u)=>Object.is(r,u)),i=[],a=[],d=0,y=(r,u)=>{let f;try{f=Promise.resolve(u())}catch(h){f=Promise.reject(h)}let o={key:r,promise:f};i.push(o);let p=()=>{let h=i.indexOf(o);if(h!==-1)i.splice(h,1)};return f.then(p,p),f};return{run(r,u){for(let f of i)if(s(f.key,r))return f.promise;for(let f of a)if(s(f.key,r))return f.promise;return y(r,u)},fresh(r,u){for(let h of a)if(s(h.key,r))return h.promise;let f=i.filter((h)=>s(h.key,r)).map((h)=>h.promise);if(!f.length)return y(r,u);let o={key:r,promise:null},p=()=>{};return o.promise=Promise.all(f.map((h)=>h.then(p,p))).then(()=>{let h=a.indexOf(o);if(h!==-1)a.splice(h,1);return y(r,u)}),a.push(o),o.promise},latest(){let r=++d;return()=>r===d},get busy(){return i.length>0||a.length>0}}}function ne(e){let s=!1,i=null,a=null,d=0;async function y(){if(s)return;i=new AbortController;try{let r=await e.request(e.endpoint,{signal:i.signal,cache:"no-store",headers:{Accept:"text/event-stream"}});if(!r.ok||!r.body||!r.headers.get("content-type")?.includes("text/event-stream"))throw Error("Broadcast stream unavailable");if(s){await r.body.cancel();return}let u=r.body.getReader(),f=new TextDecoder,o="";d=0,e.onStatus?.(!0),e.onConnected?.();try{while(!s){let{done:p,value:h}=await u.read();if(p)break;if(o+=f.decode(h,{stream:!0}).replace(/\r\n/g,`
|
|
3
3
|
`),o.length>1048576)throw Error("Broadcast frame too large");let t;while((t=o.indexOf(`
|
|
4
4
|
|
|
5
5
|
`))!==-1){let l=o.slice(0,t);o=o.slice(t+2);let g=l.split(`
|
|
@@ -9740,7 +9740,7 @@ catch (e2) {
|
|
|
9740
9740
|
var contentRoot = (contentEl === el) ? el : contentEl;
|
|
9741
9741
|
Array.from(contentRoot.childNodes).forEach(function(child) { processElement(child, scope); });
|
|
9742
9742
|
}
|
|
9743
|
-
`;var
|
|
9743
|
+
`;var gt=` // ==========================================================================
|
|
9744
9744
|
// Timer & Utility Composables
|
|
9745
9745
|
// ==========================================================================
|
|
9746
9746
|
|
|
@@ -10613,7 +10613,7 @@ else if (timer === null) {
|
|
|
10613
10613
|
subscribe: subscribe
|
|
10614
10614
|
};
|
|
10615
10615
|
}
|
|
10616
|
-
`;function
|
|
10616
|
+
`;function mt(){let e=St(zn());try{let i=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(e);return i=i.replace(/\}(var |let |const |function )/g,"};$1"),i}catch{return e}}function St(e){let s=[],i=0,a="console.log(";while(i<e.length){let d=e.indexOf(a,i);if(d===-1){s.push(e.slice(i));break}s.push(e.slice(i,d));let y=1,r=d+a.length;while(r<e.length&&y>0){let u=e[r];if(u==='"'||u==="'"||u==="`"){let f=u;r++;while(r<e.length&&e[r]!==f){if(e[r]==="\\")r++;r++}r++;continue}if(u==="(")y++;else if(u===")")y--;r++}s.push("0"),i=r}return s.join("")}function zn(){return`${ae}${Me}
|
|
10617
10617
|
${Je(ie,ke,Te)}
|
|
10618
10618
|
|
|
10619
10619
|
${Oe}
|
|
@@ -10640,7 +10640,7 @@ ${se}
|
|
|
10640
10640
|
${ue}
|
|
10641
10641
|
${me}
|
|
10642
10642
|
${Ke}
|
|
10643
|
-
${tt(
|
|
10643
|
+
${tt(ul(),dl(),ll())}
|
|
10644
10644
|
|
|
10645
10645
|
${ft}
|
|
10646
10646
|
${it}
|
|
@@ -10657,7 +10657,7 @@ ${fe}
|
|
|
10657
10657
|
${Le}
|
|
10658
10658
|
${Fe}
|
|
10659
10659
|
${de}
|
|
10660
|
-
${
|
|
10660
|
+
${gt}
|
|
10661
10661
|
${re}
|
|
10662
10662
|
${Ze}
|
|
10663
10663
|
|
|
@@ -10693,5 +10693,5 @@ ${lt}
|
|
|
10693
10693
|
${ct}
|
|
10694
10694
|
${at}
|
|
10695
10695
|
})();
|
|
10696
|
-
`}var
|
|
10697
|
-
export{
|
|
10696
|
+
`}var nh={state:le,derived:Hn,effect:Vn,batch:mo,onMount:qr,onDestroy:Kr,isSignal:Un,isDerived:Wn,untrack:ho,peek:Gr,generateSignalsRuntime:mt,generateSignalsRuntimeDev:zn};
|
|
10697
|
+
export{mt,zn,nh};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{w}from"./chunk-tpfxvw4q.js";function Ye(e,r){let n=v(e,r);return n.ok?{expression:n.expression,endPos:n.endPos}:null}function v(e,r){let n=r;while(n<e.length&&/\s/.test(e[n]))n++;if(e[n]!=="(")return{ok:!1,reason:"missing-open-paren",pos:n};let c=w(e,"(",")",n);if(c===-1)return{ok:!1,reason:"unclosed-paren",pos:n};return{ok:!0,expression:e.slice(n+1,c),endPos:c+1}}function y(e,r){let n=e.lastIndexOf("<",r);if(n===-1)return!1;return n>e.lastIndexOf(">",r)}function wt(e,r,n,c){let o=1,i=c,u=new RegExp(`@${r}\\s*\\(`,"g"),a=new RegExp(`@${n}(?![a-z])`,"g");while(i<e.length&&o>0){u.lastIndex=i,a.lastIndex=i;let p=u.exec(e),t=a.exec(e),s=p?p.index:1/0,f=t?t.index:1/0;if(s<f)o++,i=s+p[0].length;else if(f<1/0){if(o--,o===0)return f;i=f+t[0].length}else break}return-1}function P(e,r){let n=e.slice(r).match(/^@if\s*/);if(!n)return null;let c=r+n[0].length,o=Ye(e,c);if(!o)return null;let i=o.endPos,u=wt(e,"if","endif",i);if(u===-1)return null;let a=e.slice(i,u),p=[],t=0,s="if",f=o.expression,l=0,x=0;while(t<a.length){let h=a.indexOf("@",t);if(h===-1)break;t=h;let d=a.substring(h);if(y(a,h)){t++;continue}if(/^@if\s*\(/.test(d)){x++,t++;continue}if(/^@endif(?![a-z])/.test(d)){x--,t+=6;continue}if(x===0){let g=d.match(/^@elseif\s*/);if(g){p.push({type:s,condition:f,content:a.substring(l,t),start:i+l,end:i+t});let m=t+g[0].length,b=Ye(a,m);if(!b){t++;continue}s="elseif",f=b.expression,t=b.endPos,l=t;continue}else if(/^@else(?![a-z])/.test(d)){p.push({type:s,condition:f,content:a.substring(l,t),start:i+l,end:i+t}),s="else",f=void 0,t+=5,l=t;continue}}t++}return p.push({type:s,condition:f,content:a.slice(l),start:i+l,end:i+a.length}),{fullMatch:e.slice(r,u+6),branches:p,start:r,end:u+6}}function cn(e){let r=[],n=/@if\s*\(/g,c=n.exec(e);while(c!==null){if(r.some((u)=>c.index>u.start&&c.index<u.end)){c=n.exec(e);continue}let i=P(e,c.index);if(i)r.push(i),n.lastIndex=i.end;c=n.exec(e)}return r}function gs(e,r,n){let c=[],o=new RegExp(`@${r}\\s*\\(`,"g"),i=o.exec(e);while(i!==null){if(c.some((d)=>i.index>d.start&&i.index<d.end)){i=o.exec(e);continue}let a=i.index,p=a+i[0].length-1,t=w(e,"(",")",p);if(t===-1){i=o.exec(e);continue}let s=e.slice(p+1,t),f=t+1,l=wt(e,r,n,f);if(l===-1){i=o.exec(e);continue}let x=e.slice(f,l),h=l+`@${n}`.length;c.push({fullMatch:e.slice(a,h),name:r,params:s,content:x,start:a,end:h}),o.lastIndex=h,i=o.exec(e)}return c}function Ho(e,r){let n=e.slice(r).match(/^@switch\s*/);if(!n)return null;let c=r+n[0].length,o=Ye(e,c);if(!o)return null;let i=o.endPos,u=wt(e,"switch","endswitch",i);if(u===-1)return null;let a=e.slice(i,u),p=[],t=0,s=null,f=0;while(t<a.length){let l=a.slice(t),x=l.match(/^@switch\s*\(/),h=l.match(/^@endswitch(?![a-z])/);if(x){if(f++,s)s.content+=x[0];t+=x[0].length;continue}if(h){if(f--,s)s.content+=h[0];t+=h[0].length;continue}if(f>0){if(s)s.content+=a[t];t++;continue}let d=l.match(/^@case\s*/),g=l.match(/^@default(?![a-z])/),m=l.match(/^@break(?![a-z])/);if(d&&l.startsWith("@case")){if(s)p.push(s);let b=t+d[0].length,E=Ye(a,b);if(!E){t++;continue}s={type:"case",value:E.expression,content:""},t=E.endPos}else if(g&&l.startsWith("@default")){if(s)p.push(s);s={type:"default",content:""},t+=g[0].length}else if(m&&l.startsWith("@break"))t+=m[0].length;else{if(s)s.content+=a[t];t++}}if(s)p.push(s);return{fullMatch:e.slice(r,u+10),expression:o.expression,cases:p,start:r,end:u+10}}export{Ye,wt,cn,gs,Ho};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{s}from"./chunk-
|
|
2
|
+
import{s}from"./chunk-42zqmcnc.js";function y(e,n,i=240){return e.slice(n,n+i)}var v=[{rule:"route-params",pattern:/\blocation\s*\.\s*pathname\s*\.\s*(?:match|split)\s*\(/g,primitive:"useRoute() / useRouteParams() / useRouteParam(name)",why:"parsing the URL by hand re-implements the router and does not update on SPA navigation"},{rule:"alert",pattern:/(?<![.#\w$])(?:(?:window|globalThis)\s*\.\s*)?alert\s*\(/g,primitive:"stxAlert(message)",why:"themed, focus-trapped and non-blocking \u2014 but `await` it if the code after it "+"depended on the native dialog blocking until dismissal",reject:(e)=>/\b(?:async\s+)?function\s+alert\s*\(/.test(e)||/\b(?:const|let|var)\s+alert\s*=/.test(e)},{rule:"search-params",pattern:/new\s+URLSearchParams\s*\(/g,primitive:"useSearchParams()",why:"reactive, and writes back through the router instead of history.replaceState",reject:(e,n)=>{let i=e.indexOf("(",n);if(i===-1)return!0;let o=e.slice(i+1,e.indexOf(")",i)+1);return!/\b(?:location|search|href|url)\b/i.test(o)}},{rule:"navigate",pattern:/\blocation\s*\.\s*(?:assign|replace)\s*\(|\blocation\s*\.\s*href\s*=/g,primitive:"navigate(path) / goBack()",why:"a full document load throws away every store and the scroll position; navigate() is an SPA transition",reject:(e,n)=>/^[^\n]*?(?:['"`]\s*)?(?:mailto:|tel:|sms:|https?:\/\/|\/\/)/.test(y(e,n,160))},{rule:"fetch",pattern:/new\s+AbortController\s*\(/g,primitive:"useFetch(url) / useAsyncData(key, fn)",why:"cancellation, loading and error state are already wired; hand-rolling them is where the races live"},{rule:"polling",pattern:/setInterval\s*\(/g,primitive:"useEventSource() / useSSE() / useWebSocket() / useChannel()",why:"polling burns requests and lags; the push primitives are delivered",reject:(e,n)=>!/\bfetch\s*\(|\$fetch\b|useFetch\b|\.get\s*\(|axios\b/.test(y(e,n))},{rule:"debounce",pattern:/\bclearTimeout\s*\(/g,primitive:"useDebounce(fn, ms) / useThrottle(fn, ms)",why:"a hand-held timer handle per call site is the usual source of stale-result bugs",requires:(e)=>/setTimeout\s*\(/.test(e)},{rule:"click-outside",pattern:/document\s*\.\s*addEventListener\s*\(\s*['"](?:click|mousedown|pointerdown)['"]/g,primitive:"useClickOutside(ref, fn)",why:"the document-level listener plus the blur race is exactly what this composable exists to remove"},{rule:"focus",pattern:/\.\s*(?:getElementById|querySelector)\s*\([^)]*\)\s*(?:\?\.)?\s*\.?focus\s*\(/g,primitive:"useFocus(ref) with x-ref",why:"a query by id breaks under nested scopes and SPA navigation; a ref does not"},{rule:"clipboard",pattern:/navigator\s*\.\s*(?:clipboard|share)\b/g,primitive:"useClipboard() / useShare()",why:"permission state, the copied flag and the unsupported-browser fallback are already handled"},{rule:"watch",pattern:/\beffect\s*\(\s*\(\s*\)\s*=>\s*\{[^}]*\bvoid\s+\w+\s*\(\s*\)/g,primitive:"watch(source, cb) / watchMultiple([...], cb)",why:"the `void a(); void b()` dance is a manual dependency list; watch takes one directly"}],C=["confirm","tooltip",...v.map((e)=>e.rule)];function g(e,n){let i=1;for(let o=0;o<n;o++)if(e[o]===`
|
|
3
3
|
`)i++;return i}function b(e,n){let i=e.lastIndexOf(`
|
|
4
4
|
`,n)+1,o=e.indexOf(`
|
|
5
5
|
`,n);return e.slice(i,o===-1?e.length:o).trim().slice(0,120)}function S(e,n){let i=e.slice(0,n),o=i.lastIndexOf("function"),l=i.lastIndexOf("=>"),r=Math.max(o,l);if(r===-1)return!1;let t=e.slice(Math.max(0,r-120),r);return/\basync\b[^;{}]*$/.test(t)}function k(e){return/\b(?:async\s+)?function\s+confirm\s*\(/.test(e)||/\b(?:const|let|var)\s+confirm\s*=/.test(e)||/\bimport\s*\{[^}]*\bconfirm\b[^}]*\}/.test(e)}function A(e,n,i){if(k(e))return e;let o=/(^|[^\w$.])(?:(?:window|globalThis)\s*\.\s*)?confirm\s*\(/g,l=m(e),r="",t=0,a;while((a=o.exec(l))!==null){let c=a.index+a[1].length,u=g(e,c),d=b(e,c);if(/stxConfirm\s*\($/.test(e.slice(0,c+8)))continue;let p=S(e,c);if(i.push({file:n,line:u,rule:"confirm",applied:p,snippet:d,reason:p?void 0:"stxConfirm() returns a Promise and native confirm() is synchronous, so this needs `await` inside an async function. Rewriting it here would make the condition always true."}),p)r+=e.slice(t,c)+"await stxConfirm(",t=c+(a[0].length-a[1].length)}return r+e.slice(t)}function E(e,n,i){let o=/(<[a-z][\w-]*\b[^>]*?)\stitle=(["'])(.*?)\2/gis,l=R(e),r="",t=0,a;while((a=o.exec(l))!==null){let[c,u,d,p]=a,h=g(e,a.index),f=b(e,a.index),w=u.match(/^<([A-Za-z][\w-]*)/)?.[1]??"";if(/^[A-Z]/.test(w)){i.push({file:n,line:h,rule:"tooltip",applied:!1,snippet:f,reason:`\`title\` on <${w}> is a component prop, not an HTML attribute \u2014 `+"adding x-tooltip here would put a tooltip on a component and may duplicate text it already renders."});continue}if(/\bx-tooltip[=\s]/.test(u)||p.trim()===""){i.push({file:n,line:h,rule:"tooltip",applied:!1,snippet:f,reason:/\bx-tooltip[=\s]/.test(u)?"already has x-tooltip":"empty title"});continue}i.push({file:n,line:h,rule:"tooltip",applied:!0,snippet:f}),r+=e.slice(t,a.index)+`${u} x-tooltip=${d}${p}${d} title=${d}${p}${d}`,t=a.index+c.length}return r+e.slice(t)}function R(e){return e.replace(/<!--[\s\S]*?-->/g,(n)=>n.replace(/[^\n]/g," ")).replace(/\{\{--[\s\S]*?--\}\}/g,(n)=>n.replace(/[^\n]/g," "))}function F(e){let n=(i)=>i.replace(/[^\n]/g," ");return e.replace(/\/\*[\s\S]*?\*\//g,n).replace(/\/\/[^\n]*/g,n)}function m(e,n=!1){let i=R(e);return(n?F(i):s(i)).replace(/<script\b([^>]*)>([\s\S]*?)<\/script\s*>/gi,(l,r)=>/\bclient\b/i.test(r)?l:l.replace(/[^\n]/g," "))}function O(e,n,i,o){let l=m(e),r=m(e,!0);for(let t of v){if(!i.includes(t.rule))continue;if(t.requires&&!t.requires(e))continue;t.pattern.lastIndex=0;let a,c=/['"]/.test(t.pattern.source)?r:l;t.pattern.lastIndex=0;while((a=t.pattern.exec(c))!==null){if(t.reject?.(e,a.index))continue;o.push({file:n,line:g(e,a.index),rule:t.rule,applied:!1,snippet:b(e,a.index),reason:`${t.primitive} \u2014 ${t.why}`})}}}function q(e,n={}){let i=n.rules??C,o=n.file??"<source>",l=[];O(e,o,i,l);let r=e;if(i.includes("confirm"))r=A(r,o,l);if(i.includes("tooltip"))r=E(r,o,l);l.sort((c,u)=>c.line-u.line);let t=new Set,a=l.filter((c)=>{let u=`${c.rule}:${c.line}`;if(t.has(u))return!1;return t.add(u),!0});return{code:r,findings:a}}var x=new Set(["confirm","tooltip"]);function I(e,n){if(e.length===0)return"No hand-rolled equivalents found.";let i=e.filter((t)=>t.applied),o=e.filter((t)=>!t.applied&&x.has(t.rule)),l=e.filter((t)=>!t.applied&&!x.has(t.rule)),r=[];if(i.length>0){r.push(n?`Rewrote ${i.length} site(s):`:`Would rewrite ${i.length} site(s) (pass --fix):`);for(let t of i)r.push(` ${t.file}:${t.line} [${t.rule}] ${t.snippet}`)}if(o.length>0){r.push("",`Needs a human \u2014 ${o.length} site(s):`);for(let t of o)r.push(` ${t.file}:${t.line} [${t.rule}] ${t.snippet}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{ns,sr,Ef}from"./chunk-wk8y89q2.js";import"./chunk-9k8ztdcc.js";import"./chunk-vvs28yqw.js";import"./chunk-frybxj35.js";import"./chunk-k2ex94n8.js";import"./chunk-vv8dn70r.js";import"./chunk-kj9m0vc6.js";import"./chunk-8rk79ha1.js";import"./chunk-q3azy64b.js";import"./chunk-evxp3wmv.js";import"./chunk-f8p8ggvw.js";import{At}from"./chunk-2cbd1ew6.js";import"./chunk-wghtdgwj.js";import"./chunk-x5seqmrv.js";import"./chunk-tpfxvw4q.js";import"./chunk-4833k99b.js";import"./chunk-b51p56k5.js";export{Ef as declareBareLoopHead,At as parseLoopBinding,sr as processLoops,ns as reportDeferredLoopWarnings};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{R,t,c}from"./chunk-
|
|
3
|
-
`),n=[{obj:s,indent:-1}];for(let r of i){let o=r.replace(/#.*$/,"").trimEnd();if(!o.trim())continue;let l=o.search(/\S/);if(l===-1)continue;while(n.length>1&&n[n.length-1].indent>=l)n.pop();let u=n[n.length-1].obj,a=o.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(a){let[,,g,p]=a,f=g.trim(),m=p.trim();if(m==="")u[f]={},n.push({obj:u[f],indent:l});else u[f]=ee(m)}}return s}function ee(e){if(e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"'))return e.slice(1,-1);let s=e.toLowerCase();if(s==="true"||s==="yes")return!0;if(s==="false"||s==="no")return!1;if(s==="null"||s==="~")return null;let i=Number(e);if(!Number.isNaN(i)&&e!=="")return i;return e}function te(e){switch(e){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function re(e,s){return G(e,s)}function ne(e,s){for(let i of e){let n=i.trim(),r=n.match(/^\{(\d+)\}\s*(.*)$/);if(r){let l=Number.parseInt(r[1],10);if(s===l)return r[2];continue}let o=n.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(o){let l=Number.parseInt(o[1],10),u=o[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(o[2],10);if(s>=l&&s<=u)return o[3];continue}}if(e.length===2)return s===1?e[0].trim():e[1].trim();if(s<e.length)return e[s].trim();return e[e.length-1].trim()}function ie(e,s={}){return j(e,s)}function j(e,s){let i="",n=0;while(n<e.length)if(e[n]==="{"){let r=se(e,n);if(r===-1){i+=e[n],n++;continue}let o=e.slice(n+1,r);i+=ae(o,s),n=r+1}else if(e[n]==="'"&&n+1<e.length)if(e[n+1]==="'")i+="'",n+=2;else if(e[n+1]==="{"||e[n+1]==="}")i+=e[n+1],n+=2;else i+=e[n],n++;else i+=e[n],n++;return i}function se(e,s){let i=0;for(let n=s;n<e.length;n++)if(e[n]==="{")i++;else if(e[n]==="}"){if(i--,i===0)return n}return-1}function ae(e,s){let i=oe(e);if(i.length===0)return`{${e}}`;let n=i[0].trim(),r=s[n];if(i.length===1)return r!==void 0?String(r):`{${n}}`;switch(i[1].trim().toLowerCase()){case"plural":return le(r,i.slice(2).join(","),s);case"select":return ue(r,i.slice(2).join(","));case"selectordinal":return de(r,i.slice(2).join(","));case"number":return pe(r,i[2]?.trim());case"date":return fe(r,i[2]?.trim());case"time":return me(r,i[2]?.trim());default:return r!==void 0?String(r):`{${e}}`}}function oe(e){let s=[],i="",n=0;for(let r=0;r<e.length;r++){let o=e[r];if(o==="{")n++,i+=o;else if(o==="}")n--,i+=o;else if(o===","&&n===0)s.push(i),i="";else i+=o}if(i)s.push(i);return s}function le(e,s,i){let n=Number(e)||0,r=I(s),o=`=${n}`;if(r[o])return E(r[o],n,i);let l=ce(n);if(r[l])return E(r[l],n,i);if(r.other)return E(r.other,n,i);return String(n)}function E(e,s,i){let n=e.replace(/#/g,String(s));return j(n,i)}function ce(e){let s=Math.abs(e),i=Math.floor(s),n=String(e).includes(".")?String(e).split(".")[1].length:0;if(i===1&&n===0)return"one";return"other"}function ue(e,s){let i=String(e||""),n=I(s);if(n[i])return n[i];return n.other||String(e)}function de(e,s){let i=Number(e)||0,n=I(s),r=ge(i);if(n[r])return n[r].replace(/#/g,String(i));if(n.other)return n.other.replace(/#/g,String(i));return String(i)}function ge(e){let s=Math.abs(e),i=s%10,n=s%100;if(i===1&&n!==11)return"one";if(i===2&&n!==12)return"two";if(i===3&&n!==13)return"few";return"other"}function I(e){let s={},i=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,n=i.exec(e);while(n!==null)s[n[1]]=n[2],n=i.exec(e);return s}function pe(e,s){let i=Number(e);if(Number.isNaN(i))return String(e);switch(s){case"integer":return Math.floor(i).toLocaleString();case"percent":return`${(i*100).toFixed(0)}%`;case"currency":return i.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return i.toLocaleString()}}function fe(e,s){let i=e instanceof Date?e:new Date(String(e));if(Number.isNaN(i.getTime()))return String(e);let n={};switch(s){case"short":n.dateStyle="short";break;case"medium":n.dateStyle="medium";break;case"long":n.dateStyle="long";break;case"full":n.dateStyle="full";break;default:n.dateStyle="medium"}return i.toLocaleDateString(void 0,n)}function me(e,s){let i=e instanceof Date?e:new Date(String(e));if(Number.isNaN(i.getTime()))return String(e);let n={};switch(s){case"short":n.timeStyle="short";break;case"medium":n.timeStyle="medium";break;case"long":n.timeStyle="long";break;case"full":n.timeStyle="full";break;default:n.timeStyle="short"}return i.toLocaleTimeString(void 0,n)}function be(e){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(e)}function O(e,s,i=!0,n={}){let r=e.split("."),o=s;for(let u of r){if(o===void 0||o===null)break;o=o[u]}if(o===void 0||o===null)return i?e:"";let l=String(o);if(be(l))return ie(l,n);if(l.includes("|")&&"count"in n){let u=Number(n.count),a=l.split("|");l=ne(a,u)}for(let[u,a]of Object.entries(n)){let g=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");l=l.replace(new RegExp(`:${g}`,"g"),()=>String(a))}return l}var D=new Set(["ar","arc","ckb","dv","fa","he","khw","ks","nqo","prs","ps","sd","syr","ug","ur","uz-af","yi"]),he=new Set(["adlm","arab","aran","hebr","nkoo","rohg","syrc","thaa","yezi"]);function q(e){if(!e)return"ltr";let s=e.trim().toLowerCase().replace(/_/g,"-").split("-"),i=s[0];if(!i)return"ltr";let n=s[1]?.length===4?s[1]:void 0;if(n)return he.has(n)?"rtl":"ltr";if(s.length>1&&D.has(`${i}-${s[1]}`))return"rtl";return D.has(i)?"rtl":"ltr"}async function lc(e,s,i,n){let r=e,o=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,l={...P,...n.i18n},u=await re(l.locale,n);s.__translations=u,s.__locale=l.locale,s.__i18nConfig=l,r=await F(r,o,async(p,f,m,w,h)=>{try{let b={};if(m)try{let d=[()=>JSON.parse(m),()=>{let x=`{"data":${m}}`,A=JSON.parse(x);return typeof A.data==="object"?A.data:{}},()=>R(m,s)];for(let x of d)try{if(b=x(),Object.keys(b).length>0)break}catch{}}catch(d){if(n.debug)console.error("Error parsing parameters for @translate directive:",d)}let y=O(f,u,l.fallbackToKey,b);return y?Z(r,h,y,!1,p.length):w.trim()}catch(b){if(n.debug)console.error("Error processing @translate directive:",b);return c("Translate",`Error in @translate('${f}'): ${b instanceof Error?b.message:String(b)}`,t.EVALUATION_ERROR)}});let a=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(n.debug){console.warn(`Processing translations in template. Sections: ${r.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let p=[...r.matchAll(a)];console.warn(`Found ${p.length} @translate matches`),p.forEach((f,m)=>console.warn(`Match ${m}: ${f[0]}, Key: ${f[1]}, Params: ${f[2]||"none"}`))}return r=await F(r,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(p,f,m,w)=>{try{let h={};if(m)try{let b=[()=>JSON.parse(m),()=>{let y=`{"data":${m}}`,d=JSON.parse(y);return typeof d.data==="object"?d.data:{}},()=>R(m,s)];for(let y of b)try{if(h=y(),Object.keys(h).length>0)break}catch{}}catch(b){if(n.debug)console.error("Error parsing parameters for @translate directive:",b)}return Z(r,w,O(f,u,l.fallbackToKey,h),!1,p.length)}catch(h){if(n.debug)console.error("Error processing @translate directive:",h);return c("Translate",`Error in @translate('${f}'): ${h instanceof Error?h.message:String(h)}`,t.EVALUATION_ERROR)}}),r}async function F(e,s,i){let n=[];return e.replace(s,(o,...l)=>{let u=i(o,...l).then((a)=>({match:o,replacement:a}));return n.push(u),o}),(await Promise.all(n)).reduce((o,{match:l,replacement:u})=>o.replace(l,()=>u),e)}function _(e,s){if(!e||q(e)!=="rtl")return!1;return!s||s.trim().toLowerCase()!=="rtl"}function V(e){if(!e)return!1;return e.trim().split(/\s+/)[0]?.toLowerCase()==="presentation"||e.trim().split(/\s+/)[0]?.toLowerCase()==="none"}function U(e,s){let i=new RegExp(`\\b${s}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i").exec(e);if(!i)return null;return i[2]??i[3]??i[4]??null}function uc(e,s,i,n){let r=e;r=r.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(l,u,a)=>{let p={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[u]||"Make this element accessible";return`<!-- a11y-hint: ${a||p} -->`});let o=/@screenReader\(([^@]*)\)@endScreenReader/g;return r=r.replace(o,(l,u)=>`<span class="sr-only">${u.trim()}</span>`),r=r.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(l,u,a)=>`<span id="${`desc-${u}`}" class="sr-only">${a}</span>`),r}function ye(){return typeof globalThis.document<"u"&&typeof globalThis.document.createElement==="function"}function xe(e){let s=new Map,i=e.replace(/<(\/?)([A-Z][\w:.-]*)(?=[\s/>])/g,(r,o,l)=>{let u=s.get(l);if(!u)u=`stx-a11y-component-${s.size}`,s.set(l,u);return`<${o}${u}`}),n=new Map([...s.entries()].map(([r,o])=>[o,r]));return{protectedSource:i,restore:(r)=>r.replace(/<(\/?)(stx-a11y-component-\d+)(?=[\s/>])/g,(o,l,u)=>{let a=n.get(u);return a?`<${l}${a}`:o})}}function we(e,s){let i=[],n=/<img\s+([^>]*)>/gi,r;r=n.exec(e);while(r!==null){let d=r[1];if(!/\balt\s*=/i.test(d))i.push({type:"missing-alt",element:r[0].substring(0,100),message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"});r=n.exec(e)}let o=/<button([^>]*)>\s*<\/button>/gi;r=o.exec(e);while(r!==null){let d=r[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))i.push({type:"missing-accessible-name",element:r[0].substring(0,100),message:"Empty button missing accessible name",impact:"critical",help:"Add text content, aria-label, or title",helpUrl:"https://web.dev/learn/accessibility/aria-html/"});r=o.exec(e)}let l=/<a\s+([^>]*)>\s*<\/a>/gi;r=l.exec(e);while(r!==null){let d=r[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))i.push({type:"link-missing-text",element:r[0].substring(0,100),message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"});r=l.exec(e)}let u=/<(input|select|textarea)\s+([^>]*)>/gi;r=u.exec(e);while(r!==null){let d=r[2];if(/\btype\s*=\s*["']hidden["']/i.test(d)){r=u.exec(e);continue}let x=/\baria-label\s*=/i.test(d)||/\baria-labelledby\s*=/i.test(d),A=d.match(/\bid\s*=\s*["']([^"']+)["']/i);if(!x){let B=A&&new RegExp(`<label[^>]*\\bfor\\s*=\\s*["']${A[1]}["']`,"i").test(e),M=r.index,N=e.substring(0,M),Se=e.substring(M),H=(N.match(/<label\b/gi)||[]).length,z=(N.match(/<\/label>/gi)||[]).length,K=H>z;if(!B&&!K)i.push({type:"input-missing-label",element:r[0].substring(0,100),message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})}r=u.exec(e)}let a=/<h([1-6])[^>]*>/gi,g=[];r=a.exec(e);while(r!==null)g.push(Number.parseInt(r[1],10)),r=a.exec(e);let p=0;for(let d of g){if(p>0&&d>p+1)i.push({type:"heading-skip",element:`<h${d}>`,message:`Heading level skipped from h${p} to h${d}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});p=d}if(/<html\b/i.test(e)&&!/<html[^>]*\slang\s*=/i.test(e))i.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});let f=e.match(/<html\b([^>]*)>/i);if(f&&_(U(f[1],"lang"),U(f[1],"dir")))i.push({type:"missing-dir",element:f[0].substring(0,100),message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});let m=/<table([^>]*)>([\s\S]*?)<\/table>/gi;r=m.exec(e);while(r!==null){let d=r[2];if(!V(U(r[1],"role"))&&!/<th\b/i.test(d))i.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});r=m.exec(e)}let w=/<(video|audio)[^>]*\sautoplay\s[^>]*>/gi;r=w.exec(e);while(r!==null){if(!/\bmuted\b/i.test(r[0]))i.push({type:"autoplay-audio",element:`<${r[1]}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"});r=w.exec(e)}let h=/\btabindex\s*=\s*["']([1-9]\d*)["']/gi;r=h.exec(e);while(r!==null)i.push({type:"positive-tabindex",element:`tabindex="${r[1]}"`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"}),r=h.exec(e);let b=/<iframe\s+([^>]*)>/gi;r=b.exec(e);while(r!==null){let d=r[1];if(!/\btitle\s*=/i.test(d)&&!/\baria-label\s*=/i.test(d))i.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"});r=b.exec(e)}let y=/<([a-z]+)\s+([^>]*role\s*=\s*["']button["'][^>]*)>/gi;r=y.exec(e);while(r!==null){let d=r[1].toLowerCase(),x=r[2];if(d!=="button"&&!/\btabindex\s*=/i.test(x))i.push({type:"button-not-focusable",element:r[0].substring(0,100),message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"});r=y.exec(e)}return i}async function Ae(e,s){let{protectedSource:i}=xe(e);if(!ye())return we(i,s);let n=[];try{let r=globalThis.document.createElement("div");r.innerHTML=i,r.querySelectorAll("img").forEach((a)=>{if(!a.hasAttribute("alt"))n.push({type:"missing-alt",element:`<${a.outerHTML}>`,message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"})}),r.querySelectorAll('button, a, [role="button"]').forEach((a)=>{if(!(a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby")||a.textContent&&a.textContent.trim().length>0))n.push({type:"missing-accessible-name",element:`<${a.outerHTML}>`,message:"Interactive element missing accessible name",impact:"critical",help:"Add text content, aria-label, or aria-labelledby",helpUrl:"https://web.dev/learn/accessibility/aria-html/"})}),r.querySelectorAll("input, select, textarea").forEach((a)=>{let g=a.getAttribute("id"),p=g&&r.querySelector(`label[for="${g}"]`),f=a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby"),m=a.closest("label")!==null;if(!p&&!f&&!m)n.push({type:"input-missing-label",element:`<${a.outerHTML}>`,message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})});let o=Array.from(r.querySelectorAll("h1, h2, h3, h4, h5, h6")),l=0;for(let a of o){let g=Number.parseInt(a.tagName.charAt(1));if(l>0&&g>l+1)n.push({type:"heading-skip",element:`<${a.outerHTML}>`,message:`Heading level skipped from h${l} to h${g}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});l=g}let u=r.querySelector("html");if(i.includes("<html")&&u&&!u.hasAttribute("lang"))n.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});if(u&&_(u.getAttribute("lang"),u.getAttribute("dir")))n.push({type:"missing-dir",element:"<html>",message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});if(r.querySelectorAll("a").forEach((a)=>{let g=a.textContent&&a.textContent.trim().length>0,p=a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby"),f=a.hasAttribute("title"),m=a.querySelector("img[alt]");if(!g&&!p&&!f&&!m)n.push({type:"link-missing-text",element:`<${a.outerHTML}>`,message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"})}),i.includes("<nav")||i.includes("<header")){if(!r.querySelector('a[href="#main"], a[href="#content"], .skip-link, [class*="skip"]')&&r.querySelectorAll("a").length>5)n.push({type:"missing-skip-link",element:"<nav>",message:"Consider adding a skip navigation link",impact:"minor",help:"Add a skip link to allow keyboard users to bypass navigation",helpUrl:"https://web.dev/learn/accessibility/focus/#skip-links"})}if(r.querySelectorAll("table").forEach((a)=>{if(V(a.getAttribute("role")))return;let g=a.querySelector("caption");if(!a.querySelector("th"))n.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});if(!g&&!a.hasAttribute("aria-label")&&!a.hasAttribute("aria-labelledby"))n.push({type:"table-missing-caption",element:"<table>",message:"Table missing caption or accessible name",impact:"minor",help:"Add a caption element or aria-label to describe the table",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"})}),r.querySelectorAll('[style*="color"]').forEach((a)=>{let g=a.getAttribute("style")||"";if(g.includes("color:")&&!g.includes("background"))n.push({type:"potential-contrast-issue",element:`<${a.tagName.toLowerCase()}>`,message:"Element has inline color style - verify contrast ratio",impact:"minor",help:"Ensure text has sufficient contrast ratio (4.5:1 for normal text)",helpUrl:"https://web.dev/learn/accessibility/color-contrast/"})}),r.querySelectorAll("video[autoplay], audio[autoplay]").forEach((a)=>{if(!a.hasAttribute("muted"))n.push({type:"autoplay-audio",element:`<${a.tagName.toLowerCase()}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"})}),r.querySelectorAll("[tabindex]").forEach((a)=>{if(Number.parseInt(a.getAttribute("tabindex")||"0")>0)n.push({type:"positive-tabindex",element:`<${a.tagName.toLowerCase()}>`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"})}),r.querySelectorAll('[role="button"]').forEach((a)=>{if(!a.hasAttribute("tabindex"))n.push({type:"button-not-focusable",element:`<${a.outerHTML}>`,message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"})}),i.includes("<body")&&!r.querySelector('main, [role="main"]'))n.push({type:"missing-main-landmark",element:"<body>",message:"Document missing main landmark region",impact:"moderate",help:"Add a main element to identify the primary content",helpUrl:"https://web.dev/learn/accessibility/structure/#landmarks"});r.querySelectorAll("iframe").forEach((a)=>{if(!a.hasAttribute("title")&&!a.hasAttribute("aria-label"))n.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"})})}catch(r){console.error(`Error checking accessibility in ${s}:`,r)}return n}async function dc(e,s={}){let i={},{recursive:n=!0,ignorePaths:r=[]}=s,o=Array.isArray(e)?e:[e],l=await Vo(o,{recursive:n,ignorePaths:r}),u=[];for(let a of l)try{let g=await Bun.file(a).text();if(a.endsWith("good-a11y.stx"))continue;let p=await Ae(g,a);if(u.push(a),p.length>0)i[a]=p}catch(g){console.error(`Error scanning ${a}:`,g)}return{results:i,scannedFiles:u}}var pc={name:"a11y",handler:(e,s,i,n)=>{if(!s.length)return e;let r=s[0].replace(/['"]/g,""),o=s.length>1?s[1].replace(/['"]/g,""):"",u={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[r]||"Make this element accessible";return`<!-- a11y-hint: ${o||u} -->${e}`},hasEndTag:!1},fc={name:"screenReader",handler:(e)=>`<span class="sr-only">${e}</span>`,hasEndTag:!0};
|
|
4
|
-
export{
|
|
2
|
+
import{R,t,c}from"./chunk-tpfxvw4q.js";import{Z}from"./chunk-2cbd1ew6.js";import{Wo}from"./chunk-8rk79ha1.js";import C from"path";var S;async function W(){if(S!==void 0)return S;try{let e=await import("@stacksjs/ts-i18n");S=e.loadLocale??null}catch{S=null}return S}var P={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},v={},L={},k={};function J(e,s=0){if(s<=0)return!1;return Date.now()-e.loadedAt>s}async function G(e,s){if({...P,...s.i18n}.cache&&v[e]){let r=v[e],o=s.i18n?.cacheMaxAge??0;if(!J(r,o))return r.translations}if(L[e]?.state==="loading")return L[e].promise;k[e]="loading";let n=T(e,s).then((r)=>(k[e]="loaded",delete L[e],r)).catch((r)=>{throw k[e]="error",L[e]={promise:n,state:"error",error:r instanceof Error?r:Error(String(r))},r});return L[e]={promise:n,state:"loading"},n}async function T(e,s){let i={...P,...s.i18n},n=C.isAbsolute(i.translationsDir)?i.translationsDir:C.resolve(s.root||process.cwd(),i.translationsDir);try{let r=await W(),o=r?await r(e,{translationsDir:n,defaultLocale:i.defaultLocale,sources:te(i.format)}):await Y(e,i,n);if(o===void 0){let u=e!==i.defaultLocale?await T(i.defaultLocale,s):{};if(i.cache)v[e]={translations:u,loadedAt:Date.now(),locale:e};return u}let l=o;if(i.cache)v[e]={translations:l,loadedAt:Date.now(),locale:e};return l}catch(r){if(s.debug)console.error(`Error loading translation file for locale "${e}":`,r);if(e!==i.defaultLocale)return T(i.defaultLocale,s);return{}}}async function Y(e,s,i){let n=C.join(i,`${e}${Q(s.format)}`);try{let r=await import(n);return r.default||r}catch(r){try{let o=await Bun.file(n).text();if(s.format==="yaml"||s.format==="yml")return X(o);if(s.format==="json")return JSON.parse(o);throw r}catch{return}}}function Q(e){switch(e){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function X(e){let s={},i=e.split(`
|
|
3
|
+
`),n=[{obj:s,indent:-1}];for(let r of i){let o=r.replace(/#.*$/,"").trimEnd();if(!o.trim())continue;let l=o.search(/\S/);if(l===-1)continue;while(n.length>1&&n[n.length-1].indent>=l)n.pop();let u=n[n.length-1].obj,a=o.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(a){let[,,g,p]=a,f=g.trim(),m=p.trim();if(m==="")u[f]={},n.push({obj:u[f],indent:l});else u[f]=ee(m)}}return s}function ee(e){if(e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"'))return e.slice(1,-1);let s=e.toLowerCase();if(s==="true"||s==="yes")return!0;if(s==="false"||s==="no")return!1;if(s==="null"||s==="~")return null;let i=Number(e);if(!Number.isNaN(i)&&e!=="")return i;return e}function te(e){switch(e){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function re(e,s){return G(e,s)}function ne(e,s){for(let i of e){let n=i.trim(),r=n.match(/^\{(\d+)\}\s*(.*)$/);if(r){let l=Number.parseInt(r[1],10);if(s===l)return r[2];continue}let o=n.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(o){let l=Number.parseInt(o[1],10),u=o[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(o[2],10);if(s>=l&&s<=u)return o[3];continue}}if(e.length===2)return s===1?e[0].trim():e[1].trim();if(s<e.length)return e[s].trim();return e[e.length-1].trim()}function ie(e,s={}){return j(e,s)}function j(e,s){let i="",n=0;while(n<e.length)if(e[n]==="{"){let r=se(e,n);if(r===-1){i+=e[n],n++;continue}let o=e.slice(n+1,r);i+=ae(o,s),n=r+1}else if(e[n]==="'"&&n+1<e.length)if(e[n+1]==="'")i+="'",n+=2;else if(e[n+1]==="{"||e[n+1]==="}")i+=e[n+1],n+=2;else i+=e[n],n++;else i+=e[n],n++;return i}function se(e,s){let i=0;for(let n=s;n<e.length;n++)if(e[n]==="{")i++;else if(e[n]==="}"){if(i--,i===0)return n}return-1}function ae(e,s){let i=oe(e);if(i.length===0)return`{${e}}`;let n=i[0].trim(),r=s[n];if(i.length===1)return r!==void 0?String(r):`{${n}}`;switch(i[1].trim().toLowerCase()){case"plural":return le(r,i.slice(2).join(","),s);case"select":return ue(r,i.slice(2).join(","));case"selectordinal":return de(r,i.slice(2).join(","));case"number":return pe(r,i[2]?.trim());case"date":return fe(r,i[2]?.trim());case"time":return me(r,i[2]?.trim());default:return r!==void 0?String(r):`{${e}}`}}function oe(e){let s=[],i="",n=0;for(let r=0;r<e.length;r++){let o=e[r];if(o==="{")n++,i+=o;else if(o==="}")n--,i+=o;else if(o===","&&n===0)s.push(i),i="";else i+=o}if(i)s.push(i);return s}function le(e,s,i){let n=Number(e)||0,r=I(s),o=`=${n}`;if(r[o])return E(r[o],n,i);let l=ce(n);if(r[l])return E(r[l],n,i);if(r.other)return E(r.other,n,i);return String(n)}function E(e,s,i){let n=e.replace(/#/g,String(s));return j(n,i)}function ce(e){let s=Math.abs(e),i=Math.floor(s),n=String(e).includes(".")?String(e).split(".")[1].length:0;if(i===1&&n===0)return"one";return"other"}function ue(e,s){let i=String(e||""),n=I(s);if(n[i])return n[i];return n.other||String(e)}function de(e,s){let i=Number(e)||0,n=I(s),r=ge(i);if(n[r])return n[r].replace(/#/g,String(i));if(n.other)return n.other.replace(/#/g,String(i));return String(i)}function ge(e){let s=Math.abs(e),i=s%10,n=s%100;if(i===1&&n!==11)return"one";if(i===2&&n!==12)return"two";if(i===3&&n!==13)return"few";return"other"}function I(e){let s={},i=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,n=i.exec(e);while(n!==null)s[n[1]]=n[2],n=i.exec(e);return s}function pe(e,s){let i=Number(e);if(Number.isNaN(i))return String(e);switch(s){case"integer":return Math.floor(i).toLocaleString();case"percent":return`${(i*100).toFixed(0)}%`;case"currency":return i.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return i.toLocaleString()}}function fe(e,s){let i=e instanceof Date?e:new Date(String(e));if(Number.isNaN(i.getTime()))return String(e);let n={};switch(s){case"short":n.dateStyle="short";break;case"medium":n.dateStyle="medium";break;case"long":n.dateStyle="long";break;case"full":n.dateStyle="full";break;default:n.dateStyle="medium"}return i.toLocaleDateString(void 0,n)}function me(e,s){let i=e instanceof Date?e:new Date(String(e));if(Number.isNaN(i.getTime()))return String(e);let n={};switch(s){case"short":n.timeStyle="short";break;case"medium":n.timeStyle="medium";break;case"long":n.timeStyle="long";break;case"full":n.timeStyle="full";break;default:n.timeStyle="short"}return i.toLocaleTimeString(void 0,n)}function be(e){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(e)}function O(e,s,i=!0,n={}){let r=e.split("."),o=s;for(let u of r){if(o===void 0||o===null)break;o=o[u]}if(o===void 0||o===null)return i?e:"";let l=String(o);if(be(l))return ie(l,n);if(l.includes("|")&&"count"in n){let u=Number(n.count),a=l.split("|");l=ne(a,u)}for(let[u,a]of Object.entries(n)){let g=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");l=l.replace(new RegExp(`:${g}`,"g"),()=>String(a))}return l}var D=new Set(["ar","arc","ckb","dv","fa","he","khw","ks","nqo","prs","ps","sd","syr","ug","ur","uz-af","yi"]),he=new Set(["adlm","arab","aran","hebr","nkoo","rohg","syrc","thaa","yezi"]);function q(e){if(!e)return"ltr";let s=e.trim().toLowerCase().replace(/_/g,"-").split("-"),i=s[0];if(!i)return"ltr";let n=s[1]?.length===4?s[1]:void 0;if(n)return he.has(n)?"rtl":"ltr";if(s.length>1&&D.has(`${i}-${s[1]}`))return"rtl";return D.has(i)?"rtl":"ltr"}async function uc(e,s,i,n){let r=e,o=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,l={...P,...n.i18n},u=await re(l.locale,n);s.__translations=u,s.__locale=l.locale,s.__i18nConfig=l,r=await F(r,o,async(p,f,m,w,h)=>{try{let b={};if(m)try{let d=[()=>JSON.parse(m),()=>{let x=`{"data":${m}}`,A=JSON.parse(x);return typeof A.data==="object"?A.data:{}},()=>R(m,s)];for(let x of d)try{if(b=x(),Object.keys(b).length>0)break}catch{}}catch(d){if(n.debug)console.error("Error parsing parameters for @translate directive:",d)}let y=O(f,u,l.fallbackToKey,b);return y?Z(r,h,y,!1,p.length):w.trim()}catch(b){if(n.debug)console.error("Error processing @translate directive:",b);return c("Translate",`Error in @translate('${f}'): ${b instanceof Error?b.message:String(b)}`,t.EVALUATION_ERROR)}});let a=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(n.debug){console.warn(`Processing translations in template. Sections: ${r.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let p=[...r.matchAll(a)];console.warn(`Found ${p.length} @translate matches`),p.forEach((f,m)=>console.warn(`Match ${m}: ${f[0]}, Key: ${f[1]}, Params: ${f[2]||"none"}`))}return r=await F(r,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(p,f,m,w)=>{try{let h={};if(m)try{let b=[()=>JSON.parse(m),()=>{let y=`{"data":${m}}`,d=JSON.parse(y);return typeof d.data==="object"?d.data:{}},()=>R(m,s)];for(let y of b)try{if(h=y(),Object.keys(h).length>0)break}catch{}}catch(b){if(n.debug)console.error("Error parsing parameters for @translate directive:",b)}return Z(r,w,O(f,u,l.fallbackToKey,h),!1,p.length)}catch(h){if(n.debug)console.error("Error processing @translate directive:",h);return c("Translate",`Error in @translate('${f}'): ${h instanceof Error?h.message:String(h)}`,t.EVALUATION_ERROR)}}),r}async function F(e,s,i){let n=[];return e.replace(s,(o,...l)=>{let u=i(o,...l).then((a)=>({match:o,replacement:a}));return n.push(u),o}),(await Promise.all(n)).reduce((o,{match:l,replacement:u})=>o.replace(l,()=>u),e)}function _(e,s){if(!e||q(e)!=="rtl")return!1;return!s||s.trim().toLowerCase()!=="rtl"}function V(e){if(!e)return!1;return e.trim().split(/\s+/)[0]?.toLowerCase()==="presentation"||e.trim().split(/\s+/)[0]?.toLowerCase()==="none"}function U(e,s){let i=new RegExp(`\\b${s}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i").exec(e);if(!i)return null;return i[2]??i[3]??i[4]??null}function dc(e,s,i,n){let r=e;r=r.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(l,u,a)=>{let p={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[u]||"Make this element accessible";return`<!-- a11y-hint: ${a||p} -->`});let o=/@screenReader\(([^@]*)\)@endScreenReader/g;return r=r.replace(o,(l,u)=>`<span class="sr-only">${u.trim()}</span>`),r=r.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(l,u,a)=>`<span id="${`desc-${u}`}" class="sr-only">${a}</span>`),r}function ye(){return typeof globalThis.document<"u"&&typeof globalThis.document.createElement==="function"}function xe(e){let s=new Map,i=e.replace(/<(\/?)([A-Z][\w:.-]*)(?=[\s/>])/g,(r,o,l)=>{let u=s.get(l);if(!u)u=`stx-a11y-component-${s.size}`,s.set(l,u);return`<${o}${u}`}),n=new Map([...s.entries()].map(([r,o])=>[o,r]));return{protectedSource:i,restore:(r)=>r.replace(/<(\/?)(stx-a11y-component-\d+)(?=[\s/>])/g,(o,l,u)=>{let a=n.get(u);return a?`<${l}${a}`:o})}}function we(e,s){let i=[],n=/<img\s+([^>]*)>/gi,r;r=n.exec(e);while(r!==null){let d=r[1];if(!/\balt\s*=/i.test(d))i.push({type:"missing-alt",element:r[0].substring(0,100),message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"});r=n.exec(e)}let o=/<button([^>]*)>\s*<\/button>/gi;r=o.exec(e);while(r!==null){let d=r[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))i.push({type:"missing-accessible-name",element:r[0].substring(0,100),message:"Empty button missing accessible name",impact:"critical",help:"Add text content, aria-label, or title",helpUrl:"https://web.dev/learn/accessibility/aria-html/"});r=o.exec(e)}let l=/<a\s+([^>]*)>\s*<\/a>/gi;r=l.exec(e);while(r!==null){let d=r[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))i.push({type:"link-missing-text",element:r[0].substring(0,100),message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"});r=l.exec(e)}let u=/<(input|select|textarea)\s+([^>]*)>/gi;r=u.exec(e);while(r!==null){let d=r[2];if(/\btype\s*=\s*["']hidden["']/i.test(d)){r=u.exec(e);continue}let x=/\baria-label\s*=/i.test(d)||/\baria-labelledby\s*=/i.test(d),A=d.match(/\bid\s*=\s*["']([^"']+)["']/i);if(!x){let B=A&&new RegExp(`<label[^>]*\\bfor\\s*=\\s*["']${A[1]}["']`,"i").test(e),M=r.index,N=e.substring(0,M),Se=e.substring(M),H=(N.match(/<label\b/gi)||[]).length,z=(N.match(/<\/label>/gi)||[]).length,K=H>z;if(!B&&!K)i.push({type:"input-missing-label",element:r[0].substring(0,100),message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})}r=u.exec(e)}let a=/<h([1-6])[^>]*>/gi,g=[];r=a.exec(e);while(r!==null)g.push(Number.parseInt(r[1],10)),r=a.exec(e);let p=0;for(let d of g){if(p>0&&d>p+1)i.push({type:"heading-skip",element:`<h${d}>`,message:`Heading level skipped from h${p} to h${d}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});p=d}if(/<html\b/i.test(e)&&!/<html[^>]*\slang\s*=/i.test(e))i.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});let f=e.match(/<html\b([^>]*)>/i);if(f&&_(U(f[1],"lang"),U(f[1],"dir")))i.push({type:"missing-dir",element:f[0].substring(0,100),message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});let m=/<table([^>]*)>([\s\S]*?)<\/table>/gi;r=m.exec(e);while(r!==null){let d=r[2];if(!V(U(r[1],"role"))&&!/<th\b/i.test(d))i.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});r=m.exec(e)}let w=/<(video|audio)[^>]*\sautoplay\s[^>]*>/gi;r=w.exec(e);while(r!==null){if(!/\bmuted\b/i.test(r[0]))i.push({type:"autoplay-audio",element:`<${r[1]}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"});r=w.exec(e)}let h=/\btabindex\s*=\s*["']([1-9]\d*)["']/gi;r=h.exec(e);while(r!==null)i.push({type:"positive-tabindex",element:`tabindex="${r[1]}"`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"}),r=h.exec(e);let b=/<iframe\s+([^>]*)>/gi;r=b.exec(e);while(r!==null){let d=r[1];if(!/\btitle\s*=/i.test(d)&&!/\baria-label\s*=/i.test(d))i.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"});r=b.exec(e)}let y=/<([a-z]+)\s+([^>]*role\s*=\s*["']button["'][^>]*)>/gi;r=y.exec(e);while(r!==null){let d=r[1].toLowerCase(),x=r[2];if(d!=="button"&&!/\btabindex\s*=/i.test(x))i.push({type:"button-not-focusable",element:r[0].substring(0,100),message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"});r=y.exec(e)}return i}async function Ae(e,s){let{protectedSource:i}=xe(e);if(!ye())return we(i,s);let n=[];try{let r=globalThis.document.createElement("div");r.innerHTML=i,r.querySelectorAll("img").forEach((a)=>{if(!a.hasAttribute("alt"))n.push({type:"missing-alt",element:`<${a.outerHTML}>`,message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"})}),r.querySelectorAll('button, a, [role="button"]').forEach((a)=>{if(!(a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby")||a.textContent&&a.textContent.trim().length>0))n.push({type:"missing-accessible-name",element:`<${a.outerHTML}>`,message:"Interactive element missing accessible name",impact:"critical",help:"Add text content, aria-label, or aria-labelledby",helpUrl:"https://web.dev/learn/accessibility/aria-html/"})}),r.querySelectorAll("input, select, textarea").forEach((a)=>{let g=a.getAttribute("id"),p=g&&r.querySelector(`label[for="${g}"]`),f=a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby"),m=a.closest("label")!==null;if(!p&&!f&&!m)n.push({type:"input-missing-label",element:`<${a.outerHTML}>`,message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})});let o=Array.from(r.querySelectorAll("h1, h2, h3, h4, h5, h6")),l=0;for(let a of o){let g=Number.parseInt(a.tagName.charAt(1));if(l>0&&g>l+1)n.push({type:"heading-skip",element:`<${a.outerHTML}>`,message:`Heading level skipped from h${l} to h${g}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});l=g}let u=r.querySelector("html");if(i.includes("<html")&&u&&!u.hasAttribute("lang"))n.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});if(u&&_(u.getAttribute("lang"),u.getAttribute("dir")))n.push({type:"missing-dir",element:"<html>",message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});if(r.querySelectorAll("a").forEach((a)=>{let g=a.textContent&&a.textContent.trim().length>0,p=a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby"),f=a.hasAttribute("title"),m=a.querySelector("img[alt]");if(!g&&!p&&!f&&!m)n.push({type:"link-missing-text",element:`<${a.outerHTML}>`,message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"})}),i.includes("<nav")||i.includes("<header")){if(!r.querySelector('a[href="#main"], a[href="#content"], .skip-link, [class*="skip"]')&&r.querySelectorAll("a").length>5)n.push({type:"missing-skip-link",element:"<nav>",message:"Consider adding a skip navigation link",impact:"minor",help:"Add a skip link to allow keyboard users to bypass navigation",helpUrl:"https://web.dev/learn/accessibility/focus/#skip-links"})}if(r.querySelectorAll("table").forEach((a)=>{if(V(a.getAttribute("role")))return;let g=a.querySelector("caption");if(!a.querySelector("th"))n.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});if(!g&&!a.hasAttribute("aria-label")&&!a.hasAttribute("aria-labelledby"))n.push({type:"table-missing-caption",element:"<table>",message:"Table missing caption or accessible name",impact:"minor",help:"Add a caption element or aria-label to describe the table",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"})}),r.querySelectorAll('[style*="color"]').forEach((a)=>{let g=a.getAttribute("style")||"";if(g.includes("color:")&&!g.includes("background"))n.push({type:"potential-contrast-issue",element:`<${a.tagName.toLowerCase()}>`,message:"Element has inline color style - verify contrast ratio",impact:"minor",help:"Ensure text has sufficient contrast ratio (4.5:1 for normal text)",helpUrl:"https://web.dev/learn/accessibility/color-contrast/"})}),r.querySelectorAll("video[autoplay], audio[autoplay]").forEach((a)=>{if(!a.hasAttribute("muted"))n.push({type:"autoplay-audio",element:`<${a.tagName.toLowerCase()}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"})}),r.querySelectorAll("[tabindex]").forEach((a)=>{if(Number.parseInt(a.getAttribute("tabindex")||"0")>0)n.push({type:"positive-tabindex",element:`<${a.tagName.toLowerCase()}>`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"})}),r.querySelectorAll('[role="button"]').forEach((a)=>{if(!a.hasAttribute("tabindex"))n.push({type:"button-not-focusable",element:`<${a.outerHTML}>`,message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"})}),i.includes("<body")&&!r.querySelector('main, [role="main"]'))n.push({type:"missing-main-landmark",element:"<body>",message:"Document missing main landmark region",impact:"moderate",help:"Add a main element to identify the primary content",helpUrl:"https://web.dev/learn/accessibility/structure/#landmarks"});r.querySelectorAll("iframe").forEach((a)=>{if(!a.hasAttribute("title")&&!a.hasAttribute("aria-label"))n.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"})})}catch(r){console.error(`Error checking accessibility in ${s}:`,r)}return n}async function pc(e,s={}){let i={},{recursive:n=!0,ignorePaths:r=[]}=s,o=Array.isArray(e)?e:[e],l=await Wo(o,{recursive:n,ignorePaths:r}),u=[];for(let a of l)try{let g=await Bun.file(a).text();if(a.endsWith("good-a11y.stx"))continue;let p=await Ae(g,a);if(u.push(a),p.length>0)i[a]=p}catch(g){console.error(`Error scanning ${a}:`,g)}return{results:i,scannedFiles:u}}var fc={name:"a11y",handler:(e,s,i,n)=>{if(!s.length)return e;let r=s[0].replace(/['"]/g,""),o=s.length>1?s[1].replace(/['"]/g,""):"",u={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[r]||"Make this element accessible";return`<!-- a11y-hint: ${o||u} -->${e}`},hasEndTag:!1},gc={name:"screenReader",handler:(e)=>`<span class="sr-only">${e}</span>`,hasEndTag:!0};
|
|
4
|
+
export{uc,dc,pc,fc,gc};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ko,Go,Xo,Jo,ws,vs,Dh,Mh,Lh,jh,xs,Bh}from"./chunk-evxp3wmv.js";import"./chunk-tpfxvw4q.js";export{Bh as generateDefaultRobotsTxt,xs as generateRobotsTxt,Mh as generateSitemap,Lh as generateSitemapIndex,Jo as injectSeoTags,ws as metaDirective,Ko as processMetaDirectives,Xo as processSeoDirective,Go as processStructuredData,Dh as registerSeoDirectives,jh as scanForSitemapEntries,vs as structuredDataDirective};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
export{Q,ee,te,
|
|
2
|
+
import{qe,re,Wa}from"./chunk-r8zhed35.js";import v from"fs";import g from"path";import V from"crypto";import{generatePlaceholder as T,processImage as L}from"ts-images";var Q=[320,640,768,1024,1280,1536,1920],ee=["webp","jpeg"],te=80,D=[".jpg",".jpeg",".png",".webp",".avif",".gif",".svg"],U={webp:"image/webp",avif:"image/avif",jpeg:"image/jpeg",png:"image/png"},I=null,M=!1;async function d(){if(M)return I;M=!0;try{let t=await import("sharp");return I=t.default||t,I}catch{return null}}async function On(){return await d()!==null}async function me(){return!0}async function Te(t,e={}){let{widths:a=Q,formats:r=ee,quality:n=te,fit:c="cover",placeholder:i="none",outputDir:m=".stx/images",baseUrl:s="/images"}=e,h,l;if(typeof t==="string"){if(l=t,!await Bun.file(t).exists())throw new Wr(`Image not found: ${t}`,"NOT_FOUND");h=await Bun.file(t).arrayBuffer().then((o)=>Buffer.from(o))}else l="buffer-input",h=t;let b=V.createHash("sha256").update(h).digest("hex").slice(0,12),j=await Ur(h),{width:u,height:x}=j,F=u/x;await v.promises.mkdir(m,{recursive:!0});let B=[],A=g.basename(l,g.extname(l)),f=a.filter((o)=>o<=u);if(!f.includes(u)&&u<=Math.max(...a))f.push(u);f.sort((o,p)=>o-p);for(let o of f){let p=Math.round(o/F);for(let w of r){let S=`${A}-${o}w-${b}.${w}`,P=g.join(m,S),q=`${s}/${S}`,E=await Bl(h,{width:o,height:p,format:w,quality:n,fit:c});await Bun.write(P,E),B.push({path:P,url:q,width:o,height:p,format:w,size:E.length})}}let y;if(i!=="none")y=await k(h,i);return{src:l,variants:B,placeholder:y,width:u,height:x,aspectRatio:F,hash:b}}async function Ur(t){let e=typeof t==="string"?Buffer.from(await Bun.file(t).arrayBuffer()):t,a=await d();if(a){let n=await a(e).metadata();return{width:n.width||0,height:n.height||0,format:n.format||"unknown",hasAlpha:n.hasAlpha}}return R(e)}function R(t){if(t[0]===137&&t[1]===80&&t[2]===78&&t[3]===71){let e=t.readUInt32BE(16),a=t.readUInt32BE(20);return{width:e,height:a,format:"png",hasAlpha:!0}}if(t[0]===255&&t[1]===216){let e=2;while(e<t.length){if(t[e]!==255)break;let a=t[e+1];if(a>=192&&a<=207&&a!==196&&a!==200&&a!==204){let n=t.readUInt16BE(e+5);return{width:t.readUInt16BE(e+7),height:n,format:"jpeg",hasAlpha:!1}}let r=t.readUInt16BE(e+2);e+=2+r}}if(t.toString("utf8",0,4)==="RIFF"&&t.toString("utf8",8,12)==="WEBP"){let e=t.toString("utf8",12,16);if(e==="VP8 "){let a=t.readUInt16LE(26)&16383,r=t.readUInt16LE(28)&16383;return{width:a,height:r,format:"webp",hasAlpha:!1}}if(e==="VP8L"){let a=t.readUInt32LE(21),r=(a&16383)+1,n=(a>>14&16383)+1;return{width:r,height:n,format:"webp",hasAlpha:!0}}}if(t.toString("utf8",0,3)==="GIF"){let e=t.readUInt16LE(6),a=t.readUInt16LE(8);return{width:e,height:a,format:"gif",hasAlpha:!0}}throw new Wr("Unable to parse image dimensions","PARSE_ERROR")}async function Bl(t,e){let a=await d();if(a){let r=a(t).resize(e.width,e.height,{fit:e.fit});switch(e.format){case"webp":r=r.webp({quality:e.quality});break;case"avif":r=r.avif({quality:e.quality});break;case"jpeg":r=r.jpeg({quality:e.quality});break;case"png":r=r.png({quality:e.quality});break}return r.toBuffer()}return await Wa("img",async(r)=>{let n=g.join(r,`out.${e.format}`);return await L({input:t,output:n,format:e.format,quality:e.quality,resize:{width:e.width,height:e.height,fit:e.fit}}),Buffer.from(await Bun.file(n).arrayBuffer())})}async function k(t,e){let a=await d();if(e==="blur"&&a){let m=(await a(t).resize(20).blur(10).toBuffer()).toString("base64"),s=await Ur(t);return`data:${U[s.format]||"image/jpeg"};base64,${m}`}if(e==="dominant-color"&&a){let{dominant:i}=await a(t).resize(1,1).toBuffer().then(async(m)=>{let s=await a(m).metadata();return{dominant:{r:128,g:128,b:128}}}).catch(()=>({dominant:{r:128,g:128,b:128}}));return`rgb(${i.r}, ${i.g}, ${i.b})`}let r=await Ur(t),n=qe("ph"),c=g.join(n,`in.${r.format==="unknown"?"bin":r.format}`);try{await Bun.write(c,t);let i=e==="blur"?"blur":e==="thumbhash"?"thumbhash":"dominant-color",s=await T(c,{strategy:i,width:i==="thumbhash"?void 0:32});if(e==="dominant-color"&&s.dominantColor)return s.dominantColor;if(s.dataURL)return s.dataURL;return"rgb(128, 128, 128)"}catch{return"rgb(128, 128, 128)"}finally{re(n)}}function ft(t,e){return(e?t.filter((r)=>r.format===e):t).sort((r,n)=>r.width-n.width).map((r)=>`${r.url} ${r.width}w`).join(", ")}function Kt(t){if(!t||Object.keys(t).length===0)return"100vw";return Object.entries(t).sort((a,r)=>{let n=Number.parseInt(a[0].replace(/\D/g,""))||0;return(Number.parseInt(r[0].replace(/\D/g,""))||0)-n}).map(([a,r])=>`(max-width: ${a}) ${r}`).join(", ")+", 100vw"}function Nn(t){let e=t.filter((r)=>r.format==="jpeg");if(e.length===0)return t[Math.floor(t.length/2)];let a=e.sort((r,n)=>r.width-n.width);return a[Math.floor(a.length/2)]}function Dn(t){let e=new Map;for(let a of t){let r=e.get(a.format)||[];r.push(a),e.set(a.format,r)}return e}function Mn(t){let e=g.extname(t).toLowerCase();return D.includes(e)}function ne(t){return U[t]||"application/octet-stream"}function Ln(t){return t.reduce((e,a)=>e+a.size,0)}function jn(t){if(t<1024)return`${t} B`;if(t<1048576)return`${(t/1024).toFixed(1)} KB`;return`${(t/1048576).toFixed(2)} MB`}class Wr extends Error{code;constructor(t,e){super(t);this.name="ImageProcessingError",this.code=e}}
|
|
3
|
+
export{Q,ee,te,On,me,Te,Ur,Bl,ft,Kt,Nn,Dn,Mn,ne,Ln,jn,Wr};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{xh,Tf,Xe,tc,Sh,rs,ss,os}from"./chunk-yhbsvf65.js";import"./chunk-bjhesw78.js";import"./chunk-krsg6dgz.js";import"./chunk-9k8ztdcc.js";import"./chunk-k2ex94n8.js";import"./chunk-2cbd1ew6.js";import"./chunk-wghtdgwj.js";import"./chunk-x5seqmrv.js";import"./chunk-tpfxvw4q.js";import"./chunk-4833k99b.js";import"./chunk-b51p56k5.js";export{Sh as clearOnceStore,tc as onceStore,Xe as partialsCache,rs as processIncludes,ss as processStackPushDirectives,os as processStackReplacements,xh as resetUnscopedSignalWarnings,Tf as topLevelElements};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Kg}from"./chunk-qx0np0hy.js";import"./chunk-yjzk7rwt.js";import"./chunk-jzajpmke.js";import"./chunk-4c0qcjac.js";import"./chunk-61qh74q1.js";import"./chunk-23t9anc0.js";import"./chunk-7y1rpd4g.js";import"./chunk-b0z2n941.js";import"./chunk-wk8y89q2.js";import"./chunk-yhbsvf65.js";import"./chunk-bjhesw78.js";import"./chunk-krsg6dgz.js";import"./chunk-9k8ztdcc.js";import"./chunk-vvs28yqw.js";import"./chunk-frybxj35.js";import"./chunk-k2ex94n8.js";import"./chunk-4rxmxc1p.js";import"./chunk-vv8dn70r.js";import"./chunk-kj9m0vc6.js";import"./chunk-8rk79ha1.js";import"./chunk-q3azy64b.js";import"./chunk-evxp3wmv.js";import"./chunk-f8p8ggvw.js";import"./chunk-2cbd1ew6.js";import"./chunk-wghtdgwj.js";import"./chunk-x5seqmrv.js";import"./chunk-tpfxvw4q.js";import"./chunk-4833k99b.js";import"./chunk-b51p56k5.js";export{Kg as buildForProduction};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{U}from"./chunk-
|
|
3
|
-
export{
|
|
2
|
+
import{U}from"./chunk-2cbd1ew6.js";import{ze,O,Mt}from"./chunk-x5seqmrv.js";import{pt,Ce,M,Ee,ia,uo,aa,Pn}from"./chunk-yjzk7rwt.js";import{xt,ue,Qe}from"./chunk-f8p8ggvw.js";import{To}from"./chunk-61qh74q1.js";import{In}from"./chunk-3mz088mb.js";import{be}from"./chunk-frybxj35.js";import Z from"fs";import T from"path";var{serve:ce}=globalThis.Bun;import H from"zlib";import{promisify as Q}from"util";var K=Q(H.brotliCompress),ee=Q(H.gzip),te=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],ne=["text/event-stream","multipart/x-mixed-replace"],re=1024;function se(t){if(!t)return!1;let e=t.toLowerCase();if(ne.some((o)=>e.startsWith(o)))return!1;return te.some((o)=>e.startsWith(o))}function oe(t){let e=new Map;for(let o of t.split(",")){let[r,...a]=o.trim().split(";"),f=r.trim().toLowerCase();if(!f)continue;let h=1;for(let g of a){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 ae(t){if(!t)return null;let e=oe(t),o=e.get("*"),r=(a)=>e.get(a)??o??0;if(r("br")>0)return"br";if(r("gzip")>0)return"gzip";return null}var Y=33554432,V=new Map,z=0;function ie(t,e){if(e.length>Y/8)return;V.set(t,e),z+=e.length;for(let[o,r]of V){if(z<=Y)break;V.delete(o),z-=r.length}}async function Tn(t,e,o={}){if(e.headers.get("content-encoding"))return e;if(e.status===204||e.status===304||!e.body)return e;if(!se(e.headers.get("content-type")))return e;let r=ae(t.headers.get("accept-encoding"));if(!r)return e;let a;try{a=new Uint8Array(await e.arrayBuffer())}catch{return e}let f=()=>new Response(a,{status:e.status,statusText:e.statusText,headers:J(e.headers)});if(a.length<(o.threshold??re))return f();try{let h=o.quality??5,g=`${r}:${h}:${a.length}:${Bun.hash(a)}`,l=V.get(g);if(!l)l=r==="br"?await K(a,{params:{[H.constants.BROTLI_PARAM_QUALITY]:h,[H.constants.BROTLI_PARAM_SIZE_HINT]:a.length}}):await ee(a),ie(g,l);if(l.length>=a.length)return f();let m=J(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 J(t){let e=new Headers(t),o=e.get("Vary");if(!o)return e.set("Vary","Accept-Encoding"),e;if(!o.split(",").some((a)=>a.trim().toLowerCase()==="accept-encoding"))e.set("Vary",`${o}, Accept-Encoding`);return e}class G{now;entries=new U(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,o){let r,a=async()=>{let s=r??await o();return s.headers.set("Cache-Control","private, no-store"),s.headers.set("Vary",M(s.headers.get("Vary")).Vary),s};if(!e||t.method!=="GET"||t.headers.has("Cookie")||t.headers.has("Authorization")||t.headers.has("Range"))return a();let f=new URL(t.url),h=`${f.origin}${f.pathname}${f.search}|${Ce(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 o();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",M(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 a();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 A=await x;return A?l(A):a()}}var pe={".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 Fg(t={}){let e=T.resolve(t.outputDir||".output"),o=t.port??3000,r=ia(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 a=In(r.routeRules),f=new G,h=To(e,r.apiRoutes??[]),g=Bun.file(T.join(e,"server/runtime-config.json")),l=t.runtimeConfig??(await g.exists()?await g.json():void 0),m=l?O(l):void 0,v=new Map,_=new Map,x=new Map,A=new Map;for(let n of r.routes)try{let y=T.join(e,n.compiledPath),i=JSON.parse(await Bun.file(y).text());if(m)i.html=Mt(i.html,m);v.set(n.pattern,i),x.set(n.pattern,Qe(i.html)),A.set(n.pattern,be(i.html));let j=T.join(e,n.fragmentPath);if(await Bun.file(j).exists()){let P=await Bun.file(j).text();_.set(n.pattern,m?Mt(P,m):P)}}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:i}=ue(n.pattern,{page:!0});b.push({regex:y,route:n,paramNames:i})}else s.set(n.pattern,n);let E=ce({port:o,async fetch(n){return Tn(n,await ze(m??O(),async()=>{let i=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?.[i])return t.apiRoutes[i](n);let j=await h(n);if(j)return j;if((n.method==="GET"||n.method==="HEAD")&&i!=="/"){let p=T.resolve(e,"public"),d;try{d=decodeURIComponent(i)}catch{d=i}if(!d.includes("\x00")){let u=T.resolve(p,`.${d}`);if(u===p||u.startsWith(`${p}${T.sep}`))try{if(Z.existsSync(u)&&Z.statSync(u).isFile()){let R=T.extname(u).toLowerCase(),B=pe[R]||"application/octet-stream",X=i.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(i);return new Response(Bun.file(u),{headers:{"Content-Type":B,"Cache-Control":X?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let P=Ce(n),C=null,q={};if(C=s.get(i)||null,!C)for(let{regex:p,route:d,paramNames:u}of b){let c=i.match(p);if(c){C=d,u.forEach((R,B)=>{q[R]=c[B+1]});break}}if(!C){let p=xt(i)?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=a(i),W=Object.keys(N).length>0;return f.respond(n,N.cache,async()=>{let p=v.get(C.pattern);if(P&&n.method==="GET"&&p&&!p.hasServerScripts&&Object.keys(p.placeholders).length===0){let c=_.get(C.pattern);if(c){let R=x.get(C.pattern);return new Response(c,{status:p.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...A.has(C.pattern)?{"X-STX-Runtime":A.get(C.pattern)?"true":"false"}:{},...R?{"X-STX-Layout":R.layout,"X-STX-Layout-Group":R.group}:{},...M(),...N.cache?{}:{"Cache-Control":pt}}})}}let d=uo(n.method),u=v.get(C.pattern);if(!u){let c=s.get("/500")||null;if(c){let R=v.get(c.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",...M(),"Cache-Control":"public, max-age=60"}});try{let{html:c,boundaries:R,redirect:B,cookies:X,status:F,headers:I}=await Pn(u,{params:q,request:n,method:n.method,__stx_strict_hydration:W,__stx_runtime_config:m});if(B)return aa(B,X,I);if(R&&R.length>0){let{renderStreamingPage:S,streamToResponse:D}=await import("./chunk-w512gnft.js"),L=new Headers({...M(),...I,"Cache-Control":"private, no-store"});for(let k of X??[])L.append("Set-Cookie",k);if(P&&!d){let k=Qe(c);L.set("X-STX-Fragment","true"),L.set("X-STX-Runtime",be(c)?"true":"false"),L.set("X-STX-Layout",k.layout),L.set("X-STX-Layout-Group",k.group)}return D(S(P&&!d?Ee(c,r.routerContainer||"main",!0):c,R,{timeoutMs:30000}),{status:F??u.status??200,headers:L})}let w=new Headers({"Content-Type":"text/html",...M(),...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",M(w.get("Vary")).Vary),P&&!d){let S=Qe(c);return w.set("X-STX-Fragment","true"),w.set("X-STX-Runtime",be(c)?"true":"false"),w.set("X-STX-Layout",S.layout),w.set("X-STX-Layout-Group",S.group),new Response(Ee(c,r.routerContainer||"main",!0),{status:F??u.status??200,headers:w})}return new Response(c,{status:F??u.status??200,headers:w})}catch(c){if(console.error(`[stx] Hydration error for ${i}:`,c),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{Tn,Fg};
|