@cntrl-site/components 1.0.100 → 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 -28866
  99. package/dist/index.mjs +16 -62477
  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,321 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),ne=require("./scalingValue-CSHYgTZl.js"),nn=require("./useScopedStyles-Bf6yohVQ.js"),r=require("react"),rn=require("react-dom"),on=require("./HiveLightboxTitles-DlyptAaK.js"),sn=require("./getImageRect-BQhQXvT8.js");function an(t){return`calc(var(--cntrl-article-width, 100vw) * ${t/1440})`}function ln(t){return`
2
+ .${t}-wrapper {
3
+ display: grid;
4
+ align-items: start;
5
+ justify-content: center;
6
+ min-height: ${an(48)};
7
+ }
8
+ .${t}-item {
9
+ display: flex;
10
+ flex-direction: column;
11
+ justify-content: center;
12
+ align-items: center;
13
+ }
14
+ .${t}-item-inner {
15
+ display: flex;
16
+ flex-direction: column;
17
+ align-items: center;
18
+ outline: 1px solid #FF5C02;
19
+ }
20
+ .${t}-item-inner-hidden {
21
+ display: flex;
22
+ flex-direction: column;
23
+ align-items: center;
24
+ }
25
+ .${t}-item-image-wrapper {
26
+ display: flex;
27
+ justify-content: center;
28
+ align-items: center;
29
+ align-self: center;
30
+ }
31
+ .${t}-item-image-link {
32
+ width: 100%;
33
+ display: flex;
34
+ flex-direction: column;
35
+ align-items: center;
36
+ }
37
+ .${t}-item-image {
38
+ width: 100%;
39
+ height: 100%;
40
+ display: block;
41
+ max-width: 100%;
42
+ }
43
+ .${t}-item-video {
44
+ width: 100%;
45
+ height: 100%;
46
+ display: block;
47
+ max-width: 100%;
48
+ }
49
+ .${t}-image-align-top .${t}-item-image-wrapper {
50
+ align-items: flex-start;
51
+ }
52
+ .${t}-image-align-center .${t}-item-image-wrapper {
53
+ align-items: center;
54
+ }
55
+ .${t}-image-align-bottom .${t}-item-image-wrapper {
56
+ align-items: flex-end;
57
+ }
58
+ .${t}-align-entries .${t}-item {
59
+ display: contents;
60
+ }
61
+ .${t}-align-entries .${t}-item-inner,
62
+ .${t}-align-entries .${t}-item-inner-hidden {
63
+ display: grid;
64
+ grid-template-rows: subgrid;
65
+ grid-row: span 3;
66
+ justify-self: center;
67
+ margin-bottom: var(--${t}-align-entries-row-gap, 0);
68
+ }
69
+ .${t}-align-entries .${t}-item-inner-last-row {
70
+ margin-bottom: 0;
71
+ }
72
+ .${t}-align-entries .${t}-item-title-row,
73
+ .${t}-align-entries .${t}-item-subtitle-row {
74
+ display: flex;
75
+ flex-direction: column;
76
+ align-items: center;
77
+ width: 100%;
78
+ min-height: 100%;
79
+ }
80
+ .${t}-align-entries .${t}-item-image-link {
81
+ width: 100%;
82
+ height: 100%;
83
+ min-height: 100%;
84
+ display: flex;
85
+ flex-direction: column;
86
+ align-items: center;
87
+ justify-content: flex-start;
88
+ }
89
+ .${t}-align-entries .${t}-item-image-link > .${t}-item-image-wrapper {
90
+ flex-shrink: 0;
91
+ height: auto;
92
+ align-self: auto;
93
+ }
94
+ .${t}-image-align-top.${t}-align-entries .${t}-item-image-link > .${t}-item-image-wrapper {
95
+ margin-top: 0;
96
+ margin-bottom: auto;
97
+ }
98
+ .${t}-image-align-center.${t}-align-entries .${t}-item-image-link > .${t}-item-image-wrapper {
99
+ margin-top: auto;
100
+ margin-bottom: auto;
101
+ }
102
+ .${t}-image-align-bottom.${t}-align-entries .${t}-item-image-link > .${t}-item-image-wrapper {
103
+ margin-top: auto;
104
+ margin-bottom: 0;
105
+ }
106
+ .${t}-image-align-top.${t}-align-entries .${t}-item-image-wrapper {
107
+ align-items: flex-start;
108
+ }
109
+ .${t}-image-align-center.${t}-align-entries .${t}-item-image-wrapper {
110
+ align-items: center;
111
+ }
112
+ .${t}-image-align-bottom.${t}-align-entries .${t}-item-image-wrapper {
113
+ align-items: flex-end;
114
+ }
115
+ .${t}-image-align-top.${t}-align-entries .${t}-item-image-link {
116
+ justify-content: flex-start;
117
+ }
118
+ .${t}-image-align-center.${t}-align-entries .${t}-item-image-link {
119
+ justify-content: center;
120
+ }
121
+ .${t}-image-align-bottom.${t}-align-entries .${t}-item-image-link {
122
+ justify-content: flex-end;
123
+ }
124
+ .${t}-titles-row {
125
+ position: relative;
126
+ flex: 0 1 auto;
127
+ z-index: 2;
128
+ box-sizing: border-box;
129
+ pointer-events: none;
130
+ word-break: break-word;
131
+ min-width: 0;
132
+ display: flex;
133
+ flex-direction: row;
134
+ align-items: baseline;
135
+ }
136
+ .${t}-titles-row-header {
137
+ flex: 1;
138
+ align-items: baseline;
139
+ }
140
+ .${t}-titles-row-header-controls {
141
+ display: flex;
142
+ flex-direction: row;
143
+ align-items: baseline;
144
+ flex-shrink: 0;
145
+ }
146
+ .${t}-close-icon {
147
+ position: relative;
148
+ flex-shrink: 0;
149
+ align-self: center;
150
+ pointer-events: auto;
151
+ z-index: 2;
152
+ display: flex;
153
+ align-items: center;
154
+ justify-content: center;
155
+ border: none;
156
+ background-color: transparent;
157
+ padding: 0;
158
+ }
159
+ .${t}-close-icon-inner {
160
+ all: unset;
161
+ position: relative;
162
+ cursor: pointer;
163
+ width: 100%;
164
+ height: 100%;
165
+ pointer-events: auto;
166
+ }
167
+ .${t}-close-icon-img {
168
+ position: absolute;
169
+ top: 50%;
170
+ left: 50%;
171
+ transform: translate(-50%, -50%);
172
+ }
173
+ .${t}-titles-baseline-strut {
174
+ width: 0;
175
+ overflow: hidden;
176
+ flex-shrink: 0;
177
+ pointer-events: none;
178
+ white-space: nowrap;
179
+ }
180
+ .${t}-titles-row-titles {
181
+ position: relative;
182
+ flex: 1;
183
+ min-width: 0;
184
+ align-self: flex-start;
185
+ }
186
+ .${t}-titles-stack {
187
+ position: relative;
188
+ display: flex;
189
+ flex-direction: row;
190
+ align-items: baseline;
191
+ align-self: flex-start;
192
+ min-width: 0;
193
+ }
194
+ .${t}-titles-row-two-row {
195
+ display: flex;
196
+ flex: 1;
197
+ height: 100%;
198
+ min-height: 0;
199
+ align-self: stretch;
200
+ flex-direction: column;
201
+ width: 100%;
202
+ }
203
+ .${t}-titles-row-top {
204
+ display: flex;
205
+ flex-direction: row;
206
+ align-items: baseline;
207
+ width: 100%;
208
+ flex-shrink: 0;
209
+ margin-bottom: 0;
210
+ }
211
+ .${t}-titles-row-top .${t}-title-cell[data-title="title1"] {
212
+ flex: 0 0 auto;
213
+ min-width: 0;
214
+ }
215
+ .${t}-titles-row-bottom-wrap {
216
+ display: flex;
217
+ flex-direction: column;
218
+ width: 100%;
219
+ margin-top: auto;
220
+ flex-shrink: 0;
221
+ }
222
+ .${t}-titles-row-bottom-area {
223
+ position: relative;
224
+ flex: 1;
225
+ min-height: 0;
226
+ display: flex;
227
+ flex-direction: column;
228
+ width: 100%;
229
+ }
230
+ .${t}-titles-row-bottom {
231
+ position: relative;
232
+ display: flex;
233
+ flex-direction: row;
234
+ align-items: flex-end;
235
+ width: 100%;
236
+ }
237
+ .${t}-titles-row-bottom .${t}-title-cell {
238
+ flex: 0 0 auto;
239
+ }
240
+ .${t}-title-cell {
241
+ position: relative;
242
+ flex: 0 0 auto;
243
+ min-width: 0;
244
+ box-sizing: border-box;
245
+ }
246
+ .${t}-text-bar-cell {
247
+ position: relative;
248
+ flex: 0 1 auto;
249
+ min-width: 0;
250
+ display: flex;
251
+ align-items: baseline;
252
+ }
253
+ .${t}-title1,
254
+ .${t}-title2,
255
+ .${t}-title3 {
256
+ margin: 0;
257
+ min-width: 0;
258
+ }
259
+ .${t}-title-resize-handle {
260
+ background: transparent;
261
+ }
262
+ .${t}-lightbox {
263
+ position: fixed;
264
+ inset: 0;
265
+ z-index: 9997;
266
+ overscroll-behavior: none;
267
+ overflow: hidden;
268
+ }
269
+ .${t}-lightbox-editor {
270
+ inset: auto;
271
+ top: var(--cntrl-article-top, 0);
272
+ left: var(--cntrl-article-left, 0);
273
+ width: var(--cntrl-article-width, 100vw) !important;
274
+ height: var(--cntrl-viewport-height, 100vh) !important;
275
+ }
276
+ .${t}-lightbox-edit-mode {
277
+ z-index: 1;
278
+ }
279
+ .${t}-lightbox-dismiss-area {
280
+ position: relative;
281
+ width: 100%;
282
+ height: 100%;
283
+ }
284
+ .${t}-lightbox-overlay-content {
285
+ position: absolute;
286
+ inset: 0;
287
+ z-index: 3;
288
+ pointer-events: none;
289
+ display: flex;
290
+ flex-direction: column;
291
+ isolation: isolate;
292
+ }
293
+ .${t}-lightbox-content-area {
294
+ position: relative;
295
+ display: flex;
296
+ flex-direction: row;
297
+ align-items: flex-start;
298
+ flex: 1;
299
+ min-width: 0;
300
+ min-height: 0;
301
+ }
302
+ .${t}-lightbox-content-area-stacked {
303
+ align-items: stretch;
304
+ align-self: stretch;
305
+ }
306
+ .${t}-text-bar-cell-stacked {
307
+ align-self: stretch;
308
+ flex: 1;
309
+ min-width: 0;
310
+ min-height: 0;
311
+ height: 100%;
312
+ flex-direction: column;
313
+ align-items: stretch;
314
+ }
315
+ .${t}-control {
316
+ position: relative;
317
+ z-index: 2;
318
+ pointer-events: auto;
319
+ flex-shrink: 0;
320
+ }
321
+ `}const We={assetId:"",name:"",objectFit:"cover"},et=500,Gt=650,_="cubic-bezier(0.22, 1, 0.36, 1)",cn=72,un=50,fn=1e4,dn=650,hn=500;function gn(t,e){const i=t.width/e.width,o=t.height/e.height,s=t.left-e.left,c=t.top-e.top;return`translate(${s}px, ${c}px) scale(${i}, ${o})`}function De(t,e){if(e==="contain"&&t instanceof HTMLImageElement){const o=sn.getDisplayedImageRect(t);return{left:o.x,top:o.y,width:o.width,height:o.height}}const i=t.getBoundingClientRect();return{left:i.left,top:i.top,width:i.width,height:i.height}}function pn(t,e,i){const o=t.querySelector(`[data-hive-grid-index="${e}"]`);return o instanceof HTMLElement?De(o,i):null}function mn(t){return t.reduce((e,i,o)=>{const s=we(i.gallery),p=ve(s).filter(u=>u.lightboxMedia).map(u=>u.lightboxMedia);return p.length===0||e.push({gridIndex:o,items:p,entry:{title1:i.title1??"",title2:i.title2??"",title3:i.title3??""}}),e},[])}function qt(t,e,i){var s;if(t.length<=1)return null;const o=(e+i+t.length)%t.length;return((s=t[o])==null?void 0:s.items[0])??null}function Oe(t,e,i){if(t.length<=2)return null;const o=(e+i+t.length)%t.length;return qt(t,o,i)}const wn=.03;function ze(t){return t.width*wn}const pe={left:0,top:0,width:typeof window<"u"?window.innerWidth:1440,height:typeof window<"u"?window.innerHeight:900};function ie(t,e){return{left:t.left-e.left,top:t.top-e.top,width:t.width,height:t.height}}function Me(t){const e=t.getBoundingClientRect();return{width:e.width,height:e.height,left:e.left,top:e.top}}function vn(t){return t instanceof HTMLVideoElement?{width:t.videoWidth,height:t.videoHeight}:{width:t.naturalWidth,height:t.naturalHeight}}function me(t,e,i){const o=t.getBoundingClientRect(),s=o.width,c=o.height,p=e/i,u=s/c;if(p>u){const I=s/p;return{width:s,height:I,left:o.left,top:o.top+(c-I)/2}}const y=c*p;return{width:y,height:c,left:o.left+(s-y)/2,top:o.top}}function xn(t,e){return!t||!(e!=null&&e.width)||!(e!=null&&e.height)?null:me(t,e.width,e.height)}function yn(t,e){if(Ft(t)){const o=document.createElement("video"),s=()=>{o.videoWidth>0&&o.videoHeight>0&&e(t.assetId,o.videoWidth,o.videoHeight),o.removeEventListener("loadedmetadata",s)};o.addEventListener("loadedmetadata",s),o.preload="auto",o.src=t.assetId,o.load();return}const i=new Image;i.onload=()=>{i.naturalWidth>0&&i.naturalHeight>0&&e(t.assetId,i.naturalWidth,i.naturalHeight)},i.src=t.assetId}function $n(t){const e=new Set,i=[];for(const o of t){const s=we(o.gallery),c=ve(s);for(const p of c)for(const u of[p.displayMedia,p.lightboxMedia])u!=null&&u.assetId&&!e.has(u.assetId)&&(e.add(u.assetId),i.push(u))}return i}function bn({mediaList:t}){return t.length===0?null:l.jsx("div",{"aria-hidden":!0,style:{position:"absolute",width:0,height:0,overflow:"hidden",opacity:0,pointerEvents:"none"},children:t.map(e=>Ft(e)?l.jsx("video",{src:e.assetId,preload:"auto",muted:!0,playsInline:!0},e.assetId):l.jsx("img",{src:e.assetId,alt:""},e.assetId))})}function Ht(t,e,i){const{width:o,height:s,top:c}=t,{left:p,width:u}=i,y=ze(i);return e==="left"?{left:p+y-o,top:c,width:o,height:s}:{left:p+u-y,top:c,width:o,height:s}}function oe(t,e,i){const o=Ht(t,e,i);return{...o,left:2*o.left-t.left}}function In(t,e,i){const{left:o,width:s}=i,c=ze(i);return e==="left"?{left:o,top:t.top,width:c,height:t.height}:{left:o+s-c,top:t.top,width:c,height:t.height}}function _e(t,e,i,o){const s=Ht(t,"left",o),c=Ht(t,"right",o),p=oe(t,"left",o),u=oe(t,"right",o);if(i===1)switch(e){case"center":return{start:t,end:s};case"right-adjacent":return{start:c,end:t};case"left-adjacent":return{start:s,end:p};case"far-right":return{start:u,end:c};default:return{start:t,end:t}}switch(e){case"center":return{start:t,end:c};case"left-adjacent":return{start:s,end:t};case"right-adjacent":return{start:c,end:u};case"far-left":return{start:p,end:s};default:return{start:t,end:t}}}function Sn(t,e,i,o){const{start:s,end:c}=_e(t,e,i,o);return{x:c.left-s.left,y:c.top-s.top}}function kn(t,e,i){const o=Ht(t,e,i),s=oe(t,e,i);return{x:s.left-o.left,y:s.top-o.top}}function Ve(t){if(!Array.isArray(t)||t.length===0)return!1;const e=t[0];return e!==null&&typeof e=="object"&&"media"in e&&Array.isArray(e.media)}function we(t){if(!t)return;if(Ve(t))return t;if(!Array.isArray(t))return;const[e,i]=t,o=e!=null&&e.assetId?e:void 0,s=i!=null&&i.assetId?i:void 0;if(!(!o&&!s))return[{media:[s??o??We,o??s??We]}]}function Ln(t){const[e,i]=t.media;return i!=null&&i.assetId?i:e!=null&&e.assetId?e:null}function Rn(t){const[e]=t.media;return e!=null&&e.assetId?e:null}function ve(t){if(!Array.isArray(t)||t.length===0)return[];if(Ve(t)){const e=[];for(const i of t){const o=Ln(i);if(!o)continue;const s=Rn(i);e.push({displayMedia:o,lightboxMedia:s!=null&&s.assetId?s:null})}return e}return t.filter(e=>e==null?void 0:e.assetId).map(e=>({displayMedia:e,lightboxMedia:e}))}function Ft(t){return t.type==="video"?!0:/\.(mp4|webm|ogg|mov)(\?|#|$)/i.test(t.assetId)}function jn({media:t,className:e,style:i,gridIndex:o,onMediaClick:s}){return Ft(t)?l.jsx("video",{src:t.assetId,className:e,"data-hive-grid-index":o,style:{...i,cursor:s?"pointer":"default"},muted:!0,autoPlay:!0,loop:!0,playsInline:!0,preload:"auto",onClick:s}):l.jsx("img",{src:t.assetId,alt:t.name,className:e,"data-hive-grid-index":o,style:{...i,cursor:s?"pointer":"default"},onClick:s})}function Cn({src:t,phase:e,onMediaElement:i,wrapperStyle:o,videoStyle:s,onLoadedMetadata:c,onTransitionEnd:p}){const u=r.useRef(null);return r.useEffect(()=>{const y=u.current;return i==null||i(y??null),()=>{y==null||y.pause(),i==null||i(null)}},[t,i]),l.jsx("div",{style:o,onTransitionEnd:p,children:l.jsx("video",{ref:u,src:t,controls:e==="open",playsInline:!0,preload:"auto",onLoadedMetadata:c,onClick:y=>y.stopPropagation(),style:s},t)})}function re({media:t,style:e,onTransitionEnd:i,onMeasure:o}){return Ft(t)?l.jsx("video",{src:t.assetId,muted:!0,playsInline:!0,preload:"auto",style:e,onLoadedMetadata:s=>{const c=s.currentTarget;c.videoWidth>0&&c.videoHeight>0&&(o==null||o(t.assetId,c.videoWidth,c.videoHeight))},onTransitionEnd:i}):l.jsx("img",{src:t.assetId,alt:t.name,style:e,onLoad:s=>{const c=s.currentTarget;c.naturalWidth>0&&c.naturalHeight>0&&(o==null||o(t.assetId,c.naturalWidth,c.naturalHeight))},onTransitionEnd:i})}function An({prefix:t,items:e,index:i,entry:o,settings:s,isEditor:c,isEditMode:p,isPreviewMode:u,canNavigate:y,lightboxEntries:I,entryIdx:nt,layoutId:V,sourceRect:N,resolveCloseSourceRect:It,onClose:Nt,onPrev:Wt,onNext:Ot}){const Xt=r.useRef(null),St=r.useRef(null),kt=r.useRef(null),Lt=r.useRef(new Map),[G,Rt]=r.useState(0),it=r.useRef(null),vt=r.useRef(0),W=r.useRef(0),H=r.useRef("none"),q=r.useRef(!1),X=r.useRef(!1),rt=r.useRef(!1),ot=r.useRef(null),S=r.useRef(null),jt=r.useRef(null),ct=r.useRef(()=>{}),Y=r.useRef(null),O=r.useRef(null),ut=r.useRef(null),st=r.useRef(!1),[L,xt]=r.useState(null),[R,Yt]=r.useState(pe),[se,ae]=r.useState(0),[h,ft]=r.useState("opening"),[U,yt]=r.useState(0),[Mt,k]=r.useState(0),[B,le]=r.useState(!1),[Z,dt]=r.useState(null),[$t,ht]=r.useState(null),[x,w]=r.useState(null),[gt,j]=r.useState(!1),[pt,Dt]=r.useState(null),[zt,K]=r.useState(!1),bt=r.useRef(!1),[M,E]=r.useState(!1),[Be,xe]=r.useState(!1),ye=r.useRef(i),$e=r.useRef(void 0),g=e[i],Ut=g?Ft(g):!1,J=Mt!==0||B,ce=!p&&(!c||!!u),at=y&&!p,mt=I.length>1,Ct=r.useCallback((n,a)=>e.length<=1?null:e[(n+a+e.length)%e.length]??null,[e]),C=mt?qt(I,nt,-1):Ct(i,-1),A=mt?qt(I,nt,1):Ct(i,1),ue=Z===-1&&J?mt&&$t!==null?qt(I,$t,-1):x!==null?Ct(x,-1):null:null,fe=Z===1&&J?mt&&$t!==null?qt(I,$t,1):x!==null?Ct(x,1):null:null,Ge=ue&&ue.assetId!==(C==null?void 0:C.assetId)?ue:null,qe=fe&&fe.assetId!==(A==null?void 0:A.assetId)?fe:null,Xe=C&&at?(()=>{const n=mt?Oe(I,nt,-1):e.length>2?Ct((i-1+e.length)%e.length,-1):null;return n&&n.assetId!==C.assetId?n:null})():null,Ye=A&&at?(()=>{const n=mt?Oe(I,nt,1):e.length>2?Ct((i+1)%e.length,1):null;return n&&n.assetId!==A.assetId?n:null})():null,Zt=Ge??Xe,Kt=qe??Ye,wt=r.useCallback((n,a,d)=>{if(!n||!a||!d)return;const f=Lt.current,v=f.get(n);(v==null?void 0:v.width)===a&&(v==null?void 0:v.height)===d||(f.set(n,{width:a,height:d}),Rt(z=>z+1))},[]),At=r.useCallback(n=>{if(!(n!=null&&n.assetId))return null;const a=Lt.current.get(n.assetId);return xn(St.current,a)},[G,se]),Jt=r.useCallback(()=>{if(!g)return;const n=At(g);if(n){xt(n);return}const a=St.current;a&&xt(Me(a))},[g,At]),Qt=r.useCallback(n=>{if(mt){const a=I.length;ht((nt+n+a)%a),w(null);return}e.length>1&&(w((i+n+e.length)%e.length),ht(null))},[mt,I.length,nt,e.length,i]),T=r.useCallback(n=>{rt.current=n,le(n)},[]),$=r.useCallback(()=>{ot.current!==null&&(window.clearTimeout(ot.current),ot.current=null)},[]),be=r.useCallback(()=>{$(),ot.current=window.setTimeout(()=>{$(),T(!1)},Gt+32)},[$,T]),Ie=r.useCallback(()=>{const n=Xt.current;if(!n){Yt({left:0,top:0,width:typeof window<"u"?window.innerWidth:pe.width,height:typeof window<"u"?window.innerHeight:pe.height});return}const a=n.getBoundingClientRect();Yt({left:a.left,top:a.top,width:a.width,height:a.height})},[]),Se=r.useCallback((n,a)=>{if(J){if(M&&!B)return`translate(${Mt}px, 0px)`;if(B&&Z!==null){const d=At(n);if(!d)return;const{x:f,y:v}=Sn(d,a,Z,R);return`translate(${f}px, ${v}px)`}if(B)return"translate(0px, 0px)"}},[J,M,B,Mt,Z,R,At]),Tt=r.useCallback(()=>{const n=S.current;S.current=null,$(),T(!1),dt(null),ht(null),w(null),k(0),E(!1),q.current=!1,W.current=0,H.current="none",n===-1?Wt():n===1&&Ot()},[$,T,Wt,Ot]),Pt=r.useCallback(()=>{$(),ot.current=window.setTimeout(()=>{S.current!==null&&Tt()},Gt+32)},[$,Tt]),ke=r.useCallback(()=>{$(),S.current=null,T(!1),dt(null),ht(null),w(null),k(0),E(!1),q.current=!1,W.current=0,H.current="none"},[$,T]),Le=r.useCallback(n=>{if(!(!at||!L)){if(rt.current){if(S.current===n){jt.current=n,Tt();return}ke()}$(),Qt(n),S.current=n,dt(n),T(!0),Pt()}},[at,L,Tt,ke,$,Qt,T,Pt]);ct.current=Le;const lt=r.useCallback(()=>{Y.current=null,st.current=!1,O.current!==null&&(window.clearInterval(O.current),O.current=null),ut.current!==null&&(window.clearTimeout(ut.current),ut.current=null)},[]),de=r.useCallback(n=>{O.current!==null&&window.clearInterval(O.current);const a=st.current?hn:dn;O.current=window.setInterval(()=>{ct.current(n)},a)},[]),Re=r.useCallback(n=>{Y.current!==n&&(lt(),Y.current=n,st.current=!1,ct.current(n),de(n),ut.current=window.setTimeout(()=>{ut.current=null,Y.current===n&&(st.current=!0,de(n))},fn))},[lt,de]),Q=r.useCallback(()=>{const n=St.current;if(!n)return;const a=g==null?void 0:g.assetId,d=a?Lt.current.get(a):void 0;if(d!=null&&d.width&&(d!=null&&d.height)){xt(me(n,d.width,d.height));return}const f=kt.current;if(f&&a&&(f.src===a||f.currentSrc===a)){const{width:z,height:m}=vn(f);if(z&&m){wt(a,z,m),xt(me(n,z,m));return}}const v=Me(n);!v.width||!v.height||xt(v)},[g==null?void 0:g.assetId,wt]),je=r.useCallback(n=>{if(kt.current=n,!!n){if(n instanceof HTMLVideoElement){n.readyState>=1&&n.videoWidth>0&&Q();return}n.complete&&n.naturalWidth>0&&Q()}},[Q]),_t=r.useCallback(()=>{Ie(),Q(),ae(n=>n+1)},[Ie,Q]);r.useEffect(()=>{_t();const n=St.current,a=Xt.current,d=new ResizeObserver(()=>_t());return n&&d.observe(n),a&&d.observe(a),window.addEventListener("resize",_t),()=>{d.disconnect(),window.removeEventListener("resize",_t)}},[_t,i,V]),r.useLayoutEffect(()=>{if(!g)return;const n=kt.current;if(n){if(n instanceof HTMLImageElement&&n.complete&&n.naturalWidth>0){Q();return}n instanceof HTMLVideoElement&&n.readyState>=1&&n.videoWidth>0&&Q()}},[g==null?void 0:g.assetId,i,Q]),r.useEffect(()=>{Jt()},[Jt,G]),r.useEffect(()=>{const n=new Set,a=[],d=f=>{!(f!=null&&f.assetId)||n.has(f.assetId)||(n.add(f.assetId),a.push(f))};e.forEach(d),I.forEach(f=>f.items.forEach(d)),a.forEach(f=>{Lt.current.has(f.assetId)||yn(f,wt)})},[e,I,wt]),r.useEffect(()=>{if(h!=="opening"||!L)return;if(!N){ft("open");return}j(!1);const n=requestAnimationFrame(()=>{requestAnimationFrame(()=>{j(!0),ft("open")})});return()=>cancelAnimationFrame(n)},[h,L,N]),r.useEffect(()=>{if(h!=="closing")return;const n=setTimeout(()=>Nt(),et);return()=>clearTimeout(n)},[h,Nt]),r.useEffect(()=>()=>{$()},[$]),r.useLayoutEffect(()=>{ye.current===i&&$e.current===(g==null?void 0:g.assetId)||($(),S.current=null,dt(null),ht(null),w(null),yt(0),k(0),T(!1),xe(!1),E(!1),vt.current=0,W.current=0,H.current="none",q.current=!1,it.current=null,X.current=!1,kt.current=null,Jt(),ye.current=i,$e.current=g==null?void 0:g.assetId)},[i,g==null?void 0:g.assetId,T,$,Jt]),r.useLayoutEffect(()=>{const n=jt.current;n!==null&&(jt.current=null,requestAnimationFrame(()=>{ct.current(n)}))},[i,nt,g==null?void 0:g.assetId]),r.useLayoutEffect(()=>{if(h==="opening"){bt.current=!1,K(!1);return}if(h!=="open"||bt.current)return;if(!C&&!A){bt.current=!0;return}K(!1);const n=requestAnimationFrame(()=>{requestAnimationFrame(()=>{K(!0),bt.current=!0})});return()=>cancelAnimationFrame(n)},[h,C==null?void 0:C.assetId,A==null?void 0:A.assetId]),r.useEffect(()=>{if(h!=="open")return;const n=()=>{const m=b=>{b.stopPropagation(),b.preventDefault(),document.removeEventListener("click",m,!0)};document.addEventListener("click",m,!0)},a=m=>{const b=m<0?1:-1;$(),Qt(b),S.current=b,dt(b),T(!0),Pt()},d=m=>{if(Math.abs(m)>un&&at){a(m);return}S.current=null,dt(null),ht(null),w(null),T(!0),k(0),be()},f=m=>{if(m.touches.length!==1||rt.current)return;const b=m.touches[0];X.current=!0,it.current={x:b.clientX,y:b.clientY},H.current="none",W.current=0,q.current=!1},v=m=>{if(!it.current||m.touches.length!==1||rt.current)return;const b=m.touches[0],P=b.clientX-it.current.x,tt=b.clientY-it.current.y;if(H.current==="none"){if(Math.abs(P)<10&&Math.abs(tt)<10)return;if(Math.abs(P)>Math.abs(tt)){if(!at)return;H.current="horizontal"}else if(tt>0){if(!ce)return;H.current="vertical"}else return}if(H.current==="horizontal"){q.current=!0,E(!0),W.current=P,k(P),m.preventDefault();return}H.current==="vertical"&&(q.current=!0,E(!0),vt.current=tt,yt(tt),m.preventDefault())},z=()=>{if(!it.current)return;const m=H.current,b=q.current;if(b&&m==="horizontal")d(W.current),n();else if(b&&m==="vertical"){const P=vt.current;if(ce&&P>cn){const tt=window.innerHeight;vt.current=tt,xe(!0),yt(tt),ft("closing")}else vt.current=0,yt(0);n()}else m==="horizontal"&&Math.abs(W.current)>0&&(d(W.current),n());it.current=null,H.current="none",W.current=0,q.current=!1,E(!1)};return document.addEventListener("touchstart",f,{passive:!0}),document.addEventListener("touchmove",v,{passive:!1}),document.addEventListener("touchend",z),document.addEventListener("touchcancel",z),()=>{document.removeEventListener("touchstart",f),document.removeEventListener("touchmove",v),document.removeEventListener("touchend",z),document.removeEventListener("touchcancel",z)}},[h,at,T,be,$,ce,Pt,Qt]);const he=r.useCallback(()=>{const n=(It==null?void 0:It())??N??null;n&&L&&(Dt(n),j(!0)),ft("closing")},[It,N,L]);r.useEffect(()=>{const n=f=>{if(f.key==="Escape"){if(c&&u||h==="closing")return;lt(),he();return}if(f.key!=="ArrowLeft"&&f.key!=="ArrowRight"||h!=="open"||!at)return;f.preventDefault();const v=f.key==="ArrowLeft"?-1:1;f.repeat&&Y.current===v||Re(v)},a=f=>{if(f.key!=="ArrowLeft"&&f.key!=="ArrowRight")return;const v=f.key==="ArrowLeft"?-1:1;Y.current===v&&lt()},d=()=>{lt()};return window.addEventListener("keydown",n),window.addEventListener("keyup",a),window.addEventListener("blur",d),()=>{window.removeEventListener("keydown",n),window.removeEventListener("keyup",a),window.removeEventListener("blur",d),lt()}},[h,c,u,he,at,Re,lt]),r.useEffect(()=>{h!=="open"&&lt()},[h,lt]);const Ce=()=>{h==="closing"||p||he()},F=h==="open",te=h==="closing",Ue=U>0?Math.max(0,1-U/500):1,Ze=U>0?Math.max(.35,1-U/500):1,Et=r.useCallback(n=>{if(!(n.propertyName!=="transform"||!rt.current)){if(S.current!==null){Tt();return}$(),T(!1)}},[$,T,Tt]),ge=h==="closing"?pt??N:N,Ke=ge&&L&&(h==="opening"||te)?gn(ge,L):void 0,Je=J&&g?Se(g,"center"):U>0?`translateY(${U}px)`:Ke,D=L?ie(L,R):null,Ae=!!(ge&&L),Qe=Ae&&(h==="closing"||h==="open"&&gt),Te={position:"absolute",top:D==null?void 0:D.top,left:D==null?void 0:D.left,width:D==null?void 0:D.width,height:D==null?void 0:D.height,objectFit:"contain",transformOrigin:"top left",transform:Je,opacity:U>0?Ze:Ae?1:h==="opening"||te?0:1,transition:M&&!B?"none":B?`transform ${Gt}ms ${_}`:Be?`transform ${et}ms ${_}, opacity ${et}ms ${_}`:Qe?`transform ${et}ms ${_}`:h==="opening"||te?`opacity ${et}ms ${_}`:"none",pointerEvents:Ut&&F&&!J?"auto":"none",touchAction:Ut&&F?"none":void 0,zIndex:1,overflow:Ut?"hidden":void 0},Pe={width:"100%",height:"100%",display:"block",objectFit:"contain",pointerEvents:F&&!J?"auto":"none"},ee=(n,a,d="adjacent")=>{const f=At(n);if(!f)return{display:"none"};const v=d==="far"?a==="left"?"far-left":"far-right":a==="left"?"left-adjacent":"right-adjacent",{start:z}=Z!==null?_e(f,v,Z,R):{start:d==="far"?oe(f,a,R):Ht(f,a,R)},m=ie(z,R),b=Se(n,v),P=!J&&d==="adjacent"&&F&&!zt?kn(f,a,R):null,tt=d==="far"&&J&&Z===(a==="left"?-1:1),tn=M&&!B?!1:B,en=d==="adjacent"&&F&&zt&&!J;return{position:"absolute",top:m.top,left:m.left,width:m.width,height:m.height,objectFit:"contain",transform:b??(P?`translate(${P.x}px, ${P.y}px)`:void 0),opacity:d==="far"?F&&tt?1:0:F?1:0,transition:tn?d==="far"?`transform ${Gt}ms ${_}`:`transform ${Gt}ms ${_}, opacity ${et}ms ${_}`:en?`transform ${et}ms ${_}`:h==="opening"||te?`opacity ${et}ms ${_}`:"none",pointerEvents:"none",zIndex:1}},Ee=(n,a)=>{const d=At(n);return d?In(Ht(d,a,R),a,R):null},He=n=>a=>{if(!p){if(X.current){X.current=!1;return}a.stopPropagation(),Le(n)}},Fe=C?Ee(C,"left"):null,Ne=A?Ee(A,"right"):null,Vt=Fe?ie(Fe,R):null,Bt=Ne?ie(Ne,R):null;return l.jsxs("div",{ref:Xt,className:[`${t}-lightbox`,c?`${t}-lightbox-editor`:"",p?`${t}-lightbox-edit-mode`:""].filter(Boolean).join(" "),style:{touchAction:h==="open"?"none":void 0},onClick:Ce,children:[l.jsx("div",{style:{position:"absolute",inset:0,background:s.backgroundColor??"#FFFFFF",opacity:F?Ue:0,transition:M?"none":`opacity ${et}ms ${_}`,pointerEvents:"none"}}),l.jsxs("div",{className:`${t}-lightbox-dismiss-area`,children:[l.jsxs("div",{style:{position:"relative",width:"100%",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:[l.jsx("div",{style:{height:"10%"}}),l.jsx("div",{style:{width:"70%",height:"80%",display:"flex",justifyContent:"center",alignItems:"center"},children:l.jsx("div",{ref:St,style:{width:"100%",height:"100%"}})}),l.jsx("div",{style:{height:"10%"}})]}),l.jsx("div",{style:{position:"absolute",inset:0,opacity:F?1:0,transition:M?"none":`opacity ${et}ms ${_}`,pointerEvents:"none"},children:l.jsx(on.HiveLightboxTitles,{prefix:t,entry:o,settings:s,isEditor:c,isEditMode:p,isPreviewMode:u,onClose:Ce})})]}),F&&Zt&&l.jsx(re,{media:Zt,style:ee(Zt,"left","far"),onMeasure:wt,onTransitionEnd:Et},`far-prev-${Zt.assetId}`),F&&C&&l.jsxs(l.Fragment,{children:[l.jsx(re,{media:C,style:ee(C,"left"),onMeasure:wt,onTransitionEnd:Et},`prev-${C.assetId}`),Vt&&l.jsx("div",{style:{position:"absolute",top:Vt.top,left:Vt.left,width:Vt.width,height:Vt.height,cursor:p||M?"default":"pointer",pointerEvents:p||M?"none":"auto",zIndex:3},onClick:He(-1)})]}),F&&A&&l.jsxs(l.Fragment,{children:[l.jsx(re,{media:A,style:ee(A,"right"),onMeasure:wt,onTransitionEnd:Et},`next-${A.assetId}`),Bt&&l.jsx("div",{style:{position:"absolute",top:Bt.top,left:Bt.left,width:Bt.width,height:Bt.height,cursor:p||M?"default":"pointer",pointerEvents:p||M?"none":"auto",zIndex:3},onClick:He(1)})]}),F&&Kt&&l.jsx(re,{media:Kt,style:ee(Kt,"right","far"),onMeasure:wt,onTransitionEnd:Et},`far-next-${Kt.assetId}`),L&&g&&(Ut?l.jsx(Cn,{src:g.assetId,phase:h,onMediaElement:je,wrapperStyle:Te,videoStyle:Pe,onLoadedMetadata:Q,onTransitionEnd:Et},`${i}-${g.assetId}`):l.jsx("img",{ref:je,src:g.assetId,alt:g.name,onLoad:Q,onTransitionEnd:Et,style:Te},`${i}-${g.assetId}`))]})}function Tn({settings:t,content:e,isEditor:i,isPreviewMode:o,isEditMode:s,layoutId:c,portalId:p}){const{prefix:u}=nn.useScopedStyles(),{gridLayout:y,verticalGap:I,align:nt="top",imageDisplay:V}=t,N=(V==null?void 0:V.display)==="cover",It=(V==null?void 0:V.ratioValue)??"1:1",Nt=(V==null?void 0:V.reversed)??!1,[Wt,Ot]=It.split(":").map(Number),kt=`${Nt?Ot:Wt} / ${Nt?Wt:Ot}`,Lt=y.entryWidth??.2,G=y.columnsCount,Rt=ne.scalingValue(Lt,i),it=ne.scalingValue(y.horizontalGap??0,i),vt=Rt,W=Rt,H={width:vt,...N?{aspectRatio:kt,height:"auto",overflow:"hidden"}:{height:"auto"}},q=N?{objectFit:"cover",pointerEvents:"auto",width:"100%",height:"100%",maxWidth:"100%"}:{objectFit:"contain",pointerEvents:"auto",width:"auto",height:"auto",maxWidth:"100%"},X=r.useRef(null),[rt,ot]=r.useState(!1),[S,jt]=r.useState([]),[ct,Y]=r.useState(0),[O,ut]=r.useState(0),[st,L]=r.useState(null),[xt,R]=r.useState({title1:"",title2:"",title3:""}),Yt=(()=>{const x={},w=X.current?getComputedStyle(X.current).getPropertyValue("--cntrl-article-width").trim():"";return w&&(x["--cntrl-article-width"]=w),x})(),se=!i||o||s,ae=r.useMemo(()=>ln(u),[u]),h=e??[],ft=h.length%G||G,U=ft<G&&h.length>0,yt=h.length-ft,Mt=U?Math.floor((G-ft)/2)+1:1,k=r.useMemo(()=>mn(h),[h]),B=r.useMemo(()=>$n(h),[h]),le=(x,w,gt)=>{if(i&&!s&&!o)return;const j=k.findIndex(Dt=>Dt.gridIndex===x);if(j<0)return;const pt=k[j];ut(j),jt(pt.items),Y(w),R(pt.entry),L(gt??null),ot(!0)},Z=r.useCallback(()=>{ot(!1),L(null)},[]),dt=r.useCallback(()=>{const x=k[O];return!x||!X.current?st:pn(X.current,x.gridIndex,N?"cover":"contain")??st},[k,O,st,N]),$t=r.useCallback(x=>{if(k.length>1){const w=k.length,gt=(O+x+w)%w,j=k[gt],pt=Math.min(ct,j.items.length-1);ut(gt),jt(j.items),Y(pt),R(j.entry);return}Y(w=>(w+x+S.length)%S.length)},[k,O,ct,S.length]),ht=k.length>1||S.length>1;return r.useEffect(()=>{if(!rt||typeof document>"u")return;const x=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=x}},[rt]),r.useEffect(()=>{!i||s||o||ot(!1)},[i,s,o]),l.jsxs(l.Fragment,{children:[l.jsx("style",{dangerouslySetInnerHTML:{__html:ae}}),l.jsx(bn,{mediaList:B}),l.jsx("div",{ref:X,className:`${u}-wrapper ${u}-align-entries ${u}-image-align-${nt}`.trim(),style:{gridTemplateColumns:`repeat(${G}, ${Rt})`,rowGap:0,columnGap:it,width:ne.scalingValue(y.wrapperWidth??0,i),[`--${u}-align-entries-row-gap`]:ne.scalingValue(I??0,i)},children:h.map((x,w)=>{const gt=we(x.gallery),j=ve(gt),pt=j.filter(E=>E.lightboxMedia).map(E=>E.lightboxMedia),Dt=Math.floor(w/G)===Math.ceil(h.length/G)-1,zt=U&&w>=yt?`${Mt+(w-yt)}`:void 0,K=j[0],bt=K!=null&&K.lightboxMedia?pt.findIndex(E=>E.assetId===K.lightboxMedia.assetId):-1,M=l.jsx("div",{className:`${u}-item-image-wrapper`,style:H,children:j.length>0&&l.jsx(jn,{media:K.displayMedia,gridIndex:w,className:`${u}-item-${Ft(K.displayMedia)?"video":"image"}`.trim(),style:q,onMediaClick:se&&bt>=0?E=>le(w,bt,De(E.currentTarget,N?"cover":"contain")):void 0})});return l.jsx("div",{className:`${u}-item`,children:l.jsxs("div",{className:[s?`${u}-item-inner`:`${u}-item-inner-hidden`,Dt?`${u}-item-inner-last-row`:""].filter(Boolean).join(" "),style:{width:Rt,...zt?{gridColumn:zt}:{}},children:[l.jsx("div",{className:`${u}-item-title-row`,children:l.jsx("div",{style:{height:0,width:W}})}),l.jsx("a",{className:`${u}-item-image-link`,children:M}),l.jsx("div",{className:`${u}-item-subtitle-row`,children:l.jsx("div",{style:{height:0,width:W}})})]})},w)})}),rt&&typeof document<"u"&&(()=>{const x=(p?document.getElementById(p):null)??document.body;return rn.createPortal(l.jsx("div",{style:Yt,"data-selection":"none",children:l.jsx(An,{prefix:u,items:S,index:ct,entry:xt,settings:t,isEditor:i,isEditMode:s,isPreviewMode:o,canNavigate:ht,lightboxEntries:k,entryIdx:O,layoutId:c,sourceRect:st,resolveCloseSourceRect:dt,onClose:Z,onPrev:()=>$t(-1),onNext:()=>$t(1)})}),x)})()]})}exports.Hive=Tn;