@cntrl-site/components 1.0.102 → 1.0.104

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 (50) hide show
  1. package/dist/ClickGallerie-D7g093HX.js +36 -0
  2. package/dist/{ClickGallerie-D_O1XhAO.mjs → ClickGallerie-QSOQjSdv.mjs} +92 -91
  3. package/dist/Components/ClickGallerie/ClickGallerie.d.ts +1 -0
  4. package/dist/Components/Scale/Scale.d.ts +2 -0
  5. package/dist/Components/helpers/LazyVideo/LazyVideo.d.ts +4 -0
  6. package/dist/Components/utils/index.d.ts +1 -0
  7. package/dist/Components/utils/useLazyVideos.d.ts +15 -0
  8. package/dist/Grid-B2_o1dvz.mjs +1576 -0
  9. package/dist/Grid-Bq6bk2AQ.js +374 -0
  10. package/dist/{Helix-2Vr-9WBa.js → Helix-B7rxlvKq.js} +2 -2
  11. package/dist/{Helix-BmkAKT1G.mjs → Helix-BrKQzGX5.mjs} +53 -53
  12. package/dist/{Hive-BGMWinrW.mjs → Hive-BusARSOi.mjs} +114 -111
  13. package/dist/Hive-Dh5nKPGm.js +321 -0
  14. package/dist/LazyVideo-Cn_vmMq8.js +1 -0
  15. package/dist/LazyVideo-D8eVYFyw.mjs +15 -0
  16. package/dist/Marquee-CdtAqhQE.mjs +563 -0
  17. package/dist/Marquee-DUN8wUax.js +133 -0
  18. package/dist/{Mercury-DuKJQ1Zo.mjs → Mercury-BRqlbk4i.mjs} +55 -54
  19. package/dist/Mercury-C-O2VGkK.js +267 -0
  20. package/dist/{PretextComponent-C3YFICy8.js → PretextComponent-D5P0AjnL.js} +1 -1
  21. package/dist/{PretextComponent-Ct0newmn.mjs → PretextComponent-s4DDfmzY.mjs} +25 -16
  22. package/dist/Scale-Bg3bGICG.js +114 -0
  23. package/dist/Scale-TnkWtRrs.mjs +409 -0
  24. package/dist/{Waterfall-A0FjM2my.mjs → Waterfall-DKuh4bnv.mjs} +299 -295
  25. package/dist/Waterfall-fdiHR0Rc.js +287 -0
  26. package/dist/{components-OE3ac1dr.js → components-DzNixU7Q.js} +1 -1
  27. package/dist/{components-w-jHX-2U.mjs → components-Yf9Zjska.mjs} +1 -1
  28. package/dist/elements.js +1 -1
  29. package/dist/elements.mjs +8 -8
  30. package/dist/elements.node.js +1 -1
  31. package/dist/elements.node.mjs +1 -1
  32. package/dist/index.js +1 -1
  33. package/dist/index.mjs +2 -2
  34. package/dist/sources.js +260 -72
  35. package/dist/sources.mjs +264 -76
  36. package/dist/useLazyVideos-BbgdvELi.js +1 -0
  37. package/dist/useLazyVideos-CZLyNolX.mjs +72 -0
  38. package/dist/utils.js +1 -1
  39. package/dist/utils.mjs +14 -12
  40. package/package.json +5 -3
  41. package/dist/ClickGallerie-M9xdGR1G.js +0 -36
  42. package/dist/Grid-CemGhf3F.js +0 -374
  43. package/dist/Grid-cfQsXW3b.mjs +0 -1553
  44. package/dist/Hive-BC6zQBsv.js +0 -321
  45. package/dist/Marquee-BYClHHws.mjs +0 -551
  46. package/dist/Marquee-vmHaTGIP.js +0 -133
  47. package/dist/Mercury-BwF_XW2w.js +0 -267
  48. package/dist/Scale-976sjO8e.js +0 -111
  49. package/dist/Scale-rLNT4KAk.mjs +0 -345
  50. package/dist/Waterfall-DnPDHbCL.js +0 -287
