UNPKG

balm-ui

Version:

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

1 lines 112 kB
!function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e(require("vue")):"function"===typeof define&&define.amd?define("UiSelect",["vue"],e):"object"===typeof exports?exports.UiSelect=e(require("vue")):t.UiSelect=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 o(t,e,n){return t.concat(e).map((function(t){return i(t,n)}))}function r(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 o={};return n.isMergeableObject(t)&&r(t).forEach((function(e){o[e]=i(t[e],n)})),r(e).forEach((function(r){(function(t,e){return s(t,e)&&!(Object.hasOwnProperty.call(t,e)&&Object.propertyIsEnumerable.call(t,e))})(t,r)||(s(t,r)&&n.isMergeableObject(e[r])?o[r]=function(t,e){if(!e.customMerge)return c;var n=e.customMerge(t);return"function"===typeof n?n:c}(r,n)(t[r],e[r],n):o[r]=i(e[r],n))})),o}function c(t,n,r){(r=r||{}).arrayMerge=r.arrayMerge||o,r.isMergeableObject=r.isMergeableObject||e,r.cloneUnlessOtherwiseSpecified=i;var s=Array.isArray(n);return s===Array.isArray(t)?s?r.arrayMerge(t,n,r):a(t,n,r):i(n,r)}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 u=c;t.exports=u},262:function(t,e){e.A=(t,e)=>{const n=t.__vccOpts||t;for(const[i,o]of e)n[i]=o;return n}},154:function(e){e.exports=t}},n={};function i(t){var o=n[t];if(void 0!==o)return o.exports;var r=n[t]={exports:{}};return e[t](r,r.exports,i),r.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 o={};i.d(o,{default:function(){return on}});var r=i(744),s=i.n(r);const a=/(?:^\[object\s(.*?)\]$)/;var c=t=>Object.prototype.toString.call(t).replace(a,"$1").toLowerCase();const u=t=>{let{componentProps:e,propName:n,props:i}=t,o=i[n];if("object"===c(o)){const t=e[n].default;e[n].default=()=>s()(t,o)}else Array.isArray(o)?e[n].default=()=>o:e[n].default=o},d=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]){u({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]?d({componentMixins:t.mixins,propName:n,props:e}):u({componentProps:t.props,propName:n,props:e}):d({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],o=e[n];l(i,o)}};var p=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},f=i(154),m=function(t,e){return m=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])},m(t,e)};function E(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}m(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var I=function(){return I=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},I.apply(this,arguments)};Object.create;function y(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 A(t,e){var n="function"===typeof Symbol&&t[Symbol.iterator];if(!n)return t;var i,o,r=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return s}function T(t,e,n){if(n||2===arguments.length)for(var i,o=0,r=e.length;o<r;o++)!i&&o in e||(i||(i=Array.prototype.slice.call(e,0,o)),i[o]=e[o]);return t.concat(i||Array.prototype.slice.call(e))}Object.create;"function"===typeof SuppressedError&&SuppressedError;var g=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}(),C=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,T([],A(n))),this.foundation=void 0===e?this.getDefaultFoundation():e,this.foundation.init(),this.initialSyncWithDOM()}return t.attachTo=function(e){return new t(e,new g({}))},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 S(t,e){if(t.closest)return t.closest(e);for(var n=t;n;){if(v(n,e))return n;n=n.parentElement}return null}function v(t,e){return(t.matches||t.webkitMatchesSelector||t.msMatchesSelector).call(t,e)}var b,_,x,O,L={LABEL_FLOAT_ABOVE:"mdc-floating-label--float-above",LABEL_REQUIRED:"mdc-floating-label--required",LABEL_SHAKE:"mdc-floating-label--shake",ROOT:"mdc-floating-label"},D=function(t){function e(n){var i=t.call(this,I(I({},e.defaultAdapter),n))||this;return i.shakeAnimationEndHandler=function(){i.handleShakeAnimationEnd()},i}return E(e,t),Object.defineProperty(e,"cssClasses",{get:function(){return L},enumerable:!1,configurable:!0}),Object.defineProperty(e,"defaultAdapter",{get:function(){return{addClass:function(){},removeClass:function(){},getWidth:function(){return 0},registerInteractionHandler:function(){},deregisterInteractionHandler:function(){}}},enumerable:!1,configurable:!0}),e.prototype.init=function(){this.adapter.registerInteractionHandler("animationend",this.shakeAnimationEndHandler)},e.prototype.destroy=function(){this.adapter.deregisterInteractionHandler("animationend",this.shakeAnimationEndHandler)},e.prototype.getWidth=function(){return this.adapter.getWidth()},e.prototype.shake=function(t){var n=e.cssClasses.LABEL_SHAKE;t?this.adapter.addClass(n):this.adapter.removeClass(n)},e.prototype.float=function(t){var n=e.cssClasses,i=n.LABEL_FLOAT_ABOVE,o=n.LABEL_SHAKE;t?this.adapter.addClass(i):(this.adapter.removeClass(i),this.adapter.removeClass(o))},e.prototype.setRequired=function(t){var n=e.cssClasses.LABEL_REQUIRED;t?this.adapter.addClass(n):this.adapter.removeClass(n)},e.prototype.handleShakeAnimationEnd=function(){var t=e.cssClasses.LABEL_SHAKE;this.adapter.removeClass(t)},e}(g),N=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return E(e,t),e.attachTo=function(t){return new e(t)},e.prototype.shake=function(t){this.foundation.shake(t)},e.prototype.float=function(t){this.foundation.float(t)},e.prototype.setRequired=function(t){this.foundation.setRequired(t)},e.prototype.getWidth=function(){return this.foundation.getWidth()},e.prototype.getDefaultFoundation=function(){var t=this;return new D({addClass:function(e){return t.root.classList.add(e)},removeClass:function(e){return t.root.classList.remove(e)},getWidth:function(){return function(t){var e=t;if(null!==e.offsetParent)return e.scrollWidth;var n=e.cloneNode(!0);n.style.setProperty("position","absolute"),n.style.setProperty("transform","translate(-9999px, -9999px)"),document.documentElement.appendChild(n);var i=n.scrollWidth;return document.documentElement.removeChild(n),i}(t.root)},registerInteractionHandler:function(e,n){return t.listen(e,n)},deregisterInteractionHandler:function(e,n){return t.unlisten(e,n)}})},e}(C),R={LINE_RIPPLE_ACTIVE:"mdc-line-ripple--active",LINE_RIPPLE_DEACTIVATING:"mdc-line-ripple--deactivating"},M=function(t){function e(n){var i=t.call(this,I(I({},e.defaultAdapter),n))||this;return i.transitionEndHandler=function(t){i.handleTransitionEnd(t)},i}return E(e,t),Object.defineProperty(e,"cssClasses",{get:function(){return R},enumerable:!1,configurable:!0}),Object.defineProperty(e,"defaultAdapter",{get:function(){return{addClass:function(){},removeClass:function(){},hasClass:function(){return!1},setStyle:function(){},registerEventHandler:function(){},deregisterEventHandler:function(){}}},enumerable:!1,configurable:!0}),e.prototype.init=function(){this.adapter.registerEventHandler("transitionend",this.transitionEndHandler)},e.prototype.destroy=function(){this.adapter.deregisterEventHandler("transitionend",this.transitionEndHandler)},e.prototype.activate=function(){this.adapter.removeClass(R.LINE_RIPPLE_DEACTIVATING),this.adapter.addClass(R.LINE_RIPPLE_ACTIVE)},e.prototype.setRippleCenter=function(t){this.adapter.setStyle("transform-origin",t+"px center")},e.prototype.deactivate=function(){this.adapter.addClass(R.LINE_RIPPLE_DEACTIVATING)},e.prototype.handleTransitionEnd=function(t){var e=this.adapter.hasClass(R.LINE_RIPPLE_DEACTIVATING);"opacity"===t.propertyName&&e&&(this.adapter.removeClass(R.LINE_RIPPLE_ACTIVE),this.adapter.removeClass(R.LINE_RIPPLE_DEACTIVATING))},e}(g),F=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return E(e,t),e.attachTo=function(t){return new e(t)},e.prototype.activate=function(){this.foundation.activate()},e.prototype.deactivate=function(){this.foundation.deactivate()},e.prototype.setRippleCenter=function(t){this.foundation.setRippleCenter(t)},e.prototype.getDefaultFoundation=function(){var t=this;return new M({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)},setStyle:function(e,n){return t.root.style.setProperty(e,n)},registerEventHandler:function(e,n){return t.listen(e,n)},deregisterEventHandler:function(e,n){return t.unlisten(e,n)}})},e}(C),w={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"},P={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(", ")},B={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"}(b||(b={})),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"}(_||(_={}));var V={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"},k=((x={})[""+V.LIST_ITEM_ACTIVATED_CLASS]="mdc-list-item--activated",x[""+V.LIST_ITEM_CLASS]="mdc-list-item",x[""+V.LIST_ITEM_DISABLED_CLASS]="mdc-list-item--disabled",x[""+V.LIST_ITEM_SELECTED_CLASS]="mdc-list-item--selected",x[""+V.LIST_ITEM_PRIMARY_TEXT_CLASS]="mdc-list-item__primary-text",x[""+V.ROOT]="mdc-list",x),H=((O={})[""+V.LIST_ITEM_ACTIVATED_CLASS]="mdc-deprecated-list-item--activated",O[""+V.LIST_ITEM_CLASS]="mdc-deprecated-list-item",O[""+V.LIST_ITEM_DISABLED_CLASS]="mdc-deprecated-list-item--disabled",O[""+V.LIST_ITEM_SELECTED_CLASS]="mdc-deprecated-list-item--selected",O[""+V.LIST_ITEM_TEXT_CLASS]="mdc-deprecated-list-item__text",O[""+V.LIST_ITEM_PRIMARY_TEXT_CLASS]="mdc-deprecated-list-item__primary-text",O[""+V.ROOT]="mdc-deprecated-list",O),U={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 ."+V.LIST_ITEM_CLASS+" button:not(:disabled),\n ."+V.LIST_ITEM_CLASS+" a,\n ."+H[V.LIST_ITEM_CLASS]+" button:not(:disabled),\n ."+H[V.LIST_ITEM_CLASS]+" a\n ",DEPRECATED_SELECTOR:".mdc-deprecated-list",FOCUSABLE_CHILD_ELEMENTS:"\n ."+V.LIST_ITEM_CLASS+" button:not(:disabled),\n ."+V.LIST_ITEM_CLASS+" a,\n ."+V.LIST_ITEM_CLASS+' input[type="radio"]:not(:disabled),\n .'+V.LIST_ITEM_CLASS+' input[type="checkbox"]:not(:disabled),\n .'+H[V.LIST_ITEM_CLASS]+" button:not(:disabled),\n ."+H[V.LIST_ITEM_CLASS]+" a,\n ."+H[V.LIST_ITEM_CLASS]+' input[type="radio"]:not(:disabled),\n .'+H[V.LIST_ITEM_CLASS]+' input[type="checkbox"]:not(:disabled)\n ',RADIO_SELECTOR:'input[type="radio"]',SELECTED_ITEM_SELECTOR:'[aria-selected="true"], [aria-current="true"]'},j={UNSET_INDEX:-1,TYPEAHEAD_BUFFER_CLEAR_TIMEOUT_MS:300},G="Unknown",X="Backspace",q="Enter",z="Spacebar",K="PageUp",W="PageDown",$="End",Y="Home",Q="ArrowLeft",Z="ArrowUp",J="ArrowRight",tt="ArrowDown",et="Delete",nt="Escape",it="Tab",ot=new Set;ot.add(X),ot.add(q),ot.add(z),ot.add(K),ot.add(W),ot.add($),ot.add(Y),ot.add(Q),ot.add(Z),ot.add(J),ot.add(tt),ot.add(et),ot.add(nt),ot.add(it);var rt=8,st=13,at=32,ct=33,ut=34,dt=35,lt=36,ht=37,pt=38,ft=39,mt=40,Et=46,It=27,yt=9,At=new Map;At.set(rt,X),At.set(st,q),At.set(at,z),At.set(ct,K),At.set(ut,W),At.set(dt,$),At.set(lt,Y),At.set(ht,Q),At.set(pt,Z),At.set(ft,J),At.set(mt,tt),At.set(Et,et),At.set(It,nt),At.set(yt,it);var Tt=new Set;function gt(t){var e=t.key;if(ot.has(e))return e;var n=At.get(t.keyCode);return n||G}Tt.add(K),Tt.add(W),Tt.add($),Tt.add(Y),Tt.add(Q),Tt.add(Z),Tt.add(J),Tt.add(tt);var Ct=["input","button","textarea","select"],St=function(t){var e=t.target;if(e){var n=(""+e.tagName).toLowerCase();-1===Ct.indexOf(n)&&t.preventDefault()}};function vt(t,e){var n,i=t.nextChar,o=t.focusItemAtIndex,r=t.sortedIndexByFirstChar,s=t.focusedItemIndex,a=t.skipFocus,c=t.isItemAtIndexDisabled;return clearTimeout(e.bufferClearTimeout),e.bufferClearTimeout=setTimeout((function(){_t(e)}),j.TYPEAHEAD_BUFFER_CLEAR_TIMEOUT_MS),e.typeaheadBuffer=e.typeaheadBuffer+i,n=1===e.typeaheadBuffer.length?function(t,e,n,i){var o=i.typeaheadBuffer[0],r=t.get(o);if(!r)return-1;if(o===i.currentFirstChar&&r[i.sortedIndexCursor].index===e){i.sortedIndexCursor=(i.sortedIndexCursor+1)%r.length;var s=r[i.sortedIndexCursor].index;if(!n(s))return s}i.currentFirstChar=o;var a,c=-1;for(a=0;a<r.length;a++)if(!n(r[a].index)){c=a;break}for(;a<r.length;a++)if(r[a].index>e&&!n(r[a].index)){c=a;break}if(-1!==c)return i.sortedIndexCursor=c,r[i.sortedIndexCursor].index;return-1}(r,s,c,e):function(t,e,n){var i=n.typeaheadBuffer[0],o=t.get(i);if(!o)return-1;var r=o[n.sortedIndexCursor];if(0===r.text.lastIndexOf(n.typeaheadBuffer,0)&&!e(r.index))return r.index;var s=(n.sortedIndexCursor+1)%o.length,a=-1;for(;s!==n.sortedIndexCursor;){var c=o[s],u=0===c.text.lastIndexOf(n.typeaheadBuffer,0),d=!e(c.index);if(u&&d){a=s;break}s=(s+1)%o.length}if(-1!==a)return n.sortedIndexCursor=a,o[n.sortedIndexCursor].index;return-1}(r,c,e),-1===n||a||o(n),n}function bt(t){return t.typeaheadBuffer.length>0}function _t(t){t.typeaheadBuffer=""}function xt(t,e){var n=t.event,i=t.isTargetListItem,o=t.focusedItemIndex,r=t.focusItemAtIndex,s=t.sortedIndexByFirstChar,a=t.isItemAtIndexDisabled,c="ArrowLeft"===gt(n),u="ArrowUp"===gt(n),d="ArrowRight"===gt(n),l="ArrowDown"===gt(n),h="Home"===gt(n),p="End"===gt(n),f="Enter"===gt(n),m="Spacebar"===gt(n);return n.altKey||n.ctrlKey||n.metaKey||c||u||d||l||h||p||f?-1:m||1!==n.key.length?m?(i&&St(n),i&&bt(e)?vt({focusItemAtIndex:r,focusedItemIndex:o,nextChar:" ",sortedIndexByFirstChar:s,skipFocus:!1,isItemAtIndexDisabled:a},e):-1):-1:(St(n),vt({focusItemAtIndex:r,focusedItemIndex:o,nextChar:n.key.toLowerCase(),sortedIndexByFirstChar:s,skipFocus:!1,isItemAtIndexDisabled:a},e))}var Ot=["Alt","Control","Meta","Shift"];function Lt(t){var e=new Set(t?Ot.filter((function(e){return t.getModifierState(e)})):[]);return function(t){return t.every((function(t){return e.has(t)}))&&t.length===e.size}}var Dt=function(t){function e(n){var i=t.call(this,I(I({},e.defaultAdapter),n))||this;return i.wrapFocus=!1,i.isVertical=!0,i.isSingleSelectionList=!1,i.areDisabledItemsFocusable=!0,i.selectedIndex=j.UNSET_INDEX,i.focusedItemIndex=j.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 E(e,t),Object.defineProperty(e,"strings",{get:function(){return U},enumerable:!1,configurable:!0}),Object.defineProperty(e,"cssClasses",{get:function(){return V},enumerable:!1,configurable:!0}),Object.defineProperty(e,"numbers",{get:function(){return j},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!==j.UNSET_INDEX&&(this.adapter.listItemAtIndexHasClass(t,V.LIST_ITEM_ACTIVATED_CLASS)&&this.setUseActivatedClass(!0),this.isSingleSelectionList=!0,this.selectedIndex=t)},e.prototype.getSelectedIndexFromDOM=function(){for(var t=j.UNSET_INDEX,e=this.adapter.getListItemCount(),n=0;n<e;n++){var i=this.adapter.listItemAtIndexHasClass(n,V.LIST_ITEM_SELECTED_CLASS),o=this.adapter.listItemAtIndexHasClass(n,V.LIST_ITEM_ACTIVATED_CLASS);if(i||o){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&&bt(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,V.LIST_ITEM_DISABLED_CLASS)},e.prototype.handleKeydown=function(t,e,n){var i,o=this,r="ArrowLeft"===gt(t),s="ArrowUp"===gt(t),a="ArrowRight"===gt(t),c="ArrowDown"===gt(t),u="Home"===gt(t),d="End"===gt(t),l="Enter"===gt(t),h="Spacebar"===gt(t),p=this.isVertical&&c||!this.isVertical&&a,f=this.isVertical&&s||!this.isVertical&&r,m="A"===t.key||"a"===t.key,E=Lt(t);if(this.adapter.isRootFocused()){if((f||d)&&E([]))t.preventDefault(),this.focusLastElement();else if((p||u)&&E([]))t.preventDefault(),this.focusFirstElement();else if(f&&E(["Shift"])&&this.isCheckboxList){t.preventDefault(),-1!==(y=this.focusLastElement())&&this.setSelectedIndexOnAction(y,!1)}else if(p&&E(["Shift"])&&this.isCheckboxList){t.preventDefault(),-1!==(y=this.focusFirstElement())&&this.setSelectedIndexOnAction(y,!1)}this.hasTypeahead&&xt({event:t,focusItemAtIndex:function(t){o.focusItemAtIndex(t)},focusedItemIndex:-1,isTargetListItem:e,sortedIndexByFirstChar:this.sortedIndexByFirstChar,isItemAtIndexDisabled:function(t){return o.isIndexDisabled(t)}},this.typeaheadState)}else{var I=this.adapter.getFocusedElementIndex();if(!(-1===I&&(I=n)<0)){if(p&&E([]))St(t),this.focusNextElement(I);else if(f&&E([]))St(t),this.focusPrevElement(I);else if(p&&E(["Shift"])&&this.isCheckboxList){St(t),-1!==(y=this.focusNextElement(I))&&this.setSelectedIndexOnAction(y,!1)}else if(f&&E(["Shift"])&&this.isCheckboxList){var y;St(t),-1!==(y=this.focusPrevElement(I))&&this.setSelectedIndexOnAction(y,!1)}else if(u&&E([]))St(t),this.focusFirstElement();else if(d&&E([]))St(t),this.focusLastElement();else if(u&&E(["Control","Shift"])&&this.isCheckboxList){if(St(t),this.isIndexDisabled(I))return;this.focusFirstElement(),this.toggleCheckboxRange(0,I,I)}else if(d&&E(["Control","Shift"])&&this.isCheckboxList){if(St(t),this.isIndexDisabled(I))return;this.focusLastElement(),this.toggleCheckboxRange(I,this.adapter.getListItemCount()-1,I)}else if(m&&E(["Control"])&&this.isCheckboxList)t.preventDefault(),this.checkboxListToggleAll(this.selectedIndex===j.UNSET_INDEX?[]:this.selectedIndex,!0);else if((l||h)&&E([])){if(e){if((A=t.target)&&"A"===A.tagName&&l)return;if(St(t),this.isIndexDisabled(I))return;this.isTypeaheadInProgress()||(this.isSelectableList()&&this.setSelectedIndexOnAction(I,!1),this.adapter.notifyAction(I))}}else if((l||h)&&E(["Shift"])&&this.isCheckboxList){var A;if((A=t.target)&&"A"===A.tagName&&l)return;if(St(t),this.isIndexDisabled(I))return;this.isTypeaheadInProgress()||(this.toggleCheckboxRange(null!==(i=this.lastSelectedIndex)&&void 0!==i?i:I,I,I),this.adapter.notifyAction(I))}if(this.hasTypeahead)xt({event:t,focusItemAtIndex:function(t){o.focusItemAtIndex(t)},focusedItemIndex:this.focusedItemIndex,isTargetListItem:e,sortedIndexByFirstChar:this.sortedIndexByFirstChar,isItemAtIndexDisabled:function(t){return o.isIndexDisabled(t)}},this.typeaheadState)}}},e.prototype.handleClick=function(t,e,n){var i,o=Lt(n);t!==j.UNSET_INDEX&&(this.isIndexDisabled(t)||(o([])?(this.isSelectableList()&&this.setSelectedIndexOnAction(t,e),this.adapter.notifyAction(t)):this.isCheckboxList&&o(["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,V.LIST_ITEM_DISABLED_CLASS),this.adapter.setAttributeForElementIndex(t,U.ARIA_DISABLED,"false")):(this.adapter.addClassForElementIndex(t,V.LIST_ITEM_DISABLED_CLASS),this.adapter.setAttributeForElementIndex(t,U.ARIA_DISABLED,"true")))},e.prototype.setSingleSelectionAtIndex=function(t,e){if(void 0===e&&(e={}),this.selectedIndex!==t||e.forceUpdate){var n=V.LIST_ITEM_SELECTED_CLASS;this.useActivatedClass&&(n=V.LIST_ITEM_ACTIVATED_CLASS),this.selectedIndex!==j.UNSET_INDEX&&this.adapter.removeClassForElementIndex(this.selectedIndex,n),this.setAriaForSingleSelectionAtIndex(t),this.setTabindexAtIndex(t),t!==j.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===j.UNSET_INDEX&&(this.ariaCurrentAttrValue=this.adapter.getAttributeForElementIndex(t,U.ARIA_CURRENT));var e=null!==this.ariaCurrentAttrValue,n=e?U.ARIA_CURRENT:U.ARIA_SELECTED;if(this.selectedIndex!==j.UNSET_INDEX&&this.adapter.setAttributeForElementIndex(this.selectedIndex,n,"false"),t!==j.UNSET_INDEX){var i=e?this.ariaCurrentAttrValue:"true";this.adapter.setAttributeForElementIndex(t,n,i)}},e.prototype.getSelectionAttribute=function(){return this.useSelectedAttr?U.ARIA_SELECTED:U.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!==j.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===j.UNSET_INDEX?[]:n):null,o=this.getSelectionAttribute(),r=[],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&&r.push(s),this.adapter.setCheckedCheckboxOrRadioAtIndex(s,c),this.adapter.setAttributeForElementIndex(s,o,c?"true":"false")}this.selectedIndex=t,e.isUserInteraction&&r.length&&this.adapter.notifySelectionChange(r)},e.prototype.toggleCheckboxRange=function(t,e,n){this.lastSelectedIndex=n;for(var i=new Set(this.selectedIndex===j.UNSET_INDEX?[]:this.selectedIndex),o=!(null===i||void 0===i?void 0:i.has(n)),r=A([t,e].sort(),2),s=r[0],a=r[1],c=this.getSelectionAttribute(),u=[],d=s;d<=a;d++){if(!this.isIndexDisabled(d))o!==i.has(d)&&(u.push(d),this.adapter.setCheckedCheckboxOrRadioAtIndex(d,o),this.adapter.setAttributeForElementIndex(d,c,""+o),o?i.add(d):i.delete(d))}u.length&&(this.selectedIndex=T([],A(i)),this.adapter.notifySelectionChange(u))},e.prototype.setTabindexAtIndex=function(t){this.focusedItemIndex===j.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!==j.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!==j.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===j.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(),o=this.adapter.isCheckboxCheckedAtIndex(t);e?n=o:(n=!o,this.adapter.setCheckedCheckboxOrRadioAtIndex(t,n)),this.adapter.setAttributeForElementIndex(t,i,n?"true":"false");var r=this.selectedIndex===j.UNSET_INDEX?[]:this.selectedIndex.slice();n?r.push(t):r=r.filter((function(e){return e!==t})),this.selectedIndex=r},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=[],o=0;o<n;o++)(!this.isIndexDisabled(o)||t.indexOf(o)>-1)&&i.push(o);this.setCheckboxAtIndex(i,{isUserInteraction:e})}},e.prototype.typeaheadMatchItem=function(t,e,n){var i=this;return void 0===n&&(n=!1),vt({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 o=e(i).trim();if(o){var r=o[0].toLowerCase();n.has(r)||n.set(r,[]),n.get(r).push({text:o.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(){_t(this.typeaheadState)},e}(g),Nt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return E(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[V.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=k:v(this.root,U.DEPRECATED_SELECTOR)?this.classNameMap=H:this.classNameMap=Object.values(V).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(U.ARIA_ORIENTATION);this.vertical=t!==U.ARIA_ORIENTATION_HORIZONTAL;var e="."+this.classNameMap[V.LIST_ITEM_CLASS]+":not([tabindex])",n=U.FOCUSABLE_CHILD_ELEMENTS,i=this.root.querySelectorAll(e);i.length&&Array.prototype.forEach.call(i,(function(t){t.setAttribute("tabindex","-1")}));var o=this.root.querySelectorAll(n);o.length&&Array.prototype.forEach.call(o,(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[V.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[V.LIST_ITEM_TEXT_CLASS]);return i&&i.textContent||""},e.prototype.initializeListType=function(){var t=this;if(this.isInteractive=v(this.root,U.ARIA_INTERACTIVE_ROLES_SELECTOR),this.isEvolutionEnabled&&this.isInteractive){var e=Array.from(this.root.querySelectorAll(U.SELECTED_ITEM_SELECTOR),(function(e){return t.listElements.indexOf(e)}));v(this.root,U.ARIA_MULTI_SELECTABLE_SELECTOR)?this.selectedIndex=e:e.length>0&&(this.selectedIndex=e[0])}else{var n=this.root.querySelectorAll(U.ARIA_ROLE_CHECKBOX_SELECTOR),i=this.root.querySelector(U.ARIA_CHECKED_RADIO_SELECTOR);if(n.length){var o=this.root.querySelectorAll(U.ARIA_CHECKED_CHECKBOX_SELECTOR);this.selectedIndex=Array.from(o,(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 Dt({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(U.CHECKBOX_SELECTOR)},hasRadioAtIndex:function(e){return!!t.listElements[e].querySelector(U.RADIO_SELECTOR)},isCheckboxCheckedAtIndex:function(e){return t.listElements[e].querySelector(U.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(U.ACTION_EVENT,{index:e},!0)},notifySelectionChange:function(e){t.emit(U.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 o=t.listElements[e];o&&o.setAttribute(n,i)},setCheckedCheckboxOrRadioAtIndex:function(e,n){var i=t.listElements[e].querySelector(U.CHECKBOX_RADIO_SELECTOR);i.checked=n;var o=document.createEvent("Event");o.initEvent("change",!0,!0),i.dispatchEvent(o)},setTabIndexForListItemChildren:function(e,n){var i=t.listElements[e],o=U.CHILD_ELEMENTS_TO_TOGGLE_TABINDEX;Array.prototype.forEach.call(i.querySelectorAll(o),(function(t){t.setAttribute("tabindex",n)}))}})},e.prototype.ensureFocusable=function(){if(this.isEvolutionEnabled&&this.isInteractive&&!this.root.querySelector("."+this.classNameMap[V.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!==j.UNSET_INDEX)return this.selectedIndex;var t=this.root.querySelector("."+this.classNameMap[V.LIST_ITEM_CLASS]+":not(."+this.classNameMap[V.LIST_ITEM_DISABLED_CLASS]+")");return null===t?-1:this.getListItemIndex(t)},e.prototype.getListItemIndex=function(t){var e=S(t,"."+this.classNameMap[V.LIST_ITEM_CLASS]+", ."+this.classNameMap[V.ROOT]);return e&&v(e,"."+this.classNameMap[V.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[V.LIST_ITEM_CLASS]),e)},e.prototype.handleClickEvent=function(t){var e=this.getListItemIndex(t.target),n=!v(t.target,U.CHECKBOX_RADIO_SELECTOR);this.foundation.handleClick(e,n,t)},e}(C),Rt=function(t){function e(n){var i=t.call(this,I(I({},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=_.TOP_START,i.originCorner=_.TOP_START,i.anchorMargin={top:0,right:0,bottom:0,left:0},i.position={x:0,y:0},i}return E(e,t),Object.defineProperty(e,"cssClasses",{get:function(){return w},enumerable:!1,configurable:!0}),Object.defineProperty(e,"strings",{get:function(){return P},enumerable:!1,configurable:!0}),Object.defineProperty(e,"numbers",{get:function(){return B},enumerable:!1,configurable:!0}),Object.defineProperty(e,"Corner",{get:function(){return _},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^b.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()}),B.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()}),B.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),o=this.hasBit(n,b.BOTTOM)?"bottom":"top",r=this.hasBit(n,b.RIGHT)?"right":"left",s=this.getHorizontalOriginOffset(n),a=this.getVerticalOriginOffset(n),c=this.measurements,u=c.anchorSize,d=c.surfaceSize,l=((t={})[r]=s,t[o]=a,t);u.width/d.width>B.ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO&&(r="center"),(this.isHoistedElement||this.isFixedPosition)&&this.adjustPositionForHoistedElement(l),this.adapter.setTransformOrigin(r+" "+o),this.adapter.setPosition(l),this.adapter.setMaxHeight(i?i+"px":""),this.hasBit(n,b.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,o=this.measurements,r=o.viewportDistance,s=o.anchorSize,a=o.surfaceSize,c=e.numbers.MARGIN_TO_EDGE;this.hasBit(this.anchorCorner,b.BOTTOM)?(t=r.top-c+this.anchorMargin.bottom,n=r.bottom-c-this.anchorMargin.bottom):(t=r.top-c+this.anchorMargin.top,n=r.bottom-c+s.height-this.anchorMargin.top),!(n-a.height>0)&&t>n+this.openBottomBias&&(i=this.setBit(i,b.BOTTOM));var u,d,l=this.adapter.isRtl(),h=this.hasBit(this.anchorCorner,b.FLIP_RTL),p=this.hasBit(this.anchorCorner,b.RIGHT)||this.hasBit(i,b.RIGHT),f=!1;(f=l&&h?!p:p)?(u=r.left+s.width+this.anchorMargin.right,d=r.right-this.anchorMargin.right):(u=r.left+this.anchorMargin.left,d=r.right+s.width-this.anchorMargin.left);var m=u-a.width>0,E=d-a.width>0,I=this.hasBit(i,b.FLIP_RTL)&&this.hasBit(i,b.RIGHT);return E&&I&&l||!m&&I?i=this.unsetBit(i,b.RIGHT):(m&&f&&l||m&&!f&&p||!E&&u>=d)&&(i=this.setBit(i,b.RIGHT)),i},e.prototype.getMenuSurfaceMaxHeight=function(t){if(this.maxHeight>0)return this.maxHeight;var n=this.measurements.viewportDistance,i=0,o=this.hasBit(t,b.BOTTOM),r=this.hasBit(this.anchorCorner,b.BOTTOM),s=e.numbers.MARGIN_TO_EDGE;return o?(i=n.top+this.anchorMargin.top-s,r||(i+=this.measurements.anchorSize.height)):(i=n.bottom-this.anchorMargin.bottom+this.measurements.anchorSize.height-s,r&&(i-=this.measurements.anchorSize.height)),i},e.prototype.getHorizontalOriginOffset=function(t){var e=this.measurements.anchorSize,n=this.hasBit(t,b.RIGHT),i=this.hasBit(this.anchorCorner,b.RIGHT);if(n){var o=i?e.width-this.anchorMargin.left:this.anchorMargin.right;return this.isHoistedElement||this.isFixedPosition?o-(this.measurements.viewportSize.width-this.measurements.bodySize.width):o}return i?e.width-this.anchorMargin.right:this.anchorMargin.left},e.prototype.getVerticalOriginOffset=function(t){var e=this.measurements.anchorSize,n=this.hasBit(t,b.BOTTOM),i=this.hasBit(this.anchorCorner,b.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,o=i.windowScroll,r=i.viewportDistance,s=i.surfaceSize,a=i.viewportSize,c=Object.keys(t);try{for(var u=y(c),d=u.next();!d.done;d=u.next()){var l=d.value,h=t[l]||0;!this.isHorizontallyCenteredOnViewport||"left"!==l&&"right"!==l?(h+=r[l],this.isFixedPosition||("top"===l?h+=o.y:"bottom"===l?h-=o.y:"left"===l?h+=o.x:h-=o.x),t[l]=h):t[l]=(a.width-s.width)/2}}catch(p){e={error:p}}finally{try{d&&!d.done&&(n=u.return)&&n.call(u)}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()}),B.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}(g),Mt={animation:{prefixed:"-webkit-animation",standard:"animation"},transform:{prefixed:"-webkit-transform",standard:"transform"},transition:{prefixed:"-webkit-transition",standard:"transition"}};function Ft(t){return Boolean(t.document)&&"function"===typeof t.document.createElement}var wt,Pt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return E(e,t),e.attachTo=function(t){return new e(t)},e.protot