@stacksjs/stx 0.2.510 → 0.2.512

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 (128) hide show
  1. package/dist/{chunk-twqmyetp.js → chunk-02m9mhkd.js} +1 -1
  2. package/dist/chunk-0gzf18jm.js +2 -0
  3. package/dist/{chunk-xd4zvm4x.js → chunk-1aw9qbdf.js} +3 -0
  4. package/dist/{chunk-xmw9e9zn.js → chunk-1eq6nj35.js} +3 -3
  5. package/dist/{chunk-2dkyyewm.js → chunk-1j7na0de.js} +2 -2
  6. package/dist/chunk-1mkyksne.js +2 -0
  7. package/dist/chunk-26b39qx2.js +2 -0
  8. package/dist/chunk-2fabc38n.js +2 -0
  9. package/dist/chunk-3kxh9rsp.js +2 -0
  10. package/dist/chunk-3vqabd10.js +2 -0
  11. package/dist/{chunk-rvwtyrj4.js → chunk-3y8ykqpx.js} +1 -1
  12. package/dist/chunk-490f2x2r.js +2 -0
  13. package/dist/{chunk-qv57r0fa.js → chunk-4c1afy15.js} +1 -1
  14. package/dist/{chunk-2j1q5te2.js → chunk-4vc67zkb.js} +2 -2
  15. package/dist/chunk-55z4hn0d.js +2 -0
  16. package/dist/chunk-5c1qesrs.js +2 -0
  17. package/dist/{chunk-7wnw3h4p.js → chunk-68sc0w22.js} +1 -1
  18. package/dist/{chunk-zz5b1g50.js → chunk-6k4f583z.js} +2 -2
  19. package/dist/chunk-76tar7ak.js +2 -0
  20. package/dist/chunk-7ceqp9yv.js +2 -0
  21. package/dist/{chunk-5q9rmcp7.js → chunk-802qf0vz.js} +1 -1
  22. package/dist/{chunk-ej46bkaw.js → chunk-8fb1mqw1.js} +1 -1
  23. package/dist/chunk-8pknhtv7.js +2 -0
  24. package/dist/{chunk-9p3rtfbv.js → chunk-8wrxmtce.js} +8 -8
  25. package/dist/{chunk-km9g9drp.js → chunk-9c86wgnk.js} +1 -1
  26. package/dist/{chunk-68tzytfz.js → chunk-a3zn6rc9.js} +3 -3
  27. package/dist/{chunk-a6djsvag.js → chunk-aadtwt3f.js} +3 -3
  28. package/dist/chunk-b0bgprzs.js +2 -0
  29. package/dist/{chunk-gw9ax7xx.js → chunk-b7fx8rsm.js} +1 -1
  30. package/dist/chunk-bf60qqjt.js +2 -0
  31. package/dist/chunk-c331r7za.js +2 -0
  32. package/dist/chunk-ctz541w3.js +2 -0
  33. package/dist/{chunk-1149d93e.js → chunk-czmw5xsd.js} +2 -2
  34. package/dist/{chunk-npth2waq.js → chunk-dc46t9tn.js} +1 -1
  35. package/dist/{chunk-s7rbe4c6.js → chunk-e32b0446.js} +1 -1
  36. package/dist/{chunk-g7g6rc6e.js → chunk-e8hj8v9s.js} +1 -1
  37. package/dist/chunk-ecdffs66.js +2 -0
  38. package/dist/{chunk-pj562qnx.js → chunk-epy4ycvv.js} +1 -1
  39. package/dist/{chunk-46wre9ep.js → chunk-fesb4h31.js} +3 -3
  40. package/dist/chunk-ftyen64y.js +30 -0
  41. package/dist/{chunk-qa53jmk3.js → chunk-gq8xkhxx.js} +1 -1
  42. package/dist/{chunk-1verz406.js → chunk-gte0wmh8.js} +5 -5
  43. package/dist/{chunk-pan2t7h3.js → chunk-gvqmcf6z.js} +1 -1
  44. package/dist/chunk-he7ykm3x.js +2 -0
  45. package/dist/chunk-hkc9hezx.js +3 -0
  46. package/dist/{chunk-vtxzaj1h.js → chunk-hktvv0hd.js} +2 -2
  47. package/dist/{chunk-z2775k8r.js → chunk-hmyyq2hh.js} +1 -1
  48. package/dist/{chunk-t77pz252.js → chunk-hqvdm4h9.js} +1 -1
  49. package/dist/{chunk-5tvxv2v1.js → chunk-j9dq3q4z.js} +1 -1
  50. package/dist/{chunk-vftdacyb.js → chunk-jbvg29t0.js} +1 -1
  51. package/dist/{chunk-g495xx4v.js → chunk-jtaqygzg.js} +1 -1
  52. package/dist/{chunk-ph4fszwq.js → chunk-k2fxyvn8.js} +1 -1
  53. package/dist/{chunk-5vzts63r.js → chunk-k3p8vgct.js} +1 -1
  54. package/dist/chunk-m8n4gyb7.js +2 -0
  55. package/dist/{chunk-ke05jx3n.js → chunk-mrbfx4t7.js} +1 -1
  56. package/dist/chunk-p2ckxfs8.js +2 -0
  57. package/dist/{chunk-91y360rc.js → chunk-p4gbvge6.js} +1 -1
  58. package/dist/{chunk-7pr8gvpc.js → chunk-q6k3w27m.js} +1 -1
  59. package/dist/chunk-qky9zfvx.js +2 -0
  60. package/dist/chunk-qnewez0a.js +2 -0
  61. package/dist/{chunk-hka18tmt.js → chunk-qnmtzvm1.js} +1 -1
  62. package/dist/chunk-r96zmdxa.js +2 -0
  63. package/dist/chunk-r9cqq4bk.js +2 -0
  64. package/dist/chunk-rfd1pwk7.js +2 -0
  65. package/dist/chunk-rk153jft.js +2 -0
  66. package/dist/{chunk-w9kj6t7s.js → chunk-rnnead1w.js} +1 -1
  67. package/dist/{chunk-4mmd282p.js → chunk-s2e33mdf.js} +1 -1
  68. package/dist/{chunk-1r3fmmy8.js → chunk-sq9zp9c3.js} +1 -1
  69. package/dist/{chunk-x2ghjgxm.js → chunk-ss0b1sss.js} +1 -1
  70. package/dist/{chunk-j7bncsd9.js → chunk-t6ttge9g.js} +1 -1
  71. package/dist/{chunk-tv2xr7s3.js → chunk-tbh9k246.js} +1 -1
  72. package/dist/{chunk-s9fskxy7.js → chunk-thm0rq9y.js} +5 -5
  73. package/dist/chunk-va6x7pkt.js +2 -0
  74. package/dist/{chunk-5z69phk9.js → chunk-vfjjp7cf.js} +1727 -1727
  75. package/dist/{chunk-g7wgpys2.js → chunk-vp827ah7.js} +4 -4
  76. package/dist/{chunk-mwz1mq51.js → chunk-vyhtz9k2.js} +4 -4
  77. package/dist/{chunk-k14e9k4h.js → chunk-wjcfwfms.js} +1 -1
  78. package/dist/chunk-wpcam5kp.js +2 -0
  79. package/dist/{chunk-5tbqdz94.js → chunk-wxgs36py.js} +2 -2
  80. package/dist/chunk-wy36z6qp.js +2 -0
  81. package/dist/{chunk-xemsypk7.js → chunk-x8mp9yvn.js} +4 -4
  82. package/dist/{chunk-tnxprz69.js → chunk-xevnx24r.js} +2 -2
  83. package/dist/{chunk-e07ptggk.js → chunk-yd62qhpz.js} +2219 -2219
  84. package/dist/{chunk-068ank60.js → chunk-ygetbydb.js} +3 -3
  85. package/dist/{chunk-g1r4v0mc.js → chunk-yxdyh23k.js} +2 -2
  86. package/dist/{chunk-5zm23zrb.js → chunk-yy6cqwnj.js} +44 -8
  87. package/dist/{chunk-h6z4s5p3.js → chunk-z6nm6rf1.js} +1 -1
  88. package/dist/{chunk-5tkzfw4s.js → chunk-zv0vgamy.js} +3 -3
  89. package/dist/cli.js +10 -10
  90. package/dist/craft-entry.js +2 -2
  91. package/dist/craft.js +2 -2
  92. package/dist/database.js +2 -2
  93. package/dist/native/runtime/craft-bridge.js +17 -0
  94. package/dist/pwa.js +2 -2
  95. package/dist/signals.js +38 -2
  96. package/dist/ssg.js +2 -2
  97. package/package.json +5 -5
  98. package/dist/chunk-11j2dj0r.js +0 -2
  99. package/dist/chunk-144xhefw.js +0 -2
  100. package/dist/chunk-18y7kk8n.js +0 -2
  101. package/dist/chunk-2a8dw04j.js +0 -2
  102. package/dist/chunk-2djfn17e.js +0 -2
  103. package/dist/chunk-2h4bf7m4.js +0 -2
  104. package/dist/chunk-33meqm5e.js +0 -2
  105. package/dist/chunk-3pczp9c0.js +0 -2
  106. package/dist/chunk-6ygvfpc5.js +0 -2
  107. package/dist/chunk-7bwkc5yf.js +0 -2
  108. package/dist/chunk-8nv7xakv.js +0 -30
  109. package/dist/chunk-8ptefdpy.js +0 -2
  110. package/dist/chunk-8sjctqyw.js +0 -2
  111. package/dist/chunk-abxnep18.js +0 -2
  112. package/dist/chunk-aw8ehxde.js +0 -2
  113. package/dist/chunk-azv7g8rr.js +0 -2
  114. package/dist/chunk-c2vwq6gr.js +0 -2
  115. package/dist/chunk-c82gckm3.js +0 -2
  116. package/dist/chunk-dn4tww9q.js +0 -2
  117. package/dist/chunk-etbszapb.js +0 -2
  118. package/dist/chunk-j7nd8zfe.js +0 -2
  119. package/dist/chunk-jtwx2xte.js +0 -2
  120. package/dist/chunk-m6xpg33p.js +0 -3
  121. package/dist/chunk-pzcw3trh.js +0 -2
  122. package/dist/chunk-q5jc8hmg.js +0 -2
  123. package/dist/chunk-rfqsgs51.js +0 -2
  124. package/dist/chunk-t7djn7zd.js +0 -2
  125. package/dist/chunk-vgkjmrf3.js +0 -2
  126. package/dist/chunk-w5w055g6.js +0 -2
  127. package/dist/chunk-x5gbrjm5.js +0 -2
  128. package/dist/chunk-zddtnyp7.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{O}from"./chunk-vtxzaj1h.js";var t={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603};function N(e){for(let[r,n]of Object.entries(t))if(n===e)return r;return}import ee from"path";var re={showRelativePaths:!1,enableAutoRecovery:O(),logRecoveryWarnings:!0},L={...re};function R(){return{...L}}function k(e){if(!L.showRelativePaths||!e)return e;let r=L.baseDir||process.cwd();try{let n=ee.relative(r,e);return n.startsWith("..")?e:n}catch{return e}}class v extends Error{code;filePath;line;column;context;numericCode;constructor(e,r,n,o,s,a,g){super(e);this.code=r;this.filePath=n;this.line=o;this.column=s;this.context=a;if(this.name="StxError",this.numericCode=g||t.EVALUATION_ERROR,this.filePath)this.filePath=k(this.filePath)}}class X extends v{constructor(e,r,n,o,s,a){super(e,"stx_RUNTIME_ERROR",r,n,o,s,a||t.EVALUATION_ERROR);this.name="StxRuntimeError"}}class yn extends v{constructor(e,r,n,o,s,a){super(e,"stx_FILE_ERROR",r,n,o,s,a||t.FILE_NOT_FOUND);this.name="StxFileError"}}class ir extends v{isFatal=!0;constructor(e,r,n,o,s,a){super(e,"stx_VALIDATION_ERROR",r,n,o,s,a||t.DOM_API_VIOLATION);this.name="StxValidationError"}}function U(e){let{type:r,message:n,code:o,filePath:s,line:a,column:g,template:u,offset:d,snippet:f,suggestion:m,format:h="text"}=e,E=a,x=g;if(!E&&u&&d!==void 0){let z=ce(u,d);E=z.line,x=z.column}let y=s?k(s):void 0,K=o?N(o):void 0,w={type:r,code:o,codeName:K,message:n,filePath:y,line:E,column:x,snippet:f,suggestion:m,timestamp:new Date().toISOString()},S;switch(h){case"html":S=oe(w);break;case"json":S=JSON.stringify(w,null,2);break;case"console":S=ie(w,u,d);break;case"text":default:S=ne(w,u,d);break}return{formatted:S,data:w}}function ne(e,r,n){let o=[],s=e.code?` [${e.codeName||e.code}]`:"";if(o.push(`[${e.type} Error${s}]`),e.filePath){let a=e.filePath;if(e.line){if(a+=`:${e.line}`,e.column)a+=`:${e.column}`}o.push(`at ${a}`)}if(o.push(`
2
+ import{O}from"./chunk-hktvv0hd.js";var t={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603};function N(e){for(let[r,n]of Object.entries(t))if(n===e)return r;return}import ee from"path";var re={showRelativePaths:!1,enableAutoRecovery:O(),logRecoveryWarnings:!0},L={...re};function R(){return{...L}}function k(e){if(!L.showRelativePaths||!e)return e;let r=L.baseDir||process.cwd();try{let n=ee.relative(r,e);return n.startsWith("..")?e:n}catch{return e}}class v extends Error{code;filePath;line;column;context;numericCode;constructor(e,r,n,o,s,a,g){super(e);this.code=r;this.filePath=n;this.line=o;this.column=s;this.context=a;if(this.name="StxError",this.numericCode=g||t.EVALUATION_ERROR,this.filePath)this.filePath=k(this.filePath)}}class X extends v{constructor(e,r,n,o,s,a){super(e,"stx_RUNTIME_ERROR",r,n,o,s,a||t.EVALUATION_ERROR);this.name="StxRuntimeError"}}class yn extends v{constructor(e,r,n,o,s,a){super(e,"stx_FILE_ERROR",r,n,o,s,a||t.FILE_NOT_FOUND);this.name="StxFileError"}}class ir extends v{isFatal=!0;constructor(e,r,n,o,s,a){super(e,"stx_VALIDATION_ERROR",r,n,o,s,a||t.DOM_API_VIOLATION);this.name="StxValidationError"}}function U(e){let{type:r,message:n,code:o,filePath:s,line:a,column:g,template:u,offset:d,snippet:f,suggestion:m,format:h="text"}=e,E=a,x=g;if(!E&&u&&d!==void 0){let z=ce(u,d);E=z.line,x=z.column}let y=s?k(s):void 0,K=o?N(o):void 0,w={type:r,code:o,codeName:K,message:n,filePath:y,line:E,column:x,snippet:f,suggestion:m,timestamp:new Date().toISOString()},S;switch(h){case"html":S=oe(w);break;case"json":S=JSON.stringify(w,null,2);break;case"console":S=ie(w,u,d);break;case"text":default:S=ne(w,u,d);break}return{formatted:S,data:w}}function ne(e,r,n){let o=[],s=e.code?` [${e.codeName||e.code}]`:"";if(o.push(`[${e.type} Error${s}]`),e.filePath){let a=e.filePath;if(e.line){if(a+=`:${e.line}`,e.column)a+=`:${e.column}`}o.push(`at ${a}`)}if(o.push(`
3
3
  ${e.message}`),r&&e.line){let a=se(r,e.line,2);if(a)o.push(`
4
4
  ${a}`)}if(e.snippet)o.push(`
5
5
  Snippet: ${e.snippet}`);if(e.suggestion)o.push(`
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{p,l}from"./chunk-g495xx4v.js";import{b}from"./chunk-e07ptggk.js";function y(t,o){let i=1,r=o,e="<template",n="</template";while(r<t.length&&i>0){let s=t.indexOf("<",r);if(s===-1)break;if(r=s,t.startsWith(e,r)&&(r+e.length>=t.length||/[\s>\/]/.test(t[r+e.length]))){i++,r+=e.length;continue}if(t.startsWith(n,r)){let a=t.indexOf(">",r+n.length);if(a!==-1){if(i--,i===0)return a+1;r=a+1;continue}}r++}return i===0?r:-1}var w=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function x(t,o){let i=null;for(let r=o;r<t.length;r++){let e=t[r];if(i){if(e==="\\"){r++;continue}if(e===i)i=null;continue}if(e==='"'||e==="'"){i=e;continue}if(e===">")return r+1}return-1}function N(t,o,i){let r=o.toLowerCase(),e=1,n=i;while(n<t.length){let s=t.indexOf("<",n);if(s===-1)return-1;if(t.startsWith("<!--",s)){let g=t.indexOf("-->",s+4);n=g===-1?t.length:g+3;continue}let a=x(t,s+1);if(a===-1)return-1;let f=t.slice(s,a),u=f.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(u&&u[2].toLowerCase()===r){if(u[1]==="/"){if(e--,e===0)return a}else if(!/\/\s*>$/.test(f))e++}n=a}return-1}function A(t){let o=[],i=[],r=/\bslot\s*=\s*(?:"([^"]+)"|'([^']+)')/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let c=t.indexOf("-->",n+4);e=c===-1?t.length:c+3;continue}let s=x(t,n+1);if(s===-1)break;let a=t.slice(n,s),f=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!f){e=s;continue}let u=f[2].toLowerCase();if(f[1]==="/"){let c=i.lastIndexOf(u);if(c!==-1)i.splice(c);e=s;continue}let g=/\/\s*>$/.test(a),d=i.length===0?a.match(r):null;if(d){let c=d[1]||d[2],m=a.replace(r,"").replace(/\s+(?=\/?>$)/,"").replace(/\s{2,}/g," "),h=g||w.has(u)?-1:N(t,u,s);if(h===-1)o.push({start:n,end:s,slotName:c,element:m}),e=s;else o.push({start:n,end:h,slotName:c,element:m+t.slice(s,h)}),e=h;continue}if(!g&&!w.has(u)){if(i.push(u),u==="script"||u==="style"){let c=t.toLowerCase().indexOf(`</${u}>`,s);if(c!==-1){e=c;continue}}}e=s}return o}function O(t){let o=[],i=[],r=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let c=t.indexOf("-->",n+4);e=c===-1?t.length:c+3;continue}let s=x(t,n+1);if(s===-1)break;let a=t.slice(n,s),f=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!f){e=s;continue}let u=f[1]==="/",g=f[2].toLowerCase();if(u){let c=i.lastIndexOf(g);if(c!==-1)i.splice(c);e=s;continue}if(g==="template"&&i.length===0){let c=a.match(r);if(c){let m=y(t,s);if(m!==-1){let h=c[1]||c[2]||c[3];o.push({start:n,end:m,slotName:h,content:t.slice(s,m-11).trim(),propsBinding:c[4]||void 0}),e=m;continue}}}if(!/\/\s*>$/.test(a)&&!w.has(g)){if(i.push(g),g==="script"||g==="style"){let c=t.toLowerCase().indexOf(`</${g}>`,s);if(c!==-1){e=c;continue}}}e=s}return o}function aa(t){let o={default:"",named:new Map},i=t,r=O(t);for(let n of r)o.named.set(n.slotName,{name:n.slotName,content:n.content,propsBinding:n.propsBinding});r.sort((n,s)=>s.start-n.start);for(let n of r)i=i.slice(0,n.start)+i.slice(n.end);let e=A(i);for(let n of e){let s=o.named.get(n.slotName);if(s)s.content+=n.element;else o.named.set(n.slotName,{name:n.slotName,content:n.element})}for(let n=e.length-1;n>=0;n--){let s=e[n];i=i.slice(0,s.start)+i.slice(s.end)}return o.default=i.trim(),o}function xl(t){let o=t.match(/name\s*=\s*["']([^"']+)["']/),i=o?o[1]:"",r={},e=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,n;while((n=e.exec(t))!==null)r[n[1]]=n[2];let s=t.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),a=s?s[1].trim():"";return{name:i,props:r,defaultContent:a}}async function ca(t,o,i,r){if(!t)return i;let e=t.content;if(t.propsBinding&&Object.keys(o).length>0){let n=t.propsBinding.trim(),s={...r};if(n.startsWith("{")&&n.endsWith("}")){let a=n.slice(1,-1).split(",").map((f)=>f.trim()).filter(Boolean);for(let f of a){let[u,g]=f.split(":").map((c)=>c.trim()),d=g||u;if(o[u]!==void 0)s[d]=o[u]}}else s[n]=o;e=C(e,s)}return e}function C(t,o){return t.replace(/\{\{\s*([^}]+)\s*\}\}/g,(i,r)=>{try{let e=r.trim(),n=k(e,o);return b(String(n??""))}catch{return`{{ ${r} }}`}})}function k(t,o){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(t)){let r=t.split("."),e=o;for(let n of r)if(e&&typeof e==="object"&&n in e)e=e[n];else return;return e}let i=t.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(i){let[,r,e,n]=i,s=o[r],a=parseInt(n,10);if(typeof s==="number")switch(e){case"+":return s+a;case"-":return s-a;case"*":return s*a;case"/":return s/a}}try{if(!p(t))return;return l(t,Object.keys(o))(...Object.values(o))}catch{return}}async function la(t,o,i){let r=t;r=await M(r,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(s,a,f,u)=>{let g=o.named.get(a),d=u?.trim()||"",c=f||"",m={},h=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,S;while((S=h.exec(c))!==null){let E=S[1],R=S[2];m[E]=k(R,i)}return await ca(g,m,d,i)});let n=/<slot\b((?:"[^"]*"|'[^']*'|[^>"'])*?)\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return r=r.replace(n,(s,a,f)=>{if(/\bname\s*=/.test(a||""))return s;let u=f?.trim()||"";return o.default||u}),r}async function M(t,o,i){let r=[],e=[];t.replace(o,(a,...f)=>{let u=f[f.length-2];return e.push({match:a,index:u}),r.push(i(a,...f.slice(0,-2))),a});let n=await Promise.all(r),s=t;for(let a=e.length-1;a>=0;a--){let{match:f,index:u}=e[a];s=s.slice(0,u)+n[a]+s.slice(u+f.length)}return s}function Sl(t){let o=aa(t);return{defaultSlot:o.default,namedSlots:o.named}}async function kl(t,o,i,r){return await la(t,{default:o,named:i},r)}
2
+ import{p,l}from"./chunk-jtaqygzg.js";import{b}from"./chunk-yd62qhpz.js";function y(t,o){let i=1,r=o,e="<template",n="</template";while(r<t.length&&i>0){let s=t.indexOf("<",r);if(s===-1)break;if(r=s,t.startsWith(e,r)&&(r+e.length>=t.length||/[\s>\/]/.test(t[r+e.length]))){i++,r+=e.length;continue}if(t.startsWith(n,r)){let a=t.indexOf(">",r+n.length);if(a!==-1){if(i--,i===0)return a+1;r=a+1;continue}}r++}return i===0?r:-1}var w=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function x(t,o){let i=null;for(let r=o;r<t.length;r++){let e=t[r];if(i){if(e==="\\"){r++;continue}if(e===i)i=null;continue}if(e==='"'||e==="'"){i=e;continue}if(e===">")return r+1}return-1}function N(t,o,i){let r=o.toLowerCase(),e=1,n=i;while(n<t.length){let s=t.indexOf("<",n);if(s===-1)return-1;if(t.startsWith("<!--",s)){let g=t.indexOf("-->",s+4);n=g===-1?t.length:g+3;continue}let a=x(t,s+1);if(a===-1)return-1;let f=t.slice(s,a),u=f.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(u&&u[2].toLowerCase()===r){if(u[1]==="/"){if(e--,e===0)return a}else if(!/\/\s*>$/.test(f))e++}n=a}return-1}function A(t){let o=[],i=[],r=/\bslot\s*=\s*(?:"([^"]+)"|'([^']+)')/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let c=t.indexOf("-->",n+4);e=c===-1?t.length:c+3;continue}let s=x(t,n+1);if(s===-1)break;let a=t.slice(n,s),f=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!f){e=s;continue}let u=f[2].toLowerCase();if(f[1]==="/"){let c=i.lastIndexOf(u);if(c!==-1)i.splice(c);e=s;continue}let g=/\/\s*>$/.test(a),d=i.length===0?a.match(r):null;if(d){let c=d[1]||d[2],m=a.replace(r,"").replace(/\s+(?=\/?>$)/,"").replace(/\s{2,}/g," "),h=g||w.has(u)?-1:N(t,u,s);if(h===-1)o.push({start:n,end:s,slotName:c,element:m}),e=s;else o.push({start:n,end:h,slotName:c,element:m+t.slice(s,h)}),e=h;continue}if(!g&&!w.has(u)){if(i.push(u),u==="script"||u==="style"){let c=t.toLowerCase().indexOf(`</${u}>`,s);if(c!==-1){e=c;continue}}}e=s}return o}function O(t){let o=[],i=[],r=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let c=t.indexOf("-->",n+4);e=c===-1?t.length:c+3;continue}let s=x(t,n+1);if(s===-1)break;let a=t.slice(n,s),f=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!f){e=s;continue}let u=f[1]==="/",g=f[2].toLowerCase();if(u){let c=i.lastIndexOf(g);if(c!==-1)i.splice(c);e=s;continue}if(g==="template"&&i.length===0){let c=a.match(r);if(c){let m=y(t,s);if(m!==-1){let h=c[1]||c[2]||c[3];o.push({start:n,end:m,slotName:h,content:t.slice(s,m-11).trim(),propsBinding:c[4]||void 0}),e=m;continue}}}if(!/\/\s*>$/.test(a)&&!w.has(g)){if(i.push(g),g==="script"||g==="style"){let c=t.toLowerCase().indexOf(`</${g}>`,s);if(c!==-1){e=c;continue}}}e=s}return o}function aa(t){let o={default:"",named:new Map},i=t,r=O(t);for(let n of r)o.named.set(n.slotName,{name:n.slotName,content:n.content,propsBinding:n.propsBinding});r.sort((n,s)=>s.start-n.start);for(let n of r)i=i.slice(0,n.start)+i.slice(n.end);let e=A(i);for(let n of e){let s=o.named.get(n.slotName);if(s)s.content+=n.element;else o.named.set(n.slotName,{name:n.slotName,content:n.element})}for(let n=e.length-1;n>=0;n--){let s=e[n];i=i.slice(0,s.start)+i.slice(s.end)}return o.default=i.trim(),o}function xl(t){let o=t.match(/name\s*=\s*["']([^"']+)["']/),i=o?o[1]:"",r={},e=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,n;while((n=e.exec(t))!==null)r[n[1]]=n[2];let s=t.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),a=s?s[1].trim():"";return{name:i,props:r,defaultContent:a}}async function ca(t,o,i,r){if(!t)return i;let e=t.content;if(t.propsBinding&&Object.keys(o).length>0){let n=t.propsBinding.trim(),s={...r};if(n.startsWith("{")&&n.endsWith("}")){let a=n.slice(1,-1).split(",").map((f)=>f.trim()).filter(Boolean);for(let f of a){let[u,g]=f.split(":").map((c)=>c.trim()),d=g||u;if(o[u]!==void 0)s[d]=o[u]}}else s[n]=o;e=C(e,s)}return e}function C(t,o){return t.replace(/\{\{\s*([^}]+)\s*\}\}/g,(i,r)=>{try{let e=r.trim(),n=k(e,o);return b(String(n??""))}catch{return`{{ ${r} }}`}})}function k(t,o){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(t)){let r=t.split("."),e=o;for(let n of r)if(e&&typeof e==="object"&&n in e)e=e[n];else return;return e}let i=t.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(i){let[,r,e,n]=i,s=o[r],a=parseInt(n,10);if(typeof s==="number")switch(e){case"+":return s+a;case"-":return s-a;case"*":return s*a;case"/":return s/a}}try{if(!p(t))return;return l(t,Object.keys(o))(...Object.values(o))}catch{return}}async function la(t,o,i){let r=t;r=await M(r,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(s,a,f,u)=>{let g=o.named.get(a),d=u?.trim()||"",c=f||"",m={},h=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,S;while((S=h.exec(c))!==null){let E=S[1],R=S[2];m[E]=k(R,i)}return await ca(g,m,d,i)});let n=/<slot\b((?:"[^"]*"|'[^']*'|[^>"'])*?)\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return r=r.replace(n,(s,a,f)=>{if(/\bname\s*=/.test(a||""))return s;let u=f?.trim()||"";return o.default||u}),r}async function M(t,o,i){let r=[],e=[];t.replace(o,(a,...f)=>{let u=f[f.length-2];return e.push({match:a,index:u}),r.push(i(a,...f.slice(0,-2))),a});let n=await Promise.all(r),s=t;for(let a=e.length-1;a>=0;a--){let{match:f,index:u}=e[a];s=s.slice(0,u)+n[a]+s.slice(u+f.length)}return s}function Sl(t){let o=aa(t);return{defaultSlot:o.default,namedSlots:o.named}}async function kl(t,o,i,r){return await la(t,{default:o,named:i},r)}
3
3
  export{aa,xl,ca,la,Sl,kl};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{De,Kt}from"./chunk-5zm23zrb.js";import{Ce}from"./chunk-xd4zvm4x.js";import{Uo,Wo,f,Ct,Q,N,n,R,o}from"./chunk-e07ptggk.js";import{C}from"./chunk-zz5b1g50.js";import{Cs}from"./chunk-twqmyetp.js";import{pn,fn,gn,hn,pe}from"./chunk-9p3rtfbv.js";import{ki}from"./chunk-kp4mzspk.js";import{me,re,uo,po,Ot}from"./chunk-8nv7xakv.js";import{vt,qr}from"./chunk-mwz1mq51.js";import{Mt}from"./chunk-2etevws0.js";import{ft,Yt,Zt}from"./chunk-g7ey7mtw.js";import{createHash as ee}from"crypto";function J(i){return ee("sha256").update(i).digest("hex").slice(0,8)}function U(i=!1){let l=i?Kt():De(),a=J(l);return{content:l,filename:`runtime.${a}.js`,hash:a}}function V(){let i=Ce(),l=J(i);return{content:i,filename:`router.${l}.js`,hash:l}}import m from"fs";import c from"path";import q from"path";import{createHash as te}from"crypto";function se(i={}){let l=new Set;return{context:new Proxy(i,{get(r,e){if(e in r)return r[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(r,e){if(e in r)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function X(i,l,a={}){let r=q.resolve(i),e=await Bun.file(r).text(),S=te("sha256").update(e).digest("hex").slice(0,16);Uo();let _={};try{_=await o(a.configDir)}catch{}let y=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let v=g[1];if(/\bserver\b/.test(v))y.push(g[2])}let u=new Set(y.flatMap((v)=>Q(v))),{context:A}=se({__filename:r,__dirname:q.dirname(r),__stx_serverDeclared:u}),w=new Set,P={...R,..._,...a,buildMode:"compile",strict:!1},b=await n(e,A,r,P,w),T=me(b),B=Wo();return{route:l,sourceFile:i,html:b,fragment:T,placeholders:B,hasServerScripts:y.length>0,serverScriptContent:y,dependencies:Array.from(w),contentHash:S,status:Ct(e),streamTemplates:A.__streamTemplates}}var ne=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function Z(i,l){let a=0,r=0;if(!m.existsSync(i))return{copied:a,bytes:r};m.mkdirSync(l,{recursive:!0});function e(S,_){let y=m.readdirSync(S,{withFileTypes:!0});for(let d of y){if(ne.has(d.name))continue;let g=c.join(S,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(g,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(g,u),a++,r+=m.statSync(u).size}}}return e(i,l),{copied:a,bytes:r}}async function al(i={}){let l=Date.now(),a=c.resolve(i.root||process.cwd()),r=c.resolve(a,i.outputDir||".output");console.log("[stx build] Starting production build...");let e=await o(a),S=c.resolve(a,i.componentsDir??e.componentsDir??"components"),_=c.resolve(a,i.partialsDir??e.partialsDir??"partials"),y=c.resolve(a,i.layoutsDir??e.layoutsDir??"layouts"),d=i.publicDir??e.publicDir??"public",g=pe(e.app?.head,{known:hn,source:"app.head"}),u=e.app?.colorMode,A=e.router?.container||"main",w=i.routeRules??e.routeRules??{},P=Mt(w),b=i.serverApi??e.serverApi,T=typeof b==="object"?b:{};if(b)vt(a,T);if(e.runtimeConfig)C(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let B=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of B)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let v=N(a,{pagesDirs:e._layerPageDirs}),Y=["components","layouts","partials"],M=v.filter((s)=>!Y.some((h)=>s.pattern.startsWith(`/${h}/`)||s.pattern===`/${h}`));console.log(`[stx build] Found ${M.length} page routes (${v.length-M.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let D=U(i.debug),x=V();await Bun.write(c.join(r,"public","__stx",D.filename),D.content),await Bun.write(c.join(r,"public","__stx",x.filename),x.content),console.log(`[stx build] Runtime: ${D.filename} (${(D.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${x.filename} (${(x.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let O=[],E=[];for(let s of M){let h=P(s.pattern),k=h.rendering==="prerender";if(k&&(s.pattern.includes(":")||s.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${s.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await X(s.filePath,s.pattern,{configDir:a,componentsDir:S,partialsDir:_,layoutsDir:y,debug:i.debug});if(O.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,D.filename).replace(/router\.__STX_HASH__\.js/g,x.filename),t.html=gn(t.html,g,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=pn(t.html,u);if(g.htmlAttrs)t.html=fn(t.html,g.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(t.html)){let p=t.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(p&&p[1]){let W=p[1];t.html=t.html.replace(" "+W,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${W}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await f(t.html),k){let p=await Ot(t,{params:{},request:new Request(`http://stx.build${s.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${s.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=re(t.html,A);let z=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),G=c.join("server","pages",`${z}.compiled.json`),I=c.join("server","fragments",`${z}.html`);await Bun.write(c.join(r,G),JSON.stringify(t,null,2)),await Bun.write(c.join(r,I),t.fragment),E.push({pattern:s.pattern,compiledPath:G,fragmentPath:I,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:k}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(h).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let H=c.resolve(a,d);if(m.existsSync(H)){let{copied:s,bytes:h}=Z(H,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${d}/`)}let F=Zt(a);if(F){let{copied:s,bytes:h}=Z(F,c.join(r,"public",Yt));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${ft}/`)}let K={runtime:D.filename,router:x.filename},j=uo(E,K,r);if(j.routeRules=w,j.routerContainer=A,b)j.apiRoutes=await qr(a,r,T);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await Cs(a,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(ki(e._layerGraph),null,2));po(j,r);let L=Date.now()-l;return console.log(`
2
+ import{Ce}from"./chunk-1aw9qbdf.js";import{De,Kt}from"./chunk-yy6cqwnj.js";import{Uo,Wo,f,Ct,Q,N,n,R,o}from"./chunk-yd62qhpz.js";import{C}from"./chunk-6k4f583z.js";import{Cs}from"./chunk-02m9mhkd.js";import{pn,fn,gn,hn,pe}from"./chunk-8wrxmtce.js";import{ki}from"./chunk-kp4mzspk.js";import{me,re,uo,po,Ot}from"./chunk-ftyen64y.js";import{wt,qr}from"./chunk-vyhtz9k2.js";import{Mt}from"./chunk-2etevws0.js";import{ft,Yt,Zt}from"./chunk-g7ey7mtw.js";import m from"fs";import c from"path";import{createHash as ee}from"crypto";function J(i){return ee("sha256").update(i).digest("hex").slice(0,8)}function U(i=!1){let l=i?Kt():De(),a=J(l);return{content:l,filename:`runtime.${a}.js`,hash:a}}function V(){let i=Ce(),l=J(i);return{content:i,filename:`router.${l}.js`,hash:l}}import q from"path";import{createHash as te}from"crypto";function se(i={}){let l=new Set;return{context:new Proxy(i,{get(r,e){if(e in r)return r[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(r,e){if(e in r)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function X(i,l,a={}){let r=q.resolve(i),e=await Bun.file(r).text(),S=te("sha256").update(e).digest("hex").slice(0,16);Uo();let _={};try{_=await o(a.configDir)}catch{}let y=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let v=g[1];if(/\bserver\b/.test(v))y.push(g[2])}let u=new Set(y.flatMap((v)=>Q(v))),{context:A}=se({__filename:r,__dirname:q.dirname(r),__stx_serverDeclared:u}),w=new Set,P={...R,..._,...a,buildMode:"compile",strict:!1},b=await n(e,A,r,P,w),T=me(b),B=Wo();return{route:l,sourceFile:i,html:b,fragment:T,placeholders:B,hasServerScripts:y.length>0,serverScriptContent:y,dependencies:Array.from(w),contentHash:S,status:Ct(e),streamTemplates:A.__streamTemplates}}var ne=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function Z(i,l){let a=0,r=0;if(!m.existsSync(i))return{copied:a,bytes:r};m.mkdirSync(l,{recursive:!0});function e(S,_){let y=m.readdirSync(S,{withFileTypes:!0});for(let d of y){if(ne.has(d.name))continue;let g=c.join(S,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(g,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(g,u),a++,r+=m.statSync(u).size}}}return e(i,l),{copied:a,bytes:r}}async function al(i={}){let l=Date.now(),a=c.resolve(i.root||process.cwd()),r=c.resolve(a,i.outputDir||".output");console.log("[stx build] Starting production build...");let e=await o(a),S=c.resolve(a,i.componentsDir??e.componentsDir??"components"),_=c.resolve(a,i.partialsDir??e.partialsDir??"partials"),y=c.resolve(a,i.layoutsDir??e.layoutsDir??"layouts"),d=i.publicDir??e.publicDir??"public",g=pe(e.app?.head,{known:hn,source:"app.head"}),u=e.app?.colorMode,A=e.router?.container||"main",w=i.routeRules??e.routeRules??{},P=Mt(w),b=i.serverApi??e.serverApi,T=typeof b==="object"?b:{};if(b)wt(a,T);if(e.runtimeConfig)C(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let B=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of B)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let v=N(a,{pagesDirs:e._layerPageDirs}),Y=["components","layouts","partials"],M=v.filter((s)=>!Y.some((h)=>s.pattern.startsWith(`/${h}/`)||s.pattern===`/${h}`));console.log(`[stx build] Found ${M.length} page routes (${v.length-M.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let D=U(i.debug),x=V();await Bun.write(c.join(r,"public","__stx",D.filename),D.content),await Bun.write(c.join(r,"public","__stx",x.filename),x.content),console.log(`[stx build] Runtime: ${D.filename} (${(D.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${x.filename} (${(x.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let O=[],E=[];for(let s of M){let h=P(s.pattern),k=h.rendering==="prerender";if(k&&(s.pattern.includes(":")||s.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${s.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await X(s.filePath,s.pattern,{configDir:a,componentsDir:S,partialsDir:_,layoutsDir:y,debug:i.debug});if(O.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,D.filename).replace(/router\.__STX_HASH__\.js/g,x.filename),t.html=gn(t.html,g,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=pn(t.html,u);if(g.htmlAttrs)t.html=fn(t.html,g.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(t.html)){let p=t.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(p&&p[1]){let W=p[1];t.html=t.html.replace(" "+W,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${W}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await f(t.html),k){let p=await Ot(t,{params:{},request:new Request(`http://stx.build${s.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${s.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=re(t.html,A);let z=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),G=c.join("server","pages",`${z}.compiled.json`),I=c.join("server","fragments",`${z}.html`);await Bun.write(c.join(r,G),JSON.stringify(t,null,2)),await Bun.write(c.join(r,I),t.fragment),E.push({pattern:s.pattern,compiledPath:G,fragmentPath:I,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:k}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(h).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let H=c.resolve(a,d);if(m.existsSync(H)){let{copied:s,bytes:h}=Z(H,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${d}/`)}let F=Zt(a);if(F){let{copied:s,bytes:h}=Z(F,c.join(r,"public",Yt));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${ft}/`)}let K={runtime:D.filename,router:x.filename},j=uo(E,K,r);if(j.routeRules=w,j.routerContainer=A,b)j.apiRoutes=await qr(a,r,T);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await Cs(a,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(ki(e._layerGraph),null,2));po(j,r);let L=Date.now()-l;return console.log(`
3
3
  [stx build] Done in ${L}ms \u2014 ${O.length} pages compiled`),{pageCount:O.length,assets:K,outputDir:r,duration:L}}
4
4
  export{al};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ui,Wi}from"./chunk-vfjjp7cf.js";import"./chunk-gq8xkhxx.js";import"./chunk-hkc9hezx.js";import"./chunk-gte0wmh8.js";import"./chunk-2j04bc8c.js";import"./chunk-q6k3w27m.js";import"./chunk-01rz8h7x.js";import"./chunk-k3p8vgct.js";import{io}from"./chunk-ftyen64y.js";import"./chunk-4hz4g5ym.js";import"./chunk-jcmgj8kk.js";import"./chunk-1j7na0de.js";import"./chunk-8fb1mqw1.js";import"./chunk-n34kagea.js";import"./chunk-k2fxyvn8.js";import"./chunk-3y8ykqpx.js";import"./chunk-zv0vgamy.js";import"./chunk-fesb4h31.js";import"./chunk-vp827ah7.js";import"./chunk-ygetbydb.js";import"./chunk-8xpyzcq2.js";import"./chunk-67actssw.js";import"./chunk-dc46t9tn.js";import"./chunk-h6q8jafh.js";import"./chunk-3s9s1mdt.js";import"./chunk-s9mq9x2k.js";import"./chunk-1c407nky.js";import"./chunk-xx2pk2ay.js";import"./chunk-mrbfx4t7.js";import"./chunk-yy6cqwnj.js";import"./chunk-68sc0w22.js";import"./chunk-4vc67zkb.js";import"./chunk-er7y8hk9.js";import"./chunk-1eq6nj35.js";import"./chunk-vyhtz9k2.js";import"./chunk-2hc5mbw8.js";import{he,nn,rn,K,u,n,Jn,R,o,le}from"./chunk-yd62qhpz.js";import"./chunk-a3zn6rc9.js";import"./chunk-c57j92td.js";import"./chunk-kp4mzspk.js";import"./chunk-02m9mhkd.js";import"./chunk-6k4f583z.js";import"./chunk-wxgs36py.js";import"./chunk-8wrxmtce.js";import"./chunk-jtaqygzg.js";import"./chunk-ba88n1j7.js";import"./chunk-yxdyh23k.js";import"./chunk-1aw9qbdf.js";import"./chunk-e6y6s7q8.js";export{Jn as buildWebComponents,rn as cacheTemplate,nn as checkCache,io as classifyAllScripts,Ui as createMiddleware,Wi as createRoute,R as defaultConfig,u as extractVariables,K as injectRouterScript,o as loadStxConfig,he as processClientScript,n as processDirectives,le as readMarkdownFile};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{y}from"./chunk-g1r4v0mc.js";import{I,At}from"./chunk-ba88n1j7.js";import{w,Ve,L,o}from"./chunk-e07ptggk.js";import{ie,yt,bt}from"./chunk-xmw9e9zn.js";import{Ie,qt,pt,H}from"./chunk-2fb4yx25.js";import f from"path";var l=new Map;function v(a,s){for(let n of a.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(n[1])s.add(n[1]);for(let n of a.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let r of(n[1]??"").split(",")){let i=((r.includes(":")?r.split(":").pop():r)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(i))s.add(i)}for(let n of a.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let r of(n[1]??"").split(",")){let c=r.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(c))s.add(c)}}async function nd(a){let s;if(a)s=f.resolve(a);else{let t=await o();s=f.resolve(t.root||process.cwd(),t.storesDir||"stores")}let n=new Bun.Glob("*.ts"),r=[];try{for await(let t of n.scan({cwd:s,absolute:!0})){let e=f.basename(t,".ts");if(["index","types"].includes(e))continue;if(t.includes(".d.ts"))continue;r.push(t)}}catch{return H(l,s,"",""),null}let c=()=>[...new Set([...r,...r.flatMap((t)=>ie(t))])],i=Ie(c()),d=pt(l,s,i);if(d!==void 0)return d||null;if(r.length===0)return H(l,s,i,""),null;let p=[];for(let t of r){let e=await Bun.file(t).text();p.push({file:t,hasUseStore:/useStore\s*\(/.test(e)})}p.sort((t,e)=>{if(t.hasUseStore===e.hasUseStore)return 0;return t.hasUseStore?1:-1});let h=p.map((t)=>t.file),u=[],m=new Set,b=L({loader:"ts",target:"browser",define:w()});for(let t of h)try{let e=await Bun.file(t).text(),x=f.basename(t,".ts");if(v(e,m),yt(e))e=await bt(e,t,{projectRoot:process.cwd(),externalizeUserModules:!1});e=Ve(e),e=I(e),e=At(e),e=e.replace(/^export\s+(default\s+)?/gm,""),e=b.transformSync(e),u.push(`// Store: ${x}
2
+ import{y}from"./chunk-yxdyh23k.js";import{I,At}from"./chunk-ba88n1j7.js";import{w,Ve,L,o}from"./chunk-yd62qhpz.js";import{ie,yt,bt}from"./chunk-1eq6nj35.js";import{Ie,qt,pt,H}from"./chunk-2fb4yx25.js";import f from"path";var l=new Map;function v(a,s){for(let n of a.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(n[1])s.add(n[1]);for(let n of a.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let r of(n[1]??"").split(",")){let i=((r.includes(":")?r.split(":").pop():r)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(i))s.add(i)}for(let n of a.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let r of(n[1]??"").split(",")){let c=r.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(c))s.add(c)}}async function nd(a){let s;if(a)s=f.resolve(a);else{let t=await o();s=f.resolve(t.root||process.cwd(),t.storesDir||"stores")}let n=new Bun.Glob("*.ts"),r=[];try{for await(let t of n.scan({cwd:s,absolute:!0})){let e=f.basename(t,".ts");if(["index","types"].includes(e))continue;if(t.includes(".d.ts"))continue;r.push(t)}}catch{return H(l,s,"",""),null}let c=()=>[...new Set([...r,...r.flatMap((t)=>ie(t))])],i=Ie(c()),d=pt(l,s,i);if(d!==void 0)return d||null;if(r.length===0)return H(l,s,i,""),null;let p=[];for(let t of r){let e=await Bun.file(t).text();p.push({file:t,hasUseStore:/useStore\s*\(/.test(e)})}p.sort((t,e)=>{if(t.hasUseStore===e.hasUseStore)return 0;return t.hasUseStore?1:-1});let h=p.map((t)=>t.file),u=[],m=new Set,b=L({loader:"ts",target:"browser",define:w()});for(let t of h)try{let e=await Bun.file(t).text(),x=f.basename(t,".ts");if(v(e,m),yt(e))e=await bt(e,t,{projectRoot:process.cwd(),externalizeUserModules:!1});e=Ve(e),e=I(e),e=At(e),e=e.replace(/^export\s+(default\s+)?/gm,""),e=b.transformSync(e),u.push(`// Store: ${x}
3
3
  ${e.trim()}`)}catch(e){console.warn(`[stx] Failed to load store ${t}:`,e)}if(u.length===0)return H(l,s,i,""),null;let g=u.join(`
4
4
 
5
5
  `),S=`;(function(){
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{wt,Wr,qr,Kr,Td,Xr}from"./chunk-vyhtz9k2.js";import"./chunk-kp4mzspk.js";import"./chunk-6k4f583z.js";import"./chunk-1aw9qbdf.js";export{qr as buildServerApi,Td as createServerApi,wt as discoverServerApi,Wr as generateApiTypes,Xr as isServerApiSource,Kr as productionApiDispatcher};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{$e,Te,_e}from"./chunk-1149d93e.js";import{it,at,Ee,Ws,ct,lt}from"./chunk-c322rrge.js";import o from"fs";import i from"path";var c=[];function m(a){c=[];for(let e of a.storyFiles)if(c.push({text:e.fileName.toLowerCase(),original:e.fileName,type:"story",storyId:e.id}),c.push({text:e.relativePath.toLowerCase(),original:e.relativePath,type:"story",storyId:e.id}),e.story)for(let t of e.story.variants)c.push({text:t.title.toLowerCase(),original:t.title,type:"story",storyId:e.id,variantId:t.id})}function f(){return JSON.stringify(c)}async function F(a={}){let e=Date.now();it();let t=await $e({mode:"build"});if(!t.config.enabled){Ee("Story feature is disabled in config.");return}let n=await ct(t);Te(t,n);let l=lt(t.config,n);_e(t,l),at(n.length);let d=a.outDir??t.config.outDir,s=i.resolve(t.root,d);await o.promises.mkdir(s,{recursive:!0}),console.log(` Building to ${d}...`);let g=v(t);await o.promises.writeFile(i.join(s,"index.html"),g);let y={files:n.map((r)=>({id:r.id,fileName:r.fileName,relativePath:r.relativePath,treePath:r.treePath})),tree:l};await o.promises.writeFile(i.join(s,"stories.json"),JSON.stringify(y,null,2));let u={theme:t.config.theme,responsivePresets:t.config.responsivePresets,backgroundPresets:t.config.backgroundPresets};await o.promises.writeFile(i.join(s,"config.json"),JSON.stringify(u,null,2));let p=i.join(s,"stories");await o.promises.mkdir(p,{recursive:!0});for(let r of n){let b=await o.promises.readFile(r.path,"utf-8");await o.promises.writeFile(i.join(p,`${r.id}.stx`),b)}m(t);let h=f();await o.promises.writeFile(i.join(s,"search-index.json"),h);let x=Date.now()-e;Ws(n.length,d,x)}function v(a){let{theme:e}=a.config,t=e.title||"STX Story";return`<!DOCTYPE html>
2
+ import{$e,_e,Te}from"./chunk-czmw5xsd.js";import{it,at,Ee,Ws,ct,lt}from"./chunk-c322rrge.js";import o from"fs";import i from"path";var c=[];function m(a){c=[];for(let e of a.storyFiles)if(c.push({text:e.fileName.toLowerCase(),original:e.fileName,type:"story",storyId:e.id}),c.push({text:e.relativePath.toLowerCase(),original:e.relativePath,type:"story",storyId:e.id}),e.story)for(let t of e.story.variants)c.push({text:t.title.toLowerCase(),original:t.title,type:"story",storyId:e.id,variantId:t.id})}function f(){return JSON.stringify(c)}async function F(a={}){let e=Date.now();it();let t=await $e({mode:"build"});if(!t.config.enabled){Ee("Story feature is disabled in config.");return}let n=await ct(t);_e(t,n);let l=lt(t.config,n);Te(t,l),at(n.length);let d=a.outDir??t.config.outDir,s=i.resolve(t.root,d);await o.promises.mkdir(s,{recursive:!0}),console.log(` Building to ${d}...`);let g=v(t);await o.promises.writeFile(i.join(s,"index.html"),g);let y={files:n.map((r)=>({id:r.id,fileName:r.fileName,relativePath:r.relativePath,treePath:r.treePath})),tree:l};await o.promises.writeFile(i.join(s,"stories.json"),JSON.stringify(y,null,2));let u={theme:t.config.theme,responsivePresets:t.config.responsivePresets,backgroundPresets:t.config.backgroundPresets};await o.promises.writeFile(i.join(s,"config.json"),JSON.stringify(u,null,2));let p=i.join(s,"stories");await o.promises.mkdir(p,{recursive:!0});for(let r of n){let b=await o.promises.readFile(r.path,"utf-8");await o.promises.writeFile(i.join(p,`${r.id}.stx`),b)}m(t);let h=f();await o.promises.writeFile(i.join(s,"search-index.json"),h);let x=Date.now()-e;Ws(n.length,d,x)}function v(a){let{theme:e}=a.config,t=e.title||"STX Story";return`<!DOCTYPE html>
3
3
  <html lang="en">
4
4
  <head>
5
5
  <meta charset="UTF-8">
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{y}from"./chunk-g1r4v0mc.js";import{W,He,ss,os,Yo,Zo,Qo,ei,Wn,is,ti,ni,ri,Et,o}from"./chunk-e07ptggk.js";import{Lr}from"./chunk-npth2waq.js";import{a}from"./chunk-dne8n6h3.js";import{existsSync as M,readFileSync as K}from"fs";import h from"path";var me=new Set(["module","exports","require","$bool","$num","window","document","console","confirm","alert","fetch"]),te=Et.filter((e)=>!me.has(e)).sort(),ne=[...y].sort(),he=[...new Set([...te,...ne])].sort(),be=new Set(te),ye=new Set(ne),xe=new Set(he),ee=/\bimport\s+(?!type[\s{])\{([^}]*)\}\s*from\s*(['"])stx\2/g;function Se(e,t){if(t==="server")return`'${e}' is not provided by 'stx' in a <script server> block. The engine binds only its own names there (defineProps, state, useHead, ...); any other name becomes \`await import('stx')\`, which does not resolve, so the whole script fails when the page renders. Import it from '@stacksjs/stx' instead.`;return`'${e}' is not provided by 'stx' in a client <script> block. The import is replaced by the window.stx runtime, which has no '${e}', so it is undefined in the browser.`}function ie(e,t){let s=[];for(let u of t){if(u.offset===void 0)continue;let i=u.kind==="server"?be:ye;ee.lastIndex=0;for(let l of u.code.matchAll(ee)){let g=l.index+l[0].indexOf("{")+1;for(let m of l[1].matchAll(/[^,]+/g)){let S=m[0];if(/^\s*type\s/.test(S))continue;let x=/^\s*([A-Za-z_$][\w$]*)/.exec(S);if(!x)continue;let r=x[1];if(!xe.has(r)||i.has(r))continue;let f=u.offset+g+m.index+x[0].length-r.length,p=e.slice(0,f),w=p.split(`
2
+ import{y}from"./chunk-yxdyh23k.js";import{W,He,ss,os,Yo,Zo,Qo,ei,Wn,is,ti,ni,ri,Et,o}from"./chunk-yd62qhpz.js";import{Lr}from"./chunk-dc46t9tn.js";import{a}from"./chunk-dne8n6h3.js";import{existsSync as M,readFileSync as K}from"fs";import h from"path";var me=new Set(["module","exports","require","$bool","$num","window","document","console","confirm","alert","fetch"]),te=Et.filter((e)=>!me.has(e)).sort(),ne=[...y].sort(),he=[...new Set([...te,...ne])].sort(),be=new Set(te),ye=new Set(ne),xe=new Set(he),ee=/\bimport\s+(?!type[\s{])\{([^}]*)\}\s*from\s*(['"])stx\2/g;function Se(e,t){if(t==="server")return`'${e}' is not provided by 'stx' in a <script server> block. The engine binds only its own names there (defineProps, state, useHead, ...); any other name becomes \`await import('stx')\`, which does not resolve, so the whole script fails when the page renders. Import it from '@stacksjs/stx' instead.`;return`'${e}' is not provided by 'stx' in a client <script> block. The import is replaced by the window.stx runtime, which has no '${e}', so it is undefined in the browser.`}function ie(e,t){let s=[];for(let u of t){if(u.offset===void 0)continue;let i=u.kind==="server"?be:ye;ee.lastIndex=0;for(let l of u.code.matchAll(ee)){let g=l.index+l[0].indexOf("{")+1;for(let m of l[1].matchAll(/[^,]+/g)){let S=m[0];if(/^\s*type\s/.test(S))continue;let x=/^\s*([A-Za-z_$][\w$]*)/.exec(S);if(!x)continue;let r=x[1];if(!xe.has(r)||i.has(r))continue;let f=u.offset+g+m.index+x[0].length-r.length,p=e.slice(0,f),w=p.split(`
3
3
  `).length;s.push({line:w,column:f-(p.lastIndexOf(`
4
4
  `)+1)+1,offset:f,length:r.length,name:r,kind:u.kind,message:Se(r,u.kind)})}}}return s}import T from"path";var ke="@stacksjs/stx-typescript-plugin";function we(e,t){let s=T.resolve(e);for(;;){let u=T.join(s,"tsconfig.json");if(t(u))return u;let i=T.dirname(s);if(i===s)return;s=i}}function se(e,t,s){let u=we(e,s);if(!u)return;let i=new Set,l=(g)=>{if(i.has(g))return;i.add(g);let m=t(g);if(!m)return;let S=m.compilerOptions?.plugins;if(Array.isArray(S)){let r=S.find((p)=>p?.name===ke),f=Array.isArray(r?.libs)?r.libs.filter((p)=>typeof p==="string"):[];return r?{configPath:g,libs:f.map((p)=>T.resolve(T.dirname(g),p))}:null}let x=typeof m.extends==="string"?[m.extends]:Array.isArray(m.extends)?m.extends:[];for(let r of[...x].reverse()){if(typeof r!=="string"||!r.startsWith("."))continue;let f=T.resolve(T.dirname(g),r.endsWith(".json")?r:`${r}.json`),p=l(f);if(p!==void 0)return p}return};return l(u)??void 0}function ea(e,t="",s=""){let u=e.startLine>1?`
5
5
  `.repeat(e.startLine-1):"",i=is(e)+os(ss(e.code)),l=e.kind==="client"||e.kind==="plain"?Qo(t,e.code):"";return Wn(`${u+i}
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{_r,Tr,Rr,da,ua,pa,yo,fa,ga}from"./chunk-3y8ykqpx.js";export{_r as ImageProcessorCache,yo as applyTransformations,da as clearImageCache,fa as generateResponsiveVariants,ga as generateSrcset,Tr as getCachedImageResult,pa as optimizeImage,ua as processImage,Rr as setCachedImageResult};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Qc}from"./chunk-hkc9hezx.js";import"./chunk-ftyen64y.js";import"./chunk-vyhtz9k2.js";import"./chunk-yd62qhpz.js";import"./chunk-a3zn6rc9.js";import"./chunk-c57j92td.js";import"./chunk-kp4mzspk.js";import"./chunk-02m9mhkd.js";import"./chunk-6k4f583z.js";import"./chunk-wxgs36py.js";import"./chunk-8wrxmtce.js";import"./chunk-jtaqygzg.js";import"./chunk-ba88n1j7.js";import"./chunk-yxdyh23k.js";import"./chunk-1aw9qbdf.js";import"./chunk-e6y6s7q8.js";export{Qc as startProductionServer};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import"./chunk-g495xx4v.js";import"./chunk-c57j92td.js";import"./chunk-68tzytfz.js";import{a}from"./chunk-dne8n6h3.js";import f from"fs";import l from"path";async function d(e,t={}){let s=Date.now(),n={total:0,passed:0,failed:0,new:0,failures:[],duration:0},o=t.snapshotDir||a(e.root,"story","snapshots");await f.promises.mkdir(o,{recursive:!0});let r=e.storyFiles;if(t.filter&&t.filter.length>0)r=r.filter((i)=>t.filter.some((p)=>i.fileName.toLowerCase().includes(p.toLowerCase())));for(let i of r)await h(i,o,t,n);return n.duration=Date.now()-s,n}async function h(e,t,s,n){let o=e.story;if(!o)return;for(let r of o.variants){n.total++;let i=l.join(t,`${e.id}-${r.id}.snap`),p=g(r.source||""),c=await w(i);if(s.update||!c){let u={storyId:e.id,variantId:r.id,component:e.fileName,timestamp:Date.now(),hash:p};if(await f.promises.writeFile(i,JSON.stringify(u,null,2)),!c)n.new++;n.passed++}else try{let u=await f.promises.readFile(i,"utf-8"),m=JSON.parse(u);if(m.hash===p)n.passed++;else n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:"Snapshot mismatch",difference:y(m.hash,p)})}catch(u){n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:`Error reading snapshot: ${u}`})}}}async function x(e,t={}){return(await d(e,{...t,update:!0})).total}function g(e){let t=0;for(let s=0;s<e.length;s++){let n=e.charCodeAt(s);t=(t<<5)-t+n,t=t&t}return t.toString(16)}function y(e,t){if(e===t)return 0;let s=Math.abs(Number.parseInt(e,16)-Number.parseInt(t,16));return Math.min(s/1e6,1)}async function w(e){try{return await f.promises.access(e),!0}catch{return!1}}function F(e){let t=[];if(t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(" STX Story Visual Regression Tests"),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),e.failures.length>0){t.push(" \u274C Failures:"),t.push("");for(let s of e.failures){if(t.push(` \u2022 ${s.component} / ${s.variantId}`),t.push(` ${s.message}`),s.difference!==void 0)t.push(` Difference: ${(s.difference*100).toFixed(2)}%`);t.push("")}}if(t.push(" Summary:"),t.push(` Total: ${e.total}`),t.push(` Passed: ${e.passed} \u2713`),t.push(` Failed: ${e.failed} \u2717`),e.new>0)t.push(` New: ${e.new} \u26A1`);return t.push(` Time: ${e.duration}ms`),t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),t.join(`
2
+ import"./chunk-jtaqygzg.js";import"./chunk-c57j92td.js";import"./chunk-a3zn6rc9.js";import{a}from"./chunk-dne8n6h3.js";import f from"fs";import l from"path";async function d(e,t={}){let s=Date.now(),n={total:0,passed:0,failed:0,new:0,failures:[],duration:0},o=t.snapshotDir||a(e.root,"story","snapshots");await f.promises.mkdir(o,{recursive:!0});let r=e.storyFiles;if(t.filter&&t.filter.length>0)r=r.filter((i)=>t.filter.some((p)=>i.fileName.toLowerCase().includes(p.toLowerCase())));for(let i of r)await h(i,o,t,n);return n.duration=Date.now()-s,n}async function h(e,t,s,n){let o=e.story;if(!o)return;for(let r of o.variants){n.total++;let i=l.join(t,`${e.id}-${r.id}.snap`),p=g(r.source||""),c=await w(i);if(s.update||!c){let u={storyId:e.id,variantId:r.id,component:e.fileName,timestamp:Date.now(),hash:p};if(await f.promises.writeFile(i,JSON.stringify(u,null,2)),!c)n.new++;n.passed++}else try{let u=await f.promises.readFile(i,"utf-8"),m=JSON.parse(u);if(m.hash===p)n.passed++;else n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:"Snapshot mismatch",difference:y(m.hash,p)})}catch(u){n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:`Error reading snapshot: ${u}`})}}}async function x(e,t={}){return(await d(e,{...t,update:!0})).total}function g(e){let t=0;for(let s=0;s<e.length;s++){let n=e.charCodeAt(s);t=(t<<5)-t+n,t=t&t}return t.toString(16)}function y(e,t){if(e===t)return 0;let s=Math.abs(Number.parseInt(e,16)-Number.parseInt(t,16));return Math.min(s/1e6,1)}async function w(e){try{return await f.promises.access(e),!0}catch{return!1}}function F(e){let t=[];if(t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(" STX Story Visual Regression Tests"),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),e.failures.length>0){t.push(" \u274C Failures:"),t.push("");for(let s of e.failures){if(t.push(` \u2022 ${s.component} / ${s.variantId}`),t.push(` ${s.message}`),s.difference!==void 0)t.push(` Difference: ${(s.difference*100).toFixed(2)}%`);t.push("")}}if(t.push(" Summary:"),t.push(` Total: ${e.total}`),t.push(` Passed: ${e.passed} \u2713`),t.push(` Failed: ${e.failed} \u2717`),e.new>0)t.push(` New: ${e.new} \u26A1`);return t.push(` Time: ${e.duration}ms`),t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),t.join(`
3
3
  `)}export{F as formatTestResults,d as runVisualTests,x as updateSnapshots};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Lr,Ml,Nl}from"./chunk-dc46t9tn.js";import"./chunk-1eq6nj35.js";import"./chunk-vyhtz9k2.js";import"./chunk-2hc5mbw8.js";import"./chunk-yd62qhpz.js";import"./chunk-a3zn6rc9.js";import"./chunk-c57j92td.js";import"./chunk-kp4mzspk.js";import"./chunk-02m9mhkd.js";import"./chunk-6k4f583z.js";import"./chunk-wxgs36py.js";import"./chunk-8wrxmtce.js";import"./chunk-jtaqygzg.js";import"./chunk-ba88n1j7.js";import"./chunk-yxdyh23k.js";import"./chunk-1aw9qbdf.js";import"./chunk-e6y6s7q8.js";export{Nl as clearComposableCache,Ml as getComposableScript,Lr as listComposableModules};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{wl}from"./chunk-1j7na0de.js";import"./chunk-yd62qhpz.js";import"./chunk-a3zn6rc9.js";import"./chunk-c57j92td.js";import"./chunk-kp4mzspk.js";import"./chunk-02m9mhkd.js";import"./chunk-6k4f583z.js";import"./chunk-wxgs36py.js";import"./chunk-8wrxmtce.js";import"./chunk-jtaqygzg.js";import"./chunk-ba88n1j7.js";import"./chunk-yxdyh23k.js";import"./chunk-1aw9qbdf.js";import"./chunk-e6y6s7q8.js";export{wl as buildApp};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Xd,$c,be,ui,Gd,ms,hs,ys}from"./chunk-yd62qhpz.js";import"./chunk-a3zn6rc9.js";import"./chunk-c57j92td.js";import"./chunk-kp4mzspk.js";import"./chunk-02m9mhkd.js";import"./chunk-6k4f583z.js";import"./chunk-wxgs36py.js";import"./chunk-8wrxmtce.js";import"./chunk-jtaqygzg.js";import"./chunk-ba88n1j7.js";import"./chunk-yxdyh23k.js";import"./chunk-1aw9qbdf.js";import"./chunk-e6y6s7q8.js";export{Gd as clearOnceStore,ui as onceStore,be as partialsCache,ms as processIncludes,hs as processStackPushDirectives,ys as processStackReplacements,Xd as resetUnscopedSignalWarnings,$c as topLevelElements};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{ie,qa,Fo,mt,ht,_d,zo,yt,Qt,Ka,Xa,Ga,Ja,bt,Ya}from"./chunk-1eq6nj35.js";import"./chunk-vyhtz9k2.js";import"./chunk-2hc5mbw8.js";import"./chunk-yd62qhpz.js";import"./chunk-a3zn6rc9.js";import"./chunk-c57j92td.js";import"./chunk-kp4mzspk.js";import"./chunk-02m9mhkd.js";import"./chunk-6k4f583z.js";import"./chunk-wxgs36py.js";import"./chunk-8wrxmtce.js";import"./chunk-jtaqygzg.js";import"./chunk-ba88n1j7.js";import"./chunk-yxdyh23k.js";import"./chunk-1aw9qbdf.js";import"./chunk-e6y6s7q8.js";export{Qt as MODULE_SPECIFIER_PREFIX,bt as bundleClientScript,ht as clearBundleFailures,ie as clientBundleDependencies,mt as getBundleFailures,yt as hasUserImports,Xa as normalizeRegistrySpecifiers,Ja as queueClientBundleBuild,Fo as recordBundleFailure,Ka as registryIdForPath,zo as resolveBundlerFallback,Ga as rewriteRegistryImports,_d as setBundlerFallbackMode,qa as shouldLogBundlerDiagnostics,Ya as tempBuildName};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{de,Tt,Qn,Es,C,Xe}from"./chunk-zz5b1g50.js";export{Tt as currentRuntimeConfig,Xe as injectRuntimeConfig,C as resolveRuntimeConfig,Es as useRuntimeConfig,Qn as useServerRuntimeConfig,de as withRuntimeConfig};
2
+ import{de,_t,Qn,Es,C,Xe}from"./chunk-6k4f583z.js";export{_t as currentRuntimeConfig,Xe as injectRuntimeConfig,C as resolveRuntimeConfig,Es as useRuntimeConfig,Qn as useServerRuntimeConfig,de as withRuntimeConfig};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
2
  import m from"path";var y=/__stxModules\["((?:[^"\\]|\\.)*)"\]/g;function I(...o){let r=new Set;for(let s of o){if(!s||!s.includes("__stxModules["))continue;for(let e of s.matchAll(y))try{r.add(JSON.parse(`"${e[1]}"`))}catch{}}return[...r].sort()}async function w(o,r={}){if(o.length===0)return null;let s=process.cwd(),e=[],a=[];o.forEach((t,c)=>{let i=t.startsWith("npm:")?t.slice(4):m.resolve(s,t),l=`__stxRegistered${c}`,p=JSON.stringify(t);e.push(`import * as ${l} from ${JSON.stringify(i)};`),a.push(`if (!globalThis.__stxModules[${p}]) globalThis.__stxModules[${p}] = ${l};`)});let d=[...e,"globalThis.__stxModules = globalThis.__stxModules || {};",...a].join(`
3
- `),n;try{let{bundleClientScript:t}=await import("./chunk-x5gbrjm5.js");n=await t(d,m.join(s,".stx-module-registry.ts"),{projectRoot:s,minify:r.minify,externalizeUserModules:!1,collectInputs:r.collectInputs,throwOnFailure:!0})}catch(t){let{formatBuildFailure:c}=await import("./chunk-0fad6jf4.js"),i=c(t);console.warn(`[stx] could not build the page module registry (#1957): ${i}`);let l=`[stx] the page module registry did not build, so ${o.join(", ")} cannot load (#1957): ${i}`;return`;console.error(${JSON.stringify(l)});`}let{transformAutoImports:f,generateAutoImportDestructuring:_}=await import("./chunk-11j2dj0r.js"),u=f(n),h=_(u.stxImports,u.browserImports),{transformStoreImports:x}=await import("./chunk-9z76qhdm.js");n=x(u.code);let g=JSON.stringify(new Bun.CryptoHasher("md5").update(d).digest("hex").slice(0,12));return[";(function() {"," var __stxBundles = globalThis.__stxModuleBundles || (globalThis.__stxModuleBundles = {});",` if (__stxBundles[${g}]) return;`,` __stxBundles[${g}] = true;`,h,n,"})();"].join(`
3
+ `),n;try{let{bundleClientScript:t}=await import("./chunk-rk153jft.js");n=await t(d,m.join(s,".stx-module-registry.ts"),{projectRoot:s,minify:r.minify,externalizeUserModules:!1,collectInputs:r.collectInputs,throwOnFailure:!0})}catch(t){let{formatBuildFailure:c}=await import("./chunk-0fad6jf4.js"),i=c(t);console.warn(`[stx] could not build the page module registry (#1957): ${i}`);let l=`[stx] the page module registry did not build, so ${o.join(", ")} cannot load (#1957): ${i}`;return`;console.error(${JSON.stringify(l)});`}let{transformAutoImports:f,generateAutoImportDestructuring:_}=await import("./chunk-26b39qx2.js"),u=f(n),h=_(u.stxImports,u.browserImports),{transformStoreImports:x}=await import("./chunk-9z76qhdm.js");n=x(u.code);let g=JSON.stringify(new Bun.CryptoHasher("md5").update(d).digest("hex").slice(0,12));return[";(function() {"," var __stxBundles = globalThis.__stxModuleBundles || (globalThis.__stxModuleBundles = {});",` if (__stxBundles[${g}]) return;`,` __stxBundles[${g}] = true;`,h,n,"})();"].join(`
4
4
  `)}export{w as buildModuleRegistryScript,I as registeredModuleIdsIn};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Ne,oc,Md,Nd,Ld,jd,ic,ac,Bd,Fd,Ko,zd,nn,rn,zn}from"./chunk-e07ptggk.js";import"./chunk-68tzytfz.js";import"./chunk-c57j92td.js";import"./chunk-kp4mzspk.js";import"./chunk-twqmyetp.js";import"./chunk-zz5b1g50.js";import"./chunk-5tbqdz94.js";import"./chunk-9p3rtfbv.js";import"./chunk-g495xx4v.js";import"./chunk-ba88n1j7.js";import"./chunk-g1r4v0mc.js";import"./chunk-xd4zvm4x.js";import"./chunk-e6y6s7q8.js";export{jd as __setSignalsGeneratorsForTest,Ne as cacheEngineFingerprint,rn as cacheTemplate,nn as checkCache,zd as clearDevCaches,ac as getCachedRouterScript,ic as getCachedSignalsRuntime,Bd as getServeClientAsset,Ko as getServeModuleBundle,zn as hashFilePath,Nd as invalidateFileCache,Ld as invalidateFileCacheByDir,Md as readFileCached,Fd as registerServeModuleBundle,oc as templateCache};
2
+ import{Ne,oc,Md,Nd,Ld,jd,ic,ac,Bd,Fd,Ko,zd,nn,rn,zn}from"./chunk-yd62qhpz.js";import"./chunk-a3zn6rc9.js";import"./chunk-c57j92td.js";import"./chunk-kp4mzspk.js";import"./chunk-02m9mhkd.js";import"./chunk-6k4f583z.js";import"./chunk-wxgs36py.js";import"./chunk-8wrxmtce.js";import"./chunk-jtaqygzg.js";import"./chunk-ba88n1j7.js";import"./chunk-yxdyh23k.js";import"./chunk-1aw9qbdf.js";import"./chunk-e6y6s7q8.js";export{jd as __setSignalsGeneratorsForTest,Ne as cacheEngineFingerprint,rn as cacheTemplate,nn as checkCache,zd as clearDevCaches,ac as getCachedRouterScript,ic as getCachedSignalsRuntime,Bd as getServeClientAsset,Ko as getServeModuleBundle,zn as hashFilePath,Nd as invalidateFileCache,Ld as invalidateFileCacheByDir,Md as readFileCached,Fd as registerServeModuleBundle,oc as templateCache};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Bn,Qa,Ad,ec,Pd,tc,Fn,b,St,ye,nc,es,rc,Id,q,sc,Dd,x,Od}from"./chunk-e07ptggk.js";import"./chunk-68tzytfz.js";import"./chunk-c57j92td.js";import"./chunk-kp4mzspk.js";import"./chunk-twqmyetp.js";import"./chunk-zz5b1g50.js";import"./chunk-5tbqdz94.js";import"./chunk-9p3rtfbv.js";import"./chunk-g495xx4v.js";import"./chunk-ba88n1j7.js";import"./chunk-g1r4v0mc.js";import"./chunk-xd4zvm4x.js";import"./chunk-e6y6s7q8.js";export{sc as applyFilters,Pd as clearCustomFilters,nc as clientLoopScopes,Bn as defaultFilters,b as escapeHtml,St as escapeHtmlValue,x as evaluateExpression,tc as findMustacheEnd,ec as getAllFilters,rc as interpolateScriptAttributes,es as interpolateScriptExpressions,Id as interpolateScriptsInTemplate,q as processExpressions,Qa as registerFilter,Ad as registerFilters,Fn as replaceInterpolations,Dd as resetRejectedExpressionWarnings,Od as unescapeHtml,ye as usesSignalsInScript};
2
+ import{Bn,Qa,Ad,ec,Pd,tc,Fn,b,St,ye,nc,es,rc,Id,q,sc,Dd,x,Od}from"./chunk-yd62qhpz.js";import"./chunk-a3zn6rc9.js";import"./chunk-c57j92td.js";import"./chunk-kp4mzspk.js";import"./chunk-02m9mhkd.js";import"./chunk-6k4f583z.js";import"./chunk-wxgs36py.js";import"./chunk-8wrxmtce.js";import"./chunk-jtaqygzg.js";import"./chunk-ba88n1j7.js";import"./chunk-yxdyh23k.js";import"./chunk-1aw9qbdf.js";import"./chunk-e6y6s7q8.js";export{sc as applyFilters,Pd as clearCustomFilters,nc as clientLoopScopes,Bn as defaultFilters,b as escapeHtml,St as escapeHtmlValue,x as evaluateExpression,tc as findMustacheEnd,ec as getAllFilters,rc as interpolateScriptAttributes,es as interpolateScriptExpressions,Id as interpolateScriptsInTemplate,q as processExpressions,Qa as registerFilter,Ad as registerFilters,Fn as replaceInterpolations,Dd as resetRejectedExpressionWarnings,Od as unescapeHtml,ye as usesSignalsInScript};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{dn,Cs}from"./chunk-twqmyetp.js";import"./chunk-zz5b1g50.js";export{Cs as generateRuntimeConfigTypes,dn as prepareRuntimeConfig};
2
+ import{dn,Cs}from"./chunk-02m9mhkd.js";import"./chunk-6k4f583z.js";export{Cs as generateRuntimeConfigTypes,dn as prepareRuntimeConfig};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Kd,mc,cs,ls,si,oi,ds,us,qn,hc,ii,ai,yc,Ve}from"./chunk-e07ptggk.js";import"./chunk-68tzytfz.js";import"./chunk-c57j92td.js";import"./chunk-kp4mzspk.js";import"./chunk-twqmyetp.js";import"./chunk-zz5b1g50.js";import"./chunk-5tbqdz94.js";import"./chunk-9p3rtfbv.js";import"./chunk-g495xx4v.js";import"./chunk-ba88n1j7.js";import"./chunk-g1r4v0mc.js";import"./chunk-xd4zvm4x.js";import"./chunk-e6y6s7q8.js";export{Kd as clearScriptScanCache,ds as convertServerLoopAttributesToDirectives,si as convertSignalDirectivesToAttributes,us as convertSignalLoopsToAttributes,hc as extractExports,ai as findMarkupIndexOutsideScripts,ls as hasSignalsSyntax,cs as parseLoopExpression,oi as preEvalLiteralReactiveIfs,qn as processScriptSetup,ii as processSignals,yc as rewriteStxImportSpecifiers,mc as scanScriptTags,Ve as stripStxRuntimeImports};
2
+ import{Kd,mc,cs,ls,si,oi,ds,us,qn,hc,ii,ai,yc,Ve}from"./chunk-yd62qhpz.js";import"./chunk-a3zn6rc9.js";import"./chunk-c57j92td.js";import"./chunk-kp4mzspk.js";import"./chunk-02m9mhkd.js";import"./chunk-6k4f583z.js";import"./chunk-wxgs36py.js";import"./chunk-8wrxmtce.js";import"./chunk-jtaqygzg.js";import"./chunk-ba88n1j7.js";import"./chunk-yxdyh23k.js";import"./chunk-1aw9qbdf.js";import"./chunk-e6y6s7q8.js";export{Kd as clearScriptScanCache,ds as convertServerLoopAttributesToDirectives,si as convertSignalDirectivesToAttributes,us as convertSignalLoopsToAttributes,hc as extractExports,ai as findMarkupIndexOutsideScripts,ls as hasSignalsSyntax,cs as parseLoopExpression,oi as preEvalLiteralReactiveIfs,qn as processScriptSetup,ii as processSignals,yc as rewriteStxImportSpecifiers,mc as scanScriptTags,Ve as stripStxRuntimeImports};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Io}from"./chunk-2j1q5te2.js";import{d}from"./chunk-yn2d8x8m.js";var vd=`
2
+ import{Io}from"./chunk-4vc67zkb.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 re}from"child_process";import{tmpdir as M,homedir as q,platform as ae}from"os";var wd=`
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: ${r},`).replace("timeout: 30000",`timeout: ${a}`)}function wd(){return!1}function xd(e,r={}){let a=/@craft(?:\(([\s\S]*?)\))?/g;return e.replace(a,(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 ko(t)})}function Co(e,r={}){if(e.includes("__craftBridgeInitialized"))return e;let a=ko(r);if(e.includes("</head>"))return e.replace("</head>",`${a}
934
+ `.replace("debug: false,",`debug: ${r},`).replace("timeout: 30000",`timeout: ${a}`)}function vd(){return!1}function xd(e,r={}){let a=/@craft(?:\(([\s\S]*?)\))?/g;return e.replace(a,(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 ko(t)})}function Co(e,r={}){if(e.includes("__craftBridgeInitialized"))return e;let a=ko(r);if(e.includes("</head>"))return e.replace("</head>",`${a}
935
935
  </head>`);if(e.includes("<body"))return e.replace(/(<body[^>]*>)/,`$1
936
936
  ${a}`);return a+e}var zr={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,r)=>{let a=e.checked?"checked":"",i=e.disabled?"disabled":"";return`<label class="craft-checkbox-wrapper">
937
937
  <input type="checkbox" class="craft-checkbox" ${a} ${i}>
@@ -2955,7 +2955,7 @@ ${a}`);return a+e}var zr={button:{nativeType:"craft-button",fallbackTag:"button"
2955
2955
  ${e.icon?`<span class="craft-sidebar-item-icon" data-icon="${h(e.icon)}"${a}></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 K(e){let r=5381;for(let a=0;a<e.length;a++)r=r*33^e.charCodeAt(a);return(r>>>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,r,a){let i=[];i.push(`class="${a.join(" ")}"`),i.push(`data-craft="${r.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 kd(e,r){zr[e]=r}function Cd(){return{...zr}}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 re}from"child_process";import{tmpdir as M,homedir as q,platform as ae}from"os";async function To(e){let r=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 a=e.target||P(),i=e.format||ue(a),s=e.output||o(process.cwd(),"dist","native");if(!z(s))v(s,{recursive:!0});let t=await Io(e.input,{context:e.context,options:{isDev:!1}});if(t=Co(t,{debug:e.verbose}),t=$o(t),!t.includes("craft-component-styles")){if(t.includes("</head>"))t=t.replace("</head>",`${Eo}
2958
+ </button>`}function I(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function K(e){let r=5381;for(let a=0;a<e.length;a++)r=r*33^e.charCodeAt(a);return(r>>>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,r,a){let i=[];i.push(`class="${a.join(" ")}"`),i.push(`data-craft="${r.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 kd(e,r){zr[e]=r}function Cd(){return{...zr}}async function _o(e){let r=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 a=e.target||P(),i=e.format||ue(a),s=e.output||o(process.cwd(),"dist","native");if(!z(s))v(s,{recursive:!0});let t=await Io(e.input,{context:e.context,options:{isDev:!1}});if(t=Co(t,{debug:e.verbose}),t=$o(t),!t.includes("craft-component-styles")){if(t.includes("</head>"))t=t.replace("</head>",`${Eo}
2959
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:a,format:i,error:"Craft binary not found. Please install Craft or specify craftPath."};if(e.verbose)console.log(`\uD83D\uDCE6 Building native app for ${a}...`),console.log(` Input: ${e.input}`),console.log(` Output: ${s}`),console.log(` Craft: ${l}`);let f;switch(a){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:a,format:i,error:`Unsupported target: ${a}`}}return f.duration=Date.now()-r,f}catch(a){return{success:!1,target:e.target||P(),format:e.format||"app",error:a.message,duration:Date.now()-r}}}async function ie(e,r,a,i,s,t,n){let c=t.bundleId||`com.stx.${r.toLowerCase().replace(/[^a-z0-9]/g,"")}`,l=o(i,`${r}.app`),f=o(l,"Contents"),p=o(f,"MacOS"),u=o(f,"Resources");v(p,{recursive:!0}),v(u,{recursive:!0});let x=o(u,"index.html");await Bun.write(x,e);let b="";if(t.sidebar?.enabled&&t.sidebar?.config)b=o(u,"sidebar-config.json"),await Bun.write(b,JSON.stringify(t.sidebar.config));let g=t.sidebar?.enabled?`--native-sidebar --sidebar-width ${t.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",m=t.menubarOnly??t.systemTray;if((t.bundleStyle||(await se(n)?"executable":"launcher"))==="executable"){let S=o(p,r);k(n,S),T(S,493);let w={html:"index.html",title:t.window?.title||r,width:t.window?.width||1200,height:t.window?.height||800,devTools:Boolean(t.devTools)};if(m)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(u,"craft.json"),`${JSON.stringify(w,null,2)}
2960
2960
  `)}else{let S=o(p,"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")"`:"",U=`#!/bin/bash
2961
2961
  set -euo pipefail
@@ -3018,5 +3018,5 @@ Exec=${a.toLowerCase()}
3018
3018
  Terminal=false
3019
3019
  Categories=Utility;
3020
3020
  Icon=${a.toLowerCase()}
3021
- `;d("fs").writeFileSync(o(n,`${a.toLowerCase()}.desktop`),b);let g=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,`${a.toLowerCase()}.png`),g),i.icon&&z(i.icon))k(i.icon,o(n,`${a.toLowerCase()}.png`));let m=E("appimagetool",[n,r],{env:{...process.env,ARCH:"x86_64"}});m.on("close",(y)=>{if(d("fs").rmSync(t,{recursive:!0,force:!0}),y===0)T(r,493),s({success:!0});else s({success:!1,error:`appimagetool exited with code ${y}. Install from https://appimage.github.io/appimagetool/`})}),m.on("error",(y)=>{d("fs").rmSync(t,{recursive:!0,force:!0}),s({success:!1,error:`appimagetool not found: ${y.message}`})})}catch(t){s({success:!1,error:t.message})}})}function _o(){return[P()]}function Ro(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:To,getAvailableTargets:_o,getAvailableFormats:Ro,detectPlatform:P},Ed=he;
3022
- export{vd,ko,wd,xd,Co,zr,Eo,Sd,$o,kd,Cd,To,_o,Ro,Ed};
3021
+ `;d("fs").writeFileSync(o(n,`${a.toLowerCase()}.desktop`),b);let g=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,`${a.toLowerCase()}.png`),g),i.icon&&z(i.icon))k(i.icon,o(n,`${a.toLowerCase()}.png`));let m=E("appimagetool",[n,r],{env:{...process.env,ARCH:"x86_64"}});m.on("close",(y)=>{if(d("fs").rmSync(t,{recursive:!0,force:!0}),y===0)T(r,493),s({success:!0});else s({success:!1,error:`appimagetool exited with code ${y}. Install from https://appimage.github.io/appimagetool/`})}),m.on("error",(y)=>{d("fs").rmSync(t,{recursive:!0,force:!0}),s({success:!1,error:`appimagetool not found: ${y.message}`})})}catch(t){s({success:!1,error:t.message})}})}function To(){return[P()]}function Ro(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:_o,getAvailableTargets:To,getAvailableFormats:Ro,detectPlatform:P},Ed=he;
3022
+ export{wd,ko,vd,xd,Co,zr,Eo,Sd,$o,kd,Cd,_o,To,Ro,Ed};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{R,Nc,o,A,Yd,Zd}from"./chunk-yd62qhpz.js";import"./chunk-a3zn6rc9.js";import"./chunk-c57j92td.js";import"./chunk-kp4mzspk.js";import"./chunk-02m9mhkd.js";import"./chunk-6k4f583z.js";import"./chunk-wxgs36py.js";import"./chunk-8wrxmtce.js";import"./chunk-jtaqygzg.js";import"./chunk-ba88n1j7.js";import"./chunk-yxdyh23k.js";import"./chunk-1aw9qbdf.js";import"./chunk-e6y6s7q8.js";export{A as config,R as defaultConfig,Yd as defineStxConfig,o as loadStxConfig,Nc as resolveStxDirectories,Zd as validateConfig};