@cntrl-site/components 1.0.101 → 1.0.102
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/README.md +25 -1
- package/dist/Burger-C6jI6C1c.js +661 -0
- package/dist/Burger-EMSn7TPB.mjs +1807 -0
- package/dist/ClickGallerie-D_O1XhAO.mjs +270 -0
- package/dist/ClickGallerie-M9xdGR1G.js +36 -0
- package/dist/Components/Burger/BurgerComponent.d.ts +0 -1
- package/dist/Components/ClickGallerie/ClickGallerieComponent.d.ts +0 -1
- package/dist/Components/FAQ/FAQComponent.d.ts +0 -1
- package/dist/Components/Form/FormComponent.d.ts +0 -1
- package/dist/Components/Grid/GridComponent.d.ts +0 -1
- package/dist/Components/Helix/HelixComponent.d.ts +0 -1
- package/dist/Components/Hive/HiveComponent.d.ts +0 -1
- package/dist/Components/LightboxJournal/LightboxJournalComponent.d.ts +0 -1
- package/dist/Components/LightboxStrip/LightboxStripComponent.d.ts +0 -1
- package/dist/Components/List/ListComponent.d.ts +0 -1
- package/dist/Components/Marquee/MarqueeComponent.d.ts +0 -1
- package/dist/Components/MarqueeText/MarqueeTextComponent.d.ts +0 -1
- package/dist/Components/Mercury/MercuryComponent.d.ts +0 -1
- package/dist/Components/OnelinerForm/OnelinerFormComponent.d.ts +0 -1
- package/dist/Components/Pretext/PretextComponent.d.ts +0 -1
- package/dist/Components/Scale/ScaleComponent.d.ts +0 -1
- package/dist/Components/SimpleButton/SimpleButtonComponent.d.ts +0 -1
- package/dist/Components/Slider20/Slider20Component.d.ts +0 -1
- package/dist/Components/TestimonialGrid/TestimonialGridComponent.d.ts +0 -1
- package/dist/Components/TestimonialSingle/TestimonialSingleComponent.d.ts +0 -1
- package/dist/Components/Waterfall/WaterfallComponent.d.ts +0 -1
- package/dist/ControlSlider-SiOt22l_.js +1 -0
- package/dist/ControlSlider-pZv7H6BU.mjs +334 -0
- package/dist/FAQ-C7823fyi.js +166 -0
- package/dist/FAQ-CZ39u4m8.mjs +588 -0
- package/dist/Form-BX5_41nb.mjs +472 -0
- package/dist/Form-Dn-6A1He.js +153 -0
- package/dist/Grid-CemGhf3F.js +374 -0
- package/dist/Grid-cfQsXW3b.mjs +1553 -0
- package/dist/Helix-2Vr-9WBa.js +43 -0
- package/dist/Helix-BmkAKT1G.mjs +315 -0
- package/dist/Hive-BC6zQBsv.js +321 -0
- package/dist/Hive-BGMWinrW.mjs +1425 -0
- package/dist/HiveLightboxTitles-DhEeFKWs.mjs +507 -0
- package/dist/HiveLightboxTitles-DlyptAaK.js +1 -0
- package/dist/ImageRevealSlider-BBWtFjUF.js +1 -0
- package/dist/ImageRevealSlider-BdFGyVEP.mjs +184 -0
- package/dist/Lightbox-CIss_nOG.js +1 -0
- package/dist/Lightbox-eP9qAZzL.mjs +665 -0
- package/dist/LightboxJournal-D59ex6wH.mjs +1613 -0
- package/dist/LightboxJournal-DAEZOPDi.js +523 -0
- package/dist/LightboxStrip-BDjI1jyH.js +386 -0
- package/dist/LightboxStrip-YspzBP8N.mjs +1574 -0
- package/dist/List-C32WImI3.js +377 -0
- package/dist/List-DW7fyJbf.mjs +1891 -0
- package/dist/Marquee-BYClHHws.mjs +551 -0
- package/dist/Marquee-vmHaTGIP.js +133 -0
- package/dist/MarqueeText-4Rip_sQX.mjs +515 -0
- package/dist/MarqueeText-E6OubMOG.js +132 -0
- package/dist/Mercury-BwF_XW2w.js +267 -0
- package/dist/Mercury-DuKJQ1Zo.mjs +1701 -0
- package/dist/OnelinerForm-BEu7_sho.mjs +434 -0
- package/dist/OnelinerForm-C2Y_XMCY.js +194 -0
- package/dist/Pretext-10CcyP1E.mjs +2762 -0
- package/dist/Pretext-DvQ3xsni.js +231 -0
- package/dist/PretextComponent-C3YFICy8.js +1 -0
- package/dist/PretextComponent-Ct0newmn.mjs +11624 -0
- package/dist/RichTextRenderer-B6WtTYlR.mjs +32 -0
- package/dist/RichTextRenderer-CIy6yI8U.js +1 -0
- package/dist/Scale-976sjO8e.js +111 -0
- package/dist/Scale-rLNT4KAk.mjs +345 -0
- package/dist/SimpleButton-C-o2W9bS.mjs +451 -0
- package/dist/SimpleButton-nGEcO2gB.js +243 -0
- package/dist/Slider20-C9o2REDl.js +272 -0
- package/dist/Slider20-Dm8BeCli.mjs +851 -0
- package/dist/SvgImage-B5mR9y6q.mjs +51 -0
- package/dist/SvgImage-DFlmxAoL.js +1 -0
- package/dist/TestimonialGrid-CPu4qQ6B.mjs +492 -0
- package/dist/TestimonialGrid-D4ieiz9e.js +90 -0
- package/dist/TestimonialSingle-CVu15ZtV.js +125 -0
- package/dist/TestimonialSingle-DLdnAVF7.mjs +391 -0
- package/dist/Waterfall-A0FjM2my.mjs +1400 -0
- package/dist/Waterfall-DnPDHbCL.js +287 -0
- package/dist/buildColorVars-CE2D5cQV.js +1 -0
- package/dist/buildColorVars-CLyWQm5K.mjs +21 -0
- package/dist/components-OE3ac1dr.js +1 -0
- package/dist/components-w-jHX-2U.mjs +2053 -0
- package/dist/components.css +1 -1
- package/dist/elements.d.ts +7 -0
- package/dist/elements.js +1 -0
- package/dist/elements.mjs +63 -0
- package/dist/elements.node.d.ts +6 -0
- package/dist/elements.node.js +1 -0
- package/dist/elements.node.mjs +21 -0
- package/dist/forking.d.ts +1 -0
- package/dist/formFieldValidation-DZl2KVaF.js +1 -0
- package/dist/formFieldValidation-DvihFrq5.mjs +21 -0
- package/dist/getColorAlpha-BVBY0N5x.mjs +39 -0
- package/dist/getColorAlpha-CoSseoCn.js +1 -0
- package/dist/getImageRect-BQhQXvT8.js +1 -0
- package/dist/getImageRect-CBMhFNHM.mjs +109 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -28862
- package/dist/index.mjs +16 -62473
- package/dist/loadSvgMaskUrl-DfF7ay6h.js +1 -0
- package/dist/loadSvgMaskUrl-xHgGYgPe.mjs +20 -0
- package/dist/panelAvailability-D179wwJx.mjs +27 -0
- package/dist/panelAvailability-DnOe0rQ4.js +1 -0
- package/dist/react-splide.esm-CabaEmHi.js +6 -0
- package/dist/react-splide.esm-DQqds4PL.mjs +1750 -0
- package/dist/readTestimonialTextMeasure-BIXpGFEt.mjs +13 -0
- package/dist/readTestimonialTextMeasure-CEPaB4Sy.js +1 -0
- package/dist/scalingValue-C9JH5L6O.mjs +6 -0
- package/dist/scalingValue-CSHYgTZl.js +1 -0
- package/dist/sources.d.ts +1 -0
- package/dist/sources.js +23753 -0
- package/dist/sources.mjs +23779 -0
- package/dist/textStylesToCss-05Mn6I_2.mjs +32 -0
- package/dist/textStylesToCss-CNN3zZTV.js +1 -0
- package/dist/types/Component.d.ts +0 -1
- package/dist/useLightboxScrollLock-Hf16Eq4g.js +1 -0
- package/dist/useLightboxScrollLock-VQ07s7EJ.mjs +18 -0
- package/dist/useLightboxSwipeDismiss-Br9uE5G0.js +1 -0
- package/dist/useLightboxSwipeDismiss-SGv6Ra33.mjs +95 -0
- package/dist/useScopedStyles-Bf6yohVQ.js +1 -0
- package/dist/useScopedStyles-DhBG3557.mjs +11 -0
- package/dist/utils-033j3qNL.js +1 -0
- package/dist/utils-FxC9rcxw.mjs +247 -0
- package/dist/utils.js +1 -1
- package/dist/utils.mjs +17 -11
- package/package.json +31 -2
- package/dist/index-2JTNRDR1.js +0 -1
- package/dist/index-DA8t6EZ4.mjs +0 -255
- package/dist/panelAvailability-CgSic84c.mjs +0 -126
- package/dist/panelAvailability-D8c7cdbu.js +0 -1
|
@@ -0,0 +1,551 @@
|
|
|
1
|
+
import { jsxs as ce, jsx as y } from "react/jsx-runtime";
|
|
2
|
+
import { useState as Y, useMemo as D, useRef as N, useLayoutEffect as V, useEffect as ve, useCallback as ye } from "react";
|
|
3
|
+
import P from "classnames";
|
|
4
|
+
import { s as ke } from "./scalingValue-C9JH5L6O.mjs";
|
|
5
|
+
import { u as Se } from "./useScopedStyles-DhBG3557.mjs";
|
|
6
|
+
function Ee(e, r) {
|
|
7
|
+
const n = r > 0 ? `${r}px` : "0px";
|
|
8
|
+
return `
|
|
9
|
+
.${e}-marquee-wrapper {
|
|
10
|
+
overflow: hidden;
|
|
11
|
+
width: 100%;
|
|
12
|
+
height: auto;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@keyframes ${e}-marquee-left {
|
|
16
|
+
from { -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); }
|
|
17
|
+
to { -webkit-transform: translate3d(-${n}, 0, 0); transform: translate3d(-${n}, 0, 0); }
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@keyframes ${e}-marquee-right {
|
|
21
|
+
from { -webkit-transform: translate3d(-${n}, 0, 0); transform: translate3d(-${n}, 0, 0); }
|
|
22
|
+
to { -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); }
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.${e}-marquee-track {
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-direction: row;
|
|
28
|
+
width: max-content;
|
|
29
|
+
will-change: transform;
|
|
30
|
+
backface-visibility: hidden;
|
|
31
|
+
-webkit-backface-visibility: hidden;
|
|
32
|
+
flex-wrap: nowrap;
|
|
33
|
+
-webkit-animation-timing-function: linear;
|
|
34
|
+
animation-timing-function: linear;
|
|
35
|
+
-webkit-animation-iteration-count: infinite;
|
|
36
|
+
animation-iteration-count: infinite;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.${e}-marquee-track[data-direction="left"] {
|
|
40
|
+
-webkit-animation-name: ${e}-marquee-left;
|
|
41
|
+
animation-name: ${e}-marquee-left;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.${e}-marquee-track[data-direction="right"] {
|
|
45
|
+
-webkit-animation-name: ${e}-marquee-right;
|
|
46
|
+
animation-name: ${e}-marquee-right;
|
|
47
|
+
}
|
|
48
|
+
.${e}-marquee-row {
|
|
49
|
+
display: flex;
|
|
50
|
+
flex-direction: row;
|
|
51
|
+
align-items: flex-start;
|
|
52
|
+
}
|
|
53
|
+
.${e}-marquee-set {
|
|
54
|
+
flex: 0 0 auto;
|
|
55
|
+
}
|
|
56
|
+
.${e}-marquee-static {
|
|
57
|
+
justify-content: center;
|
|
58
|
+
overflow-x: auto;
|
|
59
|
+
}
|
|
60
|
+
.${e}-marquee-card {
|
|
61
|
+
position: relative;
|
|
62
|
+
flex: 0 0 auto;
|
|
63
|
+
align-self: flex-start;
|
|
64
|
+
}
|
|
65
|
+
.${e}-wrapper {
|
|
66
|
+
position: relative;
|
|
67
|
+
width: 100%;
|
|
68
|
+
height: 100%;
|
|
69
|
+
order: 1;
|
|
70
|
+
}
|
|
71
|
+
.${e}-cover {
|
|
72
|
+
position: absolute;
|
|
73
|
+
width: 100%;
|
|
74
|
+
height: 100%;
|
|
75
|
+
top: 0;
|
|
76
|
+
left: 0;
|
|
77
|
+
}
|
|
78
|
+
.${e}-elements-overlay {
|
|
79
|
+
position: relative;
|
|
80
|
+
inset: 0;
|
|
81
|
+
display: flex;
|
|
82
|
+
flex-direction: column;
|
|
83
|
+
pointer-events: none;
|
|
84
|
+
}
|
|
85
|
+
.${e}-control {
|
|
86
|
+
position: relative;
|
|
87
|
+
z-index: 2;
|
|
88
|
+
width: 100%;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.${e}-marquee-link {
|
|
92
|
+
display: flex;
|
|
93
|
+
flex-direction: column;
|
|
94
|
+
justify-content: center;
|
|
95
|
+
align-items: center;
|
|
96
|
+
width: 100%;
|
|
97
|
+
height: 100%;
|
|
98
|
+
text-decoration: none;
|
|
99
|
+
color: inherit;
|
|
100
|
+
}
|
|
101
|
+
.${e}-marquee-link-contain {
|
|
102
|
+
width: auto;
|
|
103
|
+
height: auto;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.${e}-control::before {
|
|
107
|
+
content: "";
|
|
108
|
+
position: absolute;
|
|
109
|
+
top: 0;
|
|
110
|
+
left: 0;
|
|
111
|
+
width: 100%;
|
|
112
|
+
height: 100%;
|
|
113
|
+
min-height: 20px;
|
|
114
|
+
pointer-events: auto;
|
|
115
|
+
z-index: 10;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.${e}-gap-control {
|
|
119
|
+
position: relative;
|
|
120
|
+
z-index: 2;
|
|
121
|
+
pointer-events: auto;
|
|
122
|
+
height: 100%;
|
|
123
|
+
}
|
|
124
|
+
.${e}-image-hover-brightness img,
|
|
125
|
+
.${e}-image-hover-brightness video {
|
|
126
|
+
transition: filter 0.3s ease;
|
|
127
|
+
}
|
|
128
|
+
.${e}-image-hover-brightness:hover img,
|
|
129
|
+
.${e}-image-hover-brightness:hover video {
|
|
130
|
+
filter: brightness(1.25);
|
|
131
|
+
}
|
|
132
|
+
.${e}-image-hover-grayscale img,
|
|
133
|
+
.${e}-image-hover-grayscale video {
|
|
134
|
+
transition: filter 0.3s ease;
|
|
135
|
+
}
|
|
136
|
+
.${e}-image-hover-grayscale:hover img,
|
|
137
|
+
.${e}-image-hover-grayscale:hover video {
|
|
138
|
+
filter: grayscale(100%);
|
|
139
|
+
}
|
|
140
|
+
`;
|
|
141
|
+
}
|
|
142
|
+
const Ne = 30, Ae = 20, le = 3, We = 12, Me = 32, _e = 3, Te = (e) => {
|
|
143
|
+
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");
|
|
144
|
+
}, He = (e, r) => Array.from({ length: r }, () => e).flat(), Be = (e) => typeof e == "string" ? {
|
|
145
|
+
display: e.toLowerCase() === "cover" ? "cover" : "fit",
|
|
146
|
+
ratioValue: "16:9",
|
|
147
|
+
reversed: !1
|
|
148
|
+
} : {
|
|
149
|
+
display: (typeof (e == null ? void 0 : e.display) == "string" ? e.display.toLowerCase() : "") === "cover" ? "cover" : "fit",
|
|
150
|
+
ratioValue: (e == null ? void 0 : e.ratioValue) ?? "16:9",
|
|
151
|
+
reversed: (e == null ? void 0 : e.reversed) ?? !1
|
|
152
|
+
}, $e = (e) => e.reduce(
|
|
153
|
+
(r, n) => r + (n.offsetWidth || n.getBoundingClientRect().width),
|
|
154
|
+
0
|
|
155
|
+
), be = (e, r) => {
|
|
156
|
+
if (r <= 0 || e.children.length < r) return 0;
|
|
157
|
+
const n = e.children[0], u = e.children[r - 1];
|
|
158
|
+
if (!n || !u) return 0;
|
|
159
|
+
const m = getComputedStyle(e), l = Number.parseFloat(m.columnGap || m.gap || "0") || 0, g = u.getBoundingClientRect().right - n.getBoundingClientRect().left;
|
|
160
|
+
if (g > 0) return g;
|
|
161
|
+
const b = Array.from({ length: r }, (v, A) => e.children[A]), f = $e(b);
|
|
162
|
+
return f <= 0 ? 0 : f + l * Math.max(0, r - 1);
|
|
163
|
+
}, Ie = (e) => {
|
|
164
|
+
const r = e.getBoundingClientRect().width;
|
|
165
|
+
if (r > 0) return r;
|
|
166
|
+
const n = e.offsetWidth;
|
|
167
|
+
if (n > 0) return n;
|
|
168
|
+
const u = $e(Array.from(e.children));
|
|
169
|
+
if (u <= 0) return 0;
|
|
170
|
+
const m = getComputedStyle(e), l = Number.parseFloat(m.columnGap || m.gap || "0") || 0, g = Number.parseFloat(m.paddingRight) || 0;
|
|
171
|
+
return u + l * Math.max(0, e.children.length - 1) + g;
|
|
172
|
+
}, Oe = (e, r) => {
|
|
173
|
+
const n = r.getBoundingClientRect(), u = e.getBoundingClientRect();
|
|
174
|
+
return u.right > n.left && u.left < n.right;
|
|
175
|
+
}, Le = (e, r) => {
|
|
176
|
+
const n = e.querySelectorAll(`[data-marquee-item-index="${r}"]`);
|
|
177
|
+
return Array.from(n).some((u) => Oe(u, e));
|
|
178
|
+
}, ze = (e) => {
|
|
179
|
+
if (e.type === "video") return !0;
|
|
180
|
+
if (e.type === "image") return !1;
|
|
181
|
+
const r = e.name ?? "";
|
|
182
|
+
return /\.(mp4|webm|ogg|mov)(\?|$)/i.test(r) ? !0 : /\.(mp4|webm|ogg|mov)(\?|$)/i.test(e.assetId ?? "");
|
|
183
|
+
}, Ve = (e) => e ? e instanceof HTMLVideoElement ? e.readyState >= 2 : e.complete : !1, je = ({
|
|
184
|
+
item: e,
|
|
185
|
+
prefix: r,
|
|
186
|
+
imageFit: n,
|
|
187
|
+
imageMaxWidth: u,
|
|
188
|
+
imageMaxHeight: m,
|
|
189
|
+
cornerRadius: l,
|
|
190
|
+
imageHoverClass: g,
|
|
191
|
+
isFirstSet: b,
|
|
192
|
+
scaled: f,
|
|
193
|
+
onFirstSetImageDone: v
|
|
194
|
+
}) => {
|
|
195
|
+
var E, B, I, O;
|
|
196
|
+
const A = N(null), j = !!((E = e.image) != null && E.assetId && ze(e.image));
|
|
197
|
+
V(() => {
|
|
198
|
+
b && Ve(A.current) && (v == null || v());
|
|
199
|
+
}, [b, (B = e.image) == null ? void 0 : B.assetId, v]);
|
|
200
|
+
const T = n.display === "cover", k = n.ratioValue ?? "1:1", U = n.reversed ?? !1, [F, x] = k.split(":").map(Number), S = (U ? x : F) / (U ? F : x), W = u / S, M = W > m ? m : W, ee = W > m ? m * S : u, C = f(ee), de = f(M), h = {
|
|
201
|
+
borderRadius: f(l)
|
|
202
|
+
}, H = T ? {
|
|
203
|
+
pointerEvents: "auto",
|
|
204
|
+
display: "block",
|
|
205
|
+
width: "100%",
|
|
206
|
+
height: "100%",
|
|
207
|
+
objectFit: "cover",
|
|
208
|
+
...h
|
|
209
|
+
} : {
|
|
210
|
+
pointerEvents: "auto",
|
|
211
|
+
display: "block",
|
|
212
|
+
width: "auto",
|
|
213
|
+
height: "auto",
|
|
214
|
+
maxWidth: f(u),
|
|
215
|
+
maxHeight: f(m),
|
|
216
|
+
objectFit: "contain",
|
|
217
|
+
...h
|
|
218
|
+
}, q = ((I = e.image) == null ? void 0 : I.assetId) && (j ? /* @__PURE__ */ y(
|
|
219
|
+
"video",
|
|
220
|
+
{
|
|
221
|
+
ref: (L) => {
|
|
222
|
+
A.current = L;
|
|
223
|
+
},
|
|
224
|
+
src: e.image.assetId,
|
|
225
|
+
style: H,
|
|
226
|
+
muted: !0,
|
|
227
|
+
loop: !0,
|
|
228
|
+
autoPlay: !0,
|
|
229
|
+
playsInline: !0,
|
|
230
|
+
preload: "auto",
|
|
231
|
+
onLoadedData: b ? v : void 0,
|
|
232
|
+
onError: b ? v : void 0
|
|
233
|
+
}
|
|
234
|
+
) : /* @__PURE__ */ y(
|
|
235
|
+
"img",
|
|
236
|
+
{
|
|
237
|
+
ref: (L) => {
|
|
238
|
+
A.current = L;
|
|
239
|
+
},
|
|
240
|
+
src: e.image.assetId,
|
|
241
|
+
alt: ((O = e.image) == null ? void 0 : O.name) ?? "",
|
|
242
|
+
style: H,
|
|
243
|
+
onLoad: b ? v : void 0,
|
|
244
|
+
onError: b ? v : void 0
|
|
245
|
+
}
|
|
246
|
+
));
|
|
247
|
+
return /* @__PURE__ */ y(
|
|
248
|
+
"div",
|
|
249
|
+
{
|
|
250
|
+
style: {
|
|
251
|
+
display: "flex",
|
|
252
|
+
flexDirection: "column",
|
|
253
|
+
alignItems: "start",
|
|
254
|
+
...T ? { width: C } : { width: "max-content", maxWidth: f(u), minWidth: 0 }
|
|
255
|
+
},
|
|
256
|
+
children: /* @__PURE__ */ y(
|
|
257
|
+
"div",
|
|
258
|
+
{
|
|
259
|
+
className: g,
|
|
260
|
+
style: {
|
|
261
|
+
display: "flex",
|
|
262
|
+
flexDirection: "column",
|
|
263
|
+
justifyContent: "center",
|
|
264
|
+
alignItems: "center",
|
|
265
|
+
flexShrink: 0,
|
|
266
|
+
...T ? {
|
|
267
|
+
width: C,
|
|
268
|
+
height: de,
|
|
269
|
+
overflow: "hidden",
|
|
270
|
+
...h
|
|
271
|
+
} : {
|
|
272
|
+
width: "max-content",
|
|
273
|
+
maxWidth: f(u),
|
|
274
|
+
height: f(m)
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
children: q && e.link ? /* @__PURE__ */ y("a", { href: e.link, target: "_self", rel: "noopener noreferrer", className: P(`${r}-marquee-link`, !T && `${r}-marquee-link-contain`), children: q }) : q
|
|
278
|
+
}
|
|
279
|
+
)
|
|
280
|
+
}
|
|
281
|
+
);
|
|
282
|
+
}, Ye = ({ settings: e, content: r, isEditor: n, isPreviewMode: u, isEditMode: m }) => {
|
|
283
|
+
const { prefix: l } = Se(), [g, b] = Y(0), f = g > 0 ? Math.round(g) : 0, v = D(() => Ee(l, f), [l, f]), {
|
|
284
|
+
speed: A,
|
|
285
|
+
direction: j,
|
|
286
|
+
pauseOnHover: T,
|
|
287
|
+
gap: k,
|
|
288
|
+
imageMaxWidth: U,
|
|
289
|
+
imageMaxHeight: F,
|
|
290
|
+
hoverEffect: x,
|
|
291
|
+
cornerRadius: ue = 0
|
|
292
|
+
} = e, X = D(() => Be(e.imageFit), [e.imageFit]), S = (r == null ? void 0 : r.length) ?? 0, W = !!m, M = !n || !!u, ee = M && x !== "off" && x !== "randomize" ? `${l}-image-hover-${x}` : void 0, C = n ? !!u : !0, h = ((r == null ? void 0 : r.length) ?? 0) > 0 && (C || !!n), H = Math.max(0, A) * Ne, q = (t) => ke(t, n ?? !1), E = N(null), B = N(null), I = N(null), [O, L] = Y(0), te = C && T === "on", [we, fe] = Y(!1), [_, re] = Y({}), ne = N(_);
|
|
293
|
+
ne.current = _;
|
|
294
|
+
const oe = N(null), ae = N(0), G = N(null), me = D(() => (r ?? []).map((t) => {
|
|
295
|
+
var o;
|
|
296
|
+
return ((o = t.image) == null ? void 0 : o.assetId) ?? "";
|
|
297
|
+
}).join("\0"), [r]), [z, he] = Y(le), J = D(() => {
|
|
298
|
+
const t = r ?? [];
|
|
299
|
+
return t.length === 0 || !(C || !!n) ? t : He(t, z);
|
|
300
|
+
}, [r, C, z, n]), ge = D(
|
|
301
|
+
() => (r ?? []).filter((t) => {
|
|
302
|
+
var o;
|
|
303
|
+
return !!((o = t.image) != null && o.assetId);
|
|
304
|
+
}).length,
|
|
305
|
+
[r]
|
|
306
|
+
), ie = h ? _e : 1;
|
|
307
|
+
V(() => {
|
|
308
|
+
ae.current = 0, re({}), oe.current = null, he(le), b(0);
|
|
309
|
+
}, [me]), ve(() => {
|
|
310
|
+
if (!M || x !== "randomize") return;
|
|
311
|
+
const t = E.current;
|
|
312
|
+
if (!t) return;
|
|
313
|
+
const o = (i) => {
|
|
314
|
+
re((c) => {
|
|
315
|
+
const p = Array.from(i).filter(
|
|
316
|
+
(R) => R in c && !Le(t, R)
|
|
317
|
+
);
|
|
318
|
+
if (p.length === 0) return c;
|
|
319
|
+
const $ = { ...c };
|
|
320
|
+
return p.forEach((R) => {
|
|
321
|
+
delete $[R];
|
|
322
|
+
}), $;
|
|
323
|
+
});
|
|
324
|
+
}, a = new IntersectionObserver((i) => {
|
|
325
|
+
const c = /* @__PURE__ */ new Set();
|
|
326
|
+
for (const p of i) {
|
|
327
|
+
const $ = p.target.dataset.marqueeItemIndex, R = $ !== void 0 ? Number($) : NaN;
|
|
328
|
+
Number.isNaN(R) || c.add(R);
|
|
329
|
+
}
|
|
330
|
+
c.size > 0 && o(c);
|
|
331
|
+
}, { root: t, threshold: 0 });
|
|
332
|
+
Object.keys(_).forEach((i) => {
|
|
333
|
+
const c = Number(i);
|
|
334
|
+
t.querySelectorAll(`[data-marquee-item-index="${c}"]`).forEach((p) => a.observe(p));
|
|
335
|
+
});
|
|
336
|
+
const d = { current: 0 }, s = () => {
|
|
337
|
+
const i = Object.keys(ne.current);
|
|
338
|
+
i.length !== 0 && (o(i.map(Number)), d.current = requestAnimationFrame(s));
|
|
339
|
+
};
|
|
340
|
+
return Object.keys(ne.current).length > 0 && (d.current = requestAnimationFrame(s)), () => {
|
|
341
|
+
cancelAnimationFrame(d.current), a.disconnect();
|
|
342
|
+
};
|
|
343
|
+
}, [x, _, M]), ve(() => {
|
|
344
|
+
const t = E.current;
|
|
345
|
+
if (!t || typeof IntersectionObserver > "u") return;
|
|
346
|
+
const o = t.querySelectorAll("video");
|
|
347
|
+
if (o.length === 0) return;
|
|
348
|
+
const a = new IntersectionObserver((d) => {
|
|
349
|
+
for (const s of d) {
|
|
350
|
+
const i = s.target;
|
|
351
|
+
s.isIntersecting ? i.paused && i.play().catch(() => {
|
|
352
|
+
}) : i.paused || i.pause();
|
|
353
|
+
}
|
|
354
|
+
}, { threshold: 0 });
|
|
355
|
+
return o.forEach((d) => a.observe(d)), () => a.disconnect();
|
|
356
|
+
}, [h, J, ie, _]), V(() => {
|
|
357
|
+
if (!h) return;
|
|
358
|
+
const t = E.current, o = I.current;
|
|
359
|
+
if (!t || !o) return;
|
|
360
|
+
const a = { current: 0 }, d = () => {
|
|
361
|
+
const c = t.getBoundingClientRect().width || t.offsetWidth, p = Ie(o), $ = oe.current, R = typeof $ == "number" && Math.abs($ - p) <= 0.25;
|
|
362
|
+
oe.current = p;
|
|
363
|
+
let K = z, Q = 0;
|
|
364
|
+
if ((C || n) && S > 0 && c > 0) {
|
|
365
|
+
const w = be(o, S);
|
|
366
|
+
if (w >= Me) {
|
|
367
|
+
Q = w;
|
|
368
|
+
const se = Math.min(
|
|
369
|
+
We,
|
|
370
|
+
Math.max(
|
|
371
|
+
le,
|
|
372
|
+
Math.ceil(c / w) + 1
|
|
373
|
+
)
|
|
374
|
+
);
|
|
375
|
+
K = se, se !== z && he(se);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
const Z = K !== z && Q > 0 ? Q * K : p > 0 ? p : Q > 0 ? Q * K : (() => {
|
|
379
|
+
const w = be(o, S);
|
|
380
|
+
return w > 0 ? w * K : 0;
|
|
381
|
+
})();
|
|
382
|
+
Z > 0 ? b((w) => w <= 0 ? Z : !R || Math.round(w) === Math.round(Z) ? w : Z) : !R && g <= 0 && (cancelAnimationFrame(a.current), a.current = requestAnimationFrame(d));
|
|
383
|
+
}, s = () => {
|
|
384
|
+
cancelAnimationFrame(a.current), a.current = requestAnimationFrame(d);
|
|
385
|
+
};
|
|
386
|
+
G.current = s, s();
|
|
387
|
+
const i = new ResizeObserver(s);
|
|
388
|
+
return i.observe(t), i.observe(o), () => {
|
|
389
|
+
G.current = null, cancelAnimationFrame(a.current), i.disconnect();
|
|
390
|
+
};
|
|
391
|
+
}, [C, h, g, me, z, S, n]), V(() => {
|
|
392
|
+
if (!h || f <= 0) return;
|
|
393
|
+
const t = B.current;
|
|
394
|
+
t && Te(t);
|
|
395
|
+
}, [h, f, j, H]), V(() => {
|
|
396
|
+
if (!h || g <= 0) {
|
|
397
|
+
L(0);
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
const t = B.current, o = I.current;
|
|
401
|
+
if (!t || !o) return;
|
|
402
|
+
const a = () => {
|
|
403
|
+
const s = t.offsetHeight || t.getBoundingClientRect().height, i = Array.from(o.children).reduce(
|
|
404
|
+
(p, $) => Math.max(p, $.offsetHeight || $.getBoundingClientRect().height),
|
|
405
|
+
0
|
|
406
|
+
), c = s > 0 ? s : i;
|
|
407
|
+
L(c > 0 ? c : 0);
|
|
408
|
+
};
|
|
409
|
+
a();
|
|
410
|
+
const d = new ResizeObserver(a);
|
|
411
|
+
return d.observe(t), d.observe(o), () => d.disconnect();
|
|
412
|
+
}, [h, ie, J, n, k, U, F, g, X, _]), V(() => {
|
|
413
|
+
if (!n || !W || !h || typeof window > "u") return;
|
|
414
|
+
const t = requestAnimationFrame(() => {
|
|
415
|
+
window.dispatchEvent(new Event("scroll"));
|
|
416
|
+
});
|
|
417
|
+
return () => cancelAnimationFrame(t);
|
|
418
|
+
}, [n, W, h, j, g, O, k, J]);
|
|
419
|
+
const xe = () => {
|
|
420
|
+
te && fe(!0);
|
|
421
|
+
}, Ce = () => {
|
|
422
|
+
te && fe(!1);
|
|
423
|
+
}, qe = ye(() => {
|
|
424
|
+
var t;
|
|
425
|
+
ae.current = Math.min(
|
|
426
|
+
ge,
|
|
427
|
+
ae.current + 1
|
|
428
|
+
), (t = G.current) == null || t.call(G);
|
|
429
|
+
}, [ge]), Re = ye((t, o) => {
|
|
430
|
+
re((a) => {
|
|
431
|
+
const d = a[t] ?? o, s = (r ?? []).filter((c) => c !== d);
|
|
432
|
+
if (s.length === 0) return a;
|
|
433
|
+
const i = s[Math.floor(Math.random() * s.length)];
|
|
434
|
+
return { ...a, [t]: i };
|
|
435
|
+
});
|
|
436
|
+
}, [r]), pe = (t, o, a, d) => {
|
|
437
|
+
const s = M && x === "randomize" && X.display === "cover" ? _[a] ?? t : t, i = `max(${q(k)}, ${Ae}px)`, c = `calc(-0.5 * (${i} + ${q(k)}))`;
|
|
438
|
+
return /* @__PURE__ */ ce(
|
|
439
|
+
"div",
|
|
440
|
+
{
|
|
441
|
+
className: `${l}-marquee-card`,
|
|
442
|
+
"data-marquee-item-index": a,
|
|
443
|
+
onMouseEnter: M && x === "randomize" && X.display === "cover" ? () => Re(a, t) : void 0,
|
|
444
|
+
children: [
|
|
445
|
+
/* @__PURE__ */ y(
|
|
446
|
+
je,
|
|
447
|
+
{
|
|
448
|
+
item: s,
|
|
449
|
+
prefix: l,
|
|
450
|
+
imageFit: X,
|
|
451
|
+
imageMaxWidth: U,
|
|
452
|
+
imageMaxHeight: F,
|
|
453
|
+
cornerRadius: ue,
|
|
454
|
+
imageHoverClass: ee,
|
|
455
|
+
isEditor: n,
|
|
456
|
+
isFirstSet: d,
|
|
457
|
+
scaled: q,
|
|
458
|
+
onFirstSetImageDone: qe
|
|
459
|
+
}
|
|
460
|
+
),
|
|
461
|
+
W && /* @__PURE__ */ y(
|
|
462
|
+
"div",
|
|
463
|
+
{
|
|
464
|
+
"data-controls": "gap",
|
|
465
|
+
"data-controls-axis": "x",
|
|
466
|
+
className: `${l}-gap-control`,
|
|
467
|
+
style: {
|
|
468
|
+
position: "absolute",
|
|
469
|
+
top: 0,
|
|
470
|
+
right: c,
|
|
471
|
+
width: i,
|
|
472
|
+
height: "100%"
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
)
|
|
476
|
+
]
|
|
477
|
+
},
|
|
478
|
+
`${o}-${a}`
|
|
479
|
+
);
|
|
480
|
+
};
|
|
481
|
+
if (h) {
|
|
482
|
+
const t = C ? te && we ? "paused" : "running" : "paused", o = f > 0 && H > 0 ? f / H * 1e3 : 0, a = `${Math.max(0, o) / 1e3}s`;
|
|
483
|
+
return /* @__PURE__ */ ce(
|
|
484
|
+
"div",
|
|
485
|
+
{
|
|
486
|
+
ref: E,
|
|
487
|
+
className: P(`${l}-wrapper`, `${l}-marquee-wrapper`),
|
|
488
|
+
"aria-label": "Marquee",
|
|
489
|
+
style: O > 0 ? { height: O } : void 0,
|
|
490
|
+
children: [
|
|
491
|
+
/* @__PURE__ */ y("style", { dangerouslySetInnerHTML: { __html: v } }),
|
|
492
|
+
/* @__PURE__ */ y(
|
|
493
|
+
"div",
|
|
494
|
+
{
|
|
495
|
+
ref: B,
|
|
496
|
+
className: `${l}-marquee-track`,
|
|
497
|
+
"data-direction": j,
|
|
498
|
+
onMouseEnter: xe,
|
|
499
|
+
onMouseLeave: Ce,
|
|
500
|
+
style: {
|
|
501
|
+
WebkitAnimationDuration: a,
|
|
502
|
+
animationDuration: a,
|
|
503
|
+
WebkitAnimationPlayState: t,
|
|
504
|
+
animationPlayState: t
|
|
505
|
+
},
|
|
506
|
+
children: Array.from({ length: ie }, (d, s) => /* @__PURE__ */ y(
|
|
507
|
+
"div",
|
|
508
|
+
{
|
|
509
|
+
ref: s === 0 ? I : void 0,
|
|
510
|
+
className: P(`${l}-marquee-row`, `${l}-marquee-set`),
|
|
511
|
+
style: {
|
|
512
|
+
gap: q(k),
|
|
513
|
+
paddingRight: q(k)
|
|
514
|
+
},
|
|
515
|
+
"aria-hidden": s > 0,
|
|
516
|
+
children: J.map(
|
|
517
|
+
(i, c) => pe(
|
|
518
|
+
i,
|
|
519
|
+
s,
|
|
520
|
+
c,
|
|
521
|
+
s === 0 && c < S
|
|
522
|
+
)
|
|
523
|
+
)
|
|
524
|
+
},
|
|
525
|
+
`set-${s}`
|
|
526
|
+
))
|
|
527
|
+
}
|
|
528
|
+
)
|
|
529
|
+
]
|
|
530
|
+
}
|
|
531
|
+
);
|
|
532
|
+
}
|
|
533
|
+
return /* @__PURE__ */ ce("div", { ref: E, className: `${l}-wrapper`, children: [
|
|
534
|
+
/* @__PURE__ */ y("style", { dangerouslySetInnerHTML: { __html: v } }),
|
|
535
|
+
/* @__PURE__ */ y(
|
|
536
|
+
"div",
|
|
537
|
+
{
|
|
538
|
+
className: P(`${l}-marquee-row`, `${l}-marquee-static`),
|
|
539
|
+
style: { gap: q(k), transform: "none" },
|
|
540
|
+
"aria-label": "Marquee",
|
|
541
|
+
children: r == null ? void 0 : r.map(
|
|
542
|
+
(t, o) => pe(t, 0, o)
|
|
543
|
+
)
|
|
544
|
+
},
|
|
545
|
+
"marquee-static"
|
|
546
|
+
)
|
|
547
|
+
] });
|
|
548
|
+
};
|
|
549
|
+
export {
|
|
550
|
+
Ye as Marquee
|
|
551
|
+
};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react/jsx-runtime"),o=require("react"),D=require("classnames"),xe=require("./scalingValue-CSHYgTZl.js"),$e=require("./useScopedStyles-Bf6yohVQ.js");function we(e,n){const r=n>0?`${n}px`:"0px";return`
|
|
2
|
+
.${e}-marquee-wrapper {
|
|
3
|
+
overflow: hidden;
|
|
4
|
+
width: 100%;
|
|
5
|
+
height: auto;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
@keyframes ${e}-marquee-left {
|
|
9
|
+
from { -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); }
|
|
10
|
+
to { -webkit-transform: translate3d(-${r}, 0, 0); transform: translate3d(-${r}, 0, 0); }
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@keyframes ${e}-marquee-right {
|
|
14
|
+
from { -webkit-transform: translate3d(-${r}, 0, 0); transform: translate3d(-${r}, 0, 0); }
|
|
15
|
+
to { -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); }
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.${e}-marquee-track {
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: row;
|
|
21
|
+
width: max-content;
|
|
22
|
+
will-change: transform;
|
|
23
|
+
backface-visibility: hidden;
|
|
24
|
+
-webkit-backface-visibility: hidden;
|
|
25
|
+
flex-wrap: nowrap;
|
|
26
|
+
-webkit-animation-timing-function: linear;
|
|
27
|
+
animation-timing-function: linear;
|
|
28
|
+
-webkit-animation-iteration-count: infinite;
|
|
29
|
+
animation-iteration-count: infinite;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.${e}-marquee-track[data-direction="left"] {
|
|
33
|
+
-webkit-animation-name: ${e}-marquee-left;
|
|
34
|
+
animation-name: ${e}-marquee-left;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.${e}-marquee-track[data-direction="right"] {
|
|
38
|
+
-webkit-animation-name: ${e}-marquee-right;
|
|
39
|
+
animation-name: ${e}-marquee-right;
|
|
40
|
+
}
|
|
41
|
+
.${e}-marquee-row {
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: row;
|
|
44
|
+
align-items: flex-start;
|
|
45
|
+
}
|
|
46
|
+
.${e}-marquee-set {
|
|
47
|
+
flex: 0 0 auto;
|
|
48
|
+
}
|
|
49
|
+
.${e}-marquee-static {
|
|
50
|
+
justify-content: center;
|
|
51
|
+
overflow-x: auto;
|
|
52
|
+
}
|
|
53
|
+
.${e}-marquee-card {
|
|
54
|
+
position: relative;
|
|
55
|
+
flex: 0 0 auto;
|
|
56
|
+
align-self: flex-start;
|
|
57
|
+
}
|
|
58
|
+
.${e}-wrapper {
|
|
59
|
+
position: relative;
|
|
60
|
+
width: 100%;
|
|
61
|
+
height: 100%;
|
|
62
|
+
order: 1;
|
|
63
|
+
}
|
|
64
|
+
.${e}-cover {
|
|
65
|
+
position: absolute;
|
|
66
|
+
width: 100%;
|
|
67
|
+
height: 100%;
|
|
68
|
+
top: 0;
|
|
69
|
+
left: 0;
|
|
70
|
+
}
|
|
71
|
+
.${e}-elements-overlay {
|
|
72
|
+
position: relative;
|
|
73
|
+
inset: 0;
|
|
74
|
+
display: flex;
|
|
75
|
+
flex-direction: column;
|
|
76
|
+
pointer-events: none;
|
|
77
|
+
}
|
|
78
|
+
.${e}-control {
|
|
79
|
+
position: relative;
|
|
80
|
+
z-index: 2;
|
|
81
|
+
width: 100%;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.${e}-marquee-link {
|
|
85
|
+
display: flex;
|
|
86
|
+
flex-direction: column;
|
|
87
|
+
justify-content: center;
|
|
88
|
+
align-items: center;
|
|
89
|
+
width: 100%;
|
|
90
|
+
height: 100%;
|
|
91
|
+
text-decoration: none;
|
|
92
|
+
color: inherit;
|
|
93
|
+
}
|
|
94
|
+
.${e}-marquee-link-contain {
|
|
95
|
+
width: auto;
|
|
96
|
+
height: auto;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.${e}-control::before {
|
|
100
|
+
content: "";
|
|
101
|
+
position: absolute;
|
|
102
|
+
top: 0;
|
|
103
|
+
left: 0;
|
|
104
|
+
width: 100%;
|
|
105
|
+
height: 100%;
|
|
106
|
+
min-height: 20px;
|
|
107
|
+
pointer-events: auto;
|
|
108
|
+
z-index: 10;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.${e}-gap-control {
|
|
112
|
+
position: relative;
|
|
113
|
+
z-index: 2;
|
|
114
|
+
pointer-events: auto;
|
|
115
|
+
height: 100%;
|
|
116
|
+
}
|
|
117
|
+
.${e}-image-hover-brightness img,
|
|
118
|
+
.${e}-image-hover-brightness video {
|
|
119
|
+
transition: filter 0.3s ease;
|
|
120
|
+
}
|
|
121
|
+
.${e}-image-hover-brightness:hover img,
|
|
122
|
+
.${e}-image-hover-brightness:hover video {
|
|
123
|
+
filter: brightness(1.25);
|
|
124
|
+
}
|
|
125
|
+
.${e}-image-hover-grayscale img,
|
|
126
|
+
.${e}-image-hover-grayscale video {
|
|
127
|
+
transition: filter 0.3s ease;
|
|
128
|
+
}
|
|
129
|
+
.${e}-image-hover-grayscale:hover img,
|
|
130
|
+
.${e}-image-hover-grayscale:hover video {
|
|
131
|
+
filter: grayscale(100%);
|
|
132
|
+
}
|
|
133
|
+
`}const qe=30,Re=20,oe=3,Ce=12,Se=32,ke=3,Ee=e=>{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")},Me=(e,n)=>Array.from({length:n},()=>e).flat(),Ne=e=>typeof e=="string"?{display:e.toLowerCase()==="cover"?"cover":"fit",ratioValue:"16:9",reversed:!1}:{display:(typeof(e==null?void 0:e.display)=="string"?e.display.toLowerCase():"")==="cover"?"cover":"fit",ratioValue:(e==null?void 0:e.ratioValue)??"16:9",reversed:(e==null?void 0:e.reversed)??!1},he=e=>e.reduce((n,r)=>n+(r.offsetWidth||r.getBoundingClientRect().width),0),me=(e,n)=>{if(n<=0||e.children.length<n)return 0;const r=e.children[0],d=e.children[n-1];if(!r||!d)return 0;const h=getComputedStyle(e),u=Number.parseFloat(h.columnGap||h.gap||"0")||0,y=d.getBoundingClientRect().right-r.getBoundingClientRect().left;if(y>0)return y;const x=Array.from({length:n},(b,N)=>e.children[N]),m=he(x);return m<=0?0:m+u*Math.max(0,n-1)},Ae=e=>{const n=e.getBoundingClientRect().width;if(n>0)return n;const r=e.offsetWidth;if(r>0)return r;const d=he(Array.from(e.children));if(d<=0)return 0;const h=getComputedStyle(e),u=Number.parseFloat(h.columnGap||h.gap||"0")||0,y=Number.parseFloat(h.paddingRight)||0;return d+u*Math.max(0,e.children.length-1)+y},We=(e,n)=>{const r=n.getBoundingClientRect(),d=e.getBoundingClientRect();return d.right>r.left&&d.left<r.right},_e=(e,n)=>{const r=e.querySelectorAll(`[data-marquee-item-index="${n}"]`);return Array.from(r).some(d=>We(d,e))},je=e=>{if(e.type==="video")return!0;if(e.type==="image")return!1;const n=e.name??"";return/\.(mp4|webm|ogg|mov)(\?|$)/i.test(n)?!0:/\.(mp4|webm|ogg|mov)(\?|$)/i.test(e.assetId??"")},Te=e=>e?e instanceof HTMLVideoElement?e.readyState>=2:e.complete:!1,He=({item:e,prefix:n,imageFit:r,imageMaxWidth:d,imageMaxHeight:h,cornerRadius:u,imageHoverClass:y,isFirstSet:x,scaled:m,onFirstSetImageDone:b})=>{var M,H,L,O;const N=o.useRef(null),z=!!((M=e.image)!=null&&M.assetId&&je(e.image));o.useLayoutEffect(()=>{x&&Te(N.current)&&(b==null||b())},[x,(H=e.image)==null?void 0:H.assetId,b]);const j=r.display==="cover",k=r.ratioValue??"1:1",V=r.reversed??!1,[U,q]=k.split(":").map(Number),E=(V?q:U)/(V?U:q),A=d/E,W=A>h?h:A,J=A>h?h*E:d,R=m(J),se=m(W),g={borderRadius:m(u)},T=j?{pointerEvents:"auto",display:"block",width:"100%",height:"100%",objectFit:"cover",...g}:{pointerEvents:"auto",display:"block",width:"auto",height:"auto",maxWidth:m(d),maxHeight:m(h),objectFit:"contain",...g},C=((L=e.image)==null?void 0:L.assetId)&&(z?p.jsx("video",{ref:B=>{N.current=B},src:e.image.assetId,style:T,muted:!0,loop:!0,autoPlay:!0,playsInline:!0,preload:"auto",onLoadedData:x?b:void 0,onError:x?b:void 0}):p.jsx("img",{ref:B=>{N.current=B},src:e.image.assetId,alt:((O=e.image)==null?void 0:O.name)??"",style:T,onLoad:x?b:void 0,onError:x?b:void 0}));return p.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"start",...j?{width:R}:{width:"max-content",maxWidth:m(d),minWidth:0}},children:p.jsx("div",{className:y,style:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",flexShrink:0,...j?{width:R,height:se,overflow:"hidden",...g}:{width:"max-content",maxWidth:m(d),height:m(h)}},children:C&&e.link?p.jsx("a",{href:e.link,target:"_self",rel:"noopener noreferrer",className:D(`${n}-marquee-link`,!j&&`${n}-marquee-link-contain`),children:C}):C})})},Le=({settings:e,content:n,isEditor:r,isPreviewMode:d,isEditMode:h})=>{const{prefix:u}=$e.useScopedStyles(),[y,x]=o.useState(0),m=y>0?Math.round(y):0,b=o.useMemo(()=>we(u,m),[u,m]),{speed:N,direction:z,pauseOnHover:j,gap:k,imageMaxWidth:V,imageMaxHeight:U,hoverEffect:q,cornerRadius:ie=0}=e,F=o.useMemo(()=>Ne(e.imageFit),[e.imageFit]),E=(n==null?void 0:n.length)??0,A=!!h,W=!r||!!d,J=W&&q!=="off"&&q!=="randomize"?`${u}-image-hover-${q}`:void 0,R=r?!!d:!0,g=((n==null?void 0:n.length)??0)>0&&(R||!!r),T=Math.max(0,N)*qe,C=t=>xe.scalingValue(t,r??!1),M=o.useRef(null),H=o.useRef(null),L=o.useRef(null),[O,B]=o.useState(0),Z=R&&j==="on",[ge,ce]=o.useState(!1),[_,P]=o.useState({}),ee=o.useRef(_);ee.current=_;const te=o.useRef(null),ne=o.useRef(0),X=o.useRef(null),le=o.useMemo(()=>(n??[]).map(t=>{var a;return((a=t.image)==null?void 0:a.assetId)??""}).join("\0"),[n]),[I,ue]=o.useState(oe),Q=o.useMemo(()=>{const t=n??[];return t.length===0||!(R||!!r)?t:Me(t,I)},[n,R,I,r]),de=o.useMemo(()=>(n??[]).filter(t=>{var a;return!!((a=t.image)!=null&&a.assetId)}).length,[n]),re=g?ke:1;o.useLayoutEffect(()=>{ne.current=0,P({}),te.current=null,ue(oe),x(0)},[le]),o.useEffect(()=>{if(!W||q!=="randomize")return;const t=M.current;if(!t)return;const a=s=>{P(l=>{const v=Array.from(s).filter(S=>S in l&&!_e(t,S));if(v.length===0)return l;const $={...l};return v.forEach(S=>{delete $[S]}),$})},i=new IntersectionObserver(s=>{const l=new Set;for(const v of s){const $=v.target.dataset.marqueeItemIndex,S=$!==void 0?Number($):NaN;Number.isNaN(S)||l.add(S)}l.size>0&&a(l)},{root:t,threshold:0});Object.keys(_).forEach(s=>{const l=Number(s);t.querySelectorAll(`[data-marquee-item-index="${l}"]`).forEach(v=>i.observe(v))});const f={current:0},c=()=>{const s=Object.keys(ee.current);s.length!==0&&(a(s.map(Number)),f.current=requestAnimationFrame(c))};return Object.keys(ee.current).length>0&&(f.current=requestAnimationFrame(c)),()=>{cancelAnimationFrame(f.current),i.disconnect()}},[q,_,W]),o.useEffect(()=>{const t=M.current;if(!t||typeof IntersectionObserver>"u")return;const a=t.querySelectorAll("video");if(a.length===0)return;const i=new IntersectionObserver(f=>{for(const c of f){const s=c.target;c.isIntersecting?s.paused&&s.play().catch(()=>{}):s.paused||s.pause()}},{threshold:0});return a.forEach(f=>i.observe(f)),()=>i.disconnect()},[g,Q,re,_]),o.useLayoutEffect(()=>{if(!g)return;const t=M.current,a=L.current;if(!t||!a)return;const i={current:0},f=()=>{const l=t.getBoundingClientRect().width||t.offsetWidth,v=Ae(a),$=te.current,S=typeof $=="number"&&Math.abs($-v)<=.25;te.current=v;let G=I,K=0;if((R||r)&&E>0&&l>0){const w=me(a,E);if(w>=Se){K=w;const ae=Math.min(Ce,Math.max(oe,Math.ceil(l/w)+1));G=ae,ae!==I&&ue(ae)}}const Y=G!==I&&K>0?K*G:v>0?v:K>0?K*G:(()=>{const w=me(a,E);return w>0?w*G:0})();Y>0?x(w=>w<=0?Y:!S||Math.round(w)===Math.round(Y)?w:Y):!S&&y<=0&&(cancelAnimationFrame(i.current),i.current=requestAnimationFrame(f))},c=()=>{cancelAnimationFrame(i.current),i.current=requestAnimationFrame(f)};X.current=c,c();const s=new ResizeObserver(c);return s.observe(t),s.observe(a),()=>{X.current=null,cancelAnimationFrame(i.current),s.disconnect()}},[R,g,y,le,I,E,r]),o.useLayoutEffect(()=>{if(!g||m<=0)return;const t=H.current;t&&Ee(t)},[g,m,z,T]),o.useLayoutEffect(()=>{if(!g||y<=0){B(0);return}const t=H.current,a=L.current;if(!t||!a)return;const i=()=>{const c=t.offsetHeight||t.getBoundingClientRect().height,s=Array.from(a.children).reduce((v,$)=>Math.max(v,$.offsetHeight||$.getBoundingClientRect().height),0),l=c>0?c:s;B(l>0?l:0)};i();const f=new ResizeObserver(i);return f.observe(t),f.observe(a),()=>f.disconnect()},[g,re,Q,r,k,V,U,y,F,_]),o.useLayoutEffect(()=>{if(!r||!A||!g||typeof window>"u")return;const t=requestAnimationFrame(()=>{window.dispatchEvent(new Event("scroll"))});return()=>cancelAnimationFrame(t)},[r,A,g,z,y,O,k,Q]);const pe=()=>{Z&&ce(!0)},ye=()=>{Z&&ce(!1)},ve=o.useCallback(()=>{var t;ne.current=Math.min(de,ne.current+1),(t=X.current)==null||t.call(X)},[de]),be=o.useCallback((t,a)=>{P(i=>{const f=i[t]??a,c=(n??[]).filter(l=>l!==f);if(c.length===0)return i;const s=c[Math.floor(Math.random()*c.length)];return{...i,[t]:s}})},[n]),fe=(t,a,i,f)=>{const c=W&&q==="randomize"&&F.display==="cover"?_[i]??t:t,s=`max(${C(k)}, ${Re}px)`,l=`calc(-0.5 * (${s} + ${C(k)}))`;return p.jsxs("div",{className:`${u}-marquee-card`,"data-marquee-item-index":i,onMouseEnter:W&&q==="randomize"&&F.display==="cover"?()=>be(i,t):void 0,children:[p.jsx(He,{item:c,prefix:u,imageFit:F,imageMaxWidth:V,imageMaxHeight:U,cornerRadius:ie,imageHoverClass:J,isEditor:r,isFirstSet:f,scaled:C,onFirstSetImageDone:ve}),A&&p.jsx("div",{"data-controls":"gap","data-controls-axis":"x",className:`${u}-gap-control`,style:{position:"absolute",top:0,right:l,width:s,height:"100%"}})]},`${a}-${i}`)};if(g){const t=R?Z&&ge?"paused":"running":"paused",a=m>0&&T>0?m/T*1e3:0,i=`${Math.max(0,a)/1e3}s`;return p.jsxs("div",{ref:M,className:D(`${u}-wrapper`,`${u}-marquee-wrapper`),"aria-label":"Marquee",style:O>0?{height:O}:void 0,children:[p.jsx("style",{dangerouslySetInnerHTML:{__html:b}}),p.jsx("div",{ref:H,className:`${u}-marquee-track`,"data-direction":z,onMouseEnter:pe,onMouseLeave:ye,style:{WebkitAnimationDuration:i,animationDuration:i,WebkitAnimationPlayState:t,animationPlayState:t},children:Array.from({length:re},(f,c)=>p.jsx("div",{ref:c===0?L:void 0,className:D(`${u}-marquee-row`,`${u}-marquee-set`),style:{gap:C(k),paddingRight:C(k)},"aria-hidden":c>0,children:Q.map((s,l)=>fe(s,c,l,c===0&&l<E))},`set-${c}`))})]})}return p.jsxs("div",{ref:M,className:`${u}-wrapper`,children:[p.jsx("style",{dangerouslySetInnerHTML:{__html:b}}),p.jsx("div",{className:D(`${u}-marquee-row`,`${u}-marquee-static`),style:{gap:C(k),transform:"none"},"aria-label":"Marquee",children:n==null?void 0:n.map((t,a)=>fe(t,0,a))},"marquee-static")]})};exports.Marquee=Le;
|