1"use strict";(self.webpackChunkpratt_parent=self.webpackChunkpratt_parent||[]).push([[59],{5951:function(t,e,s){s.d(e,{default:function(){return T}});var i=s(7e3),n=class{constructor(t,e){this._state=t,this._map=Object.entries(e).reduce((t,[e,s])=>({...t,[e]:new Set(s)}),{})}get state(){return this._state}isStateOneOf(...t){return new Set(t).has(this._state)}setState(t){const e=this._map[this._state];if(!e)throw new Error(`Modal gallery is in unknown state: ${this._state}`);e.has(t)&&(this._state=t)}},r=(t,e,s,i)=>{let n=t;return Array.isArray(t)||(n=[t]),n.forEach(t=>{t&&t.addEventListener(e,s,i)}),()=>{n.forEach(t=>{t&&t.removeEventListener(e,s,i)})}},o=s(3689);s(2234);const a="unmounted",l="beforeUnmount",h="beforeMount",d="mounted",c="open",u="beforeOpen",p="beforeClose",m="js-modal-gallery__video-button",g="js-modal-gallery__open",_={caption:null,close:[],countCurrent:null,countTotal:null,credit:null,next:[],open:[],previous:[],slideActive:null,slideNext:null,slidePrevious:null},f="unmounted",y="beforeMount",b="mounted",v="beforeUnmount",M="Pause",C="Play Video",S="Pause Video";var x=class{constructor(t){this.stateManager=new n(f,{[f]:[y],[y]:[b],[b]:[v],[v]:[f]}),this.ref=t,this.wrapper=null,this.button=null,this.el=null,this.videoPoster=null,this.mount()}cloneReferenceImage(){if(!this.isKaltura){const t=this.isWithinPicture?this.ref.parentNode:this.ref;this.el=t.cloneNode(!0)}if(this.isVideo)if(this.videoPoster=document.createElement("img"),this.isKaltura){const t=this.ref.closest(".playkit-container");if(t&&t.querySelector(".playkit-poster")){const e=window.getComputedStyle(t.querySelector(".playkit-poster")).getPropertyValue("background-image");e&&e.includes("url")&&(this.videoPoster.src=e.slice(4,-1).replace(/["']/g,""))}}else this.videoPoster.src=this.ref.poster;else{const t=this.isWithinPicture?this.el.querySelector("img"):this.el;if(t.className="js-modal-gallery__asset",t.src=this.ref.dataset.src||this.ref.src,t.srcset=this.ref.dataset.srcset||this.ref.srcset,t.sizes=this.ref.dataset.sizes||this.ref.sizes,this.isWithinPicture){const t=this.el.querySelector("source");t&&(t.srcset=t.dataset.srcset||t.srcset,t.sizes=t.dataset.sizes||t.sizes)}}}get isMounted(){return this.stateManager.isStateOneOf([y,b,v])}get preview(){return this.isVideo?this.videoPoster:this.el}get isKaltura(){return this.isVideo&&this.ref.classList.contains("playkit-engine")}get isWithinPicture(){return this.ref.parentNode&&"PICTURE"===this.ref.parentNode.tagName}get isVideo(){return this.ref instanceof HTMLVideoElement}
1get caption(){const t=this.ref.closest(this.isKaltura?".kaltura-video":"figure");if(!t)return"";const e=t.querySelector(this.isKaltura?".kaltura-video__caption p":"figcaption");if(!e)return this.ref.dataset.caption??"";const s=e.querySelector(".article__caption-description");return s?.innerHTML??e.innerHTML}get credit(){return this.ref.dataset.credit||""}_beforeMount(){const t=document.createElement("span");t.classList.add("js-modal-gallery__trigger"),"absolute"!==window.getComputedStyle(this.ref).position&&t.classList.add("relative");const e=this.isWithinPicture?this.ref.parentNode:this.ref;let s=null;const i=this.ref.parentNode.classList.contains("wp-block-video");this.isVideo&&i&&(t.classList.add("video"),s=this.createVideoOverlayElem()),e.parentNode.insertBefore(t,e),t.append(e),s&&(t.append(s),this.ref.play()),this.wrapper=t}mount(){if(this.isMounted)throw new Error("Slide is already mounted!");this.stateManager.setState(y),this._beforeMount(),this.stateManager.setState(b)}_beforeUnmount(){const t=this.isWithinPicture?this.ref.parentNode:this.ref;this.wrapper.parentNode.insertBefore(t,this.wrapper),this.wrapper.parentNode.removeChild(this.wrapper),this.button=null,this.wrapper=null}unmount(){this.stateManager.state===b&&(this.stateManager.setState(v),this._beforeUnmount(),this.stateManager.setState(f))}getOrCreateOpenButton(){if(this.stateManager.state!==b||this.isKaltura)return null;if(!this.button){const t=document.createElement("button");t.setAttribute("aria-label","Open gallery"),t.setAttribute("aria-haspopup","dialog"),t.setAttribute("aria-expanded","false"),t.setAttribute("aria-controls","modal-gallery"),t.classList.add(g),this.wrapper.append(t),this.button=t}return this.button}renderTo(t,e=!1){if(this.stateManager.state!==b||!t)return null;if(!e)return t.appendChild(this.preview);if(this.isKaltura?t.appendChild(this.preview):t.appendChild(this.el),this.isVideo&&!this.isKaltura){const e=this.createVideoOverlayElem();t.append(e),this.el.currentTime=0,this.el.play()}}createVideoOverlayElem(){const t=document.createElement("div");t.classList.add("js-modal-gallery__video-overlay"),t.setAttribute("tabindex","0"),t.setAttribute("role","button"),t.setAttribute("aria-label",S),r(t,"click",this.toggleVideoPlay),r(t,"keydown",t=>{const e=t.key===o.L.SPACE||t.key===o.L.SPACE_IE11,s=t.key===o.L.ENTER;(e||s)&&(t.preventDefault(),this.toggleVideoPlay(t))});const e=document.createElement("button");return e.classList.add(m),e.setAttribute("tabindex","-1"),e.setAttribute("aria-label",S),e.textContent=M,t.append(e),t}toggleVideoPlay(t){const e=t.currentTarget,s=e.parentNode.querySelector("video"),i=e.querySelector(`.${m}`);s&&(s.paused?(s.play(),i.textContent=M,i.setAttribute("aria-label",S),e.setAttribute("aria-label",S)):(s.pause(),i.textContent="Play",i.setAttribute("aria-label",C),e.setAttribute("aria-label",C)))}},E=s(8654),T=class{constructor(){this._index=0,this.stateManager=new n(a,{[a]:[h],[h]:[d],[d]:[u,l],[u]:[c],[c]:[p],[p]:[d],[l]:[a]}),this.container=this._getComponent("js-modal-gallery",{rootEl:document}),this.root=null,this.modalTrigger=null,this.focusTrap=null,this.everOpened=null,this.components=Object.assign({},_),this.slides=[],this.listeners=[],this.galleryListeners=[],this.mount()}get index(){return this._index}set index(t){this._index=this._getBoundedIndex(t)}get isMounted(){return this.stateManager.isStateOneOf([h,d,u,c,p,l])}get numSlides(){return this.slides.length}_beforeMount(){this.root.setAttribute("aria-hidden",!0),this.everOpened=!1;const t=["img","video"].map(t=>`${t}:not(.js-modal-gallery__hidden):not(.wp-rich-text-inline-image):not(.playkit-icon)`).join(", "),e=Array.from(this.container.querySelectorAll(t));this.slides=e.map((t,e)=>{const s=new x(t),i=s.getOrCreateOpenButton();return this.listeners.push(r(i,"click",()=>{this.open(e)})),s}),this.components.open=this._getComponent(g,{rootEl:this.container,multiple:!0}),this.listeners.push(r(this.components.open,"click",t=>{const e=(parseInt(t.target.dataset.slide,10)||1)-1;this.open(e)})),this.components.caption=this._getComponent("js-modal-gallery__caption"),this.components.close=this._getComponent("js-modal-gallery__close",{multiple:!0}
1),this.components.countCurrent=this._getComponent("js-modal-gallery__count--current"),this.components.countTotal=this._getComponent("js-modal-gallery__count--total"),this.components.credit=this._getComponent("js-modal-gallery__credit"),this.components.next=this._getComponent("js-modal-gallery__next",{multiple:!0}),this.components.previous=this._getComponent("js-modal-gallery__previous",{multiple:!0}),this.components.slideActive=this._getComponent("js-modal-gallery__slide--active"),this.components.slideNext=this._getComponent("js-modal-gallery__slide--next"),this.components.slidePrevious=this._getComponent("js-modal-gallery__slide--previous"),this.numSlides>1?this._setInnerHTML(this.components.countTotal,this.numSlides):this.root.classList.add("disable-controls")}mount(){if(this.isMounted)throw new Error("Modal gallery has already been mounted!");this.root=this._getComponent("js-modal-gallery__root",{rootEl:document}),this.stateManager.setState(h),this._beforeMount(),this.stateManager.setState(d)}_beforeUnmount(){this.listeners.forEach(t=>{t()}),this.listeners=[],this.slides.forEach(t=>{t.unmount()}),this.slides=[],this._removeChildren(this.components.slideActive),this._removeChildren(this.components.slideNext),this._removeChildren(this.components.slidePrevious),this._setInnerHTML(this.components.caption,""),this._setInnerHTML(this.components.credit,""),this._setInnerHTML(this.components.countCurrent,""),this._setInnerHTML(this.components.countTotal,""),this.root=null,this.components=Object.assign({},_),this.index=0}unmount(){this.stateManager.state!==d&&this.stateManager.state!==c||(this.stateManager.state===c&&this.close(),this.stateManager.setState(l),this._beforeUnmount(),this.stateManager.setState(a))}_getBoundedIndex(t){return Math.min(this.numSlides,Math.max(0,(t+this.numSlides)%this.numSlides))}_getComponent(t,e={}){const s=`.${t}`,i=e.rootEl||this.root;return e.multiple?Array.from(i.querySelectorAll(s)):i.querySelector(s)}_onKeyDown(t){switch(t.key){case o.L.ARROW_LEFT:case o.L.ARROW_LEFT_IE11:this.previous();break;case o.L.ARROW_RIGHT:case o.L.ARROW_RIGHT_IE11:this.next();break;case o.L.ESCAPE:case o.L.ESCAPE_IE11:this.close()}}_removeChildren(t){if(t)for(;t.firstChild;)t.removeChild(t.lastChild)}_setInnerHTML(t,e){t&&(t.innerHTML=e)}_update(){if(this.stateManager.state===u||this.stateManager.state===c){const t=this.slides[this.index];this._removeChildren(this.components.slideActive),t.renderTo(this.components.slideActive,!0),this._removeChildren(this.components.slideNext),this.slides[this._getBoundedIndex(this.index+1)].renderTo(this.components.slideNext),this._removeChildren(this.components.slidePrevious),this.slides[this._getBoundedIndex(this.index-1)].renderTo(this.components.slidePrevious),this._setInnerHTML(this.components.caption,t.caption?`<span class="modal-gallery__caption-span">${t.caption}</span>`:""),this._setInnerHTML(this.components.countCurrent,this.index+1)}}_beforeOpen(t){void 0!==t&&(this.index=t),this.everOpened||(this.slides.forEach(t=>{t.cloneReferenceImage()}),this.everOpened=!0),this.galleryListeners.push(r(window,"keydown",this._onKeyDown.bind(this)),r(this.components.close,"click",this.close.bind(this)),r(this.components.next,"click",this.next.bind(this)),r(this.components.previous,"click",this.previous.bind(this))),this._update(),this.root.setAttribute("aria-hidden",!1),this.modalTrigger=document.activeElement,this.modalTrigger.setAttribute("aria-expanded",!0),this.focusTrap=(0,E.K)(this.root,{escapeDeactivates:!1,setReturnFocus:this.modalTrigger}),this.focusTrap.activate(),(0,i.mh)(this.root)}open(t){this.stateManager.state===d&&(this.stateManager.setState(u),this._beforeOpen(t),this.stateManager.setState(c))}goToSlide(t){this.stateManager.state===c&&(this.index=t,this._update())}next(){this.stateManager.state===c&&(this.index+=1,this._update())}previous(){this.stateManager.state===c&&(this.index-=1,this._update())}_beforeClose(){this.galleryListeners.forEach(t=>{t()}),this.galleryListeners=[],this.focusTrap.deactivate(),this.focusTrap=null,(0,i.fY)(this.root),this.root.setAttribute("aria-hidden",!0),this.modalTrigger.setAttribute("aria-expanded",!1),this.modalTrigger=null}close(){this.stateManager.state===c&&(this.stateManager.setState(p),this._beforeClose(),this.stateManager.setState(d))}}}}]);
2//# sourceMappingURL=59.bc17d330c6dfcb9fbc1e.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.