text: import"../polymer/polymer-legacy.js";import"../iron-a11y-keys-behavior/iron-a11y-keys-behavior.js";import"../iron-icon/iron-icon.js";import"../paper-input/paper-input.js";import"../paper-menu-button/paper-menu-button.js";import"../paper-ripple/paper-ripple.js";import"../paper-styles/default-theme.js";import"./paper-dropdown-menu-icons.js";import"./paper-dropdown-menu-shared-styles.js";import{IronButtonState}from"../iron-behaviors/iron-button-state.js";import{IronControlState}from"../iron-behaviors/iron-control-state.js";import{IronFormElementBehavior}from"../iron-form-element-behavior/iron-form-element-behavior.js";import{IronValidatableBehavior}from"../iron-validatable-behavior/iron-validatable-behavior.js";import{Polymer}from"../polymer/lib/legacy/polymer-fn.js";import{dom}from"../polymer/lib/legacy/polymer.dom.js";import*as gestures from"../polymer/lib/utils/gestures.js";import{html}from"../polymer/lib/utils/html-tag.js";Polymer({_template:html`
      <style include="paper-dropdown-menu-shared-styles"></style>
  
      <!-- this div fulfills an a11y requirement for combobox, do not remove -->
      <span role="button"></span>
      <paper-menu-button id="menuButton" vertical-align="[[verticalAlign]]" horizontal-align="[[horizontalAlign]]" dynamic-align="[[dynamicAlign]]" vertical-offset="[[_computeMenuVerticalOffset(noLabelFloat, verticalOffset)]]" disabled="[[disabled]]" no-animations="[[noAnimations]]" on-iron-select="_onIronSelect" on-iron-deselect="_onIronDeselect" opened="{{opened}}" close-on-activate allow-outside-scroll="[[allowOutsideScroll]]" restore-focus-on-close="[[restoreFocusOnClose]]">
        <!-- support hybrid mode: user might be using paper-menu-button 1.x which distributes via <content> -->
        <div class="dropdown-trigger" slot="dropdown-trigger">
          <paper-ripple></paper-ripple>
          <!-- paper-input has type="text" for a11y, do not remove -->
          <paper-input type="text" invalid="[[invalid]]" readonly disabled="[[disabled]]" value="[[value]]" placeholder="[[placeholder]]" error-message="[[errorMessage]]" always-float-label="[[alwaysFloatLabel]]" no-label-float="[[noLabelFloat]]" label="[[label]]">
            <!-- support hybrid mode: user might be using paper-input 1.x which distributes via <content> -->
            <iron-icon icon="paper-dropdown-menu:arrow-drop-down" suffix slot="suffix"></iron-icon>
          </paper-input>
        </div>
        <slot id="content" name="dropdown-content" slot="dropdown-content"></slot>
      </paper-menu-button>
  `,is:"paper-dropdown-menu",behaviors:[IronButtonState,IronControlState,IronFormElementBehavior,IronValidatableBehavior],properties:{selectedItemLabel:{type:String,notify:!0,readOnly:!0},selectedItem:{type:Object,notify:!0,readOnly:!0},value:{type:String,notify:!0},label:{type:String},placeholder:{type:String},errorMessage:{type:String},opened:{type:Boolean,notify:!0,value:!1,observer:"_openedChanged"},allowOutsideScroll:{type:Boolean,value:!1},noLabelFloat:{type:Boolean,value:!1,reflectToAttribute:!0},alwaysFloatLabel:{type:Boolean,value:!1},noAnimations:{type:Boolean,value:!1},horizontalAlign:{type:String,value:"right"},verticalAlign:{type:String,value:"top"},verticalOffset:Number,dynamicAlign:{type:Boolean},restoreFocusOnClose:{type:Boolean,value:!0}},listeners:{tap:"_onTap"},keyBindings:{"up down":"open",esc:"close"},hostAttributes:{role:"combobox","aria-autocomplete":"none","aria-haspopup":"true"},observers:["_selectedItemChanged(selectedItem)"],attached:function(){var contentElement=this.contentElement;contentElement&&contentElement.selectedItem&&this._setSelectedItem(contentElement.selectedItem)},get contentElement(){for(var nodes=dom(this.$.content).getDistributedNodes(),i=0,l=nodes.length;i<l;i++)if(nodes[i].nodeType===Node.ELEMENT_NODE)return nodes[i]},open:function(){this.$.menuButton.open()},close:function(){this.$.menuButton.close()},_onIronSelect:function(event){this._setSelectedItem(event.detail.item)},_onIronDeselect:function(event){this._setSelectedItem(null)},_onTap:function(event){gestures.findOriginalTarget(event)===this&&this.open()},_selectedItemChanged:function(selectedItem){var value="";value=selectedItem?selectedItem.label||selectedItem.getAttribute("label")||selectedItem.textContent.trim():"",this.value=value,this._setSelectedItemLabel(value)},_computeMenuVerticalOffset:function(noLabelFloat,opt_verticalOffset){return opt_verticalOffset||(noLabelFloat?-4:8)},_getValidity:function(_value){return this.disabled||!this.required||this.required&&!!this.value},_openedChanged:function(){var openState=this.opened?"true":"false",e=this.contentElement;e&&e.setAttribute("aria-expanded",openState)}});