1"use strict";/*! 2 * @project Electricity Authority 3 * @name mobile-nav.3f3d952836d0cecbbf93.js 4 * @author Octave 5 * @copyright Copyright (c) 2026 Electricity Authority 6 * 7 */(self.webpackChunkelectricity_authority=self.webpackChunkelectricity_authority||[]).push([[481],{8989:function(p,d,o){o.r(d),o.d(d,{default:function(){return b}});var u=o(3767);const v=5,l=(s,e=document)=>e.querySelector(s),r=(s,e=document)=>[...e.querySelectorAll(s)];function f(s){const e=s.length+1,a=v-1;return e>=a?a:e===2&&s[0]===""?1:e}function c(s,e){const a=["nav-panel",String(s)];return e&&a.push(e.slice(0,s-1).join("-")),a.join("-")}function h(s,e){if(s===1)return c(s);const a=c(s,e);return l(`#${a}`)?a:h(s-1,e)}class b{constructor(e){this.state={open:!1,activePanelClass:"",defaultPanel:"",defaultMenuId:"",isToggling:!1,initialHeaderTop:null,savedScrollPosition:null},this.bindNavButtonEvents=()=>{this.forwardButtons.forEach(t=>{t.addEventListener("click",this.handleForwardClick)}),this.backButtons.forEach(t=>{t.addEventListener("click",this.handleBackClick)})},this.unBindNavButtonEvents=()=>{this.forwardButtons.forEach(t=>{t.removeEventListener("click",this.handleForwardClick)}),this.backButtons.forEach(t=>{t.removeEventListener("click",this.handleBackClick)})},this.track=t=>{window.GA&&window.GA.track(`${t} menu`,"Mobile navigation","Click")},this.log=(...t)=>{},this.saveScrollPosition=()=>{this.state.savedScrollPosition={x:window.scrollX||document.documentElement.scrollLeft||document.body.scrollLeft||0,y:window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0}},this.restoreScrollPosition=()=>{this.state.savedScrollPosition&&(window.scrollTo(this.state.savedScrollPosition.x,this.state.savedScrollPosition.y),this.state.savedScrollPosition=null)},this.toggleMenu=t=>{t.preventDefault(),t.stopPropagation(),!this.state.isToggling&&(this.state.isToggling=!0,this.track(this.state.open?"Close":"Open"),this.state.open?this.closeMenu():this.openMenu(),this.state.isToggling=!1)},this.setActivePanel=t=>{const{activePanelClass:i}=this.state;i&&this.containerEl.classList.remove(i);const n=`mobile-nav--panel-${t}-active`;this.containerEl.classList.add(n),this.state.activePanelClass=n},this.navigate=(t,i,n=!1)=>{this.navPanelItems.forEach(E=>E.style.display="none");let m=!1;if(i){const E=l(`#${i}`,this.menuEl);E.style.display="block",m=!0,setTimeout(()=>
7{const w=document.querySelector(`[data-panel="${t}"]`),g=document.querySelector(".has-transformed");g&&g.classList.remove("has-transformed"),w.classList.add("has-transformed")},250)}n&&!m&&(t=1),this.setActivePanel(t),this.headerNavEl&&this.state.open&&(this.headerNavEl.style.top="0")},this.handleForwardClick=t=>{t.preventDefault();const i=t.target.getAttribute("data-target-panel"),n=t.target.getAttribute("data-nav-target");this.navigate(i,n)},this.handleBackClick=t=>{t.preventDefault();const i=t.target.getAttribute("data-target-panel"),n=t.target.getAttribute("data-nav-back");this.navigate(i,n)},this.menuEl=e||l(".mobile-nav"),this.containerEl=l("html"),this.headerNavEl=l(".header-nav"),this.forwardButtons=r("[data-nav-target]",this.menuEl),this.backButtons=r("[data-nav-back]",this.menuEl),this.navPanelItems=r("[data-nav-panel-items]",this.menuEl),this.menuTriggers=r("[data-mobile-nav-toggle]"),this.menuTriggers.forEach(t=>{t.hasEventListenerAttached||(t.addEventListener("click",this.toggleMenu),t.addEventListener("touchstart",this.toggleMenu)),t.hasEventListenerAttached=!0}),this.findDefaultMenuState(),this.headerNavWatcher&&clearInterval(this.headerNavWatcher),this.headerNavWatcher=setInterval(()=>{this.state.open&&this.headerNavEl&&window.getComputedStyle(this.headerNavEl).top!=="0px"&&(this.headerNavEl.style.top="0")},50);let a=window.innerWidth;(0,u.Z)(()=>{window.innerWidth!==a&&(this.closeMenu(),a=window.innerWidth)})}findDefaultMenuState(){const a=decodeURIComponent(window.location.pathname).replace(/^\//,"").replace(/\/\s*$/,"").split("/");let t=f(a);const i=h(t,a),n=i.replace(/^\D+/g,"");t.toString()!==n&&(t=parseInt(n,10)),this.state.defaultPanel=`${t}`,this.state.defaultMenuId=i}setDefaultMenuState(){const{defaultPanel:e,defaultMenuId:a}=this.state;this.navigate(e,a,!0),this.headerNavEl&&this.state.open&&(this.headerNavEl.style.top="0")}openMenu(){window.requestAnimationFrame(()=>{if(this.menuEl.removeAttribute("hidden"),this.menuEl.removeAttribute("inert"),this.menuEl.setAttribute("aria-hidden","false"),this.saveScrollPosition(),this.headerNavEl){const e=window.getComputedStyle(this.headerNavEl);this.state.initialHeaderTop=e.top,this.headerNavEl.style.top="0"}this.setDefaultMenuState(),this.containerEl.classList.add("mobile-nav--visible"),this.containerEl.classList.add("-header-reversed","-header-over-banner"),this.containerEl.classList.remove("mobile-nav--hidden"),this.headerNavEl&&(this.headerNavEl.style.top="0"),this.bindNavButtonEvents(),this.state.open=!0,this.headerNavEl&&(this.headerNavEl.style.top="0")})}closeMenu(){window.requestAnimationFrame(()=>{this.menuEl.setAttribute("aria-hidden","true"),this.menuEl.setAttribute("inert",""),this.containerEl.classList.remove("mobile-nav--visible"),this.containerEl.classList.remove("theme--blue-dark","-header-reversed","-header-over-banner"),this.containerEl.classList.add("mobile-nav--hidden"),this.headerNavEl&&this.state.initialHeaderTop!==null&&(this.headerNavEl.style.top=this.state.initialHeaderTop,this.state.initialHeaderTop=null),this.unBindNavButtonEvents(),this.state.open=!1,this.restoreScrollPosition(),setTimeout(()=>{this.state.open===!1&&(this.menuEl.setAttribute("hidden",""),this.state.activePanelClass&&this.containerEl.classList.remove(this.state.activePanelClass),this.state.activePanelClass="")},200)}),this.headerNavWatcher&&(clearInterval(this.headerNavWatcher),this.headerNavWatcher=null)}}},3767:function(p,d,o){o.d(d,{Z:function(){return c}});var u=o(4529),v=o.n(u);const l=[];let r=!1;function f(){l.forEach(h=>h())}function c(h){l.push(h),r||(window.addEventListener("resize",v()(f,200)),r=!0)}}}]); 8 9//# sourceMappingURL=mobile-nav.3f3d952836d0cecbbf93.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.