@stacksjs/stx 0.2.312 → 0.2.314

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.
Files changed (62) hide show
  1. package/dist/{chunk-avqacmvp.js → chunk-0n9ywg62.js} +2 -2
  2. package/dist/{chunk-29vx193k.js → chunk-0z4edy84.js} +1 -1
  3. package/dist/{chunk-34yzcb00.js → chunk-2q3vmxas.js} +2 -2
  4. package/dist/{chunk-df1mx1s1.js → chunk-36dt9a5b.js} +1 -1
  5. package/dist/{chunk-n4g9p5td.js → chunk-3w407f62.js} +1 -1
  6. package/dist/{chunk-y1b6y022.js → chunk-4beqrgqg.js} +1 -1
  7. package/dist/{chunk-kvarrr2y.js → chunk-4t1gj13c.js} +1 -1
  8. package/dist/{chunk-2vxmgj67.js → chunk-4yd1snck.js} +1 -1
  9. package/dist/{chunk-ws7d1krp.js → chunk-4zzdcr52.js} +1 -1
  10. package/dist/{chunk-92g4qya5.js → chunk-64cm30pt.js} +9 -9
  11. package/dist/{chunk-se9jfhzq.js → chunk-65ysk047.js} +1 -1
  12. package/dist/{chunk-yyy5mk7b.js → chunk-776va6he.js} +1 -1
  13. package/dist/{chunk-wrngf5nq.js → chunk-79hz2yeb.js} +1 -1
  14. package/dist/{chunk-c0edxvn0.js → chunk-7d9ngt4b.js} +2 -2
  15. package/dist/{chunk-cdayqb5c.js → chunk-7ef0sdyb.js} +1 -1
  16. package/dist/{chunk-9ksr8sjy.js → chunk-840zb3m6.js} +1 -1
  17. package/dist/{chunk-w62chvwb.js → chunk-87anckve.js} +1 -1
  18. package/dist/{chunk-xdnsxn2f.js → chunk-8hw05c3g.js} +1 -1
  19. package/dist/{chunk-5n5ejg0x.js → chunk-8rd7086f.js} +1 -1
  20. package/dist/{chunk-9wtpnaps.js → chunk-a5brmegq.js} +2 -2
  21. package/dist/{chunk-4mftgf8s.js → chunk-asvtwk0t.js} +1 -1
  22. package/dist/{chunk-81jx0c3x.js → chunk-ax3zx9qr.js} +1 -1
  23. package/dist/{chunk-s5wevejz.js → chunk-bseetp6t.js} +1 -1
  24. package/dist/{chunk-wcftvmk4.js → chunk-btw9z3hs.js} +1 -1
  25. package/dist/{chunk-zqd4nrqt.js → chunk-c8xa2551.js} +17 -17
  26. package/dist/chunk-cctd3tmn.js +2 -0
  27. package/dist/{chunk-54a8kxqj.js → chunk-crmth86x.js} +1 -1
  28. package/dist/{chunk-4mm03gj3.js → chunk-dh58qn19.js} +1 -1
  29. package/dist/{chunk-sr1xxzye.js → chunk-f0331x6e.js} +1 -1
  30. package/dist/{chunk-cjdjhtc9.js → chunk-fgv72akz.js} +1 -1
  31. package/dist/{chunk-hnb6kzpe.js → chunk-g32847vd.js} +1 -1
  32. package/dist/{chunk-mq9f910z.js → chunk-g76m40t7.js} +1 -1
  33. package/dist/{chunk-5kh5dr9k.js → chunk-h22zwr5c.js} +47 -21
  34. package/dist/{chunk-5pm4w6ef.js → chunk-h2z851gp.js} +1 -1
  35. package/dist/{chunk-1233k4y4.js → chunk-han0799s.js} +1 -1
  36. package/dist/chunk-hmxtgj9f.js +2 -0
  37. package/dist/{chunk-mbkjkg12.js → chunk-hysb682g.js} +1 -1
  38. package/dist/{chunk-97bbr767.js → chunk-k7yjaptf.js} +1 -1
  39. package/dist/{chunk-e7dse3cf.js → chunk-mykjksa5.js} +1 -1
  40. package/dist/{chunk-03kxmbb3.js → chunk-n350bng2.js} +1 -1
  41. package/dist/{chunk-3h5z1eby.js → chunk-ncvm6af1.js} +1 -1
  42. package/dist/{chunk-4xgsb361.js → chunk-ns0dgs08.js} +1 -1
  43. package/dist/{chunk-tt0rww6h.js → chunk-pay4z99n.js} +1 -1
  44. package/dist/{chunk-8bnpdtjh.js → chunk-pgqdhg7n.js} +1 -1
  45. package/dist/{chunk-87qbq45v.js → chunk-pqb9bmnn.js} +1 -1
  46. package/dist/{chunk-k8p54eqr.js → chunk-pqvzm9pz.js} +1 -1
  47. package/dist/{chunk-ycvxjxhz.js → chunk-qwr4fwy6.js} +1 -1
  48. package/dist/{chunk-bcx36g1n.js → chunk-sytymfs3.js} +1 -1
  49. package/dist/{chunk-6aqsmree.js → chunk-ta1p5yab.js} +1 -1
  50. package/dist/chunk-w0jhye6c.js +2 -0
  51. package/dist/{chunk-9ewg41dm.js → chunk-z4knj9j0.js} +1 -1
  52. package/dist/chunk-zpg03knt.js +2 -0
  53. package/dist/cli.js +7 -7
  54. package/dist/craft-entry.js +1 -1
  55. package/dist/craft.js +1 -1
  56. package/dist/pwa.js +1 -1
  57. package/dist/ssg.js +2 -2
  58. package/package.json +5 -5
  59. package/dist/chunk-3j7y8yen.js +0 -2
  60. package/dist/chunk-9xfx5q8b.js +0 -2
  61. package/dist/chunk-awwkfzyy.js +0 -2
  62. package/dist/chunk-xtn6zwr8.js +0 -2
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ye as a}from"./chunk-4beqrgqg.js";import"./chunk-2q3vmxas.js";import"./chunk-dvvx1wny.js";import"./chunk-0n9ywg62.js";import"./chunk-c8xa2551.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-sytymfs3.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-36dt9a5b.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-h22zwr5c.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{a as startProductionServer};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Ak as m}from"./chunk-9wtpnaps.js";import{ew as z}from"./chunk-jryjwara.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=`
2
+ import{Ak as m}from"./chunk-a5brmegq.js";import{ew as z}from"./chunk-jryjwara.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';
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Av as r,Bv as s,Cv as t,Dv as u,Ev as v,Fv as w,Gv as x,Hv as y,Iv as z,Jv as A,Kv as B,Lv as C,Mv as D,Nv as E,Ov as F,Pv as G,Qv as H,Rv as I,Sv as J,Uv as K,Wv as L,jv as a,kv as b,lv as c,mv as d,nv as e,ov as f,pv as g,qv as h,rv as i,sv as j,tv as k,uv as l,vv as m,wv as n,xv as o,yv as p,zv as q}from"./chunk-5kh5dr9k.js";import"./chunk-jryjwara.js";L();export{o as setAppUrl,H as runMiddleware,r as route,j as resolveLayoutChain,s as resetRoutes,z as registerMiddleware,g as patternToRegex,t as navigateTo,h as matchRoute,E as loadMiddlewareFromDirectory,c as isNonPageRoutePattern,b as isNonPageRoutePath,B as hasMiddleware,K as getRouterScript,D as getMiddlewareNames,A as getMiddleware,d as generateRouteTypes,e as generateRouteManifest,n as formatRoutes,m as findErrorPage,f as filePathToPattern,J as extractLayoutMetadata,I as deriveLayoutGroup,q as defineRoutes,p as defineRoute,v as defineMiddleware,y as createStorageManager,w as createServerCookieManager,l as createRouter,F as createRouteLocation,G as createMiddlewareContext,x as createClientCookieManager,C as clearMiddleware,i as bracketPathToRegex,u as abortNavigation,k as Router,a as NON_PAGE_DIRS};
2
+ import{Av as r,Bv as s,Cv as t,Dv as u,Ev as v,Fv as w,Gv as x,Hv as y,Iv as z,Jv as A,Kv as B,Lv as C,Mv as D,Nv as E,Ov as F,Pv as G,Qv as H,Rv as I,Sv as J,Uv as K,Wv as L,jv as a,kv as b,lv as c,mv as d,nv as e,ov as f,pv as g,qv as h,rv as i,sv as j,tv as k,uv as l,vv as m,wv as n,xv as o,yv as p,zv as q}from"./chunk-h22zwr5c.js";import"./chunk-jryjwara.js";L();export{o as setAppUrl,H as runMiddleware,r as route,j as resolveLayoutChain,s as resetRoutes,z as registerMiddleware,g as patternToRegex,t as navigateTo,h as matchRoute,E as loadMiddlewareFromDirectory,c as isNonPageRoutePattern,b as isNonPageRoutePath,B as hasMiddleware,K as getRouterScript,D as getMiddlewareNames,A as getMiddleware,d as generateRouteTypes,e as generateRouteManifest,n as formatRoutes,m as findErrorPage,f as filePathToPattern,J as extractLayoutMetadata,I as deriveLayoutGroup,q as defineRoutes,p as defineRoute,v as defineMiddleware,y as createStorageManager,w as createServerCookieManager,l as createRouter,F as createRouteLocation,G as createMiddlewareContext,x as createClientCookieManager,C as clearMiddleware,i as bracketPathToRegex,u as abortNavigation,k as Router,a as NON_PAGE_DIRS};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Ar as e,Br as f,wr as a,xr as b,yr as c,zr as d}from"./chunk-zqd4nrqt.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-bcx36g1n.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-df1mx1s1.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-5kh5dr9k.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{f as validateConfig,b as resolveStxDirectories,c as loadStxConfig,e as defineStxConfig,a as defaultConfig,d as config};
2
+ import{Ar as e,Br as f,wr as a,xr as b,yr as c,zr as d}from"./chunk-c8xa2551.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-sytymfs3.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-36dt9a5b.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-h22zwr5c.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{f as validateConfig,b as resolveStxDirectories,c as loadStxConfig,e as defineStxConfig,a as defaultConfig,d as config};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{tk as a,uk as b,vk as c,wk as d}from"./chunk-54a8kxqj.js";import"./chunk-9wtpnaps.js";import"./chunk-zqd4nrqt.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-bcx36g1n.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-df1mx1s1.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-5kh5dr9k.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{b as getAvailableTargets,c as getAvailableFormats,d as default,a as buildNative};
2
+ import{tk as a,uk as b,vk as c,wk as d}from"./chunk-crmth86x.js";import"./chunk-a5brmegq.js";import"./chunk-c8xa2551.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-sytymfs3.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-36dt9a5b.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-h22zwr5c.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{b as getAvailableTargets,c as getAvailableFormats,d as default,a as buildNative};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{$p as X,Im as W}from"./chunk-zqd4nrqt.js";import V from"fs";import M from"path";import*as Y from"readline";var j={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m"},Q={help:{description:"Show available commands",usage:"help [command]",handler:async(q,z)=>{if(q[0]&&Q[q[0]]){let A=Q[q[0]];console.log(`
2
+ import{$p as X,Im as W}from"./chunk-c8xa2551.js";import V from"fs";import M from"path";import*as Y from"readline";var j={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m"},Q={help:{description:"Show available commands",usage:"help [command]",handler:async(q,z)=>{if(q[0]&&Q[q[0]]){let A=Q[q[0]];console.log(`
3
3
  ${j.bold}${q[0]}${j.reset} - ${A.description}`),console.log(` Usage: ${j.cyan}${A.usage}${j.reset}
4
4
  `)}else{console.log(`
5
5
  ${j.bold}Available Commands:${j.reset}
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Le as c,Me as d,Ne as e,Oe as f,Pe as g,Qe as h}from"./chunk-4xgsb361.js";import{Xf as a,_f as b}from"./chunk-yyy5mk7b.js";import"./chunk-xdnsxn2f.js";import"./chunk-xwxdwqn9.js";import"./chunk-zqd4nrqt.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-bcx36g1n.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-df1mx1s1.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-5kh5dr9k.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{d as virtualPathFor,g as typecheckStxFiles,e as sourcePathFor,h as formatTypecheckDiagnostics,f as findRuntimeTypeDeclarations,b as extractTemplateExpressions,a as extractScriptBlocks,c as buildVirtualSource};
2
+ import{Le as c,Me as d,Ne as e,Oe as f,Pe as g,Qe as h}from"./chunk-ns0dgs08.js";import{Xf as a,_f as b}from"./chunk-776va6he.js";import"./chunk-8hw05c3g.js";import"./chunk-xwxdwqn9.js";import"./chunk-c8xa2551.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-sytymfs3.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-36dt9a5b.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-h22zwr5c.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{d as virtualPathFor,g as typecheckStxFiles,e as sourcePathFor,h as formatTypecheckDiagnostics,f as findRuntimeTypeDeclarations,b as extractTemplateExpressions,a as extractScriptBlocks,c as buildVirtualSource};
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import{cw as Te,dw as u}from"./chunk-jryjwara.js";function F(e){return e.split(/[\\/]/).filter(Boolean).slice(0,-1).some((a)=>m.includes(a))}function y(e){return F(e.replace(/^\//,""))}var m;var x=u(()=>{m=["components","layouts","partials","emails"]});import d from"fs";import v from"path";function S(e,t){let a=e.filter((o)=>!y(o.pattern)),r=["// Auto-generated by STX - do not edit"];if(a.length===0)r.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{r.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let o of a){let i=[];for(let c of o.params){let h=o.pattern.includes(`:${c}?`)?"?":"";i.push(`${c}${h}: string`)}let l=i.join("; ");r.push(` '${o.pattern}': { ${l} }`)}r.push(" }","}","","export {}","")}let n=r.join(`
3
3
  `),s=v.join(t,"route-types.d.ts");try{if(d.existsSync(s)&&d.readFileSync(s,"utf8")===n)return;d.mkdirSync(t,{recursive:!0}),d.writeFileSync(s,n)}catch{}}function k(e,t,a){let r=process.cwd(),n=v.relative(r,a),s=e.filter((i)=>!y(i.pattern)),o=["// Auto-generated by stx \u2014 do not edit",`// Source: ${n||"pages"}/`,"","export const routes = ["];for(let i of s){let l=v.relative(r,i.filePath).replace(/\\/g,"/"),c=JSON.stringify(i.params),h=i.layout?`, layout: '${v.relative(r,i.layout).replace(/\\/g,"/")}'`:"";o.push(` { pattern: '${i.pattern}', filePath: '${l}', isDynamic: ${i.isDynamic}, params: ${c}${h} },`)}o.push("] as const",""),o.push("export type RouteName = typeof routes[number]['pattern']",""),d.mkdirSync(t,{recursive:!0}),d.writeFileSync(v.join(t,"routes.ts"),o.join(`
4
- `))}var M=u(()=>{x()});import V from"path";function A(e,t){let r=V.relative(t,e).replace(/\.(stx|md)$/,"");if(r=r.split(V.sep).join("/"),r==="index")return"/";if(r.endsWith("/index"))r=r.slice(0,-6);return r=r.replace(/\[\[([^\]]+)\]\]/g,":$1?"),r=r.replace(/\[([^\]]+)\]/g,":$1"),r=r.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${r}`}function w(e){let t=[],a="",r=0;while(r<e.length){let n=e.slice(r),s=/^\/:([^/?*]+)\?/.exec(n);if(s){t.push(s[1]),a+="(?:/([^/]+))?",r+=s[0].length;continue}let o=/^:([^/?*]+)\*/.exec(n);if(o){t.push(o[1]),a+="(.+)",r+=o[0].length;continue}let i=/^:([^/?*]+)/.exec(n);if(i){t.push(i[1]),a+="([^/]+)",r+=i[0].length;continue}a+=e[r].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),r+=1}return{regex:new RegExp(`^${a}$`),params:t}}function W(e,t){let a=e===""?"/":e;for(let r of t){let n=a.match(r.regex);if(n){let s={};return r.params.forEach((o,i)=>{s[o]=n[i+1]}),{route:r,params:s}}}return null}function K(e){let t=e.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return w(t)}var N=()=>{};import ke from"fs";import I from"path";function C(e,t){let a=[],r=I.dirname(e);while(r.startsWith(t)||r===t){let n=I.join(r,"_layout.stx");if(ke.existsSync(n))a.unshift(n);if(r===t)break;r=I.dirname(r)}return a}var B=()=>{};import P from"fs";import p from"path";function $(e,t){let a=[];if(!P.existsSync(e))return a;let r=P.readdirSync(e,{withFileTypes:!0});for(let n of r){let s=p.join(e,n.name);if(n.isDirectory()){if(n.name.startsWith("."))continue;if(m.includes(n.name))continue;a.push(...$(s,t))}else if(n.isFile()){let o=p.extname(n.name);if(t.includes(o)){if(n.name.startsWith("_")&&n.name!=="_layout.stx")continue;if(n.name==="_layout.stx")continue;a.push(s)}}}return a}class T{routes;pagesDir;pagesDirs;config;constructor(e,t={}){this.config=t;let a=t.pagesDirs&&t.pagesDirs.length>0?t.pagesDirs:[t.pagesDir||"pages"];this.pagesDirs=a.map((o)=>p.resolve(e,o)),this.pagesDir=this.pagesDirs[0];let r=t.extensions||[".stx"],n=new Set;this.routes=[];for(let o of this.pagesDirs){let i=$(o,r),l=new Map;for(let c of i){let h=A(c,o),g=t.pagesDirs?h.replace(/:[\w]+/g,":param"):h;if(t.pagesDirs&&l.has(g))throw Error(`Conflicting layer pages for ${h}: ${l.get(g)} and ${c}`);if(l.set(g,c),n.has(g))continue;n.add(g);let{regex:Se,params:D}=w(h),O=t.layouts!==!1?C(c,o):[];this.routes.push({pattern:h,regex:Se,params:D,filePath:c,isDynamic:D.length>0,layout:O.length>0?O[O.length-1]:void 0})}}this.routes.sort((o,i)=>{if(!o.isDynamic&&i.isDynamic)return-1;if(o.isDynamic&&!i.isDynamic)return 1;let l=o.pattern.split("/").length,c=i.pattern.split("/").length;if(l!==c)return c-l;return o.pattern.localeCompare(i.pattern)});let s=p.resolve(e,t.stateDir||process.env.STX_DIR?.trim()||".stx");S(this.routes,s),k(this.routes,s,this.pagesDir)}match(e){let t=e===""?"/":e;for(let a of this.routes){let r=t.match(a.regex);if(r){let n={};return a.params.forEach((s,o)=>{n[s]=r[o+1]}),{route:a,params:n}}}return null}resolve(e,t){let a=this.routes.find((n)=>n.pattern===e||n.filePath.includes(e));if(!a)return"#not-found";let r=a.pattern;if(t)for(let[n,s]of Object.entries(t))r=r.replace(`:${n}`,encodeURIComponent(s));return r}addRoute(e){this.routes.push(e),this.routes.sort((t,a)=>{if(!t.isDynamic&&a.isDynamic)return-1;if(t.isDynamic&&!a.isDynamic)return 1;return t.pattern.localeCompare(a.pattern)})}getLayout(e){return e.layout??null}}function z(e,t){return new T(e,t)}function J(e,t){let a=[`${t}.stx`,"error.stx"];for(let r of a){let n=p.join(e,r);if(P.existsSync(n))return n}return null}function Y(e,t){return e.map((a)=>{let r=p.relative(t,a.filePath),n=a.isDynamic?" (dynamic)":"";return`${a.pattern} \u2192 ${r}${n}`})}var Z=u(()=>{M();N();B();x()});function Q(e){E=e.replace(/\/$/,"")}function ee(e,t,a={}){f[e]={path:t,name:e,params:a}}function te(e){for(let[t,a]of Object.entries(e))if(typeof a==="string")f[t]={path:a,name:t};else f[t]={...a,name:t}}function re(e,t={},a=!1){let r=f[e];if(!r)return console.warn(`Route [${e}] not defined.`),"#undefined-route";let n={...r.params,...t},s=r.path;s=s.replace(/:(\w+)/g,(i,l)=>{let c=n[l];if(c===void 0)return console.warn(`Missing parameter [${l}] for route [${e}].`),`:${l}`;return delete n[l],encodeURIComponent(String(c))});let o=Object.entries(n);if(o.length>0){let i=o.map(([l,c])=>`${encodeURIComponent(l)}=${encodeURIComponent(String(c))}`).join("&");s+=(s.includes("?")?"&":"?")+i}return a&&E?`${E}${s}`:s}function ae(){for(let e of Object.keys(f))delete f[e];E=""}var f,E="";var ne=u(()=>{f={}});import oe from"fs";import se from"path";function ie(e,t={}){return{type:"redirect",path:e,options:{replace:t.replace??!1,external:t.external??!1,redirectCode:t.redirectCode??302}}}function le(e){return{type:"abort",error:typeof e==="string"?{statusCode:500,message:e}:e}}function ce(e,t={}){return{handler:e,mode:t.mode??"universal"}}function G(e){let t={};if(!e)return t;let a=e.split(";");for(let r of a){let[n,...s]=r.split("=");if(n){let o=n.trim(),i=s.join("=").trim();if(o)t[o]=decodeURIComponent(i)}}return t}function R(e,t,a={}){let r=`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(a.expires){let n=typeof a.expires==="number"?new Date(Date.now()+a.expires*1000):a.expires;r+=`; Expires=${n.toUTCString()}`}if(a.path)r+=`; Path=${a.path}`;if(a.domain)r+=`; Domain=${a.domain}`;if(a.secure)r+="; Secure";if(a.httpOnly)r+="; HttpOnly";if(a.sameSite)r+=`; SameSite=${a.sameSite}`;return r}function U(e,t){let a=e.headers.get("cookie")||"",r=G(a);return{get(n){return r[n]},set(n,s,o={}){r[n]=s,t.append("Set-Cookie",R(n,s,o))},delete(n){delete r[n],t.append("Set-Cookie",R(n,"",{expires:new Date(0),path:"/"}))},getAll(){return{...r}}}}function X(){return{get(e){if(typeof document>"u")return;return G(document.cookie)[e]},set(e,t,a={}){if(typeof document>"u")return;document.cookie=R(e,t,a)},delete(e){if(typeof document>"u")return;document.cookie=R(e,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return G(document.cookie)}}}function j(){let e=typeof window<"u"&&typeof window.localStorage<"u";return{get(t){if(!e)return null;try{return window.localStorage.getItem(t)}catch{return null}},set(t,a){if(!e)return;try{window.localStorage.setItem(t,a)}catch{}},remove(t){if(!e)return;try{window.localStorage.removeItem(t)}catch{}},isAvailable(){return e}}}function L(e,t){b.set(e,t)}function q(e){return b.get(e)}function ue(e){return b.has(e)}function he(){b.clear()}function de(){return Array.from(b.keys())}async function pe(e,t="middleware"){let a=se.resolve(e,t);if(!oe.existsSync(a))return;let r=oe.readdirSync(a);for(let n of r){if(!n.endsWith(".ts")&&!n.endsWith(".js"))continue;if(n.includes(".test.")||n.includes(".spec."))continue;let s=n.replace(/\.(ts|js)$/,""),o=se.join(a,n);try{let l=(await import(o)).default;if(l&&typeof l.handler==="function")L(s,l);else if(typeof l==="function")L(s,{handler:l,mode:"universal"})}catch(i){console.warn(`Failed to load middleware '${s}' from ${o}:`,i)}}}function Ae(e){let t={};if(!e)return t;let a=new URLSearchParams(e);for(let[r,n]of a)t[r]=n;return t}function fe(e,t,a,r=""){return{path:e,params:t,query:Ae(r),fullPath:r?`${e}?${r}`:e,meta:a}}function ge(e,t,a,r){let n=r?.isServer??typeof window>"u",s=!n,o=new Headers;return{to:e,from:t,isClient:s,isServer:n,cookies:n&&a?U(a,o):X(),storage:j(),state:{},request:a,responseHeaders:o}}async function me(e,t){let a=Array.isArray(e)?e:[e],r=t.isServer;for(let n of a){let s=q(n);if(!s)return console.error(`Route middleware '${n}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${n}' is not registered`}},state:t.state,responseHeaders:t.responseHeaders};if(s.mode==="server"&&!r)continue;try{let o=await s.handler(t);if(o){if(o.type==="redirect")return{passed:!1,redirect:o,state:t.state,responseHeaders:t.responseHeaders};if(o.type==="abort")return{passed:!1,abort:o,state:t.state,responseHeaders:t.responseHeaders}}}catch(o){return console.error(`Error in middleware '${n}':`,o),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:o instanceof Error?o.message:"Middleware error"}},state:t.state,responseHeaders:t.responseHeaders}}}return{passed:!0,state:t.state,responseHeaders:t.responseHeaders}}var b;var ye=u(()=>{b=new Map});function H(e){let a=e.replace(/\\/g,"/").split("/").filter(Boolean),r=a.lastIndexOf("layouts"),n=r>=0?a[r+1]:a.at(-1);if(!n)return"app";return n.replace(/\.stx$/i,"")||"app"}function ve(e){let t=e.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),a=e.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),r=e.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),n=t?.[1]||r?.[1]||"";return{layout:n,group:a?.[1]||H(n)}}var we=()=>{};function Ce(e){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(e).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return e}}function be(){if(_)return _;return _=Ce(`
4
+ `))}var M=u(()=>{x()});import V from"path";function A(e,t){let r=V.relative(t,e).replace(/\.(stx|md)$/,"");if(r=r.split(V.sep).join("/"),r==="index")return"/";if(r.endsWith("/index"))r=r.slice(0,-6);return r=r.replace(/\[\[([^\]]+)\]\]/g,":$1?"),r=r.replace(/\[([^\]]+)\]/g,":$1"),r=r.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${r}`}function w(e){let t=[],a="",r=0;while(r<e.length){let n=e.slice(r),s=/^\/:([^/?*]+)\?/.exec(n);if(s){t.push(s[1]),a+="(?:/([^/]+))?",r+=s[0].length;continue}let o=/^:([^/?*]+)\*/.exec(n);if(o){t.push(o[1]),a+="(.+)",r+=o[0].length;continue}let i=/^:([^/?*]+)/.exec(n);if(i){t.push(i[1]),a+="([^/]+)",r+=i[0].length;continue}a+=e[r].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),r+=1}return{regex:new RegExp(`^${a}$`),params:t}}function W(e,t){let a=e===""?"/":e;for(let r of t){let n=a.match(r.regex);if(n){let s={};return r.params.forEach((o,i)=>{s[o]=n[i+1]}),{route:r,params:s}}}return null}function K(e){let t=e.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return w(t)}var N=()=>{};import ke from"fs";import I from"path";function C(e,t){let a=[],r=I.dirname(e);while(r.startsWith(t)||r===t){let n=I.join(r,"_layout.stx");if(ke.existsSync(n))a.unshift(n);if(r===t)break;r=I.dirname(r)}return a}var P=()=>{};import B from"fs";import p from"path";function $(e,t){let a=[];if(!B.existsSync(e))return a;let r=B.readdirSync(e,{withFileTypes:!0});for(let n of r){let s=p.join(e,n.name);if(n.isDirectory()){if(n.name.startsWith("."))continue;if(m.includes(n.name))continue;a.push(...$(s,t))}else if(n.isFile()){let o=p.extname(n.name);if(t.includes(o)){if(n.name.startsWith("_")&&n.name!=="_layout.stx")continue;if(n.name==="_layout.stx")continue;a.push(s)}}}return a}class T{routes;pagesDir;pagesDirs;config;constructor(e,t={}){this.config=t;let a=t.pagesDirs&&t.pagesDirs.length>0?t.pagesDirs:[t.pagesDir||"pages"];this.pagesDirs=a.map((o)=>p.resolve(e,o)),this.pagesDir=this.pagesDirs[0];let r=t.extensions||[".stx"],n=new Set;this.routes=[];for(let o of this.pagesDirs){let i=$(o,r),l=new Map;for(let c of i){let h=A(c,o),g=t.pagesDirs?h.replace(/:[\w]+/g,":param"):h;if(t.pagesDirs&&l.has(g))throw Error(`Conflicting layer pages for ${h}: ${l.get(g)} and ${c}`);if(l.set(g,c),n.has(g))continue;n.add(g);let{regex:Se,params:D}=w(h),O=t.layouts!==!1?C(c,o):[];this.routes.push({pattern:h,regex:Se,params:D,filePath:c,isDynamic:D.length>0,layout:O.length>0?O[O.length-1]:void 0})}}this.routes.sort((o,i)=>{if(!o.isDynamic&&i.isDynamic)return-1;if(o.isDynamic&&!i.isDynamic)return 1;let l=o.pattern.split("/").length,c=i.pattern.split("/").length;if(l!==c)return c-l;return o.pattern.localeCompare(i.pattern)});let s=p.resolve(e,t.stateDir||process.env.STX_DIR?.trim()||".stx");S(this.routes,s),k(this.routes,s,this.pagesDir)}match(e){let t=e===""?"/":e;for(let a of this.routes){let r=t.match(a.regex);if(r){let n={};return a.params.forEach((s,o)=>{n[s]=r[o+1]}),{route:a,params:n}}}return null}resolve(e,t){let a=this.routes.find((n)=>n.pattern===e||n.filePath.includes(e));if(!a)return"#not-found";let r=a.pattern;if(t)for(let[n,s]of Object.entries(t))r=r.replace(`:${n}`,encodeURIComponent(s));return r}addRoute(e){this.routes.push(e),this.routes.sort((t,a)=>{if(!t.isDynamic&&a.isDynamic)return-1;if(t.isDynamic&&!a.isDynamic)return 1;return t.pattern.localeCompare(a.pattern)})}getLayout(e){return e.layout??null}}function z(e,t){return new T(e,t)}function J(e,t){let a=[`${t}.stx`,"error.stx"];for(let r of a){let n=p.join(e,r);if(B.existsSync(n))return n}return null}function Y(e,t){return e.map((a)=>{let r=p.relative(t,a.filePath),n=a.isDynamic?" (dynamic)":"";return`${a.pattern} \u2192 ${r}${n}`})}var Z=u(()=>{M();N();P();x()});function Q(e){R=e.replace(/\/$/,"")}function ee(e,t,a={}){f[e]={path:t,name:e,params:a}}function te(e){for(let[t,a]of Object.entries(e))if(typeof a==="string")f[t]={path:a,name:t};else f[t]={...a,name:t}}function re(e,t={},a=!1){let r=f[e];if(!r)return console.warn(`Route [${e}] not defined.`),"#undefined-route";let n={...r.params,...t},s=r.path;s=s.replace(/:(\w+)/g,(i,l)=>{let c=n[l];if(c===void 0)return console.warn(`Missing parameter [${l}] for route [${e}].`),`:${l}`;return delete n[l],encodeURIComponent(String(c))});let o=Object.entries(n);if(o.length>0){let i=o.map(([l,c])=>`${encodeURIComponent(l)}=${encodeURIComponent(String(c))}`).join("&");s+=(s.includes("?")?"&":"?")+i}return a&&R?`${R}${s}`:s}function ae(){for(let e of Object.keys(f))delete f[e];R=""}var f,R="";var ne=u(()=>{f={}});import oe from"fs";import se from"path";function ie(e,t={}){return{type:"redirect",path:e,options:{replace:t.replace??!1,external:t.external??!1,redirectCode:t.redirectCode??302}}}function le(e){return{type:"abort",error:typeof e==="string"?{statusCode:500,message:e}:e}}function ce(e,t={}){return{handler:e,mode:t.mode??"universal"}}function G(e){let t={};if(!e)return t;let a=e.split(";");for(let r of a){let[n,...s]=r.split("=");if(n){let o=n.trim(),i=s.join("=").trim();if(o)t[o]=decodeURIComponent(i)}}return t}function E(e,t,a={}){let r=`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(a.expires){let n=typeof a.expires==="number"?new Date(Date.now()+a.expires*1000):a.expires;r+=`; Expires=${n.toUTCString()}`}if(a.path)r+=`; Path=${a.path}`;if(a.domain)r+=`; Domain=${a.domain}`;if(a.secure)r+="; Secure";if(a.httpOnly)r+="; HttpOnly";if(a.sameSite)r+=`; SameSite=${a.sameSite}`;return r}function U(e,t){let a=e.headers.get("cookie")||"",r=G(a);return{get(n){return r[n]},set(n,s,o={}){r[n]=s,t.append("Set-Cookie",E(n,s,o))},delete(n){delete r[n],t.append("Set-Cookie",E(n,"",{expires:new Date(0),path:"/"}))},getAll(){return{...r}}}}function X(){return{get(e){if(typeof document>"u")return;return G(document.cookie)[e]},set(e,t,a={}){if(typeof document>"u")return;document.cookie=E(e,t,a)},delete(e){if(typeof document>"u")return;document.cookie=E(e,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return G(document.cookie)}}}function j(){let e=typeof window<"u"&&typeof window.localStorage<"u";return{get(t){if(!e)return null;try{return window.localStorage.getItem(t)}catch{return null}},set(t,a){if(!e)return;try{window.localStorage.setItem(t,a)}catch{}},remove(t){if(!e)return;try{window.localStorage.removeItem(t)}catch{}},isAvailable(){return e}}}function L(e,t){b.set(e,t)}function q(e){return b.get(e)}function ue(e){return b.has(e)}function he(){b.clear()}function de(){return Array.from(b.keys())}async function pe(e,t="middleware"){let a=se.resolve(e,t);if(!oe.existsSync(a))return;let r=oe.readdirSync(a);for(let n of r){if(!n.endsWith(".ts")&&!n.endsWith(".js"))continue;if(n.includes(".test.")||n.includes(".spec."))continue;let s=n.replace(/\.(ts|js)$/,""),o=se.join(a,n);try{let l=(await import(o)).default;if(l&&typeof l.handler==="function")L(s,l);else if(typeof l==="function")L(s,{handler:l,mode:"universal"})}catch(i){console.warn(`Failed to load middleware '${s}' from ${o}:`,i)}}}function Ae(e){let t={};if(!e)return t;let a=new URLSearchParams(e);for(let[r,n]of a)t[r]=n;return t}function fe(e,t,a,r=""){return{path:e,params:t,query:Ae(r),fullPath:r?`${e}?${r}`:e,meta:a}}function ge(e,t,a,r){let n=r?.isServer??typeof window>"u",s=!n,o=new Headers;return{to:e,from:t,isClient:s,isServer:n,cookies:n&&a?U(a,o):X(),storage:j(),state:{},request:a,responseHeaders:o}}async function me(e,t){let a=Array.isArray(e)?e:[e],r=t.isServer;for(let n of a){let s=q(n);if(!s)return console.error(`Route middleware '${n}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${n}' is not registered`}},state:t.state,responseHeaders:t.responseHeaders};if(s.mode==="server"&&!r)continue;try{let o=await s.handler(t);if(o){if(o.type==="redirect")return{passed:!1,redirect:o,state:t.state,responseHeaders:t.responseHeaders};if(o.type==="abort")return{passed:!1,abort:o,state:t.state,responseHeaders:t.responseHeaders}}}catch(o){return console.error(`Error in middleware '${n}':`,o),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:o instanceof Error?o.message:"Middleware error"}},state:t.state,responseHeaders:t.responseHeaders}}}return{passed:!0,state:t.state,responseHeaders:t.responseHeaders}}var b;var ye=u(()=>{b=new Map});function H(e){let a=e.replace(/\\/g,"/").split("/").filter(Boolean),r=a.lastIndexOf("layouts"),n=r>=0?a[r+1]:a.at(-1);if(!n)return"app";return n.replace(/\.stx$/i,"")||"app"}function ve(e){let t=e.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),a=e.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),r=e.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),n=t?.[1]||r?.[1]||"";return{layout:n,group:a?.[1]||H(n)}}var we=()=>{};function Ce(e){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(e).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return e}}function be(){if(_)return _;return _=Ce(`
5
5
  ;(function(){
6
6
  'use strict';
7
7
  var ROUTER_REV=7;
@@ -1029,7 +1029,7 @@ else {
1029
1029
  // Remove old page scripts
1030
1030
  document.querySelectorAll('script[data-stx-page]').forEach(function(s){s.remove()});
1031
1031
  if(pushState!==false)writeHistory(pushState,url+(hash||''));
1032
- updateNav(url);
1032
+ updateNav();
1033
1033
  updateActiveLinks();
1034
1034
  if(o.scrollToTop&&!hash)window.scrollTo({top:0,behavior:'instant'});
1035
1035
  else if(hash){var el=document.querySelector(hash);if(el)el.scrollIntoView({behavior:'smooth'})}
@@ -1466,7 +1466,7 @@ else {
1466
1466
  if(pushState!==false)writeHistory(pushState,url+(hash||''));
1467
1467
 
1468
1468
  // Update active nav links
1469
- updateNav(url);
1469
+ updateNav();
1470
1470
  updateActiveLinks();
1471
1471
 
1472
1472
  // Scroll
@@ -1863,33 +1863,59 @@ else {
1863
1863
  }
1864
1864
 
1865
1865
  // \u2500\u2500 Active link management \u2500\u2500
1866
- function updateNav(url){
1866
+ // Which links point at the page being shown. Every href is resolved against
1867
+ // the current URL first, because comparing the raw attribute with
1868
+ // location.pathname got most real links wrong:
1869
+ // - a query-only href (?range=24h, the shape of every range picker and tab
1870
+ // bar) never equalled a pathname, so the active one lost its classes and
1871
+ // had the server's aria-current="page" stripped on every load;
1872
+ // - /dashboard?site=1 was never an exact match for /dashboard;
1873
+ // - http://same-origin/x and /x/ were never matches for /x;
1874
+ // - /blog was "active" on /blogging, a prefix that is not a parent.
1875
+ // Null for links the router does not own (another origin, a bare #fragment,
1876
+ // anything unparseable), which are left exactly as the server rendered them.
1877
+ function normPath(p){return p.length>1&&p.charAt(p.length-1)==='/'?p.slice(0,-1):p}
1878
+ function linkState(href){
1879
+ if(!href||href.charAt(0)==='#')return null;
1880
+ var u;
1881
+ try{u=new URL(href,location.href)}catch(e){return null}
1882
+ if(u.origin!==location.origin)return null;
1883
+ var path=normPath(u.pathname),cur=normPath(location.pathname);
1884
+ // A link with no query matches on its path, so a nav entry stays current
1885
+ // while the page adds filters. A link WITH a query is current only when
1886
+ // every param it names has that value here: of five range links that all
1887
+ // point at this path, exactly one is.
1888
+ var have=new URLSearchParams(location.search),q=true;
1889
+ u.searchParams.forEach(function(v,k){if(have.getAll(k).indexOf(v)===-1)q=false});
1890
+ return {
1891
+ exact:q&&path===cur,
1892
+ active:q&&(path==='/'?cur==='/':(cur===path||cur.indexOf(path+'/')===0))
1893
+ };
1894
+ }
1895
+
1896
+ function updateNav(){
1867
1897
  document.querySelectorAll('nav a[href], #mobileNav a[href], [data-stx-nav] a[href]').forEach(function(a){
1868
- var href=a.getAttribute('href');
1869
- if(!href||href.startsWith('#')||href.startsWith('http'))return;
1870
- var isActive=(href===url)||(href==='/'&&url==='/');
1871
- if(a.hasAttribute('data-stx-link')){
1872
- var ac=a.getAttribute('data-stx-active-class')||'active';
1873
- if(isActive)ac.split(' ').forEach(function(cls){if(cls)a.classList.add(cls)});else ac.split(' ').forEach(function(cls){if(cls)a.classList.remove(cls)});
1874
- }
1898
+ if(!a.hasAttribute('data-stx-link'))return;
1899
+ var st=linkState(a.getAttribute('href'));
1900
+ if(!st)return;
1901
+ var ac=a.getAttribute('data-stx-active-class')||'active';
1902
+ if(st.exact)ac.split(' ').forEach(function(cls){if(cls)a.classList.add(cls)});else ac.split(' ').forEach(function(cls){if(cls)a.classList.remove(cls)});
1875
1903
  });
1876
1904
  }
1877
1905
 
1878
1906
  function updateActiveLinks(){
1879
1907
  // Update active classes on <stx-link> elements (and legacy data-stx-link)
1880
1908
  var links=document.querySelectorAll('[data-stx-link]');
1881
- var cur=location.pathname;
1882
1909
  links.forEach(function(link){
1883
- var href=link.getAttribute('to')||link.getAttribute('href')||'';
1910
+ var st=linkState(link.getAttribute('to')||link.getAttribute('href')||'');
1911
+ if(!st)return;
1884
1912
  var ac=link.getAttribute('active-class')||link.getAttribute('data-stx-active-class')||'active';
1885
1913
  var eac=link.getAttribute('exact-active-class')||link.getAttribute('data-stx-exact-active-class')||'exact-active';
1886
1914
  ac.split(' ').forEach(function(cls){if(cls)link.classList.remove(cls)});
1887
1915
  eac.split(' ').forEach(function(cls){if(cls)link.classList.remove(cls)});
1888
- var isExact=cur===href;
1889
- var isActive=href!=='/'?cur.startsWith(href):cur==='/';
1890
- if(isExact)eac.split(' ').forEach(function(cls){if(cls)link.classList.add(cls)});
1891
- if(isActive)ac.split(' ').forEach(function(cls){if(cls)link.classList.add(cls)});
1892
- markCurrent(link,isExact);
1916
+ if(st.exact)eac.split(' ').forEach(function(cls){if(cls)link.classList.add(cls)});
1917
+ if(st.active)ac.split(' ').forEach(function(cls){if(cls)link.classList.add(cls)});
1918
+ markCurrent(link,st.exact);
1893
1919
  });
1894
1920
  }
1895
1921
 
@@ -2013,10 +2039,10 @@ else {
2013
2039
  injectStyles();
2014
2040
  injectViewTransitionCSS();
2015
2041
  updateActiveLinks();
2016
- updateNav(location.pathname);
2042
+ updateNav();
2017
2043
  }
2018
2044
 
2019
2045
  if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',init);else init();
2020
2046
  })();
2021
- `),_}var _;var xe=()=>{};var Ee={};Te(Ee,{setAppUrl:()=>Q,runMiddleware:()=>me,route:()=>re,resolveLayoutChain:()=>C,resetRoutes:()=>ae,registerMiddleware:()=>L,patternToRegex:()=>w,navigateTo:()=>ie,matchRoute:()=>W,loadMiddlewareFromDirectory:()=>pe,isNonPageRoutePattern:()=>y,isNonPageRoutePath:()=>F,hasMiddleware:()=>ue,getRouterScript:()=>be,getMiddlewareNames:()=>de,getMiddleware:()=>q,generateRouteTypes:()=>S,generateRouteManifest:()=>k,formatRoutes:()=>Y,findErrorPage:()=>J,filePathToPattern:()=>A,extractLayoutMetadata:()=>ve,deriveLayoutGroup:()=>H,defineRoutes:()=>te,defineRoute:()=>ee,defineMiddleware:()=>ce,createStorageManager:()=>j,createServerCookieManager:()=>U,createRouter:()=>z,createRouteLocation:()=>fe,createMiddlewareContext:()=>ge,createClientCookieManager:()=>X,clearMiddleware:()=>he,bracketPathToRegex:()=>K,abortNavigation:()=>le,Router:()=>T,NON_PAGE_DIRS:()=>m});var Re=u(()=>{Z();N();ne();ye();B();we();M();x();xe()});
2022
- export{m as jv,F as kv,y as lv,S as mv,k as nv,A as ov,w as pv,W as qv,K as rv,C as sv,T as tv,z as uv,J as vv,Y as wv,Q as xv,ee as yv,te as zv,re as Av,ae as Bv,ie as Cv,le as Dv,ce as Ev,U as Fv,X as Gv,j as Hv,L as Iv,q as Jv,ue as Kv,he as Lv,de as Mv,pe as Nv,fe as Ov,ge as Pv,me as Qv,H as Rv,ve as Sv,we as Tv,be as Uv,Ee as Vv,Re as Wv};
2047
+ `),_}var _;var xe=()=>{};var Re={};Te(Re,{setAppUrl:()=>Q,runMiddleware:()=>me,route:()=>re,resolveLayoutChain:()=>C,resetRoutes:()=>ae,registerMiddleware:()=>L,patternToRegex:()=>w,navigateTo:()=>ie,matchRoute:()=>W,loadMiddlewareFromDirectory:()=>pe,isNonPageRoutePattern:()=>y,isNonPageRoutePath:()=>F,hasMiddleware:()=>ue,getRouterScript:()=>be,getMiddlewareNames:()=>de,getMiddleware:()=>q,generateRouteTypes:()=>S,generateRouteManifest:()=>k,formatRoutes:()=>Y,findErrorPage:()=>J,filePathToPattern:()=>A,extractLayoutMetadata:()=>ve,deriveLayoutGroup:()=>H,defineRoutes:()=>te,defineRoute:()=>ee,defineMiddleware:()=>ce,createStorageManager:()=>j,createServerCookieManager:()=>U,createRouter:()=>z,createRouteLocation:()=>fe,createMiddlewareContext:()=>ge,createClientCookieManager:()=>X,clearMiddleware:()=>he,bracketPathToRegex:()=>K,abortNavigation:()=>le,Router:()=>T,NON_PAGE_DIRS:()=>m});var Ee=u(()=>{Z();N();ne();ye();P();we();M();x();xe()});
2048
+ export{m as jv,F as kv,y as lv,S as mv,k as nv,A as ov,w as pv,W as qv,K as rv,C as sv,T as tv,z as uv,J as vv,Y as wv,Q as xv,ee as yv,te as zv,re as Av,ae as Bv,ie as Cv,le as Dv,ce as Ev,U as Fv,X as Gv,j as Hv,L as Iv,q as Jv,ue as Kv,he as Lv,de as Mv,pe as Nv,fe as Ov,ge as Pv,me as Qv,H as Rv,ve as Sv,we as Tv,be as Uv,Re as Vv,Ee as Wv};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{fm as x,hq as M}from"./chunk-zqd4nrqt.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import{xt as B,zt as P}from"./chunk-bcx36g1n.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-df1mx1s1.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-5kh5dr9k.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";import G from"path";var T=["broadcast","calculateDistance","canNotify","clearCookies","clearFetchCache","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],O=new Set(T);var K=new Map,U=B(64),V=new Set,D=0,N=new Set(T);function f(){K.clear(),U.clear()}function S(H){let J=new Map;for(let Q of H){let Z=G.basename(Q);if(Z.endsWith(".d.ts"))continue;let z=Z.replace(/\.[jt]s$/,"");if(z==="index")continue;if(z===Z)continue;let X=J.get(z);if(X&&!X.endsWith(".js"))continue;J.set(z,Q)}return[...J.values()].sort()}function g(H,J){let Q=J.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${Q}\\b`).test(H)}function y(H){if(!H)return[];let J=P(H,D),Q=U.get(J);if(Q)return Q.slice();let Z=H.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),z=[];for(let X of N){if(V.has(X))continue;let A=X.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${A}\\s*\\(`).test(Z))z.push(X)}return z.sort(),U.set(J,z),z.slice()}async function p(H,J){let Q=y(H);if(Q.length===0)return null;let Z=J??G.join(import.meta.dir,"composables"),z=`${Z}\x00${Q.join(",")}`,X=K.get(z);if(X!==void 0)return X||null;let A=M({loader:"ts",target:"browser",define:x()}),L=new Set(Q),W=[],C=new Set,F=[];try{let q=new Bun.Glob("*.{ts,js}");for await(let j of q.scan({cwd:Z,absolute:!0}))F.push(j)}catch{return K.set(z,""),null}F=S(F);for(let q of F){let j;try{j=await Bun.file(q).text()}catch{continue}let I=[];try{I=A.scan(j).exports.filter(($)=>$!=="default")}catch{continue}if(!I.some(($)=>L.has($)))continue;try{j=j.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^import\s+type\s+.*$/gm,""),j=j.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),j=j.replace(/^export\s+default\s+/gm,""),j=j.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),W.push(`// ${G.basename(q).replace(/\.[jt]s$/,"")}
2
+ import{fm as x,hq as M}from"./chunk-c8xa2551.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import{xt as B,zt as P}from"./chunk-sytymfs3.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-36dt9a5b.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-h22zwr5c.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";import G from"path";var T=["broadcast","calculateDistance","canNotify","clearCookies","clearFetchCache","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],O=new Set(T);var K=new Map,U=B(64),V=new Set,D=0,N=new Set(T);function f(){K.clear(),U.clear()}function S(H){let J=new Map;for(let Q of H){let Z=G.basename(Q);if(Z.endsWith(".d.ts"))continue;let z=Z.replace(/\.[jt]s$/,"");if(z==="index")continue;if(z===Z)continue;let X=J.get(z);if(X&&!X.endsWith(".js"))continue;J.set(z,Q)}return[...J.values()].sort()}function g(H,J){let Q=J.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${Q}\\b`).test(H)}function y(H){if(!H)return[];let J=P(H,D),Q=U.get(J);if(Q)return Q.slice();let Z=H.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),z=[];for(let X of N){if(V.has(X))continue;let A=X.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${A}\\s*\\(`).test(Z))z.push(X)}return z.sort(),U.set(J,z),z.slice()}async function p(H,J){let Q=y(H);if(Q.length===0)return null;let Z=J??G.join(import.meta.dir,"composables"),z=`${Z}\x00${Q.join(",")}`,X=K.get(z);if(X!==void 0)return X||null;let A=M({loader:"ts",target:"browser",define:x()}),L=new Set(Q),W=[],C=new Set,F=[];try{let q=new Bun.Glob("*.{ts,js}");for await(let j of q.scan({cwd:Z,absolute:!0}))F.push(j)}catch{return K.set(z,""),null}F=S(F);for(let q of F){let j;try{j=await Bun.file(q).text()}catch{continue}let I=[];try{I=A.scan(j).exports.filter(($)=>$!=="default")}catch{continue}if(!I.some(($)=>L.has($)))continue;try{j=j.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^import\s+type\s+.*$/gm,""),j=j.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),j=j.replace(/^export\s+default\s+/gm,""),j=j.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),W.push(`// ${G.basename(q).replace(/\.[jt]s$/,"")}
3
3
  ${A.transformSync(j).trim()}`);for(let $ of I)C.add($)}catch($){console.warn(`[stx] framework composable ${G.basename(q)} could not be bundled:`,$)}}let Y=Q.filter((q)=>!C.has(q)&&!g(H,q));if(Y.length>0)console.warn(`[stx] could not bundle ${Y.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(W.length===0)return K.set(z,""),null;let k=[...C].map((q)=>` try { if (!(${JSON.stringify(q)} in __s)) { __s[${JSON.stringify(q)}] = ${q}; if (!(${JSON.stringify(q)} in window)) window[${JSON.stringify(q)}] = ${q}; } } catch (e) {}`).join(`
4
4
  `),w=`<script data-stx-framework-composables>
5
5
  ;(function(){
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Am as d,Bm as e,Cm as f,Dm as g,Em as h,Fm as i,Gm as j,Hm as k,Im as l,Jm as m,Km as n,Lm as o,Mm as p,xm as a,ym as b,zm as c}from"./chunk-zqd4nrqt.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-bcx36g1n.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-df1mx1s1.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-5kh5dr9k.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{h as usesSignalsInScript,p as unescapeHtml,n as resetRejectedExpressionWarnings,c as registerFilters,b as registerFilter,l as processExpressions,k as interpolateScriptsInTemplate,i as interpolateScriptExpressions,j as interpolateScriptAttributes,d as getAllFilters,o as evaluateExpression,g as escapeHtmlValue,f as escapeHtml,a as defaultFilters,e as clearCustomFilters,m as applyFilters};
2
+ import{Am as d,Bm as e,Cm as f,Dm as g,Em as h,Fm as i,Gm as j,Hm as k,Im as l,Jm as m,Km as n,Lm as o,Mm as p,xm as a,ym as b,zm as c}from"./chunk-c8xa2551.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-sytymfs3.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-36dt9a5b.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-h22zwr5c.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{h as usesSignalsInScript,p as unescapeHtml,n as resetRejectedExpressionWarnings,c as registerFilters,b as registerFilter,l as processExpressions,k as interpolateScriptsInTemplate,i as interpolateScriptExpressions,j as interpolateScriptAttributes,d as getAllFilters,o as evaluateExpression,g as escapeHtmlValue,f as escapeHtml,a as defaultFilters,e as clearCustomFilters,m as applyFilters};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ue as a}from"./chunk-ax3zx9qr.js";import"./chunk-dvvx1wny.js";import"./chunk-c8xa2551.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-sytymfs3.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-36dt9a5b.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-h22zwr5c.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{a as buildApp};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{$j as h,Uj as a,Vj as b,Wj as c,Xj as d,Yj as e,Zj as f,_j as g,ak as i,bk as j,ck as k,dk as l}from"./chunk-4mftgf8s.js";import"./chunk-zqd4nrqt.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-bcx36g1n.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-df1mx1s1.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-5kh5dr9k.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{a as templateCache,b as readFileCached,d as invalidateFileCacheByDir,c as invalidateFileCache,l as hashFilePath,h as getServeClientAsset,f as getCachedSignalsRuntime,g as getCachedRouterScript,i as clearDevCaches,j as checkCache,k as cacheTemplate,e as __setSignalsGeneratorsForTest};
2
+ import{$j as h,Uj as a,Vj as b,Wj as c,Xj as d,Yj as e,Zj as f,_j as g,ak as i,bk as j,ck as k,dk as l}from"./chunk-asvtwk0t.js";import"./chunk-c8xa2551.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-sytymfs3.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-36dt9a5b.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-h22zwr5c.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{a as templateCache,b as readFileCached,d as invalidateFileCacheByDir,c as invalidateFileCache,l as hashFilePath,h as getServeClientAsset,f as getCachedSignalsRuntime,g as getCachedRouterScript,i as clearDevCaches,j as checkCache,k as cacheTemplate,e as __setSignalsGeneratorsForTest};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{$p as H,Cm as O,Qo as R,rq as x,wr as g}from"./chunk-zqd4nrqt.js";import b from"path";var v={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},M=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var T=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function f(q){let B=[],Q=0,G;T.lastIndex=0;while((G=T.exec(q))!==null){if(G.index>Q){let X=q.slice(Q,G.index);if(X.trim())B.push({type:B.length===0?"shell":"content",content:X})}let J=G[1],K=G[2];B.push({type:"suspense",name:J,content:K}),Q=G.index+G[0].length}if(Q<q.length){let J=q.slice(Q);if(J.trim())B.push({type:B.length===0?"shell":"content",content:J})}if(B.length===0)B.push({type:"shell",content:q});return B}async function r(q,B={},Q={}){let G={...g,...Q,streaming:{...v,...Q.streaming}},J=G.streaming?.bufferSize||16384;return new ReadableStream({async start(K){try{let X=await Bun.file(q).text(),z=X.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),L=z?z[1]:"",Y=X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),j={...B,__filename:q,__dirname:b.dirname(q)};if(L.trim())await R(L,j,q);let D=f(Y),$=new Set;if(!D.some((w)=>w.type==="suspense")){let w=G.streaming?.strategy||"auto",U=new RegExp(M.source,"g");if(!(w!=="manual"&&U.test(Y))){let F=await H(Y,j,q,G,$);for(let V=0;V<F.length;V+=J)K.enqueue(F.slice(V,V+J)),await new Promise((W)=>setTimeout(W,0))}else{let F=[],V=new RegExp(M.source,"g"),W;while((W=V.exec(Y))!==null)F.push({name:W[1],content:W[2],start:W.index,end:W.index+W[0].length});let y=0;for(let A of F){if(A.start>y){let k=Y.slice(y,A.start);if(k.trim()){let E=await H(k,j,q,G,$);K.enqueue(E),await new Promise((S)=>setTimeout(S,0))}}let I=await H(A.content,j,q,G,$);K.enqueue(I),await new Promise((k)=>setTimeout(k,0)),y=A.end}if(y<Y.length){let A=Y.slice(y);if(A.trim()){let I=await H(A,j,q,G,$);K.enqueue(I)}}}}else{let w=new Map;for(let Z of D)if(Z.type==="shell"||Z.type==="content"){let F=await H(Z.content,j,q,G,$);K.enqueue(F)}else if(Z.type==="suspense"&&Z.name){let F=`stx-suspense-${Z.name}`;K.enqueue(`<div id="${F}" data-suspense="${Z.name}" style="display:contents;">
2
+ import{$p as H,Cm as O,Qo as R,rq as x,wr as g}from"./chunk-c8xa2551.js";import b from"path";var v={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},M=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var T=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function f(q){let B=[],Q=0,G;T.lastIndex=0;while((G=T.exec(q))!==null){if(G.index>Q){let X=q.slice(Q,G.index);if(X.trim())B.push({type:B.length===0?"shell":"content",content:X})}let J=G[1],K=G[2];B.push({type:"suspense",name:J,content:K}),Q=G.index+G[0].length}if(Q<q.length){let J=q.slice(Q);if(J.trim())B.push({type:B.length===0?"shell":"content",content:J})}if(B.length===0)B.push({type:"shell",content:q});return B}async function r(q,B={},Q={}){let G={...g,...Q,streaming:{...v,...Q.streaming}},J=G.streaming?.bufferSize||16384;return new ReadableStream({async start(K){try{let X=await Bun.file(q).text(),z=X.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),L=z?z[1]:"",Y=X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),j={...B,__filename:q,__dirname:b.dirname(q)};if(L.trim())await R(L,j,q);let D=f(Y),$=new Set;if(!D.some((w)=>w.type==="suspense")){let w=G.streaming?.strategy||"auto",U=new RegExp(M.source,"g");if(!(w!=="manual"&&U.test(Y))){let F=await H(Y,j,q,G,$);for(let V=0;V<F.length;V+=J)K.enqueue(F.slice(V,V+J)),await new Promise((W)=>setTimeout(W,0))}else{let F=[],V=new RegExp(M.source,"g"),W;while((W=V.exec(Y))!==null)F.push({name:W[1],content:W[2],start:W.index,end:W.index+W[0].length});let y=0;for(let A of F){if(A.start>y){let k=Y.slice(y,A.start);if(k.trim()){let E=await H(k,j,q,G,$);K.enqueue(E),await new Promise((S)=>setTimeout(S,0))}}let I=await H(A.content,j,q,G,$);K.enqueue(I),await new Promise((k)=>setTimeout(k,0)),y=A.end}if(y<Y.length){let A=Y.slice(y);if(A.trim()){let I=await H(A,j,q,G,$);K.enqueue(I)}}}}else{let w=new Map;for(let Z of D)if(Z.type==="shell"||Z.type==="content"){let F=await H(Z.content,j,q,G,$);K.enqueue(F)}else if(Z.type==="suspense"&&Z.name){let F=`stx-suspense-${Z.name}`;K.enqueue(`<div id="${F}" data-suspense="${Z.name}" style="display:contents;">
3
3
  <template data-suspense-fallback>Loading...</template>
4
4
  </div>`),w.set(Z.name,H(Z.content,j,q,G,$))}K.enqueue(`
5
5
  <script>
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Ri as a,Si as b,Ti as c}from"./chunk-xdnsxn2f.js";import"./chunk-xwxdwqn9.js";import"./chunk-zqd4nrqt.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-bcx36g1n.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-df1mx1s1.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-5kh5dr9k.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{a as listComposableModules,b as getComposableScript,c as clearComposableCache};
2
+ import{Ri as a,Si as b,Ti as c}from"./chunk-8hw05c3g.js";import"./chunk-xwxdwqn9.js";import"./chunk-c8xa2551.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-sytymfs3.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-36dt9a5b.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-h22zwr5c.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{a as listComposableModules,b as getComposableScript,c as clearComposableCache};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Te as a}from"./chunk-hnb6kzpe.js";import"./chunk-zqd4nrqt.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-bcx36g1n.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-df1mx1s1.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-5kh5dr9k.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{a as startInteractive};
2
+ import{Te as a}from"./chunk-g32847vd.js";import"./chunk-c8xa2551.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-sytymfs3.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-36dt9a5b.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-h22zwr5c.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{a as startInteractive};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{gl as a,hl as b,il as c,jl as d,kl as e,ll as f,ml as g,nl as h,ol as i,pl as j,ql as k,rl as l,sl as m,tl as n}from"./chunk-6aqsmree.js";import"./chunk-avqacmvp.js";import"./chunk-zqd4nrqt.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-bcx36g1n.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-df1mx1s1.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-5kh5dr9k.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{b as shouldLogBundlerDiagnostics,f as setBundlerFallbackMode,l as rewriteRegistryImports,g as resolveBundlerFallback,j as registryIdForPath,c as recordBundleFailure,m as queueClientBundleBuild,k as normalizeRegistrySpecifiers,h as hasUserImports,d as getBundleFailures,a as clientBundleDependencies,e as clearBundleFailures,n as bundleClientScript,i as MODULE_SPECIFIER_PREFIX};
2
+ import{gl as a,hl as b,il as c,jl as d,kl as e,ll as f,ml as g,nl as h,ol as i,pl as j,ql as k,rl as l,sl as m,tl as n}from"./chunk-ta1p5yab.js";import"./chunk-0n9ywg62.js";import"./chunk-c8xa2551.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-sytymfs3.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-36dt9a5b.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-h22zwr5c.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{b as shouldLogBundlerDiagnostics,f as setBundlerFallbackMode,l as rewriteRegistryImports,g as resolveBundlerFallback,j as registryIdForPath,c as recordBundleFailure,m as queueClientBundleBuild,k as normalizeRegistrySpecifiers,h as hasUserImports,d as getBundleFailures,a as clientBundleDependencies,e as clearBundleFailures,n as bundleClientScript,i as MODULE_SPECIFIER_PREFIX};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Xf as v,Yf as t,Zf as e,ag as HH,bg as KH,cg as QH,dg as YH,eg as ZH,fg as $H}from"./chunk-yyy5mk7b.js";import{Ri as s}from"./chunk-xdnsxn2f.js";import{em as a,yr as i}from"./chunk-zqd4nrqt.js";import{ou as h}from"./chunk-4ee1aaet.js";import{Uu as f}from"./chunk-ttny9g8k.js";import{existsSync as jH,readFileSync as WH}from"fs";import z from"path";function AH(Q,K="",V=""){let L=Q.startLine>1?`
2
+ import{Xf as v,Yf as t,Zf as e,ag as HH,bg as KH,cg as QH,dg as YH,eg as ZH,fg as $H}from"./chunk-776va6he.js";import{Ri as s}from"./chunk-8hw05c3g.js";import{em as a,yr as i}from"./chunk-c8xa2551.js";import{ou as h}from"./chunk-4ee1aaet.js";import{Uu as f}from"./chunk-ttny9g8k.js";import{existsSync as jH,readFileSync as WH}from"fs";import z from"path";function AH(Q,K="",V=""){let L=Q.startLine>1?`
3
3
  `.repeat(Q.startLine-1):"",U=e(t(Q.code)),X=Q.kind==="client"||Q.kind==="plain"?KH(K,Q.code):"";return YH(`${L+U}
4
4
  ${X}
5
5
  export {}
@@ -1,4 +1,4 @@
1
1
  // @bun
2
2
  import{ew as H}from"./chunk-jryjwara.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-3h5z1eby.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-k8p54eqr.js"),F=Q(B),V=U(F.stxImports,F.browserImports),{transformStoreImports:W}=await import("./chunk-9aw5d4rr.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(`
3
+ `),B;try{let{bundleClientScript:j}=await import("./chunk-ncvm6af1.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-pqvzm9pz.js"),F=Q(B),V=U(F.stxImports,F.browserImports),{transformStoreImports:W}=await import("./chunk-9aw5d4rr.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};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Ui as O,Vi as w,Wi as Z}from"./chunk-xwxdwqn9.js";import{gl as R,nl as U,tl as T}from"./chunk-6aqsmree.js";import{Io as W,fm as M,hq as k,yr as C}from"./chunk-zqd4nrqt.js";import{Pu as E,Qu as L}from"./chunk-xcsf7my7.js";import{Uu as B}from"./chunk-ttny9g8k.js";import $ from"path";var Y=new Map;function b(Q,z){for(let J of Q.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(J[1])z.add(J[1]);for(let J of Q.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let H of(J[1]??"").split(",")){let K=((H.includes(":")?H.split(":").pop():H)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(K))z.add(K)}for(let J of Q.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let H of(J[1]??"").split(",")){let V=H.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(V))z.add(V)}}async function l(Q){let z;if(Q)z=$.resolve(Q);else{let q=await C();z=$.resolve(q.root||process.cwd(),q.storesDir||"stores")}let J=new Bun.Glob("*.ts"),H=[];try{for await(let q of J.scan({cwd:z,absolute:!0})){let y=$.basename(q,".ts");if(["index","types"].includes(y))continue;if(q.includes(".d.ts"))continue;H.push(q)}}catch{return Z(Y,z,"",""),null}let V=()=>[...new Set([...H,...H.flatMap((q)=>R(q))])],K=O(V()),P=w(Y,z,K);if(P!==void 0)return P||null;if(H.length===0)return Z(Y,z,K,""),null;let A=[];for(let q of H){let y=await Bun.file(q).text();A.push({file:q,hasUseStore:/useStore\s*\(/.test(y)})}A.sort((q,y)=>{if(q.hasUseStore===y.hasUseStore)return 0;return q.hasUseStore?1:-1});let N=A.map((q)=>q.file),G=[],X=new Set,F=k({loader:"ts",target:"browser",define:M()});for(let q of N)try{let y=await Bun.file(q).text(),I=$.basename(q,".ts");if(b(y,X),U(y))y=await T(y,q,{projectRoot:process.cwd(),externalizeUserModules:!1});y=W(y),y=E(y),y=L(y),y=y.replace(/^export\s+(default\s+)?/gm,""),y=F.transformSync(y),G.push(`// Store: ${I}
2
+ import{Ui as O,Vi as w,Wi as Z}from"./chunk-xwxdwqn9.js";import{gl as R,nl as U,tl as T}from"./chunk-ta1p5yab.js";import{Io as W,fm as M,hq as k,yr as C}from"./chunk-c8xa2551.js";import{Pu as E,Qu as L}from"./chunk-xcsf7my7.js";import{Uu as B}from"./chunk-ttny9g8k.js";import $ from"path";var Y=new Map;function b(Q,z){for(let J of Q.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(J[1])z.add(J[1]);for(let J of Q.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let H of(J[1]??"").split(",")){let K=((H.includes(":")?H.split(":").pop():H)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(K))z.add(K)}for(let J of Q.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let H of(J[1]??"").split(",")){let V=H.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(V))z.add(V)}}async function l(Q){let z;if(Q)z=$.resolve(Q);else{let q=await C();z=$.resolve(q.root||process.cwd(),q.storesDir||"stores")}let J=new Bun.Glob("*.ts"),H=[];try{for await(let q of J.scan({cwd:z,absolute:!0})){let y=$.basename(q,".ts");if(["index","types"].includes(y))continue;if(q.includes(".d.ts"))continue;H.push(q)}}catch{return Z(Y,z,"",""),null}let V=()=>[...new Set([...H,...H.flatMap((q)=>R(q))])],K=O(V()),P=w(Y,z,K);if(P!==void 0)return P||null;if(H.length===0)return Z(Y,z,K,""),null;let A=[];for(let q of H){let y=await Bun.file(q).text();A.push({file:q,hasUseStore:/useStore\s*\(/.test(y)})}A.sort((q,y)=>{if(q.hasUseStore===y.hasUseStore)return 0;return q.hasUseStore?1:-1});let N=A.map((q)=>q.file),G=[],X=new Set,F=k({loader:"ts",target:"browser",define:M()});for(let q of N)try{let y=await Bun.file(q).text(),I=$.basename(q,".ts");if(b(y,X),U(y))y=await T(y,q,{projectRoot:process.cwd(),externalizeUserModules:!1});y=W(y),y=E(y),y=L(y),y=y.replace(/^export\s+(default\s+)?/gm,""),y=F.transformSync(y),G.push(`// Store: ${I}
3
3
  ${y.trim()}`)}catch(y){console.warn(`[stx] Failed to load store ${q}:`,y)}if(G.length===0)return Z(Y,z,K,""),null;let j=G.join(`
4
4
 
5
5
  `),x=`;(function(){
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{$o as d,Yo as a,Zo as b,_o as c,ap as e,bp as f}from"./chunk-zqd4nrqt.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-bcx36g1n.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-df1mx1s1.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-5kh5dr9k.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{f as processStackReplacements,e as processStackPushDirectives,d as processIncludes,a as partialsCache,b as onceStore,c as clearOnceStore};
2
+ import{$o as d,Yo as a,Zo as b,_o as c,ap as e,bp as f}from"./chunk-c8xa2551.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-sytymfs3.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-36dt9a5b.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-h22zwr5c.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{f as processStackReplacements,e as processStackPushDirectives,d as processIncludes,a as partialsCache,b as onceStore,c as clearOnceStore};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{em as c,hm as d,im as e,jm as f,km as g,lm as h,mm as i,nm as j,om as k,pm as l,qm as m}from"./chunk-zqd4nrqt.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import{it as a,jt as b}from"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-bcx36g1n.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-df1mx1s1.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-5kh5dr9k.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{h as transformAutoImports,b as stripCommentsAndLiterals,e as renderVendorStyleTags,m as processClientScript,g as injectBrowserCoreAutoImports,l as generateServerDataBridge,j as generateBrowserAutoImportDestructuring,i as generateAutoImportDestructuring,a as findInterpolationEnd,k as extractBridgeData,d as extractAndStripCssImports,f as STX_AUTO_IMPORTS,c as BROWSER_CORE_IMPORTS};
2
+ import{em as c,hm as d,im as e,jm as f,km as g,lm as h,mm as i,nm as j,om as k,pm as l,qm as m}from"./chunk-c8xa2551.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import{it as a,jt as b}from"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-sytymfs3.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-36dt9a5b.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-h22zwr5c.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{h as transformAutoImports,b as stripCommentsAndLiterals,e as renderVendorStyleTags,m as processClientScript,g as injectBrowserCoreAutoImports,l as generateServerDataBridge,j as generateBrowserAutoImportDestructuring,i as generateAutoImportDestructuring,a as findInterpolationEnd,k as extractBridgeData,d as extractAndStripCssImports,f as STX_AUTO_IMPORTS,c as BROWSER_CORE_IMPORTS};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{Cm as I}from"./chunk-zqd4nrqt.js";import{rs as F,vs as V}from"./chunk-raxr83fs.js";function R(j,W){let U=1,z=W,G="<template",X="</template";while(z<j.length&&U>0){let J=j.indexOf("<",z);if(J===-1)break;if(z=J,j.startsWith(G,z)&&(z+G.length>=j.length||/[\s>\/]/.test(j[z+G.length]))){U++,z+=G.length;continue}if(j.startsWith(X,z)){let Y=j.indexOf(">",z+X.length);if(Y!==-1){if(U--,U===0)return Y+1;z=Y+1;continue}}z++}return U===0?z:-1}var P=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function D(j,W){let U=null;for(let z=W;z<j.length;z++){let G=j[z];if(U){if(G==="\\"){z++;continue}if(G===U)U=null;continue}if(G==='"'||G==="'"){U=G;continue}if(G===">")return z+1}return-1}function b(j){let W=[],U=[],z=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,G=0;while(G<j.length){let X=j.indexOf("<",G);if(X===-1)break;if(j.startsWith("<!--",X)){let $=j.indexOf("-->",X+4);G=$===-1?j.length:$+3;continue}let J=D(j,X+1);if(J===-1)break;let Y=j.slice(X,J),Q=Y.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!Q){G=J;continue}let Z=Q[1]==="/",H=Q[2].toLowerCase();if(Z){let $=U.lastIndexOf(H);if($!==-1)U.splice($);G=J;continue}if(H==="template"&&U.length===0){let $=Y.match(z);if($){let K=R(j,J);if(K!==-1){let O=$[1]||$[2]||$[3];W.push({start:X,end:K,slotName:O,content:j.slice(J,K-11).trim(),propsBinding:$[4]||void 0}),G=K;continue}}}if(!/\/\s*>$/.test(Y)&&!P.has(H)){if(U.push(H),H==="script"||H==="style"){let $=j.toLowerCase().indexOf(`</${H}>`,J);if($!==-1){G=$;continue}}}G=J}return W}function w(j){let W={default:"",named:new Map},U=j,z=b(j);for(let Q of z)W.named.set(Q.slotName,{name:Q.slotName,content:Q.content,propsBinding:Q.propsBinding});z.sort((Q,Z)=>Z.start-Q.start);for(let Q of z)U=U.slice(0,Q.start)+U.slice(Q.end);let G=[],X=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,J;while((J=X.exec(U))!==null){let[Q,Z,H,_,$,K]=J,O=H.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),B=$.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=(O+B).trim(),q=`<${Z}${L?" "+L:""}>${K}</${Z}>`;G.push({start:J.index,end:J.index+Q.length,slotName:_,element:q})}let Y=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((J=Y.exec(U))!==null){let[Q,Z,H,_,$]=J,K=H.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),O=$.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),B=(K+O).trim(),L=`<${Z}${B?" "+B:""} />`;G.push({start:J.index,end:J.index+Q.length,slotName:_,element:L})}G.sort((Q,Z)=>Z.start-Q.start);for(let Q of G){let Z=W.named.get(Q.slotName);if(Z)Z.content+=Q.element;else W.named.set(Q.slotName,{name:Q.slotName,content:Q.element});U=U.slice(0,Q.start)+U.slice(Q.end)}return W.default=U.trim(),W}function C(j){let W=j.match(/name\s*=\s*["']([^"']+)["']/),U=W?W[1]:"",z={},G=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,X;while((X=G.exec(j))!==null)z[X[1]]=X[2];let J=j.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),Y=J?J[1].trim():"";return{name:U,props:z,defaultContent:Y}}async function N(j,W,U,z){if(!j)return U;let G=j.content;if(j.propsBinding&&Object.keys(W).length>0){let X=j.propsBinding.trim(),J={...z};if(X.startsWith("{")&&X.endsWith("}")){let Y=X.slice(1,-1).split(",").map((Q)=>Q.trim()).filter(Boolean);for(let Q of Y){let[Z,H]=Q.split(":").map(($)=>$.trim()),_=H||Z;if(W[Z]!==void 0)J[_]=W[Z]}}else J[X]=W;G=k(G,J)}return G}function k(j,W){return j.replace(/\{\{\s*([^}]+)\s*\}\}/g,(U,z)=>{try{let G=z.trim(),X=y(G,W);return I(String(X??""))}catch{return`{{ ${z} }}`}})}function y(j,W){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(j)){let z=j.split("."),G=W;for(let X of z)if(G&&typeof G==="object"&&X in G)G=G[X];else return;return G}let U=j.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(U){let[,z,G,X]=U,J=W[z],Y=parseInt(X,10);if(typeof J==="number")switch(G){case"+":return J+Y;case"-":return J-Y;case"*":return J*Y;case"/":return J/Y}}try{if(!F(j))return;return V(j,Object.keys(W))(...Object.values(W))}catch{return}}async function A(j,W,U){let z=j;z=await v(z,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(J,Y,Q,Z)=>{let H=W.named.get(Y),_=Z?.trim()||"",$=Q||"",K={},O=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,B;while((B=O.exec($))!==null){let L=B[1],q=B[2];K[L]=y(q,U)}return await N(H,K,_,U)});let X=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return z=z.replace(X,(J,Y)=>{if(J.includes("name="))return J;let Q=Y?.trim()||"";return W.default||Q}),z}async function v(j,W,U){let z=[],G=[];j.replace(W,(Y,...Q)=>{let Z=Q[Q.length-2];return G.push({match:Y,index:Z}),z.push(U(Y,...Q.slice(0,-2))),Y});let X=await Promise.all(z),J=j;for(let Y=G.length-1;Y>=0;Y--){let{match:Q,index:Z}=G[Y];J=J.slice(0,Z)+X[Y]+J.slice(Z+Q.length)}return J}function E(j){let W=w(j);return{defaultSlot:W.default,namedSlots:W.named}}async function M(j,W,U,z){return await A(j,{default:W,named:U},z)}
2
+ import{Cm as I}from"./chunk-c8xa2551.js";import{rs as F,vs as V}from"./chunk-raxr83fs.js";function R(j,W){let U=1,z=W,G="<template",X="</template";while(z<j.length&&U>0){let J=j.indexOf("<",z);if(J===-1)break;if(z=J,j.startsWith(G,z)&&(z+G.length>=j.length||/[\s>\/]/.test(j[z+G.length]))){U++,z+=G.length;continue}if(j.startsWith(X,z)){let Y=j.indexOf(">",z+X.length);if(Y!==-1){if(U--,U===0)return Y+1;z=Y+1;continue}}z++}return U===0?z:-1}var P=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function D(j,W){let U=null;for(let z=W;z<j.length;z++){let G=j[z];if(U){if(G==="\\"){z++;continue}if(G===U)U=null;continue}if(G==='"'||G==="'"){U=G;continue}if(G===">")return z+1}return-1}function b(j){let W=[],U=[],z=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,G=0;while(G<j.length){let X=j.indexOf("<",G);if(X===-1)break;if(j.startsWith("<!--",X)){let $=j.indexOf("-->",X+4);G=$===-1?j.length:$+3;continue}let J=D(j,X+1);if(J===-1)break;let Y=j.slice(X,J),Q=Y.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!Q){G=J;continue}let Z=Q[1]==="/",H=Q[2].toLowerCase();if(Z){let $=U.lastIndexOf(H);if($!==-1)U.splice($);G=J;continue}if(H==="template"&&U.length===0){let $=Y.match(z);if($){let K=R(j,J);if(K!==-1){let O=$[1]||$[2]||$[3];W.push({start:X,end:K,slotName:O,content:j.slice(J,K-11).trim(),propsBinding:$[4]||void 0}),G=K;continue}}}if(!/\/\s*>$/.test(Y)&&!P.has(H)){if(U.push(H),H==="script"||H==="style"){let $=j.toLowerCase().indexOf(`</${H}>`,J);if($!==-1){G=$;continue}}}G=J}return W}function w(j){let W={default:"",named:new Map},U=j,z=b(j);for(let Q of z)W.named.set(Q.slotName,{name:Q.slotName,content:Q.content,propsBinding:Q.propsBinding});z.sort((Q,Z)=>Z.start-Q.start);for(let Q of z)U=U.slice(0,Q.start)+U.slice(Q.end);let G=[],X=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,J;while((J=X.exec(U))!==null){let[Q,Z,H,_,$,K]=J,O=H.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),B=$.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=(O+B).trim(),q=`<${Z}${L?" "+L:""}>${K}</${Z}>`;G.push({start:J.index,end:J.index+Q.length,slotName:_,element:q})}let Y=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((J=Y.exec(U))!==null){let[Q,Z,H,_,$]=J,K=H.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),O=$.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),B=(K+O).trim(),L=`<${Z}${B?" "+B:""} />`;G.push({start:J.index,end:J.index+Q.length,slotName:_,element:L})}G.sort((Q,Z)=>Z.start-Q.start);for(let Q of G){let Z=W.named.get(Q.slotName);if(Z)Z.content+=Q.element;else W.named.set(Q.slotName,{name:Q.slotName,content:Q.element});U=U.slice(0,Q.start)+U.slice(Q.end)}return W.default=U.trim(),W}function C(j){let W=j.match(/name\s*=\s*["']([^"']+)["']/),U=W?W[1]:"",z={},G=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,X;while((X=G.exec(j))!==null)z[X[1]]=X[2];let J=j.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),Y=J?J[1].trim():"";return{name:U,props:z,defaultContent:Y}}async function N(j,W,U,z){if(!j)return U;let G=j.content;if(j.propsBinding&&Object.keys(W).length>0){let X=j.propsBinding.trim(),J={...z};if(X.startsWith("{")&&X.endsWith("}")){let Y=X.slice(1,-1).split(",").map((Q)=>Q.trim()).filter(Boolean);for(let Q of Y){let[Z,H]=Q.split(":").map(($)=>$.trim()),_=H||Z;if(W[Z]!==void 0)J[_]=W[Z]}}else J[X]=W;G=k(G,J)}return G}function k(j,W){return j.replace(/\{\{\s*([^}]+)\s*\}\}/g,(U,z)=>{try{let G=z.trim(),X=y(G,W);return I(String(X??""))}catch{return`{{ ${z} }}`}})}function y(j,W){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(j)){let z=j.split("."),G=W;for(let X of z)if(G&&typeof G==="object"&&X in G)G=G[X];else return;return G}let U=j.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(U){let[,z,G,X]=U,J=W[z],Y=parseInt(X,10);if(typeof J==="number")switch(G){case"+":return J+Y;case"-":return J-Y;case"*":return J*Y;case"/":return J/Y}}try{if(!F(j))return;return V(j,Object.keys(W))(...Object.values(W))}catch{return}}async function A(j,W,U){let z=j;z=await v(z,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(J,Y,Q,Z)=>{let H=W.named.get(Y),_=Z?.trim()||"",$=Q||"",K={},O=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,B;while((B=O.exec($))!==null){let L=B[1],q=B[2];K[L]=y(q,U)}return await N(H,K,_,U)});let X=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return z=z.replace(X,(J,Y)=>{if(J.includes("name="))return J;let Q=Y?.trim()||"";return W.default||Q}),z}async function v(j,W,U){let z=[],G=[];j.replace(W,(Y,...Q)=>{let Z=Q[Q.length-2];return G.push({match:Y,index:Z}),z.push(U(Y,...Q.slice(0,-2))),Y});let X=await Promise.all(z),J=j;for(let Y=G.length-1;Y>=0;Y--){let{match:Q,index:Z}=G[Y];J=J.slice(0,Z)+X[Y]+J.slice(Z+Q.length)}return J}function E(j){let W=w(j);return{defaultSlot:W.default,namedSlots:W.named}}async function M(j,W,U,z){return await A(j,{default:W,named:U},z)}
3
3
  export{w as Vg,C as Wg,N as Xg,A as Yg,E as Zg,M as _g};
@@ -17,7 +17,7 @@ catch (e) {
17
17
  }
18
18
  throw e;
19
19
  }
20
- `),U.set(X,q)}return q(...j)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:W,context:Q.slice()});return W}clear(){this.pool.length=0,this.fnCache.clear()}}var CQ=new bJ;class kJ{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(J){this.enabled=J}isEnabled(){return this.enabled}setBudget(J,Q){this.budgets.set(J,{warnThreshold:0.8,action:"warn",...Q})}setBudgets(J){for(let[Q,Z]of Object.entries(J))this.setBudget(Q,Z)}removeBudget(J){this.budgets.delete(J)}getBudgets(){let J={};for(let[Q,Z]of this.budgets.entries())J[Q]=Z;return J}onViolation(J){this.violationHandlers.push(J)}offViolation(J){let Q=this.violationHandlers.indexOf(J);if(Q!==-1)this.violationHandlers.splice(Q,1)}time(J,Q){if(!this.enabled)return Q();let Z=performance.now(),$=Q(),U=performance.now()-Z;return this.recordTime(J,U),this.checkBudget(J,U),$}async timeAsync(J,Q){if(!this.enabled)return Q();let Z=performance.now(),$=await Q(),U=performance.now()-Z;return this.recordTime(J,U),this.checkBudget(J,U),$}checkBudget(J,Q){let Z=this.budgets.get(J);if(!Z)return;let $=Q/Z.maxTime*100,U=Z.warnThreshold!==void 0?Q>=Z.maxTime*Z.warnThreshold&&Q<Z.maxTime:!1,F=Q>=Z.maxTime;if(!U&&!F)return;let W={label:J,actualTime:Q,budgetTime:Z.maxTime,exceedancePercent:$,timestamp:new Date,isWarning:U};this.violations.push(W);while(this.violations.length>this.maxViolations)this.violations.shift();for(let V of this.violationHandlers)try{V(W)}catch{}let j=U?`[Performance Warning] "${J}" took ${Q.toFixed(2)}ms (${$.toFixed(1)}% of ${Z.maxTime}ms budget)`:`[Performance Budget Exceeded] "${J}" took ${Q.toFixed(2)}ms (exceeded ${Z.maxTime}ms budget by ${($-100).toFixed(1)}%)`;switch(Z.action){case"log":console.log(j);break;case"warn":console.warn(j);break;case"error":console.error(j);break;case"throw":if(F)throw Error(j);else console.warn(j);break}}recordTime(J,Q){let Z=this.metrics.get(J);if(Z)Z.count++,Z.totalTime+=Q,Z.maxTime=Math.max(Z.maxTime,Q),Z.minTime=Math.min(Z.minTime,Q);else this.metrics.set(J,{count:1,totalTime:Q,maxTime:Q,minTime:Q})}getStats(J){if(J){let Z=this.metrics.get(J);if(!Z)return{};let $=this.budgets.get(J);return{count:Z.count,avgTime:Z.totalTime/Z.count,totalTime:Z.totalTime,maxTime:Z.maxTime,minTime:Z.minTime,budget:$?.maxTime,budgetUtilization:$?Z.totalTime/Z.count/$.maxTime*100:void 0}}let Q={};for(let[Z,$]of this.metrics.entries()){let U=this.budgets.get(Z);Q[Z]={count:$.count,avgTime:$.totalTime/$.count,totalTime:$.totalTime,maxTime:$.maxTime,minTime:$.minTime,budget:U?.maxTime,budgetUtilization:U?$.totalTime/$.count/U.maxTime*100:void 0}}return Q}getViolations(J){if(J)return this.violations.filter((Q)=>Q.label===J);return[...this.violations]}getViolationStats(){let J={},Q=0,Z=0;for(let $ of this.violations)if(J[$.label]=(J[$.label]||0)+1,$.isWarning)Q++;else Z++;return{total:this.violations.length,byLabel:J,warnings:Q,errors:Z}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var $J=null;function WQ(){if(!$J)$J=new kJ;return $J}var gQ=new Proxy({},{get(J,Q){return WQ()[Q]}});var xJ=[];function SJ(J){let Q=new ZJ(J);return xJ.push(Q),Q}function mQ(){for(let J of xJ)J.clear()}function UJ(J,...Q){return`${Q.map((Z)=>String(Z??"")).join("\x00")}\x00${J.length}\x00${Bun.hash(J)}`}function hQ(J){let Q=[];for(let Z of new Set(J))try{Q.push({path:Z,mtimeMs:EJ.statSync(Z).mtimeMs})}catch{}return Q}function iQ(J){for(let Q of J)try{if(EJ.statSync(Q.path).mtimeMs!==Q.mtimeMs)return!1}catch{return!1}return!0}var O=null,WJ=!1,H=null,T="",A=!1,dJ=256,D=new Map,L=new Map,N=null,b=null;function y(J){return Bun.hash(J).toString(16).padStart(16,"0").slice(0,16)}function FJ(J,Q){if(D.has(J))D.delete(J);else if(D.size>=dJ)D.delete(D.keys().next().value);D.set(J,Q)}function VQ(J){let Q=y(J);if(L.has(Q))L.delete(Q);else if(L.size>=dJ)L.delete(L.keys().next().value);return L.set(Q,J),Q}function eQ(J){let Q=L.get(J);if(Q===void 0)return;return L.delete(J),L.set(J,Q),Q}async function XQ(J){if(!N)return null;try{let Q=Bun.file(z.join(N,`cw-${y(J)}.css`));if(!await Q.exists())return null;return await Q.text()}catch{return null}}async function jQ(J,Q){if(!N)return;try{if(!fs.existsSync(N))fs.mkdirSync(N,{recursive:!0});await Bun.write(z.join(N,`cw-${y(J)}.css`),Q)}catch{}}async function fJ(J){try{let Q=await import(J);if(Q&&Q.CSSGenerator)return{CSSGenerator:Q.CSSGenerator,config:Q.config,build:Q.build,defaultConfig:Q.defaultConfig,extractClasses:Q.extractClasses}}catch{}return null}var qQ=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],GQ=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function zQ(){let J=[],Q=process.cwd();while(Q!==z.dirname(Q)){for(let Z of["node_modules","pantry"])for(let $ of qQ)J.push(z.join(Q,Z,...$));Q=z.dirname(Q)}return J}function YQ(){let J=[],Q=process.env.HOME||process.env.USERPROFILE||"",Z=[Q&&z.join(Q,"Code","Tools","ts-css"),Q&&z.join(Q,"Code","Tools","crosswind"),Q&&z.join(Q,"repos","stacks-org","ts-css"),Q&&z.join(Q,"repos","stacks-org","crosswind"),z.join(process.cwd(),"..","ts-css"),z.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let $ of Z)J.push(z.join($,"packages","toolkit","dist","engine","index.js")),J.push(z.join($,"packages","toolkit","src","engine","index.ts"));if(Q)J.push(z.join(Q,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return J}async function pJ(){if(WJ)return O;WJ=!0;try{let J=async(U)=>{for(let F of U){if(!await Bun.file(F).exists())continue;let W=await fJ(F);if(W){if(!process.env.STACKS_DEV_QUIET)console.log(`${Y.green}[ts-css]${Y.reset} CSS engine loaded from ${z.dirname(z.dirname(F))}`);return W}}return null};if(process.env.CROSSWIND_SRC){let U=z.resolve(process.env.CROSSWIND_SRC),F=await J([U]);if(!F)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${U}`);return O=F,O}let Q=await J(zQ());if(Q)return O=Q,O;let Z=GQ;for(let U of Z){let F=await fJ(U);if(F){if(O=F,!process.env.STACKS_DEV_QUIET)console.log(`${Y.green}[ts-css]${Y.reset} CSS engine loaded`);return O}}let $=await J(YQ());if($)return O=$,O;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${Y.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${Y.reset}`),console.warn(`${Y.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${Y.reset}`),null}}function J0(){VJ.clear(),O=null,WJ=!1,H=null,T="",D.clear(),L.clear(),b=null}var CJ=!1;async function mJ(J){try{let Q=yJ({name:"css",cwd:J})?"css":yJ({name:"crosswind",cwd:J})?"crosswind":null;if(!Q)return null;if(Q==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!CJ)CJ=!0,console.warn(`${Y.yellow}[ts-css]${Y.reset} Reading the CSS config from a \`crosswind\` file. Rename it to \`css\` (e.g. config/css.ts) \u2014 the old name is deprecated.`);let{loadConfigWithResult:Z}=await import("bunfig"),$=await Z({name:Q,cwd:J,defaultConfig:{},checkEnv:!1,verbose:!1});if(!$?.path||!$.config||Object.keys($.config).length===0)return null;let U=z.relative(J,$.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${Y.green}[ts-css]${Y.reset} Loaded config from ${U||$.path}`);return $.config}catch(Q){if(Q instanceof Error&&Q.name==="ConfigNotFoundError")return null;return console.warn(`${Y.yellow}[ts-css]${Y.reset} Failed to load css config:`,Q instanceof Error?Q.message:Q),null}}async function wQ(J){let Q=null;try{let{loadStxConfig:Z}=await import("./chunk-sr1xxzye.js"),$=await Z(J);if($.css)if(typeof $.css==="string"){let U=z.isAbsolute($.css)?$.css:z.resolve(J,$.css);if(await Bun.file(U).exists()){let F=await import(U);Q=F.default||F,console.log(`${Y.green}[ts-css]${Y.reset} Loaded config from stx.config.ts \u2192 ${$.css}`)}}else{if(Q={...$.css,content:$.css.content||[],preflight:$.css.preflight??!0,minify:$.css.minify??!1},$.css.config){let U=z.isAbsolute($.css.config)?$.css.config:z.resolve(J,$.css.config);if(await Bun.file(U).exists()){let F=await import(U);Q={...F.default||F,...Q}}}console.log(`${Y.green}[ts-css]${Y.reset} Using inline CSS config from stx.config.ts`)}}catch{}return Q||await mJ(J)}function BQ(J){try{let Q=new WeakSet;return y(JSON.stringify(J??{},(Z,$)=>{if(typeof $==="function")return`[fn]${String($)}`;if(typeof $==="object"&&$!==null){if(Q.has($))return"[circular]";Q.add($)}return $})??"")}catch{return"unhashable"}}async function HQ(J){if(A)return T;A=!0;try{let Q=await pJ();if(!Q||!Q.build)return A=!1,"";if(!H)H=await mJ(J);if(!H)return A=!1,"";let Z=Q.defaultConfig?.theme||{},$=H.theme||{},U={...Q.defaultConfig,...H,theme:{...Z,...$,extend:{...Z.extend||{},...$.extend||{}}}},F=performance.now(),W=await Q.build(U),j=performance.now()-F;if(T=W.css,console.log(`${Y.cyan}[ts-css]${Y.reset} Built ${W.classes.size} classes in ${j.toFixed(1)}ms`),U.output){let V=z.isAbsolute(U.output)?U.output:z.join(J,U.output),X=z.dirname(V);if(!fs.existsSync(X))fs.mkdirSync(X,{recursive:!0});await Bun.write(V,W.css)}return A=!1,W.css}catch(Q){return console.error(`${Y.red}[ts-css]${Y.reset} Build error:`,Q),A=!1,T}}async function Q0(J){H=null,await HQ(J)}function $0(){return T}function OQ(J){let Q=new Set,Z=/class\s*=\s*["']([^"']+)["']/gi,$=Z.exec(J);while($!==null){for(let W of $[1].split(/\s+/))if(W.trim())Q.add(W.trim());$=Z.exec(J)}let U=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,F=U.exec(J);while(F!==null){let W=F[1].match(/'([^']+)'/g);if(W){for(let j of W)for(let V of j.slice(1,-1).split(/\s+/))if(V.trim())Q.add(V.trim())}F=U.exec(J)}return Q}var VJ=SJ(64);async function LQ(J,Q){let Z=VJ.get(UJ(J,Q,b));if(Z!==void 0)return Z;let $=await KQ(J,Q);if($)VJ.set(UJ(J,Q,b),$);return $}async function KQ(J,Q){try{let Z=await pJ();if(!Z)return"";let $=typeof Z.extractClasses==="function"?Z.extractClasses(J):OQ(J);if($.size===0)return"";let U=Q?z.resolve(Q):process.cwd();if(!N)N=uJ(U,"cache");let F=[...$].sort().join(" "),W=`${b||"default"}::${F}`,j=D.get(W);if(j!==void 0)return FJ(W,j),j;let V=await XQ(W);if(V!==null)return FJ(W,V),V;if(!H)H=await wQ(U),b=BQ(H);let X=Z.defaultConfig||Z.config,q=H||{},G=LJ(X,q),{safelist:w,includePreflight:K,minify:M,tokenCSS:hJ}=G,XJ=G.config,_=new Z.CSSGenerator(XJ);for(let B of w)_.generate(B);for(let B of $)_.generate(B);let I=_.toCSS(K,M),jJ=XJ.shortcuts||q.shortcuts||{};for(let[B,f]of Object.entries(jJ)){if(!$.has(B)&&!w.includes(B))continue;let C=f.split(/\s+/).filter(Boolean);for(let R of C)_.generate(R)}I=_.toCSS(K,M);let v=I.split(`
20
+ `),U.set(X,q)}return q(...j)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:W,context:Q.slice()});return W}clear(){this.pool.length=0,this.fnCache.clear()}}var CQ=new bJ;class kJ{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(J){this.enabled=J}isEnabled(){return this.enabled}setBudget(J,Q){this.budgets.set(J,{warnThreshold:0.8,action:"warn",...Q})}setBudgets(J){for(let[Q,Z]of Object.entries(J))this.setBudget(Q,Z)}removeBudget(J){this.budgets.delete(J)}getBudgets(){let J={};for(let[Q,Z]of this.budgets.entries())J[Q]=Z;return J}onViolation(J){this.violationHandlers.push(J)}offViolation(J){let Q=this.violationHandlers.indexOf(J);if(Q!==-1)this.violationHandlers.splice(Q,1)}time(J,Q){if(!this.enabled)return Q();let Z=performance.now(),$=Q(),U=performance.now()-Z;return this.recordTime(J,U),this.checkBudget(J,U),$}async timeAsync(J,Q){if(!this.enabled)return Q();let Z=performance.now(),$=await Q(),U=performance.now()-Z;return this.recordTime(J,U),this.checkBudget(J,U),$}checkBudget(J,Q){let Z=this.budgets.get(J);if(!Z)return;let $=Q/Z.maxTime*100,U=Z.warnThreshold!==void 0?Q>=Z.maxTime*Z.warnThreshold&&Q<Z.maxTime:!1,F=Q>=Z.maxTime;if(!U&&!F)return;let W={label:J,actualTime:Q,budgetTime:Z.maxTime,exceedancePercent:$,timestamp:new Date,isWarning:U};this.violations.push(W);while(this.violations.length>this.maxViolations)this.violations.shift();for(let V of this.violationHandlers)try{V(W)}catch{}let j=U?`[Performance Warning] "${J}" took ${Q.toFixed(2)}ms (${$.toFixed(1)}% of ${Z.maxTime}ms budget)`:`[Performance Budget Exceeded] "${J}" took ${Q.toFixed(2)}ms (exceeded ${Z.maxTime}ms budget by ${($-100).toFixed(1)}%)`;switch(Z.action){case"log":console.log(j);break;case"warn":console.warn(j);break;case"error":console.error(j);break;case"throw":if(F)throw Error(j);else console.warn(j);break}}recordTime(J,Q){let Z=this.metrics.get(J);if(Z)Z.count++,Z.totalTime+=Q,Z.maxTime=Math.max(Z.maxTime,Q),Z.minTime=Math.min(Z.minTime,Q);else this.metrics.set(J,{count:1,totalTime:Q,maxTime:Q,minTime:Q})}getStats(J){if(J){let Z=this.metrics.get(J);if(!Z)return{};let $=this.budgets.get(J);return{count:Z.count,avgTime:Z.totalTime/Z.count,totalTime:Z.totalTime,maxTime:Z.maxTime,minTime:Z.minTime,budget:$?.maxTime,budgetUtilization:$?Z.totalTime/Z.count/$.maxTime*100:void 0}}let Q={};for(let[Z,$]of this.metrics.entries()){let U=this.budgets.get(Z);Q[Z]={count:$.count,avgTime:$.totalTime/$.count,totalTime:$.totalTime,maxTime:$.maxTime,minTime:$.minTime,budget:U?.maxTime,budgetUtilization:U?$.totalTime/$.count/U.maxTime*100:void 0}}return Q}getViolations(J){if(J)return this.violations.filter((Q)=>Q.label===J);return[...this.violations]}getViolationStats(){let J={},Q=0,Z=0;for(let $ of this.violations)if(J[$.label]=(J[$.label]||0)+1,$.isWarning)Q++;else Z++;return{total:this.violations.length,byLabel:J,warnings:Q,errors:Z}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var $J=null;function WQ(){if(!$J)$J=new kJ;return $J}var gQ=new Proxy({},{get(J,Q){return WQ()[Q]}});var xJ=[];function SJ(J){let Q=new ZJ(J);return xJ.push(Q),Q}function mQ(){for(let J of xJ)J.clear()}function UJ(J,...Q){return`${Q.map((Z)=>String(Z??"")).join("\x00")}\x00${J.length}\x00${Bun.hash(J)}`}function hQ(J){let Q=[];for(let Z of new Set(J))try{Q.push({path:Z,mtimeMs:EJ.statSync(Z).mtimeMs})}catch{}return Q}function iQ(J){for(let Q of J)try{if(EJ.statSync(Q.path).mtimeMs!==Q.mtimeMs)return!1}catch{return!1}return!0}var O=null,WJ=!1,H=null,T="",A=!1,dJ=256,D=new Map,L=new Map,N=null,b=null;function y(J){return Bun.hash(J).toString(16).padStart(16,"0").slice(0,16)}function FJ(J,Q){if(D.has(J))D.delete(J);else if(D.size>=dJ)D.delete(D.keys().next().value);D.set(J,Q)}function VQ(J){let Q=y(J);if(L.has(Q))L.delete(Q);else if(L.size>=dJ)L.delete(L.keys().next().value);return L.set(Q,J),Q}function eQ(J){let Q=L.get(J);if(Q===void 0)return;return L.delete(J),L.set(J,Q),Q}async function XQ(J){if(!N)return null;try{let Q=Bun.file(z.join(N,`cw-${y(J)}.css`));if(!await Q.exists())return null;return await Q.text()}catch{return null}}async function jQ(J,Q){if(!N)return;try{if(!fs.existsSync(N))fs.mkdirSync(N,{recursive:!0});await Bun.write(z.join(N,`cw-${y(J)}.css`),Q)}catch{}}async function fJ(J){try{let Q=await import(J);if(Q&&Q.CSSGenerator)return{CSSGenerator:Q.CSSGenerator,config:Q.config,build:Q.build,defaultConfig:Q.defaultConfig,extractClasses:Q.extractClasses}}catch{}return null}var qQ=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],GQ=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function zQ(){let J=[],Q=process.cwd();while(Q!==z.dirname(Q)){for(let Z of["node_modules","pantry"])for(let $ of qQ)J.push(z.join(Q,Z,...$));Q=z.dirname(Q)}return J}function YQ(){let J=[],Q=process.env.HOME||process.env.USERPROFILE||"",Z=[Q&&z.join(Q,"Code","Tools","ts-css"),Q&&z.join(Q,"Code","Tools","crosswind"),Q&&z.join(Q,"repos","stacks-org","ts-css"),Q&&z.join(Q,"repos","stacks-org","crosswind"),z.join(process.cwd(),"..","ts-css"),z.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let $ of Z)J.push(z.join($,"packages","toolkit","dist","engine","index.js")),J.push(z.join($,"packages","toolkit","src","engine","index.ts"));if(Q)J.push(z.join(Q,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return J}async function pJ(){if(WJ)return O;WJ=!0;try{let J=async(U)=>{for(let F of U){if(!await Bun.file(F).exists())continue;let W=await fJ(F);if(W){if(!process.env.STACKS_DEV_QUIET)console.log(`${Y.green}[ts-css]${Y.reset} CSS engine loaded from ${z.dirname(z.dirname(F))}`);return W}}return null};if(process.env.CROSSWIND_SRC){let U=z.resolve(process.env.CROSSWIND_SRC),F=await J([U]);if(!F)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${U}`);return O=F,O}let Q=await J(zQ());if(Q)return O=Q,O;let Z=GQ;for(let U of Z){let F=await fJ(U);if(F){if(O=F,!process.env.STACKS_DEV_QUIET)console.log(`${Y.green}[ts-css]${Y.reset} CSS engine loaded`);return O}}let $=await J(YQ());if($)return O=$,O;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${Y.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${Y.reset}`),console.warn(`${Y.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${Y.reset}`),null}}function J0(){VJ.clear(),O=null,WJ=!1,H=null,T="",D.clear(),L.clear(),b=null}var CJ=!1;async function mJ(J){try{let Q=yJ({name:"css",cwd:J})?"css":yJ({name:"crosswind",cwd:J})?"crosswind":null;if(!Q)return null;if(Q==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!CJ)CJ=!0,console.warn(`${Y.yellow}[ts-css]${Y.reset} Reading the CSS config from a \`crosswind\` file. Rename it to \`css\` (e.g. config/css.ts) \u2014 the old name is deprecated.`);let{loadConfigWithResult:Z}=await import("bunfig"),$=await Z({name:Q,cwd:J,defaultConfig:{},checkEnv:!1,verbose:!1});if(!$?.path||!$.config||Object.keys($.config).length===0)return null;let U=z.relative(J,$.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${Y.green}[ts-css]${Y.reset} Loaded config from ${U||$.path}`);return $.config}catch(Q){if(Q instanceof Error&&Q.name==="ConfigNotFoundError")return null;return console.warn(`${Y.yellow}[ts-css]${Y.reset} Failed to load css config:`,Q instanceof Error?Q.message:Q),null}}async function wQ(J){let Q=null;try{let{loadStxConfig:Z}=await import("./chunk-f0331x6e.js"),$=await Z(J);if($.css)if(typeof $.css==="string"){let U=z.isAbsolute($.css)?$.css:z.resolve(J,$.css);if(await Bun.file(U).exists()){let F=await import(U);Q=F.default||F,console.log(`${Y.green}[ts-css]${Y.reset} Loaded config from stx.config.ts \u2192 ${$.css}`)}}else{if(Q={...$.css,content:$.css.content||[],preflight:$.css.preflight??!0,minify:$.css.minify??!1},$.css.config){let U=z.isAbsolute($.css.config)?$.css.config:z.resolve(J,$.css.config);if(await Bun.file(U).exists()){let F=await import(U);Q={...F.default||F,...Q}}}console.log(`${Y.green}[ts-css]${Y.reset} Using inline CSS config from stx.config.ts`)}}catch{}return Q||await mJ(J)}function BQ(J){try{let Q=new WeakSet;return y(JSON.stringify(J??{},(Z,$)=>{if(typeof $==="function")return`[fn]${String($)}`;if(typeof $==="object"&&$!==null){if(Q.has($))return"[circular]";Q.add($)}return $})??"")}catch{return"unhashable"}}async function HQ(J){if(A)return T;A=!0;try{let Q=await pJ();if(!Q||!Q.build)return A=!1,"";if(!H)H=await mJ(J);if(!H)return A=!1,"";let Z=Q.defaultConfig?.theme||{},$=H.theme||{},U={...Q.defaultConfig,...H,theme:{...Z,...$,extend:{...Z.extend||{},...$.extend||{}}}},F=performance.now(),W=await Q.build(U),j=performance.now()-F;if(T=W.css,console.log(`${Y.cyan}[ts-css]${Y.reset} Built ${W.classes.size} classes in ${j.toFixed(1)}ms`),U.output){let V=z.isAbsolute(U.output)?U.output:z.join(J,U.output),X=z.dirname(V);if(!fs.existsSync(X))fs.mkdirSync(X,{recursive:!0});await Bun.write(V,W.css)}return A=!1,W.css}catch(Q){return console.error(`${Y.red}[ts-css]${Y.reset} Build error:`,Q),A=!1,T}}async function Q0(J){H=null,await HQ(J)}function $0(){return T}function OQ(J){let Q=new Set,Z=/class\s*=\s*["']([^"']+)["']/gi,$=Z.exec(J);while($!==null){for(let W of $[1].split(/\s+/))if(W.trim())Q.add(W.trim());$=Z.exec(J)}let U=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,F=U.exec(J);while(F!==null){let W=F[1].match(/'([^']+)'/g);if(W){for(let j of W)for(let V of j.slice(1,-1).split(/\s+/))if(V.trim())Q.add(V.trim())}F=U.exec(J)}return Q}var VJ=SJ(64);async function LQ(J,Q){let Z=VJ.get(UJ(J,Q,b));if(Z!==void 0)return Z;let $=await KQ(J,Q);if($)VJ.set(UJ(J,Q,b),$);return $}async function KQ(J,Q){try{let Z=await pJ();if(!Z)return"";let $=typeof Z.extractClasses==="function"?Z.extractClasses(J):OQ(J);if($.size===0)return"";let U=Q?z.resolve(Q):process.cwd();if(!N)N=uJ(U,"cache");let F=[...$].sort().join(" "),W=`${b||"default"}::${F}`,j=D.get(W);if(j!==void 0)return FJ(W,j),j;let V=await XQ(W);if(V!==null)return FJ(W,V),V;if(!H)H=await wQ(U),b=BQ(H);let X=Z.defaultConfig||Z.config,q=H||{},G=LJ(X,q),{safelist:w,includePreflight:K,minify:M,tokenCSS:hJ}=G,XJ=G.config,_=new Z.CSSGenerator(XJ);for(let B of w)_.generate(B);for(let B of $)_.generate(B);let I=_.toCSS(K,M),jJ=XJ.shortcuts||q.shortcuts||{};for(let[B,f]of Object.entries(jJ)){if(!$.has(B)&&!w.includes(B))continue;let C=f.split(/\s+/).filter(Boolean);for(let R of C)_.generate(R)}I=_.toCSS(K,M);let v=I.split(`
21
21
  `);for(let[B,f]of Object.entries(jJ)){if(!$.has(B)&&!w.includes(B))continue;let C=f.split(/\s+/).filter(Boolean),R=[],g=[];for(let u of C){let qJ=u.startsWith("dark:"),GJ=`.${(qJ?u.slice(5):u).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let k=0;k<v.length;k++){let zJ=v[k].trim();if(zJ===`${GJ} {`||zJ.startsWith(`${GJ} {`)){let E=k,YJ="";while(E<v.length){if(YJ+=v[E],v[E].includes("}"))break;E++}let d=YJ.match(/\{([^}]+)\}/);if(d)if(qJ)g.push(d[1].trim());else R.push(d[1].trim());break}}}if(R.length)I+=`
22
22
  .${B} { ${R.join(" ")} }`;if(g.length)I+=`
23
23
  @media (prefers-color-scheme: dark) { .dark .${B} { ${g.join(" ")} } }`}return I=hJ+I,FJ(W,I),jQ(W,I),I}catch(Z){return console.warn("Failed to generate Css CSS:",Z),""}}async function Z0(J,Q,Z=!1,$=!1){let U=await LQ(J,Q);if(!U)return $?QJ(J):J;let F=Z?`<link data-css="generated" rel="stylesheet" href="/_stx/css.${VQ(U)}.css">`:`<style data-css="generated">
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Al as GJ}from"./chunk-avqacmvp.js";import{fm as $J,yr as HJ,zr as zJ}from"./chunk-zqd4nrqt.js";import{jt as KJ,kt as ZJ}from"./chunk-397rqs12.js";import{Bt as u,xt as WJ}from"./chunk-bcx36g1n.js";import{ou as c}from"./chunk-4ee1aaet.js";import X from"path";import O from"fs";function OJ(J){if(!J||typeof J!=="object")return!1;let K=J;return typeof K.message==="string"&&(K.name==="BuildMessage"||K.name==="ResolveMessage"||("position"in K))}function wJ(J){if(J&&typeof J==="object"&&Array.isArray(J.errors))return J.errors;return[J]}function b(J,K){let $=[];for(let W of wJ(J)){if(OJ(W)){let H=W.position||void 0;$.push({file:K||H?.file,line:H?.line,column:H?.column,message:W.message??"",lineText:H?.lineText});continue}$.push({file:K,message:W instanceof Error?W.message:String(W)})}return $}function s(J,K){return b(J,K).map(($)=>{let W=$.file?`${$.file}${$.line?`:${$.line}${$.column?`:${$.column}`:""}`:""}`:"",H=$.lineText?`
2
+ import{Al as GJ}from"./chunk-0n9ywg62.js";import{fm as $J,yr as HJ,zr as zJ}from"./chunk-c8xa2551.js";import{jt as KJ,kt as ZJ}from"./chunk-397rqs12.js";import{Bt as u,xt as WJ}from"./chunk-sytymfs3.js";import{ou as c}from"./chunk-4ee1aaet.js";import X from"path";import O from"fs";function OJ(J){if(!J||typeof J!=="object")return!1;let K=J;return typeof K.message==="string"&&(K.name==="BuildMessage"||K.name==="ResolveMessage"||("position"in K))}function wJ(J){if(J&&typeof J==="object"&&Array.isArray(J.errors))return J.errors;return[J]}function b(J,K){let $=[];for(let W of wJ(J)){if(OJ(W)){let H=W.position||void 0;$.push({file:K||H?.file,line:H?.line,column:H?.column,message:W.message??"",lineText:H?.lineText});continue}$.push({file:K,message:W instanceof Error?W.message:String(W)})}return $}function s(J,K){return b(J,K).map(($)=>{let W=$.file?`${$.file}${$.line?`:${$.line}${$.column?`:${$.column}`:""}`:""}`:"",H=$.lineText?`
3
3
  ${$.lineText.trim()}`:"";return W?`${W}: ${$.message}${H}`:`${$.message}${H}`}).join(`
4
4
  `)}var UJ=9;function P(J,K,$){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(X.basename(J))||GJ(J,K,$)}var QJ=1,YJ=new Map,f=600,LJ=100,g=new Map;async function TJ(J){let K=g.get(J)??0;if(K>0&&K<LJ){g.set(J,K+1);return}g.set(J,1);try{let $=(await O.promises.readdir(J)).filter((z)=>z.endsWith(".js"));if($.length<=f)return;let H=(await Promise.all($.map(async(z)=>{try{return{name:z,at:(await O.promises.stat(X.join(J,z))).mtimeMs}}catch{return null}}))).filter((z)=>z!==null);H.sort((z,Y)=>Y.at-z.at);for(let z of H.slice(f)){let Y=z.name.slice(0,-3);await O.promises.rm(X.join(J,`${Y}.js`),{force:!0}),await O.promises.rm(X.join(J,`${Y}.deps.json`),{force:!0})}I("pruned bundle cache to",f,"entries")}catch{}}function mJ(J){return YJ.get(J)??[]}function h(J,K){if(J)YJ.set(J,K)}function AJ(J=process.env){return J.STX_DEBUG==="true"||J.STX_DEBUG==="1"}function I(...J){if(AJ())console.log("[stx:bundler]",...J)}var n=[];function t(J,K,$){n.push({filePath:J||"<inline>",message:K,details:$})}function uJ(){return n.slice()}function hJ(){n.length=0}var p;function pJ(J){p=J}function r(){if(p)return p;try{let J=zJ.strict;return typeof J==="object"&&J!==null?J.bundlerFallback??"warn":"warn"}catch{return"warn"}}var a=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function cJ(J){let K=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,$;while(($=K.exec(J))!==null){let H=$[1];if(!a.some((Y)=>Y.test(H)))return I("detected user import:",H),!0}let W=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while(($=W.exec(J))!==null){let H=$[1];if(/\.css(?:\?.*)?$/.test(H))continue;if(!a.some((Y)=>Y.test(H)))return I("detected side-effect import:",H),!0}return!1}var D="stx-module:",CJ=/\.(?:[cm]?[jt]sx?|json)$/i;function MJ(J,K){return X.relative(J,K).split(X.sep).join("/")}function xJ(J,K){if(K.size===0)return J;return J.replace(/^([ \t]*import\s+(?:[^;"']*?\s+from\s+)?)(["'])([^"']+)\2/gm,($,W,H,z)=>{let Y=K.get(z);return Y&&!z.startsWith(D)?`${W}${H}${Y}${H}`:$})}function IJ(J,K){let $=0,W=(z)=>{let Y=`__stxMod${$++}`,j=JSON.stringify(z);return K.push(`var ${Y} = globalThis.__stxModules && globalThis.__stxModules[${j}];`,`if (${Y} === undefined) throw new Error("[stx] module " + ${JSON.stringify(j)} + " is not registered on this page (#1957)");`),Y},H=(z,Y)=>{for(let j of z.split(",")){let T=j.trim();if(!T)continue;let Q=T.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!Q)continue;let Z=Q[1].startsWith('"')?JSON.parse(Q[1]):Q[1],G=Q[2]??Z;K.push(`var ${G} = ${Y}[${JSON.stringify(Z)}];`)}};return J=J.replace(/^[ \t]*import\s+([^;"']*?)\s+from\s+["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(z,Y,j)=>{let T=j.slice(D.length),Q=W(T),Z=Y.trim(),G=Z.match(/^([\w$]+)\s*(?:,\s*|$)/);if(G&&!Z.startsWith("{")&&!Z.startsWith("*"))K.push(`var ${G[1]} = ${Q}.default;`),Z=Z.slice(G[0].length).trim();let q=Z.match(/^\*\s*as\s+([\w$]+)$/);if(q)K.push(`var ${q[1]} = ${Q};`);else if(Z.startsWith("{"))H(Z.replace(/^\{|\}$/g,""),Q);return""}),J=J.replace(/^[ \t]*import\s+["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(z,Y)=>{return W(Y.slice(D.length)),""}),J}function e(J){let K=[J,`${J}.ts`,`${J}.tsx`,`${J}.js`,`${J}.mjs`,`${J}.jsx`,X.join(J,"index.ts"),X.join(J,"index.tsx"),X.join(J,"index.js"),X.join(J,"index.mjs")];for(let $ of K)try{if(O.existsSync($)&&O.statSync($,{throwIfNoEntry:!1})?.isFile())return $}catch{}return}function NJ(J,K,$,W,H,z=new Map,Y){let j=(Q,Z,G)=>{if(P(Z,J,Y))return null;if(!H||Q!==$||!CJ.test(Z))return null;try{if(!O.statSync(Z,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}W.add(Z);let q=`${D}${MJ(process.cwd(),Z)}`;return z.set(G,q),{path:q,external:!0}},T=(Q,Z)=>{let G=Q===$?K:X.dirname(Q),q=X.resolve(G,Z);return e(q)??q};return{name:"stx-client-bundle",setup(Q){Q.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(Z)=>({path:Z.path,external:!0})),Q.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(Z)=>({path:Z.path,external:!0})),Q.onResolve({filter:/^\//},(Z)=>{let G=e(Z.path);if(G){let q=j(Z.importer,G,Z.path);if(q)return q;if(G!==$)W.add(G);return{path:G}}return{path:Z.path,external:!0}}),Q.onResolve({filter:/^\.\.?\//},(Z)=>{let G=T(Z.importer,Z.path),q=j(Z.importer,G,Z.path);if(q)return q;return W.add(G),{path:G}}),Q.onResolve({filter:/^[@~]\//},(Z)=>{let G=X.resolve(J,Z.path.slice(2)),q=[G,`${G}.ts`,`${G}.tsx`,`${G}.js`,`${G}.mjs`,`${G}.jsx`,X.join(G,"index.ts"),X.join(G,"index.tsx"),X.join(G,"index.js"),X.join(G,"index.mjs")];for(let A of q)if(O.existsSync(A)&&O.statSync(A,{throwIfNoEntry:!1})?.isFile()){let U=j(Z.importer,A,Z.path);if(U)return U;return I(`resolved ${Z.path[0]}/ import:`,Z.path,"\u2192",A),W.add(A),{path:A}}return console.warn(`[stx:bundler] could not resolve ${Z.path[0]}/ import:`,Z.path),{path:G}}),Q.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(Z)=>{if(!H||Z.importer!==$)return;let G=`${D}npm:${Z.path}`;return z.set(Z.path,G),{path:G,external:!0}}),Q.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(Z)=>{if(P(Z.path,J,Y))throw Error(`Server-only API source cannot be imported by a client script: ${Z.path}`);let G=X.extname(Z.path).toLowerCase(),q=G===".json"?"json":G===".tsx"?"tsx":G===".jsx"?"jsx":G===".ts"||G===".mts"||G===".cts"?"ts":"js";if(Z.path!==$)W.add(Z.path);return{contents:O.readFileSync(Z.path,"utf8"),loader:q}})}}}var m=new Map,F=WJ(64),JJ=Symbol.for("stx.client-bundle-build-queue");function _J(J){let K=globalThis,W=(K[JJ]??Promise.resolve()).then(J,J);return K[JJ]=W.then(()=>{return},()=>{return}),W}async function nJ(J,K,$={}){let W=$.projectRoot||process.cwd(),H=(await HJ(W)).serverApi,z=$.minify??!1,Y=$.externalizeUserModules??!0,j=$.cacheDir||c(W,"bundle-cache"),T=new Bun.CryptoHasher("md5");T.update(`${UJ}\x00${JSON.stringify(H??!1)}\x00${Y?"registry":"inline"}\x00${J}\x00${K}`);let Q=T.digest("hex").slice(0,12),Z=X.join(j,`${Q}.js`),G=F.get(Z);if(G){if(u(G.files)&&G.files.every((C)=>!P(C.path,W,H))){I("memo hit:",Q);let C=G.files.map((w)=>w.path);return h(K,C),$.collectInputs?.push(...C),G.code}F.delete(Z),I("memo invalidated by dep change:",Q)}let q=X.join(j,`${Q}.deps.json`),A=Bun.file(Z);if(await A.exists()){let C=Bun.file(q),w=!1,M=null;if(await C.exists())try{let _=JSON.parse(await C.text());if(_.metadataVersion!==QJ||!Array.isArray(_.files))w=!1;else M=_.files,w=!0;if(M&&(!u(M)||M.some((S)=>P(S.path,W,H))))w=!1}catch{w=!1}if(w){if(I("cache hit:",Q),M)h(K,M.map((S)=>S.path)),$.collectInputs?.push(...M.map((S)=>S.path));let _=await A.text();if(M)F.set(Z,{code:_,files:M});return _}I("cache invalidated by dep change:",Q)}let U=m.get(Q);if(U){let C=await U;if($.collectInputs)$.collectInputs.push(...(F.get(Z)?.files??[]).map((w)=>w.path));return C}let v=_J(()=>SJ(J,K,{projectRoot:W,minify:z,cacheDir:j,hash:Q,cachePath:Z,depsPath:q,collectInputs:$.collectInputs,externalizeUserModules:Y,serverApi:H}));m.set(Q,v);try{return await v}finally{m.delete(Q)}}async function SJ(J,K,$){let{projectRoot:W,minify:H,cacheDir:z,hash:Y,cachePath:j,depsPath:T,externalizeUserModules:Q}=$,Z=c(W,"bundle-tmp"),G=X.join(Z,`${Y}.ts`),q=X.join(Z,"out",Y);O.mkdirSync(Z,{recursive:!0}),O.mkdirSync(q,{recursive:!0});let A=X.dirname(K),U=new Set,v=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,C=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,w=KJ(J),{depths:M,balanced:_}=ZJ(w),S=(L)=>!_||M[L]===0,x;while((x=v.exec(w))!==null){if(x[1])continue;if(!S(x.index))continue;if(x[2])x[2].split(",").forEach((L)=>{let k=BJ(L);if(k)U.add(k)});else if(x[3])U.add(x[3])}while((x=C.exec(w))!==null){if(x[1])continue;if(!S(x.index))continue;U.add(x[2])}let XJ=U.size>0?`
5
5
  export { ${[...U].join(", ")} }`:"";await Bun.write(G,J+XJ),I("bundling:",Y,"from:",X.basename(K));let o=new Set,l=new Map;try{let L=await Bun.build({entrypoints:[G],outdir:q,target:"browser",format:"esm",minify:H,plugins:[NJ(W,A,G,o,Q,l,$.serverApi)],define:{"process.env.NODE_ENV":H?'"production"':'"development"',...$J()},root:W});if(!L.success){let B=L.logs.filter((y)=>y.level==="error").map((y)=>y.message).join(", ")||`Unable to bundle ${X.basename(K)}`,R=b(L.logs,K||void 0);if(console.warn("[stx:bundler] build failed:",B),t(K||"",B,R),r()==="error")throw Error(B);return J}let k="";for(let V of L.outputs){k=await V.text();break}let N=[];for(let V of k.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let B of V[1].split(",")){let R=B.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(R){N.push([R[2],R[1]]);continue}let y=B.trim();if(/^[A-Za-z_$][\w$]*$/.test(y))N.push([y,y])}let d=[];k=IJ(xJ(k,l),d);let qJ=k.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];k=k.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let i=`__stxBundle_${Y}`,VJ=N.map(([V,B])=>`${JSON.stringify(V)}: ${B}`).join(", "),kJ=N.map(([V])=>`var ${V} = undefined;`).join(`
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Pi as a,Qi as b}from"./chunk-pgqdhg7n.js";import"./chunk-xwxdwqn9.js";import"./chunk-ta1p5yab.js";import"./chunk-0n9ywg62.js";import"./chunk-c8xa2551.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-sytymfs3.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-36dt9a5b.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-h22zwr5c.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{a as getStoreScript,b as clearStoreCache};