text: var a=3.5,c=2.5,v=class{constructor(i,r,t){this.mainHeader=i;this.mainNav=r;this.mainAside=t;this.handleDoubleClick=i=>{var t,e;i.target===((t=this.mainHeader)==null?void 0:t.lastElementChild)&&((e=window.getSelection())==null||e.removeAllRanges(),window.scrollTo({top:0,behavior:"smooth"}))};this.handleResize=()=>{let i=(r,t)=>document.documentElement.style.setProperty(r,t);i("--js-unit-header-height","0"),setTimeout(()=>{var t,e;let r=((e=(t=this.mainHeader)==null?void 0:t.getBoundingClientRect().height)!=null?e:0)/16;i("--js-unit-header-height",`${r}rem`),i("--js-sticky-header-height",`${a}rem`),i("--js-unit-header-top",`${(r-a)*-1}rem`)})};this.headerObserver=new IntersectionObserver(([e])=>{if(e.intersectionRatio<1)for(let s of document.querySelectorAll('[class^="go-Main-header"'))s.setAttribute("data-fixed","true");else{for(let s of document.querySelectorAll('[class^="go-Main-header"'))s.removeAttribute("data-fixed");this.handleResize()}},{threshold:1,rootMargin:`${c*16}px`}),this.navObserver=new IntersectionObserver(([e])=>{var s,n,h,l;e.intersectionRatio<1?((s=this.mainNav)==null||s.classList.add("go-Main-nav--fixed"),(n=this.mainNav)==null||n.setAttribute("data-fixed","true")):((h=this.mainNav)==null||h.classList.remove("go-Main-nav--fixed"),(l=this.mainNav)==null||l.removeAttribute("data-fixed"))},{threshold:1,rootMargin:`-${a*16+10}px`}),this.asideObserver=new IntersectionObserver(([e])=>{var s,n;e.intersectionRatio<1?(s=this.mainHeader)==null||s.setAttribute("data-raised","true"):(n=this.mainHeader)==null||n.removeAttribute("data-raised")},{threshold:1,rootMargin:`-${a*16+20}px 0px 0px 0px`}),this.init()}init(){var i,r,t;if(this.handleResize(),window.addEventListener("resize",this.handleResize),(i=this.mainHeader)==null||i.addEventListener("dblclick",this.handleDoubleClick),(r=this.mainHeader)==null?void 0:r.hasChildNodes()){let e=document.createElement("div");this.mainHeader.prepend(e),this.headerObserver.observe(e)}if((t=this.mainNav)==null?void 0:t.hasChildNodes()){let e=document.createElement("div");this.mainNav.prepend(e),this.navObserver.observe(e)}if(this.mainAside){let e=document.createElement("div");this.mainAside.prepend(e),this.asideObserver.observe(e)}}},d=o=>document.querySelector(o);new v(d(".js-mainHeader"),d(".js-mainNav"),d(".js-mainAside"));export{v as MainLayoutController};
  /**
   * @license
   * Copyright 2021 The Go Authors. All rights reserved.
   * Use of this source code is governed by a BSD-style
   * license that can be found in the LICENSE file.
   */
  //# sourceMappingURL=unit.js.map
  