@stacksjs/stx 0.2.642 → 0.2.644

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/{chunk-ngkxtkh3.js → chunk-12677ap2.js} +2 -2
  2. package/dist/{chunk-70na8hcs.js → chunk-162gprh9.js} +1 -1
  3. package/dist/{chunk-bxvnzafh.js → chunk-29gd2kkk.js} +1 -1
  4. package/dist/{chunk-8at87jae.js → chunk-29sq7kqw.js} +1 -1
  5. package/dist/{chunk-yvf7ta8h.js → chunk-2s3sxt48.js} +1 -1
  6. package/dist/{chunk-3xdmxpxe.js → chunk-3jrssj8g.js} +1 -1
  7. package/dist/{chunk-pjxns9tp.js → chunk-5c511mj0.js} +1 -1
  8. package/dist/{chunk-p7jbzxps.js → chunk-6bdr0x43.js} +2 -2
  9. package/dist/{chunk-pr08fz3f.js → chunk-7qgsgfnt.js} +1 -1
  10. package/dist/{chunk-j36hrzac.js → chunk-8bk1ghb7.js} +3 -3
  11. package/dist/{chunk-w7wb4t0z.js → chunk-8k5eac6p.js} +1 -1
  12. package/dist/{chunk-z84vhs3n.js → chunk-afsf6sp0.js} +1 -1
  13. package/dist/{chunk-kcvn37qp.js → chunk-bnfjwgtm.js} +1 -1
  14. package/dist/{chunk-jmhpfxjq.js → chunk-br7xk2hb.js} +1 -1
  15. package/dist/{chunk-efx1zm7a.js → chunk-c8p5jwdq.js} +1 -1
  16. package/dist/{chunk-7xq8ng55.js → chunk-cpxtmmvv.js} +41 -43
  17. package/dist/{chunk-cc1v8q2d.js → chunk-cw8mx4qf.js} +5 -5
  18. package/dist/{chunk-crtv20vx.js → chunk-dr4325et.js} +1 -1
  19. package/dist/{chunk-vecjfm4z.js → chunk-eh7qq39j.js} +1 -1
  20. package/dist/chunk-ek5vrw4r.js +2 -0
  21. package/dist/chunk-erweevv2.js +2 -0
  22. package/dist/{chunk-h3nrzz4k.js → chunk-ft3r2rzs.js} +1 -1
  23. package/dist/{chunk-6sb3tcr6.js → chunk-fywp8fcr.js} +1 -1
  24. package/dist/{chunk-hhnbm4y5.js → chunk-gbxzqvez.js} +1 -1
  25. package/dist/{chunk-dqjx14em.js → chunk-grg366m9.js} +18 -18
  26. package/dist/{chunk-dy3hvydn.js → chunk-h3brvxbf.js} +1 -1
  27. package/dist/{chunk-1at1xzx5.js → chunk-hbk20w21.js} +1 -1
  28. package/dist/{chunk-n95243ry.js → chunk-hrdnz5q9.js} +1 -1
  29. package/dist/{chunk-g0wr83v9.js → chunk-hshcbe3p.js} +1 -1
  30. package/dist/{chunk-j9kachkd.js → chunk-hvk5zkpm.js} +1 -1
  31. package/dist/{chunk-2zey344t.js → chunk-ja3m0h9h.js} +1 -1
  32. package/dist/{chunk-5x83f835.js → chunk-jtk2p5p0.js} +1 -1
  33. package/dist/{chunk-52wj6yc8.js → chunk-k46gqnmk.js} +1 -1
  34. package/dist/{chunk-5qwrg6m7.js → chunk-ktjvqwp4.js} +1 -1
  35. package/dist/{chunk-7pmcsw3x.js → chunk-kv5mn1qr.js} +1 -1
  36. package/dist/{chunk-hbwxr5dq.js → chunk-m2bnyrft.js} +1 -1
  37. package/dist/{chunk-p6kaqfa9.js → chunk-myq0m4h4.js} +1 -1
  38. package/dist/{chunk-wv9mc6gx.js → chunk-nv9syzs0.js} +1 -1
  39. package/dist/{chunk-t53pmm3n.js → chunk-qf210sfx.js} +2 -2
  40. package/dist/{chunk-cc6f6t8f.js → chunk-s0tbc9t1.js} +1 -1
  41. package/dist/{chunk-4whp2tr5.js → chunk-s7e9ztgq.js} +1 -1
  42. package/dist/{chunk-mck6csxx.js → chunk-t6awky15.js} +1 -1
  43. package/dist/{chunk-0f75mm0s.js → chunk-tcq0me7c.js} +1 -1
  44. package/dist/{chunk-kah2drys.js → chunk-vse0hhn9.js} +1 -1
  45. package/dist/{chunk-75tshgmz.js → chunk-x901zq4q.js} +1 -1
  46. package/dist/chunk-xe8qmf1d.js +2 -0
  47. package/dist/{chunk-pr1rt0z4.js → chunk-xsmvcnmx.js} +1 -1
  48. package/dist/{chunk-8k4d65x2.js → chunk-zrngcg6r.js} +1 -1
  49. package/dist/cli.js +7 -7
  50. package/dist/craft-entry.js +1 -1
  51. package/dist/craft.js +1 -1
  52. package/dist/native-backend.d.ts +0 -4
  53. package/dist/native-backend.js +14 -30
  54. package/dist/native-build.js +39 -8
  55. package/dist/native-signing.d.ts +2 -1
  56. package/dist/native-signing.js +45 -9
  57. package/dist/pwa.js +1 -1
  58. package/dist/ssg.js +2 -2
  59. package/package.json +5 -5
  60. package/dist/chunk-fhhen33c.js +0 -2
  61. package/dist/chunk-hbqqh0cr.js +0 -2
  62. package/dist/chunk-razh91br.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Ce,U}from"./chunk-gmxrckgj.js";import{ni}from"./chunk-p7jbzxps.js";import{d}from"./chunk-yn2d8x8m.js";import{existsSync as q,mkdirSync as v,copyFileSync as S,chmodSync as k,rmSync as ne}from"fs";import{join as o,basename as oe,resolve as H}from"path";import{spawn as N,execSync as ce}from"child_process";import{homedir as A,platform as de}from"os";var Wu=`
2
+ import{Ce,U}from"./chunk-gmxrckgj.js";import{ni}from"./chunk-6bdr0x43.js";import{d}from"./chunk-yn2d8x8m.js";import{existsSync as F,mkdirSync as x,copyFileSync as k,chmodSync as T,rmSync as pe}from"fs";import{join as n,basename as ue,resolve as V}from"path";import{spawn as N,execSync as be}from"child_process";import{homedir as q,platform as ge}from"os";var Wu=`
3
3
  <script>
