@stacksjs/stx 0.2.910 → 0.2.913

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 (94) hide show
  1. package/dist/chunk-027qc41m.js +2 -0
  2. package/dist/{chunk-c829tgwv.js → chunk-084f6953.js} +1 -1
  3. package/dist/{chunk-ba27s9vr.js → chunk-0b5vmmf8.js} +1 -1
  4. package/dist/chunk-12f99j3h.js +2 -0
  5. package/dist/{chunk-cpt9sg6d.js → chunk-132j46ey.js} +1 -1
  6. package/dist/{chunk-cw7vnkc8.js → chunk-1nf2ma94.js} +1 -1
  7. package/dist/{chunk-cd2jc724.js → chunk-1qygqpc7.js} +1 -1
  8. package/dist/{chunk-dh4p07cc.js → chunk-2qypb5q8.js} +1 -1
  9. package/dist/{chunk-13awnyq0.js → chunk-2vdbt2a7.js} +1 -1
  10. package/dist/{chunk-e4fseqnv.js → chunk-3xgr1z61.js} +1 -1
  11. package/dist/{chunk-a259mfax.js → chunk-500be1wy.js} +2 -2
  12. package/dist/chunk-5md9ymx3.js +2 -0
  13. package/dist/{chunk-xjbj655y.js → chunk-5mv2hc96.js} +3 -3
  14. package/dist/{chunk-pp89n1et.js → chunk-5xsghm23.js} +1 -1
  15. package/dist/{chunk-4kh0616n.js → chunk-6s82ecbh.js} +4 -4
  16. package/dist/{chunk-anj2j86n.js → chunk-6vyy44ve.js} +2 -2
  17. package/dist/{chunk-ck4ypzet.js → chunk-75r2p1cz.js} +1 -1
  18. package/dist/{chunk-gwvkqf5r.js → chunk-7b2t9j0x.js} +4 -4
  19. package/dist/{chunk-7apr0ww2.js → chunk-7mv9z3mp.js} +1 -1
  20. package/dist/{chunk-688hf1mx.js → chunk-89z732nx.js} +1 -1
  21. package/dist/{chunk-87aqcw1w.js → chunk-8mc1kr6z.js} +1 -1
  22. package/dist/{chunk-b234w3mf.js → chunk-9gptdyqq.js} +14 -4
  23. package/dist/chunk-a774ncg3.js +3 -0
  24. package/dist/chunk-aty34jhn.js +2 -0
  25. package/dist/chunk-banmft69.js +2 -0
  26. package/dist/{chunk-jcp3rs1t.js → chunk-bwk2jakf.js} +1 -1
  27. package/dist/chunk-dk881ye4.js +2 -0
  28. package/dist/{chunk-ccq7d7ar.js → chunk-dm9r5gzb.js} +1 -1
  29. package/dist/{chunk-ggez55jb.js → chunk-etn044yn.js} +7 -7
  30. package/dist/{chunk-kvcz1926.js → chunk-exny40nv.js} +1 -1
  31. package/dist/chunk-f9dy0r3f.js +2 -0
  32. package/dist/{chunk-4zw9trtx.js → chunk-fcqca9qb.js} +1 -1
  33. package/dist/{chunk-vd03gnnb.js → chunk-fcxg3xwf.js} +5 -5
  34. package/dist/{chunk-9grwqzpe.js → chunk-fd8fp6h4.js} +1 -1
  35. package/dist/{chunk-ah615efp.js → chunk-fx6hg5yd.js} +1 -1
  36. package/dist/{chunk-r425m35g.js → chunk-g9s2t064.js} +1 -1
  37. package/dist/{chunk-zbzfkh3m.js → chunk-gfm238j6.js} +1 -1
  38. package/dist/{chunk-8d6wkfdx.js → chunk-gqz6502d.js} +2 -2
  39. package/dist/{chunk-94k80qpp.js → chunk-hacdy30m.js} +1 -1
  40. package/dist/{chunk-pgqc8895.js → chunk-hcxsyw55.js} +4 -4
  41. package/dist/{chunk-ph8k7jdx.js → chunk-hgpjneyy.js} +2 -2
  42. package/dist/{chunk-9nf58keq.js → chunk-hm954re1.js} +1 -1
  43. package/dist/{chunk-2r84qtat.js → chunk-ja4fyz87.js} +2 -2
  44. package/dist/chunk-jr3txt3f.js +2 -0
  45. package/dist/{chunk-3760wpvw.js → chunk-kc3w40c2.js} +1 -1
  46. package/dist/{chunk-5k55yk8g.js → chunk-mqknt05a.js} +1 -1
  47. package/dist/chunk-n008g6xh.js +2 -0
  48. package/dist/{chunk-dqt1kw68.js → chunk-p9cm5ksf.js} +1 -1
  49. package/dist/{chunk-gt3426kc.js → chunk-pasjfsz4.js} +1 -1
  50. package/dist/{chunk-4ccbj4z6.js → chunk-px6zx8ae.js} +1 -1
  51. package/dist/{chunk-pn3gj7zm.js → chunk-pzf34jvd.js} +1 -1
  52. package/dist/chunk-q8k9ava8.js +2 -0
  53. package/dist/{chunk-d5szrgdq.js → chunk-qedhz0p8.js} +1 -1
  54. package/dist/chunk-qfwnp28b.js +2 -0
  55. package/dist/{chunk-q33tyfpp.js → chunk-rbfrxaer.js} +1 -1
  56. package/dist/{chunk-caaexbqy.js → chunk-rmyhjta6.js} +1 -1
  57. package/dist/{chunk-29trx6h3.js → chunk-s19t5mh2.js} +1 -1
  58. package/dist/chunk-s26a54qk.js +2 -0
  59. package/dist/{chunk-magfdzdj.js → chunk-thrvqves.js} +1 -1
  60. package/dist/{chunk-pmmctgdd.js → chunk-tm4fgc58.js} +1 -1
  61. package/dist/{chunk-r2ns89f7.js → chunk-v37hjzt2.js} +1 -1
  62. package/dist/{chunk-13kfjnyn.js → chunk-vk9s9byv.js} +4 -4
  63. package/dist/{chunk-azyq6fds.js → chunk-vr6maaas.js} +1 -1
  64. package/dist/{chunk-g17g6w1t.js → chunk-whd6y829.js} +3 -3
  65. package/dist/chunk-ygrrbcfm.js +2 -0
  66. package/dist/chunk-ys68yvgz.js +2 -0
  67. package/dist/{chunk-kvrbdez2.js → chunk-z02jzx63.js} +1 -1
  68. package/dist/chunk-zjrnz9yt.js +7 -0
  69. package/dist/{chunk-x40j9ta1.js → chunk-zwhc17pt.js} +2 -2
  70. package/dist/chunk-zzpedcte.js +2 -0
  71. package/dist/cli.js +8 -8
  72. package/dist/craft-entry.js +1 -1
  73. package/dist/craft.js +1 -1
  74. package/dist/pwa.js +1 -1
  75. package/dist/ssg.js +2 -2
  76. package/dist/strip-literals.js +40 -26
  77. package/package.json +5 -5
  78. package/dist/chunk-1a911c4c.js +0 -2
  79. package/dist/chunk-24hrd8sg.js +0 -2
  80. package/dist/chunk-2cbrcb9m.js +0 -2
  81. package/dist/chunk-3rzpkjmn.js +0 -2
  82. package/dist/chunk-44qcbbc4.js +0 -2
  83. package/dist/chunk-6w9sgs52.js +0 -2
  84. package/dist/chunk-7w9ksdbp.js +0 -2
  85. package/dist/chunk-850b0cxa.js +0 -2
  86. package/dist/chunk-9yvhj108.js +0 -2
  87. package/dist/chunk-ahf9j8wb.js +0 -12
  88. package/dist/chunk-cf4apy9s.js +0 -3
  89. package/dist/chunk-cqcxj08t.js +0 -2
  90. package/dist/chunk-q6jecdtg.js +0 -2
  91. package/dist/chunk-ssdjny2r.js +0 -2
  92. package/dist/chunk-sx1jg8dw.js +0 -2
  93. package/dist/chunk-vf29gp9a.js +0 -2
  94. package/dist/chunk-ya8nwtdn.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{n,u}from"./chunk-c08jvjqt.js";import{Oi,s,On,b}from"./chunk-ggez55jb.js";import{ft}from"./chunk-b234w3mf.js";import{Vs,Ws}from"./chunk-eca022er.js";import{Zc,Si,Hs,Us}from"./chunk-mpfm5ctr.js";import{Gc,Jc}from"./chunk-r2ns89f7.js";import{Mt}from"./chunk-bvqgq18r.js";import{En,sl,Ir,Or}from"./chunk-w4177qn3.js";import{w}from"./chunk-v6gkjg5f.js";import{Co}from"./chunk-0d3pkkrv.js";import{c,f}from"./chunk-8tfpv6zf.js";import Q from"fs";import z from"path";import{loadConfigWithResult as Kt}from"bunfig";var K={duration:300,delay:0,ease:"ease",direction:"both"};function it(e,t={}){let{duration:i,delay:o,ease:r,direction:l,custom:d}={...K,...t};if(e==="custom"&&d)return d;switch(e){case"fade":return`${l==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":l==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
2
+ import{n,u}from"./chunk-c08jvjqt.js";import{Oi,s,On,b}from"./chunk-etn044yn.js";import{ft}from"./chunk-9gptdyqq.js";import{Vs,Ws}from"./chunk-eca022er.js";import{Zc,Si,Hs,Us}from"./chunk-mpfm5ctr.js";import{Gc,Jc}from"./chunk-v37hjzt2.js";import{Mt}from"./chunk-bvqgq18r.js";import{En,sl,Ir,Or}from"./chunk-w4177qn3.js";import{w}from"./chunk-v6gkjg5f.js";import{Co}from"./chunk-0d3pkkrv.js";import{c,f}from"./chunk-8tfpv6zf.js";import Q from"fs";import z from"path";import{loadConfigWithResult as Kt}from"bunfig";var K={duration:300,delay:0,ease:"ease",direction:"both"};function it(e,t={}){let{duration:i,delay:o,ease:r,direction:l,custom:d}={...K,...t};if(e==="custom"&&d)return d;switch(e){case"fade":return`${l==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":l==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
3
3
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
4
4
  @keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }`;case"slide":return`${l==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":l==="out"?"transform: translateY(0); opacity: 1; animation: slideOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: translateY(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
5
5
  @keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@@ -1306,6 +1306,6 @@ ${y}
1306
1306
  customElements.define('${t}', ${d});
1307
1307
  `}async function et(e,t,i,o){if(t.length<1)return u("WebComponent","@webcomponent directive requires at least the tag name parameter",n.INVALID_DIRECTIVE_SYNTAX);let r=t[0].replace(/['"]/g,""),d=(i.__stx_options||{}).componentsDir||"components",m=U.isAbsolute(d)?[U.join(d,`${r}.stx`),U.join(U.dirname(o),`${r}.stx`)]:[U.join(U.dirname(o),d,`${r}.stx`),U.join(process.cwd(),d,`${r}.stx`),U.join(U.dirname(o),`${r}.stx`)],p=null;for(let h of m)if(await s(h)){p=await Bun.file(h).text();break}if(!p)return u("WebComponent",`Component file not found: ${r}.stx`,n.FILE_NOT_FOUND);let g=Bt(p,r);return`<script type="module">
1308
1308
  ${Jt(g)}
1309
- </script>`}var q={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:En,cachePath:".stx/cache",cacheVersion:"1.0.0",componentRenderCacheBytes:33554432,build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:je,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:et,hasEndTag:!1,description:"Include a web component in the template"},Gc,Jc,Vs,Ws,Ae,Re,Ee,_e,Oe,Te,Ue,De,...Co],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,scrollRestoration:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};function Gt(e,t,i){let o=t||"pages";if(e)return{root:e,pagesDir:o};let r=i||process.cwd(),l=z.join(r,"resources","views"),d=z.join(r,"resources","layouts");if(Q.existsSync(l)&&Q.existsSync(d))return{root:"resources",pagesDir:"views"};let m=z.join(r,"resources","views","pages");if(Q.existsSync(m))return{root:"resources/views",pagesDir:o};return{root:".",pagesDir:o}}var tt=new Set,ge=["partialsDir","componentsDir","layoutsDir"],Pe=new WeakMap;function Yt(e,t){let i=t.replace(/[\\/]+$/,"");if(!i||i===".")return!0;let o=e.replace(/\\/g,"/"),r=i.replace(/\\/g,"/");return o===r||o.startsWith(`${r}/`)}function Sg(e,t){let i=!e.root,o=Gt(e.root,e.pagesDir,t);if(e.root=o.root,e.pagesDir=o.pagesDir,i&&o.root!=="."){let r=`${t}::${o.root}`;if(!tt.has(r))tt.add(r),console.warn(`[stx] No "root" in config \u2014 inferred "${o.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!Pe.has(e)){let r={};for(let l of ge){let d=e[l];if(typeof d==="string"&&d)r[l]=d}Pe.set(e,r)}if(e.root&&e.root!=="."){let r=e.root;for(let l of ge){let d=e[l];if(typeof d!=="string"||!d)continue;if(z.isAbsolute(d)||Yt(d,r))continue;e[l]=z.join(r,d)}}for(let r of ge){let l=e[r];if(typeof l!=="string"||!l||z.isAbsolute(l))continue;e[r]=z.resolve(t,l)}return e}function Xt(e,t){let i=Pe.get(e);for(let o of ge){let r=e[o];if(typeof r!=="string"||!r)continue;let l=z.isAbsolute(r)?r:z.join(t,r);if(Q.existsSync(l))continue;let d=i?.[o]??r,m=e.root,p=!!m&&m!==".";console.warn(`[stx] ${String(o)} resolves to "${l}", which does not exist. Configured as "${d}"`+(p?`, resolved under root "${m}".`:"."))}}function Zt(e){if(e.customDirectives)e.customDirectives=[...e.customDirectives];if(e.middleware)e.middleware=[...e.middleware];if(e.apiRoutes)e.apiRoutes={...e.apiRoutes}}function Qt(e){if(sl(e.stateDir),e.stateDir=Ir(),e.cachePath=Or(e.cachePath),e.build)e.build.cacheDir=Or(e.build.cacheDir);if(e.media?.cache)e.media.cache.directory=Or(e.media.cache.directory);if(e.story)e.story.outDir=Or(e.story.outDir)}var Y=null,Z=new Map,me=new Map,ae=null;async function vi(e,t=Kt){try{return await t(e)}catch(i){if(i instanceof Error&&i.name==="ConfigNotFoundError")return{config:e.defaultConfig};throw i}}var er=/[\\/]install[\\/]cache[\\/](?:@[^\\/]+[\\/])?[^\\/]+@[^\\/]*@@@\d+[\\/]/;function Wc(e,t){let i=w.resolve(e,{paths:[t]});if(er.test(i))throw Error(`${e} is not installed in ${t} (found only in Bun's install cache)`);return i}async function a(e){let t=e?z.resolve(e):process.cwd(),i=me.get(t);if(i&&i.signature!==Hs(i.graph)){let l=Z.get(t);if(Z.delete(t),me.delete(t),!e)Y=null,ae=null;let{clearComponentCache:d}=await import("./chunk-ccq7d7ar.js"),{partialsCache:m}=await import("./chunk-2cbrcb9m.js");if(d(),m.clear(),l&&i.configSignature===Us(i.graph)){let p=l.then(async(g)=>{let y={...i.graph};await Si(y,t),me.set(t,{graph:y,signature:Hs(y),configSignature:Us(y)});let h={...g,_layerGraph:y};if(!e)Y=h;return h});return Z.set(t,p),p}}if(!e){if(Y)return Y;if(ae)return ae}let o=Z.get(t);if(o)return o;let r=(async()=>{let l=[".ts",".js",".mjs",".cjs",".json"],d=l.some((v)=>Q.existsSync(z.join(t,`stx.config${v}`))),m=l.some((v)=>Q.existsSync(z.join(t,"config",`ui${v}`))),p;if(d&&m){let v=await vi({name:"ui",cwd:z.join(t,"config"),defaultConfig:q,errorPolicy:"throw",verbose:!1});p=(await vi({name:"stx",alias:"ui",cwd:t,defaultConfig:v.config,errorPolicy:"throw",verbose:!1})).config}else p=(await vi({name:"stx",alias:"ui",cwd:t,defaultConfig:q,errorPolicy:"throw",verbose:!1})).config;if(p.extends!==void 0||i){let v=await Zc(t,q);p=v.config,me.set(t,{graph:v.graph,signature:Hs(v.graph),configSignature:Us(v.graph)})}if(p.runtimeConfig){let{resolveRuntimeConfig:v}=await import("./chunk-43kz6rx9.js");v(p.runtimeConfig,{});let{generateRuntimeConfigTypes:x}=await import("./chunk-jcp3rs1t.js");await x(t,p.runtimeConfig)}Zt(p),Qt(p),Sg(p,t),Xt(p,t);let g=[],y=new Set((p.plugins??[]).map((v)=>typeof v==="string"?v:v[0]));for(let v of p.componentPackages??["@stacksjs/components"]){let x=`${v}/stx-plugin`;if(y.has(x)||y.has(v))continue;try{Wc(x,t),g.push(x)}catch{}}let h=[...p.plugins??[],...g];if(h.length>0){let{pluginManager:v}=await import("./chunk-cqq68aw8.js"),x=[],C=[],A=new Set(p.componentPackages??["@stacksjs/components"]),P=[];for(let R of h){let _=typeof R==="string"?R:R[0],I=typeof R==="string"?{}:R[1]||{};try{let T,k;try{let S=Wc(_,t);T=await import(S),k=z.dirname(S)}catch{let S=z.resolve(t,_);T=await import(S),k=z.dirname(S)}let D=T.default||T;if(!v.has(D.name))await v.register(D,p);if(D.components){let S=Array.isArray(D.components)?D.components:[D.components],M=A.has(D.name)||A.has(_)||A.has(_.replace(/\/stx-plugin$/,""));for(let F of S){let N=z.resolve(k,F);x.push(N);let V=M;if(!V){let E=Oi(z.join(N,"package.json"));if(E)try{let L=JSON.parse(Q.readFileSync(z.join(E,"package.json"),"utf8"));V=typeof L.name==="string"&&A.has(L.name)}catch{}}if(V)C.push(N)}}if(D.pages){let S=z.resolve(k,D.pages),M=I.path||"/";P.push({dir:S,prefix:M})}if(D.setup){let S={addDirective:(M)=>{p.customDirectives=p.customDirectives||[],p.customDirectives.push(M)},addRoute:(M,F)=>{p.apiRoutes=p.apiRoutes||{},p.apiRoutes[M]=F},addMiddleware:(M)=>{p.middleware=p.middleware||[],p.middleware.push(M)},pluginDir:k,config:p};await D.setup(I,S)}process.stderr.write(`[stx] Plugin loaded: ${D.name||_}
1309
+ </script>`}var q={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:En,cachePath:".stx/cache",cacheVersion:"1.0.0",componentRenderCacheBytes:33554432,build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:je,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:et,hasEndTag:!1,description:"Include a web component in the template"},Gc,Jc,Vs,Ws,Ae,Re,Ee,_e,Oe,Te,Ue,De,...Co],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,scrollRestoration:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};function Gt(e,t,i){let o=t||"pages";if(e)return{root:e,pagesDir:o};let r=i||process.cwd(),l=z.join(r,"resources","views"),d=z.join(r,"resources","layouts");if(Q.existsSync(l)&&Q.existsSync(d))return{root:"resources",pagesDir:"views"};let m=z.join(r,"resources","views","pages");if(Q.existsSync(m))return{root:"resources/views",pagesDir:o};return{root:".",pagesDir:o}}var tt=new Set,ge=["partialsDir","componentsDir","layoutsDir"],Pe=new WeakMap;function Yt(e,t){let i=t.replace(/[\\/]+$/,"");if(!i||i===".")return!0;let o=e.replace(/\\/g,"/"),r=i.replace(/\\/g,"/");return o===r||o.startsWith(`${r}/`)}function Sg(e,t){let i=!e.root,o=Gt(e.root,e.pagesDir,t);if(e.root=o.root,e.pagesDir=o.pagesDir,i&&o.root!=="."){let r=`${t}::${o.root}`;if(!tt.has(r))tt.add(r),console.warn(`[stx] No "root" in config \u2014 inferred "${o.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!Pe.has(e)){let r={};for(let l of ge){let d=e[l];if(typeof d==="string"&&d)r[l]=d}Pe.set(e,r)}if(e.root&&e.root!=="."){let r=e.root;for(let l of ge){let d=e[l];if(typeof d!=="string"||!d)continue;if(z.isAbsolute(d)||Yt(d,r))continue;e[l]=z.join(r,d)}}for(let r of ge){let l=e[r];if(typeof l!=="string"||!l||z.isAbsolute(l))continue;e[r]=z.resolve(t,l)}return e}function Xt(e,t){let i=Pe.get(e);for(let o of ge){let r=e[o];if(typeof r!=="string"||!r)continue;let l=z.isAbsolute(r)?r:z.join(t,r);if(Q.existsSync(l))continue;let d=i?.[o]??r,m=e.root,p=!!m&&m!==".";console.warn(`[stx] ${String(o)} resolves to "${l}", which does not exist. Configured as "${d}"`+(p?`, resolved under root "${m}".`:"."))}}function Zt(e){if(e.customDirectives)e.customDirectives=[...e.customDirectives];if(e.middleware)e.middleware=[...e.middleware];if(e.apiRoutes)e.apiRoutes={...e.apiRoutes}}function Qt(e){if(sl(e.stateDir),e.stateDir=Ir(),e.cachePath=Or(e.cachePath),e.build)e.build.cacheDir=Or(e.build.cacheDir);if(e.media?.cache)e.media.cache.directory=Or(e.media.cache.directory);if(e.story)e.story.outDir=Or(e.story.outDir)}var Y=null,Z=new Map,me=new Map,ae=null;async function vi(e,t=Kt){try{return await t(e)}catch(i){if(i instanceof Error&&i.name==="ConfigNotFoundError")return{config:e.defaultConfig};throw i}}var er=/[\\/]install[\\/]cache[\\/](?:@[^\\/]+[\\/])?[^\\/]+@[^\\/]*@@@\d+[\\/]/;function Wc(e,t){let i=w.resolve(e,{paths:[t]});if(er.test(i))throw Error(`${e} is not installed in ${t} (found only in Bun's install cache)`);return i}async function a(e){let t=e?z.resolve(e):process.cwd(),i=me.get(t);if(i&&i.signature!==Hs(i.graph)){let l=Z.get(t);if(Z.delete(t),me.delete(t),!e)Y=null,ae=null;let{clearComponentCache:d}=await import("./chunk-dm9r5gzb.js"),{partialsCache:m}=await import("./chunk-jr3txt3f.js");if(d(),m.clear(),l&&i.configSignature===Us(i.graph)){let p=l.then(async(g)=>{let y={...i.graph};await Si(y,t),me.set(t,{graph:y,signature:Hs(y),configSignature:Us(y)});let h={...g,_layerGraph:y};if(!e)Y=h;return h});return Z.set(t,p),p}}if(!e){if(Y)return Y;if(ae)return ae}let o=Z.get(t);if(o)return o;let r=(async()=>{let l=[".ts",".js",".mjs",".cjs",".json"],d=l.some((v)=>Q.existsSync(z.join(t,`stx.config${v}`))),m=l.some((v)=>Q.existsSync(z.join(t,"config",`ui${v}`))),p;if(d&&m){let v=await vi({name:"ui",cwd:z.join(t,"config"),defaultConfig:q,errorPolicy:"throw",verbose:!1});p=(await vi({name:"stx",alias:"ui",cwd:t,defaultConfig:v.config,errorPolicy:"throw",verbose:!1})).config}else p=(await vi({name:"stx",alias:"ui",cwd:t,defaultConfig:q,errorPolicy:"throw",verbose:!1})).config;if(p.extends!==void 0||i){let v=await Zc(t,q);p=v.config,me.set(t,{graph:v.graph,signature:Hs(v.graph),configSignature:Us(v.graph)})}if(p.runtimeConfig){let{resolveRuntimeConfig:v}=await import("./chunk-43kz6rx9.js");v(p.runtimeConfig,{});let{generateRuntimeConfigTypes:x}=await import("./chunk-bwk2jakf.js");await x(t,p.runtimeConfig)}Zt(p),Qt(p),Sg(p,t),Xt(p,t);let g=[],y=new Set((p.plugins??[]).map((v)=>typeof v==="string"?v:v[0]));for(let v of p.componentPackages??["@stacksjs/components"]){let x=`${v}/stx-plugin`;if(y.has(x)||y.has(v))continue;try{Wc(x,t),g.push(x)}catch{}}let h=[...p.plugins??[],...g];if(h.length>0){let{pluginManager:v}=await import("./chunk-cqq68aw8.js"),x=[],C=[],A=new Set(p.componentPackages??["@stacksjs/components"]),P=[];for(let R of h){let _=typeof R==="string"?R:R[0],I=typeof R==="string"?{}:R[1]||{};try{let T,k;try{let S=Wc(_,t);T=await import(S),k=z.dirname(S)}catch{let S=z.resolve(t,_);T=await import(S),k=z.dirname(S)}let D=T.default||T;if(!v.has(D.name))await v.register(D,p);if(D.components){let S=Array.isArray(D.components)?D.components:[D.components],M=A.has(D.name)||A.has(_)||A.has(_.replace(/\/stx-plugin$/,""));for(let F of S){let N=z.resolve(k,F);x.push(N);let V=M;if(!V){let E=Oi(z.join(N,"package.json"));if(E)try{let L=JSON.parse(Q.readFileSync(z.join(E,"package.json"),"utf8"));V=typeof L.name==="string"&&A.has(L.name)}catch{}}if(V)C.push(N)}}if(D.pages){let S=z.resolve(k,D.pages),M=I.path||"/";P.push({dir:S,prefix:M})}if(D.setup){let S={addDirective:(M)=>{p.customDirectives=p.customDirectives||[],p.customDirectives.push(M)},addRoute:(M,F)=>{p.apiRoutes=p.apiRoutes||{},p.apiRoutes[M]=F},addMiddleware:(M)=>{p.middleware=p.middleware||[],p.middleware.push(M)},pluginDir:k,config:p};await D.setup(I,S)}process.stderr.write(`[stx] Plugin loaded: ${D.name||_}
1310
1310
  `)}catch(T){console.warn(`[stx] Failed to load plugin ${_}:`,T.message)}}p._pluginComponentDirs=x,p._componentPackageDirs=C,p._pluginPageDirs=P}if(p.nativePrimitives!==!1)p._nativePrimitivesFallback={dir:Fs(),except:["Button","Checkbox","Switch","TextInput","Image","Video"]};return p})();if(Z.set(t,r),r.catch(()=>{if(Z.get(t)===r)Z.delete(t)}),!e)ae=r,r.then((l)=>{Y=l}).catch(()=>{});return r}var j=new Proxy(q,{get(e,t){if(Y&&t in Y)return Y[t];if(!ae)a().catch((i)=>{console.warn("[stx] Failed to load config file:",i?.message||i)});return e[t]}});function _y(e){return e}function Cy(e){let t=[],i=[];if(e.partialsDir!==void 0&&typeof e.partialsDir!=="string")t.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if(e.componentsDir!==void 0&&typeof e.componentsDir!=="string")t.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if(e.cache!==void 0&&typeof e.cache!=="boolean")t.push({path:"cache",message:"cache must be a boolean",severity:"error"});if(e.debug!==void 0&&typeof e.debug!=="boolean")t.push({path:"debug",message:"debug must be a boolean",severity:"error"});if(e.streaming){if(e.streaming.bufferSize!==void 0){if(typeof e.streaming.bufferSize!=="number"||e.streaming.bufferSize<=0)t.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if(e.streaming.timeout!==void 0){if(typeof e.streaming.timeout!=="number"||e.streaming.timeout<=0)t.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if(e.streaming.strategy!==void 0){let o=["auto","manual","sections"];if(!o.includes(e.streaming.strategy))t.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${o.join(", ")}`,severity:"error"})}}if(e.i18n){if(e.i18n.format!==void 0){let o=["json","yaml","yml","js"];if(!o.includes(e.i18n.format))t.push({path:"i18n.format",message:`i18n.format must be one of: ${o.join(", ")}`,severity:"error"})}}if(e.animation){if(e.animation.defaultDuration!==void 0){if(typeof e.animation.defaultDuration!=="number"||e.animation.defaultDuration<0)t.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if(e.animation.staggerDelay!==void 0){if(typeof e.animation.staggerDelay!=="number"||e.animation.staggerDelay<0)t.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if(e.a11y){if(e.a11y.level!==void 0){let o=["AA","AAA"];if(!o.includes(e.a11y.level))t.push({path:"a11y.level",message:`a11y.level must be one of: ${o.join(", ")}`,severity:"error"})}}if(e.hydration){if(e.hydration.mode!==void 0){let o=["progressive","islands"];if(!o.includes(e.hydration.mode))t.push({path:"hydration.mode",message:`hydration.mode must be one of: ${o.join(", ")}`,severity:"error"})}if(e.hydration.preload!==void 0){let o=["none","eager","lazy"];if(!o.includes(e.hydration.preload))t.push({path:"hydration.preload",message:`hydration.preload must be one of: ${o.join(", ")}`,severity:"error"})}}if(e.customDirectives)if(!Array.isArray(e.customDirectives))t.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else e.customDirectives.forEach((o,r)=>{if(!o.name||typeof o.name!=="string")t.push({path:`customDirectives[${r}].name`,message:"Custom directive must have a name string",severity:"error"});if(!o.handler||typeof o.handler!=="function")t.push({path:`customDirectives[${r}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if(e.middleware)if(!Array.isArray(e.middleware))t.push({path:"middleware",message:"middleware must be an array",severity:"error"});else e.middleware.forEach((o,r)=>{if(!o.name||typeof o.name!=="string")t.push({path:`middleware[${r}].name`,message:"Middleware must have a name string",severity:"error"});if(!o.handler||typeof o.handler!=="function")t.push({path:`middleware[${r}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!o.timing||!["before","after"].includes(o.timing))t.push({path:`middleware[${r}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if(e.debug===!0&&e.cache===!0)i.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if(e.seo?.enabled===!0&&!e.seo?.defaultConfig?.title)i.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if(e.pwa){if(e.pwa.enabled===!0&&!e.pwa.manifest?.name)t.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if(e.pwa.manifest?.display!==void 0){let o=["fullscreen","standalone","minimal-ui","browser"];if(!o.includes(e.pwa.manifest.display))t.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${o.join(", ")}`,severity:"error"})}if(e.pwa.manifest?.orientation!==void 0){let o=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!o.includes(e.pwa.manifest.orientation))t.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${o.join(", ")}`,severity:"error"})}if(e.pwa.routes){let o=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];e.pwa.routes.forEach((r,l)=>{if(!r.pattern||typeof r.pattern!=="string")t.push({path:`pwa.routes[${l}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!o.includes(r.strategy))t.push({path:`pwa.routes[${l}].strategy`,message:`PWA route strategy must be one of: ${o.join(", ")}`,severity:"error"});if(r.maxAgeSeconds!==void 0&&(typeof r.maxAgeSeconds!=="number"||r.maxAgeSeconds<0))t.push({path:`pwa.routes[${l}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(r.maxEntries!==void 0&&(typeof r.maxEntries!=="number"||r.maxEntries<1))t.push({path:`pwa.routes[${l}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if(e.pwa.icons?.sizes){if(!Array.isArray(e.pwa.icons.sizes))t.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if(e.pwa.icons.sizes.filter((r)=>typeof r!=="number"||r<16||r>1024).length>0)t.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if(e.pwa.icons?.purpose){let o=["any","maskable","monochrome"];if(e.pwa.icons.purpose.filter((l)=>!o.includes(l)).length>0)t.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${o.join(", ")}`,severity:"error"})}if(e.pwa.enabled===!0&&!e.pwa.icons?.src)i.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if(e.pwa.enabled===!0&&!e.pwa.manifest?.themeColor)i.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:t.length===0,errors:t,warnings:i}}
1311
1311
  export{Hc,Uc,$r,pt,Vc,Fs,zs,q,Sg,vi,Wc,a,j,_y,Cy};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{uy,fg,lt,Dc,dy,Ts,$s,Rs}from"./chunk-vk9s9byv.js";import"./chunk-0b5vmmf8.js";import"./chunk-a774ncg3.js";import"./chunk-9bexzgws.js";import"./chunk-v0yay1kw.js";import"./chunk-etn044yn.js";import"./chunk-fcqca9qb.js";import"./chunk-w98yt4d4.js";import"./chunk-c08jvjqt.js";import"./chunk-phzhmnnm.js";import"./chunk-75r2p1cz.js";import"./chunk-0jdz31q1.js";import"./chunk-4b110x6r.js";export{dy as clearOnceStore,Dc as onceStore,lt as partialsCache,Ts as processIncludes,$s as processStackPushDirectives,Rs as processStackReplacements,uy as resetUnscopedSignalWarnings,fg as topLevelElements};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ht,Og,Ng,Mg,Dg,Lg,y,jg,Ui,Bg,Sl,kl}from"./chunk-ggez55jb.js";import"./chunk-4zw9trtx.js";import"./chunk-w98yt4d4.js";import"./chunk-c08jvjqt.js";import"./chunk-phzhmnnm.js";import"./chunk-ck4ypzet.js";import"./chunk-0jdz31q1.js";import"./chunk-4b110x6r.js";export{ht as STX_ENGINE_BINDING_NAMES,Ui as convertToCommonJS,Sl as extractScriptFromTemplate,y as extractVariables,kl as hasVariables,jg as isCompleteImport,Lg as isMissingBindingFailure,Mg as isModuleResolutionFailure,Dg as isSyntaxFailure,Bg as splitDeclaration,Og as stripTypeScript,Ng as withoutStxReferrer};
2
+ import{ht,Og,Ng,Mg,Dg,Lg,y,jg,Ui,Bg,Sl,kl}from"./chunk-etn044yn.js";import"./chunk-fcqca9qb.js";import"./chunk-w98yt4d4.js";import"./chunk-c08jvjqt.js";import"./chunk-phzhmnnm.js";import"./chunk-75r2p1cz.js";import"./chunk-0jdz31q1.js";import"./chunk-4b110x6r.js";export{ht as STX_ENGINE_BINDING_NAMES,Ui as convertToCommonJS,Sl as extractScriptFromTemplate,y as extractVariables,kl as hasVariables,jg as isCompleteImport,Lg as isMissingBindingFailure,Mg as isModuleResolutionFailure,Dg as isSyntaxFailure,Bg as splitDeclaration,Og as stripTypeScript,Ng as withoutStxReferrer};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{P}from"./chunk-ggez55jb.js";import{i}from"./chunk-4kh0616n.js";import p from"fs";import g from"path";import*as y from"readline";var e={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m"},u={help:{description:"Show available commands",usage:"help [command]",handler:async(t,o)=>{if(t[0]&&u[t[0]]){let n=u[t[0]];console.log(`
2
+ import{P}from"./chunk-etn044yn.js";import{i}from"./chunk-6s82ecbh.js";import p from"fs";import g from"path";import*as y from"readline";var e={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m"},u={help:{description:"Show available commands",usage:"help [command]",handler:async(t,o)=>{if(t[0]&&u[t[0]]){let n=u[t[0]];console.log(`
3
3
  ${e.bold}${t[0]}${e.reset} - ${n.description}`),console.log(` Usage: ${e.cyan}${n.usage}${e.reset}
4
4
  `)}else{console.log(`
5
5
  ${e.bold}Available Commands:${e.reset}
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{mh,Ka,Uu,hh,yh,bh,wh,vh,Vu,Wu,xh,Sh,kh,_h}from"./chunk-89z732nx.js";import"./chunk-6s82ecbh.js";import"./chunk-zwhc17pt.js";import"./chunk-vk9s9byv.js";import"./chunk-fs43342z.js";import"./chunk-0b5vmmf8.js";import"./chunk-a774ncg3.js";import"./chunk-084f6953.js";import"./chunk-9bexzgws.js";import"./chunk-6vyy44ve.js";import"./chunk-hcxsyw55.js";import"./chunk-v0yay1kw.js";import"./chunk-z02jzx63.js";import"./chunk-2vdbt2a7.js";import"./chunk-ja4fyz87.js";import"./chunk-v37hjzt2.js";import"./chunk-razwegar.js";import"./chunk-mpfm5ctr.js";import"./chunk-eca022er.js";import"./chunk-9gptdyqq.js";import"./chunk-etn044yn.js";import"./chunk-fcqca9qb.js";import"./chunk-w98yt4d4.js";import"./chunk-c08jvjqt.js";import"./chunk-phzhmnnm.js";import"./chunk-75r2p1cz.js";import"./chunk-0jdz31q1.js";import"./chunk-4b110x6r.js";export{Uu as SUSPENSE_RESOLVER_RUNTIME,Ka as buildSuspenseResolveScript,vh as createStreamRenderer,bh as extractStreamBoundaries,_h as generateHydrationRuntime,Wu as islandDirective,Sh as processSectionDirectives,yh as processStreamDirectives,xh as registerStreamingDirectives,hh as renderStreamingPage,mh as streamTemplate,wh as streamTemplateSimple,kh as streamToResponse,Vu as streamingSuspenseDirective};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{gy,my,gg,Ps}from"./chunk-ba27s9vr.js";import"./chunk-cf4apy9s.js";import"./chunk-9bexzgws.js";import"./chunk-v0yay1kw.js";import{Fr}from"./chunk-ggez55jb.js";import"./chunk-4zw9trtx.js";import"./chunk-w98yt4d4.js";import{Ee}from"./chunk-c08jvjqt.js";import"./chunk-phzhmnnm.js";import"./chunk-ck4ypzet.js";import"./chunk-0jdz31q1.js";import"./chunk-4b110x6r.js";export{Ee as freeIdentifiers,Ps as processComponents,gg as processESImports,Fr as rendersAsElement,gy as resetMarginStackWarnings,my as resetTemplateLoopWarnings};
2
+ import{gy,my,gg,Ps}from"./chunk-0b5vmmf8.js";import"./chunk-a774ncg3.js";import"./chunk-9bexzgws.js";import"./chunk-v0yay1kw.js";import{Fr}from"./chunk-etn044yn.js";import"./chunk-fcqca9qb.js";import"./chunk-w98yt4d4.js";import{Ee}from"./chunk-c08jvjqt.js";import"./chunk-phzhmnnm.js";import"./chunk-75r2p1cz.js";import"./chunk-0jdz31q1.js";import"./chunk-4b110x6r.js";export{Ee as freeIdentifiers,Ps as processComponents,gg as processESImports,Fr as rendersAsElement,gy as resetMarginStackWarnings,my as resetTemplateLoopWarnings};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import"./chunk-0jdz31q1.js";import"./chunk-c08jvjqt.js";import"./chunk-4b110x6r.js";import"./chunk-phzhmnnm.js";import"./chunk-ck4ypzet.js";import"./chunk-ggez55jb.js";import"./chunk-w98yt4d4.js";import"./chunk-4zw9trtx.js";import"./chunk-razwegar.js";import"./chunk-r2ns89f7.js";import{l}from"./chunk-w4177qn3.js";import u from"fs";import m from"path";async function d(e,t={}){let s=Date.now(),n={total:0,passed:0,failed:0,new:0,failures:[],duration:0},i=t.snapshotDir||l(e.root,"story","snapshots");await u.promises.mkdir(i,{recursive:!0});let r=e.storyFiles;if(t.filter&&t.filter.length>0)r=r.filter((a)=>t.filter.some((o)=>a.fileName.toLowerCase().includes(o.toLowerCase())));for(let a of r)await h(a,i,t,n);return n.duration=Date.now()-s,n}async function h(e,t,s,n){let i=e.story;if(!i)return;for(let r of i.variants){n.total++;let a=m.join(t,`${e.id}-${r.id}.snap`),o=g(r.source||""),f=await w(a);if(s.update||!f){let p={storyId:e.id,variantId:r.id,component:e.fileName,timestamp:Date.now(),hash:o};if(await u.promises.writeFile(a,JSON.stringify(p,null,2)),!f)n.new++;n.passed++}else try{let p=await u.promises.readFile(a,"utf-8"),c=JSON.parse(p);if(c.hash===o)n.passed++;else n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:"Snapshot mismatch",difference:y(c.hash,o)})}catch(p){n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:`Error reading snapshot: ${p}`})}}}async function x(e,t={}){return(await d(e,{...t,update:!0})).total}function g(e){let t=0;for(let s=0;s<e.length;s++){let n=e.charCodeAt(s);t=(t<<5)-t+n,t=t&t}return t.toString(16)}function y(e,t){if(e===t)return 0;let s=Math.abs(Number.parseInt(e,16)-Number.parseInt(t,16));return Math.min(s/1e6,1)}async function w(e){try{return await u.promises.access(e),!0}catch{return!1}}function F(e){let t=[];if(t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(" STX Story Visual Regression Tests"),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),e.failures.length>0){t.push(" \u274C Failures:"),t.push("");for(let s of e.failures){if(t.push(` \u2022 ${s.component} / ${s.variantId}`),t.push(` ${s.message}`),s.difference!==void 0)t.push(` Difference: ${(s.difference*100).toFixed(2)}%`);t.push("")}}if(t.push(" Summary:"),t.push(` Total: ${e.total}`),t.push(` Passed: ${e.passed} \u2713`),t.push(` Failed: ${e.failed} \u2717`),e.new>0)t.push(` New: ${e.new} \u26A1`);return t.push(` Time: ${e.duration}ms`),t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),t.join(`
2
+ import"./chunk-0jdz31q1.js";import"./chunk-c08jvjqt.js";import"./chunk-4b110x6r.js";import"./chunk-phzhmnnm.js";import"./chunk-75r2p1cz.js";import"./chunk-etn044yn.js";import"./chunk-w98yt4d4.js";import"./chunk-fcqca9qb.js";import"./chunk-razwegar.js";import"./chunk-v37hjzt2.js";import{l}from"./chunk-w4177qn3.js";import u from"fs";import m from"path";async function d(e,t={}){let s=Date.now(),n={total:0,passed:0,failed:0,new:0,failures:[],duration:0},i=t.snapshotDir||l(e.root,"story","snapshots");await u.promises.mkdir(i,{recursive:!0});let r=e.storyFiles;if(t.filter&&t.filter.length>0)r=r.filter((a)=>t.filter.some((o)=>a.fileName.toLowerCase().includes(o.toLowerCase())));for(let a of r)await h(a,i,t,n);return n.duration=Date.now()-s,n}async function h(e,t,s,n){let i=e.story;if(!i)return;for(let r of i.variants){n.total++;let a=m.join(t,`${e.id}-${r.id}.snap`),o=g(r.source||""),f=await w(a);if(s.update||!f){let p={storyId:e.id,variantId:r.id,component:e.fileName,timestamp:Date.now(),hash:o};if(await u.promises.writeFile(a,JSON.stringify(p,null,2)),!f)n.new++;n.passed++}else try{let p=await u.promises.readFile(a,"utf-8"),c=JSON.parse(p);if(c.hash===o)n.passed++;else n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:"Snapshot mismatch",difference:y(c.hash,o)})}catch(p){n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:`Error reading snapshot: ${p}`})}}}async function x(e,t={}){return(await d(e,{...t,update:!0})).total}function g(e){let t=0;for(let s=0;s<e.length;s++){let n=e.charCodeAt(s);t=(t<<5)-t+n,t=t&t}return t.toString(16)}function y(e,t){if(e===t)return 0;let s=Math.abs(Number.parseInt(e,16)-Number.parseInt(t,16));return Math.min(s/1e6,1)}async function w(e){try{return await u.promises.access(e),!0}catch{return!1}}function F(e){let t=[];if(t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(" STX Story Visual Regression Tests"),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),e.failures.length>0){t.push(" \u274C Failures:"),t.push("");for(let s of e.failures){if(t.push(` \u2022 ${s.component} / ${s.variantId}`),t.push(` ${s.message}`),s.difference!==void 0)t.push(` Difference: ${(s.difference*100).toFixed(2)}%`);t.push("")}}if(t.push(" Summary:"),t.push(` Total: ${e.total}`),t.push(` Passed: ${e.passed} \u2713`),t.push(` Failed: ${e.failed} \u2717`),e.new>0)t.push(` New: ${e.new} \u26A1`);return t.push(` Time: ${e.duration}ms`),t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),t.join(`
3
3
  `)}export{F as formatTestResults,d as runVisualTests,x as updateSnapshots};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Z}from"./chunk-13awnyq0.js";import{yr,He}from"./chunk-cwcmmgvz.js";import{G,k,Mr,to,A}from"./chunk-ggez55jb.js";import{a,j}from"./chunk-2r84qtat.js";import{ri}from"./chunk-8d6wkfdx.js";import{gt}from"./chunk-zkwkhesc.js";import{l}from"./chunk-w4177qn3.js";import{t,h}from"./chunk-ahf9j8wb.js";import d from"path";import E from"fs";import{AsyncLocalStorage as lt}from"async_hooks";import{randomUUID as St}from"crypto";var vt=12;function X(e,n,s){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(d.basename(e))||ri(e,n,s)}var ct=2;function Qf(e){let n=process.env.STX_BUNDLE_CACHE_DIR?.trim();return n?d.resolve(n):l(e,"bundle-cache")}function rt(e,n){let s=e;for(let i of Bt(n))if(i!==d.sep)s=s.split(i).join("\x00root");return s}var it=new Map;function Bt(e){let n=d.resolve(e),s=it.get(n);if(!s){let i=n;try{i=E.realpathSync(n)}catch{}s=[...new Set([n,i])].sort((c,p)=>p.length-c.length),it.set(n,s)}return s}function jt(e,n){try{let s=E.statSync(e),i=d.resolve(n),c=e.startsWith(`${i}${d.sep}`);return{path:c?d.relative(i,e):e,...c?{inRoot:!0}:{},mtimeMs:s.mtimeMs,size:s.size,hash:Bun.hash(E.readFileSync(e)).toString(36)}}catch{return null}}function ut(e,n){return e.inRoot?d.join(d.resolve(n),e.path):e.path}function Et(e,n){for(let s of e){let i=ut(s,n);try{let c=E.statSync(i);if(c.size!==s.size)return!1;if(c.mtimeMs!==s.mtimeMs&&Bun.hash(E.readFileSync(i)).toString(36)!==s.hash)return!1}catch{return!1}}return!0}var dt=new Map,_t=100;function eg(e=process.env){let n=Number(e.STX_BUNDLE_CACHE_LIMIT);return Number.isFinite(n)&&n>=1?Math.floor(n):2000}var q=new Map;async function Mt(e){let n=q.get(e)??0;if(n>0&&n<_t){q.set(e,n+1);return}q.set(e,1);try{let s=(await E.promises.readdir(e)).filter((o)=>o.endsWith(".js")),i=eg();if(s.length<=i)return;let p=(await Promise.all(s.map(async(o)=>{try{return{name:o,at:(await E.promises.stat(d.join(e,o))).mtimeMs}}catch{return null}}))).filter((o)=>o!==null);p.sort((o,w)=>w.at-o.at);for(let o of p.slice(i)){let w=o.name.slice(0,-3);await E.promises.rm(d.join(e,`${w}.js`),{force:!0}),await E.promises.rm(d.join(e,`${w}.deps.json`),{force:!0})}T("pruned bundle cache to",i,"entries")}catch{}}function $e(e){return dt.get(e)??[]}function Y(e,n){if(e)dt.set(e,n)}function tg(e=process.env){return e.STX_DEBUG==="true"||e.STX_DEBUG==="1"}function T(...e){if(tg())console.log("[stx:bundler]",...e)}var et=[];function Rc(e,n,s){et.push({filePath:e||"<inline>",message:n,details:s})}function mn(){return et.slice()}function hn(){et.length=0}var K;function sy(e){K=e}function Ac(){if(K)return K;try{let e=j.strict;return typeof e==="object"&&e!==null?e.bundlerFallback??"warn":"warn"}catch{return"warn"}}var tt=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function yn(e){let n=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,s;while((s=n.exec(e))!==null){let c=s[1];if(!tt.some((o)=>o.test(c)))return T("detected user import:",c),!0}let i=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((s=i.exec(e))!==null){let c=s[1];if(/\.css(?:\?.*)?$/.test(c))continue;if(!tt.some((o)=>o.test(c)))return T("detected side-effect import:",c),!0}return!1}var hr="stx-module:",Rt=/\.(?:[cm]?[jt]sx?|json)$/i;function ng(e,n){return d.relative(e,n).split(d.sep).join("/")}function rg(e,n){if(n.size===0)return e;return e.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(s,i,c,p)=>{let o=n.get(p);return o&&!p.startsWith(hr)?`${i}${c}${o}${c}`:s})}function sg(e,n){let s=0,i=(p)=>{let o=`__stxMod${s++}`,w=JSON.stringify(p);return n.push(`var ${o} = globalThis.__stxModules && globalThis.__stxModules[${w}];`,`if (${o} === undefined) throw new Error("[stx] module " + ${JSON.stringify(w)} + " is not registered on this page (#1957)");`),o},c=(p,o)=>{for(let w of p.split(",")){let C=w.trim();if(!C)continue;let R=C.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!R)continue;let S=R[1].startsWith('"')?JSON.parse(R[1]):R[1],f=R[2]??S;n.push(`var ${f} = ${o}[${JSON.stringify(S)}];`)}};return e=e.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(p,o,w)=>{let C=w.slice(hr.length),R=i(C),S=o.trim(),f=S.match(/^([\w$]+)\s*(?:,\s*|$)/);if(f&&!S.startsWith("{")&&!S.startsWith("*"))n.push(`var ${f[1]} = ${R}.default;`),S=S.slice(f[0].length).trim();let v=S.match(/^\*\s*as\s+([\w$]+)$/);if(v)n.push(`var ${v[1]} = ${R};`);else if(S.startsWith("{"))c(S.replace(/^\{|\}$/g,""),R);return""}),e=e.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(p,o)=>(i(o.slice(hr.length)),"")),e}function ot(e){let n=[e,`${e}.ts`,`${e}.tsx`,`${e}.js`,`${e}.mjs`,`${e}.jsx`,d.join(e,"index.ts"),d.join(e,"index.tsx"),d.join(e,"index.js"),d.join(e,"index.mjs")];for(let s of n)try{if(E.existsSync(s)&&E.statSync(s,{throwIfNoEntry:!1})?.isFile())return s}catch{}return}var H=new lt;function Cs(e,n){let s=new Bun.CryptoHasher("md5");for(let[i,c]of[...e].sort(([p],[o])=>p<o?-1:p>o?1:0))s.update(`${i}\x00${c}\x00`);return H.run({modules:e,key:s.digest("hex").slice(0,12)},n)}var pt=new lt;function og(e){return pt.run(!0,e)}function ig(){return pt.getStore()===!0}function Pc(e){if(!ig())return;throw Error(`The client script of ${e} needs bundling, and it is being rendered inside a Bun.build loader, where Bun never finishes a second build. Make the page an entrypoint of the build (bun-plugin-stx renders entrypoints before the bundler starts), or render it once outside the build so its bundle is cached.`)}function bn(){return H.getStore()?.key??""}function ft(e,n,s,i,c,p,o=new Map,w,C,R){let S=new Map([[s,i],...R??[]]),f=(B)=>B!==void 0&&S.has(B),v=(B,r,u)=>{if(X(r,e,w))return null;if(!p||!f(B)||!Rt.test(r))return null;try{if(!E.statSync(r,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}c.add(r);let _=`${hr}${ng(process.cwd(),r)}`;return o.set(u,_),{path:_,external:!0}},b=(B,r)=>{let u=f(B)?n:d.dirname(B),_=d.resolve(u,r);return ot(_)??_};return{name:"stx-client-bundle",setup(B){if(B.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(r)=>({path:r.path,external:!0})),B.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(r)=>({path:r.path,external:!0})),B.onResolve({filter:/^\//},(r)=>{if(f(r.path))return{path:r.path};let u=ot(r.path);if(u){let _=v(r.importer,u,r.path);if(_)return _;if(!f(u))c.add(u);return{path:u}}return{path:r.path,external:!0}}),B.onResolve({filter:/^\.\.?\//},(r)=>{let u=b(r.importer,r.path),_=v(r.importer,u,r.path);if(_)return _;return c.add(u),{path:u}}),B.onResolve({filter:/^[@~]\//},(r)=>{let u=d.resolve(e,r.path.slice(2)),_=[u,`${u}.ts`,`${u}.tsx`,`${u}.js`,`${u}.mjs`,`${u}.jsx`,d.join(u,"index.ts"),d.join(u,"index.tsx"),d.join(u,"index.js"),d.join(u,"index.mjs")];for(let x of _)if(E.existsSync(x)&&E.statSync(x,{throwIfNoEntry:!1})?.isFile()){let D=v(r.importer,x,r.path);if(D)return D;return T(`resolved ${r.path[0]}/ import:`,r.path,"\u2192",x),c.add(x),{path:x}}return console.warn(`[stx:bundler] could not resolve ${r.path[0]}/ import:`,r.path),{path:u}}),p)B.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(r)=>{if(!f(r.importer))return;let u=`${hr}npm:${r.path}`;return o.set(r.path,u),{path:u,external:!0}});B.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(r)=>{if(S.has(r.path))return{contents:S.get(r.path),loader:"ts"};if(X(r.path,e,w))throw Error(`Server-only API source cannot be imported by a client script: ${r.path}`);let u=d.extname(r.path).toLowerCase(),_=u===".json"?"json":u===".tsx"?"tsx":u===".jsx"?"jsx":u===".ts"||u===".mts"||u===".cts"?"ts":"js";if(!f(r.path))c.add(r.path);let x=C?.get(r.path);if(x!==void 0)return{contents:x,loader:"js"};return{contents:E.readFileSync(r.path,"utf8"),loader:_}})}}}var Q=new Map,V=k(64),at=Symbol.for("stx.client-bundle-build-queue");function ag(e){let n=globalThis,i=(n[at]??Promise.resolve()).then(e,e);return n[at]=i.then(()=>{return},()=>{return}),i}async function wn(e,n,s={}){let i=s.projectRoot||process.cwd(),c=(await a(i)).serverApi,p=s.minify??!1,o=s.externalizeUserModules??!0,w=s.expose?.length?[...new Set(s.expose)].sort():void 0,C=s.cacheDir||Qf(i),R=H.getStore(),S=new Bun.CryptoHasher("md5");S.update(`${vt}\x00${gt()}\x00${JSON.stringify(c??!1)}\x00${o?"registry":"inline"}\x00${w?w.join(","):"*"}\x00${p?"minified":"readable"}\x00${R?.key??""}\x00${rt(e,i)}\x00${rt(n,i)}`);let f=S.digest("hex").slice(0,12),v=d.join(C,`${f}.js`),b=V.get(v);if(b){if(to(b.files)&&b.files.every((x)=>!X(x.path,i,c))){T("memo hit:",f);let x=b.files.map((D)=>D.path);return Y(n,x),s.collectInputs?.push(...x),b.code}V.delete(v),T("memo invalidated by dep change:",f)}let B=d.join(C,`${f}.deps.json`),r=Bun.file(v);if(await r.exists()){let x=Bun.file(B),D=!1,N=null;if(await x.exists())try{let O=JSON.parse(await x.text());if(O.metadataVersion===ct&&Array.isArray(O.files)&&Et(O.files,i))N=Mr(O.files.map((g)=>ut(g,i))),D=N.length===O.files.length&&!N.some((g)=>X(g.path,i,c))}catch{D=!1}if(D){if(T("cache hit:",f),N)Y(n,N.map((L)=>L.path)),s.collectInputs?.push(...N.map((L)=>L.path));let O=await r.text(),g=new Date;if(E.promises.utimes(v,g,g).catch(()=>{}),N)V.set(v,{code:O,files:N});return O}T("cache invalidated by dep change:",f)}let u=Q.get(f);if(u){let x=await u;if(s.collectInputs)s.collectInputs.push(...(V.get(v)?.files??[]).map((D)=>D.path));return x}Pc(n);let _=ag(()=>Ft(e,n,{projectRoot:i,minify:p,cacheDir:C,hash:f,cachePath:v,depsPath:B,collectInputs:s.collectInputs,externalizeUserModules:o,serverApi:c,expose:w,throwOnFailure:s.throwOnFailure,substitutes:R?.modules}));Q.set(f,_);try{return await _}finally{Q.delete(f)}}function Ic(e){return`${e}-${process.pid}-${St()}`}async function oy(e,n){let{projectRoot:s}=n,i=Ic(new Bun.CryptoHasher("md5").update([...e.keys()].join("\x00")).digest("hex").slice(0,12)),c=d.join(l(s,"bundle-tmp"),"out",i);E.mkdirSync(c,{recursive:!0});let p=new Map,o=new Map,w=0;for(let[f,v]of e){let b=d.join(s,`.stx-split-${i}-${w++}.ts`);p.set(b,v),o.set(d.basename(b).replace(/\.ts$/,""),f)}let[C,R]=[...p][0],S=new Set;Pc(n.filePath);try{let f=await Bun.build({entrypoints:[...p.keys()],outdir:c,target:"browser",format:"esm",splitting:!0,minify:!1,naming:{entry:"[name].js",chunk:"chunk-[hash].js"},plugins:[ft(s,d.dirname(n.filePath),C,R,S,!1,new Map,void 0,H.getStore()?.modules,p)],define:{"process.env.NODE_ENV":'"development"',...A()},root:s});if(!f.success)throw Error(f.logs.filter((b)=>b.level==="error").map((b)=>b.message).join(", ")||"Unable to bundle the entries");let v={entries:new Map,chunks:new Map};for(let b of f.outputs){let B=d.basename(b.path);if(b.kind==="entry-point"){let r=o.get(B.replace(/\.js$/,""));if(r!==void 0)v.entries.set(r,await b.text())}else if(b.kind==="chunk")v.chunks.set(B.replace(/\.js$/,""),await b.text())}return n.collectInputs?.push(...S),v}finally{try{E.rmSync(c,{recursive:!0,force:!0})}catch{}}}async function Ft(e,n,s){let{projectRoot:i,minify:c,cacheDir:p,hash:o,cachePath:w,depsPath:C,externalizeUserModules:R}=s,S=l(i,"bundle-tmp"),f=Ic(o),v=d.join(i,`.stx-client-${f}.ts`),b=d.join(S,"out",f);E.mkdirSync(b,{recursive:!0});let B=d.dirname(n),r=new Set,u=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,_=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,x=t(e),{depths:D,balanced:N}=h(x),O=(F)=>!N||D[F]===0,g;while((g=u.exec(x))!==null){if(g[1])continue;if(!O(g.index))continue;if(g[2])g[2].split(",").forEach((F)=>{let m=It(F);if(m)r.add(m)});else if(g[3])r.add(g[3])}while((g=_.exec(x))!==null){if(g[1])continue;if(!O(g.index))continue;r.add(g[2])}let L=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=L.exec(x))!==null){if(!O(g.index))continue;let F=/^\s*['"]([^'"]+)['"]/.exec(e.slice(g.index+g[0].length))?.[1];if(F&&tt.some((m)=>m.test(F)))continue;if(g[1])r.add(g[1]);if(g[2])r.add(g[2]);for(let m of(g[3]??"").split(",")){let M=m.trim();if(!M||/^type\s/.test(M))continue;let P=/\bas\s+(\w+)\s*$/.exec(M)?.[1]??/^\w+$/.exec(M)?.[0];if(P)r.add(P)}}for(let F of x.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let m of F[1].split(",")){let M=/\bas\s+(\w+)\s*$/.exec(m)?.[1]??/^\s*(\w+)\s*$/.exec(m)?.[1];if(M)r.delete(M)}let mt=r.size>0?`
2
+ import{Z}from"./chunk-2vdbt2a7.js";import{yr,He}from"./chunk-cwcmmgvz.js";import{G,k,Mr,to,A}from"./chunk-etn044yn.js";import{a,j}from"./chunk-ja4fyz87.js";import{ri}from"./chunk-gqz6502d.js";import{gt}from"./chunk-zkwkhesc.js";import{l}from"./chunk-w4177qn3.js";import{t,h}from"./chunk-zjrnz9yt.js";import d from"path";import E from"fs";import{AsyncLocalStorage as lt}from"async_hooks";import{randomUUID as St}from"crypto";var vt=12;function X(e,n,s){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(d.basename(e))||ri(e,n,s)}var ct=2;function Qf(e){let n=process.env.STX_BUNDLE_CACHE_DIR?.trim();return n?d.resolve(n):l(e,"bundle-cache")}function rt(e,n){let s=e;for(let i of Bt(n))if(i!==d.sep)s=s.split(i).join("\x00root");return s}var it=new Map;function Bt(e){let n=d.resolve(e),s=it.get(n);if(!s){let i=n;try{i=E.realpathSync(n)}catch{}s=[...new Set([n,i])].sort((c,p)=>p.length-c.length),it.set(n,s)}return s}function jt(e,n){try{let s=E.statSync(e),i=d.resolve(n),c=e.startsWith(`${i}${d.sep}`);return{path:c?d.relative(i,e):e,...c?{inRoot:!0}:{},mtimeMs:s.mtimeMs,size:s.size,hash:Bun.hash(E.readFileSync(e)).toString(36)}}catch{return null}}function ut(e,n){return e.inRoot?d.join(d.resolve(n),e.path):e.path}function Et(e,n){for(let s of e){let i=ut(s,n);try{let c=E.statSync(i);if(c.size!==s.size)return!1;if(c.mtimeMs!==s.mtimeMs&&Bun.hash(E.readFileSync(i)).toString(36)!==s.hash)return!1}catch{return!1}}return!0}var dt=new Map,_t=100;function eg(e=process.env){let n=Number(e.STX_BUNDLE_CACHE_LIMIT);return Number.isFinite(n)&&n>=1?Math.floor(n):2000}var q=new Map;async function Mt(e){let n=q.get(e)??0;if(n>0&&n<_t){q.set(e,n+1);return}q.set(e,1);try{let s=(await E.promises.readdir(e)).filter((o)=>o.endsWith(".js")),i=eg();if(s.length<=i)return;let p=(await Promise.all(s.map(async(o)=>{try{return{name:o,at:(await E.promises.stat(d.join(e,o))).mtimeMs}}catch{return null}}))).filter((o)=>o!==null);p.sort((o,w)=>w.at-o.at);for(let o of p.slice(i)){let w=o.name.slice(0,-3);await E.promises.rm(d.join(e,`${w}.js`),{force:!0}),await E.promises.rm(d.join(e,`${w}.deps.json`),{force:!0})}T("pruned bundle cache to",i,"entries")}catch{}}function $e(e){return dt.get(e)??[]}function Y(e,n){if(e)dt.set(e,n)}function tg(e=process.env){return e.STX_DEBUG==="true"||e.STX_DEBUG==="1"}function T(...e){if(tg())console.log("[stx:bundler]",...e)}var et=[];function Rc(e,n,s){et.push({filePath:e||"<inline>",message:n,details:s})}function mn(){return et.slice()}function hn(){et.length=0}var K;function sy(e){K=e}function Ac(){if(K)return K;try{let e=j.strict;return typeof e==="object"&&e!==null?e.bundlerFallback??"warn":"warn"}catch{return"warn"}}var tt=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function yn(e){let n=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,s;while((s=n.exec(e))!==null){let c=s[1];if(!tt.some((o)=>o.test(c)))return T("detected user import:",c),!0}let i=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((s=i.exec(e))!==null){let c=s[1];if(/\.css(?:\?.*)?$/.test(c))continue;if(!tt.some((o)=>o.test(c)))return T("detected side-effect import:",c),!0}return!1}var hr="stx-module:",Rt=/\.(?:[cm]?[jt]sx?|json)$/i;function ng(e,n){return d.relative(e,n).split(d.sep).join("/")}function rg(e,n){if(n.size===0)return e;return e.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(s,i,c,p)=>{let o=n.get(p);return o&&!p.startsWith(hr)?`${i}${c}${o}${c}`:s})}function sg(e,n){let s=0,i=(p)=>{let o=`__stxMod${s++}`,w=JSON.stringify(p);return n.push(`var ${o} = globalThis.__stxModules && globalThis.__stxModules[${w}];`,`if (${o} === undefined) throw new Error("[stx] module " + ${JSON.stringify(w)} + " is not registered on this page (#1957)");`),o},c=(p,o)=>{for(let w of p.split(",")){let C=w.trim();if(!C)continue;let R=C.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!R)continue;let S=R[1].startsWith('"')?JSON.parse(R[1]):R[1],f=R[2]??S;n.push(`var ${f} = ${o}[${JSON.stringify(S)}];`)}};return e=e.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(p,o,w)=>{let C=w.slice(hr.length),R=i(C),S=o.trim(),f=S.match(/^([\w$]+)\s*(?:,\s*|$)/);if(f&&!S.startsWith("{")&&!S.startsWith("*"))n.push(`var ${f[1]} = ${R}.default;`),S=S.slice(f[0].length).trim();let v=S.match(/^\*\s*as\s+([\w$]+)$/);if(v)n.push(`var ${v[1]} = ${R};`);else if(S.startsWith("{"))c(S.replace(/^\{|\}$/g,""),R);return""}),e=e.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(p,o)=>(i(o.slice(hr.length)),"")),e}function ot(e){let n=[e,`${e}.ts`,`${e}.tsx`,`${e}.js`,`${e}.mjs`,`${e}.jsx`,d.join(e,"index.ts"),d.join(e,"index.tsx"),d.join(e,"index.js"),d.join(e,"index.mjs")];for(let s of n)try{if(E.existsSync(s)&&E.statSync(s,{throwIfNoEntry:!1})?.isFile())return s}catch{}return}var H=new lt;function Cs(e,n){let s=new Bun.CryptoHasher("md5");for(let[i,c]of[...e].sort(([p],[o])=>p<o?-1:p>o?1:0))s.update(`${i}\x00${c}\x00`);return H.run({modules:e,key:s.digest("hex").slice(0,12)},n)}var pt=new lt;function og(e){return pt.run(!0,e)}function ig(){return pt.getStore()===!0}function Pc(e){if(!ig())return;throw Error(`The client script of ${e} needs bundling, and it is being rendered inside a Bun.build loader, where Bun never finishes a second build. Make the page an entrypoint of the build (bun-plugin-stx renders entrypoints before the bundler starts), or render it once outside the build so its bundle is cached.`)}function bn(){return H.getStore()?.key??""}function ft(e,n,s,i,c,p,o=new Map,w,C,R){let S=new Map([[s,i],...R??[]]),f=(B)=>B!==void 0&&S.has(B),v=(B,r,u)=>{if(X(r,e,w))return null;if(!p||!f(B)||!Rt.test(r))return null;try{if(!E.statSync(r,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}c.add(r);let _=`${hr}${ng(process.cwd(),r)}`;return o.set(u,_),{path:_,external:!0}},b=(B,r)=>{let u=f(B)?n:d.dirname(B),_=d.resolve(u,r);return ot(_)??_};return{name:"stx-client-bundle",setup(B){if(B.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(r)=>({path:r.path,external:!0})),B.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(r)=>({path:r.path,external:!0})),B.onResolve({filter:/^\//},(r)=>{if(f(r.path))return{path:r.path};let u=ot(r.path);if(u){let _=v(r.importer,u,r.path);if(_)return _;if(!f(u))c.add(u);return{path:u}}return{path:r.path,external:!0}}),B.onResolve({filter:/^\.\.?\//},(r)=>{let u=b(r.importer,r.path),_=v(r.importer,u,r.path);if(_)return _;return c.add(u),{path:u}}),B.onResolve({filter:/^[@~]\//},(r)=>{let u=d.resolve(e,r.path.slice(2)),_=[u,`${u}.ts`,`${u}.tsx`,`${u}.js`,`${u}.mjs`,`${u}.jsx`,d.join(u,"index.ts"),d.join(u,"index.tsx"),d.join(u,"index.js"),d.join(u,"index.mjs")];for(let x of _)if(E.existsSync(x)&&E.statSync(x,{throwIfNoEntry:!1})?.isFile()){let D=v(r.importer,x,r.path);if(D)return D;return T(`resolved ${r.path[0]}/ import:`,r.path,"\u2192",x),c.add(x),{path:x}}return console.warn(`[stx:bundler] could not resolve ${r.path[0]}/ import:`,r.path),{path:u}}),p)B.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(r)=>{if(!f(r.importer))return;let u=`${hr}npm:${r.path}`;return o.set(r.path,u),{path:u,external:!0}});B.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(r)=>{if(S.has(r.path))return{contents:S.get(r.path),loader:"ts"};if(X(r.path,e,w))throw Error(`Server-only API source cannot be imported by a client script: ${r.path}`);let u=d.extname(r.path).toLowerCase(),_=u===".json"?"json":u===".tsx"?"tsx":u===".jsx"?"jsx":u===".ts"||u===".mts"||u===".cts"?"ts":"js";if(!f(r.path))c.add(r.path);let x=C?.get(r.path);if(x!==void 0)return{contents:x,loader:"js"};return{contents:E.readFileSync(r.path,"utf8"),loader:_}})}}}var Q=new Map,V=k(64),at=Symbol.for("stx.client-bundle-build-queue");function ag(e){let n=globalThis,i=(n[at]??Promise.resolve()).then(e,e);return n[at]=i.then(()=>{return},()=>{return}),i}async function wn(e,n,s={}){let i=s.projectRoot||process.cwd(),c=(await a(i)).serverApi,p=s.minify??!1,o=s.externalizeUserModules??!0,w=s.expose?.length?[...new Set(s.expose)].sort():void 0,C=s.cacheDir||Qf(i),R=H.getStore(),S=new Bun.CryptoHasher("md5");S.update(`${vt}\x00${gt()}\x00${JSON.stringify(c??!1)}\x00${o?"registry":"inline"}\x00${w?w.join(","):"*"}\x00${p?"minified":"readable"}\x00${R?.key??""}\x00${rt(e,i)}\x00${rt(n,i)}`);let f=S.digest("hex").slice(0,12),v=d.join(C,`${f}.js`),b=V.get(v);if(b){if(to(b.files)&&b.files.every((x)=>!X(x.path,i,c))){T("memo hit:",f);let x=b.files.map((D)=>D.path);return Y(n,x),s.collectInputs?.push(...x),b.code}V.delete(v),T("memo invalidated by dep change:",f)}let B=d.join(C,`${f}.deps.json`),r=Bun.file(v);if(await r.exists()){let x=Bun.file(B),D=!1,N=null;if(await x.exists())try{let O=JSON.parse(await x.text());if(O.metadataVersion===ct&&Array.isArray(O.files)&&Et(O.files,i))N=Mr(O.files.map((g)=>ut(g,i))),D=N.length===O.files.length&&!N.some((g)=>X(g.path,i,c))}catch{D=!1}if(D){if(T("cache hit:",f),N)Y(n,N.map((L)=>L.path)),s.collectInputs?.push(...N.map((L)=>L.path));let O=await r.text(),g=new Date;if(E.promises.utimes(v,g,g).catch(()=>{}),N)V.set(v,{code:O,files:N});return O}T("cache invalidated by dep change:",f)}let u=Q.get(f);if(u){let x=await u;if(s.collectInputs)s.collectInputs.push(...(V.get(v)?.files??[]).map((D)=>D.path));return x}Pc(n);let _=ag(()=>Ft(e,n,{projectRoot:i,minify:p,cacheDir:C,hash:f,cachePath:v,depsPath:B,collectInputs:s.collectInputs,externalizeUserModules:o,serverApi:c,expose:w,throwOnFailure:s.throwOnFailure,substitutes:R?.modules}));Q.set(f,_);try{return await _}finally{Q.delete(f)}}function Ic(e){return`${e}-${process.pid}-${St()}`}async function oy(e,n){let{projectRoot:s}=n,i=Ic(new Bun.CryptoHasher("md5").update([...e.keys()].join("\x00")).digest("hex").slice(0,12)),c=d.join(l(s,"bundle-tmp"),"out",i);E.mkdirSync(c,{recursive:!0});let p=new Map,o=new Map,w=0;for(let[f,v]of e){let b=d.join(s,`.stx-split-${i}-${w++}.ts`);p.set(b,v),o.set(d.basename(b).replace(/\.ts$/,""),f)}let[C,R]=[...p][0],S=new Set;Pc(n.filePath);try{let f=await Bun.build({entrypoints:[...p.keys()],outdir:c,target:"browser",format:"esm",splitting:!0,minify:!1,naming:{entry:"[name].js",chunk:"chunk-[hash].js"},plugins:[ft(s,d.dirname(n.filePath),C,R,S,!1,new Map,void 0,H.getStore()?.modules,p)],define:{"process.env.NODE_ENV":'"development"',...A()},root:s});if(!f.success)throw Error(f.logs.filter((b)=>b.level==="error").map((b)=>b.message).join(", ")||"Unable to bundle the entries");let v={entries:new Map,chunks:new Map};for(let b of f.outputs){let B=d.basename(b.path);if(b.kind==="entry-point"){let r=o.get(B.replace(/\.js$/,""));if(r!==void 0)v.entries.set(r,await b.text())}else if(b.kind==="chunk")v.chunks.set(B.replace(/\.js$/,""),await b.text())}return n.collectInputs?.push(...S),v}finally{try{E.rmSync(c,{recursive:!0,force:!0})}catch{}}}async function Ft(e,n,s){let{projectRoot:i,minify:c,cacheDir:p,hash:o,cachePath:w,depsPath:C,externalizeUserModules:R}=s,S=l(i,"bundle-tmp"),f=Ic(o),v=d.join(i,`.stx-client-${f}.ts`),b=d.join(S,"out",f);E.mkdirSync(b,{recursive:!0});let B=d.dirname(n),r=new Set,u=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,_=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,x=t(e),{depths:D,balanced:N}=h(x),O=(F)=>!N||D[F]===0,g;while((g=u.exec(x))!==null){if(g[1])continue;if(!O(g.index))continue;if(g[2])g[2].split(",").forEach((F)=>{let m=It(F);if(m)r.add(m)});else if(g[3])r.add(g[3])}while((g=_.exec(x))!==null){if(g[1])continue;if(!O(g.index))continue;r.add(g[2])}let L=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=L.exec(x))!==null){if(!O(g.index))continue;let F=/^\s*['"]([^'"]+)['"]/.exec(e.slice(g.index+g[0].length))?.[1];if(F&&tt.some((m)=>m.test(F)))continue;if(g[1])r.add(g[1]);if(g[2])r.add(g[2]);for(let m of(g[3]??"").split(",")){let M=m.trim();if(!M||/^type\s/.test(M))continue;let P=/\bas\s+(\w+)\s*$/.exec(M)?.[1]??/^\w+$/.exec(M)?.[0];if(P)r.add(P)}}for(let F of x.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let m of F[1].split(",")){let M=/\bas\s+(\w+)\s*$/.exec(m)?.[1]??/^\s*(\w+)\s*$/.exec(m)?.[1];if(M)r.delete(M)}let mt=r.size>0?`
3
3
  export { ${[...r].join(", ")} }`:"";T("bundling:",o,"from:",d.basename(n));let nt=new Set,st=new Map;try{let F=await Bun.build({entrypoints:[v],outdir:b,target:"browser",format:"esm",minify:c?{whitespace:!1,identifiers:!0,syntax:!0}:!1,plugins:[ft(i,B,v,e+mt,nt,R,st,s.serverApi,s.substitutes)],define:{"process.env.NODE_ENV":c?'"production"':'"development"',...A()},root:i});if(!F.success){let I=F.logs.filter((U)=>U.level==="error").map((U)=>U.message).join(", ")||`Unable to bundle ${d.basename(n)}`,z=yr(F.logs,n||void 0);if(console.warn("[stx:bundler] build failed:",I),Rc(n||"",I,z),s.throwOnFailure||Ac()==="error")throw Error(I);return e}let m="";for(let y of F.outputs){m=await y.text();break}let M=[];for(let y of m.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let I of y[1].split(",")){let z=I.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(z){M.push([z[2],z[1]]);continue}let U=I.trim();if(/^[A-Za-z_$][\w$]*$/.test(U))M.push([U,U])}if(s.expose){let y=new Set(s.expose);for(let I=M.length-1;I>=0;I--)if(!y.has(M[I][0]))M.splice(I,1)}let P=[];m=sg(rg(m,st),P);let ht=m.match(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm)||[];if(m=m.replace(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),c&&m)try{m=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(m)}catch{}let xt=Z(m),W=`__stxBundle_${o}`,yt=new Set(G(e,!0).split(",").map((y)=>y.trim())),$t=M.map(([y,I])=>`get ${JSON.stringify(y)}() { return ${I} }${yt.has(y)?`, set ${JSON.stringify(y)}(__stxValue_${I}) { ${I} = __stxValue_${I} }`:""}`).join(", "),bt=M.map(([y])=>`var ${y} = undefined;`).join(`
4
4
  `),wt=M.map(([y])=>`${y} = ${W}[${JSON.stringify(y)}];`).join(`
5
5
  `);if(m=`${ht.join(`
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{k,E,A,ee,O,so,ie}from"./chunk-ggez55jb.js";import{je}from"./chunk-ck4ypzet.js";import{Z}from"./chunk-13awnyq0.js";import{C}from"./chunk-4b110x6r.js";import{D,zn}from"./chunk-phzhmnnm.js";import{a}from"./chunk-2r84qtat.js";import{$e,yn,bn,wn}from"./chunk-4ccbj4z6.js";import{Ot}from"./chunk-anj2j86n.js";import{Rt,sr,un,ve}from"./chunk-jz37h2z0.js";import{I,rt}from"./chunk-e5rag6rh.js";import w from"path";var x=new Map,P=new Map,R=k(64),T=new Map,ne=["composables","functions"];function W(e){let s=w.basename(e,".ts");return s==="index"||s==="types"||e.endsWith(".d.ts")}async function se(e){if(e)return w.resolve(e);let s=`<default>:${process.cwd()}`,i=T.get(s);if(i!==void 0)return i;let t=await oe();if(t!==null)T.set(s,t);return t}async function oe(){let e=await a(),s=e.root||process.cwd(),i=e.composablesDir;if(i)return w.resolve(s,i);for(let t of ne){let n=w.resolve(s,t);try{let c=new Bun.Glob("**/*.ts");for await(let r of c.scan({cwd:n,absolute:!0}))if(!W(r))return n}catch{}}return null}async function X(e){let s=Array.isArray(e)?e:e?[w.resolve(e)]:(await a())._layerComposableDirs??[await se()].filter((t)=>!!t),i=new Map;for(let t of s){let n=new Bun.Glob("**/*.ts");try{for await(let c of n.scan({cwd:t,absolute:!0})){let r=w.relative(t,c);if(!W(c)&&!i.has(r))i.set(r,c)}}catch{}}return{key:s.join("\x00"),files:[...i.values()].sort()}}async function Uo(e){let{files:s}=await X(e),i=ie({loader:"ts",target:"browser",define:A()}),t=[];for(let n of s)try{let c=await Bun.file(n).text(),r=i.scan(c).exports.filter((d)=>d!=="default");if(r.length>0)t.push({file:n,names:r})}catch{}return t}function re(e,s){return new RegExp(`\\b${s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test(e)}function Q(e,s){let i=new Set(e.match(/\w+/g)),t=new Set;for(let n of s)if(/^\w+$/.test(n)?i.has(n):re(e,n))t.add(n);return t}var H=k(64);function U(e,s){let i=E(e,s.size),t=H.get(i);if(t)return t;let n;try{n=je(e,s)}catch{n=Q(e,s)}let c=[...e.matchAll(/(?:const|let|var)\s*\{([^}]*)\}\s*=\s*window\.__composables\u0008/g),...e.matchAll(/import\s*\{([^}]*)\}\s*from\s*['"]@composables['"]/g)];for(let r of c)for(let d of r[1].split(",")){let f=d.trim().split(/\s*(?::|\u0008as\u0008)\s*/)[0];if(f&&s.has(f))n.add(f)}return H.set(i,n),n}function ae(e){return!e||/^(?:module|(?:text|application)\/(?:java|ecma)script|application\/stx-[\w-]+)$/i.test(e)}var q=k(256);function ce(e,s){let i=new Set(s),t="",n=0,c=new Set;for(let r of ee(e)){t+=e.slice(n,r.start),n=r.end;let d=O(r.attrs),f=e.slice(r.bodyStart,r.bodyEnd),u=d.get("type"),m=typeof u==="string"?u.trim():void 0;if(!ae(m)){if(!/json/i.test(m??""))t+=` ${f} `;continue}let h=Q(f,i);if(h.size===0)continue;let _=E(f,[...h].sort().join(",")),b=q.get(_);if(!b)b=U(f,h),q.set(_,b);for(let v of b)c.add(v)}t+=e.slice(n);for(let r of so(t))for(let d of U(r.code,i))c.add(d);return c}function le(e,s,i){let t=new Map;for(let{file:f,names:u}of e)for(let m of u)if(!t.has(m))t.set(m,f);let n=new Set(t.keys()),c=(f)=>{let u=[];for(let m of U(f,n))u.push(t.get(m));return u},r=new Set,d=i.flatMap((f,u)=>u===0?[...ce(f,t.keys())].map((m)=>t.get(m)):c(f));while(d.length>0){let f=[];for(let u of d){if(r.has(u))continue;r.add(u);for(let m of c(s.get(u)??""))if(!r.has(m))f.push(m)}d=f}return r}async function Vh(e,s,i,t){let{key:n,files:c}=await X(e);if(!n)return null;let r=()=>[...new Set([...c,...c.flatMap((o)=>$e(o))])],d=Rt(r());if(c.length===0)return ve(x,n,d,""),null;c.sort();let f=ie({loader:"ts",target:"browser",define:A()}),u=un(P,n,d);if(!u){let o=new Map,l=[];for(let p of c)try{let S=await Bun.file(p).text();o.set(p,S);let g=f.scan(S).exports.filter((te)=>te!=="default");if(g.length>0)l.push({file:p,names:g})}catch{o.set(p,"")}u=ve(P,n,d,{codeByFile:o,modules:l})}let{codeByFile:m,modules:h}=u,_;if(s===void 0)_=new Set(c);else{let o=i?[s,...i]:[s],l=E(o.join("\x00"),n,o.length,d),p=R.get(l);if(_=p??le(h,m,o),!p)R.set(l,_)}if(_.size===0)return null;let b=c.filter((o)=>_.has(o)),v=()=>{if(!t)return;for(let o of b)t.push(o,...$e(o))},N=`${n}\x00${b.join("\x00")}\x00${bn()}`,z=un(x,N,d);if(z!==void 0)return v(),z||null;let F=[],B=new Set,K=new Set;for(let o of b)try{let l=m.get(o)??await Bun.file(o).text(),p=w.basename(o,".ts");for(let g of l.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(g[1])K.add(g[1]);let S=[];try{for(let g of f.scan(l).exports)if(g!=="default")B.add(g),S.push(g)}catch{}if(l=D(l),yn(l))l=await wn(l,o,{projectRoot:process.cwd(),externalizeUserModules:!1,expose:S}),l=Ot(l);l=zn(l),l=l.replace(/^export\s+(default\s+)?/gm,""),l=f.transformSync(l),F.push(`// Composable: ${p}
2
+ import{k,E,A,ee,O,so,ie}from"./chunk-etn044yn.js";import{je}from"./chunk-75r2p1cz.js";import{Z}from"./chunk-2vdbt2a7.js";import{C}from"./chunk-4b110x6r.js";import{D,zn}from"./chunk-phzhmnnm.js";import{a}from"./chunk-ja4fyz87.js";import{$e,yn,bn,wn}from"./chunk-px6zx8ae.js";import{Ot}from"./chunk-6vyy44ve.js";import{Rt,sr,un,ve}from"./chunk-jz37h2z0.js";import{I,rt}from"./chunk-e5rag6rh.js";import w from"path";var x=new Map,P=new Map,R=k(64),T=new Map,ne=["composables","functions"];function W(e){let s=w.basename(e,".ts");return s==="index"||s==="types"||e.endsWith(".d.ts")}async function se(e){if(e)return w.resolve(e);let s=`<default>:${process.cwd()}`,i=T.get(s);if(i!==void 0)return i;let t=await oe();if(t!==null)T.set(s,t);return t}async function oe(){let e=await a(),s=e.root||process.cwd(),i=e.composablesDir;if(i)return w.resolve(s,i);for(let t of ne){let n=w.resolve(s,t);try{let c=new Bun.Glob("**/*.ts");for await(let r of c.scan({cwd:n,absolute:!0}))if(!W(r))return n}catch{}}return null}async function X(e){let s=Array.isArray(e)?e:e?[w.resolve(e)]:(await a())._layerComposableDirs??[await se()].filter((t)=>!!t),i=new Map;for(let t of s){let n=new Bun.Glob("**/*.ts");try{for await(let c of n.scan({cwd:t,absolute:!0})){let r=w.relative(t,c);if(!W(c)&&!i.has(r))i.set(r,c)}}catch{}}return{key:s.join("\x00"),files:[...i.values()].sort()}}async function Uo(e){let{files:s}=await X(e),i=ie({loader:"ts",target:"browser",define:A()}),t=[];for(let n of s)try{let c=await Bun.file(n).text(),r=i.scan(c).exports.filter((d)=>d!=="default");if(r.length>0)t.push({file:n,names:r})}catch{}return t}function re(e,s){return new RegExp(`\\b${s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test(e)}function Q(e,s){let i=new Set(e.match(/\w+/g)),t=new Set;for(let n of s)if(/^\w+$/.test(n)?i.has(n):re(e,n))t.add(n);return t}var H=k(64);function U(e,s){let i=E(e,s.size),t=H.get(i);if(t)return t;let n;try{n=je(e,s)}catch{n=Q(e,s)}let c=[...e.matchAll(/(?:const|let|var)\s*\{([^}]*)\}\s*=\s*window\.__composables\u0008/g),...e.matchAll(/import\s*\{([^}]*)\}\s*from\s*['"]@composables['"]/g)];for(let r of c)for(let d of r[1].split(",")){let f=d.trim().split(/\s*(?::|\u0008as\u0008)\s*/)[0];if(f&&s.has(f))n.add(f)}return H.set(i,n),n}function ae(e){return!e||/^(?:module|(?:text|application)\/(?:java|ecma)script|application\/stx-[\w-]+)$/i.test(e)}var q=k(256);function ce(e,s){let i=new Set(s),t="",n=0,c=new Set;for(let r of ee(e)){t+=e.slice(n,r.start),n=r.end;let d=O(r.attrs),f=e.slice(r.bodyStart,r.bodyEnd),u=d.get("type"),m=typeof u==="string"?u.trim():void 0;if(!ae(m)){if(!/json/i.test(m??""))t+=` ${f} `;continue}let h=Q(f,i);if(h.size===0)continue;let _=E(f,[...h].sort().join(",")),b=q.get(_);if(!b)b=U(f,h),q.set(_,b);for(let v of b)c.add(v)}t+=e.slice(n);for(let r of so(t))for(let d of U(r.code,i))c.add(d);return c}function le(e,s,i){let t=new Map;for(let{file:f,names:u}of e)for(let m of u)if(!t.has(m))t.set(m,f);let n=new Set(t.keys()),c=(f)=>{let u=[];for(let m of U(f,n))u.push(t.get(m));return u},r=new Set,d=i.flatMap((f,u)=>u===0?[...ce(f,t.keys())].map((m)=>t.get(m)):c(f));while(d.length>0){let f=[];for(let u of d){if(r.has(u))continue;r.add(u);for(let m of c(s.get(u)??""))if(!r.has(m))f.push(m)}d=f}return r}async function Vh(e,s,i,t){let{key:n,files:c}=await X(e);if(!n)return null;let r=()=>[...new Set([...c,...c.flatMap((o)=>$e(o))])],d=Rt(r());if(c.length===0)return ve(x,n,d,""),null;c.sort();let f=ie({loader:"ts",target:"browser",define:A()}),u=un(P,n,d);if(!u){let o=new Map,l=[];for(let p of c)try{let S=await Bun.file(p).text();o.set(p,S);let g=f.scan(S).exports.filter((te)=>te!=="default");if(g.length>0)l.push({file:p,names:g})}catch{o.set(p,"")}u=ve(P,n,d,{codeByFile:o,modules:l})}let{codeByFile:m,modules:h}=u,_;if(s===void 0)_=new Set(c);else{let o=i?[s,...i]:[s],l=E(o.join("\x00"),n,o.length,d),p=R.get(l);if(_=p??le(h,m,o),!p)R.set(l,_)}if(_.size===0)return null;let b=c.filter((o)=>_.has(o)),v=()=>{if(!t)return;for(let o of b)t.push(o,...$e(o))},N=`${n}\x00${b.join("\x00")}\x00${bn()}`,z=un(x,N,d);if(z!==void 0)return v(),z||null;let F=[],B=new Set,K=new Set;for(let o of b)try{let l=m.get(o)??await Bun.file(o).text(),p=w.basename(o,".ts");for(let g of l.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(g[1])K.add(g[1]);let S=[];try{for(let g of f.scan(l).exports)if(g!=="default")B.add(g),S.push(g)}catch{}if(l=D(l),yn(l))l=await wn(l,o,{projectRoot:process.cwd(),externalizeUserModules:!1,expose:S}),l=Ot(l);l=zn(l),l=l.replace(/^export\s+(default\s+)?/gm,""),l=f.transformSync(l),F.push(`// Composable: ${p}
3
3
  ${l.trim()}`)}catch(l){console.warn(`[stx] Failed to load composable ${o}:`,l)}if(F.length===0||B.size===0)return ve(x,N,d,""),null;let V=[...B].map((o)=>` try { if (!(${JSON.stringify(o)} in __c)) __c[${JSON.stringify(o)}] = ${o}; } catch (e) {}`).join(`
4
4
  `),G=JSON.stringify([...B]),M=F.join(`
5
5
 
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Is,mg,ui,hg}from"./chunk-084f6953.js";import"./chunk-9bexzgws.js";import"./chunk-6vyy44ve.js";import"./chunk-hcxsyw55.js";import"./chunk-v0yay1kw.js";import"./chunk-ja4fyz87.js";import"./chunk-v37hjzt2.js";import"./chunk-razwegar.js";import"./chunk-mpfm5ctr.js";import"./chunk-eca022er.js";import"./chunk-9gptdyqq.js";import{Wt}from"./chunk-etn044yn.js";import"./chunk-fcqca9qb.js";import"./chunk-w98yt4d4.js";import"./chunk-c08jvjqt.js";import"./chunk-phzhmnnm.js";import"./chunk-75r2p1cz.js";import"./chunk-0jdz31q1.js";import"./chunk-4b110x6r.js";export{hg as declareBareLoopHead,Wt as parseLoopBinding,mg as processLoops,ui as processLoopsAsync,Is as reportDeferredLoopWarnings};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{et,z,Jt}from"./chunk-w98yt4d4.js";import{T}from"./chunk-0jdz31q1.js";import{Et,Be,V,ds,Tt,Fe,Fa,Fo,za,Gn}from"./chunk-xjbj655y.js";import{Dt,Se,We,Ai,Pi}from"./chunk-b234w3mf.js";import{ni}from"./chunk-8d6wkfdx.js";import{Jn}from"./chunk-fznjm7qt.js";import{Ae}from"./chunk-pgqc8895.js";import ae from"fs";import P from"path";var{serve:ge}=globalThis.Bun;import k from"zlib";import{promisify as re}from"util";var ce=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],ue=["text/event-stream","multipart/x-mixed-replace"],pe=1024;function le(t){if(!t)return!1;let e=t.toLowerCase();if(ue.some((o)=>e.startsWith(o)))return!1;return ce.some((o)=>e.startsWith(o))}function me(t){let e=new Map;for(let o of t.split(",")){let[r,...c]=o.trim().split(";"),m=r.trim().toLowerCase();if(!m)continue;let v=1;for(let d of c){let u=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(d);if(!u)continue;let l=Number.parseFloat(u[1]);if(Number.isFinite(l))v=l}e.set(m,v)}return e}function fe(t){if(!t)return null;let e=me(t),o=e.get("*"),r=(c)=>e.get(c)??o??0;if(r("br")>0)return"br";if(r("gzip")>0)return"gzip";return null}var se=33554432,F=new Map,W=0;function de(t,e){if(e.length>se/8)return;F.set(t,e),W+=e.length;for(let[o,r]of F){if(W<=se)break;F.delete(o),W-=r.length}}async function Wn(t,e,o={}){if(e.headers.get("content-encoding"))return e;if(e.status===204||e.status===304||!e.body)return e;if(!le(e.headers.get("content-type")))return e;let r=fe(t.headers.get("accept-encoding"));if(!r)return e;let c;try{c=new Uint8Array(await e.arrayBuffer())}catch{return e}let m=()=>new Response(c,{status:e.status,statusText:e.statusText,headers:oe(e.headers)});if(c.length<(o.threshold??pe))return m();try{let v=o.quality??5,d=`${r}:${v}:${c.length}:${Bun.hash(c)}`,u=F.get(d);if(!u)u=r==="br"?await re(k.brotliCompress)(c,{params:{[k.constants.BROTLI_PARAM_QUALITY]:v,[k.constants.BROTLI_PARAM_SIZE_HINT]:c.length}}):await re(k.gzip)(c),de(d,u);if(u.length>=c.length)return m();let l=oe(e.headers);return l.set("Content-Encoding",r),l.set("Content-Length",String(u.length)),new Response(u,{status:e.status,statusText:e.statusText,headers:l})}catch{return m()}}function oe(t){let e=new Headers(t),o=e.get("Vary");if(!o)return e.set("Vary","Accept-Encoding"),e;if(!o.split(",").some((c)=>c.trim().toLowerCase()==="accept-encoding"))e.set("Vary",`${o}, Accept-Encoding`);return e}var he=new Set(["x-stx-router","accept-encoding",...ds.map((t)=>t.toLowerCase())]);class J{now;entries=new T(1000,{maxBytes:33554432,sizeOf:(t)=>t.body.byteLength+JSON.stringify(t.headers).length*2});pending=new Map;generation=0;constructor(t=Date.now){this.now=t}invalidate(t){this.generation++,this.pending.clear();for(let e of Array.from(this.entries.keys()))if(t===void 0||this.entries.get(e)?.path===t)this.entries.delete(e)}async respond(t,e,o){let r,c=async()=>{let a=r??await o();return a.headers.set("Cache-Control","private, no-store"),a.headers.set("Vary",V(a.headers.get("Vary")).Vary),a};if(!e||t.method!=="GET"||t.headers.has("Cookie")||t.headers.has("Authorization")||t.headers.has("Range"))return c();let m=new URL(t.url),v=Be(t)?`fragment|${ds.map((a)=>t.headers.get(a)??"").join("|")}`:"document",d=`${m.origin}${m.pathname}${m.search}|${v}`,u=this.entries.get(d),l=(a)=>{let S=new Headers(a.headers);return S.set("Cache-Control","private, no-store"),S.set("Age",String(Math.max(0,Math.floor((this.now()-a.created)/1000)))),new Response(a.body.slice(0),{headers:S})},b=u?(this.now()-u.created)/1000:1/0;if(u&&b<e.maxAge)return l(u);let N=this.generation,X=async()=>{let a=await o();r=a;let S=(a.headers.get("Vary")??"").toLowerCase().split(",").map((s)=>s.trim()).filter(Boolean);if(a.status!==200||a.headers.has("Set-Cookie")||/(?:private|no-store|no-cache)/i.test(a.headers.get("Cache-Control")??"")||S.some((s)=>!he.has(s)))return null;let n=await a.clone().arrayBuffer();if(n.byteLength>1048576)return null;a.headers.set("Vary",V(a.headers.get("Vary")).Vary);let A={body:n,headers:Array.from(a.headers.entries()),created:this.now(),path:m.pathname};if(this.generation===N)this.entries.set(d,A);return A},w=this.pending.get(d);if(!w){if(this.pending.size>=1000)return c();w=X().finally(()=>{if(this.pending.get(d)===w)this.pending.delete(d)}),this.pending.set(d,w)}if(u&&b<e.maxAge+(e.swr??0))return w.catch(()=>{}),l(u);let E=await w;return E?l(E):c()}}var Re={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".json":"application/json",".html":"text/html",".txt":"text/plain",".xml":"application/xml",".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".svg":"image/svg+xml",".ico":"image/x-icon",".bmp":"image/bmp",".mp4":"video/mp4",".webm":"video/webm",".ogg":"audio/ogg",".mp3":"audio/mpeg",".wav":"audio/wav",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"};function q(t,e){if(!e)return null;let o=Pi(t.headers);return o&&Ai(o,e)?e:null}function K(t){return t?{"X-STX-Layout":t.layout,"X-STX-Layout-Group":t.group}:{}}async function Rm(t={}){let e=P.resolve(t.outputDir||".output"),o=t.port??3000,r=Fa(e);if(!r)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${r.routes.length} routes...`);let c=Jn(r.routeRules),m=new J,v=ni(e,r.apiRoutes??[]),d=Bun.file(P.join(e,"server/runtime-config.json")),u=t.runtimeConfig??(await d.exists()?await d.json():void 0),l=u?z(u):void 0,b=new Map,N=new Map,X=new Map,w=new Map;for(let n of r.routes)try{let A=P.join(e,n.compiledPath),s=JSON.parse(await Bun.file(A).text());if(l)s.html=Jt(s.html,l);b.set(n.pattern,s),X.set(n.pattern,We(s.html)),w.set(n.pattern,Ae(s.html));let j=P.join(e,n.fragmentPath);if(Tt(s.html,r.routerContainer||"main")&&await Bun.file(j).exists()){let M=await Bun.file(j).text();N.set(n.pattern,l?Jt(M,l):M)}}catch(A){console.warn(`[stx] Failed to load route ${n.pattern}:`,A)}let E=new Map,a=[];for(let n of r.routes)if(n.hasParams){let{regex:A,params:s}=Se(n.pattern,{page:!0});a.push({regex:A,route:n,paramNames:s})}else E.set(n.pattern,n);let S=ge({port:o,async fetch(n){return Wn(n,await et(l??z(),async()=>{let s=new URL(n.url).pathname;if(t.onRequest){let p=await t.onRequest(n);if(p)return p}if(t.apiRouter){let p=await t.apiRouter.handleRequest(n);if(p.status!==404)return p}if(t.apiRoutes?.[s])return t.apiRoutes[s](n);let j=await v(n);if(j)return j;if((n.method==="GET"||n.method==="HEAD")&&s!=="/"){let p=P.resolve(e,"public"),y;try{y=decodeURIComponent(s)}catch{y=s}if(!y.includes("\x00")){let f=P.resolve(p,`.${y}`);if(f===p||f.startsWith(`${p}${P.sep}`))try{if(ae.existsSync(f)&&ae.statSync(f).isFile()){let i=P.extname(f).toLowerCase(),g=Re[i]||"application/octet-stream",H=s.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(s);return new Response(Bun.file(f),{headers:{"Content-Type":g,"Cache-Control":H?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let M=Be(n),R=null,Q={};if(R=E.get(s)||null,!R)for(let{regex:p,route:y,paramNames:f}of a){let h=s.match(p);if(h){R=y,f.forEach((i,g)=>{Q[i]=h[g+1]});break}}if(!R){let p=Dt(s)?null:E.get("/404")||null;if(p){let y=b.get(p.pattern);if(y)return new Response(y.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}})}let O=c(s),Z=Object.keys(O).length>0;return m.respond(n,O.cache,async()=>{let p=b.get(R.pattern),y=M?q(n,X.get(R.pattern)):null;if(M&&!y&&n.method==="GET"&&p&&!p.hasServerScripts&&Object.keys(p.placeholders).length===0){let i=N.get(R.pattern);if(i){let g=X.get(R.pattern);return new Response(i,{status:p.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...w.has(R.pattern)?{"X-STX-Runtime":w.get(R.pattern)?"true":"false"}:{},...g?{"X-STX-Layout":g.layout,"X-STX-Layout-Group":g.group}:{},...V(),...O.cache?{}:{"Cache-Control":Et}}})}}let f=Fo(n.method),h=b.get(R.pattern);if(!h){let i=E.get("/500")||null;if(i){let g=b.get(i.pattern);if(g)return new Response(g.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(R.prerendered&&f)return new Response("Prerendered pages do not accept actions",{status:405,headers:{Allow:"GET, HEAD"}});if(!f&&!h.hasServerScripts&&Object.keys(h.placeholders).length===0)return new Response(h.html,{status:h.status??200,headers:{"Content-Type":"text/html",...V(),"Cache-Control":"public, max-age=60",...K(y)}});try{let{html:i,boundaries:g,redirect:H,cookies:I,status:D,headers:U}=await Gn(h,{params:Q,request:n,method:n.method,__stx_strict_hydration:Z,__stx_runtime_config:l});if(H)return za(H,I,U);if(g&&g.length>0){let{renderStreamingPage:x,streamToResponse:B}=await import("./chunk-6w9sgs52.js"),L=new Headers({...V(),...U,"Cache-Control":"private, no-store"});for(let Y of I??[])L.append("Set-Cookie",Y);let _=M&&!f?We(i):null,te=_?q(n,_):null,ne=M&&!f&&!te&&Tt(i,r.routerContainer||"main");if(ne&&_)L.set("X-STX-Fragment","true"),L.set("X-STX-Runtime",Ae(i)?"true":"false"),L.set("X-STX-Layout",_.layout),L.set("X-STX-Layout-Group",_.group);for(let[Y,ie]of Object.entries(K(te)))L.set(Y,ie);return B(x(ne?Fe(i,r.routerContainer||"main",!0):i,g,{timeoutMs:30000}),{status:D??h.status??200,headers:L})}let C=new Headers({"Content-Type":"text/html",...V(),...O.cache?{}:{"Cache-Control":"private, no-store"}});for(let x of I??[])C.append("Set-Cookie",x);for(let[x,B]of Object.entries(U??{}))C.set(x,B);C.set("Vary",V(C.get("Vary")).Vary);let G=M&&!f?We(i):null,ee=G?q(n,G):null;for(let[x,B]of Object.entries(K(ee)))C.set(x,B);if(M&&!f&&!ee&&Tt(i,r.routerContainer||"main")){let x=G??We(i);return C.set("X-STX-Fragment","true"),C.set("X-STX-Runtime",Ae(i)?"true":"false"),C.set("X-STX-Layout",x.layout),C.set("X-STX-Layout-Group",x.group),new Response(Fe(i,r.routerContainer||"main",!0),{status:D??h.status??200,headers:C})}return new Response(i,{status:D??h.status??200,headers:C})}catch(i){if(console.error(`[stx] Hydration error for ${s}:`,i),Z)return new Response("Internal Server Error",{status:500});return new Response(h.html,{headers:{"Content-Type":"text/html"}})}})}))}});return console.log(`[stx] Production server running at http://localhost:${S.port}`),console.log(`[stx] Serving ${r.routes.length} routes (${b.size} pre-loaded)`),{port:S.port,stop:()=>{m.invalidate(),S.stop()},invalidate:(n)=>m.invalidate(n)}}
2
+ import{et,z,Jt}from"./chunk-w98yt4d4.js";import{T}from"./chunk-0jdz31q1.js";import{Et,Be,V,ds,Tt,Fe,Fa,Fo,za,Gn}from"./chunk-5mv2hc96.js";import{Dt,Se,We,Ai,Pi}from"./chunk-9gptdyqq.js";import{ni}from"./chunk-gqz6502d.js";import{Jn}from"./chunk-fznjm7qt.js";import{Ae}from"./chunk-hcxsyw55.js";import ae from"fs";import P from"path";var{serve:ge}=globalThis.Bun;import k from"zlib";import{promisify as re}from"util";var ce=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],ue=["text/event-stream","multipart/x-mixed-replace"],pe=1024;function le(t){if(!t)return!1;let e=t.toLowerCase();if(ue.some((o)=>e.startsWith(o)))return!1;return ce.some((o)=>e.startsWith(o))}function me(t){let e=new Map;for(let o of t.split(",")){let[r,...c]=o.trim().split(";"),m=r.trim().toLowerCase();if(!m)continue;let v=1;for(let d of c){let u=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(d);if(!u)continue;let l=Number.parseFloat(u[1]);if(Number.isFinite(l))v=l}e.set(m,v)}return e}function fe(t){if(!t)return null;let e=me(t),o=e.get("*"),r=(c)=>e.get(c)??o??0;if(r("br")>0)return"br";if(r("gzip")>0)return"gzip";return null}var se=33554432,F=new Map,W=0;function de(t,e){if(e.length>se/8)return;F.set(t,e),W+=e.length;for(let[o,r]of F){if(W<=se)break;F.delete(o),W-=r.length}}async function Wn(t,e,o={}){if(e.headers.get("content-encoding"))return e;if(e.status===204||e.status===304||!e.body)return e;if(!le(e.headers.get("content-type")))return e;let r=fe(t.headers.get("accept-encoding"));if(!r)return e;let c;try{c=new Uint8Array(await e.arrayBuffer())}catch{return e}let m=()=>new Response(c,{status:e.status,statusText:e.statusText,headers:oe(e.headers)});if(c.length<(o.threshold??pe))return m();try{let v=o.quality??5,d=`${r}:${v}:${c.length}:${Bun.hash(c)}`,u=F.get(d);if(!u)u=r==="br"?await re(k.brotliCompress)(c,{params:{[k.constants.BROTLI_PARAM_QUALITY]:v,[k.constants.BROTLI_PARAM_SIZE_HINT]:c.length}}):await re(k.gzip)(c),de(d,u);if(u.length>=c.length)return m();let l=oe(e.headers);return l.set("Content-Encoding",r),l.set("Content-Length",String(u.length)),new Response(u,{status:e.status,statusText:e.statusText,headers:l})}catch{return m()}}function oe(t){let e=new Headers(t),o=e.get("Vary");if(!o)return e.set("Vary","Accept-Encoding"),e;if(!o.split(",").some((c)=>c.trim().toLowerCase()==="accept-encoding"))e.set("Vary",`${o}, Accept-Encoding`);return e}var he=new Set(["x-stx-router","accept-encoding",...ds.map((t)=>t.toLowerCase())]);class J{now;entries=new T(1000,{maxBytes:33554432,sizeOf:(t)=>t.body.byteLength+JSON.stringify(t.headers).length*2});pending=new Map;generation=0;constructor(t=Date.now){this.now=t}invalidate(t){this.generation++,this.pending.clear();for(let e of Array.from(this.entries.keys()))if(t===void 0||this.entries.get(e)?.path===t)this.entries.delete(e)}async respond(t,e,o){let r,c=async()=>{let a=r??await o();return a.headers.set("Cache-Control","private, no-store"),a.headers.set("Vary",V(a.headers.get("Vary")).Vary),a};if(!e||t.method!=="GET"||t.headers.has("Cookie")||t.headers.has("Authorization")||t.headers.has("Range"))return c();let m=new URL(t.url),v=Be(t)?`fragment|${ds.map((a)=>t.headers.get(a)??"").join("|")}`:"document",d=`${m.origin}${m.pathname}${m.search}|${v}`,u=this.entries.get(d),l=(a)=>{let S=new Headers(a.headers);return S.set("Cache-Control","private, no-store"),S.set("Age",String(Math.max(0,Math.floor((this.now()-a.created)/1000)))),new Response(a.body.slice(0),{headers:S})},b=u?(this.now()-u.created)/1000:1/0;if(u&&b<e.maxAge)return l(u);let N=this.generation,X=async()=>{let a=await o();r=a;let S=(a.headers.get("Vary")??"").toLowerCase().split(",").map((s)=>s.trim()).filter(Boolean);if(a.status!==200||a.headers.has("Set-Cookie")||/(?:private|no-store|no-cache)/i.test(a.headers.get("Cache-Control")??"")||S.some((s)=>!he.has(s)))return null;let n=await a.clone().arrayBuffer();if(n.byteLength>1048576)return null;a.headers.set("Vary",V(a.headers.get("Vary")).Vary);let A={body:n,headers:Array.from(a.headers.entries()),created:this.now(),path:m.pathname};if(this.generation===N)this.entries.set(d,A);return A},w=this.pending.get(d);if(!w){if(this.pending.size>=1000)return c();w=X().finally(()=>{if(this.pending.get(d)===w)this.pending.delete(d)}),this.pending.set(d,w)}if(u&&b<e.maxAge+(e.swr??0))return w.catch(()=>{}),l(u);let E=await w;return E?l(E):c()}}var Re={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".json":"application/json",".html":"text/html",".txt":"text/plain",".xml":"application/xml",".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".svg":"image/svg+xml",".ico":"image/x-icon",".bmp":"image/bmp",".mp4":"video/mp4",".webm":"video/webm",".ogg":"audio/ogg",".mp3":"audio/mpeg",".wav":"audio/wav",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"};function q(t,e){if(!e)return null;let o=Pi(t.headers);return o&&Ai(o,e)?e:null}function K(t){return t?{"X-STX-Layout":t.layout,"X-STX-Layout-Group":t.group}:{}}async function Rm(t={}){let e=P.resolve(t.outputDir||".output"),o=t.port??3000,r=Fa(e);if(!r)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${r.routes.length} routes...`);let c=Jn(r.routeRules),m=new J,v=ni(e,r.apiRoutes??[]),d=Bun.file(P.join(e,"server/runtime-config.json")),u=t.runtimeConfig??(await d.exists()?await d.json():void 0),l=u?z(u):void 0,b=new Map,N=new Map,X=new Map,w=new Map;for(let n of r.routes)try{let A=P.join(e,n.compiledPath),s=JSON.parse(await Bun.file(A).text());if(l)s.html=Jt(s.html,l);b.set(n.pattern,s),X.set(n.pattern,We(s.html)),w.set(n.pattern,Ae(s.html));let j=P.join(e,n.fragmentPath);if(Tt(s.html,r.routerContainer||"main")&&await Bun.file(j).exists()){let M=await Bun.file(j).text();N.set(n.pattern,l?Jt(M,l):M)}}catch(A){console.warn(`[stx] Failed to load route ${n.pattern}:`,A)}let E=new Map,a=[];for(let n of r.routes)if(n.hasParams){let{regex:A,params:s}=Se(n.pattern,{page:!0});a.push({regex:A,route:n,paramNames:s})}else E.set(n.pattern,n);let S=ge({port:o,async fetch(n){return Wn(n,await et(l??z(),async()=>{let s=new URL(n.url).pathname;if(t.onRequest){let p=await t.onRequest(n);if(p)return p}if(t.apiRouter){let p=await t.apiRouter.handleRequest(n);if(p.status!==404)return p}if(t.apiRoutes?.[s])return t.apiRoutes[s](n);let j=await v(n);if(j)return j;if((n.method==="GET"||n.method==="HEAD")&&s!=="/"){let p=P.resolve(e,"public"),y;try{y=decodeURIComponent(s)}catch{y=s}if(!y.includes("\x00")){let f=P.resolve(p,`.${y}`);if(f===p||f.startsWith(`${p}${P.sep}`))try{if(ae.existsSync(f)&&ae.statSync(f).isFile()){let i=P.extname(f).toLowerCase(),g=Re[i]||"application/octet-stream",H=s.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(s);return new Response(Bun.file(f),{headers:{"Content-Type":g,"Cache-Control":H?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let M=Be(n),R=null,Q={};if(R=E.get(s)||null,!R)for(let{regex:p,route:y,paramNames:f}of a){let h=s.match(p);if(h){R=y,f.forEach((i,g)=>{Q[i]=h[g+1]});break}}if(!R){let p=Dt(s)?null:E.get("/404")||null;if(p){let y=b.get(p.pattern);if(y)return new Response(y.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}})}let O=c(s),Z=Object.keys(O).length>0;return m.respond(n,O.cache,async()=>{let p=b.get(R.pattern),y=M?q(n,X.get(R.pattern)):null;if(M&&!y&&n.method==="GET"&&p&&!p.hasServerScripts&&Object.keys(p.placeholders).length===0){let i=N.get(R.pattern);if(i){let g=X.get(R.pattern);return new Response(i,{status:p.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...w.has(R.pattern)?{"X-STX-Runtime":w.get(R.pattern)?"true":"false"}:{},...g?{"X-STX-Layout":g.layout,"X-STX-Layout-Group":g.group}:{},...V(),...O.cache?{}:{"Cache-Control":Et}}})}}let f=Fo(n.method),h=b.get(R.pattern);if(!h){let i=E.get("/500")||null;if(i){let g=b.get(i.pattern);if(g)return new Response(g.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(R.prerendered&&f)return new Response("Prerendered pages do not accept actions",{status:405,headers:{Allow:"GET, HEAD"}});if(!f&&!h.hasServerScripts&&Object.keys(h.placeholders).length===0)return new Response(h.html,{status:h.status??200,headers:{"Content-Type":"text/html",...V(),"Cache-Control":"public, max-age=60",...K(y)}});try{let{html:i,boundaries:g,redirect:H,cookies:I,status:D,headers:U}=await Gn(h,{params:Q,request:n,method:n.method,__stx_strict_hydration:Z,__stx_runtime_config:l});if(H)return za(H,I,U);if(g&&g.length>0){let{renderStreamingPage:x,streamToResponse:B}=await import("./chunk-n008g6xh.js"),L=new Headers({...V(),...U,"Cache-Control":"private, no-store"});for(let Y of I??[])L.append("Set-Cookie",Y);let _=M&&!f?We(i):null,te=_?q(n,_):null,ne=M&&!f&&!te&&Tt(i,r.routerContainer||"main");if(ne&&_)L.set("X-STX-Fragment","true"),L.set("X-STX-Runtime",Ae(i)?"true":"false"),L.set("X-STX-Layout",_.layout),L.set("X-STX-Layout-Group",_.group);for(let[Y,ie]of Object.entries(K(te)))L.set(Y,ie);return B(x(ne?Fe(i,r.routerContainer||"main",!0):i,g,{timeoutMs:30000}),{status:D??h.status??200,headers:L})}let C=new Headers({"Content-Type":"text/html",...V(),...O.cache?{}:{"Cache-Control":"private, no-store"}});for(let x of I??[])C.append("Set-Cookie",x);for(let[x,B]of Object.entries(U??{}))C.set(x,B);C.set("Vary",V(C.get("Vary")).Vary);let G=M&&!f?We(i):null,ee=G?q(n,G):null;for(let[x,B]of Object.entries(K(ee)))C.set(x,B);if(M&&!f&&!ee&&Tt(i,r.routerContainer||"main")){let x=G??We(i);return C.set("X-STX-Fragment","true"),C.set("X-STX-Runtime",Ae(i)?"true":"false"),C.set("X-STX-Layout",x.layout),C.set("X-STX-Layout-Group",x.group),new Response(Fe(i,r.routerContainer||"main",!0),{status:D??h.status??200,headers:C})}return new Response(i,{status:D??h.status??200,headers:C})}catch(i){if(console.error(`[stx] Hydration error for ${s}:`,i),Z)return new Response("Internal Server Error",{status:500});return new Response(h.html,{headers:{"Content-Type":"text/html"}})}})}))}});return console.log(`[stx] Production server running at http://localhost:${S.port}`),console.log(`[stx] Serving ${r.routes.length} routes (${b.size} pre-loaded)`),{port:S.port,stop:()=>{m.invalidate(),S.stop()},invalidate:(n)=>m.invalidate(n)}}
3
3
  export{Wn,Rm};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{q,Sg,vi,Wc,a,j,_y,Cy}from"./chunk-ja4fyz87.js";import"./chunk-v37hjzt2.js";import"./chunk-razwegar.js";import"./chunk-mpfm5ctr.js";import"./chunk-eca022er.js";import"./chunk-9gptdyqq.js";import"./chunk-etn044yn.js";import"./chunk-fcqca9qb.js";import"./chunk-w98yt4d4.js";import"./chunk-c08jvjqt.js";import"./chunk-phzhmnnm.js";import"./chunk-75r2p1cz.js";import"./chunk-0jdz31q1.js";import"./chunk-4b110x6r.js";export{j as config,q as defaultConfig,_y as defineStxConfig,vi as discoverConfig,a as loadStxConfig,Wc as resolveInstalledPackage,Sg as resolveStxDirectories,Cy as validateConfig};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Qf,eg,$e,tg,Rc,mn,hn,sy,Ac,yn,hr,ng,rg,sg,Cs,og,ig,Pc,bn,ag,wn,Ic,oy}from"./chunk-4ccbj4z6.js";import"./chunk-8d6wkfdx.js";import"./chunk-cwcmmgvz.js";import"./chunk-13awnyq0.js";import"./chunk-2r84qtat.js";import"./chunk-r2ns89f7.js";import"./chunk-razwegar.js";import"./chunk-mpfm5ctr.js";import"./chunk-eca022er.js";import"./chunk-b234w3mf.js";import"./chunk-ggez55jb.js";import"./chunk-4zw9trtx.js";import"./chunk-w98yt4d4.js";import"./chunk-c08jvjqt.js";import"./chunk-phzhmnnm.js";import"./chunk-ck4ypzet.js";import"./chunk-0jdz31q1.js";import"./chunk-4b110x6r.js";export{hr as MODULE_SPECIFIER_PREFIX,Pc as assertBundleBuildCanSettle,Qf as bundleCacheDir,eg as bundleCacheEntryLimit,oy as bundleClientEntriesSplit,wn as bundleClientScript,hn as clearBundleFailures,$e as clientBundleDependencies,mn as getBundleFailures,yn as hasUserImports,ig as isWithinBundlerCallback,bn as moduleSubstitutionKey,rg as normalizeRegistrySpecifiers,ag as queueClientBundleBuild,Rc as recordBundleFailure,ng as registryIdForPath,Ac as resolveBundlerFallback,sg as rewriteRegistryImports,sy as setBundlerFallbackMode,tg as shouldLogBundlerDiagnostics,Ic as tempBuildName,Cs as withModuleSubstitutes,og as withinBundlerCallback};
2
+ import{Qf,eg,$e,tg,Rc,mn,hn,sy,Ac,yn,hr,ng,rg,sg,Cs,og,ig,Pc,bn,ag,wn,Ic,oy}from"./chunk-px6zx8ae.js";import"./chunk-gqz6502d.js";import"./chunk-cwcmmgvz.js";import"./chunk-2vdbt2a7.js";import"./chunk-ja4fyz87.js";import"./chunk-v37hjzt2.js";import"./chunk-razwegar.js";import"./chunk-mpfm5ctr.js";import"./chunk-eca022er.js";import"./chunk-9gptdyqq.js";import"./chunk-etn044yn.js";import"./chunk-fcqca9qb.js";import"./chunk-w98yt4d4.js";import"./chunk-c08jvjqt.js";import"./chunk-phzhmnnm.js";import"./chunk-75r2p1cz.js";import"./chunk-0jdz31q1.js";import"./chunk-4b110x6r.js";export{hr as MODULE_SPECIFIER_PREFIX,Pc as assertBundleBuildCanSettle,Qf as bundleCacheDir,eg as bundleCacheEntryLimit,oy as bundleClientEntriesSplit,wn as bundleClientScript,hn as clearBundleFailures,$e as clientBundleDependencies,mn as getBundleFailures,yn as hasUserImports,ig as isWithinBundlerCallback,bn as moduleSubstitutionKey,rg as normalizeRegistrySpecifiers,ag as queueClientBundleBuild,Rc as recordBundleFailure,ng as registryIdForPath,Ac as resolveBundlerFallback,sg as rewriteRegistryImports,sy as setBundlerFallbackMode,tg as shouldLogBundlerDiagnostics,Ic as tempBuildName,Cs as withModuleSubstitutes,og as withinBundlerCallback};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{vn,ei,ti,ni,iy,ri}from"./chunk-8d6wkfdx.js";import"./chunk-mpfm5ctr.js";import"./chunk-b234w3mf.js";import"./chunk-w98yt4d4.js";export{ti as buildServerApi,iy as createServerApi,vn as discoverServerApi,ei as generateApiTypes,ri as isServerApiSource,ni as productionApiDispatcher};
2
+ import{vn,ei,ti,ni,iy,ri}from"./chunk-gqz6502d.js";import"./chunk-mpfm5ctr.js";import"./chunk-9gptdyqq.js";import"./chunk-w98yt4d4.js";export{ti as buildServerApi,iy as createServerApi,vn as discoverServerApi,ei as generateApiTypes,ri as isServerApiSource,ni as productionApiDispatcher};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{wg,yy,by,wy,vy,vg,xg,xy,Sy,wi,ky,Er,Tr,Bs}from"./chunk-kvrbdez2.js";import{gt}from"./chunk-zkwkhesc.js";import"./chunk-ggez55jb.js";import"./chunk-4zw9trtx.js";import"./chunk-w98yt4d4.js";import"./chunk-c08jvjqt.js";import"./chunk-phzhmnnm.js";import"./chunk-ck4ypzet.js";import"./chunk-0jdz31q1.js";import"./chunk-4b110x6r.js";export{vy as __setSignalsGeneratorsForTest,gt as cacheEngineFingerprint,Tr as cacheTemplate,Er as checkCache,ky as clearDevCaches,xg as getCachedRouterScript,vg as getCachedSignalsRuntime,xy as getServeClientAsset,wi as getServeModuleBundle,Bs as hashFilePath,by as invalidateFileCache,wy as invalidateFileCacheByDir,yy as readFileCached,Sy as registerServeModuleBundle,wg as templateCache};
2
+ import{wg,yy,by,wy,vy,vg,xg,xy,Sy,wi,ky,Er,Tr,Bs}from"./chunk-z02jzx63.js";import{gt}from"./chunk-zkwkhesc.js";import"./chunk-etn044yn.js";import"./chunk-fcqca9qb.js";import"./chunk-w98yt4d4.js";import"./chunk-c08jvjqt.js";import"./chunk-phzhmnnm.js";import"./chunk-75r2p1cz.js";import"./chunk-0jdz31q1.js";import"./chunk-4b110x6r.js";export{vy as __setSignalsGeneratorsForTest,gt as cacheEngineFingerprint,Tr as cacheTemplate,Er as checkCache,ky as clearDevCaches,xg as getCachedRouterScript,vg as getCachedSignalsRuntime,xy as getServeClientAsset,wi as getServeModuleBundle,Bs as hashFilePath,by as invalidateFileCache,wy as invalidateFileCacheByDir,yy as readFileCached,Sy as registerServeModuleBundle,wg as templateCache};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Rm}from"./chunk-qedhz0p8.js";import"./chunk-5mv2hc96.js";import"./chunk-7mv9z3mp.js";import"./chunk-gqz6502d.js";import"./chunk-a774ncg3.js";import"./chunk-hcxsyw55.js";import"./chunk-ja4fyz87.js";import"./chunk-v37hjzt2.js";import"./chunk-razwegar.js";import"./chunk-mpfm5ctr.js";import"./chunk-eca022er.js";import"./chunk-9gptdyqq.js";import"./chunk-etn044yn.js";import"./chunk-fcqca9qb.js";import"./chunk-w98yt4d4.js";import"./chunk-c08jvjqt.js";import"./chunk-phzhmnnm.js";import"./chunk-75r2p1cz.js";import"./chunk-0jdz31q1.js";import"./chunk-4b110x6r.js";export{Rm as startProductionServer};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{ft}from"./chunk-b234w3mf.js";import{At,or}from"./chunk-0mxkw6m6.js";import{ye,An,Rl,Al}from"./chunk-ggez55jb.js";import{qr,Kr,Xr,Jr,Le}from"./chunk-c08jvjqt.js";import{z}from"./chunk-w98yt4d4.js";import{Ji}from"./chunk-4zw9trtx.js";import{S}from"./chunk-x40j9ta1.js";import{i}from"./chunk-4kh0616n.js";import{q,a}from"./chunk-2r84qtat.js";import{Qc}from"./chunk-mpfm5ctr.js";import{Kn,Xn,ot,Fe,ja,Ba,Gn}from"./chunk-xjbj655y.js";import{vn,ti}from"./chunk-8d6wkfdx.js";import{Jn}from"./chunk-fznjm7qt.js";import{fn,gr,mr}from"./chunk-357qjcj1.js";import{re}from"./chunk-pgqc8895.js";import m from"fs";import c from"path";import{createHash as Y}from"crypto";function I(n){return Y("sha256").update(n).digest("hex").slice(0,8)}function W(n=!1){let l=n?or():At(),o=I(l);return{content:l,filename:`runtime.${o}.js`,hash:o}}function J(){let n=ft(),l=I(n);return{content:n,filename:`router.${l}.js`,hash:l}}import U from"path";import{createHash as Q}from"crypto";function ee(n={}){let l=new Set;return{context:new Proxy(n,{get(r,e){if(e in r)return r[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(r,e){if(e in r)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function V(n,l,o={}){let r=U.resolve(n),e=await Bun.file(r).text(),x=Q("sha256").update(e).digest("hex").slice(0,16);Rl();let _={};try{_=await a(o.configDir)}catch{}let y=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let R=g[1];if(/\bserver\b/.test(R))y.push(g[2])}let u=new Set(y.flatMap((R)=>ye(R))),{context:D}=ee({__filename:r,__dirname:U.dirname(r),__stx_serverDeclared:u}),A=new Set,T={...q,..._,...o,buildMode:"compile",strict:!1},f=await i(e,D,r,T,A),w=Kn(f)+Xn(f)+ot(f),j=Al();return{route:l,sourceFile:n,html:f,fragment:w,placeholders:j,hasServerScripts:y.length>0,serverScriptContent:y,dependencies:Array.from(A),contentHash:x,status:An(e),streamTemplates:D.__streamTemplates}}var te=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function X(n,l){let o=0,r=0;if(!m.existsSync(n))return{copied:o,bytes:r};m.mkdirSync(l,{recursive:!0});function e(x,_){let y=m.readdirSync(x,{withFileTypes:!0});for(let d of y){if(te.has(d.name))continue;let g=c.join(x,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(g,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(g,u),o++,r+=m.statSync(u).size}}}return e(n,l),{copied:o,bytes:r}}async function Lm(n={}){let l=Date.now(),o=c.resolve(n.root||process.cwd()),r=c.resolve(o,n.outputDir||".output");console.log("[stx build] Starting production build...");let e=await a(o),x=c.resolve(o,n.componentsDir??e.componentsDir??"components"),_=c.resolve(o,n.partialsDir??e.partialsDir??"partials"),y=c.resolve(o,n.layoutsDir??e.layoutsDir??"layouts"),d=n.publicDir??e.publicDir??"public",g=Le(e.app?.head,{known:Jr,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",A=n.routeRules??e.routeRules??{},T=Jn(A),f=n.serverApi??e.serverApi,w=typeof f==="object"?f:{};if(f)vn(o,w);if(e.runtimeConfig)z(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let j=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of j)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=re(o,{pagesDirs:e._layerPageDirs}),Z=["components","layouts","partials"],P=R.filter((s)=>!Z.some((h)=>s.pattern.startsWith(`/${h}/`)||s.pattern===`/${h}`));console.log(`[stx build] Found ${P.length} page routes (${R.length-P.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=W(n.debug),b=J();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",b.filename),b.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${b.filename} (${(b.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let B=[],O=[];for(let s of P){let h=T(s.pattern),M=h.rendering==="prerender";if(M&&(s.pattern.includes(":")||s.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${s.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await V(s.filePath,s.pattern,{configDir:o,componentsDir:x,partialsDir:_,layoutsDir:y,debug:n.debug});if(B.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,b.filename),t.html=Xr(t.html,g,{bodyScripts:[`<script src="/__stx/${b.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=qr(t.html,u);if(g.htmlAttrs)t.html=Kr(t.html,g.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(t.html)){let p=t.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(p&&p[1]){let G=p[1];t.html=t.html.replace(" "+G,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${G}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await S(t.html),M){let p=await Gn(t,{params:{},request:new Request(`http://stx.build${s.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${s.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=Fe(t.html,D,!0);let N=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),K=c.join("server","pages",`${N}.compiled.json`),L=c.join("server","fragments",`${N}.html`);await Bun.write(c.join(r,K),JSON.stringify(t,null,2)),await Bun.write(c.join(r,L),t.fragment),O.push({pattern:s.pattern,compiledPath:K,fragmentPath:L,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:M}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(h).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let H=c.resolve(o,d);if(m.existsSync(H)){let{copied:s,bytes:h}=X(H,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${d}/`)}let k=mr(o);if(k){let{copied:s,bytes:h}=X(k,c.join(r,"public",gr));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${fn}/`)}let E={runtime:v.filename,router:b.filename},C=ja(O,E,r);if(C.routeRules=A,C.routerContainer=D,f)C.apiRoutes=await ti(o,r,w);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await Ji(o,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(Qc(e._layerGraph),null,2));Ba(C,r);let F=Date.now()-l;return console.log(`
2
+ import{ft}from"./chunk-9gptdyqq.js";import{At,or}from"./chunk-0mxkw6m6.js";import{ye,An,Rl,Al}from"./chunk-etn044yn.js";import{qr,Kr,Xr,Jr,Le}from"./chunk-c08jvjqt.js";import{z}from"./chunk-w98yt4d4.js";import{Ji}from"./chunk-fcqca9qb.js";import{S}from"./chunk-zwhc17pt.js";import{i}from"./chunk-6s82ecbh.js";import{q,a}from"./chunk-ja4fyz87.js";import{Qc}from"./chunk-mpfm5ctr.js";import{Kn,Xn,ot,Fe,ja,Ba,Gn}from"./chunk-5mv2hc96.js";import{vn,ti}from"./chunk-gqz6502d.js";import{Jn}from"./chunk-fznjm7qt.js";import{fn,gr,mr}from"./chunk-357qjcj1.js";import{re}from"./chunk-hcxsyw55.js";import m from"fs";import c from"path";import{createHash as Y}from"crypto";function I(n){return Y("sha256").update(n).digest("hex").slice(0,8)}function W(n=!1){let l=n?or():At(),o=I(l);return{content:l,filename:`runtime.${o}.js`,hash:o}}function J(){let n=ft(),l=I(n);return{content:n,filename:`router.${l}.js`,hash:l}}import U from"path";import{createHash as Q}from"crypto";function ee(n={}){let l=new Set;return{context:new Proxy(n,{get(r,e){if(e in r)return r[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(r,e){if(e in r)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function V(n,l,o={}){let r=U.resolve(n),e=await Bun.file(r).text(),x=Q("sha256").update(e).digest("hex").slice(0,16);Rl();let _={};try{_=await a(o.configDir)}catch{}let y=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let R=g[1];if(/\bserver\b/.test(R))y.push(g[2])}let u=new Set(y.flatMap((R)=>ye(R))),{context:D}=ee({__filename:r,__dirname:U.dirname(r),__stx_serverDeclared:u}),A=new Set,T={...q,..._,...o,buildMode:"compile",strict:!1},f=await i(e,D,r,T,A),w=Kn(f)+Xn(f)+ot(f),j=Al();return{route:l,sourceFile:n,html:f,fragment:w,placeholders:j,hasServerScripts:y.length>0,serverScriptContent:y,dependencies:Array.from(A),contentHash:x,status:An(e),streamTemplates:D.__streamTemplates}}var te=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function X(n,l){let o=0,r=0;if(!m.existsSync(n))return{copied:o,bytes:r};m.mkdirSync(l,{recursive:!0});function e(x,_){let y=m.readdirSync(x,{withFileTypes:!0});for(let d of y){if(te.has(d.name))continue;let g=c.join(x,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(g,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(g,u),o++,r+=m.statSync(u).size}}}return e(n,l),{copied:o,bytes:r}}async function Lm(n={}){let l=Date.now(),o=c.resolve(n.root||process.cwd()),r=c.resolve(o,n.outputDir||".output");console.log("[stx build] Starting production build...");let e=await a(o),x=c.resolve(o,n.componentsDir??e.componentsDir??"components"),_=c.resolve(o,n.partialsDir??e.partialsDir??"partials"),y=c.resolve(o,n.layoutsDir??e.layoutsDir??"layouts"),d=n.publicDir??e.publicDir??"public",g=Le(e.app?.head,{known:Jr,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",A=n.routeRules??e.routeRules??{},T=Jn(A),f=n.serverApi??e.serverApi,w=typeof f==="object"?f:{};if(f)vn(o,w);if(e.runtimeConfig)z(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let j=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of j)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=re(o,{pagesDirs:e._layerPageDirs}),Z=["components","layouts","partials"],P=R.filter((s)=>!Z.some((h)=>s.pattern.startsWith(`/${h}/`)||s.pattern===`/${h}`));console.log(`[stx build] Found ${P.length} page routes (${R.length-P.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=W(n.debug),b=J();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",b.filename),b.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${b.filename} (${(b.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let B=[],O=[];for(let s of P){let h=T(s.pattern),M=h.rendering==="prerender";if(M&&(s.pattern.includes(":")||s.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${s.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await V(s.filePath,s.pattern,{configDir:o,componentsDir:x,partialsDir:_,layoutsDir:y,debug:n.debug});if(B.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,b.filename),t.html=Xr(t.html,g,{bodyScripts:[`<script src="/__stx/${b.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=qr(t.html,u);if(g.htmlAttrs)t.html=Kr(t.html,g.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(t.html)){let p=t.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(p&&p[1]){let G=p[1];t.html=t.html.replace(" "+G,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${G}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await S(t.html),M){let p=await Gn(t,{params:{},request:new Request(`http://stx.build${s.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${s.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=Fe(t.html,D,!0);let N=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),K=c.join("server","pages",`${N}.compiled.json`),L=c.join("server","fragments",`${N}.html`);await Bun.write(c.join(r,K),JSON.stringify(t,null,2)),await Bun.write(c.join(r,L),t.fragment),O.push({pattern:s.pattern,compiledPath:K,fragmentPath:L,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:M}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(h).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let H=c.resolve(o,d);if(m.existsSync(H)){let{copied:s,bytes:h}=X(H,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${d}/`)}let k=mr(o);if(k){let{copied:s,bytes:h}=X(k,c.join(r,"public",gr));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${fn}/`)}let E={runtime:v.filename,router:b.filename},C=ja(O,E,r);if(C.routeRules=A,C.routerContainer=D,f)C.apiRoutes=await ti(o,r,w);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await Ji(o,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(Qc(e._layerGraph),null,2));Ba(C,r);let F=Date.now()-l;return console.log(`
3
3
  [stx build] Done in ${F}ms \u2014 ${B.length} pages compiled`),{pageCount:B.length,assets:E,outputDir:r,duration:F}}
4
4
  export{Lm};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Ie,fo,Jg,Oy,Yg,Ny,Nn,g,Y,ae,Mn,Me,Zg,Xi,Qg,My,P,Gi,em,Dy,N,Ly}from"./chunk-ggez55jb.js";import"./chunk-4zw9trtx.js";import"./chunk-w98yt4d4.js";import"./chunk-c08jvjqt.js";import"./chunk-phzhmnnm.js";import"./chunk-ck4ypzet.js";import"./chunk-0jdz31q1.js";import"./chunk-4b110x6r.js";export{em as applyFilters,Ny as clearCustomFilters,Zg as clientLoopScopes,fo as defaultFilters,Mn as escapeAttributeValue,g as escapeHtml,Y as escapeHtmlValue,ae as escapeInterpolatedHtmlValue,N as evaluateExpression,Ie as findMustacheEnd,Yg as getAllFilters,Qg as interpolateScriptAttributes,Xi as interpolateScriptExpressions,My as interpolateScriptsInTemplate,P as processExpressions,Gi as processExpressionsChunked,Jg as registerFilter,Oy as registerFilters,Nn as replaceInterpolations,Dy as resetRejectedExpressionWarnings,Ly as unescapeHtml,Me as usesSignalsInScript};
2
+ import{Ie,fo,Jg,Oy,Yg,Ny,Nn,g,Y,ae,Mn,Me,Zg,Xi,Qg,My,P,Gi,em,Dy,N,Ly}from"./chunk-etn044yn.js";import"./chunk-fcqca9qb.js";import"./chunk-w98yt4d4.js";import"./chunk-c08jvjqt.js";import"./chunk-phzhmnnm.js";import"./chunk-75r2p1cz.js";import"./chunk-0jdz31q1.js";import"./chunk-4b110x6r.js";export{em as applyFilters,Ny as clearCustomFilters,Zg as clientLoopScopes,fo as defaultFilters,Mn as escapeAttributeValue,g as escapeHtml,Y as escapeHtmlValue,ae as escapeInterpolatedHtmlValue,N as evaluateExpression,Ie as findMustacheEnd,Yg as getAllFilters,Qg as interpolateScriptAttributes,Xi as interpolateScriptExpressions,My as interpolateScriptsInTemplate,P as processExpressions,Gi as processExpressionsChunked,Jg as registerFilter,Oy as registerFilters,Nn as replaceInterpolations,Dy as resetRejectedExpressionWarnings,Ly as unescapeHtml,Me as usesSignalsInScript};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{M,n,u}from"./chunk-c08jvjqt.js";import{ae}from"./chunk-ggez55jb.js";import{xi}from"./chunk-razwegar.js";import E from"path";var S;async function W(){if(S!==void 0)return S;try{let e=await import("@stacksjs/ts-i18n");S=e.loadLocale??null}catch{S=null}return S}var T={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},v={},L={},k={};function J(e,s=0){if(s<=0)return!1;return Date.now()-e.loadedAt>s}async function G(e,s){if({...T,...s.i18n}.cache&&v[e]){let t=v[e],o=s.i18n?.cacheMaxAge??0;if(!J(t,o))return t.translations}if(L[e]?.state==="loading")return L[e].promise;k[e]="loading";let r=C(e,s).then((t)=>(k[e]="loaded",delete L[e],t)).catch((t)=>{throw k[e]="error",L[e]={promise:r,state:"error",error:t instanceof Error?t:Error(String(t))},t});return L[e]={promise:r,state:"loading"},r}async function C(e,s){let i={...T,...s.i18n},r=E.isAbsolute(i.translationsDir)?i.translationsDir:E.resolve(s.root||process.cwd(),i.translationsDir);try{let t=await W(),o=t?await t(e,{translationsDir:r,defaultLocale:i.defaultLocale,sources:ee(i.format)}):await Y(e,i,r);if(o===void 0){let c=e!==i.defaultLocale?await C(i.defaultLocale,s):{};if(i.cache)v[e]={translations:c,loadedAt:Date.now(),locale:e};return c}let l=o;if(i.cache)v[e]={translations:l,loadedAt:Date.now(),locale:e};return l}catch(t){if(s.debug)console.error(`Error loading translation file for locale "${e}":`,t);if(e!==i.defaultLocale)return C(i.defaultLocale,s);return{}}}async function Y(e,s,i){let r=E.join(i,`${e}${Z(s.format)}`);try{let t=await import(r);return t.default||t}catch(t){try{let o=await Bun.file(r).text();if(s.format==="yaml"||s.format==="yml")return Q(o);if(s.format==="json")return JSON.parse(o);throw t}catch{return}}}function Z(e){switch(e){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function Q(e){let s={},i=e.split(`
2
+ import{M,n,u}from"./chunk-c08jvjqt.js";import{ae}from"./chunk-etn044yn.js";import{xi}from"./chunk-razwegar.js";import E from"path";var S;async function W(){if(S!==void 0)return S;try{let e=await import("@stacksjs/ts-i18n");S=e.loadLocale??null}catch{S=null}return S}var T={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},v={},L={},k={};function J(e,s=0){if(s<=0)return!1;return Date.now()-e.loadedAt>s}async function G(e,s){if({...T,...s.i18n}.cache&&v[e]){let t=v[e],o=s.i18n?.cacheMaxAge??0;if(!J(t,o))return t.translations}if(L[e]?.state==="loading")return L[e].promise;k[e]="loading";let r=C(e,s).then((t)=>(k[e]="loaded",delete L[e],t)).catch((t)=>{throw k[e]="error",L[e]={promise:r,state:"error",error:t instanceof Error?t:Error(String(t))},t});return L[e]={promise:r,state:"loading"},r}async function C(e,s){let i={...T,...s.i18n},r=E.isAbsolute(i.translationsDir)?i.translationsDir:E.resolve(s.root||process.cwd(),i.translationsDir);try{let t=await W(),o=t?await t(e,{translationsDir:r,defaultLocale:i.defaultLocale,sources:ee(i.format)}):await Y(e,i,r);if(o===void 0){let c=e!==i.defaultLocale?await C(i.defaultLocale,s):{};if(i.cache)v[e]={translations:c,loadedAt:Date.now(),locale:e};return c}let l=o;if(i.cache)v[e]={translations:l,loadedAt:Date.now(),locale:e};return l}catch(t){if(s.debug)console.error(`Error loading translation file for locale "${e}":`,t);if(e!==i.defaultLocale)return C(i.defaultLocale,s);return{}}}async function Y(e,s,i){let r=E.join(i,`${e}${Z(s.format)}`);try{let t=await import(r);return t.default||t}catch(t){try{let o=await Bun.file(r).text();if(s.format==="yaml"||s.format==="yml")return Q(o);if(s.format==="json")return JSON.parse(o);throw t}catch{return}}}function Z(e){switch(e){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function Q(e){let s={},i=e.split(`
3
3
  `),r=[{obj:s,indent:-1}];for(let t of i){let o=t.replace(/#.*$/,"").trimEnd();if(!o.trim())continue;let l=o.search(/\S/);if(l===-1)continue;while(r.length>1&&r[r.length-1].indent>=l)r.pop();let c=r[r.length-1].obj,a=o.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(a){let[,,g,p]=a,f=g.trim(),m=p.trim();if(m==="")c[f]={},r.push({obj:c[f],indent:l});else c[f]=X(m)}}return s}function X(e){if(e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"'))return e.slice(1,-1);let s=e.toLowerCase();if(s==="true"||s==="yes")return!0;if(s==="false"||s==="no")return!1;if(s==="null"||s==="~")return null;let i=Number(e);if(!Number.isNaN(i)&&e!=="")return i;return e}function ee(e){switch(e){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function te(e,s){return G(e,s)}function re(e,s){for(let i of e){let r=i.trim(),t=r.match(/^\{(\d+)\}\s*(.*)$/);if(t){let l=Number.parseInt(t[1],10);if(s===l)return t[2];continue}let o=r.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(o){let l=Number.parseInt(o[1],10),c=o[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(o[2],10);if(s>=l&&s<=c)return o[3];continue}}if(e.length===2)return s===1?e[0].trim():e[1].trim();if(s<e.length)return e[s].trim();return e[e.length-1].trim()}function ne(e,s={}){return j(e,s)}function j(e,s){let i="",r=0;while(r<e.length)if(e[r]==="{"){let t=ie(e,r);if(t===-1){i+=e[r],r++;continue}let o=e.slice(r+1,t);i+=se(o,s),r=t+1}else if(e[r]==="'"&&r+1<e.length)if(e[r+1]==="'")i+="'",r+=2;else if(e[r+1]==="{"||e[r+1]==="}")i+=e[r+1],r+=2;else i+=e[r],r++;else i+=e[r],r++;return i}function ie(e,s){let i=0;for(let r=s;r<e.length;r++)if(e[r]==="{")i++;else if(e[r]==="}"){if(i--,i===0)return r}return-1}function se(e,s){let i=oe(e);if(i.length===0)return`{${e}}`;let r=i[0].trim(),t=s[r];if(i.length===1)return t!==void 0?String(t):`{${r}}`;switch(i[1].trim().toLowerCase()){case"plural":return le(t,i.slice(2).join(","),s);case"select":return ue(t,i.slice(2).join(","));case"selectordinal":return de(t,i.slice(2).join(","));case"number":return pe(t,i[2]?.trim());case"date":return fe(t,i[2]?.trim());case"time":return me(t,i[2]?.trim());default:return t!==void 0?String(t):`{${e}}`}}function oe(e){let s=[],i="",r=0;for(let t=0;t<e.length;t++){let o=e[t];if(o==="{")r++,i+=o;else if(o==="}")r--,i+=o;else if(o===","&&r===0)s.push(i),i="";else i+=o}if(i)s.push(i);return s}function le(e,s,i){let r=Number(e)||0,t=P(s),o=`=${r}`;if(t[o])return R(t[o],r,i);let l=ce(r);if(t[l])return R(t[l],r,i);if(t.other)return R(t.other,r,i);return String(r)}function R(e,s,i){let r=e.replace(/#/g,String(s));return j(r,i)}function ce(e){let s=Math.abs(e),i=Math.floor(s),r=String(e).includes(".")?String(e).split(".")[1].length:0;if(i===1&&r===0)return"one";return"other"}function ue(e,s){let i=String(e||""),r=P(s);if(r[i])return r[i];return r.other||String(e)}function de(e,s){let i=Number(e)||0,r=P(s),t=ge(i);if(r[t])return r[t].replace(/#/g,String(i));if(r.other)return r.other.replace(/#/g,String(i));return String(i)}function ge(e){let s=Math.abs(e),i=s%10,r=s%100;if(i===1&&r!==11)return"one";if(i===2&&r!==12)return"two";if(i===3&&r!==13)return"few";return"other"}function P(e){let s={},i=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,r=i.exec(e);while(r!==null)s[r[1]]=r[2],r=i.exec(e);return s}function pe(e,s){let i=Number(e);if(Number.isNaN(i))return String(e);switch(s){case"integer":return Math.floor(i).toLocaleString();case"percent":return`${(i*100).toFixed(0)}%`;case"currency":return i.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return i.toLocaleString()}}function fe(e,s){let i=e instanceof Date?e:new Date(String(e));if(Number.isNaN(i.getTime()))return String(e);let r={};switch(s){case"short":r.dateStyle="short";break;case"medium":r.dateStyle="medium";break;case"long":r.dateStyle="long";break;case"full":r.dateStyle="full";break;default:r.dateStyle="medium"}return i.toLocaleDateString(void 0,r)}function me(e,s){let i=e instanceof Date?e:new Date(String(e));if(Number.isNaN(i.getTime()))return String(e);let r={};switch(s){case"short":r.timeStyle="short";break;case"medium":r.timeStyle="medium";break;case"long":r.timeStyle="long";break;case"full":r.timeStyle="full";break;default:r.timeStyle="short"}return i.toLocaleTimeString(void 0,r)}function be(e){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(e)}function O(e,s,i=!0,r={}){let t=e.split("."),o=s;for(let c of t){if(o===void 0||o===null)break;o=o[c]}if(o===void 0||o===null)return i?e:"";let l=String(o);if(be(l))return ne(l,r);if(l.includes("|")&&"count"in r){let c=Number(r.count),a=l.split("|");l=re(a,c)}for(let[c,a]of Object.entries(r)){let g=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");l=l.replace(new RegExp(`:${g}`,"g"),()=>String(a))}return l}var D=new Set(["ar","arc","ckb","dv","fa","he","khw","ks","nqo","prs","ps","sd","syr","ug","ur","uz-af","yi"]),he=new Set(["adlm","arab","aran","hebr","nkoo","rohg","syrc","thaa","yezi"]);function q(e){if(!e)return"ltr";let s=e.trim().toLowerCase().replace(/_/g,"-").split("-"),i=s[0];if(!i)return"ltr";let r=s[1]?.length===4?s[1]:void 0;if(r)return he.has(r)?"rtl":"ltr";if(s.length>1&&D.has(`${i}-${s[1]}`))return"rtl";return D.has(i)?"rtl":"ltr"}async function qc(e,s,i,r){let t=e,o=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,l={...T,...r.i18n},c=await te(l.locale,r);s.__translations=c,s.__locale=l.locale,s.__i18nConfig=l,t=await F(t,o,async(p,f,m,w,h)=>{try{let b={};if(m)try{let d=[()=>JSON.parse(m),()=>{let x=`{"data":${m}}`,A=JSON.parse(x);return typeof A.data==="object"?A.data:{}},()=>M(m,s)];for(let x of d)try{if(b=x(),Object.keys(b).length>0)break}catch{}}catch(d){if(r.debug)console.error("Error parsing parameters for @translate directive:",d)}let y=O(f,c,l.fallbackToKey,b);return y?ae(t,h,y,!1,p.length):w.trim()}catch(b){if(r.debug)console.error("Error processing @translate directive:",b);return u("Translate",`Error in @translate('${f}'): ${b instanceof Error?b.message:String(b)}`,n.EVALUATION_ERROR)}});let a=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(r.debug){console.warn(`Processing translations in template. Sections: ${t.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let p=[...t.matchAll(a)];console.warn(`Found ${p.length} @translate matches`),p.forEach((f,m)=>console.warn(`Match ${m}: ${f[0]}, Key: ${f[1]}, Params: ${f[2]||"none"}`))}return t=await F(t,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(p,f,m,w)=>{try{let h={};if(m)try{let b=[()=>JSON.parse(m),()=>{let y=`{"data":${m}}`,d=JSON.parse(y);return typeof d.data==="object"?d.data:{}},()=>M(m,s)];for(let y of b)try{if(h=y(),Object.keys(h).length>0)break}catch{}}catch(b){if(r.debug)console.error("Error parsing parameters for @translate directive:",b)}return ae(t,w,O(f,c,l.fallbackToKey,h),!1,p.length)}catch(h){if(r.debug)console.error("Error processing @translate directive:",h);return u("Translate",`Error in @translate('${f}'): ${h instanceof Error?h.message:String(h)}`,n.EVALUATION_ERROR)}}),t}async function F(e,s,i){let r=[];return e.replace(s,(o,...l)=>{let c=i(o,...l).then((a)=>({match:o,replacement:a}));return r.push(c),o}),(await Promise.all(r)).reduce((o,{match:l,replacement:c})=>o.replace(l,()=>c),e)}function _(e,s){if(!e||q(e)!=="rtl")return!1;return!s||s.trim().toLowerCase()!=="rtl"}function V(e){if(!e)return!1;return e.trim().split(/\s+/)[0]?.toLowerCase()==="presentation"||e.trim().split(/\s+/)[0]?.toLowerCase()==="none"}function I(e,s){let i=new RegExp(`\\b${s}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i").exec(e);if(!i)return null;return i[2]??i[3]??i[4]??null}function Kc(e,s,i,r){let t=e;t=t.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(l,c,a)=>{let p={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[c]||"Make this element accessible";return`<!-- a11y-hint: ${a||p} -->`});let o=/@screenReader\(([^@]*)\)@endScreenReader/g;return t=t.replace(o,(l,c)=>`<span class="sr-only">${c.trim()}</span>`),t=t.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(l,c,a)=>`<span id="${`desc-${c}`}" class="sr-only">${a}</span>`),t}function ye(){return typeof globalThis.document<"u"&&typeof globalThis.document.createElement==="function"}function xe(e){let s=new Map,i=e.replace(/<(\/?)([A-Z][\w:.-]*)(?=[\s/>])/g,(t,o,l)=>{let c=s.get(l);if(!c)c=`stx-a11y-component-${s.size}`,s.set(l,c);return`<${o}${c}`}),r=new Map([...s.entries()].map(([t,o])=>[o,t]));return{protectedSource:i,restore:(t)=>t.replace(/<(\/?)(stx-a11y-component-\d+)(?=[\s/>])/g,(o,l,c)=>{let a=r.get(c);return a?`<${l}${a}`:o})}}function we(e,s){let i=[],r=/<img\s+([^>]*)>/gi,t;t=r.exec(e);while(t!==null){let d=t[1];if(!/\balt\s*=/i.test(d))i.push({type:"missing-alt",element:t[0].substring(0,100),message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"});t=r.exec(e)}let o=/<button([^>]*)>\s*<\/button>/gi;t=o.exec(e);while(t!==null){let d=t[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))i.push({type:"missing-accessible-name",element:t[0].substring(0,100),message:"Empty button missing accessible name",impact:"critical",help:"Add text content, aria-label, or title",helpUrl:"https://web.dev/learn/accessibility/aria-html/"});t=o.exec(e)}let l=/<a\s+([^>]*)>\s*<\/a>/gi;t=l.exec(e);while(t!==null){let d=t[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))i.push({type:"link-missing-text",element:t[0].substring(0,100),message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"});t=l.exec(e)}let c=/<(input|select|textarea)\s+([^>]*)>/gi;t=c.exec(e);while(t!==null){let d=t[2];if(/\btype\s*=\s*["']hidden["']/i.test(d)){t=c.exec(e);continue}let x=/\baria-label\s*=/i.test(d)||/\baria-labelledby\s*=/i.test(d),A=d.match(/\bid\s*=\s*["']([^"']+)["']/i);if(!x){let B=A&&new RegExp(`<label[^>]*\\bfor\\s*=\\s*["']${A[1]}["']`,"i").test(e),U=t.index,N=e.substring(0,U),Se=e.substring(U),H=(N.match(/<label\b/gi)||[]).length,z=(N.match(/<\/label>/gi)||[]).length,K=H>z;if(!B&&!K)i.push({type:"input-missing-label",element:t[0].substring(0,100),message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})}t=c.exec(e)}let a=/<h([1-6])[^>]*>/gi,g=[];t=a.exec(e);while(t!==null)g.push(Number.parseInt(t[1],10)),t=a.exec(e);let p=0;for(let d of g){if(p>0&&d>p+1)i.push({type:"heading-skip",element:`<h${d}>`,message:`Heading level skipped from h${p} to h${d}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});p=d}if(/<html\b/i.test(e)&&!/<html[^>]*\slang\s*=/i.test(e))i.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});let f=e.match(/<html\b([^>]*)>/i);if(f&&_(I(f[1],"lang"),I(f[1],"dir")))i.push({type:"missing-dir",element:f[0].substring(0,100),message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});let m=/<table([^>]*)>([\s\S]*?)<\/table>/gi;t=m.exec(e);while(t!==null){let d=t[2];if(!V(I(t[1],"role"))&&!/<th\b/i.test(d))i.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});t=m.exec(e)}let w=/<(video|audio)[^>]*\sautoplay\s[^>]*>/gi;t=w.exec(e);while(t!==null){if(!/\bmuted\b/i.test(t[0]))i.push({type:"autoplay-audio",element:`<${t[1]}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"});t=w.exec(e)}let h=/\btabindex\s*=\s*["']([1-9]\d*)["']/gi;t=h.exec(e);while(t!==null)i.push({type:"positive-tabindex",element:`tabindex="${t[1]}"`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"}),t=h.exec(e);let b=/<iframe\s+([^>]*)>/gi;t=b.exec(e);while(t!==null){let d=t[1];if(!/\btitle\s*=/i.test(d)&&!/\baria-label\s*=/i.test(d))i.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"});t=b.exec(e)}let y=/<([a-z]+)\s+([^>]*role\s*=\s*["']button["'][^>]*)>/gi;t=y.exec(e);while(t!==null){let d=t[1].toLowerCase(),x=t[2];if(d!=="button"&&!/\btabindex\s*=/i.test(x))i.push({type:"button-not-focusable",element:t[0].substring(0,100),message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"});t=y.exec(e)}return i}async function Ae(e,s){let{protectedSource:i}=xe(e);if(!ye())return we(i,s);let r=[];try{let t=globalThis.document.createElement("div");t.innerHTML=i,t.querySelectorAll("img").forEach((a)=>{if(!a.hasAttribute("alt"))r.push({type:"missing-alt",element:`<${a.outerHTML}>`,message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"})}),t.querySelectorAll('button, a, [role="button"]').forEach((a)=>{if(!(a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby")||a.textContent&&a.textContent.trim().length>0))r.push({type:"missing-accessible-name",element:`<${a.outerHTML}>`,message:"Interactive element missing accessible name",impact:"critical",help:"Add text content, aria-label, or aria-labelledby",helpUrl:"https://web.dev/learn/accessibility/aria-html/"})}),t.querySelectorAll("input, select, textarea").forEach((a)=>{let g=a.getAttribute("id"),p=g&&t.querySelector(`label[for="${g}"]`),f=a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby"),m=a.closest("label")!==null;if(!p&&!f&&!m)r.push({type:"input-missing-label",element:`<${a.outerHTML}>`,message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})});let o=Array.from(t.querySelectorAll("h1, h2, h3, h4, h5, h6")),l=0;for(let a of o){let g=Number.parseInt(a.tagName.charAt(1));if(l>0&&g>l+1)r.push({type:"heading-skip",element:`<${a.outerHTML}>`,message:`Heading level skipped from h${l} to h${g}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});l=g}let c=t.querySelector("html");if(i.includes("<html")&&c&&!c.hasAttribute("lang"))r.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});if(c&&_(c.getAttribute("lang"),c.getAttribute("dir")))r.push({type:"missing-dir",element:"<html>",message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});if(t.querySelectorAll("a").forEach((a)=>{let g=a.textContent&&a.textContent.trim().length>0,p=a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby"),f=a.hasAttribute("title"),m=a.querySelector("img[alt]");if(!g&&!p&&!f&&!m)r.push({type:"link-missing-text",element:`<${a.outerHTML}>`,message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"})}),i.includes("<nav")||i.includes("<header")){if(!t.querySelector('a[href="#main"], a[href="#content"], .skip-link, [class*="skip"]')&&t.querySelectorAll("a").length>5)r.push({type:"missing-skip-link",element:"<nav>",message:"Consider adding a skip navigation link",impact:"minor",help:"Add a skip link to allow keyboard users to bypass navigation",helpUrl:"https://web.dev/learn/accessibility/focus/#skip-links"})}if(t.querySelectorAll("table").forEach((a)=>{if(V(a.getAttribute("role")))return;let g=a.querySelector("caption");if(!a.querySelector("th"))r.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});if(!g&&!a.hasAttribute("aria-label")&&!a.hasAttribute("aria-labelledby"))r.push({type:"table-missing-caption",element:"<table>",message:"Table missing caption or accessible name",impact:"minor",help:"Add a caption element or aria-label to describe the table",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"})}),t.querySelectorAll('[style*="color"]').forEach((a)=>{let g=a.getAttribute("style")||"";if(g.includes("color:")&&!g.includes("background"))r.push({type:"potential-contrast-issue",element:`<${a.tagName.toLowerCase()}>`,message:"Element has inline color style - verify contrast ratio",impact:"minor",help:"Ensure text has sufficient contrast ratio (4.5:1 for normal text)",helpUrl:"https://web.dev/learn/accessibility/color-contrast/"})}),t.querySelectorAll("video[autoplay], audio[autoplay]").forEach((a)=>{if(!a.hasAttribute("muted"))r.push({type:"autoplay-audio",element:`<${a.tagName.toLowerCase()}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"})}),t.querySelectorAll("[tabindex]").forEach((a)=>{if(Number.parseInt(a.getAttribute("tabindex")||"0")>0)r.push({type:"positive-tabindex",element:`<${a.tagName.toLowerCase()}>`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"})}),t.querySelectorAll('[role="button"]').forEach((a)=>{if(!a.hasAttribute("tabindex"))r.push({type:"button-not-focusable",element:`<${a.outerHTML}>`,message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"})}),i.includes("<body")&&!t.querySelector('main, [role="main"]'))r.push({type:"missing-main-landmark",element:"<body>",message:"Document missing main landmark region",impact:"moderate",help:"Add a main element to identify the primary content",helpUrl:"https://web.dev/learn/accessibility/structure/#landmarks"});t.querySelectorAll("iframe").forEach((a)=>{if(!a.hasAttribute("title")&&!a.hasAttribute("aria-label"))r.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"})})}catch(t){console.error(`Error checking accessibility in ${s}:`,t)}return r}async function Xc(e,s={}){let i={},{recursive:r=!0,ignorePaths:t=[]}=s,o=Array.isArray(e)?e:[e],l=await xi(o,{recursive:r,ignorePaths:t}),c=[];for(let a of l)try{let g=await Bun.file(a).text();if(a.endsWith("good-a11y.stx"))continue;let p=await Ae(g,a);if(c.push(a),p.length>0)i[a]=p}catch(g){console.error(`Error scanning ${a}:`,g)}return{results:i,scannedFiles:c}}var Gc={name:"a11y",handler:(e,s,i,r)=>{if(!s.length)return e;let t=s[0].replace(/['"]/g,""),o=s.length>1?s[1].replace(/['"]/g,""):"",c={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[t]||"Make this element accessible";return`<!-- a11y-hint: ${o||c} -->${e}`},hasEndTag:!1},Jc={name:"screenReader",handler:(e)=>`<span class="sr-only">${e}</span>`,hasEndTag:!0};
4
4
  export{qc,Kc,Xc,Gc,Jc};