UNPKG

balm-ui

Version:

A modular and customizable UI library based on Material Design and Vue 3

1 lines 81.3 kB
!function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e(require("vue")):"function"===typeof define&&define.amd?define("UiMenu",["vue"],e):"object"===typeof exports?exports.UiMenu=e(require("vue")):t.UiMenu=e(t.Vue)}("undefined"!==typeof self?self:this,(function(t){return function(){"use strict";var e={744:function(t){var e=function(t){return function(t){return!!t&&"object"===typeof t}(t)&&!function(t){var e=Object.prototype.toString.call(t);return"[object RegExp]"===e||"[object Date]"===e||function(t){return t.$$typeof===n}(t)}(t)};var n="function"===typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function i(t,e){return!1!==e.clone&&e.isMergeableObject(t)?c((n=t,Array.isArray(n)?[]:{}),t,e):t;var n}function r(t,e,n){return t.concat(e).map((function(t){return i(t,n)}))}function o(t){return Object.keys(t).concat(function(t){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t).filter((function(e){return Object.propertyIsEnumerable.call(t,e)})):[]}(t))}function s(t,e){try{return e in t}catch(n){return!1}}function a(t,e,n){var r={};return n.isMergeableObject(t)&&o(t).forEach((function(e){r[e]=i(t[e],n)})),o(e).forEach((function(o){(function(t,e){return s(t,e)&&!(Object.hasOwnProperty.call(t,e)&&Object.propertyIsEnumerable.call(t,e))})(t,o)||(s(t,o)&&n.isMergeableObject(e[o])?r[o]=function(t,e){if(!e.customMerge)return c;var n=e.customMerge(t);return"function"===typeof n?n:c}(o,n)(t[o],e[o],n):r[o]=i(e[o],n))})),r}function c(t,n,o){(o=o||{}).arrayMerge=o.arrayMerge||r,o.isMergeableObject=o.isMergeableObject||e,o.cloneUnlessOtherwiseSpecified=i;var s=Array.isArray(n);return s===Array.isArray(t)?s?o.arrayMerge(t,n,o):a(t,n,o):i(n,o)}c.all=function(t,e){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce((function(t,n){return c(t,n,e)}),{})};var d=c;t.exports=d},262:function(t,e){e.A=(t,e)=>{const n=t.__vccOpts||t;for(const[i,r]of e)n[i]=r;return n}},154:function(e){e.exports=t}},n={};function i(t){var r=n[t];if(void 0!==r)return r.exports;var o=n[t]={exports:{}};return e[t](o,o.exports,i),o.exports}i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,{a:e}),e},i.d=function(t,e){for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};var r={};i.d(r,{default:function(){return ve}});var o=i(744),s=i.n(o);const a=/(?:^\[object\s(.*?)\]$)/;var c=t=>Object.prototype.toString.call(t).replace(a,"$1").toLowerCase();const d=t=>{let{componentProps:e,propName:n,props:i}=t,r=i[n];if("object"===c(r)){const t=e[n].default;e[n].default=()=>s()(t,r)}else Array.isArray(r)?e[n].default=()=>r:e[n].default=r},u=t=>{let{componentMixins:e,propName:n,props:i}=t;if(e.length){let t=e.length;for(;t--;)if(e[t].props&&void 0!==e[t].props[n]){d({componentProps:e[t].props,propName:n,props:i});break}}};var l=(t,e)=>{for(const n of Object.keys(e))t.props?void 0===t.props[n]?u({componentMixins:t.mixins,propName:n,props:e}):d({componentProps:t.props,propName:n,props:e}):u({componentMixins:t.mixins,propName:n,props:e})};var h=(t,e)=>{for(const n of Object.keys(e))if(/^Ui[A-Z]{1}[A-Za-z]+$/.test(n)){const i=t[n],r=e[n];l(i,r)}};var f=t=>{const e={install(e){h(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{});for(let n in t){const i=t[n];e.component(i.name,i)}}};return e},p=i(154);const m="UiMenuAnchor",I=["top left","top right","middle left","middle right","bottom left","bottom right"],E={name:m,customOptions:{name:m,ANCHOR_POSITIONS:I}};var y,T,S=Object.assign(E,{props:{position:{type:String,default:""},absolute:{type:Boolean,default:!1}},setup(t){const e=t,n=(0,p.computed)((()=>({"mdc-menu-surface--anchor":!0,"mdc-menu-surface--absolute":e.absolute}))),i=(0,p.computed)((()=>{let t="",n=e.position;if(n)if(I.includes(n)){let e=n.split(" ");t="middle"===e[0]?`top:50%;${e[1]}:0;transform:translateY(-50%);`:e.map((t=>`${t}:0`)).join(";")}else console.warn(`[${m}]: Invalid anchor position`);return t}));return(t,e)=>((0,p.openBlock)(),(0,p.createElementBlock)("div",{class:(0,p.normalizeClass)(n.value),style:(0,p.normalizeStyle)(i.value)},[(0,p.renderSlot)(t.$slots,"default")],6))}}),A={ANCHOR:"mdc-menu-surface--anchor",ANIMATING_CLOSED:"mdc-menu-surface--animating-closed",ANIMATING_OPEN:"mdc-menu-surface--animating-open",FIXED:"mdc-menu-surface--fixed",IS_OPEN_BELOW:"mdc-menu-surface--is-open-below",OPEN:"mdc-menu-surface--open",ROOT:"mdc-menu-surface"},C={CLOSED_EVENT:"MDCMenuSurface:closed",CLOSING_EVENT:"MDCMenuSurface:closing",OPENED_EVENT:"MDCMenuSurface:opened",OPENING_EVENT:"MDCMenuSurface:opening",FOCUSABLE_ELEMENTS:["button:not(:disabled)",'[href]:not([aria-disabled="true"])',"input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)",'[tabindex]:not([tabindex="-1"]):not([aria-disabled="true"])'].join(", ")},v={TRANSITION_OPEN_DURATION:120,TRANSITION_CLOSE_DURATION:75,MARGIN_TO_EDGE:32,ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO:.67,TOUCH_EVENT_WAIT_MS:30};!function(t){t[t.BOTTOM=1]="BOTTOM",t[t.CENTER=2]="CENTER",t[t.RIGHT=4]="RIGHT",t[t.FLIP_RTL=8]="FLIP_RTL"}(y||(y={})),function(t){t[t.TOP_LEFT=0]="TOP_LEFT",t[t.TOP_RIGHT=4]="TOP_RIGHT",t[t.BOTTOM_LEFT=1]="BOTTOM_LEFT",t[t.BOTTOM_RIGHT=5]="BOTTOM_RIGHT",t[t.TOP_START=8]="TOP_START",t[t.TOP_END=12]="TOP_END",t[t.BOTTOM_START=9]="BOTTOM_START",t[t.BOTTOM_END=13]="BOTTOM_END"}(T||(T={}));var g=function(t,e){return g=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},g(t,e)};function x(t,e){if("function"!==typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}g(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var b=function(){return b=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},b.apply(this,arguments)};Object.create;function _(t){var e="function"===typeof Symbol&&Symbol.iterator,n=e&&t[e],i=0;if(n)return n.call(t);if(t&&"number"===typeof t.length)return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function O(t,e){var n="function"===typeof Symbol&&t[Symbol.iterator];if(!n)return t;var i,r,o=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(i=o.next()).done;)s.push(i.value)}catch(a){r={error:a}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return s}function L(t,e,n){if(n||2===arguments.length)for(var i,r=0,o=e.length;r<o;r++)!i&&r in e||(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return t.concat(i||Array.prototype.slice.call(e))}Object.create;"function"===typeof SuppressedError&&SuppressedError;var D,M,N=function(){function t(t){void 0===t&&(t={}),this.adapter=t}return Object.defineProperty(t,"cssClasses",{get:function(){return{}},enumerable:!1,configurable:!0}),Object.defineProperty(t,"strings",{get:function(){return{}},enumerable:!1,configurable:!0}),Object.defineProperty(t,"numbers",{get:function(){return{}},enumerable:!1,configurable:!0}),Object.defineProperty(t,"defaultAdapter",{get:function(){return{}},enumerable:!1,configurable:!0}),t.prototype.init=function(){},t.prototype.destroy=function(){},t}(),R=function(){function t(t,e){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];this.root=t,this.initialize.apply(this,L([],O(n))),this.foundation=void 0===e?this.getDefaultFoundation():e,this.foundation.init(),this.initialSyncWithDOM()}return t.attachTo=function(e){return new t(e,new N({}))},t.prototype.initialize=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e]},t.prototype.getDefaultFoundation=function(){throw new Error("Subclasses must override getDefaultFoundation to return a properly configured foundation class")},t.prototype.initialSyncWithDOM=function(){},t.prototype.destroy=function(){this.foundation.destroy()},t.prototype.listen=function(t,e,n){this.root.addEventListener(t,e,n)},t.prototype.unlisten=function(t,e,n){this.root.removeEventListener(t,e,n)},t.prototype.emit=function(t,e,n){var i;void 0===n&&(n=!1),"function"===typeof CustomEvent?i=new CustomEvent(t,{bubbles:n,detail:e}):(i=document.createEvent("CustomEvent")).initCustomEvent(t,n,!1,e),this.root.dispatchEvent(i)},t}();function F(t,e){if(t.closest)return t.closest(e);for(var n=t;n;){if(w(n,e))return n;n=n.parentElement}return null}function w(t,e){return(t.matches||t.webkitMatchesSelector||t.msMatchesSelector).call(t,e)}var k={LIST_ITEM_ACTIVATED_CLASS:"mdc-list-item--activated",LIST_ITEM_CLASS:"mdc-list-item",LIST_ITEM_DISABLED_CLASS:"mdc-list-item--disabled",LIST_ITEM_SELECTED_CLASS:"mdc-list-item--selected",LIST_ITEM_TEXT_CLASS:"mdc-list-item__text",LIST_ITEM_PRIMARY_TEXT_CLASS:"mdc-list-item__primary-text",ROOT:"mdc-list"},B=((D={})[""+k.LIST_ITEM_ACTIVATED_CLASS]="mdc-list-item--activated",D[""+k.LIST_ITEM_CLASS]="mdc-list-item",D[""+k.LIST_ITEM_DISABLED_CLASS]="mdc-list-item--disabled",D[""+k.LIST_ITEM_SELECTED_CLASS]="mdc-list-item--selected",D[""+k.LIST_ITEM_PRIMARY_TEXT_CLASS]="mdc-list-item__primary-text",D[""+k.ROOT]="mdc-list",D),P=((M={})[""+k.LIST_ITEM_ACTIVATED_CLASS]="mdc-deprecated-list-item--activated",M[""+k.LIST_ITEM_CLASS]="mdc-deprecated-list-item",M[""+k.LIST_ITEM_DISABLED_CLASS]="mdc-deprecated-list-item--disabled",M[""+k.LIST_ITEM_SELECTED_CLASS]="mdc-deprecated-list-item--selected",M[""+k.LIST_ITEM_TEXT_CLASS]="mdc-deprecated-list-item__text",M[""+k.LIST_ITEM_PRIMARY_TEXT_CLASS]="mdc-deprecated-list-item__primary-text",M[""+k.ROOT]="mdc-deprecated-list",M),H={ACTION_EVENT:"MDCList:action",SELECTION_CHANGE_EVENT:"MDCList:selectionChange",ARIA_CHECKED:"aria-checked",ARIA_CHECKED_CHECKBOX_SELECTOR:'[role="checkbox"][aria-checked="true"]',ARIA_CHECKED_RADIO_SELECTOR:'[role="radio"][aria-checked="true"]',ARIA_CURRENT:"aria-current",ARIA_DISABLED:"aria-disabled",ARIA_ORIENTATION:"aria-orientation",ARIA_ORIENTATION_HORIZONTAL:"horizontal",ARIA_ROLE_CHECKBOX_SELECTOR:'[role="checkbox"]',ARIA_SELECTED:"aria-selected",ARIA_INTERACTIVE_ROLES_SELECTOR:'[role="listbox"], [role="menu"]',ARIA_MULTI_SELECTABLE_SELECTOR:'[aria-multiselectable="true"]',CHECKBOX_RADIO_SELECTOR:'input[type="checkbox"], input[type="radio"]',CHECKBOX_SELECTOR:'input[type="checkbox"]',CHILD_ELEMENTS_TO_TOGGLE_TABINDEX:"\n ."+k.LIST_ITEM_CLASS+" button:not(:disabled),\n ."+k.LIST_ITEM_CLASS+" a,\n ."+P[k.LIST_ITEM_CLASS]+" button:not(:disabled),\n ."+P[k.LIST_ITEM_CLASS]+" a\n ",DEPRECATED_SELECTOR:".mdc-deprecated-list",FOCUSABLE_CHILD_ELEMENTS:"\n ."+k.LIST_ITEM_CLASS+" button:not(:disabled),\n ."+k.LIST_ITEM_CLASS+" a,\n ."+k.LIST_ITEM_CLASS+' input[type="radio"]:not(:disabled),\n .'+k.LIST_ITEM_CLASS+' input[type="checkbox"]:not(:disabled),\n .'+P[k.LIST_ITEM_CLASS]+" button:not(:disabled),\n ."+P[k.LIST_ITEM_CLASS]+" a,\n ."+P[k.LIST_ITEM_CLASS]+' input[type="radio"]:not(:disabled),\n .'+P[k.LIST_ITEM_CLASS]+' input[type="checkbox"]:not(:disabled)\n ',RADIO_SELECTOR:'input[type="radio"]',SELECTED_ITEM_SELECTOR:'[aria-selected="true"], [aria-current="true"]'},U={UNSET_INDEX:-1,TYPEAHEAD_BUFFER_CLEAR_TIMEOUT_MS:300},V="Unknown",j="Backspace",G="Enter",z="Spacebar",X="PageUp",K="PageDown",q="End",$="Home",W="ArrowLeft",Y="ArrowUp",Q="ArrowRight",Z="ArrowDown",J="Delete",tt="Escape",et="Tab",nt=new Set;nt.add(j),nt.add(G),nt.add(z),nt.add(X),nt.add(K),nt.add(q),nt.add($),nt.add(W),nt.add(Y),nt.add(Q),nt.add(Z),nt.add(J),nt.add(tt),nt.add(et);var it=8,rt=13,ot=32,st=33,at=34,ct=35,dt=36,ut=37,lt=38,ht=39,ft=40,pt=46,mt=27,It=9,Et=new Map;Et.set(it,j),Et.set(rt,G),Et.set(ot,z),Et.set(st,X),Et.set(at,K),Et.set(ct,q),Et.set(dt,$),Et.set(ut,W),Et.set(lt,Y),Et.set(ht,Q),Et.set(ft,Z),Et.set(pt,J),Et.set(mt,tt),Et.set(It,et);var yt=new Set;function Tt(t){var e=t.key;if(nt.has(e))return e;var n=Et.get(t.keyCode);return n||V}yt.add(X),yt.add(K),yt.add(q),yt.add($),yt.add(W),yt.add(Y),yt.add(Q),yt.add(Z);var St=["input","button","textarea","select"],At=function(t){var e=t.target;if(e){var n=(""+e.tagName).toLowerCase();-1===St.indexOf(n)&&t.preventDefault()}};function Ct(t,e){var n,i=t.nextChar,r=t.focusItemAtIndex,o=t.sortedIndexByFirstChar,s=t.focusedItemIndex,a=t.skipFocus,c=t.isItemAtIndexDisabled;return clearTimeout(e.bufferClearTimeout),e.bufferClearTimeout=setTimeout((function(){gt(e)}),U.TYPEAHEAD_BUFFER_CLEAR_TIMEOUT_MS),e.typeaheadBuffer=e.typeaheadBuffer+i,n=1===e.typeaheadBuffer.length?function(t,e,n,i){var r=i.typeaheadBuffer[0],o=t.get(r);if(!o)return-1;if(r===i.currentFirstChar&&o[i.sortedIndexCursor].index===e){i.sortedIndexCursor=(i.sortedIndexCursor+1)%o.length;var s=o[i.sortedIndexCursor].index;if(!n(s))return s}i.currentFirstChar=r;var a,c=-1;for(a=0;a<o.length;a++)if(!n(o[a].index)){c=a;break}for(;a<o.length;a++)if(o[a].index>e&&!n(o[a].index)){c=a;break}if(-1!==c)return i.sortedIndexCursor=c,o[i.sortedIndexCursor].index;return-1}(o,s,c,e):function(t,e,n){var i=n.typeaheadBuffer[0],r=t.get(i);if(!r)return-1;var o=r[n.sortedIndexCursor];if(0===o.text.lastIndexOf(n.typeaheadBuffer,0)&&!e(o.index))return o.index;var s=(n.sortedIndexCursor+1)%r.length,a=-1;for(;s!==n.sortedIndexCursor;){var c=r[s],d=0===c.text.lastIndexOf(n.typeaheadBuffer,0),u=!e(c.index);if(d&&u){a=s;break}s=(s+1)%r.length}if(-1!==a)return n.sortedIndexCursor=a,r[n.sortedIndexCursor].index;return-1}(o,c,e),-1===n||a||r(n),n}function vt(t){return t.typeaheadBuffer.length>0}function gt(t){t.typeaheadBuffer=""}function xt(t,e){var n=t.event,i=t.isTargetListItem,r=t.focusedItemIndex,o=t.focusItemAtIndex,s=t.sortedIndexByFirstChar,a=t.isItemAtIndexDisabled,c="ArrowLeft"===Tt(n),d="ArrowUp"===Tt(n),u="ArrowRight"===Tt(n),l="ArrowDown"===Tt(n),h="Home"===Tt(n),f="End"===Tt(n),p="Enter"===Tt(n),m="Spacebar"===Tt(n);return n.altKey||n.ctrlKey||n.metaKey||c||d||u||l||h||f||p?-1:m||1!==n.key.length?m?(i&&At(n),i&&vt(e)?Ct({focusItemAtIndex:o,focusedItemIndex:r,nextChar:" ",sortedIndexByFirstChar:s,skipFocus:!1,isItemAtIndexDisabled:a},e):-1):-1:(At(n),Ct({focusItemAtIndex:o,focusedItemIndex:r,nextChar:n.key.toLowerCase(),sortedIndexByFirstChar:s,skipFocus:!1,isItemAtIndexDisabled:a},e))}var bt=["Alt","Control","Meta","Shift"];function _t(t){var e=new Set(t?bt.filter((function(e){return t.getModifierState(e)})):[]);return function(t){return t.every((function(t){return e.has(t)}))&&t.length===e.size}}var Ot=function(t){function e(n){var i=t.call(this,b(b({},e.defaultAdapter),n))||this;return i.wrapFocus=!1,i.isVertical=!0,i.isSingleSelectionList=!1,i.areDisabledItemsFocusable=!0,i.selectedIndex=U.UNSET_INDEX,i.focusedItemIndex=U.UNSET_INDEX,i.useActivatedClass=!1,i.useSelectedAttr=!1,i.ariaCurrentAttrValue=null,i.isCheckboxList=!1,i.isRadioList=!1,i.lastSelectedIndex=null,i.hasTypeahead=!1,i.typeaheadState={bufferClearTimeout:0,currentFirstChar:"",sortedIndexCursor:0,typeaheadBuffer:""},i.sortedIndexByFirstChar=new Map,i}return x(e,t),Object.defineProperty(e,"strings",{get:function(){return H},enumerable:!1,configurable:!0}),Object.defineProperty(e,"cssClasses",{get:function(){return k},enumerable:!1,configurable:!0}),Object.defineProperty(e,"numbers",{get:function(){return U},enumerable:!1,configurable:!0}),Object.defineProperty(e,"defaultAdapter",{get:function(){return{addClassForElementIndex:function(){},focusItemAtIndex:function(){},getAttributeForElementIndex:function(){return null},getFocusedElementIndex:function(){return 0},getListItemCount:function(){return 0},hasCheckboxAtIndex:function(){return!1},hasRadioAtIndex:function(){return!1},isCheckboxCheckedAtIndex:function(){return!1},isFocusInsideList:function(){return!1},isRootFocused:function(){return!1},listItemAtIndexHasClass:function(){return!1},notifyAction:function(){},notifySelectionChange:function(){},removeClassForElementIndex:function(){},setAttributeForElementIndex:function(){},setCheckedCheckboxOrRadioAtIndex:function(){},setTabIndexForListItemChildren:function(){},getPrimaryTextAtIndex:function(){return""}}},enumerable:!1,configurable:!0}),e.prototype.layout=function(){0!==this.adapter.getListItemCount()&&(this.adapter.hasCheckboxAtIndex(0)?this.isCheckboxList=!0:this.adapter.hasRadioAtIndex(0)?this.isRadioList=!0:this.maybeInitializeSingleSelection(),this.hasTypeahead&&(this.sortedIndexByFirstChar=this.typeaheadInitSortedIndex()))},e.prototype.getFocusedItemIndex=function(){return this.focusedItemIndex},e.prototype.setWrapFocus=function(t){this.wrapFocus=t},e.prototype.setVerticalOrientation=function(t){this.isVertical=t},e.prototype.setSingleSelection=function(t){this.isSingleSelectionList=t,t&&(this.maybeInitializeSingleSelection(),this.selectedIndex=this.getSelectedIndexFromDOM())},e.prototype.setDisabledItemsFocusable=function(t){this.areDisabledItemsFocusable=t},e.prototype.maybeInitializeSingleSelection=function(){var t=this.getSelectedIndexFromDOM();t!==U.UNSET_INDEX&&(this.adapter.listItemAtIndexHasClass(t,k.LIST_ITEM_ACTIVATED_CLASS)&&this.setUseActivatedClass(!0),this.isSingleSelectionList=!0,this.selectedIndex=t)},e.prototype.getSelectedIndexFromDOM=function(){for(var t=U.UNSET_INDEX,e=this.adapter.getListItemCount(),n=0;n<e;n++){var i=this.adapter.listItemAtIndexHasClass(n,k.LIST_ITEM_SELECTED_CLASS),r=this.adapter.listItemAtIndexHasClass(n,k.LIST_ITEM_ACTIVATED_CLASS);if(i||r){t=n;break}}return t},e.prototype.setHasTypeahead=function(t){this.hasTypeahead=t,t&&(this.sortedIndexByFirstChar=this.typeaheadInitSortedIndex())},e.prototype.isTypeaheadInProgress=function(){return this.hasTypeahead&&vt(this.typeaheadState)},e.prototype.setUseActivatedClass=function(t){this.useActivatedClass=t},e.prototype.setUseSelectedAttribute=function(t){this.useSelectedAttr=t},e.prototype.getSelectedIndex=function(){return this.selectedIndex},e.prototype.setSelectedIndex=function(t,e){void 0===e&&(e={}),this.isIndexValid(t)&&(this.isCheckboxList?this.setCheckboxAtIndex(t,e):this.isRadioList?this.setRadioAtIndex(t,e):this.setSingleSelectionAtIndex(t,e))},e.prototype.handleFocusIn=function(t){t>=0&&(this.focusedItemIndex=t,this.adapter.setAttributeForElementIndex(t,"tabindex","0"),this.adapter.setTabIndexForListItemChildren(t,"0"))},e.prototype.handleFocusOut=function(t){var e=this;t>=0&&(this.adapter.setAttributeForElementIndex(t,"tabindex","-1"),this.adapter.setTabIndexForListItemChildren(t,"-1")),setTimeout((function(){e.adapter.isFocusInsideList()||e.setTabindexToFirstSelectedOrFocusedItem()}),0)},e.prototype.isIndexDisabled=function(t){return this.adapter.listItemAtIndexHasClass(t,k.LIST_ITEM_DISABLED_CLASS)},e.prototype.handleKeydown=function(t,e,n){var i,r=this,o="ArrowLeft"===Tt(t),s="ArrowUp"===Tt(t),a="ArrowRight"===Tt(t),c="ArrowDown"===Tt(t),d="Home"===Tt(t),u="End"===Tt(t),l="Enter"===Tt(t),h="Spacebar"===Tt(t),f=this.isVertical&&c||!this.isVertical&&a,p=this.isVertical&&s||!this.isVertical&&o,m="A"===t.key||"a"===t.key,I=_t(t);if(this.adapter.isRootFocused()){if((p||u)&&I([]))t.preventDefault(),this.focusLastElement();else if((f||d)&&I([]))t.preventDefault(),this.focusFirstElement();else if(p&&I(["Shift"])&&this.isCheckboxList){t.preventDefault(),-1!==(y=this.focusLastElement())&&this.setSelectedIndexOnAction(y,!1)}else if(f&&I(["Shift"])&&this.isCheckboxList){t.preventDefault(),-1!==(y=this.focusFirstElement())&&this.setSelectedIndexOnAction(y,!1)}this.hasTypeahead&&xt({event:t,focusItemAtIndex:function(t){r.focusItemAtIndex(t)},focusedItemIndex:-1,isTargetListItem:e,sortedIndexByFirstChar:this.sortedIndexByFirstChar,isItemAtIndexDisabled:function(t){return r.isIndexDisabled(t)}},this.typeaheadState)}else{var E=this.adapter.getFocusedElementIndex();if(!(-1===E&&(E=n)<0)){if(f&&I([]))At(t),this.focusNextElement(E);else if(p&&I([]))At(t),this.focusPrevElement(E);else if(f&&I(["Shift"])&&this.isCheckboxList){At(t),-1!==(y=this.focusNextElement(E))&&this.setSelectedIndexOnAction(y,!1)}else if(p&&I(["Shift"])&&this.isCheckboxList){var y;At(t),-1!==(y=this.focusPrevElement(E))&&this.setSelectedIndexOnAction(y,!1)}else if(d&&I([]))At(t),this.focusFirstElement();else if(u&&I([]))At(t),this.focusLastElement();else if(d&&I(["Control","Shift"])&&this.isCheckboxList){if(At(t),this.isIndexDisabled(E))return;this.focusFirstElement(),this.toggleCheckboxRange(0,E,E)}else if(u&&I(["Control","Shift"])&&this.isCheckboxList){if(At(t),this.isIndexDisabled(E))return;this.focusLastElement(),this.toggleCheckboxRange(E,this.adapter.getListItemCount()-1,E)}else if(m&&I(["Control"])&&this.isCheckboxList)t.preventDefault(),this.checkboxListToggleAll(this.selectedIndex===U.UNSET_INDEX?[]:this.selectedIndex,!0);else if((l||h)&&I([])){if(e){if((T=t.target)&&"A"===T.tagName&&l)return;if(At(t),this.isIndexDisabled(E))return;this.isTypeaheadInProgress()||(this.isSelectableList()&&this.setSelectedIndexOnAction(E,!1),this.adapter.notifyAction(E))}}else if((l||h)&&I(["Shift"])&&this.isCheckboxList){var T;if((T=t.target)&&"A"===T.tagName&&l)return;if(At(t),this.isIndexDisabled(E))return;this.isTypeaheadInProgress()||(this.toggleCheckboxRange(null!==(i=this.lastSelectedIndex)&&void 0!==i?i:E,E,E),this.adapter.notifyAction(E))}if(this.hasTypeahead)xt({event:t,focusItemAtIndex:function(t){r.focusItemAtIndex(t)},focusedItemIndex:this.focusedItemIndex,isTargetListItem:e,sortedIndexByFirstChar:this.sortedIndexByFirstChar,isItemAtIndexDisabled:function(t){return r.isIndexDisabled(t)}},this.typeaheadState)}}},e.prototype.handleClick=function(t,e,n){var i,r=_t(n);t!==U.UNSET_INDEX&&(this.isIndexDisabled(t)||(r([])?(this.isSelectableList()&&this.setSelectedIndexOnAction(t,e),this.adapter.notifyAction(t)):this.isCheckboxList&&r(["Shift"])&&(this.toggleCheckboxRange(null!==(i=this.lastSelectedIndex)&&void 0!==i?i:t,t,t),this.adapter.notifyAction(t))))},e.prototype.focusNextElement=function(t){var e=this.adapter.getListItemCount(),n=t,i=null;do{if(++n>=e){if(!this.wrapFocus)return t;n=0}if(n===i)return-1;i=null!==i&&void 0!==i?i:n}while(!this.areDisabledItemsFocusable&&this.isIndexDisabled(n));return this.focusItemAtIndex(n),n},e.prototype.focusPrevElement=function(t){var e=this.adapter.getListItemCount(),n=t,i=null;do{if(--n<0){if(!this.wrapFocus)return t;n=e-1}if(n===i)return-1;i=null!==i&&void 0!==i?i:n}while(!this.areDisabledItemsFocusable&&this.isIndexDisabled(n));return this.focusItemAtIndex(n),n},e.prototype.focusFirstElement=function(){return this.focusNextElement(-1)},e.prototype.focusLastElement=function(){return this.focusPrevElement(this.adapter.getListItemCount())},e.prototype.focusInitialElement=function(){var t=this.getFirstSelectedOrFocusedItemIndex();return this.focusItemAtIndex(t),t},e.prototype.setEnabled=function(t,e){this.isIndexValid(t,!1)&&(e?(this.adapter.removeClassForElementIndex(t,k.LIST_ITEM_DISABLED_CLASS),this.adapter.setAttributeForElementIndex(t,H.ARIA_DISABLED,"false")):(this.adapter.addClassForElementIndex(t,k.LIST_ITEM_DISABLED_CLASS),this.adapter.setAttributeForElementIndex(t,H.ARIA_DISABLED,"true")))},e.prototype.setSingleSelectionAtIndex=function(t,e){if(void 0===e&&(e={}),this.selectedIndex!==t||e.forceUpdate){var n=k.LIST_ITEM_SELECTED_CLASS;this.useActivatedClass&&(n=k.LIST_ITEM_ACTIVATED_CLASS),this.selectedIndex!==U.UNSET_INDEX&&this.adapter.removeClassForElementIndex(this.selectedIndex,n),this.setAriaForSingleSelectionAtIndex(t),this.setTabindexAtIndex(t),t!==U.UNSET_INDEX&&this.adapter.addClassForElementIndex(t,n),this.selectedIndex=t,e.isUserInteraction&&!e.forceUpdate&&this.adapter.notifySelectionChange([t])}},e.prototype.setAriaForSingleSelectionAtIndex=function(t){this.selectedIndex===U.UNSET_INDEX&&(this.ariaCurrentAttrValue=this.adapter.getAttributeForElementIndex(t,H.ARIA_CURRENT));var e=null!==this.ariaCurrentAttrValue,n=e?H.ARIA_CURRENT:H.ARIA_SELECTED;if(this.selectedIndex!==U.UNSET_INDEX&&this.adapter.setAttributeForElementIndex(this.selectedIndex,n,"false"),t!==U.UNSET_INDEX){var i=e?this.ariaCurrentAttrValue:"true";this.adapter.setAttributeForElementIndex(t,n,i)}},e.prototype.getSelectionAttribute=function(){return this.useSelectedAttr?H.ARIA_SELECTED:H.ARIA_CHECKED},e.prototype.setRadioAtIndex=function(t,e){void 0===e&&(e={});var n=this.getSelectionAttribute();this.adapter.setCheckedCheckboxOrRadioAtIndex(t,!0),(this.selectedIndex!==t||e.forceUpdate)&&(this.selectedIndex!==U.UNSET_INDEX&&this.adapter.setAttributeForElementIndex(this.selectedIndex,n,"false"),this.adapter.setAttributeForElementIndex(t,n,"true"),this.selectedIndex=t,e.isUserInteraction&&!e.forceUpdate&&this.adapter.notifySelectionChange([t]))},e.prototype.setCheckboxAtIndex=function(t,e){void 0===e&&(e={});for(var n=this.selectedIndex,i=e.isUserInteraction?new Set(n===U.UNSET_INDEX?[]:n):null,r=this.getSelectionAttribute(),o=[],s=0;s<this.adapter.getListItemCount();s++){var a=null===i||void 0===i?void 0:i.has(s),c=t.indexOf(s)>=0;c!==a&&o.push(s),this.adapter.setCheckedCheckboxOrRadioAtIndex(s,c),this.adapter.setAttributeForElementIndex(s,r,c?"true":"false")}this.selectedIndex=t,e.isUserInteraction&&o.length&&this.adapter.notifySelectionChange(o)},e.prototype.toggleCheckboxRange=function(t,e,n){this.lastSelectedIndex=n;for(var i=new Set(this.selectedIndex===U.UNSET_INDEX?[]:this.selectedIndex),r=!(null===i||void 0===i?void 0:i.has(n)),o=O([t,e].sort(),2),s=o[0],a=o[1],c=this.getSelectionAttribute(),d=[],u=s;u<=a;u++){if(!this.isIndexDisabled(u))r!==i.has(u)&&(d.push(u),this.adapter.setCheckedCheckboxOrRadioAtIndex(u,r),this.adapter.setAttributeForElementIndex(u,c,""+r),r?i.add(u):i.delete(u))}d.length&&(this.selectedIndex=L([],O(i)),this.adapter.notifySelectionChange(d))},e.prototype.setTabindexAtIndex=function(t){this.focusedItemIndex===U.UNSET_INDEX&&0!==t?this.adapter.setAttributeForElementIndex(0,"tabindex","-1"):this.focusedItemIndex>=0&&this.focusedItemIndex!==t&&this.adapter.setAttributeForElementIndex(this.focusedItemIndex,"tabindex","-1"),this.selectedIndex instanceof Array||this.selectedIndex===t||this.adapter.setAttributeForElementIndex(this.selectedIndex,"tabindex","-1"),t!==U.UNSET_INDEX&&this.adapter.setAttributeForElementIndex(t,"tabindex","0")},e.prototype.isSelectableList=function(){return this.isSingleSelectionList||this.isCheckboxList||this.isRadioList},e.prototype.setTabindexToFirstSelectedOrFocusedItem=function(){var t=this.getFirstSelectedOrFocusedItemIndex();this.setTabindexAtIndex(t)},e.prototype.getFirstSelectedOrFocusedItemIndex=function(){return this.isSelectableList()?"number"===typeof this.selectedIndex&&this.selectedIndex!==U.UNSET_INDEX?this.selectedIndex:this.selectedIndex instanceof Array&&this.selectedIndex.length>0?this.selectedIndex.reduce((function(t,e){return Math.min(t,e)})):0:Math.max(this.focusedItemIndex,0)},e.prototype.isIndexValid=function(t,e){var n=this;if(void 0===e&&(e=!0),t instanceof Array){if(!this.isCheckboxList&&e)throw new Error("MDCListFoundation: Array of index is only supported for checkbox based list");return 0===t.length||t.some((function(t){return n.isIndexInRange(t)}))}if("number"===typeof t){if(this.isCheckboxList&&e)throw new Error("MDCListFoundation: Expected array of index for checkbox based list but got number: "+t);return this.isIndexInRange(t)||this.isSingleSelectionList&&t===U.UNSET_INDEX}return!1},e.prototype.isIndexInRange=function(t){var e=this.adapter.getListItemCount();return t>=0&&t<e},e.prototype.setSelectedIndexOnAction=function(t,e){this.lastSelectedIndex=t,this.isCheckboxList?(this.toggleCheckboxAtIndex(t,e),this.adapter.notifySelectionChange([t])):this.setSelectedIndex(t,{isUserInteraction:!0})},e.prototype.toggleCheckboxAtIndex=function(t,e){var n,i=this.getSelectionAttribute(),r=this.adapter.isCheckboxCheckedAtIndex(t);e?n=r:(n=!r,this.adapter.setCheckedCheckboxOrRadioAtIndex(t,n)),this.adapter.setAttributeForElementIndex(t,i,n?"true":"false");var o=this.selectedIndex===U.UNSET_INDEX?[]:this.selectedIndex.slice();n?o.push(t):o=o.filter((function(e){return e!==t})),this.selectedIndex=o},e.prototype.focusItemAtIndex=function(t){this.adapter.focusItemAtIndex(t),this.focusedItemIndex=t},e.prototype.checkboxListToggleAll=function(t,e){var n=this.adapter.getListItemCount();if(t.length===n)this.setCheckboxAtIndex([],{isUserInteraction:e});else{for(var i=[],r=0;r<n;r++)(!this.isIndexDisabled(r)||t.indexOf(r)>-1)&&i.push(r);this.setCheckboxAtIndex(i,{isUserInteraction:e})}},e.prototype.typeaheadMatchItem=function(t,e,n){var i=this;return void 0===n&&(n=!1),Ct({focusItemAtIndex:function(t){i.focusItemAtIndex(t)},focusedItemIndex:e||this.focusedItemIndex,nextChar:t,sortedIndexByFirstChar:this.sortedIndexByFirstChar,skipFocus:n,isItemAtIndexDisabled:function(t){return i.isIndexDisabled(t)}},this.typeaheadState)},e.prototype.typeaheadInitSortedIndex=function(){return function(t,e){for(var n=new Map,i=0;i<t;i++){var r=e(i).trim();if(r){var o=r[0].toLowerCase();n.has(o)||n.set(o,[]),n.get(o).push({text:r.toLowerCase(),index:i})}}return n.forEach((function(t){t.sort((function(t,e){return t.index-e.index}))})),n}(this.adapter.getListItemCount(),this.adapter.getPrimaryTextAtIndex)},e.prototype.clearTypeaheadBuffer=function(){gt(this.typeaheadState)},e}(N),Lt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return x(e,t),Object.defineProperty(e.prototype,"vertical",{set:function(t){this.foundation.setVerticalOrientation(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"listElements",{get:function(){return Array.from(this.root.querySelectorAll("."+this.classNameMap[k.LIST_ITEM_CLASS]))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"wrapFocus",{set:function(t){this.foundation.setWrapFocus(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"typeaheadInProgress",{get:function(){return this.foundation.isTypeaheadInProgress()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasTypeahead",{set:function(t){this.foundation.setHasTypeahead(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"singleSelection",{set:function(t){this.foundation.setSingleSelection(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"disabledItemsFocusable",{set:function(t){this.foundation.setDisabledItemsFocusable(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"selectedIndex",{get:function(){return this.foundation.getSelectedIndex()},set:function(t){this.foundation.setSelectedIndex(t)},enumerable:!1,configurable:!0}),e.attachTo=function(t){return new e(t)},e.prototype.initialSyncWithDOM=function(){this.isEvolutionEnabled="evolution"in this.root.dataset,this.isEvolutionEnabled?this.classNameMap=B:w(this.root,H.DEPRECATED_SELECTOR)?this.classNameMap=P:this.classNameMap=Object.values(k).reduce((function(t,e){return t[e]=e,t}),{}),this.handleClick=this.handleClickEvent.bind(this),this.handleKeydown=this.handleKeydownEvent.bind(this),this.focusInEventListener=this.handleFocusInEvent.bind(this),this.focusOutEventListener=this.handleFocusOutEvent.bind(this),this.listen("keydown",this.handleKeydown),this.listen("click",this.handleClick),this.listen("focusin",this.focusInEventListener),this.listen("focusout",this.focusOutEventListener),this.layout(),this.initializeListType(),this.ensureFocusable()},e.prototype.destroy=function(){this.unlisten("keydown",this.handleKeydown),this.unlisten("click",this.handleClick),this.unlisten("focusin",this.focusInEventListener),this.unlisten("focusout",this.focusOutEventListener)},e.prototype.layout=function(){var t=this.root.getAttribute(H.ARIA_ORIENTATION);this.vertical=t!==H.ARIA_ORIENTATION_HORIZONTAL;var e="."+this.classNameMap[k.LIST_ITEM_CLASS]+":not([tabindex])",n=H.FOCUSABLE_CHILD_ELEMENTS,i=this.root.querySelectorAll(e);i.length&&Array.prototype.forEach.call(i,(function(t){t.setAttribute("tabindex","-1")}));var r=this.root.querySelectorAll(n);r.length&&Array.prototype.forEach.call(r,(function(t){t.setAttribute("tabindex","-1")})),this.isEvolutionEnabled&&this.foundation.setUseSelectedAttribute(!0),this.foundation.layout()},e.prototype.getPrimaryText=function(t){var e,n=t.querySelector("."+this.classNameMap[k.LIST_ITEM_PRIMARY_TEXT_CLASS]);if(this.isEvolutionEnabled||n)return null!==(e=null===n||void 0===n?void 0:n.textContent)&&void 0!==e?e:"";var i=t.querySelector("."+this.classNameMap[k.LIST_ITEM_TEXT_CLASS]);return i&&i.textContent||""},e.prototype.initializeListType=function(){var t=this;if(this.isInteractive=w(this.root,H.ARIA_INTERACTIVE_ROLES_SELECTOR),this.isEvolutionEnabled&&this.isInteractive){var e=Array.from(this.root.querySelectorAll(H.SELECTED_ITEM_SELECTOR),(function(e){return t.listElements.indexOf(e)}));w(this.root,H.ARIA_MULTI_SELECTABLE_SELECTOR)?this.selectedIndex=e:e.length>0&&(this.selectedIndex=e[0])}else{var n=this.root.querySelectorAll(H.ARIA_ROLE_CHECKBOX_SELECTOR),i=this.root.querySelector(H.ARIA_CHECKED_RADIO_SELECTOR);if(n.length){var r=this.root.querySelectorAll(H.ARIA_CHECKED_CHECKBOX_SELECTOR);this.selectedIndex=Array.from(r,(function(e){return t.listElements.indexOf(e)}))}else i&&(this.selectedIndex=this.listElements.indexOf(i))}},e.prototype.setEnabled=function(t,e){this.foundation.setEnabled(t,e)},e.prototype.typeaheadMatchItem=function(t,e){return this.foundation.typeaheadMatchItem(t,e,!0)},e.prototype.getDefaultFoundation=function(){var t=this;return new Ot({addClassForElementIndex:function(e,n){var i=t.listElements[e];i&&i.classList.add(t.classNameMap[n])},focusItemAtIndex:function(e){var n=t.listElements[e];n&&n.focus()},getAttributeForElementIndex:function(e,n){return t.listElements[e].getAttribute(n)},getFocusedElementIndex:function(){return t.listElements.indexOf(document.activeElement)},getListItemCount:function(){return t.listElements.length},getPrimaryTextAtIndex:function(e){return t.getPrimaryText(t.listElements[e])},hasCheckboxAtIndex:function(e){return!!t.listElements[e].querySelector(H.CHECKBOX_SELECTOR)},hasRadioAtIndex:function(e){return!!t.listElements[e].querySelector(H.RADIO_SELECTOR)},isCheckboxCheckedAtIndex:function(e){return t.listElements[e].querySelector(H.CHECKBOX_SELECTOR).checked},isFocusInsideList:function(){return t.root!==document.activeElement&&t.root.contains(document.activeElement)},isRootFocused:function(){return document.activeElement===t.root},listItemAtIndexHasClass:function(e,n){return t.listElements[e].classList.contains(t.classNameMap[n])},notifyAction:function(e){t.emit(H.ACTION_EVENT,{index:e},!0)},notifySelectionChange:function(e){t.emit(H.SELECTION_CHANGE_EVENT,{changedIndices:e},!0)},removeClassForElementIndex:function(e,n){var i=t.listElements[e];i&&i.classList.remove(t.classNameMap[n])},setAttributeForElementIndex:function(e,n,i){var r=t.listElements[e];r&&r.setAttribute(n,i)},setCheckedCheckboxOrRadioAtIndex:function(e,n){var i=t.listElements[e].querySelector(H.CHECKBOX_RADIO_SELECTOR);i.checked=n;var r=document.createEvent("Event");r.initEvent("change",!0,!0),i.dispatchEvent(r)},setTabIndexForListItemChildren:function(e,n){var i=t.listElements[e],r=H.CHILD_ELEMENTS_TO_TOGGLE_TABINDEX;Array.prototype.forEach.call(i.querySelectorAll(r),(function(t){t.setAttribute("tabindex",n)}))}})},e.prototype.ensureFocusable=function(){if(this.isEvolutionEnabled&&this.isInteractive&&!this.root.querySelector("."+this.classNameMap[k.LIST_ITEM_CLASS]+'[tabindex="0"]')){var t=this.initialFocusIndex();-1!==t&&(this.listElements[t].tabIndex=0)}},e.prototype.initialFocusIndex=function(){if(this.selectedIndex instanceof Array&&this.selectedIndex.length>0)return this.selectedIndex[0];if("number"===typeof this.selectedIndex&&this.selectedIndex!==U.UNSET_INDEX)return this.selectedIndex;var t=this.root.querySelector("."+this.classNameMap[k.LIST_ITEM_CLASS]+":not(."+this.classNameMap[k.LIST_ITEM_DISABLED_CLASS]+")");return null===t?-1:this.getListItemIndex(t)},e.prototype.getListItemIndex=function(t){var e=F(t,"."+this.classNameMap[k.LIST_ITEM_CLASS]+", ."+this.classNameMap[k.ROOT]);return e&&w(e,"."+this.classNameMap[k.LIST_ITEM_CLASS])?this.listElements.indexOf(e):-1},e.prototype.handleFocusInEvent=function(t){var e=this.getListItemIndex(t.target);this.foundation.handleFocusIn(e)},e.prototype.handleFocusOutEvent=function(t){var e=this.getListItemIndex(t.target);this.foundation.handleFocusOut(e)},e.prototype.handleKeydownEvent=function(t){var e=this.getListItemIndex(t.target),n=t.target;this.foundation.handleKeydown(t,n.classList.contains(this.classNameMap[k.LIST_ITEM_CLASS]),e)},e.prototype.handleClickEvent=function(t){var e=this.getListItemIndex(t.target),n=!w(t.target,H.CHECKBOX_RADIO_SELECTOR);this.foundation.handleClick(e,n,t)},e}(R),Dt=function(t){function e(n){var i=t.call(this,b(b({},e.defaultAdapter),n))||this;return i.isSurfaceOpen=!1,i.isQuickOpen=!1,i.isHoistedElement=!1,i.isFixedPosition=!1,i.isHorizontallyCenteredOnViewport=!1,i.maxHeight=0,i.openBottomBias=0,i.openAnimationEndTimerId=0,i.closeAnimationEndTimerId=0,i.animationRequestId=0,i.anchorCorner=T.TOP_START,i.originCorner=T.TOP_START,i.anchorMargin={top:0,right:0,bottom:0,left:0},i.position={x:0,y:0},i}return x(e,t),Object.defineProperty(e,"cssClasses",{get:function(){return A},enumerable:!1,configurable:!0}),Object.defineProperty(e,"strings",{get:function(){return C},enumerable:!1,configurable:!0}),Object.defineProperty(e,"numbers",{get:function(){return v},enumerable:!1,configurable:!0}),Object.defineProperty(e,"Corner",{get:function(){return T},enumerable:!1,configurable:!0}),Object.defineProperty(e,"defaultAdapter",{get:function(){return{addClass:function(){},removeClass:function(){},hasClass:function(){return!1},hasAnchor:function(){return!1},isElementInContainer:function(){return!1},isFocused:function(){return!1},isRtl:function(){return!1},getInnerDimensions:function(){return{height:0,width:0}},getAnchorDimensions:function(){return null},getWindowDimensions:function(){return{height:0,width:0}},getBodyDimensions:function(){return{height:0,width:0}},getWindowScroll:function(){return{x:0,y:0}},setPosition:function(){},setMaxHeight:function(){},setTransformOrigin:function(){},saveFocus:function(){},restoreFocus:function(){},notifyClose:function(){},notifyClosing:function(){},notifyOpen:function(){},notifyOpening:function(){}}},enumerable:!1,configurable:!0}),e.prototype.init=function(){var t=e.cssClasses,n=t.ROOT,i=t.OPEN;if(!this.adapter.hasClass(n))throw new Error(n+" class required in root element.");this.adapter.hasClass(i)&&(this.isSurfaceOpen=!0)},e.prototype.destroy=function(){clearTimeout(this.openAnimationEndTimerId),clearTimeout(this.closeAnimationEndTimerId),cancelAnimationFrame(this.animationRequestId)},e.prototype.setAnchorCorner=function(t){this.anchorCorner=t},e.prototype.flipCornerHorizontally=function(){this.originCorner=this.originCorner^y.RIGHT},e.prototype.setAnchorMargin=function(t){this.anchorMargin.top=t.top||0,this.anchorMargin.right=t.right||0,this.anchorMargin.bottom=t.bottom||0,this.anchorMargin.left=t.left||0},e.prototype.setIsHoisted=function(t){this.isHoistedElement=t},e.prototype.setFixedPosition=function(t){this.isFixedPosition=t},e.prototype.isFixed=function(){return this.isFixedPosition},e.prototype.setAbsolutePosition=function(t,e){this.position.x=this.isFinite(t)?t:0,this.position.y=this.isFinite(e)?e:0},e.prototype.setIsHorizontallyCenteredOnViewport=function(t){this.isHorizontallyCenteredOnViewport=t},e.prototype.setQuickOpen=function(t){this.isQuickOpen=t},e.prototype.setMaxHeight=function(t){this.maxHeight=t},e.prototype.setOpenBottomBias=function(t){this.openBottomBias=t},e.prototype.isOpen=function(){return this.isSurfaceOpen},e.prototype.open=function(){var t=this;this.isSurfaceOpen||(this.adapter.notifyOpening(),this.adapter.saveFocus(),this.isQuickOpen?(this.isSurfaceOpen=!0,this.adapter.addClass(e.cssClasses.OPEN),this.dimensions=this.adapter.getInnerDimensions(),this.autoposition(),this.adapter.notifyOpen()):(this.adapter.addClass(e.cssClasses.ANIMATING_OPEN),this.animationRequestId=requestAnimationFrame((function(){t.dimensions=t.adapter.getInnerDimensions(),t.autoposition(),t.adapter.addClass(e.cssClasses.OPEN),t.openAnimationEndTimerId=setTimeout((function(){t.openAnimationEndTimerId=0,t.adapter.removeClass(e.cssClasses.ANIMATING_OPEN),t.adapter.notifyOpen()}),v.TRANSITION_OPEN_DURATION)})),this.isSurfaceOpen=!0))},e.prototype.close=function(t){var n=this;if(void 0===t&&(t=!1),this.isSurfaceOpen){if(this.adapter.notifyClosing(),this.isQuickOpen)return this.isSurfaceOpen=!1,t||this.maybeRestoreFocus(),this.adapter.removeClass(e.cssClasses.OPEN),this.adapter.removeClass(e.cssClasses.IS_OPEN_BELOW),void this.adapter.notifyClose();this.adapter.addClass(e.cssClasses.ANIMATING_CLOSED),requestAnimationFrame((function(){n.adapter.removeClass(e.cssClasses.OPEN),n.adapter.removeClass(e.cssClasses.IS_OPEN_BELOW),n.closeAnimationEndTimerId=setTimeout((function(){n.closeAnimationEndTimerId=0,n.adapter.removeClass(e.cssClasses.ANIMATING_CLOSED),n.adapter.notifyClose()}),v.TRANSITION_CLOSE_DURATION)})),this.isSurfaceOpen=!1,t||this.maybeRestoreFocus()}},e.prototype.handleBodyClick=function(t){var e=t.target;this.adapter.isElementInContainer(e)||this.close()},e.prototype.handleKeydown=function(t){var e=t.keyCode;("Escape"===t.key||27===e)&&this.close()},e.prototype.autoposition=function(){var t;this.measurements=this.getAutoLayoutmeasurements();var n=this.getoriginCorner(),i=this.getMenuSurfaceMaxHeight(n),r=this.hasBit(n,y.BOTTOM)?"bottom":"top",o=this.hasBit(n,y.RIGHT)?"right":"left",s=this.getHorizontalOriginOffset(n),a=this.getVerticalOriginOffset(n),c=this.measurements,d=c.anchorSize,u=c.surfaceSize,l=((t={})[o]=s,t[r]=a,t);d.width/u.width>v.ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO&&(o="center"),(this.isHoistedElement||this.isFixedPosition)&&this.adjustPositionForHoistedElement(l),this.adapter.setTransformOrigin(o+" "+r),this.adapter.setPosition(l),this.adapter.setMaxHeight(i?i+"px":""),this.hasBit(n,y.BOTTOM)||this.adapter.addClass(e.cssClasses.IS_OPEN_BELOW)},e.prototype.getAutoLayoutmeasurements=function(){var t=this.adapter.getAnchorDimensions(),e=this.adapter.getBodyDimensions(),n=this.adapter.getWindowDimensions(),i=this.adapter.getWindowScroll();return t||(t={top:this.position.y,right:this.position.x,bottom:this.position.y,left:this.position.x,width:0,height:0}),{anchorSize:t,bodySize:e,surfaceSize:this.dimensions,viewportDistance:{top:t.top,right:n.width-t.right,bottom:n.height-t.bottom,left:t.left},viewportSize:n,windowScroll:i}},e.prototype.getoriginCorner=function(){var t,n,i=this.originCorner,r=this.measurements,o=r.viewportDistance,s=r.anchorSize,a=r.surfaceSize,c=e.numbers.MARGIN_TO_EDGE;this.hasBit(this.anchorCorner,y.BOTTOM)?(t=o.top-c+this.anchorMargin.bottom,n=o.bottom-c-this.anchorMargin.bottom):(t=o.top-c+this.anchorMargin.top,n=o.bottom-c+s.height-this.anchorMargin.top),!(n-a.height>0)&&t>n+this.openBottomBias&&(i=this.setBit(i,y.BOTTOM));var d,u,l=this.adapter.isRtl(),h=this.hasBit(this.anchorCorner,y.FLIP_RTL),f=this.hasBit(this.anchorCorner,y.RIGHT)||this.hasBit(i,y.RIGHT),p=!1;(p=l&&h?!f:f)?(d=o.left+s.width+this.anchorMargin.right,u=o.right-this.anchorMargin.right):(d=o.left+this.anchorMargin.left,u=o.right+s.width-this.anchorMargin.left);var m=d-a.width>0,I=u-a.width>0,E=this.hasBit(i,y.FLIP_RTL)&&this.hasBit(i,y.RIGHT);return I&&E&&l||!m&&E?i=this.unsetBit(i,y.RIGHT):(m&&p&&l||m&&!p&&f||!I&&d>=u)&&(i=this.setBit(i,y.RIGHT)),i},e.prototype.getMenuSurfaceMaxHeight=function(t){if(this.maxHeight>0)return this.maxHeight;var n=this.measurements.viewportDistance,i=0,r=this.hasBit(t,y.BOTTOM),o=this.hasBit(this.anchorCorner,y.BOTTOM),s=e.numbers.MARGIN_TO_EDGE;return r?(i=n.top+this.anchorMargin.top-s,o||(i+=this.measurements.anchorSize.height)):(i=n.bottom-this.anchorMargin.bottom+this.measurements.anchorSize.height-s,o&&(i-=this.measurements.anchorSize.height)),i},e.prototype.getHorizontalOriginOffset=function(t){var e=this.measurements.anchorSize,n=this.hasBit(t,y.RIGHT),i=this.hasBit(this.anchorCorner,y.RIGHT);if(n){var r=i?e.width-this.anchorMargin.left:this.anchorMargin.right;return this.isHoistedElement||this.isFixedPosition?r-(this.measurements.viewportSize.width-this.measurements.bodySize.width):r}return i?e.width-this.anchorMargin.right:this.anchorMargin.left},e.prototype.getVerticalOriginOffset=function(t){var e=this.measurements.anchorSize,n=this.hasBit(t,y.BOTTOM),i=this.hasBit(this.anchorCorner,y.BOTTOM);return n?i?e.height-this.anchorMargin.top:-this.anchorMargin.bottom:i?e.height+this.anchorMargin.bottom:this.anchorMargin.top},e.prototype.adjustPositionForHoistedElement=function(t){var e,n,i=this.measurements,r=i.windowScroll,o=i.viewportDistance,s=i.surfaceSize,a=i.viewportSize,c=Object.keys(t);try{for(var d=_(c),u=d.next();!u.done;u=d.next()){var l=u.value,h=t[l]||0;!this.isHorizontallyCenteredOnViewport||"left"!==l&&"right"!==l?(h+=o[l],this.isFixedPosition||("top"===l?h+=r.y:"bottom"===l?h-=r.y:"left"===l?h+=r.x:h-=r.x),t[l]=h):t[l]=(a.width-s.width)/2}}catch(f){e={error:f}}finally{try{u&&!u.done&&(n=d.return)&&n.call(d)}finally{if(e)throw e.error}}},e.prototype.maybeRestoreFocus=function(){var t=this,e=this.adapter.isFocused(),n=this.adapter.getOwnerDocument?this.adapter.getOwnerDocument():document,i=n.activeElement&&this.adapter.isElementInContainer(n.activeElement);(e||i)&&setTimeout((function(){t.adapter.restoreFocus()}),v.TOUCH_EVENT_WAIT_MS)},e.prototype.hasBit=function(t,e){return Boolean(t&e)},e.prototype.setBit=function(t,e){return t|e},e.prototype.unsetBit=function(t,e){return t^e},e.prototype.isFinite=function(t){return"number"===typeof t&&isFinite(t)},e}(N),Mt={animation:{prefixed:"-webkit-animation",standard:"animation"},transform:{prefixed:"-webkit-transform",standard:"transform"},transition:{prefixed:"-webkit-transition",standard:"transition"}};function Nt(t){return Boolean(t.document)&&"function"===typeof t.document.createElement}var Rt,Ft=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return x(e,t),e.attachTo=function(t){return new e(t)},e.prototype.initialSyncWithDOM=function(){var t=this,e=this.root.parentElement;this.anchorElement=e&&e.classList.contains(A.ANCHOR)?e:null,this.root.classList.contains(A.FIXED)&&this.setFixedPosition(!0),this.handleKeydown=function(e){t.foundation.handleKeydown(e)},this.handleBodyClick=function(e){t.foundation.handleBodyClick(e)},this.registerBodyClickListener=function(){document.body.addEventListener("click",t.handleBodyClick,{capture:!0})},this.deregisterBodyClickListener=function(){document.body.removeEventListener("click",t.handleBodyClick,{capture:!0})},this.listen("keydown",this.handleKeydown),this.listen(C.OPENED_EVENT,this.registerBodyClickListener),this.listen(C.CLOSED_EVENT,this.deregisterBodyClickListener)},e.prototype.destroy=function(){this.unlisten("keydown",this.handleKeydown),this.unlisten(C.OPENED_EVENT,this.registerBodyClickListener),this.unlisten(C.CLOSED_EVENT,this.deregisterBodyClickListener),t.prototype.destroy.call(this)},e.prototype.isOpen=function(){return this.foundation.isOpen()},e.prototype.open=function(){this.foundation.open()},e.prototype.close=function(t){void 0===t&&(t=!1),this.foundation.close(t)},Object.defineProperty(e.prototype,"quickOpen",{set:function(t){this.foundation.setQuickOpen(t)},enumerable:!1,configurable:!0}),e.prototype.setIsHoisted=function(t){this.foundation.setIsHoisted(t)},e.prototype.setMenuSurfaceAnchorElement=function(t){this.anchorElement=t},e.prototype.setFixedPosition=function(t){t?this.root.classList.add(A.FIXED):this.root.classList.remove(A.FIXED),this.foundation.setFixedPosition(t)},e.prototype.setAbsolutePosition=function(t,e){this.foundation.setAbsolutePosition(t,e),this.setIsHoisted(!0)},e.prototype.setAnchorCorner=function(t){this.foundation.setAnchorCorner(t)},e.prototype.setAnchorMargin=function(t){this.foundation.setAnchorMargin(t)},e.prototype.getDefaultFoundation=function(){var t=this,e={addClass:function(e){return t.root.classList.add(e)},removeClass:function(e){return t.root.classList.remove(e)},hasClass:function(e){return t.root.classList.contains(e)},hasAnchor:function(){return!!t.anchorElement},notifyClose:function(){return t.emit(Dt.strings.CLOSED_EVENT,{})},notifyClosing:function(){t.emit(Dt.strings.CLOSING_EVENT,{})},notifyOpen:function(){return t.emit(Dt.strings.OPENED_EVENT,{})},notifyOpening:function(){return t.emit(Dt.strings.OPENING_EVENT,{})},isElementInContainer:function(e){return t.root.contains(e)},isRtl:function(){return"rtl"===getComputedStyle(t.root).getPropertyValue("direction")},setTransformOrigin:function(e){var n=function(t,e){if(Nt(t)&&e in Mt){var n=t.document.createElement("div"),i=Mt[e],r=i.standard,o=i.prefixed;return r in n.style?r:o}return e}(window,"transform")+"-origin";t.root.style.setProperty(n,e)},isFocused:function(){return document.activeElement===t.root},saveFocus:function(){t.previousFocus=document.activeElement},restoreFocus:function(){t.root.contains(document.activeElement)&&t.previousFocus&&t.previousFocus.focus&&t.previousFocus.focus()},getInnerDimensions:function(){return{width:t.root.offsetWidth,height:t.root.offsetHeight}},getAnchorDimensions:function(){return t.anchorElement?t.anchorElement.getBoundingClientRect():null},getWindowDimensions:function(){return{width:window.innerWidth,height:window.innerHeight}},getBodyDimensions:function(){return{width:document.body.clientWidth,height:document.body.clientHeight}},getWindowScroll:function(){return{x:window.pageXOffset,y:window.pageYOffset}},setPosition:function(e){var n=t.root;n.style.left="left"in e?e.left+"px":"",n.style.right="right"in e?e.right+"px":"",n.style.top="top"in e?e.top+"px":"",n.style.bottom="bottom"in e?e.bottom+"px":""},setMaxHeight:function(e){t.root.style.maxHeight=e}};return new Dt(e)},e}(R),wt={MENU_SELECTED_LIST_ITEM:"mdc-menu-item--selected",MENU_SELECTION_GROUP:"mdc-menu__selection-group",ROOT:"mdc-menu"},kt={ARIA_CHECKED_ATTR:"aria-checked",ARIA_DISABLED_ATTR:"ar