text: import{LitElement as e,html as t,css as i}from"../../../lit-element/lit-element.js";import"./hax-toolbar-menu.js";import"../../simple-tooltip/simple-tooltip.js";import"../../../@polymer/paper-item/paper-item.js";import"../../../@polymer/neon-animation/neon-animation.js";class HaxContextItemMenu extends e{static get styles(){return[i`
          :host {
            display: inline-flex;
            box-sizing: border-box;
          }
          :host(mini) {
            height: unset;
            width: unset;
          }
        `]}constructor(){super(),this._blockEvent=!1,this.selectedValue=0,this.action=!1,this.direction="top",this.icon="editor:text-fields",this.label="editor:text-fields"}render(){return t`
        <hax-toolbar-menu
          id="menu"
          ?mini="${this.mini}"
          ?action="${this.action}"
          .icon="${this.icon}"
          .tooltip="${this.label}"
          .tooltip-direction="${this.direction}"
          @selected-changed="${this.selectedValueChanged}"
          .selected="${this.selectedValue}"
        >
          <slot></slot>
        </hax-toolbar-menu>
      `}selectedValueChanged(e){this.selectedValue=e.detail}static get tag(){return"hax-context-item-menu"}updated(e){e.forEach((e,t)=>{"selectedValue"==t&&(this._selectedUpdated(this[t],e),this.dispatchEvent(new CustomEvent("selected-value-changed",{detail:this[t]})))})}static get properties(){return{mini:{type:Boolean,reflect:!0},action:{type:Boolean},_blockEvent:{type:Boolean},selectedValue:{type:Number,reflect:!0,attribute:"selected-value"},direction:{type:String},icon:{type:String,reflect:!0},label:{type:String,reflect:!0},eventName:{type:String,attribute:"event-name"}}}_selectedUpdated(e,t){if("object"!=typeof e&&void 0!==t&&"object"!=typeof t){let t=this.children;for(var i=new Object,n=0,o=0,l=t.length;o<l;o++)if("PAPER-ITEM"===t[o].tagName){if(n===e){i=t[o],l=o;continue}n++}this._blockEvent||void 0===i.attributes||void 0===i.attributes.value||void 0===i.attributes.value.value||(this.shadowRoot.querySelector("#menu").hideMenu(),this.eventName&&this.dispatchEvent(new CustomEvent("hax-context-item-selected",{bubbles:!0,cancelable:!0,composed:!0,detail:{target:i,eventName:this.eventName,value:i.attributes.value.value}}))),this._blockEvent&&(this._blockEvent=!1)}}}window.customElements.define(HaxContextItemMenu.tag,HaxContextItemMenu);export{HaxContextItemMenu};