@cntrl-site/components 1.0.106-alpha.0 → 1.0.107-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/dist/ClickGallerie-CYQMgrIr.js +36 -0
  2. package/dist/ClickGallerie-o2U6oyOF.mjs +272 -0
  3. package/dist/Components/ClickGallerie/ClickGallerie.d.ts +2 -1
  4. package/dist/Components/Helix/Helix.d.ts +4 -1
  5. package/dist/Components/Hive/Hive.d.ts +4 -1
  6. package/dist/Components/ImageRevealSlider/ImageRevealSlider.d.ts +2 -1
  7. package/dist/Components/List/List.d.ts +6 -2
  8. package/dist/Components/Marquee/Marquee.d.ts +6 -2
  9. package/dist/Components/MarqueeText/MarqueeText.d.ts +2 -1
  10. package/dist/Components/Mercury/Mercury.d.ts +4 -1
  11. package/dist/Components/Waterfall/WaterfallLightbox.d.ts +4 -1
  12. package/dist/Components/utils/EmbedMediaFrame.d.ts +27 -0
  13. package/dist/Components/utils/LinkWrapper.d.ts +16 -0
  14. package/dist/Components/utils/embedMedia.d.ts +40 -0
  15. package/dist/Components/utils/index.d.ts +6 -0
  16. package/dist/{ControlSlider-SiOt22l_.js → ControlSlider-Kkec-i14.js} +1 -1
  17. package/dist/{ControlSlider-pZv7H6BU.mjs → ControlSlider-LcZmviGX.mjs} +1 -1
  18. package/dist/EmbedMediaFrame-DsOTKE4i.js +1 -0
  19. package/dist/EmbedMediaFrame-DwHeOAy5.mjs +164 -0
  20. package/dist/{FAQ-C7823fyi.js → FAQ-BxhMo7T8.js} +1 -1
  21. package/dist/{FAQ-CZ39u4m8.mjs → FAQ-CdwSft5p.mjs} +1 -1
  22. package/dist/Grid-CFHTP3mb.js +378 -0
  23. package/dist/Grid-e-gLfsji.mjs +1590 -0
  24. package/dist/Helix-BpLo9FD3.js +43 -0
  25. package/dist/Helix-CidI3ucE.mjs +324 -0
  26. package/dist/{Hive-D6-R6TwM.mjs → Hive-BsmFHk2i.mjs} +505 -475
  27. package/dist/Hive-D1j6wZpV.js +321 -0
  28. package/dist/ImageRevealSlider-BuukTGAK.js +1 -0
  29. package/dist/{ImageRevealSlider-BdFGyVEP.mjs → ImageRevealSlider-Df9sygk9.mjs} +63 -70
  30. package/dist/{Lightbox-eP9qAZzL.mjs → Lightbox-C_fXsfdz.mjs} +1 -1
  31. package/dist/{Lightbox-CIss_nOG.js → Lightbox-DaunVrkp.js} +1 -1
  32. package/dist/LinkWrapper-Ca84iPtg.js +1 -0
  33. package/dist/LinkWrapper-DZs9hlOn.mjs +13 -0
  34. package/dist/{List-DW7fyJbf.mjs → List-Bh_-l9vD.mjs} +532 -520
  35. package/dist/List-DVvpQ24J.js +377 -0
  36. package/dist/Marquee-DByooiWP.mjs +578 -0
  37. package/dist/Marquee-DfIP-tIN.js +133 -0
  38. package/dist/{MarqueeText-Rzt2fJYt.mjs → MarqueeText-D6FNCe6P.mjs} +115 -114
  39. package/dist/MarqueeText-DsUiV6Zv.js +132 -0
  40. package/dist/Mercury-B-s2Kvuq.js +267 -0
  41. package/dist/Mercury-CCW0Es-s.mjs +1700 -0
  42. package/dist/PretextComponent-Dnbenstn.js +1 -0
  43. package/dist/{PretextComponent-j-OsRZTx.mjs → PretextComponent-OygSO3fr.mjs} +312 -269
  44. package/dist/{RichTextRenderer-B6WtTYlR.mjs → RichTextRenderer-BptwNpbJ.mjs} +10 -9
  45. package/dist/RichTextRenderer-K90Dd7pt.js +1 -0
  46. package/dist/{Slider20-Dm8BeCli.mjs → Slider20-CCzixTiN.mjs} +1 -1
  47. package/dist/{Slider20-C9o2REDl.js → Slider20-fMVeRfgx.js} +1 -1
  48. package/dist/{TestimonialGrid-CPu4qQ6B.mjs → TestimonialGrid-CbsVxSn9.mjs} +1 -1
  49. package/dist/{TestimonialGrid-D4ieiz9e.js → TestimonialGrid-CiCagfBU.js} +1 -1
  50. package/dist/{TestimonialSingle-DLdnAVF7.mjs → TestimonialSingle-BVm3Amrl.mjs} +1 -1
  51. package/dist/{TestimonialSingle-CVu15ZtV.js → TestimonialSingle-BWXynGjv.js} +1 -1
  52. package/dist/Waterfall-3kKioKh2.mjs +1432 -0
  53. package/dist/Waterfall-DII4-WV5.js +288 -0
  54. package/dist/{components-D2LyuDm-.mjs → components-BRmbflgg.mjs} +15 -15
  55. package/dist/components-nvbH4l0S.js +1 -0
  56. package/dist/content/postFieldBindings.d.ts +29 -0
  57. package/dist/elements.js +1 -1
  58. package/dist/elements.mjs +16 -16
  59. package/dist/elements.node.js +1 -1
  60. package/dist/elements.node.mjs +1 -1
  61. package/dist/index.d.ts +3 -1
  62. package/dist/index.js +1 -1
  63. package/dist/index.mjs +52 -15
  64. package/dist/sources.js +312 -212
  65. package/dist/sources.mjs +312 -212
  66. package/dist/types/SchemaV1.d.ts +53 -1
  67. package/dist/utils.js +1 -1
  68. package/dist/utils.mjs +30 -20
  69. package/package.json +1 -1
  70. package/dist/ClickGallerie-D7g093HX.js +0 -36
  71. package/dist/ClickGallerie-QSOQjSdv.mjs +0 -271
  72. package/dist/Grid-BBpdl60K.js +0 -374
  73. package/dist/Grid-DS53S_gA.mjs +0 -1576
  74. package/dist/Helix-BPn9V1sg.mjs +0 -315
  75. package/dist/Helix-DcgsCc4D.js +0 -43
  76. package/dist/Hive-n8Fz-j3o.js +0 -321
  77. package/dist/ImageRevealSlider-BBWtFjUF.js +0 -1
  78. package/dist/List-C32WImI3.js +0 -377
  79. package/dist/Marquee-DOIRRCu4.js +0 -133
  80. package/dist/Marquee-O_PDwlIb.mjs +0 -564
  81. package/dist/MarqueeText-DkaO2lQ5.js +0 -132
  82. package/dist/Mercury-C9D10TTT.mjs +0 -1702
  83. package/dist/Mercury-DynO-NxY.js +0 -267
  84. package/dist/PretextComponent-BnsS2zJ6.js +0 -1
  85. package/dist/RichTextRenderer-CIy6yI8U.js +0 -1
  86. package/dist/Waterfall-DC2WQ3GT.js +0 -287
  87. package/dist/Waterfall-Yud2VR62.mjs +0 -1404
  88. package/dist/components-B9Vdjf0w.js +0 -1
