(function(){function n(n,t,i){var r=document.createElement(n);return t&&(r.className=t),i!=null&&(r.textContent=i),r}function g(t){var i=n("i","fas "+t);return i.setAttribute("aria-hidden","true"),i}function e(n){return n.url?n.is_category_page?"/category"+n.url:n.url:null}function o(n){return n.children||[]}function y(t,i,r){var u=e(t),f=n(u?"a":r||"span",i,t.text);return u&&(f.href=u),f}function tt(){var n=w.offsetHeight;lt.style.height=n+"px";document.documentElement.style.setProperty("--lme-header-h",n+"px")}function at(t){var a=n("div","lme-mega"),s=n("div","lme-mega__inner"),i,h,r,u,f,c,l;return a.appendChild(s),i=n("div","lme-mega__head"),i.appendChild(n("span","lme-mega__title",t.text)),h=e(t),h&&(r=n("a","lme-mega__view-all","View all "+t.text),r.href=h,r.appendChild(g("fa-chevron-right")),i.appendChild(r)),s.appendChild(i),u=n("ul","lme-mega__cols"),f=[],o(t).forEach(function(t){var i,r;if(!o(t).length){f.push(t);return}i=n("li","lme-mega__group");i.appendChild(y(t,"lme-mega__heading","span"));r=n("ul","lme-mega__links");o(t).forEach(function(t){var i=n("li");i.appendChild(y(t,"lme-mega__link"));r.appendChild(i)});i.appendChild(r);u.appendChild(i)}),f.length&&(c=n("li","lme-mega__group lme-mega__group--plain"),l=n("ul","lme-mega__links"),f.forEach(function(t){var i=n("li");i.appendChild(y(t,"lme-mega__link lme-mega__link--strong"));l.appendChild(i)}),c.appendChild(l),u.appendChild(c)),s.appendChild(u),a}function st(n){(clearTimeout(d),i!==n)&&(i&&u(!0),i=n,ot=Date.now(),n.classList.add("is-open"),n.querySelector(".lme-nav__link").setAttribute("aria-expanded","true"),b.classList.add("is-visible"))}function u(n){if(clearTimeout(v),i){var t=i;i=null;t.classList.remove("is-open");t.querySelector(".lme-nav__link").setAttribute("aria-expanded","false");n!==!0&&b.classList.remove("is-visible")}}function vt(t){ft.innerHTML="";t.forEach(function(t){var e=o(t).length>0,r=n("li","lme-nav__item"),f;e?(f=n("button","lme-nav__link",t.text),f.type="button",f.setAttribute("aria-expanded","false"),f.appendChild(g("fa-chevron-down lme-nav__chevron")),r.appendChild(f),r.appendChild(at(t)),r.addEventListener("mouseenter",function(){clearTimeout(d);clearTimeout(v);v=setTimeout(function(){st(r)},i?0:ct)}),r.addEventListener("mouseleave",function(){clearTimeout(v);d=setTimeout(u,ut)}),f.addEventListener("click",function(){i===r&&Date.now()-ot>400?u():st(r)})):(f=y(t,"lme-nav__link"),r.appendChild(f),r.addEventListener("mouseenter",function(){clearTimeout(v);d=setTimeout(u,ut)}));ft.appendChild(r)})}function nt(n){k.setAttribute("aria-expanded",n?"true":"false");k.setAttribute("aria-label",n?"Close menu":"Menu");w.classList.toggle("is-drawer-open",n);document.body.classList.toggle("lme-drawer-lock",n);n?(l.hidden=!1,ht()):l.hidden=!0}function ht(){et.classList.remove("is-sub");a.scrollTop=0}function f(t,i,r,u){var f=n(i?"a":"button","lme-drawer__row"+(u?" "+u:""),t);return i?f.href=i:f.type="button",r&&f.appendChild(g(r+" lme-drawer__row-icon")),f}function yt(t){var i,u,r;s.innerHTML="";i=f("Back to main menu",null,null,"lme-drawer__back");i.insertBefore(g("fa-chevron-left lme-drawer__back-icon"),i.firstChild);i.addEventListener("click",function(){ht();var n=a.querySelector('[data-top="'+t.id+'"]');n&&n.focus()});s.appendChild(i);s.appendChild(n("div","lme-drawer__title",t.text));u=e(t);u&&s.appendChild(f("View all "+t.text,u,"fa-chevron-right","lme-drawer__view-all"));r=n("ul","lme-drawer__list");o(t).forEach(function(t){var u=n("li","lme-drawer__group"),l=o(t),s,i,c,h;if(!l.length){u.appendChild(f(t.text,e(t),e(t)?"fa-chevron-right":null));r.appendChild(u);return}s=f(t.text,null,"fa-chevron-down","lme-drawer__accordion");s.setAttribute("aria-expanded","false");i=n("ul","lme-drawer__leaves");i.hidden=!0;c=e(t);c&&(h=n("li"),h.appendChild(n("a","lme-drawer__leaf lme-drawer__leaf--all","All "+t.text)),h.firstChild.href=c,i.appendChild(h));l.forEach(function(t){var r=n("li");r.appendChild(y(t,"lme-drawer__leaf"));i.appendChild(r)});s.addEventListener("click",function(){var n=i.hidden;i.hidden=!n;s.setAttribute("aria-expanded",n?"true":"false");u.classList.toggle("is-open",n)});u.appendChild(s);u.appendChild(i);r.appendChild(u)});s.appendChild(r);et.classList.add("is-sub");s.scrollTop=0;i.focus({preventScroll:!0})}function pt(t){var i,u,h,c;a.innerHTML="";i=n("ul","lme-drawer__list");u=n("li");u.appendChild(f("Home",r?"/dlf-for-professionals/home":"/","fa-chevron-right"));i.appendChild(u);t.forEach(function(t){var u=n("li"),r;o(t).length?(r=f(t.text,null,"fa-chevron-right"),r.setAttribute("data-top",t.id),r.addEventListener("click",function(){yt(t)})):r=f(t.text,e(t),e(t)?"fa-chevron-right":null);u.appendChild(r);i.appendChild(u)});a.appendChild(i);var s=n("ul","lme-drawer__list lme-drawer__list--extras"),l=n("li"),v=f(r?"Living Made Easy":"DLF for Professionals",r?"/":"/dlf-for-professionals/home","fa-chevron-right","lme-drawer__pro");l.appendChild(v);s.appendChild(l);h=n("li");c=f("Search",null,"fa-search");c.addEventListener("click",function(){nt(!1);toggleSearchBox()});h.appendChild(c);s.appendChild(h);a.appendChild(s)}function p(n){var t=document.getElementById(n);return t?{node:t,src:t.getAttribute("src"),alt:t.getAttribute("alt"),href:t.getAttribute("href"),text:t.textContent}:null}function c(n,t,i){n&&n.node.setAttribute(t,i)}function wt(){w.classList.toggle("lme-header--pro",r);c(t.logo,"src",r?rt+"dlf-colour.svg":t.logo&&t.logo.src);c(t.logo,"alt",r?"DLF for Professionals":t.logo&&t.logo.alt);c(t.logoLink,"href",r?"/dlf-for-professionals/home":t.logoLink&&t.logoLink.href);c(t.proLink,"href",r?"/":t.proLink&&t.proLink.href);c(t.proImg,"src",r?rt+"lme-logo.svg":t.proImg&&t.proImg.src);c(t.proImg,"alt",r?"Living Made Easy":t.proImg&&t.proImg.alt);t.proLabel&&(t.proLabel.node.textContent=r?"Back to":t.proLabel.text)}var rt="https://livingmadeeasy.blob.core.windows.net/dlf-live/lme/",ct=120,ut=200,w=document.getElementById("lme-header"),ft=document.getElementById("lme-nav-list"),b=document.getElementById("lme-nav-overlay"),lt=document.getElementById("lme-header-spacer"),k=document.getElementById("lme-burger"),l=document.getElementById("lme-drawer"),et=document.getElementById("lme-drawer-track"),a=document.getElementById("lme-drawer-main"),s=document.getElementById("lme-drawer-sub"),r=!1,i=null,v=null,d=null,ot=0,h,it,t;window.ResizeObserver?new ResizeObserver(tt).observe(w):window.addEventListener("resize",tt);b.addEventListener("mouseenter",function(){u()});b.addEventListener("click",function(){u()});document.addEventListener("click",function(n){i&&!i.contains(n.target)&&u()});document.addEventListener("focusin",function(n){i&&!i.contains(n.target)&&u()});k.addEventListener("click",function(){nt(l.hidden)});window.addEventListener("keydown",function(n){if(n.key==="Escape")if(i){var t=i.querySelector(".lme-nav__link");u();t.focus()}else l.hidden||(nt(!1),k.focus())});h=window.matchMedia("(min-width: 1200px)");it=function(){h.matches&&!l.hidden&&nt(!1);h.matches||u()};h.addEventListener?h.addEventListener("change",it):h.addListener(it);t={logo:p("lme-logo"),logoLink:p("lme-logo-link"),proLink:p("pro-menu-container"),proImg:p("lme-pro-img"),proLabel:p("lme-pro-label")};window.buildMenu=function(n){var t=n||[];u();r=!!(t.length&&t[0].pro);wt();vt(t);pt(t);tt()};window.toggleSearchBox=function(n){(!n||n.target.classList.contains("sb-back"))&&(document.body.classList.toggle("search-active"),document.body.classList.contains("search-active")&&document.querySelector(".sb-container input").focus())};buildMenu(typeof menu!="undefined"?menu:[])})()