(()=>{var a=class{constructor(e){this.isVisible=!1;this.lastHeight=0;this.lastOffset=0;this.wasSticky=!1;this.maxWidth=1023;this.element=e,this.initObservers(),this.updateOffsets(),this.addEventListeners()}initObservers(){this.resizeObserver=new ResizeObserver(()=>{this.updateHeight(),this.updateOffsets()}),this.resizeObserver.observe(this.element),this.intersectionObserver=new IntersectionObserver(e=>{e.forEach(t=>{t.target===this.element&&(this.isVisible=t.isIntersecting,this.updateHeight())})}),this.intersectionObserver.observe(this.element)}addEventListeners(){let e=this.updateOffsets.bind(this);window.addEventListener("scroll",e,{passive:!0}),window.addEventListener("resize",e,{passive:!0}),window.addEventListener("orientationchange",e,{passive:!0})}updateOffsets(){if(window.innerWidth>this.maxWidth){this.setOffset(0);return}let e=window.scrollY||window.pageYOffset,t=this.element.offsetTop;e>=t?this.wasSticky||(this.setOffset(0),this.wasSticky=!0):(this.wasSticky&&(this.calculateOffset(),this.wasSticky=!1),e>0&&this.noElementsAbove()&&this.setOffset(0)),this.wasSticky||this.calculateOffset()}calculateOffset(){if(window.innerWidth>this.maxWidth)return;let e=0;if(document.querySelectorAll("body > *:not(header)").forEach(s=>{let i=s.offsetTop+s.offsetHeight,o=this.element.offsetTop;i<=o&&(e+=s.offsetHeight)}),e===0)this.setOffset(0);else{let s=window.innerHeight,i=e/s*100;this.setOffset(Math.round(i*100)/100)}}noElementsAbove(){let e=document.querySelectorAll("body > *:not(header)"),t=this.element.offsetTop;return Array.from(e).every(s=>s.offsetTop+s.offsetHeight>t)}setOffset(e){this.element.style.setProperty("--o3-header-offset",`${e}svh`),this.lastOffset=e}updateHeight(){let e=this.isVisible?this.element.offsetHeight:0;if(e!==this.lastHeight){let t=e;this.element.classList.contains("o3-header--fixed")&&this.element.querySelector(".o3-subnav__item")&&window.innerWidth>this.maxWidth&&(t-=50),document.body.style.setProperty("--o3-header-height",`${t}px`),this.lastHeight=e}}};var d=class{constructor(e){this.timeout=null;this.paused=!1;this.stopped=!1;this.state="top";this.lastScrollTop=0;this.lastDirChangeTime=Date.now();this.options={minScroll:50,upMinDuration:150,downMinDuration:150,upMinScroll:0,downMinScroll:0,upTimeoutDuration:5e3,downTimeoutDuration:!1,topClass:{"o3-header--sticky":!1,"o3-header--fixed":!1,"o3-header--hidden":!1},upClass:{"o3-header--fixed":!0,"o3-header--small":!1,"o3-header--hidden":!1},downClass:{"o3-header--fixed":!1,"o3-header--hidden":!0},permaClasses:["o3-header--perma"],constClasses:{"o3-header--fixed":!0},protectorClasses:{"o3-header--fixed":"o3-header--opened"}};this.element=e,this.menuHeight=this.element.offsetHeight,this.setTop(),this.attachEventListeners()}attachEventListeners(){["mouseover","mouseout","click"].forEach(e=>this.element.addEventListener(e,this.handleEvent.bind(this))),window.addEventListener("scroll",this.handleScroll.bind(this))}handleEvent(e){switch(e.type){case"mouseover":this.pause();break;case"mouseout":this.resume();break;case"click":window.innerWidth<1024?this.resume():this.postpone();break}}handleScroll(){let e=window.pageYOffset||document.documentElement.scrollTop,t=e>this.lastScrollTop?"down":"up",s=this.element.getBoundingClientRect().top;t!==(this.lastScrollTop>e?"up":"down")&&(this.lastDirChangeTime=Date.now()),s>0?(this.setTop(),this.element.style.boxShadow=""):(this.element.style.boxShadow="0px 2px 20px 0px rgba(0, 80, 255, 0.17)",this.checkScroll({pos:e,dir:t,t:Date.now(),lastDirChange:this.lastDirChangeTime})),this.lastScrollTop=e<=0?0:e}updateClass(e){Object.keys(e).forEach(t=>{if(!e.hasOwnProperty(t))return;let s=this.options.protectorClasses[t];s&&this.element.classList.contains(s)||t==="o3-header--hidden"&&this.element.classList.contains("o3-header--searching")||t==="o3-header--hidden"&&this.element.classList.contains("o3-header--opened")||(e[t]?this.element.classList.add(t):this.element.classList.remove(t))})}setTop(){this.cancelTimeout(),this.state="top",this.updateClass(this.options.topClass),new a(this.element).updateHeight()}setUp(){this.cancelTimeout(),this.paused||this.stopped?this.updateClass({...this.filterClasses(this.options.upClass),...this.options.constClasses}):(this.state="up",this.updateClass(this.options.upClass),this.prepTimeout(this.options.upTimeoutDuration,this.setDown.bind(this)))}setDown(){this.cancelTimeout(),this.paused||this.stopped?this.updateClass({...this.filterClasses(this.options.downClass),...this.options.constClasses}):(this.state="down",this.updateClass(this.options.downClass),this.prepTimeout(this.options.downTimeoutDuration,this.setUp.bind(this)))}filterClasses(e){return this.options.permaClasses.reduce((t,s)=>(typeof e[s]<"u"&&(t[s]=e[s]),t),{})}prepTimeout(e,t){typeof e=="number"&&(this.cancelTimeout(),this.timeout=window.setTimeout(t,e))}cancelTimeout(){this.timeout&&(clearTimeout(this.timeout),this.timeout=null)}checkScroll(e){let{minScroll:t,upMinDuration:s,downMinDuration:i,upMinScroll:o,downMinScroll:n}=this.options,l=this.element.getBoundingClientRect().top+window.scrollY;e.pos<=t&&l<=t?(this.setTop(),this.element.style.boxShadow=""):e.dir==="up"&&e.t-e.lastDirChange>=s&&(this.stopped||e.pos>=o+this.menuHeight)?this.setUp():e.dir==="down"&&e.t-e.lastDirChange>=i&&(this.stopped||e.pos>=n+this.menuHeight)&&this.setDown()}pause(){!this.stopped&&!this.paused&&this.timeout&&(this.cancelTimeout(),this.paused=!0)}resume(){!this.stopped&&this.paused&&!this.timeout&&(this.paused=!1,this.prepTimeout(this.options.upTimeoutDuration,this.setDown.bind(this)))}postpone(){!this.stopped&&this.paused&&(this.cancelTimeout(),this.prepTimeout(this.options.upTimeoutDuration,this.setDown.bind(this)))}};var c=class{constructor(e){this.element=e,this.wrapElement=e.querySelectorAll(".js3-header__wrap"),this.searchElement=e.querySelectorAll(".o3-header__search"),this.element.querySelectorAll(".js3-header__toggle").forEach(o=>{o.addEventListener("click",this.toggleMenu.bind(this))}),this.element.querySelectorAll(".js3-header__toggle-search").forEach(o=>{o.addEventListener("click",this.toggleSearch.bind(this))}),new ResizeObserver(this.resize.bind(this)).observe(this.element)}allowScroll(e){e.stopPropagation()}preventScroll(e){e.preventDefault()}toggleMenu(){let e=this.element.classList.contains("o3-header--opened"),t=document.body;e?(this.element.classList.remove("o3-header--opened"),this.wrapElement.forEach(s=>s.classList.remove("o3-header__wrap--wide")),window.innerWidth<=600&&(document.removeEventListener("wheel",this.preventScroll),document.removeEventListener("touchmove",this.preventScroll),this.element.removeEventListener("wheel",this.allowScroll),this.element.removeEventListener("touchmove",this.allowScroll),t.classList.remove("o3-header-no-scroll"))):(this.element.classList.add("o3-header--opened"),this.wrapElement.forEach(s=>s.classList.add("o3-header__wrap--wide")),window.innerWidth<=600&&(document.addEventListener("wheel",this.preventScroll,{passive:!1}),document.addEventListener("touchmove",this.preventScroll,{passive:!1}),this.element.addEventListener("wheel",this.allowScroll,{passive:!1}),this.element.addEventListener("touchmove",this.allowScroll,{passive:!1}),t.classList.add("o3-header-no-scroll")))}resize(){window.innerWidth>600&&document.body.classList.contains("o3-header-no-scroll")?(document.body.classList.remove("o3-header-no-scroll"),document.removeEventListener("wheel",this.preventScroll),document.removeEventListener("touchmove",this.preventScroll),this.element.removeEventListener("wheel",this.allowScroll),this.element.removeEventListener("touchmove",this.allowScroll)):window.innerWidth<=600&&!document.body.classList.contains("o3-header-no-scroll")&&this.element.classList.contains("o3-header--opened")&&(document.body.classList.add("o3-header-no-scroll"),document.addEventListener("wheel",this.preventScroll,{passive:!1}),document.addEventListener("touchmove",this.preventScroll,{passive:!1}),this.element.addEventListener("wheel",this.allowScroll,{passive:!1}),this.element.addEventListener("touchmove",this.allowScroll,{passive:!1}))}toggleSearch(){this.element.classList.contains("o3-header--opened")&&(this.element.classList.remove("o3-header--opened"),this.wrapElement.forEach(e=>e.classList.remove("o3-header__wrap--wide"))),this.element.classList.contains("o3-header--searching")?(this.element.classList.remove("o3-header--searching","o3-header--fixed"),document.body.classList.remove("o3-header-no-scroll"),this.searchElement.forEach(e=>e.classList.remove("o3-header__search--opened"))):(this.element.classList.add("o3-header--searching","o3-header--fixed"),document.body.classList.add("o3-header-no-scroll"),this.searchElement.forEach(e=>e.classList.add("o3-header__search--opened")),this.searchElement.forEach(e=>{let t=e.querySelector("input");t&&t.focus()}))}};var p=class{constructor(e){this.tooltip=e.querySelectorAll(".js3-header__tooltip"),this.tooltip.forEach(t=>{t.setAttribute("role","button"),t.setAttribute("aria-haspopup","true"),t.setAttribute("aria-expanded","false"),t.addEventListener("click",()=>{this.toggleTooltip(t)}),this.attachEventListeners(t)})}attachEventListeners(e){["resize","scroll","click","scroll","orientationchange"].forEach(t=>window.addEventListener(t,s=>this.handleEvent(s,e)))}handleEvent(e,t){let s=document.getElementById(t.getAttribute("aria-describedby")),i=s?.querySelector(".o3-header-tooltip__arrow");if(!(!s&&!i))switch(e.type){case"resize":case"orientationchange":this.updateTooltipPosition(t,s,i);break;case"click":!t.contains(e.target)&&!s.contains(e.target)&&this.fadeOutTooltip(s,()=>{this.removeTooltipContainer(),t.setAttribute("aria-expanded","false")});break;case"scroll":this.fadeOutTooltip(s,()=>{this.removeTooltipContainer(),t.setAttribute("aria-expanded","false")});break}}toggleTooltip(e){let t=document.querySelector(".o3-header-tooltip-box"),s;if(t)s=t.querySelector(".o3-header-tooltip__arrow");else{let i=e.querySelector(".o3-header-tooltip__content");if(!i)return;t=this.createTooltipContainer(i),s=this.createArrowElement(),t.appendChild(s),document.body.appendChild(t)}t.style.visibility==="visible"?this.fadeOutTooltip(t,()=>{this.removeTooltipContainer(),e.removeAttribute("aria-describedby"),e.setAttribute("aria-expanded","false")}):(this.updateTooltipPosition(e,t,s),t.style.zIndex="9999",this.fadeInTooltip(t),t.setAttribute("role","tooltip"),e.setAttribute("aria-expanded","true"),e.setAttribute("aria-describedby",t.id),this.setupFocusTrap(t,e))}fadeInTooltip(e){e.style.visibility="visible",e.style.opacity="0",e.style.transition="opacity 0.15s ease-in",requestAnimationFrame(()=>{e.style.opacity="1"})}fadeOutTooltip(e,t){e.style.transition="opacity 0.15s ease-out",e.style.opacity="0",e.addEventListener("transitionend",function s(){e.removeEventListener("transitionend",s),t()})}setupFocusTrap(e,t){let s=e.querySelectorAll('a, button, [tabindex]:not([tabindex="-1"])'),i=s[0],o=s[s.length-1];e.querySelector("a").focus(),o.addEventListener("keydown",n=>{n.key==="Tab"&&!n.shiftKey&&(n.preventDefault(),i.focus(),this.fadeOutTooltip(e,()=>{this.removeTooltipContainer(),t.setAttribute("aria-expanded","false")}))})}createTooltipContainer(e){let t=document.createElement("div");return t.id=`tooltip-${Math.random().toString(36).substr(2,9)}`,t.className="o3-header-tooltip-box",t.style.position="absolute",t.style.visibility="hidden",t.style.opacity="0",t.setAttribute("role","tooltip"),t.appendChild(e.cloneNode(!0)),t}removeTooltipContainer(){let e=document.querySelector(".o3-header-tooltip-box");e&&e.remove()}createArrowElement(){let e=document.createElement("div");return e.className="o3-header-tooltip__arrow",e.style.position="absolute",e.style.transform="translateX(-50%)",e}updateTooltipPosition(e,t,s){let i=e.getBoundingClientRect(),o=window.innerWidth,n=window.innerHeight,l=t.offsetWidth,m=i.left+i.width/2,f=i.bottom+window.scrollY+10,r=m-l/2+window.scrollX;r+l>o&&(r=o-l-50),r<0&&(r=10),t.style.top=`${f}px`,t.style.left=`${r}px`;let v=m-r;s.style.left=`${v}px`}};var u=class{constructor(){this.elements=document.querySelectorAll(".js3-header"),document.readyState==="complete"||document.readyState==="interactive"?this.initializeComponents():document.addEventListener("DOMContentLoaded",this.initializeComponents.bind(this))}initializeComponents(){this.elements.forEach(e=>{e.classList.contains("o3-header--eshop")||(new d(e),new a(e)),new c(e),new p(e)})}};new u;})();
