(()=>{const{GHOSTKIT:{events:t}}=window;let e=!1,o=!1,i="",a=!1,r=0,n=0;function c(){if(e&&o){const a=o.getBoundingClientRect();let c=0;c="vertical"===i?Math.max(0,Math.min(1,(n-a.top)/a.height)):Math.max(0,Math.min(1,(r-a.left)/a.width));const s=Math.round(1e4*c)/100;e.style.setProperty("--gkt-image-compare__position",`${s}%`),t.trigger(e,"move.imageCompare.gkt",{originalEvent:{clientX:r,clientY:n}})}}function s(t){e=t,o=t.querySelector(".ghostkit-image-compare-images"),i=t.classList.contains("ghostkit-image-compare-vertical")?"vertical":"horizontal"}function g(){c(),e.style.removeProperty("--gkt-image-compare__transition-duration"),e=!1,o=!1,a=!1}t.on(document,"mousedown touchstart",".ghostkit-image-compare:not(.ghostkit-image-compare-trigger-hover)",(t=>{t.targetTouches&&!t.target.classList.contains("ghostkit-image-compare-images-divider")||(t.targetTouches||t.preventDefault(),s(t.delegateTarget))})),t.on(document,"mouseover touchstart",".ghostkit-image-compare-trigger-hover",(t=>{e||t.targetTouches&&!t.target.classList.contains("ghostkit-image-compare-images-divider")||(t.targetTouches||t.preventDefault(),s(t.delegateTarget))})),t.on(document,"mouseout touchend",".ghostkit-image-compare-trigger-hover",(t=>{e&&(t.targetTouches||(r=t.clientX,n=t.clientY),g())})),t.on(document,"mouseup touchend",(t=>{e&&(t.targetTouches||(r=t.clientX,n=t.clientY),g())})),t.on(document,"mousemove touchmove",(t=>{e&&(t.targetTouches||t.preventDefault(),r=t.targetTouches?.[0].clientX||t.clientX,n=t.targetTouches?.[0].clientY||t.clientY,a||(e.style.setProperty("--gkt-image-compare__transition-duration","0s"),a=!0),c())})),window.addEventListener("touchstart",(function(t){e&&t.target.classList.contains("ghostkit-image-compare-images-divider")&&t.preventDefault()}),{passive:!1})})();