@stacksjs/stx 0.2.851 → 0.2.852
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.
- package/dist/{chunk-qk2herh9.js → chunk-02w7kaas.js} +1 -1
- package/dist/{chunk-69kbw21c.js → chunk-0b7knfwk.js} +1 -1
- package/dist/{chunk-xz4yq7gh.js → chunk-0kaph5qq.js} +5 -5
- package/dist/{chunk-xsavnbkv.js → chunk-14vv64pw.js} +1 -1
- package/dist/{chunk-036pnz1y.js → chunk-1mqyt33c.js} +1 -1
- package/dist/{chunk-4jf18yed.js → chunk-1pavg6q5.js} +4 -4
- package/dist/{chunk-taf784yy.js → chunk-1sedjgmj.js} +1 -1
- package/dist/{chunk-7hv190bd.js → chunk-2stgv8kd.js} +2 -2
- package/dist/chunk-332qk8tm.js +3 -0
- package/dist/{chunk-hdep0xcy.js → chunk-3bp76dx5.js} +3 -3
- package/dist/{chunk-45yytzyd.js → chunk-42hj9jnj.js} +1 -1
- package/dist/{chunk-j882bpqq.js → chunk-47z5w330.js} +1 -1
- package/dist/chunk-4e5wynb4.js +2 -0
- package/dist/{chunk-6ekgf3b3.js → chunk-4hfh5ety.js} +1 -1
- package/dist/{chunk-p2gsezmj.js → chunk-6amqskpv.js} +1 -1
- package/dist/chunk-6ra9dqs2.js +2 -0
- package/dist/{chunk-yvfzvygh.js → chunk-6tns3zet.js} +1 -1
- package/dist/{chunk-nqv66ehx.js → chunk-714p8awg.js} +1 -1
- package/dist/{chunk-kf5fsz9b.js → chunk-7x6aqvfe.js} +1 -1
- package/dist/{chunk-ark6w80h.js → chunk-818kkhb8.js} +1 -1
- package/dist/{chunk-6rk18x14.js → chunk-8f5dy08a.js} +1 -1
- package/dist/{chunk-zjm67zx2.js → chunk-9gzgfj19.js} +1 -1
- package/dist/{chunk-pg2dxnry.js → chunk-a69v31q8.js} +1 -1
- package/dist/{chunk-eyp7rr70.js → chunk-c1dkvqr5.js} +2 -2
- package/dist/{chunk-e6qam3x3.js → chunk-cm5kpn54.js} +2 -2
- package/dist/{chunk-tr5r70yr.js → chunk-d5m6xy9p.js} +4 -4
- package/dist/{chunk-htsqfx9m.js → chunk-dqrkteav.js} +1 -1
- package/dist/{chunk-cct2fzth.js → chunk-e0dgx3ev.js} +1 -1
- package/dist/{chunk-3m3jny87.js → chunk-epqp6mmn.js} +1 -1
- package/dist/chunk-et9fyzf6.js +2 -0
- package/dist/{chunk-jxzcwjx4.js → chunk-fhd8e4mq.js} +1 -1
- package/dist/{chunk-m9kkd9f2.js → chunk-fkrf2099.js} +1 -1
- package/dist/chunk-ft43rx62.js +2 -0
- package/dist/{chunk-ngdye54z.js → chunk-g34tj6ny.js} +1 -1
- package/dist/{chunk-wtahqbxe.js → chunk-gn6yqcz2.js} +4 -4
- package/dist/{chunk-x9a2agqk.js → chunk-hh9hnx1a.js} +1 -1
- package/dist/{chunk-evyspfm5.js → chunk-j415w6dm.js} +1 -1
- package/dist/{chunk-fj18grh2.js → chunk-ja5ghh0f.js} +1 -1
- package/dist/{chunk-vvr19nq7.js → chunk-jmjz23rf.js} +1 -1
- package/dist/{chunk-e9qgyvz5.js → chunk-keeetray.js} +1 -1
- package/dist/{chunk-422eg7vs.js → chunk-kp2g6sj6.js} +1 -1
- package/dist/{chunk-j8f4tb4p.js → chunk-m150nmez.js} +1 -1
- package/dist/{chunk-ezzskm4a.js → chunk-n2z4kyba.js} +1 -1
- package/dist/{chunk-xj5jdy7n.js → chunk-pbq1gn94.js} +2 -2
- package/dist/chunk-pd0wdjqd.js +2 -0
- package/dist/{chunk-ty915d4h.js → chunk-ptppavv8.js} +1 -1
- package/dist/{chunk-p4ytnee6.js → chunk-r53tqxmq.js} +6 -6
- package/dist/{chunk-knapnbwv.js → chunk-s922rk4n.js} +1 -1
- package/dist/{chunk-69nhstnz.js → chunk-sb8vn22f.js} +1 -1
- package/dist/{chunk-5gfg2tqg.js → chunk-tbms7m44.js} +1 -1
- package/dist/{chunk-dy31f39m.js → chunk-te090fxv.js} +4 -4
- package/dist/{chunk-wn8qkcaw.js → chunk-tgk6bst6.js} +2 -2
- package/dist/{chunk-j5pgwqwp.js → chunk-tn9h4prj.js} +1 -1
- package/dist/{chunk-q5rw0d2m.js → chunk-tt3jxdy5.js} +1 -1
- package/dist/{chunk-5yy40vxk.js → chunk-v4kqxe8a.js} +1 -1
- package/dist/{chunk-93kdj0t4.js → chunk-vffwkmt4.js} +1 -1
- package/dist/chunk-vqr3hn16.js +2 -0
- package/dist/{chunk-6dqafrq5.js → chunk-w7dks1ev.js} +2 -2
- package/dist/{chunk-yza0mj53.js → chunk-whdy7r35.js} +1 -1
- package/dist/{chunk-vk9zpckc.js → chunk-x1c1aggq.js} +1 -1
- package/dist/chunk-xkvzg640.js +2 -0
- package/dist/chunk-xt7qsgk4.js +2 -0
- package/dist/{chunk-8wnkh2ss.js → chunk-yq12dhnt.js} +1 -1
- package/dist/chunk-z5z6442j.js +2 -0
- package/dist/cli.js +7 -7
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/native/floating-actions.d.ts +1 -0
- package/dist/native/floating-actions.js +2 -0
- package/dist/native/runtime/browser-screen.js +12 -1
- package/dist/native/runtime/craft.d.ts +1 -0
- package/dist/pwa.js +1 -1
- package/dist/ssg.js +2 -2
- package/package.json +5 -5
- package/dist/chunk-2vfhzn8m.js +0 -2
- package/dist/chunk-30y1dbcf.js +0 -2
- package/dist/chunk-5bbwdv4y.js +0 -3
- package/dist/chunk-8qqrrbap.js +0 -2
- package/dist/chunk-8spe7avc.js +0 -2
- package/dist/chunk-9frv1kpd.js +0 -2
- package/dist/chunk-9pzbesp6.js +0 -2
- package/dist/chunk-wjf69hmc.js +0 -2
- package/dist/chunk-zwy89pzx.js +0 -2
- package/dist/chunk-zz1n2ake.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{_n,Ti}from"./chunk-
|
|
2
|
+
import{_n,Ti}from"./chunk-n2z4kyba.js";import"./chunk-v4bqmzj9.js";export{Ti as generateRuntimeConfigTypes,_n as prepareRuntimeConfig};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{F,Gf,ei,a,O,Yh,Zh}from"./chunk-
|
|
2
|
+
import{F,Gf,ei,a,O,Yh,Zh}from"./chunk-c1dkvqr5.js";import"./chunk-tt3jxdy5.js";import"./chunk-jtccqpwa.js";import"./chunk-2rg9pqmh.js";import"./chunk-0rszcb0m.js";import"./chunk-8cvgm13s.js";import"./chunk-r53tqxmq.js";import"./chunk-n2z4kyba.js";import"./chunk-v4bqmzj9.js";import"./chunk-k47addf7.js";import"./chunk-xppm4cs4.js";import"./chunk-agbkv9ab.js";export{O as config,F as defaultConfig,Yh as defineStxConfig,ei as discoverConfig,a as loadStxConfig,Gf as resolveStxDirectories,Zh as validateConfig};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{zo,Ho,Vo,Bh,gs,Fh}from"./chunk-
|
|
2
|
+
import{zo,Ho,Vo,Bh,gs,Fh}from"./chunk-e0dgx3ev.js";export{gs as clearImageDeliveryCatalog,Bh as deliveredImage,Vo as efficientDeliverySources,zo as getImageDelivery,Ho as isTransparentImage,Fh as prepareImageDelivery};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Wf,Uh,Wh,qh,Kh,qf,Kf,Gh,Xh,Qo,Jh,fr,gr,ks}from"./chunk-
|
|
2
|
+
import{Wf,Uh,Wh,qh,Kh,qf,Kf,Gh,Xh,Qo,Jh,fr,gr,ks}from"./chunk-7x6aqvfe.js";import{rt}from"./chunk-car6nhfe.js";import"./chunk-r53tqxmq.js";import"./chunk-n2z4kyba.js";import"./chunk-v4bqmzj9.js";import"./chunk-k47addf7.js";import"./chunk-xppm4cs4.js";import"./chunk-agbkv9ab.js";export{Kh as __setSignalsGeneratorsForTest,rt as cacheEngineFingerprint,gr as cacheTemplate,fr as checkCache,Jh as clearDevCaches,Kf as getCachedRouterScript,qf as getCachedSignalsRuntime,Gh as getServeClientAsset,Qo as getServeModuleBundle,ks as hashFilePath,Wh as invalidateFileCache,qh as invalidateFileCacheByDir,Uh as readFileCached,Xh as registerServeModuleBundle,Wf as templateCache};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{a}from"./chunk-
|
|
2
|
+
import{a}from"./chunk-c1dkvqr5.js";import{xo}from"./chunk-12r22pf0.js";import p from"path";async function tm(t={}){let l=performance.now(),s=t.root||process.cwd(),e=await a(s),o=t.ssr?.routeRules??e.routeRules??{};if(xo(o),!e.ssr&&Object.keys(o).length)throw Error("routeRules require ssr: true and the production server; flat SSG output cannot apply request/cache policies");if(!e.ssr&&(t.ssr?.serverApi??e.serverApi))throw Error("serverApi requires ssr: true; flat SSG output cannot execute API endpoints");let r=e.ssr?"ssr":"ssg";console.log(`[stx build] Mode: ${r.toUpperCase()}${e.ssr?" (ssr: true in stx.config.ts)":" (default \u2014 ssr is false)"}`);let u,n;if(r==="ssg"){let{generateStaticSite:i}=await import("./ssg.js");u=await i({pagesDir:p.join(e.root||".",e.pagesDir||e.build?.pagesDir||"pages"),publicDir:e.publicDir||e.build?.publicDir||"public",outputDir:e.build?.outputDir||"dist",generate404:e.build?.generate404??!0,minify:e.build?.minify??!0,cleanOutput:e.build?.cleanOutput??!0,router:e.router,...t.ssg})}else{let{buildForProduction:i}=await import("./chunk-ft43rx62.js");n=await i({root:s,outputDir:".output",debug:t.debug,...t.ssr})}let d=Math.round(performance.now()-l);return{mode:r,ssg:u,ssr:n,duration:d}}
|
|
3
3
|
export{tm};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-agbkv9ab.js";import"./chunk-xppm4cs4.js";import"./chunk-k47addf7.js";import{w,S,C,Z}from"./chunk-
|
|
2
|
+
import"./chunk-agbkv9ab.js";import"./chunk-xppm4cs4.js";import"./chunk-k47addf7.js";import{w,S,C,Z}from"./chunk-r53tqxmq.js";import"./chunk-v4bqmzj9.js";import"./chunk-n2z4kyba.js";import{lr}from"./chunk-14cvwsy1.js";import{existsSync as R}from"fs";import l from"path";var b=["applyOfflineUpdate","broadcast","cacheMedia","calculateDistance","canNotify","clearCookies","clearFetchCache","clearOfflineData","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","onOfflineUpdateReady","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAmbientSound","useAnimationFrame","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBreathPacer","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useCompletion","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useOutbox","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVirtualList","useVisibility","useWakeLock","useWindowSize"],F=new Set(b);var u=new Map,h=w(64),x=new Set,k=0,P=new Set(b);function z(){u.clear(),h.clear()}function I(s){let o=new Map;for(let t of s){let i=l.basename(t);if(i.endsWith(".d.ts"))continue;let r=i.replace(/\.[jt]s$/,"");if(r==="index")continue;if(r===i)continue;let a=o.get(r);if(a&&!a.endsWith(".js"))continue;o.set(r,t)}return[...o.values()].sort()}function M(s,o){let t=o.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${t}\\b`).test(s)}function L(s){if(!s)return[];let o=S(s,k),t=h.get(o);if(t)return t.slice();let i=s.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),r=[];for(let a of P){if(x.has(a))continue;let p=a.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${p}\\s*\\(`).test(i))r.push(a)}return r.sort(),h.set(o,r),r.slice()}function _(){let s=l.join(import.meta.dir,"composables"),o=import.meta.url.endsWith(".ts")?"ts":"js";if(R(l.join(s,`index.${o}`)))return s;let t=lr("@stacksjs/stx/composables");return t?l.dirname(t):void 0}async function V(s,o){let t=L(s);if(t.length===0)return null;let i=o??_();if(!i)return null;let r=`${i}\x00${t.join(",")}`,a=u.get(r);if(a!==void 0)return a||null;let p=Z({loader:"ts",target:"browser",define:C()}),O=new Set(t),m=[],d=new Set,f=[];try{let n=new Bun.Glob("*.{ts,js}");for await(let e of n.scan({cwd:i,absolute:!0}))f.push(e)}catch{return u.set(r,""),null}f=I(f);for(let n of f){let e;try{e=await Bun.file(n).text()}catch{continue}let g=[];try{g=p.scan(e).exports.filter((c)=>c!=="default")}catch{continue}if(!g.some((c)=>O.has(c)))continue;try{e=e.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^import\s+type\s+.*$/gm,""),e=e.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),e=e.replace(/^export\s+default\s+/gm,""),e=e.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),m.push(`// ${l.basename(n).replace(/\.[jt]s$/,"")}
|
|
3
3
|
${p.transformSync(e).trim()}`);for(let c of g)d.add(c)}catch(c){console.warn(`[stx] framework composable ${l.basename(n)} could not be bundled:`,c)}}let y=t.filter((n)=>!d.has(n)&&!M(s,n));if(y.length>0)console.warn(`[stx] could not bundle ${y.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(m.length===0)return u.set(r,""),null;let E=[...d].map((n)=>` try { if (!(${JSON.stringify(n)} in __s)) { __s[${JSON.stringify(n)}] = ${n}; if (!(${JSON.stringify(n)} in window)) window[${JSON.stringify(n)}] = ${n}; } } catch (e) {}`).join(`
|
|
4
4
|
`),v=`<script data-stx-scoped data-stx-run="always" data-stx-framework-composables>
|
|
5
5
|
;(function(){
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{q,Me}from"./chunk-
|
|
2
|
+
import{q,Me}from"./chunk-r53tqxmq.js";var o=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function u(t,e,r){let i={fullTag:r,content:e,attrs:t};if(/\bserver\b/.test(t))return{...i,type:"server"};if(/\bdata-stx-scoped\b/.test(t))return{...i,type:"client"};if(o.test(e))return{...i,type:"signals"};if(/\bclient\b/.test(t)||/\btype\s*=\s*["']module["']/.test(t)||/\bsrc\s*=/.test(t))return{...i,type:"client"};return{...i,type:"server"}}var S=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function nn(t){let e=[],r=[],i=[],c=0;while(c<t.length){let s=t.indexOf("<",c);if(s===-1)break;let p=Me(t,s);if(p>s){c=p;continue}let a=q(t,s);if(a>s){let f=t.slice(s,a),l=S.exec(f);if(l){let n=u(l[1],l[2],f);switch(n.type){case"signals":e.push(n);break;case"client":r.push(n);break;case"server":i.push(n);break}}c=a;continue}c=s+(t.startsWith("<!--",s)?4:1)}return{signals:e,client:r,server:i}}
|
|
3
3
|
export{nn};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Cn,M}from"./chunk-v4bqmzj9.js";import m from"fs";import e from"path";async function _n(r,o,i){if(r.__stx_runtime_config)return;let n=Cn();if(n||i){r.__stx_runtime_config=n??M(i);return}let t=e.dirname(e.resolve(o));while(!0){if(["stx.config.ts","stx.config.js",".config/stx.config.ts",".config/stx.config.js"].some((f)=>m.existsSync(e.join(t,f)))){let{loadStxConfig:f}=await import("./chunk-
|
|
2
|
+
import{Cn,M}from"./chunk-v4bqmzj9.js";import m from"fs";import e from"path";async function _n(r,o,i){if(r.__stx_runtime_config)return;let n=Cn();if(n||i){r.__stx_runtime_config=n??M(i);return}let t=e.dirname(e.resolve(o));while(!0){if(["stx.config.ts","stx.config.js",".config/stx.config.ts",".config/stx.config.js"].some((f)=>m.existsSync(e.join(t,f)))){let{loadStxConfig:f}=await import("./chunk-j415w6dm.js"),c=await f(t);if(c.runtimeConfig)r.__stx_runtime_config=M(c.runtimeConfig);return}let s=e.dirname(t);if(s===t)return;t=s}}async function Ti(r,o){function i(n){if(n===null)return"null";if(Array.isArray(n))return`Array<${n.length?[...new Set(n.map(i))].join(" | "):"unknown"}>`;if(typeof n==="object")return`{ ${Object.entries(n).map(([t,s])=>`readonly ${JSON.stringify(t)}: ${i(s)}`).join("; ")} }`;return typeof n}await Bun.write(e.join(r,".stx/runtime-config.d.ts"),`import '@stacksjs/stx/runtime-config'
|
|
3
3
|
declare module '@stacksjs/stx/runtime-config' { interface PublicRuntimeConfig ${i(o.public??{})} }
|
|
4
4
|
`),await Bun.write(e.join(r,".stx/runtime-config-server.d.ts"),`import '@stacksjs/stx/runtime-config-server'
|
|
5
5
|
declare module '@stacksjs/stx/runtime-config-server' { interface PrivateRuntimeConfig ${i(o.private??{})} }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{dt,pt,ft}from"./chunk-w032x0zm.js";import"./chunk-agbkv9ab.js";import"./chunk-xppm4cs4.js";import"./chunk-k47addf7.js";import{m}from"./chunk-
|
|
2
|
+
import{dt,pt,ft}from"./chunk-w032x0zm.js";import"./chunk-agbkv9ab.js";import"./chunk-xppm4cs4.js";import"./chunk-k47addf7.js";import{m}from"./chunk-r53tqxmq.js";import"./chunk-v4bqmzj9.js";import"./chunk-n2z4kyba.js";import{Wt,io,qt,Ji,ut,Yi,ao,Kt,Qi,Gt}from"./chunk-wzv7k91a.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()=>{Yi("Config file changed, restarting...");try{await e.onChange()}catch(p){ut(`Failed to restart: ${p}`)}},s)}});a.push(n)}catch{}return{stop(){if(o)clearTimeout(o);for(let c of a)c.close()}}}import w from"fs";import j from"path";var nt=".stx/story/analytics.json",st=1,A=1e4;class k{storage;storagePath;currentSession=null;dirty=!1;viewStartTimes=new Map;constructor(t){this.storagePath=j.join(t,nt),this.storage=this.loadStorage(),this.startSession()}loadStorage(){try{let t=w.readFileSync(this.storagePath,"utf-8");return JSON.parse(t)}catch{return{version:st,events:[],sessions:[]}}}async save(){if(!this.dirty)return;let t=j.dirname(this.storagePath);if(await w.promises.mkdir(t,{recursive:!0}),this.storage.events.length>A)this.storage.events=this.storage.events.slice(-A);await w.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}startSession(){this.endSession(),this.currentSession={id:at(),startTime:Date.now(),componentViews:[]},this.storage.sessions.push(this.currentSession),this.dirty=!0}endSession(){if(this.currentSession)this.currentSession.endTime=Date.now(),this.currentSession=null}track(t){this.storage.events.push({...t,timestamp:Date.now()}),this.dirty=!0}trackView(t,e){if(this.endViewTiming(t),this.viewStartTimes.set(t,Date.now()),this.track({type:"view",componentId:t,variantId:e}),this.currentSession&&!this.currentSession.componentViews.includes(t))this.currentSession.componentViews.push(t)}endViewTiming(t){let e=this.viewStartTimes.get(t);if(e){let r=Date.now()-e;this.track({type:"view",componentId:t,metadata:{duration:r,endView:!0}}),this.viewStartTimes.delete(t)}}trackPropChange(t,e,r){this.track({type:"prop_change",componentId:t,propName:e,metadata:{value:r}})}trackVariantSwitch(t,e){this.track({type:"variant_switch",componentId:t,variantId:e})}trackSearch(t,e){this.track({type:"search",query:t,metadata:{resultCount:e}})}getComponentAnalytics(t,e){let r=this.storage.events.filter((i)=>i.componentId===t),s=r.filter((i)=>i.type==="view"&&!i.metadata?.endView),o=r.filter((i)=>i.type==="prop_change"),a=r.filter((i)=>i.type==="variant_switch"),c={};for(let i of o)if(i.propName)c[i.propName]=(c[i.propName]||0)+1;let n={};for(let i of a)if(i.variantId)n[i.variantId]=(n[i.variantId]||0)+1;let d=new Set(this.storage.sessions.filter((i)=>i.componentViews.includes(t)).map((i)=>i.id)),p=r.filter((i)=>i.metadata?.duration).map((i)=>i.metadata.duration),g=p.length>0?p.reduce((i,l)=>i+l,0)/p.length:0,y=Object.entries(c).sort((i,l)=>l[1]-i[1]).slice(0,5).map(([i])=>i);return{componentId:t,componentName:e,viewCount:s.length,uniqueViews:d.size,lastViewed:s[s.length-1]?.timestamp,propChanges:c,topChangedProps:y,variantViews:n,avgTimeSpent:g}}getMostViewedComponents(t=10){let e=new Map;for(let r of this.storage.events)if(r.type==="view"&&r.componentId&&!r.metadata?.endView)e.set(r.componentId,(e.get(r.componentId)||0)+1);return Array.from(e.entries()).map(([r,s])=>({componentId:r,viewCount:s})).sort((r,s)=>s.viewCount-r.viewCount).slice(0,t)}getMostChangedProps(t=10){let e=new Map;for(let r of this.storage.events)if(r.type==="prop_change"&&r.propName)e.set(r.propName,(e.get(r.propName)||0)+1);return Array.from(e.entries()).map(([r,s])=>({propName:r,changeCount:s})).sort((r,s)=>s.changeCount-r.changeCount).slice(0,t)}getSearchAnalytics(){let t=this.storage.events.filter((o)=>o.type==="search"),e=new Map,r=0;for(let o of t){if(o.query)e.set(o.query,(e.get(o.query)||0)+1);if(o.metadata?.resultCount!==void 0)r+=o.metadata.resultCount}let s=Array.from(e.entries()).map(([o,a])=>({query:o,count:a})).sort((o,a)=>a.count-o.count).slice(0,10);return{totalSearches:t.length,topQueries:s,avgResultCount:t.length>0?r/t.length:0}}clear(){this.storage.events=[],this.storage.sessions=[],this.dirty=!0,this.startSession()}exportAnalytics(){return JSON.stringify({exportedAt:Date.now(),...this.storage},null,2)}}function at(){return`session-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import S from"fs";import B from"path";var it=".stx/story/bookmarks.json",ct=1;class P{storage;storagePath;dirty=!1;constructor(t){this.storagePath=B.join(t,it),this.storage=this.loadStorage()}loadStorage(){try{let t=S.readFileSync(this.storagePath,"utf-8");return JSON.parse(t)}catch{return{version:ct,bookmarks:[]}}}async save(){if(!this.dirty)return;let t=B.dirname(this.storagePath);await S.promises.mkdir(t,{recursive:!0}),await S.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}addBookmark(t,e,r,s={}){let o={id:lt(),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 lt(){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 gt=".stx/story/presets.json",R=1,yt=10;class I{storage;storagePath;dirty=!1;constructor(t){this.storagePath=K.join(t,gt),this.storage=this.loadStorage()}loadStorage(){try{let t=T.readFileSync(this.storagePath,"utf-8"),e=JSON.parse(t);if(e.version!==R)return this.migrateStorage(e);return e}catch{return{version:R,presets:[],recentIds:[]}}}migrateStorage(t){return{version:R,presets:t.presets||[],recentIds:t.recentIds||[]}}async save(){if(!this.dirty)return;let t=K.dirname(this.storagePath);await T.promises.mkdir(t,{recursive:!0}),await T.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}createPreset(t,e,r={}){let s={id:ht(),name:t,description:r.description,props:e,componentId:r.componentId,created:Date.now(),usageCount:0,tags:r.tags};return this.storage.presets.push(s),this.dirty=!0,s}getPreset(t){return this.storage.presets.find((e)=>e.id===t)}getAllPresets(){return[...this.storage.presets]}getPresetsForComponent(t){return this.storage.presets.filter((e)=>!e.componentId||e.componentId===t)}getRecentPresets(){return this.storage.recentIds.map((t)=>this.getPreset(t)).filter((t)=>t!==void 0)}usePreset(t){let e=this.getPreset(t);if(!e)return;return e.lastUsed=Date.now(),e.usageCount++,this.storage.recentIds=[t,...this.storage.recentIds.filter((r)=>r!==t)].slice(0,yt),this.dirty=!0,e}updatePreset(t,e){let r=this.getPreset(t);if(!r)return;return Object.assign(r,e),this.dirty=!0,r}deletePreset(t){let e=this.storage.presets.findIndex((r)=>r.id===t);if(e===-1)return!1;return this.storage.presets.splice(e,1),this.storage.recentIds=this.storage.recentIds.filter((r)=>r!==t),this.dirty=!0,!0}searchPresets(t){let e=t.toLowerCase();return this.storage.presets.filter((r)=>{if(r.name.toLowerCase().includes(e))return!0;if(r.description?.toLowerCase().includes(e))return!0;if(r.tags?.some((s)=>s.toLowerCase().includes(e)))return!0;return!1})}getMostUsedPresets(t=5){return[...this.storage.presets].sort((e,r)=>r.usageCount-e.usageCount).slice(0,t)}exportPresets(t){let e=t?this.storage.presets.filter((r)=>t.includes(r.id)):this.storage.presets;return JSON.stringify({presets:e},null,2)}importPresets(t,e=!1){let r=JSON.parse(t),s=0;for(let o of r.presets){let a=this.storage.presets.find((c)=>c.id===o.id);if(a&&!e)continue;if(a)Object.assign(a,o);else this.storage.presets.push(o);s++}if(s>0)this.dirty=!0;return s}}function ht(){return`preset-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import _ from"fs";var q=new Map;async function b(t,e,r={}){let s=performance.now(),o=[];try{let a=await _.promises.stat(e),c=q.get(e),n;if(c&&c.mtime===a.mtimeMs)n=c.content;else n=await _.promises.readFile(e,"utf-8"),q.set(e,{content:n,mtime:a.mtimeMs,analyzed:null});let{processDirectives:d}=await import("./chunk-
|
|
559
|
+
`}import T from"fs";import K from"path";var gt=".stx/story/presets.json",R=1,yt=10;class I{storage;storagePath;dirty=!1;constructor(t){this.storagePath=K.join(t,gt),this.storage=this.loadStorage()}loadStorage(){try{let t=T.readFileSync(this.storagePath,"utf-8"),e=JSON.parse(t);if(e.version!==R)return this.migrateStorage(e);return e}catch{return{version:R,presets:[],recentIds:[]}}}migrateStorage(t){return{version:R,presets:t.presets||[],recentIds:t.recentIds||[]}}async save(){if(!this.dirty)return;let t=K.dirname(this.storagePath);await T.promises.mkdir(t,{recursive:!0}),await T.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}createPreset(t,e,r={}){let s={id:ht(),name:t,description:r.description,props:e,componentId:r.componentId,created:Date.now(),usageCount:0,tags:r.tags};return this.storage.presets.push(s),this.dirty=!0,s}getPreset(t){return this.storage.presets.find((e)=>e.id===t)}getAllPresets(){return[...this.storage.presets]}getPresetsForComponent(t){return this.storage.presets.filter((e)=>!e.componentId||e.componentId===t)}getRecentPresets(){return this.storage.recentIds.map((t)=>this.getPreset(t)).filter((t)=>t!==void 0)}usePreset(t){let e=this.getPreset(t);if(!e)return;return e.lastUsed=Date.now(),e.usageCount++,this.storage.recentIds=[t,...this.storage.recentIds.filter((r)=>r!==t)].slice(0,yt),this.dirty=!0,e}updatePreset(t,e){let r=this.getPreset(t);if(!r)return;return Object.assign(r,e),this.dirty=!0,r}deletePreset(t){let e=this.storage.presets.findIndex((r)=>r.id===t);if(e===-1)return!1;return this.storage.presets.splice(e,1),this.storage.recentIds=this.storage.recentIds.filter((r)=>r!==t),this.dirty=!0,!0}searchPresets(t){let e=t.toLowerCase();return this.storage.presets.filter((r)=>{if(r.name.toLowerCase().includes(e))return!0;if(r.description?.toLowerCase().includes(e))return!0;if(r.tags?.some((s)=>s.toLowerCase().includes(e)))return!0;return!1})}getMostUsedPresets(t=5){return[...this.storage.presets].sort((e,r)=>r.usageCount-e.usageCount).slice(0,t)}exportPresets(t){let e=t?this.storage.presets.filter((r)=>t.includes(r.id)):this.storage.presets;return JSON.stringify({presets:e},null,2)}importPresets(t,e=!1){let r=JSON.parse(t),s=0;for(let o of r.presets){let a=this.storage.presets.find((c)=>c.id===o.id);if(a&&!e)continue;if(a)Object.assign(a,o);else this.storage.presets.push(o);s++}if(s>0)this.dirty=!0;return s}}function ht(){return`preset-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import _ from"fs";var q=new Map;async function b(t,e,r={}){let s=performance.now(),o=[];try{let a=await _.promises.stat(e),c=q.get(e),n;if(c&&c.mtime===a.mtimeMs)n=c.content;else n=await _.promises.readFile(e,"utf-8"),q.set(e,{content:n,mtime:a.mtimeMs,analyzed:null});let{processDirectives:d}=await import("./chunk-pd0wdjqd.js"),p={},g=h(n);if(g)try{await m(g,p,e)}catch(f){o.push(`Warning: Could not extract script variables: ${f instanceof Error?f.message:String(f)}`)}if(r.props)Object.assign(p,r.props);let i=await d(n,p,e,{},new Set),l=Z(n),u=h(n);return i=Q(i),i=tt(i,p),{html:i,css:l,js:u,errors:o,duration:performance.now()-s}}catch(a){return o.push(a instanceof Error?a.message:String(a)),{html:`<div class="stx-render-error">${et(o[0])}</div>`,css:"",js:"",errors:o,duration:performance.now()-s}}}async function vt(t){try{let e=await _.promises.readFile(t,"utf-8"),r=h(e);if(!r)return null;let s={};if(await m(r,s,t),Array.isArray(s.variants))return s.variants;return null}catch{return null}}async function Y(t,e,r,s){let o=e.story?.variants;if(!o){let n=await vt(e.path);if(n)o=n}if(!o&&r==="default")return b(t,e.path,{props:s||{}});if(!o)return b(t,e.path,{props:s||{}});let a=o.find((n)=>n.id===r);if(!a&&r==="default")return b(t,e.path,{props:s||{}});if(!a)return{html:'<div class="stx-render-error">Variant not found</div>',css:"",js:"",errors:[`Variant '${r}' not found`],duration:0};let c={...a.state,...s};if(a.source)return bt(t,a.source,c);return b(t,e.path,{props:c})}async function bt(t,e,r={}){let s=performance.now(),o=[];try{let{processDirectives:a}=await import("./chunk-pd0wdjqd.js"),c={...r},n=h(e);if(n)try{await m(n,c,"inline-template.stx")}catch{}let p=await a(e,c,"inline-template.stx",{},new Set);return p=Q(p),p=tt(p,c),{html:p,css:Z(e),js:h(e),errors:o,duration:performance.now()-s}}catch(a){return o.push(a instanceof Error?a.message:String(a)),{html:`<div class="stx-render-error">${et(o[0])}</div>`,css:"",js:"",errors:o,duration:performance.now()-s}}}function Z(t){let e=[],r=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,s=r.exec(t);while(s!==null)e.push(s[1].trim()),s=r.exec(t);return e.join(`
|
|
560
560
|
`)}function Q(t){return t.replace(/<!--[\s\S]*?-->/g,"").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"").replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/^\s*\n/gm,"").trim()}function h(t){let e=[],r=/<script\b[^>]*>([\s\S]*?)<\/script>/gi,s=r.exec(t);while(s!==null)e.push(s[1].trim()),s=r.exec(t);return e.join(`
|
|
561
561
|
`)}function tt(t,e){let r=`<script>window.__stxProps = ${JSON.stringify(e)};</script>`;return t+r}function et(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}async function rt(t,e){let r=await Kt(t);pt(t,r);let s=Gt(t.config,r);ft(t,s),console.log(` Found ${r.length} story files`);let o=typeof e.host==="string"?e.host:e.host===!0?"0.0.0.0":"localhost",a=new I(t.root),c=new P(t.root),n=new k(t.root),d=N(),p=Bun.serve({port:e.port,hostname:o,fetch:async(i,l)=>{let f=new URL(i.url).pathname;if(f==="/__hmr"){if(l.upgrade(i,{data:{isHmr:!0}}))return;return new Response("WebSocket upgrade failed",{status:400})}if(f.startsWith("/api/"))return xt(t,f,i,{presetsManager:a,bookmarksManager:c,analyticsTracker:n});return wt(t,f,e.port)},websocket:{open(i){d.open(i)},close(i){d.close(i)},message(i,l){d.message(i,l)}}}),g=`http://${o}:${e.port}`,y=Qi(t,async(i,l)=>{console.log(` [${i}] ${l.relativePath}`);let u=await Kt(t);pt(t,u);let f=Gt(t.config,u);if(ft(t,f),i==="add")H(l.id,{fileName:l.fileName});else if(i==="unlink")O(l.id);else V(l.id,{fileName:l.fileName})});if(e.open){let i=g;try{let{exec:l}=await import("child_process"),u=process.platform;l(`${u==="darwin"?"open":u==="win32"?"start":"xdg-open"} ${i}`)}catch{}}return{server:p,url:g,close:async()=>{y(),p.stop()}}}async function xt(t,e,r,s){let{presetsManager:o,bookmarksManager:a,analyticsTracker:c}=s;if(e==="/api/stories")return Response.json({files:t.storyFiles.map((n)=>({id:n.id,fileName:n.fileName,relativePath:n.relativePath,treePath:n.treePath})),tree:t.tree});if(e.startsWith("/api/story/")){let n=e.slice(11),d=t.storyFiles.find((p)=>p.id===n);if(!d)return new Response("Story not found",{status:404});try{let p=await Bun.file(d.path).text();return Response.json({id:d.id,fileName:d.fileName,relativePath:d.relativePath,content:p})}catch{return new Response("Error reading story",{status:500})}}if(e==="/api/config")return Response.json({theme:t.config.theme,responsivePresets:t.config.responsivePresets,backgroundPresets:t.config.backgroundPresets});if(e.startsWith("/api/render/")){let n=new URL(r.url),d=e.slice(12).split("/"),p=d[0],g=d[1]||"default",y,i=n.searchParams.get("props");if(i)try{y=JSON.parse(i)}catch{}let l=t.storyFiles.find((u)=>u.id===p);if(!l)return new Response("Story not found",{status:404});try{let u=await Y(t,l,g,y);return Response.json({html:u.html,css:u.css,js:u.js,errors:u.errors,duration:u.duration})}catch(u){return Response.json({html:"",css:"",js:"",errors:[u instanceof Error?u.message:String(u)],duration:0},{status:500})}}if(e==="/api/presets"&&r.method==="GET")return Response.json({presets:o.getAllPresets()});if(e==="/api/presets"&&r.method==="POST")try{let n=await r.json(),d=o.createPreset(n.name,n.props,{componentId:n.componentId,description:n.description});return await o.save(),Response.json(d)}catch(n){return Response.json({error:String(n)},{status:400})}if(e.startsWith("/api/presets/")&&!e.includes("/use")&&r.method==="GET"){let n=e.slice(13),d=o.getPreset(n);if(!d)return new Response("Preset not found",{status:404});return Response.json(d)}if(e.endsWith("/use")&&r.method==="POST"){let n=e.slice(13,-4),d=o.usePreset(n);if(!d)return new Response("Preset not found",{status:404});return await o.save(),Response.json(d)}if(e.startsWith("/api/presets/")&&r.method==="DELETE"){let n=e.slice(13);if(!o.deletePreset(n))return new Response("Preset not found",{status:404});return await o.save(),Response.json({success:!0})}if(e==="/api/bookmarks"&&r.method==="GET")return Response.json({bookmarks:a.getAllBookmarks()});if(e==="/api/bookmarks"&&r.method==="POST")try{let n=await r.json(),d=a.addBookmark(n.storyId,n.variantId,n.props,{name:n.name,notes:n.notes,color:n.color});return await a.save(),Response.json(d)}catch(n){return Response.json({error:String(n)},{status:400})}if(e==="/api/bookmarks/toggle"&&r.method==="POST")try{let n=await r.json(),d=a.toggleBookmark(n.storyId,n.variantId,n.props);return await a.save(),Response.json(d)}catch(n){return Response.json({error:String(n)},{status:400})}if(e.startsWith("/api/bookmarks/")&&e!=="/api/bookmarks/toggle"&&r.method==="GET"){let n=e.slice(15),d=a.getBookmark(n);if(!d)return new Response("Bookmark not found",{status:404});return Response.json(d)}if(e.startsWith("/api/bookmarks/")&&r.method==="DELETE"){let n=e.slice(15);if(!a.deleteBookmark(n))return new Response("Bookmark not found",{status:404});return await a.save(),Response.json({success:!0})}if(e==="/api/analytics/track"&&r.method==="POST")try{let n=await r.json();if(n.type==="view"&&n.componentId)c.trackView(n.componentId,n.variantId);else if(n.type==="prop_change"&&n.componentId&&n.propName)c.trackPropChange(n.componentId,n.propName,null);else if(n.type==="variant_switch"&&n.componentId&&n.variantId)c.trackVariantSwitch(n.componentId,n.variantId);else if(n.type==="search"&&n.query)c.trackSearch(n.query,0);return await c.save(),Response.json({success:!0})}catch(n){return Response.json({error:String(n)},{status:400})}if(e==="/api/analytics/summary"&&r.method==="GET")return Response.json({mostViewed:c.getMostViewedComponents(10),mostChangedProps:c.getMostChangedProps(10),searchAnalytics:c.getSearchAnalytics()});if(e.startsWith("/api/analytics/component/")&&r.method==="GET"){let n=e.slice(25),d=t.storyFiles.find((g)=>g.id===n),p=c.getComponentAnalytics(n,d?.fileName||n);return Response.json(p)}return new Response("Not found",{status:404})}function wt(t,e,r){let s=kt(t,r);return new Response(s,{headers:{"Content-Type":"text/html; charset=utf-8"}})}function kt(t,e){let{theme:r}=t.config,s=r.title||"STX Story",o=`ws://localhost:${e}/__hmr`,a=F(o);return`<!DOCTYPE html>
|
|
562
562
|
<html lang="en" class="${r.darkClass||"dark"}">
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{or,i}from"./chunk-1pavg6q5.js";import"./chunk-cm5kpn54.js";import"./chunk-d5m6xy9p.js";import"./chunk-t5q31st4.js";import"./chunk-e0dgx3ev.js";import"./chunk-332qk8tm.js";import"./chunk-tn9h4prj.js";import"./chunk-m710wkr4.js";import"./chunk-w7dks1ev.js";import{ve}from"./chunk-te090fxv.js";import"./chunk-833y1ndd.js";import"./chunk-7x6aqvfe.js";import"./chunk-c1dkvqr5.js";import"./chunk-tt3jxdy5.js";import"./chunk-jtccqpwa.js";import"./chunk-2rg9pqmh.js";import"./chunk-0rszcb0m.js";import"./chunk-8cvgm13s.js";import{Ne,Ws,qs}from"./chunk-r53tqxmq.js";import"./chunk-n2z4kyba.js";import"./chunk-v4bqmzj9.js";import"./chunk-k47addf7.js";import"./chunk-xppm4cs4.js";import"./chunk-agbkv9ab.js";export{or as buildModulesTag,ve as injectRouterScript,i as processDirectives,Ws as processJsonDirective,qs as processOnceDirective,Ne as validateClientScript};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{wn,ig,ag,cg,lg,ug,m,dg,vi,pg,Zc,Qc}from"./chunk-
|
|
2
|
+
import{wn,ig,ag,cg,lg,ug,m,dg,vi,pg,Zc,Qc}from"./chunk-r53tqxmq.js";import"./chunk-n2z4kyba.js";import"./chunk-v4bqmzj9.js";import"./chunk-k47addf7.js";import"./chunk-xppm4cs4.js";import"./chunk-agbkv9ab.js";export{wn as STX_ENGINE_BINDING_NAMES,vi as convertToCommonJS,Zc as extractScriptFromTemplate,m as extractVariables,Qc as hasVariables,dg as isCompleteImport,ug as isMissingBindingFailure,cg as isModuleResolutionFailure,lg as isSyntaxFailure,pg as splitDeclaration,ig as stripTypeScript,ag as withoutStxReferrer};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{He,Cn,Xs,$i,M}from"./chunk-v4bqmzj9.js";import{_n}from"./chunk-ezzskm4a.js";import{Lr,k,yl,lt,Di,bl}from"./chunk-agbkv9ab.js";import{I}from"./chunk-xppm4cs4.js";import{R,_,Js,u,f,Ft,d,K,z,x,eo,Ce,Ue,to}from"./chunk-k47addf7.js";import{r,me}from"./chunk-qev14f76.js";import{g}from"./chunk-0dve54ne.js";import{G}from"./chunk-ym5qgw03.js";import ct from"path";import Wt from"process";import{AsyncLocalStorage as da}from"async_hooks";var Or=new da;function bn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function Dr(e,t){return Or.run(bn(e),t)}async function Mr(e,t){let n=Or.getStore();if(!n)throw Error("useServerData must run inside a <script server> render");if(typeof e!=="string"||!e.trim())throw TypeError("useServerData requires a non-empty string key");let i=n.pending.get(e);if(i)return i;let a=Promise.resolve().then(t).then((l)=>{let c=JSON.stringify(l,(v,T)=>{if(T===void 0||typeof T==="function"||typeof T==="symbol"||typeof T==="bigint"||typeof T==="number"&&!Number.isFinite(T))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(T&&typeof T==="object"&&!Array.isArray(T)&&Object.getPrototypeOf(T)!==Object.prototype&&Object.getPrototypeOf(T)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return T}),b=JSON.parse(c);return n.values.set(e,b),b}).catch((l)=>{throw n.pending.delete(e),l});return n.pending.set(e,a),a}function $r(e){let t=e.__stx_server_data;if(!t?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(t.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function V(e,t=!1){let n=r(e),i=[],a=new Set,l=0,c=0,b=n.length,v=()=>{if(l!==0)return;let T=n.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(T){if(t&&T[1]==="const")return;let L=T[2];if(!a.has(L))i.push(L),a.add(L);return}let P=n.slice(c).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(P){if(t&&n.slice(c).startsWith("const"))return;P[1].split(",").forEach((L)=>{let F=L.trim();if(!F)return;let B=F.indexOf(":"),X=(B>=0?F.slice(B+1).trim():F).split(/[\s=]/)[0];if(X&&!a.has(X))i.push(X),a.add(X)});return}let D=n.slice(c).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(D){if(t&&n.slice(c).startsWith("const"))return;D[1].split(",").forEach((L)=>{let F=L.trim().replace(/^\.\.\./,"");if(!F)return;let B=F.split(/[\s=]/)[0];if(B&&!a.has(B))i.push(B),a.add(B)});return}if(t)return;let H=n.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let L=H[1];if(!a.has(L))i.push(L),a.add(L);return}let O=n.slice(c).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let L=O[1];if(!a.has(L))i.push(L),a.add(L)}};while(c<b){if(n[c]==="{"){l++,c++;continue}if(n[c]==="}"){l--,c++;continue}if(l===0&&/[a-z]/i.test(n[c])&&(c===0||/\s|[;{}()]/.test(n[c-1])))v();c++}return i.join(", ")}function Ms(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function ga(e,t=V(e).split(",").map((n)=>n.trim()).filter(Boolean)){let n=new Set(V(e,!0).split(",").map((i)=>i.trim()));return t.map((i)=>n.has(i)?`get ${i}() { return ${i} }, set ${i}(__stxValue_${i}) { ${i} = __stxValue_${i} }`:i).join(", ")}function Ds(e,t){let n=`{ ${ga(e,t)} }`;return V(e).split(",").some((i)=>i.trim()==="__stxLiveBindings")?`Object.defineProperties(${n}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:n}import jt from"fs";import ve from"path";function U(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var jr=new Map;function xr(e,t=!0){let n=jr.get(e);if(t&&n)return n;let i=new Map,a=[ve.join(e,"src"),ve.join(e,"dist"),e];function l(c,b){if(b>6)return;let v;try{v=jt.readdirSync(c,{withFileTypes:!0})}catch{return}for(let T of v){let P=ve.join(c,T.name);if(T.isDirectory()){if(T.name==="node_modules"||T.name.startsWith("."))continue;l(P,b+1)}else if(T.isFile()&&T.name.endsWith(".stx")){let D=T.name.slice(0,-4);if(!i.has(D))i.set(D,P);let H=D.toLowerCase();if(!i.has(H))i.set(H,P);let O=U(D);if(!i.has(O))i.set(O,P)}}}for(let c of a)if(l(c,0),i.size>0)break;if(t)jr.set(e,i);return i}function Ls(e,t){if(e.startsWith(".")||e.startsWith("/"))return null;let n=t;while(!0){let i=ve.join(n,"node_modules",e);try{if(jt.statSync(i).isDirectory())return i}catch{}let a=ve.dirname(n);if(a===n)return null;n=a}}function js(e,t,n={}){return[ve.resolve(ve.dirname(t),`${e}.stx`),ve.resolve(ve.dirname(t),e),ve.resolve(n.componentsDir||"components",`${e}.stx`),ve.resolve(n.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function Nr(e){let t=e.endsWith(".stx")?e.slice(0,-4):e,n=t.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),i=U(t);return[t,n,i]}function ui(e,t){let[n,i,a]=Nr(e);for(let l of[n,n.toLowerCase(),i,a]){let c=t?.__importedComponents?.get(l);if(c!==void 0)return c}}function ma(e,t){let n=t?ve.resolve(t):void 0,i=ve.dirname(ve.resolve(e));for(;;){if(jt.existsSync(ve.join(i,"package.json")))return n&&i===n?void 0:i;let a=ve.dirname(i);if(a===i)return;i=a}}var ha=["src/ui","src/components","components","dist"];function Ln(e,t){let n=ve.resolve(e);if(!t&&!n.split(ve.sep).includes("node_modules"))return[];let i=ma(n,t);if(!i)return[];let a=[];try{let b=JSON.parse(jt.readFileSync(ve.join(i,"package.json"),"utf8")).stx?.components;if(Array.isArray(b))a=b.filter((v)=>typeof v==="string")}catch{}let l=a.length?a:ha;return[ve.dirname(ve.resolve(e)),...l.map((c)=>ve.resolve(i,c))]}function*di(e,t,n={},i){let a=Nr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield ve.resolve(ve.dirname(t),`${a[0]}.stx`);return}let l=[...new Set(a.map((v)=>`${v}.stx`))],c=n.projectRoot||process.cwd(),b=[...Ln(t,n.projectRoot),...i?.__originalFilePath?[ve.join(ve.dirname(i.__originalFilePath),"components")]:[],...n.componentsDir?[n.componentsDir]:[],ve.join(ve.dirname(t),"components"),ve.resolve(c,"src/components"),ve.resolve(c,"components"),...import.meta.dir?[ve.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(b)){for(let T of l)yield ve.join(v,T);try{for(let T of jt.readdirSync(v,{withFileTypes:!0}))if(T.isDirectory())for(let P of l)yield ve.join(v,T.name,P)}catch{}}}function zr(e,t,n={},i){let a=ui(e,i);if(a!==void 0)return a;for(let l of di(e,t,n,i))try{if(jt.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function Bs(e,t=[],n={}){let i=new Set([...e].map((T)=>T.replace(/[-_]/g,"").toLowerCase()));if(!i.has("src")&&!i.has("source")||!i.has("alt")&&!i.has("decorative"))return!1;let a=new Map(Object.entries(n).map(([T,P])=>[T.replace(/[-_]/g,"").toLowerCase(),P])),l=a.get("alt"),c=a.get("decorative"),b=typeof l==="string"&&!!l.trim(),v=typeof c==="string"?!["false","0","off","no"].includes(c.trim().toLowerCase()):Boolean(c);if(!b&&!v)return!1;if(["defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((T)=>i.has(T)))return!1;if([...t].some((T)=>!["load","error"].includes(T.replace(/^@/,"").split(".")[0].toLowerCase())))return!1;if(i.has("resizemode")&&(i.has("fit")||i.has("objectfit")))return!1;if(i.has("src")&&i.has("source"))return!1;return["fit","objectfit","resizemode","position","objectposition","rounded","aspectratio","zoomonhover","sources","webpsrc","webpsrcset"].some((T)=>i.has(T))}import rs from"fs";import ce from"path";import $t from"path";import tn from"fs";var xa=new Set(["touchstart","touchmove","wheel","mousewheel"]);function bs(e,t){if(t.passive)return!0;if(t.prevent||t.nonpassive)return!1;return xa.has(e.toLowerCase())}var Br=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),Wr={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},ba=new Set(["ctrl","alt","shift","meta"]),Ur={left:0,middle:1,right:2};function Fr(e){let t={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let n of e){let i=n.toLowerCase();if(i==="prevent")t.prevent=!0;else if(i==="stop")t.stop=!0;else if(i==="once")t.once=!0;else if(i==="capture")t.capture=!0;else if(i==="self")t.self=!0;else if(i==="passive")t.passive=!0;else if(i==="nonpassive")t.nonpassive=!0;else if(ba.has(i))t.systemKeys.push(i);else if(i in Ur)t.mouse=i;else if(i in Wr||/^[a-z]$/.test(i))t.keys.push(Wr[i]||i.toUpperCase());else if(i.startsWith("debounce")){let a=i.match(/debounce(?:\.(\d+))?/);t.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(i.startsWith("throttle")){let a=i.match(/throttle(?:\.(\d+))?/);t.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return t}function Hr(e,t=""){let n=[],i=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=a.exec(e))!==null){let[c,b,v]=l,T=l.index,P=T+c.length,D=`__stx_evt_${t}${i++}`,H=[],O=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,L;while((L=O.exec(v))!==null){let[,B,ee]=L,X=B.split("."),j=X[0];if(!Br.has(j))continue;H.push({attribute:`@${B}`,event:j,handler:ee,modifiers:Fr(X.slice(1)),elementId:D})}let F=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((L=F.exec(v))!==null){let[,B,ee]=L,X=B.split("."),j=X[0];if(!Br.has(j))continue;H.push({attribute:`@${B}`,event:j,handler:ee,modifiers:Fr(X.slice(1)),elementId:D})}if(H.length>0)n.push({originalTag:c,elementId:D,events:H,startIndex:T,endIndex:P})}return n}function ya(e){let t=[],{modifiers:n}=e;if(n.self)t.push("if ($event.target !== $el) return");for(let i of n.systemKeys)t.push(`if (!$event.${i}Key) return`);if(n.keys.length>0){let i=n.keys.map((a)=>`$event.key === '${a}'`).join(" || ");t.push(`if (!(${i})) return`)}if(n.mouse!==null){let i=Ur[n.mouse];t.push(`if ($event.button !== ${i}) return`)}if(n.prevent)t.push("$event.preventDefault()");if(n.stop)t.push("$event.stopPropagation()");return t.join("; ")}function _a(e,t){let n=e;if(t.debounce!==null)n=`__stx_debounce(() => { ${n} }, ${t.debounce})`;else if(t.throttle!==null)n=`__stx_throttle(() => { ${n} }, ${t.throttle})`;return n}function ys(e){let t=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(t))return e;return`if (typeof ${t} === 'function' && !${t}._isSignal) ${t}($event);`}function wa(e){let{modifiers:t}=e,n=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),i=ya(e),a=_a(ys(e.handler),t),l=[];if(t.once)l.push("once: true");if(t.capture)l.push("capture: true");if(bs(e.event,t))l.push("passive: true");let c=l.length>0?`, { ${l.join(", ")} }`:"",b=a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
|
|
2
|
+
import{He,Cn,Xs,$i,M}from"./chunk-v4bqmzj9.js";import{_n}from"./chunk-n2z4kyba.js";import{Lr,k,yl,lt,Di,bl}from"./chunk-agbkv9ab.js";import{I}from"./chunk-xppm4cs4.js";import{R,_,Js,u,f,Ft,d,K,z,x,eo,Ce,Ue,to}from"./chunk-k47addf7.js";import{r,me}from"./chunk-qev14f76.js";import{g}from"./chunk-0dve54ne.js";import{G}from"./chunk-ym5qgw03.js";import ct from"path";import Wt from"process";import{AsyncLocalStorage as da}from"async_hooks";var Or=new da;function bn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function Dr(e,t){return Or.run(bn(e),t)}async function Mr(e,t){let n=Or.getStore();if(!n)throw Error("useServerData must run inside a <script server> render");if(typeof e!=="string"||!e.trim())throw TypeError("useServerData requires a non-empty string key");let i=n.pending.get(e);if(i)return i;let a=Promise.resolve().then(t).then((l)=>{let c=JSON.stringify(l,(v,T)=>{if(T===void 0||typeof T==="function"||typeof T==="symbol"||typeof T==="bigint"||typeof T==="number"&&!Number.isFinite(T))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(T&&typeof T==="object"&&!Array.isArray(T)&&Object.getPrototypeOf(T)!==Object.prototype&&Object.getPrototypeOf(T)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return T}),b=JSON.parse(c);return n.values.set(e,b),b}).catch((l)=>{throw n.pending.delete(e),l});return n.pending.set(e,a),a}function $r(e){let t=e.__stx_server_data;if(!t?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(t.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function V(e,t=!1){let n=r(e),i=[],a=new Set,l=0,c=0,b=n.length,v=()=>{if(l!==0)return;let T=n.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(T){if(t&&T[1]==="const")return;let L=T[2];if(!a.has(L))i.push(L),a.add(L);return}let P=n.slice(c).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(P){if(t&&n.slice(c).startsWith("const"))return;P[1].split(",").forEach((L)=>{let F=L.trim();if(!F)return;let B=F.indexOf(":"),X=(B>=0?F.slice(B+1).trim():F).split(/[\s=]/)[0];if(X&&!a.has(X))i.push(X),a.add(X)});return}let D=n.slice(c).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(D){if(t&&n.slice(c).startsWith("const"))return;D[1].split(",").forEach((L)=>{let F=L.trim().replace(/^\.\.\./,"");if(!F)return;let B=F.split(/[\s=]/)[0];if(B&&!a.has(B))i.push(B),a.add(B)});return}if(t)return;let H=n.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let L=H[1];if(!a.has(L))i.push(L),a.add(L);return}let O=n.slice(c).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let L=O[1];if(!a.has(L))i.push(L),a.add(L)}};while(c<b){if(n[c]==="{"){l++,c++;continue}if(n[c]==="}"){l--,c++;continue}if(l===0&&/[a-z]/i.test(n[c])&&(c===0||/\s|[;{}()]/.test(n[c-1])))v();c++}return i.join(", ")}function Ms(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function ga(e,t=V(e).split(",").map((n)=>n.trim()).filter(Boolean)){let n=new Set(V(e,!0).split(",").map((i)=>i.trim()));return t.map((i)=>n.has(i)?`get ${i}() { return ${i} }, set ${i}(__stxValue_${i}) { ${i} = __stxValue_${i} }`:i).join(", ")}function Ds(e,t){let n=`{ ${ga(e,t)} }`;return V(e).split(",").some((i)=>i.trim()==="__stxLiveBindings")?`Object.defineProperties(${n}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:n}import jt from"fs";import ve from"path";function U(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var jr=new Map;function xr(e,t=!0){let n=jr.get(e);if(t&&n)return n;let i=new Map,a=[ve.join(e,"src"),ve.join(e,"dist"),e];function l(c,b){if(b>6)return;let v;try{v=jt.readdirSync(c,{withFileTypes:!0})}catch{return}for(let T of v){let P=ve.join(c,T.name);if(T.isDirectory()){if(T.name==="node_modules"||T.name.startsWith("."))continue;l(P,b+1)}else if(T.isFile()&&T.name.endsWith(".stx")){let D=T.name.slice(0,-4);if(!i.has(D))i.set(D,P);let H=D.toLowerCase();if(!i.has(H))i.set(H,P);let O=U(D);if(!i.has(O))i.set(O,P)}}}for(let c of a)if(l(c,0),i.size>0)break;if(t)jr.set(e,i);return i}function Ls(e,t){if(e.startsWith(".")||e.startsWith("/"))return null;let n=t;while(!0){let i=ve.join(n,"node_modules",e);try{if(jt.statSync(i).isDirectory())return i}catch{}let a=ve.dirname(n);if(a===n)return null;n=a}}function js(e,t,n={}){return[ve.resolve(ve.dirname(t),`${e}.stx`),ve.resolve(ve.dirname(t),e),ve.resolve(n.componentsDir||"components",`${e}.stx`),ve.resolve(n.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function Nr(e){let t=e.endsWith(".stx")?e.slice(0,-4):e,n=t.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),i=U(t);return[t,n,i]}function ui(e,t){let[n,i,a]=Nr(e);for(let l of[n,n.toLowerCase(),i,a]){let c=t?.__importedComponents?.get(l);if(c!==void 0)return c}}function ma(e,t){let n=t?ve.resolve(t):void 0,i=ve.dirname(ve.resolve(e));for(;;){if(jt.existsSync(ve.join(i,"package.json")))return n&&i===n?void 0:i;let a=ve.dirname(i);if(a===i)return;i=a}}var ha=["src/ui","src/components","components","dist"];function Ln(e,t){let n=ve.resolve(e);if(!t&&!n.split(ve.sep).includes("node_modules"))return[];let i=ma(n,t);if(!i)return[];let a=[];try{let b=JSON.parse(jt.readFileSync(ve.join(i,"package.json"),"utf8")).stx?.components;if(Array.isArray(b))a=b.filter((v)=>typeof v==="string")}catch{}let l=a.length?a:ha;return[ve.dirname(ve.resolve(e)),...l.map((c)=>ve.resolve(i,c))]}function*di(e,t,n={},i){let a=Nr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield ve.resolve(ve.dirname(t),`${a[0]}.stx`);return}let l=[...new Set(a.map((v)=>`${v}.stx`))],c=n.projectRoot||process.cwd(),b=[...Ln(t,n.projectRoot),...i?.__originalFilePath?[ve.join(ve.dirname(i.__originalFilePath),"components")]:[],...n.componentsDir?[n.componentsDir]:[],ve.join(ve.dirname(t),"components"),ve.resolve(c,"src/components"),ve.resolve(c,"components"),...import.meta.dir?[ve.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(b)){for(let T of l)yield ve.join(v,T);try{for(let T of jt.readdirSync(v,{withFileTypes:!0}))if(T.isDirectory())for(let P of l)yield ve.join(v,T.name,P)}catch{}}}function zr(e,t,n={},i){let a=ui(e,i);if(a!==void 0)return a;for(let l of di(e,t,n,i))try{if(jt.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function Bs(e,t=[],n={}){let i=new Set([...e].map((T)=>T.replace(/[-_]/g,"").toLowerCase()));if(!i.has("src")&&!i.has("source")||!i.has("alt")&&!i.has("decorative"))return!1;let a=new Map(Object.entries(n).map(([T,P])=>[T.replace(/[-_]/g,"").toLowerCase(),P])),l=a.get("alt"),c=a.get("decorative"),b=typeof l==="string"&&!!l.trim(),v=typeof c==="string"?!["false","0","off","no"].includes(c.trim().toLowerCase()):Boolean(c);if(!b&&!v)return!1;if(["defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((T)=>i.has(T)))return!1;if([...t].some((T)=>!["load","error"].includes(T.replace(/^@/,"").split(".")[0].toLowerCase())))return!1;if(i.has("resizemode")&&(i.has("fit")||i.has("objectfit")))return!1;if(i.has("src")&&i.has("source"))return!1;return["fit","objectfit","resizemode","position","objectposition","rounded","aspectratio","zoomonhover","sources","webpsrc","webpsrcset"].some((T)=>i.has(T))}import rs from"fs";import ce from"path";import $t from"path";import tn from"fs";var xa=new Set(["touchstart","touchmove","wheel","mousewheel"]);function bs(e,t){if(t.passive)return!0;if(t.prevent||t.nonpassive)return!1;return xa.has(e.toLowerCase())}var Br=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),Wr={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},ba=new Set(["ctrl","alt","shift","meta"]),Ur={left:0,middle:1,right:2};function Fr(e){let t={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let n of e){let i=n.toLowerCase();if(i==="prevent")t.prevent=!0;else if(i==="stop")t.stop=!0;else if(i==="once")t.once=!0;else if(i==="capture")t.capture=!0;else if(i==="self")t.self=!0;else if(i==="passive")t.passive=!0;else if(i==="nonpassive")t.nonpassive=!0;else if(ba.has(i))t.systemKeys.push(i);else if(i in Ur)t.mouse=i;else if(i in Wr||/^[a-z]$/.test(i))t.keys.push(Wr[i]||i.toUpperCase());else if(i.startsWith("debounce")){let a=i.match(/debounce(?:\.(\d+))?/);t.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(i.startsWith("throttle")){let a=i.match(/throttle(?:\.(\d+))?/);t.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return t}function Hr(e,t=""){let n=[],i=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=a.exec(e))!==null){let[c,b,v]=l,T=l.index,P=T+c.length,D=`__stx_evt_${t}${i++}`,H=[],O=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,L;while((L=O.exec(v))!==null){let[,B,ee]=L,X=B.split("."),j=X[0];if(!Br.has(j))continue;H.push({attribute:`@${B}`,event:j,handler:ee,modifiers:Fr(X.slice(1)),elementId:D})}let F=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((L=F.exec(v))!==null){let[,B,ee]=L,X=B.split("."),j=X[0];if(!Br.has(j))continue;H.push({attribute:`@${B}`,event:j,handler:ee,modifiers:Fr(X.slice(1)),elementId:D})}if(H.length>0)n.push({originalTag:c,elementId:D,events:H,startIndex:T,endIndex:P})}return n}function ya(e){let t=[],{modifiers:n}=e;if(n.self)t.push("if ($event.target !== $el) return");for(let i of n.systemKeys)t.push(`if (!$event.${i}Key) return`);if(n.keys.length>0){let i=n.keys.map((a)=>`$event.key === '${a}'`).join(" || ");t.push(`if (!(${i})) return`)}if(n.mouse!==null){let i=Ur[n.mouse];t.push(`if ($event.button !== ${i}) return`)}if(n.prevent)t.push("$event.preventDefault()");if(n.stop)t.push("$event.stopPropagation()");return t.join("; ")}function _a(e,t){let n=e;if(t.debounce!==null)n=`__stx_debounce(() => { ${n} }, ${t.debounce})`;else if(t.throttle!==null)n=`__stx_throttle(() => { ${n} }, ${t.throttle})`;return n}function ys(e){let t=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(t))return e;return`if (typeof ${t} === 'function' && !${t}._isSignal) ${t}($event);`}function wa(e){let{modifiers:t}=e,n=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),i=ya(e),a=_a(ys(e.handler),t),l=[];if(t.once)l.push("once: true");if(t.capture)l.push("capture: true");if(bs(e.event,t))l.push("passive: true");let c=l.length>0?`, { ${l.join(", ")} }`:"",b=a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
|
|
3
3
|
(function() {
|
|
4
4
|
var $el = document.getElementById('${n}');
|
|
5
5
|
if (!$el) return;
|
|
@@ -112,7 +112,7 @@ else {
|
|
|
112
112
|
`)}
|
|
113
113
|
})();
|
|
114
114
|
</script>`}function Sa(e,t=""){let n=Hr(e,t);if(n.length===0)return{template:e,bindings:[]};let i=e,a=[];for(let l=n.length-1;l>=0;l--){let c=n[l],b=c.originalTag;if(!b.includes(" id="))b=b.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${c.elementId}"`);else{let v=b.match(/id=["']([^"']+)["']/);if(v)for(let T of c.events)T.elementId=v[1]}for(let v of c.events){let T=v.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),P=new RegExp(`\\s*${T}\\s*=\\s*"[^"]*"`,"g"),D=new RegExp(`\\s*${T}\\s*=\\s*'[^']*'`,"g");b=b.replace(P,""),b=b.replace(D,"")}i=i.slice(0,c.startIndex)+b+i.slice(c.endIndex),a.push(...c.events)}return{template:i,bindings:a}}function Vr(e){let t=e.$uid;return typeof t==="string"&&t?`${t}_`:""}function Mc(e,t,n){if(bl(e))return e;if(t.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:b,bindings:v}=Sa(e,Vr(t)),T=t.__stx_event_bindings||[];return t.__stx_event_bindings=[...T,...v],b}let i=Hr(e,Vr(t));if(i.length===0)return e;let a=e;for(let b=i.length-1;b>=0;b--){let v=i[b],T=v.originalTag;if(!T.includes(" id="))T=T.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${v.elementId}"`);else{let P=T.match(/id=["']([^"']+)["']/);if(P)for(let D of v.events)D.elementId=P[1]}for(let P of v.events){let D=P.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),H=new RegExp(`\\s*${D}\\s*=\\s*"[^"]*"`,"g"),O=new RegExp(`\\s*${D}\\s*=\\s*'[^']*'`,"g");T=T.replace(H,""),T=T.replace(O,"")}a=a.slice(0,v.startIndex)+T+a.slice(v.endIndex)}let l=pi(i.flatMap((b)=>b.events)),c=a.lastIndexOf("</body>");if(c!==-1)a=a.slice(0,c)+l+`
|
|
115
|
-
`+a.slice(c);else a+=l;return a}function qr(e,t){let n=new Set;for(let i of e.split(",")){let a=i.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(t){let l=a.lastIndexOf(":");if(l!==-1)a=a.slice(l+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))n.add(a)}return n}function Pt(e,t){let n=r(e),{depths:i,balanced:a}=me(n),l=(b)=>!a||i[b]===0,c=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${t}\\b)`,"g");for(let b of n.matchAll(c)){let v=(b.index??0)+b[0].length-b[1].length;if(l(v))return!0}for(let b of n.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(b.index??0)&&qr(b[1],!0).has(t))return!0;for(let b of n.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(b.index??0)&&qr(b[1],!1).has(t))return!0;return!1}var Zr=new R(32,{maxBytes:2097152,sizeOf:(e)=>e.code.length*4}),yt=/^[A-Za-z_$][\w$]*$/,$a=new Set(["if","for","while","switch","with"]),Kr=["(","[","{"],Xr=[")","]","}"],va=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function Ea(e){let t=r(e),n=[];for(let i of t.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=i.index??0;n.push({text:i[0],start:a,end:a+i[0].length})}return{code:t,tokens:n}}function _s(e){let t=Zr.get(e);if(t)return t;let{code:n,tokens:i}=Ea(e),a=new Map,l=[];for(let B=0;B<i.length;B++){let ee=i[B].text;if(["(","[","{"].includes(ee))l.push(B);else if([")","]","}"].includes(ee)){let X=l.at(-1);if(X!==void 0&&["()","[]","{}"].includes(i[X].text+ee))l.pop(),a.set(X,B),a.set(B,X)}}function c(B,ee){let X=[],j=B;for(let te=B;te<ee;te++){if(["(","[","{"].includes(i[te].text)&&(a.get(te)??ee)<ee){te=a.get(te);continue}if(i[te].text===",")X.push([j,te]),j=te+1}return X.push([j,ee]),X}let b=[];function v(B,ee,X,j=!1){if(i[B]?.text==="...")B++;if(B>=ee)return;let te=i[B].text;if(yt.test(te)){if(X.add(te),X===D)b.push({name:te,token:B,functionScoped:j});return}if(te!=="{"&&te!=="[")return;let se=a.get(B);if(se===void 0||se>=ee)return;for(let[ne,ue]of c(B+1,se)){let ye=ne;if(te==="{")for(let de=ne;de<ue;de++){if(i[de].text===":"){ye=de+1;break}if(i[de].text==="=")break;if(["(","[","{"].includes(i[de].text)&&a.has(de))de=a.get(de)}v(ye,ue,X,j)}}function T(B,ee){let X=new Set;for(let[j,te]of c(B,ee))v(j,te,X);return X}function P(B){let ee=B;for(;ee<i.length;ee++){let X=i[ee].text;if(["(","[","{"].includes(X)&&a.has(ee)){ee=a.get(ee);continue}if([",",";",")","]","}"].includes(X))break}return i[Math.max(B,ee-1)]?.end??n.length}let D=new Set,H=[];for(let B=0;B<i.length;B++)if(i[B].text==="=>"){let ee=B-1,X=ee,j;if(i[ee]?.text===")"&&a.has(ee))X=a.get(ee),j=T(X+1,ee);else if(i[ee]&&yt.test(i[ee].text))j=new Set([i[ee].text]);else continue;let te=B+1,se=i[te]?.text==="{"&&a.has(te)?i[a.get(te)].end:P(te);H.push({start:i[X].start,end:se,bodyStart:i[te]?.start??se,functionBody:!0,names:j})}else if(i[B].text==="("&&a.has(B)){let ee=i[B-1]?.text;if(!ee||$a.has(ee)||!yt.test(ee)&&ee!=="*"&&ee!=="]")continue;let X=a.get(B),j=X+1;if(i[j]?.text===":"){j++;while(j<i.length&&!["{","=>",";","="].includes(i[j].text))j++}if(i[j]?.text!=="{"||!a.has(j))continue;H.push({start:i[B].start,end:i[a.get(j)].end,bodyStart:i[j].start,functionBody:ee!=="catch",names:T(B+1,X)})}function O(B){let ee=B;for(;ee<i.length;ee++){let X=i[ee].text;if(Kr.includes(X)&&a.has(ee)){ee=a.get(ee);continue}if(X===";"||Xr.includes(X))break;let j=i[ee-1];if(ee>B&&va.has(X)&&j.text!==".")break;if(ee>B&&/[\n\r]/.test(n.slice(j.end,i[ee].start))&&(/^[\w$]+$/.test(j.text)||Xr.includes(j.text)||['"',"'","`"].includes(j.text))&&yt.test(X)&&!["in","of","instanceof"].includes(X))break}return ee}let L=[];for(let B=0;B<i.length;B++){if(i[B].text!=="for")continue;let ee=i[B+1]?.text==="await"?B+2:B+1;if(i[ee]?.text!=="("||!a.has(ee))continue;let X=a.get(ee),j=X+1,te=i[j]?.text==="{"&&a.has(j)?a.get(j):O(j),se=i[te]?.text===";"||i[te]?.text==="}"?i[te].end:i[Math.max(j,te-1)]?.end??n.length;L.push({headStart:ee,headEnd:X,start:i[ee].start,end:se})}for(let B=0;B<i.length;B++){let ee=i[B].text,X=i[B-1]?.text;if(X==="."||i[B+1]?.text===":")continue;if(X==="as"||X==="<")continue;if(ee==="const"||ee==="let"||ee==="var"){let j=O(B+1),te=B+1,se=!1,ne=!1,ue=0;for(let ye=B+1;ye<=j;ye++){let de=i[ye]?.text;if(ye<j&&Kr.includes(de)&&a.has(ye)&&a.get(ye)<j){ye=a.get(ye);continue}if(ye<j&&de===":"&&!ne)se=!0;else if(ye<j&&de==="="&&ue===0)se=!1,ne=!0;else if(ye<j&&se&&de==="<")ue++;else if(ye<j&&se&&de===">"&&ue>0)ue--;else if(ye===j||de===","&&ue===0)v(te,ye,D,ee==="var"),te=ye+1,se=!1,ne=!1}}else if(ee==="function"||ee==="class"){let j=B+1;if(i[j]?.text==="*")j++;if(i[j]&&yt.test(i[j].text)&&i[j].text!=="extends")D.add(i[j].text),b.push({name:i[j].text,token:j})}else if(ee==="import"){let j=B+1;if(i[j]?.text==="*"&&i[j+1]?.text==="as")j+=2;let te=i[j]?.text;if(te&&yt.test(te)&&te!=="type"&&i[j+1]?.text!=="("&&i[j+1]?.text!==".")D.add(te),b.push({name:te,token:j,file:!0});let se=i[j]?.text==="{"?j:i[j+1]?.text===","&&i[j+2]?.text==="{"?j+2:-1;if(se!==-1&&a.has(se)){let ne=a.get(se);for(let[ue,ye]of c(se+1,ne)){let de=ye-1;while(de>=ue&&!yt.test(i[de].text))de--;if(de>=ue&&i[de].text!=="type")b.push({name:i[de].text,token:de,file:!0})}}}}let F={code:n,scopes:H,loops:L,declarations:D,sites:b,tokens:i,pairs:a};return Zr.set(e,F),F}function en(e){let t=_s(e);return{code:t.code,shadows:(n,i)=>t.scopes.some((a)=>i>=a.start&&i<a.end&&a.names.has(n))}}function zn(e){return new Set(_s(e).declarations)}function Oe(e,t){let{scopes:n,loops:i,sites:a,tokens:l,pairs:c}=_s(e),b=Array.from({length:l.length},()=>-1),v=[];for(let O=0;O<l.length;O++){b[O]=v.length?v[v.length-1]:-1;let L=l[O].text;if(L==="{"&&c.has(O))v.push(O);else if(L==="}"&&v.length&&c.get(O)===v[v.length-1])v.pop()}let T=new Set,P=new Map;for(let O of a){if(!t.has(O.name))continue;T.add(O.token);let L=O.file?-1:b[O.token],F=L===-1?[0,Number.POSITIVE_INFINITY]:[l[L].start,l[c.get(L)].end];if(O.functionScoped){let ee=l[O.token].start,X=n.filter((j)=>j.functionBody&&ee>=j.bodyStart&&ee<j.end).sort((j,te)=>j.end-j.bodyStart-(te.end-te.bodyStart))[0];F=X?[X.bodyStart,X.end]:[0,Number.POSITIVE_INFINITY]}else if(!O.file){let ee=i.filter((X)=>O.token>X.headStart&&O.token<X.headEnd).sort((X,j)=>X.headEnd-X.headStart-(j.headEnd-j.headStart))[0];if(ee)F=[ee.start,ee.end]}let B=P.get(O.name);if(B)B.push(F);else P.set(O.name,[F])}let D=new Set;for(let O=0;O<l.length;O++){if(l[O].text!=="import"||l[O-1]?.text===".")continue;let L=O+1;if(l[L]?.text==="type")L++;if(l[L]&&yt.test(l[L].text)&&l[L+1]?.text===",")L+=2;if(l[L]?.text==="{"&&c.has(L))for(let F=L+1;F<c.get(L);F++)D.add(F)}let H=new Set;for(let O=0;O<l.length;O++){let L=l[O].text;if(!t.has(L)||H.has(L)||T.has(O)||D.has(O))continue;let F=l[O-1]?.text;if(F==="#"||F==="."&&l[O-2]?.text!=="..")continue;if(l[O+1]?.text===":"&&(F==="{"||F===","))continue;let B=l[O].start;if(P.get(L)?.some(([ee,X])=>B>=ee&&B<X))continue;if(n.some((ee)=>B>=ee.start&&B<ee.end&&ee.names.has(L)))continue;H.add(L)}return H}var Ie="0.2.851";var Jr=Symbol.for(`stx.lazy-module-promises.${Ie}`);function Ca(){let e=globalThis;return e[Jr]??=new Map,e[Jr]}function o(e,t){let n=Ca(),i=`${import.meta.url}\x00${e}`,a=n.get(i);if(a)return a;let l=t();return n.set(i,l),l.catch(()=>{if(n.get(i)===l)n.delete(i)}),l}var Ra=/<\/(script)/gi;function gn(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(Ra,"<\\/$1")}import Gr from"fs";var Yr=[];function w(e){let t=new R(e);return Yr.push(t),t}function Dc(){for(let e of Yr)e.clear()}function S(e,...t){return`${t.map((n)=>String(n??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function Sr(e){let t=[];for(let n of new Set(e))try{t.push({path:n,mtimeMs:Gr.statSync(n).mtimeMs})}catch{}return t}function Fs(e){for(let t of e)try{if(Gr.statSync(t.path).mtimeMs!==t.mtimeMs)return!1}catch{return!1}return!0}var Se=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useIntervalFn","useObjectUrl"];var Ta=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function Aa(e){if(e.startsWith(".")||e.startsWith("/"))return null;if(e.startsWith("@")){let n=e.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!n)return null;return{pkg:n[1],subpath:n[2]||""}}let t=e.match(/^([^/]+)(\/.*)?$/);if(!t)return null;return{pkg:t[1],subpath:t[2]||""}}function Ia(e,t){let n=t;while(!0){let i=$t.join(n,"node_modules",e,"package.json");if(tn.existsSync(i))return $t.dirname(i);let a=$t.dirname(n);if(a===n)return null;n=a}}function Pa(e,t){if(!e||typeof e!=="object")return null;let n=(a)=>{if(typeof a==="string")return a;if(a&&typeof a==="object"){if(typeof a.import==="string")return a.import;if(typeof a.default==="string")return a.default;if(typeof a.import==="object")return n(a.import);if(typeof a.default==="object")return n(a.default)}return null};if(Object.prototype.hasOwnProperty.call(e,t))return n(e[t]);let i=null;for(let a of Object.keys(e)){let l=a.indexOf("*");if(l===-1)continue;let c=a.slice(0,l),b=a.slice(l+1);if(!t.startsWith(c)||!t.endsWith(b))continue;if(t.length<c.length+b.length)continue;if(!i||c.length>i.prefix.length)i={pattern:a,prefix:c,suffix:b}}if(i){let a=t.slice(i.prefix.length,t.length-i.suffix.length),l=n(e[i.pattern]);if(l)return l.replace("*",a)}return null}function Oa(e,t){let n=Aa(e);if(!n||!n.subpath)return null;let i=Ia(n.pkg,t);if(!i)return null;let a;try{a=JSON.parse(tn.readFileSync($t.join(i,"package.json"),"utf8"))}catch{return null}let l=`.${n.subpath}`,c=Pa(a.exports,l);if(!c)return null;let b=$t.resolve(i,c);return tn.existsSync(b)?b:null}function xi(e,t){let n=t.filePath?$t.dirname(t.filePath):t.projectRoot||process.cwd(),i=t.projectRoot||process.cwd(),a=new Set,l=[],c=[];return{code:e.replace(Ta,(v,T)=>{let P;try{if(T.startsWith("./")||T.startsWith("../")||T.startsWith("/")){if(P=T.startsWith("/")?T:$t.resolve(n,T),!tn.existsSync(P))throw Error(`file not found: ${P}`)}else{let D=null;try{D=Bun.resolveSync(T,i)}catch{D=Oa(T,i)}if(!D)throw Error(`could not resolve ${T} (Bun.resolveSync + exports fallback both failed)`);P=D}}catch(D){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(T)} (from ${t.filePath||"<unknown>"}): ${D?.message||D}`),c.push(T),""}if(a.has(P))return"";a.add(P);try{let D=tn.readFileSync(P,"utf8");l.push({source:T,resolvedPath:P,contents:D})}catch(D){console.warn(`[stx:vendor-css] could not read ${P}: ${D?.message||D}`),c.push(T)}return""}),styles:l,unresolved:c}}function Da(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Si(e){if(e.length===0)return"";return`${e.map((t)=>`<style data-stx-vendor="${Da(t.source)}" data-stx-layer="vendor">
|
|
115
|
+
`+a.slice(c);else a+=l;return a}function qr(e,t){let n=new Set;for(let i of e.split(",")){let a=i.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(t){let l=a.lastIndexOf(":");if(l!==-1)a=a.slice(l+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))n.add(a)}return n}function Pt(e,t){let n=r(e),{depths:i,balanced:a}=me(n),l=(b)=>!a||i[b]===0,c=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${t}\\b)`,"g");for(let b of n.matchAll(c)){let v=(b.index??0)+b[0].length-b[1].length;if(l(v))return!0}for(let b of n.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(b.index??0)&&qr(b[1],!0).has(t))return!0;for(let b of n.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(b.index??0)&&qr(b[1],!1).has(t))return!0;return!1}var Zr=new R(32,{maxBytes:2097152,sizeOf:(e)=>e.code.length*4}),yt=/^[A-Za-z_$][\w$]*$/,$a=new Set(["if","for","while","switch","with"]),Kr=["(","[","{"],Xr=[")","]","}"],va=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function Ea(e){let t=r(e),n=[];for(let i of t.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=i.index??0;n.push({text:i[0],start:a,end:a+i[0].length})}return{code:t,tokens:n}}function _s(e){let t=Zr.get(e);if(t)return t;let{code:n,tokens:i}=Ea(e),a=new Map,l=[];for(let B=0;B<i.length;B++){let ee=i[B].text;if(["(","[","{"].includes(ee))l.push(B);else if([")","]","}"].includes(ee)){let X=l.at(-1);if(X!==void 0&&["()","[]","{}"].includes(i[X].text+ee))l.pop(),a.set(X,B),a.set(B,X)}}function c(B,ee){let X=[],j=B;for(let te=B;te<ee;te++){if(["(","[","{"].includes(i[te].text)&&(a.get(te)??ee)<ee){te=a.get(te);continue}if(i[te].text===",")X.push([j,te]),j=te+1}return X.push([j,ee]),X}let b=[];function v(B,ee,X,j=!1){if(i[B]?.text==="...")B++;if(B>=ee)return;let te=i[B].text;if(yt.test(te)){if(X.add(te),X===D)b.push({name:te,token:B,functionScoped:j});return}if(te!=="{"&&te!=="[")return;let se=a.get(B);if(se===void 0||se>=ee)return;for(let[ne,ue]of c(B+1,se)){let ye=ne;if(te==="{")for(let de=ne;de<ue;de++){if(i[de].text===":"){ye=de+1;break}if(i[de].text==="=")break;if(["(","[","{"].includes(i[de].text)&&a.has(de))de=a.get(de)}v(ye,ue,X,j)}}function T(B,ee){let X=new Set;for(let[j,te]of c(B,ee))v(j,te,X);return X}function P(B){let ee=B;for(;ee<i.length;ee++){let X=i[ee].text;if(["(","[","{"].includes(X)&&a.has(ee)){ee=a.get(ee);continue}if([",",";",")","]","}"].includes(X))break}return i[Math.max(B,ee-1)]?.end??n.length}let D=new Set,H=[];for(let B=0;B<i.length;B++)if(i[B].text==="=>"){let ee=B-1,X=ee,j;if(i[ee]?.text===")"&&a.has(ee))X=a.get(ee),j=T(X+1,ee);else if(i[ee]&&yt.test(i[ee].text))j=new Set([i[ee].text]);else continue;let te=B+1,se=i[te]?.text==="{"&&a.has(te)?i[a.get(te)].end:P(te);H.push({start:i[X].start,end:se,bodyStart:i[te]?.start??se,functionBody:!0,names:j})}else if(i[B].text==="("&&a.has(B)){let ee=i[B-1]?.text;if(!ee||$a.has(ee)||!yt.test(ee)&&ee!=="*"&&ee!=="]")continue;let X=a.get(B),j=X+1;if(i[j]?.text===":"){j++;while(j<i.length&&!["{","=>",";","="].includes(i[j].text))j++}if(i[j]?.text!=="{"||!a.has(j))continue;H.push({start:i[B].start,end:i[a.get(j)].end,bodyStart:i[j].start,functionBody:ee!=="catch",names:T(B+1,X)})}function O(B){let ee=B;for(;ee<i.length;ee++){let X=i[ee].text;if(Kr.includes(X)&&a.has(ee)){ee=a.get(ee);continue}if(X===";"||Xr.includes(X))break;let j=i[ee-1];if(ee>B&&va.has(X)&&j.text!==".")break;if(ee>B&&/[\n\r]/.test(n.slice(j.end,i[ee].start))&&(/^[\w$]+$/.test(j.text)||Xr.includes(j.text)||['"',"'","`"].includes(j.text))&&yt.test(X)&&!["in","of","instanceof"].includes(X))break}return ee}let L=[];for(let B=0;B<i.length;B++){if(i[B].text!=="for")continue;let ee=i[B+1]?.text==="await"?B+2:B+1;if(i[ee]?.text!=="("||!a.has(ee))continue;let X=a.get(ee),j=X+1,te=i[j]?.text==="{"&&a.has(j)?a.get(j):O(j),se=i[te]?.text===";"||i[te]?.text==="}"?i[te].end:i[Math.max(j,te-1)]?.end??n.length;L.push({headStart:ee,headEnd:X,start:i[ee].start,end:se})}for(let B=0;B<i.length;B++){let ee=i[B].text,X=i[B-1]?.text;if(X==="."||i[B+1]?.text===":")continue;if(X==="as"||X==="<")continue;if(ee==="const"||ee==="let"||ee==="var"){let j=O(B+1),te=B+1,se=!1,ne=!1,ue=0;for(let ye=B+1;ye<=j;ye++){let de=i[ye]?.text;if(ye<j&&Kr.includes(de)&&a.has(ye)&&a.get(ye)<j){ye=a.get(ye);continue}if(ye<j&&de===":"&&!ne)se=!0;else if(ye<j&&de==="="&&ue===0)se=!1,ne=!0;else if(ye<j&&se&&de==="<")ue++;else if(ye<j&&se&&de===">"&&ue>0)ue--;else if(ye===j||de===","&&ue===0)v(te,ye,D,ee==="var"),te=ye+1,se=!1,ne=!1}}else if(ee==="function"||ee==="class"){let j=B+1;if(i[j]?.text==="*")j++;if(i[j]&&yt.test(i[j].text)&&i[j].text!=="extends")D.add(i[j].text),b.push({name:i[j].text,token:j})}else if(ee==="import"){let j=B+1;if(i[j]?.text==="*"&&i[j+1]?.text==="as")j+=2;let te=i[j]?.text;if(te&&yt.test(te)&&te!=="type"&&i[j+1]?.text!=="("&&i[j+1]?.text!==".")D.add(te),b.push({name:te,token:j,file:!0});let se=i[j]?.text==="{"?j:i[j+1]?.text===","&&i[j+2]?.text==="{"?j+2:-1;if(se!==-1&&a.has(se)){let ne=a.get(se);for(let[ue,ye]of c(se+1,ne)){let de=ye-1;while(de>=ue&&!yt.test(i[de].text))de--;if(de>=ue&&i[de].text!=="type")b.push({name:i[de].text,token:de,file:!0})}}}}let F={code:n,scopes:H,loops:L,declarations:D,sites:b,tokens:i,pairs:a};return Zr.set(e,F),F}function en(e){let t=_s(e);return{code:t.code,shadows:(n,i)=>t.scopes.some((a)=>i>=a.start&&i<a.end&&a.names.has(n))}}function zn(e){return new Set(_s(e).declarations)}function Oe(e,t){let{scopes:n,loops:i,sites:a,tokens:l,pairs:c}=_s(e),b=Array.from({length:l.length},()=>-1),v=[];for(let O=0;O<l.length;O++){b[O]=v.length?v[v.length-1]:-1;let L=l[O].text;if(L==="{"&&c.has(O))v.push(O);else if(L==="}"&&v.length&&c.get(O)===v[v.length-1])v.pop()}let T=new Set,P=new Map;for(let O of a){if(!t.has(O.name))continue;T.add(O.token);let L=O.file?-1:b[O.token],F=L===-1?[0,Number.POSITIVE_INFINITY]:[l[L].start,l[c.get(L)].end];if(O.functionScoped){let ee=l[O.token].start,X=n.filter((j)=>j.functionBody&&ee>=j.bodyStart&&ee<j.end).sort((j,te)=>j.end-j.bodyStart-(te.end-te.bodyStart))[0];F=X?[X.bodyStart,X.end]:[0,Number.POSITIVE_INFINITY]}else if(!O.file){let ee=i.filter((X)=>O.token>X.headStart&&O.token<X.headEnd).sort((X,j)=>X.headEnd-X.headStart-(j.headEnd-j.headStart))[0];if(ee)F=[ee.start,ee.end]}let B=P.get(O.name);if(B)B.push(F);else P.set(O.name,[F])}let D=new Set;for(let O=0;O<l.length;O++){if(l[O].text!=="import"||l[O-1]?.text===".")continue;let L=O+1;if(l[L]?.text==="type")L++;if(l[L]&&yt.test(l[L].text)&&l[L+1]?.text===",")L+=2;if(l[L]?.text==="{"&&c.has(L))for(let F=L+1;F<c.get(L);F++)D.add(F)}let H=new Set;for(let O=0;O<l.length;O++){let L=l[O].text;if(!t.has(L)||H.has(L)||T.has(O)||D.has(O))continue;let F=l[O-1]?.text;if(F==="#"||F==="."&&l[O-2]?.text!=="..")continue;if(l[O+1]?.text===":"&&(F==="{"||F===","))continue;let B=l[O].start;if(P.get(L)?.some(([ee,X])=>B>=ee&&B<X))continue;if(n.some((ee)=>B>=ee.start&&B<ee.end&&ee.names.has(L)))continue;H.add(L)}return H}var Ie="0.2.852";var Jr=Symbol.for(`stx.lazy-module-promises.${Ie}`);function Ca(){let e=globalThis;return e[Jr]??=new Map,e[Jr]}function o(e,t){let n=Ca(),i=`${import.meta.url}\x00${e}`,a=n.get(i);if(a)return a;let l=t();return n.set(i,l),l.catch(()=>{if(n.get(i)===l)n.delete(i)}),l}var Ra=/<\/(script)/gi;function gn(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(Ra,"<\\/$1")}import Gr from"fs";var Yr=[];function w(e){let t=new R(e);return Yr.push(t),t}function Dc(){for(let e of Yr)e.clear()}function S(e,...t){return`${t.map((n)=>String(n??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function Sr(e){let t=[];for(let n of new Set(e))try{t.push({path:n,mtimeMs:Gr.statSync(n).mtimeMs})}catch{}return t}function Fs(e){for(let t of e)try{if(Gr.statSync(t.path).mtimeMs!==t.mtimeMs)return!1}catch{return!1}return!0}var Se=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useIntervalFn","useObjectUrl"];var Ta=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function Aa(e){if(e.startsWith(".")||e.startsWith("/"))return null;if(e.startsWith("@")){let n=e.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!n)return null;return{pkg:n[1],subpath:n[2]||""}}let t=e.match(/^([^/]+)(\/.*)?$/);if(!t)return null;return{pkg:t[1],subpath:t[2]||""}}function Ia(e,t){let n=t;while(!0){let i=$t.join(n,"node_modules",e,"package.json");if(tn.existsSync(i))return $t.dirname(i);let a=$t.dirname(n);if(a===n)return null;n=a}}function Pa(e,t){if(!e||typeof e!=="object")return null;let n=(a)=>{if(typeof a==="string")return a;if(a&&typeof a==="object"){if(typeof a.import==="string")return a.import;if(typeof a.default==="string")return a.default;if(typeof a.import==="object")return n(a.import);if(typeof a.default==="object")return n(a.default)}return null};if(Object.prototype.hasOwnProperty.call(e,t))return n(e[t]);let i=null;for(let a of Object.keys(e)){let l=a.indexOf("*");if(l===-1)continue;let c=a.slice(0,l),b=a.slice(l+1);if(!t.startsWith(c)||!t.endsWith(b))continue;if(t.length<c.length+b.length)continue;if(!i||c.length>i.prefix.length)i={pattern:a,prefix:c,suffix:b}}if(i){let a=t.slice(i.prefix.length,t.length-i.suffix.length),l=n(e[i.pattern]);if(l)return l.replace("*",a)}return null}function Oa(e,t){let n=Aa(e);if(!n||!n.subpath)return null;let i=Ia(n.pkg,t);if(!i)return null;let a;try{a=JSON.parse(tn.readFileSync($t.join(i,"package.json"),"utf8"))}catch{return null}let l=`.${n.subpath}`,c=Pa(a.exports,l);if(!c)return null;let b=$t.resolve(i,c);return tn.existsSync(b)?b:null}function xi(e,t){let n=t.filePath?$t.dirname(t.filePath):t.projectRoot||process.cwd(),i=t.projectRoot||process.cwd(),a=new Set,l=[],c=[];return{code:e.replace(Ta,(v,T)=>{let P;try{if(T.startsWith("./")||T.startsWith("../")||T.startsWith("/")){if(P=T.startsWith("/")?T:$t.resolve(n,T),!tn.existsSync(P))throw Error(`file not found: ${P}`)}else{let D=null;try{D=Bun.resolveSync(T,i)}catch{D=Oa(T,i)}if(!D)throw Error(`could not resolve ${T} (Bun.resolveSync + exports fallback both failed)`);P=D}}catch(D){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(T)} (from ${t.filePath||"<unknown>"}): ${D?.message||D}`),c.push(T),""}if(a.has(P))return"";a.add(P);try{let D=tn.readFileSync(P,"utf8");l.push({source:T,resolvedPath:P,contents:D})}catch(D){console.warn(`[stx:vendor-css] could not read ${P}: ${D?.message||D}`),c.push(T)}return""}),styles:l,unresolved:c}}function Da(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Si(e){if(e.length===0)return"";return`${e.map((t)=>`<style data-stx-vendor="${Da(t.source)}" data-stx-layer="vendor">
|
|
116
116
|
@layer vendor {
|
|
117
117
|
${t.contents}
|
|
118
118
|
}
|
|
@@ -182,7 +182,7 @@ else {
|
|
|
182
182
|
// STX: auto-generated event bindings
|
|
183
183
|
${e.map((n,i)=>Ha(n,i)).join(`
|
|
184
184
|
`)}`}function ni(e){let t=[],n=new Set,i=e.replace(/^\s*import\s+.*$/gm,""),a=0,l=i.length,c=0;while(c<l){let b=i[c];if(b==="'"||b==='"'||b==="`"){let v=b;if(c++,v==="`"){let T=0;while(c<l){if(i[c]==="\\"){c+=2;continue}if(i[c]==="`"&&T===0){c++;break}if(i[c]==="$"&&i[c+1]==="{"){T++,c+=2;continue}if(i[c]==="}"&&T>0){T--,c++;continue}c++}}else while(c<l){if(i[c]==="\\"){c+=2;continue}if(i[c]===v){c++;break}c++}continue}if(b==="/"&&i[c+1]==="/"){while(c<l&&i[c]!==`
|
|
185
|
-
`)c++;continue}if(b==="/"&&i[c+1]==="*"){c+=2;while(c<l-1&&!(i[c]==="*"&&i[c+1]==="/"))c++;c+=2;continue}if(b==="{"){a++,c++;continue}if(b==="}"){a--,c++;continue}if(a===0){let v=i.slice(c),T=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(T){let H=T[1];if(!H.startsWith("_")&&!n.has(H))t.push(H),n.add(H);c+=T[0].length;continue}let P=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(P){P[1].split(",").forEach((H)=>{let O=H.trim(),L=O.indexOf(":"),F=L>=0?O.slice(L+1).trim().split(/[\s=]/)[0]:O.split(/[\s=]/)[0];if(F&&!F.startsWith("_")&&!n.has(F))t.push(F),n.add(F)}),c+=P[0].length;continue}let D=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(D){let H=D[1];if(!H.startsWith("_")&&!n.has(H))t.push(H),n.add(H);c+=D[0].length;continue}}c++}return t}var Za=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"]);function Ka(e){let t=new Set,n=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function i(H){let O;while((O=n.exec(H))!==null){let L=O[0];if(!Za.has(L))t.add(L)}}let a=/\{\{([\s\S]*?)\}\}/g,l;while((l=a.exec(e))!==null)i(l[1]);let c=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((l=c.exec(e))!==null)i(l[1]);let b=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=b.exec(e))!==null)i(l[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=v.exec(e))!==null)i(l[1]);let T=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=T.exec(e))!==null)i(l[1]);let P=/@model\s*=\s*["']([^"']*)["']/gi;while((l=P.exec(e))!==null)i(l[1]);let D=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=D.exec(e))!==null)i(l[1]);return t}async function je(e,t={}){let n=e,i="",a=!1,l=[],c=xi(n,{filePath:t.filePath,projectRoot:t.projectRoot});n=c.code;let b=Si(c.styles),v=Lt(n);n=v.code,l=[...v.imports,...v.models];let{hasUserImports:T,bundleClientScript:P}=await o("stx/client-script-bundler",()=>import("./chunk-
|
|
185
|
+
`)c++;continue}if(b==="/"&&i[c+1]==="*"){c+=2;while(c<l-1&&!(i[c]==="*"&&i[c+1]==="/"))c++;c+=2;continue}if(b==="{"){a++,c++;continue}if(b==="}"){a--,c++;continue}if(a===0){let v=i.slice(c),T=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(T){let H=T[1];if(!H.startsWith("_")&&!n.has(H))t.push(H),n.add(H);c+=T[0].length;continue}let P=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(P){P[1].split(",").forEach((H)=>{let O=H.trim(),L=O.indexOf(":"),F=L>=0?O.slice(L+1).trim().split(/[\s=]/)[0]:O.split(/[\s=]/)[0];if(F&&!F.startsWith("_")&&!n.has(F))t.push(F),n.add(F)}),c+=P[0].length;continue}let D=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(D){let H=D[1];if(!H.startsWith("_")&&!n.has(H))t.push(H),n.add(H);c+=D[0].length;continue}}c++}return t}var Za=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"]);function Ka(e){let t=new Set,n=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function i(H){let O;while((O=n.exec(H))!==null){let L=O[0];if(!Za.has(L))t.add(L)}}let a=/\{\{([\s\S]*?)\}\}/g,l;while((l=a.exec(e))!==null)i(l[1]);let c=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((l=c.exec(e))!==null)i(l[1]);let b=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=b.exec(e))!==null)i(l[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=v.exec(e))!==null)i(l[1]);let T=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=T.exec(e))!==null)i(l[1]);let P=/@model\s*=\s*["']([^"']*)["']/gi;while((l=P.exec(e))!==null)i(l[1]);let D=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=D.exec(e))!==null)i(l[1]);return t}async function je(e,t={}){let n=e,i="",a=!1,l=[],c=xi(n,{filePath:t.filePath,projectRoot:t.projectRoot});n=c.code;let b=Si(c.styles),v=Lt(n);n=v.code,l=[...v.imports,...v.models];let{hasUserImports:T,bundleClientScript:P}=await o("stx/client-script-bundler",()=>import("./chunk-x1c1aggq.js"));if(T(n))n=await P(n,t.filePath||"",{projectRoot:t.projectRoot,minify:t.production}),a=!0;if(t.autoImports!==!1){let j=el(n);n=j.code,i=tl(j.stxImports,j.browserImports.filter((te)=>!l.includes(te)))}if(i=`${vn(n,t.serverData)}${i}`,n=I(n),!a&&Be(t.attrs||""))n=Fe(n);let D=qa(t.eventBindings||[]),H=(t.attrs||"").trim(),O=/\btype\s*=\s*["']module["']/i.test(H),L=t.instanceId?` data-stx-instance="${t.instanceId}"`:"";if(O){let j=H.replace(/\btype\s*=\s*["']module["']/i,"").trim(),te=`type="module" data-stx-scoped${L}${j?` ${j}`:""}`;return`${b}<script ${te}>
|
|
186
186
|
${gn(`${i}${n}
|
|
187
187
|
${D}`)}
|
|
188
188
|
</script>`}let F=Di(e),B=/function __stx_setup_/.test(n),ee=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function X(j){let te=j.length>0?`
|
|
@@ -573,8 +573,8 @@ ${T.join(`
|
|
|
573
573
|
`){let L=e[a];if(L==="\\"){a+=2;continue}if(L==="[")O=!0;else if(L==="]")O=!1;else if(L==="/"&&!O){a++;while(a<l&&/[a-z]/i.test(e[a]))a++;return}a++}},H=()=>{if(i!==0)return;let O=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(O){let ee=O[2].split(",").map((X)=>{let j=X.trim().split(":");return j[j.length-1].trim()});for(let X of ee)if(X&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(X)&&!n.has(X))t.push(X),n.add(X);return}let L=e.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(L){let ee=L[2];if(!n.has(ee))t.push(ee),n.add(ee);return}let F=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let ee=F[1];if(!n.has(ee))t.push(ee),n.add(ee);return}let B=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let ee=B[1];if(!n.has(ee))t.push(ee),n.add(ee)}};while(a<l){if(v())continue;if(e[a]==="'"||e[a]==='"'){c(e[a]);continue}if(e[a]==="`"){b();continue}if(e[a]==="/"&&P()){D();continue}if(e[a]==="{"){i++,a++;continue}if(e[a]==="}"){i--,a++;continue}if(i===0&&/[a-z]/i.test(e[a])&&(a===0||/\s|[;{}()]/.test(e[a-1])))H();a++}return t}function hu(e){let t=[],n=0,i=0,a=null;for(let l=0;l<e.length;l++){let c=e[l];if(a){if(c==="\\"){l++;continue}if(c===a)a=null;continue}if(c==='"'||c==="'"||c==="`"){a=c;continue}if(c==="("||c==="["||c==="{")n++;else if(c===")"||c==="]"||c==="}")n--;else if(c===","&&n===0)t.push(e.slice(i,l)),i=l+1}if(i<e.length)t.push(e.slice(i));return t}function xu(e){let t=0,n=null;for(let i=0;i<e.length;i++){let a=e[i];if(n){if(a==="\\"){i++;continue}if(a===n)n=null;continue}if(a==='"'||a==="'"||a==="`"){n=a;continue}if(a==="("||a==="["||a==="{")t++;else if(a===")"||a==="]"||a==="}")t--;else if(a==="="&&t===0){let l=e[i-1],c=e[i+1];if(l==="!"||l==="<"||l===">"||l==="=")continue;if(c==="="||c===">")continue;return i}}return-1}function bu(e,t){try{let n=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(e);if(!n)return;let i=n.index-1;while(i>=0&&/\s/.test(e[i]))i--;if(e[i]!=="}")return;let a=i,l=0,c=-1;for(;i>=0;i--){let v=e[i];if(v==="}")l++;else if(v==="{"){if(l--,l===0){c=i;break}}}if(c===-1)return;let b=e.slice(c+1,a);for(let v of hu(b)){let T=v.trim();if(!T||T.startsWith("..."))continue;let P=xu(T);if(P===-1)continue;let D=T.slice(0,P).trim();if(!/^[A-Z_$][\w$]*$/i.test(D))continue;if(t[D]!==void 0)continue;let H=T.slice(P+1).trim();if(!H)continue;try{let O=Object.keys(t).filter(Ft),L=Function(...O,`"use strict"; return (${H});`);t[D]=L(...O.map((F)=>t[F]))}catch{}}}catch{}}var yu=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function xg(e,t){let n=It(e),i=e.slice(n).match(/^<([a-zA-Z][a-zA-Z0-9-]*)/);if(!i)return null;let a=i[1].toLowerCase();if(!yu.has(a))return null;let l=new RegExp(`<\\/?${a}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),c=y(e,(P,D)=>(l.lastIndex=D,l.exec(P)?.index===D?l.lastIndex:-1));if(a==="span"&&/\sdata-stx-scope\s*=/.test(c[0]?.token||""))return null;let b=0,v=!1;for(let P of c){if(b+=P.token.startsWith("</")?-1:1,b<0)return null;if(b===0){if(e.slice(P.end).trim())return null;v=!0;break}}if(!v)return null;let T=n+i[0].length;return e.slice(0,T)+t+e.slice(T)}function Go(e,t){if(!e)return!1;return[...t.additionalComponentsDirs??[],...t.fallbackComponentsDir?[t.fallbackComponentsDir]:[]].some((i)=>{let a=ce.relative(ce.resolve(i),ce.resolve(e));return!a.startsWith("..")&&!ce.isAbsolute(a)})}async function Rr(e,t,n,i,a){let l=e.endsWith(".stx")?e.slice(0,-4):e,c=(ne)=>ne.split("-").map((ue)=>ue.charAt(0).toUpperCase()+ue.slice(1)).join(""),b=n.__importedComponents;if(b){for(let ne of[l,l.toLowerCase(),c(l),U(l)])if(b.has(ne))return!0}let v=[...new Set([`${l}.stx`,`${c(l)}.stx`,`${U(l)}.stx`])],T=typeof a.root==="string"?ce.resolve(a.root):void 0,P=T??ce.dirname(i),D=[],H=(ne)=>{if(ne&&!D.includes(ne))D.push(ne)};for(let ne of Ln(i,T))H(ne);let O=n.__originalFilePath;if(O)H(ce.join(ce.dirname(O),"components"));if(Go(t,a))H(a._rootComponentsDir);H(t),H(a._rootComponentsDir),H(ce.join(ce.dirname(i),"components")),H(a.componentsDir);for(let ne of a.additionalComponentsDirs??[])H(ne);let L=a._targetComponentFallbackNames?.some((ne)=>ne.toLowerCase()===l.toLowerCase());if(!L)for(let ne of a._targetComponentDirs??[])H(ne);if(T)H(ce.resolve(T,"resources/views/components")),H(ce.resolve(T,"resources/components")),H(ce.resolve(T,"src/components")),H(ce.resolve(T,"components"));for(let ne of a._layerComponentDirs??[])H(ne);let F=a._pluginComponentDirs;if(Array.isArray(F))for(let ne of F)H(typeof ne==="string"?ne:null);if(H(a.fallbackComponentsDir),L)for(let ne of a._targetComponentDirs??[])H(ne);let B=a._nativePrimitivesFallback;if(B&&!B.except.some((ne)=>ne.toLowerCase()===l.toLowerCase()))H(B.dir);if(l.startsWith("./")||l.startsWith("../"))return s(ce.resolve(ce.dirname(i),`${l}.stx`));let ee=Vo(ce.resolve(import.meta.dir,"components")),X=D.map((ne)=>ce.isAbsolute(ne)?ne:ce.resolve(P,ne)),j=`${v.join("\x00")}\x00\x00${X.join("\x00")}`,te=ur.get(j);if(te!==void 0)return te;let se=!1;e:for(let ne of X){if(Vo(ne)===ee)continue;for(let ue of v)if(await s(ce.join(ne,ue))){se=!0;break e}}return ur.set(j,se),se}function Vo(e){let t=fr.get(e);if(t!==void 0)return t;let n=e;try{n=rs.realpathSync(e)}catch{}return fr.set(e,n),n}function Sg(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function nl(e){if(!e)return!1;let t=e.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(t)}function _u(e,t,n){if(!e.includes("{{")&&!e.includes("{!!"))return e;let i=(a,l)=>{let c;try{c=A(a,t)}catch{return l}if(c===void 0||c===null)return"";let b=String(c);if(/<\/style/i.test(b))return console.warn(`[stx] a <style> expression in ${n??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return b};return e.replace(/\{!!([\s\S]*?)!!\}/g,(a,l)=>i(l,a)).replace(/\{\{([\s\S]*?)\}\}/g,(a,l)=>i(l,a))}var Uo=new Set;function Ho(e,t,n,i){let a=`${e}\x00${t}\x00${i??""}`;if(!process.env.STX_DEBUG&&Uo.has(a))return;Uo.add(a);let l=t?` used in ${t}`:"",c=i?` Cause: ${i}.`:"",b=n.length>0?`
|
|
574
574
|
searched:
|
|
575
575
|
${n.map((v)=>` - ${v}`).join(`
|
|
576
|
-
`)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${c}${b}`)}function qo(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var wu=new Set(["for","if","show","key","ref","class","className","style"]),Zo=new Set,Yo="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",rl=new RegExp(`\\b(?:${Yo})\\s*(?:<[^>]*>)?\\s*\\(`);function ki(e){let t=new Set,n=new RegExp(`\\b(?:const|let|var)\\s+([a-zA-Z_$][\\w$]*)\\s*=\\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue|${Yo})\\s*(?:<[^>]*>)?\\s*\\(`,"g");for(let i of e){let a;while((a=n.exec(i))!==null)t.add(a[1]);n.lastIndex=0}return[...t]}async function ze(e,t,n,i,a,l,c,b=new Set,v,T=st(a),P,D=e){let{extractVariables:H}=await o("stx/variable-extractor",()=>import("./chunk-ty915d4h.js")),O=b??new Set;if(O.has(e))return`[Circular component reference: ${e}]`;let L=new Set(O);L.add(e);let F=typeof t.client==="string"?t.client.trim():"";if("client"in t)delete t.client;let B=F&&F!=="load"&&Sg(F)?F:"";try{let ee=(oe)=>oe.split("-").map((le)=>le.charAt(0).toUpperCase()+le.slice(1)).join(""),X=D.endsWith(".stx")?D.slice(0,-4):D,j=null,te=a.__importedComponents;if(te){let oe=[X,X.toLowerCase(),ee(X),U(X)];for(let le of oe)if(te.has(le)){j=te.get(le);break}}let se=[];if(!j){let oe=[`${X}.stx`,`${ee(X)}.stx`,`${U(X)}.stx`],le=[...new Set(oe)],we=a.__originalFilePath,be=[];for(let _e of Ln(l))if(!be.includes(_e))be.push(_e);let Xe=be.length;for(let _e of c._layerComponentDirs??[])if(!be.includes(_e))be.push(_e);if(we){let _e=ce.join(ce.dirname(we),"components");be.push(_e)}let Te=c._rootComponentsDir;if(typeof Te==="string"&&Go(i,c)&&!be.includes(Te))be.push(Te);if(i&&!be.includes(i))be.push(i);if(typeof Te==="string"&&!be.includes(Te))be.push(Te);let mt=ce.join(ce.dirname(l),"components");if(!be.includes(mt))be.push(mt);if(c.componentsDir&&c.componentsDir!==i&&!be.includes(c.componentsDir))be.push(c.componentsDir);for(let _e of c.additionalComponentsDirs??[])if(_e&&!be.includes(_e))be.push(_e);let kt=c._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(X),bt=(P?.events??[]).map((_e)=>_e.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),Rn=Object.hasOwn(t,"checked")||Boolean(P?.reactiveProps?.includes("checked")),fs=Object.hasOwn(t,"value")||Boolean(P?.reactiveProps?.includes("value")),ps=!bt.includes("valuechange")&&(Rn||bt.includes("change")&&!fs),wt=c._nativeHostAttrs&&/^textinput$/i.test(X),Ct=bt.includes("update:value")&&!bt.includes("input"),Qt=c._nativeHostAttrs&&/^video$/i.test(X),ds=c._nativeHostAttrs&&/^image$/i.test(X),Tn=Bs([...Object.keys(t),...P?.reactiveProps??[]],P?.events,t),Rt=Object.hasOwn(t,"src")||Boolean(P?.reactiveProps?.includes("src")),An=Object.hasOwn(t,"source")||Boolean(P?.reactiveProps?.includes("source")),In=Qt&&(Rt||An)&&(P?.events??[]).every((_e)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(_e.replace(/^@/,"").split(".")[0])),Pn=new Set(["","primary","secondary","outline","ghost","danger"]),On=typeof t.variant==="string"?t.variant.trim().toLowerCase():"",Dn=c._nativeHostAttrs&&/^button$/i.test(X)&&!Pn.has(On),wr=c._targetComponentFallbackNames?.some((_e)=>_e.toLowerCase()===X.toLowerCase())??!1,gs=wr&&(!kt||ps)&&(!wt||Ct)&&(!Qt||In)&&(!ds||Tn)&&!Dn;for(let _e of gs?[]:c._targetComponentDirs??[])if(_e&&!be.includes(_e))be.push(_e);let Tt=typeof c.root==="string"?ce.resolve(c.root):void 0,vr=Tt??ce.dirname(l),At=[];if(Tt)At.push(ce.resolve(Tt,"resources/views/components")),At.push(ce.resolve(Tt,"resources/components")),At.push(ce.resolve(Tt,"src/components")),At.push(ce.resolve(Tt,"components"));At.push(ce.resolve(import.meta.dir,"components"));for(let _e of At)if(!be.includes(_e))be.push(_e);if(wr){let _e=(c._componentPackageDirs??[]).filter((Qe)=>typeof Qe==="string"&&Qe.length>0),ht=(gs?_e.length?_e:c._pluginComponentDirs??[]:c._targetComponentDirs??[]).filter((Qe)=>typeof Qe==="string"&&Qe.length>0);if(ht.length){let Qe=be.slice(Xe).map((Ge)=>ce.isAbsolute(Ge)?Ge:ce.resolve(vr,Ge)).filter((Ge)=>!ht.includes(Ge)),jn=`${X}\x00${Qe.join("\x00")}`,at=lr.get(jn);if(at===void 0){at=!1;for(let Ge of Qe){for(let St of le)if(await s(ce.join(Ge,St))){at=!0;break}if(at)break}lr.set(jn,at)}if(!at){for(let Ge of ht){let St=be.indexOf(Ge);if(St>=0)be.splice(St,1)}be.splice(Xe,0,...ht)}}}let Ar=c._pluginComponentDirs;if(Array.isArray(Ar)){for(let _e of Ar)if(typeof _e==="string"&&!be.includes(_e))be.push(_e)}if(c.fallbackComponentsDir&&!be.includes(c.fallbackComponentsDir))be.push(c.fallbackComponentsDir);if(gs){for(let _e of c._targetComponentDirs??[])if(_e&&!be.includes(_e))be.push(_e)}let Mn=c._nativePrimitivesFallback;if(Mn&&!Mn.except.some((_e)=>_e.toLowerCase()===X.toLowerCase())&&!be.includes(Mn.dir))be.push(Mn.dir);let Ir=[...new Set(be.map((_e)=>{if(!_e)return _e;return ce.isAbsolute(_e)?_e:ce.resolve(vr,_e)}))];be.length=0,be.push(...Ir);let ms=`${X}\x00${l}\x00${Ir.join("\x00")}`,hs=ns.get(ms);if(hs)if(await s(hs))j=hs;else ns.delete(ms);if(!j&&(X.startsWith("./")||X.startsWith("../")))j=ce.resolve(ce.dirname(l),`${X}.stx`),se.push(j);else if(!j)for(let _e of be){if(!_e)continue;for(let ht of le){let Qe=ce.join(_e,ht);if(se.push(Qe),await s(Qe)){j=Qe;break}}if(j)break;if(!j)try{let ht=await import("fs");if(!ht.statSync(_e,{throwIfNoEntry:!1})?.isDirectory())continue;let jn=8,at=[{path:_e,depth:0}];while(at.length>0&&!j){let Ge=at.pop();if(Ge.depth>=jn)continue;let St;try{St=ht.readdirSync(Ge.path,{withFileTypes:!0})}catch{continue}for(let Nn of St){if(!Nn.isDirectory())continue;if(Nn.name==="node_modules"||Nn.name.startsWith("."))continue;let Pr=ce.join(Ge.path,Nn.name);for(let pa of le){let xs=ce.join(Pr,pa);if(se.push(xs),await s(xs)){j=xs;break}}if(j)break;at.push({path:Pr,depth:Ge.depth+1})}}}catch{}if(j)break}if(j)ns.set(ms,j)}if(!j||!await s(j))return Ho(e,l,se),qo(e);v.add(j);let ne;if(ln.has(j)&&cr.get(j)===Bo(j))ne=ln.get(j);else try{let oe=Bo(j);ne=await Bun.file(j).text(),ln.set(j,ne),cr.set(j,oe)}catch(oe){let le=oe instanceof Error?oe.message:String(oe);return Ho(e,l,[j],le),qo(e)}if(P)for(let oe of new Set([...Object.keys(t),...P.reactiveProps??[]])){let le=oe.toLowerCase();if(le.startsWith("aria-")||le.startsWith("data-"))continue;let we=oe.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${we}\\b`).test(ne))P.declaredProps.add(oe);if(new RegExp(`\\$props\\s*(?:\\.\\s*${we}\\b|\\[\\s*['"]${we}['"]\\s*\\])`).test(ne)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${we}['"]`).test(ne))P.consumedProps?.add(oe)}if(P?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(ne))for(let oe of P.reactiveProps){if(wu.has(oe)||P.consumedProps?.has(oe))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${oe.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(ne))continue;let le=`${j}\x00${oe}`;if(Zo.has(le))continue;Zo.add(le),console.warn(`[stx] ${ce.basename(j)} reads \`${oe}\` with defineProps(), which is not live, but ${ce.basename(l)} binds it (:${oe}): the value can arrive empty or stale (on a native screen, and for a :for's rows, it does not arrive at all). Read it with useReactiveProp('${oe}').`)}let ue=new Set(["__originalFilePath","__importedComponents",Un,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),ye={};for(let[oe,le]of Object.entries(a))if(!oe.startsWith("__")||ue.has(oe))ye[oe]=le;let de=T.length>0?{[Jn]:[...T]}:{},Ae=n;if(n.includes("@include")){let{processIncludes:oe}=await o("stx/includes",()=>import("./chunk-knapnbwv.js"));Ae=await oe(n,a,l,c,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ae)){let{processComponents:oe}=await o("stx/component-renderer",()=>import("./chunk-p2gsezmj.js")),le={...a,__processedComponents:O,...de};Ae=await oe(Ae,le,l,c,v);let we=le.__stx_preserved_client_expressions;if(Array.isArray(we)&&we.length>0)a.__stx_preserved_client_expressions=[...new Set([...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...we])]}let Ze=[];if(nl(Ae)){let{processExpressions:oe}=await o("stx/expressions",()=>import("./chunk-j882bpqq.js")),le=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...de}:T.length>0?{...a,...de}:a;Ae=oe(Ae,le,l);for(let we of Ae.matchAll(/\{\{([\s\S]*?)\}\}/g))Ze.push(we[1].trim())}let Re=J(Ae),Ke=[],Ye=Re.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(oe,le)=>{let we=Re.scripts[Number(le)]||"",be=we.match(/^<script\b([^>]*)>/i)?.[1]||"",Xe=be.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Te=!Xe||["module","text/javascript","application/javascript"].includes(Xe),mt=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${be}`);if(!/\bserver\b/i.test(be)&&Te&&!mt)return Ke.push(we),"";return we}),{extractSlotContent:Je}=await o("stx/slots",()=>import("./chunk-6ekgf3b3.js")),rt=Je(Ye),et={};if(rt.defaultSlot?.trim())et.default=rt.defaultSlot;for(let[oe,le]of rt.namedSlots)et[oe]=le.content;let _t=a.__stx_scope_seq??={n:0,key:Ks(String(a.__filename??l))},Vt=Jo(e,process.cwd()),ut=`stx_${(Vt.endsWith(".stx")?Vt.slice(0,-4):Vt).replace(/[^a-zA-Z0-9]/g,"_")}_${++_t.n}_${_t.key}`,We={...ye,$uid:ut,$native:c._nativeHostAttrs===!0,...t,props:t,slot:Ye,$slots:et,__processedComponents:L,__sections:{},__stx_signals_gate:ke(ne)||nl(n),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Ze]};if(/import\s/.test(ne)){We.__importedComponents=new Map(We.__importedComponents);let{processESImports:oe}=await o("stx/component-renderer",()=>import("./chunk-p2gsezmj.js"));ne=await oe(ne,We,j,c,v)}bu(ne,We);let Ut=ne,fn=pe(Ut);if(fn)Ut=fn.content.trim();let os=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Ht=[...ne.matchAll(os)];for(let[,oe,le]of Ht)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(oe))Ne(le,j,c.strict);let tt=[],qt=null,as=Ht.some((oe)=>/\bserver\b/.test(oe[1]||"")&&/\bcache\b/.test(oe[1]||"")),Et=null,ft=null,Zt=null,pn=0,Kt=null;if(fu(c),as&&pr>0){let oe=pu({props:t,slot:Ae,slotContext:n.trim()?du(ye):void 0,buildMode:c.buildMode??"",skipEventDirectives:c.skipEventDirectives===!0,native:c._nativeHostAttrs===!0,clientLoopNames:[...T].sort(),layers:c._layerGraph?.layers.map((le)=>le.configFile),uid:ut});if(oe!==null){Et=`${j}\x00${S(ne)}\x00${oe}`;let le=ss.get(Et);if(le){for(let we of le.dependencies)v.add(we);if(Ri(a,le.clientFactories),_t.n+=le.uidsConsumed,le.preservedClientExpressions.length>0){let we=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let be of le.preservedClientExpressions)we.add(be);a.__stx_preserved_client_expressions=[...we]}return le.output}ft=new Set(v),Zt=ci(a),pn=_t.n,Kt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let Xt=new Set;for(let oe of Ht){let le=oe[1]||"",we=oe[2]||"",be=le.includes("server");if(Be(le)&&we.trim())we=Fe(we);if(be&&we){for(let Te of De(we))Xt.add(Te);try{await H(we,We,j,{onFailure:(Te)=>{if(Te.kind!=="unknown")qt=Te.kind}})}catch(Te){}}if(!be){let Te=we.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),mt=Te.includes("{{")&&Te.includes("}}"),kt=Te.includes("{!!")&&Te.includes("!!}");if(mt||kt)Te=Ci(Te,We,j);let bt=le.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");tt.push(`<script${bt}>${Te}</script>`)}}let nt=J(ne).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Jt=nt?nt[1]:"",cs=nt?nt[2]:"",pt="",re=Jt&&/\bscoped\b/i.test(Jt);if(nt)pt=`<style${Jt}>${_u(cs,We,j)}</style>`;let ae=Ut;if(ae=ae.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),nt)ae=ae.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let oe=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,le=[];if(ae=ae.replace(oe,(we,be)=>{let Xe=be.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Xe)le.push(`<style${Xe[1]}>${Xe[2]}</style>`);return""}),ae=ae.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),le.length>0)pt=`${pt}${le.join(`
|
|
577
|
-
`)}`}if(n&&ae.includes("{{ text || slot }}"))ae=ae.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>n);let{applySlots:he}=await o("stx/slots",()=>import("./chunk-
|
|
576
|
+
`)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${c}${b}`)}function qo(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var wu=new Set(["for","if","show","key","ref","class","className","style"]),Zo=new Set,Yo="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",rl=new RegExp(`\\b(?:${Yo})\\s*(?:<[^>]*>)?\\s*\\(`);function ki(e){let t=new Set,n=new RegExp(`\\b(?:const|let|var)\\s+([a-zA-Z_$][\\w$]*)\\s*=\\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue|${Yo})\\s*(?:<[^>]*>)?\\s*\\(`,"g");for(let i of e){let a;while((a=n.exec(i))!==null)t.add(a[1]);n.lastIndex=0}return[...t]}async function ze(e,t,n,i,a,l,c,b=new Set,v,T=st(a),P,D=e){let{extractVariables:H}=await o("stx/variable-extractor",()=>import("./chunk-ptppavv8.js")),O=b??new Set;if(O.has(e))return`[Circular component reference: ${e}]`;let L=new Set(O);L.add(e);let F=typeof t.client==="string"?t.client.trim():"";if("client"in t)delete t.client;let B=F&&F!=="load"&&Sg(F)?F:"";try{let ee=(oe)=>oe.split("-").map((le)=>le.charAt(0).toUpperCase()+le.slice(1)).join(""),X=D.endsWith(".stx")?D.slice(0,-4):D,j=null,te=a.__importedComponents;if(te){let oe=[X,X.toLowerCase(),ee(X),U(X)];for(let le of oe)if(te.has(le)){j=te.get(le);break}}let se=[];if(!j){let oe=[`${X}.stx`,`${ee(X)}.stx`,`${U(X)}.stx`],le=[...new Set(oe)],we=a.__originalFilePath,be=[];for(let _e of Ln(l))if(!be.includes(_e))be.push(_e);let Xe=be.length;for(let _e of c._layerComponentDirs??[])if(!be.includes(_e))be.push(_e);if(we){let _e=ce.join(ce.dirname(we),"components");be.push(_e)}let Te=c._rootComponentsDir;if(typeof Te==="string"&&Go(i,c)&&!be.includes(Te))be.push(Te);if(i&&!be.includes(i))be.push(i);if(typeof Te==="string"&&!be.includes(Te))be.push(Te);let mt=ce.join(ce.dirname(l),"components");if(!be.includes(mt))be.push(mt);if(c.componentsDir&&c.componentsDir!==i&&!be.includes(c.componentsDir))be.push(c.componentsDir);for(let _e of c.additionalComponentsDirs??[])if(_e&&!be.includes(_e))be.push(_e);let kt=c._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(X),bt=(P?.events??[]).map((_e)=>_e.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),Rn=Object.hasOwn(t,"checked")||Boolean(P?.reactiveProps?.includes("checked")),fs=Object.hasOwn(t,"value")||Boolean(P?.reactiveProps?.includes("value")),ps=!bt.includes("valuechange")&&(Rn||bt.includes("change")&&!fs),wt=c._nativeHostAttrs&&/^textinput$/i.test(X),Ct=bt.includes("update:value")&&!bt.includes("input"),Qt=c._nativeHostAttrs&&/^video$/i.test(X),ds=c._nativeHostAttrs&&/^image$/i.test(X),Tn=Bs([...Object.keys(t),...P?.reactiveProps??[]],P?.events,t),Rt=Object.hasOwn(t,"src")||Boolean(P?.reactiveProps?.includes("src")),An=Object.hasOwn(t,"source")||Boolean(P?.reactiveProps?.includes("source")),In=Qt&&(Rt||An)&&(P?.events??[]).every((_e)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(_e.replace(/^@/,"").split(".")[0])),Pn=new Set(["","primary","secondary","outline","ghost","danger"]),On=typeof t.variant==="string"?t.variant.trim().toLowerCase():"",Dn=c._nativeHostAttrs&&/^button$/i.test(X)&&!Pn.has(On),wr=c._targetComponentFallbackNames?.some((_e)=>_e.toLowerCase()===X.toLowerCase())??!1,gs=wr&&(!kt||ps)&&(!wt||Ct)&&(!Qt||In)&&(!ds||Tn)&&!Dn;for(let _e of gs?[]:c._targetComponentDirs??[])if(_e&&!be.includes(_e))be.push(_e);let Tt=typeof c.root==="string"?ce.resolve(c.root):void 0,vr=Tt??ce.dirname(l),At=[];if(Tt)At.push(ce.resolve(Tt,"resources/views/components")),At.push(ce.resolve(Tt,"resources/components")),At.push(ce.resolve(Tt,"src/components")),At.push(ce.resolve(Tt,"components"));At.push(ce.resolve(import.meta.dir,"components"));for(let _e of At)if(!be.includes(_e))be.push(_e);if(wr){let _e=(c._componentPackageDirs??[]).filter((Qe)=>typeof Qe==="string"&&Qe.length>0),ht=(gs?_e.length?_e:c._pluginComponentDirs??[]:c._targetComponentDirs??[]).filter((Qe)=>typeof Qe==="string"&&Qe.length>0);if(ht.length){let Qe=be.slice(Xe).map((Ge)=>ce.isAbsolute(Ge)?Ge:ce.resolve(vr,Ge)).filter((Ge)=>!ht.includes(Ge)),jn=`${X}\x00${Qe.join("\x00")}`,at=lr.get(jn);if(at===void 0){at=!1;for(let Ge of Qe){for(let St of le)if(await s(ce.join(Ge,St))){at=!0;break}if(at)break}lr.set(jn,at)}if(!at){for(let Ge of ht){let St=be.indexOf(Ge);if(St>=0)be.splice(St,1)}be.splice(Xe,0,...ht)}}}let Ar=c._pluginComponentDirs;if(Array.isArray(Ar)){for(let _e of Ar)if(typeof _e==="string"&&!be.includes(_e))be.push(_e)}if(c.fallbackComponentsDir&&!be.includes(c.fallbackComponentsDir))be.push(c.fallbackComponentsDir);if(gs){for(let _e of c._targetComponentDirs??[])if(_e&&!be.includes(_e))be.push(_e)}let Mn=c._nativePrimitivesFallback;if(Mn&&!Mn.except.some((_e)=>_e.toLowerCase()===X.toLowerCase())&&!be.includes(Mn.dir))be.push(Mn.dir);let Ir=[...new Set(be.map((_e)=>{if(!_e)return _e;return ce.isAbsolute(_e)?_e:ce.resolve(vr,_e)}))];be.length=0,be.push(...Ir);let ms=`${X}\x00${l}\x00${Ir.join("\x00")}`,hs=ns.get(ms);if(hs)if(await s(hs))j=hs;else ns.delete(ms);if(!j&&(X.startsWith("./")||X.startsWith("../")))j=ce.resolve(ce.dirname(l),`${X}.stx`),se.push(j);else if(!j)for(let _e of be){if(!_e)continue;for(let ht of le){let Qe=ce.join(_e,ht);if(se.push(Qe),await s(Qe)){j=Qe;break}}if(j)break;if(!j)try{let ht=await import("fs");if(!ht.statSync(_e,{throwIfNoEntry:!1})?.isDirectory())continue;let jn=8,at=[{path:_e,depth:0}];while(at.length>0&&!j){let Ge=at.pop();if(Ge.depth>=jn)continue;let St;try{St=ht.readdirSync(Ge.path,{withFileTypes:!0})}catch{continue}for(let Nn of St){if(!Nn.isDirectory())continue;if(Nn.name==="node_modules"||Nn.name.startsWith("."))continue;let Pr=ce.join(Ge.path,Nn.name);for(let pa of le){let xs=ce.join(Pr,pa);if(se.push(xs),await s(xs)){j=xs;break}}if(j)break;at.push({path:Pr,depth:Ge.depth+1})}}}catch{}if(j)break}if(j)ns.set(ms,j)}if(!j||!await s(j))return Ho(e,l,se),qo(e);v.add(j);let ne;if(ln.has(j)&&cr.get(j)===Bo(j))ne=ln.get(j);else try{let oe=Bo(j);ne=await Bun.file(j).text(),ln.set(j,ne),cr.set(j,oe)}catch(oe){let le=oe instanceof Error?oe.message:String(oe);return Ho(e,l,[j],le),qo(e)}if(P)for(let oe of new Set([...Object.keys(t),...P.reactiveProps??[]])){let le=oe.toLowerCase();if(le.startsWith("aria-")||le.startsWith("data-"))continue;let we=oe.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${we}\\b`).test(ne))P.declaredProps.add(oe);if(new RegExp(`\\$props\\s*(?:\\.\\s*${we}\\b|\\[\\s*['"]${we}['"]\\s*\\])`).test(ne)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${we}['"]`).test(ne))P.consumedProps?.add(oe)}if(P?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(ne))for(let oe of P.reactiveProps){if(wu.has(oe)||P.consumedProps?.has(oe))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${oe.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(ne))continue;let le=`${j}\x00${oe}`;if(Zo.has(le))continue;Zo.add(le),console.warn(`[stx] ${ce.basename(j)} reads \`${oe}\` with defineProps(), which is not live, but ${ce.basename(l)} binds it (:${oe}): the value can arrive empty or stale (on a native screen, and for a :for's rows, it does not arrive at all). Read it with useReactiveProp('${oe}').`)}let ue=new Set(["__originalFilePath","__importedComponents",Un,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),ye={};for(let[oe,le]of Object.entries(a))if(!oe.startsWith("__")||ue.has(oe))ye[oe]=le;let de=T.length>0?{[Jn]:[...T]}:{},Ae=n;if(n.includes("@include")){let{processIncludes:oe}=await o("stx/includes",()=>import("./chunk-s922rk4n.js"));Ae=await oe(n,a,l,c,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ae)){let{processComponents:oe}=await o("stx/component-renderer",()=>import("./chunk-6amqskpv.js")),le={...a,__processedComponents:O,...de};Ae=await oe(Ae,le,l,c,v);let we=le.__stx_preserved_client_expressions;if(Array.isArray(we)&&we.length>0)a.__stx_preserved_client_expressions=[...new Set([...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...we])]}let Ze=[];if(nl(Ae)){let{processExpressions:oe}=await o("stx/expressions",()=>import("./chunk-47z5w330.js")),le=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...de}:T.length>0?{...a,...de}:a;Ae=oe(Ae,le,l);for(let we of Ae.matchAll(/\{\{([\s\S]*?)\}\}/g))Ze.push(we[1].trim())}let Re=J(Ae),Ke=[],Ye=Re.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(oe,le)=>{let we=Re.scripts[Number(le)]||"",be=we.match(/^<script\b([^>]*)>/i)?.[1]||"",Xe=be.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Te=!Xe||["module","text/javascript","application/javascript"].includes(Xe),mt=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${be}`);if(!/\bserver\b/i.test(be)&&Te&&!mt)return Ke.push(we),"";return we}),{extractSlotContent:Je}=await o("stx/slots",()=>import("./chunk-4hfh5ety.js")),rt=Je(Ye),et={};if(rt.defaultSlot?.trim())et.default=rt.defaultSlot;for(let[oe,le]of rt.namedSlots)et[oe]=le.content;let _t=a.__stx_scope_seq??={n:0,key:Ks(String(a.__filename??l))},Vt=Jo(e,process.cwd()),ut=`stx_${(Vt.endsWith(".stx")?Vt.slice(0,-4):Vt).replace(/[^a-zA-Z0-9]/g,"_")}_${++_t.n}_${_t.key}`,We={...ye,$uid:ut,$native:c._nativeHostAttrs===!0,...t,props:t,slot:Ye,$slots:et,__processedComponents:L,__sections:{},__stx_signals_gate:ke(ne)||nl(n),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Ze]};if(/import\s/.test(ne)){We.__importedComponents=new Map(We.__importedComponents);let{processESImports:oe}=await o("stx/component-renderer",()=>import("./chunk-6amqskpv.js"));ne=await oe(ne,We,j,c,v)}bu(ne,We);let Ut=ne,fn=pe(Ut);if(fn)Ut=fn.content.trim();let os=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Ht=[...ne.matchAll(os)];for(let[,oe,le]of Ht)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(oe))Ne(le,j,c.strict);let tt=[],qt=null,as=Ht.some((oe)=>/\bserver\b/.test(oe[1]||"")&&/\bcache\b/.test(oe[1]||"")),Et=null,ft=null,Zt=null,pn=0,Kt=null;if(fu(c),as&&pr>0){let oe=pu({props:t,slot:Ae,slotContext:n.trim()?du(ye):void 0,buildMode:c.buildMode??"",skipEventDirectives:c.skipEventDirectives===!0,native:c._nativeHostAttrs===!0,clientLoopNames:[...T].sort(),layers:c._layerGraph?.layers.map((le)=>le.configFile),uid:ut});if(oe!==null){Et=`${j}\x00${S(ne)}\x00${oe}`;let le=ss.get(Et);if(le){for(let we of le.dependencies)v.add(we);if(Ri(a,le.clientFactories),_t.n+=le.uidsConsumed,le.preservedClientExpressions.length>0){let we=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let be of le.preservedClientExpressions)we.add(be);a.__stx_preserved_client_expressions=[...we]}return le.output}ft=new Set(v),Zt=ci(a),pn=_t.n,Kt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let Xt=new Set;for(let oe of Ht){let le=oe[1]||"",we=oe[2]||"",be=le.includes("server");if(Be(le)&&we.trim())we=Fe(we);if(be&&we){for(let Te of De(we))Xt.add(Te);try{await H(we,We,j,{onFailure:(Te)=>{if(Te.kind!=="unknown")qt=Te.kind}})}catch(Te){}}if(!be){let Te=we.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),mt=Te.includes("{{")&&Te.includes("}}"),kt=Te.includes("{!!")&&Te.includes("!!}");if(mt||kt)Te=Ci(Te,We,j);let bt=le.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");tt.push(`<script${bt}>${Te}</script>`)}}let nt=J(ne).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Jt=nt?nt[1]:"",cs=nt?nt[2]:"",pt="",re=Jt&&/\bscoped\b/i.test(Jt);if(nt)pt=`<style${Jt}>${_u(cs,We,j)}</style>`;let ae=Ut;if(ae=ae.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),nt)ae=ae.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let oe=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,le=[];if(ae=ae.replace(oe,(we,be)=>{let Xe=be.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Xe)le.push(`<style${Xe[1]}>${Xe[2]}</style>`);return""}),ae=ae.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),le.length>0)pt=`${pt}${le.join(`
|
|
577
|
+
`)}`}if(n&&ae.includes("{{ text || slot }}"))ae=ae.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>n);let{applySlots:he}=await o("stx/slots",()=>import("./chunk-4hfh5ety.js")),{defaultSlot:$e,namedSlots:Pe}=rt,Ve=a.__stx_signals_gate===!0&&/\s(?:@[\w:.-]+|x-on:[\w:.-]+)\s*=/.test(Ye),it=tt.length>0&&Zs(ae)||c._nativeHostAttrs===!0&&tt.length>0||Ve&&tt.length>0||tt.some((oe)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(oe)),ls=(oe)=>it?lo(oe,ut):oe,us=new Map([...Pe].map(([oe,le])=>[oe,{...le,content:ls(le.content)}]));ae=await he(ae,it?co(ls($e),ut):$e,us,We,it?ut:"");let dn=ki(tt),Gt=(Array.isArray(We.__stx_client_signal_names)?We.__stx_client_signal_names:[]).filter((oe)=>!Xt.has(oe));if(dn.length>0||Gt.length>0)We.__stx_client_signal_names=[...new Set([...Gt,...dn])];else delete We.__stx_client_signal_names;let Yt=T.filter((oe)=>!Xt.has(oe)&&!(oe in t));if(Yt.length>0)We[Jn]=Yt;let $n={...c,_rootComponentsDir:c._rootComponentsDir||c.componentsDir,componentsDir:ce.dirname(j),skipSignalsRuntime:!0,skipEventDirectives:c._nativeHostAttrs===!0||it||tt.length===0,defaultLayout:void 0};We.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:En}=await o("stx/process",()=>import("./chunk-pd0wdjqd.js")),dt=await En(ae,We,j,$n,v),xt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let oe of dt.matchAll(/\{\{([\s\S]*?)\}\}/g))xt.add(oe[1].trim());if(xt.size>0)a.__stx_preserved_client_expressions=[...xt];let gt=ut,qe=dt;if(it){let oe="";if(Object.keys(t).length>0)try{oe=` data-stx-props="${or(JSON.stringify(t))}"`}catch{}let le=B?` stx-hydrate="${or(B)}"`:"",we=Object.fromEntries(Object.entries(et).map(([wt,Ct])=>[wt,Boolean(Ct)])),be=Object.keys(we).length>0?` data-stx-slots="${or(JSON.stringify(we))}"`:"",Xe=` data-stx-scope="${gt}"${oe}${be}${le}`,Te=dt.slice(It(dt)),mt=/^<span(?=[\s/>])/i.test(Te),kt=/^<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(Te),bt=/^<[^>]+\bdata-stx-fill-root(?:\s|=|>)/i.test(Te),Rn=mt?"span":"div",fs=kt&&c._nativeHostAttrs?' style="display:flex;flex-direction:column;flex:1;min-height:0;min-width:0"':bt&&c._nativeHostAttrs?' style="width:100%;height:100%"':mt||kt?' style="display:contents"':"";qe=xg(dt,Xe)??`<${Rn}${Xe} data-stx-component-wrapper${fs}>${dt}</${Rn}>`;let ps=await Promise.all(tt.map(async(wt)=>{let Ct=wt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!Ct)return wt;let[,Qt,ds]=Ct,Tn=zo(wt,We,j);if(Tn!==null)return Tn;let Rt=await $u(ds,j,c.buildMode==="compile"),An=vn(Rt.clientCode,Le(We)),{vendorStyleTags:In}=Rt,Pn=An?`function(__scopeId) {
|
|
578
578
|
${An}
|
|
579
579
|
return (${Rt.factoryBody})(__scopeId);
|
|
580
580
|
}`:Rt.factoryBody,On=B?null:Rs(a,Pn),Dn=On?`window.__stxComponentFactories[${JSON.stringify(On)}](${JSON.stringify(gt)});`:`(${Pn})(${JSON.stringify(gt)});`;if(B)return`${In}<script type="stx/island" data-stx-island="${gt}" data-stx-scoped data-stx-owner="${gt}"${Qt}>${Dn}</script>`;return`${In}<script data-stx-scoped data-stx-run="always" data-stx-owner="${gt}"${Qt}>${Dn}</script>`}));if(qe=qe+`
|
|
@@ -600,7 +600,7 @@ ${Ee.yellow}${Ee.bold}Message:${Ee.reset} ${t}
|
|
|
600
600
|
`,b)P+=`
|
|
601
601
|
${Ee.blue}${Ee.bold}Context:${Ee.reset}
|
|
602
602
|
${Ee.dim}${b}${Ee.reset}
|
|
603
|
-
`;return P}function ge(){ln.clear(),cr.clear(),ns.clear(),lr.clear(),ur.clear(),fr.clear(),ss.clear()}function oy(){return{size:ln.size,maxSize:500}}var ar=w(128);async function $u(e,t,n){let i=S(e,t,n),a=ar.get(i);if(a){if(Fs(a.deps))return a;ar.delete(i)}let l=xi(e,{filePath:t,projectRoot:process.cwd()}),c=l.code,b=Si(l.styles);c=Lt(c).code;let{hasUserImports:v,bundleClientScript:T}=await o("stx/client-script-bundler",()=>import("./chunk-
|
|
603
|
+
`;return P}function ge(){ln.clear(),cr.clear(),ns.clear(),lr.clear(),ur.clear(),fr.clear(),ss.clear()}function oy(){return{size:ln.size,maxSize:500}}var ar=w(128);async function $u(e,t,n){let i=S(e,t,n),a=ar.get(i);if(a){if(Fs(a.deps))return a;ar.delete(i)}let l=xi(e,{filePath:t,projectRoot:process.cwd()}),c=l.code,b=Si(l.styles);c=Lt(c).code;let{hasUserImports:v,bundleClientScript:T}=await o("stx/client-script-bundler",()=>import("./chunk-x1c1aggq.js")),P=[],D=!1;if(v(c)){let X=c;c=await T(X,t,{projectRoot:process.cwd(),minify:n,collectInputs:P}),D=c===X}let{stripStxRuntimeImports:H}=await o("stx/signal-processing",()=>import("./chunk-14vv64pw.js"));c=H(c);let O=I(c),L=mu(O),F=new Set(V(O,!0).split(",").map((X)=>X.trim())),B=`function(__scopeId) {
|
|
604
604
|
${lt("const",[...yl,...L],O)}
|
|
605
605
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
606
606
|
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Lh,Bf,Ye,fc,jh,us,ds,ps}from"./chunk-
|
|
2
|
+
import{Lh,Bf,Ye,fc,jh,us,ds,ps}from"./chunk-d5m6xy9p.js";import"./chunk-e0dgx3ev.js";import"./chunk-332qk8tm.js";import"./chunk-m710wkr4.js";import"./chunk-833y1ndd.js";import"./chunk-r53tqxmq.js";import"./chunk-n2z4kyba.js";import"./chunk-v4bqmzj9.js";import"./chunk-k47addf7.js";import"./chunk-xppm4cs4.js";import"./chunk-agbkv9ab.js";export{jh as clearOnceStore,fc as onceStore,Ye as partialsCache,us as processIncludes,ds as processStackPushDirectives,ps as processStackReplacements,Lh as resetUnscopedSignalWarnings,Bf as topLevelElements};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import{de}from"./chunk-8cvgm13s.js";import{He,M}from"./chunk-v4bqmzj9.js";import{Tc}from"./chunk-2rg9pqmh.js";import{c}from"./chunk-z33esms3.js";import v from"fs";import m from"path";import{pathToFileURL as I}from"url";var P=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],R=new Set;function ln(s,l={}){let o=m.resolve(s,l.dir??"server/api"),i=[],f=new Map;if(!v.existsSync(o))return i;let t=Array.from(new Bun.Glob("**/*.{ts,js,mts,mjs}").scanSync({cwd:o})).sort();for(let e of t){if(e.endsWith(".d.ts"))continue;let p=e.replace(/\.(?:ts|js|mts|mjs)$/,"").split("/"),n=p.pop(),u=n.lastIndexOf("."),d=u>=0?n.slice(u+1):"get",g=d.toUpperCase();if(!P.includes(g)||d!==d.toLowerCase())throw Error(`Unsupported API method suffix in ${e}; use ${P.map((A)=>A.toLowerCase()).join(", ")}`);if(u>=0)n=n.slice(0,u);if(n!=="index")p.push(n);let r=new Set,h=p.map((A,j)=>{let y=/^\[(\.\.\.)?([A-Za-z_]\w*)\]$/.exec(A);if(y){if(r.has(y[2])||y[1]&&j!==p.length-1)throw Error(`Invalid API parameter in ${e}`);return r.add(y[2]),`:${y[2]}${y[1]?"*":""}`}if(!/^[\w-]+$/.test(A))throw Error(`Unsupported API path segment ${A} in ${e}`);return A}),w=`/api${h.length?`/${h.join("/")}`:""}`,S=`${g} ${w.replace(/:\w+/g,":param")}`;if(f.has(S))throw Error(`Ambiguous API route ${g} ${w}: ${f.get(S)} and ${e}`);f.set(S,e);let x=m.join(o,e);R.add(m.resolve(x)),R.add(v.realpathSync(x)),i.push({pattern:w,method:g,filePath:x})}return i.sort((e,a)=>{let p=e.pattern.split("/"),n=a.pattern.split("/"),u=(d)=>d?.endsWith("*")?0:d?.startsWith(":")?1:2;for(let d=0;d<Math.max(p.length,n.length);d++){let g=u(n[d])-u(p[d]);if(g)return g}return e.pattern.localeCompare(a.pattern)||e.method.localeCompare(a.method)})}async function No(s,l){let o=c(s,"api-types.d.ts"),i=["// Generated by stx. Include this file in tsconfig.json.","declare module '@stacksjs/stx/api-client' {"," interface KnownApiRoutes {"];for(let t of l){let e=`./${m.relative(m.dirname(o),t.filePath).replace(/\\/g,"/")}`,{params:a}=de(t.pattern);i.push(` ${JSON.stringify(`${t.method} ${t.pattern}`)}: { params: { ${a.map((p)=>`${JSON.stringify(p)}: string`).join("; ")} }; response: Awaited<ReturnType<typeof import(${JSON.stringify(e)}).default>> }`)}i.push(" }","}","export {}","");let f=i.join(`
|
|
3
3
|
`);if(!await Bun.file(o).exists()||await Bun.file(o).text()!==f)await Bun.write(o,f);return o}async function Mo(s,l,o={}){let i=ln(s,o);await No(s,i);let f=[];for(let t of i){let e=await Bun.build({entrypoints:[t.filePath],target:"bun",format:"esm",minify:!1,splitting:!1});if(!e.success)throw Error(`API build failed for ${t.filePath}: ${e.logs.join(`
|
|
4
|
-
`)}`);let a=e.outputs.find((u)=>u.kind==="entry-point");if(!a)throw Error(`No API bundle for ${t.filePath}`);if(e.outputs.length!==1)throw Error(`API endpoint ${t.filePath} emits assets; package those explicitly instead`);let n=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await a.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write(m.join(l,n),a),f.push({...t,filePath:n})}return f}function E(s,l){let o=s.map((i)=>({route:i,...de(i.pattern)}));return async(i)=>{let f=new URL(i.url).pathname,t=o.filter((r)=>r.regex.test(f));if(!t.length)return null;let e=t[0].route.pattern,a=(r)=>r.replace(/:\w+/g,":param"),p=t.filter((r)=>a(r.route.pattern)===a(e)),n=i.method,u=p.find((r)=>r.route.method===n)??(n==="HEAD"?p.find((r)=>r.route.method==="GET"):void 0);if(!u){let r=new Set(p.map((h)=>h.route.method));if(r.has("GET"))r.add("HEAD");return r.add("OPTIONS"),new Response(null,{status:n==="OPTIONS"?204:405,headers:{Allow:Array.from(r).sort().join(", ")}})}let d=u.regex.exec(f),g=Object.create(null);try{u.params.forEach((r,h)=>{g[r]=decodeURIComponent(d[h+1])})}catch{return new Response("Invalid URL parameter encoding",{status:400})}try{let r=await l(u.route);if(typeof r!=="function")throw Error(`API endpoint ${u.route.filePath} must default-export a handler`);let h=await r(i,{params:g}),w=h instanceof Response?h:h===void 0?new Response(null,{status:204}):Response.json(h);if(n==="HEAD")return new Response(null,{status:w.status,headers:w.headers});return w}catch(r){return console.error(`[stx] API error for ${n} ${e}:`,r),Response.json({error:"Internal Server Error"},{status:500})}}}function Do(s,l){return E(l,async(o)=>(await import(I(m.resolve(s,o.filePath)).href)).default)}async function Oh(s,l){if(!l)return async()=>null;let o=l===!0?{}:l,i=ln(s,o);return await No(s,i),async(f)=>{if(!new URL(f.url).pathname.match(/^\/api(?:\/|$)/))return null;try{let t=ln(s,o);await No(s,t);let{loadStxConfig:e}=await import("./chunk-
|
|
4
|
+
`)}`);let a=e.outputs.find((u)=>u.kind==="entry-point");if(!a)throw Error(`No API bundle for ${t.filePath}`);if(e.outputs.length!==1)throw Error(`API endpoint ${t.filePath} emits assets; package those explicitly instead`);let n=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await a.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write(m.join(l,n),a),f.push({...t,filePath:n})}return f}function E(s,l){let o=s.map((i)=>({route:i,...de(i.pattern)}));return async(i)=>{let f=new URL(i.url).pathname,t=o.filter((r)=>r.regex.test(f));if(!t.length)return null;let e=t[0].route.pattern,a=(r)=>r.replace(/:\w+/g,":param"),p=t.filter((r)=>a(r.route.pattern)===a(e)),n=i.method,u=p.find((r)=>r.route.method===n)??(n==="HEAD"?p.find((r)=>r.route.method==="GET"):void 0);if(!u){let r=new Set(p.map((h)=>h.route.method));if(r.has("GET"))r.add("HEAD");return r.add("OPTIONS"),new Response(null,{status:n==="OPTIONS"?204:405,headers:{Allow:Array.from(r).sort().join(", ")}})}let d=u.regex.exec(f),g=Object.create(null);try{u.params.forEach((r,h)=>{g[r]=decodeURIComponent(d[h+1])})}catch{return new Response("Invalid URL parameter encoding",{status:400})}try{let r=await l(u.route);if(typeof r!=="function")throw Error(`API endpoint ${u.route.filePath} must default-export a handler`);let h=await r(i,{params:g}),w=h instanceof Response?h:h===void 0?new Response(null,{status:204}):Response.json(h);if(n==="HEAD")return new Response(null,{status:w.status,headers:w.headers});return w}catch(r){return console.error(`[stx] API error for ${n} ${e}:`,r),Response.json({error:"Internal Server Error"},{status:500})}}}function Do(s,l){return E(l,async(o)=>(await import(I(m.resolve(s,o.filePath)).href)).default)}async function Oh(s,l){if(!l)return async()=>null;let o=l===!0?{}:l,i=ln(s,o);return await No(s,i),async(f)=>{if(!new URL(f.url).pathname.match(/^\/api(?:\/|$)/))return null;try{let t=ln(s,o);await No(s,t);let{loadStxConfig:e}=await import("./chunk-j415w6dm.js"),a=M((await e(s)).runtimeConfig);return await He(a,()=>E(t,async(p)=>{let n=await Bun.build({entrypoints:[p.filePath],target:"bun",format:"esm",splitting:!1});if(!n.success)throw Error(n.logs.join(`
|
|
5
5
|
`));let u=n.outputs.find((d)=>d.kind==="entry-point");if(!u||n.outputs.length!==1)throw Error(`Unsupported API bundle output: ${p.filePath}`);return(await import(`data:text/javascript;base64,${Buffer.from(await u.text()).toString("base64")}`)).default})(f))}catch(t){return console.error("[stx] API discovery failed:",t),Response.json({error:"API discovery failed; check the server log"},{status:500})}}}function Lo(s,l,o){if(Tc(s))return!0;let i=/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/;if(i.test(m.basename(s)))return!0;try{if(i.test(m.basename(v.realpathSync(s))))return!0}catch{}if(R.has(m.resolve(s)))return!0;if(!o)return!1;let f=m.resolve(l,typeof o==="object"?o.dir??"server/api":"server/api"),t=(a)=>{try{return v.realpathSync(a)}catch{return m.resolve(a)}},e=t(s);return[f,m.resolve(l,"server"),m.resolve(l,".output/server")].some((a)=>{let p=t(a);return e===p||e.startsWith(`${p}${m.sep}`)})}
|
|
6
6
|
export{ln,No,Mo,Do,Oh,Lo};
|