@cntrl-site/components 1.0.118-alpha.8 → 1.0.118-alpha.9

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.
@@ -0,0 +1,1853 @@
1
+ import { jsxs as V, Fragment as ft, jsx as r } from "react/jsx-runtime";
2
+ import { s as f } from "./scalingValue-C9JH5L6O.mjs";
3
+ import { b as On } from "./buildColorVars-CLyWQm5K.mjs";
4
+ import { u as _n } from "./useScopedStyles-DhBG3557.mjs";
5
+ import { u as gn } from "./useLazyVideos-CxXyEjRQ.mjs";
6
+ import { L as Me } from "./LinkWrapper-5kQHiGJQ.mjs";
7
+ import { i as Vt, g as Ze, E as pn, a as Gn } from "./EmbedMediaFrame-DwHeOAy5.mjs";
8
+ import { useMemo as mt, useRef as W, useState as G, useLayoutEffect as qe, useEffect as et, memo as Dn, useCallback as kt } from "react";
9
+ import { createPortal as Fn } from "react-dom";
10
+ import { o as je, t as Ve } from "./textStylesToCss-05Mn6I_2.mjs";
11
+ import { S as Hn } from "./SvgImage-B5mR9y6q.mjs";
12
+ import { L as fn } from "./LazyVideo-CdAWymKO.mjs";
13
+ function jn(t) {
14
+ return `calc(var(--cntrl-article-width, 100vw) * ${t / 1440})`;
15
+ }
16
+ function cn(t) {
17
+ return ((t == null ? void 0 : t.trim().length) ?? 0) > 0;
18
+ }
19
+ function Be(t, n, e, s) {
20
+ return n !== void 0 && n < (t ?? 0.01) ? `${e} ${s}` : e;
21
+ }
22
+ function Ee(t, n, e, s) {
23
+ const o = t ?? 0.01;
24
+ return n === void 0 || n >= o ? {} : {
25
+ [`--${e}-title-leading-gap`]: f((o - n) / 2, s)
26
+ };
27
+ }
28
+ const Ue = 400, Xe = "cubic-bezier(0.25, 0.1, 0.25, 1)", Vn = 1.1, $n = "--grid-media-radius";
29
+ function Bn(t) {
30
+ return `
31
+ .${t}-wrapper {
32
+ display: grid;
33
+ align-items: start;
34
+ justify-content: center;
35
+ min-height: ${jn(48)};
36
+ }
37
+ .${t}-item {
38
+ display: flex;
39
+ flex-direction: column;
40
+ justify-content: center;
41
+ align-items: center;
42
+ }
43
+ .${t}-item-inner {
44
+ display: flex;
45
+ flex-direction: column;
46
+ align-items: center;
47
+ outline: 1px solid #FF5C02;
48
+ }
49
+ .${t}-item-inner-hidden {
50
+ display: flex;
51
+ flex-direction: column;
52
+ align-items: center;
53
+ }
54
+ .${t}-item-image-wrapper {
55
+ display: flex;
56
+ justify-content: center;
57
+ align-items: center;
58
+ align-self: center;
59
+ }
60
+ .${t}-item-image-wrapper-fit-slider {
61
+ display: grid;
62
+ overflow: hidden;
63
+ position: relative;
64
+ }
65
+ .${t}-item-image-wrapper-fit-slider > .${t}-item-image-wrapper-sizer {
66
+ grid-area: 1 / 1;
67
+ width: 100%;
68
+ display: grid;
69
+ visibility: hidden;
70
+ pointer-events: none;
71
+ }
72
+ .${t}-item-image-wrapper-fit-slider > .${t}-item-image-wrapper-sizer img {
73
+ grid-area: 1 / 1;
74
+ width: auto;
75
+ height: auto;
76
+ max-width: 100%;
77
+ object-fit: contain;
78
+ }
79
+ .${t}-item-image-wrapper-fit-slider > .${t}-item-image-wrapper-sizer video {
80
+ grid-area: 1 / 1;
81
+ width: auto;
82
+ height: auto;
83
+ max-width: 100%;
84
+ object-fit: contain;
85
+ }
86
+ .${t}-item-image-wrapper-fit-slider > .${t}-item-image-wrapper-sizer div {
87
+ grid-area: 1 / 1;
88
+ width: 100%;
89
+ }
90
+ .${t}-item-image-wrapper-fit-slider > .${t}-item-slider {
91
+ position: absolute;
92
+ inset: 0;
93
+ width: 100%;
94
+ overflow: hidden;
95
+ }
96
+ .${t}-item-image-link {
97
+ width: 100%;
98
+ display: flex;
99
+ flex-direction: column;
100
+ align-items: center;
101
+ }
102
+ .${t}-custom-layout .${t}-item-image-link {
103
+ flex: 1 1 0%;
104
+ min-height: 0;
105
+ }
106
+ .${t}-custom-layout.${t}-text-outside .${t}-item-image-link,
107
+ .${t}-custom-layout.${t}-auto-height .${t}-item-image-link {
108
+ flex: none;
109
+ }
110
+ .${t}-auto-height .${t}-item-image-wrapper-fit-slider > .${t}-item-image-wrapper-sizer :is(img, video) {
111
+ width: 100%;
112
+ }
113
+ .${t}-item-text-link {
114
+ display: flex;
115
+ flex-direction: column;
116
+ align-items: center;
117
+ width: 100%;
118
+ color: inherit;
119
+ text-decoration: none;
120
+ }
121
+ .${t}-item-image {
122
+ width: 100%;
123
+ height: 100%;
124
+ display: block;
125
+ max-width: 100%;
126
+ }
127
+ .${t}-item-video {
128
+ width: 100%;
129
+ height: 100%;
130
+ display: block;
131
+ max-width: 100%;
132
+ }
133
+ .${t}-item-slider {
134
+ position: relative;
135
+ width: 100%;
136
+ height: 100%;
137
+ overflow: hidden;
138
+ }
139
+ .${t}-item-slider-list {
140
+ position: relative;
141
+ display: flex;
142
+ flex-direction: row;
143
+ width: 100%;
144
+ height: 100%;
145
+ will-change: transform;
146
+ }
147
+ .${t}-item-slider-list-vertical {
148
+ flex-direction: column;
149
+ }
150
+ .${t}-item-slider-list-fade {
151
+ display: block;
152
+ will-change: auto;
153
+ }
154
+ .${t}-item-slide {
155
+ position: relative;
156
+ flex: 0 0 100%;
157
+ width: 100%;
158
+ height: 100%;
159
+ display: flex;
160
+ justify-content: center;
161
+ align-items: center;
162
+ }
163
+ .${t}-item-slider-list-fade .${t}-item-slide {
164
+ position: absolute;
165
+ top: 0;
166
+ left: 0;
167
+ opacity: 0;
168
+ transition: opacity ${Ye}ms ${yn};
169
+ }
170
+ .${t}-item-slider-list-fade .${t}-item-slide-active {
171
+ opacity: 1;
172
+ z-index: 1;
173
+ }
174
+ .${t}-item-title {
175
+ white-space: normal;
176
+ overflow-wrap: anywhere;
177
+ word-break: break-word;
178
+ text-align: center;
179
+ margin-bottom: 0px;
180
+ margin-top: 0px;
181
+ color: var(--${t}-title-color);
182
+ }
183
+ .${t}-item-subtitle {
184
+ white-space: normal;
185
+ overflow-wrap: anywhere;
186
+ word-break: break-word;
187
+ text-align: center;
188
+ margin-bottom: 0px;
189
+ margin-top: 0px;
190
+ color: var(--${t}-subtitle-color);
191
+ }
192
+ .${t}-text-tight-leading {
193
+ display: block;
194
+ flex-shrink: 0;
195
+ padding-top: var(--${t}-title-leading-gap, 0);
196
+ padding-bottom: var(--${t}-title-leading-gap, 0);
197
+ }
198
+ .${t}-show-text-hover .${t}-item-title,
199
+ .${t}-show-text-hover .${t}-item-subtitle {
200
+ opacity: 0;
201
+ transition: opacity 250ms;
202
+ }
203
+ .${t}-show-text-hover .${t}-item-inner:hover .${t}-item-title,
204
+ .${t}-show-text-hover .${t}-item-inner:hover .${t}-item-subtitle,
205
+ .${t}-show-text-hover .${t}-item-inner-hidden:hover .${t}-item-title,
206
+ .${t}-show-text-hover .${t}-item-inner-hidden:hover .${t}-item-subtitle {
207
+ opacity: 1;
208
+ }
209
+ @property --${t}-hover-zoom {
210
+ syntax: '<number>';
211
+ inherits: false;
212
+ initial-value: 1;
213
+ }
214
+ .${t}-hover-zoom-in .${t}-item-image,
215
+ .${t}-hover-zoom-in .${t}-item-video {
216
+ transform: scale(var(--${t}-hover-zoom));
217
+ clip-path: inset(calc(50% - 50% / var(--${t}-hover-zoom)) round calc(var(${$n}, 0px) / var(--${t}-hover-zoom)));
218
+ transition: --${t}-hover-zoom ${Ue}ms ${Xe};
219
+ }
220
+ .${t}-hover-scale-down .${t}-item-image,
221
+ .${t}-hover-scale-down .${t}-item-video {
222
+ transition: transform ${Ue}ms ${Xe};
223
+ }
224
+ .${t}-hover-greyscale .${t}-item-image-wrapper {
225
+ transition: filter ${Ue}ms ${Xe};
226
+ }
227
+ @media (hover: hover) {
228
+ .${t}-hover-zoom-in .${t}-item-image-wrapper:has(.${t}-item-image:hover, .${t}-item-video:hover) :is(.${t}-item-image, .${t}-item-video) {
229
+ --${t}-hover-zoom: ${Vn};
230
+ }
231
+ .${t}-hover-scale-down .${t}-item-image-wrapper:hover .${t}-item-image,
232
+ .${t}-hover-scale-down .${t}-item-image-wrapper:hover .${t}-item-video {
233
+ transform: scale(0.9);
234
+ }
235
+ .${t}-hover-greyscale:has(.${t}-item-image:hover, .${t}-item-video:hover) .${t}-item-image-wrapper:not(:has(.${t}-item-image:hover, .${t}-item-video:hover)) {
236
+ filter: grayscale(1);
237
+ }
238
+ }
239
+ .${t}-type-a .${t}-item-inner,
240
+ .${t}-type-a .${t}-item-inner-hidden,
241
+ .${t}-type-d .${t}-item-inner,
242
+ .${t}-type-d .${t}-item-inner-hidden {
243
+ align-items: flex-start;
244
+ }
245
+ .${t}-type-b .${t}-item-inner,
246
+ .${t}-type-b .${t}-item-inner-hidden,
247
+ .${t}-type-e .${t}-item-inner,
248
+ .${t}-type-e .${t}-item-inner-hidden {
249
+ align-items: center;
250
+ }
251
+ .${t}-type-c .${t}-item-inner,
252
+ .${t}-type-c .${t}-item-inner-hidden,
253
+ .${t}-type-f .${t}-item-inner,
254
+ .${t}-type-f .${t}-item-inner-hidden {
255
+ align-items: flex-end;
256
+ }
257
+ .${t}-type-a .${t}-item-image-link,
258
+ .${t}-type-b .${t}-item-image-link,
259
+ .${t}-type-c .${t}-item-image-link,
260
+ .${t}-type-d .${t}-item-image-link,
261
+ .${t}-type-e .${t}-item-image-link,
262
+ .${t}-type-f .${t}-item-image-link {
263
+ align-items: center;
264
+ }
265
+ .${t}-type-a .${t}-item-title,
266
+ .${t}-type-a .${t}-item-subtitle,
267
+ .${t}-type-d .${t}-item-title,
268
+ .${t}-type-d .${t}-item-subtitle {
269
+ text-align: left;
270
+ }
271
+ .${t}-type-b .${t}-item-title,
272
+ .${t}-type-b .${t}-item-subtitle,
273
+ .${t}-type-e .${t}-item-title,
274
+ .${t}-type-e .${t}-item-subtitle {
275
+ text-align: center;
276
+ }
277
+ .${t}-type-c .${t}-item-title,
278
+ .${t}-type-c .${t}-item-subtitle,
279
+ .${t}-type-f .${t}-item-title,
280
+ .${t}-type-f .${t}-item-subtitle {
281
+ text-align: right;
282
+ }
283
+ .${t}-item-text-block {
284
+ display: flex;
285
+ flex-direction: column;
286
+ align-items: flex-start;
287
+ width: 100%;
288
+ flex-shrink: 0;
289
+ }
290
+ .${t}-type-d .${t}-item-text-block {
291
+ align-items: flex-start;
292
+ }
293
+ .${t}-type-e .${t}-item-text-block {
294
+ align-items: center;
295
+ }
296
+ .${t}-type-f .${t}-item-text-block {
297
+ align-items: flex-end;
298
+ }
299
+ .${t}-type-a .${t}-item-text-link,
300
+ .${t}-type-d .${t}-item-text-link {
301
+ align-items: flex-start;
302
+ }
303
+ .${t}-type-b .${t}-item-text-link,
304
+ .${t}-type-e .${t}-item-text-link {
305
+ align-items: center;
306
+ }
307
+ .${t}-type-c .${t}-item-text-link,
308
+ .${t}-type-f .${t}-item-text-link {
309
+ align-items: flex-end;
310
+ }
311
+ .${t}-image-align-top .${t}-item-image-wrapper:not(.${t}-item-image-wrapper-fit-slider) {
312
+ align-items: flex-start;
313
+ }
314
+ .${t}-image-align-center .${t}-item-image-wrapper:not(.${t}-item-image-wrapper-fit-slider) {
315
+ align-items: center;
316
+ }
317
+ .${t}-image-align-bottom .${t}-item-image-wrapper:not(.${t}-item-image-wrapper-fit-slider) {
318
+ align-items: flex-end;
319
+ }
320
+ .${t}-image-align-top .${t}-item-slider .${t}-item-slide {
321
+ align-items: flex-start;
322
+ }
323
+ .${t}-image-align-center .${t}-item-slider .${t}-item-slide {
324
+ align-items: center;
325
+ }
326
+ .${t}-image-align-bottom .${t}-item-slider .${t}-item-slide {
327
+ align-items: flex-end;
328
+ }
329
+ .${t}-align-entries .${t}-item {
330
+ display: contents;
331
+ }
332
+ .${t}-align-entries .${t}-item-inner,
333
+ .${t}-align-entries .${t}-item-inner-hidden {
334
+ display: grid;
335
+ grid-template-rows: subgrid;
336
+ grid-row: span 3;
337
+ justify-self: center;
338
+ margin-bottom: var(--${t}-align-entries-row-gap, 0);
339
+ }
340
+ .${t}-align-entries .${t}-item-inner-last-row {
341
+ margin-bottom: 0;
342
+ }
343
+ .${t}-align-entries .${t}-item-text-link {
344
+ display: contents;
345
+ }
346
+ .${t}-align-entries .${t}-item-title-row,
347
+ .${t}-align-entries .${t}-item-subtitle-row {
348
+ display: flex;
349
+ flex-direction: column;
350
+ align-items: flex-start;
351
+ width: 100%;
352
+ min-height: 100%;
353
+ }
354
+ .${t}-type-a.${t}-align-entries .${t}-item-title-row,
355
+ .${t}-type-a.${t}-align-entries .${t}-item-subtitle-row,
356
+ .${t}-type-d.${t}-align-entries .${t}-item-title-row,
357
+ .${t}-type-d.${t}-align-entries .${t}-item-subtitle-row {
358
+ align-items: flex-start;
359
+ }
360
+ .${t}-type-b.${t}-align-entries .${t}-item-title-row,
361
+ .${t}-type-b.${t}-align-entries .${t}-item-subtitle-row,
362
+ .${t}-type-e.${t}-align-entries .${t}-item-title-row,
363
+ .${t}-type-e.${t}-align-entries .${t}-item-subtitle-row {
364
+ align-items: center;
365
+ }
366
+ .${t}-type-c.${t}-align-entries .${t}-item-title-row,
367
+ .${t}-type-c.${t}-align-entries .${t}-item-subtitle-row,
368
+ .${t}-type-f.${t}-align-entries .${t}-item-title-row,
369
+ .${t}-type-f.${t}-align-entries .${t}-item-subtitle-row {
370
+ align-items: flex-end;
371
+ }
372
+ .${t}-align-entries .${t}-item-image-link {
373
+ width: 100%;
374
+ height: 100%;
375
+ min-height: 100%;
376
+ display: flex;
377
+ flex-direction: column;
378
+ align-items: center;
379
+ justify-content: flex-start;
380
+ }
381
+ .${t}-align-entries .${t}-item-image-link > .${t}-item-image-wrapper {
382
+ flex-shrink: 0;
383
+ height: auto;
384
+ align-self: auto;
385
+ }
386
+ .${t}-image-align-top.${t}-align-entries .${t}-item-image-link > .${t}-item-image-wrapper {
387
+ margin-top: 0;
388
+ margin-bottom: auto;
389
+ }
390
+ .${t}-image-align-center.${t}-align-entries .${t}-item-image-link > .${t}-item-image-wrapper {
391
+ margin-top: auto;
392
+ margin-bottom: auto;
393
+ }
394
+ .${t}-image-align-bottom.${t}-align-entries .${t}-item-image-link > .${t}-item-image-wrapper {
395
+ margin-top: auto;
396
+ margin-bottom: 0;
397
+ }
398
+ .${t}-image-align-top.${t}-align-entries .${t}-item-image-wrapper:not(.${t}-item-image-wrapper-fit-slider) {
399
+ align-items: flex-start;
400
+ }
401
+ .${t}-image-align-center.${t}-align-entries .${t}-item-image-wrapper:not(.${t}-item-image-wrapper-fit-slider) {
402
+ align-items: center;
403
+ }
404
+ .${t}-image-align-bottom.${t}-align-entries .${t}-item-image-wrapper:not(.${t}-item-image-wrapper-fit-slider) {
405
+ align-items: flex-end;
406
+ }
407
+ .${t}-image-align-top.${t}-align-entries .${t}-item-slider .${t}-item-slide {
408
+ align-items: flex-start;
409
+ }
410
+ .${t}-image-align-center.${t}-align-entries .${t}-item-slider .${t}-item-slide {
411
+ align-items: center;
412
+ }
413
+ .${t}-image-align-bottom.${t}-align-entries .${t}-item-slider .${t}-item-slide {
414
+ align-items: flex-end;
415
+ }
416
+ .${t}-image-align-top.${t}-align-entries .${t}-item-image-link {
417
+ justify-content: flex-start;
418
+ }
419
+ .${t}-image-align-center.${t}-align-entries .${t}-item-image-link {
420
+ justify-content: center;
421
+ }
422
+ .${t}-image-align-bottom.${t}-align-entries .${t}-item-image-link {
423
+ justify-content: flex-end;
424
+ }
425
+ .${t}-lightbox-counter {
426
+ margin: 0;
427
+ color: var(--${t}-lightbox-counter-color);
428
+ }
429
+ .${t}-lightbox {
430
+ position: fixed;
431
+ inset: 0;
432
+ z-index: 9997;
433
+ overscroll-behavior: none;
434
+ overflow: hidden;
435
+ }
436
+ .${t}-lightbox-editor {
437
+ inset: auto;
438
+ top: var(--cntrl-article-top, 0);
439
+ left: var(--cntrl-article-left, 0);
440
+ width: var(--cntrl-article-width, 100vw) !important;
441
+ height: var(--cntrl-viewport-height, 100vh) !important;
442
+ }
443
+ .${t}-control {
444
+ position: relative;
445
+ z-index: 2;
446
+ width: 100%;
447
+ }
448
+ .${t}-close-icon {
449
+ position: relative;
450
+ flex-shrink: 0;
451
+ pointer-events: auto;
452
+ z-index: 2;
453
+ display: flex;
454
+ align-items: center;
455
+ justify-content: center;
456
+ border: none;
457
+ background-color: transparent;
458
+ padding: 0;
459
+ }
460
+ .${t}-close-icon-inner {
461
+ all: unset;
462
+ position: relative;
463
+ cursor: pointer;
464
+ width: 100%;
465
+ height: 100%;
466
+ pointer-events: auto;
467
+ }
468
+ .${t}-close-icon-img {
469
+ position: absolute;
470
+ top: 50%;
471
+ left: 50%;
472
+ transform: translate(-50%, -50%);
473
+ }
474
+ `;
475
+ }
476
+ function En() {
477
+ return Math.random() < 0.5 ? "ltr" : "ttb";
478
+ }
479
+ function mn(t, n) {
480
+ return n <= 0 ? 0 : (t % n + n) % n;
481
+ }
482
+ const pt = 500, Ye = 750, yn = "cubic-bezier(0.25, 1, 0.5, 1)", Un = 5e3, Rt = "cubic-bezier(0.22, 1, 0.36, 1)", Xn = 72, qn = 50;
483
+ function Yn(t) {
484
+ if (!Array.isArray(t) || t.length === 0) return !1;
485
+ const n = t[0];
486
+ return n !== null && typeof n == "object" && "media" in n && Array.isArray(n.media);
487
+ }
488
+ function Kn(t) {
489
+ const [n, e] = t.media;
490
+ return e != null && e.assetId ? e : n != null && n.assetId ? n : null;
491
+ }
492
+ function Zn(t) {
493
+ const [n] = t.media;
494
+ return n != null && n.assetId ? n : null;
495
+ }
496
+ function vn(t) {
497
+ return !Array.isArray(t) || t.length === 0 ? [] : Yn(t) ? t.flatMap((n) => {
498
+ const e = Kn(n);
499
+ if (!e) return [];
500
+ const s = Zn(n);
501
+ return [{
502
+ displayMedia: e,
503
+ lightboxMedia: s != null && s.assetId ? s : null
504
+ }];
505
+ }) : t.filter((n) => n == null ? void 0 : n.assetId).map((n) => ({
506
+ displayMedia: n,
507
+ lightboxMedia: n
508
+ }));
509
+ }
510
+ function jt(t) {
511
+ return !Vt(t) && t.type === "video";
512
+ }
513
+ function Jn(t) {
514
+ const n = /* @__PURE__ */ new Set(), e = [];
515
+ for (const s of t) {
516
+ const o = vn(s.gallery);
517
+ for (const m of o) {
518
+ const c = m.lightboxMedia;
519
+ c != null && c.assetId && !n.has(c.assetId) && (n.add(c.assetId), e.push(c));
520
+ }
521
+ }
522
+ return e;
523
+ }
524
+ const Qn = Dn(function({ mediaList: n }) {
525
+ const [e, s] = G(null);
526
+ gn(e, { preload: "metadata" });
527
+ const o = n.filter((m) => !Vt(m));
528
+ return o.length === 0 ? null : /* @__PURE__ */ r(
529
+ "div",
530
+ {
531
+ ref: s,
532
+ "aria-hidden": !0,
533
+ style: {
534
+ position: "absolute",
535
+ width: 0,
536
+ height: 0,
537
+ overflow: "hidden",
538
+ opacity: 0,
539
+ pointerEvents: "none"
540
+ },
541
+ children: o.map((m) => jt(m) ? /* @__PURE__ */ r(
542
+ "video",
543
+ {
544
+ src: m.assetId,
545
+ preload: "none",
546
+ muted: !0,
547
+ playsInline: !0
548
+ },
549
+ m.assetId
550
+ ) : /* @__PURE__ */ r(
551
+ "img",
552
+ {
553
+ src: m.assetId,
554
+ alt: ""
555
+ },
556
+ m.assetId
557
+ ))
558
+ }
559
+ );
560
+ });
561
+ function Pn(t) {
562
+ t.pause(), t.removeAttribute("src"), t.load();
563
+ }
564
+ const wn = "cntrl-grid-slide", xn = "cntrl-grid-slide-playing", ti = `.${wn} video`;
565
+ function ei(t) {
566
+ return t.closest(`.${xn}`) !== null;
567
+ }
568
+ function ni({ prefix: t, slides: n, isFade: e, direction: s, intervalMs: o }) {
569
+ const m = n.length, c = !e && m > 1, L = !e && s === "random", q = Number.isFinite(o) && o > 0 ? o : Un, [i, v] = G(c ? 1 : 0), [$, O] = G(!e && s === "vertical" ? "ttb" : "ltr"), [M, T] = G(!1), [K, w] = G(!1), [nt, E] = G(0), x = W(!1);
570
+ et(() => {
571
+ if (m < 2) return;
572
+ const I = window.setTimeout(() => {
573
+ if (x.current) {
574
+ E((b) => b + 1);
575
+ return;
576
+ }
577
+ x.current = !0, T(!0), w(!1), v((b) => c ? b + 1 : mn(b + 1, m)), L || E((b) => b + 1);
578
+ }, q);
579
+ return () => window.clearTimeout(I);
580
+ }, [m, nt, q, c, L]), et(() => {
581
+ if (!M) return;
582
+ const I = window.setTimeout(() => {
583
+ const b = c && i === m + 1, z = L ? En() : $;
584
+ (b || z !== $) && (w(!0), b && v(1), O(z)), x.current = !1, T(!1), L && E((U) => U + 1);
585
+ }, Ye);
586
+ return () => window.clearTimeout(I);
587
+ }, [$, m, c, M, L, i]), et(() => {
588
+ if (!K) return;
589
+ let I = 0;
590
+ const b = requestAnimationFrame(() => {
591
+ I = requestAnimationFrame(() => w(!1));
592
+ });
593
+ return () => {
594
+ cancelAnimationFrame(b), cancelAnimationFrame(I);
595
+ };
596
+ }, [K]);
597
+ const Q = c ? m + 2 : m, d = (I) => c ? mn(I - 1, m) : I, g = (I) => c && (I === 0 || I === m + 1), S = d(i), D = i + 1 < Q ? i + 1 : -1, _ = (I) => e || I === i && !g(I) || I === D || D >= 0 && !g(I) && d(I) === d(D), F = !e && $ === "ttb", it = e ? void 0 : {
598
+ transform: F ? `translate3d(0, ${-i * 100}%, 0)` : `translate3d(${-i * 100}%, 0, 0)`,
599
+ transition: K ? "none" : `transform ${Ye}ms ${yn}`
600
+ };
601
+ return /* @__PURE__ */ r("div", { className: `${t}-item-slider`, children: /* @__PURE__ */ r(
602
+ "div",
603
+ {
604
+ className: `${t}-item-slider-list${e ? ` ${t}-item-slider-list-fade` : ""}${F ? ` ${t}-item-slider-list-vertical` : ""}`,
605
+ style: it,
606
+ children: Array.from({ length: Q }, (I, b) => {
607
+ const z = d(b), U = g(b), tt = e ? z === S : b === i;
608
+ return /* @__PURE__ */ r(
609
+ "div",
610
+ {
611
+ className: `${t}-item-slide ${wn}${e && tt ? ` ${t}-item-slide-active` : ""}${_(b) ? ` ${xn}` : ""}`,
612
+ "aria-hidden": tt ? void 0 : !0,
613
+ children: n[z]
614
+ },
615
+ U ? `clone-${b === 0 ? "start" : "end"}` : `slide-${z}`
616
+ );
617
+ })
618
+ }
619
+ ) });
620
+ }
621
+ function hn({
622
+ media: t,
623
+ className: n,
624
+ style: e,
625
+ hasLightbox: s,
626
+ isSliderSlide: o = !1,
627
+ onMediaClick: m
628
+ }) {
629
+ if (Vt(t))
630
+ return /* @__PURE__ */ r(
631
+ pn,
632
+ {
633
+ media: t,
634
+ fit: e.objectFit === "contain" ? "contain" : "cover",
635
+ silentLoop: s,
636
+ className: n,
637
+ style: {
638
+ ...e,
639
+ cursor: m ? "pointer" : "default"
640
+ },
641
+ onClick: m
642
+ }
643
+ );
644
+ if (jt(t)) {
645
+ const c = {
646
+ src: t.assetId,
647
+ className: n,
648
+ style: {
649
+ ...e,
650
+ cursor: m ? "pointer" : "default"
651
+ },
652
+ muted: !0,
653
+ loop: !0,
654
+ playsInline: !0,
655
+ onClick: m
656
+ };
657
+ return o ? /* @__PURE__ */ r("video", { ...c, preload: "none" }) : /* @__PURE__ */ r(fn, { ...c, autoPlay: !0 });
658
+ }
659
+ return /* @__PURE__ */ r(
660
+ "img",
661
+ {
662
+ src: t.assetId,
663
+ alt: t.name,
664
+ className: n,
665
+ style: {
666
+ ...e,
667
+ cursor: m ? "pointer" : "default"
668
+ },
669
+ onClick: m
670
+ }
671
+ );
672
+ }
673
+ function ii({
674
+ className: t,
675
+ style: n,
676
+ children: e
677
+ }) {
678
+ const [s, o] = G(null);
679
+ return gn(s, { autoPlay: !0, selector: ti, shouldPlay: ei }), /* @__PURE__ */ r("div", { ref: o, className: t, style: n, children: e });
680
+ }
681
+ function dn(t) {
682
+ const n = t.getBoundingClientRect();
683
+ return { width: n.width, height: n.height, left: n.left, top: n.top };
684
+ }
685
+ function ri(t, n) {
686
+ if (!n || !n.width || !n.height || !t.width || !t.height) return t;
687
+ const e = n.width / n.height, s = t.width / t.height;
688
+ if (e > s) {
689
+ const m = t.width / e;
690
+ return { width: t.width, height: m, left: t.left, top: t.top + (t.height - m) / 2 };
691
+ }
692
+ const o = t.height * e;
693
+ return { width: o, height: t.height, left: t.left + (t.width - o) / 2, top: t.top };
694
+ }
695
+ function oi({
696
+ src: t,
697
+ mediaRef: n,
698
+ mediaStyle: e,
699
+ onLoadedMetadata: s
700
+ }) {
701
+ return et(() => {
702
+ const o = n.current;
703
+ if (o)
704
+ return () => {
705
+ Pn(o);
706
+ };
707
+ }, [t, n]), /* @__PURE__ */ r(
708
+ "video",
709
+ {
710
+ ref: n,
711
+ src: t,
712
+ muted: !0,
713
+ autoPlay: !0,
714
+ loop: !0,
715
+ playsInline: !0,
716
+ preload: "auto",
717
+ onLoadedMetadata: s,
718
+ style: e
719
+ }
720
+ );
721
+ }
722
+ const si = "https://cdn.cntrl.site/component-assets/defaultCloseIcon.svg", li = 4e-3;
723
+ function ai({
724
+ prefix: t,
725
+ closeIcon: n = si,
726
+ closeIconMaxWidth: e = 0.0125,
727
+ closeIconColor: s = "#FFFFFF",
728
+ closeIconHoverColor: o = "#999999",
729
+ iconMarginRight: m = 0.01,
730
+ contentMarginTop: c = 0.01,
731
+ isEditor: L,
732
+ isPreviewMode: q,
733
+ isEditMode: i,
734
+ visible: v,
735
+ onClose: $
736
+ }) {
737
+ if (!n) return null;
738
+ const O = f(e, L), M = f(m, L), T = f(c, L), K = f(Math.max(c, li), L);
739
+ return /* @__PURE__ */ V(
740
+ "div",
741
+ {
742
+ style: {
743
+ position: "absolute",
744
+ top: 0,
745
+ left: 0,
746
+ right: 0,
747
+ zIndex: 1e4,
748
+ display: "flex",
749
+ flexDirection: "column",
750
+ alignItems: "flex-end",
751
+ pointerEvents: "none",
752
+ opacity: v ? 1 : 0,
753
+ transition: "opacity 500ms cubic-bezier(0.22, 1, 0.36, 1)"
754
+ },
755
+ children: [
756
+ /* @__PURE__ */ r(
757
+ "div",
758
+ {
759
+ style: {
760
+ position: "relative",
761
+ width: "100%",
762
+ height: T,
763
+ flexShrink: 0
764
+ },
765
+ children: i && /* @__PURE__ */ r(
766
+ "div",
767
+ {
768
+ "data-controls": "contentMarginTop",
769
+ "data-controls-axis": "y",
770
+ "data-controls-min": "0",
771
+ className: `${t}-control`,
772
+ style: {
773
+ position: "absolute",
774
+ top: 0,
775
+ left: 0,
776
+ width: "100%",
777
+ height: K,
778
+ pointerEvents: v ? "auto" : "none"
779
+ }
780
+ }
781
+ )
782
+ }
783
+ ),
784
+ /* @__PURE__ */ V(
785
+ "div",
786
+ {
787
+ className: `${t}-close-icon`,
788
+ style: {
789
+ width: O,
790
+ height: O,
791
+ marginRight: M,
792
+ pointerEvents: v ? "auto" : "none"
793
+ },
794
+ onClick: (w) => w.stopPropagation(),
795
+ children: [
796
+ /* @__PURE__ */ r(
797
+ "button",
798
+ {
799
+ type: "button",
800
+ className: `${t}-close-icon-inner`,
801
+ "aria-label": "Close",
802
+ onClick: (w) => {
803
+ w.stopPropagation(), $();
804
+ },
805
+ children: /* @__PURE__ */ r(
806
+ Hn,
807
+ {
808
+ url: n,
809
+ fill: s,
810
+ hoverFill: L && !q ? s : o,
811
+ className: `${t}-close-icon-img`
812
+ }
813
+ )
814
+ }
815
+ ),
816
+ i && /* @__PURE__ */ r(
817
+ "div",
818
+ {
819
+ "data-controls": "iconMarginRight",
820
+ "data-controls-axis": "x",
821
+ "data-controls-reverse": "",
822
+ className: `${t}-control`,
823
+ style: {
824
+ position: "absolute",
825
+ top: 0,
826
+ left: "100%",
827
+ width: M,
828
+ height: "100%",
829
+ pointerEvents: v ? "auto" : "none"
830
+ }
831
+ }
832
+ )
833
+ ]
834
+ }
835
+ )
836
+ ]
837
+ }
838
+ );
839
+ }
840
+ function ci({
841
+ prefix: t,
842
+ items: n,
843
+ index: e,
844
+ imageDisplay: s,
845
+ isEditor: o,
846
+ isPreviewMode: m,
847
+ isEditMode: c,
848
+ onClose: L,
849
+ onPrev: q,
850
+ onNext: i,
851
+ counterClassName: v,
852
+ counterStyle: $,
853
+ closeIcon: O,
854
+ closeIconMaxWidth: M,
855
+ closeIconColor: T,
856
+ closeIconHoverColor: K,
857
+ iconMarginRight: w,
858
+ contentMarginTop: nt
859
+ }) {
860
+ const E = s === "cover", x = W(null), Q = W(null), d = W(null), g = W(null), S = W(0), D = W(0), _ = W("none"), F = W(!1), it = W(!1), I = W(null), b = W(0), z = W(null), U = W(!1), tt = W(null), ht = W(null), Bt = W(null), ne = W(() => {
861
+ }), [R, St] = G(null), [p, Et] = G(null), [Y, Wt] = G("opening"), [$t, Ot] = G(0), [dt, ct] = G(0), [Tt, It] = G(null), [Ut, Mt] = G(!1), [Xt, _t] = G(!1), [Ne, ge] = G(!1), [Ae, pe] = G(null), fe = W(e), ie = W(void 0), y = n[e], ze = y ? jt(y) : !1, re = y ? Vt(y) : !1, qt = Tt !== null, Yt = kt((l) => {
862
+ const C = l.currentTarget, H = C instanceof HTMLVideoElement ? { width: C.videoWidth, height: C.videoHeight } : { width: C.naturalWidth, height: C.naturalHeight };
863
+ !H.width || !H.height || pe(H);
864
+ }, []);
865
+ et(() => {
866
+ I.current = p;
867
+ }, [p]), et(() => {
868
+ const l = x.current;
869
+ if (!l) return;
870
+ const C = () => Et(dn(l));
871
+ C();
872
+ const H = new ResizeObserver(C);
873
+ return H.observe(l), () => H.disconnect();
874
+ }, []);
875
+ const Z = kt(() => {
876
+ tt.current !== null && (window.clearTimeout(tt.current), tt.current = null);
877
+ }, []), yt = kt(() => {
878
+ const l = ht.current;
879
+ ht.current = null, Z(), z.current = null, U.current = !1, It(null), Mt(!1), ct(0), b.current = 0, _t(!1), F.current = !1, D.current = 0, _.current = "none", l === 1 ? i() : l === -1 && q();
880
+ }, [Z, i, q]), Lt = kt(() => {
881
+ Z(), ht.current = null, z.current = null, U.current = !1, It(null), Mt(!1), ct(0), b.current = 0;
882
+ }, [Z]), $e = kt(() => {
883
+ Z(), tt.current = window.setTimeout(() => {
884
+ ht.current !== null && yt();
885
+ }, pt + 32);
886
+ }, [Z, yt]), Nt = kt((l, C) => {
887
+ var Dt;
888
+ const H = ((Dt = I.current) == null ? void 0 : Dt.width) ?? 0;
889
+ if (Z(), z.current = l, It(l), U.current = !0, Mt(!0), C) {
890
+ ht.current = l;
891
+ const wt = -l * H;
892
+ b.current = wt, ct(wt), $e();
893
+ return;
894
+ }
895
+ b.current = 0, ct(0), tt.current = window.setTimeout(() => {
896
+ tt.current = null, Lt();
897
+ }, pt + 32);
898
+ }, [Z, Lt, $e]), oe = kt((l) => {
899
+ if (!(n.length <= 1)) {
900
+ if (U.current) {
901
+ if (ht.current === l) {
902
+ Bt.current = l, yt();
903
+ return;
904
+ }
905
+ Lt();
906
+ }
907
+ Z(), z.current = l, It(l), U.current = !1, Mt(!1), b.current = 0, ct(0), requestAnimationFrame(() => {
908
+ requestAnimationFrame(() => {
909
+ Nt(l, !0);
910
+ });
911
+ });
912
+ }
913
+ }, [n.length, Nt, yt, Lt, Z]);
914
+ ne.current = oe;
915
+ const ye = kt((l) => {
916
+ l.propertyName !== "transform" || !U.current || ht.current !== null && yt();
917
+ }, [yt]), se = kt(() => {
918
+ const l = Q.current;
919
+ if (!l) return;
920
+ const C = dn(l);
921
+ !C.width || !C.height || St(C);
922
+ }, []);
923
+ et(() => {
924
+ se();
925
+ const l = Q.current;
926
+ if (!l) return;
927
+ const C = new ResizeObserver(() => se());
928
+ return C.observe(l), () => C.disconnect();
929
+ }, [se]), et(() => {
930
+ Y === "opening" && R && Wt("open");
931
+ }, [Y, R]), et(() => {
932
+ if (Y !== "closing") return;
933
+ const l = setTimeout(() => L(), pt);
934
+ return () => clearTimeout(l);
935
+ }, [Y, L]), et(() => () => {
936
+ Z();
937
+ }, [Z]), qe(() => {
938
+ fe.current === e && ie.current === (y == null ? void 0 : y.assetId) || (Z(), ht.current = null, It(null), Ot(0), ct(0), Mt(!1), ge(!1), _t(!1), pe(null), S.current = 0, D.current = 0, _.current = "none", F.current = !1, U.current = !1, b.current = 0, z.current = null, g.current = null, it.current = !1, fe.current = e, ie.current = y == null ? void 0 : y.assetId);
939
+ }, [e, y == null ? void 0 : y.assetId, Z]), qe(() => {
940
+ const l = Bt.current;
941
+ l !== null && (Bt.current = null, requestAnimationFrame(() => {
942
+ ne.current(l);
943
+ }));
944
+ }, [e, y == null ? void 0 : y.assetId]), et(() => {
945
+ if (Y !== "open") return;
946
+ let l = null;
947
+ const C = () => {
948
+ l && (document.removeEventListener("click", l, !0), l = null);
949
+ }, H = () => {
950
+ C(), l = (j) => {
951
+ j.stopPropagation(), j.preventDefault(), C();
952
+ }, document.addEventListener("click", l, !0);
953
+ }, Dt = (j) => {
954
+ const st = j < 0 ? 1 : -1;
955
+ if (Math.abs(j) > qn && n.length > 1) {
956
+ Nt(st, !0);
957
+ return;
958
+ }
959
+ Nt(st, !1);
960
+ }, wt = (j) => {
961
+ if (j.touches.length !== 1 || U.current) return;
962
+ const st = j.touches[0];
963
+ it.current = !0, g.current = { x: st.clientX, y: st.clientY }, _.current = "none", D.current = 0, F.current = !1;
964
+ }, Jt = (j) => {
965
+ if (!g.current || j.touches.length !== 1 || U.current) return;
966
+ const st = j.touches[0], lt = st.clientX - g.current.x, xt = st.clientY - g.current.y;
967
+ if (_.current === "none") {
968
+ if (Math.abs(lt) < 10 && Math.abs(xt) < 10) return;
969
+ if (Math.abs(lt) > Math.abs(xt)) {
970
+ if (n.length <= 1) return;
971
+ _.current = "horizontal";
972
+ } else if (xt > 0)
973
+ _.current = "vertical";
974
+ else
975
+ return;
976
+ }
977
+ if (_.current === "horizontal") {
978
+ F.current = !0, _t(!0), D.current = lt;
979
+ const de = lt < 0 ? 1 : -1;
980
+ z.current !== de && (z.current = de, It(de)), b.current = lt, ct(lt), j.preventDefault();
981
+ return;
982
+ }
983
+ _.current === "vertical" && (F.current = !0, _t(!0), S.current = xt, Ot(xt), j.preventDefault());
984
+ }, Ft = () => {
985
+ if (!g.current) return;
986
+ const j = _.current, st = F.current;
987
+ if (st && j === "horizontal")
988
+ Dt(D.current), H();
989
+ else if (st && j === "vertical")
990
+ if (S.current > Xn) {
991
+ const xt = window.innerHeight;
992
+ S.current = xt, ge(!0), Ot(xt), Wt("closing");
993
+ } else
994
+ S.current = 0, Ot(0), H();
995
+ else j === "horizontal" && Math.abs(D.current) > 0 && (Dt(D.current), H());
996
+ g.current = null, _.current = "none", D.current = 0, F.current = !1, _t(!1);
997
+ };
998
+ return document.addEventListener("touchstart", wt, { passive: !0 }), document.addEventListener("touchmove", Jt, { passive: !1 }), document.addEventListener("touchend", Ft), document.addEventListener("touchcancel", Ft), () => {
999
+ document.removeEventListener("touchstart", wt), document.removeEventListener("touchmove", Jt), document.removeEventListener("touchend", Ft), document.removeEventListener("touchcancel", Ft), C();
1000
+ };
1001
+ }, [Y, n.length, Nt]), et(() => {
1002
+ const l = (C) => {
1003
+ C.key === "Escape" && (C.preventDefault(), C.stopPropagation(), Y !== "closing" && Wt("closing"));
1004
+ };
1005
+ return window.addEventListener("keydown", l, !0), () => window.removeEventListener("keydown", l, !0);
1006
+ }, [Y]);
1007
+ const ve = () => {
1008
+ Y !== "closing" && Wt("closing");
1009
+ }, a = Y === "open", le = Y === "closing", ae = $t > 0 ? Math.max(0, 1 - $t / 500) : 1, rt = $t > 0 ? Math.max(0.35, 1 - $t / 500) : 1, ce = re && y ? { width: Ze(y), height: 1 } : Ae, N = R ? E ? R : ri(R, ce) : null, me = {
1010
+ position: "fixed",
1011
+ top: p == null ? void 0 : p.top,
1012
+ left: p == null ? void 0 : p.left,
1013
+ width: p == null ? void 0 : p.width,
1014
+ height: p == null ? void 0 : p.height,
1015
+ zIndex: 9998
1016
+ }, he = E ? "cover" : "contain", X = dt !== 0 || $t > 0 ? `translate(${dt}px, ${$t}px)` : void 0, Re = Xt && !Ut ? "none" : Ut ? `transform ${pt}ms ${Rt}` : Ne ? `transform ${pt}ms ${Rt}, opacity ${pt}ms ${Rt}` : Y === "opening" || le ? `opacity ${pt}ms ${Rt}` : "none", Gt = {
1017
+ ...me,
1018
+ transform: X,
1019
+ opacity: $t > 0 ? rt : Y === "opening" || le ? 0 : 1,
1020
+ transition: Re,
1021
+ pointerEvents: "none"
1022
+ }, Kt = {
1023
+ position: "absolute",
1024
+ top: ((N == null ? void 0 : N.top) ?? 0) - ((p == null ? void 0 : p.top) ?? 0),
1025
+ left: ((N == null ? void 0 : N.left) ?? 0) - ((p == null ? void 0 : p.left) ?? 0),
1026
+ width: N == null ? void 0 : N.width,
1027
+ height: N == null ? void 0 : N.height,
1028
+ objectFit: he,
1029
+ pointerEvents: "none"
1030
+ }, ut = (p == null ? void 0 : p.width) ?? 0, vt = qt ? (e + Tt + n.length) % n.length : null, ot = vt !== null ? n[vt] : null, we = {
1031
+ ...me,
1032
+ transform: qt ? `translateX(${Tt * ut + dt}px)` : void 0,
1033
+ opacity: 1,
1034
+ transition: Ut ? `transform ${pt}ms ${Rt}` : "none",
1035
+ pointerEvents: "none"
1036
+ }, Zt = {
1037
+ position: "absolute",
1038
+ top: ((R == null ? void 0 : R.top) ?? 0) - ((p == null ? void 0 : p.top) ?? 0),
1039
+ left: ((R == null ? void 0 : R.left) ?? 0) - ((p == null ? void 0 : p.left) ?? 0),
1040
+ width: R == null ? void 0 : R.width,
1041
+ height: R == null ? void 0 : R.height,
1042
+ objectFit: he,
1043
+ pointerEvents: "none"
1044
+ }, xe = re && y && Gn(y).controls && N ? Math.min(52, N.height * 0.2) : 0, be = N ? {
1045
+ position: "fixed",
1046
+ top: N.top,
1047
+ height: N.height - xe,
1048
+ width: N.width / 2,
1049
+ zIndex: 9999
1050
+ } : null;
1051
+ return /* @__PURE__ */ V(
1052
+ "div",
1053
+ {
1054
+ ref: x,
1055
+ className: [
1056
+ `${t}-lightbox`,
1057
+ o ? `${t}-lightbox-editor` : ""
1058
+ ].filter(Boolean).join(" "),
1059
+ style: {
1060
+ touchAction: Y === "open" ? "none" : void 0
1061
+ },
1062
+ onClick: ve,
1063
+ children: [
1064
+ /* @__PURE__ */ r(
1065
+ "div",
1066
+ {
1067
+ style: {
1068
+ position: "absolute",
1069
+ inset: 0,
1070
+ background: "rgba(28,31,34,0.9)",
1071
+ opacity: a ? ae : 0,
1072
+ transition: Xt ? "none" : `opacity ${pt}ms ${Rt}`,
1073
+ pointerEvents: "none"
1074
+ }
1075
+ }
1076
+ ),
1077
+ /* @__PURE__ */ r(
1078
+ "div",
1079
+ {
1080
+ style: {
1081
+ position: "relative",
1082
+ width: "100%",
1083
+ height: "100%",
1084
+ display: "flex",
1085
+ flexDirection: "column",
1086
+ alignItems: "center",
1087
+ justifyContent: "center"
1088
+ },
1089
+ children: E ? /* @__PURE__ */ V(ft, { children: [
1090
+ /* @__PURE__ */ r("div", { ref: Q, style: { position: "absolute", inset: 0 } }),
1091
+ /* @__PURE__ */ r(
1092
+ "div",
1093
+ {
1094
+ style: {
1095
+ position: "absolute",
1096
+ bottom: 0,
1097
+ left: 0,
1098
+ right: 0,
1099
+ display: "flex",
1100
+ flexDirection: "row",
1101
+ justifyContent: "center",
1102
+ alignItems: "center",
1103
+ height: "10%",
1104
+ opacity: a ? 1 : 0,
1105
+ transition: `opacity ${pt}ms ${Rt}`,
1106
+ pointerEvents: "none",
1107
+ zIndex: 9999
1108
+ },
1109
+ children: n.length > 1 && /* @__PURE__ */ V("p", { className: v, style: $, children: [
1110
+ e + 1,
1111
+ " / ",
1112
+ n.length
1113
+ ] })
1114
+ }
1115
+ )
1116
+ ] }) : /* @__PURE__ */ V(ft, { children: [
1117
+ /* @__PURE__ */ r("div", { style: { height: "10%" } }),
1118
+ /* @__PURE__ */ r(
1119
+ "div",
1120
+ {
1121
+ style: {
1122
+ width: "70%",
1123
+ height: "80%",
1124
+ display: "flex",
1125
+ justifyContent: "center",
1126
+ alignItems: "center"
1127
+ },
1128
+ children: /* @__PURE__ */ r("div", { ref: Q, style: { width: "100%", height: "100%" } })
1129
+ }
1130
+ ),
1131
+ /* @__PURE__ */ r(
1132
+ "div",
1133
+ {
1134
+ style: {
1135
+ display: "flex",
1136
+ flexDirection: "row",
1137
+ justifyContent: "center",
1138
+ alignItems: "center",
1139
+ height: "10%",
1140
+ opacity: a ? 1 : 0,
1141
+ transition: `opacity ${pt}ms ${Rt}`
1142
+ },
1143
+ children: n.length > 1 && /* @__PURE__ */ V("p", { className: v, style: $, children: [
1144
+ e + 1,
1145
+ " / ",
1146
+ n.length
1147
+ ] })
1148
+ }
1149
+ )
1150
+ ] })
1151
+ }
1152
+ ),
1153
+ R && p && ot && /* @__PURE__ */ r("div", { style: we, onTransitionEnd: ye, children: Vt(ot) ? /* @__PURE__ */ r(
1154
+ "img",
1155
+ {
1156
+ src: ot.thumbnail,
1157
+ alt: ot.name,
1158
+ style: Zt
1159
+ },
1160
+ `neighbor-${vt}-${ot.assetId}`
1161
+ ) : jt(ot) ? /* @__PURE__ */ r(
1162
+ "video",
1163
+ {
1164
+ src: ot.assetId,
1165
+ muted: !0,
1166
+ autoPlay: !0,
1167
+ loop: !0,
1168
+ playsInline: !0,
1169
+ preload: "auto",
1170
+ style: Zt
1171
+ },
1172
+ `neighbor-${vt}-${ot.assetId}`
1173
+ ) : /* @__PURE__ */ r(
1174
+ "img",
1175
+ {
1176
+ src: ot.assetId,
1177
+ alt: ot.name,
1178
+ style: Zt
1179
+ },
1180
+ `neighbor-${vt}-${ot.assetId}`
1181
+ ) }),
1182
+ R && p && y && /* @__PURE__ */ r("div", { style: Gt, onTransitionEnd: ye, children: re ? /* @__PURE__ */ r(
1183
+ pn,
1184
+ {
1185
+ media: y,
1186
+ fit: E ? "cover" : "contain",
1187
+ lazy: !1,
1188
+ startsAtOnce: !0,
1189
+ style: Kt
1190
+ },
1191
+ `${e}-${y.assetId}`
1192
+ ) : ze ? /* @__PURE__ */ r(
1193
+ oi,
1194
+ {
1195
+ src: y.assetId,
1196
+ mediaRef: d,
1197
+ mediaStyle: Kt,
1198
+ onLoadedMetadata: Yt
1199
+ },
1200
+ `${e}-${y.assetId}`
1201
+ ) : /* @__PURE__ */ r(
1202
+ "img",
1203
+ {
1204
+ ref: d,
1205
+ src: y.assetId,
1206
+ alt: y.name,
1207
+ onLoad: Yt,
1208
+ style: Kt
1209
+ },
1210
+ `${e}-${y.assetId}`
1211
+ ) }),
1212
+ a && be && n.length > 1 && /* @__PURE__ */ V(ft, { children: [
1213
+ /* @__PURE__ */ r(
1214
+ "div",
1215
+ {
1216
+ style: {
1217
+ ...be,
1218
+ left: N.left,
1219
+ cursor: "w-resize",
1220
+ pointerEvents: Xt ? "none" : "auto"
1221
+ },
1222
+ onClick: (l) => {
1223
+ if (it.current) {
1224
+ it.current = !1;
1225
+ return;
1226
+ }
1227
+ l.stopPropagation(), oe(-1);
1228
+ }
1229
+ }
1230
+ ),
1231
+ /* @__PURE__ */ r(
1232
+ "div",
1233
+ {
1234
+ style: {
1235
+ ...be,
1236
+ left: N.left + N.width / 2,
1237
+ cursor: "e-resize",
1238
+ pointerEvents: Xt ? "none" : "auto"
1239
+ },
1240
+ onClick: (l) => {
1241
+ if (it.current) {
1242
+ it.current = !1;
1243
+ return;
1244
+ }
1245
+ l.stopPropagation(), oe(1);
1246
+ }
1247
+ }
1248
+ )
1249
+ ] }),
1250
+ /* @__PURE__ */ r(
1251
+ ai,
1252
+ {
1253
+ prefix: t,
1254
+ closeIcon: O,
1255
+ closeIconMaxWidth: M,
1256
+ closeIconColor: T,
1257
+ closeIconHoverColor: K,
1258
+ iconMarginRight: w,
1259
+ contentMarginTop: nt,
1260
+ isEditor: o,
1261
+ isPreviewMode: m,
1262
+ isEditMode: c,
1263
+ visible: a,
1264
+ onClose: ve
1265
+ }
1266
+ )
1267
+ ]
1268
+ }
1269
+ );
1270
+ }
1271
+ function mi(t) {
1272
+ return typeof t == "string" ? t === "cover" ? "cover" : "fit" : (t == null ? void 0 : t.display) === "cover" ? "cover" : "fit";
1273
+ }
1274
+ function Ke(t, n) {
1275
+ return t.columnWidth * n + t.gutterWidth * Math.max(0, n - 1);
1276
+ }
1277
+ function hi(t) {
1278
+ return t.blocks.reduce((n, e) => Math.max(n, Math.max(0, e.top) + Math.max(0, e.height)), 0);
1279
+ }
1280
+ function bn(t) {
1281
+ return typeof t.verticalGap == "number" ? Math.max(0, t.verticalGap) : Math.max(0, (t.repeatHeight ?? 0) - hi(t));
1282
+ }
1283
+ function Sn(t, n) {
1284
+ const e = t.blocks[n % t.blocks.length], s = Math.min(Math.max(1, Math.round(e.span)), t.columnsCount), o = Math.min(Math.max(0, Math.round(e.column)), t.columnsCount - s);
1285
+ return {
1286
+ column: o,
1287
+ span: s,
1288
+ width: Ke(t, s),
1289
+ top: Math.max(0, e.top),
1290
+ height: Math.max(0, e.height),
1291
+ gridColumn: `${o + 1} / span ${s}`
1292
+ };
1293
+ }
1294
+ const Le = 1e-6;
1295
+ function di(t, n, e) {
1296
+ const s = t.beat ?? 0, o = s > 0 && !!e, m = (i) => Math.ceil(i / s - 1e-3) * s, c = [], L = [], q = bn(t);
1297
+ for (let i = 0; i < n; i += t.blocks.length) {
1298
+ i > 0 && q > 0 && c.push(q);
1299
+ const v = Array.from(
1300
+ { length: Math.min(t.blocks.length, n - i) },
1301
+ (d, g) => Sn(t, i + g)
1302
+ ), $ = v.map((d) => {
1303
+ const g = v.filter((S) => S.column < d.column + d.span && d.column < S.column + S.span && S.top >= d.top + d.height - Le);
1304
+ return g.length > 0 ? Math.min(...g.map((S) => S.top)) : void 0;
1305
+ }), O = [0, ...v.map((d) => d.top)].sort((d, g) => d - g).filter((d, g, S) => g === 0 || d - S[g - 1] > Le), M = (d, g) => Math.abs(d - g) <= Le, T = (d) => O.findIndex((g) => M(g, d)), K = [];
1306
+ let w = 0;
1307
+ const nt = (d) => {
1308
+ const g = v.flatMap((_, F) => d($[F]) ? [{ slot: _, entry: i + F }] : []);
1309
+ if (g.length === 0) return;
1310
+ if (!o) {
1311
+ c.push("auto");
1312
+ return;
1313
+ }
1314
+ const S = Math.max(...g.map(({ slot: _, entry: F }) => K[T(_.top)] + (e[F] ?? 0))), D = Math.max(0, m(S) - w);
1315
+ c.push(D), w += D;
1316
+ }, E = O.map((d, g) => (g > 0 && (c.push(d - O[g - 1]), w += d - O[g - 1]), nt((S) => S !== void 0 && M(S, d)), K.push(w), c.length + 1));
1317
+ nt((d) => d === void 0);
1318
+ const x = c.length + 1, Q = (d) => E[T(d)];
1319
+ v.forEach((d, g) => {
1320
+ const S = $[g];
1321
+ L.push(`${Q(d.top)} / ${S === void 0 ? x : Q(S)}`);
1322
+ });
1323
+ }
1324
+ return { tracks: c, gridRows: L };
1325
+ }
1326
+ function un(t) {
1327
+ return Vt(t) ? Ze(t) : t.width && t.height && t.width > 0 && t.height > 0 ? t.width / t.height : void 0;
1328
+ }
1329
+ function ui(t, n, e) {
1330
+ const s = t.blocks.length, o = bn(t), m = t.masonry === "on", c = [], L = [], q = (v) => v.reduce(($, O) => Math.max($, O.bottom), 0);
1331
+ let i = 0;
1332
+ for (let v = 0; v < n.length; v += s) {
1333
+ const $ = v / s, O = Array.from({ length: Math.min(s, n.length - v) }, (M, T) => v + T).sort((M, T) => n[M].top - n[T].top || M - T);
1334
+ for (const M of O) {
1335
+ const T = n[M], K = (x) => x.column < T.column + T.span && T.column < x.column + x.span, w = O.filter((x) => x !== M && c[x] !== void 0 && K(n[x]) && n[x].top + n[x].height <= T.top + Le), nt = m ? L.filter((x) => x.group < $ && K(x)) : [], E = w.map((x) => c[x] + e[x] + T.top - (n[x].top + n[x].height));
1336
+ nt.length > 0 && E.push(q(nt) + o), E.length === 0 && E.push(i + T.top), c[M] = Math.max(...E), L.push({ column: T.column, span: T.span, bottom: c[M] + e[M], group: $ });
1337
+ }
1338
+ i = q(L) + o;
1339
+ }
1340
+ return { tops: c, bottom: q(L) };
1341
+ }
1342
+ function Mi({ settings: t, content: n, isEditor: e, isPreviewMode: s, isEditMode: o, metadata: m, activeEvent: c, layoutId: L, portalId: q }) {
1343
+ const { prefix: i } = _n(), {
1344
+ type: v = "a",
1345
+ gridLayout: $,
1346
+ customGrid: O,
1347
+ textBoxWidth: M = 100,
1348
+ verticalGap: T,
1349
+ entriesCount: K,
1350
+ lightbox: w,
1351
+ imageDisplay: nt,
1352
+ imageCorners: E,
1353
+ lightboxImageDisplay: x,
1354
+ slider: Q,
1355
+ sliderTiming: d,
1356
+ direction: g,
1357
+ transition: S,
1358
+ titleMarginTop: D,
1359
+ subtitleMarginTop: _,
1360
+ titleColor: F,
1361
+ subtitleColor: it,
1362
+ lightboxCounterColor: I,
1363
+ titleFontFamily: b,
1364
+ titleFontSettings: z,
1365
+ titleFontSize: U,
1366
+ titleLineHeight: tt,
1367
+ titleLetterSpacing: ht,
1368
+ titleWordSpacing: Bt,
1369
+ titleTextAppearance: ne,
1370
+ subtitleFontFamily: R,
1371
+ subtitleFontSettings: St,
1372
+ subtitleFontSize: p,
1373
+ subtitleLineHeight: Et,
1374
+ subtitleLetterSpacing: Y,
1375
+ subtitleWordSpacing: Wt,
1376
+ subtitleTextAppearance: $t,
1377
+ lightboxCounterFontFamily: Ot,
1378
+ lightboxCounterFontSettings: dt,
1379
+ lightboxCounterFontSize: ct,
1380
+ lightboxCounterLineHeight: Tt,
1381
+ lightboxCounterLetterSpacing: It,
1382
+ lightboxCounterWordSpacing: Ut,
1383
+ lightboxCounterTextAppearance: Mt,
1384
+ closeIcon: Xt,
1385
+ closeIconMaxWidth: _t,
1386
+ closeIconColor: Ne,
1387
+ closeIconHoverColor: ge,
1388
+ iconMarginRight: Ae,
1389
+ contentMarginTop: pe,
1390
+ showText: fe = "always",
1391
+ hover: ie = "none",
1392
+ alignEntries: y = "off",
1393
+ align: ze = "top",
1394
+ textGrowth: re = "inside"
1395
+ } = t, qt = mt(() => ({
1396
+ ...je(Ve({
1397
+ fontSettings: {
1398
+ fontFamily: b,
1399
+ fontWeight: (z == null ? void 0 : z.fontWeight) ?? 400,
1400
+ fontStyle: (z == null ? void 0 : z.fontStyle) ?? "normal"
1401
+ },
1402
+ fontSize: U ?? 0.01,
1403
+ lineHeight: tt,
1404
+ letterSpacing: ht ?? 0,
1405
+ wordSpacing: Bt ?? 0,
1406
+ textAppearance: ne,
1407
+ color: F
1408
+ }, e)),
1409
+ ...Ee(U, tt, i, e)
1410
+ }), [
1411
+ b,
1412
+ z,
1413
+ U,
1414
+ tt,
1415
+ ht,
1416
+ Bt,
1417
+ ne,
1418
+ F,
1419
+ e,
1420
+ i
1421
+ ]), Yt = mt(() => ({
1422
+ ...je(Ve({
1423
+ fontSettings: {
1424
+ fontFamily: R,
1425
+ fontWeight: (St == null ? void 0 : St.fontWeight) ?? 400,
1426
+ fontStyle: (St == null ? void 0 : St.fontStyle) ?? "normal"
1427
+ },
1428
+ fontSize: p ?? 0.01,
1429
+ lineHeight: Et,
1430
+ letterSpacing: Y ?? 0,
1431
+ wordSpacing: Wt ?? 0,
1432
+ textAppearance: $t,
1433
+ color: it
1434
+ }, e)),
1435
+ ...Ee(p, Et, i, e)
1436
+ }), [
1437
+ R,
1438
+ St,
1439
+ p,
1440
+ Et,
1441
+ Y,
1442
+ Wt,
1443
+ $t,
1444
+ it,
1445
+ e,
1446
+ i
1447
+ ]), Z = mt(() => ({
1448
+ ...je(Ve({
1449
+ fontSettings: {
1450
+ fontFamily: Ot,
1451
+ fontWeight: (dt == null ? void 0 : dt.fontWeight) ?? 400,
1452
+ fontStyle: (dt == null ? void 0 : dt.fontStyle) ?? "normal"
1453
+ },
1454
+ fontSize: ct ?? 0.01,
1455
+ lineHeight: Tt,
1456
+ letterSpacing: It ?? 0,
1457
+ wordSpacing: Ut ?? 0,
1458
+ textAppearance: Mt,
1459
+ color: I
1460
+ }, e)),
1461
+ ...Ee(ct, Tt, i, e)
1462
+ }), [
1463
+ Ot,
1464
+ dt,
1465
+ ct,
1466
+ Tt,
1467
+ It,
1468
+ Ut,
1469
+ Mt,
1470
+ I,
1471
+ e,
1472
+ i
1473
+ ]), yt = Be(
1474
+ U,
1475
+ tt,
1476
+ `${i}-item-title`,
1477
+ `${i}-text-tight-leading`
1478
+ ), Lt = Be(
1479
+ p,
1480
+ Et,
1481
+ `${i}-item-subtitle`,
1482
+ `${i}-text-tight-leading`
1483
+ ), $e = Be(
1484
+ ct,
1485
+ Tt,
1486
+ `${i}-lightbox-counter`,
1487
+ `${i}-text-tight-leading`
1488
+ ), Nt = mt(() => On(i, {
1489
+ titleColor: F,
1490
+ subtitleColor: it,
1491
+ lightboxCounterColor: I
1492
+ }, gi, pi), [i, F, it, I]), oe = c && c !== "default" ? `${i}-state-${c}` : "", ye = fe === "on hover" && (!e || s), se = ie !== "none" && (!e || s) ? ` ${i}-hover-${ie}` : "", ve = `${oe}${ye ? ` ${i}-show-text-hover` : ""}${se}`.trim(), a = O && Array.isArray(O.blocks) && O.blocks.length > 0 ? O : void 0, le = a || K === 0 ? 1 / 0 : K, ae = !!a && re === "outside", rt = (a == null ? void 0 : a.cellHeight) === "auto", ce = rt || (a == null ? void 0 : a.masonry) === "on", N = W([]), [me, he] = G([]), X = mt(() => (n ?? []).slice(0, le), [n, le]), Re = mt(
1493
+ () => w === "on" ? Jn(X) : [],
1494
+ [X, w]
1495
+ ), Gt = mt(() => X.map((h) => {
1496
+ const u = vn(h.gallery), k = u.filter((A) => A.lightboxMedia).map((A) => A.lightboxMedia), B = u.map(({ lightboxMedia: A }) => A ? k.findIndex((bt) => bt.assetId === A.assetId) : -1);
1497
+ return { displayItems: u, lightboxItemsForEntry: k, lightboxIndexes: B };
1498
+ }), [X]), Kt = ($ == null ? void 0 : $.entryWidth) ?? 0.2, ut = typeof nt == "string" ? { display: nt } : nt, vt = (ut == null ? void 0 : ut.display) === "cover", ot = (ut == null ? void 0 : ut.ratioValue) ?? "1:1", we = (ut == null ? void 0 : ut.reversed) ?? !1, [Zt, xe] = ot.split(":").map(Number), C = `${we ? xe : Zt} / ${we ? Zt : xe}`, H = ($ == null ? void 0 : $.columnsCount) ?? 1, Dt = f(Kt ?? 0, e), wt = Q !== "off" && (a ? rt : !vt), Jt = X.length % H || H, Ft = !a && Jt < H && X.length > 0, j = X.length - Jt, st = Ft ? Math.floor((H - Jt) / 2) + 1 : 1, lt = E ? f(E, e) : void 0, xt = (h, u, k) => ({
1499
+ width: h,
1500
+ ...u && rt ? {
1501
+ // an entry with no media keeps the drawn height, so it can still be seen and filled
1502
+ height: k != null && k.isEmpty ? f(u.height, e) : "auto",
1503
+ flexShrink: 0,
1504
+ overflow: "hidden",
1505
+ ...k != null && k.aspect && !wt ? { aspectRatio: `${k.aspect}` } : {}
1506
+ } : u ? ae ? { height: f(u.height, e), flexShrink: 0, overflow: "hidden" } : { flex: "1 1 0%", minHeight: 0, overflow: "hidden" } : vt ? { aspectRatio: C, height: "auto", overflow: "hidden" } : { height: "auto" },
1507
+ ...lt ? { borderRadius: lt, overflow: "hidden" } : {}
1508
+ }), de = `${i}-item-image-wrapper${wt ? ` ${i}-item-image-wrapper-fit-slider` : ""}`.trim(), At = v === "d" || v === "e" || v === "f", Ct = !a && y === "on", We = lt ? { borderRadius: lt, [$n]: lt } : {}, Oe = rt ? {
1509
+ objectFit: wt && !vt ? "contain" : "cover",
1510
+ pointerEvents: "auto",
1511
+ width: "100%",
1512
+ height: "100%",
1513
+ maxWidth: "100%",
1514
+ ...We
1515
+ } : vt ? {
1516
+ objectFit: "cover",
1517
+ pointerEvents: "auto",
1518
+ width: "100%",
1519
+ height: "100%",
1520
+ maxWidth: "100%",
1521
+ ...We
1522
+ } : {
1523
+ objectFit: "contain",
1524
+ pointerEvents: "auto",
1525
+ width: "auto",
1526
+ height: "auto",
1527
+ maxWidth: "100%",
1528
+ ...a ? { maxHeight: "100%" } : {},
1529
+ ...We
1530
+ }, _e = ((a == null ? void 0 : a.beat) ?? 0) > 0 || ce, Ge = a ? Ke(a, a.columnsCount) : 0;
1531
+ qe(() => {
1532
+ if (!_e) {
1533
+ he((A) => A.length > 0 ? [] : A);
1534
+ return;
1535
+ }
1536
+ const h = Ie.current, u = N.current.slice(0, X.length), k = () => {
1537
+ const A = h && Ge > 0 ? h.offsetWidth / Ge : 0;
1538
+ if (A <= 0) return;
1539
+ const bt = u.map((at) => at ? at.offsetHeight / A : 0);
1540
+ he((at) => at.length === bt.length && at.every((P, gt) => Math.abs(P - bt[gt]) < 1e-5) ? at : bt);
1541
+ };
1542
+ k();
1543
+ const B = new ResizeObserver(k);
1544
+ return h && B.observe(h), u.forEach((A) => A && B.observe(A)), () => B.disconnect();
1545
+ }, [_e, X.length, Ge, i]);
1546
+ const Qt = _e && me.length === X.length ? me : void 0, Pt = mt(() => {
1547
+ if (!a) return;
1548
+ const h = di(a, X.length, Qt);
1549
+ return {
1550
+ gridRows: h.gridRows,
1551
+ gridTemplateRows: h.tracks.length ? h.tracks.map((u) => u === "auto" ? "auto" : f(u, e)).join(" ") : "auto"
1552
+ };
1553
+ }, [a, X.length, Qt, e]), Ht = mt(
1554
+ () => a ? X.map((h, u) => Sn(a, u)) : void 0,
1555
+ [a, X.length]
1556
+ ), In = mt(
1557
+ () => Gt.map(({ displayItems: h }) => rt && h.length > 0 ? un(h[0].displayMedia) : void 0),
1558
+ [Gt, rt]
1559
+ ), Se = mt(() => {
1560
+ if (!a || !Ht || !ce) return;
1561
+ const h = a.beat ?? 0, u = Ht.map((k, B) => {
1562
+ const bt = Gt[B].displayItems.map(({ displayMedia: gt }) => un(gt)).filter((gt) => gt !== void 0), at = rt && bt.length > 0 ? Math.max(...bt.map((gt) => k.width / gt)) : k.height, P = (Qt == null ? void 0 : Qt[B]) ?? at;
1563
+ return h > 0 ? Math.ceil(P / h - 1e-3) * h : P;
1564
+ });
1565
+ return ui(a, Ht, u);
1566
+ }, [a, Ht, ce, rt, Gt, Qt]), Cn = a ? {
1567
+ gridTemplateColumns: `repeat(${a.columnsCount}, ${f(a.columnWidth, e)})`,
1568
+ gridTemplateRows: (Pt == null ? void 0 : Pt.gridTemplateRows) ?? "auto",
1569
+ rowGap: 0,
1570
+ columnGap: f(a.gutterWidth, e),
1571
+ width: f(Ke(a, a.columnsCount), e),
1572
+ ...Se ? { position: "relative", height: f(Se.bottom, e) } : {}
1573
+ } : {
1574
+ gridTemplateColumns: `repeat(${H}, ${Dt})`,
1575
+ rowGap: Ct ? 0 : f(T ?? 0, e),
1576
+ columnGap: f(($ == null ? void 0 : $.horizontalGap) ?? 0, e),
1577
+ width: f(($ == null ? void 0 : $.wrapperWidth) ?? 0, e),
1578
+ ...Ct ? { [`--${i}-align-entries-row-gap`]: f(T ?? 0, e) } : {}
1579
+ }, Ie = W(null), kn = () => {
1580
+ const h = { ...Nt }, u = Ie.current ? getComputedStyle(Ie.current).getPropertyValue("--cntrl-article-width").trim() : "";
1581
+ return u && (h["--cntrl-article-width"] = u), h;
1582
+ }, [De, Fe] = G(!1), [Ce, Tn] = G([]), [Mn, He] = G(0), Je = w === "on" && (!e || s), Qe = (h, u) => {
1583
+ e && !s || w !== "off" && (Tn(h), He(u), Fe(!0));
1584
+ };
1585
+ et(() => {
1586
+ if (!De || w !== "on" || typeof document > "u") return;
1587
+ const h = document.body.style.overflow;
1588
+ return document.body.style.overflow = "hidden", () => {
1589
+ document.body.style.overflow = h;
1590
+ };
1591
+ }, [De, w]), et(() => {
1592
+ !e || s || Fe(!1);
1593
+ }, [e, s]);
1594
+ const Ln = mt(() => Bn(i), [i]);
1595
+ return /* @__PURE__ */ V(ft, { children: [
1596
+ /* @__PURE__ */ r("style", { dangerouslySetInnerHTML: { __html: Ln } }),
1597
+ w === "on" && /* @__PURE__ */ r(Qn, { mediaList: Re }),
1598
+ /* @__PURE__ */ r("div", { style: Nt, children: /* @__PURE__ */ r(
1599
+ "div",
1600
+ {
1601
+ ref: Ie,
1602
+ className: `${i}-wrapper ${i}-type-${v}${Ct ? ` ${i}-align-entries` : ""}${a ? ` ${i}-custom-layout` : ""}${ae ? ` ${i}-text-outside` : ""}${rt ? ` ${i}-auto-height` : ""} ${i}-image-align-${a ? "top" : ze} ${ve}`.trim(),
1603
+ style: Cn,
1604
+ children: X.map((h, u) => {
1605
+ var ln;
1606
+ const k = cn(h.title), B = cn(h.subtitle), A = w === "off" && ((ln = h.link) != null && ln.value) ? h.link : void 0, bt = Math.floor(u / H) === Math.ceil(X.length / H) - 1, at = Ft && u >= j ? `${st + (u - j)}` : void 0, P = Ht == null ? void 0 : Ht[u], gt = (P == null ? void 0 : P.width) ?? Kt, ue = f(gt, e), te = `calc(${ue} * (${M} / 100))`, zt = f(gt * M / 100, e), { displayItems: ee, lightboxItemsForEntry: Pe, lightboxIndexes: tn } = Gt[u], en = Q === "off" ? In[u] : void 0, Nn = xt(
1607
+ ue,
1608
+ P,
1609
+ { aspect: en, isEmpty: ee.length === 0 }
1610
+ ), An = rt && Q === "off" && !en ? { ...Oe, height: "auto" } : Oe, zn = P && a && Se ? {
1611
+ position: "absolute",
1612
+ left: f(P.column * (a.columnWidth + a.gutterWidth), e),
1613
+ top: f(Se.tops[u], e),
1614
+ width: ue
1615
+ } : P ? {
1616
+ gridColumn: P.gridColumn,
1617
+ gridRow: Pt == null ? void 0 : Pt.gridRows[u],
1618
+ alignSelf: "start"
1619
+ } : at && !Ct ? { gridColumn: at } : void 0, nn = At ? /* @__PURE__ */ V("div", { className: `${i}-item-text-block`, children: [
1620
+ k && /* @__PURE__ */ r("p", { className: yt, style: { width: te, ...qt }, children: h.title }),
1621
+ k && /* @__PURE__ */ r(
1622
+ "div",
1623
+ {
1624
+ "data-controls": o ? "titleMarginTop" : void 0,
1625
+ className: o ? `${i}-control` : void 0,
1626
+ style: {
1627
+ height: f(D ?? 0, e),
1628
+ width: zt
1629
+ }
1630
+ }
1631
+ ),
1632
+ B && /* @__PURE__ */ r("p", { className: Lt, style: { width: te, ...Yt }, children: h.subtitle }),
1633
+ B && /* @__PURE__ */ r(
1634
+ "div",
1635
+ {
1636
+ "data-controls": o ? "subtitleMarginTop" : void 0,
1637
+ className: o ? `${i}-control` : void 0,
1638
+ style: {
1639
+ height: f(_ ?? 0, e),
1640
+ width: zt
1641
+ }
1642
+ }
1643
+ )
1644
+ ] }) : null, Rn = Ct ? /* @__PURE__ */ V("div", { className: `${i}-item-title-row`, children: [
1645
+ !At && /* @__PURE__ */ r(
1646
+ "div",
1647
+ {
1648
+ "data-controls": o && k ? "titleMarginTop" : void 0,
1649
+ className: o && k ? `${i}-control` : void 0,
1650
+ style: {
1651
+ height: k ? f(D ?? 0, e) : 0,
1652
+ width: zt
1653
+ }
1654
+ }
1655
+ ),
1656
+ k && /* @__PURE__ */ r("p", { className: yt, style: { width: te, ...qt }, children: h.title }),
1657
+ At && k && /* @__PURE__ */ r(
1658
+ "div",
1659
+ {
1660
+ "data-controls": o ? "titleMarginTop" : void 0,
1661
+ className: o ? `${i}-control` : void 0,
1662
+ style: {
1663
+ height: f(D ?? 0, e),
1664
+ width: zt
1665
+ }
1666
+ }
1667
+ )
1668
+ ] }) : null, Wn = Ct ? /* @__PURE__ */ V("div", { className: `${i}-item-subtitle-row`, children: [
1669
+ !At && /* @__PURE__ */ r(
1670
+ "div",
1671
+ {
1672
+ "data-controls": o && B ? "subtitleMarginTop" : void 0,
1673
+ className: o && B ? `${i}-control` : void 0,
1674
+ style: {
1675
+ height: B ? f(_ ?? 0, e) : 0,
1676
+ width: zt
1677
+ }
1678
+ }
1679
+ ),
1680
+ B && /* @__PURE__ */ r("p", { className: Lt, style: { width: te, ...Yt }, children: h.subtitle }),
1681
+ At && B && /* @__PURE__ */ r(
1682
+ "div",
1683
+ {
1684
+ "data-controls": o ? "subtitleMarginTop" : void 0,
1685
+ className: o ? `${i}-control` : void 0,
1686
+ style: {
1687
+ height: f(_ ?? 0, e),
1688
+ width: zt
1689
+ }
1690
+ }
1691
+ )
1692
+ ] }) : null, rn = /* @__PURE__ */ V(Me, { link: A, className: `${i}-item-text-link`, children: [
1693
+ Rn,
1694
+ Wn
1695
+ ] }), ke = /* @__PURE__ */ r(ii, { className: de, style: Nn, children: ee.length === 0 ? null : Q === "off" ? (() => {
1696
+ const { displayMedia: J } = ee[0], Te = tn[0];
1697
+ return /* @__PURE__ */ r(
1698
+ hn,
1699
+ {
1700
+ media: J,
1701
+ className: `${i}-item-${jt(J) ? "video" : "image"}`.trim(),
1702
+ style: An,
1703
+ hasLightbox: w === "on",
1704
+ onMediaClick: Je && Te >= 0 ? () => Qe(Pe, Te) : void 0
1705
+ }
1706
+ );
1707
+ })() : /* @__PURE__ */ V(ft, { children: [
1708
+ wt && /* @__PURE__ */ r("div", { className: `${i}-item-image-wrapper-sizer`, "aria-hidden": "true", children: ee.map(({ displayMedia: J }) => Vt(J) ? /* @__PURE__ */ r("div", { style: { aspectRatio: `${Ze(J)}` } }, `sizer-${J.assetId}`) : jt(J) ? /* @__PURE__ */ r(fn, { src: J.assetId, nearPreload: "metadata", muted: !0, playsInline: !0 }, `sizer-${J.assetId}`) : /* @__PURE__ */ r("img", { src: J.assetId, alt: "" }, `sizer-${J.assetId}`)) }),
1709
+ /* @__PURE__ */ r(
1710
+ ni,
1711
+ {
1712
+ prefix: i,
1713
+ isFade: S === "fade",
1714
+ direction: g,
1715
+ intervalMs: d * 1e3,
1716
+ slides: ee.map(({ displayMedia: J }, Te) => {
1717
+ const an = tn[Te];
1718
+ return /* @__PURE__ */ r(
1719
+ hn,
1720
+ {
1721
+ media: J,
1722
+ className: `${i}-item-${jt(J) ? "video" : "image"}`.trim(),
1723
+ style: Oe,
1724
+ hasLightbox: w === "on",
1725
+ isSliderSlide: !0,
1726
+ onMediaClick: Je && an >= 0 ? () => Qe(Pe, an) : void 0
1727
+ }
1728
+ );
1729
+ })
1730
+ },
1731
+ `${S}-${gt}-${g}-${d}-${L}-${ee.length}`
1732
+ )
1733
+ ] }) }), on = At ? null : /* @__PURE__ */ V(ft, { children: [
1734
+ /* @__PURE__ */ r(
1735
+ "div",
1736
+ {
1737
+ "data-controls": o && k ? "titleMarginTop" : void 0,
1738
+ className: o && k ? `${i}-control` : void 0,
1739
+ style: {
1740
+ height: k ? f(D ?? 0, e) : 0,
1741
+ width: zt
1742
+ }
1743
+ }
1744
+ ),
1745
+ /* @__PURE__ */ r(
1746
+ "p",
1747
+ {
1748
+ className: yt,
1749
+ style: { width: te, ...qt },
1750
+ children: h.title
1751
+ }
1752
+ ),
1753
+ /* @__PURE__ */ r(
1754
+ "div",
1755
+ {
1756
+ "data-controls": o && B ? "subtitleMarginTop" : void 0,
1757
+ className: o && B ? `${i}-control` : void 0,
1758
+ style: {
1759
+ height: B ? f(_ ?? 0, e) : 0,
1760
+ width: zt
1761
+ }
1762
+ }
1763
+ ),
1764
+ /* @__PURE__ */ r(
1765
+ "p",
1766
+ {
1767
+ className: Lt,
1768
+ style: { width: te, ...Yt },
1769
+ children: h.subtitle
1770
+ }
1771
+ )
1772
+ ] }), sn = A ? /* @__PURE__ */ r(Me, { link: A, className: `${i}-item-image-link`, children: ke }) : /* @__PURE__ */ r("a", { className: `${i}-item-image-link`, children: ke });
1773
+ return /* @__PURE__ */ r(
1774
+ "div",
1775
+ {
1776
+ className: `${i}-item`.trim(),
1777
+ style: zn,
1778
+ children: /* @__PURE__ */ r(
1779
+ "div",
1780
+ {
1781
+ ref: (J) => {
1782
+ N.current[u] = J;
1783
+ },
1784
+ className: `${o ? `${i}-item-inner` : `${i}-item-inner-hidden`}${Ct && bt ? ` ${i}-item-inner-last-row` : ""}`.trim(),
1785
+ style: {
1786
+ width: (M ?? 0) > 100 ? `calc(${ue} * (${M} / 100))` : ue,
1787
+ ...P && !ae && !rt ? { height: f(P.height, e) } : {},
1788
+ ...at && Ct ? { gridColumn: at } : {}
1789
+ },
1790
+ children: Ct ? /* @__PURE__ */ r(ft, { children: At ? /* @__PURE__ */ V(ft, { children: [
1791
+ rn,
1792
+ sn
1793
+ ] }) : /* @__PURE__ */ V(ft, { children: [
1794
+ sn,
1795
+ rn
1796
+ ] }) }) : A ? /* @__PURE__ */ V(ft, { children: [
1797
+ /* @__PURE__ */ V(Me, { link: A, className: `${i}-item-image-link`, children: [
1798
+ nn,
1799
+ ke
1800
+ ] }),
1801
+ !At && /* @__PURE__ */ r(Me, { link: A, className: `${i}-item-text-link`, children: on })
1802
+ ] }) : /* @__PURE__ */ V(ft, { children: [
1803
+ nn,
1804
+ ke,
1805
+ on
1806
+ ] })
1807
+ }
1808
+ )
1809
+ },
1810
+ u
1811
+ );
1812
+ })
1813
+ }
1814
+ ) }),
1815
+ (!e || s) && De && typeof document < "u" && w === "on" && (() => {
1816
+ const h = (q ? document.getElementById(q) : null) ?? document.body;
1817
+ return Fn(
1818
+ /* @__PURE__ */ r("div", { style: kn(), "data-selection": "none", children: /* @__PURE__ */ r(
1819
+ ci,
1820
+ {
1821
+ prefix: i,
1822
+ items: Ce,
1823
+ index: Mn,
1824
+ imageDisplay: mi(x),
1825
+ isEditor: e,
1826
+ isPreviewMode: s,
1827
+ isEditMode: o,
1828
+ closeIcon: Xt,
1829
+ closeIconMaxWidth: _t,
1830
+ closeIconColor: Ne,
1831
+ closeIconHoverColor: ge,
1832
+ iconMarginRight: Ae,
1833
+ contentMarginTop: pe,
1834
+ onClose: () => Fe(!1),
1835
+ onPrev: () => He((u) => (u - 1 + Ce.length) % Ce.length),
1836
+ onNext: () => He((u) => (u + 1) % Ce.length),
1837
+ counterClassName: $e,
1838
+ counterStyle: Z
1839
+ }
1840
+ ) }),
1841
+ h
1842
+ );
1843
+ })()
1844
+ ] });
1845
+ }
1846
+ const gi = {
1847
+ titleColor: "title-color",
1848
+ subtitleColor: "subtitle-color",
1849
+ lightboxCounterColor: "lightbox-counter-color"
1850
+ }, pi = ["hover", "focus", "filled", "success", "error"];
1851
+ export {
1852
+ Mi as Grid
1853
+ };