@stacksjs/stx 0.2.653 → 0.2.655

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 (79) hide show
  1. package/dist/{chunk-z1verv61.js → chunk-00m5t5kj.js} +1 -1
  2. package/dist/chunk-02qt18vt.js +2 -0
  3. package/dist/{chunk-bcak75rd.js → chunk-049nrn61.js} +1 -1
  4. package/dist/chunk-0bc2f2qb.js +2 -0
  5. package/dist/{chunk-yvns10k8.js → chunk-0mr9wx5c.js} +1 -1
  6. package/dist/chunk-20mme81e.js +2 -0
  7. package/dist/{chunk-p4n5h44f.js → chunk-3ewa10ak.js} +1 -1
  8. package/dist/{chunk-9f1d2x97.js → chunk-3gaggdvz.js} +5 -5
  9. package/dist/chunk-3qe83ymq.js +2 -0
  10. package/dist/{chunk-c3p6bnz2.js → chunk-42hjga3m.js} +2 -2
  11. package/dist/chunk-49n9hrb1.js +2 -0
  12. package/dist/{chunk-hezw1xmp.js → chunk-4gge63vp.js} +1 -1
  13. package/dist/{chunk-y0r3egr3.js → chunk-4t0nz925.js} +1 -1
  14. package/dist/{chunk-aw7a82fp.js → chunk-5c14xpmg.js} +1 -1
  15. package/dist/{chunk-83p6yy52.js → chunk-6bn5t1cc.js} +1 -1
  16. package/dist/{chunk-035g7w2k.js → chunk-86phdm37.js} +2 -2
  17. package/dist/{chunk-pkftgt3b.js → chunk-8bad437f.js} +32 -32
  18. package/dist/{chunk-ycqnhnkr.js → chunk-8ftpzhx4.js} +3 -3
  19. package/dist/{chunk-anpp7jqf.js → chunk-ajgxj2t9.js} +2 -2
  20. package/dist/{chunk-r13q4a4w.js → chunk-bzpf3qtz.js} +1 -1
  21. package/dist/{chunk-qvvb6v7r.js → chunk-cah391jn.js} +1 -1
  22. package/dist/{chunk-7ct5a6e5.js → chunk-d0nsehz6.js} +1 -1
  23. package/dist/{chunk-kqnsytx3.js → chunk-dpz9tx1f.js} +1 -1
  24. package/dist/{chunk-hygs8atq.js → chunk-dwe2dedz.js} +1 -1
  25. package/dist/chunk-evqwz50x.js +2 -0
  26. package/dist/{chunk-60ntv8n1.js → chunk-eyrkpf0q.js} +5 -5
  27. package/dist/{chunk-3dms896y.js → chunk-ez2kr2k1.js} +1 -1
  28. package/dist/{chunk-e9k6gn09.js → chunk-fn6x5b29.js} +1 -1
  29. package/dist/{chunk-90w45mx5.js → chunk-fw8mf9xd.js} +1 -1
  30. package/dist/{chunk-vre4g5yb.js → chunk-g3xcyqb8.js} +1 -1
  31. package/dist/{chunk-5e2pnqyr.js → chunk-hg4y1p7w.js} +1 -1
  32. package/dist/{chunk-gvk4rrc5.js → chunk-hyd0s2ew.js} +2 -2
  33. package/dist/{chunk-g778htym.js → chunk-j6f9ffmc.js} +1 -1
  34. package/dist/{chunk-4gxfhtxr.js → chunk-jc64acnb.js} +1 -1
  35. package/dist/chunk-js23p89e.js +2 -0
  36. package/dist/{chunk-77vp2r7q.js → chunk-jw0q2f5e.js} +4 -4
  37. package/dist/{chunk-646x47qt.js → chunk-jzejh7ch.js} +1 -1
  38. package/dist/{chunk-shtcpfe6.js → chunk-k6jq6a19.js} +1 -1
  39. package/dist/{chunk-sb8nvdwt.js → chunk-kgbf3z87.js} +2 -2
  40. package/dist/{chunk-j5nh5jkp.js → chunk-ktk8zm60.js} +1 -1
  41. package/dist/{chunk-wxvpfzbe.js → chunk-m2vpa496.js} +1 -1
  42. package/dist/{chunk-xrn7fzbm.js → chunk-m6tqbxjx.js} +1 -1
  43. package/dist/{chunk-57ja31kj.js → chunk-n5xp0sad.js} +1 -1
  44. package/dist/{chunk-0pkvaj4d.js → chunk-nfafd1zr.js} +4 -4
  45. package/dist/{chunk-fd5px33r.js → chunk-njmdbz8t.js} +1 -1
  46. package/dist/{chunk-7v9hxyqx.js → chunk-nsxecff6.js} +1 -1
  47. package/dist/{chunk-nw4vztfq.js → chunk-pb5k6sbj.js} +1 -1
  48. package/dist/{chunk-rhejgcfj.js → chunk-pc74fca2.js} +1 -1
  49. package/dist/{chunk-90937tdt.js → chunk-qmvwc88h.js} +1 -1
  50. package/dist/chunk-qszk2tcw.js +2 -0
  51. package/dist/{chunk-wgddpw30.js → chunk-r95kmjj1.js} +1 -1
  52. package/dist/{chunk-0vfbcad6.js → chunk-ra1kfa6e.js} +1 -1
  53. package/dist/{chunk-mhhhhq5m.js → chunk-sfn7f9dm.js} +1 -1
  54. package/dist/{chunk-kz2exzj0.js → chunk-sj0rrn72.js} +1 -1
  55. package/dist/{chunk-fx6fvgh7.js → chunk-tdnp94kz.js} +2 -2
  56. package/dist/chunk-vstv3ncc.js +2 -0
  57. package/dist/{chunk-mcqvhfks.js → chunk-wv541wm9.js} +1 -1
  58. package/dist/chunk-x5v00zg4.js +2 -0
  59. package/dist/{chunk-2dm6ey5w.js → chunk-y4nhcrf1.js} +6 -6
  60. package/dist/{chunk-kw680rcy.js → chunk-yr9shdxa.js} +1 -1
  61. package/dist/{chunk-xagtm6pe.js → chunk-z7s1aqyn.js} +1 -1
  62. package/dist/cli.js +7 -7
  63. package/dist/craft-entry.js +1 -1
  64. package/dist/craft.js +1 -1
  65. package/dist/native-signing.d.ts +2 -0
  66. package/dist/native-signing.js +13 -4
  67. package/dist/pwa.js +1 -1
  68. package/dist/ssg.js +2 -2
  69. package/package.json +5 -5
  70. package/dist/chunk-14dpfzts.js +0 -2
  71. package/dist/chunk-3075268c.js +0 -2
  72. package/dist/chunk-33w449cn.js +0 -2
  73. package/dist/chunk-57rmkmbs.js +0 -2
  74. package/dist/chunk-ezez5jmd.js +0 -2
  75. package/dist/chunk-nfwy33s2.js +0 -2
  76. package/dist/chunk-qa2cyrbt.js +0 -2
  77. package/dist/chunk-qs1t1362.js +0 -2
  78. package/dist/chunk-x5hrbc9b.js +0 -2
  79. package/dist/chunk-z8nnsb11.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{He,Q}from"./chunk-c1dkh0es.js";import{Ki}from"./chunk-c3p6bnz2.js";import{p}from"./chunk-2a4szpje.js";import{existsSync as N,mkdirSync as x,copyFileSync as k,chmodSync as T,rmSync as fe}from"fs";import{join as o,basename as pe,resolve as j}from"path";import{spawn as A}from"child_process";import{platform as ue}from"os";var Xd=`
2
+ import{He,Q}from"./chunk-c1dkh0es.js";import{Ki}from"./chunk-42hjga3m.js";import{p}from"./chunk-2a4szpje.js";import{existsSync as N,mkdirSync as v,copyFileSync as k,chmodSync as T,rmSync as pe}from"fs";import{join as o,basename as ue,resolve as j}from"path";import{spawn as A}from"child_process";import{platform as be}from"os";var Xd=`
3
3
  <script>
