@stacksjs/stx 0.2.847 → 0.2.849

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 (85) hide show
  1. package/dist/{chunk-mbcqpcyt.js → chunk-056rsqc6.js} +1 -1
  2. package/dist/{chunk-s4wcksaw.js → chunk-0ey7kc6t.js} +1 -1
  3. package/dist/{chunk-5x8q6e1q.js → chunk-0zgxxhvs.js} +4 -4
  4. package/dist/{chunk-xn0ebqgw.js → chunk-1k12cc65.js} +1 -1
  5. package/dist/{chunk-j1sm889p.js → chunk-2sxmmjt1.js} +1 -1
  6. package/dist/{chunk-g891ftgz.js → chunk-34afrhts.js} +1 -1
  7. package/dist/{chunk-fhyvdxhw.js → chunk-3m5v3ynh.js} +1 -1
  8. package/dist/{chunk-twfx2scr.js → chunk-4q4mtrc5.js} +1 -1
  9. package/dist/{chunk-cz2s176s.js → chunk-54p27ney.js} +1 -1
  10. package/dist/{chunk-nm04926f.js → chunk-5r2z29n8.js} +1 -1
  11. package/dist/{chunk-907zya76.js → chunk-63sqdcr6.js} +2 -2
  12. package/dist/chunk-660preb9.js +2 -0
  13. package/dist/chunk-740njbwc.js +2 -0
  14. package/dist/chunk-7c73t536.js +2 -0
  15. package/dist/{chunk-6peq9s4s.js → chunk-83dxfhkw.js} +2 -2
  16. package/dist/{chunk-cq06hsm4.js → chunk-84gg2atb.js} +1 -1
  17. package/dist/{chunk-ysqzz2h3.js → chunk-88a7qaw8.js} +1 -1
  18. package/dist/{chunk-110s34yg.js → chunk-8bxws458.js} +1 -1
  19. package/dist/{chunk-fxk08je0.js → chunk-8vkywnpx.js} +2 -2
  20. package/dist/{chunk-eqbx4yj1.js → chunk-90mm5bf8.js} +2 -2
  21. package/dist/{chunk-se79v0pe.js → chunk-9f0pv6sz.js} +1 -1
  22. package/dist/{chunk-cv0rmntr.js → chunk-9mbyhepc.js} +1 -1
  23. package/dist/{chunk-5m0nyt8d.js → chunk-b147ejha.js} +1 -1
  24. package/dist/{chunk-6bemqsdj.js → chunk-bkqqa8aw.js} +1 -1
  25. package/dist/{chunk-v7d7m4k1.js → chunk-bmds786f.js} +1 -1
  26. package/dist/{chunk-8586a2hh.js → chunk-bsw6hd14.js} +1 -1
  27. package/dist/{chunk-sz2nax5v.js → chunk-c7qej674.js} +4 -4
  28. package/dist/{chunk-q61r0m6r.js → chunk-ct54e34a.js} +1 -1
  29. package/dist/{chunk-341c732h.js → chunk-e1n286mv.js} +1 -1
  30. package/dist/{chunk-v5tzcd49.js → chunk-f2zgh4xr.js} +4 -4
  31. package/dist/{chunk-hpaj7zjv.js → chunk-fx8jjasv.js} +1 -1
  32. package/dist/{chunk-5ghw26vq.js → chunk-gpkxphqz.js} +1 -1
  33. package/dist/{chunk-my8257pf.js → chunk-h8zb6cek.js} +1 -1
  34. package/dist/{chunk-1na30z8t.js → chunk-hc4ydhw0.js} +1 -1
  35. package/dist/{chunk-acwdf0cf.js → chunk-jmshgw0t.js} +2 -2
  36. package/dist/{chunk-prnebmz1.js → chunk-k7e3e149.js} +5 -5
  37. package/dist/{chunk-rsa9ssz7.js → chunk-ke76eaat.js} +3 -3
  38. package/dist/chunk-kz7ha54c.js +2 -0
  39. package/dist/{chunk-79pgjds2.js → chunk-m7cbkrz6.js} +1 -1
  40. package/dist/{chunk-31rtwv90.js → chunk-md8dj6tb.js} +1 -1
  41. package/dist/{chunk-5aqvfnvy.js → chunk-mnncq81c.js} +4 -4
  42. package/dist/{chunk-kvttzk86.js → chunk-na1v2jcy.js} +1 -1
  43. package/dist/{chunk-byjjz7h8.js → chunk-pqqyjvq9.js} +1 -1
  44. package/dist/{chunk-9m96yv69.js → chunk-qczgdzjk.js} +1 -1
  45. package/dist/chunk-r40g6785.js +2 -0
  46. package/dist/{chunk-dsh91n7n.js → chunk-rrnvbwac.js} +1 -1
  47. package/dist/{chunk-5njk2ba0.js → chunk-rtsshvpt.js} +2 -2
  48. package/dist/{chunk-fr658fhd.js → chunk-rwc322gq.js} +1 -1
  49. package/dist/{chunk-txs1vxas.js → chunk-shnw9geh.js} +1 -1
  50. package/dist/{chunk-s6td2c1k.js → chunk-tbcvarvy.js} +1 -1
  51. package/dist/{chunk-gzx1f8ay.js → chunk-te1wksa0.js} +1 -1
  52. package/dist/{chunk-h9778nxm.js → chunk-tj533808.js} +1 -1
  53. package/dist/chunk-v11hvvxc.js +2 -0
  54. package/dist/{chunk-jj5fz0fq.js → chunk-v929r67j.js} +1 -1
  55. package/dist/chunk-vasvns9e.js +2 -0
  56. package/dist/{chunk-nnnf8cjv.js → chunk-x2wn6mpd.js} +1 -1
  57. package/dist/{chunk-343hxxq1.js → chunk-x45mp78q.js} +1 -1
  58. package/dist/chunk-xa2qfe51.js +3 -0
  59. package/dist/{chunk-ks0dwtp0.js → chunk-xr9rf0e6.js} +1 -1
  60. package/dist/{chunk-8xb9ecb9.js → chunk-xsmyhp5f.js} +1 -1
  61. package/dist/{chunk-3c2hgvag.js → chunk-y6wbbmp3.js} +1 -1
  62. package/dist/{chunk-ybgzr6wn.js → chunk-ynnd6nnt.js} +6 -6
  63. package/dist/{chunk-vm68yvgf.js → chunk-yqjmqndq.js} +1 -1
  64. package/dist/chunk-zecffe6a.js +2 -0
  65. package/dist/cli.js +7 -7
  66. package/dist/craft-entry.js +1 -1
  67. package/dist/craft.js +1 -1
  68. package/dist/native/floating-actions.d.ts +43 -0
  69. package/dist/native/floating-actions.js +50 -0
  70. package/dist/native/index.d.ts +1 -0
  71. package/dist/native/index.js +1 -0
  72. package/dist/native/primitives/FloatingActions.stx +42 -0
  73. package/dist/native/runtime/browser-screen.js +3 -8
  74. package/dist/pwa.js +1 -1
  75. package/dist/ssg.js +2 -2
  76. package/package.json +5 -5
  77. package/dist/chunk-0vbt87cv.js +0 -2
  78. package/dist/chunk-1rban2td.js +0 -2
  79. package/dist/chunk-gc7gh0g0.js +0 -2
  80. package/dist/chunk-h526qmg2.js +0 -2
  81. package/dist/chunk-hazd1sh8.js +0 -2
  82. package/dist/chunk-jmqwpnpd.js +0 -2
  83. package/dist/chunk-ke8rxpp9.js +0 -2
  84. package/dist/chunk-mfbqjkgp.js +0 -3
  85. package/dist/chunk-xc1k2zza.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{He,Cn,Gs,Ti,D}from"./chunk-46t924aw.js";import{_n}from"./chunk-5ghw26vq.js";import{Lr,k,hl,ct,Di,yl}from"./chunk-0wms5teg.js";import{I}from"./chunk-xppm4cs4.js";import{R,_,Js,u,f,Bt,d,K,z,x,eo,Ce,Ue,to}from"./chunk-eg2p1cyw.js";import{s,me}from"./chunk-jm0qsr3s.js";import{g}from"./chunk-0dve54ne.js";import{X}from"./chunk-k44qj40k.js";import at from"path";import Wt from"process";import{AsyncLocalStorage as ca}from"async_hooks";var Pr=new ca;function bn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function Or(e,t){return Pr.run(bn(e),t)}async function Dr(e,t){let n=Pr.getStore();if(!n)throw Error("useServerData must run inside a <script server> render");if(typeof e!=="string"||!e.trim())throw TypeError("useServerData requires a non-empty string key");let i=n.pending.get(e);if(i)return i;let a=Promise.resolve().then(t).then((l)=>{let c=JSON.stringify(l,(v,T)=>{if(T===void 0||typeof T==="function"||typeof T==="symbol"||typeof T==="bigint"||typeof T==="number"&&!Number.isFinite(T))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(T&&typeof T==="object"&&!Array.isArray(T)&&Object.getPrototypeOf(T)!==Object.prototype&&Object.getPrototypeOf(T)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return T}),b=JSON.parse(c);return n.values.set(e,b),b}).catch((l)=>{throw n.pending.delete(e),l});return n.pending.set(e,a),a}function $r(e){let t=e.__stx_server_data;if(!t?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(t.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function V(e,t=!1){let n=s(e),i=[],a=new Set,l=0,c=0,b=n.length,v=()=>{if(l!==0)return;let T=n.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(T){if(t&&T[1]==="const")return;let L=T[2];if(!a.has(L))i.push(L),a.add(L);return}let P=n.slice(c).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(P){if(t&&n.slice(c).startsWith("const"))return;P[1].split(",").forEach((L)=>{let B=L.trim();if(!B)return;let F=B.indexOf(":"),G=(F>=0?B.slice(F+1).trim():B).split(/[\s=]/)[0];if(G&&!a.has(G))i.push(G),a.add(G)});return}let M=n.slice(c).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(M){if(t&&n.slice(c).startsWith("const"))return;M[1].split(",").forEach((L)=>{let B=L.trim().replace(/^\.\.\./,"");if(!B)return;let F=B.split(/[\s=]/)[0];if(F&&!a.has(F))i.push(F),a.add(F)});return}if(t)return;let H=n.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let L=H[1];if(!a.has(L))i.push(L),a.add(L);return}let O=n.slice(c).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let L=O[1];if(!a.has(L))i.push(L),a.add(L)}};while(c<b){if(n[c]==="{"){l++,c++;continue}if(n[c]==="}"){l--,c++;continue}if(l===0&&/[a-z]/i.test(n[c])&&(c===0||/\s|[;{}()]/.test(n[c-1])))v();c++}return i.join(", ")}function Ds(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function la(e,t=V(e).split(",").map((n)=>n.trim()).filter(Boolean)){let n=new Set(V(e,!0).split(",").map((i)=>i.trim()));return t.map((i)=>n.has(i)?`get ${i}() { return ${i} }, set ${i}(__stxValue_${i}) { ${i} = __stxValue_${i} }`:i).join(", ")}function Ms(e,t){let n=`{ ${la(e,t)} }`;return V(e).split(",").some((i)=>i.trim()==="__stxLiveBindings")?`Object.defineProperties(${n}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:n}import jt from"fs";import ve from"path";function U(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var Mr=new Map;function xr(e,t=!0){let n=Mr.get(e);if(t&&n)return n;let i=new Map,a=[ve.join(e,"src"),ve.join(e,"dist"),e];function l(c,b){if(b>6)return;let v;try{v=jt.readdirSync(c,{withFileTypes:!0})}catch{return}for(let T of v){let P=ve.join(c,T.name);if(T.isDirectory()){if(T.name==="node_modules"||T.name.startsWith("."))continue;l(P,b+1)}else if(T.isFile()&&T.name.endsWith(".stx")){let M=T.name.slice(0,-4);if(!i.has(M))i.set(M,P);let H=M.toLowerCase();if(!i.has(H))i.set(H,P);let O=U(M);if(!i.has(O))i.set(O,P)}}}for(let c of a)if(l(c,0),i.size>0)break;if(t)Mr.set(e,i);return i}function Ls(e,t){if(e.startsWith(".")||e.startsWith("/"))return null;let n=t;while(!0){let i=ve.join(n,"node_modules",e);try{if(jt.statSync(i).isDirectory())return i}catch{}let a=ve.dirname(n);if(a===n)return null;n=a}}function js(e,t,n={}){return[ve.resolve(ve.dirname(t),`${e}.stx`),ve.resolve(ve.dirname(t),e),ve.resolve(n.componentsDir||"components",`${e}.stx`),ve.resolve(n.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function jr(e){let t=e.endsWith(".stx")?e.slice(0,-4):e,n=t.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),i=U(t);return[t,n,i]}function ui(e,t){let[n,i,a]=jr(e);for(let l of[n,n.toLowerCase(),i,a]){let c=t?.__importedComponents?.get(l);if(c!==void 0)return c}}function ua(e,t){let n=t?ve.resolve(t):void 0,i=ve.dirname(ve.resolve(e));for(;;){if(jt.existsSync(ve.join(i,"package.json")))return n&&i===n?void 0:i;let a=ve.dirname(i);if(a===i)return;i=a}}var fa=["src/ui","src/components","components","dist"];function Ln(e,t){let n=ve.resolve(e);if(!t&&!n.split(ve.sep).includes("node_modules"))return[];let i=ua(n,t);if(!i)return[];let a=[];try{let b=JSON.parse(jt.readFileSync(ve.join(i,"package.json"),"utf8")).stx?.components;if(Array.isArray(b))a=b.filter((v)=>typeof v==="string")}catch{}let l=a.length?a:fa;return[ve.dirname(ve.resolve(e)),...l.map((c)=>ve.resolve(i,c))]}function*di(e,t,n={},i){let a=jr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield ve.resolve(ve.dirname(t),`${a[0]}.stx`);return}let l=[...new Set(a.map((v)=>`${v}.stx`))],c=n.projectRoot||process.cwd(),b=[...Ln(t,n.projectRoot),...i?.__originalFilePath?[ve.join(ve.dirname(i.__originalFilePath),"components")]:[],...n.componentsDir?[n.componentsDir]:[],ve.join(ve.dirname(t),"components"),ve.resolve(c,"src/components"),ve.resolve(c,"components"),...import.meta.dir?[ve.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(b)){for(let T of l)yield ve.join(v,T);try{for(let T of jt.readdirSync(v,{withFileTypes:!0}))if(T.isDirectory())for(let P of l)yield ve.join(v,T.name,P)}catch{}}}function Nr(e,t,n={},i){let a=ui(e,i);if(a!==void 0)return a;for(let l of di(e,t,n,i))try{if(jt.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function Bs(e,t=[],n={}){let i=new Set([...e].map((T)=>T.replace(/[-_]/g,"").toLowerCase()));if(!i.has("src")&&!i.has("source")||!i.has("alt")&&!i.has("decorative"))return!1;let a=new Map(Object.entries(n).map(([T,P])=>[T.replace(/[-_]/g,"").toLowerCase(),P])),l=a.get("alt"),c=a.get("decorative"),b=typeof l==="string"&&!!l.trim(),v=typeof c==="string"?!["false","0","off","no"].includes(c.trim().toLowerCase()):Boolean(c);if(!b&&!v)return!1;if(["defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((T)=>i.has(T)))return!1;if([...t].some((T)=>!["load","error"].includes(T.replace(/^@/,"").split(".")[0].toLowerCase())))return!1;if(i.has("resizemode")&&(i.has("fit")||i.has("objectfit")))return!1;if(i.has("src")&&i.has("source"))return!1;return["fit","objectfit","resizemode","position","objectposition","rounded","aspectratio","zoomonhover","sources","webpsrc","webpsrcset"].some((T)=>i.has(T))}import rs from"fs";import ce from"path";import St from"path";import en from"fs";var pa=new Set(["touchstart","touchmove","wheel","mousewheel"]);function bs(e,t){if(t.passive)return!0;if(t.prevent||t.nonpassive)return!1;return pa.has(e.toLowerCase())}var zr=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),Br={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},da=new Set(["ctrl","alt","shift","meta"]),Vr={left:0,middle:1,right:2};function Wr(e){let t={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let n of e){let i=n.toLowerCase();if(i==="prevent")t.prevent=!0;else if(i==="stop")t.stop=!0;else if(i==="once")t.once=!0;else if(i==="capture")t.capture=!0;else if(i==="self")t.self=!0;else if(i==="passive")t.passive=!0;else if(i==="nonpassive")t.nonpassive=!0;else if(da.has(i))t.systemKeys.push(i);else if(i in Vr)t.mouse=i;else if(i in Br||/^[a-z]$/.test(i))t.keys.push(Br[i]||i.toUpperCase());else if(i.startsWith("debounce")){let a=i.match(/debounce(?:\.(\d+))?/);t.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(i.startsWith("throttle")){let a=i.match(/throttle(?:\.(\d+))?/);t.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return t}function Ur(e,t=""){let n=[],i=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=a.exec(e))!==null){let[c,b,v]=l,T=l.index,P=T+c.length,M=`__stx_evt_${t}${i++}`,H=[],O=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,L;while((L=O.exec(v))!==null){let[,F,ee]=L,G=F.split("."),j=G[0];if(!zr.has(j))continue;H.push({attribute:`@${F}`,event:j,handler:ee,modifiers:Wr(G.slice(1)),elementId:M})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((L=B.exec(v))!==null){let[,F,ee]=L,G=F.split("."),j=G[0];if(!zr.has(j))continue;H.push({attribute:`@${F}`,event:j,handler:ee,modifiers:Wr(G.slice(1)),elementId:M})}if(H.length>0)n.push({originalTag:c,elementId:M,events:H,startIndex:T,endIndex:P})}return n}function ga(e){let t=[],{modifiers:n}=e;if(n.self)t.push("if ($event.target !== $el) return");for(let i of n.systemKeys)t.push(`if (!$event.${i}Key) return`);if(n.keys.length>0){let i=n.keys.map((a)=>`$event.key === '${a}'`).join(" || ");t.push(`if (!(${i})) return`)}if(n.mouse!==null){let i=Vr[n.mouse];t.push(`if ($event.button !== ${i}) return`)}if(n.prevent)t.push("$event.preventDefault()");if(n.stop)t.push("$event.stopPropagation()");return t.join("; ")}function ma(e,t){let n=e;if(t.debounce!==null)n=`__stx_debounce(() => { ${n} }, ${t.debounce})`;else if(t.throttle!==null)n=`__stx_throttle(() => { ${n} }, ${t.throttle})`;return n}function ys(e){let t=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(t))return e;return`if (typeof ${t} === 'function' && !${t}._isSignal) ${t}($event);`}function ha(e){let{modifiers:t}=e,n=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),i=ga(e),a=ma(ys(e.handler),t),l=[];if(t.once)l.push("once: true");if(t.capture)l.push("capture: true");if(bs(e.event,t))l.push("passive: true");let c=l.length>0?`, { ${l.join(", ")} }`:"",b=a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
2
+ import{He,Cn,Gs,Ti,D}from"./chunk-46t924aw.js";import{_n}from"./chunk-gpkxphqz.js";import{Lr,k,hl,ct,Di,yl}from"./chunk-0wms5teg.js";import{I}from"./chunk-xppm4cs4.js";import{R,_,Js,u,f,Bt,d,K,z,x,eo,Ce,Ue,to}from"./chunk-eg2p1cyw.js";import{s,me}from"./chunk-jm0qsr3s.js";import{g}from"./chunk-0dve54ne.js";import{X}from"./chunk-k44qj40k.js";import at from"path";import Wt from"process";import{AsyncLocalStorage as ca}from"async_hooks";var Pr=new ca;function bn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function Or(e,t){return Pr.run(bn(e),t)}async function Dr(e,t){let n=Pr.getStore();if(!n)throw Error("useServerData must run inside a <script server> render");if(typeof e!=="string"||!e.trim())throw TypeError("useServerData requires a non-empty string key");let i=n.pending.get(e);if(i)return i;let a=Promise.resolve().then(t).then((l)=>{let c=JSON.stringify(l,(v,T)=>{if(T===void 0||typeof T==="function"||typeof T==="symbol"||typeof T==="bigint"||typeof T==="number"&&!Number.isFinite(T))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(T&&typeof T==="object"&&!Array.isArray(T)&&Object.getPrototypeOf(T)!==Object.prototype&&Object.getPrototypeOf(T)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return T}),b=JSON.parse(c);return n.values.set(e,b),b}).catch((l)=>{throw n.pending.delete(e),l});return n.pending.set(e,a),a}function $r(e){let t=e.__stx_server_data;if(!t?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(t.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function V(e,t=!1){let n=s(e),i=[],a=new Set,l=0,c=0,b=n.length,v=()=>{if(l!==0)return;let T=n.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(T){if(t&&T[1]==="const")return;let L=T[2];if(!a.has(L))i.push(L),a.add(L);return}let P=n.slice(c).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(P){if(t&&n.slice(c).startsWith("const"))return;P[1].split(",").forEach((L)=>{let B=L.trim();if(!B)return;let F=B.indexOf(":"),G=(F>=0?B.slice(F+1).trim():B).split(/[\s=]/)[0];if(G&&!a.has(G))i.push(G),a.add(G)});return}let M=n.slice(c).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(M){if(t&&n.slice(c).startsWith("const"))return;M[1].split(",").forEach((L)=>{let B=L.trim().replace(/^\.\.\./,"");if(!B)return;let F=B.split(/[\s=]/)[0];if(F&&!a.has(F))i.push(F),a.add(F)});return}if(t)return;let H=n.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let L=H[1];if(!a.has(L))i.push(L),a.add(L);return}let O=n.slice(c).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let L=O[1];if(!a.has(L))i.push(L),a.add(L)}};while(c<b){if(n[c]==="{"){l++,c++;continue}if(n[c]==="}"){l--,c++;continue}if(l===0&&/[a-z]/i.test(n[c])&&(c===0||/\s|[;{}()]/.test(n[c-1])))v();c++}return i.join(", ")}function Ds(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function la(e,t=V(e).split(",").map((n)=>n.trim()).filter(Boolean)){let n=new Set(V(e,!0).split(",").map((i)=>i.trim()));return t.map((i)=>n.has(i)?`get ${i}() { return ${i} }, set ${i}(__stxValue_${i}) { ${i} = __stxValue_${i} }`:i).join(", ")}function Ms(e,t){let n=`{ ${la(e,t)} }`;return V(e).split(",").some((i)=>i.trim()==="__stxLiveBindings")?`Object.defineProperties(${n}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:n}import jt from"fs";import ve from"path";function U(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var Mr=new Map;function xr(e,t=!0){let n=Mr.get(e);if(t&&n)return n;let i=new Map,a=[ve.join(e,"src"),ve.join(e,"dist"),e];function l(c,b){if(b>6)return;let v;try{v=jt.readdirSync(c,{withFileTypes:!0})}catch{return}for(let T of v){let P=ve.join(c,T.name);if(T.isDirectory()){if(T.name==="node_modules"||T.name.startsWith("."))continue;l(P,b+1)}else if(T.isFile()&&T.name.endsWith(".stx")){let M=T.name.slice(0,-4);if(!i.has(M))i.set(M,P);let H=M.toLowerCase();if(!i.has(H))i.set(H,P);let O=U(M);if(!i.has(O))i.set(O,P)}}}for(let c of a)if(l(c,0),i.size>0)break;if(t)Mr.set(e,i);return i}function Ls(e,t){if(e.startsWith(".")||e.startsWith("/"))return null;let n=t;while(!0){let i=ve.join(n,"node_modules",e);try{if(jt.statSync(i).isDirectory())return i}catch{}let a=ve.dirname(n);if(a===n)return null;n=a}}function js(e,t,n={}){return[ve.resolve(ve.dirname(t),`${e}.stx`),ve.resolve(ve.dirname(t),e),ve.resolve(n.componentsDir||"components",`${e}.stx`),ve.resolve(n.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function jr(e){let t=e.endsWith(".stx")?e.slice(0,-4):e,n=t.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),i=U(t);return[t,n,i]}function ui(e,t){let[n,i,a]=jr(e);for(let l of[n,n.toLowerCase(),i,a]){let c=t?.__importedComponents?.get(l);if(c!==void 0)return c}}function ua(e,t){let n=t?ve.resolve(t):void 0,i=ve.dirname(ve.resolve(e));for(;;){if(jt.existsSync(ve.join(i,"package.json")))return n&&i===n?void 0:i;let a=ve.dirname(i);if(a===i)return;i=a}}var fa=["src/ui","src/components","components","dist"];function Ln(e,t){let n=ve.resolve(e);if(!t&&!n.split(ve.sep).includes("node_modules"))return[];let i=ua(n,t);if(!i)return[];let a=[];try{let b=JSON.parse(jt.readFileSync(ve.join(i,"package.json"),"utf8")).stx?.components;if(Array.isArray(b))a=b.filter((v)=>typeof v==="string")}catch{}let l=a.length?a:fa;return[ve.dirname(ve.resolve(e)),...l.map((c)=>ve.resolve(i,c))]}function*di(e,t,n={},i){let a=jr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield ve.resolve(ve.dirname(t),`${a[0]}.stx`);return}let l=[...new Set(a.map((v)=>`${v}.stx`))],c=n.projectRoot||process.cwd(),b=[...Ln(t,n.projectRoot),...i?.__originalFilePath?[ve.join(ve.dirname(i.__originalFilePath),"components")]:[],...n.componentsDir?[n.componentsDir]:[],ve.join(ve.dirname(t),"components"),ve.resolve(c,"src/components"),ve.resolve(c,"components"),...import.meta.dir?[ve.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(b)){for(let T of l)yield ve.join(v,T);try{for(let T of jt.readdirSync(v,{withFileTypes:!0}))if(T.isDirectory())for(let P of l)yield ve.join(v,T.name,P)}catch{}}}function Nr(e,t,n={},i){let a=ui(e,i);if(a!==void 0)return a;for(let l of di(e,t,n,i))try{if(jt.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function Bs(e,t=[],n={}){let i=new Set([...e].map((T)=>T.replace(/[-_]/g,"").toLowerCase()));if(!i.has("src")&&!i.has("source")||!i.has("alt")&&!i.has("decorative"))return!1;let a=new Map(Object.entries(n).map(([T,P])=>[T.replace(/[-_]/g,"").toLowerCase(),P])),l=a.get("alt"),c=a.get("decorative"),b=typeof l==="string"&&!!l.trim(),v=typeof c==="string"?!["false","0","off","no"].includes(c.trim().toLowerCase()):Boolean(c);if(!b&&!v)return!1;if(["defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((T)=>i.has(T)))return!1;if([...t].some((T)=>!["load","error"].includes(T.replace(/^@/,"").split(".")[0].toLowerCase())))return!1;if(i.has("resizemode")&&(i.has("fit")||i.has("objectfit")))return!1;if(i.has("src")&&i.has("source"))return!1;return["fit","objectfit","resizemode","position","objectposition","rounded","aspectratio","zoomonhover","sources","webpsrc","webpsrcset"].some((T)=>i.has(T))}import rs from"fs";import ce from"path";import St from"path";import en from"fs";var pa=new Set(["touchstart","touchmove","wheel","mousewheel"]);function bs(e,t){if(t.passive)return!0;if(t.prevent||t.nonpassive)return!1;return pa.has(e.toLowerCase())}var zr=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),Br={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},da=new Set(["ctrl","alt","shift","meta"]),Vr={left:0,middle:1,right:2};function Wr(e){let t={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let n of e){let i=n.toLowerCase();if(i==="prevent")t.prevent=!0;else if(i==="stop")t.stop=!0;else if(i==="once")t.once=!0;else if(i==="capture")t.capture=!0;else if(i==="self")t.self=!0;else if(i==="passive")t.passive=!0;else if(i==="nonpassive")t.nonpassive=!0;else if(da.has(i))t.systemKeys.push(i);else if(i in Vr)t.mouse=i;else if(i in Br||/^[a-z]$/.test(i))t.keys.push(Br[i]||i.toUpperCase());else if(i.startsWith("debounce")){let a=i.match(/debounce(?:\.(\d+))?/);t.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(i.startsWith("throttle")){let a=i.match(/throttle(?:\.(\d+))?/);t.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return t}function Ur(e,t=""){let n=[],i=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=a.exec(e))!==null){let[c,b,v]=l,T=l.index,P=T+c.length,M=`__stx_evt_${t}${i++}`,H=[],O=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,L;while((L=O.exec(v))!==null){let[,F,ee]=L,G=F.split("."),j=G[0];if(!zr.has(j))continue;H.push({attribute:`@${F}`,event:j,handler:ee,modifiers:Wr(G.slice(1)),elementId:M})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((L=B.exec(v))!==null){let[,F,ee]=L,G=F.split("."),j=G[0];if(!zr.has(j))continue;H.push({attribute:`@${F}`,event:j,handler:ee,modifiers:Wr(G.slice(1)),elementId:M})}if(H.length>0)n.push({originalTag:c,elementId:M,events:H,startIndex:T,endIndex:P})}return n}function ga(e){let t=[],{modifiers:n}=e;if(n.self)t.push("if ($event.target !== $el) return");for(let i of n.systemKeys)t.push(`if (!$event.${i}Key) return`);if(n.keys.length>0){let i=n.keys.map((a)=>`$event.key === '${a}'`).join(" || ");t.push(`if (!(${i})) return`)}if(n.mouse!==null){let i=Vr[n.mouse];t.push(`if ($event.button !== ${i}) return`)}if(n.prevent)t.push("$event.preventDefault()");if(n.stop)t.push("$event.stopPropagation()");return t.join("; ")}function ma(e,t){let n=e;if(t.debounce!==null)n=`__stx_debounce(() => { ${n} }, ${t.debounce})`;else if(t.throttle!==null)n=`__stx_throttle(() => { ${n} }, ${t.throttle})`;return n}function ys(e){let t=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(t))return e;return`if (typeof ${t} === 'function' && !${t}._isSignal) ${t}($event);`}function ha(e){let{modifiers:t}=e,n=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),i=ga(e),a=ma(ys(e.handler),t),l=[];if(t.once)l.push("once: true");if(t.capture)l.push("capture: true");if(bs(e.event,t))l.push("passive: true");let c=l.length>0?`, { ${l.join(", ")} }`:"",b=a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
3
3
  (function() {
4
4
  var $el = document.getElementById('${n}');
5
5
  if (!$el) return;
@@ -112,7 +112,7 @@ else {
112
112
  `)}
113
113
  })();
114
114
  </script>`}function xa(e,t=""){let n=Ur(e,t);if(n.length===0)return{template:e,bindings:[]};let i=e,a=[];for(let l=n.length-1;l>=0;l--){let c=n[l],b=c.originalTag;if(!b.includes(" id="))b=b.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${c.elementId}"`);else{let v=b.match(/id=["']([^"']+)["']/);if(v)for(let T of c.events)T.elementId=v[1]}for(let v of c.events){let T=v.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),P=new RegExp(`\\s*${T}\\s*=\\s*"[^"]*"`,"g"),M=new RegExp(`\\s*${T}\\s*=\\s*'[^']*'`,"g");b=b.replace(P,""),b=b.replace(M,"")}i=i.slice(0,c.startIndex)+b+i.slice(c.endIndex),a.push(...c.events)}return{template:i,bindings:a}}function Fr(e){let t=e.$uid;return typeof t==="string"&&t?`${t}_`:""}function Nc(e,t,n){if(yl(e))return e;if(t.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:b,bindings:v}=xa(e,Fr(t)),T=t.__stx_event_bindings||[];return t.__stx_event_bindings=[...T,...v],b}let i=Ur(e,Fr(t));if(i.length===0)return e;let a=e;for(let b=i.length-1;b>=0;b--){let v=i[b],T=v.originalTag;if(!T.includes(" id="))T=T.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${v.elementId}"`);else{let P=T.match(/id=["']([^"']+)["']/);if(P)for(let M of v.events)M.elementId=P[1]}for(let P of v.events){let M=P.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),H=new RegExp(`\\s*${M}\\s*=\\s*"[^"]*"`,"g"),O=new RegExp(`\\s*${M}\\s*=\\s*'[^']*'`,"g");T=T.replace(H,""),T=T.replace(O,"")}a=a.slice(0,v.startIndex)+T+a.slice(v.endIndex)}let l=pi(i.flatMap((b)=>b.events)),c=a.lastIndexOf("</body>");if(c!==-1)a=a.slice(0,c)+l+`
115
- `+a.slice(c);else a+=l;return a}function Hr(e,t){let n=new Set;for(let i of e.split(",")){let a=i.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(t){let l=a.lastIndexOf(":");if(l!==-1)a=a.slice(l+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))n.add(a)}return n}function At(e,t){let n=s(e),{depths:i,balanced:a}=me(n),l=(b)=>!a||i[b]===0,c=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${t}\\b)`,"g");for(let b of n.matchAll(c)){let v=(b.index??0)+b[0].length-b[1].length;if(l(v))return!0}for(let b of n.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(b.index??0)&&Hr(b[1],!0).has(t))return!0;for(let b of n.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(b.index??0)&&Hr(b[1],!1).has(t))return!0;return!1}var qr=new R(32,{maxBytes:2097152,sizeOf:(e)=>e.code.length*4}),bt=/^[A-Za-z_$][\w$]*$/,ba=new Set(["if","for","while","switch","with"]),Zr=["(","[","{"],Kr=[")","]","}"],ya=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function _a(e){let t=s(e),n=[];for(let i of t.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=i.index??0;n.push({text:i[0],start:a,end:a+i[0].length})}return{code:t,tokens:n}}function _s(e){let t=qr.get(e);if(t)return t;let{code:n,tokens:i}=_a(e),a=new Map,l=[];for(let F=0;F<i.length;F++){let ee=i[F].text;if(["(","[","{"].includes(ee))l.push(F);else if([")","]","}"].includes(ee)){let G=l.at(-1);if(G!==void 0&&["()","[]","{}"].includes(i[G].text+ee))l.pop(),a.set(G,F),a.set(F,G)}}function c(F,ee){let G=[],j=F;for(let te=F;te<ee;te++){if(["(","[","{"].includes(i[te].text)&&(a.get(te)??ee)<ee){te=a.get(te);continue}if(i[te].text===",")G.push([j,te]),j=te+1}return G.push([j,ee]),G}let b=[];function v(F,ee,G,j=!1){if(i[F]?.text==="...")F++;if(F>=ee)return;let te=i[F].text;if(bt.test(te)){if(G.add(te),G===M)b.push({name:te,token:F,functionScoped:j});return}if(te!=="{"&&te!=="[")return;let se=a.get(F);if(se===void 0||se>=ee)return;for(let[ne,ue]of c(F+1,se)){let ye=ne;if(te==="{")for(let de=ne;de<ue;de++){if(i[de].text===":"){ye=de+1;break}if(i[de].text==="=")break;if(["(","[","{"].includes(i[de].text)&&a.has(de))de=a.get(de)}v(ye,ue,G,j)}}function T(F,ee){let G=new Set;for(let[j,te]of c(F,ee))v(j,te,G);return G}function P(F){let ee=F;for(;ee<i.length;ee++){let G=i[ee].text;if(["(","[","{"].includes(G)&&a.has(ee)){ee=a.get(ee);continue}if([",",";",")","]","}"].includes(G))break}return i[Math.max(F,ee-1)]?.end??n.length}let M=new Set,H=[];for(let F=0;F<i.length;F++)if(i[F].text==="=>"){let ee=F-1,G=ee,j;if(i[ee]?.text===")"&&a.has(ee))G=a.get(ee),j=T(G+1,ee);else if(i[ee]&&bt.test(i[ee].text))j=new Set([i[ee].text]);else continue;let te=F+1,se=i[te]?.text==="{"&&a.has(te)?i[a.get(te)].end:P(te);H.push({start:i[G].start,end:se,bodyStart:i[te]?.start??se,functionBody:!0,names:j})}else if(i[F].text==="("&&a.has(F)){let ee=i[F-1]?.text;if(!ee||ba.has(ee)||!bt.test(ee)&&ee!=="*"&&ee!=="]")continue;let G=a.get(F),j=G+1;if(i[j]?.text===":"){j++;while(j<i.length&&!["{","=>",";","="].includes(i[j].text))j++}if(i[j]?.text!=="{"||!a.has(j))continue;H.push({start:i[F].start,end:i[a.get(j)].end,bodyStart:i[j].start,functionBody:ee!=="catch",names:T(F+1,G)})}function O(F){let ee=F;for(;ee<i.length;ee++){let G=i[ee].text;if(Zr.includes(G)&&a.has(ee)){ee=a.get(ee);continue}if(G===";"||Kr.includes(G))break;let j=i[ee-1];if(ee>F&&ya.has(G)&&j.text!==".")break;if(ee>F&&/[\n\r]/.test(n.slice(j.end,i[ee].start))&&(/^[\w$]+$/.test(j.text)||Kr.includes(j.text)||['"',"'","`"].includes(j.text))&&bt.test(G)&&!["in","of","instanceof"].includes(G))break}return ee}let L=[];for(let F=0;F<i.length;F++){if(i[F].text!=="for")continue;let ee=i[F+1]?.text==="await"?F+2:F+1;if(i[ee]?.text!=="("||!a.has(ee))continue;let G=a.get(ee),j=G+1,te=i[j]?.text==="{"&&a.has(j)?a.get(j):O(j),se=i[te]?.text===";"||i[te]?.text==="}"?i[te].end:i[Math.max(j,te-1)]?.end??n.length;L.push({headStart:ee,headEnd:G,start:i[ee].start,end:se})}for(let F=0;F<i.length;F++){let ee=i[F].text,G=i[F-1]?.text;if(G==="."||i[F+1]?.text===":")continue;if(G==="as"||G==="<")continue;if(ee==="const"||ee==="let"||ee==="var"){let j=O(F+1),te=F+1,se=!1,ne=!1,ue=0;for(let ye=F+1;ye<=j;ye++){let de=i[ye]?.text;if(ye<j&&Zr.includes(de)&&a.has(ye)&&a.get(ye)<j){ye=a.get(ye);continue}if(ye<j&&de===":"&&!ne)se=!0;else if(ye<j&&de==="="&&ue===0)se=!1,ne=!0;else if(ye<j&&se&&de==="<")ue++;else if(ye<j&&se&&de===">"&&ue>0)ue--;else if(ye===j||de===","&&ue===0)v(te,ye,M,ee==="var"),te=ye+1,se=!1,ne=!1}}else if(ee==="function"||ee==="class"){let j=F+1;if(i[j]?.text==="*")j++;if(i[j]&&bt.test(i[j].text)&&i[j].text!=="extends")M.add(i[j].text),b.push({name:i[j].text,token:j})}else if(ee==="import"){let j=F+1;if(i[j]?.text==="*"&&i[j+1]?.text==="as")j+=2;let te=i[j]?.text;if(te&&bt.test(te)&&te!=="type"&&i[j+1]?.text!=="("&&i[j+1]?.text!==".")M.add(te),b.push({name:te,token:j,file:!0});let se=i[j]?.text==="{"?j:i[j+1]?.text===","&&i[j+2]?.text==="{"?j+2:-1;if(se!==-1&&a.has(se)){let ne=a.get(se);for(let[ue,ye]of c(se+1,ne)){let de=ye-1;while(de>=ue&&!bt.test(i[de].text))de--;if(de>=ue&&i[de].text!=="type")b.push({name:i[de].text,token:de,file:!0})}}}}let B={code:n,scopes:H,loops:L,declarations:M,sites:b,tokens:i,pairs:a};return qr.set(e,B),B}function Qt(e){let t=_s(e);return{code:t.code,shadows:(n,i)=>t.scopes.some((a)=>i>=a.start&&i<a.end&&a.names.has(n))}}function zn(e){return new Set(_s(e).declarations)}function Oe(e,t){let{scopes:n,loops:i,sites:a,tokens:l,pairs:c}=_s(e),b=Array.from({length:l.length},()=>-1),v=[];for(let O=0;O<l.length;O++){b[O]=v.length?v[v.length-1]:-1;let L=l[O].text;if(L==="{"&&c.has(O))v.push(O);else if(L==="}"&&v.length&&c.get(O)===v[v.length-1])v.pop()}let T=new Set,P=new Map;for(let O of a){if(!t.has(O.name))continue;T.add(O.token);let L=O.file?-1:b[O.token],B=L===-1?[0,Number.POSITIVE_INFINITY]:[l[L].start,l[c.get(L)].end];if(O.functionScoped){let ee=l[O.token].start,G=n.filter((j)=>j.functionBody&&ee>=j.bodyStart&&ee<j.end).sort((j,te)=>j.end-j.bodyStart-(te.end-te.bodyStart))[0];B=G?[G.bodyStart,G.end]:[0,Number.POSITIVE_INFINITY]}else if(!O.file){let ee=i.filter((G)=>O.token>G.headStart&&O.token<G.headEnd).sort((G,j)=>G.headEnd-G.headStart-(j.headEnd-j.headStart))[0];if(ee)B=[ee.start,ee.end]}let F=P.get(O.name);if(F)F.push(B);else P.set(O.name,[B])}let M=new Set;for(let O=0;O<l.length;O++){if(l[O].text!=="import"||l[O-1]?.text===".")continue;let L=O+1;if(l[L]?.text==="type")L++;if(l[L]&&bt.test(l[L].text)&&l[L+1]?.text===",")L+=2;if(l[L]?.text==="{"&&c.has(L))for(let B=L+1;B<c.get(L);B++)M.add(B)}let H=new Set;for(let O=0;O<l.length;O++){let L=l[O].text;if(!t.has(L)||H.has(L)||T.has(O)||M.has(O))continue;let B=l[O-1]?.text;if(B==="#"||B==="."&&l[O-2]?.text!=="..")continue;if(l[O+1]?.text===":"&&(B==="{"||B===","))continue;let F=l[O].start;if(P.get(L)?.some(([ee,G])=>F>=ee&&F<G))continue;if(n.some((ee)=>F>=ee.start&&F<ee.end&&ee.names.has(L)))continue;H.add(L)}return H}var Ie="0.2.847";var Xr=Symbol.for(`stx.lazy-module-promises.${Ie}`);function Sa(){let e=globalThis;return e[Xr]??=new Map,e[Xr]}function o(e,t){let n=Sa(),i=`${import.meta.url}\x00${e}`,a=n.get(i);if(a)return a;let l=t();return n.set(i,l),l.catch(()=>{if(n.get(i)===l)n.delete(i)}),l}var $a=/<\/(script)/gi;function fn(e){if(!e||e.indexOf("</")===-1)return e;return e.replace($a,"<\\/$1")}import Jr from"fs";var Gr=[];function w(e){let t=new R(e);return Gr.push(t),t}function Dc(){for(let e of Gr)e.clear()}function S(e,...t){return`${t.map((n)=>String(n??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function Sr(e){let t=[];for(let n of new Set(e))try{t.push({path:n,mtimeMs:Jr.statSync(n).mtimeMs})}catch{}return t}function Fs(e){for(let t of e)try{if(Jr.statSync(t.path).mtimeMs!==t.mtimeMs)return!1}catch{return!1}return!0}var Se=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useIntervalFn","useObjectUrl"];var va=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function Ea(e){if(e.startsWith(".")||e.startsWith("/"))return null;if(e.startsWith("@")){let n=e.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!n)return null;return{pkg:n[1],subpath:n[2]||""}}let t=e.match(/^([^/]+)(\/.*)?$/);if(!t)return null;return{pkg:t[1],subpath:t[2]||""}}function ka(e,t){let n=t;while(!0){let i=St.join(n,"node_modules",e,"package.json");if(en.existsSync(i))return St.dirname(i);let a=St.dirname(n);if(a===n)return null;n=a}}function Ca(e,t){if(!e||typeof e!=="object")return null;let n=(a)=>{if(typeof a==="string")return a;if(a&&typeof a==="object"){if(typeof a.import==="string")return a.import;if(typeof a.default==="string")return a.default;if(typeof a.import==="object")return n(a.import);if(typeof a.default==="object")return n(a.default)}return null};if(Object.prototype.hasOwnProperty.call(e,t))return n(e[t]);let i=null;for(let a of Object.keys(e)){let l=a.indexOf("*");if(l===-1)continue;let c=a.slice(0,l),b=a.slice(l+1);if(!t.startsWith(c)||!t.endsWith(b))continue;if(t.length<c.length+b.length)continue;if(!i||c.length>i.prefix.length)i={pattern:a,prefix:c,suffix:b}}if(i){let a=t.slice(i.prefix.length,t.length-i.suffix.length),l=n(e[i.pattern]);if(l)return l.replace("*",a)}return null}function Ra(e,t){let n=Ea(e);if(!n||!n.subpath)return null;let i=ka(n.pkg,t);if(!i)return null;let a;try{a=JSON.parse(en.readFileSync(St.join(i,"package.json"),"utf8"))}catch{return null}let l=`.${n.subpath}`,c=Ca(a.exports,l);if(!c)return null;let b=St.resolve(i,c);return en.existsSync(b)?b:null}function vi(e,t){let n=t.filePath?St.dirname(t.filePath):t.projectRoot||process.cwd(),i=t.projectRoot||process.cwd(),a=new Set,l=[],c=[];return{code:e.replace(va,(v,T)=>{let P;try{if(T.startsWith("./")||T.startsWith("../")||T.startsWith("/")){if(P=T.startsWith("/")?T:St.resolve(n,T),!en.existsSync(P))throw Error(`file not found: ${P}`)}else{let M=null;try{M=Bun.resolveSync(T,i)}catch{M=Ra(T,i)}if(!M)throw Error(`could not resolve ${T} (Bun.resolveSync + exports fallback both failed)`);P=M}}catch(M){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(T)} (from ${t.filePath||"<unknown>"}): ${M?.message||M}`),c.push(T),""}if(a.has(P))return"";a.add(P);try{let M=en.readFileSync(P,"utf8");l.push({source:T,resolvedPath:P,contents:M})}catch(M){console.warn(`[stx:vendor-css] could not read ${P}: ${M?.message||M}`),c.push(T)}return""}),styles:l,unresolved:c}}function Ta(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function xi(e){if(e.length===0)return"";return`${e.map((t)=>`<style data-stx-vendor="${Ta(t.source)}" data-stx-layer="vendor">
115
+ `+a.slice(c);else a+=l;return a}function Hr(e,t){let n=new Set;for(let i of e.split(",")){let a=i.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(t){let l=a.lastIndexOf(":");if(l!==-1)a=a.slice(l+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))n.add(a)}return n}function At(e,t){let n=s(e),{depths:i,balanced:a}=me(n),l=(b)=>!a||i[b]===0,c=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${t}\\b)`,"g");for(let b of n.matchAll(c)){let v=(b.index??0)+b[0].length-b[1].length;if(l(v))return!0}for(let b of n.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(b.index??0)&&Hr(b[1],!0).has(t))return!0;for(let b of n.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(b.index??0)&&Hr(b[1],!1).has(t))return!0;return!1}var qr=new R(32,{maxBytes:2097152,sizeOf:(e)=>e.code.length*4}),bt=/^[A-Za-z_$][\w$]*$/,ba=new Set(["if","for","while","switch","with"]),Zr=["(","[","{"],Kr=[")","]","}"],ya=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function _a(e){let t=s(e),n=[];for(let i of t.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=i.index??0;n.push({text:i[0],start:a,end:a+i[0].length})}return{code:t,tokens:n}}function _s(e){let t=qr.get(e);if(t)return t;let{code:n,tokens:i}=_a(e),a=new Map,l=[];for(let F=0;F<i.length;F++){let ee=i[F].text;if(["(","[","{"].includes(ee))l.push(F);else if([")","]","}"].includes(ee)){let G=l.at(-1);if(G!==void 0&&["()","[]","{}"].includes(i[G].text+ee))l.pop(),a.set(G,F),a.set(F,G)}}function c(F,ee){let G=[],j=F;for(let te=F;te<ee;te++){if(["(","[","{"].includes(i[te].text)&&(a.get(te)??ee)<ee){te=a.get(te);continue}if(i[te].text===",")G.push([j,te]),j=te+1}return G.push([j,ee]),G}let b=[];function v(F,ee,G,j=!1){if(i[F]?.text==="...")F++;if(F>=ee)return;let te=i[F].text;if(bt.test(te)){if(G.add(te),G===M)b.push({name:te,token:F,functionScoped:j});return}if(te!=="{"&&te!=="[")return;let se=a.get(F);if(se===void 0||se>=ee)return;for(let[ne,ue]of c(F+1,se)){let ye=ne;if(te==="{")for(let de=ne;de<ue;de++){if(i[de].text===":"){ye=de+1;break}if(i[de].text==="=")break;if(["(","[","{"].includes(i[de].text)&&a.has(de))de=a.get(de)}v(ye,ue,G,j)}}function T(F,ee){let G=new Set;for(let[j,te]of c(F,ee))v(j,te,G);return G}function P(F){let ee=F;for(;ee<i.length;ee++){let G=i[ee].text;if(["(","[","{"].includes(G)&&a.has(ee)){ee=a.get(ee);continue}if([",",";",")","]","}"].includes(G))break}return i[Math.max(F,ee-1)]?.end??n.length}let M=new Set,H=[];for(let F=0;F<i.length;F++)if(i[F].text==="=>"){let ee=F-1,G=ee,j;if(i[ee]?.text===")"&&a.has(ee))G=a.get(ee),j=T(G+1,ee);else if(i[ee]&&bt.test(i[ee].text))j=new Set([i[ee].text]);else continue;let te=F+1,se=i[te]?.text==="{"&&a.has(te)?i[a.get(te)].end:P(te);H.push({start:i[G].start,end:se,bodyStart:i[te]?.start??se,functionBody:!0,names:j})}else if(i[F].text==="("&&a.has(F)){let ee=i[F-1]?.text;if(!ee||ba.has(ee)||!bt.test(ee)&&ee!=="*"&&ee!=="]")continue;let G=a.get(F),j=G+1;if(i[j]?.text===":"){j++;while(j<i.length&&!["{","=>",";","="].includes(i[j].text))j++}if(i[j]?.text!=="{"||!a.has(j))continue;H.push({start:i[F].start,end:i[a.get(j)].end,bodyStart:i[j].start,functionBody:ee!=="catch",names:T(F+1,G)})}function O(F){let ee=F;for(;ee<i.length;ee++){let G=i[ee].text;if(Zr.includes(G)&&a.has(ee)){ee=a.get(ee);continue}if(G===";"||Kr.includes(G))break;let j=i[ee-1];if(ee>F&&ya.has(G)&&j.text!==".")break;if(ee>F&&/[\n\r]/.test(n.slice(j.end,i[ee].start))&&(/^[\w$]+$/.test(j.text)||Kr.includes(j.text)||['"',"'","`"].includes(j.text))&&bt.test(G)&&!["in","of","instanceof"].includes(G))break}return ee}let L=[];for(let F=0;F<i.length;F++){if(i[F].text!=="for")continue;let ee=i[F+1]?.text==="await"?F+2:F+1;if(i[ee]?.text!=="("||!a.has(ee))continue;let G=a.get(ee),j=G+1,te=i[j]?.text==="{"&&a.has(j)?a.get(j):O(j),se=i[te]?.text===";"||i[te]?.text==="}"?i[te].end:i[Math.max(j,te-1)]?.end??n.length;L.push({headStart:ee,headEnd:G,start:i[ee].start,end:se})}for(let F=0;F<i.length;F++){let ee=i[F].text,G=i[F-1]?.text;if(G==="."||i[F+1]?.text===":")continue;if(G==="as"||G==="<")continue;if(ee==="const"||ee==="let"||ee==="var"){let j=O(F+1),te=F+1,se=!1,ne=!1,ue=0;for(let ye=F+1;ye<=j;ye++){let de=i[ye]?.text;if(ye<j&&Zr.includes(de)&&a.has(ye)&&a.get(ye)<j){ye=a.get(ye);continue}if(ye<j&&de===":"&&!ne)se=!0;else if(ye<j&&de==="="&&ue===0)se=!1,ne=!0;else if(ye<j&&se&&de==="<")ue++;else if(ye<j&&se&&de===">"&&ue>0)ue--;else if(ye===j||de===","&&ue===0)v(te,ye,M,ee==="var"),te=ye+1,se=!1,ne=!1}}else if(ee==="function"||ee==="class"){let j=F+1;if(i[j]?.text==="*")j++;if(i[j]&&bt.test(i[j].text)&&i[j].text!=="extends")M.add(i[j].text),b.push({name:i[j].text,token:j})}else if(ee==="import"){let j=F+1;if(i[j]?.text==="*"&&i[j+1]?.text==="as")j+=2;let te=i[j]?.text;if(te&&bt.test(te)&&te!=="type"&&i[j+1]?.text!=="("&&i[j+1]?.text!==".")M.add(te),b.push({name:te,token:j,file:!0});let se=i[j]?.text==="{"?j:i[j+1]?.text===","&&i[j+2]?.text==="{"?j+2:-1;if(se!==-1&&a.has(se)){let ne=a.get(se);for(let[ue,ye]of c(se+1,ne)){let de=ye-1;while(de>=ue&&!bt.test(i[de].text))de--;if(de>=ue&&i[de].text!=="type")b.push({name:i[de].text,token:de,file:!0})}}}}let B={code:n,scopes:H,loops:L,declarations:M,sites:b,tokens:i,pairs:a};return qr.set(e,B),B}function Qt(e){let t=_s(e);return{code:t.code,shadows:(n,i)=>t.scopes.some((a)=>i>=a.start&&i<a.end&&a.names.has(n))}}function zn(e){return new Set(_s(e).declarations)}function Oe(e,t){let{scopes:n,loops:i,sites:a,tokens:l,pairs:c}=_s(e),b=Array.from({length:l.length},()=>-1),v=[];for(let O=0;O<l.length;O++){b[O]=v.length?v[v.length-1]:-1;let L=l[O].text;if(L==="{"&&c.has(O))v.push(O);else if(L==="}"&&v.length&&c.get(O)===v[v.length-1])v.pop()}let T=new Set,P=new Map;for(let O of a){if(!t.has(O.name))continue;T.add(O.token);let L=O.file?-1:b[O.token],B=L===-1?[0,Number.POSITIVE_INFINITY]:[l[L].start,l[c.get(L)].end];if(O.functionScoped){let ee=l[O.token].start,G=n.filter((j)=>j.functionBody&&ee>=j.bodyStart&&ee<j.end).sort((j,te)=>j.end-j.bodyStart-(te.end-te.bodyStart))[0];B=G?[G.bodyStart,G.end]:[0,Number.POSITIVE_INFINITY]}else if(!O.file){let ee=i.filter((G)=>O.token>G.headStart&&O.token<G.headEnd).sort((G,j)=>G.headEnd-G.headStart-(j.headEnd-j.headStart))[0];if(ee)B=[ee.start,ee.end]}let F=P.get(O.name);if(F)F.push(B);else P.set(O.name,[B])}let M=new Set;for(let O=0;O<l.length;O++){if(l[O].text!=="import"||l[O-1]?.text===".")continue;let L=O+1;if(l[L]?.text==="type")L++;if(l[L]&&bt.test(l[L].text)&&l[L+1]?.text===",")L+=2;if(l[L]?.text==="{"&&c.has(L))for(let B=L+1;B<c.get(L);B++)M.add(B)}let H=new Set;for(let O=0;O<l.length;O++){let L=l[O].text;if(!t.has(L)||H.has(L)||T.has(O)||M.has(O))continue;let B=l[O-1]?.text;if(B==="#"||B==="."&&l[O-2]?.text!=="..")continue;if(l[O+1]?.text===":"&&(B==="{"||B===","))continue;let F=l[O].start;if(P.get(L)?.some(([ee,G])=>F>=ee&&F<G))continue;if(n.some((ee)=>F>=ee.start&&F<ee.end&&ee.names.has(L)))continue;H.add(L)}return H}var Ie="0.2.849";var Xr=Symbol.for(`stx.lazy-module-promises.${Ie}`);function Sa(){let e=globalThis;return e[Xr]??=new Map,e[Xr]}function o(e,t){let n=Sa(),i=`${import.meta.url}\x00${e}`,a=n.get(i);if(a)return a;let l=t();return n.set(i,l),l.catch(()=>{if(n.get(i)===l)n.delete(i)}),l}var $a=/<\/(script)/gi;function fn(e){if(!e||e.indexOf("</")===-1)return e;return e.replace($a,"<\\/$1")}import Jr from"fs";var Gr=[];function w(e){let t=new R(e);return Gr.push(t),t}function Dc(){for(let e of Gr)e.clear()}function S(e,...t){return`${t.map((n)=>String(n??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function Sr(e){let t=[];for(let n of new Set(e))try{t.push({path:n,mtimeMs:Jr.statSync(n).mtimeMs})}catch{}return t}function Fs(e){for(let t of e)try{if(Jr.statSync(t.path).mtimeMs!==t.mtimeMs)return!1}catch{return!1}return!0}var Se=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useIntervalFn","useObjectUrl"];var va=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function Ea(e){if(e.startsWith(".")||e.startsWith("/"))return null;if(e.startsWith("@")){let n=e.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!n)return null;return{pkg:n[1],subpath:n[2]||""}}let t=e.match(/^([^/]+)(\/.*)?$/);if(!t)return null;return{pkg:t[1],subpath:t[2]||""}}function ka(e,t){let n=t;while(!0){let i=St.join(n,"node_modules",e,"package.json");if(en.existsSync(i))return St.dirname(i);let a=St.dirname(n);if(a===n)return null;n=a}}function Ca(e,t){if(!e||typeof e!=="object")return null;let n=(a)=>{if(typeof a==="string")return a;if(a&&typeof a==="object"){if(typeof a.import==="string")return a.import;if(typeof a.default==="string")return a.default;if(typeof a.import==="object")return n(a.import);if(typeof a.default==="object")return n(a.default)}return null};if(Object.prototype.hasOwnProperty.call(e,t))return n(e[t]);let i=null;for(let a of Object.keys(e)){let l=a.indexOf("*");if(l===-1)continue;let c=a.slice(0,l),b=a.slice(l+1);if(!t.startsWith(c)||!t.endsWith(b))continue;if(t.length<c.length+b.length)continue;if(!i||c.length>i.prefix.length)i={pattern:a,prefix:c,suffix:b}}if(i){let a=t.slice(i.prefix.length,t.length-i.suffix.length),l=n(e[i.pattern]);if(l)return l.replace("*",a)}return null}function Ra(e,t){let n=Ea(e);if(!n||!n.subpath)return null;let i=ka(n.pkg,t);if(!i)return null;let a;try{a=JSON.parse(en.readFileSync(St.join(i,"package.json"),"utf8"))}catch{return null}let l=`.${n.subpath}`,c=Ca(a.exports,l);if(!c)return null;let b=St.resolve(i,c);return en.existsSync(b)?b:null}function vi(e,t){let n=t.filePath?St.dirname(t.filePath):t.projectRoot||process.cwd(),i=t.projectRoot||process.cwd(),a=new Set,l=[],c=[];return{code:e.replace(va,(v,T)=>{let P;try{if(T.startsWith("./")||T.startsWith("../")||T.startsWith("/")){if(P=T.startsWith("/")?T:St.resolve(n,T),!en.existsSync(P))throw Error(`file not found: ${P}`)}else{let M=null;try{M=Bun.resolveSync(T,i)}catch{M=Ra(T,i)}if(!M)throw Error(`could not resolve ${T} (Bun.resolveSync + exports fallback both failed)`);P=M}}catch(M){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(T)} (from ${t.filePath||"<unknown>"}): ${M?.message||M}`),c.push(T),""}if(a.has(P))return"";a.add(P);try{let M=en.readFileSync(P,"utf8");l.push({source:T,resolvedPath:P,contents:M})}catch(M){console.warn(`[stx:vendor-css] could not read ${P}: ${M?.message||M}`),c.push(T)}return""}),styles:l,unresolved:c}}function Ta(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function xi(e){if(e.length===0)return"";return`${e.map((t)=>`<style data-stx-vendor="${Ta(t.source)}" data-stx-layer="vendor">
116
116
  @layer vendor {
117
117
  ${t.contents}
118
118
  }
@@ -182,7 +182,7 @@ else {
182
182
  // STX: auto-generated event bindings
183
183
  ${e.map((n,i)=>Ba(n,i)).join(`
184
184
  `)}`}function ti(e){let t=[],n=new Set,i=e.replace(/^\s*import\s+.*$/gm,""),a=0,l=i.length,c=0;while(c<l){let b=i[c];if(b==="'"||b==='"'||b==="`"){let v=b;if(c++,v==="`"){let T=0;while(c<l){if(i[c]==="\\"){c+=2;continue}if(i[c]==="`"&&T===0){c++;break}if(i[c]==="$"&&i[c+1]==="{"){T++,c+=2;continue}if(i[c]==="}"&&T>0){T--,c++;continue}c++}}else while(c<l){if(i[c]==="\\"){c+=2;continue}if(i[c]===v){c++;break}c++}continue}if(b==="/"&&i[c+1]==="/"){while(c<l&&i[c]!==`
185
- `)c++;continue}if(b==="/"&&i[c+1]==="*"){c+=2;while(c<l-1&&!(i[c]==="*"&&i[c+1]==="/"))c++;c+=2;continue}if(b==="{"){a++,c++;continue}if(b==="}"){a--,c++;continue}if(a===0){let v=i.slice(c),T=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(T){let H=T[1];if(!H.startsWith("_")&&!n.has(H))t.push(H),n.add(H);c+=T[0].length;continue}let P=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(P){P[1].split(",").forEach((H)=>{let O=H.trim(),L=O.indexOf(":"),B=L>=0?O.slice(L+1).trim().split(/[\s=]/)[0]:O.split(/[\s=]/)[0];if(B&&!B.startsWith("_")&&!n.has(B))t.push(B),n.add(B)}),c+=P[0].length;continue}let M=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(M){let H=M[1];if(!H.startsWith("_")&&!n.has(H))t.push(H),n.add(H);c+=M[0].length;continue}}c++}return t}var Fa=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"]);function Va(e){let t=new Set,n=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function i(H){let O;while((O=n.exec(H))!==null){let L=O[0];if(!Fa.has(L))t.add(L)}}let a=/\{\{([\s\S]*?)\}\}/g,l;while((l=a.exec(e))!==null)i(l[1]);let c=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((l=c.exec(e))!==null)i(l[1]);let b=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=b.exec(e))!==null)i(l[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=v.exec(e))!==null)i(l[1]);let T=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=T.exec(e))!==null)i(l[1]);let P=/@model\s*=\s*["']([^"']*)["']/gi;while((l=P.exec(e))!==null)i(l[1]);let M=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=M.exec(e))!==null)i(l[1]);return t}async function je(e,t={}){let n=e,i="",a=!1,l=[],c=vi(n,{filePath:t.filePath,projectRoot:t.projectRoot});n=c.code;let b=xi(c.styles),v=Mt(n);n=v.code,l=[...v.imports,...v.models];let{hasUserImports:T,bundleClientScript:P}=await o("stx/client-script-bundler",()=>import("./chunk-se79v0pe.js"));if(T(n))n=await P(n,t.filePath||"",{projectRoot:t.projectRoot,minify:t.production}),a=!0;if(t.autoImports!==!1){let j=Qc(n);n=j.code,i=el(j.stxImports,j.browserImports.filter((te)=>!l.includes(te)))}if(i=`${vn(n,t.serverData)}${i}`,n=I(n),!a&&Be(t.attrs||""))n=Fe(n);let M=Wa(t.eventBindings||[]),H=(t.attrs||"").trim(),O=/\btype\s*=\s*["']module["']/i.test(H),L=t.instanceId?` data-stx-instance="${t.instanceId}"`:"";if(O){let j=H.replace(/\btype\s*=\s*["']module["']/i,"").trim(),te=`type="module" data-stx-scoped${L}${j?` ${j}`:""}`;return`${b}<script ${te}>
185
+ `)c++;continue}if(b==="/"&&i[c+1]==="*"){c+=2;while(c<l-1&&!(i[c]==="*"&&i[c+1]==="/"))c++;c+=2;continue}if(b==="{"){a++,c++;continue}if(b==="}"){a--,c++;continue}if(a===0){let v=i.slice(c),T=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(T){let H=T[1];if(!H.startsWith("_")&&!n.has(H))t.push(H),n.add(H);c+=T[0].length;continue}let P=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(P){P[1].split(",").forEach((H)=>{let O=H.trim(),L=O.indexOf(":"),B=L>=0?O.slice(L+1).trim().split(/[\s=]/)[0]:O.split(/[\s=]/)[0];if(B&&!B.startsWith("_")&&!n.has(B))t.push(B),n.add(B)}),c+=P[0].length;continue}let M=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(M){let H=M[1];if(!H.startsWith("_")&&!n.has(H))t.push(H),n.add(H);c+=M[0].length;continue}}c++}return t}var Fa=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"]);function Va(e){let t=new Set,n=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function i(H){let O;while((O=n.exec(H))!==null){let L=O[0];if(!Fa.has(L))t.add(L)}}let a=/\{\{([\s\S]*?)\}\}/g,l;while((l=a.exec(e))!==null)i(l[1]);let c=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((l=c.exec(e))!==null)i(l[1]);let b=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=b.exec(e))!==null)i(l[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=v.exec(e))!==null)i(l[1]);let T=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=T.exec(e))!==null)i(l[1]);let P=/@model\s*=\s*["']([^"']*)["']/gi;while((l=P.exec(e))!==null)i(l[1]);let M=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=M.exec(e))!==null)i(l[1]);return t}async function je(e,t={}){let n=e,i="",a=!1,l=[],c=vi(n,{filePath:t.filePath,projectRoot:t.projectRoot});n=c.code;let b=xi(c.styles),v=Mt(n);n=v.code,l=[...v.imports,...v.models];let{hasUserImports:T,bundleClientScript:P}=await o("stx/client-script-bundler",()=>import("./chunk-9f0pv6sz.js"));if(T(n))n=await P(n,t.filePath||"",{projectRoot:t.projectRoot,minify:t.production}),a=!0;if(t.autoImports!==!1){let j=Qc(n);n=j.code,i=el(j.stxImports,j.browserImports.filter((te)=>!l.includes(te)))}if(i=`${vn(n,t.serverData)}${i}`,n=I(n),!a&&Be(t.attrs||""))n=Fe(n);let M=Wa(t.eventBindings||[]),H=(t.attrs||"").trim(),O=/\btype\s*=\s*["']module["']/i.test(H),L=t.instanceId?` data-stx-instance="${t.instanceId}"`:"";if(O){let j=H.replace(/\btype\s*=\s*["']module["']/i,"").trim(),te=`type="module" data-stx-scoped${L}${j?` ${j}`:""}`;return`${b}<script ${te}>
186
186
  ${fn(`${i}${n}
187
187
  ${M}`)}
188
188
  </script>`}let B=Di(e),F=/function __stx_setup_/.test(n),ee=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function G(j){let te=j.length>0?`
@@ -570,8 +570,8 @@ ${T.join(`
570
570
  `){let L=e[a];if(L==="\\"){a+=2;continue}if(L==="[")O=!0;else if(L==="]")O=!1;else if(L==="/"&&!O){a++;while(a<l&&/[a-z]/i.test(e[a]))a++;return}a++}},H=()=>{if(i!==0)return;let O=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(O){let ee=O[2].split(",").map((G)=>{let j=G.trim().split(":");return j[j.length-1].trim()});for(let G of ee)if(G&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(G)&&!n.has(G))t.push(G),n.add(G);return}let L=e.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(L){let ee=L[2];if(!n.has(ee))t.push(ee),n.add(ee);return}let B=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let ee=B[1];if(!n.has(ee))t.push(ee),n.add(ee);return}let F=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let ee=F[1];if(!n.has(ee))t.push(ee),n.add(ee)}};while(a<l){if(v())continue;if(e[a]==="'"||e[a]==='"'){c(e[a]);continue}if(e[a]==="`"){b();continue}if(e[a]==="/"&&P()){M();continue}if(e[a]==="{"){i++,a++;continue}if(e[a]==="}"){i--,a++;continue}if(i===0&&/[a-z]/i.test(e[a])&&(a===0||/\s|[;{}()]/.test(e[a-1])))H();a++}return t}function lu(e){let t=[],n=0,i=0,a=null;for(let l=0;l<e.length;l++){let c=e[l];if(a){if(c==="\\"){l++;continue}if(c===a)a=null;continue}if(c==='"'||c==="'"||c==="`"){a=c;continue}if(c==="("||c==="["||c==="{")n++;else if(c===")"||c==="]"||c==="}")n--;else if(c===","&&n===0)t.push(e.slice(i,l)),i=l+1}if(i<e.length)t.push(e.slice(i));return t}function uu(e){let t=0,n=null;for(let i=0;i<e.length;i++){let a=e[i];if(n){if(a==="\\"){i++;continue}if(a===n)n=null;continue}if(a==='"'||a==="'"||a==="`"){n=a;continue}if(a==="("||a==="["||a==="{")t++;else if(a===")"||a==="]"||a==="}")t--;else if(a==="="&&t===0){let l=e[i-1],c=e[i+1];if(l==="!"||l==="<"||l===">"||l==="=")continue;if(c==="="||c===">")continue;return i}}return-1}function fu(e,t){try{let n=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(e);if(!n)return;let i=n.index-1;while(i>=0&&/\s/.test(e[i]))i--;if(e[i]!=="}")return;let a=i,l=0,c=-1;for(;i>=0;i--){let v=e[i];if(v==="}")l++;else if(v==="{"){if(l--,l===0){c=i;break}}}if(c===-1)return;let b=e.slice(c+1,a);for(let v of lu(b)){let T=v.trim();if(!T||T.startsWith("..."))continue;let P=uu(T);if(P===-1)continue;let M=T.slice(0,P).trim();if(!/^[A-Z_$][\w$]*$/i.test(M))continue;if(t[M]!==void 0)continue;let H=T.slice(P+1).trim();if(!H)continue;try{let O=Object.keys(t).filter(Bt),L=Function(...O,`"use strict"; return (${H});`);t[M]=L(...O.map((B)=>t[B]))}catch{}}}catch{}}var pu=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function vg(e,t){let n=Pt(e),i=e.slice(n).match(/^<([a-zA-Z][a-zA-Z0-9-]*)/);if(!i)return null;let a=i[1].toLowerCase();if(!pu.has(a))return null;let l=new RegExp(`<\\/?${a}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),c=y(e,(P,M)=>(l.lastIndex=M,l.exec(P)?.index===M?l.lastIndex:-1));if(a==="span"&&/\sdata-stx-scope\s*=/.test(c[0]?.token||""))return null;let b=0,v=!1;for(let P of c){if(b+=P.token.startsWith("</")?-1:1,b<0)return null;if(b===0){if(e.slice(P.end).trim())return null;v=!0;break}}if(!v)return null;let T=n+i[0].length;return e.slice(0,T)+t+e.slice(T)}function qo(e,t){if(!e)return!1;return[...t.additionalComponentsDirs??[],...t.fallbackComponentsDir?[t.fallbackComponentsDir]:[]].some((i)=>{let a=ce.relative(ce.resolve(i),ce.resolve(e));return!a.startsWith("..")&&!ce.isAbsolute(a)})}async function Rr(e,t,n,i,a){let l=e.endsWith(".stx")?e.slice(0,-4):e,c=(ne)=>ne.split("-").map((ue)=>ue.charAt(0).toUpperCase()+ue.slice(1)).join(""),b=n.__importedComponents;if(b){for(let ne of[l,l.toLowerCase(),c(l),U(l)])if(b.has(ne))return!0}let v=[...new Set([`${l}.stx`,`${c(l)}.stx`,`${U(l)}.stx`])],T=typeof a.root==="string"?ce.resolve(a.root):void 0,P=T??ce.dirname(i),M=[],H=(ne)=>{if(ne&&!M.includes(ne))M.push(ne)};for(let ne of Ln(i,T))H(ne);let O=n.__originalFilePath;if(O)H(ce.join(ce.dirname(O),"components"));if(qo(t,a))H(a._rootComponentsDir);H(t),H(a._rootComponentsDir),H(ce.join(ce.dirname(i),"components")),H(a.componentsDir);for(let ne of a.additionalComponentsDirs??[])H(ne);let L=a._targetComponentFallbackNames?.some((ne)=>ne.toLowerCase()===l.toLowerCase());if(!L)for(let ne of a._targetComponentDirs??[])H(ne);if(T)H(ce.resolve(T,"resources/views/components")),H(ce.resolve(T,"resources/components")),H(ce.resolve(T,"src/components")),H(ce.resolve(T,"components"));for(let ne of a._layerComponentDirs??[])H(ne);let B=a._pluginComponentDirs;if(Array.isArray(B))for(let ne of B)H(typeof ne==="string"?ne:null);if(H(a.fallbackComponentsDir),L)for(let ne of a._targetComponentDirs??[])H(ne);let F=a._nativePrimitivesFallback;if(F&&!F.except.some((ne)=>ne.toLowerCase()===l.toLowerCase()))H(F.dir);if(l.startsWith("./")||l.startsWith("../"))return r(ce.resolve(ce.dirname(i),`${l}.stx`));let ee=Lo(ce.resolve(import.meta.dir,"components")),G=M.map((ne)=>ce.isAbsolute(ne)?ne:ce.resolve(P,ne)),j=`${v.join("\x00")}\x00\x00${G.join("\x00")}`,te=lr.get(j);if(te!==void 0)return te;let se=!1;e:for(let ne of G){if(Lo(ne)===ee)continue;for(let ue of v)if(await r(ce.join(ne,ue))){se=!0;break e}}return lr.set(j,se),se}function Lo(e){let t=ur.get(e);if(t!==void 0)return t;let n=e;try{n=rs.realpathSync(e)}catch{}return ur.set(e,n),n}function xg(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function tl(e){if(!e)return!1;let t=e.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(t)}function du(e,t,n){if(!e.includes("{{")&&!e.includes("{!!"))return e;let i=(a,l)=>{let c;try{c=A(a,t)}catch{return l}if(c===void 0||c===null)return"";let b=String(c);if(/<\/style/i.test(b))return console.warn(`[stx] a <style> expression in ${n??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return b};return e.replace(/\{!!([\s\S]*?)!!\}/g,(a,l)=>i(l,a)).replace(/\{\{([\s\S]*?)\}\}/g,(a,l)=>i(l,a))}var zo=new Set;function Bo(e,t,n,i){let a=`${e}\x00${t}\x00${i??""}`;if(!process.env.STX_DEBUG&&zo.has(a))return;zo.add(a);let l=t?` used in ${t}`:"",c=i?` Cause: ${i}.`:"",b=n.length>0?`
571
571
  searched:
572
572
  ${n.map((v)=>` - ${v}`).join(`
573
- `)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${c}${b}`)}function Wo(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var gu=new Set(["for","if","show","key","ref","class","className","style"]),Fo=new Set,Zo="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",nl=new RegExp(`\\b(?:${Zo})\\s*(?:<[^>]*>)?\\s*\\(`);function Si(e){let t=new Set,n=new RegExp(`\\b(?:const|let|var)\\s+([a-zA-Z_$][\\w$]*)\\s*=\\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue|${Zo})\\s*(?:<[^>]*>)?\\s*\\(`,"g");for(let i of e){let a;while((a=n.exec(i))!==null)t.add(a[1]);n.lastIndex=0}return[...t]}async function ze(e,t,n,i,a,l,c,b=new Set,v,T=st(a),P,M=e){let{extractVariables:H}=await o("stx/variable-extractor",()=>import("./chunk-kvttzk86.js")),O=b??new Set;if(O.has(e))return`[Circular component reference: ${e}]`;let L=new Set(O);L.add(e);let B=typeof t.client==="string"?t.client.trim():"";if("client"in t)delete t.client;let F=B&&B!=="load"&&xg(B)?B:"";try{let ee=(oe)=>oe.split("-").map((le)=>le.charAt(0).toUpperCase()+le.slice(1)).join(""),G=M.endsWith(".stx")?M.slice(0,-4):M,j=null,te=a.__importedComponents;if(te){let oe=[G,G.toLowerCase(),ee(G),U(G)];for(let le of oe)if(te.has(le)){j=te.get(le);break}}let se=[];if(!j){let oe=[`${G}.stx`,`${ee(G)}.stx`,`${U(G)}.stx`],le=[...new Set(oe)],we=a.__originalFilePath,be=[];for(let _e of Ln(l))if(!be.includes(_e))be.push(_e);let Xe=be.length;for(let _e of c._layerComponentDirs??[])if(!be.includes(_e))be.push(_e);if(we){let _e=ce.join(ce.dirname(we),"components");be.push(_e)}let Te=c._rootComponentsDir;if(typeof Te==="string"&&qo(i,c)&&!be.includes(Te))be.push(Te);if(i&&!be.includes(i))be.push(i);if(typeof Te==="string"&&!be.includes(Te))be.push(Te);let gt=ce.join(ce.dirname(l),"components");if(!be.includes(gt))be.push(gt);if(c.componentsDir&&c.componentsDir!==i&&!be.includes(c.componentsDir))be.push(c.componentsDir);for(let _e of c.additionalComponentsDirs??[])if(_e&&!be.includes(_e))be.push(_e);let Et=c._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(G),xt=(P?.events??[]).map((_e)=>_e.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),Rn=Object.hasOwn(t,"checked")||Boolean(P?.reactiveProps?.includes("checked")),fs=Object.hasOwn(t,"value")||Boolean(P?.reactiveProps?.includes("value")),ps=!xt.includes("valuechange")&&(Rn||xt.includes("change")&&!fs),_t=c._nativeHostAttrs&&/^textinput$/i.test(G),kt=xt.includes("update:value")&&!xt.includes("input"),Yt=c._nativeHostAttrs&&/^video$/i.test(G),ds=c._nativeHostAttrs&&/^image$/i.test(G),Tn=Bs([...Object.keys(t),...P?.reactiveProps??[]],P?.events,t),Ct=Object.hasOwn(t,"src")||Boolean(P?.reactiveProps?.includes("src")),An=Object.hasOwn(t,"source")||Boolean(P?.reactiveProps?.includes("source")),In=Yt&&(Ct||An)&&(P?.events??[]).every((_e)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(_e.replace(/^@/,"").split(".")[0])),Pn=new Set(["","primary","secondary","outline","ghost","danger"]),On=typeof t.variant==="string"?t.variant.trim().toLowerCase():"",Dn=c._nativeHostAttrs&&/^button$/i.test(G)&&!Pn.has(On),yr=c._targetComponentFallbackNames?.some((_e)=>_e.toLowerCase()===G.toLowerCase())??!1,gs=yr&&(!Et||ps)&&(!_t||kt)&&(!Yt||In)&&(!ds||Tn)&&!Dn;for(let _e of gs?[]:c._targetComponentDirs??[])if(_e&&!be.includes(_e))be.push(_e);let Rt=typeof c.root==="string"?ce.resolve(c.root):void 0,wr=Rt??ce.dirname(l),Tt=[];if(Rt)Tt.push(ce.resolve(Rt,"resources/views/components")),Tt.push(ce.resolve(Rt,"resources/components")),Tt.push(ce.resolve(Rt,"src/components")),Tt.push(ce.resolve(Rt,"components"));Tt.push(ce.resolve(import.meta.dir,"components"));for(let _e of Tt)if(!be.includes(_e))be.push(_e);if(yr){let _e=(c._componentPackageDirs??[]).filter((Qe)=>typeof Qe==="string"&&Qe.length>0),mt=(gs?_e.length?_e:c._pluginComponentDirs??[]:c._targetComponentDirs??[]).filter((Qe)=>typeof Qe==="string"&&Qe.length>0);if(mt.length){let Qe=be.slice(Xe).map((Ge)=>ce.isAbsolute(Ge)?Ge:ce.resolve(wr,Ge)).filter((Ge)=>!mt.includes(Ge)),jn=`${G}\x00${Qe.join("\x00")}`,ot=cr.get(jn);if(ot===void 0){ot=!1;for(let Ge of Qe){for(let wt of le)if(await r(ce.join(Ge,wt))){ot=!0;break}if(ot)break}cr.set(jn,ot)}if(!ot){for(let Ge of mt){let wt=be.indexOf(Ge);if(wt>=0)be.splice(wt,1)}be.splice(Xe,0,...mt)}}}let vr=c._pluginComponentDirs;if(Array.isArray(vr)){for(let _e of vr)if(typeof _e==="string"&&!be.includes(_e))be.push(_e)}if(c.fallbackComponentsDir&&!be.includes(c.fallbackComponentsDir))be.push(c.fallbackComponentsDir);if(gs){for(let _e of c._targetComponentDirs??[])if(_e&&!be.includes(_e))be.push(_e)}let Mn=c._nativePrimitivesFallback;if(Mn&&!Mn.except.some((_e)=>_e.toLowerCase()===G.toLowerCase())&&!be.includes(Mn.dir))be.push(Mn.dir);let Ar=[...new Set(be.map((_e)=>{if(!_e)return _e;return ce.isAbsolute(_e)?_e:ce.resolve(wr,_e)}))];be.length=0,be.push(...Ar);let ms=`${G}\x00${l}\x00${Ar.join("\x00")}`,hs=ns.get(ms);if(hs)if(await r(hs))j=hs;else ns.delete(ms);if(!j&&(G.startsWith("./")||G.startsWith("../")))j=ce.resolve(ce.dirname(l),`${G}.stx`),se.push(j);else if(!j)for(let _e of be){if(!_e)continue;for(let mt of le){let Qe=ce.join(_e,mt);if(se.push(Qe),await r(Qe)){j=Qe;break}}if(j)break;if(!j)try{let mt=await import("fs");if(!mt.statSync(_e,{throwIfNoEntry:!1})?.isDirectory())continue;let jn=8,ot=[{path:_e,depth:0}];while(ot.length>0&&!j){let Ge=ot.pop();if(Ge.depth>=jn)continue;let wt;try{wt=mt.readdirSync(Ge.path,{withFileTypes:!0})}catch{continue}for(let Nn of wt){if(!Nn.isDirectory())continue;if(Nn.name==="node_modules"||Nn.name.startsWith("."))continue;let Ir=ce.join(Ge.path,Nn.name);for(let aa of le){let xs=ce.join(Ir,aa);if(se.push(xs),await r(xs)){j=xs;break}}if(j)break;ot.push({path:Ir,depth:Ge.depth+1})}}}catch{}if(j)break}if(j)ns.set(ms,j)}if(!j||!await r(j))return Bo(e,l,se),Wo(e);v.add(j);let ne;if(cn.has(j)&&ar.get(j)===Mo(j))ne=cn.get(j);else try{let oe=Mo(j);ne=await Bun.file(j).text(),cn.set(j,ne),ar.set(j,oe)}catch(oe){let le=oe instanceof Error?oe.message:String(oe);return Bo(e,l,[j],le),Wo(e)}if(P)for(let oe of new Set([...Object.keys(t),...P.reactiveProps??[]])){let le=oe.toLowerCase();if(le.startsWith("aria-")||le.startsWith("data-"))continue;let we=oe.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${we}\\b`).test(ne))P.declaredProps.add(oe);if(new RegExp(`\\$props\\s*(?:\\.\\s*${we}\\b|\\[\\s*['"]${we}['"]\\s*\\])`).test(ne)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${we}['"]`).test(ne))P.consumedProps?.add(oe)}if(P?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(ne))for(let oe of P.reactiveProps){if(gu.has(oe)||P.consumedProps?.has(oe))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${oe.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(ne))continue;let le=`${j}\x00${oe}`;if(Fo.has(le))continue;Fo.add(le),console.warn(`[stx] ${ce.basename(j)} reads \`${oe}\` with defineProps(), which is not live, but ${ce.basename(l)} binds it (:${oe}): the value can arrive empty or stale (on a native screen, and for a :for's rows, it does not arrive at all). Read it with useReactiveProp('${oe}').`)}let ue=new Set(["__originalFilePath","__importedComponents",Un,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),ye={};for(let[oe,le]of Object.entries(a))if(!oe.startsWith("__")||ue.has(oe))ye[oe]=le;let de=T.length>0?{[Jn]:[...T]}:{},Ae=n;if(n.includes("@include")){let{processIncludes:oe}=await o("stx/includes",()=>import("./chunk-gzx1f8ay.js"));Ae=await oe(n,a,l,c,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ae)){let{processComponents:oe}=await o("stx/component-renderer",()=>import("./chunk-9m96yv69.js")),le={...a,__processedComponents:O,...de};Ae=await oe(Ae,le,l,c,v);let we=le.__stx_preserved_client_expressions;if(Array.isArray(we)&&we.length>0)a.__stx_preserved_client_expressions=[...new Set([...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...we])]}let Ze=[];if(tl(Ae)){let{processExpressions:oe}=await o("stx/expressions",()=>import("./chunk-6bemqsdj.js")),le=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...de}:T.length>0?{...a,...de}:a;Ae=oe(Ae,le,l);for(let we of Ae.matchAll(/\{\{([\s\S]*?)\}\}/g))Ze.push(we[1].trim())}let Re=J(Ae),Ke=[],Ye=Re.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(oe,le)=>{let we=Re.scripts[Number(le)]||"",be=we.match(/^<script\b([^>]*)>/i)?.[1]||"",Xe=be.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Te=!Xe||["module","text/javascript","application/javascript"].includes(Xe),gt=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${be}`);if(!/\bserver\b/i.test(be)&&Te&&!gt)return Ke.push(we),"";return we}),{extractSlotContent:Je}=await o("stx/slots",()=>import("./chunk-twfx2scr.js")),rt=Je(Ye),et={};if(rt.defaultSlot?.trim())et.default=rt.defaultSlot;for(let[oe,le]of rt.namedSlots)et[oe]=le.content;let yt=a.__stx_scope_seq??={n:0,key:Ks(String(a.__filename??l))},Ft=Ho(e,process.cwd()),lt=`stx_${(Ft.endsWith(".stx")?Ft.slice(0,-4):Ft).replace(/[^a-zA-Z0-9]/g,"_")}_${++yt.n}_${yt.key}`,We={...ye,$uid:lt,$native:c._nativeHostAttrs===!0,...t,props:t,slot:Ye,$slots:et,__processedComponents:L,__sections:{},__stx_signals_gate:ke(ne)||tl(n),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Ze]};if(/import\s/.test(ne)){We.__importedComponents=new Map(We.__importedComponents);let{processESImports:oe}=await o("stx/component-renderer",()=>import("./chunk-9m96yv69.js"));ne=await oe(ne,We,j,c,v)}fu(ne,We);let Vt=ne,un=pe(Vt);if(un)Vt=un.content.trim();let os=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Ut=[...ne.matchAll(os)];for(let[,oe,le]of Ut)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(oe))Ne(le,j,c.strict);let tt=[],Ht=null,as=Ut.some((oe)=>/\bserver\b/.test(oe[1]||"")&&/\bcache\b/.test(oe[1]||"")),vt=null,ut=null,qt=null,pn=0,Zt=null;if(ru(c),as&&fr>0){let oe=iu({props:t,slot:Ae,slotContext:n.trim()?ou(ye):void 0,buildMode:c.buildMode??"",skipEventDirectives:c.skipEventDirectives===!0,native:c._nativeHostAttrs===!0,clientLoopNames:[...T].sort(),layers:c._layerGraph?.layers.map((le)=>le.configFile),uid:lt});if(oe!==null){vt=`${j}\x00${S(ne)}\x00${oe}`;let le=ss.get(vt);if(le){for(let we of le.dependencies)v.add(we);if(li(a,le.clientFactories),yt.n+=le.uidsConsumed,le.preservedClientExpressions.length>0){let we=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let be of le.preservedClientExpressions)we.add(be);a.__stx_preserved_client_expressions=[...we]}return le.output}ut=new Set(v),qt=ai(a),pn=yt.n,Zt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let Kt=new Set;for(let oe of Ut){let le=oe[1]||"",we=oe[2]||"",be=le.includes("server");if(Be(le)&&we.trim())we=Fe(we);if(be&&we){for(let Te of Me(we))Kt.add(Te);try{await H(we,We,j,{onFailure:(Te)=>{if(Te.kind!=="unknown")Ht=Te.kind}})}catch(Te){}}if(!be){let Te=we.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),gt=Te.includes("{{")&&Te.includes("}}"),Et=Te.includes("{!!")&&Te.includes("!!}");if(gt||Et)Te=_i(Te,We,j);let xt=le.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");tt.push(`<script${xt}>${Te}</script>`)}}let nt=J(ne).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Xt=nt?nt[1]:"",cs=nt?nt[2]:"",ft="",re=Xt&&/\bscoped\b/i.test(Xt);if(nt)ft=`<style${Xt}>${du(cs,We,j)}</style>`;let ae=Vt;if(ae=ae.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),nt)ae=ae.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let oe=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,le=[];if(ae=ae.replace(oe,(we,be)=>{let Xe=be.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Xe)le.push(`<style${Xe[1]}>${Xe[2]}</style>`);return""}),ae=ae.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),le.length>0)ft=`${ft}${le.join(`
574
- `)}`}if(n&&ae.includes("{{ text || slot }}"))ae=ae.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>n);let{applySlots:he}=await o("stx/slots",()=>import("./chunk-twfx2scr.js")),{defaultSlot:$e,namedSlots:Pe}=rt,Ve=a.__stx_signals_gate===!0&&/\s(?:@[\w:.-]+|x-on:[\w:.-]+)\s*=/.test(Ye),it=tt.length>0&&Zs(ae)||c._nativeHostAttrs===!0&&tt.length>0||Ve&&tt.length>0||tt.some((oe)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(oe)),ls=(oe)=>it?ao(oe,lt):oe,us=new Map([...Pe].map(([oe,le])=>[oe,{...le,content:ls(le.content)}]));ae=await he(ae,it?oo(ls($e),lt):$e,us,We,it?lt:"");let dn=Si(tt),Jt=(Array.isArray(We.__stx_client_signal_names)?We.__stx_client_signal_names:[]).filter((oe)=>!Kt.has(oe));if(dn.length>0||Jt.length>0)We.__stx_client_signal_names=[...new Set([...Jt,...dn])];else delete We.__stx_client_signal_names;let Gt=T.filter((oe)=>!Kt.has(oe)&&!(oe in t));if(Gt.length>0)We[Jn]=Gt;let $n={...c,_rootComponentsDir:c._rootComponentsDir||c.componentsDir,componentsDir:ce.dirname(j),skipSignalsRuntime:!0,skipEventDirectives:c._nativeHostAttrs===!0||it||tt.length===0,defaultLayout:void 0};We.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:En}=await o("stx/process",()=>import("./chunk-jmqwpnpd.js")),pt=await En(ae,We,j,$n,v),ht=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let oe of pt.matchAll(/\{\{([\s\S]*?)\}\}/g))ht.add(oe[1].trim());if(ht.size>0)a.__stx_preserved_client_expressions=[...ht];let dt=lt,qe=pt;if(it){let oe="";if(Object.keys(t).length>0)try{oe=` data-stx-props="${ir(JSON.stringify(t))}"`}catch{}let le=F?` stx-hydrate="${ir(F)}"`:"",we=Object.fromEntries(Object.entries(et).map(([_t,kt])=>[_t,Boolean(kt)])),be=Object.keys(we).length>0?` data-stx-slots="${ir(JSON.stringify(we))}"`:"",Xe=` data-stx-scope="${dt}"${oe}${be}${le}`,Te=pt.slice(Pt(pt)),gt=/^<span(?=[\s/>])/i.test(Te),Et=/^<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(Te),xt=/^<[^>]+\bdata-stx-fill-root(?:\s|=|>)/i.test(Te),Rn=gt?"span":"div",fs=Et&&c._nativeHostAttrs?' style="display:flex;flex-direction:column;flex:1;min-height:0;min-width:0"':xt&&c._nativeHostAttrs?' style="width:100%;height:100%"':gt||Et?' style="display:contents"':"";qe=vg(pt,Xe)??`<${Rn}${Xe} data-stx-component-wrapper${fs}>${pt}</${Rn}>`;let ps=await Promise.all(tt.map(async(_t)=>{let kt=_t.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!kt)return _t;let[,Yt,ds]=kt,Tn=Do(_t,We,j);if(Tn!==null)return Tn;let Ct=await hu(ds,j,c.buildMode==="compile"),An=vn(Ct.clientCode,Le(We)),{vendorStyleTags:In}=Ct,Pn=An?`function(__scopeId) {
573
+ `)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${c}${b}`)}function Wo(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var gu=new Set(["for","if","show","key","ref","class","className","style"]),Fo=new Set,Zo="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",nl=new RegExp(`\\b(?:${Zo})\\s*(?:<[^>]*>)?\\s*\\(`);function Si(e){let t=new Set,n=new RegExp(`\\b(?:const|let|var)\\s+([a-zA-Z_$][\\w$]*)\\s*=\\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue|${Zo})\\s*(?:<[^>]*>)?\\s*\\(`,"g");for(let i of e){let a;while((a=n.exec(i))!==null)t.add(a[1]);n.lastIndex=0}return[...t]}async function ze(e,t,n,i,a,l,c,b=new Set,v,T=st(a),P,M=e){let{extractVariables:H}=await o("stx/variable-extractor",()=>import("./chunk-na1v2jcy.js")),O=b??new Set;if(O.has(e))return`[Circular component reference: ${e}]`;let L=new Set(O);L.add(e);let B=typeof t.client==="string"?t.client.trim():"";if("client"in t)delete t.client;let F=B&&B!=="load"&&xg(B)?B:"";try{let ee=(oe)=>oe.split("-").map((le)=>le.charAt(0).toUpperCase()+le.slice(1)).join(""),G=M.endsWith(".stx")?M.slice(0,-4):M,j=null,te=a.__importedComponents;if(te){let oe=[G,G.toLowerCase(),ee(G),U(G)];for(let le of oe)if(te.has(le)){j=te.get(le);break}}let se=[];if(!j){let oe=[`${G}.stx`,`${ee(G)}.stx`,`${U(G)}.stx`],le=[...new Set(oe)],we=a.__originalFilePath,be=[];for(let _e of Ln(l))if(!be.includes(_e))be.push(_e);let Xe=be.length;for(let _e of c._layerComponentDirs??[])if(!be.includes(_e))be.push(_e);if(we){let _e=ce.join(ce.dirname(we),"components");be.push(_e)}let Te=c._rootComponentsDir;if(typeof Te==="string"&&qo(i,c)&&!be.includes(Te))be.push(Te);if(i&&!be.includes(i))be.push(i);if(typeof Te==="string"&&!be.includes(Te))be.push(Te);let gt=ce.join(ce.dirname(l),"components");if(!be.includes(gt))be.push(gt);if(c.componentsDir&&c.componentsDir!==i&&!be.includes(c.componentsDir))be.push(c.componentsDir);for(let _e of c.additionalComponentsDirs??[])if(_e&&!be.includes(_e))be.push(_e);let Et=c._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(G),xt=(P?.events??[]).map((_e)=>_e.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),Rn=Object.hasOwn(t,"checked")||Boolean(P?.reactiveProps?.includes("checked")),fs=Object.hasOwn(t,"value")||Boolean(P?.reactiveProps?.includes("value")),ps=!xt.includes("valuechange")&&(Rn||xt.includes("change")&&!fs),_t=c._nativeHostAttrs&&/^textinput$/i.test(G),kt=xt.includes("update:value")&&!xt.includes("input"),Yt=c._nativeHostAttrs&&/^video$/i.test(G),ds=c._nativeHostAttrs&&/^image$/i.test(G),Tn=Bs([...Object.keys(t),...P?.reactiveProps??[]],P?.events,t),Ct=Object.hasOwn(t,"src")||Boolean(P?.reactiveProps?.includes("src")),An=Object.hasOwn(t,"source")||Boolean(P?.reactiveProps?.includes("source")),In=Yt&&(Ct||An)&&(P?.events??[]).every((_e)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(_e.replace(/^@/,"").split(".")[0])),Pn=new Set(["","primary","secondary","outline","ghost","danger"]),On=typeof t.variant==="string"?t.variant.trim().toLowerCase():"",Dn=c._nativeHostAttrs&&/^button$/i.test(G)&&!Pn.has(On),yr=c._targetComponentFallbackNames?.some((_e)=>_e.toLowerCase()===G.toLowerCase())??!1,gs=yr&&(!Et||ps)&&(!_t||kt)&&(!Yt||In)&&(!ds||Tn)&&!Dn;for(let _e of gs?[]:c._targetComponentDirs??[])if(_e&&!be.includes(_e))be.push(_e);let Rt=typeof c.root==="string"?ce.resolve(c.root):void 0,wr=Rt??ce.dirname(l),Tt=[];if(Rt)Tt.push(ce.resolve(Rt,"resources/views/components")),Tt.push(ce.resolve(Rt,"resources/components")),Tt.push(ce.resolve(Rt,"src/components")),Tt.push(ce.resolve(Rt,"components"));Tt.push(ce.resolve(import.meta.dir,"components"));for(let _e of Tt)if(!be.includes(_e))be.push(_e);if(yr){let _e=(c._componentPackageDirs??[]).filter((Qe)=>typeof Qe==="string"&&Qe.length>0),mt=(gs?_e.length?_e:c._pluginComponentDirs??[]:c._targetComponentDirs??[]).filter((Qe)=>typeof Qe==="string"&&Qe.length>0);if(mt.length){let Qe=be.slice(Xe).map((Ge)=>ce.isAbsolute(Ge)?Ge:ce.resolve(wr,Ge)).filter((Ge)=>!mt.includes(Ge)),jn=`${G}\x00${Qe.join("\x00")}`,ot=cr.get(jn);if(ot===void 0){ot=!1;for(let Ge of Qe){for(let wt of le)if(await r(ce.join(Ge,wt))){ot=!0;break}if(ot)break}cr.set(jn,ot)}if(!ot){for(let Ge of mt){let wt=be.indexOf(Ge);if(wt>=0)be.splice(wt,1)}be.splice(Xe,0,...mt)}}}let vr=c._pluginComponentDirs;if(Array.isArray(vr)){for(let _e of vr)if(typeof _e==="string"&&!be.includes(_e))be.push(_e)}if(c.fallbackComponentsDir&&!be.includes(c.fallbackComponentsDir))be.push(c.fallbackComponentsDir);if(gs){for(let _e of c._targetComponentDirs??[])if(_e&&!be.includes(_e))be.push(_e)}let Mn=c._nativePrimitivesFallback;if(Mn&&!Mn.except.some((_e)=>_e.toLowerCase()===G.toLowerCase())&&!be.includes(Mn.dir))be.push(Mn.dir);let Ar=[...new Set(be.map((_e)=>{if(!_e)return _e;return ce.isAbsolute(_e)?_e:ce.resolve(wr,_e)}))];be.length=0,be.push(...Ar);let ms=`${G}\x00${l}\x00${Ar.join("\x00")}`,hs=ns.get(ms);if(hs)if(await r(hs))j=hs;else ns.delete(ms);if(!j&&(G.startsWith("./")||G.startsWith("../")))j=ce.resolve(ce.dirname(l),`${G}.stx`),se.push(j);else if(!j)for(let _e of be){if(!_e)continue;for(let mt of le){let Qe=ce.join(_e,mt);if(se.push(Qe),await r(Qe)){j=Qe;break}}if(j)break;if(!j)try{let mt=await import("fs");if(!mt.statSync(_e,{throwIfNoEntry:!1})?.isDirectory())continue;let jn=8,ot=[{path:_e,depth:0}];while(ot.length>0&&!j){let Ge=ot.pop();if(Ge.depth>=jn)continue;let wt;try{wt=mt.readdirSync(Ge.path,{withFileTypes:!0})}catch{continue}for(let Nn of wt){if(!Nn.isDirectory())continue;if(Nn.name==="node_modules"||Nn.name.startsWith("."))continue;let Ir=ce.join(Ge.path,Nn.name);for(let aa of le){let xs=ce.join(Ir,aa);if(se.push(xs),await r(xs)){j=xs;break}}if(j)break;ot.push({path:Ir,depth:Ge.depth+1})}}}catch{}if(j)break}if(j)ns.set(ms,j)}if(!j||!await r(j))return Bo(e,l,se),Wo(e);v.add(j);let ne;if(cn.has(j)&&ar.get(j)===Mo(j))ne=cn.get(j);else try{let oe=Mo(j);ne=await Bun.file(j).text(),cn.set(j,ne),ar.set(j,oe)}catch(oe){let le=oe instanceof Error?oe.message:String(oe);return Bo(e,l,[j],le),Wo(e)}if(P)for(let oe of new Set([...Object.keys(t),...P.reactiveProps??[]])){let le=oe.toLowerCase();if(le.startsWith("aria-")||le.startsWith("data-"))continue;let we=oe.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${we}\\b`).test(ne))P.declaredProps.add(oe);if(new RegExp(`\\$props\\s*(?:\\.\\s*${we}\\b|\\[\\s*['"]${we}['"]\\s*\\])`).test(ne)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${we}['"]`).test(ne))P.consumedProps?.add(oe)}if(P?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(ne))for(let oe of P.reactiveProps){if(gu.has(oe)||P.consumedProps?.has(oe))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${oe.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(ne))continue;let le=`${j}\x00${oe}`;if(Fo.has(le))continue;Fo.add(le),console.warn(`[stx] ${ce.basename(j)} reads \`${oe}\` with defineProps(), which is not live, but ${ce.basename(l)} binds it (:${oe}): the value can arrive empty or stale (on a native screen, and for a :for's rows, it does not arrive at all). Read it with useReactiveProp('${oe}').`)}let ue=new Set(["__originalFilePath","__importedComponents",Un,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),ye={};for(let[oe,le]of Object.entries(a))if(!oe.startsWith("__")||ue.has(oe))ye[oe]=le;let de=T.length>0?{[Jn]:[...T]}:{},Ae=n;if(n.includes("@include")){let{processIncludes:oe}=await o("stx/includes",()=>import("./chunk-te1wksa0.js"));Ae=await oe(n,a,l,c,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ae)){let{processComponents:oe}=await o("stx/component-renderer",()=>import("./chunk-qczgdzjk.js")),le={...a,__processedComponents:O,...de};Ae=await oe(Ae,le,l,c,v);let we=le.__stx_preserved_client_expressions;if(Array.isArray(we)&&we.length>0)a.__stx_preserved_client_expressions=[...new Set([...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...we])]}let Ze=[];if(tl(Ae)){let{processExpressions:oe}=await o("stx/expressions",()=>import("./chunk-bkqqa8aw.js")),le=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...de}:T.length>0?{...a,...de}:a;Ae=oe(Ae,le,l);for(let we of Ae.matchAll(/\{\{([\s\S]*?)\}\}/g))Ze.push(we[1].trim())}let Re=J(Ae),Ke=[],Ye=Re.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(oe,le)=>{let we=Re.scripts[Number(le)]||"",be=we.match(/^<script\b([^>]*)>/i)?.[1]||"",Xe=be.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Te=!Xe||["module","text/javascript","application/javascript"].includes(Xe),gt=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${be}`);if(!/\bserver\b/i.test(be)&&Te&&!gt)return Ke.push(we),"";return we}),{extractSlotContent:Je}=await o("stx/slots",()=>import("./chunk-4q4mtrc5.js")),rt=Je(Ye),et={};if(rt.defaultSlot?.trim())et.default=rt.defaultSlot;for(let[oe,le]of rt.namedSlots)et[oe]=le.content;let yt=a.__stx_scope_seq??={n:0,key:Ks(String(a.__filename??l))},Ft=Ho(e,process.cwd()),lt=`stx_${(Ft.endsWith(".stx")?Ft.slice(0,-4):Ft).replace(/[^a-zA-Z0-9]/g,"_")}_${++yt.n}_${yt.key}`,We={...ye,$uid:lt,$native:c._nativeHostAttrs===!0,...t,props:t,slot:Ye,$slots:et,__processedComponents:L,__sections:{},__stx_signals_gate:ke(ne)||tl(n),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Ze]};if(/import\s/.test(ne)){We.__importedComponents=new Map(We.__importedComponents);let{processESImports:oe}=await o("stx/component-renderer",()=>import("./chunk-qczgdzjk.js"));ne=await oe(ne,We,j,c,v)}fu(ne,We);let Vt=ne,un=pe(Vt);if(un)Vt=un.content.trim();let os=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Ut=[...ne.matchAll(os)];for(let[,oe,le]of Ut)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(oe))Ne(le,j,c.strict);let tt=[],Ht=null,as=Ut.some((oe)=>/\bserver\b/.test(oe[1]||"")&&/\bcache\b/.test(oe[1]||"")),vt=null,ut=null,qt=null,pn=0,Zt=null;if(ru(c),as&&fr>0){let oe=iu({props:t,slot:Ae,slotContext:n.trim()?ou(ye):void 0,buildMode:c.buildMode??"",skipEventDirectives:c.skipEventDirectives===!0,native:c._nativeHostAttrs===!0,clientLoopNames:[...T].sort(),layers:c._layerGraph?.layers.map((le)=>le.configFile),uid:lt});if(oe!==null){vt=`${j}\x00${S(ne)}\x00${oe}`;let le=ss.get(vt);if(le){for(let we of le.dependencies)v.add(we);if(li(a,le.clientFactories),yt.n+=le.uidsConsumed,le.preservedClientExpressions.length>0){let we=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let be of le.preservedClientExpressions)we.add(be);a.__stx_preserved_client_expressions=[...we]}return le.output}ut=new Set(v),qt=ai(a),pn=yt.n,Zt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let Kt=new Set;for(let oe of Ut){let le=oe[1]||"",we=oe[2]||"",be=le.includes("server");if(Be(le)&&we.trim())we=Fe(we);if(be&&we){for(let Te of Me(we))Kt.add(Te);try{await H(we,We,j,{onFailure:(Te)=>{if(Te.kind!=="unknown")Ht=Te.kind}})}catch(Te){}}if(!be){let Te=we.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),gt=Te.includes("{{")&&Te.includes("}}"),Et=Te.includes("{!!")&&Te.includes("!!}");if(gt||Et)Te=_i(Te,We,j);let xt=le.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");tt.push(`<script${xt}>${Te}</script>`)}}let nt=J(ne).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Xt=nt?nt[1]:"",cs=nt?nt[2]:"",ft="",re=Xt&&/\bscoped\b/i.test(Xt);if(nt)ft=`<style${Xt}>${du(cs,We,j)}</style>`;let ae=Vt;if(ae=ae.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),nt)ae=ae.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let oe=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,le=[];if(ae=ae.replace(oe,(we,be)=>{let Xe=be.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Xe)le.push(`<style${Xe[1]}>${Xe[2]}</style>`);return""}),ae=ae.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),le.length>0)ft=`${ft}${le.join(`
574
+ `)}`}if(n&&ae.includes("{{ text || slot }}"))ae=ae.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>n);let{applySlots:he}=await o("stx/slots",()=>import("./chunk-4q4mtrc5.js")),{defaultSlot:$e,namedSlots:Pe}=rt,Ve=a.__stx_signals_gate===!0&&/\s(?:@[\w:.-]+|x-on:[\w:.-]+)\s*=/.test(Ye),it=tt.length>0&&Zs(ae)||c._nativeHostAttrs===!0&&tt.length>0||Ve&&tt.length>0||tt.some((oe)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(oe)),ls=(oe)=>it?ao(oe,lt):oe,us=new Map([...Pe].map(([oe,le])=>[oe,{...le,content:ls(le.content)}]));ae=await he(ae,it?oo(ls($e),lt):$e,us,We,it?lt:"");let dn=Si(tt),Jt=(Array.isArray(We.__stx_client_signal_names)?We.__stx_client_signal_names:[]).filter((oe)=>!Kt.has(oe));if(dn.length>0||Jt.length>0)We.__stx_client_signal_names=[...new Set([...Jt,...dn])];else delete We.__stx_client_signal_names;let Gt=T.filter((oe)=>!Kt.has(oe)&&!(oe in t));if(Gt.length>0)We[Jn]=Gt;let $n={...c,_rootComponentsDir:c._rootComponentsDir||c.componentsDir,componentsDir:ce.dirname(j),skipSignalsRuntime:!0,skipEventDirectives:c._nativeHostAttrs===!0||it||tt.length===0,defaultLayout:void 0};We.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:En}=await o("stx/process",()=>import("./chunk-zecffe6a.js")),pt=await En(ae,We,j,$n,v),ht=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let oe of pt.matchAll(/\{\{([\s\S]*?)\}\}/g))ht.add(oe[1].trim());if(ht.size>0)a.__stx_preserved_client_expressions=[...ht];let dt=lt,qe=pt;if(it){let oe="";if(Object.keys(t).length>0)try{oe=` data-stx-props="${ir(JSON.stringify(t))}"`}catch{}let le=F?` stx-hydrate="${ir(F)}"`:"",we=Object.fromEntries(Object.entries(et).map(([_t,kt])=>[_t,Boolean(kt)])),be=Object.keys(we).length>0?` data-stx-slots="${ir(JSON.stringify(we))}"`:"",Xe=` data-stx-scope="${dt}"${oe}${be}${le}`,Te=pt.slice(Pt(pt)),gt=/^<span(?=[\s/>])/i.test(Te),Et=/^<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(Te),xt=/^<[^>]+\bdata-stx-fill-root(?:\s|=|>)/i.test(Te),Rn=gt?"span":"div",fs=Et&&c._nativeHostAttrs?' style="display:flex;flex-direction:column;flex:1;min-height:0;min-width:0"':xt&&c._nativeHostAttrs?' style="width:100%;height:100%"':gt||Et?' style="display:contents"':"";qe=vg(pt,Xe)??`<${Rn}${Xe} data-stx-component-wrapper${fs}>${pt}</${Rn}>`;let ps=await Promise.all(tt.map(async(_t)=>{let kt=_t.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!kt)return _t;let[,Yt,ds]=kt,Tn=Do(_t,We,j);if(Tn!==null)return Tn;let Ct=await hu(ds,j,c.buildMode==="compile"),An=vn(Ct.clientCode,Le(We)),{vendorStyleTags:In}=Ct,Pn=An?`function(__scopeId) {
575
575
  ${An}
576
576
  return (${Ct.factoryBody})(__scopeId);
577
577
  }`:Ct.factoryBody,On=F?null:Rs(a,Pn),Dn=On?`window.__stxComponentFactories[${JSON.stringify(On)}](${JSON.stringify(dt)});`:`(${Pn})(${JSON.stringify(dt)});`;if(F)return`${In}<script type="stx/island" data-stx-island="${dt}" data-stx-scoped data-stx-owner="${dt}"${Yt}>${Dn}</script>`;return`${In}<script data-stx-scoped data-stx-run="always" data-stx-owner="${dt}"${Yt}>${Dn}</script>`}));if(qe=qe+`
@@ -597,7 +597,7 @@ ${Ee.yellow}${Ee.bold}Message:${Ee.reset} ${t}
597
597
  `,b)P+=`
598
598
  ${Ee.blue}${Ee.bold}Context:${Ee.reset}
599
599
  ${Ee.dim}${b}${Ee.reset}
600
- `;return P}function ge(){cn.clear(),ar.clear(),ns.clear(),cr.clear(),lr.clear(),ur.clear(),ss.clear()}function ry(){return{size:cn.size,maxSize:500}}var or=w(128);async function hu(e,t,n){let i=S(e,t,n),a=or.get(i);if(a){if(Fs(a.deps))return a;or.delete(i)}let l=vi(e,{filePath:t,projectRoot:process.cwd()}),c=l.code,b=xi(l.styles);c=Mt(c).code;let{hasUserImports:v,bundleClientScript:T}=await o("stx/client-script-bundler",()=>import("./chunk-se79v0pe.js")),P=[],M=!1;if(v(c)){let G=c;c=await T(G,t,{projectRoot:process.cwd(),minify:n,collectInputs:P}),M=c===G}let{stripStxRuntimeImports:H}=await o("stx/signal-processing",()=>import("./chunk-j1sm889p.js"));c=H(c);let O=I(c),L=cu(O),B=new Set(V(O,!0).split(",").map((G)=>G.trim())),F=`function(__scopeId) {
600
+ `;return P}function ge(){cn.clear(),ar.clear(),ns.clear(),cr.clear(),lr.clear(),ur.clear(),ss.clear()}function ry(){return{size:cn.size,maxSize:500}}var or=w(128);async function hu(e,t,n){let i=S(e,t,n),a=or.get(i);if(a){if(Fs(a.deps))return a;or.delete(i)}let l=vi(e,{filePath:t,projectRoot:process.cwd()}),c=l.code,b=xi(l.styles);c=Mt(c).code;let{hasUserImports:v,bundleClientScript:T}=await o("stx/client-script-bundler",()=>import("./chunk-9f0pv6sz.js")),P=[],M=!1;if(v(c)){let G=c;c=await T(G,t,{projectRoot:process.cwd(),minify:n,collectInputs:P}),M=c===G}let{stripStxRuntimeImports:H}=await o("stx/signal-processing",()=>import("./chunk-2sxmmjt1.js"));c=H(c);let O=I(c),L=cu(O),B=new Set(V(O,!0).split(",").map((G)=>G.trim())),F=`function(__scopeId) {
601
601
  ${ct("const",[...hl,...L],O)}
602
602
  const __scope = window.stx._scopes = window.stx._scopes || {};
603
603
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{m,h,p}from"./chunk-ybgzr6wn.js";import{F}from"./chunk-5njk2ba0.js";import{i}from"./chunk-sz2nax5v.js";import k from"path";var q={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},T=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var M=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function H(e){let t=[],o=0,n;M.lastIndex=0;while((n=M.exec(e))!==null){if(n.index>o){let a=e.slice(o,n.index);if(a.trim())t.push({type:t.length===0?"shell":"content",content:a})}let s=n[1],r=n[2];t.push({type:"suspense",name:s,content:r}),o=n.index+n[0].length}if(o<e.length){let s=e.slice(o);if(s.trim())t.push({type:t.length===0?"shell":"content",content:s})}if(t.length===0)t.push({type:"shell",content:e});return t}async function zm(e,t={},o={}){let n={...F,...o,streaming:{...q,...o.streaming}},s=n.streaming?.bufferSize||16384;return new ReadableStream({async start(r){try{let a=await Bun.file(e).text(),S=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),g=S?S[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),y={...t,__filename:e,__dirname:k.dirname(e)};if(g.trim())await m(g,y,e);let E=H(c),l=new Set;if(!E.some((w)=>w.type==="suspense")){let w=n.streaming?.strategy||"auto",x=new RegExp(T.source,"g");if(!(w!=="manual"&&x.test(c))){let u=await i(c,y,e,n,l);for(let b=0;b<u.length;b+=s)r.enqueue(u.slice(b,b+s)),await new Promise((f)=>setTimeout(f,0))}else{let u=[],b=new RegExp(T.source,"g"),f;while((f=b.exec(c))!==null)u.push({name:f[1],content:f[2],start:f.index,end:f.index+f[0].length});let v=0;for(let _ of u){if(_.start>v){let I=c.slice(v,_.start);if(I.trim()){let O=await i(I,y,e,n,l);r.enqueue(O),await new Promise((D)=>setTimeout(D,0))}}let C=await i(_.content,y,e,n,l);r.enqueue(C),await new Promise((I)=>setTimeout(I,0)),v=_.end}if(v<c.length){let _=c.slice(v);if(_.trim()){let C=await i(_,y,e,n,l);r.enqueue(C)}}}}else{let w=new Map;for(let d of E)if(d.type==="shell"||d.type==="content"){let u=await i(d.content,y,e,n,l);r.enqueue(u)}else if(d.type==="suspense"&&d.name){let u=`stx-suspense-${d.name}`;r.enqueue(`<div id="${u}" data-suspense="${d.name}" style="display:contents;">
2
+ import{m,h,p}from"./chunk-ynnd6nnt.js";import{F}from"./chunk-rtsshvpt.js";import{i}from"./chunk-c7qej674.js";import k from"path";var q={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},T=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var M=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function H(e){let t=[],o=0,n;M.lastIndex=0;while((n=M.exec(e))!==null){if(n.index>o){let a=e.slice(o,n.index);if(a.trim())t.push({type:t.length===0?"shell":"content",content:a})}let s=n[1],r=n[2];t.push({type:"suspense",name:s,content:r}),o=n.index+n[0].length}if(o<e.length){let s=e.slice(o);if(s.trim())t.push({type:t.length===0?"shell":"content",content:s})}if(t.length===0)t.push({type:"shell",content:e});return t}async function zm(e,t={},o={}){let n={...F,...o,streaming:{...q,...o.streaming}},s=n.streaming?.bufferSize||16384;return new ReadableStream({async start(r){try{let a=await Bun.file(e).text(),S=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),g=S?S[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),y={...t,__filename:e,__dirname:k.dirname(e)};if(g.trim())await m(g,y,e);let E=H(c),l=new Set;if(!E.some((w)=>w.type==="suspense")){let w=n.streaming?.strategy||"auto",x=new RegExp(T.source,"g");if(!(w!=="manual"&&x.test(c))){let u=await i(c,y,e,n,l);for(let b=0;b<u.length;b+=s)r.enqueue(u.slice(b,b+s)),await new Promise((f)=>setTimeout(f,0))}else{let u=[],b=new RegExp(T.source,"g"),f;while((f=b.exec(c))!==null)u.push({name:f[1],content:f[2],start:f.index,end:f.index+f[0].length});let v=0;for(let _ of u){if(_.start>v){let I=c.slice(v,_.start);if(I.trim()){let O=await i(I,y,e,n,l);r.enqueue(O),await new Promise((D)=>setTimeout(D,0))}}let C=await i(_.content,y,e,n,l);r.enqueue(C),await new Promise((I)=>setTimeout(I,0)),v=_.end}if(v<c.length){let _=c.slice(v);if(_.trim()){let C=await i(_,y,e,n,l);r.enqueue(C)}}}}else{let w=new Map;for(let d of E)if(d.type==="shell"||d.type==="content"){let u=await i(d.content,y,e,n,l);r.enqueue(u)}else if(d.type==="suspense"&&d.name){let u=`stx-suspense-${d.name}`;r.enqueue(`<div id="${u}" data-suspense="${d.name}" style="display:contents;">
3
3
  <template data-suspense-fallback>Loading...</template>
4
4
  </div>`),w.set(d.name,i(d.content,y,e,n,l))}r.enqueue(`
5
5
  <script>
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{or,i}from"./chunk-c7qej674.js";import"./chunk-8vkywnpx.js";import"./chunk-f2zgh4xr.js";import"./chunk-t5q31st4.js";import"./chunk-shnw9geh.js";import"./chunk-xa2qfe51.js";import"./chunk-88a7qaw8.js";import"./chunk-cww1zk8y.js";import"./chunk-63sqdcr6.js";import{ve}from"./chunk-0zgxxhvs.js";import"./chunk-he9dzchk.js";import"./chunk-0ey7kc6t.js";import"./chunk-rtsshvpt.js";import"./chunk-xr9rf0e6.js";import"./chunk-jtccqpwa.js";import"./chunk-nws4zm4k.js";import"./chunk-09412heg.js";import"./chunk-t4dkcf28.js";import{Ne,Ws,qs}from"./chunk-ynnd6nnt.js";import"./chunk-gpkxphqz.js";import"./chunk-46t924aw.js";import"./chunk-eg2p1cyw.js";import"./chunk-xppm4cs4.js";import"./chunk-0wms5teg.js";export{or as buildModulesTag,ve as injectRouterScript,i as processDirectives,Ws as processJsonDirective,qs as processOnceDirective,Ne as validateClientScript};
package/dist/cli.js CHANGED
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- import{ae}from"./chunk-eg2p1cyw.js";import"./chunk-0wms5teg.js";import"./chunk-xppm4cs4.js";import{Ie}from"./chunk-ybgzr6wn.js";import"./chunk-46t924aw.js";import"./chunk-5ghw26vq.js";import"./chunk-jtccqpwa.js";import"./chunk-t4dkcf28.js";import"./chunk-5njk2ba0.js";import"./chunk-09412heg.js";import"./chunk-nws4zm4k.js";import"./chunk-sz2nax5v.js";import"./chunk-s4wcksaw.js";import"./chunk-fxk08je0.js";import"./chunk-txs1vxas.js";import"./chunk-v5tzcd49.js";import"./chunk-110s34yg.js";import"./chunk-r96ahk8s.js";import"./chunk-fez9828r.js";import"./chunk-jh36gqcq.js";import"./chunk-81ysx0tc.js";import"./chunk-2ts9pb6s.js";import"./chunk-6xcmeev9.js";import"./chunk-rsa9ssz7.js";import"./chunk-fa3ygt8c.js";import"./chunk-s6td2c1k.js";import"./chunk-ga650crj.js";import"./chunk-y1cneng3.js";import"./chunk-tb5h85ag.js";import"./chunk-trgbdydw.js";import"./chunk-907zya76.js";import"./chunk-ysqzz2h3.js";import"./chunk-t5q31st4.js";import"./chunk-5m0nyt8d.js";import"./chunk-4fc8zs15.js";import"./chunk-cz2s176s.js";import"./chunk-fhyvdxhw.js";import"./chunk-8586a2hh.js";import"./chunk-vm68yvgf.js";import"./chunk-25m74mh1.js";import"./chunk-zfb2wnha.js";import"./chunk-93c08def.js";import"./chunk-hpwtjb4a.js";import{nn,rn}from"./chunk-hpaj7zjv.js";import"./chunk-3c2hgvag.js";import"./chunk-mbcqpcyt.js";import"./chunk-9qxx2teq.js";import"./chunk-3qyz80d6.js";import"./chunk-jaf44web.js";import"./chunk-qpz9jrvw.js";import"./chunk-2j3gttzf.js";import"./chunk-cv0rmntr.js";import"./chunk-h9778nxm.js";import{Qi,ea,ta,na,uo,ra,sa,oa,po,fo,Ur,Wr,qr}from"./chunk-prnebmz1.js";import"./chunk-acwdf0cf.js";import"./chunk-tm5t3hh3.js";import"./chunk-fr658fhd.js";import"./chunk-mfbqjkgp.js";import"./chunk-cww1zk8y.js";import"./chunk-5x8q6e1q.js";import"./chunk-he9dzchk.js";import{kc}from"./chunk-ks0dwtp0.js";import{g}from"./chunk-0dve54ne.js";import{spawn as R}from"child_process";import S from"fs";import f from"path";import n from"process";import{CLI as z}from"@stacksjs/clapp";var __dirname="/home/runner/work/stx/stx/packages/stx/bin",y=new z("stx");function E(h){let m=typeof h==="string"?Number.parseInt(h,10):h;if(Number.isNaN(m))return{isValid:!1,error:"Port must be a valid number",suggestion:"Try using a number between 1024 and 65535"};if(m<1024||m>65535)return{isValid:!1,error:"Port must be between 1024 and 65535",suggestion:"Try using a port between 1024 and 65535"};return{isValid:!0}}function A(h){try{if(!S.existsSync(h)){let x=f.dirname(h),t=f.basename(h);if(S.existsSync(x)){let o=S.readdirSync(x).filter((s)=>s.toLowerCase().includes(t.toLowerCase().substring(0,3))||s.endsWith(".stx")||s.endsWith(".md")),r=o.length>0?`File not found. Similar files in ${x}: ${o.slice(0,3).join(", ")}`:`File not found. Directory ${x} exists but doesn't contain the specified file.`;return{isValid:!1,error:`File does not exist: ${h}`,suggestion:r}}return{isValid:!1,error:`File does not exist: ${h}`,suggestion:"Check the file path and try again"}}if(S.statSync(h).isDirectory())return{isValid:!1,error:`Expected file but got directory: ${h}`,suggestion:"Specify a .stx or .md file path"};return{isValid:!0}}catch(m){return{isValid:!1,error:`Cannot access file: ${h}`,suggestion:"Check file permissions and path"}}}function I(h){let m=typeof h==="string"?Number.parseInt(h,10):h;if(Number.isNaN(m))return{isValid:!1,error:"Timeout must be a valid number",suggestion:"Specify timeout in milliseconds (e.g., 5000 for 5 seconds)"};if(m<100)return{isValid:!1,error:"Timeout too short (minimum 100ms)",suggestion:"Use a timeout of at least 100ms"};if(m>300000)return{isValid:!1,error:"Timeout too long (maximum 5 minutes)",suggestion:"Use a timeout of less than 300000ms (5 minutes)"};return{isValid:!0}}var O=(h)=>h.includes("*")||h.includes("?")||h.includes("{")||h.includes("["),W=(h)=>h.endsWith(".stx")||h.endsWith(".md");function F(h,m=1){if(console.error(`\u274C ${h.error}`),h.suggestion)console.error(`\uD83D\uDCA1 suggestion: ${h.suggestion}`);n.exit(m)}function M(h){if(!h)return;let m;try{m=JSON.parse(h)}catch(x){console.error(`\u274C --info-plist is not valid JSON: ${x.message}`),n.exit(1)}if(typeof m!=="object"||m===null||Array.isArray(m))console.error(`\u274C --info-plist must be a JSON object, e.g. '{"NSFocusStatusUsageDescription":"\u2026"}'`),n.exit(1);for(let[x,t]of Object.entries(m))if(typeof t!=="string"&&typeof t!=="number"&&typeof t!=="boolean")console.error(`\u274C --info-plist value for "${x}" must be a string, number or boolean`),n.exit(1);return m}async function V(h,m){try{let x=["test"],t=[];if(h&&h.length>0)for(let c of h)if(O(c))try{let i=await Array.fromAsync(new Bun.Glob(c).scan({onlyFiles:!0,absolute:!0}));if(i.length===0)console.warn(`Warning: No files found matching pattern: ${c}`);else if(t.push(...i),m.verbose)console.log(`Found ${i.length} file(s) matching pattern: ${c}`)}catch(i){return console.error(`Error expanding glob pattern ${c}:`,i),!1}else t.push(c);if(t.length===0)return console.error("Error: No test files found matching the provided patterns."),!1;if(x.push(...t),m.filter)x.push("--pattern",m.filter);if(m.timeout)x.push("--timeout",m.timeout.toString());if(m.reporter&&m.reporter!=="default")if(m.reporter==="junit"){let c=f.resolve("stx-test-report.xml");x.push("--reporter",m.reporter),x.push("--reporter-outfile",c),console.log(`JUnit report: ${c}`)}else console.warn(`Warning: Reporter '${m.reporter}' is not supported. Using default reporter.`);if(m.coverage)x.push("--coverage");if(m.watch)x.push("--watch");x.push("--preload",f.join(__dirname,"../../../test-utils/happy-dom.ts"));let e={...n.env,STX_TEST_MODE:"true",STX_TEST_UI:m.ui?"true":"false",STX_TEST_VERBOSE:m.verbose?"true":"false"},o="bun";if(m.verbose)console.log(`Running: ${o} ${x.join(" ")}`);let r=performance.now(),s=R(o,x,{stdio:"inherit",shell:!1,env:e});return new Promise((c)=>{s.on("close",(i)=>{let d=((performance.now()-r)/1000).toFixed(2);if(i===0)c(!0);else c(!1)}),n.on("SIGINT",()=>{console.log(`
3
+ import{ae}from"./chunk-eg2p1cyw.js";import"./chunk-0wms5teg.js";import"./chunk-xppm4cs4.js";import{Ie}from"./chunk-ynnd6nnt.js";import"./chunk-46t924aw.js";import"./chunk-gpkxphqz.js";import"./chunk-jtccqpwa.js";import"./chunk-t4dkcf28.js";import"./chunk-rtsshvpt.js";import"./chunk-09412heg.js";import"./chunk-nws4zm4k.js";import"./chunk-c7qej674.js";import"./chunk-0ey7kc6t.js";import"./chunk-8vkywnpx.js";import"./chunk-shnw9geh.js";import"./chunk-f2zgh4xr.js";import"./chunk-8bxws458.js";import"./chunk-r96ahk8s.js";import"./chunk-fez9828r.js";import"./chunk-jh36gqcq.js";import"./chunk-81ysx0tc.js";import"./chunk-2ts9pb6s.js";import"./chunk-6xcmeev9.js";import"./chunk-ke76eaat.js";import"./chunk-fa3ygt8c.js";import"./chunk-tbcvarvy.js";import"./chunk-ga650crj.js";import"./chunk-y1cneng3.js";import"./chunk-tb5h85ag.js";import"./chunk-trgbdydw.js";import"./chunk-63sqdcr6.js";import"./chunk-88a7qaw8.js";import"./chunk-t5q31st4.js";import"./chunk-b147ejha.js";import"./chunk-4fc8zs15.js";import"./chunk-54p27ney.js";import"./chunk-3m5v3ynh.js";import"./chunk-bsw6hd14.js";import"./chunk-yqjmqndq.js";import"./chunk-25m74mh1.js";import"./chunk-zfb2wnha.js";import"./chunk-93c08def.js";import"./chunk-hpwtjb4a.js";import{nn,rn}from"./chunk-fx8jjasv.js";import"./chunk-y6wbbmp3.js";import"./chunk-056rsqc6.js";import"./chunk-9qxx2teq.js";import"./chunk-3qyz80d6.js";import"./chunk-jaf44web.js";import"./chunk-qpz9jrvw.js";import"./chunk-2j3gttzf.js";import"./chunk-9mbyhepc.js";import"./chunk-tj533808.js";import{Qi,ea,ta,na,uo,ra,sa,oa,po,fo,Ur,Wr,qr}from"./chunk-k7e3e149.js";import"./chunk-jmshgw0t.js";import"./chunk-tm5t3hh3.js";import"./chunk-rwc322gq.js";import"./chunk-xa2qfe51.js";import"./chunk-cww1zk8y.js";import"./chunk-0zgxxhvs.js";import"./chunk-he9dzchk.js";import{kc}from"./chunk-xr9rf0e6.js";import{g}from"./chunk-0dve54ne.js";import{spawn as R}from"child_process";import S from"fs";import f from"path";import n from"process";import{CLI as z}from"@stacksjs/clapp";var __dirname="/home/runner/work/stx/stx/packages/stx/bin",y=new z("stx");function E(h){let m=typeof h==="string"?Number.parseInt(h,10):h;if(Number.isNaN(m))return{isValid:!1,error:"Port must be a valid number",suggestion:"Try using a number between 1024 and 65535"};if(m<1024||m>65535)return{isValid:!1,error:"Port must be between 1024 and 65535",suggestion:"Try using a port between 1024 and 65535"};return{isValid:!0}}function A(h){try{if(!S.existsSync(h)){let x=f.dirname(h),t=f.basename(h);if(S.existsSync(x)){let o=S.readdirSync(x).filter((s)=>s.toLowerCase().includes(t.toLowerCase().substring(0,3))||s.endsWith(".stx")||s.endsWith(".md")),r=o.length>0?`File not found. Similar files in ${x}: ${o.slice(0,3).join(", ")}`:`File not found. Directory ${x} exists but doesn't contain the specified file.`;return{isValid:!1,error:`File does not exist: ${h}`,suggestion:r}}return{isValid:!1,error:`File does not exist: ${h}`,suggestion:"Check the file path and try again"}}if(S.statSync(h).isDirectory())return{isValid:!1,error:`Expected file but got directory: ${h}`,suggestion:"Specify a .stx or .md file path"};return{isValid:!0}}catch(m){return{isValid:!1,error:`Cannot access file: ${h}`,suggestion:"Check file permissions and path"}}}function I(h){let m=typeof h==="string"?Number.parseInt(h,10):h;if(Number.isNaN(m))return{isValid:!1,error:"Timeout must be a valid number",suggestion:"Specify timeout in milliseconds (e.g., 5000 for 5 seconds)"};if(m<100)return{isValid:!1,error:"Timeout too short (minimum 100ms)",suggestion:"Use a timeout of at least 100ms"};if(m>300000)return{isValid:!1,error:"Timeout too long (maximum 5 minutes)",suggestion:"Use a timeout of less than 300000ms (5 minutes)"};return{isValid:!0}}var O=(h)=>h.includes("*")||h.includes("?")||h.includes("{")||h.includes("["),W=(h)=>h.endsWith(".stx")||h.endsWith(".md");function F(h,m=1){if(console.error(`\u274C ${h.error}`),h.suggestion)console.error(`\uD83D\uDCA1 suggestion: ${h.suggestion}`);n.exit(m)}function M(h){if(!h)return;let m;try{m=JSON.parse(h)}catch(x){console.error(`\u274C --info-plist is not valid JSON: ${x.message}`),n.exit(1)}if(typeof m!=="object"||m===null||Array.isArray(m))console.error(`\u274C --info-plist must be a JSON object, e.g. '{"NSFocusStatusUsageDescription":"\u2026"}'`),n.exit(1);for(let[x,t]of Object.entries(m))if(typeof t!=="string"&&typeof t!=="number"&&typeof t!=="boolean")console.error(`\u274C --info-plist value for "${x}" must be a string, number or boolean`),n.exit(1);return m}async function V(h,m){try{let x=["test"],t=[];if(h&&h.length>0)for(let c of h)if(O(c))try{let i=await Array.fromAsync(new Bun.Glob(c).scan({onlyFiles:!0,absolute:!0}));if(i.length===0)console.warn(`Warning: No files found matching pattern: ${c}`);else if(t.push(...i),m.verbose)console.log(`Found ${i.length} file(s) matching pattern: ${c}`)}catch(i){return console.error(`Error expanding glob pattern ${c}:`,i),!1}else t.push(c);if(t.length===0)return console.error("Error: No test files found matching the provided patterns."),!1;if(x.push(...t),m.filter)x.push("--pattern",m.filter);if(m.timeout)x.push("--timeout",m.timeout.toString());if(m.reporter&&m.reporter!=="default")if(m.reporter==="junit"){let c=f.resolve("stx-test-report.xml");x.push("--reporter",m.reporter),x.push("--reporter-outfile",c),console.log(`JUnit report: ${c}`)}else console.warn(`Warning: Reporter '${m.reporter}' is not supported. Using default reporter.`);if(m.coverage)x.push("--coverage");if(m.watch)x.push("--watch");x.push("--preload",f.join(__dirname,"../../../test-utils/happy-dom.ts"));let e={...n.env,STX_TEST_MODE:"true",STX_TEST_UI:m.ui?"true":"false",STX_TEST_VERBOSE:m.verbose?"true":"false"},o="bun";if(m.verbose)console.log(`Running: ${o} ${x.join(" ")}`);let r=performance.now(),s=R(o,x,{stdio:"inherit",shell:!1,env:e});return new Promise((c)=>{s.on("close",(i)=>{let d=((performance.now()-r)/1000).toFixed(2);if(i===0)c(!0);else c(!1)}),n.on("SIGINT",()=>{console.log(`
4
4
  Test run interrupted`),s.kill("SIGINT"),n.exit(1)})})}catch(x){return console.error("Error running tests:",x instanceof Error?x.message:String(x)),!1}}var U=n.argv.length>=3&&(W(n.argv[2])&&S.existsSync(n.argv[2])||O(n.argv[2]));if(U){let h=n.argv[2],m={port:3000,watch:!0,cache:!0,markdown:{syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}}};for(let x=3;x<n.argv.length;x++){let t=n.argv[x];if(t==="--port"&&x+1<n.argv.length){let e=E(n.argv[++x]);if(!e.isValid)F(e);m.port=Number.parseInt(n.argv[x],10)}else if(t==="--no-watch")m.watch=!1;else if(t==="--highlight-theme"&&x+1<n.argv.length){if(!m.markdown)m.markdown={};if(!m.markdown.syntaxHighlighting)m.markdown.syntaxHighlighting={};m.markdown.syntaxHighlighting.defaultTheme=n.argv[++x]}else if(t==="--no-highlight"){if(!m.markdown)m.markdown={};if(!m.markdown.syntaxHighlighting)m.markdown.syntaxHighlighting={};m.markdown.syntaxHighlighting.enabled=!1}else if(t==="--no-highlight-unknown"){if(!m.markdown)m.markdown={};if(!m.markdown.syntaxHighlighting)m.markdown.syntaxHighlighting={};m.markdown.syntaxHighlighting.highlightUnknownLanguages=!1}else if(t==="--no-cache")m.cache=!1;else if(t==="--native")m.native=!0}if(O(h))try{let x=await Array.fromAsync(new Bun.Glob(h).scan({onlyFiles:!0,absolute:!0})),t=h.endsWith(".stx")?x.filter((s)=>s.endsWith(".stx")):h.endsWith(".md")?x.filter((s)=>s.endsWith(".md")):x.filter((s)=>s.endsWith(".stx")||s.endsWith(".md")),e=h.split("*")[0].replace(/\/$/,"")||".",o=f.resolve(e);try{let s=new Bun.Glob("**/*.stx"),i=(await Array.fromAsync(s.scan({cwd:o,onlyFiles:!0,absolute:!0}))).filter((l)=>/\[.+\]/.test(f.basename(l)));for(let l of i)if(!t.includes(l))t.push(l)}catch{}if(t.length===0)console.error(`Error: No STX or Markdown files found matching pattern: ${h}`),n.exit(1);if(!await Wr(t,m))n.exit(1)}catch(x){console.error("Failed to process files:",x),n.exit(1)}else Ur(h,m).catch((x)=>{console.error("Failed to start dev server:",x),n.exit(1)})}else{let h=function(t,e){let o=[];for(let r=0;r<=e.length;r++)o[r]=[r];for(let r=0;r<=t.length;r++)o[0][r]=r;for(let r=1;r<=e.length;r++)for(let s=1;s<=t.length;s++)if(e.charAt(r-1)===t.charAt(s-1))o[r][s]=o[r-1][s-1];else o[r][s]=Math.min(o[r-1][s-1]+1,o[r][s-1]+1,o[r-1][s]+1);return o[e.length][t.length]};y.command("docs","Generate documentation for components, templates, and directives").option("--output <dir>","Output directory for documentation",{default:"docs"}).option("--format <format>","Documentation format (markdown, html, json)",{default:"markdown"}).option("--components-dir <dir>","Components directory",{default:"components"}).option("--templates-dir <dir>","Templates directory",{default:"."}).option("--no-components","Disable components documentation").option("--no-templates","Disable templates documentation").option("--no-directives","Disable directives documentation").option("--extra-content <content>","Extra content to include in documentation").example("stx docs --output docs --format html").action(async(t)=>{try{if(await na(t))console.log("Documentation generated successfully."),n.exit(0);else console.error("Documentation generation failed."),n.exit(1)}catch(e){console.error("Error generating documentation:",e),n.exit(1)}}),y.command("iconify <command>","Generate Iconify icon packages").option("--output <dir>","Output directory for generated packages",{default:"packages"}).option("--icons <icons>","Comma-separated list of specific icons to generate").example("stx iconify list").example("stx iconify generate mdi").example("stx iconify generate lucide --icons home,settings,user").action(async(t,e)=>{try{let{fetchCollections:o,generatePackage:r}=await import("./chunk-3wkgd883.js");if(t==="list"){console.log(`
5
5
  \uD83D\uDCDA Fetching available icon collections...
6
6
  `);let s=await o(),c=Object.entries(s).sort((i,l)=>l[1].total-i[1].total);console.log(`Available collections:
7
7
  `);for(let[i,l]of c){let d=l;console.log(` ${i.padEnd(30)} ${d.name} (${d.total} icons)`)}console.log(`
8
8
  Total: ${c.length} collections`)}else if(t.startsWith("generate")){let s=t==="generate"?"":t.replace("generate:","").replace("generate-","").replace("generate","").trim();if(!s)console.error("Error: Please specify a collection prefix"),console.error("Usage: stx iconify generate <prefix> [--icons icon1,icon2,...]"),n.exit(1);let c=e.output||f.join(n.cwd(),"packages/collections"),i=e.icons?e.icons.split(",").map((l)=>l.trim()):void 0;await r(s,c,i),console.log(`
9
9
  \u2713 Package generated successfully!`),console.log(`
10
- To use the package:`),console.log(` 1. cd packages/collections/iconify-${s}`),console.log(" 2. bun install"),console.log(" 3. bun run build")}else console.error(`Unknown iconify command: ${t}`),console.error("Available commands: list, generate"),n.exit(1)}catch(o){console.error("Error:",o instanceof Error?o.message:String(o)),n.exit(1)}}),y.command("pwa <command>","PWA tools - audit configuration and build output").option("--output <dir>","Build output directory to audit",{default:"dist"}).example("stx pwa audit").example("stx pwa audit --output build").action(async(t,e)=>{try{if(t==="audit"){let{runPwaAudit:o,formatAuditResult:r}=await import("./chunk-f8akfzzn.js"),{loadConfig:s}=await import("./chunk-8xb9ecb9.js");console.log(`
10
+ To use the package:`),console.log(` 1. cd packages/collections/iconify-${s}`),console.log(" 2. bun install"),console.log(" 3. bun run build")}else console.error(`Unknown iconify command: ${t}`),console.error("Available commands: list, generate"),n.exit(1)}catch(o){console.error("Error:",o instanceof Error?o.message:String(o)),n.exit(1)}}),y.command("pwa <command>","PWA tools - audit configuration and build output").option("--output <dir>","Build output directory to audit",{default:"dist"}).example("stx pwa audit").example("stx pwa audit --output build").action(async(t,e)=>{try{if(t==="audit"){let{runPwaAudit:o,formatAuditResult:r}=await import("./chunk-f8akfzzn.js"),{loadConfig:s}=await import("./chunk-xsmyhp5f.js");console.log(`
11
11
  \uD83D\uDD0D Running PWA audit...
12
12
  `);let c=await s(),i=e.output||"dist",l=o(c,i);if(console.log(r(l)),l.failed>0)n.exit(1)}else console.error(`Unknown pwa command: ${t}`),console.error("Available commands: audit"),n.exit(1)}catch(o){console.error("Error:",o instanceof Error?o.message:String(o)),n.exit(1)}}),y.command("dev [file]","Start a development server for an STX app or file").option("--port <port>","Port to use for the dev server",{default:3000}).option("--pages <dir>",'Directory containing page templates (default: pagesDir from stx.config.ts, else "pages")').option("--no-watch","Disable file watching and auto-reload").option("--native","Open in a native desktop window using Zyte").option("--titlebar-hidden","Hide the native titlebar but keep the traffic-light buttons (web content draws under a transparent full-size titlebar). Implies --native.").option("--highlight-theme <theme>","Syntax highlighting theme for Markdown code blocks",{default:"github-dark"}).option("--no-highlight","Disable syntax highlighting for Markdown code blocks").option("--no-highlight-unknown","Disable syntax highlighting for unknown languages in Markdown").option("--no-cache","Disable caching of parsed files").option("--no-hmr","Disable HMR / live-reload script injection (useful for clean network traces)").option("--profile","Print per-directive timing for every page render via performanceMonitor").option("--debug-directives","Log directive ordering and intermediate template state during rendering").example("stx dev").example("stx dev --port 8080").example("stx dev --pages src/pages").example("stx dev template.stx").example("stx dev components/hero.stx --port 8080").example("stx dev **/*.stx").example("stx dev docs/guide.md").example("stx dev template.stx --native").action(async(t,e)=>{try{if(e.port!==void 0){let r=E(e.port);if(!r.isValid)F(r);e.port=Number.parseInt(String(e.port),10)}if(e.timeout!==void 0){let r=I(e.timeout);if(!r.isValid)F(r)}let o={syntaxHighlighting:{enabled:e.highlight!==!1,serverSide:!0,defaultTheme:e.highlightTheme||"github-dark",highlightUnknownLanguages:e.highlightUnknown!==!1}};if(!t){if(!await qr(".",{port:e.port,watch:e.watch!==!1,native:e.native||e.titlebarHidden||!1,titlebarHidden:e.titlebarHidden===!0,cache:e.cache!==!1,hotReload:e.hmr!==!1,profile:e.profile===!0,debugDirectives:e.debugDirectives===!0,...e.pages&&{pagesDir:e.pages}}))n.exit(1);return}if(!O(t))try{let r=await import("fs");if(r.existsSync(t)&&r.statSync(t).isDirectory()){if(!await qr(t,{port:e.port,watch:e.watch!==!1,native:e.native||e.titlebarHidden||!1,titlebarHidden:e.titlebarHidden===!0,cache:e.cache!==!1,hotReload:e.hmr!==!1,profile:e.profile===!0,debugDirectives:e.debugDirectives===!0,...e.pages&&{pagesDir:e.pages}}))n.exit(1);return}}catch{}if(O(t)){console.log(`Expanding glob pattern: ${t}`);let r=await ae.timeAsync("glob-expansion",async()=>Array.fromAsync(new Bun.Glob(t).scan({onlyFiles:!0,absolute:!0}))),s=t.endsWith(".stx")?r.filter((d)=>d.endsWith(".stx")):t.endsWith(".md")?r.filter((d)=>d.endsWith(".md")):r.filter((d)=>d.endsWith(".stx")||d.endsWith(".md"));if(s.length===0)console.error(`No STX or Markdown files found matching pattern: ${t}`),console.error("Try using patterns like '*.stx' or 'components/**/*.stx'"),n.exit(1);let c=t.split("*")[0].replace(/\/$/,"")||".",i=f.resolve(c);try{let d=new Bun.Glob("**/*.stx"),u=(await Array.fromAsync(d.scan({cwd:i,onlyFiles:!0,absolute:!0}))).filter((p)=>/\[.+\]/.test(f.basename(p)));for(let p of u)if(!s.includes(p))s.push(p)}catch{}if(console.log(`Found ${s.length} ${s.length===1?"file":"files"} matching ${t}`),!await Wr(s,{port:e.port,watch:e.watch!==!1,native:e.native||e.titlebarHidden||!1,titlebarHidden:e.titlebarHidden===!0,markdown:o,cache:e.cache!==!1}))n.exit(1)}else{if(!O(t)){let s=A(t);if(!s.isValid)F(s)}if(!await Ur(t,{port:e.port,watch:e.watch!==!1,native:e.native||e.titlebarHidden||!1,titlebarHidden:e.titlebarHidden===!0,markdown:o,cache:e.cache!==!1}))n.exit(1)}}catch(o){console.error("Error starting dev server:",o),n.exit(1)}}),y.command("a11y [target]","Scan .stx files for accessibility issues (directory, file, or glob)").option("--no-recursive","Disable recursive scanning of directories").option("--ignore <paths>","Comma-separated paths to ignore",{default:""}).option("--json","Output results as JSON").option("--output <file>","Write results to a file instead of stdout").option("--fix","Automatically fix common accessibility issues").example("stx a11y ./templates").example('stx a11y "resources/**/*.stx"').example("stx a11y resources/emails/welcome.stx").example("stx a11y --json --output a11y-report.json").action(async(t=".",e)=>{try{console.log(`Scanning ${t} for accessibility issues...`);let o=e.ignore?e.ignore.split(",").map((l)=>l.trim()):[],{results:r,scannedFiles:s}=await kc(t,{recursive:e.recursive!==!1,ignorePaths:o});if(s.length===0)console.log(`
13
13
  No .stx files matched ${t}
@@ -69,7 +69,7 @@ Total: ${i} issues in ${c} files`),e.output){let l=`
69
69
  File not found: ${t}`),n.exit(1);if(!t.endsWith(".stx"))console.error(`
70
70
  File must have .stx extension: ${t}`),n.exit(1)}let r=f.resolve(e.pages),s=f.resolve(e.out);if(!t&&!S.existsSync(r))console.error(`
71
71
  Pages directory not found: ${r}`),console.log(`
72
- Create a 'pages' directory with .stx files, or use --pages to specify a different directory.`),n.exit(1);let{buildApp:c}=await import("./chunk-g891ftgz.js");rn();let i=await c({root:t?f.dirname(t):void 0,debug:e.verbose,ssg:{pagesDir:e.pages,outputDir:e.out,domain:e.domain,baseUrl:e.base,sitemap:e.sitemap,rss:e.rss,minify:e.minify,cache:e.cache!==!1,cleanOutput:e.clean,concurrency:Number.parseInt(e.concurrency,10)||10,publicDir:e.public,trailingSlash:e.trailingSlash,generate404:!0,hooks:e.verbose?{onPageStart:(d)=>console.log(` Generating: ${d}`),onPageEnd:(d,a)=>console.log(` Generated: ${d} (${a.length} bytes)`),onError:(d,a)=>console.error(` Error in ${a}: ${d.message}`)}:void 0},ssr:{outputDir:e.out==="dist"?".output":e.out,debug:e.verbose}}),l=((performance.now()-o)/1000).toFixed(2);if(i.mode==="ssr"&&i.ssr)console.log(`
72
+ Create a 'pages' directory with .stx files, or use --pages to specify a different directory.`),n.exit(1);let{buildApp:c}=await import("./chunk-34afrhts.js");rn();let i=await c({root:t?f.dirname(t):void 0,debug:e.verbose,ssg:{pagesDir:e.pages,outputDir:e.out,domain:e.domain,baseUrl:e.base,sitemap:e.sitemap,rss:e.rss,minify:e.minify,cache:e.cache!==!1,cleanOutput:e.clean,concurrency:Number.parseInt(e.concurrency,10)||10,publicDir:e.public,trailingSlash:e.trailingSlash,generate404:!0,hooks:e.verbose?{onPageStart:(d)=>console.log(` Generating: ${d}`),onPageEnd:(d,a)=>console.log(` Generated: ${d} (${a.length} bytes)`),onError:(d,a)=>console.error(` Error in ${a}: ${d.message}`)}:void 0},ssr:{outputDir:e.out==="dist"?".output":e.out,debug:e.verbose}}),l=((performance.now()-o)/1000).toFixed(2);if(i.mode==="ssr"&&i.ssr)console.log(`
73
73
  Build complete! (SSR)
74
74
  `),console.log(` Pages compiled: ${i.ssr.pageCount}`),console.log(` Output: ${i.ssr.outputDir}`),console.log(` Duration: ${l}s
75
75
  `);else if(i.ssg){if(console.log(`
@@ -84,7 +84,7 @@ Total: ${i} issues in ${c} files`),e.output){let l=`
84
84
  Build completed with ${i.ssg.failedCount} error(s). Fix the issues above and try again.
85
85
  `),n.exit(1);console.log(" To preview locally:"),console.log(` cd ${e.out||"dist"} && npx serve
86
86
  `)}}catch(o){console.error(`
87
- Build failed:`,o instanceof Error?o.message:String(o)),n.exit(1)}}),y.command("start","Start the production server (serves pre-built .output/)").option("--port <number>","Server port",{default:"3000"}).option("--output <dir>","Output directory from stx build",{default:".output"}).example("stx start").example("stx start --port 8080").action(async(t)=>{try{let e=f.resolve(t.output);if(!S.existsSync(f.join(e,"manifest.json")))console.error("\n No production build found. Run `stx build --out .output` first.\n"),n.exit(1);let{startProductionServer:o}=await import("./chunk-ke8rxpp9.js");await o({outputDir:e,port:Number.parseInt(t.port,10)||3000})}catch(e){console.error(`
87
+ Build failed:`,o instanceof Error?o.message:String(o)),n.exit(1)}}),y.command("start","Start the production server (serves pre-built .output/)").option("--port <number>","Server port",{default:"3000"}).option("--output <dir>","Output directory from stx build",{default:".output"}).example("stx start").example("stx start --port 8080").action(async(t)=>{try{let e=f.resolve(t.output);if(!S.existsSync(f.join(e,"manifest.json")))console.error("\n No production build found. Run `stx build --out .output` first.\n"),n.exit(1);let{startProductionServer:o}=await import("./chunk-7c73t536.js");await o({outputDir:e,port:Number.parseInt(t.port,10)||3000})}catch(e){console.error(`
88
88
  Failed to start production server:`,e instanceof Error?e.message:String(e)),n.exit(1)}}),y.command("deploy [directory]","Deploy built site to Netlify").option("--site-id <id>","Netlify site ID (or set NETLIFY_SITE_ID env var)").option("--token <token>","Auth token (or set NETLIFY_AUTH_TOKEN env var)").option("--production","Deploy to production (default: draft preview)").option("--message <msg>","Deploy message/title").option("--no-build","Skip build step before deploy").option("--open","Open deployed URL in browser").option("--dry-run","Preview deployment without uploading").option("--init","Initialize Netlify configuration for this project").example("stx deploy").example("stx deploy --production").example("stx deploy dist --site-id my-site-abc123").example("stx deploy --init").example("stx deploy --dry-run").action(async(t,e)=>{try{let{deploy:o,initNetlify:r,DeployError:s}=await import("./chunk-rke4q3jk.js");if(console.log(`\x1B[1mstx deploy\x1B[0m \x1B[2mv${Ie}\x1B[0m`),e.init){console.log(`
89
89
  \uD83D\uDCDD Initializing Netlify configuration...
90
90
  `);let i=await r({directory:t||n.cwd(),siteId:e.siteId});if(console.log(`\u2713 Created ${i.configPath}`),i.siteId)console.log("\u2713 Saved site ID to .env.local");console.log(`
@@ -124,7 +124,7 @@ To view it in the development server:`),console.log(` stx dev ${t}
124
124
  \uD83D\uDCDD ${f.relative(n.cwd(),a)}:`),console.log("--- Original"),console.log("+++ Formatted"),console.log(`@@ Changes in ${f.basename(a)} @@`),console.log("+ Formatted content would be applied");else await Bun.write(a,b),console.log(`\u2705 Formatted ${f.relative(n.cwd(),a)}`),l++}catch(u){console.error(`\u274C Error formatting ${f.relative(n.cwd(),a)}:`,u),d++}if(e.check&&d>0)console.log(`
125
125
  ${d} files need formatting. Run 'stx format' to fix.`),n.exit(1);else if(!e.check&&!e.diff)console.log(`\u2728 Formatted ${l} files successfully`)}catch(o){console.error("Error formatting files:",o),n.exit(1)}}),y.command("perf [command...]","Show performance statistics for STX operations").option("--clear","Clear performance statistics").option("--json","Output as JSON").example("stx perf").example("stx perf --clear").example("stx perf --json").action(async(t,e)=>{try{if(e.clear){ae.clear(),console.log("\u2705 Performance statistics cleared");return}let o=ae.getStats();if(Object.keys(o).length===0){if(e.json){console.log(JSON.stringify({},null,2));return}console.log("No performance data available. Run some STX commands first.");return}if(e.json)console.log(JSON.stringify(o,null,2));else{console.log(`
126
126
  \uD83D\uDCCA STX Performance Statistics
127
- `);for(let[r,s]of Object.entries(o))console.log(`\uD83D\uDD27 ${r}:`),console.log(` Count: ${s.count}`),console.log(` Average: ${s.avgTime.toFixed(2)}ms`),console.log(` Total: ${s.totalTime.toFixed(2)}ms`),console.log(` Min: ${s.minTime.toFixed(2)}ms`),console.log(` Max: ${s.maxTime.toFixed(2)}ms`),console.log("")}}catch(o){console.error("Error showing performance stats:",o),n.exit(1)}}),y.command("typecheck [patterns...]","Type-check the TypeScript inside .stx script blocks").option("--no-client","Skip <script client> and bare <script> blocks").option("--no-server","Skip <script server> blocks").option("--no-templates","Skip {{ }} and directive expressions in the markup").option("--lib <path>","Extra ambient declaration file (repeatable)").example("stx typecheck").example('stx typecheck "resources/views/**/*.stx"').action(async(t,e)=>{let{formatTypecheckDiagnostics:o,typecheckStxFiles:r}=await import("./chunk-343hxxq1.js"),{resolveStxTargets:s}=await import("./chunk-0g05v7m1.js"),c=Array.isArray(t)?t:t?[t]:[],i=c.length?c:["**/*.stx"],l=await s(i);if(l.length===0){console.log(`
127
+ `);for(let[r,s]of Object.entries(o))console.log(`\uD83D\uDD27 ${r}:`),console.log(` Count: ${s.count}`),console.log(` Average: ${s.avgTime.toFixed(2)}ms`),console.log(` Total: ${s.totalTime.toFixed(2)}ms`),console.log(` Min: ${s.minTime.toFixed(2)}ms`),console.log(` Max: ${s.maxTime.toFixed(2)}ms`),console.log("")}}catch(o){console.error("Error showing performance stats:",o),n.exit(1)}}),y.command("typecheck [patterns...]","Type-check the TypeScript inside .stx script blocks").option("--no-client","Skip <script client> and bare <script> blocks").option("--no-server","Skip <script server> blocks").option("--no-templates","Skip {{ }} and directive expressions in the markup").option("--lib <path>","Extra ambient declaration file (repeatable)").example("stx typecheck").example('stx typecheck "resources/views/**/*.stx"').action(async(t,e)=>{let{formatTypecheckDiagnostics:o,typecheckStxFiles:r}=await import("./chunk-x45mp78q.js"),{resolveStxTargets:s}=await import("./chunk-0g05v7m1.js"),c=Array.isArray(t)?t:t?[t]:[],i=c.length?c:["**/*.stx"],l=await s(i);if(l.length===0){console.log(`
128
128
  No .stx files matched ${i.join(", ")}
129
129
  `);return}let d=Qi(n.argv,"--lib"),a=d.length>0?d:e.lib?Array.isArray(e.lib)?e.lib:[e.lib]:[],u=await r(l,{client:e.client!==!1,server:e.server!==!1,templates:e.templates!==!1,extraLibs:a});if(u.failure)console.error(`
130
130
  Type-check did not run.
@@ -160,11 +160,11 @@ Press Ctrl+C to stop watching...
160
160
  \uD83D\uDCC4 Files with issues:`),d.forEach((a)=>{let u=a.issues.filter((p)=>s[p.type]>=c).length;if(u>0)console.log(` ${f.relative(n.cwd(),a.file)} (${u} issues)`)});if(e.saveReport){let a={summary:l,results:d,generatedAt:new Date().toISOString(),commandOptions:e};await Bun.write(e.saveReport,JSON.stringify(a,null,2)),console.log(`
161
161
  \uD83D\uDCCB Analysis report saved to: ${e.saveReport}`)}console.log(`
162
162
  \u2728 Analysis complete! Use --detailed for more information.`)}catch(o){console.error("Error analyzing templates:",o),n.exit(1)}}),y.command("screenshot [input]","Capture PNG screenshot(s) of page(s) via Bun WebView \u2014 a file, URL, or dist directory").option("--out <dir>","Output directory",{default:"screenshots"}).option("--width <px>","Viewport width",{default:"1440"}).option("--height <px>","Viewport height",{default:"2200"}).option("--wait <ms>","Settle time after navigation before capture",{default:"800"}).option("--timeout <ms>","Hard cap on waiting for navigation",{default:"15000"}).option("--full-page","Capture the entire scrollable page, not just the viewport").option("--wait-selector <sel>","Wait until a CSS selector exists before capturing").option("--format <fmt>","Image format: png | jpeg | webp",{default:"png"}).option("--backend <name>","WebView backend: webkit (macOS, default) | chrome").action(async(t,e)=>{let{captureScreenshots:o}=await import("./chunk-3m6n90sk.js"),r=t||"dist";try{let s=await o(r,e.out,{width:Number.parseInt(e.width,10),height:Number.parseInt(e.height,10),waitMs:Number.parseInt(e.wait,10),timeoutMs:Number.parseInt(e.timeout,10),fullPage:Boolean(e.fullPage),waitSelector:e.waitSelector,format:e.format,backend:e.backend});for(let c of s)console.log(`\uD83D\uDCF8 ${c.output} (${(c.bytes/1024).toFixed(0)} KB)`);console.log(`
163
- \u2728 Captured ${s.length} screenshot(s) to ${e.out}/ via Bun WebView`)}catch(s){console.error(`Screenshot failed: ${s.message}`),n.exit(1)}}),y.command("version","Show the version of the CLI").action(()=>{console.log(Ie)}),y.command("interactive","Start interactive REPL mode for template development").alias("i").option("--context <file>","Load initial context from JSON file").option("--cwd <directory>","Set working directory").option("--verbose","Show verbose output").action(async(t)=>{let{startInteractive:e}=await import("./chunk-h526qmg2.js"),o={};if(t.context){let r=f.resolve(t.context);if(S.existsSync(r))try{let s=S.readFileSync(r,"utf-8");o=JSON.parse(s)}catch(s){console.error("Error loading context file:",s),n.exit(1)}else console.error(`Context file not found: ${r}`),n.exit(1)}await e({context:o,cwd:t.cwd?f.resolve(t.cwd):n.cwd(),verbose:t.verbose})}),y.command("build:native <input>","Build stx template into a native desktop/mobile app").option("--output <dir>","Output directory",{default:"dist/native"}).option("--target <platform>","Target platform: macos, windows, linux, ios, android").option("--format <format>","Output format: app, dmg, pkg, msi, zip, deb, rpm, appimage, ipa, apk").option("--name <name>","Application name (defaults to filename)").option("--version <version>","Application version",{default:"1.0.0"}).option("--description <desc>","Application description").option("--author <author>","Author/Maintainer name").option("--bundle-id <id>","Bundle identifier (macOS/iOS)").option("--icon <path>","Path to application icon").option("--width <width>","Window width",{default:"1200"}).option("--height <height>","Window height",{default:"800"}).option("--title <title>","Window title").option("--system-tray","Enable system tray/menubar mode").option("--menubar-only","Run without a dock icon (implied by --system-tray)").option("--category <type>","LSApplicationCategoryType (macOS)").option("--copyright <text>","NSHumanReadableCopyright (macOS)").option("--min-system-version <v>","LSMinimumSystemVersion (macOS)").option("--info-plist <json>","Extra Info.plist keys as a JSON object (macOS)").option("--dev-tools","Enable developer tools").option("--frameless","Create frameless window").option("--always-on-top","Keep window always on top").option("--craft-path <path>","Path to Craft binary").option("--verbose","Show verbose output").example("stx build:native app.stx --target macos").example("stx build:native app.stx --target macos --format dmg").example("stx build:native app.stx --target linux --format appimage").example('stx build:native app.stx --name "My App" --icon icon.png').action(async(t,e)=>{try{let{buildNative:o,getAvailableTargets:r,getAvailableFormats:s}=await import("./chunk-xc1k2zza.js"),c=f.resolve(t);if(!S.existsSync(c))console.error(`\u274C Input file not found: ${t}`),n.exit(1);let i=r();if(e.target&&!["macos","windows","linux","ios","android"].includes(e.target))console.error(`\u274C Invalid target: ${e.target}`),console.error("\uD83D\uDCA1 Available targets: macos, windows, linux, ios, android"),console.error(`\uD83D\uDCA1 Targets available on this machine: ${i.join(", ")}`),n.exit(1);let l=e.target||i[0],d=s(l);if(e.format&&!d.includes(e.format))console.error(`\u274C Invalid format for ${l}: ${e.format}`),console.error(`\uD83D\uDCA1 Available formats: ${d.join(", ")}`),n.exit(1);console.log(`
163
+ \u2728 Captured ${s.length} screenshot(s) to ${e.out}/ via Bun WebView`)}catch(s){console.error(`Screenshot failed: ${s.message}`),n.exit(1)}}),y.command("version","Show the version of the CLI").action(()=>{console.log(Ie)}),y.command("interactive","Start interactive REPL mode for template development").alias("i").option("--context <file>","Load initial context from JSON file").option("--cwd <directory>","Set working directory").option("--verbose","Show verbose output").action(async(t)=>{let{startInteractive:e}=await import("./chunk-kz7ha54c.js"),o={};if(t.context){let r=f.resolve(t.context);if(S.existsSync(r))try{let s=S.readFileSync(r,"utf-8");o=JSON.parse(s)}catch(s){console.error("Error loading context file:",s),n.exit(1)}else console.error(`Context file not found: ${r}`),n.exit(1)}await e({context:o,cwd:t.cwd?f.resolve(t.cwd):n.cwd(),verbose:t.verbose})}),y.command("build:native <input>","Build stx template into a native desktop/mobile app").option("--output <dir>","Output directory",{default:"dist/native"}).option("--target <platform>","Target platform: macos, windows, linux, ios, android").option("--format <format>","Output format: app, dmg, pkg, msi, zip, deb, rpm, appimage, ipa, apk").option("--name <name>","Application name (defaults to filename)").option("--version <version>","Application version",{default:"1.0.0"}).option("--description <desc>","Application description").option("--author <author>","Author/Maintainer name").option("--bundle-id <id>","Bundle identifier (macOS/iOS)").option("--icon <path>","Path to application icon").option("--width <width>","Window width",{default:"1200"}).option("--height <height>","Window height",{default:"800"}).option("--title <title>","Window title").option("--system-tray","Enable system tray/menubar mode").option("--menubar-only","Run without a dock icon (implied by --system-tray)").option("--category <type>","LSApplicationCategoryType (macOS)").option("--copyright <text>","NSHumanReadableCopyright (macOS)").option("--min-system-version <v>","LSMinimumSystemVersion (macOS)").option("--info-plist <json>","Extra Info.plist keys as a JSON object (macOS)").option("--dev-tools","Enable developer tools").option("--frameless","Create frameless window").option("--always-on-top","Keep window always on top").option("--craft-path <path>","Path to Craft binary").option("--verbose","Show verbose output").example("stx build:native app.stx --target macos").example("stx build:native app.stx --target macos --format dmg").example("stx build:native app.stx --target linux --format appimage").example('stx build:native app.stx --name "My App" --icon icon.png').action(async(t,e)=>{try{let{buildNative:o,getAvailableTargets:r,getAvailableFormats:s}=await import("./chunk-740njbwc.js"),c=f.resolve(t);if(!S.existsSync(c))console.error(`\u274C Input file not found: ${t}`),n.exit(1);let i=r();if(e.target&&!["macos","windows","linux","ios","android"].includes(e.target))console.error(`\u274C Invalid target: ${e.target}`),console.error("\uD83D\uDCA1 Available targets: macos, windows, linux, ios, android"),console.error(`\uD83D\uDCA1 Targets available on this machine: ${i.join(", ")}`),n.exit(1);let l=e.target||i[0],d=s(l);if(e.format&&!d.includes(e.format))console.error(`\u274C Invalid format for ${l}: ${e.format}`),console.error(`\uD83D\uDCA1 Available formats: ${d.join(", ")}`),n.exit(1);console.log(`
164
164
  \uD83D\uDD28 Building native app...`),console.log(` Input: ${t}`),console.log(` Target: ${l}`),console.log(` Format: ${e.format||"default"}`),console.log(` Output: ${e.output}
165
165
  `);let a=await o({input:c,output:f.resolve(e.output),target:l,format:e.format,name:e.name,version:e.version,description:e.description,author:e.author,bundleId:e.bundleId,icon:e.icon?f.resolve(e.icon):void 0,window:{title:e.title,width:Number.parseInt(e.width,10),height:Number.parseInt(e.height,10),frameless:e.frameless,alwaysOnTop:e.alwaysOnTop},systemTray:e.systemTray,menubarOnly:e.menubarOnly,category:e.category,copyright:e.copyright,minimumSystemVersion:e.minSystemVersion,infoPlist:M(e.infoPlist),devTools:e.devTools,craftPath:e.craftPath,verbose:e.verbose});if(a.success){if(console.log("\u2705 Build successful!"),console.log(` Output: ${a.outputPath}`),a.duration)console.log(` Duration: ${(a.duration/1000).toFixed(2)}s`);if(l==="macos"&&a.format==="app")console.log(`
166
166
  \uD83D\uDCA1 To run: open "${a.outputPath}"`);else if(l==="linux"&&a.format==="appimage")console.log(`
167
- \uD83D\uDCA1 To run: chmod +x "${a.outputPath}" && "${a.outputPath}"`)}else console.error(`\u274C Build failed: ${a.error}`),n.exit(1)}catch(o){console.error(`\u274C Build error: ${o.message}`),n.exit(1)}}),y.command("story","Start component showcase and testing server").option("-p, --port <port>","Server port",{default:"6006"}).option("-o, --open","Open browser automatically",{default:!1}).option("--host <host>","Host to bind to",{default:"localhost"}).example("stx story").example("stx story --port 3000 --open").action(async(t)=>{try{let{devCommand:e}=await import("./chunk-6peq9s4s.js");await e({port:t.port?Number.parseInt(t.port,10):6006,open:t.open,host:t.host})}catch(e){console.error(`\u274C Story error: ${e.message}`),n.exit(1)}}),y.command("story:build","Build static story site").option("-o, --outDir <dir>","Output directory",{default:".stx/dist/story"}).example("stx story:build").example("stx story:build --outDir ./docs/components").action(async(t)=>{try{let{buildCommand:e}=await import("./chunk-yrmppd8r.js");await e({outDir:t.outDir})}catch(e){console.error(`\u274C Story build error: ${e.message}`),n.exit(1)}}),y.command("story:test","Run visual regression tests").option("-u, --update","Update snapshots",{default:!1}).option("-f, --filter <name>","Filter components by name").example("stx story:test").example("stx story:test --update").example("stx story:test --filter Button").action(async(t)=>{try{let{createContext:e}=await import("./chunk-gg48cgx3.js"),{runVisualTests:o,updateSnapshots:r,formatTestResults:s}=await import("./chunk-q61r0m6r.js"),c=await e({mode:"build"});if(t.update){let i=await r(c,{filter:t.filter?[t.filter]:void 0});console.log(`Updated ${i} snapshots`)}else{let i=await o(c,{filter:t.filter?[t.filter]:void 0});if(console.log(s(i)),i.failed>0)n.exit(1)}}catch(e){console.error(`\u274C Story test error: ${e.message}`),n.exit(1)}}),y.command("native <action> [file]","Compile .stx screens into the JavaScriptCore bundle Craft renders natively").option("--format <format>","bundle (the JavaScriptCore bundle) or ir (the template as JSON)",{default:"ir"}).option("--output <path>","Write to this file instead of stdout").option("--minify","Minify the bundle",{default:!1}).option("--config <file>","Screens config (default: native.config.json in the working directory)").example("stx native compile Screen.stx --format bundle --output native-screen.js").example("stx native compile --format bundle --output native-screen.js --minify").example("stx native compile Screen.stx").action(async(t,e,o)=>{if(t!=="compile")console.error(`Unknown native command: ${t}`),console.error("Usage: stx native compile [file.stx] --format bundle|ir [--output <file>] [--minify] [--config <file>]"),n.exit(1);try{let{runNativeCompile:r}=await import("./chunk-5aqvfnvy.js"),s=await r(e,{format:o.format,output:o.output,minify:Boolean(o.minify),config:o.config});for(let c of s.diagnostics)console.warn(`${c.level}: ${c.message}`);if(s.written)console.log(`Compiled: ${e??"screens"} \u2192 ${f.relative(n.cwd(),s.written)||s.written}`);else console.log(s.output)}catch(r){console.error(r instanceof Error?r.message:String(r)),n.exit(1)}}),y.command("compile <input>","Compile stx template to native Craft component code").option("--target <platform>","Target platform: macos, windows, linux, ios, android, universal",{default:"universal"}).option("--format <format>","Output format: zig, typescript, json",{default:"zig"}).option("--output <path>","Output directory for compiled files",{default:"./dist"}).option("--optimize","Enable optimizations",{default:!0}).option("--tree-shake","Enable tree shaking",{default:!0}).option("--hot-reload","Enable hot reload support",{default:!1}).option("--sourcemaps","Generate source maps",{default:!1}).option("--bundle","Bundle all dependencies",{default:!0}).option("--minify","Minify output",{default:!1}).option("--verbose","Show detailed output",{default:!1}).example("stx compile app.stx").example("stx compile app.stx --target macos --format zig").example("stx compile app.stx --format typescript --output ./native").example("stx compile app.stx --optimize --tree-shake --minify").action(async(t,e)=>{try{let{compileToNative:o}=await import("./chunk-fseqwysr.js"),r=f.resolve(t);if(!S.existsSync(r))console.error(`\u274C Input file not found: ${t}`),n.exit(1);let s=["macos","windows","linux","ios","android","universal"];if(!s.includes(e.target))console.error(`\u274C Invalid target: ${e.target}`),console.error(`\uD83D\uDCA1 Available targets: ${s.join(", ")}`),n.exit(1);let c=["zig","typescript","json"];if(!c.includes(e.format))console.error(`\u274C Invalid format: ${e.format}`),console.error(`\uD83D\uDCA1 Available formats: ${c.join(", ")}`),n.exit(1);console.log(`
167
+ \uD83D\uDCA1 To run: chmod +x "${a.outputPath}" && "${a.outputPath}"`)}else console.error(`\u274C Build failed: ${a.error}`),n.exit(1)}catch(o){console.error(`\u274C Build error: ${o.message}`),n.exit(1)}}),y.command("story","Start component showcase and testing server").option("-p, --port <port>","Server port",{default:"6006"}).option("-o, --open","Open browser automatically",{default:!1}).option("--host <host>","Host to bind to",{default:"localhost"}).example("stx story").example("stx story --port 3000 --open").action(async(t)=>{try{let{devCommand:e}=await import("./chunk-83dxfhkw.js");await e({port:t.port?Number.parseInt(t.port,10):6006,open:t.open,host:t.host})}catch(e){console.error(`\u274C Story error: ${e.message}`),n.exit(1)}}),y.command("story:build","Build static story site").option("-o, --outDir <dir>","Output directory",{default:".stx/dist/story"}).example("stx story:build").example("stx story:build --outDir ./docs/components").action(async(t)=>{try{let{buildCommand:e}=await import("./chunk-yrmppd8r.js");await e({outDir:t.outDir})}catch(e){console.error(`\u274C Story build error: ${e.message}`),n.exit(1)}}),y.command("story:test","Run visual regression tests").option("-u, --update","Update snapshots",{default:!1}).option("-f, --filter <name>","Filter components by name").example("stx story:test").example("stx story:test --update").example("stx story:test --filter Button").action(async(t)=>{try{let{createContext:e}=await import("./chunk-gg48cgx3.js"),{runVisualTests:o,updateSnapshots:r,formatTestResults:s}=await import("./chunk-ct54e34a.js"),c=await e({mode:"build"});if(t.update){let i=await r(c,{filter:t.filter?[t.filter]:void 0});console.log(`Updated ${i} snapshots`)}else{let i=await o(c,{filter:t.filter?[t.filter]:void 0});if(console.log(s(i)),i.failed>0)n.exit(1)}}catch(e){console.error(`\u274C Story test error: ${e.message}`),n.exit(1)}}),y.command("native <action> [file]","Compile .stx screens into the JavaScriptCore bundle Craft renders natively").option("--format <format>","bundle (the JavaScriptCore bundle) or ir (the template as JSON)",{default:"ir"}).option("--output <path>","Write to this file instead of stdout").option("--minify","Minify the bundle",{default:!1}).option("--config <file>","Screens config (default: native.config.json in the working directory)").example("stx native compile Screen.stx --format bundle --output native-screen.js").example("stx native compile --format bundle --output native-screen.js --minify").example("stx native compile Screen.stx").action(async(t,e,o)=>{if(t!=="compile")console.error(`Unknown native command: ${t}`),console.error("Usage: stx native compile [file.stx] --format bundle|ir [--output <file>] [--minify] [--config <file>]"),n.exit(1);try{let{runNativeCompile:r}=await import("./chunk-mnncq81c.js"),s=await r(e,{format:o.format,output:o.output,minify:Boolean(o.minify),config:o.config});for(let c of s.diagnostics)console.warn(`${c.level}: ${c.message}`);if(s.written)console.log(`Compiled: ${e??"screens"} \u2192 ${f.relative(n.cwd(),s.written)||s.written}`);else console.log(s.output)}catch(r){console.error(r instanceof Error?r.message:String(r)),n.exit(1)}}),y.command("compile <input>","Compile stx template to native Craft component code").option("--target <platform>","Target platform: macos, windows, linux, ios, android, universal",{default:"universal"}).option("--format <format>","Output format: zig, typescript, json",{default:"zig"}).option("--output <path>","Output directory for compiled files",{default:"./dist"}).option("--optimize","Enable optimizations",{default:!0}).option("--tree-shake","Enable tree shaking",{default:!0}).option("--hot-reload","Enable hot reload support",{default:!1}).option("--sourcemaps","Generate source maps",{default:!1}).option("--bundle","Bundle all dependencies",{default:!0}).option("--minify","Minify output",{default:!1}).option("--verbose","Show detailed output",{default:!1}).example("stx compile app.stx").example("stx compile app.stx --target macos --format zig").example("stx compile app.stx --format typescript --output ./native").example("stx compile app.stx --optimize --tree-shake --minify").action(async(t,e)=>{try{let{compileToNative:o}=await import("./chunk-fseqwysr.js"),r=f.resolve(t);if(!S.existsSync(r))console.error(`\u274C Input file not found: ${t}`),n.exit(1);let s=["macos","windows","linux","ios","android","universal"];if(!s.includes(e.target))console.error(`\u274C Invalid target: ${e.target}`),console.error(`\uD83D\uDCA1 Available targets: ${s.join(", ")}`),n.exit(1);let c=["zig","typescript","json"];if(!c.includes(e.format))console.error(`\u274C Invalid format: ${e.format}`),console.error(`\uD83D\uDCA1 Available formats: ${c.join(", ")}`),n.exit(1);console.log(`
168
168
  \uD83D\uDD27 Compiling stx template to native code...`),console.log(` Input: ${t}`),console.log(` Target: ${e.target}`),console.log(` Format: ${e.format}`),console.log(` Output: ${e.output}
169
169
  `);let i=S.readFileSync(r,"utf-8"),l=await o(i,{target:e.target,format:e.format,optimize:e.optimize,treeShake:e.treeShake,hotReload:e.hotReload,debug:e.verbose,sourceMaps:e.sourcemaps,bundle:e.bundle,minify:e.minify}),d=f.resolve(e.output);if(!S.existsSync(d))S.mkdirSync(d,{recursive:!0});let a=f.basename(t,f.extname(t)),u=e.format==="typescript"?"ts":e.format==="json"?"json":"zig",p=f.join(d,`${a}.${u}`);S.writeFileSync(p,l.code);let b=f.join(d,`${a}.manifest.json`);if(S.writeFileSync(b,JSON.stringify(l.manifest,null,2)),e.sourcemaps&&l.sourceMaps){let w=f.join(d,`${a}.${u}.map`);S.writeFileSync(w,l.sourceMaps)}if(e.target==="universal"&&l.platformCode.size>0)for(let[w,k]of l.platformCode){let v=f.join(d,`${a}.${w}.${u}`);S.writeFileSync(v,k)}if(console.log("\u2705 Compilation successful!"),console.log(` Output: ${p}`),console.log(` Manifest: ${b}`),console.log(`
170
170
  \uD83D\uDCCA Statistics:`),console.log(` Compilation time: ${l.stats.compilationTime.toFixed(2)}ms`),console.log(` Total components: ${l.stats.totalComponents}`),console.log(` Native components: ${l.stats.nativeComponents}`),console.log(` Web fallback components: ${l.stats.webComponents}`),console.log(` Bundle size: ${(l.stats.bundleSize/1024).toFixed(2)}KB`),l.stats.warnings.length>0){console.log(`
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import"./chunk-ybgzr6wn.js";import{Eo,Ca,Ea}from"./chunk-2xf323h9.js";import"./chunk-rqjskxpw.js";import"./chunk-eg2p1cyw.js";import"./chunk-0wms5teg.js";import"./chunk-xppm4cs4.js";import"./chunk-46t924aw.js";import"./chunk-5ghw26vq.js";import"./chunk-jtccqpwa.js";import"./chunk-t4dkcf28.js";import"./chunk-5njk2ba0.js";import"./chunk-09412heg.js";import"./chunk-nws4zm4k.js";import"./chunk-s4wcksaw.js";import"./chunk-fxk08je0.js";import"./chunk-sz2nax5v.js";import"./chunk-txs1vxas.js";import"./chunk-v5tzcd49.js";import"./chunk-907zya76.js";import"./chunk-ysqzz2h3.js";import"./chunk-t5q31st4.js";import"./chunk-fez9828r.js";import{wu,Ta,Ch,Eh,$a,To,ns,Ra,Aa,Th,$h,Pa,Ia,Oa,Na}from"./chunk-xn0ebqgw.js";import"./chunk-acwdf0cf.js";import"./chunk-mfbqjkgp.js";import"./chunk-cww1zk8y.js";import"./chunk-5x8q6e1q.js";import"./chunk-he9dzchk.js";import"./chunk-ks0dwtp0.js";var m=new Map,d=new Map;function R(t,e){let n=e?.id||E(t),r=I(t),a=m.get(n);if(a&&a.hash===r)return a;let i=M(t),s=L(t),o=W(t),c=O(i),{staticParts:p,dynamicParts:l}=A(i),f=_(t),g={id:n,hash:r,tree:i,scripts:s,styles:o,staticParts:p,dynamicParts:l,dependencies:f,metadata:c};return m.set(n,g),g}async function Q(t,e={},n={}){let r=performance.now();if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`,c=d.get(o);if(c&&Date.now()-c.timestamp<(n.cacheTTL||60000))return{html:c.html,styles:t.styles.join(`
2
+ import"./chunk-ynnd6nnt.js";import{Eo,Ca,Ea}from"./chunk-2xf323h9.js";import"./chunk-rqjskxpw.js";import"./chunk-eg2p1cyw.js";import"./chunk-0wms5teg.js";import"./chunk-xppm4cs4.js";import"./chunk-46t924aw.js";import"./chunk-gpkxphqz.js";import"./chunk-jtccqpwa.js";import"./chunk-t4dkcf28.js";import"./chunk-rtsshvpt.js";import"./chunk-09412heg.js";import"./chunk-nws4zm4k.js";import"./chunk-0ey7kc6t.js";import"./chunk-8vkywnpx.js";import"./chunk-c7qej674.js";import"./chunk-shnw9geh.js";import"./chunk-f2zgh4xr.js";import"./chunk-63sqdcr6.js";import"./chunk-88a7qaw8.js";import"./chunk-t5q31st4.js";import"./chunk-fez9828r.js";import{wu,Ta,Ch,Eh,$a,To,ns,Ra,Aa,Th,$h,Pa,Ia,Oa,Na}from"./chunk-1k12cc65.js";import"./chunk-jmshgw0t.js";import"./chunk-xa2qfe51.js";import"./chunk-cww1zk8y.js";import"./chunk-0zgxxhvs.js";import"./chunk-he9dzchk.js";import"./chunk-xr9rf0e6.js";var m=new Map,d=new Map;function R(t,e){let n=e?.id||E(t),r=I(t),a=m.get(n);if(a&&a.hash===r)return a;let i=M(t),s=L(t),o=W(t),c=O(i),{staticParts:p,dynamicParts:l}=A(i),f=_(t),g={id:n,hash:r,tree:i,scripts:s,styles:o,staticParts:p,dynamicParts:l,dependencies:f,metadata:c};return m.set(n,g),g}async function Q(t,e={},n={}){let r=performance.now();if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`,c=d.get(o);if(c&&Date.now()-c.timestamp<(n.cacheTTL||60000))return{html:c.html,styles:t.styles.join(`
3
3
  `),scripts:t.scripts.join(`
4
4
  `),metadata:{renderTime:0,cacheHit:!0,totalSize:c.html.length,componentCount:t.metadata.componentCount}}}let a;if(n.streaming)a=await H(t.tree,e);else a=h(t.tree,e);let i;if(n.hydrate){let o=j(a,t,e);a=o.html,i=o.data}if(n.minify)a=D(a);if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`;d.set(o,{html:a,timestamp:Date.now()})}let s=performance.now()-r;return{html:a,styles:t.styles.join(`
5
5
  `),scripts:t.scripts.join(`
package/dist/craft.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import"./chunk-ybgzr6wn.js";import{Eo,Ca,Ea}from"./chunk-2xf323h9.js";import"./chunk-rqjskxpw.js";import"./chunk-eg2p1cyw.js";import"./chunk-0wms5teg.js";import"./chunk-xppm4cs4.js";import"./chunk-46t924aw.js";import"./chunk-5ghw26vq.js";import"./chunk-jtccqpwa.js";import"./chunk-t4dkcf28.js";import"./chunk-5njk2ba0.js";import"./chunk-09412heg.js";import"./chunk-nws4zm4k.js";import"./chunk-s4wcksaw.js";import"./chunk-fxk08je0.js";import"./chunk-sz2nax5v.js";import"./chunk-txs1vxas.js";import"./chunk-v5tzcd49.js";import"./chunk-907zya76.js";import"./chunk-ysqzz2h3.js";import"./chunk-t5q31st4.js";import"./chunk-fez9828r.js";import{wu,Ta,Ch,Eh,$a,To,ns,Ra,Aa,Th,$h,Pa,Ia,Oa,Na}from"./chunk-xn0ebqgw.js";import"./chunk-acwdf0cf.js";import"./chunk-mfbqjkgp.js";import"./chunk-cww1zk8y.js";import"./chunk-5x8q6e1q.js";import"./chunk-he9dzchk.js";import"./chunk-ks0dwtp0.js";var m=new Map,d=new Map;function R(t,e){let n=e?.id||E(t),r=I(t),a=m.get(n);if(a&&a.hash===r)return a;let i=M(t),s=L(t),o=W(t),c=O(i),{staticParts:p,dynamicParts:l}=A(i),f=_(t),g={id:n,hash:r,tree:i,scripts:s,styles:o,staticParts:p,dynamicParts:l,dependencies:f,metadata:c};return m.set(n,g),g}async function Q(t,e={},n={}){let r=performance.now();if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`,c=d.get(o);if(c&&Date.now()-c.timestamp<(n.cacheTTL||60000))return{html:c.html,styles:t.styles.join(`
2
+ import"./chunk-ynnd6nnt.js";import{Eo,Ca,Ea}from"./chunk-2xf323h9.js";import"./chunk-rqjskxpw.js";import"./chunk-eg2p1cyw.js";import"./chunk-0wms5teg.js";import"./chunk-xppm4cs4.js";import"./chunk-46t924aw.js";import"./chunk-gpkxphqz.js";import"./chunk-jtccqpwa.js";import"./chunk-t4dkcf28.js";import"./chunk-rtsshvpt.js";import"./chunk-09412heg.js";import"./chunk-nws4zm4k.js";import"./chunk-0ey7kc6t.js";import"./chunk-8vkywnpx.js";import"./chunk-c7qej674.js";import"./chunk-shnw9geh.js";import"./chunk-f2zgh4xr.js";import"./chunk-63sqdcr6.js";import"./chunk-88a7qaw8.js";import"./chunk-t5q31st4.js";import"./chunk-fez9828r.js";import{wu,Ta,Ch,Eh,$a,To,ns,Ra,Aa,Th,$h,Pa,Ia,Oa,Na}from"./chunk-1k12cc65.js";import"./chunk-jmshgw0t.js";import"./chunk-xa2qfe51.js";import"./chunk-cww1zk8y.js";import"./chunk-0zgxxhvs.js";import"./chunk-he9dzchk.js";import"./chunk-xr9rf0e6.js";var m=new Map,d=new Map;function R(t,e){let n=e?.id||E(t),r=I(t),a=m.get(n);if(a&&a.hash===r)return a;let i=M(t),s=L(t),o=W(t),c=O(i),{staticParts:p,dynamicParts:l}=A(i),f=_(t),g={id:n,hash:r,tree:i,scripts:s,styles:o,staticParts:p,dynamicParts:l,dependencies:f,metadata:c};return m.set(n,g),g}async function Q(t,e={},n={}){let r=performance.now();if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`,c=d.get(o);if(c&&Date.now()-c.timestamp<(n.cacheTTL||60000))return{html:c.html,styles:t.styles.join(`
3
3
  `),scripts:t.scripts.join(`
4
4
  `),metadata:{renderTime:0,cacheHit:!0,totalSize:c.html.length,componentCount:t.metadata.componentCount}}}let a;if(n.streaming)a=await H(t.tree,e);else a=h(t.tree,e);let i;if(n.hydrate){let o=j(a,t,e);a=o.html,i=o.data}if(n.minify)a=D(a);if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`;d.set(o,{html:a,timestamp:Date.now()})}let s=performance.now()-r;return{html:a,styles:t.styles.join(`
5
5
  `),scripts:t.scripts.join(`
@@ -0,0 +1,43 @@
1
+ import type { NativeAccessoryMenuItem, NativeTabAccessory } from './runtime/craft';
2
+ /**
3
+ * The floating actions of a screen, or of the whole app, in the order they
4
+ * read: top to bottom in a vertical group, leading to trailing otherwise.
5
+ *
6
+ * It answers with the `tabAccessory` a host draws them from, for
7
+ * `craft.navigation.setChrome` (every screen) and `setOptions` (one screen);
8
+ * no actions answers `null`, which takes the group away.
9
+ *
10
+ * ```ts
11
+ * craft.navigation.setChrome({
12
+ * tabAccessory: floatingActions([
13
+ * { path: '/add', label: 'Add', symbol: 'plus', menu: [{ path: '/workouts/new', title: 'Workout', symbol: 'dumbbell' }] },
14
+ * { path: '/messages', label: 'Messages', symbol: 'message.fill', badge: unread },
15
+ * ]),
16
+ * })
17
+ * ```
18
+ *
19
+ * The host's group has one primary action, the last: it alone shows a badge,
20
+ * and it always opens its path. A badge or a menu anywhere else is a mistake
21
+ * in the list rather than something to draw differently, so it is refused.
22
+ */
23
+ export declare function floatingActions(actions: ReadonlyArray<NativeFloatingAction | null | undefined | false>, layout?: NativeFloatingActionsLayout): NativeTabAccessory | null;
24
+ /** The most actions one group holds. */
25
+ export declare const MAX_FLOATING_ACTIONS: 3;
26
+ /**
27
+ * One floating action: a round control over the screen that opens a path of
28
+ * the app, or a short menu of them. Named for what it does (`label`), drawn
29
+ * as a symbol.
30
+ */
31
+ export declare interface NativeFloatingAction {
32
+ path: string
33
+ label: string
34
+ symbol: string
35
+ accessibilityLabel?: string
36
+ badge?: string | number | null
37
+ menu?: NativeAccessoryMenuItem[]
38
+ }
39
+ /**
40
+ * `vertical` and `horizontal` join the actions in one capsule of glass, as the
41
+ * map controls in Maps are joined; `separate` keeps a round control each.
42
+ */
43
+ export type NativeFloatingActionsLayout = 'vertical' | 'horizontal' | 'separate';