@stacksjs/stx 0.2.892 → 0.2.894

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 (86) hide show
  1. package/dist/{chunk-ynw19f6q.js → chunk-0d14783x.js} +1 -1
  2. package/dist/{chunk-3bxq3nbz.js → chunk-0hfn4cek.js} +1 -1
  3. package/dist/{chunk-e3ec9c31.js → chunk-0waheg6m.js} +1 -1
  4. package/dist/{chunk-rdzt8vxa.js → chunk-0yw075t7.js} +1 -1
  5. package/dist/{chunk-6xyqhbrp.js → chunk-1a8ev0eh.js} +1 -1
  6. package/dist/{chunk-0ky8gsvf.js → chunk-1csmm3f6.js} +1 -1
  7. package/dist/{chunk-79agzry9.js → chunk-3mdg7w2d.js} +1 -1
  8. package/dist/chunk-4eyyshsq.js +2 -0
  9. package/dist/{chunk-kv5st7dx.js → chunk-4fcb8rmm.js} +1 -1
  10. package/dist/chunk-4mmy5pfh.js +2 -0
  11. package/dist/{chunk-6pzrv1fd.js → chunk-4pq32bt3.js} +1 -1
  12. package/dist/{chunk-thnna9h7.js → chunk-4s3ts344.js} +1 -1
  13. package/dist/{chunk-jf9a4vdq.js → chunk-5kfe3smn.js} +1 -1
  14. package/dist/{chunk-7x0tfpfs.js → chunk-5spnw5zr.js} +1 -1
  15. package/dist/{chunk-t8kzetfr.js → chunk-60z8rka9.js} +4 -4
  16. package/dist/{chunk-9jysje1r.js → chunk-66qt9q6e.js} +5 -5
  17. package/dist/{chunk-2gp2m4fq.js → chunk-6yy54yyp.js} +1 -1
  18. package/dist/{chunk-bnqjj9a6.js → chunk-8a71xvx1.js} +106 -106
  19. package/dist/{chunk-fyyfsjy1.js → chunk-8n5bjars.js} +1 -1
  20. package/dist/{chunk-m4h31n4w.js → chunk-8qgcvc9r.js} +1 -1
  21. package/dist/{chunk-dsdhft2k.js → chunk-ae0qvjkz.js} +1 -1
  22. package/dist/chunk-b4kbj9kq.js +2 -0
  23. package/dist/{chunk-g4zbfjd4.js → chunk-b77t5zy2.js} +1 -1
  24. package/dist/{chunk-z98d529z.js → chunk-brmmkfnq.js} +1 -1
  25. package/dist/chunk-btjhb71k.js +2 -0
  26. package/dist/{chunk-b74heqjh.js → chunk-c5q6jdm9.js} +4 -4
  27. package/dist/{chunk-6chwb38w.js → chunk-c9xg8rc2.js} +1 -1
  28. package/dist/{chunk-da5dyp40.js → chunk-cbjvabsa.js} +4 -4
  29. package/dist/{chunk-1jza82sh.js → chunk-ccecyvwf.js} +1 -1
  30. package/dist/{chunk-gdg89bp0.js → chunk-d8ptv989.js} +2 -2
  31. package/dist/chunk-dz1mkvdw.js +2 -0
  32. package/dist/chunk-dz2zehsh.js +2 -0
  33. package/dist/{chunk-2carg287.js → chunk-e9c56r58.js} +2 -2
  34. package/dist/{chunk-d8t463k9.js → chunk-eenw264a.js} +1 -1
  35. package/dist/{chunk-1hvr0kan.js → chunk-erka2w6z.js} +1 -1
  36. package/dist/{chunk-b7ps2e5m.js → chunk-gd5a11h2.js} +1 -1
  37. package/dist/{chunk-gh6skca7.js → chunk-gjqdp0zx.js} +1 -1
  38. package/dist/{chunk-d52v5808.js → chunk-hdqy5v4v.js} +1 -1
  39. package/dist/{chunk-mkpgr3cy.js → chunk-hxm31y5q.js} +1 -1
  40. package/dist/{chunk-zb6yy424.js → chunk-hxq5tsqa.js} +1 -1
  41. package/dist/{chunk-bf9363rs.js → chunk-j1mr34da.js} +1 -1
  42. package/dist/{chunk-40wq4yde.js → chunk-j5m4hy3m.js} +2 -2
  43. package/dist/{chunk-7mag1jnj.js → chunk-jjz64ac2.js} +1 -1
  44. package/dist/{chunk-5b9y6cae.js → chunk-jqnfvdx5.js} +4 -4
  45. package/dist/{chunk-q102460n.js → chunk-khaem3zq.js} +1 -1
  46. package/dist/{chunk-sqbq2q45.js → chunk-mdrdp6c4.js} +1 -1
  47. package/dist/{chunk-zteb8tdv.js → chunk-mj0dnha4.js} +1 -1
  48. package/dist/{chunk-r9m7c7nq.js → chunk-na92k4va.js} +1 -1
  49. package/dist/chunk-nqarmx3w.js +3 -0
  50. package/dist/chunk-nxjfdtc0.js +2 -0
  51. package/dist/{chunk-mrw23g6x.js → chunk-p06tqhp9.js} +1 -1
  52. package/dist/{chunk-adgwf5p0.js → chunk-pg3yatv3.js} +2 -2
  53. package/dist/{chunk-584w4x9q.js → chunk-qv4qwa61.js} +1 -1
  54. package/dist/{chunk-dd0atx19.js → chunk-s32gsz18.js} +1 -1
  55. package/dist/{chunk-0wd2h9b2.js → chunk-s9a9kda4.js} +2 -2
  56. package/dist/{chunk-8raf8qpm.js → chunk-t79khbtp.js} +1 -1
  57. package/dist/{chunk-s8kvj5v8.js → chunk-tc94atxh.js} +1 -1
  58. package/dist/{chunk-2tm29n87.js → chunk-v6ja6a65.js} +2 -2
  59. package/dist/{chunk-k4gkjabr.js → chunk-wk36dj2m.js} +1 -1
  60. package/dist/{chunk-sp65wfth.js → chunk-xdn58ea6.js} +1 -1
  61. package/dist/chunk-xv471ek2.js +2 -0
  62. package/dist/{chunk-q9pnps31.js → chunk-y54vpvy0.js} +1 -1
  63. package/dist/{chunk-b5ag687r.js → chunk-yrjm6zyh.js} +1 -1
  64. package/dist/{chunk-yjptf9na.js → chunk-z3ar05m3.js} +3 -3
  65. package/dist/cli.js +7 -7
  66. package/dist/component-library.js +10 -4
  67. package/dist/craft-entry.js +1 -1
  68. package/dist/craft.js +1 -1
  69. package/dist/native/components/primitives.d.ts +1 -0
  70. package/dist/native/runtime/craft-bridge.js +4 -3
  71. package/dist/native/runtime/craft.d.ts +8 -1
  72. package/dist/native/runtime/native-host.js +28 -15
  73. package/dist/native/runtime/navigation-chrome.d.ts +2 -2
  74. package/dist/native/runtime/navigation-chrome.js +4 -4
  75. package/dist/pwa.js +1 -1
  76. package/dist/ssg.js +2 -2
  77. package/package.json +5 -5
  78. package/dist/chunk-18vtanxc.js +0 -2
  79. package/dist/chunk-a33zxt0c.js +0 -2
  80. package/dist/chunk-gpe2qdaa.js +0 -2
  81. package/dist/chunk-gscc3cyr.js +0 -3
  82. package/dist/chunk-krdkkg1m.js +0 -2
  83. package/dist/chunk-n6rqssaf.js +0 -2
  84. package/dist/chunk-nh5pna5s.js +0 -2
  85. package/dist/chunk-ppf1dey1.js +0 -2
  86. package/dist/chunk-wpdag2gh.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{n,u}from"./chunk-ac3e6nhg.js";import{$i,s,Pn,b}from"./chunk-bnqjj9a6.js";import{ft}from"./chunk-gzc16hs8.js";import{zs,Hs}from"./chunk-qrk535j6.js";import{Gc,wi,Bs,Fs}from"./chunk-rb2zbdqd.js";import{Wc,qc}from"./chunk-mkpgr3cy.js";import{Mt}from"./chunk-bvqgq18r.js";import{_n,el,Ar,Pr}from"./chunk-zxjdfgdx.js";import{w}from"./chunk-v6gkjg5f.js";import{So}from"./chunk-ksmn19qw.js";import{c,f}from"./chunk-hxws025y.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-ac3e6nhg.js";import{$i,s,Pn,b}from"./chunk-8a71xvx1.js";import{ft}from"./chunk-gzc16hs8.js";import{zs,Hs}from"./chunk-qrk535j6.js";import{Gc,wi,Bs,Fs}from"./chunk-rb2zbdqd.js";import{Wc,qc}from"./chunk-hxm31y5q.js";import{Mt}from"./chunk-bvqgq18r.js";import{_n,el,Ar,Pr}from"./chunk-zxjdfgdx.js";import{w}from"./chunk-v6gkjg5f.js";import{So}from"./chunk-ksmn19qw.js";import{c,f}from"./chunk-hxws025y.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:_n,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"},Wc,qc,zs,Hs,Ae,Re,Ee,_e,Oe,Te,Ue,De,...So],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 bg(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(el(e.stateDir),e.stateDir=Ar(),e.cachePath=Pr(e.cachePath),e.build)e.build.cacheDir=Pr(e.build.cacheDir);if(e.media?.cache)e.media.cache.directory=Pr(e.media.cache.directory);if(e.story)e.story.outDir=Pr(e.story.outDir)}var Y=null,Z=new Map,me=new Map,ae=null;async function yi(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 zc(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!==Bs(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-3bxq3nbz.js"),{partialsCache:m}=await import("./chunk-z98d529z.js");if(d(),m.clear(),l&&i.configSignature===Fs(i.graph)){let p=l.then(async(g)=>{let y={...i.graph};await wi(y,t),me.set(t,{graph:y,signature:Bs(y),configSignature:Fs(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 yi({name:"ui",cwd:z.join(t,"config"),defaultConfig:q,errorPolicy:"throw",verbose:!1});p=(await yi({name:"stx",alias:"ui",cwd:t,defaultConfig:v.config,errorPolicy:"throw",verbose:!1})).config}else p=(await yi({name:"stx",alias:"ui",cwd:t,defaultConfig:q,errorPolicy:"throw",verbose:!1})).config;if(p.extends!==void 0||i){let v=await Gc(t,q);p=v.config,me.set(t,{graph:v.graph,signature:Bs(v.graph),configSignature:Fs(v.graph)})}if(p.runtimeConfig){let{resolveRuntimeConfig:v}=await import("./chunk-jhbz5w30.js");v(p.runtimeConfig,{});let{generateRuntimeConfigTypes:x}=await import("./chunk-0ky8gsvf.js");await x(t,p.runtimeConfig)}Zt(p),Qt(p),bg(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{zc(x,t),g.push(x)}catch{}}let h=[...p.plugins??[],...g];if(h.length>0){let{pluginManager:v}=await import("./chunk-1z6pqvmf.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=zc(_,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=$i(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:_n,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"},Wc,qc,zs,Hs,Ae,Re,Ee,_e,Oe,Te,Ue,De,...So],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 bg(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(el(e.stateDir),e.stateDir=Ar(),e.cachePath=Pr(e.cachePath),e.build)e.build.cacheDir=Pr(e.build.cacheDir);if(e.media?.cache)e.media.cache.directory=Pr(e.media.cache.directory);if(e.story)e.story.outDir=Pr(e.story.outDir)}var Y=null,Z=new Map,me=new Map,ae=null;async function yi(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 zc(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!==Bs(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-0hfn4cek.js"),{partialsCache:m}=await import("./chunk-brmmkfnq.js");if(d(),m.clear(),l&&i.configSignature===Fs(i.graph)){let p=l.then(async(g)=>{let y={...i.graph};await wi(y,t),me.set(t,{graph:y,signature:Bs(y),configSignature:Fs(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 yi({name:"ui",cwd:z.join(t,"config"),defaultConfig:q,errorPolicy:"throw",verbose:!1});p=(await yi({name:"stx",alias:"ui",cwd:t,defaultConfig:v.config,errorPolicy:"throw",verbose:!1})).config}else p=(await yi({name:"stx",alias:"ui",cwd:t,defaultConfig:q,errorPolicy:"throw",verbose:!1})).config;if(p.extends!==void 0||i){let v=await Gc(t,q);p=v.config,me.set(t,{graph:v.graph,signature:Bs(v.graph),configSignature:Fs(v.graph)})}if(p.runtimeConfig){let{resolveRuntimeConfig:v}=await import("./chunk-jhbz5w30.js");v(p.runtimeConfig,{});let{generateRuntimeConfigTypes:x}=await import("./chunk-1csmm3f6.js");await x(t,p.runtimeConfig)}Zt(p),Qt(p),bg(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{zc(x,t),g.push(x)}catch{}}let h=[...p.plugins??[],...g];if(h.length>0){let{pluginManager:v}=await import("./chunk-1z6pqvmf.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=zc(_,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=$i(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:Ls(),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 vy(e){return e}function xy(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{jc,Bc,Er,dt,Fc,Ls,js,q,bg,yi,zc,a,j,vy,xy};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{hu,qm,yu,bu,Km,Gm}from"./chunk-d52v5808.js";import"./chunk-bnqjj9a6.js";import"./chunk-m4h31n4w.js";import"./chunk-41z7f41b.js";import"./chunk-ac3e6nhg.js";import"./chunk-vk2jy6mn.js";import"./chunk-3b3mkgpj.js";import"./chunk-0jdz31q1.js";import"./chunk-x9036mfd.js";export{Gm as applySlots,Km as extractSlotContent,qm as parseSlotElement,hu as parseSlots,bu as processSlots,yu as renderSlot};
2
+ import{hu,qm,yu,bu,Km,Gm}from"./chunk-hdqy5v4v.js";import"./chunk-8a71xvx1.js";import"./chunk-8qgcvc9r.js";import"./chunk-41z7f41b.js";import"./chunk-ac3e6nhg.js";import"./chunk-vk2jy6mn.js";import"./chunk-3b3mkgpj.js";import"./chunk-0jdz31q1.js";import"./chunk-x9036mfd.js";export{Gm as applySlots,Km as extractSlotContent,qm as parseSlotElement,hu as parseSlots,bu as processSlots,yu as renderSlot};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Pa,Rm,Mo,Am,pu,fu,Pm,Im}from"./chunk-s8kvj5v8.js";import"./chunk-584w4x9q.js";import"./chunk-thnna9h7.js";import"./chunk-sqbq2q45.js";import"./chunk-115bb91s.js";import"./chunk-0wd2h9b2.js";import"./chunk-t8kzetfr.js";import"./chunk-n64zbwzr.js";import"./chunk-n6q1d66k.js";import"./chunk-2carg287.js";import"./chunk-mkpgr3cy.js";import"./chunk-q0y8gv18.js";import"./chunk-rb2zbdqd.js";import"./chunk-qrk535j6.js";import"./chunk-gzc16hs8.js";import{_e,no}from"./chunk-bnqjj9a6.js";import"./chunk-m4h31n4w.js";import"./chunk-41z7f41b.js";import"./chunk-ac3e6nhg.js";import"./chunk-vk2jy6mn.js";import"./chunk-3b3mkgpj.js";import"./chunk-0jdz31q1.js";import"./chunk-x9036mfd.js";export{Pa as buildScriptVirtualFile,Rm as buildVirtualSource,_e as extractScriptBlocks,no as extractTemplateExpressions,pu as findRuntimeTypeDeclarations,fu as findStxModuleDeclarations,Im as formatTypecheckDiagnostics,Am as sourcePathFor,Pm as typecheckStxFiles,Mo as virtualPathFor};
2
+ import{Pa,Rm,Mo,Am,pu,fu,Pm,Im}from"./chunk-tc94atxh.js";import"./chunk-qv4qwa61.js";import"./chunk-4s3ts344.js";import"./chunk-mdrdp6c4.js";import"./chunk-115bb91s.js";import"./chunk-s9a9kda4.js";import"./chunk-60z8rka9.js";import"./chunk-n64zbwzr.js";import"./chunk-n6q1d66k.js";import"./chunk-e9c56r58.js";import"./chunk-hxm31y5q.js";import"./chunk-q0y8gv18.js";import"./chunk-rb2zbdqd.js";import"./chunk-qrk535j6.js";import"./chunk-gzc16hs8.js";import{_e,no}from"./chunk-8a71xvx1.js";import"./chunk-8qgcvc9r.js";import"./chunk-41z7f41b.js";import"./chunk-ac3e6nhg.js";import"./chunk-vk2jy6mn.js";import"./chunk-3b3mkgpj.js";import"./chunk-0jdz31q1.js";import"./chunk-x9036mfd.js";export{Pa as buildScriptVirtualFile,Rm as buildVirtualSource,_e as extractScriptBlocks,no as extractTemplateExpressions,pu as findRuntimeTypeDeclarations,fu as findStxModuleDeclarations,Im as formatTypecheckDiagnostics,Am as sourcePathFor,Pm as typecheckStxFiles,Mo as virtualPathFor};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Rs,dg,ai,pg}from"./chunk-zteb8tdv.js";import"./chunk-xvprhdcb.js";import"./chunk-0wd2h9b2.js";import"./chunk-t8kzetfr.js";import"./chunk-n64zbwzr.js";import"./chunk-2carg287.js";import"./chunk-mkpgr3cy.js";import"./chunk-q0y8gv18.js";import"./chunk-rb2zbdqd.js";import"./chunk-qrk535j6.js";import"./chunk-gzc16hs8.js";import{Wt}from"./chunk-bnqjj9a6.js";import"./chunk-m4h31n4w.js";import"./chunk-41z7f41b.js";import"./chunk-ac3e6nhg.js";import"./chunk-vk2jy6mn.js";import"./chunk-3b3mkgpj.js";import"./chunk-0jdz31q1.js";import"./chunk-x9036mfd.js";export{pg as declareBareLoopHead,Wt as parseLoopBinding,dg as processLoops,ai as processLoopsAsync,Rs as reportDeferredLoopWarnings};
2
+ import{Rs,dg,ai,pg}from"./chunk-mj0dnha4.js";import"./chunk-xvprhdcb.js";import"./chunk-s9a9kda4.js";import"./chunk-60z8rka9.js";import"./chunk-n64zbwzr.js";import"./chunk-e9c56r58.js";import"./chunk-hxm31y5q.js";import"./chunk-q0y8gv18.js";import"./chunk-rb2zbdqd.js";import"./chunk-qrk535j6.js";import"./chunk-gzc16hs8.js";import{Wt}from"./chunk-8a71xvx1.js";import"./chunk-8qgcvc9r.js";import"./chunk-41z7f41b.js";import"./chunk-ac3e6nhg.js";import"./chunk-vk2jy6mn.js";import"./chunk-3b3mkgpj.js";import"./chunk-0jdz31q1.js";import"./chunk-x9036mfd.js";export{pg as declareBareLoopHead,Wt as parseLoopBinding,dg as processLoops,ai as processLoopsAsync,Rs as reportDeferredLoopWarnings};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{vn,Yo,Zo,Qo,ny,ei}from"./chunk-sqbq2q45.js";import"./chunk-rb2zbdqd.js";import"./chunk-gzc16hs8.js";import"./chunk-41z7f41b.js";export{Zo as buildServerApi,ny as createServerApi,vn as discoverServerApi,Yo as generateApiTypes,ei as isServerApiSource,Qo as productionApiDispatcher};
2
+ import{vn,Yo,Zo,Qo,ny,ei}from"./chunk-mdrdp6c4.js";import"./chunk-rb2zbdqd.js";import"./chunk-gzc16hs8.js";import"./chunk-41z7f41b.js";export{Zo as buildServerApi,ny as createServerApi,vn as discoverServerApi,Yo as generateApiTypes,ei as isServerApiSource,Qo as productionApiDispatcher};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{m,p}from"./chunk-ac3e6nhg.js";import{oe,F,g}from"./chunk-bnqjj9a6.js";function z(t,o){let i=1,r=o,e="<template",n="</template";while(r<t.length&&i>0){let s=t.indexOf("<",r);if(s===-1)break;if(r=s,t.startsWith(e,r)&&(r+e.length>=t.length||/[\s>\/]/.test(t[r+e.length]))){i++,r+=e.length;continue}if(t.startsWith(n,r)){let a=t.indexOf(">",r+n.length);if(a!==-1){if(i--,i===0)return a+1;r=a+1;continue}}r++}return i===0?r:-1}var N=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function k(t,o){let i=null;for(let r=o;r<t.length;r++){let e=t[r];if(i){if(e==="\\"){r++;continue}if(e===i)i=null;continue}if(e==='"'||e==="'"){i=e;continue}if(e===">")return r+1}return-1}function B(t,o,i){let r=o.toLowerCase(),e=1,n=i;while(n<t.length){let s=t.indexOf("<",n);if(s===-1)return-1;if(t.startsWith("<!--",s)){let f=t.indexOf("-->",s+4);n=f===-1?t.length:f+3;continue}let a=k(t,s+1);if(a===-1)return-1;let u=t.slice(s,a),c=u.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(c&&c[2].toLowerCase()===r){if(c[1]==="/"){if(e--,e===0)return a}else if(!/\/\s*>$/.test(u))e++}n=a}return-1}function Z(t){let o=[],i=[],r=/\bslot\s*=\s*(?:"([^"]+)"|'([^']+)')/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let l=t.indexOf("-->",n+4);e=l===-1?t.length:l+3;continue}let s=k(t,n+1);if(s===-1)break;let a=t.slice(n,s),u=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!u){e=s;continue}let c=u[2].toLowerCase();if(u[1]==="/"){let l=i.lastIndexOf(c);if(l!==-1)i.splice(l);e=s;continue}let f=/\/\s*>$/.test(a),d=i.length===0?a.match(r):null;if(d){let l=d[1]||d[2],h=a.replace(r,"").replace(/\s+(?=\/?>$)/,"").replace(/\s{2,}/g," "),S=f||N.has(c)?-1:B(t,c,s);if(S===-1)o.push({start:n,end:s,slotName:l,element:h}),e=s;else o.push({start:n,end:S,slotName:l,element:h+t.slice(s,S)}),e=S;continue}if(!f&&!N.has(c)){if(i.push(c),c==="script"||c==="style"){let l=t.toLowerCase().indexOf(`</${c}>`,s);if(l!==-1){e=l;continue}}}e=s}return o}function L(t){let o=[],i=[],r=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let l=t.indexOf("-->",n+4);e=l===-1?t.length:l+3;continue}let s=k(t,n+1);if(s===-1)break;let a=t.slice(n,s),u=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!u){e=s;continue}let c=u[1]==="/",f=u[2].toLowerCase();if(c){let l=i.lastIndexOf(f);if(l!==-1)i.splice(l);e=s;continue}if(f==="template"&&i.length===0){let l=a.match(r);if(l){let h=z(t,s);if(h!==-1){let S=l[1]||l[2]||l[3];o.push({start:n,end:h,slotName:S,content:t.slice(s,h-11).trim(),propsBinding:l[4]||void 0}),e=h;continue}}}if(!/\/\s*>$/.test(a)&&!N.has(f)){if(i.push(f),f==="script"||f==="style"){let l=t.toLowerCase().indexOf(`</${f}>`,s);if(l!==-1){e=l;continue}}}e=s}return o}function hu(t){let o={default:"",named:new Map},i=t,r=L(t);for(let n of r)o.named.set(n.slotName,{name:n.slotName,content:n.content,propsBinding:n.propsBinding});r.sort((n,s)=>s.start-n.start);for(let n of r)i=i.slice(0,n.start)+i.slice(n.end);let e=Z(i);for(let n of e){let s=o.named.get(n.slotName);if(s)s.content+=n.element;else o.named.set(n.slotName,{name:n.slotName,content:n.element})}for(let n=e.length-1;n>=0;n--){let s=e[n];i=i.slice(0,s.start)+i.slice(s.end)}return o.default=i.trim(),o}function qm(t){let o=t.match(/name\s*=\s*["']([^"']+)["']/),i=o?o[1]:"",r={},e=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,n;while((n=e.exec(t))!==null)r[n[1]]=n[2];let s=t.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),a=s?s[1].trim():"";return{name:i,props:r,defaultContent:a}}async function yu(t,o,i,r){if(!t)return i;let e=t.content;if(t.propsBinding&&Object.keys(o).length>0){let n=t.propsBinding.trim(),s={...r},a=new Set,u=new Set;if(n.startsWith("{")&&n.endsWith("}")){let c=n.slice(1,-1).split(",").map((f)=>f.trim()).filter(Boolean);for(let f of c){let[d,l]=f.split(":").map((S)=>S.trim()),h=l||d;if(s[h]=o[d],o[d]!==void 0)u.add(h);else a.add(h)}}else if(s[n]=o,Object.values(o).some((c)=>c===void 0))a.add(n);else u.add(n);e=j(e,s,a,u)}return e}function j(t,o,i,r){return t.replace(/\{\{\s*([^}]+)\s*\}\}/g,(e,n)=>{try{let s=n.trim();if(F(s,i))return e;if(Array.isArray(o.__stx_preserved_client_expressions)&&o.__stx_preserved_client_expressions.includes(s)&&!F(s,r))return e;let a=_(s,o);if(a===void 0)return e;return g(String(a??""))}catch{return`{{ ${n} }}`}})}function _(t,o){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(t)){let r=t.split("."),e=o;for(let n of r)if(e&&typeof e==="object"&&n in e)e=e[n];else return;return e}let i=t.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(i){let[,r,e,n]=i,s=o[r],a=parseInt(n,10);if(typeof s==="number")switch(e){case"+":return s+a;case"-":return s-a;case"*":return s*a;case"/":return s/a}}try{if(!m(t))return;return p(t,Object.keys(o))(...Object.values(o))}catch{return}}async function bu(t,o,i,r){let e=t;e=await I(e,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(a,u,c,f)=>{let d=o.named.get(u),l=f?.trim()||"",h=c||"",S={},E=[],C=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,b;while((b=C.exec(h))!==null){let w=b[1],x=b[2];S[w]=_(x,i),E.push([w,x])}if(r!==void 0&&d?.propsBinding&&Object.values(S).some((w)=>w===void 0)){let w=d.propsBinding.trim(),x=oe(`${w} in []`),y="__stx_slot_props";while(x.includes(y))y+="_";let M=E.map(([A,P])=>{let O=S[A],R;try{R=O===void 0?void 0:JSON.stringify(O)}catch{}return`${JSON.stringify(A)}:(${R??P})`}).join(","),v=g(JSON.stringify({binding:w,names:x,owner:r}));return`<template :for="${g(`${y} in [{${M}}]`)}" data-stx-slot-binding="${encodeURIComponent(w)}" data-stx-slot-scope="${v}">${d.content}</template>`}return await yu(d,S,l,i)});let s=/<slot\b((?:"[^"]*"|'[^']*'|[^>"'])*?)\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return e=e.replace(s,(a,u,c)=>{if(/\bname\s*=/.test(u||""))return a;let f=c?.trim()||"";return o.default||f}),e}async function I(t,o,i){let r=[],e=[];t.replace(o,(a,...u)=>{let c=u[u.length-2];return e.push({match:a,index:c}),r.push(i(a,...u.slice(0,-2))),a});let n=await Promise.all(r),s=t;for(let a=e.length-1;a>=0;a--){let{match:u,index:c}=e[a];s=s.slice(0,c)+n[a]+s.slice(c+u.length)}return s}function Km(t){let o=hu(t);return{defaultSlot:o.default,namedSlots:o.named}}async function Gm(t,o,i,r,e){return await bu(t,{default:o,named:i},r,e)}
2
+ import{m,p}from"./chunk-ac3e6nhg.js";import{oe,F,g}from"./chunk-8a71xvx1.js";function z(t,o){let i=1,r=o,e="<template",n="</template";while(r<t.length&&i>0){let s=t.indexOf("<",r);if(s===-1)break;if(r=s,t.startsWith(e,r)&&(r+e.length>=t.length||/[\s>\/]/.test(t[r+e.length]))){i++,r+=e.length;continue}if(t.startsWith(n,r)){let a=t.indexOf(">",r+n.length);if(a!==-1){if(i--,i===0)return a+1;r=a+1;continue}}r++}return i===0?r:-1}var N=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function k(t,o){let i=null;for(let r=o;r<t.length;r++){let e=t[r];if(i){if(e==="\\"){r++;continue}if(e===i)i=null;continue}if(e==='"'||e==="'"){i=e;continue}if(e===">")return r+1}return-1}function B(t,o,i){let r=o.toLowerCase(),e=1,n=i;while(n<t.length){let s=t.indexOf("<",n);if(s===-1)return-1;if(t.startsWith("<!--",s)){let f=t.indexOf("-->",s+4);n=f===-1?t.length:f+3;continue}let a=k(t,s+1);if(a===-1)return-1;let u=t.slice(s,a),c=u.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(c&&c[2].toLowerCase()===r){if(c[1]==="/"){if(e--,e===0)return a}else if(!/\/\s*>$/.test(u))e++}n=a}return-1}function Z(t){let o=[],i=[],r=/\bslot\s*=\s*(?:"([^"]+)"|'([^']+)')/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let l=t.indexOf("-->",n+4);e=l===-1?t.length:l+3;continue}let s=k(t,n+1);if(s===-1)break;let a=t.slice(n,s),u=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!u){e=s;continue}let c=u[2].toLowerCase();if(u[1]==="/"){let l=i.lastIndexOf(c);if(l!==-1)i.splice(l);e=s;continue}let f=/\/\s*>$/.test(a),d=i.length===0?a.match(r):null;if(d){let l=d[1]||d[2],h=a.replace(r,"").replace(/\s+(?=\/?>$)/,"").replace(/\s{2,}/g," "),S=f||N.has(c)?-1:B(t,c,s);if(S===-1)o.push({start:n,end:s,slotName:l,element:h}),e=s;else o.push({start:n,end:S,slotName:l,element:h+t.slice(s,S)}),e=S;continue}if(!f&&!N.has(c)){if(i.push(c),c==="script"||c==="style"){let l=t.toLowerCase().indexOf(`</${c}>`,s);if(l!==-1){e=l;continue}}}e=s}return o}function L(t){let o=[],i=[],r=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let l=t.indexOf("-->",n+4);e=l===-1?t.length:l+3;continue}let s=k(t,n+1);if(s===-1)break;let a=t.slice(n,s),u=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!u){e=s;continue}let c=u[1]==="/",f=u[2].toLowerCase();if(c){let l=i.lastIndexOf(f);if(l!==-1)i.splice(l);e=s;continue}if(f==="template"&&i.length===0){let l=a.match(r);if(l){let h=z(t,s);if(h!==-1){let S=l[1]||l[2]||l[3];o.push({start:n,end:h,slotName:S,content:t.slice(s,h-11).trim(),propsBinding:l[4]||void 0}),e=h;continue}}}if(!/\/\s*>$/.test(a)&&!N.has(f)){if(i.push(f),f==="script"||f==="style"){let l=t.toLowerCase().indexOf(`</${f}>`,s);if(l!==-1){e=l;continue}}}e=s}return o}function hu(t){let o={default:"",named:new Map},i=t,r=L(t);for(let n of r)o.named.set(n.slotName,{name:n.slotName,content:n.content,propsBinding:n.propsBinding});r.sort((n,s)=>s.start-n.start);for(let n of r)i=i.slice(0,n.start)+i.slice(n.end);let e=Z(i);for(let n of e){let s=o.named.get(n.slotName);if(s)s.content+=n.element;else o.named.set(n.slotName,{name:n.slotName,content:n.element})}for(let n=e.length-1;n>=0;n--){let s=e[n];i=i.slice(0,s.start)+i.slice(s.end)}return o.default=i.trim(),o}function qm(t){let o=t.match(/name\s*=\s*["']([^"']+)["']/),i=o?o[1]:"",r={},e=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,n;while((n=e.exec(t))!==null)r[n[1]]=n[2];let s=t.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),a=s?s[1].trim():"";return{name:i,props:r,defaultContent:a}}async function yu(t,o,i,r){if(!t)return i;let e=t.content;if(t.propsBinding&&Object.keys(o).length>0){let n=t.propsBinding.trim(),s={...r},a=new Set,u=new Set;if(n.startsWith("{")&&n.endsWith("}")){let c=n.slice(1,-1).split(",").map((f)=>f.trim()).filter(Boolean);for(let f of c){let[d,l]=f.split(":").map((S)=>S.trim()),h=l||d;if(s[h]=o[d],o[d]!==void 0)u.add(h);else a.add(h)}}else if(s[n]=o,Object.values(o).some((c)=>c===void 0))a.add(n);else u.add(n);e=j(e,s,a,u)}return e}function j(t,o,i,r){return t.replace(/\{\{\s*([^}]+)\s*\}\}/g,(e,n)=>{try{let s=n.trim();if(F(s,i))return e;if(Array.isArray(o.__stx_preserved_client_expressions)&&o.__stx_preserved_client_expressions.includes(s)&&!F(s,r))return e;let a=_(s,o);if(a===void 0)return e;return g(String(a??""))}catch{return`{{ ${n} }}`}})}function _(t,o){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(t)){let r=t.split("."),e=o;for(let n of r)if(e&&typeof e==="object"&&n in e)e=e[n];else return;return e}let i=t.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(i){let[,r,e,n]=i,s=o[r],a=parseInt(n,10);if(typeof s==="number")switch(e){case"+":return s+a;case"-":return s-a;case"*":return s*a;case"/":return s/a}}try{if(!m(t))return;return p(t,Object.keys(o))(...Object.values(o))}catch{return}}async function bu(t,o,i,r){let e=t;e=await I(e,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(a,u,c,f)=>{let d=o.named.get(u),l=f?.trim()||"",h=c||"",S={},E=[],C=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,b;while((b=C.exec(h))!==null){let w=b[1],x=b[2];S[w]=_(x,i),E.push([w,x])}if(r!==void 0&&d?.propsBinding&&Object.values(S).some((w)=>w===void 0)){let w=d.propsBinding.trim(),x=oe(`${w} in []`),y="__stx_slot_props";while(x.includes(y))y+="_";let M=E.map(([A,P])=>{let O=S[A],R;try{R=O===void 0?void 0:JSON.stringify(O)}catch{}return`${JSON.stringify(A)}:(${R??P})`}).join(","),v=g(JSON.stringify({binding:w,names:x,owner:r}));return`<template :for="${g(`${y} in [{${M}}]`)}" data-stx-slot-binding="${encodeURIComponent(w)}" data-stx-slot-scope="${v}">${d.content}</template>`}return await yu(d,S,l,i)});let s=/<slot\b((?:"[^"]*"|'[^']*'|[^>"'])*?)\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return e=e.replace(s,(a,u,c)=>{if(/\bname\s*=/.test(u||""))return a;let f=c?.trim()||"";return o.default||f}),e}async function I(t,o,i){let r=[],e=[];t.replace(o,(a,...u)=>{let c=u[u.length-2];return e.push({match:a,index:c}),r.push(i(a,...u.slice(0,-2))),a});let n=await Promise.all(r),s=t;for(let a=e.length-1;a>=0;a--){let{match:u,index:c}=e[a];s=s.slice(0,c)+n[a]+s.slice(c+u.length)}return s}function Km(t){let o=hu(t);return{defaultSlot:o.default,namedSlots:o.named}}async function Gm(t,o,i,r,e){return await bu(t,{default:o,named:i},r,e)}
3
3
  export{hu,qm,yu,bu,Km,Gm};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{M,n,u}from"./chunk-ac3e6nhg.js";import{ae}from"./chunk-bnqjj9a6.js";import{bi}from"./chunk-q0y8gv18.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-ac3e6nhg.js";import{ae}from"./chunk-8a71xvx1.js";import{bi}from"./chunk-q0y8gv18.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 Hc(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 Uc(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 Vc(e,s={}){let i={},{recursive:r=!0,ignorePaths:t=[]}=s,o=Array.isArray(e)?e:[e],l=await bi(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 Wc={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},qc={name:"screenReader",handler:(e)=>`<span class="sr-only">${e}</span>`,hasEndTag:!0};
