@stacksjs/stx 0.2.612 → 0.2.614

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 (123) hide show
  1. package/dist/{chunk-tawfv519.js → chunk-06bwys2z.js} +1 -1
  2. package/dist/{chunk-f6pjf3tb.js → chunk-1bqtsjry.js} +1 -1
  3. package/dist/chunk-1gyrk0qv.js +2 -0
  4. package/dist/{chunk-jbaedjyk.js → chunk-1q3e1w2y.js} +3 -3
  5. package/dist/chunk-1v40w4qr.js +2 -0
  6. package/dist/chunk-1xzxmnsd.js +2 -0
  7. package/dist/{chunk-1q06tw66.js → chunk-27h4ndsg.js} +2 -2
  8. package/dist/chunk-2a1sgnxf.js +2 -0
  9. package/dist/{chunk-kwfwc32d.js → chunk-2bagpncj.js} +2 -2
  10. package/dist/chunk-37n8rf75.js +2 -0
  11. package/dist/{chunk-bgcn01mr.js → chunk-3a60b9an.js} +2 -2
  12. package/dist/{chunk-jskaacqy.js → chunk-3cg5mrtq.js} +6 -6
  13. package/dist/{chunk-4x5zryhk.js → chunk-3hzr66vn.js} +8 -8
  14. package/dist/{chunk-6fmcs19t.js → chunk-3vbv4gxx.js} +5 -5
  15. package/dist/chunk-42er5gwc.js +2 -0
  16. package/dist/{chunk-1c0zvjt3.js → chunk-5hqkfqne.js} +9 -10
  17. package/dist/{chunk-t9pnkbg6.js → chunk-5mw7qawr.js} +1 -1
  18. package/dist/{chunk-zsqfvwwf.js → chunk-5pa5bbzv.js} +2 -2
  19. package/dist/chunk-6kqmr5z1.js +2 -0
  20. package/dist/{chunk-d5nxsg1p.js → chunk-71wntraa.js} +1 -1
  21. package/dist/{chunk-vbzpc1yz.js → chunk-araay35m.js} +4 -4
  22. package/dist/chunk-awvbp2t4.js +2 -0
  23. package/dist/chunk-b3g8zzc6.js +2 -0
  24. package/dist/chunk-bdn21f8c.js +2 -0
  25. package/dist/chunk-c6vb28zd.js +2 -0
  26. package/dist/chunk-cjm2d6w1.js +2 -0
  27. package/dist/{chunk-58s20ceb.js → chunk-ctf9gd40.js} +2 -2
  28. package/dist/chunk-dcdmr6cp.js +2 -0
  29. package/dist/{chunk-0s6shhb3.js → chunk-dq58tn5x.js} +1 -1
  30. package/dist/{chunk-f8kh3s0k.js → chunk-e5t4xhfk.js} +1 -1
  31. package/dist/{chunk-hw97qw4k.js → chunk-ehq5j4tb.js} +2 -2
  32. package/dist/{chunk-mfh61qdr.js → chunk-faq9x5kw.js} +15 -15
  33. package/dist/chunk-fq4xjy4k.js +2 -0
  34. package/dist/chunk-gv3se08t.js +2 -0
  35. package/dist/{chunk-qkczk53w.js → chunk-h74p4zay.js} +65 -65
  36. package/dist/chunk-hx2fc5dt.js +2 -0
  37. package/dist/{chunk-8n306p92.js → chunk-jpe8pt9m.js} +1 -1
  38. package/dist/{chunk-g18pwk0t.js → chunk-jrsvbztw.js} +1 -1
  39. package/dist/{chunk-btcc95hq.js → chunk-jwxppaj3.js} +4 -4
  40. package/dist/{chunk-qh3b1w7q.js → chunk-k0kajwdw.js} +1 -1
  41. package/dist/{chunk-adn5r0r4.js → chunk-kt9ksp8w.js} +1 -1
  42. package/dist/{chunk-t61vdbje.js → chunk-ktvr45qg.js} +6 -6
  43. package/dist/{chunk-jx1p2eza.js → chunk-m0x9gfx5.js} +1 -1
  44. package/dist/chunk-m85kmqbn.js +2 -0
  45. package/dist/chunk-mf6mqs9k.js +2 -0
  46. package/dist/chunk-mheh85ph.js +2 -0
  47. package/dist/{chunk-ewmpbxhv.js → chunk-mkss8wbh.js} +5 -5
  48. package/dist/{chunk-13xvn7vh.js → chunk-mqky9h29.js} +1 -1
  49. package/dist/chunk-n5acpvq3.js +2 -0
  50. package/dist/{chunk-zhe35k6k.js → chunk-nk0cn3yq.js} +1 -1
  51. package/dist/chunk-nvewemvh.js +2 -0
  52. package/dist/chunk-p1t8mm9b.js +2 -0
  53. package/dist/{chunk-7ed685cs.js → chunk-pv73vnyj.js} +1 -1
  54. package/dist/{chunk-970j89r5.js → chunk-pw0b0an6.js} +2 -2
  55. package/dist/{chunk-s43pj9n6.js → chunk-r9z467kx.js} +5 -5
  56. package/dist/chunk-rgg6kr7r.js +2 -0
  57. package/dist/chunk-rw3kgv2q.js +2 -0
  58. package/dist/{chunk-c9jav70j.js → chunk-s9jgsp0a.js} +3 -3
  59. package/dist/{chunk-th4x1wbc.js → chunk-t1cbac58.js} +3 -3
  60. package/dist/{chunk-z83p4bme.js → chunk-t4rxr1zj.js} +3 -3
  61. package/dist/chunk-t7h714ne.js +2 -0
  62. package/dist/{chunk-8dq3r6xw.js → chunk-t8akfx99.js} +6 -6
  63. package/dist/{chunk-ej2ka6g6.js → chunk-temrpzxj.js} +22 -22
  64. package/dist/chunk-th9t5vks.js +2 -0
  65. package/dist/{chunk-7yjyzzcp.js → chunk-tkw5mr0k.js} +1 -1
  66. package/dist/chunk-tq5nzr99.js +2 -0
  67. package/dist/{chunk-ktg9khmj.js → chunk-trhr4gzz.js} +4 -4
  68. package/dist/{chunk-j4smj8cr.js → chunk-vxa0h3yy.js} +4 -4
  69. package/dist/{chunk-xncqjkjm.js → chunk-wq6b8qgz.js} +1 -1
  70. package/dist/chunk-wr42shpx.js +2 -0
  71. package/dist/chunk-x81g1v5x.js +2 -0
  72. package/dist/{chunk-5fa9g7x1.js → chunk-xeqysa9z.js} +62 -62
  73. package/dist/{chunk-74j18qk0.js → chunk-y8h823cb.js} +28 -28
  74. package/dist/chunk-yn2d8x8m.js +3 -0
  75. package/dist/chunk-ywf6pa29.js +2 -0
  76. package/dist/{chunk-frvn6psn.js → chunk-ywxg3f9s.js} +1 -1
  77. package/dist/chunk-yxksngda.js +2 -0
  78. package/dist/chunk-yytfje8a.js +2 -0
  79. package/dist/{chunk-6w0h6vpd.js → chunk-zb191qdx.js} +3 -3
  80. package/dist/{chunk-wy93yhce.js → chunk-zde9mef4.js} +3 -3
  81. package/dist/chunk-zxvqjzr2.js +2 -0
  82. package/dist/cli.js +42 -42
  83. package/dist/craft-entry.js +2 -2
  84. package/dist/craft.js +2 -2
  85. package/dist/native/compiler/render-screen.js +7 -0
  86. package/dist/native/runtime/jsc-globals.js +18 -3
  87. package/dist/pwa.js +3 -3
  88. package/dist/ssg.js +5 -5
  89. package/package.json +5 -5
  90. package/dist/chunk-07rryvyt.js +0 -2
  91. package/dist/chunk-0dkd5z22.js +0 -2
  92. package/dist/chunk-0hpng9by.js +0 -2
  93. package/dist/chunk-0nfysn6e.js +0 -2
  94. package/dist/chunk-0vmwp37n.js +0 -2
  95. package/dist/chunk-0x72g1jn.js +0 -2
  96. package/dist/chunk-15wmzj8j.js +0 -2
  97. package/dist/chunk-1p7v0ytv.js +0 -2
  98. package/dist/chunk-32y8adx3.js +0 -2
  99. package/dist/chunk-5003ncbh.js +0 -2
  100. package/dist/chunk-514ykzna.js +0 -2
  101. package/dist/chunk-6yn7pc5s.js +0 -2
  102. package/dist/chunk-7mee8bte.js +0 -2
  103. package/dist/chunk-7mgbh13b.js +0 -2
  104. package/dist/chunk-851cd8sc.js +0 -2
  105. package/dist/chunk-be89da2e.js +0 -2
  106. package/dist/chunk-cg8hg6cs.js +0 -3
  107. package/dist/chunk-cxv6mhky.js +0 -2
  108. package/dist/chunk-g8hwrejy.js +0 -2
  109. package/dist/chunk-gmqr7v81.js +0 -2
  110. package/dist/chunk-h94znyac.js +0 -2
  111. package/dist/chunk-j9pcvc0z.js +0 -2
  112. package/dist/chunk-m4k7f63m.js +0 -2
  113. package/dist/chunk-mtm39290.js +0 -2
  114. package/dist/chunk-n4z6evey.js +0 -2
  115. package/dist/chunk-pjh4kftn.js +0 -2
  116. package/dist/chunk-pjqrcbtt.js +0 -2
  117. package/dist/chunk-t535swnv.js +0 -2
  118. package/dist/chunk-trah2z70.js +0 -2
  119. package/dist/chunk-vrnb2xat.js +0 -2
  120. package/dist/chunk-xq9f9ftz.js +0 -2
  121. package/dist/chunk-xv9qre1x.js +0 -2
  122. package/dist/chunk-zar7fhqr.js +0 -2
  123. package/dist/chunk-zy266h8p.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{y}from"./chunk-2bcp699b.js";import{I,Ut}from"./chunk-66e4ga0z.js";import{w,et,j,o}from"./chunk-5fa9g7x1.js";import{ue,$t,Rt,At}from"./chunk-btcc95hq.js";import{ze,an,kt,q}from"./chunk-swv69q75.js";import{E,jn}from"./chunk-twmq5m6r.js";import p from"path";var a=new Map;function A(c,n){for(let s of c.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(s[1])n.add(s[1]);for(let s of c.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let i of(s[1]??"").split(",")){let l=((i.includes(":")?i.split(":").pop():i)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(l))n.add(l)}for(let s of c.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let i of(s[1]??"").split(",")){let r=i.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(r))n.add(r)}}async function xd(c){let n;if(c)n=p.resolve(c);else{let t=await o();n=p.resolve(t.root||process.cwd(),t.storesDir||"stores")}let s=`${n}\x00${Rt()}`,i=new Bun.Glob("*.ts"),r=[];try{for await(let t of i.scan({cwd:n,absolute:!0})){let e=p.basename(t,".ts");if(["index","types"].includes(e))continue;if(t.includes(".d.ts"))continue;r.push(t)}}catch{return q(a,s,"",""),null}let l=()=>[...new Set([...r,...r.flatMap((t)=>ue(t))])],f=ze(l()),d=kt(a,s,f);if(d!==void 0)return d||null;if(r.length===0)return q(a,s,f,""),null;let u=[];for(let t of r){let e=await Bun.file(t).text();u.push({file:t,hasUseStore:/useStore\s*\(/.test(e)})}u.sort((t,e)=>{if(t.hasUseStore===e.hasUseStore)return 0;return t.hasUseStore?1:-1});let x=u.map((t)=>t.file),m=[],g=new Set,v=j({loader:"ts",target:"browser",define:w()});for(let t of x)try{let e=await Bun.file(t).text(),_=p.basename(t,".ts");if(A(e,g),$t(e))e=await At(e,t,{projectRoot:process.cwd(),externalizeUserModules:E()});e=et(e),e=I(e),e=Ut(e),e=e.replace(/^export\s+(default\s+)?/gm,""),e=v.transformSync(e),m.push(`// Store: ${_}
2
+ import{y}from"./chunk-2bcp699b.js";import{I,Ut}from"./chunk-66e4ga0z.js";import{w,et,j,o}from"./chunk-xeqysa9z.js";import{de,$t,Rt,At}from"./chunk-jwxppaj3.js";import{ze,an,kt,q}from"./chunk-swv69q75.js";import{E,jn}from"./chunk-twmq5m6r.js";import p from"path";var a=new Map;function A(c,n){for(let s of c.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(s[1])n.add(s[1]);for(let s of c.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let i of(s[1]??"").split(",")){let l=((i.includes(":")?i.split(":").pop():i)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(l))n.add(l)}for(let s of c.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let i of(s[1]??"").split(",")){let r=i.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(r))n.add(r)}}async function xu(c){let n;if(c)n=p.resolve(c);else{let t=await o();n=p.resolve(t.root||process.cwd(),t.storesDir||"stores")}let s=`${n}\x00${Rt()}`,i=new Bun.Glob("*.ts"),r=[];try{for await(let t of i.scan({cwd:n,absolute:!0})){let e=p.basename(t,".ts");if(["index","types"].includes(e))continue;if(t.includes(".d.ts"))continue;r.push(t)}}catch{return q(a,s,"",""),null}let l=()=>[...new Set([...r,...r.flatMap((t)=>de(t))])],f=ze(l()),d=kt(a,s,f);if(d!==void 0)return d||null;if(r.length===0)return q(a,s,f,""),null;let u=[];for(let t of r){let e=await Bun.file(t).text();u.push({file:t,hasUseStore:/useStore\s*\(/.test(e)})}u.sort((t,e)=>{if(t.hasUseStore===e.hasUseStore)return 0;return t.hasUseStore?1:-1});let x=u.map((t)=>t.file),m=[],g=new Set,v=j({loader:"ts",target:"browser",define:w()});for(let t of x)try{let e=await Bun.file(t).text(),_=p.basename(t,".ts");if(A(e,g),$t(e))e=await At(e,t,{projectRoot:process.cwd(),externalizeUserModules:E()});e=et(e),e=I(e),e=Ut(e),e=e.replace(/^export\s+(default\s+)?/gm,""),e=v.transformSync(e),m.push(`// Store: ${_}
3
3
  ${e.trim()}`)}catch(e){console.warn(`[stx] Failed to load store ${t}:`,e)}if(m.length===0)return q(a,s,f,""),null;let S=m.join(`
4
4
 
5
5
  `),h=`;(function(){
@@ -7,5 +7,5 @@ var __stx = window.stx || {};
7
7
  ${y.filter((t)=>!g.has(t)&&new RegExp(`\\b${t}\\b`).test(S)).map((t)=>`var ${t} = __stx[${JSON.stringify(t)}];`).join(`
8
8
  `)}
9
9
  ${S}
10
- })();`,b=E()?jn(h):h;return f=ze(l()),q(a,s,f,b),b}function Sd(){a.clear(),an()}
11
- export{xd,Sd};
10
+ })();`,b=E()?jn(h):h;return f=ze(l()),q(a,s,f,b),b}function Su(){a.clear(),an()}
11
+ export{xu,Su};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Cn,Dc,Es}from"./chunk-xeqysa9z.js";import"./chunk-q4t49t6z.js";import"./chunk-99rfdydy.js";import"./chunk-0zx1400y.js";import"./chunk-kt9ksp8w.js";import"./chunk-nmh4pn44.js";import"./chunk-t8akfx99.js";import"./chunk-s9jgsp0a.js";import{Pe}from"./chunk-k1hpxgzq.js";import"./chunk-66e4ga0z.js";import"./chunk-2bcp699b.js";import"./chunk-5hqkfqne.js";import"./chunk-mm8jdb4p.js";export{Pe as freeIdentifiers,Es as processComponents,Dc as processESImports,Cn as rendersAsElement};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{t,i}from"./chunk-k1hpxgzq.js";import{it,at,ct,be,Re,_,xr,On,we}from"./chunk-c9jav70j.js";var I=/(?<![\w$@])@meta\s*\(/g,C=/(?<![\w$@])@metaTag\s*\(/g,k=/(?<![\w$@])@structuredData\s*\(/g,N=/(?<![\w$@])@seo\s*\(/g;function D(e,r){return(n)=>_(e,n,"the call has no closing parenthesis",r,t.INVALID_DIRECTIVE_SYNTAX)}function j(e){return"property"in e?`<meta property="${l(e.property)}" content="${l(e.content)}">`:`<meta name="${l(e.name)}" content="${l(e.content)}">`}function Ws(e,r,n,g){if(!e.includes("@meta"))return e;let a=it(e,I,(s,c)=>{let o=On(at(s),r);if(o.kind==="tag")return j(o.tag);if(o.kind==="empty")return"";return _("Meta",c,o.message,n,o.code)},D("Meta",n));return a=it(a,C,(s,c)=>{let o=ct(s,r);if(!o.ok)return _("MetaTag",c,o.message,n,o.code);if(o.value===void 0||o.value===null)return"";if(!Re(o.value))return _("MetaTag",c,`expected an object such as { name, content }, got ${be(o.value)}`,n,t.TYPE_ERROR);let u=o.value;if(!u.name&&!u.property&&!u.httpEquiv)return _("MetaTag",c,"the tag needs a name, property or httpEquiv",n,t.INVALID_DIRECTIVE_SYNTAX);if(u.content===void 0||u.content===null||u.content===""||u.content===!1)return"";let p="<meta";if(u.name)p+=` name="${l(u.name)}"`;if(u.property)p+=` property="${l(u.property)}"`;if(u.httpEquiv)p+=` http-equiv="${l(u.httpEquiv)}"`;return p+=` content="${l(u.content)}">`,p},D("MetaTag",n)),a}function v(e){let r=(n)=>n["@context"]?{...n}:{...n,"@context":"https://schema.org"};if(Re(e))return r(e);if(Array.isArray(e)&&e.length>0&&e.every(Re))return e.map(r);return null}function A(e){return`<script type="application/ld+json">${JSON.stringify(e).replace(/<\//g,"<\\/")}</script>`}function qs(e,r,n){if(!e.includes("@structuredData"))return e;return it(e,k,(g,a)=>{let s=ct(g,r);if(!s.ok)return _("StructuredData",a,s.message,n,s.code);if(s.value===void 0||s.value===null)return"";let c=v(s.value);if(!c)return _("StructuredData",a,`expected an object or an array of objects, got ${be(s.value)}`,n,t.TYPE_ERROR);try{return A(c)}catch(o){let u=o instanceof Error?o.message:String(o);return _("StructuredData",a,`the data cannot be written as JSON: ${u}`,n,t.EVALUATION_ERROR)}},D("StructuredData",n))}var L=new Set(["title","description","keywords","robots","canonical","openGraph","twitter","structuredData"]),R={image:"openGraph.image",url:"canonical or openGraph.url",type:"openGraph.type",siteName:"openGraph.siteName",locale:"openGraph.locale",og:"openGraph",author:"@meta('author', ...)"};function Gs(e,r,n,g){if(!e.includes("@seo"))return e;return it(e,N,(a,s)=>{if(!a.trim())return _("SEO",s,"expected an object: @seo({ title, description }) or @seo(seoVariable)",n,t.INVALID_DIRECTIVE_SYNTAX);let c=ct(a,r);if(!c.ok)return _("SEO",s,c.message,n,c.code);if(c.value===void 0||c.value===null)return"";if(!Re(c.value))return _("SEO",s,`expected an object such as { title, description }, got ${be(c.value)}`,n,t.TYPE_ERROR);try{return q(c.value,s,n)}catch(o){let u=o instanceof Error?o.message:String(o);return _("SEO",s,`Error processing @seo directive: ${u}`,n,t.EVALUATION_ERROR)}},D("SEO",n))}function b(e,r,n,g){let a=e[r];if(a===void 0||a===null||a===!1)return;if(Re(a))return a;xr(n,`${r} must be an object, got ${be(a)}; its tags were left out`,g);return}function q(e,r,n){let g=Object.keys(e).filter((o)=>!L.has(o));if(g.length>0){let o=g.map((u)=>R[u]?`${u} (use ${R[u]})`:u).join(", ");xr(r,`@seo does not read ${o}; ${g.length===1?"it was":"they were"} ignored`,n)}let a="";if(e.title)a+=`<title>${l(e.title)}</title>
2
+ import{t,i}from"./chunk-k1hpxgzq.js";import{it,at,ct,be,Re,_,xr,On,we}from"./chunk-s9jgsp0a.js";var I=/(?<![\w$@])@meta\s*\(/g,C=/(?<![\w$@])@metaTag\s*\(/g,k=/(?<![\w$@])@structuredData\s*\(/g,N=/(?<![\w$@])@seo\s*\(/g;function D(e,r){return(n)=>_(e,n,"the call has no closing parenthesis",r,t.INVALID_DIRECTIVE_SYNTAX)}function j(e){return"property"in e?`<meta property="${l(e.property)}" content="${l(e.content)}">`:`<meta name="${l(e.name)}" content="${l(e.content)}">`}function Ws(e,r,n,g){if(!e.includes("@meta"))return e;let a=it(e,I,(s,c)=>{let o=On(at(s),r);if(o.kind==="tag")return j(o.tag);if(o.kind==="empty")return"";return _("Meta",c,o.message,n,o.code)},D("Meta",n));return a=it(a,C,(s,c)=>{let o=ct(s,r);if(!o.ok)return _("MetaTag",c,o.message,n,o.code);if(o.value===void 0||o.value===null)return"";if(!Re(o.value))return _("MetaTag",c,`expected an object such as { name, content }, got ${be(o.value)}`,n,t.TYPE_ERROR);let u=o.value;if(!u.name&&!u.property&&!u.httpEquiv)return _("MetaTag",c,"the tag needs a name, property or httpEquiv",n,t.INVALID_DIRECTIVE_SYNTAX);if(u.content===void 0||u.content===null||u.content===""||u.content===!1)return"";let p="<meta";if(u.name)p+=` name="${l(u.name)}"`;if(u.property)p+=` property="${l(u.property)}"`;if(u.httpEquiv)p+=` http-equiv="${l(u.httpEquiv)}"`;return p+=` content="${l(u.content)}">`,p},D("MetaTag",n)),a}function v(e){let r=(n)=>n["@context"]?{...n}:{...n,"@context":"https://schema.org"};if(Re(e))return r(e);if(Array.isArray(e)&&e.length>0&&e.every(Re))return e.map(r);return null}function A(e){return`<script type="application/ld+json">${JSON.stringify(e).replace(/<\//g,"<\\/")}</script>`}function qs(e,r,n){if(!e.includes("@structuredData"))return e;return it(e,k,(g,a)=>{let s=ct(g,r);if(!s.ok)return _("StructuredData",a,s.message,n,s.code);if(s.value===void 0||s.value===null)return"";let c=v(s.value);if(!c)return _("StructuredData",a,`expected an object or an array of objects, got ${be(s.value)}`,n,t.TYPE_ERROR);try{return A(c)}catch(o){let u=o instanceof Error?o.message:String(o);return _("StructuredData",a,`the data cannot be written as JSON: ${u}`,n,t.EVALUATION_ERROR)}},D("StructuredData",n))}var L=new Set(["title","description","keywords","robots","canonical","openGraph","twitter","structuredData"]),R={image:"openGraph.image",url:"canonical or openGraph.url",type:"openGraph.type",siteName:"openGraph.siteName",locale:"openGraph.locale",og:"openGraph",author:"@meta('author', ...)"};function Gs(e,r,n,g){if(!e.includes("@seo"))return e;return it(e,N,(a,s)=>{if(!a.trim())return _("SEO",s,"expected an object: @seo({ title, description }) or @seo(seoVariable)",n,t.INVALID_DIRECTIVE_SYNTAX);let c=ct(a,r);if(!c.ok)return _("SEO",s,c.message,n,c.code);if(c.value===void 0||c.value===null)return"";if(!Re(c.value))return _("SEO",s,`expected an object such as { title, description }, got ${be(c.value)}`,n,t.TYPE_ERROR);try{return q(c.value,s,n)}catch(o){let u=o instanceof Error?o.message:String(o);return _("SEO",s,`Error processing @seo directive: ${u}`,n,t.EVALUATION_ERROR)}},D("SEO",n))}function b(e,r,n,g){let a=e[r];if(a===void 0||a===null||a===!1)return;if(Re(a))return a;xr(n,`${r} must be an object, got ${be(a)}; its tags were left out`,g);return}function q(e,r,n){let g=Object.keys(e).filter((o)=>!L.has(o));if(g.length>0){let o=g.map((u)=>R[u]?`${u} (use ${R[u]})`:u).join(", ");xr(r,`@seo does not read ${o}; ${g.length===1?"it was":"they were"} ignored`,n)}let a="";if(e.title)a+=`<title>${l(e.title)}</title>
3
3
  `,a+=`<meta name="title" content="${l(e.title)}">
4
4
  `;if(e.description)a+=`<meta name="description" content="${l(e.description)}">
5
5
  `;if(e.keywords){let o=Array.isArray(e.keywords)?e.keywords.join(", "):e.keywords;a+=`<meta name="keywords" content="${l(o)}">
@@ -43,7 +43,7 @@ import{t,i}from"./chunk-k1hpxgzq.js";import{it,at,ct,be,Re,_,xr,On,we}from"./chu
43
43
  ${y}
44
44
  `),h;return h.replace(/<head[^>]*>/,`$&
45
45
  ${y}
46
- `)}function M(e){let r=e.search(/<\/head\s*>/i);return r===-1?e:e.slice(0,r)}function x(e){return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0*39;|&apos;/g,"'").replace(/&amp;/g,"&")}function V(e){let r=e.match(/<title(?:\s[^>]*)?>([\s\S]*?)<\/title\s*>/i);return r?x(r[1].trim()):""}function O(e){return(e.match(/<meta\s[^>]*>/gi)||[]).filter((r)=>/\sname\s*=\s*["']description["']/i.test(r))}function G(e){return O(e).length>0}function U(e){for(let r of O(e)){let n=r.match(/\scontent\s*=\s*(?:"([^"]*)"|'([^']*)')/i),g=(n?.[1]??n?.[2]??"").trim();if(g)return x(g)}return""}function l(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var br={name:"meta",rawParams:!0,handler:(e,r,n,g)=>{let a=On(r,n??{});if(a.kind==="error")return _("Meta",`@meta(${r.join(", ")})`,a.message,g,a.code);if(a.kind==="empty")return"";if(n)n.__stx_runtime_head=we(n.__stx_runtime_head??{},{meta:[a.tag]});return""},hasEndTag:!1},vr={name:"structuredData",handler:(e,r,n,g)=>{if(e.trim()==="")return i("StructuredData","structuredData directive requires JSON-LD content",t.INVALID_DIRECTIVE_SYNTAX);try{let a=JSON.parse(e);if(!a["@context"])a["@context"]="https://schema.org";if(!a["@type"])return i("StructuredData","structuredData requires @type property",t.INVALID_DIRECTIVE_SYNTAX);return A(a)}catch(a){let s=a instanceof Error?a.message:String(a);return i("StructuredData",s,t.EVALUATION_ERROR)}},hasEndTag:!0};function wu(){return[br,vr]}function xu(e,r){let{baseUrl:n,defaultChangefreq:g="weekly",defaultPriority:a=0.5,includeLastmod:s=!0}=r,c=n.replace(/\/$/,""),o=(m)=>m.startsWith("http")?m:`${c}${m.startsWith("/")?"":"/"}${m}`,u=e.map((m)=>{let d=o(m.loc),f=m.lastmod||(s?new Date().toISOString().split("T")[0]:void 0),E=m.changefreq||g,y=m.priority??a,h=` <url>
46
+ `)}function M(e){let r=e.search(/<\/head\s*>/i);return r===-1?e:e.slice(0,r)}function x(e){return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0*39;|&apos;/g,"'").replace(/&amp;/g,"&")}function V(e){let r=e.match(/<title(?:\s[^>]*)?>([\s\S]*?)<\/title\s*>/i);return r?x(r[1].trim()):""}function O(e){return(e.match(/<meta\s[^>]*>/gi)||[]).filter((r)=>/\sname\s*=\s*["']description["']/i.test(r))}function G(e){return O(e).length>0}function U(e){for(let r of O(e)){let n=r.match(/\scontent\s*=\s*(?:"([^"]*)"|'([^']*)')/i),g=(n?.[1]??n?.[2]??"").trim();if(g)return x(g)}return""}function l(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var br={name:"meta",rawParams:!0,handler:(e,r,n,g)=>{let a=On(r,n??{});if(a.kind==="error")return _("Meta",`@meta(${r.join(", ")})`,a.message,g,a.code);if(a.kind==="empty")return"";if(n)n.__stx_runtime_head=we(n.__stx_runtime_head??{},{meta:[a.tag]});return""},hasEndTag:!1},vr={name:"structuredData",handler:(e,r,n,g)=>{if(e.trim()==="")return i("StructuredData","structuredData directive requires JSON-LD content",t.INVALID_DIRECTIVE_SYNTAX);try{let a=JSON.parse(e);if(!a["@context"])a["@context"]="https://schema.org";if(!a["@type"])return i("StructuredData","structuredData requires @type property",t.INVALID_DIRECTIVE_SYNTAX);return A(a)}catch(a){let s=a instanceof Error?a.message:String(a);return i("StructuredData",s,t.EVALUATION_ERROR)}},hasEndTag:!0};function wd(){return[br,vr]}function xd(e,r){let{baseUrl:n,defaultChangefreq:g="weekly",defaultPriority:a=0.5,includeLastmod:s=!0}=r,c=n.replace(/\/$/,""),o=(m)=>m.startsWith("http")?m:`${c}${m.startsWith("/")?"":"/"}${m}`,u=e.map((m)=>{let d=o(m.loc),f=m.lastmod||(s?new Date().toISOString().split("T")[0]:void 0),E=m.changefreq||g,y=m.priority??a,h=` <url>
47
47
  <loc>${T(d)}</loc>`;for(let w of m.alternates??[])h+=`
48
48
  <xhtml:link rel="alternate" hreflang="${T(w.hreflang)}" href="${T(o(w.href))}"/>`;if(f)h+=`
49
49
  <lastmod>${f}</lastmod>`;return h+=`
@@ -53,13 +53,13 @@ ${y}
53
53
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"${e.some((m)=>m.alternates?.length)?' xmlns:xhtml="http://www.w3.org/1999/xhtml"':""}>
54
54
  ${u.join(`
55
55
  `)}
56
- </urlset>`}function Su(e,r){let n=r.replace(/\/$/,""),g=new Date().toISOString().split("T")[0];return`<?xml version="1.0" encoding="UTF-8"?>
56
+ </urlset>`}function Sd(e,r){let n=r.replace(/\/$/,""),g=new Date().toISOString().split("T")[0];return`<?xml version="1.0" encoding="UTF-8"?>
57
57
  <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
58
58
  ${e.map((s)=>{let c=s.startsWith("http")?s:`${n}${s.startsWith("/")?"":"/"}${s}`;return` <sitemap>
59
59
  <loc>${T(c)}</loc>
60
60
  <lastmod>${g}</lastmod>
61
61
  </sitemap>`}).join(`
62
62
  `)}
63
- </sitemapindex>`}async function ku(e,r){let{extensions:n=[".stx",".html",".htm"],ignore:g=["_*",".*","node_modules","components","partials","layouts"]}=r,a=[],s=n.length===1?`*${n[0]}`:`*{${n.join(",")}}`,c=new Bun.Glob(`**/${s}`);for await(let o of c.scan(e)){if(g.some((f)=>{if(f.startsWith("*"))return o.includes(f.slice(1));return o.startsWith(f)||o.includes(`/${f}`)}))continue;let p=o.replace(/\\/g,"/").replace(/index\.(stx|html|htm)$/,"").replace(/\.(stx|html|htm)$/,"");if(!p.startsWith("/"))p=`/${p}`;if(p!=="/"&&p.endsWith("/"))p=p.slice(0,-1);let m=`${e}/${o}`,d;try{let f=await Bun.file(m).stat();if(f)d=new Date(f.mtime).toISOString().split("T")[0]}catch{}a.push({loc:p||"/",lastmod:d,priority:p==="/"?1:0.5})}return a.sort((o,u)=>o.loc.localeCompare(u.loc)),a}function wr(e){let r=[];for(let n of e.rules){if(r.push(`User-agent: ${n.userAgent}`),n.allow)for(let g of n.allow)r.push(`Allow: ${g}`);if(n.disallow)for(let g of n.disallow)r.push(`Disallow: ${g}`);if(n.crawlDelay!==void 0)r.push(`Crawl-delay: ${n.crawlDelay}`);r.push("")}if(e.sitemap){let n=Array.isArray(e.sitemap)?e.sitemap:[e.sitemap];for(let g of n)r.push(`Sitemap: ${g}`)}if(e.host)r.push(`Host: ${e.host}`);return r.join(`
64
- `).trim()}function Cu(e){return wr({rules:[{userAgent:"*",allow:["/"]}],sitemap:e})}function T(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}
65
- export{Ws,qs,Gs,Ks,br,vr,wu,xu,Su,ku,wr,Cu};
63
+ </sitemapindex>`}async function kd(e,r){let{extensions:n=[".stx",".html",".htm"],ignore:g=["_*",".*","node_modules","components","partials","layouts"]}=r,a=[],s=n.length===1?`*${n[0]}`:`*{${n.join(",")}}`,c=new Bun.Glob(`**/${s}`);for await(let o of c.scan(e)){if(g.some((f)=>{if(f.startsWith("*"))return o.includes(f.slice(1));return o.startsWith(f)||o.includes(`/${f}`)}))continue;let p=o.replace(/\\/g,"/").replace(/index\.(stx|html|htm)$/,"").replace(/\.(stx|html|htm)$/,"");if(!p.startsWith("/"))p=`/${p}`;if(p!=="/"&&p.endsWith("/"))p=p.slice(0,-1);let m=`${e}/${o}`,d;try{let f=await Bun.file(m).stat();if(f)d=new Date(f.mtime).toISOString().split("T")[0]}catch{}a.push({loc:p||"/",lastmod:d,priority:p==="/"?1:0.5})}return a.sort((o,u)=>o.loc.localeCompare(u.loc)),a}function wr(e){let r=[];for(let n of e.rules){if(r.push(`User-agent: ${n.userAgent}`),n.allow)for(let g of n.allow)r.push(`Allow: ${g}`);if(n.disallow)for(let g of n.disallow)r.push(`Disallow: ${g}`);if(n.crawlDelay!==void 0)r.push(`Crawl-delay: ${n.crawlDelay}`);r.push("")}if(e.sitemap){let n=Array.isArray(e.sitemap)?e.sitemap:[e.sitemap];for(let g of n)r.push(`Sitemap: ${g}`)}if(e.host)r.push(`Host: ${e.host}`);return r.join(`
64
+ `).trim()}function Cd(e){return wr({rules:[{userAgent:"*",allow:["/"]}],sitemap:e})}function T(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}
65
+ export{Ws,qs,Gs,Ks,br,vr,wd,xd,Sd,kd,wr,Cd};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Ve,K}from"./chunk-dcs87qta.js";import{Yo}from"./chunk-6fmcs19t.js";import{u}from"./chunk-cg8hg6cs.js";import{existsSync as z,mkdirSync as v,copyFileSync as k,chmodSync as T}from"fs";import{join as o,basename as te}from"path";import{spawn as E,execSync as ae}from"child_process";import{homedir as B,platform as re}from"os";var Bd=`
2
+ import{Ve,K}from"./chunk-dcs87qta.js";import{Yo}from"./chunk-3vbv4gxx.js";import{d}from"./chunk-yn2d8x8m.js";import{existsSync as z,mkdirSync as v,copyFileSync as k,chmodSync as T}from"fs";import{join as o,basename as te}from"path";import{spawn as E,execSync as ae}from"child_process";import{homedir as B,platform as re}from"os";var Bu=`
3
3
  <script>
4
4
  (function() {
5
5
  'use strict';
@@ -931,7 +931,7 @@ else if (data.type === 'event' && data.method) {
931
931
  }
932
932
  })();
933
933
  </script>
934
- `.replace("debug: false,",`debug: ${a},`).replace("timeout: 30000",`timeout: ${r}`)}function Fd(){return!1}function zd(e,a={}){let r=/@craft(?:\(([\s\S]*?)\))?/g;return e.replace(r,(i,s)=>{let t={};if(s)try{t=JSON.parse(s.replace(/'/g,'"'))}catch{try{t=Function(`return ${s}`)()}catch{console.warn(`[stx] Invalid @craft config: ${s}`)}}return Ho(t)})}function Vo(e,a={}){if(e.includes("__craftBridgeInitialized"))return e;let r=Ho(a);if(e.includes("</head>"))return e.replace("</head>",`${r}
934
+ `.replace("debug: false,",`debug: ${a},`).replace("timeout: 30000",`timeout: ${r}`)}function Fu(){return!1}function zu(e,a={}){let r=/@craft(?:\(([\s\S]*?)\))?/g;return e.replace(r,(i,s)=>{let t={};if(s)try{t=JSON.parse(s.replace(/'/g,'"'))}catch{try{t=Function(`return ${s}`)()}catch{console.warn(`[stx] Invalid @craft config: ${s}`)}}return Ho(t)})}function Vo(e,a={}){if(e.includes("__craftBridgeInitialized"))return e;let r=Ho(a);if(e.includes("</head>"))return e.replace("</head>",`${r}
935
935
  </head>`);if(e.includes("<body"))return e.replace(/(<body[^>]*>)/,`$1
936
936
  ${r}`);return r+e}var os={button:{nativeType:"craft-button",fallbackTag:"button",fallbackClasses:"craft-button",nativeProps:["variant","size","disabled","loading"]},"text-input":{nativeType:"craft-text-input",fallbackTag:"input",fallbackClasses:"craft-text-input",nativeProps:["placeholder","value","type","disabled","readonly"]},textarea:{nativeType:"craft-textarea",fallbackTag:"textarea",fallbackClasses:"craft-textarea",nativeProps:["placeholder","value","rows","disabled","readonly"]},checkbox:{nativeType:"craft-checkbox",fallbackTag:"input",fallbackClasses:"craft-checkbox",nativeProps:["checked","disabled","label"],render:(e,a)=>{let r=e.checked?"checked":"",i=e.disabled?"disabled":"";return`<label class="craft-checkbox-wrapper">
937
937
  <input type="checkbox" class="craft-checkbox" ${r} ${i}>
@@ -1365,7 +1365,7 @@ ${r}`);return r+e}var os={button:{nativeType:"craft-button",fallbackTag:"button"
1365
1365
  }
1366
1366
  }
1367
1367
  </style>
1368
- `,Hd=`
1368
+ `,Hu=`
1369
1369
  <script id="craft-component-runtime">
1370
1370
  (function() {
1371
1371
  if (window.__stxCraftComponentRuntime) return;
@@ -2934,17 +2934,17 @@ ${r}`);return r+e}var os={button:{nativeType:"craft-button",fallbackTag:"button"
2934
2934
  document.addEventListener('craft:nativeui:ready', initializeCraftComponents);
2935
2935
  })();
2936
2936
  </script>
2937
- `;return e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(i,s,t)=>R("sidebar",s,t.trim(),a,r)),e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(i,s)=>R("sidebar",s,"",a,r)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(i,s,t)=>R(s,t,"",a,r)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(i,s,t,n)=>R(s,t,n.trim(),a,r)),e}function R(e,a,r,i,s){let t=i.components?.[e]||os[e];if(!t)return console.warn(`[stx] Unknown Craft component: @craft-${e}`),`<div class="${s}-unknown" data-component="${e}">${r}</div>`;let n=A(a),c=[t.fallbackClasses||`${s}-${e}`];if(n.class)c.push(n.class),delete n.class;if(t.render)return n.__fallbackClasses=c.join(" "),t.render(n,r);let d=ee(n,t,c);if(["input","hr","br","img"].includes(t.fallbackTag))return`<${t.fallbackTag} ${d}>`;return`<${t.fallbackTag} ${d}>${r}</${t.fallbackTag}>`}function A(e){let a={},r=/(?::|@)?(\w+[-\w]*)(?:=(?:"([^"]*)"|'([^']*)'))?/g,i;while((i=r.exec(e))!==null){let[s,t,n,c]=i,d=n??c;if(s.startsWith(":"))a[t]=d;else if(s.startsWith("@"))a[`on${t.charAt(0).toUpperCase()}${t.slice(1)}`]=d;else if(d===void 0)a[t]=!0;else a[t]=d}return a}function U(e,a){let r=I(String(e.id||`craft-sidebar-${X(a||JSON.stringify(e))}`)),i=Y(e.spaces)||J(a),s=i.length?[]:G(e.sections)||F(a),t=String(e.selectedSpace||i[0]?.id||""),n=i.find((m)=>m.id===t)||i[0],c=String(e.selectedItem||e.selected||(i.length?n?.sections[0]?.items[0]?.id:s[0]?.items[0]?.id)||""),d={id:r,variant:String(e.variant||"desktop"),material:String(e.material||"sidebar"),backgroundEffect:String(e.backgroundEffect||"shimmer"),allowsVibrancy:e.allowsVibrancy!==!1&&e.allowsVibrancy!=="false",materialOpacity:Number(e.materialOpacity??0.68),materialDarkOpacity:e.materialDarkOpacity===void 0?void 0:Number(e.materialDarkOpacity),minWidth:e.minWidth===void 0?240:Number(e.minWidth),maxWidth:e.maxWidth===void 0?340:Number(e.maxWidth),canCollapse:e.canCollapse!==!1&&e.canCollapse!=="false",searchPlaceholder:e.searchPlaceholder?String(e.searchPlaceholder):void 0,selectedItem:c,sections:s,spaces:i,selectedSpace:t||void 0},l=String(e.__fallbackClasses||"craft-sidebar craft-sidebar-tahoe"),b=Number(e.width||e.sidebarWidth||286),f=e.native===!1||e.native==="false"?"false":"true",x=d.searchPlaceholder?`<div class="craft-sidebar-search"><input type="search" placeholder="${C(d.searchPlaceholder)}"></div>`:"",p;if(i.length)p=Q(i,t,c);else if(s.length)p=s.map((m)=>D(m,c)).join("");else p=a;return`<aside class="${h(l)}" data-craft="craft-sidebar" data-craft-native-sidebar data-craft-sidebar-id="${h(r)}" data-native="${f}" style="--craft-sidebar-width:${b}px">
2937
+ `;return e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(i,s,t)=>R("sidebar",s,t.trim(),a,r)),e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(i,s)=>R("sidebar",s,"",a,r)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(i,s,t)=>R(s,t,"",a,r)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(i,s,t,n)=>R(s,t,n.trim(),a,r)),e}function R(e,a,r,i,s){let t=i.components?.[e]||os[e];if(!t)return console.warn(`[stx] Unknown Craft component: @craft-${e}`),`<div class="${s}-unknown" data-component="${e}">${r}</div>`;let n=A(a),c=[t.fallbackClasses||`${s}-${e}`];if(n.class)c.push(n.class),delete n.class;if(t.render)return n.__fallbackClasses=c.join(" "),t.render(n,r);let l=ee(n,t,c);if(["input","hr","br","img"].includes(t.fallbackTag))return`<${t.fallbackTag} ${l}>`;return`<${t.fallbackTag} ${l}>${r}</${t.fallbackTag}>`}function A(e){let a={},r=/(?::|@)?(\w+[-\w]*)(?:=(?:"([^"]*)"|'([^']*)'))?/g,i;while((i=r.exec(e))!==null){let[s,t,n,c]=i,l=n??c;if(s.startsWith(":"))a[t]=l;else if(s.startsWith("@"))a[`on${t.charAt(0).toUpperCase()}${t.slice(1)}`]=l;else if(l===void 0)a[t]=!0;else a[t]=l}return a}function U(e,a){let r=I(String(e.id||`craft-sidebar-${X(a||JSON.stringify(e))}`)),i=Y(e.spaces)||J(a),s=i.length?[]:G(e.sections)||F(a),t=String(e.selectedSpace||i[0]?.id||""),n=i.find((m)=>m.id===t)||i[0],c=String(e.selectedItem||e.selected||(i.length?n?.sections[0]?.items[0]?.id:s[0]?.items[0]?.id)||""),l={id:r,variant:String(e.variant||"desktop"),material:String(e.material||"sidebar"),backgroundEffect:String(e.backgroundEffect||"shimmer"),allowsVibrancy:e.allowsVibrancy!==!1&&e.allowsVibrancy!=="false",materialOpacity:Number(e.materialOpacity??0.68),materialDarkOpacity:e.materialDarkOpacity===void 0?void 0:Number(e.materialDarkOpacity),minWidth:e.minWidth===void 0?240:Number(e.minWidth),maxWidth:e.maxWidth===void 0?340:Number(e.maxWidth),canCollapse:e.canCollapse!==!1&&e.canCollapse!=="false",searchPlaceholder:e.searchPlaceholder?String(e.searchPlaceholder):void 0,selectedItem:c,sections:s,spaces:i,selectedSpace:t||void 0},f=String(e.__fallbackClasses||"craft-sidebar craft-sidebar-tahoe"),b=Number(e.width||e.sidebarWidth||286),p=e.native===!1||e.native==="false"?"false":"true",x=l.searchPlaceholder?`<div class="craft-sidebar-search"><input type="search" placeholder="${C(l.searchPlaceholder)}"></div>`:"",u;if(i.length)u=Q(i,t,c);else if(s.length)u=s.map((m)=>D(m,c)).join("");else u=a;return`<aside class="${h(f)}" data-craft="craft-sidebar" data-craft-native-sidebar data-craft-sidebar-id="${h(r)}" data-native="${p}" style="--craft-sidebar-width:${b}px">
2938
2938
  ${x}
2939
- ${p}
2939
+ ${u}
2940
2940
  </aside>
2941
- <script type="application/json" data-craft-sidebar-config="${h(r)}">${Z(d)}</script>`}function j(e,a){let r=I(String(e.id||e.label||"space"));return`<section class="craft-sidebar-space" data-craft="craft-sidebar-space" data-space-id="${h(r)}">
2941
+ <script type="application/json" data-craft-sidebar-config="${h(r)}">${Z(l)}</script>`}function j(e,a){let r=I(String(e.id||e.label||"space"));return`<section class="craft-sidebar-space" data-craft="craft-sidebar-space" data-space-id="${h(r)}">
2942
2942
  ${e.label?`<div class="craft-sidebar-space-title">${C(String(e.label))}</div>`:""}
2943
2943
  ${a}
2944
2944
  </section>`}function H(e,a){let r=String(e.header||e.title||"");return`<section class="craft-sidebar-section" data-craft="craft-sidebar-section" data-section-id="${h(String(e.id||"section"))}">
2945
2945
  ${r?`<div class="craft-sidebar-section-title">${C(r)}</div>`:""}
2946
2946
  ${a}
2947
- </section>`}function V(e,a){let r={id:String(e.id||I(String(e.label||a||"item"))),label:String(e.label||a||""),icon:e.icon?String(e.icon):void 0,badge:e.badge?String(e.badge):void 0,tintColor:e.tintColor?String(e.tintColor):void 0};return O(r,String(e.selected||"")==="true")}function F(e){let a=[],r=/<@craft-sidebar-section\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-section>)/g,i;while((i=r.exec(e))!==null){let s=A(i[1]||""),t=i[2]||"",n=String(s.id||I(String(s.header||s.title||`section-${a.length+1}`))),c=String(s.header||s.title||n),d=W(t);a.push({id:n,header:c,title:c,items:d})}return a}function W(e){let a=[],r=/<@craft-sidebar-item\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-item>)/g,i;while((i=r.exec(e))!==null){let s=A(i[1]||""),t=String(s.label||(i[2]||"").replace(/<[^>]*>/g,"").trim()),n=String(s.id||I(t||`item-${a.length+1}`));a.push({id:n,label:t,icon:s.icon?String(s.icon):void 0,badge:s.badge?String(s.badge):void 0,tintColor:s.tintColor?String(s.tintColor):void 0})}return a}function J(e){let a=[],r=/<@craft-sidebar-space\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-space>)/g,i;while((i=r.exec(e))!==null){let s=A(i[1]||""),t=i[2]||"",n=String(s.label||s.title||`Space ${a.length+1}`);a.push({id:String(s.id||I(n)),label:n,icon:s.icon?String(s.icon):void 0,tint:s.tint?String(s.tint):void 0,sections:F(t)})}return a}function Y(e){if(!e)return;if(Array.isArray(e))return e;if(typeof e!=="string")return;try{let a=JSON.parse(e);return Array.isArray(a)?a:void 0}catch{return}}function Q(e,a,r){let i=e.map((t)=>`<button class="craft-sidebar-space-tab" type="button" data-space-target="${h(t.id)}" data-selected="${t.id===a?"true":"false"}" title="${h(t.label||t.id)}">${t.icon?`<span class="craft-sidebar-item-icon" data-icon="${h(t.icon)}"></span>`:C((t.label||t.id).charAt(0))}</button>`).join("");return`<div class="craft-sidebar-spaces">${e.map((t)=>`<section class="craft-sidebar-space" data-space-id="${h(t.id)}" data-selected="${t.id===a?"true":"false"}">
2947
+ </section>`}function V(e,a){let r={id:String(e.id||I(String(e.label||a||"item"))),label:String(e.label||a||""),icon:e.icon?String(e.icon):void 0,badge:e.badge?String(e.badge):void 0,tintColor:e.tintColor?String(e.tintColor):void 0};return O(r,String(e.selected||"")==="true")}function F(e){let a=[],r=/<@craft-sidebar-section\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-section>)/g,i;while((i=r.exec(e))!==null){let s=A(i[1]||""),t=i[2]||"",n=String(s.id||I(String(s.header||s.title||`section-${a.length+1}`))),c=String(s.header||s.title||n),l=W(t);a.push({id:n,header:c,title:c,items:l})}return a}function W(e){let a=[],r=/<@craft-sidebar-item\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-item>)/g,i;while((i=r.exec(e))!==null){let s=A(i[1]||""),t=String(s.label||(i[2]||"").replace(/<[^>]*>/g,"").trim()),n=String(s.id||I(t||`item-${a.length+1}`));a.push({id:n,label:t,icon:s.icon?String(s.icon):void 0,badge:s.badge?String(s.badge):void 0,tintColor:s.tintColor?String(s.tintColor):void 0})}return a}function J(e){let a=[],r=/<@craft-sidebar-space\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-space>)/g,i;while((i=r.exec(e))!==null){let s=A(i[1]||""),t=i[2]||"",n=String(s.label||s.title||`Space ${a.length+1}`);a.push({id:String(s.id||I(n)),label:n,icon:s.icon?String(s.icon):void 0,tint:s.tint?String(s.tint):void 0,sections:F(t)})}return a}function Y(e){if(!e)return;if(Array.isArray(e))return e;if(typeof e!=="string")return;try{let a=JSON.parse(e);return Array.isArray(a)?a:void 0}catch{return}}function Q(e,a,r){let i=e.map((t)=>`<button class="craft-sidebar-space-tab" type="button" data-space-target="${h(t.id)}" data-selected="${t.id===a?"true":"false"}" title="${h(t.label||t.id)}">${t.icon?`<span class="craft-sidebar-item-icon" data-icon="${h(t.icon)}"></span>`:C((t.label||t.id).charAt(0))}</button>`).join("");return`<div class="craft-sidebar-spaces">${e.map((t)=>`<section class="craft-sidebar-space" data-space-id="${h(t.id)}" data-selected="${t.id===a?"true":"false"}">
2948
2948
  ${t.label?`<div class="craft-sidebar-space-title">${C(t.label)}</div>`:""}
2949
2949
  ${t.sections.map((n)=>D(n,r)).join("")}
2950
2950
  </section>`).join("")}</div>
@@ -2955,16 +2955,16 @@ ${r}`);return r+e}var os={button:{nativeType:"craft-button",fallbackTag:"button"
2955
2955
  ${e.icon?`<span class="craft-sidebar-item-icon" data-icon="${h(e.icon)}"${r}></span>`:""}
2956
2956
  <span class="craft-sidebar-item-label">${C(e.label)}</span>
2957
2957
  ${e.badge?`<span class="craft-sidebar-item-badge">${C(e.badge)}</span>`:""}
2958
- </button>`}function I(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function X(e){let a=5381;for(let r=0;r<e.length;r++)a=a*33^e.charCodeAt(r);return(a>>>0).toString(36)}function C(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function h(e){return C(e).replace(/`/g,"&#96;")}function Z(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function ee(e,a,r){let i=[];i.push(`class="${r.join(" ")}"`),i.push(`data-craft="${a.nativeType}"`);for(let[s,t]of Object.entries(e))if(t===!0)i.push(s);else if(t!==!1&&t!==void 0&&t!==null){let n=String(t).replace(/"/g,"&quot;");i.push(`${s}="${n}"`)}return i.join(" ")}function Vd(e,a){os[e]=a}function Ud(){return{...os}}async function qo(e){let a=Date.now();try{if(!await Bun.file(e.input).exists())return{success:!1,target:e.target||P(),format:e.format||"app",error:`Input file not found: ${e.input}`};let r=e.target||P(),i=e.format||pe(r),s=e.output||o(process.cwd(),"dist","native");if(!z(s))v(s,{recursive:!0});let t=await Yo(e.input,{context:e.context,options:{isDev:!1}});if(t=Vo(t,{debug:e.verbose}),t=Wo(t),!t.includes("craft-component-styles")){if(t.includes("</head>"))t=t.replace("</head>",`${Uo}
2959
- </head>`)}let n=e.name||te(e.input,".stx"),c=e.version||"1.0.0",d=e.craftPath||await fe();if(!d)return{success:!1,target:r,format:i,error:"Craft binary not found. Please install Craft or specify craftPath."};if(e.verbose)console.log(`\uD83D\uDCE6 Building native app for ${r}...`),console.log(` Input: ${e.input}`),console.log(` Output: ${s}`),console.log(` Craft: ${d}`);let l;switch(r){case"macos":l=await ie(t,n,c,s,i,e,d);break;case"windows":l=await oe(t,n,c,s,i,e,d);break;case"linux":l=await ce(t,n,c,s,i,e,d);break;case"ios":l=await de(t,n,c,s,e,d);break;case"android":l=await le(t,n,c,s,e,d);break;default:l={success:!1,target:r,format:i,error:`Unsupported target: ${r}`}}return l.duration=Date.now()-a,l}catch(r){return{success:!1,target:e.target||P(),format:e.format||"app",error:r.message,duration:Date.now()-a}}}async function ie(e,a,r,i,s,t,n){let c=t.bundleId||`com.stx.${a.toLowerCase().replace(/[^a-z0-9]/g,"")}`,d=o(i,`${a}.app`),l=o(d,"Contents"),b=o(l,"MacOS"),f=o(l,"Resources");v(b,{recursive:!0}),v(f,{recursive:!0});let x=o(f,"index.html");await Bun.write(x,e);let p="";if(t.sidebar?.enabled&&t.sidebar?.config)p=o(f,"sidebar-config.json"),await Bun.write(p,JSON.stringify(t.sidebar.config));let m=t.sidebar?.enabled?`--native-sidebar --sidebar-width ${t.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",y=t.menubarOnly??t.systemTray;if((t.bundleStyle||(await se(n)?"executable":"launcher"))==="executable"){let S=o(b,a);k(n,S),T(S,493);let w={html:"index.html",title:t.window?.title||a,width:t.window?.width||1200,height:t.window?.height||800,devTools:Boolean(t.devTools)};if(y)w.menubarOnly=!0;else if(t.systemTray)w.systemTray=!0;if(t.window?.frameless)w.frameless=!0;if(t.window?.transparent)w.transparent=!0;if(t.window?.alwaysOnTop)w.alwaysOnTop=!0;if(t.window?.resizable===!1)w.resizable=!1;await Bun.write(o(f,"craft.json"),`${JSON.stringify(w,null,2)}
2958
+ </button>`}function I(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function X(e){let a=5381;for(let r=0;r<e.length;r++)a=a*33^e.charCodeAt(r);return(a>>>0).toString(36)}function C(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function h(e){return C(e).replace(/`/g,"&#96;")}function Z(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function ee(e,a,r){let i=[];i.push(`class="${r.join(" ")}"`),i.push(`data-craft="${a.nativeType}"`);for(let[s,t]of Object.entries(e))if(t===!0)i.push(s);else if(t!==!1&&t!==void 0&&t!==null){let n=String(t).replace(/"/g,"&quot;");i.push(`${s}="${n}"`)}return i.join(" ")}function Vu(e,a){os[e]=a}function Uu(){return{...os}}async function qo(e){let a=Date.now();try{if(!await Bun.file(e.input).exists())return{success:!1,target:e.target||P(),format:e.format||"app",error:`Input file not found: ${e.input}`};let r=e.target||P(),i=e.format||pe(r),s=e.output||o(process.cwd(),"dist","native");if(!z(s))v(s,{recursive:!0});let t=await Yo(e.input,{context:e.context,options:{isDev:!1}});if(t=Vo(t,{debug:e.verbose}),t=Wo(t),!t.includes("craft-component-styles")){if(t.includes("</head>"))t=t.replace("</head>",`${Uo}
2959
+ </head>`)}let n=e.name||te(e.input,".stx"),c=e.version||"1.0.0",l=e.craftPath||await fe();if(!l)return{success:!1,target:r,format:i,error:"Craft binary not found. Please install Craft or specify craftPath."};if(e.verbose)console.log(`\uD83D\uDCE6 Building native app for ${r}...`),console.log(` Input: ${e.input}`),console.log(` Output: ${s}`),console.log(` Craft: ${l}`);let f;switch(r){case"macos":f=await ie(t,n,c,s,i,e,l);break;case"windows":f=await oe(t,n,c,s,i,e,l);break;case"linux":f=await ce(t,n,c,s,i,e,l);break;case"ios":f=await de(t,n,c,s,e,l);break;case"android":f=await le(t,n,c,s,e,l);break;default:f={success:!1,target:r,format:i,error:`Unsupported target: ${r}`}}return f.duration=Date.now()-a,f}catch(r){return{success:!1,target:e.target||P(),format:e.format||"app",error:r.message,duration:Date.now()-a}}}async function ie(e,a,r,i,s,t,n){let c=t.bundleId||`com.stx.${a.toLowerCase().replace(/[^a-z0-9]/g,"")}`,l=o(i,`${a}.app`),f=o(l,"Contents"),b=o(f,"MacOS"),p=o(f,"Resources");v(b,{recursive:!0}),v(p,{recursive:!0});let x=o(p,"index.html");await Bun.write(x,e);let u="";if(t.sidebar?.enabled&&t.sidebar?.config)u=o(p,"sidebar-config.json"),await Bun.write(u,JSON.stringify(t.sidebar.config));let m=t.sidebar?.enabled?`--native-sidebar --sidebar-width ${t.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",y=t.menubarOnly??t.systemTray;if((t.bundleStyle||(await se(n)?"executable":"launcher"))==="executable"){let S=o(b,a);k(n,S),T(S,493);let w={html:"index.html",title:t.window?.title||a,width:t.window?.width||1200,height:t.window?.height||800,devTools:Boolean(t.devTools)};if(y)w.menubarOnly=!0;else if(t.systemTray)w.systemTray=!0;if(t.window?.frameless)w.frameless=!0;if(t.window?.transparent)w.transparent=!0;if(t.window?.alwaysOnTop)w.alwaysOnTop=!0;if(t.window?.resizable===!1)w.resizable=!1;await Bun.write(o(p,"craft.json"),`${JSON.stringify(w,null,2)}
2960
2960
  `)}else{let S=o(b,"craft");k(n,S),T(S,493);let w=t.sidebar?.enabled?`--native-sidebar --sidebar-width ${t.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",L=`#!/bin/bash
2961
2961
  set -euo pipefail
2962
2962
  DIR="$( cd "$( dirname "\${BASH_SOURCE[0]}" )" && pwd )"
2963
2963
  RESOURCES="$DIR/../Resources"
2964
2964
  exec "$DIR/craft" --html-file "$RESOURCES/index.html" \\
2965
2965
  ${[`--title "${t.window?.title||a}"`,`--width ${t.window?.width||1200}`,`--height ${t.window?.height||800}`,y?"--menubar-only":t.systemTray?"--system-tray":"",t.devTools?"":"--no-devtools",t.window?.frameless?"--frameless":"",t.window?.transparent?"--transparent":"",t.window?.alwaysOnTop?"--always-on-top":"",t.window?.resizable===!1?"--no-resize":"",w].filter(Boolean).join(" \\\n ")}
2966
- `,q=o(b,a);await Bun.write(q,L),T(q,493)}let N=Boolean(t.icon&&await Bun.file(t.icon).exists());if(N)k(t.icon,o(f,"AppIcon.icns"));let M={CFBundleExecutable:a,CFBundleIdentifier:c,CFBundleName:a,CFBundleDisplayName:a,CFBundleShortVersionString:r,CFBundleVersion:r,CFBundlePackageType:"APPL",CFBundleSignature:"????",LSMinimumSystemVersion:t.minimumSystemVersion||"13.0",NSHighResolutionCapable:!0,NSSupportsAutomaticGraphicsSwitching:!0,LSUIElement:t.menubarOnly??Boolean(t.systemTray),...N?{CFBundleIconFile:"AppIcon"}:{},...t.category?{LSApplicationCategoryType:t.category}:{},...t.copyright?{NSHumanReadableCopyright:t.copyright}:{},...t.infoPlist||{}};if(await Bun.write(o(l,"Info.plist"),ne(M)),s==="dmg"){let S=o(i,`${a}-${r}.dmg`),w=await ue(d,S,a);if(!w.success)return{success:!1,target:"macos",format:"dmg",error:w.error};return{success:!0,target:"macos",format:"dmg",outputPath:S}}return{success:!0,target:"macos",format:"app",outputPath:d}}async function se(e){try{let a=Bun.spawn([e,"--version"],{stdout:"pipe",stderr:"pipe"}),[r,i]=await Promise.all([new Response(a.stdout).text(),new Response(a.stderr).text()]);await a.exited;let t=`${r}
2967
- ${i}`.match(/(\d+)\.(\d+)\.(\d+)/);if(!t)return!1;let[n,c,d]=t.slice(1).map(Number);if(n>0||c>0)return!0;return d>=57}catch{return!1}}function _(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ne(e){return`<?xml version="1.0" encoding="UTF-8"?>
2966
+ `,q=o(b,a);await Bun.write(q,L),T(q,493)}let N=Boolean(t.icon&&await Bun.file(t.icon).exists());if(N)k(t.icon,o(p,"AppIcon.icns"));let M={CFBundleExecutable:a,CFBundleIdentifier:c,CFBundleName:a,CFBundleDisplayName:a,CFBundleShortVersionString:r,CFBundleVersion:r,CFBundlePackageType:"APPL",CFBundleSignature:"????",LSMinimumSystemVersion:t.minimumSystemVersion||"13.0",NSHighResolutionCapable:!0,NSSupportsAutomaticGraphicsSwitching:!0,LSUIElement:t.menubarOnly??Boolean(t.systemTray),...N?{CFBundleIconFile:"AppIcon"}:{},...t.category?{LSApplicationCategoryType:t.category}:{},...t.copyright?{NSHumanReadableCopyright:t.copyright}:{},...t.infoPlist||{}};if(await Bun.write(o(f,"Info.plist"),ne(M)),s==="dmg"){let S=o(i,`${a}-${r}.dmg`),w=await ue(l,S,a);if(!w.success)return{success:!1,target:"macos",format:"dmg",error:w.error};return{success:!0,target:"macos",format:"dmg",outputPath:S}}return{success:!0,target:"macos",format:"app",outputPath:l}}async function se(e){try{let a=Bun.spawn([e,"--version"],{stdout:"pipe",stderr:"pipe"}),[r,i]=await Promise.all([new Response(a.stdout).text(),new Response(a.stderr).text()]);await a.exited;let t=`${r}
2967
+ ${i}`.match(/(\d+)\.(\d+)\.(\d+)/);if(!t)return!1;let[n,c,l]=t.slice(1).map(Number);if(n>0||c>0)return!0;return l>=57}catch{return!1}}function _(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ne(e){return`<?xml version="1.0" encoding="UTF-8"?>
2968
2968
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
2969
2969
  <plist version="1.0">
2970
2970
  <dict>
@@ -2973,7 +2973,7 @@ ${Object.entries(e).map(([r,i])=>{let s=typeof i==="boolean"?`<${i}/>`:typeof i=
2973
2973
  `)}
2974
2974
  </dict>
2975
2975
  </plist>
2976
- `}async function oe(e,a,r,i,s,t,n){let c=o(i,a);v(c,{recursive:!0});let d=o(c,"index.html");await Bun.write(d,e),k(n,o(c,"craft.exe"));let l=`@echo off
2976
+ `}async function oe(e,a,r,i,s,t,n){let c=o(i,a);v(c,{recursive:!0});let l=o(c,"index.html");await Bun.write(l,e),k(n,o(c,"craft.exe"));let f=`@echo off
2977
2977
  set DIR=%~dp0
2978
2978
  "%DIR%craft.exe" --html-file "%DIR%index.html" ^
2979
2979
  --title "${t.window?.title||a}" ^
@@ -2981,7 +2981,7 @@ set DIR=%~dp0
2981
2981
  --height ${t.window?.height||800} ^
2982
2982
  ${t.systemTray?"--system-tray":""} ^
2983
2983
  ${t.devTools?"":"--no-devtools"}
2984
- `;if(await Bun.write(o(c,`${a}.bat`),l),s==="zip"){let b=o(i,`${a}-${r}-windows.zip`),f=await be(c,b);if(!f.success)return{success:!1,target:"windows",format:"zip",error:f.error};return{success:!0,target:"windows",format:"zip",outputPath:b}}return{success:!0,target:"windows",format:"app",outputPath:c}}async function ce(e,a,r,i,s,t,n){let c=o(i,a);v(c,{recursive:!0});let d=o(c,"index.html");await Bun.write(d,e);let l=o(c,"craft");k(n,l),T(l,493);let b=`#!/bin/bash
2984
+ `;if(await Bun.write(o(c,`${a}.bat`),f),s==="zip"){let b=o(i,`${a}-${r}-windows.zip`),p=await be(c,b);if(!p.success)return{success:!1,target:"windows",format:"zip",error:p.error};return{success:!0,target:"windows",format:"zip",outputPath:b}}return{success:!0,target:"windows",format:"app",outputPath:c}}async function ce(e,a,r,i,s,t,n){let c=o(i,a);v(c,{recursive:!0});let l=o(c,"index.html");await Bun.write(l,e);let f=o(c,"craft");k(n,f),T(f,493);let b=`#!/bin/bash
2985
2985
  set -euo pipefail
2986
2986
  DIR="$( cd "$( dirname "\${BASH_SOURCE[0]}" )" && pwd )"
2987
2987
  exec "$DIR/craft" --html-file "$DIR/index.html" \\
@@ -2990,15 +2990,15 @@ exec "$DIR/craft" --html-file "$DIR/index.html" \\
2990
2990
  --height ${t.window?.height||800} \\
2991
2991
  ${t.systemTray?"--system-tray":""} \\
2992
2992
  ${t.devTools?"":"--no-devtools"}
2993
- `,f=o(c,a.toLowerCase());await Bun.write(f,b),T(f,493);let x=`[Desktop Entry]
2993
+ `,p=o(c,a.toLowerCase());await Bun.write(p,b),T(p,493);let x=`[Desktop Entry]
2994
2994
  Type=Application
2995
2995
  Name=${a}
2996
- Exec=${f}
2996
+ Exec=${p}
2997
2997
  Terminal=false
2998
2998
  Categories=Utility;
2999
- `;if(await Bun.write(o(c,`${a.toLowerCase()}.desktop`),x),s==="deb"){let p=o(i,`${a.toLowerCase()}_${r}_amd64.deb`),m=await ge(c,p,a,r,t);if(!m.success)return{success:!1,target:"linux",format:"deb",error:m.error};return{success:!0,target:"linux",format:"deb",outputPath:p}}if(s==="appimage"){let p=o(i,`${a}-${r}-x86_64.AppImage`),m=await me(c,p,a,t);if(!m.success)return{success:!1,target:"linux",format:"appimage",error:m.error};return{success:!0,target:"linux",format:"appimage",outputPath:p}}return{success:!0,target:"linux",format:"app",outputPath:c}}async function de(e,a,r,i,s,t){return{success:!1,target:"ios",format:"ipa",error:`iOS build requires Xcode and additional setup. Use 'stx init:ios ${a}' to create an iOS project.`}}async function le(e,a,r,i,s,t){return{success:!1,target:"android",format:"apk",error:`Android build requires Android SDK and additional setup. Use 'stx init:android ${a}' to create an Android project.`}}async function fe(){if(process.env.CRAFT_BIN&&await Bun.file(process.env.CRAFT_BIN).exists())return process.env.CRAFT_BIN;let e=[o(process.cwd(),"../../craft/packages/zig/zig-out/bin/craft"),o(process.cwd(),"../craft/packages/zig/zig-out/bin/craft"),o(B(),"Code/Tools/craft/packages/zig/zig-out/bin/craft"),o(B(),"Code/craft/packages/zig/zig-out/bin/craft"),"/usr/local/bin/craft","/usr/bin/craft",o(B(),".local/bin/craft"),o(process.env.LOCALAPPDATA||"","craft","craft.exe"),o(process.env.PROGRAMFILES||"","craft","craft.exe")];for(let a of e)if(await Bun.file(a).exists())return a;try{let r=ae("which craft 2>/dev/null || where craft 2>nul",{encoding:"utf-8"}).trim().split(`
3000
- `)[0];if(r&&await Bun.file(r).exists())return r}catch{}return null}function P(){switch(re()){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}function pe(e){switch(e){case"macos":return"app";case"windows":return"zip";case"linux":return"appimage";case"ios":return"ipa";case"android":return"apk";default:return"app"}}async function ue(e,a,r){return new Promise((i)=>{let s=E("hdiutil",["create","-volname",r,"-srcfolder",e,"-ov","-format","UDZO",a]);s.on("close",(t)=>{if(t===0)i({success:!0});else i({success:!1,error:`hdiutil exited with code ${t}`})}),s.on("error",(t)=>{i({success:!1,error:t.message})})})}async function be(e,a){return new Promise((r)=>{let i=E("zip",["-r",a,"."],{cwd:e});i.on("close",(s)=>{if(s===0)r({success:!0});else r({success:!1,error:`zip exited with code ${s}`})}),i.on("error",(s)=>{r({success:!1,error:s.message})})})}async function ge(e,a,r,i,s){return new Promise((t)=>{let n=Ve("deb");try{let c=o(n,"pkg"),d=o(c,"DEBIAN"),l=o(c,"usr","bin"),b=o(c,"usr","share","applications"),f=o(c,"usr","share",r.toLowerCase());v(d,{recursive:!0}),v(l,{recursive:!0}),v(b,{recursive:!0}),v(f,{recursive:!0});let x=u("fs").readdirSync(e);for(let g of x)k(o(e,g),o(f,g));let p=`#!/bin/bash
3001
- exec /usr/share/${r.toLowerCase()}/${r.toLowerCase()} "$@"`;u("fs").writeFileSync(o(l,r.toLowerCase()),p),T(o(l,r.toLowerCase()),493);let m=`Package: ${r.toLowerCase()}
2999
+ `;if(await Bun.write(o(c,`${a.toLowerCase()}.desktop`),x),s==="deb"){let u=o(i,`${a.toLowerCase()}_${r}_amd64.deb`),m=await ge(c,u,a,r,t);if(!m.success)return{success:!1,target:"linux",format:"deb",error:m.error};return{success:!0,target:"linux",format:"deb",outputPath:u}}if(s==="appimage"){let u=o(i,`${a}-${r}-x86_64.AppImage`),m=await me(c,u,a,t);if(!m.success)return{success:!1,target:"linux",format:"appimage",error:m.error};return{success:!0,target:"linux",format:"appimage",outputPath:u}}return{success:!0,target:"linux",format:"app",outputPath:c}}async function de(e,a,r,i,s,t){return{success:!1,target:"ios",format:"ipa",error:`iOS build requires Xcode and additional setup. Use 'stx init:ios ${a}' to create an iOS project.`}}async function le(e,a,r,i,s,t){return{success:!1,target:"android",format:"apk",error:`Android build requires Android SDK and additional setup. Use 'stx init:android ${a}' to create an Android project.`}}async function fe(){if(process.env.CRAFT_BIN&&await Bun.file(process.env.CRAFT_BIN).exists())return process.env.CRAFT_BIN;let e=[o(process.cwd(),"../../craft/packages/zig/zig-out/bin/craft"),o(process.cwd(),"../craft/packages/zig/zig-out/bin/craft"),o(B(),"Code/Tools/craft/packages/zig/zig-out/bin/craft"),o(B(),"Code/craft/packages/zig/zig-out/bin/craft"),"/usr/local/bin/craft","/usr/bin/craft",o(B(),".local/bin/craft"),o(process.env.LOCALAPPDATA||"","craft","craft.exe"),o(process.env.PROGRAMFILES||"","craft","craft.exe")];for(let a of e)if(await Bun.file(a).exists())return a;try{let r=ae("which craft 2>/dev/null || where craft 2>nul",{encoding:"utf-8"}).trim().split(`
3000
+ `)[0];if(r&&await Bun.file(r).exists())return r}catch{}return null}function P(){switch(re()){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}function pe(e){switch(e){case"macos":return"app";case"windows":return"zip";case"linux":return"appimage";case"ios":return"ipa";case"android":return"apk";default:return"app"}}async function ue(e,a,r){return new Promise((i)=>{let s=E("hdiutil",["create","-volname",r,"-srcfolder",e,"-ov","-format","UDZO",a]);s.on("close",(t)=>{if(t===0)i({success:!0});else i({success:!1,error:`hdiutil exited with code ${t}`})}),s.on("error",(t)=>{i({success:!1,error:t.message})})})}async function be(e,a){return new Promise((r)=>{let i=E("zip",["-r",a,"."],{cwd:e});i.on("close",(s)=>{if(s===0)r({success:!0});else r({success:!1,error:`zip exited with code ${s}`})}),i.on("error",(s)=>{r({success:!1,error:s.message})})})}async function ge(e,a,r,i,s){return new Promise((t)=>{let n=Ve("deb");try{let c=o(n,"pkg"),l=o(c,"DEBIAN"),f=o(c,"usr","bin"),b=o(c,"usr","share","applications"),p=o(c,"usr","share",r.toLowerCase());v(l,{recursive:!0}),v(f,{recursive:!0}),v(b,{recursive:!0}),v(p,{recursive:!0});let x=d("fs").readdirSync(e);for(let g of x)k(o(e,g),o(p,g));let u=`#!/bin/bash
3001
+ exec /usr/share/${r.toLowerCase()}/${r.toLowerCase()} "$@"`;d("fs").writeFileSync(o(f,r.toLowerCase()),u),T(o(f,r.toLowerCase()),493);let m=`Package: ${r.toLowerCase()}
3002
3002
  Version: ${i}
3003
3003
  Section: utils
3004
3004
  Priority: optional
@@ -3006,17 +3006,17 @@ Architecture: amd64
3006
3006
  Depends: libgtk-3-0, libwebkit2gtk-4.0-37
3007
3007
  Maintainer: ${s.author||"Unknown"}
3008
3008
  Description: ${s.description||r}
3009
- `;u("fs").writeFileSync(o(d,"control"),m);let y=E("dpkg-deb",["--build",c,a]);y.on("close",(g)=>{if(K(n),g===0)t({success:!0});else t({success:!1,error:`dpkg-deb exited with code ${g}`})}),y.on("error",(g)=>{K(n),t({success:!1,error:g.message})})}catch(c){K(n),t({success:!1,error:c.message})}})}async function me(e,a,r,i){return new Promise((s)=>{let t=Ve("appimage");try{let n=o(t,`${r}.AppDir`),c=o(n,"usr"),d=o(c,"bin"),l=o(c,"share");v(d,{recursive:!0}),v(l,{recursive:!0});let b=o(l,r.toLowerCase());v(b,{recursive:!0});let f=u("fs").readdirSync(e);for(let g of f)k(o(e,g),o(b,g));let x=`#!/bin/bash
3009
+ `;d("fs").writeFileSync(o(l,"control"),m);let y=E("dpkg-deb",["--build",c,a]);y.on("close",(g)=>{if(K(n),g===0)t({success:!0});else t({success:!1,error:`dpkg-deb exited with code ${g}`})}),y.on("error",(g)=>{K(n),t({success:!1,error:g.message})})}catch(c){K(n),t({success:!1,error:c.message})}})}async function me(e,a,r,i){return new Promise((s)=>{let t=Ve("appimage");try{let n=o(t,`${r}.AppDir`),c=o(n,"usr"),l=o(c,"bin"),f=o(c,"share");v(l,{recursive:!0}),v(f,{recursive:!0});let b=o(f,r.toLowerCase());v(b,{recursive:!0});let p=d("fs").readdirSync(e);for(let g of p)k(o(e,g),o(b,g));let x=`#!/bin/bash
3010
3010
  SELF=$(readlink -f "$0")
3011
3011
  HERE=\${SELF%/*}
3012
3012
  export PATH="\${HERE}/usr/bin:\${PATH}"
3013
3013
  exec "\${HERE}/usr/share/${r.toLowerCase()}/${r.toLowerCase()}" "$@"
3014
- `;u("fs").writeFileSync(o(n,"AppRun"),x),T(o(n,"AppRun"),493);let p=`[Desktop Entry]
3014
+ `;d("fs").writeFileSync(o(n,"AppRun"),x),T(o(n,"AppRun"),493);let u=`[Desktop Entry]
3015
3015
  Type=Application
3016
3016
  Name=${r}
3017
3017
  Exec=${r.toLowerCase()}
3018
3018
  Terminal=false
3019
3019
  Categories=Utility;
3020
3020
  Icon=${r.toLowerCase()}
3021
- `;u("fs").writeFileSync(o(n,`${r.toLowerCase()}.desktop`),p);let m=Buffer.from([137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,1,0,0,0,1,8,2,0,0,0,144,119,83,222,0,0,0,12,73,68,65,84,8,215,99,248,255,255,63,0,5,254,2,254,220,204,89,231,0,0,0,0,73,69,78,68,174,66,96,130]);if(u("fs").writeFileSync(o(n,`${r.toLowerCase()}.png`),m),i.icon&&z(i.icon))k(i.icon,o(n,`${r.toLowerCase()}.png`));let y=E("appimagetool",[n,a],{env:{...process.env,ARCH:"x86_64"}});y.on("close",(g)=>{if(K(t),g===0)T(a,493),s({success:!0});else s({success:!1,error:`appimagetool exited with code ${g}. Install from https://appimage.github.io/appimagetool/`})}),y.on("error",(g)=>{K(t),s({success:!1,error:`appimagetool not found: ${g.message}`})})}catch(n){K(t),s({success:!1,error:n.message})}})}function Go(){return[P()]}function Ko(e){switch(e){case"macos":return["app","dmg","pkg"];case"windows":return["app","zip","msi"];case"linux":return["app","deb","rpm","appimage"];case"ios":return["ipa"];case"android":return["apk"];default:return["app"]}}var he={buildNative:qo,getAvailableTargets:Go,getAvailableFormats:Ko,detectPlatform:P},Wd=he;
3022
- export{Bd,Ho,Fd,zd,Vo,os,Uo,Hd,Wo,Vd,Ud,qo,Go,Ko,Wd};
3021
+ `;d("fs").writeFileSync(o(n,`${r.toLowerCase()}.desktop`),u);let m=Buffer.from([137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,1,0,0,0,1,8,2,0,0,0,144,119,83,222,0,0,0,12,73,68,65,84,8,215,99,248,255,255,63,0,5,254,2,254,220,204,89,231,0,0,0,0,73,69,78,68,174,66,96,130]);if(d("fs").writeFileSync(o(n,`${r.toLowerCase()}.png`),m),i.icon&&z(i.icon))k(i.icon,o(n,`${r.toLowerCase()}.png`));let y=E("appimagetool",[n,a],{env:{...process.env,ARCH:"x86_64"}});y.on("close",(g)=>{if(K(t),g===0)T(a,493),s({success:!0});else s({success:!1,error:`appimagetool exited with code ${g}. Install from https://appimage.github.io/appimagetool/`})}),y.on("error",(g)=>{K(t),s({success:!1,error:`appimagetool not found: ${g.message}`})})}catch(n){K(t),s({success:!1,error:n.message})}})}function Go(){return[P()]}function Ko(e){switch(e){case"macos":return["app","dmg","pkg"];case"windows":return["app","zip","msi"];case"linux":return["app","deb","rpm","appimage"];case"ios":return["ipa"];case"android":return["apk"];default:return["app"]}}var he={buildNative:qo,getAvailableTargets:Go,getAvailableFormats:Ko,detectPlatform:P},Wu=he;
3022
+ export{Bu,Ho,Fu,zu,Vo,os,Uo,Hu,Wo,Vu,Uu,qo,Go,Ko,Wu};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{sr,wc,Ju,xc,Yu,Sc,or,b,Nt,Ce,kc,vs,Cc,Zu,Y,_c,Qu,x,ed}from"./chunk-xeqysa9z.js";import"./chunk-q4t49t6z.js";import"./chunk-99rfdydy.js";import"./chunk-0zx1400y.js";import"./chunk-kt9ksp8w.js";import"./chunk-nmh4pn44.js";import"./chunk-t8akfx99.js";import"./chunk-s9jgsp0a.js";import"./chunk-k1hpxgzq.js";import"./chunk-66e4ga0z.js";import"./chunk-2bcp699b.js";import"./chunk-5hqkfqne.js";import"./chunk-mm8jdb4p.js";export{_c as applyFilters,Yu as clearCustomFilters,kc as clientLoopScopes,sr as defaultFilters,b as escapeHtml,Nt as escapeHtmlValue,x as evaluateExpression,Sc as findMustacheEnd,xc as getAllFilters,Cc as interpolateScriptAttributes,vs as interpolateScriptExpressions,Zu as interpolateScriptsInTemplate,Y as processExpressions,wc as registerFilter,Ju as registerFilters,or as replaceInterpolations,Qu as resetRejectedExpressionWarnings,ed as unescapeHtml,Ce as usesSignalsInScript};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{J,ms,hs,vc,Ot,ci,ys,li,Xd,Se,bn,ke}from"./chunk-5fa9g7x1.js";import"./chunk-q4t49t6z.js";import"./chunk-99rfdydy.js";import{Fi,s}from"./chunk-6rd762vj.js";import"./chunk-0zx1400y.js";import"./chunk-adn5r0r4.js";import"./chunk-nmh4pn44.js";import"./chunk-8dq3r6xw.js";import"./chunk-c9jav70j.js";import"./chunk-k1hpxgzq.js";import"./chunk-66e4ga0z.js";import"./chunk-2bcp699b.js";import"./chunk-1c0zvjt3.js";import"./chunk-mm8jdb4p.js";export{J as BROWSER_CORE_IMPORTS,vc as STX_AUTO_IMPORTS,ms as extractAndStripCssImports,Se as extractBridgeData,Fi as findInterpolationEnd,li as generateAutoImportDestructuring,Xd as generateBrowserAutoImportDestructuring,bn as generateServerDataBridge,Ot as injectBrowserCoreAutoImports,ke as processClientScript,ys as referencesName,hs as renderVendorStyleTags,s as stripCommentsAndLiterals,ci as transformAutoImports};
2
+ import{J,ms,hs,vc,Ot,ci,ys,li,Xu,Se,bn,ke}from"./chunk-xeqysa9z.js";import"./chunk-q4t49t6z.js";import"./chunk-99rfdydy.js";import{Fi,s}from"./chunk-6rd762vj.js";import"./chunk-0zx1400y.js";import"./chunk-kt9ksp8w.js";import"./chunk-nmh4pn44.js";import"./chunk-t8akfx99.js";import"./chunk-s9jgsp0a.js";import"./chunk-k1hpxgzq.js";import"./chunk-66e4ga0z.js";import"./chunk-2bcp699b.js";import"./chunk-5hqkfqne.js";import"./chunk-mm8jdb4p.js";export{J as BROWSER_CORE_IMPORTS,vc as STX_AUTO_IMPORTS,ms as extractAndStripCssImports,Se as extractBridgeData,Fi as findInterpolationEnd,li as generateAutoImportDestructuring,Xu as generateBrowserAutoImportDestructuring,bn as generateServerDataBridge,Ot as injectBrowserCoreAutoImports,ke as processClientScript,ys as referencesName,hs as renderVendorStyleTags,s as stripCommentsAndLiterals,ci as transformAutoImports};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Bt,jc,Bc,Fc,zc,Hc,u,Vc,Ps,Uc,$i,Ri}from"./chunk-xeqysa9z.js";import"./chunk-q4t49t6z.js";import"./chunk-99rfdydy.js";import"./chunk-0zx1400y.js";import"./chunk-kt9ksp8w.js";import"./chunk-nmh4pn44.js";import"./chunk-t8akfx99.js";import"./chunk-s9jgsp0a.js";import"./chunk-k1hpxgzq.js";import"./chunk-66e4ga0z.js";import"./chunk-2bcp699b.js";import"./chunk-5hqkfqne.js";import"./chunk-mm8jdb4p.js";export{Bt as STX_ENGINE_BINDING_NAMES,Ps as convertToCommonJS,$i as extractScriptFromTemplate,u as extractVariables,Ri as hasVariables,Vc as isCompleteImport,Hc as isMissingBindingFailure,Fc as isModuleResolutionFailure,zc as isSyntaxFailure,Uc as splitDeclaration,jc as stripTypeScript,Bc as withoutStxReferrer};
@@ -1,6 +1,6 @@
1
1
  // @bun
2
- import{Q}from"./chunk-1c0zvjt3.js";import{ye,C}from"./chunk-nmh4pn44.js";import{zi}from"./chunk-0zx1400y.js";import{a}from"./chunk-6ta850w8.js";import v from"fs";import m from"path";import{pathToFileURL as I}from"url";var P=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],R=new Set;function Pt(s,l={}){let o=m.resolve(s,l.dir??"server/api"),i=[],f=new Map;if(!v.existsSync(o))return i;let t=Array.from(new Bun.Glob("**/*.{ts,js,mts,mjs}").scanSync({cwd:o})).sort();for(let e of t){if(e.endsWith(".d.ts"))continue;let u=e.replace(/\.(?:ts|js|mts|mjs)$/,"").split("/"),n=u.pop(),c=n.lastIndexOf("."),d=c>=0?n.slice(c+1):"get",g=d.toUpperCase();if(!P.includes(g)||d!==d.toLowerCase())throw Error(`Unsupported API method suffix in ${e}; use ${P.map((A)=>A.toLowerCase()).join(", ")}`);if(c>=0)n=n.slice(0,c);if(n!=="index")u.push(n);let r=new Set,h=u.map((A,j)=>{let y=/^\[(\.\.\.)?([A-Za-z_]\w*)\]$/.exec(A);if(y){if(r.has(y[2])||y[1]&&j!==u.length-1)throw Error(`Invalid API parameter in ${e}`);return r.add(y[2]),`:${y[2]}${y[1]?"*":""}`}if(!/^[\w-]+$/.test(A))throw Error(`Unsupported API path segment ${A} in ${e}`);return A}),w=`/api${h.length?`/${h.join("/")}`:""}`,S=`${g} ${w.replace(/:\w+/g,":param")}`;if(f.has(S))throw Error(`Ambiguous API route ${g} ${w}: ${f.get(S)} and ${e}`);f.set(S,e);let x=m.join(o,e);R.add(m.resolve(x)),R.add(v.realpathSync(x)),i.push({pattern:w,method:g,filePath:x})}return i.sort((e,p)=>{let u=e.pattern.split("/"),n=p.pattern.split("/"),c=(d)=>d?.endsWith("*")?0:d?.startsWith(":")?1:2;for(let d=0;d<Math.max(u.length,n.length);d++){let g=c(n[d])-c(u[d]);if(g)return g}return e.pattern.localeCompare(p.pattern)||e.method.localeCompare(p.method)})}async function ds(s,l){let o=a(s,"api-types.d.ts"),i=["// Generated by stx. Include this file in tsconfig.json.","declare module '@stacksjs/stx/api-client' {"," interface KnownApiRoutes {"];for(let t of l){let e=`./${m.relative(m.dirname(o),t.filePath).replace(/\\/g,"/")}`,{params:p}=Q(t.pattern);i.push(` ${JSON.stringify(`${t.method} ${t.pattern}`)}: { params: { ${p.map((u)=>`${JSON.stringify(u)}: string`).join("; ")} }; response: Awaited<ReturnType<typeof import(${JSON.stringify(e)}).default>> }`)}i.push(" }","}","export {}","");let f=i.join(`
3
- `);if(!await Bun.file(o).exists()||await Bun.file(o).text()!==f)await Bun.write(o,f);return o}async function us(s,l,o={}){let i=Pt(s,o);await ds(s,i);let f=[];for(let t of i){let e=await Bun.build({entrypoints:[t.filePath],target:"bun",format:"esm",minify:!1,splitting:!1});if(!e.success)throw Error(`API build failed for ${t.filePath}: ${e.logs.join(`
4
- `)}`);let p=e.outputs.find((c)=>c.kind==="entry-point");if(!p)throw Error(`No API bundle for ${t.filePath}`);if(e.outputs.length!==1)throw Error(`API endpoint ${t.filePath} emits assets; package those explicitly instead`);let n=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await p.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write(m.join(l,n),p),f.push({...t,filePath:n})}return f}function E(s,l){let o=s.map((i)=>({route:i,...Q(i.pattern)}));return async(i)=>{let f=new URL(i.url).pathname,t=o.filter((r)=>r.regex.test(f));if(!t.length)return null;let e=t[0].route.pattern,p=(r)=>r.replace(/:\w+/g,":param"),u=t.filter((r)=>p(r.route.pattern)===p(e)),n=i.method,c=u.find((r)=>r.route.method===n)??(n==="HEAD"?u.find((r)=>r.route.method==="GET"):void 0);if(!c){let r=new Set(u.map((h)=>h.route.method));if(r.has("GET"))r.add("HEAD");return r.add("OPTIONS"),new Response(null,{status:n==="OPTIONS"?204:405,headers:{Allow:Array.from(r).sort().join(", ")}})}let d=c.regex.exec(f),g=Object.create(null);try{c.params.forEach((r,h)=>{g[r]=decodeURIComponent(d[h+1])})}catch{return new Response("Invalid URL parameter encoding",{status:400})}try{let r=await l(c.route);if(typeof r!=="function")throw Error(`API endpoint ${c.route.filePath} must default-export a handler`);let h=await r(i,{params:g}),w=h instanceof Response?h:h===void 0?new Response(null,{status:204}):Response.json(h);if(n==="HEAD")return new Response(null,{status:w.status,headers:w.headers});return w}catch(r){return console.error(`[stx] API error for ${n} ${e}:`,r),Response.json({error:"Internal Server Error"},{status:500})}}}function ps(s,l){return E(l,async(o)=>(await import(I(m.resolve(s,o.filePath)).href)).default)}async function Kd(s,l){if(!l)return async()=>null;let o=l===!0?{}:l,i=Pt(s,o);return await ds(s,i),async(f)=>{if(!new URL(f.url).pathname.match(/^\/api(?:\/|$)/))return null;try{let t=Pt(s,o);await ds(s,t);let{loadStxConfig:e}=await import("./chunk-mtm39290.js"),p=C((await e(s)).runtimeConfig);return await ye(p,()=>E(t,async(u)=>{let n=await Bun.build({entrypoints:[u.filePath],target:"bun",format:"esm",splitting:!1});if(!n.success)throw Error(n.logs.join(`
2
+ import{Q}from"./chunk-5hqkfqne.js";import{ye,C}from"./chunk-nmh4pn44.js";import{zi}from"./chunk-0zx1400y.js";import{a}from"./chunk-6ta850w8.js";import v from"fs";import m from"path";import{pathToFileURL as I}from"url";var P=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],R=new Set;function Pt(s,l={}){let o=m.resolve(s,l.dir??"server/api"),i=[],f=new Map;if(!v.existsSync(o))return i;let t=Array.from(new Bun.Glob("**/*.{ts,js,mts,mjs}").scanSync({cwd:o})).sort();for(let e of t){if(e.endsWith(".d.ts"))continue;let u=e.replace(/\.(?:ts|js|mts|mjs)$/,"").split("/"),n=u.pop(),c=n.lastIndexOf("."),d=c>=0?n.slice(c+1):"get",g=d.toUpperCase();if(!P.includes(g)||d!==d.toLowerCase())throw Error(`Unsupported API method suffix in ${e}; use ${P.map((A)=>A.toLowerCase()).join(", ")}`);if(c>=0)n=n.slice(0,c);if(n!=="index")u.push(n);let r=new Set,h=u.map((A,j)=>{let y=/^\[(\.\.\.)?([A-Za-z_]\w*)\]$/.exec(A);if(y){if(r.has(y[2])||y[1]&&j!==u.length-1)throw Error(`Invalid API parameter in ${e}`);return r.add(y[2]),`:${y[2]}${y[1]?"*":""}`}if(!/^[\w-]+$/.test(A))throw Error(`Unsupported API path segment ${A} in ${e}`);return A}),w=`/api${h.length?`/${h.join("/")}`:""}`,S=`${g} ${w.replace(/:\w+/g,":param")}`;if(f.has(S))throw Error(`Ambiguous API route ${g} ${w}: ${f.get(S)} and ${e}`);f.set(S,e);let x=m.join(o,e);R.add(m.resolve(x)),R.add(v.realpathSync(x)),i.push({pattern:w,method:g,filePath:x})}return i.sort((e,p)=>{let u=e.pattern.split("/"),n=p.pattern.split("/"),c=(d)=>d?.endsWith("*")?0:d?.startsWith(":")?1:2;for(let d=0;d<Math.max(u.length,n.length);d++){let g=c(n[d])-c(u[d]);if(g)return g}return e.pattern.localeCompare(p.pattern)||e.method.localeCompare(p.method)})}async function us(s,l){let o=a(s,"api-types.d.ts"),i=["// Generated by stx. Include this file in tsconfig.json.","declare module '@stacksjs/stx/api-client' {"," interface KnownApiRoutes {"];for(let t of l){let e=`./${m.relative(m.dirname(o),t.filePath).replace(/\\/g,"/")}`,{params:p}=Q(t.pattern);i.push(` ${JSON.stringify(`${t.method} ${t.pattern}`)}: { params: { ${p.map((u)=>`${JSON.stringify(u)}: string`).join("; ")} }; response: Awaited<ReturnType<typeof import(${JSON.stringify(e)}).default>> }`)}i.push(" }","}","export {}","");let f=i.join(`
3
+ `);if(!await Bun.file(o).exists()||await Bun.file(o).text()!==f)await Bun.write(o,f);return o}async function ds(s,l,o={}){let i=Pt(s,o);await us(s,i);let f=[];for(let t of i){let e=await Bun.build({entrypoints:[t.filePath],target:"bun",format:"esm",minify:!1,splitting:!1});if(!e.success)throw Error(`API build failed for ${t.filePath}: ${e.logs.join(`
4
+ `)}`);let p=e.outputs.find((c)=>c.kind==="entry-point");if(!p)throw Error(`No API bundle for ${t.filePath}`);if(e.outputs.length!==1)throw Error(`API endpoint ${t.filePath} emits assets; package those explicitly instead`);let n=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await p.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write(m.join(l,n),p),f.push({...t,filePath:n})}return f}function E(s,l){let o=s.map((i)=>({route:i,...Q(i.pattern)}));return async(i)=>{let f=new URL(i.url).pathname,t=o.filter((r)=>r.regex.test(f));if(!t.length)return null;let e=t[0].route.pattern,p=(r)=>r.replace(/:\w+/g,":param"),u=t.filter((r)=>p(r.route.pattern)===p(e)),n=i.method,c=u.find((r)=>r.route.method===n)??(n==="HEAD"?u.find((r)=>r.route.method==="GET"):void 0);if(!c){let r=new Set(u.map((h)=>h.route.method));if(r.has("GET"))r.add("HEAD");return r.add("OPTIONS"),new Response(null,{status:n==="OPTIONS"?204:405,headers:{Allow:Array.from(r).sort().join(", ")}})}let d=c.regex.exec(f),g=Object.create(null);try{c.params.forEach((r,h)=>{g[r]=decodeURIComponent(d[h+1])})}catch{return new Response("Invalid URL parameter encoding",{status:400})}try{let r=await l(c.route);if(typeof r!=="function")throw Error(`API endpoint ${c.route.filePath} must default-export a handler`);let h=await r(i,{params:g}),w=h instanceof Response?h:h===void 0?new Response(null,{status:204}):Response.json(h);if(n==="HEAD")return new Response(null,{status:w.status,headers:w.headers});return w}catch(r){return console.error(`[stx] API error for ${n} ${e}:`,r),Response.json({error:"Internal Server Error"},{status:500})}}}function ps(s,l){return E(l,async(o)=>(await import(I(m.resolve(s,o.filePath)).href)).default)}async function Ku(s,l){if(!l)return async()=>null;let o=l===!0?{}:l,i=Pt(s,o);return await us(s,i),async(f)=>{if(!new URL(f.url).pathname.match(/^\/api(?:\/|$)/))return null;try{let t=Pt(s,o);await us(s,t);let{loadStxConfig:e}=await import("./chunk-yytfje8a.js"),p=C((await e(s)).runtimeConfig);return await ye(p,()=>E(t,async(u)=>{let n=await Bun.build({entrypoints:[u.filePath],target:"bun",format:"esm",splitting:!1});if(!n.success)throw Error(n.logs.join(`
5
5
  `));let c=n.outputs.find((d)=>d.kind==="entry-point");if(!c||n.outputs.length!==1)throw Error(`Unsupported API bundle output: ${u.filePath}`);return(await import(`data:text/javascript;base64,${Buffer.from(await c.text()).toString("base64")}`)).default})(f))}catch(t){return console.error("[stx] API discovery failed:",t),Response.json({error:"API discovery failed; check the server log"},{status:500})}}}function gs(s,l,o){if(zi(s))return!0;let i=/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/;if(i.test(m.basename(s)))return!0;try{if(i.test(m.basename(v.realpathSync(s))))return!0}catch{}if(R.has(m.resolve(s)))return!0;if(!o)return!1;let f=m.resolve(l,typeof o==="object"?o.dir??"server/api":"server/api"),t=(p)=>{try{return v.realpathSync(p)}catch{return m.resolve(p)}},e=t(s);return[f,m.resolve(l,"server"),m.resolve(l,".output/server")].some((p)=>{let u=t(p);return e===u||e.startsWith(`${u}${m.sep}`)})}
6
- export{Pt,ds,us,ps,Kd,gs};
6
+ export{Pt,us,ds,ps,Ku,gs};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- var g=0;function p(){return`async-${++g}-${Date.now().toString(36)}`}function hd(e,t={},c){let o=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,i=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,n=e;return n=n.replace(o,(r,s,a,d)=>{let l=p(),y=u(s);return m(l,y,a.trim(),d.trim())}),n=n.replace(i,(r,s,a)=>{let d=p(),l=u(s);return m(d,l,a.trim(),'<div class="stx-async-error">Failed to load component</div>')}),n}function u(e){let t={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},c=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,o;while((o=c.exec(e))!==null){let i=o[1],n=o[2]||o[3],r=o[4],s=o[5];switch(i){case"component":t.component=n||s||"";break;case"timeout":t.timeout=r?parseInt(r,10):30000;break;case"delay":t.delay=r?parseInt(r,10):200;break;case"suspensible":t.suspensible=s==="true";break;case"retries":t.retries=r?parseInt(r,10):0;break;case"loadingComponent":t.loadingComponent=n||s;break;case"errorComponent":t.errorComponent=n||s;break}}return t}function m(e,t,c,o){let{component:i,timeout:n,delay:r,suspensible:s,retries:a}=t;return`
2
+ var g=0;function p(){return`async-${++g}-${Date.now().toString(36)}`}function hu(e,t={},c){let o=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,i=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,n=e;return n=n.replace(o,(r,s,a,d)=>{let l=p(),y=u(s);return m(l,y,a.trim(),d.trim())}),n=n.replace(i,(r,s,a)=>{let d=p(),l=u(s);return m(d,l,a.trim(),'<div class="stx-async-error">Failed to load component</div>')}),n}function u(e){let t={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},c=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,o;while((o=c.exec(e))!==null){let i=o[1],n=o[2]||o[3],r=o[4],s=o[5];switch(i){case"component":t.component=n||s||"";break;case"timeout":t.timeout=r?parseInt(r,10):30000;break;case"delay":t.delay=r?parseInt(r,10):200;break;case"suspensible":t.suspensible=s==="true";break;case"retries":t.retries=r?parseInt(r,10):0;break;case"loadingComponent":t.loadingComponent=n||s;break;case"errorComponent":t.errorComponent=n||s;break}}return t}function m(e,t,c,o){let{component:i,timeout:n,delay:r,suspensible:s,retries:a}=t;return`
3
3
  <div class="stx-async-component" data-async-id="${e}" data-component="${i}" data-status="pending">
4
4
  <div class="stx-async-loading" data-async-loading="${e}">
5
5
  ${c}
@@ -226,7 +226,7 @@ catch (error) {
226
226
  loadComponent();
227
227
  })();
228
228
  </script>
229
- `}function yd(e){return{__asyncComponent:!0,...typeof e==="function"?{loader:e}:e}}function bd(e){return typeof e==="object"&&e!==null&&"__asyncComponent"in e&&e.__asyncComponent===!0}function vd(){return`
229
+ `}function yu(e){return{__asyncComponent:!0,...typeof e==="function"?{loader:e}:e}}function bu(e){return typeof e==="object"&&e!==null&&"__asyncComponent"in e&&e.__asyncComponent===!0}function vu(){return`
230
230
  /* STX Async Component Styles */
231
231
  .stx-async-component {
232
232
  position: relative;
@@ -300,7 +300,7 @@ catch (error) {
300
300
  background-size: 200% 100%;
301
301
  }
302
302
  }
303
- `}function wd(){return`
303
+ `}function wu(){return`
304
304
  // STX Async Component Runtime
305
305
  (function() {
306
306
  if (typeof window === 'undefined') return;
@@ -355,4 +355,4 @@ catch (error) {
355
355
  console.log('[stx] Async component runtime initialized');
356
356
  })();
357
357
  `}
358
- export{hd,yd,bd,vd,wd};
358
+ export{hu,yu,bu,vu,wu};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{nr,Ue,oi,pc}from"./chunk-970j89r5.js";export{nr as generateServiceWorker,pc as generateServiceWorkerAuto,Ue as getServiceWorkerFileName,oi as isWorkboxEnabled};
2
+ import{nr,Ue,oi,pc}from"./chunk-pw0b0an6.js";export{nr as generateServiceWorker,pc as generateServiceWorkerAuto,Ue as getServiceWorkerFileName,oi as isWorkboxEnabled};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Pt,us,ds,ps,Ku,gs}from"./chunk-trhr4gzz.js";import"./chunk-0zx1400y.js";import"./chunk-nmh4pn44.js";import"./chunk-5hqkfqne.js";export{ds as buildServerApi,Ku as createServerApi,Pt as discoverServerApi,us as generateApiTypes,gs as isServerApiSource,ps as productionApiDispatcher};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{md,qc,Te,Pi,hd,Os,Ds,Ns}from"./chunk-xeqysa9z.js";import"./chunk-q4t49t6z.js";import"./chunk-99rfdydy.js";import"./chunk-0zx1400y.js";import"./chunk-kt9ksp8w.js";import"./chunk-nmh4pn44.js";import"./chunk-t8akfx99.js";import"./chunk-s9jgsp0a.js";import"./chunk-k1hpxgzq.js";import"./chunk-66e4ga0z.js";import"./chunk-2bcp699b.js";import"./chunk-5hqkfqne.js";import"./chunk-mm8jdb4p.js";export{hd as clearOnceStore,Pi as onceStore,Te as partialsCache,Os as processIncludes,Ds as processStackPushDirectives,Ns as processStackReplacements,md as resetUnscopedSignalWarnings,qc as topLevelElements};