import { ElementIDUtils, ObjectUtils } from '@sankhyalabs/core';
import { forceUpdate, h, Host } from '@stencil/core';
import { defaultIconResolver, defaultTooltipResolver } from './subcomponents';
import { TreeItem } from './subcomponents/TreeItem';
import { Tree } from './types/Tree';
import initI18n from '../../utils/i18n';
export class EzTree {
  constructor() {
    this._onItemClick = (item) => {
      if (!this.selectable) {
        this.openClose(item);
        return;
      }
      if (this.value && this.value.id === item.id) {
        this.value = undefined;
        return;
      }
      this.value = item;
    };
    this._onIconClick = (item) => {
      this.openClose(item);
    };
    this._tree = new Tree(() => forceUpdate(this));
    this._waintingForLoad = undefined;
    this.items = [];
    this.value = undefined;
    this.selectedId = undefined;
    this.iconResolver = defaultIconResolver;
    this.tooltipResolver = undefined;
    this.enableHierarchicalFilter = true;
    this.selectable = true;
  }
  /**
   * Efetua a seleção de um item.
   */
  async selectItem(id) {
    const node = this._tree.getNode(id);
    if (node) {
      this.value = node.item;
    }
    else {
      this.value = undefined;
    }
  }
  /**
   * Realiza a abertura de um item, incluindo a hieraquia acima.
   * Observação para carga dinâmica (Lazyload): O item solicitado já deve
   * estar carregado na lista. Nos casos onde o item ainda não esteja
   * carregado o id pode ser uma string no formato "id1>>id2>>id3",
   * tornando possível a carga a partir de um ponto já carregado.
   */
  async openItem(id) {
    this._waintingForLoad = true;
    await this._tree.open(id);
    this._waintingForLoad = false;
  }
  /**
   * Desabilita um ou mais itens.
   */
  async disableItem(id) {
    [].concat(id).forEach(item => this._tree.setDisabled(item, true));
  }
  /**
  * Habilita um ou mais itens.
  */
  async enableItem(id) {
    [].concat(id).forEach(item => this._tree.setDisabled(item, false));
  }
  /**
   * Adiciona um ou mais itens. Opcionalmente pode-se determinar a qual
   * item da árvore será anexado o item. Caso não informado parentId,
   * adiciona no item selecionado.
   * Observação para carga dinâmica (Lazyload): O parentId deve ser
   * um item carregado atualmente na árvore.
   */
  async addChild(item, parentId) {
    var _a;
    if (parentId == undefined) {
      parentId = (_a = this.value) === null || _a === void 0 ? void 0 : _a.id;
    }
    this._tree.addChildAt(parentId, item);
    this.addItemInIndexedList(parentId, item);
    const node = this._tree.getNode(parentId);
    if (node) {
      node.item.expanded = true;
    }
    else {
      this.collapseAll();
    }
  }
  /**
   * Efetua a seleção de um item.
   */
  async applyFilter(pattern) {
    await this._tree.setFilterPattern(pattern, this.enableHierarchicalFilter);
  }
  /**
   * Expande todos os itens da árvore.
   */
  async expandAll() {
    this._tree.expandAll();
  }
  /**
   * Recolhe todos os itens da árvore.
   */
  async collapseAll() {
    this._tree.collapseAll();
  }
  /**
   * Atualiza um item
   */
  async updateItem(item, config) {
    var _a, _b, _c;
    if (Array.isArray(item)) {
      item.forEach(i => this.updateItem(i, config));
      return;
    }
    if (config === null || config === void 0 ? void 0 : config.updatedBySelectedId) {
      Object.assign(item, { id: this.selectedId });
    }
    this._tree.updateItem((config === null || config === void 0 ? void 0 : config.forceDefaultValues) ? this.applyDefaultValues(item) : item);
    this.updateItemInIndexedList(item, config === null || config === void 0 ? void 0 : config.forceDefaultValues);
    const node = (_a = this._tree) === null || _a === void 0 ? void 0 : _a.getNode(this.selectedId);
    if (node == undefined) {
      this.value = this._visibleItems ? this._visibleItems[0] : undefined;
      this._tree.collapseAll();
    }
    if (((_b = this.value) === null || _b === void 0 ? void 0 : _b.id) === item.id) {
      this.value = item;
      this.ezChange.emit(this.value);
      return;
    }
    const childSelected = this.getItemById((_c = this.value) === null || _c === void 0 ? void 0 : _c.id, [item]);
    if (childSelected) {
      this.value = childSelected;
      this.ezChange.emit(this.value);
    }
  }
  /**
   * Remove um item da árvore pelo seu ID.
   * Se o item removido estiver selecionado, a seleção será limpa.
   */
  async removeItem(id) {
    var _a;
    id = id !== null && id !== void 0 ? id : this.selectedId;
    if (!id) {
      return;
    }
    this._tree.removeItem(id);
    this.removeItemFromIndexedList(id);
    this.ezRemoveItem.emit(id);
    if (((_a = this.value) === null || _a === void 0 ? void 0 : _a.id) === id) {
      this.value = undefined;
    }
  }
  /**
   * Obtem um item pelo id
   */
  async getItem(id) {
    return new Promise(resolve => {
      const node = this._tree.getNode(id);
      resolve(node === null || node === void 0 ? void 0 : node.item);
    });
  }
  /**
   * Obtem um array do caminho de itens da seleção atual.
   * @returns Retorna um array do caminho de itens da seleção atual.
   */
  async getCurrentPath() {
    var _a, _b, _c;
    const node = (_a = this._tree) === null || _a === void 0 ? void 0 : _a.getNode(this.selectedId);
    if (node == undefined) {
      return;
    }
    const currentPath = [];
    let parentNode;
    let parentItem = (_b = node.parent) === null || _b === void 0 ? void 0 : _b.item;
    currentPath.push(this.getItemPathAttrs(node.item));
    while (parentItem != undefined) {
      currentPath.unshift(this.getItemPathAttrs(parentItem));
      parentNode = this._tree.getNode(parentItem.id);
      parentItem = (_c = parentNode === null || parentNode === void 0 ? void 0 : parentNode.parent) === null || _c === void 0 ? void 0 : _c.item;
    }
    return currentPath;
  }
  /**
   * Obtem o item pai a partir de um id
   */
  async getParent(id) {
    return new Promise(resolve => {
      var _a;
      const node = this._tree.getNode(id);
      if (node) {
        resolve((_a = node.parent) === null || _a === void 0 ? void 0 : _a.item);
      }
      resolve(undefined);
    });
  }
  observeItems(newValue, oldValue) {
    if (ObjectUtils.objectToString(newValue) !== ObjectUtils.objectToString(oldValue)) {
      this._tree.load(this.items || []);
    }
  }
  observeValue() {
    var _a;
    this.ezChange.emit(this.value);
    this.selectedId = (_a = this.value) === null || _a === void 0 ? void 0 : _a.id;
  }
  onKeyDownListener(event) {
    if (!this.value) {
      return;
    }
    let stop = false;
    switch (event.key) {
      case "ArrowUp":
        this.previousItem();
        stop = true;
        break;
      case "ArrowDown":
        this.nextItem();
        stop = true;
        break;
      case "ArrowLeft":
        this.previousLevel();
        stop = true;
        break;
      case "ArrowRight":
        this.nextLevel();
        stop = true;
        break;
      case " ":
        this.openClose(this.value);
        stop = true;
        break;
    }
    if (stop) {
      event.stopPropagation();
      event.preventDefault();
    }
  }
  getItemById(id, items) {
    for (const treeItem of items) {
      if (treeItem.id === id) {
        return treeItem;
      }
      else if (treeItem.children && Array.isArray(treeItem.children)) {
        const itemFound = this.getItemById(id, treeItem.children);
        if (itemFound) {
          return itemFound;
        }
      }
    }
    return undefined;
  }
  addItemInIndexedList(parentId, item, items) {
    var _a, _b;
    items = (_a = items !== null && items !== void 0 ? items : this.items) !== null && _a !== void 0 ? _a : [];
    if (!parentId) {
      items.push(item);
    }
    const itemFound = this.getItemById(parentId, items);
    itemFound.children = ((_b = itemFound.children) !== null && _b !== void 0 ? _b : []);
    itemFound.children.push(item);
    itemFound.childrenCount = itemFound.children.length;
  }
  applyDefaultValues(item) {
    if (item.disabled === undefined) {
      item.disabled = false;
    }
    if (item.expanded === undefined) {
      item.expanded = false;
    }
    return item;
  }
  updateItemInIndexedList(item, forceDefaultValues = false) {
    if (!item || !this.items) {
      return;
    }
    const itemFound = this.getItemById(item.id, this.items);
    if (itemFound) {
      Object.assign(itemFound, forceDefaultValues ? this.applyDefaultValues(item) : item);
    }
  }
  removeItemFromIndexedList(id, items) {
    var _a;
    items = (_a = items !== null && items !== void 0 ? items : this.items) !== null && _a !== void 0 ? _a : [];
    if (!id) {
      return false;
    }
    const rootIndex = items.findIndex(item => item.id === id);
    if (rootIndex !== -1) {
      items.splice(rootIndex, 1);
      return true;
    }
    for (const treeItem of items) {
      if (treeItem.children && Array.isArray(treeItem.children)) {
        const childIndex = treeItem.children.findIndex(child => child.id === id);
        if (childIndex !== -1) {
          treeItem.children.splice(childIndex, 1);
          treeItem.childrenCount = treeItem.children.length;
          return true;
        }
        if (this.removeItemFromIndexedList(id, treeItem.children)) {
          return true;
        }
      }
    }
    return false;
  }
  getItemPathAttrs({ id, label }) {
    return { id, label };
  }
  openClose(item) {
    if (item == undefined) {
      return;
    }
    const expanded = !item.expanded;
    item.expanded = expanded;
    if (expanded) {
      this.ezOpenItem.emit(item);
    }
    this._tree.updateItem(item);
  }
  previousLevel() {
    var _a;
    if (!this.value) {
      return;
    }
    if (this.value.expanded) {
      this.value.expanded = false;
      this._tree.updateItem(this.value);
    }
    else {
      const node = this._tree.getNode(this.value.id);
      const parentItem = (_a = node.parent) === null || _a === void 0 ? void 0 : _a.item;
      if (parentItem) {
        this.value = parentItem;
      }
    }
  }
  nextLevel() {
    if (!this.value) {
      return;
    }
    const node = this._tree.getNode(this.value.id);
    if (!node.isExpandable()) {
      return;
    }
    if (this.value.expanded) {
      this.nextItem();
    }
    else {
      this.value.expanded = true;
      this._tree.updateItem(this.value);
    }
  }
  indexOf(id) {
    if (id == undefined) {
      return -1;
    }
    for (let i = 0; i < this._visibleItems.length; i++) {
      const item = this._visibleItems[i];
      if (item.id === id) {
        return i;
      }
    }
    return -1;
  }
  selectNextItem(indexIncrement) {
    var _a;
    const nextIndex = this.indexOf((_a = this.value) === null || _a === void 0 ? void 0 : _a.id) + indexIncrement;
    if (nextIndex > -1 && nextIndex < this._visibleItems.length) {
      this.value = this._visibleItems[nextIndex];
    }
  }
  nextItem() {
    this.selectNextItem(1);
  }
  previousItem() {
    this.selectNextItem(-1);
  }
  connectedCallback() {
    if (this.items) {
      this._tree.load(this.items);
    }
  }
  async componentWillLoad() {
    this.i18n = await initI18n();
  }
  componentWillRender() {
    var _a;
    if (!this.selectedId || ((_a = this.value) === null || _a === void 0 ? void 0 : _a.id) === this.selectedId) {
      return;
    }
    const node = this._tree.getNode(this.selectedId);
    if (node) {
      this.value = node.item;
    }
  }
  render() {
    ElementIDUtils.addIDInfoIfNotExists(this._element, 'ezTree');
    if (this.items == undefined) {
      return;
    }
    this._visibleItems = [];
    return (h(Host, { tabindex: "-1" }, this._waintingForLoad ?
      h("label", null, this.i18n("app.loading"), "...")
      :
        this._tree.getChildren().map(node => {
          var _a;
          return h(TreeItem, { selectedId: (_a = this.value) === null || _a === void 0 ? void 0 : _a.id, node: node, itemClick: this._onItemClick, iconClick: this._onIconClick, iconResolver: this.iconResolver, tooltipResolver: this.tooltipResolver || defaultTooltipResolver, itemsList: this._visibleItems, itemDoubleClick: (item) => this.ezDbClickItem.emit(item) });
        })));
  }
  static get is() { return "ez-tree"; }
  static get encapsulation() { return "shadow"; }
  static get originalStyleUrls() {
    return {
      "$": ["ez-tree.css"]
    };
  }
  static get styleUrls() {
    return {
      "$": ["ez-tree.css"]
    };
  }
  static get properties() {
    return {
      "items": {
        "type": "unknown",
        "mutable": true,
        "complexType": {
          "original": "Array<ITreeItem>",
          "resolved": "ITreeItem[]",
          "references": {
            "Array": {
              "location": "global"
            },
            "ITreeItem": {
              "location": "import",
              "path": "./interfaces/ITreeItem"
            }
          }
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Define os itens apresentados na \u00E1rvore."
        },
        "defaultValue": "[]"
      },
      "value": {
        "type": "unknown",
        "mutable": true,
        "complexType": {
          "original": "ITreeItem",
          "resolved": "ITreeItem",
          "references": {
            "ITreeItem": {
              "location": "import",
              "path": "./interfaces/ITreeItem"
            }
          }
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Define o item selecionado na \u00E1rvore."
        }
      },
      "selectedId": {
        "type": "string",
        "mutable": true,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Forma alternativa para atribuir o item selecionado por seu ID."
        },
        "attribute": "selected-id",
        "reflect": true
      },
      "iconResolver": {
        "type": "unknown",
        "mutable": false,
        "complexType": {
          "original": "(item: ITreeItem, expanded: boolean, level: number) => string",
          "resolved": "(item: ITreeItem, expanded: boolean, level: number) => string",
          "references": {
            "ITreeItem": {
              "location": "import",
              "path": "./interfaces/ITreeItem"
            }
          }
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Define uma fun\u00E7\u00E3o que vai resolver o \u00EDcone daquele item. Retorna o nome do \u00EDcone da lib de icones do DS."
        },
        "defaultValue": "defaultIconResolver"
      },
      "tooltipResolver": {
        "type": "unknown",
        "mutable": false,
        "complexType": {
          "original": "(item: ITreeItem, enabled: boolean, level: number) => string",
          "resolved": "(item: ITreeItem, enabled: boolean, level: number) => string",
          "references": {
            "ITreeItem": {
              "location": "import",
              "path": "./interfaces/ITreeItem"
            }
          }
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Define uma fun\u00E7\u00E3o que vai resolver o `tooltip` ou `title` daquele item."
        }
      },
      "enableHierarchicalFilter": {
        "type": "boolean",
        "mutable": false,
        "complexType": {
          "original": "boolean",
          "resolved": "boolean",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Define se a \u00E1rvore deve permitir a filtragem hier\u00E1rquica."
        },
        "attribute": "enable-hierarchical-filter",
        "reflect": false,
        "defaultValue": "true"
      },
      "selectable": {
        "type": "boolean",
        "mutable": false,
        "complexType": {
          "original": "boolean",
          "resolved": "boolean",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Define se os itens da \u00E1rvore s\u00E3o selecion\u00E1veis."
        },
        "attribute": "selectable",
        "reflect": false,
        "defaultValue": "true"
      }
    };
  }
  static get states() {
    return {
      "_tree": {},
      "_waintingForLoad": {}
    };
  }
  static get events() {
    return [{
        "method": "ezChange",
        "name": "ezChange",
        "bubbles": true,
        "cancelable": true,
        "composed": true,
        "docs": {
          "tags": [],
          "text": "Emitido quando um item \u00E9 selecionado na \u00E1rvore."
        },
        "complexType": {
          "original": "ITreeItem",
          "resolved": "ITreeItem",
          "references": {
            "ITreeItem": {
              "location": "import",
              "path": "./interfaces/ITreeItem"
            }
          }
        }
      }, {
        "method": "ezOpenItem",
        "name": "ezOpenItem",
        "bubbles": true,
        "cancelable": true,
        "composed": true,
        "docs": {
          "tags": [],
          "text": "Emitido quando um item \u00E9 aberto na \u00E1rvore."
        },
        "complexType": {
          "original": "ITreeItem",
          "resolved": "ITreeItem",
          "references": {
            "ITreeItem": {
              "location": "import",
              "path": "./interfaces/ITreeItem"
            }
          }
        }
      }, {
        "method": "ezDbClickItem",
        "name": "ezDbClickItem",
        "bubbles": true,
        "cancelable": true,
        "composed": true,
        "docs": {
          "tags": [],
          "text": "Emitido ao dar clique duplo em um item da \u00E1rvore."
        },
        "complexType": {
          "original": "ITreeItem",
          "resolved": "ITreeItem",
          "references": {
            "ITreeItem": {
              "location": "import",
              "path": "./interfaces/ITreeItem"
            }
          }
        }
      }, {
        "method": "ezRemoveItem",
        "name": "ezRemoveItem",
        "bubbles": true,
        "cancelable": true,
        "composed": true,
        "docs": {
          "tags": [],
          "text": "Emitido ao remover um item da \u00E1rvore."
        },
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        }
      }];
  }
  static get methods() {
    return {
      "selectItem": {
        "complexType": {
          "signature": "(id: string) => Promise<void>",
          "parameters": [{
              "tags": [],
              "text": ""
            }],
          "references": {
            "Promise": {
              "location": "global"
            }
          },
          "return": "Promise<void>"
        },
        "docs": {
          "text": "Efetua a sele\u00E7\u00E3o de um item.",
          "tags": []
        }
      },
      "openItem": {
        "complexType": {
          "signature": "(id: string) => Promise<void>",
          "parameters": [{
              "tags": [],
              "text": ""
            }],
          "references": {
            "Promise": {
              "location": "global"
            }
          },
          "return": "Promise<void>"
        },
        "docs": {
          "text": "Realiza a abertura de um item, incluindo a hieraquia acima.\nObserva\u00E7\u00E3o para carga din\u00E2mica (Lazyload): O item solicitado j\u00E1 deve\nestar carregado na lista. Nos casos onde o item ainda n\u00E3o esteja \ncarregado o id pode ser uma string no formato \"id1>>id2>>id3\",\ntornando poss\u00EDvel a carga a partir de um ponto j\u00E1 carregado.",
          "tags": []
        }
      },
      "disableItem": {
        "complexType": {
          "signature": "(id: string | Array<string>) => Promise<void>",
          "parameters": [{
              "tags": [],
              "text": ""
            }],
          "references": {
            "Promise": {
              "location": "global"
            },
            "Array": {
              "location": "global"
            }
          },
          "return": "Promise<void>"
        },
        "docs": {
          "text": "Desabilita um ou mais itens.",
          "tags": []
        }
      },
      "enableItem": {
        "complexType": {
          "signature": "(id: string | Array<string>) => Promise<void>",
          "parameters": [{
              "tags": [],
              "text": ""
            }],
          "references": {
            "Promise": {
              "location": "global"
            },
            "Array": {
              "location": "global"
            }
          },
          "return": "Promise<void>"
        },
        "docs": {
          "text": "Habilita um ou mais itens.",
          "tags": []
        }
      },
      "addChild": {
        "complexType": {
          "signature": "(item: ITreeItem, parentId?: string) => Promise<void>",
          "parameters": [{
              "tags": [],
              "text": ""
            }, {
              "tags": [],
              "text": ""
            }],
          "references": {
            "Promise": {
              "location": "global"
            },
            "ITreeItem": {
              "location": "import",
              "path": "./interfaces/ITreeItem"
            }
          },
          "return": "Promise<void>"
        },
        "docs": {
          "text": "Adiciona um ou mais itens. Opcionalmente pode-se determinar a qual\nitem da \u00E1rvore ser\u00E1 anexado o item. Caso n\u00E3o informado parentId,\nadiciona no item selecionado.\nObserva\u00E7\u00E3o para carga din\u00E2mica (Lazyload): O parentId deve ser\num item carregado atualmente na \u00E1rvore.",
          "tags": []
        }
      },
      "applyFilter": {
        "complexType": {
          "signature": "(pattern: string) => Promise<void>",
          "parameters": [{
              "tags": [],
              "text": ""
            }],
          "references": {
            "Promise": {
              "location": "global"
            }
          },
          "return": "Promise<void>"
        },
        "docs": {
          "text": "Efetua a sele\u00E7\u00E3o de um item.",
          "tags": []
        }
      },
      "expandAll": {
        "complexType": {
          "signature": "() => Promise<void>",
          "parameters": [],
          "references": {
            "Promise": {
              "location": "global"
            }
          },
          "return": "Promise<void>"
        },
        "docs": {
          "text": "Expande todos os itens da \u00E1rvore.",
          "tags": []
        }
      },
      "collapseAll": {
        "complexType": {
          "signature": "() => Promise<void>",
          "parameters": [],
          "references": {
            "Promise": {
              "location": "global"
            }
          },
          "return": "Promise<void>"
        },
        "docs": {
          "text": "Recolhe todos os itens da \u00E1rvore.",
          "tags": []
        }
      },
      "updateItem": {
        "complexType": {
          "signature": "(item: ITreeItem | ITreeItem[], config?: Partial<UpdateItemConfig>) => Promise<void>",
          "parameters": [{
              "tags": [],
              "text": ""
            }, {
              "tags": [],
              "text": ""
            }],
          "references": {
            "Promise": {
              "location": "global"
            },
            "ITreeItem": {
              "location": "import",
              "path": "./interfaces/ITreeItem"
            },
            "Partial": {
              "location": "global"
            },
            "UpdateItemConfig": {
              "location": "import",
              "path": "./types/UpdateItemConfig"
            }
          },
          "return": "Promise<void>"
        },
        "docs": {
          "text": "Atualiza um item",
          "tags": []
        }
      },
      "removeItem": {
        "complexType": {
          "signature": "(id?: string) => Promise<void>",
          "parameters": [{
              "tags": [],
              "text": ""
            }],
          "references": {
            "Promise": {
              "location": "global"
            }
          },
          "return": "Promise<void>"
        },
        "docs": {
          "text": "Remove um item da \u00E1rvore pelo seu ID.\nSe o item removido estiver selecionado, a sele\u00E7\u00E3o ser\u00E1 limpa.",
          "tags": []
        }
      },
      "getItem": {
        "complexType": {
          "signature": "(id: string) => Promise<ITreeItem>",
          "parameters": [{
              "tags": [],
              "text": ""
            }],
          "references": {
            "Promise": {
              "location": "global"
            },
            "ITreeItem": {
              "location": "import",
              "path": "./interfaces/ITreeItem"
            }
          },
          "return": "Promise<ITreeItem>"
        },
        "docs": {
          "text": "Obtem um item pelo id",
          "tags": []
        }
      },
      "getCurrentPath": {
        "complexType": {
          "signature": "() => Promise<Array<ITreeItem>>",
          "parameters": [],
          "references": {
            "Promise": {
              "location": "global"
            },
            "ITreeItem": {
              "location": "import",
              "path": "./interfaces/ITreeItem"
            },
            "Array": {
              "location": "global"
            },
            "Node": {
              "location": "import",
              "path": "./types/Node"
            }
          },
          "return": "Promise<ITreeItem[]>"
        },
        "docs": {
          "text": "Obtem um array do caminho de itens da sele\u00E7\u00E3o atual.",
          "tags": [{
              "name": "returns",
              "text": "Retorna um array do caminho de itens da sele\u00E7\u00E3o atual."
            }]
        }
      },
      "getParent": {
        "complexType": {
          "signature": "(id: string) => Promise<ITreeItem>",
          "parameters": [{
              "tags": [],
              "text": ""
            }],
          "references": {
            "Promise": {
              "location": "global"
            },
            "ITreeItem": {
              "location": "import",
              "path": "./interfaces/ITreeItem"
            }
          },
          "return": "Promise<ITreeItem>"
        },
        "docs": {
          "text": "Obtem o item pai a partir de um id",
          "tags": []
        }
      }
    };
  }
  static get elementRef() { return "_element"; }
  static get watchers() {
    return [{
        "propName": "items",
        "methodName": "observeItems"
      }, {
        "propName": "value",
        "methodName": "observeValue"
      }];
  }
  static get listeners() {
    return [{
        "name": "keydown",
        "method": "onKeyDownListener",
        "target": undefined,
        "capture": true,
        "passive": false
      }];
  }
}
