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