!function(){"use strict";var t={n:function(e){var i=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(i,{a:i}),i},d:function(e,i){for(var n in i)t.o(i,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:i[n]})},o:function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}},e=window.ctEvents,i=t.n(e),n=window.ctFrontend;const o=function(t,e,i){return Math.max(t,Math.min(e,i))},r=function(t,e,i){return e[0]+(e[1]-e[0])/(t[1]-t[0])*(i-t[0])},a=function(t){const e=getComputedStyle(t);let i=getComputedStyle(t.firstElementChild);if("none"===e.display)return 0;let n=parseFloat(e.borderTopWidth)+parseFloat(e.borderBottomWidth)+parseFloat(i.borderTopWidth)+parseFloat(i.borderBottomWidth),o=parseFloat(e.getPropertyValue("--height"));if(t.querySelector('[data-items] > [data-id="logo"]')){const e=getComputedStyle(t.querySelector('[data-items] > [data-id="logo"]'));let i=parseFloat(e.height);if(i+=parseFloat(e.marginTop)+parseFloat(e.marginBottom),t.querySelector(".site-logo-container")){const e=getComputedStyle(t.querySelector(".site-logo-container"));let n=parseFloat(e.getPropertyValue("--logo-shrink-height")||0);n>0&&(i=i-n+parseFloat(e.getPropertyValue("--logo-max-height")||50))}i>o&&(o=i)}let r=['[data-items] > [data-id*="widget-area"]','[data-items] > [data-id*="content-block"]','[data-items] > [data-id*="text"]','[data-items] > [data-id*="menu"]'].reduce(function(e,i){if(t.querySelector(i)){const n=getComputedStyle(t.querySelector(i));let o=parseFloat(n.height);if(o>e)return o}return e},0);return r>o&&(o=r),o+n},s=function(t){if(t.blcInitialHeight)return t.blcInitialHeight;let e=t.firstElementChild;t.firstElementChild.firstElementChild&&(e=t.firstElementChild.firstElementChild);let i=e.getBoundingClientRect().height;return t.blcInitialHeight=i,i},c=function(t,e=!0){if(t.blcStickyHeight)return t.blcStickyHeight;let i=s(t),n=getComputedStyle(t),o=getComputedStyle(t.firstElementChild);if(t.closest('[data-sticky*="yes"]')){let r=parseFloat(n.borderTopWidth)+parseFloat(n.borderBottomWidth)+parseFloat(o.borderTopWidth)+parseFloat(o.borderBottomWidth);e||(r=0);let s=t.getBoundingClientRect().height-r;const c=a(t);if(!(t.querySelector(".site-logo-container")&&parseFloat(getComputedStyle(t.querySelector(".site-logo-container")).getPropertyValue("--logo-sticky-shrink")||1)<1)&&(Math.round(s)!==Math.round(i)||Math.round(i)>Math.round(c)))return t.blcStickyHeight=t.getBoundingClientRect().height,s}let r=100;t.dataset.row.includes("middle")&&(r=n.getPropertyValue("--sticky-shrink"));return r&&(i*=parseFloat(r)/100),i},l=function(t=function(){return 0}){const e=document.querySelector(".ct-floating-bar");e&&e.style.setProperty("--header-sticky-height-animated",t())};let d=null;const u=function({stickyContainer:t,startPosition:e}){[...t.querySelectorAll('[data-row*="middle"]')].map(function(t){if(!t.querySelector('[data-id="logo"] .site-logo-container'))return;const i=t.querySelector('[data-id="logo"] .site-logo-container');let{initialHeight:n,stickyShrink:a,rowInitialHeight:l,rowStickyHeight:u}=function({logo:t,row:e}){if(d)return d;let i=parseFloat(getComputedStyle(t).getPropertyValue("--logo-max-height")||50);const n=parseFloat(getComputedStyle(t).getPropertyValue("--logo-sticky-shrink").toString().replace(",",".")||1);let o=s(e),r=c(e);return d={initialHeight:i,stickyShrink:n,rowInitialHeight:o,rowStickyHeight:r},d}({logo:i,row:t});const y=n*a;1!==a&&i.style.setProperty("--logo-shrink-height",r([e,e+Math.abs(l===u?n-y:l-u)],[1,a],o(e,e+Math.abs(l===u?n-y:l-u),scrollY))*n+"px")})};let y=null;const f=function({stickyContainer:t,containerInitialHeight:e,startPosition:i}){t.querySelector('[data-row*="middle"]')&&[t.querySelector('[data-row*="middle"]')].map(function(t){let{rowInitialHeight:e,rowStickyHeight:n}=function({row:t}){if(y)return y;let e=s(t),i=c(t);return y={rowInitialHeight:e,rowStickyHeight:i},y}({row:t});if(e!==n){let a=n;a=r([i,i+Math.abs(e-n)],[e,n],o(i,i+Math.abs(e-n),scrollY)),t.style.setProperty("--shrink-height",`${Math.round(a)}px`)}})},h=function({stickyContainer:t}){const e=[...t.querySelectorAll("[data-row]")].reduce(function(t,e){return t+c(e,!1)},0);return{stickyContainerHeight:e,stickyContainerHeightAbsolute:e+parseFloat(getComputedStyle(t).top)}};let g=null;function m(t,e){const i=function(n){n.target===t&&(t.removeEventListener("transitionend",i),e())};t.addEventListener("transitionend",i)}const p=function(t,e="yes"){Array.from(t.querySelectorAll("[data-row][data-transparent-row]")).map(function(t){t.dataset.transparentRow=e})};let k=null,w={},S=null,C=null,b=!1;const x=function(){y=null,d=null,k=null,S=null,C=null,v=null,b=!1};if(i().on("blocksy:sticky:compute",function(){setTimeout(function(){x(),A()},100)}),window.wp&&wp.customize&&wp.customize.selectiveRefresh){let t=!1;wp.customize.selectiveRefresh.bind("partial-content-rendered",function(e){t||(t=!0,setTimeout(function(){x(),b=!0,A(),t=!1},500))})}const H=function(t){if(k)return k;-1===t.dataset.sticky.indexOf("shrink")&&t.dataset.sticky.indexOf("auto-hide");let e=t.closest("header").getBoundingClientRect().top+scrollY;if(e>0){let t=document.elementFromPoint(0,3);t&&function(t){for(var e=[];t&&t!==document;t=t.parentNode)e.push(t);return e}(t).map(function(t){return getComputedStyle(t).position}).indexOf("fixed")>-1&&(e-=t.getBoundingClientRect().height)}-1===t.dataset.sticky.indexOf("shrink")&&-1===t.dataset.sticky.indexOf("auto-hide")&&(e+=200);const i=t.parentNode,n=getComputedStyle(document.body);let o=parseFloat(n.getPropertyValue("--header-sticky-offset")||0);o+=parseFloat(n.getPropertyValue("--theme-frame-size"))||0;const r=function(t){return t.filter(function(t){return 0!==t.height}).reduce(function(t,e){return t.indexOf(0)>-1?[...t,0]:[...t,e.sticky?0:e.height]},[]).reduce(function(t,e){return t+e},0)}(Array.from(i.parentNode.children).filter(function(t){return t.dataset.row||t.classList.contains("ct-sticky-container")}).map(function(t){return t.classList.contains("ct-sticky-container")?{sticky:!0}:{height:t.getBoundingClientRect().height}}));let a=r+e;a=a>0?a-o:a;let s=!0;const c=document.querySelector(".woocommerce-store-notice");return c&&(s=!1,c.offsetHeight>0&&(s=!0)),s&&(k=a),a};let v=null;const A=function(){if(v===scrollY)return;const t=document.querySelector(`[data-device="${(0,n.getCurrentScreen)()}"] [data-sticky]`);if(!t)return;const e=(0,n.getCurrentScreen)({withTablet:!0});let i=w[e];const r=!i||b;i&&!b||(w[e]=[...t.querySelectorAll("[data-row]")].reduce(function(t,e){return t+a(e)},0),i=w[e]),r&&(b=!1,t.parentNode.style.height=`${i}px`);let s=H(t),d=S;if(null===d){d=t.closest("[data-device]").getBoundingClientRect().height,S=d}let y=C;const k=t.dataset.sticky.split(":").filter(function(t){return"yes"!==t&&"no"!==t&&"fixed"!==t});y||(y=[...t.querySelectorAll("[data-row]")].reduce(function(t,e){return t+c(e)},0),C=parseInt(y),l(function(){return-1===k.indexOf("auto-hide")?y>[...t.querySelectorAll("[data-row]")].reduce(function(t,e){return t+a(e)},0)?`${y}px`:`${[...t.querySelectorAll("[data-row]")].reduce(function(t,e){return t+c(e)},0)}px`:"0px"}));let x=s>0&&Math.abs(window.scrollY-s)<5||window.scrollY>s;k.indexOf("shrink")>-1&&(x=s>0?window.scrollY>=s:window.scrollY>0),setTimeout(function(){x&&-1===document.body.dataset.header.indexOf("shrink")&&(document.body.dataset.header=`${document.body.dataset.header}:shrink`),!x&&document.body.dataset.header.indexOf("shrink")>-1&&(document.body.dataset.header=document.body.dataset.header.replace(":shrink",""))},300);let A=scrollY;k.indexOf("shrink")>-1&&function({containerInitialHeight:t,stickyContainer:e,stickyContainerHeight:i,isSticky:n,startPosition:o,stickyComponents:r}){if(0===o&&0===window.scrollY&&(e.dataset.sticky=["fixed",...r].join(":")),n){if(r.indexOf("yes")>-1)return;-1===e.dataset.sticky.indexOf("yes")&&(p(e,"no"),e.dataset.sticky=["yes",...r].join(":")),u({stickyContainer:e,startPosition:o}),f({stickyContainer:e,containerInitialHeight:t,startPosition:o})}else Array.from(e.querySelectorAll("[data-row]")).map(function(t){return t.removeAttribute("style")}),Array.from(e.querySelectorAll('[data-row*="middle"] .site-logo-container')).map(function(t){return t.removeAttribute("style")}),p(e,"yes"),0===o&&window.scrollY<=0?e.dataset.sticky=["fixed",...r].join(":"):e.dataset.sticky=r.join(":")}({stickyContainer:t,stickyContainerHeight:y,containerInitialHeight:i,isSticky:x,startPosition:s,stickyComponents:k}),k.indexOf("auto-hide")>-1&&function(t){let{currentScrollY:e,stickyContainer:i,containerInitialHeight:n,headerInitialHeight:r,startPosition:a,isSticky:s,stickyComponents:c}=t;s&&e-t.prevScrollY===0&&l(function(){return"0px"}),s?-1===i.dataset.sticky.indexOf("yes")&&e>2*r+a&&(i.dataset.sticky=["yes",...c].join(":"),u({stickyContainer:i,startPosition:a}),f({stickyContainer:i,containerInitialHeight:n,startPosition:a}),p(i,"no"),document.body.removeAttribute("style")):(Array.from(i.querySelectorAll("[data-row]")).map(function(t){return t.removeAttribute("style")}),Array.from(i.querySelectorAll('[data-row*="middle"] .site-logo-container')).map(function(t){return t.removeAttribute("style")}),i.dataset.sticky=[...c].join(":"),p(i,"yes"),l(function(){return"0px"}),g=null),null===g&&(g=1e3);var d=g+t.prevScrollY-e;let y=0;if(e>2*r+a||i.dataset.sticky.indexOf("yes")>-1){if(e<=a)y=0;else if(e>t.prevScrollY){let{stickyContainerHeightAbsolute:t}=h({stickyContainer:i});y=Math.abs(d)>t?-t:d}else y=d>0?0:d;i.style.transform=`translateY(${y}px)`,g=y}else i.removeAttribute("style");i.dataset.sticky.indexOf("yes")>-1&&(e<=a||e>t.prevScrollY||(u({stickyContainer:i,startPosition:a}),f({stickyContainer:i,containerInitialHeight:n,startPosition:a}))),l(function(){const{stickyContainerHeight:t}=h({stickyContainer:i});let e=o(0,t-Math.abs(y),t);return-1===i.dataset.sticky.indexOf("yes")&&(e=0),`${e}px`})}({stickyContainer:t,isSticky:x,startPosition:s,stickyComponents:k,containerInitialHeight:i,stickyContainerHeight:y,headerInitialHeight:d,currentScrollY:A,prevScrollY:v}),(k.indexOf("slide")>-1||k.indexOf("fade")>-1)&&function({stickyContainer:t,isSticky:e,startPosition:i,stickyComponents:n}){e?(-1===t.dataset.sticky.indexOf("yes")&&(t.dataset.sticky=["yes-start",...n].join(":"),setTimeout(function(){t.dataset.sticky=t.dataset.sticky.replace("yes-start","yes-end"),m(t,function(){t.dataset.sticky=t.dataset.sticky.replace("yes-end","yes")})},1)),p(t,"no")):-1===t.dataset.sticky.indexOf("yes-hide")&&t.dataset.sticky.indexOf("yes:")>-1&&(Math.abs(window.scrollY-i)>10?(t.dataset.sticky=n.join(":"),setTimeout(function(){Array.from(t.querySelectorAll("[data-row]")).map(function(t){return t.removeAttribute("style")})},300),p(t,"yes")):(t.dataset.sticky=["yes-hide-start",...n].join(":"),requestAnimationFrame(function(){t.dataset.sticky=t.dataset.sticky.replace("yes-hide-start","yes-hide-end"),m(t,function(){t.dataset.sticky=n.join(":"),setTimeout(function(){Array.from(t.querySelectorAll("[data-row]")).map(function(t){return t.removeAttribute("style")})},300),p(t,"yes")})})))}({stickyContainer:t,isSticky:x,startPosition:s,stickyComponents:k}),v=A},q=function(){if(document.querySelector("header [data-sticky]")){var t=window.width;window.addEventListener("resize",function(e){window.width!==t&&(t=window.width,x(),A(e),i().trigger("ct:header:update"))},!1),window.addEventListener("orientationchange",function(t){x(),A(t),i().trigger("ct:header:update")}),window.addEventListener("scroll",A,!1),window.addEventListener("load",A,!1),A()}};document.body.className.indexOf("e-preview")>-1?setTimeout(function(){q()},500):q(),(0,n.registerDynamicChunk)("blocksy_sticky_header",{mount:function(t){}})}();