var e,t,s={4085(e,t,s){s.d(t,{R:()=>f,W:()=>I});var i=s(2900),n=s(9609),r=s(4781),o=s(608),a=s(93),c=s(4084),d=s(2927),m=s(8899),l=s(4955),h=s(5410),u=s(3051),p=function(e,t,s,i){var n,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,s,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(r<3?n(o):r>3?n(t,s,o):n(t,s))||o);return r>3&&o&&Object.defineProperty(t,s,o),o};const f="more-menu-item-";var I;!function(e){let t=class extends((0,o.T)((0,r.I)(d.LitElement))){constructor(){super(...arguments),this.justified=!1,this.direction="horizontal",this.items=[],this.itemsHash={},this.itemsIdxHash={}}getNormalizedItemId(e){return e.replace(f,"")}static get styles(){return[c.A,u.A]}get slotItem(){return this.menuSlotElement}linkMenuItems(){return e=this,t=void 0,i=function*(){const{items:e}=this;e.forEach((e,t)=>{const s=(0,a.O)("menu");e.setAttribute("id",s),e.setAttribute("aria-controls",s),e.selected=this.selected===t}),this.itemsHash=this.items.reduce((e,t)=>(e[t.id]=t,e),{}),this.itemsIdxHash=this.items.reduce((e,t,s)=>(e[t.id]=s,e),{})},new((s=void 0)||(s=Promise))(function(n,r){function o(e){try{c(i.next(e))}catch(e){r(e)}}function a(e){try{c(i.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof s?t:new s(function(e){e(t)})).then(o,a)}c((i=i.apply(e,t||[])).next())});var e,t,s,i}setupMenuItems(){if(this.menuSlotElement){const e=this.menuSlotElement.assignedElements({flatten:!0});this.getChildrenFromTree({children:e},this.items)}}getChildrenFromTree(e,t){e.children.forEach(e=>{e instanceof h.D.ELEMENT&&t.push(e),this.getChildrenFromTree({children:Array.from(e.children)},t)})}updateSelectedItem(e){const t=this.slotted.findIndex(e=>e.hasAttribute("selected"));t!==e&&(this.items&&[t,e].forEach(e=>{const t=this.items[e];null==t||t.toggleAttribute("selected")}),this.dispatchEvent(new CustomEvent("selected-menu-item",{detail:{value:e},composed:!0,bubbles:!0})),this.changeSelectedItemIdx(e))}changeSelectedItemIdx(e){this.selected=e}handleItemClick(e){const{id:t}=e.detail,s=this.itemsHash[this.getNormalizedItemId(t)];if(s&&!s.disabled){const e=this.itemsIdxHash[s.id];-1!==e&&this.updateSelectedItem(e)}}handleItemKeydown(e){const{key:t,id:s}=e.detail;switch(t){case i.Uz.End:this.changeSelectedItemIdx(this.items.length-1);break;case i.Uz.Home:this.changeSelectedItemIdx(0);break;case i.Uz.ArrowLeft:case i.Uz.ArrowUp:0===this.selected?this.changeSelectedItemIdx(this.items.length-1):this.changeSelectedItemIdx(this.selected-1);break;case i.Uz.ArrowRight:case i.Uz.ArrowDown:this.selected===this.items.length-1?this.changeSelectedItemIdx(0):this.changeSelectedItemIdx(this.selected+1);break;case i.Uz.Enter:case i.Uz.Space:const e=this.slotted.findIndex(e=>e.id===s&&!e.disabled);-1!==e&&this.updateSelectedItem(e)}}connectedCallback(){super.connectedCallback(),this.addEventListener("menu-item-click",this.handleItemClick),this.addEventListener("menu-item-keydown",this.handleItemKeydown)}disconnectedCallback(){super.connectedCallback(),this.removeEventListener("menu-item-click",this.handleItemClick),this.removeEventListener("menu-item-keydown",this.handleItemKeydown)}onSlotChange(){this.setupMenuItems(),this.linkMenuItems()}get menuClassMap(){return{[`md-menu--${this.direction}`]:this.direction,justified:this.justified}}render(){return d.html`
        <nav class="md-menu ${(0,l.classMap)(this.menuClassMap)}">
          <ul class="md-menu-list">
            <slot @slotchange=${this.onSlotChange}></slot>
          </ul>
        </nav>
      `}};p([(0,m.property)({type:Boolean})],t.prototype,"justified",void 0),p([(0,m.property)({type:String})],t.prototype,"direction",void 0),p([(0,m.query)("slot")],t.prototype,"menuSlotElement",void 0),p([(0,m.query)("md-menu-overlay")],t.prototype,"menuSubElement",void 0),t=p([(0,n.w)("md-menu")],t),e.ELEMENT=t}(I||(I={}))}},i={};function n(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}};return s[e](r,r.exports,n),r.exports}n.m=s,e=[],n.O=(t,s,i,r)=>{if(!s){var o=1/0;for(m=0;m<e.length;m++){for(var[s,i,r]=e[m],a=!0,c=0;c<s.length;c++)(!1&r||o>=r)&&Object.keys(n.O).every(e=>n.O[e](s[c]))?s.splice(c--,1):(a=!1,r<o&&(o=r));if(a){e.splice(m--,1);var d=i();void 0!==d&&(t=d)}}return t}r=r||0;for(var m=e.length;m>0&&e[m-1][2]>r;m--)e[m]=e[m-1];e[m]=[s,i,r]},n.d=(e,t)=>{for(var s in t)n.o(t,s)&&!n.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);export{n as __webpack_require__};t={1037:0},n.C=e=>{var s,i,{__webpack_esm_ids__:r,__webpack_esm_modules__:o,__webpack_esm_runtime__:a}=e,c=0;for(s in o)n.o(o,s)&&(n.m[s]=o[s]);for(a&&a(n);c<r.length;c++)i=r[c],n.o(t,i)&&t[i]&&t[i][0](),t[r[c]]=0;n.O()},n.O.j=e=>0===t[e];import*as r from"../9609.js";n.C(r);import*as o from"../4084.js";n.C(o);import*as a from"../4955.js";n.C(a);import*as c from"../3517.js";n.C(c);import*as d from"../519.js";n.C(d);import*as m from"../2927.js";n.C(m);import*as l from"../9983.js";n.C(l);import*as h from"../7162.js";n.C(h);import*as u from"../93.js";n.C(u);import*as p from"../5846.js";n.C(p);import*as f from"../5432.js";n.C(f);import*as I from"../9375.js";n.C(I);import*as v from"../5410.js";n.C(v);var g=n.O(void 0,[9609,4084,4955,3517,519,2927,9983,7162,93,5846,5432,9375,5410],()=>n(4085));const y=(g=n.O(g)).R,C=g.W;export{y as MORE_MENU_ITEM_COPY_ID_PREFIX,C as Menu};