var NPC=NPC||{}; (function(document){var MenubarNavigation=function(domNode){var $jscomp$this=this;var linkURL,linkTitle;this.domNode=domNode;this.menuitems=[];this.popups=[];this.menuitemGroups={};this.menuOrientation={};this.isPopup={};this.isPopout={};this.openPopups=false;this.firstChars={};this.firstMenuitem={};this.lastMenuitem={};this.menubarHeader=document.getElementsByClassName("npc-mmenubar-header")[0];var buttonsPrevious=document.getElementsByClassName("button-prev");this.buttonPrevious=buttonsPrevious.length> 0?buttonsPrevious[0]:undefined;this.lastMenuitemMobile={};this.sizeScreen=window.innerWidth;this.switchMediaDesk=990;this.switchMediaMob=this.switchMediaDesk-1;this.N2Col1=989;this.N2Scope=".npc-mmenubar-navigation \x3e li \x3e button[aria-expanded\x3dtrue] + ul";this.firstItemSelectorN1=document.querySelector(".npc-mmenubar-navigation \x3e li \x3e button, .npc-mmenubar-navigation \x3e li \x3e a");NPC.FUNCTIONS=NPC.FUNCTIONS||{};NPC.FUNCTIONS.TRACKING=NPC.FUNCTIONS.TRACKING||{};NPC.NAVBAR=NPC.NAVBAR|| [];NPC.NAVBAR.push(this);this.initMenu(domNode,0);this.mmenu=document.querySelectorAll(".Header-lowerNav, .HeaderLogged-nav");var buttonCloseMob=document.getElementsByClassName("js-button-close-mob");if(buttonCloseMob.length>0)buttonCloseMob[0].addEventListener("click",this.onCloseClickMob.bind(this));var buttonCloseDesk=document.getElementsByClassName("js-button-close-desk");if(buttonCloseDesk.length>0)Array.from(buttonCloseDesk).forEach(function(button){button.addEventListener("click",$jscomp$this.onCloseClickDesk.bind($jscomp$this))}); var buttonOpen=document.getElementsByClassName("js-openMegaMenu");if(buttonOpen.length>0)buttonOpen[0].addEventListener("click",this.onOpenClick.bind(this));if(this.buttonPrevious)this.buttonPrevious.addEventListener("click",this.onPreviousClick.bind(this));window.addEventListener("resize",this.calcDisplayN2N3OnResize.bind(this));var buttonAncre=document.getElementsByClassName("js-button-ancre");if(buttonAncre.length>0)Array.from(buttonAncre).forEach(function(button){button.addEventListener("click", $jscomp$this.onOpenAncre.bind($jscomp$this))});this.parentMenuId=this.getMenuId(domNode);if(this.isdesktop())this.changeParentMenuOrientationToHorizontal();else this.changeParentMenuOrientationToVertical();window.addEventListener("click",this.onBackgroundPointerdown.bind(this),true);domNode.querySelector("[role\x3dmenuitem]").tabIndex=0;this.updateContent(linkURL,linkTitle,false)};MenubarNavigation.prototype.getParentMenuitem=function(menuitem){var node=menuitem.parentNode;if(node){node=node.parentNode; if(node){node=node.previousElementSibling;if(node)if(node.getAttribute("role")==="menuitem")return node}}return false};MenubarNavigation.prototype.getLastMenuItem=function(menuId){if(this.isdesktop())return this.lastMenuitem[menuId];else return this.lastMenuitemMobile[menuId]};MenubarNavigation.prototype.updateContent=function(linkURL,linkName,moveFocus){var $jscomp$this=this;var pathNode;if(typeof moveFocus!=="boolean")moveFocus=true;this.menuitems.forEach(function(item){item.removeAttribute("aria-current"); item.classList.remove("aria-current-path")});this.menuitems.forEach(function(item){if(item.href===linkURL){item.setAttribute("aria-current","page");pathNode=$jscomp$this.getParentMenuitem(item);while(pathNode){pathNode.classList.add("aria-current-path");pathNode.setAttribute("aria-current","true");pathNode=$jscomp$this.getParentMenuitem(pathNode)}}})};MenubarNavigation.prototype.getMenuitems=function(domNode,depth){var nodes=[];var initMenu=this.initMenu.bind(this);var popups=this.popups;function findMenuitems(node){var role, flag;while(node){flag=true;role=node.getAttribute("role");if(role)role=role.trim().toLowerCase();switch(role){case "menu":node.tabIndex=-1;initMenu(node,depth+1);flag=false;break;case "menuitem":if(node.getAttribute("aria-haspopup")==="true")popups.push(node);nodes.push(node);break;default:break}if(flag&&node.firstElementChild&&node.firstElementChild.tagName!=="svg")findMenuitems(node.firstElementChild);node=node.nextElementSibling}}findMenuitems(domNode.firstElementChild);return nodes};MenubarNavigation.prototype.initMenu= function(menu,depth){var menuitems,menuitem,role;var menuId=this.getMenuId(menu);menuitems=this.getMenuitems(menu,depth);this.menuOrientation[menuId]=this.getMenuOrientation(menu);this.isPopup[menuId]=menu.getAttribute("role")==="menu"&&depth===1;this.isPopout[menuId]=menu.getAttribute("role")==="menu"&&depth>1;this.menuitemGroups[menuId]=[];this.firstChars[menuId]=[];this.firstMenuitem[menuId]=null;this.lastMenuitem[menuId]=null;for(var i=0;i=this.menuitemGroups[menuId].length)start=0;index=this.getIndexFirstChars(menuId,start,char);if(index===-1)index=this.getIndexFirstChars(menuId,0,char);if(index>-1)this.setFocusToMenuitem(menuId,this.menuitemGroups[menuId][index])};MenubarNavigation.prototype.getIndexFirstChars=function(menuId,startIndex,char){for(var i=startIndex;i0)this.mmenu[0].style.display="none";this.toggleMainScroll()};MenubarNavigation.prototype.onOpenClick=function(){if(this.mmenu.length>0){LayerNav.close();this.mmenu[0].style.display="block";this.togglePreviousButton(false);if(this.firstItemSelectorN1)this.firstItemSelectorN1.focus()}this.toggleMainScroll()};MenubarNavigation.prototype.onOpenAncre=function(){if(!this.isdesktop())this.onCloseClickMob()}; MenubarNavigation.prototype.onPreviousClick=function(){var expandedItems=[];for(var i=0;i0){var openMenu=openMenuList[openMenuList.length-1];if(this.isdesktop())openMenu.parentNode.querySelector("ul").style.paddingTop="";else{var listElement=openMenu.parentNode.querySelectorAll("ul li");if(listElement.length>0){var titleHeight=listElement[0].getBoundingClientRect().height; var titleMarginBottom=window.getComputedStyle(listElement[0]).marginBottom;if(titleMarginBottom!==undefined)titleHeight+=parseInt(titleMarginBottom.replace("px",""));openMenu.parentNode.querySelector("ul").style.paddingTop=titleHeight+80+"px"}}}};MenubarNavigation.prototype.calcDisplayN2N3OnResize=function(){if(this.sizeScreen0)this.mmenu[0].style.display= ""}else if(this.sizeScreen>this.switchMediaMob&&!this.isdesktop()&&this.sizeScreen>window.innerWidth){this.changeParentMenuOrientationToVertical();if(document.querySelectorAll(".npc-mmenubar-navigation button[aria-expanded\x3dtrue]").length>0)if(this.mmenu.length>0){this.mmenu[0].style.display="block";$(window).trigger("close.layerNav")}}this.sizeScreen=window.innerWidth;if(this.isdesktop())this.calcDispalyN2N3();else{this.resetAllN2Top(false);this.resetAllWidth()}this.toggleMainScroll();this.setPaddingTopN2N3Mobile()}; MenubarNavigation.prototype.isdesktop=function(){return window.innerWidth>this.switchMediaMob};MenubarNavigation.prototype.changeParentMenuOrientationToHorizontal=function(){this.menuOrientation[this.parentMenuId]="horizontal"};MenubarNavigation.prototype.changeParentMenuOrientationToVertical=function(){this.menuOrientation[this.parentMenuId]="vertical"};MenubarNavigation.prototype.toggleMainScroll=function(){var openN1Size=document.querySelectorAll(".npc-mmenubar-navigation \x3e li \x3e button[aria-expanded\x3dtrue]").length; var N2=document.querySelector(this.N2Scope);var isMobileDisplay="";var main=document.getElementById("main");if(this.mmenu.length>0)isMobileDisplay=this.mmenu[0].style.display;if(openN1Size>0||isMobileDisplay!==""&&isMobileDisplay!=="none"){document.getElementsByTagName("html")[0].style.setProperty("overflow","hidden");if(main)main.style.setProperty("pointer-events","none");this.displayDeskElement(N2,true)}else{if(document.getElementsByTagName("html")[0].getAttribute("overflow-fixe")===null)document.getElementsByTagName("html")[0].style.setProperty("overflow", "");if(main)main.style.setProperty("pointer-events","");this.displayDeskElement(N2,false)}};MenubarNavigation.prototype.calcDispalyN2N3=function(){this.resetAllWidth();if(this.isdesktop()){var N2=document.querySelector(this.N2Scope);var N3=null;var verticalSeparator=0;var nodeList=[];var maximumWidthSizeN2=0;if(N2){N3=N2.querySelector("li \x3e button[aria-expanded\x3dtrue] + ul");var nodeList=N2.querySelectorAll(this.N2Scope+" \x3e li \x3e a, "+this.N2Scope+" \x3e li \x3e button, "+this.N2Scope+" \x3e li.mm-title-h4"); N2.style.paddingLeft=this.getOffesetMM()+"px";N2.querySelector(this.N2Scope+" \x3e li.js-mm-N2-width-size").style.width="calc( 100vw - "+this.getOffesetMM()+"px )";N2.querySelector(this.N2Scope+" \x3e li.mm-title-h4").style.minWidth=this.N2Col1-(this.getOffesetMM()+432+41)+"px";this.calcHeightStickyRight(N2);maximumWidthSizeN2=this.maximumWidthSizeN2(nodeList);verticalSeparator=this.setWidthSeparatorN2(maximumWidthSizeN2,N2)}else this.resetAllN2Top(false);if(N3){var N2FullSize=verticalSeparator;var spaceAllow= window.innerWidth-N2FullSize;var N3Size=N3.getBoundingClientRect().width;var sizeMinN2=566;var sizeMinN2Element=326;var leftN3Value=this.getOffesetMM()+maximumWidthSizeN2+40+1;if(N3Size>spaceAllow)if(N2FullSize>sizeMinN2){var wantedSize=window.innerWidth-N3Size-this.getOffesetMM()-40;if(wantedSize>sizeMinN2Element){this.resetMaxWidthN2Element(nodeList,wantedSize);verticalSeparator=this.setWidthSeparatorN2(wantedSize,N2);N3.style.left=verticalSeparator+"px"}else{this.resetMaxWidthN2Element(nodeList, sizeMinN2Element);verticalSeparator=this.setWidthSeparatorN2(sizeMinN2Element,N2);N3.style.width=window.innerWidth-verticalSeparator+"px";N3.style.left=verticalSeparator+"px"}}else{N3.style.left=leftN3Value+"px";N3.style.width=spaceAllow+"px"}else N3.style.left=leftN3Value+"px";N3.querySelector(".npc-mmenubar-close-desk").style.left="calc( 100vw - "+leftN3Value+"px - 66px)";this.calcHeightN2N3(N2,N3)}if(N2){this.setHeaderSpace(N2);this.displayDeskElement(N2,true)}}};MenubarNavigation.prototype.resetScrollN2= function(){if(this.isdesktop())if(document.querySelector('.npc-mmenubar-navigation *[role\x3d"menuitem"][aria-expanded\x3d"true"]'))document.querySelector('.npc-mmenubar-navigation *[role\x3d"menuitem"][aria-expanded\x3d"true"]').parentNode.querySelector("ul").scrollTop=0};MenubarNavigation.prototype.resetAllN2Top=function(isOpen,topVal){topVal=topVal===undefined?0:topVal;var N2List=document.querySelectorAll(".npc-mmenubar-navigation \x3e li \x3e button + ul");N2List.forEach(function(N2){N2.style.top= isOpen?topVal+"px":"120px"})};MenubarNavigation.prototype.resetAllWidth=function(){var $jscomp$this=this;var N2ListScope=".npc-mmenubar-navigation \x3e li \x3e button + ul";var N2List=document.querySelectorAll(N2ListScope);N2List.forEach(function(N2){var N3=N2.querySelector("li \x3e button + ul");var nodeList=N2.querySelectorAll(N2ListScope+" \x3e li \x3e a, "+N2ListScope+" \x3e li \x3e button, "+N2ListScope+" \x3e li.mm-title-h4");nodeList.forEach(function(n){n.style.setProperty("max-width","")}); N2.style.setProperty("height","");if(N3){N3.style.setProperty("width","");N3.style.setProperty("left","");N3.style.setProperty("height","")}$jscomp$this.setWidthSeparatorN2(0,N2,N2ListScope);$jscomp$this.displayDeskElement(N2,false)})};MenubarNavigation.prototype.getOffesetMM=function(){var elementlogoHeader=document.querySelector(".Header .logo-header, .HeaderLogged .HeaderLogged-logo");return elementlogoHeader?elementlogoHeader.getBoundingClientRect().width:200};MenubarNavigation.prototype.displayDeskElement= function(N2,state){if(N2){var elementbackGround=N2.parentNode.querySelector(".npc-mmenubar-categorie-background");if(elementbackGround){elementbackGround.style.display=state?"block":"none";elementbackGround.style.visibility=state?"visible":"hidden"}}else{var elementbackGround=document.querySelectorAll(".npc-mmenubar-categorie-background");elementbackGround.forEach(function(e){e.style.display=state?"block":"none";e.style.visibility=state?"visible":"hidden"})}};MenubarNavigation.prototype.setHeaderSpace= function(N2){var elementHeader=document.querySelector(".js-Header");var elementAlert=document.querySelector(".bandeau_alertes .AlertBanner");var elementDeconexion=document.querySelector(".header .AlertBanner");var elementbackGround=N2.parentNode.querySelector(".npc-mmenubar-categorie-background");var heightHeader=elementHeader?elementHeader.getBoundingClientRect().height:120;var heightAlertInfo=elementAlert?elementAlert.getBoundingClientRect().height:0;var heightDeconexion=elementDeconexion?elementDeconexion.getBoundingClientRect().height: 0;var heightAlert=heightAlertInfo>heightDeconexion?heightAlertInfo:heightDeconexion;var headerSize=heightAlert+heightHeader;this.resetAllN2Top(true,headerSize);elementbackGround.style.top=headerSize+"px"};MenubarNavigation.prototype.calcHeightStickyRight=function(N2){var stickyRight=N2.querySelector(".mm-N2-stick-right");if(stickyRight){var stickyTopMargin=parseFloat(window.getComputedStyle(stickyRight)["marginTop"]);var stickyRightHeight=stickyRight.getBoundingClientRect().height+stickyTopMargin; if(stickyRightHeight>N2.getBoundingClientRect().height)N2.style.height=stickyRightHeight+1+"px";else N2.style.height=""}};MenubarNavigation.prototype.calcHeightN2N3=function(N2,N3){var n2Height=N2.scrollHeight;var n3Height=N3.scrollHeight;if(n2Height>n3Height)N3.style.height=n2Height+"px";else N2.style.height=n3Height+"px"};MenubarNavigation.prototype.maximumWidthSizeN2=function(nodeList){var maximumWidthSizeN2=0;nodeList.forEach(function(n){var nodeWidth=n.getBoundingClientRect().width;if(nodeWidth> maximumWidthSizeN2)maximumWidthSizeN2=nodeWidth});return maximumWidthSizeN2};MenubarNavigation.prototype.resetMaxWidthN2Element=function(nodeList,wantedSize){nodeList.forEach(function(n){n.style.setProperty("max-width",wantedSize+"px","important")})};MenubarNavigation.prototype.setWidthSeparatorN2=function(maximumWidthSizeN2,element){var separateurVertical=element.querySelector(this.N2Scope+" \x3e li[role\x3dseparator]:not([aria-orientation\x3dhorizontal])");var separateurHorizontal=element.querySelectorAll(this.N2Scope+ " \x3e li[role\x3dseparator]:not([aria-orientation\x3dvertical])");var possSeparateurVertical=this.getOffesetMM()+maximumWidthSizeN2+40;if(separateurVertical){separateurVertical.style.left=possSeparateurVertical+"px";separateurVertical.style.height=maximumWidthSizeN2===0?"0px":element.scrollHeight+"px"}if(separateurHorizontal)separateurHorizontal.forEach(function(s){return s.style.width=maximumWidthSizeN2+8+"px"});return possSeparateurVertical};MenubarNavigation.prototype.togglePreviousButton=function(display){if(this.buttonPrevious)this.buttonPrevious.style.display= display?"block":"none"};window.addEventListener("load",function(){var menubarNavs=document.querySelectorAll(".npc-mmenubar-navigation");for(var i=0;i