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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/dist/ArchivePopup-DMpGP8r2.js +176 -0
  2. package/dist/ArchivePopup-X4EtTAyA.mjs +694 -0
  3. package/dist/ArchivePopupComponent-BTniPIfi.js +1 -0
  4. package/dist/{PretextComponent-j-OsRZTx.mjs → ArchivePopupComponent-GgAT2Avz.mjs} +954 -479
  5. package/dist/ClickGallerie-CYQMgrIr.js +36 -0
  6. package/dist/ClickGallerie-o2U6oyOF.mjs +272 -0
  7. package/dist/Components/ArchivePopup/ArchivePopup.d.ts +154 -0
  8. package/dist/Components/ArchivePopup/ArchivePopupComponent.d.ts +288 -0
  9. package/dist/Components/ClickGallerie/ClickGallerie.d.ts +2 -1
  10. package/dist/Components/Helix/Helix.d.ts +4 -1
  11. package/dist/Components/Hive/Hive.d.ts +4 -1
  12. package/dist/Components/ImageRevealSlider/ImageRevealSlider.d.ts +2 -1
  13. package/dist/Components/List/List.d.ts +6 -2
  14. package/dist/Components/Marquee/Marquee.d.ts +6 -2
  15. package/dist/Components/MarqueeText/MarqueeText.d.ts +2 -1
  16. package/dist/Components/Mercury/Mercury.d.ts +4 -1
  17. package/dist/Components/Waterfall/WaterfallLightbox.d.ts +4 -1
  18. package/dist/Components/utils/EmbedMediaFrame.d.ts +27 -0
  19. package/dist/Components/utils/LinkWrapper.d.ts +16 -0
  20. package/dist/Components/utils/embedMedia.d.ts +40 -0
  21. package/dist/Components/utils/index.d.ts +6 -0
  22. package/dist/{ControlSlider-SiOt22l_.js → ControlSlider-Kkec-i14.js} +1 -1
  23. package/dist/{ControlSlider-pZv7H6BU.mjs → ControlSlider-LcZmviGX.mjs} +1 -1
  24. package/dist/EmbedMediaFrame-DsOTKE4i.js +1 -0
  25. package/dist/EmbedMediaFrame-DwHeOAy5.mjs +164 -0
  26. package/dist/{FAQ-C7823fyi.js → FAQ-BxhMo7T8.js} +1 -1
  27. package/dist/{FAQ-CZ39u4m8.mjs → FAQ-CdwSft5p.mjs} +1 -1
  28. package/dist/Grid-CFHTP3mb.js +378 -0
  29. package/dist/Grid-e-gLfsji.mjs +1590 -0
  30. package/dist/Helix-BpLo9FD3.js +43 -0
  31. package/dist/Helix-CidI3ucE.mjs +324 -0
  32. package/dist/{Hive-D6-R6TwM.mjs → Hive-BsmFHk2i.mjs} +505 -475
  33. package/dist/Hive-D1j6wZpV.js +321 -0
  34. package/dist/ImageRevealSlider-BuukTGAK.js +1 -0
  35. package/dist/{ImageRevealSlider-BdFGyVEP.mjs → ImageRevealSlider-Df9sygk9.mjs} +63 -70
  36. package/dist/{Lightbox-eP9qAZzL.mjs → Lightbox-C_fXsfdz.mjs} +1 -1
  37. package/dist/{Lightbox-CIss_nOG.js → Lightbox-DaunVrkp.js} +1 -1
  38. package/dist/LinkWrapper-Ca84iPtg.js +1 -0
  39. package/dist/LinkWrapper-DZs9hlOn.mjs +13 -0
  40. package/dist/{List-DW7fyJbf.mjs → List-Bh_-l9vD.mjs} +532 -520
  41. package/dist/List-DVvpQ24J.js +377 -0
  42. package/dist/Marquee-DByooiWP.mjs +578 -0
  43. package/dist/Marquee-DfIP-tIN.js +133 -0
  44. package/dist/{MarqueeText-Rzt2fJYt.mjs → MarqueeText-D6FNCe6P.mjs} +115 -114
  45. package/dist/MarqueeText-DsUiV6Zv.js +132 -0
  46. package/dist/Mercury-B-s2Kvuq.js +267 -0
  47. package/dist/Mercury-CCW0Es-s.mjs +1700 -0
  48. package/dist/{RichTextRenderer-B6WtTYlR.mjs → RichTextRenderer-BptwNpbJ.mjs} +10 -9
  49. package/dist/RichTextRenderer-K90Dd7pt.js +1 -0
  50. package/dist/{Slider20-Dm8BeCli.mjs → Slider20-CCzixTiN.mjs} +1 -1
  51. package/dist/{Slider20-C9o2REDl.js → Slider20-fMVeRfgx.js} +1 -1
  52. package/dist/{TestimonialGrid-CPu4qQ6B.mjs → TestimonialGrid-CbsVxSn9.mjs} +1 -1
  53. package/dist/{TestimonialGrid-D4ieiz9e.js → TestimonialGrid-CiCagfBU.js} +1 -1
  54. package/dist/{TestimonialSingle-DLdnAVF7.mjs → TestimonialSingle-BVm3Amrl.mjs} +1 -1
  55. package/dist/{TestimonialSingle-CVu15ZtV.js → TestimonialSingle-BWXynGjv.js} +1 -1
  56. package/dist/Waterfall-3kKioKh2.mjs +1432 -0
  57. package/dist/Waterfall-DII4-WV5.js +288 -0
  58. package/dist/{components-D2LyuDm-.mjs → components-DKuQ8PUa.mjs} +19 -18
  59. package/dist/components-SEwSqFrQ.js +1 -0
  60. package/dist/content/postFieldBindings.d.ts +29 -0
  61. package/dist/elements.js +1 -1
  62. package/dist/elements.mjs +22 -21
  63. package/dist/elements.node.js +1 -1
  64. package/dist/elements.node.mjs +1 -1
  65. package/dist/index.d.ts +3 -1
  66. package/dist/index.js +1 -1
  67. package/dist/index.mjs +52 -15
  68. package/dist/sources.js +1331 -233
  69. package/dist/sources.mjs +1355 -256
  70. package/dist/types/SchemaV1.d.ts +53 -1
  71. package/dist/utils.js +1 -1
  72. package/dist/utils.mjs +30 -20
  73. package/package.json +1 -1
  74. package/dist/ClickGallerie-D7g093HX.js +0 -36
  75. package/dist/ClickGallerie-QSOQjSdv.mjs +0 -271
  76. package/dist/Grid-BBpdl60K.js +0 -374
  77. package/dist/Grid-DS53S_gA.mjs +0 -1576
  78. package/dist/Helix-BPn9V1sg.mjs +0 -315
  79. package/dist/Helix-DcgsCc4D.js +0 -43
  80. package/dist/Hive-n8Fz-j3o.js +0 -321
  81. package/dist/ImageRevealSlider-BBWtFjUF.js +0 -1
  82. package/dist/List-C32WImI3.js +0 -377
  83. package/dist/Marquee-DOIRRCu4.js +0 -133
  84. package/dist/Marquee-O_PDwlIb.mjs +0 -564
  85. package/dist/MarqueeText-DkaO2lQ5.js +0 -132
  86. package/dist/Mercury-C9D10TTT.mjs +0 -1702
  87. package/dist/Mercury-DynO-NxY.js +0 -267
  88. package/dist/PretextComponent-BnsS2zJ6.js +0 -1
  89. package/dist/RichTextRenderer-CIy6yI8U.js +0 -1
  90. package/dist/Waterfall-DC2WQ3GT.js +0 -287
  91. package/dist/Waterfall-Yud2VR62.mjs +0 -1404
  92. package/dist/components-B9Vdjf0w.js +0 -1
