@cntrl-site/components 1.0.116 → 1.0.118-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.
Files changed (62) hide show
  1. package/dist/{Burger-C3yVbQcq.js → Burger-B4kXX9aY.js} +1 -1
  2. package/dist/{Burger-BkVgNMGU.mjs → Burger-DyORh_vF.mjs} +1 -1
  3. package/dist/{ChroniclesComponent-0ZWBPdbh.mjs → ChroniclesComponent-DVoJ0kdT.mjs} +12 -12
  4. package/dist/{ChroniclesComponent-D4_6w8f7.js → ChroniclesComponent-Nm_yIRmr.js} +1 -1
  5. package/dist/Components/PopupMenu/PopupMenu.d.ts +73 -0
  6. package/dist/Components/PopupMenu/PopupMenuComponent.d.ts +594 -0
  7. package/dist/Components/PopupMenu/popupMenuLayout.d.ts +203 -0
  8. package/dist/Components/PopupMenu/popupMenuSnap.d.ts +61 -0
  9. package/dist/Components/helpers/SvgImage/loadSvgMaskUrl.d.ts +7 -0
  10. package/dist/{ControlSlider-DqKfaKMG.mjs → ControlSlider-3w-bHQEg.mjs} +1 -1
  11. package/dist/{ControlSlider-C8ckUIDm.js → ControlSlider-DB4nbVLT.js} +1 -1
  12. package/dist/{FAQ-DLh63Utr.js → FAQ-7HEkaoU6.js} +1 -1
  13. package/dist/{FAQ-CJHCMSBa.mjs → FAQ-GmiwRdFq.mjs} +1 -1
  14. package/dist/{Grid-t07NDMzY.mjs → Grid-BuRdth9A.mjs} +201 -196
  15. package/dist/{Grid-OvzWvUW9.js → Grid-tqSSYh2-.js} +14 -9
  16. package/dist/{Hive-CzabuuCc.js → Hive-34KvKNsa.js} +1 -1
  17. package/dist/{Hive-DyxYd5eg.mjs → Hive-7xHXyMM1.mjs} +1 -1
  18. package/dist/{HiveLightboxTitles-DhEeFKWs.mjs → HiveLightboxTitles-BCoL46-V.mjs} +1 -1
  19. package/dist/{HiveLightboxTitles-DlyptAaK.js → HiveLightboxTitles-DEeyQGcf.js} +1 -1
  20. package/dist/{Lightbox-DZckgBzK.js → Lightbox-Cb7lyaNt.js} +1 -1
  21. package/dist/{Lightbox-BY99NS14.mjs → Lightbox-DzPqgKP4.mjs} +1 -1
  22. package/dist/{LightboxJournal-Bmw2zm4t.js → LightboxJournal-B-vul_be.js} +14 -8
  23. package/dist/{LightboxJournal-gePVKQJ4.mjs → LightboxJournal-DisD2DLv.mjs} +340 -334
  24. package/dist/{LightboxStrip-CTxRwLYk.js → LightboxStrip-YDyEPEb6.js} +14 -8
  25. package/dist/{LightboxStrip-BPQiQhd3.mjs → LightboxStrip-wCHUhAqN.mjs} +258 -252
  26. package/dist/{Mercury-B-s2Kvuq.js → Mercury-BmhtFYOw.js} +1 -1
  27. package/dist/{Mercury-CCW0Es-s.mjs → Mercury-Q788wrYQ.mjs} +1 -1
  28. package/dist/{OnelinerForm-C2Y_XMCY.js → OnelinerForm-CUmY-bXL.js} +1 -1
  29. package/dist/{OnelinerForm-BEu7_sho.mjs → OnelinerForm-D8WIB9Qy.mjs} +1 -1
  30. package/dist/PopupMenu-CYdDyzEt.mjs +1372 -0
  31. package/dist/PopupMenu-Di1fHgho.js +409 -0
  32. package/dist/{SimpleButton-C-o2W9bS.mjs → SimpleButton-DTpzfmb6.mjs} +1 -1
  33. package/dist/{SimpleButton-nGEcO2gB.js → SimpleButton-DtaCYa3y.js} +1 -1
  34. package/dist/{Slider20-DUi6qwnd.mjs → Slider20-CKngROrc.mjs} +1 -1
  35. package/dist/{Slider20-BOmjDRf2.js → Slider20-q0iGgnE3.js} +1 -1
  36. package/dist/SvgImage-CwRq9-ec.mjs +56 -0
  37. package/dist/SvgImage-_QN8ngad.js +1 -0
  38. package/dist/{TestimonialSingle-DrnyReim.mjs → TestimonialSingle-Bax71Hyo.mjs} +1 -1
  39. package/dist/{TestimonialSingle-BORQom3u.js → TestimonialSingle-CpEUendN.js} +1 -1
  40. package/dist/{Waterfall-DII4-WV5.js → Waterfall-B9YWMhrg.js} +1 -1
  41. package/dist/{Waterfall-3kKioKh2.mjs → Waterfall-znaoynn5.mjs} +1 -1
  42. package/dist/components-BYoTPJk3.js +1 -0
  43. package/dist/{components-BQjon_-7.mjs → components-eK82xypT.mjs} +653 -29
  44. package/dist/elements.js +1 -1
  45. package/dist/elements.mjs +23 -22
  46. package/dist/elements.node.js +1 -1
  47. package/dist/elements.node.mjs +1 -1
  48. package/dist/index.d.ts +3 -1
  49. package/dist/index.js +1 -1
  50. package/dist/index.mjs +63 -36
  51. package/dist/loadSvgMaskUrl-B6kHUyof.js +1 -0
  52. package/dist/loadSvgMaskUrl-DUhCVvpl.mjs +39 -0
  53. package/dist/sources.js +30 -16
  54. package/dist/sources.mjs +30 -16
  55. package/dist/types/Component.d.ts +7 -0
  56. package/dist/types/SchemaV1.d.ts +3 -0
  57. package/package.json +1 -1
  58. package/dist/SvgImage-B5mR9y6q.mjs +0 -51
  59. package/dist/SvgImage-DFlmxAoL.js +0 -1
  60. package/dist/components-B8MjlzLL.js +0 -1
  61. package/dist/loadSvgMaskUrl-DfF7ay6h.js +0 -1
  62. package/dist/loadSvgMaskUrl-xHgGYgPe.mjs +0 -20
