관리-도구
편집 파일: photoswipe.min.js
/*! PhotoSwipe - v4.1.3 - 2019-01-08 * http://photoswipe.com * Copyright (c) 2019 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(p,i,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<t.length;a++)t[a]&&e[o](t[a],n,!1)},isArray:function(e){return e instanceof Array},createEl:function(e,t){var n=document.createElement(t||"div");return e&&(n.className=e),n},getScrollY:function(){var e=window.pageYOffset;return e!==undefined?e:document.documentElement.scrollTop},unbind:function(e,t,n){f.bind(e,t,n,!0)},removeClass:function(e,t){var n=new RegExp("(\\s|^)"+t+"(\\s|$)");e.className=e.className.replace(n," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")},addClass:function(e,t){f.hasClass(e,t)||(e.className+=(e.className?" ":"")+t)},hasClass:function(e,t){return e.className&&new RegExp("(^|\\s)"+t+"(\\s|$)").test(e.className)},getChildByClass:function(e,t){for(var n=e.firstChild;n;){if(f.hasClass(n,t))return n;n=n.nextSibling}},arraySearch:function(e,t,n){for(var i=e.length;i--;)if(e[i][n]===t)return i;return-1},extend:function(e,t,n){for(var i in t)if(t.hasOwnProperty(i)){if(n&&e.hasOwnProperty(i))continue;e[i]=t[i]}},easing:{sine:{out:function(e){return Math.sin(e*(Math.PI/2))},inOut:function(e){return-(Math.cos(Math.PI*e)-1)/2}},cubic:{out:function(e){return--e*e*e+1}}},detectFeatures:function(){if(f.features)return f.features;var e=f.createEl().style,t="",n={};if(n.oldIE=document.all&&!document.addEventListener,n.touch="ontouchstart"in window,window.requestAnimationFrame&&(n.raf=window.requestAnimationFrame,n.caf=window.cancelAnimationFrame),n.pointerEvent=!!window.PointerEvent||navigator.msPointerEnabled,!n.pointerEvent){var i=navigator.userAgent;if(/iP(hone|od)/.test(navigator.platform)){var o=navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);o&&0<o.length&&1<=(o=parseInt(o[1],10))&&o<8&&(n.isOldIOSPhone=!0)}var a=i.match(/Android\s([0-9\.]*)/),r=a?a[1]:0;1<=(r=parseFloat(r))&&(r<4.4&&(n.isOldAndroid=!0),n.androidVersion=r),n.isMobileOpera=/opera mini|opera mobi/i.test(i)}for(var l,s,u=["transform","perspective","animationName"],c=["","webkit","Moz","ms","O"],d=0;d<4;d++){t=c[d];for(var m=0;m<3;m++)l=u[m],s=t+(t?l.charAt(0).toUpperCase()+l.slice(1):l),!n[l]&&s in e&&(n[l]=s);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 p=0;n.raf=function(e){var t=(new Date).getTime(),n=Math.max(0,16-(t-p)),i=window.setTimeout(function(){e(t+n)},n);return p=t+n,i},n.caf=function(e){clearTimeout(e)}}return n.svg=!!document.createElementNS&&!!document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect,f.features=n}};f.detectFeatures(),f.features.oldIE&&(f.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;l<t.length;l++)if(o=t[l])if("object"==typeof n&&n.handleEvent){if(i){if(!n["oldIE"+o])return!1}else n["oldIE"+o]=r;e[a]("on"+o,n["oldIE"+o])}else e[a]("on"+o,n)});var h=this,y={allowPanToNext:!0,spacing:.12,bgOpacity:1,mouseUsed:!1,loop:!0,pinchToClose:!0,closeOnScroll:!0,closeOnVerticalDrag:!0,verticalDragRange:.75,hideAnimationDuration:333,showAnimationDuration:333,showHideOpacity:!1,focus:!0,escKey:!0,arrowKeys:!0,mainScrollEndFriction:.35,panEndFriction:.35,isClickableElement:function(e){return"A"===e.tagName},getDoubleTapZoom:function(e,t){return e?1:t.initialZoomLevel<.7?1:1.33},maxSpreadZoom:1.33,modal:!0,scaleMode:"fit"};f.extend(y,t);function n(e,t){f.extend(h,t.publicMethods),$e.push(e)}function s(e){var t=Gt();return t-1<e?e-t:e<0?t+e:e}function a(e,t){return Qe[e]||(Qe[e]=[]),Qe[e].push(t)}function x(e){var t=Qe[e];if(t){var n=Array.prototype.slice.call(arguments);n.shift();for(var i=0;i<t.length;i++)t[i].apply(h,n)}}function c(){return(new Date).getTime()}function v(e){_e=e,h.bg.style.opacity=e*y.bgOpacity}function o(e,t,n,i,o){(!Je||o&&o!==h.currItem)&&(i/=o?o.fitRatio:h.currItem.fitRatio),e[re]=$+t+"px, "+n+"px"+j+" scale("+i+")"}function d(e,t){if(!y.loop&&t){var n=Y+(Ve.x*Ge-e)/Ve.x,i=Math.round(e-wt.x);(n<0&&0<i||n>=Gt()-1&&i<0)&&(e=wt.x+i*y.mainScrollEndFriction)}wt.x=e,nt(e,W)}function u(e,t){var n=bt[e]-Xe[e];return Ye[e]+He[e]+n-t/q*n}function g(e,t){e.x=t.x,e.y=t.y,t.id&&(e.id=t.id)}function m(e){e.x=Math.round(e.x),e.y=Math.round(e.y)}function w(e,t){var n=$t(h.currItem,Be,e);return t&&(Re=n),n}function b(e){return e||(e=h.currItem),e.initialZoomLevel}function I(e){return e||(e=h.currItem),0<e.w?y.maxSpreadZoom:1}function C(e,t,n,i){return i===h.currItem.initialZoomLevel?(n[e]=h.currItem.initialPosition[e],!0):(n[e]=u(e,i),n[e]>t.min[e]?(n[e]=t.min[e],!0):n[e]<t.max[e]&&(n[e]=t.max[e],!0))}function r(e){var t="";y.escKey&&27===e.keyCode?t="close":y.arrowKeys&&(37===e.keyCode?t="prev":39===e.keyCode&&(t="next")),t&&(e.ctrlKey||e.altKey||e.shiftKey||e.metaKey||(e.preventDefault?e.preventDefault():e.returnValue=!1,h[t]()))}function l(e){e&&(Me||Te||Ze||be)&&(e.preventDefault(),e.stopPropagation())}function D(){h.setScrollOffset(0,f.getScrollY())}function T(e){at[e]&&(at[e].raf&&ce(at[e].raf),rt--,delete at[e])}function M(e){at[e]&&T(e),at[e]||(rt++,at[e]={})}function S(){for(var e in at)at.hasOwnProperty(e)&&T(e)}function A(e,t,n,i,o,a,r){var l,s=c();M(e);var u=function(){if(at[e]){if(l=c()-s,i<=l)return T(e),a(n),void(r&&r());a((n-t)*o(l/i)+t),at[e].raf=ue(u)}};u()}function E(e,t){return yt.x=Math.abs(e.x-t.x),yt.y=Math.abs(e.y-t.y),Math.sqrt(yt.x*yt.x+yt.y*yt.y)}function O(e,t){return Mt.prevent=!Tt(e.target,y.isClickableElement),x("preventDragEvent",e,t,Mt),Mt.prevent}function k(e,t){return t.x=e.pageX,t.y=e.pageY,t.id=e.identifier,t}function R(e,t,n){n.x=.5*(e.x+t.x),n.y=.5*(e.y+t.y)}function P(){var e=We.y-h.currItem.initialPosition.y;return 1-Math.abs(e/(Be.y/2))}function Z(e){for(;0<Et.length;)Et.pop();return le?(Ue=0,pt.forEach(function(e){0===Ue?Et[0]=e:1===Ue&&(Et[1]=e),Ue++})):-1<e.type.indexOf("touch")?e.touches&&0<e.touches.length&&(Et[0]=k(e.touches[0],St),1<e.touches.length&&(Et[1]=k(e.touches[1],At))):(St.x=e.pageX,St.y=e.pageY,St.id="",Et[0]=St),Et}function F(e,t){var n,i,o,a,r=We[e]+t[e],l=0<t[e],s=wt.x+t.x,u=wt.x-ft.x;if(n=r>Re.min[e]||r<Re.max[e]?y.panEndFriction:1,r=We[e]+t[e]*n,(y.allowPanToNext||K===h.currItem.initialZoomLevel)&&(Pe?"h"!==Fe||"x"!==e||Te||(l?(r>Re.min[e]&&(n=y.panEndFriction,Re.min[e],i=Re.min[e]-Ye[e]),(i<=0||u<0)&&1<Gt()?(a=s,u<0&&s>ft.x&&(a=ft.x)):Re.min.x!==Re.max.x&&(o=r)):(r<Re.max[e]&&(n=y.panEndFriction,Re.max[e],i=Ye[e]-Re.max[e]),(i<=0||0<u)&&1<Gt()?(a=s,0<u&&s<ft.x&&(a=ft.x)):Re.min.x!==Re.max.x&&(o=r))):a=s,"x"===e))return a!==undefined&&(d(a,!0),Ae=a!==ft.x),Re.min.x!==Re.max.x&&(o!==undefined?We.x=o:Ae||(We.x+=t.x*n)),a!==undefined;Ze||Ae||K>h.currItem.fitRatio&&(We[e]+=t[e]*n)}function L(e){if(!("mousedown"===e.type&&0<e.button))if(Wt)e.preventDefault();else if(!Ie||"mousedown"!==e.type){if(O(e,!0)&&e.preventDefault(),x("pointerDown"),le){var t=f.arraySearch(pt,e.pointerId,"id");t<0&&(t=pt.length),pt[t]={x:e.pageX,y:e.pageY,id:e.pointerId}}var n=Z(e),i=n.length;Ee=null,S(),Ce&&1!==i||(Ce=Le=!0,f.bind(window,G,h),we=Ne=ze=be=Ae=Me=De=Te=!1,Fe=null,x("firstTouchStart",n),g(Ye,We),He.x=He.y=0,g(dt,n[0]),g(mt,dt),ft.x=Ve.x*Ge,ht=[{x:dt.x,y:dt.y}],ve=xe=c(),w(K,!0),Ct(),Dt()),!Oe&&1<i&&!Ze&&!Ae&&(q=K,Oe=De=!(Te=!1),He.y=He.x=0,g(Ye,We),g(st,n[0]),g(ut,n[1]),R(st,ut,It),bt.x=Math.abs(It.x)-We.x,bt.y=Math.abs(It.y)-We.y,ke=E(st,ut))}}function z(e){if(e.preventDefault(),le){var t=f.arraySearch(pt,e.pointerId,"id");if(-1<t){var n=pt[t];n.x=e.pageX,n.y=e.pageY}}if(Ce){var i=Z(e);if(Fe||Me||Oe)Ee=i;else if(wt.x!==Ve.x*Ge)Fe="h";else{var o=Math.abs(i[0].x-dt.x)-Math.abs(i[0].y-dt.y);10<=Math.abs(o)&&(Fe=0<o?"h":"v",Ee=i)}}}function _(e){if(he.isOldAndroid){if(Ie&&"mouseup"===e.type)return;-1<e.type.indexOf("touch")&&(clearTimeout(Ie),Ie=setTimeout(function(){Ie=0},600))}var t;if(x("pointerUp"),O(e,!1)&&e.preventDefault(),le){var n=f.arraySearch(pt,e.pointerId,"id");-1<n&&(t=pt.splice(n,1)[0],navigator.msPointerEnabled?(t.type={4:"mouse",2:"touch",3:"pen"}[e.pointerType],t.type||(t.type=e.pointerType||"mouse")):t.type=e.pointerType||"mouse")}var i,o=Z(e),a=o.length;if("mouseup"===e.type&&(a=0),2===a)return!(Ee=null);1===a&&g(mt,o[0]),0!==a||Fe||Ze||(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"})),x("touchRelease",e,t));var r=-1;if(0===a&&(Ce=!1,f.unbind(window,G,h),Ct(),Oe?r=0:-1!==gt&&(r=c()-gt)),gt=1===a?c():-1,i=-1!==r&&r<150?"zoom":"swipe",Oe&&a<2&&(Oe=!1,1===a&&(i="zoomPointerUp"),x("zoomGestureEnded")),Ee=null,Me||Te||Ze||be)if(S(),ge||(ge=kt()),ge.calculateSwipeSpeed("x"),be)if(P()<y.verticalDragRange)h.close();else{var l=We.y,s=_e;A("verticalDrag",0,1,300,f.easing.cubic.out,function(e){We.y=(h.currItem.initialPosition.y-l)*e+l,v((1-s)*e+s),et()}),x("onVerticalDrag",1)}else{if((Ae||Ze)&&0===a){if(Pt(i,ge))return;i="zoomPointerUp"}Ze||("swipe"===i?!Ae&&K>h.currItem.fitRatio&&Rt(ge):Ft())}}var N,U,H,Y,W,B,G,X,V,K,q,$,j,J,Q,ee,te,ne,ie,oe,ae,re,le,se,ue,ce,de,me,pe,fe,he,ye,xe,ve,ge,we,be,Ie,Ce,De,Te,Me,Se,Ae,Ee,Oe,ke,Re,Pe,Ze,Fe,Le,ze,_e,Ne,Ue,He={x:0,y:0},Ye={x:0,y:0},We={x:0,y:0},Be={},Ge=0,Xe={},Ve={x:0,y:0},Ke=0,qe=!0,$e=[],je={},Je=!1,Qe={},et=function(e){Pe&&(e&&(K>h.currItem.fitRatio?Je||(jt(h.currItem,!1,!0),Je=!0):Je&&(jt(h.currItem),Je=!1)),o(Pe,We.x,We.y,K))},tt=function(e){e.container&&o(e.container.style,e.initialPosition.x,e.initialPosition.y,e.initialZoomLevel,e)},nt=function(e,t){t[re]=$+e+"px, 0px"+j},it=null,ot=function(){it&&(f.unbind(document,"mousemove",ot),f.addClass(p,"pswp--has_mouse"),y.mouseUsed=!0,x("mouseUsed")),it=setTimeout(function(){it=null},100)},at={},rt=0,lt={shout:x,listen:a,viewportSize:Be,options:y,isMainScrollAnimating:function(){return Ze},getZoomLevel:function(){return K},getCurrentIndex:function(){return Y},isDragging:function(){return Ce},isZooming:function(){return Oe},setScrollOffset:function(e,t){Xe.x=e,fe=Xe.y=t,x("updateScrollOffset",Xe)},applyZoomPan:function(e,t,n,i){We.x=t,We.y=n,K=e,et(i)},init:function(){if(!N&&!U){var e;h.framework=f,h.template=p,h.bg=f.getChildByClass(p,"pswp__bg"),de=p.className,N=!0,he=f.detectFeatures(),ue=he.raf,ce=he.caf,re=he.transform,pe=he.oldIE,h.scrollWrap=f.getChildByClass(p,"pswp__scroll-wrap"),h.container=f.getChildByClass(h.scrollWrap,"pswp__container"),W=h.container.style,h.itemHolders=ee=[{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}],ee[0].el.style.display=ee[2].el.style.display="none",function(){if(re){var e=he.perspective&&!se;return $="translate"+(e?"3d(":"("),j=he.perspective?", 0px)":")"}re="left",f.addClass(p,"pswp--ie"),nt=function(e,t){t.left=e+"px"},tt=function(e){var t=1<e.fitRatio?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"},et=function(){if(Pe){var e=Pe,t=h.currItem,n=1<t.fitRatio?1:t.fitRatio,i=n*t.w,o=n*t.h;e.width=i+"px",e.height=o+"px",e.left=We.x+"px",e.top=We.y+"px"}}}(),V={resize:h.updateSize,orientationchange:function(){clearTimeout(ye),ye=setTimeout(function(){Be.x!==h.scrollWrap.clientWidth&&h.updateSize()},500)},scroll:D,keydown:r,click:l};var t=he.isOldIOSPhone||he.isOldAndroid||he.isMobileOpera;for(he.animationName&&he.transform&&!t||(y.showAnimationDuration=y.hideAnimationDuration=0),e=0;e<$e.length;e++)h["init"+$e[e]]();i&&(h.ui=new i(h,f)).init(),x("firstUpdate"),Y=Y||y.index||0,(isNaN(Y)||Y<0||Y>=Gt())&&(Y=0),h.currItem=Bt(Y),(he.isOldIOSPhone||he.isOldAndroid)&&(qe=!1),p.setAttribute("aria-hidden","false"),y.modal&&(qe?p.style.position="fixed":(p.style.position="absolute",p.style.top=f.getScrollY()+"px")),fe===undefined&&(x("initialLayout"),fe=me=f.getScrollY());var n="pswp--open ";for(y.mainClass&&(n+=y.mainClass+" "),y.showHideOpacity&&(n+="pswp--animate_opacity "),n+=se?"pswp--touch":"pswp--notouch",n+=he.animationName?" pswp--css_animation":"",n+=he.svg?" pswp--svg":"",f.addClass(p,n),h.updateSize(),B=-1,Ke=null,e=0;e<3;e++)nt((e+B)*Ve.x,ee[e].el.style);pe||f.bind(h.scrollWrap,X,h),a("initialZoomInEnd",function(){h.setContent(ee[0],Y-1),h.setContent(ee[2],Y+1),ee[0].el.style.display=ee[2].el.style.display="block",y.focus&&p.focus(),f.bind(document,"keydown",h),he.transform&&f.bind(h.scrollWrap,"click",h),y.mouseUsed||f.bind(document,"mousemove",ot),f.bind(window,"resize scroll orientationchange",h),x("bindEvents")}),h.setContent(ee[1],Y),h.updateCurrItem(),x("afterInit"),qe||(J=setInterval(function(){rt||Ce||Oe||K!==h.currItem.initialZoomLevel||h.updateSize()},1e3)),f.addClass(p,"pswp--visible")}},close:function(){N&&(U=!(N=!1),x("close"),f.unbind(window,"resize scroll orientationchange",h),f.unbind(window,"scroll",V.scroll),f.unbind(document,"keydown",h),f.unbind(document,"mousemove",ot),he.transform&&f.unbind(h.scrollWrap,"click",h),Ce&&f.unbind(window,G,h),clearTimeout(ye),x("unbindEvents"),Xt(h.currItem,null,!0,h.destroy))},destroy:function(){x("destroy"),Ut&&clearTimeout(Ut),p.setAttribute("aria-hidden","true"),p.className=de,J&&clearInterval(J),f.unbind(h.scrollWrap,X,h),f.unbind(window,"scroll",h),Ct(),S(),Qe=null},panTo:function(e,t,n){n||(e>Re.min.x?e=Re.min.x:e<Re.max.x&&(e=Re.max.x),t>Re.min.y?t=Re.min.y:t<Re.max.y&&(t=Re.max.y)),We.x=e,We.y=t,et()},handleEvent:function(e){e=e||window.event,V[e.type]&&V[e.type](e)},goTo:function(e){var t=(e=s(e))-Y;Ke=t,Y=e,h.currItem=Bt(Y),Ge-=t,d(Ve.x*Ge),S(),Ze=!1,h.updateCurrItem()},next:function(){h.goTo(Y+1)},prev:function(){h.goTo(Y-1)},updateCurrZoomItem:function(e){if(e&&x("beforeChange",0),ee[1].el.children.length){var t=ee[1].el.children[0];Pe=f.hasClass(t,"pswp__zoom-wrap")?t.style:null}else Pe=null;Re=h.currItem.bounds,q=K=h.currItem.initialZoomLevel,We.x=Re.center.x,We.y=Re.center.y,e&&x("afterChange")},invalidateCurrItems:function(){Q=!0;for(var e=0;e<3;e++)ee[e].item&&(ee[e].item.needsUpdate=!0)},updateCurrItem:function(e){if(0!==Ke){var t,n=Math.abs(Ke);if(!(e&&n<2)){h.currItem=Bt(Y),Je=!1,x("beforeChange",Ke),3<=n&&(B+=Ke+(0<Ke?-3:3),n=3);for(var i=0;i<n;i++)0<Ke?(t=ee.shift(),ee[2]=t,nt((++B+2)*Ve.x,t.el.style),h.setContent(t,Y-n+i+1+1)):(t=ee.pop(),ee.unshift(t),nt(--B*Ve.x,t.el.style),h.setContent(t,Y+n-i-1-1));if(Pe&&1===Math.abs(Ke)){var o=Bt(te);o.initialZoomLevel!==K&&($t(o,Be),jt(o),tt(o))}Ke=0,h.updateCurrZoomItem(),te=Y,x("afterChange")}}},updateSize:function(e){if(!qe&&y.modal){var t=f.getScrollY();if(fe!==t&&(p.style.top=t+"px",fe=t),!e&&je.x===window.innerWidth&&je.y===window.innerHeight)return;je.x=window.innerWidth,je.y=window.innerHeight,p.style.height=je.y+"px"}if(Be.x=h.scrollWrap.clientWidth,Be.y=h.scrollWrap.clientHeight,D(),Ve.x=Be.x+Math.round(Be.x*y.spacing),Ve.y=Be.y,d(Ve.x*Ge),x("beforeResize"),B!==undefined){for(var n,i,o,a=0;a<3;a++)n=ee[a],nt((a+B)*Ve.x,n.el.style),o=Y+a-1,y.loop&&2<Gt()&&(o=s(o)),(i=Bt(o))&&(Q||i.needsUpdate||!i.bounds)?(h.cleanSlide(i),h.setContent(n,o),1===a&&(h.currItem=i,h.updateCurrZoomItem(!0)),i.needsUpdate=!1):-1===n.index&&0<=o&&h.setContent(n,o),i&&i.container&&($t(i,Be),jt(i),tt(i));Q=!1}q=K=h.currItem.initialZoomLevel,(Re=h.currItem.bounds)&&(We.x=Re.center.x,We.y=Re.center.y,et(!0)),x("resize")},zoomTo:function(t,e,n,i,o){e&&(q=K,bt.x=Math.abs(e.x)-We.x,bt.y=Math.abs(e.y)-We.y,g(Ye,We));var a=w(t,!1),r={};C("x",a,r,t),C("y",a,r,t);var l=K,s=We.x,u=We.y;function c(e){1===e?(K=t,We.x=r.x,We.y=r.y):(K=(t-l)*e+l,We.x=(r.x-s)*e+s,We.y=(r.y-u)*e+u),o&&o(e),et(1===e)}m(r),n?A("customZoomTo",0,1,n,i||f.easing.sine.inOut,c):c(1)}},st={},ut={},ct={},dt={},mt={},pt=[],ft={},ht=[],yt={},xt=0,vt={x:0,y:0},gt=0,wt={x:0,y:0},bt={x:0,y:0},It={x:0,y:0},Ct=function(){Se&&(ce(Se),Se=null)},Dt=function(){Ce&&(Se=ue(Dt),Ot())},Tt=function(e,t){return!(!e||e===document)&&!(e.getAttribute("class")&&-1<e.getAttribute("class").indexOf("pswp__scroll-wrap"))&&(t(e)?e:Tt(e.parentNode,t))},Mt={},St={},At={},Et=[],Ot=function(){if(Ee){var e=Ee.length;if(0!==e)if(g(st,Ee[0]),ct.x=st.x-dt.x,ct.y=st.y-dt.y,Oe&&1<e){if(dt.x=st.x,dt.y=st.y,!ct.x&&!ct.y&&function(e,t){return e.x===t.x&&e.y===t.y}(Ee[1],ut))return;g(ut,Ee[1]),Te||(Te=!0,x("zoomGestureStarted"));var t=E(st,ut),n=Zt(t);n>h.currItem.initialZoomLevel+h.currItem.initialZoomLevel/15&&(Ne=!0);var i=1,o=b(),a=I();if(n<o)if(y.pinchToClose&&!Ne&&q<=h.currItem.initialZoomLevel){var r=1-(o-n)/(o/1.2);v(r),x("onPinchClose",r),ze=!0}else 1<(i=(o-n)/o)&&(i=1),n=o-i*(o/3);else a<n&&(1<(i=(n-a)/(6*o))&&(i=1),n=a+i*o);i<0&&(i=0),R(st,ut,vt),He.x+=vt.x-It.x,He.y+=vt.y-It.y,g(It,vt),We.x=u("x",n),We.y=u("y",n),we=K<n,K=n,et()}else{if(!Fe)return;if(Le&&(Le=!1,10<=Math.abs(ct.x)&&(ct.x-=Ee[0].x-mt.x),10<=Math.abs(ct.y)&&(ct.y-=Ee[0].y-mt.y)),dt.x=st.x,dt.y=st.y,0===ct.x&&0===ct.y)return;if("v"===Fe&&y.closeOnVerticalDrag&&"fit"===y.scaleMode&&K===h.currItem.initialZoomLevel){He.y+=ct.y,We.y+=ct.y;var l=P();return be=!0,x("onVerticalDrag",l),v(l),void et()}!function(e,t,n){if(50<e-ve){var i=2<ht.length?ht.shift():{};i.x=t,i.y=n,ht.push(i),ve=e}}(c(),st.x,st.y),Me=!0,Re=h.currItem.bounds,F("x",ct)||(F("y",ct),m(We),et())}}},kt=function(){var t,n,i={lastFlickOffset:{},lastFlickDist:{},lastFlickSpeed:{},slowDownRatio:{},slowDownRatioReverse:{},speedDecelerationRatio:{},speedDecelerationRatioAbs:{},distanceOffset:{},backAnimDestination:{},backAnimStarted:{},calculateSwipeSpeed:function(e){n=1<ht.length?(t=c()-ve+50,ht[ht.length-2][e]):(t=c()-xe,mt[e]),i.lastFlickOffset[e]=dt[e]-n,i.lastFlickDist[e]=Math.abs(i.lastFlickOffset[e]),20<i.lastFlickDist[e]?i.lastFlickSpeed[e]=i.lastFlickOffset[e]/t:i.lastFlickSpeed[e]=0,Math.abs(i.lastFlickSpeed[e])<.1&&(i.lastFlickSpeed[e]=0),i.slowDownRatio[e]=.95,i.slowDownRatioReverse[e]=1-i.slowDownRatio[e],i.speedDecelerationRatio[e]=1},calculateOverBoundsAnimOffset:function(t,e){i.backAnimStarted[t]||(We[t]>Re.min[t]?i.backAnimDestination[t]=Re.min[t]:We[t]<Re.max[t]&&(i.backAnimDestination[t]=Re.max[t]),i.backAnimDestination[t]!==undefined&&(i.slowDownRatio[t]=.7,i.slowDownRatioReverse[t]=1-i.slowDownRatio[t],i.speedDecelerationRatioAbs[t]<.05&&(i.lastFlickSpeed[t]=0,i.backAnimStarted[t]=!0,A("bounceZoomPan"+t,We[t],i.backAnimDestination[t],e||300,f.easing.sine.out,function(e){We[t]=e,et()}))))},calculateAnimOffset:function(e){i.backAnimStarted[e]||(i.speedDecelerationRatio[e]=i.speedDecelerationRatio[e]*(i.slowDownRatio[e]+i.slowDownRatioReverse[e]-i.slowDownRatioReverse[e]*i.timeDiff/10),i.speedDecelerationRatioAbs[e]=Math.abs(i.lastFlickSpeed[e]*i.speedDecelerationRatio[e]),i.distanceOffset[e]=i.lastFlickSpeed[e]*i.speedDecelerationRatio[e]*i.timeDiff,We[e]+=i.distanceOffset[e])},panAnimLoop:function(){if(at.zoomPan&&(at.zoomPan.raf=ue(i.panAnimLoop),i.now=c(),i.timeDiff=i.now-i.lastNow,i.lastNow=i.now,i.calculateAnimOffset("x"),i.calculateAnimOffset("y"),et(),i.calculateOverBoundsAnimOffset("x"),i.calculateOverBoundsAnimOffset("y"),i.speedDecelerationRatioAbs.x<.05&&i.speedDecelerationRatioAbs.y<.05))return We.x=Math.round(We.x),We.y=Math.round(We.y),et(),void T("zoomPan")}};return i},Rt=function(e){if(e.calculateSwipeSpeed("y"),Re=h.currItem.bounds,e.backAnimDestination={},e.backAnimStarted={},Math.abs(e.lastFlickSpeed.x)<=.05&&Math.abs(e.lastFlickSpeed.y)<=.05)return e.speedDecelerationRatioAbs.x=e.speedDecelerationRatioAbs.y=0,e.calculateOverBoundsAnimOffset("x"),e.calculateOverBoundsAnimOffset("y"),!0;M("zoomPan"),e.lastNow=c(),e.panAnimLoop()},Pt=function(e,t){var n,i,o;if(Ze||(xt=Y),"swipe"===e){var a=dt.x-mt.x,r=t.lastFlickDist.x<10;30<a&&(r||20<t.lastFlickOffset.x)?i=-1:a<-30&&(r||t.lastFlickOffset.x<-20)&&(i=1)}i&&((Y+=i)<0?(Y=y.loop?Gt()-1:0,o=!0):Y>=Gt()&&(Y=y.loop?0:Gt()-1,o=!0),o&&!y.loop||(Ke+=i,Ge-=i,n=!0));var l,s=Ve.x*Ge,u=Math.abs(s-wt.x);return l=n||s>wt.x==0<t.lastFlickSpeed.x?(l=0<Math.abs(t.lastFlickSpeed.x)?u/Math.abs(t.lastFlickSpeed.x):333,l=Math.min(l,400),Math.max(l,250)):333,xt===Y&&(n=!1),Ze=!0,x("mainScrollAnimStart"),A("mainScroll",wt.x,s,l,f.easing.cubic.out,d,function(){S(),Ze=!1,xt=-1,!n&&xt===Y||h.updateCurrItem(),x("mainScrollAnimComplete")}),n&&h.updateCurrItem(!0),n},Zt=function(e){return 1/ke*e*q},Ft=function(){var e=K,t=b(),n=I();K<t?e=t:n<K&&(e=n);var i,o=_e;return ze&&!we&&!Ne&&K<t?h.close():(ze&&(i=function(e){v((1-o)*e+o)}),h.zoomTo(e,0,200,f.easing.cubic.out,i)),!0};n("Gestures",{publicMethods:{initGestures:function(){function e(e,t,n,i,o){ne=e+t,ie=e+n,oe=e+i,ae=o?e+o:""}(le=he.pointerEvent)&&he.touch&&(he.touch=!1),le?navigator.msPointerEnabled?e("MSPointer","Down","Move","Up","Cancel"):e("pointer","down","move","up","cancel"):he.touch?(e("touch","start","move","end","cancel"),se=!0):e("mouse","down","move","up"),G=ie+" "+oe+" "+ae,X=ne,le&&!se&&(se=1<navigator.maxTouchPoints||1<navigator.msMaxTouchPoints),h.likelyTouchDevice=se,V[ne]=L,V[ie]=z,V[oe]=_,ae&&(V[ae]=V[oe]),he.touch&&(X+=" mousedown",G+=" mousemove mouseup",V.mousedown=V[ne],V.mousemove=V[ie],V.mouseup=V[oe]),se||(y.allowPanToNext=!1)}}});function Lt(e,t,n,i,o,a){t.loadError||i&&(t.imageAppended=!0,jt(t,i,t===h.currItem&&Je),n.appendChild(i),a&&setTimeout(function(){t&&t.loaded&&t.placeholder&&(t.placeholder.style.display="none",t.placeholder=null)},500))}function zt(e){function t(){e.loading=!1,e.loaded=!0,e.loadComplete?e.loadComplete(e):e.img=null,n.onload=n.onerror=null,n=null}e.loading=!0,e.loaded=!1;var n=e.img=f.createEl("pswp__img","img");return n.onload=t,n.onerror=function(){e.loadError=!0,t()},n.src=e.src,n.alt=e.alt||"",n}function _t(e,t){if(e.src&&e.loadError&&e.container)return t&&(e.container.innerHTML=""),e.container.innerHTML=y.errorMsg.replace("%url%",e.src),!0}function Nt(){if(Kt.length){for(var e,t=0;t<Kt.length;t++)(e=Kt[t]).holder.index===e.index&&Lt(e.index,e.item,e.baseDiv,e.img,0,e.clearPlaceholder);Kt=[]}}var Ut,Ht,Yt,Wt,Bt,Gt,Xt=function(r,e,l,t){var s;function u(){T("initialZoom"),l?(h.template.removeAttribute("style"),h.bg.removeAttribute("style")):(v(1),e&&(e.style.display="block"),f.addClass(p,"pswp--animated-in"),x("initialZoom"+(l?"OutEnd":"InEnd"))),t&&t(),Wt=!1}Ut&&clearTimeout(Ut),Yt=Wt=!0,r.initialLayout?(s=r.initialLayout,r.initialLayout=null):s=y.getThumbBoundsFn&&y.getThumbBoundsFn(Y);var c,d,m=l?y.hideAnimationDuration:y.showAnimationDuration;if(!m||!s||s.x===undefined)return x("initialZoom"+(l?"Out":"In")),K=r.initialZoomLevel,g(We,r.initialPosition),et(),p.style.opacity=l?0:1,v(1),void(m?setTimeout(function(){u()},m):u());c=H,d=!h.currItem.src||h.currItem.loadError||y.showHideOpacity,r.miniImg&&(r.miniImg.style.webkitBackfaceVisibility="hidden"),l||(K=s.w/r.w,We.x=s.x,We.y=s.y-me,h[d?"template":"bg"].style.opacity=.001,et()),M("initialZoom"),l&&!c&&f.removeClass(p,"pswp--animated-in"),d&&(l?f[(c?"remove":"add")+"Class"](p,"pswp--animate_opacity"):setTimeout(function(){f.addClass(p,"pswp--animate_opacity")},30)),Ut=setTimeout(function(){if(x("initialZoom"+(l?"Out":"In")),l){var t=s.w/r.w,n=We.x,i=We.y,o=K,a=_e,e=function(e){1===e?(K=t,We.x=s.x,We.y=s.y-fe):(K=(t-o)*e+o,We.x=(s.x-n)*e+n,We.y=(s.y-fe-i)*e+i),et(),d?p.style.opacity=1-e:v(a-e*a)};c?A("initialZoom",0,1,m,f.easing.cubic.out,e,u):(e(1),Ut=setTimeout(u,m+20))}else K=r.initialZoomLevel,g(We,r.initialPosition),et(),v(1),d?p.style.opacity=1:v(1),Ut=setTimeout(u,m+20)},l?25:90)},Vt={},Kt=[],qt={index:0,errorMsg:'<div class="pswp__error-msg"><a href="%url%" target="_blank">The image</a> could not be loaded.</div>',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={center:{x:0,y:0},max:{x:0,y:0},min:{x:0,y:0}},e.initialPosition=e.bounds.center,e.bounds;var i=!n;if(i&&(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,i){var o=Vt.x/e.w,a=Vt.y/e.h;e.fitRatio=o<a?o:a;var r=y.scaleMode;"orig"===r?n=1:"fit"===r&&(n=e.fitRatio),1<n&&(n=1),e.initialZoomLevel=n,e.bounds||(e.bounds={center:{x:0,y:0},max:{x:0,y:0},min:{x:0,y:0}})}return n?(function(e,t,n){var i=e.bounds;i.center.x=Math.round((Vt.x-t)/2),i.center.y=Math.round((Vt.y-n)/2)+e.vGap.top,i.max.x=t>Vt.x?Math.round(Vt.x-t):i.center.x,i.max.y=n>Vt.y?Math.round(Vt.y-n)+e.vGap.top:i.center.y,i.min.x=t>Vt.x?0:i.center.x,i.min.y=n>Vt.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):void 0},jt=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"}};n("Controller",{publicMethods:{lazyLoadItem:function(e){e=s(e);var t=Bt(e);t&&(!t.loaded&&!t.loading||Q)&&(x("gettingData",e,t),t.src&&zt(t))},initController:function(){f.extend(y,qt,!0),h.items=Ht=e,Bt=h.getItemAt,Gt=y.getNumItemsFn,y.loop,Gt()<3&&(y.loop=!1),a("beforeChange",function(e){var t,n=y.preload,i=null===e||0<=e,o=Math.min(n[0],Gt()),a=Math.min(n[1],Gt());for(t=1;t<=(i?a:o);t++)h.lazyLoadItem(Y+t);for(t=1;t<=(i?o:a);t++)h.lazyLoadItem(Y-t)}),a("initialLayout",function(){h.currItem.initialLayout=y.getThumbBoundsFn&&y.getThumbBoundsFn(Y)}),a("mainScrollAnimComplete",Nt),a("initialZoomInEnd",Nt),a("destroy",function(){for(var e,t=0;t<Ht.length;t++)(e=Ht[t]).container&&(e.container=null),e.placeholder&&(e.placeholder=null),e.img&&(e.img=null),e.preloader&&(e.preloader=null),e.loadError&&(e.loaded=e.loadError=!1);Kt=null})},getItemAt:function(e){return 0<=e&&Ht[e]!==undefined&&Ht[e]},allowProgressiveImg:function(){return y.forceProgressiveLoading||!se||y.mouseUsed||1200<screen.width},setContent:function(t,n){y.loop&&(n=s(n));var e=h.getItemAt(t.index);e&&(e.container=null);var i,o=h.getItemAt(n);if(o){x("gettingData",n,o),t.index=n;var a=(t.item=o).container=f.createEl("pswp__zoom-wrap");if(!o.src&&o.html&&(o.html.tagName?a.appendChild(o.html):a.innerHTML=o.html),_t(o),$t(o,Be),!o.src||o.loadError||o.loaded)o.src&&!o.loadError&&((i=f.createEl("pswp__img","img")).style.opacity=1,i.src=o.src,jt(o,i),Lt(0,o,a,i));else{if(o.loadComplete=function(e){if(N){if(t&&t.index===n){if(_t(e,!0))return e.loadComplete=e.img=null,$t(e,Be),tt(e),void(t.index===Y&&h.updateCurrZoomItem());e.imageAppended?!Wt&&e.placeholder&&(e.placeholder.style.display="none",e.placeholder=null):he.transform&&(Ze||Wt)?Kt.push({item:e,baseDiv:a,img:e.img,index:n,holder:t,clearPlaceholder:!0}):Lt(0,e,a,e.img,0,!0)}e.loadComplete=null,e.img=null,x("imageLoadComplete",n,e)}},f.features.transform){var r="pswp__img pswp__img--placeholder";r+=o.msrc?"":" pswp__img--placeholder--blank";var l=f.createEl(r,o.msrc?"img":"");o.msrc&&(l.src=o.msrc),jt(o,l),a.appendChild(l),o.placeholder=l}o.loading||zt(o),h.allowProgressiveImg()&&(!Yt&&he.transform?Kt.push({item:o,baseDiv:a,img:o.img,index:n,holder:t}):Lt(0,o,a,o.img,0,!0))}Yt||n!==Y?tt(o):(Pe=a.style,Xt(o,i||o.img)),t.el.innerHTML="",t.el.appendChild(a)}else t.el.innerHTML=""},cleanSlide:function(e){e.img&&(e.img.onload=e.img.onerror=null),e.loaded=e.loading=e.img=e.imageAppended=!1}}});function Jt(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)}var Qt,en,tn={};n("Tap",{publicMethods:{initTap:function(){a("firstTouchStart",h.onTapStart),a("touchRelease",h.onTapRelease),a("destroy",function(){tn={},Qt=null})},onTapStart:function(e){1<e.length&&(clearTimeout(Qt),Qt=null)},onTapRelease:function(e,t){if(t&&!Me&&!De&&!rt){var n=t;if(Qt&&(clearTimeout(Qt),Qt=null,function(e,t){return Math.abs(e.x-t.x)<25&&Math.abs(e.y-t.y)<25}(n,tn)))return void x("doubleTap",n);if("mouse"===t.type)return void Jt(e,t,"mouse");if("BUTTON"===e.target.tagName.toUpperCase()||f.hasClass(e.target,"pswp__single-tap"))return void Jt(e,t);g(tn,n),Qt=setTimeout(function(){Jt(e,t),Qt=null},300)}}}}),n("DesktopZoom",{publicMethods:{initDesktopZoom:function(){pe||(se?a("mouseUsed",function(){h.setupDesktopZoom()}):h.setupDesktopZoom(!0))},setupDesktopZoom:function(e){en={};var t="wheel mousewheel DOMMouseScroll";function n(){h.mouseZoomedIn&&(f.removeClass(p,"pswp--zoomed-in"),h.mouseZoomedIn=!1),K<1?f.addClass(p,"pswp--zoom-allowed"):f.removeClass(p,"pswp--zoom-allowed"),o()}a("bindEvents",function(){f.bind(p,t,h.handleMouseWheel)}),a("unbindEvents",function(){en&&f.unbind(p,t,h.handleMouseWheel)}),h.mouseZoomedIn=!1;var i,o=function(){i&&(f.removeClass(p,"pswp--dragging"),i=!1)};a("resize",n),a("afterChange",n),a("pointerDown",function(){h.mouseZoomedIn&&(i=!0,f.addClass(p,"pswp--dragging"))}),a("pointerUp",o),e||n()},handleMouseWheel:function(e){if(K<=h.currItem.fitRatio)return y.modal&&(!y.closeOnScroll||rt||Ce?e.preventDefault():re&&2<Math.abs(e.deltaY)&&(H=!0,h.close())),!0;if(e.stopPropagation(),en.x=0,"deltaX"in e)1===e.deltaMode?(en.x=18*e.deltaX,en.y=18*e.deltaY):(en.x=e.deltaX,en.y=e.deltaY);else if("wheelDelta"in e)e.wheelDeltaX&&(en.x=-.16*e.wheelDeltaX),e.wheelDeltaY?en.y=-.16*e.wheelDeltaY:en.y=-.16*e.wheelDelta;else{if(!("detail"in e))return;en.y=e.detail}w(K,!0);var t=We.x-en.x,n=We.y-en.y;(y.modal||t<=Re.min.x&&t>=Re.max.x&&n<=Re.min.y&&n>=Re.max.y)&&e.preventDefault(),h.panTo(t,n)},toggleDesktopZoom:function(e){e=e||{x:Be.x/2+Xe.x,y:Be.y/2+Xe.y};var t=y.getDoubleTapZoom(!0,h.currItem),n=K===t;h.mouseZoomedIn=!n,h.zoomTo(n?h.currItem.initialZoomLevel:t,e,333),f[(n?"remove":"add")+"Class"](p,"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(n=0;n<i.length;n++)if(i[n]){var o=i[n].split("=");o.length<2||(t[o[0]]=o[1])}if(y.galleryPIDs){var a=t.pid;for(n=t.pid=0;n<Ht.length;n++)if(Ht[n].pid===a){t.pid=n;break}}else t.pid=parseInt(t.pid,10)-1;return t.pid<0&&(t.pid=0),t}var rn,ln,sn,un,cn,dn,mn,pn,fn,hn,yn,xn,vn={history:!0,galleryUID:1},gn=function(){if(sn&&clearTimeout(sn),rt||Ce)sn=setTimeout(gn,500);else{un?clearTimeout(ln):un=!0;var e=Y+1,t=Bt(Y);t.hasOwnProperty("pid")&&(e=t.pid);var n=mn+"&gid="+y.galleryUID+"&pid="+e;pn||-1===yn.hash.indexOf(n)&&(hn=!0);var i=yn.href.split("#")[0]+"#"+n;xn?"#"+n!==window.location.hash&&history[pn?"replaceState":"pushState"]("",document.title,i):pn?yn.replace(i):yn.hash=n,pn=!0,ln=setTimeout(function(){un=!1},60)}};n("History",{publicMethods:{initHistory:function(){if(f.extend(y,vn,!0),y.history){yn=window.location,pn=fn=hn=!1,mn=nn(),xn="pushState"in history,-1<mn.indexOf("gid=")&&(mn=(mn=mn.split("&gid=")[0]).split("?gid=")[0]),a("afterChange",h.updateURL),a("unbindEvents",function(){f.unbind(window,"hashchange",h.onHashChange)});var e=function(){dn=!0,fn||(hn?history.back():mn?yn.hash=mn:xn?history.pushState("",document.title,yn.pathname+yn.search):yn.hash=""),on()};a("unbindEvents",function(){H&&e()}),a("destroy",function(){dn||e()}),a("firstUpdate",function(){Y=an().pid});var t=mn.indexOf("pid=");-1<t&&"&"===(mn=mn.substring(0,t)).slice(-1)&&(mn=mn.slice(0,-1)),setTimeout(function(){N&&f.bind(window,"hashchange",h.onHashChange)},40)}},onHashChange:function(){if(nn()===mn)return fn=!0,void h.close();un||(cn=!0,h.goTo(an().pid),cn=!1)},updateURL:function(){on(),cn||(pn?rn=setTimeout(gn,800):gn())}}}),f.extend(h,lt)}});