@stacksjs/stx 0.2.827 → 0.2.832

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 (83) hide show
  1. package/dist/{chunk-nxnkd48v.js → chunk-0cwn420q.js} +1 -1
  2. package/dist/{chunk-kh2n3zqa.js → chunk-27r7e2pv.js} +1 -1
  3. package/dist/{chunk-a7ewznxk.js → chunk-32xv3q66.js} +1 -1
  4. package/dist/chunk-39k5bfmk.js +2 -0
  5. package/dist/{chunk-7amk61bt.js → chunk-44wcgf44.js} +1 -1
  6. package/dist/{chunk-b3nv89wq.js → chunk-5hm3aq74.js} +1 -1
  7. package/dist/{chunk-5phdmpa7.js → chunk-5jkx1t6c.js} +4 -4
  8. package/dist/{chunk-bh7v78je.js → chunk-6cayjtgq.js} +1 -1
  9. package/dist/{chunk-ret52ds0.js → chunk-6m58mesb.js} +3 -3
  10. package/dist/{chunk-3zfras5s.js → chunk-7b3wjek8.js} +1 -1
  11. package/dist/{chunk-fr9e8kb9.js → chunk-7jazxycb.js} +1 -1
  12. package/dist/{chunk-y6nz6bk2.js → chunk-7kzmfpcf.js} +1 -1
  13. package/dist/{chunk-48z7tg83.js → chunk-7qgegnxh.js} +1 -1
  14. package/dist/{chunk-mfebs2s2.js → chunk-7zzz8r0d.js} +1 -1
  15. package/dist/{chunk-kfkbqwyf.js → chunk-8ew4a7vy.js} +1 -1
  16. package/dist/chunk-8hhkqfb7.js +3 -0
  17. package/dist/{chunk-543yvntm.js → chunk-8nf8244n.js} +1 -1
  18. package/dist/chunk-8q6qp36z.js +2 -0
  19. package/dist/{chunk-ayk94a19.js → chunk-8z2g630g.js} +1 -1
  20. package/dist/{chunk-3x3zcfxp.js → chunk-9fw647px.js} +5 -5
  21. package/dist/chunk-9maxchrj.js +2 -0
  22. package/dist/{chunk-3esj6tb8.js → chunk-9pjmza44.js} +2 -2
  23. package/dist/{chunk-ftw0a5dm.js → chunk-9vvvp4g3.js} +1 -1
  24. package/dist/{chunk-b92vzax2.js → chunk-a5kd0r75.js} +1 -1
  25. package/dist/{chunk-kmqcvpz2.js → chunk-any1jha4.js} +2 -2
  26. package/dist/chunk-asf2d722.js +2 -0
  27. package/dist/{chunk-qm6epp9h.js → chunk-asqznjzg.js} +1 -1
  28. package/dist/{chunk-w9gpscjf.js → chunk-atbzg7vw.js} +1 -1
  29. package/dist/{chunk-se3fqsxk.js → chunk-b5rxc6p1.js} +1 -1
  30. package/dist/chunk-bkf2z7zt.js +2 -0
  31. package/dist/{chunk-8yy8qrcv.js → chunk-cnf9r95x.js} +1 -1
  32. package/dist/{chunk-e8a6s6xs.js → chunk-d6qkykt6.js} +1 -1
  33. package/dist/chunk-dafwt7tk.js +2 -0
  34. package/dist/{chunk-xtn0hnmz.js → chunk-dnx152fg.js} +1 -1
  35. package/dist/{chunk-ng5revck.js → chunk-eaeyemgp.js} +2 -2
  36. package/dist/{chunk-5r63bv4g.js → chunk-ec45m14s.js} +1 -1
  37. package/dist/{chunk-2mrdtxfy.js → chunk-egmxf96v.js} +1 -1
  38. package/dist/{chunk-rbq4dn2a.js → chunk-f9yqvq9t.js} +1 -1
  39. package/dist/{chunk-m973xh3a.js → chunk-fgreefqz.js} +4 -4
  40. package/dist/{chunk-c7ybxv8x.js → chunk-gj33636j.js} +1 -1
  41. package/dist/{chunk-t96229jm.js → chunk-hdedvppk.js} +1 -1
  42. package/dist/chunk-hmnzsdc9.js +2 -0
  43. package/dist/{chunk-c8vza3p0.js → chunk-hn3qmkx2.js} +1 -1
  44. package/dist/{chunk-4d8ep00w.js → chunk-hr4rd0rr.js} +4 -4
  45. package/dist/{chunk-s6399qe7.js → chunk-jxjmbwb9.js} +1 -1
  46. package/dist/{chunk-7z2ygy9p.js → chunk-k58rsprz.js} +1 -1
  47. package/dist/{chunk-bh35v908.js → chunk-ke0w29sz.js} +1 -1
  48. package/dist/{chunk-m716f2ga.js → chunk-kmss70d5.js} +1 -1
  49. package/dist/{chunk-s5ejh2yx.js → chunk-kqhq31nh.js} +1 -1
  50. package/dist/{chunk-bwnwv91e.js → chunk-kts0wcxn.js} +1 -1
  51. package/dist/{chunk-717qsbap.js → chunk-nd7z3syn.js} +2 -2
  52. package/dist/{chunk-3g7bjpj6.js → chunk-npk6j7a9.js} +1 -1
  53. package/dist/{chunk-8ta7f5en.js → chunk-q1nbsj9p.js} +1 -1
  54. package/dist/{chunk-12m1qwzd.js → chunk-q2zsy8vk.js} +1 -1
  55. package/dist/chunk-qez22va2.js +2 -0
  56. package/dist/{chunk-tngj0fp6.js → chunk-qm2t1ftx.js} +1 -1
  57. package/dist/{chunk-d9s37xm5.js → chunk-qy6dtm1a.js} +6 -7
  58. package/dist/{chunk-yv1vw0kx.js → chunk-tdq1bq8x.js} +1 -1
  59. package/dist/{chunk-qz82cpyv.js → chunk-v856z21j.js} +2 -2
  60. package/dist/{chunk-qn06sy9j.js → chunk-v88bnrwx.js} +1 -1
  61. package/dist/chunk-wbmh106x.js +2 -0
  62. package/dist/{chunk-tzhs7drk.js → chunk-xwjsbewa.js} +4 -4
  63. package/dist/{chunk-x742wppj.js → chunk-yw9g1ag1.js} +1 -1
  64. package/dist/{chunk-xj3my6b9.js → chunk-zgf3nss0.js} +6 -6
  65. package/dist/{chunk-fqq5qzm0.js → chunk-zt74q4c8.js} +1 -1
  66. package/dist/{chunk-bjvmmsvp.js → chunk-zx85qm3n.js} +2 -2
  67. package/dist/cli.js +8 -8
  68. package/dist/client/signals-authoring-runtime.js +6 -7
  69. package/dist/craft-entry.js +1 -1
  70. package/dist/craft.js +1 -1
  71. package/dist/pwa.js +1 -1
  72. package/dist/ssg.js +2 -2
  73. package/package.json +5 -5
  74. package/dist/chunk-0jhq2kza.js +0 -2
  75. package/dist/chunk-2b1w7py1.js +0 -2
  76. package/dist/chunk-3qx7whh5.js +0 -2
  77. package/dist/chunk-3vsz0vrk.js +0 -2
  78. package/dist/chunk-d2n2zrdg.js +0 -2
  79. package/dist/chunk-fevyb337.js +0 -3
  80. package/dist/chunk-j9aftb7p.js +0 -2
  81. package/dist/chunk-kve27dy3.js +0 -2
  82. package/dist/chunk-pg146fc5.js +0 -2
  83. package/dist/chunk-vxhq8n8y.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{He,Sn,Ws,ki,M}from"./chunk-2qngyyaz.js";import{xn}from"./chunk-yv1vw0kx.js";import{Or,k,pl,ct,Pi,fl}from"./chunk-04z1xyrb.js";import{I}from"./chunk-8y8kgw9s.js";import{T,qs,u,f,Bt,d,K,z,x,Js,Ce,Ue,Ys}from"./chunk-c9mdvpf5.js";import{r,me}from"./chunk-fwktw49p.js";import{g}from"./chunk-0dve54ne.js";import{X}from"./chunk-t59bc7na.js";import rt from"path";import Rt from"process";import{AsyncLocalStorage as Go}from"async_hooks";var mr=new Go;function hn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function hr(e,t){return mr.run(hn(e),t)}async function $r(e,t){let i=mr.getStore();if(!i)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 n=i.pending.get(e);if(n)return n;let a=Promise.resolve().then(t).then((l)=>{let c=JSON.stringify(l,(v,E)=>{if(E===void 0||typeof E==="function"||typeof E==="symbol"||typeof E==="bigint"||typeof E==="number"&&!Number.isFinite(E))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(E&&typeof E==="object"&&!Array.isArray(E)&&Object.getPrototypeOf(E)!==Object.prototype&&Object.getPrototypeOf(E)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return E}),b=JSON.parse(c);return i.values.set(e,b),b}).catch((l)=>{throw i.pending.delete(e),l});return i.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 i=r(e),n=[],a=new Set,l=0,c=0,b=i.length,v=()=>{if(l!==0)return;let E=i.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(E){if(t&&E[1]==="const")return;let P=E[2];if(!a.has(P))n.push(P),a.add(P);return}let A=i.slice(c).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){if(t&&i.slice(c).startsWith("const"))return;A[1].split(",").forEach((P)=>{let B=P.trim();if(!B)return;let L=B.indexOf(":"),G=(L>=0?B.slice(L+1).trim():B).split(/[\s=]/)[0];if(G&&!a.has(G))n.push(G),a.add(G)});return}let O=i.slice(c).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(O){if(t&&i.slice(c).startsWith("const"))return;O[1].split(",").forEach((P)=>{let B=P.trim().replace(/^\.\.\./,"");if(!B)return;let L=B.split(/[\s=]/)[0];if(L&&!a.has(L))n.push(L),a.add(L)});return}if(t)return;let H=i.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let P=H[1];if(!a.has(P))n.push(P),a.add(P);return}let j=i.slice(c).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let P=j[1];if(!a.has(P))n.push(P),a.add(P)}};while(c<b){if(i[c]==="{"){l++,c++;continue}if(i[c]==="}"){l--,c++;continue}if(l===0&&/[a-z]/i.test(i[c])&&(c===0||/\s|[;{}()]/.test(i[c-1])))v();c++}return n.join(", ")}function Ps(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function Yo(e,t=V(e).split(",").map((i)=>i.trim()).filter(Boolean)){let i=new Set(V(e,!0).split(",").map((n)=>n.trim()));return t.map((n)=>i.has(n)?`get ${n}() { return ${n} }, set ${n}(__stxValue_${n}) { ${n} = __stxValue_${n} }`:n).join(", ")}function Is(e,t){let i=`{ ${Yo(e,t)} }`;return V(e).split(",").some((n)=>n.trim()==="__stxLiveBindings")?`Object.defineProperties(${i}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:i}import vt from"fs";import $e 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 Er=new Map;function yr(e,t=!0){let i=Er.get(e);if(t&&i)return i;let n=new Map,a=[$e.join(e,"src"),$e.join(e,"dist"),e];function l(c,b){if(b>6)return;let v;try{v=vt.readdirSync(c,{withFileTypes:!0})}catch{return}for(let E of v){let A=$e.join(c,E.name);if(E.isDirectory()){if(E.name==="node_modules"||E.name.startsWith("."))continue;l(A,b+1)}else if(E.isFile()&&E.name.endsWith(".stx")){let O=E.name.slice(0,-4);if(!n.has(O))n.set(O,A);let H=O.toLowerCase();if(!n.has(H))n.set(H,A);let j=U(O);if(!n.has(j))n.set(j,A)}}}for(let c of a)if(l(c,0),n.size>0)break;if(t)Er.set(e,n);return n}function Os(e,t){if(e.startsWith(".")||e.startsWith("/"))return null;let i=t;while(!0){let n=$e.join(i,"node_modules",e);try{if(vt.statSync(n).isDirectory())return n}catch{}let a=$e.dirname(i);if(a===i)return null;i=a}}function Ns(e,t,i={}){return[$e.resolve($e.dirname(t),`${e}.stx`),$e.resolve($e.dirname(t),e),$e.resolve(i.componentsDir||"components",`${e}.stx`),$e.resolve(i.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function Rr(e){let t=e.endsWith(".stx")?e.slice(0,-4):e,i=t.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),n=U(t);return[t,i,n]}function ii(e,t){let[i,n,a]=Rr(e);for(let l of[i,i.toLowerCase(),n,a]){let c=t?.__importedComponents?.get(l);if(c!==void 0)return c}}function Qo(e,t){let i=t?$e.resolve(t):void 0,n=$e.dirname($e.resolve(e));for(;;){if(vt.existsSync($e.join(n,"package.json")))return i&&n===i?void 0:n;let a=$e.dirname(n);if(a===n)return;n=a}}var ea=["src/ui","src/components","components","dist"];function us(e,t){let i=$e.resolve(e);if(!t&&!i.split($e.sep).includes("node_modules"))return[];let n=Qo(i,t);if(!n)return[];let a=[];try{let b=JSON.parse(vt.readFileSync($e.join(n,"package.json"),"utf8")).stx?.components;if(Array.isArray(b))a=b.filter((v)=>typeof v==="string")}catch{}let l=a.length?a:ea;return[$e.dirname($e.resolve(e)),...l.map((c)=>$e.resolve(n,c))]}function*ai(e,t,i={},n){let a=Rr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield $e.resolve($e.dirname(t),`${a[0]}.stx`);return}let l=[...new Set(a.map((v)=>`${v}.stx`))],c=i.projectRoot||process.cwd(),b=[...us(t,i.projectRoot),...n?.__originalFilePath?[$e.join($e.dirname(n.__originalFilePath),"components")]:[],...i.componentsDir?[i.componentsDir]:[],$e.join($e.dirname(t),"components"),$e.resolve(c,"src/components"),$e.resolve(c,"components"),...import.meta.dir?[$e.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(b)){for(let E of l)yield $e.join(v,E);try{for(let E of vt.readdirSync(v,{withFileTypes:!0}))if(E.isDirectory())for(let A of l)yield $e.join(v,E.name,A)}catch{}}}function Ar(e,t,i={},n){let a=ii(e,n);if(a!==void 0)return a;for(let l of ai(e,t,i,n))try{if(vt.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function Ms(e,t=[],i={}){let n=new Set([...e].map((E)=>E.replace(/[-_]/g,"").toLowerCase()));if(!n.has("src")||!n.has("alt")&&!n.has("decorative"))return!1;let a=new Map(Object.entries(i).map(([E,A])=>[E.replace(/[-_]/g,"").toLowerCase(),A])),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(["source","resizemode","defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((E)=>n.has(E)))return!1;if([...t].some((E)=>!["load","error"].includes(E.replace(/^@/,"").split(".")[0].toLowerCase())))return!1;return["fit","objectfit","position","objectposition","rounded","aspectratio","zoomonhover","sources","webpsrc","webpsrcset"].some((E)=>n.has(E))}import Jn from"fs";import ae from"path";import ht from"path";import Kt from"fs";var ta=new Set(["touchstart","touchmove","wheel","mousewheel"]);function fs(e,t){if(t.passive)return!0;if(t.prevent||t.nonpassive)return!1;return ta.has(e.toLowerCase())}var Tr=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"]),Ir={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"},na=new Set(["ctrl","alt","shift","meta"]),jr={left:0,middle:1,right:2};function Pr(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 i of e){let n=i.toLowerCase();if(n==="prevent")t.prevent=!0;else if(n==="stop")t.stop=!0;else if(n==="once")t.once=!0;else if(n==="capture")t.capture=!0;else if(n==="self")t.self=!0;else if(n==="passive")t.passive=!0;else if(n==="nonpassive")t.nonpassive=!0;else if(na.has(n))t.systemKeys.push(n);else if(n in jr)t.mouse=n;else if(n in Ir||/^[a-z]$/.test(n))t.keys.push(Ir[n]||n.toUpperCase());else if(n.startsWith("debounce")){let a=n.match(/debounce(?:\.(\d+))?/);t.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(n.startsWith("throttle")){let a=n.match(/throttle(?:\.(\d+))?/);t.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return t}function Dr(e,t=""){let i=[],n=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=a.exec(e))!==null){let[c,b,v]=l,E=l.index,A=E+c.length,O=`__stx_evt_${t}${n++}`,H=[],j=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,P;while((P=j.exec(v))!==null){let[,L,F]=P,G=L.split("."),D=G[0];if(!Tr.has(D))continue;H.push({attribute:`@${L}`,event:D,handler:F,modifiers:Pr(G.slice(1)),elementId:O})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((P=B.exec(v))!==null){let[,L,F]=P,G=L.split("."),D=G[0];if(!Tr.has(D))continue;H.push({attribute:`@${L}`,event:D,handler:F,modifiers:Pr(G.slice(1)),elementId:O})}if(H.length>0)i.push({originalTag:c,elementId:O,events:H,startIndex:E,endIndex:A})}return i}function sa(e){let t=[],{modifiers:i}=e;if(i.self)t.push("if ($event.target !== $el) return");for(let n of i.systemKeys)t.push(`if (!$event.${n}Key) return`);if(i.keys.length>0){let n=i.keys.map((a)=>`$event.key === '${a}'`).join(" || ");t.push(`if (!(${n})) return`)}if(i.mouse!==null){let n=jr[i.mouse];t.push(`if ($event.button !== ${n}) return`)}if(i.prevent)t.push("$event.preventDefault()");if(i.stop)t.push("$event.stopPropagation()");return t.join("; ")}function ra(e,t){let i=e;if(t.debounce!==null)i=`__stx_debounce(() => { ${i} }, ${t.debounce})`;else if(t.throttle!==null)i=`__stx_throttle(() => { ${i} }, ${t.throttle})`;return i}function ps(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 ia(e){let{modifiers:t}=e,i=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),n=sa(e),a=ra(ps(e.handler),t),l=[];if(t.once)l.push("once: true");if(t.capture)l.push("capture: true");if(fs(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,Sn,Ws,ki,M}from"./chunk-2qngyyaz.js";import{xn}from"./chunk-tdq1bq8x.js";import{Or,k,pl,ct,Pi,fl}from"./chunk-04z1xyrb.js";import{I}from"./chunk-8y8kgw9s.js";import{T,qs,u,f,Bt,d,K,z,x,Js,Ce,Ue,Ys}from"./chunk-c9mdvpf5.js";import{r,me}from"./chunk-fwktw49p.js";import{g}from"./chunk-0dve54ne.js";import{X}from"./chunk-t59bc7na.js";import rt from"path";import Rt from"process";import{AsyncLocalStorage as Go}from"async_hooks";var mr=new Go;function hn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function hr(e,t){return mr.run(hn(e),t)}async function $r(e,t){let i=mr.getStore();if(!i)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 n=i.pending.get(e);if(n)return n;let a=Promise.resolve().then(t).then((l)=>{let c=JSON.stringify(l,(v,E)=>{if(E===void 0||typeof E==="function"||typeof E==="symbol"||typeof E==="bigint"||typeof E==="number"&&!Number.isFinite(E))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(E&&typeof E==="object"&&!Array.isArray(E)&&Object.getPrototypeOf(E)!==Object.prototype&&Object.getPrototypeOf(E)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return E}),b=JSON.parse(c);return i.values.set(e,b),b}).catch((l)=>{throw i.pending.delete(e),l});return i.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 i=r(e),n=[],a=new Set,l=0,c=0,b=i.length,v=()=>{if(l!==0)return;let E=i.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(E){if(t&&E[1]==="const")return;let P=E[2];if(!a.has(P))n.push(P),a.add(P);return}let A=i.slice(c).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){if(t&&i.slice(c).startsWith("const"))return;A[1].split(",").forEach((P)=>{let B=P.trim();if(!B)return;let L=B.indexOf(":"),G=(L>=0?B.slice(L+1).trim():B).split(/[\s=]/)[0];if(G&&!a.has(G))n.push(G),a.add(G)});return}let O=i.slice(c).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(O){if(t&&i.slice(c).startsWith("const"))return;O[1].split(",").forEach((P)=>{let B=P.trim().replace(/^\.\.\./,"");if(!B)return;let L=B.split(/[\s=]/)[0];if(L&&!a.has(L))n.push(L),a.add(L)});return}if(t)return;let H=i.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let P=H[1];if(!a.has(P))n.push(P),a.add(P);return}let j=i.slice(c).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let P=j[1];if(!a.has(P))n.push(P),a.add(P)}};while(c<b){if(i[c]==="{"){l++,c++;continue}if(i[c]==="}"){l--,c++;continue}if(l===0&&/[a-z]/i.test(i[c])&&(c===0||/\s|[;{}()]/.test(i[c-1])))v();c++}return n.join(", ")}function Ps(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function Yo(e,t=V(e).split(",").map((i)=>i.trim()).filter(Boolean)){let i=new Set(V(e,!0).split(",").map((n)=>n.trim()));return t.map((n)=>i.has(n)?`get ${n}() { return ${n} }, set ${n}(__stxValue_${n}) { ${n} = __stxValue_${n} }`:n).join(", ")}function Is(e,t){let i=`{ ${Yo(e,t)} }`;return V(e).split(",").some((n)=>n.trim()==="__stxLiveBindings")?`Object.defineProperties(${i}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:i}import vt from"fs";import $e 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 Er=new Map;function yr(e,t=!0){let i=Er.get(e);if(t&&i)return i;let n=new Map,a=[$e.join(e,"src"),$e.join(e,"dist"),e];function l(c,b){if(b>6)return;let v;try{v=vt.readdirSync(c,{withFileTypes:!0})}catch{return}for(let E of v){let A=$e.join(c,E.name);if(E.isDirectory()){if(E.name==="node_modules"||E.name.startsWith("."))continue;l(A,b+1)}else if(E.isFile()&&E.name.endsWith(".stx")){let O=E.name.slice(0,-4);if(!n.has(O))n.set(O,A);let H=O.toLowerCase();if(!n.has(H))n.set(H,A);let j=U(O);if(!n.has(j))n.set(j,A)}}}for(let c of a)if(l(c,0),n.size>0)break;if(t)Er.set(e,n);return n}function Os(e,t){if(e.startsWith(".")||e.startsWith("/"))return null;let i=t;while(!0){let n=$e.join(i,"node_modules",e);try{if(vt.statSync(n).isDirectory())return n}catch{}let a=$e.dirname(i);if(a===i)return null;i=a}}function Ns(e,t,i={}){return[$e.resolve($e.dirname(t),`${e}.stx`),$e.resolve($e.dirname(t),e),$e.resolve(i.componentsDir||"components",`${e}.stx`),$e.resolve(i.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function Rr(e){let t=e.endsWith(".stx")?e.slice(0,-4):e,i=t.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),n=U(t);return[t,i,n]}function ii(e,t){let[i,n,a]=Rr(e);for(let l of[i,i.toLowerCase(),n,a]){let c=t?.__importedComponents?.get(l);if(c!==void 0)return c}}function Qo(e,t){let i=t?$e.resolve(t):void 0,n=$e.dirname($e.resolve(e));for(;;){if(vt.existsSync($e.join(n,"package.json")))return i&&n===i?void 0:n;let a=$e.dirname(n);if(a===n)return;n=a}}var ea=["src/ui","src/components","components","dist"];function us(e,t){let i=$e.resolve(e);if(!t&&!i.split($e.sep).includes("node_modules"))return[];let n=Qo(i,t);if(!n)return[];let a=[];try{let b=JSON.parse(vt.readFileSync($e.join(n,"package.json"),"utf8")).stx?.components;if(Array.isArray(b))a=b.filter((v)=>typeof v==="string")}catch{}let l=a.length?a:ea;return[$e.dirname($e.resolve(e)),...l.map((c)=>$e.resolve(n,c))]}function*ai(e,t,i={},n){let a=Rr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield $e.resolve($e.dirname(t),`${a[0]}.stx`);return}let l=[...new Set(a.map((v)=>`${v}.stx`))],c=i.projectRoot||process.cwd(),b=[...us(t,i.projectRoot),...n?.__originalFilePath?[$e.join($e.dirname(n.__originalFilePath),"components")]:[],...i.componentsDir?[i.componentsDir]:[],$e.join($e.dirname(t),"components"),$e.resolve(c,"src/components"),$e.resolve(c,"components"),...import.meta.dir?[$e.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(b)){for(let E of l)yield $e.join(v,E);try{for(let E of vt.readdirSync(v,{withFileTypes:!0}))if(E.isDirectory())for(let A of l)yield $e.join(v,E.name,A)}catch{}}}function Ar(e,t,i={},n){let a=ii(e,n);if(a!==void 0)return a;for(let l of ai(e,t,i,n))try{if(vt.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function Ms(e,t=[],i={}){let n=new Set([...e].map((E)=>E.replace(/[-_]/g,"").toLowerCase()));if(!n.has("src")||!n.has("alt")&&!n.has("decorative"))return!1;let a=new Map(Object.entries(i).map(([E,A])=>[E.replace(/[-_]/g,"").toLowerCase(),A])),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(["source","resizemode","defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((E)=>n.has(E)))return!1;if([...t].some((E)=>!["load","error"].includes(E.replace(/^@/,"").split(".")[0].toLowerCase())))return!1;return["fit","objectfit","position","objectposition","rounded","aspectratio","zoomonhover","sources","webpsrc","webpsrcset"].some((E)=>n.has(E))}import Jn from"fs";import ae from"path";import ht from"path";import Kt from"fs";var ta=new Set(["touchstart","touchmove","wheel","mousewheel"]);function fs(e,t){if(t.passive)return!0;if(t.prevent||t.nonpassive)return!1;return ta.has(e.toLowerCase())}var Tr=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"]),Ir={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"},na=new Set(["ctrl","alt","shift","meta"]),jr={left:0,middle:1,right:2};function Pr(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 i of e){let n=i.toLowerCase();if(n==="prevent")t.prevent=!0;else if(n==="stop")t.stop=!0;else if(n==="once")t.once=!0;else if(n==="capture")t.capture=!0;else if(n==="self")t.self=!0;else if(n==="passive")t.passive=!0;else if(n==="nonpassive")t.nonpassive=!0;else if(na.has(n))t.systemKeys.push(n);else if(n in jr)t.mouse=n;else if(n in Ir||/^[a-z]$/.test(n))t.keys.push(Ir[n]||n.toUpperCase());else if(n.startsWith("debounce")){let a=n.match(/debounce(?:\.(\d+))?/);t.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(n.startsWith("throttle")){let a=n.match(/throttle(?:\.(\d+))?/);t.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return t}function Dr(e,t=""){let i=[],n=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=a.exec(e))!==null){let[c,b,v]=l,E=l.index,A=E+c.length,O=`__stx_evt_${t}${n++}`,H=[],j=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,P;while((P=j.exec(v))!==null){let[,L,F]=P,G=L.split("."),D=G[0];if(!Tr.has(D))continue;H.push({attribute:`@${L}`,event:D,handler:F,modifiers:Pr(G.slice(1)),elementId:O})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((P=B.exec(v))!==null){let[,L,F]=P,G=L.split("."),D=G[0];if(!Tr.has(D))continue;H.push({attribute:`@${L}`,event:D,handler:F,modifiers:Pr(G.slice(1)),elementId:O})}if(H.length>0)i.push({originalTag:c,elementId:O,events:H,startIndex:E,endIndex:A})}return i}function sa(e){let t=[],{modifiers:i}=e;if(i.self)t.push("if ($event.target !== $el) return");for(let n of i.systemKeys)t.push(`if (!$event.${n}Key) return`);if(i.keys.length>0){let n=i.keys.map((a)=>`$event.key === '${a}'`).join(" || ");t.push(`if (!(${n})) return`)}if(i.mouse!==null){let n=jr[i.mouse];t.push(`if ($event.button !== ${n}) return`)}if(i.prevent)t.push("$event.preventDefault()");if(i.stop)t.push("$event.stopPropagation()");return t.join("; ")}function ra(e,t){let i=e;if(t.debounce!==null)i=`__stx_debounce(() => { ${i} }, ${t.debounce})`;else if(t.throttle!==null)i=`__stx_throttle(() => { ${i} }, ${t.throttle})`;return i}function ps(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 ia(e){let{modifiers:t}=e,i=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),n=sa(e),a=ra(ps(e.handler),t),l=[];if(t.once)l.push("once: true");if(t.capture)l.push("capture: true");if(fs(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('${i}');
5
5
  if (!$el) return;
@@ -112,7 +112,7 @@ else {
112
112
  `)}
113
113
  })();
114
114
  </script>`}function oa(e,t=""){let i=Dr(e,t);if(i.length===0)return{template:e,bindings:[]};let n=e,a=[];for(let l=i.length-1;l>=0;l--){let c=i[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 E of c.events)E.elementId=v[1]}for(let v of c.events){let E=v.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),A=new RegExp(`\\s*${E}\\s*=\\s*"[^"]*"`,"g"),O=new RegExp(`\\s*${E}\\s*=\\s*'[^']*'`,"g");b=b.replace(A,""),b=b.replace(O,"")}n=n.slice(0,c.startIndex)+b+n.slice(c.endIndex),a.push(...c.events)}return{template:n,bindings:a}}function Mr(e){let t=e.$uid;return typeof t==="string"&&t?`${t}_`:""}function Ac(e,t,i){if(fl(e))return e;if(t.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:b,bindings:v}=oa(e,Mr(t)),E=t.__stx_event_bindings||[];return t.__stx_event_bindings=[...E,...v],b}let n=Dr(e,Mr(t));if(n.length===0)return e;let a=e;for(let b=n.length-1;b>=0;b--){let v=n[b],E=v.originalTag;if(!E.includes(" id="))E=E.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${v.elementId}"`);else{let A=E.match(/id=["']([^"']+)["']/);if(A)for(let O of v.events)O.elementId=A[1]}for(let A of v.events){let O=A.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),H=new RegExp(`\\s*${O}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${O}\\s*=\\s*'[^']*'`,"g");E=E.replace(H,""),E=E.replace(j,"")}a=a.slice(0,v.startIndex)+E+a.slice(v.endIndex)}let l=ci(n.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 Nr(e,t){let i=new Set;for(let n of e.split(",")){let a=n.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))i.add(a)}return i}function At(e,t){let i=r(e),{depths:n,balanced:a}=me(i),l=(b)=>!a||n[b]===0,c=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${t}\\b)`,"g");for(let b of i.matchAll(c)){let v=(b.index??0)+b[0].length-b[1].length;if(l(v))return!0}for(let b of i.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(b.index??0)&&Nr(b[1],!0).has(t))return!0;for(let b of i.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(b.index??0)&&Nr(b[1],!1).has(t))return!0;return!1}var Lr=new T(32,{maxBytes:2097152,sizeOf:(e)=>e.code.length*4}),dt=/^[A-Za-z_$][\w$]*$/,aa=new Set(["if","for","while","switch","with"]),zr=["(","[","{"],Br=[")","]","}"],ca=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function la(e){let t=r(e),i=[];for(let n of t.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=n.index??0;i.push({text:n[0],start:a,end:a+n[0].length})}return{code:t,tokens:i}}function ds(e){let t=Lr.get(e);if(t)return t;let{code:i,tokens:n}=la(e),a=new Map,l=[];for(let L=0;L<n.length;L++){let F=n[L].text;if(["(","[","{"].includes(F))l.push(L);else if([")","]","}"].includes(F)){let G=l.at(-1);if(G!==void 0&&["()","[]","{}"].includes(n[G].text+F))l.pop(),a.set(G,L),a.set(L,G)}}function c(L,F){let G=[],D=L;for(let ee=L;ee<F;ee++){if(["(","[","{"].includes(n[ee].text)&&(a.get(ee)??F)<F){ee=a.get(ee);continue}if(n[ee].text===",")G.push([D,ee]),D=ee+1}return G.push([D,F]),G}let b=[];function v(L,F,G,D=!1){if(n[L]?.text==="...")L++;if(L>=F)return;let ee=n[L].text;if(dt.test(ee)){if(G.add(ee),G===O)b.push({name:ee,token:L,functionScoped:D});return}if(ee!=="{"&&ee!=="[")return;let ne=a.get(L);if(ne===void 0||ne>=F)return;for(let[te,le]of c(L+1,ne)){let he=te;if(ee==="{")for(let ue=te;ue<le;ue++){if(n[ue].text===":"){he=ue+1;break}if(n[ue].text==="=")break;if(["(","[","{"].includes(n[ue].text)&&a.has(ue))ue=a.get(ue)}v(he,le,G,D)}}function E(L,F){let G=new Set;for(let[D,ee]of c(L,F))v(D,ee,G);return G}function A(L){let F=L;for(;F<n.length;F++){let G=n[F].text;if(["(","[","{"].includes(G)&&a.has(F)){F=a.get(F);continue}if([",",";",")","]","}"].includes(G))break}return n[Math.max(L,F-1)]?.end??i.length}let O=new Set,H=[];for(let L=0;L<n.length;L++)if(n[L].text==="=>"){let F=L-1,G=F,D;if(n[F]?.text===")"&&a.has(F))G=a.get(F),D=E(G+1,F);else if(n[F]&&dt.test(n[F].text))D=new Set([n[F].text]);else continue;let ee=L+1,ne=n[ee]?.text==="{"&&a.has(ee)?n[a.get(ee)].end:A(ee);H.push({start:n[G].start,end:ne,bodyStart:n[ee]?.start??ne,functionBody:!0,names:D})}else if(n[L].text==="("&&a.has(L)){let F=n[L-1]?.text;if(!F||aa.has(F)||!dt.test(F)&&F!=="*"&&F!=="]")continue;let G=a.get(L),D=G+1;if(n[D]?.text===":"){D++;while(D<n.length&&!["{","=>",";","="].includes(n[D].text))D++}if(n[D]?.text!=="{"||!a.has(D))continue;H.push({start:n[L].start,end:n[a.get(D)].end,bodyStart:n[D].start,functionBody:F!=="catch",names:E(L+1,G)})}function j(L){let F=L;for(;F<n.length;F++){let G=n[F].text;if(zr.includes(G)&&a.has(F)){F=a.get(F);continue}if(G===";"||Br.includes(G))break;let D=n[F-1];if(F>L&&ca.has(G)&&D.text!==".")break;if(F>L&&/[\n\r]/.test(i.slice(D.end,n[F].start))&&(/^[\w$]+$/.test(D.text)||Br.includes(D.text)||['"',"'","`"].includes(D.text))&&dt.test(G)&&!["in","of","instanceof"].includes(G))break}return F}let P=[];for(let L=0;L<n.length;L++){if(n[L].text!=="for")continue;let F=n[L+1]?.text==="await"?L+2:L+1;if(n[F]?.text!=="("||!a.has(F))continue;let G=a.get(F),D=G+1,ee=n[D]?.text==="{"&&a.has(D)?a.get(D):j(D),ne=n[ee]?.text===";"||n[ee]?.text==="}"?n[ee].end:n[Math.max(D,ee-1)]?.end??i.length;P.push({headStart:F,headEnd:G,start:n[F].start,end:ne})}for(let L=0;L<n.length;L++){let F=n[L].text,G=n[L-1]?.text;if(G==="."||n[L+1]?.text===":")continue;if(G==="as"||G==="<")continue;if(F==="const"||F==="let"||F==="var"){let D=j(L+1),ee=L+1,ne=!1,te=!1,le=0;for(let he=L+1;he<=D;he++){let ue=n[he]?.text;if(he<D&&zr.includes(ue)&&a.has(he)&&a.get(he)<D){he=a.get(he);continue}if(he<D&&ue===":"&&!te)ne=!0;else if(he<D&&ue==="="&&le===0)ne=!1,te=!0;else if(he<D&&ne&&ue==="<")le++;else if(he<D&&ne&&ue===">"&&le>0)le--;else if(he===D||ue===","&&le===0)v(ee,he,O,F==="var"),ee=he+1,ne=!1,te=!1}}else if(F==="function"||F==="class"){let D=L+1;if(n[D]?.text==="*")D++;if(n[D]&&dt.test(n[D].text)&&n[D].text!=="extends")O.add(n[D].text),b.push({name:n[D].text,token:D})}else if(F==="import"){let D=L+1;if(n[D]?.text==="*"&&n[D+1]?.text==="as")D+=2;let ee=n[D]?.text;if(ee&&dt.test(ee)&&ee!=="type"&&n[D+1]?.text!=="("&&n[D+1]?.text!==".")O.add(ee),b.push({name:ee,token:D,file:!0});let ne=n[D]?.text==="{"?D:n[D+1]?.text===","&&n[D+2]?.text==="{"?D+2:-1;if(ne!==-1&&a.has(ne)){let te=a.get(ne);for(let[le,he]of c(ne+1,te)){let ue=he-1;while(ue>=le&&!dt.test(n[ue].text))ue--;if(ue>=le&&n[ue].text!=="type")b.push({name:n[ue].text,token:ue,file:!0})}}}}let B={code:i,scopes:H,loops:P,declarations:O,sites:b,tokens:n,pairs:a};return Lr.set(e,B),B}function Zt(e){let t=ds(e);return{code:t.code,shadows:(i,n)=>t.scopes.some((a)=>n>=a.start&&n<a.end&&a.names.has(i))}}function In(e){return new Set(ds(e).declarations)}function Oe(e,t){let{scopes:i,loops:n,sites:a,tokens:l,pairs:c}=ds(e),b=Array.from({length:l.length},()=>-1),v=[];for(let j=0;j<l.length;j++){b[j]=v.length?v[v.length-1]:-1;let P=l[j].text;if(P==="{"&&c.has(j))v.push(j);else if(P==="}"&&v.length&&c.get(j)===v[v.length-1])v.pop()}let E=new Set,A=new Map;for(let j of a){if(!t.has(j.name))continue;E.add(j.token);let P=j.file?-1:b[j.token],B=P===-1?[0,Number.POSITIVE_INFINITY]:[l[P].start,l[c.get(P)].end];if(j.functionScoped){let F=l[j.token].start,G=i.filter((D)=>D.functionBody&&F>=D.bodyStart&&F<D.end).sort((D,ee)=>D.end-D.bodyStart-(ee.end-ee.bodyStart))[0];B=G?[G.bodyStart,G.end]:[0,Number.POSITIVE_INFINITY]}else if(!j.file){let F=n.filter((G)=>j.token>G.headStart&&j.token<G.headEnd).sort((G,D)=>G.headEnd-G.headStart-(D.headEnd-D.headStart))[0];if(F)B=[F.start,F.end]}let L=A.get(j.name);if(L)L.push(B);else A.set(j.name,[B])}let O=new Set;for(let j=0;j<l.length;j++){if(l[j].text!=="import"||l[j-1]?.text===".")continue;let P=j+1;if(l[P]?.text==="type")P++;if(l[P]&&dt.test(l[P].text)&&l[P+1]?.text===",")P+=2;if(l[P]?.text==="{"&&c.has(P))for(let B=P+1;B<c.get(P);B++)O.add(B)}let H=new Set;for(let j=0;j<l.length;j++){let P=l[j].text;if(!t.has(P)||H.has(P)||E.has(j)||O.has(j))continue;let B=l[j-1]?.text;if(B==="#"||B==="."&&l[j-2]?.text!=="..")continue;if(l[j+1]?.text===":"&&(B==="{"||B===","))continue;let L=l[j].start;if(A.get(P)?.some(([F,G])=>L>=F&&L<G))continue;if(i.some((F)=>L>=F.start&&L<F.end&&F.names.has(P)))continue;H.add(P)}return H}var Ie="0.2.827";var Wr=Symbol.for(`stx.lazy-module-promises.${Ie}`);function fa(){let e=globalThis;return e[Wr]??=new Map,e[Wr]}function o(e,t){let i=fa(),n=`${import.meta.url}\x00${e}`,a=i.get(n);if(a)return a;let l=t();return i.set(n,l),l.catch(()=>{if(i.get(n)===l)i.delete(n)}),l}var pa=/<\/(script)/gi;function pn(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(pa,"<\\/$1")}import Fr from"fs";var Vr=[];function w(e){let t=new T(e);return Vr.push(t),t}function Pc(){for(let e of Vr)e.clear()}function S(e,...t){return`${t.map((i)=>String(i??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function br(e){let t=[];for(let i of new Set(e))try{t.push({path:i,mtimeMs:Fr.statSync(i).mtimeMs})}catch{}return t}function Ds(e){for(let t of e)try{if(Fr.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 da=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function ga(e){if(e.startsWith(".")||e.startsWith("/"))return null;if(e.startsWith("@")){let i=e.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!i)return null;return{pkg:i[1],subpath:i[2]||""}}let t=e.match(/^([^/]+)(\/.*)?$/);if(!t)return null;return{pkg:t[1],subpath:t[2]||""}}function ma(e,t){let i=t;while(!0){let n=ht.join(i,"node_modules",e,"package.json");if(Kt.existsSync(n))return ht.dirname(n);let a=ht.dirname(i);if(a===i)return null;i=a}}function ha(e,t){if(!e||typeof e!=="object")return null;let i=(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 i(a.import);if(typeof a.default==="object")return i(a.default)}return null};if(Object.prototype.hasOwnProperty.call(e,t))return i(e[t]);let n=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(!n||c.length>n.prefix.length)n={pattern:a,prefix:c,suffix:b}}if(n){let a=t.slice(n.prefix.length,t.length-n.suffix.length),l=i(e[n.pattern]);if(l)return l.replace("*",a)}return null}function xa(e,t){let i=ga(e);if(!i||!i.subpath)return null;let n=ma(i.pkg,t);if(!n)return null;let a;try{a=JSON.parse(Kt.readFileSync(ht.join(n,"package.json"),"utf8"))}catch{return null}let l=`.${i.subpath}`,c=ha(a.exports,l);if(!c)return null;let b=ht.resolve(n,c);return Kt.existsSync(b)?b:null}function yi(e,t){let i=t.filePath?ht.dirname(t.filePath):t.projectRoot||process.cwd(),n=t.projectRoot||process.cwd(),a=new Set,l=[],c=[];return{code:e.replace(da,(v,E)=>{let A;try{if(E.startsWith("./")||E.startsWith("../")||E.startsWith("/")){if(A=E.startsWith("/")?E:ht.resolve(i,E),!Kt.existsSync(A))throw Error(`file not found: ${A}`)}else{let O=null;try{O=Bun.resolveSync(E,n)}catch{O=xa(E,n)}if(!O)throw Error(`could not resolve ${E} (Bun.resolveSync + exports fallback both failed)`);A=O}}catch(O){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(E)} (from ${t.filePath||"<unknown>"}): ${O?.message||O}`),c.push(E),""}if(a.has(A))return"";a.add(A);try{let O=Kt.readFileSync(A,"utf8");l.push({source:E,resolvedPath:A,contents:O})}catch(O){console.warn(`[stx:vendor-css] could not read ${A}: ${O?.message||O}`),c.push(E)}return""}),styles:l,unresolved:c}}function ba(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function bi(e){if(e.length===0)return"";return`${e.map((t)=>`<style data-stx-vendor="${ba(t.source)}" data-stx-layer="vendor">
115
+ `+a.slice(c);else a+=l;return a}function Nr(e,t){let i=new Set;for(let n of e.split(",")){let a=n.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))i.add(a)}return i}function At(e,t){let i=r(e),{depths:n,balanced:a}=me(i),l=(b)=>!a||n[b]===0,c=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${t}\\b)`,"g");for(let b of i.matchAll(c)){let v=(b.index??0)+b[0].length-b[1].length;if(l(v))return!0}for(let b of i.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(b.index??0)&&Nr(b[1],!0).has(t))return!0;for(let b of i.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(b.index??0)&&Nr(b[1],!1).has(t))return!0;return!1}var Lr=new T(32,{maxBytes:2097152,sizeOf:(e)=>e.code.length*4}),dt=/^[A-Za-z_$][\w$]*$/,aa=new Set(["if","for","while","switch","with"]),zr=["(","[","{"],Br=[")","]","}"],ca=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function la(e){let t=r(e),i=[];for(let n of t.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=n.index??0;i.push({text:n[0],start:a,end:a+n[0].length})}return{code:t,tokens:i}}function ds(e){let t=Lr.get(e);if(t)return t;let{code:i,tokens:n}=la(e),a=new Map,l=[];for(let L=0;L<n.length;L++){let F=n[L].text;if(["(","[","{"].includes(F))l.push(L);else if([")","]","}"].includes(F)){let G=l.at(-1);if(G!==void 0&&["()","[]","{}"].includes(n[G].text+F))l.pop(),a.set(G,L),a.set(L,G)}}function c(L,F){let G=[],D=L;for(let ee=L;ee<F;ee++){if(["(","[","{"].includes(n[ee].text)&&(a.get(ee)??F)<F){ee=a.get(ee);continue}if(n[ee].text===",")G.push([D,ee]),D=ee+1}return G.push([D,F]),G}let b=[];function v(L,F,G,D=!1){if(n[L]?.text==="...")L++;if(L>=F)return;let ee=n[L].text;if(dt.test(ee)){if(G.add(ee),G===O)b.push({name:ee,token:L,functionScoped:D});return}if(ee!=="{"&&ee!=="[")return;let ne=a.get(L);if(ne===void 0||ne>=F)return;for(let[te,le]of c(L+1,ne)){let he=te;if(ee==="{")for(let ue=te;ue<le;ue++){if(n[ue].text===":"){he=ue+1;break}if(n[ue].text==="=")break;if(["(","[","{"].includes(n[ue].text)&&a.has(ue))ue=a.get(ue)}v(he,le,G,D)}}function E(L,F){let G=new Set;for(let[D,ee]of c(L,F))v(D,ee,G);return G}function A(L){let F=L;for(;F<n.length;F++){let G=n[F].text;if(["(","[","{"].includes(G)&&a.has(F)){F=a.get(F);continue}if([",",";",")","]","}"].includes(G))break}return n[Math.max(L,F-1)]?.end??i.length}let O=new Set,H=[];for(let L=0;L<n.length;L++)if(n[L].text==="=>"){let F=L-1,G=F,D;if(n[F]?.text===")"&&a.has(F))G=a.get(F),D=E(G+1,F);else if(n[F]&&dt.test(n[F].text))D=new Set([n[F].text]);else continue;let ee=L+1,ne=n[ee]?.text==="{"&&a.has(ee)?n[a.get(ee)].end:A(ee);H.push({start:n[G].start,end:ne,bodyStart:n[ee]?.start??ne,functionBody:!0,names:D})}else if(n[L].text==="("&&a.has(L)){let F=n[L-1]?.text;if(!F||aa.has(F)||!dt.test(F)&&F!=="*"&&F!=="]")continue;let G=a.get(L),D=G+1;if(n[D]?.text===":"){D++;while(D<n.length&&!["{","=>",";","="].includes(n[D].text))D++}if(n[D]?.text!=="{"||!a.has(D))continue;H.push({start:n[L].start,end:n[a.get(D)].end,bodyStart:n[D].start,functionBody:F!=="catch",names:E(L+1,G)})}function j(L){let F=L;for(;F<n.length;F++){let G=n[F].text;if(zr.includes(G)&&a.has(F)){F=a.get(F);continue}if(G===";"||Br.includes(G))break;let D=n[F-1];if(F>L&&ca.has(G)&&D.text!==".")break;if(F>L&&/[\n\r]/.test(i.slice(D.end,n[F].start))&&(/^[\w$]+$/.test(D.text)||Br.includes(D.text)||['"',"'","`"].includes(D.text))&&dt.test(G)&&!["in","of","instanceof"].includes(G))break}return F}let P=[];for(let L=0;L<n.length;L++){if(n[L].text!=="for")continue;let F=n[L+1]?.text==="await"?L+2:L+1;if(n[F]?.text!=="("||!a.has(F))continue;let G=a.get(F),D=G+1,ee=n[D]?.text==="{"&&a.has(D)?a.get(D):j(D),ne=n[ee]?.text===";"||n[ee]?.text==="}"?n[ee].end:n[Math.max(D,ee-1)]?.end??i.length;P.push({headStart:F,headEnd:G,start:n[F].start,end:ne})}for(let L=0;L<n.length;L++){let F=n[L].text,G=n[L-1]?.text;if(G==="."||n[L+1]?.text===":")continue;if(G==="as"||G==="<")continue;if(F==="const"||F==="let"||F==="var"){let D=j(L+1),ee=L+1,ne=!1,te=!1,le=0;for(let he=L+1;he<=D;he++){let ue=n[he]?.text;if(he<D&&zr.includes(ue)&&a.has(he)&&a.get(he)<D){he=a.get(he);continue}if(he<D&&ue===":"&&!te)ne=!0;else if(he<D&&ue==="="&&le===0)ne=!1,te=!0;else if(he<D&&ne&&ue==="<")le++;else if(he<D&&ne&&ue===">"&&le>0)le--;else if(he===D||ue===","&&le===0)v(ee,he,O,F==="var"),ee=he+1,ne=!1,te=!1}}else if(F==="function"||F==="class"){let D=L+1;if(n[D]?.text==="*")D++;if(n[D]&&dt.test(n[D].text)&&n[D].text!=="extends")O.add(n[D].text),b.push({name:n[D].text,token:D})}else if(F==="import"){let D=L+1;if(n[D]?.text==="*"&&n[D+1]?.text==="as")D+=2;let ee=n[D]?.text;if(ee&&dt.test(ee)&&ee!=="type"&&n[D+1]?.text!=="("&&n[D+1]?.text!==".")O.add(ee),b.push({name:ee,token:D,file:!0});let ne=n[D]?.text==="{"?D:n[D+1]?.text===","&&n[D+2]?.text==="{"?D+2:-1;if(ne!==-1&&a.has(ne)){let te=a.get(ne);for(let[le,he]of c(ne+1,te)){let ue=he-1;while(ue>=le&&!dt.test(n[ue].text))ue--;if(ue>=le&&n[ue].text!=="type")b.push({name:n[ue].text,token:ue,file:!0})}}}}let B={code:i,scopes:H,loops:P,declarations:O,sites:b,tokens:n,pairs:a};return Lr.set(e,B),B}function Zt(e){let t=ds(e);return{code:t.code,shadows:(i,n)=>t.scopes.some((a)=>n>=a.start&&n<a.end&&a.names.has(i))}}function In(e){return new Set(ds(e).declarations)}function Oe(e,t){let{scopes:i,loops:n,sites:a,tokens:l,pairs:c}=ds(e),b=Array.from({length:l.length},()=>-1),v=[];for(let j=0;j<l.length;j++){b[j]=v.length?v[v.length-1]:-1;let P=l[j].text;if(P==="{"&&c.has(j))v.push(j);else if(P==="}"&&v.length&&c.get(j)===v[v.length-1])v.pop()}let E=new Set,A=new Map;for(let j of a){if(!t.has(j.name))continue;E.add(j.token);let P=j.file?-1:b[j.token],B=P===-1?[0,Number.POSITIVE_INFINITY]:[l[P].start,l[c.get(P)].end];if(j.functionScoped){let F=l[j.token].start,G=i.filter((D)=>D.functionBody&&F>=D.bodyStart&&F<D.end).sort((D,ee)=>D.end-D.bodyStart-(ee.end-ee.bodyStart))[0];B=G?[G.bodyStart,G.end]:[0,Number.POSITIVE_INFINITY]}else if(!j.file){let F=n.filter((G)=>j.token>G.headStart&&j.token<G.headEnd).sort((G,D)=>G.headEnd-G.headStart-(D.headEnd-D.headStart))[0];if(F)B=[F.start,F.end]}let L=A.get(j.name);if(L)L.push(B);else A.set(j.name,[B])}let O=new Set;for(let j=0;j<l.length;j++){if(l[j].text!=="import"||l[j-1]?.text===".")continue;let P=j+1;if(l[P]?.text==="type")P++;if(l[P]&&dt.test(l[P].text)&&l[P+1]?.text===",")P+=2;if(l[P]?.text==="{"&&c.has(P))for(let B=P+1;B<c.get(P);B++)O.add(B)}let H=new Set;for(let j=0;j<l.length;j++){let P=l[j].text;if(!t.has(P)||H.has(P)||E.has(j)||O.has(j))continue;let B=l[j-1]?.text;if(B==="#"||B==="."&&l[j-2]?.text!=="..")continue;if(l[j+1]?.text===":"&&(B==="{"||B===","))continue;let L=l[j].start;if(A.get(P)?.some(([F,G])=>L>=F&&L<G))continue;if(i.some((F)=>L>=F.start&&L<F.end&&F.names.has(P)))continue;H.add(P)}return H}var Ie="0.2.832";var Wr=Symbol.for(`stx.lazy-module-promises.${Ie}`);function fa(){let e=globalThis;return e[Wr]??=new Map,e[Wr]}function o(e,t){let i=fa(),n=`${import.meta.url}\x00${e}`,a=i.get(n);if(a)return a;let l=t();return i.set(n,l),l.catch(()=>{if(i.get(n)===l)i.delete(n)}),l}var pa=/<\/(script)/gi;function pn(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(pa,"<\\/$1")}import Fr from"fs";var Vr=[];function w(e){let t=new T(e);return Vr.push(t),t}function Pc(){for(let e of Vr)e.clear()}function S(e,...t){return`${t.map((i)=>String(i??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function br(e){let t=[];for(let i of new Set(e))try{t.push({path:i,mtimeMs:Fr.statSync(i).mtimeMs})}catch{}return t}function Ds(e){for(let t of e)try{if(Fr.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 da=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function ga(e){if(e.startsWith(".")||e.startsWith("/"))return null;if(e.startsWith("@")){let i=e.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!i)return null;return{pkg:i[1],subpath:i[2]||""}}let t=e.match(/^([^/]+)(\/.*)?$/);if(!t)return null;return{pkg:t[1],subpath:t[2]||""}}function ma(e,t){let i=t;while(!0){let n=ht.join(i,"node_modules",e,"package.json");if(Kt.existsSync(n))return ht.dirname(n);let a=ht.dirname(i);if(a===i)return null;i=a}}function ha(e,t){if(!e||typeof e!=="object")return null;let i=(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 i(a.import);if(typeof a.default==="object")return i(a.default)}return null};if(Object.prototype.hasOwnProperty.call(e,t))return i(e[t]);let n=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(!n||c.length>n.prefix.length)n={pattern:a,prefix:c,suffix:b}}if(n){let a=t.slice(n.prefix.length,t.length-n.suffix.length),l=i(e[n.pattern]);if(l)return l.replace("*",a)}return null}function xa(e,t){let i=ga(e);if(!i||!i.subpath)return null;let n=ma(i.pkg,t);if(!n)return null;let a;try{a=JSON.parse(Kt.readFileSync(ht.join(n,"package.json"),"utf8"))}catch{return null}let l=`.${i.subpath}`,c=ha(a.exports,l);if(!c)return null;let b=ht.resolve(n,c);return Kt.existsSync(b)?b:null}function yi(e,t){let i=t.filePath?ht.dirname(t.filePath):t.projectRoot||process.cwd(),n=t.projectRoot||process.cwd(),a=new Set,l=[],c=[];return{code:e.replace(da,(v,E)=>{let A;try{if(E.startsWith("./")||E.startsWith("../")||E.startsWith("/")){if(A=E.startsWith("/")?E:ht.resolve(i,E),!Kt.existsSync(A))throw Error(`file not found: ${A}`)}else{let O=null;try{O=Bun.resolveSync(E,n)}catch{O=xa(E,n)}if(!O)throw Error(`could not resolve ${E} (Bun.resolveSync + exports fallback both failed)`);A=O}}catch(O){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(E)} (from ${t.filePath||"<unknown>"}): ${O?.message||O}`),c.push(E),""}if(a.has(A))return"";a.add(A);try{let O=Kt.readFileSync(A,"utf8");l.push({source:E,resolvedPath:A,contents:O})}catch(O){console.warn(`[stx:vendor-css] could not read ${A}: ${O?.message||O}`),c.push(E)}return""}),styles:l,unresolved:c}}function ba(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function bi(e){if(e.length===0)return"";return`${e.map((t)=>`<style data-stx-vendor="${ba(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((i,n)=>Aa(i,n)).join(`
184
184
  `)}`}function Zr(e){let t=[],i=new Set,n=e.replace(/^\s*import\s+.*$/gm,""),a=0,l=n.length,c=0;while(c<l){let b=n[c];if(b==="'"||b==='"'||b==="`"){let v=b;if(c++,v==="`"){let E=0;while(c<l){if(n[c]==="\\"){c+=2;continue}if(n[c]==="`"&&E===0){c++;break}if(n[c]==="$"&&n[c+1]==="{"){E++,c+=2;continue}if(n[c]==="}"&&E>0){E--,c++;continue}c++}}else while(c<l){if(n[c]==="\\"){c+=2;continue}if(n[c]===v){c++;break}c++}continue}if(b==="/"&&n[c+1]==="/"){while(c<l&&n[c]!==`
185
- `)c++;continue}if(b==="/"&&n[c+1]==="*"){c+=2;while(c<l-1&&!(n[c]==="*"&&n[c+1]==="/"))c++;c+=2;continue}if(b==="{"){a++,c++;continue}if(b==="}"){a--,c++;continue}if(a===0){let v=n.slice(c),E=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(E){let H=E[1];if(!H.startsWith("_")&&!i.has(H))t.push(H),i.add(H);c+=E[0].length;continue}let A=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){A[1].split(",").forEach((H)=>{let j=H.trim(),P=j.indexOf(":"),B=P>=0?j.slice(P+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(B&&!B.startsWith("_")&&!i.has(B))t.push(B),i.add(B)}),c+=A[0].length;continue}let O=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(O){let H=O[1];if(!H.startsWith("_")&&!i.has(H))t.push(H),i.add(H);c+=O[0].length;continue}}c++}return t}var Ia=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 Pa(e){let t=new Set,i=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function n(H){let j;while((j=i.exec(H))!==null){let P=j[0];if(!Ia.has(P))t.add(P)}}let a=/\{\{([\s\S]*?)\}\}/g,l;while((l=a.exec(e))!==null)n(l[1]);let c=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((l=c.exec(e))!==null)n(l[1]);let b=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=b.exec(e))!==null)n(l[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=v.exec(e))!==null)n(l[1]);let E=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=E.exec(e))!==null)n(l[1]);let A=/@model\s*=\s*["']([^"']*)["']/gi;while((l=A.exec(e))!==null)n(l[1]);let O=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=O.exec(e))!==null)n(l[1]);return t}async function je(e,t={}){let i=e,n="",a=!1,l=[],c=yi(i,{filePath:t.filePath,projectRoot:t.projectRoot});i=c.code;let b=bi(c.styles),v=Mt(i);i=v.code,l=[...v.imports,...v.models];let{hasUserImports:E,bundleClientScript:A}=await o("stx/client-script-bundler",()=>import("./chunk-a7ewznxk.js"));if(E(i))i=await A(i,t.filePath||"",{projectRoot:t.projectRoot,minify:t.production}),a=!0;if(t.autoImports!==!1){let D=Gc(i);i=D.code,n=Jc(D.stxImports,D.browserImports.filter((ee)=>!l.includes(ee)))}if(n=`${bn(i,t.serverData)}${n}`,i=I(i),!a&&Be(t.attrs||""))i=Fe(i);let O=Ta(t.eventBindings||[]),H=(t.attrs||"").trim(),j=/\btype\s*=\s*["']module["']/i.test(H),P=t.instanceId?` data-stx-instance="${t.instanceId}"`:"";if(j){let D=H.replace(/\btype\s*=\s*["']module["']/i,"").trim(),ee=`type="module" data-stx-scoped${P}${D?` ${D}`:""}`;return`${b}<script ${ee}>
185
+ `)c++;continue}if(b==="/"&&n[c+1]==="*"){c+=2;while(c<l-1&&!(n[c]==="*"&&n[c+1]==="/"))c++;c+=2;continue}if(b==="{"){a++,c++;continue}if(b==="}"){a--,c++;continue}if(a===0){let v=n.slice(c),E=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(E){let H=E[1];if(!H.startsWith("_")&&!i.has(H))t.push(H),i.add(H);c+=E[0].length;continue}let A=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){A[1].split(",").forEach((H)=>{let j=H.trim(),P=j.indexOf(":"),B=P>=0?j.slice(P+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(B&&!B.startsWith("_")&&!i.has(B))t.push(B),i.add(B)}),c+=A[0].length;continue}let O=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(O){let H=O[1];if(!H.startsWith("_")&&!i.has(H))t.push(H),i.add(H);c+=O[0].length;continue}}c++}return t}var Ia=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 Pa(e){let t=new Set,i=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function n(H){let j;while((j=i.exec(H))!==null){let P=j[0];if(!Ia.has(P))t.add(P)}}let a=/\{\{([\s\S]*?)\}\}/g,l;while((l=a.exec(e))!==null)n(l[1]);let c=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((l=c.exec(e))!==null)n(l[1]);let b=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=b.exec(e))!==null)n(l[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=v.exec(e))!==null)n(l[1]);let E=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=E.exec(e))!==null)n(l[1]);let A=/@model\s*=\s*["']([^"']*)["']/gi;while((l=A.exec(e))!==null)n(l[1]);let O=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=O.exec(e))!==null)n(l[1]);return t}async function je(e,t={}){let i=e,n="",a=!1,l=[],c=yi(i,{filePath:t.filePath,projectRoot:t.projectRoot});i=c.code;let b=bi(c.styles),v=Mt(i);i=v.code,l=[...v.imports,...v.models];let{hasUserImports:E,bundleClientScript:A}=await o("stx/client-script-bundler",()=>import("./chunk-32xv3q66.js"));if(E(i))i=await A(i,t.filePath||"",{projectRoot:t.projectRoot,minify:t.production}),a=!0;if(t.autoImports!==!1){let D=Gc(i);i=D.code,n=Jc(D.stxImports,D.browserImports.filter((ee)=>!l.includes(ee)))}if(n=`${bn(i,t.serverData)}${n}`,i=I(i),!a&&Be(t.attrs||""))i=Fe(i);let O=Ta(t.eventBindings||[]),H=(t.attrs||"").trim(),j=/\btype\s*=\s*["']module["']/i.test(H),P=t.instanceId?` data-stx-instance="${t.instanceId}"`:"";if(j){let D=H.replace(/\btype\s*=\s*["']module["']/i,"").trim(),ee=`type="module" data-stx-scoped${P}${D?` ${D}`:""}`;return`${b}<script ${ee}>
186
186
  ${pn(`${n}${i}
187
187
  ${O}`)}
188
188
  </script>`}let B=Pi(e),L=/function __stx_setup_/.test(i),F=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function G(D){let ee=D.length>0?`
@@ -570,8 +570,8 @@ ${E.join(`
570
570
  `){let P=e[a];if(P==="\\"){a+=2;continue}if(P==="[")j=!0;else if(P==="]")j=!1;else if(P==="/"&&!j){a++;while(a<l&&/[a-z]/i.test(e[a]))a++;return}a++}},H=()=>{if(n!==0)return;let j=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(j){let F=j[2].split(",").map((G)=>{let D=G.trim().split(":");return D[D.length-1].trim()});for(let G of F)if(G&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(G)&&!i.has(G))t.push(G),i.add(G);return}let P=e.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(P){let F=P[2];if(!i.has(F))t.push(F),i.add(F);return}let B=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let F=B[1];if(!i.has(F))t.push(F),i.add(F);return}let L=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let F=L[1];if(!i.has(F))t.push(F),i.add(F)}};while(a<l){if(v())continue;if(e[a]==="'"||e[a]==='"'){c(e[a]);continue}if(e[a]==="`"){b();continue}if(e[a]==="/"&&A()){O();continue}if(e[a]==="{"){n++,a++;continue}if(e[a]==="}"){n--,a++;continue}if(n===0&&/[a-z]/i.test(e[a])&&(a===0||/\s|[;{}()]/.test(e[a-1])))H();a++}return t}function Jl(e){let t=[],i=0,n=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==="{")i++;else if(c===")"||c==="]"||c==="}")i--;else if(c===","&&i===0)t.push(e.slice(n,l)),n=l+1}if(n<e.length)t.push(e.slice(n));return t}function Gl(e){let t=0,i=null;for(let n=0;n<e.length;n++){let a=e[n];if(i){if(a==="\\"){n++;continue}if(a===i)i=null;continue}if(a==='"'||a==="'"||a==="`"){i=a;continue}if(a==="("||a==="["||a==="{")t++;else if(a===")"||a==="]"||a==="}")t--;else if(a==="="&&t===0){let l=e[n-1],c=e[n+1];if(l==="!"||l==="<"||l===">"||l==="=")continue;if(c==="="||c===">")continue;return n}}return-1}function Yl(e,t){try{let i=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(e);if(!i)return;let n=i.index-1;while(n>=0&&/\s/.test(e[n]))n--;if(e[n]!=="}")return;let a=n,l=0,c=-1;for(;n>=0;n--){let v=e[n];if(v==="}")l++;else if(v==="{"){if(l--,l===0){c=n;break}}}if(c===-1)return;let b=e.slice(c+1,a);for(let v of Jl(b)){let E=v.trim();if(!E||E.startsWith("..."))continue;let A=Gl(E);if(A===-1)continue;let O=E.slice(0,A).trim();if(!/^[A-Z_$][\w$]*$/i.test(O))continue;if(t[O]!==void 0)continue;let H=E.slice(A+1).trim();if(!H)continue;try{let j=Object.keys(t).filter(Bt),P=Function(...j,`"use strict"; return (${H});`);t[O]=P(...j.map((B)=>t[B]))}catch{}}}catch{}}var Ql=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function hg(e,t){let i=e.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)<([a-zA-Z][a-zA-Z0-9-]*)/s);if(!i)return null;let n=i[2].toLowerCase();if(!Ql.has(n))return null;let a=new RegExp(`<\\/?${n}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),l=y(e,(E,A)=>(a.lastIndex=A,a.exec(E)?.index===A?a.lastIndex:-1));if(n==="span"&&/\sdata-stx-scope\s*=/.test(l[0]?.token||""))return null;let c=0,b=!1;for(let E of l){if(c+=E.token.startsWith("</")?-1:1,c<0)return null;if(c===0){if(e.slice(E.end).trim())return null;b=!0;break}}if(!b)return null;let v=i[0].length;return e.slice(0,v)+t+e.slice(v)}function Oo(e,t){if(!e)return!1;return[...t.additionalComponentsDirs??[],...t.fallbackComponentsDir?[t.fallbackComponentsDir]:[]].some((n)=>{let a=ae.relative(ae.resolve(n),ae.resolve(e));return!a.startsWith("..")&&!ae.isAbsolute(a)})}async function Cr(e,t,i,n,a){let l=e.endsWith(".stx")?e.slice(0,-4):e,c=(te)=>te.split("-").map((le)=>le.charAt(0).toUpperCase()+le.slice(1)).join(""),b=i.__importedComponents;if(b){for(let te of[l,l.toLowerCase(),c(l),U(l)])if(b.has(te))return!0}let v=[...new Set([`${l}.stx`,`${c(l)}.stx`,`${U(l)}.stx`])],E=typeof a.root==="string"?ae.resolve(a.root):void 0,A=E??ae.dirname(n),O=[],H=(te)=>{if(te&&!O.includes(te))O.push(te)};for(let te of us(n,E))H(te);let j=i.__originalFilePath;if(j)H(ae.join(ae.dirname(j),"components"));if(Oo(t,a))H(a._rootComponentsDir);H(t),H(a._rootComponentsDir),H(ae.join(ae.dirname(n),"components")),H(a.componentsDir);for(let te of a.additionalComponentsDirs??[])H(te);let P=a._targetComponentFallbackNames?.some((te)=>te.toLowerCase()===l.toLowerCase());if(!P)for(let te of a._targetComponentDirs??[])H(te);if(E)H(ae.resolve(E,"resources/views/components")),H(ae.resolve(E,"resources/components")),H(ae.resolve(E,"src/components")),H(ae.resolve(E,"components"));for(let te of a._layerComponentDirs??[])H(te);let B=a._pluginComponentDirs;if(Array.isArray(B))for(let te of B)H(typeof te==="string"?te:null);if(H(a.fallbackComponentsDir),P)for(let te of a._targetComponentDirs??[])H(te);let L=a._nativePrimitivesFallback;if(L&&!L.except.some((te)=>te.toLowerCase()===l.toLowerCase()))H(L.dir);if(l.startsWith("./")||l.startsWith("../"))return s(ae.resolve(ae.dirname(n),`${l}.stx`));let F=Eo(ae.resolve(import.meta.dir,"components")),G=O.map((te)=>ae.isAbsolute(te)?te:ae.resolve(A,te)),D=`${v.join("\x00")}\x00\x00${G.join("\x00")}`,ee=tr.get(D);if(ee!==void 0)return ee;let ne=!1;e:for(let te of G){if(Eo(te)===F)continue;for(let le of v)if(await s(ae.join(te,le))){ne=!0;break e}}return tr.set(D,ne),ne}function Eo(e){let t=nr.get(e);if(t!==void 0)return t;let i=e;try{i=Jn.realpathSync(e)}catch{}return nr.set(e,i),i}function yg(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function Yc(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 eu(e,t,i){if(!e.includes("{{")&&!e.includes("{!!"))return e;let n=(a,l)=>{let c;try{c=R(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 ${i??"<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)=>n(l,a)).replace(/\{\{([\s\S]*?)\}\}/g,(a,l)=>n(l,a))}var ko=new Set;function Ro(e,t,i,n){let a=`${e}\x00${t}\x00${n??""}`;if(!process.env.STX_DEBUG&&ko.has(a))return;ko.add(a);let l=t?` used in ${t}`:"",c=n?` Cause: ${n}.`:"",b=i.length>0?`
571
571
  searched:
572
572
  ${i.map((v)=>` - ${v}`).join(`
573
- `)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${c}${b}`)}function Co(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var tu=new Set(["for","if","show","key","ref","class","className","style"]),Ao=new Set,Mo="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",Zc=new RegExp(`\\b(?:${Mo})\\s*(?:<[^>]*>)?\\s*\\(`);function wi(e){let t=new Set,i=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|${Mo})\\s*(?:<[^>]*>)?\\s*\\(`,"g");for(let n of e){let a;while((a=i.exec(n))!==null)t.add(a[1]);i.lastIndex=0}return[...t]}async function ze(e,t,i,n,a,l,c,b=new Set,v,E=st(a),A,O=e){let{extractVariables:H}=await o("stx/variable-extractor",()=>import("./chunk-bh7v78je.js")),j=b??new Set;if(j.has(e))return`[Circular component reference: ${e}]`;let P=new Set(j);P.add(e);let B=typeof t.client==="string"?t.client.trim():"";if("client"in t)delete t.client;let L=B&&B!=="load"&&yg(B)?B:"";try{let F=(re)=>re.split("-").map((ce)=>ce.charAt(0).toUpperCase()+ce.slice(1)).join(""),G=O.endsWith(".stx")?O.slice(0,-4):O,D=null,ee=a.__importedComponents;if(ee){let re=[G,G.toLowerCase(),F(G),U(G)];for(let ce of re)if(ee.has(ce)){D=ee.get(ce);break}}let ne=[];if(!D){let re=[`${G}.stx`,`${F(G)}.stx`,`${U(G)}.stx`],ce=[...new Set(re)],_e=a.__originalFilePath,be=[];if(be.push(...c._layerComponentDirs??[]),_e){let ye=ae.join(ae.dirname(_e),"components");be.push(ye)}let Ve=c._rootComponentsDir;if(typeof Ve==="string"&&Oo(n,c)&&!be.includes(Ve))be.push(Ve);if(n&&!be.includes(n))be.push(n);if(typeof Ve==="string"&&!be.includes(Ve))be.push(Ve);let Te=ae.join(ae.dirname(l),"components");if(!be.includes(Te))be.push(Te);if(c.componentsDir&&c.componentsDir!==n&&!be.includes(c.componentsDir))be.push(c.componentsDir);for(let ye of c.additionalComponentsDirs??[])if(ye&&!be.includes(ye))be.push(ye);let ft=c._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(G),pt=(A?.events??[]).map((ye)=>ye.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),yt=Object.hasOwn(t,"checked")||Boolean(A?.reactiveProps?.includes("checked")),ss=Object.hasOwn(t,"value")||Boolean(A?.reactiveProps?.includes("value")),rs=!pt.includes("valuechange")&&(yt||pt.includes("change")&&!ss),mt=c._nativeHostAttrs&&/^textinput$/i.test(G),_t=pt.includes("update:value")&&!pt.includes("input"),qt=c._nativeHostAttrs&&/^video$/i.test(G),is=c._nativeHostAttrs&&/^image$/i.test(G),ln=Ms([...Object.keys(t),...A?.reactiveProps??[]],A?.events,t),wt=Object.hasOwn(t,"src")||Boolean(A?.reactiveProps?.includes("src")),un=Object.hasOwn(t,"source")||Boolean(A?.reactiveProps?.includes("source")),dn=qt&&(wt||un)&&(A?.events??[]).every((ye)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(ye.replace(/^@/,"").split(".")[0])),_n=new Set(["","primary","secondary","outline","ghost","danger"]),$n=typeof t.variant==="string"?t.variant.trim().toLowerCase():"",En=c._nativeHostAttrs&&/^button$/i.test(G)&&!_n.has($n),ur=c._targetComponentFallbackNames?.some((ye)=>ye.toLowerCase()===G.toLowerCase())&&(!ft||rs)&&(!mt||_t)&&(!qt||dn)&&(!is||ln)&&!En;for(let ye of ur?[]:c._targetComponentDirs??[])if(ye&&!be.includes(ye))be.push(ye);let St=typeof c.root==="string"?ae.resolve(c.root):void 0,Ko=St??ae.dirname(l),$t=[];if(St)$t.push(ae.resolve(St,"resources/views/components")),$t.push(ae.resolve(St,"resources/components")),$t.push(ae.resolve(St,"src/components")),$t.push(ae.resolve(St,"components"));$t.push(ae.resolve(import.meta.dir,"components"));for(let ye of $t)if(!be.includes(ye))be.push(ye);let fr=c._pluginComponentDirs;if(Array.isArray(fr)){for(let ye of fr)if(typeof ye==="string"&&!be.includes(ye))be.push(ye)}if(c.fallbackComponentsDir&&!be.includes(c.fallbackComponentsDir))be.push(c.fallbackComponentsDir);if(ur){for(let ye of c._targetComponentDirs??[])if(ye&&!be.includes(ye))be.push(ye)}let kn=c._nativePrimitivesFallback;if(kn&&!kn.except.some((ye)=>ye.toLowerCase()===G.toLowerCase())&&!be.includes(kn.dir))be.push(kn.dir);let pr=[...new Set(be.map((ye)=>{if(!ye)return ye;return ae.isAbsolute(ye)?ye:ae.resolve(Ko,ye)}))];be.length=0,be.push(...pr);let os=`${G}\x00${l}\x00${pr.join("\x00")}`,as=Kn.get(os);if(as)if(await s(as))D=as;else Kn.delete(os);if(!D&&(G.startsWith("./")||G.startsWith("../")))D=ae.resolve(ae.dirname(l),`${G}.stx`),ne.push(D);else if(!D)for(let ye of be){if(!ye)continue;for(let Rn of ce){let Cn=ae.join(ye,Rn);if(ne.push(Cn),await s(Cn)){D=Cn;break}}if(D)break;if(!D)try{let Rn=await import("fs");if(!Rn.statSync(ye,{throwIfNoEntry:!1})?.isDirectory())continue;let Xo=8,cs=[{path:ye,depth:0}];while(cs.length>0&&!D){let An=cs.pop();if(An.depth>=Xo)continue;let dr;try{dr=Rn.readdirSync(An.path,{withFileTypes:!0})}catch{continue}for(let Tn of dr){if(!Tn.isDirectory())continue;if(Tn.name==="node_modules"||Tn.name.startsWith("."))continue;let gr=ae.join(An.path,Tn.name);for(let Jo of ce){let ls=ae.join(gr,Jo);if(ne.push(ls),await s(ls)){D=ls;break}}if(D)break;cs.push({path:gr,depth:An.depth+1})}}}catch{}if(D)break}if(D)Kn.set(os,D)}if(!D||!await s(D))return Ro(e,l,ne),Co(e);v.add(D);let te;if(tn.has(D)&&er.get(D)===So(D))te=tn.get(D);else try{let re=So(D);te=await Bun.file(D).text(),tn.set(D,te),er.set(D,re)}catch(re){let ce=re instanceof Error?re.message:String(re);return Ro(e,l,[D],ce),Co(e)}if(A)for(let re of new Set([...Object.keys(t),...A.reactiveProps??[]])){let ce=re.toLowerCase();if(ce.startsWith("aria-")||ce.startsWith("data-"))continue;let _e=re.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${_e}\\b`).test(te))A.declaredProps.add(re);if(new RegExp(`\\$props\\s*(?:\\.\\s*${_e}\\b|\\[\\s*['"]${_e}['"]\\s*\\])`).test(te)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${_e}['"]`).test(te))A.consumedProps?.add(re)}if(A?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(te))for(let re of A.reactiveProps){if(tu.has(re)||A.consumedProps?.has(re))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${re.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(te))continue;let ce=`${D}\x00${re}`;if(Ao.has(ce))continue;Ao.add(ce),console.warn(`[stx] ${ae.basename(D)} reads \`${re}\` with defineProps(), which is not live, but ${ae.basename(l)} binds it (:${re}): 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('${re}').`)}let le=new Set(["__originalFilePath","__importedComponents",Dn,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),he={};for(let[re,ce]of Object.entries(a))if(!re.startsWith("__")||le.has(re))he[re]=ce;let ue=E.length>0?{[Fn]:[...E]}:{},Ee=i;if(i.includes("@include")){let{processIncludes:re}=await o("stx/includes",()=>import("./chunk-rbq4dn2a.js"));Ee=await re(i,a,l,c,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ee)){let{processComponents:re}=await o("stx/component-renderer",()=>import("./chunk-s6399qe7.js")),ce={...a,__processedComponents:j,...ue};Ee=await re(Ee,ce,l,c,v);let _e=ce.__stx_preserved_client_expressions;if(Array.isArray(_e)&&_e.length>0)a.__stx_preserved_client_expressions=[...new Set([...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],..._e])]}let Ae=[];if(Yc(Ee)){let{processExpressions:re}=await o("stx/expressions",()=>import("./chunk-7amk61bt.js")),ce=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...ue}:E.length>0?{...a,...ue}:a;Ee=re(Ee,ce,l);for(let _e of Ee.matchAll(/\{\{([\s\S]*?)\}\}/g))Ae.push(_e[1].trim())}let We=J(Ee),Ke=[],Ye=We.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(re,ce)=>{let _e=We.scripts[Number(ce)]||"",be=_e.match(/^<script\b([^>]*)>/i)?.[1]||"",Ve=be.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Te=!Ve||["module","text/javascript","application/javascript"].includes(Ve),ft=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${be}`);if(!/\bserver\b/i.test(be)&&Te&&!ft)return Ke.push(_e),"";return _e}),{extractSlotContent:Xe}=await o("stx/slots",()=>import("./chunk-12m1qwzd.js")),et=Xe(Ye),Je={};if(et.defaultSlot?.trim())Je.default=et.defaultSlot;for(let[re,ce]of et.namedSlots)Je[re]=ce.content;let gt=a.__stx_scope_seq??={n:0,key:Vs(String(a.__filename??l))},Ct=Po(e,process.cwd()),it=`stx_${(Ct.endsWith(".stx")?Ct.slice(0,-4):Ct).replace(/[^a-zA-Z0-9]/g,"_")}_${++gt.n}_${gt.key}`,Pe={...he,$uid:it,$native:c._nativeHostAttrs===!0,...t,props:t,slot:Ye,$slots:Je,__processedComponents:P,__sections:{},__stx_signals_gate:ke(te)||Yc(i),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Ae]};if(/import\s/.test(te)){Pe.__importedComponents=new Map(Pe.__importedComponents);let{processESImports:re}=await o("stx/component-renderer",()=>import("./chunk-s6399qe7.js"));te=await re(te,Pe,D,c,v)}Yl(te,Pe);let Tt=te,sn=pe(Tt);if(sn)Tt=sn.content.trim();let Yn=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,jt=[...te.matchAll(Yn)];for(let[,re,ce]of jt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(re))Ne(ce,D,c.strict);let Ge=[],Lt=null,Qn=jt.some((re)=>/\bserver\b/.test(re[1]||"")&&/\bcache\b/.test(re[1]||"")),bt=null,ot=null,zt=null,rn=0,Wt=null;if(Hl(c),Qn&&sr>0){let re=ql({props:t,slot:Ee,slotContext:i.trim()?Zl(he):void 0,buildMode:c.buildMode??"",skipEventDirectives:c.skipEventDirectives===!0,native:c._nativeHostAttrs===!0,clientLoopNames:[...E].sort(),layers:c._layerGraph?.layers.map((ce)=>ce.configFile),uid:it});if(re!==null){bt=`${D}\x00${S(te)}\x00${re}`;let ce=Xn.get(bt);if(ce){for(let _e of ce.dependencies)v.add(_e);if(ti(a,ce.clientFactories),gt.n+=ce.uidsConsumed,ce.preservedClientExpressions.length>0){let _e=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let be of ce.preservedClientExpressions)_e.add(be);a.__stx_preserved_client_expressions=[..._e]}return ce.output}ot=new Set(v),zt=Qr(a),rn=gt.n,Wt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let Ft=new Set;for(let re of jt){let ce=re[1]||"",_e=re[2]||"",be=ce.includes("server");if(Be(ce)&&_e.trim())_e=Fe(_e);if(be&&_e){for(let Te of De(_e))Ft.add(Te);try{await H(_e,Pe,D,{onFailure:(Te)=>{if(Te.kind!=="unknown")Lt=Te.kind}})}catch(Te){}}if(!be){let Te=_e.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),ft=Te.includes("{{")&&Te.includes("}}"),pt=Te.includes("{!!")&&Te.includes("!!}");if(ft||pt)Te=xi(Te,Pe,D);let yt=ce.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");Ge.push(`<script${yt}>${Te}</script>`)}}let Qe=J(te).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Vt=Qe?Qe[1]:"",es=Qe?Qe[2]:"",at="",se=Vt&&/\bscoped\b/i.test(Vt);if(Qe)at=`<style${Vt}>${eu(es,Pe,D)}</style>`;let oe=Tt;if(oe=oe.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),Qe)oe=oe.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let re=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,ce=[];if(oe=oe.replace(re,(_e,be)=>{let Ve=be.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Ve)ce.push(`<style${Ve[1]}>${Ve[2]}</style>`);return""}),oe=oe.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),ce.length>0)at=`${at}${ce.join(`
574
- `)}`}if(i&&oe.includes("{{ text || slot }}"))oe=oe.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>i);let{applySlots:de}=await o("stx/slots",()=>import("./chunk-12m1qwzd.js")),{defaultSlot:we,namedSlots:Re}=et,qe=a.__stx_signals_gate===!0&&/\s(?:@[\w:.-]+|x-on:[\w:.-]+)\s*=/.test(Ye),tt=Ge.length>0&&ks(oe)||c._nativeHostAttrs===!0&&Ge.length>0||qe&&Ge.length>0||Ge.some((re)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(re)),ts=(re)=>tt?Ki(re,it):re,ns=new Map([...Re].map(([re,ce])=>[re,{...ce,content:ts(ce.content)}]));oe=await de(oe,tt?Zi(ts(we),it):we,ns,Pe,tt?it:"");let on=wi(Ge),Ut=(Array.isArray(Pe.__stx_client_signal_names)?Pe.__stx_client_signal_names:[]).filter((re)=>!Ft.has(re));if(on.length>0||Ut.length>0)Pe.__stx_client_signal_names=[...new Set([...Ut,...on])];else delete Pe.__stx_client_signal_names;let Ht=E.filter((re)=>!Ft.has(re)&&!(re in t));if(Ht.length>0)Pe[Fn]=Ht;let an={...c,_rootComponentsDir:c._rootComponentsDir||c.componentsDir,componentsDir:ae.dirname(D),skipSignalsRuntime:!0,skipEventDirectives:c._nativeHostAttrs===!0||tt||Ge.length===0,defaultLayout:void 0};Pe.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:cn}=await o("stx/process",()=>import("./chunk-3vsz0vrk.js")),nt=await cn(oe,Pe,D,an,v),ut=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let re of nt.matchAll(/\{\{([\s\S]*?)\}\}/g))ut.add(re[1].trim());if(ut.size>0)a.__stx_preserved_client_expressions=[...ut];let lt=it,Ze=nt;if(tt){let re="";if(Object.keys(t).length>0)try{re=` data-stx-props="${Gs(JSON.stringify(t))}"`}catch{}let ce=L?` stx-hydrate="${Gs(L)}"`:"",_e=Object.fromEntries(Object.entries(Je).map(([mt,_t])=>[mt,Boolean(_t)])),be=Object.keys(_e).length>0?` data-stx-slots="${Gs(JSON.stringify(_e))}"`:"",Ve=` data-stx-scope="${lt}"${re}${be}${ce}`,Te=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(nt),ft=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(nt),pt=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<[^>]+\bdata-stx-fill-root(?:\s|=|>)/i.test(nt),yt=Te?"span":"div",ss=ft&&c._nativeHostAttrs?' style="display:flex;flex-direction:column;flex:1;min-height:0;min-width:0"':pt&&c._nativeHostAttrs?' style="width:100%;height:100%"':Te||ft?' style="display:contents"':"";Ze=hg(nt,Ve)??`<${yt}${Ve} data-stx-component-wrapper${ss}>${nt}</${yt}>`;let rs=await Promise.all(Ge.map(async(mt)=>{let _t=mt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!_t)return mt;let[,qt,is]=_t,ln=wo(mt,Pe,D);if(ln!==null)return ln;let wt=await su(is,D,c.buildMode==="compile"),un=bn(wt.clientCode,Le(Pe)),{vendorStyleTags:dn}=wt,_n=un?`function(__scopeId) {
573
+ `)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${c}${b}`)}function Co(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var tu=new Set(["for","if","show","key","ref","class","className","style"]),Ao=new Set,Mo="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",Zc=new RegExp(`\\b(?:${Mo})\\s*(?:<[^>]*>)?\\s*\\(`);function wi(e){let t=new Set,i=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|${Mo})\\s*(?:<[^>]*>)?\\s*\\(`,"g");for(let n of e){let a;while((a=i.exec(n))!==null)t.add(a[1]);i.lastIndex=0}return[...t]}async function ze(e,t,i,n,a,l,c,b=new Set,v,E=st(a),A,O=e){let{extractVariables:H}=await o("stx/variable-extractor",()=>import("./chunk-6cayjtgq.js")),j=b??new Set;if(j.has(e))return`[Circular component reference: ${e}]`;let P=new Set(j);P.add(e);let B=typeof t.client==="string"?t.client.trim():"";if("client"in t)delete t.client;let L=B&&B!=="load"&&yg(B)?B:"";try{let F=(re)=>re.split("-").map((ce)=>ce.charAt(0).toUpperCase()+ce.slice(1)).join(""),G=O.endsWith(".stx")?O.slice(0,-4):O,D=null,ee=a.__importedComponents;if(ee){let re=[G,G.toLowerCase(),F(G),U(G)];for(let ce of re)if(ee.has(ce)){D=ee.get(ce);break}}let ne=[];if(!D){let re=[`${G}.stx`,`${F(G)}.stx`,`${U(G)}.stx`],ce=[...new Set(re)],_e=a.__originalFilePath,be=[];if(be.push(...c._layerComponentDirs??[]),_e){let ye=ae.join(ae.dirname(_e),"components");be.push(ye)}let Ve=c._rootComponentsDir;if(typeof Ve==="string"&&Oo(n,c)&&!be.includes(Ve))be.push(Ve);if(n&&!be.includes(n))be.push(n);if(typeof Ve==="string"&&!be.includes(Ve))be.push(Ve);let Te=ae.join(ae.dirname(l),"components");if(!be.includes(Te))be.push(Te);if(c.componentsDir&&c.componentsDir!==n&&!be.includes(c.componentsDir))be.push(c.componentsDir);for(let ye of c.additionalComponentsDirs??[])if(ye&&!be.includes(ye))be.push(ye);let ft=c._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(G),pt=(A?.events??[]).map((ye)=>ye.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),yt=Object.hasOwn(t,"checked")||Boolean(A?.reactiveProps?.includes("checked")),ss=Object.hasOwn(t,"value")||Boolean(A?.reactiveProps?.includes("value")),rs=!pt.includes("valuechange")&&(yt||pt.includes("change")&&!ss),mt=c._nativeHostAttrs&&/^textinput$/i.test(G),_t=pt.includes("update:value")&&!pt.includes("input"),qt=c._nativeHostAttrs&&/^video$/i.test(G),is=c._nativeHostAttrs&&/^image$/i.test(G),ln=Ms([...Object.keys(t),...A?.reactiveProps??[]],A?.events,t),wt=Object.hasOwn(t,"src")||Boolean(A?.reactiveProps?.includes("src")),un=Object.hasOwn(t,"source")||Boolean(A?.reactiveProps?.includes("source")),dn=qt&&(wt||un)&&(A?.events??[]).every((ye)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(ye.replace(/^@/,"").split(".")[0])),_n=new Set(["","primary","secondary","outline","ghost","danger"]),$n=typeof t.variant==="string"?t.variant.trim().toLowerCase():"",En=c._nativeHostAttrs&&/^button$/i.test(G)&&!_n.has($n),ur=c._targetComponentFallbackNames?.some((ye)=>ye.toLowerCase()===G.toLowerCase())&&(!ft||rs)&&(!mt||_t)&&(!qt||dn)&&(!is||ln)&&!En;for(let ye of ur?[]:c._targetComponentDirs??[])if(ye&&!be.includes(ye))be.push(ye);let St=typeof c.root==="string"?ae.resolve(c.root):void 0,Ko=St??ae.dirname(l),$t=[];if(St)$t.push(ae.resolve(St,"resources/views/components")),$t.push(ae.resolve(St,"resources/components")),$t.push(ae.resolve(St,"src/components")),$t.push(ae.resolve(St,"components"));$t.push(ae.resolve(import.meta.dir,"components"));for(let ye of $t)if(!be.includes(ye))be.push(ye);let fr=c._pluginComponentDirs;if(Array.isArray(fr)){for(let ye of fr)if(typeof ye==="string"&&!be.includes(ye))be.push(ye)}if(c.fallbackComponentsDir&&!be.includes(c.fallbackComponentsDir))be.push(c.fallbackComponentsDir);if(ur){for(let ye of c._targetComponentDirs??[])if(ye&&!be.includes(ye))be.push(ye)}let kn=c._nativePrimitivesFallback;if(kn&&!kn.except.some((ye)=>ye.toLowerCase()===G.toLowerCase())&&!be.includes(kn.dir))be.push(kn.dir);let pr=[...new Set(be.map((ye)=>{if(!ye)return ye;return ae.isAbsolute(ye)?ye:ae.resolve(Ko,ye)}))];be.length=0,be.push(...pr);let os=`${G}\x00${l}\x00${pr.join("\x00")}`,as=Kn.get(os);if(as)if(await s(as))D=as;else Kn.delete(os);if(!D&&(G.startsWith("./")||G.startsWith("../")))D=ae.resolve(ae.dirname(l),`${G}.stx`),ne.push(D);else if(!D)for(let ye of be){if(!ye)continue;for(let Rn of ce){let Cn=ae.join(ye,Rn);if(ne.push(Cn),await s(Cn)){D=Cn;break}}if(D)break;if(!D)try{let Rn=await import("fs");if(!Rn.statSync(ye,{throwIfNoEntry:!1})?.isDirectory())continue;let Xo=8,cs=[{path:ye,depth:0}];while(cs.length>0&&!D){let An=cs.pop();if(An.depth>=Xo)continue;let dr;try{dr=Rn.readdirSync(An.path,{withFileTypes:!0})}catch{continue}for(let Tn of dr){if(!Tn.isDirectory())continue;if(Tn.name==="node_modules"||Tn.name.startsWith("."))continue;let gr=ae.join(An.path,Tn.name);for(let Jo of ce){let ls=ae.join(gr,Jo);if(ne.push(ls),await s(ls)){D=ls;break}}if(D)break;cs.push({path:gr,depth:An.depth+1})}}}catch{}if(D)break}if(D)Kn.set(os,D)}if(!D||!await s(D))return Ro(e,l,ne),Co(e);v.add(D);let te;if(tn.has(D)&&er.get(D)===So(D))te=tn.get(D);else try{let re=So(D);te=await Bun.file(D).text(),tn.set(D,te),er.set(D,re)}catch(re){let ce=re instanceof Error?re.message:String(re);return Ro(e,l,[D],ce),Co(e)}if(A)for(let re of new Set([...Object.keys(t),...A.reactiveProps??[]])){let ce=re.toLowerCase();if(ce.startsWith("aria-")||ce.startsWith("data-"))continue;let _e=re.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${_e}\\b`).test(te))A.declaredProps.add(re);if(new RegExp(`\\$props\\s*(?:\\.\\s*${_e}\\b|\\[\\s*['"]${_e}['"]\\s*\\])`).test(te)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${_e}['"]`).test(te))A.consumedProps?.add(re)}if(A?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(te))for(let re of A.reactiveProps){if(tu.has(re)||A.consumedProps?.has(re))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${re.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(te))continue;let ce=`${D}\x00${re}`;if(Ao.has(ce))continue;Ao.add(ce),console.warn(`[stx] ${ae.basename(D)} reads \`${re}\` with defineProps(), which is not live, but ${ae.basename(l)} binds it (:${re}): 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('${re}').`)}let le=new Set(["__originalFilePath","__importedComponents",Dn,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),he={};for(let[re,ce]of Object.entries(a))if(!re.startsWith("__")||le.has(re))he[re]=ce;let ue=E.length>0?{[Fn]:[...E]}:{},Ee=i;if(i.includes("@include")){let{processIncludes:re}=await o("stx/includes",()=>import("./chunk-f9yqvq9t.js"));Ee=await re(i,a,l,c,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ee)){let{processComponents:re}=await o("stx/component-renderer",()=>import("./chunk-jxjmbwb9.js")),ce={...a,__processedComponents:j,...ue};Ee=await re(Ee,ce,l,c,v);let _e=ce.__stx_preserved_client_expressions;if(Array.isArray(_e)&&_e.length>0)a.__stx_preserved_client_expressions=[...new Set([...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],..._e])]}let Ae=[];if(Yc(Ee)){let{processExpressions:re}=await o("stx/expressions",()=>import("./chunk-44wcgf44.js")),ce=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...ue}:E.length>0?{...a,...ue}:a;Ee=re(Ee,ce,l);for(let _e of Ee.matchAll(/\{\{([\s\S]*?)\}\}/g))Ae.push(_e[1].trim())}let We=J(Ee),Ke=[],Ye=We.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(re,ce)=>{let _e=We.scripts[Number(ce)]||"",be=_e.match(/^<script\b([^>]*)>/i)?.[1]||"",Ve=be.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Te=!Ve||["module","text/javascript","application/javascript"].includes(Ve),ft=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${be}`);if(!/\bserver\b/i.test(be)&&Te&&!ft)return Ke.push(_e),"";return _e}),{extractSlotContent:Xe}=await o("stx/slots",()=>import("./chunk-q2zsy8vk.js")),et=Xe(Ye),Je={};if(et.defaultSlot?.trim())Je.default=et.defaultSlot;for(let[re,ce]of et.namedSlots)Je[re]=ce.content;let gt=a.__stx_scope_seq??={n:0,key:Vs(String(a.__filename??l))},Ct=Po(e,process.cwd()),it=`stx_${(Ct.endsWith(".stx")?Ct.slice(0,-4):Ct).replace(/[^a-zA-Z0-9]/g,"_")}_${++gt.n}_${gt.key}`,Pe={...he,$uid:it,$native:c._nativeHostAttrs===!0,...t,props:t,slot:Ye,$slots:Je,__processedComponents:P,__sections:{},__stx_signals_gate:ke(te)||Yc(i),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Ae]};if(/import\s/.test(te)){Pe.__importedComponents=new Map(Pe.__importedComponents);let{processESImports:re}=await o("stx/component-renderer",()=>import("./chunk-jxjmbwb9.js"));te=await re(te,Pe,D,c,v)}Yl(te,Pe);let Tt=te,sn=pe(Tt);if(sn)Tt=sn.content.trim();let Yn=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,jt=[...te.matchAll(Yn)];for(let[,re,ce]of jt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(re))Ne(ce,D,c.strict);let Ge=[],Lt=null,Qn=jt.some((re)=>/\bserver\b/.test(re[1]||"")&&/\bcache\b/.test(re[1]||"")),bt=null,ot=null,zt=null,rn=0,Wt=null;if(Hl(c),Qn&&sr>0){let re=ql({props:t,slot:Ee,slotContext:i.trim()?Zl(he):void 0,buildMode:c.buildMode??"",skipEventDirectives:c.skipEventDirectives===!0,native:c._nativeHostAttrs===!0,clientLoopNames:[...E].sort(),layers:c._layerGraph?.layers.map((ce)=>ce.configFile),uid:it});if(re!==null){bt=`${D}\x00${S(te)}\x00${re}`;let ce=Xn.get(bt);if(ce){for(let _e of ce.dependencies)v.add(_e);if(ti(a,ce.clientFactories),gt.n+=ce.uidsConsumed,ce.preservedClientExpressions.length>0){let _e=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let be of ce.preservedClientExpressions)_e.add(be);a.__stx_preserved_client_expressions=[..._e]}return ce.output}ot=new Set(v),zt=Qr(a),rn=gt.n,Wt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let Ft=new Set;for(let re of jt){let ce=re[1]||"",_e=re[2]||"",be=ce.includes("server");if(Be(ce)&&_e.trim())_e=Fe(_e);if(be&&_e){for(let Te of De(_e))Ft.add(Te);try{await H(_e,Pe,D,{onFailure:(Te)=>{if(Te.kind!=="unknown")Lt=Te.kind}})}catch(Te){}}if(!be){let Te=_e.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),ft=Te.includes("{{")&&Te.includes("}}"),pt=Te.includes("{!!")&&Te.includes("!!}");if(ft||pt)Te=xi(Te,Pe,D);let yt=ce.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");Ge.push(`<script${yt}>${Te}</script>`)}}let Qe=J(te).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Vt=Qe?Qe[1]:"",es=Qe?Qe[2]:"",at="",se=Vt&&/\bscoped\b/i.test(Vt);if(Qe)at=`<style${Vt}>${eu(es,Pe,D)}</style>`;let oe=Tt;if(oe=oe.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),Qe)oe=oe.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let re=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,ce=[];if(oe=oe.replace(re,(_e,be)=>{let Ve=be.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Ve)ce.push(`<style${Ve[1]}>${Ve[2]}</style>`);return""}),oe=oe.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),ce.length>0)at=`${at}${ce.join(`
574
+ `)}`}if(i&&oe.includes("{{ text || slot }}"))oe=oe.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>i);let{applySlots:de}=await o("stx/slots",()=>import("./chunk-q2zsy8vk.js")),{defaultSlot:we,namedSlots:Re}=et,qe=a.__stx_signals_gate===!0&&/\s(?:@[\w:.-]+|x-on:[\w:.-]+)\s*=/.test(Ye),tt=Ge.length>0&&ks(oe)||c._nativeHostAttrs===!0&&Ge.length>0||qe&&Ge.length>0||Ge.some((re)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(re)),ts=(re)=>tt?Ki(re,it):re,ns=new Map([...Re].map(([re,ce])=>[re,{...ce,content:ts(ce.content)}]));oe=await de(oe,tt?Zi(ts(we),it):we,ns,Pe,tt?it:"");let on=wi(Ge),Ut=(Array.isArray(Pe.__stx_client_signal_names)?Pe.__stx_client_signal_names:[]).filter((re)=>!Ft.has(re));if(on.length>0||Ut.length>0)Pe.__stx_client_signal_names=[...new Set([...Ut,...on])];else delete Pe.__stx_client_signal_names;let Ht=E.filter((re)=>!Ft.has(re)&&!(re in t));if(Ht.length>0)Pe[Fn]=Ht;let an={...c,_rootComponentsDir:c._rootComponentsDir||c.componentsDir,componentsDir:ae.dirname(D),skipSignalsRuntime:!0,skipEventDirectives:c._nativeHostAttrs===!0||tt||Ge.length===0,defaultLayout:void 0};Pe.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:cn}=await o("stx/process",()=>import("./chunk-bkf2z7zt.js")),nt=await cn(oe,Pe,D,an,v),ut=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let re of nt.matchAll(/\{\{([\s\S]*?)\}\}/g))ut.add(re[1].trim());if(ut.size>0)a.__stx_preserved_client_expressions=[...ut];let lt=it,Ze=nt;if(tt){let re="";if(Object.keys(t).length>0)try{re=` data-stx-props="${Gs(JSON.stringify(t))}"`}catch{}let ce=L?` stx-hydrate="${Gs(L)}"`:"",_e=Object.fromEntries(Object.entries(Je).map(([mt,_t])=>[mt,Boolean(_t)])),be=Object.keys(_e).length>0?` data-stx-slots="${Gs(JSON.stringify(_e))}"`:"",Ve=` data-stx-scope="${lt}"${re}${be}${ce}`,Te=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(nt),ft=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(nt),pt=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<[^>]+\bdata-stx-fill-root(?:\s|=|>)/i.test(nt),yt=Te?"span":"div",ss=ft&&c._nativeHostAttrs?' style="display:flex;flex-direction:column;flex:1;min-height:0;min-width:0"':pt&&c._nativeHostAttrs?' style="width:100%;height:100%"':Te||ft?' style="display:contents"':"";Ze=hg(nt,Ve)??`<${yt}${Ve} data-stx-component-wrapper${ss}>${nt}</${yt}>`;let rs=await Promise.all(Ge.map(async(mt)=>{let _t=mt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!_t)return mt;let[,qt,is]=_t,ln=wo(mt,Pe,D);if(ln!==null)return ln;let wt=await su(is,D,c.buildMode==="compile"),un=bn(wt.clientCode,Le(Pe)),{vendorStyleTags:dn}=wt,_n=un?`function(__scopeId) {
575
575
  ${un}
576
576
  return (${wt.factoryBody})(__scopeId);
577
577
  }`:wt.factoryBody,$n=L?null:ys(a,_n),En=$n?`window.__stxComponentFactories[${JSON.stringify($n)}](${JSON.stringify(lt)});`:`(${_n})(${JSON.stringify(lt)});`;if(L)return`${dn}<script type="stx/island" data-stx-island="${lt}" data-stx-scoped data-stx-owner="${lt}"${qt}>${En}</script>`;return`${dn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${lt}"${qt}>${En}</script>`}));if(Ze=Ze+`
@@ -597,7 +597,7 @@ ${ve.yellow}${ve.bold}Message:${ve.reset} ${t}
597
597
  `,b)A+=`
598
598
  ${ve.blue}${ve.bold}Context:${ve.reset}
599
599
  ${ve.dim}${b}${ve.reset}
600
- `;return A}function ge(){tn.clear(),er.clear(),Kn.clear(),tr.clear(),nr.clear(),Xn.clear()}function Zh(){return{size:tn.size,maxSize:500}}var Qs=w(128);async function su(e,t,i){let n=S(e,t,i),a=Qs.get(n);if(a){if(Ds(a.deps))return a;Qs.delete(n)}let l=yi(e,{filePath:t,projectRoot:process.cwd()}),c=l.code,b=bi(l.styles);c=Mt(c).code;let{hasUserImports:v,bundleClientScript:E}=await o("stx/client-script-bundler",()=>import("./chunk-a7ewznxk.js")),A=[],O=!1;if(v(c)){let G=c;c=await E(G,t,{projectRoot:process.cwd(),minify:i,collectInputs:A}),O=c===G}let{stripStxRuntimeImports:H}=await o("stx/signal-processing",()=>import("./chunk-w9gpscjf.js"));c=H(c);let j=I(c),P=Xl(j),B=new Set(V(j,!0).split(",").map((G)=>G.trim())),L=`function(__scopeId) {
600
+ `;return A}function ge(){tn.clear(),er.clear(),Kn.clear(),tr.clear(),nr.clear(),Xn.clear()}function Zh(){return{size:tn.size,maxSize:500}}var Qs=w(128);async function su(e,t,i){let n=S(e,t,i),a=Qs.get(n);if(a){if(Ds(a.deps))return a;Qs.delete(n)}let l=yi(e,{filePath:t,projectRoot:process.cwd()}),c=l.code,b=bi(l.styles);c=Mt(c).code;let{hasUserImports:v,bundleClientScript:E}=await o("stx/client-script-bundler",()=>import("./chunk-32xv3q66.js")),A=[],O=!1;if(v(c)){let G=c;c=await E(G,t,{projectRoot:process.cwd(),minify:i,collectInputs:A}),O=c===G}let{stripStxRuntimeImports:H}=await o("stx/signal-processing",()=>import("./chunk-atbzg7vw.js"));c=H(c);let j=I(c),P=Xl(j),B=new Set(V(j,!0).split(",").map((G)=>G.trim())),L=`function(__scopeId) {
601
601
  ${ct("const",[...pl,...P],j)}
602
602
  const __scope = window.stx._scopes = window.stx._scopes || {};
603
603
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{yt,Vn,gh}from"./chunk-d9s37xm5.js";import{ue,Un,mh,Wn,vo,Gr,Jr,hh,yh,bh,qn,Kn,xo,Yr,wh}from"./chunk-wvds0s9m.js";import"./chunk-04z1xyrb.js";export{vo as batch,gh as default,Un as derived,Wn as effect,yt as generateSignalsRuntime,Vn as generateSignalsRuntimeDev,Kn as isDerived,qn as isSignal,mh as memo,Jr as onDestroy,Gr as onMount,Yr as peek,bh as pendingLifecycleCounts,yh as runDestroyCallbacks,hh as runMountCallbacks,ue as state,xo as untrack,wh as useOptimistic};
2
+ import{yt,Vn,gh}from"./chunk-qy6dtm1a.js";import{ue,Un,mh,Wn,vo,Gr,Jr,hh,yh,bh,qn,Kn,xo,Yr,wh}from"./chunk-wvds0s9m.js";import"./chunk-04z1xyrb.js";export{vo as batch,gh as default,Un as derived,Wn as effect,yt as generateSignalsRuntime,Vn as generateSignalsRuntimeDev,Kn as isDerived,qn as isSignal,mh as memo,Jr as onDestroy,Gr as onMount,Yr as peek,bh as pendingLifecycleCounts,yh as runDestroyCallbacks,hh as runMountCallbacks,ue as state,xo as untrack,wh as useOptimistic};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{ut,dt,pt}from"./chunk-ema1c29k.js";import"./chunk-04z1xyrb.js";import"./chunk-8y8kgw9s.js";import"./chunk-c9mdvpf5.js";import{m}from"./chunk-xj3my6b9.js";import"./chunk-2qngyyaz.js";import"./chunk-yv1vw0kx.js";import{Ut,no,Wt,Wi,lt,qi,ro,qt,Xi,Kt}from"./chunk-qnrgfm9v.js";import M from"fs";import x from"path";function E(t,e){let r=[x.join(t.root,"stx.config.ts"),x.join(t.root,"stx.config.js"),x.join(t.root,"stx.config.mjs")],s=e.debounceMs??300,o=null,a=[];for(let c of r)try{if(!M.existsSync(c))continue;let n=M.watch(c,(d)=>{if(d==="change"){if(o)clearTimeout(o);o=setTimeout(async()=>{qi("Config file changed, restarting...");try{await e.onChange()}catch(p){lt(`Failed to restart: ${p}`)}},s)}});a.push(n)}catch{}return{stop(){if(o)clearTimeout(o);for(let c of a)c.close()}}}import w from"fs";import j from"path";var nt=".stx/story/analytics.json",st=1,A=1e4;class k{storage;storagePath;currentSession=null;dirty=!1;viewStartTimes=new Map;constructor(t){this.storagePath=j.join(t,nt),this.storage=this.loadStorage(),this.startSession()}loadStorage(){try{let t=w.readFileSync(this.storagePath,"utf-8");return JSON.parse(t)}catch{return{version:st,events:[],sessions:[]}}}async save(){if(!this.dirty)return;let t=j.dirname(this.storagePath);if(await w.promises.mkdir(t,{recursive:!0}),this.storage.events.length>A)this.storage.events=this.storage.events.slice(-A);await w.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}startSession(){this.endSession(),this.currentSession={id:at(),startTime:Date.now(),componentViews:[]},this.storage.sessions.push(this.currentSession),this.dirty=!0}endSession(){if(this.currentSession)this.currentSession.endTime=Date.now(),this.currentSession=null}track(t){this.storage.events.push({...t,timestamp:Date.now()}),this.dirty=!0}trackView(t,e){if(this.endViewTiming(t),this.viewStartTimes.set(t,Date.now()),this.track({type:"view",componentId:t,variantId:e}),this.currentSession&&!this.currentSession.componentViews.includes(t))this.currentSession.componentViews.push(t)}endViewTiming(t){let e=this.viewStartTimes.get(t);if(e){let r=Date.now()-e;this.track({type:"view",componentId:t,metadata:{duration:r,endView:!0}}),this.viewStartTimes.delete(t)}}trackPropChange(t,e,r){this.track({type:"prop_change",componentId:t,propName:e,metadata:{value:r}})}trackVariantSwitch(t,e){this.track({type:"variant_switch",componentId:t,variantId:e})}trackSearch(t,e){this.track({type:"search",query:t,metadata:{resultCount:e}})}getComponentAnalytics(t,e){let r=this.storage.events.filter((i)=>i.componentId===t),s=r.filter((i)=>i.type==="view"&&!i.metadata?.endView),o=r.filter((i)=>i.type==="prop_change"),a=r.filter((i)=>i.type==="variant_switch"),c={};for(let i of o)if(i.propName)c[i.propName]=(c[i.propName]||0)+1;let n={};for(let i of a)if(i.variantId)n[i.variantId]=(n[i.variantId]||0)+1;let d=new Set(this.storage.sessions.filter((i)=>i.componentViews.includes(t)).map((i)=>i.id)),p=r.filter((i)=>i.metadata?.duration).map((i)=>i.metadata.duration),g=p.length>0?p.reduce((i,l)=>i+l,0)/p.length:0,y=Object.entries(c).sort((i,l)=>l[1]-i[1]).slice(0,5).map(([i])=>i);return{componentId:t,componentName:e,viewCount:s.length,uniqueViews:d.size,lastViewed:s[s.length-1]?.timestamp,propChanges:c,topChangedProps:y,variantViews:n,avgTimeSpent:g}}getMostViewedComponents(t=10){let e=new Map;for(let r of this.storage.events)if(r.type==="view"&&r.componentId&&!r.metadata?.endView)e.set(r.componentId,(e.get(r.componentId)||0)+1);return Array.from(e.entries()).map(([r,s])=>({componentId:r,viewCount:s})).sort((r,s)=>s.viewCount-r.viewCount).slice(0,t)}getMostChangedProps(t=10){let e=new Map;for(let r of this.storage.events)if(r.type==="prop_change"&&r.propName)e.set(r.propName,(e.get(r.propName)||0)+1);return Array.from(e.entries()).map(([r,s])=>({propName:r,changeCount:s})).sort((r,s)=>s.changeCount-r.changeCount).slice(0,t)}getSearchAnalytics(){let t=this.storage.events.filter((o)=>o.type==="search"),e=new Map,r=0;for(let o of t){if(o.query)e.set(o.query,(e.get(o.query)||0)+1);if(o.metadata?.resultCount!==void 0)r+=o.metadata.resultCount}let s=Array.from(e.entries()).map(([o,a])=>({query:o,count:a})).sort((o,a)=>a.count-o.count).slice(0,10);return{totalSearches:t.length,topQueries:s,avgResultCount:t.length>0?r/t.length:0}}clear(){this.storage.events=[],this.storage.sessions=[],this.dirty=!0,this.startSession()}exportAnalytics(){return JSON.stringify({exportedAt:Date.now(),...this.storage},null,2)}}function at(){return`session-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import S from"fs";import B from"path";var it=".stx/story/bookmarks.json",ct=1;class P{storage;storagePath;dirty=!1;constructor(t){this.storagePath=B.join(t,it),this.storage=this.loadStorage()}loadStorage(){try{let t=S.readFileSync(this.storagePath,"utf-8");return JSON.parse(t)}catch{return{version:ct,bookmarks:[]}}}async save(){if(!this.dirty)return;let t=B.dirname(this.storagePath);await S.promises.mkdir(t,{recursive:!0}),await S.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}addBookmark(t,e,r,s={}){let o={id:mt(),name:s.name||`${t}/${e}`,storyId:t,variantId:e,props:r,created:Date.now(),notes:s.notes,color:s.color};return this.storage.bookmarks.push(o),this.dirty=!0,o}getAllBookmarks(){return[...this.storage.bookmarks]}getBookmarksForStory(t){return this.storage.bookmarks.filter((e)=>e.storyId===t)}getBookmark(t){return this.storage.bookmarks.find((e)=>e.id===t)}isBookmarked(t,e){return this.storage.bookmarks.some((r)=>r.storyId===t&&r.variantId===e)}updateBookmark(t,e){let r=this.getBookmark(t);if(!r)return;return Object.assign(r,e),this.dirty=!0,r}deleteBookmark(t){let e=this.storage.bookmarks.findIndex((r)=>r.id===t);if(e===-1)return!1;return this.storage.bookmarks.splice(e,1),this.dirty=!0,!0}toggleBookmark(t,e,r){let s=this.storage.bookmarks.find((a)=>a.storyId===t&&a.variantId===e);if(s)return this.deleteBookmark(s.id),{added:!1};return{added:!0,bookmark:this.addBookmark(t,e,r)}}exportBookmarks(){return JSON.stringify(this.storage,null,2)}importBookmarks(t,e=!0){let r=JSON.parse(t),s=0;for(let o of r.bookmarks){if(e){let a=this.storage.bookmarks.find((c)=>c.id===o.id);if(a)Object.assign(a,o);else this.storage.bookmarks.push(o)}else this.storage.bookmarks.push(o);s++}if(s>0)this.dirty=!0;return s}}function mt(){return`bm-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}var v=new Set;function N(){return{open(t){v.add(t),t.send(JSON.stringify({type:"connected",timestamp:Date.now()}))},close(t){v.delete(t)},message(t,e){}}}function C(t){let e=JSON.stringify({...t,timestamp:t.timestamp||Date.now()});for(let r of v)try{r.send(e)}catch{v.delete(r)}}function V(t,e){C({type:"story-update",data:{storyId:t,...e}})}function H(t,e){C({type:"story-add",data:{storyId:t,...e}})}function O(t){C({type:"story-remove",data:{storyId:t}})}function F(t){return`
2
+ import{ut,dt,pt}from"./chunk-ema1c29k.js";import"./chunk-04z1xyrb.js";import"./chunk-8y8kgw9s.js";import"./chunk-c9mdvpf5.js";import{m}from"./chunk-zgf3nss0.js";import"./chunk-2qngyyaz.js";import"./chunk-tdq1bq8x.js";import{Ut,no,Wt,Wi,lt,qi,ro,qt,Xi,Kt}from"./chunk-qnrgfm9v.js";import M from"fs";import x from"path";function E(t,e){let r=[x.join(t.root,"stx.config.ts"),x.join(t.root,"stx.config.js"),x.join(t.root,"stx.config.mjs")],s=e.debounceMs??300,o=null,a=[];for(let c of r)try{if(!M.existsSync(c))continue;let n=M.watch(c,(d)=>{if(d==="change"){if(o)clearTimeout(o);o=setTimeout(async()=>{qi("Config file changed, restarting...");try{await e.onChange()}catch(p){lt(`Failed to restart: ${p}`)}},s)}});a.push(n)}catch{}return{stop(){if(o)clearTimeout(o);for(let c of a)c.close()}}}import w from"fs";import j from"path";var nt=".stx/story/analytics.json",st=1,A=1e4;class k{storage;storagePath;currentSession=null;dirty=!1;viewStartTimes=new Map;constructor(t){this.storagePath=j.join(t,nt),this.storage=this.loadStorage(),this.startSession()}loadStorage(){try{let t=w.readFileSync(this.storagePath,"utf-8");return JSON.parse(t)}catch{return{version:st,events:[],sessions:[]}}}async save(){if(!this.dirty)return;let t=j.dirname(this.storagePath);if(await w.promises.mkdir(t,{recursive:!0}),this.storage.events.length>A)this.storage.events=this.storage.events.slice(-A);await w.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}startSession(){this.endSession(),this.currentSession={id:at(),startTime:Date.now(),componentViews:[]},this.storage.sessions.push(this.currentSession),this.dirty=!0}endSession(){if(this.currentSession)this.currentSession.endTime=Date.now(),this.currentSession=null}track(t){this.storage.events.push({...t,timestamp:Date.now()}),this.dirty=!0}trackView(t,e){if(this.endViewTiming(t),this.viewStartTimes.set(t,Date.now()),this.track({type:"view",componentId:t,variantId:e}),this.currentSession&&!this.currentSession.componentViews.includes(t))this.currentSession.componentViews.push(t)}endViewTiming(t){let e=this.viewStartTimes.get(t);if(e){let r=Date.now()-e;this.track({type:"view",componentId:t,metadata:{duration:r,endView:!0}}),this.viewStartTimes.delete(t)}}trackPropChange(t,e,r){this.track({type:"prop_change",componentId:t,propName:e,metadata:{value:r}})}trackVariantSwitch(t,e){this.track({type:"variant_switch",componentId:t,variantId:e})}trackSearch(t,e){this.track({type:"search",query:t,metadata:{resultCount:e}})}getComponentAnalytics(t,e){let r=this.storage.events.filter((i)=>i.componentId===t),s=r.filter((i)=>i.type==="view"&&!i.metadata?.endView),o=r.filter((i)=>i.type==="prop_change"),a=r.filter((i)=>i.type==="variant_switch"),c={};for(let i of o)if(i.propName)c[i.propName]=(c[i.propName]||0)+1;let n={};for(let i of a)if(i.variantId)n[i.variantId]=(n[i.variantId]||0)+1;let d=new Set(this.storage.sessions.filter((i)=>i.componentViews.includes(t)).map((i)=>i.id)),p=r.filter((i)=>i.metadata?.duration).map((i)=>i.metadata.duration),g=p.length>0?p.reduce((i,l)=>i+l,0)/p.length:0,y=Object.entries(c).sort((i,l)=>l[1]-i[1]).slice(0,5).map(([i])=>i);return{componentId:t,componentName:e,viewCount:s.length,uniqueViews:d.size,lastViewed:s[s.length-1]?.timestamp,propChanges:c,topChangedProps:y,variantViews:n,avgTimeSpent:g}}getMostViewedComponents(t=10){let e=new Map;for(let r of this.storage.events)if(r.type==="view"&&r.componentId&&!r.metadata?.endView)e.set(r.componentId,(e.get(r.componentId)||0)+1);return Array.from(e.entries()).map(([r,s])=>({componentId:r,viewCount:s})).sort((r,s)=>s.viewCount-r.viewCount).slice(0,t)}getMostChangedProps(t=10){let e=new Map;for(let r of this.storage.events)if(r.type==="prop_change"&&r.propName)e.set(r.propName,(e.get(r.propName)||0)+1);return Array.from(e.entries()).map(([r,s])=>({propName:r,changeCount:s})).sort((r,s)=>s.changeCount-r.changeCount).slice(0,t)}getSearchAnalytics(){let t=this.storage.events.filter((o)=>o.type==="search"),e=new Map,r=0;for(let o of t){if(o.query)e.set(o.query,(e.get(o.query)||0)+1);if(o.metadata?.resultCount!==void 0)r+=o.metadata.resultCount}let s=Array.from(e.entries()).map(([o,a])=>({query:o,count:a})).sort((o,a)=>a.count-o.count).slice(0,10);return{totalSearches:t.length,topQueries:s,avgResultCount:t.length>0?r/t.length:0}}clear(){this.storage.events=[],this.storage.sessions=[],this.dirty=!0,this.startSession()}exportAnalytics(){return JSON.stringify({exportedAt:Date.now(),...this.storage},null,2)}}function at(){return`session-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import S from"fs";import B from"path";var it=".stx/story/bookmarks.json",ct=1;class P{storage;storagePath;dirty=!1;constructor(t){this.storagePath=B.join(t,it),this.storage=this.loadStorage()}loadStorage(){try{let t=S.readFileSync(this.storagePath,"utf-8");return JSON.parse(t)}catch{return{version:ct,bookmarks:[]}}}async save(){if(!this.dirty)return;let t=B.dirname(this.storagePath);await S.promises.mkdir(t,{recursive:!0}),await S.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}addBookmark(t,e,r,s={}){let o={id:mt(),name:s.name||`${t}/${e}`,storyId:t,variantId:e,props:r,created:Date.now(),notes:s.notes,color:s.color};return this.storage.bookmarks.push(o),this.dirty=!0,o}getAllBookmarks(){return[...this.storage.bookmarks]}getBookmarksForStory(t){return this.storage.bookmarks.filter((e)=>e.storyId===t)}getBookmark(t){return this.storage.bookmarks.find((e)=>e.id===t)}isBookmarked(t,e){return this.storage.bookmarks.some((r)=>r.storyId===t&&r.variantId===e)}updateBookmark(t,e){let r=this.getBookmark(t);if(!r)return;return Object.assign(r,e),this.dirty=!0,r}deleteBookmark(t){let e=this.storage.bookmarks.findIndex((r)=>r.id===t);if(e===-1)return!1;return this.storage.bookmarks.splice(e,1),this.dirty=!0,!0}toggleBookmark(t,e,r){let s=this.storage.bookmarks.find((a)=>a.storyId===t&&a.variantId===e);if(s)return this.deleteBookmark(s.id),{added:!1};return{added:!0,bookmark:this.addBookmark(t,e,r)}}exportBookmarks(){return JSON.stringify(this.storage,null,2)}importBookmarks(t,e=!0){let r=JSON.parse(t),s=0;for(let o of r.bookmarks){if(e){let a=this.storage.bookmarks.find((c)=>c.id===o.id);if(a)Object.assign(a,o);else this.storage.bookmarks.push(o)}else this.storage.bookmarks.push(o);s++}if(s>0)this.dirty=!0;return s}}function mt(){return`bm-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}var v=new Set;function N(){return{open(t){v.add(t),t.send(JSON.stringify({type:"connected",timestamp:Date.now()}))},close(t){v.delete(t)},message(t,e){}}}function C(t){let e=JSON.stringify({...t,timestamp:t.timestamp||Date.now()});for(let r of v)try{r.send(e)}catch{v.delete(r)}}function V(t,e){C({type:"story-update",data:{storyId:t,...e}})}function H(t,e){C({type:"story-add",data:{storyId:t,...e}})}function O(t){C({type:"story-remove",data:{storyId:t}})}function F(t){return`
3
3
  <script>
4
4
  (function() {
5
5
  const ws = new WebSocket('${t}');
@@ -556,7 +556,7 @@ window.__stxPerformance = {
556
556
 
557
557
  window.clearPerformanceMetrics = () => window.__stxPerformance.clear();
558
558
  </script>
559
- `}import T from"fs";import K from"path";var ft=".stx/story/presets.json",R=1,yt=10;class I{storage;storagePath;dirty=!1;constructor(t){this.storagePath=K.join(t,ft),this.storage=this.loadStorage()}loadStorage(){try{let t=T.readFileSync(this.storagePath,"utf-8"),e=JSON.parse(t);if(e.version!==R)return this.migrateStorage(e);return e}catch{return{version:R,presets:[],recentIds:[]}}}migrateStorage(t){return{version:R,presets:t.presets||[],recentIds:t.recentIds||[]}}async save(){if(!this.dirty)return;let t=K.dirname(this.storagePath);await T.promises.mkdir(t,{recursive:!0}),await T.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}createPreset(t,e,r={}){let s={id:ht(),name:t,description:r.description,props:e,componentId:r.componentId,created:Date.now(),usageCount:0,tags:r.tags};return this.storage.presets.push(s),this.dirty=!0,s}getPreset(t){return this.storage.presets.find((e)=>e.id===t)}getAllPresets(){return[...this.storage.presets]}getPresetsForComponent(t){return this.storage.presets.filter((e)=>!e.componentId||e.componentId===t)}getRecentPresets(){return this.storage.recentIds.map((t)=>this.getPreset(t)).filter((t)=>t!==void 0)}usePreset(t){let e=this.getPreset(t);if(!e)return;return e.lastUsed=Date.now(),e.usageCount++,this.storage.recentIds=[t,...this.storage.recentIds.filter((r)=>r!==t)].slice(0,yt),this.dirty=!0,e}updatePreset(t,e){let r=this.getPreset(t);if(!r)return;return Object.assign(r,e),this.dirty=!0,r}deletePreset(t){let e=this.storage.presets.findIndex((r)=>r.id===t);if(e===-1)return!1;return this.storage.presets.splice(e,1),this.storage.recentIds=this.storage.recentIds.filter((r)=>r!==t),this.dirty=!0,!0}searchPresets(t){let e=t.toLowerCase();return this.storage.presets.filter((r)=>{if(r.name.toLowerCase().includes(e))return!0;if(r.description?.toLowerCase().includes(e))return!0;if(r.tags?.some((s)=>s.toLowerCase().includes(e)))return!0;return!1})}getMostUsedPresets(t=5){return[...this.storage.presets].sort((e,r)=>r.usageCount-e.usageCount).slice(0,t)}exportPresets(t){let e=t?this.storage.presets.filter((r)=>t.includes(r.id)):this.storage.presets;return JSON.stringify({presets:e},null,2)}importPresets(t,e=!1){let r=JSON.parse(t),s=0;for(let o of r.presets){let a=this.storage.presets.find((c)=>c.id===o.id);if(a&&!e)continue;if(a)Object.assign(a,o);else this.storage.presets.push(o);s++}if(s>0)this.dirty=!0;return s}}function ht(){return`preset-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import _ from"fs";var q=new Map;async function b(t,e,r={}){let s=performance.now(),o=[];try{let a=await _.promises.stat(e),c=q.get(e),n;if(c&&c.mtime===a.mtimeMs)n=c.content;else n=await _.promises.readFile(e,"utf-8"),q.set(e,{content:n,mtime:a.mtimeMs,analyzed:null});let{processDirectives:d}=await import("./chunk-3vsz0vrk.js"),p={},g=h(n);if(g)try{await m(g,p,e)}catch(f){o.push(`Warning: Could not extract script variables: ${f instanceof Error?f.message:String(f)}`)}if(r.props)Object.assign(p,r.props);let i=await d(n,p,e,{},new Set),l=Z(n),u=h(n);return i=Q(i),i=tt(i,p),{html:i,css:l,js:u,errors:o,duration:performance.now()-s}}catch(a){return o.push(a instanceof Error?a.message:String(a)),{html:`<div class="stx-render-error">${et(o[0])}</div>`,css:"",js:"",errors:o,duration:performance.now()-s}}}async function vt(t){try{let e=await _.promises.readFile(t,"utf-8"),r=h(e);if(!r)return null;let s={};if(await m(r,s,t),Array.isArray(s.variants))return s.variants;return null}catch{return null}}async function Y(t,e,r,s){let o=e.story?.variants;if(!o){let n=await vt(e.path);if(n)o=n}if(!o&&r==="default")return b(t,e.path,{props:s||{}});if(!o)return b(t,e.path,{props:s||{}});let a=o.find((n)=>n.id===r);if(!a&&r==="default")return b(t,e.path,{props:s||{}});if(!a)return{html:'<div class="stx-render-error">Variant not found</div>',css:"",js:"",errors:[`Variant '${r}' not found`],duration:0};let c={...a.state,...s};if(a.source)return bt(t,a.source,c);return b(t,e.path,{props:c})}async function bt(t,e,r={}){let s=performance.now(),o=[];try{let{processDirectives:a}=await import("./chunk-3vsz0vrk.js"),c={...r},n=h(e);if(n)try{await m(n,c,"inline-template.stx")}catch{}let p=await a(e,c,"inline-template.stx",{},new Set);return p=Q(p),p=tt(p,c),{html:p,css:Z(e),js:h(e),errors:o,duration:performance.now()-s}}catch(a){return o.push(a instanceof Error?a.message:String(a)),{html:`<div class="stx-render-error">${et(o[0])}</div>`,css:"",js:"",errors:o,duration:performance.now()-s}}}function Z(t){let e=[],r=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,s=r.exec(t);while(s!==null)e.push(s[1].trim()),s=r.exec(t);return e.join(`
559
+ `}import T from"fs";import K from"path";var ft=".stx/story/presets.json",R=1,yt=10;class I{storage;storagePath;dirty=!1;constructor(t){this.storagePath=K.join(t,ft),this.storage=this.loadStorage()}loadStorage(){try{let t=T.readFileSync(this.storagePath,"utf-8"),e=JSON.parse(t);if(e.version!==R)return this.migrateStorage(e);return e}catch{return{version:R,presets:[],recentIds:[]}}}migrateStorage(t){return{version:R,presets:t.presets||[],recentIds:t.recentIds||[]}}async save(){if(!this.dirty)return;let t=K.dirname(this.storagePath);await T.promises.mkdir(t,{recursive:!0}),await T.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}createPreset(t,e,r={}){let s={id:ht(),name:t,description:r.description,props:e,componentId:r.componentId,created:Date.now(),usageCount:0,tags:r.tags};return this.storage.presets.push(s),this.dirty=!0,s}getPreset(t){return this.storage.presets.find((e)=>e.id===t)}getAllPresets(){return[...this.storage.presets]}getPresetsForComponent(t){return this.storage.presets.filter((e)=>!e.componentId||e.componentId===t)}getRecentPresets(){return this.storage.recentIds.map((t)=>this.getPreset(t)).filter((t)=>t!==void 0)}usePreset(t){let e=this.getPreset(t);if(!e)return;return e.lastUsed=Date.now(),e.usageCount++,this.storage.recentIds=[t,...this.storage.recentIds.filter((r)=>r!==t)].slice(0,yt),this.dirty=!0,e}updatePreset(t,e){let r=this.getPreset(t);if(!r)return;return Object.assign(r,e),this.dirty=!0,r}deletePreset(t){let e=this.storage.presets.findIndex((r)=>r.id===t);if(e===-1)return!1;return this.storage.presets.splice(e,1),this.storage.recentIds=this.storage.recentIds.filter((r)=>r!==t),this.dirty=!0,!0}searchPresets(t){let e=t.toLowerCase();return this.storage.presets.filter((r)=>{if(r.name.toLowerCase().includes(e))return!0;if(r.description?.toLowerCase().includes(e))return!0;if(r.tags?.some((s)=>s.toLowerCase().includes(e)))return!0;return!1})}getMostUsedPresets(t=5){return[...this.storage.presets].sort((e,r)=>r.usageCount-e.usageCount).slice(0,t)}exportPresets(t){let e=t?this.storage.presets.filter((r)=>t.includes(r.id)):this.storage.presets;return JSON.stringify({presets:e},null,2)}importPresets(t,e=!1){let r=JSON.parse(t),s=0;for(let o of r.presets){let a=this.storage.presets.find((c)=>c.id===o.id);if(a&&!e)continue;if(a)Object.assign(a,o);else this.storage.presets.push(o);s++}if(s>0)this.dirty=!0;return s}}function ht(){return`preset-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import _ from"fs";var q=new Map;async function b(t,e,r={}){let s=performance.now(),o=[];try{let a=await _.promises.stat(e),c=q.get(e),n;if(c&&c.mtime===a.mtimeMs)n=c.content;else n=await _.promises.readFile(e,"utf-8"),q.set(e,{content:n,mtime:a.mtimeMs,analyzed:null});let{processDirectives:d}=await import("./chunk-bkf2z7zt.js"),p={},g=h(n);if(g)try{await m(g,p,e)}catch(f){o.push(`Warning: Could not extract script variables: ${f instanceof Error?f.message:String(f)}`)}if(r.props)Object.assign(p,r.props);let i=await d(n,p,e,{},new Set),l=Z(n),u=h(n);return i=Q(i),i=tt(i,p),{html:i,css:l,js:u,errors:o,duration:performance.now()-s}}catch(a){return o.push(a instanceof Error?a.message:String(a)),{html:`<div class="stx-render-error">${et(o[0])}</div>`,css:"",js:"",errors:o,duration:performance.now()-s}}}async function vt(t){try{let e=await _.promises.readFile(t,"utf-8"),r=h(e);if(!r)return null;let s={};if(await m(r,s,t),Array.isArray(s.variants))return s.variants;return null}catch{return null}}async function Y(t,e,r,s){let o=e.story?.variants;if(!o){let n=await vt(e.path);if(n)o=n}if(!o&&r==="default")return b(t,e.path,{props:s||{}});if(!o)return b(t,e.path,{props:s||{}});let a=o.find((n)=>n.id===r);if(!a&&r==="default")return b(t,e.path,{props:s||{}});if(!a)return{html:'<div class="stx-render-error">Variant not found</div>',css:"",js:"",errors:[`Variant '${r}' not found`],duration:0};let c={...a.state,...s};if(a.source)return bt(t,a.source,c);return b(t,e.path,{props:c})}async function bt(t,e,r={}){let s=performance.now(),o=[];try{let{processDirectives:a}=await import("./chunk-bkf2z7zt.js"),c={...r},n=h(e);if(n)try{await m(n,c,"inline-template.stx")}catch{}let p=await a(e,c,"inline-template.stx",{},new Set);return p=Q(p),p=tt(p,c),{html:p,css:Z(e),js:h(e),errors:o,duration:performance.now()-s}}catch(a){return o.push(a instanceof Error?a.message:String(a)),{html:`<div class="stx-render-error">${et(o[0])}</div>`,css:"",js:"",errors:o,duration:performance.now()-s}}}function Z(t){let e=[],r=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,s=r.exec(t);while(s!==null)e.push(s[1].trim()),s=r.exec(t);return e.join(`
560
560
  `)}function Q(t){return t.replace(/<!--[\s\S]*?-->/g,"").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"").replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/^\s*\n/gm,"").trim()}function h(t){let e=[],r=/<script\b[^>]*>([\s\S]*?)<\/script>/gi,s=r.exec(t);while(s!==null)e.push(s[1].trim()),s=r.exec(t);return e.join(`
561
561
  `)}function tt(t,e){let r=`<script>window.__stxProps = ${JSON.stringify(e)};</script>`;return t+r}function et(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}async function rt(t,e){let r=await qt(t);dt(t,r);let s=Kt(t.config,r);pt(t,s),console.log(` Found ${r.length} story files`);let o=typeof e.host==="string"?e.host:e.host===!0?"0.0.0.0":"localhost",a=new I(t.root),c=new P(t.root),n=new k(t.root),d=N(),p=Bun.serve({port:e.port,hostname:o,fetch:async(i,l)=>{let f=new URL(i.url).pathname;if(f==="/__hmr"){if(l.upgrade(i,{data:{isHmr:!0}}))return;return new Response("WebSocket upgrade failed",{status:400})}if(f.startsWith("/api/"))return xt(t,f,i,{presetsManager:a,bookmarksManager:c,analyticsTracker:n});return wt(t,f,e.port)},websocket:{open(i){d.open(i)},close(i){d.close(i)},message(i,l){d.message(i,l)}}}),g=`http://${o}:${e.port}`,y=Xi(t,async(i,l)=>{console.log(` [${i}] ${l.relativePath}`);let u=await qt(t);dt(t,u);let f=Kt(t.config,u);if(pt(t,f),i==="add")H(l.id,{fileName:l.fileName});else if(i==="unlink")O(l.id);else V(l.id,{fileName:l.fileName})});if(e.open){let i=g;try{let{exec:l}=await import("child_process"),u=process.platform;l(`${u==="darwin"?"open":u==="win32"?"start":"xdg-open"} ${i}`)}catch{}}return{server:p,url:g,close:async()=>{y(),p.stop()}}}async function xt(t,e,r,s){let{presetsManager:o,bookmarksManager:a,analyticsTracker:c}=s;if(e==="/api/stories")return Response.json({files:t.storyFiles.map((n)=>({id:n.id,fileName:n.fileName,relativePath:n.relativePath,treePath:n.treePath})),tree:t.tree});if(e.startsWith("/api/story/")){let n=e.slice(11),d=t.storyFiles.find((p)=>p.id===n);if(!d)return new Response("Story not found",{status:404});try{let p=await Bun.file(d.path).text();return Response.json({id:d.id,fileName:d.fileName,relativePath:d.relativePath,content:p})}catch{return new Response("Error reading story",{status:500})}}if(e==="/api/config")return Response.json({theme:t.config.theme,responsivePresets:t.config.responsivePresets,backgroundPresets:t.config.backgroundPresets});if(e.startsWith("/api/render/")){let n=new URL(r.url),d=e.slice(12).split("/"),p=d[0],g=d[1]||"default",y,i=n.searchParams.get("props");if(i)try{y=JSON.parse(i)}catch{}let l=t.storyFiles.find((u)=>u.id===p);if(!l)return new Response("Story not found",{status:404});try{let u=await Y(t,l,g,y);return Response.json({html:u.html,css:u.css,js:u.js,errors:u.errors,duration:u.duration})}catch(u){return Response.json({html:"",css:"",js:"",errors:[u instanceof Error?u.message:String(u)],duration:0},{status:500})}}if(e==="/api/presets"&&r.method==="GET")return Response.json({presets:o.getAllPresets()});if(e==="/api/presets"&&r.method==="POST")try{let n=await r.json(),d=o.createPreset(n.name,n.props,{componentId:n.componentId,description:n.description});return await o.save(),Response.json(d)}catch(n){return Response.json({error:String(n)},{status:400})}if(e.startsWith("/api/presets/")&&!e.includes("/use")&&r.method==="GET"){let n=e.slice(13),d=o.getPreset(n);if(!d)return new Response("Preset not found",{status:404});return Response.json(d)}if(e.endsWith("/use")&&r.method==="POST"){let n=e.slice(13,-4),d=o.usePreset(n);if(!d)return new Response("Preset not found",{status:404});return await o.save(),Response.json(d)}if(e.startsWith("/api/presets/")&&r.method==="DELETE"){let n=e.slice(13);if(!o.deletePreset(n))return new Response("Preset not found",{status:404});return await o.save(),Response.json({success:!0})}if(e==="/api/bookmarks"&&r.method==="GET")return Response.json({bookmarks:a.getAllBookmarks()});if(e==="/api/bookmarks"&&r.method==="POST")try{let n=await r.json(),d=a.addBookmark(n.storyId,n.variantId,n.props,{name:n.name,notes:n.notes,color:n.color});return await a.save(),Response.json(d)}catch(n){return Response.json({error:String(n)},{status:400})}if(e==="/api/bookmarks/toggle"&&r.method==="POST")try{let n=await r.json(),d=a.toggleBookmark(n.storyId,n.variantId,n.props);return await a.save(),Response.json(d)}catch(n){return Response.json({error:String(n)},{status:400})}if(e.startsWith("/api/bookmarks/")&&e!=="/api/bookmarks/toggle"&&r.method==="GET"){let n=e.slice(15),d=a.getBookmark(n);if(!d)return new Response("Bookmark not found",{status:404});return Response.json(d)}if(e.startsWith("/api/bookmarks/")&&r.method==="DELETE"){let n=e.slice(15);if(!a.deleteBookmark(n))return new Response("Bookmark not found",{status:404});return await a.save(),Response.json({success:!0})}if(e==="/api/analytics/track"&&r.method==="POST")try{let n=await r.json();if(n.type==="view"&&n.componentId)c.trackView(n.componentId,n.variantId);else if(n.type==="prop_change"&&n.componentId&&n.propName)c.trackPropChange(n.componentId,n.propName,null);else if(n.type==="variant_switch"&&n.componentId&&n.variantId)c.trackVariantSwitch(n.componentId,n.variantId);else if(n.type==="search"&&n.query)c.trackSearch(n.query,0);return await c.save(),Response.json({success:!0})}catch(n){return Response.json({error:String(n)},{status:400})}if(e==="/api/analytics/summary"&&r.method==="GET")return Response.json({mostViewed:c.getMostViewedComponents(10),mostChangedProps:c.getMostChangedProps(10),searchAnalytics:c.getSearchAnalytics()});if(e.startsWith("/api/analytics/component/")&&r.method==="GET"){let n=e.slice(25),d=t.storyFiles.find((g)=>g.id===n),p=c.getComponentAnalytics(n,d?.fileName||n);return Response.json(p)}return new Response("Not found",{status:404})}function wt(t,e,r){let s=kt(t,r);return new Response(s,{headers:{"Content-Type":"text/html; charset=utf-8"}})}function kt(t,e){let{theme:r}=t.config,s=r.title||"STX Story",o=`ws://localhost:${e}/__hmr`,a=F(o);return`<!DOCTYPE html>
562
562
  <html lang="en" class="${r.darkClass||"dark"}">