!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(e,t,n,o){var i={features:null,bind:function(e,t,n,o){var i=(o?"remove":"add")+"EventListener";t=t.split(" ");for(var a=0;a0&&(a=parseInt(a[1],10))>=1&&a<8&&(n.isOldIOSPhone=!0)}var r=o.match(/Android\s([0-9\.]*)/),l=r?r[1]:0;(l=parseFloat(l))>=1&&(l<4.4&&(n.isOldAndroid=!0),n.androidVersion=l),n.isMobileOpera=/opera mini|opera mobi/i.test(o)}for(var s,u,c=["transform","perspective","animationName"],d=["","webkit","Moz","ms","O"],p=0;p<4;p++){t=d[p];for(var m=0;m<3;m++)s=c[m],u=t+(t?s.charAt(0).toUpperCase()+s.slice(1):s),!n[s]&&u in e&&(n[s]=u);t&&!n.raf&&(t=t.toLowerCase(),n.raf=window[t+"RequestAnimationFrame"],n.raf&&(n.caf=window[t+"CancelAnimationFrame"]||window[t+"CancelRequestAnimationFrame"]))}if(!n.raf){var f=0;n.raf=function(e){var t=(new Date).getTime(),n=Math.max(0,16-(t-f)),o=window.setTimeout((function(){e(t+n)}),n);return f=t+n,o},n.caf=function(e){clearTimeout(e)}}return n.svg=!!document.createElementNS&&!!document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect,i.features=n,n}};i.detectFeatures(),i.features.oldIE&&(i.bind=function(e,t,n,o){t=t.split(" ");for(var i,a=(o?"detach":"attach")+"Event",r=function(){n.handleEvent.call(n)},l=0;lt-1?e-t:e<0?t+e:e},Ie={},Te=function(e,t){return Ie[e]||(Ie[e]=[]),Ie[e].push(t)},Ee=function(e){var t=Ie[e];if(t){var n=Array.prototype.slice.call(arguments);n.shift();for(var o=0;oa.currItem.fitRatio?we||(jt(a.currItem,!1,!0),we=!0):we&&(jt(a.currItem),we=!1)),_e(te,de.x,de.y,v))},Fe=function(e){e.container&&_e(e.container.style,e.initialPosition.x,e.initialPosition.y,e.initialZoomLevel,e)},Oe=function(e,t){t[_]=g+e+"px, 0px"+y},ke=function(e,t){if(!r.loop&&t){var n=c+(he.x*me-e)/he.x,o=Math.round(e-ct.x);(n<0&&o>0||n>=Kt()-1&&o<0)&&(e=ct.x+o*r.mainScrollEndFriction)}ct.x=e,Oe(e,d)},Ae=function(e,t){var n=dt[e]-fe[e];return ce[e]+ue[e]+n-n*(t/x)},Re=function(e,t){e.x=t.x,e.y=t.y,t.id&&(e.id=t.id)},Le=function(e){e.x=Math.round(e.x),e.y=Math.round(e.y)},Pe=null,Ze=function(){Pe&&(i.unbind(document,"mousemove",Ze),i.addClass(e,"pswp--has_mouse"),r.mouseUsed=!0,Ee("mouseUsed")),Pe=setTimeout((function(){Pe=null}),100)},ze=function(e,t){var n=Gt(a.currItem,pe,e);return t&&(ee=n),n},Ne=function(e){return e||(e=a.currItem),e.initialZoomLevel},Ue=function(e){return e||(e=a.currItem),e.w>0?r.maxSpreadZoom:1},Ke=function(e,t,n,o){return o===a.currItem.initialZoomLevel?(n[e]=a.currItem.initialPosition[e],!0):(n[e]=Ae(e,o),n[e]>t.min[e]?(n[e]=t.min[e],!0):n[e]=o)return qe(e),a(n),void(r&&r());a((n-t)*i(l/o)+t),Ye[e].raf=O(u)}};u()},$e={shout:Ee,listen:Te,viewportSize:pe,options:r,isMainScrollAnimating:function(){return ne},getZoomLevel:function(){return v},getCurrentIndex:function(){return c},isDragging:function(){return Y},isZooming:function(){return J},setScrollOffset:function(e,t){fe.x=e,P=fe.y=t,Ee("updateScrollOffset",fe)},applyZoomPan:function(e,t,n,o){de.x=t,de.y=n,v=e,Me(o)},init:function(){if(!l&&!s){var n;a.framework=i,a.template=e,a.bg=i.getChildByClass(e,"pswp__bg"),A=e.className,l=!0,Z=i.detectFeatures(),O=Z.raf,k=Z.caf,_=Z.transform,L=Z.oldIE,a.scrollWrap=i.getChildByClass(e,"pswp__scroll-wrap"),a.container=i.getChildByClass(a.scrollWrap,"pswp__container"),d=a.container.style,a.itemHolders=C=[{el:a.container.children[0],wrap:0,index:-1},{el:a.container.children[1],wrap:0,index:-1},{el:a.container.children[2],wrap:0,index:-1}],C[0].el.style.display=C[2].el.style.display="none",function(){if(_){var t=Z.perspective&&!F;return g="translate"+(t?"3d(":"("),void(y=Z.perspective?", 0px)":")")}_="left",i.addClass(e,"pswp--ie"),Oe=function(e,t){t.left=e+"px"},Fe=function(e){var t=e.fitRatio>1?1:e.fitRatio,n=e.container.style,o=t*e.w,i=t*e.h;n.width=o+"px",n.height=i+"px",n.left=e.initialPosition.x+"px",n.top=e.initialPosition.y+"px"},Me=function(){if(te){var e=te,t=a.currItem,n=t.fitRatio>1?1:t.fitRatio,o=n*t.w,i=n*t.h;e.width=o+"px",e.height=i+"px",e.left=de.x+"px",e.top=de.y+"px"}}}(),h={resize:a.updateSize,orientationchange:function(){clearTimeout(z),z=setTimeout((function(){pe.x!==a.scrollWrap.clientWidth&&a.updateSize()}),500)},scroll:Be,keydown:He,click:We};var o=Z.isOldIOSPhone||Z.isOldAndroid||Z.isMobileOpera;for(Z.animationName&&Z.transform&&!o||(r.showAnimationDuration=r.hideAnimationDuration=0),n=0;n=Kt())&&(c=0),a.currItem=Ut(c),(Z.isOldIOSPhone||Z.isOldAndroid)&&(xe=!1),e.setAttribute("aria-hidden","false"),r.modal&&(xe?e.style.position="fixed":(e.style.position="absolute",e.style.top=i.getScrollY()+"px")),void 0===P&&(Ee("initialLayout"),P=R=i.getScrollY());var u="pswp--open ";for(r.mainClass&&(u+=r.mainClass+" "),r.showHideOpacity&&(u+="pswp--animate_opacity "),u+=F?"pswp--touch":"pswp--notouch",u+=Z.animationName?" pswp--css_animation":"",u+=Z.svg?" pswp--svg":"",i.addClass(e,u),a.updateSize(),p=-1,ve=null,n=0;n<3;n++)Oe((n+p)*he.x,C[n].el.style);L||i.bind(a.scrollWrap,f,a),Te("initialZoomInEnd",(function(){a.setContent(C[0],c-1),a.setContent(C[2],c+1),C[0].el.style.display=C[2].el.style.display="block",r.focus&&e.focus(),i.bind(document,"keydown",a),Z.transform&&i.bind(a.scrollWrap,"click",a),r.mouseUsed||i.bind(document,"mousemove",Ze),i.bind(window,"resize scroll orientationchange",a),Ee("bindEvents")})),a.setContent(C[1],c),a.updateCurrItem(),Ee("afterInit"),xe||(w=setInterval((function(){Ge||Y||J||v!==a.currItem.initialZoomLevel||a.updateSize()}),1e3)),i.addClass(e,"pswp--visible")}},close:function(){l&&(l=!1,s=!0,Ee("close"),i.unbind(window,"resize scroll orientationchange",a),i.unbind(window,"scroll",h.scroll),i.unbind(document,"keydown",a),i.unbind(document,"mousemove",Ze),Z.transform&&i.unbind(a.scrollWrap,"click",a),Y&&i.unbind(window,m,a),clearTimeout(z),Ee("unbindEvents"),Ht(a.currItem,null,!0,a.destroy))},destroy:function(){Ee("destroy"),Pt&&clearTimeout(Pt),e.setAttribute("aria-hidden","true"),e.className=A,w&&clearInterval(w),i.unbind(a.scrollWrap,f,a),i.unbind(window,"scroll",a),ft(),Xe(),Ie=null},panTo:function(e,t,n){n||(e>ee.min.x?e=ee.min.x:eee.min.y?t=ee.min.y:t=3&&(p+=ve+(ve>0?-3:3),n=3);for(var o=0;o0?(t=C.shift(),C[2]=t,p++,Oe((p+2)*he.x,t.el.style),a.setContent(t,c-n+o+1+1)):(t=C.pop(),C.unshift(t),p--,Oe(p*he.x,t.el.style),a.setContent(t,c+n-o-1-1));if(te&&1===Math.abs(ve)){var i=Ut(I);i.initialZoomLevel!==v&&(Gt(i,pe),jt(i),Fe(i))}ve=0,a.updateCurrZoomItem(),I=c,Ee("afterChange")}}},updateSize:function(t){if(!xe&&r.modal){var n=i.getScrollY();if(P!==n&&(e.style.top=n+"px",P=n),!t&&ye.x===window.innerWidth&&ye.y===window.innerHeight)return;ye.x=window.innerWidth,ye.y=window.innerHeight,e.style.height=ye.y+"px"}if(pe.x=a.scrollWrap.clientWidth,pe.y=a.scrollWrap.clientHeight,Be(),he.x=pe.x+Math.round(pe.x*r.spacing),he.y=pe.y,ke(he.x*me),Ee("beforeResize"),void 0!==p){for(var o,l,s,u=0;u<3;u++)o=C[u],Oe((u+p)*he.x,o.el.style),s=c+u-1,r.loop&&Kt()>2&&(s=Ce(s)),(l=Ut(s))&&(b||l.needsUpdate||!l.bounds)?(a.cleanSlide(l),a.setContent(o,s),1===u&&(a.currItem=l,a.updateCurrZoomItem(!0)),l.needsUpdate=!1):-1===o.index&&s>=0&&a.setContent(o,s),l&&l.container&&(Gt(l,pe),jt(l),Fe(l));b=!1}x=v=a.currItem.initialZoomLevel,(ee=a.currItem.bounds)&&(de.x=ee.center.x,de.y=ee.center.y,Me(!0)),Ee("resize")},zoomTo:function(e,t,n,o,a){t&&(x=v,dt.x=Math.abs(t.x)-de.x,dt.y=Math.abs(t.y)-de.y,Re(ce,de));var r=ze(e,!1),l={};Ke("x",r,l,e),Ke("y",r,l,e);var s=v,u=de.x,c=de.y;Le(l);var d=function(t){1===t?(v=e,de.x=l.x,de.y=l.y):(v=(e-s)*t+s,de.x=(l.x-u)*t+u,de.y=(l.y-c)*t+c),a&&a(t),Me(1===t)};n?je("customZoomTo",0,1,n,o||i.easing.sine.inOut,d):d(1)}},Je={},Qe={},et={},tt={},nt={},ot=[],it={},at=[],rt={},lt=0,st={x:0,y:0},ut=0,ct={x:0,y:0},dt={x:0,y:0},pt={x:0,y:0},mt=function(e,t){return rt.x=Math.abs(e.x-t.x),rt.y=Math.abs(e.y-t.y),Math.sqrt(rt.x*rt.x+rt.y*rt.y)},ft=function(){X&&(k(X),X=null)},ht=function(){Y&&(X=O(ht),Mt())},vt=function(e,t){return!(!e||e===document)&&(!(e.getAttribute("class")&&e.getAttribute("class").indexOf("pswp__scroll-wrap")>-1)&&(t(e)?e:vt(e.parentNode,t)))},xt={},gt=function(e,t){return xt.prevent=!vt(e.target,r.isClickableElement),Ee("preventDragEvent",e,t,xt),xt.prevent},yt=function(e,t){return t.x=e.pageX,t.y=e.pageY,t.id=e.identifier,t},wt=function(e,t,n){n.x=.5*(e.x+t.x),n.y=.5*(e.y+t.y)},bt=function(){var e=de.y-a.currItem.initialPosition.y;return 1-Math.abs(e/(pe.y/2))},Ct={},It={},Tt=[],Et=function(e){for(;Tt.length>0;)Tt.pop();return M?(se=0,ot.forEach((function(e){0===se?Tt[0]=e:1===se&&(Tt[1]=e),se++}))):e.type.indexOf("touch")>-1?e.touches&&e.touches.length>0&&(Tt[0]=yt(e.touches[0],Ct),e.touches.length>1&&(Tt[1]=yt(e.touches[1],It))):(Ct.x=e.pageX,Ct.y=e.pageY,Ct.id="",Tt[0]=Ct),Tt},Dt=function(e,t){var n,o,i,l,s=de[e]+t[e],u=t[e]>0,c=ct.x+t.x,d=ct.x-it.x;if(n=s>ee.min[e]||see.min[e]&&(n=r.panEndFriction,ee.min[e]-s,o=ee.min[e]-ce[e]),(o<=0||d<0)&&Kt()>1?(l=c,d<0&&c>it.x&&(l=it.x)):ee.min.x!==ee.max.x&&(i=s)):(s0)&&Kt()>1?(l=c,d>0&&ca.currItem.fitRatio&&(de[e]+=t[e]*n)},St=function(e){if(!("mousedown"===e.type&&e.button>0))if(Nt)e.preventDefault();else if(!B||"mousedown"!==e.type){if(gt(e,!0)&&e.preventDefault(),Ee("pointerDown"),M){var t=i.arraySearch(ot,e.pointerId,"id");t<0&&(t=ot.length),ot[t]={x:e.pageX,y:e.pageY,id:e.pointerId}}var n=Et(e),o=n.length;$=null,Xe(),Y&&1!==o||(Y=ie=!0,i.bind(window,m,a),H=le=ae=W=j=V=G=q=!1,oe=null,Ee("firstTouchStart",n),Re(ce,de),ue.x=ue.y=0,Re(tt,n[0]),Re(nt,tt),it.x=he.x*me,at=[{x:tt.x,y:tt.y}],U=N=De(),ze(v,!0),ft(),ht()),!J&&o>1&&!ne&&!j&&(x=v,q=!1,J=G=!0,ue.y=ue.x=0,Re(ce,de),Re(Je,n[0]),Re(Qe,n[1]),wt(Je,Qe,pt),dt.x=Math.abs(pt.x)-de.x,dt.y=Math.abs(pt.y)-de.y,Q=mt(Je,Qe))}},_t=function(e){if(e.preventDefault(),M){var t=i.arraySearch(ot,e.pointerId,"id");if(t>-1){var n=ot[t];n.x=e.pageX,n.y=e.pageY}}if(Y){var o=Et(e);if(oe||V||J)$=o;else if(ct.x!==he.x*me)oe="h";else{var a=Math.abs(o[0].x-tt.x)-Math.abs(o[0].y-tt.y);Math.abs(a)>=10&&(oe=a>0?"h":"v",$=o)}}},Mt=function(){if($){var e=$.length;if(0!==e)if(Re(Je,$[0]),et.x=Je.x-tt.x,et.y=Je.y-tt.y,J&&e>1){if(tt.x=Je.x,tt.y=Je.y,!et.x&&!et.y&&function(e,t){return e.x===t.x&&e.y===t.y}($[1],Qe))return;Re(Qe,$[1]),q||(q=!0,Ee("zoomGestureStarted"));var t=mt(Je,Qe),n=Rt(t);n>a.currItem.initialZoomLevel+a.currItem.initialZoomLevel/15&&(le=!0);var o=1,i=Ne(),l=Ue();if(n1&&(o=1),n=i-o*(i/3);else n>l&&((o=(n-l)/(6*i))>1&&(o=1),n=l+o*i);o<0&&(o=0),t,wt(Je,Qe,st),ue.x+=st.x-pt.x,ue.y+=st.y-pt.y,Re(pt,st),de.x=Ae("x",n),de.y=Ae("y",n),H=n>v,v=n,Me()}else{if(!oe)return;if(ie&&(ie=!1,Math.abs(et.x)>=10&&(et.x-=$[0].x-nt.x),Math.abs(et.y)>=10&&(et.y-=$[0].y-nt.y)),tt.x=Je.x,tt.y=Je.y,0===et.x&&0===et.y)return;if("v"===oe&&r.closeOnVerticalDrag&&"fit"===r.scaleMode&&v===a.currItem.initialZoomLevel){ue.y+=et.y,de.y+=et.y;var u=bt();return W=!0,Ee("onVerticalDrag",u),Se(u),void Me()}!function(e,t,n){if(e-U>50){var o=at.length>2?at.shift():{};o.x=t,o.y=n,at.push(o),U=e}}(De(),Je.x,Je.y),V=!0,ee=a.currItem.bounds,Dt("x",et)||(Dt("y",et),Le(de),Me())}}},Ft=function(e){if(Z.isOldAndroid){if(B&&"mouseup"===e.type)return;e.type.indexOf("touch")>-1&&(clearTimeout(B),B=setTimeout((function(){B=0}),600))}var t;if(Ee("pointerUp"),gt(e,!1)&&e.preventDefault(),M){var n=i.arraySearch(ot,e.pointerId,"id");if(n>-1)if(t=ot.splice(n,1)[0],navigator.msPointerEnabled){t.type={4:"mouse",2:"touch",3:"pen"}[e.pointerType],t.type||(t.type=e.pointerType||"mouse")}else t.type=e.pointerType||"mouse"}var o,l=Et(e),s=l.length;if("mouseup"===e.type&&(s=0),2===s)return $=null,!0;1===s&&Re(nt,l[0]),0!==s||oe||ne||(t||("mouseup"===e.type?t={x:e.pageX,y:e.pageY,type:"mouse"}:e.changedTouches&&e.changedTouches[0]&&(t={x:e.changedTouches[0].pageX,y:e.changedTouches[0].pageY,type:"touch"})),Ee("touchRelease",e,t));var u=-1;if(0===s&&(Y=!1,i.unbind(window,m,a),ft(),J?u=0:-1!==ut&&(u=De()-ut)),ut=1===s?De():-1,o=-1!==u&&u<150?"zoom":"swipe",J&&s<2&&(J=!1,1===s&&(o="zoomPointerUp"),Ee("zoomGestureEnded")),$=null,V||q||ne||W)if(Xe(),K||(K=Ot()),K.calculateSwipeSpeed("x"),W){if(bt()a.currItem.fitRatio&&kt(K):Lt())}},Ot=function(){var e,t,n={lastFlickOffset:{},lastFlickDist:{},lastFlickSpeed:{},slowDownRatio:{},slowDownRatioReverse:{},speedDecelerationRatio:{},speedDecelerationRatioAbs:{},distanceOffset:{},backAnimDestination:{},backAnimStarted:{},calculateSwipeSpeed:function(o){at.length>1?(e=De()-U+50,t=at[at.length-2][o]):(e=De()-N,t=nt[o]),n.lastFlickOffset[o]=tt[o]-t,n.lastFlickDist[o]=Math.abs(n.lastFlickOffset[o]),n.lastFlickDist[o]>20?n.lastFlickSpeed[o]=n.lastFlickOffset[o]/e:n.lastFlickSpeed[o]=0,Math.abs(n.lastFlickSpeed[o])<.1&&(n.lastFlickSpeed[o]=0),n.slowDownRatio[o]=.95,n.slowDownRatioReverse[o]=1-n.slowDownRatio[o],n.speedDecelerationRatio[o]=1},calculateOverBoundsAnimOffset:function(e,t){n.backAnimStarted[e]||(de[e]>ee.min[e]?n.backAnimDestination[e]=ee.min[e]:de[e]30&&(u||t.lastFlickOffset.x>20)?o=-1:s<-30&&(u||t.lastFlickOffset.x<-20)&&(o=1)}o&&((c+=o)<0?(c=r.loop?Kt()-1:0,l=!0):c>=Kt()&&(c=r.loop?0:Kt()-1,l=!0),l&&!r.loop||(ve+=o,me-=o,n=!0));var d,p=he.x*me,m=Math.abs(p-ct.x);return n||p>ct.x==t.lastFlickSpeed.x>0?(d=Math.abs(t.lastFlickSpeed.x)>0?m/Math.abs(t.lastFlickSpeed.x):333,d=Math.min(d,400),d=Math.max(d,250)):d=333,lt===c&&(n=!1),ne=!0,Ee("mainScrollAnimStart"),je("mainScroll",ct.x,p,d,i.easing.cubic.out,ke,(function(){Xe(),ne=!1,lt=-1,(n||lt!==c)&&a.updateCurrItem(),Ee("mainScrollAnimComplete")})),n&&a.updateCurrItem(!0),n},Rt=function(e){return 1/Q*e*x},Lt=function(){var e=v,t=Ne(),n=Ue();vn&&(e=n);var o,r=re;return ae&&!H&&!le&&v1||navigator.msMaxTouchPoints>1),a.likelyTouchDevice=F,h[T]=St,h[E]=_t,h[D]=Ft,S&&(h[S]=h[D]),Z.touch&&(f+=" mousedown",m+=" mousemove mouseup",h.mousedown=h[T],h.mousemove=h[E],h.mouseup=h[D]),F||(r.allowPanToNext=!1)}}});var Pt,Zt,zt,Nt,Ut,Kt,Ht=function(t,n,o,l){var s;Pt&&clearTimeout(Pt),Nt=!0,zt=!0,t.initialLayout?(s=t.initialLayout,t.initialLayout=null):s=r.getThumbBoundsFn&&r.getThumbBoundsFn(c);var d=o?r.hideAnimationDuration:r.showAnimationDuration,p=function(){qe("initialZoom"),o?(a.template.removeAttribute("style"),a.bg.removeAttribute("style")):(Se(1),n&&(n.style.display="block"),i.addClass(e,"pswp--animated-in"),Ee("initialZoom"+(o?"OutEnd":"InEnd"))),l&&l(),Nt=!1};if(!d||!s||void 0===s.x)return Ee("initialZoom"+(o?"Out":"In")),v=t.initialZoomLevel,Re(de,t.initialPosition),Me(),e.style.opacity=o?0:1,Se(1),void(d?setTimeout((function(){p()}),d):p());var m,f;m=u,f=!a.currItem.src||a.currItem.loadError||r.showHideOpacity,t.miniImg&&(t.miniImg.style.webkitBackfaceVisibility="hidden"),o||(v=s.w/t.w,de.x=s.x,de.y=s.y-R,a[f?"template":"bg"].style.opacity=.001,Me()),Ve("initialZoom"),o&&!m&&i.removeClass(e,"pswp--animated-in"),f&&(o?i[(m?"remove":"add")+"Class"](e,"pswp--animate_opacity"):setTimeout((function(){i.addClass(e,"pswp--animate_opacity")}),30)),Pt=setTimeout((function(){if(Ee("initialZoom"+(o?"Out":"In")),o){var n=s.w/t.w,a={x:de.x,y:de.y},r=v,l=re,u=function(t){1===t?(v=n,de.x=s.x,de.y=s.y-P):(v=(n-r)*t+r,de.x=(s.x-a.x)*t+a.x,de.y=(s.y-P-a.y)*t+a.y),Me(),f?e.style.opacity=1-t:Se(l-t*l)};m?je("initialZoom",0,1,d,i.easing.cubic.out,u,p):(u(1),Pt=setTimeout(p,d+20))}else v=t.initialZoomLevel,Re(de,t.initialPosition),Me(),Se(1),f?e.style.opacity=1:Se(1),Pt=setTimeout(p,d+20)}),o?25:90)},Wt={},Bt=[],Yt={index:0,errorMsg:'
The image could not be loaded.
',forceProgressiveLoading:!1,preload:[1,1],getNumItemsFn:function(){return Zt.length}},Gt=function(e,t,n){if(e.src&&!e.loadError){var o=!n;if(o&&(e.vGap||(e.vGap={top:0,bottom:0}),Ee("parseVerticalMargin",e)),Wt.x=t.x,Wt.y=t.y-e.vGap.top-e.vGap.bottom,o){var i=Wt.x/e.w,a=Wt.y/e.h;e.fitRatio=i1&&(n=1),e.initialZoomLevel=n,e.bounds||(e.bounds={center:{x:0,y:0},max:{x:0,y:0},min:{x:0,y:0}})}if(!n)return;return function(e,t,n){var o=e.bounds;o.center.x=Math.round((Wt.x-t)/2),o.center.y=Math.round((Wt.y-n)/2)+e.vGap.top,o.max.x=t>Wt.x?Math.round(Wt.x-t):o.center.x,o.max.y=n>Wt.y?Math.round(Wt.y-n)+e.vGap.top:o.center.y,o.min.x=t>Wt.x?0:o.center.x,o.min.y=n>Wt.y?e.vGap.top:o.center.y}(e,e.w*n,e.h*n),o&&n===e.initialZoomLevel&&(e.initialPosition=e.bounds.center),e.bounds}return e.w=e.h=0,e.initialZoomLevel=e.fitRatio=1,e.bounds={center:{x:0,y:0},max:{x:0,y:0},min:{x:0,y:0}},e.initialPosition=e.bounds.center,e.bounds},qt=function(e,t,n,o,i,r){t.loadError||o&&(t.imageAppended=!0,jt(t,o,t===a.currItem&&we),n.appendChild(o),r&&setTimeout((function(){t&&t.loaded&&t.placeholder&&(t.placeholder.style.display="none",t.placeholder=null)}),500))},Vt=function(e){e.loading=!0,e.loaded=!1;var t=e.img=i.createEl("pswp__img","img"),n=function(){e.loading=!1,e.loaded=!0,e.loadComplete?e.loadComplete(e):e.img=null,t.onload=t.onerror=null,t=null};return t.onload=n,t.onerror=function(){e.loadError=!0,n()},t.src=e.src,t},Xt=function(e,t){if(e.src&&e.loadError&&e.container)return t&&(e.container.innerHTML=""),e.container.innerHTML=r.errorMsg.replace("%url%",e.src),!0},jt=function(e,t,n){if(e.src){t||(t=e.container.lastChild);var o=n?e.w:Math.round(e.w*e.fitRatio),i=n?e.h:Math.round(e.h*e.fitRatio);e.placeholder&&!e.loaded&&(e.placeholder.style.width=o+"px",e.placeholder.style.height=i+"px"),t.style.width=o+"px",t.style.height=i+"px"}},$t=function(){if(Bt.length){for(var e,t=0;t=0,i=Math.min(n[0],Kt()),l=Math.min(n[1],Kt());for(t=1;t<=(o?l:i);t++)a.lazyLoadItem(c+t);for(t=1;t<=(o?i:l);t++)a.lazyLoadItem(c-t)})),Te("initialLayout",(function(){a.currItem.initialLayout=r.getThumbBoundsFn&&r.getThumbBoundsFn(c)})),Te("mainScrollAnimComplete",$t),Te("initialZoomInEnd",$t),Te("destroy",(function(){for(var e,t=0;t=0&&(void 0!==Zt[e]&&Zt[e])},allowProgressiveImg:function(){return r.forceProgressiveLoading||!F||r.mouseUsed||screen.width>1200},setContent:function(e,t){r.loop&&(t=Ce(t));var n=a.getItemAt(e.index);n&&(n.container=null);var o,s=a.getItemAt(t);if(s){Ee("gettingData",t,s),e.index=t,e.item=s;var u=s.container=i.createEl("pswp__zoom-wrap");if(!s.src&&s.html&&(s.html.tagName?u.appendChild(s.html):u.innerHTML=s.html),Xt(s),Gt(s,pe),!s.src||s.loadError||s.loaded)s.src&&!s.loadError&&((o=i.createEl("pswp__img","img")).style.opacity=1,o.src=s.src,jt(s,o),qt(0,s,u,o));else{if(s.loadComplete=function(n){if(l){if(e&&e.index===t){if(Xt(n,!0))return n.loadComplete=n.img=null,Gt(n,pe),Fe(n),void(e.index===c&&a.updateCurrZoomItem());n.imageAppended?!Nt&&n.placeholder&&(n.placeholder.style.display="none",n.placeholder=null):Z.transform&&(ne||Nt)?Bt.push({item:n,baseDiv:u,img:n.img,index:t,holder:e,clearPlaceholder:!0}):qt(0,n,u,n.img,0,!0)}n.loadComplete=null,n.img=null,Ee("imageLoadComplete",t,n)}},i.features.transform){var d="pswp__img pswp__img--placeholder";d+=s.msrc?"":" pswp__img--placeholder--blank";var p=i.createEl(d,s.msrc?"img":"");s.msrc&&(p.src=s.msrc),jt(s,p),u.appendChild(p),s.placeholder=p}s.loading||Vt(s),a.allowProgressiveImg()&&(!zt&&Z.transform?Bt.push({item:s,baseDiv:u,img:s.img,index:t,holder:e}):qt(0,s,u,s.img,0,!0))}zt||t!==c?Fe(s):(te=u.style,Ht(s,o||s.img)),e.el.innerHTML="",e.el.appendChild(u)}else e.el.innerHTML=""},cleanSlide:function(e){e.img&&(e.img.onload=e.img.onerror=null),e.loaded=e.loading=e.img=e.imageAppended=!1}}});var Jt,Qt,en={},tn=function(e,t,n){var o=document.createEvent("CustomEvent"),i={origEvent:e,target:e.target,releasePoint:t,pointerType:n||"touch"};o.initCustomEvent("pswpTap",!0,!0,i),e.target.dispatchEvent(o)};be("Tap",{publicMethods:{initTap:function(){Te("firstTouchStart",a.onTapStart),Te("touchRelease",a.onTapRelease),Te("destroy",(function(){en={},Jt=null}))},onTapStart:function(e){e.length>1&&(clearTimeout(Jt),Jt=null)},onTapRelease:function(e,t){var n,o;if(t&&(!V&&!G&&!Ge)){var a=t;if(Jt&&(clearTimeout(Jt),Jt=null,n=a,o=en,Math.abs(n.x-o.x)<25&&Math.abs(n.y-o.y)<25))return void Ee("doubleTap",a);if("mouse"===t.type)return void tn(e,t,"mouse");if("BUTTON"===e.target.tagName.toUpperCase()||i.hasClass(e.target,"pswp__single-tap"))return void tn(e,t);Re(en,a),Jt=setTimeout((function(){tn(e,t),Jt=null}),300)}}}}),be("DesktopZoom",{publicMethods:{initDesktopZoom:function(){L||(F?Te("mouseUsed",(function(){a.setupDesktopZoom()})):a.setupDesktopZoom(!0))},setupDesktopZoom:function(t){Qt={};var n="wheel mousewheel DOMMouseScroll";Te("bindEvents",(function(){i.bind(e,n,a.handleMouseWheel)})),Te("unbindEvents",(function(){Qt&&i.unbind(e,n,a.handleMouseWheel)})),a.mouseZoomedIn=!1;var o,r=function(){a.mouseZoomedIn&&(i.removeClass(e,"pswp--zoomed-in"),a.mouseZoomedIn=!1),v<1?i.addClass(e,"pswp--zoom-allowed"):i.removeClass(e,"pswp--zoom-allowed"),l()},l=function(){o&&(i.removeClass(e,"pswp--dragging"),o=!1)};Te("resize",r),Te("afterChange",r),Te("pointerDown",(function(){a.mouseZoomedIn&&(o=!0,i.addClass(e,"pswp--dragging"))})),Te("pointerUp",l),t||r()},handleMouseWheel:function(e){if(v<=a.currItem.fitRatio)return r.modal&&(!r.closeOnScroll||Ge||Y?e.preventDefault():_&&Math.abs(e.deltaY)>2&&(u=!0,a.close())),!0;if(e.stopPropagation(),Qt.x=0,"deltaX"in e)1===e.deltaMode?(Qt.x=18*e.deltaX,Qt.y=18*e.deltaY):(Qt.x=e.deltaX,Qt.y=e.deltaY);else if("wheelDelta"in e)e.wheelDeltaX&&(Qt.x=-.16*e.wheelDeltaX),e.wheelDeltaY?Qt.y=-.16*e.wheelDeltaY:Qt.y=-.16*e.wheelDelta;else{if(!("detail"in e))return;Qt.y=e.detail}ze(v,!0);var t=de.x-Qt.x,n=de.y-Qt.y;(r.modal||t<=ee.min.x&&t>=ee.max.x&&n<=ee.min.y&&n>=ee.max.y)&&e.preventDefault(),a.panTo(t,n)},toggleDesktopZoom:function(t){t=t||{x:pe.x/2+fe.x,y:pe.y/2+fe.y};var n=r.getDoubleTapZoom(!0,a.currItem),o=v===n;a.mouseZoomedIn=!o,a.zoomTo(o?a.currItem.initialZoomLevel:n,t,333),i[(o?"remove":"add")+"Class"](e,"pswp--zoomed-in")}}});var nn,on,an,rn,ln,sn,un,cn,dn,pn,mn,fn,hn={history:!0,galleryUID:1},vn=function(){return mn.hash.substring(1)},xn=function(){nn&&clearTimeout(nn),an&&clearTimeout(an)},gn=function(){var e=vn(),t={};if(e.length<5)return t;var n,o=e.split("&");for(n=0;n-1&&"&"===(un=un.substring(0,t)).slice(-1)&&(un=un.slice(0,-1)),setTimeout((function(){l&&i.bind(window,"hashchange",a.onHashChange)}),40)}},onHashChange:function(){if(vn()===un)return dn=!0,void a.close();rn||(ln=!0,a.goTo(gn().pid),ln=!1)},updateURL:function(){xn(),ln||(cn?nn=setTimeout(yn,800):yn())}}}),i.extend(a,$e)}})),function(e,t){"function"==typeof define&&define.amd?define(t):"object"==typeof exports?module.exports=t():e.PhotoSwipeUI_Default=t()}(this,(function(){"use strict";return function(e,t){var n,o,i,a,r,l,s,u,c,d,p,m,f,h,v,x,g,y,w=this,b=!1,C=!0,I=!0,T={barsSize:{top:44,bottom:"auto"},closeElClasses:["item","caption","zoom-wrap","ui","top-bar"],timeToIdle:4e3,timeToIdleOutside:1e3,loadingIndicatorDelay:1e3,addCaptionHTMLFn:function(e,t){return e.title?(t.children[0].innerHTML=e.title,!0):(t.children[0].innerHTML="",!1)},closeEl:!0,captionEl:!0,fullscreenEl:!0,zoomEl:!0,shareEl:!0,counterEl:!0,arrowEl:!0,preloaderEl:!0,tapToClose:!1,tapToToggleControls:!0,clickToCloseNonZoomable:!0,shareButtons:[{id:"facebook",label:"Share on Facebook",url:"https://www.facebook.com/sharer/sharer.php?u={{url}}"},{id:"twitter",label:"Tweet",url:"https://twitter.com/intent/tweet?text={{text}}&url={{url}}"},{id:"pinterest",label:"Pin it",url:"http://www.pinterest.com/pin/create/button/?url={{url}}&media={{image_url}}&description={{text}}"},{id:"download",label:"Download image",url:"{{raw_image_url}}",download:!0}],getImageURLForShare:function(){return e.currItem.src||""},getPageURLForShare:function(){return window.location.href},getTextForShare:function(){return e.currItem.title||""},indexIndicatorSep:" / ",fitControlsWidth:1200},E=function(e){if(x)return!0;e=e||window.event,v.timeToIdle&&v.mouseUsed&&!c&&R();for(var n,o,i=(e.target||e.srcElement).getAttribute("class")||"",a=0;a-1&&(n.onTap(),o=!0);if(o){e.stopPropagation&&e.stopPropagation(),x=!0;var r=t.features.isOldAndroid?600:30;setTimeout((function(){x=!1}),r)}},D=function(e,n,o){t[(o?"add":"remove")+"Class"](e,"pswp__"+n)},S=function(){var e=1===v.getNumItemsFn();e!==h&&(D(o,"ui--one-slide",e),h=e)},_=function(){D(s,"share-modal--hidden",I)},M=function(){return(I=!I)?(t.removeClass(s,"pswp__share-modal--fade-in"),setTimeout((function(){I&&_()}),300)):(_(),setTimeout((function(){I||t.addClass(s,"pswp__share-modal--fade-in")}),30)),I||O(),!1},F=function(t){var n=(t=t||window.event).target||t.srcElement;return e.shout("shareLinkClick",t,n),!!n.href&&(!!n.hasAttribute("download")||(window.open(n.href,"pswp_share","scrollbars=yes,resizable=yes,toolbar=no,location=yes,width=550,height=420,top=100,left="+(window.screen?Math.round(screen.width/2-275):100)),I||M(),!1))},O=function(){for(var e,t,n,o,i="",a=0;a