@stacksjs/stx 0.2.919 → 0.2.921
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-0678sab4.js +2 -0
- package/dist/chunk-0bnv0aaz.js +2 -0
- package/dist/chunk-0bvfm5h5.js +2 -0
- package/dist/chunk-0c3q5h03.js +2 -0
- package/dist/chunk-0fh84wr5.js +2 -0
- package/dist/chunk-0p9x0m5n.js +2 -0
- package/dist/{chunk-m390z8w8.js → chunk-0rq1w0xr.js} +7 -7
- package/dist/{chunk-fwxgzktt.js → chunk-1pc2p489.js} +2 -2
- package/dist/{chunk-2szhk8mh.js → chunk-29cy41z3.js} +4 -4
- package/dist/{chunk-9mack1g8.js → chunk-2d0pemtc.js} +3 -3
- package/dist/{chunk-1bf0grbf.js → chunk-2qnpr0ty.js} +3 -3
- package/dist/{chunk-fjpt8arw.js → chunk-2r2tayyd.js} +2 -2
- package/dist/chunk-2sfxj244.js +2 -0
- package/dist/{chunk-wxqay5c2.js → chunk-30d298vs.js} +1 -1
- package/dist/{chunk-d69k67bn.js → chunk-36j2drjv.js} +9 -9
- package/dist/{chunk-9gr7m3tb.js → chunk-3d0bjcn7.js} +1 -1
- package/dist/chunk-3k9d0h11.js +2 -0
- package/dist/{chunk-whnzf9hn.js → chunk-3mc9ew9r.js} +6 -6
- package/dist/chunk-43r0h76m.js +2 -0
- package/dist/{chunk-cbqe84g3.js → chunk-4f8h38xr.js} +2 -2
- package/dist/{chunk-858p3hkz.js → chunk-4jg8ddfy.js} +2 -2
- package/dist/chunk-4jh5t3rz.js +2 -0
- package/dist/{chunk-rk16391e.js → chunk-4nabpd82.js} +5 -5
- package/dist/{chunk-p3x7kwb5.js → chunk-4w203ddt.js} +6 -6
- package/dist/chunk-4y2k14ec.js +2 -0
- package/dist/chunk-57xcb1wn.js +2 -0
- package/dist/chunk-5ekbye3p.js +2 -0
- package/dist/chunk-5s1q4y2j.js +2 -0
- package/dist/chunk-6359fekc.js +2 -0
- package/dist/{chunk-wv0wsavj.js → chunk-66cz2ph7.js} +2 -2
- package/dist/{chunk-p0xqm2ne.js → chunk-7767n5k6.js} +1 -1
- package/dist/{chunk-xpsg91dh.js → chunk-78j6c3sf.js} +5 -5
- package/dist/{chunk-qtzfbv7e.js → chunk-7d0h2pa3.js} +5 -5
- package/dist/{chunk-jgtn9t5n.js → chunk-7g720sk3.js} +2 -2
- package/dist/chunk-7nshr15z.js +2 -0
- package/dist/{chunk-14df2jzs.js → chunk-875wejw1.js} +2 -2
- package/dist/chunk-8g6cmgn8.js +2 -0
- package/dist/chunk-8gfdy17b.js +2 -0
- package/dist/{chunk-fn0y9z1t.js → chunk-8vjsmyrk.js} +5 -5
- package/dist/chunk-8yx65vb0.js +2 -0
- package/dist/{chunk-09xqy448.js → chunk-90ps064x.js} +2 -2
- package/dist/chunk-91nwc581.js +2 -0
- package/dist/{chunk-yzqb7y45.js → chunk-94001bha.js} +5 -5
- package/dist/chunk-94skx5m6.js +2 -0
- package/dist/chunk-9aegppj7.js +2 -0
- package/dist/{chunk-gjyz5ma7.js → chunk-9ch2qhbw.js} +1 -1
- package/dist/{chunk-m6hrb7rm.js → chunk-9sk596tw.js} +25 -25
- package/dist/{chunk-3ftrv1f7.js → chunk-a3qb13vr.js} +20 -20
- package/dist/chunk-a5vzdhsk.js +2 -0
- package/dist/{chunk-jjq7c8s2.js → chunk-a78k8fkg.js} +2 -2
- package/dist/{chunk-txk2z7v0.js → chunk-ag07tdhn.js} +4 -4
- package/dist/{chunk-0wctbtad.js → chunk-amnfd29h.js} +3 -3
- package/dist/chunk-aqh48tyw.js +2 -0
- package/dist/{chunk-zaj3nnvv.js → chunk-avtq2p0c.js} +2 -2
- package/dist/{chunk-3kpxkjgm.js → chunk-b0kq5mzq.js} +2 -2
- package/dist/chunk-b6am4h24.js +2 -0
- package/dist/{chunk-qzqqzraq.js → chunk-b9z4nb1v.js} +6 -6
- package/dist/{chunk-d4xjwebv.js → chunk-bwnx71s8.js} +5 -5
- package/dist/{chunk-mr9pp5cf.js → chunk-c3nmjx26.js} +2 -2
- package/dist/chunk-cajg2sz0.js +2 -0
- package/dist/{chunk-3efpqm1f.js → chunk-dhx4m7mf.js} +2 -2
- package/dist/chunk-dktqmf4t.js +2 -0
- package/dist/chunk-dqwxyk1m.js +2 -0
- package/dist/chunk-e2kk1d9z.js +2 -0
- package/dist/{chunk-zrxvj3zf.js → chunk-e8aqkt1b.js} +6 -6
- package/dist/{chunk-mztjpp7m.js → chunk-e8hvbc53.js} +2 -2
- package/dist/{chunk-kk9h53xg.js → chunk-edjzm0vj.js} +3 -3
- package/dist/chunk-ee4ejnk2.js +2 -0
- package/dist/chunk-eezp4a40.js +2 -0
- package/dist/chunk-eh2ynja3.js +2 -0
- package/dist/chunk-emk29htn.js +2 -0
- package/dist/{chunk-xq5s4vc1.js → chunk-eqj8nj5c.js} +1 -1
- package/dist/{chunk-ktv65e3n.js → chunk-f8sh6289.js} +7 -7
- package/dist/{chunk-6n6kndk0.js → chunk-fb1hyhgf.js} +3 -3
- package/dist/chunk-fd0vnz09.js +2 -0
- package/dist/chunk-fyhtp2nt.js +2 -0
- package/dist/{chunk-xk7hdpq5.js → chunk-g2fxp9zp.js} +3 -3
- package/dist/chunk-gbct53j0.js +2 -0
- package/dist/{chunk-m9ta0640.js → chunk-gsm3rk4j.js} +2 -2
- package/dist/{chunk-x40j67z1.js → chunk-gt9bt8xa.js} +2 -2
- package/dist/{chunk-ft34x0h1.js → chunk-gxdy4qjj.js} +4 -4
- package/dist/chunk-gxtq25gr.js +2 -0
- package/dist/chunk-h1dnjn9g.js +2 -0
- package/dist/{chunk-yvaqgdv1.js → chunk-h7z23fpq.js} +1 -1
- package/dist/{chunk-sxrcac01.js → chunk-hakevnm1.js} +2 -2
- package/dist/chunk-hn7fv830.js +2 -0
- package/dist/chunk-hx6tr46s.js +1459 -0
- package/dist/chunk-jenk04c8.js +2 -0
- package/dist/{chunk-1baxccfq.js → chunk-jfy0r3hx.js} +24 -24
- package/dist/{chunk-9zwmfkfg.js → chunk-jh007a8k.js} +5 -5
- package/dist/chunk-jh1hdq31.js +3 -0
- package/dist/{chunk-tb4be5ct.js → chunk-jk1hzawb.js} +3 -3
- package/dist/{chunk-hht7n4zd.js → chunk-jya12bfn.js} +2 -2
- package/dist/chunk-k1qbgpfy.js +2 -0
- package/dist/chunk-kgmwja6f.js +2 -0
- package/dist/{chunk-z6nyyt3n.js → chunk-khf62zkn.js} +5 -5
- package/dist/chunk-kppj8rqa.js +2 -0
- package/dist/{chunk-514yg4dr.js → chunk-m3ra99h8.js} +6 -6
- package/dist/{chunk-qsnw0qyp.js → chunk-m8rzaqm8.js} +2 -2
- package/dist/chunk-msvphygp.js +2 -0
- package/dist/chunk-mzbejejf.js +2 -0
- package/dist/{chunk-v1x96kjr.js → chunk-nkgqhb7s.js} +7 -7
- package/dist/{chunk-9707zz6v.js → chunk-p17jeqz0.js} +2 -2
- package/dist/{chunk-2f46pcg0.js → chunk-pe5sstex.js} +2 -2
- package/dist/{chunk-vtj3dwhh.js → chunk-pqr4gn9b.js} +2 -2
- package/dist/{chunk-40j2pmnb.js → chunk-prj38cyp.js} +5 -5
- package/dist/{chunk-mn9t5fnv.js → chunk-q8snpht6.js} +2 -2
- package/dist/chunk-q99y5115.js +3 -0
- package/dist/{chunk-7axtwg1f.js → chunk-qzspvwv6.js} +2 -2
- package/dist/chunk-r02asm46.js +2 -0
- package/dist/{chunk-vf7tpgqz.js → chunk-r7zvrh58.js} +16 -16
- package/dist/{chunk-ex6dne7e.js → chunk-ra35ptjg.js} +2 -2
- package/dist/chunk-rc4712qh.js +2 -0
- package/dist/chunk-rq7sg012.js +33 -0
- package/dist/{chunk-v060015m.js → chunk-rt4gzqs9.js} +1 -1
- package/dist/chunk-rx1xw7q2.js +2 -0
- package/dist/{chunk-mnpfvxpa.js → chunk-rzmephr2.js} +30 -30
- package/dist/{chunk-0xyfs691.js → chunk-s3rhbwgf.js} +4 -4
- package/dist/{chunk-xap1f1bw.js → chunk-s6w14v6h.js} +2 -2
- package/dist/{chunk-nkbnsbb0.js → chunk-sdvv8zge.js} +2 -2
- package/dist/{chunk-3br07y64.js → chunk-sgppgy5e.js} +5 -5
- package/dist/{chunk-v1a5h1tc.js → chunk-sk7pptzf.js} +9 -9
- package/dist/{chunk-50zzar2c.js → chunk-sk8x8nw8.js} +3 -3
- package/dist/chunk-skjm3zdh.js +2 -0
- package/dist/{chunk-5fdc8pej.js → chunk-t4exh7c9.js} +7 -7
- package/dist/{chunk-3hfv217t.js → chunk-t64mp8x1.js} +6 -6
- package/dist/{chunk-neymp1bb.js → chunk-tfpd7aht.js} +3 -3
- package/dist/chunk-tsnzhke9.js +2 -0
- package/dist/{chunk-yye2pec5.js → chunk-tt6n2mx6.js} +14 -14
- package/dist/chunk-txyze88n.js +2 -0
- package/dist/chunk-v1t7sees.js +2 -0
- package/dist/{chunk-1a2c4pv8.js → chunk-vhp5hqwp.js} +10 -10
- package/dist/{chunk-1vsjmwr1.js → chunk-vn3hsx7v.js} +2 -2
- package/dist/chunk-vt410s5m.js +2 -0
- package/dist/{chunk-3tcy9r6r.js → chunk-w27j0apm.js} +14 -14
- package/dist/{chunk-2zb642qr.js → chunk-w5vxzk5j.js} +6 -6
- package/dist/chunk-w81a1e14.js +9 -0
- package/dist/{chunk-tnbzg7fd.js → chunk-wajvxzt0.js} +2 -2
- package/dist/chunk-wrva7jes.js +2 -0
- package/dist/{chunk-p4twxjfs.js → chunk-ws25jw6x.js} +3 -3
- package/dist/{chunk-m86sjbx7.js → chunk-ww24mxmd.js} +3 -3
- package/dist/chunk-xdprx6tx.js +1331 -0
- package/dist/chunk-xgv3gy1b.js +2 -0
- package/dist/chunk-xjhv5e5f.js +2 -0
- package/dist/chunk-xnvh4jk2.js +21 -0
- package/dist/chunk-xtakhmnb.js +2 -0
- package/dist/{chunk-zb6my502.js → chunk-y97g0kwc.js} +1 -1
- package/dist/chunk-y9f9d4zv.js +2 -0
- package/dist/{chunk-qda8tmk9.js → chunk-yfe380a4.js} +2 -2
- package/dist/{chunk-6x5a2w5a.js → chunk-ygtz9kc7.js} +2 -2
- package/dist/chunk-yyypc7s3.js +2 -0
- package/dist/chunk-z5j4prza.js +2 -0
- package/dist/{chunk-2jm7map2.js → chunk-z68teecy.js} +2 -2
- package/dist/cli.js +20 -20
- package/dist/composables/use-media-query.js +23 -22
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/native/accessibility.d.ts +1 -1
- package/dist/native/accessibility.js +5 -3
- package/dist/native/bridge/protocol.d.ts +1 -0
- package/dist/native/compiler/html-to-ir.js +14 -1
- package/dist/native/compiler/ir.d.ts +7 -0
- package/dist/native/components/primitives.d.ts +1 -0
- package/dist/native/event-names.js +4 -0
- package/dist/native/prop-names.js +3 -1
- package/dist/native/runtime/browser-renderer.js +4 -0
- package/dist/native/runtime/craft-bridge.js +1 -0
- package/dist/native/runtime/craft.d.ts +3 -0
- package/dist/native/runtime/jsc-globals.js +1 -1
- package/dist/native/runtime/native-media.js +8 -3
- package/dist/native/runtime/shared-screen.js +8 -3
- package/dist/native/testing.d.ts +2 -1
- package/dist/native/testing.js +2 -1
- package/dist/process.js +6 -3
- package/dist/pwa.js +3 -3
- package/dist/signal-processing.d.ts +2 -2
- package/dist/signal-processing.js +17 -11
- package/dist/ssg.js +9 -9
- package/dist/utils.js +2 -1
- package/dist/vue-template.d.ts +2 -0
- package/dist/vue-template.js +72 -2
- package/package.json +6 -6
- package/dist/chunk-0ebaf0pr.js +0 -2
- package/dist/chunk-0jjq552g.js +0 -2
- package/dist/chunk-15rc8t28.js +0 -2
- package/dist/chunk-1jrhjn2b.js +0 -2
- package/dist/chunk-1svffhzq.js +0 -2
- package/dist/chunk-2m4ydym0.js +0 -33
- package/dist/chunk-2mv29s6w.js +0 -9
- package/dist/chunk-3aayrnbh.js +0 -21
- package/dist/chunk-426gq0g5.js +0 -2
- package/dist/chunk-4ge80k8j.js +0 -2
- package/dist/chunk-4vdfqr64.js +0 -2
- package/dist/chunk-4yz33vzb.js +0 -2
- package/dist/chunk-4zcswx6x.js +0 -2
- package/dist/chunk-5ht628zp.js +0 -2
- package/dist/chunk-67zy5p7x.js +0 -2
- package/dist/chunk-8153bfpx.js +0 -2
- package/dist/chunk-86p0m920.js +0 -2
- package/dist/chunk-88texeh4.js +0 -2
- package/dist/chunk-8mye65n9.js +0 -2
- package/dist/chunk-8ycgk8w6.js +0 -2
- package/dist/chunk-9xcsn4pb.js +0 -2
- package/dist/chunk-a5tg553d.js +0 -2
- package/dist/chunk-agxxqjjt.js +0 -2
- package/dist/chunk-b44pvac7.js +0 -2
- package/dist/chunk-b4yp16a2.js +0 -2
- package/dist/chunk-fb63xppz.js +0 -2
- package/dist/chunk-ffqqkeye.js +0 -2
- package/dist/chunk-g1v12bjm.js +0 -2
- package/dist/chunk-gg0kkn2e.js +0 -2
- package/dist/chunk-ggg8b8n1.js +0 -2
- package/dist/chunk-ggrcg7k7.js +0 -2
- package/dist/chunk-gmn9ba8f.js +0 -3
- package/dist/chunk-gqe574d9.js +0 -2
- package/dist/chunk-hajamm16.js +0 -2
- package/dist/chunk-hg2n2264.js +0 -2
- package/dist/chunk-hxabvt31.js +0 -2
- package/dist/chunk-j3sat6vn.js +0 -2
- package/dist/chunk-j9gbnqxq.js +0 -2
- package/dist/chunk-jj2z4nxa.js +0 -2
- package/dist/chunk-k289127j.js +0 -2
- package/dist/chunk-m1hfh2t4.js +0 -2
- package/dist/chunk-m3qwqhxp.js +0 -2
- package/dist/chunk-m9smh7fs.js +0 -2
- package/dist/chunk-mhnjtc42.js +0 -2
- package/dist/chunk-n4bxb2hx.js +0 -2
- package/dist/chunk-n958bxm6.js +0 -2
- package/dist/chunk-nkr1aa5z.js +0 -2
- package/dist/chunk-p3vswt0f.js +0 -2
- package/dist/chunk-p8wnp4p1.js +0 -2
- package/dist/chunk-q3z252d9.js +0 -2
- package/dist/chunk-qfkak3jb.js +0 -2
- package/dist/chunk-rt7xy537.js +0 -2
- package/dist/chunk-rwjye578.js +0 -2
- package/dist/chunk-sbr3wg75.js +0 -1467
- package/dist/chunk-sftznswb.js +0 -2
- package/dist/chunk-tz5ktd6d.js +0 -2
- package/dist/chunk-vb609vbj.js +0 -1323
- package/dist/chunk-vtcyber4.js +0 -2
- package/dist/chunk-wq2bpt0w.js +0 -2
- package/dist/chunk-wv8zt78c.js +0 -2
- package/dist/chunk-xakqpa4z.js +0 -3
- package/dist/chunk-xy3ex6ht.js +0 -2
- package/dist/chunk-y899wtm8.js +0 -2
- package/dist/chunk-ye45znz5.js +0 -2
- package/dist/chunk-yegp50jb.js +0 -2
- package/dist/chunk-yq9aqpk8.js +0 -2
- package/dist/chunk-zt45dqfx.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ja,qu,ar,vh,Ku,Xu,Gu,xh}from"./chunk-ww24mxmd.js";import"./chunk-xdprx6tx.js";import"./chunk-yfe380a4.js";import"./chunk-875wejw1.js";import"./chunk-r7zvrh58.js";import"./chunk-ayrd026n.js";import"./chunk-ra35ptjg.js";import"./chunk-a78k8fkg.js";import"./chunk-4jg8ddfy.js";export{ar as Validator,qu as defineForm,Ku as processErrorDirective,Xu as processErrorsDirective,xh as processFormValidationDirectives,Gu as processHasErrorsDirective,Ja as useForm,vh as v};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{K,Rg,_i,Yc,a,j,Py,Iy}from"./chunk-w27j0apm.js";import"./chunk-sk8x8nw8.js";import"./chunk-c3nmjx26.js";import"./chunk-ag07tdhn.js";import"./chunk-f8sh6289.js";import"./chunk-t4exh7c9.js";import"./chunk-xdprx6tx.js";import"./chunk-yfe380a4.js";import"./chunk-875wejw1.js";import"./chunk-r7zvrh58.js";import"./chunk-ayrd026n.js";import"./chunk-ra35ptjg.js";import"./chunk-a78k8fkg.js";import"./chunk-4jg8ddfy.js";export{j as config,K as defaultConfig,Py as defineStxConfig,_i as discoverConfig,a as loadStxConfig,Yc as resolveInstalledPackage,Rg as resolveStxDirectories,Iy as validateConfig};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{ue,de,pe,tr,$e,ze,hs,Au,Rt,pn,nr,rr,sr,fe,or,ir,ys}from"./chunk-vn3hsx7v.js";import"./chunk-2qnpr0ty.js";export{de as DEFAULT_FORMATS,pe as DEFAULT_QUALITY,ue as DEFAULT_WIDTHS,ys as ImageProcessingError,ir as formatSize,pn as generateSizes,Rt as generateSrcSet,nr as getFallbackVariant,hs as getImageMetadata,fe as getMimeType,or as getTotalSize,rr as groupVariantsByFormat,$e as isImageBackendAvailable,sr as isImageFile,tr as isSharpAvailable,ze as processImage,Au as resizeAndConvert};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Nm}from"./chunk-4nabpd82.js";import"./chunk-hx6tr46s.js";import"./chunk-0rq1w0xr.js";import"./chunk-vhp5hqwp.js";import"./chunk-avtq2p0c.js";import"./chunk-36j2drjv.js";import"./chunk-jh1hdq31.js";import"./chunk-3mc9ew9r.js";import"./chunk-2r2tayyd.js";import"./chunk-xnvh4jk2.js";import"./chunk-nkgqhb7s.js";import"./chunk-7767n5k6.js";import"./chunk-1pc2p489.js";import"./chunk-w81a1e14.js";import"./chunk-w27j0apm.js";import"./chunk-sk8x8nw8.js";import"./chunk-c3nmjx26.js";import"./chunk-ag07tdhn.js";import"./chunk-f8sh6289.js";import"./chunk-t4exh7c9.js";import"./chunk-xdprx6tx.js";import"./chunk-yfe380a4.js";import"./chunk-875wejw1.js";import"./chunk-r7zvrh58.js";import"./chunk-ayrd026n.js";import"./chunk-ra35ptjg.js";import"./chunk-a78k8fkg.js";import"./chunk-4jg8ddfy.js";export{Nm as startInteractive};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{qh,qo,Kh,Xh,Gh,Jh}from"./chunk-t64mp8x1.js";import"./chunk-sgppgy5e.js";import"./chunk-78j6c3sf.js";import"./chunk-s1x2pc9b.js";import"./chunk-xnvh4jk2.js";import"./chunk-nkgqhb7s.js";import"./chunk-7767n5k6.js";import"./chunk-w81a1e14.js";import"./chunk-w27j0apm.js";import"./chunk-sk8x8nw8.js";import"./chunk-c3nmjx26.js";import"./chunk-ag07tdhn.js";import"./chunk-f8sh6289.js";import"./chunk-t4exh7c9.js";import"./chunk-xdprx6tx.js";import"./chunk-yfe380a4.js";import"./chunk-875wejw1.js";import"./chunk-r7zvrh58.js";import"./chunk-ayrd026n.js";import"./chunk-ra35ptjg.js";import"./chunk-a78k8fkg.js";import"./chunk-4jg8ddfy.js";export{Jh as clearStoreCache,qh as getStoreScript,Gh as getStoreScriptFor,Xh as pageStoresAll,qo as storesRead,Kh as storesReadInFiles};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{k,E,
|
|
3
|
-
`)}var
|
|
2
|
+
import{k,E,Wi,Pn}from"./chunk-xdprx6tx.js";import{ki}from"./chunk-1pc2p489.js";import{l}from"./chunk-ygtz9kc7.js";import{N,f}from"./chunk-ws25jw6x.js";import _ from"fs";import d from"path";import{hasLocalConfig as ye}from"bunfig";var Ot={fg:{light:"neutral-900",dark:"neutral-100",description:"Primary text"},"fg-strong":{light:"neutral-700",dark:"neutral-300",description:"Labels, secondary headings"},"fg-muted":{light:"neutral-600",dark:"neutral-400",description:"Supporting text"},"fg-soft":{light:"neutral-500",dark:"neutral-400",description:"De-emphasised text"},"fg-subtle":{light:"neutral-400",dark:"neutral-500",description:"Recessive, non-essential text"},surface:{light:"neutral-50",dark:"neutral-800",description:"Page and panel background"},"surface-raised":{light:"neutral-100",dark:"neutral-700",description:"Cards, popovers"},"surface-sunken":{light:"neutral-200",dark:"neutral-700",description:"Wells, track backgrounds"},panel:{light:"white",dark:"neutral-800",description:"Card, menu, dialog surface"},field:{light:"white",dark:"neutral-700",description:"Form control surface"},page:{light:"neutral-50",dark:"neutral-900",description:"Page background, behind panels"},content:{light:"white",dark:"neutral-900",description:"Content area under a chrome header - a table or list body"},"surface-hover":{light:"neutral-100",dark:"neutral-700",description:"Row or item highlight on a page or panel"},"surface-raised-hover":{light:"neutral-200",dark:"neutral-600",description:"Raised surface, hovered"},"surface-sunken-hover":{light:"neutral-300",dark:"neutral-600",description:"Sunken surface, hovered"},"field-hover":{light:"neutral-50",dark:"neutral-600",description:"Form control surface, hovered"},link:{light:"blue-500",dark:"blue-400",description:"Hyperlink"},"link-hover":{light:"blue-600",dark:"blue-300",description:"Hyperlink, hovered"},inverse:{light:"neutral-900",dark:"neutral-700",description:"Tooltip bubble, inverted surface"},"inverse-ink":{light:"white",dark:"white",description:"Text on an inverted surface"},line:{light:"neutral-200",dark:"neutral-700",description:"Default border, divider"},"line-strong":{light:"neutral-300",dark:"neutral-600",description:"Input border, focus ring track"},"line-hover":{light:"neutral-400",dark:"neutral-500",description:"Border of a hovered control"},accent:{light:"blue-600",dark:"blue-400",description:"Primary action, selected state"},info:{light:"cyan-600",dark:"cyan-400",description:"Informational emphasis"},danger:{light:"red-600",dark:"red-400",description:"Errors, destructive actions"},success:{light:"green-600",dark:"green-400",description:"Confirmation"},warning:{light:"yellow-600",dark:"yellow-400",description:"Caution"},"accent-solid":{light:"blue-500",dark:"blue-600",description:"Primary button fill"},"info-solid":{light:"cyan-500",dark:"cyan-600",description:"Informational fill"},"danger-solid":{light:"red-500",dark:"red-600",description:"Destructive button fill"},"success-solid":{light:"green-500",dark:"green-600",description:"Confirmation fill"},"warning-solid":{light:"yellow-500",dark:"yellow-600",description:"Caution fill"},"accent-solid-hover":{light:"blue-600",dark:"blue-700",description:"Primary button fill, hovered"},"info-solid-hover":{light:"cyan-600",dark:"cyan-700",description:"Informational fill, hovered"},"danger-solid-hover":{light:"red-600",dark:"red-700",description:"Destructive fill, hovered"},"success-solid-hover":{light:"green-600",dark:"green-700",description:"Confirmation fill, hovered"},"warning-solid-hover":{light:"yellow-600",dark:"yellow-700",description:"Caution fill, hovered"},"accent-ink":{light:"white",dark:"white",description:"Text on a primary fill"},"info-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on an informational fill"},"danger-ink":{light:"white",dark:"white",description:"Text on a destructive fill"},"success-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a confirmation fill"},"warning-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a caution fill"},"accent-soft":{light:"blue-100",dark:"blue-900",description:"Tinted primary fill"},"accent-soft-ink":{light:"blue-800",dark:"blue-200",description:"Text on a tinted primary fill"},"info-soft":{light:"cyan-100",dark:"cyan-900",description:"Tinted informational fill"},"info-soft-ink":{light:"cyan-800",dark:"cyan-200",description:"Text on a tinted informational fill"},"danger-soft":{light:"red-100",dark:"red-900",description:"Tinted destructive fill"},"danger-soft-ink":{light:"red-800",dark:"red-200",description:"Text on a tinted destructive fill"},"success-soft":{light:"green-100",dark:"green-900",description:"Tinted confirmation fill"},"success-soft-ink":{light:"green-800",dark:"green-200",description:"Text on a tinted confirmation fill"},"warning-soft":{light:"yellow-100",dark:"yellow-900",description:"Tinted caution fill"},"warning-soft-ink":{light:"yellow-800",dark:"yellow-200",description:"Text on a tinted caution fill"},secondary:{light:"purple-600",dark:"purple-400",description:"Secondary emphasis"},"secondary-solid":{light:"purple-500",dark:"purple-600",description:"Secondary fill"},"secondary-solid-hover":{light:"purple-600",dark:"purple-700",description:"Secondary fill, hovered"},"secondary-ink":{light:"white",dark:"white",description:"Text on a secondary fill"},"secondary-soft":{light:"purple-100",dark:"purple-900",description:"Tinted secondary fill"},"secondary-soft-ink":{light:"purple-800",dark:"purple-200",description:"Text on a tinted secondary fill"},"danger-fg":{light:"red-900",dark:"red-300",description:"Text in a field with an error"},"danger-fg-subtle":{light:"red-300",dark:"red-500",description:"Recessive text in a field with an error"},"danger-line":{light:"red-300",dark:"red-600",description:"Border of a field with an error"},"danger-focus":{light:"red-500",dark:"red-400",description:"Focus ring of a field with an error"}};function ct(n){return`--stx-${n}`}function H(n,t){let s=t.lastIndexOf("-");if(s===-1)return typeof n[t]==="string"?n[t]:void 0;let r=n[t.slice(0,s)];if(!r||typeof r!=="object")return;let i=r[t.slice(s+1)];return typeof i==="string"?i:void 0}var Re=/^(?:#[\da-f]{3,8}|(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix|var)\(.*\)|white|black|transparent|currentcolor)$/i;function te(n,t){let s=t.trim();return H(n,s)??(Re.test(s)?s:void 0)}function ne(n={}){return[...Object.keys(n.roles??{}).filter((t)=>!Ot[t]).map((t)=>`roles.${t}`),...Object.keys(n.shapes??{}).filter((t)=>!Ae[t]).map((t)=>`shapes.${t}`),...Object.keys(n.density??{}).filter((t)=>!Ve[t]).map((t)=>`density.${t}`)]}function se(n){let t={};for(let[s,r]of Object.entries(Ot)){let i=H(n,r.light);if(i===void 0)continue;t[s]=`var(${ct(s)}, ${i})`}return t}function re(n,t={}){let s=[],r=[];for(let[i,o]of Object.entries(Ot)){let a=t[i],g=typeof a==="string"?a:a?.light,c=typeof a==="string"?a:a?.dark,u=g&&te(n,g)||H(n,o.light),h=c&&te(n,c)||H(n,o.dark);if(u===void 0)continue;if(s.push(` ${ct(i)}: ${u};`),h!==void 0)r.push(` ${ct(i)}: ${h};`)}if(s.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",...s,"}",".dark {",...r,"}",""].join(`
|
|
3
|
+
`)}var Ae={control:{value:"0.375rem",description:"Buttons, inputs, selects \u2014 rounded-md"},panel:{value:"0.5rem",description:"Cards, dialogs, menus \u2014 rounded-lg"},pill:{value:"9999px",description:"Chips and badges, which are pill-shaped by intent"}};function _n(n){return`--stx-radius-${n}`}function ie(){let n={};for(let[t,s]of Object.entries(Ae))n[t]=`var(${_n(t)}, ${s.value})`;return n}function oe(n={}){return["/* stx shape tokens \u2014 a radius by what the thing is. */",":root {",...Object.entries(Ae).map(([t,s])=>` ${_n(t)}: ${n[t]??s.value};`),"}",""].join(`
|
|
4
4
|
`)}var Ve={"control-px":{value:"1rem",description:"Inline padding of a md text control \u2014 px-4"},"control-py":{value:"0.5rem",description:"Block padding of a md text control \u2014 py-2"},"control-text":{value:"1rem",description:"Font size of a md text control \u2014 text-base"},"control-leading":{value:"1.5rem",description:"Line height of a md text control \u2014 text-base"},"cell-px":{value:"1.5rem",description:"Inline padding of every table cell, header or body \u2014 px-6"},"cell-py":{value:"1rem",description:"Block padding of a body cell \u2014 py-4"},"cell-text":{value:"0.875rem",description:"Font size of a body cell \u2014 text-sm"},"cell-leading":{value:"1.25rem",description:"Line height of a body cell \u2014 text-sm"},"cell-head-py":{value:"0.75rem",description:"Block padding of a header cell \u2014 py-3"},"cell-head-text":{value:"0.75rem",description:"Font size of a header cell \u2014 text-xs"},"cell-head-leading":{value:"1rem",description:"Line height of a header cell \u2014 text-xs"}},kr={"control-x":"control-px","control-y":"control-py","cell-x":"cell-px","cell-y":"cell-py","cell-head-y":"cell-head-py"},_r={control:{size:"control-text",leading:"control-leading"},cell:{size:"cell-text",leading:"cell-leading"},"cell-head":{size:"cell-head-text",leading:"cell-head-leading"}};function lt(n){return`--stx-${n}`}function Y(n){let t=Ve[n];if(!t)throw Error(`[stx] unknown density token "${n}"`);return`var(${lt(n)}, ${t.value})`}function ce(){let n={};for(let[t,s]of Object.entries(kr))n[t]=Y(s);return n}function ae(){let n={};for(let[t,{size:s,leading:r}]of Object.entries(_r))n[t]=[Y(s),{lineHeight:Y(r)}];return n}function le(n={}){return["/* stx density tokens \u2014 how much room a control or a table cell takes. */",":root {",...Object.entries(Ve).map(([t,s])=>` ${lt(t)}: ${n[t]??s.value};`),"}",""].join(`
|
|
5
5
|
`)}function de(n){return typeof n==="object"&&n!==null&&!Array.isArray(n)}function J(n,t){let s={...n};for(let[r,i]of Object.entries(t))s[r]=de(i)&&de(s[r])?J(s[r],i):i;return s}function ge(n,t){if(!t.fonts)return"";let s=new n({...t.config,fonts:t.fonts,cssVariables:!1}).toCSS(!1,t.minify);return s&&!t.minify?`${s}
|
|
6
|
-
`:s}function fe(n={},t={}){let s=n.theme||{},r=t.theme||{},{extend:i,...o}=r,{extend:a,...g}=s,c=g.colors||{};g.colors={...c,...se(c)};let u=g.borderRadius||{};g.borderRadius={...u,...ie()};let h=g.spacing||{};g.spacing={...h,...ce()};let P=g.fontSize||{};g.fontSize={...P,...ae()};let D=J(g,o),
|
|
7
|
-
`)}async function Fe(n,t){try{let s=await
|
|
6
|
+
`:s}function fe(n={},t={}){let s=n.theme||{},r=t.theme||{},{extend:i,...o}=r,{extend:a,...g}=s,c=g.colors||{};g.colors={...c,...se(c)};let u=g.borderRadius||{};g.borderRadius={...u,...ie()};let h=g.spacing||{};g.spacing={...h,...ce()};let P=g.fontSize||{};g.fontSize={...P,...ae()};let D=J(g,o),O=J(a||{},i||{});if(Object.keys(O).length>0)D.extend=O;let y=[...n.safelist||[],...t.safelist||[]],I={...n.shortcuts||{},...t.shortcuts||{}},z=[...n.preflights||[],...t.preflights||[]],{fonts:L,...Q}=n,{fonts:A,roles:R,shapes:T,density:F,...w}=t,b={roles:R,shapes:T,density:F},p=A??L;return{config:{...Q,...w,theme:D,safelist:y,shortcuts:I,...z.length>0?{preflights:z}:{},content:[],output:""},safelist:y,shortcuts:I,includePreflight:t.preflight!==!1,minify:t.minify===!0,tokenCSS:re({...c,...D.colors},R)+oe(T)+le(F),unknownRoles:ne(b),...p?{fonts:p}:{}}}var e={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"};import j from"fs";import $e from"path";var Te=256,x=new Map,ue=(n)=>Bun.hash(n).toString(16).padStart(16,"0").slice(0,16),pe=(n)=>l(process.cwd(),"css-assets",`${n}.css`);function K(n,t){if(x.delete(n),x.set(n,t),x.size>Te)x.delete(x.keys().next().value)}function he(n){let t=ue(n),s=pe(t);if(x.has(s))return K(s,n),t;let r;try{let i;try{i=j.readFileSync(s,"utf8")}catch{}if(i!==n)j.mkdirSync($e.dirname(s),{recursive:!0}),r=`${s}.${process.pid}.${crypto.randomUUID()}.tmp`,j.writeFileSync(r,n,{flag:"wx"}),j.renameSync(r,s);return K(s,n),t}catch{return}finally{if(r)try{j.unlinkSync(r)}catch{}}}function mg(n){if(!/^[a-f0-9]{16}$/.test(n))return;let t=pe(n),s=x.get(t);if(s!==void 0)return K(t,s),s;try{let r=j.readFileSync(t,"utf8");if(ue(r)!==n)return;return K(t,r),r}catch{return}}function me(){x.clear()}var m=null,U="";function xe(n){try{let t=n.startsWith("file:")?new URL(n).pathname:n;U=`${t}@${Math.trunc(_.statSync(t).mtimeMs)}`}catch{U=n}}var Z=!1,v=null,M="",B=!1,je=256,Be="sorted",C=new Map,V=null,we=null,W=new Map,ke=new Set;function ee(n){return Bun.hash(n).toString(16).padStart(16,"0").slice(0,16)}function X(n,t){if(C.has(n))C.delete(n);else if(C.size>=je)C.delete(C.keys().next().value);C.set(n,t)}async function Ee(n,t=V){if(!t)return null;try{let s=Bun.file(d.join(t,`cw-${ee(n)}.css`));if(!await s.exists())return null;return await s.text()}catch{return null}}async function Pe(n,t,s=V){if(!s)return;try{if(!_.existsSync(s))_.mkdirSync(s,{recursive:!0});await Bun.write(d.join(s,`cw-${ee(n)}.css`),t)}catch{}}async function Ce(n){try{let t=await import(n);if(t&&t.CSSGenerator)return{CSSGenerator:t.CSSGenerator,config:t.config,build:t.build,defaultConfig:t.defaultConfig,extractClasses:t.extractClasses}}catch{}return null}var De=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],Oe=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function Ie(){let n=[],t=process.cwd();while(t!==d.dirname(t)){for(let s of["node_modules","pantry"])for(let r of De)n.push(d.join(t,s,...r));t=d.dirname(t)}return n}function Ne(){let n=[],t=process.env.HOME||process.env.USERPROFILE||"",s=[t&&d.join(t,"Code","Tools","ts-css"),t&&d.join(t,"Code","Tools","crosswind"),t&&d.join(t,"repos","stacks-org","ts-css"),t&&d.join(t,"repos","stacks-org","crosswind"),d.join(process.cwd(),"..","ts-css"),d.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let r of s)n.push(d.join(r,"packages","toolkit","dist","engine","index.js")),n.push(d.join(r,"packages","toolkit","src","engine","index.ts"));if(t)n.push(d.join(t,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return n}async function Fc(){if(Z)return m;Z=!0;try{let n=async(i)=>{for(let o of i){if(!await Bun.file(o).exists())continue;let a=await Ce(o);if(a){if(xe(o),!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded from ${d.dirname(d.dirname(o))}`);return a}}return null};if(process.env.CROSSWIND_SRC){let i=d.resolve(process.env.CROSSWIND_SRC),o=await n([i]);if(!o)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${i}`);return m=o,m}let t=await n(Ie());if(t)return m=t,m;let s=Oe;for(let i of s){let o=await Ce(i);if(o){m=o;try{xe(import.meta.resolve(i))}catch{U=i}if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded`);return m}}let r=await n(Ne());if(r)return m=r,m;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${e.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${e.reset}`),console.warn(`${e.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${e.reset}`),null}}function gy(){q.clear(),m=null,Z=!1,v=null,M="",C.clear(),me(),we=null,W.clear()}var Se=!1;async function zc(n){try{let t=ye({name:"css",cwd:n})?"css":ye({name:"crosswind",cwd:n})?"crosswind":null;if(!t)return null;if(t==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!Se)Se=!0,console.warn(`${e.yellow}[ts-css]${e.reset} Reading the CSS config from a \`crosswind\` file. Rename it to \`css\` (e.g. config/css.ts) \u2014 the old name is deprecated.`);let{loadConfigWithResult:s}=await import("bunfig"),r=await s({name:t,cwd:n,defaultConfig:{},checkEnv:!1,verbose:!1});if(!r?.path||!r.config||Object.keys(r.config).length===0)return null;let i=d.relative(n,r.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} Loaded config from ${i||r.path}`);return r.config}catch(t){if(t instanceof Error&&t.name==="ConfigNotFoundError")return null;return console.warn(`${e.yellow}[ts-css]${e.reset} Failed to load css config:`,t instanceof Error?t.message:t),null}}async function hg(n){let t=null;try{let{loadStxConfig:s}=await import("./chunk-0bnv0aaz.js"),r=await s(n);if(r.css)if(typeof r.css==="string"){let i=d.isAbsolute(r.css)?r.css:d.resolve(n,r.css);if(await Bun.file(i).exists()){let o=await import(i);t=o.default||o,console.log(`${e.green}[ts-css]${e.reset} Loaded config from stx.config.ts \u2192 ${r.css}`)}}else{if(t={...r.css,content:r.css.content||[],preflight:r.css.preflight??!0,minify:r.css.minify??!1},r.css.config){let i=d.isAbsolute(r.css.config)?r.css.config:d.resolve(n,r.css.config);if(await Bun.file(i).exists()){let o=await import(i);t={...o.default||o,...t}}}console.log(`${e.green}[ts-css]${e.reset} Using inline CSS config from stx.config.ts`)}}catch{}return t||await zc(n)}function yg(n){try{let t=new WeakSet;return ee(JSON.stringify(n??{},(s,r)=>{if(typeof r==="function")return`[fn]${String(r)}`;if(typeof r==="object"&&r!==null){if(t.has(r))return"[circular]";t.add(r)}return r})??"")}catch{return"unhashable"}}async function Cn(n){if(B)return M;B=!0;try{let t=await Fc();if(!t||!t.build)return B=!1,"";if(!v)v=await zc(n);if(!v)return B=!1,"";let s=t.defaultConfig?.theme||{},r=v.theme||{},i={...t.defaultConfig,...v,theme:{...s,...r,extend:{...s.extend||{},...r.extend||{}}}},o=performance.now(),a=await t.build(i),g=performance.now()-o;if(M=a.css,console.log(`${e.cyan}[ts-css]${e.reset} Built ${a.classes.size} classes in ${g.toFixed(1)}ms`),i.output){let c=d.isAbsolute(i.output)?i.output:d.join(n,i.output),u=d.dirname(c);if(!_.existsSync(u))_.mkdirSync(u,{recursive:!0});await Bun.write(c,a.css)}return B=!1,a.css}catch(t){return console.error(`${e.red}[ts-css]${e.reset} Build error:`,t),B=!1,M}}async function Cr(n){v=null,await Cn(n)}function my(){return M}function bg(n){let t=new Set,s=/class\s*=\s*["']([^"']+)["']/gi,r=s.exec(n);while(r!==null){for(let a of r[1].split(/\s+/))if(a.trim())t.add(a.trim());r=s.exec(n)}let i=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,o=i.exec(n);while(o!==null){let a=o[1].match(/'([^']+)'/g);if(a){for(let g of a)for(let c of g.slice(1,-1).split(/\s+/))if(c.trim())t.add(c.trim())}o=i.exec(n)}return t}var q=k(64);async function wg(n,t){let s=()=>W.get(t?d.resolve(t):process.cwd())?.fingerprint??null,r=q.get(E(n,t,s()));if(r!==void 0)return r;let i=await Fe(n,t);if(i)q.set(E(n,t,s()),i);return i}function*be(n){yield n;let t=new Set;for(let s of n.matchAll(/\/_stx\/modules\.([0-9a-f]{16})\.js/g)){let r=s[1];if(t.has(r))continue;t.add(r);let i=ki(r);if(i)yield i}}function hy(n){return[...be(n)].join(`
|
|
7
|
+
`)}async function Fe(n,t){try{let s=await Fc();if(!s)return"";let r=new Set;for(let p of be(n)){let G=typeof s.extractClasses==="function"?s.extractClasses(p):bg(p);for(let ve of G)r.add(ve)}if(r.size===0)return"";let i=t?d.resolve(t):process.cwd(),o=l(i,"cache");if(!V)V=o;let a=W.get(i);if(!a){let p=await hg(i);a={config:p,fingerprint:yg(p)},W.set(i,a),we=a.fingerprint}let g=[...r].sort(),c=g.join(" "),u=`${Be}::${U}::${a.fingerprint||"default"}::${c}`,h=C.get(u);if(h!==void 0)return X(u,h),h;let P=await Ee(u,o);if(P!==null)return X(u,P),P;let D=s.defaultConfig||s.config,O=a.config||{},y=fe(D,O),{safelist:I,includePreflight:z,minify:L,tokenCSS:Q}=y;if(y.unknownRoles.length>0&&!ke.has(i))ke.add(i),console.warn(`${e.yellow}[ts-css]${e.reset} No stx role for ${y.unknownRoles.join(", ")} - these keep the stock value. Role names: semanticTokenNames() in @stacksjs/stx/theme-tokens.`);let A=y.config,R=new s.CSSGenerator(A),T=A.shortcuts||O.shortcuts||{},F=Object.keys(T).filter((p)=>r.has(p)||I.includes(p));for(let p of I)if(!T[p])R.generate(p);for(let p of g)if(!T[p])R.generate(p);let w="";if(F.length>0){let p=new s.CSSGenerator(A);for(let G of F)p.generate(G);if(w=p.toCSS(!1,L),w&&!w.endsWith(`
|
|
8
8
|
`))w+=`
|
|
9
|
-
`}let b=w+R.toCSS(z,L);return b=ge(s.CSSGenerator,y)+Q+b,X(u,b),
|
|
9
|
+
`}let b=w+R.toCSS(z,L);return b=ge(s.CSSGenerator,y)+Q+b,X(u,b),Pe(u,b,o),b}catch(s){return console.warn("Failed to generate Css CSS:",s),""}}async function S(n,t,s=!1,r=!1,i=0){let o=await wg(n,t);if(!o)return r?Pn(n):n;let a=i>0&&Buffer.byteLength(o)<=i,g=s&&!a?he(o):void 0,c=g?`<link data-css="generated" rel="stylesheet" href="/_stx/css.${g}.css">`:`<style data-css="generated">
|
|
10
10
|
${o}
|
|
11
11
|
</style>`;if(r)return Me(n,c);let u=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g;if(u.test(n)){let h=!1;return n.replace(u,()=>{if(h)return"";return h=!0,c})}if(n.includes("</head>"))return f(n,c);if(n.includes("<body"))return n.replace(/<body([^>]*)>/,`<body$1>
|
|
12
|
-
${c}`);return c+n}function Me(n,t){let s=
|
|
12
|
+
${c}`);return c+n}function Me(n,t){let s=Wi(n).map((c)=>({...c,replacement:""})),r=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g,i=r.exec(n);if(i!==null){let c=!0;while(i!==null)s.push({start:i.index,end:i.index+i[0].length,replacement:c?t:""}),c=!1,i=r.exec(n)}else{let c=N(n);if(c!==-1)s.push({start:c,end:c,replacement:`${t}
|
|
13
13
|
`});else{let u=n.match(/<body([^>]*)>/);if(u?.index!==void 0)s.push({start:u.index,end:u.index+u[0].length,replacement:`${u[0]}
|
|
14
14
|
${t}`});else s.push({start:0,end:0,replacement:t})}}s.sort((c,u)=>c.start-u.start||c.end-u.end);for(let c=1;c<s.length;c++)if(s[c].start<s[c-1].end)return _e(Pn(n),t);let o=Array(s.length*2+1),a=0,g=0;for(let c of s)o[g++]=n.slice(a,c.start),o[g++]=c.replacement,a=c.end;return o[g]=n.slice(a),o.join("")}function _e(n,t){let s=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g;if(s.test(n)){let r=!1;return n.replace(s,()=>{if(r)return"";return r=!0,t})}if(n.includes("</head>"))return f(n,t);if(n.includes("<body"))return n.replace(/<body([^>]*)>/,`<body$1>
|
|
15
15
|
${t}`);return t+n}
|
|
16
|
-
export{Ot,ct,
|
|
16
|
+
export{Ot,ct,Ae,_n,Ve,kr,_r,lt,e,mg,Fc,gy,zc,hg,yg,Cn,Cr,my,bg,wg,hy,S};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
export{
|
|
2
|
+
import{pl,s,Ee}from"./chunk-xdprx6tx.js";import{mt}from"./chunk-xmy75h5v.js";import{l}from"./chunk-ygtz9kc7.js";import o from"fs";import u from"path";var Eg=new Map,m=new Map;async function _y(e){let n;for(let i=0;i<3;i++)try{let g=(await o.promises.stat(e)).mtime.getTime(),a=m.get(e);if(a&&a.mtime===g)return a.content;let h=await Bun.file(e).text(),w=(await o.promises.stat(e)).mtime.getTime();if(w!==g)continue;return m.set(e,{content:h,mtime:w}),h}catch(r){n=r;break}throw m.delete(e),Error(`File not found: ${e}${n?` (${n.message})`:""}`)}function Cy(e){m.delete(e)}function Ey(e){for(let t of m.keys())if(t.startsWith(e))m.delete(t)}var f=null,B=null,x=null;function Ty(e){x=e}async function Tg(e=!1){let t=x??await import("./chunk-jenk04c8.js");if(e)return t.generateSignalsRuntimeDev();if(f===null)f=t.generateSignalsRuntime();return f}var S=null;async function $g(){if(S===null){let{getRouterScript:e}=await import("./chunk-msvphygp.js");S=e()}return S}var y={};async function $y(e,t=!1){let n=e==="runtime"?await Tg(t):await $g(),i=e==="runtime"&&t?"runtime-debug":e,r=y[i];if(!r||r.content!==n)r={content:n,hash:Bun.hash(n).toString(16).padStart(16,"0").slice(0,16)},y[i]=r;return{content:n,hash:r.hash,url:`/_stx/${e}.${r.hash}.js`}}var E=500,T=33554432,c=new Map,p=0;function C(e){return l(process.cwd(),"module-bundles",`${e}.js`)}function Ry(e){let t=Bun.hash(e).toString(16).padStart(16,"0").slice(0,16),n=c.get(t),i=n!==void 0;if(i)c.delete(t),p-=n.length*2;c.set(t,e),p+=e.length*2;while(c.size>1&&(c.size>E||p>T)){let r=c.keys().next().value;p-=c.get(r).length*2,c.delete(r)}if(!i)try{let r=C(t);if(!o.existsSync(r))o.mkdirSync(u.dirname(r),{recursive:!0}),o.writeFileSync(r,e)}catch{}return`/_stx/modules.${t}.js`}function ki(e){if(!/^[0-9a-f]{16}$/.test(e))return;let t=c.get(e);if(t!==void 0)return t;try{return o.readFileSync(C(e),"utf8")}catch{return}}function Ay(){m.clear(),Ee(),pl(),f=null,B=null,S=null}function v(e){let t={debug:e.debug===!0,middleware:(e.middleware??[]).map((n)=>({name:n.name,timing:n.timing,handler:String(n.handler)})),customDirectives:(e.customDirectives??[]).map((n)=>({name:n.name,hasEndTag:n.hasEndTag===!0,rawParams:n.rawParams===!0,handler:String(n.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(t)).digest("hex")}async function Ar(e,t){try{if(!t.cachePath)return null;let n=u.resolve(t.cachePath),i=u.join(n,`${zs(e)}.html`),r=u.join(n,`${zs(e)}.meta.json`);if(!await s(i)||!await s(r))return null;let g=await Bun.file(r).text(),a=JSON.parse(g);if(a.cacheVersion!==t.cacheVersion)return null;if(a.engine!==mt())return null;if(a.optionsSignature!==v(t))return null;if((await o.promises.stat(e)).mtime.getTime()>a.mtime)return null;for(let d of a.dependencies)if(await s(d)){if((await o.promises.stat(d)).mtime.getTime()>a.mtime)return null}else return null;return await Bun.file(i).text()}catch(n){return console.warn(`Cache error for ${e}:`,n),null}}async function Pr(e,t,n,i){try{if(!i.cachePath)return;let r=u.resolve(i.cachePath);await o.promises.mkdir(r,{recursive:!0});let g=u.join(r,`${zs(e)}.html`),a=u.join(r,`${zs(e)}.meta.json`),h=await o.promises.stat(e);await Bun.write(g,t);let d={sourcePath:e,mtime:h.mtime.getTime(),dependencies:Array.from(n),cacheVersion:i.cacheVersion,engine:mt(),optionsSignature:v(i),generatedAt:Date.now()};await Bun.write(a,JSON.stringify(d,null,2)),Eg.set(e,{output:t,mtime:h.mtime.getTime(),dependencies:n})}catch(r){console.warn(`Failed to cache template ${e}:`,r)}}var _=16;function zs(e){return new Bun.CryptoHasher("sha1").update(e).digest("hex").substring(0,_)}
|
|
3
|
+
export{Eg,_y,Cy,Ey,Ty,Tg,$g,$y,Ry,ki,Ay,Ar,Pr,zs};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{B,
|
|
2
|
+
import{B,wl,uo,On,b,Xe,Ge}from"./chunk-xdprx6tx.js";import{Ir,ft,K}from"./chunk-w27j0apm.js";import{Sr,i}from"./chunk-hx6tr46s.js";import{Ie}from"./chunk-nkgqhb7s.js";import{fa}from"./chunk-ws25jw6x.js";function y(s){return s.endsWith(".md")||s.endsWith(".markdown")}function C(s){let e=[];m(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let r=[...e];m(/<code\b[^>]*>[\s\S]*?<\/code>/gi,r);function m(n,p){let g;while((g=n.exec(s))!==null){let t=g.index,o=t+g[0].length;if(p?.some((l)=>t>=l.start&&o<=l.end))continue;e.push({start:t,end:o})}}if(e.length===0)return s;e.sort((n,p)=>n.start-p.start);let c="",a=0;for(let n of e){if(n.start<a)continue;c+=s.slice(a,n.start),c+=`@raw${s.slice(n.start,n.end)}@endraw`,a=n.end}return c+=s.slice(a),c}async function h(s,e={}){let{data:r,content:m}=Ir(s),a=await(e.renderer??((n)=>ft(n)))(m);return{html:C(a),frontmatter:r??{}}}import{dirname as k,resolve as R}from"path";function v(s){let e=s,r=B(s);if(r)e=r.content.trim();let m=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,c=[],a=[],n=[],p=(o)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(o),g;while((g=m.exec(s))!==null){let o=g[1],l=g[2],d=g[0],u=o.includes("server");if(p(l))n.push(d);else if(u)a.push(l);else c.push(d)}let t=e;{let o=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,l,d=[];while((l=o.exec(t))!==null){let u=l.index+l[0].length,f=t.indexOf("</script>",u);if(f===-1)continue;d.push({start:l.index,end:f+9}),o.lastIndex=f+9}for(let u=d.length-1;u>=0;u--)t=t.substring(0,d[u].start)+t.substring(d[u].end)}for(let o of c)t=t.replace(o,"");return{templateContent:t,serverScripts:a,clientScripts:c,signalsScripts:n}}function M(s,e){return`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="UTF-8">
|
|
@@ -9,8 +9,8 @@ import{B,yl,lo,On,b,Xe,Ge}from"./chunk-vb609vbj.js";import{Ir,ft,q}from"./chunk-
|
|
|
9
9
|
<body>
|
|
10
10
|
${s}
|
|
11
11
|
</body>
|
|
12
|
-
</html>`}async function
|
|
12
|
+
</html>`}async function $c(s,e={}){let r=R(s),m=Bun.file(r);if(!await m.exists())throw Error(`Template file not found: ${r}`);let c=await m.text(),a=null;if(y(r)){let n=await h(c,{renderer:e.markdownRenderer});c=n.html,a=n.frontmatter}if(a)e={...e,context:{...a,...e.context||{}}};if(e.layout){let n=R(e.layout),p=Bun.file(n);if(!await p.exists())throw Error(`Layout template not found: ${n}`);let{layout:g,injectCSS:t,...o}=e,l={...e.context||{}};On(l);let d=await w(c,r,{...o,context:{...l,__stx_defer_server_data:!0},injectCSS:!1}),u=await p.text(),f={...l,content:d},x={...o,context:f,injectCSS:t};return w(u,n,x)}return w(c,r,e)}async function w(s,e,r={}){let{templateContent:m,serverScripts:c,clientScripts:a}=v(s),n={...K,...r.options},p={__filename:e,__dirname:k(e),__stx:{},__stx_options:n,__stx_sfc_mode:!0,__stx_inject_css:r.injectCSS===!0,__stxServeContext:void 0,...uo(r.context??{}),definePageMeta:()=>{},...r.context||{}};for(let o of c)await b(o,p,e);let g=new Set,t=m;if(t=await i(t,p,e,n,g),wl(p,r.context),r.templateOnly){if(t=t.replace(/<script data-stx-scoped>[\s\S]*?<\/script>\s*/gi,""),t=t.replace(/<!-- stx SEO Tags -->[\s\S]*?(?=<)/i,""),a.length>0)t+=`
|
|
13
13
|
${a.join(`
|
|
14
14
|
`)}`}else{if(r.processClientScripts!==!1&&a.length>0){let o=p.__stx_event_bindings||[],l=Xe(p),d=await Promise.all(a.map(async(x)=>{let _=x.match(/<script\b([^>]*)>/i)?.[1]||"";if(/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(_))return x;let S=x.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!S)return x;return await Ge(S[1],{eventBindings:o,templateContent:t,serverData:l,filePath:e})})),f=[await Sr(d,{...n,buildMode:"compile"}),...d].filter(Boolean).join(`
|
|
15
|
-
`);t=
|
|
16
|
-
export{
|
|
15
|
+
`);t=fa(t,f)}t=await Ie(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=M(t,r.title)}if(r.injectCSS)try{let{injectCss:o}=await import("./chunk-8g6cmgn8.js");t=await o(t)}catch{}return t}
|
|
16
|
+
export{$c};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
`)}async function
|
|
2
|
+
import{Y,W,ns,rs,ss}from"./chunk-hakevnm1.js";import{resolve as Q,basename as G,extname as J,join as K}from"path";import{mkdir as Z}from"fs/promises";var U={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0};class ya{config;constructor(t={}){this.config={...U,...t}}async get(t,e){return ns(t,e,"video",this.config)}async set(t,e,a){return rs(t,e,a,"video",this.config)}async clear(){return ss("video",this.config)}updateConfig(t){this.config={...this.config,...t}}}var V=null;function T(t){if(!V)V=new ya(t);else if(t)V.updateConfig(t);return V}async function ba(t,e,a){let c=a?{directory:`${a.outputDir}/../.cache`}:{};return T(c).get(t,e)}async function wa(t,e,a,c){let r=c?{directory:`${c.outputDir}/../.cache`}:{};return T(r).set(t,e,a)}async function _m(){return T().clear()}import{resolve as B,basename as _,extname as D,join as v}from"path";import{mkdir as A}from"fs/promises";async function M(){try{return await import("ts-videos")}catch{return null}}async function va(t,e,a,c){let r=await M();if(!r)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let n=B(t);if(!await W(n))return null;await A(a,{recursive:!0});let i=await Y(n),s=_(t,D(t)),o=e.format||"webp",h=e.timestamp||0,y=`${s}-poster-${i}.${o}`,u=v(a,y),m=await r.extractThumbnails(n,{timestamps:[h],width:e.width||1280,height:e.height,format:o,quality:e.quality||85,outputDir:a,outputPattern:y.replace(`.${o}`,"")});if(m&&m.length>0){let d=m[0];return{path:u,url:`${c}/${y}`,width:d.width||e.width||1280,height:d.height||720,timestamp:h,size:d.size||0}}return null}catch(n){return console.warn(`[stx-media] Failed to generate poster: ${n}`),null}}async function xa(t,e,a,c){let r=await M();if(!r)return[];try{let n=B(t);if(!await W(n))return[];await A(a,{recursive:!0});let i=await Y(n),s=_(t,D(t)),o=e.format||"webp",u=(await new r.Input(n).getInfo()).duration||60,m=e.count||10,d=e.interval||u/m,g=[];for(let f=0;f<m&&f*d<u;f++)g.push(f*d);let l=await r.extractThumbnails(n,{timestamps:g,width:e.width||320,format:o,quality:e.quality||80,outputDir:a,outputPattern:`${s}-thumb-${i}`});if(l&&l.length>0)return l.map((f,b)=>({path:f.path||v(a,`${s}-thumb-${i}-${b}.${o}`),url:`${c}/${s}-thumb-${i}-${b}.${o}`,width:f.width||e.width||320,height:f.height||180,timestamp:g[b],size:f.size||0}));return[]}catch(n){return console.warn(`[stx-media] Failed to generate thumbnails: ${n}`),[]}}async function Cm(t,e,a,c){let r=await M();if(!r)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let n=B(t);if(!await W(n))return null;await A(a,{recursive:!0});let i=await Y(n),s=_(t,D(t)),y=(await new r.Input(n).getInfo()).duration||60,u=e.columns||10,m=e.interval||5,d=e.thumbnailWidth||160,g=e.thumbnailHeight||90,l=e.format||"jpeg",f=Math.ceil(y/m),b=Math.ceil(f/u),S=`${s}-sprite-${i}.${l}`,w=v(a,S),C=[];for(let P=0;P<f;P++)C.push(P*m);let p=await r.extractThumbnails(n,{timestamps:C,width:d,height:g,format:l,quality:e.quality||70,outputDir:v(a,".temp")});if(!p||p.length===0)return null;try{let P=await import("ts-images"),x=u*d,ie=b*g,re=await P.createSprite({images:p.map((O)=>O.path),columns:u,padding:0,outputPath:w,format:l,quality:e.quality||70});return{url:`${c}/${S}`,path:w,columns:u,rows:b,thumbnailWidth:d,thumbnailHeight:g,interval:m,totalFrames:f}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(n){return console.warn(`[stx-media] Failed to generate sprite sheet: ${n}`),null}}import{resolve as I,basename as E,extname as F,join as R}from"path";import{mkdir as H,writeFile as q}from"fs/promises";async function z(){try{return await import("ts-videos")}catch{return null}}var j=[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000},{label:"360p",width:640,height:360,bitrate:600000,audioBitrate:64000}];async function Sa(t,e,a,c,r){let n=await z();if(!n)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let i=I(t);if(!await W(i))return null;let s=await Y(i),o=E(t,F(t)),h=R(a,`${o}-${s}-hls`);await H(h,{recursive:!0});let y=e.length>0?e:j,u=r?.segmentDuration||6,g=(await new n.Input(i).getInfo()).duration||0,l=[],f=0;for(let w of y){let C=R(h,w.label);await H(C,{recursive:!0});let p=`${w.label}.m3u8`,P=R(C,p);try{let x=await n.generateHLS(i,{outputDir:C,segmentDuration:u,width:w.width,height:w.height,videoBitrate:w.bitrate,audioBitrate:w.audioBitrate,playlistName:w.label});if(x)l.push({quality:w,url:`${c}/${o}-${s}-hls/${w.label}/${p}`,path:P}),f+=x.segmentCount||Math.ceil(g/u)}catch(x){console.warn(`[stx-media] Failed to generate HLS for ${w.label}: ${x}`)}}if(l.length===0)return null;let b=R(h,"master.m3u8"),S=N(l,c,o,s);return await q(b,S),{manifestUrl:`${c}/${o}-${s}-hls/master.m3u8`,manifestPath:b,playlists:l,segmentCount:f,duration:g}}catch(i){return console.warn(`[stx-media] Failed to generate HLS manifest: ${i}`),null}}function N(t,e,a,c){let r=["#EXTM3U","#EXT-X-VERSION:3"];for(let n of t){let{quality:i}=n,s=i.bitrate+(i.audioBitrate||128000),o=`${i.width}x${i.height||Math.round(i.width*9/16)}`;r.push(`#EXT-X-STREAM-INF:BANDWIDTH=${s},RESOLUTION=${o},NAME="${i.label}"`,`${i.label}/${i.label}.m3u8`)}return r.join(`
|
|
3
|
+
`)}async function ka(t,e,a,c,r){let n=await z();if(!n)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let i=I(t);if(!await W(i))return null;let s=await Y(i),o=E(t,F(t)),h=R(a,`${o}-${s}-dash`);await H(h,{recursive:!0});let y=e.length>0?e:j,u=r?.segmentDuration||4,m=r?.minBufferTime||2,l=(await new n.Input(i).getInfo()).duration||0,f=[],b=[];for(let p of y){let P=R(h,p.label);await H(P,{recursive:!0});try{if(await n.generateDASH(i,{outputDir:P,segmentDuration:u,width:p.width,height:p.height,videoBitrate:p.bitrate,audioBitrate:p.audioBitrate})){if(f.push({bandwidth:p.bitrate,width:p.width,height:p.height||Math.round(p.width*9/16),url:`${c}/${o}-${s}-dash/${p.label}/video`}),p.audioBitrate)b.push({bandwidth:p.audioBitrate,url:`${c}/${o}-${s}-dash/${p.label}/audio`})}}catch(x){console.warn(`[stx-media] Failed to generate DASH for ${p.label}: ${x}`)}}if(f.length===0)return null;let S=R(h,"manifest.mpd"),w=X(f,b,l,u,m);await q(S,w);let C=[{type:"video",representations:f}];if(b.length>0)C.push({type:"audio",representations:b});return{manifestUrl:`${c}/${o}-${s}-dash/manifest.mpd`,manifestPath:S,adaptationSets:C,duration:l}}catch(i){return console.warn(`[stx-media] Failed to generate DASH manifest: ${i}`),null}}function X(t,e,a,c,r){let n=L(a),i=L(r),s=`<?xml version="1.0" encoding="UTF-8"?>
|
|
4
4
|
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
|
|
5
5
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
6
6
|
xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
|
|
@@ -26,4 +26,4 @@ import{G,V,ts,ns,rs}from"./chunk-sxrcac01.js";import{resolve as Q,basename as J,
|
|
|
26
26
|
</Representation>
|
|
27
27
|
`}s+=` </AdaptationSet>
|
|
28
28
|
`}return s+=` </Period>
|
|
29
|
-
</MPD>`,s}function
|
|
29
|
+
</MPD>`,s}function L(t){let e=Math.floor(t/3600),a=Math.floor(t%3600/60),c=Math.floor(t%60),r="PT";if(e>0)r+=`${e}H`;if(a>0)r+=`${a}M`;return r+=`${c}S`,r}async function k(){try{return await import("ts-videos")}catch{return null}}function ee(t){switch(t){case"very-low":return 500000;case"low":return 1e6;case"medium":return 2500000;case"high":return 5000000;case"very-high":return 1e7;case"lossless":return 0;default:return 2500000}}function te(t){switch(t){case"youtube":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};case"twitter":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"instagram-feed":return{codec:"h264",maxWidth:1080,maxHeight:1080,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"instagram-story":case"instagram-reels":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"tiktok":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"discord":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:60,bitrate:8000000,audioCodec:"aac",audioBitrate:192000};case"linkedin":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"facebook":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"web-progressive":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000,twoPass:!0};case"web-streaming":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};default:return{}}}async function uu(t){let e=await k();if(!e)return null;try{let a=Q(t),r=await new e.Input(a).getInfo();return{duration:r.duration||0,width:r.width||0,height:r.height||0,frameRate:r.frameRate||0,bitrate:r.bitrate||0,codec:r.videoCodec||"",audioCodec:r.audioCodec}}catch(a){return console.warn(`[stx-media] Failed to analyze video: ${a}`),null}}async function Em(t,e,a,c){let r=await k();if(!r)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:t,processed:!1};let n=await ba(t,e,a);if(n)return n;try{let i=Q(t);if(!await W(i))return{src:t,processed:!1,errors:[`Source file not found: ${t}`]};let s=a.outputDir||"dist/videos",o=a.baseUrl||"/videos";await Z(s,{recursive:!0});let h=await Y(i),y=G(t,J(t)),u={src:t,processed:!0,hash:h};c?.({percentage:5,stage:"analyzing"}),u.metadata=await uu(i)||void 0;let m={};if(e.quality)m.bitrate=ee(e.quality);if(e.platform)Object.assign(m,te(e.platform));if(e.transcode)Object.assign(m,e.transcode);if(Object.keys(m).length>0||e.process){c?.({percentage:10,stage:"transcoding"});let d=`${y}-${h}.mp4`,g=K(s,d);try{let l=await ae(i,g,m,r,(f)=>c?.({percentage:10+f*0.5,stage:"transcoding"}));if(l)u.transcoded={path:g,url:`${o}/${d}`,duration:l.duration,size:l.size,video:{codec:m.codec||"h264",width:l.width,height:l.height,bitrate:l.bitrate,frameRate:l.frameRate},audio:l.audioCodec?{codec:m.audioCodec||"aac",bitrate:m.audioBitrate||128000,sampleRate:m.sampleRate||48000,channels:m.channels||2}:void 0}}catch(l){u.errors=u.errors||[],u.errors.push(`Transcoding failed: ${l}`)}}if(e.generatePoster){c?.({percentage:65,stage:"generating-poster"});let d=typeof e.generatePoster==="object"?e.generatePoster:{timestamp:0},g=await va(i,d,s,o);if(g)u.poster=g}if(a.thumbnails?.enabled){c?.({percentage:70,stage:"generating-thumbnails"});let d=await xa(i,a.thumbnails,s,o);if(d.length>0)u.thumbnails=d}if(e.streaming){c?.({percentage:80,stage:"generating-manifests"});let d=typeof e.streaming==="object"?e.streaming:a.streaming||{format:"hls"};if(d.format==="hls"||d.format===void 0){let g=await Sa(i,d.qualities||a.streaming?.defaultQualities||[],s,o);if(g)u.streaming={...u.streaming,hls:g}}if(d.format==="dash"){let g=await ka(i,d.qualities||a.streaming?.defaultQualities||[],s,o);if(g)u.streaming={...u.streaming,dash:g}}}if(e.spriteSheet)c?.({percentage:90,stage:"generating-sprite-sheet"});return c?.({percentage:100,stage:"complete"}),await wa(t,e,u,a),u}catch(i){return{src:t,processed:!1,errors:[`Processing failed: ${i}`]}}}async function ae(t,e,a,c,r){try{let i=await new c.Conversion(t,e,{videoCodec:a.codec,videoBitrate:a.bitrate,width:a.maxWidth,height:a.maxHeight,frameRate:a.frameRate,audioCodec:a.audioCodec,audioBitrate:a.audioBitrate,sampleRate:a.sampleRate,channels:a.channels}).run((s)=>{r?.(s.percentage/100)});return{duration:i.duration||0,size:i.size||0,width:i.width||a.maxWidth||0,height:i.height||a.maxHeight||0,bitrate:i.bitrate||a.bitrate||0,frameRate:i.frameRate||a.frameRate||30,audioCodec:i.audioCodec}}catch(n){return console.error(`[stx-media] Transcoding failed: ${n}`),null}}export{ya,ba,wa,_m,va,xa,Cm,Sa,ka,uu,Em};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{existsSync as A,mkdtempSync as D,readdirSync as M,realpathSync as b,rmSync as k,statSync as g,writeFileSync as P}from"fs";import{constants as _,tmpdir as x}from"os";import{join as s}from"path";import t from"process";var I=/^stx-(?:.+-)?p(\d+)-\w{6}$/,v=".stx-keep",N=60000,R=["SIGINT","SIGTERM","SIGHUP"],i=new Set,y=new Set,c=!1,S=new Set;function p(e){try{k(e,{recursive:!0,force:!0})}catch{}}function C(){for(let e of i)p(e);i.clear(),f()}function E(){for(let e of i)p(e);i.clear()}function G(e){if(C(),t.listenerCount(e)===0)t.exit(128+(_.signals[e]??1))}var h=new Map(R.map((e)=>[e,()=>G(e)]));function K(){if(c)return;c=!0,t.on("exit",E);for(let[e,n]of h)try{t.on(e,n)}catch{}}function f(){if(!c)return;c=!1,t.off("exit",E);for(let[e,n]of h)t.off(e,n)}function O(e){try{return t.kill(e,0),!0}catch(n){return n.code==="EPERM"}}function L(e={}){let n=e.root??x(),r=e.isAlive??O,w=e.minAgeMs??N,T=e.now??Date.now(),a=[],u;try{u=M(n)}catch{return a}for(let l of u){let d=I.exec(l);if(!d)continue;let m=Number(d[1]);if(m===t.pid||r(m))continue;let o=s(n,l);try{if(!g(o).isDirectory())continue;if(T-g(o).mtimeMs<w)continue;if(A(s(o,v)))continue}catch{continue}p(o),a.push(o)}return a}function z(e){let n=e.replace(/^stx-/,"").replace(/-+$/,"");return n?`stx-${n}-p${t.pid}-`:`stx-p${t.pid}-`}function H(e=t.env){let n=e.STX_KEEP_TEMP?.trim().toLowerCase();return!!n&&n!=="0"&&n!=="false"}function at(e="stx",n=x()){if(!S.has(n))S.add(n),L({root:n});let r=b(D(s(n,z(e))));if(H())return W(r),console.warn(`[stx] STX_KEEP_TEMP: keeping ${r}`),r;return K(),i.add(r),r}function
|
|
3
|
-
`)}catch{}if(y.add(e),i.delete(e),i.size===0)f()}async function
|
|
4
|
-
export{at,
|
|
2
|
+
import{existsSync as A,mkdtempSync as D,readdirSync as M,realpathSync as b,rmSync as k,statSync as g,writeFileSync as P}from"fs";import{constants as _,tmpdir as x}from"os";import{join as s}from"path";import t from"process";var I=/^stx-(?:.+-)?p(\d+)-\w{6}$/,v=".stx-keep",N=60000,R=["SIGINT","SIGTERM","SIGHUP"],i=new Set,y=new Set,c=!1,S=new Set;function p(e){try{k(e,{recursive:!0,force:!0})}catch{}}function C(){for(let e of i)p(e);i.clear(),f()}function E(){for(let e of i)p(e);i.clear()}function G(e){if(C(),t.listenerCount(e)===0)t.exit(128+(_.signals[e]??1))}var h=new Map(R.map((e)=>[e,()=>G(e)]));function K(){if(c)return;c=!0,t.on("exit",E);for(let[e,n]of h)try{t.on(e,n)}catch{}}function f(){if(!c)return;c=!1,t.off("exit",E);for(let[e,n]of h)t.off(e,n)}function O(e){try{return t.kill(e,0),!0}catch(n){return n.code==="EPERM"}}function L(e={}){let n=e.root??x(),r=e.isAlive??O,w=e.minAgeMs??N,T=e.now??Date.now(),a=[],u;try{u=M(n)}catch{return a}for(let l of u){let d=I.exec(l);if(!d)continue;let m=Number(d[1]);if(m===t.pid||r(m))continue;let o=s(n,l);try{if(!g(o).isDirectory())continue;if(T-g(o).mtimeMs<w)continue;if(A(s(o,v)))continue}catch{continue}p(o),a.push(o)}return a}function z(e){let n=e.replace(/^stx-/,"").replace(/-+$/,"");return n?`stx-${n}-p${t.pid}-`:`stx-p${t.pid}-`}function H(e=t.env){let n=e.STX_KEEP_TEMP?.trim().toLowerCase();return!!n&&n!=="0"&&n!=="false"}function at(e="stx",n=x()){if(!S.has(n))S.add(n),L({root:n});let r=b(D(s(n,z(e))));if(H())return W(r),console.warn(`[stx] STX_KEEP_TEMP: keeping ${r}`),r;return K(),i.add(r),r}function ge(e){if(y.has(e))return;if(p(e),i.delete(e),i.size===0)f()}function W(e){try{P(s(e,v),`kept by pid ${t.pid}
|
|
3
|
+
`)}catch{}if(y.add(e),i.delete(e),i.size===0)f()}async function Rc(e,n){let r=at(e);try{return await n(r)}finally{ge(r)}}
|
|
4
|
+
export{at,ge,Rc};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{d,h,Ml,p,n,u}from"./chunk-vf7tpgqz.js";import{pt,Mt,Tn,vi}from"./chunk-p0xqm2ne.js";function L(w,e){try{let g=w.trim();if(h(g))return p(g,Object.keys(e))(...Object.values(e));else return d(g,e)}catch{return!1}}function Q(w,e,g){let t=w,v=!0;while(v){v=!1;let a=t.match(/@switch\s*\(/);if(!a||a.index===void 0)break;let b=a.index,s=vi(t,b);if(!s)break;try{let o;if(h(s.expression))o=p(s.expression,Object.keys(e))(...Object.values(e));else o=d(s.expression,e);let r="",c=!1;for(let i of s.cases)if(i.type==="default"){if(!c)r=i.content.trim()}else try{let y;if(i.value&&h(i.value))y=p(i.value,Object.keys(e))(...Object.values(e));else if(i.value)y=d(i.value,e);if(o===y){r=i.content.trim(),c=!0;break}}catch{continue}t=t.substring(0,b)+r+t.substring(s.end),v=!0}catch(o){let r=o instanceof Error?o.message:String(o),c=u("Switch",`Error evaluating @switch expression: ${r}`,n.EVALUATION_ERROR);t=t.substring(0,b)+c+t.substring(s.end);break}}return t}function H(w){let e=[];return{masked:w.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(t)=>(e.push(t),`\x00stx-script-${e.length-1}\x00`)),scripts:e}}function J(w,e){if(e.length===0)return w;return w.replace(/\u0000stx-script-(\d+)\u0000/g,(g,t)=>e[Number(t)]??g)}function ge(w,e,g){let{masked:t,scripts:v}=H(w);return J(K(t,e,g),v)}function K(w,e,g){let t=w;t=Q(t,e,g);{let a=!0;while(a){a=!1;let b=t.match(/@unless\s*\(/);if(!b||b.index===void 0)break;let s=b.index,o=pt(t,s+7);if(!o)break;let r=o.endPos,c=Mt(t,"unless","endunless",r);if(c===-1){console.warn(`[stx] @unless directive at position ${s} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let i=t.slice(r,c),y=o.expression,m=-1;{let x=0,k=/@(?:if|unless)\s*\(/g,f=/@(?:endif|endunless)(?![a-z])/g,E=/@else(?![a-z])/g,S=[],C;while((C=k.exec(i))!==null)S.push({pos:C.index,type:"open"});while((C=f.exec(i))!==null)S.push({pos:C.index,type:"close"});while((C=E.exec(i))!==null)S.push({pos:C.index,type:"else"});S.sort((P,R)=>P.pos-R.pos);for(let P of S)if(P.type==="open")x++;else if(P.type==="close")x--;else if(P.type==="else"&&x===0){m=P.pos;break}}let l;if(m!==-1){let x=i.slice(0,m),k=i.slice(m+5);l=`@if (${y})${k}@else ${x}@endif`}else l=`@if (!(${y}))${i}@endif`;t=t.substring(0,s)+l+t.substring(c+10),a=!0}}t=gi(t,e,g),t=mi(t,e,g),t=fi(t,e);let v=()=>{let a=Tn(t);if(a.length===0)return!1;let b=Array(a.length);for(let r=a.length-1;r>=0;r--){let c=a[r];try{let i="",y=!1;for(let m of c.branches){if(y)break;if(m.type==="else")i=m.content,y=!0;else try{if(m.condition?Ml(m.condition,e):!1)i=m.content,y=!0}catch(l){i=u(m.type==="if"?"If":"Elseif",`Error in @${m.type}(${m.condition}): ${l instanceof Error?l.message:String(l)}`,n.EVALUATION_ERROR),y=!0}}b[r]=i}catch(i){let y=i instanceof Error?i.message:String(i);b[r]=u("If",`Error processing @if block: ${y}`,n.EVALUATION_ERROR)}}let s=Array(a.length*2+1),o=0;for(let r=0;r<a.length;r++){let c=a[r];s[r*2]=t.slice(o,c.start),s[r*2+1]=b[r],o=c.end}return s[a.length*2]=t.slice(o),t=s.join(""),!0};while(!0){let a=t;if(!v())break;if(t===a)break}return t}function q(w){let e=0;while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!=="(")return null;e++;while(e<w.length&&/\s/.test(w[e]))e++;let g=w[e];if(g!=="'"&&g!=='"')return null;e++;let t=[];while(e<w.length){let v=w[e];if(v==="\\"&&e+1<w.length){t.push(w[e+1]),e+=2;continue}if(v===g){e++;break}t.push(v),e++}while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!==")")return null;return e++,{value:t.join(""),consumed:e}}function fi(w,e){let g=w;function t(s,o,r,c){let i=1,y=c,m=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),l=new RegExp(`@${r}(?![a-z])`,"g");while(y<s.length&&i>0){m.lastIndex=y,l.lastIndex=y;let x=m.exec(s),k=l.exec(s),f=x?x.index:1/0,E=k?k.index:1/0;if(f<E)i++,y=f+x[0].length;else if(E<1/0){if(i--,i===0)return E;y=E+k[0].length}else break}return-1}function v(s,o,r){let c=0,i=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),y=new RegExp(`@${r}(?![a-z])`,"g"),m=/@else(?![a-z])/g,l=[],x;while((x=i.exec(s))!==null)l.push({pos:x.index,type:"open"});while((x=y.exec(s))!==null)l.push({pos:x.index,type:"close"});while((x=m.exec(s))!==null)l.push({pos:x.index,type:"else"});l.sort((k,f)=>k.pos-f.pos);for(let k of l)if(k.type==="open")c++;else if(k.type==="close")c--;else if(k.type==="else"&&c===0)return k.pos;return-1}{let s=!0;while(s){s=!1;let o=g.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,c,i,y=g.slice(r+5),m=q(y);if(m)c=m.value,i=r+5+m.consumed;else i=r+5;let l=t(g,"auth","endauth",i);if(l===-1){console.warn(`[stx] @auth directive at position ${r} has no matching @endauth \u2014 the block was skipped.`);break}let x=g.slice(i,l),k=v(x,"auth","endauth"),f;if(!e.auth)f=!1;else f=c?L(`auth?.check && auth?.user?.[${c}]`,e):L("auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=f?S:C}else E=f?x:"";g=g.substring(0,r)+E+g.substring(l+8),s=!0}}{let s=!0;while(s){s=!1;let o=g.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,c,i,y=g.slice(r+6),m=q(y);if(m)c=m.value,i=r+6+m.consumed;else i=r+6;let l=t(g,"guest","endguest",i);if(l===-1){console.warn(`[stx] @guest directive at position ${r} has no matching @endguest \u2014 the block was skipped.`);break}let x=g.slice(i,l),k=v(x,"guest","endguest"),f;if(!e.auth)f=!0;else f=c?L(`!auth?.check || !auth?.user?.[${c}]`,e):L("!auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=f?S:C}else E=f?x:"";g=g.substring(0,r)+E+g.substring(l+9),s=!0}}function a(s,o,r){if(e.userCan&&typeof e.userCan[s]==="boolean")return e.userCan[s];if(e.permissions?.check&&typeof e.permissions.check==="function")try{let c=[s];if(o)c.push(o);if(r){let i=L(r,e);c.push(i)}return e.permissions.check(...c)}catch{return!1}return!1}function b(s){let o=s.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!o)return null;return{ability:o[1],type:o[2],id:o[3]?.trim(),paramsEnd:o[0].length}}for(let s of["can","cannot"]){let o=`end${s}`,r=s==="can"?"elsecan":"elsecannot",c=!0;while(c){c=!1;let i=g.match(new RegExp(`@${s}\\s*\\(`));if(!i||i.index===void 0)break;let y=i.index,m=g.slice(y+`@${s}`.length),l=b(m);if(!l)break;let x=y+`@${s}`.length+l.paramsEnd,k=t(g,s,o,x);if(k===-1){console.warn(`[stx] @${s} directive at position ${y} has no matching @${o} \u2014 the block was skipped.`);break}let f=g.slice(x,k),E=[],S=0,C=new RegExp(`@${s}\\s*\\(`,"g"),P=new RegExp(`@${o}(?![a-z])`,"g"),R=new RegExp(`@${r}\\s*\\(`,"g"),T=/@else(?![a-z])/g,_=[],M;while((M=C.exec(f))!==null)_.push({pos:M.index,type:"open"});while((M=P.exec(f))!==null)_.push({pos:M.index,type:"close"});while((M=R.exec(f))!==null)_.push({pos:M.index,type:"elseDirective"});while((M=T.exec(f))!==null)_.push({pos:M.index,type:"else"});_.sort((A,z)=>A.pos-z.pos);for(let A of _){if(A.type==="open"){S++;continue}if(A.type==="close"){S--;continue}if(S===0)E.push(A)}let I=[],F=0;for(let A=0;A<E.length;A++){let z=E[A];if(I.push({content:f.slice(F,z.pos),ability:void 0}),z.type==="elseDirective"){let D=f.slice(z.pos+`@${r}`.length),B=b(D);if(B){I[I.length-1]={content:f.slice(F,z.pos)},F=z.pos+`@${r}`.length+B.paramsEnd,I.push({content:"",ability:B.ability,type:B.type,id:B.id}),I.pop();let G=E[A+1],U=G?G.pos:f.length;I.push({content:f.slice(F,U),ability:B.ability,type:B.type,id:B.id}),F=U}}else F=z.pos+5}if(F<f.length){let A=I[I.length-1];if(E.length>0&&E[E.length-1].type==="else")I.push({content:f.slice(F),isFinalElse:!0});else if(I.length===0)I.push({content:f.slice(F)})}let O=a(l.ability,l.type,l.id),j=s==="can"?O:!O,V="";if(j)V=I[0]?.content||"";else{let A=!1;for(let z=1;z<I.length;z++){let D=I[z];if(D.isFinalElse){V=D.content,A=!0;break}if(D.ability){let B=a(D.ability,D.type,D.id);if(s==="can"?B:!B){V=D.content,A=!0;break}}}if(!A&&I.length>0){let z=I[I.length-1];if(z.isFinalElse)V=z.content}}g=g.substring(0,y)+V+g.substring(k+`@${o}`.length),c=!0}}return g}function gi(w,e,g){let t=w;function v(a,b,s,o,r){let c=!0;while(c){c=!1;let i=new RegExp(`@${b}\\s*\\(`),y=a.match(i);if(!y||y.index===void 0)break;let m=y.index,l=pt(a,m+`@${b}`.length);if(!l)break;let x=l.endPos,k=Mt(a,b,s,x);if(k===-1){console.warn(`[stx] @${b} directive at position ${m} has no matching @${s} \u2014 the block was skipped.`);break}let f=a.slice(x,k),E=l.expression,S=-1,C=0,P=0;while(P<f.length){let R=f.indexOf("@",P);if(R===-1)break;let T=f.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(T)){C++,P=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(T)){C--,P=R+1;continue}if(C===0&&/^@else(?![a-z])/.test(T)){S=R;break}P=R+1}try{let R=o(E.trim()),T;if(S!==-1){let _=f.slice(0,S),M=f.slice(S+5);T=R?_:M}else T=R?f:"";a=a.substring(0,m)+T+a.substring(k+`@${s}`.length),c=!0}catch(R){let T=R instanceof Error?R.message:String(R),_=u(r,`Error processing @${b} directive: ${T}`,n.EVALUATION_ERROR);a=a.substring(0,m)+_+a.substring(k+`@${s}`.length);break}}return a}return t=v(t,"isset","endisset",(a)=>{let b=L(a,e);return b!==void 0&&b!==null},"Isset"),t=v(t,"empty","endempty",(a)=>{let b=L(a,e);return b===void 0||b===null||b===""||b===0||b===!1||Array.isArray(b)&&b.length===0||typeof b==="object"&&b!==null&&Object.keys(b).length===0},"Empty"),t}function mi(w,e,g){let t=w,v="development";function a(b,s,o,r){let c=new RegExp(`@${s}(?![a-z])`,"g"),i=new RegExp(`@${o}(?![a-z])`,"g"),y=new RegExp(`^@${s}(?![a-z])`),m=new RegExp(`^@${o}(?![a-z])`),l=b,x=!0;while(x){x=!1,c.lastIndex=0;let k=c.exec(l);if(!k)break;let f=k.index,E=f+k[0].length;if(s==="env"){let O=l.substring(E).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!O)break;E+=O[0].length,r=v===O[2]}let S=1,C=E,P=-1;while(S>0&&C<l.length){c.lastIndex=C,i.lastIndex=C;let O=c.exec(l),j=i.exec(l),V=O?O.index:1/0,A=j?j.index:1/0;if(V<A)S++,C=V+O[0].length;else if(A<1/0){if(S--,S===0){P=A;break}C=A+j[0].length}else break}if(P===-1){console.warn(`[stx] @${s} directive at position ${f} has no matching @${o} \u2014 the block was skipped.`);break}let R=l.substring(E,P),T=-1,_=0,M=0;while(M<R.length){let O=R.indexOf("@",M);if(O===-1)break;let j=R.substring(O);if(y.test(j)){_++,M=O+1;continue}if(m.test(j)){_--,M=O+1;continue}if(_===0&&/^@else(?![a-z])/.test(j)){T=O;break}M=O+1}let I;if(T!==-1){let O=R.slice(0,T),j=R.slice(T+5);I=r?O:j}else I=r?R:"";let F=`@${o}`.length;l=l.substring(0,f)+I+l.substring(P+F),x=!0}return l}return t=a(t,"env","endenv",!1),t=a(t,"production","endproduction",v==="production"),t=a(t,"development","enddevelopment",v==="development"),t=a(t,"staging","endstaging",v==="staging"),t=a(t,"testing","endtesting",v==="testing"),t}
|
|
3
|
-
export{
|
|
2
|
+
import{d,h,jl,p,n,u}from"./chunk-r7zvrh58.js";import{pt,Mt,Tn,Si}from"./chunk-7767n5k6.js";function L(w,e){try{let g=w.trim();if(h(g))return p(g,Object.keys(e))(...Object.values(e));else return d(g,e)}catch{return!1}}function Q(w,e,g){let t=w,v=!0;while(v){v=!1;let a=t.match(/@switch\s*\(/);if(!a||a.index===void 0)break;let b=a.index,s=Si(t,b);if(!s)break;try{let o;if(h(s.expression))o=p(s.expression,Object.keys(e))(...Object.values(e));else o=d(s.expression,e);let r="",c=!1;for(let i of s.cases)if(i.type==="default"){if(!c)r=i.content.trim()}else try{let y;if(i.value&&h(i.value))y=p(i.value,Object.keys(e))(...Object.values(e));else if(i.value)y=d(i.value,e);if(o===y){r=i.content.trim(),c=!0;break}}catch{continue}t=t.substring(0,b)+r+t.substring(s.end),v=!0}catch(o){let r=o instanceof Error?o.message:String(o),c=u("Switch",`Error evaluating @switch expression: ${r}`,n.EVALUATION_ERROR);t=t.substring(0,b)+c+t.substring(s.end);break}}return t}function H(w){let e=[];return{masked:w.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(t)=>(e.push(t),`\x00stx-script-${e.length-1}\x00`)),scripts:e}}function J(w,e){if(e.length===0)return w;return w.replace(/\u0000stx-script-(\d+)\u0000/g,(g,t)=>e[Number(t)]??g)}function me(w,e,g){let{masked:t,scripts:v}=H(w);return J(K(t,e,g),v)}function K(w,e,g){let t=w;t=Q(t,e,g);{let a=!0;while(a){a=!1;let b=t.match(/@unless\s*\(/);if(!b||b.index===void 0)break;let s=b.index,o=pt(t,s+7);if(!o)break;let r=o.endPos,c=Mt(t,"unless","endunless",r);if(c===-1){console.warn(`[stx] @unless directive at position ${s} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let i=t.slice(r,c),y=o.expression,m=-1;{let x=0,k=/@(?:if|unless)\s*\(/g,f=/@(?:endif|endunless)(?![a-z])/g,E=/@else(?![a-z])/g,S=[],C;while((C=k.exec(i))!==null)S.push({pos:C.index,type:"open"});while((C=f.exec(i))!==null)S.push({pos:C.index,type:"close"});while((C=E.exec(i))!==null)S.push({pos:C.index,type:"else"});S.sort((P,R)=>P.pos-R.pos);for(let P of S)if(P.type==="open")x++;else if(P.type==="close")x--;else if(P.type==="else"&&x===0){m=P.pos;break}}let l;if(m!==-1){let x=i.slice(0,m),k=i.slice(m+5);l=`@if (${y})${k}@else ${x}@endif`}else l=`@if (!(${y}))${i}@endif`;t=t.substring(0,s)+l+t.substring(c+10),a=!0}}t=hi(t,e,g),t=yi(t,e,g),t=mi(t,e);let v=()=>{let a=Tn(t);if(a.length===0)return!1;let b=Array(a.length);for(let r=a.length-1;r>=0;r--){let c=a[r];try{let i="",y=!1;for(let m of c.branches){if(y)break;if(m.type==="else")i=m.content,y=!0;else try{if(m.condition?jl(m.condition,e):!1)i=m.content,y=!0}catch(l){i=u(m.type==="if"?"If":"Elseif",`Error in @${m.type}(${m.condition}): ${l instanceof Error?l.message:String(l)}`,n.EVALUATION_ERROR),y=!0}}b[r]=i}catch(i){let y=i instanceof Error?i.message:String(i);b[r]=u("If",`Error processing @if block: ${y}`,n.EVALUATION_ERROR)}}let s=Array(a.length*2+1),o=0;for(let r=0;r<a.length;r++){let c=a[r];s[r*2]=t.slice(o,c.start),s[r*2+1]=b[r],o=c.end}return s[a.length*2]=t.slice(o),t=s.join(""),!0};while(!0){let a=t;if(!v())break;if(t===a)break}return t}function q(w){let e=0;while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!=="(")return null;e++;while(e<w.length&&/\s/.test(w[e]))e++;let g=w[e];if(g!=="'"&&g!=='"')return null;e++;let t=[];while(e<w.length){let v=w[e];if(v==="\\"&&e+1<w.length){t.push(w[e+1]),e+=2;continue}if(v===g){e++;break}t.push(v),e++}while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!==")")return null;return e++,{value:t.join(""),consumed:e}}function mi(w,e){let g=w;function t(s,o,r,c){let i=1,y=c,m=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),l=new RegExp(`@${r}(?![a-z])`,"g");while(y<s.length&&i>0){m.lastIndex=y,l.lastIndex=y;let x=m.exec(s),k=l.exec(s),f=x?x.index:1/0,E=k?k.index:1/0;if(f<E)i++,y=f+x[0].length;else if(E<1/0){if(i--,i===0)return E;y=E+k[0].length}else break}return-1}function v(s,o,r){let c=0,i=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),y=new RegExp(`@${r}(?![a-z])`,"g"),m=/@else(?![a-z])/g,l=[],x;while((x=i.exec(s))!==null)l.push({pos:x.index,type:"open"});while((x=y.exec(s))!==null)l.push({pos:x.index,type:"close"});while((x=m.exec(s))!==null)l.push({pos:x.index,type:"else"});l.sort((k,f)=>k.pos-f.pos);for(let k of l)if(k.type==="open")c++;else if(k.type==="close")c--;else if(k.type==="else"&&c===0)return k.pos;return-1}{let s=!0;while(s){s=!1;let o=g.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,c,i,y=g.slice(r+5),m=q(y);if(m)c=m.value,i=r+5+m.consumed;else i=r+5;let l=t(g,"auth","endauth",i);if(l===-1){console.warn(`[stx] @auth directive at position ${r} has no matching @endauth \u2014 the block was skipped.`);break}let x=g.slice(i,l),k=v(x,"auth","endauth"),f;if(!e.auth)f=!1;else f=c?L(`auth?.check && auth?.user?.[${c}]`,e):L("auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=f?S:C}else E=f?x:"";g=g.substring(0,r)+E+g.substring(l+8),s=!0}}{let s=!0;while(s){s=!1;let o=g.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,c,i,y=g.slice(r+6),m=q(y);if(m)c=m.value,i=r+6+m.consumed;else i=r+6;let l=t(g,"guest","endguest",i);if(l===-1){console.warn(`[stx] @guest directive at position ${r} has no matching @endguest \u2014 the block was skipped.`);break}let x=g.slice(i,l),k=v(x,"guest","endguest"),f;if(!e.auth)f=!0;else f=c?L(`!auth?.check || !auth?.user?.[${c}]`,e):L("!auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=f?S:C}else E=f?x:"";g=g.substring(0,r)+E+g.substring(l+9),s=!0}}function a(s,o,r){if(e.userCan&&typeof e.userCan[s]==="boolean")return e.userCan[s];if(e.permissions?.check&&typeof e.permissions.check==="function")try{let c=[s];if(o)c.push(o);if(r){let i=L(r,e);c.push(i)}return e.permissions.check(...c)}catch{return!1}return!1}function b(s){let o=s.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!o)return null;return{ability:o[1],type:o[2],id:o[3]?.trim(),paramsEnd:o[0].length}}for(let s of["can","cannot"]){let o=`end${s}`,r=s==="can"?"elsecan":"elsecannot",c=!0;while(c){c=!1;let i=g.match(new RegExp(`@${s}\\s*\\(`));if(!i||i.index===void 0)break;let y=i.index,m=g.slice(y+`@${s}`.length),l=b(m);if(!l)break;let x=y+`@${s}`.length+l.paramsEnd,k=t(g,s,o,x);if(k===-1){console.warn(`[stx] @${s} directive at position ${y} has no matching @${o} \u2014 the block was skipped.`);break}let f=g.slice(x,k),E=[],S=0,C=new RegExp(`@${s}\\s*\\(`,"g"),P=new RegExp(`@${o}(?![a-z])`,"g"),R=new RegExp(`@${r}\\s*\\(`,"g"),T=/@else(?![a-z])/g,_=[],M;while((M=C.exec(f))!==null)_.push({pos:M.index,type:"open"});while((M=P.exec(f))!==null)_.push({pos:M.index,type:"close"});while((M=R.exec(f))!==null)_.push({pos:M.index,type:"elseDirective"});while((M=T.exec(f))!==null)_.push({pos:M.index,type:"else"});_.sort((A,z)=>A.pos-z.pos);for(let A of _){if(A.type==="open"){S++;continue}if(A.type==="close"){S--;continue}if(S===0)E.push(A)}let I=[],F=0;for(let A=0;A<E.length;A++){let z=E[A];if(I.push({content:f.slice(F,z.pos),ability:void 0}),z.type==="elseDirective"){let D=f.slice(z.pos+`@${r}`.length),B=b(D);if(B){I[I.length-1]={content:f.slice(F,z.pos)},F=z.pos+`@${r}`.length+B.paramsEnd,I.push({content:"",ability:B.ability,type:B.type,id:B.id}),I.pop();let G=E[A+1],U=G?G.pos:f.length;I.push({content:f.slice(F,U),ability:B.ability,type:B.type,id:B.id}),F=U}}else F=z.pos+5}if(F<f.length){let A=I[I.length-1];if(E.length>0&&E[E.length-1].type==="else")I.push({content:f.slice(F),isFinalElse:!0});else if(I.length===0)I.push({content:f.slice(F)})}let O=a(l.ability,l.type,l.id),j=s==="can"?O:!O,V="";if(j)V=I[0]?.content||"";else{let A=!1;for(let z=1;z<I.length;z++){let D=I[z];if(D.isFinalElse){V=D.content,A=!0;break}if(D.ability){let B=a(D.ability,D.type,D.id);if(s==="can"?B:!B){V=D.content,A=!0;break}}}if(!A&&I.length>0){let z=I[I.length-1];if(z.isFinalElse)V=z.content}}g=g.substring(0,y)+V+g.substring(k+`@${o}`.length),c=!0}}return g}function hi(w,e,g){let t=w;function v(a,b,s,o,r){let c=!0;while(c){c=!1;let i=new RegExp(`@${b}\\s*\\(`),y=a.match(i);if(!y||y.index===void 0)break;let m=y.index,l=pt(a,m+`@${b}`.length);if(!l)break;let x=l.endPos,k=Mt(a,b,s,x);if(k===-1){console.warn(`[stx] @${b} directive at position ${m} has no matching @${s} \u2014 the block was skipped.`);break}let f=a.slice(x,k),E=l.expression,S=-1,C=0,P=0;while(P<f.length){let R=f.indexOf("@",P);if(R===-1)break;let T=f.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(T)){C++,P=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(T)){C--,P=R+1;continue}if(C===0&&/^@else(?![a-z])/.test(T)){S=R;break}P=R+1}try{let R=o(E.trim()),T;if(S!==-1){let _=f.slice(0,S),M=f.slice(S+5);T=R?_:M}else T=R?f:"";a=a.substring(0,m)+T+a.substring(k+`@${s}`.length),c=!0}catch(R){let T=R instanceof Error?R.message:String(R),_=u(r,`Error processing @${b} directive: ${T}`,n.EVALUATION_ERROR);a=a.substring(0,m)+_+a.substring(k+`@${s}`.length);break}}return a}return t=v(t,"isset","endisset",(a)=>{let b=L(a,e);return b!==void 0&&b!==null},"Isset"),t=v(t,"empty","endempty",(a)=>{let b=L(a,e);return b===void 0||b===null||b===""||b===0||b===!1||Array.isArray(b)&&b.length===0||typeof b==="object"&&b!==null&&Object.keys(b).length===0},"Empty"),t}function yi(w,e,g){let t=w,v="development";function a(b,s,o,r){let c=new RegExp(`@${s}(?![a-z])`,"g"),i=new RegExp(`@${o}(?![a-z])`,"g"),y=new RegExp(`^@${s}(?![a-z])`),m=new RegExp(`^@${o}(?![a-z])`),l=b,x=!0;while(x){x=!1,c.lastIndex=0;let k=c.exec(l);if(!k)break;let f=k.index,E=f+k[0].length;if(s==="env"){let O=l.substring(E).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!O)break;E+=O[0].length,r=v===O[2]}let S=1,C=E,P=-1;while(S>0&&C<l.length){c.lastIndex=C,i.lastIndex=C;let O=c.exec(l),j=i.exec(l),V=O?O.index:1/0,A=j?j.index:1/0;if(V<A)S++,C=V+O[0].length;else if(A<1/0){if(S--,S===0){P=A;break}C=A+j[0].length}else break}if(P===-1){console.warn(`[stx] @${s} directive at position ${f} has no matching @${o} \u2014 the block was skipped.`);break}let R=l.substring(E,P),T=-1,_=0,M=0;while(M<R.length){let O=R.indexOf("@",M);if(O===-1)break;let j=R.substring(O);if(y.test(j)){_++,M=O+1;continue}if(m.test(j)){_--,M=O+1;continue}if(_===0&&/^@else(?![a-z])/.test(j)){T=O;break}M=O+1}let I;if(T!==-1){let O=R.slice(0,T),j=R.slice(T+5);I=r?O:j}else I=r?R:"";let F=`@${o}`.length;l=l.substring(0,f)+I+l.substring(P+F),x=!0}return l}return t=a(t,"env","endenv",!1),t=a(t,"production","endproduction",v==="production"),t=a(t,"development","enddevelopment",v==="development"),t=a(t,"staging","endstaging",v==="staging"),t=a(t,"testing","endtesting",v==="testing"),t}
|
|
3
|
+
export{me,mi,hi,yi};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-a78k8fkg.js";import"./chunk-r7zvrh58.js";import"./chunk-4jg8ddfy.js";import"./chunk-ayrd026n.js";import"./chunk-ra35ptjg.js";import"./chunk-xdprx6tx.js";import"./chunk-875wejw1.js";import"./chunk-yfe380a4.js";import"./chunk-c3nmjx26.js";import"./chunk-sk8x8nw8.js";import{l}from"./chunk-ygtz9kc7.js";import u from"fs";import m from"path";async function d(e,t={}){let s=Date.now(),n={total:0,passed:0,failed:0,new:0,failures:[],duration:0},i=t.snapshotDir||l(e.root,"story","snapshots");await u.promises.mkdir(i,{recursive:!0});let r=e.storyFiles;if(t.filter&&t.filter.length>0)r=r.filter((a)=>t.filter.some((o)=>a.fileName.toLowerCase().includes(o.toLowerCase())));for(let a of r)await h(a,i,t,n);return n.duration=Date.now()-s,n}async function h(e,t,s,n){let i=e.story;if(!i)return;for(let r of i.variants){n.total++;let a=m.join(t,`${e.id}-${r.id}.snap`),o=g(r.source||""),f=await w(a);if(s.update||!f){let p={storyId:e.id,variantId:r.id,component:e.fileName,timestamp:Date.now(),hash:o};if(await u.promises.writeFile(a,JSON.stringify(p,null,2)),!f)n.new++;n.passed++}else try{let p=await u.promises.readFile(a,"utf-8"),c=JSON.parse(p);if(c.hash===o)n.passed++;else n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:"Snapshot mismatch",difference:y(c.hash,o)})}catch(p){n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:`Error reading snapshot: ${p}`})}}}async function x(e,t={}){return(await d(e,{...t,update:!0})).total}function g(e){let t=0;for(let s=0;s<e.length;s++){let n=e.charCodeAt(s);t=(t<<5)-t+n,t=t&t}return t.toString(16)}function y(e,t){if(e===t)return 0;let s=Math.abs(Number.parseInt(e,16)-Number.parseInt(t,16));return Math.min(s/1e6,1)}async function w(e){try{return await u.promises.access(e),!0}catch{return!1}}function F(e){let t=[];if(t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(" STX Story Visual Regression Tests"),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),e.failures.length>0){t.push(" \u274C Failures:"),t.push("");for(let s of e.failures){if(t.push(` \u2022 ${s.component} / ${s.variantId}`),t.push(` ${s.message}`),s.difference!==void 0)t.push(` Difference: ${(s.difference*100).toFixed(2)}%`);t.push("")}}if(t.push(" Summary:"),t.push(` Total: ${e.total}`),t.push(` Passed: ${e.passed} \u2713`),t.push(` Failed: ${e.failed} \u2717`),e.new>0)t.push(` New: ${e.new} \u26A1`);return t.push(` Time: ${e.duration}ms`),t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),t.join(`
|
|
3
3
|
`)}export{F as formatTestResults,d as runVisualTests,x as updateSnapshots};
|