@cntrl-site/components 1.0.101 → 1.0.102

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