Files
StaticGalleryBuilder/files/pswp/photoswipe.min.js

5 lines
30 KiB
JavaScript

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