4
4
  (function() {
5
5
  'use strict';
@@ -2940,43 +2940,43 @@ ${a}`);return a+e}var Us={button:{nativeType:"craft-button",fallbackTag:"button"
2940
2940
  document.addEventListener('craft:nativeui:ready', initializeCraftComponents);
2941
2941
  })();
2942
2942
  </script>
2943
- `;return e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(i,n,t)=>E("sidebar",n,t.trim(),r,a)),e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(i,n)=>E("sidebar",n,"",r,a)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(i,n,t)=>E(n,t,"",r,a)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(i,n,t,s)=>E(n,t,s.trim(),r,a)),e}function E(e,r,a,i,n){let t=i.components?.[e]||Us[e];if(!t)return console.warn(`[stx] Unknown Craft component: @craft-${e}`),`<div class="${n}-unknown" data-component="${e}">${a}</div>`;let s=O(r),c=[t.fallbackClasses||`${n}-${e}`];if(s.class)c.push(s.class),delete s.class;if(t.render)return s.__fallbackClasses=c.join(" "),t.render(s,a);let d=ne(s,t,c);if(["input","hr","br","img"].includes(t.fallbackTag))return`<${t.fallbackTag} ${d}>`;return`<${t.fallbackTag} ${d}>${a}</${t.fallbackTag}>`}function O(e){let r={},a=/(?::|@)?(\w+[-\w]*)(?:=(?:"([^"]*)"|'([^']*)'))?/g,i;while((i=a.exec(e))!==null){let[n,t,s,c]=i,d=s??c;if(n.startsWith(":"))r[t]=d;else if(n.startsWith("@"))r[`on${t.charAt(0).toUpperCase()}${t.slice(1)}`]=d;else if(d===void 0)r[t]=!0;else r[t]=d}return r}function J(e,r){let a=P(String(e.id||`craft-sidebar-${ae(r||JSON.stringify(e))}`)),i=ee(e.spaces)||Z(r),n=i.length?[]:re(e.sections)||_(r),t=String(e.selectedSpace||i[0]?.id||""),s=i.find((w)=>w.id===t)||i[0],c=String(e.selectedItem||e.selected||(i.length?s?.sections[0]?.items[0]?.id:n[0]?.items[0]?.id)||""),d={id:a,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:n,spaces:i,selectedSpace:t||void 0},l=String(e.__fallbackClasses||"craft-sidebar craft-sidebar-tahoe"),u=Number(e.width||e.sidebarWidth||286),f=e.native===!1||e.native==="false"?"false":"true",g=d.searchPlaceholder?`<div class="craft-sidebar-search"><input type="search" placeholder="${S(d.searchPlaceholder)}"></div>`:"",b;if(i.length)b=te(i,t,c);else if(n.length)b=n.map((w)=>z(w,c)).join("");else b=r;return`<aside class="${v(l)}" data-craft="craft-sidebar" data-craft-native-sidebar data-craft-sidebar-id="${v(a)}" data-native="${f}" style="--craft-sidebar-width:${u}px">
2944
- ${g}
2943
+ `;return e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(i,n,t)=>E("sidebar",n,t.trim(),r,a)),e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(i,n)=>E("sidebar",n,"",r,a)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(i,n,t)=>E(n,t,"",r,a)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(i,n,t,s)=>E(n,t,s.trim(),r,a)),e}function E(e,r,a,i,n){let t=i.components?.[e]||Us[e];if(!t)return console.warn(`[stx] Unknown Craft component: @craft-${e}`),`<div class="${n}-unknown" data-component="${e}">${a}</div>`;let s=O(r),c=[t.fallbackClasses||`${n}-${e}`];if(s.class)c.push(s.class),delete s.class;if(t.render)return s.__fallbackClasses=c.join(" "),t.render(s,a);let d=ne(s,t,c);if(["input","hr","br","img"].includes(t.fallbackTag))return`<${t.fallbackTag} ${d}>`;return`<${t.fallbackTag} ${d}>${a}</${t.fallbackTag}>`}function O(e){let r={},a=/(?::|@)?(\w+[-\w]*)(?:=(?:"([^"]*)"|'([^']*)'))?/g,i;while((i=a.exec(e))!==null){let[n,t,s,c]=i,d=s??c;if(n.startsWith(":"))r[t]=d;else if(n.startsWith("@"))r[`on${t.charAt(0).toUpperCase()}${t.slice(1)}`]=d;else if(d===void 0)r[t]=!0;else r[t]=d}return r}function J(e,r){let a=P(String(e.id||`craft-sidebar-${ae(r||JSON.stringify(e))}`)),i=ee(e.spaces)||Z(r),n=i.length?[]:re(e.sections)||_(r),t=String(e.selectedSpace||i[0]?.id||""),s=i.find((h)=>h.id===t)||i[0],c=String(e.selectedItem||e.selected||(i.length?s?.sections[0]?.items[0]?.id:n[0]?.items[0]?.id)||""),d={id:a,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:n,spaces:i,selectedSpace:t||void 0},l=String(e.__fallbackClasses||"craft-sidebar craft-sidebar-tahoe"),u=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>`:"",b;if(i.length)b=te(i,t,c);else if(n.length)b=n.map((h)=>z(h,c)).join("");else b=r;return`<aside class="${w(l)}" data-craft="craft-sidebar" data-craft-native-sidebar data-craft-sidebar-id="${w(a)}" data-native="${f}" style="--craft-sidebar-width:${u}px">
2944
+ ${x}
2945
2945
  ${b}
2946
2946
  </aside>
2947
- <script type="application/json" data-craft-sidebar-config="${v(a)}">${ie(d)}</script>`}function Y(e,r){let a=P(String(e.id||e.label||"space"));return`<section class="craft-sidebar-space" data-craft="craft-sidebar-space" data-space-id="${v(a)}">
2948
- ${e.label?`<div class="craft-sidebar-space-title">${S(String(e.label))}</div>`:""}
2947
+ <script type="application/json" data-craft-sidebar-config="${w(a)}">${ie(d)}</script>`}function Y(e,r){let a=P(String(e.id||e.label||"space"));return`<section class="craft-sidebar-space" data-craft="craft-sidebar-space" data-space-id="${w(a)}">
2948
+ ${e.label?`<div class="craft-sidebar-space-title">${C(String(e.label))}</div>`:""}
2949
2949
  ${r}
2950
- </section>`}function G(e,r){let a=String(e.header||e.title||"");return`<section class="craft-sidebar-section" data-craft="craft-sidebar-section" data-section-id="${v(String(e.id||"section"))}">
2951
- ${a?`<div class="craft-sidebar-section-title">${S(a)}</div>`:""}
2950
+ </section>`}function G(e,r){let a=String(e.header||e.title||"");return`<section class="craft-sidebar-section" data-craft="craft-sidebar-section" data-section-id="${w(String(e.id||"section"))}">
2951
+ ${a?`<div class="craft-sidebar-section-title">${C(a)}</div>`:""}
2952
2952
  ${r}
2953
- </section>`}function X(e,r){let a={id:String(e.id||P(String(e.label||r||"item"))),label:String(e.label||r||""),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 M(a,String(e.selected||"")==="true")}function _(e){let r=[],a=/<@craft-sidebar-section\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-section>)/g,i;while((i=a.exec(e))!==null){let n=O(i[1]||""),t=i[2]||"",s=String(n.id||P(String(n.header||n.title||`section-${r.length+1}`))),c=String(n.header||n.title||s),d=K(t);r.push({id:s,header:c,title:c,items:d})}return r}function K(e){let r=[],a=/<@craft-sidebar-item\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-item>)/g,i;while((i=a.exec(e))!==null){let n=O(i[1]||""),t=String(n.label||(i[2]||"").replace(/<[^>]*>/g,"").trim()),s=String(n.id||P(t||`item-${r.length+1}`));r.push({id:s,label:t,icon:n.icon?String(n.icon):void 0,badge:n.badge?String(n.badge):void 0,tintColor:n.tintColor?String(n.tintColor):void 0})}return r}function Z(e){let r=[],a=/<@craft-sidebar-space\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-space>)/g,i;while((i=a.exec(e))!==null){let n=O(i[1]||""),t=i[2]||"",s=String(n.label||n.title||`Space ${r.length+1}`);r.push({id:String(n.id||P(s)),label:s,icon:n.icon?String(n.icon):void 0,tint:n.tint?String(n.tint):void 0,sections:_(t)})}return r}function ee(e){if(!e)return;if(Array.isArray(e))return e;if(typeof e!=="string")return;try{let r=JSON.parse(e);return Array.isArray(r)?r:void 0}catch{return}}function te(e,r,a){let i=e.map((t)=>`<button class="craft-sidebar-space-tab" type="button" data-space-target="${v(t.id)}" data-selected="${t.id===r?"true":"false"}" title="${v(t.label||t.id)}">${t.icon?`<span class="craft-sidebar-item-icon" data-icon="${v(t.icon)}"></span>`:S((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="${v(t.id)}" data-selected="${t.id===r?"true":"false"}">
2954
- ${t.label?`<div class="craft-sidebar-space-title">${S(t.label)}</div>`:""}
2953
+ </section>`}function X(e,r){let a={id:String(e.id||P(String(e.label||r||"item"))),label:String(e.label||r||""),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 M(a,String(e.selected||"")==="true")}function _(e){let r=[],a=/<@craft-sidebar-section\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-section>)/g,i;while((i=a.exec(e))!==null){let n=O(i[1]||""),t=i[2]||"",s=String(n.id||P(String(n.header||n.title||`section-${r.length+1}`))),c=String(n.header||n.title||s),d=K(t);r.push({id:s,header:c,title:c,items:d})}return r}function K(e){let r=[],a=/<@craft-sidebar-item\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-item>)/g,i;while((i=a.exec(e))!==null){let n=O(i[1]||""),t=String(n.label||(i[2]||"").replace(/<[^>]*>/g,"").trim()),s=String(n.id||P(t||`item-${r.length+1}`));r.push({id:s,label:t,icon:n.icon?String(n.icon):void 0,badge:n.badge?String(n.badge):void 0,tintColor:n.tintColor?String(n.tintColor):void 0})}return r}function Z(e){let r=[],a=/<@craft-sidebar-space\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-space>)/g,i;while((i=a.exec(e))!==null){let n=O(i[1]||""),t=i[2]||"",s=String(n.label||n.title||`Space ${r.length+1}`);r.push({id:String(n.id||P(s)),label:s,icon:n.icon?String(n.icon):void 0,tint:n.tint?String(n.tint):void 0,sections:_(t)})}return r}function ee(e){if(!e)return;if(Array.isArray(e))return e;if(typeof e!=="string")return;try{let r=JSON.parse(e);return Array.isArray(r)?r:void 0}catch{return}}function te(e,r,a){let i=e.map((t)=>`<button class="craft-sidebar-space-tab" type="button" data-space-target="${w(t.id)}" data-selected="${t.id===r?"true":"false"}" title="${w(t.label||t.id)}">${t.icon?`<span class="craft-sidebar-item-icon" data-icon="${w(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="${w(t.id)}" data-selected="${t.id===r?"true":"false"}">
2954
+ ${t.label?`<div class="craft-sidebar-space-title">${C(t.label)}</div>`:""}
2955
2955
  ${t.sections.map((s)=>z(s,a)).join("")}
2956
2956
  </section>`).join("")}</div>
2957
- <div class="craft-sidebar-space-switcher">${i}</div>`}function re(e){if(!e)return;if(Array.isArray(e))return e;if(typeof e!=="string")return;try{let r=JSON.parse(e);return Array.isArray(r)?r:void 0}catch{return}}function z(e,r){let a=e.header||e.title||e.id;return`<section class="craft-sidebar-section" data-section-id="${v(e.id)}">
2958
- <div class="craft-sidebar-section-title">${S(a)}</div>
2957
+ <div class="craft-sidebar-space-switcher">${i}</div>`}function re(e){if(!e)return;if(Array.isArray(e))return e;if(typeof e!=="string")return;try{let r=JSON.parse(e);return Array.isArray(r)?r:void 0}catch{return}}function z(e,r){let a=e.header||e.title||e.id;return`<section class="craft-sidebar-section" data-section-id="${w(e.id)}">
2958
+ <div class="craft-sidebar-section-title">${C(a)}</div>
2959
2959
  ${e.items.map((i)=>M(i,i.id===r)).join("")}
2960
- </section>`}function M(e,r){let a=e.tintColor?` style="--craft-sidebar-icon-color:${v(e.tintColor)}"`:"";return`<button class="craft-sidebar-item" type="button" data-item-id="${v(e.id)}" data-selected="${r?"true":"false"}">
2961
- ${e.icon?`<span class="craft-sidebar-item-icon" data-icon="${v(e.icon)}"${a}></span>`:""}
2962
- <span class="craft-sidebar-item-label">${S(e.label)}</span>
2963
- ${e.badge?`<span class="craft-sidebar-item-badge">${S(e.badge)}</span>`:""}
2964
- </button>`}function P(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function ae(e){let r=5381;for(let a=0;a<e.length;a++)r=r*33^e.charCodeAt(a);return(r>>>0).toString(36)}function S(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function v(e){return S(e).replace(/`/g,"&#96;")}function ie(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function ne(e,r,a){let i=[];i.push(`class="${a.join(" ")}"`),i.push(`data-craft="${r.nativeType}"`);for(let[n,t]of Object.entries(e))if(t===!0)i.push(n);else if(t!==!1&&t!==void 0&&t!==null){let s=String(t).replace(/"/g,"&quot;");i.push(`${n}="${s}"`)}return i.join(" ")}function Qd(e,r){Us[e]=r}function ep(){return{...Us}}import{copyFileSync as se,mkdtempSync as oe,rmSync as ce,writeFileSync as de}from"fs";import{tmpdir as le}from"os";import{join as q}from"path";async function U(e,r=[],a={}){if(process.platform!=="darwin")return;let i=a.entitlements,n;try{if(a.provisioningProfile){if(!a.identity||a.identity==="-")throw Error("A provisioning profile requires a signing identity.");let d=Bun.spawnSync(["/usr/bin/security","cms","-D","-i",a.provisioningProfile]);if(d.exitCode!==0)throw Error("Could not decode the macOS provisioning profile.");let l=Bun.spawnSync(["/usr/bin/plutil","-extract","Entitlements","json","-o","-","-"],{stdin:d.stdout});if(l.exitCode!==0)throw Error("The macOS profile has no entitlement dictionary.");let u=JSON.parse(l.stdout.toString()),f={};if(a.entitlements){let g=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-",a.entitlements]);if(g.exitCode!==0)throw Error("Could not read the app entitlements plist.");f=JSON.parse(g.stdout.toString())}for(let g of["com.apple.application-identifier","com.apple.developer.team-identifier"])if(u[g])f[g]=u[g];if(n=oe(q(le(),"stx-entitlements-")),i=q(n,"entitlements.plist"),de(i,JSON.stringify(f)),Bun.spawnSync(["/usr/bin/plutil","-convert","xml1",i]).exitCode!==0)throw Error("Could not generate the provisioned app entitlements.");se(a.provisioningProfile,q(e,"Contents","embedded.provisionprofile"))}for(let d of[...r,e]){let l=a.hardenedRuntime?["--options","runtime"]:[];if(d===e&&i)l.push("--entitlements",i);let u=a.identity&&a.identity!=="-"?"--timestamp":"--timestamp=none",f=Bun.spawn(["/usr/bin/codesign","--force","--sign",a.identity||"-",u,...l,d],{stdout:"pipe",stderr:"pipe"}),[g,b]=await Promise.all([new Response(f.stderr).text(),f.exited]);if(b!==0)throw Error(`Could not sign native bundle ${d}: ${g.trim()}`)}let t=Bun.spawn(["/usr/bin/codesign","--verify","--strict",e],{stdout:"pipe",stderr:"pipe"}),[s,c]=await Promise.all([new Response(t.stderr).text(),t.exited]);if(c!==0)throw Error(`Invalid native bundle signature: ${s.trim()}`)}finally{if(n)ce(n,{recursive:!0,force:!0})}}async function Hi(e){let r=Date.now();try{if(!await Bun.file(e.input).exists())return{success:!1,target:e.target||B(),format:e.format||"app",error:`Input file not found: ${e.input}`};let a=e.target||B(),i=e.format||Ce(a);if(e.backend&&a!=="macos")throw Error("Native backend bundles currently support macOS only.");if(e.backend&&!N(j(e.backend.entry)))throw Error(`Native backend not found: ${e.backend.entry}`);let n=e.output||o(process.cwd(),"dist","native");if(!N(n))x(n,{recursive:!0});let t=await Ki(e.input,{context:e.context,options:{isDev:!1}});if(t=Bi(t,{debug:e.verbose}),t=zi(t),!t.includes("craft-component-styles")){if(t.includes("</head>"))t=t.replace("</head>",`${Fi}
2965
- </head>`)}let s=e.name||pe(e.input,".stx"),c=e.version||"1.0.0",d=e.craftPath||await Vi();if(!d)return{success:!1,target:a,format:i,error:"Craft native binary not found on PATH. Run pantry install craft, or specify craftPath for framework development."};if(e.verbose)console.log(`\uD83D\uDCE6 Building native app for ${a}...`),console.log(` Input: ${e.input}`),console.log(` Output: ${n}`),console.log(` Craft: ${d}`);let l;switch(a){case"macos":l=await be(t,s,c,n,i,e,d);break;case"windows":l=await we(t,s,c,n,i,e,d);break;case"linux":l=await ve(t,s,c,n,i,e,d);break;case"ios":l=await xe(t,s,c,n,e,d);break;case"android":l=await ye(t,s,c,n,e,d);break;default:l={success:!1,target:a,format:i,error:`Unsupported target: ${a}`}}return l.duration=Date.now()-r,l}catch(a){return{success:!1,target:e.target||B(),format:e.format||"app",error:a.message,duration:Date.now()-r}}}async function be(e,r,a,i,n,t,s){let c=t.bundleId||`com.stx.${r.toLowerCase().replace(/[^a-z0-9]/g,"")}`,d=o(i,`${r}.app`),l=o(d,"Contents"),u=o(l,"MacOS"),f=o(l,"Resources");fe(d,{recursive:!0,force:!0}),x(u,{recursive:!0}),x(f,{recursive:!0});let g=o(f,"index.html");await Bun.write(g,e);let b="";if(t.sidebar?.enabled&&t.sidebar?.config)b=o(f,"sidebar-config.json"),await Bun.write(b,JSON.stringify(t.sidebar.config));let w=t.sidebar?.enabled?`--native-sidebar --sidebar-width ${t.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",C=t.menubarOnly??t.systemTray,m=t.bundleStyle||(await me(s)?"executable":"launcher");if(t.backend){if(!await ge(s))throw Error("This Craft runtime does not support bundled backends. Upgrade Craft before building this app.");k(s,o(u,r)),T(o(u,r),493);let y=He("native-backend");try{let h=o(y,"launcher.ts"),D=o(import.meta.dir,"native-backend"+(import.meta.path.endsWith(".ts")?".ts":".js"));await Bun.write(h,`import { runNativeBackend } from ${JSON.stringify(D)}
2960
+ </section>`}function M(e,r){let a=e.tintColor?` style="--craft-sidebar-icon-color:${w(e.tintColor)}"`:"";return`<button class="craft-sidebar-item" type="button" data-item-id="${w(e.id)}" data-selected="${r?"true":"false"}">
2961
+ ${e.icon?`<span class="craft-sidebar-item-icon" data-icon="${w(e.icon)}"${a}></span>`:""}
2962
+ <span class="craft-sidebar-item-label">${C(e.label)}</span>
2963
+ ${e.badge?`<span class="craft-sidebar-item-badge">${C(e.badge)}</span>`:""}
2964
+ </button>`}function P(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function ae(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 w(e){return C(e).replace(/`/g,"&#96;")}function ie(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function ne(e,r,a){let i=[];i.push(`class="${a.join(" ")}"`),i.push(`data-craft="${r.nativeType}"`);for(let[n,t]of Object.entries(e))if(t===!0)i.push(n);else if(t!==!1&&t!==void 0&&t!==null){let s=String(t).replace(/"/g,"&quot;");i.push(`${n}="${s}"`)}return i.join(" ")}function Qd(e,r){Us[e]=r}function ep(){return{...Us}}import{copyFileSync as se,mkdtempSync as oe,rmSync as ce,writeFileSync as de}from"fs";import{tmpdir as le}from"os";import{join as q}from"path";function fe(e){let r=Bun.spawnSync(["/usr/bin/plutil","-extract","Entitlements","xml1","-o","-","-"],{stdin:e});if(r.exitCode!==0)throw Error(`Could not extract the macOS profile entitlements: ${r.stderr.toString().trim()||r.stdout.toString().trim()}`);let a=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-","-"],{stdin:r.stdout});if(a.exitCode!==0)throw Error(`Could not convert the macOS profile entitlements: ${a.stderr.toString().trim()||a.stdout.toString().trim()}`);let i=JSON.parse(a.stdout.toString());if(!i||typeof i!=="object"||Array.isArray(i))throw Error("The macOS profile entitlements must be a dictionary.");return i}async function U(e,r=[],a={}){if(process.platform!=="darwin")return;let i=a.entitlements,n;try{if(a.provisioningProfile){if(!a.identity||a.identity==="-")throw Error("A provisioning profile requires a signing identity.");let d=Bun.spawnSync(["/usr/bin/security","cms","-D","-i",a.provisioningProfile]);if(d.exitCode!==0)throw Error("Could not decode the macOS provisioning profile.");let l=fe(d.stdout),u={};if(a.entitlements){let f=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-",a.entitlements]);if(f.exitCode!==0)throw Error("Could not read the app entitlements plist.");u=JSON.parse(f.stdout.toString())}for(let f of["com.apple.application-identifier","com.apple.developer.team-identifier"])if(l[f])u[f]=l[f];if(n=oe(q(le(),"stx-entitlements-")),i=q(n,"entitlements.plist"),de(i,JSON.stringify(u)),Bun.spawnSync(["/usr/bin/plutil","-convert","xml1",i]).exitCode!==0)throw Error("Could not generate the provisioned app entitlements.");se(a.provisioningProfile,q(e,"Contents","embedded.provisionprofile"))}for(let d of[...r,e]){let l=a.hardenedRuntime?["--options","runtime"]:[];if(d===e&&i)l.push("--entitlements",i);let u=a.identity&&a.identity!=="-"?"--timestamp":"--timestamp=none",f=Bun.spawn(["/usr/bin/codesign","--force","--sign",a.identity||"-",u,...l,d],{stdout:"pipe",stderr:"pipe"}),[x,b]=await Promise.all([new Response(f.stderr).text(),f.exited]);if(b!==0)throw Error(`Could not sign native bundle ${d}: ${x.trim()}`)}let t=Bun.spawn(["/usr/bin/codesign","--verify","--strict",e],{stdout:"pipe",stderr:"pipe"}),[s,c]=await Promise.all([new Response(t.stderr).text(),t.exited]);if(c!==0)throw Error(`Invalid native bundle signature: ${s.trim()}`)}finally{if(n)ce(n,{recursive:!0,force:!0})}}async function Hi(e){let r=Date.now();try{if(!await Bun.file(e.input).exists())return{success:!1,target:e.target||B(),format:e.format||"app",error:`Input file not found: ${e.input}`};let a=e.target||B(),i=e.format||Ce(a);if(e.backend&&a!=="macos")throw Error("Native backend bundles currently support macOS only.");if(e.backend&&!N(j(e.backend.entry)))throw Error(`Native backend not found: ${e.backend.entry}`);let n=e.output||o(process.cwd(),"dist","native");if(!N(n))v(n,{recursive:!0});let t=await Ki(e.input,{context:e.context,options:{isDev:!1}});if(t=Bi(t,{debug:e.verbose}),t=zi(t),!t.includes("craft-component-styles")){if(t.includes("</head>"))t=t.replace("</head>",`${Fi}
2965
+ </head>`)}let s=e.name||ue(e.input,".stx"),c=e.version||"1.0.0",d=e.craftPath||await Vi();if(!d)return{success:!1,target:a,format:i,error:"Craft native binary not found on PATH. Run pantry install craft, or specify craftPath for framework development."};if(e.verbose)console.log(`\uD83D\uDCE6 Building native app for ${a}...`),console.log(` Input: ${e.input}`),console.log(` Output: ${n}`),console.log(` Craft: ${d}`);let l;switch(a){case"macos":l=await ge(t,s,c,n,i,e,d);break;case"windows":l=await ve(t,s,c,n,i,e,d);break;case"linux":l=await xe(t,s,c,n,i,e,d);break;case"ios":l=await ye(t,s,c,n,e,d);break;case"android":l=await Se(t,s,c,n,e,d);break;default:l={success:!1,target:a,format:i,error:`Unsupported target: ${a}`}}return l.duration=Date.now()-r,l}catch(a){return{success:!1,target:e.target||B(),format:e.format||"app",error:a.message,duration:Date.now()-r}}}async function ge(e,r,a,i,n,t,s){let c=t.bundleId||`com.stx.${r.toLowerCase().replace(/[^a-z0-9]/g,"")}`,d=o(i,`${r}.app`),l=o(d,"Contents"),u=o(l,"MacOS"),f=o(l,"Resources");pe(d,{recursive:!0,force:!0}),v(u,{recursive:!0}),v(f,{recursive:!0});let x=o(f,"index.html");await Bun.write(x,e);let b="";if(t.sidebar?.enabled&&t.sidebar?.config)b=o(f,"sidebar-config.json"),await Bun.write(b,JSON.stringify(t.sidebar.config));let h=t.sidebar?.enabled?`--native-sidebar --sidebar-width ${t.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",S=t.menubarOnly??t.systemTray,g=t.bundleStyle||(await he(s)?"executable":"launcher");if(t.backend){if(!await me(s))throw Error("This Craft runtime does not support bundled backends. Upgrade Craft before building this app.");k(s,o(u,r)),T(o(u,r),493);let y=He("native-backend");try{let m=o(y,"launcher.ts"),D=o(import.meta.dir,"native-backend"+(import.meta.path.endsWith(".ts")?".ts":".js"));await Bun.write(m,`import { runNativeBackend } from ${JSON.stringify(D)}
2966
2966
  import handler from ${JSON.stringify(j(t.backend.entry))}
2967
2967
  await runNativeBackend({ html: ${JSON.stringify(e)}, fetch: handler,
2968
2968
  maxRequestBodySize: ${t.backend.maxRequestBodySize??33554432} })
2969
- `);let I=Bun.spawn([process.execPath,"build",h,"--compile","--minify","--no-compile-autoload-bunfig","--no-compile-autoload-dotenv","--outfile",o(u,"stx-backend")],{stdout:"pipe",stderr:"pipe"}),[R,V,W]=await Promise.all([new Response(I.stdout).text(),new Response(I.stderr).text(),I.exited]);if(W!==0)throw Error(`Native backend compilation failed: ${R}
2970
- ${V}`)}finally{Q(y)}await Bun.write(o(f,"craft.json"),`${JSON.stringify({backend:{executable:"stx-backend"},title:t.window?.title||r,appName:r,width:t.window?.width||1200,height:t.window?.height||800,devTools:Boolean(t.devTools),frameless:Boolean(t.window?.frameless),transparent:Boolean(t.window?.transparent),alwaysOnTop:Boolean(t.window?.alwaysOnTop),resizable:t.window?.resizable!==!1,...t.trayPopover?{trayPopover:!0}:C?{menubarOnly:!0}:t.systemTray?{systemTray:!0}:{}},null,2)}
2971
- `)}else if(m==="executable"){let y=o(u,r);k(s,y),T(y,493);let h={html:"index.html",title:t.window?.title||r,width:t.window?.width||1200,height:t.window?.height||800,devTools:Boolean(t.devTools)};if(t.trayPopover)h.trayPopover=!0;else if(C)h.menubarOnly=!0;else if(t.systemTray)h.systemTray=!0;if(t.window?.frameless)h.frameless=!0;if(t.window?.transparent)h.transparent=!0;if(t.window?.alwaysOnTop)h.alwaysOnTop=!0;if(t.window?.resizable===!1)h.resizable=!1;await Bun.write(o(f,"craft.json"),`${JSON.stringify(h,null,2)}
2972
- `)}else{let y=o(u,"craft");k(s,y),T(y,493);let h=t.sidebar?.enabled?`--native-sidebar --sidebar-width ${t.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",I=`#!/bin/bash
2969
+ `);let I=Bun.spawn([process.execPath,"build",m,"--compile","--minify","--no-compile-autoload-bunfig","--no-compile-autoload-dotenv","--outfile",o(u,"stx-backend")],{stdout:"pipe",stderr:"pipe"}),[R,V,W]=await Promise.all([new Response(I.stdout).text(),new Response(I.stderr).text(),I.exited]);if(W!==0)throw Error(`Native backend compilation failed: ${R}
2970
+ ${V}`)}finally{Q(y)}await Bun.write(o(f,"craft.json"),`${JSON.stringify({backend:{executable:"stx-backend"},title:t.window?.title||r,appName:r,width:t.window?.width||1200,height:t.window?.height||800,devTools:Boolean(t.devTools),frameless:Boolean(t.window?.frameless),transparent:Boolean(t.window?.transparent),alwaysOnTop:Boolean(t.window?.alwaysOnTop),resizable:t.window?.resizable!==!1,...t.trayPopover?{trayPopover:!0}:S?{menubarOnly:!0}:t.systemTray?{systemTray:!0}:{}},null,2)}
2971
+ `)}else if(g==="executable"){let y=o(u,r);k(s,y),T(y,493);let m={html:"index.html",title:t.window?.title||r,width:t.window?.width||1200,height:t.window?.height||800,devTools:Boolean(t.devTools)};if(t.trayPopover)m.trayPopover=!0;else if(S)m.menubarOnly=!0;else if(t.systemTray)m.systemTray=!0;if(t.window?.frameless)m.frameless=!0;if(t.window?.transparent)m.transparent=!0;if(t.window?.alwaysOnTop)m.alwaysOnTop=!0;if(t.window?.resizable===!1)m.resizable=!1;await Bun.write(o(f,"craft.json"),`${JSON.stringify(m,null,2)}
2972
+ `)}else{let y=o(u,"craft");k(s,y),T(y,493);let m=t.sidebar?.enabled?`--native-sidebar --sidebar-width ${t.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",I=`#!/bin/bash
2973
2973
  set -euo pipefail
2974
2974
  DIR="$( cd "$( dirname "\${BASH_SOURCE[0]}" )" && pwd )"
2975
2975
  RESOURCES="$DIR/../Resources"
2976
2976
  exec "$DIR/craft" --html-file "$RESOURCES/index.html" \\
2977
- ${[`--title "${t.window?.title||r}"`,`--width ${t.window?.width||1200}`,`--height ${t.window?.height||800}`,t.trayPopover?"--tray-popover":C?"--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":"",h].filter(Boolean).join(" \\\n ")}
2978
- `,R=o(u,r);await Bun.write(R,I),T(R,493)}let F=Boolean(t.icon&&await Bun.file(t.icon).exists());if(F)k(t.icon,o(f,"AppIcon.icns"));let H={CFBundleInfoDictionaryVersion:"6.0",CFBundleExecutable:r,CFBundleIdentifier:c,CFBundleName:r,CFBundleDisplayName:r,CFBundleShortVersionString:a,CFBundleVersion:a,CFBundlePackageType:"APPL",CFBundleSignature:"????",LSMinimumSystemVersion:t.minimumSystemVersion||"13.0",NSHighResolutionCapable:!0,NSSupportsAutomaticGraphicsSwitching:!0,LSUIElement:t.trayPopover||(t.menubarOnly??Boolean(t.systemTray)),...F?{CFBundleIconFile:"AppIcon"}:{},...t.category?{LSApplicationCategoryType:t.category}:{},...t.copyright?{NSHumanReadableCopyright:t.copyright}:{},...t.infoPlist||{}};if(await Bun.write(o(l,"Info.plist"),he(H)),await U(d,t.backend?[o(u,"stx-backend")]:m==="launcher"?[o(u,"craft")]:[],t.macosSigning),n==="dmg"){let y=o(i,`${r}-${a}.dmg`),h=await Se(d,y,r);if(!h.success)return{success:!1,target:"macos",format:"dmg",error:h.error};return{success:!0,target:"macos",format:"dmg",outputPath:y}}return{success:!0,target:"macos",format:"app",outputPath:d}}async function ge(e){let r=Bun.spawn([e,"--capabilities"],{stdout:"pipe",stderr:"pipe"}),a=setTimeout(()=>r.kill(),5000);try{let[i,n,t]=await Promise.all([new Response(r.stdout).text(),new Response(r.stderr).text(),r.exited]);if(t!==0)return!1;return JSON.parse(`${i}${n}`.trim()).bundleBackend===!0}catch{return!1}finally{clearTimeout(a)}}async function me(e){try{let r=Bun.spawn([e,"--version"],{stdout:"pipe",stderr:"pipe"}),[a,i]=await Promise.all([new Response(r.stdout).text(),new Response(r.stderr).text()]);await r.exited;let t=`${a}
2979
- ${i}`.match(/(\d+)\.(\d+)\.(\d+)/);if(!t)return!1;let[s,c,d]=t.slice(1).map(Number);if(s>0||c>0)return!0;return d>=57}catch{return!1}}function L(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function he(e){return`<?xml version="1.0" encoding="UTF-8"?>
2977
+ ${[`--title "${t.window?.title||r}"`,`--width ${t.window?.width||1200}`,`--height ${t.window?.height||800}`,t.trayPopover?"--tray-popover":S?"--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":"",m].filter(Boolean).join(" \\\n ")}
2978
+ `,R=o(u,r);await Bun.write(R,I),T(R,493)}let F=Boolean(t.icon&&await Bun.file(t.icon).exists());if(F)k(t.icon,o(f,"AppIcon.icns"));let H={CFBundleInfoDictionaryVersion:"6.0",CFBundleExecutable:r,CFBundleIdentifier:c,CFBundleName:r,CFBundleDisplayName:r,CFBundleShortVersionString:a,CFBundleVersion:a,CFBundlePackageType:"APPL",CFBundleSignature:"????",LSMinimumSystemVersion:t.minimumSystemVersion||"13.0",NSHighResolutionCapable:!0,NSSupportsAutomaticGraphicsSwitching:!0,LSUIElement:t.trayPopover||(t.menubarOnly??Boolean(t.systemTray)),...F?{CFBundleIconFile:"AppIcon"}:{},...t.category?{LSApplicationCategoryType:t.category}:{},...t.copyright?{NSHumanReadableCopyright:t.copyright}:{},...t.infoPlist||{}};if(await Bun.write(o(l,"Info.plist"),we(H)),await U(d,t.backend?[o(u,"stx-backend")]:g==="launcher"?[o(u,"craft")]:[],t.macosSigning),n==="dmg"){let y=o(i,`${r}-${a}.dmg`),m=await ke(d,y,r);if(!m.success)return{success:!1,target:"macos",format:"dmg",error:m.error};return{success:!0,target:"macos",format:"dmg",outputPath:y}}return{success:!0,target:"macos",format:"app",outputPath:d}}async function me(e){let r=Bun.spawn([e,"--capabilities"],{stdout:"pipe",stderr:"pipe"}),a=setTimeout(()=>r.kill(),5000);try{let[i,n,t]=await Promise.all([new Response(r.stdout).text(),new Response(r.stderr).text(),r.exited]);if(t!==0)return!1;return JSON.parse(`${i}${n}`.trim()).bundleBackend===!0}catch{return!1}finally{clearTimeout(a)}}async function he(e){try{let r=Bun.spawn([e,"--version"],{stdout:"pipe",stderr:"pipe"}),[a,i]=await Promise.all([new Response(r.stdout).text(),new Response(r.stderr).text()]);await r.exited;let t=`${a}
2979
+ ${i}`.match(/(\d+)\.(\d+)\.(\d+)/);if(!t)return!1;let[s,c,d]=t.slice(1).map(Number);if(s>0||c>0)return!0;return d>=57}catch{return!1}}function L(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function we(e){return`<?xml version="1.0" encoding="UTF-8"?>
2980
2980
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
2981
2981
  <plist version="1.0">
2982
2982
  <dict>
@@ -2985,7 +2985,7 @@ ${Object.entries(e).map(([a,i])=>{let n=typeof i==="boolean"?`<${i}/>`:typeof i=
2985
2985
  `)}
2986
2986
  </dict>
2987
2987
  </plist>
2988
- `}async function we(e,r,a,i,n,t,s){let c=o(i,r);x(c,{recursive:!0});let d=o(c,"index.html");await Bun.write(d,e),k(s,o(c,"craft.exe"));let l=`@echo off
2988
+ `}async function ve(e,r,a,i,n,t,s){let c=o(i,r);v(c,{recursive:!0});let d=o(c,"index.html");await Bun.write(d,e),k(s,o(c,"craft.exe"));let l=`@echo off
2989
2989
  set DIR=%~dp0
2990
2990
  "%DIR%craft.exe" --html-file "%DIR%index.html" ^
2991
2991
  --title "${t.window?.title||r}" ^
@@ -2993,7 +2993,7 @@ set DIR=%~dp0
2993
2993
  --height ${t.window?.height||800} ^
2994
2994
  ${t.systemTray?"--system-tray":""} ^
2995
2995
  ${t.devTools?"":"--no-devtools"}
2996
- `;if(await Bun.write(o(c,`${r}.bat`),l),n==="zip"){let u=o(i,`${r}-${a}-windows.zip`),f=await ke(c,u);if(!f.success)return{success:!1,target:"windows",format:"zip",error:f.error};return{success:!0,target:"windows",format:"zip",outputPath:u}}return{success:!0,target:"windows",format:"app",outputPath:c}}async function ve(e,r,a,i,n,t,s){let c=o(i,r);x(c,{recursive:!0});let d=o(c,"index.html");await Bun.write(d,e);let l=o(c,"craft");k(s,l),T(l,493);let u=`#!/bin/bash
2996
+ `;if(await Bun.write(o(c,`${r}.bat`),l),n==="zip"){let u=o(i,`${r}-${a}-windows.zip`),f=await $e(c,u);if(!f.success)return{success:!1,target:"windows",format:"zip",error:f.error};return{success:!0,target:"windows",format:"zip",outputPath:u}}return{success:!0,target:"windows",format:"app",outputPath:c}}async function xe(e,r,a,i,n,t,s){let c=o(i,r);v(c,{recursive:!0});let d=o(c,"index.html");await Bun.write(d,e);let l=o(c,"craft");k(s,l),T(l,493);let u=`#!/bin/bash
2997
2997
  set -euo pipefail
2998
2998
  DIR="$( cd "$( dirname "\${BASH_SOURCE[0]}" )" && pwd )"
2999
2999
  exec "$DIR/craft" --html-file "$DIR/index.html" \\
@@ -3002,14 +3002,14 @@ exec "$DIR/craft" --html-file "$DIR/index.html" \\
3002
3002
  --height ${t.window?.height||800} \\
3003
3003
  ${t.systemTray?"--system-tray":""} \\
3004
3004
  ${t.devTools?"":"--no-devtools"}
3005
- `,f=o(c,r.toLowerCase());await Bun.write(f,u),T(f,493);let g=`[Desktop Entry]
3005
+ `,f=o(c,r.toLowerCase());await Bun.write(f,u),T(f,493);let x=`[Desktop Entry]
3006
3006
  Type=Application
3007
3007
  Name=${r}
3008
3008
  Exec=${f}
3009
3009
  Terminal=false
3010
3010
  Categories=Utility;
3011
- `;if(await Bun.write(o(c,`${r.toLowerCase()}.desktop`),g),n==="deb"){let b=o(i,`${r.toLowerCase()}_${a}_amd64.deb`),w=await $e(c,b,r,a,t);if(!w.success)return{success:!1,target:"linux",format:"deb",error:w.error};return{success:!0,target:"linux",format:"deb",outputPath:b}}if(n==="appimage"){let b=o(i,`${r}-${a}-x86_64.AppImage`),w=await Te(c,b,r,t);if(!w.success)return{success:!1,target:"linux",format:"appimage",error:w.error};return{success:!0,target:"linux",format:"appimage",outputPath:b}}return{success:!0,target:"linux",format:"app",outputPath:c}}async function xe(e,r,a,i,n,t){return{success:!1,target:"ios",format:"ipa",error:`iOS build requires Xcode and additional setup. Use 'stx init:ios ${r}' to create an iOS project.`}}async function ye(e,r,a,i,n,t){return{success:!1,target:"android",format:"apk",error:`Android build requires Android SDK and additional setup. Use 'stx init:android ${r}' to create an Android project.`}}function Vi(){let e=process.env.CRAFT_BIN;if(e){if(!N(e))throw Error(`CRAFT_BIN points to a missing file: ${e}`);return e}return Bun.which("craft",{PATH:process.env.PATH??"",cwd:process.cwd()})}function B(){switch(ue()){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}function Ce(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 Se(e,r,a){return new Promise((i)=>{let n=A("hdiutil",["create","-volname",a,"-srcfolder",e,"-ov","-format","UDZO",r]);n.on("close",(t)=>{if(t===0)i({success:!0});else i({success:!1,error:`hdiutil exited with code ${t}`})}),n.on("error",(t)=>{i({success:!1,error:t.message})})})}async function ke(e,r){return new Promise((a)=>{let i=A("zip",["-r",r,"."],{cwd:e});i.on("close",(n)=>{if(n===0)a({success:!0});else a({success:!1,error:`zip exited with code ${n}`})}),i.on("error",(n)=>{a({success:!1,error:n.message})})})}async function $e(e,r,a,i,n){return new Promise((t)=>{let s=He("deb");try{let c=o(s,"pkg"),d=o(c,"DEBIAN"),l=o(c,"usr","bin"),u=o(c,"usr","share","applications"),f=o(c,"usr","share",a.toLowerCase());x(d,{recursive:!0}),x(l,{recursive:!0}),x(u,{recursive:!0}),x(f,{recursive:!0});let g=p("fs").readdirSync(e);for(let m of g)k(o(e,m),o(f,m));let b=`#!/bin/bash
3012
- exec /usr/share/${a.toLowerCase()}/${a.toLowerCase()} "$@"`;p("fs").writeFileSync(o(l,a.toLowerCase()),b),T(o(l,a.toLowerCase()),493);let w=`Package: ${a.toLowerCase()}
3011
+ `;if(await Bun.write(o(c,`${r.toLowerCase()}.desktop`),x),n==="deb"){let b=o(i,`${r.toLowerCase()}_${a}_amd64.deb`),h=await Te(c,b,r,a,t);if(!h.success)return{success:!1,target:"linux",format:"deb",error:h.error};return{success:!0,target:"linux",format:"deb",outputPath:b}}if(n==="appimage"){let b=o(i,`${r}-${a}-x86_64.AppImage`),h=await Pe(c,b,r,t);if(!h.success)return{success:!1,target:"linux",format:"appimage",error:h.error};return{success:!0,target:"linux",format:"appimage",outputPath:b}}return{success:!0,target:"linux",format:"app",outputPath:c}}async function ye(e,r,a,i,n,t){return{success:!1,target:"ios",format:"ipa",error:`iOS build requires Xcode and additional setup. Use 'stx init:ios ${r}' to create an iOS project.`}}async function Se(e,r,a,i,n,t){return{success:!1,target:"android",format:"apk",error:`Android build requires Android SDK and additional setup. Use 'stx init:android ${r}' to create an Android project.`}}function Vi(){let e=process.env.CRAFT_BIN;if(e){if(!N(e))throw Error(`CRAFT_BIN points to a missing file: ${e}`);return e}return Bun.which("craft",{PATH:process.env.PATH??"",cwd:process.cwd()})}function B(){switch(be()){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}function Ce(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 ke(e,r,a){return new Promise((i)=>{let n=A("hdiutil",["create","-volname",a,"-srcfolder",e,"-ov","-format","UDZO",r]);n.on("close",(t)=>{if(t===0)i({success:!0});else i({success:!1,error:`hdiutil exited with code ${t}`})}),n.on("error",(t)=>{i({success:!1,error:t.message})})})}async function $e(e,r){return new Promise((a)=>{let i=A("zip",["-r",r,"."],{cwd:e});i.on("close",(n)=>{if(n===0)a({success:!0});else a({success:!1,error:`zip exited with code ${n}`})}),i.on("error",(n)=>{a({success:!1,error:n.message})})})}async function Te(e,r,a,i,n){return new Promise((t)=>{let s=He("deb");try{let c=o(s,"pkg"),d=o(c,"DEBIAN"),l=o(c,"usr","bin"),u=o(c,"usr","share","applications"),f=o(c,"usr","share",a.toLowerCase());v(d,{recursive:!0}),v(l,{recursive:!0}),v(u,{recursive:!0}),v(f,{recursive:!0});let x=p("fs").readdirSync(e);for(let g of x)k(o(e,g),o(f,g));let b=`#!/bin/bash
3012
+ exec /usr/share/${a.toLowerCase()}/${a.toLowerCase()} "$@"`;p("fs").writeFileSync(o(l,a.toLowerCase()),b),T(o(l,a.toLowerCase()),493);let h=`Package: ${a.toLowerCase()}
3013
3013
  Version: ${i}
3014
3014
  Section: utils
3015
3015
  Priority: optional
@@ -3017,17 +3017,17 @@ Architecture: amd64
3017
3017
  Depends: libgtk-3-0, libwebkit2gtk-4.0-37
3018
3018
  Maintainer: ${n.author||"Unknown"}
3019
3019
  Description: ${n.description||a}
3020
- `;p("fs").writeFileSync(o(d,"control"),w);let C=A("dpkg-deb",["--build",c,r]);C.on("close",(m)=>{if(Q(s),m===0)t({success:!0});else t({success:!1,error:`dpkg-deb exited with code ${m}`})}),C.on("error",(m)=>{Q(s),t({success:!1,error:m.message})})}catch(c){Q(s),t({success:!1,error:c.message})}})}async function Te(e,r,a,i){return new Promise((n)=>{let t=He("appimage");try{let s=o(t,`${a}.AppDir`),c=o(s,"usr"),d=o(c,"bin"),l=o(c,"share");x(d,{recursive:!0}),x(l,{recursive:!0});let u=o(l,a.toLowerCase());x(u,{recursive:!0});let f=p("fs").readdirSync(e);for(let m of f)k(o(e,m),o(u,m));let g=`#!/bin/bash
3020
+ `;p("fs").writeFileSync(o(d,"control"),h);let S=A("dpkg-deb",["--build",c,r]);S.on("close",(g)=>{if(Q(s),g===0)t({success:!0});else t({success:!1,error:`dpkg-deb exited with code ${g}`})}),S.on("error",(g)=>{Q(s),t({success:!1,error:g.message})})}catch(c){Q(s),t({success:!1,error:c.message})}})}async function Pe(e,r,a,i){return new Promise((n)=>{let t=He("appimage");try{let s=o(t,`${a}.AppDir`),c=o(s,"usr"),d=o(c,"bin"),l=o(c,"share");v(d,{recursive:!0}),v(l,{recursive:!0});let u=o(l,a.toLowerCase());v(u,{recursive:!0});let f=p("fs").readdirSync(e);for(let g of f)k(o(e,g),o(u,g));let x=`#!/bin/bash
3021
3021
  SELF=$(readlink -f "$0")
3022
3022
  HERE=\${SELF%/*}
3023
3023
  export PATH="\${HERE}/usr/bin:\${PATH}"
3024
3024
  exec "\${HERE}/usr/share/${a.toLowerCase()}/${a.toLowerCase()}" "$@"
3025
- `;p("fs").writeFileSync(o(s,"AppRun"),g),T(o(s,"AppRun"),493);let b=`[Desktop Entry]
3025
+ `;p("fs").writeFileSync(o(s,"AppRun"),x),T(o(s,"AppRun"),493);let b=`[Desktop Entry]
3026
3026
  Type=Application
3027
3027
  Name=${a}
3028
3028
  Exec=${a.toLowerCase()}
3029
3029
  Terminal=false
3030
3030
  Categories=Utility;
3031
3031
  Icon=${a.toLowerCase()}
3032
- `;p("fs").writeFileSync(o(s,`${a.toLowerCase()}.desktop`),b);let w=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(p("fs").writeFileSync(o(s,`${a.toLowerCase()}.png`),w),i.icon&&N(i.icon))k(i.icon,o(s,`${a.toLowerCase()}.png`));let C=A("appimagetool",[s,r],{env:{...process.env,ARCH:"x86_64"}});C.on("close",(m)=>{if(Q(t),m===0)T(r,493),n({success:!0});else n({success:!1,error:`appimagetool exited with code ${m}. Install from https://appimage.github.io/appimagetool/`})}),C.on("error",(m)=>{Q(t),n({success:!1,error:`appimagetool not found: ${m.message}`})})}catch(s){Q(t),n({success:!1,error:s.message})}})}function Ui(){return[B()]}function Wi(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 Pe={buildNative:Hi,getAvailableTargets:Ui,getAvailableFormats:Wi,detectPlatform:B},tp=Pe;
3032
+ `;p("fs").writeFileSync(o(s,`${a.toLowerCase()}.desktop`),b);let h=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(p("fs").writeFileSync(o(s,`${a.toLowerCase()}.png`),h),i.icon&&N(i.icon))k(i.icon,o(s,`${a.toLowerCase()}.png`));let S=A("appimagetool",[s,r],{env:{...process.env,ARCH:"x86_64"}});S.on("close",(g)=>{if(Q(t),g===0)T(r,493),n({success:!0});else n({success:!1,error:`appimagetool exited with code ${g}. Install from https://appimage.github.io/appimagetool/`})}),S.on("error",(g)=>{Q(t),n({success:!1,error:`appimagetool not found: ${g.message}`})})}catch(s){Q(t),n({success:!1,error:s.message})}})}function Ui(){return[B()]}function Wi(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 Ie={buildNative:Hi,getAvailableTargets:Ui,getAvailableFormats:Wi,detectPlatform:B},tp=Ie;
3033
3033
  export{Xd,ji,Jd,Yd,Bi,Us,Fi,Zd,zi,Qd,ep,Hi,Vi,Ui,Wi,tp};