@stacksjs/stx 0.2.336 → 0.2.338
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app-shell.js +9 -8
- package/dist/{chunk-9v0fsdsf.js → chunk-066yt1hy.js} +1 -1
- package/dist/{chunk-eth22r93.js → chunk-0xgc5t3y.js} +1 -1
- package/dist/{chunk-vd5xvsnv.js → chunk-18018jkn.js} +1 -1
- package/dist/{chunk-5tefa8qb.js → chunk-1vb2rj09.js} +2 -2
- package/dist/chunk-1wsewc5h.js +2 -0
- package/dist/{chunk-p1hy2bwn.js → chunk-1yj4xd6n.js} +3 -3
- package/dist/{chunk-fqq5k9ve.js → chunk-1z1efvtw.js} +1 -1
- package/dist/{chunk-cdqx2c2h.js → chunk-22hch2me.js} +1 -1
- package/dist/{chunk-kpeqn5tx.js → chunk-2gc4cevb.js} +1 -1
- package/dist/{chunk-mgmn1vxy.js → chunk-39xtzfzf.js} +1 -1
- package/dist/{chunk-zsnrcbw1.js → chunk-3cjvqa0s.js} +2 -2
- package/dist/chunk-3sgdth20.js +2 -0
- package/dist/chunk-41dfsdy9.js +2 -0
- package/dist/{chunk-ymrxpwr8.js → chunk-46tmg3k4.js} +2 -2
- package/dist/{chunk-e1sxe3q4.js → chunk-4904n5v0.js} +2 -2
- package/dist/chunk-4cw0s9f4.js +4 -0
- package/dist/chunk-4jj4kk18.js +2 -0
- package/dist/chunk-4np12rj1.js +2 -0
- package/dist/chunk-4pcjt99d.js +2 -0
- package/dist/{chunk-dvvx1wny.js → chunk-57atgbyq.js} +1 -1
- package/dist/chunk-58j32d7n.js +2 -0
- package/dist/{chunk-hyfjnn7g.js → chunk-5g6rprcy.js} +1 -1
- package/dist/{chunk-mm59b0gg.js → chunk-5qsg9q46.js} +1 -1
- package/dist/{chunk-m8kezfrt.js → chunk-5r7gfwpj.js} +5 -5
- package/dist/chunk-799s9mwc.js +47 -0
- package/dist/{chunk-yxppshfd.js → chunk-7a21q2q4.js} +1 -1
- package/dist/chunk-7d74am4w.js +2 -0
- package/dist/chunk-7ngnyy5k.js +2 -0
- package/dist/{chunk-r8rbf28v.js → chunk-7r79j1hs.js} +1 -1
- package/dist/{chunk-cr8v8k53.js → chunk-7r9vgzg4.js} +1 -1
- package/dist/{chunk-xwxdwqn9.js → chunk-7we3xfde.js} +1 -1
- package/dist/{chunk-fr66xp8q.js → chunk-823h67tv.js} +1 -1
- package/dist/{chunk-42en0cxm.js → chunk-86v2rps7.js} +1 -1
- package/dist/{chunk-xz3evxqp.js → chunk-8bxtvsgm.js} +1 -1
- package/dist/{chunk-09jdvqhg.js → chunk-8cg15rr7.js} +2 -2
- package/dist/chunk-95t7pked.js +2 -0
- package/dist/{chunk-xdmb578h.js → chunk-97ej3abh.js} +1 -1
- package/dist/{chunk-kw98dfza.js → chunk-9btdax2s.js} +1 -1
- package/dist/{chunk-pbexz0d4.js → chunk-9bvgzqw1.js} +2 -2
- package/dist/{chunk-te6qym2g.js → chunk-9jc2z17q.js} +2 -2
- package/dist/chunk-9m5sxaen.js +2 -0
- package/dist/{chunk-tjag2cmm.js → chunk-a26hcag1.js} +1 -1
- package/dist/chunk-a3m7mgjc.js +2 -0
- package/dist/{chunk-9368t9jm.js → chunk-a959m68j.js} +1 -1
- package/dist/{chunk-fkdnfjc2.js → chunk-aftqqqcg.js} +2 -2
- package/dist/chunk-aved735s.js +64 -0
- package/dist/{chunk-q0g5c39d.js → chunk-ay336sqb.js} +1 -1
- package/dist/{chunk-cvphepjb.js → chunk-b3pn6dh5.js} +1 -1
- package/dist/{chunk-5swem3qy.js → chunk-b4cabzk9.js} +1 -1
- package/dist/{chunk-ej8mv2k6.js → chunk-bgrkxzr7.js} +1 -1
- package/dist/{chunk-2cm03y4y.js → chunk-d3kjaae0.js} +1 -1
- package/dist/chunk-d7zxg9bp.js +16 -0
- package/dist/{chunk-1ebyt1ba.js → chunk-dekxwgc2.js} +1 -1
- package/dist/chunk-dvafkj8w.js +2 -0
- package/dist/chunk-e3rgky2r.js +3747 -0
- package/dist/{chunk-t41aaehf.js → chunk-e4g8wz6t.js} +1 -1
- package/dist/chunk-e9y48d60.js +2 -0
- package/dist/{chunk-pbzdjhp8.js → chunk-eq2j7w8p.js} +1 -1
- package/dist/chunk-f08ttkqr.js +2 -0
- package/dist/{chunk-4jdj52c5.js → chunk-f6sejeg3.js} +1 -1
- package/dist/chunk-fha0nyet.js +2 -0
- package/dist/{chunk-6k8h1fj1.js → chunk-fjrkyhm7.js} +1 -1
- package/dist/chunk-fw56y3cb.js +30 -0
- package/dist/chunk-fx5m9d3t.js +2 -0
- package/dist/{chunk-mwh3ymwc.js → chunk-g6czgcg4.js} +1 -1
- package/dist/chunk-gtfcw1gc.js +12 -0
- package/dist/chunk-gz539gk6.js +2 -0
- package/dist/chunk-h0y4mb2m.js +2 -0
- package/dist/chunk-hfzv07az.js +3 -0
- package/dist/{chunk-nat3actx.js → chunk-hrdd26r4.js} +1 -1
- package/dist/{chunk-cdsbxghb.js → chunk-jkyvk4x6.js} +1 -1
- package/dist/{chunk-4ty8j3xn.js → chunk-jx03a693.js} +1 -1
- package/dist/{chunk-vvd659y4.js → chunk-k3dtvay1.js} +1 -1
- package/dist/chunk-kawdj1j7.js +2 -0
- package/dist/{chunk-d4etph79.js → chunk-kdhrk7x5.js} +1 -1
- package/dist/chunk-kdwerx8e.js +2 -0
- package/dist/{chunk-n66k2v2q.js → chunk-kermxyfe.js} +2 -2
- package/dist/{chunk-x7yc7e9v.js → chunk-m11pb9cx.js} +1 -1
- package/dist/{chunk-k6ky5et7.js → chunk-m1p2n3nf.js} +1 -1
- package/dist/chunk-m46edxtt.js +3 -0
- package/dist/chunk-meqz313r.js +2 -0
- package/dist/{chunk-q05eh1n4.js → chunk-mnyehz4t.js} +2 -2
- package/dist/{chunk-0vv5s039.js → chunk-mys0rat0.js} +1 -1
- package/dist/chunk-n0a55zv2.js +2 -0
- package/dist/{chunk-7kw3grq5.js → chunk-nf7k53ap.js} +1 -1
- package/dist/{chunk-kffndzch.js → chunk-nhbc464j.js} +3 -3
- package/dist/{chunk-1hzgxk2m.js → chunk-nvp546bb.js} +1 -1
- package/dist/chunk-p1cddybx.js +2 -0
- package/dist/chunk-q0srntf6.js +2 -0
- package/dist/chunk-q3g4yf5r.js +2 -0
- package/dist/{chunk-c2ta859c.js → chunk-q9ckfwhh.js} +1 -1
- package/dist/chunk-qhdp0ycf.js +2 -0
- package/dist/{chunk-y4nzmkea.js → chunk-qsbjtp60.js} +1 -1
- package/dist/{chunk-1tva0f8f.js → chunk-qtc28zy1.js} +1 -1
- package/dist/{chunk-2vgkc0kg.js → chunk-r10fypcd.js} +1 -1
- package/dist/chunk-rkykwy3z.js +2 -0
- package/dist/{chunk-64djh88a.js → chunk-sqvqwd0p.js} +1 -1
- package/dist/{chunk-67bh5vrj.js → chunk-stbns4bg.js} +1 -1
- package/dist/chunk-szfk6pw6.js +2 -0
- package/dist/{chunk-amxtypkp.js → chunk-t00ga194.js} +1 -1
- package/dist/chunk-temapbqe.js +2 -0
- package/dist/{chunk-9kxfz708.js → chunk-tr1174hz.js} +1 -1
- package/dist/{chunk-q85qp5we.js → chunk-tr41gn5j.js} +1 -1
- package/dist/{chunk-crj19mqr.js → chunk-tr9ynxdw.js} +1 -1
- package/dist/{chunk-71y3bhcw.js → chunk-tsmdmf5h.js} +123 -37
- package/dist/{chunk-gptwwv3c.js → chunk-vaggjvsm.js} +1 -1
- package/dist/{chunk-ya5m5vbn.js → chunk-vgfd9582.js} +1 -1
- package/dist/chunk-vgfnre7b.js +2 -0
- package/dist/{chunk-n9c975db.js → chunk-vhzc08aa.js} +1 -1
- package/dist/{chunk-08w4gtyf.js → chunk-vm5jbgb1.js} +3 -3
- package/dist/{chunk-drqdc0mh.js → chunk-vxt5c5aq.js} +1 -1
- package/dist/{chunk-hzfd8cz0.js → chunk-w0hzaka3.js} +78 -67
- package/dist/{chunk-yk6446kr.js → chunk-w72v0ab1.js} +2 -2
- package/dist/{chunk-c65yrgck.js → chunk-wakb8z5q.js} +10 -10
- package/dist/{chunk-q569zmrr.js → chunk-wb90259a.js} +1 -1
- package/dist/chunk-x01sw9wy.js +2 -0
- package/dist/{chunk-dfejgnny.js → chunk-x48crnwa.js} +1 -1
- package/dist/{chunk-24b4711v.js → chunk-x4vhn880.js} +1 -1
- package/dist/{chunk-j2dj21ay.js → chunk-xe6zmdfq.js} +1 -1
- package/dist/chunk-y8vj3rtt.js +2 -0
- package/dist/chunk-yj1dxdfr.js +2 -0
- package/dist/{chunk-wx5zf66r.js → chunk-yne23w3c.js} +1 -1
- package/dist/{chunk-zz8qgqa1.js → chunk-ypzm47q3.js} +2 -2
- package/dist/chunk-z07knk3p.js +2 -0
- package/dist/{chunk-27xfkzks.js → chunk-zj039s33.js} +1 -1
- package/dist/{chunk-c79nfdyj.js → chunk-zk6ghjnj.js} +1 -1
- package/dist/chunk-zt4pf776.js +2 -0
- package/dist/{chunk-4k0ce745.js → chunk-zye9r15n.js} +2 -2
- package/dist/chunk-zzfpwxpp.js +2 -0
- package/dist/cli.js +14 -14
- package/dist/component-contract-checks.d.ts +18 -15
- package/dist/component-contract.d.ts +6 -14
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/database.js +1 -1
- package/dist/expressions.d.ts +45 -0
- package/dist/expressions.js +60 -11
- package/dist/includes.js +4 -0
- package/dist/loops.js +10 -0
- package/dist/pwa.js +2 -2
- package/dist/server-components.js +2 -1
- package/dist/signals.js +121 -35
- package/dist/slots.js +86 -12
- package/dist/ssg.js +2 -2
- package/dist/stx-virtual-ts.d.ts +205 -95
- package/dist/template-syntax-escape.d.ts +36 -0
- package/dist/template-syntax-escape.js +8 -0
- package/dist/utils.js +9 -2
- package/dist/variable-extractor.d.ts +1 -0
- package/dist/variable-extractor.js +8 -0
- package/dist/visual-testing.js +1 -1
- package/package.json +8 -8
- package/dist/chunk-046dp691.js +0 -2
- package/dist/chunk-1brnvyhv.js +0 -2
- package/dist/chunk-3ntf8f5e.js +0 -2
- package/dist/chunk-4tnxnzja.js +0 -2
- package/dist/chunk-63yfp05p.js +0 -2
- package/dist/chunk-7y4eqkv4.js +0 -2
- package/dist/chunk-7ywnkv1f.js +0 -2
- package/dist/chunk-80zj5516.js +0 -2
- package/dist/chunk-8730k51r.js +0 -2
- package/dist/chunk-907qxn09.js +0 -2
- package/dist/chunk-9fcq5x2r.js +0 -2
- package/dist/chunk-a97tp43x.js +0 -2
- package/dist/chunk-atw841yx.js +0 -2
- package/dist/chunk-c1m1gng4.js +0 -2
- package/dist/chunk-caaenc3w.js +0 -60
- package/dist/chunk-dbfq77qe.js +0 -4
- package/dist/chunk-dnesmvvb.js +0 -2
- package/dist/chunk-eg8ksaft.js +0 -2
- package/dist/chunk-ewsx2qxm.js +0 -2
- package/dist/chunk-farwrdr2.js +0 -3
- package/dist/chunk-fcenm8n1.js +0 -2
- package/dist/chunk-gbz6pfs8.js +0 -2
- package/dist/chunk-gdbkqatx.js +0 -43
- package/dist/chunk-jnahcd4d.js +0 -2
- package/dist/chunk-ke88kpva.js +0 -30
- package/dist/chunk-krpkfndf.js +0 -3
- package/dist/chunk-kxtqbrfr.js +0 -3759
- package/dist/chunk-m1yrakpk.js +0 -2
- package/dist/chunk-q2hvne0v.js +0 -2
- package/dist/chunk-qpbk50xd.js +0 -2
- package/dist/chunk-rxdd3k6n.js +0 -2
- package/dist/chunk-ssd10kje.js +0 -2
- package/dist/chunk-szx6pxh3.js +0 -2
- package/dist/chunk-tpmgq2dx.js +0 -12
- package/dist/chunk-tte4m2s9.js +0 -2
- package/dist/chunk-v7gjsb3f.js +0 -2
- package/dist/chunk-vv289x82.js +0 -2
- package/dist/chunk-vx6mxybh.js +0 -2
- package/dist/chunk-x510wr8z.js +0 -2
- package/dist/chunk-x95sxapm.js +0 -2
- package/dist/chunk-xjrhzkx2.js +0 -2
- package/dist/chunk-y1x2ebhv.js +0 -2
- package/dist/chunk-yvec3f1c.js +0 -2
- package/dist/chunk-yzxm75jp.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{tw as O}from"./chunk-5g6rprcy.js";import{mkdir as b,writeFile as T}from"fs/promises";import{join as q}from"path";var E="https://api.iconify.design";async function k(){let G=await fetch(`${E}/collections`);if(!G.ok)throw Error(`Failed to fetch collections: ${G.statusText}`);return await G.json()}async function P(G,z){try{let Z=O.resolve("@iconify/json"),X=`${`${Z.substring(0,Z.lastIndexOf("/node_modules/@iconify/json/"))}/node_modules/@iconify/json`}/json/${G}.json`,Q=Bun.file(X);if(await Q.exists()){let $=await Q.json();if(z&&z.length>0){let B={};for(let S of z)if($.icons[S])B[S]=$.icons[S];return{...$,icons:B}}return $}}catch{}let M=z&&z.length>0?`${E}/${G}.json?icons=${z.join(",")}`:`${E}/${G}.json`,U=await fetch(M);if(!U.ok)throw Error(`Failed to fetch icons for ${G}: ${U.statusText}`);return await U.json()}function j(G,z=24,M=24){return{body:G.body,width:G.width||z,height:G.height||M,viewBox:`0 0 ${G.width||z} ${G.height||M}`}}function F(G,z){let M=V(G);return`import type { IconData } from '@stacksjs/iconify-core'
|
|
3
3
|
|
|
4
4
|
export const ${M}: IconData = ${JSON.stringify(z,null,2)}
|
|
5
5
|
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{pr as a,qr as b,rr as c,sr as d,tr as e,ur as f}from"./chunk-e3rgky2r.js";import"./chunk-d7zxg9bp.js";import"./chunk-t00ga194.js";import"./chunk-hrdd26r4.js";import"./chunk-7r79j1hs.js";import"./chunk-ay336sqb.js";import"./chunk-nhbc464j.js";import"./chunk-vaggjvsm.js";import"./chunk-q9ckfwhh.js";import"./chunk-kermxyfe.js";import"./chunk-k3dtvay1.js";import"./chunk-aved735s.js";import"./chunk-799s9mwc.js";import"./chunk-7r80apc5.js";import"./chunk-2tjk867y.js";import"./chunk-t8ctvjqe.js";import"./chunk-deqnt1w5.js";import"./chunk-w0hzaka3.js";import"./chunk-wb90259a.js";import"./chunk-5g6rprcy.js";export{f as validateConfig,b as resolveStxDirectories,c as loadStxConfig,e as defineStxConfig,a as defaultConfig,d as config};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{$l as e,Xl as c,_l as d,am as f,bm as g,cm as h,dm as i,em as j,fm as k,gm as l,hm as m,im as n}from"./chunk-e3rgky2r.js";import"./chunk-d7zxg9bp.js";import"./chunk-t00ga194.js";import{js as a,ks as b}from"./chunk-hrdd26r4.js";import"./chunk-7r79j1hs.js";import"./chunk-ay336sqb.js";import"./chunk-nhbc464j.js";import"./chunk-vaggjvsm.js";import"./chunk-q9ckfwhh.js";import"./chunk-kermxyfe.js";import"./chunk-k3dtvay1.js";import"./chunk-aved735s.js";import"./chunk-799s9mwc.js";import"./chunk-7r80apc5.js";import"./chunk-2tjk867y.js";import"./chunk-t8ctvjqe.js";import"./chunk-deqnt1w5.js";import"./chunk-w0hzaka3.js";import"./chunk-wb90259a.js";import"./chunk-5g6rprcy.js";export{h as transformAutoImports,b as stripCommentsAndLiterals,e as renderVendorStyleTags,i as referencesName,n as processClientScript,g as injectBrowserCoreAutoImports,m as generateServerDataBridge,k as generateBrowserAutoImportDestructuring,j as generateAutoImportDestructuring,a as findInterpolationEnd,l as extractBridgeData,d as extractAndStripCssImports,f as STX_AUTO_IMPORTS,c as BROWSER_CORE_IMPORTS};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
import I from"fs";import F from"path";import{createHash as w}from"crypto";var H=["pages","components","layouts","partials","composables"],Y=new Set;function u(j){try{return Y.has(I.realpathSync(j))}catch{return Y.has(F.resolve(j))}}var L=new Set(["extends","root",...H.map((j)=>`${j}Dir`),"publicDir","stateDir","cachePath"]),Z=(j)=>j!==null&&typeof j==="object"&&(Object.getPrototypeOf(j)===Object.prototype||Object.getPrototypeOf(j)===null);function _(j,z,A=""){if(Array.isArray(z))return["middleware","plugins"].includes(A)?[...Array.isArray(j)?j:[],...z]:[...z];if(!Z(z))return z;let E={...Z(j)?j:{}};for(let[B,G]of Object.entries(z)){if(["__proto__","constructor","prototype"].includes(B))throw Error(`Invalid layer config key: ${B}`);E[B]=_(E[B],G,B)}return E}function $(j){for(let z of["stx.config.ts","stx.config.js","stx.config.mjs",".config/stx.config.ts",".config/stx.ts","ui.config.ts"]){let A=F.join(j,z);if(I.existsSync(A))return I.realpathSync(A)}throw Error(`Application layer has no stx.config.ts: ${j}`)}function S(j,z,A){if(typeof j!=="string"||!j||/^(?:https?:|git[+:])/.test(j))throw Error(`Invalid application layer ${JSON.stringify(j)} in ${z}; use a local path or installed package`);if(j.startsWith(".")||F.isAbsolute(j)){let B=F.resolve(z,j);return I.statSync(B).isDirectory()?$(B):I.realpathSync(B)}let E=z;while(!0){let B=F.join(E,"node_modules",j),G=F.join(B,"package.json");if(I.existsSync(G)){A.add(I.realpathSync(G));let T=JSON.parse(I.readFileSync(G,"utf8"));return T.stx?.layer?I.realpathSync(F.resolve(B,T.stx.layer)):$(B)}let J=F.dirname(E);if(J===E)break;E=J}throw Error(`Cannot resolve application layer ${JSON.stringify(j)} from ${z}`)}async function C(j,z){let A=await Bun.build({entrypoints:[j],target:"bun",format:"esm",splitting:!1,plugins:[{name:"stx-layer-config",setup(G){G.onResolve({filter:/^[^./]/},(J)=>{if(J.path.startsWith("node:"))return{path:J.path,external:!0};return{path:Bun.resolveSync(J.path,J.resolveDir),external:!0}}),G.onLoad({filter:/./},(J)=>{let T=I.realpathSync(J.path);z.add(T),Y.add(T);return})}}]});if(!A.success)throw Error(`Cannot load layer ${j}: ${A.logs.join(`
|
|
3
3
|
`)}`);let E=A.outputs.find((G)=>G.kind==="entry-point");if(!E||A.outputs.length!==1)throw Error(`Unsupported layer config output: ${j}`);let B=(await import(`data:text/javascript;base64,${Buffer.from(await E.text()).toString("base64")}`)).default;if(!Z(B))throw Error(`Layer ${j} must default-export a config object`);return B}async function v(j,z){let A=new Set,E=[],B=[],G=new Set,J=[];async function T(q,M){if(q=I.realpathSync(q),J.includes(q))throw Error(`Application layer cycle: ${[...J,q].join(" -> ")}`);if(G.has(q))return;G.add(q),J.push(q);let U=await C(q,A);M??=F.basename(F.dirname(q))===".config"?F.dirname(F.dirname(q)):F.dirname(q),M=I.realpathSync(M);let D=F.resolve(M,U.root??"."),K=Object.fromEntries(H.map((Q)=>[Q,F.resolve(D,U[`${Q}Dir`]??(Q==="composables"?"functions":Q))]));E.push({root:M,configFile:q,resources:K});let N={...U};if(N.plugins)N.plugins=N.plugins.map((Q)=>{let W=typeof Q==="string"?Q:Q[0],X=W.startsWith(".")?F.resolve(M,W):F.isAbsolute(W)?W:Bun.resolveSync(W,M);return A.add(I.realpathSync(X)),typeof Q==="string"?X:[X,Q[1]]});if(typeof N.css==="string")N.css=F.resolve(M,N.css);if(N.serverApi)N.serverApi={...typeof N.serverApi==="object"?N.serverApi:{},dir:F.resolve(M,typeof N.serverApi==="object"?N.serverApi.dir??"server/api":"server/api")};if(B.push(N),U.extends!==void 0&&!Array.isArray(U.extends))throw Error(`extends in ${q} must be an array`);for(let Q of U.extends??[])await T(S(Q,M,A));J.pop()}await T($(j),j);for(let q of["package.json","bun.lock","package-lock.json","pnpm-lock.yaml"]){let M=F.join(j,q);if(I.existsSync(M))A.add(I.realpathSync(M))}let O=_({},z);for(let q=B.length-1;q>=0;q--){let M=q===0?B[q]:Object.fromEntries(Object.entries(B[q]).filter(([U])=>!L.has(U)));O=_(O,M)}let V={layers:E,configDependencies:[...A].sort()};return O._layerGraph=V,O._layerPageDirs=E.map((q)=>q.resources.pages),O._layerComponentDirs=E.map((q)=>q.resources.components),O._layerLayoutDirs=E.map((q)=>q.resources.layouts),O._layerPartialDirs=E.map((q)=>q.resources.partials),O._layerComposableDirs=E.map((q)=>q.resources.composables),await R(V,j),{config:O,graph:V}}async function R(j,z){let A=new Map,E=[];for(let B of j.layers)for(let[G,J]of Object.entries(B.resources)){if(!I.existsSync(J))continue;let T=new Bun.Glob(G==="composables"?"**/*.ts":"**/*.stx");for(let O of[...T.scanSync({cwd:J})].sort()){let V=`${G}/${O}`,q=F.join(J,O),M=A.get(V);if(M)E.push({resource:V,winner:M,shadowed:q});else A.set(V,q)}}Object.assign(j,{overrides:E}),await Bun.write(F.join(z,".stx/layers.json"),JSON.stringify(j,null,2))}function P(j){let z=new Set(j.configDependencies);function A(E){if(!I.existsSync(E))return;z.add(E);for(let B of I.readdirSync(E,{withFileTypes:!0}).sort((G,J)=>G.name.localeCompare(J.name))){if(B.name.startsWith(".")||B.name==="node_modules")continue;let G=F.join(E,B.name);if(B.isDirectory())A(G);else if(B.isFile())z.add(G)}}for(let E of j.layers)for(let B of Object.values(E.resources))A(B);return[...z].sort()}function h(j){return x(P(j))}function y(j){return x(j.configDependencies)}function x(j){return j.map((z)=>{try{let A=I.statSync(z);return`${z}:${A.mtimeMs}:${A.size}`}catch{return`${z}:missing`}}).join(`
|
|
4
4
|
`)}function g(j){return j.layers.map((z)=>({config:F.relative(z.root,z.configFile),files:P({layers:[z],configDependencies:j.configDependencies.filter((A)=>A.startsWith(`${z.root}${F.sep}`))}).filter((A)=>I.statSync(A).isFile()).map((A)=>({path:F.relative(z.root,A).replaceAll(F.sep,"/"),sha256:w("sha256").update(I.readFileSync(A)).digest("hex")}))}))}
|
|
5
|
-
export{u as
|
|
5
|
+
export{u as ms,v as ns,R as os,h as ps,y as qs,g as rs};
|
|
@@ -213,4 +213,4 @@ function w(Z,M){let{itemHeight:K,containerHeight:P,overscan:F=3,keyProperty:$="i
|
|
|
213
213
|
})();
|
|
214
214
|
</script>
|
|
215
215
|
`})}var v={createVirtualList:w,processVirtualListDirectives:C,processInfiniteListDirectives:E,processVirtualGridDirectives:f,generateVirtualListCSS:b,useVirtualList:L};
|
|
216
|
-
export{w as
|
|
216
|
+
export{w as Bh,C as Ch,b as Dh,L as Eh,E as Fh,f as Gh,v as Hh};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import z from"fs";function B(x){return[...x].sort().map((b)=>{try{let j=z.statSync(b);return`${b}:${j.size}:${j.mtimeMs}`}catch{return`${b}:missing`}}).join(`
|
|
3
3
|
`)}function C(x,b,j){let q=x.get(b);return q!==void 0&&q.signature===j?q.value:void 0}function D(x,b,j,q){return x.set(b,{signature:j,value:q}),q}
|
|
4
|
-
export{B as
|
|
4
|
+
export{B as Ji,C as Ki,D as Li};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{ag as ZJ,cg as g,eg as A,kg as n,ng as GJ,qg as WJ,sg as YJ,ug as jJ}from"./chunk-fw56y3cb.js";import{xg as $J}from"./chunk-57atgbyq.js";import{pl as XJ}from"./chunk-1yj4xd6n.js";import{ko as h}from"./chunk-e3rgky2r.js";import{Bs as e}from"./chunk-nhbc464j.js";import{Ct as QJ,Gt as i,It as p}from"./chunk-k3dtvay1.js";import{Dv as KJ,ew as l,jw as VJ}from"./chunk-w0hzaka3.js";import{tw as DJ}from"./chunk-5g6rprcy.js";import JJ from"fs";import k from"path";var{serve:wJ}=globalThis.Bun;VJ();import y from"zlib";import{promisify as a}from"util";var IJ=a(y.brotliCompress),OJ=a(y.gzip),UJ=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],BJ=["text/event-stream","multipart/x-mixed-replace"],_J=1024;function zJ(K){if(!K)return!1;let J=K.toLowerCase();if(BJ.some((G)=>J.startsWith(G)))return!1;return UJ.some((G)=>J.startsWith(G))}function FJ(K){let J=new Map;for(let G of K.split(",")){let[Z,...W]=G.trim().split(";"),O=Z.trim().toLowerCase();if(!O)continue;let U=1;for(let B of W){let w=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(B);if(!w)continue;let F=Number.parseFloat(w[1]);if(Number.isFinite(F))U=F}J.set(O,U)}return J}function LJ(K){if(!K)return null;let J=FJ(K),G=J.get("*"),Z=(W)=>J.get(W)??G??0;if(Z("br")>0)return"br";if(Z("gzip")>0)return"gzip";return null}async function t(K,J,G={}){if(J.headers.get("content-encoding"))return J;if(J.status===204||J.status===304||!J.body)return J;if(!zJ(J.headers.get("content-type")))return J;let Z=LJ(K.headers.get("accept-encoding"));if(!Z)return J;let W;try{W=new Uint8Array(await J.arrayBuffer())}catch{return J}let O=()=>new Response(W,{status:J.status,statusText:J.statusText,headers:s(J.headers)});if(W.length<(G.threshold??_J))return O();try{let U=Z==="br"?await IJ(W,{params:{[y.constants.BROTLI_PARAM_QUALITY]:G.quality??5,[y.constants.BROTLI_PARAM_SIZE_HINT]:W.length}}):await OJ(W);if(U.length>=W.length)return O();let B=s(J.headers);return B.set("Content-Encoding",Z),B.set("Content-Length",String(U.length)),new Response(U,{status:J.status,statusText:J.statusText,headers:B})}catch{return O()}}function s(K){let J=new Headers(K),G=J.get("Vary");if(!G)return J.set("Vary","Accept-Encoding"),J;if(!G.split(",").some((W)=>W.trim().toLowerCase()==="accept-encoding"))J.set("Vary",`${G}, Accept-Encoding`);return J}class d{now;entries=new e(1000,{maxBytes:33554432,sizeOf:(K)=>K.body.byteLength+JSON.stringify(K.headers).length*2});pending=new Map;generation=0;constructor(K=Date.now){this.now=K}invalidate(K){this.generation++,this.pending.clear();for(let J of Array.from(this.entries.keys()))if(K===void 0||this.entries.get(J)?.path===K)this.entries.delete(J)}async respond(K,J,G){let Z,W=async()=>{let X=Z??await G();return X.headers.set("Cache-Control","private, no-store"),X.headers.set("Vary",A(X.headers.get("Vary")).Vary),X};if(!J||K.method!=="GET"||K.headers.has("Cookie")||K.headers.has("Authorization")||K.headers.has("Range"))return W();let O=new URL(K.url),U=`${O.origin}${O.pathname}${O.search}|${g(K)?"fragment":"document"}`,B=this.entries.get(U),w=(X)=>{let T=new Headers(X.headers);return T.set("Cache-Control","private, no-store"),T.set("Age",String(Math.max(0,Math.floor((this.now()-X.created)/1000)))),new Response(X.body.slice(0),{headers:T})},F=B?(this.now()-B.created)/1000:1/0;if(B&&F<J.maxAge)return w(B);let S=this.generation,q=async()=>{let X=await G();Z=X;let T=(X.headers.get("Vary")??"").toLowerCase().split(",").map((L)=>L.trim()).filter(Boolean);if(X.status!==200||X.headers.has("Set-Cookie")||/(?:private|no-store|no-cache)/i.test(X.headers.get("Cache-Control")??"")||T.some((L)=>L!=="x-stx-router"&&L!=="accept-encoding"))return null;let M=await X.clone().arrayBuffer();if(M.byteLength>1048576)return null;X.headers.set("Vary",A(X.headers.get("Vary")).Vary);let Q={body:M,headers:Array.from(X.headers.entries()),created:this.now(),path:O.pathname};if(this.generation===S)this.entries.set(U,Q);return Q},H=this.pending.get(U);if(!H){if(this.pending.size>=1000)return W();H=q().finally(()=>{if(this.pending.get(U)===H)this.pending.delete(U)}),this.pending.set(U,H)}if(B&&F<J.maxAge+(J.swr??0))return H.catch(()=>{}),w(B);let x=await H;return x?w(x):W()}}var HJ={".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 uJ(K={}){let J=k.resolve(K.outputDir||".output"),G=K.port??3000,Z=GJ(J);if(!Z)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${Z.routes.length} routes...`);let W=$J(Z.routeRules),O=new d,U=XJ(J,Z.apiRoutes??[]),B=Bun.file(k.join(J,"server/runtime-config.json")),w=K.runtimeConfig??(await B.exists()?await B.json():void 0),F=w?i(w):void 0,S=new Map,q=new Map,H=new Map,x=new Map;for(let Q of Z.routes)try{let L=k.join(J,Q.compiledPath),Y=JSON.parse(await Bun.file(L).text());if(F)Y.html=p(Y.html,F);S.set(Q.pattern,Y),H.set(Q.pattern,l(Y.html)),x.set(Q.pattern,h(Y.html));let C=k.join(J,Q.fragmentPath);if(await Bun.file(C).exists()){let P=await Bun.file(C).text();q.set(Q.pattern,F?p(P,F):P)}}catch(L){console.warn(`[stx] Failed to load route ${Q.pattern}:`,L)}let X=new Map,T=[];for(let Q of Z.routes)if(Q.hasParams){let{regex:L,params:Y}=KJ(Q.pattern);T.push({regex:L,route:Q,paramNames:Y})}else X.set(Q.pattern,Q);let M=wJ({port:G,async fetch(Q){return t(Q,await QJ(F??i(),async()=>{let Y=new URL(Q.url).pathname;if(K.onRequest){let j=await K.onRequest(Q);if(j)return j}if(K.apiRouter){let j=await K.apiRouter.handleRequest(Q);if(j.status!==404)return j}if(K.apiRoutes?.[Y])return K.apiRoutes[Y](Q);let C=await U(Q);if(C)return C;if((Q.method==="GET"||Q.method==="HEAD")&&Y!=="/"){let j=k.resolve(J,"public"),_;try{_=decodeURIComponent(Y)}catch{_=Y}if(!_.includes("\x00")){let I=k.resolve(j,`.${_}`);if(I===j||I.startsWith(`${j}${k.sep}`))try{if(JJ.existsSync(I)&&JJ.statSync(I).isFile()){let z=k.extname(I).toLowerCase(),E=HJ[z]||"application/octet-stream",v=Y.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(Y);return new Response(Bun.file(I),{headers:{"Content-Type":E,"Cache-Control":v?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let P=g(Q),D=null,o={};if(D=X.get(Y)||null,!D)for(let{regex:j,route:_,paramNames:I}of T){let $=Y.match(j);if($){D=_,I.forEach((z,E)=>{o[z]=$[E+1]});break}}if(!D){let j=X.get("/404")||null;if(j){let _=S.get(j.pattern);if(_)return new Response(_.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})}let R=W(Y),r=Object.keys(R).length>0;return O.respond(Q,R.cache,async()=>{let j=S.get(D.pattern);if(P&&Q.method==="GET"&&j&&!j.hasServerScripts&&Object.keys(j.placeholders).length===0){let $=q.get(D.pattern);if($){let z=H.get(D.pattern);return new Response($,{status:j.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...x.has(D.pattern)?{"X-STX-Runtime":x.get(D.pattern)?"true":"false"}:{},...z?{"X-STX-Layout":z.layout,"X-STX-Layout-Group":z.group}:{},...A(),...R.cache?{}:{"Cache-Control":ZJ}}})}}let _=WJ(Q.method),I=S.get(D.pattern);if(!I){let $=X.get("/500")||null;if($){let z=S.get($.pattern);if(z)return new Response(z.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(D.prerendered&&_)return new Response("Prerendered pages do not accept actions",{status:405,headers:{Allow:"GET, HEAD"}});if(!_&&!I.hasServerScripts&&Object.keys(I.placeholders).length===0)return new Response(I.html,{status:I.status??200,headers:{"Content-Type":"text/html",...A(),"Cache-Control":"public, max-age=60"}});try{let{html:$,boundaries:z,redirect:E,cookies:v,status:m,headers:c}=await jJ(I,{params:o,request:Q,method:Q.method,__stx_strict_hydration:r,__stx_runtime_config:F});if(E)return YJ(E,v,c);if(z&&z.length>0){let{renderStreamingPage:N,streamToResponse:u}=await import("./chunk-fha0nyet.js"),b=new Headers({...A(),...c,"Cache-Control":"private, no-store"});for(let f of v??[])b.append("Set-Cookie",f);if(P&&!_){let f=l($);b.set("X-STX-Fragment","true"),b.set("X-STX-Runtime",h($)?"true":"false"),b.set("X-STX-Layout",f.layout),b.set("X-STX-Layout-Group",f.group)}return u(N(P&&!_?n($,Z.routerContainer||"main"):$,z,{timeoutMs:30000}),{status:m??I.status??200,headers:b})}let V=new Headers({"Content-Type":"text/html",...A(),...R.cache?{}:{"Cache-Control":"private, no-store"}});for(let N of v??[])V.append("Set-Cookie",N);for(let[N,u]of Object.entries(c??{}))V.set(N,u);if(V.set("Vary",A(V.get("Vary")).Vary),P&&!_){let N=l($);return V.set("X-STX-Fragment","true"),V.set("X-STX-Runtime",h($)?"true":"false"),V.set("X-STX-Layout",N.layout),V.set("X-STX-Layout-Group",N.group),new Response(n($,Z.routerContainer||"main"),{status:m??I.status??200,headers:V})}return new Response($,{status:m??I.status??200,headers:V})}catch($){if(console.error(`[stx] Hydration error for ${Y}:`,$),r)return new Response("Internal Server Error",{status:500});return new Response(I.html,{headers:{"Content-Type":"text/html"}})}})}))}});return console.log(`[stx] Production server running at http://localhost:${M.port}`),console.log(`[stx] Serving ${Z.routes.length} routes (${S.size} pre-loaded)`),{port:M.port,stop:()=>{O.invalidate(),M.stop()},invalidate:(Q)=>O.invalidate(Q)}}
|
|
3
3
|
export{zJ as Ve,LJ as We,t as Xe,uJ as Ye};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{ki as a,li as b,mi as c,ni as d,oi as e,pi as f}from"./chunk-qsbjtp60.js";import"./chunk-5g6rprcy.js";export{c as processTransitionDirectives,f as processTransitionAttributes,b as performLeave,a as performEnter,e as generateTransitionRuntime,d as generateTransitionCSS};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import{Broadcast as D,BroadcastServer as U}from"ts-broadcasting";import{channel as b}from"ts-broadcasting";import{Broadcast as N,BroadcastServer as p}from"ts-broadcasting";var z=null,H=[];function X(){return z}async function Y(j){if(z)return z;let k=j.driver??"bun",q=j.host??"0.0.0.0",G=j.port??6001,J=j.scheme??"ws",E={verbose:j.verbose??!1,driver:k,default:k,connections:{[k]:{driver:k,host:q,port:G,scheme:J}}};return z=new U(E),D.setServer(z),await z.start(),z}async function Z(){for(let j of H)clearInterval(j);if(H.length=0,!z)return;await z.stop(),z=null}async function $(j){let k=await import(j),q=k.default??k;if(typeof q!=="function")throw Error(`routes/channels.ts must export a default function, got ${typeof q}`);let G=0;return q({channel(E,A){if(G++,A.authorize&&z)z.channels.channel(E,A.authorize);if(A.interval&&A.data){let L=A.event??`${E}.updated`,M=A.data,Q=setInterval(async()=>{try{let T=await M();V(E,L,T)}catch{}},A.interval);H.push(Q)}}}),G}var K=!1;function F(){if(z)return!0;if(!K)K=!0,console.warn("[stx] broadcast() called before server started \u2014 messages will be sent once broadcasting is ready");return!1}function V(j,k,q){if(!F())return;D.send(j,k,q)}function x(j,k,q){if(!F())return;D.toUser(j,k,q)}function C(j,k,q){if(!F())return;D.toUsers(j,k,q)}function S(j,k,q){if(!F())return;D.send(`private-${j}`,k,q)}function w(j,k,q){if(!F())return;D.presence(j,k,q)}
|
|
3
|
-
export{X as
|
|
3
|
+
export{X as yg,Y as zg,Z as Ag,$ as Bg,V as Cg,x as Dg,C as Eg,S as Fg,w as Gg,b as Hg,N as Ig,p as Jg};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
`),B;try{let{bundleClientScript:j}=await import("./chunk-
|
|
2
|
+
import{tw as H}from"./chunk-5g6rprcy.js";import P from"path";var $=/__stxModules\["((?:[^"\\]|\\.)*)"\]/g;function G(...v){let w=new Set;for(let q of v){if(!q||!q.includes("__stxModules["))continue;for(let z of q.matchAll($))try{w.add(JSON.parse(`"${z[1]}"`))}catch{}}return[...w].sort()}async function T(v,w={}){if(v.length===0)return null;let q=process.cwd(),z=[],J=[];v.forEach((j,X)=>{let Z=j.startsWith("npm:")?j.slice(4):P.resolve(q,j),N=`__stxRegistered${X}`,O=JSON.stringify(j);z.push(`import * as ${N} from ${JSON.stringify(Z)};`),J.push(`if (!globalThis.__stxModules[${O}]) globalThis.__stxModules[${O}] = ${N};`)});let L=[...z,"globalThis.__stxModules = globalThis.__stxModules || {};",...J].join(`
|
|
3
|
+
`),B;try{let{bundleClientScript:j}=await import("./chunk-f08ttkqr.js");B=await j(L,P.join(q,".stx-module-registry.ts"),{projectRoot:q,minify:w.minify,externalizeUserModules:!1})}catch(j){return console.warn("[stx] could not build the page module registry (#1957):",j),null}let{transformAutoImports:Q,generateAutoImportDestructuring:U}=await import("./chunk-7ngnyy5k.js"),F=Q(B),V=U(F.stxImports,F.browserImports),{transformStoreImports:W}=await import("./chunk-b3pn6dh5.js");B=W(F.code);let M=JSON.stringify(new Bun.CryptoHasher("md5").update(L).digest("hex").slice(0,12));return[";(function() {"," var __stxBundles = globalThis.__stxModuleBundles || (globalThis.__stxModuleBundles = {});",` if (__stxBundles[${M}]) return;`,` __stxBundles[${M}] = true;`,V,B,"})();"].join(`
|
|
4
4
|
`)}export{G as registeredModuleIdsIn,T as buildModuleRegistryScript};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{$p as k,Ho as a,Jo as b,Lo as c,Mo as d,Vp as e,Wp as f,Xp as g,Yp as h,Zp as i,_p as j,aq as l,bq as m,cq as n,dq as o,eq as p,fq as q,gq as r,hq as s,iq as t,jq as u,kq as v,lq as w,mq as x}from"./chunk-e3rgky2r.js";import"./chunk-d7zxg9bp.js";import"./chunk-t00ga194.js";import"./chunk-hrdd26r4.js";import"./chunk-7r79j1hs.js";import"./chunk-ay336sqb.js";import"./chunk-nhbc464j.js";import"./chunk-vaggjvsm.js";import"./chunk-q9ckfwhh.js";import"./chunk-kermxyfe.js";import"./chunk-k3dtvay1.js";import"./chunk-aved735s.js";import"./chunk-799s9mwc.js";import"./chunk-7r80apc5.js";import"./chunk-2tjk867y.js";import"./chunk-t8ctvjqe.js";import"./chunk-deqnt1w5.js";import"./chunk-w0hzaka3.js";import"./chunk-wb90259a.js";import"./chunk-5g6rprcy.js";export{e as validateTemplate,g as validateDirective,n as userComponentFileExists,m as transpileTypeScript,p as slotContentHasExpressions,k as shouldTranspileTypeScript,t as resolveTemplatePath,r as renderComponentWithSlot,j as isJavaScriptScript,o as isHydrateTrigger,d as hasVariables,h as hasDirectives,u as getSourceLineInfo,l as getSharedTranspiler,f as getPositionInfo,x as getComponentCacheStats,s as fileExists,a as extractVariables,c as extractScriptFromTemplate,i as extractDirectiveNames,v as createDetailedErrorMessage,b as convertToCommonJS,q as componentClientSignalNames,w as clearComponentCache};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{ot as a,st as b,tt as c,ut as d,vt as e,wt as f,xt as g,yt as h,zt as i}from"./chunk-q9ckfwhh.js";import"./chunk-5g6rprcy.js";export{a as webpHeaderHasAlpha,g as snapshotImageDelivery,b as setImageEncoderIdentity,i as prepareImageDelivery,e as isTransparentImage,h as installImageDelivery,c as imageEncoderIdentity,d as getImageDelivery,f as clearImageDeliveryCatalog};
|
|
@@ -5,4 +5,4 @@ import Q from"fs";import U from"path";function W(H){let v=[],j=H.pwa;if(v.push({
|
|
|
5
5
|
`);let J=["required","recommended","optional"];for(let L of J){let N=H.checks.filter((K)=>K.category===L);if(N.length===0)continue;v.push(`
|
|
6
6
|
${L.toUpperCase()}:`);for(let K of N){let T=K.passed?"\x1B[32m\u2713\x1B[0m":"\x1B[31m\u2717\x1B[0m";if(v.push(` ${T} ${K.name}: ${K.message}`),K.details)v.push(` ${K.details}`)}}return v.push(""),v.join(`
|
|
7
7
|
`)}
|
|
8
|
-
export{W as
|
|
8
|
+
export{W as Ek,X as Fk,Y as Gk,A as Hk,B as Ik};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{a as x,b as u,c as b,d as Az,e as G,f as d,h as y,i as I,j as Uz,k as v}from"./chunk-0y46fbkx.js";import{l as h,m as f,n as g}from"./chunk-q9n5swx7.js";import{
|
|
2
|
+
import{a as x,b as u,c as b,d as Az,e as G,f as d,h as y,i as I,j as Uz,k as v}from"./chunk-0y46fbkx.js";import{l as h,m as f,n as g}from"./chunk-q9n5swx7.js";import{Ho as V}from"./chunk-e3rgky2r.js";import"./chunk-d7zxg9bp.js";import"./chunk-t00ga194.js";import"./chunk-hrdd26r4.js";import"./chunk-7r79j1hs.js";import"./chunk-ay336sqb.js";import"./chunk-nhbc464j.js";import"./chunk-vaggjvsm.js";import"./chunk-q9ckfwhh.js";import"./chunk-kermxyfe.js";import"./chunk-k3dtvay1.js";import"./chunk-aved735s.js";import"./chunk-799s9mwc.js";import"./chunk-7r80apc5.js";import"./chunk-2tjk867y.js";import"./chunk-t8ctvjqe.js";import"./chunk-deqnt1w5.js";import"./chunk-w0hzaka3.js";import"./chunk-wb90259a.js";import{tw as F}from"./chunk-5g6rprcy.js";import l from"fs";import R from"path";function m(z,J){let Z=[R.join(z.root,"stx.config.ts"),R.join(z.root,"stx.config.js"),R.join(z.root,"stx.config.mjs")],K=J.debounceMs??300,$=null,X=[];for(let B of Z)try{if(!l.existsSync(B))continue;let Y=l.watch(B,(W)=>{if(W==="change"){if($)clearTimeout($);$=setTimeout(async()=>{d("Config file changed, restarting...");try{await J.onChange()}catch(j){G(`Failed to restart: ${j}`)}},K)}});X.push(Y)}catch{}return{stop(){if($)clearTimeout($);for(let B of X)B.close()}}}import E from"fs";import i from"path";var Gz=".stx/story/analytics.json",Nz=1,c=1e4;class M{storage;storagePath;currentSession=null;dirty=!1;viewStartTimes=new Map;constructor(z){this.storagePath=i.join(z,Gz),this.storage=this.loadStorage(),this.startSession()}loadStorage(){try{let z=E.readFileSync(this.storagePath,"utf-8");return JSON.parse(z)}catch{return{version:Nz,events:[],sessions:[]}}}async save(){if(!this.dirty)return;let z=i.dirname(this.storagePath);if(await E.promises.mkdir(z,{recursive:!0}),this.storage.events.length>c)this.storage.events=this.storage.events.slice(-c);await E.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}startSession(){this.endSession(),this.currentSession={id:Hz(),startTime:Date.now(),componentViews:[]},this.storage.sessions.push(this.currentSession),this.dirty=!0}endSession(){if(this.currentSession)this.currentSession.endTime=Date.now(),this.currentSession=null}track(z){this.storage.events.push({...z,timestamp:Date.now()}),this.dirty=!0}trackView(z,J){if(this.endViewTiming(z),this.viewStartTimes.set(z,Date.now()),this.track({type:"view",componentId:z,variantId:J}),this.currentSession&&!this.currentSession.componentViews.includes(z))this.currentSession.componentViews.push(z)}endViewTiming(z){let J=this.viewStartTimes.get(z);if(J){let Z=Date.now()-J;this.track({type:"view",componentId:z,metadata:{duration:Z,endView:!0}}),this.viewStartTimes.delete(z)}}trackPropChange(z,J,Z){this.track({type:"prop_change",componentId:z,propName:J,metadata:{value:Z}})}trackVariantSwitch(z,J){this.track({type:"variant_switch",componentId:z,variantId:J})}trackSearch(z,J){this.track({type:"search",query:z,metadata:{resultCount:J}})}getComponentAnalytics(z,J){let Z=this.storage.events.filter((Q)=>Q.componentId===z),K=Z.filter((Q)=>Q.type==="view"&&!Q.metadata?.endView),$=Z.filter((Q)=>Q.type==="prop_change"),X=Z.filter((Q)=>Q.type==="variant_switch"),B={};for(let Q of $)if(Q.propName)B[Q.propName]=(B[Q.propName]||0)+1;let Y={};for(let Q of X)if(Q.variantId)Y[Q.variantId]=(Y[Q.variantId]||0)+1;let W=new Set(this.storage.sessions.filter((Q)=>Q.componentViews.includes(z)).map((Q)=>Q.id)),j=Z.filter((Q)=>Q.metadata?.duration).map((Q)=>Q.metadata.duration),U=j.length>0?j.reduce((Q,D)=>Q+D,0)/j.length:0,_=Object.entries(B).sort((Q,D)=>D[1]-Q[1]).slice(0,5).map(([Q])=>Q);return{componentId:z,componentName:J,viewCount:K.length,uniqueViews:W.size,lastViewed:K[K.length-1]?.timestamp,propChanges:B,topChangedProps:_,variantViews:Y,avgTimeSpent:U}}getMostViewedComponents(z=10){let J=new Map;for(let Z of this.storage.events)if(Z.type==="view"&&Z.componentId&&!Z.metadata?.endView)J.set(Z.componentId,(J.get(Z.componentId)||0)+1);return Array.from(J.entries()).map(([Z,K])=>({componentId:Z,viewCount:K})).sort((Z,K)=>K.viewCount-Z.viewCount).slice(0,z)}getMostChangedProps(z=10){let J=new Map;for(let Z of this.storage.events)if(Z.type==="prop_change"&&Z.propName)J.set(Z.propName,(J.get(Z.propName)||0)+1);return Array.from(J.entries()).map(([Z,K])=>({propName:Z,changeCount:K})).sort((Z,K)=>K.changeCount-Z.changeCount).slice(0,z)}getSearchAnalytics(){let z=this.storage.events.filter(($)=>$.type==="search"),J=new Map,Z=0;for(let $ of z){if($.query)J.set($.query,(J.get($.query)||0)+1);if($.metadata?.resultCount!==void 0)Z+=$.metadata.resultCount}let K=Array.from(J.entries()).map(([$,X])=>({query:$,count:X})).sort(($,X)=>X.count-$.count).slice(0,10);return{totalSearches:z.length,topQueries:K,avgResultCount:z.length>0?Z/z.length:0}}clear(){this.storage.events=[],this.storage.sessions=[],this.dirty=!0,this.startSession()}exportAnalytics(){return JSON.stringify({exportedAt:Date.now(),...this.storage},null,2)}}function Hz(){return`session-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import P from"fs";import p from"path";var Fz=".stx/story/bookmarks.json",Vz=1;class T{storage;storagePath;dirty=!1;constructor(z){this.storagePath=p.join(z,Fz),this.storage=this.loadStorage()}loadStorage(){try{let z=P.readFileSync(this.storagePath,"utf-8");return JSON.parse(z)}catch{return{version:Vz,bookmarks:[]}}}async save(){if(!this.dirty)return;let z=p.dirname(this.storagePath);await P.promises.mkdir(z,{recursive:!0}),await P.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}addBookmark(z,J,Z,K={}){let $={id:Rz(),name:K.name||`${z}/${J}`,storyId:z,variantId:J,props:Z,created:Date.now(),notes:K.notes,color:K.color};return this.storage.bookmarks.push($),this.dirty=!0,$}getAllBookmarks(){return[...this.storage.bookmarks]}getBookmarksForStory(z){return this.storage.bookmarks.filter((J)=>J.storyId===z)}getBookmark(z){return this.storage.bookmarks.find((J)=>J.id===z)}isBookmarked(z,J){return this.storage.bookmarks.some((Z)=>Z.storyId===z&&Z.variantId===J)}updateBookmark(z,J){let Z=this.getBookmark(z);if(!Z)return;return Object.assign(Z,J),this.dirty=!0,Z}deleteBookmark(z){let J=this.storage.bookmarks.findIndex((Z)=>Z.id===z);if(J===-1)return!1;return this.storage.bookmarks.splice(J,1),this.dirty=!0,!0}toggleBookmark(z,J,Z){let K=this.storage.bookmarks.find((X)=>X.storyId===z&&X.variantId===J);if(K)return this.deleteBookmark(K.id),{added:!1};return{added:!0,bookmark:this.addBookmark(z,J,Z)}}exportBookmarks(){return JSON.stringify(this.storage,null,2)}importBookmarks(z,J=!0){let Z=JSON.parse(z),K=0;for(let $ of Z.bookmarks){if(J){let X=this.storage.bookmarks.find((B)=>B.id===$.id);if(X)Object.assign(X,$);else this.storage.bookmarks.push($)}else this.storage.bookmarks.push($);K++}if(K>0)this.dirty=!0;return K}}function Rz(){return`bm-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}var N=new Set;function s(){return{open(z){N.add(z),z.send(JSON.stringify({type:"connected",timestamp:Date.now()}))},close(z){N.delete(z)},message(z,J){}}}function q(z){let J=JSON.stringify({...z,timestamp:z.timestamp||Date.now()});for(let Z of N)try{Z.send(J)}catch{N.delete(Z)}}function n(z,J){q({type:"story-update",data:{storyId:z,...J}})}function a(z,J){q({type:"story-add",data:{storyId:z,...J}})}function o(z){q({type:"story-remove",data:{storyId:z}})}function r(z){return`
|
|
3
3
|
<script>
|
|
4
4
|
(function() {
|
|
5
5
|
const ws = new WebSocket('${z}');
|
|
@@ -556,7 +556,7 @@ window.__stxPerformance = {
|
|
|
556
556
|
|
|
557
557
|
window.clearPerformanceMetrics = () => window.__stxPerformance.clear();
|
|
558
558
|
</script>
|
|
559
|
-
`}import w from"fs";import Xz from"path";var Mz=".stx/story/presets.json",C=1,Pz=10;class k{storage;storagePath;dirty=!1;constructor(z){this.storagePath=Xz.join(z,Mz),this.storage=this.loadStorage()}loadStorage(){try{let z=w.readFileSync(this.storagePath,"utf-8"),J=JSON.parse(z);if(J.version!==C)return this.migrateStorage(J);return J}catch{return{version:C,presets:[],recentIds:[]}}}migrateStorage(z){return{version:C,presets:z.presets||[],recentIds:z.recentIds||[]}}async save(){if(!this.dirty)return;let z=Xz.dirname(this.storagePath);await w.promises.mkdir(z,{recursive:!0}),await w.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}createPreset(z,J,Z={}){let K={id:Tz(),name:z,description:Z.description,props:J,componentId:Z.componentId,created:Date.now(),usageCount:0,tags:Z.tags};return this.storage.presets.push(K),this.dirty=!0,K}getPreset(z){return this.storage.presets.find((J)=>J.id===z)}getAllPresets(){return[...this.storage.presets]}getPresetsForComponent(z){return this.storage.presets.filter((J)=>!J.componentId||J.componentId===z)}getRecentPresets(){return this.storage.recentIds.map((z)=>this.getPreset(z)).filter((z)=>z!==void 0)}usePreset(z){let J=this.getPreset(z);if(!J)return;return J.lastUsed=Date.now(),J.usageCount++,this.storage.recentIds=[z,...this.storage.recentIds.filter((Z)=>Z!==z)].slice(0,Pz),this.dirty=!0,J}updatePreset(z,J){let Z=this.getPreset(z);if(!Z)return;return Object.assign(Z,J),this.dirty=!0,Z}deletePreset(z){let J=this.storage.presets.findIndex((Z)=>Z.id===z);if(J===-1)return!1;return this.storage.presets.splice(J,1),this.storage.recentIds=this.storage.recentIds.filter((Z)=>Z!==z),this.dirty=!0,!0}searchPresets(z){let J=z.toLowerCase();return this.storage.presets.filter((Z)=>{if(Z.name.toLowerCase().includes(J))return!0;if(Z.description?.toLowerCase().includes(J))return!0;if(Z.tags?.some((K)=>K.toLowerCase().includes(J)))return!0;return!1})}getMostUsedPresets(z=5){return[...this.storage.presets].sort((J,Z)=>Z.usageCount-J.usageCount).slice(0,z)}exportPresets(z){let J=z?this.storage.presets.filter((Z)=>z.includes(Z.id)):this.storage.presets;return JSON.stringify({presets:J},null,2)}importPresets(z,J=!1){let Z=JSON.parse(z),K=0;for(let $ of Z.presets){let X=this.storage.presets.find((B)=>B.id===$.id);if(X&&!J)continue;if(X)Object.assign(X,$);else this.storage.presets.push($);K++}if(K>0)this.dirty=!0;return K}}function Tz(){return`preset-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import S from"fs";var Qz=new Map;async function H(z,J,Z={}){let K=performance.now(),$=[];try{let X=await S.promises.stat(J),B=Qz.get(J),Y;if(B&&B.mtime===X.mtimeMs)Y=B.content;else Y=await S.promises.readFile(J,"utf-8"),Qz.set(J,{content:Y,mtime:X.mtimeMs,analyzed:null});let{processDirectives:W}=await import("./chunk-
|
|
559
|
+
`}import w from"fs";import Xz from"path";var Mz=".stx/story/presets.json",C=1,Pz=10;class k{storage;storagePath;dirty=!1;constructor(z){this.storagePath=Xz.join(z,Mz),this.storage=this.loadStorage()}loadStorage(){try{let z=w.readFileSync(this.storagePath,"utf-8"),J=JSON.parse(z);if(J.version!==C)return this.migrateStorage(J);return J}catch{return{version:C,presets:[],recentIds:[]}}}migrateStorage(z){return{version:C,presets:z.presets||[],recentIds:z.recentIds||[]}}async save(){if(!this.dirty)return;let z=Xz.dirname(this.storagePath);await w.promises.mkdir(z,{recursive:!0}),await w.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}createPreset(z,J,Z={}){let K={id:Tz(),name:z,description:Z.description,props:J,componentId:Z.componentId,created:Date.now(),usageCount:0,tags:Z.tags};return this.storage.presets.push(K),this.dirty=!0,K}getPreset(z){return this.storage.presets.find((J)=>J.id===z)}getAllPresets(){return[...this.storage.presets]}getPresetsForComponent(z){return this.storage.presets.filter((J)=>!J.componentId||J.componentId===z)}getRecentPresets(){return this.storage.recentIds.map((z)=>this.getPreset(z)).filter((z)=>z!==void 0)}usePreset(z){let J=this.getPreset(z);if(!J)return;return J.lastUsed=Date.now(),J.usageCount++,this.storage.recentIds=[z,...this.storage.recentIds.filter((Z)=>Z!==z)].slice(0,Pz),this.dirty=!0,J}updatePreset(z,J){let Z=this.getPreset(z);if(!Z)return;return Object.assign(Z,J),this.dirty=!0,Z}deletePreset(z){let J=this.storage.presets.findIndex((Z)=>Z.id===z);if(J===-1)return!1;return this.storage.presets.splice(J,1),this.storage.recentIds=this.storage.recentIds.filter((Z)=>Z!==z),this.dirty=!0,!0}searchPresets(z){let J=z.toLowerCase();return this.storage.presets.filter((Z)=>{if(Z.name.toLowerCase().includes(J))return!0;if(Z.description?.toLowerCase().includes(J))return!0;if(Z.tags?.some((K)=>K.toLowerCase().includes(J)))return!0;return!1})}getMostUsedPresets(z=5){return[...this.storage.presets].sort((J,Z)=>Z.usageCount-J.usageCount).slice(0,z)}exportPresets(z){let J=z?this.storage.presets.filter((Z)=>z.includes(Z.id)):this.storage.presets;return JSON.stringify({presets:J},null,2)}importPresets(z,J=!1){let Z=JSON.parse(z),K=0;for(let $ of Z.presets){let X=this.storage.presets.find((B)=>B.id===$.id);if(X&&!J)continue;if(X)Object.assign(X,$);else this.storage.presets.push($);K++}if(K>0)this.dirty=!0;return K}}function Tz(){return`preset-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import S from"fs";var Qz=new Map;async function H(z,J,Z={}){let K=performance.now(),$=[];try{let X=await S.promises.stat(J),B=Qz.get(J),Y;if(B&&B.mtime===X.mtimeMs)Y=B.content;else Y=await S.promises.readFile(J,"utf-8"),Qz.set(J,{content:Y,mtime:X.mtimeMs,analyzed:null});let{processDirectives:W}=await import("./chunk-x01sw9wy.js"),j={},U=A(Y);if(U)try{await V(U,j,J)}catch(O){$.push(`Warning: Could not extract script variables: ${O instanceof Error?O.message:String(O)}`)}if(Z.props)Object.assign(j,Z.props);let Q=await W(Y,j,J,{},new Set),D=Wz(Y),L=A(Y);return Q=jz(Q),Q=Dz(Q,j),{html:Q,css:D,js:L,errors:$,duration:performance.now()-K}}catch(X){return $.push(X instanceof Error?X.message:String(X)),{html:`<div class="stx-render-error">${Lz($[0])}</div>`,css:"",js:"",errors:$,duration:performance.now()-K}}}async function qz(z){try{let J=await S.promises.readFile(z,"utf-8"),Z=A(J);if(!Z)return null;let K={};if(await V(Z,K,z),Array.isArray(K.variants))return K.variants;return null}catch{return null}}async function Bz(z,J,Z,K){let $=J.story?.variants;if(!$){let Y=await qz(J.path);if(Y)$=Y}if(!$&&Z==="default")return H(z,J.path,{props:K||{}});if(!$)return H(z,J.path,{props:K||{}});let X=$.find((Y)=>Y.id===Z);if(!X&&Z==="default")return H(z,J.path,{props:K||{}});if(!X)return{html:'<div class="stx-render-error">Variant not found</div>',css:"",js:"",errors:[`Variant '${Z}' not found`],duration:0};let B={...X.state,...K};if(X.source)return wz(z,X.source,B);return H(z,J.path,{props:B})}async function wz(z,J,Z={}){let K=performance.now(),$=[];try{let{processDirectives:X}=await import("./chunk-x01sw9wy.js"),B={...Z},Y=A(J);if(Y)try{await V(Y,B,"inline-template.stx")}catch{}let j=await X(J,B,"inline-template.stx",{},new Set);return j=jz(j),j=Dz(j,B),{html:j,css:Wz(J),js:A(J),errors:$,duration:performance.now()-K}}catch(X){return $.push(X instanceof Error?X.message:String(X)),{html:`<div class="stx-render-error">${Lz($[0])}</div>`,css:"",js:"",errors:$,duration:performance.now()-K}}}function Wz(z){let J=[],Z=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,K=Z.exec(z);while(K!==null)J.push(K[1].trim()),K=Z.exec(z);return J.join(`
|
|
560
560
|
`)}function jz(z){return z.replace(/<!--[\s\S]*?-->/g,"").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"").replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/^\s*\n/gm,"").trim()}function A(z){let J=[],Z=/<script\b[^>]*>([\s\S]*?)<\/script>/gi,K=Z.exec(z);while(K!==null)J.push(K[1].trim()),K=Z.exec(z);return J.join(`
|
|
561
561
|
`)}function Dz(z,J){let Z=`<script>window.__stxProps = ${JSON.stringify(J)};</script>`;return z+Z}function Lz(z){return z.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}async function Oz(z,J){let Z=await I(z);f(z,Z);let K=v(z.config,Z);g(z,K),console.log(` Found ${Z.length} story files`);let $=typeof J.host==="string"?J.host:J.host===!0?"0.0.0.0":"localhost",X=new k(z.root),B=new T(z.root),Y=new M(z.root),W=s(),j=Bun.serve({port:J.port,hostname:$,fetch:async(Q,D)=>{let O=new URL(Q.url).pathname;if(O==="/__hmr"){if(D.upgrade(Q,{data:{isHmr:!0}}))return;return new Response("WebSocket upgrade failed",{status:400})}if(O.startsWith("/api/"))return Cz(z,O,Q,{presetsManager:X,bookmarksManager:B,analyticsTracker:Y});return kz(z,O,J.port)},websocket:{open(Q){W.open(Q)},close(Q){W.close(Q)},message(Q,D){W.message(Q,D)}}}),U=`http://${$}:${J.port}`,_=Uz(z,async(Q,D)=>{console.log(` [${Q}] ${D.relativePath}`);let L=await I(z);f(z,L);let O=v(z.config,L);if(g(z,O),Q==="add")a(D.id,{fileName:D.fileName});else if(Q==="unlink")o(D.id);else n(D.id,{fileName:D.fileName})});if(J.open){let Q=U;try{let{exec:D}=await import("child_process"),L=process.platform;D(`${L==="darwin"?"open":L==="win32"?"start":"xdg-open"} ${Q}`)}catch{}}return{server:j,url:U,close:async()=>{_(),j.stop()}}}async function Cz(z,J,Z,K){let{presetsManager:$,bookmarksManager:X,analyticsTracker:B}=K;if(J==="/api/stories")return Response.json({files:z.storyFiles.map((Y)=>({id:Y.id,fileName:Y.fileName,relativePath:Y.relativePath,treePath:Y.treePath})),tree:z.tree});if(J.startsWith("/api/story/")){let Y=J.slice(11),W=z.storyFiles.find((j)=>j.id===Y);if(!W)return new Response("Story not found",{status:404});try{let j=await Bun.file(W.path).text();return Response.json({id:W.id,fileName:W.fileName,relativePath:W.relativePath,content:j})}catch{return new Response("Error reading story",{status:500})}}if(J==="/api/config")return Response.json({theme:z.config.theme,responsivePresets:z.config.responsivePresets,backgroundPresets:z.config.backgroundPresets});if(J.startsWith("/api/render/")){let Y=new URL(Z.url),W=J.slice(12).split("/"),j=W[0],U=W[1]||"default",_,Q=Y.searchParams.get("props");if(Q)try{_=JSON.parse(Q)}catch{}let D=z.storyFiles.find((L)=>L.id===j);if(!D)return new Response("Story not found",{status:404});try{let L=await Bz(z,D,U,_);return Response.json({html:L.html,css:L.css,js:L.js,errors:L.errors,duration:L.duration})}catch(L){return Response.json({html:"",css:"",js:"",errors:[L instanceof Error?L.message:String(L)],duration:0},{status:500})}}if(J==="/api/presets"&&Z.method==="GET")return Response.json({presets:$.getAllPresets()});if(J==="/api/presets"&&Z.method==="POST")try{let Y=await Z.json(),W=$.createPreset(Y.name,Y.props,{componentId:Y.componentId,description:Y.description});return await $.save(),Response.json(W)}catch(Y){return Response.json({error:String(Y)},{status:400})}if(J.startsWith("/api/presets/")&&!J.includes("/use")&&Z.method==="GET"){let Y=J.slice(13),W=$.getPreset(Y);if(!W)return new Response("Preset not found",{status:404});return Response.json(W)}if(J.endsWith("/use")&&Z.method==="POST"){let Y=J.slice(13,-4),W=$.usePreset(Y);if(!W)return new Response("Preset not found",{status:404});return await $.save(),Response.json(W)}if(J.startsWith("/api/presets/")&&Z.method==="DELETE"){let Y=J.slice(13);if(!$.deletePreset(Y))return new Response("Preset not found",{status:404});return await $.save(),Response.json({success:!0})}if(J==="/api/bookmarks"&&Z.method==="GET")return Response.json({bookmarks:X.getAllBookmarks()});if(J==="/api/bookmarks"&&Z.method==="POST")try{let Y=await Z.json(),W=X.addBookmark(Y.storyId,Y.variantId,Y.props,{name:Y.name,notes:Y.notes,color:Y.color});return await X.save(),Response.json(W)}catch(Y){return Response.json({error:String(Y)},{status:400})}if(J==="/api/bookmarks/toggle"&&Z.method==="POST")try{let Y=await Z.json(),W=X.toggleBookmark(Y.storyId,Y.variantId,Y.props);return await X.save(),Response.json(W)}catch(Y){return Response.json({error:String(Y)},{status:400})}if(J.startsWith("/api/bookmarks/")&&J!=="/api/bookmarks/toggle"&&Z.method==="GET"){let Y=J.slice(15),W=X.getBookmark(Y);if(!W)return new Response("Bookmark not found",{status:404});return Response.json(W)}if(J.startsWith("/api/bookmarks/")&&Z.method==="DELETE"){let Y=J.slice(15);if(!X.deleteBookmark(Y))return new Response("Bookmark not found",{status:404});return await X.save(),Response.json({success:!0})}if(J==="/api/analytics/track"&&Z.method==="POST")try{let Y=await Z.json();if(Y.type==="view"&&Y.componentId)B.trackView(Y.componentId,Y.variantId);else if(Y.type==="prop_change"&&Y.componentId&&Y.propName)B.trackPropChange(Y.componentId,Y.propName,null);else if(Y.type==="variant_switch"&&Y.componentId&&Y.variantId)B.trackVariantSwitch(Y.componentId,Y.variantId);else if(Y.type==="search"&&Y.query)B.trackSearch(Y.query,0);return await B.save(),Response.json({success:!0})}catch(Y){return Response.json({error:String(Y)},{status:400})}if(J==="/api/analytics/summary"&&Z.method==="GET")return Response.json({mostViewed:B.getMostViewedComponents(10),mostChangedProps:B.getMostChangedProps(10),searchAnalytics:B.getSearchAnalytics()});if(J.startsWith("/api/analytics/component/")&&Z.method==="GET"){let Y=J.slice(25),W=z.storyFiles.find((U)=>U.id===Y),j=B.getComponentAnalytics(Y,W?.fileName||Y);return Response.json(j)}return new Response("Not found",{status:404})}function kz(z,J,Z){let K=Sz(z,Z);return new Response(K,{headers:{"Content-Type":"text/html; charset=utf-8"}})}function Sz(z,J){let{theme:Z}=z.config,K=Z.title||"STX Story",$=`ws://localhost:${J}/__hmr`,X=r($);return`<!DOCTYPE html>
|
|
562
562
|
<html lang="en" class="${Z.darkClass||"dark"}">
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{qk as m}from"./chunk-vm5jbgb1.js";import{tw as z}from"./chunk-5g6rprcy.js";import{existsSync as s,mkdirSync as T,copyFileSync as F,chmodSync as A}from"fs";import{join as Z,basename as Yq}from"path";import{spawn as j,execSync as Zq}from"child_process";import{tmpdir as c,homedir as P,platform as Lq}from"os";var Iq=`
|
|
3
3
|
<script>
|
|
4
4
|
(function() {
|
|
5
5
|
'use strict';
|
|
@@ -3019,4 +3019,4 @@ Terminal=false
|
|
|
3019
3019
|
Categories=Utility;
|
|
3020
3020
|
Icon=${$.toLowerCase()}
|
|
3021
3021
|
`;z("fs").writeFileSync(Z(Y,`${$.toLowerCase()}.desktop`),_);let E=Buffer.from([137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,1,0,0,0,1,8,2,0,0,0,144,119,83,222,0,0,0,12,73,68,65,84,8,215,99,248,255,255,63,0,5,254,2,254,220,204,89,231,0,0,0,0,73,69,78,68,174,66,96,130]);if(z("fs").writeFileSync(Z(Y,`${$.toLowerCase()}.png`),E),J.icon&&s(J.icon))F(J.icon,Z(Y,`${$.toLowerCase()}.png`));let H=j("appimagetool",[Y,U],{env:{...process.env,ARCH:"x86_64"}});H.on("close",(x)=>{if(z("fs").rmSync(K,{recursive:!0,force:!0}),x===0)A(U,493),W({success:!0});else W({success:!1,error:`appimagetool exited with code ${x}. Install from https://appimage.github.io/appimagetool/`})}),H.on("error",(x)=>{z("fs").rmSync(K,{recursive:!0,force:!0}),W({success:!1,error:`appimagetool not found: ${x.message}`})})}catch(K){W({success:!1,error:K.message})}})}function Vq(){return[I()]}function Fq(q){switch(q){case"macos":return["app","dmg","pkg"];case"windows":return["app","zip","msi"];case"linux":return["app","deb","rpm","appimage"];case"ios":return["ipa"];case"android":return["apk"];default:return["app"]}}var Aq={buildNative:Qq,getAvailableTargets:Vq,getAvailableFormats:Fq,detectPlatform:I},cq=Aq;
|
|
3022
|
-
export{Iq as
|
|
3022
|
+
export{Iq as _j,D as $j,Cq as ak,yq as bk,N as ck,b as dk,h as ek,bq as fk,u as gk,Pq as hk,vq as ik,Qq as jk,Vq as kk,Fq as lk,cq as mk};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Qg as a,Rg as b,Sg as c,Tg as d,Ug as e,Vg as f,Wg as g,Xg as h,Yg as i}from"./chunk-yne23w3c.js";import"./chunk-18018jkn.js";import"./chunk-5g6rprcy.js";export{c as setCachedImageResult,e as processImage,f as optimizeImage,b as getCachedImageResult,i as generateSrcset,h as generateResponsiveVariants,d as clearImageCache,g as applyTransformations,a as ImageProcessorCache};
|
|
@@ -394,4 +394,4 @@ else {
|
|
|
394
394
|
${JSON.stringify(j)}
|
|
395
395
|
</script>
|
|
396
396
|
`}var r={processPartialHydrationDirectives:b,processStaticDirectives:x,generatePartialHydrationCSS:H,generateIslandManifest:y,createIslandRegistry:f,hydrateIsland:S,hydrateByStrategy:h,hydrateAll:g,isHydrated:v,onHydrated:u};
|
|
397
|
-
export{B as
|
|
397
|
+
export{B as Ih,I as Jh,E as Kh,V as Lh,f as Mh,b as Nh,H as Oh,S as Ph,h as Qh,g as Rh,v as Sh,u as Th,x as Uh,y as Vh,r as Wh};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
export{A as
|
|
2
|
+
import{hq as M,lq as w}from"./chunk-e3rgky2r.js";import{Fs as O}from"./chunk-nhbc464j.js";import{tw as G}from"./chunk-5g6rprcy.js";import V from"fs";import W from"path";import{fileURLToPath as y}from"url";var A=new Map,X=new Map;async function u(j){let z;for(let I=0;I<3;I++)try{let Y=(await V.promises.stat(j)).mtime.getTime(),Q=X.get(j);if(Q&&Q.mtime===Y)return Q.content;let Z=await Bun.file(j).text(),N=(await V.promises.stat(j)).mtime.getTime();if(N!==Y)continue;return X.set(j,{content:Z,mtime:N}),Z}catch(J){z=J;break}throw X.delete(j),Error(`File not found: ${j}${z?` (${z.message})`:""}`)}function g(j){X.delete(j)}function P(j){for(let B of X.keys())if(B.startsWith(j))X.delete(B)}var q=null,v=null,T=null;function m(j){T=j}async function k(j=!1){let B=T??await import("./chunk-qtc28zy1.js");if(j)return B.generateSignalsRuntimeDev();if(q===null)q=B.generateSignalsRuntime();return q}var D=null;async function H(){if(D===null){let{getRouterScript:j}=await import("./chunk-gz539gk6.js");D=j()}return D}var L={};async function p(j,B=!1){let z=j==="runtime"?await k(B):await H(),I=j==="runtime"&&B?"runtime-debug":j,J=L[I];if(!J||J.content!==z)J={content:z,hash:Bun.hash(z).toString(16).padStart(16,"0").slice(0,16)},L[I]=J;return{content:z,hash:J.hash,url:`/_stx/${j}.${J.hash}.js`}}function d(){X.clear(),w(),O(),q=null,v=null,D=null}function x(j){let B={debug:j.debug===!0,middleware:(j.middleware??[]).map((z)=>({name:z.name,timing:z.timing,handler:String(z.handler)})),customDirectives:(j.customDirectives??[]).map((z)=>({name:z.name,hasEndTag:z.hasEndTag===!0,handler:String(z.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(B)).digest("hex")}var U;function b(){if(U)return U;let j="unknown";try{j=String(JSON.parse(V.readFileSync(new URL("../package.json",import.meta.url),"utf8")).version)}catch{}if(import.meta.url.endsWith(".ts"))try{let B=W.dirname(y(import.meta.url)),z=0;for(let I of V.readdirSync(B,{recursive:!0,withFileTypes:!0}))if(I.isFile()&&I.name.endsWith(".ts"))z=Math.max(z,V.statSync(W.join(I.parentPath,I.name)).mtimeMs);j+=`+src.${Math.trunc(z)}`}catch{}return U=j,j}async function f(j,B){try{if(!B.cachePath)return null;let z=W.resolve(B.cachePath),I=W.join(z,`${K(j)}.html`),J=W.join(z,`${K(j)}.meta.json`);if(!await M(I)||!await M(J))return null;let Y=await Bun.file(J).text(),Q=JSON.parse(Y);if(Q.cacheVersion!==B.cacheVersion)return null;if(Q.engine!==b())return null;if(Q.optionsSignature!==x(B))return null;if((await V.promises.stat(j)).mtime.getTime()>Q.mtime)return null;for(let $ of Q.dependencies)if(await M($)){if((await V.promises.stat($)).mtime.getTime()>Q.mtime)return null}else return null;return await Bun.file(I).text()}catch(z){return console.warn(`Cache error for ${j}:`,z),null}}async function l(j,B,z,I){try{if(!I.cachePath)return;let J=W.resolve(I.cachePath);await V.promises.mkdir(J,{recursive:!0});let Y=W.join(J,`${K(j)}.html`),Q=W.join(J,`${K(j)}.meta.json`),Z=await V.promises.stat(j);await Bun.write(Y,B);let $={sourcePath:j,mtime:Z.mtime.getTime(),dependencies:Array.from(z),cacheVersion:I.cacheVersion,engine:b(),optionsSignature:x(I),generatedAt:Date.now()};await Bun.write(Q,JSON.stringify($,null,2)),A.set(j,{output:B,mtime:Z.mtime.getTime(),dependencies:z})}catch(J){console.warn(`Failed to cache template ${j}:`,J)}}var E=16;function K(j){return new Bun.CryptoHasher("sha1").update(j).digest("hex").substring(0,E)}
|
|
3
|
+
export{A as Jj,u as Kj,g as Lj,P as Mj,m as Nj,k as Oj,H as Pj,p as Qj,d as Rj,b as Sj,f as Tj,l as Uj,K as Vj};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{$t as U,Iu as b,pu as v}from"./chunk-799s9mwc.js";import{Ru as w}from"./chunk-7r80apc5.js";function p(F,z,V,Y){let Q=F;Q=Q.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,Z,J)=>{if(!J&&Z.includes(":")){let N=Z.split(":"),L=Z,q=N.length>1?N[1]:"";if(q&&z[q])J=z[q];else if(L.startsWith("og:")&&z.openGraph&&z.openGraph[N[1]])J=z.openGraph[N[1]];else J="";return J?`<meta property="${$(L)}" content="${$(J)}">`:""}return J?`<meta name="${$(Z)}" content="${$(J)}">`:""});let _=/@metaTag\s*\(/g,I;while((I=_.exec(Q))!==null){let K=I.index,Z=K+I[0].length-1,J=1,N=Z+1;while(N<Q.length&&J>0){if(Q[N]==="(")J++;else if(Q[N]===")"){if(J--,J===0)break}N++}if(J!==0)break;let L=Q.substring(Z+1,N).trim(),q=N+1,B=(()=>{try{let A=b(L,z);if(!A)return"";let j="<meta";if(A.name)j+=` name="${$(String(A.name))}"`;if(A.property)j+=` property="${$(String(A.property))}"`;if(A.httpEquiv)j+=` http-equiv="${$(String(A.httpEquiv))}"`;if(A.content)j+=` content="${$(String(A.content))}"`;return j+=">",j}catch(A){let j=A instanceof Error?A.message:String(A);return v("MetaTag",j,U.EVALUATION_ERROR)}})();Q=Q.substring(0,K)+B+Q.substring(q),_.lastIndex=0}return Q}function i(F,z,V){let Y=F,Q=/@structuredData\s*\(/g,_;while((_=Q.exec(Y))!==null){let I=_.index,K=I+_[0].length-1,Z=1,J=K+1;while(J<Y.length&&Z>0){if(Y[J]==="(")Z++;else if(Y[J]===")"){if(Z--,Z===0)break}J++}if(Z!==0)break;let N=Y.substring(K+1,J).trim(),L=J+1,q=(()=>{try{let B=b(N,z);if(!B)return"";if(!B["@context"])B["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(B).replace(/<\//g,"<\\/")}</script>`}catch(B){let A=B instanceof Error?B.message:String(B);return v("StructuredData",A,U.EVALUATION_ERROR)}})();Y=Y.substring(0,I)+q+Y.substring(L),Q.lastIndex=0}return Y}function c(F,z,V,Y){let Q=F,_=/@seo\s*\(\s*\{/g,I;while((I=_.exec(Q))!==null){let K=Q.indexOf("{",I.index+4),Z=1,J=K+1,N=null,L=!1;while(J<Q.length&&Z>0){let R=Q[J];if(L){L=!1,J++;continue}if(R==="\\"&&N){L=!0,J++;continue}if(N){if(R===N)N=null;J++;continue}if(R==='"'||R==="'"||R==="`"){N=R,J++;continue}if(R==="{")Z++;else if(R==="}")Z--;J++}if(Z!==0)break;let q=Q.substring(J).match(/^\s*\)/);if(!q)break;let B=J+q[0].length,A=Q.substring(K,J),j=Q.substring(I.index,B),X=((R)=>{try{let G=b(R,z);if(!G)return"";let k="";if(G.title)k+=`<title>${$(G.title)}</title>
|
|
3
|
+
`,k+=`<meta name="title" content="${$(G.title)}">
|
|
4
|
+
`;if(G.description)k+=`<meta name="description" content="${$(G.description)}">
|
|
5
|
+
`;if(G.keywords){let W=Array.isArray(G.keywords)?G.keywords.join(", "):G.keywords;k+=`<meta name="keywords" content="${$(W)}">
|
|
6
|
+
`}if(G.robots)k+=`<meta name="robots" content="${$(G.robots)}">
|
|
7
|
+
`;if(G.canonical)k+=`<link rel="canonical" href="${$(G.canonical)}">
|
|
8
|
+
`;if(G.openGraph){let W=G.openGraph;if(k+=`<meta property="og:type" content="${$(W.type||"website")}">
|
|
9
|
+
`,W.title||G.title){let O=W.title||G.title||"";k+=`<meta property="og:title" content="${$(O)}">
|
|
10
|
+
`}if(W.description||G.description){let O=W.description||G.description||"";k+=`<meta property="og:description" content="${$(O)}">
|
|
11
|
+
`}if(W.url||G.canonical){let O=W.url||G.canonical||"";k+=`<meta property="og:url" content="${$(O)}">
|
|
12
|
+
`}if(W.image){if(k+=`<meta property="og:image" content="${$(W.image)}">
|
|
13
|
+
`,W.imageAlt)k+=`<meta property="og:image:alt" content="${$(W.imageAlt)}">
|
|
14
|
+
`;if(W.imageWidth)k+=`<meta property="og:image:width" content="${$(String(W.imageWidth))}">
|
|
15
|
+
`;if(W.imageHeight)k+=`<meta property="og:image:height" content="${$(String(W.imageHeight))}">
|
|
16
|
+
`;if(W.imageType)k+=`<meta property="og:image:type" content="${$(W.imageType)}">
|
|
17
|
+
`}if(W.siteName)k+=`<meta property="og:site_name" content="${$(W.siteName)}">
|
|
18
|
+
`;if(W.locale)k+=`<meta property="og:locale" content="${$(W.locale)}">
|
|
19
|
+
`;if(W.profile){let O=[["first_name",W.profile.firstName],["last_name",W.profile.lastName],["username",W.profile.username],["gender",W.profile.gender]];for(let[D,C]of O)if(C)k+=`<meta property="profile:${D}" content="${$(C)}">
|
|
20
|
+
`}}if(G.twitter){let W=G.twitter;if(k+=`<meta name="twitter:card" content="${$(W.card||"summary_large_image")}">
|
|
21
|
+
`,W.title||G.title){let O=W.title||G.title||"";k+=`<meta name="twitter:title" content="${$(O)}">
|
|
22
|
+
`}if(W.description||G.description){let O=W.description||G.description||"";k+=`<meta name="twitter:description" content="${$(O)}">
|
|
23
|
+
`}if(W.image||G.openGraph&&G.openGraph.image){let O=W.image||(G.openGraph?G.openGraph.image:"")||"";k+=`<meta name="twitter:image" content="${$(O)}">
|
|
24
|
+
`;let D=W.imageAlt||(!W.image&&G.openGraph?G.openGraph.imageAlt:void 0);if(D)k+=`<meta name="twitter:image:alt" content="${$(D)}">
|
|
25
|
+
`}if(W.site)k+=`<meta name="twitter:site" content="${$(W.site)}">
|
|
26
|
+
`;if(W.creator)k+=`<meta name="twitter:creator" content="${$(W.creator)}">
|
|
27
|
+
`}if(G.structuredData){let W=JSON.stringify(G.structuredData).replace(/<\//g,"<\\/");k+=`<script type="application/ld+json">${W}</script>
|
|
28
|
+
`}return k.trim()}catch(G){let k=G instanceof Error?G.message:String(G);return v("SEO",`Error processing @seo directive: ${k}`,U.EVALUATION_ERROR)}})(A);Q=Q.substring(0,I.index)+X+Q.substring(B),_.lastIndex=I.index+X.length}return Q}function r(F,z,V){if(V.seo?.enabled===!1)return F;if(F.includes("<!-- stx SEO Tags -->")||z.__stx_seo_staged===!0||V.skipDefaultSeoTags===!0)return F;let Y=z.__stx_runtime_head;if(!!(Y?.title||Y?.meta?.some((R)=>R.property==="og:title"||R.name==="og:title"||R.name==="twitter:title"||R.name==="description")))return F;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test(F)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test(F)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test(F))return F;if(!F.includes("<head>")&&!F.includes("<head "))return F;let _=F.includes("<title>")||F.includes("</title>"),I=P(F),K=T(I),Z=f(I),J="";if(z.title)J=z.title;else if(z.meta&&z.meta.title)J=z.meta.title;else if(K)J=K;else if(V.seo?.defaultConfig?.title)J=V.seo.defaultConfig.title;else J=V.defaultTitle||"stx Project";let N="";if(z.description)N=z.description;else if(z.meta&&z.meta.description)N=z.meta.description;else if(Z)N=Z;else if(V.seo?.defaultConfig?.description)N=V.seo.defaultConfig.description;else N=V.defaultDescription||"A website built with stx templating engine";let L="";if(z.image)L=z.image;else if(z.meta&&z.meta.image)L=z.meta.image;else if(z.openGraph&&z.openGraph.image)L=z.openGraph.image;else if(V.seo?.defaultImage)L=V.seo.defaultImage;else if(V.defaultImage)L=V.defaultImage;let q=_?"":`
|
|
29
|
+
<meta name="title" content="${$(J)}">`,B=H(I)?"":`
|
|
30
|
+
<meta name="description" content="${$(N)}">`,A=`
|
|
31
|
+
<!-- stx SEO Tags -->${q}${B}
|
|
32
|
+
<meta property="og:title" content="${$(J)}">
|
|
33
|
+
<meta property="og:description" content="${$(N)}">
|
|
34
|
+
<meta property="og:type" content="website">
|
|
35
|
+
<meta name="twitter:card" content="summary_large_image">
|
|
36
|
+
<meta name="twitter:title" content="${$(J)}">
|
|
37
|
+
<meta name="twitter:description" content="${$(N)}">
|
|
38
|
+
`;if(L)A+=`
|
|
39
|
+
<meta property="og:image" content="${$(L)}">
|
|
40
|
+
<meta name="twitter:image" content="${$(L)}">
|
|
41
|
+
`;let j=F;if(!_)j=j.replace(/<head[^>]*>/,`$&
|
|
42
|
+
<title>${$(J)}</title>`);let X=z.__stx_head_injections;if(X)return z.__stx_seo_staged=!0,X.afterOpen.push(`
|
|
43
|
+
${A}
|
|
44
|
+
`),j;return j.replace(/<head[^>]*>/,`$&
|
|
45
|
+
${A}
|
|
46
|
+
`)}function P(F){let z=F.search(/<\/head\s*>/i);return z===-1?F:F.slice(0,z)}function M(F){return F.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�*39;|'/g,"'").replace(/&/g,"&")}function T(F){let z=F.match(/<title(?:\s[^>]*)?>([\s\S]*?)<\/title\s*>/i);return z?M(z[1].trim()):""}function y(F){return(F.match(/<meta\s[^>]*>/gi)||[]).filter((z)=>/\sname\s*=\s*["']description["']/i.test(z))}function H(F){return y(F).length>0}function f(F){for(let z of y(F)){let V=z.match(/\scontent\s*=\s*(?:"([^"]*)"|'([^']*)')/i),Y=(V?.[1]??V?.[2]??"").trim();if(Y)return M(Y)}return""}function $(F){return F.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var x=["og:","article:","book:","profile:","fb:","music:","video:"];function S(F){let z=F.trim(),V=z[0];if((V==="'"||V==='"'||V==="`")&&z.length>1&&z.at(-1)===V)return{value:z.slice(1,-1),quoted:!0};return{value:z,quoted:!1}}var d={name:"meta",handler:(F,z,V,Y)=>{if(z.length<1)return v("Meta","meta directive requires at least the meta name",U.INVALID_DIRECTIVE_SYNTAX);let Q=S(z[0]).value,_;if(z.length>1){let Z=S(z[1]);_=Z.quoted?Z.value:String(V?.[Z.value]??Z.value)}else{let Z=Q.includes(":")?Q.slice(Q.indexOf(":")+1):Q,J=V?.openGraph;_=String(V?.[Z]??J?.[Z]??"")}if(!_)return"";let K=x.some((Z)=>Q.startsWith(Z))?{property:Q,content:_}:{name:Q,content:_};if(V)V.__stx_runtime_head=w(V.__stx_runtime_head??{},{meta:[K]});return""},hasEndTag:!1},h={name:"structuredData",handler:(F,z,V,Y)=>{if(F.trim()==="")return v("StructuredData","structuredData directive requires JSON-LD content",U.INVALID_DIRECTIVE_SYNTAX);try{let Q=JSON.parse(F);if(!Q["@context"])Q["@context"]="https://schema.org";if(!Q["@type"])return v("StructuredData","structuredData requires @type property",U.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(Q)}</script>`}catch(Q){let _=Q instanceof Error?Q.message:String(Q);return v("StructuredData",_,U.EVALUATION_ERROR)}},hasEndTag:!0};function s(){return[d,h]}function n(F,z){let{baseUrl:V,defaultChangefreq:Y="weekly",defaultPriority:Q=0.5,includeLastmod:_=!0}=z,I=V.replace(/\/$/,"");return`<?xml version="1.0" encoding="UTF-8"?>
|
|
47
|
+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
48
|
+
${F.map((Z)=>{let J=Z.loc.startsWith("http")?Z.loc:`${I}${Z.loc.startsWith("/")?"":"/"}${Z.loc}`,N=Z.lastmod||(_?new Date().toISOString().split("T")[0]:void 0),L=Z.changefreq||Y,q=Z.priority??Q,B=` <url>
|
|
49
|
+
<loc>${E(J)}</loc>`;if(N)B+=`
|
|
50
|
+
<lastmod>${N}</lastmod>`;return B+=`
|
|
51
|
+
<changefreq>${L}</changefreq>`,B+=`
|
|
52
|
+
<priority>${q.toFixed(1)}</priority>`,B+=`
|
|
53
|
+
</url>`,B}).join(`
|
|
54
|
+
`)}
|
|
55
|
+
</urlset>`}function a(F,z){let V=z.replace(/\/$/,""),Y=new Date().toISOString().split("T")[0];return`<?xml version="1.0" encoding="UTF-8"?>
|
|
56
|
+
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
57
|
+
${F.map((_)=>{let I=_.startsWith("http")?_:`${V}${_.startsWith("/")?"":"/"}${_}`;return` <sitemap>
|
|
58
|
+
<loc>${E(I)}</loc>
|
|
59
|
+
<lastmod>${Y}</lastmod>
|
|
60
|
+
</sitemap>`}).join(`
|
|
61
|
+
`)}
|
|
62
|
+
</sitemapindex>`}async function o(F,z){let{extensions:V=[".stx",".html",".htm"],ignore:Y=["_*",".*","node_modules","components","partials","layouts"]}=z,Q=[],_=V.length===1?`*${V[0]}`:`*{${V.join(",")}}`,I=new Bun.Glob(`**/${_}`);for await(let K of I.scan(F)){if(Y.some((q)=>{if(q.startsWith("*"))return K.includes(q.slice(1));return K.startsWith(q)||K.includes(`/${q}`)}))continue;let J=K.replace(/\\/g,"/").replace(/index\.(stx|html|htm)$/,"").replace(/\.(stx|html|htm)$/,"");if(!J.startsWith("/"))J=`/${J}`;if(J!=="/"&&J.endsWith("/"))J=J.slice(0,-1);let N=`${F}/${K}`,L;try{let q=await Bun.file(N).stat();if(q)L=new Date(q.mtime).toISOString().split("T")[0]}catch{}Q.push({loc:J||"/",lastmod:L,priority:J==="/"?1:0.5})}return Q.sort((K,Z)=>K.loc.localeCompare(Z.loc)),Q}function u(F){let z=[];for(let V of F.rules){if(z.push(`User-agent: ${V.userAgent}`),V.allow)for(let Y of V.allow)z.push(`Allow: ${Y}`);if(V.disallow)for(let Y of V.disallow)z.push(`Disallow: ${Y}`);if(V.crawlDelay!==void 0)z.push(`Crawl-delay: ${V.crawlDelay}`);z.push("")}if(F.sitemap){let V=Array.isArray(F.sitemap)?F.sitemap:[F.sitemap];for(let Y of V)z.push(`Sitemap: ${Y}`)}if(F.host)z.push(`Host: ${F.host}`);return z.join(`
|
|
63
|
+
`).trim()}function e(F){return u({rules:[{userAgent:"*",allow:["/"]}],sitemap:F})}function E(F){return F.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}
|
|
64
|
+
export{p as Jt,i as Kt,c as Lt,r as Mt,d as Nt,h as Ot,s as Pt,n as Qt,a as Rt,o as St,u as Tt,e as Ut};
|
|
@@ -144,4 +144,4 @@ var N=new Map,Q=new Map;function T(A){if(N.set(A.name,A),A.client)Q.set(A.name,A
|
|
|
144
144
|
console.log('[stx] Directive runtime initialized');
|
|
145
145
|
})();
|
|
146
146
|
`}function $(A){let B=/v-(\w+)(?::(\w+))?(?:\.([\w.]+))?="([^"]*)"/g;return A.replace(B,(C,F,H,L,J)=>{let E=(L?L.split("."):[]).reduce((M,S)=>{return M[S]=!0,M},{});return`data-stx-directive="${F}:${J}" data-stx-directive-arg="${H||""}" data-stx-directive-modifiers='${JSON.stringify(E)}'`})}
|
|
147
|
-
export{T as
|
|
147
|
+
export{T as ss,V as ts,W as us,X as vs,G as ws,Y as xs,Z as ys,_ as zs,$ as As};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{bv as a,cv as b}from"./chunk-2tjk867y.js";import"./chunk-
|
|
2
|
+
import{bv as a,cv as b}from"./chunk-2tjk867y.js";import"./chunk-5g6rprcy.js";export{a as transformStoreImports,b as stripModuleImports};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$e as c,Ze as a,_e as b,af as d,bf as e,cf as f,df as g,ef as h,ff as i,gf as j,hf as k,if as l,jf as m,kf as n,lf as o}from"./chunk-ym3r8ktq.js";import"./chunk-
|
|
2
|
+
import{$e as c,Ze as a,_e as b,af as d,bf as e,cf as f,df as g,ef as h,ff as i,gf as j,hf as k,if as l,jf as m,kf as n,lf as o}from"./chunk-ym3r8ktq.js";import"./chunk-5g6rprcy.js";export{k as writeNetlifyConfig,n as initNetlify,l as hasNetlifyConfig,g as getTotalSize,h as generateNetlifyToml,f as formatSize,e as filterRequiredFiles,i as detectProjectConfig,m as deploy,a as createNetlifyClient,d as createFileManifest,j as createDefaultNetlifyConfig,c as collectDeployFiles,b as calculateSha1,o as DeployError};
|
|
@@ -348,4 +348,4 @@ else {
|
|
|
348
348
|
console.log('[stx] Keep-alive runtime initialized');
|
|
349
349
|
})();
|
|
350
350
|
`}function Z(f){if(typeof document<"u")document.addEventListener("stx:activated",(j)=>{f(j.detail)})}function _(f){if(typeof document<"u")document.addEventListener("stx:deactivated",(j)=>{f(j.detail)})}
|
|
351
|
-
export{Q as
|
|
351
|
+
export{Q as Ai,T as Bi,W as Ci,X as Di,Y as Ei,Z as Fi,_ as Gi};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{ks as _}from"./chunk-hrdd26r4.js";import"./chunk-5g6rprcy.js";function W(j,G,H=240){return j.slice(G,G+H)}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:(j)=>/\b(?:async\s+)?function\s+alert\s*\(/.test(j)||/\b(?:const|let|var)\s+alert\s*=/.test(j)},{rule:"search-params",pattern:/new\s+URLSearchParams\s*\(/g,primitive:"useSearchParams()",why:"reactive, and writes back through the router instead of history.replaceState",reject:(j,G)=>{let H=j.indexOf("(",G);if(H===-1)return!0;let Q=j.slice(H+1,j.indexOf(")",H)+1);return!/\b(?:location|search|href|url)\b/i.test(Q)}},{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:(j,G)=>/^[^\n]*?(?:['"`]\s*)?(?:mailto:|tel:|sms:|https?:\/\/|\/\/)/.test(W(j,G,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:(j,G)=>!/\bfetch\s*\(|\$fetch\b|useFetch\b|\.get\s*\(|axios\b/.test(W(j,G))},{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:(j)=>/setTimeout\s*\(/.test(j)},{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"}],U=["confirm","tooltip",...v.map((j)=>j.rule)];function N(j,G){let H=1;for(let Q=0;Q<G;Q++)if(j[Q]===`
|
|
3
3
|
`)H++;return H}function P(j,G){let H=j.lastIndexOf(`
|
|
4
4
|
`,G)+1,Q=j.indexOf(`
|
|
5
5
|
`,G);return j.slice(H,Q===-1?j.length:Q).trim().slice(0,120)}function q(j,G){let H=j.slice(0,G),Q=H.lastIndexOf("function"),X=H.lastIndexOf("=>"),M=Math.max(Q,X);if(M===-1)return!1;let z=j.slice(Math.max(0,M-120),M);return/\basync\b[^;{}]*$/.test(z)}function L(j){return/\b(?:async\s+)?function\s+confirm\s*\(/.test(j)||/\b(?:const|let|var)\s+confirm\s*=/.test(j)||/\bimport\s*\{[^}]*\bconfirm\b[^}]*\}/.test(j)}function O(j,G,H){if(L(j))return j;let Q=/(^|[^\w$.])(?:(?:window|globalThis)\s*\.\s*)?confirm\s*\(/g,X=F(j),M="",z=0,Y;while((Y=Q.exec(X))!==null){let Z=Y.index+Y[1].length,$=N(j,Z),J=P(j,Z);if(/stxConfirm\s*\($/.test(j.slice(0,Z+8)))continue;let D=q(j,Z);if(H.push({file:G,line:$,rule:"confirm",applied:D,snippet:J,reason:D?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."}),D)M+=j.slice(z,Z)+"await stxConfirm(",z=Z+(Y[0].length-Y[1].length)}return M+j.slice(z)}function w(j,G,H){let Q=/(<[a-z][\w-]*\b[^>]*?)\stitle=(["'])(.*?)\2/gis,X=C(j),M="",z=0,Y;while((Y=Q.exec(X))!==null){let[Z,$,J,D]=Y,K=N(j,Y.index),B=P(j,Y.index),V=$.match(/^<([A-Za-z][\w-]*)/)?.[1]??"";if(/^[A-Z]/.test(V)){H.push({file:G,line:K,rule:"tooltip",applied:!1,snippet:B,reason:`\`title\` on <${V}> 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($)||D.trim()===""){H.push({file:G,line:K,rule:"tooltip",applied:!1,snippet:B,reason:/\bx-tooltip[=\s]/.test($)?"already has x-tooltip":"empty title"});continue}H.push({file:G,line:K,rule:"tooltip",applied:!0,snippet:B}),M+=j.slice(z,Y.index)+`${$} x-tooltip=${J}${D}${J} title=${J}${D}${J}`,z=Y.index+Z.length}return M+j.slice(z)}function C(j){return j.replace(/<!--[\s\S]*?-->/g,(G)=>G.replace(/[^\n]/g," ")).replace(/\{\{--[\s\S]*?--\}\}/g,(G)=>G.replace(/[^\n]/g," "))}function E(j){let G=(H)=>H.replace(/[^\n]/g," ");return j.replace(/\/\*[\s\S]*?\*\//g,G).replace(/\/\/[^\n]*/g,G)}function F(j,G=!1){let H=C(j);return(G?E(H):_(H)).replace(/<script\b([^>]*)>([\s\S]*?)<\/script\s*>/gi,(X,M)=>/\bclient\b/i.test(M)?X:X.replace(/[^\n]/g," "))}function S(j,G,H,Q){let X=F(j),M=F(j,!0);for(let z of v){if(!H.includes(z.rule))continue;if(z.requires&&!z.requires(j))continue;z.pattern.lastIndex=0;let Y,Z=/['"]/.test(z.pattern.source)?M:X;z.pattern.lastIndex=0;while((Y=z.pattern.exec(Z))!==null){if(z.reject?.(j,Y.index))continue;Q.push({file:G,line:N(j,Y.index),rule:z.rule,applied:!1,snippet:P(j,Y.index),reason:`${z.primitive} \u2014 ${z.why}`})}}}function k(j,G={}){let H=G.rules??U,Q=G.file??"<source>",X=[];S(j,Q,H,X);let M=j;if(H.includes("confirm"))M=O(M,Q,X);if(H.includes("tooltip"))M=w(M,Q,X);X.sort((Z,$)=>Z.line-$.line);let z=new Set,Y=X.filter((Z)=>{let $=`${Z.rule}:${Z.line}`;if(z.has($))return!1;return z.add($),!0});return{code:M,findings:Y}}var I=new Set(["confirm","tooltip"]);function A(j,G){if(j.length===0)return"No hand-rolled equivalents found.";let H=j.filter((z)=>z.applied),Q=j.filter((z)=>!z.applied&&I.has(z.rule)),X=j.filter((z)=>!z.applied&&!I.has(z.rule)),M=[];if(H.length>0){M.push(G?`Rewrote ${H.length} site(s):`:`Would rewrite ${H.length} site(s) (pass --fix):`);for(let z of H)M.push(` ${z.file}:${z.line} [${z.rule}] ${z.snippet}`)}if(Q.length>0){M.push("",`Needs a human \u2014 ${Q.length} site(s):`);for(let z of Q)M.push(` ${z.file}:${z.line} [${z.rule}] ${z.snippet}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{is as i}from"./chunk-t00ga194.js";import{$t as R,Iu as S,pu as T}from"./chunk-799s9mwc.js";import{tw as g}from"./chunk-5g6rprcy.js";import k from"path";var O;async function t(){if(O!==void 0)return O;try{O=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{O=null}return O}var y={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},F={},V={},E={};function vq(q){if(q)delete F[q];else for(let X of Object.keys(F))delete F[X]}function fq(){let q=Object.entries(F).map(([X,Q])=>({locale:X,loadedAt:new Date(Q.loadedAt),keyCount:p(Q.translations)}));return{size:Object.keys(F).length,locales:Object.keys(F),entries:q}}function p(q,X=0){for(let Q of Object.values(q))if(X++,Q&&typeof Q==="object"&&!Array.isArray(Q))X=p(Q,X);return X}function e(q,X=0){if(X<=0)return!1;return Date.now()-q.loadedAt>X}function dq(q){if(F[q])return"loaded";return E[q]||"idle"}function gq(q){return E[q]==="loading"}function uq(q){return!!F[q]}async function qq(q,X){let{locales:Q,parallel:H=!0,priority:J={},onLocaleLoaded:Y,onComplete:W,onError:$}=q,Z=H?Q:[...Q].sort((_,z)=>(J[z]||0)-(J[_]||0));if(H){let _=Z.map(async(z)=>{try{await P(z,X),Y?.(z)}catch(G){$?.(z,G instanceof Error?G:Error(String(G)))}});await Promise.all(_)}else for(let _ of Z)try{await P(_,X),Y?.(_)}catch(z){$?.(_,z instanceof Error?z:Error(String(z)))}W?.()}function hq(q,X){queueMicrotask(()=>{qq(q,X).catch((Q)=>{if(X.debug)console.error("Background preload error:",Q)})})}async function P(q,X){if({...y,...X.i18n}.cache&&F[q]){let J=F[q],Y=X.i18n?.cacheMaxAge??0;if(!e(J,Y))return J.translations}if(V[q]?.state==="loading")return V[q].promise;E[q]="loading";let H=b(q,X).then((J)=>{return E[q]="loaded",delete V[q],J}).catch((J)=>{throw E[q]="error",V[q]={promise:H,state:"error",error:J instanceof Error?J:Error(String(J))},J});return V[q]={promise:H,state:"loading"},H}function Hq(q){return F[q]?.translations}async function pq(q,X){let Q=Hq(q);if(Q)return Q;return P(q,X)}async function mq(q,X){if(F[q])return F[q].translations;if(V[q]){if(X)return Promise.race([V[q].promise,new Promise((Q,H)=>setTimeout(()=>H(Error(`Timeout waiting for locale: ${q}`)),X))]);return V[q].promise}throw Error(`Locale "${q}" is not loading. Call loadTranslationLazy first.`)}function cq(){return Object.entries(E).filter(([q,X])=>X==="loading").map(([q])=>q)}function iq(q){if(q)delete V[q],delete E[q];else{for(let X of Object.keys(V))delete V[X];for(let X of Object.keys(E))delete E[X]}}async function b(q,X){let Q={...y,...X.i18n},H=k.isAbsolute(Q.translationsDir)?Q.translationsDir:k.resolve(X.root||process.cwd(),Q.translationsDir);try{let J=await t(),Y=J?await J(q,{translationsDir:H,defaultLocale:Q.defaultLocale,sources:$q(Q.format)}):await Jq(q,Q,H);if(Y===void 0){if(q!==Q.defaultLocale)return b(Q.defaultLocale,X);return{}}let W=Y;if(Q.cache)F[q]={translations:W,loadedAt:Date.now(),locale:q};return W}catch(J){if(X.debug)console.error(`Error loading translation file for locale "${q}":`,J);if(q!==Q.defaultLocale)return b(Q.defaultLocale,X);return{}}}async function Jq(q,X,Q){let H=k.join(Q,`${q}${Qq(X.format)}`);try{let J=await import(H);return J.default||J}catch(J){try{let Y=await Bun.file(H).text();if(X.format==="yaml"||X.format==="yml")return Xq(Y);if(X.format==="json")return JSON.parse(Y);throw J}catch{return}}}function Qq(q){switch(q){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function Xq(q){let X={},Q=q.split(`
|
|
3
|
+
`),H=[{obj:X,indent:-1}];for(let J of Q){let Y=J.replace(/#.*$/,"").trimEnd();if(!Y.trim())continue;let W=Y.search(/\S/);if(W===-1)continue;while(H.length>1&&H[H.length-1].indent>=W)H.pop();let $=H[H.length-1].obj,Z=Y.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(Z){let[,,_,z]=Z,G=_.trim(),w=z.trim();if(w==="")$[G]={},H.push({obj:$[G],indent:W});else $[G]=Zq(w)}}return X}function Zq(q){if(q.startsWith("'")&&q.endsWith("'")||q.startsWith('"')&&q.endsWith('"'))return q.slice(1,-1);let X=q.toLowerCase();if(X==="true"||X==="yes")return!0;if(X==="false"||X==="no")return!1;if(X==="null"||X==="~")return null;let Q=Number(q);if(!Number.isNaN(Q)&&q!=="")return Q;return q}function $q(q){switch(q){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function Wq(q,X){return P(q,X)}function Yq(q,X){for(let Q of q){let H=Q.trim(),J=H.match(/^\{(\d+)\}\s*(.*)$/);if(J){let W=Number.parseInt(J[1],10);if(X===W)return J[2];continue}let Y=H.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(Y){let W=Number.parseInt(Y[1],10),$=Y[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(Y[2],10);if(X>=W&&X<=$)return Y[3];continue}}if(q.length===2)return X===1?q[0].trim():q[1].trim();if(X<q.length)return q[X].trim();return q[q.length-1].trim()}function _q(q,X={}){return m(q,X)}function m(q,X){let Q="",H=0;while(H<q.length)if(q[H]==="{"){let J=zq(q,H);if(J===-1){Q+=q[H],H++;continue}let Y=q.slice(H+1,J);Q+=Gq(Y,X),H=J+1}else if(q[H]==="'"&&H+1<q.length)if(q[H+1]==="'")Q+="'",H+=2;else if(q[H+1]==="{"||q[H+1]==="}")Q+=q[H+1],H+=2;else Q+=q[H],H++;else Q+=q[H],H++;return Q}function zq(q,X){let Q=0;for(let H=X;H<q.length;H++)if(q[H]==="{")Q++;else if(q[H]==="}"){if(Q--,Q===0)return H}return-1}function Gq(q,X){let Q=Bq(q);if(Q.length===0)return`{${q}}`;let H=Q[0].trim(),J=X[H];if(Q.length===1)return J!==void 0?String(J):`{${H}}`;switch(Q[1].trim().toLowerCase()){case"plural":return wq(J,Q.slice(2).join(","),X);case"select":return Dq(J,Q.slice(2).join(","));case"selectordinal":return Kq(J,Q.slice(2).join(","));case"number":return Vq(J,Q[2]?.trim());case"date":return Eq(J,Q[2]?.trim());case"time":return Aq(J,Q[2]?.trim());default:return J!==void 0?String(J):`{${q}}`}}function Bq(q){let X=[],Q="",H=0;for(let J=0;J<q.length;J++){let Y=q[J];if(Y==="{")H++,Q+=Y;else if(Y==="}")H--,Q+=Y;else if(Y===","&&H===0)X.push(Q),Q="";else Q+=Y}if(Q)X.push(Q);return X}function wq(q,X,Q){let H=Number(q)||0,J=C(X),Y=`=${H}`;if(J[Y])return I(J[Y],H,Q);let W=jq(H);if(J[W])return I(J[W],H,Q);if(J.other)return I(J.other,H,Q);return String(H)}function I(q,X,Q){let H=q.replace(/#/g,String(X));return m(H,Q)}function jq(q){let X=Math.abs(q),Q=Math.floor(X),H=String(q).includes(".")?String(q).split(".")[1].length:0;if(Q===1&&H===0)return"one";return"other"}function Dq(q,X){let Q=String(q||""),H=C(X);if(H[Q])return H[Q];return H.other||String(q)}function Kq(q,X){let Q=Number(q)||0,H=C(X),J=Fq(Q);if(H[J])return H[J].replace(/#/g,String(Q));if(H.other)return H.other.replace(/#/g,String(Q));return String(Q)}function Fq(q){let X=Math.abs(q),Q=X%10,H=X%100;if(Q===1&&H!==11)return"one";if(Q===2&&H!==12)return"two";if(Q===3&&H!==13)return"few";return"other"}function C(q){let X={},Q=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,H=Q.exec(q);while(H!==null)X[H[1]]=H[2],H=Q.exec(q);return X}function Vq(q,X){let Q=Number(q);if(Number.isNaN(Q))return String(q);switch(X){case"integer":return Math.floor(Q).toLocaleString();case"percent":return`${(Q*100).toFixed(0)}%`;case"currency":return Q.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Q.toLocaleString()}}function Eq(q,X){let Q=q instanceof Date?q:new Date(String(q));if(Number.isNaN(Q.getTime()))return String(q);let H={};switch(X){case"short":H.dateStyle="short";break;case"medium":H.dateStyle="medium";break;case"long":H.dateStyle="long";break;case"full":H.dateStyle="full";break;default:H.dateStyle="medium"}return Q.toLocaleDateString(void 0,H)}function Aq(q,X){let Q=q instanceof Date?q:new Date(String(q));if(Number.isNaN(Q.getTime()))return String(q);let H={};switch(X){case"short":H.timeStyle="short";break;case"medium":H.timeStyle="medium";break;case"long":H.timeStyle="long";break;case"full":H.timeStyle="full";break;default:H.timeStyle="short"}return Q.toLocaleTimeString(void 0,H)}function Uq(q){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(q)}function L(q,X,Q=!0,H={}){let J=q.split("."),Y=X;for(let $ of J){if(Y===void 0||Y===null)break;Y=Y[$]}if(Y===void 0||Y===null)return Q?q:"";let W=String(Y);if(Uq(W))return _q(W,H);if(W.includes("|")&&"count"in H){let $=Number(H.count),Z=W.split("|");W=Yq(Z,$)}for(let[$,Z]of Object.entries(H)){let _=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");W=W.replace(new RegExp(`:${_}`,"g"),String(Z))}return W}var u=new Set(["ar","arc","ckb","dv","fa","he","khw","ks","nqo","prs","ps","sd","syr","ug","ur","uz-af","yi"]),Mq=new Set(["adlm","arab","aran","hebr","nkoo","rohg","syrc","thaa","yezi"]);function x(q){if(!q)return"ltr";let X=q.trim().toLowerCase().replace(/_/g,"-").split("-"),Q=X[0];if(!Q)return"ltr";let H=X[1]?.length===4?X[1]:void 0;if(H)return Mq.has(H)?"rtl":"ltr";if(X.length>1&&u.has(`${Q}-${X[1]}`))return"rtl";return u.has(Q)?"rtl":"ltr"}function nq(q){return x(q)==="rtl"}async function sq(q,X,Q,H){let J=q,Y=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,W={...y,...H.i18n},$=await Wq(W.locale,H);X.__translations=$,X.__locale=W.locale,X.__i18nConfig=W,J=await h(J,Y,async(z,G,w,K,j)=>{try{let D={};if(w)try{let B=[()=>JSON.parse(w),()=>{let U=`{"data":${w}}`,M=JSON.parse(U);return typeof M.data==="object"?M.data:{}},()=>{return S(w,X)}];for(let U of B)try{if(D=U(),Object.keys(D).length>0)break}catch{}}catch(B){if(H.debug)console.error("Error parsing parameters for @translate directive:",B)}return L(G,$,W.fallbackToKey,D)||K.trim()}catch(D){if(H.debug)console.error("Error processing @translate directive:",D);return T("Translate",`Error in @translate('${G}'): ${D instanceof Error?D.message:String(D)}`,R.EVALUATION_ERROR)}});let Z=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(H.debug){console.warn(`Processing translations in template. Sections: ${J.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let z=[...J.matchAll(Z)];console.warn(`Found ${z.length} @translate matches`),z.forEach((G,w)=>console.warn(`Match ${w}: ${G[0]}, Key: ${G[1]}, Params: ${G[2]||"none"}`))}return J=await h(J,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(z,G,w,K)=>{try{let j={};if(w)try{let D=[()=>JSON.parse(w),()=>{let A=`{"data":${w}}`,B=JSON.parse(A);return typeof B.data==="object"?B.data:{}},()=>{return S(w,X)}];for(let A of D)try{if(j=A(),Object.keys(j).length>0)break}catch{}}catch(D){if(H.debug)console.error("Error parsing parameters for @translate directive:",D)}return L(G,$,W.fallbackToKey,j)}catch(j){if(H.debug)console.error("Error processing @translate directive:",j);return T("Translate",`Error in @translate('${G}'): ${j instanceof Error?j.message:String(j)}`,R.EVALUATION_ERROR)}}),J}async function h(q,X,Q){let H=[];return q.replace(X,(Y,...W)=>{let $=Q(Y,...W).then((Z)=>({match:Y,replacement:Z}));return H.push($),Y}),(await Promise.all(H)).reduce((Y,{match:W,replacement:$})=>Y.replace(W,$),q)}function rq(q,X=!0){return(Q,H={})=>{return L(Q,q,X,H)}}import c from"path";function v(q,X){if(!q||x(q)!=="rtl")return!1;return!X||X.trim().toLowerCase()!=="rtl"}function n(q){if(!q)return!1;return q.trim().split(/\s+/)[0]?.toLowerCase()==="presentation"||q.trim().split(/\s+/)[0]?.toLowerCase()==="none"}function N(q,X){let Q=new RegExp(`\\b${X}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i").exec(q);if(!Q)return null;return Q[2]??Q[3]??Q[4]??null}function eq(q,X,Q,H){let J=q;J=J.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(W,$,Z)=>{let z={"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"}[$]||"Make this element accessible";return`<!-- a11y-hint: ${Z||z} -->`});let Y=/@screenReader\(([^@]*)\)@endScreenReader/g;return J=J.replace(Y,(W,$)=>{return`<span class="sr-only">${$.trim()}</span>`}),J=J.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(W,$,Z)=>{return`<span id="${`desc-${$}`}" class="sr-only">${Z}</span>`}),J}function qH(){return`
|
|
4
|
+
.sr-only {
|
|
5
|
+
position: absolute;
|
|
6
|
+
width: 1px;
|
|
7
|
+
height: 1px;
|
|
8
|
+
padding: 0;
|
|
9
|
+
margin: -1px;
|
|
10
|
+
overflow: hidden;
|
|
11
|
+
clip: rect(0, 0, 0, 0);
|
|
12
|
+
white-space: nowrap;
|
|
13
|
+
border-width: 0;
|
|
14
|
+
}
|
|
15
|
+
`.trim()}function Oq(){return typeof globalThis.document<"u"&&typeof globalThis.document.createElement==="function"}function s(q){let X=new Map,Q=q.replace(/<(\/?)([A-Z][\w:.-]*)(?=[\s/>])/g,(J,Y,W)=>{let $=X.get(W);if(!$)$=`stx-a11y-component-${X.size}`,X.set(W,$);return`<${Y}${$}`}),H=new Map([...X.entries()].map(([J,Y])=>[Y,J]));return{protectedSource:Q,restore:(J)=>J.replace(/<(\/?)(stx-a11y-component-\d+)(?=[\s/>])/g,(Y,W,$)=>{let Z=H.get($);return Z?`<${W}${Z}`:Y})}}function Nq(q,X){let Q=[],H=/<img\s+([^>]*)>/gi,J;J=H.exec(q);while(J!==null){let B=J[1];if(!/\balt\s*=/i.test(B))Q.push({type:"missing-alt",element:J[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/"});J=H.exec(q)}let Y=/<button([^>]*)>\s*<\/button>/gi;J=Y.exec(q);while(J!==null){let B=J[1];if(!/\baria-label\s*=/i.test(B)&&!/\btitle\s*=/i.test(B))Q.push({type:"missing-accessible-name",element:J[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/"});J=Y.exec(q)}let W=/<a\s+([^>]*)>\s*<\/a>/gi;J=W.exec(q);while(J!==null){let B=J[1];if(!/\baria-label\s*=/i.test(B)&&!/\btitle\s*=/i.test(B))Q.push({type:"link-missing-text",element:J[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"});J=W.exec(q)}let $=/<(input|select|textarea)\s+([^>]*)>/gi;J=$.exec(q);while(J!==null){let B=J[2];if(/\btype\s*=\s*["']hidden["']/i.test(B)){J=$.exec(q);continue}let U=/\baria-label\s*=/i.test(B)||/\baria-labelledby\s*=/i.test(B),M=B.match(/\bid\s*=\s*["']([^"']+)["']/i);if(!U){let r=M&&new RegExp(`<label[^>]*\\bfor\\s*=\\s*["']${M[1]}["']`,"i").test(q),f=J.index,d=q.substring(0,f),Lq=q.substring(f),l=(d.match(/<label\b/gi)||[]).length,o=(d.match(/<\/label>/gi)||[]).length,a=l>o;if(!r&&!a)Q.push({type:"input-missing-label",element:J[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/"})}J=$.exec(q)}let Z=/<h([1-6])[^>]*>/gi,_=[];J=Z.exec(q);while(J!==null)_.push(Number.parseInt(J[1],10)),J=Z.exec(q);let z=0;for(let B of _){if(z>0&&B>z+1)Q.push({type:"heading-skip",element:`<h${B}>`,message:`Heading level skipped from h${z} to h${B}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});z=B}if(/<html\b/i.test(q)&&!/<html[^>]*\slang\s*=/i.test(q))Q.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 G=q.match(/<html\b([^>]*)>/i);if(G&&v(N(G[1],"lang"),N(G[1],"dir")))Q.push({type:"missing-dir",element:G[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 w=/<table([^>]*)>([\s\S]*?)<\/table>/gi;J=w.exec(q);while(J!==null){let B=J[2];if(!n(N(J[1],"role"))&&!/<th\b/i.test(B))Q.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"});J=w.exec(q)}let K=/<(video|audio)[^>]*\sautoplay\s[^>]*>/gi;J=K.exec(q);while(J!==null){if(!/\bmuted\b/i.test(J[0]))Q.push({type:"autoplay-audio",element:`<${J[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"});J=K.exec(q)}let j=/\btabindex\s*=\s*["']([1-9]\d*)["']/gi;J=j.exec(q);while(J!==null)Q.push({type:"positive-tabindex",element:`tabindex="${J[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"}),J=j.exec(q);let D=/<iframe\s+([^>]*)>/gi;J=D.exec(q);while(J!==null){let B=J[1];if(!/\btitle\s*=/i.test(B)&&!/\baria-label\s*=/i.test(B))Q.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"});J=D.exec(q)}let A=/<([a-z]+)\s+([^>]*role\s*=\s*["']button["'][^>]*)>/gi;J=A.exec(q);while(J!==null){let B=J[1].toLowerCase(),U=J[2];if(B!=="button"&&!/\btabindex\s*=/i.test(U))Q.push({type:"button-not-focusable",element:J[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/"});J=A.exec(q)}return Q}async function Pq(q,X){let{protectedSource:Q}=s(q);if(!Oq())return Nq(Q,X);let H=[];try{let J=globalThis.document.createElement("div");J.innerHTML=Q,J.querySelectorAll("img").forEach((Z)=>{if(!Z.hasAttribute("alt"))H.push({type:"missing-alt",element:`<${Z.outerHTML}>`,message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"})}),J.querySelectorAll('button, a, [role="button"]').forEach((Z)=>{if(!(Z.hasAttribute("aria-label")||Z.hasAttribute("aria-labelledby")||Z.textContent&&Z.textContent.trim().length>0))H.push({type:"missing-accessible-name",element:`<${Z.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/"})}),J.querySelectorAll("input, select, textarea").forEach((Z)=>{let _=Z.getAttribute("id"),z=_&&J.querySelector(`label[for="${_}"]`),G=Z.hasAttribute("aria-label")||Z.hasAttribute("aria-labelledby"),w=Z.closest("label")!==null;if(!z&&!G&&!w)H.push({type:"input-missing-label",element:`<${Z.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 Y=Array.from(J.querySelectorAll("h1, h2, h3, h4, h5, h6")),W=0;for(let Z of Y){let _=Number.parseInt(Z.tagName.charAt(1));if(W>0&&_>W+1)H.push({type:"heading-skip",element:`<${Z.outerHTML}>`,message:`Heading level skipped from h${W} to h${_}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});W=_}let $=J.querySelector("html");if(Q.includes("<html")&&$&&!$.hasAttribute("lang"))H.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($&&v($.getAttribute("lang"),$.getAttribute("dir")))H.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(J.querySelectorAll("a").forEach((Z)=>{let _=Z.textContent&&Z.textContent.trim().length>0,z=Z.hasAttribute("aria-label")||Z.hasAttribute("aria-labelledby"),G=Z.hasAttribute("title"),w=Z.querySelector("img[alt]");if(!_&&!z&&!G&&!w)H.push({type:"link-missing-text",element:`<${Z.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"})}),Q.includes("<nav")||Q.includes("<header")){if(!J.querySelector('a[href="#main"], a[href="#content"], .skip-link, [class*="skip"]')&&J.querySelectorAll("a").length>5)H.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(J.querySelectorAll("table").forEach((Z)=>{if(n(Z.getAttribute("role")))return;let _=Z.querySelector("caption");if(!Z.querySelector("th"))H.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(!_&&!Z.hasAttribute("aria-label")&&!Z.hasAttribute("aria-labelledby"))H.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"})}),J.querySelectorAll('[style*="color"]').forEach((Z)=>{let _=Z.getAttribute("style")||"";if(_.includes("color:")&&!_.includes("background"))H.push({type:"potential-contrast-issue",element:`<${Z.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/"})}),J.querySelectorAll("video[autoplay], audio[autoplay]").forEach((Z)=>{if(!Z.hasAttribute("muted"))H.push({type:"autoplay-audio",element:`<${Z.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"})}),J.querySelectorAll("[tabindex]").forEach((Z)=>{if(Number.parseInt(Z.getAttribute("tabindex")||"0")>0)H.push({type:"positive-tabindex",element:`<${Z.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"})}),J.querySelectorAll('[role="button"]').forEach((Z)=>{if(!Z.hasAttribute("tabindex"))H.push({type:"button-not-focusable",element:`<${Z.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/"})}),Q.includes("<body")&&!J.querySelector('main, [role="main"]'))H.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"});J.querySelectorAll("iframe").forEach((Z)=>{if(!Z.hasAttribute("title")&&!Z.hasAttribute("aria-label"))H.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(J){console.error(`Error checking accessibility in ${X}:`,J)}return H}async function Iq(q,X={}){let Q={},{recursive:H=!0,ignorePaths:J=[]}=X,Y=Array.isArray(q)?q:[q],W=await i(Y,{recursive:H,ignorePaths:J}),$=[];for(let Z of W)try{let _=await Bun.file(Z).text();if(Z.endsWith("good-a11y.stx"))continue;let z=await Pq(_,Z);if($.push(Z),z.length>0)Q[Z]=z}catch(_){console.error(`Error scanning ${Z}:`,_)}return{results:Q,scannedFiles:$}}async function HH(q,X={}){return(await Iq(q,X)).results}var Rq={fixMissingAlt:!0,fixMissingLabels:!0,fixMissingFormLabels:!0,fixTableHeaders:!0,fixMissingLang:!0,fixMissingDir:!0,fixPositiveTabindex:!0,fixButtonFocusable:!0,defaultLang:"en"};function Tq(q,X={}){let Q={...Rq,...X},H=[],{protectedSource:J,restore:Y}=s(q),W=J;if(Q.fixMissingAlt)W=W.replace(/<img([^>]*?)(?<!\balt\s*=\s*["'][^"']*["'])(\s*\/?>)/gi,($,Z,_)=>{if(/\balt\s*=/i.test(Z))return $;let z=$,G=`<img${Z} alt=""${_}`;return H.push({type:"missing-alt",description:"Added empty alt attribute to image",before:z,after:G}),G});if(Q.fixMissingLabels)W=W.replace(/<button([^>]*)>\s*<\/button>/gi,($,Z)=>{if(/\baria-label\s*=/i.test(Z)||/\btitle\s*=/i.test(Z))return $;let _=$,z=`<button${Z} aria-label="Button"></button>`;return H.push({type:"missing-accessible-name",description:"Added aria-label to empty button",before:_,after:z}),z}),W=W.replace(/<a([^>]*)>\s*(<(?:i|span|svg)[^>]*(?:class="[^"]*icon[^"]*")?[^>]*>.*?<\/(?:i|span|svg)>)?\s*<\/a>/gi,($,Z,_)=>{if(/\baria-label\s*=/i.test(Z)||/\btitle\s*=/i.test(Z))return $;if(!_&&$.replace(/<a[^>]*>|<\/a>/gi,"").trim())return $;let z=$,G=`<a${Z} aria-label="Link">${_||""}</a>`;return H.push({type:"missing-accessible-name",description:"Added aria-label to link without text",before:z,after:G}),G});if(Q.fixMissingFormLabels)W=W.replace(/<(input|select|textarea)([^>]*)>/gi,($,Z,_)=>{if(/\baria-label\s*=/i.test(_)||/\baria-labelledby\s*=/i.test(_))return $;if(/\btype\s*=\s*["']hidden["']/i.test(_))return $;let z=_.match(/\bname\s*=\s*["']([^"']+)["']/i),G=_.match(/\bid\s*=\s*["']([^"']+)["']/i),w=z?.[1]||G?.[1]||Z,K=$,j=`<${Z}${_} aria-label="${w}">`;return H.push({type:"input-missing-label",description:`Added aria-label to ${Z} element`,before:K,after:j}),j});if(Q.fixMissingLang)W=W.replace(/<html([^>]*)>/gi,($,Z)=>{if(/\blang\s*=/i.test(Z))return $;let _=$,z=`<html${Z} lang="${Q.defaultLang}">`;return H.push({type:"missing-lang",description:`Added lang="${Q.defaultLang}" to html element`,before:_,after:z}),z});if(Q.fixMissingDir)W=W.replace(/<html([^>]*)>/gi,($,Z)=>{let _=N(Z,"lang");if(!v(_,N(Z,"dir")))return $;let z=/\bdir\s*=/i.test(Z)?`<html${Z.replace(/\bdir\s*=\s*(["'])[^"']*\1/i,'dir="rtl"')}>`:`<html${Z} dir="rtl">`;return H.push({type:"missing-dir",description:`Added dir="rtl" to html element (lang="${_}" is right-to-left)`,before:$,after:z}),z});if(Q.fixPositiveTabindex)W=W.replace(/\btabindex\s*=\s*["']([1-9]\d*)["']/gi,($,Z)=>{let _=$,z='tabindex="0"';return H.push({type:"positive-tabindex",description:`Changed tabindex="${Z}" to tabindex="0"`,before:_,after:'tabindex="0"'}),'tabindex="0"'});if(Q.fixButtonFocusable)W=W.replace(/<([a-z]+)(\s[^>]*role\s*=\s*["']button["'][^>]*)>/gi,($,Z,_)=>{if(/\btabindex\s*=/i.test(_))return $;if(Z.toLowerCase()==="button")return $;let z=$,G=`<${Z}${_} tabindex="0">`;return H.push({type:"button-not-focusable",description:'Added tabindex="0" to element with role="button"',before:z,after:G}),G});if(Q.fixTableHeaders)W=W.replace(/<th([^>]*)>/gi,($,Z)=>{if(/\bscope\s*=/i.test(Z))return $;let _=$,z=`<th${Z} scope="col">`;return H.push({type:"table-missing-scope",description:'Added scope="col" to table header',before:_,after:z}),z});return{original:q,fixed:Y(W),fixCount:H.length,fixes:H}}async function Sq(q,X={},Q=!1){let H=await Bun.file(q).text(),J=Tq(H,X);if(Q&&J.fixCount>0)await Bun.write(q,J.fixed);return J}async function JH(q,X={},Q={}){let H={},{recursive:J=!0,ignorePaths:Y=[],writeBack:W=!1,extensions:$=[".stx",".html",".htm"]}=Q,Z=$.length===1?`*${$[0]}`:`*{${$.join(",")}}`,_=c.join(q,J?`**/${Z}`:Z),z=new Bun.Glob(_);for await(let G of z.scan()){if(Y.some((K)=>G.includes(c.normalize(K))))continue;try{let K=await Sq(G,X,W);if(K.fixCount>0)H[G]=K}catch(K){console.error(`Error fixing ${G}:`,K)}}return H}var kq={name:"a11y",handler:(q,X,Q,H)=>{if(!X.length)return q;let J=X[0].replace(/['"]/g,""),Y=X.length>1?X[1].replace(/['"]/g,""):"",$={"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"}[J]||"Make this element accessible";return`<!-- a11y-hint: ${Y||$} -->${q}`},hasEndTag:!1},bq={name:"screenReader",handler:(q)=>{return`<span class="sr-only">${q}</span>`},hasEndTag:!0};function QH(){return[kq,bq]}
|
|
16
|
+
export{y as yr,vq as zr,fq as Ar,dq as Br,gq as Cr,uq as Dr,qq as Er,hq as Fr,P as Gr,Hq as Hr,pq as Ir,mq as Jr,cq as Kr,iq as Lr,Wq as Mr,_q as Nr,Uq as Or,L as Pr,x as Qr,nq as Rr,sq as Sr,rq as Tr,n as Ur,N as Vr,eq as Wr,qH as Xr,Oq as Yr,Nq as Zr,Pq as _r,Iq as $r,HH as as,Tq as bs,Sq as cs,JH as ds,kq as es,bq as fs,QH as gs};
|