@@ -1,9 +1,9 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),Wt=require("./react-splide.esm-CabaEmHi.js");;/* empty css */const f=require("./scalingValue-CSHYgTZl.js"),ni=require("./buildColorVars-CE2D5cQV.js"),ri=require("./useScopedStyles-Bf6yohVQ.js"),qt=require("./useLazyVideos-CdCbc2j0.js"),ct=require("./LinkWrapper-CTqM1ucO.js"),H=require("./EmbedMediaFrame-DsOTKE4i.js"),r=require("react"),si=require("react-dom"),Re=require("./textStylesToCss-CNN3zZTV.js"),oi=require("./SvgImage-DFlmxAoL.js"),Bt=require("./LazyVideo-imbU18js.js");function li(e){return`calc(var(--cntrl-article-width, 100vw) * ${e/1440})`}function Et(e){return((e==null?void 0:e.trim().length)??0)>0}function Ct(e,i,n,a){return i!==void 0&&i<(e??.01)?`${n} ${a}`:n}function It(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 dt=400,ut="cubic-bezier(0.25, 0.1, 0.25, 1)",kt=1.1,ai=`${((1-1/kt)/2*100).toFixed(4)}%`,Tt="--grid-media-radius";function ci(e){return`
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-_QN8ngad.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
2
  .${e}-wrapper {
3
3
  display: grid;
4
4
  align-items: start;
5
5
  justify-content: center;
6
- min-height: ${li(48)};
6
+ min-height: ${oi(48)};
7
7
  }
8
8
  .${e}-item {
9
9
  display: flex;
@@ -140,22 +140,27 @@
140
140
  .${e}-show-text-hover .${e}-item-inner-hidden:hover .${e}-item-subtitle {
141
141
  opacity: 1;
142
142
  }
143
+ @property --${e}-hover-zoom {
144
+ syntax: '<number>';
145
+ inherits: false;
146
+ initial-value: 1;
147
+ }
143
148
  .${e}-hover-zoom-in .${e}-item-image,
144
149
  .${e}-hover-zoom-in .${e}-item-video {
145
- clip-path: inset(0 round var(${Tt}, 0px));
146
- transition: transform ${dt}ms ${ut}, clip-path ${dt}ms ${ut};
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};
147
153
  }
148
154
  .${e}-hover-scale-down .${e}-item-image,
149
155
  .${e}-hover-scale-down .${e}-item-video {
150
- transition: transform ${dt}ms ${ut};
156
+ transition: transform ${Ct}ms ${It};
151
157
  }
152
158
  .${e}-hover-greyscale .${e}-item-image-wrapper {
153
- transition: filter ${dt}ms ${ut};
159
+ transition: filter ${Ct}ms ${It};
154
160
  }
155
161
  @media (hover: hover) {
156
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) {
157
- transform: scale(${kt});
158
- clip-path: inset(${ai} round calc(var(${Tt}, 0px) / ${kt}));
163
+ --${e}-hover-zoom: ${li};
159
164
  }
160
165
  .${e}-hover-scale-down .${e}-item-image-wrapper:hover .${e}-item-image,
161
166
  .${e}-hover-scale-down .${e}-item-image-wrapper:hover .${e}-item-video {
@@ -400,4 +405,4 @@
400
405
  left: 50%;
401
406
  transform: translate(-50%, -50%);
402
407
  }
403
- `}function di(){return Math.random()<.5?"ltr":"ttb"}function ui(e){const i=e.Components.Autoplay;i&&(i.pause(!1),i.play())}function mi(e){const i=di();e.options.direction!==i&&(e.options={...e.options,direction:i}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{ui(e)})})}const D=500,gi=750,le="cubic-bezier(0.22, 1, 0.36, 1)",hi=72,pi=50;function fi(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 $i(e){const[i,n]=e.media;return n!=null&&n.assetId?n:i!=null&&i.assetId?i:null}function yi(e){const[i]=e.media;return i!=null&&i.assetId?i:null}function Gt(e){return!Array.isArray(e)||e.length===0?[]:fi(e)?e.flatMap(i=>{const n=$i(i);if(!n)return[];const a=yi(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 xi(e){const i=new Set,n=[];for(const a of e){const o=Gt(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 vi({mediaList:e}){const[i,n]=r.useState(null);qt.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 wi(e){e.pause(),e.removeAttribute("src"),e.load()}const bi=".splide__slide video";function Si(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 Dt({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(Bt.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 ji({className:e,style:i,children:n}){const[a,o]=r.useState(null);return qt.useLazyVideos(a,{autoPlay:!0,selector:bi,shouldPlay:Si}),t.jsx("div",{ref:o,className:e,style:i,children:n})}function Ht(e){const i=e.getBoundingClientRect();return{width:i.width,height:i.height,left:i.left,top:i.top}}function Ci(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 Ii({src:e,mediaRef:i,mediaStyle:n,onLoadedMetadata:a}){return r.useEffect(()=>{const o=i.current;if(o)return()=>{wi(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 ki="https://cdn.cntrl.site/component-assets/defaultCloseIcon.svg",Ti=.004;function Li({prefix:e,closeIcon:i=ki,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,Ti),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(oi.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 _i({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",ze=r.useRef(null),de=r.useRef(null),ue=r.useRef(null),L=r.useRef(null),B=r.useRef(0),_=r.useRef(0),N=r.useRef("none"),G=r.useRef(!1),Q=r.useRef(!1),Ue=r.useRef(null),k=r.useRef(0),M=r.useRef(null),R=r.useRef(!1),ie=r.useRef(null),X=r.useRef(null),Fe=r.useRef(null),Ye=r.useRef(()=>{}),[m,Ve]=r.useState(null),[c,mt]=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),[gt,Ke]=r.useState(!1),[ht,Ze]=r.useState(null),Oe=r.useRef(n),Je=r.useRef(void 0),d=i[n],pt=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=ze.current;if(!l)return;const u=()=>mt(Ht(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,R.current=!1,ne(null),ge(!1),W(0),k.current=0,he(!1),G.current=!1,_.current=0,N.current="none",l===1?s():l===-1&&ae()},[C,s,ae]),Ce=r.useCallback(()=>{C(),X.current=null,M.current=null,R.current=!1,ne(null),ge(!1),W(0),k.current=0},[C]),ft=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),R.current=!0,ge(!0),u){X.current=l;const se=-l*I;k.current=se,W(se),ft();return}k.current=0,W(0),ie.current=window.setTimeout(()=>{ie.current=null,Ce()},D+32)},[C,Ce,ft]),fe=r.useCallback(l=>{if(!(i.length<=1)){if(R.current){if(X.current===l){Fe.current=l,U();return}Ce()}C(),M.current=l,ne(l),R.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"||!R.current||X.current!==null&&U()},[U]),$e=r.useCallback(()=>{const l=de.current;if(!l)return;const u=Ht(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,N.current="none",G.current=!1,R.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 z=h<0?1:-1;if(Math.abs(h)>pi&&i.length>1){pe(z,!0);return}pe(z,!1)},se=h=>{if(h.touches.length!==1||R.current)return;const z=h.touches[0];Q.current=!0,L.current={x:z.clientX,y:z.clientY},N.current="none",_.current=0,G.current=!1},He=h=>{if(!L.current||h.touches.length!==1||R.current)return;const z=h.touches[0],te=z.clientX-L.current.x,v=z.clientY-L.current.y;if(N.current==="none"){if(Math.abs(te)<10&&Math.abs(v)<10)return;if(Math.abs(te)>Math.abs(v)){if(i.length<=1)return;N.current="horizontal"}else if(v>0)N.current="vertical";else return}if(N.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}N.current==="vertical"&&(G.current=!0,he(!0),B.current=v,O(v),h.preventDefault())},Le=()=>{if(!L.current)return;const h=N.current,z=G.current;if(z&&h==="horizontal")ee(_.current),I();else if(z&&h==="vertical")if(B.current>hi){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,N.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",$t=P>0?Math.max(0,1-P/500):1,yt=P>0?Math.max(.35,1-P/500):1,xt=Qe&&d?{width:H.getEmbedAspect(d),height:1}:ht,g=m?we?m:Ci(m,xt):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",vt=me!==0||P>0?`translate(${me}px, ${P}px)`:void 0,Te=Se&&!Me?"none":Me?`transform ${D}ms ${le}`:gt?`transform ${D}ms ${le}, opacity ${D}ms ${le}`:w==="opening"||We?`opacity ${D}ms ${le}`:"none",Ee={...et,transform:vt,opacity:P>0?yt: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,Lt={...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"},wt=Qe&&d&&H.getEmbedPlayback(d).controls&&g?Math.min(52,g.height*.2):0,E=g?{position:"fixed",top:g.top,height:g.height-wt,width:g.width/2,zIndex:9999}:null;return t.jsxs("div",{ref:ze,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?$t: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:Lt,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}`):pt?t.jsx(Ii,{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(Li,{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 Ni(e){return typeof e=="string"?e==="cover"?"cover":"fit":(e==null?void 0:e.display)==="cover"?"cover":"fit"}function Ri({settings:e,content:i,isEditor:n,isPreviewMode:a,isEditMode:o,metadata:x,activeEvent:y,layoutId:q,portalId:ae}){const{prefix:s}=ri.useScopedStyles(),{type:V="a",gridLayout:Z,textBoxWidth:J=100,verticalGap:ce,entriesCount:ve,lightbox:S,imageDisplay:j,imageCorners:Xe,lightboxImageDisplay:we,slider:ze,sliderTiming:de,direction:ue,transition:L,titleMarginTop:B,subtitleMarginTop:_,titleColor:N,subtitleColor:G,lightboxCounterColor:Q,titleFontFamily:Ue,titleFontSettings:k,titleFontSize:M,titleLineHeight:R,titleLetterSpacing:ie,titleWordSpacing:X,titleTextAppearance:Fe,subtitleFontFamily:Ye,subtitleFontSettings:m,subtitleFontSize:Ve,subtitleLineHeight:c,subtitleLetterSpacing:mt,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:gt,iconMarginRight:Ke,contentMarginTop:ht,showText:Ze="always",hover:Oe="none",alignEntries:Je="off",align:d="top"}=e,pt={fontSettings:{fontFamily:Ue,fontWeight:(k==null?void 0:k.fontWeight)??400,fontStyle:(k==null?void 0:k.fontStyle)??"normal"},fontSize:M??.01,lineHeight:R,letterSpacing:ie??0,wordSpacing:X??0,textAppearance:Fe,color:N},je={...Re.omitTextColors(Re.textStylesToCss(pt,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:mt??0,wordSpacing:w??0,textAppearance:be,color:G},U={...Re.omitTextColors(Re.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={...Re.omitTextColors(Re.textStylesToCss(Ce,n)),...It(me,W,s,n)},fe=Ct(M,R,`${s}-item-title`,`${s}-text-tight-leading`),Ie=Ct(Ve,c,`${s}-item-subtitle`,`${s}-text-tight-leading`),$e=It(M,R,s,n),ke=It(Ve,c,s,n),ye=Ct(me,W,`${s}-lightbox-counter`,`${s}-text-tight-leading`),We=ni.buildColorVars(s,{titleColor:N,subtitleColor:G,lightboxCounterColor:Q},zi,Fi),$t=y&&y!=="default"?`${s}-state-${y}`:"",yt=Ze==="on hover"&&(!n||a),xt=Oe!=="none"&&(!n||a)?` ${s}-hover-${Oe}`:"",g=`${$t}${yt?` ${s}-show-text-hover`:""}${xt}`.trim(),et=ve===0?1/0:ve,Y=(i??[]).slice(0,et),vt=r.useMemo(()=>S==="on"?xi(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),wt=`${tt?T:re} / ${tt?re:T}`,E=Z.columnsCount,l=f.scalingValue(Te??0,n),u=l,I=!Ee&&ze!=="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,z={width:u,...Ee?{aspectRatio:wt,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),_t=h?{borderRadius:h,[Tt]:h}:{},Nt=Ee?{objectFit:"cover",pointerEvents:"auto",width:"100%",height:"100%",maxWidth:"100%",..._t}:{objectFit:"contain",pointerEvents:"auto",width:"auto",height:"auto",maxWidth:"100%",..._t},[Xt,Ut]=r.useState(0),nt=r.useRef(null),Yt=L==="fade"||ue==="horizontal"?"ltr":ue==="vertical"?"ttb":"ltr";r.useEffect(()=>{const p=nt.current;if(!p)return;const b=new ResizeObserver(A=>{Ut(Math.round(A[0].contentRect.width))});return b.observe(p),()=>b.disconnect()},[]);const Kt=(()=>{const p={...We},b=nt.current?getComputedStyle(nt.current).getPropertyValue("--cntrl-article-width").trim():"";return b&&(p["--cntrl-article-width"]=b),p})(),[bt,St]=r.useState(!1),[rt,Zt]=r.useState([]),[Jt,jt]=r.useState(0),Rt=S==="on"&&(!n||a),zt=(p,b)=>{n&&!a||S!=="off"&&(Zt(p),jt(b),St(!0))};r.useEffect(()=>{if(!bt||S!=="on"||typeof document>"u")return;const p=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=p}},[bt,S]),r.useEffect(()=>{!n||a||St(!1)},[n,a]);const Qt=r.useMemo(()=>ci(s),[s]);return t.jsxs(t.Fragment,{children:[t.jsx("style",{dangerouslySetInnerHTML:{__html:Qt}}),S==="on"&&t.jsx(vi,{mediaList:vt}),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 Ot;const A=Et(p.title),K=Et(p.subtitle),Ne=S==="off"&&((Ot=p.link)!=null&&Ot.value)?p.link:void 0,Pt=Math.floor(b/E)===Math.ceil(Y.length/E)-1,st=se&&b>=He?`${Le+(b-He)}`:void 0,Ft=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,ei=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,ti=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,Vt=t.jsxs(ct.LinkWrapper,{link:Ne,className:`${s}-item-text-link`,children:[ei,ti]}),qe=Gt(p.gallery),ot=qe.filter($=>$.lightboxMedia).map($=>$.lightboxMedia),lt=t.jsx(ji,{className:te,style:z,children:qe.length===0?null:ze==="off"?(()=>{const{displayMedia:$,lightboxMedia:Be}=qe[0],Ge=Be?ot.findIndex(at=>at.assetId===Be.assetId):-1;return t.jsx(Dt,{media:$,className:`${s}-item-${xe($)?"video":"image"}`.trim(),style:Nt,hasLightbox:S==="on",onMediaClick:Rt&&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(Bt.LazyVideo,{src:$.assetId,nearPreload:"metadata",muted:!0,playsInline:!0},`sizer-${$.assetId}`):t.jsx("img",{src:$.assetId,alt:""},`sizer-${$.assetId}`))}),t.jsx(Wt.Splide2,{className:`${s}-item-slider`,options:{arrows:!1,pagination:!1,drag:!1,perPage:1,autoplay:!0,interval:de*1e3,width:"100%",height:"100%",speed:gi,type:L==="fade"?"fade":"loop",rewind:L==="fade",pauseOnHover:!1,pauseOnFocus:!1,direction:Yt},onMoved:$=>{ue!=="random"||L==="fade"||mi($)},children:qe.map(({displayMedia:$,lightboxMedia:Be},Ge)=>{const at=Be?ot.findIndex(ii=>ii.assetId===Be.assetId):-1;return t.jsx(Wt.SplideSlide,{"data-slide-index":Ge,children:t.jsx(Dt,{media:$,className:`${s}-item-${xe($)?"video":"image"}`.trim(),style:Nt,hasLightbox:S==="on",isSplideSlide:!0,onMediaClick:Rt&&at>=0?()=>zt(ot,at):void 0})},Ge)})},`${L}-${Te}-${ue}-${de}-${Xt}-${q}`)]})}),At=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})]}),Mt=Ne?t.jsx(ct.LinkWrapper,{link:Ne,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&&Pt?` ${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:[Vt,Mt]}):t.jsxs(t.Fragment,{children:[Mt,Vt]})}):Ne?t.jsxs(t.Fragment,{children:[t.jsxs(ct.LinkWrapper,{link:Ne,className:`${s}-item-image-link`,children:[Ft,lt]}),!v&&t.jsx(ct.LinkWrapper,{link:Ne,className:`${s}-item-text-link`,children:At})]}):t.jsxs(t.Fragment,{children:[Ft,lt,At]})})},b)})})}),(!n||a)&&bt&&typeof document<"u"&&S==="on"&&(()=>{const p=(ae?document.getElementById(ae):null)??document.body;return si.createPortal(t.jsx("div",{style:Kt,"data-selection":"none",children:t.jsx(_i,{prefix:s,items:rt,index:Jt,imageDisplay:Ni(we),isEditor:n,isPreviewMode:a,isEditMode:o,closeIcon:ge,closeIconMaxWidth:Se,closeIconColor:he,closeIconHoverColor:gt,iconMarginRight:Ke,contentMarginTop:ht,onClose:()=>St(!1),onPrev:()=>jt(b=>(b-1+rt.length)%rt.length),onNext:()=>jt(b=>(b+1)%rt.length),counterClassName:ye,counterStyle:pe})}),p)})()]})}const zi={titleColor:"title-color",subtitleColor:"subtitle-color",lightboxCounterColor:"lightbox-counter-color"},Fi=["hover","focus","filled","success","error"];exports.Grid=Ri;
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;
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),Wt=require("./scalingValue-CSHYgTZl.js"),on=require("./useScopedStyles-Bf6yohVQ.js"),sn=require("./useLazyVideos-CdCbc2j0.js"),st=require("./EmbedMediaFrame-DsOTKE4i.js"),ln=require("./LazyVideo-imbU18js.js"),r=require("react"),an=require("react-dom"),cn=require("./HiveLightboxTitles-DlyptAaK.js"),un=require("./getImageRect-BQhQXvT8.js"),fn=require("./textStylesToCss-CNN3zZTV.js");function dn(t){return`calc(var(--cntrl-article-width, 100vw) * ${t/1440})`}function hn(t){return`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),Wt=require("./scalingValue-CSHYgTZl.js"),on=require("./useScopedStyles-Bf6yohVQ.js"),sn=require("./useLazyVideos-CdCbc2j0.js"),st=require("./EmbedMediaFrame-DsOTKE4i.js"),ln=require("./LazyVideo-imbU18js.js"),r=require("react"),an=require("react-dom"),cn=require("./HiveLightboxTitles-DEeyQGcf.js"),un=require("./getImageRect-BQhQXvT8.js"),fn=require("./textStylesToCss-CNN3zZTV.js");function dn(t){return`calc(var(--cntrl-article-width, 100vw) * ${t/1440})`}function hn(t){return`
2
2
  .${t}-wrapper {
3
3
  display: grid;
4
4
  align-items: start;
@@ -6,7 +6,7 @@ import { i as Mt, E as Ke, g as pn } from "./EmbedMediaFrame-DwHeOAy5.mjs";
6
6
  import { L as mn } from "./LazyVideo-CdAWymKO.mjs";
7
7
  import { useMemo as de, useRef as y, useState as $, useCallback as v, useEffect as _, useLayoutEffect as fe } from "react";
8
8
  import { createPortal as wn } from "react-dom";
9
- import { H as vn } from "./HiveLightboxTitles-DhEeFKWs.mjs";
9
+ import { H as vn } from "./HiveLightboxTitles-BCoL46-V.mjs";
10
10
  import { g as yn } from "./getImageRect-CBMhFNHM.mjs";
11
11
  import { t as xn } from "./textStylesToCss-05Mn6I_2.mjs";
12
12
  function $n(t) {
@@ -1,7 +1,7 @@
1
1
  import { jsxs as x, jsx as r, Fragment as J } from "react/jsx-runtime";
2
2
  import { useMemo as w } from "react";
3
3
  import { s } from "./scalingValue-C9JH5L6O.mjs";
4
- import { S as Ft } from "./SvgImage-B5mR9y6q.mjs";
4
+ import { S as Ft } from "./SvgImage-CwRq9-ec.mjs";
5
5
  import { j as Z, r as q, D as Q, b as _, a as pt, g as wt, c as F, T as K, d as jt, e as b, f as R, h as At } from "./utils-FxC9rcxw.mjs";
6
6
  function Qt({
7
7
  prefix: i,
@@ -1 +1 @@
1
- "use strict";const e=require("react/jsx-runtime"),T=require("react"),c=require("./scalingValue-CSHYgTZl.js"),Ht=require("./SvgImage-DFlmxAoL.js"),i=require("./utils-033j3qNL.js");function Rt({prefix:a,entry:w,settings:R,isEditor:r,isEditMode:m,isPreviewMode:st,onClose:J}){const{title1Width:E,title2Width:F,title3Width:O,title1MarginLeft:y=0,title2MarginLeft:k=0,title3MarginLeft:U=0,titleRowMarginBottom:_=0,titleHeaderLayout:rt="desktop",contentMarginTop:Z=0,iconMarginRight:ct=0,closeIcon:q=null,closeIconMaxWidth:G=0,closeIconColor:z="#000000",closeIconHoverColor:Q="#cccccc"}=R,dt=c.scalingValue(Z,r),ht=c.scalingValue(Math.max(Z,i.TITLE_PADDING_HANDLE_WIDTH),r),X=c.scalingValue(ct,r),ft=c.scalingValue(_,r),g=rt==="mobile",S=i.journalTextFieldsToCss("title1",i.resolveJournalTextFields(R,"title1"),r),M=i.journalTextFieldsToCss("title2",i.resolveJournalTextFields(R,"title2"),r),N=i.journalTextFieldsToCss("title3",i.resolveJournalTextFields(R,"title3"),r),u=T.useMemo(()=>({title1Width:E??i.DEFAULT_JOURNAL_TITLE_WIDTHS.title1Width,title2Width:F??i.DEFAULT_JOURNAL_TITLE_WIDTHS.title2Width,title3Width:O??i.DEFAULT_JOURNAL_TITLE_WIDTHS.title3Width}),[E,F,O]),W=T.useMemo(()=>({title2MarginLeft:k,title3MarginLeft:U}),[k,U]),d=T.useMemo(()=>i.buildJournalTitleSlots(a,w,S,M,N),[a,w,S,M,N]),b=T.useMemo(()=>d.map(t=>u[t.widthKey]),[d,u]),p=T.useMemo(()=>i.resolveJournalTitleWidths(d.length,b),[d.length,b]),gt=T.useMemo(()=>i.getEffectiveJournalTitleWidths(d.length,b),[d.length,b]),K=T.useMemo(()=>d.filter(t=>t.prefix==="title1"),[d]),L=T.useMemo(()=>d.filter(t=>t.prefix==="title2"||t.prefix==="title3"),[d]),B=T.useMemo(()=>i.getRowScopedJournalTitleWidths(K,u),[K,u]),j=T.useMemo(()=>i.getRowScopedJournalTitleWidths(L,u),[L,u]),D=!!(w.title1||w.title2||w.title3),$=q!==null;if(!(D||$))return null;const Y=(y??0)>0||m,A=(t,n)=>{const s=d.findIndex(l=>l.prefix===t.prefix);if(!g||n==="single-row")return{effectiveWidth:gt[s]??0,resolvedWidth:p[s]??0,maxWidth:i.getJournalTitleMaxWidth(s,p)};if(n==="two-row-top"){const l=K.findIndex(f=>f.prefix===t.prefix);return{effectiveWidth:B.effective[l]??0,resolvedWidth:B.resolved[l]??0,maxWidth:i.getJournalTitleMaxWidth(l,B.resolved)}}const o=L.findIndex(l=>l.prefix===t.prefix);return{effectiveWidth:j.effective[o]??0,resolvedWidth:j.resolved[o]??0,maxWidth:i.getJournalTitleMaxWidth(o,j.resolved)}},C=(t,n,s)=>{if(!g||s==="single-row"){const h=t.findIndex(I=>I.prefix===n.prefix),v=t.map(I=>u[I.widthKey]),H=i.resolveJournalTitleWidths(t.length,v);return{effectiveWidth:i.getEffectiveJournalTitleWidths(t.length,v)[h]??0,resolvedWidth:H[h]??0,maxWidth:i.getJournalTitleMaxWidth(h,H)}}if(s==="two-row-top"){const h=t.filter(I=>I.prefix==="title1"),v=h.findIndex(I=>I.prefix===n.prefix),{resolved:H,effective:at}=i.getRowScopedJournalTitleWidths(h,u);return{effectiveWidth:at[v]??0,resolvedWidth:H[v]??0,maxWidth:i.getJournalTitleMaxWidth(v,H)}}const o=t.filter(h=>h.prefix==="title2"||h.prefix==="title3"),l=o.findIndex(h=>h.prefix===n.prefix),{resolved:f,effective:x}=i.getRowScopedJournalTitleWidths(o,u);return{effectiveWidth:x[l]??0,resolvedWidth:f[l]??0,maxWidth:i.getJournalTitleMaxWidth(l,f)}},ut=t=>i.getJournalTitleBoundaryOffset(d,p,W,t)+(g?0:y??0),xt=()=>g?0:y??0,P=t=>L.slice(0,t).reduce((n,s,o)=>n+(s.marginLeftKey?W[s.marginLeftKey]??0:0)+(j.resolved[o]??0),0),mt=t=>{const n=L[t];return P(t)+(n.marginLeftKey?W[n.marginLeftKey]??0:0)+(j.resolved[t]??0)},V=(t,n,s)=>{const o=t.marginLeftKey?W[t.marginLeftKey]??0:0,{effectiveWidth:l,resolvedWidth:f,maxWidth:x}=s??A(t,n),h=Math.max(o,i.TITLE_PADDING_HANDLE_WIDTH),v=m&&n==="two-row-top";return e.jsxs("div",{className:`${a}-title-cell`,"data-title":t.prefix,style:{width:c.scalingValue(l,r),...o>0?{marginLeft:c.scalingValue(o,r)}:{}},children:[e.jsx("p",{className:t.className,style:t.style,children:t.text}),v&&t.marginLeftKey?e.jsx("div",{"data-controls":t.marginLeftKey,"data-controls-axis":"x","data-controls-min":"0","data-controls-max-fraction":String(f),style:{position:"absolute",top:0,left:c.scalingValue(-o,r),width:c.scalingValue(h,r),height:"100%",pointerEvents:"auto"}}):null,v?e.jsx("div",{"data-controls":t.widthKey,"data-controls-axis":"x","data-controls-max-fraction":String(x),"data-controls-variant":"column-width",className:`${a}-title-resize-handle`,style:{position:"absolute",top:0,right:c.scalingValue(-i.TITLE_RESIZE_HANDLE_WIDTH/2,r),width:c.scalingValue(i.TITLE_RESIZE_HANDLE_WIDTH,r),height:"100%",pointerEvents:"auto"}}):null]},t.className)},tt=(t="two-row")=>{const n=d.findIndex(l=>l.prefix==="title1"),s=n>=0?p[n]:u.title1Width,o=t==="two-row"&&m;return e.jsx("div",{...o?{"data-controls":"title1MarginLeft","data-controls-axis":"x","data-controls-min":"0","data-controls-max-fraction":String(s)}:{},style:{width:c.scalingValue(y??0,r),flexShrink:0,alignSelf:"stretch",...o?{pointerEvents:"auto"}:{}}})},et=()=>e.jsx("span",{className:`${a}-titles-baseline-strut`,style:S,"aria-hidden":"true",children:" "}),Tt=t=>{const n=i.buildJournalTitleSlots(a,t,S,M,N);return e.jsx(e.Fragment,{children:n.map(s=>V(s,"single-row",C(n,s,"single-row")))})},wt=t=>{const n=i.buildJournalTitleSlots(a,t,S,M,N),s=n.find(o=>o.prefix==="title1");return s?V(s,"two-row-top",C(n,s,"two-row-top")):null},vt=(t,n=!1)=>{const s=i.buildJournalTitleSlots(a,t,S,M,N),o=s.filter(x=>x.prefix==="title2"||x.prefix==="title3"),l=m&&n;return o.length>0||l||(_??0)>0?e.jsxs("div",{className:`${a}-titles-row-bottom-wrap`,children:[o.length>0?e.jsxs("div",{className:`${a}-titles-row-bottom`,children:[e.jsx("div",{className:`${a}-titles-stack`,children:o.map(x=>V(x,"two-row-bottom",C(s,x,"two-row-bottom")))}),n&&m?e.jsxs(e.Fragment,{children:[St(),Mt()]}):null]}):null,(_??0)>0||l?e.jsx("div",{"data-controls":l?"titleRowMarginBottom":void 0,"data-controls-axis":l?"y":void 0,"data-controls-reverse":l?"":void 0,className:l?`${a}-control`:void 0,style:{height:ft,width:"100%",flexShrink:0,pointerEvents:l?"auto":"none"}}):null]}):null},pt=()=>e.jsxs("div",{className:`${a}-close-icon`,style:{width:c.scalingValue(G??0,r),height:c.scalingValue(G??0,r),marginRight:X,"--close-icon-hover-color":Q},children:[e.jsx("button",{type:"button",className:`${a}-close-icon-inner`,onClick:t=>{t.stopPropagation(),J==null||J()},"aria-label":"Close",children:e.jsx(Ht.SvgImage,{url:q??"",fill:z,hoverFill:r&&!st?z:Q,className:`${a}-close-icon-img`})}),m&&e.jsx("div",{"data-controls":"iconMarginRight","data-controls-axis":"x","data-controls-reverse":"",className:`${a}-control`,style:{position:"absolute",top:0,left:"100%",width:X,height:"100%",pointerEvents:"auto"}})]}),it=()=>$?e.jsx("div",{className:`${a}-titles-row-header-controls`,children:pt()}):null,nt=t=>e.jsx("div",{className:`${a}-titles-row-titles`,children:e.jsx("div",{className:`${a}-titles-stack`,children:t})}),Wt=t=>e.jsxs("div",{className:`${a}-titles-row-top`,children:[$||D?et():null,Y?tt("two-row"):null,nt(t),it()]}),Lt=(t,n=!1)=>e.jsxs(e.Fragment,{children:[Wt(wt(t)),vt(t,n)]}),It=()=>{const t=g?-1:d.findIndex(o=>o.prefix==="title1"),n=!g&&(m||(y??0)>0)?(()=>{const o=y??0,l=t>=0?p[t]:u.title1Width,f=Math.max(o,i.TITLE_PADDING_HANDLE_WIDTH);return e.jsx("div",{"data-controls":"title1MarginLeft","data-controls-axis":"x","data-controls-min":"0","data-controls-max-fraction":String(l),style:{position:"absolute",top:0,left:0,width:c.scalingValue(f,r),height:"100%",pointerEvents:"auto"}},"title1MarginLeft")})():null,s=d.flatMap((o,l)=>{if(!o.marginLeftKey)return[];const f=W[o.marginLeftKey]??0,x=i.getJournalTitleOffsetBeforeSlot(d,p,W,l)+xt(),h=Math.max(f,i.TITLE_PADDING_HANDLE_WIDTH);return e.jsx("div",{"data-controls":o.marginLeftKey,"data-controls-axis":"x","data-controls-min":"0","data-controls-max-fraction":String(p[l]),style:{position:"absolute",top:0,left:c.scalingValue(x,r),width:c.scalingValue(h,r),height:"100%",pointerEvents:"auto"}},o.marginLeftKey)});return n?[n,...s]:s},yt=()=>d.map((t,n)=>{const s=i.getJournalTitleMaxWidth(n,p),l=ut(n)-i.TITLE_RESIZE_HANDLE_WIDTH/2;return e.jsx("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:e.jsx("div",{"data-controls":t.widthKey,"data-controls-axis":"x","data-controls-max-fraction":String(s),"data-controls-variant":"column-width",className:`${a}-title-resize-handle`,style:{position:"absolute",top:0,left:c.scalingValue(l,r),width:c.scalingValue(i.TITLE_RESIZE_HANDLE_WIDTH,r),height:"100%",pointerEvents:"auto"}})},`${t.widthKey}-junction`)}),St=()=>L.flatMap((t,n)=>{if(!t.marginLeftKey)return[];const s=W[t.marginLeftKey]??0,o=P(n),l=Math.max(s,i.TITLE_PADDING_HANDLE_WIDTH),{resolvedWidth:f}=A(t,"two-row-bottom");return e.jsx("div",{"data-controls":t.marginLeftKey,"data-controls-axis":"x","data-controls-min":"0","data-controls-max-fraction":String(f),style:{position:"absolute",top:0,left:c.scalingValue(o,r),width:c.scalingValue(l,r),height:"100%",pointerEvents:"auto"}},t.marginLeftKey)}),Mt=()=>L.map((t,n)=>{const{maxWidth:s}=A(t,"two-row-bottom"),l=mt(n)-i.TITLE_RESIZE_HANDLE_WIDTH/2;return e.jsx("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:e.jsx("div",{"data-controls":t.widthKey,"data-controls-axis":"x","data-controls-max-fraction":String(s),"data-controls-variant":"column-width",className:`${a}-title-resize-handle`,style:{position:"absolute",top:0,left:c.scalingValue(l,r),width:c.scalingValue(i.TITLE_RESIZE_HANDLE_WIDTH,r),height:"100%",pointerEvents:"auto"}})},`${t.widthKey}-junction`)}),ot=()=>!m||g?null:e.jsxs(e.Fragment,{children:[It(),yt()]}),lt=!!(w.title2||w.title3||(_??0)>0||m),Nt=()=>e.jsxs("div",{className:`${a}-titles-row ${a}-titles-row-header`,style:{width:"100%",position:"relative"},children:[$||D?et():null,Y?tt("single-row"):null,D?nt(Tt(w)):e.jsx("div",{className:`${a}-titles-row-titles`,"aria-hidden":"true"}),it(),ot()]}),jt=()=>e.jsxs("div",{style:{position:"relative",width:"100%",alignSelf:"stretch",display:"flex",flexDirection:"column",minHeight:0,...lt?{flex:1,height:"100%"}:{}},children:[e.jsx("div",{className:`${a}-titles-row-two-row`,style:lt?void 0:{flex:"0 0 auto",height:"auto"},children:Lt(w,!0)}),ot()]});return e.jsxs("div",{className:`${a}-lightbox-overlay-content`,children:[e.jsx("div",{style:{position:"relative",width:"100%",height:dt,flexShrink:0},children:m&&e.jsx("div",{"data-controls":"contentMarginTop","data-controls-axis":"y","data-controls-min":"0",className:`${a}-control`,style:{position:"absolute",top:0,left:0,width:"100%",height:ht,pointerEvents:"auto"}})}),e.jsx("div",{style:{display:"flex",flexDirection:"row",width:"100%",...g?{flex:1,minHeight:0}:{}},children:e.jsx("div",{className:`${a}-lightbox-content-area${g?` ${a}-lightbox-content-area-stacked`:""}`,children:e.jsx("div",{className:`${a}-text-bar-cell${g?` ${a}-text-bar-cell-stacked`:""}`,style:g?void 0:{flex:1,minWidth:0,width:"100%"},children:g?jt():Nt()})})})]})}exports.HiveLightboxTitles=Rt;
1
+ "use strict";const e=require("react/jsx-runtime"),T=require("react"),c=require("./scalingValue-CSHYgTZl.js"),Ht=require("./SvgImage-_QN8ngad.js"),i=require("./utils-033j3qNL.js");function Rt({prefix:a,entry:w,settings:R,isEditor:r,isEditMode:m,isPreviewMode:st,onClose:J}){const{title1Width:E,title2Width:F,title3Width:O,title1MarginLeft:y=0,title2MarginLeft:k=0,title3MarginLeft:U=0,titleRowMarginBottom:_=0,titleHeaderLayout:rt="desktop",contentMarginTop:Z=0,iconMarginRight:ct=0,closeIcon:q=null,closeIconMaxWidth:G=0,closeIconColor:z="#000000",closeIconHoverColor:Q="#cccccc"}=R,dt=c.scalingValue(Z,r),ht=c.scalingValue(Math.max(Z,i.TITLE_PADDING_HANDLE_WIDTH),r),X=c.scalingValue(ct,r),ft=c.scalingValue(_,r),g=rt==="mobile",S=i.journalTextFieldsToCss("title1",i.resolveJournalTextFields(R,"title1"),r),M=i.journalTextFieldsToCss("title2",i.resolveJournalTextFields(R,"title2"),r),N=i.journalTextFieldsToCss("title3",i.resolveJournalTextFields(R,"title3"),r),u=T.useMemo(()=>({title1Width:E??i.DEFAULT_JOURNAL_TITLE_WIDTHS.title1Width,title2Width:F??i.DEFAULT_JOURNAL_TITLE_WIDTHS.title2Width,title3Width:O??i.DEFAULT_JOURNAL_TITLE_WIDTHS.title3Width}),[E,F,O]),W=T.useMemo(()=>({title2MarginLeft:k,title3MarginLeft:U}),[k,U]),d=T.useMemo(()=>i.buildJournalTitleSlots(a,w,S,M,N),[a,w,S,M,N]),b=T.useMemo(()=>d.map(t=>u[t.widthKey]),[d,u]),p=T.useMemo(()=>i.resolveJournalTitleWidths(d.length,b),[d.length,b]),gt=T.useMemo(()=>i.getEffectiveJournalTitleWidths(d.length,b),[d.length,b]),K=T.useMemo(()=>d.filter(t=>t.prefix==="title1"),[d]),L=T.useMemo(()=>d.filter(t=>t.prefix==="title2"||t.prefix==="title3"),[d]),B=T.useMemo(()=>i.getRowScopedJournalTitleWidths(K,u),[K,u]),j=T.useMemo(()=>i.getRowScopedJournalTitleWidths(L,u),[L,u]),D=!!(w.title1||w.title2||w.title3),$=q!==null;if(!(D||$))return null;const Y=(y??0)>0||m,A=(t,n)=>{const s=d.findIndex(l=>l.prefix===t.prefix);if(!g||n==="single-row")return{effectiveWidth:gt[s]??0,resolvedWidth:p[s]??0,maxWidth:i.getJournalTitleMaxWidth(s,p)};if(n==="two-row-top"){const l=K.findIndex(f=>f.prefix===t.prefix);return{effectiveWidth:B.effective[l]??0,resolvedWidth:B.resolved[l]??0,maxWidth:i.getJournalTitleMaxWidth(l,B.resolved)}}const o=L.findIndex(l=>l.prefix===t.prefix);return{effectiveWidth:j.effective[o]??0,resolvedWidth:j.resolved[o]??0,maxWidth:i.getJournalTitleMaxWidth(o,j.resolved)}},C=(t,n,s)=>{if(!g||s==="single-row"){const h=t.findIndex(I=>I.prefix===n.prefix),v=t.map(I=>u[I.widthKey]),H=i.resolveJournalTitleWidths(t.length,v);return{effectiveWidth:i.getEffectiveJournalTitleWidths(t.length,v)[h]??0,resolvedWidth:H[h]??0,maxWidth:i.getJournalTitleMaxWidth(h,H)}}if(s==="two-row-top"){const h=t.filter(I=>I.prefix==="title1"),v=h.findIndex(I=>I.prefix===n.prefix),{resolved:H,effective:at}=i.getRowScopedJournalTitleWidths(h,u);return{effectiveWidth:at[v]??0,resolvedWidth:H[v]??0,maxWidth:i.getJournalTitleMaxWidth(v,H)}}const o=t.filter(h=>h.prefix==="title2"||h.prefix==="title3"),l=o.findIndex(h=>h.prefix===n.prefix),{resolved:f,effective:x}=i.getRowScopedJournalTitleWidths(o,u);return{effectiveWidth:x[l]??0,resolvedWidth:f[l]??0,maxWidth:i.getJournalTitleMaxWidth(l,f)}},ut=t=>i.getJournalTitleBoundaryOffset(d,p,W,t)+(g?0:y??0),xt=()=>g?0:y??0,P=t=>L.slice(0,t).reduce((n,s,o)=>n+(s.marginLeftKey?W[s.marginLeftKey]??0:0)+(j.resolved[o]??0),0),mt=t=>{const n=L[t];return P(t)+(n.marginLeftKey?W[n.marginLeftKey]??0:0)+(j.resolved[t]??0)},V=(t,n,s)=>{const o=t.marginLeftKey?W[t.marginLeftKey]??0:0,{effectiveWidth:l,resolvedWidth:f,maxWidth:x}=s??A(t,n),h=Math.max(o,i.TITLE_PADDING_HANDLE_WIDTH),v=m&&n==="two-row-top";return e.jsxs("div",{className:`${a}-title-cell`,"data-title":t.prefix,style:{width:c.scalingValue(l,r),...o>0?{marginLeft:c.scalingValue(o,r)}:{}},children:[e.jsx("p",{className:t.className,style:t.style,children:t.text}),v&&t.marginLeftKey?e.jsx("div",{"data-controls":t.marginLeftKey,"data-controls-axis":"x","data-controls-min":"0","data-controls-max-fraction":String(f),style:{position:"absolute",top:0,left:c.scalingValue(-o,r),width:c.scalingValue(h,r),height:"100%",pointerEvents:"auto"}}):null,v?e.jsx("div",{"data-controls":t.widthKey,"data-controls-axis":"x","data-controls-max-fraction":String(x),"data-controls-variant":"column-width",className:`${a}-title-resize-handle`,style:{position:"absolute",top:0,right:c.scalingValue(-i.TITLE_RESIZE_HANDLE_WIDTH/2,r),width:c.scalingValue(i.TITLE_RESIZE_HANDLE_WIDTH,r),height:"100%",pointerEvents:"auto"}}):null]},t.className)},tt=(t="two-row")=>{const n=d.findIndex(l=>l.prefix==="title1"),s=n>=0?p[n]:u.title1Width,o=t==="two-row"&&m;return e.jsx("div",{...o?{"data-controls":"title1MarginLeft","data-controls-axis":"x","data-controls-min":"0","data-controls-max-fraction":String(s)}:{},style:{width:c.scalingValue(y??0,r),flexShrink:0,alignSelf:"stretch",...o?{pointerEvents:"auto"}:{}}})},et=()=>e.jsx("span",{className:`${a}-titles-baseline-strut`,style:S,"aria-hidden":"true",children:" "}),Tt=t=>{const n=i.buildJournalTitleSlots(a,t,S,M,N);return e.jsx(e.Fragment,{children:n.map(s=>V(s,"single-row",C(n,s,"single-row")))})},wt=t=>{const n=i.buildJournalTitleSlots(a,t,S,M,N),s=n.find(o=>o.prefix==="title1");return s?V(s,"two-row-top",C(n,s,"two-row-top")):null},vt=(t,n=!1)=>{const s=i.buildJournalTitleSlots(a,t,S,M,N),o=s.filter(x=>x.prefix==="title2"||x.prefix==="title3"),l=m&&n;return o.length>0||l||(_??0)>0?e.jsxs("div",{className:`${a}-titles-row-bottom-wrap`,children:[o.length>0?e.jsxs("div",{className:`${a}-titles-row-bottom`,children:[e.jsx("div",{className:`${a}-titles-stack`,children:o.map(x=>V(x,"two-row-bottom",C(s,x,"two-row-bottom")))}),n&&m?e.jsxs(e.Fragment,{children:[St(),Mt()]}):null]}):null,(_??0)>0||l?e.jsx("div",{"data-controls":l?"titleRowMarginBottom":void 0,"data-controls-axis":l?"y":void 0,"data-controls-reverse":l?"":void 0,className:l?`${a}-control`:void 0,style:{height:ft,width:"100%",flexShrink:0,pointerEvents:l?"auto":"none"}}):null]}):null},pt=()=>e.jsxs("div",{className:`${a}-close-icon`,style:{width:c.scalingValue(G??0,r),height:c.scalingValue(G??0,r),marginRight:X,"--close-icon-hover-color":Q},children:[e.jsx("button",{type:"button",className:`${a}-close-icon-inner`,onClick:t=>{t.stopPropagation(),J==null||J()},"aria-label":"Close",children:e.jsx(Ht.SvgImage,{url:q??"",fill:z,hoverFill:r&&!st?z:Q,className:`${a}-close-icon-img`})}),m&&e.jsx("div",{"data-controls":"iconMarginRight","data-controls-axis":"x","data-controls-reverse":"",className:`${a}-control`,style:{position:"absolute",top:0,left:"100%",width:X,height:"100%",pointerEvents:"auto"}})]}),it=()=>$?e.jsx("div",{className:`${a}-titles-row-header-controls`,children:pt()}):null,nt=t=>e.jsx("div",{className:`${a}-titles-row-titles`,children:e.jsx("div",{className:`${a}-titles-stack`,children:t})}),Wt=t=>e.jsxs("div",{className:`${a}-titles-row-top`,children:[$||D?et():null,Y?tt("two-row"):null,nt(t),it()]}),Lt=(t,n=!1)=>e.jsxs(e.Fragment,{children:[Wt(wt(t)),vt(t,n)]}),It=()=>{const t=g?-1:d.findIndex(o=>o.prefix==="title1"),n=!g&&(m||(y??0)>0)?(()=>{const o=y??0,l=t>=0?p[t]:u.title1Width,f=Math.max(o,i.TITLE_PADDING_HANDLE_WIDTH);return e.jsx("div",{"data-controls":"title1MarginLeft","data-controls-axis":"x","data-controls-min":"0","data-controls-max-fraction":String(l),style:{position:"absolute",top:0,left:0,width:c.scalingValue(f,r),height:"100%",pointerEvents:"auto"}},"title1MarginLeft")})():null,s=d.flatMap((o,l)=>{if(!o.marginLeftKey)return[];const f=W[o.marginLeftKey]??0,x=i.getJournalTitleOffsetBeforeSlot(d,p,W,l)+xt(),h=Math.max(f,i.TITLE_PADDING_HANDLE_WIDTH);return e.jsx("div",{"data-controls":o.marginLeftKey,"data-controls-axis":"x","data-controls-min":"0","data-controls-max-fraction":String(p[l]),style:{position:"absolute",top:0,left:c.scalingValue(x,r),width:c.scalingValue(h,r),height:"100%",pointerEvents:"auto"}},o.marginLeftKey)});return n?[n,...s]:s},yt=()=>d.map((t,n)=>{const s=i.getJournalTitleMaxWidth(n,p),l=ut(n)-i.TITLE_RESIZE_HANDLE_WIDTH/2;return e.jsx("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:e.jsx("div",{"data-controls":t.widthKey,"data-controls-axis":"x","data-controls-max-fraction":String(s),"data-controls-variant":"column-width",className:`${a}-title-resize-handle`,style:{position:"absolute",top:0,left:c.scalingValue(l,r),width:c.scalingValue(i.TITLE_RESIZE_HANDLE_WIDTH,r),height:"100%",pointerEvents:"auto"}})},`${t.widthKey}-junction`)}),St=()=>L.flatMap((t,n)=>{if(!t.marginLeftKey)return[];const s=W[t.marginLeftKey]??0,o=P(n),l=Math.max(s,i.TITLE_PADDING_HANDLE_WIDTH),{resolvedWidth:f}=A(t,"two-row-bottom");return e.jsx("div",{"data-controls":t.marginLeftKey,"data-controls-axis":"x","data-controls-min":"0","data-controls-max-fraction":String(f),style:{position:"absolute",top:0,left:c.scalingValue(o,r),width:c.scalingValue(l,r),height:"100%",pointerEvents:"auto"}},t.marginLeftKey)}),Mt=()=>L.map((t,n)=>{const{maxWidth:s}=A(t,"two-row-bottom"),l=mt(n)-i.TITLE_RESIZE_HANDLE_WIDTH/2;return e.jsx("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:e.jsx("div",{"data-controls":t.widthKey,"data-controls-axis":"x","data-controls-max-fraction":String(s),"data-controls-variant":"column-width",className:`${a}-title-resize-handle`,style:{position:"absolute",top:0,left:c.scalingValue(l,r),width:c.scalingValue(i.TITLE_RESIZE_HANDLE_WIDTH,r),height:"100%",pointerEvents:"auto"}})},`${t.widthKey}-junction`)}),ot=()=>!m||g?null:e.jsxs(e.Fragment,{children:[It(),yt()]}),lt=!!(w.title2||w.title3||(_??0)>0||m),Nt=()=>e.jsxs("div",{className:`${a}-titles-row ${a}-titles-row-header`,style:{width:"100%",position:"relative"},children:[$||D?et():null,Y?tt("single-row"):null,D?nt(Tt(w)):e.jsx("div",{className:`${a}-titles-row-titles`,"aria-hidden":"true"}),it(),ot()]}),jt=()=>e.jsxs("div",{style:{position:"relative",width:"100%",alignSelf:"stretch",display:"flex",flexDirection:"column",minHeight:0,...lt?{flex:1,height:"100%"}:{}},children:[e.jsx("div",{className:`${a}-titles-row-two-row`,style:lt?void 0:{flex:"0 0 auto",height:"auto"},children:Lt(w,!0)}),ot()]});return e.jsxs("div",{className:`${a}-lightbox-overlay-content`,children:[e.jsx("div",{style:{position:"relative",width:"100%",height:dt,flexShrink:0},children:m&&e.jsx("div",{"data-controls":"contentMarginTop","data-controls-axis":"y","data-controls-min":"0",className:`${a}-control`,style:{position:"absolute",top:0,left:0,width:"100%",height:ht,pointerEvents:"auto"}})}),e.jsx("div",{style:{display:"flex",flexDirection:"row",width:"100%",...g?{flex:1,minHeight:0}:{}},children:e.jsx("div",{className:`${a}-lightbox-content-area${g?` ${a}-lightbox-content-area-stacked`:""}`,children:e.jsx("div",{className:`${a}-text-bar-cell${g?` ${a}-text-bar-cell-stacked`:""}`,style:g?void 0:{flex:1,minWidth:0,width:"100%"},children:g?jt():Nt()})})})]})}exports.HiveLightboxTitles=Rt;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),g=require("react"),Ae=require("react-dom"),h=require("./scalingValue-CSHYgTZl.js"),ae=require("./SvgImage-DFlmxAoL.js"),$=require("classnames"),fe=require("./react-splide.esm-CabaEmHi.js"),Te=require("./RichTextRenderer-DEFXh5o6.js"),Z=require("./getImageRect-BQhQXvT8.js"),pe=require("./getColorAlpha-CoSseoCn.js"),je=require("./textStylesToCss-CNN3zZTV.js"),$e="LightBox-module__hidden___9s-9x",ze="LightBox-module__heroImage___sTxNF",Fe="LightBox-module__background___rm9ml",Ne="LightBox-module__editor___4ACaY",Oe="LightBox-module__contentStyle___Bgnsq",We="LightBox-module__imageStyle___tLIlB",Ee="LightBox-module__imgWrapper___LuFUp",De="LightBox-module__contain___8-yaS",Me="LightBox-module__cover___hNvOG",Pe="LightBox-module__caption___b6L2I",Xe="LightBox-module__captionTextInner___rCGNH",He="LightBox-module__lightboxSplide___XFuWC",Ye="LightBox-module__arrow___iz38X",Ue="LightBox-module__arrowVertical___Zfz81",qe="LightBox-module__nextArrow___zkAQN",Ge="LightBox-module__arrowInner___p48sW",Ke="LightBox-module__arrowIcon___3VaFf",Ze="LightBox-module__arrowImg___pNV88",Je="LightBox-module__mirror___pjeXc",Qe="LightBox-module__thumbsWrapper___GB-nU",et="LightBox-module__thumbsContainerVertical___wttk5",tt="LightBox-module__thumbsContainer___osSma",nt="LightBox-module__thumbsAlignStart___MO6tY",rt="LightBox-module__thumbsAlignCenter___Q4sUx",ot="LightBox-module__thumbsAlignEnd___p4y9R",it="LightBox-module__thumbItem___HvnF3",st="LightBox-module__closeButton___g2khP",at="LightBox-module__fadeIn___0m5GW",lt="LightBox-module__slideInLeft___gPYwC",ct="LightBox-module__slideInRight___S-pPp",ut="LightBox-module__slideInTop___DFdAj",dt="LightBox-module__slideInBottom___m27kZ",ht="LightBox-module__fadeOut___55qBR",mt="LightBox-module__slideOutLeft___NvU7P",gt="LightBox-module__slideOutRight___SK7eC",ft="LightBox-module__slideOutTop___Vgg0z",pt="LightBox-module__slideOutBottom___nJ0Ef",_t="LightBox-module__scaleSlide___vZriG",e={hidden:$e,heroImage:ze,background:Fe,editor:Ne,contentStyle:Oe,imageStyle:We,imgWrapper:Ee,contain:De,cover:Me,caption:Pe,captionTextInner:Xe,lightboxSplide:He,arrow:Ye,arrowVertical:Ue,nextArrow:qe,arrowInner:Ge,arrowIcon:Ke,arrowImg:Ze,mirror:Je,thumbsWrapper:Qe,thumbsContainerVertical:et,thumbsContainer:tt,thumbsAlignStart:nt,thumbsAlignCenter:rt,thumbsAlignEnd:ot,thumbItem:it,closeButton:st,fadeIn:at,slideInLeft:lt,slideInRight:ct,slideInTop:ut,slideInBottom:dt,fadeOut:ht,slideOutLeft:mt,slideOutRight:gt,slideOutTop:ft,slideOutBottom:pt,scaleSlide:_t},J=(l,L,f)=>{const p={},[V,R]=l.split("-");return V==="top"?(p.top="0",p.bottom="auto"):V==="middle"?(p.top="50%",p.bottom="auto"):V==="bottom"&&(p.top="auto",p.bottom="0"),R==="left"?(p.left="0",p.right="auto"):R==="center"?(p.left="50%",p.right="auto"):R==="right"&&(p.left="auto",p.right="0"),V==="middle"&&R==="center"?p.transform=`translate(calc(-50% + ${h.scalingValue(L.x,f)}), calc(-50% + ${h.scalingValue(L.y,f)}))`:V==="middle"?p.transform=`translate(${h.scalingValue(L.x,f)}, calc(-50% + ${h.scalingValue(L.y,f)}))`:R==="center"?p.transform=`translate(calc(-50% + ${h.scalingValue(L.x,f)}), ${h.scalingValue(L.y,f)})`:p.transform=`translate(${h.scalingValue(L.x,f)}, ${h.scalingValue(L.y,f)})`,p};function vt(l,L){const f=(()=>{if(l==="fade in")return e.fadeIn;if(l==="slide in"||l==="mix")switch(L){case"left":return e.slideInLeft;case"right":return e.slideInRight;case"top":return e.slideInTop;case"bottom":return e.slideInBottom;default:return e.slideInRight}return e.fadeIn})(),p=(()=>{if(l==="fade in"||l==="mix")return e.fadeIn;if(l==="slide in")switch(L){case"left":return e.slideInLeft;case"right":return e.slideInRight;case"top":return e.slideInTop;case"bottom":return e.slideInBottom;default:return e.slideInRight}return e.fadeIn})(),V=(()=>{if(l==="fade in"||l==="mix")return e.fadeOut;if(l==="slide in")switch(L){case"left":return e.slideOutLeft;case"right":return e.slideOutRight;case"top":return e.slideOutTop;case"bottom":return e.slideOutBottom;default:return e.slideOutRight}return e.fadeOut})(),R=(()=>{if(l==="fade in")return e.fadeOut;if(l==="slide in"||l==="mix")switch(L){case"left":return e.slideOutLeft;case"right":return e.slideOutRight;case"top":return e.slideOutTop;case"bottom":return e.slideOutBottom;default:return e.slideOutRight}return e.fadeOut})();return{appearClass:f,backdropAppearClass:p,backdropDisappearClass:V,disappearClass:R}}const xt=({settings:l,content:L,styles:f,portalId:p,activeEvent:V,isEditor:R,isPreviewMode:r})=>{const[X,O]=g.useState(!1),{assetId:H}=l.thumbnailBlock.cover;return g.useEffect(()=>{V==="close"&&O(!1),V==="open"&&O(!0)},[V]),u.jsxs(u.Fragment,{children:[u.jsx("img",{src:H,alt:"Cover",className:e.heroImage,onClick:()=>O(!0)}),u.jsx(bt,{isOpen:X,onClose:()=>O(!1),content:L,settings:l,lightboxStyles:f,portalId:p,isEditor:R})]})},bt=({isOpen:l,onClose:L,content:f,lightboxStyles:p,settings:V,portalId:R,isEditor:r,metadata:X})=>{var ge;const{widthSettings:O,fontSettings:H,letterSpacing:ve,textAlign:xe,wordSpacing:be,fontSizeLineHeight:le,textAppearance:Q,color:we}=p.imageCaption??{},[z,Y]=g.useState(0),[ce,ee]=g.useState(0),[te,ne]=g.useState(!1),[Le,U]=g.useState(!1),[ue,de]=g.useState({}),I=g.useRef(null),re=g.useRef(null),A=g.useRef(null),W=g.useRef(!1),C=g.useRef(null),E=g.useRef(null),D=g.useRef(null),S=g.useRef(null),F=g.useRef(!1),he=g.useRef(null),[ye,oe]=g.useState(!1),{appear:q,triggers:T,slider:s,thumbnail:_,controls:v,area:B,caption:M,layout:P}=V.lightboxBlock,{appearClass:Ie,backdropAppearClass:Ce,backdropDisappearClass:Se,disappearClass:Be}=vt(q.type,q.direction),ie=(X==null?void 0:X.itemId)??null;g.useEffect(()=>{const t=()=>{setTimeout(()=>{var o,c;(c=(o=I.current)==null?void 0:o.splide)==null||c.refresh()},16)},n=()=>{ee(o=>o+1)};return window.addEventListener("ArticleEditor.Layout:change",t),window.addEventListener("ArticleEditor.ComponentContent:change",n),()=>{window.removeEventListener("ArticleEditor.Layout:change",t),window.removeEventListener("ArticleEditor.ComponentContent:change",n)}},[]),g.useEffect(()=>{if(!l||!_.isActive){oe(!1);return}const t=he.current;if(!t)return;const n=()=>{s.direction==="horiz"?oe(t.scrollWidth>t.clientWidth):oe(t.scrollHeight>t.clientHeight)};n();const o=new ResizeObserver(n);return o.observe(t),()=>o.disconnect()},[l,_.isActive,f.length,ue,s.direction]);const N=g.useCallback(()=>{const t=window.matchMedia("(max-width: 768px)").matches,n=pe.getColorAlpha(B.color);t&&!r&&n>.9&&(document.body.style.backgroundColor=""),ne(!0),W.current=!0;const o=c=>{c.target===C.current&&c.animationName&&(C.current&&E.current&&C.current.removeEventListener("animationend",E.current),E.current=null,W.current&&(W.current=!1,L()),ne(!1))};C.current&&(E.current=o,C.current.addEventListener("animationend",o))},[L,B.color,r]),Ve=(t,n,o)=>{var c,m;if(t){if(T.type==="click"&&T.switch==="image")T.repeat==="close"&&z===f.length-1?N():(c=I.current)==null||c.go("+1");else if(T.type==="click"&&T.switch==="50/50"){const d=t.getBoundingClientRect(),i=n-d.left,x=o-d.top,k=d.width,b=d.height;let y;s.direction==="horiz"?y=i<k/2?"-1":"+1":y=x<b/2?"-1":"+1",(m=I.current)==null||m.go(y)}}},me=t=>{if(F.current){F.current=!1;return}const n=f[z],o=(n==null?void 0:n.image.objectFit)==="cover";let c,m;if("changedTouches"in t&&t.changedTouches.length>0)c=t.changedTouches[0].clientX,m=t.changedTouches[0].clientY;else if("clientX"in t)c=t.clientX,m=t.clientY;else return;let d;if(o&&A.current){const i=Z.getPaddedContainerBounds(A.current);d=c>=i.left&&c<=i.right&&m>=i.top&&m<=i.bottom}else{const i=A.current?Z.getDisplayedImageRect(A.current):null;if(!i){t.target===t.currentTarget&&N();return}d=c>=i.x&&c<=i.x+i.width&&m>=i.y&&m<=i.y+i.height}d?Ve(A.current,c,m):N()},Re=t=>{const n=t.target;(n.classList.contains(e.thumbsWrapper)||n.classList.contains(e.thumbsContainer))&&me(t)};g.useEffect(()=>{if(!l)return;const t=n=>{var o,c;if(n.key==="Escape"){N();return}if(n.key==="ArrowRight"){Y(m=>(m+1)%Math.max(f.length,1)),(o=I.current)==null||o.go("+1");return}n.key==="ArrowLeft"&&(Y(m=>(m-1+Math.max(f.length,1))%Math.max(f.length,1)),(c=I.current)==null||c.go("-1"))};return window.addEventListener("keydown",t),()=>{window.removeEventListener("keydown",t)}},[l,N,f.length]),g.useEffect(()=>{if(l){if(Y(0),ee(n=>n+1),W.current=!1,ne(!1),U(!1),de({}),!ie)return;const t=new CustomEvent("page-overlay",{detail:{itemId:ie}});window.dispatchEvent(t)}return()=>{C.current&&E.current&&(C.current.removeEventListener("animationend",E.current),E.current=null),U(!1)}},[l,ie]),g.useEffect(()=>{re.current!==null&&re.current!==s.type&&ee(t=>t+1),re.current=s.type},[s.type]),g.useEffect(()=>{if(!l)return;const t=document.body.style.overflow,n=window.matchMedia("(max-width: 768px)").matches,o=pe.getColorAlpha(B.color);document.body.style.overflow="hidden",U(!1);const c=d=>{d.target===C.current&&!W.current&&d.animationName&&(n&&!r&&o>.9&&(document.body.style.backgroundColor=B.color),U(!0),C.current&&D.current&&C.current.removeEventListener("animationend",D.current),D.current=null)};C.current&&(D.current=c,C.current.addEventListener("animationend",c));const m=d=>{const i=d.target;i&&(i.closest(`.${e.thumbsWrapper}`)||i.closest(`.${e.thumbsContainer}`))||s.type!=="slide"&&d.preventDefault()};return document.addEventListener("touchmove",m,{passive:!1}),()=>{document.body.style.overflow=t,document.removeEventListener("touchmove",m),C.current&&D.current&&(C.current.removeEventListener("animationend",D.current),D.current=null),U(!1)}},[l,r,B.color,s.type]),g.useEffect(()=>{if(!l)return;const t=n=>{var c,m;if(W.current){n.stopPropagation();return}if(F.current){F.current=!1;return}const o=n.target;if(!(o&&(o.closest(`.${e.thumbsContainer}`)||o.closest(`.${e.thumbItem}`)||o.closest(`.${e.arrow}`)||o.closest(`.${e.closeButton}`)||o.closest(`.${e.caption}`)))){if(s.type==="slide"&&T.type==="drag"&&((m=(c=I.current)==null?void 0:c.splide)!=null&&m.root)){const d=I.current.splide.root;if(o&&(d.contains(o)||d===o))return}if(n.touches.length===0&&n.changedTouches.length>0){const d=f[z],i=(d==null?void 0:d.image.objectFit)==="cover",x=n.changedTouches[0];let k;if(i&&A.current){const b=Z.getPaddedContainerBounds(A.current);k=x.clientX>=b.left&&x.clientX<=b.right&&x.clientY>=b.top&&x.clientY<=b.bottom}else{const b=A.current?Z.getDisplayedImageRect(A.current):null;if(!b)return;k=x.clientX>=b.x&&x.clientX<=b.x+b.width&&x.clientY>=b.y&&x.clientY<=b.y+b.height}if(!k){n.stopPropagation(),W.current=!0;const b=y=>{y.stopPropagation(),y.preventDefault(),document.removeEventListener("click",b,!0)};document.addEventListener("click",b,!0),N()}}}};return document.addEventListener("touchend",t,{passive:!0}),()=>{document.removeEventListener("touchend",t)}},[l,N,z,f]);const se=(s.type==="scale"||s.type==="fade")&&s.direction==="vert"&&T.type==="drag";g.useEffect(()=>{var y,G;if(!l||!se||!((G=(y=I.current)==null?void 0:y.splide)!=null&&G.root))return;const t=I.current.splide.root,n=30,o=(a,w)=>{if(S.current){const j=Math.abs(a-S.current.x),K=Math.abs(w-S.current.y);(j>0||K>0)&&(F.current=!0)}},c=a=>{S.current&&(a.preventDefault(),o(a.clientX,a.clientY))},m=a=>{S.current&&a.touches.length>0&&(a.preventDefault(),o(a.touches[0].clientX,a.touches[0].clientY))},d=(a,w)=>{if(!S.current||!I.current){S.current=null;return}const j=Math.abs(a-S.current.x),K=Math.abs(w-S.current.y);K>n&&K>j&&I.current.go(w<S.current.y?"+1":"-1"),S.current=null},i=a=>{S.current&&d(a.clientX,a.clientY),document.removeEventListener("pointerup",i),document.removeEventListener("pointercancel",i),document.removeEventListener("pointermove",c)},x=a=>{if(S.current){if(a.changedTouches.length>0){const w=a.changedTouches[0];d(w.clientX,w.clientY)}document.removeEventListener("touchend",x),document.removeEventListener("touchcancel",x),document.removeEventListener("touchmove",m)}},k=a=>{S.current={x:a.clientX,y:a.clientY},F.current=!1,document.addEventListener("pointermove",c,{passive:!1}),document.addEventListener("pointerup",i),document.addEventListener("pointercancel",i)},b=a=>{a.touches.length>0&&(S.current={x:a.touches[0].clientX,y:a.touches[0].clientY},F.current=!1,document.addEventListener("touchmove",m,{passive:!1}),document.addEventListener("touchend",x),document.addEventListener("touchcancel",x))};return t.addEventListener("pointerdown",k),t.addEventListener("touchstart",b),()=>{t.removeEventListener("pointerdown",k),t.removeEventListener("touchstart",b),document.removeEventListener("pointermove",c),document.removeEventListener("pointerup",i),document.removeEventListener("pointercancel",i),document.removeEventListener("touchmove",m),document.removeEventListener("touchend",x),document.removeEventListener("touchcancel",x),S.current=null,F.current=!1}},[l,se,ce]);const ke={backgroundColor:B.color,backdropFilter:`blur(${B.blur}px)`,animationDuration:`${parseInt(q.duration)}ms`,animationTimingFunction:"ease",animationFillMode:"both"};return typeof document>"u"||!document.getElementById(R)?null:Ae.createPortal(u.jsxs(u.Fragment,{children:[u.jsx("div",{ref:r?null:C,className:$(e.background,te?Se:Ce,{[e.editor]:r},{[e.hidden]:!l}),style:{...ke,...Le&&!r&&!te?{position:"absolute"}:{}}}),u.jsxs("div",{ref:r?C:null,className:$(e.contentStyle,te?Be:Ie,{[e.editor]:r},{[e.hidden]:!l}),style:{animationDuration:`${parseInt(q.duration)}ms`,animationTimingFunction:"ease",animationFillMode:"both"},children:[u.jsx(fe.Splide2,{onMove:t=>Y(t.index),ref:I,className:e.lightboxSplide,options:{arrows:!1,speed:s.duration?parseInt(s.duration):500,direction:s.direction==="horiz"||s.type==="fade"||s.type==="scale"?"ltr":"ttb",pagination:!1,drag:T.type==="drag"&&!se,perPage:1,width:"100%",height:"100%",type:s.type==="fade"||s.type==="scale"?"fade":"loop",padding:0,rewind:T.repeat!=="close",start:0},style:{"--splide-speed":s.duration},children:f.map((t,n)=>{const o=J(P.position,P.offset,r),c=`${h.scalingValue(P.padding.top,r)} ${h.scalingValue(P.padding.right,r)} ${h.scalingValue(P.padding.bottom,r)} ${h.scalingValue(P.padding.left,r)}`,m=s.type==="scale"?(()=>{const{transform:d,...i}=o;return{...i,position:"absolute",padding:c,boxSizing:"border-box","--position-transform":d||"none"}})():{...o,position:"absolute",padding:c,boxSizing:"border-box"};return u.jsx(fe.SplideSlide,{children:u.jsx("div",{className:e.imgWrapper,onClick:me,children:u.jsx("img",{ref:n===z?A:null,className:$(e.imageStyle,{[e.contain]:t.image.objectFit==="contain",[e.cover]:t.image.objectFit==="cover",[e.scaleSlide]:s.type==="scale"}),src:t.image.assetId,alt:t.image.name??"",style:{...m,pointerEvents:t.image.objectFit==="contain"?"none":"auto"}})})},n)})},ce),v.isActive&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:$(e.arrow,{[e.arrowVertical]:s.direction==="vert"}),style:{color:v.color,"--arrow-hover-color":v.hover},children:u.jsxs("button",{className:e.arrowInner,style:{transform:`translate(${h.scalingValue(v.offset.x,r)}, ${h.scalingValue(v.offset.y*(s.direction==="horiz"?1:-1),r)}) scale(${v.scale}) rotate(${s.direction==="horiz"?"0deg":"90deg"})`},onClick:()=>{var t;return(t=I.current)==null?void 0:t.go("-1")},"aria-label":"Previous",children:[v.arrowsImgUrl&&u.jsx(ae.SvgImage,{url:v.arrowsImgUrl,fill:v.color,hoverFill:v.hover,className:$(e.arrowImg,e.mirror)}),!v.arrowsImgUrl&&u.jsx(_e,{color:v.color,className:$(e.arrowIcon,e.arrowImg,e.mirror)})]})}),u.jsx("div",{className:$(e.arrow,e.nextArrow,{[e.arrowVertical]:s.direction==="vert"}),style:{color:v.color,"--arrow-hover-color":v.hover},children:u.jsxs("button",{className:e.arrowInner,style:{transform:`translate(${h.scalingValue(v.offset.x*(s.direction==="horiz"?-1:1),r)}, ${h.scalingValue(v.offset.y,r)}) scale(${v.scale}) rotate(${s.direction==="horiz"?"0deg":"90deg"})`},onClick:()=>{var t;return(t=I.current)==null?void 0:t.go("+1")},"aria-label":"Next",children:[v.arrowsImgUrl&&u.jsx(ae.SvgImage,{url:v.arrowsImgUrl,fill:v.color,hoverFill:v.hover,className:e.arrowImg}),!v.arrowsImgUrl&&u.jsx(_e,{color:v.color,className:$(e.arrowIcon,e.arrowImg)})]})})]}),B.closeIconUrl&&(()=>{const t=J(B.closeIconAlign,B.closeIconOffset,r),n=`scale(${B.closeIconScale})`,o=t.transform?`${t.transform} ${n}`:n;return u.jsx("button",{className:e.closeButton,style:{...t,transform:o},onClick:N,"aria-label":"Close lightbox",children:u.jsx(ae.SvgImage,{url:B.closeIconUrl,fill:B.closeIconColor??"#000000",hoverFill:B.closeIconHover??"#cccccc"})})})(),M&&M.isActive&&p.imageCaption&&((ge=f[z])==null?void 0:ge.imageCaption)&&u.jsx("div",{className:e.caption,style:{...J(M.alignment,M.offset,r),fontFamily:je.normalizeFontFamilyCssValue(H.fontFamily),fontWeight:H.fontWeight,fontStyle:H.fontStyle,width:O.sizing==="auto"?"max-content":h.scalingValue(O.width,r),letterSpacing:h.scalingValue(ve,r),wordSpacing:h.scalingValue(be,r),textAlign:xe,fontSize:h.scalingValue(le.fontSize,r),lineHeight:h.scalingValue(le.lineHeight,r),textTransform:Q.textTransform??"none",textDecoration:Q.textDecoration??"none",fontVariant:Q.fontVariant??"normal",color:we},onClick:t=>t.stopPropagation(),children:u.jsx("div",{"data-styles":"imageCaption",className:e.captionTextInner,style:{"--link-color":M.linkColor,"--link-hover-color":M.linkHoverColor},children:u.jsx(Te.RichTextRenderer,{content:f[z].imageCaption})})}),_.isActive&&(()=>{const[t,n]=_.position.split("-"),o=s.direction==="horiz"?`${t}-left`:_.position,c=J(o,_.offset,r),m=()=>{if(s.direction==="horiz"){if(n==="left")return"flex-start";if(n==="center")return"center";if(n==="right")return"flex-end"}else{if(t==="top")return"flex-start";if(t==="middle")return"center";if(t==="bottom")return"flex-end"}return"flex-start"};return u.jsx("div",{ref:he,className:e.thumbsWrapper,onClick:d=>Re(d),style:{position:r?"absolute":"fixed",...c,...s.direction==="horiz"?{maxWidth:"100vw",width:"100%",overflowX:"auto",overflowY:"hidden"}:{maxHeight:"100vh",overflowY:"auto",overflowX:"hidden"}},children:u.jsx("div",{className:$(e.thumbsContainer,{[e.thumbsContainerVertical]:s.direction==="vert",[e.thumbsAlignStart]:_.align==="start",[e.thumbsAlignCenter]:_.align==="center",[e.thumbsAlignEnd]:_.align==="end"}),style:{gap:h.scalingValue(_.grid.gap,r),justifyContent:ye?"flex-start":m()},children:f.map((d,i)=>{const x=i===z,k=ue[i],y=_.grid.size*(x?_.activeState.scale:1),G=()=>{if(_.fit!=="fit")return{};if(!k)return s.direction==="horiz"?{height:h.scalingValue(y,r)}:{width:h.scalingValue(y,r)};const a=k.width/k.height;if(s.direction==="horiz"){const w=y,j=w*a;return{width:h.scalingValue(j,r),height:h.scalingValue(w,r)}}else{const w=y,j=w/a;return{width:h.scalingValue(w,r),height:h.scalingValue(j,r)}}};return u.jsx("button",{className:e.thumbItem,style:{...s.direction==="horiz"&&_.fit!=="fit"?{height:h.scalingValue(y,r)}:{},...s.direction==="vert"&&_.fit!=="fit"?{width:h.scalingValue(y,r)}:{},..._.fit==="cover"?{width:h.scalingValue(y,r),height:h.scalingValue(y,r)}:{},...G(),transition:x?"all 0.25s ease-out":"none",opacity:x?_.activeState.opacity/100:_.opacity/100,"--thumb-hover":_.activeState.opacity/100},onClick:a=>{var w;a.stopPropagation(),Y(i),(w=I.current)==null||w.go(i)},onMouseEnter:()=>{var a;_.triggers==="hov"&&((a=I.current)==null||a.go(i))},children:u.jsx("img",{src:d.image.assetId,alt:d.image.name??"",onLoad:a=>{const w=a.currentTarget;w.naturalWidth&&w.naturalHeight&&de(j=>({...j,[i]:{width:w.naturalWidth,height:w.naturalHeight}}))},style:{objectFit:_.fit==="cover"?"cover":"contain",..._.fit==="fit"?{maxWidth:"100%",maxHeight:"100%",objectFit:"contain"}:{},..._.fit==="cover"?{width:"100%",height:"100%"}:{}}})},`${d.image.name}-${i}`)})})})})()]})]}),document.getElementById(R))};function _e({color:l,className:L}){return u.jsx("svg",{viewBox:"0 0 10 18",className:L,children:u.jsx("g",{id:"Symbols",stroke:"none",strokeWidth:"1",fillRule:"evenodd",children:u.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:l,transform:"translate(5, 9) rotate(-90) translate(-5, -9)"})})})}exports.LightboxGallery=xt;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),g=require("react"),Ae=require("react-dom"),h=require("./scalingValue-CSHYgTZl.js"),ae=require("./SvgImage-_QN8ngad.js"),$=require("classnames"),fe=require("./react-splide.esm-CabaEmHi.js"),Te=require("./RichTextRenderer-DEFXh5o6.js"),Z=require("./getImageRect-BQhQXvT8.js"),pe=require("./getColorAlpha-CoSseoCn.js"),je=require("./textStylesToCss-CNN3zZTV.js"),$e="LightBox-module__hidden___9s-9x",ze="LightBox-module__heroImage___sTxNF",Fe="LightBox-module__background___rm9ml",Ne="LightBox-module__editor___4ACaY",Oe="LightBox-module__contentStyle___Bgnsq",We="LightBox-module__imageStyle___tLIlB",Ee="LightBox-module__imgWrapper___LuFUp",De="LightBox-module__contain___8-yaS",Me="LightBox-module__cover___hNvOG",Pe="LightBox-module__caption___b6L2I",Xe="LightBox-module__captionTextInner___rCGNH",He="LightBox-module__lightboxSplide___XFuWC",Ye="LightBox-module__arrow___iz38X",Ue="LightBox-module__arrowVertical___Zfz81",qe="LightBox-module__nextArrow___zkAQN",Ge="LightBox-module__arrowInner___p48sW",Ke="LightBox-module__arrowIcon___3VaFf",Ze="LightBox-module__arrowImg___pNV88",Je="LightBox-module__mirror___pjeXc",Qe="LightBox-module__thumbsWrapper___GB-nU",et="LightBox-module__thumbsContainerVertical___wttk5",tt="LightBox-module__thumbsContainer___osSma",nt="LightBox-module__thumbsAlignStart___MO6tY",rt="LightBox-module__thumbsAlignCenter___Q4sUx",ot="LightBox-module__thumbsAlignEnd___p4y9R",it="LightBox-module__thumbItem___HvnF3",st="LightBox-module__closeButton___g2khP",at="LightBox-module__fadeIn___0m5GW",lt="LightBox-module__slideInLeft___gPYwC",ct="LightBox-module__slideInRight___S-pPp",ut="LightBox-module__slideInTop___DFdAj",dt="LightBox-module__slideInBottom___m27kZ",ht="LightBox-module__fadeOut___55qBR",mt="LightBox-module__slideOutLeft___NvU7P",gt="LightBox-module__slideOutRight___SK7eC",ft="LightBox-module__slideOutTop___Vgg0z",pt="LightBox-module__slideOutBottom___nJ0Ef",_t="LightBox-module__scaleSlide___vZriG",e={hidden:$e,heroImage:ze,background:Fe,editor:Ne,contentStyle:Oe,imageStyle:We,imgWrapper:Ee,contain:De,cover:Me,caption:Pe,captionTextInner:Xe,lightboxSplide:He,arrow:Ye,arrowVertical:Ue,nextArrow:qe,arrowInner:Ge,arrowIcon:Ke,arrowImg:Ze,mirror:Je,thumbsWrapper:Qe,thumbsContainerVertical:et,thumbsContainer:tt,thumbsAlignStart:nt,thumbsAlignCenter:rt,thumbsAlignEnd:ot,thumbItem:it,closeButton:st,fadeIn:at,slideInLeft:lt,slideInRight:ct,slideInTop:ut,slideInBottom:dt,fadeOut:ht,slideOutLeft:mt,slideOutRight:gt,slideOutTop:ft,slideOutBottom:pt,scaleSlide:_t},J=(l,L,f)=>{const p={},[V,R]=l.split("-");return V==="top"?(p.top="0",p.bottom="auto"):V==="middle"?(p.top="50%",p.bottom="auto"):V==="bottom"&&(p.top="auto",p.bottom="0"),R==="left"?(p.left="0",p.right="auto"):R==="center"?(p.left="50%",p.right="auto"):R==="right"&&(p.left="auto",p.right="0"),V==="middle"&&R==="center"?p.transform=`translate(calc(-50% + ${h.scalingValue(L.x,f)}), calc(-50% + ${h.scalingValue(L.y,f)}))`:V==="middle"?p.transform=`translate(${h.scalingValue(L.x,f)}, calc(-50% + ${h.scalingValue(L.y,f)}))`:R==="center"?p.transform=`translate(calc(-50% + ${h.scalingValue(L.x,f)}), ${h.scalingValue(L.y,f)})`:p.transform=`translate(${h.scalingValue(L.x,f)}, ${h.scalingValue(L.y,f)})`,p};function vt(l,L){const f=(()=>{if(l==="fade in")return e.fadeIn;if(l==="slide in"||l==="mix")switch(L){case"left":return e.slideInLeft;case"right":return e.slideInRight;case"top":return e.slideInTop;case"bottom":return e.slideInBottom;default:return e.slideInRight}return e.fadeIn})(),p=(()=>{if(l==="fade in"||l==="mix")return e.fadeIn;if(l==="slide in")switch(L){case"left":return e.slideInLeft;case"right":return e.slideInRight;case"top":return e.slideInTop;case"bottom":return e.slideInBottom;default:return e.slideInRight}return e.fadeIn})(),V=(()=>{if(l==="fade in"||l==="mix")return e.fadeOut;if(l==="slide in")switch(L){case"left":return e.slideOutLeft;case"right":return e.slideOutRight;case"top":return e.slideOutTop;case"bottom":return e.slideOutBottom;default:return e.slideOutRight}return e.fadeOut})(),R=(()=>{if(l==="fade in")return e.fadeOut;if(l==="slide in"||l==="mix")switch(L){case"left":return e.slideOutLeft;case"right":return e.slideOutRight;case"top":return e.slideOutTop;case"bottom":return e.slideOutBottom;default:return e.slideOutRight}return e.fadeOut})();return{appearClass:f,backdropAppearClass:p,backdropDisappearClass:V,disappearClass:R}}const xt=({settings:l,content:L,styles:f,portalId:p,activeEvent:V,isEditor:R,isPreviewMode:r})=>{const[X,O]=g.useState(!1),{assetId:H}=l.thumbnailBlock.cover;return g.useEffect(()=>{V==="close"&&O(!1),V==="open"&&O(!0)},[V]),u.jsxs(u.Fragment,{children:[u.jsx("img",{src:H,alt:"Cover",className:e.heroImage,onClick:()=>O(!0)}),u.jsx(bt,{isOpen:X,onClose:()=>O(!1),content:L,settings:l,lightboxStyles:f,portalId:p,isEditor:R})]})},bt=({isOpen:l,onClose:L,content:f,lightboxStyles:p,settings:V,portalId:R,isEditor:r,metadata:X})=>{var ge;const{widthSettings:O,fontSettings:H,letterSpacing:ve,textAlign:xe,wordSpacing:be,fontSizeLineHeight:le,textAppearance:Q,color:we}=p.imageCaption??{},[z,Y]=g.useState(0),[ce,ee]=g.useState(0),[te,ne]=g.useState(!1),[Le,U]=g.useState(!1),[ue,de]=g.useState({}),I=g.useRef(null),re=g.useRef(null),A=g.useRef(null),W=g.useRef(!1),C=g.useRef(null),E=g.useRef(null),D=g.useRef(null),S=g.useRef(null),F=g.useRef(!1),he=g.useRef(null),[ye,oe]=g.useState(!1),{appear:q,triggers:T,slider:s,thumbnail:_,controls:v,area:B,caption:M,layout:P}=V.lightboxBlock,{appearClass:Ie,backdropAppearClass:Ce,backdropDisappearClass:Se,disappearClass:Be}=vt(q.type,q.direction),ie=(X==null?void 0:X.itemId)??null;g.useEffect(()=>{const t=()=>{setTimeout(()=>{var o,c;(c=(o=I.current)==null?void 0:o.splide)==null||c.refresh()},16)},n=()=>{ee(o=>o+1)};return window.addEventListener("ArticleEditor.Layout:change",t),window.addEventListener("ArticleEditor.ComponentContent:change",n),()=>{window.removeEventListener("ArticleEditor.Layout:change",t),window.removeEventListener("ArticleEditor.ComponentContent:change",n)}},[]),g.useEffect(()=>{if(!l||!_.isActive){oe(!1);return}const t=he.current;if(!t)return;const n=()=>{s.direction==="horiz"?oe(t.scrollWidth>t.clientWidth):oe(t.scrollHeight>t.clientHeight)};n();const o=new ResizeObserver(n);return o.observe(t),()=>o.disconnect()},[l,_.isActive,f.length,ue,s.direction]);const N=g.useCallback(()=>{const t=window.matchMedia("(max-width: 768px)").matches,n=pe.getColorAlpha(B.color);t&&!r&&n>.9&&(document.body.style.backgroundColor=""),ne(!0),W.current=!0;const o=c=>{c.target===C.current&&c.animationName&&(C.current&&E.current&&C.current.removeEventListener("animationend",E.current),E.current=null,W.current&&(W.current=!1,L()),ne(!1))};C.current&&(E.current=o,C.current.addEventListener("animationend",o))},[L,B.color,r]),Ve=(t,n,o)=>{var c,m;if(t){if(T.type==="click"&&T.switch==="image")T.repeat==="close"&&z===f.length-1?N():(c=I.current)==null||c.go("+1");else if(T.type==="click"&&T.switch==="50/50"){const d=t.getBoundingClientRect(),i=n-d.left,x=o-d.top,k=d.width,b=d.height;let y;s.direction==="horiz"?y=i<k/2?"-1":"+1":y=x<b/2?"-1":"+1",(m=I.current)==null||m.go(y)}}},me=t=>{if(F.current){F.current=!1;return}const n=f[z],o=(n==null?void 0:n.image.objectFit)==="cover";let c,m;if("changedTouches"in t&&t.changedTouches.length>0)c=t.changedTouches[0].clientX,m=t.changedTouches[0].clientY;else if("clientX"in t)c=t.clientX,m=t.clientY;else return;let d;if(o&&A.current){const i=Z.getPaddedContainerBounds(A.current);d=c>=i.left&&c<=i.right&&m>=i.top&&m<=i.bottom}else{const i=A.current?Z.getDisplayedImageRect(A.current):null;if(!i){t.target===t.currentTarget&&N();return}d=c>=i.x&&c<=i.x+i.width&&m>=i.y&&m<=i.y+i.height}d?Ve(A.current,c,m):N()},Re=t=>{const n=t.target;(n.classList.contains(e.thumbsWrapper)||n.classList.contains(e.thumbsContainer))&&me(t)};g.useEffect(()=>{if(!l)return;const t=n=>{var o,c;if(n.key==="Escape"){N();return}if(n.key==="ArrowRight"){Y(m=>(m+1)%Math.max(f.length,1)),(o=I.current)==null||o.go("+1");return}n.key==="ArrowLeft"&&(Y(m=>(m-1+Math.max(f.length,1))%Math.max(f.length,1)),(c=I.current)==null||c.go("-1"))};return window.addEventListener("keydown",t),()=>{window.removeEventListener("keydown",t)}},[l,N,f.length]),g.useEffect(()=>{if(l){if(Y(0),ee(n=>n+1),W.current=!1,ne(!1),U(!1),de({}),!ie)return;const t=new CustomEvent("page-overlay",{detail:{itemId:ie}});window.dispatchEvent(t)}return()=>{C.current&&E.current&&(C.current.removeEventListener("animationend",E.current),E.current=null),U(!1)}},[l,ie]),g.useEffect(()=>{re.current!==null&&re.current!==s.type&&ee(t=>t+1),re.current=s.type},[s.type]),g.useEffect(()=>{if(!l)return;const t=document.body.style.overflow,n=window.matchMedia("(max-width: 768px)").matches,o=pe.getColorAlpha(B.color);document.body.style.overflow="hidden",U(!1);const c=d=>{d.target===C.current&&!W.current&&d.animationName&&(n&&!r&&o>.9&&(document.body.style.backgroundColor=B.color),U(!0),C.current&&D.current&&C.current.removeEventListener("animationend",D.current),D.current=null)};C.current&&(D.current=c,C.current.addEventListener("animationend",c));const m=d=>{const i=d.target;i&&(i.closest(`.${e.thumbsWrapper}`)||i.closest(`.${e.thumbsContainer}`))||s.type!=="slide"&&d.preventDefault()};return document.addEventListener("touchmove",m,{passive:!1}),()=>{document.body.style.overflow=t,document.removeEventListener("touchmove",m),C.current&&D.current&&(C.current.removeEventListener("animationend",D.current),D.current=null),U(!1)}},[l,r,B.color,s.type]),g.useEffect(()=>{if(!l)return;const t=n=>{var c,m;if(W.current){n.stopPropagation();return}if(F.current){F.current=!1;return}const o=n.target;if(!(o&&(o.closest(`.${e.thumbsContainer}`)||o.closest(`.${e.thumbItem}`)||o.closest(`.${e.arrow}`)||o.closest(`.${e.closeButton}`)||o.closest(`.${e.caption}`)))){if(s.type==="slide"&&T.type==="drag"&&((m=(c=I.current)==null?void 0:c.splide)!=null&&m.root)){const d=I.current.splide.root;if(o&&(d.contains(o)||d===o))return}if(n.touches.length===0&&n.changedTouches.length>0){const d=f[z],i=(d==null?void 0:d.image.objectFit)==="cover",x=n.changedTouches[0];let k;if(i&&A.current){const b=Z.getPaddedContainerBounds(A.current);k=x.clientX>=b.left&&x.clientX<=b.right&&x.clientY>=b.top&&x.clientY<=b.bottom}else{const b=A.current?Z.getDisplayedImageRect(A.current):null;if(!b)return;k=x.clientX>=b.x&&x.clientX<=b.x+b.width&&x.clientY>=b.y&&x.clientY<=b.y+b.height}if(!k){n.stopPropagation(),W.current=!0;const b=y=>{y.stopPropagation(),y.preventDefault(),document.removeEventListener("click",b,!0)};document.addEventListener("click",b,!0),N()}}}};return document.addEventListener("touchend",t,{passive:!0}),()=>{document.removeEventListener("touchend",t)}},[l,N,z,f]);const se=(s.type==="scale"||s.type==="fade")&&s.direction==="vert"&&T.type==="drag";g.useEffect(()=>{var y,G;if(!l||!se||!((G=(y=I.current)==null?void 0:y.splide)!=null&&G.root))return;const t=I.current.splide.root,n=30,o=(a,w)=>{if(S.current){const j=Math.abs(a-S.current.x),K=Math.abs(w-S.current.y);(j>0||K>0)&&(F.current=!0)}},c=a=>{S.current&&(a.preventDefault(),o(a.clientX,a.clientY))},m=a=>{S.current&&a.touches.length>0&&(a.preventDefault(),o(a.touches[0].clientX,a.touches[0].clientY))},d=(a,w)=>{if(!S.current||!I.current){S.current=null;return}const j=Math.abs(a-S.current.x),K=Math.abs(w-S.current.y);K>n&&K>j&&I.current.go(w<S.current.y?"+1":"-1"),S.current=null},i=a=>{S.current&&d(a.clientX,a.clientY),document.removeEventListener("pointerup",i),document.removeEventListener("pointercancel",i),document.removeEventListener("pointermove",c)},x=a=>{if(S.current){if(a.changedTouches.length>0){const w=a.changedTouches[0];d(w.clientX,w.clientY)}document.removeEventListener("touchend",x),document.removeEventListener("touchcancel",x),document.removeEventListener("touchmove",m)}},k=a=>{S.current={x:a.clientX,y:a.clientY},F.current=!1,document.addEventListener("pointermove",c,{passive:!1}),document.addEventListener("pointerup",i),document.addEventListener("pointercancel",i)},b=a=>{a.touches.length>0&&(S.current={x:a.touches[0].clientX,y:a.touches[0].clientY},F.current=!1,document.addEventListener("touchmove",m,{passive:!1}),document.addEventListener("touchend",x),document.addEventListener("touchcancel",x))};return t.addEventListener("pointerdown",k),t.addEventListener("touchstart",b),()=>{t.removeEventListener("pointerdown",k),t.removeEventListener("touchstart",b),document.removeEventListener("pointermove",c),document.removeEventListener("pointerup",i),document.removeEventListener("pointercancel",i),document.removeEventListener("touchmove",m),document.removeEventListener("touchend",x),document.removeEventListener("touchcancel",x),S.current=null,F.current=!1}},[l,se,ce]);const ke={backgroundColor:B.color,backdropFilter:`blur(${B.blur}px)`,animationDuration:`${parseInt(q.duration)}ms`,animationTimingFunction:"ease",animationFillMode:"both"};return typeof document>"u"||!document.getElementById(R)?null:Ae.createPortal(u.jsxs(u.Fragment,{children:[u.jsx("div",{ref:r?null:C,className:$(e.background,te?Se:Ce,{[e.editor]:r},{[e.hidden]:!l}),style:{...ke,...Le&&!r&&!te?{position:"absolute"}:{}}}),u.jsxs("div",{ref:r?C:null,className:$(e.contentStyle,te?Be:Ie,{[e.editor]:r},{[e.hidden]:!l}),style:{animationDuration:`${parseInt(q.duration)}ms`,animationTimingFunction:"ease",animationFillMode:"both"},children:[u.jsx(fe.Splide2,{onMove:t=>Y(t.index),ref:I,className:e.lightboxSplide,options:{arrows:!1,speed:s.duration?parseInt(s.duration):500,direction:s.direction==="horiz"||s.type==="fade"||s.type==="scale"?"ltr":"ttb",pagination:!1,drag:T.type==="drag"&&!se,perPage:1,width:"100%",height:"100%",type:s.type==="fade"||s.type==="scale"?"fade":"loop",padding:0,rewind:T.repeat!=="close",start:0},style:{"--splide-speed":s.duration},children:f.map((t,n)=>{const o=J(P.position,P.offset,r),c=`${h.scalingValue(P.padding.top,r)} ${h.scalingValue(P.padding.right,r)} ${h.scalingValue(P.padding.bottom,r)} ${h.scalingValue(P.padding.left,r)}`,m=s.type==="scale"?(()=>{const{transform:d,...i}=o;return{...i,position:"absolute",padding:c,boxSizing:"border-box","--position-transform":d||"none"}})():{...o,position:"absolute",padding:c,boxSizing:"border-box"};return u.jsx(fe.SplideSlide,{children:u.jsx("div",{className:e.imgWrapper,onClick:me,children:u.jsx("img",{ref:n===z?A:null,className:$(e.imageStyle,{[e.contain]:t.image.objectFit==="contain",[e.cover]:t.image.objectFit==="cover",[e.scaleSlide]:s.type==="scale"}),src:t.image.assetId,alt:t.image.name??"",style:{...m,pointerEvents:t.image.objectFit==="contain"?"none":"auto"}})})},n)})},ce),v.isActive&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:$(e.arrow,{[e.arrowVertical]:s.direction==="vert"}),style:{color:v.color,"--arrow-hover-color":v.hover},children:u.jsxs("button",{className:e.arrowInner,style:{transform:`translate(${h.scalingValue(v.offset.x,r)}, ${h.scalingValue(v.offset.y*(s.direction==="horiz"?1:-1),r)}) scale(${v.scale}) rotate(${s.direction==="horiz"?"0deg":"90deg"})`},onClick:()=>{var t;return(t=I.current)==null?void 0:t.go("-1")},"aria-label":"Previous",children:[v.arrowsImgUrl&&u.jsx(ae.SvgImage,{url:v.arrowsImgUrl,fill:v.color,hoverFill:v.hover,className:$(e.arrowImg,e.mirror)}),!v.arrowsImgUrl&&u.jsx(_e,{color:v.color,className:$(e.arrowIcon,e.arrowImg,e.mirror)})]})}),u.jsx("div",{className:$(e.arrow,e.nextArrow,{[e.arrowVertical]:s.direction==="vert"}),style:{color:v.color,"--arrow-hover-color":v.hover},children:u.jsxs("button",{className:e.arrowInner,style:{transform:`translate(${h.scalingValue(v.offset.x*(s.direction==="horiz"?-1:1),r)}, ${h.scalingValue(v.offset.y,r)}) scale(${v.scale}) rotate(${s.direction==="horiz"?"0deg":"90deg"})`},onClick:()=>{var t;return(t=I.current)==null?void 0:t.go("+1")},"aria-label":"Next",children:[v.arrowsImgUrl&&u.jsx(ae.SvgImage,{url:v.arrowsImgUrl,fill:v.color,hoverFill:v.hover,className:e.arrowImg}),!v.arrowsImgUrl&&u.jsx(_e,{color:v.color,className:$(e.arrowIcon,e.arrowImg)})]})})]}),B.closeIconUrl&&(()=>{const t=J(B.closeIconAlign,B.closeIconOffset,r),n=`scale(${B.closeIconScale})`,o=t.transform?`${t.transform} ${n}`:n;return u.jsx("button",{className:e.closeButton,style:{...t,transform:o},onClick:N,"aria-label":"Close lightbox",children:u.jsx(ae.SvgImage,{url:B.closeIconUrl,fill:B.closeIconColor??"#000000",hoverFill:B.closeIconHover??"#cccccc"})})})(),M&&M.isActive&&p.imageCaption&&((ge=f[z])==null?void 0:ge.imageCaption)&&u.jsx("div",{className:e.caption,style:{...J(M.alignment,M.offset,r),fontFamily:je.normalizeFontFamilyCssValue(H.fontFamily),fontWeight:H.fontWeight,fontStyle:H.fontStyle,width:O.sizing==="auto"?"max-content":h.scalingValue(O.width,r),letterSpacing:h.scalingValue(ve,r),wordSpacing:h.scalingValue(be,r),textAlign:xe,fontSize:h.scalingValue(le.fontSize,r),lineHeight:h.scalingValue(le.lineHeight,r),textTransform:Q.textTransform??"none",textDecoration:Q.textDecoration??"none",fontVariant:Q.fontVariant??"normal",color:we},onClick:t=>t.stopPropagation(),children:u.jsx("div",{"data-styles":"imageCaption",className:e.captionTextInner,style:{"--link-color":M.linkColor,"--link-hover-color":M.linkHoverColor},children:u.jsx(Te.RichTextRenderer,{content:f[z].imageCaption})})}),_.isActive&&(()=>{const[t,n]=_.position.split("-"),o=s.direction==="horiz"?`${t}-left`:_.position,c=J(o,_.offset,r),m=()=>{if(s.direction==="horiz"){if(n==="left")return"flex-start";if(n==="center")return"center";if(n==="right")return"flex-end"}else{if(t==="top")return"flex-start";if(t==="middle")return"center";if(t==="bottom")return"flex-end"}return"flex-start"};return u.jsx("div",{ref:he,className:e.thumbsWrapper,onClick:d=>Re(d),style:{position:r?"absolute":"fixed",...c,...s.direction==="horiz"?{maxWidth:"100vw",width:"100%",overflowX:"auto",overflowY:"hidden"}:{maxHeight:"100vh",overflowY:"auto",overflowX:"hidden"}},children:u.jsx("div",{className:$(e.thumbsContainer,{[e.thumbsContainerVertical]:s.direction==="vert",[e.thumbsAlignStart]:_.align==="start",[e.thumbsAlignCenter]:_.align==="center",[e.thumbsAlignEnd]:_.align==="end"}),style:{gap:h.scalingValue(_.grid.gap,r),justifyContent:ye?"flex-start":m()},children:f.map((d,i)=>{const x=i===z,k=ue[i],y=_.grid.size*(x?_.activeState.scale:1),G=()=>{if(_.fit!=="fit")return{};if(!k)return s.direction==="horiz"?{height:h.scalingValue(y,r)}:{width:h.scalingValue(y,r)};const a=k.width/k.height;if(s.direction==="horiz"){const w=y,j=w*a;return{width:h.scalingValue(j,r),height:h.scalingValue(w,r)}}else{const w=y,j=w/a;return{width:h.scalingValue(w,r),height:h.scalingValue(j,r)}}};return u.jsx("button",{className:e.thumbItem,style:{...s.direction==="horiz"&&_.fit!=="fit"?{height:h.scalingValue(y,r)}:{},...s.direction==="vert"&&_.fit!=="fit"?{width:h.scalingValue(y,r)}:{},..._.fit==="cover"?{width:h.scalingValue(y,r),height:h.scalingValue(y,r)}:{},...G(),transition:x?"all 0.25s ease-out":"none",opacity:x?_.activeState.opacity/100:_.opacity/100,"--thumb-hover":_.activeState.opacity/100},onClick:a=>{var w;a.stopPropagation(),Y(i),(w=I.current)==null||w.go(i)},onMouseEnter:()=>{var a;_.triggers==="hov"&&((a=I.current)==null||a.go(i))},children:u.jsx("img",{src:d.image.assetId,alt:d.image.name??"",onLoad:a=>{const w=a.currentTarget;w.naturalWidth&&w.naturalHeight&&de(j=>({...j,[i]:{width:w.naturalWidth,height:w.naturalHeight}}))},style:{objectFit:_.fit==="cover"?"cover":"contain",..._.fit==="fit"?{maxWidth:"100%",maxHeight:"100%",objectFit:"contain"}:{},..._.fit==="cover"?{width:"100%",height:"100%"}:{}}})},`${d.image.name}-${i}`)})})})})()]})]}),document.getElementById(R))};function _e({color:l,className:L}){return u.jsx("svg",{viewBox:"0 0 10 18",className:L,children:u.jsx("g",{id:"Symbols",stroke:"none",strokeWidth:"1",fillRule:"evenodd",children:u.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:l,transform:"translate(5, 9) rotate(-90) translate(-5, -9)"})})})}exports.LightboxGallery=xt;
@@ -2,7 +2,7 @@ import { jsxs as U, Fragment as ue, jsx as g } from "react/jsx-runtime";
2
2
  import { useState as P, useEffect as F, useRef as R, useCallback as Fe } from "react";
3
3
  import { createPortal as Oe } from "react-dom";
4
4
  import { s as d } from "./scalingValue-C9JH5L6O.mjs";
5
- import { S as se } from "./SvgImage-B5mR9y6q.mjs";
5
+ import { S as se } from "./SvgImage-CwRq9-ec.mjs";
6
6
  import N from "classnames";
7
7
  import { S as We, a as Ve } from "./react-splide.esm-DQqds4PL.mjs";
8
8
  import { R as De } from "./RichTextRenderer-D52Xto59.mjs";
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),o=require("react"),Lt=require("react-dom"),fi=require("./useScopedStyles-Bf6yohVQ.js"),G=require("./useLightboxSwipeDismiss-Br9uE5G0.js"),ct=require("./scalingValue-CSHYgTZl.js"),mi=require("./SvgImage-DFlmxAoL.js"),gi=require("./useLightboxScrollLock-Hf16Eq4g.js"),l=require("./utils-033j3qNL.js"),xi=({prefix:e,entries:E,settings:I,isEditor:w,isEditMode:f,isPreviewMode:ee,initialSlideIndex:U=0,enableUrlSync:j=!1,journalItemId:k=null,onBeforeClose:V,onClose:q})=>{const{type:C,coverFit:te,backgroundColor:Ae,imageGap:Ee,maxWidth:Je,maxHeight:H,textTransition:J,title1Width:ie,title2Width:re,title3Width:X,title1MarginLeft:R=0,title2MarginLeft:L=0,title3MarginLeft:pe=0,titleRowMarginBottom:$=0,titleHeaderLayout:Fe="single-row",countCloseGap:ze=0,closeIcon:ve,closeIconMaxWidth:b,closeIconColor:_,closeIconHoverColor:F,contentMarginTop:we=0,iconMarginRight:_t=0}=I,m=o.useCallback(t=>ct.scalingValue(t,w??!1),[w]),Oe=m(Ee??0),Mt=`${Je}%`,Dt=`${H}%`,ye=m(ze),At=m(we),dt=m(_t),ne=l.journalTextFieldsToCss("title1",l.resolveJournalTextFields(I,"title1"),w),ae=l.journalTextFieldsToCss("title2",l.resolveJournalTextFields(I,"title2"),w),ce=l.journalTextFieldsToCss("title3",l.resolveJournalTextFields(I,"title3"),w),Et=l.journalTextFieldsToCss("count",l.resolveJournalTextFields(I,"count"),w),p=Fe==="mobile",z=!w||!!ee,Jt=!f&&(!w||!!ee),u=o.useMemo(()=>l.buildJournalSlides(E,C),[E,C]),[y,Be]=o.useState(U),de=u[y],h=de==null?void 0:de.entry,[ut,ht]=o.useState(!1),[ft,ue]=o.useState(null),[T,he]=o.useState(!1),[mt,Ke]=o.useState(null),[gt,Ge]=o.useState(!1),[Ue,xt]=o.useState(0),[oe,fe]=o.useState(),[be,me]=o.useState(),[$e,Te]=o.useState(null),Z=o.useRef(null),Se=o.useRef(0),Ie=o.useRef(0),pt=o.useRef(0),vt=o.useRef(!1),Ve=o.useRef(null),qe=o.useRef(null),O=o.useRef(null),B=o.useRef(null),Xe=o.useRef(null),wt=o.useRef(null),je=o.useRef(null),yt=o.useCallback(()=>{const t=qe.current;if(!t)return;const n=t.closest(`.${e}-lightbox-content-area`);if(!n)return t.getBoundingClientRect().width;const a=Array.from(n.children).reduce((s,r)=>!(r instanceof HTMLElement)||r.contains(t)?s:s+r.getBoundingClientRect().width,0);return n.getBoundingClientRect().width-a},[e]),Y=o.useCallback(()=>{Z.current&&(clearTimeout(Z.current),Z.current=null)},[]),Ft=o.useCallback(t=>{t===Se.current&&(Ke(null),Ge(!1))},[]),ge=o.useCallback(()=>{f||vt.current||(vt.current=!0,V==null||V(),ht(!1),Ve.current=setTimeout(()=>{q()},300))},[f,V,q]),zt=o.useCallback(t=>!!(t.closest("[data-controls]")||t.closest(`.${e}-close-icon`)),[e]),{isSwipeDragging:Ze,backdropStyle:Ot,mediaAreaStyle:Bt,overlayContentStyle:Kt,swipeHandlers:Gt,dismissAreaStyle:Ut}=G.useLightboxSwipeDismiss({enabled:Jt,onClose:ge,animMs:300,isBlockedTarget:zt}),bt=o.useCallback(t=>{j&&l.setJournalUrlParam(t+1,k,!0)},[j,k]),Ye=o.useCallback(t=>{if(t)return t.getBoundingClientRect().height},[]),le=o.useCallback(t=>{if(u.length===0)return;const n=(t%u.length+u.length)%u.length;if(n===y)return;const a=u[y],s=u[n];Se.current+=1;const r=Se.current,d=J==="fade"&&l.getEntryTitleKey(a==null?void 0:a.entry)!==l.getEntryTitleKey(s==null?void 0:s.entry),x=Ye(O.current),c=d?(()=>{const N=yt();Lt.flushSync(()=>{Te(s.entry)}),O.current&&N&&(O.current.style.width=`${N}px`);const _e=Ye(O.current);return O.current&&(O.current.style.width=""),{measuredIncomingTitlesHeight:_e,incomingTitlesMeasureWidth:N}})():void 0,S=Math.max(x??0,(c==null?void 0:c.measuredIncomingTitlesHeight)??0)||void 0;xt(r),Ke(y),Ge(!0),Be(n),bt(n),pt.current=n,d?(Y(),S&&fe(S),c!=null&&c.incomingTitlesMeasureWidth&&me(c.incomingTitlesMeasureWidth),ue((a==null?void 0:a.entryIndex)??null),he(!0),Ie.current=s.entryIndex,Z.current=setTimeout(()=>{ue(null),he(!1),fe(void 0),me(void 0),Te(null),Z.current=null},400)):(Y(),ue(null),he(!1),fe(void 0),me(void 0),Te(null),Ie.current=s.entryIndex)},[y,Y,yt,Ye,u,bt,J]),xe=o.useCallback(()=>{je.current=null},[]),Vt=o.useCallback(t=>{!z||u.length<=1||t.pointerType==="mouse"&&t.button!==0||t.target.closest("[data-controls]")||(je.current={startX:t.clientX,startY:t.clientY,pointerId:t.pointerId})},[z,u.length]),qt=o.useCallback(t=>{var N;if(!z||u.length<=1||t.pointerType==="mouse"&&t.button!==0)return;if(Ze){xe();return}const n=je.current;if(!n||n.pointerId!==t.pointerId||(xe(),t.target.closest("[data-controls]")))return;const s=t.clientX-n.startX,r=t.clientY-n.startY,d=Math.abs(s),x=Math.abs(r);if(d>=l.STRIP_NAV_SWIPE_MIN_PX&&d>x){le(s>0?y-1:y+1);return}if(d>l.STRIP_NAV_TAP_MAX_PX||x>l.STRIP_NAV_TAP_MAX_PX)return;const c=(N=B.current)==null?void 0:N.getBoundingClientRect(),S=c?c.left+c.width/2:window.innerWidth/2;le(t.clientX<S?y-1:y+1)},[y,z,le,Ze,xe,u.length]),Xt=o.useCallback(t=>{const n=je.current;(n==null?void 0:n.pointerId)===t.pointerId&&xe()},[xe]);gi.useLightboxScrollLock(),o.useEffect(()=>{wt.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const t=requestAnimationFrame(()=>{ht(!0),requestAnimationFrame(()=>{Xe.current?Xe.current.focus():B.current&&B.current.focus()})});return()=>{cancelAnimationFrame(t),Ve.current&&clearTimeout(Ve.current),Z.current&&clearTimeout(Z.current);const n=wt.current;n&&document.contains(n)&&n.focus({preventScroll:!0})}},[]),o.useEffect(()=>{var t;J!=="fade"&&(Ie.current=((t=u[y])==null?void 0:t.entryIndex)??0,Y(),ue(null),he(!1),fe(void 0),me(void 0))},[y,Y,u,J]),o.useEffect(()=>{const t=n=>{if(n.key==="Escape"){ge();return}if(n.key==="ArrowLeft"&&u.length>1){le(y-1);return}if(n.key==="ArrowRight"&&u.length>1){le(y+1);return}if(n.key==="Tab"&&B.current){const a=B.current.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'),s=Array.from(a).filter(c=>!c.closest('[aria-hidden="true"]'));if(s.length===0)return;const r=s[0],d=s[s.length-1],x=document.activeElement;n.shiftKey?(x===r||!B.current.contains(x))&&(n.preventDefault(),d.focus()):(x===d||!B.current.contains(x))&&(n.preventDefault(),r.focus())}};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[le,ge,y,u.length]),o.useLayoutEffect(()=>{Y(),Se.current=0,xt(0),Ke(null),Ge(!1),ue(null),he(!1),fe(void 0),me(void 0),Te(null),Be(t=>{const n=Math.max(0,u.length-1);return Math.min(t,n)})},[Y,E.length,C,u.length]),o.useLayoutEffect(()=>{var a;const t=Math.max(0,u.length-1),n=Math.min(Math.max(0,U),t);pt.current=n,Ie.current=((a=u[n])==null?void 0:a.entryIndex)??0,Be(n)},[U]);const g=ft!==null?E[ft]:null,$t=mt!==null?u[mt]:null,Re=(h==null?void 0:h.title1)||(h==null?void 0:h.title2)||(h==null?void 0:h.title3)||(g==null?void 0:g.title1)||(g==null?void 0:g.title2)||(g==null?void 0:g.title3),Q=l.shouldShowCounter(C,u,E),se=ve!==null,Zt=Re||Q||se,Yt=Q&&se?{gap:ye}:void 0,We=`${e}-titles-stack${p?` ${e}-titles-stack-stacked`:""}`,Tt=`${e}-titles-layer-out${p?` ${e}-titles-layer-out-stacked`:""}`,Qt=`${e}-titles-layer-out`,Qe=(R??0)>0||f,Pt=m($),W=o.useMemo(()=>({title1Width:ie??l.DEFAULT_JOURNAL_TITLE_WIDTHS.title1Width,title2Width:re??l.DEFAULT_JOURNAL_TITLE_WIDTHS.title2Width,title3Width:X??l.DEFAULT_JOURNAL_TITLE_WIDTHS.title3Width}),[ie,re,X]),M=o.useMemo(()=>({title2MarginLeft:L,title3MarginLeft:pe}),[L,pe]),v=o.useMemo(()=>h?l.buildJournalTitleSlots(e,h,ne,ae,ce):[],[e,h,ne,ae,ce]),Ne=o.useMemo(()=>v.map(t=>W[t.widthKey]),[v,W]),D=o.useMemo(()=>l.resolveJournalTitleWidths(v.length,Ne),[v.length,Ne]),St=o.useMemo(()=>l.getEffectiveJournalTitleWidths(v.length,Ne),[v.length,Ne]),ke=o.useMemo(()=>v.filter(t=>t.prefix==="title1"),[v]),A=o.useMemo(()=>v.filter(t=>t.prefix==="title2"||t.prefix==="title3"),[v]),Ce=o.useMemo(()=>l.getRowScopedJournalTitleWidths(ke,W),[ke,W]),K=o.useMemo(()=>l.getRowScopedJournalTitleWidths(A,W),[A,W]),Pe=o.useCallback((t,n)=>{const a=v.findIndex(r=>r.prefix===t.prefix);if(!p||n==="single-row")return{effectiveWidth:St[a]??0,resolvedWidth:D[a]??0,maxWidth:l.getJournalTitleMaxWidth(a,D)};if(n==="two-row-top"){const r=ke.findIndex(d=>d.prefix===t.prefix);return{effectiveWidth:Ce.effective[r]??0,resolvedWidth:Ce.resolved[r]??0,maxWidth:l.getJournalTitleMaxWidth(r,Ce.resolved)}}const s=A.findIndex(r=>r.prefix===t.prefix);return{effectiveWidth:K.effective[s]??0,resolvedWidth:K.resolved[s]??0,maxWidth:l.getJournalTitleMaxWidth(s,K.resolved)}},[v,A,K,St,D,ke,Ce,p]),ei=o.useCallback(t=>l.getJournalTitleBoundaryOffset(v,D,M,t)+(p?0:R??0),[v,D,M,p,R]),ti=o.useCallback(()=>p?0:R??0,[p,R]),et=o.useCallback(t=>A.slice(0,t).reduce((n,a,s)=>n+(a.marginLeftKey?M[a.marginLeftKey]??0:0)+(K.resolved[s]??0),0),[A,K.resolved,M]),ii=o.useCallback(t=>{const n=A[t];return et(t)+(n.marginLeftKey?M[n.marginLeftKey]??0:0)+(K.resolved[t]??0)},[A,K.resolved,et,M]),tt=o.useCallback((t,n,a)=>{if(!p||a==="single-row"){const c=t.findIndex(P=>P.prefix===n.prefix),S=t.map(P=>W[P.widthKey]),N=l.resolveJournalTitleWidths(t.length,S);return{effectiveWidth:l.getEffectiveJournalTitleWidths(t.length,S)[c]??0,resolvedWidth:N[c]??0,maxWidth:l.getJournalTitleMaxWidth(c,N)}}if(a==="two-row-top"){const c=t.filter(P=>P.prefix==="title1"),S=c.findIndex(P=>P.prefix===n.prefix),{resolved:N,effective:_e}=l.getRowScopedJournalTitleWidths(c,W);return{effectiveWidth:_e[S]??0,resolvedWidth:N[S]??0,maxWidth:l.getJournalTitleMaxWidth(S,N)}}const s=t.filter(c=>c.prefix==="title2"||c.prefix==="title3"),r=s.findIndex(c=>c.prefix===n.prefix),{resolved:d,effective:x}=l.getRowScopedJournalTitleWidths(s,W);return{effectiveWidth:x[r]??0,resolvedWidth:d[r]??0,maxWidth:l.getJournalTitleMaxWidth(r,d)}},[W,p]),it=(t,n,a)=>{const s=t.marginLeftKey?M[t.marginLeftKey]??0:0,{effectiveWidth:r,resolvedWidth:d,maxWidth:x}=a??Pe(t,n),c=Math.max(s,l.TITLE_PADDING_HANDLE_WIDTH),S=f&&n==="two-row-top";return i.jsxs("div",{className:`${e}-title-cell`,"data-title":t.prefix,style:{width:m(r),...s>0?{marginLeft:m(s)}:{}},children:[i.jsx("p",{className:t.className,style:t.style,children:t.text}),S&&t.marginLeftKey?i.jsx("div",{"data-controls":t.marginLeftKey,"data-controls-axis":"x","data-controls-min":"0","data-controls-max-fraction":String(d),style:{position:"absolute",top:0,left:m(-s),width:m(c),height:"100%",pointerEvents:"auto"}}):null,S?i.jsx("div",{"data-controls":t.widthKey,"data-controls-axis":"x","data-controls-max-fraction":String(x),"data-controls-variant":"column-width",className:`${e}-title-resize-handle`,style:{position:"absolute",top:0,right:m(-l.TITLE_RESIZE_HANDLE_WIDTH/2),width:m(l.TITLE_RESIZE_HANDLE_WIDTH),height:"100%",pointerEvents:"auto"}}):null]},t.className)},nt=(t="two-row")=>{const n=v.findIndex(r=>r.prefix==="title1"),a=n>=0?D[n]:W.title1Width,s=t==="two-row"&&f;return i.jsx("div",{...s?{"data-controls":"title1MarginLeft","data-controls-axis":"x","data-controls-min":"0","data-controls-max-fraction":String(a)}:{},style:{width:m(R??0),flexShrink:0,alignSelf:"stretch",...s?{pointerEvents:"auto"}:{}}})},ot=()=>i.jsx("span",{className:`${e}-titles-baseline-strut`,style:ne,"aria-hidden":"true",children:" "}),It=()=>i.jsx("span",{className:`${e}-entry-counter`,style:Et,"aria-live":"polite","aria-atomic":"true",children:l.formatSlideCounter(u,y,C,E)}),ni=()=>Q?f&&se?i.jsxs("div",{className:`${e}-text-bar-cell`,style:{flexShrink:0},children:[It(),i.jsx("div",{"data-controls":"countCloseGap","data-controls-axis":"x","data-controls-reverse":"true",style:{position:"absolute",top:0,right:`calc(-0.5 * (${l.getGapControlSize(ye)} + ${ye}))`,width:l.getGapControlSize(ye),height:"100%",pointerEvents:"auto",zIndex:3}})]}):It():null,lt=()=>!Q&&!se?null:i.jsxs("div",{className:`${e}-titles-row-header-controls`,style:Yt,children:[ni(),se?si():null]}),oi=()=>i.jsxs("div",{className:`${e}-titles-row ${e}-titles-row-header`,style:{width:"100%",position:"relative"},children:[Q||Re?ot():null,Qe?nt("single-row"):null,Rt(h),i.jsx("div",{style:{flex:1,minWidth:0},"aria-hidden":"true"}),lt(),at()]}),li=()=>i.jsxs("div",{className:`${e}-titles-row ${e}-titles-row-header`,style:{width:"100%",position:"relative"},children:[Q||Re?ot():null,Qe?nt("single-row"):null,i.jsxs("div",{className:`${e}-titles-row-titles`,style:T&&oe?{minHeight:oe}:void 0,children:[i.jsx("div",{ref:O,className:We,style:{position:"absolute",visibility:"hidden",pointerEvents:"none",left:0,right:0,top:0,width:"100%",height:"auto"},"aria-hidden":"true",children:He($e||h)}),i.jsxs("div",{ref:qe,className:We,style:{position:T?"absolute":"relative",inset:T?0:void 0,width:"100%",...T&&be?{width:be,maxWidth:"100%"}:void 0},children:[g&&T?i.jsx("div",{className:`${Tt} ${e}-titles-fade-out`,children:He(g)}):null,i.jsx("div",{className:`${e}-titles-layer-in${T?` ${e}-titles-layer-in-fading ${e}-titles-fade-in`:""}`,children:He(h)})]})]}),lt(),at()]}),si=()=>i.jsxs("div",{className:`${e}-close-icon`,style:{width:ct.scalingValue(b??0,w),height:ct.scalingValue(b??0,w),marginRight:dt,"--close-icon-hover-color":F},children:[i.jsx("button",{ref:Xe,type:"button",className:`${e}-close-icon-inner`,onClick:ge,"aria-label":"Close",children:i.jsx(mi.SvgImage,{url:ve??"",fill:_,hoverFill:w&&!ee?_:F,className:`${e}-close-icon-img`})}),f&&i.jsx("div",{"data-controls":"iconMarginRight","data-controls-axis":"x","data-controls-reverse":"",className:`${e}-control`,style:{position:"absolute",top:0,left:"100%",width:dt,height:"100%",pointerEvents:"auto"}})]}),jt=(t,n)=>i.jsxs("div",{className:`${e}-titles-row-top`,children:[Q||Re?ot():null,Qe?nt("two-row"):null,n!==void 0?i.jsx("div",{className:`${e}-titles-row-titles`,style:{position:"relative",flex:1,minWidth:0,minHeight:n},children:t}):i.jsxs(i.Fragment,{children:[t,i.jsx("div",{style:{flex:1,minWidth:0},"aria-hidden":"true"})]}),lt()]}),Rt=t=>{if(!t)return null;const n=l.buildJournalTitleSlots(e,t,ne,ae,ce);return i.jsx(i.Fragment,{children:n.map(a=>it(a,"single-row",tt(n,a,"single-row")))})},st=t=>{if(!t)return null;const n=l.buildJournalTitleSlots(e,t,ne,ae,ce),a=n.find(s=>s.prefix==="title1");return a?it(a,"two-row-top",tt(n,a,"two-row-top")):null},rt=(t,n=!1)=>{const a=t?l.buildJournalTitleSlots(e,t,ne,ae,ce):[],s=a.filter(x=>x.prefix==="title2"||x.prefix==="title3"),r=f&&n;return s.length>0||r||($??0)>0?i.jsxs("div",{className:`${e}-titles-row-bottom-wrap`,children:[s.length>0?i.jsxs("div",{className:`${e}-titles-row-bottom`,children:[s.map(x=>it(x,"two-row-bottom",tt(a,x,"two-row-bottom"))),n&&f?i.jsxs(i.Fragment,{children:[ci(),di()]}):null]}):null,($??0)>0||r?i.jsx("div",{"data-controls":r?"titleRowMarginBottom":void 0,"data-controls-axis":r?"y":void 0,"data-controls-reverse":r?"":void 0,className:r?`${e}-control`:void 0,style:{height:Pt,width:"100%",flexShrink:0,pointerEvents:r?"auto":"none"}}):null]}):null},Le=(t,n=!1)=>i.jsxs(i.Fragment,{children:[jt(st(t)),rt(t,n)]}),He=t=>p?i.jsx("div",{className:`${e}-titles-row-two-row`,children:Le(t)}):t?i.jsx("div",{className:`${e}-titles-row`,style:{width:"100%"},children:Rt(t)}):null,ri=()=>{const t=p?-1:v.findIndex(s=>s.prefix==="title1"),n=!p&&(f||(R??0)>0)?(()=>{const s=R??0,r=t>=0?D[t]:W.title1Width,d=Math.max(s,l.TITLE_PADDING_HANDLE_WIDTH);return i.jsx("div",{"data-controls":"title1MarginLeft","data-controls-axis":"x","data-controls-min":"0","data-controls-max-fraction":String(r),style:{position:"absolute",top:0,left:0,width:m(d),height:"100%",pointerEvents:"auto"}},"title1MarginLeft")})():null,a=v.flatMap((s,r)=>{if(!s.marginLeftKey)return[];const d=M[s.marginLeftKey]??0,x=l.getJournalTitleOffsetBeforeSlot(v,D,M,r)+ti(),c=Math.max(d,l.TITLE_PADDING_HANDLE_WIDTH);return i.jsx("div",{"data-controls":s.marginLeftKey,"data-controls-axis":"x","data-controls-min":"0","data-controls-max-fraction":String(D[r]),style:{position:"absolute",top:0,left:m(x),width:m(c),height:"100%",pointerEvents:"auto"}},s.marginLeftKey)});return n?[n,...a]:a},ai=()=>v.map((t,n)=>{const a=l.getJournalTitleMaxWidth(n,D),r=ei(n)-l.TITLE_RESIZE_HANDLE_WIDTH/2;return i.jsx("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:i.jsx("div",{"data-controls":t.widthKey,"data-controls-axis":"x","data-controls-max-fraction":String(a),"data-controls-variant":"column-width",className:`${e}-title-resize-handle`,style:{position:"absolute",top:0,left:m(r),width:m(l.TITLE_RESIZE_HANDLE_WIDTH),height:"100%",pointerEvents:"auto"}})},`${t.widthKey}-junction`)}),ci=()=>A.flatMap((t,n)=>{if(!t.marginLeftKey)return[];const a=M[t.marginLeftKey]??0,s=et(n),r=Math.max(a,l.TITLE_PADDING_HANDLE_WIDTH),{resolvedWidth:d}=Pe(t,"two-row-bottom");return i.jsx("div",{"data-controls":t.marginLeftKey,"data-controls-axis":"x","data-controls-min":"0","data-controls-max-fraction":String(d),style:{position:"absolute",top:0,left:m(s),width:m(r),height:"100%",pointerEvents:"auto"}},t.marginLeftKey)}),di=()=>A.map((t,n)=>{const{maxWidth:a}=Pe(t,"two-row-bottom"),r=ii(n)-l.TITLE_RESIZE_HANDLE_WIDTH/2;return i.jsx("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:i.jsx("div",{"data-controls":t.widthKey,"data-controls-axis":"x","data-controls-max-fraction":String(a),"data-controls-variant":"column-width",className:`${e}-title-resize-handle`,style:{position:"absolute",top:0,left:m(r),width:m(l.TITLE_RESIZE_HANDLE_WIDTH),height:"100%",pointerEvents:"auto"}})},`${t.widthKey}-junction`)}),at=()=>!f||p?null:i.jsxs(i.Fragment,{children:[ri(),ai()]}),Wt=t=>{const n=!t.objectFit&&G.isImageRatioCover(te);return{className:`${e}-slide-image-cell${n?` ${e}-slide-image-cell-cover`:""}`,style:{maxWidth:Mt,maxHeight:Dt,...n?{"--image-aspect-ratio":G.getAspectRatio(te)}:{}}}},Nt=t=>t.objectFit?{className:`${e}-slide-image ${e}-slide-image-custom`,style:{"--image-object-fit":t.objectFit}}:G.isImageRatioCover(te)?{className:`${e}-slide-image ${e}-slide-image-cover`}:{className:`${e}-slide-image ${e}-slide-image-fit`},kt=t=>{if(t.length===0)return null;const n=t.length>1,a=l.getGapControlSize(Oe),s=`calc(-0.5 * (${a} + ${Oe}))`;if(t.length===1){const r=t[0];return i.jsx("div",{...Wt(r),children:i.jsx("img",{...Nt(r),src:r.assetId,alt:r.name??"",draggable:!1})})}return i.jsx("div",{className:`${e}-slide-inner`,style:n?{gap:Oe}:void 0,children:t.map((r,d)=>i.jsxs("div",{...Wt(r),children:[i.jsx("img",{...Nt(r),src:r.assetId,alt:r.name??"",draggable:!1}),f&&n&&d<t.length-1&&i.jsx("div",{"data-controls":"imageGap","data-controls-axis":"x",style:{position:"absolute",top:0,right:s,width:a,height:"100%",pointerEvents:"auto",zIndex:3}})]},`${r.assetId}-${d}`))})},Ct=!!(h!=null&&h.title2||h!=null&&h.title3||g!=null&&g.title2||g!=null&&g.title3||($??0)>0||f),ui=()=>i.jsxs("div",{style:{position:"relative",width:"100%",flex:1,alignSelf:"stretch",display:"flex",flexDirection:"column",minHeight:0,height:"100%"},children:[i.jsx("div",{ref:O,className:We,style:{position:"absolute",visibility:"hidden",pointerEvents:"none",left:0,right:0,top:0,width:"100%",height:"auto"},"aria-hidden":"true",children:Le($e||h)}),i.jsxs("div",{ref:qe,className:`${e}-titles-row-two-row`,style:{...T&&oe?{minHeight:oe}:void 0,...T&&be?{width:be,maxWidth:"100%"}:void 0},children:[jt(i.jsxs("div",{className:We,style:{position:T?"absolute":"relative",inset:T?0:void 0,width:"100%"},children:[g&&T?i.jsx("div",{className:`${Qt} ${e}-titles-fade-out`,children:st(g)}):null,i.jsx("div",{className:`${e}-titles-layer-in${T?` ${e}-titles-layer-in-fading ${e}-titles-fade-in`:""}`,children:st(h)})]}),T&&oe?oe:void 0),Ct?i.jsxs("div",{className:`${e}-titles-row-bottom-area`,children:[g&&T?i.jsx("div",{className:`${Tt} ${e}-titles-layer-out-bottom ${e}-titles-fade-out`,children:rt(g)}):null,i.jsx("div",{className:`${e}-titles-layer-in${T?` ${e}-titles-layer-in-fading ${e}-titles-fade-in`:""}${p?` ${e}-titles-layer-in-stacked`:""}`,children:rt(h,!0)})]}):null]})]}),hi=()=>{const t=Ct;return i.jsxs("div",{style:{position:"relative",width:"100%",alignSelf:"stretch",display:"flex",flexDirection:"column",minHeight:0,...t?{flex:1,height:"100%"}:{}},children:[i.jsx("div",{className:`${e}-titles-row-two-row`,style:t?void 0:{flex:"0 0 auto",height:"auto"},children:Le(h,!0)}),at()]})};return i.jsxs("div",{ref:B,"data-selection":"none",className:`${e}-lightbox${w?` ${e}-lightbox-editor`:""}${f?` ${e}-lightbox-edit-mode`:""}`,onClick:()=>{Ze||ge()},role:"dialog","aria-modal":"true","aria-label":"Journal gallery",tabIndex:se?void 0:-1,style:{opacity:ut?1:0,transition:"opacity 300ms ease",pointerEvents:ut?"auto":"none"},children:[i.jsx("div",{className:`${e}-lightbox-backdrop`,style:{backgroundColor:Ae,...Ot}}),i.jsxs("div",{className:`${e}-lightbox-dismiss-area`,style:Ut,...Gt,children:[i.jsx("div",{className:`${e}-lightbox-content`,style:Bt,onClick:t=>t.stopPropagation(),children:i.jsx("div",{className:`${e}-lightbox-strip`,"data-desktop-nav":z&&u.length>1?"true":"false",onPointerDown:z?Vt:void 0,onPointerUp:z?qt:void 0,onPointerCancel:z?Xt:void 0,children:i.jsxs("div",{className:`${e}-slide-stack`,children:[$t&&gt?i.jsx("div",{className:`${e}-slide-layer-out ${e}-slide-fade-out`,onAnimationEnd:t=>{t.target===t.currentTarget&&Ft(Ue)},children:i.jsx("div",{className:`${e}-slide-area`,children:kt($t.images)})},`slide-out-${Ue}`):null,i.jsx("div",{className:`${e}-slide-layer-in${gt?` ${e}-slide-fade-in`:""}`,children:i.jsx("div",{className:`${e}-slide-area`,children:de?kt(de.images):null})},`slide-in-${Ue}-${y}`)]})})}),i.jsxs("div",{className:`${e}-lightbox-overlay-content`,style:Kt,children:[i.jsx("div",{"data-controls":f?"contentMarginTop":void 0,className:f?`${e}-control`:void 0,style:{height:At,width:"100%"}}),i.jsx("div",{style:{display:"flex",flexDirection:"row",width:"100%",...p?{flex:1,minHeight:0}:{}},children:i.jsx("div",{className:`${e}-lightbox-content-area${p?` ${e}-lightbox-content-area-stacked`:""}`,children:Zt&&i.jsx("div",{className:`${e}-text-bar-cell${p?` ${e}-text-bar-cell-stacked`:""}`,style:p?void 0:{flex:1,minWidth:0,width:"100%"},children:p?J==="fade"?ui():hi():J==="fade"?li():oi()})})})]})]})]})},Me=400,De="cubic-bezier(0.25, 0.1, 0.25, 1)",Ht=1.1,pi=`${((1-1/Ht)/2*100).toFixed(4)}%`;function vi(e){return`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),o=require("react"),Lt=require("react-dom"),hi=require("./useScopedStyles-Bf6yohVQ.js"),G=require("./useLightboxSwipeDismiss-Br9uE5G0.js"),rt=require("./scalingValue-CSHYgTZl.js"),fi=require("./SvgImage-_QN8ngad.js"),mi=require("./useLightboxScrollLock-Hf16Eq4g.js"),l=require("./utils-033j3qNL.js"),gi=({prefix:e,entries:z,settings:I,isEditor:w,isEditMode:f,isPreviewMode:ee,initialSlideIndex:U=0,enableUrlSync:j=!1,journalItemId:k=null,onBeforeClose:V,onClose:q})=>{const{type:C,coverFit:te,backgroundColor:_e,imageGap:De,maxWidth:Ae,maxHeight:H,textTransition:E,title1Width:ie,title2Width:re,title3Width:X,title1MarginLeft:R=0,title2MarginLeft:L=0,title3MarginLeft:pe=0,titleRowMarginBottom:$=0,titleHeaderLayout:ze="single-row",countCloseGap:Ee=0,closeIcon:ve,closeIconMaxWidth:b,closeIconColor:M,closeIconHoverColor:J,contentMarginTop:we=0,iconMarginRight:Ht=0}=I,m=o.useCallback(t=>rt.scalingValue(t,w??!1),[w]),Je=m(De??0),Mt=`${Ae}%`,_t=`${H}%`,ye=m(Ee),Dt=m(we),dt=m(Ht),ne=l.journalTextFieldsToCss("title1",l.resolveJournalTextFields(I,"title1"),w),ae=l.journalTextFieldsToCss("title2",l.resolveJournalTextFields(I,"title2"),w),ce=l.journalTextFieldsToCss("title3",l.resolveJournalTextFields(I,"title3"),w),At=l.journalTextFieldsToCss("count",l.resolveJournalTextFields(I,"count"),w),p=ze==="mobile",F=!w||!!ee,zt=!f&&(!w||!!ee),u=o.useMemo(()=>l.buildJournalSlides(z,C),[z,C]),[y,Fe]=o.useState(U),de=u[y],h=de==null?void 0:de.entry,[ut,ht]=o.useState(!1),[ft,ue]=o.useState(null),[T,he]=o.useState(!1),[mt,Be]=o.useState(null),[gt,Ke]=o.useState(!1),[Oe,xt]=o.useState(0),[oe,fe]=o.useState(),[be,me]=o.useState(),[$e,Te]=o.useState(null),Z=o.useRef(null),Se=o.useRef(0),Ie=o.useRef(0),pt=o.useRef(0),vt=o.useRef(!1),Ge=o.useRef(null),Ue=o.useRef(null),B=o.useRef(null),K=o.useRef(null),Ve=o.useRef(null),wt=o.useRef(null),je=o.useRef(null),yt=o.useCallback(()=>{const t=Ue.current;if(!t)return;const n=t.closest(`.${e}-lightbox-content-area`);if(!n)return t.getBoundingClientRect().width;const a=Array.from(n.children).reduce((s,r)=>!(r instanceof HTMLElement)||r.contains(t)?s:s+r.getBoundingClientRect().width,0);return n.getBoundingClientRect().width-a},[e]),Y=o.useCallback(()=>{Z.current&&(clearTimeout(Z.current),Z.current=null)},[]),Et=o.useCallback(t=>{t===Se.current&&(Be(null),Ke(!1))},[]),ge=o.useCallback(()=>{f||vt.current||(vt.current=!0,V==null||V(),ht(!1),Ge.current=setTimeout(()=>{q()},300))},[f,V,q]),Jt=o.useCallback(t=>!!(t.closest("[data-controls]")||t.closest(`.${e}-close-icon`)),[e]),{isSwipeDragging:qe,backdropStyle:Ft,mediaAreaStyle:Bt,overlayContentStyle:Kt,swipeHandlers:Ot,dismissAreaStyle:Gt}=G.useLightboxSwipeDismiss({enabled:zt,onClose:ge,animMs:300,isBlockedTarget:Jt}),bt=o.useCallback(t=>{j&&l.setJournalUrlParam(t+1,k,!0)},[j,k]),Xe=o.useCallback(t=>{if(t)return t.getBoundingClientRect().height},[]),le=o.useCallback(t=>{if(u.length===0)return;const n=(t%u.length+u.length)%u.length;if(n===y)return;const a=u[y],s=u[n];Se.current+=1;const r=Se.current,d=E==="fade"&&l.getEntryTitleKey(a==null?void 0:a.entry)!==l.getEntryTitleKey(s==null?void 0:s.entry),x=Xe(B.current),c=d?(()=>{const N=yt();Lt.flushSync(()=>{Te(s.entry)}),B.current&&N&&(B.current.style.width=`${N}px`);const Me=Xe(B.current);return B.current&&(B.current.style.width=""),{measuredIncomingTitlesHeight:Me,incomingTitlesMeasureWidth:N}})():void 0,S=Math.max(x??0,(c==null?void 0:c.measuredIncomingTitlesHeight)??0)||void 0;xt(r),Be(y),Ke(!0),Fe(n),bt(n),pt.current=n,d?(Y(),S&&fe(S),c!=null&&c.incomingTitlesMeasureWidth&&me(c.incomingTitlesMeasureWidth),ue((a==null?void 0:a.entryIndex)??null),he(!0),Ie.current=s.entryIndex,Z.current=setTimeout(()=>{ue(null),he(!1),fe(void 0),me(void 0),Te(null),Z.current=null},400)):(Y(),ue(null),he(!1),fe(void 0),me(void 0),Te(null),Ie.current=s.entryIndex)},[y,Y,yt,Xe,u,bt,E]),xe=o.useCallback(()=>{je.current=null},[]),Ut=o.useCallback(t=>{!F||u.length<=1||t.pointerType==="mouse"&&t.button!==0||t.target.closest("[data-controls]")||(je.current={startX:t.clientX,startY:t.clientY,pointerId:t.pointerId})},[F,u.length]),Vt=o.useCallback(t=>{var N;if(!F||u.length<=1||t.pointerType==="mouse"&&t.button!==0)return;if(qe){xe();return}const n=je.current;if(!n||n.pointerId!==t.pointerId||(xe(),t.target.closest("[data-controls]")))return;const s=t.clientX-n.startX,r=t.clientY-n.startY,d=Math.abs(s),x=Math.abs(r);if(d>=l.STRIP_NAV_SWIPE_MIN_PX&&d>x){le(s>0?y-1:y+1);return}if(d>l.STRIP_NAV_TAP_MAX_PX||x>l.STRIP_NAV_TAP_MAX_PX)return;const c=(N=K.current)==null?void 0:N.getBoundingClientRect(),S=c?c.left+c.width/2:window.innerWidth/2;le(t.clientX<S?y-1:y+1)},[y,F,le,qe,xe,u.length]),qt=o.useCallback(t=>{const n=je.current;(n==null?void 0:n.pointerId)===t.pointerId&&xe()},[xe]);mi.useLightboxScrollLock(),o.useEffect(()=>{wt.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const t=requestAnimationFrame(()=>{ht(!0),requestAnimationFrame(()=>{Ve.current?Ve.current.focus():K.current&&K.current.focus()})});return()=>{cancelAnimationFrame(t),Ge.current&&clearTimeout(Ge.current),Z.current&&clearTimeout(Z.current);const n=wt.current;n&&document.contains(n)&&n.focus({preventScroll:!0})}},[]),o.useEffect(()=>{var t;E!=="fade"&&(Ie.current=((t=u[y])==null?void 0:t.entryIndex)??0,Y(),ue(null),he(!1),fe(void 0),me(void 0))},[y,Y,u,E]),o.useEffect(()=>{const t=n=>{if(n.key==="Escape"){ge();return}if(n.key==="ArrowLeft"&&u.length>1){le(y-1);return}if(n.key==="ArrowRight"&&u.length>1){le(y+1);return}if(n.key==="Tab"&&K.current){const a=K.current.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'),s=Array.from(a).filter(c=>!c.closest('[aria-hidden="true"]'));if(s.length===0)return;const r=s[0],d=s[s.length-1],x=document.activeElement;n.shiftKey?(x===r||!K.current.contains(x))&&(n.preventDefault(),d.focus()):(x===d||!K.current.contains(x))&&(n.preventDefault(),r.focus())}};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[le,ge,y,u.length]),o.useLayoutEffect(()=>{Y(),Se.current=0,xt(0),Be(null),Ke(!1),ue(null),he(!1),fe(void 0),me(void 0),Te(null),Fe(t=>{const n=Math.max(0,u.length-1);return Math.min(t,n)})},[Y,z.length,C,u.length]),o.useLayoutEffect(()=>{var a;const t=Math.max(0,u.length-1),n=Math.min(Math.max(0,U),t);pt.current=n,Ie.current=((a=u[n])==null?void 0:a.entryIndex)??0,Fe(n)},[U]);const g=ft!==null?z[ft]:null,$t=mt!==null?u[mt]:null,Re=(h==null?void 0:h.title1)||(h==null?void 0:h.title2)||(h==null?void 0:h.title3)||(g==null?void 0:g.title1)||(g==null?void 0:g.title2)||(g==null?void 0:g.title3),Q=l.shouldShowCounter(C,u,z),se=ve!==null,Xt=Re||Q||se,Zt=Q&&se?{gap:ye}:void 0,We=`${e}-titles-stack${p?` ${e}-titles-stack-stacked`:""}`,Tt=`${e}-titles-layer-out${p?` ${e}-titles-layer-out-stacked`:""}`,Yt=`${e}-titles-layer-out`,Ze=(R??0)>0||f,Qt=m($),W=o.useMemo(()=>({title1Width:ie??l.DEFAULT_JOURNAL_TITLE_WIDTHS.title1Width,title2Width:re??l.DEFAULT_JOURNAL_TITLE_WIDTHS.title2Width,title3Width:X??l.DEFAULT_JOURNAL_TITLE_WIDTHS.title3Width}),[ie,re,X]),_=o.useMemo(()=>({title2MarginLeft:L,title3MarginLeft:pe}),[L,pe]),v=o.useMemo(()=>h?l.buildJournalTitleSlots(e,h,ne,ae,ce):[],[e,h,ne,ae,ce]),Ne=o.useMemo(()=>v.map(t=>W[t.widthKey]),[v,W]),D=o.useMemo(()=>l.resolveJournalTitleWidths(v.length,Ne),[v.length,Ne]),St=o.useMemo(()=>l.getEffectiveJournalTitleWidths(v.length,Ne),[v.length,Ne]),ke=o.useMemo(()=>v.filter(t=>t.prefix==="title1"),[v]),A=o.useMemo(()=>v.filter(t=>t.prefix==="title2"||t.prefix==="title3"),[v]),Ce=o.useMemo(()=>l.getRowScopedJournalTitleWidths(ke,W),[ke,W]),O=o.useMemo(()=>l.getRowScopedJournalTitleWidths(A,W),[A,W]),Ye=o.useCallback((t,n)=>{const a=v.findIndex(r=>r.prefix===t.prefix);if(!p||n==="single-row")return{effectiveWidth:St[a]??0,resolvedWidth:D[a]??0,maxWidth:l.getJournalTitleMaxWidth(a,D)};if(n==="two-row-top"){const r=ke.findIndex(d=>d.prefix===t.prefix);return{effectiveWidth:Ce.effective[r]??0,resolvedWidth:Ce.resolved[r]??0,maxWidth:l.getJournalTitleMaxWidth(r,Ce.resolved)}}const s=A.findIndex(r=>r.prefix===t.prefix);return{effectiveWidth:O.effective[s]??0,resolvedWidth:O.resolved[s]??0,maxWidth:l.getJournalTitleMaxWidth(s,O.resolved)}},[v,A,O,St,D,ke,Ce,p]),Pt=o.useCallback(t=>l.getJournalTitleBoundaryOffset(v,D,_,t)+(p?0:R??0),[v,D,_,p,R]),ei=o.useCallback(()=>p?0:R??0,[p,R]),Qe=o.useCallback(t=>A.slice(0,t).reduce((n,a,s)=>n+(a.marginLeftKey?_[a.marginLeftKey]??0:0)+(O.resolved[s]??0),0),[A,O.resolved,_]),ti=o.useCallback(t=>{const n=A[t];return Qe(t)+(n.marginLeftKey?_[n.marginLeftKey]??0:0)+(O.resolved[t]??0)},[A,O.resolved,Qe,_]),Pe=o.useCallback((t,n,a)=>{if(!p||a==="single-row"){const c=t.findIndex(P=>P.prefix===n.prefix),S=t.map(P=>W[P.widthKey]),N=l.resolveJournalTitleWidths(t.length,S);return{effectiveWidth:l.getEffectiveJournalTitleWidths(t.length,S)[c]??0,resolvedWidth:N[c]??0,maxWidth:l.getJournalTitleMaxWidth(c,N)}}if(a==="two-row-top"){const c=t.filter(P=>P.prefix==="title1"),S=c.findIndex(P=>P.prefix===n.prefix),{resolved:N,effective:Me}=l.getRowScopedJournalTitleWidths(c,W);return{effectiveWidth:Me[S]??0,resolvedWidth:N[S]??0,maxWidth:l.getJournalTitleMaxWidth(S,N)}}const s=t.filter(c=>c.prefix==="title2"||c.prefix==="title3"),r=s.findIndex(c=>c.prefix===n.prefix),{resolved:d,effective:x}=l.getRowScopedJournalTitleWidths(s,W);return{effectiveWidth:x[r]??0,resolvedWidth:d[r]??0,maxWidth:l.getJournalTitleMaxWidth(r,d)}},[W,p]),et=(t,n,a)=>{const s=t.marginLeftKey?_[t.marginLeftKey]??0:0,{effectiveWidth:r,resolvedWidth:d,maxWidth:x}=a??Ye(t,n),c=Math.max(s,l.TITLE_PADDING_HANDLE_WIDTH),S=f&&n==="two-row-top";return i.jsxs("div",{className:`${e}-title-cell`,"data-title":t.prefix,style:{width:m(r),...s>0?{marginLeft:m(s)}:{}},children:[i.jsx("p",{className:t.className,style:t.style,children:t.text}),S&&t.marginLeftKey?i.jsx("div",{"data-controls":t.marginLeftKey,"data-controls-axis":"x","data-controls-min":"0","data-controls-max-fraction":String(d),style:{position:"absolute",top:0,left:m(-s),width:m(c),height:"100%",pointerEvents:"auto"}}):null,S?i.jsx("div",{"data-controls":t.widthKey,"data-controls-axis":"x","data-controls-max-fraction":String(x),"data-controls-variant":"column-width",className:`${e}-title-resize-handle`,style:{position:"absolute",top:0,right:m(-l.TITLE_RESIZE_HANDLE_WIDTH/2),width:m(l.TITLE_RESIZE_HANDLE_WIDTH),height:"100%",pointerEvents:"auto"}}):null]},t.className)},tt=(t="two-row")=>{const n=v.findIndex(r=>r.prefix==="title1"),a=n>=0?D[n]:W.title1Width,s=t==="two-row"&&f;return i.jsx("div",{...s?{"data-controls":"title1MarginLeft","data-controls-axis":"x","data-controls-min":"0","data-controls-max-fraction":String(a)}:{},style:{width:m(R??0),flexShrink:0,alignSelf:"stretch",...s?{pointerEvents:"auto"}:{}}})},it=()=>i.jsx("span",{className:`${e}-titles-baseline-strut`,style:ne,"aria-hidden":"true",children:" "}),It=()=>i.jsx("span",{className:`${e}-entry-counter`,style:At,"aria-live":"polite","aria-atomic":"true",children:l.formatSlideCounter(u,y,C,z)}),ii=()=>Q?f&&se?i.jsxs("div",{className:`${e}-text-bar-cell`,style:{flexShrink:0},children:[It(),i.jsx("div",{"data-controls":"countCloseGap","data-controls-axis":"x","data-controls-reverse":"true",style:{position:"absolute",top:0,right:`calc(-0.5 * (${l.getGapControlSize(ye)} + ${ye}))`,width:l.getGapControlSize(ye),height:"100%",pointerEvents:"auto",zIndex:3}})]}):It():null,nt=()=>!Q&&!se?null:i.jsxs("div",{className:`${e}-titles-row-header-controls`,style:Zt,children:[ii(),se?li():null]}),ni=()=>i.jsxs("div",{className:`${e}-titles-row ${e}-titles-row-header`,style:{width:"100%",position:"relative"},children:[Q||Re?it():null,Ze?tt("single-row"):null,Rt(h),i.jsx("div",{style:{flex:1,minWidth:0},"aria-hidden":"true"}),nt(),st()]}),oi=()=>i.jsxs("div",{className:`${e}-titles-row ${e}-titles-row-header`,style:{width:"100%",position:"relative"},children:[Q||Re?it():null,Ze?tt("single-row"):null,i.jsxs("div",{className:`${e}-titles-row-titles`,style:T&&oe?{minHeight:oe}:void 0,children:[i.jsx("div",{ref:B,className:We,style:{position:"absolute",visibility:"hidden",pointerEvents:"none",left:0,right:0,top:0,width:"100%",height:"auto"},"aria-hidden":"true",children:He($e||h)}),i.jsxs("div",{ref:Ue,className:We,style:{position:T?"absolute":"relative",inset:T?0:void 0,width:"100%",...T&&be?{width:be,maxWidth:"100%"}:void 0},children:[g&&T?i.jsx("div",{className:`${Tt} ${e}-titles-fade-out`,children:He(g)}):null,i.jsx("div",{className:`${e}-titles-layer-in${T?` ${e}-titles-layer-in-fading ${e}-titles-fade-in`:""}`,children:He(h)})]})]}),nt(),st()]}),li=()=>i.jsxs("div",{className:`${e}-close-icon`,style:{width:rt.scalingValue(b??0,w),height:rt.scalingValue(b??0,w),marginRight:dt,"--close-icon-hover-color":J},children:[i.jsx("button",{ref:Ve,type:"button",className:`${e}-close-icon-inner`,onClick:ge,"aria-label":"Close",children:i.jsx(fi.SvgImage,{url:ve??"",fill:M,hoverFill:w&&!ee?M:J,className:`${e}-close-icon-img`})}),f&&i.jsx("div",{"data-controls":"iconMarginRight","data-controls-axis":"x","data-controls-reverse":"",className:`${e}-control`,style:{position:"absolute",top:0,left:"100%",width:dt,height:"100%",pointerEvents:"auto"}})]}),jt=(t,n)=>i.jsxs("div",{className:`${e}-titles-row-top`,children:[Q||Re?it():null,Ze?tt("two-row"):null,n!==void 0?i.jsx("div",{className:`${e}-titles-row-titles`,style:{position:"relative",flex:1,minWidth:0,minHeight:n},children:t}):i.jsxs(i.Fragment,{children:[t,i.jsx("div",{style:{flex:1,minWidth:0},"aria-hidden":"true"})]}),nt()]}),Rt=t=>{if(!t)return null;const n=l.buildJournalTitleSlots(e,t,ne,ae,ce);return i.jsx(i.Fragment,{children:n.map(a=>et(a,"single-row",Pe(n,a,"single-row")))})},ot=t=>{if(!t)return null;const n=l.buildJournalTitleSlots(e,t,ne,ae,ce),a=n.find(s=>s.prefix==="title1");return a?et(a,"two-row-top",Pe(n,a,"two-row-top")):null},lt=(t,n=!1)=>{const a=t?l.buildJournalTitleSlots(e,t,ne,ae,ce):[],s=a.filter(x=>x.prefix==="title2"||x.prefix==="title3"),r=f&&n;return s.length>0||r||($??0)>0?i.jsxs("div",{className:`${e}-titles-row-bottom-wrap`,children:[s.length>0?i.jsxs("div",{className:`${e}-titles-row-bottom`,children:[s.map(x=>et(x,"two-row-bottom",Pe(a,x,"two-row-bottom"))),n&&f?i.jsxs(i.Fragment,{children:[ai(),ci()]}):null]}):null,($??0)>0||r?i.jsx("div",{"data-controls":r?"titleRowMarginBottom":void 0,"data-controls-axis":r?"y":void 0,"data-controls-reverse":r?"":void 0,className:r?`${e}-control`:void 0,style:{height:Qt,width:"100%",flexShrink:0,pointerEvents:r?"auto":"none"}}):null]}):null},Le=(t,n=!1)=>i.jsxs(i.Fragment,{children:[jt(ot(t)),lt(t,n)]}),He=t=>p?i.jsx("div",{className:`${e}-titles-row-two-row`,children:Le(t)}):t?i.jsx("div",{className:`${e}-titles-row`,style:{width:"100%"},children:Rt(t)}):null,si=()=>{const t=p?-1:v.findIndex(s=>s.prefix==="title1"),n=!p&&(f||(R??0)>0)?(()=>{const s=R??0,r=t>=0?D[t]:W.title1Width,d=Math.max(s,l.TITLE_PADDING_HANDLE_WIDTH);return i.jsx("div",{"data-controls":"title1MarginLeft","data-controls-axis":"x","data-controls-min":"0","data-controls-max-fraction":String(r),style:{position:"absolute",top:0,left:0,width:m(d),height:"100%",pointerEvents:"auto"}},"title1MarginLeft")})():null,a=v.flatMap((s,r)=>{if(!s.marginLeftKey)return[];const d=_[s.marginLeftKey]??0,x=l.getJournalTitleOffsetBeforeSlot(v,D,_,r)+ei(),c=Math.max(d,l.TITLE_PADDING_HANDLE_WIDTH);return i.jsx("div",{"data-controls":s.marginLeftKey,"data-controls-axis":"x","data-controls-min":"0","data-controls-max-fraction":String(D[r]),style:{position:"absolute",top:0,left:m(x),width:m(c),height:"100%",pointerEvents:"auto"}},s.marginLeftKey)});return n?[n,...a]:a},ri=()=>v.map((t,n)=>{const a=l.getJournalTitleMaxWidth(n,D),r=Pt(n)-l.TITLE_RESIZE_HANDLE_WIDTH/2;return i.jsx("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:i.jsx("div",{"data-controls":t.widthKey,"data-controls-axis":"x","data-controls-max-fraction":String(a),"data-controls-variant":"column-width",className:`${e}-title-resize-handle`,style:{position:"absolute",top:0,left:m(r),width:m(l.TITLE_RESIZE_HANDLE_WIDTH),height:"100%",pointerEvents:"auto"}})},`${t.widthKey}-junction`)}),ai=()=>A.flatMap((t,n)=>{if(!t.marginLeftKey)return[];const a=_[t.marginLeftKey]??0,s=Qe(n),r=Math.max(a,l.TITLE_PADDING_HANDLE_WIDTH),{resolvedWidth:d}=Ye(t,"two-row-bottom");return i.jsx("div",{"data-controls":t.marginLeftKey,"data-controls-axis":"x","data-controls-min":"0","data-controls-max-fraction":String(d),style:{position:"absolute",top:0,left:m(s),width:m(r),height:"100%",pointerEvents:"auto"}},t.marginLeftKey)}),ci=()=>A.map((t,n)=>{const{maxWidth:a}=Ye(t,"two-row-bottom"),r=ti(n)-l.TITLE_RESIZE_HANDLE_WIDTH/2;return i.jsx("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:i.jsx("div",{"data-controls":t.widthKey,"data-controls-axis":"x","data-controls-max-fraction":String(a),"data-controls-variant":"column-width",className:`${e}-title-resize-handle`,style:{position:"absolute",top:0,left:m(r),width:m(l.TITLE_RESIZE_HANDLE_WIDTH),height:"100%",pointerEvents:"auto"}})},`${t.widthKey}-junction`)}),st=()=>!f||p?null:i.jsxs(i.Fragment,{children:[si(),ri()]}),Wt=t=>{const n=!t.objectFit&&G.isImageRatioCover(te);return{className:`${e}-slide-image-cell${n?` ${e}-slide-image-cell-cover`:""}`,style:{maxWidth:Mt,maxHeight:_t,...n?{"--image-aspect-ratio":G.getAspectRatio(te)}:{}}}},Nt=t=>t.objectFit?{className:`${e}-slide-image ${e}-slide-image-custom`,style:{"--image-object-fit":t.objectFit}}:G.isImageRatioCover(te)?{className:`${e}-slide-image ${e}-slide-image-cover`}:{className:`${e}-slide-image ${e}-slide-image-fit`},kt=t=>{if(t.length===0)return null;const n=t.length>1,a=l.getGapControlSize(Je),s=`calc(-0.5 * (${a} + ${Je}))`;if(t.length===1){const r=t[0];return i.jsx("div",{...Wt(r),children:i.jsx("img",{...Nt(r),src:r.assetId,alt:r.name??"",draggable:!1})})}return i.jsx("div",{className:`${e}-slide-inner`,style:n?{gap:Je}:void 0,children:t.map((r,d)=>i.jsxs("div",{...Wt(r),children:[i.jsx("img",{...Nt(r),src:r.assetId,alt:r.name??"",draggable:!1}),f&&n&&d<t.length-1&&i.jsx("div",{"data-controls":"imageGap","data-controls-axis":"x",style:{position:"absolute",top:0,right:s,width:a,height:"100%",pointerEvents:"auto",zIndex:3}})]},`${r.assetId}-${d}`))})},Ct=!!(h!=null&&h.title2||h!=null&&h.title3||g!=null&&g.title2||g!=null&&g.title3||($??0)>0||f),di=()=>i.jsxs("div",{style:{position:"relative",width:"100%",flex:1,alignSelf:"stretch",display:"flex",flexDirection:"column",minHeight:0,height:"100%"},children:[i.jsx("div",{ref:B,className:We,style:{position:"absolute",visibility:"hidden",pointerEvents:"none",left:0,right:0,top:0,width:"100%",height:"auto"},"aria-hidden":"true",children:Le($e||h)}),i.jsxs("div",{ref:Ue,className:`${e}-titles-row-two-row`,style:{...T&&oe?{minHeight:oe}:void 0,...T&&be?{width:be,maxWidth:"100%"}:void 0},children:[jt(i.jsxs("div",{className:We,style:{position:T?"absolute":"relative",inset:T?0:void 0,width:"100%"},children:[g&&T?i.jsx("div",{className:`${Yt} ${e}-titles-fade-out`,children:ot(g)}):null,i.jsx("div",{className:`${e}-titles-layer-in${T?` ${e}-titles-layer-in-fading ${e}-titles-fade-in`:""}`,children:ot(h)})]}),T&&oe?oe:void 0),Ct?i.jsxs("div",{className:`${e}-titles-row-bottom-area`,children:[g&&T?i.jsx("div",{className:`${Tt} ${e}-titles-layer-out-bottom ${e}-titles-fade-out`,children:lt(g)}):null,i.jsx("div",{className:`${e}-titles-layer-in${T?` ${e}-titles-layer-in-fading ${e}-titles-fade-in`:""}${p?` ${e}-titles-layer-in-stacked`:""}`,children:lt(h,!0)})]}):null]})]}),ui=()=>{const t=Ct;return i.jsxs("div",{style:{position:"relative",width:"100%",alignSelf:"stretch",display:"flex",flexDirection:"column",minHeight:0,...t?{flex:1,height:"100%"}:{}},children:[i.jsx("div",{className:`${e}-titles-row-two-row`,style:t?void 0:{flex:"0 0 auto",height:"auto"},children:Le(h,!0)}),st()]})};return i.jsxs("div",{ref:K,"data-selection":"none",className:`${e}-lightbox${w?` ${e}-lightbox-editor`:""}${f?` ${e}-lightbox-edit-mode`:""}`,onClick:()=>{qe||ge()},role:"dialog","aria-modal":"true","aria-label":"Journal gallery",tabIndex:se?void 0:-1,style:{opacity:ut?1:0,transition:"opacity 300ms ease",pointerEvents:ut?"auto":"none"},children:[i.jsx("div",{className:`${e}-lightbox-backdrop`,style:{backgroundColor:_e,...Ft}}),i.jsxs("div",{className:`${e}-lightbox-dismiss-area`,style:Gt,...Ot,children:[i.jsx("div",{className:`${e}-lightbox-content`,style:Bt,onClick:t=>t.stopPropagation(),children:i.jsx("div",{className:`${e}-lightbox-strip`,"data-desktop-nav":F&&u.length>1?"true":"false",onPointerDown:F?Ut:void 0,onPointerUp:F?Vt:void 0,onPointerCancel:F?qt:void 0,children:i.jsxs("div",{className:`${e}-slide-stack`,children:[$t&&gt?i.jsx("div",{className:`${e}-slide-layer-out ${e}-slide-fade-out`,onAnimationEnd:t=>{t.target===t.currentTarget&&Et(Oe)},children:i.jsx("div",{className:`${e}-slide-area`,children:kt($t.images)})},`slide-out-${Oe}`):null,i.jsx("div",{className:`${e}-slide-layer-in${gt?` ${e}-slide-fade-in`:""}`,children:i.jsx("div",{className:`${e}-slide-area`,children:de?kt(de.images):null})},`slide-in-${Oe}-${y}`)]})})}),i.jsxs("div",{className:`${e}-lightbox-overlay-content`,style:Kt,children:[i.jsx("div",{"data-controls":f?"contentMarginTop":void 0,className:f?`${e}-control`:void 0,style:{height:Dt,width:"100%"}}),i.jsx("div",{style:{display:"flex",flexDirection:"row",width:"100%",...p?{flex:1,minHeight:0}:{}},children:i.jsx("div",{className:`${e}-lightbox-content-area${p?` ${e}-lightbox-content-area-stacked`:""}`,children:Xt&&i.jsx("div",{className:`${e}-text-bar-cell${p?` ${e}-text-bar-cell-stacked`:""}`,style:p?void 0:{flex:1,minWidth:0,width:"100%"},children:p?E==="fade"?di():ui():E==="fade"?oi():ni()})})})]})]})]})},at=400,ct="cubic-bezier(0.25, 0.1, 0.25, 1)",xi=1.1;function pi(e){return`
2
2
  .${e}-wrapper {
3
3
  position: relative;
4
4
  width: 100%;
@@ -43,23 +43,29 @@
43
43
  max-width: 100%;
44
44
  }
45
45
 
46
+ @property --${e}-hover-zoom {
47
+ syntax: '<number>';
48
+ inherits: false;
49
+ initial-value: 1;
50
+ }
51
+
46
52
  .${e}-hover-zoom-in .${e}-cover-image {
47
- clip-path: inset(0);
48
- transition: transform ${Me}ms ${De}, clip-path ${Me}ms ${De};
53
+ transform: scale(var(--${e}-hover-zoom));
54
+ clip-path: inset(calc(50% - 50% / var(--${e}-hover-zoom)));
55
+ transition: --${e}-hover-zoom ${at}ms ${ct};
49
56
  }
50
57
 
51
58
  .${e}-hover-scale-down .${e}-cover-image {
52
- transition: transform ${Me}ms ${De};
59
+ transition: transform ${at}ms ${ct};
53
60
  }
54
61
 
55
62
  .${e}-hover-greyscale .${e}-cover-image {
56
- transition: filter ${Me}ms ${De};
63
+ transition: filter ${at}ms ${ct};
57
64
  }
58
65
 
59
66
  @media (hover: hover) {
60
67
  .${e}-hover-zoom-in .${e}-cover:hover .${e}-cover-image {
61
- transform: scale(${Ht});
62
- clip-path: inset(${pi});
68
+ --${e}-hover-zoom: ${xi};
63
69
  }
64
70
  .${e}-hover-scale-down .${e}-cover:hover .${e}-cover-image {
65
71
  transform: scale(0.9);
@@ -546,4 +552,4 @@
546
552
  pointer-events: auto;
547
553
  z-index: 10;
548
554
  }
549
- `}const wi=({settings:e,content:E,isEditor:I,isEditMode:w,isPreviewMode:f,portalId:ee,metadata:U})=>{const{prefix:j}=fi.useScopedStyles(),k=(U==null?void 0:U.itemId)??null,{cover:V,coverFit:q,type:C,hover:te="none"}=e,Ae=te!=="none"&&(!I||f)?` ${j}-hover-${te}`:"",Ee=o.useRef(null),[Je,H]=o.useState(!1),[J,ie]=o.useState(0),re=o.useRef(!1),X=o.useRef(!1),R=o.useRef(!1),L=o.useMemo(()=>(E??[]).filter(b=>l.getEntryImages(b).length>0),[E]),pe=Je&&L.length>0,$=!I,Fe=o.useCallback(()=>{$&&(R.current=!0,l.removeJournalUrlParam(X.current,k),X.current=!1)},[$,k]),ze=(b=0)=>{if(L.length===0||I&&!w&&!f)return;const _=l.buildJournalSlides(L,C),F=Math.max(0,Math.min(b,_.length-1));if(ie(F),$){const we=l.hasJournalUrlParam();l.setJournalUrlParam(F+1,k,we),X.current=!we}H(!0)},ve=o.useCallback(()=>{H(!1),R.current=!1},[]);return o.useEffect(()=>{!I||w||f||H(!1)},[I,w,f]),o.useEffect(()=>{if(!$||typeof window>"u")return;const b=window.history.scrollRestoration;return window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration=b}},[$]),o.useEffect(()=>{if(!$||re.current)return;re.current=!0;const b=l.findJournalUrlSlideNumber(k);if(!b)return;const _=l.slideNumberToIndex(b,l.buildJournalSlides(L,C).length);_<0||(ie(_),H(!0))},[L,k,$,C]),o.useEffect(()=>{if(!$)return;const b=()=>{if(R.current){R.current=!1,H(!1);return}const _=l.findJournalUrlSlideNumber(k);if(!_){H(!1);return}const F=l.slideNumberToIndex(_,l.buildJournalSlides(L,C).length);if(F<0){H(!1);return}X.current=!1,ie(F),H(!0)};return window.addEventListener("popstate",b),()=>window.removeEventListener("popstate",b)},[L,k,$,C]),i.jsxs(i.Fragment,{children:[i.jsxs("div",{ref:Ee,className:`${j}-wrapper${Ae}`,children:[i.jsx("style",{dangerouslySetInnerHTML:{__html:vi(j)}}),V?i.jsx("button",{type:"button",className:`${j}-cover ${G.isImageRatioCover(q)?`${j}-ratio-wrapper-cover`:`${j}-ratio-wrapper-fit`}`,onClick:()=>ze(),style:{display:"block",padding:0,border:"none",background:"transparent",pointerEvents:I&&!w&&!f?"none":void 0,...G.isImageRatioCover(q)?{"--image-aspect-ratio":G.getAspectRatio(q)}:{}},"aria-label":"Open journal gallery",children:i.jsx("img",{className:`${j}-cover-image ${G.isImageRatioCover(q)?`${j}-cover-image-cover`:`${j}-cover-image-fit`}`,src:V,alt:"cover"})}):null]}),pe&&typeof document<"u"&&(()=>{const b=(ee?document.getElementById(ee):null)??document.body;return Lt.createPortal(i.jsx(xi,{prefix:j,entries:L,settings:e,isEditor:I,isEditMode:w,isPreviewMode:f,initialSlideIndex:J,enableUrlSync:$,journalItemId:k,onBeforeClose:Fe,onClose:ve}),b)})()]})};exports.LightboxJournal=wi;
555
+ `}const vi=({settings:e,content:z,isEditor:I,isEditMode:w,isPreviewMode:f,portalId:ee,metadata:U})=>{const{prefix:j}=hi.useScopedStyles(),k=(U==null?void 0:U.itemId)??null,{cover:V,coverFit:q,type:C,hover:te="none"}=e,_e=te!=="none"&&(!I||f)?` ${j}-hover-${te}`:"",De=o.useRef(null),[Ae,H]=o.useState(!1),[E,ie]=o.useState(0),re=o.useRef(!1),X=o.useRef(!1),R=o.useRef(!1),L=o.useMemo(()=>(z??[]).filter(b=>l.getEntryImages(b).length>0),[z]),pe=Ae&&L.length>0,$=!I,ze=o.useCallback(()=>{$&&(R.current=!0,l.removeJournalUrlParam(X.current,k),X.current=!1)},[$,k]),Ee=(b=0)=>{if(L.length===0||I&&!w&&!f)return;const M=l.buildJournalSlides(L,C),J=Math.max(0,Math.min(b,M.length-1));if(ie(J),$){const we=l.hasJournalUrlParam();l.setJournalUrlParam(J+1,k,we),X.current=!we}H(!0)},ve=o.useCallback(()=>{H(!1),R.current=!1},[]);return o.useEffect(()=>{!I||w||f||H(!1)},[I,w,f]),o.useEffect(()=>{if(!$||typeof window>"u")return;const b=window.history.scrollRestoration;return window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration=b}},[$]),o.useEffect(()=>{if(!$||re.current)return;re.current=!0;const b=l.findJournalUrlSlideNumber(k);if(!b)return;const M=l.slideNumberToIndex(b,l.buildJournalSlides(L,C).length);M<0||(ie(M),H(!0))},[L,k,$,C]),o.useEffect(()=>{if(!$)return;const b=()=>{if(R.current){R.current=!1,H(!1);return}const M=l.findJournalUrlSlideNumber(k);if(!M){H(!1);return}const J=l.slideNumberToIndex(M,l.buildJournalSlides(L,C).length);if(J<0){H(!1);return}X.current=!1,ie(J),H(!0)};return window.addEventListener("popstate",b),()=>window.removeEventListener("popstate",b)},[L,k,$,C]),i.jsxs(i.Fragment,{children:[i.jsxs("div",{ref:De,className:`${j}-wrapper${_e}`,children:[i.jsx("style",{dangerouslySetInnerHTML:{__html:pi(j)}}),V?i.jsx("button",{type:"button",className:`${j}-cover ${G.isImageRatioCover(q)?`${j}-ratio-wrapper-cover`:`${j}-ratio-wrapper-fit`}`,onClick:()=>Ee(),style:{display:"block",padding:0,border:"none",background:"transparent",pointerEvents:I&&!w&&!f?"none":void 0,...G.isImageRatioCover(q)?{"--image-aspect-ratio":G.getAspectRatio(q)}:{}},"aria-label":"Open journal gallery",children:i.jsx("img",{className:`${j}-cover-image ${G.isImageRatioCover(q)?`${j}-cover-image-cover`:`${j}-cover-image-fit`}`,src:V,alt:"cover"})}):null]}),pe&&typeof document<"u"&&(()=>{const b=(ee?document.getElementById(ee):null)??document.body;return Lt.createPortal(i.jsx(gi,{prefix:j,entries:L,settings:e,isEditor:I,isEditMode:w,isPreviewMode:f,initialSlideIndex:E,enableUrlSync:$,journalItemId:k,onBeforeClose:ze,onClose:ve}),b)})()]})};exports.LightboxJournal=vi;