!function(e,t){"function"==typeof define&&define.amd?define(t):"object"==typeof exports?module.exports=t():e.PhotoSwipe=t()}(this,function(){"use strict";return function(m,n,e,t){var f={features:null,bind:function(e,t,n,i){var o=(i?"remove":"add")+"EventListener";t=t.split(" ");for(var a=0;a=Gt()-1&&t<0)&&(e=vt.x+t*y.mainScrollEndFriction)),vt.x=e,nt(e,W)}function s(e,t){var n=wt[e]-Xe[e];return Ye[e]+He[e]+n-t/$*n}function v(e,t){e.x=t.x,e.y=t.y,t.id&&(e.id=t.id)}function u(e){e.x=Math.round(e.x),e.y=Math.round(e.y)}function p(e,t){return e=$t(h.currItem,We,e),t&&(Re=e),e}function w(e){return(e=e||h.currItem).initialZoomLevel}function b(e){return 0<(e=e||h.currItem).w?y.maxSpreadZoom:1}function I(e,t,n,i){return i===h.currItem.initialZoomLevel?(n[e]=h.currItem.initialPosition[e],!0):(n[e]=s(e,i),n[e]>t.min[e]?(n[e]=t.min[e],!0):n[e]Re.min[e]||aRe.min[e]&&(u=y.panEndFriction,Re.min[e],n=Re.min[e]-Ye[e]),(n<=0||s<0)&&1mt.x&&(o=mt.x)):Re.min.x!==Re.max.x&&(i=a)):(ah.currItem.fitRatio&&(Be[e]+=t[e]*u)}function _(e){var t;"mousedown"===e.type&&0h.currItem.fitRatio&&kt(ve):Pt())}}var U,H,Y,B,W,G,X,V,K,q,$,j,J,Q,ee,te,ne,ie,oe,ae,re,le,se,ue,ce,de,pe,me,fe,he,ye,xe,ge,ve,we,be,Ie,Ce,De,Me,Te,Se,Ae,Ee,Oe,ke,Re,Ze,Pe,Fe,Le,_e,ze,Ne,Ue,He=i(),Ye=i(),Be=i(),We={},Ge=0,Xe={},Ve=i(),Ke=0,qe=!0,$e=[],je={},Je=!1,Qe={},et=function(e){Ze&&(e&&(q>h.currItem.fitRatio?Je||(jt(h.currItem,!1,!0),Je=!0):Je&&(jt(h.currItem),Je=!1)),l(Ze,Be.x,Be.y,q))},tt=function(e){e.container&&l(e.container.style,e.initialPosition.x,e.initialPosition.y,e.initialZoomLevel,e)},nt=function(e,t){t[le]=j+e+"px, 0px"+J},it=null,ot=function(){it&&(f.unbind(document,"mousemove",ot),f.addClass(m,"pswp--has_mouse"),y.mouseUsed=!0,x("mouseUsed")),it=setTimeout(function(){it=null},100)},at={},rt=0,t={shout:x,listen:a,viewportSize:We,options:y,isMainScrollAnimating:function(){return Pe},getZoomLevel:function(){return q},getCurrentIndex:function(){return B},isDragging:function(){return Ce},isZooming:function(){return Oe},setScrollOffset:function(e,t){Xe.x=e,he=Xe.y=t,x("updateScrollOffset",Xe)},applyZoomPan:function(e,t,n,i){Be.x=t,Be.y=n,q=e,et(i)},init:function(){if(!U&&!H){var e;h.framework=f,h.template=m,h.bg=f.getChildByClass(m,"pswp__bg"),pe=m.className,U=!0,ye=f.detectFeatures(),ce=ye.raf,de=ye.caf,le=ye.transform,fe=ye.oldIE,h.scrollWrap=f.getChildByClass(m,"pswp__scroll-wrap"),h.container=f.getChildByClass(h.scrollWrap,"pswp__container"),W=h.container.style,h.itemHolders=te=[{el:h.container.children[0],wrap:0,index:-1},{el:h.container.children[1],wrap:0,index:-1},{el:h.container.children[2],wrap:0,index:-1}],te[0].el.style.display=te[2].el.style.display="none",function(){if(le){var e=ye.perspective&&!ue;return j="translate"+(e?"3d(":"("),J=ye.perspective?", 0px)":")"}le="left",f.addClass(m,"pswp--ie"),nt=function(e,t){t.left=e+"px"},tt=function(e){var t=1=Gt())&&(B=0),h.currItem=Wt(B),(ye.isOldIOSPhone||ye.isOldAndroid)&&(qe=!1),m.setAttribute("aria-hidden","false"),y.modal&&(qe?m.style.position="fixed":(m.style.position="absolute",m.style.top=f.getScrollY()+"px")),void 0===he&&(x("initialLayout"),he=me=f.getScrollY());t="pswp--open ";for(y.mainClass&&(t+=y.mainClass+" "),y.showHideOpacity&&(t+="pswp--animate_opacity "),t+=ue?"pswp--touch":"pswp--notouch",t+=ye.animationName?" pswp--css_animation":"",t+=ye.svg?" pswp--svg":"",f.addClass(m,t),h.updateSize(),G=-1,Ke=null,e=0;e<3;e++)nt((e+G)*Ve.x,te[e].el.style);fe||f.bind(h.scrollWrap,V,h),a("initialZoomInEnd",function(){h.setContent(te[0],B-1),h.setContent(te[2],B+1),te[0].el.style.display=te[2].el.style.display="block",y.focus&&m.focus(),f.bind(document,"keydown",h),ye.transform&&f.bind(h.scrollWrap,"click",h),y.mouseUsed||f.bind(document,"mousemove",ot),f.bind(window,"resize scroll",h),x("bindEvents")}),h.setContent(te[1],B),h.updateCurrItem(),x("afterInit"),qe||(Q=setInterval(function(){rt||Ce||Oe||q!==h.currItem.initialZoomLevel||h.updateSize()},1e3)),f.addClass(m,"pswp--visible")}},close:function(){U&&(H=!(U=!1),x("close"),f.unbind(window,"resize",h),f.unbind(window,"scroll",K.scroll),f.unbind(document,"keydown",h),f.unbind(document,"mousemove",ot),ye.transform&&f.unbind(h.scrollWrap,"click",h),Ce&&f.unbind(window,X,h),x("unbindEvents"),Xt(h.currItem,null,!0,h.destroy))},destroy:function(){x("destroy"),Ut&&clearTimeout(Ut),m.setAttribute("aria-hidden","true"),m.className=pe,Q&&clearInterval(Q),f.unbind(h.scrollWrap,V,h),f.unbind(window,"scroll",h),It(),A(),Qe=null},panTo:function(e,t,n){n||(e>Re.min.x?e=Re.min.x:eRe.min.y?t=Re.min.y:th.currItem.initialZoomLevel+h.currItem.initialZoomLevel/15&&(Ne=!0),e=1,a=w(),i=b(),nRe.min[t]?i.backAnimDestination[t]=Re.min[t]:Be[t]=Gt()&&(B=y.loop?0:Gt()-1,o=!0),o&&!y.loop||(Ke+=a,Ge-=a,n=!0));var o=Ve.x*Ge,a=Math.abs(o-vt.x),r=n||o>vt.x==0The image could not be loaded.',forceProgressiveLoading:!1,preload:[1,1],getNumItemsFn:function(){return Ht.length}},$t=function(e,t,n){if(!e.src||e.loadError)return e.w=e.h=0,e.initialZoomLevel=e.fitRatio=1,e.bounds=Ft(),e.initialPosition=e.bounds.center,e.bounds;var i,o,a,r=!n;return r&&(e.vGap||(e.vGap={top:0,bottom:0}),x("parseVerticalMargin",e)),Vt.x=t.x,Vt.y=t.y-e.vGap.top-e.vGap.bottom,r&&(i=Vt.x/e.w,o=Vt.y/e.h,e.fitRatio=iVt.x?Math.round(Vt.x-i):a.center.x,a.max.y=o>Vt.y?Math.round(Vt.y-o)+t.vGap.top:a.center.y,a.min.x=i>Vt.x?0:a.center.x,a.min.y=o>Vt.y?t.vGap.top:a.center.y,r&&n===e.initialZoomLevel&&(e.initialPosition=e.bounds.center),e.bounds):void 0},jt=function(e,t,n){var i;e.src&&(t=t||e.container.lastChild,i=n?e.w:Math.round(e.w*e.fitRatio),n=n?e.h:Math.round(e.h*e.fitRatio),e.placeholder&&!e.loaded&&(e.placeholder.style.width=i+"px",e.placeholder.style.height=n+"px"),t.style.width=i+"px",t.style.height=n+"px")};o("Controller",{publicMethods:{lazyLoadItem:function(e){e=r(e);var t=Wt(e);t&&(!t.loaded&&!t.loading||ee)&&(x("gettingData",e,t),t.src&&_t(t))},initController:function(){f.extend(y,qt,!0),h.items=Ht=e,Wt=h.getItemAt,Gt=y.getNumItemsFn,y.loop,Gt()<3&&(y.loop=!1),a("beforeChange",function(e){for(var t=y.preload,n=null===e||0<=e,i=Math.min(t[0],Gt()),o=Math.min(t[1],Gt()),a=1;a<=(n?o:i);a++)h.lazyLoadItem(B+a);for(a=1;a<=(n?i:o);a++)h.lazyLoadItem(B-a)}),a("initialLayout",function(){h.currItem.initialLayout=y.getThumbBoundsFn&&y.getThumbBoundsFn(B)}),a("mainScrollAnimComplete",Nt),a("initialZoomInEnd",Nt),a("destroy",function(){for(var e,t=0;t=Re.max.x&&n<=Re.min.y&&n>=Re.max.y)&&e.preventDefault(),h.panTo(t,n)},toggleDesktopZoom:function(e){e=e||{x:We.x/2+Xe.x,y:We.y/2+Xe.y};var t=y.getDoubleTapZoom(!0,h.currItem),n=q===t;h.mouseZoomedIn=!n,h.zoomTo(n?h.currItem.initialZoomLevel:t,e,333),f[(n?"remove":"add")+"Class"](m,"pswp--zoomed-in")}}});function nn(){return yn.hash.substring(1)}function on(){rn&&clearTimeout(rn),sn&&clearTimeout(sn)}function an(){var e=nn(),t={};if(e.length<5)return t;var n,i=e.split("&");for(a=0;a