@stacksjs/stx 0.2.411 → 0.2.413
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/builtins/image-delivery.d.ts +38 -0
- package/dist/builtins/image-delivery.js +17 -0
- package/dist/builtins/stx-image.js +1 -5
- package/dist/{chunk-btd7ds3x.js → chunk-0d0qeqvv.js} +1 -1
- package/dist/{chunk-zm4jetjz.js → chunk-0psndabd.js} +1 -1
- package/dist/{chunk-g5ny3aka.js → chunk-0qv8yf53.js} +1 -1
- package/dist/{chunk-q2ssypg6.js → chunk-0vkxyvsd.js} +1 -1
- package/dist/{chunk-73z5fzkn.js → chunk-0xqdmemy.js} +1 -1
- package/dist/{chunk-zyy4rakd.js → chunk-158wqccn.js} +12 -12
- package/dist/{chunk-aq1xq0r4.js → chunk-1cyxbb8y.js} +1 -1
- package/dist/{chunk-04tgatyy.js → chunk-1enwnh2a.js} +1 -1
- package/dist/{chunk-td08rnk3.js → chunk-213pzm0d.js} +1 -1
- package/dist/{chunk-8yfy9ch7.js → chunk-21hzqyja.js} +1 -1
- package/dist/{chunk-qvnbnsv9.js → chunk-24zher49.js} +1 -1
- package/dist/{chunk-cj3adc77.js → chunk-266t58b8.js} +1 -1
- package/dist/{chunk-90b2vt2n.js → chunk-2a9n102n.js} +1 -1
- package/dist/chunk-2eqzrczk.js +2 -0
- package/dist/{chunk-p4zrvt5f.js → chunk-2ke37m54.js} +1 -1
- package/dist/{chunk-hdysywd8.js → chunk-2snqdnk9.js} +1 -1
- package/dist/{chunk-1te8k8gp.js → chunk-35ds08e7.js} +1 -1
- package/dist/chunk-3mtwkjcg.js +2 -0
- package/dist/{chunk-36xaycje.js → chunk-4f9zyfdw.js} +19 -4
- package/dist/{chunk-50pszj17.js → chunk-4xr8zwkp.js} +1 -1
- package/dist/chunk-58v77x2c.js +2 -0
- package/dist/{chunk-9xew0kgf.js → chunk-5mhq8605.js} +1 -1
- package/dist/{chunk-zpcnbdhn.js → chunk-5se8xt9e.js} +2 -2
- package/dist/{chunk-tgadbsd4.js → chunk-5zh0h080.js} +1 -1
- package/dist/{chunk-y61n68ca.js → chunk-62435225.js} +1 -1
- package/dist/{chunk-vsbmc9kt.js → chunk-6n2rr3x7.js} +1 -1
- package/dist/{chunk-dzk2n4tv.js → chunk-6xk87qf2.js} +2 -2
- package/dist/{chunk-w4nspy4b.js → chunk-7ekd7zj9.js} +1 -1
- package/dist/{chunk-n2swas11.js → chunk-7pr3wdd5.js} +1 -1
- package/dist/{chunk-jr52y0j1.js → chunk-7rxvafwc.js} +1 -1
- package/dist/{chunk-zq4ssxj9.js → chunk-7tnwfa7w.js} +1 -1
- package/dist/chunk-8c5je0wf.js +2 -0
- package/dist/{chunk-kvmx7dnb.js → chunk-8dz6nyvx.js} +1 -1
- package/dist/{chunk-fpwzacpm.js → chunk-8sdhs0zk.js} +1 -1
- package/dist/{chunk-pan7wmdg.js → chunk-98zj3fv2.js} +2 -2
- package/dist/{chunk-2fw05hs2.js → chunk-ay6zjq8v.js} +1 -1
- package/dist/{chunk-gbmeh7jg.js → chunk-az4v4ard.js} +1 -1
- package/dist/chunk-ba5erggg.js +2 -0
- package/dist/chunk-bnagrdz6.js +2 -0
- package/dist/{chunk-5f0nwne4.js → chunk-bwjxk1dw.js} +2 -2
- package/dist/{chunk-spxsw4mp.js → chunk-by8wghtf.js} +1 -1
- package/dist/{chunk-00g9x6w2.js → chunk-cd7h4q51.js} +1 -1
- package/dist/{chunk-85sasgtc.js → chunk-cjmv8hgp.js} +1 -1
- package/dist/{chunk-ct1jwd4r.js → chunk-cthf912y.js} +1 -1
- package/dist/{chunk-9mm4e8hy.js → chunk-cxbpmwq5.js} +1 -1
- package/dist/chunk-d3sy16qn.js +2 -0
- package/dist/{chunk-1ws3xcea.js → chunk-dh6s7mrj.js} +1 -1
- package/dist/{chunk-0pkk226n.js → chunk-dm2nzg7a.js} +1 -1
- package/dist/{chunk-82pd4b5w.js → chunk-e2sgcnxc.js} +1 -1
- package/dist/chunk-e3b7jj74.js +2 -0
- package/dist/{chunk-mm9v8t7p.js → chunk-ec4wq2sv.js} +2 -2
- package/dist/{chunk-akwd34xt.js → chunk-ekzg97dn.js} +1 -1
- package/dist/chunk-epjt342x.js +2 -0
- package/dist/{chunk-60q6jwym.js → chunk-eqe26g14.js} +2 -2
- package/dist/chunk-ev0v1yma.js +2 -0
- package/dist/{chunk-m0ee1f3f.js → chunk-f53psr2y.js} +1 -1
- package/dist/{chunk-7kpr3fcp.js → chunk-f8p69dsg.js} +1 -1
- package/dist/{chunk-ph5wmtr9.js → chunk-f95drhdb.js} +1 -1
- package/dist/{chunk-esypgzzm.js → chunk-ff5a6hvb.js} +1 -1
- package/dist/chunk-fs5fy4h8.js +2 -0
- package/dist/chunk-fzsygce3.js +2 -0
- package/dist/chunk-g465x63k.js +2 -0
- package/dist/chunk-g708ekh1.js +2 -0
- package/dist/{chunk-9sxfybkc.js → chunk-gcr9e83g.js} +1 -1
- package/dist/{chunk-5zyeg43k.js → chunk-gdmyrsr8.js} +2 -2
- package/dist/{chunk-38wvkv3s.js → chunk-gkms2ngq.js} +1 -1
- package/dist/{chunk-rz9f3zqz.js → chunk-gnfywmgs.js} +2 -2
- package/dist/chunk-hpf8kq7e.js +2 -0
- package/dist/{chunk-0s34z9kx.js → chunk-j4x3faf8.js} +1 -1
- package/dist/chunk-jkavtw9f.js +2 -0
- package/dist/{chunk-563shnkz.js → chunk-kg1rdena.js} +2 -2
- package/dist/{chunk-t5ja7qkn.js → chunk-kgd8kchy.js} +1 -1
- package/dist/chunk-km91wx0v.js +2 -0
- package/dist/{chunk-1fs9jvpb.js → chunk-nk3czvnk.js} +1 -1
- package/dist/chunk-nmw4eewb.js +2 -0
- package/dist/{chunk-t1htzg9e.js → chunk-nq5zxrk0.js} +1 -1
- package/dist/{chunk-6kd5jjwc.js → chunk-p4wdxp2c.js} +1 -1
- package/dist/chunk-pdyeaxc1.js +2 -0
- package/dist/chunk-pf06ded4.js +2 -0
- package/dist/chunk-pfs0gpzm.js +2 -0
- package/dist/chunk-pshdwq44.js +2 -0
- package/dist/{chunk-s9za1vvd.js → chunk-pv3d7sfn.js} +1 -1
- package/dist/{chunk-x99xve3y.js → chunk-pwgv84pn.js} +2 -2
- package/dist/{chunk-92ysystz.js → chunk-pwsnafp3.js} +159 -159
- package/dist/chunk-qr346wnp.js +2 -0
- package/dist/{chunk-8w2mqdnv.js → chunk-r02hke04.js} +1 -1
- package/dist/chunk-ranshpyc.js +3 -0
- package/dist/{chunk-hyhba18z.js → chunk-rn194bhp.js} +1 -1
- package/dist/{chunk-gvbf1mhs.js → chunk-rn1hgyc8.js} +1 -1
- package/dist/{chunk-p5wp0ce6.js → chunk-s7z5dp70.js} +1 -1
- package/dist/{chunk-nvex8g39.js → chunk-smcj3442.js} +1 -1
- package/dist/{chunk-k80sn8d1.js → chunk-sn7exv0n.js} +1 -1
- package/dist/{chunk-bbt3tp6f.js → chunk-t6qx04s8.js} +1 -1
- package/dist/chunk-t6y6gyps.js +2 -0
- package/dist/chunk-tjfs7cc3.js +2 -0
- package/dist/chunk-tntv9hvq.js +2 -0
- package/dist/{chunk-gc06g35w.js → chunk-vd4cb5xr.js} +1 -1
- package/dist/{chunk-tgrpp58r.js → chunk-vkhdce50.js} +1 -1
- package/dist/{chunk-qmmp5kb5.js → chunk-w183av08.js} +1 -1
- package/dist/{chunk-fcnrgxck.js → chunk-w2m02njv.js} +1 -1
- package/dist/chunk-wpjrcrs5.js +2 -0
- package/dist/{chunk-pbnz7259.js → chunk-wqmppf6b.js} +1 -1
- package/dist/{chunk-1qq26zt0.js → chunk-wtb9fxdy.js} +1 -1
- package/dist/{chunk-esr0mfyc.js → chunk-xmzygmcz.js} +1 -1
- package/dist/{chunk-vx86cf4r.js → chunk-xssw417m.js} +1 -1
- package/dist/{chunk-naw4jt7j.js → chunk-xxzefj4j.js} +1 -1
- package/dist/{chunk-bn1edb1y.js → chunk-yq8x8bxq.js} +2 -2
- package/dist/{chunk-z5rwnnk1.js → chunk-ytma76qe.js} +1 -1
- package/dist/{chunk-603x5gb2.js → chunk-yw1m115e.js} +1 -1
- package/dist/{chunk-mq5ewmz6.js → chunk-z64a924m.js} +1 -1
- package/dist/cli.js +14 -14
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/database.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/pwa.js +2 -2
- package/dist/ssg.js +2 -2
- package/dist/visual-testing.js +1 -1
- package/package.json +5 -5
- package/dist/chunk-1y6ejjrk.js +0 -2
- package/dist/chunk-213jwgpx.js +0 -3
- package/dist/chunk-21wkhpvg.js +0 -2
- package/dist/chunk-2a3vwvqv.js +0 -2
- package/dist/chunk-32mjs2sw.js +0 -2
- package/dist/chunk-3w6z6tw9.js +0 -2
- package/dist/chunk-5f6r72kw.js +0 -2
- package/dist/chunk-5jy3f138.js +0 -2
- package/dist/chunk-87egs73t.js +0 -2
- package/dist/chunk-a4vf72a0.js +0 -2
- package/dist/chunk-bcyw6frx.js +0 -2
- package/dist/chunk-cqn117hn.js +0 -2
- package/dist/chunk-ctpyb5qn.js +0 -2
- package/dist/chunk-g50agfg7.js +0 -2
- package/dist/chunk-j9760xb0.js +0 -2
- package/dist/chunk-jecj1xg9.js +0 -2
- package/dist/chunk-jxvmf02k.js +0 -2
- package/dist/chunk-khmgbnsa.js +0 -2
- package/dist/chunk-kj8wnz6f.js +0 -2
- package/dist/chunk-mgrckqww.js +0 -2
- package/dist/chunk-ndq5gnzs.js +0 -2
- package/dist/chunk-pjrn29gg.js +0 -2
- package/dist/chunk-q738pwv6.js +0 -2
- package/dist/chunk-smfnkpny.js +0 -2
- package/dist/chunk-w02zw7et.js +0 -2
- package/dist/chunk-wkanrfb3.js +0 -2
- package/dist/chunk-x4wjtspw.js +0 -2
- package/dist/chunk-xv1t91fk.js +0 -2
|
@@ -24,6 +24,44 @@ export declare function getImageDelivery(src: string): ImageDeliveryManifest | u
|
|
|
24
24
|
* there, so a placeholder has to stay out of it entirely.
|
|
25
25
|
*/
|
|
26
26
|
export declare function isTransparentImage(src: string): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* The modern-format `<source>` families worth offering for a delivered image,
|
|
29
|
+
* smallest first.
|
|
30
|
+
*
|
|
31
|
+
* A modern extension is not automatically an optimization. Browsers use the
|
|
32
|
+
* first supported `<source>`, so any family that costs at least as much as the
|
|
33
|
+
* fallback is left out.
|
|
34
|
+
*/
|
|
35
|
+
export declare function efficientDeliverySources(delivery: ImageDeliveryManifest): Array<{
|
|
36
|
+
format: 'avif' | 'webp';
|
|
37
|
+
srcset: string;
|
|
38
|
+
}>;
|
|
39
|
+
/** What a component needs to render one delivered image. */
|
|
40
|
+
export interface DeliveredImage {
|
|
41
|
+
/** The fallback variant's URL, for `<img src>`. */
|
|
42
|
+
src: string;
|
|
43
|
+
/** The fallback format at every width, for `<img srcset>`. */
|
|
44
|
+
srcset: string;
|
|
45
|
+
/** `<source>` elements to put ahead of the `<img>`, smallest family first. */
|
|
46
|
+
sources: Array<{
|
|
47
|
+
type: string;
|
|
48
|
+
srcset: string;
|
|
49
|
+
}>;
|
|
50
|
+
width: number;
|
|
51
|
+
height: number;
|
|
52
|
+
/** A data URL of the image's own preview, absent for a transparent image. */
|
|
53
|
+
placeholder?: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The optimized variants of a public image, ready for markup.
|
|
57
|
+
*
|
|
58
|
+
* `<StxImage>` renders from the catalog directly. A component that draws its
|
|
59
|
+
* own markup (the `<Image>` in @stacksjs/components) reads it through this, so
|
|
60
|
+
* an app gets the same responsive variants whichever `<Image>` resolves.
|
|
61
|
+
* Undefined when the image is not in the catalog: remote, an SVG, or a server
|
|
62
|
+
* that has not prepared delivery.
|
|
63
|
+
*/
|
|
64
|
+
export declare function deliveredImage(src: string): DeliveredImage | undefined;
|
|
27
65
|
/** Clear process-global delivery state between builds and tests. */
|
|
28
66
|
export declare function clearImageDeliveryCatalog(): void;
|
|
29
67
|
/** The catalog as plain data, for a worker to post back to the thread that serves. */
|
|
@@ -212,6 +212,23 @@ export function isTransparentImage(src) {
|
|
|
212
212
|
const key = normalizeLookupSource(src);
|
|
213
213
|
return key ? transparentSources.has(key) : !1;
|
|
214
214
|
}
|
|
215
|
+
export function efficientDeliverySources(delivery) {
|
|
216
|
+
const bytesByFormat = (format) => delivery.variants.filter((variant) => variant.format === format).reduce((total, variant) => total + variant.bytes, 0), fallbackBytes = bytesByFormat(delivery.fallback.format);
|
|
217
|
+
return ["avif", "webp"].map((format) => ({ format, srcset: delivery.sources[format] || "", bytes: bytesByFormat(format) })).filter((candidate) => candidate.srcset && candidate.bytes > 0 && candidate.bytes < fallbackBytes).sort((a, b) => a.bytes - b.bytes).map(({ format, srcset }) => ({ format, srcset }));
|
|
218
|
+
}
|
|
219
|
+
export function deliveredImage(src) {
|
|
220
|
+
const delivery = getImageDelivery(src);
|
|
221
|
+
if (!delivery)
|
|
222
|
+
return;
|
|
223
|
+
return {
|
|
224
|
+
src: delivery.fallback.url,
|
|
225
|
+
srcset: delivery.sources[delivery.fallback.format] || "",
|
|
226
|
+
sources: efficientDeliverySources(delivery).map(({ format, srcset }) => ({ type: `image/${format}`, srcset })),
|
|
227
|
+
width: delivery.source.width,
|
|
228
|
+
height: delivery.source.height,
|
|
229
|
+
placeholder: isTransparentImage(src) ? void 0 : delivery.placeholder?.dataUrl
|
|
230
|
+
};
|
|
231
|
+
}
|
|
215
232
|
export function clearImageDeliveryCatalog() {
|
|
216
233
|
deliveryCatalog = new Map;
|
|
217
234
|
transparentSources = new Set;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { forwardResolvedAttrs, forwardStaticAttrs } from "./attrs.js";
|
|
2
|
-
import { getImageDelivery, isTransparentImage } from "./image-delivery.js";
|
|
2
|
+
import { efficientDeliverySources, getImageDelivery, isTransparentImage } from "./image-delivery.js";
|
|
3
3
|
import { getImagePlaceholder } from "./image-placeholder.js";
|
|
4
4
|
import { sanitizeUrlValue } from "../url-safety.js";
|
|
5
5
|
const DEFAULT_BREAKPOINTS = {
|
|
@@ -29,10 +29,6 @@ function resolveBoolProp(props, key, defaultVal = !1) {
|
|
|
29
29
|
return stat !== "false" && stat !== !1;
|
|
30
30
|
return defaultVal;
|
|
31
31
|
}
|
|
32
|
-
function efficientDeliverySources(delivery) {
|
|
33
|
-
const bytesByFormat = (format) => delivery.variants.filter((variant) => variant.format === format).reduce((total, variant) => total + variant.bytes, 0), fallbackBytes = bytesByFormat(delivery.fallback.format);
|
|
34
|
-
return ["avif", "webp"].map((format) => ({ format, srcset: delivery.sources[format] || "", bytes: bytesByFormat(format) })).filter((candidate) => candidate.srcset && candidate.bytes > 0 && candidate.bytes < fallbackBytes).sort((a, b) => a.bytes - b.bytes).map(({ format, srcset }) => ({ format, srcset }));
|
|
35
|
-
}
|
|
36
32
|
function parseSizes(sizesStr) {
|
|
37
33
|
if (sizesStr.includes("(") || sizesStr.includes(","))
|
|
38
34
|
return sizesStr;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Jh as a,Kh as b,Lh as c,Mh as d,Nh as e,Oh as f,Ph as g}from"./chunk-t1tdjjht.js";import"./chunk-
|
|
2
|
+
import{Jh as a,Kh as b,Lh as c,Mh as d,Nh as e,Oh as f,Ph as g}from"./chunk-t1tdjjht.js";import"./chunk-ay6zjq8v.js";export{d as useVirtualList,b as processVirtualListDirectives,f as processVirtualGridDirectives,e as processInfiniteListDirectives,c as generateVirtualListCSS,g as default,a as createVirtualList};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Al as c,Bl as d,Cl as e,Dl as f,El as g,yl as a,zl as b}from"./chunk-
|
|
2
|
+
import{Al as c,Bl as d,Cl as e,Dl as f,El as g,yl as a,zl as b}from"./chunk-ec4wq2sv.js";import"./chunk-9fqp72ze.js";import"./chunk-tkyrk66a.js";import"./chunk-35ds08e7.js";import"./chunk-4f9zyfdw.js";import"./chunk-ay6zjq8v.js";export{e as productionApiDispatcher,g as isServerApiSource,b as generateApiTypes,a as discoverServerApi,f as createServerApi,d as createApiDispatcher,c as buildServerApi};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Aw as
|
|
2
|
+
import{Aw as q,Bw as r,Cw as s,Dw as t,Ew as u,Fw as v,Gw as w,Hw as x,Iw as y,Jw as z,Kw as A,Lw as B,Mw as C,Nw as D,Ow as E,Pw as F,Qw as G,Rw as H,Sw as I,Tw as J,Vw as K,Ww as L,Yw as M,kw as a,lw as b,mw as c,nw as d,ow as e,pw as f,qw as g,rw as h,sw as i,tw as j,uw as k,vw as l,ww as m,xw as n,yw as o,zw as p}from"./chunk-4f9zyfdw.js";import"./chunk-ay6zjq8v.js";M();export{o as setAppUrl,H as runMiddleware,r as route,j as resolveLayoutChain,s as resetRoutes,z as registerMiddleware,g as patternToRegex,t as navigateTo,h as matchRoute,E as loadMiddlewareFromDirectory,c as isNonPageRoutePattern,b as isNonPageRoutePath,B as hasMiddleware,L as getRouterScriptDev,K as getRouterScript,D as getMiddlewareNames,A as getMiddleware,d as generateRouteTypes,e as generateRouteManifest,n as formatRoutes,m as findErrorPage,f as filePathToPattern,J as extractLayoutMetadata,I as deriveLayoutGroup,q as defineRoutes,p as defineRoute,v as defineMiddleware,y as createStorageManager,w as createServerCookieManager,l as createRouter,F as createRouteLocation,G as createMiddlewareContext,x as createClientCookieManager,C as clearMiddleware,i as bracketPathToRegex,u as abortNavigation,k as Router,a as NON_PAGE_DIRS};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ao as b,Bo as c,Co as d,Do as e,Eo as f,Fo as g,Go as h,Ho as i,Io as j,Jo as k,Ko as l,Lo as m,Mo as n,zo as a}from"./chunk-
|
|
2
|
+
import{Ao as b,Bo as c,Co as d,Do as e,Eo as f,Fo as g,Go as h,Ho as i,Io as j,Jo as k,Ko as l,Lo as m,Mo as n,zo as a}from"./chunk-pwsnafp3.js";import"./chunk-1cyxbb8y.js";import"./chunk-zcz9rs6p.js";import"./chunk-v3nwkveg.js";import"./chunk-9fqp72ze.js";import"./chunk-0btmm4m2.js";import"./chunk-pwgv84pn.js";import"./chunk-tkyrk66a.js";import"./chunk-ranshpyc.js";import"./chunk-98zj3fv2.js";import"./chunk-35ds08e7.js";import"./chunk-5se8xt9e.js";import"./chunk-gnfywmgs.js";import"./chunk-yq8x8bxq.js";import"./chunk-266t58b8.js";import"./chunk-nq5zxrk0.js";import"./chunk-az4v4ard.js";import"./chunk-4f9zyfdw.js";import"./chunk-xssw417m.js";import"./chunk-kg1rdena.js";import"./chunk-ay6zjq8v.js";export{n as stripStxRuntimeImports,b as scanScriptTags,m as rewriteStxImportSpecifiers,k as processSignals,i as processScriptSetup,f as preEvalLiteralReactiveIfs,c as parseLoopExpression,d as hasSignalsSyntax,l as findMarkupIndexOutsideScripts,j as extractExports,h as convertSignalLoopsToAttributes,e as convertSignalDirectivesToAttributes,g as convertServerLoopAttributesToDirectives,a as clearScriptScanCache};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Mm as b}from"./chunk-
|
|
2
|
+
import{Mm as b}from"./chunk-pwsnafp3.js";import{Fv as L,Jv as R}from"./chunk-yq8x8bxq.js";function P(j,U){let Q=1,J=U,B="<template",z="</template";while(J<j.length&&Q>0){let G=j.indexOf("<",J);if(G===-1)break;if(J=G,j.startsWith(B,J)&&(J+B.length>=j.length||/[\s>\/]/.test(j[J+B.length]))){Q++,J+=B.length;continue}if(j.startsWith(z,J)){let W=j.indexOf(">",J+z.length);if(W!==-1){if(Q--,Q===0)return W+1;J=W+1;continue}}J++}return Q===0?J:-1}var F=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function O(j,U){let Q=null;for(let J=U;J<j.length;J++){let B=j[J];if(Q){if(B==="\\"){J++;continue}if(B===Q)Q=null;continue}if(B==='"'||B==="'"){Q=B;continue}if(B===">")return J+1}return-1}function I(j,U,Q){let J=U.toLowerCase(),B=1,z=Q;while(z<j.length){let G=j.indexOf("<",z);if(G===-1)return-1;if(j.startsWith("<!--",G)){let $=j.indexOf("-->",G+4);z=$===-1?j.length:$+3;continue}let W=O(j,G+1);if(W===-1)return-1;let Z=j.slice(G,W),Y=Z.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(Y&&Y[2].toLowerCase()===J){if(Y[1]==="/"){if(B--,B===0)return W}else if(!/\/\s*>$/.test(Z))B++}z=W}return-1}function w(j){let U=[],Q=[],J=/\bslot\s*=\s*(?:"([^"]+)"|'([^']+)')/i,B=0;while(B<j.length){let z=j.indexOf("<",B);if(z===-1)break;if(j.startsWith("<!--",z)){let X=j.indexOf("-->",z+4);B=X===-1?j.length:X+3;continue}let G=O(j,z+1);if(G===-1)break;let W=j.slice(z,G),Z=W.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!Z){B=G;continue}let Y=Z[2].toLowerCase();if(Z[1]==="/"){let X=Q.lastIndexOf(Y);if(X!==-1)Q.splice(X);B=G;continue}let $=/\/\s*>$/.test(W),K=Q.length===0?W.match(J):null;if(K){let X=K[1]||K[2],H=W.replace(J,"").replace(/\s+(?=\/?>$)/,"").replace(/\s{2,}/g," "),_=$||F.has(Y)?-1:I(j,Y,G);if(_===-1)U.push({start:z,end:G,slotName:X,element:H}),B=G;else U.push({start:z,end:_,slotName:X,element:H+j.slice(G,_)}),B=_;continue}if(!$&&!F.has(Y)){if(Q.push(Y),Y==="script"||Y==="style"){let X=j.toLowerCase().indexOf(`</${Y}>`,G);if(X!==-1){B=X;continue}}}B=G}return U}function D(j){let U=[],Q=[],J=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,B=0;while(B<j.length){let z=j.indexOf("<",B);if(z===-1)break;if(j.startsWith("<!--",z)){let X=j.indexOf("-->",z+4);B=X===-1?j.length:X+3;continue}let G=O(j,z+1);if(G===-1)break;let W=j.slice(z,G),Z=W.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!Z){B=G;continue}let Y=Z[1]==="/",$=Z[2].toLowerCase();if(Y){let X=Q.lastIndexOf($);if(X!==-1)Q.splice(X);B=G;continue}if($==="template"&&Q.length===0){let X=W.match(J);if(X){let H=P(j,G);if(H!==-1){let _=X[1]||X[2]||X[3];U.push({start:z,end:H,slotName:_,content:j.slice(G,H-11).trim(),propsBinding:X[4]||void 0}),B=H;continue}}}if(!/\/\s*>$/.test(W)&&!F.has($)){if(Q.push($),$==="script"||$==="style"){let X=j.toLowerCase().indexOf(`</${$}>`,G);if(X!==-1){B=X;continue}}}B=G}return U}function v(j){let U={default:"",named:new Map},Q=j,J=D(j);for(let z of J)U.named.set(z.slotName,{name:z.slotName,content:z.content,propsBinding:z.propsBinding});J.sort((z,G)=>G.start-z.start);for(let z of J)Q=Q.slice(0,z.start)+Q.slice(z.end);let B=w(Q);for(let z of B){let G=U.named.get(z.slotName);if(G)G.content+=z.element;else U.named.set(z.slotName,{name:z.slotName,content:z.element})}for(let z=B.length-1;z>=0;z--){let G=B[z];Q=Q.slice(0,G.start)+Q.slice(G.end)}return U.default=Q.trim(),U}function S(j){let U=j.match(/name\s*=\s*["']([^"']+)["']/),Q=U?U[1]:"",J={},B=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,z;while((z=B.exec(j))!==null)J[z[1]]=z[2];let G=j.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),W=G?G[1].trim():"";return{name:Q,props:J,defaultContent:W}}async function k(j,U,Q,J){if(!j)return Q;let B=j.content;if(j.propsBinding&&Object.keys(U).length>0){let z=j.propsBinding.trim(),G={...J};if(z.startsWith("{")&&z.endsWith("}")){let W=z.slice(1,-1).split(",").map((Z)=>Z.trim()).filter(Boolean);for(let Z of W){let[Y,$]=Z.split(":").map((X)=>X.trim()),K=$||Y;if(U[Y]!==void 0)G[K]=U[Y]}}else G[z]=U;B=N(B,G)}return B}function N(j,U){return j.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Q,J)=>{try{let B=J.trim(),z=y(B,U);return b(String(z??""))}catch{return`{{ ${J} }}`}})}function y(j,U){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(j)){let J=j.split("."),B=U;for(let z of J)if(B&&typeof B==="object"&&z in B)B=B[z];else return;return B}let Q=j.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Q){let[,J,B,z]=Q,G=U[J],W=parseInt(z,10);if(typeof G==="number")switch(B){case"+":return G+W;case"-":return G-W;case"*":return G*W;case"/":return G/W}}try{if(!L(j))return;return R(j,Object.keys(U))(...Object.values(U))}catch{return}}async function T(j,U,Q){let J=j;J=await C(J,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,W,Z,Y)=>{let $=U.named.get(W),K=Y?.trim()||"",X=Z||"",H={},_=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,q;while((q=_.exec(X))!==null){let A=q[1],V=q[2];H[A]=y(V,Q)}return await k($,H,K,Q)});let z=/<slot\b((?:"[^"]*"|'[^']*'|[^>"'])*?)\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return J=J.replace(z,(G,W,Z)=>{if(/\bname\s*=/.test(W||""))return G;let Y=Z?.trim()||"";return U.default||Y}),J}async function C(j,U,Q){let J=[],B=[];j.replace(U,(W,...Z)=>{let Y=Z[Z.length-2];return B.push({match:W,index:Y}),J.push(Q(W,...Z.slice(0,-2))),W});let z=await Promise.all(J),G=j;for(let W=B.length-1;W>=0;W--){let{match:Z,index:Y}=B[W];G=G.slice(0,Y)+z[W]+G.slice(Y+Z.length)}return G}function E(j){let U=v(j);return{defaultSlot:U.default,namedSlots:U.named}}async function x(j,U,Q,J){return await T(j,{default:U,named:Q},J)}
|
|
3
3
|
export{v as Sg,S as Tg,k as Ug,T as Vg,E as Wg,x as Xg};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{cf as O$}from"./chunk-
|
|
2
|
+
import{cf as O$}from"./chunk-xmzygmcz.js";import{dg as Y3,hg as N$,ig as X7,jg as h6,lg as F1,mg as Z7,ng as z5,og as q$,pg as V$,rg as Q7,sg as Y7,wg as q5}from"./chunk-6xk87qf2.js";import{ij as a5,vj as Z6,wj as Q6,xj as Y6,yj as J6}from"./chunk-kgd8kchy.js";import{Cj as s1,Dj as D1,Ej as w1,Fj as t$,Gj as e$,Hj as J1,Jj as G6}from"./chunk-9e8t0twa.js";import{ek as L$,fk as F$}from"./chunk-f8p69dsg.js";import{Ik as o5,Jk as t5}from"./chunk-f53psr2y.js";import{Pk as z3,Qk as j3}from"./chunk-anydpa34.js";import{il as L1}from"./chunk-ff5a6hvb.js";import{Dl as w5,El as D7}from"./chunk-ec4wq2sv.js";import{Cp as e6,Dp as $7,Dq as q6,Eq as P1,Iq as e0,Mm as o0,Mr as S$,Or as n0,Pr as C0,Tr as k0,Wo as E0,aq as I0,dn as o6,fm as P7,fp as t0,hn as j5,kn as k1,ko as B$,ln as x1,vo as A$,vp as G3,xo as t6,ym as Q3,yo as b6,zr as z$}from"./chunk-pwsnafp3.js";import{At as H$,Et as J0,_s as U5,st as B,zt as j$}from"./chunk-pwgv84pn.js";import{Jt as p0}from"./chunk-tkyrk66a.js";import{$u as o1,Gv as A6,hv as W5,jv as K5,mv as t1,qv as _5,tv as U$,uv as P6}from"./chunk-yq8x8bxq.js";import{Mw as c6,Nw as l6,Ow as i6,Pw as a6,Qw as s6,Rw as r6,Tw as n6,Yw as f6,rw as F5,sw as g6,ww as m6,xw as p6}from"./chunk-4f9zyfdw.js";import{dx as q3,ex as S6,gx as B5}from"./chunk-kg1rdena.js";import{kx as s}from"./chunk-ay6zjq8v.js";var n$=null,o$=null;function R1(){if(!n$)n$=Q6(void 0,Z6);return n$}function i1(){if(!o$)o$=J6({state:J1,kept:R1(),matches:Y6});return o$}function E3($,X){return i1().cachedQuery($,X)}function I3($){i1().setScope($)}function R3(){return R1().flush()}var W6={read:($)=>{try{return JSON.parse($)}catch{return $}},write:($)=>{return JSON.stringify($)}};function D3($,X,Z={}){let{storage:Q="local",serializer:Y=W6,mergeDefaults:J=!1,listenToStorageChanges:G=!0}=Z,W=new Set,K=typeof window<"u",_=()=>{if(!K)return null;return Q==="session"?sessionStorage:localStorage},U=()=>{let L=_();if(!L)return X;try{let O=L.getItem($);if(O===null)return X;let N=Y.read(O);if(J&&typeof X==="object"&&X!==null)return{...X,...N};return N}catch{return X}},F=(L)=>{let O=_();if(!O)return;try{if(L===null||L===void 0)O.removeItem($);else O.setItem($,Y.write(L))}catch(N){console.warn(`[useStorage] Failed to write key "${$}":`,N)}},z=U(),j=(L,O)=>{for(let N of W)try{N(L,O)}catch(V){console.error("[useStorage] Subscriber error:",V)}};if(K&&G){let L=(N)=>{if(N.key===$&&N.storageArea===_()){let V=z;try{z=N.newValue?Y.read(N.newValue):X}catch(M){console.warn(`[useStorage] Failed to read key "${$}" from a cross-tab update:`,M);return}j(z,V)}};window.addEventListener("storage",L);let O=globalThis.onDestroy;if(typeof O==="function")O(()=>window.removeEventListener("storage",L))}let H={get value(){return z},set value(L){let O=z;z=L,F(L),j(L,O)},get:()=>z,set:(L)=>{H.value=L},remove:()=>{let L=_();if(L){L.removeItem($);let O=z;z=X,j(X,O)}},subscribe:(L)=>{return W.add(L),L(z,void 0),()=>W.delete(L)}};return H}function K6($,X,Z,Q,Y={}){let{serializer:J=W6,mergeDefaults:G=!1,listenToStorageChanges:W=!0}=Y,K=typeof window<"u",_=()=>{if(!K)return null;return $==="session"?sessionStorage:localStorage},U=(j)=>{if(j===null||j===void 0)return Q;try{let H=J.read(j);if(G&&typeof Q==="object"&&Q!==null)return{...Q,...H};return H}catch(H){return console.warn(`[${X}] Failed to read key "${Z}":`,H),Q}},z=J1((()=>{let j=_();if(!j)return Q;try{return U(j.getItem(Z))}catch(H){return console.warn(`[${X}] Cannot read "${Z}":`,H),Q}})());if(G6(()=>{let j=z(),H=_();if(!H)return;try{if(j===null||j===void 0)H.removeItem(Z);else H.setItem(Z,J.write(j))}catch(L){console.warn(`[${X}] Cannot persist "${Z}":`,L)}}),K&&W){let j=(L)=>{if(L.key!==Z)return;if(L.storageArea&&L.storageArea!==_())return;z.set(U(L.newValue))};window.addEventListener("storage",j);let H=globalThis.onDestroy;if(typeof H==="function")H(()=>window.removeEventListener("storage",j))}return z}function w3($,X,Z){return K6("local","useLocalStorage",$,X,Z)}function T3($,X,Z){return K6("session","useSessionStorage",$,X,Z)}function C3($="local"){if(typeof window>"u")return;($==="session"?sessionStorage:localStorage).clear()}function k3($="local"){if(typeof window>"u")return[];let X=$==="session"?sessionStorage:localStorage;return Object.keys(X)}function x3($="local"){if(typeof window>"u")return 0;let X=$==="session"?sessionStorage:localStorage,Z=0;for(let Q in X)if(Object.prototype.hasOwnProperty.call(X,Q))Z+=(Q.length+(X.getItem(Q)?.length||0))*2;return Z}var _6="stx:kept:";function U6($){return`${_6}${$===void 0||$===null||$===""||$===!1?"":`${$}:`}`}function S3($,X){return`${U6(X)}${$}`}function P3($,X,Z={}){let Q=Z.scope===void 0?i1().scope():Z.scope;if(Q===!1||Q===null||Q===""||typeof window>"u")return J1(X);let Y=S3($,Q),J=R1(),G=J.peek(Y),W=J1(G?G.value:X),K={},_=!1;if(W.subscribe((U)=>{if(U===K)return;_=!0,J.set(Y,U)}),!G)J.load(Y).then((U)=>{if(!U||_)return;K=U.value,W.set(U.value)});return W}function b3($){if(typeof window>"u")return Promise.resolve();return R1().forget(U6($))}var t=null;function a1($,X,Z=new WeakSet){if(Object.is($,X))return!0;if(typeof $!=="object"||typeof X!=="object"||$===null||X===null)return!1;if(Z.has($))return!0;if(Z.add($),$ instanceof Date&&X instanceof Date)return $.getTime()===X.getTime();if($ instanceof RegExp&&X instanceof RegExp)return $.source===X.source&&$.flags===X.flags;if(Array.isArray($)){if(!Array.isArray(X)||$.length!==X.length)return!1;for(let J=0;J<$.length;J++)if(!a1($[J],X[J],Z))return!1;return!0}if(Array.isArray(X))return!1;if($ instanceof Map){if(!(X instanceof Map)||$.size!==X.size)return!1;for(let[J,G]of $)if(!X.has(J)||!a1(G,X.get(J),Z))return!1;return!0}if(X instanceof Map)return!1;if($ instanceof Set){if(!(X instanceof Set)||$.size!==X.size)return!1;for(let J of $)if(!X.has(J))return!1;return!0}if(X instanceof Set)return!1;let Q=Object.keys($),Y=Object.keys(X);if(Q.length!==Y.length)return!1;for(let J of Q){if(!Object.prototype.hasOwnProperty.call(X,J))return!1;if(!a1($[J],X[J],Z))return!1}return!0}function gJ($){t=$}function fJ(){return t}function hJ(){return{isMounted:!1,isUnmounted:!1,hooks:{beforeMount:[],mounted:[],beforeUpdate:[],updated:[],beforeUnmount:[],unmounted:[]},effects:[],scope:y3()}}function y3(){return{refs:new Map,effects:new Set,cleanups:[]}}function dJ($){let X=new Set,Z=new Set,Q=$,Y=Symbol("ref"),J={get value(){let G=s1();if(G)Z.add(G);return Q},set value(G){if(!Object.is(G,Q)){let W=Q;Q=G;for(let K of X)K(G,W);for(let K of Z)if(t$())e$(K);else K()}},subscribe(G){return X.add(G),()=>{X.delete(G)}}};if(t)t.scope.refs.set(Y,J);return J}var B6=new WeakMap;function v3($){let X=B6.get($);if(X)return X;let Z=new Map,Q=(G)=>{let W=Z.get(G);if(!W)return;for(let K of[...W])if(t$())e$(K);else K()},Y=(G,W)=>{if(!Z.has(G))Z.set(G,new Set);return Z.get(G).add(W),()=>{Z.get(G)?.delete(W)}},J=new Proxy($,{get(G,W,K){let _=Reflect.get(G,W,K),U=s1();if(U)Y(W,U);if(_!==null&&typeof _==="object"&&!Array.isArray(_)){let F=Object.getPrototypeOf(_);if(F===Object.prototype||F===null)return v3(_)}return _},set(G,W,K,_){let U=Reflect.get(G,W,_),F=Reflect.set(G,W,K,_);if(!Object.is(K,U))Q(W);return F},deleteProperty(G,W){let K=Reflect.deleteProperty(G,W);return Q(W),K}});return B6.set($,J),J}function uJ($){let X,Z=!0,Q=new Set,Y=new Set,J=()=>{Z=!0,G()},G=()=>{if(Z){let K=X,_=D1(J);if(X=$(),w1(_),Z=!1,!Object.is(X,K)){for(let U of Q)U(X,K);for(let U of Y)U()}}},W=D1(J);return X=$(),Z=!1,w1(W),{get value(){let K=s1();if(K)Y.add(K);return G(),X},set value(K){console.warn("[stx] Computed properties are readonly")},subscribe(K){return Q.add(K),()=>{Q.delete(K)}}}}function g3($){if(typeof requestAnimationFrame==="function"){requestAnimationFrame(()=>{requestAnimationFrame($)});return}setTimeout($,0)}function mJ($,X,Z={}){let{immediate:Q=!1,deep:Y=!1,flush:J="post"}=Z,G,W,K=!1,_=()=>{if(K)return;let H=j();if((Y?!a1(H,G):!Object.is(H,G))||Q)if(X(H,G),Y&&H!==null&&typeof H==="object")try{G=structuredClone(H)}catch{G=H}else G=H},U=(H)=>{if(J==="sync")H();else if(J==="pre")Promise.resolve().then(H);else g3(H)},F=!1,z=()=>{if(K||F)return;F=!0,U(()=>{F=!1,_()})},j=()=>{if(typeof $==="function"){let H=D1(z);try{return $()}finally{w1(H)}}return $.value};if(typeof $!=="function"){let H=$.subscribe(()=>{U(_)});W=()=>{K=!0,H()}}else W=()=>{K=!0};if(G=j(),Q)U(_);if(t)t.scope.cleanups.push(()=>W?.());return()=>W?.()}function pJ($,X,Z={}){let Q=[],Y=$.map((J)=>J.value);for(let J of $){let G=J.subscribe(()=>{let W=$.map((K)=>K.value);X(W,Y),Y=[...W]});Q.push(G)}if(Z.immediate){let J=$.map((G)=>G.value);X(J,Y)}return()=>{for(let J of Q)J()}}function cJ($){let X,Z=!1,Q=()=>{if(Z)return;if(X)X();let Y=D1(Q);X=$(),w1(Y)};if(Q(),t)t.scope.cleanups.push(()=>{if(Z=!0,X)X()});return()=>{if(Z=!0,X)X()}}function lJ($){if(t)t.hooks.beforeMount.push($);else console.warn("[stx] onBeforeMount called outside of component setup")}function iJ($){if(t)t.hooks.mounted.push($);else console.warn("[stx] onMounted called outside of component setup")}function aJ($){if(t)t.hooks.beforeUpdate.push($);else console.warn("[stx] onBeforeUpdate called outside of component setup")}function sJ($){if(t)t.hooks.updated.push($);else console.warn("[stx] onUpdated called outside of component setup")}function rJ($){if(t)t.hooks.beforeUnmount.push($);else console.warn("[stx] onBeforeUnmount called outside of component setup")}function nJ($){if(t)t.hooks.unmounted.push($);else console.warn("[stx] onUnmounted called outside of component setup")}async function G1($,X){let Z=$.hooks[X];for(let Q of Z)await Q()}async function oJ($){await G1($,"beforeMount"),$.isMounted=!0,await G1($,"mounted")}async function tJ($){if(!$.isMounted||$.isUnmounted)return;await G1($,"beforeUpdate"),await G1($,"updated")}async function eJ($){if($.isUnmounted)return;await G1($,"beforeUnmount");for(let X of $.scope.cleanups)X();$.isUnmounted=!0,await G1($,"unmounted")}function $G(){return`
|
|
3
3
|
<script data-stx-client-runtime>
|
|
4
4
|
(function() {
|
|
5
5
|
'use strict';
|
|
@@ -697,7 +697,7 @@ else {
|
|
|
697
697
|
<span class="frontmatter-label">${X}:</span>
|
|
698
698
|
<span>${Array.isArray(Z)?Z.join(", "):String(Z)}</span>
|
|
699
699
|
</div>`).join("")}
|
|
700
|
-
</div>`}import k6 from"net";async function v4($){return new Promise((X)=>{let Z=k6.createServer();Z.once("error",()=>X(!1)),Z.once("listening",()=>{Z.close(()=>X(!0))}),Z.listen($,"0.0.0.0")})}async function g4($){return new Promise((X)=>{let Z=k6.createServer();Z.once("error",()=>X(!1)),Z.once("listening",()=>{Z.close(()=>X(!0))}),Z.listen($,"::")})}async function f4($){if(!await v4($))return!1;return await g4($)}async function u0($,X=20){$=Number($);for(let Z=0;Z<X;Z++){let Q=$+Z;if(await f4(Q))return Q}throw Error(`Could not find an available port between ${$} and ${$+X-1}`)}var h4={title:"stx Development",width:1400,height:900,darkMode:!0,hotReload:!0,titlebarHidden:!1,nativeSidebar:!1,sidebarWidth:260,sidebarConfig:void 0};async function d4(){try{let $=await import("./chunk-
|
|
700
|
+
</div>`}import k6 from"net";async function v4($){return new Promise((X)=>{let Z=k6.createServer();Z.once("error",()=>X(!1)),Z.once("listening",()=>{Z.close(()=>X(!0))}),Z.listen($,"0.0.0.0")})}async function g4($){return new Promise((X)=>{let Z=k6.createServer();Z.once("error",()=>X(!1)),Z.once("listening",()=>{Z.close(()=>X(!0))}),Z.listen($,"::")})}async function f4($){if(!await v4($))return!1;return await g4($)}async function u0($,X=20){$=Number($);for(let Z=0;Z<X;Z++){let Q=$+Z;if(await f4(Q))return Q}throw Error(`Could not find an available port between ${$} and ${$+X-1}`)}var h4={title:"stx Development",width:1400,height:900,darkMode:!0,hotReload:!0,titlebarHidden:!1,nativeSidebar:!1,sidebarWidth:260,sidebarConfig:void 0};async function d4(){try{let $=await import("./chunk-rn1hgyc8.js");if(typeof $.openDevWindow!=="function")return null;return $}catch{return null}}async function K1($,X={}){let Z={...h4,...X},Q=await d4();if(!Q)return console.log(`${B.yellow}\u26A0${B.reset} Native window requested, but @stacksjs/desktop is not available.`),console.log(" Install & build the desktop package to enable --native."),!1;try{let Y=await Q.openDevWindow($,{title:Z.title,width:Z.width,height:Z.height,darkMode:Z.darkMode,hotReload:Z.hotReload,titlebarHidden:Z.titlebarHidden,nativeSidebar:Z.nativeSidebar,sidebarWidth:Z.sidebarWidth,sidebarConfig:Z.sidebarConfig});if(Y&&Z.nativeSidebar)console.log(`${B.green}\u2713${B.reset} Native sidebar enabled (macOS Tahoe style)`);return Y}catch(Y){return console.log(`${B.red}\u2717${B.reset} Could not open native window:`,Y),!1}}function J$($){if($.match(/<Sidebar[\s\S]*?variant=["'](?:tahoe|vibrancy|desktop)["'][\s\S]*?\/>/i)){let Y=$.match(/<script\s+server[^>]*>([\s\S]*?)<\/script>/i);if(Y){let J=Y[1];try{let G=`
|
|
701
701
|
${J}
|
|
702
702
|
return typeof sidebarConfig !== 'undefined' ? sidebarConfig : null;
|
|
703
703
|
`,K=Function(G)();if(K)return K}catch(G){console.warn("Invalid sidebarConfig:",G)}}return{sections:[]}}let Z=$.match(/@nativeSidebar\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(Z)try{return JSON.parse(Z[1])}catch{console.warn("Invalid @nativeSidebar configuration")}let Q=$.match(/<script\s+native-sidebar[^>]*>([\s\S]*?)<\/script>/i);if(Q)try{let Y=Q[1].match(/(?:export\s+(?:default\s+)?|const\s+\w+\s*=\s*)(\{[\s\S]*\})/m);if(Y)return Function(`return ${Y[1]}`)()}catch(Y){console.warn("Invalid native-sidebar script configuration:",Y)}return}function Y5(){console.log(`
|
|
@@ -1069,7 +1069,7 @@ else {
|
|
|
1069
1069
|
};
|
|
1070
1070
|
})();
|
|
1071
1071
|
</script>
|
|
1072
|
-
`}function y0($,X,Z={}){let Q=i4(X,Z),Y=$.lastIndexOf("</body>");if(Y!==-1)return $.slice(0,Y)+Q+$.slice(Y);if($.includes("</html>"))return $.replace("</html>",`${Q}</html>`);return $+Q}function G$($){let X=$.toLowerCase();return X.endsWith(".css")||X.endsWith(".scss")||X.endsWith(".sass")||X.endsWith(".less")}function W$($){let X=$.toLowerCase();return[".stx",".html",".htm",".md",".js",".ts",".jsx",".tsx",".json"].some((Q)=>X.endsWith(Q))}function K$($){return[/^\./,/node_modules/,/\.stx\/output/,/\.stx\/cache/,/~$/,/\.swp$/,/\.swo$/].some((Z)=>Z.test($))}var U1=null;function _$($){if(!U1)U1=new x6($);return U1}function T1(){if(U1)U1.stop(),U1=null}import C1 from"path";B5();var B1={name:"bun-plugin-stx",async setup($){let Z={...await n0(),...$.config?.stx},Q=new Set,Y=Z.webComponents?.enabled?`./${C1.relative(C1.dirname($.config?.outdir||"dist"),Z.webComponents.outputDir||"dist/web-components")}`:"/web-components",J=[];if(Z.webComponents?.enabled)try{let G=await z$(Z,Q);if(J.push(...G),Z.debug&&G.length>0)console.log(`Successfully built ${G.length} web components`)}catch(G){console.error("Failed to build web components:",G)}$.onLoad({filter:/\.stx$/},async({path:G})=>{try{let W=new Set;if(Z.cache&&Z.cachePath){let L=await L$(G,Z);if(L){if(Z.debug)console.log(`Using cached version of ${G}`);return{contents:L,loader:"html"}}}let K=await _5(()=>Bun.file(G).text(),"",(L)=>{throw new K5(`Failed to read stx file: ${G}`,G,void 0,void 0,`File read error: ${L.message}`)});if(!K)throw new K5(`stx file is empty: ${G}`,G);let{scriptContent:_,templateContent:U,allScripts:F}=U5.time("script-extraction",()=>{let L=K,O=B$(K);if(O)L=O.content.trim();let N=K.match(/<script\b[^>]*>[\s\S]*?<\/script>/gi)||[],V="",M=[];for(let q of N){let I=q.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i)?.[1]||"",E=q.match(/<script\b([^>]*)>/i),w=E?E[1]:"";if(/\bserver\b/i.test(w))V=I;else M.push(q)}let A=L.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"");return{scriptContent:V,templateContent:A,allScripts:M}}),z={__filename:G,__dirname:C1.dirname(G),__stx:{webComponentsPath:Y,builtComponents:J}};await _5(()=>E0(_,z,G),void 0,(L)=>{let O=new W5(`Script execution failed in ${G}: ${L.message}`,G,void 0,void 0,_.substring(0,100));if(U$.log(O,{filePath:G,scriptContent:_}),Z.debug)throw O});let H=await U5.timeAsync("directive-processing",async()=>{return await I0(U,z,G,Z,W)});if(F.length>0){let{interpolateScriptsInTemplate:L}=await import("./chunk-
|
|
1072
|
+
`}function y0($,X,Z={}){let Q=i4(X,Z),Y=$.lastIndexOf("</body>");if(Y!==-1)return $.slice(0,Y)+Q+$.slice(Y);if($.includes("</html>"))return $.replace("</html>",`${Q}</html>`);return $+Q}function G$($){let X=$.toLowerCase();return X.endsWith(".css")||X.endsWith(".scss")||X.endsWith(".sass")||X.endsWith(".less")}function W$($){let X=$.toLowerCase();return[".stx",".html",".htm",".md",".js",".ts",".jsx",".tsx",".json"].some((Q)=>X.endsWith(Q))}function K$($){return[/^\./,/node_modules/,/\.stx\/output/,/\.stx\/cache/,/~$/,/\.swp$/,/\.swo$/].some((Z)=>Z.test($))}var U1=null;function _$($){if(!U1)U1=new x6($);return U1}function T1(){if(U1)U1.stop(),U1=null}import C1 from"path";B5();var B1={name:"bun-plugin-stx",async setup($){let Z={...await n0(),...$.config?.stx},Q=new Set,Y=Z.webComponents?.enabled?`./${C1.relative(C1.dirname($.config?.outdir||"dist"),Z.webComponents.outputDir||"dist/web-components")}`:"/web-components",J=[];if(Z.webComponents?.enabled)try{let G=await z$(Z,Q);if(J.push(...G),Z.debug&&G.length>0)console.log(`Successfully built ${G.length} web components`)}catch(G){console.error("Failed to build web components:",G)}$.onLoad({filter:/\.stx$/},async({path:G})=>{try{let W=new Set;if(Z.cache&&Z.cachePath){let L=await L$(G,Z);if(L){if(Z.debug)console.log(`Using cached version of ${G}`);return{contents:L,loader:"html"}}}let K=await _5(()=>Bun.file(G).text(),"",(L)=>{throw new K5(`Failed to read stx file: ${G}`,G,void 0,void 0,`File read error: ${L.message}`)});if(!K)throw new K5(`stx file is empty: ${G}`,G);let{scriptContent:_,templateContent:U,allScripts:F}=U5.time("script-extraction",()=>{let L=K,O=B$(K);if(O)L=O.content.trim();let N=K.match(/<script\b[^>]*>[\s\S]*?<\/script>/gi)||[],V="",M=[];for(let q of N){let I=q.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i)?.[1]||"",E=q.match(/<script\b([^>]*)>/i),w=E?E[1]:"";if(/\bserver\b/i.test(w))V=I;else M.push(q)}let A=L.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"");return{scriptContent:V,templateContent:A,allScripts:M}}),z={__filename:G,__dirname:C1.dirname(G),__stx:{webComponentsPath:Y,builtComponents:J}};await _5(()=>E0(_,z,G),void 0,(L)=>{let O=new W5(`Script execution failed in ${G}: ${L.message}`,G,void 0,void 0,_.substring(0,100));if(U$.log(O,{filePath:G,scriptContent:_}),Z.debug)throw O});let H=await U5.timeAsync("directive-processing",async()=>{return await I0(U,z,G,Z,W)});if(F.length>0){let{interpolateScriptsInTemplate:L}=await import("./chunk-7ekd7zj9.js"),O=L(F.join(`
|
|
1073
1073
|
`),z),N=H.search(/<\/body>/i);if(N!==-1)H=H.slice(0,N)+O+`
|
|
1074
1074
|
`+H.slice(N);else H+=`
|
|
1075
1075
|
${O}`}if(H=await b6(H),W.forEach((L)=>Q.add(L)),Z.cache&&Z.cachePath){if(await F$(G,H,W,Z),Z.debug)console.log(`Cached template ${G} with ${W.size} dependencies`)}return{contents:H,loader:"html"}}catch(W){let K=W instanceof Error?W:new W5(`Plugin processing failed: ${String(W)}`,G);if(U$.log(K,{filePath:G,buildConfig:$.config}),P6.logDetailedError(K,{filePath:G,plugin:"bun-plugin-stx"}),Z.debug)console.error("stx Plugin Error:",K);let _=K,U=_.line||null,F=_.context||null;return{contents:Z.debug||S6()?`<!DOCTYPE html>
|
|
@@ -1132,7 +1132,7 @@ ${O}`}if(H=await b6(H),W.forEach((L)=>Q.add(L)),Z.cache&&Z.cachePath){if(await F
|
|
|
1132
1132
|
<h1>Something went wrong</h1>
|
|
1133
1133
|
<p>An internal error occurred. Please try again later.</p>
|
|
1134
1134
|
</body>
|
|
1135
|
-
</html>`,loader:"html"}}})}};async function s4($,X={}){let Z=X.port||3000,Q=X.watch!==!1,Y=X.hotReload!==!1&&Q,J=null,G=X.hmrPort||Z+1,W=Q0.resolve($);if(!R0.existsSync(W))return console.error(`${B.red}Error: File not found: ${B.bright}${W}${B.reset}`),!1;if(W.endsWith(".md"))return G5(W,X);else if(!W.endsWith(".stx"))return console.error(`${B.red}Error: Unsupported file type: ${B.bright}${W}${B.reset}. Only .stx and .md files are supported.`),!1;let K=p0(process.cwd(),"output");R0.mkdirSync(K,{recursive:!0}),console.log(`${B.blue}Building ${B.bright}${$}${B.reset}...`);let _=null,U=async()=>{try{let I={name:"public-assets",setup(T){T.onResolve({filter:/^\/(images|fonts|assets|public)\//},(f)=>{return{path:f.path,external:!0}})}},E=await Bun.build({entrypoints:[W],outdir:K,plugins:[I,B1],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...X.stxOptions});if(!E.success)return console.error(`${B.red}Build failed:${B.reset}`,E.logs),!1;let w=E.outputs.find((T)=>T.path.endsWith(".html"));if(!w)return console.error(`${B.red}No HTML output found${B.reset}`),!1;return _=await Bun.file(w.path).text(),!0}catch(I){return console.error(`${B.red}Error building stx file:${B.reset}`,I),!1}};if(!await U())return!1;let z=Q0.dirname(W);await j$(z);let j=Z;try{if(j=await u0(Z),j!==Z)console.log(`${B.yellow}Port ${Z} is busy, using port ${j} instead${B.reset}`)}catch{return console.error(`${B.red}Could not find an available port${B.reset}`),!1}if(Y){let I=X.hmrPort||j+1;J=_$({wsPort:I,verbose:!1}),G=J.start(I)}let H={},L=null,O;try{let{loadStxConfig:I}=await import("./chunk-
|
|
1135
|
+
</html>`,loader:"html"}}})}};async function s4($,X={}){let Z=X.port||3000,Q=X.watch!==!1,Y=X.hotReload!==!1&&Q,J=null,G=X.hmrPort||Z+1,W=Q0.resolve($);if(!R0.existsSync(W))return console.error(`${B.red}Error: File not found: ${B.bright}${W}${B.reset}`),!1;if(W.endsWith(".md"))return G5(W,X);else if(!W.endsWith(".stx"))return console.error(`${B.red}Error: Unsupported file type: ${B.bright}${W}${B.reset}. Only .stx and .md files are supported.`),!1;let K=p0(process.cwd(),"output");R0.mkdirSync(K,{recursive:!0}),console.log(`${B.blue}Building ${B.bright}${$}${B.reset}...`);let _=null,U=async()=>{try{let I={name:"public-assets",setup(T){T.onResolve({filter:/^\/(images|fonts|assets|public)\//},(f)=>{return{path:f.path,external:!0}})}},E=await Bun.build({entrypoints:[W],outdir:K,plugins:[I,B1],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...X.stxOptions});if(!E.success)return console.error(`${B.red}Build failed:${B.reset}`,E.logs),!1;let w=E.outputs.find((T)=>T.path.endsWith(".html"));if(!w)return console.error(`${B.red}No HTML output found${B.reset}`),!1;return _=await Bun.file(w.path).text(),!0}catch(I){return console.error(`${B.red}Error building stx file:${B.reset}`,I),!1}};if(!await U())return!1;let z=Q0.dirname(W);await j$(z);let j=Z;try{if(j=await u0(Z),j!==Z)console.log(`${B.yellow}Port ${Z} is busy, using port ${j} instead${B.reset}`)}catch{return console.error(`${B.red}Could not find an available port${B.reset}`),!1}if(Y){let I=X.hmrPort||j+1;J=_$({wsPort:I,verbose:!1}),G=J.start(I)}let H={},L=null,O;try{let{loadStxConfig:I}=await import("./chunk-e3b7jj74.js"),E=await I();if(O=X.stxOptions?.serverApi??E.serverApi,E?.apiRouter)L=E?.apiRouter,console.log(`${B.blue}Using custom router for API handling${B.reset}`);if(E?.apiRoutes){H=E.apiRoutes;let w=Object.keys(H).length;if(w>0)console.log(`${B.blue}Loaded ${B.bright}${w} API route${w>1?"s":""}${B.reset}`)}if(E?.broadcasting?.enabled)try{let{startBroadcasting:w,loadChannels:D}=await import("./chunk-w183av08.js"),T=E.broadcasting;await w(T);let f=T.port??6001;console.log(`${B.magenta}Broadcasting on ${B.cyan}ws://localhost:${f}/ws${B.reset}`);let c=Q0.join(process.cwd(),"channels.ts");if(R0.existsSync(c))try{let v=await D(c);console.log(`${B.blue}Loaded ${B.bright}${v} broadcast channel${v!==1?"s":""}${B.blue} from channels.ts${B.reset}`)}catch(v){console.warn(`${B.yellow}Failed to load channels.ts: ${v.message}${B.reset}`)}}catch(w){console.warn(`${B.yellow}Broadcasting failed to start: ${w.message}${B.reset}`)}}catch{}let{createServerApi:N,isServerApiSource:V}=await import("./chunk-0psndabd.js"),M=await N(process.cwd(),O);if(console.log(`${B.blue}Starting server on ${B.cyan}http://localhost:${j}/${B.reset}...`),Y)console.log(`${B.magenta}Hot reload enabled on ws://localhost:${G}${B.reset}`);let A=a4({port:j,async fetch(I){return O$(I,await(async()=>{let E=new URL(I.url);if([K,Q0.dirname(W),Q0.join(process.cwd(),"public")].some((v)=>V(Q0.join(v,E.pathname),process.cwd(),O)))return new Response("Not Found",{status:404});if(L)try{let v=await L.handleRequest(I);if(v.status!==404)return v}catch{}if(H[E.pathname])try{return await H[E.pathname](I)}catch(v){return new Response(JSON.stringify({error:v.message}),{status:500,headers:{"Content-Type":"application/json"}})}let w=await M(I);if(w)return w;if(E.pathname==="/")return(async()=>{let S=await J0(_||"");if(Y)S=y0(S,G);if(X.native)if(S.includes("<head>"))S=S.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else if(S.includes("<html"))S=S.replace(/(<html[^>]*>)/,"$1<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>");else S="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+S;if(X.titlebarHidden)if(S.includes("<head>"))S=S.replace("<head>","<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script>");else if(S.includes("<html"))S=S.replace(/(<html[^>]*>)/,"$1<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>");else S=`<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>${S}`;return S})().then((S)=>new Response(S,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}}));let D=Q0.join(K,E.pathname);if(R0.existsSync(D)&&R0.statSync(D).isFile()){let v=Bun.file(D),S=Q0.extname(D).toLowerCase(),k="text/plain";if(S===".ts"||S===".tsx"){let N0=new Bun.Transpiler({loader:S===".tsx"?"tsx":"ts"}),W0=await v.text(),r0=N0.transformSync(W0);return new Response(r0,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(S){case".html":k="text/html";break;case".css":k="text/css";break;case".js":k="text/javascript";break;case".json":k="application/json";break;case".png":k="image/png";break;case".jpg":case".jpeg":k="image/jpeg";break;case".gif":k="image/gif";break;case".woff":k="font/woff";break;case".woff2":k="font/woff2";break;case".ttf":k="font/ttf";break;case".otf":k="font/otf";break;case".eot":k="application/vnd.ms-fontobject";break}return new Response(v,{headers:{"Content-Type":k}})}let T=Q0.dirname(W),f=Q0.join(T,E.pathname);if(R0.existsSync(f)&&R0.statSync(f).isFile()){let v=Bun.file(f),S=Q0.extname(f).toLowerCase(),k="text/plain";if(S===".ts"||S===".tsx"){let N0=new Bun.Transpiler({loader:S===".tsx"?"tsx":"ts"}),W0=await v.text(),r0=N0.transformSync(W0);return new Response(r0,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(S){case".html":k="text/html";break;case".css":k="text/css";break;case".js":k="text/javascript";break;case".json":k="application/json";break;case".png":k="image/png";break;case".jpg":case".jpeg":k="image/jpeg";break;case".gif":k="image/gif";break;case".svg":k="image/svg+xml";break;case".ico":k="image/x-icon";break;case".woff":k="font/woff";break;case".woff2":k="font/woff2";break;case".ttf":k="font/ttf";break;case".otf":k="font/otf";break;case".eot":k="application/vnd.ms-fontobject";break}return new Response(v,{headers:{"Content-Type":k}})}let c=Q0.join(process.cwd(),"public",E.pathname);if(R0.existsSync(c)&&R0.statSync(c).isFile()){let v=Bun.file(c),S=Q0.extname(c).toLowerCase(),k="application/octet-stream";if(S===".ts"||S===".tsx"){let N0=new Bun.Transpiler({loader:S===".tsx"?"tsx":"ts"}),W0=await v.text(),r0=N0.transformSync(W0);return new Response(r0,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(S){case".html":k="text/html";break;case".css":k="text/css";break;case".js":k="text/javascript";break;case".json":k="application/json";break;case".png":k="image/png";break;case".jpg":case".jpeg":k="image/jpeg";break;case".gif":k="image/gif";break;case".svg":k="image/svg+xml";break;case".ico":k="image/x-icon";break;case".woff":k="font/woff";break;case".woff2":k="font/woff2";break;case".ttf":k="font/ttf";break;case".otf":k="font/otf";break;case".eot":k="application/vnd.ms-fontobject";break}return new Response(v,{headers:{"Content-Type":k}})}return new Response("Not Found",{status:404})})())},error(I){return new Response(`<pre>${I}
|
|
1136
1136
|
${I.stack}</pre>`,{headers:{"Content-Type":"text/html"}})}});console.clear(),console.log(`
|
|
1137
1137
|
${B.blue}stx${B.reset} ${B.green}${process.env.stx_VERSION||"v0.0.10"}${B.reset} ${B.dim}ready in ${Math.random()*10+5|0}.${Math.random()*90+10|0} ms${B.reset}`),console.log(`
|
|
1138
1138
|
${B.bright}\u2192 ${B.cyan}http://localhost:${j}/${B.reset}`),console.log(`
|
|
@@ -1619,12 +1619,12 @@ ${H.stack}</pre>`,{headers:{"Content-Type":"text/html"}})}});console.clear(),con
|
|
|
1619
1619
|
${B.blue}stx${B.reset} ${B.green}${process.env.stx_VERSION||"v0.0.10"}${B.reset} ${B.dim}ready in ${Math.random()*10+5|0}.${Math.random()*90+10|0} ms${B.reset}`),console.log(`
|
|
1620
1620
|
${B.bright}\u2192 ${B.cyan}http://localhost:${U}/${B.reset}`),console.log(`
|
|
1621
1621
|
${B.yellow}Routes:${B.reset}`);let z=new Set(W.map((H)=>H.routeTemplate)),j=Object.entries(G).filter(([H])=>!z.has(H)).sort(([H],[L])=>H.localeCompare(L)).map(([H,L])=>({route:H==="/"?"/":H,filePath:L0.relative(process.cwd(),L.filePath),fileType:L.fileType}));for(let H of W){let L=H.routeTemplate.replace(/\[([^\]]+)\]/g,":$1");j.push({route:L,filePath:L0.relative(process.cwd(),H.filePath),fileType:"stx"})}if(j.sort((H,L)=>H.route.localeCompare(L.route)),j.forEach((H,L)=>{let N=L===j.length-1?"\u2514\u2500 ":"\u251C\u2500 ",V=H.fileType==="md"?`${B.magenta}(markdown)${B.reset}`:"";console.log(` ${B.green}${N}${H.route}${B.reset} \u2192 ${B.bright}${H.filePath}${B.reset} ${V}`)}),console.log(`
|
|
1622
|
-
Press ${B.cyan}h${B.reset} + ${B.cyan}Enter${B.reset} to show shortcuts`),m0(F.url.toString(),()=>{if(Q)c0.watch(J,{recursive:!0}).close();F.stop()}),Q){console.log(`${B.blue}Watching for changes...${B.reset}`);let H=c0.watch(J,{recursive:!0},async(L,O)=>{if(!O)return;if(O.endsWith(".stx")||O.endsWith(".js")||O.endsWith(".ts")||O.endsWith(".md"))console.log(`${B.yellow}File ${B.bright}${O}${B.yellow} changed, rebuilding...${B.reset}`),t0.clear(),e0(),await K()});process.on("SIGINT",()=>{H.close(),F.stop(),process.exit(0)})}return!0}function v6($){return String($??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}var{serve:o4}=globalThis.Bun;import e from"fs";import m from"path";async function u6($){try{return j5(await Bun.file($).text())}catch{return}}function L5($){let X=Bun.file($),Z=m.extname($).toLowerCase(),Q={".html":"text/html",".css":"text/css",".js":"text/javascript",".json":"application/json",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".ico":"image/x-icon",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"},J=[".js",".css",".json"].includes(Z)?{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}:{};return new Response(X,{headers:{"Content-Type":Q[Z]||"application/octet-stream",...J}})}async function t4($=".",X={}){let Z=X.port||3000,Q=X.watch!==!1,Y=X.hotReload!==!1&&Q,J=null,G=X.hmrPort||Z+1,W=m.resolve($),{loadStxConfig:K}=await import("./chunk-x4wjtspw.js"),_=await K(W),{createServerApi:U,isServerApiSource:F}=await import("./chunk-zm4jetjz.js"),z=X.stxOptions?.serverApi??_.serverApi,j=await U(W,z),H=_.root&&_.root!=="."?m.join(W,_.root):W,L=X.pagesDir||_.pagesDir||"pages",O=m.join(H,L);if(!e.existsSync(O)&&!_._layerPageDirs?.some((R)=>e.existsSync(R)))return console.error(`${B.red}Error: No '${L}' directory found${B.reset}`),console.log(`${B.dim}Looked in: ${B.bright}${O}${B.reset}`),console.log(`${B.dim}Run stx dev from the app directory, pass it as an argument (stx dev <dir>),${B.reset}`),console.log(`${B.dim}point at another directory with --pages <dir>, or set pagesDir in stx.config.ts.${B.reset}`),console.log(`${B.dim}Starting fresh? Create ${L}/index.stx for the homepage.${B.reset}`),!1;let N=A$(H,{pagesDir:L,pagesDirs:_._layerPageDirs?[O,..._._layerPageDirs.slice(1)]:void 0});if(N.length===0)return console.error(`${B.red}Error: No page files found in ${B.bright}${O}${B.reset}`),!1;console.log(`${B.blue}Found ${B.bright}${N.length}${B.blue} routes${B.reset}`);let V=_?._pluginPageDirs||[],M=[];for(let{dir:R,prefix:x}of V)if(e.existsSync(R)){let P=A$(m.dirname(R),{pagesDir:m.basename(R)});for(let y of P){let Z0=x==="/"?y.pattern:`${x}${y.pattern==="/"?"":y.pattern}`;M.push({route:{...y,pattern:Z0},prefix:x})}if(P.length>0)console.log(`${B.blue}Plugin pages: ${B.bright}${P.length}${B.blue} routes at ${B.cyan}${x}${B.reset}`)}let A=new Map,q=null,I=null;if(X.stxOptions?.shell!==!1){if(I=await Z7(W,X.stxOptions?.shell),I){if(q=await z5(I,X.stxOptions||{}),q)console.log(`${B.blue}Using app shell: ${B.bright}${m.relative(W,I)}${B.reset} ${B.dim}(deprecated: use layouts/default.stx instead)${B.reset}`)}}c6(),await i6(W);let E=l6();if(E.length>0)console.log(`${B.blue}Loaded ${B.bright}${E.length}${B.blue} middleware: ${B.dim}${E.join(", ")}${B.reset}`);let w={},D=null;try{let{loadStxConfig:R}=await import("./chunk-x4wjtspw.js"),x=await R(W);if(x?.apiRouter)D=x?.apiRouter,console.log(`${B.blue}Using custom router for API handling${B.reset}`);if(x?.apiRoutes){w=x.apiRoutes;let P=Object.keys(w).length;if(P>0)console.log(`${B.blue}Loaded ${B.bright}${P} API route${P>1?"s":""}${B.reset}`)}if(x?.broadcasting?.enabled)try{let{startBroadcasting:P,loadChannels:y}=await import("./chunk-qmmp5kb5.js"),Z0=x.broadcasting;await P(Z0);let w0=Z0.port??6001;console.log(`${B.magenta}Broadcasting on ${B.cyan}ws://localhost:${w0}/ws${B.reset}`);let h0=m.join(process.cwd(),"channels.ts");if(e.existsSync(h0))try{let p=await y(h0);console.log(`${B.blue}Loaded ${B.bright}${p} broadcast channel${p!==1?"s":""}${B.blue} from channels.ts${B.reset}`)}catch(p){console.warn(`${B.yellow}Failed to load channels.ts: ${p.message}${B.reset}`)}}catch(P){console.warn(`${B.yellow}Broadcasting failed to start: ${P.message}${B.reset}`)}}catch{}let T=p0(W,"output");e.mkdirSync(T,{recursive:!0});let f=new Map,c=new Set,v=async(R)=>{let x=m6(O,R);if(!x)return null;try{let P=await Bun.build({entrypoints:[x],outdir:T,plugins:[B1],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...X.stxOptions});if(!P.success)return null;let y=P.outputs.find((Z0)=>Z0.path.endsWith(".html"));if(!y)return null;return await Bun.file(y.path).text()}catch{return null}},S=new Map,k=async(R,x)=>{try{let{processDirectives:P,extractVariables:y,defaultConfig:Z0,loadStxConfig:w0,injectRouterScript:h0}=await import("./chunk-x4wjtspw.js"),{checkCache:p,cacheTemplate:u,readFileCached:g,templateCache:h}=await import("./chunk-32mjs2sw.js"),Y0=await w0(W),d0=(i)=>{if(!i)return i;if(m.isAbsolute(i))return i;return m.resolve(W,i)},C={...Z0,...Y0,...X.stxOptions,autoShell:!0};if(X.debugDirectives)C.debug=!0;C.partialsDir=d0(C.partialsDir),C.componentsDir=d0(C.componentsDir),C.layoutsDir=d0(C.layoutsDir),C.storesDir=d0(C.storesDir||"stores"),C.cachePath=d0(C.cachePath)??p0(W,"cache");let X0=!x&&!X.profile,a=C.cache!==!1;if(a&&X0){let i=h.get(R.filePath);if(i)try{if((await e.promises.stat(R.filePath)).mtime.getTime()<=i.mtime){let M0=!0;for(let U0 of i.dependencies){if(!e.existsSync(U0)){M0=!1;break}if((await e.promises.stat(U0)).mtime.getTime()>i.mtime){M0=!1;break}}if(M0){let U0=i.output;if(q)U0=V$(U0,{preserveHead:!0});let I1=S.get(R.filePath);return{route:R,content:U0,status:I1?.status??await u6(R.filePath),headers:I1?.headers}}}}catch{}let q0=await p(R.filePath,C);if(q0){let V0=q0;if(q)V0=V$(V0,{preserveHead:!0});let M0=S.get(R.filePath);return{route:R,content:V0,status:M0?.status??await u6(R.filePath),headers:M0?.headers}}}let o=a?await g(R.filePath):await Bun.file(R.filePath).text(),_0=j5(o),{classifyAllScripts:d}=await import("./chunk-x4wjtspw.js"),A0=d(o),T0=A0.server.map((i)=>i.content),r=o;for(let i of A0.server)r=r.replace(i.fullTag,"");let n={__filename:R.filePath,__dirname:m.dirname(R.filePath),__stx_options:C,params:x??{},__stx_runtime_head:{}};for(let i of T0)try{await y(i,n,R.filePath)}catch(q0){if(X.stxOptions?.debug)console.error("[stx] variable extraction error",R.filePath,q0?.message||q0)}let b0=new Set,H0;if(X.profile){let i=performance.now();H0=await P(r,n,R.filePath,C,b0);let q0=performance.now()-i,V0=m.relative(W,R.filePath)||R.filePath;console.log(`[stx:profile] ${V0} \u2192 ${q0.toFixed(2)}ms`)}else H0=await P(r,n,R.filePath,C,b0);if(!q)H0=await h0(H0,{router:C.router});{let{interpolateScriptExpressions:i}=await import("./chunk-w4nspy4b.js");H0=H0.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/g,(q0,V0,M0)=>{if(!/function\s+__stx_setup_/.test(M0))return q0;return`<script${V0}>${i(M0,n)}</script>`})}if(q)H0=V$(H0,{preserveHead:!0});if(a&&X0)await u(R.filePath,H0,b0,C);let{extractStreamBoundaries:M3}=await import("./chunk-xv1t91fk.js"),Y1=M3(n),E1=n.__streamTemplates;if(E1&&typeof E1==="object"&&Object.keys(E1).length>0){let i=n.streamBoundaries||{},q0={...C,autoShell:!1},V0=Object.keys(E1).map((U0)=>({id:U0,render:async()=>{let I1=typeof i[U0]==="function"?await i[U0]():void 0;return P(E1[U0],{...n,$boundary:I1},R.filePath,q0,new Set)}})),M0=new Set(V0.map((U0)=>U0.id));Y1=[...(Y1||[]).filter((U0)=>!M0.has(U0.id)),...V0]}if(Y1&&Y1.length>0)c.add(R.pattern);else Y1=void 0;let $6=k1(n),X6=x1(n);if(X0)S.set(R.filePath,{status:$6,headers:X6});return{route:R,content:H0,status:$6??_0,headers:X6,boundaries:Y1}}catch(P){return console.error(`${B.red}Error building ${B.bright}${R.pattern}${B.reset}:`,P),null}},N0=8,W0=async()=>{f.clear(),A.clear();for(let R=0;R<N.length;R+=N0){let x=N.slice(R,R+N0),P=await Promise.all(x.map((y)=>k(y)));for(let y of P)if(y)f.set(y.route.pattern,y)}for(let R=0;R<M.length;R+=N0){let x=M.slice(R,R+N0),P=await Promise.all(x.map(({route:y})=>k(y)));for(let y of P)if(y)A.set(y.route.pattern,y)}return f.size>0};if(console.log(`${B.blue}Building pages...${B.reset}`),!await W0())return console.error(`${B.red}No pages were successfully built${B.reset}`),!1;await j$(W);let f0=Z;try{if(f0=await u0(Z),f0!==Z)console.log(`${B.yellow}Port ${Z} is busy, using port ${f0} instead${B.reset}`)}catch{return console.error(`${B.red}Could not find an available port${B.reset}`),!1}if(Y){let R=X.hmrPort||f0+1;J=_$({wsPort:R,verbose:!1}),G=J.start(R)}let j0=(R,x)=>{let y=`<script data-stx-route-params>(function(){var p=${JSON.stringify(x).replace(/</g,"\\u003C").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")};window.__stx_rp=p;if(window.stx){window.stx._rp=p;if(window.stx.setRouteParams)window.stx.setRouteParams(p)}})()</script>`;if(R.includes("</head>"))return R.replace("</head>",`${y}</head>`);if(R.includes("<body"))return R.replace(/<body([^>]*)>/,`<body$1>${y}`);return y+R};console.log(`${B.blue}Starting server...${B.reset}`);let Q1=o4({port:f0,async fetch(R){let x=new URL(R.url),P=_?.publicDir||"public",y=m.join(W,P,x.pathname),Z0=m.join(W,x.pathname),w0=m.join(T,x.pathname);if([y,Z0,w0].some((C)=>F(C,W,z)))return new Response("Not Found",{status:404});let[h0,p,u]=await Promise.all([e.promises.stat(y).catch(()=>null),e.promises.stat(Z0).catch(()=>null),e.promises.stat(w0).catch(()=>null)]);if(h0?.isFile()&&!F(y,W,z))return L5(y);if(p?.isFile()&&!F(Z0,W,z))return L5(Z0);if(u?.isFile()&&!F(w0,W,z))return L5(w0);if(x.pathname.startsWith("/_stx/component/")){let C=decodeURIComponent(x.pathname.slice(16));if(C)try{let X0=`<${C} />`,a={...buildConfig,autoShell:!1},o=await processDirectives(X0,{},m.join(W,"components",`${C}.stx`),a,new Set);return new Response(o,{headers:{"Content-Type":"text/html"}})}catch(X0){return new Response(`<div class="stx-async-error">${X0.message}</div>`,{status:500,headers:{"Content-Type":"text/html"}})}}if(x.pathname==="/_stx/img"){let{handleImageRequest:C}=await import("./chunk-3w6z6tw9.js"),X0=await C(R,{publicDir:m.join(W,P),cacheDir:p0(W,"cache","img")});if(X0)return X0}if(D)try{let C=await D.handleRequest(R);if(C.status!==404)return C}catch{}if(w[x.pathname])try{return await w[x.pathname](R)}catch(C){return new Response(JSON.stringify({error:C.message}),{status:500,headers:{"Content-Type":"application/json"}})}let g=await j(R);if(g)return g;let h=F5(x.pathname,N);if(h){let C=f.get(h.route.pattern),X0=c.has(h.route.pattern);if(h.route.isDynamic&&Object.keys(h.params).length>0||X0){let a=await k(h.route,h.params);if(a)C=a}if(C){let a=C.status??200,o=C.headers??{},_0=(h.route.filePath?o6(await Bun.file(h.route.filePath).text().catch(()=>"")):null)??{};if(_0.validate){if(!await _0.validate({params:h.params})){let T0=await v(404);if(T0){let r=T0;if(r=await J0(r,W),Y)r=y0(r,G);return new Response(r,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})}}if(_0.middleware){let A0=a6(x.pathname,h.params,_0,x.search),T0=s6(A0,null,R,{isServer:!0}),r=await r6(_0.middleware,T0);if(r.redirect){let n=r.redirect.path,b0=r.redirect.options.redirectCode||302,H0=new Headers(r.responseHeaders);return H0.set("Location",n),new Response(null,{status:b0,headers:H0})}if(r.abort){let{statusCode:n,message:b0}=r.abort.error;return new Response(`<!DOCTYPE html><html><head><title>Error ${n}</title></head><body><h1>Error ${n}</h1><p>${b0}</p></body></html>`,{status:n,headers:{"Content-Type":"text/html"}})}if(Object.keys(r.state).length>0){let n=`<script>(function(){var s=typeof stx!=='undefined'?stx:{};s._ms=${JSON.stringify(r.state)};if(s.setMiddlewareState)s.setMiddlewareState(s._ms);})()</script>`;C.content=C.content.replace("</head>",`${n}</head>`)}}let d=C.content;if(q&&Q7(R)){let A0=n6(d),T0=t6(d),r=d.match(/<title[^>]*>([\s\S]*?)<\/title>/i),n=r?X7(r[1].trim()):"";if(Object.keys(h.params).length>0)d=j0(d,h.params);d=await J0(d,W);let b0=_?.router?.container||"main";return d=Y7(d,b0),new Response(d,{status:a,headers:{"Content-Type":"text/html","X-STX-Fragment":"true","X-STX-Layout":A0.layout,"X-STX-Layout-Group":A0.group,"X-STX-Runtime":T0?"true":"false",...n&&{"X-STX-Title":encodeURIComponent(n)},[e6]:$7(),...F1(),"Cache-Control":N$}})}if(q)d=q$(q,d);if(Object.keys(h.params).length>0)d=j0(d,h.params);if(d=await J0(d,W),Y)d=y0(d,G);if(X.native)if(d.includes("<head>"))d=d.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else d="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+d;if(X.titlebarHidden)if(d.includes("<head>"))d=d.replace("<head>","<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script>");else d=`<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>${d}`;if(C.boundaries&&C.boundaries.length>0){let{renderStreamingPage:A0,streamToResponse:T0}=await import("./chunk-xv1t91fk.js");return T0(A0(d,C.boundaries,{timeoutMs:30000}),{status:a,headers:{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}return new Response(d,{status:a,headers:{"Content-Type":"text/html",...F1(),"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0",...o}})}}if(M.length>0){let C=M.map((a)=>a.route),X0=F5(x.pathname,C);if(X0){let a=A.get(X0.route.pattern);if(a){let o=a.content;if(q)o=q$(q,o);if(Object.keys(X0.params).length>0)o=j0(o,X0.params);if(o=await J0(o,W),Y)o=y0(o,G);return new Response(o,{status:a.status??200,headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}for(let{prefix:a}of V)if(a!=="/"&&x.pathname.startsWith(a)){let o=A.get(a)||A.get(a+"/");if(o){let _0=o.content;if(q)_0=q$(q,_0);if(_0=await J0(_0,W),Y)_0=y0(_0,G);return new Response(_0,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}}let Y0=f.get("/");if(Y0){let C=Y0.content;if(C=await J0(C,W),Y)C=y0(C,G);if(X.native)if(C.includes("<head>"))C=C.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else C="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+C;return new Response(C,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}let d0=await v(404);if(d0){let C=d0;if(C=await J0(C,W),Y)C=y0(C,G);return new Response(C,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})},async error(R){let x=await v(500);if(x)return new Response(x,{status:500,headers:{"Content-Type":"text/html"}});return new Response(`<pre>${R}
|
|
1622
|
+
Press ${B.cyan}h${B.reset} + ${B.cyan}Enter${B.reset} to show shortcuts`),m0(F.url.toString(),()=>{if(Q)c0.watch(J,{recursive:!0}).close();F.stop()}),Q){console.log(`${B.blue}Watching for changes...${B.reset}`);let H=c0.watch(J,{recursive:!0},async(L,O)=>{if(!O)return;if(O.endsWith(".stx")||O.endsWith(".js")||O.endsWith(".ts")||O.endsWith(".md"))console.log(`${B.yellow}File ${B.bright}${O}${B.yellow} changed, rebuilding...${B.reset}`),t0.clear(),e0(),await K()});process.on("SIGINT",()=>{H.close(),F.stop(),process.exit(0)})}return!0}function v6($){return String($??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}var{serve:o4}=globalThis.Bun;import e from"fs";import m from"path";async function u6($){try{return j5(await Bun.file($).text())}catch{return}}function L5($){let X=Bun.file($),Z=m.extname($).toLowerCase(),Q={".html":"text/html",".css":"text/css",".js":"text/javascript",".json":"application/json",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".ico":"image/x-icon",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"},J=[".js",".css",".json"].includes(Z)?{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}:{};return new Response(X,{headers:{"Content-Type":Q[Z]||"application/octet-stream",...J}})}async function t4($=".",X={}){let Z=X.port||3000,Q=X.watch!==!1,Y=X.hotReload!==!1&&Q,J=null,G=X.hmrPort||Z+1,W=m.resolve($),{loadStxConfig:K}=await import("./chunk-e3b7jj74.js"),_=await K(W),{createServerApi:U,isServerApiSource:F}=await import("./chunk-0psndabd.js"),z=X.stxOptions?.serverApi??_.serverApi,j=await U(W,z),H=_.root&&_.root!=="."?m.join(W,_.root):W,L=X.pagesDir||_.pagesDir||"pages",O=m.join(H,L);if(!e.existsSync(O)&&!_._layerPageDirs?.some((R)=>e.existsSync(R)))return console.error(`${B.red}Error: No '${L}' directory found${B.reset}`),console.log(`${B.dim}Looked in: ${B.bright}${O}${B.reset}`),console.log(`${B.dim}Run stx dev from the app directory, pass it as an argument (stx dev <dir>),${B.reset}`),console.log(`${B.dim}point at another directory with --pages <dir>, or set pagesDir in stx.config.ts.${B.reset}`),console.log(`${B.dim}Starting fresh? Create ${L}/index.stx for the homepage.${B.reset}`),!1;let N=A$(H,{pagesDir:L,pagesDirs:_._layerPageDirs?[O,..._._layerPageDirs.slice(1)]:void 0});if(N.length===0)return console.error(`${B.red}Error: No page files found in ${B.bright}${O}${B.reset}`),!1;console.log(`${B.blue}Found ${B.bright}${N.length}${B.blue} routes${B.reset}`);let V=_?._pluginPageDirs||[],M=[];for(let{dir:R,prefix:x}of V)if(e.existsSync(R)){let P=A$(m.dirname(R),{pagesDir:m.basename(R)});for(let y of P){let Z0=x==="/"?y.pattern:`${x}${y.pattern==="/"?"":y.pattern}`;M.push({route:{...y,pattern:Z0},prefix:x})}if(P.length>0)console.log(`${B.blue}Plugin pages: ${B.bright}${P.length}${B.blue} routes at ${B.cyan}${x}${B.reset}`)}let A=new Map,q=null,I=null;if(X.stxOptions?.shell!==!1){if(I=await Z7(W,X.stxOptions?.shell),I){if(q=await z5(I,X.stxOptions||{}),q)console.log(`${B.blue}Using app shell: ${B.bright}${m.relative(W,I)}${B.reset} ${B.dim}(deprecated: use layouts/default.stx instead)${B.reset}`)}}c6(),await i6(W);let E=l6();if(E.length>0)console.log(`${B.blue}Loaded ${B.bright}${E.length}${B.blue} middleware: ${B.dim}${E.join(", ")}${B.reset}`);let w={},D=null;try{let{loadStxConfig:R}=await import("./chunk-e3b7jj74.js"),x=await R(W);if(x?.apiRouter)D=x?.apiRouter,console.log(`${B.blue}Using custom router for API handling${B.reset}`);if(x?.apiRoutes){w=x.apiRoutes;let P=Object.keys(w).length;if(P>0)console.log(`${B.blue}Loaded ${B.bright}${P} API route${P>1?"s":""}${B.reset}`)}if(x?.broadcasting?.enabled)try{let{startBroadcasting:P,loadChannels:y}=await import("./chunk-w183av08.js"),Z0=x.broadcasting;await P(Z0);let w0=Z0.port??6001;console.log(`${B.magenta}Broadcasting on ${B.cyan}ws://localhost:${w0}/ws${B.reset}`);let h0=m.join(process.cwd(),"channels.ts");if(e.existsSync(h0))try{let p=await y(h0);console.log(`${B.blue}Loaded ${B.bright}${p} broadcast channel${p!==1?"s":""}${B.blue} from channels.ts${B.reset}`)}catch(p){console.warn(`${B.yellow}Failed to load channels.ts: ${p.message}${B.reset}`)}}catch(P){console.warn(`${B.yellow}Broadcasting failed to start: ${P.message}${B.reset}`)}}catch{}let T=p0(W,"output");e.mkdirSync(T,{recursive:!0});let f=new Map,c=new Set,v=async(R)=>{let x=m6(O,R);if(!x)return null;try{let P=await Bun.build({entrypoints:[x],outdir:T,plugins:[B1],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...X.stxOptions});if(!P.success)return null;let y=P.outputs.find((Z0)=>Z0.path.endsWith(".html"));if(!y)return null;return await Bun.file(y.path).text()}catch{return null}},S=new Map,k=async(R,x)=>{try{let{processDirectives:P,extractVariables:y,defaultConfig:Z0,loadStxConfig:w0,injectRouterScript:h0}=await import("./chunk-e3b7jj74.js"),{checkCache:p,cacheTemplate:u,readFileCached:g,templateCache:h}=await import("./chunk-3mtwkjcg.js"),Y0=await w0(W),d0=(i)=>{if(!i)return i;if(m.isAbsolute(i))return i;return m.resolve(W,i)},C={...Z0,...Y0,...X.stxOptions,autoShell:!0};if(X.debugDirectives)C.debug=!0;C.partialsDir=d0(C.partialsDir),C.componentsDir=d0(C.componentsDir),C.layoutsDir=d0(C.layoutsDir),C.storesDir=d0(C.storesDir||"stores"),C.cachePath=d0(C.cachePath)??p0(W,"cache");let X0=!x&&!X.profile,a=C.cache!==!1;if(a&&X0){let i=h.get(R.filePath);if(i)try{if((await e.promises.stat(R.filePath)).mtime.getTime()<=i.mtime){let M0=!0;for(let U0 of i.dependencies){if(!e.existsSync(U0)){M0=!1;break}if((await e.promises.stat(U0)).mtime.getTime()>i.mtime){M0=!1;break}}if(M0){let U0=i.output;if(q)U0=V$(U0,{preserveHead:!0});let I1=S.get(R.filePath);return{route:R,content:U0,status:I1?.status??await u6(R.filePath),headers:I1?.headers}}}}catch{}let q0=await p(R.filePath,C);if(q0){let V0=q0;if(q)V0=V$(V0,{preserveHead:!0});let M0=S.get(R.filePath);return{route:R,content:V0,status:M0?.status??await u6(R.filePath),headers:M0?.headers}}}let o=a?await g(R.filePath):await Bun.file(R.filePath).text(),_0=j5(o),{classifyAllScripts:d}=await import("./chunk-e3b7jj74.js"),A0=d(o),T0=A0.server.map((i)=>i.content),r=o;for(let i of A0.server)r=r.replace(i.fullTag,"");let n={__filename:R.filePath,__dirname:m.dirname(R.filePath),__stx_options:C,params:x??{},__stx_runtime_head:{}};for(let i of T0)try{await y(i,n,R.filePath)}catch(q0){if(X.stxOptions?.debug)console.error("[stx] variable extraction error",R.filePath,q0?.message||q0)}let b0=new Set,H0;if(X.profile){let i=performance.now();H0=await P(r,n,R.filePath,C,b0);let q0=performance.now()-i,V0=m.relative(W,R.filePath)||R.filePath;console.log(`[stx:profile] ${V0} \u2192 ${q0.toFixed(2)}ms`)}else H0=await P(r,n,R.filePath,C,b0);if(!q)H0=await h0(H0,{router:C.router});{let{interpolateScriptExpressions:i}=await import("./chunk-7ekd7zj9.js");H0=H0.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/g,(q0,V0,M0)=>{if(!/function\s+__stx_setup_/.test(M0))return q0;return`<script${V0}>${i(M0,n)}</script>`})}if(q)H0=V$(H0,{preserveHead:!0});if(a&&X0)await u(R.filePath,H0,b0,C);let{extractStreamBoundaries:M3}=await import("./chunk-epjt342x.js"),Y1=M3(n),E1=n.__streamTemplates;if(E1&&typeof E1==="object"&&Object.keys(E1).length>0){let i=n.streamBoundaries||{},q0={...C,autoShell:!1},V0=Object.keys(E1).map((U0)=>({id:U0,render:async()=>{let I1=typeof i[U0]==="function"?await i[U0]():void 0;return P(E1[U0],{...n,$boundary:I1},R.filePath,q0,new Set)}})),M0=new Set(V0.map((U0)=>U0.id));Y1=[...(Y1||[]).filter((U0)=>!M0.has(U0.id)),...V0]}if(Y1&&Y1.length>0)c.add(R.pattern);else Y1=void 0;let $6=k1(n),X6=x1(n);if(X0)S.set(R.filePath,{status:$6,headers:X6});return{route:R,content:H0,status:$6??_0,headers:X6,boundaries:Y1}}catch(P){return console.error(`${B.red}Error building ${B.bright}${R.pattern}${B.reset}:`,P),null}},N0=8,W0=async()=>{f.clear(),A.clear();for(let R=0;R<N.length;R+=N0){let x=N.slice(R,R+N0),P=await Promise.all(x.map((y)=>k(y)));for(let y of P)if(y)f.set(y.route.pattern,y)}for(let R=0;R<M.length;R+=N0){let x=M.slice(R,R+N0),P=await Promise.all(x.map(({route:y})=>k(y)));for(let y of P)if(y)A.set(y.route.pattern,y)}return f.size>0};if(console.log(`${B.blue}Building pages...${B.reset}`),!await W0())return console.error(`${B.red}No pages were successfully built${B.reset}`),!1;await j$(W);let f0=Z;try{if(f0=await u0(Z),f0!==Z)console.log(`${B.yellow}Port ${Z} is busy, using port ${f0} instead${B.reset}`)}catch{return console.error(`${B.red}Could not find an available port${B.reset}`),!1}if(Y){let R=X.hmrPort||f0+1;J=_$({wsPort:R,verbose:!1}),G=J.start(R)}let j0=(R,x)=>{let y=`<script data-stx-route-params>(function(){var p=${JSON.stringify(x).replace(/</g,"\\u003C").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")};window.__stx_rp=p;if(window.stx){window.stx._rp=p;if(window.stx.setRouteParams)window.stx.setRouteParams(p)}})()</script>`;if(R.includes("</head>"))return R.replace("</head>",`${y}</head>`);if(R.includes("<body"))return R.replace(/<body([^>]*)>/,`<body$1>${y}`);return y+R};console.log(`${B.blue}Starting server...${B.reset}`);let Q1=o4({port:f0,async fetch(R){let x=new URL(R.url),P=_?.publicDir||"public",y=m.join(W,P,x.pathname),Z0=m.join(W,x.pathname),w0=m.join(T,x.pathname);if([y,Z0,w0].some((C)=>F(C,W,z)))return new Response("Not Found",{status:404});let[h0,p,u]=await Promise.all([e.promises.stat(y).catch(()=>null),e.promises.stat(Z0).catch(()=>null),e.promises.stat(w0).catch(()=>null)]);if(h0?.isFile()&&!F(y,W,z))return L5(y);if(p?.isFile()&&!F(Z0,W,z))return L5(Z0);if(u?.isFile()&&!F(w0,W,z))return L5(w0);if(x.pathname.startsWith("/_stx/component/")){let C=decodeURIComponent(x.pathname.slice(16));if(C)try{let X0=`<${C} />`,a={...buildConfig,autoShell:!1},o=await processDirectives(X0,{},m.join(W,"components",`${C}.stx`),a,new Set);return new Response(o,{headers:{"Content-Type":"text/html"}})}catch(X0){return new Response(`<div class="stx-async-error">${X0.message}</div>`,{status:500,headers:{"Content-Type":"text/html"}})}}if(x.pathname==="/_stx/img"){let{handleImageRequest:C}=await import("./chunk-tjfs7cc3.js"),X0=await C(R,{publicDir:m.join(W,P),cacheDir:p0(W,"cache","img")});if(X0)return X0}if(D)try{let C=await D.handleRequest(R);if(C.status!==404)return C}catch{}if(w[x.pathname])try{return await w[x.pathname](R)}catch(C){return new Response(JSON.stringify({error:C.message}),{status:500,headers:{"Content-Type":"application/json"}})}let g=await j(R);if(g)return g;let h=F5(x.pathname,N);if(h){let C=f.get(h.route.pattern),X0=c.has(h.route.pattern);if(h.route.isDynamic&&Object.keys(h.params).length>0||X0){let a=await k(h.route,h.params);if(a)C=a}if(C){let a=C.status??200,o=C.headers??{},_0=(h.route.filePath?o6(await Bun.file(h.route.filePath).text().catch(()=>"")):null)??{};if(_0.validate){if(!await _0.validate({params:h.params})){let T0=await v(404);if(T0){let r=T0;if(r=await J0(r,W),Y)r=y0(r,G);return new Response(r,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})}}if(_0.middleware){let A0=a6(x.pathname,h.params,_0,x.search),T0=s6(A0,null,R,{isServer:!0}),r=await r6(_0.middleware,T0);if(r.redirect){let n=r.redirect.path,b0=r.redirect.options.redirectCode||302,H0=new Headers(r.responseHeaders);return H0.set("Location",n),new Response(null,{status:b0,headers:H0})}if(r.abort){let{statusCode:n,message:b0}=r.abort.error;return new Response(`<!DOCTYPE html><html><head><title>Error ${n}</title></head><body><h1>Error ${n}</h1><p>${b0}</p></body></html>`,{status:n,headers:{"Content-Type":"text/html"}})}if(Object.keys(r.state).length>0){let n=`<script>(function(){var s=typeof stx!=='undefined'?stx:{};s._ms=${JSON.stringify(r.state)};if(s.setMiddlewareState)s.setMiddlewareState(s._ms);})()</script>`;C.content=C.content.replace("</head>",`${n}</head>`)}}let d=C.content;if(q&&Q7(R)){let A0=n6(d),T0=t6(d),r=d.match(/<title[^>]*>([\s\S]*?)<\/title>/i),n=r?X7(r[1].trim()):"";if(Object.keys(h.params).length>0)d=j0(d,h.params);d=await J0(d,W);let b0=_?.router?.container||"main";return d=Y7(d,b0),new Response(d,{status:a,headers:{"Content-Type":"text/html","X-STX-Fragment":"true","X-STX-Layout":A0.layout,"X-STX-Layout-Group":A0.group,"X-STX-Runtime":T0?"true":"false",...n&&{"X-STX-Title":encodeURIComponent(n)},[e6]:$7(),...F1(),"Cache-Control":N$}})}if(q)d=q$(q,d);if(Object.keys(h.params).length>0)d=j0(d,h.params);if(d=await J0(d,W),Y)d=y0(d,G);if(X.native)if(d.includes("<head>"))d=d.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else d="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+d;if(X.titlebarHidden)if(d.includes("<head>"))d=d.replace("<head>","<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script>");else d=`<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>${d}`;if(C.boundaries&&C.boundaries.length>0){let{renderStreamingPage:A0,streamToResponse:T0}=await import("./chunk-epjt342x.js");return T0(A0(d,C.boundaries,{timeoutMs:30000}),{status:a,headers:{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}return new Response(d,{status:a,headers:{"Content-Type":"text/html",...F1(),"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0",...o}})}}if(M.length>0){let C=M.map((a)=>a.route),X0=F5(x.pathname,C);if(X0){let a=A.get(X0.route.pattern);if(a){let o=a.content;if(q)o=q$(q,o);if(Object.keys(X0.params).length>0)o=j0(o,X0.params);if(o=await J0(o,W),Y)o=y0(o,G);return new Response(o,{status:a.status??200,headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}for(let{prefix:a}of V)if(a!=="/"&&x.pathname.startsWith(a)){let o=A.get(a)||A.get(a+"/");if(o){let _0=o.content;if(q)_0=q$(q,_0);if(_0=await J0(_0,W),Y)_0=y0(_0,G);return new Response(_0,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}}let Y0=f.get("/");if(Y0){let C=Y0.content;if(C=await J0(C,W),Y)C=y0(C,G);if(X.native)if(C.includes("<head>"))C=C.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else C="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+C;return new Response(C,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}let d0=await v(404);if(d0){let C=d0;if(C=await J0(C,W),Y)C=y0(C,G);return new Response(C,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})},async error(R){let x=await v(500);if(x)return new Response(x,{status:500,headers:{"Content-Type":"text/html"}});return new Response(`<pre>${R}
|
|
1623
1623
|
${R.stack}</pre>`,{headers:{"Content-Type":"text/html"}})}});if(console.clear(),console.log(`
|
|
1624
1624
|
${B.blue}stx${B.reset} ${B.green}${process.env.stx_VERSION||"v0.0.10"}${B.reset} ${B.dim}ready in ${Math.random()*10+5|0}.${Math.random()*90+10|0} ms${B.reset}`),console.log(`
|
|
1625
1625
|
${B.bright}\u2192 ${B.cyan}http://localhost:${f0}/${B.reset}`),Y)console.log(`${B.dim} HMR: ws://localhost:${G}${B.reset}`);console.log(`
|
|
1626
1626
|
${B.yellow}Routes:${B.reset}`);let K0=[...p6(N,W)];for(let{route:R}of M)K0.push(`${R.pattern}`);if(K0.forEach((R,x)=>{let y=x===K0.length-1?"\u2514\u2500 ":"\u251C\u2500 ";console.log(` ${B.green}${y}${B.reset}${R}`)}),console.log(`
|
|
1627
|
-
Press ${B.cyan}h${B.reset} + ${B.cyan}Enter${B.reset} to show shortcuts`),m0(Q1.url.toString(),()=>{if(J)T1();Q1.stop()}),X.native){let R,x=m.join(O,"index.stx");if(e.existsSync(x)){let y=await Bun.file(x).text();R=J$(y)}let P=_?.app?.window??{};await K1(f0,{title:_?.app?.head?.title||m.basename(W)||"stx App",width:P.width,height:P.height,darkMode:P.darkMode,hotReload:P.hotReload,titlebarHidden:P.titlebarHidden??X.titlebarHidden===!0,nativeSidebar:!!R,sidebarConfig:R})}if(Q){console.log(`${B.blue}Watching for changes...${B.reset}`);let R=(p)=>{return p.startsWith("public/")||p.startsWith("public\\")},x=(p)=>{let u=p.toLowerCase();return u.endsWith(".stx")||u.endsWith(".html")||u.endsWith(".md")},P=new Map,y=()=>{let p=new Set([W,..._._layerGraph?.layers.map((u)=>u.root)??[],..._._layerGraph?.configDependencies.map((u)=>m.dirname(u))??[]].filter((u)=>e.existsSync(u)).map((u)=>e.realpathSync(u)));for(let u of _._layerGraph?.layers??[])for(let g of Object.values(u.resources)){if(!e.existsSync(g))continue;let h=e.realpathSync(g);if(![...p].some((Y0)=>h===Y0||h.startsWith(`${Y0}${m.sep}`)))p.add(h)}for(let[u,g]of P)if(!p.has(u))g.close(),P.delete(u);for(let u of p)if(!P.has(u)&&e.existsSync(u))P.set(u,e.watch(u,{recursive:!0},(g,h)=>{w0(u,g,h).catch((Y0)=>console.error("[stx] Layer rebuild failed:",Y0))}))},Z0=Promise.resolve(),w0=(p,u,g)=>{return Z0=Z0.catch(()=>{}).then(()=>h0(p,u,g)),Z0},h0=async(p,u,g)=>{if(!g||K$(g))return;if(W$(g)){if(_._layerGraph){let h=await K(W);Object.assign(_,h),N.splice(0,N.length,...A$(H,{pagesDir:L,pagesDirs:h._layerPageDirs?[O,...h._layerPageDirs.slice(1)]:void 0})),y()}if(R(g)){if(console.log(`${B.cyan}${g} changed${B.reset}`),Y&&J)J.reload(g)}else if(x(g)){console.log(`${B.yellow}${g} changed, rebuilding...${B.reset}`),t0.clear(),e0();try{let{invalidateFileCache:h,templateCache:Y0}=await import("./chunk-
|
|
1627
|
+
Press ${B.cyan}h${B.reset} + ${B.cyan}Enter${B.reset} to show shortcuts`),m0(Q1.url.toString(),()=>{if(J)T1();Q1.stop()}),X.native){let R,x=m.join(O,"index.stx");if(e.existsSync(x)){let y=await Bun.file(x).text();R=J$(y)}let P=_?.app?.window??{};await K1(f0,{title:_?.app?.head?.title||m.basename(W)||"stx App",width:P.width,height:P.height,darkMode:P.darkMode,hotReload:P.hotReload,titlebarHidden:P.titlebarHidden??X.titlebarHidden===!0,nativeSidebar:!!R,sidebarConfig:R})}if(Q){console.log(`${B.blue}Watching for changes...${B.reset}`);let R=(p)=>{return p.startsWith("public/")||p.startsWith("public\\")},x=(p)=>{let u=p.toLowerCase();return u.endsWith(".stx")||u.endsWith(".html")||u.endsWith(".md")},P=new Map,y=()=>{let p=new Set([W,..._._layerGraph?.layers.map((u)=>u.root)??[],..._._layerGraph?.configDependencies.map((u)=>m.dirname(u))??[]].filter((u)=>e.existsSync(u)).map((u)=>e.realpathSync(u)));for(let u of _._layerGraph?.layers??[])for(let g of Object.values(u.resources)){if(!e.existsSync(g))continue;let h=e.realpathSync(g);if(![...p].some((Y0)=>h===Y0||h.startsWith(`${Y0}${m.sep}`)))p.add(h)}for(let[u,g]of P)if(!p.has(u))g.close(),P.delete(u);for(let u of p)if(!P.has(u)&&e.existsSync(u))P.set(u,e.watch(u,{recursive:!0},(g,h)=>{w0(u,g,h).catch((Y0)=>console.error("[stx] Layer rebuild failed:",Y0))}))},Z0=Promise.resolve(),w0=(p,u,g)=>{return Z0=Z0.catch(()=>{}).then(()=>h0(p,u,g)),Z0},h0=async(p,u,g)=>{if(!g||K$(g))return;if(W$(g)){if(_._layerGraph){let h=await K(W);Object.assign(_,h),N.splice(0,N.length,...A$(H,{pagesDir:L,pagesDirs:h._layerPageDirs?[O,...h._layerPageDirs.slice(1)]:void 0})),y()}if(R(g)){if(console.log(`${B.cyan}${g} changed${B.reset}`),Y&&J)J.reload(g)}else if(x(g)){console.log(`${B.yellow}${g} changed, rebuilding...${B.reset}`),t0.clear(),e0();try{let{invalidateFileCache:h,templateCache:Y0}=await import("./chunk-3mtwkjcg.js");h(m.resolve(p,g)),Y0.delete(m.resolve(p,g))}catch{}if(I&&g){if(m.resolve(p,g)===I||m.basename(I)===g){let Y0=await z5(I,X.stxOptions||{});if(Y0)q=Y0}}if(await W0(),await H$(W),Y&&J)J.reload(g)}else{console.log(`${B.yellow}${g} changed, rebuilding...${B.reset}`),t0.clear(),e0();try{let{invalidateFileCache:h,templateCache:Y0}=await import("./chunk-3mtwkjcg.js");h(m.resolve(p,g)),Y0.delete(m.resolve(p,g))}catch{}if(await W0(),Y&&J)J.reload(g)}}else if(G$(g)){if(console.log(`${B.cyan}CSS ${g} changed${B.reset}`),Y&&J)J.updateCss(g)}};y(),process.on("SIGINT",()=>{for(let p of P.values())p.close();if(J)T1();Q1.stop(),process.exit(0)})}return!0}var b={enabled:!1,components:new Map,stores:new Map,events:[],performance:[],selectedComponent:null,selectedStore:null,maxEvents:1000,maxPerformance:500};function e4($={}){if(typeof window>"u")return;b.enabled=!0,b.maxEvents=$.maxEvents||1000,b.maxPerformance=$.maxPerformance||500,window.__STX_DEVTOOLS__={getState:()=>b,getComponents:()=>Array.from(b.components.values()),getComponent:(X)=>b.components.get(X),getStores:()=>Array.from(b.stores.values()),getStore:(X)=>b.stores.get(X),getEvents:()=>b.events,getPerformance:()=>b.performance,selectComponent:(X)=>O5(X),selectStore:(X)=>XX(X),inspectElement:(X)=>ZX(X),highlightComponent:(X)=>_7(X),clearHighlight:()=>U7(),logComponentTree:()=>QX(),logStoreState:(X)=>YX(X),timeTravel:(X,Z)=>JX(X,Z)},WX(),GX(),console.log("%c[STX DevTools] Enabled","color: #10b981; font-weight: bold;")}function $X(){b.enabled=!1,delete window.__STX_DEVTOOLS__;let $=document.getElementById("stx-devtools-panel");if($)$.remove();console.log("%c[STX DevTools] Disabled","color: #ef4444;")}function J7($){if(!b.enabled)return;let X=b.components.get($);if(X){if(X.parentId){let Z=b.components.get(X.parentId);if(Z)Z.children=Z.children.filter((Q)=>Q!==$)}b.components.delete($),H5({timestamp:Date.now(),type:"component:unmounted",componentId:$,payload:{name:X.name}})}}function W7($,X,Z={},Q=[]){if(!b.enabled)return;let Y={id:$,state:X,getters:Z,actions:Q,history:[{timestamp:Date.now(),type:"state",name:"__init__",newValue:X}]};b.stores.set($,Y),H5({timestamp:Date.now(),type:"store:registered",payload:{id:$,state:X}})}function K7($,X,Z,Q,Y="state"){if(!b.enabled)return;let J=b.stores.get($);if(J){let G={timestamp:Date.now(),type:Y,name:X,oldValue:Z,newValue:Q,stack:Error().stack};if(J.history.push(G),J.history.length>100)J.history=J.history.slice(-100);if(Y==="state")J.state={...J.state,[X]:Q};H5({timestamp:Date.now(),type:`store:${Y}`,payload:{storeId:$,name:X,oldValue:Z,newValue:Q}})}}function H5($){if(!b.enabled)return;if(b.events.push($),b.events.length>b.maxEvents)b.events=b.events.slice(-b.maxEvents);if(typeof window<"u")window.dispatchEvent(new CustomEvent("stx:devtools:event",{detail:$}))}function O5($){b.selectedComponent=$;let X=b.components.get($);if(X)_7($),console.log("%c[STX DevTools] Selected component:","color: #3b82f6;",X);return X}function XX($){b.selectedStore=$;let X=b.stores.get($);if(X)console.log("%c[STX DevTools] Selected store:","color: #8b5cf6;",X);return X}function ZX($){let X=$;while(X){let Z=X.getAttribute("data-stx-component-id");if(Z)return O5(Z);X=X.parentElement}console.log("%c[STX DevTools] No component found for element","color: #f59e0b;");return}function _7($){U7();let X=b.components.get($);if(X?.element){let Z=document.createElement("div");Z.id="stx-devtools-highlight",Z.style.cssText=`
|
|
1628
1628
|
position: absolute;
|
|
1629
1629
|
background: rgba(59, 130, 246, 0.2);
|
|
1630
1630
|
border: 2px solid #3b82f6;
|
|
@@ -2893,9 +2893,9 @@ describe('Example', () => {
|
|
|
2893
2893
|
</footer>
|
|
2894
2894
|
@yield('scripts')
|
|
2895
2895
|
</body>
|
|
2896
|
-
</html>`}function IZ(){return"<!-- Hero section -->"}function RZ(){return"<!-- Features -->"}function DZ(){return"<!-- Pricing -->"}function wZ(){return"<!-- Button -->"}function h1($){if(!f1($))I5($,{recursive:!0})}function TZ(){if(f1("bun.lockb"))return"bun";if(f1("pnpm-lock.yaml"))return"pnpm";if(f1("yarn.lock"))return"yarn";return"bun"}function R5($){return $.replace(/[-_\s]+(.)?/g,(X,Z)=>Z?Z.toUpperCase():"").replace(/^./,(X)=>X.toUpperCase())}function CZ($){return $.replace(/[-_\s]+(.)?/g,(X,Z)=>Z?Z.toUpperCase():"").replace(/^./,(X)=>X.toLowerCase())}function $1($){return $.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()}var{serve:kZ}=globalThis.Bun;import d1 from"fs";import D0 from"path";function qK($,X=200,Z={}){return new Response($,{status:X,headers:{"Content-Type":"text/html; charset=utf-8",...Z}})}async function D5($){let{loadStxConfig:X}=await import("./chunk-
|
|
2896
|
+
</html>`}function IZ(){return"<!-- Hero section -->"}function RZ(){return"<!-- Features -->"}function DZ(){return"<!-- Pricing -->"}function wZ(){return"<!-- Button -->"}function h1($){if(!f1($))I5($,{recursive:!0})}function TZ(){if(f1("bun.lockb"))return"bun";if(f1("pnpm-lock.yaml"))return"pnpm";if(f1("yarn.lock"))return"yarn";return"bun"}function R5($){return $.replace(/[-_\s]+(.)?/g,(X,Z)=>Z?Z.toUpperCase():"").replace(/^./,(X)=>X.toUpperCase())}function CZ($){return $.replace(/[-_\s]+(.)?/g,(X,Z)=>Z?Z.toUpperCase():"").replace(/^./,(X)=>X.toLowerCase())}function $1($){return $.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()}var{serve:kZ}=globalThis.Bun;import d1 from"fs";import D0 from"path";function qK($,X=200,Z={}){return new Response($,{status:X,headers:{"Content-Type":"text/html; charset=utf-8",...Z}})}async function D5($){let{loadStxConfig:X}=await import("./chunk-tntv9hvq.js");return{...await X($.configDir??process.cwd()),...$.stxOptions??{}}}async function xZ($={}){let{port:X=3000,root:Z=".",watch:Q=!0,onRequest:Y,routes:J={},middleware:G=[],on404:W,onError:K}=$,_=D0.resolve(Z),U=await D5($),F=D0.resolve($.configDir??process.cwd()),z=await w5(F,U.serverApi),j=new Map;async function H(A){let q=d1.statSync(A),I=`${A}:${q.mtimeMs}`,E=j.get(I);if(E)return{content:E.content,status:E.status,headers:E.headers};for(let K0 of j.keys())if(K0.startsWith(`${A}:`)&&K0!==I)j.delete(K0);let w=await Bun.file(A).text(),D=w,T=B$(w);if(T)D=T.content.trim();let f=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,c=[],v=[],S;while((S=f.exec(w))!==null){let K0=S[1],R=S[2],x=S[0];if(K0.includes("server"))v.push(R);else c.push(x)}let k=w.match(/<style\b[^>]*>[\s\S]*?<\/style>/gi)||[],N0=D.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,""),W0={__filename:A,__dirname:D0.dirname(A),__stx_options:U};for(let K0 of v)await E0(K0,W0,A);let j0=await I0(N0,W0,A,U,new Set);if(k.length>0){let K0=k.join(`
|
|
2897
2897
|
`);if(j0.match(/(<\/head>)/i))j0=j0.replace(/(<\/head>)/i,`${K0}
|
|
2898
|
-
$1`)}if(c.length>0){let{interpolateScriptsInTemplate:K0}=await import("./chunk-
|
|
2898
|
+
$1`)}if(c.length>0){let{interpolateScriptsInTemplate:K0}=await import("./chunk-7ekd7zj9.js"),R=K0(c.join(`
|
|
2899
2899
|
`),W0);if(j0.match(/(<\/body>)/i))j0=j0.replace(/(<\/body>)/i,`${R}
|
|
2900
2900
|
$1`);else j0+=`
|
|
2901
2901
|
${R}`}let Q1=k1(W0),r$=x1(W0);return j.set(I,{content:j0,mtime:q.mtimeMs,status:Q1,headers:r$}),{content:j0,status:Q1,headers:r$}}async function L(A){let q=d1.statSync(A),I=`${A}:${q.mtimeMs}`,E=j.get(I);if(E)return E.content;let{content:w}=await k0(A,U);return j.set(I,{content:w,mtime:q.mtimeMs}),w}function O(A){let q=A.startsWith("/")?A.slice(1):A,I=[q,`${q}.stx`,`${q}.md`,`${q}.html`,D0.join(q,"index.stx"),D0.join(q,"index.md"),D0.join(q,"index.html")];for(let E of[_,...U._layerPageDirs??[]])for(let w of I){let D=D0.resolve(E,w);if(!D.startsWith(`${D0.resolve(E)}${D0.sep}`))continue;if(d1.existsSync(D)&&d1.statSync(D).isFile())return D}return null}async function N(A){if(U._layerGraph){let E=await D5($);if(E._layerGraph!==U._layerGraph)Object.assign(U,E),j.clear()}let q=new URL(A.url),I=async()=>{if(J[q.pathname])return await J[q.pathname](A);if(Y){let D=await Y(A);if(D)return D}if(U.apiRouter){let D=await U.apiRouter.handleRequest(A);if(D.status!==404)return D}if(U.apiRoutes?.[q.pathname])return U.apiRoutes[q.pathname](A);let E=await z(A);if(E)return E;let w=O(q.pathname);if(!w||D7(w,F,U.serverApi)){if(W)return await W(A);return new Response("Not Found",{status:404})}try{let D,T="text/html",f,c;if(w.endsWith(".stx")){let v=await H(w);D=v.content,f=v.status,c=v.headers}else if(w.endsWith(".md"))D=await L(w);else if(w.endsWith(".html"))D=await Bun.file(w).text();else if(w.endsWith(".css"))D=await Bun.file(w).text(),T="text/css";else if(w.endsWith(".js"))D=await Bun.file(w).text(),T="text/javascript";else if(w.endsWith(".json"))D=await Bun.file(w).text(),T="application/json";else return new Response(Bun.file(w));return new Response(D,{status:f??200,headers:{"Content-Type":T,...c}})}catch(D){if(K)return await K(D,A);let T=D instanceof Error?D.message:String(D),c=U?.debug===!0?`<h1>Error</h1><pre>${T}
|
|
@@ -4329,7 +4329,7 @@ else {
|
|
|
4329
4329
|
\u26A0\uFE0F Built ${Z.views.length} views with ${Z.errors.length} errors`);return Z}function y_($,X){let Z=x$.watch($.viewsDir,{recursive:!0},async(Q,Y)=>{if(!Y)return;if(Y.endsWith(".stx")||Y.endsWith(".ts")||Y.endsWith(".js")){if($.debug)console.log(`
|
|
4330
4330
|
File changed: ${Y}, rebuilding...`);let J=await $Y($);X?.(J)}});return{close:()=>Z.close()}}async function v_($,X={},Z={}){let Q={...Z,skipDefaultSeoTags:!0,skipSignalsRuntime:!0},Y=await c8($,X,Q);Y=await XY(Y),Y=Y.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),Y=Y.replace(/<style\b([^>]*)>[\s\S]*?<\/style>/gi,(G,W)=>/\bdata-(?:css=["']generated["']|stx-)/i.test(W)?"":G),Y=Y.replace(/<!--\s*stx SEO Tags\s*-->/gi,""),Y=Y.replace(/\n\s*\n\s*\n/g,`
|
|
4331
4331
|
|
|
4332
|
-
`).trim();let J=YY(Y);return{html:Y,text:J}}async function XY($){try{let{generateCss:X,extractClassNames:Z}=await import("./chunk-
|
|
4332
|
+
`).trim();let J=YY(Y);return{html:Y,text:J}}async function XY($){try{let{generateCss:X,extractClassNames:Z}=await import("./chunk-62435225.js");if(Z($).size===0)return $;let Y=await X($);if(!Y)return $;let J=ZY(Y);if(J.size===0)return $;return $.replace(/(<[a-z][a-z0-9]*)((?:\s+[a-z][a-z0-9-]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s+)class\s*=\s*"([^"]*)"((?:\s+[a-z][a-z0-9-]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?>)/gi,(G,W,K,_,U,F)=>{let z=_.split(/\s+/).filter(Boolean),j=[];for(let N of z){let V=J.get(N);if(V)j.push(V)}if(j.length===0)return`${W}${K}class="${_}"${U}${F}`;let H=j.join("; "),O=`${K}${U}`.match(/style\s*=\s*"([^"]*)"/);if(O){let N=`${H}; ${O[1]}`,V=K.replace(/style\s*=\s*"[^"]*"/,`style="${N}"`),M=U.replace(/style\s*=\s*"[^"]*"/,`style="${N}"`);return`${W}${V}class="${_}"${M}${F}`}return`${W}${K}class="${_}" style="${H}"${U}${F}`})}catch{return $}}function ZY($){let X=new Map,Z=/\.([a-zA-Z0-9_-]+(?:\\:[a-zA-Z0-9_-]+)*)\s*\{([^}]+)\}/g,Q=Z.exec($);while(Q!==null){let Y=Q[1].replace(/\\/g,""),J=Q[2].split(";").map((G)=>G.trim()).filter(Boolean).join("; ");if(J)X.set(Y,J);Q=Z.exec($)}return X}function QY($,X){let Z=X.replace(/<[^>]*>/g,"").replace(/\s+/g," ").trim(),Q=$.replace(/&/g,"&").trim();if(!Q||Q.startsWith("#")||/^javascript:/i.test(Q))return Z;let Y=Q.replace(/^mailto:/i,"").replace(/^https?:\/\//i,"").replace(/\/$/,"");if(!Z)return Q.replace(/^mailto:/i,"");if(Z.replace(/^https?:\/\//i,"").replace(/\/$/,"")===Y)return Z;return`${Z} (${Q.replace(/^mailto:/i,"")})`}function YY($){return $.replace(/<head\b[\s\S]*?<\/head>/gi,"").replace(/<(style|script)\b[\s\S]*?<\/\1>/gi,"").replace(/<(div|span|p)\b[^>]*\bstyle="[^"]*display:\s*none[^"]*"[^>]*>[\s\S]*?<\/\1>/gi,"").replace(/<a\b[^>]*?\bhref\s*=\s*(?:"([^"]*)"|'([^']*)')[^>]*>([\s\S]*?)<\/a>/gi,(X,Z,Q,Y)=>QY(Z??Q??"",Y)).replace(/<br\s*\/?>/gi,`
|
|
4333
4333
|
`).replace(/<\/(p|div|h[1-6]|li|tr)>/gi,`
|
|
4334
4334
|
`).replace(/<\/td>/gi,"\t").replace(/<[^>]*>/g,"").replace(/ /g," ").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/©/g,"(c)").replace(/·/g,"-").replace(/\n\s*\n\s*\n/g,`
|
|
4335
4335
|
|
|
@@ -4399,7 +4399,7 @@ ${I}`}function F0($){return $.replace(/&/g,"&").replace(/"/g,""").repla
|
|
|
4399
4399
|
`;let Z=$.sitemap!==!1?`Sitemap: ${$.url.replace(/\/$/,"")}/sitemap.xml
|
|
4400
4400
|
`:"";if(X==="disallow")return["User-agent: *","Disallow: /","",Z].filter(Boolean).join(`
|
|
4401
4401
|
`);return["User-agent: *","Allow: /","",Z].filter(Boolean).join(`
|
|
4402
|
-
`)}var M1=null;async function CY(){if(M1!==null)return M1;try{let $=await import("./chunk-
|
|
4402
|
+
`)}var M1=null;async function CY(){if(M1!==null)return M1;try{let $=await import("./chunk-0qv8yf53.js");if(typeof $.getRouterScript==="function")M1=$.getRouterScript();else M1=""}catch{M1=""}return M1}async function s5($,X){let Z=await CY();if(!Z)return $;let Q={interceptAllLinks:!0,container:"main",...X},J=`${`<script>window.__stxRouterConfig=${JSON.stringify(Q)};</script>
|
|
4403
4403
|
`}<script>${Z}</script>`;if(/<\/body>/i.test($))return $.replace(/<\/body>/i,`${J}
|
|
4404
4404
|
</body>`);return`${$}
|
|
4405
4405
|
${J}`}var kY=`window.__stxThemeIcon=function(isDark){try{var want=isDark?'dark':'light';var pick=document.querySelector('link[rel~="icon"][media*="prefers-color-scheme: '+want+'"]');if(!pick)return;var live=document.querySelector('link[rel~="icon"]:not([media])');if(!live){live=document.createElement('link');live.setAttribute('rel','icon');document.head.appendChild(live)}if(pick.type)live.setAttribute('type',pick.type);var href=pick.getAttribute('href');if(live.getAttribute('href')!==href)live.setAttribute('href',href)}catch(e){}};`,xY=($,X,Z,Q)=>`(function(){${kY}function read(){try{var k=${JSON.stringify(X)};var t=localStorage.getItem(k);return t===null?(${JSON.stringify($)}==='dark'||(${JSON.stringify($)}==='auto'&&window.matchMedia('(prefers-color-scheme: dark)').matches)):t==='dark'}catch(e){return ${JSON.stringify($)}==='dark'}}function apply(){var isDark=read();var html=document.documentElement;html.classList[isDark?'add':'remove']('dark');var color=isDark?${JSON.stringify(Q)}:${JSON.stringify(Z)};if(!document.head)return;var tc=document.querySelector('meta[name="theme-color"]:not([media])');if(!tc){tc=document.createElement('meta');tc.setAttribute('name','theme-color');tc.setAttribute('data-stx-theme-meta','1')}tc.setAttribute('content',color);if(tc!==document.head.firstChild){document.head.insertBefore(tc,document.head.firstChild)}if(window.__stxThemeIcon)window.__stxThemeIcon(isDark)}apply();window.addEventListener('stx:navigate',apply);window.addEventListener('popstate',apply)})();`,SY=($,X,Z)=>`document.addEventListener('click',function(e){var t=e.target&&e.target.closest&&e.target.closest('#theme-toggle');if(!t)return;var html=document.documentElement;var isDark=html.classList.toggle('dark');try{localStorage.setItem(${JSON.stringify($)},isDark?'dark':'light')}catch(e){}var tc=document.querySelector('meta[name="theme-color"]:not([media])');if(tc)tc.setAttribute('content',isDark?${JSON.stringify(Z)}:${JSON.stringify(X)});if(window.__stxThemeIcon)window.__stxThemeIcon(isDark)});`;function g$($,X){if(X.theme===!1)return $;let Z=$.includes(G3),Q=typeof X.theme==="object"&&X.theme!==null?X.theme:{},Y=Q.default??"dark",J=Q.storageKey??"theme",G=Q.colors?.light??"#ffffff",W=Q.colors?.dark??"#000000";if(Y==="dark"&&!Z){if(!/<html\b[^>]*\bclass=/.test($))$=$.replace(/<html\b([^>]*)>/i,'<html$1 class="dark">');else if(!/<html\b[^>]*\bclass="[^"]*\bdark\b/.test($))$=$.replace(/<html\b([^>]*\bclass=")([^"]*)(")/i,"<html$1$2 dark$3")}if(!$.includes("data-stx-theme-meta")&&/<head\b[^>]*>/i.test($)){let K=['<meta name="color-scheme" content="dark light" data-stx-theme-meta="1">',`<meta name="theme-color" media="(prefers-color-scheme: light)" content="${G}" data-stx-theme-meta="1">`,`<meta name="theme-color" media="(prefers-color-scheme: dark)" content="${W}" data-stx-theme-meta="1">`].join(`
|
|
@@ -4418,5 +4418,5 @@ ${$}`}function p$($,X){return`<script data-stx-lang-picker="1">window.__stxI18n=
|
|
|
4418
4418
|
${Y.slice(W)}`;return`${$.slice(0,Q)}${F}${$.slice(Z)}`}function QJ($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function O3($){return $}var YJ=new Set(["if","else","elseif","else-if","for","foreach","show","model","html","text","bind","key","ref","once","memo","slot","teleport","cloak","pre","effect","init"]),JJ=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function GJ($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function WJ($){let X=[],Z=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,Q;while((Q=Z.exec($))!==null)X.push([Q.index,Q.index+Q[0].length]);return X}function KJ($,X){for(let[Z,Q]of $)if(X>=Z&&X<Q)return!0;return!1}function s$($,X){let Z=1,Q=0;for(let Y=0;Y<X&&Y<$.length;Y++)if($[Y]===`
|
|
4419
4419
|
`)Z++,Q=Y+1;return{line:Z,column:X-Q+1}}function _J($,X,Z){let Q=X.toLowerCase(),Y=$.length,J=1,G=Z;while(G<Y){let W=$.indexOf("<",G);if(W===-1)return-1;if(G=W,$.startsWith("<!--",G)){let U=$.indexOf("-->",G+4);if(U===-1)return-1;G=U+3;continue}if($[G+1]==="/"){let U=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(G,G+64));if(!U){G++;continue}if(U[1].toLowerCase()===Q){if(J--,G+=U[0].length,J===0)return G;continue}G+=U[0].length;continue}let K=/^<([a-z][\w-]*)\b/i.exec($.slice(G,G+64));if(!K){G++;continue}let _=$.indexOf(">",G);if(_===-1)return-1;if(K[1].toLowerCase()===Q&&$[_-1]!=="/")J++;G=_+1}return-1}function UJ($,X,Z){let Q=/@([a-z][\w:-]*)((?:\.[a-z][\w-]*)*)\s*=\s*"([^"]*)"/gi,Y;while((Y=Q.exec($))!==null){if(KJ(X,Y.index))continue;let J=Y[1].toLowerCase().split(":")[0];if(YJ.has(J))continue;let G=Y[3].trim();if(/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)+$/.test(G)){let W=$.indexOf(Y[3],Y.index),{line:K,column:_}=s$($,W<0?Y.index:W);Z.push({ruleId:"stx/no-bare-function-ref-in-event",message:`Event handler @${Y[1]}="${G}" is a member path, which the runtime does not invoke \u2014 it only auto-calls a plain identifier. Call it: @${Y[1]}="${G}($event)".`,line:K,column:_,severity:"error"})}}}function N3($){let X=$.split("/"),Z=[];for(let Q of X){if(Q===""||Q===".")continue;if(Q==="..")Z.pop();else Z.push(Q)}return Z.join("/")}function BJ($,X,Z){let Q=X.replace(/\\/g,"/"),Y=Q.indexOf("resources/stores/");if(Y===-1)return;let J=Q.slice(0,Y+16),G=Q.slice(0,Q.lastIndexOf("/")),W=/\b(import|export)\s+(type\s+)?([^'"]*?)\s*from\s*['"]([^'"]+)['"]/g,K;while((K=W.exec($))!==null){if(K[2])continue;let _=K[1],U=K[4],F;if(U.startsWith("."))F=!N3(`${G}/${U}`).startsWith(N3(J));else F=!0;if(F){let{line:z,column:j}=s$($,K.index),H=_==="export"?"Value re-export":"Value import";Z.push({ruleId:"stx/store-value-imports-must-be-local",message:`${H} from "${U}" is outside resources/stores/ and will be stripped from the store bundle. Use \`${_} type\`, or move the value into the stores dir.`,line:z,column:j,severity:"error"})}}}function LJ($){let X=$.trim(),Z=(G)=>{let W=G.match(/[A-Za-z_$][\w$]*/g);return W?W:[]},Q=/\bas\s+(.+)$/.exec(X);if(Q){let G=Q[1].trim(),W=/^([A-Za-z_$][\w$]*)\s*=>\s*([A-Za-z_$][\w$]*)/.exec(G);if(W)return[W[1],W[2]];let K=/^\(([^)]*)\)/.exec(G);if(K)return Z(K[1]);let _=/^([A-Za-z_$][\w$]*)/.exec(G);return _?[_[1]]:[]}let Y=/^\(([^)]*)\)\s+(?:in|of)\s+/.exec(X);if(Y)return Z(Y[1]);let J=/^([A-Za-z_$][\w$]*)\s+(?:in|of)\s+/.exec(X);return J?[J[1]]:[]}function FJ($,X){let Z=/(?::for|x-for|@for)\s*=\s*"([^"]*)"/gi,Q;while((Q=Z.exec($))!==null){let Y=LJ(Q[1]);if(Y.length===0)continue;let J=$.lastIndexOf("<",Q.index);if(J===-1)continue;let G=/^<([a-z][\w-]*)/i.exec($.slice(J,J+64));if(!G)continue;let W=$.indexOf(">",Q.index);if(W===-1)continue;let _=$[W-1]==="/"||JJ.has(G[1].toLowerCase())?W+1:_J($,G[1],W+1),U=_===-1?W+1:_,F=$.indexOf(Q[1],Q.index),z=$.slice(J,U);if(F>=0&&F+Q[1].length<=U){let j=F-J;z=z.slice(0,j)+" ".repeat(Q[1].length)+z.slice(j+Q[1].length)}for(let j of Y){let H=new RegExp(`(?<![.\\w$])${GJ(j)}\\s*\\(`,"g"),L;while((L=H.exec(z))!==null){let O=J+L.index,{line:N,column:V}=s$($,O);X.push({ruleId:"stx/no-signal-call-in-for-iteration-var",message:`"${j}" is a :for iteration variable, not a signal \u2014 calling it as "${j}()" leaves it as a function and silently breaks comparisons. Use "${j}" directly.`,line:N,column:V,severity:"error"})}}}}function zJ($,X){let Z=/<!--([\s\S]*?)-->/g,Q;while((Q=Z.exec($))!==null){let J=Q[1].indexOf("`");if(J!==-1){let G=Q.index+4+J,{line:W,column:K}=s$($,G);X.push({ruleId:"stx/no-backticks-in-html-comments",message:"Backtick inside an HTML comment leaks into the merged setup function and flips the JS parser into template-literal mode. Remove it or rephrase the comment.",line:W,column:K,severity:"error"})}}}function a$($,X){return $?.[X]!==!1}function jJ($,X={}){let Z=[],Q=WJ($),Y=(X.filePath??"").replace(/\\/g,"/"),J=X.fileKind??(/\/components?\//i.test(Y)?"component":/\/layouts?\//i.test(Y)?"layout":"view");if(a$(X.rules,"stx/no-bare-function-ref-in-event"))UJ($,Q,Z);if(Y&&a$(X.rules,"stx/store-value-imports-must-be-local"))BJ($,Y,Z);if(a$(X.rules,"stx/no-signal-call-in-for-iteration-var"))FJ($,Z);if(a$(X.rules,"stx/no-backticks-in-html-comments"))zJ($,Z);Z.sort((W,K)=>W.line-K.line||W.column-K.column);let G=new Set;return Z.filter((W)=>{let K=`${W.ruleId}:${W.line}:${W.column}`;if(G.has(K))return!1;return G.add(K),!0})}function HJ($,X){return $.kind===X}B5();function A3($){if($===String)return"string";if($===Number)return"number";if($===Boolean)return"boolean";if($===Array)return"array";if($===Object)return"object";if($===Function)return"function";if($===Date)return"date";if($===Symbol)return"symbol";if(typeof $==="function"&&$.name)return $.name;return"unknown"}function OJ($,X){if($===null||$===void 0)return!0;if(X===String)return typeof $==="string";if(X===Number)return typeof $==="number"&&!Number.isNaN($);if(X===Boolean)return typeof $==="boolean";if(X===Array)return Array.isArray($);if(X===Object)return typeof $==="object"&&!Array.isArray($);if(X===Function)return typeof $==="function";if(X===Date)return $ instanceof Date;if(X===Symbol)return typeof $==="symbol";if(typeof X==="function")return $ instanceof X;return!0}function V3($,X,Z,Q){let Y=Q?`[${Q}]`:"";if(Z.required&&(X===void 0||X===null))return{prop:$,message:`${Y} Missing required prop: "${$}"`,value:X,expected:Z.type?A3(Z.type):void 0};if(X===void 0||X===null)return null;if(Z.type){let J=Array.isArray(Z.type)?Z.type:[Z.type];if(!J.some((W)=>OJ(X,W))){let W=J.map((K)=>A3(K)).join(" | ");return{prop:$,message:`${Y} Invalid prop type for "${$}": expected ${W}, got ${typeof X}`,value:X,expected:W}}}if(Z.validator){if(!Z.validator(X))return{prop:$,message:`${Y} Custom validation failed for prop "${$}"`,value:X}}return null}function NJ($){let X=globalThis.__STX_CURRENT_PROPS__||{};if(!$)return X;let Z={...X};for(let[Q,Y]of Object.entries($)){let J=typeof Y==="function"||Array.isArray(Y)?{type:Y}:Y||{};if(Z[Q]===void 0&&J.default!==void 0)Z[Q]=typeof J.default==="function"?J.default():J.default}return Z}function AJ($,X={}){let{componentName:Z,throwOnError:Q=!1,logWarnings:Y=!0}=X,J=globalThis.__STX_CURRENT_PROPS__||{},G={...J},W={valid:!0,errors:[],warnings:[]};for(let[K,_]of Object.entries($)){let U=typeof _==="function"||Array.isArray(_)?{type:_}:_||{};if(G[K]===void 0&&U.default!==void 0)G[K]=typeof U.default==="function"?U.default():U.default;let F=V3(K,G[K],U,Z);if(F){if(W.valid=!1,W.errors.push(F),Y)console.warn(F.message)}}for(let K of Object.keys(J))if(!(K in $)){let _=`${Z?`[${Z}]`:""} Unknown prop: "${K}"`;if(W.warnings.push(_),Y)console.warn(_)}if(Q&&!W.valid){let K=W.errors.map((_)=>_.message).join(`
|
|
4420
4420
|
`);throw Error(`Prop validation failed:
|
|
4421
|
-
${K}`)}return{props:G,validation:W}}function qJ($,X){let Z={...$};for(let[Q,Y]of Object.entries(X))if(Z[Q]===void 0)Z[Q]=typeof Y==="function"?Y():Y;return Z}function VJ($){return $}function MJ($){return{type:$,required:!0}}function EJ($,X){return{type:X,default:$}}function IJ($,X={}){return{...X,validator:$}}function RJ($,X={}){return{...X,validator:(Z)=>$.includes(Z)}}function DJ($,X={}){return{...X,type:Array,validator:(Z)=>{if(!Array.isArray(Z))return!1;return!0}}}function wJ($,X={}){return{...X,type:Object}}function TJ($,X,Z){if(!X)return $;let Q={};for(let[Y,J]of Object.entries(X)){let G=typeof J==="function"||Array.isArray(J)?{type:J}:J||{},W=$[Y];if(W===void 0&&G.default!==void 0)W=typeof G.default==="function"?G.default():G.default;if(!q3()){let K=V3(Y,W,G,Z);if(K)console.warn(K.message)}Q[Y]=W}for(let[Y,J]of Object.entries($))if(!(Y in Q))Q[Y]=J;return Q}var
|
|
4422
|
-
export{yK as o,G5 as p,x6 as q,i4 as r,y0 as s,G$ as t,W$ as u,K$ as v,_$ as w,T1 as x,E3 as y,I3 as z,R3 as A,D3 as B,w3 as C,T3 as D,C3 as E,k3 as F,x3 as G,_6 as H,P3 as I,b3 as J,gJ as K,fJ as L,hJ as M,y3 as N,dJ as O,v3 as P,uJ as Q,mJ as R,pJ as S,cJ as T,lJ as U,iJ as V,aJ as W,sJ as X,rJ as Y,nJ as Z,G1 as _,oJ as $,tJ as aa,eJ as ba,$G as ca,ZG as da,QG as ea,f3 as fa,h3 as ga,YG as ha,d3 as ia,JG as ja,GG as ka,WG as la,KG as ma,_G as na,UG as oa,u3 as pa,m3 as qa,BG as ra,LG as sa,p3 as ta,zG as ua,NG as va,AG as wa,N6 as xa,n3 as ya,o3 as za,t3 as Aa,e3 as Ba,$5 as Ca,$4 as Da,X4 as Ea,Z4 as Fa,Q4 as Ga,VG as Ha,DG as Ia,wG as Ja,G4 as Ka,TG as La,Z5 as Ma,SG as Na,e4 as Oa,$X as Pa,BX as Qa,LX as Ra,FX as Sa,B7 as Ta,zX as Ua,jX as Va,HX as Wa,OX as Xa,NX as Ya,AX as Za,qX as _a,jW as $a,b1 as ab,AW as bb,qW as cb,VX as db,MX as eb,RX as fb,M$ as gb,VW as hb,MW as ib,EW as jb,IW as kb,RW as lb,DW as mb,wW as nb,TW as ob,CW as pb,kW as qb,xW as rb,SW as sb,xX as tb,bW as ub,fW as vb,hW as wb,E5 as xb,iW as yb,aW as zb,sW as Ab,rX as Bb,oW as Cb,QK as Db,YK as Eb,JK as Fb,GK as Gb,WK as Hb,KK as Ib,qK as Jb,xZ as Kb,VK as Lb,SZ as Mb,PZ as Nb,T7 as Ob,C7 as Pb,IK as Qb,RK as Rb,DK as Sb,TK as Tb,CK as Ub,dZ as Vb,xK as Wb,SK as Xb,PK as Yb,y6 as Zb,S7 as _b,gK as $b,fK as ac,hK as bc,dK as cc,uZ as dc,mZ as ec,pK as fc,pZ as gc,y7 as hc,cK as ic,cZ as jc,lK as kc,iK as lc,lZ as mc,X9 as nc,f7 as oc,sZ as pc,rZ as qc,h7 as rc,oZ as sc,tZ as tc,$Q as uc,l as vc,d7 as wc,P5 as xc,u7 as yc,m7 as zc,p7 as Ac,c7 as Bc,l7 as Cc,i7 as Dc,a7 as Ec,s7 as Fc,r7 as Gc,n7 as Hc,o7 as Ic,t7 as Jc,e7 as Kc,$8 as Lc,X8 as Mc,Z8 as Nc,Q8 as Oc,Y8 as Pc,J8 as Qc,G8 as Rc,b5 as Sc,W8 as Tc,K8 as Uc,_8 as Vc,U8 as Wc,B8 as Xc,F8 as Yc,y5 as Zc,v5 as _c,z8 as $c,g5 as ad,f5 as bd,h5 as cd,c1 as dd,I$ as ed,j8 as fd,H8 as gd,O8 as hd,R$ as id,A8 as jd,q8 as kd,V8 as ld,M8 as md,cQ as nd,lQ as od,d5 as pd,u5 as qd,w8 as rd,i0 as sd,T8 as td,C8 as ud,k8 as vd,x8 as wd,S8 as xd,D$ as yd,m5 as zd,b8 as Ad,w$ as Bd,y8 as Cd,v8 as Dd,g8 as Ed,f8 as Fd,T$ as Gd,C$ as Hd,p5 as Id,c5 as Jd,d8 as Kd,u8 as Ld,m8 as Md,k$ as Nd,p8 as Od,eQ as Pd,A_ as Qd,c8 as Rd,$Y as Sd,y_ as Td,v_ as Ud,f_ as Vd,q1 as Wd,V1 as Xd,_Y as Yd,UY as Zd,A1 as _d,LY as $d,l1 as ae,zY as be,jY as ce,HY as de,OY as ee,n8 as fe,NY as ge,AY as he,t8 as ie,IY as je,RY as ke,b$ as le,y$ as me,v$ as ne,g$ as oe,h$ as pe,r5 as qe,d$ as re,s0 as se,_3 as te,u$ as ue,m$ as ve,p$ as we,H3 as xe,O3 as ye,jJ as ze,HJ as Ae,NJ as Be,AJ as Ce,qJ as De,VJ as Ee,MJ as Fe,EJ as Ge,IJ as He,RJ as Ie,DJ as Je,wJ as Ke,TJ as Le,
|
|
4421
|
+
${K}`)}return{props:G,validation:W}}function qJ($,X){let Z={...$};for(let[Q,Y]of Object.entries(X))if(Z[Q]===void 0)Z[Q]=typeof Y==="function"?Y():Y;return Z}function VJ($){return $}function MJ($){return{type:$,required:!0}}function EJ($,X){return{type:X,default:$}}function IJ($,X={}){return{...X,validator:$}}function RJ($,X={}){return{...X,validator:(Z)=>$.includes(Z)}}function DJ($,X={}){return{...X,type:Array,validator:(Z)=>{if(!Array.isArray(Z))return!1;return!0}}}function wJ($,X={}){return{...X,type:Object}}function TJ($,X,Z){if(!X)return $;let Q={};for(let[Y,J]of Object.entries(X)){let G=typeof J==="function"||Array.isArray(J)?{type:J}:J||{},W=$[Y];if(W===void 0&&G.default!==void 0)W=typeof G.default==="function"?G.default():G.default;if(!q3()){let K=V3(Y,W,G,Z);if(K)console.warn(K.message)}Q[Y]=W}for(let[Y,J]of Object.entries($))if(!(Y in Q))Q[Y]=J;return Q}var LL={};
|
|
4422
|
+
export{yK as o,G5 as p,x6 as q,i4 as r,y0 as s,G$ as t,W$ as u,K$ as v,_$ as w,T1 as x,E3 as y,I3 as z,R3 as A,D3 as B,w3 as C,T3 as D,C3 as E,k3 as F,x3 as G,_6 as H,P3 as I,b3 as J,gJ as K,fJ as L,hJ as M,y3 as N,dJ as O,v3 as P,uJ as Q,mJ as R,pJ as S,cJ as T,lJ as U,iJ as V,aJ as W,sJ as X,rJ as Y,nJ as Z,G1 as _,oJ as $,tJ as aa,eJ as ba,$G as ca,ZG as da,QG as ea,f3 as fa,h3 as ga,YG as ha,d3 as ia,JG as ja,GG as ka,WG as la,KG as ma,_G as na,UG as oa,u3 as pa,m3 as qa,BG as ra,LG as sa,p3 as ta,zG as ua,NG as va,AG as wa,N6 as xa,n3 as ya,o3 as za,t3 as Aa,e3 as Ba,$5 as Ca,$4 as Da,X4 as Ea,Z4 as Fa,Q4 as Ga,VG as Ha,DG as Ia,wG as Ja,G4 as Ka,TG as La,Z5 as Ma,SG as Na,e4 as Oa,$X as Pa,BX as Qa,LX as Ra,FX as Sa,B7 as Ta,zX as Ua,jX as Va,HX as Wa,OX as Xa,NX as Ya,AX as Za,qX as _a,jW as $a,b1 as ab,AW as bb,qW as cb,VX as db,MX as eb,RX as fb,M$ as gb,VW as hb,MW as ib,EW as jb,IW as kb,RW as lb,DW as mb,wW as nb,TW as ob,CW as pb,kW as qb,xW as rb,SW as sb,xX as tb,bW as ub,fW as vb,hW as wb,E5 as xb,iW as yb,aW as zb,sW as Ab,rX as Bb,oW as Cb,QK as Db,YK as Eb,JK as Fb,GK as Gb,WK as Hb,KK as Ib,qK as Jb,xZ as Kb,VK as Lb,SZ as Mb,PZ as Nb,T7 as Ob,C7 as Pb,IK as Qb,RK as Rb,DK as Sb,TK as Tb,CK as Ub,dZ as Vb,xK as Wb,SK as Xb,PK as Yb,y6 as Zb,S7 as _b,gK as $b,fK as ac,hK as bc,dK as cc,uZ as dc,mZ as ec,pK as fc,pZ as gc,y7 as hc,cK as ic,cZ as jc,lK as kc,iK as lc,lZ as mc,X9 as nc,f7 as oc,sZ as pc,rZ as qc,h7 as rc,oZ as sc,tZ as tc,$Q as uc,l as vc,d7 as wc,P5 as xc,u7 as yc,m7 as zc,p7 as Ac,c7 as Bc,l7 as Cc,i7 as Dc,a7 as Ec,s7 as Fc,r7 as Gc,n7 as Hc,o7 as Ic,t7 as Jc,e7 as Kc,$8 as Lc,X8 as Mc,Z8 as Nc,Q8 as Oc,Y8 as Pc,J8 as Qc,G8 as Rc,b5 as Sc,W8 as Tc,K8 as Uc,_8 as Vc,U8 as Wc,B8 as Xc,F8 as Yc,y5 as Zc,v5 as _c,z8 as $c,g5 as ad,f5 as bd,h5 as cd,c1 as dd,I$ as ed,j8 as fd,H8 as gd,O8 as hd,R$ as id,A8 as jd,q8 as kd,V8 as ld,M8 as md,cQ as nd,lQ as od,d5 as pd,u5 as qd,w8 as rd,i0 as sd,T8 as td,C8 as ud,k8 as vd,x8 as wd,S8 as xd,D$ as yd,m5 as zd,b8 as Ad,w$ as Bd,y8 as Cd,v8 as Dd,g8 as Ed,f8 as Fd,T$ as Gd,C$ as Hd,p5 as Id,c5 as Jd,d8 as Kd,u8 as Ld,m8 as Md,k$ as Nd,p8 as Od,eQ as Pd,A_ as Qd,c8 as Rd,$Y as Sd,y_ as Td,v_ as Ud,f_ as Vd,q1 as Wd,V1 as Xd,_Y as Yd,UY as Zd,A1 as _d,LY as $d,l1 as ae,zY as be,jY as ce,HY as de,OY as ee,n8 as fe,NY as ge,AY as he,t8 as ie,IY as je,RY as ke,b$ as le,y$ as me,v$ as ne,g$ as oe,h$ as pe,r5 as qe,d$ as re,s0 as se,_3 as te,u$ as ue,m$ as ve,p$ as we,H3 as xe,O3 as ye,jJ as ze,HJ as Ae,NJ as Be,AJ as Ce,qJ as De,VJ as Ee,MJ as Fe,EJ as Ge,IJ as He,RJ as Ie,DJ as Je,wJ as Ke,TJ as Le,LL as Me,s4 as Ne,d6 as Oe,n4 as Pe,t4 as Qe};
|