4
4
  export{Hc,Uc,Vc,Wc,qc};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{nl,s,Ce}from"./chunk-bnqjj9a6.js";import{gt}from"./chunk-zkwkhesc.js";import{l}from"./chunk-zxjdfgdx.js";import o from"fs";import u from"path";var mg=new Map,m=new Map;async function fy(e){let n;for(let i=0;i<3;i++)try{let g=(await o.promises.stat(e)).mtime.getTime(),a=m.get(e);if(a&&a.mtime===g)return a.content;let h=await Bun.file(e).text(),w=(await o.promises.stat(e)).mtime.getTime();if(w!==g)continue;return m.set(e,{content:h,mtime:w}),h}catch(r){n=r;break}throw m.delete(e),Error(`File not found: ${e}${n?` (${n.message})`:""}`)}function gy(e){m.delete(e)}function my(e){for(let t of m.keys())if(t.startsWith(e))m.delete(t)}var f=null,B=null,x=null;function hy(e){x=e}async function hg(e=!1){let t=x??await import("./chunk-vm57848v.js");if(e)return t.generateSignalsRuntimeDev();if(f===null)f=t.generateSignalsRuntime();return f}var S=null;async function yg(){if(S===null){let{getRouterScript:e}=await import("./chunk-2eq3aret.js");S=e()}return S}var y={};async function yy(e,t=!1){let n=e==="runtime"?await hg(t):await yg(),i=e==="runtime"&&t?"runtime-debug":e,r=y[i];if(!r||r.content!==n)r={content:n,hash:Bun.hash(n).toString(16).padStart(16,"0").slice(0,16)},y[i]=r;return{content:n,hash:r.hash,url:`/_stx/${e}.${r.hash}.js`}}var E=500,T=33554432,c=new Map,p=0;function C(e){return l(process.cwd(),"module-bundles",`${e}.js`)}function by(e){let t=Bun.hash(e).toString(16).padStart(16,"0").slice(0,16),n=c.get(t),i=n!==void 0;if(i)c.delete(t),p-=n.length*2;c.set(t,e),p+=e.length*2;while(c.size>1&&(c.size>E||p>T)){let r=c.keys().next().value;p-=c.get(r).length*2,c.delete(r)}if(!i)try{let r=C(t);if(!o.existsSync(r))o.mkdirSync(u.dirname(r),{recursive:!0}),o.writeFileSync(r,e)}catch{}return`/_stx/modules.${t}.js`}function hi(e){if(!/^[0-9a-f]{16}$/.test(e))return;let t=c.get(e);if(t!==void 0)return t;try{return o.readFileSync(C(e),"utf8")}catch{return}}function wy(){m.clear(),Ce(),nl(),f=null,B=null,S=null}function v(e){let t={debug:e.debug===!0,middleware:(e.middleware??[]).map((n)=>({name:n.name,timing:n.timing,handler:String(n.handler)})),customDirectives:(e.customDirectives??[]).map((n)=>({name:n.name,hasEndTag:n.hasEndTag===!0,rawParams:n.rawParams===!0,handler:String(n.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(t)).digest("hex")}async function _r(e,t){try{if(!t.cachePath)return null;let n=u.resolve(t.cachePath),i=u.join(n,`${Ds(e)}.html`),r=u.join(n,`${Ds(e)}.meta.json`);if(!await s(i)||!await s(r))return null;let g=await Bun.file(r).text(),a=JSON.parse(g);if(a.cacheVersion!==t.cacheVersion)return null;if(a.engine!==gt())return null;if(a.optionsSignature!==v(t))return null;if((await o.promises.stat(e)).mtime.getTime()>a.mtime)return null;for(let d of a.dependencies)if(await s(d)){if((await o.promises.stat(d)).mtime.getTime()>a.mtime)return null}else return null;return await Bun.file(i).text()}catch(n){return console.warn(`Cache error for ${e}:`,n),null}}async function Cr(e,t,n,i){try{if(!i.cachePath)return;let r=u.resolve(i.cachePath);await o.promises.mkdir(r,{recursive:!0});let g=u.join(r,`${Ds(e)}.html`),a=u.join(r,`${Ds(e)}.meta.json`),h=await o.promises.stat(e);await Bun.write(g,t);let d={sourcePath:e,mtime:h.mtime.getTime(),dependencies:Array.from(n),cacheVersion:i.cacheVersion,engine:gt(),optionsSignature:v(i),generatedAt:Date.now()};await Bun.write(a,JSON.stringify(d,null,2)),mg.set(e,{output:t,mtime:h.mtime.getTime(),dependencies:n})}catch(r){console.warn(`Failed to cache template ${e}:`,r)}}var _=16;function Ds(e){return new Bun.CryptoHasher("sha1").update(e).digest("hex").substring(0,_)}
2
+ import{nl,s,Ce}from"./chunk-8a71xvx1.js";import{gt}from"./chunk-zkwkhesc.js";import{l}from"./chunk-zxjdfgdx.js";import o from"fs";import u from"path";var mg=new Map,m=new Map;async function fy(e){let n;for(let i=0;i<3;i++)try{let g=(await o.promises.stat(e)).mtime.getTime(),a=m.get(e);if(a&&a.mtime===g)return a.content;let h=await Bun.file(e).text(),w=(await o.promises.stat(e)).mtime.getTime();if(w!==g)continue;return m.set(e,{content:h,mtime:w}),h}catch(r){n=r;break}throw m.delete(e),Error(`File not found: ${e}${n?` (${n.message})`:""}`)}function gy(e){m.delete(e)}function my(e){for(let t of m.keys())if(t.startsWith(e))m.delete(t)}var f=null,B=null,x=null;function hy(e){x=e}async function hg(e=!1){let t=x??await import("./chunk-vm57848v.js");if(e)return t.generateSignalsRuntimeDev();if(f===null)f=t.generateSignalsRuntime();return f}var S=null;async function yg(){if(S===null){let{getRouterScript:e}=await import("./chunk-2eq3aret.js");S=e()}return S}var y={};async function yy(e,t=!1){let n=e==="runtime"?await hg(t):await yg(),i=e==="runtime"&&t?"runtime-debug":e,r=y[i];if(!r||r.content!==n)r={content:n,hash:Bun.hash(n).toString(16).padStart(16,"0").slice(0,16)},y[i]=r;return{content:n,hash:r.hash,url:`/_stx/${e}.${r.hash}.js`}}var E=500,T=33554432,c=new Map,p=0;function C(e){return l(process.cwd(),"module-bundles",`${e}.js`)}function by(e){let t=Bun.hash(e).toString(16).padStart(16,"0").slice(0,16),n=c.get(t),i=n!==void 0;if(i)c.delete(t),p-=n.length*2;c.set(t,e),p+=e.length*2;while(c.size>1&&(c.size>E||p>T)){let r=c.keys().next().value;p-=c.get(r).length*2,c.delete(r)}if(!i)try{let r=C(t);if(!o.existsSync(r))o.mkdirSync(u.dirname(r),{recursive:!0}),o.writeFileSync(r,e)}catch{}return`/_stx/modules.${t}.js`}function hi(e){if(!/^[0-9a-f]{16}$/.test(e))return;let t=c.get(e);if(t!==void 0)return t;try{return o.readFileSync(C(e),"utf8")}catch{return}}function wy(){m.clear(),Ce(),nl(),f=null,B=null,S=null}function v(e){let t={debug:e.debug===!0,middleware:(e.middleware??[]).map((n)=>({name:n.name,timing:n.timing,handler:String(n.handler)})),customDirectives:(e.customDirectives??[]).map((n)=>({name:n.name,hasEndTag:n.hasEndTag===!0,rawParams:n.rawParams===!0,handler:String(n.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(t)).digest("hex")}async function _r(e,t){try{if(!t.cachePath)return null;let n=u.resolve(t.cachePath),i=u.join(n,`${Ds(e)}.html`),r=u.join(n,`${Ds(e)}.meta.json`);if(!await s(i)||!await s(r))return null;let g=await Bun.file(r).text(),a=JSON.parse(g);if(a.cacheVersion!==t.cacheVersion)return null;if(a.engine!==gt())return null;if(a.optionsSignature!==v(t))return null;if((await o.promises.stat(e)).mtime.getTime()>a.mtime)return null;for(let d of a.dependencies)if(await s(d)){if((await o.promises.stat(d)).mtime.getTime()>a.mtime)return null}else return null;return await Bun.file(i).text()}catch(n){return console.warn(`Cache error for ${e}:`,n),null}}async function Cr(e,t,n,i){try{if(!i.cachePath)return;let r=u.resolve(i.cachePath);await o.promises.mkdir(r,{recursive:!0});let g=u.join(r,`${Ds(e)}.html`),a=u.join(r,`${Ds(e)}.meta.json`),h=await o.promises.stat(e);await Bun.write(g,t);let d={sourcePath:e,mtime:h.mtime.getTime(),dependencies:Array.from(n),cacheVersion:i.cacheVersion,engine:gt(),optionsSignature:v(i),generatedAt:Date.now()};await Bun.write(a,JSON.stringify(d,null,2)),mg.set(e,{output:t,mtime:h.mtime.getTime(),dependencies:n})}catch(r){console.warn(`Failed to cache template ${e}:`,r)}}var _=16;function Ds(e){return new Bun.CryptoHasher("sha1").update(e).digest("hex").substring(0,_)}
3
3
  export{mg,fy,gy,my,hy,hg,yg,yy,by,hi,wy,_r,Cr,Ds};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{mg,fy,gy,my,hy,hg,yg,yy,by,hi,wy,_r,Cr,Ds}from"./chunk-zb6yy424.js";import{gt}from"./chunk-zkwkhesc.js";import"./chunk-bnqjj9a6.js";import"./chunk-m4h31n4w.js";import"./chunk-41z7f41b.js";import"./chunk-ac3e6nhg.js";import"./chunk-vk2jy6mn.js";import"./chunk-3b3mkgpj.js";import"./chunk-0jdz31q1.js";import"./chunk-x9036mfd.js";export{hy as __setSignalsGeneratorsForTest,gt as cacheEngineFingerprint,Cr as cacheTemplate,_r as checkCache,wy as clearDevCaches,yg as getCachedRouterScript,hg as getCachedSignalsRuntime,yy as getServeClientAsset,hi as getServeModuleBundle,Ds as hashFilePath,gy as invalidateFileCache,my as invalidateFileCacheByDir,fy as readFileCached,by as registerServeModuleBundle,mg as templateCache};
2
+ import{mg,fy,gy,my,hy,hg,yg,yy,by,hi,wy,_r,Cr,Ds}from"./chunk-hxq5tsqa.js";import{gt}from"./chunk-zkwkhesc.js";import"./chunk-8a71xvx1.js";import"./chunk-8qgcvc9r.js";import"./chunk-41z7f41b.js";import"./chunk-ac3e6nhg.js";import"./chunk-vk2jy6mn.js";import"./chunk-3b3mkgpj.js";import"./chunk-0jdz31q1.js";import"./chunk-x9036mfd.js";export{hy as __setSignalsGeneratorsForTest,gt as cacheEngineFingerprint,Cr as cacheTemplate,_r as checkCache,wy as clearDevCaches,yg as getCachedRouterScript,hg as getCachedSignalsRuntime,yy as getServeClientAsset,hi as getServeModuleBundle,Ds as hashFilePath,gy as invalidateFileCache,my as invalidateFileCacheByDir,fy as readFileCached,by as registerServeModuleBundle,mg as templateCache};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{kt,_t,Ct}from"./chunk-pwpge9bj.js";import"./chunk-x9036mfd.js";import"./chunk-vk2jy6mn.js";import"./chunk-0jdz31q1.js";import"./chunk-3b3mkgpj.js";import{y}from"./chunk-bnqjj9a6.js";import"./chunk-ac3e6nhg.js";import"./chunk-41z7f41b.js";import"./chunk-m4h31n4w.js";import{nn,ko,rn,ha,St,ya,_o,sn,wa,on}from"./chunk-g5nfqzfh.js";import M from"fs";import x from"path";function E(t,e){let r=[x.join(t.root,"stx.config.ts"),x.join(t.root,"stx.config.js"),x.join(t.root,"stx.config.mjs")],s=e.debounceMs??300,o=null,a=[];for(let c of r)try{if(!M.existsSync(c))continue;let n=M.watch(c,(d)=>{if(d==="change"){if(o)clearTimeout(o);o=setTimeout(async()=>{ya("Config file changed, restarting...");try{await e.onChange()}catch(p){St(`Failed to restart: ${p}`)}},s)}});a.push(n)}catch{}return{stop(){if(o)clearTimeout(o);for(let c of a)c.close()}}}import w from"fs";import j from"path";var nt=".stx/story/analytics.json",st=1,A=1e4;class k{storage;storagePath;currentSession=null;dirty=!1;viewStartTimes=new Map;constructor(t){this.storagePath=j.join(t,nt),this.storage=this.loadStorage(),this.startSession()}loadStorage(){try{let t=w.readFileSync(this.storagePath,"utf-8");return JSON.parse(t)}catch{return{version:st,events:[],sessions:[]}}}async save(){if(!this.dirty)return;let t=j.dirname(this.storagePath);if(await w.promises.mkdir(t,{recursive:!0}),this.storage.events.length>A)this.storage.events=this.storage.events.slice(-A);await w.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}startSession(){this.endSession(),this.currentSession={id:at(),startTime:Date.now(),componentViews:[]},this.storage.sessions.push(this.currentSession),this.dirty=!0}endSession(){if(this.currentSession)this.currentSession.endTime=Date.now(),this.currentSession=null}track(t){this.storage.events.push({...t,timestamp:Date.now()}),this.dirty=!0}trackView(t,e){if(this.endViewTiming(t),this.viewStartTimes.set(t,Date.now()),this.track({type:"view",componentId:t,variantId:e}),this.currentSession&&!this.currentSession.componentViews.includes(t))this.currentSession.componentViews.push(t)}endViewTiming(t){let e=this.viewStartTimes.get(t);if(e){let r=Date.now()-e;this.track({type:"view",componentId:t,metadata:{duration:r,endView:!0}}),this.viewStartTimes.delete(t)}}trackPropChange(t,e,r){this.track({type:"prop_change",componentId:t,propName:e,metadata:{value:r}})}trackVariantSwitch(t,e){this.track({type:"variant_switch",componentId:t,variantId:e})}trackSearch(t,e){this.track({type:"search",query:t,metadata:{resultCount:e}})}getComponentAnalytics(t,e){let r=this.storage.events.filter((i)=>i.componentId===t),s=r.filter((i)=>i.type==="view"&&!i.metadata?.endView),o=r.filter((i)=>i.type==="prop_change"),a=r.filter((i)=>i.type==="variant_switch"),c={};for(let i of o)if(i.propName)c[i.propName]=(c[i.propName]||0)+1;let n={};for(let i of a)if(i.variantId)n[i.variantId]=(n[i.variantId]||0)+1;let d=new Set(this.storage.sessions.filter((i)=>i.componentViews.includes(t)).map((i)=>i.id)),p=r.filter((i)=>i.metadata?.duration).map((i)=>i.metadata.duration),u=p.length>0?p.reduce((i,l)=>i+l,0)/p.length:0,f=Object.entries(c).sort((i,l)=>l[1]-i[1]).slice(0,5).map(([i])=>i);return{componentId:t,componentName:e,viewCount:s.length,uniqueViews:d.size,lastViewed:s[s.length-1]?.timestamp,propChanges:c,topChangedProps:f,variantViews:n,avgTimeSpent:u}}getMostViewedComponents(t=10){let e=new Map;for(let r of this.storage.events)if(r.type==="view"&&r.componentId&&!r.metadata?.endView)e.set(r.componentId,(e.get(r.componentId)||0)+1);return Array.from(e.entries()).map(([r,s])=>({componentId:r,viewCount:s})).sort((r,s)=>s.viewCount-r.viewCount).slice(0,t)}getMostChangedProps(t=10){let e=new Map;for(let r of this.storage.events)if(r.type==="prop_change"&&r.propName)e.set(r.propName,(e.get(r.propName)||0)+1);return Array.from(e.entries()).map(([r,s])=>({propName:r,changeCount:s})).sort((r,s)=>s.changeCount-r.changeCount).slice(0,t)}getSearchAnalytics(){let t=this.storage.events.filter((o)=>o.type==="search"),e=new Map,r=0;for(let o of t){if(o.query)e.set(o.query,(e.get(o.query)||0)+1);if(o.metadata?.resultCount!==void 0)r+=o.metadata.resultCount}let s=Array.from(e.entries()).map(([o,a])=>({query:o,count:a})).sort((o,a)=>a.count-o.count).slice(0,10);return{totalSearches:t.length,topQueries:s,avgResultCount:t.length>0?r/t.length:0}}clear(){this.storage.events=[],this.storage.sessions=[],this.dirty=!0,this.startSession()}exportAnalytics(){return JSON.stringify({exportedAt:Date.now(),...this.storage},null,2)}}function at(){return`session-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import S from"fs";import B from"path";var it=".stx/story/bookmarks.json",ct=1;class P{storage;storagePath;dirty=!1;constructor(t){this.storagePath=B.join(t,it),this.storage=this.loadStorage()}loadStorage(){try{let t=S.readFileSync(this.storagePath,"utf-8");return JSON.parse(t)}catch{return{version:ct,bookmarks:[]}}}async save(){if(!this.dirty)return;let t=B.dirname(this.storagePath);await S.promises.mkdir(t,{recursive:!0}),await S.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}addBookmark(t,e,r,s={}){let o={id:dt(),name:s.name||`${t}/${e}`,storyId:t,variantId:e,props:r,created:Date.now(),notes:s.notes,color:s.color};return this.storage.bookmarks.push(o),this.dirty=!0,o}getAllBookmarks(){return[...this.storage.bookmarks]}getBookmarksForStory(t){return this.storage.bookmarks.filter((e)=>e.storyId===t)}getBookmark(t){return this.storage.bookmarks.find((e)=>e.id===t)}isBookmarked(t,e){return this.storage.bookmarks.some((r)=>r.storyId===t&&r.variantId===e)}updateBookmark(t,e){let r=this.getBookmark(t);if(!r)return;return Object.assign(r,e),this.dirty=!0,r}deleteBookmark(t){let e=this.storage.bookmarks.findIndex((r)=>r.id===t);if(e===-1)return!1;return this.storage.bookmarks.splice(e,1),this.dirty=!0,!0}toggleBookmark(t,e,r){let s=this.storage.bookmarks.find((a)=>a.storyId===t&&a.variantId===e);if(s)return this.deleteBookmark(s.id),{added:!1};return{added:!0,bookmark:this.addBookmark(t,e,r)}}exportBookmarks(){return JSON.stringify(this.storage,null,2)}importBookmarks(t,e=!0){let r=JSON.parse(t),s=0;for(let o of r.bookmarks){if(e){let a=this.storage.bookmarks.find((c)=>c.id===o.id);if(a)Object.assign(a,o);else this.storage.bookmarks.push(o)}else this.storage.bookmarks.push(o);s++}if(s>0)this.dirty=!0;return s}}function dt(){return`bm-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}var v=new Set;function N(){return{open(t){v.add(t),t.send(JSON.stringify({type:"connected",timestamp:Date.now()}))},close(t){v.delete(t)},message(t,e){}}}function C(t){let e=JSON.stringify({...t,timestamp:t.timestamp||Date.now()});for(let r of v)try{r.send(e)}catch{v.delete(r)}}function V(t,e){C({type:"story-update",data:{storyId:t,...e}})}function H(t,e){C({type:"story-add",data:{storyId:t,...e}})}function O(t){C({type:"story-remove",data:{storyId:t}})}function F(t){return`
2
+ import{kt,_t,Ct}from"./chunk-pwpge9bj.js";import"./chunk-x9036mfd.js";import"./chunk-vk2jy6mn.js";import"./chunk-0jdz31q1.js";import"./chunk-3b3mkgpj.js";import{y}from"./chunk-8a71xvx1.js";import"./chunk-ac3e6nhg.js";import"./chunk-41z7f41b.js";import"./chunk-8qgcvc9r.js";import{nn,ko,rn,ha,St,ya,_o,sn,wa,on}from"./chunk-g5nfqzfh.js";import M from"fs";import x from"path";function E(t,e){let r=[x.join(t.root,"stx.config.ts"),x.join(t.root,"stx.config.js"),x.join(t.root,"stx.config.mjs")],s=e.debounceMs??300,o=null,a=[];for(let c of r)try{if(!M.existsSync(c))continue;let n=M.watch(c,(d)=>{if(d==="change"){if(o)clearTimeout(o);o=setTimeout(async()=>{ya("Config file changed, restarting...");try{await e.onChange()}catch(p){St(`Failed to restart: ${p}`)}},s)}});a.push(n)}catch{}return{stop(){if(o)clearTimeout(o);for(let c of a)c.close()}}}import w from"fs";import j from"path";var nt=".stx/story/analytics.json",st=1,A=1e4;class k{storage;storagePath;currentSession=null;dirty=!1;viewStartTimes=new Map;constructor(t){this.storagePath=j.join(t,nt),this.storage=this.loadStorage(),this.startSession()}loadStorage(){try{let t=w.readFileSync(this.storagePath,"utf-8");return JSON.parse(t)}catch{return{version:st,events:[],sessions:[]}}}async save(){if(!this.dirty)return;let t=j.dirname(this.storagePath);if(await w.promises.mkdir(t,{recursive:!0}),this.storage.events.length>A)this.storage.events=this.storage.events.slice(-A);await w.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}startSession(){this.endSession(),this.currentSession={id:at(),startTime:Date.now(),componentViews:[]},this.storage.sessions.push(this.currentSession),this.dirty=!0}endSession(){if(this.currentSession)this.currentSession.endTime=Date.now(),this.currentSession=null}track(t){this.storage.events.push({...t,timestamp:Date.now()}),this.dirty=!0}trackView(t,e){if(this.endViewTiming(t),this.viewStartTimes.set(t,Date.now()),this.track({type:"view",componentId:t,variantId:e}),this.currentSession&&!this.currentSession.componentViews.includes(t))this.currentSession.componentViews.push(t)}endViewTiming(t){let e=this.viewStartTimes.get(t);if(e){let r=Date.now()-e;this.track({type:"view",componentId:t,metadata:{duration:r,endView:!0}}),this.viewStartTimes.delete(t)}}trackPropChange(t,e,r){this.track({type:"prop_change",componentId:t,propName:e,metadata:{value:r}})}trackVariantSwitch(t,e){this.track({type:"variant_switch",componentId:t,variantId:e})}trackSearch(t,e){this.track({type:"search",query:t,metadata:{resultCount:e}})}getComponentAnalytics(t,e){let r=this.storage.events.filter((i)=>i.componentId===t),s=r.filter((i)=>i.type==="view"&&!i.metadata?.endView),o=r.filter((i)=>i.type==="prop_change"),a=r.filter((i)=>i.type==="variant_switch"),c={};for(let i of o)if(i.propName)c[i.propName]=(c[i.propName]||0)+1;let n={};for(let i of a)if(i.variantId)n[i.variantId]=(n[i.variantId]||0)+1;let d=new Set(this.storage.sessions.filter((i)=>i.componentViews.includes(t)).map((i)=>i.id)),p=r.filter((i)=>i.metadata?.duration).map((i)=>i.metadata.duration),u=p.length>0?p.reduce((i,l)=>i+l,0)/p.length:0,f=Object.entries(c).sort((i,l)=>l[1]-i[1]).slice(0,5).map(([i])=>i);return{componentId:t,componentName:e,viewCount:s.length,uniqueViews:d.size,lastViewed:s[s.length-1]?.timestamp,propChanges:c,topChangedProps:f,variantViews:n,avgTimeSpent:u}}getMostViewedComponents(t=10){let e=new Map;for(let r of this.storage.events)if(r.type==="view"&&r.componentId&&!r.metadata?.endView)e.set(r.componentId,(e.get(r.componentId)||0)+1);return Array.from(e.entries()).map(([r,s])=>({componentId:r,viewCount:s})).sort((r,s)=>s.viewCount-r.viewCount).slice(0,t)}getMostChangedProps(t=10){let e=new Map;for(let r of this.storage.events)if(r.type==="prop_change"&&r.propName)e.set(r.propName,(e.get(r.propName)||0)+1);return Array.from(e.entries()).map(([r,s])=>({propName:r,changeCount:s})).sort((r,s)=>s.changeCount-r.changeCount).slice(0,t)}getSearchAnalytics(){let t=this.storage.events.filter((o)=>o.type==="search"),e=new Map,r=0;for(let o of t){if(o.query)e.set(o.query,(e.get(o.query)||0)+1);if(o.metadata?.resultCount!==void 0)r+=o.metadata.resultCount}let s=Array.from(e.entries()).map(([o,a])=>({query:o,count:a})).sort((o,a)=>a.count-o.count).slice(0,10);return{totalSearches:t.length,topQueries:s,avgResultCount:t.length>0?r/t.length:0}}clear(){this.storage.events=[],this.storage.sessions=[],this.dirty=!0,this.startSession()}exportAnalytics(){return JSON.stringify({exportedAt:Date.now(),...this.storage},null,2)}}function at(){return`session-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import S from"fs";import B from"path";var it=".stx/story/bookmarks.json",ct=1;class P{storage;storagePath;dirty=!1;constructor(t){this.storagePath=B.join(t,it),this.storage=this.loadStorage()}loadStorage(){try{let t=S.readFileSync(this.storagePath,"utf-8");return JSON.parse(t)}catch{return{version:ct,bookmarks:[]}}}async save(){if(!this.dirty)return;let t=B.dirname(this.storagePath);await S.promises.mkdir(t,{recursive:!0}),await S.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}addBookmark(t,e,r,s={}){let o={id:dt(),name:s.name||`${t}/${e}`,storyId:t,variantId:e,props:r,created:Date.now(),notes:s.notes,color:s.color};return this.storage.bookmarks.push(o),this.dirty=!0,o}getAllBookmarks(){return[...this.storage.bookmarks]}getBookmarksForStory(t){return this.storage.bookmarks.filter((e)=>e.storyId===t)}getBookmark(t){return this.storage.bookmarks.find((e)=>e.id===t)}isBookmarked(t,e){return this.storage.bookmarks.some((r)=>r.storyId===t&&r.variantId===e)}updateBookmark(t,e){let r=this.getBookmark(t);if(!r)return;return Object.assign(r,e),this.dirty=!0,r}deleteBookmark(t){let e=this.storage.bookmarks.findIndex((r)=>r.id===t);if(e===-1)return!1;return this.storage.bookmarks.splice(e,1),this.dirty=!0,!0}toggleBookmark(t,e,r){let s=this.storage.bookmarks.find((a)=>a.storyId===t&&a.variantId===e);if(s)return this.deleteBookmark(s.id),{added:!1};return{added:!0,bookmark:this.addBookmark(t,e,r)}}exportBookmarks(){return JSON.stringify(this.storage,null,2)}importBookmarks(t,e=!0){let r=JSON.parse(t),s=0;for(let o of r.bookmarks){if(e){let a=this.storage.bookmarks.find((c)=>c.id===o.id);if(a)Object.assign(a,o);else this.storage.bookmarks.push(o)}else this.storage.bookmarks.push(o);s++}if(s>0)this.dirty=!0;return s}}function dt(){return`bm-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}var v=new Set;function N(){return{open(t){v.add(t),t.send(JSON.stringify({type:"connected",timestamp:Date.now()}))},close(t){v.delete(t)},message(t,e){}}}function C(t){let e=JSON.stringify({...t,timestamp:t.timestamp||Date.now()});for(let r of v)try{r.send(e)}catch{v.delete(r)}}function V(t,e){C({type:"story-update",data:{storyId:t,...e}})}function H(t,e){C({type:"story-add",data:{storyId:t,...e}})}function O(t){C({type:"story-remove",data:{storyId:t}})}function F(t){return`
3
3
  <script>
4
4
  (function() {
5
5
  const ws = new WebSocket('${t}');
@@ -556,7 +556,7 @@ window.__stxPerformance = {
556
556
 
557
557
  window.clearPerformanceMetrics = () => window.__stxPerformance.clear();
558
558
  </script>
559
- `}import T from"fs";import K from"path";var lt=".stx/story/presets.json",R=1,mt=10;class I{storage;storagePath;dirty=!1;constructor(t){this.storagePath=K.join(t,lt),this.storage=this.loadStorage()}loadStorage(){try{let t=T.readFileSync(this.storagePath,"utf-8"),e=JSON.parse(t);if(e.version!==R)return this.migrateStorage(e);return e}catch{return{version:R,presets:[],recentIds:[]}}}migrateStorage(t){return{version:R,presets:t.presets||[],recentIds:t.recentIds||[]}}async save(){if(!this.dirty)return;let t=K.dirname(this.storagePath);await T.promises.mkdir(t,{recursive:!0}),await T.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}createPreset(t,e,r={}){let s={id:ut(),name:t,description:r.description,props:e,componentId:r.componentId,created:Date.now(),usageCount:0,tags:r.tags};return this.storage.presets.push(s),this.dirty=!0,s}getPreset(t){return this.storage.presets.find((e)=>e.id===t)}getAllPresets(){return[...this.storage.presets]}getPresetsForComponent(t){return this.storage.presets.filter((e)=>!e.componentId||e.componentId===t)}getRecentPresets(){return this.storage.recentIds.map((t)=>this.getPreset(t)).filter((t)=>t!==void 0)}usePreset(t){let e=this.getPreset(t);if(!e)return;return e.lastUsed=Date.now(),e.usageCount++,this.storage.recentIds=[t,...this.storage.recentIds.filter((r)=>r!==t)].slice(0,mt),this.dirty=!0,e}updatePreset(t,e){let r=this.getPreset(t);if(!r)return;return Object.assign(r,e),this.dirty=!0,r}deletePreset(t){let e=this.storage.presets.findIndex((r)=>r.id===t);if(e===-1)return!1;return this.storage.presets.splice(e,1),this.storage.recentIds=this.storage.recentIds.filter((r)=>r!==t),this.dirty=!0,!0}searchPresets(t){let e=t.toLowerCase();return this.storage.presets.filter((r)=>{if(r.name.toLowerCase().includes(e))return!0;if(r.description?.toLowerCase().includes(e))return!0;if(r.tags?.some((s)=>s.toLowerCase().includes(e)))return!0;return!1})}getMostUsedPresets(t=5){return[...this.storage.presets].sort((e,r)=>r.usageCount-e.usageCount).slice(0,t)}exportPresets(t){let e=t?this.storage.presets.filter((r)=>t.includes(r.id)):this.storage.presets;return JSON.stringify({presets:e},null,2)}importPresets(t,e=!1){let r=JSON.parse(t),s=0;for(let o of r.presets){let a=this.storage.presets.find((c)=>c.id===o.id);if(a&&!e)continue;if(a)Object.assign(a,o);else this.storage.presets.push(o);s++}if(s>0)this.dirty=!0;return s}}function ut(){return`preset-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import _ from"fs";var q=new Map;async function b(t,e,r={}){let s=performance.now(),o=[];try{let a=await _.promises.stat(e),c=q.get(e),n;if(c&&c.mtime===a.mtimeMs)n=c.content;else n=await _.promises.readFile(e,"utf-8"),q.set(e,{content:n,mtime:a.mtimeMs,analyzed:null});let{processDirectives:d}=await import("./chunk-nh5pna5s.js"),p={},u=h(n);if(u)try{await y(u,p,e)}catch(g){o.push(`Warning: Could not extract script variables: ${g instanceof Error?g.message:String(g)}`)}if(r.props)Object.assign(p,r.props);let i=await d(n,p,e,{},new Set),l=Z(n),m=h(n);return i=Q(i),i=tt(i,p),{html:i,css:l,js:m,errors:o,duration:performance.now()-s}}catch(a){return o.push(a instanceof Error?a.message:String(a)),{html:`<div class="stx-render-error">${et(o[0])}</div>`,css:"",js:"",errors:o,duration:performance.now()-s}}}async function gt(t){try{let e=await _.promises.readFile(t,"utf-8"),r=h(e);if(!r)return null;let s={};if(await y(r,s,t),Array.isArray(s.variants))return s.variants;return null}catch{return null}}async function Y(t,e,r,s){let o=e.story?.variants;if(!o){let n=await gt(e.path);if(n)o=n}if(!o&&r==="default")return b(t,e.path,{props:s||{}});if(!o)return b(t,e.path,{props:s||{}});let a=o.find((n)=>n.id===r);if(!a&&r==="default")return b(t,e.path,{props:s||{}});if(!a)return{html:'<div class="stx-render-error">Variant not found</div>',css:"",js:"",errors:[`Variant '${r}' not found`],duration:0};let c={...a.state,...s};if(a.source)return ft(t,a.source,c);return b(t,e.path,{props:c})}async function ft(t,e,r={}){let s=performance.now(),o=[];try{let{processDirectives:a}=await import("./chunk-nh5pna5s.js"),c={...r},n=h(e);if(n)try{await y(n,c,"inline-template.stx")}catch{}let p=await a(e,c,"inline-template.stx",{},new Set);return p=Q(p),p=tt(p,c),{html:p,css:Z(e),js:h(e),errors:o,duration:performance.now()-s}}catch(a){return o.push(a instanceof Error?a.message:String(a)),{html:`<div class="stx-render-error">${et(o[0])}</div>`,css:"",js:"",errors:o,duration:performance.now()-s}}}function Z(t){let e=[],r=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,s=r.exec(t);while(s!==null)e.push(s[1].trim()),s=r.exec(t);return e.join(`
559
+ `}import T from"fs";import K from"path";var lt=".stx/story/presets.json",R=1,mt=10;class I{storage;storagePath;dirty=!1;constructor(t){this.storagePath=K.join(t,lt),this.storage=this.loadStorage()}loadStorage(){try{let t=T.readFileSync(this.storagePath,"utf-8"),e=JSON.parse(t);if(e.version!==R)return this.migrateStorage(e);return e}catch{return{version:R,presets:[],recentIds:[]}}}migrateStorage(t){return{version:R,presets:t.presets||[],recentIds:t.recentIds||[]}}async save(){if(!this.dirty)return;let t=K.dirname(this.storagePath);await T.promises.mkdir(t,{recursive:!0}),await T.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}createPreset(t,e,r={}){let s={id:ut(),name:t,description:r.description,props:e,componentId:r.componentId,created:Date.now(),usageCount:0,tags:r.tags};return this.storage.presets.push(s),this.dirty=!0,s}getPreset(t){return this.storage.presets.find((e)=>e.id===t)}getAllPresets(){return[...this.storage.presets]}getPresetsForComponent(t){return this.storage.presets.filter((e)=>!e.componentId||e.componentId===t)}getRecentPresets(){return this.storage.recentIds.map((t)=>this.getPreset(t)).filter((t)=>t!==void 0)}usePreset(t){let e=this.getPreset(t);if(!e)return;return e.lastUsed=Date.now(),e.usageCount++,this.storage.recentIds=[t,...this.storage.recentIds.filter((r)=>r!==t)].slice(0,mt),this.dirty=!0,e}updatePreset(t,e){let r=this.getPreset(t);if(!r)return;return Object.assign(r,e),this.dirty=!0,r}deletePreset(t){let e=this.storage.presets.findIndex((r)=>r.id===t);if(e===-1)return!1;return this.storage.presets.splice(e,1),this.storage.recentIds=this.storage.recentIds.filter((r)=>r!==t),this.dirty=!0,!0}searchPresets(t){let e=t.toLowerCase();return this.storage.presets.filter((r)=>{if(r.name.toLowerCase().includes(e))return!0;if(r.description?.toLowerCase().includes(e))return!0;if(r.tags?.some((s)=>s.toLowerCase().includes(e)))return!0;return!1})}getMostUsedPresets(t=5){return[...this.storage.presets].sort((e,r)=>r.usageCount-e.usageCount).slice(0,t)}exportPresets(t){let e=t?this.storage.presets.filter((r)=>t.includes(r.id)):this.storage.presets;return JSON.stringify({presets:e},null,2)}importPresets(t,e=!1){let r=JSON.parse(t),s=0;for(let o of r.presets){let a=this.storage.presets.find((c)=>c.id===o.id);if(a&&!e)continue;if(a)Object.assign(a,o);else this.storage.presets.push(o);s++}if(s>0)this.dirty=!0;return s}}function ut(){return`preset-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import _ from"fs";var q=new Map;async function b(t,e,r={}){let s=performance.now(),o=[];try{let a=await _.promises.stat(e),c=q.get(e),n;if(c&&c.mtime===a.mtimeMs)n=c.content;else n=await _.promises.readFile(e,"utf-8"),q.set(e,{content:n,mtime:a.mtimeMs,analyzed:null});let{processDirectives:d}=await import("./chunk-4eyyshsq.js"),p={},u=h(n);if(u)try{await y(u,p,e)}catch(g){o.push(`Warning: Could not extract script variables: ${g instanceof Error?g.message:String(g)}`)}if(r.props)Object.assign(p,r.props);let i=await d(n,p,e,{},new Set),l=Z(n),m=h(n);return i=Q(i),i=tt(i,p),{html:i,css:l,js:m,errors:o,duration:performance.now()-s}}catch(a){return o.push(a instanceof Error?a.message:String(a)),{html:`<div class="stx-render-error">${et(o[0])}</div>`,css:"",js:"",errors:o,duration:performance.now()-s}}}async function gt(t){try{let e=await _.promises.readFile(t,"utf-8"),r=h(e);if(!r)return null;let s={};if(await y(r,s,t),Array.isArray(s.variants))return s.variants;return null}catch{return null}}async function Y(t,e,r,s){let o=e.story?.variants;if(!o){let n=await gt(e.path);if(n)o=n}if(!o&&r==="default")return b(t,e.path,{props:s||{}});if(!o)return b(t,e.path,{props:s||{}});let a=o.find((n)=>n.id===r);if(!a&&r==="default")return b(t,e.path,{props:s||{}});if(!a)return{html:'<div class="stx-render-error">Variant not found</div>',css:"",js:"",errors:[`Variant '${r}' not found`],duration:0};let c={...a.state,...s};if(a.source)return ft(t,a.source,c);return b(t,e.path,{props:c})}async function ft(t,e,r={}){let s=performance.now(),o=[];try{let{processDirectives:a}=await import("./chunk-4eyyshsq.js"),c={...r},n=h(e);if(n)try{await y(n,c,"inline-template.stx")}catch{}let p=await a(e,c,"inline-template.stx",{},new Set);return p=Q(p),p=tt(p,c),{html:p,css:Z(e),js:h(e),errors:o,duration:performance.now()-s}}catch(a){return o.push(a instanceof Error?a.message:String(a)),{html:`<div class="stx-render-error">${et(o[0])}</div>`,css:"",js:"",errors:o,duration:performance.now()-s}}}function Z(t){let e=[],r=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,s=r.exec(t);while(s!==null)e.push(s[1].trim()),s=r.exec(t);return e.join(`
560
560
  `)}function Q(t){return t.replace(/<!--[\s\S]*?-->/g,"").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"").replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/^\s*\n/gm,"").trim()}function h(t){let e=[],r=/<script\b[^>]*>([\s\S]*?)<\/script>/gi,s=r.exec(t);while(s!==null)e.push(s[1].trim()),s=r.exec(t);return e.join(`
561
561
  `)}function tt(t,e){let r=`<script>window.__stxProps = ${JSON.stringify(e)};</script>`;return t+r}function et(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}async function rt(t,e){let r=await sn(t);_t(t,r);let s=on(t.config,r);Ct(t,s),console.log(` Found ${r.length} story files`);let o=typeof e.host==="string"?e.host:e.host===!0?"0.0.0.0":"localhost",a=new I(t.root),c=new P(t.root),n=new k(t.root),d=N(),p=Bun.serve({port:e.port,hostname:o,fetch:async(i,l)=>{let g=new URL(i.url).pathname;if(g==="/__hmr"){if(l.upgrade(i,{data:{isHmr:!0}}))return;return new Response("WebSocket upgrade failed",{status:400})}if(g.startsWith("/api/"))return yt(t,g,i,{presetsManager:a,bookmarksManager:c,analyticsTracker:n});return ht(t,g,e.port)},websocket:{open(i){d.open(i)},close(i){d.close(i)},message(i,l){d.message(i,l)}}}),u=`http://${o}:${e.port}`,f=wa(t,async(i,l)=>{console.log(` [${i}] ${l.relativePath}`);let m=await sn(t);_t(t,m);let g=on(t.config,m);if(Ct(t,g),i==="add")H(l.id,{fileName:l.fileName});else if(i==="unlink")O(l.id);else V(l.id,{fileName:l.fileName})});if(e.open){let i=u;try{let{exec:l}=await import("child_process"),m=process.platform;l(`${m==="darwin"?"open":m==="win32"?"start":"xdg-open"} ${i}`)}catch{}}return{server:p,url:u,close:async()=>{f(),p.stop()}}}async function yt(t,e,r,s){let{presetsManager:o,bookmarksManager:a,analyticsTracker:c}=s;if(e==="/api/stories")return Response.json({files:t.storyFiles.map((n)=>({id:n.id,fileName:n.fileName,relativePath:n.relativePath,treePath:n.treePath})),tree:t.tree});if(e.startsWith("/api/story/")){let n=e.slice(11),d=t.storyFiles.find((p)=>p.id===n);if(!d)return new Response("Story not found",{status:404});try{let p=await Bun.file(d.path).text();return Response.json({id:d.id,fileName:d.fileName,relativePath:d.relativePath,content:p})}catch{return new Response("Error reading story",{status:500})}}if(e==="/api/config")return Response.json({theme:t.config.theme,responsivePresets:t.config.responsivePresets,backgroundPresets:t.config.backgroundPresets});if(e.startsWith("/api/render/")){let n=new URL(r.url),d=e.slice(12).split("/"),p=d[0],u=d[1]||"default",f,i=n.searchParams.get("props");if(i)try{f=JSON.parse(i)}catch{}let l=t.storyFiles.find((m)=>m.id===p);if(!l)return new Response("Story not found",{status:404});try{let m=await Y(t,l,u,f);return Response.json({html:m.html,css:m.css,js:m.js,errors:m.errors,duration:m.duration})}catch(m){return Response.json({html:"",css:"",js:"",errors:[m instanceof Error?m.message:String(m)],duration:0},{status:500})}}if(e==="/api/presets"&&r.method==="GET")return Response.json({presets:o.getAllPresets()});if(e==="/api/presets"&&r.method==="POST")try{let n=await r.json(),d=o.createPreset(n.name,n.props,{componentId:n.componentId,description:n.description});return await o.save(),Response.json(d)}catch(n){return Response.json({error:String(n)},{status:400})}if(e.startsWith("/api/presets/")&&!e.includes("/use")&&r.method==="GET"){let n=e.slice(13),d=o.getPreset(n);if(!d)return new Response("Preset not found",{status:404});return Response.json(d)}if(e.endsWith("/use")&&r.method==="POST"){let n=e.slice(13,-4),d=o.usePreset(n);if(!d)return new Response("Preset not found",{status:404});return await o.save(),Response.json(d)}if(e.startsWith("/api/presets/")&&r.method==="DELETE"){let n=e.slice(13);if(!o.deletePreset(n))return new Response("Preset not found",{status:404});return await o.save(),Response.json({success:!0})}if(e==="/api/bookmarks"&&r.method==="GET")return Response.json({bookmarks:a.getAllBookmarks()});if(e==="/api/bookmarks"&&r.method==="POST")try{let n=await r.json(),d=a.addBookmark(n.storyId,n.variantId,n.props,{name:n.name,notes:n.notes,color:n.color});return await a.save(),Response.json(d)}catch(n){return Response.json({error:String(n)},{status:400})}if(e==="/api/bookmarks/toggle"&&r.method==="POST")try{let n=await r.json(),d=a.toggleBookmark(n.storyId,n.variantId,n.props);return await a.save(),Response.json(d)}catch(n){return Response.json({error:String(n)},{status:400})}if(e.startsWith("/api/bookmarks/")&&e!=="/api/bookmarks/toggle"&&r.method==="GET"){let n=e.slice(15),d=a.getBookmark(n);if(!d)return new Response("Bookmark not found",{status:404});return Response.json(d)}if(e.startsWith("/api/bookmarks/")&&r.method==="DELETE"){let n=e.slice(15);if(!a.deleteBookmark(n))return new Response("Bookmark not found",{status:404});return await a.save(),Response.json({success:!0})}if(e==="/api/analytics/track"&&r.method==="POST")try{let n=await r.json();if(n.type==="view"&&n.componentId)c.trackView(n.componentId,n.variantId);else if(n.type==="prop_change"&&n.componentId&&n.propName)c.trackPropChange(n.componentId,n.propName,null);else if(n.type==="variant_switch"&&n.componentId&&n.variantId)c.trackVariantSwitch(n.componentId,n.variantId);else if(n.type==="search"&&n.query)c.trackSearch(n.query,0);return await c.save(),Response.json({success:!0})}catch(n){return Response.json({error:String(n)},{status:400})}if(e==="/api/analytics/summary"&&r.method==="GET")return Response.json({mostViewed:c.getMostViewedComponents(10),mostChangedProps:c.getMostChangedProps(10),searchAnalytics:c.getSearchAnalytics()});if(e.startsWith("/api/analytics/component/")&&r.method==="GET"){let n=e.slice(25),d=t.storyFiles.find((u)=>u.id===n),p=c.getComponentAnalytics(n,d?.fileName||n);return Response.json(p)}return new Response("Not found",{status:404})}function ht(t,e,r){let s=vt(t,r);return new Response(s,{headers:{"Content-Type":"text/html; charset=utf-8"}})}function vt(t,e){let{theme:r}=t.config,s=r.title||"STX Story",o=`ws://localhost:${e}/__hmr`,a=F(o);return`<!DOCTYPE html>
562
562
  <html lang="en" class="${r.darkClass||"dark"}">
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{_m}from"./chunk-dsdhft2k.js";import"./chunk-2carg287.js";import"./chunk-mkpgr3cy.js";import"./chunk-q0y8gv18.js";import"./chunk-rb2zbdqd.js";import"./chunk-qrk535j6.js";import"./chunk-gzc16hs8.js";import"./chunk-bnqjj9a6.js";import"./chunk-m4h31n4w.js";import"./chunk-41z7f41b.js";import"./chunk-ac3e6nhg.js";import"./chunk-vk2jy6mn.js";import"./chunk-3b3mkgpj.js";import"./chunk-0jdz31q1.js";import"./chunk-x9036mfd.js";export{_m as buildApp};
2
+ import{_m}from"./chunk-ae0qvjkz.js";import"./chunk-e9c56r58.js";import"./chunk-hxm31y5q.js";import"./chunk-q0y8gv18.js";import"./chunk-rb2zbdqd.js";import"./chunk-qrk535j6.js";import"./chunk-gzc16hs8.js";import"./chunk-8a71xvx1.js";import"./chunk-8qgcvc9r.js";import"./chunk-41z7f41b.js";import"./chunk-ac3e6nhg.js";import"./chunk-vk2jy6mn.js";import"./chunk-3b3mkgpj.js";import"./chunk-0jdz31q1.js";import"./chunk-x9036mfd.js";export{_m as buildApp};