@stacksjs/stx 0.2.897 → 0.2.898

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 (80) hide show
  1. package/dist/{chunk-3xkrnf5m.js → chunk-051r7ebx.js} +2 -2
  2. package/dist/chunk-0hgetg3j.js +2 -0
  3. package/dist/{chunk-d6ghx785.js → chunk-0vrt55pp.js} +6 -6
  4. package/dist/{chunk-jc3zrmpz.js → chunk-0yh33smh.js} +1 -1
  5. package/dist/chunk-0yycygry.js +2 -0
  6. package/dist/{chunk-h0stypkf.js → chunk-2s0q8mjx.js} +1 -1
  7. package/dist/{chunk-ry7nh392.js → chunk-2shw0j2q.js} +1 -1
  8. package/dist/{chunk-a27xsdp6.js → chunk-3hd73qqj.js} +1 -1
  9. package/dist/{chunk-j1npj5xc.js → chunk-3jxmnnef.js} +1 -1
  10. package/dist/{chunk-6g5z6r27.js → chunk-4wh71ddp.js} +1 -1
  11. package/dist/{chunk-qnz406aa.js → chunk-5v4e2a02.js} +1 -1
  12. package/dist/{chunk-s557tht3.js → chunk-5xq6eky7.js} +4 -4
  13. package/dist/{chunk-8jb5fsnf.js → chunk-66qfr6b0.js} +1 -1
  14. package/dist/{chunk-xqb0rzk1.js → chunk-6kn2vwtn.js} +1 -1
  15. package/dist/{chunk-yfqrwazc.js → chunk-7h52e87j.js} +2 -2
  16. package/dist/{chunk-d2whsv81.js → chunk-8cs8jckk.js} +1 -1
  17. package/dist/{chunk-w6r18he3.js → chunk-a0jhmkpd.js} +1 -1
  18. package/dist/chunk-a1s0tfcd.js +3 -0
  19. package/dist/{chunk-5y4q7k3j.js → chunk-a2bstyq1.js} +1 -1
  20. package/dist/{chunk-txegy370.js → chunk-b9npgke0.js} +6 -6
  21. package/dist/{chunk-at8dv8dn.js → chunk-bh2j50cy.js} +1 -1
  22. package/dist/{chunk-x89k2af8.js → chunk-bj8pv8m9.js} +5 -5
  23. package/dist/{chunk-mjj36awr.js → chunk-bjmkyead.js} +4 -4
  24. package/dist/chunk-cgxmgjk4.js +2 -0
  25. package/dist/{chunk-dtpxzcrw.js → chunk-dd074gp5.js} +3 -3
  26. package/dist/{chunk-b8zrn7k4.js → chunk-ezpk14gs.js} +1 -1
  27. package/dist/{chunk-n5ypn9nh.js → chunk-fsehzmg8.js} +1 -1
  28. package/dist/chunk-g0p2n9tm.js +2 -0
  29. package/dist/{chunk-pyqacq37.js → chunk-g5axctr0.js} +1 -1
  30. package/dist/{chunk-jdpzwv1t.js → chunk-g8p4sjy4.js} +2 -2
  31. package/dist/chunk-ggnhr4r3.js +2 -0
  32. package/dist/{chunk-sezkn93y.js → chunk-hmpmvf5c.js} +1 -1
  33. package/dist/{chunk-2bnsxgfe.js → chunk-htvft92j.js} +1 -1
  34. package/dist/{chunk-gm48z1nk.js → chunk-j1cgj6z2.js} +1 -1
  35. package/dist/{chunk-7wj6yx6f.js → chunk-j1ncsbk2.js} +1 -1
  36. package/dist/{chunk-hj98d829.js → chunk-jm9rbxj4.js} +1 -1
  37. package/dist/{chunk-bzpxjvcq.js → chunk-jnwj14eq.js} +1 -1
  38. package/dist/{chunk-dr6fqa3x.js → chunk-jvc2qb1n.js} +1 -1
  39. package/dist/{chunk-gz7egees.js → chunk-jytqf6p6.js} +1 -1
  40. package/dist/{chunk-gdyjd163.js → chunk-mr34w48c.js} +4 -4
  41. package/dist/{chunk-sw0gme6q.js → chunk-mx5twaps.js} +1 -1
  42. package/dist/{chunk-18dv485d.js → chunk-n0jfwsz1.js} +1 -1
  43. package/dist/{chunk-at843zxh.js → chunk-nd2bhjdw.js} +1 -1
  44. package/dist/{chunk-2g7cs1n8.js → chunk-ns2d6pb9.js} +1 -1
  45. package/dist/{chunk-dt80hbq8.js → chunk-nw2zjwcg.js} +2 -2
  46. package/dist/{chunk-3fnb12nh.js → chunk-q4dcchrt.js} +1 -1
  47. package/dist/{chunk-5qv5v8kc.js → chunk-qcbj1m21.js} +2 -2
  48. package/dist/{chunk-rc12m1j7.js → chunk-qfxy34d4.js} +1 -1
  49. package/dist/{chunk-wkk0gska.js → chunk-qwt94yh2.js} +1 -1
  50. package/dist/chunk-rarsjcs4.js +2 -0
  51. package/dist/{chunk-4azhfxrm.js → chunk-rryzw9x7.js} +1 -1
  52. package/dist/chunk-ryj1srqn.js +2 -0
  53. package/dist/{chunk-4s2x5p6r.js → chunk-s5j4fpdr.js} +1 -1
  54. package/dist/{chunk-6xaeq730.js → chunk-s94gqce0.js} +1 -1
  55. package/dist/{chunk-tkjjyh6k.js → chunk-taeqm3nc.js} +1 -1
  56. package/dist/chunk-tsz03zc9.js +2 -0
  57. package/dist/{chunk-jxydtkdw.js → chunk-v8ewgs1y.js} +1 -1
  58. package/dist/{chunk-2hpkr84c.js → chunk-w2qct5kq.js} +1 -1
  59. package/dist/{chunk-87tmvvvp.js → chunk-wbp6jgcr.js} +1 -1
  60. package/dist/{chunk-xfjezd96.js → chunk-x8yne6s5.js} +1 -1
  61. package/dist/{chunk-9d578fvc.js → chunk-xdrp6d7e.js} +2 -2
  62. package/dist/{chunk-vx1s055y.js → chunk-ykax1thr.js} +1 -1
  63. package/dist/{chunk-ffkhg23t.js → chunk-zrbyvyn2.js} +1 -1
  64. package/dist/{chunk-bgggjcwt.js → chunk-zy97etqx.js} +1 -1
  65. package/dist/cli.js +7 -7
  66. package/dist/craft-entry.js +1 -1
  67. package/dist/craft.js +1 -1
  68. package/dist/offline/app-service-worker.js +2 -2
  69. package/dist/pwa.js +1 -1
  70. package/dist/ssg.js +2 -2
  71. package/package.json +5 -5
  72. package/dist/chunk-02qhay07.js +0 -2
  73. package/dist/chunk-04x7mp45.js +0 -2
  74. package/dist/chunk-awb046ct.js +0 -2
  75. package/dist/chunk-b5njp1ef.js +0 -2
  76. package/dist/chunk-cjxfc5j5.js +0 -2
  77. package/dist/chunk-jk6yg125.js +0 -2
  78. package/dist/chunk-sccjcyb9.js +0 -2
  79. package/dist/chunk-wg2n94gf.js +0 -3
  80. package/dist/chunk-zn5dcfhc.js +0 -2
@@ -1,13 +1,13 @@
1
1
  // @bun
