@ecodev/natural-gallery-js
Version:
A lazy load, infinite scroll, natural and masonry layout gallery
1 lines • 96.5 kB
JavaScript
var qt=Object.defineProperty,$t=Object.defineProperties;var te=Object.getOwnPropertyDescriptors;var Bt=Object.getOwnPropertySymbols;var ee=Object.prototype.hasOwnProperty,ie=Object.prototype.propertyIsEnumerable;var V=Math.pow,Ot=(r,t,e)=>t in r?qt(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,L=(r,t)=>{for(var e in t||(t={}))ee.call(t,e)&&Ot(r,e,t[e]);if(Bt)for(var e of Bt(t))ie.call(t,e)&&Ot(r,e,t[e]);return r},Tt=(r,t)=>$t(r,te(t));function x(r,t,{signal:e,edges:i}={}){let o,s=null,n=i!=null&&i.includes("leading"),l=i==null||i.includes("trailing"),a=()=>{s!==null&&(r.apply(o,s),o=void 0,s=null)},h=()=>{l&&a(),m()},p=null,d=()=>{p!=null&&clearTimeout(p),p=setTimeout(()=>{p=null,h()},t)},c=()=>{p!==null&&(clearTimeout(p),p=null)},m=()=>{c(),o=void 0,s=null},u=()=>{c(),a()},f=function(...S){if(e!=null&&e.aborted)return;o=this,s=S;let b=p==null;d(),n&&b&&a()};return f.schedule=d,f.cancel=m,f.flush=u,e==null||e.addEventListener("abort",m,{once:!0}),f}function N(r,t){let e={};for(let i=0;i<t.length;i++){let o=t[i];Object.hasOwn(r,o)&&(e[o]=r[o])}return e}function F(r){var e;if(typeof r!="object"||r==null)return!1;if(Object.getPrototypeOf(r)===null)return!0;if(Object.prototype.toString.call(r)!=="[object Object]"){let i=r[Symbol.toStringTag];return i==null||!((e=Object.getOwnPropertyDescriptor(r,Symbol.toStringTag))!=null&&e.writable)?!1:r.toString()===`[object ${i}]`}let t=r;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(r)===t}function U(r,...t){r=Object(r);for(let e=0;e<t.length;e++){let i=t[e];i!=null&&H(r,i,new WeakMap)}return r}function H(r,t,e){for(let i in t){let o=t[i],s=r[i];if(!Object.hasOwn(r,i)||s===void 0)if(e.has(o))r[i]=e.get(o);else if(F(o)){let l={};e.set(o,l),r[i]=l,H(l,o,e)}else r[i]=o;else if(F(s)&&F(o)){let l=e.has(o);(!l||l&&e.get(o)!==s)&&(e.set(o,s),H(s,o,e))}}}function I(r,t,e){let i=document.createElement(t);return r&&(i.className=r),e&&e.appendChild(i),i}function g(r,t){return r.x=t.x,r.y=t.y,t.id!==void 0&&(r.id=t.id),r}function Dt(r){r.x=Math.round(r.x),r.y=Math.round(r.y)}function Q(r,t){let e=Math.abs(r.x-t.x),i=Math.abs(r.y-t.y);return Math.sqrt(e*e+i*i)}function O(r,t){return r.x===t.x&&r.y===t.y}function P(r,t,e){return Math.min(Math.max(r,t),e)}function T(r,t,e){let i=`translate3d(${r}px,${t||0}px,0)`;return e!==void 0&&(i+=` scale3d(${e},${e},1)`),i}function v(r,t,e,i){r.style.transform=T(t,e,i)}var oe="cubic-bezier(.4,0,.22,1)";function Wt(r,t,e,i){r.style.transition=t?`${t} ${e}ms ${i||oe}`:"none"}function j(r,t,e){r.style.width=typeof t=="number"?`${t}px`:t,r.style.height=typeof e=="number"?`${e}px`:e}function se(r){Wt(r)}function re(r){return"decode"in r?r.decode().catch(()=>{}):r.complete?Promise.resolve(r):new Promise((t,e)=>{r.onload=()=>t(r),r.onerror=e})}var C={IDLE:"idle",LOADING:"loading",LOADED:"loaded",ERROR:"error"};function ne(r){return"button"in r&&r.button===1||r.ctrlKey||r.metaKey||r.altKey||r.shiftKey}function le(r,t,e=document){let i=[];if(r instanceof Element)i=[r];else if(r instanceof NodeList||Array.isArray(r))i=Array.from(r);else{let o=typeof r=="string"?r:t;o&&(i=Array.from(e.querySelectorAll(o)))}return i}function Pt(){return!!(navigator.vendor&&navigator.vendor.match(/apple/i))}var kt=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:()=>{kt=!0}}))}catch(r){}var Y=class{constructor(){this._pool=[]}add(t,e,i,o){this._toggleListener(t,e,i,o)}remove(t,e,i,o){this._toggleListener(t,e,i,o,!0)}removeAll(){this._pool.forEach(t=>{this._toggleListener(t.target,t.type,t.listener,t.passive,!0,!0)}),this._pool=[]}_toggleListener(t,e,i,o,s,n){if(!t)return;let l=s?"removeEventListener":"addEventListener";e.split(" ").forEach(h=>{if(h){n||(s?this._pool=this._pool.filter(d=>d.type!==h||d.listener!==i||d.target!==t):this._pool.push({target:t,type:h,listener:i,passive:o}));let p=kt?{passive:o||!1}:!1;t[l](h,i,p)}})}};function Xt(r,t){if(r.getViewportSizeFn){let e=r.getViewportSizeFn(r,t);if(e)return e}return{x:document.documentElement.clientWidth,y:window.innerHeight}}function B(r,t,e,i,o){let s=0;if(t.paddingFn)s=t.paddingFn(e,i,o)[r];else if(t.padding)s=t.padding[r];else{let n="padding"+r[0].toUpperCase()+r.slice(1);t[n]&&(s=t[n])}return Number(s)||0}function Vt(r,t,e,i){return{x:t.x-B("left",r,t,e,i)-B("right",r,t,e,i),y:t.y-B("top",r,t,e,i)-B("bottom",r,t,e,i)}}var J=class{constructor(t){this.slide=t,this.currZoomLevel=1,this.center={x:0,y:0},this.max={x:0,y:0},this.min={x:0,y:0}}update(t){this.currZoomLevel=t,this.slide.width?(this._updateAxis("x"),this._updateAxis("y"),this.slide.pswp.dispatch("calcBounds",{slide:this.slide})):this.reset()}_updateAxis(t){let{pswp:e}=this.slide,i=this.slide[t==="x"?"width":"height"]*this.currZoomLevel,s=B(t==="x"?"left":"top",e.options,e.viewportSize,this.slide.data,this.slide.index),n=this.slide.panAreaSize[t];this.center[t]=Math.round((n-i)/2)+s,this.max[t]=i>n?Math.round(n-i)+s:this.center[t],this.min[t]=i>n?s:this.center[t]}reset(){this.center.x=0,this.center.y=0,this.max.x=0,this.max.y=0,this.min.x=0,this.min.y=0}correctPan(t,e){return P(e,this.max[t],this.min[t])}},zt=4e3,G=class{constructor(t,e,i,o){this.pswp=o,this.options=t,this.itemData=e,this.index=i,this.panAreaSize=null,this.elementSize=null,this.fit=1,this.fill=1,this.vFill=1,this.initial=1,this.secondary=1,this.max=1,this.min=1}update(t,e,i){let o={x:t,y:e};this.elementSize=o,this.panAreaSize=i;let s=i.x/o.x,n=i.y/o.y;this.fit=Math.min(1,s<n?s:n),this.fill=Math.min(1,s>n?s:n),this.vFill=Math.min(1,n),this.initial=this._getInitial(),this.secondary=this._getSecondary(),this.max=Math.max(this.initial,this.secondary,this._getMax()),this.min=Math.min(this.fit,this.initial,this.secondary),this.pswp&&this.pswp.dispatch("zoomLevelsUpdate",{zoomLevels:this,slideData:this.itemData})}_parseZoomLevelOption(t){let e=t+"ZoomLevel",i=this.options[e];if(i)return typeof i=="function"?i(this):i==="fill"?this.fill:i==="fit"?this.fit:Number(i)}_getSecondary(){let t=this._parseZoomLevelOption("secondary");return t||(t=Math.min(1,this.fit*3),this.elementSize&&t*this.elementSize.x>zt&&(t=zt/this.elementSize.x),t)}_getInitial(){return this._parseZoomLevelOption("initial")||this.fit}_getMax(){return this._parseZoomLevelOption("max")||Math.max(1,this.fit*4)}},K=class{constructor(t,e,i){this.data=t,this.index=e,this.pswp=i,this.isActive=e===i.currIndex,this.currentResolution=0,this.panAreaSize={x:0,y:0},this.pan={x:0,y:0},this.isFirstSlide=this.isActive&&!i.opener.isOpen,this.zoomLevels=new G(i.options,t,e,i),this.pswp.dispatch("gettingData",{slide:this,data:this.data,index:e}),this.content=this.pswp.contentLoader.getContentBySlide(this),this.container=I("pswp__zoom-wrap","div"),this.holderElement=null,this.currZoomLevel=1,this.width=this.content.width,this.height=this.content.height,this.heavyAppended=!1,this.bounds=new J(this),this.prevDisplayedWidth=-1,this.prevDisplayedHeight=-1,this.pswp.dispatch("slideInit",{slide:this})}setIsActive(t){t&&!this.isActive?this.activate():!t&&this.isActive&&this.deactivate()}append(t){this.holderElement=t,this.container.style.transformOrigin="0 0",this.data&&(this.calculateSize(),this.load(),this.updateContentSize(),this.appendHeavy(),this.holderElement.appendChild(this.container),this.zoomAndPanToInitial(),this.pswp.dispatch("firstZoomPan",{slide:this}),this.applyCurrentZoomPan(),this.pswp.dispatch("afterSetContent",{slide:this}),this.isActive&&this.activate())}load(){this.content.load(!1),this.pswp.dispatch("slideLoad",{slide:this})}appendHeavy(){let{pswp:t}=this;this.heavyAppended||!t.opener.isOpen||t.mainScroll.isShifted()||!this.isActive&&!!0||this.pswp.dispatch("appendHeavy",{slide:this}).defaultPrevented||(this.heavyAppended=!0,this.content.append(),this.pswp.dispatch("appendHeavyContent",{slide:this}))}activate(){this.isActive=!0,this.appendHeavy(),this.content.activate(),this.pswp.dispatch("slideActivate",{slide:this})}deactivate(){this.isActive=!1,this.content.deactivate(),this.currZoomLevel!==this.zoomLevels.initial&&this.calculateSize(),this.currentResolution=0,this.zoomAndPanToInitial(),this.applyCurrentZoomPan(),this.updateContentSize(),this.pswp.dispatch("slideDeactivate",{slide:this})}destroy(){this.content.hasSlide=!1,this.content.remove(),this.container.remove(),this.pswp.dispatch("slideDestroy",{slide:this})}resize(){this.currZoomLevel===this.zoomLevels.initial||!this.isActive?(this.calculateSize(),this.currentResolution=0,this.zoomAndPanToInitial(),this.applyCurrentZoomPan(),this.updateContentSize()):(this.calculateSize(),this.bounds.update(this.currZoomLevel),this.panTo(this.pan.x,this.pan.y))}updateContentSize(t){let e=this.currentResolution||this.zoomLevels.initial;if(!e)return;let i=Math.round(this.width*e)||this.pswp.viewportSize.x,o=Math.round(this.height*e)||this.pswp.viewportSize.y;!this.sizeChanged(i,o)&&!t||this.content.setDisplayedSize(i,o)}sizeChanged(t,e){return t!==this.prevDisplayedWidth||e!==this.prevDisplayedHeight?(this.prevDisplayedWidth=t,this.prevDisplayedHeight=e,!0):!1}getPlaceholderElement(){var t;return(t=this.content.placeholder)===null||t===void 0?void 0:t.element}zoomTo(t,e,i,o){let{pswp:s}=this;if(!this.isZoomable()||s.mainScroll.isShifted())return;s.dispatch("beforeZoomTo",{destZoomLevel:t,centerPoint:e,transitionDuration:i}),s.animations.stopAllPan();let n=this.currZoomLevel;o||(t=P(t,this.zoomLevels.min,this.zoomLevels.max)),this.setZoomLevel(t),this.pan.x=this.calculateZoomToPanOffset("x",e,n),this.pan.y=this.calculateZoomToPanOffset("y",e,n),Dt(this.pan);let l=()=>{this._setResolution(t),this.applyCurrentZoomPan()};i?s.animations.startTransition({isPan:!0,name:"zoomTo",target:this.container,transform:this.getCurrentTransform(),onComplete:l,duration:i,easing:s.options.easing}):l()}toggleZoom(t){this.zoomTo(this.currZoomLevel===this.zoomLevels.initial?this.zoomLevels.secondary:this.zoomLevels.initial,t,this.pswp.options.zoomAnimationDuration)}setZoomLevel(t){this.currZoomLevel=t,this.bounds.update(this.currZoomLevel)}calculateZoomToPanOffset(t,e,i){if(this.bounds.max[t]-this.bounds.min[t]===0)return this.bounds.center[t];e||(e=this.pswp.getViewportCenterPoint()),i||(i=this.zoomLevels.initial);let s=this.currZoomLevel/i;return this.bounds.correctPan(t,(this.pan[t]-e[t])*s+e[t])}panTo(t,e){this.pan.x=this.bounds.correctPan("x",t),this.pan.y=this.bounds.correctPan("y",e),this.applyCurrentZoomPan()}isPannable(){return!!this.width&&this.currZoomLevel>this.zoomLevels.fit}isZoomable(){return!!this.width&&this.content.isZoomable()}applyCurrentZoomPan(){this._applyZoomTransform(this.pan.x,this.pan.y,this.currZoomLevel),this===this.pswp.currSlide&&this.pswp.dispatch("zoomPanUpdate",{slide:this})}zoomAndPanToInitial(){this.currZoomLevel=this.zoomLevels.initial,this.bounds.update(this.currZoomLevel),g(this.pan,this.bounds.center),this.pswp.dispatch("initialZoomPan",{slide:this})}_applyZoomTransform(t,e,i){i/=this.currentResolution||this.zoomLevels.initial,v(this.container,t,e,i)}calculateSize(){let{pswp:t}=this;g(this.panAreaSize,Vt(t.options,t.viewportSize,this.data,this.index)),this.zoomLevels.update(this.width,this.height,this.panAreaSize),t.dispatch("calcSlideSize",{slide:this})}getCurrentTransform(){let t=this.currZoomLevel/(this.currentResolution||this.zoomLevels.initial);return T(this.pan.x,this.pan.y,t)}_setResolution(t){t!==this.currentResolution&&(this.currentResolution=t,this.updateContentSize(),this.pswp.dispatch("resolutionChanged"))}},ae=.35,he=.6,Rt=.4,Zt=.5;function pe(r,t){return r*t/(1-t)}var q=class{constructor(t){this.gestures=t,this.pswp=t.pswp,this.startPan={x:0,y:0}}start(){this.pswp.currSlide&&g(this.startPan,this.pswp.currSlide.pan),this.pswp.animations.stopAll()}change(){let{p1:t,prevP1:e,dragAxis:i}=this.gestures,{currSlide:o}=this.pswp;if(i==="y"&&this.pswp.options.closeOnVerticalDrag&&o&&o.currZoomLevel<=o.zoomLevels.fit&&!this.gestures.isMultitouch){let s=o.pan.y+(t.y-e.y);if(!this.pswp.dispatch("verticalDrag",{panY:s}).defaultPrevented){this._setPanWithFriction("y",s,he);let n=1-Math.abs(this._getVerticalDragRatio(o.pan.y));this.pswp.applyBgOpacity(n),o.applyCurrentZoomPan()}}else this._panOrMoveMainScroll("x")||(this._panOrMoveMainScroll("y"),o&&(Dt(o.pan),o.applyCurrentZoomPan()))}end(){let{velocity:t}=this.gestures,{mainScroll:e,currSlide:i}=this.pswp,o=0;if(this.pswp.animations.stopAll(),e.isShifted()){let n=(e.x-e.getCurrSlideX())/this.pswp.viewportSize.x;t.x<-Zt&&n<0||t.x<.1&&n<-.5?(o=1,t.x=Math.min(t.x,0)):(t.x>Zt&&n>0||t.x>-.1&&n>.5)&&(o=-1,t.x=Math.max(t.x,0)),e.moveIndexBy(o,!0,t.x)}i&&i.currZoomLevel>i.zoomLevels.max||this.gestures.isMultitouch?this.gestures.zoomLevels.correctZoomPan(!0):(this._finishPanGestureForAxis("x"),this._finishPanGestureForAxis("y"))}_finishPanGestureForAxis(t){let{velocity:e}=this.gestures,{currSlide:i}=this.pswp;if(!i)return;let{pan:o,bounds:s}=i,n=o[t],l=this.pswp.bgOpacity<1&&t==="y",h=n+pe(e[t],.995);if(l){let u=this._getVerticalDragRatio(n),f=this._getVerticalDragRatio(h);if(u<0&&f<-Rt||u>0&&f>Rt){this.pswp.close();return}}let p=s.correctPan(t,h);if(n===p)return;let d=p===h?1:.82,c=this.pswp.bgOpacity,m=p-n;this.pswp.animations.startSpring({name:"panGesture"+t,isPan:!0,start:n,end:p,velocity:e[t],dampingRatio:d,onUpdate:u=>{if(l&&this.pswp.bgOpacity<1){let f=1-(p-u)/m;this.pswp.applyBgOpacity(P(c+(1-c)*f,0,1))}o[t]=Math.floor(u),i.applyCurrentZoomPan()}})}_panOrMoveMainScroll(t){let{p1:e,dragAxis:i,prevP1:o,isMultitouch:s}=this.gestures,{currSlide:n,mainScroll:l}=this.pswp,a=e[t]-o[t],h=l.x+a;if(!a||!n)return!1;if(t==="x"&&!n.isPannable()&&!s)return l.moveTo(h,!0),!0;let{bounds:p}=n,d=n.pan[t]+a;if(this.pswp.options.allowPanToNext&&i==="x"&&t==="x"&&!s){let c=l.getCurrSlideX(),m=l.x-c,u=a>0,f=!u;if(d>p.min[t]&&u){if(p.min[t]<=this.startPan[t])return l.moveTo(h,!0),!0;this._setPanWithFriction(t,d)}else if(d<p.max[t]&&f){if(this.startPan[t]<=p.max[t])return l.moveTo(h,!0),!0;this._setPanWithFriction(t,d)}else if(m!==0){if(m>0)return l.moveTo(Math.max(h,c),!0),!0;if(m<0)return l.moveTo(Math.min(h,c),!0),!0}else this._setPanWithFriction(t,d)}else t==="y"?!l.isShifted()&&p.min.y!==p.max.y&&this._setPanWithFriction(t,d):this._setPanWithFriction(t,d);return!1}_getVerticalDragRatio(t){var e,i;return(t-((e=(i=this.pswp.currSlide)===null||i===void 0?void 0:i.bounds.center.y)!==null&&e!==void 0?e:0))/(this.pswp.viewportSize.y/3)}_setPanWithFriction(t,e,i){let{currSlide:o}=this.pswp;if(!o)return;let{pan:s,bounds:n}=o;if(n.correctPan(t,e)!==e||i){let a=Math.round(e-s[t]);s[t]+=a*(i||ae)}else s[t]=e}},de=.05,ce=.15;function Ft(r,t,e){return r.x=(t.x+e.x)/2,r.y=(t.y+e.y)/2,r}var $=class{constructor(t){this.gestures=t,this._startPan={x:0,y:0},this._startZoomPoint={x:0,y:0},this._zoomPoint={x:0,y:0},this._wasOverFitZoomLevel=!1,this._startZoomLevel=1}start(){let{currSlide:t}=this.gestures.pswp;t&&(this._startZoomLevel=t.currZoomLevel,g(this._startPan,t.pan)),this.gestures.pswp.animations.stopAllPan(),this._wasOverFitZoomLevel=!1}change(){let{p1:t,startP1:e,p2:i,startP2:o,pswp:s}=this.gestures,{currSlide:n}=s;if(!n)return;let l=n.zoomLevels.min,a=n.zoomLevels.max;if(!n.isZoomable()||s.mainScroll.isShifted())return;Ft(this._startZoomPoint,e,o),Ft(this._zoomPoint,t,i);let h=1/Q(e,o)*Q(t,i)*this._startZoomLevel;if(h>n.zoomLevels.initial+n.zoomLevels.initial/15&&(this._wasOverFitZoomLevel=!0),h<l)if(s.options.pinchToClose&&!this._wasOverFitZoomLevel&&this._startZoomLevel<=n.zoomLevels.initial){let p=1-(l-h)/(l/1.2);s.dispatch("pinchClose",{bgOpacity:p}).defaultPrevented||s.applyBgOpacity(p)}else h=l-(l-h)*ce;else h>a&&(h=a+(h-a)*de);n.pan.x=this._calculatePanForZoomLevel("x",h),n.pan.y=this._calculatePanForZoomLevel("y",h),n.setZoomLevel(h),n.applyCurrentZoomPan()}end(){let{pswp:t}=this.gestures,{currSlide:e}=t;(!e||e.currZoomLevel<e.zoomLevels.initial)&&!this._wasOverFitZoomLevel&&t.options.pinchToClose?t.close():this.correctZoomPan()}_calculatePanForZoomLevel(t,e){let i=e/this._startZoomLevel;return this._zoomPoint[t]-(this._startZoomPoint[t]-this._startPan[t])*i}correctZoomPan(t){let{pswp:e}=this.gestures,{currSlide:i}=e;if(!(i!=null&&i.isZoomable()))return;this._zoomPoint.x===0&&(t=!0);let o=i.currZoomLevel,s,n=!0;o<i.zoomLevels.initial?s=i.zoomLevels.initial:o>i.zoomLevels.max?s=i.zoomLevels.max:(n=!1,s=o);let l=e.bgOpacity,a=e.bgOpacity<1,h=g({x:0,y:0},i.pan),p=g({x:0,y:0},h);t&&(this._zoomPoint.x=0,this._zoomPoint.y=0,this._startZoomPoint.x=0,this._startZoomPoint.y=0,this._startZoomLevel=o,g(this._startPan,h)),n&&(p={x:this._calculatePanForZoomLevel("x",s),y:this._calculatePanForZoomLevel("y",s)}),i.setZoomLevel(s),p={x:i.bounds.correctPan("x",p.x),y:i.bounds.correctPan("y",p.y)},i.setZoomLevel(o);let d=!O(p,h);if(!d&&!n&&!a){i._setResolution(s),i.applyCurrentZoomPan();return}e.animations.stopAllPan(),e.animations.startSpring({isPan:!0,start:0,end:1e3,velocity:0,dampingRatio:1,naturalFrequency:40,onUpdate:c=>{if(c/=1e3,d||n){if(d&&(i.pan.x=h.x+(p.x-h.x)*c,i.pan.y=h.y+(p.y-h.y)*c),n){let m=o+(s-o)*c;i.setZoomLevel(m)}i.applyCurrentZoomPan()}a&&e.bgOpacity<1&&e.applyBgOpacity(P(l+(1-l)*c,0,1))},onComplete:()=>{i._setResolution(s),i.applyCurrentZoomPan()}})}};function Gt(r){return!!r.target.closest(".pswp__container")}var tt=class{constructor(t){this.gestures=t}click(t,e){let i=e.target.classList,o=i.contains("pswp__img"),s=i.contains("pswp__item")||i.contains("pswp__zoom-wrap");o?this._doClickOrTapAction("imageClick",t,e):s&&this._doClickOrTapAction("bgClick",t,e)}tap(t,e){Gt(e)&&this._doClickOrTapAction("tap",t,e)}doubleTap(t,e){Gt(e)&&this._doClickOrTapAction("doubleTap",t,e)}_doClickOrTapAction(t,e,i){var o;let{pswp:s}=this.gestures,{currSlide:n}=s,l=t+"Action",a=s.options[l];if(!s.dispatch(l,{point:e,originalEvent:i}).defaultPrevented){if(typeof a=="function"){a.call(s,e,i);return}switch(a){case"close":case"next":s[a]();break;case"zoom":n==null||n.toggleZoom(e);break;case"zoom-or-close":n!=null&&n.isZoomable()&&n.zoomLevels.secondary!==n.zoomLevels.initial?n.toggleZoom(e):s.options.clickToCloseNonZoomable&&s.close();break;case"toggle-controls":(o=this.gestures.pswp.element)===null||o===void 0||o.classList.toggle("pswp--ui-visible");break}}}},me=10,ge=300,ue=25,et=class{constructor(t){this.pswp=t,this.dragAxis=null,this.p1={x:0,y:0},this.p2={x:0,y:0},this.prevP1={x:0,y:0},this.prevP2={x:0,y:0},this.startP1={x:0,y:0},this.startP2={x:0,y:0},this.velocity={x:0,y:0},this._lastStartP1={x:0,y:0},this._intervalP1={x:0,y:0},this._numActivePoints=0,this._ongoingPointers=[],this._touchEventEnabled="ontouchstart"in window,this._pointerEventEnabled=!!window.PointerEvent,this.supportsTouch=this._touchEventEnabled||this._pointerEventEnabled&&navigator.maxTouchPoints>1,this._numActivePoints=0,this._intervalTime=0,this._velocityCalculated=!1,this.isMultitouch=!1,this.isDragging=!1,this.isZooming=!1,this.raf=null,this._tapTimer=null,this.supportsTouch||(t.options.allowPanToNext=!1),this.drag=new q(this),this.zoomLevels=new $(this),this.tapHandler=new tt(this),t.on("bindEvents",()=>{t.events.add(t.scrollWrap,"click",this._onClick.bind(this)),this._pointerEventEnabled?this._bindEvents("pointer","down","up","cancel"):this._touchEventEnabled?(this._bindEvents("touch","start","end","cancel"),t.scrollWrap&&(t.scrollWrap.ontouchmove=()=>{},t.scrollWrap.ontouchend=()=>{})):this._bindEvents("mouse","down","up")})}_bindEvents(t,e,i,o){let{pswp:s}=this,{events:n}=s,l=o?t+o:"";n.add(s.scrollWrap,t+e,this.onPointerDown.bind(this)),n.add(window,t+"move",this.onPointerMove.bind(this)),n.add(window,t+i,this.onPointerUp.bind(this)),l&&n.add(s.scrollWrap,l,this.onPointerUp.bind(this))}onPointerDown(t){let e=t.type==="mousedown"||t.pointerType==="mouse";if(e&&t.button>0)return;let{pswp:i}=this;if(!i.opener.isOpen){t.preventDefault();return}i.dispatch("pointerDown",{originalEvent:t}).defaultPrevented||(e&&(i.mouseDetected(),this._preventPointerEventBehaviour(t,"down")),i.animations.stopAll(),this._updatePoints(t,"down"),this._numActivePoints===1&&(this.dragAxis=null,g(this.startP1,this.p1)),this._numActivePoints>1?(this._clearTapTimer(),this.isMultitouch=!0):this.isMultitouch=!1)}onPointerMove(t){this._preventPointerEventBehaviour(t,"move"),this._numActivePoints&&(this._updatePoints(t,"move"),!this.pswp.dispatch("pointerMove",{originalEvent:t}).defaultPrevented&&(this._numActivePoints===1&&!this.isDragging?(this.dragAxis||this._calculateDragDirection(),this.dragAxis&&!this.isDragging&&(this.isZooming&&(this.isZooming=!1,this.zoomLevels.end()),this.isDragging=!0,this._clearTapTimer(),this._updateStartPoints(),this._intervalTime=Date.now(),this._velocityCalculated=!1,g(this._intervalP1,this.p1),this.velocity.x=0,this.velocity.y=0,this.drag.start(),this._rafStopLoop(),this._rafRenderLoop())):this._numActivePoints>1&&!this.isZooming&&(this._finishDrag(),this.isZooming=!0,this._updateStartPoints(),this.zoomLevels.start(),this._rafStopLoop(),this._rafRenderLoop())))}_finishDrag(){this.isDragging&&(this.isDragging=!1,this._velocityCalculated||this._updateVelocity(!0),this.drag.end(),this.dragAxis=null)}onPointerUp(t){this._numActivePoints&&(this._updatePoints(t,"up"),!this.pswp.dispatch("pointerUp",{originalEvent:t}).defaultPrevented&&(this._numActivePoints===0&&(this._rafStopLoop(),this.isDragging?this._finishDrag():!this.isZooming&&!this.isMultitouch&&this._finishTap(t)),this._numActivePoints<2&&this.isZooming&&(this.isZooming=!1,this.zoomLevels.end(),this._numActivePoints===1&&(this.dragAxis=null,this._updateStartPoints()))))}_rafRenderLoop(){(this.isDragging||this.isZooming)&&(this._updateVelocity(),this.isDragging?O(this.p1,this.prevP1)||this.drag.change():(!O(this.p1,this.prevP1)||!O(this.p2,this.prevP2))&&this.zoomLevels.change(),this._updatePrevPoints(),this.raf=requestAnimationFrame(this._rafRenderLoop.bind(this)))}_updateVelocity(t){let e=Date.now(),i=e-this._intervalTime;i<50&&!t||(this.velocity.x=this._getVelocity("x",i),this.velocity.y=this._getVelocity("y",i),this._intervalTime=e,g(this._intervalP1,this.p1),this._velocityCalculated=!0)}_finishTap(t){let{mainScroll:e}=this.pswp;if(e.isShifted()){e.moveIndexBy(0,!0);return}if(t.type.indexOf("cancel")>0)return;if(t.type==="mouseup"||t.pointerType==="mouse"){this.tapHandler.click(this.startP1,t);return}let i=this.pswp.options.doubleTapAction?ge:0;this._tapTimer?(this._clearTapTimer(),Q(this._lastStartP1,this.startP1)<ue&&this.tapHandler.doubleTap(this.startP1,t)):(g(this._lastStartP1,this.startP1),this._tapTimer=setTimeout(()=>{this.tapHandler.tap(this.startP1,t),this._clearTapTimer()},i))}_clearTapTimer(){this._tapTimer&&(clearTimeout(this._tapTimer),this._tapTimer=null)}_getVelocity(t,e){let i=this.p1[t]-this._intervalP1[t];return Math.abs(i)>1&&e>5?i/e:0}_rafStopLoop(){this.raf&&(cancelAnimationFrame(this.raf),this.raf=null)}_preventPointerEventBehaviour(t,e){this.pswp.applyFilters("preventPointerEvent",!0,t,e)&&t.preventDefault()}_updatePoints(t,e){if(this._pointerEventEnabled){let i=t,o=this._ongoingPointers.findIndex(s=>s.id===i.pointerId);e==="up"&&o>-1?this._ongoingPointers.splice(o,1):e==="down"&&o===-1?this._ongoingPointers.push(this._convertEventPosToPoint(i,{x:0,y:0})):o>-1&&this._convertEventPosToPoint(i,this._ongoingPointers[o]),this._numActivePoints=this._ongoingPointers.length,this._numActivePoints>0&&g(this.p1,this._ongoingPointers[0]),this._numActivePoints>1&&g(this.p2,this._ongoingPointers[1])}else{let i=t;this._numActivePoints=0,i.type.indexOf("touch")>-1?i.touches&&i.touches.length>0&&(this._convertEventPosToPoint(i.touches[0],this.p1),this._numActivePoints++,i.touches.length>1&&(this._convertEventPosToPoint(i.touches[1],this.p2),this._numActivePoints++)):(this._convertEventPosToPoint(t,this.p1),e==="up"?this._numActivePoints=0:this._numActivePoints++)}}_updatePrevPoints(){g(this.prevP1,this.p1),g(this.prevP2,this.p2)}_updateStartPoints(){g(this.startP1,this.p1),g(this.startP2,this.p2),this._updatePrevPoints()}_calculateDragDirection(){if(this.pswp.mainScroll.isShifted())this.dragAxis="x";else{let t=Math.abs(this.p1.x-this.startP1.x)-Math.abs(this.p1.y-this.startP1.y);if(t!==0){let e=t>0?"x":"y";Math.abs(this.p1[e]-this.startP1[e])>=me&&(this.dragAxis=e)}}}_convertEventPosToPoint(t,e){return e.x=t.pageX-this.pswp.offset.x,e.y=t.pageY-this.pswp.offset.y,"pointerId"in t?e.id=t.pointerId:t.identifier!==void 0&&(e.id=t.identifier),e}_onClick(t){this.pswp.mainScroll.isShifted()&&(t.preventDefault(),t.stopPropagation())}},fe=.35,it=class{constructor(t){this.pswp=t,this.x=0,this.slideWidth=0,this._currPositionIndex=0,this._prevPositionIndex=0,this._containerShiftIndex=-1,this.itemHolders=[]}resize(t){let{pswp:e}=this,i=Math.round(e.viewportSize.x+e.viewportSize.x*e.options.spacing),o=i!==this.slideWidth;o&&(this.slideWidth=i,this.moveTo(this.getCurrSlideX())),this.itemHolders.forEach((s,n)=>{o&&v(s.el,(n+this._containerShiftIndex)*this.slideWidth),t&&s.slide&&s.slide.resize()})}resetPosition(){this._currPositionIndex=0,this._prevPositionIndex=0,this.slideWidth=0,this._containerShiftIndex=-1}appendHolders(){this.itemHolders=[];for(let t=0;t<3;t++){let e=I("pswp__item","div",this.pswp.container);e.setAttribute("role","group"),e.setAttribute("aria-roledescription","slide"),e.setAttribute("aria-hidden","true"),e.style.display=t===1?"block":"none",this.itemHolders.push({el:e})}}canBeSwiped(){return this.pswp.getNumItems()>1}moveIndexBy(t,e,i){let{pswp:o}=this,s=o.potentialIndex+t,n=o.getNumItems();if(o.canLoop()){s=o.getLoopedIndex(s);let a=(t+n)%n;a<=n/2?t=a:t=a-n}else s<0?s=0:s>=n&&(s=n-1),t=s-o.potentialIndex;o.potentialIndex=s,this._currPositionIndex-=t,o.animations.stopMainScroll();let l=this.getCurrSlideX();if(!e)this.moveTo(l),this.updateCurrItem();else{o.animations.startSpring({isMainScroll:!0,start:this.x,end:l,velocity:i||0,naturalFrequency:30,dampingRatio:1,onUpdate:h=>{this.moveTo(h)},onComplete:()=>{this.updateCurrItem(),o.appendHeavy()}});let a=o.potentialIndex-o.currIndex;if(o.canLoop()){let h=(a+n)%n;h<=n/2?a=h:a=h-n}Math.abs(a)>1&&this.updateCurrItem()}return!!t}getCurrSlideX(){return this.slideWidth*this._currPositionIndex}isShifted(){return this.x!==this.getCurrSlideX()}updateCurrItem(){var t;let{pswp:e}=this,i=this._prevPositionIndex-this._currPositionIndex;if(!i)return;this._prevPositionIndex=this._currPositionIndex,e.currIndex=e.potentialIndex;let o=Math.abs(i),s;o>=3&&(this._containerShiftIndex+=i+(i>0?-3:3),o=3,this.itemHolders.forEach(n=>{var l;(l=n.slide)===null||l===void 0||l.destroy(),n.slide=void 0}));for(let n=0;n<o;n++)i>0?(s=this.itemHolders.shift(),s&&(this.itemHolders[2]=s,this._containerShiftIndex++,v(s.el,(this._containerShiftIndex+2)*this.slideWidth),e.setContent(s,e.currIndex-o+n+2))):(s=this.itemHolders.pop(),s&&(this.itemHolders.unshift(s),this._containerShiftIndex--,v(s.el,this._containerShiftIndex*this.slideWidth),e.setContent(s,e.currIndex+o-n-2)));Math.abs(this._containerShiftIndex)>50&&!this.isShifted()&&(this.resetPosition(),this.resize()),e.animations.stopAllPan(),this.itemHolders.forEach((n,l)=>{n.slide&&n.slide.setIsActive(l===1)}),e.currSlide=(t=this.itemHolders[1])===null||t===void 0?void 0:t.slide,e.contentLoader.updateLazy(i),e.currSlide&&e.currSlide.applyCurrentZoomPan(),e.dispatch("change")}moveTo(t,e){if(!this.pswp.canLoop()&&e){let i=(this.slideWidth*this._currPositionIndex-t)/this.slideWidth;i+=this.pswp.currIndex;let o=Math.round(t-this.x);(i<0&&o>0||i>=this.pswp.getNumItems()-1&&o<0)&&(t=this.x+o*fe)}this.x=t,this.pswp.container&&v(this.pswp.container,t),this.pswp.dispatch("moveMainScroll",{x:t,dragging:e!=null?e:!1})}},Ie={Escape:27,z:90,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,Tab:9},y=(r,t)=>t?r:Ie[r],ot=class{constructor(t){this.pswp=t,this._wasFocused=!1,t.on("bindEvents",()=>{t.options.trapFocus&&(t.options.initialPointerPos||this._focusRoot(),t.events.add(document,"focusin",this._onFocusIn.bind(this))),t.events.add(document,"keydown",this._onKeyDown.bind(this))});let e=document.activeElement;t.on("destroy",()=>{t.options.returnFocus&&e&&this._wasFocused&&e.focus()})}_focusRoot(){!this._wasFocused&&this.pswp.element&&(this.pswp.element.focus(),this._wasFocused=!0)}_onKeyDown(t){let{pswp:e}=this;if(e.dispatch("keydown",{originalEvent:t}).defaultPrevented||ne(t))return;let i,o,s=!1,n="key"in t;switch(n?t.key:t.keyCode){case y("Escape",n):e.options.escKey&&(i="close");break;case y("z",n):i="toggleZoom";break;case y("ArrowLeft",n):o="x";break;case y("ArrowUp",n):o="y";break;case y("ArrowRight",n):o="x",s=!0;break;case y("ArrowDown",n):s=!0,o="y";break;case y("Tab",n):this._focusRoot();break}if(o){t.preventDefault();let{currSlide:l}=e;e.options.arrowKeys&&o==="x"&&e.getNumItems()>1?i=s?"next":"prev":l&&l.currZoomLevel>l.zoomLevels.fit&&(l.pan[o]+=s?-80:80,l.panTo(l.pan.x,l.pan.y))}i&&(t.preventDefault(),e[i]())}_onFocusIn(t){let{template:e}=this.pswp;e&&document!==t.target&&e!==t.target&&!e.contains(t.target)&&e.focus()}},Ce="cubic-bezier(.4,0,.22,1)",st=class{constructor(t){var e;this.props=t;let{target:i,onComplete:o,transform:s,onFinish:n=()=>{},duration:l=333,easing:a=Ce}=t;this.onFinish=n;let h=s?"transform":"opacity",p=(e=t[h])!==null&&e!==void 0?e:"";this._target=i,this._onComplete=o,this._finished=!1,this._onTransitionEnd=this._onTransitionEnd.bind(this),this._helperTimeout=setTimeout(()=>{Wt(i,h,l,a),this._helperTimeout=setTimeout(()=>{i.addEventListener("transitionend",this._onTransitionEnd,!1),i.addEventListener("transitioncancel",this._onTransitionEnd,!1),this._helperTimeout=setTimeout(()=>{this._finalizeAnimation()},l+500),i.style[h]=p},30)},0)}_onTransitionEnd(t){t.target===this._target&&this._finalizeAnimation()}_finalizeAnimation(){this._finished||(this._finished=!0,this.onFinish(),this._onComplete&&this._onComplete())}destroy(){this._helperTimeout&&clearTimeout(this._helperTimeout),se(this._target),this._target.removeEventListener("transitionend",this._onTransitionEnd,!1),this._target.removeEventListener("transitioncancel",this._onTransitionEnd,!1),this._finished||this._finalizeAnimation()}},Ae=12,be=.75,rt=class{constructor(t,e,i){this.velocity=t*1e3,this._dampingRatio=e||be,this._naturalFrequency=i||Ae,this._dampedFrequency=this._naturalFrequency,this._dampingRatio<1&&(this._dampedFrequency*=Math.sqrt(1-this._dampingRatio*this._dampingRatio))}easeFrame(t,e){let i=0,o;e/=1e3;let s=V(Math.E,-this._dampingRatio*this._naturalFrequency*e);if(this._dampingRatio===1)o=this.velocity+this._naturalFrequency*t,i=(t+o*e)*s,this.velocity=i*-this._naturalFrequency+o*s;else if(this._dampingRatio<1){o=1/this._dampedFrequency*(this._dampingRatio*this._naturalFrequency*t+this.velocity);let n=Math.cos(this._dampedFrequency*e),l=Math.sin(this._dampedFrequency*e);i=s*(t*n+o*l),this.velocity=i*-this._naturalFrequency*this._dampingRatio+s*(-this._dampedFrequency*t*l+this._dampedFrequency*o*n)}return i}},nt=class{constructor(t){this.props=t,this._raf=0;let{start:e,end:i,velocity:o,onUpdate:s,onComplete:n,onFinish:l=()=>{},dampingRatio:a,naturalFrequency:h}=t;this.onFinish=l;let p=new rt(o,a,h),d=Date.now(),c=e-i,m=()=>{this._raf&&(c=p.easeFrame(c,Date.now()-d),Math.abs(c)<1&&Math.abs(p.velocity)<50?(s(i),n&&n(),this.onFinish()):(d=Date.now(),s(c+i),this._raf=requestAnimationFrame(m)))};this._raf=requestAnimationFrame(m)}destroy(){this._raf>=0&&cancelAnimationFrame(this._raf),this._raf=0}},lt=class{constructor(){this.activeAnimations=[]}startSpring(t){this._start(t,!0)}startTransition(t){this._start(t)}_start(t,e){let i=e?new nt(t):new st(t);return this.activeAnimations.push(i),i.onFinish=()=>this.stop(i),i}stop(t){t.destroy();let e=this.activeAnimations.indexOf(t);e>-1&&this.activeAnimations.splice(e,1)}stopAll(){this.activeAnimations.forEach(t=>{t.destroy()}),this.activeAnimations=[]}stopAllPan(){this.activeAnimations=this.activeAnimations.filter(t=>t.props.isPan?(t.destroy(),!1):!0)}stopMainScroll(){this.activeAnimations=this.activeAnimations.filter(t=>t.props.isMainScroll?(t.destroy(),!1):!0)}isPanRunning(){return this.activeAnimations.some(t=>t.props.isPan)}},at=class{constructor(t){this.pswp=t,t.events.add(t.element,"wheel",this._onWheel.bind(this))}_onWheel(t){t.preventDefault();let{currSlide:e}=this.pswp,{deltaX:i,deltaY:o}=t;if(e&&!this.pswp.dispatch("wheel",{originalEvent:t}).defaultPrevented)if(t.ctrlKey||this.pswp.options.wheelToZoom){if(e.isZoomable()){let s=-o;t.deltaMode===1?s*=.05:s*=t.deltaMode?1:.002,s=V(2,s);let n=e.currZoomLevel*s;e.zoomTo(n,{x:t.clientX,y:t.clientY})}}else e.isPannable()&&(t.deltaMode===1&&(i*=18,o*=18),e.panTo(e.pan.x-i,e.pan.y-o))}};function xe(r){if(typeof r=="string")return r;if(!r||!r.isCustomSVG)return"";let t=r,e='<svg aria-hidden="true" class="pswp__icn" viewBox="0 0 %d %d" width="%d" height="%d">';return e=e.split("%d").join(t.size||32),t.outlineID&&(e+='<use class="pswp__icn-shadow" xlink:href="#'+t.outlineID+'"/>'),e+=t.inner,e+="</svg>",e}var ht=class{constructor(t,e){var i;let o=e.name||e.className,s=e.html;if(t.options[o]===!1)return;typeof t.options[o+"SVG"]=="string"&&(s=t.options[o+"SVG"]),t.dispatch("uiElementCreate",{data:e});let n="";e.isButton?(n+="pswp__button ",n+=e.className||`pswp__button--${e.name}`):n+=e.className||`pswp__${e.name}`;let l=e.isButton?e.tagName||"button":e.tagName||"div";l=l.toLowerCase();let a=I(n,l);if(e.isButton){l==="button"&&(a.type="button");let{title:d}=e,{ariaLabel:c}=e;typeof t.options[o+"Title"]=="string"&&(d=t.options[o+"Title"]),d&&(a.title=d);let m=c||d;m&&a.setAttribute("aria-label",m)}a.innerHTML=xe(s),e.onInit&&e.onInit(a,t),e.onClick&&(a.onclick=d=>{typeof e.onClick=="string"?t[e.onClick]():typeof e.onClick=="function"&&e.onClick(d,a,t)});let h=e.appendTo||"bar",p=t.element;h==="bar"?(t.topBar||(t.topBar=I("pswp__top-bar pswp__hide-on-close","div",t.scrollWrap)),p=t.topBar):(a.classList.add("pswp__hide-on-close"),h==="wrapper"&&(p=t.scrollWrap)),(i=p)===null||i===void 0||i.appendChild(t.applyFilters("uiElement",a,e))}};function Nt(r,t,e){r.classList.add("pswp__button--arrow"),r.setAttribute("aria-controls","pswp__items"),t.on("change",()=>{t.options.loop||(e?r.disabled=!(t.currIndex<t.getNumItems()-1):r.disabled=!(t.currIndex>0))})}var ye={name:"arrowPrev",className:"pswp__button--arrow--prev",title:"Previous",order:10,isButton:!0,appendTo:"wrapper",html:{isCustomSVG:!0,size:60,inner:'<path d="M29 43l-3 3-16-16 16-16 3 3-13 13 13 13z" id="pswp__icn-arrow"/>',outlineID:"pswp__icn-arrow"},onClick:"prev",onInit:Nt},ve={name:"arrowNext",className:"pswp__button--arrow--next",title:"Next",order:11,isButton:!0,appendTo:"wrapper",html:{isCustomSVG:!0,size:60,inner:'<use xlink:href="#pswp__icn-arrow"/>',outlineID:"pswp__icn-arrow"},onClick:"next",onInit:(r,t)=>{Nt(r,t,!0)}},we={name:"close",title:"Close",order:20,isButton:!0,html:{isCustomSVG:!0,inner:'<path d="M24 10l-2-2-6 6-6-6-2 2 6 6-6 6 2 2 6-6 6 6 2-2-6-6z" id="pswp__icn-close"/>',outlineID:"pswp__icn-close"},onClick:"close"},_e={name:"zoom",title:"Zoom",order:10,isButton:!0,html:{isCustomSVG:!0,inner:'<path d="M17.426 19.926a6 6 0 1 1 1.5-1.5L23 22.5 21.5 24l-4.074-4.074z" id="pswp__icn-zoom"/><path fill="currentColor" class="pswp__zoom-icn-bar-h" d="M11 16v-2h6v2z"/><path fill="currentColor" class="pswp__zoom-icn-bar-v" d="M13 12h2v6h-2z"/>',outlineID:"pswp__icn-zoom"},onClick:"toggleZoom"},Se={name:"preloader",appendTo:"bar",order:7,html:{isCustomSVG:!0,inner:'<path fill-rule="evenodd" clip-rule="evenodd" d="M21.2 16a5.2 5.2 0 1 1-5.2-5.2V8a8 8 0 1 0 8 8h-2.8Z" id="pswp__icn-loading"/>',outlineID:"pswp__icn-loading"},onInit:(r,t)=>{let e,i=null,o=(l,a)=>{r.classList.toggle("pswp__preloader--"+l,a)},s=l=>{e!==l&&(e=l,o("active",l))},n=()=>{var l;if(!((l=t.currSlide)!==null&&l!==void 0&&l.content.isLoading())){s(!1),i&&(clearTimeout(i),i=null);return}i||(i=setTimeout(()=>{var a;s(!!(!((a=t.currSlide)===null||a===void 0)&&a.content.isLoading())),i=null},t.options.preloaderDelay))};t.on("change",n),t.on("loadComplete",l=>{t.currSlide===l.slide&&n()}),t.ui&&(t.ui.updatePreloaderVisibility=n)}},Le={name:"counter",order:5,onInit:(r,t)=>{t.on("change",()=>{r.innerText=t.currIndex+1+t.options.indexIndicatorSep+t.getNumItems()})}};function Mt(r,t){r.classList.toggle("pswp--zoomed-in",t)}var pt=class{constructor(t){this.pswp=t,this.isRegistered=!1,this.uiElementsData=[],this.items=[],this.updatePreloaderVisibility=()=>{},this._lastUpdatedZoomLevel=void 0}init(){let{pswp:t}=this;this.isRegistered=!1,this.uiElementsData=[we,ye,ve,_e,Se,Le],t.dispatch("uiRegister"),this.uiElementsData.sort((e,i)=>(e.order||0)-(i.order||0)),this.items=[],this.isRegistered=!0,this.uiElementsData.forEach(e=>{this.registerElement(e)}),t.on("change",()=>{var e;(e=t.element)===null||e===void 0||e.classList.toggle("pswp--one-slide",t.getNumItems()===1)}),t.on("zoomPanUpdate",()=>this._onZoomPanUpdate())}registerElement(t){this.isRegistered?this.items.push(new ht(this.pswp,t)):this.uiElementsData.push(t)}_onZoomPanUpdate(){let{template:t,currSlide:e,options:i}=this.pswp;if(this.pswp.opener.isClosing||!t||!e)return;let{currZoomLevel:o}=e;if(this.pswp.opener.isOpen||(o=e.zoomLevels.initial),o===this._lastUpdatedZoomLevel)return;this._lastUpdatedZoomLevel=o;let s=e.zoomLevels.initial-e.zoomLevels.secondary;if(Math.abs(s)<.01||!e.isZoomable()){Mt(t,!1),t.classList.remove("pswp--zoom-allowed");return}t.classList.add("pswp--zoom-allowed");let n=o===e.zoomLevels.initial?e.zoomLevels.secondary:e.zoomLevels.initial;Mt(t,n<=o),(i.imageClickAction==="zoom"||i.imageClickAction==="zoom-or-close")&&t.classList.add("pswp--click-to-zoom")}};function Ee(r){let t=r.getBoundingClientRect();return{x:t.left,y:t.top,w:t.width}}function Be(r,t,e){let i=r.getBoundingClientRect(),o=i.width/t,s=i.height/e,n=o>s?o:s,l=(i.width-t*n)/2,a=(i.height-e*n)/2,h={x:i.left+l,y:i.top+a,w:t*n};return h.innerRect={w:i.width,h:i.height,x:l,y:a},h}function Oe(r,t,e){let i=e.dispatch("thumbBounds",{index:r,itemData:t,instance:e});if(i.thumbBounds)return i.thumbBounds;let{element:o}=t,s,n;if(o&&e.options.thumbSelector!==!1){let l=e.options.thumbSelector||"img";n=o.matches(l)?o:o.querySelector(l)}return n=e.applyFilters("thumbEl",n,t,r),n&&(t.thumbCropped?s=Be(n,t.width||t.w||0,t.height||t.h||0):s=Ee(n)),e.applyFilters("thumbBounds",s,t,r)}var dt=class{constructor(t,e){this.type=t,this.defaultPrevented=!1,e&&Object.assign(this,e)}preventDefault(){this.defaultPrevented=!0}},ct=class{constructor(){this._listeners={},this._filters={},this.pswp=void 0,this.options=void 0}addFilter(t,e,i=100){var o,s,n;this._filters[t]||(this._filters[t]=[]),(o=this._filters[t])===null||o===void 0||o.push({fn:e,priority:i}),(s=this._filters[t])===null||s===void 0||s.sort((l,a)=>l.priority-a.priority),(n=this.pswp)===null||n===void 0||n.addFilter(t,e,i)}removeFilter(t,e){this._filters[t]&&(this._filters[t]=this._filters[t].filter(i=>i.fn!==e)),this.pswp&&this.pswp.removeFilter(t,e)}applyFilters(t,...e){var i;return(i=this._filters[t])===null||i===void 0||i.forEach(o=>{e[0]=o.fn.apply(this,e)}),e[0]}on(t,e){var i,o;this._listeners[t]||(this._listeners[t]=[]),(i=this._listeners[t])===null||i===void 0||i.push(e),(o=this.pswp)===null||o===void 0||o.on(t,e)}off(t,e){var i;this._listeners[t]&&(this._listeners[t]=this._listeners[t].filter(o=>e!==o)),(i=this.pswp)===null||i===void 0||i.off(t,e)}dispatch(t,e){var i;if(this.pswp)return this.pswp.dispatch(t,e);let o=new dt(t,e);return(i=this._listeners[t])===null||i===void 0||i.forEach(s=>{s.call(this,o)}),o}},mt=class{constructor(t,e){if(this.element=I("pswp__img pswp__img--placeholder",t?"img":"div",e),t){let i=this.element;i.decoding="async",i.alt="",i.src=t,i.setAttribute("role","presentation")}this.element.setAttribute("aria-hidden","true")}setDisplayedSize(t,e){this.element&&(this.element.tagName==="IMG"?(j(this.element,250,"auto"),this.element.style.transformOrigin="0 0",this.element.style.transform=T(0,0,t/250)):j(this.element,t,e))}destroy(){var t;(t=this.element)!==null&&t!==void 0&&t.parentNode&&this.element.remove(),this.element=null}},gt=class{constructor(t,e,i){this.instance=e,this.data=t,this.index=i,this.element=void 0,this.placeholder=void 0,this.slide=void 0,this.displayedImageWidth=0,this.displayedImageHeight=0,this.width=Number(this.data.w)||Number(this.data.width)||0,this.height=Number(this.data.h)||Number(this.data.height)||0,this.isAttached=!1,this.hasSlide=!1,this.isDecoding=!1,this.state=C.IDLE,this.data.type?this.type=this.data.type:this.data.src?this.type="image":this.type="html",this.instance.dispatch("contentInit",{content:this})}removePlaceholder(){this.placeholder&&!this.keepPlaceholder()&&setTimeout(()=>{this.placeholder&&(this.placeholder.destroy(),this.placeholder=void 0)},1e3)}load(t,e){if(this.slide&&this.usePlaceholder())if(this.placeholder){let i=this.placeholder.element;i&&!i.parentElement&&this.slide.container.prepend(i)}else{let i=this.instance.applyFilters("placeholderSrc",this.data.msrc&&this.slide.isFirstSlide?this.data.msrc:!1,this);this.placeholder=new mt(i,this.slide.container)}this.element&&!e||this.instance.dispatch("contentLoad",{content:this,isLazy:t}).defaultPrevented||(this.isImageContent()?(this.element=I("pswp__img","img"),this.displayedImageWidth&&this.loadImage(t)):(this.element=I("pswp__content","div"),this.element.innerHTML=this.data.html||""),e&&this.slide&&this.slide.updateContentSize(!0))}loadImage(t){var e,i;if(!this.isImageContent()||!this.element||this.instance.dispatch("contentLoadImage",{content:this,isLazy:t}).defaultPrevented)return;let o=this.element;this.updateSrcsetSizes(),this.data.srcset&&(o.srcset=this.data.srcset),o.src=(e=this.data.src)!==null&&e!==void 0?e:"",o.alt=(i=this.data.alt)!==null&&i!==void 0?i:"",this.state=C.LOADING,o.complete?this.onLoaded():(o.onload=()=>{this.onLoaded()},o.onerror=()=>{this.onError()})}setSlide(t){this.slide=t,this.hasSlide=!0,this.instance=t.pswp}onLoaded(){this.state=C.LOADED,this.slide&&this.element&&(this.instance.dispatch("loadComplete",{slide:this.slide,content:this}),this.slide.isActive&&this.slide.heavyAppended&&!this.element.parentNode&&(this.append(),this.slide.updateContentSize(!0)),(this.state===C.LOADED||this.state===C.ERROR)&&this.removePlaceholder())}onError(){this.state=C.ERROR,this.slide&&(this.displayError(),this.instance.dispatch("loadComplete",{slide:this.slide,isError:!0,content:this}),this.instance.dispatch("loadError",{slide:this.slide,content:this}))}isLoading(){return this.instance.applyFilters("isContentLoading",this.state===C.LOADING,this)}isError(){return this.state===C.ERROR}isImageContent(){return this.type==="image"}setDisplayedSize(t,e){if(this.element&&(this.placeholder&&this.placeholder.setDisplayedSize(t,e),!this.instance.dispatch("contentResize",{content:this,width:t,height:e}).defaultPrevented&&(j(this.element,t,e),this.isImageContent()&&!this.isError()))){let i=!this.displayedImageWidth&&t;this.displayedImageWidth=t,this.displayedImageHeight=e,i?this.loadImage(!1):this.updateSrcsetSizes(),this.slide&&this.instance.dispatch("imageSizeChange",{slide:this.slide,width:t,height:e,content:this})}}isZoomable(){return this.instance.applyFilters("isContentZoomable",this.isImageContent()&&this.state!==C.ERROR,this)}updateSrcsetSizes(){if(!this.isImageContent()||!this.element||!this.data.srcset)return;let t=this.element,e=this.instance.applyFilters("srcsetSizesWidth",this.displayedImageWidth,this);(!t.dataset.largestUsedSize||e>parseInt(t.dataset.largestUsedSize,10))&&(t.sizes=e+"px",t.dataset.largestUsedSize=String(e))}usePlaceholder(){return this.instance.applyFilters("useContentPlaceholder",this.isImageContent(),this)}lazyLoad(){this.instance.dispatch("contentLazyLoad",{content:this}).defaultPrevented||this.load(!0)}keepPlaceholder(){return this.instance.applyFilters("isKeepingPlaceholder",this.isLoading(),this)}destroy(){this.hasSlide=!1,this.slide=void 0,!this.instance.dispatch("contentDestroy",{content:this}).defaultPrevented&&(this.remove(),this.placeholder&&(this.placeholder.destroy(),this.placeholder=void 0),this.isImageContent()&&this.element&&(this.element.onload=null,this.element.onerror=null,this.element=void 0))}displayError(){if(this.slide){var t,e;let i=I("pswp__error-msg","div");i.innerText=(t=(e=this.instance.options)===null||e===void 0?void 0:e.errorMsg)!==null&&t!==void 0?t:"",i=this.instance.applyFilters("contentErrorElement",i,this),this.element=I("pswp__content pswp__error-msg-container","div"),this.element.appendChild(i),this.slide.container.innerText="",this.slide.container.appendChild(this.element),this.slide.updateContentSize(!0),this.removePlaceholder()}}append(){if(this.isAttached||!this.element)return;if(this.isAttached=!0,this.state===C.ERROR){this.displayError();return}if(this.instance.dispatch("contentAppend",{content:this}).defaultPrevented)return;let t="decode"in this.element;this.isImageContent()?t&&this.slide&&(!this.slide.isActive||Pt())?(this.isDecoding=!0,this.element.decode().catch(()=>{}).finally(()=>{this.isDecoding=!1,this.appendImage()})):this.appendImage():this.slide&&!this.element.parentNode&&this.slide.container.appendChild(this.element)}activate(){this.instance.dispatch("contentActivate",{content:this}).defaultPrevented||!this.slide||(this.isImageContent()&&this.isDecoding&&!Pt()?this.appendImage():this.isError()&&this.load(!1,!0),this.slide.holderElement&&this.slide.holderElement.setAttribute("aria-hidden","false"))}deactivate(){this.instance.dispatch("contentDeactivate",{content:this}),this.slide&&this.slide.holderElement&&this.slide.holderElement.setAttribute("aria-hidden","true")}remove(){this.isAttached=!1,!this.instance.dispatch("contentRemove",{content:this}).defaultPrevented&&(this.element&&this.element.parentNode&&this.element.remove(),this.placeholder&&this.placeholder.element&&this.placeholder.element.remove())}appendImage(){this.isAttached&&(this.instance.dispatch("contentAppendImage",{content:this}).defaultPrevented||(this.slide&&this.element&&!this.element.parentNode&&this.slide.container.appendChild(this.element),(this.state===C.LOADED||this.state===C.ERROR)&&this.removePlaceholder()))}},Te=5;function Ht(r,t,e){let i=t.createContentFromData(r,e),o,{options:s}=t;if(s){o=new G(s,r,-1);let n;t.pswp?n=t.pswp.viewportSize:n=Xt(s,t);let l=Vt(s,n,r,e);o.update(i.width,i.height,l)}return i.lazyLoad(),o&&i.setDisplayedSize(Math.ceil(i.width*o.initial),Math.ceil(i.height*o.initial)),i}function Pe(r,t){let e=t.getItemData(r);if(!t.dispatch("lazyLoadSlide",{index:r,itemData:e}).defaultPrevented)return Ht(e,t,r)}var ut=class{constructor(t){this.pswp=t,this.limit=Math.max(t.options.preload[0]+t.options.preload[1]+1,Te),this._cachedItems=[]}updateLazy(t){let{pswp:e}=this;if(e.dispatch("lazyLoad").defaultPrevented)return;let{preload:i}=e.options,o=t===void 0?!0:t>=0,s;for(s=0;s<=i[1];s++)this.loadSlideByIndex(e.currIndex+(o?s:-s));for(s=1;s<=i[0];s++)this.loadSlideByIndex(e.currIndex+(o?-s:s))}loadSlideByIndex(t){let e=this.pswp.getLoopedIndex(t),i=this.getContentByIndex(e);i||(i=Pe(e,this.pswp),i&&this.addToCache(i))}getContentBySlide(t){let e=this.getContentByIndex(t.index);return e||(e=this.pswp.createContentFromData(t.data,t.index),this.addToCache(e)),e.setSlide(t),e}addToCache(t){if(this.removeByIndex(t.index),this._cachedItems.push(t),this._cachedItems.length>this.limit){let e=this._cachedItems.findIndex(i=>!i.isAttached&&!i.hasSlide);e!==-1&&this._cachedItems.splice(e,1)[0].destroy()}}removeByIndex(t){let e=this._cachedItems.findIndex(i=>i.index===t);e!==-1&&this._cachedItems.splice(e,1)}getContentByIndex(t){return this._cachedItems.find(e=>e.index===t)}destroy(){this._cachedItems.forEach(t=>t.destroy()),this._cachedItems=[]}},ft=class extends ct{getNumItems(){var t;let e=0,i=(t=this.options)===null||t===void 0?void 0:t.dataSource;i&&"length"in i?e=i.length:i&&"gallery"in i&&(i.items||(i.items=this._getGalleryDOMElements(i.gallery)),i.items&&(e=i.items.length));let o=this.dispatch("numItems",{dataSource:i,numItems:e});return this.applyFilters("numItems",o.numItems,i)}createContentFromData(t,e){return new gt(t,this,e)}getItemData(t){var e;let i=(e=this.options)===null||e===void 0?void 0:e.dataSource,o={};Array.isArray(i)?o=i[t]:i&&"gallery"in i&&(i.items||(i.items=this._getGalleryDOMElements(i.gallery)),o=i.items[t]);let s=o;s instanceof Element&&(s=this._domElementToItemData(s));let n=this.dispatch("itemData",{itemData:s||{},index:t});return this.applyFilters("itemData",n.itemData,t)}_getGalleryDOMElements(t){var e,i;return(e=this.options)!==null&&e!==void 0&&e.children||(i=this.options)!==null&&i!==void 0&&i.childSelector?le(this.options.children,this.options.childSelector,t)||[]:[t]}_domElementToItemData(t){let e={element:t},i=t.tagName==="A"?t:t.querySelector("a");if(i){e.src=i.dataset.pswpSrc||i.href,i.dataset.pswpSrcset&&(e.srcset=i.dataset.pswpSrcset),e.width=i.dataset.pswpWidth?parseInt(i.dataset.pswpWidth,10):0,e.height=i.dataset.pswpHeight?parseInt(i.dataset.pswpHeight,10):0,e.w=e.width,e.h=e.height,i.dataset.pswpType&&(e.type=i.dataset.pswpType);let s=t.querySelector("img");if(s){var o;e.msrc=s.currentSrc||s.src,e.alt=(o=s.getAttribute("alt"))!==null&&o!==void 0?o:""}(i.dataset.pswpCropped||i.dataset.cropped)&&(e.thumbCropped=!0)}return this.applyFilters("domItemData",e,t,i)}lazyLoadData(t,e){return Ht(t,this,e)}},E=.003,It=class{constructor(t){this.pswp=t,this.isClosed=!0,this.isOpen=!1,this.isClosing=!1,this.isOpening=!1,this._duration=void 0,this._useAnimation=!1,this._croppedZoom=!1,this._animateRootOpacity=!1,this._animateBgOpacity=!1,this._placeholder=void 0,this._opacityElement=void 0,this._cropContainer1=void 0,this._cropContainer2=void 0,this._thumbBounds=void 0,this._prepareOpen=this._prepareOpen.bind(this),t.on("firstZoomPan",this._prepareOpen)}open(){this._prepareOpen(),this._start()}close(){if(this.isClosed||this.isClosing||this.isOpening)return;let t=this.pswp.currSlide;this.isOpen=!1,this.isOpening=!1,this.isClosing=!0,this._duration=this.pswp.options.hideAnimationDuration,t&&t.currZoomLevel*t.width>=this.pswp.options.maxWidthToAnimate&&(this._duration=0),this._applyStartProps(),setTimeout(()=>{this._start()},this._croppedZoom?30:0)}_prepareOpen(){if(this.pswp.off("firstZoomPan",this._prepareOpe