1import"@archetype-themes/vendors/photoswipe.min";import"@archetype-themes/vendors/photoswipe-ui-default.min";let selectors={trigger:".js-photoswipe__zoom",images:".photoswipe__image",slideshowTrack:".flickity-viewport ",activeImage:".is-selected"};export default class Photoswipe{constructor(container,sectionId){this.container=container,this.sectionId=sectionId,this.namespace=".photoswipe-"+this.sectionId,this.gallery,this.images,this.items,this.inSlideshow=!1,!(!container||container.dataset.zoom==="false")&&this.init()}init(){this.container.querySelectorAll(selectors.trigger).forEach(trigger=>{trigger.addEventListener("click",this.triggerClick.bind(this))})}triggerClick(evt){this.container.dataset&&this.container.dataset.hasSlideshow==="true"?this.inSlideshow=!0:this.inSlideshow=!1,this.items=this.getImageData();let image=this.inSlideshow?this.container.querySelector(selectors.activeImage):evt.currentTarget,index=this.inSlideshow?this.getChildIndex(image):image.dataset.index;this.initGallery(this.items,index)}getChildIndex(el){let i=0;for(;(el=el.previousSibling)!=null;)i++;return i+1}getImageData(){this.images=this.inSlideshow?this.container.querySelectorAll(selectors.slideshowTrack+selectors.images):this.container.querySelectorAll(selectors.images);let items=[],options={};return this.images.forEach(el=>{let item={msrc:el.currentSrc||el.src,src:el.getAttribute("data-photoswipe-src"),w:el.getAttribute("data-photoswipe-width"),h:el.getAttribute("data-photoswipe-height"),el,initialZoomLevel:.5};items.push(item)}),items}initGallery(items,index){document.body.classList.add("photoswipe-open");let pswpElement=document.querySelectorAll(".pswp")[0],options={allowPanToNext:!1,captionEl:!1,closeOnScroll:!1,counterEl:!1,history:!1,index:index-1,pinchToClose:!1,preloaderEl:!1,scaleMode:"zoom",shareEl:!1,tapToToggleControls:!1,getThumbBoundsFn:function(index2){let pageYScroll=window.pageYOffset||document.documentElement.scrollTop,thumbnail=items[index2].el,rect=thumbnail.getBoundingClientRect(),imageAspectRatio=thumbnail.naturalWidth/thumbnail.naturalHeight,containerAspectRatio=rect.width/rect.height,displayedWidth,displayedHeight,offsetX,offsetY;return imageAspectRatio>containerAspectRatio?(displayedWidth=rect.width,displayedHeight=rect.width/imageAspectRatio,offsetX=0,offsetY=(rect.height-displayedHeight)/2):(displayedHeight=rect.height,displayedWidth=rect.height*imageAspectRatio,offsetX=(rect.width-displayedWidth)/2,offsetY=0),{x:rect.left+offsetX,y:rect.top+offsetY+pageYScroll,w:displayedWidth}}};this.gallery=new PhotoSwipe(pswpElement,PhotoSwipeUI_Default,items,options),this.gallery.listen("afterChange",this.afterChange.bind(this)),this.gallery.listen("afterInit",this.afterInit.bind(this)),this.gallery.init(),this.preventiOS15Scrolling()}afterChange(){let index=this.gallery.getCurrentIndex();this.container.dispatchEvent(new CustomEvent("photoswipe:afterChange",{detail:{index}}))}afterInit(){this.container.dispatchEvent(new CustomEvent("photoswipe:afterInit"))}syncHeight(){document.documentElement.style.setProperty("--window-inner-height",`${window.innerHeight}px`)}preventiOS15Scrolling(){let initialScrollPos;/iPhone|iPad|iPod/i.test(window.navigator.userAgent)&&(this.syncHeight(),initialScrollPos=window.scrollY,document.documentElement.classList.add("pswp-open-in-ios"),window.addEventListener("resize",this.syncHeight),this.gallery.listen("destroy",()=>{document.documentElement.classList.remove("pswp-open-in-ios"),window.scrollTo(0,initialScrollPos)}))}} 2//# sourceMappingURL=/cdn/shop/t/40/assets/photoswipe.js.map?v=26893319410327140681789141436
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.