2
2
  import{Z}from"./chunk-n6q1d66k.js";import R from"path";var B=/__stxModules\["((?:[^"\\]|\\.)*)"\]/g;function es(...d){let g=new Set;for(let l of d){if(!l||!l.includes("__stxModules["))continue;for(let e of l.matchAll(B))try{g.add(JSON.parse(`"${e[1]}"`))}catch{}}return[...g].sort()}function Co(...d){let g=new Map,l=(e,n)=>{let o=g.get(e);if(o===null)return;if(n===null){g.set(e,null);return}let s=o??new Set;for(let i of n)s.add(i);g.set(e,s)};for(let e of d){if(!e||!e.includes("__stxModules["))continue;let n=[];for(let s of e.matchAll(/([\w$]+)\s*=\s*globalThis\.__stxModules\s*&&\s*globalThis\.__stxModules\["((?:[^"\\]|\\.)*)"\]/g)){let i;try{i=JSON.parse(`"${s[2]}"`)}catch{continue}n.push({variable:s[1],id:i,start:s.index+s[0].length,end:e.length})}let o=e.match(/__stxModules\["(?:[^"\\]|\\.)*"\]/g)?.length??0;if(n.length===0||o!==n.length){for(let s of es(e))l(s,null);continue}for(let[s,i]of n.entries()){let p=n.slice(s+1).find((h)=>h.variable===i.variable);i.end=p?p.start:e.length}for(let s of n){let i=new Set,p=!1,h=s.variable.replace(/[$]/g,"\\$&"),r=e.slice(s.start,s.end);for(let a of r.matchAll(new RegExp(`(?<![\\w$.])${h}(?![\\w$])`,"g"))){let f=r.slice(a.index+s.variable.length,a.index+s.variable.length+200),c=/^\s*\[\s*(["'])([A-Za-z_$][\w$]*)\1\s*\]/.exec(f)??/^\s*\.\s*([A-Za-z_$][\w$]*)/.exec(f);if(c){i.add(c[c.length-1]);continue}if(/^\s*[!=]==?\s*(?:undefined|void 0)\b/.test(f))continue;p=!0;break}l(s.id,p?null:i)}}return g}function k(d,g,l){let e=[],n=[];return d.forEach((o,s)=>{let i=o.startsWith("npm:")?o.slice(4):R.resolve(g,o),p=`__stxRegistered${s}`,h=JSON.stringify(o),r=l?.get(o);if(r&&[...r].every((a)=>/^[A-Za-z_$][\w$]*$/.test(a))){let a=[...r].sort(),f=a.map((m,_)=>`${m} as ${p}_${_}`);e.push(a.length>0?`import { ${f.join(", ")} } from ${JSON.stringify(i)};`:`import ${JSON.stringify(i)};`);let c=a.map((m,_)=>`get ${JSON.stringify(m)}() { return ${p}_${_}; }`).join(", ");n.push(`if (!globalThis.__stxModules[${h}]) globalThis.__stxModules[${h}] = { ${c} };`);return}e.push(`import * as ${p} from ${JSON.stringify(i)};`),n.push(`if (!globalThis.__stxModules[${h}]) globalThis.__stxModules[${h}] = ${p};`)}),[...e,"globalThis.__stxModules = globalThis.__stxModules || {};",...n].join(`
3
- `)}async function hm(d,g={}){if(d.length===0)return null;let l=process.cwd(),e=k(d,l,g.names),n;try{let{bundleClientScript:f}=await import("./chunk-gz7egees.js"),c=()=>f(e,R.join(l,".stx-module-registry.ts"),{projectRoot:l,minify:g.minify,externalizeUserModules:!1,collectInputs:g.collectInputs,throwOnFailure:!0});try{n=await c()}catch(m){if(!g.names)throw m;e=k(d,l,void 0),n=await c()}}catch(f){let{formatBuildFailure:c}=await import("./chunk-j9kejcrx.js"),m=c(f);console.warn(`[stx] could not build the page module registry (#1957): ${m}`);let _=`[stx] the page module registry did not build, so ${d.join(", ")} cannot load (#1957): ${m}`;return`;console.error(${JSON.stringify(_)});`}let{transformAutoImports:o,generateAutoImportDestructuring:s}=await import("./chunk-w6r18he3.js"),i=o(n),p=s(i.stxImports,i.browserImports),{transformStoreImports:h}=await import("./chunk-80xzjxah.js");n=h(i.code);let r=JSON.stringify(new Bun.CryptoHasher("md5").update(e).digest("hex").slice(0,12)),a=Z(n);return[a?";await (async function() {":";(function() {"," var __stxBundles = globalThis.__stxModuleBundles || (globalThis.__stxModuleBundles = {});",` if (__stxBundles[${r}]) { ${a?"await __stxBundles["+r+"];":""} return; }`,a?`var __resolveBundle, __rejectBundle;
3
+ `)}async function hm(d,g={}){if(d.length===0)return null;let l=process.cwd(),e=k(d,l,g.names),n;try{let{bundleClientScript:f}=await import("./chunk-jytqf6p6.js"),c=()=>f(e,R.join(l,".stx-module-registry.ts"),{projectRoot:l,minify:g.minify,externalizeUserModules:!1,collectInputs:g.collectInputs,throwOnFailure:!0});try{n=await c()}catch(m){if(!g.names)throw m;e=k(d,l,void 0),n=await c()}}catch(f){let{formatBuildFailure:c}=await import("./chunk-j9kejcrx.js"),m=c(f);console.warn(`[stx] could not build the page module registry (#1957): ${m}`);let _=`[stx] the page module registry did not build, so ${d.join(", ")} cannot load (#1957): ${m}`;return`;console.error(${JSON.stringify(_)});`}let{transformAutoImports:o,generateAutoImportDestructuring:s}=await import("./chunk-a0jhmkpd.js"),i=o(n),p=s(i.stxImports,i.browserImports),{transformStoreImports:h}=await import("./chunk-80xzjxah.js");n=h(i.code);let r=JSON.stringify(new Bun.CryptoHasher("md5").update(e).digest("hex").slice(0,12)),a=Z(n);return[a?";await (async function() {":";(function() {"," var __stxBundles = globalThis.__stxModuleBundles || (globalThis.__stxModuleBundles = {});",` if (__stxBundles[${r}]) { ${a?"await __stxBundles["+r+"];":""} return; }`,a?`var __resolveBundle, __rejectBundle;
4
4
  __stxBundles[${r}]=new Promise(function(resolve,reject){__resolveBundle=resolve;__rejectBundle=reject;});
5
5
  __stxBundles[${r}].catch(function(){});
6
6
  try {`:`__stxBundles[${r}] = true;`,p,n,a?`__resolveBundle();
7
7
  } catch(error) { delete __stxBundles[${r}]; __rejectBundle(error); throw error; }`:"","})();"].join(`
8
8
  `)}var j=/^import(?:[ \t]*(\{[^}]*\})[ \t]*from|[ \t]*\*[ \t]*as[ \t]+([\w$]+)[ \t]+from)?[ \t]*["']\.\/(chunk-[\w-]+)\.js["'][ \t]*;?[ \t]*$/gm,O=/^export\s*\{([^}]*)\}\s*;?[ \t]*$/gm,I=new Set(["__preload","__chunks"]),N=/^("[^"]*"|[\w$]+)(?:\s+as\s+("[^"]*"|[\w$]+))?$/;function P(d){let g=[],l=[],e=!0,o=d.replace(/^var __chunkGraphs;[\s\S]*?^var __chunks = [\s\S]*?^\};[ \t]*\n?/m,"").replace(/^__chunks\(import\.meta\.url,[^\n]*\);[ \t]*\n?/gm,"").replace(j,(h,r,a,f)=>{let c=`__stxChunkExports${g.length}`;if(g.push(f),l.push(`var ${c} = __stxChunk(${JSON.stringify(f)});`),a)l.push(`var ${a} = ${c};`);else if(r)for(let m of r.slice(1,-1).split(",")){let _=m.trim();if(!_)continue;let w=N.exec(_);if(!w){e=!1;continue}if(I.has(w[1]))continue;let M=w[1].startsWith('"')?JSON.parse(w[1]):w[1],t=w[2]??w[1];if(t.startsWith('"')){e=!1;continue}l.push(`var ${t} = ${c}[${JSON.stringify(M)}];`)}return""});if(!e)throw Error("an import it does not read");let s=[];o=o.replace(/\(\s*__preload\([^)]*\)\s*,\s*import\(\s*["']\.\/(chunk-[\w-]+)\.js["']\s*\)\s*\)|\bimport\(\s*["']\.\/(chunk-[\w-]+)\.js["']\s*\)/g,(h,r,a)=>{let f=r??a;return s.push(f),`Promise.resolve().then(function () { return __stxChunk(${JSON.stringify(f)}); })`});let i=[];o=o.replace(O,(h,r)=>{for(let a of r.split(",")){let f=a.trim();if(!f)continue;let c=N.exec(f);if(!c||c[1].startsWith('"')){e=!1;continue}if(I.has(c[1]))continue;let m=c[2]??c[1];i.push([c[1],m.startsWith('"')?JSON.parse(m):m])}return""});let p=[/\bimport\.meta\b/,/\b__chunks\b/,/\b__preload\b/,/^\s*export\s+(?:default\b|const\b|let\b|var\b|function\b|class\b|async\b|\*|\{)/m,/\bfrom\s*["']\.\/chunk-/,/^\s*import\s*["']\.\/chunk-/m].find((h)=>h.test(o));if(!e||p)throw Error(`${p?`${p.source} is left in it`:"an export it does not read"}`);return{reads:l.join(`
9
9
  `),chunks:g,lazy:s,body:o,exports:i}}function eu(d){if(/\bexport\s+(?:let|var)\b/.test(d))return!0;if(d.length/Math.max(1,d.split(`
10
- `).length)>200)return!1;for(let g of d.matchAll(/\bexport\s*\{([^}]*)\}(?!\s*from\b)/g))for(let l of g[1].split(",")){let e=l.trim().split(/\s+as\s+/)[0].trim();if(!/^[A-Za-z_$][\w$]*$/.test(e))continue;let n=e.replace(/[$]/g,"\\$&");if(!new RegExp(`(?<![\\w$.])(?:let|var)\\s+${n}(?![\\w$])`,"g").test(d))continue;let s=new RegExp(`(?<![\\w$.])${n}\\s*(?:=(?![=>])|[-+*/%&|^]=|\\*\\*=|<<=|>>>?=|&&=|\\|\\|=|\\?\\?=|\\+\\+|--)|(?:\\+\\+|--)\\s*${n}(?![\\w$])`,"g"),i=new RegExp(`(?<![\\w$.])(?:let|var|const)\\s+${n}\\s*=`,"g");if((d.match(s)?.length??0)>(d.match(i)?.length??0))return!0}return!1}async function Eo(d,g={}){let l=d.filter((n)=>n.ids.length>0);if(l.length===0)return{chunks:new Map,routes:new Map,reads:new Map};let e=process.cwd();try{let{bundleClientEntriesSplit:n}=await import("./chunk-gz7egees.js"),o=[],s=await n(new Map(l.map((t)=>[t.name,k(t.ids,e,t.names)])),{projectRoot:e,filePath:R.join(e,".stx-module-registry.ts"),collectInputs:o});g.collectInputs?.push(...o);let{transformAutoImports:i,generateAutoImportDestructuring:p}=await import("./chunk-w6r18he3.js"),{transformStoreImports:h}=await import("./chunk-80xzjxah.js"),r=new Map;for(let[t,u]of[...s.chunks,...s.entries])try{r.set(t,P(u))}catch(x){throw Error(`cannot read ${t}: ${x instanceof Error?x.message:String(x)}`)}for(let[t,u]of[...s.chunks,...s.entries])if(/\b__esm\(/.test(u))throw Error(`${t} initialises a module lazily`);for(let t of o)if(/\.(?:[cm]?[jt]sx?)$/.test(t)&&eu(await Bun.file(t).text()))throw Error(`${t} exports a binding that changes after it is read`);let a=new Set,f=new Set,c=(t)=>{if(f.has(t))return;if(a.has(t))throw Error(`the chunks import each other (${t})`);a.add(t);for(let u of r.get(t)?.chunks??[]){if(!r.has(u))throw Error(`${t} imports ${u}, which was not built`);c(u)}for(let u of r.get(t)?.lazy??[])if(!r.has(u))throw Error(`${t} imports ${u}, which was not built`);a.delete(t),f.add(t)};for(let t of r.keys())c(t);let m=(t)=>{let u=i(t.body);return{prelude:p(u.stxImports,u.browserImports),body:h(u.code)}},_=new Map;for(let t of s.chunks.keys()){let u=r.get(t),{prelude:x,body:v}=m(u),b=u.exports.map(([S,y])=>`get ${JSON.stringify(y)}() { return ${S}; }`).join(", ");_.set(t,`function (__stxChunk) {
10
+ `).length)>200)return!1;for(let g of d.matchAll(/\bexport\s*\{([^}]*)\}(?!\s*from\b)/g))for(let l of g[1].split(",")){let e=l.trim().split(/\s+as\s+/)[0].trim();if(!/^[A-Za-z_$][\w$]*$/.test(e))continue;let n=e.replace(/[$]/g,"\\$&");if(!new RegExp(`(?<![\\w$.])(?:let|var)\\s+${n}(?![\\w$])`,"g").test(d))continue;let s=new RegExp(`(?<![\\w$.])${n}\\s*(?:=(?![=>])|[-+*/%&|^]=|\\*\\*=|<<=|>>>?=|&&=|\\|\\|=|\\?\\?=|\\+\\+|--)|(?:\\+\\+|--)\\s*${n}(?![\\w$])`,"g"),i=new RegExp(`(?<![\\w$.])(?:let|var|const)\\s+${n}\\s*=`,"g");if((d.match(s)?.length??0)>(d.match(i)?.length??0))return!0}return!1}async function Eo(d,g={}){let l=d.filter((n)=>n.ids.length>0);if(l.length===0)return{chunks:new Map,routes:new Map,reads:new Map};let e=process.cwd();try{let{bundleClientEntriesSplit:n}=await import("./chunk-jytqf6p6.js"),o=[],s=await n(new Map(l.map((t)=>[t.name,k(t.ids,e,t.names)])),{projectRoot:e,filePath:R.join(e,".stx-module-registry.ts"),collectInputs:o});g.collectInputs?.push(...o);let{transformAutoImports:i,generateAutoImportDestructuring:p}=await import("./chunk-a0jhmkpd.js"),{transformStoreImports:h}=await import("./chunk-80xzjxah.js"),r=new Map;for(let[t,u]of[...s.chunks,...s.entries])try{r.set(t,P(u))}catch(x){throw Error(`cannot read ${t}: ${x instanceof Error?x.message:String(x)}`)}for(let[t,u]of[...s.chunks,...s.entries])if(/\b__esm\(/.test(u))throw Error(`${t} initialises a module lazily`);for(let t of o)if(/\.(?:[cm]?[jt]sx?)$/.test(t)&&eu(await Bun.file(t).text()))throw Error(`${t} exports a binding that changes after it is read`);let a=new Set,f=new Set,c=(t)=>{if(f.has(t))return;if(a.has(t))throw Error(`the chunks import each other (${t})`);a.add(t);for(let u of r.get(t)?.chunks??[]){if(!r.has(u))throw Error(`${t} imports ${u}, which was not built`);c(u)}for(let u of r.get(t)?.lazy??[])if(!r.has(u))throw Error(`${t} imports ${u}, which was not built`);a.delete(t),f.add(t)};for(let t of r.keys())c(t);let m=(t)=>{let u=i(t.body);return{prelude:p(u.stxImports,u.browserImports),body:h(u.code)}},_=new Map;for(let t of s.chunks.keys()){let u=r.get(t),{prelude:x,body:v}=m(u),b=u.exports.map(([S,y])=>`get ${JSON.stringify(y)}() { return ${S}; }`).join(", ");_.set(t,`function (__stxChunk) {
11
11
  ${x}
12
12
  ${u.reads}
13
13
  ${v}
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{km}from"./chunk-v8ewgs1y.js";import"./chunk-b9npgke0.js";import"./chunk-nw2zjwcg.js";import"./chunk-5xq6eky7.js";import"./chunk-05x1rd86.js";import"./chunk-6kn2vwtn.js";import"./chunk-a1s0tfcd.js";import"./chunk-ns2d6pb9.js";import"./chunk-80ky40mm.js";import"./chunk-g8p4sjy4.js";import"./chunk-mr34w48c.js";import"./chunk-9rjgq8k4.js";import"./chunk-s94gqce0.js";import"./chunk-n6q1d66k.js";import"./chunk-qcbj1m21.js";import"./chunk-zy97etqx.js";import"./chunk-q0y8gv18.js";import"./chunk-rb2zbdqd.js";import"./chunk-t3zmfh8w.js";import"./chunk-qe0t0m38.js";import"./chunk-0vrt55pp.js";import"./chunk-4wh71ddp.js";import"./chunk-41z7f41b.js";import"./chunk-xmg6bmh6.js";import"./chunk-vk2jy6mn.js";import"./chunk-3b3mkgpj.js";import"./chunk-0jdz31q1.js";import"./chunk-cphc60zw.js";export{km as startInteractive};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Ze,Mn,uo,Ki,z}from"./chunk-41z7f41b.js";import{Nn}from"./chunk-6g5z6r27.js";import{Jr,C,Bl,xt,ta,Fl}from"./chunk-cphc60zw.js";import{D}from"./chunk-vk2jy6mn.js";import{T,R}from"./chunk-0jdz31q1.js";import{Xr,bo,Fn,Dl,Le}from"./chunk-3b3mkgpj.js";import{po,d,m,zr,p,te,K,be,_,bt,ho,De,et,yo}from"./chunk-xmg6bmh6.js";import{w}from"./chunk-v6gkjg5f.js";import{ne}from"./chunk-a0aqs5a8.js";import{t,h}from"./chunk-neg6ckjg.js";import{c}from"./chunk-hxws025y.js";import Ct from"path";import un from"process";import{AsyncLocalStorage as sc}from"async_hooks";var ni=new sc;function Rn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function si(e,n){return ni.run(Rn(e),n)}async function ri(e,n){let r=ni.getStore();if(!r)throw Error("useServerData must run inside a <script server> render");if(typeof e!=="string"||!e.trim())throw TypeError("useServerData requires a non-empty string key");let i=r.pending.get(e);if(i)return i;let a=Promise.resolve().then(n).then((l)=>{let u=JSON.stringify(l,(v,S)=>{if(S===void 0||typeof S==="function"||typeof S==="symbol"||typeof S==="bigint"||typeof S==="number"&&!Number.isFinite(S))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(S&&typeof S==="object"&&!Array.isArray(S)&&Object.getPrototypeOf(S)!==Object.prototype&&Object.getPrototypeOf(S)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return S}),f=JSON.parse(u);return r.values.set(e,f),f}).catch((l)=>{throw r.pending.delete(e),l});return r.pending.set(e,a),a}function Br(e){let n=e.__stx_server_data;if(!n?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(n.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function X(e,n=!1){let r=t(e),i=[],a=new Set,l=0,u=0,f=r.length,v=()=>{if(l!==0)return;let S=r.slice(u).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(S){if(n&&S[1]==="const")return;let V=S[2];if(!a.has(V))i.push(V),a.add(V);return}let I=r.slice(u).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(I){if(n&&r.slice(u).startsWith("const"))return;I[1].split(",").forEach((V)=>{let W=V.trim();if(!W)return;let Z=W.indexOf(":"),G=(Z>=0?W.slice(Z+1).trim():W).split(/[\s=]/)[0];if(G&&!a.has(G))i.push(G),a.add(G)});return}let j=r.slice(u).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(j){if(n&&r.slice(u).startsWith("const"))return;j[1].split(",").forEach((V)=>{let W=V.trim().replace(/^\.\.\./,"");if(!W)return;let Z=W.split(/[\s=]/)[0];if(Z&&!a.has(Z))i.push(Z),a.add(Z)});return}if(n)return;let L=r.slice(u).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let V=L[1];if(!a.has(V))i.push(V),a.add(V);return}let M=r.slice(u).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(M){let V=M[1];if(!a.has(V))i.push(V),a.add(V)}};while(u<f){if(r[u]==="{"){l++,u++;continue}if(r[u]==="}"){l--,u++;continue}if(l===0&&/[a-z]/i.test(r[u])&&(u===0||/\s|[;{}()]/.test(r[u-1])))v();u++}return i.join(", ")}function Gs(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function rc(e,n=X(e).split(",").map((r)=>r.trim()).filter(Boolean)){let r=new Set(X(e,!0).split(",").map((i)=>i.trim()));return n.map((i)=>r.has(i)?`get ${i}() { return ${i} }, set ${i}(__stxValue_${i}) { ${i} = __stxValue_${i} }`:i).join(", ")}function Xs(e,n){let r=`{ ${rc(e,n)} }`;return X(e).split(",").some((i)=>i.trim()==="__stxLiveBindings")?`Object.defineProperties(${r}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:r}import sn from"fs";import Ve from"path";function J(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var ii=new Map;function Ir(e,n=!0){let r=ii.get(e);if(n&&r)return r;let i=new Map,a=[Ve.join(e,"src"),Ve.join(e,"dist"),e];function l(u,f){if(f>6)return;let v;try{v=sn.readdirSync(u,{withFileTypes:!0})}catch{return}for(let S of v){let I=Ve.join(u,S.name);if(S.isDirectory()){if(S.name==="node_modules"||S.name.startsWith("."))continue;l(I,f+1)}else if(S.isFile()&&S.name.endsWith(".stx")){let j=S.name.slice(0,-4);if(!i.has(j))i.set(j,I);let L=j.toLowerCase();if(!i.has(L))i.set(L,I);let M=J(j);if(!i.has(M))i.set(M,I)}}}for(let u of a)if(l(u,0),i.size>0)break;if(n)ii.set(e,i);return i}function Js(e,n){if(e.startsWith(".")||e.startsWith("/"))return null;let r=n;while(!0){let i=Ve.join(r,"node_modules",e);try{if(sn.statSync(i).isDirectory())return i}catch{}let a=Ve.dirname(r);if(a===r)return null;r=a}}function Ys(e,n,r={}){return[Ve.resolve(Ve.dirname(n),`${e}.stx`),Ve.resolve(Ve.dirname(n),e),Ve.resolve(r.componentsDir||"components",`${e}.stx`),Ve.resolve(r.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function oi(e){let n=e.endsWith(".stx")?e.slice(0,-4):e,r=n.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),i=J(n);return[n,r,i]}function Ti(e,n){let[r,i,a]=oi(e);for(let l of[r,r.toLowerCase(),i,a]){let u=n?.__importedComponents?.get(l);if(u!==void 0)return u}}function $i(e,n){let r=n?Ve.resolve(n):void 0,i=Ve.dirname(Ve.resolve(e));for(;;){if(sn.existsSync(Ve.join(i,"package.json")))return r&&i===r?void 0:i;let a=Ve.dirname(i);if(a===i)return;i=a}}var ic=["src/ui","src/components","components","dist"];function rs(e,n){let r=Ve.resolve(e);if(!n&&!r.split(Ve.sep).includes("node_modules"))return[];let i=$i(r,n);if(!i)return[];let a=[];try{let f=JSON.parse(sn.readFileSync(Ve.join(i,"package.json"),"utf8")).stx?.components;if(Array.isArray(f))a=f.filter((v)=>typeof v==="string")}catch{}let l=a.length?a:ic;return[Ve.dirname(Ve.resolve(e)),...l.map((u)=>Ve.resolve(i,u))]}function*Ri(e,n,r={},i){let a=oi(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield Ve.resolve(Ve.dirname(n),`${a[0]}.stx`);return}let l=[...new Set(a.map((v)=>`${v}.stx`))],u=r.projectRoot||process.cwd(),f=[...rs(n,r.projectRoot),...i?.__originalFilePath?[Ve.join(Ve.dirname(i.__originalFilePath),"components")]:[],...r.componentsDir?[r.componentsDir]:[],Ve.join(Ve.dirname(n),"components"),Ve.resolve(u,"src/components"),Ve.resolve(u,"components"),...import.meta.dir?[Ve.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(f)){for(let S of l)yield Ve.join(v,S);try{for(let S of sn.readdirSync(v,{withFileTypes:!0}))if(S.isDirectory())for(let I of l)yield Ve.join(v,S.name,I)}catch{}}}function ai(e,n,r={},i){let a=Ti(e,i);if(a!==void 0)return a;for(let l of Ri(e,n,r,i))try{if(sn.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function Zs(e,n=[],r={}){let i=new Set([...e].map((S)=>S.replace(/[-_]/g,"").toLowerCase()));if(!i.has("src")&&!i.has("source")||!i.has("alt")&&!i.has("decorative"))return!1;let a=new Map(Object.entries(r).map(([S,I])=>[S.replace(/[-_]/g,"").toLowerCase(),I])),l=a.get("alt"),u=a.get("decorative"),f=typeof l==="string"&&!!l.trim(),v=typeof u==="string"?!["false","0","off","no"].includes(u.trim().toLowerCase()):Boolean(u);if(!f&&!v)return!1;if(["defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((S)=>i.has(S)))return!1;if([...n].some((S)=>!["load","error"].includes(S.replace(/^@/,"").split(".")[0].toLowerCase())))return!1;if(i.has("resizemode")&&(i.has("fit")||i.has("objectfit")))return!1;if(i.has("src")&&i.has("source"))return!1;return["fit","objectfit","resizemode","position","objectposition","rounded","aspectratio","zoomonhover","sources","webpsrc","webpsrcset"].some((S)=>i.has(S))}import Is from"fs";import xe from"path";import Bt from"path";import _n from"fs";var oc=new Set(["touchstart","touchmove","wheel","mousewheel"]);function Us(e,n){if(n.passive)return!0;if(n.prevent||n.nonpassive)return!1;return oc.has(e.toLowerCase())}var ci=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),li={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},ac=new Set(["ctrl","alt","shift","meta"]),fi={left:0,middle:1,right:2};function ui(e){let n={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let r of e){let i=r.toLowerCase();if(i==="prevent")n.prevent=!0;else if(i==="stop")n.stop=!0;else if(i==="once")n.once=!0;else if(i==="capture")n.capture=!0;else if(i==="self")n.self=!0;else if(i==="passive")n.passive=!0;else if(i==="nonpassive")n.nonpassive=!0;else if(ac.has(i))n.systemKeys.push(i);else if(i in fi)n.mouse=i;else if(i in li||/^[a-z]$/.test(i))n.keys.push(li[i]||i.toUpperCase());else if(i.startsWith("debounce")){let a=i.match(/debounce(?:\.(\d+))?/);n.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(i.startsWith("throttle")){let a=i.match(/throttle(?:\.(\d+))?/);n.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return n}function di(e,n=""){let r=[],i=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=a.exec(e))!==null){let[u,f,v]=l,S=l.index,I=S+u.length,j=`__stx_evt_${n}${i++}`,L=[],M=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,V;while((V=M.exec(v))!==null){let[,Z,q]=V,G=Z.split("."),U=G[0];if(!ci.has(U))continue;L.push({attribute:`@${Z}`,event:U,handler:q,modifiers:ui(G.slice(1)),elementId:j})}let W=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((V=W.exec(v))!==null){let[,Z,q]=V,G=Z.split("."),U=G[0];if(!ci.has(U))continue;L.push({attribute:`@${Z}`,event:U,handler:q,modifiers:ui(G.slice(1)),elementId:j})}if(L.length>0)r.push({originalTag:u,elementId:j,events:L,startIndex:S,endIndex:I})}return r}function cc(e){let n=[],{modifiers:r}=e;if(r.self)n.push("if ($event.target !== $el) return");for(let i of r.systemKeys)n.push(`if (!$event.${i}Key) return`);if(r.keys.length>0){let i=r.keys.map((a)=>`$event.key === '${a}'`).join(" || ");n.push(`if (!(${i})) return`)}if(r.mouse!==null){let i=fi[r.mouse];n.push(`if ($event.button !== ${i}) return`)}if(r.prevent)n.push("$event.preventDefault()");if(r.stop)n.push("$event.stopPropagation()");return n.join("; ")}function lc(e,n){let r=e;if(n.debounce!==null)r=`__stx_debounce(() => { ${r} }, ${n.debounce})`;else if(n.throttle!==null)r=`__stx_throttle(() => { ${r} }, ${n.throttle})`;return r}function Hs(e){let n=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(n))return e;return`if (typeof ${n} === 'function' && !${n}._isSignal) ${n}($event);`}function uc(e){let{modifiers:n}=e,r=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),i=cc(e),a=lc(Hs(e.handler),n),l=[];if(n.once)l.push("once: true");if(n.capture)l.push("capture: true");if(Us(e.event,n))l.push("passive: true");let u=l.length>0?`, { ${l.join(", ")} }`:"",f=a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
2
+ import{Ze,Mn,uo,Ki,z}from"./chunk-41z7f41b.js";import{Nn}from"./chunk-4wh71ddp.js";import{Jr,C,Bl,xt,ta,Fl}from"./chunk-cphc60zw.js";import{D}from"./chunk-vk2jy6mn.js";import{T,R}from"./chunk-0jdz31q1.js";import{Xr,bo,Fn,Dl,Le}from"./chunk-3b3mkgpj.js";import{po,d,m,zr,p,te,K,be,_,bt,ho,De,et,yo}from"./chunk-xmg6bmh6.js";import{w}from"./chunk-v6gkjg5f.js";import{ne}from"./chunk-a0aqs5a8.js";import{t,h}from"./chunk-neg6ckjg.js";import{c}from"./chunk-hxws025y.js";import Ct from"path";import un from"process";import{AsyncLocalStorage as sc}from"async_hooks";var ni=new sc;function Rn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function si(e,n){return ni.run(Rn(e),n)}async function ri(e,n){let r=ni.getStore();if(!r)throw Error("useServerData must run inside a <script server> render");if(typeof e!=="string"||!e.trim())throw TypeError("useServerData requires a non-empty string key");let i=r.pending.get(e);if(i)return i;let a=Promise.resolve().then(n).then((l)=>{let u=JSON.stringify(l,(v,S)=>{if(S===void 0||typeof S==="function"||typeof S==="symbol"||typeof S==="bigint"||typeof S==="number"&&!Number.isFinite(S))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(S&&typeof S==="object"&&!Array.isArray(S)&&Object.getPrototypeOf(S)!==Object.prototype&&Object.getPrototypeOf(S)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return S}),f=JSON.parse(u);return r.values.set(e,f),f}).catch((l)=>{throw r.pending.delete(e),l});return r.pending.set(e,a),a}function Br(e){let n=e.__stx_server_data;if(!n?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(n.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function X(e,n=!1){let r=t(e),i=[],a=new Set,l=0,u=0,f=r.length,v=()=>{if(l!==0)return;let S=r.slice(u).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(S){if(n&&S[1]==="const")return;let V=S[2];if(!a.has(V))i.push(V),a.add(V);return}let I=r.slice(u).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(I){if(n&&r.slice(u).startsWith("const"))return;I[1].split(",").forEach((V)=>{let W=V.trim();if(!W)return;let Z=W.indexOf(":"),G=(Z>=0?W.slice(Z+1).trim():W).split(/[\s=]/)[0];if(G&&!a.has(G))i.push(G),a.add(G)});return}let j=r.slice(u).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(j){if(n&&r.slice(u).startsWith("const"))return;j[1].split(",").forEach((V)=>{let W=V.trim().replace(/^\.\.\./,"");if(!W)return;let Z=W.split(/[\s=]/)[0];if(Z&&!a.has(Z))i.push(Z),a.add(Z)});return}if(n)return;let L=r.slice(u).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let V=L[1];if(!a.has(V))i.push(V),a.add(V);return}let M=r.slice(u).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(M){let V=M[1];if(!a.has(V))i.push(V),a.add(V)}};while(u<f){if(r[u]==="{"){l++,u++;continue}if(r[u]==="}"){l--,u++;continue}if(l===0&&/[a-z]/i.test(r[u])&&(u===0||/\s|[;{}()]/.test(r[u-1])))v();u++}return i.join(", ")}function Gs(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function rc(e,n=X(e).split(",").map((r)=>r.trim()).filter(Boolean)){let r=new Set(X(e,!0).split(",").map((i)=>i.trim()));return n.map((i)=>r.has(i)?`get ${i}() { return ${i} }, set ${i}(__stxValue_${i}) { ${i} = __stxValue_${i} }`:i).join(", ")}function Xs(e,n){let r=`{ ${rc(e,n)} }`;return X(e).split(",").some((i)=>i.trim()==="__stxLiveBindings")?`Object.defineProperties(${r}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:r}import sn from"fs";import Ve from"path";function J(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var ii=new Map;function Ir(e,n=!0){let r=ii.get(e);if(n&&r)return r;let i=new Map,a=[Ve.join(e,"src"),Ve.join(e,"dist"),e];function l(u,f){if(f>6)return;let v;try{v=sn.readdirSync(u,{withFileTypes:!0})}catch{return}for(let S of v){let I=Ve.join(u,S.name);if(S.isDirectory()){if(S.name==="node_modules"||S.name.startsWith("."))continue;l(I,f+1)}else if(S.isFile()&&S.name.endsWith(".stx")){let j=S.name.slice(0,-4);if(!i.has(j))i.set(j,I);let L=j.toLowerCase();if(!i.has(L))i.set(L,I);let M=J(j);if(!i.has(M))i.set(M,I)}}}for(let u of a)if(l(u,0),i.size>0)break;if(n)ii.set(e,i);return i}function Js(e,n){if(e.startsWith(".")||e.startsWith("/"))return null;let r=n;while(!0){let i=Ve.join(r,"node_modules",e);try{if(sn.statSync(i).isDirectory())return i}catch{}let a=Ve.dirname(r);if(a===r)return null;r=a}}function Ys(e,n,r={}){return[Ve.resolve(Ve.dirname(n),`${e}.stx`),Ve.resolve(Ve.dirname(n),e),Ve.resolve(r.componentsDir||"components",`${e}.stx`),Ve.resolve(r.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function oi(e){let n=e.endsWith(".stx")?e.slice(0,-4):e,r=n.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),i=J(n);return[n,r,i]}function Ti(e,n){let[r,i,a]=oi(e);for(let l of[r,r.toLowerCase(),i,a]){let u=n?.__importedComponents?.get(l);if(u!==void 0)return u}}function $i(e,n){let r=n?Ve.resolve(n):void 0,i=Ve.dirname(Ve.resolve(e));for(;;){if(sn.existsSync(Ve.join(i,"package.json")))return r&&i===r?void 0:i;let a=Ve.dirname(i);if(a===i)return;i=a}}var ic=["src/ui","src/components","components","dist"];function rs(e,n){let r=Ve.resolve(e);if(!n&&!r.split(Ve.sep).includes("node_modules"))return[];let i=$i(r,n);if(!i)return[];let a=[];try{let f=JSON.parse(sn.readFileSync(Ve.join(i,"package.json"),"utf8")).stx?.components;if(Array.isArray(f))a=f.filter((v)=>typeof v==="string")}catch{}let l=a.length?a:ic;return[Ve.dirname(Ve.resolve(e)),...l.map((u)=>Ve.resolve(i,u))]}function*Ri(e,n,r={},i){let a=oi(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield Ve.resolve(Ve.dirname(n),`${a[0]}.stx`);return}let l=[...new Set(a.map((v)=>`${v}.stx`))],u=r.projectRoot||process.cwd(),f=[...rs(n,r.projectRoot),...i?.__originalFilePath?[Ve.join(Ve.dirname(i.__originalFilePath),"components")]:[],...r.componentsDir?[r.componentsDir]:[],Ve.join(Ve.dirname(n),"components"),Ve.resolve(u,"src/components"),Ve.resolve(u,"components"),...import.meta.dir?[Ve.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(f)){for(let S of l)yield Ve.join(v,S);try{for(let S of sn.readdirSync(v,{withFileTypes:!0}))if(S.isDirectory())for(let I of l)yield Ve.join(v,S.name,I)}catch{}}}function ai(e,n,r={},i){let a=Ti(e,i);if(a!==void 0)return a;for(let l of Ri(e,n,r,i))try{if(sn.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function Zs(e,n=[],r={}){let i=new Set([...e].map((S)=>S.replace(/[-_]/g,"").toLowerCase()));if(!i.has("src")&&!i.has("source")||!i.has("alt")&&!i.has("decorative"))return!1;let a=new Map(Object.entries(r).map(([S,I])=>[S.replace(/[-_]/g,"").toLowerCase(),I])),l=a.get("alt"),u=a.get("decorative"),f=typeof l==="string"&&!!l.trim(),v=typeof u==="string"?!["false","0","off","no"].includes(u.trim().toLowerCase()):Boolean(u);if(!f&&!v)return!1;if(["defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((S)=>i.has(S)))return!1;if([...n].some((S)=>!["load","error"].includes(S.replace(/^@/,"").split(".")[0].toLowerCase())))return!1;if(i.has("resizemode")&&(i.has("fit")||i.has("objectfit")))return!1;if(i.has("src")&&i.has("source"))return!1;return["fit","objectfit","resizemode","position","objectposition","rounded","aspectratio","zoomonhover","sources","webpsrc","webpsrcset"].some((S)=>i.has(S))}import Is from"fs";import xe from"path";import Bt from"path";import _n from"fs";var oc=new Set(["touchstart","touchmove","wheel","mousewheel"]);function Us(e,n){if(n.passive)return!0;if(n.prevent||n.nonpassive)return!1;return oc.has(e.toLowerCase())}var ci=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),li={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},ac=new Set(["ctrl","alt","shift","meta"]),fi={left:0,middle:1,right:2};function ui(e){let n={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let r of e){let i=r.toLowerCase();if(i==="prevent")n.prevent=!0;else if(i==="stop")n.stop=!0;else if(i==="once")n.once=!0;else if(i==="capture")n.capture=!0;else if(i==="self")n.self=!0;else if(i==="passive")n.passive=!0;else if(i==="nonpassive")n.nonpassive=!0;else if(ac.has(i))n.systemKeys.push(i);else if(i in fi)n.mouse=i;else if(i in li||/^[a-z]$/.test(i))n.keys.push(li[i]||i.toUpperCase());else if(i.startsWith("debounce")){let a=i.match(/debounce(?:\.(\d+))?/);n.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(i.startsWith("throttle")){let a=i.match(/throttle(?:\.(\d+))?/);n.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return n}function di(e,n=""){let r=[],i=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=a.exec(e))!==null){let[u,f,v]=l,S=l.index,I=S+u.length,j=`__stx_evt_${n}${i++}`,L=[],M=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,V;while((V=M.exec(v))!==null){let[,Z,q]=V,G=Z.split("."),U=G[0];if(!ci.has(U))continue;L.push({attribute:`@${Z}`,event:U,handler:q,modifiers:ui(G.slice(1)),elementId:j})}let W=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((V=W.exec(v))!==null){let[,Z,q]=V,G=Z.split("."),U=G[0];if(!ci.has(U))continue;L.push({attribute:`@${Z}`,event:U,handler:q,modifiers:ui(G.slice(1)),elementId:j})}if(L.length>0)r.push({originalTag:u,elementId:j,events:L,startIndex:S,endIndex:I})}return r}function cc(e){let n=[],{modifiers:r}=e;if(r.self)n.push("if ($event.target !== $el) return");for(let i of r.systemKeys)n.push(`if (!$event.${i}Key) return`);if(r.keys.length>0){let i=r.keys.map((a)=>`$event.key === '${a}'`).join(" || ");n.push(`if (!(${i})) return`)}if(r.mouse!==null){let i=fi[r.mouse];n.push(`if ($event.button !== ${i}) return`)}if(r.prevent)n.push("$event.preventDefault()");if(r.stop)n.push("$event.stopPropagation()");return n.join("; ")}function lc(e,n){let r=e;if(n.debounce!==null)r=`__stx_debounce(() => { ${r} }, ${n.debounce})`;else if(n.throttle!==null)r=`__stx_throttle(() => { ${r} }, ${n.throttle})`;return r}function Hs(e){let n=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(n))return e;return`if (typeof ${n} === 'function' && !${n}._isSignal) ${n}($event);`}function uc(e){let{modifiers:n}=e,r=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),i=cc(e),a=lc(Hs(e.handler),n),l=[];if(n.once)l.push("once: true");if(n.capture)l.push("capture: true");if(Us(e.event,n))l.push("passive: true");let u=l.length>0?`, { ${l.join(", ")} }`:"",f=a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
3
3
  (function() {
4
4
  var $el = document.getElementById('${r}');
5
5
  if (!$el) return;
@@ -112,7 +112,7 @@ else {
112
112
  `)}
113
113
  })();
114
114
  </script>`}function pc(e,n=""){let r=di(e,n);if(r.length===0)return{template:e,bindings:[]};let i=e,a=[];for(let l=r.length-1;l>=0;l--){let u=r[l],f=u.originalTag;if(!f.includes(" id="))f=f.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${u.elementId}"`);else{let v=f.match(/id=["']([^"']+)["']/);if(v)for(let S of u.events)S.elementId=v[1]}for(let v of u.events){let S=v.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),I=new RegExp(`\\s*${S}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${S}\\s*=\\s*'[^']*'`,"g");f=f.replace(I,""),f=f.replace(j,"")}i=i.slice(0,u.startIndex)+f+i.slice(u.endIndex),a.push(...u.events)}return{template:i,bindings:a}}function pi(e){let n=e.$uid;return typeof n==="string"&&n?`${n}_`:""}function tl(e,n,r){if(Fl(e))return e;if(n.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:f,bindings:v}=pc(e,pi(n)),S=n.__stx_event_bindings||[];return n.__stx_event_bindings=[...S,...v],f}let i=di(e,pi(n));if(i.length===0)return e;let a=e;for(let f=i.length-1;f>=0;f--){let v=i[f],S=v.originalTag;if(!S.includes(" id="))S=S.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${v.elementId}"`);else{let I=S.match(/id=["']([^"']+)["']/);if(I)for(let j of v.events)j.elementId=I[1]}for(let I of v.events){let j=I.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),L=new RegExp(`\\s*${j}\\s*=\\s*"[^"]*"`,"g"),M=new RegExp(`\\s*${j}\\s*=\\s*'[^']*'`,"g");S=S.replace(L,""),S=S.replace(M,"")}a=a.slice(0,v.startIndex)+S+a.slice(v.endIndex)}let l=Ai(i.flatMap((f)=>f.events)),u=c(a);if(u!==-1)a=a.slice(0,u)+l+`
115
- `+a.slice(u);else a+=l;return a}function gi(e,n){let r=new Set;for(let i of e.split(",")){let a=i.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(n){let l=a.lastIndexOf(":");if(l!==-1)a=a.slice(l+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))r.add(a)}return r}function Vt(e,n){let r=t(e),{depths:i,balanced:a}=h(r),l=(f)=>!a||i[f]===0,u=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${n}\\b)`,"g");for(let f of r.matchAll(u)){let v=(f.index??0)+f[0].length-f[1].length;if(l(v))return!0}for(let f of r.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(f.index??0)&&gi(f[1],!0).has(n))return!0;for(let f of r.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(f.index??0)&&gi(f[1],!1).has(n))return!0;return!1}var Ue="0.2.897";var mi=Symbol.for(`stx.lazy-module-promises.${Ue}`);function dc(){let e=globalThis;return e[mi]??=new Map,e[mi]}function o(e,n){let r=dc(),i=`${import.meta.url}\x00${e}`,a=r.get(i);if(a)return a;let l=n();return r.set(i,l),l.catch(()=>{if(r.get(i)===l)r.delete(i)}),l}var gc=/<\/(script)/gi;function me(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(gc,"<\\/$1")}import hi from"fs";var xi=[];function k(e){let n=new T(e);return xi.push(n),n}function nl(){for(let e of xi)e.clear()}function E(e,...n){return`${n.map((r)=>String(r??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function Or(e){let n=[];for(let r of new Set(e))try{n.push({path:r,mtimeMs:hi.statSync(r).mtimeMs})}catch{}return n}function Qs(e){for(let n of e)try{if(hi.statSync(n.path).mtimeMs!==n.mtimeMs)return!1}catch{return!1}return!0}var Ie=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useIntervalFn","useObjectUrl"];var mc=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function hc(e){if(e.startsWith(".")||e.startsWith("/"))return null;if(e.startsWith("@")){let r=e.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!r)return null;return{pkg:r[1],subpath:r[2]||""}}let n=e.match(/^([^/]+)(\/.*)?$/);if(!n)return null;return{pkg:n[1],subpath:n[2]||""}}function xc(e,n){let r=n;while(!0){let i=Bt.join(r,"node_modules",e,"package.json");if(_n.existsSync(i))return Bt.dirname(i);let a=Bt.dirname(r);if(a===r)return null;r=a}}function bc(e,n){if(!e||typeof e!=="object")return null;let r=(a)=>{if(typeof a==="string")return a;if(a&&typeof a==="object"){if(typeof a.import==="string")return a.import;if(typeof a.default==="string")return a.default;if(typeof a.import==="object")return r(a.import);if(typeof a.default==="object")return r(a.default)}return null};if(Object.prototype.hasOwnProperty.call(e,n))return r(e[n]);let i=null;for(let a of Object.keys(e)){let l=a.indexOf("*");if(l===-1)continue;let u=a.slice(0,l),f=a.slice(l+1);if(!n.startsWith(u)||!n.endsWith(f))continue;if(n.length<u.length+f.length)continue;if(!i||u.length>i.prefix.length)i={pattern:a,prefix:u,suffix:f}}if(i){let a=n.slice(i.prefix.length,n.length-i.suffix.length),l=r(e[i.pattern]);if(l)return l.replace("*",a)}return null}function yc(e,n){let r=hc(e);if(!r||!r.subpath)return null;let i=xc(r.pkg,n);if(!i)return null;let a;try{a=JSON.parse(_n.readFileSync(Bt.join(i,"package.json"),"utf8"))}catch{return null}let l=`.${r.subpath}`,u=bc(a.exports,l);if(!u)return null;let f=Bt.resolve(i,u);return _n.existsSync(f)?f:null}function Fi(e,n){let r=n.filePath?Bt.dirname(n.filePath):n.projectRoot||process.cwd(),i=n.projectRoot||process.cwd(),a=new Set,l=[],u=[];return{code:e.replace(mc,(v,S)=>{let I;try{if(S.startsWith("./")||S.startsWith("../")||S.startsWith("/")){if(I=S.startsWith("/")?S:Bt.resolve(r,S),!_n.existsSync(I))throw Error(`file not found: ${I}`)}else{let j=null;try{j=Bun.resolveSync(S,i)}catch{j=yc(S,i)}if(!j)throw Error(`could not resolve ${S} (Bun.resolveSync + exports fallback both failed)`);I=j}}catch(j){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(S)} (from ${n.filePath||"<unknown>"}): ${j?.message||j}`),u.push(S),""}if(a.has(I))return"";a.add(I);try{let j=_n.readFileSync(I,"utf8");l.push({source:S,resolvedPath:I,contents:j})}catch(j){console.warn(`[stx:vendor-css] could not read ${I}: ${j?.message||j}`),u.push(S)}return""}),styles:l,unresolved:u}}function _c(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function zi(e){if(e.length===0)return"";return`${e.map((n)=>`<style data-stx-vendor="${_c(n.source)}" data-stx-layer="vendor">
115
+ `+a.slice(u);else a+=l;return a}function gi(e,n){let r=new Set;for(let i of e.split(",")){let a=i.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(n){let l=a.lastIndexOf(":");if(l!==-1)a=a.slice(l+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))r.add(a)}return r}function Vt(e,n){let r=t(e),{depths:i,balanced:a}=h(r),l=(f)=>!a||i[f]===0,u=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${n}\\b)`,"g");for(let f of r.matchAll(u)){let v=(f.index??0)+f[0].length-f[1].length;if(l(v))return!0}for(let f of r.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(f.index??0)&&gi(f[1],!0).has(n))return!0;for(let f of r.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(f.index??0)&&gi(f[1],!1).has(n))return!0;return!1}var Ue="0.2.898";var mi=Symbol.for(`stx.lazy-module-promises.${Ue}`);function dc(){let e=globalThis;return e[mi]??=new Map,e[mi]}function o(e,n){let r=dc(),i=`${import.meta.url}\x00${e}`,a=r.get(i);if(a)return a;let l=n();return r.set(i,l),l.catch(()=>{if(r.get(i)===l)r.delete(i)}),l}var gc=/<\/(script)/gi;function me(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(gc,"<\\/$1")}import hi from"fs";var xi=[];function k(e){let n=new T(e);return xi.push(n),n}function nl(){for(let e of xi)e.clear()}function E(e,...n){return`${n.map((r)=>String(r??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function Or(e){let n=[];for(let r of new Set(e))try{n.push({path:r,mtimeMs:hi.statSync(r).mtimeMs})}catch{}return n}function Qs(e){for(let n of e)try{if(hi.statSync(n.path).mtimeMs!==n.mtimeMs)return!1}catch{return!1}return!0}var Ie=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useIntervalFn","useObjectUrl"];var mc=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function hc(e){if(e.startsWith(".")||e.startsWith("/"))return null;if(e.startsWith("@")){let r=e.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!r)return null;return{pkg:r[1],subpath:r[2]||""}}let n=e.match(/^([^/]+)(\/.*)?$/);if(!n)return null;return{pkg:n[1],subpath:n[2]||""}}function xc(e,n){let r=n;while(!0){let i=Bt.join(r,"node_modules",e,"package.json");if(_n.existsSync(i))return Bt.dirname(i);let a=Bt.dirname(r);if(a===r)return null;r=a}}function bc(e,n){if(!e||typeof e!=="object")return null;let r=(a)=>{if(typeof a==="string")return a;if(a&&typeof a==="object"){if(typeof a.import==="string")return a.import;if(typeof a.default==="string")return a.default;if(typeof a.import==="object")return r(a.import);if(typeof a.default==="object")return r(a.default)}return null};if(Object.prototype.hasOwnProperty.call(e,n))return r(e[n]);let i=null;for(let a of Object.keys(e)){let l=a.indexOf("*");if(l===-1)continue;let u=a.slice(0,l),f=a.slice(l+1);if(!n.startsWith(u)||!n.endsWith(f))continue;if(n.length<u.length+f.length)continue;if(!i||u.length>i.prefix.length)i={pattern:a,prefix:u,suffix:f}}if(i){let a=n.slice(i.prefix.length,n.length-i.suffix.length),l=r(e[i.pattern]);if(l)return l.replace("*",a)}return null}function yc(e,n){let r=hc(e);if(!r||!r.subpath)return null;let i=xc(r.pkg,n);if(!i)return null;let a;try{a=JSON.parse(_n.readFileSync(Bt.join(i,"package.json"),"utf8"))}catch{return null}let l=`.${r.subpath}`,u=bc(a.exports,l);if(!u)return null;let f=Bt.resolve(i,u);return _n.existsSync(f)?f:null}function Fi(e,n){let r=n.filePath?Bt.dirname(n.filePath):n.projectRoot||process.cwd(),i=n.projectRoot||process.cwd(),a=new Set,l=[],u=[];return{code:e.replace(mc,(v,S)=>{let I;try{if(S.startsWith("./")||S.startsWith("../")||S.startsWith("/")){if(I=S.startsWith("/")?S:Bt.resolve(r,S),!_n.existsSync(I))throw Error(`file not found: ${I}`)}else{let j=null;try{j=Bun.resolveSync(S,i)}catch{j=yc(S,i)}if(!j)throw Error(`could not resolve ${S} (Bun.resolveSync + exports fallback both failed)`);I=j}}catch(j){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(S)} (from ${n.filePath||"<unknown>"}): ${j?.message||j}`),u.push(S),""}if(a.has(I))return"";a.add(I);try{let j=_n.readFileSync(I,"utf8");l.push({source:S,resolvedPath:I,contents:j})}catch(j){console.warn(`[stx:vendor-css] could not read ${I}: ${j?.message||j}`),u.push(S)}return""}),styles:l,unresolved:u}}function _c(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function zi(e){if(e.length===0)return"";return`${e.map((n)=>`<style data-stx-vendor="${_c(n.source)}" data-stx-layer="vendor">
116
116
  @layer vendor {
117
117
  ${n.contents}
118
118
  }
@@ -182,7 +182,7 @@ else {
182
182
  // STX: auto-generated event bindings
183
183
  ${e.map((r,i)=>Ic(r,i)).join(`
184
184
  `)}`}function wi(e){let n=[],r=new Set,i=e.replace(/^\s*import\s+.*$/gm,""),a=0,l=i.length,u=0;while(u<l){let f=i[u];if(f==="'"||f==='"'||f==="`"){let v=f;if(u++,v==="`"){let S=0;while(u<l){if(i[u]==="\\"){u+=2;continue}if(i[u]==="`"&&S===0){u++;break}if(i[u]==="$"&&i[u+1]==="{"){S++,u+=2;continue}if(i[u]==="}"&&S>0){S--,u++;continue}u++}}else while(u<l){if(i[u]==="\\"){u+=2;continue}if(i[u]===v){u++;break}u++}continue}if(f==="/"&&i[u+1]==="/"){while(u<l&&i[u]!==`
185
- `)u++;continue}if(f==="/"&&i[u+1]==="*"){u+=2;while(u<l-1&&!(i[u]==="*"&&i[u+1]==="/"))u++;u+=2;continue}if(f==="{"){a++,u++;continue}if(f==="}"){a--,u++;continue}if(a===0){let v=i.slice(u),S=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(S){let L=S[1];if(!L.startsWith("_")&&!r.has(L))n.push(L),r.add(L);u+=S[0].length;continue}let I=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(I){I[1].split(",").forEach((L)=>{let M=L.trim(),V=M.indexOf(":"),W=V>=0?M.slice(V+1).trim().split(/[\s=]/)[0]:M.split(/[\s=]/)[0];if(W&&!W.startsWith("_")&&!r.has(W))n.push(W),r.add(W)}),u+=I[0].length;continue}let j=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(j){let L=j[1];if(!L.startsWith("_")&&!r.has(L))n.push(L),r.add(L);u+=j[0].length;continue}}u++}return n}var jc=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"]);function Pc(e){let n=new Set,r=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function i(L){let M;while((M=r.exec(L))!==null){let V=M[0];if(!jc.has(V))n.add(V)}}let a=/\{\{([\s\S]*?)\}\}/g,l;while((l=a.exec(e))!==null)i(l[1]);let u=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((l=u.exec(e))!==null)i(l[1]);let f=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=f.exec(e))!==null)i(l[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=v.exec(e))!==null)i(l[1]);let S=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=S.exec(e))!==null)i(l[1]);let I=/@model\s*=\s*["']([^"']*)["']/gi;while((l=I.exec(e))!==null)i(l[1]);let j=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=j.exec(e))!==null)i(l[1]);return n}async function Ge(e,n={}){let r=e,i="",a=!1,l=[],u=Fi(r,{filePath:n.filePath,projectRoot:n.projectRoot});r=u.code;let f=zi(u.styles),v=Xt(r);r=v.code,l=[...v.imports,...v.models];let{hasUserImports:S,bundleClientScript:I}=await o("stx/client-script-bundler",()=>import("./chunk-gz7egees.js"));if(S(r))r=await I(r,n.filePath||"",{projectRoot:n.projectRoot,minify:n.production}),a=!0;if(n.autoImports!==!1){let U=vl(r);r=U.code,i=xl(U.stxImports,U.browserImports.filter((H)=>!l.includes(H)))}if(i=`${An(r,n.serverData)}${i}`,r=D(r),!a&&Xe(n.attrs||""))r=Je(r);let j=Oc(n.eventBindings||[]),L=(n.attrs||"").trim(),M=/\btype\s*=\s*["']module["']/i.test(L),V=n.instanceId?` data-stx-instance="${n.instanceId}"`:"";if(M){let U=L.replace(/\btype\s*=\s*["']module["']/i,"").trim(),H=`type="module" data-stx-scoped${V}${U?` ${U}`:""}`;return`${f}<script ${H}>
185
+ `)u++;continue}if(f==="/"&&i[u+1]==="*"){u+=2;while(u<l-1&&!(i[u]==="*"&&i[u+1]==="/"))u++;u+=2;continue}if(f==="{"){a++,u++;continue}if(f==="}"){a--,u++;continue}if(a===0){let v=i.slice(u),S=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(S){let L=S[1];if(!L.startsWith("_")&&!r.has(L))n.push(L),r.add(L);u+=S[0].length;continue}let I=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(I){I[1].split(",").forEach((L)=>{let M=L.trim(),V=M.indexOf(":"),W=V>=0?M.slice(V+1).trim().split(/[\s=]/)[0]:M.split(/[\s=]/)[0];if(W&&!W.startsWith("_")&&!r.has(W))n.push(W),r.add(W)}),u+=I[0].length;continue}let j=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(j){let L=j[1];if(!L.startsWith("_")&&!r.has(L))n.push(L),r.add(L);u+=j[0].length;continue}}u++}return n}var jc=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"]);function Pc(e){let n=new Set,r=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function i(L){let M;while((M=r.exec(L))!==null){let V=M[0];if(!jc.has(V))n.add(V)}}let a=/\{\{([\s\S]*?)\}\}/g,l;while((l=a.exec(e))!==null)i(l[1]);let u=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((l=u.exec(e))!==null)i(l[1]);let f=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=f.exec(e))!==null)i(l[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=v.exec(e))!==null)i(l[1]);let S=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=S.exec(e))!==null)i(l[1]);let I=/@model\s*=\s*["']([^"']*)["']/gi;while((l=I.exec(e))!==null)i(l[1]);let j=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=j.exec(e))!==null)i(l[1]);return n}async function Ge(e,n={}){let r=e,i="",a=!1,l=[],u=Fi(r,{filePath:n.filePath,projectRoot:n.projectRoot});r=u.code;let f=zi(u.styles),v=Xt(r);r=v.code,l=[...v.imports,...v.models];let{hasUserImports:S,bundleClientScript:I}=await o("stx/client-script-bundler",()=>import("./chunk-jytqf6p6.js"));if(S(r))r=await I(r,n.filePath||"",{projectRoot:n.projectRoot,minify:n.production}),a=!0;if(n.autoImports!==!1){let U=vl(r);r=U.code,i=xl(U.stxImports,U.browserImports.filter((H)=>!l.includes(H)))}if(i=`${An(r,n.serverData)}${i}`,r=D(r),!a&&Xe(n.attrs||""))r=Je(r);let j=Oc(n.eventBindings||[]),L=(n.attrs||"").trim(),M=/\btype\s*=\s*["']module["']/i.test(L),V=n.instanceId?` data-stx-instance="${n.instanceId}"`:"";if(M){let U=L.replace(/\btype\s*=\s*["']module["']/i,"").trim(),H=`type="module" data-stx-scoped${V}${U?` ${U}`:""}`;return`${f}<script ${H}>
186
186
  ${me(`${i}${r}
187
187
  ${j}`)}
188
188
  </script>`}let W=ta(e),Z=/function __stx_setup_/.test(r),q=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function G(U){let H=U.length>0?`
@@ -1183,8 +1183,8 @@ ${S.join(`
1183
1183
  `){let V=e[a];if(V==="\\"){a+=2;continue}if(V==="[")M=!0;else if(V==="]")M=!1;else if(V==="/"&&!M){a++;while(a<l&&/[a-z]/i.test(e[a]))a++;return}a++}},L=()=>{if(i!==0)return;let M=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(M){let q=M[2].split(",").map((G)=>{let U=G.trim().split(":");return U[U.length-1].trim()});for(let G of q)if(G&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(G)&&!r.has(G))n.push(G),r.add(G);return}let V=e.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(V){let q=V[2];if(!r.has(q))n.push(q),r.add(q);return}let W=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(W){let q=W[1];if(!r.has(q))n.push(q),r.add(q);return}let Z=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Z){let q=Z[1];if(!r.has(q))n.push(q),r.add(q)}};while(a<l){if(v())continue;if(e[a]==="'"||e[a]==='"'){u(e[a]);continue}if(e[a]==="`"){f();continue}if(e[a]==="/"&&I()){j();continue}if(e[a]==="{"){i++,a++;continue}if(e[a]==="}"){i--,a++;continue}if(i===0&&/[a-z]/i.test(e[a])&&(a===0||/\s|[;{}()]/.test(e[a-1])))L();a++}return n}function jp(e,n,r){for(let i of ee(e)){let a=O(i.attrs);if(["server","src","component","stx:component"].some((f)=>a.has(f))||!$t(a))continue;let l=an(e.slice(i.bodyStart,i.bodyEnd));if(!l)continue;let u=Object.assign(Object.create(null),r);for(let[f,v]of Object.entries(l.defaults))if(u[f]===void 0)u[f]=ws(v);for(let f of new Set([...l.propNames,...Object.keys(l.defaults)])){let v=l.localBindings[f]??(l.propBindings[f]?void 0:f);if(v)Object.defineProperty(n,v,{value:u[f],writable:!0,enumerable:!0,configurable:!0})}if(l.identifier)Object.defineProperty(n,l.identifier,{value:u,writable:!0,enumerable:!0,configurable:!0})}}var Pp=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function Ug(e,n){let r=Ut(e),i=e.slice(r).match(/^<([a-zA-Z][a-zA-Z0-9-]*)/);if(!i)return null;let a=i[1].toLowerCase();if(!Pp.has(a))return null;let l=new RegExp(`<\\/?${a}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),u=x(e,(I,j)=>(l.lastIndex=j,l.exec(I)?.index===j?l.lastIndex:-1));if(a==="span"&&/\sdata-stx-scope\s*=/.test(u[0]?.token||""))return null;let f=0,v=!1;for(let I of u){if(f+=I.token.startsWith("</")?-1:1,f<0)return null;if(f===0){if(e.slice(I.end).trim())return null;v=!0;break}}if(!v)return null;let S=r+i[0].length;return e.slice(0,S)+n+e.slice(S)}function Wa(e,n){if(!e)return!1;return[...n.additionalComponentsDirs??[],...n.fallbackComponentsDir?[n.fallbackComponentsDir]:[]].some((i)=>{let a=xe.relative(xe.resolve(i),xe.resolve(e));return!a.startsWith("..")&&!xe.isAbsolute(a)})}async function Fr(e,n,r,i,a){let l=e.endsWith(".stx")?e.slice(0,-4):e,u=(ce)=>ce.split("-").map((le)=>le.charAt(0).toUpperCase()+le.slice(1)).join(""),f=r.__importedComponents;if(f){for(let ce of[l,l.toLowerCase(),u(l),J(l)])if(f.has(ce))return!0}let v=[...new Set([`${l}.stx`,`${u(l)}.stx`,`${J(l)}.stx`])],S=typeof a.root==="string"?xe.resolve(a.root):void 0,I=S??xe.dirname(i),j=[],L=(ce)=>{if(ce&&!j.includes(ce))j.push(ce)};for(let ce of rs(i,S))L(ce);let M=r.__originalFilePath;if(M)L(xe.join(xe.dirname(M),"components"));if(Wa(n,a))L(a._rootComponentsDir);L(n),L(a._rootComponentsDir),L(xe.join(xe.dirname(i),"components")),L(a.componentsDir);for(let ce of a.additionalComponentsDirs??[])L(ce);let V=a._targetComponentFallbackNames?.some((ce)=>ce.toLowerCase()===l.toLowerCase());if(!V)for(let ce of a._targetComponentDirs??[])L(ce);if(S)L(xe.resolve(S,"resources/views/components")),L(xe.resolve(S,"resources/components")),L(xe.resolve(S,"src/components")),L(xe.resolve(S,"components"));for(let ce of a._layerComponentDirs??[])L(ce);let W=a._pluginComponentDirs;if(Array.isArray(W))for(let ce of W)L(typeof ce==="string"?ce:null);if(L(a.fallbackComponentsDir),V)for(let ce of a._targetComponentDirs??[])L(ce);let Z=a._nativePrimitivesFallback;if(Z&&!Z.except.some((ce)=>ce.toLowerCase()===l.toLowerCase()))L(Z.dir);if(l.startsWith("./")||l.startsWith("../"))return s(xe.resolve(xe.dirname(i),`${l}.stx`));let q=ja(xe.resolve(import.meta.dir,"components")),G=j.map((ce)=>xe.isAbsolute(ce)?ce:xe.resolve(I,ce)),U=`${v.join("\x00")}\x00\x00${G.join("\x00")}`,H=Pr.get(U);if(H!==void 0)return H;let re=!1;e:for(let ce of G){if(ja(ce)===q)continue;for(let le of v)if(await s(xe.join(ce,le))){re=!0;break e}}return Pr.set(U,re),re}function ja(e){let n=Wr.get(e);if(n!==void 0)return n;let r=e;try{r=Is.realpathSync(e)}catch{}return Wr.set(e,r),r}function Wg(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function Sl(e){if(!e)return!1;let n=e.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(n)}function Mp(e,n,r){if(!e.includes("{{")&&!e.includes("{!!"))return e;let i=(a,l)=>{let u;try{u=N(a,n)}catch{return l}if(u===void 0||u===null)return"";let f=String(u);if(/<\/style/i.test(f))return console.warn(`[stx] a <style> expression in ${r??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return f};return e.replace(/\{!!([\s\S]*?)!!\}/g,(a,l)=>i(l,a)).replace(/\{\{([\s\S]*?)\}\}/g,(a,l)=>i(l,a))}var Pa=new Set;function Ma(e,n,r,i){let a=`${e}\x00${n}\x00${i??""}`;if(!process.env.STX_DEBUG&&Pa.has(a))return;Pa.add(a);let l=n?` used in ${n}`:"",u=i?` Cause: ${i}.`:"",f=r.length>0?`
1184
1184
  searched:
1185
1185
  ${r.map((v)=>` - ${v}`).join(`
1186
- `)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${u}${f}`)}function Da(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var Dp=new Set(["for","if","show","key","ref","class","className","style"]),Na=new Set,Fa="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",kl=new RegExp(`\\b(?:${Fa})\\s*(?:<[^>]*>)?\\s*\\(`);function Hi(e){let n=new Set,r=new RegExp(`\\b(?:const|let|var)\\s+([a-zA-Z_$][\\w$]*)\\s*=\\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue|${Fa})\\s*(?:<[^>]*>)?\\s*\\(`,"g");for(let i of e){let a;while((a=r.exec(i))!==null)n.add(a[1]);r.lastIndex=0}return[...n]}async function Ye(e,n,r,i,a,l,u,f=new Set,v,S=mt(a),I,j=e){let{extractVariables:L}=await o("stx/variable-extractor",()=>import("./chunk-rc12m1j7.js")),M=f??new Set;if(M.has(e))return`[Circular component reference: ${e}]`;let V=new Set(M);V.add(e);let W=typeof n.client==="string"?n.client.trim():"";if("client"in n)delete n.client;let Z=W&&W!=="load"&&Wg(W)?W:"";try{let q=(pe)=>pe.split("-").map((ve)=>ve.charAt(0).toUpperCase()+ve.slice(1)).join(""),G=j.endsWith(".stx")?j.slice(0,-4):j,U=null,H=a.__importedComponents;if(H){let pe=[G,G.toLowerCase(),q(G),J(G)];for(let ve of pe)if(H.has(ve)){U=H.get(ve);break}}let re=[];if(!U){let pe=[`${G}.stx`,`${q(G)}.stx`,`${J(G)}.stx`],ve=[...new Set(pe)],Me=a.__originalFilePath,$e=[];for(let Te of rs(l))if(!$e.includes(Te))$e.push(Te);let lt=$e.length;for(let Te of u._layerComponentDirs??[])if(!$e.includes(Te))$e.push(Te);if(Me){let Te=xe.join(xe.dirname(Me),"components");$e.push(Te)}let Qe=u._rootComponentsDir;if(typeof Qe==="string"&&Wa(i,u)&&!$e.includes(Qe))$e.push(Qe);if(i&&!$e.includes(i))$e.push(i);if(typeof Qe==="string"&&!$e.includes(Qe))$e.push(Qe);let Ot=xe.join(xe.dirname(l),"components");if(!$e.includes(Ot))$e.push(Ot);if(u.componentsDir&&u.componentsDir!==i&&!$e.includes(u.componentsDir))$e.push(u.componentsDir);for(let Te of u.additionalComponentsDirs??[])if(Te&&!$e.includes(Te))$e.push(Te);let Yt=u._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(G),Dt=(I?.events??[]).map((Te)=>Te.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),Zn=Object.hasOwn(n,"checked")||Boolean(I?.reactiveProps?.includes("checked")),Ns=Object.hasOwn(n,"value")||Boolean(I?.reactiveProps?.includes("value")),Ls=!Dt.includes("valuechange")&&(Zn||Dt.includes("change")&&!Ns),Lt=u._nativeHostAttrs&&/^textinput$/i.test(G),Qt=Dt.includes("update:value")&&!Dt.includes("input"),yn=u._nativeHostAttrs&&/^video$/i.test(G),zs=u._nativeHostAttrs&&/^image$/i.test(G),Jn=Zs([...Object.keys(n),...I?.reactiveProps??[]],I?.events,n),en=Object.hasOwn(n,"src")||Boolean(I?.reactiveProps?.includes("src")),Xn=Object.hasOwn(n,"source")||Boolean(I?.reactiveProps?.includes("source")),Gn=yn&&(en||Xn)&&(I?.events??[]).every((Te)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(Te.replace(/^@/,"").split(".")[0])),Yn=new Set(["","primary","secondary","outline","ghost","danger"]),Qn=typeof n.variant==="string"?n.variant.trim().toLowerCase():"",es=u._nativeHostAttrs&&/^button$/i.test(G)&&!Yn.has(Qn),Gr=u._targetComponentFallbackNames?.some((Te)=>Te.toLowerCase()===G.toLowerCase())??!1,Bs=Gr&&(!Yt||Ls)&&(!Lt||Qt)&&(!yn||Gn)&&(!zs||Jn)&&!es;for(let Te of Bs?[]:u._targetComponentDirs??[])if(Te&&!$e.includes(Te))$e.push(Te);let tn=typeof u.root==="string"?xe.resolve(u.root):void 0,Yr=tn??xe.dirname(l),nn=[];if(tn)nn.push(xe.resolve(tn,"resources/views/components")),nn.push(xe.resolve(tn,"resources/components")),nn.push(xe.resolve(tn,"src/components")),nn.push(xe.resolve(tn,"components"));nn.push(xe.resolve(import.meta.dir,"components"));for(let Te of nn)if(!$e.includes(Te))$e.push(Te);if(Gr){let Te=(u._componentPackageDirs??[]).filter((gt)=>typeof gt==="string"&&gt.length>0),jt=(Bs?Te.length?Te:u._pluginComponentDirs??[]:u._targetComponentDirs??[]).filter((gt)=>typeof gt==="string"&&gt.length>0);if(jt.length){let gt=$e.slice(lt).map((ut)=>xe.isAbsolute(ut)?ut:xe.resolve(Yr,ut)).filter((ut)=>!jt.includes(ut)),ns=`${G}\x00${gt.join("\x00")}`,kt=Ar.get(ns);if(kt===void 0){kt=!1;for(let ut of gt){for(let zt of ve)if(await s(xe.join(ut,zt))){kt=!0;break}if(kt)break}Ar.set(ns,kt)}if(!kt){for(let ut of jt){let zt=$e.indexOf(ut);if(zt>=0)$e.splice(zt,1)}$e.splice(lt,0,...jt)}}}let Qr=u._pluginComponentDirs;if(Array.isArray(Qr)){for(let Te of Qr)if(typeof Te==="string"&&!$e.includes(Te))$e.push(Te)}if(u.fallbackComponentsDir&&!$e.includes(u.fallbackComponentsDir))$e.push(u.fallbackComponentsDir);if(Bs){for(let Te of u._targetComponentDirs??[])if(Te&&!$e.includes(Te))$e.push(Te)}let ts=u._nativePrimitivesFallback;if(ts&&!ts.except.some((Te)=>Te.toLowerCase()===G.toLowerCase())&&!$e.includes(ts.dir))$e.push(ts.dir);let ei=[...new Set($e.map((Te)=>{if(!Te)return Te;return xe.isAbsolute(Te)?Te:xe.resolve(Yr,Te)}))];$e.length=0,$e.push(...ei);let Ws=`${G}\x00${l}\x00${ei.join("\x00")}`,Fs=Ts.get(Ws);if(Fs)if(await s(Fs))U=Fs;else Ts.delete(Ws);if(!U&&(G.startsWith("./")||G.startsWith("../")))U=xe.resolve(xe.dirname(l),`${G}.stx`),re.push(U);else if(!U)for(let Te of $e){if(!Te)continue;for(let jt of ve){let gt=xe.join(Te,jt);if(re.push(gt),await s(gt)){U=gt;break}}if(U)break;if(!U)try{let jt=await import("fs");if(!jt.statSync(Te,{throwIfNoEntry:!1})?.isDirectory())continue;let ns=8,kt=[{path:Te,depth:0}];while(kt.length>0&&!U){let ut=kt.pop();if(ut.depth>=ns)continue;let zt;try{zt=jt.readdirSync(ut.path,{withFileTypes:!0})}catch{continue}for(let ss of zt){if(!ss.isDirectory())continue;if(ss.name==="node_modules"||ss.name.startsWith("."))continue;let ti=xe.join(ut.path,ss.name);for(let nc of ve){let Vs=xe.join(ti,nc);if(re.push(Vs),await s(Vs)){U=Vs;break}}if(U)break;kt.push({path:ti,depth:ut.depth+1})}}}catch{}if(U)break}if(U)Ts.set(Ws,U)}if(!U||!await s(U))return Ma(e,l,re),Da(e);v.add(U);let ce;if(Wn.has(U)&&Tr.get(U)===Aa(U))ce=Wn.get(U);else try{let pe=Aa(U);ce=await Bun.file(U).text(),Wn.set(U,ce),Tr.set(U,pe)}catch(pe){let ve=pe instanceof Error?pe.message:String(pe);return Ma(e,l,[U],ve),Da(e)}if(I)for(let pe of new Set([...Object.keys(n),...I.reactiveProps??[]])){let ve=pe.toLowerCase();if(ve.startsWith("aria-")||ve.startsWith("data-"))continue;let Me=pe.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${Me}\\b`).test(ce))I.declaredProps.add(pe);if(new RegExp(`\\$props\\s*(?:\\.\\s*${Me}\\b|\\[\\s*['"]${Me}['"]\\s*\\])`).test(ce)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${Me}['"]`).test(ce))I.consumedProps?.add(pe)}if(I?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(ce))for(let pe of I.reactiveProps){if(Dp.has(pe)||I.consumedProps?.has(pe))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${pe.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(ce))continue;let ve=`${U}\x00${pe}`;if(Na.has(ve))continue;Na.add(ve),console.warn(`[stx] ${xe.basename(U)} reads \`${pe}\` with defineProps(), which is not live, but ${xe.basename(l)} binds it (:${pe}): the value can arrive empty or stale (on a native screen, and for a :for's rows, it does not arrive at all). Read it with useReactiveProp('${pe}').`)}let le=new Set(["__originalFilePath","__importedComponents",ls,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),de={};for(let[pe,ve]of Object.entries(a))if(!pe.startsWith("__")||le.has(pe))de[pe]=ve;let Ee=S.length>0?{[ms]:[...S]}:{},Re=r;if(r.includes("@include")){let{processIncludes:pe}=await o("stx/includes",()=>import("./chunk-ry7nh392.js"));Re=await pe(r,a,l,u,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(Re)){let{processComponents:pe}=await o("stx/component-renderer",()=>import("./chunk-7wj6yx6f.js")),ve={...a,__processedComponents:M,...Ee};Re=await pe(Re,ve,l,u,v);let Me=ve.__stx_preserved_client_expressions;if(Array.isArray(Me)&&Me.length>0)a.__stx_preserved_client_expressions=[...new Set([...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Me])]}let we=[];if(Sl(Re)){let{processExpressions:pe}=await o("stx/expressions",()=>import("./chunk-n5ypn9nh.js")),ve=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...Ee}:S.length>0?{...a,...Ee}:a;Re=pe(Re,ve,l);for(let Me of Re.matchAll(/\{\{([\s\S]*?)\}\}/g))we.push(Me[1].trim())}let ge=se(Re),ze=[],Fe=ge.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(pe,ve)=>{let Me=ge.scripts[Number(ve)]||"",$e=Me.match(/^<script\b([^>]*)>/i)?.[1]||"",lt=$e.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Qe=!lt||["module","text/javascript","application/javascript"].includes(lt),Ot=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${$e}`);if(!/\bserver\b/i.test($e)&&Qe&&!Ot)return ze.push(Me),"";return Me}),{extractSlotContent:it}=await o("stx/slots",()=>import("./chunk-4azhfxrm.js")),rt=it(Fe),wt={};if(rt.defaultSlot?.trim())wt.default=rt.defaultSlot;for(let[pe,ve]of rt.namedSlots)wt[pe]=ve.content;let ft=a.__stx_scope_seq??={n:0,key:co(String(a.__filename??l))},ot=Ba(e,process.cwd()),je=`stx_${(ot.endsWith(".stx")?ot.slice(0,-4):ot).replace(/[^a-zA-Z0-9]/g,"_")}_${++ft.n}_${ft.key}`,Ae={...de,$uid:je,$native:u._nativeHostAttrs===!0,...n,props:n,slot:Fe,$slots:wt,__processedComponents:V,__sections:{},__stx_signals_gate:Ne(ce)||Sl(r),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...we]};if(/import\s/.test(ce)){Ae.__importedComponents=new Map(Ae.__importedComponents);let{processESImports:pe}=await o("stx/component-renderer",()=>import("./chunk-7wj6yx6f.js"));ce=await pe(ce,Ae,U,u,v)}jp(ce,Ae,n);let dt=ce,nt=B(dt);if(nt)dt=nt.content.trim();let pn=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Pt=[...ce.matchAll(pn)];for(let[,pe,ve]of Pt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(pe))We(ve,U,u.strict);let vt=[],fn=null,js=Pt.some((pe)=>/\bserver\b/.test(pe[1]||"")&&/\bcache\b/.test(pe[1]||"")),Jt=null,Rt=null,dn=null,Un=0,gn=null;if(Rp(u),js&&Vr>0){let pe=Tp({props:n,slot:Re,slotContext:r.trim()?Ap(de):void 0,buildMode:u.buildMode??"",skipEventDirectives:u.skipEventDirectives===!0,native:u._nativeHostAttrs===!0,clientLoopNames:[...S].sort(),layers:u._layerGraph?.layers.map((ve)=>ve.configFile),uid:je});if(pe!==null){Jt=`${U}\x00${E(ce)}\x00${pe}`;let ve=As.get(Jt);if(ve){for(let Me of ve.dependencies)v.add(Me);if(Ji(a,ve.clientFactories),ft.n+=ve.uidsConsumed,ve.preservedClientExpressions.length>0){let Me=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let $e of ve.preservedClientExpressions)Me.add($e);a.__stx_preserved_client_expressions=[...Me]}return ve.output}Rt=new Set(v),dn=qi(a),Un=ft.n,gn=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let mn=new Set;for(let pe of Pt){let ve=pe[1]||"",Me=pe[2]||"",$e=ve.includes("server");if(Xe(ve)&&Me.trim())Me=Je(Me);if($e&&Me){for(let Qe of ye(Me))mn.add(Qe);try{await L(Me,Ae,U,{onFailure:(Qe)=>{if(Qe.kind!=="unknown")fn=Qe.kind}})}catch(Qe){}}if(!$e){let Qe=Me.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),Ot=Qe.includes("{{")&&Qe.includes("}}"),Yt=Qe.includes("{!!")&&Qe.includes("!!}");if(Ot||Yt)Qe=Ui(Qe,Ae,U);let Dt=ve.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");vt.push(`<script${Dt}>${Qe}</script>`)}}let St=se(ce).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),hn=St?St[1]:"",Ps=St?St[2]:"",Tt="",ue=hn&&/\bscoped\b/i.test(hn);if(St)Tt=`<style${hn}>${Mp(Ps,Ae,U)}</style>`;let fe=dt;if(fe=fe.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),St)fe=fe.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let pe=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,ve=[];if(fe=fe.replace(pe,(Me,$e)=>{let lt=$e.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(lt)ve.push(`<style${lt[1]}>${lt[2]}</style>`);return""}),fe=fe.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),ve.length>0)Tt=`${Tt}${ve.join(`
1187
- `)}`}if(r&&fe.includes("{{ text || slot }}"))fe=fe.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>r);let{applySlots:Se}=await o("stx/slots",()=>import("./chunk-4azhfxrm.js")),{defaultSlot:Be,namedSlots:tt}=rt,at=a.__stx_signals_gate===!0&&/\s(?:@[\w:.-]+|x-on:[\w:.-]+)\s*=/.test(Fe),Et=vt.length>0&&fr(fe)||u._nativeHostAttrs===!0&&vt.length>0||at&&vt.length>0||vt.some((pe)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(pe)),Ms=(pe)=>Et?Vo(pe,je):pe,Ds=new Map([...tt].map(([pe,ve])=>[pe,{...ve,content:Ms(ve.content)}]));fe=await Se(fe,Et?Fo(Ms(Be),je):Be,Ds,Ae,Et?je:"");let Hn=Hi(vt),xn=(Array.isArray(Ae.__stx_client_signal_names)?Ae.__stx_client_signal_names:[]).filter((pe)=>!mn.has(pe));if(Hn.length>0||xn.length>0)Ae.__stx_client_signal_names=[...new Set([...xn,...Hn])];else delete Ae.__stx_client_signal_names;let bn=S.filter((pe)=>!mn.has(pe)&&!(pe in n));if(bn.length>0)Ae[ms]=bn;let Kn={...u,_rootComponentsDir:u._rootComponentsDir||u.componentsDir,componentsDir:xe.dirname(U),skipSignalsRuntime:!0,skipEventDirectives:u._nativeHostAttrs===!0||Et||vt.length===0,defaultLayout:void 0};Ae.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:qn}=await o("stx/process",()=>import("./chunk-sccjcyb9.js")),At=await qn(fe,Ae,U,Kn,v),Mt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let pe of At.matchAll(/\{\{([\s\S]*?)\}\}/g))Mt.add(pe[1].trim());if(Mt.size>0)a.__stx_preserved_client_expressions=[...Mt];let It=je,ct=At;if(Et){let pe="";if(Object.keys(n).length>0)try{pe=` data-stx-props="${Cr(JSON.stringify(n))}"`}catch{}let ve=Z?` stx-hydrate="${Cr(Z)}"`:"",Me=Object.fromEntries(Object.entries(wt).map(([Lt,Qt])=>[Lt,Boolean(Qt)])),$e=Object.keys(Me).length>0?` data-stx-slots="${Cr(JSON.stringify(Me))}"`:"",lt=` data-stx-scope="${It}"${pe}${$e}${ve}`,Qe=At.slice(Ut(At)),Ot=/^<span(?=[\s/>])/i.test(Qe),Yt=/^<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(Qe),Dt=/^<[^>]+\bdata-stx-fill-root(?:\s|=|>)/i.test(Qe),Zn=Ot?"span":"div",Ns=Yt&&u._nativeHostAttrs?' style="display:flex;flex-direction:column;flex:1;min-height:0;min-width:0"':Dt&&u._nativeHostAttrs?' style="width:100%;height:100%"':Ot||Yt?' style="display:contents"':"";ct=Ug(At,lt)??`<${Zn}${lt} data-stx-component-wrapper${Ns}>${At}</${Zn}>`;let Ls=await Promise.all(vt.map(async(Lt)=>{let Qt=Lt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!Qt)return Lt;let[,yn,zs]=Qt,Jn=Ta(Lt,Ae,U);if(Jn!==null)return Jn;let en=await Lp(zs,U,u.buildMode==="compile"),Xn=An(en.clientCode,Ke(Ae)),{vendorStyleTags:Gn}=en,Yn=Xn?`function(__scopeId) {
1186
+ `)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${u}${f}`)}function Da(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var Dp=new Set(["for","if","show","key","ref","class","className","style"]),Na=new Set,Fa="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",kl=new RegExp(`\\b(?:${Fa})\\s*(?:<[^>]*>)?\\s*\\(`);function Hi(e){let n=new Set,r=new RegExp(`\\b(?:const|let|var)\\s+([a-zA-Z_$][\\w$]*)\\s*=\\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue|${Fa})\\s*(?:<[^>]*>)?\\s*\\(`,"g");for(let i of e){let a;while((a=r.exec(i))!==null)n.add(a[1]);r.lastIndex=0}return[...n]}async function Ye(e,n,r,i,a,l,u,f=new Set,v,S=mt(a),I,j=e){let{extractVariables:L}=await o("stx/variable-extractor",()=>import("./chunk-qfxy34d4.js")),M=f??new Set;if(M.has(e))return`[Circular component reference: ${e}]`;let V=new Set(M);V.add(e);let W=typeof n.client==="string"?n.client.trim():"";if("client"in n)delete n.client;let Z=W&&W!=="load"&&Wg(W)?W:"";try{let q=(pe)=>pe.split("-").map((ve)=>ve.charAt(0).toUpperCase()+ve.slice(1)).join(""),G=j.endsWith(".stx")?j.slice(0,-4):j,U=null,H=a.__importedComponents;if(H){let pe=[G,G.toLowerCase(),q(G),J(G)];for(let ve of pe)if(H.has(ve)){U=H.get(ve);break}}let re=[];if(!U){let pe=[`${G}.stx`,`${q(G)}.stx`,`${J(G)}.stx`],ve=[...new Set(pe)],Me=a.__originalFilePath,$e=[];for(let Te of rs(l))if(!$e.includes(Te))$e.push(Te);let lt=$e.length;for(let Te of u._layerComponentDirs??[])if(!$e.includes(Te))$e.push(Te);if(Me){let Te=xe.join(xe.dirname(Me),"components");$e.push(Te)}let Qe=u._rootComponentsDir;if(typeof Qe==="string"&&Wa(i,u)&&!$e.includes(Qe))$e.push(Qe);if(i&&!$e.includes(i))$e.push(i);if(typeof Qe==="string"&&!$e.includes(Qe))$e.push(Qe);let Ot=xe.join(xe.dirname(l),"components");if(!$e.includes(Ot))$e.push(Ot);if(u.componentsDir&&u.componentsDir!==i&&!$e.includes(u.componentsDir))$e.push(u.componentsDir);for(let Te of u.additionalComponentsDirs??[])if(Te&&!$e.includes(Te))$e.push(Te);let Yt=u._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(G),Dt=(I?.events??[]).map((Te)=>Te.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),Zn=Object.hasOwn(n,"checked")||Boolean(I?.reactiveProps?.includes("checked")),Ns=Object.hasOwn(n,"value")||Boolean(I?.reactiveProps?.includes("value")),Ls=!Dt.includes("valuechange")&&(Zn||Dt.includes("change")&&!Ns),Lt=u._nativeHostAttrs&&/^textinput$/i.test(G),Qt=Dt.includes("update:value")&&!Dt.includes("input"),yn=u._nativeHostAttrs&&/^video$/i.test(G),zs=u._nativeHostAttrs&&/^image$/i.test(G),Jn=Zs([...Object.keys(n),...I?.reactiveProps??[]],I?.events,n),en=Object.hasOwn(n,"src")||Boolean(I?.reactiveProps?.includes("src")),Xn=Object.hasOwn(n,"source")||Boolean(I?.reactiveProps?.includes("source")),Gn=yn&&(en||Xn)&&(I?.events??[]).every((Te)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(Te.replace(/^@/,"").split(".")[0])),Yn=new Set(["","primary","secondary","outline","ghost","danger"]),Qn=typeof n.variant==="string"?n.variant.trim().toLowerCase():"",es=u._nativeHostAttrs&&/^button$/i.test(G)&&!Yn.has(Qn),Gr=u._targetComponentFallbackNames?.some((Te)=>Te.toLowerCase()===G.toLowerCase())??!1,Bs=Gr&&(!Yt||Ls)&&(!Lt||Qt)&&(!yn||Gn)&&(!zs||Jn)&&!es;for(let Te of Bs?[]:u._targetComponentDirs??[])if(Te&&!$e.includes(Te))$e.push(Te);let tn=typeof u.root==="string"?xe.resolve(u.root):void 0,Yr=tn??xe.dirname(l),nn=[];if(tn)nn.push(xe.resolve(tn,"resources/views/components")),nn.push(xe.resolve(tn,"resources/components")),nn.push(xe.resolve(tn,"src/components")),nn.push(xe.resolve(tn,"components"));nn.push(xe.resolve(import.meta.dir,"components"));for(let Te of nn)if(!$e.includes(Te))$e.push(Te);if(Gr){let Te=(u._componentPackageDirs??[]).filter((gt)=>typeof gt==="string"&&gt.length>0),jt=(Bs?Te.length?Te:u._pluginComponentDirs??[]:u._targetComponentDirs??[]).filter((gt)=>typeof gt==="string"&&gt.length>0);if(jt.length){let gt=$e.slice(lt).map((ut)=>xe.isAbsolute(ut)?ut:xe.resolve(Yr,ut)).filter((ut)=>!jt.includes(ut)),ns=`${G}\x00${gt.join("\x00")}`,kt=Ar.get(ns);if(kt===void 0){kt=!1;for(let ut of gt){for(let zt of ve)if(await s(xe.join(ut,zt))){kt=!0;break}if(kt)break}Ar.set(ns,kt)}if(!kt){for(let ut of jt){let zt=$e.indexOf(ut);if(zt>=0)$e.splice(zt,1)}$e.splice(lt,0,...jt)}}}let Qr=u._pluginComponentDirs;if(Array.isArray(Qr)){for(let Te of Qr)if(typeof Te==="string"&&!$e.includes(Te))$e.push(Te)}if(u.fallbackComponentsDir&&!$e.includes(u.fallbackComponentsDir))$e.push(u.fallbackComponentsDir);if(Bs){for(let Te of u._targetComponentDirs??[])if(Te&&!$e.includes(Te))$e.push(Te)}let ts=u._nativePrimitivesFallback;if(ts&&!ts.except.some((Te)=>Te.toLowerCase()===G.toLowerCase())&&!$e.includes(ts.dir))$e.push(ts.dir);let ei=[...new Set($e.map((Te)=>{if(!Te)return Te;return xe.isAbsolute(Te)?Te:xe.resolve(Yr,Te)}))];$e.length=0,$e.push(...ei);let Ws=`${G}\x00${l}\x00${ei.join("\x00")}`,Fs=Ts.get(Ws);if(Fs)if(await s(Fs))U=Fs;else Ts.delete(Ws);if(!U&&(G.startsWith("./")||G.startsWith("../")))U=xe.resolve(xe.dirname(l),`${G}.stx`),re.push(U);else if(!U)for(let Te of $e){if(!Te)continue;for(let jt of ve){let gt=xe.join(Te,jt);if(re.push(gt),await s(gt)){U=gt;break}}if(U)break;if(!U)try{let jt=await import("fs");if(!jt.statSync(Te,{throwIfNoEntry:!1})?.isDirectory())continue;let ns=8,kt=[{path:Te,depth:0}];while(kt.length>0&&!U){let ut=kt.pop();if(ut.depth>=ns)continue;let zt;try{zt=jt.readdirSync(ut.path,{withFileTypes:!0})}catch{continue}for(let ss of zt){if(!ss.isDirectory())continue;if(ss.name==="node_modules"||ss.name.startsWith("."))continue;let ti=xe.join(ut.path,ss.name);for(let nc of ve){let Vs=xe.join(ti,nc);if(re.push(Vs),await s(Vs)){U=Vs;break}}if(U)break;kt.push({path:ti,depth:ut.depth+1})}}}catch{}if(U)break}if(U)Ts.set(Ws,U)}if(!U||!await s(U))return Ma(e,l,re),Da(e);v.add(U);let ce;if(Wn.has(U)&&Tr.get(U)===Aa(U))ce=Wn.get(U);else try{let pe=Aa(U);ce=await Bun.file(U).text(),Wn.set(U,ce),Tr.set(U,pe)}catch(pe){let ve=pe instanceof Error?pe.message:String(pe);return Ma(e,l,[U],ve),Da(e)}if(I)for(let pe of new Set([...Object.keys(n),...I.reactiveProps??[]])){let ve=pe.toLowerCase();if(ve.startsWith("aria-")||ve.startsWith("data-"))continue;let Me=pe.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${Me}\\b`).test(ce))I.declaredProps.add(pe);if(new RegExp(`\\$props\\s*(?:\\.\\s*${Me}\\b|\\[\\s*['"]${Me}['"]\\s*\\])`).test(ce)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${Me}['"]`).test(ce))I.consumedProps?.add(pe)}if(I?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(ce))for(let pe of I.reactiveProps){if(Dp.has(pe)||I.consumedProps?.has(pe))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${pe.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(ce))continue;let ve=`${U}\x00${pe}`;if(Na.has(ve))continue;Na.add(ve),console.warn(`[stx] ${xe.basename(U)} reads \`${pe}\` with defineProps(), which is not live, but ${xe.basename(l)} binds it (:${pe}): the value can arrive empty or stale (on a native screen, and for a :for's rows, it does not arrive at all). Read it with useReactiveProp('${pe}').`)}let le=new Set(["__originalFilePath","__importedComponents",ls,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),de={};for(let[pe,ve]of Object.entries(a))if(!pe.startsWith("__")||le.has(pe))de[pe]=ve;let Ee=S.length>0?{[ms]:[...S]}:{},Re=r;if(r.includes("@include")){let{processIncludes:pe}=await o("stx/includes",()=>import("./chunk-2shw0j2q.js"));Re=await pe(r,a,l,u,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(Re)){let{processComponents:pe}=await o("stx/component-renderer",()=>import("./chunk-j1ncsbk2.js")),ve={...a,__processedComponents:M,...Ee};Re=await pe(Re,ve,l,u,v);let Me=ve.__stx_preserved_client_expressions;if(Array.isArray(Me)&&Me.length>0)a.__stx_preserved_client_expressions=[...new Set([...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Me])]}let we=[];if(Sl(Re)){let{processExpressions:pe}=await o("stx/expressions",()=>import("./chunk-fsehzmg8.js")),ve=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...Ee}:S.length>0?{...a,...Ee}:a;Re=pe(Re,ve,l);for(let Me of Re.matchAll(/\{\{([\s\S]*?)\}\}/g))we.push(Me[1].trim())}let ge=se(Re),ze=[],Fe=ge.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(pe,ve)=>{let Me=ge.scripts[Number(ve)]||"",$e=Me.match(/^<script\b([^>]*)>/i)?.[1]||"",lt=$e.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Qe=!lt||["module","text/javascript","application/javascript"].includes(lt),Ot=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${$e}`);if(!/\bserver\b/i.test($e)&&Qe&&!Ot)return ze.push(Me),"";return Me}),{extractSlotContent:it}=await o("stx/slots",()=>import("./chunk-rryzw9x7.js")),rt=it(Fe),wt={};if(rt.defaultSlot?.trim())wt.default=rt.defaultSlot;for(let[pe,ve]of rt.namedSlots)wt[pe]=ve.content;let ft=a.__stx_scope_seq??={n:0,key:co(String(a.__filename??l))},ot=Ba(e,process.cwd()),je=`stx_${(ot.endsWith(".stx")?ot.slice(0,-4):ot).replace(/[^a-zA-Z0-9]/g,"_")}_${++ft.n}_${ft.key}`,Ae={...de,$uid:je,$native:u._nativeHostAttrs===!0,...n,props:n,slot:Fe,$slots:wt,__processedComponents:V,__sections:{},__stx_signals_gate:Ne(ce)||Sl(r),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...we]};if(/import\s/.test(ce)){Ae.__importedComponents=new Map(Ae.__importedComponents);let{processESImports:pe}=await o("stx/component-renderer",()=>import("./chunk-j1ncsbk2.js"));ce=await pe(ce,Ae,U,u,v)}jp(ce,Ae,n);let dt=ce,nt=B(dt);if(nt)dt=nt.content.trim();let pn=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Pt=[...ce.matchAll(pn)];for(let[,pe,ve]of Pt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(pe))We(ve,U,u.strict);let vt=[],fn=null,js=Pt.some((pe)=>/\bserver\b/.test(pe[1]||"")&&/\bcache\b/.test(pe[1]||"")),Jt=null,Rt=null,dn=null,Un=0,gn=null;if(Rp(u),js&&Vr>0){let pe=Tp({props:n,slot:Re,slotContext:r.trim()?Ap(de):void 0,buildMode:u.buildMode??"",skipEventDirectives:u.skipEventDirectives===!0,native:u._nativeHostAttrs===!0,clientLoopNames:[...S].sort(),layers:u._layerGraph?.layers.map((ve)=>ve.configFile),uid:je});if(pe!==null){Jt=`${U}\x00${E(ce)}\x00${pe}`;let ve=As.get(Jt);if(ve){for(let Me of ve.dependencies)v.add(Me);if(Ji(a,ve.clientFactories),ft.n+=ve.uidsConsumed,ve.preservedClientExpressions.length>0){let Me=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let $e of ve.preservedClientExpressions)Me.add($e);a.__stx_preserved_client_expressions=[...Me]}return ve.output}Rt=new Set(v),dn=qi(a),Un=ft.n,gn=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let mn=new Set;for(let pe of Pt){let ve=pe[1]||"",Me=pe[2]||"",$e=ve.includes("server");if(Xe(ve)&&Me.trim())Me=Je(Me);if($e&&Me){for(let Qe of ye(Me))mn.add(Qe);try{await L(Me,Ae,U,{onFailure:(Qe)=>{if(Qe.kind!=="unknown")fn=Qe.kind}})}catch(Qe){}}if(!$e){let Qe=Me.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),Ot=Qe.includes("{{")&&Qe.includes("}}"),Yt=Qe.includes("{!!")&&Qe.includes("!!}");if(Ot||Yt)Qe=Ui(Qe,Ae,U);let Dt=ve.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");vt.push(`<script${Dt}>${Qe}</script>`)}}let St=se(ce).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),hn=St?St[1]:"",Ps=St?St[2]:"",Tt="",ue=hn&&/\bscoped\b/i.test(hn);if(St)Tt=`<style${hn}>${Mp(Ps,Ae,U)}</style>`;let fe=dt;if(fe=fe.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),St)fe=fe.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let pe=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,ve=[];if(fe=fe.replace(pe,(Me,$e)=>{let lt=$e.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(lt)ve.push(`<style${lt[1]}>${lt[2]}</style>`);return""}),fe=fe.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),ve.length>0)Tt=`${Tt}${ve.join(`
1187
+ `)}`}if(r&&fe.includes("{{ text || slot }}"))fe=fe.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>r);let{applySlots:Se}=await o("stx/slots",()=>import("./chunk-rryzw9x7.js")),{defaultSlot:Be,namedSlots:tt}=rt,at=a.__stx_signals_gate===!0&&/\s(?:@[\w:.-]+|x-on:[\w:.-]+)\s*=/.test(Fe),Et=vt.length>0&&fr(fe)||u._nativeHostAttrs===!0&&vt.length>0||at&&vt.length>0||vt.some((pe)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(pe)),Ms=(pe)=>Et?Vo(pe,je):pe,Ds=new Map([...tt].map(([pe,ve])=>[pe,{...ve,content:Ms(ve.content)}]));fe=await Se(fe,Et?Fo(Ms(Be),je):Be,Ds,Ae,Et?je:"");let Hn=Hi(vt),xn=(Array.isArray(Ae.__stx_client_signal_names)?Ae.__stx_client_signal_names:[]).filter((pe)=>!mn.has(pe));if(Hn.length>0||xn.length>0)Ae.__stx_client_signal_names=[...new Set([...xn,...Hn])];else delete Ae.__stx_client_signal_names;let bn=S.filter((pe)=>!mn.has(pe)&&!(pe in n));if(bn.length>0)Ae[ms]=bn;let Kn={...u,_rootComponentsDir:u._rootComponentsDir||u.componentsDir,componentsDir:xe.dirname(U),skipSignalsRuntime:!0,skipEventDirectives:u._nativeHostAttrs===!0||Et||vt.length===0,defaultLayout:void 0};Ae.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:qn}=await o("stx/process",()=>import("./chunk-cgxmgjk4.js")),At=await qn(fe,Ae,U,Kn,v),Mt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let pe of At.matchAll(/\{\{([\s\S]*?)\}\}/g))Mt.add(pe[1].trim());if(Mt.size>0)a.__stx_preserved_client_expressions=[...Mt];let It=je,ct=At;if(Et){let pe="";if(Object.keys(n).length>0)try{pe=` data-stx-props="${Cr(JSON.stringify(n))}"`}catch{}let ve=Z?` stx-hydrate="${Cr(Z)}"`:"",Me=Object.fromEntries(Object.entries(wt).map(([Lt,Qt])=>[Lt,Boolean(Qt)])),$e=Object.keys(Me).length>0?` data-stx-slots="${Cr(JSON.stringify(Me))}"`:"",lt=` data-stx-scope="${It}"${pe}${$e}${ve}`,Qe=At.slice(Ut(At)),Ot=/^<span(?=[\s/>])/i.test(Qe),Yt=/^<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(Qe),Dt=/^<[^>]+\bdata-stx-fill-root(?:\s|=|>)/i.test(Qe),Zn=Ot?"span":"div",Ns=Yt&&u._nativeHostAttrs?' style="display:flex;flex-direction:column;flex:1;min-height:0;min-width:0"':Dt&&u._nativeHostAttrs?' style="width:100%;height:100%"':Ot||Yt?' style="display:contents"':"";ct=Ug(At,lt)??`<${Zn}${lt} data-stx-component-wrapper${Ns}>${At}</${Zn}>`;let Ls=await Promise.all(vt.map(async(Lt)=>{let Qt=Lt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!Qt)return Lt;let[,yn,zs]=Qt,Jn=Ta(Lt,Ae,U);if(Jn!==null)return Jn;let en=await Lp(zs,U,u.buildMode==="compile"),Xn=An(en.clientCode,Ke(Ae)),{vendorStyleTags:Gn}=en,Yn=Xn?`function(__scopeId) {
1188
1188
  ${Xn}
1189
1189
  return (${en.factoryBody})(__scopeId);
1190
1190
  }`:en.factoryBody,Qn=Z?null:ir(a,Yn),es=Qn?`window.__stxComponentFactories[${JSON.stringify(Qn)}](${JSON.stringify(It)});`:`(${Yn})(${JSON.stringify(It)});`;if(Z)return`${Gn}<script type="stx/island" data-stx-island="${It}" data-stx-scoped data-stx-owner="${It}"${yn}>${me(es)}</script>`;return`${Gn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${It}"${yn}>${me(es)}</script>`}));if(ct=ct+`
@@ -1210,7 +1210,7 @@ ${He.yellow}${He.bold}Message:${He.reset} ${n}
1210
1210
  `,f)I+=`
1211
1211
  ${He.blue}${He.bold}Context:${He.reset}
1212
1212
  ${He.dim}${f}${He.reset}
1213
- `;return I}function Ce(){Wn.clear(),Tr.clear(),Ts.clear(),Ar.clear(),Pr.clear(),Wr.clear(),As.clear()}function $y(){return{size:Wn.size,maxSize:500}}var Rr=k(128);async function Lp(e,n,r){let i=E(e,n,r),a=Rr.get(i);if(a){if(Qs(a.deps))return a;Rr.delete(i)}let l=Fi(e,{filePath:n,projectRoot:process.cwd()}),u=l.code,f=zi(l.styles);u=Xt(u).code;let{hasUserImports:v,bundleClientScript:S}=await o("stx/client-script-bundler",()=>import("./chunk-gz7egees.js")),I=[],j=!1;if(v(u)){let G=u;u=await S(G,n,{projectRoot:process.cwd(),minify:r,collectInputs:I}),j=u===G}let{stripStxRuntimeImports:L}=await o("stx/signal-processing",()=>import("./chunk-4s2x5p6r.js"));u=L(u);let M=D(u),V=Op(M),W=new Set(X(M,!0).split(",").map((G)=>G.trim())),Z=`function(__scopeId) {
1213
+ `;return I}function Ce(){Wn.clear(),Tr.clear(),Ts.clear(),Ar.clear(),Pr.clear(),Wr.clear(),As.clear()}function $y(){return{size:Wn.size,maxSize:500}}var Rr=k(128);async function Lp(e,n,r){let i=E(e,n,r),a=Rr.get(i);if(a){if(Qs(a.deps))return a;Rr.delete(i)}let l=Fi(e,{filePath:n,projectRoot:process.cwd()}),u=l.code,f=zi(l.styles);u=Xt(u).code;let{hasUserImports:v,bundleClientScript:S}=await o("stx/client-script-bundler",()=>import("./chunk-jytqf6p6.js")),I=[],j=!1;if(v(u)){let G=u;u=await S(G,n,{projectRoot:process.cwd(),minify:r,collectInputs:I}),j=u===G}let{stripStxRuntimeImports:L}=await o("stx/signal-processing",()=>import("./chunk-s5j4fpdr.js"));u=L(u);let M=D(u),V=Op(M),W=new Set(X(M,!0).split(",").map((G)=>G.trim())),Z=`function(__scopeId) {
1214
1214
  ${xt("const",[...Bl,...V],M)}
1215
1215
  const __scope = window.stx._scopes = window.stx._scopes || {};
1216
1216
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{si,oi,ii,cy,Ts,ly}from"./chunk-xqb0rzk1.js";export{Ts as clearImageDeliveryCatalog,cy as deliveredImage,ii as efficientDeliverySources,si as getImageDelivery,oi as isTransparentImage,ly as prepareImageDelivery};
2
+ import{si,oi,ii,cy,Ts,ly}from"./chunk-6kn2vwtn.js";export{Ts as clearImageDeliveryCatalog,cy as deliveredImage,ii as efficientDeliverySources,si as getImageDelivery,oi as isTransparentImage,ly as prepareImageDelivery};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ja,Ya,Za,Qa,Qh}from"./chunk-q4dcchrt.js";import"./chunk-whcrca58.js";import"./chunk-xdrp6d7e.js";import"./chunk-pvm48tse.js";import"./chunk-b9npgke0.js";import"./chunk-nw2zjwcg.js";import"./chunk-5xq6eky7.js";import"./chunk-05x1rd86.js";import"./chunk-6kn2vwtn.js";import"./chunk-a1s0tfcd.js";import"./chunk-ns2d6pb9.js";import"./chunk-80ky40mm.js";import"./chunk-g8p4sjy4.js";import"./chunk-mr34w48c.js";import"./chunk-9rjgq8k4.js";import"./chunk-s94gqce0.js";import"./chunk-n6q1d66k.js";import"./chunk-qcbj1m21.js";import"./chunk-zy97etqx.js";import"./chunk-q0y8gv18.js";import"./chunk-rb2zbdqd.js";import"./chunk-t3zmfh8w.js";import"./chunk-qe0t0m38.js";import"./chunk-0vrt55pp.js";import"./chunk-4wh71ddp.js";import"./chunk-41z7f41b.js";import"./chunk-xmg6bmh6.js";import"./chunk-vk2jy6mn.js";import"./chunk-3b3mkgpj.js";import"./chunk-0jdz31q1.js";import"./chunk-cphc60zw.js";export{Ja as buildNative,Qh as default,Ya as findCraftBinary,Qa as getAvailableFormats,Za as getAvailableTargets};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{Ze,z,Jt}from"./chunk-41z7f41b.js";import{T}from"./chunk-0jdz31q1.js";import{Tt,je,U,st,Be,Da,Lo,La,Kn}from"./chunk-dtpxzcrw.js";import{Dt,Se,pt}from"./chunk-qe0t0m38.js";import{Qo}from"./chunk-tkjjyh6k.js";import{Gn}from"./chunk-nq60tjkz.js";import{Re}from"./chunk-gdyjd163.js";import Z from"fs";import P from"path";var{serve:ae}=globalThis.Bun;import O from"zlib";import{promisify as Y}from"util";var K=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],ee=["text/event-stream","multipart/x-mixed-replace"],te=1024;function ne(t){if(!t)return!1;let e=t.toLowerCase();if(ee.some((a)=>e.startsWith(a)))return!1;return K.some((a)=>e.startsWith(a))}function re(t){let e=new Map;for(let a of t.split(",")){let[r,...i]=a.trim().split(";"),f=r.trim().toLowerCase();if(!f)continue;let h=1;for(let g of i){let l=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(g);if(!l)continue;let m=Number.parseFloat(l[1]);if(Number.isFinite(m))h=m}e.set(f,h)}return e}function se(t){if(!t)return null;let e=re(t),a=e.get("*"),r=(i)=>e.get(i)??a??0;if(r("br")>0)return"br";if(r("gzip")>0)return"gzip";return null}var J=33554432,V=new Map,D=0;function oe(t,e){if(e.length>J/8)return;V.set(t,e),D+=e.length;for(let[a,r]of V){if(D<=J)break;V.delete(a),D-=r.length}}async function Vn(t,e,a={}){if(e.headers.get("content-encoding"))return e;if(e.status===204||e.status===304||!e.body)return e;if(!ne(e.headers.get("content-type")))return e;let r=se(t.headers.get("accept-encoding"));if(!r)return e;let i;try{i=new Uint8Array(await e.arrayBuffer())}catch{return e}let f=()=>new Response(i,{status:e.status,statusText:e.statusText,headers:Q(e.headers)});if(i.length<(a.threshold??te))return f();try{let h=a.quality??5,g=`${r}:${h}:${i.length}:${Bun.hash(i)}`,l=V.get(g);if(!l)l=r==="br"?await Y(O.brotliCompress)(i,{params:{[O.constants.BROTLI_PARAM_QUALITY]:h,[O.constants.BROTLI_PARAM_SIZE_HINT]:i.length}}):await Y(O.gzip)(i),oe(g,l);if(l.length>=i.length)return f();let m=Q(e.headers);return m.set("Content-Encoding",r),m.set("Content-Length",String(l.length)),new Response(l,{status:e.status,statusText:e.statusText,headers:m})}catch{return f()}}function Q(t){let e=new Headers(t),a=e.get("Vary");if(!a)return e.set("Vary","Accept-Encoding"),e;if(!a.split(",").some((i)=>i.trim().toLowerCase()==="accept-encoding"))e.set("Vary",`${a}, Accept-Encoding`);return e}class G{now;entries=new T(1000,{maxBytes:33554432,sizeOf:(t)=>t.body.byteLength+JSON.stringify(t.headers).length*2});pending=new Map;generation=0;constructor(t=Date.now){this.now=t}invalidate(t){this.generation++,this.pending.clear();for(let e of Array.from(this.entries.keys()))if(t===void 0||this.entries.get(e)?.path===t)this.entries.delete(e)}async respond(t,e,a){let r,i=async()=>{let s=r??await a();return s.headers.set("Cache-Control","private, no-store"),s.headers.set("Vary",U(s.headers.get("Vary")).Vary),s};if(!e||t.method!=="GET"||t.headers.has("Cookie")||t.headers.has("Authorization")||t.headers.has("Range"))return i();let f=new URL(t.url),h=`${f.origin}${f.pathname}${f.search}|${je(t)?"fragment":"document"}`,g=this.entries.get(h),l=(s)=>{let b=new Headers(s.headers);return b.set("Cache-Control","private, no-store"),b.set("Age",String(Math.max(0,Math.floor((this.now()-s.created)/1000)))),new Response(s.body.slice(0),{headers:b})},m=g?(this.now()-g.created)/1000:1/0;if(g&&m<e.maxAge)return l(g);let v=this.generation,_=async()=>{let s=await a();r=s;let b=(s.headers.get("Vary")??"").toLowerCase().split(",").map((y)=>y.trim()).filter(Boolean);if(s.status!==200||s.headers.has("Set-Cookie")||/(?:private|no-store|no-cache)/i.test(s.headers.get("Cache-Control")??"")||b.some((y)=>y!=="x-stx-router"&&y!=="accept-encoding"))return null;let E=await s.clone().arrayBuffer();if(E.byteLength>1048576)return null;s.headers.set("Vary",U(s.headers.get("Vary")).Vary);let n={body:E,headers:Array.from(s.headers.entries()),created:this.now(),path:f.pathname};if(this.generation===v)this.entries.set(h,n);return n},x=this.pending.get(h);if(!x){if(this.pending.size>=1000)return i();x=_().finally(()=>{if(this.pending.get(h)===x)this.pending.delete(h)}),this.pending.set(h,x)}if(g&&m<e.maxAge+(e.swr??0))return x.catch(()=>{}),l(g);let M=await x;return M?l(M):i()}}var ie={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".json":"application/json",".html":"text/html",".txt":"text/plain",".xml":"application/xml",".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".svg":"image/svg+xml",".ico":"image/x-icon",".bmp":"image/bmp",".mp4":"video/mp4",".webm":"video/webm",".ogg":"audio/ogg",".mp3":"audio/mpeg",".wav":"audio/wav",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"};async function Cm(t={}){let e=P.resolve(t.outputDir||".output"),a=t.port??3000,r=Da(e);if(!r)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${r.routes.length} routes...`);let i=Gn(r.routeRules),f=new G,h=Qo(e,r.apiRoutes??[]),g=Bun.file(P.join(e,"server/runtime-config.json")),l=t.runtimeConfig??(await g.exists()?await g.json():void 0),m=l?z(l):void 0,v=new Map,_=new Map,x=new Map,M=new Map;for(let n of r.routes)try{let y=P.join(e,n.compiledPath),c=JSON.parse(await Bun.file(y).text());if(m)c.html=Jt(c.html,m);v.set(n.pattern,c),x.set(n.pattern,pt(c.html)),M.set(n.pattern,Re(c.html));let j=P.join(e,n.fragmentPath);if(st(c.html,r.routerContainer||"main")&&await Bun.file(j).exists()){let A=await Bun.file(j).text();_.set(n.pattern,m?Jt(A,m):A)}}catch(y){console.warn(`[stx] Failed to load route ${n.pattern}:`,y)}let s=new Map,b=[];for(let n of r.routes)if(n.hasParams){let{regex:y,params:c}=Se(n.pattern,{page:!0});b.push({regex:y,route:n,paramNames:c})}else s.set(n.pattern,n);let E=ae({port:a,async fetch(n){return Vn(n,await Ze(m??z(),async()=>{let c=new URL(n.url).pathname;if(t.onRequest){let p=await t.onRequest(n);if(p)return p}if(t.apiRouter){let p=await t.apiRouter.handleRequest(n);if(p.status!==404)return p}if(t.apiRoutes?.[c])return t.apiRoutes[c](n);let j=await h(n);if(j)return j;if((n.method==="GET"||n.method==="HEAD")&&c!=="/"){let p=P.resolve(e,"public"),d;try{d=decodeURIComponent(c)}catch{d=c}if(!d.includes("\x00")){let u=P.resolve(p,`.${d}`);if(u===p||u.startsWith(`${p}${P.sep}`))try{if(Z.existsSync(u)&&Z.statSync(u).isFile()){let R=P.extname(u).toLowerCase(),B=ie[R]||"application/octet-stream",X=c.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(c);return new Response(Bun.file(u),{headers:{"Content-Type":B,"Cache-Control":X?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let A=je(n),C=null,q={};if(C=s.get(c)||null,!C)for(let{regex:p,route:d,paramNames:u}of b){let o=c.match(p);if(o){C=d,u.forEach((R,B)=>{q[R]=o[B+1]});break}}if(!C){let p=Dt(c)?null:s.get("/404")||null;if(p){let d=v.get(p.pattern);if(d)return new Response(d.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}})}let N=i(c),W=Object.keys(N).length>0;return f.respond(n,N.cache,async()=>{let p=v.get(C.pattern);if(A&&n.method==="GET"&&p&&!p.hasServerScripts&&Object.keys(p.placeholders).length===0){let o=_.get(C.pattern);if(o){let R=x.get(C.pattern);return new Response(o,{status:p.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...M.has(C.pattern)?{"X-STX-Runtime":M.get(C.pattern)?"true":"false"}:{},...R?{"X-STX-Layout":R.layout,"X-STX-Layout-Group":R.group}:{},...U(),...N.cache?{}:{"Cache-Control":Tt}}})}}let d=Lo(n.method),u=v.get(C.pattern);if(!u){let o=s.get("/500")||null;if(o){let R=v.get(o.pattern);if(R)return new Response(R.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(C.prerendered&&d)return new Response("Prerendered pages do not accept actions",{status:405,headers:{Allow:"GET, HEAD"}});if(!d&&!u.hasServerScripts&&Object.keys(u.placeholders).length===0)return new Response(u.html,{status:u.status??200,headers:{"Content-Type":"text/html",...U(),"Cache-Control":"public, max-age=60"}});try{let{html:o,boundaries:R,redirect:B,cookies:X,status:H,headers:F}=await Kn(u,{params:q,request:n,method:n.method,__stx_strict_hydration:W,__stx_runtime_config:m});if(B)return La(B,X,F);if(R&&R.length>0){let{renderStreamingPage:S,streamToResponse:I}=await import("./chunk-02qhay07.js"),L=new Headers({...U(),...F,"Cache-Control":"private, no-store"});for(let k of X??[])L.append("Set-Cookie",k);if(A&&!d&&st(o,r.routerContainer||"main")){let k=pt(o);L.set("X-STX-Fragment","true"),L.set("X-STX-Runtime",Re(o)?"true":"false"),L.set("X-STX-Layout",k.layout),L.set("X-STX-Layout-Group",k.group)}return I(S(A&&!d&&st(o,r.routerContainer||"main")?Be(o,r.routerContainer||"main",!0):o,R,{timeoutMs:30000}),{status:H??u.status??200,headers:L})}let w=new Headers({"Content-Type":"text/html",...U(),...N.cache?{}:{"Cache-Control":"private, no-store"}});for(let S of X??[])w.append("Set-Cookie",S);for(let[S,I]of Object.entries(F??{}))w.set(S,I);if(w.set("Vary",U(w.get("Vary")).Vary),A&&!d&&st(o,r.routerContainer||"main")){let S=pt(o);return w.set("X-STX-Fragment","true"),w.set("X-STX-Runtime",Re(o)?"true":"false"),w.set("X-STX-Layout",S.layout),w.set("X-STX-Layout-Group",S.group),new Response(Be(o,r.routerContainer||"main",!0),{status:H??u.status??200,headers:w})}return new Response(o,{status:H??u.status??200,headers:w})}catch(o){if(console.error(`[stx] Hydration error for ${c}:`,o),W)return new Response("Internal Server Error",{status:500});return new Response(u.html,{headers:{"Content-Type":"text/html"}})}})}))}});return console.log(`[stx] Production server running at http://localhost:${E.port}`),console.log(`[stx] Serving ${r.routes.length} routes (${v.size} pre-loaded)`),{port:E.port,stop:()=>{f.invalidate(),E.stop()},invalidate:(n)=>f.invalidate(n)}}
2
+ import{Ze,z,Jt}from"./chunk-41z7f41b.js";import{T}from"./chunk-0jdz31q1.js";import{Tt,je,U,st,Be,Da,Lo,La,Kn}from"./chunk-dd074gp5.js";import{Dt,Se,pt}from"./chunk-qe0t0m38.js";import{Qo}from"./chunk-taeqm3nc.js";import{Gn}from"./chunk-nq60tjkz.js";import{Re}from"./chunk-mr34w48c.js";import Z from"fs";import P from"path";var{serve:ae}=globalThis.Bun;import O from"zlib";import{promisify as Y}from"util";var K=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],ee=["text/event-stream","multipart/x-mixed-replace"],te=1024;function ne(t){if(!t)return!1;let e=t.toLowerCase();if(ee.some((a)=>e.startsWith(a)))return!1;return K.some((a)=>e.startsWith(a))}function re(t){let e=new Map;for(let a of t.split(",")){let[r,...i]=a.trim().split(";"),f=r.trim().toLowerCase();if(!f)continue;let h=1;for(let g of i){let l=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(g);if(!l)continue;let m=Number.parseFloat(l[1]);if(Number.isFinite(m))h=m}e.set(f,h)}return e}function se(t){if(!t)return null;let e=re(t),a=e.get("*"),r=(i)=>e.get(i)??a??0;if(r("br")>0)return"br";if(r("gzip")>0)return"gzip";return null}var J=33554432,V=new Map,D=0;function oe(t,e){if(e.length>J/8)return;V.set(t,e),D+=e.length;for(let[a,r]of V){if(D<=J)break;V.delete(a),D-=r.length}}async function Vn(t,e,a={}){if(e.headers.get("content-encoding"))return e;if(e.status===204||e.status===304||!e.body)return e;if(!ne(e.headers.get("content-type")))return e;let r=se(t.headers.get("accept-encoding"));if(!r)return e;let i;try{i=new Uint8Array(await e.arrayBuffer())}catch{return e}let f=()=>new Response(i,{status:e.status,statusText:e.statusText,headers:Q(e.headers)});if(i.length<(a.threshold??te))return f();try{let h=a.quality??5,g=`${r}:${h}:${i.length}:${Bun.hash(i)}`,l=V.get(g);if(!l)l=r==="br"?await Y(O.brotliCompress)(i,{params:{[O.constants.BROTLI_PARAM_QUALITY]:h,[O.constants.BROTLI_PARAM_SIZE_HINT]:i.length}}):await Y(O.gzip)(i),oe(g,l);if(l.length>=i.length)return f();let m=Q(e.headers);return m.set("Content-Encoding",r),m.set("Content-Length",String(l.length)),new Response(l,{status:e.status,statusText:e.statusText,headers:m})}catch{return f()}}function Q(t){let e=new Headers(t),a=e.get("Vary");if(!a)return e.set("Vary","Accept-Encoding"),e;if(!a.split(",").some((i)=>i.trim().toLowerCase()==="accept-encoding"))e.set("Vary",`${a}, Accept-Encoding`);return e}class G{now;entries=new T(1000,{maxBytes:33554432,sizeOf:(t)=>t.body.byteLength+JSON.stringify(t.headers).length*2});pending=new Map;generation=0;constructor(t=Date.now){this.now=t}invalidate(t){this.generation++,this.pending.clear();for(let e of Array.from(this.entries.keys()))if(t===void 0||this.entries.get(e)?.path===t)this.entries.delete(e)}async respond(t,e,a){let r,i=async()=>{let s=r??await a();return s.headers.set("Cache-Control","private, no-store"),s.headers.set("Vary",U(s.headers.get("Vary")).Vary),s};if(!e||t.method!=="GET"||t.headers.has("Cookie")||t.headers.has("Authorization")||t.headers.has("Range"))return i();let f=new URL(t.url),h=`${f.origin}${f.pathname}${f.search}|${je(t)?"fragment":"document"}`,g=this.entries.get(h),l=(s)=>{let b=new Headers(s.headers);return b.set("Cache-Control","private, no-store"),b.set("Age",String(Math.max(0,Math.floor((this.now()-s.created)/1000)))),new Response(s.body.slice(0),{headers:b})},m=g?(this.now()-g.created)/1000:1/0;if(g&&m<e.maxAge)return l(g);let v=this.generation,_=async()=>{let s=await a();r=s;let b=(s.headers.get("Vary")??"").toLowerCase().split(",").map((y)=>y.trim()).filter(Boolean);if(s.status!==200||s.headers.has("Set-Cookie")||/(?:private|no-store|no-cache)/i.test(s.headers.get("Cache-Control")??"")||b.some((y)=>y!=="x-stx-router"&&y!=="accept-encoding"))return null;let E=await s.clone().arrayBuffer();if(E.byteLength>1048576)return null;s.headers.set("Vary",U(s.headers.get("Vary")).Vary);let n={body:E,headers:Array.from(s.headers.entries()),created:this.now(),path:f.pathname};if(this.generation===v)this.entries.set(h,n);return n},x=this.pending.get(h);if(!x){if(this.pending.size>=1000)return i();x=_().finally(()=>{if(this.pending.get(h)===x)this.pending.delete(h)}),this.pending.set(h,x)}if(g&&m<e.maxAge+(e.swr??0))return x.catch(()=>{}),l(g);let M=await x;return M?l(M):i()}}var ie={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".json":"application/json",".html":"text/html",".txt":"text/plain",".xml":"application/xml",".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".svg":"image/svg+xml",".ico":"image/x-icon",".bmp":"image/bmp",".mp4":"video/mp4",".webm":"video/webm",".ogg":"audio/ogg",".mp3":"audio/mpeg",".wav":"audio/wav",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"};async function Cm(t={}){let e=P.resolve(t.outputDir||".output"),a=t.port??3000,r=Da(e);if(!r)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${r.routes.length} routes...`);let i=Gn(r.routeRules),f=new G,h=Qo(e,r.apiRoutes??[]),g=Bun.file(P.join(e,"server/runtime-config.json")),l=t.runtimeConfig??(await g.exists()?await g.json():void 0),m=l?z(l):void 0,v=new Map,_=new Map,x=new Map,M=new Map;for(let n of r.routes)try{let y=P.join(e,n.compiledPath),c=JSON.parse(await Bun.file(y).text());if(m)c.html=Jt(c.html,m);v.set(n.pattern,c),x.set(n.pattern,pt(c.html)),M.set(n.pattern,Re(c.html));let j=P.join(e,n.fragmentPath);if(st(c.html,r.routerContainer||"main")&&await Bun.file(j).exists()){let A=await Bun.file(j).text();_.set(n.pattern,m?Jt(A,m):A)}}catch(y){console.warn(`[stx] Failed to load route ${n.pattern}:`,y)}let s=new Map,b=[];for(let n of r.routes)if(n.hasParams){let{regex:y,params:c}=Se(n.pattern,{page:!0});b.push({regex:y,route:n,paramNames:c})}else s.set(n.pattern,n);let E=ae({port:a,async fetch(n){return Vn(n,await Ze(m??z(),async()=>{let c=new URL(n.url).pathname;if(t.onRequest){let p=await t.onRequest(n);if(p)return p}if(t.apiRouter){let p=await t.apiRouter.handleRequest(n);if(p.status!==404)return p}if(t.apiRoutes?.[c])return t.apiRoutes[c](n);let j=await h(n);if(j)return j;if((n.method==="GET"||n.method==="HEAD")&&c!=="/"){let p=P.resolve(e,"public"),d;try{d=decodeURIComponent(c)}catch{d=c}if(!d.includes("\x00")){let u=P.resolve(p,`.${d}`);if(u===p||u.startsWith(`${p}${P.sep}`))try{if(Z.existsSync(u)&&Z.statSync(u).isFile()){let R=P.extname(u).toLowerCase(),B=ie[R]||"application/octet-stream",X=c.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(c);return new Response(Bun.file(u),{headers:{"Content-Type":B,"Cache-Control":X?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let A=je(n),C=null,q={};if(C=s.get(c)||null,!C)for(let{regex:p,route:d,paramNames:u}of b){let o=c.match(p);if(o){C=d,u.forEach((R,B)=>{q[R]=o[B+1]});break}}if(!C){let p=Dt(c)?null:s.get("/404")||null;if(p){let d=v.get(p.pattern);if(d)return new Response(d.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}})}let N=i(c),W=Object.keys(N).length>0;return f.respond(n,N.cache,async()=>{let p=v.get(C.pattern);if(A&&n.method==="GET"&&p&&!p.hasServerScripts&&Object.keys(p.placeholders).length===0){let o=_.get(C.pattern);if(o){let R=x.get(C.pattern);return new Response(o,{status:p.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...M.has(C.pattern)?{"X-STX-Runtime":M.get(C.pattern)?"true":"false"}:{},...R?{"X-STX-Layout":R.layout,"X-STX-Layout-Group":R.group}:{},...U(),...N.cache?{}:{"Cache-Control":Tt}}})}}let d=Lo(n.method),u=v.get(C.pattern);if(!u){let o=s.get("/500")||null;if(o){let R=v.get(o.pattern);if(R)return new Response(R.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(C.prerendered&&d)return new Response("Prerendered pages do not accept actions",{status:405,headers:{Allow:"GET, HEAD"}});if(!d&&!u.hasServerScripts&&Object.keys(u.placeholders).length===0)return new Response(u.html,{status:u.status??200,headers:{"Content-Type":"text/html",...U(),"Cache-Control":"public, max-age=60"}});try{let{html:o,boundaries:R,redirect:B,cookies:X,status:H,headers:F}=await Kn(u,{params:q,request:n,method:n.method,__stx_strict_hydration:W,__stx_runtime_config:m});if(B)return La(B,X,F);if(R&&R.length>0){let{renderStreamingPage:S,streamToResponse:I}=await import("./chunk-rarsjcs4.js"),L=new Headers({...U(),...F,"Cache-Control":"private, no-store"});for(let k of X??[])L.append("Set-Cookie",k);if(A&&!d&&st(o,r.routerContainer||"main")){let k=pt(o);L.set("X-STX-Fragment","true"),L.set("X-STX-Runtime",Re(o)?"true":"false"),L.set("X-STX-Layout",k.layout),L.set("X-STX-Layout-Group",k.group)}return I(S(A&&!d&&st(o,r.routerContainer||"main")?Be(o,r.routerContainer||"main",!0):o,R,{timeoutMs:30000}),{status:H??u.status??200,headers:L})}let w=new Headers({"Content-Type":"text/html",...U(),...N.cache?{}:{"Cache-Control":"private, no-store"}});for(let S of X??[])w.append("Set-Cookie",S);for(let[S,I]of Object.entries(F??{}))w.set(S,I);if(w.set("Vary",U(w.get("Vary")).Vary),A&&!d&&st(o,r.routerContainer||"main")){let S=pt(o);return w.set("X-STX-Fragment","true"),w.set("X-STX-Runtime",Re(o)?"true":"false"),w.set("X-STX-Layout",S.layout),w.set("X-STX-Layout-Group",S.group),new Response(Be(o,r.routerContainer||"main",!0),{status:H??u.status??200,headers:w})}return new Response(o,{status:H??u.status??200,headers:w})}catch(o){if(console.error(`[stx] Hydration error for ${c}:`,o),W)return new Response("Internal Server Error",{status:500});return new Response(u.html,{headers:{"Content-Type":"text/html"}})}})}))}});return console.log(`[stx] Production server running at http://localhost:${E.port}`),console.log(`[stx] Serving ${r.routes.length} routes (${v.size} pre-loaded)`),{port:E.port,stop:()=>{f.invalidate(),E.stop()},invalidate:(n)=>f.invalidate(n)}}
3
3
  export{Vn,Cm};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{iy,lg,ct,Ic,ay,_s,Cs,Es}from"./chunk-s557tht3.js";import"./chunk-xqb0rzk1.js";import"./chunk-wg2n94gf.js";import"./chunk-80ky40mm.js";import"./chunk-9rjgq8k4.js";import"./chunk-d6ghx785.js";import"./chunk-6g5z6r27.js";import"./chunk-41z7f41b.js";import"./chunk-xmg6bmh6.js";import"./chunk-vk2jy6mn.js";import"./chunk-3b3mkgpj.js";import"./chunk-0jdz31q1.js";import"./chunk-cphc60zw.js";export{ay as clearOnceStore,Ic as onceStore,ct as partialsCache,_s as processIncludes,Cs as processStackPushDirectives,Es as processStackReplacements,iy as resetUnscopedSignalWarnings,lg as topLevelElements};
2
+ import{iy,lg,ct,Ic,ay,_s,Cs,Es}from"./chunk-5xq6eky7.js";import"./chunk-6kn2vwtn.js";import"./chunk-a1s0tfcd.js";import"./chunk-80ky40mm.js";import"./chunk-9rjgq8k4.js";import"./chunk-0vrt55pp.js";import"./chunk-4wh71ddp.js";import"./chunk-41z7f41b.js";import"./chunk-xmg6bmh6.js";import"./chunk-vk2jy6mn.js";import"./chunk-3b3mkgpj.js";import"./chunk-0jdz31q1.js";import"./chunk-cphc60zw.js";export{ay as clearOnceStore,Ic as onceStore,ct as partialsCache,_s as processIncludes,Cs as processStackPushDirectives,Es as processStackReplacements,iy as resetUnscopedSignalWarnings,lg as topLevelElements};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{vn,Yo,Zo,Qo,ny,ei}from"./chunk-tkjjyh6k.js";import"./chunk-rb2zbdqd.js";import"./chunk-qe0t0m38.js";import"./chunk-41z7f41b.js";export{Zo as buildServerApi,ny as createServerApi,vn as discoverServerApi,Yo as generateApiTypes,ei as isServerApiSource,Qo as productionApiDispatcher};
2
+ import{vn,Yo,Zo,Qo,ny,ei}from"./chunk-taeqm3nc.js";import"./chunk-rb2zbdqd.js";import"./chunk-qe0t0m38.js";import"./chunk-41z7f41b.js";export{Zo as buildServerApi,ny as createServerApi,vn as discoverServerApi,Yo as generateApiTypes,ei as isServerApiSource,Qo as productionApiDispatcher};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{k,E,A,ee,O,no,ie}from"./chunk-d6ghx785.js";import{Le}from"./chunk-3b3mkgpj.js";import{C}from"./chunk-cphc60zw.js";import{D,Bn}from"./chunk-vk2jy6mn.js";import{a}from"./chunk-5qv5v8kc.js";import{Te,yn,bn,wn}from"./chunk-qnz406aa.js";import{Ot}from"./chunk-jdpzwv1t.js";import{Rt,nr,un,ve}from"./chunk-wg6fmren.js";import{Z}from"./chunk-n6q1d66k.js";import{I,tt}from"./chunk-a0aqs5a8.js";import w from"path";var x=new Map,P=new Map,R=k(64),T=new Map,ne=["composables","functions"];function W(e){let s=w.basename(e,".ts");return s==="index"||s==="types"||e.endsWith(".d.ts")}async function se(e){if(e)return w.resolve(e);let s=`<default>:${process.cwd()}`,i=T.get(s);if(i!==void 0)return i;let t=await oe();if(t!==null)T.set(s,t);return t}async function oe(){let e=await a(),s=e.root||process.cwd(),i=e.composablesDir;if(i)return w.resolve(s,i);for(let t of ne){let n=w.resolve(s,t);try{let c=new Bun.Glob("**/*.ts");for await(let r of c.scan({cwd:n,absolute:!0}))if(!W(r))return n}catch{}}return null}async function X(e){let s=Array.isArray(e)?e:e?[w.resolve(e)]:(await a())._layerComposableDirs??[await se()].filter((t)=>!!t),i=new Map;for(let t of s){let n=new Bun.Glob("**/*.ts");try{for await(let c of n.scan({cwd:t,absolute:!0})){let r=w.relative(t,c);if(!W(c)&&!i.has(r))i.set(r,c)}}catch{}}return{key:s.join("\x00"),files:[...i.values()].sort()}}async function Fo(e){let{files:s}=await X(e),i=ie({loader:"ts",target:"browser",define:A()}),t=[];for(let n of s)try{let c=await Bun.file(n).text(),r=i.scan(c).exports.filter((d)=>d!=="default");if(r.length>0)t.push({file:n,names:r})}catch{}return t}function re(e,s){return new RegExp(`\\b${s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test(e)}function Q(e,s){let i=new Set(e.match(/\w+/g)),t=new Set;for(let n of s)if(/^\w+$/.test(n)?i.has(n):re(e,n))t.add(n);return t}var H=k(64);function U(e,s){let i=E(e,s.size),t=H.get(i);if(t)return t;let n;try{n=Le(e,s)}catch{n=Q(e,s)}let c=[...e.matchAll(/(?:const|let|var)\s*\{([^}]*)\}\s*=\s*window\.__composables\u0008/g),...e.matchAll(/import\s*\{([^}]*)\}\s*from\s*['"]@composables['"]/g)];for(let r of c)for(let d of r[1].split(",")){let f=d.trim().split(/\s*(?::|\u0008as\u0008)\s*/)[0];if(f&&s.has(f))n.add(f)}return H.set(i,n),n}function ae(e){return!e||/^(?:module|(?:text|application)\/(?:java|ecma)script|application\/stx-[\w-]+)$/i.test(e)}var q=k(256);function ce(e,s){let i=new Set(s),t="",n=0,c=new Set;for(let r of ee(e)){t+=e.slice(n,r.start),n=r.end;let d=O(r.attrs),f=e.slice(r.bodyStart,r.bodyEnd),u=d.get("type"),m=typeof u==="string"?u.trim():void 0;if(!ae(m)){if(!/json/i.test(m??""))t+=` ${f} `;continue}let h=Q(f,i);if(h.size===0)continue;let _=E(f,[...h].sort().join(",")),b=q.get(_);if(!b)b=U(f,h),q.set(_,b);for(let v of b)c.add(v)}t+=e.slice(n);for(let r of no(t))for(let d of U(r.code,i))c.add(d);return c}function le(e,s,i){let t=new Map;for(let{file:f,names:u}of e)for(let m of u)if(!t.has(m))t.set(m,f);let n=new Set(t.keys()),c=(f)=>{let u=[];for(let m of U(f,n))u.push(t.get(m));return u},r=new Set,d=i.flatMap((f,u)=>u===0?[...ce(f,t.keys())].map((m)=>t.get(m)):c(f));while(d.length>0){let f=[];for(let u of d){if(r.has(u))continue;r.add(u);for(let m of c(s.get(u)??""))if(!r.has(m))f.push(m)}d=f}return r}async function Fh(e,s,i,t){let{key:n,files:c}=await X(e);if(!n)return null;let r=()=>[...new Set([...c,...c.flatMap((o)=>Te(o))])],d=Rt(r());if(c.length===0)return ve(x,n,d,""),null;c.sort();let f=ie({loader:"ts",target:"browser",define:A()}),u=un(P,n,d);if(!u){let o=new Map,l=[];for(let p of c)try{let S=await Bun.file(p).text();o.set(p,S);let g=f.scan(S).exports.filter((te)=>te!=="default");if(g.length>0)l.push({file:p,names:g})}catch{o.set(p,"")}u=ve(P,n,d,{codeByFile:o,modules:l})}let{codeByFile:m,modules:h}=u,_;if(s===void 0)_=new Set(c);else{let o=i?[s,...i]:[s],l=E(o.join("\x00"),n,o.length,d),p=R.get(l);if(_=p??le(h,m,o),!p)R.set(l,_)}if(_.size===0)return null;let b=c.filter((o)=>_.has(o)),v=()=>{if(!t)return;for(let o of b)t.push(o,...Te(o))},N=`${n}\x00${b.join("\x00")}\x00${bn()}`,z=un(x,N,d);if(z!==void 0)return v(),z||null;let F=[],B=new Set,K=new Set;for(let o of b)try{let l=m.get(o)??await Bun.file(o).text(),p=w.basename(o,".ts");for(let g of l.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(g[1])K.add(g[1]);let S=[];try{for(let g of f.scan(l).exports)if(g!=="default")B.add(g),S.push(g)}catch{}if(l=D(l),yn(l))l=await wn(l,o,{projectRoot:process.cwd(),externalizeUserModules:!1,expose:S}),l=Ot(l);l=Bn(l),l=l.replace(/^export\s+(default\s+)?/gm,""),l=f.transformSync(l),F.push(`// Composable: ${p}
2
+ import{k,E,A,ee,O,no,ie}from"./chunk-0vrt55pp.js";import{Le}from"./chunk-3b3mkgpj.js";import{C}from"./chunk-cphc60zw.js";import{D,Bn}from"./chunk-vk2jy6mn.js";import{a}from"./chunk-qcbj1m21.js";import{Te,yn,bn,wn}from"./chunk-5v4e2a02.js";import{Ot}from"./chunk-g8p4sjy4.js";import{Rt,nr,un,ve}from"./chunk-wg6fmren.js";import{Z}from"./chunk-n6q1d66k.js";import{I,tt}from"./chunk-a0aqs5a8.js";import w from"path";var x=new Map,P=new Map,R=k(64),T=new Map,ne=["composables","functions"];function W(e){let s=w.basename(e,".ts");return s==="index"||s==="types"||e.endsWith(".d.ts")}async function se(e){if(e)return w.resolve(e);let s=`<default>:${process.cwd()}`,i=T.get(s);if(i!==void 0)return i;let t=await oe();if(t!==null)T.set(s,t);return t}async function oe(){let e=await a(),s=e.root||process.cwd(),i=e.composablesDir;if(i)return w.resolve(s,i);for(let t of ne){let n=w.resolve(s,t);try{let c=new Bun.Glob("**/*.ts");for await(let r of c.scan({cwd:n,absolute:!0}))if(!W(r))return n}catch{}}return null}async function X(e){let s=Array.isArray(e)?e:e?[w.resolve(e)]:(await a())._layerComposableDirs??[await se()].filter((t)=>!!t),i=new Map;for(let t of s){let n=new Bun.Glob("**/*.ts");try{for await(let c of n.scan({cwd:t,absolute:!0})){let r=w.relative(t,c);if(!W(c)&&!i.has(r))i.set(r,c)}}catch{}}return{key:s.join("\x00"),files:[...i.values()].sort()}}async function Fo(e){let{files:s}=await X(e),i=ie({loader:"ts",target:"browser",define:A()}),t=[];for(let n of s)try{let c=await Bun.file(n).text(),r=i.scan(c).exports.filter((d)=>d!=="default");if(r.length>0)t.push({file:n,names:r})}catch{}return t}function re(e,s){return new RegExp(`\\b${s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test(e)}function Q(e,s){let i=new Set(e.match(/\w+/g)),t=new Set;for(let n of s)if(/^\w+$/.test(n)?i.has(n):re(e,n))t.add(n);return t}var H=k(64);function U(e,s){let i=E(e,s.size),t=H.get(i);if(t)return t;let n;try{n=Le(e,s)}catch{n=Q(e,s)}let c=[...e.matchAll(/(?:const|let|var)\s*\{([^}]*)\}\s*=\s*window\.__composables\u0008/g),...e.matchAll(/import\s*\{([^}]*)\}\s*from\s*['"]@composables['"]/g)];for(let r of c)for(let d of r[1].split(",")){let f=d.trim().split(/\s*(?::|\u0008as\u0008)\s*/)[0];if(f&&s.has(f))n.add(f)}return H.set(i,n),n}function ae(e){return!e||/^(?:module|(?:text|application)\/(?:java|ecma)script|application\/stx-[\w-]+)$/i.test(e)}var q=k(256);function ce(e,s){let i=new Set(s),t="",n=0,c=new Set;for(let r of ee(e)){t+=e.slice(n,r.start),n=r.end;let d=O(r.attrs),f=e.slice(r.bodyStart,r.bodyEnd),u=d.get("type"),m=typeof u==="string"?u.trim():void 0;if(!ae(m)){if(!/json/i.test(m??""))t+=` ${f} `;continue}let h=Q(f,i);if(h.size===0)continue;let _=E(f,[...h].sort().join(",")),b=q.get(_);if(!b)b=U(f,h),q.set(_,b);for(let v of b)c.add(v)}t+=e.slice(n);for(let r of no(t))for(let d of U(r.code,i))c.add(d);return c}function le(e,s,i){let t=new Map;for(let{file:f,names:u}of e)for(let m of u)if(!t.has(m))t.set(m,f);let n=new Set(t.keys()),c=(f)=>{let u=[];for(let m of U(f,n))u.push(t.get(m));return u},r=new Set,d=i.flatMap((f,u)=>u===0?[...ce(f,t.keys())].map((m)=>t.get(m)):c(f));while(d.length>0){let f=[];for(let u of d){if(r.has(u))continue;r.add(u);for(let m of c(s.get(u)??""))if(!r.has(m))f.push(m)}d=f}return r}async function Fh(e,s,i,t){let{key:n,files:c}=await X(e);if(!n)return null;let r=()=>[...new Set([...c,...c.flatMap((o)=>Te(o))])],d=Rt(r());if(c.length===0)return ve(x,n,d,""),null;c.sort();let f=ie({loader:"ts",target:"browser",define:A()}),u=un(P,n,d);if(!u){let o=new Map,l=[];for(let p of c)try{let S=await Bun.file(p).text();o.set(p,S);let g=f.scan(S).exports.filter((te)=>te!=="default");if(g.length>0)l.push({file:p,names:g})}catch{o.set(p,"")}u=ve(P,n,d,{codeByFile:o,modules:l})}let{codeByFile:m,modules:h}=u,_;if(s===void 0)_=new Set(c);else{let o=i?[s,...i]:[s],l=E(o.join("\x00"),n,o.length,d),p=R.get(l);if(_=p??le(h,m,o),!p)R.set(l,_)}if(_.size===0)return null;let b=c.filter((o)=>_.has(o)),v=()=>{if(!t)return;for(let o of b)t.push(o,...Te(o))},N=`${n}\x00${b.join("\x00")}\x00${bn()}`,z=un(x,N,d);if(z!==void 0)return v(),z||null;let F=[],B=new Set,K=new Set;for(let o of b)try{let l=m.get(o)??await Bun.file(o).text(),p=w.basename(o,".ts");for(let g of l.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(g[1])K.add(g[1]);let S=[];try{for(let g of f.scan(l).exports)if(g!=="default")B.add(g),S.push(g)}catch{}if(l=D(l),yn(l))l=await wn(l,o,{projectRoot:process.cwd(),externalizeUserModules:!1,expose:S}),l=Ot(l);l=Bn(l),l=l.replace(/^export\s+(default\s+)?/gm,""),l=f.transformSync(l),F.push(`// Composable: ${p}
3
3
  ${l.trim()}`)}catch(l){console.warn(`[stx] Failed to load composable ${o}:`,l)}if(F.length===0||B.size===0)return ve(x,N,d,""),null;let V=[...B].map((o)=>` try { if (!(${JSON.stringify(o)} in __c)) __c[${JSON.stringify(o)}] = ${o}; } catch (e) {}`).join(`
4
4
  `),G=JSON.stringify([...B]),M=F.join(`
5
5
 
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Mn,z}from"./chunk-41z7f41b.js";import m from"fs";import e from"path";async function Nn(r,o,i){if(r.__stx_runtime_config)return;let n=Mn();if(n||i){r.__stx_runtime_config=n??z(i);return}let t=e.dirname(e.resolve(o));while(!0){if(["stx.config.ts","stx.config.js",".config/stx.config.ts",".config/stx.config.js"].some((f)=>m.existsSync(e.join(t,f)))){let{loadStxConfig:f}=await import("./chunk-at843zxh.js"),c=await f(t);if(c.runtimeConfig)r.__stx_runtime_config=z(c.runtimeConfig);return}let s=e.dirname(t);if(s===t)return;t=s}}async function qi(r,o){function i(n){if(n===null)return"null";if(Array.isArray(n))return`Array<${n.length?[...new Set(n.map(i))].join(" | "):"unknown"}>`;if(typeof n==="object")return`{ ${Object.entries(n).map(([t,s])=>`readonly ${JSON.stringify(t)}: ${i(s)}`).join("; ")} }`;return typeof n}await Bun.write(e.join(r,".stx/runtime-config.d.ts"),`import '@stacksjs/stx/runtime-config'
2
+ import{Mn,z}from"./chunk-41z7f41b.js";import m from"fs";import e from"path";async function Nn(r,o,i){if(r.__stx_runtime_config)return;let n=Mn();if(n||i){r.__stx_runtime_config=n??z(i);return}let t=e.dirname(e.resolve(o));while(!0){if(["stx.config.ts","stx.config.js",".config/stx.config.ts",".config/stx.config.js"].some((f)=>m.existsSync(e.join(t,f)))){let{loadStxConfig:f}=await import("./chunk-nd2bhjdw.js"),c=await f(t);if(c.runtimeConfig)r.__stx_runtime_config=z(c.runtimeConfig);return}let s=e.dirname(t);if(s===t)return;t=s}}async function qi(r,o){function i(n){if(n===null)return"null";if(Array.isArray(n))return`Array<${n.length?[...new Set(n.map(i))].join(" | "):"unknown"}>`;if(typeof n==="object")return`{ ${Object.entries(n).map(([t,s])=>`readonly ${JSON.stringify(t)}: ${i(s)}`).join("; ")} }`;return typeof n}await Bun.write(e.join(r,".stx/runtime-config.d.ts"),`import '@stacksjs/stx/runtime-config'
3
3
  declare module '@stacksjs/stx/runtime-config' { interface PublicRuntimeConfig ${i(o.public??{})} }
4
4
  `),await Bun.write(e.join(r,".stx/runtime-config-server.d.ts"),`import '@stacksjs/stx/runtime-config-server'
5
5
  declare module '@stacksjs/stx/runtime-config-server' { interface PrivateRuntimeConfig ${i(o.private??{})} }
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{mr,ze}from"./chunk-115bb91s.js";import{X,k,Or,Qs,A}from"./chunk-d6ghx785.js";import{a,j}from"./chunk-5qv5v8kc.js";import{ei}from"./chunk-tkjjyh6k.js";import{Z}from"./chunk-n6q1d66k.js";import{gt}from"./chunk-zkwkhesc.js";import{l}from"./chunk-zxjdfgdx.js";import{t,h}from"./chunk-neg6ckjg.js";import d from"path";import E from"fs";import{AsyncLocalStorage as lt}from"async_hooks";import{randomUUID as St}from"crypto";var vt=12;function G(e,n,s){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(d.basename(e))||ei(e,n,s)}var ct=2;function Xf(e){let n=process.env.STX_BUNDLE_CACHE_DIR?.trim();return n?d.resolve(n):l(e,"bundle-cache")}function rt(e,n){let s=e;for(let i of Bt(n))if(i!==d.sep)s=s.split(i).join("\x00root");return s}var it=new Map;function Bt(e){let n=d.resolve(e),s=it.get(n);if(!s){let i=n;try{i=E.realpathSync(n)}catch{}s=[...new Set([n,i])].sort((c,p)=>p.length-c.length),it.set(n,s)}return s}function jt(e,n){try{let s=E.statSync(e),i=d.resolve(n),c=e.startsWith(`${i}${d.sep}`);return{path:c?d.relative(i,e):e,...c?{inRoot:!0}:{},mtimeMs:s.mtimeMs,size:s.size,hash:Bun.hash(E.readFileSync(e)).toString(36)}}catch{return null}}function ut(e,n){return e.inRoot?d.join(d.resolve(n),e.path):e.path}function Et(e,n){for(let s of e){let i=ut(s,n);try{let c=E.statSync(i);if(c.size!==s.size)return!1;if(c.mtimeMs!==s.mtimeMs&&Bun.hash(E.readFileSync(i)).toString(36)!==s.hash)return!1}catch{return!1}}return!0}var dt=new Map,_t=100;function Jf(e=process.env){let n=Number(e.STX_BUNDLE_CACHE_LIMIT);return Number.isFinite(n)&&n>=1?Math.floor(n):2000}var q=new Map;async function Mt(e){let n=q.get(e)??0;if(n>0&&n<_t){q.set(e,n+1);return}q.set(e,1);try{let s=(await E.promises.readdir(e)).filter((o)=>o.endsWith(".js")),i=Jf();if(s.length<=i)return;let p=(await Promise.all(s.map(async(o)=>{try{return{name:o,at:(await E.promises.stat(d.join(e,o))).mtimeMs}}catch{return null}}))).filter((o)=>o!==null);p.sort((o,w)=>w.at-o.at);for(let o of p.slice(i)){let w=o.name.slice(0,-3);await E.promises.rm(d.join(e,`${w}.js`),{force:!0}),await E.promises.rm(d.join(e,`${w}.deps.json`),{force:!0})}T("pruned bundle cache to",i,"entries")}catch{}}function Te(e){return dt.get(e)??[]}function Y(e,n){if(e)dt.set(e,n)}function Yf(e=process.env){return e.STX_DEBUG==="true"||e.STX_DEBUG==="1"}function T(...e){if(Yf())console.log("[stx:bundler]",...e)}var et=[];function Cc(e,n,s){et.push({filePath:e||"<inline>",message:n,details:s})}function mn(){return et.slice()}function hn(){et.length=0}var K;function ey(e){K=e}function Ec(){if(K)return K;try{let e=j.strict;return typeof e==="object"&&e!==null?e.bundlerFallback??"warn":"warn"}catch{return"warn"}}var tt=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function yn(e){let n=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,s;while((s=n.exec(e))!==null){let c=s[1];if(!tt.some((o)=>o.test(c)))return T("detected user import:",c),!0}let i=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((s=i.exec(e))!==null){let c=s[1];if(/\.css(?:\?.*)?$/.test(c))continue;if(!tt.some((o)=>o.test(c)))return T("detected side-effect import:",c),!0}return!1}var gr="stx-module:",Rt=/\.(?:[cm]?[jt]sx?|json)$/i;function Zf(e,n){return d.relative(e,n).split(d.sep).join("/")}function Qf(e,n){if(n.size===0)return e;return e.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(s,i,c,p)=>{let o=n.get(p);return o&&!p.startsWith(gr)?`${i}${c}${o}${c}`:s})}function eg(e,n){let s=0,i=(p)=>{let o=`__stxMod${s++}`,w=JSON.stringify(p);return n.push(`var ${o} = globalThis.__stxModules && globalThis.__stxModules[${w}];`,`if (${o} === undefined) throw new Error("[stx] module " + ${JSON.stringify(w)} + " is not registered on this page (#1957)");`),o},c=(p,o)=>{for(let w of p.split(",")){let C=w.trim();if(!C)continue;let R=C.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!R)continue;let S=R[1].startsWith('"')?JSON.parse(R[1]):R[1],f=R[2]??S;n.push(`var ${f} = ${o}[${JSON.stringify(S)}];`)}};return e=e.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(p,o,w)=>{let C=w.slice(gr.length),R=i(C),S=o.trim(),f=S.match(/^([\w$]+)\s*(?:,\s*|$)/);if(f&&!S.startsWith("{")&&!S.startsWith("*"))n.push(`var ${f[1]} = ${R}.default;`),S=S.slice(f[0].length).trim();let v=S.match(/^\*\s*as\s+([\w$]+)$/);if(v)n.push(`var ${v[1]} = ${R};`);else if(S.startsWith("{"))c(S.replace(/^\{|\}$/g,""),R);return""}),e=e.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(p,o)=>(i(o.slice(gr.length)),"")),e}function ot(e){let n=[e,`${e}.ts`,`${e}.tsx`,`${e}.js`,`${e}.mjs`,`${e}.jsx`,d.join(e,"index.ts"),d.join(e,"index.tsx"),d.join(e,"index.js"),d.join(e,"index.mjs")];for(let s of n)try{if(E.existsSync(s)&&E.statSync(s,{throwIfNoEntry:!1})?.isFile())return s}catch{}return}var H=new lt;function Ss(e,n){let s=new Bun.CryptoHasher("md5");for(let[i,c]of[...e].sort(([p],[o])=>p<o?-1:p>o?1:0))s.update(`${i}\x00${c}\x00`);return H.run({modules:e,key:s.digest("hex").slice(0,12)},n)}var pt=new lt;function tg(e){return pt.run(!0,e)}function ng(){return pt.getStore()===!0}function Tc(e){if(!ng())return;throw Error(`The client script of ${e} needs bundling, and it is being rendered inside a Bun.build loader, where Bun never finishes a second build. Make the page an entrypoint of the build (bun-plugin-stx renders entrypoints before the bundler starts), or render it once outside the build so its bundle is cached.`)}function bn(){return H.getStore()?.key??""}function ft(e,n,s,i,c,p,o=new Map,w,C,R){let S=new Map([[s,i],...R??[]]),f=(B)=>B!==void 0&&S.has(B),v=(B,r,u)=>{if(G(r,e,w))return null;if(!p||!f(B)||!Rt.test(r))return null;try{if(!E.statSync(r,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}c.add(r);let _=`${gr}${Zf(process.cwd(),r)}`;return o.set(u,_),{path:_,external:!0}},b=(B,r)=>{let u=f(B)?n:d.dirname(B),_=d.resolve(u,r);return ot(_)??_};return{name:"stx-client-bundle",setup(B){if(B.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(r)=>({path:r.path,external:!0})),B.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(r)=>({path:r.path,external:!0})),B.onResolve({filter:/^\//},(r)=>{if(f(r.path))return{path:r.path};let u=ot(r.path);if(u){let _=v(r.importer,u,r.path);if(_)return _;if(!f(u))c.add(u);return{path:u}}return{path:r.path,external:!0}}),B.onResolve({filter:/^\.\.?\//},(r)=>{let u=b(r.importer,r.path),_=v(r.importer,u,r.path);if(_)return _;return c.add(u),{path:u}}),B.onResolve({filter:/^[@~]\//},(r)=>{let u=d.resolve(e,r.path.slice(2)),_=[u,`${u}.ts`,`${u}.tsx`,`${u}.js`,`${u}.mjs`,`${u}.jsx`,d.join(u,"index.ts"),d.join(u,"index.tsx"),d.join(u,"index.js"),d.join(u,"index.mjs")];for(let x of _)if(E.existsSync(x)&&E.statSync(x,{throwIfNoEntry:!1})?.isFile()){let D=v(r.importer,x,r.path);if(D)return D;return T(`resolved ${r.path[0]}/ import:`,r.path,"\u2192",x),c.add(x),{path:x}}return console.warn(`[stx:bundler] could not resolve ${r.path[0]}/ import:`,r.path),{path:u}}),p)B.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(r)=>{if(!f(r.importer))return;let u=`${gr}npm:${r.path}`;return o.set(r.path,u),{path:u,external:!0}});B.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(r)=>{if(S.has(r.path))return{contents:S.get(r.path),loader:"ts"};if(G(r.path,e,w))throw Error(`Server-only API source cannot be imported by a client script: ${r.path}`);let u=d.extname(r.path).toLowerCase(),_=u===".json"?"json":u===".tsx"?"tsx":u===".jsx"?"jsx":u===".ts"||u===".mts"||u===".cts"?"ts":"js";if(!f(r.path))c.add(r.path);let x=C?.get(r.path);if(x!==void 0)return{contents:x,loader:"js"};return{contents:E.readFileSync(r.path,"utf8"),loader:_}})}}}var Q=new Map,V=k(64),at=Symbol.for("stx.client-bundle-build-queue");function rg(e){let n=globalThis,i=(n[at]??Promise.resolve()).then(e,e);return n[at]=i.then(()=>{return},()=>{return}),i}async function wn(e,n,s={}){let i=s.projectRoot||process.cwd(),c=(await a(i)).serverApi,p=s.minify??!1,o=s.externalizeUserModules??!0,w=s.expose?.length?[...new Set(s.expose)].sort():void 0,C=s.cacheDir||Xf(i),R=H.getStore(),S=new Bun.CryptoHasher("md5");S.update(`${vt}\x00${gt()}\x00${JSON.stringify(c??!1)}\x00${o?"registry":"inline"}\x00${w?w.join(","):"*"}\x00${p?"minified":"readable"}\x00${R?.key??""}\x00${rt(e,i)}\x00${rt(n,i)}`);let f=S.digest("hex").slice(0,12),v=d.join(C,`${f}.js`),b=V.get(v);if(b){if(Qs(b.files)&&b.files.every((x)=>!G(x.path,i,c))){T("memo hit:",f);let x=b.files.map((D)=>D.path);return Y(n,x),s.collectInputs?.push(...x),b.code}V.delete(v),T("memo invalidated by dep change:",f)}let B=d.join(C,`${f}.deps.json`),r=Bun.file(v);if(await r.exists()){let x=Bun.file(B),D=!1,N=null;if(await x.exists())try{let O=JSON.parse(await x.text());if(O.metadataVersion===ct&&Array.isArray(O.files)&&Et(O.files,i))N=Or(O.files.map((g)=>ut(g,i))),D=N.length===O.files.length&&!N.some((g)=>G(g.path,i,c))}catch{D=!1}if(D){if(T("cache hit:",f),N)Y(n,N.map((L)=>L.path)),s.collectInputs?.push(...N.map((L)=>L.path));let O=await r.text(),g=new Date;if(E.promises.utimes(v,g,g).catch(()=>{}),N)V.set(v,{code:O,files:N});return O}T("cache invalidated by dep change:",f)}let u=Q.get(f);if(u){let x=await u;if(s.collectInputs)s.collectInputs.push(...(V.get(v)?.files??[]).map((D)=>D.path));return x}Tc(n);let _=rg(()=>Ft(e,n,{projectRoot:i,minify:p,cacheDir:C,hash:f,cachePath:v,depsPath:B,collectInputs:s.collectInputs,externalizeUserModules:o,serverApi:c,expose:w,throwOnFailure:s.throwOnFailure,substitutes:R?.modules}));Q.set(f,_);try{return await _}finally{Q.delete(f)}}function $c(e){return`${e}-${process.pid}-${St()}`}async function ty(e,n){let{projectRoot:s}=n,i=$c(new Bun.CryptoHasher("md5").update([...e.keys()].join("\x00")).digest("hex").slice(0,12)),c=d.join(l(s,"bundle-tmp"),"out",i);E.mkdirSync(c,{recursive:!0});let p=new Map,o=new Map,w=0;for(let[f,v]of e){let b=d.join(s,`.stx-split-${i}-${w++}.ts`);p.set(b,v),o.set(d.basename(b).replace(/\.ts$/,""),f)}let[C,R]=[...p][0],S=new Set;Tc(n.filePath);try{let f=await Bun.build({entrypoints:[...p.keys()],outdir:c,target:"browser",format:"esm",splitting:!0,minify:!1,naming:{entry:"[name].js",chunk:"chunk-[hash].js"},plugins:[ft(s,d.dirname(n.filePath),C,R,S,!1,new Map,void 0,H.getStore()?.modules,p)],define:{"process.env.NODE_ENV":'"development"',...A()},root:s});if(!f.success)throw Error(f.logs.filter((b)=>b.level==="error").map((b)=>b.message).join(", ")||"Unable to bundle the entries");let v={entries:new Map,chunks:new Map};for(let b of f.outputs){let B=d.basename(b.path);if(b.kind==="entry-point"){let r=o.get(B.replace(/\.js$/,""));if(r!==void 0)v.entries.set(r,await b.text())}else if(b.kind==="chunk")v.chunks.set(B.replace(/\.js$/,""),await b.text())}return n.collectInputs?.push(...S),v}finally{try{E.rmSync(c,{recursive:!0,force:!0})}catch{}}}async function Ft(e,n,s){let{projectRoot:i,minify:c,cacheDir:p,hash:o,cachePath:w,depsPath:C,externalizeUserModules:R}=s,S=l(i,"bundle-tmp"),f=$c(o),v=d.join(i,`.stx-client-${f}.ts`),b=d.join(S,"out",f);E.mkdirSync(b,{recursive:!0});let B=d.dirname(n),r=new Set,u=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,_=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,x=t(e),{depths:D,balanced:N}=h(x),O=(F)=>!N||D[F]===0,g;while((g=u.exec(x))!==null){if(g[1])continue;if(!O(g.index))continue;if(g[2])g[2].split(",").forEach((F)=>{let m=It(F);if(m)r.add(m)});else if(g[3])r.add(g[3])}while((g=_.exec(x))!==null){if(g[1])continue;if(!O(g.index))continue;r.add(g[2])}let L=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=L.exec(x))!==null){if(!O(g.index))continue;let F=/^\s*['"]([^'"]+)['"]/.exec(e.slice(g.index+g[0].length))?.[1];if(F&&tt.some((m)=>m.test(F)))continue;if(g[1])r.add(g[1]);if(g[2])r.add(g[2]);for(let m of(g[3]??"").split(",")){let M=m.trim();if(!M||/^type\s/.test(M))continue;let P=/\bas\s+(\w+)\s*$/.exec(M)?.[1]??/^\w+$/.exec(M)?.[0];if(P)r.add(P)}}for(let F of x.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let m of F[1].split(",")){let M=/\bas\s+(\w+)\s*$/.exec(m)?.[1]??/^\s*(\w+)\s*$/.exec(m)?.[1];if(M)r.delete(M)}let mt=r.size>0?`
2
+ import{mr,ze}from"./chunk-115bb91s.js";import{X,k,Or,Qs,A}from"./chunk-0vrt55pp.js";import{a,j}from"./chunk-qcbj1m21.js";import{ei}from"./chunk-taeqm3nc.js";import{Z}from"./chunk-n6q1d66k.js";import{gt}from"./chunk-zkwkhesc.js";import{l}from"./chunk-zxjdfgdx.js";import{t,h}from"./chunk-neg6ckjg.js";import d from"path";import E from"fs";import{AsyncLocalStorage as lt}from"async_hooks";import{randomUUID as St}from"crypto";var vt=12;function G(e,n,s){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(d.basename(e))||ei(e,n,s)}var ct=2;function Xf(e){let n=process.env.STX_BUNDLE_CACHE_DIR?.trim();return n?d.resolve(n):l(e,"bundle-cache")}function rt(e,n){let s=e;for(let i of Bt(n))if(i!==d.sep)s=s.split(i).join("\x00root");return s}var it=new Map;function Bt(e){let n=d.resolve(e),s=it.get(n);if(!s){let i=n;try{i=E.realpathSync(n)}catch{}s=[...new Set([n,i])].sort((c,p)=>p.length-c.length),it.set(n,s)}return s}function jt(e,n){try{let s=E.statSync(e),i=d.resolve(n),c=e.startsWith(`${i}${d.sep}`);return{path:c?d.relative(i,e):e,...c?{inRoot:!0}:{},mtimeMs:s.mtimeMs,size:s.size,hash:Bun.hash(E.readFileSync(e)).toString(36)}}catch{return null}}function ut(e,n){return e.inRoot?d.join(d.resolve(n),e.path):e.path}function Et(e,n){for(let s of e){let i=ut(s,n);try{let c=E.statSync(i);if(c.size!==s.size)return!1;if(c.mtimeMs!==s.mtimeMs&&Bun.hash(E.readFileSync(i)).toString(36)!==s.hash)return!1}catch{return!1}}return!0}var dt=new Map,_t=100;function Jf(e=process.env){let n=Number(e.STX_BUNDLE_CACHE_LIMIT);return Number.isFinite(n)&&n>=1?Math.floor(n):2000}var q=new Map;async function Mt(e){let n=q.get(e)??0;if(n>0&&n<_t){q.set(e,n+1);return}q.set(e,1);try{let s=(await E.promises.readdir(e)).filter((o)=>o.endsWith(".js")),i=Jf();if(s.length<=i)return;let p=(await Promise.all(s.map(async(o)=>{try{return{name:o,at:(await E.promises.stat(d.join(e,o))).mtimeMs}}catch{return null}}))).filter((o)=>o!==null);p.sort((o,w)=>w.at-o.at);for(let o of p.slice(i)){let w=o.name.slice(0,-3);await E.promises.rm(d.join(e,`${w}.js`),{force:!0}),await E.promises.rm(d.join(e,`${w}.deps.json`),{force:!0})}T("pruned bundle cache to",i,"entries")}catch{}}function Te(e){return dt.get(e)??[]}function Y(e,n){if(e)dt.set(e,n)}function Yf(e=process.env){return e.STX_DEBUG==="true"||e.STX_DEBUG==="1"}function T(...e){if(Yf())console.log("[stx:bundler]",...e)}var et=[];function Cc(e,n,s){et.push({filePath:e||"<inline>",message:n,details:s})}function mn(){return et.slice()}function hn(){et.length=0}var K;function ey(e){K=e}function Ec(){if(K)return K;try{let e=j.strict;return typeof e==="object"&&e!==null?e.bundlerFallback??"warn":"warn"}catch{return"warn"}}var tt=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function yn(e){let n=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,s;while((s=n.exec(e))!==null){let c=s[1];if(!tt.some((o)=>o.test(c)))return T("detected user import:",c),!0}let i=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((s=i.exec(e))!==null){let c=s[1];if(/\.css(?:\?.*)?$/.test(c))continue;if(!tt.some((o)=>o.test(c)))return T("detected side-effect import:",c),!0}return!1}var gr="stx-module:",Rt=/\.(?:[cm]?[jt]sx?|json)$/i;function Zf(e,n){return d.relative(e,n).split(d.sep).join("/")}function Qf(e,n){if(n.size===0)return e;return e.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(s,i,c,p)=>{let o=n.get(p);return o&&!p.startsWith(gr)?`${i}${c}${o}${c}`:s})}function eg(e,n){let s=0,i=(p)=>{let o=`__stxMod${s++}`,w=JSON.stringify(p);return n.push(`var ${o} = globalThis.__stxModules && globalThis.__stxModules[${w}];`,`if (${o} === undefined) throw new Error("[stx] module " + ${JSON.stringify(w)} + " is not registered on this page (#1957)");`),o},c=(p,o)=>{for(let w of p.split(",")){let C=w.trim();if(!C)continue;let R=C.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!R)continue;let S=R[1].startsWith('"')?JSON.parse(R[1]):R[1],f=R[2]??S;n.push(`var ${f} = ${o}[${JSON.stringify(S)}];`)}};return e=e.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(p,o,w)=>{let C=w.slice(gr.length),R=i(C),S=o.trim(),f=S.match(/^([\w$]+)\s*(?:,\s*|$)/);if(f&&!S.startsWith("{")&&!S.startsWith("*"))n.push(`var ${f[1]} = ${R}.default;`),S=S.slice(f[0].length).trim();let v=S.match(/^\*\s*as\s+([\w$]+)$/);if(v)n.push(`var ${v[1]} = ${R};`);else if(S.startsWith("{"))c(S.replace(/^\{|\}$/g,""),R);return""}),e=e.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(p,o)=>(i(o.slice(gr.length)),"")),e}function ot(e){let n=[e,`${e}.ts`,`${e}.tsx`,`${e}.js`,`${e}.mjs`,`${e}.jsx`,d.join(e,"index.ts"),d.join(e,"index.tsx"),d.join(e,"index.js"),d.join(e,"index.mjs")];for(let s of n)try{if(E.existsSync(s)&&E.statSync(s,{throwIfNoEntry:!1})?.isFile())return s}catch{}return}var H=new lt;function Ss(e,n){let s=new Bun.CryptoHasher("md5");for(let[i,c]of[...e].sort(([p],[o])=>p<o?-1:p>o?1:0))s.update(`${i}\x00${c}\x00`);return H.run({modules:e,key:s.digest("hex").slice(0,12)},n)}var pt=new lt;function tg(e){return pt.run(!0,e)}function ng(){return pt.getStore()===!0}function Tc(e){if(!ng())return;throw Error(`The client script of ${e} needs bundling, and it is being rendered inside a Bun.build loader, where Bun never finishes a second build. Make the page an entrypoint of the build (bun-plugin-stx renders entrypoints before the bundler starts), or render it once outside the build so its bundle is cached.`)}function bn(){return H.getStore()?.key??""}function ft(e,n,s,i,c,p,o=new Map,w,C,R){let S=new Map([[s,i],...R??[]]),f=(B)=>B!==void 0&&S.has(B),v=(B,r,u)=>{if(G(r,e,w))return null;if(!p||!f(B)||!Rt.test(r))return null;try{if(!E.statSync(r,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}c.add(r);let _=`${gr}${Zf(process.cwd(),r)}`;return o.set(u,_),{path:_,external:!0}},b=(B,r)=>{let u=f(B)?n:d.dirname(B),_=d.resolve(u,r);return ot(_)??_};return{name:"stx-client-bundle",setup(B){if(B.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(r)=>({path:r.path,external:!0})),B.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(r)=>({path:r.path,external:!0})),B.onResolve({filter:/^\//},(r)=>{if(f(r.path))return{path:r.path};let u=ot(r.path);if(u){let _=v(r.importer,u,r.path);if(_)return _;if(!f(u))c.add(u);return{path:u}}return{path:r.path,external:!0}}),B.onResolve({filter:/^\.\.?\//},(r)=>{let u=b(r.importer,r.path),_=v(r.importer,u,r.path);if(_)return _;return c.add(u),{path:u}}),B.onResolve({filter:/^[@~]\//},(r)=>{let u=d.resolve(e,r.path.slice(2)),_=[u,`${u}.ts`,`${u}.tsx`,`${u}.js`,`${u}.mjs`,`${u}.jsx`,d.join(u,"index.ts"),d.join(u,"index.tsx"),d.join(u,"index.js"),d.join(u,"index.mjs")];for(let x of _)if(E.existsSync(x)&&E.statSync(x,{throwIfNoEntry:!1})?.isFile()){let D=v(r.importer,x,r.path);if(D)return D;return T(`resolved ${r.path[0]}/ import:`,r.path,"\u2192",x),c.add(x),{path:x}}return console.warn(`[stx:bundler] could not resolve ${r.path[0]}/ import:`,r.path),{path:u}}),p)B.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(r)=>{if(!f(r.importer))return;let u=`${gr}npm:${r.path}`;return o.set(r.path,u),{path:u,external:!0}});B.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(r)=>{if(S.has(r.path))return{contents:S.get(r.path),loader:"ts"};if(G(r.path,e,w))throw Error(`Server-only API source cannot be imported by a client script: ${r.path}`);let u=d.extname(r.path).toLowerCase(),_=u===".json"?"json":u===".tsx"?"tsx":u===".jsx"?"jsx":u===".ts"||u===".mts"||u===".cts"?"ts":"js";if(!f(r.path))c.add(r.path);let x=C?.get(r.path);if(x!==void 0)return{contents:x,loader:"js"};return{contents:E.readFileSync(r.path,"utf8"),loader:_}})}}}var Q=new Map,V=k(64),at=Symbol.for("stx.client-bundle-build-queue");function rg(e){let n=globalThis,i=(n[at]??Promise.resolve()).then(e,e);return n[at]=i.then(()=>{return},()=>{return}),i}async function wn(e,n,s={}){let i=s.projectRoot||process.cwd(),c=(await a(i)).serverApi,p=s.minify??!1,o=s.externalizeUserModules??!0,w=s.expose?.length?[...new Set(s.expose)].sort():void 0,C=s.cacheDir||Xf(i),R=H.getStore(),S=new Bun.CryptoHasher("md5");S.update(`${vt}\x00${gt()}\x00${JSON.stringify(c??!1)}\x00${o?"registry":"inline"}\x00${w?w.join(","):"*"}\x00${p?"minified":"readable"}\x00${R?.key??""}\x00${rt(e,i)}\x00${rt(n,i)}`);let f=S.digest("hex").slice(0,12),v=d.join(C,`${f}.js`),b=V.get(v);if(b){if(Qs(b.files)&&b.files.every((x)=>!G(x.path,i,c))){T("memo hit:",f);let x=b.files.map((D)=>D.path);return Y(n,x),s.collectInputs?.push(...x),b.code}V.delete(v),T("memo invalidated by dep change:",f)}let B=d.join(C,`${f}.deps.json`),r=Bun.file(v);if(await r.exists()){let x=Bun.file(B),D=!1,N=null;if(await x.exists())try{let O=JSON.parse(await x.text());if(O.metadataVersion===ct&&Array.isArray(O.files)&&Et(O.files,i))N=Or(O.files.map((g)=>ut(g,i))),D=N.length===O.files.length&&!N.some((g)=>G(g.path,i,c))}catch{D=!1}if(D){if(T("cache hit:",f),N)Y(n,N.map((L)=>L.path)),s.collectInputs?.push(...N.map((L)=>L.path));let O=await r.text(),g=new Date;if(E.promises.utimes(v,g,g).catch(()=>{}),N)V.set(v,{code:O,files:N});return O}T("cache invalidated by dep change:",f)}let u=Q.get(f);if(u){let x=await u;if(s.collectInputs)s.collectInputs.push(...(V.get(v)?.files??[]).map((D)=>D.path));return x}Tc(n);let _=rg(()=>Ft(e,n,{projectRoot:i,minify:p,cacheDir:C,hash:f,cachePath:v,depsPath:B,collectInputs:s.collectInputs,externalizeUserModules:o,serverApi:c,expose:w,throwOnFailure:s.throwOnFailure,substitutes:R?.modules}));Q.set(f,_);try{return await _}finally{Q.delete(f)}}function $c(e){return`${e}-${process.pid}-${St()}`}async function ty(e,n){let{projectRoot:s}=n,i=$c(new Bun.CryptoHasher("md5").update([...e.keys()].join("\x00")).digest("hex").slice(0,12)),c=d.join(l(s,"bundle-tmp"),"out",i);E.mkdirSync(c,{recursive:!0});let p=new Map,o=new Map,w=0;for(let[f,v]of e){let b=d.join(s,`.stx-split-${i}-${w++}.ts`);p.set(b,v),o.set(d.basename(b).replace(/\.ts$/,""),f)}let[C,R]=[...p][0],S=new Set;Tc(n.filePath);try{let f=await Bun.build({entrypoints:[...p.keys()],outdir:c,target:"browser",format:"esm",splitting:!0,minify:!1,naming:{entry:"[name].js",chunk:"chunk-[hash].js"},plugins:[ft(s,d.dirname(n.filePath),C,R,S,!1,new Map,void 0,H.getStore()?.modules,p)],define:{"process.env.NODE_ENV":'"development"',...A()},root:s});if(!f.success)throw Error(f.logs.filter((b)=>b.level==="error").map((b)=>b.message).join(", ")||"Unable to bundle the entries");let v={entries:new Map,chunks:new Map};for(let b of f.outputs){let B=d.basename(b.path);if(b.kind==="entry-point"){let r=o.get(B.replace(/\.js$/,""));if(r!==void 0)v.entries.set(r,await b.text())}else if(b.kind==="chunk")v.chunks.set(B.replace(/\.js$/,""),await b.text())}return n.collectInputs?.push(...S),v}finally{try{E.rmSync(c,{recursive:!0,force:!0})}catch{}}}async function Ft(e,n,s){let{projectRoot:i,minify:c,cacheDir:p,hash:o,cachePath:w,depsPath:C,externalizeUserModules:R}=s,S=l(i,"bundle-tmp"),f=$c(o),v=d.join(i,`.stx-client-${f}.ts`),b=d.join(S,"out",f);E.mkdirSync(b,{recursive:!0});let B=d.dirname(n),r=new Set,u=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,_=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,x=t(e),{depths:D,balanced:N}=h(x),O=(F)=>!N||D[F]===0,g;while((g=u.exec(x))!==null){if(g[1])continue;if(!O(g.index))continue;if(g[2])g[2].split(",").forEach((F)=>{let m=It(F);if(m)r.add(m)});else if(g[3])r.add(g[3])}while((g=_.exec(x))!==null){if(g[1])continue;if(!O(g.index))continue;r.add(g[2])}let L=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=L.exec(x))!==null){if(!O(g.index))continue;let F=/^\s*['"]([^'"]+)['"]/.exec(e.slice(g.index+g[0].length))?.[1];if(F&&tt.some((m)=>m.test(F)))continue;if(g[1])r.add(g[1]);if(g[2])r.add(g[2]);for(let m of(g[3]??"").split(",")){let M=m.trim();if(!M||/^type\s/.test(M))continue;let P=/\bas\s+(\w+)\s*$/.exec(M)?.[1]??/^\w+$/.exec(M)?.[0];if(P)r.add(P)}}for(let F of x.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let m of F[1].split(",")){let M=/\bas\s+(\w+)\s*$/.exec(m)?.[1]??/^\s*(\w+)\s*$/.exec(m)?.[1];if(M)r.delete(M)}let mt=r.size>0?`
3
3
  export { ${[...r].join(", ")} }`:"";T("bundling:",o,"from:",d.basename(n));let nt=new Set,st=new Map;try{let F=await Bun.build({entrypoints:[v],outdir:b,target:"browser",format:"esm",minify:c?{whitespace:!1,identifiers:!0,syntax:!0}:!1,plugins:[ft(i,B,v,e+mt,nt,R,st,s.serverApi,s.substitutes)],define:{"process.env.NODE_ENV":c?'"production"':'"development"',...A()},root:i});if(!F.success){let I=F.logs.filter((U)=>U.level==="error").map((U)=>U.message).join(", ")||`Unable to bundle ${d.basename(n)}`,z=mr(F.logs,n||void 0);if(console.warn("[stx:bundler] build failed:",I),Cc(n||"",I,z),s.throwOnFailure||Ec()==="error")throw Error(I);return e}let m="";for(let y of F.outputs){m=await y.text();break}let M=[];for(let y of m.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let I of y[1].split(",")){let z=I.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(z){M.push([z[2],z[1]]);continue}let U=I.trim();if(/^[A-Za-z_$][\w$]*$/.test(U))M.push([U,U])}if(s.expose){let y=new Set(s.expose);for(let I=M.length-1;I>=0;I--)if(!y.has(M[I][0]))M.splice(I,1)}let P=[];m=eg(Qf(m,st),P);let ht=m.match(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm)||[];if(m=m.replace(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),c&&m)try{m=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(m)}catch{}let xt=Z(m),W=`__stxBundle_${o}`,yt=new Set(X(e,!0).split(",").map((y)=>y.trim())),$t=M.map(([y,I])=>`get ${JSON.stringify(y)}() { return ${I} }${yt.has(y)?`, set ${JSON.stringify(y)}(__stxValue_${I}) { ${I} = __stxValue_${I} }`:""}`).join(", "),bt=M.map(([y])=>`var ${y} = undefined;`).join(`
4
4
  `),wt=M.map(([y])=>`${y} = ${W}[${JSON.stringify(y)}];`).join(`
5
5
  `);if(m=`${ht.join(`