Files
Journal-ghost/assets/built/main.min.js
2021-12-07 17:05:18 +08:00

2 lines
44 KiB
JavaScript

function lightbox(e){document.querySelectorAll(e).forEach(function(e){e.addEventListener("click",function(e){!function(t){t.preventDefault();for(var n,o=[],i=0,e=t.target.closest(".kg-card").previousSibling;e.classList.contains("kg-image-card")||e.classList.contains("kg-gallery-card");){var r=[];e.querySelectorAll("img").forEach(function(e){r.push({src:e.getAttribute("src"),msrc:e.getAttribute("src"),w:e.getAttribute("width"),h:e.getAttribute("height"),el:e}),i+=1}),e=e.previousSibling,o=r.concat(o)}t.target.classList.contains("kg-image")?o.push({src:t.target.getAttribute("src"),msrc:t.target.getAttribute("src"),w:t.target.getAttribute("width"),h:t.target.getAttribute("height"),el:t.target}):(n=!1,t.target.closest(".kg-gallery-card").querySelectorAll("img").forEach(function(e){o.push({src:e.getAttribute("src"),msrc:e.getAttribute("src"),w:e.getAttribute("width"),h:e.getAttribute("height"),el:e}),n||e===t.target?n=!0:i+=1}));for(var a=t.target.closest(".kg-card").nextSibling;a.classList.contains("kg-image-card")||a.classList.contains("kg-gallery-card");)a.querySelectorAll("img").forEach(function(e){o.push({src:e.getAttribute("src"),msrc:e.getAttribute("src"),w:e.getAttribute("width"),h:e.getAttribute("height"),el:e})}),a=a.nextSibling;var l=document.querySelectorAll(".pswp")[0];new PhotoSwipe(l,PhotoSwipeUI_Default,o,{bgOpacity:.9,closeOnScroll:!0,fullscreenEl:!1,history:!1,index:i,shareEl:!1,zoomEl:!1,getThumbBoundsFn:function(e){var t=o[e].el,e=window.pageYOffset||document.documentElement.scrollTop,t=t.getBoundingClientRect();return{x:t.left,y:t.top+e,w:t.width}}}).init()}(e)})})}function pagination(t){var n,o,i,r,a,l,s,c=document.querySelector(".gh-loadmore"),u=document.querySelector("link[rel=next]");function d(){if(404===this.status)return window.removeEventListener("scroll",m),window.removeEventListener("resize",f),void c.remove();this.response.querySelectorAll(".gh-feed:not(.gh-featured):not(.gh-related) .gh-card").forEach(function(e){n.appendChild(document.importNode(e,!0))});var e=this.response.querySelector("link[rel=next]");e?u.href=e.href:(window.removeEventListener("scroll",m),window.removeEventListener("resize",f),c.remove()),s=document.documentElement.scrollHeight,r=i=!1}function e(){var e;r||(t&&a+l<=s-o?i=!1:(r=!0,(e=new window.XMLHttpRequest).responseType="document",e.addEventListener("load",d),e.open("GET",u.href),e.send(null)))}function p(){i||window.requestAnimationFrame(e),i=!0}function m(){a=window.scrollY,p()}function f(){l=window.innerHeight,s=document.documentElement.scrollHeight,p()}u||!c?(n=document.querySelector(".gh-feed:not(.gh-featured):not(.gh-related)"))&&(r=i=!(o=300),a=window.scrollY,l=window.innerHeight,s=document.documentElement.scrollHeight,t?(window.addEventListener("scroll",m,{passive:!0}),window.addEventListener("resize",f),p()):c.addEventListener("click",p)):c.remove()}!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(o,l){function e(e){if(A)return!0;e=e||window.event,S.timeToIdle&&S.mouseUsed&&!x&&a();for(var t,n,o=(e.target||e.srcElement).getAttribute("class")||"",i=0;i<z.length;i++)(t=z[i]).onTap&&-1<o.indexOf("pswp__"+t.name)&&(t.onTap(),n=!0);n&&(e.stopPropagation&&e.stopPropagation(),A=!0,e=l.features.isOldAndroid?600:30,setTimeout(function(){A=!1},e))}function n(){var e=1===S.getNumItemsFn();e!==E&&(R(m,"ui--one-slide",e),E=e)}function t(){R(y,"share-modal--hidden",F)}function i(){return(F=!F)?(l.removeClass(y,"pswp__share-modal--fade-in"),setTimeout(function(){F&&t()},300)):(t(),setTimeout(function(){F||l.addClass(y,"pswp__share-modal--fade-in")},30)),F||function(){for(var e,t,n,o,i,r="",a=0;a<S.shareButtons.length;a++)e=S.shareButtons[a],n=S.getImageURLForShare(e),o=S.getPageURLForShare(e),i=S.getTextForShare(e),r+='<a href="'+(t=e.url.replace("{{url}}",encodeURIComponent(o)).replace("{{image_url}}",encodeURIComponent(n)).replace("{{raw_image_url}}",n).replace("{{text}}",encodeURIComponent(i)))+'" target="_blank" class="pswp__share--'+e.id+'"'+(e.download?"download":"")+">"+e.label+"</a>",S.parseShareButtonOut&&(r=S.parseShareButtonOut(e,r));y.children[0].innerHTML=r,y.children[0].onclick=P}(),0}function r(e){for(var t=0;t<S.closeElClasses.length;t++)if(l.hasClass(e,"pswp__"+S.closeElClasses[t]))return!0}function a(){clearTimeout(k),Z=0,x&&_.setIdle(!1)}function s(e){(e=(e=e||window.event).relatedTarget||e.toElement)&&"HTML"!==e.nodeName||(clearTimeout(k),k=setTimeout(function(){_.setIdle(!0)},S.timeToIdleOutside))}function c(e){I!==e&&(R(C,"preloader--active",!e),I=e)}function u(e){var t,n=e.vGap;!o.likelyTouchDevice||S.mouseUsed||screen.width>S.fitControlsWidth?(t=S.barsSize,S.captionEl&&"auto"===t.bottom?(h||((h=l.createEl("pswp__caption pswp__caption--fake")).appendChild(l.createEl("pswp__caption__center")),m.insertBefore(h,f),l.addClass(m,"pswp__ui--fit")),S.addCaptionHTMLFn(e,h,!0)?(e=h.clientHeight,n.bottom=parseInt(e,10)||44):n.bottom=t.top):n.bottom="auto"===t.bottom?0:t.bottom,n.top=t.top):n.top=n.bottom=0}function d(){function e(e){if(e)for(var t=e.length,n=0;n<t;n++){i=e[n],r=i.className;for(var o=0;o<z.length;o++)a=z[o],-1<r.indexOf("pswp__"+a.name)&&(S[a.option]?(l.removeClass(i,"pswp__element--disabled"),a.onInit&&a.onInit(i)):l.addClass(i,"pswp__element--disabled"))}}var i,r,a;e(m.children);var t=l.getChildByClass(m,"pswp__top-bar");t&&e(t.children)}var p,m,f,h,g,v,y,w,x,b,C,I,T,E,S,A,D,k,_=this,M=!1,O=!0,F=!0,L={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 o.currItem.src||""},getPageURLForShare:function(){return window.location.href},getTextForShare:function(){return o.currItem.title||""},indexIndicatorSep:" / ",fitControlsWidth:1200},R=function(e,t,n){l[(n?"add":"remove")+"Class"](e,"pswp__"+t)},P=function(e){var t=(e=e||window.event).target||e.srcElement;return o.shout("shareLinkClick",e,t),!(!t.href||!t.hasAttribute("download")&&(window.open(t.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)),F||i(),1))},Z=0,z=[{name:"caption",option:"captionEl",onInit:function(e){f=e}},{name:"share-modal",option:"shareEl",onInit:function(e){y=e},onTap:function(){i()}},{name:"button--share",option:"shareEl",onInit:function(e){v=e},onTap:function(){i()}},{name:"button--zoom",option:"zoomEl",onTap:o.toggleDesktopZoom},{name:"counter",option:"counterEl",onInit:function(e){g=e}},{name:"button--close",option:"closeEl",onTap:o.close},{name:"button--arrow--left",option:"arrowEl",onTap:o.prev},{name:"button--arrow--right",option:"arrowEl",onTap:o.next},{name:"button--fs",option:"fullscreenEl",onTap:function(){p.isFullscreen()?p.exit():p.enter()}},{name:"preloader",option:"preloaderEl",onInit:function(e){C=e}}];_.init=function(){var t;l.extend(o.options,L,!0),S=o.options,m=l.getChildByClass(o.scrollWrap,"pswp__ui"),(b=o.listen)("onVerticalDrag",function(e){O&&e<.95?_.hideControls():!O&&.95<=e&&_.showControls()}),b("onPinchClose",function(e){O&&e<.9?(_.hideControls(),t=!0):t&&!O&&.9<e&&_.showControls()}),b("zoomGestureEnded",function(){(t=!1)&&!O&&_.showControls()}),b("beforeChange",_.update),b("doubleTap",function(e){var t=o.currItem.initialZoomLevel;o.getZoomLevel()!==t?o.zoomTo(t,e,333):o.zoomTo(S.getDoubleTapZoom(!1,o.currItem),e,333)}),b("preventDragEvent",function(e,t,n){var o=e.target||e.srcElement;o&&o.getAttribute("class")&&-1<e.type.indexOf("mouse")&&(0<o.getAttribute("class").indexOf("__caption")||/(SMALL|STRONG|EM)/i.test(o.tagName))&&(n.prevent=!1)}),b("bindEvents",function(){l.bind(m,"pswpTap click",e),l.bind(o.scrollWrap,"pswpTap",_.onGlobalTap),o.likelyTouchDevice||l.bind(o.scrollWrap,"mouseover",_.onMouseOver)}),b("unbindEvents",function(){F||i(),D&&clearInterval(D),l.unbind(document,"mouseout",s),l.unbind(document,"mousemove",a),l.unbind(m,"pswpTap click",e),l.unbind(o.scrollWrap,"pswpTap",_.onGlobalTap),l.unbind(o.scrollWrap,"mouseover",_.onMouseOver),p&&(l.unbind(document,p.eventK,_.updateFullscreen),p.isFullscreen()&&(S.hideAnimationDuration=0,p.exit()),p=null)}),b("destroy",function(){S.captionEl&&(h&&m.removeChild(h),l.removeClass(f,"pswp__caption--empty")),y&&(y.children[0].onclick=null),l.removeClass(m,"pswp__ui--over-close"),l.addClass(m,"pswp__ui--hidden"),_.setIdle(!1)}),S.showAnimationDuration||l.removeClass(m,"pswp__ui--hidden"),b("initialZoomIn",function(){S.showAnimationDuration&&l.removeClass(m,"pswp__ui--hidden")}),b("initialZoomOut",function(){l.addClass(m,"pswp__ui--hidden")}),b("parseVerticalMargin",u),d(),S.shareEl&&v&&y&&(F=!0),n(),S.timeToIdle&&b("mouseUsed",function(){l.bind(document,"mousemove",a),l.bind(document,"mouseout",s),D=setInterval(function(){2===++Z&&_.setIdle(!0)},S.timeToIdle/2)}),S.fullscreenEl&&!l.features.isOldAndroid&&((p=p||_.getFullscreenAPI())?(l.bind(document,p.eventK,_.updateFullscreen),_.updateFullscreen(),l.addClass(o.template,"pswp--supports-fs")):l.removeClass(o.template,"pswp--supports-fs")),S.preloaderEl&&(c(!0),b("beforeChange",function(){clearTimeout(T),T=setTimeout(function(){o.currItem&&o.currItem.loading?o.allowProgressiveImg()&&(!o.currItem.img||o.currItem.img.naturalWidth)||c(!1):c(!0)},S.loadingIndicatorDelay)}),b("imageLoadComplete",function(e,t){o.currItem===t&&c(!0)}))},_.setIdle=function(e){R(m,"ui--idle",x=e)},_.update=function(){M=!(!O||!o.currItem)&&(_.updateIndexIndicator(),S.captionEl&&(S.addCaptionHTMLFn(o.currItem,f),R(f,"caption--empty",!o.currItem.title)),!0),F||i(),n()},_.updateFullscreen=function(e){e&&setTimeout(function(){o.setScrollOffset(0,l.getScrollY())},50),l[(p.isFullscreen()?"add":"remove")+"Class"](o.template,"pswp--fs")},_.updateIndexIndicator=function(){S.counterEl&&(g.innerHTML=o.getCurrentIndex()+1+S.indexIndicatorSep+S.getNumItemsFn())},_.onGlobalTap=function(e){var t=(e=e||window.event).target||e.srcElement;if(!A)if(e.detail&&"mouse"===e.detail.pointerType)r(t)?o.close():l.hasClass(t,"pswp__img")&&(1===o.getZoomLevel()&&o.getZoomLevel()<=o.currItem.fitRatio?S.clickToCloseNonZoomable&&o.close():o.toggleDesktopZoom(e.detail.releasePoint));else if(S.tapToToggleControls&&(O?_.hideControls():_.showControls()),S.tapToClose&&(l.hasClass(t,"pswp__img")||r(t)))return void o.close()},_.onMouseOver=function(e){e=(e=e||window.event).target||e.srcElement;R(m,"ui--over-close",r(e))},_.hideControls=function(){l.addClass(m,"pswp__ui--hidden"),O=!1},_.showControls=function(){O=!0,M||_.update(),l.removeClass(m,"pswp__ui--hidden")},_.supportsFullscreen=function(){var e=document;return!!(e.exitFullscreen||e.mozCancelFullScreen||e.webkitExitFullscreen||e.msExitFullscreen)},_.getFullscreenAPI=function(){var e,t=document.documentElement,n="fullscreenchange";return t.requestFullscreen?e={enterK:"requestFullscreen",exitK:"exitFullscreen",elementK:"fullscreenElement",eventK:n}:t.mozRequestFullScreen?e={enterK:"mozRequestFullScreen",exitK:"mozCancelFullScreen",elementK:"mozFullScreenElement",eventK:"moz"+n}:t.webkitRequestFullscreen?e={enterK:"webkitRequestFullscreen",exitK:"webkitExitFullscreen",elementK:"webkitFullscreenElement",eventK:"webkit"+n}:t.msRequestFullscreen&&(e={enterK:"msRequestFullscreen",exitK:"msExitFullscreen",elementK:"msFullscreenElement",eventK:"MSFullscreenChange"}),e&&(e.enter=function(){return w=S.closeOnScroll,S.closeOnScroll=!1,"webkitRequestFullscreen"!==this.enterK?o.template[this.enterK]():void o.template[this.enterK](Element.ALLOW_KEYBOARD_INPUT)},e.exit=function(){return S.closeOnScroll=w,document[this.exitK]()},e.isFullscreen=function(){return document[this.elementK]}),e}}}),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,n,e,t){var m={features:null,bind:function(e,t,n,o){var i=(o?"remove":"add")+"EventListener";t=t.split(" ");for(var r=0;r<t.length;r++)t[r]&&e[i](t[r],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){m.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){m.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(m.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)if(t.hasOwnProperty(o)){if(n&&e.hasOwnProperty(o))continue;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(m.features)return m.features;var e,t,n=m.createEl().style,o="",i={};i.oldIE=document.all&&!document.addEventListener,i.touch="ontouchstart"in window,window.requestAnimationFrame&&(i.raf=window.requestAnimationFrame,i.caf=window.cancelAnimationFrame),i.pointerEvent=!!window.PointerEvent||navigator.msPointerEnabled,i.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&&(i.isOldIOSPhone=!0)),t=(t=e.match(/Android\s([0-9\.]*)/))?t[1]:0,1<=(t=parseFloat(t))&&(t<4.4&&(i.isOldAndroid=!0),i.androidVersion=t),i.isMobileOpera=/opera mini|opera mobi/i.test(e));for(var r,a,l,s=["transform","perspective","animationName"],c=["","webkit","Moz","ms","O"],u=0;u<4;u++){for(var o=c[u],d=0;d<3;d++)r=s[d],a=o+(o?r.charAt(0).toUpperCase()+r.slice(1):r),!i[r]&&a in n&&(i[r]=a);o&&!i.raf&&(o=o.toLowerCase(),i.raf=window[o+"RequestAnimationFrame"],i.raf&&(i.caf=window[o+"CancelAnimationFrame"]||window[o+"CancelRequestAnimationFrame"]))}return i.raf||(l=0,i.raf=function(e){var t=(new Date).getTime(),n=Math.max(0,16-(t-l)),o=window.setTimeout(function(){e(t+n)},n);return l=t+n,o},i.caf=function(e){clearTimeout(e)}),i.svg=!!document.createElementNS&&!!document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect,m.features=i}};m.detectFeatures(),m.features.oldIE&&(m.bind=function(e,t,n,o){t=t.split(" ");for(var i,r=(o?"detach":"attach")+"Event",a=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]=a;e[r]("on"+i,n["oldIE"+i])}else e[r]("on"+i,n)});var f=this,r=25,h={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"};m.extend(h,t);function o(){return{x:0,y:0}}function i(e,t){m.extend(f,t.publicMethods),_e.push(e)}function a(e){var t=jt();return t-1<e?e-t:e<0?t+e:e}function l(e,t){return Fe[e]||(Fe[e]=[]),Fe[e].push(t)}function s(e,t,n,o){return o===f.currItem.initialZoomLevel?(n[e]=f.currItem.initialPosition[e],!0):(n[e]=Ke(e,o),n[e]>t.min[e]?(n[e]=t.min[e],!0):n[e]<t.max[e]&&(n[e]=t.max[e],!0))}function c(e){var t="";h.escKey&&27===e.keyCode?t="close":h.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,f[t]()))}function u(e){e&&(ae||re||fe||te)&&(e.preventDefault(),e.stopPropagation())}function d(){f.setScrollOffset(0,m.getScrollY())}function g(e){var t;"mousedown"===e.type&&0<e.button||(Vt?e.preventDefault():ne&&"mousedown"===e.type||(St(e,!0)&&e.preventDefault(),Le("pointerDown"),H&&((t=m.arraySearch(ct,e.pointerId,"id"))<0&&(t=ct.length),ct[t]={x:e.pageX,y:e.pageY,id:e.pointerId}),e=(t=Lt(e)).length,ce=null,et(),oe&&1!==e||(oe=ge=!0,m.bind(window,E,f),ee=we=ve=te=se=ae=ie=re=!1,he=null,Le("firstTouchStart",t),qe(Ce,Ie),be.x=be.y=0,qe(lt,t[0]),qe(st,lt),ut.x=Ae.x*Ee,dt=[{x:lt.x,y:lt.y}],J=$=Re(),Ge(D,!0),bt(),Ct()),!ue&&1<e&&!fe&&!se&&(k=D,ue=ie=!(re=!1),be.y=be.x=0,qe(Ce,Ie),qe(it,t[0]),qe(rt,t[1]),Dt(it,rt,yt),vt.x=Math.abs(yt.x)-Ie.x,vt.y=Math.abs(yt.y)-Ie.y,de=xt(it,rt))))}function v(e){var t,n;e.preventDefault(),H&&-1<(t=m.arraySearch(ct,e.pointerId,"id"))&&((n=ct[t]).x=e.pageX,n.y=e.pageY),oe&&(n=Lt(e),he||ae||ue?ce=n:gt.x!==Ae.x*Ee?he="h":(e=Math.abs(n[0].x-lt.x)-Math.abs(n[0].y-lt.y),Math.abs(e)>=ot&&(he=0<e?"h":"v",ce=n)))}function y(e){if(X.isOldAndroid){if(ne&&"mouseup"===e.type)return;-1<e.type.indexOf("touch")&&(clearTimeout(ne),ne=setTimeout(function(){ne=0},600))}Le("pointerUp"),St(e,!1)&&e.preventDefault(),!H||-1<(n=m.arraySearch(ct,e.pointerId,"id"))&&(r=ct.splice(n,1)[0],navigator.msPointerEnabled?(r.type={4:"mouse",2:"touch",3:"pen"}[e.pointerType],r.type||(r.type=e.pointerType||"mouse")):r.type=e.pointerType||"mouse");var t=Lt(e),n=t.length;if(2===(n="mouseup"===e.type?0:n))return!(ce=null);1===n&&qe(st,t[0]),0!==n||he||fe||(r||("mouseup"===e.type?r={x:e.pageX,y:e.pageY,type:"mouse"}:e.changedTouches&&e.changedTouches[0]&&(r={x:e.changedTouches[0].pageX,y:e.changedTouches[0].pageY,type:"touch"})),Le("touchRelease",e,r));var o,i,r=-1;if(0===n&&(oe=!1,m.unbind(window,E,f),bt(),ue?r=0:-1!==ht&&(r=Re()-ht)),ht=1===n?Re():-1,r=-1!==r&&r<150?"zoom":"swipe",ue&&n<2&&(ue=!1,1===n&&(r="zoomPointerUp"),Le("zoomGestureEnded")),ce=null,ae||re||fe||te)if(et(),(Q=Q||Zt()).calculateSwipeSpeed("x"),te)_t()<h.verticalDragRange?f.close():(o=Ie.y,i=ye,tt("verticalDrag",0,1,300,m.easing.cubic.out,function(e){Ie.y=(f.currItem.initialPosition.y-o)*e+o,Pe((1-i)*e+i),ze()}),Le("onVerticalDrag",1));else{if((se||fe)&&0===n){if(Nt(r,Q))return;r="zoomPointerUp"}if(!fe)return"swipe"!==r?void Ht():void(!se&&D>f.currItem.fitRatio&&zt(Q))}}var w,x,b,C,I,T,E,S,A,D,k,_,M,O,F,L,R,P,Z,z,N,U,H,K,q,B,W,Y,G,V,X,j,$,J,Q,ee,te,ne,oe,ie,re,ae,le,se,ce,ue,de,pe,me,fe,he,ge,ve,ye,we,xe,be=o(),Ce=o(),Ie=o(),Te={},Ee=0,Se={},Ae=o(),De=0,ke=!0,_e=[],Me={},Oe=!1,Fe={},Le=function(e){var t=Fe[e];if(t){var n=Array.prototype.slice.call(arguments);n.shift();for(var o=0;o<t.length;o++)t[o].apply(f,n)}},Re=function(){return(new Date).getTime()},Pe=function(e){ye=e,f.bg.style.opacity=e*h.bgOpacity},Ze=function(e,t,n,o,i){(!Oe||i&&i!==f.currItem)&&(o/=(i||f.currItem).fitRatio),e[U]=_+t+"px, "+n+"px"+M+" scale("+o+")"},ze=function(e){me&&(e&&(D>f.currItem.fitRatio?Oe||(an(f.currItem,!1,!0),Oe=!0):Oe&&(an(f.currItem),Oe=!1)),Ze(me,Ie.x,Ie.y,D))},Ne=function(e){e.container&&Ze(e.container.style,e.initialPosition.x,e.initialPosition.y,e.initialZoomLevel,e)},Ue=function(e,t){t[U]=_+e+"px, 0px"+M},He=function(e,t){var n;!h.loop&&t&&(n=C+(Ae.x*Ee-e)/Ae.x,t=Math.round(e-gt.x),(n<0&&0<t||n>=jt()-1&&t<0)&&(e=gt.x+t*h.mainScrollEndFriction)),gt.x=e,Ue(e,I)},Ke=function(e,t){var n=vt[e]-Se[e];return Ce[e]+be[e]+n-t/k*n},qe=function(e,t){e.x=t.x,e.y=t.y,t.id&&(e.id=t.id)},Be=function(e){e.x=Math.round(e.x),e.y=Math.round(e.y)},We=null,Ye=function(){We&&(m.unbind(document,"mousemove",Ye),m.addClass(p,"pswp--has_mouse"),h.mouseUsed=!0,Le("mouseUsed")),We=setTimeout(function(){We=null},100)},Ge=function(e,t){e=on(f.currItem,Te,e);return t&&(pe=e),e},Ve=function(e){return(e=e||f.currItem).initialZoomLevel},Xe=function(e){return 0<(e=e||f.currItem).w?h.maxSpreadZoom:1},je={},$e=0,Je=function(e){je[e]&&(je[e].raf&&B(je[e].raf),$e--,delete je[e])},Qe=function(e){je[e]&&Je(e),je[e]||($e++,je[e]={})},et=function(){for(var e in je)je.hasOwnProperty(e)&&Je(e)},tt=function(e,t,n,o,i,r,a){var l,s=Re();Qe(e);function c(){if(je[e]){if(l=Re()-s,o<=l)return Je(e),r(n),void(a&&a());r((n-t)*i(l/o)+t),je[e].raf=q(c)}}c()},t={shout:Le,listen:l,viewportSize:Te,options:h,isMainScrollAnimating:function(){return fe},getZoomLevel:function(){return D},getCurrentIndex:function(){return C},isDragging:function(){return oe},isZooming:function(){return ue},setScrollOffset:function(e,t){Se.x=e,V=Se.y=t,Le("updateScrollOffset",Se)},applyZoomPan:function(e,t,n,o){Ie.x=t,Ie.y=n,D=e,ze(o)},init:function(){if(!w&&!x){var e;f.framework=m,f.template=p,f.bg=m.getChildByClass(p,"pswp__bg"),W=p.className,w=!0,X=m.detectFeatures(),q=X.raf,B=X.caf,U=X.transform,G=X.oldIE,f.scrollWrap=m.getChildByClass(p,"pswp__scroll-wrap"),f.container=m.getChildByClass(f.scrollWrap,"pswp__container"),I=f.container.style,f.itemHolders=L=[{el:f.container.children[0],wrap:0,index:-1},{el:f.container.children[1],wrap:0,index:-1},{el:f.container.children[2],wrap:0,index:-1}],L[0].el.style.display=L[2].el.style.display="none",function(){if(U){var e=X.perspective&&!K;return _="translate"+(e?"3d(":"("),M=X.perspective?", 0px)":")"}U="left",m.addClass(p,"pswp--ie"),Ue=function(e,t){t.left=e+"px"},Ne=function(e){var t=1<e.fitRatio?1:e.fitRatio,n=e.container.style,o=t*e.w,t=t*e.h;n.width=o+"px",n.height=t+"px",n.left=e.initialPosition.x+"px",n.top=e.initialPosition.y+"px"},ze=function(){var e,t,n,o;me&&(e=me,n=(t=1<(o=f.currItem).fitRatio?1:o.fitRatio)*o.w,o=t*o.h,e.width=n+"px",e.height=o+"px",e.left=Ie.x+"px",e.top=Ie.y+"px")}}(),A={resize:f.updateSize,orientationchange:function(){clearTimeout(j),j=setTimeout(function(){Te.x!==f.scrollWrap.clientWidth&&f.updateSize()},500)},scroll:d,keydown:c,click:u};var t=X.isOldIOSPhone||X.isOldAndroid||X.isMobileOpera;for(X.animationName&&X.transform&&!t||(h.showAnimationDuration=h.hideAnimationDuration=0),e=0;e<_e.length;e++)f["init"+_e[e]]();n&&(f.ui=new n(f,m)).init(),Le("firstUpdate"),C=C||h.index||0,(isNaN(C)||C<0||C>=jt())&&(C=0),f.currItem=Xt(C),(X.isOldIOSPhone||X.isOldAndroid)&&(ke=!1),p.setAttribute("aria-hidden","false"),h.modal&&(ke?p.style.position="fixed":(p.style.position="absolute",p.style.top=m.getScrollY()+"px")),void 0===V&&(Le("initialLayout"),V=Y=m.getScrollY());t="pswp--open ";for(h.mainClass&&(t+=h.mainClass+" "),h.showHideOpacity&&(t+="pswp--animate_opacity "),t+=K?"pswp--touch":"pswp--notouch",t+=X.animationName?" pswp--css_animation":"",t+=X.svg?" pswp--svg":"",m.addClass(p,t),f.updateSize(),T=-1,De=null,e=0;e<3;e++)Ue((e+T)*Ae.x,L[e].el.style);G||m.bind(f.scrollWrap,S,f),l("initialZoomInEnd",function(){f.setContent(L[0],C-1),f.setContent(L[2],C+1),L[0].el.style.display=L[2].el.style.display="block",h.focus&&p.focus(),m.bind(document,"keydown",f),X.transform&&m.bind(f.scrollWrap,"click",f),h.mouseUsed||m.bind(document,"mousemove",Ye),m.bind(window,"resize scroll orientationchange",f),Le("bindEvents")}),f.setContent(L[1],C),f.updateCurrItem(),Le("afterInit"),ke||(O=setInterval(function(){$e||oe||ue||D!==f.currItem.initialZoomLevel||f.updateSize()},1e3)),m.addClass(p,"pswp--visible")}},close:function(){w&&(x=!(w=!1),Le("close"),m.unbind(window,"resize scroll orientationchange",f),m.unbind(window,"scroll",A.scroll),m.unbind(document,"keydown",f),m.unbind(document,"mousemove",Ye),X.transform&&m.unbind(f.scrollWrap,"click",f),oe&&m.unbind(window,E,f),clearTimeout(j),Le("unbindEvents"),$t(f.currItem,null,!0,f.destroy))},destroy:function(){Le("destroy"),Wt&&clearTimeout(Wt),p.setAttribute("aria-hidden","true"),p.className=W,O&&clearInterval(O),m.unbind(f.scrollWrap,S,f),m.unbind(window,"scroll",f),bt(),et(),Fe=null},panTo:function(e,t,n){n||(e>pe.min.x?e=pe.min.x:e<pe.max.x&&(e=pe.max.x),t>pe.min.y?t=pe.min.y:t<pe.max.y&&(t=pe.max.y)),Ie.x=e,Ie.y=t,ze()},handleEvent:function(e){e=e||window.event,A[e.type]&&A[e.type](e)},goTo:function(e){var t=(e=a(e))-C;De=t,C=e,f.currItem=Xt(C),Ee-=t,He(Ae.x*Ee),et(),fe=!1,f.updateCurrItem()},next:function(){f.goTo(C+1)},prev:function(){f.goTo(C-1)},updateCurrZoomItem:function(e){var t;e&&Le("beforeChange",0),me=L[1].el.children.length?(t=L[1].el.children[0],m.hasClass(t,"pswp__zoom-wrap")?t.style:null):null,pe=f.currItem.bounds,k=D=f.currItem.initialZoomLevel,Ie.x=pe.center.x,Ie.y=pe.center.y,e&&Le("afterChange")},invalidateCurrItems:function(){F=!0;for(var e=0;e<3;e++)L[e].item&&(L[e].item.needsUpdate=!0)},updateCurrItem:function(e){if(0!==De){var t,n=Math.abs(De);if(!(e&&n<2)){f.currItem=Xt(C),Oe=!1,Le("beforeChange",De),3<=n&&(T+=De+(0<De?-3:3),n=3);for(var o=0;o<n;o++)0<De?(t=L.shift(),L[2]=t,Ue((++T+2)*Ae.x,t.el.style),f.setContent(t,C-n+o+1+1)):(t=L.pop(),L.unshift(t),Ue(--T*Ae.x,t.el.style),f.setContent(t,C+n-o-1-1));!me||1!==Math.abs(De)||(e=Xt(R)).initialZoomLevel!==D&&(on(e,Te),an(e),Ne(e)),De=0,f.updateCurrZoomItem(),R=C,Le("afterChange")}}},updateSize:function(e){if(!ke&&h.modal){var t=m.getScrollY();if(V!==t&&(p.style.top=t+"px",V=t),!e&&Me.x===window.innerWidth&&Me.y===window.innerHeight)return;Me.x=window.innerWidth,Me.y=window.innerHeight,p.style.height=Me.y+"px"}if(Te.x=f.scrollWrap.clientWidth,Te.y=f.scrollWrap.clientHeight,d(),Ae.x=Te.x+Math.round(Te.x*h.spacing),Ae.y=Te.y,He(Ae.x*Ee),Le("beforeResize"),void 0!==T){for(var n,o,i,r=0;r<3;r++)n=L[r],Ue((r+T)*Ae.x,n.el.style),i=C+r-1,h.loop&&2<jt()&&(i=a(i)),(o=Xt(i))&&(F||o.needsUpdate||!o.bounds)?(f.cleanSlide(o),f.setContent(n,i),1===r&&(f.currItem=o,f.updateCurrZoomItem(!0)),o.needsUpdate=!1):-1===n.index&&0<=i&&f.setContent(n,i),o&&o.container&&(on(o,Te),an(o),Ne(o));F=!1}k=D=f.currItem.initialZoomLevel,(pe=f.currItem.bounds)&&(Ie.x=pe.center.x,Ie.y=pe.center.y,ze(!0)),Le("resize")},zoomTo:function(t,e,n,o,i){e&&(k=D,vt.x=Math.abs(e.x)-Ie.x,vt.y=Math.abs(e.y)-Ie.y,qe(Ce,Ie));var e=Ge(t,!1),r={};s("x",e,r,t),s("y",e,r,t);var a=D,l={x:Ie.x,y:Ie.y};Be(r);e=function(e){1===e?(D=t,Ie.x=r.x,Ie.y=r.y):(D=(t-a)*e+a,Ie.x=(r.x-l.x)*e+l.x,Ie.y=(r.y-l.y)*e+l.y),i&&i(e),ze(1===e)};n?tt("customZoomTo",0,1,n,o||m.easing.sine.inOut,e):e(1)}},nt=30,ot=10,it={},rt={},at={},lt={},st={},ct=[],ut={},dt=[],pt={},mt=0,ft=o(),ht=0,gt=o(),vt=o(),yt=o(),wt=function(e,t){return e.x===t.x&&e.y===t.y},xt=function(e,t){return pt.x=Math.abs(e.x-t.x),pt.y=Math.abs(e.y-t.y),Math.sqrt(pt.x*pt.x+pt.y*pt.y)},bt=function(){le&&(B(le),le=null)},Ct=function(){oe&&(le=q(Ct),Pt())},It=function(){return!("fit"===h.scaleMode&&D===f.currItem.initialZoomLevel)},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))},Et={},St=function(e,t){return Et.prevent=!Tt(e.target,h.isClickableElement),Le("preventDragEvent",e,t,Et),Et.prevent},At=function(e,t){return t.x=e.pageX,t.y=e.pageY,t.id=e.identifier,t},Dt=function(e,t,n){n.x=.5*(e.x+t.x),n.y=.5*(e.y+t.y)},kt=function(e,t,n){var o;50<e-J&&((o=2<dt.length?dt.shift():{}).x=t,o.y=n,dt.push(o),J=e)},_t=function(){var e=Ie.y-f.currItem.initialPosition.y;return 1-Math.abs(e/(Te.y/2))},Mt={},Ot={},Ft=[],Lt=function(e){for(;0<Ft.length;)Ft.pop();return H?(xe=0,ct.forEach(function(e){0===xe?Ft[0]=e:1===xe&&(Ft[1]=e),xe++})):-1<e.type.indexOf("touch")?e.touches&&0<e.touches.length&&(Ft[0]=At(e.touches[0],Mt),1<e.touches.length&&(Ft[1]=At(e.touches[1],Ot))):(Mt.x=e.pageX,Mt.y=e.pageY,Mt.id="",Ft[0]=Mt),Ft},Rt=function(e,t){var n,o,i,r=Ie[e]+t[e],a=0<t[e],l=gt.x+t.x,s=gt.x-ut.x,c=r>pe.min[e]||r<pe.max[e]?h.panEndFriction:1,r=Ie[e]+t[e]*c;return!h.allowPanToNext&&D!==f.currItem.initialZoomLevel||(me?"h"!==he||"x"!==e||re||(a?(r>pe.min[e]&&(c=h.panEndFriction,pe.min[e],n=pe.min[e]-Ce[e]),(n<=0||s<0)&&1<jt()?(i=l,s<0&&l>ut.x&&(i=ut.x)):pe.min.x!==pe.max.x&&(o=r)):(r<pe.max[e]&&(c=h.panEndFriction,pe.max[e],n=Ce[e]-pe.max[e]),(n<=0||0<s)&&1<jt()?(i=l,0<s&&l<ut.x&&(i=ut.x)):pe.min.x!==pe.max.x&&(o=r))):i=l,"x"!==e)?void(fe||se||D>f.currItem.fitRatio&&(Ie[e]+=t[e]*c)):(void 0!==i&&(He(i,!0),se=i!==ut.x),pe.min.x!==pe.max.x&&(void 0!==o?Ie.x=o:se||(Ie.x+=t.x*c)),void 0!==i)},Pt=function(){if(ce){var e,t,n,o,i=ce.length;if(0!==i)if(qe(it,ce[0]),at.x=it.x-lt.x,at.y=it.y-lt.y,ue&&1<i)lt.x=it.x,lt.y=it.y,!at.x&&!at.y&&wt(ce[1],rt)||(qe(rt,ce[1]),re||(re=!0,Le("zoomGestureStarted")),e=xt(it,rt),(r=Ut(e))>f.currItem.initialZoomLevel+f.currItem.initialZoomLevel/15&&(we=!0),t=1,n=Ve(),o=Xe(),r<n?h.pinchToClose&&!we&&k<=f.currItem.initialZoomLevel?(Pe(i=1-(n-r)/(n/1.2)),Le("onPinchClose",i),ve=!0):r=n-(t=1<(t=(n-r)/n)?1:t)*(n/3):o<r&&(r=o+(t=1<(t=(r-o)/(6*n))?1:t)*n),t<0&&(t=0),Dt(it,rt,ft),be.x+=ft.x-yt.x,be.y+=ft.y-yt.y,qe(yt,ft),Ie.x=Ke("x",r),Ie.y=Ke("y",r),ee=D<r,D=r,ze());else if(he&&(ge&&(ge=!1,Math.abs(at.x)>=ot&&(at.x-=ce[0].x-st.x),Math.abs(at.y)>=ot&&(at.y-=ce[0].y-st.y)),lt.x=it.x,lt.y=it.y,0!==at.x||0!==at.y)){if("v"===he&&h.closeOnVerticalDrag&&!It()){be.y+=at.y,Ie.y+=at.y;var r=_t();return te=!0,Le("onVerticalDrag",r),Pe(r),void ze()}kt(Re(),it.x,it.y),ae=!0,pe=f.currItem.bounds,Rt("x",at)||(Rt("y",at),Be(Ie),ze())}}},Zt=function(){var t,n,o={lastFlickOffset:{},lastFlickDist:{},lastFlickSpeed:{},slowDownRatio:{},slowDownRatioReverse:{},speedDecelerationRatio:{},speedDecelerationRatioAbs:{},distanceOffset:{},backAnimDestination:{},backAnimStarted:{},calculateSwipeSpeed:function(e){n=1<dt.length?(t=Re()-J+50,dt[dt.length-2][e]):(t=Re()-$,st[e]),o.lastFlickOffset[e]=lt[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]||(Ie[t]>pe.min[t]?o.backAnimDestination[t]=pe.min[t]:Ie[t]<pe.max[t]&&(o.backAnimDestination[t]=pe.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,tt("bounceZoomPan"+t,Ie[t],o.backAnimDestination[t],e||300,m.easing.sine.out,function(e){Ie[t]=e,ze()}))))},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,Ie[e]+=o.distanceOffset[e])},panAnimLoop:function(){if(je.zoomPan&&(je.zoomPan.raf=q(o.panAnimLoop),o.now=Re(),o.timeDiff=o.now-o.lastNow,o.lastNow=o.now,o.calculateAnimOffset("x"),o.calculateAnimOffset("y"),ze(),o.calculateOverBoundsAnimOffset("x"),o.calculateOverBoundsAnimOffset("y"),o.speedDecelerationRatioAbs.x<.05&&o.speedDecelerationRatioAbs.y<.05))return Ie.x=Math.round(Ie.x),Ie.y=Math.round(Ie.y),ze(),void Je("zoomPan")}};return o},zt=function(e){return e.calculateSwipeSpeed("y"),pe=f.currItem.bounds,e.backAnimDestination={},e.backAnimStarted={},Math.abs(e.lastFlickSpeed.x)<=.05&&Math.abs(e.lastFlickSpeed.y)<=.05?(e.speedDecelerationRatioAbs.x=e.speedDecelerationRatioAbs.y=0,e.calculateOverBoundsAnimOffset("x"),e.calculateOverBoundsAnimOffset("y"),!0):(Qe("zoomPan"),e.lastNow=Re(),void e.panAnimLoop())},Nt=function(e,t){var n,o;fe||(mt=C),"swipe"===e&&(o=lt.x-st.x,e=t.lastFlickDist.x<10,nt<o&&(e||20<t.lastFlickOffset.x)?r=-1:o<-nt&&(e||t.lastFlickOffset.x<-20)&&(r=1)),r&&((C+=r)<0?(C=h.loop?jt()-1:0,i=!0):C>=jt()&&(C=h.loop?0:jt()-1,i=!0),i&&!h.loop||(De+=r,Ee-=r,n=!0));var i=Ae.x*Ee,r=Math.abs(i-gt.x),a=n||i>gt.x==0<t.lastFlickSpeed.x?(a=0<Math.abs(t.lastFlickSpeed.x)?r/Math.abs(t.lastFlickSpeed.x):333,a=Math.min(a,400),Math.max(a,250)):333;return mt===C&&(n=!1),fe=!0,Le("mainScrollAnimStart"),tt("mainScroll",gt.x,i,a,m.easing.cubic.out,He,function(){et(),fe=!1,mt=-1,!n&&mt===C||f.updateCurrItem(),Le("mainScrollAnimComplete")}),n&&f.updateCurrItem(!0),n},Ut=function(e){return 1/de*e*k},Ht=function(){var e=D,t=Ve(),n=Xe();D<t?e=t:n<D&&(e=n);var o,i=ye;return ve&&!ee&&!we&&D<t?f.close():(ve&&(o=function(e){Pe((1-i)*e+i)}),f.zoomTo(e,0,200,m.easing.cubic.out,o)),!0};i("Gestures",{publicMethods:{initGestures:function(){function e(e,t,n,o,i){P=e+t,Z=e+n,z=e+o,N=i?e+i:""}(H=X.pointerEvent)&&X.touch&&(X.touch=!1),H?navigator.msPointerEnabled?e("MSPointer","Down","Move","Up","Cancel"):e("pointer","down","move","up","cancel"):X.touch?(e("touch","start","move","end","cancel"),K=!0):e("mouse","down","move","up"),E=Z+" "+z+" "+N,S=P,H&&!K&&(K=1<navigator.maxTouchPoints||1<navigator.msMaxTouchPoints),f.likelyTouchDevice=K,A[P]=g,A[Z]=v,A[z]=y,N&&(A[N]=A[z]),X.touch&&(S+=" mousedown",E+=" mousemove mouseup",A.mousedown=A[P],A.mousemove=A[Z],A.mouseup=A[z]),K||(h.allowPanToNext=!1)}}});function Kt(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=m.createEl("pswp__img","img");return n.onload=t,n.onerror=function(){e.loadError=!0,t()},n.src=e.src,n}function qt(e,t){return e.src&&e.loadError&&e.container&&(t&&(e.container.innerHTML=""),e.container.innerHTML=h.errorMsg.replace("%url%",e.src),1)}function Bt(){if(Qt.length){for(var e,t=0;t<Qt.length;t++)(e=Qt[t]).holder.index===e.index&&rn(e.index,e.item,e.baseDiv,e.img,!1,e.clearPlaceholder);Qt=[]}}var Wt,Yt,Gt,Vt,Xt,jt,$t=function(r,e,a,t){var l;Wt&&clearTimeout(Wt),Gt=Vt=!0,r.initialLayout?(l=r.initialLayout,r.initialLayout=null):l=h.getThumbBoundsFn&&h.getThumbBoundsFn(C);function s(){Je("initialZoom"),a?(f.template.removeAttribute("style"),f.bg.removeAttribute("style")):(Pe(1),e&&(e.style.display="block"),m.addClass(p,"pswp--animated-in"),Le("initialZoom"+(a?"OutEnd":"InEnd"))),t&&t(),Vt=!1}var c=a?h.hideAnimationDuration:h.showAnimationDuration;if(!c||!l||void 0===l.x)return Le("initialZoom"+(a?"Out":"In")),D=r.initialZoomLevel,qe(Ie,r.initialPosition),ze(),p.style.opacity=a?0:1,Pe(1),void(c?setTimeout(function(){s()},c):s());var u,d;u=b,d=!f.currItem.src||f.currItem.loadError||h.showHideOpacity,r.miniImg&&(r.miniImg.style.webkitBackfaceVisibility="hidden"),a||(D=l.w/r.w,Ie.x=l.x,Ie.y=l.y-Y,f[d?"template":"bg"].style.opacity=.001,ze()),Qe("initialZoom"),a&&!u&&m.removeClass(p,"pswp--animated-in"),d&&(a?m[(u?"remove":"add")+"Class"](p,"pswp--animate_opacity"):setTimeout(function(){m.addClass(p,"pswp--animate_opacity")},30)),Wt=setTimeout(function(){var t,n,o,i,e;Le("initialZoom"+(a?"Out":"In")),a?(t=l.w/r.w,n={x:Ie.x,y:Ie.y},o=D,i=ye,e=function(e){1===e?(D=t,Ie.x=l.x,Ie.y=l.y-V):(D=(t-o)*e+o,Ie.x=(l.x-n.x)*e+n.x,Ie.y=(l.y-V-n.y)*e+n.y),ze(),d?p.style.opacity=1-e:Pe(i-e*i)},u?tt("initialZoom",0,1,c,m.easing.cubic.out,e,s):(e(1),Wt=setTimeout(s,c+20))):(D=r.initialZoomLevel,qe(Ie,r.initialPosition),ze(),Pe(1),d?p.style.opacity=1:Pe(1),Wt=setTimeout(s,c+20))},a?25:90)},Jt={},Qt=[],en={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 Yt.length}},tn=function(){return{center:{x:0,y:0},max:{x:0,y:0},min:{x:0,y:0}}},nn=function(e,t,n){var o=e.bounds;o.center.x=Math.round((Jt.x-t)/2),o.center.y=Math.round((Jt.y-n)/2)+e.vGap.top,o.max.x=t>Jt.x?Math.round(Jt.x-t):o.center.x,o.max.y=n>Jt.y?Math.round(Jt.y-n)+e.vGap.top:o.center.y,o.min.x=t>Jt.x?0:o.center.x,o.min.y=n>Jt.y?e.vGap.top:o.center.y},on=function(e,t,n){if(!e.src||e.loadError)return e.w=e.h=0,e.initialZoomLevel=e.fitRatio=1,e.bounds=tn(),e.initialPosition=e.bounds.center,e.bounds;var o,i=!n;return i&&(e.vGap||(e.vGap={top:0,bottom:0}),Le("parseVerticalMargin",e)),Jt.x=t.x,Jt.y=t.y-e.vGap.top-e.vGap.bottom,i&&(o=Jt.x/e.w,t=Jt.y/e.h,e.fitRatio=o<t?o:t,"orig"===(t=h.scaleMode)?n=1:"fit"===t&&(n=e.fitRatio),e.initialZoomLevel=n=1<n?1:n,e.bounds||(e.bounds=tn())),n?(nn(e,e.w*n,e.h*n),i&&n===e.initialZoomLevel&&(e.initialPosition=e.bounds.center),e.bounds):void 0},rn=function(e,t,n,o,i,r){t.loadError||o&&(t.imageAppended=!0,an(t,o,t===f.currItem&&Oe),n.appendChild(o),r&&setTimeout(function(){t&&t.loaded&&t.placeholder&&(t.placeholder.style.display="none",t.placeholder=null)},500))},an=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")};i("Controller",{publicMethods:{lazyLoadItem:function(e){e=a(e);var t=Xt(e);t&&(!t.loaded&&!t.loading||F)&&(Le("gettingData",e,t),t.src&&Kt(t))},initController:function(){m.extend(h,en,!0),f.items=Yt=e,Xt=f.getItemAt,jt=h.getNumItemsFn,h.loop,jt()<3&&(h.loop=!1),l("beforeChange",function(e){for(var t=h.preload,n=null===e||0<=e,o=Math.min(t[0],jt()),i=Math.min(t[1],jt()),r=1;r<=(n?i:o);r++)f.lazyLoadItem(C+r);for(r=1;r<=(n?o:i);r++)f.lazyLoadItem(C-r)}),l("initialLayout",function(){f.currItem.initialLayout=h.getThumbBoundsFn&&h.getThumbBoundsFn(C)}),l("mainScrollAnimComplete",Bt),l("initialZoomInEnd",Bt),l("destroy",function(){for(var e,t=0;t<Yt.length;t++)(e=Yt[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);Qt=null})},getItemAt:function(e){return 0<=e&&void 0!==Yt[e]&&Yt[e]},allowProgressiveImg:function(){return h.forceProgressiveLoading||!K||h.mouseUsed||1200<screen.width},setContent:function(t,n){h.loop&&(n=a(n));var e=f.getItemAt(t.index);e&&(e.container=null);var o,i,r=f.getItemAt(n);r?(Le("gettingData",n,r),t.index=n,i=(t.item=r).container=m.createEl("pswp__zoom-wrap"),!r.src&&r.html&&(r.html.tagName?i.appendChild(r.html):i.innerHTML=r.html),qt(r),on(r,Te),!r.src||r.loadError||r.loaded?r.src&&!r.loadError&&((o=m.createEl("pswp__img","img")).style.opacity=1,o.src=r.src,an(r,o),rn(n,r,i,o,!0)):(r.loadComplete=function(e){if(w){if(t&&t.index===n){if(qt(e,!0))return e.loadComplete=e.img=null,on(e,Te),Ne(e),void(t.index===C&&f.updateCurrZoomItem());e.imageAppended?!Vt&&e.placeholder&&(e.placeholder.style.display="none",e.placeholder=null):X.transform&&(fe||Vt)?Qt.push({item:e,baseDiv:i,img:e.img,index:n,holder:t,clearPlaceholder:!0}):rn(n,e,i,e.img,fe||Vt,!0)}e.loadComplete=null,e.img=null,Le("imageLoadComplete",n,e)}},m.features.transform&&(e="pswp__img pswp__img--placeholder",e+=r.msrc?"":" pswp__img--placeholder--blank",e=m.createEl(e,r.msrc?"img":""),r.msrc&&(e.src=r.msrc),an(r,e),i.appendChild(e),r.placeholder=e),r.loading||Kt(r),f.allowProgressiveImg()&&(!Gt&&X.transform?Qt.push({item:r,baseDiv:i,img:r.img,index:n,holder:t}):rn(n,r,i,r.img,!0,!0))),Gt||n!==C?Ne(r):(me=i.style,$t(r,o||r.img)),t.el.innerHTML="",t.el.appendChild(i)):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 ln(e,t,n){var o=document.createEvent("CustomEvent"),n={origEvent:e,target:e.target,releasePoint:t,pointerType:n||"touch"};o.initCustomEvent("pswpTap",!0,!0,n),e.target.dispatchEvent(o)}var sn,cn,un={};i("Tap",{publicMethods:{initTap:function(){l("firstTouchStart",f.onTapStart),l("touchRelease",f.onTapRelease),l("destroy",function(){un={},sn=null})},onTapStart:function(e){1<e.length&&(clearTimeout(sn),sn=null)},onTapRelease:function(e,t){var n,o,i;!t||ae||ie||$e||(n=t,sn&&(clearTimeout(sn),sn=null,o=n,i=un,Math.abs(o.x-i.x)<r&&Math.abs(o.y-i.y)<r)?Le("doubleTap",n):"mouse"!==t.type?"BUTTON"===e.target.tagName.toUpperCase()||m.hasClass(e.target,"pswp__single-tap")?ln(e,t):(qe(un,n),sn=setTimeout(function(){ln(e,t),sn=null},300)):ln(e,t,"mouse"))}}}),i("DesktopZoom",{publicMethods:{initDesktopZoom:function(){G||(K?l("mouseUsed",function(){f.setupDesktopZoom()}):f.setupDesktopZoom(!0))},setupDesktopZoom:function(e){cn={};var t="wheel mousewheel DOMMouseScroll";l("bindEvents",function(){m.bind(p,t,f.handleMouseWheel)}),l("unbindEvents",function(){cn&&m.unbind(p,t,f.handleMouseWheel)}),f.mouseZoomedIn=!1;function n(){f.mouseZoomedIn&&(m.removeClass(p,"pswp--zoomed-in"),f.mouseZoomedIn=!1),D<1?m.addClass(p,"pswp--zoom-allowed"):m.removeClass(p,"pswp--zoom-allowed"),i()}var o,i=function(){o&&(m.removeClass(p,"pswp--dragging"),o=!1)};l("resize",n),l("afterChange",n),l("pointerDown",function(){f.mouseZoomedIn&&(o=!0,m.addClass(p,"pswp--dragging"))}),l("pointerUp",i),e||n()},handleMouseWheel:function(e){if(D<=f.currItem.fitRatio)return h.modal&&(!h.closeOnScroll||$e||oe?e.preventDefault():U&&2<Math.abs(e.deltaY)&&(b=!0,f.close())),!0;if(e.stopPropagation(),cn.x=0,"deltaX"in e)1===e.deltaMode?(cn.x=18*e.deltaX,cn.y=18*e.deltaY):(cn.x=e.deltaX,cn.y=e.deltaY);else if("wheelDelta"in e)e.wheelDeltaX&&(cn.x=-.16*e.wheelDeltaX),e.wheelDeltaY?cn.y=-.16*e.wheelDeltaY:cn.y=-.16*e.wheelDelta;else{if(!("detail"in e))return;cn.y=e.detail}Ge(D,!0);var t=Ie.x-cn.x,n=Ie.y-cn.y;(h.modal||t<=pe.min.x&&t>=pe.max.x&&n<=pe.min.y&&n>=pe.max.y)&&e.preventDefault(),f.panTo(t,n)},toggleDesktopZoom:function(e){e=e||{x:Te.x/2+Se.x,y:Te.y/2+Se.y};var t=h.getDoubleTapZoom(!0,f.currItem),n=D===t;f.mouseZoomedIn=!n,f.zoomTo(n?f.currItem.initialZoomLevel:t,e,333),m[(n?"remove":"add")+"Class"](p,"pswp--zoomed-in")}}});function dn(){mn&&clearTimeout(mn),hn&&clearTimeout(hn)}function pn(){var e=Sn(),t={};if(e.length<5)return t;var n,o=e.split("&");for(r=0;r<o.length;r++)o[r]&&((n=o[r].split("=")).length<2||(t[n[0]]=n[1]));if(h.galleryPIDs){for(var i=t.pid,r=t.pid=0;r<Yt.length;r++)if(Yt[r].pid===i){t.pid=r;break}}else t.pid=parseInt(t.pid,10)-1;return t.pid<0&&(t.pid=0),t}var mn,fn,hn,gn,vn,yn,wn,xn,bn,Cn,In,Tn,En={history:!0,galleryUID:1},Sn=function(){return In.hash.substring(1)},An=function(){var e,t;hn&&clearTimeout(hn),$e||oe?hn=setTimeout(An,500):(gn?clearTimeout(fn):gn=!0,t=C+1,(e=Xt(C)).hasOwnProperty("pid")&&(t=e.pid),e=wn+"&gid="+h.galleryUID+"&pid="+t,xn||-1===In.hash.indexOf(e)&&(Cn=!0),t=In.href.split("#")[0]+"#"+e,Tn?"#"+e!==window.location.hash&&history[xn?"replaceState":"pushState"]("",document.title,t):xn?In.replace(t):In.hash=e,xn=!0,fn=setTimeout(function(){gn=!1},60))};i("History",{publicMethods:{initHistory:function(){var e,t;m.extend(h,En,!0),h.history&&(In=window.location,xn=bn=Cn=!1,wn=Sn(),Tn="pushState"in history,-1<wn.indexOf("gid=")&&(wn=(wn=wn.split("&gid=")[0]).split("?gid=")[0]),l("afterChange",f.updateURL),l("unbindEvents",function(){m.unbind(window,"hashchange",f.onHashChange)}),e=function(){yn=!0,bn||(Cn?history.back():wn?In.hash=wn:Tn?history.pushState("",document.title,In.pathname+In.search):In.hash=""),dn()},l("unbindEvents",function(){b&&e()}),l("destroy",function(){yn||e()}),l("firstUpdate",function(){C=pn().pid}),-1<(t=wn.indexOf("pid="))&&("&"===(wn=wn.substring(0,t)).slice(-1)&&(wn=wn.slice(0,-1))),setTimeout(function(){w&&m.bind(window,"hashchange",f.onHashChange)},40))},onHashChange:function(){return Sn()===wn?(bn=!0,void f.close()):void(gn||(vn=!0,f.goTo(pn().pid),vn=!1))},updateURL:function(){dn(),vn||(xn?mn=setTimeout(An,800):An())}}}),m.extend(f,t)}}),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).reframe=t()}(this,function(){"use strict";function t(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var o=Array(e),i=0,t=0;t<n;t++)for(var r=arguments[t],a=0,l=r.length;a<l;a++,i++)o[i]=r[a];return o}return function(e,i){return void 0===i&&(i="js-reframe"),("string"==typeof e?t(document.querySelectorAll(e)):"length"in e?t(e):[e]).forEach(function(e){var t,n,o;-1!==e.className.split(" ").indexOf(i)||-1<e.style.width.indexOf("%")||(t=e.getAttribute("height")||e.offsetHeight,n=e.getAttribute("width")||e.offsetWidth,o=("string"==typeof t?parseInt(t):t)/("string"==typeof n?parseInt(n):n)*100,(t=document.createElement("div")).className=i,(n=t.style).position="relative",n.width="100%",n.paddingTop=o+"%",(o=e.style).position="absolute",o.width="100%",o.height="100%",o.left="0",o.top="0",null!==(o=e.parentNode)&&void 0!==o&&o.insertBefore(t,e),null!==(o=e.parentNode)&&void 0!==o&&o.removeChild(e),t.appendChild(e))})}}),function(){var e=document.querySelector(".gh-burger");e&&e.addEventListener("click",function(){document.body.classList.contains("is-head-open")?document.body.classList.remove("is-head-open"):document.body.classList.add("is-head-open")})}(),lightbox(".kg-image-card > .kg-image, .kg-gallery-image img"),reframe(document.querySelectorAll(['.gh-content iframe[src*="youtube.com"]','.gh-content iframe[src*="youtube-nocookie.com"]','.gh-content iframe[src*="player.vimeo.com"]','.gh-content iframe[src*="kickstarter.com"][src*="video.html"]',".gh-content object",".gh-content embed"].join(","))),pagination(!1);
//# sourceMappingURL=main.min.js.map