@cntrl-site/components 1.0.119 → 1.0.120-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1865 @@
1
+ import { jsxs as E, Fragment as ft, jsx as r } from "react/jsx-runtime";
2
+ import { s as y } from "./scalingValue-C9JH5L6O.mjs";
3
+ import { b as Gn } from "./buildColorVars-CLyWQm5K.mjs";
4
+ import { u as _n } from "./useScopedStyles-DhBG3557.mjs";
5
+ import { u as pn } from "./useLazyVideos-CxXyEjRQ.mjs";
6
+ import { L as Le } from "./LinkWrapper-5kQHiGJQ.mjs";
7
+ import { i as Vt, g as Ze, E as fn, a as On } from "./EmbedMediaFrame-DwHeOAy5.mjs";
8
+ import { useMemo as mt, useRef as G, useState as D, 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 $n } from "./LazyVideo-CdAWymKO.mjs";
13
+ function jn(t) {
14
+ return `calc(var(--cntrl-article-width, 100vw) * ${t / 1440})`;
15
+ }
16
+ function mn(t) {
17
+ return ((t == null ? void 0 : t.trim().length) ?? 0) > 0;
18
+ }
19
+ function Ee(t, n, e, s) {
20
+ return n !== void 0 && n < (t ?? 0.01) ? `${e} ${s}` : e;
21
+ }
22
+ function Be(t, n, e, s) {
23
+ const o = t ?? 0.01;
24
+ return n === void 0 || n >= o ? {} : {
25
+ [`--${e}-title-leading-gap`]: y((o - n) / 2, s)
26
+ };
27
+ }
28
+ const Ue = 400, Xe = "cubic-bezier(0.25, 0.1, 0.25, 1)", Vn = 1.1, yn = "--grid-media-radius";
29
+ function En(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 ${vn};
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(${yn}, 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 Bn() {
477
+ return Math.random() < 0.5 ? "ltr" : "ttb";
478
+ }
479
+ function hn(t, n) {
480
+ return n <= 0 ? 0 : (t % n + n) % n;
481
+ }
482
+ const pt = 500, Ye = 750, vn = "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 wn(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 = wn(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] = D(null);
526
+ pn(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 xn = "cntrl-grid-slide", bn = "cntrl-grid-slide-playing", ti = `.${xn} video`;
565
+ function ei(t) {
566
+ return t.closest(`.${bn}`) !== null;
567
+ }
568
+ function ni({ prefix: t, slides: n, isFade: e, direction: s, intervalMs: o }) {
569
+ const m = n.length, c = !e && m > 1, w = !e && s === "random", _ = Number.isFinite(o) && o > 0 ? o : Un, [i, p] = D(c ? 1 : 0), [f, x] = D(!e && s === "vertical" ? "ttb" : "ltr"), [C, N] = D(!1), [K, b] = D(!1), [nt, U] = D(0), S = G(!1);
570
+ et(() => {
571
+ if (m < 2) return;
572
+ const T = window.setTimeout(() => {
573
+ if (S.current) {
574
+ U((I) => I + 1);
575
+ return;
576
+ }
577
+ S.current = !0, N(!0), b(!1), p((I) => c ? I + 1 : hn(I + 1, m)), w || U((I) => I + 1);
578
+ }, _);
579
+ return () => window.clearTimeout(T);
580
+ }, [m, nt, _, c, w]), et(() => {
581
+ if (!C) return;
582
+ const T = window.setTimeout(() => {
583
+ const I = c && i === m + 1, R = w ? Bn() : f;
584
+ (I || R !== f) && (b(!0), I && p(1), x(R)), S.current = !1, N(!1), w && U((X) => X + 1);
585
+ }, Ye);
586
+ return () => window.clearTimeout(T);
587
+ }, [f, m, c, C, w, i]), et(() => {
588
+ if (!K) return;
589
+ let T = 0;
590
+ const I = requestAnimationFrame(() => {
591
+ T = requestAnimationFrame(() => b(!1));
592
+ });
593
+ return () => {
594
+ cancelAnimationFrame(I), cancelAnimationFrame(T);
595
+ };
596
+ }, [K]);
597
+ const Q = c ? m + 2 : m, d = (T) => c ? hn(T - 1, m) : T, g = (T) => c && (T === 0 || T === m + 1), k = d(i), F = i + 1 < Q ? i + 1 : -1, O = (T) => e || T === i && !g(T) || T === F || F >= 0 && !g(T) && d(T) === d(F), H = !e && f === "ttb", it = e ? void 0 : {
598
+ transform: H ? `translate3d(0, ${-i * 100}%, 0)` : `translate3d(${-i * 100}%, 0, 0)`,
599
+ transition: K ? "none" : `transform ${Ye}ms ${vn}`
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` : ""}${H ? ` ${t}-item-slider-list-vertical` : ""}`,
605
+ style: it,
606
+ children: Array.from({ length: Q }, (T, I) => {
607
+ const R = d(I), X = g(I), tt = e ? R === k : I === i;
608
+ return /* @__PURE__ */ r(
609
+ "div",
610
+ {
611
+ className: `${t}-item-slide ${xn}${e && tt ? ` ${t}-item-slide-active` : ""}${O(I) ? ` ${bn}` : ""}`,
612
+ "aria-hidden": tt ? void 0 : !0,
613
+ children: n[R]
614
+ },
615
+ X ? `clone-${I === 0 ? "start" : "end"}` : `slide-${R}`
616
+ );
617
+ })
618
+ }
619
+ ) });
620
+ }
621
+ function dn({
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
+ fn,
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($n, { ...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] = D(null);
679
+ return pn(s, { autoPlay: !0, selector: ti, shouldPlay: ei }), /* @__PURE__ */ r("div", { ref: o, className: t, style: n, children: e });
680
+ }
681
+ function un(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: w,
732
+ isPreviewMode: _,
733
+ isEditMode: i,
734
+ visible: p,
735
+ onClose: f
736
+ }) {
737
+ if (!n) return null;
738
+ const x = y(e, w), C = y(m, w), N = y(c, w), K = y(Math.max(c, li), w);
739
+ return /* @__PURE__ */ E(
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: p ? 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: N,
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: p ? "auto" : "none"
779
+ }
780
+ }
781
+ )
782
+ }
783
+ ),
784
+ /* @__PURE__ */ E(
785
+ "div",
786
+ {
787
+ className: `${t}-close-icon`,
788
+ style: {
789
+ width: x,
790
+ height: x,
791
+ marginRight: C,
792
+ pointerEvents: p ? "auto" : "none"
793
+ },
794
+ onClick: (b) => b.stopPropagation(),
795
+ children: [
796
+ /* @__PURE__ */ r(
797
+ "button",
798
+ {
799
+ type: "button",
800
+ className: `${t}-close-icon-inner`,
801
+ "aria-label": "Close",
802
+ onClick: (b) => {
803
+ b.stopPropagation(), f();
804
+ },
805
+ children: /* @__PURE__ */ r(
806
+ Hn,
807
+ {
808
+ url: n,
809
+ fill: s,
810
+ hoverFill: w && !_ ? 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: C,
828
+ height: "100%",
829
+ pointerEvents: p ? "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: w,
849
+ onPrev: _,
850
+ onNext: i,
851
+ counterClassName: p,
852
+ counterStyle: f,
853
+ closeIcon: x,
854
+ closeIconMaxWidth: C,
855
+ closeIconColor: N,
856
+ closeIconHoverColor: K,
857
+ iconMarginRight: b,
858
+ contentMarginTop: nt
859
+ }) {
860
+ const U = s === "cover", S = G(null), Q = G(null), d = G(null), g = G(null), k = G(0), F = G(0), O = G("none"), H = G(!1), it = G(!1), T = G(null), I = G(0), R = G(null), X = G(!1), tt = G(null), ht = G(null), Et = G(null), ie = G(() => {
861
+ }), [W, St] = D(null), [$, Bt] = D(null), [Y, Wt] = D("opening"), [$t, Gt] = D(0), [dt, ct] = D(0), [Tt, It] = D(null), [Ut, Mt] = D(!1), [Xt, _t] = D(!1), [Ne, pe] = D(!1), [Ae, fe] = D(null), $e = G(e), re = G(void 0), v = n[e], ze = v ? jt(v) : !1, oe = v ? Vt(v) : !1, qt = Tt !== null, Yt = kt((a) => {
862
+ const M = a.currentTarget, j = M instanceof HTMLVideoElement ? { width: M.videoWidth, height: M.videoHeight } : { width: M.naturalWidth, height: M.naturalHeight };
863
+ !j.width || !j.height || fe(j);
864
+ }, []);
865
+ et(() => {
866
+ T.current = $;
867
+ }, [$]), et(() => {
868
+ const a = S.current;
869
+ if (!a) return;
870
+ const M = () => Bt(un(a));
871
+ M();
872
+ const j = new ResizeObserver(M);
873
+ return j.observe(a), () => j.disconnect();
874
+ }, []);
875
+ const Z = kt(() => {
876
+ tt.current !== null && (window.clearTimeout(tt.current), tt.current = null);
877
+ }, []), yt = kt(() => {
878
+ const a = ht.current;
879
+ ht.current = null, Z(), R.current = null, X.current = !1, It(null), Mt(!1), ct(0), I.current = 0, _t(!1), H.current = !1, F.current = 0, O.current = "none", a === 1 ? i() : a === -1 && _();
880
+ }, [Z, i, _]), Lt = kt(() => {
881
+ Z(), ht.current = null, R.current = null, X.current = !1, It(null), Mt(!1), ct(0), I.current = 0;
882
+ }, [Z]), ye = kt(() => {
883
+ Z(), tt.current = window.setTimeout(() => {
884
+ ht.current !== null && yt();
885
+ }, pt + 32);
886
+ }, [Z, yt]), Nt = kt((a, M) => {
887
+ var Dt;
888
+ const j = ((Dt = T.current) == null ? void 0 : Dt.width) ?? 0;
889
+ if (Z(), R.current = a, It(a), X.current = !0, Mt(!0), M) {
890
+ ht.current = a;
891
+ const wt = -a * j;
892
+ I.current = wt, ct(wt), ye();
893
+ return;
894
+ }
895
+ I.current = 0, ct(0), tt.current = window.setTimeout(() => {
896
+ tt.current = null, Lt();
897
+ }, pt + 32);
898
+ }, [Z, Lt, ye]), se = kt((a) => {
899
+ if (!(n.length <= 1)) {
900
+ if (X.current) {
901
+ if (ht.current === a) {
902
+ Et.current = a, yt();
903
+ return;
904
+ }
905
+ Lt();
906
+ }
907
+ Z(), R.current = a, It(a), X.current = !1, Mt(!1), I.current = 0, ct(0), requestAnimationFrame(() => {
908
+ requestAnimationFrame(() => {
909
+ Nt(a, !0);
910
+ });
911
+ });
912
+ }
913
+ }, [n.length, Nt, yt, Lt, Z]);
914
+ ie.current = se;
915
+ const ve = kt((a) => {
916
+ a.propertyName !== "transform" || !X.current || ht.current !== null && yt();
917
+ }, [yt]), le = kt(() => {
918
+ const a = Q.current;
919
+ if (!a) return;
920
+ const M = un(a);
921
+ !M.width || !M.height || St(M);
922
+ }, []);
923
+ et(() => {
924
+ le();
925
+ const a = Q.current;
926
+ if (!a) return;
927
+ const M = new ResizeObserver(() => le());
928
+ return M.observe(a), () => M.disconnect();
929
+ }, [le]), et(() => {
930
+ Y === "opening" && W && Wt("open");
931
+ }, [Y, W]), et(() => {
932
+ if (Y !== "closing") return;
933
+ const a = setTimeout(() => w(), pt);
934
+ return () => clearTimeout(a);
935
+ }, [Y, w]), et(() => () => {
936
+ Z();
937
+ }, [Z]), qe(() => {
938
+ $e.current === e && re.current === (v == null ? void 0 : v.assetId) || (Z(), ht.current = null, It(null), Gt(0), ct(0), Mt(!1), pe(!1), _t(!1), fe(null), k.current = 0, F.current = 0, O.current = "none", H.current = !1, X.current = !1, I.current = 0, R.current = null, g.current = null, it.current = !1, $e.current = e, re.current = v == null ? void 0 : v.assetId);
939
+ }, [e, v == null ? void 0 : v.assetId, Z]), qe(() => {
940
+ const a = Et.current;
941
+ a !== null && (Et.current = null, requestAnimationFrame(() => {
942
+ ie.current(a);
943
+ }));
944
+ }, [e, v == null ? void 0 : v.assetId]), et(() => {
945
+ if (Y !== "open") return;
946
+ let a = null;
947
+ const M = () => {
948
+ a && (document.removeEventListener("click", a, !0), a = null);
949
+ }, j = () => {
950
+ M(), a = (V) => {
951
+ V.stopPropagation(), V.preventDefault(), M();
952
+ }, document.addEventListener("click", a, !0);
953
+ }, Dt = (V) => {
954
+ const st = V < 0 ? 1 : -1;
955
+ if (Math.abs(V) > qn && n.length > 1) {
956
+ Nt(st, !0);
957
+ return;
958
+ }
959
+ Nt(st, !1);
960
+ }, wt = (V) => {
961
+ if (V.touches.length !== 1 || X.current) return;
962
+ const st = V.touches[0];
963
+ it.current = !0, g.current = { x: st.clientX, y: st.clientY }, O.current = "none", F.current = 0, H.current = !1;
964
+ }, Jt = (V) => {
965
+ if (!g.current || V.touches.length !== 1 || X.current) return;
966
+ const st = V.touches[0], lt = st.clientX - g.current.x, xt = st.clientY - g.current.y;
967
+ if (O.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
+ O.current = "horizontal";
972
+ } else if (xt > 0)
973
+ O.current = "vertical";
974
+ else
975
+ return;
976
+ }
977
+ if (O.current === "horizontal") {
978
+ H.current = !0, _t(!0), F.current = lt;
979
+ const ue = lt < 0 ? 1 : -1;
980
+ R.current !== ue && (R.current = ue, It(ue)), I.current = lt, ct(lt), V.preventDefault();
981
+ return;
982
+ }
983
+ O.current === "vertical" && (H.current = !0, _t(!0), k.current = xt, Gt(xt), V.preventDefault());
984
+ }, Ft = () => {
985
+ if (!g.current) return;
986
+ const V = O.current, st = H.current;
987
+ if (st && V === "horizontal")
988
+ Dt(F.current), j();
989
+ else if (st && V === "vertical")
990
+ if (k.current > Xn) {
991
+ const xt = window.innerHeight;
992
+ k.current = xt, pe(!0), Gt(xt), Wt("closing");
993
+ } else
994
+ k.current = 0, Gt(0), j();
995
+ else V === "horizontal" && Math.abs(F.current) > 0 && (Dt(F.current), j());
996
+ g.current = null, O.current = "none", F.current = 0, H.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), M();
1000
+ };
1001
+ }, [Y, n.length, Nt]), et(() => {
1002
+ const a = (M) => {
1003
+ M.key === "Escape" && (M.preventDefault(), M.stopPropagation(), Y !== "closing" && Wt("closing"));
1004
+ };
1005
+ return window.addEventListener("keydown", a, !0), () => window.removeEventListener("keydown", a, !0);
1006
+ }, [Y]);
1007
+ const we = () => {
1008
+ Y !== "closing" && Wt("closing");
1009
+ }, l = Y === "open", ae = Y === "closing", ce = $t > 0 ? Math.max(0, 1 - $t / 500) : 1, rt = $t > 0 ? Math.max(0.35, 1 - $t / 500) : 1, me = oe && v ? { width: Ze(v), height: 1 } : Ae, A = W ? U ? W : ri(W, me) : null, he = {
1010
+ position: "fixed",
1011
+ top: $ == null ? void 0 : $.top,
1012
+ left: $ == null ? void 0 : $.left,
1013
+ width: $ == null ? void 0 : $.width,
1014
+ height: $ == null ? void 0 : $.height,
1015
+ zIndex: 9998
1016
+ }, de = U ? "cover" : "contain", q = 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" || ae ? `opacity ${pt}ms ${Rt}` : "none", Ot = {
1017
+ ...he,
1018
+ transform: q,
1019
+ opacity: $t > 0 ? rt : Y === "opening" || ae ? 0 : 1,
1020
+ transition: Re,
1021
+ pointerEvents: "none"
1022
+ }, Kt = {
1023
+ position: "absolute",
1024
+ top: ((A == null ? void 0 : A.top) ?? 0) - (($ == null ? void 0 : $.top) ?? 0),
1025
+ left: ((A == null ? void 0 : A.left) ?? 0) - (($ == null ? void 0 : $.left) ?? 0),
1026
+ width: A == null ? void 0 : A.width,
1027
+ height: A == null ? void 0 : A.height,
1028
+ objectFit: de,
1029
+ pointerEvents: "none"
1030
+ }, ut = ($ == null ? void 0 : $.width) ?? 0, vt = qt ? (e + Tt + n.length) % n.length : null, ot = vt !== null ? n[vt] : null, xe = {
1031
+ ...he,
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: ((W == null ? void 0 : W.top) ?? 0) - (($ == null ? void 0 : $.top) ?? 0),
1039
+ left: ((W == null ? void 0 : W.left) ?? 0) - (($ == null ? void 0 : $.left) ?? 0),
1040
+ width: W == null ? void 0 : W.width,
1041
+ height: W == null ? void 0 : W.height,
1042
+ objectFit: de,
1043
+ pointerEvents: "none"
1044
+ }, be = oe && v && On(v).controls && A ? Math.min(52, A.height * 0.2) : 0, Se = A ? {
1045
+ position: "fixed",
1046
+ top: A.top,
1047
+ height: A.height - be,
1048
+ width: A.width / 2,
1049
+ zIndex: 9999
1050
+ } : null;
1051
+ return /* @__PURE__ */ E(
1052
+ "div",
1053
+ {
1054
+ ref: S,
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: we,
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: l ? ce : 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: U ? /* @__PURE__ */ E(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: l ? 1 : 0,
1105
+ transition: `opacity ${pt}ms ${Rt}`,
1106
+ pointerEvents: "none",
1107
+ zIndex: 9999
1108
+ },
1109
+ children: n.length > 1 && /* @__PURE__ */ E("p", { className: p, style: f, children: [
1110
+ e + 1,
1111
+ " / ",
1112
+ n.length
1113
+ ] })
1114
+ }
1115
+ )
1116
+ ] }) : /* @__PURE__ */ E(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: l ? 1 : 0,
1141
+ transition: `opacity ${pt}ms ${Rt}`
1142
+ },
1143
+ children: n.length > 1 && /* @__PURE__ */ E("p", { className: p, style: f, children: [
1144
+ e + 1,
1145
+ " / ",
1146
+ n.length
1147
+ ] })
1148
+ }
1149
+ )
1150
+ ] })
1151
+ }
1152
+ ),
1153
+ W && $ && ot && /* @__PURE__ */ r("div", { style: xe, onTransitionEnd: ve, 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
+ W && $ && v && /* @__PURE__ */ r("div", { style: Ot, onTransitionEnd: ve, children: oe ? /* @__PURE__ */ r(
1183
+ fn,
1184
+ {
1185
+ media: v,
1186
+ fit: U ? "cover" : "contain",
1187
+ lazy: !1,
1188
+ startsAtOnce: !0,
1189
+ style: Kt
1190
+ },
1191
+ `${e}-${v.assetId}`
1192
+ ) : ze ? /* @__PURE__ */ r(
1193
+ oi,
1194
+ {
1195
+ src: v.assetId,
1196
+ mediaRef: d,
1197
+ mediaStyle: Kt,
1198
+ onLoadedMetadata: Yt
1199
+ },
1200
+ `${e}-${v.assetId}`
1201
+ ) : /* @__PURE__ */ r(
1202
+ "img",
1203
+ {
1204
+ ref: d,
1205
+ src: v.assetId,
1206
+ alt: v.name,
1207
+ onLoad: Yt,
1208
+ style: Kt
1209
+ },
1210
+ `${e}-${v.assetId}`
1211
+ ) }),
1212
+ l && Se && n.length > 1 && /* @__PURE__ */ E(ft, { children: [
1213
+ /* @__PURE__ */ r(
1214
+ "div",
1215
+ {
1216
+ style: {
1217
+ ...Se,
1218
+ left: A.left,
1219
+ cursor: "w-resize",
1220
+ pointerEvents: Xt ? "none" : "auto"
1221
+ },
1222
+ onClick: (a) => {
1223
+ if (it.current) {
1224
+ it.current = !1;
1225
+ return;
1226
+ }
1227
+ a.stopPropagation(), se(-1);
1228
+ }
1229
+ }
1230
+ ),
1231
+ /* @__PURE__ */ r(
1232
+ "div",
1233
+ {
1234
+ style: {
1235
+ ...Se,
1236
+ left: A.left + A.width / 2,
1237
+ cursor: "e-resize",
1238
+ pointerEvents: Xt ? "none" : "auto"
1239
+ },
1240
+ onClick: (a) => {
1241
+ if (it.current) {
1242
+ it.current = !1;
1243
+ return;
1244
+ }
1245
+ a.stopPropagation(), se(1);
1246
+ }
1247
+ }
1248
+ )
1249
+ ] }),
1250
+ /* @__PURE__ */ r(
1251
+ ai,
1252
+ {
1253
+ prefix: t,
1254
+ closeIcon: x,
1255
+ closeIconMaxWidth: C,
1256
+ closeIconColor: N,
1257
+ closeIconHoverColor: K,
1258
+ iconMarginRight: b,
1259
+ contentMarginTop: nt,
1260
+ isEditor: o,
1261
+ isPreviewMode: m,
1262
+ isEditMode: c,
1263
+ visible: l,
1264
+ onClose: we
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 Je(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 ne = 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 = [], w = [], _ = Je(t);
1297
+ for (let i = 0; i < n; i += t.blocks.length) {
1298
+ i > 0 && _ > 0 && c.push(_);
1299
+ const p = Array.from(
1300
+ { length: Math.min(t.blocks.length, n - i) },
1301
+ (d, g) => Sn(t, i + g)
1302
+ ), f = p.map((d) => {
1303
+ const g = p.filter((k) => k.column < d.column + d.span && d.column < k.column + k.span && k.top >= d.top + d.height - ne);
1304
+ return g.length > 0 ? Math.min(...g.map((k) => k.top)) : void 0;
1305
+ }), x = [0, ...p.map((d) => d.top)].sort((d, g) => d - g).filter((d, g, k) => g === 0 || d - k[g - 1] > ne), C = (d, g) => Math.abs(d - g) <= ne, N = (d) => x.findIndex((g) => C(g, d)), K = [];
1306
+ let b = 0;
1307
+ const nt = (d) => {
1308
+ const g = p.flatMap((O, H) => d(f[H]) ? [{ slot: O, entry: i + H }] : []);
1309
+ if (g.length === 0) return;
1310
+ if (!o) {
1311
+ c.push("auto");
1312
+ return;
1313
+ }
1314
+ const k = Math.max(...g.map(({ slot: O, entry: H }) => K[N(O.top)] + (e[H] ?? 0))), F = Math.max(0, m(k) - b);
1315
+ c.push(F), b += F;
1316
+ }, U = x.map((d, g) => (g > 0 && (c.push(d - x[g - 1]), b += d - x[g - 1]), nt((k) => k !== void 0 && C(k, d)), K.push(b), c.length + 1));
1317
+ nt((d) => d === void 0);
1318
+ const S = c.length + 1, Q = (d) => U[N(d)];
1319
+ p.forEach((d, g) => {
1320
+ const k = f[g];
1321
+ w.push(`${Q(d.top)} / ${k === void 0 ? S : Q(k)}`);
1322
+ });
1323
+ }
1324
+ return { tracks: c, gridRows: w };
1325
+ }
1326
+ function gn(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 = Je(t), m = n.slice(0, s).map((i) => i.top).sort((i, p) => i - p).filter((i, p, f) => p === 0 || i - f[p - 1] > ne), c = [];
1331
+ let w = 0, _ = 0;
1332
+ for (let i = 0; i < n.length; i += s)
1333
+ for (const p of m) {
1334
+ const f = Array.from({ length: Math.min(s, n.length - i) }, (x, C) => i + C).filter((x) => Math.abs(n[x].top - p) <= ne);
1335
+ f.length !== 0 && (f.forEach((x) => {
1336
+ c[x] = w;
1337
+ }), _ = Math.max(...f.map((x) => w + e[x])), w = _ + o);
1338
+ }
1339
+ return { tops: c, bottom: _ };
1340
+ }
1341
+ function gi(t, n, e) {
1342
+ if (t.gridType === "rows") return ui(t, n, e);
1343
+ const s = t.blocks.length, o = Je(t), m = t.masonry === "on", c = [], w = [], _ = (p) => p.reduce((f, x) => Math.max(f, x.bottom), 0);
1344
+ let i = 0;
1345
+ for (let p = 0; p < n.length; p += s) {
1346
+ const f = p / s, x = Array.from({ length: Math.min(s, n.length - p) }, (C, N) => p + N).sort((C, N) => n[C].top - n[N].top || C - N);
1347
+ for (const C of x) {
1348
+ const N = n[C], K = (S) => S.column < N.column + N.span && N.column < S.column + S.span, b = x.filter((S) => S !== C && c[S] !== void 0 && K(n[S]) && n[S].top + n[S].height <= N.top + ne), nt = m ? w.filter((S) => S.group < f && K(S)) : [], U = b.map((S) => c[S] + e[S] + N.top - (n[S].top + n[S].height));
1349
+ nt.length > 0 && U.push(_(nt) + o), U.length === 0 && U.push(i + N.top), c[C] = Math.max(...U), w.push({ column: N.column, span: N.span, bottom: c[C] + e[C], group: f });
1350
+ }
1351
+ i = _(w) + o;
1352
+ }
1353
+ return { tops: c, bottom: _(w) };
1354
+ }
1355
+ function Li({ settings: t, content: n, isEditor: e, isPreviewMode: s, isEditMode: o, metadata: m, activeEvent: c, layoutId: w, portalId: _ }) {
1356
+ const { prefix: i } = _n(), {
1357
+ type: p = "a",
1358
+ gridLayout: f,
1359
+ customGrid: x,
1360
+ textBoxWidth: C = 100,
1361
+ verticalGap: N,
1362
+ entriesCount: K,
1363
+ lightbox: b,
1364
+ imageDisplay: nt,
1365
+ imageCorners: U,
1366
+ lightboxImageDisplay: S,
1367
+ slider: Q,
1368
+ sliderTiming: d,
1369
+ direction: g,
1370
+ transition: k,
1371
+ titleMarginTop: F,
1372
+ subtitleMarginTop: O,
1373
+ titleColor: H,
1374
+ subtitleColor: it,
1375
+ lightboxCounterColor: T,
1376
+ titleFontFamily: I,
1377
+ titleFontSettings: R,
1378
+ titleFontSize: X,
1379
+ titleLineHeight: tt,
1380
+ titleLetterSpacing: ht,
1381
+ titleWordSpacing: Et,
1382
+ titleTextAppearance: ie,
1383
+ subtitleFontFamily: W,
1384
+ subtitleFontSettings: St,
1385
+ subtitleFontSize: $,
1386
+ subtitleLineHeight: Bt,
1387
+ subtitleLetterSpacing: Y,
1388
+ subtitleWordSpacing: Wt,
1389
+ subtitleTextAppearance: $t,
1390
+ lightboxCounterFontFamily: Gt,
1391
+ lightboxCounterFontSettings: dt,
1392
+ lightboxCounterFontSize: ct,
1393
+ lightboxCounterLineHeight: Tt,
1394
+ lightboxCounterLetterSpacing: It,
1395
+ lightboxCounterWordSpacing: Ut,
1396
+ lightboxCounterTextAppearance: Mt,
1397
+ closeIcon: Xt,
1398
+ closeIconMaxWidth: _t,
1399
+ closeIconColor: Ne,
1400
+ closeIconHoverColor: pe,
1401
+ iconMarginRight: Ae,
1402
+ contentMarginTop: fe,
1403
+ showText: $e = "always",
1404
+ hover: re = "none",
1405
+ alignEntries: v = "off",
1406
+ align: ze = "top",
1407
+ textGrowth: oe = "inside"
1408
+ } = t, qt = mt(() => ({
1409
+ ...je(Ve({
1410
+ fontSettings: {
1411
+ fontFamily: I,
1412
+ fontWeight: (R == null ? void 0 : R.fontWeight) ?? 400,
1413
+ fontStyle: (R == null ? void 0 : R.fontStyle) ?? "normal"
1414
+ },
1415
+ fontSize: X ?? 0.01,
1416
+ lineHeight: tt,
1417
+ letterSpacing: ht ?? 0,
1418
+ wordSpacing: Et ?? 0,
1419
+ textAppearance: ie,
1420
+ color: H
1421
+ }, e)),
1422
+ ...Be(X, tt, i, e)
1423
+ }), [
1424
+ I,
1425
+ R,
1426
+ X,
1427
+ tt,
1428
+ ht,
1429
+ Et,
1430
+ ie,
1431
+ H,
1432
+ e,
1433
+ i
1434
+ ]), Yt = mt(() => ({
1435
+ ...je(Ve({
1436
+ fontSettings: {
1437
+ fontFamily: W,
1438
+ fontWeight: (St == null ? void 0 : St.fontWeight) ?? 400,
1439
+ fontStyle: (St == null ? void 0 : St.fontStyle) ?? "normal"
1440
+ },
1441
+ fontSize: $ ?? 0.01,
1442
+ lineHeight: Bt,
1443
+ letterSpacing: Y ?? 0,
1444
+ wordSpacing: Wt ?? 0,
1445
+ textAppearance: $t,
1446
+ color: it
1447
+ }, e)),
1448
+ ...Be($, Bt, i, e)
1449
+ }), [
1450
+ W,
1451
+ St,
1452
+ $,
1453
+ Bt,
1454
+ Y,
1455
+ Wt,
1456
+ $t,
1457
+ it,
1458
+ e,
1459
+ i
1460
+ ]), Z = mt(() => ({
1461
+ ...je(Ve({
1462
+ fontSettings: {
1463
+ fontFamily: Gt,
1464
+ fontWeight: (dt == null ? void 0 : dt.fontWeight) ?? 400,
1465
+ fontStyle: (dt == null ? void 0 : dt.fontStyle) ?? "normal"
1466
+ },
1467
+ fontSize: ct ?? 0.01,
1468
+ lineHeight: Tt,
1469
+ letterSpacing: It ?? 0,
1470
+ wordSpacing: Ut ?? 0,
1471
+ textAppearance: Mt,
1472
+ color: T
1473
+ }, e)),
1474
+ ...Be(ct, Tt, i, e)
1475
+ }), [
1476
+ Gt,
1477
+ dt,
1478
+ ct,
1479
+ Tt,
1480
+ It,
1481
+ Ut,
1482
+ Mt,
1483
+ T,
1484
+ e,
1485
+ i
1486
+ ]), yt = Ee(
1487
+ X,
1488
+ tt,
1489
+ `${i}-item-title`,
1490
+ `${i}-text-tight-leading`
1491
+ ), Lt = Ee(
1492
+ $,
1493
+ Bt,
1494
+ `${i}-item-subtitle`,
1495
+ `${i}-text-tight-leading`
1496
+ ), ye = Ee(
1497
+ ct,
1498
+ Tt,
1499
+ `${i}-lightbox-counter`,
1500
+ `${i}-text-tight-leading`
1501
+ ), Nt = mt(() => Gn(i, {
1502
+ titleColor: H,
1503
+ subtitleColor: it,
1504
+ lightboxCounterColor: T
1505
+ }, pi, fi), [i, H, it, T]), se = c && c !== "default" ? `${i}-state-${c}` : "", ve = $e === "on hover" && (!e || s), le = re !== "none" && (!e || s) ? ` ${i}-hover-${re}` : "", we = `${se}${ve ? ` ${i}-show-text-hover` : ""}${le}`.trim(), l = x && Array.isArray(x.blocks) && x.blocks.length > 0 ? x : void 0, ae = l || K === 0 ? 1 / 0 : K, ce = !!l && (l.textGrowth ?? oe) === "outside", rt = (l == null ? void 0 : l.cellHeight) === "auto", me = rt || (l == null ? void 0 : l.masonry) === "on", A = G([]), [he, de] = D([]), q = mt(() => (n ?? []).slice(0, ae), [n, ae]), Re = mt(
1506
+ () => b === "on" ? Jn(q) : [],
1507
+ [q, b]
1508
+ ), Ot = mt(() => q.map((h) => {
1509
+ const u = wn(h.gallery), L = u.filter((z) => z.lightboxMedia).map((z) => z.lightboxMedia), B = u.map(({ lightboxMedia: z }) => z ? L.findIndex((bt) => bt.assetId === z.assetId) : -1);
1510
+ return { displayItems: u, lightboxItemsForEntry: L, lightboxIndexes: B };
1511
+ }), [q]), Kt = (f == null ? void 0 : f.entryWidth) ?? 0.2, ut = typeof nt == "string" ? { display: nt } : nt, vt = ((l == null ? void 0 : l.mediaDisplay) ?? (ut == null ? void 0 : ut.display)) === "cover", ot = (ut == null ? void 0 : ut.ratioValue) ?? "1:1", xe = (ut == null ? void 0 : ut.reversed) ?? !1, [Zt, be] = ot.split(":").map(Number), M = `${xe ? be : Zt} / ${xe ? Zt : be}`, j = (f == null ? void 0 : f.columnsCount) ?? 1, Dt = y(Kt ?? 0, e), wt = Q !== "off" && (l ? rt : !vt), Jt = q.length % j || j, Ft = !l && Jt < j && q.length > 0, V = q.length - Jt, st = Ft ? Math.floor((j - Jt) / 2) + 1 : 1, lt = U ? y(U, e) : void 0, xt = (h, u, L) => ({
1512
+ width: h,
1513
+ ...u && rt ? {
1514
+ height: L != null && L.isEmpty ? y(u.height, e) : "auto",
1515
+ flexShrink: 0,
1516
+ overflow: "hidden",
1517
+ ...L != null && L.aspect && !wt ? { aspectRatio: `${L.aspect}` } : {}
1518
+ } : u ? ce ? { height: y(u.height, e), flexShrink: 0, overflow: "hidden" } : { flex: "1 1 0%", minHeight: 0, overflow: "hidden" } : vt ? { aspectRatio: M, height: "auto", overflow: "hidden" } : { height: "auto" },
1519
+ ...lt ? { borderRadius: lt, overflow: "hidden" } : {}
1520
+ }), ue = `${i}-item-image-wrapper${wt ? ` ${i}-item-image-wrapper-fit-slider` : ""}`.trim(), At = p === "d" || p === "e" || p === "f", Ct = !l && v === "on", We = lt ? { borderRadius: lt, [yn]: lt } : {}, Ge = rt ? {
1521
+ objectFit: wt && !vt ? "contain" : "cover",
1522
+ pointerEvents: "auto",
1523
+ width: "100%",
1524
+ height: "100%",
1525
+ maxWidth: "100%",
1526
+ ...We
1527
+ } : vt ? {
1528
+ objectFit: "cover",
1529
+ pointerEvents: "auto",
1530
+ width: "100%",
1531
+ height: "100%",
1532
+ maxWidth: "100%",
1533
+ ...We
1534
+ } : {
1535
+ objectFit: "contain",
1536
+ pointerEvents: "auto",
1537
+ width: "auto",
1538
+ height: "auto",
1539
+ maxWidth: "100%",
1540
+ ...l ? { maxHeight: "100%" } : {},
1541
+ ...We
1542
+ }, _e = ((l == null ? void 0 : l.beat) ?? 0) > 0 || me, Oe = l ? Ke(l, l.columnsCount) : 0;
1543
+ qe(() => {
1544
+ if (!_e) {
1545
+ de((z) => z.length > 0 ? [] : z);
1546
+ return;
1547
+ }
1548
+ const h = Ce.current, u = A.current.slice(0, q.length), L = () => {
1549
+ const z = h && Oe > 0 ? h.offsetWidth / Oe : 0;
1550
+ if (z <= 0) return;
1551
+ const bt = u.map((at) => at ? at.offsetHeight / z : 0);
1552
+ de((at) => at.length === bt.length && at.every((P, gt) => Math.abs(P - bt[gt]) < 1e-5) ? at : bt);
1553
+ };
1554
+ L();
1555
+ const B = new ResizeObserver(L);
1556
+ return h && B.observe(h), u.forEach((z) => z && B.observe(z)), () => B.disconnect();
1557
+ }, [_e, q.length, Oe, i]);
1558
+ const Qt = _e && he.length === q.length ? he : void 0, Pt = mt(() => {
1559
+ if (!l) return;
1560
+ const h = di(l, q.length, Qt);
1561
+ return {
1562
+ gridRows: h.gridRows,
1563
+ gridTemplateRows: h.tracks.length ? h.tracks.map((u) => u === "auto" ? "auto" : y(u, e)).join(" ") : "auto"
1564
+ };
1565
+ }, [l, q.length, Qt, e]), Ht = mt(
1566
+ () => l ? q.map((h, u) => Sn(l, u)) : void 0,
1567
+ [l, q.length]
1568
+ ), In = mt(
1569
+ () => Ot.map(({ displayItems: h }) => rt && h.length > 0 ? gn(h[0].displayMedia) : void 0),
1570
+ [Ot, rt]
1571
+ ), Ie = mt(() => {
1572
+ if (!l || !Ht || !me) return;
1573
+ const h = l.beat ?? 0, u = Ht.map((L, B) => {
1574
+ const bt = Ot[B].displayItems.map(({ displayMedia: gt }) => gn(gt)).filter((gt) => gt !== void 0), at = rt && bt.length > 0 ? Math.max(...bt.map((gt) => L.width / gt)) : L.height, P = (Qt == null ? void 0 : Qt[B]) ?? at;
1575
+ return h > 0 ? Math.ceil(P / h - 1e-3) * h : P;
1576
+ });
1577
+ return gi(l, Ht, u);
1578
+ }, [l, Ht, me, rt, Ot, Qt]), Cn = l ? {
1579
+ gridTemplateColumns: `repeat(${l.columnsCount}, ${y(l.columnWidth, e)})`,
1580
+ gridTemplateRows: (Pt == null ? void 0 : Pt.gridTemplateRows) ?? "auto",
1581
+ rowGap: 0,
1582
+ columnGap: y(l.gutterWidth, e),
1583
+ width: y(Ke(l, l.columnsCount), e),
1584
+ ...Ie ? { position: "relative", height: y(Ie.bottom, e) } : {}
1585
+ } : {
1586
+ gridTemplateColumns: `repeat(${j}, ${Dt})`,
1587
+ rowGap: Ct ? 0 : y(N ?? 0, e),
1588
+ columnGap: y((f == null ? void 0 : f.horizontalGap) ?? 0, e),
1589
+ width: y((f == null ? void 0 : f.wrapperWidth) ?? 0, e),
1590
+ ...Ct ? { [`--${i}-align-entries-row-gap`]: y(N ?? 0, e) } : {}
1591
+ }, Ce = G(null), kn = () => {
1592
+ const h = { ...Nt }, u = Ce.current ? getComputedStyle(Ce.current).getPropertyValue("--cntrl-article-width").trim() : "";
1593
+ return u && (h["--cntrl-article-width"] = u), h;
1594
+ }, [De, Fe] = D(!1), [ke, Tn] = D([]), [Mn, He] = D(0), Qe = b === "on" && (!e || s), Pe = (h, u) => {
1595
+ e && !s || b !== "off" && (Tn(h), He(u), Fe(!0));
1596
+ };
1597
+ et(() => {
1598
+ if (!De || b !== "on" || typeof document > "u") return;
1599
+ const h = document.body.style.overflow;
1600
+ return document.body.style.overflow = "hidden", () => {
1601
+ document.body.style.overflow = h;
1602
+ };
1603
+ }, [De, b]), et(() => {
1604
+ !e || s || Fe(!1);
1605
+ }, [e, s]);
1606
+ const Ln = mt(() => En(i), [i]);
1607
+ return /* @__PURE__ */ E(ft, { children: [
1608
+ /* @__PURE__ */ r("style", { dangerouslySetInnerHTML: { __html: Ln } }),
1609
+ b === "on" && /* @__PURE__ */ r(Qn, { mediaList: Re }),
1610
+ /* @__PURE__ */ r("div", { style: Nt, children: /* @__PURE__ */ r(
1611
+ "div",
1612
+ {
1613
+ ref: Ce,
1614
+ className: `${i}-wrapper ${i}-type-${p}${Ct ? ` ${i}-align-entries` : ""}${l ? ` ${i}-custom-layout` : ""}${ce ? ` ${i}-text-outside` : ""}${rt ? ` ${i}-auto-height` : ""} ${i}-image-align-${l ? "top" : ze} ${we}`.trim(),
1615
+ style: Cn,
1616
+ children: q.map((h, u) => {
1617
+ var an;
1618
+ const L = mn(h.title), B = mn(h.subtitle), z = b === "off" && ((an = h.link) != null && an.value) ? h.link : void 0, bt = Math.floor(u / j) === Math.ceil(q.length / j) - 1, at = Ft && u >= V ? `${st + (u - V)}` : void 0, P = Ht == null ? void 0 : Ht[u], gt = (P == null ? void 0 : P.width) ?? Kt, ge = y(gt, e), te = `calc(${ge} * (${C} / 100))`, zt = y(gt * C / 100, e), { displayItems: ee, lightboxItemsForEntry: tn, lightboxIndexes: en } = Ot[u], nn = Q === "off" ? In[u] : void 0, Nn = xt(
1619
+ ge,
1620
+ P,
1621
+ { aspect: nn, isEmpty: ee.length === 0 }
1622
+ ), An = rt && Q === "off" && !nn ? { ...Ge, height: "auto" } : Ge, zn = P && l && Ie ? {
1623
+ position: "absolute",
1624
+ left: y(P.column * (l.columnWidth + l.gutterWidth), e),
1625
+ top: y(Ie.tops[u], e),
1626
+ width: ge
1627
+ } : P ? {
1628
+ gridColumn: P.gridColumn,
1629
+ gridRow: Pt == null ? void 0 : Pt.gridRows[u],
1630
+ alignSelf: "start"
1631
+ } : at && !Ct ? { gridColumn: at } : void 0, rn = At ? /* @__PURE__ */ E("div", { className: `${i}-item-text-block`, children: [
1632
+ L && /* @__PURE__ */ r("p", { className: yt, style: { width: te, ...qt }, children: h.title }),
1633
+ L && /* @__PURE__ */ r(
1634
+ "div",
1635
+ {
1636
+ "data-controls": o ? "titleMarginTop" : void 0,
1637
+ className: o ? `${i}-control` : void 0,
1638
+ style: {
1639
+ height: y(F ?? 0, e),
1640
+ width: zt
1641
+ }
1642
+ }
1643
+ ),
1644
+ B && /* @__PURE__ */ r("p", { className: Lt, style: { width: te, ...Yt }, children: h.subtitle }),
1645
+ B && /* @__PURE__ */ r(
1646
+ "div",
1647
+ {
1648
+ "data-controls": o ? "subtitleMarginTop" : void 0,
1649
+ className: o ? `${i}-control` : void 0,
1650
+ style: {
1651
+ height: y(O ?? 0, e),
1652
+ width: zt
1653
+ }
1654
+ }
1655
+ )
1656
+ ] }) : null, Rn = Ct ? /* @__PURE__ */ E("div", { className: `${i}-item-title-row`, children: [
1657
+ !At && /* @__PURE__ */ r(
1658
+ "div",
1659
+ {
1660
+ "data-controls": o && L ? "titleMarginTop" : void 0,
1661
+ className: o && L ? `${i}-control` : void 0,
1662
+ style: {
1663
+ height: L ? y(F ?? 0, e) : 0,
1664
+ width: zt
1665
+ }
1666
+ }
1667
+ ),
1668
+ L && /* @__PURE__ */ r("p", { className: yt, style: { width: te, ...qt }, children: h.title }),
1669
+ At && L && /* @__PURE__ */ r(
1670
+ "div",
1671
+ {
1672
+ "data-controls": o ? "titleMarginTop" : void 0,
1673
+ className: o ? `${i}-control` : void 0,
1674
+ style: {
1675
+ height: y(F ?? 0, e),
1676
+ width: zt
1677
+ }
1678
+ }
1679
+ )
1680
+ ] }) : null, Wn = Ct ? /* @__PURE__ */ E("div", { className: `${i}-item-subtitle-row`, children: [
1681
+ !At && /* @__PURE__ */ r(
1682
+ "div",
1683
+ {
1684
+ "data-controls": o && B ? "subtitleMarginTop" : void 0,
1685
+ className: o && B ? `${i}-control` : void 0,
1686
+ style: {
1687
+ height: B ? y(O ?? 0, e) : 0,
1688
+ width: zt
1689
+ }
1690
+ }
1691
+ ),
1692
+ B && /* @__PURE__ */ r("p", { className: Lt, style: { width: te, ...Yt }, children: h.subtitle }),
1693
+ At && B && /* @__PURE__ */ r(
1694
+ "div",
1695
+ {
1696
+ "data-controls": o ? "subtitleMarginTop" : void 0,
1697
+ className: o ? `${i}-control` : void 0,
1698
+ style: {
1699
+ height: y(O ?? 0, e),
1700
+ width: zt
1701
+ }
1702
+ }
1703
+ )
1704
+ ] }) : null, on = /* @__PURE__ */ E(Le, { link: z, className: `${i}-item-text-link`, children: [
1705
+ Rn,
1706
+ Wn
1707
+ ] }), Te = /* @__PURE__ */ r(ii, { className: ue, style: Nn, children: ee.length === 0 ? null : Q === "off" ? (() => {
1708
+ const { displayMedia: J } = ee[0], Me = en[0];
1709
+ return /* @__PURE__ */ r(
1710
+ dn,
1711
+ {
1712
+ media: J,
1713
+ className: `${i}-item-${jt(J) ? "video" : "image"}`.trim(),
1714
+ style: An,
1715
+ hasLightbox: b === "on",
1716
+ onMediaClick: Qe && Me >= 0 ? () => Pe(tn, Me) : void 0
1717
+ }
1718
+ );
1719
+ })() : /* @__PURE__ */ E(ft, { children: [
1720
+ 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($n, { src: J.assetId, nearPreload: "metadata", muted: !0, playsInline: !0 }, `sizer-${J.assetId}`) : /* @__PURE__ */ r("img", { src: J.assetId, alt: "" }, `sizer-${J.assetId}`)) }),
1721
+ /* @__PURE__ */ r(
1722
+ ni,
1723
+ {
1724
+ prefix: i,
1725
+ isFade: k === "fade",
1726
+ direction: g,
1727
+ intervalMs: d * 1e3,
1728
+ slides: ee.map(({ displayMedia: J }, Me) => {
1729
+ const cn = en[Me];
1730
+ return /* @__PURE__ */ r(
1731
+ dn,
1732
+ {
1733
+ media: J,
1734
+ className: `${i}-item-${jt(J) ? "video" : "image"}`.trim(),
1735
+ style: Ge,
1736
+ hasLightbox: b === "on",
1737
+ isSliderSlide: !0,
1738
+ onMediaClick: Qe && cn >= 0 ? () => Pe(tn, cn) : void 0
1739
+ }
1740
+ );
1741
+ })
1742
+ },
1743
+ `${k}-${gt}-${g}-${d}-${w}-${ee.length}`
1744
+ )
1745
+ ] }) }), sn = At ? null : /* @__PURE__ */ E(ft, { children: [
1746
+ /* @__PURE__ */ r(
1747
+ "div",
1748
+ {
1749
+ "data-controls": o && L ? "titleMarginTop" : void 0,
1750
+ className: o && L ? `${i}-control` : void 0,
1751
+ style: {
1752
+ height: L ? y(F ?? 0, e) : 0,
1753
+ width: zt
1754
+ }
1755
+ }
1756
+ ),
1757
+ /* @__PURE__ */ r(
1758
+ "p",
1759
+ {
1760
+ className: yt,
1761
+ style: { width: te, ...qt },
1762
+ children: h.title
1763
+ }
1764
+ ),
1765
+ /* @__PURE__ */ r(
1766
+ "div",
1767
+ {
1768
+ "data-controls": o && B ? "subtitleMarginTop" : void 0,
1769
+ className: o && B ? `${i}-control` : void 0,
1770
+ style: {
1771
+ height: B ? y(O ?? 0, e) : 0,
1772
+ width: zt
1773
+ }
1774
+ }
1775
+ ),
1776
+ /* @__PURE__ */ r(
1777
+ "p",
1778
+ {
1779
+ className: Lt,
1780
+ style: { width: te, ...Yt },
1781
+ children: h.subtitle
1782
+ }
1783
+ )
1784
+ ] }), ln = z ? /* @__PURE__ */ r(Le, { link: z, className: `${i}-item-image-link`, children: Te }) : /* @__PURE__ */ r("a", { className: `${i}-item-image-link`, children: Te });
1785
+ return /* @__PURE__ */ r(
1786
+ "div",
1787
+ {
1788
+ className: `${i}-item`.trim(),
1789
+ style: zn,
1790
+ children: /* @__PURE__ */ r(
1791
+ "div",
1792
+ {
1793
+ ref: (J) => {
1794
+ A.current[u] = J;
1795
+ },
1796
+ className: `${o ? `${i}-item-inner` : `${i}-item-inner-hidden`}${Ct && bt ? ` ${i}-item-inner-last-row` : ""}`.trim(),
1797
+ style: {
1798
+ width: (C ?? 0) > 100 ? `calc(${ge} * (${C} / 100))` : ge,
1799
+ ...P && !ce && !rt ? { height: y(P.height, e) } : {},
1800
+ ...at && Ct ? { gridColumn: at } : {}
1801
+ },
1802
+ children: Ct ? /* @__PURE__ */ r(ft, { children: At ? /* @__PURE__ */ E(ft, { children: [
1803
+ on,
1804
+ ln
1805
+ ] }) : /* @__PURE__ */ E(ft, { children: [
1806
+ ln,
1807
+ on
1808
+ ] }) }) : z ? /* @__PURE__ */ E(ft, { children: [
1809
+ /* @__PURE__ */ E(Le, { link: z, className: `${i}-item-image-link`, children: [
1810
+ rn,
1811
+ Te
1812
+ ] }),
1813
+ !At && /* @__PURE__ */ r(Le, { link: z, className: `${i}-item-text-link`, children: sn })
1814
+ ] }) : /* @__PURE__ */ E(ft, { children: [
1815
+ rn,
1816
+ Te,
1817
+ sn
1818
+ ] })
1819
+ }
1820
+ )
1821
+ },
1822
+ u
1823
+ );
1824
+ })
1825
+ }
1826
+ ) }),
1827
+ (!e || s) && De && typeof document < "u" && b === "on" && (() => {
1828
+ const h = (_ ? document.getElementById(_) : null) ?? document.body;
1829
+ return Fn(
1830
+ /* @__PURE__ */ r("div", { style: kn(), "data-selection": "none", children: /* @__PURE__ */ r(
1831
+ ci,
1832
+ {
1833
+ prefix: i,
1834
+ items: ke,
1835
+ index: Mn,
1836
+ imageDisplay: mi(S),
1837
+ isEditor: e,
1838
+ isPreviewMode: s,
1839
+ isEditMode: o,
1840
+ closeIcon: Xt,
1841
+ closeIconMaxWidth: _t,
1842
+ closeIconColor: Ne,
1843
+ closeIconHoverColor: pe,
1844
+ iconMarginRight: Ae,
1845
+ contentMarginTop: fe,
1846
+ onClose: () => Fe(!1),
1847
+ onPrev: () => He((u) => (u - 1 + ke.length) % ke.length),
1848
+ onNext: () => He((u) => (u + 1) % ke.length),
1849
+ counterClassName: ye,
1850
+ counterStyle: Z
1851
+ }
1852
+ ) }),
1853
+ h
1854
+ );
1855
+ })()
1856
+ ] });
1857
+ }
1858
+ const pi = {
1859
+ titleColor: "title-color",
1860
+ subtitleColor: "subtitle-color",
1861
+ lightboxCounterColor: "lightbox-counter-color"
1862
+ }, fi = ["hover", "focus", "filled", "success", "error"];
1863
+ export {
1864
+ Li as Grid
1865
+ };