/*!
 * EdGEL: The University of Edinburgh Design System v5.0.0 (https://design-system.ed.ac.uk/)
 * Copyright 2014-2023 The University of Edinburgh
 *
 * Bootstrap  v5.3.2 (https://getbootstrap.com/)
 * Copyright 2011-2023 The Bootstrap Authors
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
 */
import{x as e,c as n}from"./base-2Isyko0t.js";import{o as r}from"./if-defined-66voXlkv.js";import{E as s}from"./menu-7_PRmfGT.js";import"./collapse-zYCjoaZf.js";import"./collapse-Fp-mMCqS.js";import"./selector-engine-FWBG9T7Z.js";import"./edgel-icon.js";let t,i,l,d=e=>e;n("edgel-menu-full",class extends s{_validateMenu(){if(!this.menu.tree)throw new Error("No tree supplied in the menu object.");if(!this.menu.tree.text||!this.menu.tree.url)throw new Error("Invalid tree supplied in the menu object.");return super._validateMenu()}_processMenu(){this._current=this.menu.breadcrumb.at(-1)}_renderMenu(){return this._nestedList([this.menu.tree])}_nestedList(n,s=0){if(s>2)throw new Error("Trees more than three levels deep (including root) are not currently supported in the design");const o=s>1,u=1===s;let a="";for(const r of n)r._active=r.url===this._current.url,r._joint=!1,r._renderedChildren=e(t||(t=d``)),r.children&&r.children.length?(r._collapsed=-1===this.menu.breadcrumb.findIndex((e=>e.url===r.url)),r._expanded=!r._collapsed,r._expanded&&(r._renderedChildren=this._nestedList(r.children,s+1)),(r._active||-1!==r.children.findIndex((e=>e._active&&(!e.children||!e.children.length))))&&(r._joint=!0)):(r._collapsed=!1,r._expanded=!1);for(const r of n)r._classes=[],0===s?r._classes.push("uoe-nav-link-root"):r._joint?r._classes.push("uoe-nav-link-joint"):o?r._classes.push("uoe-nav-link-leaf"):u&&r._classes.push("uoe-nav-link-child"),r._collapsed?r._classes.push("uoe-nav-link-collapsed"):r._expanded&&r._classes.push("uoe-nav-link-expanded"),a=e(i||(i=d`
        ${0}
        <li>
          ${0}
          ${0}
        </li>
      `),a,this._itemLink(r),r._renderedChildren);return e(l||(l=d`<ul id=${0}>${0}</ul>`),r(s?void 0:this.controls),a)}});