@@ -1,1404 +0,0 @@
1
- import { jsx as h, jsxs as bt, Fragment as ve } from "react/jsx-runtime";
2
- import { useState as $, useRef as y, useCallback as w, useEffect as D, useLayoutEffect as Pt, useMemo as me } from "react";
3
- import { createPortal as an } from "react-dom";
4
- import { g as ln, a as cn } from "./getImageRect-CBMhFNHM.mjs";
5
- import { s as ne } from "./scalingValue-C9JH5L6O.mjs";
6
- import { u as sn } from "./useScopedStyles-DhBG3557.mjs";
7
- import { L as un } from "./LazyVideo-CdAWymKO.mjs";
8
- import { t as fn } from "./textStylesToCss-05Mn6I_2.mjs";
9
- import { u as dn } from "./useLazyVideos-CxXyEjRQ.mjs";
10
- import { H as hn } from "./HiveLightboxTitles-DhEeFKWs.mjs";
11
- function pn(t) {
12
- return `
13
- .${t}-titles-row {
14
- position: relative;
15
- flex: 0 1 auto;
16
- z-index: 2;
17
- box-sizing: border-box;
18
- pointer-events: none;
19
- word-break: break-word;
20
- min-width: 0;
21
- display: flex;
22
- flex-direction: row;
23
- align-items: baseline;
24
- }
25
- .${t}-titles-row-header {
26
- flex: 1;
27
- align-items: baseline;
28
- }
29
- .${t}-titles-row-header-controls {
30
- display: flex;
31
- flex-direction: row;
32
- align-items: baseline;
33
- flex-shrink: 0;
34
- }
35
- .${t}-close-icon {
36
- position: relative;
37
- flex-shrink: 0;
38
- align-self: center;
39
- pointer-events: auto;
40
- z-index: 2;
41
- display: flex;
42
- align-items: center;
43
- justify-content: center;
44
- border: none;
45
- background-color: transparent;
46
- padding: 0;
47
- }
48
- .${t}-close-icon-inner {
49
- all: unset;
50
- position: relative;
51
- cursor: pointer;
52
- width: 100%;
53
- height: 100%;
54
- pointer-events: auto;
55
- }
56
- .${t}-close-icon-img {
57
- position: absolute;
58
- top: 50%;
59
- left: 50%;
60
- transform: translate(-50%, -50%);
61
- }
62
- .${t}-titles-baseline-strut {
63
- width: 0;
64
- overflow: hidden;
65
- flex-shrink: 0;
66
- pointer-events: none;
67
- white-space: nowrap;
68
- }
69
- .${t}-titles-row-titles {
70
- position: relative;
71
- flex: 1;
72
- min-width: 0;
73
- align-self: flex-start;
74
- }
75
- .${t}-titles-stack {
76
- position: relative;
77
- display: flex;
78
- flex-direction: row;
79
- align-items: baseline;
80
- align-self: flex-start;
81
- min-width: 0;
82
- }
83
- .${t}-titles-row-two-row {
84
- display: flex;
85
- flex: 1;
86
- height: 100%;
87
- min-height: 0;
88
- align-self: stretch;
89
- flex-direction: column;
90
- width: 100%;
91
- }
92
- .${t}-titles-row-top {
93
- display: flex;
94
- flex-direction: row;
95
- align-items: baseline;
96
- width: 100%;
97
- flex-shrink: 0;
98
- margin-bottom: 0;
99
- }
100
- .${t}-titles-row-top .${t}-title-cell[data-title="title1"] {
101
- flex: 0 0 auto;
102
- min-width: 0;
103
- }
104
- .${t}-titles-row-bottom-wrap {
105
- display: flex;
106
- flex-direction: column;
107
- width: 100%;
108
- margin-top: auto;
109
- flex-shrink: 0;
110
- }
111
- .${t}-titles-row-bottom-area {
112
- position: relative;
113
- flex: 1;
114
- min-height: 0;
115
- display: flex;
116
- flex-direction: column;
117
- width: 100%;
118
- }
119
- .${t}-titles-row-bottom {
120
- position: relative;
121
- display: flex;
122
- flex-direction: row;
123
- align-items: flex-end;
124
- width: 100%;
125
- }
126
- .${t}-titles-row-bottom .${t}-title-cell {
127
- flex: 0 0 auto;
128
- }
129
- .${t}-title-cell {
130
- position: relative;
131
- flex: 0 0 auto;
132
- min-width: 0;
133
- box-sizing: border-box;
134
- }
135
- .${t}-text-bar-cell {
136
- position: relative;
137
- flex: 0 1 auto;
138
- min-width: 0;
139
- display: flex;
140
- align-items: baseline;
141
- }
142
- .${t}-title1,
143
- .${t}-title2,
144
- .${t}-title3 {
145
- margin: 0;
146
- min-width: 0;
147
- }
148
- .${t}-title-resize-handle {
149
- background: transparent;
150
- }
151
- .${t}-lightbox {
152
- position: fixed;
153
- inset: 0;
154
- z-index: 9997;
155
- overscroll-behavior: none;
156
- overflow: hidden;
157
- }
158
- .${t}-lightbox-editor {
159
- inset: auto;
160
- top: var(--cntrl-article-top, 0);
161
- left: var(--cntrl-article-left, 0);
162
- width: var(--cntrl-article-width, 100vw) !important;
163
- height: var(--cntrl-viewport-height, 100vh) !important;
164
- }
165
- .${t}-lightbox-edit-mode {
166
- z-index: 1;
167
- }
168
- .${t}-lightbox-dismiss-area {
169
- position: relative;
170
- width: 100%;
171
- height: 100%;
172
- }
173
- .${t}-lightbox-overlay-content {
174
- position: absolute;
175
- inset: 0;
176
- z-index: 3;
177
- pointer-events: none;
178
- display: flex;
179
- flex-direction: column;
180
- isolation: isolate;
181
- }
182
- .${t}-lightbox-content-area {
183
- position: relative;
184
- display: flex;
185
- flex-direction: row;
186
- align-items: flex-start;
187
- flex: 1;
188
- min-width: 0;
189
- min-height: 0;
190
- }
191
- .${t}-lightbox-content-area-stacked {
192
- align-items: stretch;
193
- align-self: stretch;
194
- }
195
- .${t}-text-bar-cell-stacked {
196
- align-self: stretch;
197
- flex: 1;
198
- min-width: 0;
199
- min-height: 0;
200
- height: 100%;
201
- flex-direction: column;
202
- align-items: stretch;
203
- }
204
- .${t}-control {
205
- position: relative;
206
- z-index: 2;
207
- pointer-events: auto;
208
- flex-shrink: 0;
209
- }
210
- `;
211
- }
212
- const Q = 500, _t = 650, B = "cubic-bezier(0.22, 1, 0.36, 1)", gn = 72, mn = 50, wn = 1e4, vn = 650, yn = 500;
213
- function xn(t, n) {
214
- const r = t.width / n.width, o = t.height / n.height, i = t.left - n.left, l = t.top - n.top;
215
- return `translate(${i}px, ${l}px) scale(${r}, ${o})`;
216
- }
217
- function je(t, n) {
218
- if (n === "contain" && t instanceof HTMLImageElement) {
219
- const o = ln(t);
220
- return { left: o.x, top: o.y, width: o.width, height: o.height };
221
- }
222
- const r = t.getBoundingClientRect();
223
- return { left: r.left, top: r.top, width: r.width, height: r.height };
224
- }
225
- function $n(t, n, r) {
226
- const o = t.querySelector(`[data-waterfall-index="${n}"]`);
227
- return o instanceof HTMLElement ? je(o, r) : null;
228
- }
229
- function bn(t) {
230
- return t.reduce((n, r, o) => {
231
- var i;
232
- return (i = r.image) != null && i.assetId && n.push({
233
- gridIndex: o,
234
- items: [r.image],
235
- entry: {
236
- title1: r.title ?? "",
237
- title2: r.subtitle ?? "",
238
- title3: r.caption ?? ""
239
- }
240
- }), n;
241
- }, []);
242
- }
243
- function jt(t, n, r) {
244
- var i;
245
- if (t.length <= 1) return null;
246
- const o = (n + r + t.length) % t.length;
247
- return ((i = t[o]) == null ? void 0 : i.items[0]) ?? null;
248
- }
249
- function De(t, n, r) {
250
- if (t.length <= 2) return null;
251
- const o = (n + r + t.length) % t.length;
252
- return jt(t, o, r);
253
- }
254
- const Sn = 0.03;
255
- function Ve(t) {
256
- return t.width * Sn;
257
- }
258
- const we = {
259
- left: 0,
260
- top: 0,
261
- width: typeof window < "u" ? window.innerWidth : 1440,
262
- height: typeof window < "u" ? window.innerHeight : 900
263
- };
264
- function te(t, n) {
265
- return {
266
- left: t.left - n.left,
267
- top: t.top - n.top,
268
- width: t.width,
269
- height: t.height
270
- };
271
- }
272
- function _e(t) {
273
- const n = t.getBoundingClientRect();
274
- return { width: n.width, height: n.height, left: n.left, top: n.top };
275
- }
276
- function In(t) {
277
- return t instanceof HTMLVideoElement ? { width: t.videoWidth, height: t.videoHeight } : { width: t.naturalWidth, height: t.naturalHeight };
278
- }
279
- function ye(t, n, r) {
280
- const o = t.getBoundingClientRect(), i = o.width, l = o.height, p = n / r, s = i / l;
281
- if (p > s) {
282
- const b = i / p;
283
- return { width: i, height: b, left: o.left, top: o.top + (l - b) / 2 };
284
- }
285
- const I = l * p;
286
- return { width: I, height: l, left: o.left + (i - I) / 2, top: o.top };
287
- }
288
- function Ln(t, n) {
289
- return !t || !(n != null && n.width) || !(n != null && n.height) ? null : ye(t, n.width, n.height);
290
- }
291
- function Tn(t, n) {
292
- if (oe(t)) {
293
- const o = document.createElement("video"), i = () => {
294
- o.videoWidth > 0 && o.videoHeight > 0 && n(t.assetId, o.videoWidth, o.videoHeight), o.removeEventListener("loadedmetadata", i);
295
- };
296
- o.addEventListener("loadedmetadata", i), o.preload = "auto", o.src = t.assetId, o.load();
297
- return;
298
- }
299
- const r = new Image();
300
- r.onload = () => {
301
- r.naturalWidth > 0 && r.naturalHeight > 0 && n(t.assetId, r.naturalWidth, r.naturalHeight);
302
- }, r.src = t.assetId;
303
- }
304
- function kn(t) {
305
- const n = /* @__PURE__ */ new Set(), r = [];
306
- for (const o of t) {
307
- const i = o.image;
308
- !(i != null && i.assetId) || n.has(i.assetId) || (n.add(i.assetId), r.push(i));
309
- }
310
- return r;
311
- }
312
- function Hn({ mediaList: t }) {
313
- const [n, r] = $(null);
314
- return dn(n, { preload: "metadata" }), t.length === 0 ? null : /* @__PURE__ */ h(
315
- "div",
316
- {
317
- ref: r,
318
- "aria-hidden": !0,
319
- style: {
320
- position: "absolute",
321
- width: 0,
322
- height: 0,
323
- overflow: "hidden",
324
- opacity: 0,
325
- pointerEvents: "none"
326
- },
327
- children: t.map((o) => oe(o) ? /* @__PURE__ */ h(
328
- "video",
329
- {
330
- src: o.assetId,
331
- preload: "none",
332
- muted: !0,
333
- playsInline: !0
334
- },
335
- o.assetId
336
- ) : /* @__PURE__ */ h(
337
- "img",
338
- {
339
- src: o.assetId,
340
- alt: ""
341
- },
342
- o.assetId
343
- ))
344
- }
345
- );
346
- }
347
- function Nt(t, n, r) {
348
- const { width: o, height: i, top: l } = t, { left: p, width: s } = r, I = Ve(r);
349
- return n === "left" ? {
350
- left: p + I - o,
351
- top: l,
352
- width: o,
353
- height: i
354
- } : {
355
- left: p + s - I,
356
- top: l,
357
- width: o,
358
- height: i
359
- };
360
- }
361
- function re(t, n, r) {
362
- const o = Nt(t, n, r);
363
- return {
364
- ...o,
365
- left: 2 * o.left - t.left
366
- };
367
- }
368
- function An(t, n, r) {
369
- const { left: o, width: i } = r, l = Ve(r);
370
- return n === "left" ? {
371
- left: o,
372
- top: t.top,
373
- width: l,
374
- height: t.height
375
- } : {
376
- left: o + i - l,
377
- top: t.top,
378
- width: l,
379
- height: t.height
380
- };
381
- }
382
- function Me(t, n, r, o) {
383
- const i = Nt(t, "left", o), l = Nt(t, "right", o), p = re(t, "left", o), s = re(t, "right", o);
384
- if (r === 1)
385
- switch (n) {
386
- case "center":
387
- return { start: t, end: i };
388
- case "right-adjacent":
389
- return { start: l, end: t };
390
- case "left-adjacent":
391
- return { start: i, end: p };
392
- case "far-right":
393
- return { start: s, end: l };
394
- default:
395
- return { start: t, end: t };
396
- }
397
- switch (n) {
398
- case "center":
399
- return { start: t, end: l };
400
- case "left-adjacent":
401
- return { start: i, end: t };
402
- case "right-adjacent":
403
- return { start: l, end: s };
404
- case "far-left":
405
- return { start: p, end: i };
406
- default:
407
- return { start: t, end: t };
408
- }
409
- }
410
- function Rn(t, n, r, o) {
411
- const { start: i, end: l } = Me(t, n, r, o);
412
- return {
413
- x: l.left - i.left,
414
- y: l.top - i.top
415
- };
416
- }
417
- function Cn(t, n, r) {
418
- const o = Nt(t, n, r), i = re(t, n, r);
419
- return {
420
- x: i.left - o.left,
421
- y: i.top - o.top
422
- };
423
- }
424
- function oe(t) {
425
- return t.type === "video" ? !0 : /\.(mp4|webm|ogg|mov)(\?|#|$)/i.test(t.assetId);
426
- }
427
- function En({
428
- src: t,
429
- phase: n,
430
- onMediaElement: r,
431
- wrapperStyle: o,
432
- videoStyle: i,
433
- onLoadedMetadata: l,
434
- onTransitionEnd: p
435
- }) {
436
- const s = y(null);
437
- return D(() => {
438
- const I = s.current;
439
- return r == null || r(I ?? null), () => {
440
- I == null || I.pause(), r == null || r(null);
441
- };
442
- }, [t, r]), /* @__PURE__ */ h("div", { style: o, onTransitionEnd: p, children: /* @__PURE__ */ h(
443
- "video",
444
- {
445
- ref: s,
446
- src: t,
447
- controls: n === "open",
448
- playsInline: !0,
449
- preload: "auto",
450
- onLoadedMetadata: l,
451
- onClick: (I) => I.stopPropagation(),
452
- style: i
453
- },
454
- t
455
- ) });
456
- }
457
- function ee({
458
- media: t,
459
- style: n,
460
- onTransitionEnd: r,
461
- onMeasure: o
462
- }) {
463
- return oe(t) ? /* @__PURE__ */ h(
464
- "video",
465
- {
466
- src: t.assetId,
467
- muted: !0,
468
- playsInline: !0,
469
- preload: "auto",
470
- style: n,
471
- onLoadedMetadata: (i) => {
472
- const l = i.currentTarget;
473
- l.videoWidth > 0 && l.videoHeight > 0 && (o == null || o(t.assetId, l.videoWidth, l.videoHeight));
474
- },
475
- onTransitionEnd: r
476
- }
477
- ) : /* @__PURE__ */ h(
478
- "img",
479
- {
480
- src: t.assetId,
481
- alt: t.name,
482
- style: n,
483
- onLoad: (i) => {
484
- const l = i.currentTarget;
485
- l.naturalWidth > 0 && l.naturalHeight > 0 && (o == null || o(t.assetId, l.naturalWidth, l.naturalHeight));
486
- },
487
- onTransitionEnd: r
488
- }
489
- );
490
- }
491
- function Nn({
492
- prefix: t,
493
- items: n,
494
- index: r,
495
- entry: o,
496
- settings: i,
497
- isEditor: l,
498
- isEditMode: p,
499
- isPreviewMode: s,
500
- canNavigate: I,
501
- lightboxEntries: b,
502
- entryIdx: P,
503
- layoutId: ie,
504
- sourceRect: st,
505
- resolveCloseSourceRect: vt,
506
- onClose: Vt,
507
- onPrev: tt,
508
- onNext: Ft
509
- }) {
510
- const Wt = y(null), G = y(null), X = y(null), et = y(/* @__PURE__ */ new Map()), [ut, Mt] = $(0), nt = y(null), rt = y(0), k = y(0), C = y("none"), F = y(!1), yt = y(!1), xt = y(!1), ft = y(null), _ = y(null), St = y(null), ot = y(() => {
511
- }), dt = y(null), ht = y(null), pt = y(null), it = y(!1), [E, $t] = $(null), [N, W] = $(we), [ae, le] = $(0), [g, It] = $("opening"), [q, Lt] = $(0), [f, v] = $(0), [S, j] = $(!1), [z, at] = $(null), [gt, Tt] = $(null), [Bt, kt] = $(null), [Be, ce] = $(!1), [Ge, Xe] = $(null), [xe, se] = $(!1), Gt = y(!1), [Y, Ht] = $(!1), [qe, $e] = $(!1), be = y(r), Se = y(void 0), d = n[r], Xt = d ? oe(d) : !1, U = f !== 0 || S, ue = !p && (!l || !!s), lt = I && !p, mt = b.length > 1, At = w((e, a) => n.length <= 1 ? null : n[(e + a + n.length) % n.length] ?? null, [n]), H = mt ? jt(b, P, -1) : At(r, -1), A = mt ? jt(b, P, 1) : At(r, 1), fe = z === -1 && U ? mt && gt !== null ? jt(b, gt, -1) : Bt !== null ? At(Bt, -1) : null : null, de = z === 1 && U ? mt && gt !== null ? jt(b, gt, 1) : Bt !== null ? At(Bt, 1) : null : null, Ye = fe && fe.assetId !== (H == null ? void 0 : H.assetId) ? fe : null, Ue = de && de.assetId !== (A == null ? void 0 : A.assetId) ? de : null, Ze = H && lt ? (() => {
512
- const e = mt ? De(b, P, -1) : n.length > 2 ? At((r - 1 + n.length) % n.length, -1) : null;
513
- return e && e.assetId !== H.assetId ? e : null;
514
- })() : null, Ke = A && lt ? (() => {
515
- const e = mt ? De(b, P, 1) : n.length > 2 ? At((r + 1) % n.length, 1) : null;
516
- return e && e.assetId !== A.assetId ? e : null;
517
- })() : null, qt = Ye ?? Ze, Yt = Ue ?? Ke, wt = w((e, a, u) => {
518
- if (!e || !a || !u) return;
519
- const c = et.current, x = c.get(e);
520
- (x == null ? void 0 : x.width) === a && (x == null ? void 0 : x.height) === u || (c.set(e, { width: a, height: u }), Mt((M) => M + 1));
521
- }, []), Rt = w((e) => {
522
- if (!(e != null && e.assetId)) return null;
523
- const a = et.current.get(e.assetId);
524
- return Ln(G.current, a);
525
- }, [ut, ae]), Ut = w(() => {
526
- if (!d) return;
527
- const e = Rt(d);
528
- if (e) {
529
- $t(e);
530
- return;
531
- }
532
- const a = G.current;
533
- a && $t(_e(a));
534
- }, [d, Rt]), Zt = w((e) => {
535
- if (mt) {
536
- const a = b.length;
537
- Tt((P + e + a) % a), kt(null);
538
- return;
539
- }
540
- n.length > 1 && (kt((r + e + n.length) % n.length), Tt(null));
541
- }, [mt, b.length, P, n.length, r]), R = w((e) => {
542
- xt.current = e, j(e);
543
- }, []), L = w(() => {
544
- ft.current !== null && (window.clearTimeout(ft.current), ft.current = null);
545
- }, []), Ie = w(() => {
546
- L(), ft.current = window.setTimeout(() => {
547
- L(), R(!1);
548
- }, _t + 32);
549
- }, [L, R]), Le = w(() => {
550
- const e = Wt.current;
551
- if (!e) {
552
- W({
553
- left: 0,
554
- top: 0,
555
- width: typeof window < "u" ? window.innerWidth : we.width,
556
- height: typeof window < "u" ? window.innerHeight : we.height
557
- });
558
- return;
559
- }
560
- const a = e.getBoundingClientRect();
561
- W({
562
- left: a.left,
563
- top: a.top,
564
- width: a.width,
565
- height: a.height
566
- });
567
- }, []), Te = w((e, a) => {
568
- if (U) {
569
- if (Y && !S)
570
- return `translate(${f}px, 0px)`;
571
- if (S && z !== null) {
572
- const u = Rt(e);
573
- if (!u) return;
574
- const { x: c, y: x } = Rn(u, a, z, N);
575
- return `translate(${c}px, ${x}px)`;
576
- }
577
- if (S)
578
- return "translate(0px, 0px)";
579
- }
580
- }, [
581
- U,
582
- Y,
583
- S,
584
- f,
585
- z,
586
- N,
587
- Rt
588
- ]), Ct = w(() => {
589
- const e = _.current;
590
- _.current = null, L(), R(!1), at(null), Tt(null), kt(null), v(0), Ht(!1), F.current = !1, k.current = 0, C.current = "none", e === -1 ? tt() : e === 1 && Ft();
591
- }, [L, R, tt, Ft]), Kt = w(() => {
592
- L(), ft.current = window.setTimeout(() => {
593
- _.current !== null && Ct();
594
- }, _t + 32);
595
- }, [L, Ct]), ke = w(() => {
596
- L(), _.current = null, R(!1), at(null), Tt(null), kt(null), v(0), Ht(!1), F.current = !1, k.current = 0, C.current = "none";
597
- }, [L, R]), He = w((e) => {
598
- if (!(!lt || !E)) {
599
- if (xt.current) {
600
- if (_.current === e) {
601
- St.current = e, Ct();
602
- return;
603
- }
604
- ke();
605
- }
606
- L(), Zt(e), _.current = e, at(e), R(!0), Kt();
607
- }
608
- }, [
609
- lt,
610
- E,
611
- Ct,
612
- ke,
613
- L,
614
- Zt,
615
- R,
616
- Kt
617
- ]);
618
- ot.current = He;
619
- const ct = w(() => {
620
- dt.current = null, it.current = !1, ht.current !== null && (window.clearInterval(ht.current), ht.current = null), pt.current !== null && (window.clearTimeout(pt.current), pt.current = null);
621
- }, []), he = w((e) => {
622
- ht.current !== null && window.clearInterval(ht.current);
623
- const a = it.current ? yn : vn;
624
- ht.current = window.setInterval(() => {
625
- ot.current(e);
626
- }, a);
627
- }, []), Ae = w((e) => {
628
- dt.current !== e && (ct(), dt.current = e, it.current = !1, ot.current(e), he(e), pt.current = window.setTimeout(() => {
629
- pt.current = null, dt.current === e && (it.current = !0, he(e));
630
- }, wn));
631
- }, [ct, he]), Z = w(() => {
632
- const e = G.current;
633
- if (!e) return;
634
- const a = d == null ? void 0 : d.assetId, u = a ? et.current.get(a) : void 0;
635
- if (u != null && u.width && (u != null && u.height)) {
636
- $t(ye(e, u.width, u.height));
637
- return;
638
- }
639
- const c = X.current;
640
- if (c && a && (c.src === a || c.currentSrc === a)) {
641
- const { width: M, height: m } = In(c);
642
- if (M && m) {
643
- wt(a, M, m), $t(ye(e, M, m));
644
- return;
645
- }
646
- }
647
- const x = _e(e);
648
- !x.width || !x.height || $t(x);
649
- }, [d == null ? void 0 : d.assetId, wt]), Re = w((e) => {
650
- if (X.current = e, !!e) {
651
- if (e instanceof HTMLVideoElement) {
652
- e.readyState >= 1 && e.videoWidth > 0 && Z();
653
- return;
654
- }
655
- e.complete && e.naturalWidth > 0 && Z();
656
- }
657
- }, [Z]), zt = w(() => {
658
- Le(), Z(), le((e) => e + 1);
659
- }, [Le, Z]);
660
- D(() => {
661
- zt();
662
- const e = G.current, a = Wt.current, u = new ResizeObserver(() => zt());
663
- return e && u.observe(e), a && u.observe(a), window.addEventListener("resize", zt), () => {
664
- u.disconnect(), window.removeEventListener("resize", zt);
665
- };
666
- }, [zt, r, ie]), Pt(() => {
667
- if (!d) return;
668
- const e = X.current;
669
- if (e) {
670
- if (e instanceof HTMLImageElement && e.complete && e.naturalWidth > 0) {
671
- Z();
672
- return;
673
- }
674
- e instanceof HTMLVideoElement && e.readyState >= 1 && e.videoWidth > 0 && Z();
675
- }
676
- }, [d == null ? void 0 : d.assetId, r, Z]), D(() => {
677
- Ut();
678
- }, [Ut, ut]), D(() => {
679
- const e = /* @__PURE__ */ new Set(), a = [], u = (c) => {
680
- !(c != null && c.assetId) || e.has(c.assetId) || (e.add(c.assetId), a.push(c));
681
- };
682
- n.forEach(u), b.forEach((c) => c.items.forEach(u)), a.forEach((c) => {
683
- et.current.has(c.assetId) || Tn(c, wt);
684
- });
685
- }, [n, b, wt]), D(() => {
686
- if (g !== "opening" || !E) return;
687
- if (!st) {
688
- It("open");
689
- return;
690
- }
691
- ce(!1);
692
- const e = requestAnimationFrame(() => {
693
- requestAnimationFrame(() => {
694
- ce(!0), It("open");
695
- });
696
- });
697
- return () => cancelAnimationFrame(e);
698
- }, [g, E, st]), D(() => {
699
- if (g !== "closing") return;
700
- const e = setTimeout(() => Vt(), Q);
701
- return () => clearTimeout(e);
702
- }, [g, Vt]), D(() => () => {
703
- L();
704
- }, [L]), Pt(() => {
705
- be.current === r && Se.current === (d == null ? void 0 : d.assetId) || (L(), _.current = null, at(null), Tt(null), kt(null), Lt(0), v(0), R(!1), $e(!1), Ht(!1), rt.current = 0, k.current = 0, C.current = "none", F.current = !1, nt.current = null, yt.current = !1, X.current = null, Ut(), be.current = r, Se.current = d == null ? void 0 : d.assetId);
706
- }, [r, d == null ? void 0 : d.assetId, R, L, Ut]), Pt(() => {
707
- const e = St.current;
708
- e !== null && (St.current = null, requestAnimationFrame(() => {
709
- ot.current(e);
710
- }));
711
- }, [r, P, d == null ? void 0 : d.assetId]), Pt(() => {
712
- if (g === "opening") {
713
- Gt.current = !1, se(!1);
714
- return;
715
- }
716
- if (g !== "open" || Gt.current) return;
717
- if (!H && !A) {
718
- Gt.current = !0;
719
- return;
720
- }
721
- se(!1);
722
- const e = requestAnimationFrame(() => {
723
- requestAnimationFrame(() => {
724
- se(!0), Gt.current = !0;
725
- });
726
- });
727
- return () => cancelAnimationFrame(e);
728
- }, [g, H == null ? void 0 : H.assetId, A == null ? void 0 : A.assetId]), D(() => {
729
- if (g !== "open") return;
730
- const e = () => {
731
- const m = (T) => {
732
- T.stopPropagation(), T.preventDefault(), document.removeEventListener("click", m, !0);
733
- };
734
- document.addEventListener("click", m, !0);
735
- }, a = (m) => {
736
- const T = m < 0 ? 1 : -1;
737
- L(), Zt(T), _.current = T, at(T), R(!0), Kt();
738
- }, u = (m) => {
739
- if (Math.abs(m) > mn && lt) {
740
- a(m);
741
- return;
742
- }
743
- _.current = null, at(null), Tt(null), kt(null), R(!0), v(0), Ie();
744
- }, c = (m) => {
745
- if (m.touches.length !== 1 || xt.current) return;
746
- const T = m.touches[0];
747
- yt.current = !0, nt.current = { x: T.clientX, y: T.clientY }, C.current = "none", k.current = 0, F.current = !1;
748
- }, x = (m) => {
749
- if (!nt.current || m.touches.length !== 1 || xt.current) return;
750
- const T = m.touches[0], K = T.clientX - nt.current.x, J = T.clientY - nt.current.y;
751
- if (C.current === "none") {
752
- if (Math.abs(K) < 10 && Math.abs(J) < 10) return;
753
- if (Math.abs(K) > Math.abs(J)) {
754
- if (!lt) return;
755
- C.current = "horizontal";
756
- } else if (J > 0) {
757
- if (!ue) return;
758
- C.current = "vertical";
759
- } else
760
- return;
761
- }
762
- if (C.current === "horizontal") {
763
- F.current = !0, Ht(!0), k.current = K, v(K), m.preventDefault();
764
- return;
765
- }
766
- C.current === "vertical" && (F.current = !0, Ht(!0), rt.current = J, Lt(J), m.preventDefault());
767
- }, M = () => {
768
- if (!nt.current) return;
769
- const m = C.current, T = F.current;
770
- if (T && m === "horizontal")
771
- u(k.current), e();
772
- else if (T && m === "vertical") {
773
- const K = rt.current;
774
- if (ue && K > gn) {
775
- const J = window.innerHeight;
776
- rt.current = J, $e(!0), Lt(J), It("closing");
777
- } else
778
- rt.current = 0, Lt(0);
779
- e();
780
- } else m === "horizontal" && Math.abs(k.current) > 0 && (u(k.current), e());
781
- nt.current = null, C.current = "none", k.current = 0, F.current = !1, Ht(!1);
782
- };
783
- return document.addEventListener("touchstart", c, { passive: !0 }), document.addEventListener("touchmove", x, { passive: !1 }), document.addEventListener("touchend", M), document.addEventListener("touchcancel", M), () => {
784
- document.removeEventListener("touchstart", c), document.removeEventListener("touchmove", x), document.removeEventListener("touchend", M), document.removeEventListener("touchcancel", M);
785
- };
786
- }, [g, lt, R, Ie, L, ue, Kt, Zt]);
787
- const pe = w(() => {
788
- const e = (vt == null ? void 0 : vt()) ?? st ?? null;
789
- e && E && (Xe(e), ce(!0)), It("closing");
790
- }, [vt, st, E]);
791
- D(() => {
792
- const e = (c) => {
793
- if (c.key === "Escape") {
794
- if (l && s || g === "closing") return;
795
- ct(), pe();
796
- return;
797
- }
798
- if (c.key !== "ArrowLeft" && c.key !== "ArrowRight" || g !== "open" || !lt) return;
799
- c.preventDefault();
800
- const x = c.key === "ArrowLeft" ? -1 : 1;
801
- c.repeat && dt.current === x || Ae(x);
802
- }, a = (c) => {
803
- if (c.key !== "ArrowLeft" && c.key !== "ArrowRight") return;
804
- const x = c.key === "ArrowLeft" ? -1 : 1;
805
- dt.current === x && ct();
806
- }, u = () => {
807
- ct();
808
- };
809
- return window.addEventListener("keydown", e), window.addEventListener("keyup", a), window.addEventListener("blur", u), () => {
810
- window.removeEventListener("keydown", e), window.removeEventListener("keyup", a), window.removeEventListener("blur", u), ct();
811
- };
812
- }, [
813
- g,
814
- l,
815
- s,
816
- pe,
817
- lt,
818
- Ae,
819
- ct
820
- ]), D(() => {
821
- g !== "open" && ct();
822
- }, [g, ct]);
823
- const Ce = () => {
824
- g === "closing" || p || pe();
825
- }, O = g === "open", Jt = g === "closing", Je = q > 0 ? Math.max(0, 1 - q / 500) : 1, Qe = q > 0 ? Math.max(0.35, 1 - q / 500) : 1, Et = w((e) => {
826
- if (!(e.propertyName !== "transform" || !xt.current)) {
827
- if (_.current !== null) {
828
- Ct();
829
- return;
830
- }
831
- L(), R(!1);
832
- }
833
- }, [L, R, Ct]), ge = g === "closing" ? Ge ?? st : st, Pe = ge && E && (g === "opening" || Jt) ? xn(ge, E) : void 0, tn = U && d ? Te(d, "center") : q > 0 ? `translateY(${q}px)` : Pe, V = E ? te(E, N) : null, Ee = !!(ge && E), en = Ee && (g === "closing" || g === "open" && Be), Ne = {
834
- position: "absolute",
835
- top: V == null ? void 0 : V.top,
836
- left: V == null ? void 0 : V.left,
837
- width: V == null ? void 0 : V.width,
838
- height: V == null ? void 0 : V.height,
839
- objectFit: "contain",
840
- transformOrigin: "top left",
841
- transform: tn,
842
- opacity: q > 0 ? Qe : Ee ? 1 : g === "opening" || Jt ? 0 : 1,
843
- transition: Y && !S ? "none" : S ? `transform ${_t}ms ${B}` : qe ? `transform ${Q}ms ${B}, opacity ${Q}ms ${B}` : en ? `transform ${Q}ms ${B}` : g === "opening" || Jt ? `opacity ${Q}ms ${B}` : "none",
844
- pointerEvents: Xt && O && !U ? "auto" : "none",
845
- touchAction: Xt && O ? "none" : void 0,
846
- zIndex: 1,
847
- overflow: Xt ? "hidden" : void 0
848
- }, nn = {
849
- width: "100%",
850
- height: "100%",
851
- display: "block",
852
- objectFit: "contain",
853
- pointerEvents: O && !U ? "auto" : "none"
854
- }, Qt = (e, a, u = "adjacent") => {
855
- const c = Rt(e);
856
- if (!c) return { display: "none" };
857
- const x = u === "far" ? a === "left" ? "far-left" : "far-right" : a === "left" ? "left-adjacent" : "right-adjacent", { start: M } = z !== null ? Me(c, x, z, N) : {
858
- start: u === "far" ? re(c, a, N) : Nt(c, a, N)
859
- }, m = te(M, N), T = Te(e, x), K = !U && u === "adjacent" && O && !xe ? Cn(c, a, N) : null, J = u === "far" && U && z === (a === "left" ? -1 : 1), rn = Y && !S ? !1 : S, on = u === "adjacent" && O && xe && !U;
860
- return {
861
- position: "absolute",
862
- top: m.top,
863
- left: m.left,
864
- width: m.width,
865
- height: m.height,
866
- objectFit: "contain",
867
- transform: T ?? (K ? `translate(${K.x}px, ${K.y}px)` : void 0),
868
- opacity: u === "far" ? O && J ? 1 : 0 : O ? 1 : 0,
869
- transition: rn ? u === "far" ? `transform ${_t}ms ${B}` : `transform ${_t}ms ${B}, opacity ${Q}ms ${B}` : on ? `transform ${Q}ms ${B}` : g === "opening" || Jt ? `opacity ${Q}ms ${B}` : "none",
870
- pointerEvents: "none",
871
- zIndex: 1
872
- };
873
- }, Fe = (e, a) => {
874
- const u = Rt(e);
875
- return u ? An(Nt(u, a, N), a, N) : null;
876
- }, We = (e) => (a) => {
877
- if (!p) {
878
- if (yt.current) {
879
- yt.current = !1;
880
- return;
881
- }
882
- a.stopPropagation(), He(e);
883
- }
884
- }, ze = H ? Fe(H, "left") : null, Oe = A ? Fe(A, "right") : null, Ot = ze ? te(ze, N) : null, Dt = Oe ? te(Oe, N) : null;
885
- return /* @__PURE__ */ bt(
886
- "div",
887
- {
888
- ref: Wt,
889
- className: [
890
- `${t}-lightbox`,
891
- l ? `${t}-lightbox-editor` : "",
892
- p ? `${t}-lightbox-edit-mode` : ""
893
- ].filter(Boolean).join(" "),
894
- style: {
895
- touchAction: g === "open" ? "none" : void 0
896
- },
897
- onClick: Ce,
898
- children: [
899
- /* @__PURE__ */ h(
900
- "div",
901
- {
902
- style: {
903
- position: "absolute",
904
- inset: 0,
905
- background: i.backgroundColor ?? "#FFFFFF",
906
- opacity: O ? Je : 0,
907
- transition: Y ? "none" : `opacity ${Q}ms ${B}`,
908
- pointerEvents: "none"
909
- }
910
- }
911
- ),
912
- /* @__PURE__ */ bt("div", { className: `${t}-lightbox-dismiss-area`, children: [
913
- /* @__PURE__ */ bt(
914
- "div",
915
- {
916
- style: {
917
- position: "relative",
918
- width: "100%",
919
- height: "100%",
920
- display: "flex",
921
- flexDirection: "column",
922
- alignItems: "center",
923
- justifyContent: "center"
924
- },
925
- children: [
926
- /* @__PURE__ */ h("div", { style: { height: "10%" } }),
927
- /* @__PURE__ */ h(
928
- "div",
929
- {
930
- style: {
931
- width: "70%",
932
- height: "80%",
933
- display: "flex",
934
- justifyContent: "center",
935
- alignItems: "center"
936
- },
937
- children: /* @__PURE__ */ h("div", { ref: G, style: { width: "100%", height: "100%" } })
938
- }
939
- ),
940
- /* @__PURE__ */ h("div", { style: { height: "10%" } })
941
- ]
942
- }
943
- ),
944
- /* @__PURE__ */ h(
945
- "div",
946
- {
947
- style: {
948
- position: "absolute",
949
- inset: 0,
950
- opacity: O ? 1 : 0,
951
- transition: Y ? "none" : `opacity ${Q}ms ${B}`,
952
- pointerEvents: "none"
953
- },
954
- children: /* @__PURE__ */ h(
955
- hn,
956
- {
957
- prefix: t,
958
- entry: o,
959
- settings: i,
960
- isEditor: l,
961
- isEditMode: p,
962
- isPreviewMode: s,
963
- onClose: Ce
964
- }
965
- )
966
- }
967
- )
968
- ] }),
969
- O && qt && /* @__PURE__ */ h(
970
- ee,
971
- {
972
- media: qt,
973
- style: Qt(qt, "left", "far"),
974
- onMeasure: wt,
975
- onTransitionEnd: Et
976
- },
977
- `far-prev-${qt.assetId}`
978
- ),
979
- O && H && /* @__PURE__ */ bt(ve, { children: [
980
- /* @__PURE__ */ h(
981
- ee,
982
- {
983
- media: H,
984
- style: Qt(H, "left"),
985
- onMeasure: wt,
986
- onTransitionEnd: Et
987
- },
988
- `prev-${H.assetId}`
989
- ),
990
- Ot && /* @__PURE__ */ h(
991
- "div",
992
- {
993
- style: {
994
- position: "absolute",
995
- top: Ot.top,
996
- left: Ot.left,
997
- width: Ot.width,
998
- height: Ot.height,
999
- cursor: p || Y ? "default" : "pointer",
1000
- pointerEvents: p || Y ? "none" : "auto",
1001
- zIndex: 3
1002
- },
1003
- onClick: We(-1)
1004
- }
1005
- )
1006
- ] }),
1007
- O && A && /* @__PURE__ */ bt(ve, { children: [
1008
- /* @__PURE__ */ h(
1009
- ee,
1010
- {
1011
- media: A,
1012
- style: Qt(A, "right"),
1013
- onMeasure: wt,
1014
- onTransitionEnd: Et
1015
- },
1016
- `next-${A.assetId}`
1017
- ),
1018
- Dt && /* @__PURE__ */ h(
1019
- "div",
1020
- {
1021
- style: {
1022
- position: "absolute",
1023
- top: Dt.top,
1024
- left: Dt.left,
1025
- width: Dt.width,
1026
- height: Dt.height,
1027
- cursor: p || Y ? "default" : "pointer",
1028
- pointerEvents: p || Y ? "none" : "auto",
1029
- zIndex: 3
1030
- },
1031
- onClick: We(1)
1032
- }
1033
- )
1034
- ] }),
1035
- O && Yt && /* @__PURE__ */ h(
1036
- ee,
1037
- {
1038
- media: Yt,
1039
- style: Qt(Yt, "right", "far"),
1040
- onMeasure: wt,
1041
- onTransitionEnd: Et
1042
- },
1043
- `far-next-${Yt.assetId}`
1044
- ),
1045
- E && d && (Xt ? /* @__PURE__ */ h(
1046
- En,
1047
- {
1048
- src: d.assetId,
1049
- phase: g,
1050
- onMediaElement: Re,
1051
- wrapperStyle: Ne,
1052
- videoStyle: nn,
1053
- onLoadedMetadata: Z,
1054
- onTransitionEnd: Et
1055
- },
1056
- `${r}-${d.assetId}`
1057
- ) : /* @__PURE__ */ h(
1058
- "img",
1059
- {
1060
- ref: Re,
1061
- src: d.assetId,
1062
- alt: d.name,
1063
- onLoad: Z,
1064
- onTransitionEnd: Et,
1065
- style: Ne
1066
- },
1067
- `${r}-${d.assetId}`
1068
- ))
1069
- ]
1070
- }
1071
- );
1072
- }
1073
- const Fn = 20, Wn = 0.18;
1074
- function zn(t) {
1075
- return `
1076
- .${t}-wrapper {
1077
- box-sizing: border-box;
1078
- max-width: 100%;
1079
- overflow: visible;
1080
- overflow-wrap: anywhere;
1081
- word-break: break-word;
1082
- }
1083
- .${t}-item {
1084
- display: inline;
1085
- white-space: normal;
1086
- max-width: 100%;
1087
- }
1088
- .${t}-item-title {
1089
- display: inline;
1090
- white-space: pre-wrap;
1091
- overflow-wrap: anywhere;
1092
- word-break: break-word;
1093
- }
1094
- .${t}-type-a.${t}-wrapper,
1095
- .${t}-type-a .${t}-item-title {
1096
- text-align: left;
1097
- }
1098
- .${t}-type-b.${t}-wrapper,
1099
- .${t}-type-b .${t}-item-title {
1100
- text-align: center;
1101
- }
1102
- .${t}-type-c.${t}-wrapper,
1103
- .${t}-type-c .${t}-item-title {
1104
- text-align: right;
1105
- }
1106
- .${t}-item-image {
1107
- display: inline-block;
1108
- vertical-align: baseline;
1109
- position: relative;
1110
- z-index: 1;
1111
- height: 0;
1112
- width: calc(1cap * var(--${t}-image-aspect));
1113
- margin: 0 var(--${t}-image-inline-gap);
1114
- }
1115
- .${t}-item-image-fit {
1116
- width: calc(1cap * var(--${t}-item-media-aspect, var(--${t}-image-aspect)));
1117
- }
1118
- .${t}-item-image img,
1119
- .${t}-item-image video {
1120
- position: absolute;
1121
- left: 0;
1122
- bottom: 0;
1123
- display: block;
1124
- height: 1cap;
1125
- width: 100%;
1126
- max-height: none;
1127
- object-position: bottom;
1128
- }
1129
- .${t}-item-image-hover-scale img,
1130
- .${t}-item-image-hover-scale video {
1131
- transition: transform 0.3s ease;
1132
- }
1133
- .${t}-item-image-hover-scale:hover {
1134
- z-index: 10;
1135
- }
1136
- .${t}-item-image-hover-scale:hover img,
1137
- .${t}-item-image-hover-scale:hover video {
1138
- transform: scale(var(--${t}-image-hover-scale, 1.2));
1139
- }
1140
- .${t}-item-image-hover-saturate img,
1141
- .${t}-item-image-hover-saturate video {
1142
- filter: grayscale(100%);
1143
- transition: filter 0.3s ease;
1144
- }
1145
- .${t}-item-image-hover-saturate:hover img,
1146
- .${t}-item-image-hover-saturate:hover video {
1147
- filter: grayscale(0%);
1148
- }
1149
- .${t}-item-gap-host {
1150
- display: inline-block;
1151
- vertical-align: top;
1152
- height: var(--${t}-line-height);
1153
- position: relative;
1154
- flex-shrink: 0;
1155
- }
1156
- .${t}-item-gap-control {
1157
- position: absolute;
1158
- top: 0;
1159
- z-index: 2;
1160
- pointer-events: auto;
1161
- }
1162
- ${pn(t)}
1163
- `;
1164
- }
1165
- function On(t) {
1166
- const { imageDisplay: n } = t ?? {}, r = (n == null ? void 0 : n.ratioValue) ?? "1:1", o = (n == null ? void 0 : n.reversed) ?? !1, [i, l] = r.split(":").map(Number), p = o ? l : i, s = o ? i : l;
1167
- return s > 0 ? p / s : 1;
1168
- }
1169
- function Dn(t) {
1170
- const n = t instanceof HTMLVideoElement ? t.videoWidth : t.naturalWidth, r = t instanceof HTMLVideoElement ? t.videoHeight : t.naturalHeight;
1171
- return !n || !r ? null : n / r;
1172
- }
1173
- function _n(t, n, r) {
1174
- const o = (t == null ? void 0 : t.titleFontSize) ?? 0.07, i = (t == null ? void 0 : t.titleLineHeight) ?? o;
1175
- return {
1176
- [`--${n}-line-height`]: ne(i, r ?? !1),
1177
- [`--${n}-image-inline-gap`]: ne(o * Wn, r ?? !1),
1178
- [`--${n}-image-aspect`]: On(t)
1179
- };
1180
- }
1181
- function jn(t, n) {
1182
- var o, i;
1183
- const r = {
1184
- fontSettings: {
1185
- fontFamily: (t == null ? void 0 : t.titleFontFamily) ?? "Arial",
1186
- fontWeight: ((o = t == null ? void 0 : t.titleFontSettings) == null ? void 0 : o.fontWeight) ?? 400,
1187
- fontStyle: ((i = t == null ? void 0 : t.titleFontSettings) == null ? void 0 : i.fontStyle) ?? "normal"
1188
- },
1189
- fontSize: (t == null ? void 0 : t.titleFontSize) ?? 0.07,
1190
- lineHeight: t == null ? void 0 : t.titleLineHeight,
1191
- letterSpacing: (t == null ? void 0 : t.titleLetterSpacing) ?? 0,
1192
- wordSpacing: (t == null ? void 0 : t.titleWordSpacing) ?? 0,
1193
- textAppearance: t == null ? void 0 : t.titleTextAppearance,
1194
- color: (t == null ? void 0 : t.titleColor) ?? "#000000"
1195
- };
1196
- return fn(r, n);
1197
- }
1198
- function Vn(t) {
1199
- var i;
1200
- const n = ((i = t == null ? void 0 : t.imageDisplay) == null ? void 0 : i.display) === "cover", r = ((t == null ? void 0 : t.lightbox) ?? "on") === "on", o = {
1201
- objectFit: n ? "cover" : "contain",
1202
- pointerEvents: "auto",
1203
- ...r ? { cursor: "pointer" } : null
1204
- };
1205
- return {
1206
- objectFitMode: n ? "cover" : "contain",
1207
- imageStyle: o
1208
- };
1209
- }
1210
- function Mn(t, n, r, o, i, l) {
1211
- if (!(!t || !n))
1212
- return (p) => {
1213
- var I;
1214
- const s = ((I = p.currentTarget.closest(`.${o}-item`)) == null ? void 0 : I.querySelector(
1215
- `[data-waterfall-index="${r}"]`
1216
- )) ?? (p.currentTarget instanceof HTMLImageElement || p.currentTarget instanceof HTMLVideoElement ? p.currentTarget : null);
1217
- l(
1218
- r,
1219
- s ? je(s, i) : void 0
1220
- );
1221
- };
1222
- }
1223
- function Pn({
1224
- settings: t,
1225
- content: n,
1226
- isEditor: r,
1227
- isPreviewMode: o,
1228
- isEditMode: i,
1229
- layoutId: l,
1230
- portalId: p
1231
- }) {
1232
- const { prefix: s } = sn(), I = me(() => zn(s), [s]), b = n ?? [], P = (t == null ? void 0 : t.type) ?? "a", ie = typeof (t == null ? void 0 : t.wrapperWidth) == "number" ? t.wrapperWidth : 1, st = typeof (t == null ? void 0 : t.horizontalGap) == "number" ? t.horizontalGap : 0, vt = ne(st, r ?? !1), Vt = `max(${vt}, ${Fn}px)`, { objectFitMode: tt, imageStyle: Ft } = Vn(t), Wt = jn(t, r), G = y(null), [X, et] = $(!1), [ut, Mt] = $([]), [nt, rt] = $(0), [k, C] = $(0), [F, yt] = $(null), [xt, ft] = $({ title1: "", title2: "", title3: "" }), _ = (!r || o) && !X, St = (t == null ? void 0 : t.imageHoverEffect) ?? { sizeType: "none", value: 120 }, ot = St.sizeType ?? "none", dt = _ && ot !== "none" ? `${s}-item-image-hover-${ot}` : void 0, ht = (St.value ?? 120) / 100, pt = w((f) => {
1233
- !f || ot !== "scale" || (f.style.transformOrigin = cn(f));
1234
- }, [ot]), it = w((f) => {
1235
- if (f) {
1236
- if (tt === "contain") {
1237
- const v = Dn(f);
1238
- if (v) {
1239
- const S = f.closest(`.${s}-item-image`);
1240
- S instanceof HTMLElement && S.style.setProperty(`--${s}-item-media-aspect`, String(v));
1241
- }
1242
- }
1243
- pt(f);
1244
- }
1245
- }, [s, pt, tt]), E = {
1246
- width: ne(ie, r ?? !1),
1247
- ...Wt,
1248
- ..._n(t, s, r),
1249
- [`--${s}-image-hover-scale`]: String(ht)
1250
- }, $t = (() => {
1251
- const f = {}, v = G.current ? getComputedStyle(G.current).getPropertyValue("--cntrl-article-width").trim() : "";
1252
- return v && (f["--cntrl-article-width"] = v), f;
1253
- })(), N = ((t == null ? void 0 : t.lightbox) ?? "on") === "on" && (!r || o || i), W = me(() => bn(b), [b]), ae = me(() => kn(b), [b]), le = (f, v) => {
1254
- if (((t == null ? void 0 : t.lightbox) ?? "on") === "off" || r && !i && !o) return;
1255
- const S = W.findIndex((z) => z.gridIndex === f);
1256
- if (S < 0) return;
1257
- const j = W[S];
1258
- C(S), Mt(j.items), rt(0), ft(j.entry), yt(v ?? null), et(!0);
1259
- }, g = w(() => {
1260
- et(!1), yt(null);
1261
- }, []), It = w(() => {
1262
- const f = W[k];
1263
- return !f || !G.current ? F : $n(G.current, f.gridIndex, tt) ?? F;
1264
- }, [W, k, F, tt]), q = w((f) => {
1265
- if (W.length > 1) {
1266
- const v = W.length, S = (k + f + v) % v, j = W[S];
1267
- C(S), Mt(j.items), rt(0), ft(j.entry);
1268
- return;
1269
- }
1270
- rt((v) => (v + f + ut.length) % ut.length);
1271
- }, [W, k, ut.length]), Lt = W.length > 1 || ut.length > 1;
1272
- return D(() => {
1273
- if (!X || typeof document > "u") return;
1274
- const f = document.body.style.overflow;
1275
- return document.body.style.overflow = "hidden", () => {
1276
- document.body.style.overflow = f;
1277
- };
1278
- }, [X]), D(() => {
1279
- !r || i || o || et(!1);
1280
- }, [r, i, o]), D(() => {
1281
- ((t == null ? void 0 : t.lightbox) ?? "on") === "off" && et(!1);
1282
- }, [t == null ? void 0 : t.lightbox]), /* @__PURE__ */ bt(ve, { children: [
1283
- /* @__PURE__ */ h("style", { dangerouslySetInnerHTML: { __html: I } }),
1284
- /* @__PURE__ */ h(Hn, { mediaList: ae }),
1285
- /* @__PURE__ */ h("div", { ref: G, className: `${s}-wrapper ${s}-type-${P}`, style: E, children: b.map((f, v) => {
1286
- var z, at;
1287
- const S = !!((z = f.image) != null && z.assetId), j = Mn(
1288
- !!N,
1289
- S,
1290
- v,
1291
- s,
1292
- tt,
1293
- le
1294
- );
1295
- return /* @__PURE__ */ bt(
1296
- "div",
1297
- {
1298
- className: `${s}-item`,
1299
- children: [
1300
- f.title ? /* @__PURE__ */ h(
1301
- "span",
1302
- {
1303
- className: `${s}-item-title`,
1304
- onClick: j,
1305
- style: j ? { cursor: "pointer" } : void 0,
1306
- children: f.title
1307
- }
1308
- ) : null,
1309
- (at = f.image) != null && at.assetId ? /* @__PURE__ */ h(
1310
- "span",
1311
- {
1312
- className: [
1313
- `${s}-item-image`,
1314
- tt === "contain" ? `${s}-item-image-fit` : void 0,
1315
- dt
1316
- ].filter(Boolean).join(" "),
1317
- children: f.image.type === "video" ? /* @__PURE__ */ h(
1318
- un,
1319
- {
1320
- ref: it,
1321
- src: f.image.assetId,
1322
- "data-waterfall-index": v,
1323
- style: Ft,
1324
- playsInline: !0,
1325
- muted: !0,
1326
- loop: !0,
1327
- autoPlay: !0,
1328
- onClick: j,
1329
- onLoadedMetadata: (gt) => it(gt.currentTarget)
1330
- }
1331
- ) : /* @__PURE__ */ h(
1332
- "img",
1333
- {
1334
- ref: it,
1335
- src: f.image.assetId,
1336
- alt: f.image.name ?? "",
1337
- "data-waterfall-index": v,
1338
- style: Ft,
1339
- onClick: j,
1340
- onLoad: (gt) => it(gt.currentTarget)
1341
- }
1342
- )
1343
- }
1344
- ) : null,
1345
- v < b.length - 1 && /* @__PURE__ */ h(
1346
- "div",
1347
- {
1348
- className: `${s}-item-gap-host`,
1349
- style: { width: vt },
1350
- children: i && !X && /* @__PURE__ */ h(
1351
- "div",
1352
- {
1353
- "data-controls": "horizontalGap",
1354
- "data-controls-axis": "x",
1355
- "data-controls-min": "0",
1356
- className: `${s}-item-gap-control`,
1357
- style: {
1358
- left: "50%",
1359
- transform: "translateX(-50%)",
1360
- width: Vt,
1361
- height: "100%"
1362
- }
1363
- }
1364
- )
1365
- }
1366
- )
1367
- ]
1368
- },
1369
- v
1370
- );
1371
- }) }),
1372
- X && ((t == null ? void 0 : t.lightbox) ?? "on") === "on" && typeof document < "u" && t && (() => {
1373
- const f = (p ? document.getElementById(p) : null) ?? document.body;
1374
- return an(
1375
- /* @__PURE__ */ h("div", { style: $t, "data-selection": "none", children: /* @__PURE__ */ h(
1376
- Nn,
1377
- {
1378
- prefix: s,
1379
- items: ut,
1380
- index: nt,
1381
- entry: xt,
1382
- settings: t,
1383
- isEditor: r,
1384
- isEditMode: i,
1385
- isPreviewMode: o,
1386
- canNavigate: Lt,
1387
- lightboxEntries: W,
1388
- entryIdx: k,
1389
- layoutId: l,
1390
- sourceRect: F,
1391
- resolveCloseSourceRect: It,
1392
- onClose: g,
1393
- onPrev: () => q(-1),
1394
- onNext: () => q(1)
1395
- }
1396
- ) }),
1397
- f
1398
- );
1399
- })()
1400
- ] });
1401
- }
1402
- export {
1403
- Pn as Waterfall
1404
- };