@cntrl-site/components 1.0.118-alpha.2 → 1.0.118

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