(()=>{+function(){"use strict";function h(c){var l=c.getBoundingClientRect(),u=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0,r=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;return{top:l.top+u,left:l.left+r}}var z=80,k=function(){function c(){var o=document.createElement("img");o.onload=function(){m=Number(o.height),f=Number(o.width),l()},o.src=e.currentSrc||e.src}function l(){n=document.createElement("div"),n.className="zoom-img-wrap",n.style.position="absolute",n.style.top=h(e).top+"px",n.style.left=h(e).left+"px",s=e.cloneNode(),s.style.visibility="hidden",e.style.width=e.offsetWidth+"px",e.parentNode.replaceChild(s,e),document.body.appendChild(n),n.appendChild(e),e.classList.add("zoom-img"),e.setAttribute("data-action","zoom-out"),i=document.createElement("div"),i.className="zoom-overlay",document.body.appendChild(i),u(),r()}function u(){e.offsetWidth;var o=f,t=m,d=o/e.width,p=window.innerHeight-z,y=window.innerWidth-z,g=o/t,b=y/p;v=o<y&&t<p?d:g<b?p/t*d:y/o*d}function r(){e.offsetWidth;var o=h(e),t=window.pageYOffset,d=t+window.innerHeight/2,p=window.innerWidth/2,y=o.top+e.height/2,g=o.left+e.width/2,b=Math.round(d-y),T=Math.round(p-g),L="scale("+v+")",E="translate("+T+"px, "+b+"px) translateZ(0)";e.style.webkitTransform=L,e.style.msTransform=L,e.style.transform=L,n.style.webkitTransform=E,n.style.msTransform=E,n.style.transform=E,document.body.classList.add("zoom-overlay-open")}function w(){if(document.body.classList.remove("zoom-overlay-open"),document.body.classList.add("zoom-overlay-transitioning"),e.style.webkitTransform="",e.style.msTransform="",e.style.transform="",n.style.webkitTransform="",n.style.msTransform="",n.style.transform="",!1 in document.body.style)return a();n.addEventListener("transitionend",a),n.addEventListener("webkitTransitionEnd",a)}function a(){e.removeEventListener("transitionend",a),e.removeEventListener("webkitTransitionEnd",a),n&&n.parentNode&&(e.classList.remove("zoom-img"),e.style.width="",e.setAttribute("data-action","zoom"),s.parentNode.replaceChild(e,s),n.parentNode.removeChild(n),i.parentNode.removeChild(i),document.body.classList.remove("zoom-overlay-transitioning"))}var m=null,f=null,i=null,v=null,e=null,n=null,s=null;return function(o){return e=o,{zoomImage:c,close:w,dispose:a}}}();(function(){function c(){document.body.addEventListener("click",function(t){t.target.getAttribute("data-action")==="zoom"&&t.target.tagName==="IMG"&&l(t)})}function l(t){if(t.stopPropagation(),!document.body.classList.contains("zoom-overlay-open")){if(t.metaKey||t.ctrlKey)return u();r({forceDispose:!0}),n=k(t.target),n.zoomImage(),w()}}function u(){window.open(event.target.getAttribute("data-original")||event.target.currentSrc||event.target.src,"_blank")}function r(t){t=t||{forceDispose:!1},n&&(n[t.forceDispose?"dispose":"close"](),a(),n=null)}function w(){window.addEventListener("scroll",m),document.addEventListener("click",i),document.addEventListener("keyup",f),document.addEventListener("touchstart",v),document.addEventListener("touchend",i)}function a(){window.removeEventListener("scroll",m),document.removeEventListener("keyup",f),document.removeEventListener("click",i),document.removeEventListener("touchstart",v),document.removeEventListener("touchend",i)}function m(t){s===null&&(s=window.pageYOffset);var d=s-window.pageYOffset;Math.abs(d)>=40&&r()}function f(t){t.keyCode==27&&r()}function i(t){t.stopPropagation(),t.preventDefault(),r()}function v(t){o=t.touches[0].pageY,t.target.addEventListener("touchmove",e)}function e(t){Math.abs(t.touches[0].pageY-o)<=10||(r(),t.target.removeEventListener("touchmove",e))}var n=null,s=null,o=null;return{listen:c}})().listen()}();})();