4
4
  (function() {
5
5
  'use strict';
@@ -942,7 +942,7 @@ else if (data.type === 'event' && data.method) {
942
942
  ${a}`);return a+e}var ls={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">
943
943
  <input type="checkbox" class="craft-checkbox" ${a} ${i}>
944
944
  <span class="craft-checkbox-label">${r||e.label||""}</span>
945
- </label>`}},radio:{nativeType:"craft-radio",fallbackTag:"input",fallbackClasses:"craft-radio",nativeProps:["checked","disabled","name","value","label"]},select:{nativeType:"craft-select",fallbackTag:"select",fallbackClasses:"craft-select",nativeProps:["value","disabled","options","placeholder"]},slider:{nativeType:"craft-slider",fallbackTag:"input",fallbackClasses:"craft-slider",nativeProps:["value","min","max","step","disabled"],render:(e,r)=>{let a=e.min??0,i=e.max??100,s=e.step??1,t=e.value??50,n=e.disabled?"disabled":"";return`<input type="range" class="craft-slider" min="${a}" max="${i}" step="${s}" value="${t}" ${n}>`}},label:{nativeType:"craft-label",fallbackTag:"span",fallbackClasses:"craft-label",nativeProps:["text","for"]},badge:{nativeType:"craft-badge",fallbackTag:"span",fallbackClasses:"craft-badge",nativeProps:["variant","size"]},avatar:{nativeType:"craft-avatar",fallbackTag:"div",fallbackClasses:"craft-avatar",nativeProps:["src","alt","size","fallback"],render:(e,r)=>{let a=e.size||40,i=e.src,s=String(e.alt||""),t=e.fallback||(s?s.charAt(0).toUpperCase():"?");if(i)return`<img class="craft-avatar" src="${i}" alt="${s}" style="width:${a}px;height:${a}px;border-radius:50%">`;return`<div class="craft-avatar craft-avatar-fallback" style="width:${a}px;height:${a}px;border-radius:50%;display:flex;align-items:center;justify-content:center">${t}</div>`}},progress:{nativeType:"craft-progress",fallbackTag:"div",fallbackClasses:"craft-progress",nativeProps:["value","max","variant"],render:(e,r)=>{let a=Number(e.value)||0,i=Number(e.max)||100;return`<div class="craft-progress"><div class="craft-progress-bar" style="width:${Math.min(100,Math.max(0,a/i*100))}%"></div></div>`}},spinner:{nativeType:"craft-spinner",fallbackTag:"div",fallbackClasses:"craft-spinner",nativeProps:["size"],render:(e,r)=>{let a=e.size||24;return`<div class="craft-spinner" style="width:${a}px;height:${a}px"></div>`}},card:{nativeType:"craft-card",fallbackTag:"div",fallbackClasses:"craft-card",nativeProps:["title","subtitle","variant"]},modal:{nativeType:"craft-modal",fallbackTag:"dialog",fallbackClasses:"craft-modal",nativeProps:["open","title","closable","size"],render:(e,r)=>{let a=e.open?"open":"",i=e.title||"";return`<dialog class="craft-modal" ${a}>
945
+ </label>`}},radio:{nativeType:"craft-radio",fallbackTag:"input",fallbackClasses:"craft-radio",nativeProps:["checked","disabled","name","value","label"]},select:{nativeType:"craft-select",fallbackTag:"select",fallbackClasses:"craft-select",nativeProps:["value","disabled","options","placeholder"]},slider:{nativeType:"craft-slider",fallbackTag:"input",fallbackClasses:"craft-slider",nativeProps:["value","min","max","step","disabled"],render:(e,r)=>{let a=e.min??0,i=e.max??100,s=e.step??1,t=e.value??50,o=e.disabled?"disabled":"";return`<input type="range" class="craft-slider" min="${a}" max="${i}" step="${s}" value="${t}" ${o}>`}},label:{nativeType:"craft-label",fallbackTag:"span",fallbackClasses:"craft-label",nativeProps:["text","for"]},badge:{nativeType:"craft-badge",fallbackTag:"span",fallbackClasses:"craft-badge",nativeProps:["variant","size"]},avatar:{nativeType:"craft-avatar",fallbackTag:"div",fallbackClasses:"craft-avatar",nativeProps:["src","alt","size","fallback"],render:(e,r)=>{let a=e.size||40,i=e.src,s=String(e.alt||""),t=e.fallback||(s?s.charAt(0).toUpperCase():"?");if(i)return`<img class="craft-avatar" src="${i}" alt="${s}" style="width:${a}px;height:${a}px;border-radius:50%">`;return`<div class="craft-avatar craft-avatar-fallback" style="width:${a}px;height:${a}px;border-radius:50%;display:flex;align-items:center;justify-content:center">${t}</div>`}},progress:{nativeType:"craft-progress",fallbackTag:"div",fallbackClasses:"craft-progress",nativeProps:["value","max","variant"],render:(e,r)=>{let a=Number(e.value)||0,i=Number(e.max)||100;return`<div class="craft-progress"><div class="craft-progress-bar" style="width:${Math.min(100,Math.max(0,a/i*100))}%"></div></div>`}},spinner:{nativeType:"craft-spinner",fallbackTag:"div",fallbackClasses:"craft-spinner",nativeProps:["size"],render:(e,r)=>{let a=e.size||24;return`<div class="craft-spinner" style="width:${a}px;height:${a}px"></div>`}},card:{nativeType:"craft-card",fallbackTag:"div",fallbackClasses:"craft-card",nativeProps:["title","subtitle","variant"]},modal:{nativeType:"craft-modal",fallbackTag:"dialog",fallbackClasses:"craft-modal",nativeProps:["open","title","closable","size"],render:(e,r)=>{let a=e.open?"open":"",i=e.title||"";return`<dialog class="craft-modal" ${a}>
946
946
  <div class="craft-modal-content">
947
947
  ${i?`<div class="craft-modal-header"><h2>${i}</h2></div>`:""}
948
948
  <div class="craft-modal-body">${r}</div>
@@ -953,7 +953,7 @@ ${a}`);return a+e}var ls={button:{nativeType:"craft-button",fallbackTag:"button"
953
953
  </details>`}},divider:{nativeType:"craft-divider",fallbackTag:"hr",fallbackClasses:"craft-divider",nativeProps:["orientation","variant"]},table:{nativeType:"craft-table",fallbackTag:"table",fallbackClasses:"craft-table",nativeProps:["columns","rows","sortable","selectable"]},list:{nativeType:"craft-list",fallbackTag:"ul",fallbackClasses:"craft-list",nativeProps:["items","selectable"]},tree:{nativeType:"craft-tree",fallbackTag:"div",fallbackClasses:"craft-tree",nativeProps:["nodes","expandable","selectable"]},alert:{nativeType:"craft-alert",fallbackTag:"div",fallbackClasses:"craft-alert",nativeProps:["variant","title","dismissible"],render:(e,r)=>{let a=e.variant||"info",i=e.title||"";return`<div class="craft-alert craft-alert-${a}" role="alert">
954
954
  ${i?`<div class="craft-alert-title">${i}</div>`:""}
955
955
  <div class="craft-alert-content">${r}</div>
956
- </div>`}},toast:{nativeType:"craft-toast",fallbackTag:"div",fallbackClasses:"craft-toast",nativeProps:["variant","duration","position"]},tooltip:{nativeType:"craft-tooltip",fallbackTag:"span",fallbackClasses:"craft-tooltip",nativeProps:["content","position"],render:(e,r)=>{let a=e.content||"",i=e.position||"top";return`<span class="craft-tooltip" data-tooltip="${a}" data-position="${i}">${r}</span>`}},menu:{nativeType:"craft-menu",fallbackTag:"nav",fallbackClasses:"craft-menu",nativeProps:["items","orientation"]},breadcrumb:{nativeType:"craft-breadcrumb",fallbackTag:"nav",fallbackClasses:"craft-breadcrumb",nativeProps:["items","separator"]},sidebar:{nativeType:"craft-sidebar",fallbackTag:"aside",fallbackClasses:"craft-sidebar craft-sidebar-tahoe",nativeProps:["id","variant","material","backgroundEffect","allowsVibrancy","materialOpacity","materialDarkOpacity","minWidth","maxWidth","canCollapse","searchPlaceholder","selectedItem","sections","spaces","selectedSpace"],render:Y},"sidebar-space":{nativeType:"craft-sidebar-space",fallbackTag:"section",fallbackClasses:"craft-sidebar-space",nativeProps:["id","label","icon","tint"],render:Q},"sidebar-section":{nativeType:"craft-sidebar-section",fallbackTag:"section",fallbackClasses:"craft-sidebar-section",nativeProps:["id","title","header"],render:G},"sidebar-item":{nativeType:"craft-sidebar-item",fallbackTag:"button",fallbackClasses:"craft-sidebar-item",nativeProps:["id","label","icon","badge","tintColor"],render:X},pagination:{nativeType:"craft-pagination",fallbackTag:"nav",fallbackClasses:"craft-pagination",nativeProps:["total","page","pageSize"]},"code-editor":{nativeType:"craft-code-editor",fallbackTag:"textarea",fallbackClasses:"craft-code-editor",nativeProps:["value","language","theme","readonly","lineNumbers"]},"file-browser":{nativeType:"craft-file-browser",fallbackTag:"div",fallbackClasses:"craft-file-browser",nativeProps:["path","showHidden","selectable"]},"color-picker":{nativeType:"craft-color-picker",fallbackTag:"input",fallbackClasses:"craft-color-picker",nativeProps:["value","format"],render:(e,r)=>`<input type="color" class="craft-color-picker" value="${e.value||"#000000"}">`},"date-picker":{nativeType:"craft-date-picker",fallbackTag:"input",fallbackClasses:"craft-date-picker",nativeProps:["value","min","max","format"],render:(e,r)=>{let a=e.value||"",i=e.min||"",s=e.max||"";return`<input type="date" class="craft-date-picker" value="${a}" min="${i}" max="${s}">`}},"time-picker":{nativeType:"craft-time-picker",fallbackTag:"input",fallbackClasses:"craft-time-picker",nativeProps:["value","min","max","step"],render:(e,r)=>`<input type="time" class="craft-time-picker" value="${e.value||""}">`}},Xo=`
956
+ </div>`}},toast:{nativeType:"craft-toast",fallbackTag:"div",fallbackClasses:"craft-toast",nativeProps:["variant","duration","position"]},tooltip:{nativeType:"craft-tooltip",fallbackTag:"span",fallbackClasses:"craft-tooltip",nativeProps:["content","position"],render:(e,r)=>{let a=e.content||"",i=e.position||"top";return`<span class="craft-tooltip" data-tooltip="${a}" data-position="${i}">${r}</span>`}},menu:{nativeType:"craft-menu",fallbackTag:"nav",fallbackClasses:"craft-menu",nativeProps:["items","orientation"]},breadcrumb:{nativeType:"craft-breadcrumb",fallbackTag:"nav",fallbackClasses:"craft-breadcrumb",nativeProps:["items","separator"]},sidebar:{nativeType:"craft-sidebar",fallbackTag:"aside",fallbackClasses:"craft-sidebar craft-sidebar-tahoe",nativeProps:["id","variant","material","backgroundEffect","allowsVibrancy","materialOpacity","materialDarkOpacity","minWidth","maxWidth","canCollapse","searchPlaceholder","selectedItem","sections","spaces","selectedSpace"],render:Q},"sidebar-space":{nativeType:"craft-sidebar-space",fallbackTag:"section",fallbackClasses:"craft-sidebar-space",nativeProps:["id","label","icon","tint"],render:G},"sidebar-section":{nativeType:"craft-sidebar-section",fallbackTag:"section",fallbackClasses:"craft-sidebar-section",nativeProps:["id","title","header"],render:X},"sidebar-item":{nativeType:"craft-sidebar-item",fallbackTag:"button",fallbackClasses:"craft-sidebar-item",nativeProps:["id","label","icon","badge","tintColor"],render:K},pagination:{nativeType:"craft-pagination",fallbackTag:"nav",fallbackClasses:"craft-pagination",nativeProps:["total","page","pageSize"]},"code-editor":{nativeType:"craft-code-editor",fallbackTag:"textarea",fallbackClasses:"craft-code-editor",nativeProps:["value","language","theme","readonly","lineNumbers"]},"file-browser":{nativeType:"craft-file-browser",fallbackTag:"div",fallbackClasses:"craft-file-browser",nativeProps:["path","showHidden","selectable"]},"color-picker":{nativeType:"craft-color-picker",fallbackTag:"input",fallbackClasses:"craft-color-picker",nativeProps:["value","format"],render:(e,r)=>`<input type="color" class="craft-color-picker" value="${e.value||"#000000"}">`},"date-picker":{nativeType:"craft-date-picker",fallbackTag:"input",fallbackClasses:"craft-date-picker",nativeProps:["value","min","max","format"],render:(e,r)=>{let a=e.value||"",i=e.min||"",s=e.max||"";return`<input type="date" class="craft-date-picker" value="${a}" min="${i}" max="${s}">`}},"time-picker":{nativeType:"craft-time-picker",fallbackTag:"input",fallbackClasses:"craft-time-picker",nativeProps:["value","min","max","step"],render:(e,r)=>`<input type="time" class="craft-time-picker" value="${e.value||""}">`}},Xo=`
957
957
  <style id="craft-component-styles">
958
958
  /* Craft Component Base Styles */
959
959
  .craft-button {
@@ -2940,54 +2940,52 @@ ${a}`);return a+e}var ls={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,s,t)=>O("sidebar",s,t.trim(),r,a)),e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(i,s)=>O("sidebar",s,"",r,a)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(i,s,t)=>O(s,t,"",r,a)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(i,s,t,n)=>O(s,t,n.trim(),r,a)),e}function O(e,r,a,i,s){let t=i.components?.[e]||ls[e];if(!t)return console.warn(`[stx] Unknown Craft component: @craft-${e}`),`<div class="${s}-unknown" data-component="${e}">${a}</div>`;let n=E(r),c=[t.fallbackClasses||`${s}-${e}`];if(n.class)c.push(n.class),delete n.class;if(t.render)return n.__fallbackClasses=c.join(" "),t.render(n,a);let l=se(n,t,c);if(["input","hr","br","img"].includes(t.fallbackTag))return`<${t.fallbackTag} ${l}>`;return`<${t.fallbackTag} ${l}>${a}</${t.fallbackTag}>`}function E(e){let r={},a=/(?::|@)?(\w+[-\w]*)(?:=(?:"([^"]*)"|'([^']*)'))?/g,i;while((i=a.exec(e))!==null){let[s,t,n,c]=i,l=n??c;if(s.startsWith(":"))r[t]=l;else if(s.startsWith("@"))r[`on${t.charAt(0).toUpperCase()}${t.slice(1)}`]=l;else if(l===void 0)r[t]=!0;else r[t]=l}return r}function Y(e,r){let a=I(String(e.id||`craft-sidebar-${ae(r||JSON.stringify(e))}`)),i=ee(e.spaces)||Z(r),s=i.length?[]:re(e.sections)||_(r),t=String(e.selectedSpace||i[0]?.id||""),n=i.find((h)=>h.id===t)||i[0],c=String(e.selectedItem||e.selected||(i.length?n?.sections[0]?.items[0]?.id:s[0]?.items[0]?.id)||""),l={id: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:s,spaces:i,selectedSpace:t||void 0},f=String(e.__fallbackClasses||"craft-sidebar craft-sidebar-tahoe"),p=Number(e.width||e.sidebarWidth||286),u=e.native===!1||e.native==="false"?"false":"true",y=l.searchPlaceholder?`<div class="craft-sidebar-search"><input type="search" placeholder="${C(l.searchPlaceholder)}"></div>`:"",g;if(i.length)g=te(i,t,c);else if(s.length)g=s.map((h)=>z(h,c)).join("");else g=r;return`<aside class="${w(f)}" data-craft="craft-sidebar" data-craft-native-sidebar data-craft-sidebar-id="${w(a)}" data-native="${u}" style="--craft-sidebar-width:${p}px">
2944
- ${y}
2943
+ `;return e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(i,s,t)=>O("sidebar",s,t.trim(),r,a)),e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(i,s)=>O("sidebar",s,"",r,a)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(i,s,t)=>O(s,t,"",r,a)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(i,s,t,o)=>O(s,t,o.trim(),r,a)),e}function O(e,r,a,i,s){let t=i.components?.[e]||ls[e];if(!t)return console.warn(`[stx] Unknown Craft component: @craft-${e}`),`<div class="${s}-unknown" data-component="${e}">${a}</div>`;let o=E(r),c=[t.fallbackClasses||`${s}-${e}`];if(o.class)c.push(o.class),delete o.class;if(t.render)return o.__fallbackClasses=c.join(" "),t.render(o,a);let l=ne(o,t,c);if(["input","hr","br","img"].includes(t.fallbackTag))return`<${t.fallbackTag} ${l}>`;return`<${t.fallbackTag} ${l}>${a}</${t.fallbackTag}>`}function E(e){let r={},a=/(?::|@)?(\w+[-\w]*)(?:=(?:"([^"]*)"|'([^']*)'))?/g,i;while((i=a.exec(e))!==null){let[s,t,o,c]=i,l=o??c;if(s.startsWith(":"))r[t]=l;else if(s.startsWith("@"))r[`on${t.charAt(0).toUpperCase()}${t.slice(1)}`]=l;else if(l===void 0)r[t]=!0;else r[t]=l}return r}function Q(e,r){let a=P(String(e.id||`craft-sidebar-${ie(r||JSON.stringify(e))}`)),i=te(e.spaces)||ee(r),s=i.length?[]:ae(e.sections)||z(r),t=String(e.selectedSpace||i[0]?.id||""),o=i.find((w)=>w.id===t)||i[0],c=String(e.selectedItem||e.selected||(i.length?o?.sections[0]?.items[0]?.id:s[0]?.items[0]?.id)||""),l={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:s,spaces:i,selectedSpace:t||void 0},f=String(e.__fallbackClasses||"craft-sidebar craft-sidebar-tahoe"),u=Number(e.width||e.sidebarWidth||286),p=e.native===!1||e.native==="false"?"false":"true",g=l.searchPlaceholder?`<div class="craft-sidebar-search"><input type="search" placeholder="${S(l.searchPlaceholder)}"></div>`:"",b;if(i.length)b=re(i,t,c);else if(s.length)b=s.map((w)=>M(w,c)).join("");else b=r;return`<aside class="${v(f)}" data-craft="craft-sidebar" data-craft-native-sidebar data-craft-sidebar-id="${v(a)}" data-native="${p}" style="--craft-sidebar-width:${u}px">
2945
2944
  ${g}
2945
+ ${b}
2946
2946
  </aside>
2947
- <script type="application/json" data-craft-sidebar-config="${w(a)}">${ie(l)}</script>`}function Q(e,r){let a=I(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>`:""}
2947
+ <script type="application/json" data-craft-sidebar-config="${v(a)}">${se(l)}</script>`}function G(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>`:""}
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="${w(String(e.id||"section"))}">
2951
- ${a?`<div class="craft-sidebar-section-title">${C(a)}</div>`:""}
2950
+ </section>`}function X(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>`:""}
2952
2952
  ${r}
2953
- </section>`}function X(e,r){let a={id:String(e.id||I(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 s=E(i[1]||""),t=i[2]||"",n=String(s.id||I(String(s.header||s.title||`section-${r.length+1}`))),c=String(s.header||s.title||n),l=K(t);r.push({id:n,header:c,title:c,items:l})}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 s=E(i[1]||""),t=String(s.label||(i[2]||"").replace(/<[^>]*>/g,"").trim()),n=String(s.id||I(t||`item-${r.length+1}`));r.push({id:n,label:t,icon:s.icon?String(s.icon):void 0,badge:s.badge?String(s.badge):void 0,tintColor:s.tintColor?String(s.tintColor):void 0})}return 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 s=E(i[1]||""),t=i[2]||"",n=String(s.label||s.title||`Space ${r.length+1}`);r.push({id:String(s.id||I(n)),label:n,icon:s.icon?String(s.icon):void 0,tint:s.tint?String(s.tint):void 0,sections:_(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
- ${t.sections.map((n)=>z(n,a)).join("")}
2953
+ </section>`}function K(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 L(a,String(e.selected||"")==="true")}function z(e){let r=[],a=/<@craft-sidebar-section\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-section>)/g,i;while((i=a.exec(e))!==null){let s=E(i[1]||""),t=i[2]||"",o=String(s.id||P(String(s.header||s.title||`section-${r.length+1}`))),c=String(s.header||s.title||o),l=Z(t);r.push({id:o,header:c,title:c,items:l})}return r}function Z(e){let r=[],a=/<@craft-sidebar-item\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-item>)/g,i;while((i=a.exec(e))!==null){let s=E(i[1]||""),t=String(s.label||(i[2]||"").replace(/<[^>]*>/g,"").trim()),o=String(s.id||P(t||`item-${r.length+1}`));r.push({id:o,label:t,icon:s.icon?String(s.icon):void 0,badge:s.badge?String(s.badge):void 0,tintColor:s.tintColor?String(s.tintColor):void 0})}return r}function ee(e){let r=[],a=/<@craft-sidebar-space\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-space>)/g,i;while((i=a.exec(e))!==null){let s=E(i[1]||""),t=i[2]||"",o=String(s.label||s.title||`Space ${r.length+1}`);r.push({id:String(s.id||P(o)),label:o,icon:s.icon?String(s.icon):void 0,tint:s.tint?String(s.tint):void 0,sections:z(t)})}return r}function te(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 re(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>`:""}
2955
+ ${t.sections.map((o)=>M(o,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="${w(e.id)}">
2958
- <div class="craft-sidebar-section-title">${C(a)}</div>
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:${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 I(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 se(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 Xu(e,r){ls[e]=r}function Ju(){return{...ls}}async function L(e,r=[],a={}){if(process.platform!=="darwin")return;for(let n of[...r,e]){let c=a.hardenedRuntime?["--options","runtime"]:[];if(n===e&&a.entitlements)c.push("--entitlements",a.entitlements);let l=Bun.spawn(["/usr/bin/codesign","--force","--sign",a.identity||"-","--timestamp=none",...c,n],{stdout:"pipe",stderr:"pipe"}),[f,p]=await Promise.all([new Response(l.stderr).text(),l.exited]);if(p!==0)throw Error(`Could not sign native bundle ${n}: ${f.trim()}`)}let i=Bun.spawn(["/usr/bin/codesign","--verify","--strict",e],{stdout:"pipe",stderr:"pipe"}),[s,t]=await Promise.all([new Response(i.stderr).text(),i.exited]);if(t!==0)throw Error(`Invalid native bundle signature: ${s.trim()}`)}async function Yo(e){let r=Date.now();try{if(!await Bun.file(e.input).exists())return{success:!1,target:e.target||R(),format:e.format||"app",error:`Input file not found: ${e.input}`};let a=e.target||R(),i=e.format||we(a);if(e.backend&&a!=="macos")throw Error("Native backend bundles currently support macOS only.");if(e.backend&&!q(H(e.backend.entry)))throw Error(`Native backend not found: ${e.backend.entry}`);let s=e.output||o(process.cwd(),"dist","native");if(!q(s))v(s,{recursive:!0});let t=await ni(e.input,{context:e.context,options:{isDev:!1}});if(t=Ko(t,{debug:e.verbose}),t=Jo(t),!t.includes("craft-component-styles")){if(t.includes("</head>"))t=t.replace("</head>",`${Xo}
2965
- </head>`)}let n=e.name||oe(e.input,".stx"),c=e.version||"1.0.0",l=e.craftPath||await he();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 le(t,n,c,s,i,e,l);break;case"windows":f=await ue(t,n,c,s,i,e,l);break;case"linux":f=await be(t,n,c,s,i,e,l);break;case"ios":f=await ge(t,n,c,s,e,l);break;case"android":f=await me(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||R(),format:e.format||"app",error:a.message,duration:Date.now()-r}}}async function le(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");ne(l,{recursive:!0,force:!0}),v(p,{recursive:!0}),v(u,{recursive:!0});let y=o(u,"index.html");await Bun.write(y,e);let g="";if(t.sidebar?.enabled&&t.sidebar?.config)g=o(u,"sidebar-config.json"),await Bun.write(g,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")"`:"",T=t.menubarOnly??t.systemTray,b=t.bundleStyle||(await fe(n)?"executable":"launcher");if(t.backend){S(n,o(p,"craft-runtime")),k(o(p,"craft-runtime"),493);let x=Ce("native-backend");try{let m=o(x,"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
- import handler from ${JSON.stringify(H(t.backend.entry))}
2957
+ <div class="craft-sidebar-space-switcher">${i}</div>`}function ae(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 M(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>
2959
+ ${e.items.map((i)=>L(i,i.id===r)).join("")}
2960
+ </section>`}function L(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 ie(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 se(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[s,t]of Object.entries(e))if(t===!0)i.push(s);else if(t!==!1&&t!==void 0&&t!==null){let o=String(t).replace(/"/g,"&quot;");i.push(`${s}="${o}"`)}return i.join(" ")}function Xu(e,r){ls[e]=r}function Ju(){return{...ls}}import{copyFileSync as oe,mkdtempSync as ce,rmSync as de,writeFileSync as le}from"fs";import{tmpdir as fe}from"os";import{join as A}from"path";async function j(e,r=[],a={}){if(process.platform!=="darwin")return;let i=a.entitlements,s;try{if(a.provisioningProfile){if(!a.identity||a.identity==="-")throw Error("A provisioning profile requires a signing identity.");let l=Bun.spawnSync(["/usr/bin/security","cms","-D","-i",a.provisioningProfile]);if(l.exitCode!==0)throw Error("Could not decode the macOS provisioning profile.");let f=Bun.spawnSync(["/usr/bin/plutil","-extract","Entitlements","json","-o","-","-"],{stdin:l.stdout});if(f.exitCode!==0)throw Error("The macOS profile has no entitlement dictionary.");let u=JSON.parse(f.stdout.toString()),p={};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.");p=JSON.parse(g.stdout.toString())}for(let g of["com.apple.application-identifier","com.apple.developer.team-identifier"])if(u[g])p[g]=u[g];if(s=ce(A(fe(),"stx-entitlements-")),i=A(s,"entitlements.plist"),le(i,JSON.stringify(p)),Bun.spawnSync(["/usr/bin/plutil","-convert","xml1",i]).exitCode!==0)throw Error("Could not generate the provisioned app entitlements.");oe(a.provisioningProfile,A(e,"Contents","embedded.provisionprofile"))}for(let l of[...r,e]){let f=a.hardenedRuntime?["--options","runtime"]:[];if(l===e&&i)f.push("--entitlements",i);let u=a.identity&&a.identity!=="-"?"--timestamp":"--timestamp=none",p=Bun.spawn(["/usr/bin/codesign","--force","--sign",a.identity||"-",u,...f,l],{stdout:"pipe",stderr:"pipe"}),[g,b]=await Promise.all([new Response(p.stderr).text(),p.exited]);if(b!==0)throw Error(`Could not sign native bundle ${l}: ${g.trim()}`)}let t=Bun.spawn(["/usr/bin/codesign","--verify","--strict",e],{stdout:"pipe",stderr:"pipe"}),[o,c]=await Promise.all([new Response(t.stderr).text(),t.exited]);if(c!==0)throw Error(`Invalid native bundle signature: ${o.trim()}`)}finally{if(s)de(s,{recursive:!0,force:!0})}}async function Yo(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||Te(a);if(e.backend&&a!=="macos")throw Error("Native backend bundles currently support macOS only.");if(e.backend&&!F(V(e.backend.entry)))throw Error(`Native backend not found: ${e.backend.entry}`);let s=e.output||n(process.cwd(),"dist","native");if(!F(s))x(s,{recursive:!0});let t=await ni(e.input,{context:e.context,options:{isDev:!1}});if(t=Ko(t,{debug:e.verbose}),t=Jo(t),!t.includes("craft-component-styles")){if(t.includes("</head>"))t=t.replace("</head>",`${Xo}
2965
+ </head>`)}let o=e.name||ue(e.input,".stx"),c=e.version||"1.0.0",l=e.craftPath||await $e();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 me(t,o,c,s,i,e,l);break;case"windows":f=await xe(t,o,c,s,i,e,l);break;case"linux":f=await ye(t,o,c,s,i,e,l);break;case"ios":f=await Se(t,o,c,s,e,l);break;case"android":f=await ke(t,o,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||B(),format:e.format||"app",error:a.message,duration:Date.now()-r}}}async function me(e,r,a,i,s,t,o){let c=t.bundleId||`com.stx.${r.toLowerCase().replace(/[^a-z0-9]/g,"")}`,l=n(i,`${r}.app`),f=n(l,"Contents"),u=n(f,"MacOS"),p=n(f,"Resources");pe(l,{recursive:!0,force:!0}),x(u,{recursive:!0}),x(p,{recursive:!0});let g=n(p,"index.html");await Bun.write(g,e);let b="";if(t.sidebar?.enabled&&t.sidebar?.config)b=n(p,"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 we(o)?"executable":"launcher");if(t.backend){if(!await he(o))throw Error("This Craft runtime does not support bundled backends. Upgrade Craft before building this app.");k(o,n(u,r)),T(n(u,r),493);let y=Ce("native-backend");try{let h=n(y,"launcher.ts"),_=n(import.meta.dir,"native-backend"+(import.meta.path.endsWith(".ts")?".ts":".js"));await Bun.write(h,`import { runNativeBackend } from ${JSON.stringify(_)}
2966
+ import handler from ${JSON.stringify(V(t.backend.entry))}
2967
2967
  await runNativeBackend({ html: ${JSON.stringify(e)}, fetch: handler,
2968
- title: ${JSON.stringify(t.window?.title||r)},
2969
- width: ${t.window?.width||1200}, height: ${t.window?.height||800},
2970
- maxRequestBodySize: ${t.backend.maxRequestBodySize??33554432},
2971
- devTools: ${Boolean(t.devTools)} })
2972
- `);let P=Bun.spawn([process.execPath,"build",m,"--compile","--minify","--no-compile-autoload-bunfig","--no-compile-autoload-dotenv","--outfile",o(p,r)],{stdout:"pipe",stderr:"pipe"}),[B,W,J]=await Promise.all([new Response(P.stdout).text(),new Response(P.stderr).text(),P.exited]);if(J!==0)throw Error(`Native backend compilation failed: ${B}
2973
- ${W}`)}finally{U(x)}}else if(b==="executable"){let x=o(p,r);S(n,x),k(x,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(T)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(u,"craft.json"),`${JSON.stringify(m,null,2)}
2974
- `)}else{let x=o(p,"craft");S(n,x),k(x,493);let m=t.sidebar?.enabled?`--native-sidebar --sidebar-width ${t.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",P=`#!/bin/bash
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",n(u,"stx-backend")],{stdout:"pipe",stderr:"pipe"}),[R,J,Y]=await Promise.all([new Response(I.stdout).text(),new Response(I.stderr).text(),I.exited]);if(Y!==0)throw Error(`Native backend compilation failed: ${R}
2970
+ ${J}`)}finally{U(y)}await Bun.write(n(p,"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=n(u,r);k(o,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(n(p,"craft.json"),`${JSON.stringify(h,null,2)}
2972
+ `)}else{let y=n(u,"craft");k(o,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
2975
2973
  set -euo pipefail
2976
2974
  DIR="$( cd "$( dirname "\${BASH_SOURCE[0]}" )" && pwd )"
2977
2975
  RESOURCES="$DIR/../Resources"
2978
2976
  exec "$DIR/craft" --html-file "$RESOURCES/index.html" \\
2979
- ${[`--title "${t.window?.title||r}"`,`--width ${t.window?.width||1200}`,`--height ${t.window?.height||800}`,t.trayPopover?"--tray-popover":T?"--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 ")}
2980
- `,B=o(p,r);await Bun.write(B,P),k(B,493)}let F=Boolean(t.icon&&await Bun.file(t.icon).exists());if(F)S(t.icon,o(u,"AppIcon.icns"));let V={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(f,"Info.plist"),pe(V)),await L(l,t.backend?[o(p,"craft-runtime")]:b==="launcher"?[o(p,"craft")]:[],t.macosSigning),s==="dmg"){let x=o(i,`${r}-${a}.dmg`),m=await ve(l,x,r);if(!m.success)return{success:!1,target:"macos",format:"dmg",error:m.error};return{success:!0,target:"macos",format:"dmg",outputPath:x}}return{success:!0,target:"macos",format:"app",outputPath:l}}async function fe(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}
2981
- ${i}`.match(/(\d+)\.(\d+)\.(\d+)/);if(!t)return!1;let[n,c,l]=t.slice(1).map(Number);if(n>0||c>0)return!0;return l>=57}catch{return!1}}function j(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function pe(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":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=n(u,r);await Bun.write(R,I),T(R,493)}let D=Boolean(t.icon&&await Bun.file(t.icon).exists());if(D)k(t.icon,n(p,"AppIcon.icns"));let W={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)),...D?{CFBundleIconFile:"AppIcon"}:{},...t.category?{LSApplicationCategoryType:t.category}:{},...t.copyright?{NSHumanReadableCopyright:t.copyright}:{},...t.infoPlist||{}};if(await Bun.write(n(f,"Info.plist"),ve(W)),await j(l,t.backend?[n(u,"stx-backend")]:m==="launcher"?[n(u,"craft")]:[],t.macosSigning),s==="dmg"){let y=n(i,`${r}-${a}.dmg`),h=await Pe(l,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:l}}async function he(e){let r=Bun.spawn([e,"--capabilities"],{stdout:"pipe",stderr:"pipe"}),a=setTimeout(()=>r.kill(),5000);try{let[i,s,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}${s}`.trim()).bundleBackend===!0}catch{return!1}finally{clearTimeout(a)}}async function we(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[o,c,l]=t.slice(1).map(Number);if(o>0||c>0)return!0;return l>=57}catch{return!1}}function H(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ve(e){return`<?xml version="1.0" encoding="UTF-8"?>
2982
2980
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
2983
2981
  <plist version="1.0">
2984
2982
  <dict>
2985
- ${Object.entries(e).map(([a,i])=>{let s=typeof i==="boolean"?`<${i}/>`:typeof i==="number"?`<integer>${i}</integer>`:`<string>${j(String(i))}</string>`;return` <key>${j(a)}</key>
2983
+ ${Object.entries(e).map(([a,i])=>{let s=typeof i==="boolean"?`<${i}/>`:typeof i==="number"?`<integer>${i}</integer>`:`<string>${H(String(i))}</string>`;return` <key>${H(a)}</key>
2986
2984
  ${s}`}).join(`
2987
2985
  `)}
2988
2986
  </dict>
2989
2987
  </plist>
2990
- `}async function ue(e,r,a,i,s,t,n){let c=o(i,r);v(c,{recursive:!0});let l=o(c,"index.html");await Bun.write(l,e),S(n,o(c,"craft.exe"));let f=`@echo off
2988
+ `}async function xe(e,r,a,i,s,t,o){let c=n(i,r);x(c,{recursive:!0});let l=n(c,"index.html");await Bun.write(l,e),k(o,n(c,"craft.exe"));let f=`@echo off
2991
2989
  set DIR=%~dp0
2992
2990
  "%DIR%craft.exe" --html-file "%DIR%index.html" ^
2993
2991
  --title "${t.window?.title||r}" ^
@@ -2995,7 +2993,7 @@ set DIR=%~dp0
2995
2993
  --height ${t.window?.height||800} ^
2996
2994
  ${t.systemTray?"--system-tray":""} ^
2997
2995
  ${t.devTools?"":"--no-devtools"}
2998
- `;if(await Bun.write(o(c,`${r}.bat`),f),s==="zip"){let p=o(i,`${r}-${a}-windows.zip`),u=await xe(c,p);if(!u.success)return{success:!1,target:"windows",format:"zip",error:u.error};return{success:!0,target:"windows",format:"zip",outputPath:p}}return{success:!0,target:"windows",format:"app",outputPath:c}}async function be(e,r,a,i,s,t,n){let c=o(i,r);v(c,{recursive:!0});let l=o(c,"index.html");await Bun.write(l,e);let f=o(c,"craft");S(n,f),k(f,493);let p=`#!/bin/bash
2996
+ `;if(await Bun.write(n(c,`${r}.bat`),f),s==="zip"){let u=n(i,`${r}-${a}-windows.zip`),p=await Ie(c,u);if(!p.success)return{success:!1,target:"windows",format:"zip",error:p.error};return{success:!0,target:"windows",format:"zip",outputPath:u}}return{success:!0,target:"windows",format:"app",outputPath:c}}async function ye(e,r,a,i,s,t,o){let c=n(i,r);x(c,{recursive:!0});let l=n(c,"index.html");await Bun.write(l,e);let f=n(c,"craft");k(o,f),T(f,493);let u=`#!/bin/bash
2999
2997
  set -euo pipefail
3000
2998
  DIR="$( cd "$( dirname "\${BASH_SOURCE[0]}" )" && pwd )"
3001
2999
  exec "$DIR/craft" --html-file "$DIR/index.html" \\
@@ -3004,15 +3002,15 @@ exec "$DIR/craft" --html-file "$DIR/index.html" \\
3004
3002
  --height ${t.window?.height||800} \\
3005
3003
  ${t.systemTray?"--system-tray":""} \\
3006
3004
  ${t.devTools?"":"--no-devtools"}
3007
- `,u=o(c,r.toLowerCase());await Bun.write(u,p),k(u,493);let y=`[Desktop Entry]
3005
+ `,p=n(c,r.toLowerCase());await Bun.write(p,u),T(p,493);let g=`[Desktop Entry]
3008
3006
  Type=Application
3009
3007
  Name=${r}
3010
- Exec=${u}
3008
+ Exec=${p}
3011
3009
  Terminal=false
3012
3010
  Categories=Utility;
3013
- `;if(await Bun.write(o(c,`${r.toLowerCase()}.desktop`),y),s==="deb"){let g=o(i,`${r.toLowerCase()}_${a}_amd64.deb`),h=await ye(c,g,r,a,t);if(!h.success)return{success:!1,target:"linux",format:"deb",error:h.error};return{success:!0,target:"linux",format:"deb",outputPath:g}}if(s==="appimage"){let g=o(i,`${r}-${a}-x86_64.AppImage`),h=await Se(c,g,r,t);if(!h.success)return{success:!1,target:"linux",format:"appimage",error:h.error};return{success:!0,target:"linux",format:"appimage",outputPath:g}}return{success:!0,target:"linux",format:"app",outputPath:c}}async function ge(e,r,a,i,s,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 me(e,r,a,i,s,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.`}}async function he(){if(process.env.CRAFT_BIN&&await Bun.file(process.env.CRAFT_BIN).exists())return process.env.CRAFT_BIN;let e=[o(process.cwd(),"../../craft/packages/zig/zig-out/bin/craft"),o(process.cwd(),"../craft/packages/zig/zig-out/bin/craft"),o(A(),"Code/Tools/craft/packages/zig/zig-out/bin/craft"),o(A(),"Code/craft/packages/zig/zig-out/bin/craft"),"/usr/local/bin/craft","/usr/bin/craft",o(A(),".local/bin/craft"),o(process.env.LOCALAPPDATA||"","craft","craft.exe"),o(process.env.PROGRAMFILES||"","craft","craft.exe")];for(let r of e)if(await Bun.file(r).exists())return r;try{let a=ce("which craft 2>/dev/null || where craft 2>nul",{encoding:"utf-8"}).trim().split(`
3014
- `)[0];if(a&&await Bun.file(a).exists())return a}catch{}return null}function R(){switch(de()){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}function we(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 ve(e,r,a){return new Promise((i)=>{let s=N("hdiutil",["create","-volname",a,"-srcfolder",e,"-ov","-format","UDZO",r]);s.on("close",(t)=>{if(t===0)i({success:!0});else i({success:!1,error:`hdiutil exited with code ${t}`})}),s.on("error",(t)=>{i({success:!1,error:t.message})})})}async function xe(e,r){return new Promise((a)=>{let i=N("zip",["-r",r,"."],{cwd:e});i.on("close",(s)=>{if(s===0)a({success:!0});else a({success:!1,error:`zip exited with code ${s}`})}),i.on("error",(s)=>{a({success:!1,error:s.message})})})}async function ye(e,r,a,i,s){return new Promise((t)=>{let n=Ce("deb");try{let c=o(n,"pkg"),l=o(c,"DEBIAN"),f=o(c,"usr","bin"),p=o(c,"usr","share","applications"),u=o(c,"usr","share",a.toLowerCase());v(l,{recursive:!0}),v(f,{recursive:!0}),v(p,{recursive:!0}),v(u,{recursive:!0});let y=d("fs").readdirSync(e);for(let b of y)S(o(e,b),o(u,b));let g=`#!/bin/bash
3015
- exec /usr/share/${a.toLowerCase()}/${a.toLowerCase()} "$@"`;d("fs").writeFileSync(o(f,a.toLowerCase()),g),k(o(f,a.toLowerCase()),493);let h=`Package: ${a.toLowerCase()}
3011
+ `;if(await Bun.write(n(c,`${r.toLowerCase()}.desktop`),g),s==="deb"){let b=n(i,`${r.toLowerCase()}_${a}_amd64.deb`),w=await Be(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(s==="appimage"){let b=n(i,`${r}-${a}-x86_64.AppImage`),w=await Re(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 Se(e,r,a,i,s,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 ke(e,r,a,i,s,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.`}}async function $e(){if(process.env.CRAFT_BIN&&await Bun.file(process.env.CRAFT_BIN).exists())return process.env.CRAFT_BIN;let e=[n(process.cwd(),"../../craft/packages/zig/zig-out/bin/craft"),n(process.cwd(),"../craft/packages/zig/zig-out/bin/craft"),n(q(),"Code/Tools/craft/packages/zig/zig-out/bin/craft"),n(q(),"Code/craft/packages/zig/zig-out/bin/craft"),"/usr/local/bin/craft","/usr/bin/craft",n(q(),".local/bin/craft"),n(process.env.LOCALAPPDATA||"","craft","craft.exe"),n(process.env.PROGRAMFILES||"","craft","craft.exe")];for(let r of e)if(await Bun.file(r).exists())return r;try{let a=be("which craft 2>/dev/null || where craft 2>nul",{encoding:"utf-8"}).trim().split(`
3012
+ `)[0];if(a&&await Bun.file(a).exists())return a}catch{}return null}function B(){switch(ge()){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}function Te(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 Pe(e,r,a){return new Promise((i)=>{let s=N("hdiutil",["create","-volname",a,"-srcfolder",e,"-ov","-format","UDZO",r]);s.on("close",(t)=>{if(t===0)i({success:!0});else i({success:!1,error:`hdiutil exited with code ${t}`})}),s.on("error",(t)=>{i({success:!1,error:t.message})})})}async function Ie(e,r){return new Promise((a)=>{let i=N("zip",["-r",r,"."],{cwd:e});i.on("close",(s)=>{if(s===0)a({success:!0});else a({success:!1,error:`zip exited with code ${s}`})}),i.on("error",(s)=>{a({success:!1,error:s.message})})})}async function Be(e,r,a,i,s){return new Promise((t)=>{let o=Ce("deb");try{let c=n(o,"pkg"),l=n(c,"DEBIAN"),f=n(c,"usr","bin"),u=n(c,"usr","share","applications"),p=n(c,"usr","share",a.toLowerCase());x(l,{recursive:!0}),x(f,{recursive:!0}),x(u,{recursive:!0}),x(p,{recursive:!0});let g=d("fs").readdirSync(e);for(let m of g)k(n(e,m),n(p,m));let b=`#!/bin/bash
3013
+ exec /usr/share/${a.toLowerCase()}/${a.toLowerCase()} "$@"`;d("fs").writeFileSync(n(f,a.toLowerCase()),b),T(n(f,a.toLowerCase()),493);let w=`Package: ${a.toLowerCase()}
3016
3014
  Version: ${i}
3017
3015
  Section: utils
3018
3016
  Priority: optional
@@ -3020,17 +3018,17 @@ Architecture: amd64
3020
3018
  Depends: libgtk-3-0, libwebkit2gtk-4.0-37
3021
3019
  Maintainer: ${s.author||"Unknown"}
3022
3020
  Description: ${s.description||a}
3023
- `;d("fs").writeFileSync(o(l,"control"),h);let T=N("dpkg-deb",["--build",c,r]);T.on("close",(b)=>{if(U(n),b===0)t({success:!0});else t({success:!1,error:`dpkg-deb exited with code ${b}`})}),T.on("error",(b)=>{U(n),t({success:!1,error:b.message})})}catch(c){U(n),t({success:!1,error:c.message})}})}async function Se(e,r,a,i){return new Promise((s)=>{let t=Ce("appimage");try{let n=o(t,`${a}.AppDir`),c=o(n,"usr"),l=o(c,"bin"),f=o(c,"share");v(l,{recursive:!0}),v(f,{recursive:!0});let p=o(f,a.toLowerCase());v(p,{recursive:!0});let u=d("fs").readdirSync(e);for(let b of u)S(o(e,b),o(p,b));let y=`#!/bin/bash
3021
+ `;d("fs").writeFileSync(n(l,"control"),w);let C=N("dpkg-deb",["--build",c,r]);C.on("close",(m)=>{if(U(o),m===0)t({success:!0});else t({success:!1,error:`dpkg-deb exited with code ${m}`})}),C.on("error",(m)=>{U(o),t({success:!1,error:m.message})})}catch(c){U(o),t({success:!1,error:c.message})}})}async function Re(e,r,a,i){return new Promise((s)=>{let t=Ce("appimage");try{let o=n(t,`${a}.AppDir`),c=n(o,"usr"),l=n(c,"bin"),f=n(c,"share");x(l,{recursive:!0}),x(f,{recursive:!0});let u=n(f,a.toLowerCase());x(u,{recursive:!0});let p=d("fs").readdirSync(e);for(let m of p)k(n(e,m),n(u,m));let g=`#!/bin/bash
3024
3022
  SELF=$(readlink -f "$0")
3025
3023
  HERE=\${SELF%/*}
3026
3024
  export PATH="\${HERE}/usr/bin:\${PATH}"
3027
3025
  exec "\${HERE}/usr/share/${a.toLowerCase()}/${a.toLowerCase()}" "$@"
3028
- `;d("fs").writeFileSync(o(n,"AppRun"),y),k(o(n,"AppRun"),493);let g=`[Desktop Entry]
3026
+ `;d("fs").writeFileSync(n(o,"AppRun"),g),T(n(o,"AppRun"),493);let b=`[Desktop Entry]
3029
3027
  Type=Application
3030
3028
  Name=${a}
3031
3029
  Exec=${a.toLowerCase()}
3032
3030
  Terminal=false
3033
3031
  Categories=Utility;
3034
3032
  Icon=${a.toLowerCase()}
3035
- `;d("fs").writeFileSync(o(n,`${a.toLowerCase()}.desktop`),g);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(d("fs").writeFileSync(o(n,`${a.toLowerCase()}.png`),h),i.icon&&q(i.icon))S(i.icon,o(n,`${a.toLowerCase()}.png`));let T=N("appimagetool",[n,r],{env:{...process.env,ARCH:"x86_64"}});T.on("close",(b)=>{if(U(t),b===0)k(r,493),s({success:!0});else s({success:!1,error:`appimagetool exited with code ${b}. Install from https://appimage.github.io/appimagetool/`})}),T.on("error",(b)=>{U(t),s({success:!1,error:`appimagetool not found: ${b.message}`})})}catch(n){U(t),s({success:!1,error:n.message})}})}function Zo(){return[R()]}function Qo(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 ke={buildNative:Yo,getAvailableTargets:Zo,getAvailableFormats:Qo,detectPlatform:R},Yu=ke;
3033
+ `;d("fs").writeFileSync(n(o,`${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(d("fs").writeFileSync(n(o,`${a.toLowerCase()}.png`),w),i.icon&&F(i.icon))k(i.icon,n(o,`${a.toLowerCase()}.png`));let C=N("appimagetool",[o,r],{env:{...process.env,ARCH:"x86_64"}});C.on("close",(m)=>{if(U(t),m===0)T(r,493),s({success:!0});else s({success:!1,error:`appimagetool exited with code ${m}. Install from https://appimage.github.io/appimagetool/`})}),C.on("error",(m)=>{U(t),s({success:!1,error:`appimagetool not found: ${m.message}`})})}catch(o){U(t),s({success:!1,error:o.message})}})}function Zo(){return[B()]}function Qo(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 Oe={buildNative:Yo,getAvailableTargets:Zo,getAvailableFormats:Qo,detectPlatform:B},Yu=Oe;
3036
3034
  export{Wu,Go,qu,Gu,Ko,ls,Xo,Ku,Jo,Xu,Ju,Yo,Zo,Qo,Yu};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{J,b,xn,Sn,e,Bt,_n,f,Ye,Ft,Ze,Qe,oe,j,ye,Q,u,Ae,Li,Fs,n,r,ie,br,o,P,be}from"./chunk-dqjx14em.js";import{q,jn,ae,O,Wt}from"./chunk-m92q2jyt.js";import{pt,Vn,Ir,Or,Nr,ft,gt,mt,ht,yt,bt,De}from"./chunk-gsp3627d.js";import{He,Io,ce,T,Oo,Gr,Zn,ke,No,le}from"./chunk-ngkxtkh3.js";import{Kt}from"./chunk-dy3hvydn.js";import{fe}from"./chunk-bsts9pr5.js";import{a}from"./chunk-8cqx63aw.js";import{D}from"./chunk-7mkw98cr.js";async function Wn(t){try{let s=await Bun.file(t).text(),i=Xn(s),d=Jn(s,t),c=Yn(s,i),l=Qn(s,i);return{file:t,metrics:i,issues:d,suggestions:c,performance:l}}catch(s){throw Error(`Failed to analyze template ${t}: ${s instanceof Error?s.message:String(s)}`)}}function Xn(t){let s=t.split(`
2
+ import{J,b,xn,Sn,e,Bt,_n,f,Ye,Ft,Ze,Qe,oe,j,ye,Q,u,Ae,Li,Fs,n,r,ie,br,o,P,be}from"./chunk-grg366m9.js";import{q,jn,ae,O,Wt}from"./chunk-m92q2jyt.js";import{pt,Vn,Ir,Or,Nr,ft,gt,mt,ht,yt,bt,De}from"./chunk-gsp3627d.js";import{He,Io,ce,T,Oo,Gr,Zn,ke,No,le}from"./chunk-12677ap2.js";import{Kt}from"./chunk-h3brvxbf.js";import{fe}from"./chunk-bsts9pr5.js";import{a}from"./chunk-8cqx63aw.js";import{D}from"./chunk-7mkw98cr.js";async function Wn(t){try{let s=await Bun.file(t).text(),i=Xn(s),d=Jn(s,t),c=Yn(s,i),l=Qn(s,i);return{file:t,metrics:i,issues:d,suggestions:c,performance:l}}catch(s){throw Error(`Failed to analyze template ${t}: ${s instanceof Error?s.message:String(s)}`)}}function Xn(t){let s=t.split(`
3
3
  `),i=t.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),c=(i?i[1]:"").split(`
4
4
  `).length,l={conditionals:(t.match(/@(if|unless|elseif|else|endif|endunless)\b/g)||[]).length,loops:(t.match(/@(foreach|for|endforeach|endfor|while|endwhile)\b/g)||[]).length,includes:(t.match(/@(include|component|extends|section|yield)\b/g)||[]).length,custom:0,total:0};l.total=l.conditionals+l.loops+l.includes+l.custom;let m=(t.match(/\{\{[\s\S]*?\}\}/g)||[]).length,p=(t.match(/\{!![\s\S]*?!!\}/g)||[]).length,h=(t.match(/@(?:if|unless|elseif|foreach|for|while)\s*\([^)]+\)/g)||[]).length,g=m+p+h,y=(t.match(/<[A-Z][^>]*>/g)||[]).length,w=(t.match(/@(?:layout|extends)\(/g)||[]).length,S=0,R=0;for(let C of s)if(/@(?:if|unless|foreach|for|while|section)\b/.test(C)&&!/@end/.test(C)&&!/@else/.test(C))R++,S=Math.max(S,R);else if(/@end(?:if|unless|foreach|for|while|section)\b/.test(C))R--;let v=S>=4?3:0,x=Math.min(10,Math.ceil(l.total*0.5+g*0.1+y*0.3+(c>10?c*0.05:0)+v));return{lines:s.length,characters:t.length,directives:l,expressions:g,components:y,layouts:w,scriptLines:c,complexity:x}}function Jn(t,s){let i=[],d=Jt(t,"if","endif");if(d>0)i.push({type:"error",category:"syntax",message:`Found ${d} unmatched @if directive(s)`,suggestion:"Ensure every @if has a corresponding @endif"});let c=Jt(t,"foreach","endforeach");if(c>0)i.push({type:"error",category:"syntax",message:`Found ${c} unmatched @foreach directive(s)`,suggestion:"Ensure every @foreach has a corresponding @endforeach"});let l=t.match(/@foreach[\s\S]*?@foreach[\s\S]*?@endforeach[\s\S]*?@endforeach/g);if(l&&l.length>0)i.push({type:"warning",category:"performance",message:"Nested loops detected which may impact performance",suggestion:"Consider preprocessing data or using more efficient data structures"});let m=(t.match(/\{!![\s\S]*?!!\}/g)||[]).length;if(m>0)i.push({type:"warning",category:"security",message:`Found ${m} raw output expression(s) {!! !!}`,suggestion:"Ensure raw outputs are properly sanitized to prevent XSS"});let p=t.match(/<img[^>]*>/g);if(p){let y=p.filter((w)=>!w.includes("alt="));if(y.length>0)i.push({type:"warning",category:"accessibility",message:`Found ${y.length} image(s) without alt attributes`,suggestion:"Add alt attributes to all images for screen reader accessibility"})}let h=t.split(`
5
5
  `).filter((y)=>y.length>120);if(h.length>0)i.push({type:"info",category:"maintainability",message:`Found ${h.length} line(s) longer than 120 characters`,suggestion:"Consider breaking long lines for better readability"});let g=(t.match(/style\s*=\s*["'][^"']*["']/g)||[]).length;if(g>3)i.push({type:"info",category:"maintainability",message:`Found ${g} inline style attributes`,suggestion:"Consider moving styles to CSS classes for better maintainability"});return i}function Yn(t,s){let i=[];if(s.complexity>7)i.push({type:"refactor",message:"Template complexity is high. Consider breaking into smaller components.",impact:"high",effort:"medium"});else if(s.complexity>5&&s.directives.total>8)i.push({type:"optimization",message:"Template has moderate complexity. Consider component extraction for reusability.",impact:"medium",effort:"low"});if(s.lines>100&&s.components===0)i.push({type:"refactor",message:"Large template with no components. Consider extracting reusable parts into components.",impact:"medium",effort:"medium"});if(s.expressions>20)i.push({type:"optimization",message:"Many template expressions detected. Consider preprocessing some data in the script section.",impact:"medium",effort:"low"});let d=t.match(/@foreach[\s\S]*?@foreach[\s\S]*?@endforeach[\s\S]*?@endforeach/g);if(d&&d.length>0)i.push({type:"optimization",message:"Nested loops detected. Consider preprocessing data or optimizing data structures.",impact:"high",effort:"medium"});if(s.directives.total===0&&s.expressions<5)i.push({type:"optimization",message:"Template appears static. Consider enabling aggressive caching.",impact:"high",effort:"low"});if(s.scriptLines>50)i.push({type:"refactor",message:"Large script section. Consider moving complex logic to external modules.",impact:"medium",effort:"medium"});return i}function Qn(t,s){let i=1;if(i+=s.directives.conditionals*0.1,i+=s.directives.loops*0.5,i+=s.directives.includes*2,i+=s.expressions*0.05,i+=s.components*1,s.scriptLines>10)i+=s.scriptLines*0.1;let d;if(s.expressions===0&&s.directives.total===0)d="high";else if(s.expressions<5&&s.directives.total<3)d="medium";else d="low";let c=[];if(i>10)c.push("Consider optimizing template complexity");if(d==="low"&&s.directives.total>5)c.push("Reduce dynamic content for better caching");if(s.components===0&&s.lines>40)c.push("Extract components to improve reusability and performance");return{estimatedRenderTime:Math.round(i*100)/100,complexityScore:s.complexity,cacheability:d,recommendations:c}}function Jt(t,s,i){let d=t.replace(/<!--[\s\S]*?-->/g,""),c=(d.match(new RegExp(`@${s}\\b`,"g"))||[]).length,l=(d.match(new RegExp(`@${i}\\b`,"g"))||[]).length;return Math.abs(c-l)}async function vo(t=["**/*.stx"],s){let i=[],d=[];for(let l of t){let m=await Array.fromAsync(new Bun.Glob(l).scan({cwd:s||process.cwd(),onlyFiles:!0,absolute:!0}));d.push(...m.filter((p)=>p.endsWith(".stx")))}for(let l of d)try{let m=await Wn(l);i.push(m)}catch(m){console.warn(`Failed to analyze ${l}:`,m)}let c=er(i);return{results:i,summary:c}}function er(t){let s=t.length,i=t.reduce((g,y)=>g+y.metrics.lines,0),d=s>0?t.reduce((g,y)=>g+y.metrics.complexity,0)/s:0,c=t.reduce((g,y)=>g+y.issues.length,0),l={};t.forEach((g)=>{g.issues.forEach((y)=>{l[y.category]=(l[y.category]||0)+1})});let m=s>0?t.reduce((g,y)=>g+y.performance.estimatedRenderTime,0)/s:0,p=Math.max(1,Math.min(10,Math.round(10-m/2-d/2))),h=[];if(d>6)h.push("Project has high average complexity. Consider refactoring complex templates.");if(c>s*2)h.push("High number of issues detected. Run detailed analysis on individual files.");if(l.security>0)h.push("Security issues found. Review raw output usage and input sanitization.");return{totalFiles:s,totalLines:i,avgComplexity:Math.round(d*100)/100,totalIssues:c,issuesByCategory:l,performanceScore:p,recommendations:h}}import{mkdir as tr,readFile as nr,readdir as rr,stat as Yt,writeFile as or}from"fs/promises";import Re from"path";function rn(t){if(t==="connectedCallback")return`method "${t}" is reserved; define "onConnect" instead, which the element calls once it is connected, rendered and bound`;if(t==="disconnectedCallback")return`method "${t}" is reserved; define "onDisconnect" instead, which the element calls as it leaves the DOM, before it releases its own listeners`;return`method "${t}" is reserved`}var on=new Set(["constructor","connectedCallback","disconnectedCallback","attributeChangedCallback","adoptedCallback"]);function sr(t){return t.replace(/\.stx$/i,"").split(/[^a-z0-9]+/i).filter(Boolean).map((s)=>s.charAt(0).toUpperCase()+s.slice(1)).join("")}function It(t){return t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[^a-z0-9]+/gi,"-").replace(/^-+|-+$/g,"").toLowerCase()}function ir(t){return/^[a-z][.0-9_a-z-]*-[.0-9_a-z-]*$/.test(t)&&!t.startsWith("xml")&&!/[A-Z]/.test(t)}function ar(t){if(t===!0)return"open";if(t==="open"||t==="closed")return t;return!1}async function cr(t){let s=[];async function i(d){let c=await rr(d,{withFileTypes:!0});c.sort((l,m)=>l.name.localeCompare(m.name));for(let l of c){let m=Re.join(d,l.name);if(l.isDirectory()){if(!l.name.startsWith(".")&&l.name!=="node_modules")await i(m)}else if(l.isFile()&&l.name.endsWith(".stx")&&!/\.(?:test|spec)\.stx$/i.test(l.name))s.push(m)}}return await i(t),s}function lr(t,s){let i=t.match(/<script\b(?=[^>]*(?:\bcomponent\b|\bstx:component\b))[^>]*>([\s\S]*?)<\/script>/i);if(!i)return{};let d=i[1].trim();if(!d)return{};try{return JSON.parse(d)}catch(c){throw Error(`${s}: <script component> must contain JSON metadata (${c.message})`)}}function dr(t,s){let i={},d=[...t.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi)];for(let c of d){if(!/\bclient\b/i.test(c[1])||/\bcomponent\b|\bstx:component\b/i.test(c[1]))continue;let l;try{l=new Bun.Transpiler({loader:"ts"}).transformSync(c[2])}catch(h){throw Error(`${s}: failed to transpile <script client> (${h.message})`)}let m=/(?:export\s+)?(?:async\s+)?function\s+([A-Za-z_$][\w$]*)\s*\(([^)]*)\)\s*\{/g,p;while(p=m.exec(l)){let h=p[1];if(on.has(h))throw Error(`${s}: client ${rn(h)}`);let g=m.lastIndex,y=1,w="",S=!1,R=g;for(;R<l.length&&y>0;R++){let x=l[R];if(S){S=!1;continue}if(w){if(x==="\\")S=!0;else if(x===w)w="";continue}if(x==='"'||x==="'"||x==="`")w=x;else if(x==="{")y++;else if(x==="}")y--}if(y!==0)throw Error(`${s}: unterminated client function "${h}"`);let v=p[0].includes("async")?"async ":"";i[h]=`${v}${h}(${p[2]}) {${l.slice(g,R-1)}}`,m.lastIndex=R}}return i}function pr(t){let s=t.match(/<template\b(?![^>]*\bshadowrootmode\b)[^>]*>([\s\S]*?)<\/template>/i);return(s?s[1]:t).replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"").trim()}function Qt(t){return[...t.matchAll(/<style\b[^>]*>([\s\S]*?)<\/style>/gi)].map((s)=>s[1].trim()).filter(Boolean).join(`
@@ -876,7 +876,7 @@ else {
876
876
  };
877
877
  })();
878
878
  </script>
879
- `}function Ve(t,s,i={}){let d=Kr(s,i),c=t.lastIndexOf("</body>");if(c!==-1)return t.slice(0,c)+d+t.slice(c);if(t.includes("</html>"))return t.replace("</html>",`${d}</html>`);return t+d}function $t(t){let s=t.toLowerCase();return s.endsWith(".css")||s.endsWith(".scss")||s.endsWith(".sass")||s.endsWith(".less")}function Ct(t){let s=t.toLowerCase();return[".stx",".html",".htm",".md",".js",".ts",".jsx",".tsx",".json"].some((d)=>s.endsWith(d))}function Rt(t){return[/^\./,/node_modules/,/\.stx\/output/,/\.stx\/cache/,/~$/,/\.swp$/,/\.swo$/].some((i)=>i.test(t))}var st=null;function Et(t){if(!st)st=new an(t);return st}function lt(){if(st)st.stop(),st=null}import Pt from"path";var it={name:"bun-plugin-stx",async setup(t){let i={...await o(),...t.config?.stx},d=new Set,c=i.webComponents?.enabled?`./${Pt.relative(Pt.dirname(t.config?.outdir||"dist"),i.webComponents.outputDir||"dist/web-components")}`:"/web-components",l=[];if(i.webComponents?.enabled)try{let m=await br(i,d);if(l.push(...m),i.debug&&m.length>0)console.log(`Successfully built ${m.length} web components`)}catch(m){console.error("Failed to build web components:",m)}t.onLoad({filter:/\.stx$/},async({path:m})=>{try{let p=new Set;if(i.cache&&i.cachePath){let x=await xn(m,i);if(x){if(i.debug)console.log(`Using cached version of ${m}`);return{contents:x,loader:"html"}}}let h=await ae(()=>Bun.file(m).text(),"",(x)=>{throw new jn(`Failed to read stx file: ${m}`,m,void 0,void 0,`File read error: ${x.message}`)});if(!h)throw new jn(`stx file is empty: ${m}`,m);let{scriptContent:g,templateContent:y,allScripts:w}=J.time("script-extraction",()=>{let x=h,C=oe(h);if(C)x=C.content.trim();let k=h.match(/<script\b[^>]*>[\s\S]*?<\/script>/gi)||[],B="",_=[];for(let E of k){let L=E.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i)?.[1]||"",F=E.match(/<script\b([^>]*)>/i),K=F?F[1]:"";if(/\bserver\b/i.test(K))B=L;else _.push(E)}let I=x.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"");return{scriptContent:B,templateContent:I,allScripts:_}}),S={__filename:m,__dirname:Pt.dirname(m),__stx:{webComponentsPath:c,builtComponents:l}};await ae(()=>u(g,S,m),void 0,(x)=>{let C=new q(`Script execution failed in ${m}: ${x.message}`,m,void 0,void 0,g.substring(0,100));if(O.log(C,{filePath:m,scriptContent:g}),i.debug)throw C});let v=await J.timeAsync("directive-processing",async()=>await n(y,S,m,i,p));if(w.length>0){let{interpolateScriptsInTemplate:x}=await import("./chunk-n95243ry.js"),C=x(w.join(`
879
+ `}function Ve(t,s,i={}){let d=Kr(s,i),c=t.lastIndexOf("</body>");if(c!==-1)return t.slice(0,c)+d+t.slice(c);if(t.includes("</html>"))return t.replace("</html>",`${d}</html>`);return t+d}function $t(t){let s=t.toLowerCase();return s.endsWith(".css")||s.endsWith(".scss")||s.endsWith(".sass")||s.endsWith(".less")}function Ct(t){let s=t.toLowerCase();return[".stx",".html",".htm",".md",".js",".ts",".jsx",".tsx",".json"].some((d)=>s.endsWith(d))}function Rt(t){return[/^\./,/node_modules/,/\.stx\/output/,/\.stx\/cache/,/~$/,/\.swp$/,/\.swo$/].some((i)=>i.test(t))}var st=null;function Et(t){if(!st)st=new an(t);return st}function lt(){if(st)st.stop(),st=null}import Pt from"path";var it={name:"bun-plugin-stx",async setup(t){let i={...await o(),...t.config?.stx},d=new Set,c=i.webComponents?.enabled?`./${Pt.relative(Pt.dirname(t.config?.outdir||"dist"),i.webComponents.outputDir||"dist/web-components")}`:"/web-components",l=[];if(i.webComponents?.enabled)try{let m=await br(i,d);if(l.push(...m),i.debug&&m.length>0)console.log(`Successfully built ${m.length} web components`)}catch(m){console.error("Failed to build web components:",m)}t.onLoad({filter:/\.stx$/},async({path:m})=>{try{let p=new Set;if(i.cache&&i.cachePath){let x=await xn(m,i);if(x){if(i.debug)console.log(`Using cached version of ${m}`);return{contents:x,loader:"html"}}}let h=await ae(()=>Bun.file(m).text(),"",(x)=>{throw new jn(`Failed to read stx file: ${m}`,m,void 0,void 0,`File read error: ${x.message}`)});if(!h)throw new jn(`stx file is empty: ${m}`,m);let{scriptContent:g,templateContent:y,allScripts:w}=J.time("script-extraction",()=>{let x=h,C=oe(h);if(C)x=C.content.trim();let k=h.match(/<script\b[^>]*>[\s\S]*?<\/script>/gi)||[],B="",_=[];for(let E of k){let L=E.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i)?.[1]||"",F=E.match(/<script\b([^>]*)>/i),K=F?F[1]:"";if(/\bserver\b/i.test(K))B=L;else _.push(E)}let I=x.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"");return{scriptContent:B,templateContent:I,allScripts:_}}),S={__filename:m,__dirname:Pt.dirname(m),__stx:{webComponentsPath:c,builtComponents:l}};await ae(()=>u(g,S,m),void 0,(x)=>{let C=new q(`Script execution failed in ${m}: ${x.message}`,m,void 0,void 0,g.substring(0,100));if(O.log(C,{filePath:m,scriptContent:g}),i.debug)throw C});let v=await J.timeAsync("directive-processing",async()=>await n(y,S,m,i,p));if(w.length>0){let{interpolateScriptsInTemplate:x}=await import("./chunk-hrdnz5q9.js"),C=x(w.join(`
880
880
  `),S),k=v.search(/<\/body>/i);if(k!==-1)v=v.slice(0,k)+C+`
881
881
  `+v.slice(k);else v+=`
882
882
  ${C}`}if(v=await Q(v),p.forEach((x)=>d.add(x)),i.cache&&i.cachePath){if(await Sn(m,v,p,i),i.debug)console.log(`Cached template ${m} with ${p.size} dependencies`)}return{contents:v,loader:"html"}}catch(p){let h=p instanceof Error?p:new q(`Plugin processing failed: ${String(p)}`,m);if(O.log(h,{filePath:m,buildConfig:t.config}),Wt.logDetailedError(h,{filePath:m,plugin:"bun-plugin-stx"}),i.debug)console.error("stx Plugin Error:",h);let g=h,y=g.line||null,w=g.context||null;return{contents:i.debug||D()?`<!DOCTYPE html>
@@ -939,7 +939,7 @@ ${C}`}if(v=await Q(v),p.forEach((x)=>d.add(x)),i.cache&&i.cachePath){if(await Sn
939
939
  <h1>Something went wrong</h1>
940
940
  <p>An internal error occurred. Please try again later.</p>
941
941
  </body>
942
- </html>`,loader:"html"}}})}};async function qn(t,s={}){let i=s.port||3000,d=s.watch!==!1,c=s.hotReload!==!1&&d,l=null,m=s.hmrPort||i+1,p=ve.resolve(t);if(!Be.existsSync(p))return console.error(`${e.red}Error: File not found: ${e.bright}${p}${e.reset}`),!1;if(p.endsWith(".md"))return zt(p,s);else if(!p.endsWith(".stx"))return console.error(`${e.red}Error: Unsupported file type: ${e.bright}${p}${e.reset}. Only .stx and .md files are supported.`),!1;let h=a(process.cwd(),"output");Be.mkdirSync(h,{recursive:!0}),console.log(`${e.blue}Building ${e.bright}${t}${e.reset}...`);let g=null,y=async()=>{try{let L={name:"public-assets",setup(Te){Te.onResolve({filter:/^\/(images|fonts|assets|public)\//},(me)=>({path:me.path,external:!0}))}},F=await Bun.build({entrypoints:[p],outdir:h,plugins:[L,it],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...s.stxOptions});if(!F.success)return console.error(`${e.red}Build failed:${e.reset}`,F.logs),!1;let K=F.outputs.find((Te)=>Te.path.endsWith(".html"));if(!K)return console.error(`${e.red}No HTML output found${e.reset}`),!1;return g=await Bun.file(K.path).text(),!0}catch(L){return console.error(`${e.red}Error building stx file:${e.reset}`,L),!1}};if(!await y())return!1;let S=ve.dirname(p);await Bt(S);let R=i;try{if(R=await Xe(i),R!==i)console.log(`${e.yellow}Port ${i} is busy, using port ${R} instead${e.reset}`)}catch{return console.error(`${e.red}Could not find an available port${e.reset}`),!1}if(c){let L=s.hmrPort||R+1;l=Et({wsPort:L,verbose:!1}),m=l.start(L)}let v={},x=null,C;try{let{loadStxConfig:L}=await import("./chunk-fhhen33c.js"),F=await L();if(C=s.stxOptions?.serverApi??F.serverApi,F?.apiRouter)x=F?.apiRouter,console.log(`${e.blue}Using custom router for API handling${e.reset}`);if(F?.apiRoutes){v=F.apiRoutes;let K=Object.keys(v).length;if(K>0)console.log(`${e.blue}Loaded ${e.bright}${K} API route${K>1?"s":""}${e.reset}`)}if(F?.broadcasting?.enabled)try{let{startBroadcasting:K,loadChannels:Z}=await import("./chunk-b2teprjf.js"),Te=F.broadcasting;await K(Te);let me=Te.port??6001;console.log(`${e.magenta}Broadcasting on ${e.cyan}ws://localhost:${me}/ws${e.reset}`);let Pe=ve.join(process.cwd(),"channels.ts");if(Be.existsSync(Pe))try{let ne=await Z(Pe);console.log(`${e.blue}Loaded ${e.bright}${ne} broadcast channel${ne!==1?"s":""}${e.blue} from channels.ts${e.reset}`)}catch(ne){console.warn(`${e.yellow}Failed to load channels.ts: ${ne.message}${e.reset}`)}}catch(K){console.warn(`${e.yellow}Broadcasting failed to start: ${K.message}${e.reset}`)}}catch{}let{createServerApi:k,isServerApiSource:B}=await import("./chunk-5x83f835.js"),_=await k(process.cwd(),C);if(console.log(`${e.blue}Starting server on ${e.cyan}http://localhost:${R}/${e.reset}...`),c)console.log(`${e.magenta}Hot reload enabled on ws://localhost:${m}${e.reset}`);let I=Xr({port:R,async fetch(L){return Kt(L,await(async()=>{let F=new URL(L.url);if([h,ve.dirname(p),ve.join(process.cwd(),"public")].some((ne)=>B(ve.join(ne,F.pathname),process.cwd(),C)))return new Response("Not Found",{status:404});if(x)try{let ne=await x.handleRequest(L);if(ne.status!==404)return ne}catch{}if(v[F.pathname])try{return await v[F.pathname](L)}catch(ne){return new Response(JSON.stringify({error:ne.message}),{status:500,headers:{"Content-Type":"application/json"}})}let K=await _(L);if(K)return K;if(F.pathname==="/")return(async()=>{let U=await f(g||"");if(c)U=Ve(U,m);if(s.native)if(U.includes("<head>"))U=U.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else if(U.includes("<html"))U=U.replace(/(<html[^>]*>)/,"$1<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>");else U="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+U;if(s.titlebarHidden)if(U.includes("<head>"))U=U.replace("<head>","<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script>");else if(U.includes("<html"))U=U.replace(/(<html[^>]*>)/,"$1<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>");else U=`<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>${U}`;return U})().then((U)=>new Response(U,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}}));let Z=ve.join(h,F.pathname);if(Be.existsSync(Z)&&Be.statSync(Z).isFile()){let ne=Bun.file(Z),U=ve.extname(Z).toLowerCase(),H="text/plain";if(U===".ts"||U===".tsx"){let Fe=new Bun.Transpiler({loader:U===".tsx"?"tsx":"ts"}),Ue=await ne.text(),tt=Fe.transformSync(Ue);return new Response(tt,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(U){case".html":H="text/html";break;case".css":H="text/css";break;case".js":H="text/javascript";break;case".json":H="application/json";break;case".png":H="image/png";break;case".jpg":case".jpeg":H="image/jpeg";break;case".gif":H="image/gif";break;case".woff":H="font/woff";break;case".woff2":H="font/woff2";break;case".ttf":H="font/ttf";break;case".otf":H="font/otf";break;case".eot":H="application/vnd.ms-fontobject";break}return new Response(ne,{headers:{"Content-Type":H}})}let Te=ve.dirname(p),me=ve.join(Te,F.pathname);if(Be.existsSync(me)&&Be.statSync(me).isFile()){let ne=Bun.file(me),U=ve.extname(me).toLowerCase(),H="text/plain";if(U===".ts"||U===".tsx"){let Fe=new Bun.Transpiler({loader:U===".tsx"?"tsx":"ts"}),Ue=await ne.text(),tt=Fe.transformSync(Ue);return new Response(tt,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(U){case".html":H="text/html";break;case".css":H="text/css";break;case".js":H="text/javascript";break;case".json":H="application/json";break;case".png":H="image/png";break;case".jpg":case".jpeg":H="image/jpeg";break;case".gif":H="image/gif";break;case".svg":H="image/svg+xml";break;case".ico":H="image/x-icon";break;case".woff":H="font/woff";break;case".woff2":H="font/woff2";break;case".ttf":H="font/ttf";break;case".otf":H="font/otf";break;case".eot":H="application/vnd.ms-fontobject";break}return new Response(ne,{headers:{"Content-Type":H}})}let Pe=ve.join(process.cwd(),"public",F.pathname);if(Be.existsSync(Pe)&&Be.statSync(Pe).isFile()){let ne=Bun.file(Pe),U=ve.extname(Pe).toLowerCase(),H="application/octet-stream";if(U===".ts"||U===".tsx"){let Fe=new Bun.Transpiler({loader:U===".tsx"?"tsx":"ts"}),Ue=await ne.text(),tt=Fe.transformSync(Ue);return new Response(tt,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(U){case".html":H="text/html";break;case".css":H="text/css";break;case".js":H="text/javascript";break;case".json":H="application/json";break;case".png":H="image/png";break;case".jpg":case".jpeg":H="image/jpeg";break;case".gif":H="image/gif";break;case".svg":H="image/svg+xml";break;case".ico":H="image/x-icon";break;case".woff":H="font/woff";break;case".woff2":H="font/woff2";break;case".ttf":H="font/ttf";break;case".otf":H="font/otf";break;case".eot":H="application/vnd.ms-fontobject";break}return new Response(ne,{headers:{"Content-Type":H}})}return new Response("Not Found",{status:404})})())},error(L){return new Response(`<pre>${L}
942
+ </html>`,loader:"html"}}})}};async function qn(t,s={}){let i=s.port||3000,d=s.watch!==!1,c=s.hotReload!==!1&&d,l=null,m=s.hmrPort||i+1,p=ve.resolve(t);if(!Be.existsSync(p))return console.error(`${e.red}Error: File not found: ${e.bright}${p}${e.reset}`),!1;if(p.endsWith(".md"))return zt(p,s);else if(!p.endsWith(".stx"))return console.error(`${e.red}Error: Unsupported file type: ${e.bright}${p}${e.reset}. Only .stx and .md files are supported.`),!1;let h=a(process.cwd(),"output");Be.mkdirSync(h,{recursive:!0}),console.log(`${e.blue}Building ${e.bright}${t}${e.reset}...`);let g=null,y=async()=>{try{let L={name:"public-assets",setup(Te){Te.onResolve({filter:/^\/(images|fonts|assets|public)\//},(me)=>({path:me.path,external:!0}))}},F=await Bun.build({entrypoints:[p],outdir:h,plugins:[L,it],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...s.stxOptions});if(!F.success)return console.error(`${e.red}Build failed:${e.reset}`,F.logs),!1;let K=F.outputs.find((Te)=>Te.path.endsWith(".html"));if(!K)return console.error(`${e.red}No HTML output found${e.reset}`),!1;return g=await Bun.file(K.path).text(),!0}catch(L){return console.error(`${e.red}Error building stx file:${e.reset}`,L),!1}};if(!await y())return!1;let S=ve.dirname(p);await Bt(S);let R=i;try{if(R=await Xe(i),R!==i)console.log(`${e.yellow}Port ${i} is busy, using port ${R} instead${e.reset}`)}catch{return console.error(`${e.red}Could not find an available port${e.reset}`),!1}if(c){let L=s.hmrPort||R+1;l=Et({wsPort:L,verbose:!1}),m=l.start(L)}let v={},x=null,C;try{let{loadStxConfig:L}=await import("./chunk-ek5vrw4r.js"),F=await L();if(C=s.stxOptions?.serverApi??F.serverApi,F?.apiRouter)x=F?.apiRouter,console.log(`${e.blue}Using custom router for API handling${e.reset}`);if(F?.apiRoutes){v=F.apiRoutes;let K=Object.keys(v).length;if(K>0)console.log(`${e.blue}Loaded ${e.bright}${K} API route${K>1?"s":""}${e.reset}`)}if(F?.broadcasting?.enabled)try{let{startBroadcasting:K,loadChannels:Z}=await import("./chunk-b2teprjf.js"),Te=F.broadcasting;await K(Te);let me=Te.port??6001;console.log(`${e.magenta}Broadcasting on ${e.cyan}ws://localhost:${me}/ws${e.reset}`);let Pe=ve.join(process.cwd(),"channels.ts");if(Be.existsSync(Pe))try{let ne=await Z(Pe);console.log(`${e.blue}Loaded ${e.bright}${ne} broadcast channel${ne!==1?"s":""}${e.blue} from channels.ts${e.reset}`)}catch(ne){console.warn(`${e.yellow}Failed to load channels.ts: ${ne.message}${e.reset}`)}}catch(K){console.warn(`${e.yellow}Broadcasting failed to start: ${K.message}${e.reset}`)}}catch{}let{createServerApi:k,isServerApiSource:B}=await import("./chunk-jtk2p5p0.js"),_=await k(process.cwd(),C);if(console.log(`${e.blue}Starting server on ${e.cyan}http://localhost:${R}/${e.reset}...`),c)console.log(`${e.magenta}Hot reload enabled on ws://localhost:${m}${e.reset}`);let I=Xr({port:R,async fetch(L){return Kt(L,await(async()=>{let F=new URL(L.url);if([h,ve.dirname(p),ve.join(process.cwd(),"public")].some((ne)=>B(ve.join(ne,F.pathname),process.cwd(),C)))return new Response("Not Found",{status:404});if(x)try{let ne=await x.handleRequest(L);if(ne.status!==404)return ne}catch{}if(v[F.pathname])try{return await v[F.pathname](L)}catch(ne){return new Response(JSON.stringify({error:ne.message}),{status:500,headers:{"Content-Type":"application/json"}})}let K=await _(L);if(K)return K;if(F.pathname==="/")return(async()=>{let U=await f(g||"");if(c)U=Ve(U,m);if(s.native)if(U.includes("<head>"))U=U.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else if(U.includes("<html"))U=U.replace(/(<html[^>]*>)/,"$1<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>");else U="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+U;if(s.titlebarHidden)if(U.includes("<head>"))U=U.replace("<head>","<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script>");else if(U.includes("<html"))U=U.replace(/(<html[^>]*>)/,"$1<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>");else U=`<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>${U}`;return U})().then((U)=>new Response(U,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}}));let Z=ve.join(h,F.pathname);if(Be.existsSync(Z)&&Be.statSync(Z).isFile()){let ne=Bun.file(Z),U=ve.extname(Z).toLowerCase(),H="text/plain";if(U===".ts"||U===".tsx"){let Fe=new Bun.Transpiler({loader:U===".tsx"?"tsx":"ts"}),Ue=await ne.text(),tt=Fe.transformSync(Ue);return new Response(tt,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(U){case".html":H="text/html";break;case".css":H="text/css";break;case".js":H="text/javascript";break;case".json":H="application/json";break;case".png":H="image/png";break;case".jpg":case".jpeg":H="image/jpeg";break;case".gif":H="image/gif";break;case".woff":H="font/woff";break;case".woff2":H="font/woff2";break;case".ttf":H="font/ttf";break;case".otf":H="font/otf";break;case".eot":H="application/vnd.ms-fontobject";break}return new Response(ne,{headers:{"Content-Type":H}})}let Te=ve.dirname(p),me=ve.join(Te,F.pathname);if(Be.existsSync(me)&&Be.statSync(me).isFile()){let ne=Bun.file(me),U=ve.extname(me).toLowerCase(),H="text/plain";if(U===".ts"||U===".tsx"){let Fe=new Bun.Transpiler({loader:U===".tsx"?"tsx":"ts"}),Ue=await ne.text(),tt=Fe.transformSync(Ue);return new Response(tt,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(U){case".html":H="text/html";break;case".css":H="text/css";break;case".js":H="text/javascript";break;case".json":H="application/json";break;case".png":H="image/png";break;case".jpg":case".jpeg":H="image/jpeg";break;case".gif":H="image/gif";break;case".svg":H="image/svg+xml";break;case".ico":H="image/x-icon";break;case".woff":H="font/woff";break;case".woff2":H="font/woff2";break;case".ttf":H="font/ttf";break;case".otf":H="font/otf";break;case".eot":H="application/vnd.ms-fontobject";break}return new Response(ne,{headers:{"Content-Type":H}})}let Pe=ve.join(process.cwd(),"public",F.pathname);if(Be.existsSync(Pe)&&Be.statSync(Pe).isFile()){let ne=Bun.file(Pe),U=ve.extname(Pe).toLowerCase(),H="application/octet-stream";if(U===".ts"||U===".tsx"){let Fe=new Bun.Transpiler({loader:U===".tsx"?"tsx":"ts"}),Ue=await ne.text(),tt=Fe.transformSync(Ue);return new Response(tt,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(U){case".html":H="text/html";break;case".css":H="text/css";break;case".js":H="text/javascript";break;case".json":H="application/json";break;case".png":H="image/png";break;case".jpg":case".jpeg":H="image/jpeg";break;case".gif":H="image/gif";break;case".svg":H="image/svg+xml";break;case".ico":H="image/x-icon";break;case".woff":H="font/woff";break;case".woff2":H="font/woff2";break;case".ttf":H="font/ttf";break;case".otf":H="font/otf";break;case".eot":H="application/vnd.ms-fontobject";break}return new Response(ne,{headers:{"Content-Type":H}})}return new Response("Not Found",{status:404})})())},error(L){return new Response(`<pre>${L}
943
943
  ${L.stack}</pre>`,{headers:{"Content-Type":"text/html"}})}});console.clear(),console.log(`
944
944
  ${e.blue}stx${e.reset} ${e.green}${process.env.stx_VERSION||"v0.0.10"}${e.reset} ${e.dim}ready in ${Math.random()*10+5|0}.${Math.random()*90+10|0} ms${e.reset}`),console.log(`
945
945
  ${e.bright}\u2192 ${e.cyan}http://localhost:${R}/${e.reset}`),console.log(`
@@ -1426,12 +1426,12 @@ ${v.stack}</pre>`,{headers:{"Content-Type":"text/html"}})}});console.clear(),con
1426
1426
  ${e.blue}stx${e.reset} ${e.green}${process.env.stx_VERSION||"v0.0.10"}${e.reset} ${e.dim}ready in ${Math.random()*10+5|0}.${Math.random()*90+10|0} ms${e.reset}`),console.log(`
1427
1427
  ${e.bright}\u2192 ${e.cyan}http://localhost:${y}/${e.reset}`),console.log(`
1428
1428
  ${e.yellow}Routes:${e.reset}`);let S=new Set(p.map((v)=>v.routeTemplate)),R=Object.entries(m).filter(([v])=>!S.has(v)).sort(([v],[x])=>v.localeCompare(x)).map(([v,x])=>({route:v==="/"?"/":v,filePath:Ee.relative(process.cwd(),x.filePath),fileType:x.fileType}));for(let v of p){let x=v.routeTemplate.replace(/\[([^\]]+)\]/g,":$1");R.push({route:x,filePath:Ee.relative(process.cwd(),v.filePath),fileType:"stx"})}if(R.sort((v,x)=>v.route.localeCompare(x.route)),R.forEach((v,x)=>{let k=x===R.length-1?"\u2514\u2500 ":"\u251C\u2500 ",B=v.fileType==="md"?`${e.magenta}(markdown)${e.reset}`:"";console.log(` ${e.green}${k}${v.route}${e.reset} \u2192 ${e.bright}${v.filePath}${e.reset} ${B}`)}),console.log(`
1429
- Press ${e.cyan}h${e.reset} + ${e.cyan}Enter${e.reset} to show shortcuts`),Ge(w.url.toString(),()=>{if(d)Je.watch(l,{recursive:!0}).close();w.stop()}),d){console.log(`${e.blue}Watching for changes...${e.reset}`);let v=Je.watch(l,{recursive:!0},async(x,C)=>{if(!C)return;if(C.endsWith(".stx")||C.endsWith(".js")||C.endsWith(".ts")||C.endsWith(".md"))console.log(`${e.yellow}File ${e.bright}${C}${e.yellow} changed, rebuilding...${e.reset}`),Ae.clear(),ie(),await h()});process.on("SIGINT",()=>{v.close(),w.stop(),process.exit(0)})}return!0}function ln(t){return String(t??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var{serve:Yr}=globalThis.Bun;import he from"fs";import te from"path";async function pn(t){try{return Ft(await Bun.file(t).text())}catch{return}}function Nt(t){let s=Bun.file(t),i=te.extname(t).toLowerCase(),d={".html":"text/html",".css":"text/css",".js":"text/javascript",".json":"application/json",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".ico":"image/x-icon",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"},l=[".js",".css",".json"].includes(i)?{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}:{};return new Response(s,{headers:{"Content-Type":d[i]||"application/octet-stream",...l}})}async function Kn(t=".",s={}){let i=s.port||3000,d=s.watch!==!1,c=s.hotReload!==!1&&d,l=null,m=s.hmrPort||i+1,p=te.resolve(t),{loadStxConfig:h}=await import("./chunk-fhhen33c.js"),g=await h(p),{createServerApi:y,isServerApiSource:w}=await import("./chunk-5x83f835.js"),S=s.stxOptions?.serverApi??g.serverApi,R=await y(p,S),v=g.root&&g.root!=="."?te.join(p,g.root):p,x=s.pagesDir||g.pagesDir||"pages",C=te.join(v,x);if(!he.existsSync(C)&&!g._layerPageDirs?.some((A)=>he.existsSync(A)))return console.error(`${e.red}Error: No '${x}' directory found${e.reset}`),console.log(`${e.dim}Looked in: ${e.bright}${C}${e.reset}`),console.log(`${e.dim}Run stx dev from the app directory, pass it as an argument (stx dev <dir>),${e.reset}`),console.log(`${e.dim}point at another directory with --pages <dir>, or set pagesDir in stx.config.ts.${e.reset}`),console.log(`${e.dim}Starting fresh? Create ${x}/index.stx for the homepage.${e.reset}`),!1;let k=j(v,{pagesDir:x,pagesDirs:g._layerPageDirs?[C,...g._layerPageDirs.slice(1)]:void 0});if(k.length===0)return console.error(`${e.red}Error: No page files found in ${e.bright}${C}${e.reset}`),!1;console.log(`${e.blue}Found ${e.bright}${k.length}${e.blue} routes${e.reset}`);let B=g?._pluginPageDirs||[],_=[];for(let{dir:A,prefix:z}of B)if(he.existsSync(A)){let N=j(te.dirname(A),{pagesDir:te.basename(A)});for(let W of N){let xe=z==="/"?W.pattern:`${z}${W.pattern==="/"?"":W.pattern}`;_.push({route:{...W,pattern:xe},prefix:z})}if(N.length>0)console.log(`${e.blue}Plugin pages: ${e.bright}${N.length}${e.blue} routes at ${e.cyan}${z}${e.reset}`)}let I=new Map,E=null,L=null;if(s.stxOptions?.shell!==!1){if(L=await Oo(p,s.stxOptions?.shell),L){if(E=await Gr(L,s.stxOptions||{}),E)console.log(`${e.blue}Using app shell: ${e.bright}${te.relative(p,L)}${e.reset} ${e.dim}(deprecated: use layouts/default.stx instead)${e.reset}`)}}ft(),await mt(p);let F=gt();if(F.length>0)console.log(`${e.blue}Loaded ${e.bright}${F.length}${e.blue} middleware: ${e.dim}${F.join(", ")}${e.reset}`);let K={},Z=null;try{let{loadStxConfig:A}=await import("./chunk-fhhen33c.js"),z=await A(p);if(z?.apiRouter)Z=z?.apiRouter,console.log(`${e.blue}Using custom router for API handling${e.reset}`);if(z?.apiRoutes){K=z.apiRoutes;let N=Object.keys(K).length;if(N>0)console.log(`${e.blue}Loaded ${e.bright}${N} API route${N>1?"s":""}${e.reset}`)}if(z?.broadcasting?.enabled)try{let{startBroadcasting:N,loadChannels:W}=await import("./chunk-b2teprjf.js"),xe=z.broadcasting;await N(xe);let ze=xe.port??6001;console.log(`${e.magenta}Broadcasting on ${e.cyan}ws://localhost:${ze}/ws${e.reset}`);let qe=te.join(process.cwd(),"channels.ts");if(he.existsSync(qe))try{let ee=await W(qe);console.log(`${e.blue}Loaded ${e.bright}${ee} broadcast channel${ee!==1?"s":""}${e.blue} from channels.ts${e.reset}`)}catch(ee){console.warn(`${e.yellow}Failed to load channels.ts: ${ee.message}${e.reset}`)}}catch(N){console.warn(`${e.yellow}Broadcasting failed to start: ${N.message}${e.reset}`)}}catch{}let Te=a(p,"output");he.mkdirSync(Te,{recursive:!0});let me=new Map,Pe=new Set,ne=async(A)=>{let z=Or(C,A);if(!z)return null;try{let N=await Bun.build({entrypoints:[z],outdir:Te,plugins:[it],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...s.stxOptions});if(!N.success)return null;let W=N.outputs.find((xe)=>xe.path.endsWith(".html"));if(!W)return null;return await Bun.file(W.path).text()}catch{return null}},U=new Map,H=async(A,z)=>{try{let{processDirectives:N,extractVariables:W,defaultConfig:xe,loadStxConfig:ze,injectRouterScript:qe}=await import("./chunk-fhhen33c.js"),{checkCache:ee,cacheTemplate:Y,readFileCached:V,templateCache:X}=await import("./chunk-52wj6yc8.js"),we=await ze(p),Ke=(re)=>{if(!re)return re;if(te.isAbsolute(re))return re;return te.resolve(p,re)},M={...xe,...we,...s.stxOptions,autoShell:!0};if(s.debugDirectives)M.debug=!0;M.partialsDir=Ke(M.partialsDir),M.componentsDir=Ke(M.componentsDir),M.layoutsDir=Ke(M.layoutsDir),M.storesDir=Ke(M.storesDir||"stores"),M.cachePath=Ke(M.cachePath)??a(p,"cache");let ge=!z&&!s.profile,se=M.cache!==!1;if(se&&ge){let re=X.get(A.filePath);if(re)try{if((await he.promises.stat(A.filePath)).mtime.getTime()<=re.mtime){let je=!0;for(let Ce of re.dependencies){if(!he.existsSync(Ce)){je=!1;break}if((await he.promises.stat(Ce)).mtime.getTime()>re.mtime){je=!1;break}}if(je){let Ce=re.output;if(E)Ce=ke(Ce,{preserveHead:!0});let ct=U.get(A.filePath);return{route:A,content:Ce,status:ct?.status??await pn(A.filePath),headers:ct?.headers}}}}catch{}let Le=await ee(A.filePath,M);if(Le){let Ie=Le;if(E)Ie=ke(Ie,{preserveHead:!0});let je=U.get(A.filePath);return{route:A,content:Ie,status:je?.status??await pn(A.filePath),headers:je?.headers}}}let ue=se?await V(A.filePath):await Bun.file(A.filePath).text(),$e=Ft(ue),{classifyAllScripts:G}=await import("./chunk-fhhen33c.js"),_e=G(ue),Ne=_e.server.map((re)=>re.content),de=ue;for(let re of _e.server)de=de.replace(re.fullTag,"");let pe={__filename:A.filePath,__dirname:te.dirname(A.filePath),__stx_options:M,params:z??{},__stx_runtime_head:{}};for(let re of Ne)try{await W(re,pe,A.filePath)}catch(Le){if(s.stxOptions?.debug)console.error("[stx] variable extraction error",A.filePath,Le?.message||Le)}let We=new Set,Oe;if(s.profile){let re=performance.now();Oe=await N(de,pe,A.filePath,M,We);let Le=performance.now()-re,Ie=te.relative(p,A.filePath)||A.filePath;console.log(`[stx:profile] ${Ie} \u2192 ${Le.toFixed(2)}ms`)}else Oe=await N(de,pe,A.filePath,M,We);if(!E)Oe=await qe(Oe,{router:M.router});{let{interpolateScriptExpressions:re}=await import("./chunk-n95243ry.js");Oe=Oe.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/g,(Le,Ie,je)=>{if(!/function\s+__stx_setup_/.test(je))return Le;return`<script${Ie}>${re(je,pe)}</script>`})}if(E)Oe=ke(Oe,{preserveHead:!0});if(se&&ge)await Y(A.filePath,Oe,We,M);let{extractStreamBoundaries:Nn}=await import("./chunk-75tshgmz.js"),nt=Nn(pe),at=pe.__streamTemplates;if(at&&typeof at==="object"&&Object.keys(at).length>0){let re=pe.streamBoundaries||{},Le={...M,autoShell:!1},Ie=Object.keys(at).map((Ce)=>({id:Ce,render:async()=>{let ct=typeof re[Ce]==="function"?await re[Ce]():void 0;return N(at[Ce],{...pe,$boundary:ct},A.filePath,Le,new Set)}})),je=new Set(Ie.map((Ce)=>Ce.id));nt=[...(nt||[]).filter((Ce)=>!je.has(Ce.id)),...Ie]}if(nt&&nt.length>0)Pe.add(A.pattern);else nt=void 0;let qt=Ze(pe),Xt=Qe(pe);if(ge)U.set(A.filePath,{status:qt,headers:Xt});return{route:A,content:Oe,status:qt??$e,headers:Xt,boundaries:nt}}catch(N){return console.error(`${e.red}Error building ${e.bright}${A.pattern}${e.reset}:`,N),null}},Fe=8,Ue=async()=>{me.clear(),I.clear();for(let A=0;A<k.length;A+=Fe){let z=k.slice(A,A+Fe),N=await Promise.all(z.map((W)=>H(W)));for(let W of N)if(W)me.set(W.route.pattern,W)}for(let A=0;A<_.length;A+=Fe){let z=_.slice(A,A+Fe),N=await Promise.all(z.map(({route:W})=>H(W)));for(let W of N)if(W)I.set(W.route.pattern,W)}return me.size>0};if(console.log(`${e.blue}Building pages...${e.reset}`),!await Ue())return console.error(`${e.red}No pages were successfully built${e.reset}`),!1;await Bt(p);let et=i;try{if(et=await Xe(i),et!==i)console.log(`${e.yellow}Port ${i} is busy, using port ${et} instead${e.reset}`)}catch{return console.error(`${e.red}Could not find an available port${e.reset}`),!1}if(c){let A=s.hmrPort||et+1;l=Et({wsPort:A,verbose:!1}),m=l.start(A)}let At=(A,z)=>{let W=`<script data-stx-route-params>(function(){var p=${JSON.stringify(z).replace(/</g,"\\u003C").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")};window.__stx_rp=p;if(window.stx){window.stx._rp=p;if(window.stx.setRouteParams)window.stx.setRouteParams(p)}})()</script>`;if(A.includes("</head>"))return A.replace("</head>",`${W}</head>`);if(A.includes("<body"))return A.replace(/<body([^>]*)>/,`<body$1>${W}`);return W+A};console.log(`${e.blue}Starting server...${e.reset}`);let Dt=Yr({port:et,async fetch(A){let z=new URL(A.url),N=g?.publicDir||"public",W=te.join(p,N,z.pathname),xe=te.join(p,z.pathname),ze=te.join(Te,z.pathname);if([W,xe,ze].some((M)=>w(M,p,S)))return new Response("Not Found",{status:404});let[qe,ee,Y]=await Promise.all([he.promises.stat(W).catch(()=>null),he.promises.stat(xe).catch(()=>null),he.promises.stat(ze).catch(()=>null)]);if(qe?.isFile()&&!w(W,p,S))return Nt(W);if(ee?.isFile()&&!w(xe,p,S))return Nt(xe);if(Y?.isFile()&&!w(ze,p,S))return Nt(ze);if(z.pathname.startsWith("/_stx/component/")){let M=decodeURIComponent(z.pathname.slice(16));if(M)try{let ge=`<${M} />`,se={...buildConfig,autoShell:!1},ue=await processDirectives(ge,{},te.join(p,"components",`${M}.stx`),se,new Set);return new Response(ue,{headers:{"Content-Type":"text/html"}})}catch(ge){return new Response(`<div class="stx-async-error">${ge.message}</div>`,{status:500,headers:{"Content-Type":"text/html"}})}}if(z.pathname==="/_stx/img"){let{handleImageRequest:M}=await import("./chunk-ns4pc13z.js"),ge=await M(A,{publicDir:te.join(p,N),cacheDir:a(p,"cache","img")});if(ge)return ge}if(Z)try{let M=await Z.handleRequest(A);if(M.status!==404)return M}catch{}if(K[z.pathname])try{return await K[z.pathname](A)}catch(M){return new Response(JSON.stringify({error:M.message}),{status:500,headers:{"Content-Type":"application/json"}})}let V=await R(A);if(V)return V;let X=Vn(z.pathname,k);if(X){let M=me.get(X.route.pattern),ge=Pe.has(X.route.pattern);if(X.route.isDynamic&&Object.keys(X.params).length>0||ge){let se=await H(X.route,X.params);if(se)M=se}if(M){let se=M.status??200,ue=M.headers??{},$e=(X.route.filePath?Ye(await Bun.file(X.route.filePath).text().catch(()=>"")):null)??{};if($e.validate){if(!await $e.validate({params:X.params})){let Ne=await ne(404);if(Ne){let de=Ne;if(de=await f(de,p),c)de=Ve(de,m);return new Response(de,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})}}if($e.middleware){let _e=ht(z.pathname,X.params,$e,z.search),Ne=yt(_e,null,A,{isServer:!0}),de=await bt($e.middleware,Ne);if(de.redirect){let pe=de.redirect.path,We=de.redirect.options.redirectCode||302,Oe=new Headers(de.responseHeaders);return Oe.set("Location",pe),new Response(null,{status:We,headers:Oe})}if(de.abort){let{statusCode:pe,message:We}=de.abort.error;return new Response(`<!DOCTYPE html><html><head><title>Error ${pe}</title></head><body><h1>Error ${pe}</h1><p>${We}</p></body></html>`,{status:pe,headers:{"Content-Type":"text/html"}})}if(Object.keys(de.state).length>0){let pe=`<script>(function(){var s=typeof stx!=='undefined'?stx:{};s._ms=${JSON.stringify(de.state)};if(s.setMiddlewareState)s.setMiddlewareState(s._ms);})()</script>`;M.content=M.content.replace("</head>",`${pe}</head>`)}}let G=M.content;if(E&&No(A)){let _e=De(G),Ne=ye(G),de=G.match(/<title[^>]*>([\s\S]*?)<\/title>/i),pe=de?Io(de[1].trim()):"";if(Object.keys(X.params).length>0)G=At(G,X.params);G=await f(G,p);let We=g?.router?.container||"main";return G=le(G,We),new Response(G,{status:se,headers:{"Content-Type":"text/html","X-STX-Fragment":"true","X-STX-Layout":_e.layout,"X-STX-Layout-Group":_e.group,"X-STX-Runtime":Ne?"true":"false",...pe&&{"X-STX-Title":encodeURIComponent(pe)},[Li]:Fs(),...T(),"Cache-Control":He}})}if(E)G=Zn(E,G);if(Object.keys(X.params).length>0)G=At(G,X.params);if(G=await f(G,p),c)G=Ve(G,m);if(s.native)if(G.includes("<head>"))G=G.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else G="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+G;if(s.titlebarHidden)if(G.includes("<head>"))G=G.replace("<head>","<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script>");else G=`<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>${G}`;if(M.boundaries&&M.boundaries.length>0){let{renderStreamingPage:_e,streamToResponse:Ne}=await import("./chunk-75tshgmz.js");return Ne(_e(G,M.boundaries,{timeoutMs:30000}),{status:se,headers:{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}return new Response(G,{status:se,headers:{"Content-Type":"text/html",...T(),"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0",...ue}})}}if(_.length>0){let M=_.map((se)=>se.route),ge=Vn(z.pathname,M);if(ge){let se=I.get(ge.route.pattern);if(se){let ue=se.content;if(E)ue=Zn(E,ue);if(Object.keys(ge.params).length>0)ue=At(ue,ge.params);if(ue=await f(ue,p),c)ue=Ve(ue,m);return new Response(ue,{status:se.status??200,headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}for(let{prefix:se}of B)if(se!=="/"&&z.pathname.startsWith(se)){let ue=I.get(se)||I.get(se+"/");if(ue){let $e=ue.content;if(E)$e=Zn(E,$e);if($e=await f($e,p),c)$e=Ve($e,m);return new Response($e,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}}if(pt(z.pathname))return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}});let we=me.get("/");if(we){let M=we.content;if(M=await f(M,p),c)M=Ve(M,m);if(s.native)if(M.includes("<head>"))M=M.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else M="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+M;return new Response(M,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}let Ke=await ne(404);if(Ke){let M=Ke;if(M=await f(M,p),c)M=Ve(M,m);return new Response(M,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})},async error(A){let z=await ne(500);if(z)return new Response(z,{status:500,headers:{"Content-Type":"text/html"}});return new Response(`<pre>${A}
1429
+ Press ${e.cyan}h${e.reset} + ${e.cyan}Enter${e.reset} to show shortcuts`),Ge(w.url.toString(),()=>{if(d)Je.watch(l,{recursive:!0}).close();w.stop()}),d){console.log(`${e.blue}Watching for changes...${e.reset}`);let v=Je.watch(l,{recursive:!0},async(x,C)=>{if(!C)return;if(C.endsWith(".stx")||C.endsWith(".js")||C.endsWith(".ts")||C.endsWith(".md"))console.log(`${e.yellow}File ${e.bright}${C}${e.yellow} changed, rebuilding...${e.reset}`),Ae.clear(),ie(),await h()});process.on("SIGINT",()=>{v.close(),w.stop(),process.exit(0)})}return!0}function ln(t){return String(t??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var{serve:Yr}=globalThis.Bun;import he from"fs";import te from"path";async function pn(t){try{return Ft(await Bun.file(t).text())}catch{return}}function Nt(t){let s=Bun.file(t),i=te.extname(t).toLowerCase(),d={".html":"text/html",".css":"text/css",".js":"text/javascript",".json":"application/json",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".ico":"image/x-icon",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"},l=[".js",".css",".json"].includes(i)?{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}:{};return new Response(s,{headers:{"Content-Type":d[i]||"application/octet-stream",...l}})}async function Kn(t=".",s={}){let i=s.port||3000,d=s.watch!==!1,c=s.hotReload!==!1&&d,l=null,m=s.hmrPort||i+1,p=te.resolve(t),{loadStxConfig:h}=await import("./chunk-ek5vrw4r.js"),g=await h(p),{createServerApi:y,isServerApiSource:w}=await import("./chunk-jtk2p5p0.js"),S=s.stxOptions?.serverApi??g.serverApi,R=await y(p,S),v=g.root&&g.root!=="."?te.join(p,g.root):p,x=s.pagesDir||g.pagesDir||"pages",C=te.join(v,x);if(!he.existsSync(C)&&!g._layerPageDirs?.some((A)=>he.existsSync(A)))return console.error(`${e.red}Error: No '${x}' directory found${e.reset}`),console.log(`${e.dim}Looked in: ${e.bright}${C}${e.reset}`),console.log(`${e.dim}Run stx dev from the app directory, pass it as an argument (stx dev <dir>),${e.reset}`),console.log(`${e.dim}point at another directory with --pages <dir>, or set pagesDir in stx.config.ts.${e.reset}`),console.log(`${e.dim}Starting fresh? Create ${x}/index.stx for the homepage.${e.reset}`),!1;let k=j(v,{pagesDir:x,pagesDirs:g._layerPageDirs?[C,...g._layerPageDirs.slice(1)]:void 0});if(k.length===0)return console.error(`${e.red}Error: No page files found in ${e.bright}${C}${e.reset}`),!1;console.log(`${e.blue}Found ${e.bright}${k.length}${e.blue} routes${e.reset}`);let B=g?._pluginPageDirs||[],_=[];for(let{dir:A,prefix:z}of B)if(he.existsSync(A)){let N=j(te.dirname(A),{pagesDir:te.basename(A)});for(let W of N){let xe=z==="/"?W.pattern:`${z}${W.pattern==="/"?"":W.pattern}`;_.push({route:{...W,pattern:xe},prefix:z})}if(N.length>0)console.log(`${e.blue}Plugin pages: ${e.bright}${N.length}${e.blue} routes at ${e.cyan}${z}${e.reset}`)}let I=new Map,E=null,L=null;if(s.stxOptions?.shell!==!1){if(L=await Oo(p,s.stxOptions?.shell),L){if(E=await Gr(L,s.stxOptions||{}),E)console.log(`${e.blue}Using app shell: ${e.bright}${te.relative(p,L)}${e.reset} ${e.dim}(deprecated: use layouts/default.stx instead)${e.reset}`)}}ft(),await mt(p);let F=gt();if(F.length>0)console.log(`${e.blue}Loaded ${e.bright}${F.length}${e.blue} middleware: ${e.dim}${F.join(", ")}${e.reset}`);let K={},Z=null;try{let{loadStxConfig:A}=await import("./chunk-ek5vrw4r.js"),z=await A(p);if(z?.apiRouter)Z=z?.apiRouter,console.log(`${e.blue}Using custom router for API handling${e.reset}`);if(z?.apiRoutes){K=z.apiRoutes;let N=Object.keys(K).length;if(N>0)console.log(`${e.blue}Loaded ${e.bright}${N} API route${N>1?"s":""}${e.reset}`)}if(z?.broadcasting?.enabled)try{let{startBroadcasting:N,loadChannels:W}=await import("./chunk-b2teprjf.js"),xe=z.broadcasting;await N(xe);let ze=xe.port??6001;console.log(`${e.magenta}Broadcasting on ${e.cyan}ws://localhost:${ze}/ws${e.reset}`);let qe=te.join(process.cwd(),"channels.ts");if(he.existsSync(qe))try{let ee=await W(qe);console.log(`${e.blue}Loaded ${e.bright}${ee} broadcast channel${ee!==1?"s":""}${e.blue} from channels.ts${e.reset}`)}catch(ee){console.warn(`${e.yellow}Failed to load channels.ts: ${ee.message}${e.reset}`)}}catch(N){console.warn(`${e.yellow}Broadcasting failed to start: ${N.message}${e.reset}`)}}catch{}let Te=a(p,"output");he.mkdirSync(Te,{recursive:!0});let me=new Map,Pe=new Set,ne=async(A)=>{let z=Or(C,A);if(!z)return null;try{let N=await Bun.build({entrypoints:[z],outdir:Te,plugins:[it],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...s.stxOptions});if(!N.success)return null;let W=N.outputs.find((xe)=>xe.path.endsWith(".html"));if(!W)return null;return await Bun.file(W.path).text()}catch{return null}},U=new Map,H=async(A,z)=>{try{let{processDirectives:N,extractVariables:W,defaultConfig:xe,loadStxConfig:ze,injectRouterScript:qe}=await import("./chunk-ek5vrw4r.js"),{checkCache:ee,cacheTemplate:Y,readFileCached:V,templateCache:X}=await import("./chunk-k46gqnmk.js"),we=await ze(p),Ke=(re)=>{if(!re)return re;if(te.isAbsolute(re))return re;return te.resolve(p,re)},M={...xe,...we,...s.stxOptions,autoShell:!0};if(s.debugDirectives)M.debug=!0;M.partialsDir=Ke(M.partialsDir),M.componentsDir=Ke(M.componentsDir),M.layoutsDir=Ke(M.layoutsDir),M.storesDir=Ke(M.storesDir||"stores"),M.cachePath=Ke(M.cachePath)??a(p,"cache");let ge=!z&&!s.profile,se=M.cache!==!1;if(se&&ge){let re=X.get(A.filePath);if(re)try{if((await he.promises.stat(A.filePath)).mtime.getTime()<=re.mtime){let je=!0;for(let Ce of re.dependencies){if(!he.existsSync(Ce)){je=!1;break}if((await he.promises.stat(Ce)).mtime.getTime()>re.mtime){je=!1;break}}if(je){let Ce=re.output;if(E)Ce=ke(Ce,{preserveHead:!0});let ct=U.get(A.filePath);return{route:A,content:Ce,status:ct?.status??await pn(A.filePath),headers:ct?.headers}}}}catch{}let Le=await ee(A.filePath,M);if(Le){let Ie=Le;if(E)Ie=ke(Ie,{preserveHead:!0});let je=U.get(A.filePath);return{route:A,content:Ie,status:je?.status??await pn(A.filePath),headers:je?.headers}}}let ue=se?await V(A.filePath):await Bun.file(A.filePath).text(),$e=Ft(ue),{classifyAllScripts:G}=await import("./chunk-ek5vrw4r.js"),_e=G(ue),Ne=_e.server.map((re)=>re.content),de=ue;for(let re of _e.server)de=de.replace(re.fullTag,"");let pe={__filename:A.filePath,__dirname:te.dirname(A.filePath),__stx_options:M,params:z??{},__stx_runtime_head:{}};for(let re of Ne)try{await W(re,pe,A.filePath)}catch(Le){if(s.stxOptions?.debug)console.error("[stx] variable extraction error",A.filePath,Le?.message||Le)}let We=new Set,Oe;if(s.profile){let re=performance.now();Oe=await N(de,pe,A.filePath,M,We);let Le=performance.now()-re,Ie=te.relative(p,A.filePath)||A.filePath;console.log(`[stx:profile] ${Ie} \u2192 ${Le.toFixed(2)}ms`)}else Oe=await N(de,pe,A.filePath,M,We);if(!E)Oe=await qe(Oe,{router:M.router});{let{interpolateScriptExpressions:re}=await import("./chunk-hrdnz5q9.js");Oe=Oe.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/g,(Le,Ie,je)=>{if(!/function\s+__stx_setup_/.test(je))return Le;return`<script${Ie}>${re(je,pe)}</script>`})}if(E)Oe=ke(Oe,{preserveHead:!0});if(se&&ge)await Y(A.filePath,Oe,We,M);let{extractStreamBoundaries:Nn}=await import("./chunk-x901zq4q.js"),nt=Nn(pe),at=pe.__streamTemplates;if(at&&typeof at==="object"&&Object.keys(at).length>0){let re=pe.streamBoundaries||{},Le={...M,autoShell:!1},Ie=Object.keys(at).map((Ce)=>({id:Ce,render:async()=>{let ct=typeof re[Ce]==="function"?await re[Ce]():void 0;return N(at[Ce],{...pe,$boundary:ct},A.filePath,Le,new Set)}})),je=new Set(Ie.map((Ce)=>Ce.id));nt=[...(nt||[]).filter((Ce)=>!je.has(Ce.id)),...Ie]}if(nt&&nt.length>0)Pe.add(A.pattern);else nt=void 0;let qt=Ze(pe),Xt=Qe(pe);if(ge)U.set(A.filePath,{status:qt,headers:Xt});return{route:A,content:Oe,status:qt??$e,headers:Xt,boundaries:nt}}catch(N){return console.error(`${e.red}Error building ${e.bright}${A.pattern}${e.reset}:`,N),null}},Fe=8,Ue=async()=>{me.clear(),I.clear();for(let A=0;A<k.length;A+=Fe){let z=k.slice(A,A+Fe),N=await Promise.all(z.map((W)=>H(W)));for(let W of N)if(W)me.set(W.route.pattern,W)}for(let A=0;A<_.length;A+=Fe){let z=_.slice(A,A+Fe),N=await Promise.all(z.map(({route:W})=>H(W)));for(let W of N)if(W)I.set(W.route.pattern,W)}return me.size>0};if(console.log(`${e.blue}Building pages...${e.reset}`),!await Ue())return console.error(`${e.red}No pages were successfully built${e.reset}`),!1;await Bt(p);let et=i;try{if(et=await Xe(i),et!==i)console.log(`${e.yellow}Port ${i} is busy, using port ${et} instead${e.reset}`)}catch{return console.error(`${e.red}Could not find an available port${e.reset}`),!1}if(c){let A=s.hmrPort||et+1;l=Et({wsPort:A,verbose:!1}),m=l.start(A)}let At=(A,z)=>{let W=`<script data-stx-route-params>(function(){var p=${JSON.stringify(z).replace(/</g,"\\u003C").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")};window.__stx_rp=p;if(window.stx){window.stx._rp=p;if(window.stx.setRouteParams)window.stx.setRouteParams(p)}})()</script>`;if(A.includes("</head>"))return A.replace("</head>",`${W}</head>`);if(A.includes("<body"))return A.replace(/<body([^>]*)>/,`<body$1>${W}`);return W+A};console.log(`${e.blue}Starting server...${e.reset}`);let Dt=Yr({port:et,async fetch(A){let z=new URL(A.url),N=g?.publicDir||"public",W=te.join(p,N,z.pathname),xe=te.join(p,z.pathname),ze=te.join(Te,z.pathname);if([W,xe,ze].some((M)=>w(M,p,S)))return new Response("Not Found",{status:404});let[qe,ee,Y]=await Promise.all([he.promises.stat(W).catch(()=>null),he.promises.stat(xe).catch(()=>null),he.promises.stat(ze).catch(()=>null)]);if(qe?.isFile()&&!w(W,p,S))return Nt(W);if(ee?.isFile()&&!w(xe,p,S))return Nt(xe);if(Y?.isFile()&&!w(ze,p,S))return Nt(ze);if(z.pathname.startsWith("/_stx/component/")){let M=decodeURIComponent(z.pathname.slice(16));if(M)try{let ge=`<${M} />`,se={...buildConfig,autoShell:!1},ue=await processDirectives(ge,{},te.join(p,"components",`${M}.stx`),se,new Set);return new Response(ue,{headers:{"Content-Type":"text/html"}})}catch(ge){return new Response(`<div class="stx-async-error">${ge.message}</div>`,{status:500,headers:{"Content-Type":"text/html"}})}}if(z.pathname==="/_stx/img"){let{handleImageRequest:M}=await import("./chunk-ns4pc13z.js"),ge=await M(A,{publicDir:te.join(p,N),cacheDir:a(p,"cache","img")});if(ge)return ge}if(Z)try{let M=await Z.handleRequest(A);if(M.status!==404)return M}catch{}if(K[z.pathname])try{return await K[z.pathname](A)}catch(M){return new Response(JSON.stringify({error:M.message}),{status:500,headers:{"Content-Type":"application/json"}})}let V=await R(A);if(V)return V;let X=Vn(z.pathname,k);if(X){let M=me.get(X.route.pattern),ge=Pe.has(X.route.pattern);if(X.route.isDynamic&&Object.keys(X.params).length>0||ge){let se=await H(X.route,X.params);if(se)M=se}if(M){let se=M.status??200,ue=M.headers??{},$e=(X.route.filePath?Ye(await Bun.file(X.route.filePath).text().catch(()=>"")):null)??{};if($e.validate){if(!await $e.validate({params:X.params})){let Ne=await ne(404);if(Ne){let de=Ne;if(de=await f(de,p),c)de=Ve(de,m);return new Response(de,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})}}if($e.middleware){let _e=ht(z.pathname,X.params,$e,z.search),Ne=yt(_e,null,A,{isServer:!0}),de=await bt($e.middleware,Ne);if(de.redirect){let pe=de.redirect.path,We=de.redirect.options.redirectCode||302,Oe=new Headers(de.responseHeaders);return Oe.set("Location",pe),new Response(null,{status:We,headers:Oe})}if(de.abort){let{statusCode:pe,message:We}=de.abort.error;return new Response(`<!DOCTYPE html><html><head><title>Error ${pe}</title></head><body><h1>Error ${pe}</h1><p>${We}</p></body></html>`,{status:pe,headers:{"Content-Type":"text/html"}})}if(Object.keys(de.state).length>0){let pe=`<script>(function(){var s=typeof stx!=='undefined'?stx:{};s._ms=${JSON.stringify(de.state)};if(s.setMiddlewareState)s.setMiddlewareState(s._ms);})()</script>`;M.content=M.content.replace("</head>",`${pe}</head>`)}}let G=M.content;if(E&&No(A)){let _e=De(G),Ne=ye(G),de=G.match(/<title[^>]*>([\s\S]*?)<\/title>/i),pe=de?Io(de[1].trim()):"";if(Object.keys(X.params).length>0)G=At(G,X.params);G=await f(G,p);let We=g?.router?.container||"main";return G=le(G,We),new Response(G,{status:se,headers:{"Content-Type":"text/html","X-STX-Fragment":"true","X-STX-Layout":_e.layout,"X-STX-Layout-Group":_e.group,"X-STX-Runtime":Ne?"true":"false",...pe&&{"X-STX-Title":encodeURIComponent(pe)},[Li]:Fs(),...T(),"Cache-Control":He}})}if(E)G=Zn(E,G);if(Object.keys(X.params).length>0)G=At(G,X.params);if(G=await f(G,p),c)G=Ve(G,m);if(s.native)if(G.includes("<head>"))G=G.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else G="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+G;if(s.titlebarHidden)if(G.includes("<head>"))G=G.replace("<head>","<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script>");else G=`<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>${G}`;if(M.boundaries&&M.boundaries.length>0){let{renderStreamingPage:_e,streamToResponse:Ne}=await import("./chunk-x901zq4q.js");return Ne(_e(G,M.boundaries,{timeoutMs:30000}),{status:se,headers:{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}return new Response(G,{status:se,headers:{"Content-Type":"text/html",...T(),"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0",...ue}})}}if(_.length>0){let M=_.map((se)=>se.route),ge=Vn(z.pathname,M);if(ge){let se=I.get(ge.route.pattern);if(se){let ue=se.content;if(E)ue=Zn(E,ue);if(Object.keys(ge.params).length>0)ue=At(ue,ge.params);if(ue=await f(ue,p),c)ue=Ve(ue,m);return new Response(ue,{status:se.status??200,headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}for(let{prefix:se}of B)if(se!=="/"&&z.pathname.startsWith(se)){let ue=I.get(se)||I.get(se+"/");if(ue){let $e=ue.content;if(E)$e=Zn(E,$e);if($e=await f($e,p),c)$e=Ve($e,m);return new Response($e,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}}if(pt(z.pathname))return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}});let we=me.get("/");if(we){let M=we.content;if(M=await f(M,p),c)M=Ve(M,m);if(s.native)if(M.includes("<head>"))M=M.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else M="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+M;return new Response(M,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}let Ke=await ne(404);if(Ke){let M=Ke;if(M=await f(M,p),c)M=Ve(M,m);return new Response(M,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})},async error(A){let z=await ne(500);if(z)return new Response(z,{status:500,headers:{"Content-Type":"text/html"}});return new Response(`<pre>${A}
1430
1430
  ${A.stack}</pre>`,{headers:{"Content-Type":"text/html"}})}});if(console.clear(),console.log(`
1431
1431
  ${e.blue}stx${e.reset} ${e.green}${process.env.stx_VERSION||"v0.0.10"}${e.reset} ${e.dim}ready in ${Math.random()*10+5|0}.${Math.random()*90+10|0} ms${e.reset}`),console.log(`
1432
1432
  ${e.bright}\u2192 ${e.cyan}http://localhost:${et}/${e.reset}`),c)console.log(`${e.dim} HMR: ws://localhost:${m}${e.reset}`);console.log(`
1433
1433
  ${e.yellow}Routes:${e.reset}`);let Mt=[...Nr(k,p)];for(let{route:A}of _)Mt.push(`${A.pattern}`);if(Mt.forEach((A,z)=>{let W=z===Mt.length-1?"\u2514\u2500 ":"\u251C\u2500 ";console.log(` ${e.green}${W}${e.reset}${A}`)}),console.log(`
1434
- Press ${e.cyan}h${e.reset} + ${e.cyan}Enter${e.reset} to show shortcuts`),Ge(Dt.url.toString(),()=>{if(l)lt();Dt.stop()}),s.native){let A,z=te.join(C,"index.stx");if(he.existsSync(z)){let W=await Bun.file(z).text();A=Tt(W)}let N=g?.app?.window??{};await rt(et,{title:g?.app?.head?.title||te.basename(p)||"stx App",width:N.width,height:N.height,darkMode:N.darkMode,hotReload:N.hotReload,titlebarHidden:N.titlebarHidden??s.titlebarHidden===!0,nativeSidebar:!!A,sidebarConfig:A})}if(d){console.log(`${e.blue}Watching for changes...${e.reset}`);let A=(ee)=>ee.startsWith("public/")||ee.startsWith("public\\"),z=(ee)=>{let Y=ee.toLowerCase();return Y.endsWith(".stx")||Y.endsWith(".html")||Y.endsWith(".md")},N=new Map,W=()=>{let ee=new Set([p,...g._layerGraph?.layers.map((Y)=>Y.root)??[],...g._layerGraph?.configDependencies.map((Y)=>te.dirname(Y))??[]].filter((Y)=>he.existsSync(Y)).map((Y)=>he.realpathSync(Y)));for(let Y of g._layerGraph?.layers??[])for(let V of Object.values(Y.resources)){if(!he.existsSync(V))continue;let X=he.realpathSync(V);if(![...ee].some((we)=>X===we||X.startsWith(`${we}${te.sep}`)))ee.add(X)}for(let[Y,V]of N)if(!ee.has(Y))V.close(),N.delete(Y);for(let Y of ee)if(!N.has(Y)&&he.existsSync(Y))N.set(Y,he.watch(Y,{recursive:!0},(V,X)=>{ze(Y,V,X).catch((we)=>console.error("[stx] Layer rebuild failed:",we))}))},xe=Promise.resolve(),ze=(ee,Y,V)=>(xe=xe.catch(()=>{}).then(()=>qe(ee,Y,V)),xe),qe=async(ee,Y,V)=>{if(!V||Rt(V))return;if(Ct(V)){if(g._layerGraph){let X=await h(p);Object.assign(g,X),k.splice(0,k.length,...j(v,{pagesDir:x,pagesDirs:X._layerPageDirs?[C,...X._layerPageDirs.slice(1)]:void 0})),W()}if(A(V)){if(console.log(`${e.cyan}${V} changed${e.reset}`),c&&l)l.reload(V)}else if(z(V)){console.log(`${e.yellow}${V} changed, rebuilding...${e.reset}`),Ae.clear(),ie();try{let{invalidateFileCache:X,templateCache:we}=await import("./chunk-52wj6yc8.js");X(te.resolve(ee,V)),we.delete(te.resolve(ee,V))}catch{}if(L&&V){if(te.resolve(ee,V)===L||te.basename(L)===V){let we=await Gr(L,s.stxOptions||{});if(we)E=we}}if(await Ue(),await _n(p),c&&l)l.reload(V)}else{console.log(`${e.yellow}${V} changed, rebuilding...${e.reset}`),Ae.clear(),ie();try{let{invalidateFileCache:X,templateCache:we}=await import("./chunk-52wj6yc8.js");X(te.resolve(ee,V)),we.delete(te.resolve(ee,V))}catch{}if(await Ue(),c&&l)l.reload(V)}}else if($t(V)){if(console.log(`${e.cyan}CSS ${V} changed${e.reset}`),c&&l)l.updateCss(V)}};W(),process.on("SIGINT",()=>{for(let ee of N.values())ee.close();if(l)lt();Dt.stop(),process.exit(0)})}return!0}import Ut from"fs";import dt from"path";async function Qr(t){try{let i=(await Bun.file(t).text()).match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(!i)return[];let d=i[1],c=[],l=/\/\*\*\s*([\s\S]*?)\s*\*\/\s*(?:(?:const|let|var)\s*)?(?:([\w$]+)\s*=|module\.exports\.([\w$]+)\s*=|\s*([\w$]+)\s*:)/g,m;while((m=l.exec(d))!==null){let p=m[1],h=m[2]||m[3]||m[4];if(!h)continue;let g={name:h},y=p.match(/@type\s+\{([^}]+)\}/i);if(y)g.type=y[1].trim();if(p.match(/@required/i))g.required=!0;let S=p.match(/@default\s+(.+?)(?:\s+|$)/i);if(S)g.default=S[1].trim();let R=p.split(`
1434
+ Press ${e.cyan}h${e.reset} + ${e.cyan}Enter${e.reset} to show shortcuts`),Ge(Dt.url.toString(),()=>{if(l)lt();Dt.stop()}),s.native){let A,z=te.join(C,"index.stx");if(he.existsSync(z)){let W=await Bun.file(z).text();A=Tt(W)}let N=g?.app?.window??{};await rt(et,{title:g?.app?.head?.title||te.basename(p)||"stx App",width:N.width,height:N.height,darkMode:N.darkMode,hotReload:N.hotReload,titlebarHidden:N.titlebarHidden??s.titlebarHidden===!0,nativeSidebar:!!A,sidebarConfig:A})}if(d){console.log(`${e.blue}Watching for changes...${e.reset}`);let A=(ee)=>ee.startsWith("public/")||ee.startsWith("public\\"),z=(ee)=>{let Y=ee.toLowerCase();return Y.endsWith(".stx")||Y.endsWith(".html")||Y.endsWith(".md")},N=new Map,W=()=>{let ee=new Set([p,...g._layerGraph?.layers.map((Y)=>Y.root)??[],...g._layerGraph?.configDependencies.map((Y)=>te.dirname(Y))??[]].filter((Y)=>he.existsSync(Y)).map((Y)=>he.realpathSync(Y)));for(let Y of g._layerGraph?.layers??[])for(let V of Object.values(Y.resources)){if(!he.existsSync(V))continue;let X=he.realpathSync(V);if(![...ee].some((we)=>X===we||X.startsWith(`${we}${te.sep}`)))ee.add(X)}for(let[Y,V]of N)if(!ee.has(Y))V.close(),N.delete(Y);for(let Y of ee)if(!N.has(Y)&&he.existsSync(Y))N.set(Y,he.watch(Y,{recursive:!0},(V,X)=>{ze(Y,V,X).catch((we)=>console.error("[stx] Layer rebuild failed:",we))}))},xe=Promise.resolve(),ze=(ee,Y,V)=>(xe=xe.catch(()=>{}).then(()=>qe(ee,Y,V)),xe),qe=async(ee,Y,V)=>{if(!V||Rt(V))return;if(Ct(V)){if(g._layerGraph){let X=await h(p);Object.assign(g,X),k.splice(0,k.length,...j(v,{pagesDir:x,pagesDirs:X._layerPageDirs?[C,...X._layerPageDirs.slice(1)]:void 0})),W()}if(A(V)){if(console.log(`${e.cyan}${V} changed${e.reset}`),c&&l)l.reload(V)}else if(z(V)){console.log(`${e.yellow}${V} changed, rebuilding...${e.reset}`),Ae.clear(),ie();try{let{invalidateFileCache:X,templateCache:we}=await import("./chunk-k46gqnmk.js");X(te.resolve(ee,V)),we.delete(te.resolve(ee,V))}catch{}if(L&&V){if(te.resolve(ee,V)===L||te.basename(L)===V){let we=await Gr(L,s.stxOptions||{});if(we)E=we}}if(await Ue(),await _n(p),c&&l)l.reload(V)}else{console.log(`${e.yellow}${V} changed, rebuilding...${e.reset}`),Ae.clear(),ie();try{let{invalidateFileCache:X,templateCache:we}=await import("./chunk-k46gqnmk.js");X(te.resolve(ee,V)),we.delete(te.resolve(ee,V))}catch{}if(await Ue(),c&&l)l.reload(V)}}else if($t(V)){if(console.log(`${e.cyan}CSS ${V} changed${e.reset}`),c&&l)l.updateCss(V)}};W(),process.on("SIGINT",()=>{for(let ee of N.values())ee.close();if(l)lt();Dt.stop(),process.exit(0)})}return!0}import Ut from"fs";import dt from"path";async function Qr(t){try{let i=(await Bun.file(t).text()).match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(!i)return[];let d=i[1],c=[],l=/\/\*\*\s*([\s\S]*?)\s*\*\/\s*(?:(?:const|let|var)\s*)?(?:([\w$]+)\s*=|module\.exports\.([\w$]+)\s*=|\s*([\w$]+)\s*:)/g,m;while((m=l.exec(d))!==null){let p=m[1],h=m[2]||m[3]||m[4];if(!h)continue;let g={name:h},y=p.match(/@type\s+\{([^}]+)\}/i);if(y)g.type=y[1].trim();if(p.match(/@required/i))g.required=!0;let S=p.match(/@default\s+(.+?)(?:\s+|$)/i);if(S)g.default=S[1].trim();let R=p.split(`
1435
1435
  `).map((v)=>v.trim().replace(/^\*\s*/,"")).filter((v)=>!v.startsWith("@")&&v.length>0);g.description=R.join(" ").trim(),c.push(g)}if(c.length===0){let p=d.match(/module\.exports\s*=\s*\{([^}]+)\}/i);if(p){let g=p[1].split(",").map((y)=>y.trim()).filter(Boolean);for(let y of g){let[w]=y.split(":").map((S)=>S.trim());if(w)c.push({name:w})}}}return c}catch(s){return console.error(`Error extracting props from ${t}:`,s),[]}}async function Zr(t){try{let s=await Bun.file(t).text(),i=s.match(/^\s*<!--\s*([\s\S]*?)\s*-->/)||s.match(/^\s*\/\*\*\s*([\s\S]*?)\s*\*\//);if(i)return i[1].split(`
1436
1436
  `).map((d)=>d.trim().replace(/^\*\s*/,"")).join(" ").trim();return""}catch{return""}}async function eo(t,s=!1,i){let d=dt.basename(t,".stx"),c=await Qr(t),l=await Zr(t),m="";if(s&&i)m=`<${i}></${i}>`;else{let p=c.map((h)=>{if(h.type==="boolean")return`:${h.name}="true"`;return`${h.name}="value"`}).join(`
1437
1437
  `);m=`<${d}
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{et,Q,zs,Hs,$n,n}from"./chunk-dqjx14em.js";import"./chunk-r00nn2qs.js";import"./chunk-y255yybn.js";import"./chunk-1m5cjrpw.js";import"./chunk-pr1rt0z4.js";import"./chunk-a0ygyftk.js";import"./chunk-6vmvra0f.js";import"./chunk-qmh6f1bt.js";import"./chunk-m92q2jyt.js";import"./chunk-ahyq08mp.js";import"./chunk-g1ae3haw.js";import"./chunk-gsp3627d.js";import"./chunk-pvfx0dgz.js";export{$n as buildModulesTag,Q as injectRouterScript,n as processDirectives,zs as processJsonDirective,Hs as processOnceDirective,et as validateClientScript};
2
+ import{et,Q,zs,Hs,$n,n}from"./chunk-grg366m9.js";import"./chunk-r00nn2qs.js";import"./chunk-y255yybn.js";import"./chunk-1m5cjrpw.js";import"./chunk-xsmvcnmx.js";import"./chunk-a0ygyftk.js";import"./chunk-6vmvra0f.js";import"./chunk-qmh6f1bt.js";import"./chunk-m92q2jyt.js";import"./chunk-ahyq08mp.js";import"./chunk-g1ae3haw.js";import"./chunk-gsp3627d.js";import"./chunk-pvfx0dgz.js";export{$n as buildModulesTag,Q as injectRouterScript,n as processDirectives,zs as processJsonDirective,Hs as processOnceDirective,et as validateClientScript};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Cs,_s,Es,bd,pr,vd}from"./chunk-dqjx14em.js";export{pr as clearImageDeliveryCatalog,bd as deliveredImage,Es as efficientDeliverySources,Cs as getImageDelivery,_s as isTransparentImage,vd as prepareImageDelivery};
2
+ import{Cs,_s,Es,bd,pr,vd}from"./chunk-grg366m9.js";export{pr as clearImageDeliveryCatalog,bd as deliveredImage,Es as efficientDeliverySources,Cs as getImageDelivery,_s as isTransparentImage,vd as prepareImageDelivery};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{ha,ya}from"./chunk-cw8mx4qf.js";import"./chunk-afsf6sp0.js";import"./chunk-h3brvxbf.js";import"./chunk-j00v4m56.js";import"./chunk-9939fjh4.js";import"./chunk-bnfjwgtm.js";import"./chunk-6avpd901.js";import"./chunk-hvk5zkpm.js";import{Po}from"./chunk-12677ap2.js";import"./chunk-fztvkacg.js";import"./chunk-639ngkgb.js";import"./chunk-gbxzqvez.js";import"./chunk-45xhjrha.js";import"./chunk-s775b8ra.js";import"./chunk-29sq7kqw.js";import"./chunk-5e063mgs.js";import"./chunk-48yja477.js";import"./chunk-aztp8r80.js";import"./chunk-drrczm0b.js";import"./chunk-fwdptew6.js";import"./chunk-5wyp57g3.js";import"./chunk-b4j5bpec.js";import"./chunk-s0tbc9t1.js";import"./chunk-wjq1wqn6.js";import"./chunk-60azcvwr.js";import"./chunk-88p10v0w.js";import"./chunk-c858mepd.js";import"./chunk-qy11cp1v.js";import"./chunk-t6awky15.js";import"./chunk-dcwhp21g.js";import"./chunk-hshcbe3p.js";import"./chunk-6bdr0x43.js";import"./chunk-gmxrckgj.js";import"./chunk-gqz26wza.js";import"./chunk-29gd2kkk.js";import"./chunk-kv5mn1qr.js";import"./chunk-bsts9pr5.js";import{Ee,xn,Sn,Q,u,n,br,A,o,be}from"./chunk-grg366m9.js";import"./chunk-r00nn2qs.js";import"./chunk-y255yybn.js";import"./chunk-1m5cjrpw.js";import"./chunk-xsmvcnmx.js";import"./chunk-a0ygyftk.js";import"./chunk-6vmvra0f.js";import"./chunk-qmh6f1bt.js";import"./chunk-m92q2jyt.js";import"./chunk-ahyq08mp.js";import"./chunk-g1ae3haw.js";import"./chunk-gsp3627d.js";import"./chunk-pvfx0dgz.js";export{br as buildWebComponents,Sn as cacheTemplate,xn as checkCache,Po as classifyAllScripts,ha as createMiddleware,ya as createRoute,A as defaultConfig,u as extractVariables,Q as injectRouterScript,o as loadStxConfig,Ee as processClientScript,n as processDirectives,be as readMarkdownFile};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Tu,$u}from"./chunk-t6awky15.js";import"./chunk-29gd2kkk.js";import"./chunk-kv5mn1qr.js";import"./chunk-bsts9pr5.js";import"./chunk-grg366m9.js";import"./chunk-r00nn2qs.js";import"./chunk-y255yybn.js";import"./chunk-1m5cjrpw.js";import"./chunk-xsmvcnmx.js";import"./chunk-a0ygyftk.js";import"./chunk-6vmvra0f.js";import"./chunk-qmh6f1bt.js";import"./chunk-m92q2jyt.js";import"./chunk-ahyq08mp.js";import"./chunk-g1ae3haw.js";import"./chunk-gsp3627d.js";import"./chunk-pvfx0dgz.js";export{$u as clearStoreCache,Tu as getStoreScript};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{u,Ds,Oi,Ni,Qc,el,tl,nl,rl,Vs,sl,rt,B,st,ol,hr,il,ji,Us,ot,r,yr,Bi,g,ie,kd}from"./chunk-dqjx14em.js";import"./chunk-r00nn2qs.js";import"./chunk-y255yybn.js";import"./chunk-1m5cjrpw.js";import"./chunk-pr1rt0z4.js";import"./chunk-a0ygyftk.js";import"./chunk-6vmvra0f.js";import"./chunk-qmh6f1bt.js";import"./chunk-m92q2jyt.js";import"./chunk-ahyq08mp.js";import"./chunk-g1ae3haw.js";import"./chunk-gsp3627d.js";import"./chunk-pvfx0dgz.js";export{ie as clearComponentCache,Us as componentClientSignalNames,Ds as convertToCommonJS,g as createDetailedErrorMessage,rl as extractDirectiveNames,Oi as extractScriptFromTemplate,u as extractVariables,r as fileExists,kd as getComponentCacheStats,el as getPositionInfo,B as getSharedTranspiler,Bi as getSourceLineInfo,nl as hasDirectives,Ni as hasVariables,il as isHydrateTrigger,sl as isJavaScriptScript,ot as renderComponentWithSlot,yr as resolveTemplatePath,ol as scopeOnRootElement,Vs as scopeSequenceKey,rt as shouldTranspileTypeScript,ji as slotContentHasExpressions,st as transpileTypeScript,hr as userComponentFileExists,tl as validateDirective,Qc as validateTemplate};
2
+ import{u,Ds,Oi,Ni,Qc,el,tl,nl,rl,Vs,sl,rt,B,st,ol,hr,il,ji,Us,ot,r,yr,Bi,g,ie,kd}from"./chunk-grg366m9.js";import"./chunk-r00nn2qs.js";import"./chunk-y255yybn.js";import"./chunk-1m5cjrpw.js";import"./chunk-xsmvcnmx.js";import"./chunk-a0ygyftk.js";import"./chunk-6vmvra0f.js";import"./chunk-qmh6f1bt.js";import"./chunk-m92q2jyt.js";import"./chunk-ahyq08mp.js";import"./chunk-g1ae3haw.js";import"./chunk-gsp3627d.js";import"./chunk-pvfx0dgz.js";export{ie as clearComponentCache,Us as componentClientSignalNames,Ds as convertToCommonJS,g as createDetailedErrorMessage,rl as extractDirectiveNames,Oi as extractScriptFromTemplate,u as extractVariables,r as fileExists,kd as getComponentCacheStats,el as getPositionInfo,B as getSharedTranspiler,Bi as getSourceLineInfo,nl as hasDirectives,Ni as hasVariables,il as isHydrateTrigger,sl as isJavaScriptScript,ot as renderComponentWithSlot,yr as resolveTemplatePath,ol as scopeOnRootElement,Vs as scopeSequenceKey,rt as shouldTranspileTypeScript,ji as slotContentHasExpressions,st as transpileTypeScript,hr as userComponentFileExists,tl as validateDirective,Qc as validateTemplate};