text: /**
   * Copyright 2018 The Pennsylvania State University
   * @license Apache-2.0, see License.md for full text.
   */
  import{html as e,css as t}from"../../../lit-element/lit-element.js";import{SimpleColors as s}from"../simple-colors.js";import"../../simple-picker/simple-picker.js";class SimpleColorsPicker extends s{static get styles(){return[...super.styles,t`
          :host {
            display: inline-block;
          }
          :host([hidden]) {
            display: none;
          }
        `]}render(){return e`
        <simple-picker
          id="picker"
          ?block-label="${this.blockLabel}"
          ?disabled="${this.disabled}"
          ?expanded="${this.expanded}"
          ?hide-option-labels="${this.shades}"
          @change="${this._handleChange}"
          @collapse="${this._handleCollapse}"
          @expand="${this._handleExpand}"
          @option-focus="${this._handleOptionFocus}"
          .aria-labelledby="${this.ariaLabelledby}"
          .label="${this.label}"
          .options="${this.options}"
          .value="${this.value}"
        >
        </simple-picker>
      `}constructor(){super(),this.ariaLabelledby=null,this.blockLabel=!1,this.disabled=!1,this.expanded=!1,this.label=null,this.shades=!1,this.value=null,this.__ready=!1,this.options=this._getOptions(this.colors,this.shades,this.dark)}updated(e){e.forEach((e,t)=>{"colors"===t&&(this.options=this._getOptions(this.colors,this.shades,this.dark)),"shades"===t&&(this.options=this._getOptions(this.colors,this.shades,this.dark)),"dark"===t&&(this.options=this._getOptions(this.colors,this.shades,this.dark)),"value"===t&&this._fireValueChangedEvent(),this._fireChangeEvent()})}static get properties(){return{...super.properties,ariaLabelledby:{type:String,attribute:"aria-labelledby"},blockLabel:{type:Boolean,attribute:"block-label"},disabled:{type:Boolean},expanded:{type:Boolean,reflect:!0},label:{type:String},options:{type:Array,reflect:!1},shades:{type:Boolean,reflect:!0},value:{type:String,reflect:!0},__ready:{type:Boolean}}}static get tag(){return"simple-colors-picker"}_getOptions(e,t,s){let i=[[]],l=!1!==s?"dark":"default";if(!1===t)i=Object.keys(this.colors).map(e=>[{alt:e,value:e}]),i.unshift([{alt:"none",value:null}]);else{let t=Object.keys(e);for(let s=0;s<e[t[0]].length;s++){let t=Object.keys(e).map(e=>{let t=e+"-"+(s+1),i="--simple-colors-"+l+"-theme-"+t;return{alt:t,style:"background-color: var("+i+")",value:i}});i.push(t)}}return i}_fireValueChangedEvent(){this.dispatchEvent(new CustomEvent("value-changed",{detail:this}))}_fireChangeEvent(){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:this}))}_handleChange(e){this.value=e.detail.value,void 0!==this.__ready&&this._fireChangeEvent()}_handleCollapse(){void 0!==this.__ready&&this.dispatchEvent(new CustomEvent("collapse",{detail:this}))}_handleExpand(){void 0!==this.__ready&&this.dispatchEvent(new CustomEvent("expand",{detail:this}))}_handleOptionFocus(e){void 0!==this.__ready&&this.dispatchEvent(new CustomEvent("option-focus",{detail:this}))}}export{SimpleColorsPicker};window.customElements.define(SimpleColorsPicker.tag,SimpleColorsPicker);