@cntrl-site/components 1.0.119 → 1.0.120-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),g=require("react"),L=require("./react-splide.esm-CabaEmHi.js");;/* empty css */const d=require("classnames"),M=require("./RichTextRenderer-DEFXh5o6.js"),s=require("./scalingValue-CSHYgTZl.js"),k=require("./SvgImage-DFlmxAoL.js"),U=require("./textStylesToCss-CNN3zZTV.js"),H="ControlSlider-module__wrapper___sHEkd",Y="ControlSlider-module__hoverArrow___A-dOH",K="ControlSlider-module__sliderItem___QQSkR",Q="ControlSlider-module__sliderImage___9hRl-",Z="ControlSlider-module__arrow___05ghY",G="ControlSlider-module__arrowVertical___tBfVN",J="ControlSlider-module__nextArrow___-30Yc",X="ControlSlider-module__arrowInner___aEra3",E="ControlSlider-module__arrowIcon___S4ztF",ee="ControlSlider-module__arrowImg___2dwJW",te="ControlSlider-module__mirror___brd6U",oe="ControlSlider-module__pagination___bicLF",ne="ControlSlider-module__paginationInner___bT-P-",ie="ControlSlider-module__paginationVertical___zYqKw",re="ControlSlider-module__paginationItem___nTRbk",le="ControlSlider-module__dot___p1Qun",ae="ControlSlider-module__activeDot___LHFaj",se="ControlSlider-module__paginationInsideBottom___R3FWn",ce="ControlSlider-module__paginationInsideTop___V-qb-",de="ControlSlider-module__paginationOutsideBottom___14w8D",_e="ControlSlider-module__paginationOutsideTop___SCLqB",me="ControlSlider-module__paginationInsideLeft___yOBRZ",ge="ControlSlider-module__paginationInsideRight___Rtt3o",pe="ControlSlider-module__paginationOutsideLeft___lahaw",ue="ControlSlider-module__paginationOutsideRight___EtuQa",he="ControlSlider-module__imgWrapper___UjEgB",fe="ControlSlider-module__captionBlock___dJ6-j",Ce="ControlSlider-module__captionTextWrapper___HFlpf",Se="ControlSlider-module__captionText___uGBVc",ve="ControlSlider-module__active___WZK4G",we="ControlSlider-module__withPointerEvents___t-18M",Ie="ControlSlider-module__topLeftAlignment___zjnGM",xe="ControlSlider-module__topCenterAlignment___gD1xW",Ae="ControlSlider-module__topRightAlignment___NMapS",ye="ControlSlider-module__middleLeftAlignment___OnUrY",Re="ControlSlider-module__middleCenterAlignment___Tdkl0",be="ControlSlider-module__middleRightAlignment___wEbfX",je="ControlSlider-module__bottomLeftAlignment___cTP2-",Le="ControlSlider-module__bottomCenterAlignment___c54fB",ke="ControlSlider-module__bottomRightAlignment___kEwrz",Ve="ControlSlider-module__clickOverlay___DZA28",Te="ControlSlider-module__contain___pLyq7",Oe="ControlSlider-module__cover___KdDat",e={wrapper:H,hoverArrow:Y,sliderItem:K,sliderImage:Q,arrow:Z,arrowVertical:G,nextArrow:J,arrowInner:X,arrowIcon:E,arrowImg:ee,mirror:te,pagination:oe,paginationInner:ne,paginationVertical:ie,paginationItem:re,dot:le,activeDot:ae,paginationInsideBottom:se,paginationInsideTop:ce,paginationOutsideBottom:de,paginationOutsideTop:_e,paginationInsideLeft:me,paginationInsideRight:ge,paginationOutsideLeft:pe,paginationOutsideRight:ue,imgWrapper:he,captionBlock:fe,captionTextWrapper:Ce,captionText:Se,active:ve,withPointerEvents:we,topLeftAlignment:Ie,topCenterAlignment:xe,topRightAlignment:Ae,middleLeftAlignment:ye,middleCenterAlignment:Re,middleRightAlignment:be,bottomLeftAlignment:je,bottomCenterAlignment:Le,bottomRightAlignment:ke,clickOverlay:Ve,contain:Te,cover:Oe},Ne={"top-left":e.topLeftAlignment,"top-center":e.topCenterAlignment,"top-right":e.topRightAlignment,"middle-left":e.middleLeftAlignment,"middle-center":e.middleCenterAlignment,"middle-right":e.middleRightAlignment,"bottom-left":e.bottomLeftAlignment,"bottom-center":e.bottomCenterAlignment,"bottom-right":e.bottomRightAlignment};function ze({settings:p,content:u,styles:T,isEditor:l}){const[_,O]=g.useState(null),{widthSettings:I,fontSettings:v,letterSpacing:N,textAlign:z,wordSpacing:B,fontSizeLineHeight:x,textAppearance:w,color:W}=T.imageCaption??{},[m,F]=g.useState(void 0),[C,q]=g.useState(null),[S,D]=g.useState(0),[$,P]=g.useState(0),{direction:n,transition:a,controls:o,pagination:i,imageCaption:h,triggers:f}=p,A=g.useRef(a.type),{x:y,y:R}=p.controls.offset,b=r=>{_&&_.go(r)};return g.useEffect(()=>{if(!C)return;const r=new ResizeObserver(c=>{if(!_)return;const[j]=c;F({width:Math.round(j.contentRect.width),height:Math.round(j.contentRect.height)})});return r.observe(C),()=>r.unobserve(C)},[C]),g.useEffect(()=>{!_||A.current===a.type||(P(r=>r+1),A.current=a.type)},[a.type]),t.jsx("div",{className:d(e.wrapper,{[e.editor]:l}),ref:q,children:t.jsxs("div",{className:e.sliderInner,style:{width:m?m.width:"100%",height:m?m.height:"100%",backgroundColor:a.backgroundColor&&a.type==="fade in"?a.backgroundColor:"transparent"},children:[p.imageCaption.isActive&&t.jsx("div",{className:d(e.captionBlock),children:t.jsx("div",{className:e.captionTextWrapper,children:u.map((r,c)=>t.jsx("div",{className:d(e.captionText,Ne[h.alignment],{[e.withPointerEvents]:c===S&&l,[e.active]:c===S}),style:{fontFamily:U.normalizeFontFamilyCssValue(v.fontFamily),fontWeight:v.fontWeight,fontStyle:v.fontStyle,width:I.sizing==="auto"?"max-content":s.scalingValue(I.width,l),letterSpacing:s.scalingValue(N,l),wordSpacing:s.scalingValue(B,l),textAlign:z,fontSize:s.scalingValue(x.fontSize,l),lineHeight:s.scalingValue(x.lineHeight,l),textTransform:w.textTransform??"none",textDecoration:w.textDecoration??"none",fontVariant:w.fontVariant??"normal",color:W,transitionDuration:a.duration?`${Math.round(parseInt(a.duration)/2)}ms`:"500ms"},children:t.jsx("div",{"data-styles":"imageCaption",className:e.captionTextInner,style:{"--link-hover-color":h.linkHoverColor,"--link-color":h.linkColor,position:"relative",top:s.scalingValue(h.offset.y,l),left:s.scalingValue(h.offset.x,l)},children:t.jsx(M.RichTextRenderer,{content:r.imageCaption})})},c))})}),t.jsx(L.Splide2,{onMove:r=>{D(r.index)},ref:O,options:{arrows:!1,speed:a.duration?parseInt(a.duration):500,autoplay:f.autoPlay!==null,...f.autoPlay!==null&&{interval:parseInt(f.autoPlay)*1e3},direction:n==="horiz"||a.type==="fade in"?"ltr":"ttb",pagination:!1,drag:f.triggersList.drag,perPage:1,width:m?m.width:"100%",height:m?m.height:"100%",type:a.type==="fade in"?"fade":"loop",rewind:!0},children:u.map((r,c)=>t.jsx(L.SplideSlide,{children:t.jsx("div",{className:e.sliderItem,children:t.jsx("div",{className:e.imgWrapper,children:t.jsx("img",{className:d(e.sliderImage,{[e.contain]:r.image.objectFit==="contain",[e.cover]:r.image.objectFit==="cover"}),src:r.image.assetId,alt:r.image.name??""})})})},c))},$),o.isActive&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:d(e.arrow,{[e.arrowVertical]:n==="vert",[e.hoverArrow]:o.show==="on hover"}),style:{color:o.color,"--arrow-hover-color":o.hover},children:t.jsxs("button",{onClick:()=>{b("-1")},className:e.arrowInner,style:{transform:`translate(${s.scalingValue(y,l)}, ${s.scalingValue(R*(n==="horiz"?1:-1),l)}) scale(${p.controls.scale/100}) rotate(${n==="horiz"?"0deg":"90deg"})`},children:[o.arrowsImgUrl&&t.jsx(k.SvgImage,{url:o.arrowsImgUrl,fill:o.color,hoverFill:o.hover,className:d(e.arrowImg,e.mirror)}),!o.arrowsImgUrl&&t.jsx(V,{color:o.color,className:d(e.arrowIcon,e.arrowImg,e.mirror)})]})}),t.jsx("div",{className:d(e.arrow,e.nextArrow,{[e.arrowVertical]:n==="vert",[e.hoverArrow]:o.show==="on hover"}),style:{color:o.color,"--arrow-hover-color":o.hover},children:t.jsxs("button",{className:e.arrowInner,onClick:()=>b("+1"),style:{transform:`translate(${s.scalingValue(y*(n==="horiz"?-1:1),l)}, ${s.scalingValue(R,l)}) scale(${p.controls.scale/100}) rotate(${n==="horiz"?"0deg":"90deg"})`},children:[o.arrowsImgUrl&&t.jsx(k.SvgImage,{url:o.arrowsImgUrl,fill:o.color,hoverFill:o.hover,className:e.arrowImg}),!o.arrowsImgUrl&&t.jsx(V,{color:o.color,className:d(e.arrowIcon,e.arrowImg)})]})})]}),f.triggersList.click&&t.jsx("div",{className:e.clickOverlay,onClick:()=>{_&&_.go("+1")}}),i.isActive&&t.jsx("div",{className:d(e.pagination,{[e.paginationInsideBottom]:i.position==="inside-1"&&n==="horiz",[e.paginationInsideTop]:i.position==="inside-2"&&n==="horiz",[e.paginationOutsideBottom]:i.position==="outside-1"&&n==="horiz",[e.paginationOutsideTop]:i.position==="outside-2"&&n==="horiz",[e.paginationInsideLeft]:i.position==="inside-1"&&n==="vert",[e.paginationInsideRight]:i.position==="inside-2"&&n==="vert",[e.paginationOutsideLeft]:i.position==="outside-1"&&n==="vert",[e.paginationOutsideRight]:i.position==="outside-2"&&n==="vert",[e.paginationVertical]:n==="vert"}),children:t.jsx("div",{className:e.paginationInner,style:{backgroundColor:i.colors[2],transform:`scale(${i.scale/100}) translate(${s.scalingValue(i.offset.x,l)}, ${s.scalingValue(i.offset.y,l)}) rotate(${n==="horiz"?"0deg":"90deg"})`},children:u.map((r,c)=>t.jsx("button",{onClick:()=>{_&&_.go(c)},className:d(e.paginationItem),children:t.jsx("div",{className:d(e.dot,{[e.activeDot]:c===S}),style:{backgroundColor:c===S?i.colors[0]:i.colors[1],"--pagination-hover-color":i.hover}})},c))})})]})})}function V({color:p,className:u}){return t.jsx("svg",{viewBox:"0 0 10 18",className:u,children:t.jsx("g",{id:"Symbols",stroke:"none",strokeWidth:"1",fillRule:"evenodd",children:t.jsx("path",{d:"M-3.70710678,4.29289322 C-3.34662282,3.93240926 -2.77939176,3.90467972 -2.38710056,4.20970461 L-2.29289322,4.29289322 L5,11.585 L12.2928932,4.29289322 C12.6533772,3.93240926 13.2206082,3.90467972 13.6128994,4.20970461 L13.7071068,4.29289322 C14.0675907,4.65337718 14.0953203,5.22060824 13.7902954,5.61289944 L13.7071068,5.70710678 L5.70710678,13.7071068 C5.34662282,14.0675907 4.77939176,14.0953203 4.38710056,13.7902954 L4.29289322,13.7071068 L-3.70710678,5.70710678 C-4.09763107,5.31658249 -4.09763107,4.68341751 -3.70710678,4.29289322 Z",id:"Shape-Copy",fill:p,transform:"translate(5, 9) rotate(-90) translate(-5, -9)"})})})}exports.ControlSlider=ze;
@@ -1,408 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),Mt=require("./react-splide.esm-CabaEmHi.js");;/* empty css */const f=require("./scalingValue-CSHYgTZl.js"),ii=require("./buildColorVars-CE2D5cQV.js"),ni=require("./useScopedStyles-Bf6yohVQ.js"),Dt=require("./useLazyVideos-CdCbc2j0.js"),ct=require("./LinkWrapper-CTqM1ucO.js"),H=require("./EmbedMediaFrame-DsOTKE4i.js"),r=require("react"),ri=require("react-dom"),Ne=require("./textStylesToCss-CNN3zZTV.js"),si=require("./SvgImage-DFlmxAoL.js"),Ht=require("./LazyVideo-imbU18js.js");function oi(e){return`calc(var(--cntrl-article-width, 100vw) * ${e/1440})`}function Ot(e){return((e==null?void 0:e.trim().length)??0)>0}function St(e,i,n,a){return i!==void 0&&i<(e??.01)?`${n} ${a}`:n}function jt(e,i,n,a){const o=e??.01;return i===void 0||i>=o?{}:{[`--${n}-title-leading-gap`]:f.scalingValue((o-i)/2,a)}}const Ct=400,It="cubic-bezier(0.25, 0.1, 0.25, 1)",li=1.1,qt="--grid-media-radius";function ai(e){return`
2
- .${e}-wrapper {
3
- display: grid;
4
- align-items: start;
5
- justify-content: center;
6
- min-height: ${oi(48)};
7
- }
8
- .${e}-item {
9
- display: flex;
10
- flex-direction: column;
11
- justify-content: center;
12
- align-items: center;
13
- }
14
- .${e}-item-inner {
15
- display: flex;
16
- flex-direction: column;
17
- align-items: center;
18
- outline: 1px solid #FF5C02;
19
- }
20
- .${e}-item-inner-hidden {
21
- display: flex;
22
- flex-direction: column;
23
- align-items: center;
24
- }
25
- .${e}-item-image-wrapper {
26
- display: flex;
27
- justify-content: center;
28
- align-items: center;
29
- align-self: center;
30
- }
31
- .${e}-item-image-wrapper-fit-slider {
32
- display: grid;
33
- overflow: hidden;
34
- position: relative;
35
- }
36
- .${e}-item-image-wrapper-fit-slider > .${e}-item-image-wrapper-sizer {
37
- grid-area: 1 / 1;
38
- width: 100%;
39
- display: grid;
40
- visibility: hidden;
41
- pointer-events: none;
42
- }
43
- .${e}-item-image-wrapper-fit-slider > .${e}-item-image-wrapper-sizer img {
44
- grid-area: 1 / 1;
45
- width: auto;
46
- height: auto;
47
- max-width: 100%;
48
- object-fit: contain;
49
- }
50
- .${e}-item-image-wrapper-fit-slider > .${e}-item-image-wrapper-sizer video {
51
- grid-area: 1 / 1;
52
- width: auto;
53
- height: auto;
54
- max-width: 100%;
55
- object-fit: contain;
56
- }
57
- .${e}-item-image-wrapper-fit-slider > .${e}-item-image-wrapper-sizer div {
58
- grid-area: 1 / 1;
59
- width: 100%;
60
- }
61
- .${e}-item-image-wrapper-fit-slider > .${e}-item-slider {
62
- position: absolute;
63
- inset: 0;
64
- width: 100%;
65
- overflow: hidden;
66
- }
67
- .${e}-item-slider .splide__track {
68
- overflow: hidden;
69
- }
70
- .${e}-item-image-link {
71
- width: 100%;
72
- display: flex;
73
- flex-direction: column;
74
- align-items: center;
75
- }
76
- .${e}-item-text-link {
77
- display: flex;
78
- flex-direction: column;
79
- align-items: center;
80
- width: 100%;
81
- color: inherit;
82
- text-decoration: none;
83
- }
84
- .${e}-item-image {
85
- width: 100%;
86
- height: 100%;
87
- display: block;
88
- max-width: 100%;
89
- }
90
- .${e}-item-video {
91
- width: 100%;
92
- height: 100%;
93
- display: block;
94
- max-width: 100%;
95
- }
96
- .${e}-item-slider,
97
- .${e}-item-slider .splide__track,
98
- .${e}-item-slider .splide__list,
99
- .${e}-item-slider .splide__slide {
100
- width: 100%;
101
- height: 100%;
102
- }
103
- .${e}-item-slider .splide__slide {
104
- display: flex;
105
- justify-content: center;
106
- align-items: center;
107
- }
108
- .${e}-item-title {
109
- white-space: normal;
110
- overflow-wrap: anywhere;
111
- word-break: break-word;
112
- text-align: center;
113
- margin-bottom: 0px;
114
- margin-top: 0px;
115
- color: var(--${e}-title-color);
116
- }
117
- .${e}-item-subtitle {
118
- white-space: normal;
119
- overflow-wrap: anywhere;
120
- word-break: break-word;
121
- text-align: center;
122
- margin-bottom: 0px;
123
- margin-top: 0px;
124
- color: var(--${e}-subtitle-color);
125
- }
126
- .${e}-text-tight-leading {
127
- display: block;
128
- flex-shrink: 0;
129
- padding-top: var(--${e}-title-leading-gap, 0);
130
- padding-bottom: var(--${e}-title-leading-gap, 0);
131
- }
132
- .${e}-show-text-hover .${e}-item-title,
133
- .${e}-show-text-hover .${e}-item-subtitle {
134
- opacity: 0;
135
- transition: opacity 250ms;
136
- }
137
- .${e}-show-text-hover .${e}-item-inner:hover .${e}-item-title,
138
- .${e}-show-text-hover .${e}-item-inner:hover .${e}-item-subtitle,
139
- .${e}-show-text-hover .${e}-item-inner-hidden:hover .${e}-item-title,
140
- .${e}-show-text-hover .${e}-item-inner-hidden:hover .${e}-item-subtitle {
141
- opacity: 1;
142
- }
143
- @property --${e}-hover-zoom {
144
- syntax: '<number>';
145
- inherits: false;
146
- initial-value: 1;
147
- }
148
- .${e}-hover-zoom-in .${e}-item-image,
149
- .${e}-hover-zoom-in .${e}-item-video {
150
- transform: scale(var(--${e}-hover-zoom));
151
- clip-path: inset(calc(50% - 50% / var(--${e}-hover-zoom)) round calc(var(${qt}, 0px) / var(--${e}-hover-zoom)));
152
- transition: --${e}-hover-zoom ${Ct}ms ${It};
153
- }
154
- .${e}-hover-scale-down .${e}-item-image,
155
- .${e}-hover-scale-down .${e}-item-video {
156
- transition: transform ${Ct}ms ${It};
157
- }
158
- .${e}-hover-greyscale .${e}-item-image-wrapper {
159
- transition: filter ${Ct}ms ${It};
160
- }
161
- @media (hover: hover) {
162
- .${e}-hover-zoom-in .${e}-item-image-wrapper:has(.${e}-item-image:hover, .${e}-item-video:hover) :is(.${e}-item-image, .${e}-item-video) {
163
- --${e}-hover-zoom: ${li};
164
- }
165
- .${e}-hover-scale-down .${e}-item-image-wrapper:hover .${e}-item-image,
166
- .${e}-hover-scale-down .${e}-item-image-wrapper:hover .${e}-item-video {
167
- transform: scale(0.9);
168
- }
169
- .${e}-hover-greyscale:has(.${e}-item-image:hover, .${e}-item-video:hover) .${e}-item-image-wrapper:not(:has(.${e}-item-image:hover, .${e}-item-video:hover)) {
170
- filter: grayscale(1);
171
- }
172
- }
173
- .${e}-type-a .${e}-item-inner,
174
- .${e}-type-a .${e}-item-inner-hidden,
175
- .${e}-type-d .${e}-item-inner,
176
- .${e}-type-d .${e}-item-inner-hidden {
177
- align-items: flex-start;
178
- }
179
- .${e}-type-b .${e}-item-inner,
180
- .${e}-type-b .${e}-item-inner-hidden,
181
- .${e}-type-e .${e}-item-inner,
182
- .${e}-type-e .${e}-item-inner-hidden {
183
- align-items: center;
184
- }
185
- .${e}-type-c .${e}-item-inner,
186
- .${e}-type-c .${e}-item-inner-hidden,
187
- .${e}-type-f .${e}-item-inner,
188
- .${e}-type-f .${e}-item-inner-hidden {
189
- align-items: flex-end;
190
- }
191
- .${e}-type-a .${e}-item-image-link,
192
- .${e}-type-b .${e}-item-image-link,
193
- .${e}-type-c .${e}-item-image-link,
194
- .${e}-type-d .${e}-item-image-link,
195
- .${e}-type-e .${e}-item-image-link,
196
- .${e}-type-f .${e}-item-image-link {
197
- align-items: center;
198
- }
199
- .${e}-type-a .${e}-item-title,
200
- .${e}-type-a .${e}-item-subtitle,
201
- .${e}-type-d .${e}-item-title,
202
- .${e}-type-d .${e}-item-subtitle {
203
- text-align: left;
204
- }
205
- .${e}-type-b .${e}-item-title,
206
- .${e}-type-b .${e}-item-subtitle,
207
- .${e}-type-e .${e}-item-title,
208
- .${e}-type-e .${e}-item-subtitle {
209
- text-align: center;
210
- }
211
- .${e}-type-c .${e}-item-title,
212
- .${e}-type-c .${e}-item-subtitle,
213
- .${e}-type-f .${e}-item-title,
214
- .${e}-type-f .${e}-item-subtitle {
215
- text-align: right;
216
- }
217
- .${e}-item-text-block {
218
- display: flex;
219
- flex-direction: column;
220
- align-items: flex-start;
221
- width: 100%;
222
- flex-shrink: 0;
223
- }
224
- .${e}-type-d .${e}-item-text-block {
225
- align-items: flex-start;
226
- }
227
- .${e}-type-e .${e}-item-text-block {
228
- align-items: center;
229
- }
230
- .${e}-type-f .${e}-item-text-block {
231
- align-items: flex-end;
232
- }
233
- .${e}-type-a .${e}-item-text-link,
234
- .${e}-type-d .${e}-item-text-link {
235
- align-items: flex-start;
236
- }
237
- .${e}-type-b .${e}-item-text-link,
238
- .${e}-type-e .${e}-item-text-link {
239
- align-items: center;
240
- }
241
- .${e}-type-c .${e}-item-text-link,
242
- .${e}-type-f .${e}-item-text-link {
243
- align-items: flex-end;
244
- }
245
- .${e}-image-align-top .${e}-item-image-wrapper:not(.${e}-item-image-wrapper-fit-slider) {
246
- align-items: flex-start;
247
- }
248
- .${e}-image-align-center .${e}-item-image-wrapper:not(.${e}-item-image-wrapper-fit-slider) {
249
- align-items: center;
250
- }
251
- .${e}-image-align-bottom .${e}-item-image-wrapper:not(.${e}-item-image-wrapper-fit-slider) {
252
- align-items: flex-end;
253
- }
254
- .${e}-image-align-top .${e}-item-slider .splide__slide {
255
- align-items: flex-start;
256
- }
257
- .${e}-image-align-center .${e}-item-slider .splide__slide {
258
- align-items: center;
259
- }
260
- .${e}-image-align-bottom .${e}-item-slider .splide__slide {
261
- align-items: flex-end;
262
- }
263
- .${e}-align-entries .${e}-item {
264
- display: contents;
265
- }
266
- .${e}-align-entries .${e}-item-inner,
267
- .${e}-align-entries .${e}-item-inner-hidden {
268
- display: grid;
269
- grid-template-rows: subgrid;
270
- grid-row: span 3;
271
- justify-self: center;
272
- margin-bottom: var(--${e}-align-entries-row-gap, 0);
273
- }
274
- .${e}-align-entries .${e}-item-inner-last-row {
275
- margin-bottom: 0;
276
- }
277
- .${e}-align-entries .${e}-item-text-link {
278
- display: contents;
279
- }
280
- .${e}-align-entries .${e}-item-title-row,
281
- .${e}-align-entries .${e}-item-subtitle-row {
282
- display: flex;
283
- flex-direction: column;
284
- align-items: flex-start;
285
- width: 100%;
286
- min-height: 100%;
287
- }
288
- .${e}-type-a.${e}-align-entries .${e}-item-title-row,
289
- .${e}-type-a.${e}-align-entries .${e}-item-subtitle-row,
290
- .${e}-type-d.${e}-align-entries .${e}-item-title-row,
291
- .${e}-type-d.${e}-align-entries .${e}-item-subtitle-row {
292
- align-items: flex-start;
293
- }
294
- .${e}-type-b.${e}-align-entries .${e}-item-title-row,
295
- .${e}-type-b.${e}-align-entries .${e}-item-subtitle-row,
296
- .${e}-type-e.${e}-align-entries .${e}-item-title-row,
297
- .${e}-type-e.${e}-align-entries .${e}-item-subtitle-row {
298
- align-items: center;
299
- }
300
- .${e}-type-c.${e}-align-entries .${e}-item-title-row,
301
- .${e}-type-c.${e}-align-entries .${e}-item-subtitle-row,
302
- .${e}-type-f.${e}-align-entries .${e}-item-title-row,
303
- .${e}-type-f.${e}-align-entries .${e}-item-subtitle-row {
304
- align-items: flex-end;
305
- }
306
- .${e}-align-entries .${e}-item-image-link {
307
- width: 100%;
308
- height: 100%;
309
- min-height: 100%;
310
- display: flex;
311
- flex-direction: column;
312
- align-items: center;
313
- justify-content: flex-start;
314
- }
315
- .${e}-align-entries .${e}-item-image-link > .${e}-item-image-wrapper {
316
- flex-shrink: 0;
317
- height: auto;
318
- align-self: auto;
319
- }
320
- .${e}-image-align-top.${e}-align-entries .${e}-item-image-link > .${e}-item-image-wrapper {
321
- margin-top: 0;
322
- margin-bottom: auto;
323
- }
324
- .${e}-image-align-center.${e}-align-entries .${e}-item-image-link > .${e}-item-image-wrapper {
325
- margin-top: auto;
326
- margin-bottom: auto;
327
- }
328
- .${e}-image-align-bottom.${e}-align-entries .${e}-item-image-link > .${e}-item-image-wrapper {
329
- margin-top: auto;
330
- margin-bottom: 0;
331
- }
332
- .${e}-image-align-top.${e}-align-entries .${e}-item-image-wrapper:not(.${e}-item-image-wrapper-fit-slider) {
333
- align-items: flex-start;
334
- }
335
- .${e}-image-align-center.${e}-align-entries .${e}-item-image-wrapper:not(.${e}-item-image-wrapper-fit-slider) {
336
- align-items: center;
337
- }
338
- .${e}-image-align-bottom.${e}-align-entries .${e}-item-image-wrapper:not(.${e}-item-image-wrapper-fit-slider) {
339
- align-items: flex-end;
340
- }
341
- .${e}-image-align-top.${e}-align-entries .${e}-item-slider .splide__slide {
342
- align-items: flex-start;
343
- }
344
- .${e}-image-align-center.${e}-align-entries .${e}-item-slider .splide__slide {
345
- align-items: center;
346
- }
347
- .${e}-image-align-bottom.${e}-align-entries .${e}-item-slider .splide__slide {
348
- align-items: flex-end;
349
- }
350
- .${e}-image-align-top.${e}-align-entries .${e}-item-image-link {
351
- justify-content: flex-start;
352
- }
353
- .${e}-image-align-center.${e}-align-entries .${e}-item-image-link {
354
- justify-content: center;
355
- }
356
- .${e}-image-align-bottom.${e}-align-entries .${e}-item-image-link {
357
- justify-content: flex-end;
358
- }
359
- .${e}-lightbox-counter {
360
- margin: 0;
361
- color: var(--${e}-lightbox-counter-color);
362
- }
363
- .${e}-lightbox {
364
- position: fixed;
365
- inset: 0;
366
- z-index: 9997;
367
- overscroll-behavior: none;
368
- overflow: hidden;
369
- }
370
- .${e}-lightbox-editor {
371
- inset: auto;
372
- top: var(--cntrl-article-top, 0);
373
- left: var(--cntrl-article-left, 0);
374
- width: var(--cntrl-article-width, 100vw) !important;
375
- height: var(--cntrl-viewport-height, 100vh) !important;
376
- }
377
- .${e}-control {
378
- position: relative;
379
- z-index: 2;
380
- width: 100%;
381
- }
382
- .${e}-close-icon {
383
- position: relative;
384
- flex-shrink: 0;
385
- pointer-events: auto;
386
- z-index: 2;
387
- display: flex;
388
- align-items: center;
389
- justify-content: center;
390
- border: none;
391
- background-color: transparent;
392
- padding: 0;
393
- }
394
- .${e}-close-icon-inner {
395
- all: unset;
396
- position: relative;
397
- cursor: pointer;
398
- width: 100%;
399
- height: 100%;
400
- pointer-events: auto;
401
- }
402
- .${e}-close-icon-img {
403
- position: absolute;
404
- top: 50%;
405
- left: 50%;
406
- transform: translate(-50%, -50%);
407
- }
408
- `}function ci(){return Math.random()<.5?"ltr":"ttb"}function di(e){const i=e.Components.Autoplay;i&&(i.pause(!1),i.play())}function ui(e){const i=ci();e.options.direction!==i&&(e.options={...e.options,direction:i}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{di(e)})})}const D=500,mi=750,le="cubic-bezier(0.22, 1, 0.36, 1)",gi=72,hi=50;function pi(e){if(!Array.isArray(e)||e.length===0)return!1;const i=e[0];return i!==null&&typeof i=="object"&&"media"in i&&Array.isArray(i.media)}function fi(e){const[i,n]=e.media;return n!=null&&n.assetId?n:i!=null&&i.assetId?i:null}function $i(e){const[i]=e.media;return i!=null&&i.assetId?i:null}function Bt(e){return!Array.isArray(e)||e.length===0?[]:pi(e)?e.flatMap(i=>{const n=fi(i);if(!n)return[];const a=$i(i);return[{displayMedia:n,lightboxMedia:a!=null&&a.assetId?a:null}]}):e.filter(i=>i==null?void 0:i.assetId).map(i=>({displayMedia:i,lightboxMedia:i}))}function xe(e){return!H.isEmbedMedia(e)&&e.type==="video"}function yi(e){const i=new Set,n=[];for(const a of e){const o=Bt(a.gallery);for(const x of o){const y=x.lightboxMedia;y!=null&&y.assetId&&!i.has(y.assetId)&&(i.add(y.assetId),n.push(y))}}return n}function xi({mediaList:e}){const[i,n]=r.useState(null);Dt.useLazyVideos(i,{preload:"metadata"});const a=e.filter(o=>!H.isEmbedMedia(o));return a.length===0?null:t.jsx("div",{ref:n,"aria-hidden":!0,style:{position:"absolute",width:0,height:0,overflow:"hidden",opacity:0,pointerEvents:"none"},children:a.map(o=>xe(o)?t.jsx("video",{src:o.assetId,preload:"none",muted:!0,playsInline:!0},o.assetId):t.jsx("img",{src:o.assetId,alt:""},o.assetId))})}function vi(e){e.pause(),e.removeAttribute("src"),e.load()}const wi=".splide__slide video";function bi(e){var o;if(e.closest(".splide--fade, .splide__slide.is-active:not(.splide__slide--clone), .splide__slide.is-next"))return!0;const i=e.closest(".splide__slide");if(!i||i.classList.contains("splide__slide--clone"))return!1;const n=i.dataset.slideIndex,a=(o=i.parentElement)==null?void 0:o.querySelector(".splide__slide.is-next");return n!==void 0&&(a==null?void 0:a.dataset.slideIndex)===n}function Wt({media:e,className:i,style:n,hasLightbox:a,isSplideSlide:o=!1,onMediaClick:x}){if(H.isEmbedMedia(e))return t.jsx(H.EmbedMediaFrame,{media:e,fit:n.objectFit==="contain"?"contain":"cover",silentLoop:a,className:i,style:{...n,cursor:x?"pointer":"default"},onClick:x});if(xe(e)){const y={src:e.assetId,className:i,style:{...n,cursor:x?"pointer":"default"},muted:!0,loop:!0,playsInline:!0,onClick:x};return o?t.jsx("video",{...y,preload:"none"}):t.jsx(Ht.LazyVideo,{...y,autoPlay:!0})}return t.jsx("img",{src:e.assetId,alt:e.name,className:i,style:{...n,cursor:x?"pointer":"default"},onClick:x})}function Si({className:e,style:i,children:n}){const[a,o]=r.useState(null);return Dt.useLazyVideos(a,{autoPlay:!0,selector:wi,shouldPlay:bi}),t.jsx("div",{ref:o,className:e,style:i,children:n})}function Et(e){const i=e.getBoundingClientRect();return{width:i.width,height:i.height,left:i.left,top:i.top}}function ji(e,i){if(!i||!i.width||!i.height||!e.width||!e.height)return e;const n=i.width/i.height,a=e.width/e.height;if(n>a){const x=e.width/n;return{width:e.width,height:x,left:e.left,top:e.top+(e.height-x)/2}}const o=e.height*n;return{width:o,height:e.height,left:e.left+(e.width-o)/2,top:e.top}}function Ci({src:e,mediaRef:i,mediaStyle:n,onLoadedMetadata:a}){return r.useEffect(()=>{const o=i.current;if(o)return()=>{vi(o)}},[e,i]),t.jsx("video",{ref:i,src:e,muted:!0,autoPlay:!0,loop:!0,playsInline:!0,preload:"auto",onLoadedMetadata:a,style:n})}const Ii="https://cdn.cntrl.site/component-assets/defaultCloseIcon.svg",ki=.004;function Ti({prefix:e,closeIcon:i=Ii,closeIconMaxWidth:n=.0125,closeIconColor:a="#FFFFFF",closeIconHoverColor:o="#999999",iconMarginRight:x=.01,contentMarginTop:y=.01,isEditor:q,isPreviewMode:ae,isEditMode:s,visible:V,onClose:Z}){if(!i)return null;const J=f.scalingValue(n,q),ce=f.scalingValue(x,q),ve=f.scalingValue(y,q),S=f.scalingValue(Math.max(y,ki),q);return t.jsxs("div",{style:{position:"absolute",top:0,left:0,right:0,zIndex:1e4,display:"flex",flexDirection:"column",alignItems:"flex-end",pointerEvents:"none",opacity:V?1:0,transition:"opacity 500ms cubic-bezier(0.22, 1, 0.36, 1)"},children:[t.jsx("div",{style:{position:"relative",width:"100%",height:ve,flexShrink:0},children:s&&t.jsx("div",{"data-controls":"contentMarginTop","data-controls-axis":"y","data-controls-min":"0",className:`${e}-control`,style:{position:"absolute",top:0,left:0,width:"100%",height:S,pointerEvents:V?"auto":"none"}})}),t.jsxs("div",{className:`${e}-close-icon`,style:{width:J,height:J,marginRight:ce,pointerEvents:V?"auto":"none"},onClick:j=>j.stopPropagation(),children:[t.jsx("button",{type:"button",className:`${e}-close-icon-inner`,"aria-label":"Close",onClick:j=>{j.stopPropagation(),Z()},children:t.jsx(si.SvgImage,{url:i,fill:a,hoverFill:q&&!ae?a:o,className:`${e}-close-icon-img`})}),s&&t.jsx("div",{"data-controls":"iconMarginRight","data-controls-axis":"x","data-controls-reverse":"",className:`${e}-control`,style:{position:"absolute",top:0,left:"100%",width:ce,height:"100%",pointerEvents:V?"auto":"none"}})]})]})}function Li({prefix:e,items:i,index:n,imageDisplay:a,isEditor:o,isPreviewMode:x,isEditMode:y,onClose:q,onPrev:ae,onNext:s,counterClassName:V,counterStyle:Z,closeIcon:J,closeIconMaxWidth:ce,closeIconColor:ve,closeIconHoverColor:S,iconMarginRight:j,contentMarginTop:Xe}){const we=a==="cover",Re=r.useRef(null),de=r.useRef(null),ue=r.useRef(null),L=r.useRef(null),B=r.useRef(0),_=r.useRef(0),z=r.useRef("none"),G=r.useRef(!1),Q=r.useRef(!1),Ue=r.useRef(null),k=r.useRef(0),M=r.useRef(null),N=r.useRef(!1),ie=r.useRef(null),X=r.useRef(null),Fe=r.useRef(null),Ye=r.useRef(()=>{}),[m,Ve]=r.useState(null),[c,dt]=r.useState(null),[w,be]=r.useState("opening"),[P,O]=r.useState(0),[me,W]=r.useState(0),[Ae,ne]=r.useState(null),[Me,ge]=r.useState(!1),[Se,he]=r.useState(!1),[ut,Ke]=r.useState(!1),[mt,Ze]=r.useState(null),Oe=r.useRef(n),Je=r.useRef(void 0),d=i[n],gt=d?xe(d):!1,Qe=d?H.isEmbedMedia(d):!1,je=Ae!==null,Pe=r.useCallback(l=>{const u=l.currentTarget,I=u instanceof HTMLVideoElement?{width:u.videoWidth,height:u.videoHeight}:{width:u.naturalWidth,height:u.naturalHeight};!I.width||!I.height||Ze(I)},[]);r.useEffect(()=>{Ue.current=c},[c]),r.useEffect(()=>{const l=Re.current;if(!l)return;const u=()=>dt(Et(l));u();const I=new ResizeObserver(u);return I.observe(l),()=>I.disconnect()},[]);const C=r.useCallback(()=>{ie.current!==null&&(window.clearTimeout(ie.current),ie.current=null)},[]),U=r.useCallback(()=>{const l=X.current;X.current=null,C(),M.current=null,N.current=!1,ne(null),ge(!1),W(0),k.current=0,he(!1),G.current=!1,_.current=0,z.current="none",l===1?s():l===-1&&ae()},[C,s,ae]),Ce=r.useCallback(()=>{C(),X.current=null,M.current=null,N.current=!1,ne(null),ge(!1),W(0),k.current=0},[C]),ht=r.useCallback(()=>{C(),ie.current=window.setTimeout(()=>{X.current!==null&&U()},D+32)},[C,U]),pe=r.useCallback((l,u)=>{var ee;const I=((ee=Ue.current)==null?void 0:ee.width)??0;if(C(),M.current=l,ne(l),N.current=!0,ge(!0),u){X.current=l;const se=-l*I;k.current=se,W(se),ht();return}k.current=0,W(0),ie.current=window.setTimeout(()=>{ie.current=null,Ce()},D+32)},[C,Ce,ht]),fe=r.useCallback(l=>{if(!(i.length<=1)){if(N.current){if(X.current===l){Fe.current=l,U();return}Ce()}C(),M.current=l,ne(l),N.current=!1,ge(!1),k.current=0,W(0),requestAnimationFrame(()=>{requestAnimationFrame(()=>{pe(l,!0)})})}},[i.length,pe,U,Ce,C]);Ye.current=fe;const Ie=r.useCallback(l=>{l.propertyName!=="transform"||!N.current||X.current!==null&&U()},[U]),$e=r.useCallback(()=>{const l=de.current;if(!l)return;const u=Et(l);!u.width||!u.height||Ve(u)},[]);r.useEffect(()=>{$e();const l=de.current;if(!l)return;const u=new ResizeObserver(()=>$e());return u.observe(l),()=>u.disconnect()},[$e]),r.useEffect(()=>{w==="opening"&&m&&be("open")},[w,m]),r.useEffect(()=>{if(w!=="closing")return;const l=setTimeout(()=>q(),D);return()=>clearTimeout(l)},[w,q]),r.useEffect(()=>()=>{C()},[C]),r.useLayoutEffect(()=>{Oe.current===n&&Je.current===(d==null?void 0:d.assetId)||(C(),X.current=null,ne(null),O(0),W(0),ge(!1),Ke(!1),he(!1),Ze(null),B.current=0,_.current=0,z.current="none",G.current=!1,N.current=!1,k.current=0,M.current=null,L.current=null,Q.current=!1,Oe.current=n,Je.current=d==null?void 0:d.assetId)},[n,d==null?void 0:d.assetId,C]),r.useLayoutEffect(()=>{const l=Fe.current;l!==null&&(Fe.current=null,requestAnimationFrame(()=>{Ye.current(l)}))},[n,d==null?void 0:d.assetId]),r.useEffect(()=>{if(w!=="open")return;let l=null;const u=()=>{l&&(document.removeEventListener("click",l,!0),l=null)},I=()=>{u(),l=h=>{h.stopPropagation(),h.preventDefault(),u()},document.addEventListener("click",l,!0)},ee=h=>{const R=h<0?1:-1;if(Math.abs(h)>hi&&i.length>1){pe(R,!0);return}pe(R,!1)},se=h=>{if(h.touches.length!==1||N.current)return;const R=h.touches[0];Q.current=!0,L.current={x:R.clientX,y:R.clientY},z.current="none",_.current=0,G.current=!1},He=h=>{if(!L.current||h.touches.length!==1||N.current)return;const R=h.touches[0],te=R.clientX-L.current.x,v=R.clientY-L.current.y;if(z.current==="none"){if(Math.abs(te)<10&&Math.abs(v)<10)return;if(Math.abs(te)>Math.abs(v)){if(i.length<=1)return;z.current="horizontal"}else if(v>0)z.current="vertical";else return}if(z.current==="horizontal"){G.current=!0,he(!0),_.current=te;const F=te<0?1:-1;M.current!==F&&(M.current=F,ne(F)),k.current=te,W(te),h.preventDefault();return}z.current==="vertical"&&(G.current=!0,he(!0),B.current=v,O(v),h.preventDefault())},Le=()=>{if(!L.current)return;const h=z.current,R=G.current;if(R&&h==="horizontal")ee(_.current),I();else if(R&&h==="vertical")if(B.current>gi){const v=window.innerHeight;B.current=v,Ke(!0),O(v),be("closing")}else B.current=0,O(0),I();else h==="horizontal"&&Math.abs(_.current)>0&&(ee(_.current),I());L.current=null,z.current="none",_.current=0,G.current=!1,he(!1)};return document.addEventListener("touchstart",se,{passive:!0}),document.addEventListener("touchmove",He,{passive:!1}),document.addEventListener("touchend",Le),document.addEventListener("touchcancel",Le),()=>{document.removeEventListener("touchstart",se),document.removeEventListener("touchmove",He),document.removeEventListener("touchend",Le),document.removeEventListener("touchcancel",Le),u()}},[w,i.length,pe]),r.useEffect(()=>{const l=u=>{u.key==="Escape"&&(u.preventDefault(),u.stopPropagation(),w!=="closing"&&be("closing"))};return window.addEventListener("keydown",l,!0),()=>window.removeEventListener("keydown",l,!0)},[w]);const ke=()=>{w!=="closing"&&be("closing")},ye=w==="open",We=w==="closing",pt=P>0?Math.max(0,1-P/500):1,ft=P>0?Math.max(.35,1-P/500):1,$t=Qe&&d?{width:H.getEmbedAspect(d),height:1}:mt,g=m?we?m:ji(m,$t):null,et={position:"fixed",top:c==null?void 0:c.top,left:c==null?void 0:c.left,width:c==null?void 0:c.width,height:c==null?void 0:c.height,zIndex:9998},Y=we?"cover":"contain",yt=me!==0||P>0?`translate(${me}px, ${P}px)`:void 0,Te=Se&&!Me?"none":Me?`transform ${D}ms ${le}`:ut?`transform ${D}ms ${le}, opacity ${D}ms ${le}`:w==="opening"||We?`opacity ${D}ms ${le}`:"none",Ee={...et,transform:yt,opacity:P>0?ft:w==="opening"||We?0:1,transition:Te,pointerEvents:"none"},De={position:"absolute",top:((g==null?void 0:g.top)??0)-((c==null?void 0:c.top)??0),left:((g==null?void 0:g.left)??0)-((c==null?void 0:c.left)??0),width:g==null?void 0:g.width,height:g==null?void 0:g.height,objectFit:Y,pointerEvents:"none"},tt=(c==null?void 0:c.width)??0,re=je?(n+Ae+i.length)%i.length:null,T=re!==null?i[re]:null,kt={...et,transform:je?`translateX(${Ae*tt+me}px)`:void 0,opacity:1,transition:Me?`transform ${D}ms ${le}`:"none",pointerEvents:"none"},it={position:"absolute",top:((m==null?void 0:m.top)??0)-((c==null?void 0:c.top)??0),left:((m==null?void 0:m.left)??0)-((c==null?void 0:c.left)??0),width:m==null?void 0:m.width,height:m==null?void 0:m.height,objectFit:Y,pointerEvents:"none"},xt=Qe&&d&&H.getEmbedPlayback(d).controls&&g?Math.min(52,g.height*.2):0,E=g?{position:"fixed",top:g.top,height:g.height-xt,width:g.width/2,zIndex:9999}:null;return t.jsxs("div",{ref:Re,className:[`${e}-lightbox`,o?`${e}-lightbox-editor`:""].filter(Boolean).join(" "),style:{touchAction:w==="open"?"none":void 0},onClick:ke,children:[t.jsx("div",{style:{position:"absolute",inset:0,background:"rgba(28,31,34,0.9)",opacity:ye?pt:0,transition:Se?"none":`opacity ${D}ms ${le}`,pointerEvents:"none"}}),t.jsx("div",{style:{position:"relative",width:"100%",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:we?t.jsxs(t.Fragment,{children:[t.jsx("div",{ref:de,style:{position:"absolute",inset:0}}),t.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",height:"10%",opacity:ye?1:0,transition:`opacity ${D}ms ${le}`,pointerEvents:"none",zIndex:9999},children:i.length>1&&t.jsxs("p",{className:V,style:Z,children:[n+1," / ",i.length]})})]}):t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{height:"10%"}}),t.jsx("div",{style:{width:"70%",height:"80%",display:"flex",justifyContent:"center",alignItems:"center"},children:t.jsx("div",{ref:de,style:{width:"100%",height:"100%"}})}),t.jsx("div",{style:{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",height:"10%",opacity:ye?1:0,transition:`opacity ${D}ms ${le}`},children:i.length>1&&t.jsxs("p",{className:V,style:Z,children:[n+1," / ",i.length]})})]})}),m&&c&&T&&t.jsx("div",{style:kt,onTransitionEnd:Ie,children:H.isEmbedMedia(T)?t.jsx("img",{src:T.thumbnail,alt:T.name,style:it},`neighbor-${re}-${T.assetId}`):xe(T)?t.jsx("video",{src:T.assetId,muted:!0,autoPlay:!0,loop:!0,playsInline:!0,preload:"auto",style:it},`neighbor-${re}-${T.assetId}`):t.jsx("img",{src:T.assetId,alt:T.name,style:it},`neighbor-${re}-${T.assetId}`)}),m&&c&&d&&t.jsx("div",{style:Ee,onTransitionEnd:Ie,children:Qe?t.jsx(H.EmbedMediaFrame,{media:d,fit:we?"cover":"contain",lazy:!1,startsAtOnce:!0,style:De},`${n}-${d.assetId}`):gt?t.jsx(Ci,{src:d.assetId,mediaRef:ue,mediaStyle:De,onLoadedMetadata:Pe},`${n}-${d.assetId}`):t.jsx("img",{ref:ue,src:d.assetId,alt:d.name,onLoad:Pe,style:De},`${n}-${d.assetId}`)}),ye&&E&&i.length>1&&t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{...E,left:g.left,cursor:"w-resize",pointerEvents:Se?"none":"auto"},onClick:l=>{if(Q.current){Q.current=!1;return}l.stopPropagation(),fe(-1)}}),t.jsx("div",{style:{...E,left:g.left+g.width/2,cursor:"e-resize",pointerEvents:Se?"none":"auto"},onClick:l=>{if(Q.current){Q.current=!1;return}l.stopPropagation(),fe(1)}})]}),t.jsx(Ti,{prefix:e,closeIcon:J,closeIconMaxWidth:ce,closeIconColor:ve,closeIconHoverColor:S,iconMarginRight:j,contentMarginTop:Xe,isEditor:o,isPreviewMode:x,isEditMode:y,visible:ye,onClose:ke})]})}function _i(e){return typeof e=="string"?e==="cover"?"cover":"fit":(e==null?void 0:e.display)==="cover"?"cover":"fit"}function zi({settings:e,content:i,isEditor:n,isPreviewMode:a,isEditMode:o,metadata:x,activeEvent:y,layoutId:q,portalId:ae}){const{prefix:s}=ni.useScopedStyles(),{type:V="a",gridLayout:Z,textBoxWidth:J=100,verticalGap:ce,entriesCount:ve,lightbox:S,imageDisplay:j,imageCorners:Xe,lightboxImageDisplay:we,slider:Re,sliderTiming:de,direction:ue,transition:L,titleMarginTop:B,subtitleMarginTop:_,titleColor:z,subtitleColor:G,lightboxCounterColor:Q,titleFontFamily:Ue,titleFontSettings:k,titleFontSize:M,titleLineHeight:N,titleLetterSpacing:ie,titleWordSpacing:X,titleTextAppearance:Fe,subtitleFontFamily:Ye,subtitleFontSettings:m,subtitleFontSize:Ve,subtitleLineHeight:c,subtitleLetterSpacing:dt,subtitleWordSpacing:w,subtitleTextAppearance:be,lightboxCounterFontFamily:P,lightboxCounterFontSettings:O,lightboxCounterFontSize:me,lightboxCounterLineHeight:W,lightboxCounterLetterSpacing:Ae,lightboxCounterWordSpacing:ne,lightboxCounterTextAppearance:Me,closeIcon:ge,closeIconMaxWidth:Se,closeIconColor:he,closeIconHoverColor:ut,iconMarginRight:Ke,contentMarginTop:mt,showText:Ze="always",hover:Oe="none",alignEntries:Je="off",align:d="top"}=e,gt={fontSettings:{fontFamily:Ue,fontWeight:(k==null?void 0:k.fontWeight)??400,fontStyle:(k==null?void 0:k.fontStyle)??"normal"},fontSize:M??.01,lineHeight:N,letterSpacing:ie??0,wordSpacing:X??0,textAppearance:Fe,color:z},je={...Ne.omitTextColors(Ne.textStylesToCss(gt,n))},Pe={fontSettings:{fontFamily:Ye,fontWeight:(m==null?void 0:m.fontWeight)??400,fontStyle:(m==null?void 0:m.fontStyle)??"normal"},fontSize:Ve??.01,lineHeight:c,letterSpacing:dt??0,wordSpacing:w??0,textAppearance:be,color:G},U={...Ne.omitTextColors(Ne.textStylesToCss(Pe,n))},Ce={fontSettings:{fontFamily:P,fontWeight:(O==null?void 0:O.fontWeight)??400,fontStyle:(O==null?void 0:O.fontStyle)??"normal"},fontSize:me??.01,lineHeight:W,letterSpacing:Ae??0,wordSpacing:ne??0,textAppearance:Me,color:Q},pe={...Ne.omitTextColors(Ne.textStylesToCss(Ce,n)),...jt(me,W,s,n)},fe=St(M,N,`${s}-item-title`,`${s}-text-tight-leading`),Ie=St(Ve,c,`${s}-item-subtitle`,`${s}-text-tight-leading`),$e=jt(M,N,s,n),ke=jt(Ve,c,s,n),ye=St(me,W,`${s}-lightbox-counter`,`${s}-text-tight-leading`),We=ii.buildColorVars(s,{titleColor:z,subtitleColor:G,lightboxCounterColor:Q},Ni,Ri),pt=y&&y!=="default"?`${s}-state-${y}`:"",ft=Ze==="on hover"&&(!n||a),$t=Oe!=="none"&&(!n||a)?` ${s}-hover-${Oe}`:"",g=`${pt}${ft?` ${s}-show-text-hover`:""}${$t}`.trim(),et=ve===0?1/0:ve,Y=(i??[]).slice(0,et),yt=r.useMemo(()=>S==="on"?yi(Y):[],[Y,S]),Te=Z.entryWidth??.2,Ee=(j==null?void 0:j.display)==="cover",De=(j==null?void 0:j.ratioValue)??"1:1",tt=(j==null?void 0:j.reversed)??!1,[re,T]=De.split(":").map(Number),xt=`${tt?T:re} / ${tt?re:T}`,E=Z.columnsCount,l=f.scalingValue(Te??0,n),u=l,I=!Ee&&Re!=="off",ee=Y.length%E||E,se=ee<E&&Y.length>0,He=Y.length-ee,Le=se?Math.floor((E-ee)/2)+1:1,h=Xe?f.scalingValue(Xe,n):void 0,R={width:u,...Ee?{aspectRatio:xt,height:"auto",overflow:"hidden"}:{height:"auto"},...h?{borderRadius:h,overflow:"hidden"}:{}},te=`${s}-item-image-wrapper${I?` ${s}-item-image-wrapper-fit-slider`:""}`.trim(),v=V==="d"||V==="e"||V==="f",F=Je==="on",_e=`calc(${f.scalingValue(Te??0,n)} * (${J} / 100))`,oe=f.scalingValue(Te*J/100,n),Tt=h?{borderRadius:h,[qt]:h}:{},Lt=Ee?{objectFit:"cover",pointerEvents:"auto",width:"100%",height:"100%",maxWidth:"100%",...Tt}:{objectFit:"contain",pointerEvents:"auto",width:"auto",height:"auto",maxWidth:"100%",...Tt},[Gt,Xt]=r.useState(0),nt=r.useRef(null),Ut=L==="fade"||ue==="horizontal"?"ltr":ue==="vertical"?"ttb":"ltr";r.useEffect(()=>{const p=nt.current;if(!p)return;const b=new ResizeObserver(A=>{Xt(Math.round(A[0].contentRect.width))});return b.observe(p),()=>b.disconnect()},[]);const Yt=(()=>{const p={...We},b=nt.current?getComputedStyle(nt.current).getPropertyValue("--cntrl-article-width").trim():"";return b&&(p["--cntrl-article-width"]=b),p})(),[vt,wt]=r.useState(!1),[rt,Kt]=r.useState([]),[Zt,bt]=r.useState(0),_t=S==="on"&&(!n||a),zt=(p,b)=>{n&&!a||S!=="off"&&(Kt(p),bt(b),wt(!0))};r.useEffect(()=>{if(!vt||S!=="on"||typeof document>"u")return;const p=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=p}},[vt,S]),r.useEffect(()=>{!n||a||wt(!1)},[n,a]);const Jt=r.useMemo(()=>ai(s),[s]);return t.jsxs(t.Fragment,{children:[t.jsx("style",{dangerouslySetInnerHTML:{__html:Jt}}),S==="on"&&t.jsx(xi,{mediaList:yt}),t.jsx("div",{style:We,children:t.jsx("div",{ref:nt,className:`${s}-wrapper ${s}-type-${V}${F?` ${s}-align-entries`:""} ${s}-image-align-${d} ${g}`.trim(),style:{gridTemplateColumns:`repeat(${E}, ${l})`,rowGap:F?0:f.scalingValue(ce??0,n),columnGap:f.scalingValue(Z.horizontalGap??0,n),width:f.scalingValue(Z.wrapperWidth??0,n),...F?{[`--${s}-align-entries-row-gap`]:f.scalingValue(ce??0,n)}:{}},children:Y.map((p,b)=>{var At;const A=Ot(p.title),K=Ot(p.subtitle),ze=S==="off"&&((At=p.link)!=null&&At.value)?p.link:void 0,Qt=Math.floor(b/E)===Math.ceil(Y.length/E)-1,st=se&&b>=He?`${Le+(b-He)}`:void 0,Nt=v?t.jsxs("div",{className:`${s}-item-text-block`,children:[A&&t.jsx("p",{className:fe,style:{width:_e,...je,...$e},children:p.title}),A&&t.jsx("div",{"data-controls":o?"titleMarginTop":void 0,className:o?`${s}-control`:void 0,style:{height:f.scalingValue(B??0,n),width:oe}}),K&&t.jsx("p",{className:Ie,style:{width:_e,...U,...ke},children:p.subtitle}),K&&t.jsx("div",{"data-controls":o?"subtitleMarginTop":void 0,className:o?`${s}-control`:void 0,style:{height:f.scalingValue(_??0,n),width:oe}})]}):null,Pt=F?t.jsxs("div",{className:`${s}-item-title-row`,children:[!v&&t.jsx("div",{"data-controls":o&&A?"titleMarginTop":void 0,className:o&&A?`${s}-control`:void 0,style:{height:A?f.scalingValue(B??0,n):0,width:oe}}),A&&t.jsx("p",{className:fe,style:{width:_e,...je,...$e},children:p.title}),v&&A&&t.jsx("div",{"data-controls":o?"titleMarginTop":void 0,className:o?`${s}-control`:void 0,style:{height:f.scalingValue(B??0,n),width:oe}})]}):null,ei=F?t.jsxs("div",{className:`${s}-item-subtitle-row`,children:[!v&&t.jsx("div",{"data-controls":o&&K?"subtitleMarginTop":void 0,className:o&&K?`${s}-control`:void 0,style:{height:K?f.scalingValue(_??0,n):0,width:oe}}),K&&t.jsx("p",{className:Ie,style:{width:_e,...U,...ke},children:p.subtitle}),v&&K&&t.jsx("div",{"data-controls":o?"subtitleMarginTop":void 0,className:o?`${s}-control`:void 0,style:{height:f.scalingValue(_??0,n),width:oe}})]}):null,Rt=t.jsxs(ct.LinkWrapper,{link:ze,className:`${s}-item-text-link`,children:[Pt,ei]}),qe=Bt(p.gallery),ot=qe.filter($=>$.lightboxMedia).map($=>$.lightboxMedia),lt=t.jsx(Si,{className:te,style:R,children:qe.length===0?null:Re==="off"?(()=>{const{displayMedia:$,lightboxMedia:Be}=qe[0],Ge=Be?ot.findIndex(at=>at.assetId===Be.assetId):-1;return t.jsx(Wt,{media:$,className:`${s}-item-${xe($)?"video":"image"}`.trim(),style:Lt,hasLightbox:S==="on",onMediaClick:_t&&Ge>=0?()=>zt(ot,Ge):void 0})})():t.jsxs(t.Fragment,{children:[I&&t.jsx("div",{className:`${s}-item-image-wrapper-sizer`,"aria-hidden":"true",children:qe.map(({displayMedia:$})=>H.isEmbedMedia($)?t.jsx("div",{style:{aspectRatio:`${H.getEmbedAspect($)}`}},`sizer-${$.assetId}`):xe($)?t.jsx(Ht.LazyVideo,{src:$.assetId,nearPreload:"metadata",muted:!0,playsInline:!0},`sizer-${$.assetId}`):t.jsx("img",{src:$.assetId,alt:""},`sizer-${$.assetId}`))}),t.jsx(Mt.Splide2,{className:`${s}-item-slider`,options:{arrows:!1,pagination:!1,drag:!1,perPage:1,autoplay:!0,interval:de*1e3,width:"100%",height:"100%",speed:mi,type:L==="fade"?"fade":"loop",rewind:L==="fade",pauseOnHover:!1,pauseOnFocus:!1,direction:Ut},onMoved:$=>{ue!=="random"||L==="fade"||ui($)},children:qe.map(({displayMedia:$,lightboxMedia:Be},Ge)=>{const at=Be?ot.findIndex(ti=>ti.assetId===Be.assetId):-1;return t.jsx(Mt.SplideSlide,{"data-slide-index":Ge,children:t.jsx(Wt,{media:$,className:`${s}-item-${xe($)?"video":"image"}`.trim(),style:Lt,hasLightbox:S==="on",isSplideSlide:!0,onMediaClick:_t&&at>=0?()=>zt(ot,at):void 0})},Ge)})},`${L}-${Te}-${ue}-${de}-${Gt}-${q}`)]})}),Ft=v?null:t.jsxs(t.Fragment,{children:[t.jsx("div",{"data-controls":o&&A?"titleMarginTop":void 0,className:o&&A?`${s}-control`:void 0,style:{height:A?f.scalingValue(B??0,n):0,width:oe}}),t.jsx("p",{className:fe,style:{width:_e,...je,...$e},children:p.title}),t.jsx("div",{"data-controls":o&&K?"subtitleMarginTop":void 0,className:o&&K?`${s}-control`:void 0,style:{height:K?f.scalingValue(_??0,n):0,width:oe}}),t.jsx("p",{className:Ie,style:{width:_e,...U,...ke},children:p.subtitle})]}),Vt=ze?t.jsx(ct.LinkWrapper,{link:ze,className:`${s}-item-image-link`,children:lt}):t.jsx("a",{className:`${s}-item-image-link`,children:lt});return t.jsx("div",{className:`${s}-item`.trim(),style:st&&!F?{gridColumn:st}:void 0,children:t.jsx("div",{className:`${o?`${s}-item-inner`:`${s}-item-inner-hidden`}${F&&Qt?` ${s}-item-inner-last-row`:""}`.trim(),style:{width:(J??0)>100?`calc(${l} * (${J} / 100))`:l,...st&&F?{gridColumn:st}:{}},children:F?t.jsx(t.Fragment,{children:v?t.jsxs(t.Fragment,{children:[Rt,Vt]}):t.jsxs(t.Fragment,{children:[Vt,Rt]})}):ze?t.jsxs(t.Fragment,{children:[t.jsxs(ct.LinkWrapper,{link:ze,className:`${s}-item-image-link`,children:[Nt,lt]}),!v&&t.jsx(ct.LinkWrapper,{link:ze,className:`${s}-item-text-link`,children:Ft})]}):t.jsxs(t.Fragment,{children:[Nt,lt,Ft]})})},b)})})}),(!n||a)&&vt&&typeof document<"u"&&S==="on"&&(()=>{const p=(ae?document.getElementById(ae):null)??document.body;return ri.createPortal(t.jsx("div",{style:Yt,"data-selection":"none",children:t.jsx(Li,{prefix:s,items:rt,index:Zt,imageDisplay:_i(we),isEditor:n,isPreviewMode:a,isEditMode:o,closeIcon:ge,closeIconMaxWidth:Se,closeIconColor:he,closeIconHoverColor:ut,iconMarginRight:Ke,contentMarginTop:mt,onClose:()=>wt(!1),onPrev:()=>bt(b=>(b-1+rt.length)%rt.length),onNext:()=>bt(b=>(b+1)%rt.length),counterClassName:ye,counterStyle:pe})}),p)})()]})}const Ni={titleColor:"title-color",subtitleColor:"subtitle-color",lightboxCounterColor:"lightbox-counter-color"},Ri=["hover","focus","filled","success","error"];exports.Grid=zi;