@stacksjs/stx 0.2.479 → 0.2.480

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 (60) hide show
  1. package/dist/{chunk-8g265pwq.js → chunk-083amvsc.js} +1 -1
  2. package/dist/{chunk-zakby6bx.js → chunk-0f9p3jm6.js} +1 -1
  3. package/dist/{chunk-a3a5s9qr.js → chunk-0w4ajnbv.js} +2 -2
  4. package/dist/{chunk-jcrcqtb3.js → chunk-1yt6vfyx.js} +1 -1
  5. package/dist/{chunk-syv9rh52.js → chunk-2ead6r6z.js} +1 -1
  6. package/dist/{chunk-4pcqg0te.js → chunk-3mqagqx2.js} +1 -1
  7. package/dist/{chunk-343k64zr.js → chunk-3sscb1dw.js} +1 -1
  8. package/dist/{chunk-kqqe0hzx.js → chunk-3wkzj28f.js} +1 -1
  9. package/dist/{chunk-yj9thf3n.js → chunk-4wc6hckd.js} +1 -1
  10. package/dist/{chunk-p2775azk.js → chunk-6tvv828r.js} +1 -1
  11. package/dist/chunk-77m49nv1.js +2 -0
  12. package/dist/{chunk-2ynmmd3z.js → chunk-9cskmz6f.js} +1 -1
  13. package/dist/{chunk-qrbpfexg.js → chunk-ab4ajce4.js} +2 -2
  14. package/dist/chunk-bgamctxe.js +2 -0
  15. package/dist/{chunk-20wvgf5w.js → chunk-by8be7t7.js} +5 -5
  16. package/dist/{chunk-cp3d3zrt.js → chunk-csc538a5.js} +1 -1
  17. package/dist/{chunk-9yverx7k.js → chunk-e6c12w2y.js} +1 -1
  18. package/dist/{chunk-1khb6g2w.js → chunk-fd5x89cr.js} +2 -2
  19. package/dist/{chunk-gef1av6b.js → chunk-fk10wpkj.js} +1 -1
  20. package/dist/{chunk-8cr4tqwg.js → chunk-fmgr96es.js} +1 -1
  21. package/dist/{chunk-ws0akhpt.js → chunk-g9a2ajsa.js} +1 -1
  22. package/dist/{chunk-w02x3nd4.js → chunk-hf3mx0b8.js} +1 -1
  23. package/dist/{chunk-qzxpqyny.js → chunk-jcwn5641.js} +1 -1
  24. package/dist/{chunk-eh23r8f2.js → chunk-js8envem.js} +1 -1
  25. package/dist/{chunk-2d71d7n1.js → chunk-jtq3nhwp.js} +1 -1
  26. package/dist/{chunk-npsccfxz.js → chunk-k6e9yc83.js} +1 -1
  27. package/dist/{chunk-ennnv0n0.js → chunk-kw7z9xtf.js} +1 -1
  28. package/dist/{chunk-pj332gj9.js → chunk-mfby8kxp.js} +1 -1
  29. package/dist/{chunk-nj1mgbt8.js → chunk-nepqqe3b.js} +1 -1
  30. package/dist/{chunk-xy0502b6.js → chunk-nmck8fae.js} +1 -1
  31. package/dist/{chunk-mkeq5ec2.js → chunk-npayazc2.js} +1 -1
  32. package/dist/{chunk-3mzmz1ht.js → chunk-nt98fd0r.js} +1 -1
  33. package/dist/{chunk-h2aetzf6.js → chunk-p87ckkwb.js} +1 -1
  34. package/dist/chunk-qa3ts1cb.js +2 -0
  35. package/dist/{chunk-9v1ewa0f.js → chunk-r63029hr.js} +1 -1
  36. package/dist/{chunk-k3fxq005.js → chunk-rnh4sxhv.js} +1 -1
  37. package/dist/{chunk-v769ppj2.js → chunk-scj3j6xz.js} +1 -1
  38. package/dist/{chunk-zbtad4yz.js → chunk-sf1fxvwa.js} +1 -1
  39. package/dist/{chunk-afxpbw68.js → chunk-sms5qrmn.js} +1 -1
  40. package/dist/{chunk-pegv1j5x.js → chunk-tjk5b18m.js} +1 -1
  41. package/dist/{chunk-3pgewsrr.js → chunk-trz5bkxe.js} +1 -1
  42. package/dist/{chunk-y19egvjj.js → chunk-txkq59z8.js} +1 -1
  43. package/dist/{chunk-r345b5an.js → chunk-vbbyxjnq.js} +1 -1
  44. package/dist/{chunk-sz5m446r.js → chunk-w267tk8j.js} +195 -196
  45. package/dist/{chunk-7ph65fcr.js → chunk-wfyq4tde.js} +1 -1
  46. package/dist/{chunk-ntnwwb9z.js → chunk-ynhfzv5f.js} +1 -1
  47. package/dist/{chunk-mre4931b.js → chunk-yw9h2zty.js} +1 -1
  48. package/dist/{chunk-r8x97zbs.js → chunk-yx89t1we.js} +1 -1
  49. package/dist/cli.js +7 -7
  50. package/dist/client-parameter-bindings.d.ts +6 -0
  51. package/dist/client-parameter-bindings.js +70 -2
  52. package/dist/client-script.js +11 -64
  53. package/dist/craft-entry.js +1 -1
  54. package/dist/craft.js +1 -1
  55. package/dist/pwa.js +1 -1
  56. package/dist/ssg.js +2 -2
  57. package/package.json +5 -5
  58. package/dist/chunk-06f66a6g.js +0 -2
  59. package/dist/chunk-sjmx8ek1.js +0 -2
  60. package/dist/chunk-w52pta5n.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Dn,Oe,Ne,he,qo,jn,Z,K,sn,d,n,I}from"./chunk-sz5m446r.js";import{dirname as C,resolve as R}from"path";function h(o){return o.endsWith(".md")||o.endsWith(".markdown")}function _(o){let e=[];m(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let r=[...e];m(/<code\b[^>]*>[\s\S]*?<\/code>/gi,r);function m(s,p){let u;while((u=s.exec(o))!==null){let t=u.index,i=t+u[0].length;if(p?.some((l)=>t>=l.start&&i<=l.end))continue;e.push({start:t,end:i})}}if(e.length===0)return o;e.sort((s,p)=>s.start-p.start);let a="",c=0;for(let s of e){if(s.start<c)continue;a+=o.slice(c,s.start),a+=`@raw${o.slice(s.start,s.end)}@endraw`,c=s.end}return a+=o.slice(c),a}async function b(o,e={}){let{data:r,content:m}=Dn(o),c=await(e.renderer??((s)=>Oe(s)))(m);return{html:_(c),frontmatter:r??{}}}function k(o){let e=o,r=Z(o);if(r)e=r.content.trim();let m=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,a=[],c=[],s=[],p=(i)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(i),u;while((u=m.exec(o))!==null){let i=u[1],l=u[2],f=u[0],g=i.includes("server");if(p(l))s.push(f);else if(g)c.push(l);else a.push(f)}let t=e;{let i=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,l,f=[];while((l=i.exec(t))!==null){let g=l.index+l[0].length,x=t.indexOf("</script>",g);if(x===-1)continue;f.push({start:l.index,end:x+9}),i.lastIndex=x+9}for(let g=f.length-1;g>=0;g--)t=t.substring(0,f[g].start)+t.substring(f[g].end)}for(let i of a)t=t.replace(i,"");return{templateContent:t,serverScripts:c,clientScripts:a,signalsScripts:s}}function v(o,e){return`<!DOCTYPE html>
2
+ import{Dn,Oe,Ne,he,qo,jn,Z,K,sn,d,n,I}from"./chunk-w267tk8j.js";import{dirname as C,resolve as R}from"path";function h(o){return o.endsWith(".md")||o.endsWith(".markdown")}function _(o){let e=[];m(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let r=[...e];m(/<code\b[^>]*>[\s\S]*?<\/code>/gi,r);function m(s,p){let u;while((u=s.exec(o))!==null){let t=u.index,i=t+u[0].length;if(p?.some((l)=>t>=l.start&&i<=l.end))continue;e.push({start:t,end:i})}}if(e.length===0)return o;e.sort((s,p)=>s.start-p.start);let a="",c=0;for(let s of e){if(s.start<c)continue;a+=o.slice(c,s.start),a+=`@raw${o.slice(s.start,s.end)}@endraw`,c=s.end}return a+=o.slice(c),a}async function b(o,e={}){let{data:r,content:m}=Dn(o),c=await(e.renderer??((s)=>Oe(s)))(m);return{html:_(c),frontmatter:r??{}}}function k(o){let e=o,r=Z(o);if(r)e=r.content.trim();let m=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,a=[],c=[],s=[],p=(i)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(i),u;while((u=m.exec(o))!==null){let i=u[1],l=u[2],f=u[0],g=i.includes("server");if(p(l))s.push(f);else if(g)c.push(l);else a.push(f)}let t=e;{let i=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,l,f=[];while((l=i.exec(t))!==null){let g=l.index+l[0].length,x=t.indexOf("</script>",g);if(x===-1)continue;f.push({start:l.index,end:x+9}),i.lastIndex=x+9}for(let g=f.length-1;g>=0;g--)t=t.substring(0,f[g].start)+t.substring(f[g].end)}for(let i of a)t=t.replace(i,"");return{templateContent:t,serverScripts:c,clientScripts:a,signalsScripts:s}}function v(o,e){return`<!DOCTYPE html>
3
3
  <html lang="en">
4
4
  <head>
5
5
  <meta charset="UTF-8">
@@ -14,5 +14,5 @@ ${c.join(`
14
14
  `)}`}else{if(r.processClientScripts!==!1&&c.length>0){let i=p.__stx_event_bindings||[],l=Ne(p),g=(await Promise.all(c.map(async(w)=>{let y=w.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!y)return w;return await he(y[1],{eventBindings:i,templateContent:t,serverData:l,filePath:e})}))).join(`
15
15
  `);if(t.match(/(<\/body>)/i))t=t.replace(/(<\/body>)/i,`${g}
16
16
  $1`);else t+=`
17
- ${g}`}t=await K(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=v(t,r.title)}if(r.injectCSS)try{let{injectCss:i}=await import("./chunk-y19egvjj.js");t=await i(t)}catch{}return t}
17
+ ${g}`}t=await K(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=v(t,r.title)}if(r.injectCSS)try{let{injectCss:i}=await import("./chunk-txkq59z8.js");t=await i(t)}catch{}return t}
18
18
  export{To};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import"./chunk-01nx6zcw.js";import"./chunk-pf0d8y9n.js";import{m,h,w,L}from"./chunk-sz5m446r.js";import"./chunk-ab7vh24b.js";import"./chunk-wkc34drs.js";import"./chunk-9ztdvnkk.js";import"./chunk-tbef3yyk.js";import"./chunk-s10r6hxp.js";import"./chunk-j4afmryj.js";import"./chunk-99kt56fn.js";import"./chunk-pj332gj9.js";import"./chunk-pcq6vphz.js";import"./chunk-8adstrk5.js";import f from"path";var S=["applyOfflineUpdate","broadcast","cacheMedia","calculateDistance","canNotify","clearCookies","clearFetchCache","clearOfflineData","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","onOfflineUpdateReady","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAmbientSound","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBreathPacer","useBroadcastChannel","useBroadcastStream","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useOutbox","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],_=new Set(S);var l=new Map,x=m(64),y=new Set,O=0,R=new Set(S);function W(){l.clear(),x.clear()}function P(o){let n=new Map;for(let r of o){let a=f.basename(r);if(a.endsWith(".d.ts"))continue;let t=a.replace(/\.[jt]s$/,"");if(t==="index")continue;if(t===a)continue;let i=n.get(t);if(i&&!i.endsWith(".js"))continue;n.set(t,r)}return[...n.values()].sort()}function I(o,n){let r=n.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${r}\\b`).test(o)}function M(o){if(!o)return[];let n=h(o,O),r=x.get(n);if(r)return r.slice();let a=o.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),t=[];for(let i of R){if(y.has(i))continue;let u=i.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${u}\\s*\\(`).test(a))t.push(i)}return t.sort(),x.set(n,t),t.slice()}async function A(o,n){let r=M(o);if(r.length===0)return null;let a=n??f.join(import.meta.dir,"composables"),t=`${a}\x00${r.join(",")}`,i=l.get(t);if(i!==void 0)return i||null;let u=L({loader:"ts",target:"browser",define:w()}),C=new Set(r),d=[],g=new Set,p=[];try{let s=new Bun.Glob("*.{ts,js}");for await(let e of s.scan({cwd:a,absolute:!0}))p.push(e)}catch{return l.set(t,""),null}p=P(p);for(let s of p){let e;try{e=await Bun.file(s).text()}catch{continue}let b=[];try{b=u.scan(e).exports.filter((c)=>c!=="default")}catch{continue}if(!b.some((c)=>C.has(c)))continue;try{e=e.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^import\s+type\s+.*$/gm,""),e=e.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),e=e.replace(/^export\s+default\s+/gm,""),e=e.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),d.push(`// ${f.basename(s).replace(/\.[jt]s$/,"")}
2
+ import"./chunk-01nx6zcw.js";import"./chunk-pf0d8y9n.js";import{m,h,w,L}from"./chunk-w267tk8j.js";import"./chunk-ab7vh24b.js";import"./chunk-wkc34drs.js";import"./chunk-9ztdvnkk.js";import"./chunk-tbef3yyk.js";import"./chunk-s10r6hxp.js";import"./chunk-j4afmryj.js";import"./chunk-99kt56fn.js";import"./chunk-mfby8kxp.js";import"./chunk-pcq6vphz.js";import"./chunk-8adstrk5.js";import f from"path";var S=["applyOfflineUpdate","broadcast","cacheMedia","calculateDistance","canNotify","clearCookies","clearFetchCache","clearOfflineData","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","onOfflineUpdateReady","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAmbientSound","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBreathPacer","useBroadcastChannel","useBroadcastStream","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useOutbox","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],_=new Set(S);var l=new Map,x=m(64),y=new Set,O=0,R=new Set(S);function W(){l.clear(),x.clear()}function P(o){let n=new Map;for(let r of o){let a=f.basename(r);if(a.endsWith(".d.ts"))continue;let t=a.replace(/\.[jt]s$/,"");if(t==="index")continue;if(t===a)continue;let i=n.get(t);if(i&&!i.endsWith(".js"))continue;n.set(t,r)}return[...n.values()].sort()}function I(o,n){let r=n.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${r}\\b`).test(o)}function M(o){if(!o)return[];let n=h(o,O),r=x.get(n);if(r)return r.slice();let a=o.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),t=[];for(let i of R){if(y.has(i))continue;let u=i.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${u}\\s*\\(`).test(a))t.push(i)}return t.sort(),x.set(n,t),t.slice()}async function A(o,n){let r=M(o);if(r.length===0)return null;let a=n??f.join(import.meta.dir,"composables"),t=`${a}\x00${r.join(",")}`,i=l.get(t);if(i!==void 0)return i||null;let u=L({loader:"ts",target:"browser",define:w()}),C=new Set(r),d=[],g=new Set,p=[];try{let s=new Bun.Glob("*.{ts,js}");for await(let e of s.scan({cwd:a,absolute:!0}))p.push(e)}catch{return l.set(t,""),null}p=P(p);for(let s of p){let e;try{e=await Bun.file(s).text()}catch{continue}let b=[];try{b=u.scan(e).exports.filter((c)=>c!=="default")}catch{continue}if(!b.some((c)=>C.has(c)))continue;try{e=e.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^import\s+type\s+.*$/gm,""),e=e.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),e=e.replace(/^export\s+default\s+/gm,""),e=e.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),d.push(`// ${f.basename(s).replace(/\.[jt]s$/,"")}
3
3
  ${u.transformSync(e).trim()}`);for(let c of b)g.add(c)}catch(c){console.warn(`[stx] framework composable ${f.basename(s)} could not be bundled:`,c)}}let v=r.filter((s)=>!g.has(s)&&!I(o,s));if(v.length>0)console.warn(`[stx] could not bundle ${v.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(d.length===0)return l.set(t,""),null;let E=[...g].map((s)=>` try { if (!(${JSON.stringify(s)} in __s)) { __s[${JSON.stringify(s)}] = ${s}; if (!(${JSON.stringify(s)} in window)) window[${JSON.stringify(s)}] = ${s}; } } catch (e) {}`).join(`
4
4
  `),k=`<script data-stx-framework-composables>
5
5
  ;(function(){
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Bu,yc,be,ai,Fu,ps,gs,ms}from"./chunk-sz5m446r.js";import"./chunk-8adstrk5.js";import"./chunk-wkc34drs.js";import"./chunk-j4afmryj.js";import"./chunk-pj332gj9.js";import"./chunk-99kt56fn.js";import"./chunk-s10r6hxp.js";import"./chunk-tbef3yyk.js";import"./chunk-ab7vh24b.js";import"./chunk-pf0d8y9n.js";import"./chunk-01nx6zcw.js";import"./chunk-9ztdvnkk.js";import"./chunk-pcq6vphz.js";export{Fu as clearOnceStore,ai as onceStore,be as partialsCache,ps as processIncludes,gs as processStackPushDirectives,ms as processStackReplacements,Bu as resetUnscopedSignalWarnings,yc as topLevelElements};
2
+ import{Bu,yc,be,ai,Fu,ps,gs,ms}from"./chunk-w267tk8j.js";import"./chunk-8adstrk5.js";import"./chunk-wkc34drs.js";import"./chunk-j4afmryj.js";import"./chunk-mfby8kxp.js";import"./chunk-99kt56fn.js";import"./chunk-s10r6hxp.js";import"./chunk-tbef3yyk.js";import"./chunk-ab7vh24b.js";import"./chunk-pf0d8y9n.js";import"./chunk-01nx6zcw.js";import"./chunk-9ztdvnkk.js";import"./chunk-pcq6vphz.js";export{Fu as clearOnceStore,ai as onceStore,be as partialsCache,ps as processIncludes,gs as processStackPushDirectives,ms as processStackReplacements,Bu as resetUnscopedSignalWarnings,yc as topLevelElements};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Vc}from"./chunk-p2775azk.js";import"./chunk-sz5m446r.js";import"./chunk-8adstrk5.js";import"./chunk-wkc34drs.js";import"./chunk-j4afmryj.js";import"./chunk-pj332gj9.js";import"./chunk-99kt56fn.js";import"./chunk-s10r6hxp.js";import"./chunk-tbef3yyk.js";import"./chunk-ab7vh24b.js";import"./chunk-pf0d8y9n.js";import"./chunk-01nx6zcw.js";import"./chunk-9ztdvnkk.js";import"./chunk-pcq6vphz.js";export{Vc as startInteractive};
2
+ import{Vc}from"./chunk-6tvv828r.js";import"./chunk-w267tk8j.js";import"./chunk-8adstrk5.js";import"./chunk-wkc34drs.js";import"./chunk-j4afmryj.js";import"./chunk-mfby8kxp.js";import"./chunk-99kt56fn.js";import"./chunk-s10r6hxp.js";import"./chunk-tbef3yyk.js";import"./chunk-ab7vh24b.js";import"./chunk-pf0d8y9n.js";import"./chunk-01nx6zcw.js";import"./chunk-9ztdvnkk.js";import"./chunk-pcq6vphz.js";export{Vc as startInteractive};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Uc}from"./chunk-4pcqg0te.js";import"./chunk-a3a5s9qr.js";import"./chunk-ennnv0n0.js";import"./chunk-sz5m446r.js";import"./chunk-8adstrk5.js";import"./chunk-wkc34drs.js";import"./chunk-j4afmryj.js";import"./chunk-pj332gj9.js";import"./chunk-99kt56fn.js";import"./chunk-s10r6hxp.js";import"./chunk-tbef3yyk.js";import"./chunk-ab7vh24b.js";import"./chunk-pf0d8y9n.js";import"./chunk-01nx6zcw.js";import"./chunk-9ztdvnkk.js";import"./chunk-pcq6vphz.js";export{Uc as startProductionServer};
2
+ import{Uc}from"./chunk-3mqagqx2.js";import"./chunk-0w4ajnbv.js";import"./chunk-kw7z9xtf.js";import"./chunk-w267tk8j.js";import"./chunk-8adstrk5.js";import"./chunk-wkc34drs.js";import"./chunk-j4afmryj.js";import"./chunk-mfby8kxp.js";import"./chunk-99kt56fn.js";import"./chunk-s10r6hxp.js";import"./chunk-tbef3yyk.js";import"./chunk-ab7vh24b.js";import"./chunk-pf0d8y9n.js";import"./chunk-01nx6zcw.js";import"./chunk-9ztdvnkk.js";import"./chunk-pcq6vphz.js";export{Uc as startProductionServer};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{b,d,n,g,I}from"./chunk-sz5m446r.js";import q from"path";var M={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},T=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var O=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function z(e){let t=[],o=0,s;O.lastIndex=0;while((s=O.exec(e))!==null){if(s.index>o){let a=e.slice(o,s.index);if(a.trim())t.push({type:t.length===0?"shell":"content",content:a})}let r=s[1],i=s[2];t.push({type:"suspense",name:r,content:i}),o=s.index+s[0].length}if(o<e.length){let r=e.slice(o);if(r.trim())t.push({type:t.length===0?"shell":"content",content:r})}if(t.length===0)t.push({type:"shell",content:e});return t}async function eu(e,t={},o={}){let s={...I,...o,streaming:{...M,...o.streaming}},r=s.streaming?.bufferSize||16384;return new ReadableStream({async start(i){try{let a=await Bun.file(e).text(),w=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),m=w?w[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),y={...t,__filename:e,__dirname:q.dirname(e)};if(m.trim())await d(m,y,e);let E=z(c),u=new Set;if(!E.some((h)=>h.type==="suspense")){let h=s.streaming?.strategy||"auto",S=new RegExp(T.source,"g");if(!(h!=="manual"&&S.test(c))){let p=await n(c,y,e,s,u);for(let x=0;x<p.length;x+=r)i.enqueue(p.slice(x,x+r)),await new Promise((f)=>setTimeout(f,0))}else{let p=[],x=new RegExp(T.source,"g"),f;while((f=x.exec(c))!==null)p.push({name:f[1],content:f[2],start:f.index,end:f.index+f[0].length});let v=0;for(let _ of p){if(_.start>v){let k=c.slice(v,_.start);if(k.trim()){let D=await n(k,y,e,s,u);i.enqueue(D),await new Promise((H)=>setTimeout(H,0))}}let C=await n(_.content,y,e,s,u);i.enqueue(C),await new Promise((k)=>setTimeout(k,0)),v=_.end}if(v<c.length){let _=c.slice(v);if(_.trim()){let C=await n(_,y,e,s,u);i.enqueue(C)}}}}else{let h=new Map;for(let l of E)if(l.type==="shell"||l.type==="content"){let p=await n(l.content,y,e,s,u);i.enqueue(p)}else if(l.type==="suspense"&&l.name){let p=`stx-suspense-${l.name}`;i.enqueue(`<div id="${p}" data-suspense="${l.name}" style="display:contents;">
2
+ import{b,d,n,g,I}from"./chunk-w267tk8j.js";import q from"path";var M={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},T=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var O=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function z(e){let t=[],o=0,s;O.lastIndex=0;while((s=O.exec(e))!==null){if(s.index>o){let a=e.slice(o,s.index);if(a.trim())t.push({type:t.length===0?"shell":"content",content:a})}let r=s[1],i=s[2];t.push({type:"suspense",name:r,content:i}),o=s.index+s[0].length}if(o<e.length){let r=e.slice(o);if(r.trim())t.push({type:t.length===0?"shell":"content",content:r})}if(t.length===0)t.push({type:"shell",content:e});return t}async function eu(e,t={},o={}){let s={...I,...o,streaming:{...M,...o.streaming}},r=s.streaming?.bufferSize||16384;return new ReadableStream({async start(i){try{let a=await Bun.file(e).text(),w=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),m=w?w[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),y={...t,__filename:e,__dirname:q.dirname(e)};if(m.trim())await d(m,y,e);let E=z(c),u=new Set;if(!E.some((h)=>h.type==="suspense")){let h=s.streaming?.strategy||"auto",S=new RegExp(T.source,"g");if(!(h!=="manual"&&S.test(c))){let p=await n(c,y,e,s,u);for(let x=0;x<p.length;x+=r)i.enqueue(p.slice(x,x+r)),await new Promise((f)=>setTimeout(f,0))}else{let p=[],x=new RegExp(T.source,"g"),f;while((f=x.exec(c))!==null)p.push({name:f[1],content:f[2],start:f.index,end:f.index+f[0].length});let v=0;for(let _ of p){if(_.start>v){let k=c.slice(v,_.start);if(k.trim()){let D=await n(k,y,e,s,u);i.enqueue(D),await new Promise((H)=>setTimeout(H,0))}}let C=await n(_.content,y,e,s,u);i.enqueue(C),await new Promise((k)=>setTimeout(k,0)),v=_.end}if(v<c.length){let _=c.slice(v);if(_.trim()){let C=await n(_,y,e,s,u);i.enqueue(C)}}}}else{let h=new Map;for(let l of E)if(l.type==="shell"||l.type==="content"){let p=await n(l.content,y,e,s,u);i.enqueue(p)}else if(l.type==="suspense"&&l.name){let p=`stx-suspense-${l.name}`;i.enqueue(`<div id="${p}" data-suspense="${l.name}" style="display:contents;">
3
3
  <template data-suspense-fallback>Loading...</template>
4
4
  </div>`),h.set(l.name,n(l.content,y,e,s,u))}i.enqueue(`
5
5
  <script>
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{y}from"./chunk-01nx6zcw.js";import{W,ze,ns,rs,Ko,Xo,Go,Jo,Fn,ss,Yo,Zo,Qo,Ct,o}from"./chunk-sz5m446r.js";import{Mr}from"./chunk-k3fxq005.js";import{a}from"./chunk-kk5cyjfs.js";import{existsSync as M,readFileSync as K}from"fs";import h from"path";var me=new Set(["module","exports","require","$bool","$num","window","document","console","confirm","alert","fetch"]),te=Ct.filter((e)=>!me.has(e)).sort(),ne=[...y].sort(),he=[...new Set([...te,...ne])].sort(),be=new Set(te),ye=new Set(ne),xe=new Set(he),ee=/\bimport\s+(?!type[\s{])\{([^}]*)\}\s*from\s*(['"])stx\2/g;function Se(e,t){if(t==="server")return`'${e}' is not provided by 'stx' in a <script server> block. The engine binds only its own names there (defineProps, state, useHead, ...); any other name becomes \`await import('stx')\`, which does not resolve, so the whole script fails when the page renders. Import it from '@stacksjs/stx' instead.`;return`'${e}' is not provided by 'stx' in a client <script> block. The import is replaced by the window.stx runtime, which has no '${e}', so it is undefined in the browser.`}function ie(e,t){let s=[];for(let u of t){if(u.offset===void 0)continue;let i=u.kind==="server"?be:ye;ee.lastIndex=0;for(let l of u.code.matchAll(ee)){let g=l.index+l[0].indexOf("{")+1;for(let m of l[1].matchAll(/[^,]+/g)){let S=m[0];if(/^\s*type\s/.test(S))continue;let x=/^\s*([A-Za-z_$][\w$]*)/.exec(S);if(!x)continue;let r=x[1];if(!xe.has(r)||i.has(r))continue;let f=u.offset+g+m.index+x[0].length-r.length,p=e.slice(0,f),w=p.split(`
2
+ import{y}from"./chunk-01nx6zcw.js";import{W,ze,ns,rs,Ko,Xo,Go,Jo,Fn,ss,Yo,Zo,Qo,Ct,o}from"./chunk-w267tk8j.js";import{Mr}from"./chunk-rnh4sxhv.js";import{a}from"./chunk-kk5cyjfs.js";import{existsSync as M,readFileSync as K}from"fs";import h from"path";var me=new Set(["module","exports","require","$bool","$num","window","document","console","confirm","alert","fetch"]),te=Ct.filter((e)=>!me.has(e)).sort(),ne=[...y].sort(),he=[...new Set([...te,...ne])].sort(),be=new Set(te),ye=new Set(ne),xe=new Set(he),ee=/\bimport\s+(?!type[\s{])\{([^}]*)\}\s*from\s*(['"])stx\2/g;function Se(e,t){if(t==="server")return`'${e}' is not provided by 'stx' in a <script server> block. The engine binds only its own names there (defineProps, state, useHead, ...); any other name becomes \`await import('stx')\`, which does not resolve, so the whole script fails when the page renders. Import it from '@stacksjs/stx' instead.`;return`'${e}' is not provided by 'stx' in a client <script> block. The import is replaced by the window.stx runtime, which has no '${e}', so it is undefined in the browser.`}function ie(e,t){let s=[];for(let u of t){if(u.offset===void 0)continue;let i=u.kind==="server"?be:ye;ee.lastIndex=0;for(let l of u.code.matchAll(ee)){let g=l.index+l[0].indexOf("{")+1;for(let m of l[1].matchAll(/[^,]+/g)){let S=m[0];if(/^\s*type\s/.test(S))continue;let x=/^\s*([A-Za-z_$][\w$]*)/.exec(S);if(!x)continue;let r=x[1];if(!xe.has(r)||i.has(r))continue;let f=u.offset+g+m.index+x[0].length-r.length,p=e.slice(0,f),w=p.split(`
3
3
  `).length;s.push({line:w,column:f-(p.lastIndexOf(`
4
4
  `)+1)+1,offset:f,length:r.length,name:r,kind:u.kind,message:Se(r,u.kind)})}}}return s}import T from"path";var ke="@stacksjs/stx-typescript-plugin";function we(e,t){let s=T.resolve(e);for(;;){let u=T.join(s,"tsconfig.json");if(t(u))return u;let i=T.dirname(s);if(i===s)return;s=i}}function se(e,t,s){let u=we(e,s);if(!u)return;let i=new Set,l=(g)=>{if(i.has(g))return;i.add(g);let m=t(g);if(!m)return;let S=m.compilerOptions?.plugins;if(Array.isArray(S)){let r=S.find((p)=>p?.name===ke),f=Array.isArray(r?.libs)?r.libs.filter((p)=>typeof p==="string"):[];return r?{configPath:g,libs:f.map((p)=>T.resolve(T.dirname(g),p))}:null}let x=typeof m.extends==="string"?[m.extends]:Array.isArray(m.extends)?m.extends:[];for(let r of[...x].reverse()){if(typeof r!=="string"||!r.startsWith("."))continue;let f=T.resolve(T.dirname(g),r.endsWith(".json")?r:`${r}.json`),p=l(f);if(p!==void 0)return p}return};return l(u)??void 0}function Wi(e,t="",s=""){let u=e.startLine>1?`
5
5
  `.repeat(e.startLine-1):"",i=ss(e)+rs(ns(e.code)),l=e.kind==="client"||e.kind==="plain"?Go(t,e.code):"";return Fn(`${u+i}
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{p,l}from"./chunk-ab7vh24b.js";import{b}from"./chunk-sz5m446r.js";function y(t,o){let i=1,r=o,e="<template",n="</template";while(r<t.length&&i>0){let s=t.indexOf("<",r);if(s===-1)break;if(r=s,t.startsWith(e,r)&&(r+e.length>=t.length||/[\s>\/]/.test(t[r+e.length]))){i++,r+=e.length;continue}if(t.startsWith(n,r)){let a=t.indexOf(">",r+n.length);if(a!==-1){if(i--,i===0)return a+1;r=a+1;continue}}r++}return i===0?r:-1}var w=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function x(t,o){let i=null;for(let r=o;r<t.length;r++){let e=t[r];if(i){if(e==="\\"){r++;continue}if(e===i)i=null;continue}if(e==='"'||e==="'"){i=e;continue}if(e===">")return r+1}return-1}function N(t,o,i){let r=o.toLowerCase(),e=1,n=i;while(n<t.length){let s=t.indexOf("<",n);if(s===-1)return-1;if(t.startsWith("<!--",s)){let g=t.indexOf("-->",s+4);n=g===-1?t.length:g+3;continue}let a=x(t,s+1);if(a===-1)return-1;let f=t.slice(s,a),u=f.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(u&&u[2].toLowerCase()===r){if(u[1]==="/"){if(e--,e===0)return a}else if(!/\/\s*>$/.test(f))e++}n=a}return-1}function A(t){let o=[],i=[],r=/\bslot\s*=\s*(?:"([^"]+)"|'([^']+)')/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let c=t.indexOf("-->",n+4);e=c===-1?t.length:c+3;continue}let s=x(t,n+1);if(s===-1)break;let a=t.slice(n,s),f=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!f){e=s;continue}let u=f[2].toLowerCase();if(f[1]==="/"){let c=i.lastIndexOf(u);if(c!==-1)i.splice(c);e=s;continue}let g=/\/\s*>$/.test(a),d=i.length===0?a.match(r):null;if(d){let c=d[1]||d[2],m=a.replace(r,"").replace(/\s+(?=\/?>$)/,"").replace(/\s{2,}/g," "),h=g||w.has(u)?-1:N(t,u,s);if(h===-1)o.push({start:n,end:s,slotName:c,element:m}),e=s;else o.push({start:n,end:h,slotName:c,element:m+t.slice(s,h)}),e=h;continue}if(!g&&!w.has(u)){if(i.push(u),u==="script"||u==="style"){let c=t.toLowerCase().indexOf(`</${u}>`,s);if(c!==-1){e=c;continue}}}e=s}return o}function O(t){let o=[],i=[],r=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let c=t.indexOf("-->",n+4);e=c===-1?t.length:c+3;continue}let s=x(t,n+1);if(s===-1)break;let a=t.slice(n,s),f=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!f){e=s;continue}let u=f[1]==="/",g=f[2].toLowerCase();if(u){let c=i.lastIndexOf(g);if(c!==-1)i.splice(c);e=s;continue}if(g==="template"&&i.length===0){let c=a.match(r);if(c){let m=y(t,s);if(m!==-1){let h=c[1]||c[2]||c[3];o.push({start:n,end:m,slotName:h,content:t.slice(s,m-11).trim(),propsBinding:c[4]||void 0}),e=m;continue}}}if(!/\/\s*>$/.test(a)&&!w.has(g)){if(i.push(g),g==="script"||g==="style"){let c=t.toLowerCase().indexOf(`</${g}>`,s);if(c!==-1){e=c;continue}}}e=s}return o}function Zi(t){let o={default:"",named:new Map},i=t,r=O(t);for(let n of r)o.named.set(n.slotName,{name:n.slotName,content:n.content,propsBinding:n.propsBinding});r.sort((n,s)=>s.start-n.start);for(let n of r)i=i.slice(0,n.start)+i.slice(n.end);let e=A(i);for(let n of e){let s=o.named.get(n.slotName);if(s)s.content+=n.element;else o.named.set(n.slotName,{name:n.slotName,content:n.element})}for(let n=e.length-1;n>=0;n--){let s=e[n];i=i.slice(0,s.start)+i.slice(s.end)}return o.default=i.trim(),o}function pl(t){let o=t.match(/name\s*=\s*["']([^"']+)["']/),i=o?o[1]:"",r={},e=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,n;while((n=e.exec(t))!==null)r[n[1]]=n[2];let s=t.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),a=s?s[1].trim():"";return{name:i,props:r,defaultContent:a}}async function Qi(t,o,i,r){if(!t)return i;let e=t.content;if(t.propsBinding&&Object.keys(o).length>0){let n=t.propsBinding.trim(),s={...r};if(n.startsWith("{")&&n.endsWith("}")){let a=n.slice(1,-1).split(",").map((f)=>f.trim()).filter(Boolean);for(let f of a){let[u,g]=f.split(":").map((c)=>c.trim()),d=g||u;if(o[u]!==void 0)s[d]=o[u]}}else s[n]=o;e=C(e,s)}return e}function C(t,o){return t.replace(/\{\{\s*([^}]+)\s*\}\}/g,(i,r)=>{try{let e=r.trim(),n=k(e,o);return b(String(n??""))}catch{return`{{ ${r} }}`}})}function k(t,o){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(t)){let r=t.split("."),e=o;for(let n of r)if(e&&typeof e==="object"&&n in e)e=e[n];else return;return e}let i=t.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(i){let[,r,e,n]=i,s=o[r],a=parseInt(n,10);if(typeof s==="number")switch(e){case"+":return s+a;case"-":return s-a;case"*":return s*a;case"/":return s/a}}try{if(!p(t))return;return l(t,Object.keys(o))(...Object.values(o))}catch{return}}async function ea(t,o,i){let r=t;r=await M(r,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(s,a,f,u)=>{let g=o.named.get(a),d=u?.trim()||"",c=f||"",m={},h=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,S;while((S=h.exec(c))!==null){let E=S[1],R=S[2];m[E]=k(R,i)}return await Qi(g,m,d,i)});let n=/<slot\b((?:"[^"]*"|'[^']*'|[^>"'])*?)\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return r=r.replace(n,(s,a,f)=>{if(/\bname\s*=/.test(a||""))return s;let u=f?.trim()||"";return o.default||u}),r}async function M(t,o,i){let r=[],e=[];t.replace(o,(a,...f)=>{let u=f[f.length-2];return e.push({match:a,index:u}),r.push(i(a,...f.slice(0,-2))),a});let n=await Promise.all(r),s=t;for(let a=e.length-1;a>=0;a--){let{match:f,index:u}=e[a];s=s.slice(0,u)+n[a]+s.slice(u+f.length)}return s}function fl(t){let o=Zi(t);return{defaultSlot:o.default,namedSlots:o.named}}async function gl(t,o,i,r){return await ea(t,{default:o,named:i},r)}
2
+ import{p,l}from"./chunk-ab7vh24b.js";import{b}from"./chunk-w267tk8j.js";function y(t,o){let i=1,r=o,e="<template",n="</template";while(r<t.length&&i>0){let s=t.indexOf("<",r);if(s===-1)break;if(r=s,t.startsWith(e,r)&&(r+e.length>=t.length||/[\s>\/]/.test(t[r+e.length]))){i++,r+=e.length;continue}if(t.startsWith(n,r)){let a=t.indexOf(">",r+n.length);if(a!==-1){if(i--,i===0)return a+1;r=a+1;continue}}r++}return i===0?r:-1}var w=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function x(t,o){let i=null;for(let r=o;r<t.length;r++){let e=t[r];if(i){if(e==="\\"){r++;continue}if(e===i)i=null;continue}if(e==='"'||e==="'"){i=e;continue}if(e===">")return r+1}return-1}function N(t,o,i){let r=o.toLowerCase(),e=1,n=i;while(n<t.length){let s=t.indexOf("<",n);if(s===-1)return-1;if(t.startsWith("<!--",s)){let g=t.indexOf("-->",s+4);n=g===-1?t.length:g+3;continue}let a=x(t,s+1);if(a===-1)return-1;let f=t.slice(s,a),u=f.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(u&&u[2].toLowerCase()===r){if(u[1]==="/"){if(e--,e===0)return a}else if(!/\/\s*>$/.test(f))e++}n=a}return-1}function A(t){let o=[],i=[],r=/\bslot\s*=\s*(?:"([^"]+)"|'([^']+)')/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let c=t.indexOf("-->",n+4);e=c===-1?t.length:c+3;continue}let s=x(t,n+1);if(s===-1)break;let a=t.slice(n,s),f=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!f){e=s;continue}let u=f[2].toLowerCase();if(f[1]==="/"){let c=i.lastIndexOf(u);if(c!==-1)i.splice(c);e=s;continue}let g=/\/\s*>$/.test(a),d=i.length===0?a.match(r):null;if(d){let c=d[1]||d[2],m=a.replace(r,"").replace(/\s+(?=\/?>$)/,"").replace(/\s{2,}/g," "),h=g||w.has(u)?-1:N(t,u,s);if(h===-1)o.push({start:n,end:s,slotName:c,element:m}),e=s;else o.push({start:n,end:h,slotName:c,element:m+t.slice(s,h)}),e=h;continue}if(!g&&!w.has(u)){if(i.push(u),u==="script"||u==="style"){let c=t.toLowerCase().indexOf(`</${u}>`,s);if(c!==-1){e=c;continue}}}e=s}return o}function O(t){let o=[],i=[],r=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let c=t.indexOf("-->",n+4);e=c===-1?t.length:c+3;continue}let s=x(t,n+1);if(s===-1)break;let a=t.slice(n,s),f=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!f){e=s;continue}let u=f[1]==="/",g=f[2].toLowerCase();if(u){let c=i.lastIndexOf(g);if(c!==-1)i.splice(c);e=s;continue}if(g==="template"&&i.length===0){let c=a.match(r);if(c){let m=y(t,s);if(m!==-1){let h=c[1]||c[2]||c[3];o.push({start:n,end:m,slotName:h,content:t.slice(s,m-11).trim(),propsBinding:c[4]||void 0}),e=m;continue}}}if(!/\/\s*>$/.test(a)&&!w.has(g)){if(i.push(g),g==="script"||g==="style"){let c=t.toLowerCase().indexOf(`</${g}>`,s);if(c!==-1){e=c;continue}}}e=s}return o}function Zi(t){let o={default:"",named:new Map},i=t,r=O(t);for(let n of r)o.named.set(n.slotName,{name:n.slotName,content:n.content,propsBinding:n.propsBinding});r.sort((n,s)=>s.start-n.start);for(let n of r)i=i.slice(0,n.start)+i.slice(n.end);let e=A(i);for(let n of e){let s=o.named.get(n.slotName);if(s)s.content+=n.element;else o.named.set(n.slotName,{name:n.slotName,content:n.element})}for(let n=e.length-1;n>=0;n--){let s=e[n];i=i.slice(0,s.start)+i.slice(s.end)}return o.default=i.trim(),o}function pl(t){let o=t.match(/name\s*=\s*["']([^"']+)["']/),i=o?o[1]:"",r={},e=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,n;while((n=e.exec(t))!==null)r[n[1]]=n[2];let s=t.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),a=s?s[1].trim():"";return{name:i,props:r,defaultContent:a}}async function Qi(t,o,i,r){if(!t)return i;let e=t.content;if(t.propsBinding&&Object.keys(o).length>0){let n=t.propsBinding.trim(),s={...r};if(n.startsWith("{")&&n.endsWith("}")){let a=n.slice(1,-1).split(",").map((f)=>f.trim()).filter(Boolean);for(let f of a){let[u,g]=f.split(":").map((c)=>c.trim()),d=g||u;if(o[u]!==void 0)s[d]=o[u]}}else s[n]=o;e=C(e,s)}return e}function C(t,o){return t.replace(/\{\{\s*([^}]+)\s*\}\}/g,(i,r)=>{try{let e=r.trim(),n=k(e,o);return b(String(n??""))}catch{return`{{ ${r} }}`}})}function k(t,o){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(t)){let r=t.split("."),e=o;for(let n of r)if(e&&typeof e==="object"&&n in e)e=e[n];else return;return e}let i=t.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(i){let[,r,e,n]=i,s=o[r],a=parseInt(n,10);if(typeof s==="number")switch(e){case"+":return s+a;case"-":return s-a;case"*":return s*a;case"/":return s/a}}try{if(!p(t))return;return l(t,Object.keys(o))(...Object.values(o))}catch{return}}async function ea(t,o,i){let r=t;r=await M(r,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(s,a,f,u)=>{let g=o.named.get(a),d=u?.trim()||"",c=f||"",m={},h=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,S;while((S=h.exec(c))!==null){let E=S[1],R=S[2];m[E]=k(R,i)}return await Qi(g,m,d,i)});let n=/<slot\b((?:"[^"]*"|'[^']*'|[^>"'])*?)\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return r=r.replace(n,(s,a,f)=>{if(/\bname\s*=/.test(a||""))return s;let u=f?.trim()||"";return o.default||u}),r}async function M(t,o,i){let r=[],e=[];t.replace(o,(a,...f)=>{let u=f[f.length-2];return e.push({match:a,index:u}),r.push(i(a,...f.slice(0,-2))),a});let n=await Promise.all(r),s=t;for(let a=e.length-1;a>=0;a--){let{match:f,index:u}=e[a];s=s.slice(0,u)+n[a]+s.slice(u+f.length)}return s}function fl(t){let o=Zi(t);return{defaultSlot:o.default,namedSlots:o.named}}async function gl(t,o,i,r){return await ea(t,{default:o,named:i},r)}
3
3
  export{Zi,pl,Qi,ea,fl,gl};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Wi,to,Xc,qi,Ki,Gc,Jc}from"./chunk-eh23r8f2.js";import"./chunk-k3fxq005.js";import"./chunk-3mzmz1ht.js";import"./chunk-ennnv0n0.js";import"./chunk-8scw1bes.js";import{ze,sc}from"./chunk-sz5m446r.js";import"./chunk-8adstrk5.js";import"./chunk-wkc34drs.js";import"./chunk-j4afmryj.js";import"./chunk-pj332gj9.js";import"./chunk-99kt56fn.js";import"./chunk-s10r6hxp.js";import"./chunk-tbef3yyk.js";import"./chunk-ab7vh24b.js";import"./chunk-pf0d8y9n.js";import"./chunk-01nx6zcw.js";import"./chunk-9ztdvnkk.js";import"./chunk-pcq6vphz.js";export{Wi as buildVirtualSource,ze as extractScriptBlocks,sc as extractTemplateExpressions,qi as findRuntimeTypeDeclarations,Ki as findStxModuleDeclarations,Jc as formatTypecheckDiagnostics,Xc as sourcePathFor,Gc as typecheckStxFiles,to as virtualPathFor};
2
+ import{Wi,to,Xc,qi,Ki,Gc,Jc}from"./chunk-js8envem.js";import"./chunk-rnh4sxhv.js";import"./chunk-nt98fd0r.js";import"./chunk-kw7z9xtf.js";import"./chunk-8scw1bes.js";import{ze,sc}from"./chunk-w267tk8j.js";import"./chunk-8adstrk5.js";import"./chunk-wkc34drs.js";import"./chunk-j4afmryj.js";import"./chunk-mfby8kxp.js";import"./chunk-99kt56fn.js";import"./chunk-s10r6hxp.js";import"./chunk-tbef3yyk.js";import"./chunk-ab7vh24b.js";import"./chunk-pf0d8y9n.js";import"./chunk-01nx6zcw.js";import"./chunk-9ztdvnkk.js";import"./chunk-pcq6vphz.js";export{Wi as buildVirtualSource,ze as extractScriptBlocks,sc as extractTemplateExpressions,qi as findRuntimeTypeDeclarations,Ki as findStxModuleDeclarations,Jc as formatTypecheckDiagnostics,Xc as sourcePathFor,Gc as typecheckStxFiles,to as virtualPathFor};
@@ -1,6 +1,6 @@
1
1
  // @bun
2
2
  import{G}from"./chunk-9ztdvnkk.js";import{ue,C}from"./chunk-99kt56fn.js";import{yi}from"./chunk-j4afmryj.js";import{a}from"./chunk-kk5cyjfs.js";import v from"fs";import m from"path";import{pathToFileURL as I}from"url";var P=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],R=new Set;function bt(s,l={}){let o=m.resolve(s,l.dir??"server/api"),i=[],f=new Map;if(!v.existsSync(o))return i;let t=Array.from(new Bun.Glob("**/*.{ts,js,mts,mjs}").scanSync({cwd:o})).sort();for(let e of t){if(e.endsWith(".d.ts"))continue;let u=e.replace(/\.(?:ts|js|mts|mjs)$/,"").split("/"),n=u.pop(),c=n.lastIndexOf("."),d=c>=0?n.slice(c+1):"get",g=d.toUpperCase();if(!P.includes(g)||d!==d.toLowerCase())throw Error(`Unsupported API method suffix in ${e}; use ${P.map((A)=>A.toLowerCase()).join(", ")}`);if(c>=0)n=n.slice(0,c);if(n!=="index")u.push(n);let r=new Set,h=u.map((A,j)=>{let y=/^\[(\.\.\.)?([A-Za-z_]\w*)\]$/.exec(A);if(y){if(r.has(y[2])||y[1]&&j!==u.length-1)throw Error(`Invalid API parameter in ${e}`);return r.add(y[2]),`:${y[2]}${y[1]?"*":""}`}if(!/^[\w-]+$/.test(A))throw Error(`Unsupported API path segment ${A} in ${e}`);return A}),w=`/api${h.length?`/${h.join("/")}`:""}`,S=`${g} ${w.replace(/:\w+/g,":param")}`;if(f.has(S))throw Error(`Ambiguous API route ${g} ${w}: ${f.get(S)} and ${e}`);f.set(S,e);let x=m.join(o,e);R.add(m.resolve(x)),R.add(v.realpathSync(x)),i.push({pattern:w,method:g,filePath:x})}return i.sort((e,p)=>{let u=e.pattern.split("/"),n=p.pattern.split("/"),c=(d)=>d?.endsWith("*")?0:d?.startsWith(":")?1:2;for(let d=0;d<Math.max(u.length,n.length);d++){let g=c(n[d])-c(u[d]);if(g)return g}return e.pattern.localeCompare(p.pattern)||e.method.localeCompare(p.method)})}async function Vr(s,l){let o=a(s,"api-types.d.ts"),i=["// Generated by stx. Include this file in tsconfig.json.","declare module '@stacksjs/stx/api-client' {"," interface KnownApiRoutes {"];for(let t of l){let e=`./${m.relative(m.dirname(o),t.filePath).replace(/\\/g,"/")}`,{params:p}=G(t.pattern);i.push(` ${JSON.stringify(`${t.method} ${t.pattern}`)}: { params: { ${p.map((u)=>`${JSON.stringify(u)}: string`).join("; ")} }; response: Awaited<ReturnType<typeof import(${JSON.stringify(e)}).default>> }`)}i.push(" }","}","export {}","");let f=i.join(`
3
3
  `);if(!await Bun.file(o).exists()||await Bun.file(o).text()!==f)await Bun.write(o,f);return o}async function Ur(s,l,o={}){let i=bt(s,o);await Vr(s,i);let f=[];for(let t of i){let e=await Bun.build({entrypoints:[t.filePath],target:"bun",format:"esm",minify:!1,splitting:!1});if(!e.success)throw Error(`API build failed for ${t.filePath}: ${e.logs.join(`
4
- `)}`);let p=e.outputs.find((c)=>c.kind==="entry-point");if(!p)throw Error(`No API bundle for ${t.filePath}`);if(e.outputs.length!==1)throw Error(`API endpoint ${t.filePath} emits assets; package those explicitly instead`);let n=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await p.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write(m.join(l,n),p),f.push({...t,filePath:n})}return f}function E(s,l){let o=s.map((i)=>({route:i,...G(i.pattern)}));return async(i)=>{let f=new URL(i.url).pathname,t=o.filter((r)=>r.regex.test(f));if(!t.length)return null;let e=t[0].route.pattern,p=(r)=>r.replace(/:\w+/g,":param"),u=t.filter((r)=>p(r.route.pattern)===p(e)),n=i.method,c=u.find((r)=>r.route.method===n)??(n==="HEAD"?u.find((r)=>r.route.method==="GET"):void 0);if(!c){let r=new Set(u.map((h)=>h.route.method));if(r.has("GET"))r.add("HEAD");return r.add("OPTIONS"),new Response(null,{status:n==="OPTIONS"?204:405,headers:{Allow:Array.from(r).sort().join(", ")}})}let d=c.regex.exec(f),g=Object.create(null);try{c.params.forEach((r,h)=>{g[r]=decodeURIComponent(d[h+1])})}catch{return new Response("Invalid URL parameter encoding",{status:400})}try{let r=await l(c.route);if(typeof r!=="function")throw Error(`API endpoint ${c.route.filePath} must default-export a handler`);let h=await r(i,{params:g}),w=h instanceof Response?h:h===void 0?new Response(null,{status:204}):Response.json(h);if(n==="HEAD")return new Response(null,{status:w.status,headers:w.headers});return w}catch(r){return console.error(`[stx] API error for ${n} ${e}:`,r),Response.json({error:"Internal Server Error"},{status:500})}}}function Wr(s,l){return E(l,async(o)=>(await import(I(m.resolve(s,o.filePath)).href)).default)}async function wu(s,l){if(!l)return async()=>null;let o=l===!0?{}:l,i=bt(s,o);return await Vr(s,i),async(f)=>{if(!new URL(f.url).pathname.match(/^\/api(?:\/|$)/))return null;try{let t=bt(s,o);await Vr(s,t);let{loadStxConfig:e}=await import("./chunk-h2aetzf6.js"),p=C((await e(s)).runtimeConfig);return await ue(p,()=>E(t,async(u)=>{let n=await Bun.build({entrypoints:[u.filePath],target:"bun",format:"esm",splitting:!1});if(!n.success)throw Error(n.logs.join(`
4
+ `)}`);let p=e.outputs.find((c)=>c.kind==="entry-point");if(!p)throw Error(`No API bundle for ${t.filePath}`);if(e.outputs.length!==1)throw Error(`API endpoint ${t.filePath} emits assets; package those explicitly instead`);let n=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await p.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write(m.join(l,n),p),f.push({...t,filePath:n})}return f}function E(s,l){let o=s.map((i)=>({route:i,...G(i.pattern)}));return async(i)=>{let f=new URL(i.url).pathname,t=o.filter((r)=>r.regex.test(f));if(!t.length)return null;let e=t[0].route.pattern,p=(r)=>r.replace(/:\w+/g,":param"),u=t.filter((r)=>p(r.route.pattern)===p(e)),n=i.method,c=u.find((r)=>r.route.method===n)??(n==="HEAD"?u.find((r)=>r.route.method==="GET"):void 0);if(!c){let r=new Set(u.map((h)=>h.route.method));if(r.has("GET"))r.add("HEAD");return r.add("OPTIONS"),new Response(null,{status:n==="OPTIONS"?204:405,headers:{Allow:Array.from(r).sort().join(", ")}})}let d=c.regex.exec(f),g=Object.create(null);try{c.params.forEach((r,h)=>{g[r]=decodeURIComponent(d[h+1])})}catch{return new Response("Invalid URL parameter encoding",{status:400})}try{let r=await l(c.route);if(typeof r!=="function")throw Error(`API endpoint ${c.route.filePath} must default-export a handler`);let h=await r(i,{params:g}),w=h instanceof Response?h:h===void 0?new Response(null,{status:204}):Response.json(h);if(n==="HEAD")return new Response(null,{status:w.status,headers:w.headers});return w}catch(r){return console.error(`[stx] API error for ${n} ${e}:`,r),Response.json({error:"Internal Server Error"},{status:500})}}}function Wr(s,l){return E(l,async(o)=>(await import(I(m.resolve(s,o.filePath)).href)).default)}async function wu(s,l){if(!l)return async()=>null;let o=l===!0?{}:l,i=bt(s,o);return await Vr(s,i),async(f)=>{if(!new URL(f.url).pathname.match(/^\/api(?:\/|$)/))return null;try{let t=bt(s,o);await Vr(s,t);let{loadStxConfig:e}=await import("./chunk-p87ckkwb.js"),p=C((await e(s)).runtimeConfig);return await ue(p,()=>E(t,async(u)=>{let n=await Bun.build({entrypoints:[u.filePath],target:"bun",format:"esm",splitting:!1});if(!n.success)throw Error(n.logs.join(`
5
5
  `));let c=n.outputs.find((d)=>d.kind==="entry-point");if(!c||n.outputs.length!==1)throw Error(`Unsupported API bundle output: ${u.filePath}`);return(await import(`data:text/javascript;base64,${Buffer.from(await c.text()).toString("base64")}`)).default})(f))}catch(t){return console.error("[stx] API discovery failed:",t),Response.json({error:"API discovery failed; check the server log"},{status:500})}}}function qr(s,l,o){if(yi(s))return!0;let i=/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/;if(i.test(m.basename(s)))return!0;try{if(i.test(m.basename(v.realpathSync(s))))return!0}catch{}if(R.has(m.resolve(s)))return!0;if(!o)return!1;let f=m.resolve(l,typeof o==="object"?o.dir??"server/api":"server/api"),t=(p)=>{try{return v.realpathSync(p)}catch{return m.resolve(p)}},e=t(s);return[f,m.resolve(l,"server"),m.resolve(l,".output/server")].some((p)=>{let u=t(p);return e===u||e.startsWith(`${u}${m.sep}`)})}
6
6
  export{bt,Vr,Ur,Wr,wu,qr};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Et,C}from"./chunk-99kt56fn.js";import m from"fs";import e from"path";async function ln(r,o,i){if(r.__stx_runtime_config)return;let n=Et();if(n||i){r.__stx_runtime_config=n??C(i);return}let t=e.dirname(e.resolve(o));while(!0){if(["stx.config.ts","stx.config.js",".config/stx.config.ts",".config/stx.config.js"].some((f)=>m.existsSync(e.join(t,f)))){let{loadStxConfig:f}=await import("./chunk-h2aetzf6.js"),c=await f(t);if(c.runtimeConfig)r.__stx_runtime_config=C(c.runtimeConfig);return}let s=e.dirname(t);if(s===t)return;t=s}}async function Ss(r,o){function i(n){if(n===null)return"null";if(Array.isArray(n))return`Array<${n.length?[...new Set(n.map(i))].join(" | "):"unknown"}>`;if(typeof n==="object")return`{ ${Object.entries(n).map(([t,s])=>`readonly ${JSON.stringify(t)}: ${i(s)}`).join("; ")} }`;return typeof n}await Bun.write(e.join(r,".stx/runtime-config.d.ts"),`import '@stacksjs/stx/runtime-config'
2
+ import{Et,C}from"./chunk-99kt56fn.js";import m from"fs";import e from"path";async function ln(r,o,i){if(r.__stx_runtime_config)return;let n=Et();if(n||i){r.__stx_runtime_config=n??C(i);return}let t=e.dirname(e.resolve(o));while(!0){if(["stx.config.ts","stx.config.js",".config/stx.config.ts",".config/stx.config.js"].some((f)=>m.existsSync(e.join(t,f)))){let{loadStxConfig:f}=await import("./chunk-p87ckkwb.js"),c=await f(t);if(c.runtimeConfig)r.__stx_runtime_config=C(c.runtimeConfig);return}let s=e.dirname(t);if(s===t)return;t=s}}async function Ss(r,o){function i(n){if(n===null)return"null";if(Array.isArray(n))return`Array<${n.length?[...new Set(n.map(i))].join(" | "):"unknown"}>`;if(typeof n==="object")return`{ ${Object.entries(n).map(([t,s])=>`readonly ${JSON.stringify(t)}: ${i(s)}`).join("; ")} }`;return typeof n}await Bun.write(e.join(r,".stx/runtime-config.d.ts"),`import '@stacksjs/stx/runtime-config'
3
3
  declare module '@stacksjs/stx/runtime-config' { interface PublicRuntimeConfig ${i(o.public??{})} }
4
4
  `),await Bun.write(e.join(r,".stx/runtime-config-server.d.ts"),`import '@stacksjs/stx/runtime-config-server'
5
5
  declare module '@stacksjs/stx/runtime-config-server' { interface PrivateRuntimeConfig ${i(o.private??{})} }
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ju,ic,is,as,ei,ti,cs,ls,zn,ac,ni,ri,cc,He}from"./chunk-sz5m446r.js";import"./chunk-8adstrk5.js";import"./chunk-wkc34drs.js";import"./chunk-j4afmryj.js";import"./chunk-pj332gj9.js";import"./chunk-99kt56fn.js";import"./chunk-s10r6hxp.js";import"./chunk-tbef3yyk.js";import"./chunk-ab7vh24b.js";import"./chunk-pf0d8y9n.js";import"./chunk-01nx6zcw.js";import"./chunk-9ztdvnkk.js";import"./chunk-pcq6vphz.js";export{ju as clearScriptScanCache,cs as convertServerLoopAttributesToDirectives,ei as convertSignalDirectivesToAttributes,ls as convertSignalLoopsToAttributes,ac as extractExports,ri as findMarkupIndexOutsideScripts,as as hasSignalsSyntax,is as parseLoopExpression,ti as preEvalLiteralReactiveIfs,zn as processScriptSetup,ni as processSignals,cc as rewriteStxImportSpecifiers,ic as scanScriptTags,He as stripStxRuntimeImports};
2
+ import{ju,ic,is,as,ei,ti,cs,ls,zn,ac,ni,ri,cc,He}from"./chunk-w267tk8j.js";import"./chunk-8adstrk5.js";import"./chunk-wkc34drs.js";import"./chunk-j4afmryj.js";import"./chunk-mfby8kxp.js";import"./chunk-99kt56fn.js";import"./chunk-s10r6hxp.js";import"./chunk-tbef3yyk.js";import"./chunk-ab7vh24b.js";import"./chunk-pf0d8y9n.js";import"./chunk-01nx6zcw.js";import"./chunk-9ztdvnkk.js";import"./chunk-pcq6vphz.js";export{ju as clearScriptScanCache,cs as convertServerLoopAttributesToDirectives,ei as convertSignalDirectivesToAttributes,ls as convertSignalLoopsToAttributes,ac as extractExports,ri as findMarkupIndexOutsideScripts,as as hasSignalsSyntax,is as parseLoopExpression,ti as preEvalLiteralReactiveIfs,zn as processScriptSetup,ni as processSignals,cc as rewriteStxImportSpecifiers,ic as scanScriptTags,He as stripStxRuntimeImports};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ul}from"./chunk-kqqe0hzx.js";import"./chunk-sz5m446r.js";import"./chunk-8adstrk5.js";import"./chunk-wkc34drs.js";import"./chunk-j4afmryj.js";import"./chunk-pj332gj9.js";import"./chunk-99kt56fn.js";import"./chunk-s10r6hxp.js";import"./chunk-tbef3yyk.js";import"./chunk-ab7vh24b.js";import"./chunk-pf0d8y9n.js";import"./chunk-01nx6zcw.js";import"./chunk-9ztdvnkk.js";import"./chunk-pcq6vphz.js";export{ul as buildApp};
2
+ import{ul}from"./chunk-3wkzj28f.js";import"./chunk-w267tk8j.js";import"./chunk-8adstrk5.js";import"./chunk-wkc34drs.js";import"./chunk-j4afmryj.js";import"./chunk-mfby8kxp.js";import"./chunk-99kt56fn.js";import"./chunk-s10r6hxp.js";import"./chunk-tbef3yyk.js";import"./chunk-ab7vh24b.js";import"./chunk-pf0d8y9n.js";import"./chunk-01nx6zcw.js";import"./chunk-9ztdvnkk.js";import"./chunk-pcq6vphz.js";export{ul as buildApp};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Zc}from"./chunk-yj9thf3n.js";import"./chunk-a3a5s9qr.js";import"./chunk-w1fy86aa.js";import"./chunk-ennnv0n0.js";import"./chunk-sz5m446r.js";import"./chunk-8adstrk5.js";import"./chunk-wkc34drs.js";import"./chunk-j4afmryj.js";import"./chunk-pj332gj9.js";import"./chunk-99kt56fn.js";import"./chunk-s10r6hxp.js";import"./chunk-tbef3yyk.js";import"./chunk-ab7vh24b.js";import"./chunk-pf0d8y9n.js";import"./chunk-01nx6zcw.js";import"./chunk-9ztdvnkk.js";import"./chunk-pcq6vphz.js";export{Zc as buildForProduction};
2
+ import{Zc}from"./chunk-4wc6hckd.js";import"./chunk-0w4ajnbv.js";import"./chunk-w1fy86aa.js";import"./chunk-kw7z9xtf.js";import"./chunk-w267tk8j.js";import"./chunk-8adstrk5.js";import"./chunk-wkc34drs.js";import"./chunk-j4afmryj.js";import"./chunk-mfby8kxp.js";import"./chunk-99kt56fn.js";import"./chunk-s10r6hxp.js";import"./chunk-tbef3yyk.js";import"./chunk-ab7vh24b.js";import"./chunk-pf0d8y9n.js";import"./chunk-01nx6zcw.js";import"./chunk-9ztdvnkk.js";import"./chunk-pcq6vphz.js";export{Zc as buildForProduction};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Zt,ae}from"./chunk-8scw1bes.js";import{m,Qt,w,Me,o,R}from"./chunk-sz5m446r.js";import{qr}from"./chunk-ennnv0n0.js";import{s,we}from"./chunk-ak95401g.js";import{a}from"./chunk-kk5cyjfs.js";import f from"path";import j from"fs";var pe=10;function V(e,n,i){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(f.basename(e))||qr(e,n,i)}var ne=1,re=new Map,P=600,fe=100,W=new Map;async function me(e){let n=W.get(e)??0;if(n>0&&n<fe){W.set(e,n+1);return}W.set(e,1);try{let i=(await j.promises.readdir(e)).filter((u)=>u.endsWith(".js"));if(i.length<=P)return;let g=(await Promise.all(i.map(async(u)=>{try{return{name:u,at:(await j.promises.stat(f.join(e,u))).mtimeMs}}catch{return null}}))).filter((u)=>u!==null);g.sort((u,l)=>l.at-u.at);for(let u of g.slice(P)){let l=u.name.slice(0,-3);await j.promises.rm(f.join(e,`${l}.js`),{force:!0}),await j.promises.rm(f.join(e,`${l}.deps.json`),{force:!0})}I("pruned bundle cache to",P,"entries")}catch{}}function ie(e){return re.get(e)??[]}function X(e,n){if(e)re.set(e,n)}function La(e=process.env){return e.STX_DEBUG==="true"||e.STX_DEBUG==="1"}function I(...e){if(La())console.log("[stx:bundler]",...e)}var Z=[];function No(e,n,i){Z.push({filePath:e||"<inline>",message:n,details:i})}function gt(){return Z.slice()}function mt(){Z.length=0}var q;function bu(e){q=e}function Lo(){if(q)return q;try{let e=R.strict;return typeof e==="object"&&e!==null?e.bundlerFallback??"warn":"warn"}catch{return"warn"}}var H=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function ht(e){let n=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,i;while((i=n.exec(e))!==null){let g=i[1];if(!H.some((l)=>l.test(g)))return I("detected user import:",g),!0}let c=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((i=c.exec(e))!==null){let g=i[1];if(/\.css(?:\?.*)?$/.test(g))continue;if(!H.some((l)=>l.test(g)))return I("detected side-effect import:",g),!0}return!1}var Yt="stx-module:",ge=/\.(?:[cm]?[jt]sx?|json)$/i;function ja(e,n){return f.relative(e,n).split(f.sep).join("/")}function Ba(e,n){if(n.size===0)return e;return e.replace(/^([ \t]*import\s+(?:[^;"']*?\s+from\s+)?)(["'])([^"']+)\2/gm,(i,c,g,u)=>{let l=n.get(u);return l&&!u.startsWith(Yt)?`${c}${g}${l}${g}`:i})}function Fa(e,n){let i=0,c=(u)=>{let l=`__stxMod${i++}`,v=JSON.stringify(u);return n.push(`var ${l} = globalThis.__stxModules && globalThis.__stxModules[${v}];`,`if (${l} === undefined) throw new Error("[stx] module " + ${JSON.stringify(v)} + " is not registered on this page (#1957)");`),l},g=(u,l)=>{for(let v of u.split(",")){let M=v.trim();if(!M)continue;let p=M.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!p)continue;let t=p[1].startsWith('"')?JSON.parse(p[1]):p[1],r=p[2]??t;n.push(`var ${r} = ${l}[${JSON.stringify(t)}];`)}};return e=e.replace(/^[ \t]*import\s+([^;"']*?)\s+from\s+["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(u,l,v)=>{let M=v.slice(Yt.length),p=c(M),t=l.trim(),r=t.match(/^([\w$]+)\s*(?:,\s*|$)/);if(r&&!t.startsWith("{")&&!t.startsWith("*"))n.push(`var ${r[1]} = ${p}.default;`),t=t.slice(r[0].length).trim();let d=t.match(/^\*\s*as\s+([\w$]+)$/);if(d)n.push(`var ${d[1]} = ${p};`);else if(t.startsWith("{"))g(t.replace(/^\{|\}$/g,""),p);return""}),e=e.replace(/^[ \t]*import\s+["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(u,l)=>(c(l.slice(Yt.length)),"")),e}function ee(e){let n=[e,`${e}.ts`,`${e}.tsx`,`${e}.js`,`${e}.mjs`,`${e}.jsx`,f.join(e,"index.ts"),f.join(e,"index.tsx"),f.join(e,"index.js"),f.join(e,"index.mjs")];for(let i of n)try{if(j.existsSync(i)&&j.statSync(i,{throwIfNoEntry:!1})?.isFile())return i}catch{}return}function he(e,n,i,c,g,u=new Map,l){let v=(p,t,r)=>{if(V(t,e,l))return null;if(!g||p!==i||!ge.test(t))return null;try{if(!j.statSync(t,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}c.add(t);let d=`${Yt}${ja(process.cwd(),t)}`;return u.set(r,d),{path:d,external:!0}},M=(p,t)=>{let r=p===i?n:f.dirname(p),d=f.resolve(r,t);return ee(d)??d};return{name:"stx-client-bundle",setup(p){if(p.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(t)=>({path:t.path,external:!0})),p.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(t)=>({path:t.path,external:!0})),p.onResolve({filter:/^\//},(t)=>{let r=ee(t.path);if(r){let d=v(t.importer,r,t.path);if(d)return d;if(r!==i)c.add(r);return{path:r}}return{path:t.path,external:!0}}),p.onResolve({filter:/^\.\.?\//},(t)=>{let r=M(t.importer,t.path),d=v(t.importer,r,t.path);if(d)return d;return c.add(r),{path:r}}),p.onResolve({filter:/^[@~]\//},(t)=>{let r=f.resolve(e,t.path.slice(2)),d=[r,`${r}.ts`,`${r}.tsx`,`${r}.js`,`${r}.mjs`,`${r}.jsx`,f.join(r,"index.ts"),f.join(r,"index.tsx"),f.join(r,"index.js"),f.join(r,"index.mjs")];for(let E of d)if(j.existsSync(E)&&j.statSync(E,{throwIfNoEntry:!1})?.isFile()){let C=v(t.importer,E,t.path);if(C)return C;return I(`resolved ${t.path[0]}/ import:`,t.path,"\u2192",E),c.add(E),{path:E}}return console.warn(`[stx:bundler] could not resolve ${t.path[0]}/ import:`,t.path),{path:r}}),g)p.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(t)=>{if(t.importer!==i)return;let r=`${Yt}npm:${t.path}`;return u.set(t.path,r),{path:r,external:!0}});p.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(t)=>{if(V(t.path,e,l))throw Error(`Server-only API source cannot be imported by a client script: ${t.path}`);let r=f.extname(t.path).toLowerCase(),d=r===".json"?"json":r===".tsx"?"tsx":r===".jsx"?"jsx":r===".ts"||r===".mts"||r===".cts"?"ts":"js";if(t.path!==i)c.add(t.path);return{contents:j.readFileSync(t.path,"utf8"),loader:d}})}}}var G=new Map,L=m(64),te=Symbol.for("stx.client-bundle-build-queue");function za(e){let n=globalThis,c=(n[te]??Promise.resolve()).then(e,e);return n[te]=c.then(()=>{return},()=>{return}),c}async function yt(e,n,i={}){let c=i.projectRoot||process.cwd(),g=(await o(c)).serverApi,u=i.minify??!1,l=i.externalizeUserModules??!0,v=i.expose?.length?[...new Set(i.expose)].sort():void 0,M=i.cacheDir||a(c,"bundle-cache"),p=new Bun.CryptoHasher("md5");p.update(`${pe}\x00${Me()}\x00${JSON.stringify(g??!1)}\x00${l?"registry":"inline"}\x00${v?v.join(","):"*"}\x00${e}\x00${n}`);let t=p.digest("hex").slice(0,12),r=f.join(M,`${t}.js`),d=L.get(r);if(d){if(Qt(d.files)&&d.files.every((A)=>!V(A.path,c,g))){I("memo hit:",t);let A=d.files.map((B)=>B.path);return X(n,A),i.collectInputs?.push(...A),d.code}L.delete(r),I("memo invalidated by dep change:",t)}let E=f.join(M,`${t}.deps.json`),C=Bun.file(r);if(await C.exists()){let A=Bun.file(E),B=!1,N=null;if(await A.exists())try{let O=JSON.parse(await A.text());if(O.metadataVersion!==ne||!Array.isArray(O.files))B=!1;else N=O.files,B=!0;if(N&&(!Qt(N)||N.some((D)=>V(D.path,c,g))))B=!1}catch{B=!1}if(B){if(I("cache hit:",t),N)X(n,N.map((D)=>D.path)),i.collectInputs?.push(...N.map((D)=>D.path));let O=await C.text();if(N)L.set(r,{code:O,files:N});return O}I("cache invalidated by dep change:",t)}let _=G.get(t);if(_){let A=await _;if(i.collectInputs)i.collectInputs.push(...(L.get(r)?.files??[]).map((B)=>B.path));return A}let z=za(()=>$e(e,n,{projectRoot:c,minify:u,cacheDir:M,hash:t,cachePath:r,depsPath:E,collectInputs:i.collectInputs,externalizeUserModules:l,serverApi:g,expose:v,throwOnFailure:i.throwOnFailure}));G.set(t,z);try{return await z}finally{G.delete(t)}}var xe=0;function Ha(e){return`${e}-${process.pid}-${++xe}`}async function $e(e,n,i){let{projectRoot:c,minify:g,cacheDir:u,hash:l,cachePath:v,depsPath:M,externalizeUserModules:p}=i,t=a(c,"bundle-tmp"),r=Ha(l),d=f.join(t,`${r}.ts`),E=f.join(t,"out",r);j.mkdirSync(t,{recursive:!0}),j.mkdirSync(E,{recursive:!0});let C=f.dirname(n),_=new Set,z=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,A=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,B=s(e),{depths:N,balanced:O}=we(B),D=(S)=>!O||N[S]===0,b;while((b=z.exec(B))!==null){if(b[1])continue;if(!D(b.index))continue;if(b[2])b[2].split(",").forEach((S)=>{let h=be(S);if(h)_.add(h)});else if(b[3])_.add(b[3])}while((b=A.exec(B))!==null){if(b[1])continue;if(!D(b.index))continue;_.add(b[2])}let se=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((b=se.exec(B))!==null){if(!D(b.index))continue;let S=/^\s*['"]([^'"]+)['"]/.exec(e.slice(b.index+b[0].length))?.[1];if(S&&H.some((h)=>h.test(S)))continue;if(b[1])_.add(b[1]);if(b[2])_.add(b[2]);for(let h of(b[3]??"").split(",")){let y=h.trim();if(!y||/^type\s/.test(y))continue;let U=/\bas\s+(\w+)\s*$/.exec(y)?.[1]??/^\w+$/.exec(y)?.[0];if(U)_.add(U)}}for(let S of B.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let h of S[1].split(",")){let y=/\bas\s+(\w+)\s*$/.exec(h)?.[1]??/^\s*(\w+)\s*$/.exec(h)?.[1];if(y)_.delete(y)}let oe=_.size>0?`
2
+ import{Zt,ae}from"./chunk-8scw1bes.js";import{m,Qt,w,Me,o,R}from"./chunk-w267tk8j.js";import{qr}from"./chunk-kw7z9xtf.js";import{s,we}from"./chunk-ak95401g.js";import{a}from"./chunk-kk5cyjfs.js";import f from"path";import j from"fs";var pe=10;function V(e,n,i){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(f.basename(e))||qr(e,n,i)}var ne=1,re=new Map,P=600,fe=100,W=new Map;async function me(e){let n=W.get(e)??0;if(n>0&&n<fe){W.set(e,n+1);return}W.set(e,1);try{let i=(await j.promises.readdir(e)).filter((u)=>u.endsWith(".js"));if(i.length<=P)return;let g=(await Promise.all(i.map(async(u)=>{try{return{name:u,at:(await j.promises.stat(f.join(e,u))).mtimeMs}}catch{return null}}))).filter((u)=>u!==null);g.sort((u,l)=>l.at-u.at);for(let u of g.slice(P)){let l=u.name.slice(0,-3);await j.promises.rm(f.join(e,`${l}.js`),{force:!0}),await j.promises.rm(f.join(e,`${l}.deps.json`),{force:!0})}I("pruned bundle cache to",P,"entries")}catch{}}function ie(e){return re.get(e)??[]}function X(e,n){if(e)re.set(e,n)}function La(e=process.env){return e.STX_DEBUG==="true"||e.STX_DEBUG==="1"}function I(...e){if(La())console.log("[stx:bundler]",...e)}var Z=[];function No(e,n,i){Z.push({filePath:e||"<inline>",message:n,details:i})}function gt(){return Z.slice()}function mt(){Z.length=0}var q;function bu(e){q=e}function Lo(){if(q)return q;try{let e=R.strict;return typeof e==="object"&&e!==null?e.bundlerFallback??"warn":"warn"}catch{return"warn"}}var H=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function ht(e){let n=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,i;while((i=n.exec(e))!==null){let g=i[1];if(!H.some((l)=>l.test(g)))return I("detected user import:",g),!0}let c=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((i=c.exec(e))!==null){let g=i[1];if(/\.css(?:\?.*)?$/.test(g))continue;if(!H.some((l)=>l.test(g)))return I("detected side-effect import:",g),!0}return!1}var Yt="stx-module:",ge=/\.(?:[cm]?[jt]sx?|json)$/i;function ja(e,n){return f.relative(e,n).split(f.sep).join("/")}function Ba(e,n){if(n.size===0)return e;return e.replace(/^([ \t]*import\s+(?:[^;"']*?\s+from\s+)?)(["'])([^"']+)\2/gm,(i,c,g,u)=>{let l=n.get(u);return l&&!u.startsWith(Yt)?`${c}${g}${l}${g}`:i})}function Fa(e,n){let i=0,c=(u)=>{let l=`__stxMod${i++}`,v=JSON.stringify(u);return n.push(`var ${l} = globalThis.__stxModules && globalThis.__stxModules[${v}];`,`if (${l} === undefined) throw new Error("[stx] module " + ${JSON.stringify(v)} + " is not registered on this page (#1957)");`),l},g=(u,l)=>{for(let v of u.split(",")){let M=v.trim();if(!M)continue;let p=M.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!p)continue;let t=p[1].startsWith('"')?JSON.parse(p[1]):p[1],r=p[2]??t;n.push(`var ${r} = ${l}[${JSON.stringify(t)}];`)}};return e=e.replace(/^[ \t]*import\s+([^;"']*?)\s+from\s+["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(u,l,v)=>{let M=v.slice(Yt.length),p=c(M),t=l.trim(),r=t.match(/^([\w$]+)\s*(?:,\s*|$)/);if(r&&!t.startsWith("{")&&!t.startsWith("*"))n.push(`var ${r[1]} = ${p}.default;`),t=t.slice(r[0].length).trim();let d=t.match(/^\*\s*as\s+([\w$]+)$/);if(d)n.push(`var ${d[1]} = ${p};`);else if(t.startsWith("{"))g(t.replace(/^\{|\}$/g,""),p);return""}),e=e.replace(/^[ \t]*import\s+["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(u,l)=>(c(l.slice(Yt.length)),"")),e}function ee(e){let n=[e,`${e}.ts`,`${e}.tsx`,`${e}.js`,`${e}.mjs`,`${e}.jsx`,f.join(e,"index.ts"),f.join(e,"index.tsx"),f.join(e,"index.js"),f.join(e,"index.mjs")];for(let i of n)try{if(j.existsSync(i)&&j.statSync(i,{throwIfNoEntry:!1})?.isFile())return i}catch{}return}function he(e,n,i,c,g,u=new Map,l){let v=(p,t,r)=>{if(V(t,e,l))return null;if(!g||p!==i||!ge.test(t))return null;try{if(!j.statSync(t,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}c.add(t);let d=`${Yt}${ja(process.cwd(),t)}`;return u.set(r,d),{path:d,external:!0}},M=(p,t)=>{let r=p===i?n:f.dirname(p),d=f.resolve(r,t);return ee(d)??d};return{name:"stx-client-bundle",setup(p){if(p.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(t)=>({path:t.path,external:!0})),p.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(t)=>({path:t.path,external:!0})),p.onResolve({filter:/^\//},(t)=>{let r=ee(t.path);if(r){let d=v(t.importer,r,t.path);if(d)return d;if(r!==i)c.add(r);return{path:r}}return{path:t.path,external:!0}}),p.onResolve({filter:/^\.\.?\//},(t)=>{let r=M(t.importer,t.path),d=v(t.importer,r,t.path);if(d)return d;return c.add(r),{path:r}}),p.onResolve({filter:/^[@~]\//},(t)=>{let r=f.resolve(e,t.path.slice(2)),d=[r,`${r}.ts`,`${r}.tsx`,`${r}.js`,`${r}.mjs`,`${r}.jsx`,f.join(r,"index.ts"),f.join(r,"index.tsx"),f.join(r,"index.js"),f.join(r,"index.mjs")];for(let E of d)if(j.existsSync(E)&&j.statSync(E,{throwIfNoEntry:!1})?.isFile()){let C=v(t.importer,E,t.path);if(C)return C;return I(`resolved ${t.path[0]}/ import:`,t.path,"\u2192",E),c.add(E),{path:E}}return console.warn(`[stx:bundler] could not resolve ${t.path[0]}/ import:`,t.path),{path:r}}),g)p.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(t)=>{if(t.importer!==i)return;let r=`${Yt}npm:${t.path}`;return u.set(t.path,r),{path:r,external:!0}});p.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(t)=>{if(V(t.path,e,l))throw Error(`Server-only API source cannot be imported by a client script: ${t.path}`);let r=f.extname(t.path).toLowerCase(),d=r===".json"?"json":r===".tsx"?"tsx":r===".jsx"?"jsx":r===".ts"||r===".mts"||r===".cts"?"ts":"js";if(t.path!==i)c.add(t.path);return{contents:j.readFileSync(t.path,"utf8"),loader:d}})}}}var G=new Map,L=m(64),te=Symbol.for("stx.client-bundle-build-queue");function za(e){let n=globalThis,c=(n[te]??Promise.resolve()).then(e,e);return n[te]=c.then(()=>{return},()=>{return}),c}async function yt(e,n,i={}){let c=i.projectRoot||process.cwd(),g=(await o(c)).serverApi,u=i.minify??!1,l=i.externalizeUserModules??!0,v=i.expose?.length?[...new Set(i.expose)].sort():void 0,M=i.cacheDir||a(c,"bundle-cache"),p=new Bun.CryptoHasher("md5");p.update(`${pe}\x00${Me()}\x00${JSON.stringify(g??!1)}\x00${l?"registry":"inline"}\x00${v?v.join(","):"*"}\x00${e}\x00${n}`);let t=p.digest("hex").slice(0,12),r=f.join(M,`${t}.js`),d=L.get(r);if(d){if(Qt(d.files)&&d.files.every((A)=>!V(A.path,c,g))){I("memo hit:",t);let A=d.files.map((B)=>B.path);return X(n,A),i.collectInputs?.push(...A),d.code}L.delete(r),I("memo invalidated by dep change:",t)}let E=f.join(M,`${t}.deps.json`),C=Bun.file(r);if(await C.exists()){let A=Bun.file(E),B=!1,N=null;if(await A.exists())try{let O=JSON.parse(await A.text());if(O.metadataVersion!==ne||!Array.isArray(O.files))B=!1;else N=O.files,B=!0;if(N&&(!Qt(N)||N.some((D)=>V(D.path,c,g))))B=!1}catch{B=!1}if(B){if(I("cache hit:",t),N)X(n,N.map((D)=>D.path)),i.collectInputs?.push(...N.map((D)=>D.path));let O=await C.text();if(N)L.set(r,{code:O,files:N});return O}I("cache invalidated by dep change:",t)}let _=G.get(t);if(_){let A=await _;if(i.collectInputs)i.collectInputs.push(...(L.get(r)?.files??[]).map((B)=>B.path));return A}let z=za(()=>$e(e,n,{projectRoot:c,minify:u,cacheDir:M,hash:t,cachePath:r,depsPath:E,collectInputs:i.collectInputs,externalizeUserModules:l,serverApi:g,expose:v,throwOnFailure:i.throwOnFailure}));G.set(t,z);try{return await z}finally{G.delete(t)}}var xe=0;function Ha(e){return`${e}-${process.pid}-${++xe}`}async function $e(e,n,i){let{projectRoot:c,minify:g,cacheDir:u,hash:l,cachePath:v,depsPath:M,externalizeUserModules:p}=i,t=a(c,"bundle-tmp"),r=Ha(l),d=f.join(t,`${r}.ts`),E=f.join(t,"out",r);j.mkdirSync(t,{recursive:!0}),j.mkdirSync(E,{recursive:!0});let C=f.dirname(n),_=new Set,z=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,A=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,B=s(e),{depths:N,balanced:O}=we(B),D=(S)=>!O||N[S]===0,b;while((b=z.exec(B))!==null){if(b[1])continue;if(!D(b.index))continue;if(b[2])b[2].split(",").forEach((S)=>{let h=be(S);if(h)_.add(h)});else if(b[3])_.add(b[3])}while((b=A.exec(B))!==null){if(b[1])continue;if(!D(b.index))continue;_.add(b[2])}let se=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((b=se.exec(B))!==null){if(!D(b.index))continue;let S=/^\s*['"]([^'"]+)['"]/.exec(e.slice(b.index+b[0].length))?.[1];if(S&&H.some((h)=>h.test(S)))continue;if(b[1])_.add(b[1]);if(b[2])_.add(b[2]);for(let h of(b[3]??"").split(",")){let y=h.trim();if(!y||/^type\s/.test(y))continue;let U=/\bas\s+(\w+)\s*$/.exec(y)?.[1]??/^\w+$/.exec(y)?.[0];if(U)_.add(U)}}for(let S of B.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let h of S[1].split(",")){let y=/\bas\s+(\w+)\s*$/.exec(h)?.[1]??/^\s*(\w+)\s*$/.exec(h)?.[1];if(y)_.delete(y)}let oe=_.size>0?`
3
3
  export { ${[..._].join(", ")} }`:"";await Bun.write(d,e+oe),I("bundling:",l,"from:",f.basename(n));let Y=new Set,Q=new Map;try{let S=await Bun.build({entrypoints:[d],outdir:E,target:"browser",format:"esm",minify:g,plugins:[he(c,C,d,Y,p,Q,i.serverApi)],define:{"process.env.NODE_ENV":g?'"production"':'"development"',...w()},root:c});if(!S.success){let F=S.logs.filter((T)=>T.level==="error").map((T)=>T.message).join(", ")||`Unable to bundle ${f.basename(n)}`,k=Zt(S.logs,n||void 0);if(console.warn("[stx:bundler] build failed:",F),No(n||"",F,k),i.throwOnFailure||Lo()==="error")throw Error(F);return e}let h="";for(let x of S.outputs){h=await x.text();break}let y=[];for(let x of h.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let F of x[1].split(",")){let k=F.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(k){y.push([k[2],k[1]]);continue}let T=F.trim();if(/^[A-Za-z_$][\w$]*$/.test(T))y.push([T,T])}if(i.expose){let x=new Set(i.expose);for(let F=y.length-1;F>=0;F--)if(!x.has(y[F][0]))y.splice(F,1)}let U=[];h=Fa(Ba(h,Q),U);let le=h.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];h=h.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let K=`__stxBundle_${l}`,ce=y.map(([x,F])=>`${JSON.stringify(x)}: ${F}`).join(", "),ue=y.map(([x])=>`var ${x} = undefined;`).join(`
4
4
  `),de=y.map(([x])=>`${x} = ${K}[${JSON.stringify(x)}];`).join(`
5
5
  `);if(h=`${le.join(`
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{I,_c,o,R,Hu,Vu}from"./chunk-sz5m446r.js";import"./chunk-8adstrk5.js";import"./chunk-wkc34drs.js";import"./chunk-j4afmryj.js";import"./chunk-pj332gj9.js";import"./chunk-99kt56fn.js";import"./chunk-s10r6hxp.js";import"./chunk-tbef3yyk.js";import"./chunk-ab7vh24b.js";import"./chunk-pf0d8y9n.js";import"./chunk-01nx6zcw.js";import"./chunk-9ztdvnkk.js";import"./chunk-pcq6vphz.js";export{R as config,I as defaultConfig,Hu as defineStxConfig,o as loadStxConfig,_c as resolveStxDirectories,Vu as validateConfig};
2
+ import{I,_c,o,R,Hu,Vu}from"./chunk-w267tk8j.js";import"./chunk-8adstrk5.js";import"./chunk-wkc34drs.js";import"./chunk-j4afmryj.js";import"./chunk-mfby8kxp.js";import"./chunk-99kt56fn.js";import"./chunk-s10r6hxp.js";import"./chunk-tbef3yyk.js";import"./chunk-ab7vh24b.js";import"./chunk-pf0d8y9n.js";import"./chunk-01nx6zcw.js";import"./chunk-9ztdvnkk.js";import"./chunk-pcq6vphz.js";export{R as config,I as defaultConfig,Hu as defineStxConfig,o as loadStxConfig,_c as resolveStxDirectories,Vu as validateConfig};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Kl,Xl}from"./chunk-sf1fxvwa.js";import"./chunk-nt98fd0r.js";import"./chunk-kw7z9xtf.js";import"./chunk-8scw1bes.js";import"./chunk-w267tk8j.js";import"./chunk-8adstrk5.js";import"./chunk-wkc34drs.js";import"./chunk-j4afmryj.js";import"./chunk-mfby8kxp.js";import"./chunk-99kt56fn.js";import"./chunk-s10r6hxp.js";import"./chunk-tbef3yyk.js";import"./chunk-ab7vh24b.js";import"./chunk-pf0d8y9n.js";import"./chunk-01nx6zcw.js";import"./chunk-9ztdvnkk.js";import"./chunk-pcq6vphz.js";export{Xl as clearStoreCache,Kl as getStoreScript};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ko,Co,$o,hu}from"./chunk-jcrcqtb3.js";import"./chunk-1khb6g2w.js";import"./chunk-sz5m446r.js";import"./chunk-8adstrk5.js";import"./chunk-wkc34drs.js";import"./chunk-j4afmryj.js";import"./chunk-pj332gj9.js";import"./chunk-99kt56fn.js";import"./chunk-s10r6hxp.js";import"./chunk-tbef3yyk.js";import"./chunk-ab7vh24b.js";import"./chunk-pf0d8y9n.js";import"./chunk-01nx6zcw.js";import"./chunk-9ztdvnkk.js";import"./chunk-pcq6vphz.js";export{ko as buildNative,hu as default,$o as getAvailableFormats,Co as getAvailableTargets};
2
+ import{ko,Co,$o,hu}from"./chunk-1yt6vfyx.js";import"./chunk-fd5x89cr.js";import"./chunk-w267tk8j.js";import"./chunk-8adstrk5.js";import"./chunk-wkc34drs.js";import"./chunk-j4afmryj.js";import"./chunk-mfby8kxp.js";import"./chunk-99kt56fn.js";import"./chunk-s10r6hxp.js";import"./chunk-tbef3yyk.js";import"./chunk-ab7vh24b.js";import"./chunk-pf0d8y9n.js";import"./chunk-01nx6zcw.js";import"./chunk-9ztdvnkk.js";import"./chunk-pcq6vphz.js";export{ko as buildNative,hu as default,$o as getAvailableFormats,Co as getAvailableTargets};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{y}from"./chunk-01nx6zcw.js";import{P,Tt}from"./chunk-pf0d8y9n.js";import{m,h,w,He,L,o}from"./chunk-sz5m446r.js";import{ie,ht,yt}from"./chunk-3mzmz1ht.js";import{Pe,Ut,dt,H}from"./chunk-xnjcmhs5.js";import _ from"path";var x=new Map,D=new Map,N=m(64),k=new Map,U=["composables","functions"];function O(t){let r=_.basename(t,".ts");return r==="index"||r==="types"||t.endsWith(".d.ts")}async function W(t){if(t)return _.resolve(t);let r=`<default>:${process.cwd()}`,c=k.get(r);if(c!==void 0)return c;let e=await X();if(e!==null)k.set(r,e);return e}async function X(){let t=await o(),r=t.root||process.cwd(),c=t.composablesDir;if(c)return _.resolve(r,c);for(let e of U){let i=_.resolve(r,e);try{let l=new Bun.Glob("**/*.ts");for await(let a of l.scan({cwd:i,absolute:!0}))if(!O(a))return i}catch{}}return null}async function G(t){let r=Array.isArray(t)?t:t?[_.resolve(t)]:(await o())._layerComposableDirs??[await W()].filter((e)=>!!e),c=new Map;for(let e of r){let i=new Bun.Glob("**/*.ts");try{for await(let l of i.scan({cwd:e,absolute:!0})){let a=_.relative(e,l);if(!O(l)&&!c.has(a))c.set(a,l)}}catch{}}return{key:r.join("\x00"),files:[...c.values()].sort()}}async function Mr(t){let{files:r}=await G(t),c=L({loader:"ts",target:"browser",define:w()}),e=[];for(let i of r)try{let l=await Bun.file(i).text(),a=c.scan(l).exports.filter((f)=>f!=="default");if(a.length>0)e.push({file:i,names:a})}catch{}return e}function Z(t,r){return new RegExp(`\\b${r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test(t)}function q(t,r){let c=new Set(t.match(/\w+/g)),e=new Set;for(let i of r)if(/^\w+$/.test(i)?c.has(i):Z(t,i))e.add(i);return e}function Q(t,r,c){let e=new Map;for(let{file:f,names:d}of t)for(let u of d)if(!e.has(u))e.set(u,f);let i=(f)=>{let d=[];for(let u of q(f,e.keys()))d.push(e.get(u));return d},l=new Set,a=c.flatMap(i);while(a.length>0){let f=[];for(let d of a){if(l.has(d))continue;l.add(d);for(let u of i(r.get(d)??""))if(!l.has(u))f.push(u)}a=f}return l}async function El(t,r,c){let{key:e,files:i}=await G(t);if(!e)return null;let l=()=>[...new Set([...i,...i.flatMap((n)=>ie(n))])],a=Pe(l());if(i.length===0)return H(x,e,a,""),null;i.sort();let f=L({loader:"ts",target:"browser",define:w()}),d=dt(D,e,a);if(!d){let n=new Map,s=[];for(let p of i)try{let S=await Bun.file(p).text();n.set(p,S);let g=f.scan(S).exports.filter((z)=>z!=="default");if(g.length>0)s.push({file:p,names:g})}catch{n.set(p,"")}d=H(D,e,a,{codeByFile:n,modules:s})}let{codeByFile:u,modules:J}=d,b;if(r===void 0)b=new Set(i);else{let n=c?[r,...c]:[r],s=h(n.join("\x00"),e,n.length,a),p=N.get(s);if(b=p??Q(J,u,n),!p)N.set(s,b)}if(b.size===0)return null;let E=i.filter((n)=>b.has(n)),v=`${e}\x00${E.join("\x00")}`,I=dt(x,v,a);if(I!==void 0)return I||null;let M=[],C=new Set,F=new Set;for(let n of E)try{let s=u.get(n)??await Bun.file(n).text(),p=_.basename(n,".ts");for(let g of s.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(g[1])F.add(g[1]);let S=[];try{for(let g of f.scan(s).exports)if(g!=="default")C.add(g),S.push(g)}catch{}if(s=P(s),ht(s))s=await yt(s,n,{projectRoot:process.cwd(),externalizeUserModules:!1,expose:S}),s=He(s);s=Tt(s),s=s.replace(/^export\s+(default\s+)?/gm,""),s=f.transformSync(s),M.push(`// Composable: ${p}
2
+ import{y}from"./chunk-01nx6zcw.js";import{P,Tt}from"./chunk-pf0d8y9n.js";import{m,h,w,He,L,o}from"./chunk-w267tk8j.js";import{ie,ht,yt}from"./chunk-nt98fd0r.js";import{Pe,Ut,dt,H}from"./chunk-xnjcmhs5.js";import _ from"path";var x=new Map,D=new Map,N=m(64),k=new Map,U=["composables","functions"];function O(t){let r=_.basename(t,".ts");return r==="index"||r==="types"||t.endsWith(".d.ts")}async function W(t){if(t)return _.resolve(t);let r=`<default>:${process.cwd()}`,c=k.get(r);if(c!==void 0)return c;let e=await X();if(e!==null)k.set(r,e);return e}async function X(){let t=await o(),r=t.root||process.cwd(),c=t.composablesDir;if(c)return _.resolve(r,c);for(let e of U){let i=_.resolve(r,e);try{let l=new Bun.Glob("**/*.ts");for await(let a of l.scan({cwd:i,absolute:!0}))if(!O(a))return i}catch{}}return null}async function G(t){let r=Array.isArray(t)?t:t?[_.resolve(t)]:(await o())._layerComposableDirs??[await W()].filter((e)=>!!e),c=new Map;for(let e of r){let i=new Bun.Glob("**/*.ts");try{for await(let l of i.scan({cwd:e,absolute:!0})){let a=_.relative(e,l);if(!O(l)&&!c.has(a))c.set(a,l)}}catch{}}return{key:r.join("\x00"),files:[...c.values()].sort()}}async function Mr(t){let{files:r}=await G(t),c=L({loader:"ts",target:"browser",define:w()}),e=[];for(let i of r)try{let l=await Bun.file(i).text(),a=c.scan(l).exports.filter((f)=>f!=="default");if(a.length>0)e.push({file:i,names:a})}catch{}return e}function Z(t,r){return new RegExp(`\\b${r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test(t)}function q(t,r){let c=new Set(t.match(/\w+/g)),e=new Set;for(let i of r)if(/^\w+$/.test(i)?c.has(i):Z(t,i))e.add(i);return e}function Q(t,r,c){let e=new Map;for(let{file:f,names:d}of t)for(let u of d)if(!e.has(u))e.set(u,f);let i=(f)=>{let d=[];for(let u of q(f,e.keys()))d.push(e.get(u));return d},l=new Set,a=c.flatMap(i);while(a.length>0){let f=[];for(let d of a){if(l.has(d))continue;l.add(d);for(let u of i(r.get(d)??""))if(!l.has(u))f.push(u)}a=f}return l}async function El(t,r,c){let{key:e,files:i}=await G(t);if(!e)return null;let l=()=>[...new Set([...i,...i.flatMap((n)=>ie(n))])],a=Pe(l());if(i.length===0)return H(x,e,a,""),null;i.sort();let f=L({loader:"ts",target:"browser",define:w()}),d=dt(D,e,a);if(!d){let n=new Map,s=[];for(let p of i)try{let S=await Bun.file(p).text();n.set(p,S);let g=f.scan(S).exports.filter((z)=>z!=="default");if(g.length>0)s.push({file:p,names:g})}catch{n.set(p,"")}d=H(D,e,a,{codeByFile:n,modules:s})}let{codeByFile:u,modules:J}=d,b;if(r===void 0)b=new Set(i);else{let n=c?[r,...c]:[r],s=h(n.join("\x00"),e,n.length,a),p=N.get(s);if(b=p??Q(J,u,n),!p)N.set(s,b)}if(b.size===0)return null;let E=i.filter((n)=>b.has(n)),v=`${e}\x00${E.join("\x00")}`,I=dt(x,v,a);if(I!==void 0)return I||null;let M=[],C=new Set,F=new Set;for(let n of E)try{let s=u.get(n)??await Bun.file(n).text(),p=_.basename(n,".ts");for(let g of s.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(g[1])F.add(g[1]);let S=[];try{for(let g of f.scan(s).exports)if(g!=="default")C.add(g),S.push(g)}catch{}if(s=P(s),ht(s))s=await yt(s,n,{projectRoot:process.cwd(),externalizeUserModules:!1,expose:S}),s=He(s);s=Tt(s),s=s.replace(/^export\s+(default\s+)?/gm,""),s=f.transformSync(s),M.push(`// Composable: ${p}
3
3
  ${s.trim()}`)}catch(s){console.warn(`[stx] Failed to load composable ${n}:`,s)}if(M.length===0||C.size===0)return H(x,v,a,""),null;let K=[...C].map((n)=>` try { if (!(${JSON.stringify(n)} in __c)) __c[${JSON.stringify(n)}] = ${n}; } catch (e) {}`).join(`
4
4
  `),j=JSON.stringify([...C]),B=M.join(`
5
5