@@ -1,564 +0,0 @@
1
- import { jsxs as le, jsx as x } from "react/jsx-runtime";
2
- import { useState as J, useMemo as Z, useRef as _, useLayoutEffect as U, useEffect as be, useCallback as we } from "react";
3
- import te from "classnames";
4
- import { s as _e } from "./scalingValue-C9JH5L6O.mjs";
5
- import { u as We } from "./useScopedStyles-DhBG3557.mjs";
6
- import { o as $e, N as Me } from "./observeIntersection-B0f3L2iK.mjs";
7
- import { p as xe, r as Re, a as Ie } from "./useLazyVideos-CxXyEjRQ.mjs";
8
- function Te(e, r) {
9
- const n = r > 0 ? `${r}px` : "0px";
10
- return `
11
- .${e}-marquee-wrapper {
12
- overflow: hidden;
13
- width: 100%;
14
- height: auto;
15
- }
16
-
17
- @keyframes ${e}-marquee-left {
18
- from { -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); }
19
- to { -webkit-transform: translate3d(-${n}, 0, 0); transform: translate3d(-${n}, 0, 0); }
20
- }
21
-
22
- @keyframes ${e}-marquee-right {
23
- from { -webkit-transform: translate3d(-${n}, 0, 0); transform: translate3d(-${n}, 0, 0); }
24
- to { -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); }
25
- }
26
-
27
- .${e}-marquee-track {
28
- display: flex;
29
- flex-direction: row;
30
- width: max-content;
31
- will-change: transform;
32
- backface-visibility: hidden;
33
- -webkit-backface-visibility: hidden;
34
- flex-wrap: nowrap;
35
- -webkit-animation-timing-function: linear;
36
- animation-timing-function: linear;
37
- -webkit-animation-iteration-count: infinite;
38
- animation-iteration-count: infinite;
39
- }
40
-
41
- .${e}-marquee-track[data-direction="left"] {
42
- -webkit-animation-name: ${e}-marquee-left;
43
- animation-name: ${e}-marquee-left;
44
- }
45
-
46
- .${e}-marquee-track[data-direction="right"] {
47
- -webkit-animation-name: ${e}-marquee-right;
48
- animation-name: ${e}-marquee-right;
49
- }
50
- .${e}-marquee-row {
51
- display: flex;
52
- flex-direction: row;
53
- align-items: flex-start;
54
- }
55
- .${e}-marquee-set {
56
- flex: 0 0 auto;
57
- }
58
- .${e}-marquee-static {
59
- justify-content: center;
60
- overflow-x: auto;
61
- }
62
- .${e}-marquee-card {
63
- position: relative;
64
- flex: 0 0 auto;
65
- align-self: flex-start;
66
- }
67
- .${e}-wrapper {
68
- position: relative;
69
- width: 100%;
70
- height: 100%;
71
- order: 1;
72
- }
73
- .${e}-cover {
74
- position: absolute;
75
- width: 100%;
76
- height: 100%;
77
- top: 0;
78
- left: 0;
79
- }
80
- .${e}-elements-overlay {
81
- position: relative;
82
- inset: 0;
83
- display: flex;
84
- flex-direction: column;
85
- pointer-events: none;
86
- }
87
- .${e}-control {
88
- position: relative;
89
- z-index: 2;
90
- width: 100%;
91
- }
92
-
93
- .${e}-marquee-link {
94
- display: flex;
95
- flex-direction: column;
96
- justify-content: center;
97
- align-items: center;
98
- width: 100%;
99
- height: 100%;
100
- text-decoration: none;
101
- color: inherit;
102
- }
103
- .${e}-marquee-link-contain {
104
- width: auto;
105
- height: auto;
106
- }
107
-
108
- .${e}-control::before {
109
- content: "";
110
- position: absolute;
111
- top: 0;
112
- left: 0;
113
- width: 100%;
114
- height: 100%;
115
- min-height: 20px;
116
- pointer-events: auto;
117
- z-index: 10;
118
- }
119
-
120
- .${e}-gap-control {
121
- position: relative;
122
- z-index: 2;
123
- pointer-events: auto;
124
- height: 100%;
125
- }
126
- .${e}-image-hover-brightness img,
127
- .${e}-image-hover-brightness video {
128
- transition: filter 0.3s ease;
129
- }
130
- .${e}-image-hover-brightness:hover img,
131
- .${e}-image-hover-brightness:hover video {
132
- filter: brightness(1.25);
133
- }
134
- .${e}-image-hover-grayscale img,
135
- .${e}-image-hover-grayscale video {
136
- transition: filter 0.3s ease;
137
- }
138
- .${e}-image-hover-grayscale:hover img,
139
- .${e}-image-hover-grayscale:hover video {
140
- filter: grayscale(100%);
141
- }
142
- `;
143
- }
144
- const Ve = 30, He = 20, ue = 3, Oe = 12, Be = 32, Le = 3, ze = 250, je = 0.5, Ue = (e) => {
145
- e.style.setProperty("animation-name", "none"), e.style.setProperty("-webkit-animation-name", "none"), e.offsetHeight, e.style.removeProperty("animation-name"), e.style.removeProperty("-webkit-animation-name");
146
- }, Fe = (e, r) => Array.from({ length: r }, () => e).flat(), Ge = (e) => typeof e == "string" ? {
147
- display: e.toLowerCase() === "cover" ? "cover" : "fit",
148
- ratioValue: "16:9",
149
- reversed: !1
150
- } : {
151
- display: (typeof (e == null ? void 0 : e.display) == "string" ? e.display.toLowerCase() : "") === "cover" ? "cover" : "fit",
152
- ratioValue: (e == null ? void 0 : e.ratioValue) ?? "16:9",
153
- reversed: (e == null ? void 0 : e.reversed) ?? !1
154
- }, qe = (e) => e.reduce(
155
- (r, n) => r + (n.offsetWidth || n.getBoundingClientRect().width),
156
- 0
157
- ), Ce = (e, r) => {
158
- if (r <= 0 || e.children.length < r) return 0;
159
- const n = e.children[0], d = e.children[r - 1];
160
- if (!n || !d) return 0;
161
- const p = getComputedStyle(e), u = Number.parseFloat(p.columnGap || p.gap || "0") || 0, v = d.getBoundingClientRect().right - n.getBoundingClientRect().left;
162
- if (v > 0) return v;
163
- const R = Array.from({ length: r }, (b, W) => e.children[W]), f = qe(R);
164
- return f <= 0 ? 0 : f + u * Math.max(0, r - 1);
165
- }, Xe = (e) => {
166
- const r = e.getBoundingClientRect().width;
167
- if (r > 0) return r;
168
- const n = e.offsetWidth;
169
- if (n > 0) return n;
170
- const d = qe(Array.from(e.children));
171
- if (d <= 0) return 0;
172
- const p = getComputedStyle(e), u = Number.parseFloat(p.columnGap || p.gap || "0") || 0, v = Number.parseFloat(p.paddingRight) || 0;
173
- return d + u * Math.max(0, e.children.length - 1) + v;
174
- }, De = (e, r) => {
175
- const n = r.getBoundingClientRect(), d = e.getBoundingClientRect();
176
- return d.right > n.left && d.left < n.right;
177
- }, Ke = (e, r) => {
178
- const n = e.querySelectorAll(`[data-marquee-item-index="${r}"]`);
179
- return Array.from(n).some((d) => De(d, e));
180
- }, Qe = (e) => {
181
- if (e.type === "video") return !0;
182
- if (e.type === "image") return !1;
183
- const r = e.name ?? "";
184
- return /\.(mp4|webm|ogg|mov)(\?|$)/i.test(r) ? !0 : /\.(mp4|webm|ogg|mov)(\?|$)/i.test(e.assetId ?? "");
185
- }, Ye = (e) => e ? e instanceof HTMLVideoElement ? e.readyState >= 1 : e.complete : !1, Je = ({
186
- item: e,
187
- prefix: r,
188
- imageFit: n,
189
- imageMaxWidth: d,
190
- imageMaxHeight: p,
191
- cornerRadius: u,
192
- imageHoverClass: v,
193
- isFirstSet: R,
194
- scaled: f,
195
- onFirstSetImageDone: b
196
- }) => {
197
- var S, N, O, B;
198
- const W = _(null), F = !!((S = e.image) != null && S.assetId && Qe(e.image));
199
- U(() => {
200
- R && Ye(W.current) && (b == null || b());
201
- }, [R, (N = e.image) == null ? void 0 : N.assetId, b]);
202
- const V = n.display === "cover", q = n.ratioValue ?? "1:1", G = n.reversed ?? !1, [X, C] = q.split(":").map(Number), D = (G ? C : X) / (G ? X : C), E = d / D, K = E > p ? p : E, M = E > p ? p * D : d, P = f(M), k = f(K), ee = {
203
- borderRadius: f(u)
204
- }, y = V ? {
205
- pointerEvents: "auto",
206
- display: "block",
207
- width: "100%",
208
- height: "100%",
209
- objectFit: "cover",
210
- ...ee
211
- } : {
212
- pointerEvents: "auto",
213
- display: "block",
214
- width: "auto",
215
- height: "auto",
216
- maxWidth: f(d),
217
- maxHeight: f(p),
218
- objectFit: "contain",
219
- ...ee
220
- }, I = ((O = e.image) == null ? void 0 : O.assetId) && (F ? /* @__PURE__ */ x(
221
- "video",
222
- {
223
- ref: (T) => {
224
- W.current = T;
225
- },
226
- src: e.image.assetId,
227
- style: y,
228
- muted: !0,
229
- loop: !0,
230
- playsInline: !0,
231
- preload: "none",
232
- onLoadedMetadata: R ? b : void 0,
233
- onError: R ? b : void 0
234
- }
235
- ) : /* @__PURE__ */ x(
236
- "img",
237
- {
238
- ref: (T) => {
239
- W.current = T;
240
- },
241
- src: e.image.assetId,
242
- alt: ((B = e.image) == null ? void 0 : B.name) ?? "",
243
- style: y,
244
- onLoad: R ? b : void 0,
245
- onError: R ? b : void 0
246
- }
247
- ));
248
- return /* @__PURE__ */ x(
249
- "div",
250
- {
251
- style: {
252
- display: "flex",
253
- flexDirection: "column",
254
- alignItems: "start",
255
- ...V ? { width: P } : { width: "max-content", maxWidth: f(d), minWidth: 0 }
256
- },
257
- children: /* @__PURE__ */ x(
258
- "div",
259
- {
260
- className: v,
261
- style: {
262
- display: "flex",
263
- flexDirection: "column",
264
- justifyContent: "center",
265
- alignItems: "center",
266
- flexShrink: 0,
267
- ...V ? {
268
- width: P,
269
- height: k,
270
- overflow: "hidden",
271
- ...ee
272
- } : {
273
- width: "max-content",
274
- maxWidth: f(d),
275
- height: f(p)
276
- }
277
- },
278
- children: I && e.link ? /* @__PURE__ */ x("a", { href: e.link, target: "_self", rel: "noopener noreferrer", className: te(`${r}-marquee-link`, !V && `${r}-marquee-link-contain`), children: I }) : I
279
- }
280
- )
281
- }
282
- );
283
- }, it = ({ settings: e, content: r, isEditor: n, isPreviewMode: d, isEditMode: p }) => {
284
- const { prefix: u } = We(), [v, R] = J(0), f = v > 0 ? Math.round(v) : 0, b = Z(() => Te(u, f), [u, f]), {
285
- speed: W,
286
- direction: F,
287
- pauseOnHover: V,
288
- gap: q,
289
- imageMaxWidth: G,
290
- imageMaxHeight: X,
291
- hoverEffect: C,
292
- cornerRadius: de = 0
293
- } = e, H = Z(() => Ge(e.imageFit), [e.imageFit]), D = H.display !== "cover", E = (r == null ? void 0 : r.length) ?? 0, K = !!p, M = !n || !!d, P = M && C !== "off" && C !== "randomize" ? `${u}-image-hover-${C}` : void 0, k = n ? !!d : !0, y = ((r == null ? void 0 : r.length) ?? 0) > 0 && (k || !!n), I = Math.max(0, W) * Ve, S = (t) => _e(t, n ?? !1), N = _(null), O = _(null), B = _(null), [T, fe] = J(0), re = k && V === "on", [Ee, me] = J(!1), [L, ne] = J({}), ae = _(L);
294
- ae.current = L;
295
- const ie = _(null), oe = _(0), Q = _(null), he = Z(() => (r ?? []).map((t) => {
296
- var a;
297
- return ((a = t.image) == null ? void 0 : a.assetId) ?? "";
298
- }).join("\0"), [r]), [z, pe] = J(ue), se = Z(() => {
299
- const t = r ?? [];
300
- return t.length === 0 || !(k || !!n) ? t : Fe(t, z);
301
- }, [r, k, z, n]), ge = Z(
302
- () => (r ?? []).filter((t) => {
303
- var a;
304
- return !!((a = t.image) != null && a.assetId);
305
- }).length,
306
- [r]
307
- ), ve = y ? Le : 1;
308
- U(() => {
309
- oe.current = 0, ne({}), ie.current = null, pe(ue), R(0);
310
- }, [he]), be(() => {
311
- if (!M || C !== "randomize") return;
312
- const t = N.current;
313
- if (!t) return;
314
- const a = (s) => {
315
- ne((c) => {
316
- const g = Array.from(s).filter(
317
- (h) => h in c && !Ke(t, h)
318
- );
319
- if (g.length === 0) return c;
320
- const m = { ...c };
321
- return g.forEach((h) => {
322
- delete m[h];
323
- }), m;
324
- });
325
- }, i = new IntersectionObserver((s) => {
326
- const c = /* @__PURE__ */ new Set();
327
- for (const g of s) {
328
- const m = g.target.dataset.marqueeItemIndex, h = m !== void 0 ? Number(m) : NaN;
329
- Number.isNaN(h) || c.add(h);
330
- }
331
- c.size > 0 && a(c);
332
- }, { root: t, threshold: 0 });
333
- Object.keys(L).forEach((s) => {
334
- const c = Number(s);
335
- t.querySelectorAll(`[data-marquee-item-index="${c}"]`).forEach((g) => i.observe(g));
336
- });
337
- const l = { current: 0 }, o = () => {
338
- const s = Object.keys(ae.current);
339
- s.length !== 0 && (a(s.map(Number)), l.current = requestAnimationFrame(o));
340
- };
341
- return Object.keys(ae.current).length > 0 && (l.current = requestAnimationFrame(o)), () => {
342
- cancelAnimationFrame(l.current), i.disconnect();
343
- };
344
- }, [C, L, M]), be(() => {
345
- const t = N.current;
346
- if (!t || typeof IntersectionObserver > "u") return;
347
- let a = !1, i = !1, l;
348
- const o = () => {
349
- const m = t.querySelectorAll("video");
350
- if (!a) {
351
- m.forEach(xe);
352
- return;
353
- }
354
- const h = t.getBoundingClientRect(), A = h.width * je;
355
- m.forEach((w) => {
356
- const Y = w.getBoundingClientRect(), j = Y.right > h.left && Y.left < h.right;
357
- Y.right > h.left - A && Y.left < h.right + A ? Re(w, "auto") : D && Re(w, "metadata"), i && j ? w.paused && Ie(w) : xe(w);
358
- });
359
- }, s = () => {
360
- a && l === void 0 ? l = setInterval(o, ze) : !a && l !== void 0 && (clearInterval(l), l = void 0), o();
361
- }, c = $e(t, Me, (m) => {
362
- a = m, s();
363
- }), g = $e(t, "0px", (m) => {
364
- i = m, s();
365
- });
366
- return () => {
367
- c(), g(), clearInterval(l);
368
- };
369
- }, [y, D]), U(() => {
370
- if (!y) return;
371
- const t = N.current, a = B.current;
372
- if (!t || !a) return;
373
- const i = { current: 0 }, l = () => {
374
- const c = t.getBoundingClientRect().width || t.offsetWidth, g = Xe(a), m = ie.current, h = typeof m == "number" && Math.abs(m - g) <= 0.25;
375
- ie.current = g;
376
- let A = z, w = 0;
377
- if ((k || n) && E > 0 && c > 0) {
378
- const $ = Ce(a, E);
379
- if ($ >= Be) {
380
- w = $;
381
- const ce = Math.min(
382
- Oe,
383
- Math.max(
384
- ue,
385
- Math.ceil(c / $) + 1
386
- )
387
- );
388
- A = ce, ce !== z && pe(ce);
389
- }
390
- }
391
- const j = A !== z && w > 0 ? w * A : g > 0 ? g : w > 0 ? w * A : (() => {
392
- const $ = Ce(a, E);
393
- return $ > 0 ? $ * A : 0;
394
- })();
395
- j > 0 ? R(($) => $ <= 0 ? j : !h || Math.round($) === Math.round(j) ? $ : j) : !h && v <= 0 && (cancelAnimationFrame(i.current), i.current = requestAnimationFrame(l));
396
- }, o = () => {
397
- cancelAnimationFrame(i.current), i.current = requestAnimationFrame(l);
398
- };
399
- Q.current = o, o();
400
- const s = new ResizeObserver(o);
401
- return s.observe(t), s.observe(a), () => {
402
- Q.current = null, cancelAnimationFrame(i.current), s.disconnect();
403
- };
404
- }, [k, y, v, he, z, E, n]), U(() => {
405
- if (!y || f <= 0) return;
406
- const t = O.current;
407
- t && Ue(t);
408
- }, [y, f, F, I]), U(() => {
409
- if (!y || v <= 0) {
410
- fe(0);
411
- return;
412
- }
413
- const t = O.current, a = B.current;
414
- if (!t || !a) return;
415
- const i = () => {
416
- const o = t.offsetHeight || t.getBoundingClientRect().height, s = Array.from(a.children).reduce(
417
- (g, m) => Math.max(g, m.offsetHeight || m.getBoundingClientRect().height),
418
- 0
419
- ), c = o > 0 ? o : s;
420
- fe(c > 0 ? c : 0);
421
- };
422
- i();
423
- const l = new ResizeObserver(i);
424
- return l.observe(t), l.observe(a), () => l.disconnect();
425
- }, [y, ve, se, n, q, G, X, v, H, L]), U(() => {
426
- if (!n || !K || !y || typeof window > "u") return;
427
- const t = requestAnimationFrame(() => {
428
- window.dispatchEvent(new Event("scroll"));
429
- });
430
- return () => cancelAnimationFrame(t);
431
- }, [n, K, y, F, v, T, q, se]);
432
- const ke = () => {
433
- re && me(!0);
434
- }, Se = () => {
435
- re && me(!1);
436
- }, Ne = we(() => {
437
- var t;
438
- oe.current = Math.min(
439
- ge,
440
- oe.current + 1
441
- ), (t = Q.current) == null || t.call(Q);
442
- }, [ge]), Ae = we((t, a) => {
443
- ne((i) => {
444
- const l = i[t] ?? a, o = (r ?? []).filter((c) => c !== l);
445
- if (o.length === 0) return i;
446
- const s = o[Math.floor(Math.random() * o.length)];
447
- return { ...i, [t]: s };
448
- });
449
- }, [r]), ye = (t, a, i, l) => {
450
- const o = M && C === "randomize" && H.display === "cover" ? L[i] ?? t : t, s = `max(${S(q)}, ${He}px)`, c = `calc(-0.5 * (${s} + ${S(q)}))`;
451
- return /* @__PURE__ */ le(
452
- "div",
453
- {
454
- className: `${u}-marquee-card`,
455
- "data-marquee-item-index": i,
456
- onMouseEnter: M && C === "randomize" && H.display === "cover" ? () => Ae(i, t) : void 0,
457
- children: [
458
- /* @__PURE__ */ x(
459
- Je,
460
- {
461
- item: o,
462
- prefix: u,
463
- imageFit: H,
464
- imageMaxWidth: G,
465
- imageMaxHeight: X,
466
- cornerRadius: de,
467
- imageHoverClass: P,
468
- isEditor: n,
469
- isFirstSet: l,
470
- scaled: S,
471
- onFirstSetImageDone: Ne
472
- }
473
- ),
474
- K && /* @__PURE__ */ x(
475
- "div",
476
- {
477
- "data-controls": "gap",
478
- "data-controls-axis": "x",
479
- className: `${u}-gap-control`,
480
- style: {
481
- position: "absolute",
482
- top: 0,
483
- right: c,
484
- width: s,
485
- height: "100%"
486
- }
487
- }
488
- )
489
- ]
490
- },
491
- `${a}-${i}`
492
- );
493
- };
494
- if (y) {
495
- const t = k ? re && Ee ? "paused" : "running" : "paused", a = f > 0 && I > 0 ? f / I * 1e3 : 0, i = `${Math.max(0, a) / 1e3}s`;
496
- return /* @__PURE__ */ le(
497
- "div",
498
- {
499
- ref: N,
500
- className: te(`${u}-wrapper`, `${u}-marquee-wrapper`),
501
- "aria-label": "Marquee",
502
- style: T > 0 ? { height: T } : void 0,
503
- children: [
504
- /* @__PURE__ */ x("style", { dangerouslySetInnerHTML: { __html: b } }),
505
- /* @__PURE__ */ x(
506
- "div",
507
- {
508
- ref: O,
509
- className: `${u}-marquee-track`,
510
- "data-direction": F,
511
- onMouseEnter: ke,
512
- onMouseLeave: Se,
513
- style: {
514
- WebkitAnimationDuration: i,
515
- animationDuration: i,
516
- WebkitAnimationPlayState: t,
517
- animationPlayState: t
518
- },
519
- children: Array.from({ length: ve }, (l, o) => /* @__PURE__ */ x(
520
- "div",
521
- {
522
- ref: o === 0 ? B : void 0,
523
- className: te(`${u}-marquee-row`, `${u}-marquee-set`),
524
- style: {
525
- gap: S(q),
526
- paddingRight: S(q)
527
- },
528
- "aria-hidden": o > 0,
529
- children: se.map(
530
- (s, c) => ye(
531
- s,
532
- o,
533
- c,
534
- o === 0 && c < E
535
- )
536
- )
537
- },
538
- `set-${o}`
539
- ))
540
- }
541
- )
542
- ]
543
- }
544
- );
545
- }
546
- return /* @__PURE__ */ le("div", { ref: N, className: `${u}-wrapper`, children: [
547
- /* @__PURE__ */ x("style", { dangerouslySetInnerHTML: { __html: b } }),
548
- /* @__PURE__ */ x(
549
- "div",
550
- {
551
- className: te(`${u}-marquee-row`, `${u}-marquee-static`),
552
- style: { gap: S(q), transform: "none" },
553
- "aria-label": "Marquee",
554
- children: r == null ? void 0 : r.map(
555
- (t, a) => ye(t, 0, a)
556
- )
557
- },
558
- "marquee-static"
559
- )
560
- ] });
561
- };
562
- export {
563
- it as Marquee
564
- };