/*! PhotoSwipe - v4.1.1 - 2015-12-24 * http://photoswipe.com * Copyright (c) 2015 Dmitry Semenov; */ !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,i){var o={features:null,bind:function(e,t,n,i){var o=(i?"remove":"add")+"EventListener";t=t.split(" ");for(var a=0;a0&(a=parseInt(a[1],10))>=1&&a<8&&(n.isOldIOSPhone=!0)}var r=i.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(i)}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)),i=window.setTimeout((function(){e(t+n)}),n);return f=t+n,i},n.caf=function(e){clearTimeout(e)}}return n.svg=!!document.createElementNS&!!document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect,o.features=n,n}};o.detectFeatures(),o.features.oldIE&(o.bind=function(e,t,n,i){t=t.split(" ");for(var o,a=(i?"detach":"attach")+"Event",r=function(){n.handleEvent.call(n)},l=0;lt-1?e-t:e<0?t+e:e},Ie={},Ce=function(e,t){return Ie[e]||(Ie[e]=[]),Ie[e].push(t)},De=function(e){var t=Ie[e];if(t){var n=Array.prototype.slice.call(arguments);n.shift();for(var i=0;ia.currItem.fitRatio?ge||(qt(a.currItem,!1,!0),ge=!0):ge&(qt(a.currItem),ge=!1)),Se(ee,ce.x,ce.y,y))},Ee=function(e){e.container&&Se(e.container.style,e.initialPosition.x,e.initialPosition.y,e.initialZoomLevel,e)},Oe=function(e,t){t[A]=v+e+"px, 0px"+g},ke=function(e,t){if(!r.loop&&t){var n=c+(fe.x*pe-e)/fe.x,i=Math.round(e-ut.x);(n<0&i>0||n>=Ut()-1&&i<0)&&(e=ut.x+i*r.mainScrollEndFriction)}ut.x=e,Oe(e,d)},Re=function(e,t){var n=ct[e]-me[e];return ue[e]+se[e]+n-n*(t/x)},Ze=function(e,t){e.x=t.x,e.y=t.y,t.id&(e.id=t.id)},Pe=function(e){e.x=Math.round(e.x),e.y=Math.round(e.y)},Fe=null,Le=function(){Fe&&(o.unbind(document,"mousemove",Le),o.addClass(e,"pswp--has_mouse"),r.mouseUsed=!0,De("mouseUsed")),Fe=setTimeout((function(){Fe=null}),100)},_e=function(e,t){var n=Gt(a.currItem,de,e);return t&(Q=n),n},ze=function(e){return e||(e=a.currItem),e.initialZoomLevel},Ne=function(e){return e||(e=a.currItem),e.w>0?r.maxSpreadZoom:1},Ue=function(e,t,n,i){return i===a.currItem.initialZoomLevel?(n[e]=a.currItem.initialPosition[e],!0):(n[e]=Re(e,i),n[e]>t.min[e]?(n[e]=t.min[e],!0):n[e]=i)return Xe(e),a(n),void(r&&r());a((n-t)*o(l/i)+t),We[e].raf=k(u)}};u()},$e={shout:De,listen:Ce,viewportSize:de,options:r,isMainScrollAnimating:function(){return te},getZoomLevel:function(){return y},getCurrentIndex:function(){return c},isDragging:function(){return W},isZooming:function(){return j},setScrollOffset:function(e,t){me.x=e,L=me.y=t,De("updateScrollOffset",me)},applyZoomPan:function(e,t,n,i){ce.x=t,ce.y=n,y=e,Ae(i)},init:function(){if(!l&!s){var n;a.framework=o,a.template=e,a.bg=o.getChildByClass(e,"pswp__bg"),Z=e.className,l=!0,_=o.detectFeatures(),k=_.raf,R=_.caf,A=_.transform,F=_.oldIE,a.scrollWrap=o.getChildByClass(e,"pswp__scroll-wrap"),a.container=o.getChildByClass(a.scrollWrap,"pswp__container"),d=a.container.style,a.itemHolders=I=[{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}],I[0].el.style.display=I[2].el.style.display="none",function(){if(A){var t=_.perspective&!O;return v="translate"+(t?"3d(":"("),void(g=_.perspective?", 0px)":")")}A="left",o.addClass(e,"pswp--ie"),Oe=function(e,t){t.left=e+"px"},Ee=function(e){var t=e.fitRatio>1?1:e.fitRatio,n=e.container.style,i=t*e.w,o=t*e.h;n.width=i+"px",n.height=o+"px",n.left=e.initialPosition.x+"px",n.top=e.initialPosition.y+"px"},Ae=function(){if(ee){var e=ee,t=a.currItem,n=t.fitRatio>1?1:t.fitRatio,i=n*t.w,o=n*t.h;e.width=i+"px",e.height=o+"px",e.left=ce.x+"px",e.top=ce.y+"px"}}}(),h={resize:a.updateSize,scroll:Be,keydown:He,click:Ye};var i=_.isOldIOSPhone||_.isOldAndroid||_.isMobileOpera;for(_.animationName&_.transform&&!i||(r.showAnimationDuration=r.hideAnimationDuration=0),n=0;n=Ut())&(c=0),a.currItem=Nt(c),(_.isOldIOSPhone||_.isOldAndroid)&&(ye=!1),e.setAttribute("aria-hidden","false"),r.modal&&(ye?e.style.position="fixed":(e.style.position="absolute",e.style.top=o.getScrollY()+"px")),void 0===L&&(De("initialLayout"),L=P=o.getScrollY());var u="pswp--open ";for(r.mainClass&(u+=r.mainClass+" "),r.showHideOpacity&&(u+="pswp--animate_opacity "),u+=O?"pswp--touch":"pswp--notouch",u+=_.animationName?" pswp--css_animation":"",u+=_.svg?" pswp--svg":"",o.addClass(e,u),a.updateSize(),p=-1,he=null,n=0;n<3;n++)Oe((n+p)*fe.x,I[n].el.style);F||o.bind(a.scrollWrap,f,a),Ce("initialZoomInEnd",(function(){a.setContent(I[0],c-1),a.setContent(I[2],c+1),I[0].el.style.display=I[2].el.style.display="block",r.focus&e.focus(),o.bind(document,"keydown",a),_.transform&&o.bind(a.scrollWrap,"click",a),r.mouseUsed||o.bind(document,"mousemove",Le),o.bind(window,"resize scroll",a),De("bindEvents")})),a.setContent(I[1],c),a.updateCurrItem(),De("afterInit"),ye||(w=setInterval((function(){Ge||W||j||y!==a.currItem.initialZoomLevel||a.updateSize()}),1e3)),o.addClass(e,"pswp--visible")}},close:function(){l&&(l=!1,s=!0,De("close"),o.unbind(window,"resize",a),o.unbind(window,"scroll",h.scroll),o.unbind(document,"keydown",a),o.unbind(document,"mousemove",Le),_.transform&&o.unbind(a.scrollWrap,"click",a),W&&o.unbind(window,m,a),De("unbindEvents"),Ht(a.currItem,null,!0,a.destroy))},destroy:function(){De("destroy"),Ft&&clearTimeout(Ft),e.setAttribute("aria-hidden","true"),e.className=Z,w&&clearInterval(w),o.unbind(a.scrollWrap,f,a),o.unbind(window,"scroll",a),mt(),Ke(),Ie=null},panTo:function(e,t,n){n||(e>Q.min.x?e=Q.min.x:eQ.min.y?t=Q.min.y:t=3&&(p+=he+(he>0?-3:3),n=3);for(var i=0;i0?(t=I.shift(),I[2]=t,p++,Oe((p+2)*fe.x,t.el.style),a.setContent(t,c-n+i+1+1)):(t=I.pop(),I.unshift(t),p--,Oe(p*fe.x,t.el.style),a.setContent(t,c+n-i-1-1));if(ee&1===Math.abs(he)){var o=Nt(C);o.initialZoomLevel!==y&(Gt(o,de),qt(o),Ee(o))}he=0,a.updateCurrZoomItem(),C=c,De("afterChange")}}},updateSize:function(t){if(!ye&&r.modal){var n=o.getScrollY();if(L!==n&(e.style.top=n+"px",L=n),!t&&ve.x===window.innerWidth&&ve.y===window.innerHeight)return;ve.x=window.innerWidth,ve.y=window.innerHeight,e.style.height=ve.y+"px"}if(de.x=a.scrollWrap.clientWidth,de.y=a.scrollWrap.clientHeight,Be(),fe.x=de.x+Math.round(de.x*r.spacing),fe.y=de.y,ke(fe.x*pe),De("beforeResize"),void 0!==p){for(var i,l,s,u=0;u<3;u++)i=I[u],Oe((u+p)*fe.x,i.el.style),s=c+u-1,r.loop&Ut()>2&&(s=be(s)),(l=Nt(s))&&(b||l.needsUpdate||!l.bounds)?(a.cleanSlide(l),a.setContent(i,s),1===u&&(a.currItem=l,a.updateCurrZoomItem(!0)),l.needsUpdate=!1):-1===i.index&&s>=0&&a.setContent(i,s),l&&l.container&&(Gt(l,de),qt(l),Ee(l));b=!1}x=y=a.currItem.initialZoomLevel,(Q=a.currItem.bounds)&(ce.x=Q.center.x,ce.y=Q.center.y,Ae(!0)),De("resize")},zoomTo:function(e,t,n,i,a){t&&(x=y,ct.x=Math.abs(t.x)-ce.x,ct.y=Math.abs(t.y)-ce.y,Ze(ue,ce));var r=_e(e,!1),l={};Ue("x",r,l,e),Ue("y",r,l,e);var s=y,u=ce.x,c=ce.y;Pe(l);var d=function(t){1===t?(y=e,ce.x=l.x,ce.y=l.y):(y=(e-s)*t+s,ce.x=(l.x-u)*t+u,ce.y=(l.y-c)*t+c),a&a(t),Ae(1===t)};n?qe("customZoomTo",0,1,n,i||o.easing.sine.inOut,d):d(1)}},je={},Je={},Qe={},et={},tt={},nt=[],it={},ot=[],at={},rt=0,lt={x:0,y:0},st=0,ut={x:0,y:0},ct={x:0,y:0},dt={x:0,y:0},pt=function(e,t){return at.x=Math.abs(e.x-t.x),at.y=Math.abs(e.y-t.y),Math.sqrt(at.x*at.x+at.y*at.y)},mt=function(){K&(R(K),K=null)},ft=function(){W&&(K=k(ft),At())},ht=function(e,t){return!(!e||e===document)&&(!(e.getAttribute("class")&&e.getAttribute("class").indexOf("pswp__scroll-wrap")>-1)&&(t(e)?e:ht(e.parentNode,t)))},yt={},xt=function(e,t){return yt.prevent=!ht(e.target,r.isClickableElement),De("preventDragEvent",e,t,yt),yt.prevent},vt=function(e,t){return t.x=e.pageX,t.y=e.pageY,t.id=e.identifier,t},gt=function(e,t,n){n.x=.5*(e.x+t.x),n.y=.5*(e.y+t.y)},wt=function(){var e=ce.y-a.currItem.initialPosition.y;return 1-Math.abs(e/(de.y/2))},bt={},It={},Ct=[],Dt=function(e){for(;Ct.length>0;)Ct.pop();return E?(le=0,nt.forEach((function(e){0===le?Ct[0]=e:1===le&(Ct[1]=e),le++}))):e.type.indexOf("touch")>-1?e.touches&&e.touches.length>0&&(Ct[0]=vt(e.touches[0],bt),e.touches.length>1&&(Ct[1]=vt(e.touches[1],It))):(bt.x=e.pageX,bt.y=e.pageY,bt.id="",Ct[0]=bt),Ct},Mt=function(e,t){var n,i,o,l,s=ce[e]+t[e],u=t[e]>0,c=ut.x+t.x,d=ut.x-it.x;if(n=s>Q.min[e]||sQ.min[e]&(n=r.panEndFriction,Q.min[e]-s,i=Q.min[e]-ue[e]),(i<=0||d<0)&&Ut()>1?(l=c,d<0&&c>it.x&&(l=it.x)):Q.min.x!==Q.max.x&&(o=s)):(s0)&&Ut()>1?(l=c,d>0&&ca.currItem.fitRatio&&(ce[e]+=t[e]*n)},Tt=function(e){if(!("mousedown"===e.type&&e.button>0))if(zt)e.preventDefault();else if(!B||"mousedown"!==e.type){if(xt(e,!0)&e.preventDefault(),De("pointerDown"),E){var t=o.arraySearch(nt,e.pointerId,"id");t<0&(t=nt.length),nt[t]={x:e.pageX,y:e.pageY,id:e.pointerId}}var n=Dt(e),i=n.length;$=null,Ke(),W&1!==i||(W=ie=!0,o.bind(window,m,a),H=re=oe=Y=q=V=G=X=!1,ne=null,De("firstTouchStart",n),Ze(ue,ce),se.x=se.y=0,Ze(et,n[0]),Ze(tt,et),it.x=fe.x*pe,ot=[{x:et.x,y:et.y}],N=z=Me(),_e(y,!0),mt(),ft()),!j&&i>1&&!te&&!q&&(x=y,X=!1,j=G=!0,se.y=se.x=0,Ze(ue,ce),Ze(je,n[0]),Ze(Je,n[1]),gt(je,Je,dt),ct.x=Math.abs(dt.x)-ce.x,ct.y=Math.abs(dt.y)-ce.y,J=pt(je,Je))}},St=function(e){if(e.preventDefault(),E){var t=o.arraySearch(nt,e.pointerId,"id");if(t>-1){var n=nt[t];n.x=e.pageX,n.y=e.pageY}}if(W){var i=Dt(e);if(ne||V||j)$=i;else if(ut.x!==fe.x*pe)ne="h";else{var a=Math.abs(i[0].x-et.x)-Math.abs(i[0].y-et.y);Math.abs(a)>=10&(ne=a>0?"h":"v",$=i)}}},At=function(){if($){var e=$.length;if(0!==e)if(Ze(je,$[0]),Qe.x=je.x-et.x,Qe.y=je.y-et.y,j&e>1){if(et.x=je.x,et.y=je.y,!Qe.x&&!Qe.y&&function(e,t){return e.x===t.x&&e.y===t.y}($[1],Je))return;Ze(Je,$[1]),X||(X=!0,De("zoomGestureStarted"));var t=pt(je,Je),n=Zt(t);n>a.currItem.initialZoomLevel+a.currItem.initialZoomLevel/15&(re=!0);var i=1,o=ze(),l=Ne();if(n1&(i=1),n=o-i*(o/3);else n>l&((i=(n-l)/(6*o))>1&&(i=1),n=l+i*o);i<0&(i=0),t,gt(je,Je,lt),se.x+=lt.x-dt.x,se.y+=lt.y-dt.y,Ze(dt,lt),ce.x=Re("x",n),ce.y=Re("y",n),H=n>y,y=n,Ae()}else{if(!ne)return;if(ie&(ie=!1,Math.abs(Qe.x)>=10&&(Qe.x-=$[0].x-tt.x),Math.abs(Qe.y)>=10&&(Qe.y-=$[0].y-tt.y)),et.x=je.x,et.y=je.y,0===Qe.x&&0===Qe.y)return;if("v"===ne&r.closeOnVerticalDrag&&"fit"===r.scaleMode&&y===a.currItem.initialZoomLevel){se.y+=Qe.y,ce.y+=Qe.y;var u=wt();return Y=!0,De("onVerticalDrag",u),Te(u),void Ae()}!function(e,t,n){if(e-N>50){var i=ot.length>2?ot.shift():{};i.x=t,i.y=n,ot.push(i),N=e}}(Me(),je.x,je.y),V=!0,Q=a.currItem.bounds,Mt("x",Qe)||(Mt("y",Qe),Pe(ce),Ae())}}},Et=function(e){if(_.isOldAndroid){if(B&"mouseup"===e.type)return;e.type.indexOf("touch")>-1&(clearTimeout(B),B=setTimeout((function(){B=0}),600))}var t;if(De("pointerUp"),xt(e,!1)&e.preventDefault(),E){var n=o.arraySearch(nt,e.pointerId,"id");if(n>-1)if(t=nt.splice(n,1)[0],navigator.pointerEnabled)t.type=e.pointerType||"mouse";else{t.type={4:"mouse",2:"touch",3:"pen"}[e.pointerType],t.type||(t.type=e.pointerType||"mouse")}}var i,l=Dt(e),s=l.length;if("mouseup"===e.type&(s=0),2===s)return $=null,!0;1===s&Ze(tt,l[0]),0!==s||ne||te||(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"})),De("touchRelease",e,t));var u=-1;if(0===s&(W=!1,o.unbind(window,m,a),mt(),j?u=0:-1!==st&&(u=Me()-st)),st=1===s?Me():-1,i=-1!==u&&u<150?"zoom":"swipe",j&&s<2&&(j=!1,1===s&&(i="zoomPointerUp"),De("zoomGestureEnded")),$=null,V||X||te||Y)if(Ke(),U||(U=Ot()),U.calculateSwipeSpeed("x"),Y){if(wt()a.currItem.fitRatio&&kt(U):Pt())}},Ot=function(){var e,t,n={lastFlickOffset:{},lastFlickDist:{},lastFlickSpeed:{},slowDownRatio:{},slowDownRatioReverse:{},speedDecelerationRatio:{},speedDecelerationRatioAbs:{},distanceOffset:{},backAnimDestination:{},backAnimStarted:{},calculateSwipeSpeed:function(i){ot.length>1?(e=Me()-N+50,t=ot[ot.length-2][i]):(e=Me()-z,t=tt[i]),n.lastFlickOffset[i]=et[i]-t,n.lastFlickDist[i]=Math.abs(n.lastFlickOffset[i]),n.lastFlickDist[i]>20?n.lastFlickSpeed[i]=n.lastFlickOffset[i]/e:n.lastFlickSpeed[i]=0,Math.abs(n.lastFlickSpeed[i])<.1&&(n.lastFlickSpeed[i]=0),n.slowDownRatio[i]=.95,n.slowDownRatioReverse[i]=1-n.slowDownRatio[i],n.speedDecelerationRatio[i]=1},calculateOverBoundsAnimOffset:function(e,t){n.backAnimStarted[e]||(ce[e]>Q.min[e]?n.backAnimDestination[e]=Q.min[e]:ce[e]30&&(u||t.lastFlickOffset.x>20)?i=-1:s<-30&&(u||t.lastFlickOffset.x<-20)&&(i=1)}i&&((c+=i)<0?(c=r.loop?Ut()-1:0,l=!0):c>=Ut()&&(c=r.loop?0:Ut()-1,l=!0),l&&!r.loop||(he+=i,pe-=i,n=!0));var d,p=fe.x*pe,m=Math.abs(p-ut.x);return n||p>ut.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,rt===c&(n=!1),te=!0,De("mainScrollAnimStart"),qe("mainScroll",ut.x,p,d,o.easing.cubic.out,ke,(function(){Ke(),te=!1,rt=-1,(n||rt!==c)&&a.updateCurrItem(),De("mainScrollAnimComplete")})),n&&a.updateCurrItem(!0),n},Zt=function(e){return 1/J*e*x},Pt=function(){var e=y,t=ze(),n=Ne();yn&(e=n);var i,r=ae;return oe&!H&&!re&&y1||navigator.msMaxTouchPoints>1),a.likelyTouchDevice=O,h[D]=Tt,h[M]=St,h[T]=Et,S&&(h[S]=h[T]),_.touch&&(f+=" mousedown",m+=" mousemove mouseup",h.mousedown=h[D],h.mousemove=h[M],h.mouseup=h[T]),O||(r.allowPanToNext=!1)}}});var Ft,Lt,_t,zt,Nt,Ut,Ht=function(t,n,i,l){var s;Ft&clearTimeout(Ft),zt=!0,_t=!0,t.initialLayout?(s=t.initialLayout,t.initialLayout=null):s=r.getThumbBoundsFn&&r.getThumbBoundsFn(c);var d=i?r.hideAnimationDuration:r.showAnimationDuration,p=function(){Xe("initialZoom"),i?(a.template.removeAttribute("style"),a.bg.removeAttribute("style")):(Te(1),n&(n.style.display="block"),o.addClass(e,"pswp--animated-in"),De("initialZoom"+(i?"OutEnd":"InEnd"))),l&&l(),zt=!1};if(!d||!s||void 0===s.x)return De("initialZoom"+(i?"Out":"In")),y=t.initialZoomLevel,Ze(ce,t.initialPosition),Ae(),e.style.opacity=i?0:1,Te(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"),i||(y=s.w/t.w,ce.x=s.x,ce.y=s.y-P,a[f?"template":"bg"].style.opacity=.001,Ae()),Ve("initialZoom"),i&&!m&&o.removeClass(e,"pswp--animated-in"),f&&(i?o[(m?"remove":"add")+"Class"](e,"pswp--animate_opacity"):setTimeout((function(){o.addClass(e,"pswp--animate_opacity")}),30)),Ft=setTimeout((function(){if(De("initialZoom"+(i?"Out":"In")),i){var n=s.w/t.w,a={x:ce.x,y:ce.y},r=y,l=ae,u=function(t){1===t?(y=n,ce.x=s.x,ce.y=s.y-L):(y=(n-r)*t+r,ce.x=(s.x-a.x)*t+a.x,ce.y=(s.y-L-a.y)*t+a.y),Ae(),f?e.style.opacity=1-t:Te(l-t*l)};m?qe("initialZoom",0,1,d,o.easing.cubic.out,u,p):(u(1),Ft=setTimeout(p,d+20))}else y=t.initialZoomLevel,Ze(ce,t.initialPosition),Ae(),Te(1),f?e.style.opacity=1:Te(1),Ft=setTimeout(p,d+20)}),i?25:90)},Yt={},Bt=[],Wt={index:0,errorMsg:'The image could not be loaded.',forceProgressiveLoading:!1,preload:[1,1],getNumItemsFn:function(){return Lt.length}},Gt=function(e,t,n){if(e.src&!e.loadError){var i=!n;if(i&(e.vGap||(e.vGap={top:0,bottom:0}),De("parseVerticalMargin",e)),Yt.x=t.x,Yt.y=t.y-e.vGap.top-e.vGap.bottom,i){var o=Yt.x/e.w,a=Yt.y/e.h;e.fitRatio=o1&(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 i=e.bounds;i.center.x=Math.round((Yt.x-t)/2),i.center.y=Math.round((Yt.y-n)/2)+e.vGap.top,i.max.x=t>Yt.x?Math.round(Yt.x-t):i.center.x,i.max.y=n>Yt.y?Math.round(Yt.y-n)+e.vGap.top:i.center.y,i.min.x=t>Yt.x?0:i.center.x,i.min.y=n>Yt.y?e.vGap.top:i.center.y}(e,e.w*n,e.h*n),i&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},Xt=function(e,t,n,i,o,r){t.loadError||i&&(t.imageAppended=!0,qt(t,i,t===a.currItem&&ge),n.appendChild(i),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=o.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},Kt=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},qt=function(e,t,n){if(e.src){t||(t=e.container.lastChild);var i=n?e.w:Math.round(e.w*e.fitRatio),o=n?e.h:Math.round(e.h*e.fitRatio);e.placeholder&!e.loaded&&(e.placeholder.style.width=i+"px",e.placeholder.style.height=o+"px"),t.style.width=i+"px",t.style.height=o+"px"}},$t=function(){if(Bt.length){for(var e,t=0;t=0,o=Math.min(n[0],Ut()),l=Math.min(n[1],Ut());for(t=1;t<=(i?l:o);t++)a.lazyLoadItem(c+t);for(t=1;t<=(i?o:l);t++)a.lazyLoadItem(c-t)})),Ce("initialLayout",(function(){a.currItem.initialLayout=r.getThumbBoundsFn&r.getThumbBoundsFn(c)})),Ce("mainScrollAnimComplete",$t),Ce("initialZoomInEnd",$t),Ce("destroy",(function(){for(var e,t=0;t=0&(void 0!==Lt[e]&&Lt[e])},allowProgressiveImg:function(){return r.forceProgressiveLoading||!O||r.mouseUsed||screen.width>1200},setContent:function(e,t){r.loop&&(t=be(t));var n=a.getItemAt(e.index);n&(n.container=null);var i,s=a.getItemAt(t);if(s){De("gettingData",t,s),e.index=t,e.item=s;var u=s.container=o.createEl("pswp__zoom-wrap");if(!s.src&s.html&&(s.html.tagName?u.appendChild(s.html):u.innerHTML=s.html),Kt(s),Gt(s,de),!s.src||s.loadError||s.loaded)s.src&&!s.loadError&&((i=o.createEl("pswp__img","img")).style.opacity=1,i.src=s.src,qt(s,i),Xt(0,s,u,i));else{if(s.loadComplete=function(n){if(l){if(e&e.index===t){if(Kt(n,!0))return n.loadComplete=n.img=null,Gt(n,de),Ee(n),void(e.index===c&&a.updateCurrZoomItem());n.imageAppended?!zt&n.placeholder&&(n.placeholder.style.display="none",n.placeholder=null):_.transform&&(te||zt)?Bt.push({item:n,baseDiv:u,img:n.img,index:t,holder:e,clearPlaceholder:!0}):Xt(0,n,u,n.img,0,!0)}n.loadComplete=null,n.img=null,De("imageLoadComplete",t,n)}},o.features.transform){var d="pswp__img pswp__img--placeholder";d+=s.msrc?"":" pswp__img--placeholder--blank";var p=o.createEl(d,s.msrc?"img":"");s.msrc&(p.src=s.msrc),qt(s,p),u.appendChild(p),s.placeholder=p}s.loading||Vt(s),a.allowProgressiveImg()&&(!_t&&_.transform?Bt.push({item:s,baseDiv:u,img:s.img,index:t,holder:e}):Xt(0,s,u,s.img,0,!0))}_t||t!==c?Ee(s):(ee=u.style,Ht(s,i||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,Jt,Qt={},en=function(e,t,n){var i=document.createEvent("CustomEvent"),o={origEvent:e,target:e.target,releasePoint:t,pointerType:n||"touch"};i.initCustomEvent("pswpTap",!0,!0,o),e.target.dispatchEvent(i)};we("Tap",{publicMethods:{initTap:function(){Ce("firstTouchStart",a.onTapStart),Ce("touchRelease",a.onTapRelease),Ce("destroy",(function(){Qt={},jt=null}))},onTapStart:function(e){e.length>1&(clearTimeout(jt),jt=null)},onTapRelease:function(e,t){var n,i;if(t&(!V&&!G&&!Ge)){var a=t;if(jt&(clearTimeout(jt),jt=null,n=a,i=Qt,Math.abs(n.x-i.x)<25&&Math.abs(n.y-i.y)<25))return void De("doubleTap",a);if("mouse"===t.type)return void en(e,t,"mouse");if("BUTTON"===e.target.tagName.toUpperCase()||o.hasClass(e.target,"pswp__single-tap"))return void en(e,t);Ze(Qt,a),jt=setTimeout((function(){en(e,t),jt=null}),300)}}}}),we("DesktopZoom",{publicMethods:{initDesktopZoom:function(){F||(O?Ce("mouseUsed",(function(){a.setupDesktopZoom()})):a.setupDesktopZoom(!0))},setupDesktopZoom:function(t){Jt={};var n="wheel mousewheel DOMMouseScroll";Ce("bindEvents",(function(){o.bind(e,n,a.handleMouseWheel)})),Ce("unbindEvents",(function(){Jt&o.unbind(e,n,a.handleMouseWheel)})),a.mouseZoomedIn=!1;var i,r=function(){a.mouseZoomedIn&(o.removeClass(e,"pswp--zoomed-in"),a.mouseZoomedIn=!1),y<1?o.addClass(e,"pswp--zoom-allowed"):o.removeClass(e,"pswp--zoom-allowed"),l()},l=function(){i&&(o.removeClass(e,"pswp--dragging"),i=!1)};Ce("resize",r),Ce("afterChange",r),Ce("pointerDown",(function(){a.mouseZoomedIn&(i=!0,o.addClass(e,"pswp--dragging"))})),Ce("pointerUp",l),t||r()},handleMouseWheel:function(e){if(y<=a.currItem.fitRatio)return r.modal&&(!r.closeOnScroll||Ge||W?e.preventDefault():A&&Math.abs(e.deltaY)>2&&(u=!0,a.close())),!0;if(e.stopPropagation(),Jt.x=0,"deltaX"in e)1===e.deltaMode?(Jt.x=18*e.deltaX,Jt.y=18*e.deltaY):(Jt.x=e.deltaX,Jt.y=e.deltaY);else if("wheelDelta"in e)e.wheelDeltaX&(Jt.x=-.16*e.wheelDeltaX),e.wheelDeltaY?Jt.y=-.16*e.wheelDeltaY:Jt.y=-.16*e.wheelDelta;else{if(!("detail"in e))return;Jt.y=e.detail}_e(y,!0);var t=ce.x-Jt.x,n=ce.y-Jt.y;(r.modal||t<=Q.min.x&t>=Q.max.x&&n<=Q.min.y&&n>=Q.max.y)&&e.preventDefault(),a.panTo(t,n)},toggleDesktopZoom:function(t){t=t||{x:de.x/2+me.x,y:de.y/2+me.y};var n=r.getDoubleTapZoom(!0,a.currItem),i=y===n;a.mouseZoomedIn=!i,a.zoomTo(i?a.currItem.initialZoomLevel:n,t,333),o[(i?"remove":"add")+"Class"](e,"pswp--zoomed-in")}}});var tn,nn,on,an,rn,ln,sn,un,cn,dn,pn,mn,fn={history:!0,galleryUID:1},hn=function(){return pn.hash.substring(1)},yn=function(){tn&clearTimeout(tn),on&&clearTimeout(on)},xn=function(){var e=hn(),t={};if(e.length<5)return t;var n,i=e.split("&");for(n=0;n-1&(sn=(sn=sn.split("&gid=")[0]).split("?gid=")[0]),Ce("afterChange",a.updateURL),Ce("unbindEvents",(function(){o.unbind(window,"hashchange",a.onHashChange)}));var e=function(){ln=!0,cn||(dn?history.back():sn?pn.hash=sn:mn?history.pushState("",document.title,pn.pathname+pn.search):pn.hash=""),yn()};Ce("unbindEvents",(function(){u&e()})),Ce("destroy",(function(){ln||e()})),Ce("firstUpdate",(function(){c=xn().pid}));var t=sn.indexOf("pid=");t>-1&"&"===(sn=sn.substring(0,t)).slice(-1)&&(sn=sn.slice(0,-1)),setTimeout((function(){l&&o.bind(window,"hashchange",a.onHashChange)}),40)}},onHashChange:function(){if(hn()===sn)return cn=!0,void a.close();an||(rn=!0,a.goTo(xn().pid),rn=!1)},updateURL:function(){yn(),rn||(un?tn=setTimeout(vn,800):vn())}}}),o.extend(a,$e)}})); 4b6g4q