!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(p,P,t,z){function e(){return{x:0,y:0}}function N(e,t){g.extend(x,t.publicMethods),We.push(e)}function U(e){var t=A();return t-1t.min[e]?n[e]=t.min[e]:n[e]=dt&&(Oe=0x.currItem.fitRatio&&Ht(be))}}var V,X,j,m,$,J,Q,ee,o,f,te,ne,oe,ie,ae,r,re,le,se,ue,ce,de,pe,i,me,fe,he,ge,xe,ye,l,we,ve,be,Ce,Ie,Te,s,Ee,De,Se,_e,Me,u,c,Fe,d,ke,h,Oe,Ae,Re,Le,Ze,Pe,g={features:null,bind:function(e,t,n,o){var i=(o?"remove":"add")+"EventListener";t=t.split(" ");for(var a=0;ax.currItem.fitRatio?Ge||(sn(x.currItem,!1,!0),Ge=!0):Ge&&(sn(x.currItem),Ge=!1)),Ve(ke,w.x,w.y,f))},Xe=function(e){e.container&&Ve(e.container.style,e.initialPosition.x,e.initialPosition.y,e.initialZoomLevel,e)},je=function(e,t){t[de]=ne+e+"px, 0px"+oe},$e=function(e,t){var n;!y.loop&&t&&(t=m+(b.x*Ke-e)/b.x,n=Math.round(e-O.x),t<0&&0=A()-1&&n<0)&&(e=O.x+n*y.mainScrollEndFriction),O.x=e,je(e,$)},Je=function(e,t){var n=bt[e]-He[e];return Ue[e]+Ne[e]+n-t/te*n},S=function(e,t){e.x=t.x,e.y=t.y,t.id&&(e.id=t.id)},Qe=function(e){e.x=Math.round(e.x),e.y=Math.round(e.y)},et=null,tt=function(){et&&(g.unbind(document,"mousemove",tt),g.addClass(p,"pswp--has_mouse"),y.mouseUsed=!0,I("mouseUsed")),et=setTimeout(function(){et=null},100)},nt=function(e,t){e=rn(x.currItem,v,e);return t&&(d=e),e},ot=function(e){return(e=e||x.currItem).initialZoomLevel},it=function(e){return 0<(e=e||x.currItem).w?y.maxSpreadZoom:1},_={},at=0,rt=function(e){_[e]&&(_[e].raf&&fe(_[e].raf),at--,delete _[e])},lt=function(e){_[e]&&rt(e),_[e]||(at++,_[e]={})},st=function(){for(var e in _)_.hasOwnProperty(e)&&rt(e)},ut=function(e,t,n,o,i,a,r){function l(){_[e]&&(s=T()-u,o<=s?(rt(e),a(n),r&&r()):(a((n-t)*i(s/o)+t),_[e].raf=me(l)))}var s,u=T();lt(e);l()},z={shout:I,listen:a,viewportSize:v,options:y,isMainScrollAnimating:function(){return h},getZoomLevel:function(){return f},getCurrentIndex:function(){return m},isDragging:function(){return s},isZooming:function(){return c},setScrollOffset:function(e,t){He.x=e,ye=He.y=t,I("updateScrollOffset",He)},applyZoomPan:function(e,t,n,o){w.x=t,w.y=n,f=e,D(o)},init:function(){if(!V&&!X){x.framework=g,x.template=p,x.bg=g.getChildByClass(p,"pswp__bg"),he=p.className,V=!0,l=g.detectFeatures(),me=l.raf,fe=l.caf,de=l.transform,xe=l.oldIE,x.scrollWrap=g.getChildByClass(p,"pswp__scroll-wrap"),x.container=g.getChildByClass(x.scrollWrap,"pswp__container"),$=x.container.style,x.itemHolders=r=[{el:x.container.children[0],wrap:0,index:-1},{el:x.container.children[1],wrap:0,index:-1},{el:x.container.children[2],wrap:0,index:-1}],r[0].el.style.display=r[2].el.style.display="none",de?(t=l.perspective&&!i,ne="translate"+(t?"3d(":"("),oe=l.perspective?", 0px)":")"):(de="left",g.addClass(p,"pswp--ie"),je=function(e,t){t.left=e+"px"},Xe=function(e){var t=1=A())&&(m=0),x.currItem=Qt(m),(l.isOldIOSPhone||l.isOldAndroid)&&(Be=!1),p.setAttribute("aria-hidden","false"),y.modal&&(Be?p.style.position="fixed":(p.style.position="absolute",p.style.top=g.getScrollY()+"px")),void 0===ye&&(I("initialLayout"),ye=ge=g.getScrollY());var n="pswp--open ";for(y.mainClass&&(n+=y.mainClass+" "),y.showHideOpacity&&(n+="pswp--animate_opacity "),n=(n=(n+=i?"pswp--touch":"pswp--notouch")+(l.animationName?" pswp--css_animation":""))+(l.svg?" pswp--svg":""),g.addClass(p,n),x.updateSize(),J=-1,C=null,e=0;e<3;e++)je((e+J)*b.x,r[e].el.style);xe||g.bind(x.scrollWrap,ee,x),a("initialZoomInEnd",function(){x.setContent(r[0],m-1),x.setContent(r[2],m+1),r[0].el.style.display=r[2].el.style.display="block",y.focus&&p.focus(),g.bind(document,"keydown",x),l.transform&&g.bind(x.scrollWrap,"click",x),y.mouseUsed||g.bind(document,"mousemove",tt),g.bind(window,"resize scroll",x),I("bindEvents")}),x.setContent(r[1],m),x.updateCurrItem(),I("afterInit"),Be||(ie=setInterval(function(){at||s||c||f!==x.currItem.initialZoomLevel||x.updateSize()},1e3)),g.addClass(p,"pswp--visible")}},close:function(){V&&(X=!(V=!1),I("close"),g.unbind(window,"resize",x),g.unbind(window,"scroll",o.scroll),g.unbind(document,"keydown",x),g.unbind(document,"mousemove",tt),l.transform&&g.unbind(x.scrollWrap,"click",x),s&&g.unbind(window,Q,x),I("unbindEvents"),en(x.currItem,null,!0,x.destroy))},destroy:function(){I("destroy"),Xt&&clearTimeout(Xt),p.setAttribute("aria-hidden","true"),p.className=he,ie&&clearInterval(ie),g.unbind(x.scrollWrap,ee,x),g.unbind(window,"scroll",x),Et(),st(),qe=null},panTo:function(e,t,n){n||(e>d.min.x?e=d.min.x:ed.min.y?t=d.min.y:td.min[e]||ad.min[e]&&(u=y.panEndFriction,d.min[e],n=d.min[e]-Ue[e]),(n<=0||s<0)&&1ht.x&&(i=ht.x)):d.min.x!==d.max.x&&(o=a)):(ax.currItem.fitRatio&&(w[e]+=t[e]*u)},Ut=function(){if(u){var e,t,n,o,i,a=u.length;if(0!==a)if(S(M,u[0]),F.x=M.x-k.x,F.y=M.y-k.y,c&&1x.currItem.initialZoomLevel+x.currItem.initialZoomLevel/15&&(Ze=!0),t=1,n=ot(),o=it(),e=dt&&(F.x-=u[0].x-mt.x),Math.abs(F.y)>=dt)&&(F.y-=u[0].y-mt.y),k.x=M.x,k.y=M.y,0!==F.x||0!==F.y)){if("v"===Oe&&y.closeOnVerticalDrag)if(!St())return Ne.y+=F.y,w.y+=F.y,i=Rt(),Ie=!0,I("onVerticalDrag",i),E(i),void D();At(T(),M.x,M.y),Se=!0,d=x.currItem.bounds,Nt("x",F)||(Nt("y",F),Qe(w),D())}}},Kt=function(){var t,n,o={lastFlickOffset:{},lastFlickDist:{},lastFlickSpeed:{},slowDownRatio:{},slowDownRatioReverse:{},speedDecelerationRatio:{},speedDecelerationRatioAbs:{},distanceOffset:{},backAnimDestination:{},backAnimStarted:{},calculateSwipeSpeed:function(e){n=(1d.min[t]?o.backAnimDestination[t]=d.min[t]:w[t]=A()&&(m=y.loop?0:A()-1,i=!0),i&&!y.loop||(C+=o,Ke-=o,n=!0));var n,o,i,e=b.x*Ke,a=Math.abs(e-O.x),r=n||e>O.x==0The image could not be loaded.',forceProgressiveLoading:!1,preload:[1,1],getNumItemsFn:function(){return jt.length}},on=function(){return{center:{x:0,y:0},max:{x:0,y:0},min:{x:0,y:0}}},an=function(e,t,n){var o=e.bounds;o.center.x=Math.round((R.x-t)/2),o.center.y=Math.round((R.y-n)/2)+e.vGap.top,o.max.x=t>R.x?Math.round(R.x-t):o.center.x,o.max.y=n>R.y?Math.round(R.y-n)+e.vGap.top:o.center.y,o.min.x=t>R.x?0:o.center.x,o.min.y=n>R.y?e.vGap.top:o.center.y},rn=function(e,t,n){var o,i;return e.src&&!e.loadError?((o=!n)&&(e.vGap||(e.vGap={top:0,bottom:0}),I("parseVerticalMargin",e)),R.x=t.x,R.y=t.y-e.vGap.top-e.vGap.bottom,o&&(t=R.x/e.w,i=R.y/e.h,e.fitRatio=t=d.max.x&&n<=d.min.y&&n>=d.max.y)&&e.preventDefault(),x.panTo(t,n)},toggleDesktopZoom:function(e){e=e||{x:v.x/2+He.x,y:v.y/2+He.y};var t=y.getDoubleTapZoom(!0,x.currItem),n=f===t;x.mouseZoomedIn=!n,x.zoomTo(n?x.currItem.initialZoomLevel:t,e,333),g[(n?"remove":"add")+"Class"](p,"pswp--zoomed-in")}}}),{history:!0,galleryUID:1}),En=function(){return Z.hash.substring(1)},Dn=function(){var e,t;hn&&clearTimeout(hn),at||s?hn=setTimeout(Dn,500):(gn?clearTimeout(fn):gn=!0,t=m+1,(e=Qt(m)).hasOwnProperty("pid")&&(t=e.pid),e=n+"&gid="+y.galleryUID+"&pid="+t,wn||-1===Z.hash.indexOf(e)&&(bn=!0),t=Z.href.split("#")[0]+"#"+e,Cn?"#"+e!==window.location.hash&&history[wn?"replaceState":"pushState"]("",document.title,t):wn?Z.replace(t):Z.hash=e,wn=!0,fn=setTimeout(function(){gn=!1},60))};N("History",{publicMethods:{initHistory:function(){var e,t;g.extend(y,Tn,!0),y.history&&(Z=window.location,wn=vn=bn=!1,n=En(),Cn="pushState"in history,-1"+e.label+"";if(E.parseShareButtonOut)i=E.parseShareButtonOut(e,i)}x.children[0].innerHTML=i,x.children[0].onclick=z}}function a(e){for(var t=0;t