@@ -1,267 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),a=require("react"),Ve=require("react-dom"),at=require("./scalingValue-CSHYgTZl.js"),_e=require("./buildColorVars-CE2D5cQV.js"),Be=require("./useScopedStyles-Bf6yohVQ.js"),wt=require("./textStylesToCss-CNN3zZTV.js"),Ge=require("./SvgImage-DFlmxAoL.js"),bt=300/1440,Xe=8/1440,lt=.004;function qe(t){return`calc(var(--cntrl-article-width, 100vw) * ${t/1440})`}function Qt(t,e,o,r){return e!==void 0&&e<(t??.01)?`${o} ${r}`:o}function Pt(t,e,o,r,l="title-leading-gap"){const h=t??.01;return e===void 0||e>=h?{}:{[`--${o}-${l}`]:at.scalingValue((h-e)/2,r)}}function Ke(t){return`
2
- .${t}-wrapper {
3
- box-sizing: border-box;
4
- display: flex;
5
- flex-direction: column;
6
- position: relative;
7
- width: 100%;
8
- min-height: ${qe(48)};
9
- }
10
- .${t}-single-title-layer {
11
- position: absolute;
12
- inset: 0;
13
- z-index: 2;
14
- pointer-events: none;
15
- display: flex;
16
- flex-direction: column;
17
- justify-content: flex-start;
18
- }
19
- .${t}-single-title {
20
- pointer-events: none;
21
- }
22
- .${t}-item {
23
- position: relative;
24
- display: flex;
25
- align-items: center;
26
- width: 100%;
27
- }
28
- .${t}-item-a {
29
- flex-direction: row;
30
- }
31
- .${t}-item-b {
32
- flex-direction: column;
33
- }
34
- .${t}-item-c {
35
- flex-direction: row-reverse;
36
- }
37
- .${t}-title {
38
- align-self: flex-start;
39
- display: flex;
40
- flex-shrink: 0;
41
- min-width: 0;
42
- box-sizing: border-box;
43
- position: sticky;
44
- z-index: 2;
45
- overflow: visible;
46
- color: var(--${t}-title-color);
47
- }
48
- .${t}-title-text,
49
- .${t}-description-text {
50
- display: block;
51
- width: 100%;
52
- white-space: pre-wrap;
53
- overflow-wrap: anywhere;
54
- word-break: break-word;
55
- }
56
- .${t}-description-text {
57
- color: var(--${t}-description-color);
58
- }
59
- .${t}-title-texts {
60
- display: flex;
61
- flex-direction: column;
62
- width: 100%;
63
- min-width: 0;
64
- }
65
- .${t}-title-texts-gap {
66
- position: relative;
67
- width: 100%;
68
- flex-shrink: 0;
69
- }
70
- .${t}-title-text-inner {
71
- display: flex;
72
- flex-direction: column;
73
- flex-shrink: 0;
74
- box-sizing: border-box;
75
- outline: 1px solid #FF5C02;
76
- }
77
- .${t}-title-text-inner-hidden {
78
- display: flex;
79
- flex-direction: column;
80
- flex-shrink: 0;
81
- box-sizing: border-box;
82
- }
83
- .${t}-title-text-stack {
84
- display: flex;
85
- flex-direction: column;
86
- flex-shrink: 0;
87
- min-width: 0;
88
- position: relative;
89
- box-sizing: border-box;
90
- }
91
- .${t}-item-a .${t}-title-v-top .${t}-title-text-stack,
92
- .${t}-item-b .${t}-title-v-top .${t}-title-text-stack,
93
- .${t}-item-c .${t}-title-v-top .${t}-title-text-stack,
94
- .${t}-single-title-layer .${t}-title-v-top .${t}-title-text-stack {
95
- padding-top: var(--${t}-title-top-padding, 0);
96
- }
97
- .${t}-item-a .${t}-title-v-bottom .${t}-title-text-stack,
98
- .${t}-item-b .${t}-title-v-bottom .${t}-title-text-stack,
99
- .${t}-item-c .${t}-title-v-bottom .${t}-title-text-stack,
100
- .${t}-single-title-layer .${t}-title-v-bottom .${t}-title-text-stack {
101
- padding-bottom: var(--${t}-title-bottom-padding, 0);
102
- }
103
- .${t}-title-v-center {
104
- top: calc(var(--cntrl-article-top, 0px) + var(--cntrl-viewport-height, 100vh) / 2 - (var(--${t}-title-height, 0px) / 2));
105
- align-items: center;
106
- }
107
- .${t}-title-v-top {
108
- top: var(--cntrl-article-top, 0px);
109
- bottom: auto;
110
- align-self: flex-start;
111
- }
112
- .${t}-title-v-bottom {
113
- top: calc(var(--cntrl-article-top, 0px) + var(--cntrl-viewport-height, 100vh) - var(--${t}-title-height, 0px));
114
- align-items: center;
115
- }
116
- .${t}-title-h-left {
117
- justify-content: flex-start;
118
- }
119
- .${t}-item-a .${t}-title-h-left,
120
- .${t}-item-b .${t}-title-h-left,
121
- .${t}-item-c .${t}-title-h-left,
122
- .${t}-single-title-layer .${t}-title-h-left {
123
- padding-left: var(--${t}-title-left-padding, 0);
124
- }
125
- .${t}-title-h-center {
126
- justify-content: center;
127
- }
128
- .${t}-title-h-right {
129
- justify-content: flex-end;
130
- }
131
- .${t}-item-a .${t}-title-h-right,
132
- .${t}-item-b .${t}-title-h-right,
133
- .${t}-item-c .${t}-title-h-right,
134
- .${t}-single-title-layer .${t}-title-h-right {
135
- padding-right: var(--${t}-title-right-padding, 0);
136
- }
137
- .${t}-item-a .${t}-title,
138
- .${t}-item-c .${t}-title {
139
- flex: 1;
140
- width: auto;
141
- min-width: 0;
142
- overflow: visible;
143
- }
144
- .${t}-item-b .${t}-title,
145
- .${t}-single-title-layer .${t}-title {
146
- width: 100%;
147
- pointer-events: none;
148
- }
149
- .${t}-gallery {
150
- display: flex;
151
- flex-direction: column;
152
- align-items: center;
153
- flex-shrink: 0;
154
- box-sizing: border-box;
155
- }
156
- .${t}-item-b .${t}-gallery {
157
- display: grid;
158
- width: 100%;
159
- }
160
- .${t}-item-b .${t}-gallery-media {
161
- grid-area: 1 / 1;
162
- display: flex;
163
- flex-direction: column;
164
- align-items: center;
165
- width: 100%;
166
- min-width: 0;
167
- }
168
- .${t}-item-b .${t}-title-layer {
169
- grid-area: 1 / 1;
170
- align-self: stretch;
171
- width: 100%;
172
- min-width: 0;
173
- z-index: 2;
174
- overflow: visible;
175
- pointer-events: none;
176
- display: flex;
177
- flex-direction: column;
178
- justify-content: flex-start;
179
- }
180
- .${t}-gallery-item {
181
- position: relative;
182
- display: flex;
183
- flex-direction: column;
184
- align-items: center;
185
- width: 100%;
186
- }
187
- .${t}-gallery-image,
188
- .${t}-gallery-video {
189
- display: block;
190
- max-width: 100%;
191
- height: auto;
192
- }
193
- .${t}-gallery-controls {
194
- position: relative;
195
- display: flex;
196
- flex-shrink: 0;
197
- box-sizing: border-box;
198
- z-index: 1;
199
- }
200
- .${t}-gallery-edge-spacer {
201
- flex-shrink: 0;
202
- }
203
- .${t}-control-anchor {
204
- position: absolute;
205
- pointer-events: none;
206
- z-index: 2;
207
- }
208
- .${t}-padding-handle {
209
- width: 100%;
210
- flex-shrink: 0;
211
- background: transparent;
212
- }
213
- .${t}-text-tight-leading {
214
- flex-shrink: 0;
215
- padding-top: var(--${t}-title-leading-gap, 0);
216
- padding-bottom: var(--${t}-title-leading-gap, 0);
217
- }
218
- .${t}-description-tight-leading {
219
- flex-shrink: 0;
220
- padding-top: var(--${t}-description-leading-gap, 0);
221
- padding-bottom: var(--${t}-description-leading-gap, 0);
222
- }
223
- .${t}-lightbox-counter {
224
- margin: 0;
225
- color: var(--${t}-lightbox-counter-color);
226
- }
227
- .${t}-lightbox {
228
- position: fixed;
229
- inset: 0;
230
- z-index: 9997;
231
- overscroll-behavior: none;
232
- overflow: hidden;
233
- }
234
- .${t}-lightbox-editor {
235
- inset: auto;
236
- top: var(--cntrl-article-top, 0);
237
- left: var(--cntrl-article-left, 0);
238
- width: var(--cntrl-article-width, 100vw) !important;
239
- height: var(--cntrl-viewport-height, 100vh) !important;
240
- }
241
- .${t}-close-icon {
242
- position: relative;
243
- flex-shrink: 0;
244
- pointer-events: auto;
245
- z-index: 2;
246
- display: flex;
247
- align-items: center;
248
- justify-content: center;
249
- border: none;
250
- background-color: transparent;
251
- padding: 0;
252
- }
253
- .${t}-close-icon-inner {
254
- all: unset;
255
- position: relative;
256
- cursor: pointer;
257
- width: 100%;
258
- height: 100%;
259
- pointer-events: auto;
260
- }
261
- .${t}-close-icon-img {
262
- position: absolute;
263
- top: 50%;
264
- left: 50%;
265
- transform: translate(-50%, -50%);
266
- }
267
- `}const be={"left-top":{horizontal:"left",vertical:"top"},"top-center":{horizontal:"center",vertical:"top"},"top-right":{horizontal:"right",vertical:"top"},"left-center":{horizontal:"left",vertical:"center"},center:{horizontal:"center",vertical:"center"},"right-center":{horizontal:"right",vertical:"center"},"left-bottom":{horizontal:"left",vertical:"bottom"},"bottom-center":{horizontal:"center",vertical:"bottom"},"right-bottom":{horizontal:"right",vertical:"bottom"}};function Ue(t){return t in be}function Ye(t){if(t&&Ue(t))return t;switch(t){case"center-top":return"top-center";case"right-top":return"top-right";case"top-left":return"left-top";case"center-bottom":return"bottom-center";case"bottom-left":return"left-bottom";case"bottom-right":return"right-bottom";case"center-center":return"center";case"left":return"left-center";case"right":return"right-center";case"top":return"left-top";default:return"center"}}function ne(t){return be[t]}const Ze="rgba(28,31,34,0.9)",rt=500,ft="cubic-bezier(0.22, 1, 0.36, 1)",Je=72,Qe=50,Pe={titleColor:"title-color",descriptionColor:"description-color",lightboxCounterColor:"lightbox-counter-color"},tn=[];function en(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 nn(t){const[e,o]=t.media;return o!=null&&o.assetId?o:e!=null&&e.assetId?e:null}function on(t){const[e]=t.media;return e!=null&&e.assetId?e:null}function rn(t){if(!Array.isArray(t)||t.length===0)return[];if(en(t)){const e=[];for(const o of t){const r=nn(o);if(!r)continue;const l=on(o);e.push({displayMedia:r,lightboxMedia:l!=null&&l.assetId?l:null})}return e}return t.filter(e=>e==null?void 0:e.assetId).map(e=>({displayMedia:e,lightboxMedia:e}))}function ee(t){return t.type==="video"}function ln(t){t.pause(),t.removeAttribute("src"),t.load()}function Ht(t){const e=t.getBoundingClientRect();return{width:e.width,height:e.height,left:e.left,top:e.top}}function an(t){return t instanceof HTMLVideoElement?{width:t.videoWidth,height:t.videoHeight}:{width:t.naturalWidth,height:t.naturalHeight}}const sn=1140/1440;function cn(t){return typeof t=="string"?{display:t.toLowerCase()==="cover"?"cover":"fit",ratioValue:"2:3",reversed:!1}:{display:(typeof(t==null?void 0:t.display)=="string"?t.display.toLowerCase():"")==="cover"?"cover":"fit",ratioValue:(t==null?void 0:t.ratioValue)??"2:3",reversed:(t==null?void 0:t.reversed)??!1}}function dn(t){const e=t.ratioValue??"1:1",o=t.reversed??!1,[r,l]=e.split(":").map(Number);return`${o?l:r} / ${o?r:l}`}function hn(t){return typeof t=="string"?t==="cover"?"cover":"fit":(t==null?void 0:t.display)==="cover"?"cover":"fit"}function un({src:t,phase:e,mediaRef:o,mediaStyle:r,onLoadedMetadata:l,onClick:h,onMouseMove:i,onTransitionEnd:p}){return a.useEffect(()=>{const s=o.current;if(s)return()=>{ln(s)}},[t,o]),n.jsx("video",{ref:o,src:t,controls:e==="open",playsInline:!0,preload:"auto",onLoadedMetadata:l,onClick:h,onMouseMove:i,onTransitionEnd:p,style:r})}const pn="https://cdn.cntrl.site/component-assets/defaultCloseIcon.svg",fn=.004;function gn({prefix:t,closeIcon:e=pn,closeIconMaxWidth:o=.0125,closeIconColor:r="#FFFFFF",closeIconHoverColor:l="#999999",iconMarginRight:h=.01,contentMarginTop:i=.01,isEditor:p,isPreviewMode:s,isEditMode:u,visible:d,onClose:v}){if(!e)return null;const I=at.scalingValue(o,p),G=at.scalingValue(h,p),N=at.scalingValue(i,p),z=at.scalingValue(Math.max(i,fn),p);return n.jsxs("div",{style:{position:"absolute",top:0,left:0,right:0,zIndex:1e4,display:"flex",flexDirection:"column",alignItems:"flex-end",pointerEvents:"none",opacity:d?1:0,transition:"opacity 500ms cubic-bezier(0.22, 1, 0.36, 1)"},children:[n.jsx("div",{style:{position:"relative",width:"100%",height:N,flexShrink:0},children:u&&n.jsx("div",{"data-controls":"contentMarginTop","data-controls-axis":"y","data-controls-min":"0",className:`${t}-control`,style:{position:"absolute",top:0,left:0,width:"100%",height:z,pointerEvents:d?"auto":"none"}})}),n.jsxs("div",{className:`${t}-close-icon`,style:{width:I,height:I,marginRight:G,pointerEvents:d?"auto":"none"},onClick:M=>M.stopPropagation(),children:[n.jsx("button",{type:"button",className:`${t}-close-icon-inner`,"aria-label":"Close",onClick:M=>{M.stopPropagation(),v()},children:n.jsx(Ge.SvgImage,{url:e,fill:r,hoverFill:p&&!s?r:l,className:`${t}-close-icon-img`})}),u&&n.jsx("div",{"data-controls":"iconMarginRight","data-controls-axis":"x","data-controls-reverse":"",className:`${t}-control`,style:{position:"absolute",top:0,left:"100%",width:G,height:"100%",pointerEvents:d?"auto":"none"}})]})]})}function mn({prefix:t,items:e,index:o,imageDisplay:r,isEditor:l,isPreviewMode:h,isEditMode:i,onClose:p,onPrev:s,onNext:u,counterClassName:d,counterStyle:v,backgroundColor:I,closeIcon:G,closeIconMaxWidth:N,closeIconColor:z,closeIconHoverColor:M,iconMarginRight:O,contentMarginTop:st}){const ct=r==="cover",D=a.useRef(null),E=a.useRef(null),L=a.useRef(null),b=a.useRef(0),m=a.useRef(0),$=a.useRef("none"),X=a.useRef(!1),A=a.useRef(!1),q=a.useRef(!1),K=a.useRef(null),[f,V]=a.useState(null),[w,R]=a.useState("opening"),[Q,gt]=a.useState(0),[jt,P]=a.useState(0),[T,tt]=a.useState(!1),[et,U]=a.useState(!1),[x,Vt]=a.useState(!1),Lt=a.useRef(o),Y=e[o],mt=Y?ee(Y):!1,xt=jt!==0||T,Z=a.useCallback(c=>{q.current=c,tt(c)},[]),F=a.useCallback(()=>{K.current!==null&&(window.clearTimeout(K.current),K.current=null)},[]),St=a.useCallback(()=>{F(),K.current=window.setTimeout(()=>{F(),Z(!1)},rt+32)},[F,Z]),dt=a.useCallback(()=>{const c=D.current,g=E.current;if(!c)return;const C=c.getBoundingClientRect(),k=C.width,W=C.height;if(!k||!W)return;if(r==="cover"){V({width:k,height:W,left:C.left,top:C.top});return}if(!g){V(Ht(c));return}const{width:_,height:ot}=an(g);if(!_||!ot){V(Ht(c));return}const B=_/ot,y=k/W;if(B>y){const S=k/B;V({width:k,height:S,left:C.left,top:C.top+(W-S)/2})}else{const S=W*B;V({width:S,height:W,left:C.left+(k-S)/2,top:C.top})}},[r]);a.useEffect(()=>{dt();const c=D.current;if(!c)return;const g=new ResizeObserver(()=>dt());return g.observe(c),()=>g.disconnect()},[dt,o]),a.useEffect(()=>{w==="opening"&&f&&R("open")},[w,f]),a.useEffect(()=>{if(w!=="closing")return;const c=setTimeout(()=>p(),rt);return()=>clearTimeout(c)},[w,p]),a.useEffect(()=>()=>{F()},[F]),a.useLayoutEffect(()=>{if(Lt.current===o)return;F(),gt(0),P(0),Z(!1),Vt(!1),U(!1),b.current=0,m.current=0,$.current="none",X.current=!1,L.current=null,A.current=!1;const c=D.current;c&&V(Ht(c)),Lt.current=o},[o,Z,F]),a.useEffect(()=>{if(w!=="open")return;let c=null;const g=()=>{c&&(document.removeEventListener("click",c,!0),c=null)},C=()=>{g(),c=y=>{y.stopPropagation(),y.preventDefault(),g()},document.addEventListener("click",c,!0)},k=y=>{F(),q.current=!1,tt(!1),P(0),U(!1),X.current=!1,m.current=0,$.current="none";const S=D.current;S&&V(Ht(S)),y<0?u():s()},W=y=>{if(Math.abs(y)>Qe&&e.length>1){k(y);return}Z(!0),P(0),St()},_=y=>{if(y.touches.length!==1||q.current)return;const S=y.touches[0];A.current=!0,L.current={x:S.clientX,y:S.clientY},$.current="none",m.current=0,X.current=!1},ot=y=>{if(!L.current||y.touches.length!==1||q.current)return;const S=y.touches[0],pt=S.clientX-L.current.x,J=S.clientY-L.current.y;if($.current==="none"){if(Math.abs(pt)<10&&Math.abs(J)<10)return;if(Math.abs(pt)>Math.abs(J)){if(e.length<=1)return;$.current="horizontal"}else if(J>0)$.current="vertical";else return}if($.current==="horizontal"){X.current=!0,U(!0),m.current=pt,P(pt),y.preventDefault();return}$.current==="vertical"&&(X.current=!0,U(!0),b.current=J,gt(J),y.preventDefault())},B=()=>{if(!L.current)return;const y=$.current,S=X.current;if(S&&y==="horizontal")W(m.current),C();else if(S&&y==="vertical")if(b.current>Je){const J=window.innerHeight;b.current=J,Vt(!0),gt(J),R("closing")}else b.current=0,gt(0),C();else y==="horizontal"&&Math.abs(m.current)>0&&(W(m.current),C());L.current=null,$.current="none",m.current=0,X.current=!1,U(!1)};return document.addEventListener("touchstart",_,{passive:!0}),document.addEventListener("touchmove",ot,{passive:!1}),document.addEventListener("touchend",B),document.addEventListener("touchcancel",B),()=>{document.removeEventListener("touchstart",_),document.removeEventListener("touchmove",ot),document.removeEventListener("touchend",B),document.removeEventListener("touchcancel",B),g()}},[w,e.length,u,s,Z,St,F]),a.useEffect(()=>{const c=g=>{g.key==="Escape"&&(g.preventDefault(),g.stopPropagation(),w!=="closing"&&R("closing"))};return window.addEventListener("keydown",c,!0),()=>window.removeEventListener("keydown",c,!0)},[w]);const Rt=()=>{w!=="closing"&&R("closing")},nt=w==="open",kt=w==="closing",_t=Q>0?Math.max(0,1-Q/500):1,Nt=Q>0?Math.max(.35,1-Q/500):1,Mt=c=>{if(c.stopPropagation(),A.current){A.current=!1;return}if(e.length<=1)return;const g=c.currentTarget.getBoundingClientRect(),C=c.clientY-g.top,k=Math.min(52,g.height*.2);if(!(C>g.height-k)){if(c.clientX-g.left<g.width/2){s();return}u()}},zt=c=>{if(e.length<=1)return;const g=c.currentTarget.getBoundingClientRect(),C=c.clientX-g.left,k=c.clientY-g.top,W=Math.min(52,g.height*.2);if(k>g.height-W){c.currentTarget.style.cursor="default";return}c.currentTarget.style.cursor=C<g.width/2?"w-resize":"e-resize"},Dt=a.useCallback(c=>{c.propertyName!=="transform"||!q.current||(F(),Z(!1))},[F,Z]),Bt=xt?`translateX(${jt}px)`:Q>0?`translateY(${Q}px)`:void 0,ht={position:"fixed",top:f==null?void 0:f.top,left:f==null?void 0:f.left,width:f==null?void 0:f.width,height:f==null?void 0:f.height,objectFit:r==="cover"?"cover":"contain",transform:Bt,opacity:Q>0?Nt:w==="opening"||kt?0:1,transition:et&&!T?"none":T?`transform ${rt}ms ${ft}`:x?`transform ${rt}ms ${ft}, opacity ${rt}ms ${ft}`:w==="opening"||kt?`opacity ${rt}ms ${ft}`:"none",pointerEvents:mt&&nt&&!xt?"auto":"none",touchAction:mt&&nt?"none":void 0,zIndex:9998},ut=f?{position:"fixed",top:f.top,height:f.height,width:f.width/2,zIndex:9999}:null;return n.jsxs("div",{className:[`${t}-lightbox`,l?`${t}-lightbox-editor`:""].filter(Boolean).join(" "),style:{touchAction:w==="open"?"none":void 0},onClick:Rt,children:[n.jsx("div",{style:{position:"absolute",inset:0,background:I,opacity:nt?_t:0,transition:et?"none":`opacity ${rt}ms ${ft}`,pointerEvents:"none"}}),n.jsx("div",{style:{position:"relative",width:"100%",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:ct?n.jsxs(n.Fragment,{children:[n.jsx("div",{ref:D,style:{position:"absolute",inset:0}}),n.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",height:"10%",opacity:nt?1:0,transition:`opacity ${rt}ms ${ft}`,pointerEvents:"none",zIndex:9999},children:e.length>1&&n.jsxs("p",{className:d,style:v,children:[o+1," / ",e.length]})})]}):n.jsxs(n.Fragment,{children:[n.jsx("div",{style:{height:"10%"}}),n.jsx("div",{style:{width:"70%",height:"80%",display:"flex",justifyContent:"center",alignItems:"center"},children:n.jsx("div",{ref:D,style:{width:"100%",height:"100%"}})}),n.jsx("div",{style:{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",height:"10%",opacity:nt?1:0,transition:`opacity ${rt}ms ${ft}`},children:e.length>1&&n.jsxs("p",{className:d,style:v,children:[o+1," / ",e.length]})})]})}),f&&Y&&(mt?n.jsx(un,{src:Y.assetId,phase:w,mediaRef:E,mediaStyle:ht,onLoadedMetadata:dt,onClick:Mt,onMouseMove:zt,onTransitionEnd:Dt},`${o}-${Y.assetId}`):n.jsx("img",{ref:E,src:Y.assetId,alt:Y.name,onLoad:dt,onTransitionEnd:Dt,style:ht},`${o}-${Y.assetId}`)),nt&&ut&&e.length>1&&!mt&&n.jsxs(n.Fragment,{children:[n.jsx("div",{style:{...ut,left:f.left,cursor:"w-resize",pointerEvents:xt?"none":"auto"},onClick:c=>{if(A.current){A.current=!1;return}c.stopPropagation(),s()}}),n.jsx("div",{style:{...ut,left:f.left+f.width/2,cursor:"e-resize",pointerEvents:xt?"none":"auto"},onClick:c=>{if(A.current){A.current=!1;return}c.stopPropagation(),u()}})]}),n.jsx(gn,{prefix:t,closeIcon:G,closeIconMaxWidth:N,closeIconColor:z,closeIconHoverColor:M,iconMarginRight:O,contentMarginTop:st,isEditor:l,isPreviewMode:h,isEditMode:i,visible:nt,onClose:Rt})]})}function xe({P:t,media:e,imgWidth:o,cornerRadius:r,fillGalleryWidth:l,imageDisplay:h,isEditor:i,galleryPaddingBetween:p=0,showPaddingAfter:s=!1,showControls:u=!1,onMediaClick:d}){const v=`${t}-gallery-${ee(e)?"video":"image"}`,I=h.display==="cover",G=dn(h),N=m=>at.scalingValue(m,i??!1),z=o??bt,M=l?{width:"100%",maxWidth:"100%"}:{width:N(z),maxWidth:"100%"},O=r?{borderRadius:N(r)}:{},st={...M,...I?{aspectRatio:G,height:"auto",overflow:"hidden"}:{},...O},ct={...I?{display:"block",width:"100%",height:"100%",objectFit:"cover",maxWidth:"100%"}:{display:"block",maxWidth:"100%",height:"auto",width:l?"100%":N(z)},...d?{cursor:"pointer",pointerEvents:"auto"}:{},...I?{}:O},E={className:v,style:ct,onClick:d?m=>{m.stopPropagation(),d()}:void 0},L=Math.max(p,lt),b=ee(e)?n.jsx("video",{...E,src:e.assetId,muted:!0,autoPlay:!0,loop:!0,playsInline:!0}):n.jsx("img",{...E,src:e.assetId,alt:e.name??""});return n.jsxs("div",{className:`${t}-gallery-item`,children:[I?n.jsx("div",{style:st,children:b}):b,s&&p>0&&n.jsx("div",{className:`${t}-padding-handle`,style:{height:N(p)},"aria-hidden":"true"}),u&&s&&n.jsx("div",{"data-controls":"galleryPaddingBetween","data-controls-axis":"y","data-controls-variant":"row-padding","data-controls-min":"0",className:`${t}-control-anchor`,style:{bottom:0,left:0,width:"100%",height:N(L)}})]})}function xn({P:t,layoutType:e,galleryWidthStyle:o,galleryPaddingRight:r,galleryPaddingLeft:l,galleryPaddingRightWidth:h,galleryPaddingLeftWidth:i,galleryPaddingMaxFraction:p,showControls:s,scaled:u,children:d}){const v=e==="a"?r:e==="c"?l:0,I=v>0||s;return n.jsxs("div",{className:`${t}-gallery-controls`,children:[e==="c"&&I&&n.jsx("div",{className:`${t}-gallery-edge-spacer`,style:{width:u(v)},"aria-hidden":"true"}),s&&e==="c"&&n.jsx("div",{"data-controls":"galleryPaddingLeft","data-controls-axis":"x","data-controls-variant":"column-padding","data-controls-min":"0","data-controls-max-fraction":String(p),className:`${t}-control-anchor`,style:{top:0,left:0,width:u(i),height:"100%"}}),n.jsx("div",{className:`${t}-gallery`,style:o,children:d}),e==="a"&&I&&n.jsx("div",{className:`${t}-gallery-edge-spacer`,style:{width:u(v)},"aria-hidden":"true"}),s&&e==="a"&&n.jsx("div",{"data-controls":"galleryPaddingRight","data-controls-axis":"x","data-controls-variant":"column-padding","data-controls-reverse":"","data-controls-min":"0","data-controls-max-fraction":String(p),className:`${t}-control-anchor`,style:{top:0,right:0,width:u(h),height:"100%"}})]})}function yn(t){switch(t){case"fade":case"retype":case"scroll":return t;case"default":return"scroll";default:return"scroll"}}function Ot({P:t,controlKey:e,scaled:o,height:r,paired:l,side:h}){return n.jsx("div",{"data-controls":e,...l?{"data-controls-paired":""}:{},"data-controls-axis":"y","data-controls-variant":"row-padding","data-controls-min":"0",className:`${t}-control-anchor`,style:{...h==="top"?{top:0}:{bottom:0},left:0,width:"100%",height:o(r)}})}function ye({P:t,controlKey:e,scaled:o,width:r,maxFraction:l,side:h,paired:i,anchorStyle:p}){return n.jsx("div",{"data-controls":e,...i?{"data-controls-paired":""}:{},"data-controls-axis":"x","data-controls-variant":"column-padding",...h==="right"?{"data-controls-reverse":""}:{},"data-controls-min":"0","data-controls-max-fraction":String(l),className:`${t}-control-anchor`,style:{top:0,...h==="left"?{left:0}:{right:0},width:o(r),height:"100%",...p}})}function te({P:t,title:e,description:o,position:r,titleRef:l,titleClassName:h,titleContainerStyle:i,titleTextBoxStyle:p,titleStyle:s,descriptionClassName:u,descriptionStyle:d,descriptionPadding:v,showTextBoxOutline:I=!1,showDescriptionPaddingControl:G=!1,descriptionPaddingPaired:N=!1,topPaddingControl:z,bottomPaddingControl:M}){const O=a.useRef(null),[st,ct]=a.useState(0),D=e??"",E=o??"",L=E.length>0,{horizontal:b,vertical:m}=ne(r),$=m==="center"||m==="bottom",X=m==="bottom";a.useLayoutEffect(()=>{if(!$)return;const f=O.current;if(!f||typeof ResizeObserver>"u")return;const V=()=>ct(f.offsetHeight);V();const w=new ResizeObserver(V);return w.observe(f),()=>w.disconnect()},[D,E,$]);const A=n.jsx("span",{className:`${t}-title-text`,style:s,children:D}),q=L?n.jsx("span",{className:u,style:d,children:E}):null,K=L?n.jsx("div",{className:`${t}-title-texts-gap`,style:{height:v},children:G&&n.jsx("div",{"data-controls":"titleDescriptionPadding",...N?{"data-controls-paired":""}:{},"data-controls-axis":"y","data-controls-variant":"row-padding","data-controls-min":"0",className:`${t}-control-anchor`,style:{top:0,left:0,width:"100%",height:"100%"}})}):null;return n.jsx("div",{ref:f=>{O.current=f,l(f)},className:[h,`${t}-title-h-${b}`,`${t}-title-v-${m}`].join(" "),style:{...$?{[`--${t}-title-height`]:`${st}px`}:{},...i},children:n.jsxs("div",{className:`${t}-title-text-stack`,style:p,children:[z,n.jsx("div",{className:I?`${t}-title-text-inner`:`${t}-title-text-inner-hidden`,style:{width:"100%"},children:n.jsx("div",{className:`${t}-title-texts`,children:X?n.jsxs(n.Fragment,{children:[q,K,A]}):n.jsxs(n.Fragment,{children:[A,K,q]})})}),M]})})}const ve=45;function $e(t,e,o){let r=t;for(;r;){const l=getComputedStyle(r).getPropertyValue(e).trim();if(l){const h=parseFloat(l);if(!Number.isNaN(h))return h}r=r.parentElement}return o}function vn(t){const e=$e(t,"--cntrl-viewport-height",window.innerHeight),o=$e(t,"--cntrl-article-top",0);return{top:o,height:e,centerY:o+e/2}}function $n(t,e,o){const{vertical:r}=ne(e),{top:l,height:h,centerY:i}=vn(o);if(r==="top"){const s=o&&parseFloat(getComputedStyle(o).top)||l;return Math.abs(t.top-s)}if(r==="bottom")return Math.abs(t.bottom-(l+h));const p=t.top+t.height/2;return Math.abs(p-i)}function wn(t,e,o){const r=Array.from({length:e},(i,p)=>{const s=t.current[p];if(!s)return 0;const u=s.getBoundingClientRect(),d=$n(u,o,s);return Math.exp(-(d*d)/(2*ve*ve))});let l=0,h=-1;return r.forEach((i,p)=>{i>h&&(h=i,l=p)}),{opacities:r,dominantIndex:l}}function bn(t,e,o){const r=a.useRef([]),[{opacities:l,dominantIndex:h},i]=a.useState(()=>({opacities:Array.from({length:t},(s,u)=>u===0?1:0),dominantIndex:0}));return a.useLayoutEffect(()=>{if(!e||t===0){i({opacities:Array.from({length:t},()=>1),dominantIndex:0});return}let s=0;const u=()=>{i(wn(r,t,o))},d=()=>{s||(s=window.requestAnimationFrame(()=>{s=0,u()}))};return u(),window.addEventListener("scroll",d,{passive:!0}),window.addEventListener("resize",d,{passive:!0}),()=>{s&&window.cancelAnimationFrame(s),window.removeEventListener("scroll",d),window.removeEventListener("resize",d)}},[e,t,o]),{setTitleRef:s=>u=>{r.current[s]=u},opacities:l,dominantIndex:h}}function we(t,e){const[o,r]=a.useState(t),l=a.useRef(t);return a.useEffect(()=>{if(!e){l.current=t,r(t);return}const h=Array.from(l.current),i=Array.from(t),p=Math.max(h.length,i.length);if(p===0||l.current===t)return;let s=0;const u=window.setInterval(()=>{s+=1;const d=[...i.slice(0,s),...h.slice(s)].join("");l.current=d,r(d),s>=p&&window.clearInterval(u)},70);return()=>window.clearInterval(u)},[e,t]),o}function Sn({settings:t,content:e,isEditor:o,isPreviewMode:r,isEditMode:l,portalId:h}){var pe,fe;const{prefix:i}=Be.useScopedStyles(),p=a.useMemo(()=>Ke(i),[i]),s=e??[],u=(t==null?void 0:t.wrapperWidth)??1,d=(t==null?void 0:t.type)??"a",v=(t==null?void 0:t.imgWidth)??bt,I=(t==null?void 0:t.titleWidth)??sn,G=cn(t==null?void 0:t.imageDisplay),N=(t==null?void 0:t.cornerRadius)??Xe,z=Ye(t==null?void 0:t.position),{horizontal:M,vertical:O}=ne(z),st=(t==null?void 0:t.titleTopPadding)??0,ct=(t==null?void 0:t.titleBottomPadding)??0,D=(t==null?void 0:t.titleLeftPadding)??0,E=(t==null?void 0:t.titleRightPadding)??0,L=(t==null?void 0:t.titleDescriptionPadding)??0,b=yn(t==null?void 0:t.transition),m=(t==null?void 0:t.lightbox)??"on",$=d==="b",X=b==="fade"||b==="retype",{setTitleRef:A,dominantIndex:q}=bn(s.length,X,z),K=((pe=s[q])==null?void 0:pe.title)??"",f=((fe=s[q])==null?void 0:fe.description)??"",V=we(K,b==="retype"),w=we(f,b==="retype"),R=b==="fade"||b==="retype",Q=b==="retype"?V:K,gt=b==="retype"?w:f,jt=$?void 0:{width:at.scalingValue(v,o??!1)},P=m==="on"&&(!o||r||l),T=l??!1,tt=(t==null?void 0:t.galleryPaddingRight)??0,et=(t==null?void 0:t.galleryPaddingLeft)??0,U=(t==null?void 0:t.galleryPaddingBetween)??0,x=j=>at.scalingValue(j,o??!1),Lt={width:x(I)},Y=d==="a"?tt:et,mt=$?{width:"100%"}:{width:`calc(100% - ${x(v)} - ${x(Y)})`,...d==="c"?{marginLeft:"auto"}:{}},xt=Math.max(tt,lt),Z=Math.max(et,lt),F=Math.max(U,lt),St=Math.max(st,lt),dt=Math.max(ct,lt),Rt=Math.max(D,lt),nt=Math.max(E,lt),kt=Math.max(L,lt),_t=Math.max(0,(u??1)-(v??bt)),Nt=d==="a"?Math.max(0,(u??1)-(v??bt)-tt):d==="c"?Math.max(0,(u??1)-(v??bt)-et):d==="b"?u??1:1,Mt=T&&O==="top",zt=T&&O==="bottom",Dt=T&&M==="left",Bt=T&&M==="right",ht=s.length>1,ut=$?void 0:x((d==="c"?et:tt)+(v??bt)),c=d==="c"&&ut?{left:ut}:void 0,g=d==="a"&&ut?{right:ut}:void 0,C=$?{left:0,width:"100%"}:d==="a"?{right:x(tt),width:x(v)}:{left:x(et),width:x(v)},{titleColor:k,titleFontFamily:W,titleFontSettings:_,titleFontSize:ot,titleLineHeight:B,titleLetterSpacing:y,titleWordSpacing:S,titleAlign:pt,titleTextAppearance:J,descriptionColor:oe,descriptionFontFamily:Se,descriptionFontSettings:yt,descriptionFontSize:Gt,descriptionLineHeight:Xt,descriptionLetterSpacing:Ce,descriptionWordSpacing:Te,descriptionAlign:Ie,descriptionTextAppearance:je,lightboxCounterColor:ie,lightboxCounterFontFamily:Le,lightboxCounterFontSettings:vt,lightboxCounterFontSize:qt,lightboxCounterLineHeight:Kt,lightboxCounterLetterSpacing:Re,lightboxCounterWordSpacing:ke,lightboxCounterTextAppearance:Ne}=t??{},Me={fontSettings:{fontFamily:W,fontWeight:(_==null?void 0:_.fontWeight)??400,fontStyle:(_==null?void 0:_.fontStyle)??"normal"},fontSize:ot??.01,lineHeight:B,letterSpacing:y??0,wordSpacing:S??0,textAlign:pt??"left",textAppearance:J,color:k??"#000000"},re=wt.omitTextColors(wt.textStylesToCss(Me,o)),le=Lt,ae={...Pt(ot,B,i,o),...Pt(Gt,Xt,i,o,"description-leading-gap")},se=Qt(ot,B,`${i}-title`,`${i}-text-tight-leading`),ze={fontSettings:{fontFamily:Se,fontWeight:(yt==null?void 0:yt.fontWeight)??400,fontStyle:(yt==null?void 0:yt.fontStyle)??"normal"},fontSize:Gt??.01,lineHeight:Xt,letterSpacing:Ce??0,wordSpacing:Te??0,textAlign:Ie??"left",textAppearance:je,color:oe??"#000000"},ce=wt.omitTextColors(wt.textStylesToCss(ze,o)),de=Qt(Gt,Xt,`${i}-description-text`,`${i}-description-tight-leading`),he=x(T?kt:L),De={fontSettings:{fontFamily:Le,fontWeight:(vt==null?void 0:vt.fontWeight)??400,fontStyle:(vt==null?void 0:vt.fontStyle)??"normal"},fontSize:qt??.01,lineHeight:Kt,letterSpacing:Re??0,wordSpacing:ke??0,textAppearance:Ne,color:ie??"#DEDDDD"},Ee={...wt.omitTextColors(wt.textStylesToCss(De,o)),...Pt(qt,Kt,i,o)},Ae=Qt(qt,Kt,`${i}-lightbox-counter`,`${i}-text-tight-leading`),Ut=_e.buildColorVars(i,{titleColor:k??"#000000",descriptionColor:oe??"#000000",lightboxCounterColor:ie??"#DEDDDD"},Pe,tn),Yt=a.useRef(null),[Et,At]=a.useState(!1),[Ft,Fe]=a.useState([]),[We,Zt]=a.useState(0),ue=a.useCallback((j,H)=>{P&&(Fe(j),Zt(H),At(!0))},[P]),He=a.useCallback(()=>{At(!1)},[]),Oe=a.useMemo(()=>{const j={...Ut},H=Yt.current?getComputedStyle(Yt.current).getPropertyValue("--cntrl-article-width").trim():"";return H&&(j["--cntrl-article-width"]=H),j},[Ut,Et]);return a.useEffect(()=>{if(!Et||m!=="on"||typeof document>"u")return;const j=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=j}},[Et,m]),a.useEffect(()=>{!o||l||r||At(!1)},[o,l,r]),a.useEffect(()=>{m==="off"&&At(!1)},[m]),n.jsxs(n.Fragment,{children:[n.jsx("style",{dangerouslySetInnerHTML:{__html:p}}),n.jsx("div",{style:Ut,children:n.jsxs("div",{ref:Yt,className:`${i}-wrapper`,style:{width:at.scalingValue(u,o??!1),[`--${i}-title-top-padding`]:O==="top"?x(st):void 0,[`--${i}-title-bottom-padding`]:O==="bottom"?x(ct):void 0,[`--${i}-title-left-padding`]:M==="left"?x(D):void 0,[`--${i}-title-right-padding`]:M==="right"?x(E):void 0},children:[R&&n.jsx("div",{className:`${i}-single-title-layer`,children:n.jsx(te,{P:i,title:Q,description:gt,position:z,titleRef:()=>{},titleClassName:`${se} ${i}-single-title`,titleContainerStyle:{...ae,...mt},titleTextBoxStyle:le,titleStyle:re,descriptionClassName:de,descriptionStyle:ce,descriptionPadding:he,showTextBoxOutline:T,showDescriptionPaddingControl:T,topPaddingControl:Mt?Ot({P:i,controlKey:"titleTopPadding",scaled:x,height:St,paired:!1,side:"top"}):void 0,bottomPaddingControl:zt?Ot({P:i,controlKey:"titleBottomPadding",scaled:x,height:dt,paired:!1,side:"bottom"}):void 0})}),s.map((j,H)=>{const $t=rn(j.gallery),ge=H<s.length-1,Wt=$t.filter(it=>it.lightboxMedia).map(it=>it.lightboxMedia),me={P:i,position:z,titleRef:A(H),titleClassName:se,titleContainerStyle:ae,titleTextBoxStyle:R?{maxWidth:"100%"}:le,titleStyle:re,descriptionClassName:de,descriptionStyle:ce,descriptionPadding:he,showTextBoxOutline:T&&!R,showDescriptionPaddingControl:T&&!R,descriptionPaddingPaired:ht,topPaddingControl:Mt&&!R?Ot({P:i,controlKey:"titleTopPadding",scaled:x,height:St,paired:ht,side:"top"}):void 0,bottomPaddingControl:zt&&!R?Ot({P:i,controlKey:"titleBottomPadding",scaled:x,height:dt,paired:ht,side:"bottom"}):void 0};return n.jsxs("div",{"data-item-index":H,className:`${i}-item ${i}-item-${d}`,style:{paddingBottom:ge?x(U):void 0},children:[Dt&&ye({P:i,controlKey:"titleLeftPadding",scaled:x,width:Rt,maxFraction:Nt,side:"left",paired:ht,anchorStyle:c}),Bt&&ye({P:i,controlKey:"titleRightPadding",scaled:x,width:nt,maxFraction:Nt,side:"right",paired:ht,anchorStyle:g}),T&&ge&&n.jsx("div",{"data-controls":"galleryPaddingBetween","data-controls-axis":"y","data-controls-variant":"row-padding","data-controls-min":"0",className:`${i}-control-anchor`,style:{bottom:0,height:x(F),...C}}),$?n.jsxs("div",{className:`${i}-gallery`,children:[n.jsx("div",{className:`${i}-gallery-media`,children:$t.map(({displayMedia:it,lightboxMedia:Ct},Tt)=>{const It=Ct?Wt.findIndex(Jt=>Jt.assetId===Ct.assetId):-1;return n.jsx(xe,{P:i,media:it,imgWidth:v||void 0,cornerRadius:N||void 0,imageDisplay:G,isEditor:o,galleryPaddingBetween:U,showPaddingAfter:Tt<$t.length-1,showControls:T,onMediaClick:P&&It>=0?()=>ue(Wt,It):void 0},`${it.assetId}-${Tt}`)})}),n.jsx("div",{className:`${i}-title-layer`,children:n.jsx(te,{...me,title:R?"":j.title,description:R?"":j.description})})]}):n.jsxs(n.Fragment,{children:[n.jsx(te,{...me,title:R?"":j.title,description:R?"":j.description}),$t.length>0&&n.jsx(xn,{P:i,layoutType:d,galleryWidthStyle:jt,galleryPaddingRight:tt,galleryPaddingLeft:et,galleryPaddingRightWidth:xt,galleryPaddingLeftWidth:Z,galleryPaddingMaxFraction:_t,showControls:T,scaled:x,children:$t.map(({displayMedia:it,lightboxMedia:Ct},Tt)=>{const It=Ct?Wt.findIndex(Jt=>Jt.assetId===Ct.assetId):-1;return n.jsx(xe,{P:i,media:it,cornerRadius:N||void 0,fillGalleryWidth:!0,imageDisplay:G,isEditor:o,galleryPaddingBetween:U,showPaddingAfter:Tt<$t.length-1,showControls:T,onMediaClick:P&&It>=0?()=>ue(Wt,It):void 0},`${it.assetId}-${Tt}`)})})]})]},H)})]})}),Et&&m==="on"&&typeof document<"u"&&t&&(()=>{const j=(h?document.getElementById(h):null)??document.body;return Ve.createPortal(n.jsx("div",{style:Oe,"data-selection":"none",children:n.jsx(mn,{prefix:i,items:Ft,index:We,imageDisplay:hn(t.lightboxImageDisplay),isEditor:o,isPreviewMode:r,isEditMode:l,closeIcon:t.closeIcon,closeIconMaxWidth:t.closeIconMaxWidth,closeIconColor:t.closeIconColor,closeIconHoverColor:t.closeIconHoverColor,iconMarginRight:t.iconMarginRight,contentMarginTop:t.contentMarginTop,onClose:He,onPrev:()=>Zt(H=>(H-1+Ft.length)%Ft.length),onNext:()=>Zt(H=>(H+1)%Ft.length),counterClassName:Ae,counterStyle:Ee,backgroundColor:t.backgroundColor??Ze})}),j)})()]})}exports.Mercury=Sn;
@@ -1,111 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),s=require("react"),w=require("classnames"),Fe=require("./useScopedStyles-Bf6yohVQ.js"),Te=100,Me=70,m="cubic-bezier(0.86, 0, 0.07, 1)";function Ce(e){return`
2
- .${e}-wrapper {
3
- position: relative;
4
- width: 100%;
5
- height: 100%;
6
- overflow: hidden;
7
- }
8
- .${e}-background {
9
- position: absolute;
10
- inset: 0;
11
- z-index: 1;
12
- pointer-events: none;
13
- overflow: hidden;
14
- }
15
- .${e}-effect-image {
16
- width: 100%;
17
- height: 100%;
18
- object-fit: cover;
19
- display: block;
20
- }
21
- .${e}-stage {
22
- position: absolute;
23
- left: 50%;
24
- top: 50%;
25
- transform: translate(-50%, -50%) scale(var(--${e}-stage-scale, 1));
26
- overflow: hidden;
27
- }
28
- .${e}-foreground {
29
- z-index: 2;
30
- }
31
- .${e}-incoming {
32
- will-change: transform;
33
- }
34
- .${e}-incoming-next {
35
- z-index: 4;
36
- transition: transform var(--${e}-transition-ms) ${m};
37
- }
38
- .${e}-incoming-prev {
39
- z-index: 4;
40
- transition: transform var(--${e}-transition-ms) ${m};
41
- }
42
- .${e}-outgoing {
43
- will-change: transform;
44
- }
45
- .${e}-outgoing-next {
46
- z-index: 3;
47
- transition: transform var(--${e}-transition-ms) ${m};
48
- }
49
- .${e}-outgoing-prev {
50
- z-index: 3;
51
- transition: transform var(--${e}-transition-ms) ${m};
52
- }
53
- .${e}-outgoing-next .${e}-effect-image {
54
- transition: filter var(--${e}-transition-ms) ${m};
55
- }
56
- .${e}-outgoing-prev .${e}-effect-image {
57
- transition: filter var(--${e}-transition-ms) ${m};
58
- }
59
- .${e}-incoming .${e}-effect-image {
60
- transition: filter var(--${e}-transition-ms) ${m};
61
- }
62
- .${e}-background .${e}-effect-image {
63
- transition: filter var(--${e}-transition-ms) ${m};
64
- }
65
- .${e}-snap .${e}-incoming,
66
- .${e}-snap .${e}-outgoing,
67
- .${e}-snap .${e}-outgoing .${e}-effect-image,
68
- .${e}-snap .${e}-incoming .${e}-effect-image {
69
- transition: none !important;
70
- }
71
- .${e}-nav {
72
- position: absolute;
73
- top: 0;
74
- bottom: 0;
75
- width: 50%;
76
- z-index: 5;
77
- margin: 0;
78
- padding: 0;
79
- border: none;
80
- background: none;
81
- cursor: pointer;
82
- outline: none;
83
- -webkit-tap-highlight-color: transparent;
84
- }
85
- .${e}-nav-prev {
86
- left: 0;
87
- cursor: w-resize;
88
- }
89
- .${e}-nav-next {
90
- right: 0;
91
- cursor: e-resize;
92
- }
93
- .${e}-nav:focus,
94
- .${e}-nav:focus-visible {
95
- outline: none;
96
- }
97
- .${e}-editor .${e}-nav {
98
- cursor: default;
99
- pointer-events: none;
100
- }
101
- .${e}-foreground {
102
- pointer-events: none;
103
- }
104
- .${e}-image {
105
- width: 100%;
106
- height: 100%;
107
- object-fit: contain;
108
- display: block;
109
- pointer-events: none;
110
- }
111
- `}function Re(e){return e==="blur"?Me:e==="greyscale"?Te:0}function T(e,n=1,l=1){const c=Re(e)*Math.max(0,Math.min(1,n));if(e==="greyscale")return`grayscale(${c}%)`;if(e==="blur"){const t=c/4;return t<=0?"none":`blur(${t/Math.max(l,1)}px)`}return"none"}function ue(e){return e<=1?{backgroundIndex:0,activeIndex:0}:{backgroundIndex:0,activeIndex:1}}function Ae(e,n){return n<=1?0:(e-1+n)%n}function Ee(e,n=1){return!e||e.height===0?n:e.width/e.height}function Oe(e,n,l,c,t){if(e<=0||n<=0)return{widthPercent:c,heightPercent:t};const E=e*c/100,M=n*t/100;let y=E,p=y/l;return p>M&&(p=M,y=p*l),{widthPercent:y/e*100,heightPercent:p/n*100}}function de(e,n,l){if(e<=0||n<=0)return 1;const c=e*l.widthPercent/100,t=n*l.heightPercent/100;return c<=0||t<=0?1:Math.max(e/c,n/t)}function fe(e){return{width:`${e.widthPercent}%`,height:`${e.heightPercent}%`}}function he(e,n,l){return{...fe(e),[`--${l}-stage-scale`]:n}}function qe(e,n){[...new Set(e.filter(Boolean))].forEach(c=>{const t=new Image;t.onload=()=>{t.naturalWidth>0&&t.naturalHeight>0&&n(c,{width:t.naturalWidth,height:t.naturalHeight})},t.src=c})}function Be({settings:e,content:n,isEditor:l,isPreviewMode:c}){var ee,te,ne,ie,se,ae,re;const{prefix:t}=Fe.useScopedStyles(),E=s.useMemo(()=>Ce(t),[t]),{imageSize:M,maxWidth:y,maxHeight:p,transition:me=1e3,bgImage:S="greyscale"}=e,i=n??[],L=ue(i.length),[g,D]=s.useState(L.activeIndex),[G,O]=s.useState(L.backgroundIndex),[I,q]=s.useState(!1),[$e,B]=s.useState(!1),[H,C]=s.useState(null),[W,R]=s.useState(null),[xe,z]=s.useState(0),[ve,k]=s.useState(1),[pe,j]=s.useState("none"),[Y,Z]=s.useState("next"),[J,Se]=s.useState({}),[u,Ie]=s.useState({width:0,height:0}),N=s.useRef(null),K=s.useRef(null),_=!l||!!c,Q=M??60,V=Math.max(10,Math.min(100,y??Q)),X=Math.max(10,Math.min(100,p??Q)),U=Math.max(100,me),be=T(S),b=s.useCallback(o=>{const a=Ee(o?J[o]:void 0);return Oe(u.width,u.height,a,V,X)},[u.height,u.width,J,X,V]);s.useEffect(()=>{const o=K.current;if(!o)return;const a=new ResizeObserver(([d])=>{const{width:f,height:v}=d.contentRect;Ie({width:f,height:v})});return a.observe(o),()=>a.disconnect()},[]),s.useEffect(()=>{const o=(n??[]).map(a=>{var d;return(d=a.image)==null?void 0:d.assetId}).filter(a=>!!a);qe(o,(a,d)=>{Se(f=>{var v,F;return((v=f[a])==null?void 0:v.width)===d.width&&((F=f[a])==null?void 0:F.height)===d.height?f:{...f,[a]:d}})})},[n]),s.useEffect(()=>{const{backgroundIndex:o,activeIndex:a}=ue(i.length);D(a),O(o),q(!1),B(!1),C(null),R(null),z(0),k(1),j("none"),Z("next")},[i.length,n]),s.useEffect(()=>()=>{N.current&&clearTimeout(N.current)},[]);const P=s.useCallback(o=>{var oe,ce,le,ge;if(!_||I||i.length<=1)return;const a=o==="next"?(g+1)%i.length:(g-1+i.length)%i.length,d=b((ce=(oe=i[g])==null?void 0:oe.image)==null?void 0:ce.assetId),f=b((ge=(le=i[a])==null?void 0:le.image)==null?void 0:ge.assetId),v=de(u.width,u.height,d),F=de(u.width,u.height,f);N.current&&clearTimeout(N.current),Z(o),B(!0),q(!0),o==="next"?(C(g),R(a),z(0),k(1),j(T(S,0,1))):(O(Ae(a,i.length)),C(a),R(g),z(1),k(F),j(T(S,1,F))),requestAnimationFrame(()=>{B(!1),requestAnimationFrame(()=>{o==="next"?(z(1),k(v),j(T(S,1,v))):(z(0),k(1),j(T(S,0,1)))})}),N.current=setTimeout(()=>{o==="next"&&O(g),D(a),C(null),R(null),q(!1)},U)},[g,S,u.height,u.width,b,I,_,i,U]),h=i[g],A=G!==null?i[G]:null,$=H!==null?i[H]:null,x=W!==null?i[W]:null,we=i.length<=1?0:(g-1+i.length)%i.length,ye=i.length<=1?0:(g+1)%i.length,ze=b((ee=h==null?void 0:h.image)==null?void 0:ee.assetId),ke=b((te=$==null?void 0:$.image)==null?void 0:te.assetId),je=b((ne=x==null?void 0:x.image)==null?void 0:ne.assetId),Ne={[`--${t}-transition-ms`]:`${U}ms`};return r.jsxs(r.Fragment,{children:[r.jsx("style",{dangerouslySetInnerHTML:{__html:E}}),r.jsxs("div",{ref:K,className:w(`${t}-wrapper`,$e&&`${t}-snap`,l&&!c&&`${t}-editor`),style:Ne,"aria-label":"Zoom gallery",children:[((ie=A==null?void 0:A.image)==null?void 0:ie.assetId)&&r.jsx("div",{className:`${t}-background`,"aria-hidden":"true",children:r.jsx("img",{className:`${t}-effect-image`,src:A.image.assetId,alt:"",style:{filter:be}})}),I&&((se=$==null?void 0:$.image)==null?void 0:se.assetId)&&r.jsx("div",{className:w(`${t}-stage`,`${t}-outgoing`,`${t}-outgoing-${Y}`),style:he(ke,ve,t),"aria-hidden":"true",children:r.jsx("img",{className:`${t}-effect-image`,src:$.image.assetId,alt:"",style:{filter:pe}})}),I&&((ae=x==null?void 0:x.image)==null?void 0:ae.assetId)&&r.jsx("div",{className:w(`${t}-stage`,`${t}-incoming`,`${t}-incoming-${Y}`),style:he(je,xe,t),"aria-hidden":"true",children:r.jsx("img",{className:`${t}-image`,src:x.image.assetId,alt:""})}),!I&&((re=h==null?void 0:h.image)==null?void 0:re.assetId)&&r.jsx("div",{className:w(`${t}-stage`,`${t}-foreground`),style:fe(ze),children:r.jsx("img",{className:`${t}-image`,src:h.image.assetId,alt:h.image.name??""})}),_&&i.length>1&&!I&&r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button",className:w(`${t}-nav`,`${t}-nav-prev`),onClick:()=>P("prev"),"aria-label":`Show previous image (${we+1} of ${i.length})`}),r.jsx("button",{type:"button",className:w(`${t}-nav`,`${t}-nav-next`),onClick:()=>P("next"),"aria-label":`Show next image (${ye+1} of ${i.length})`})]})]})]})}exports.Scale=Be;