(self["webpackJsonp"] = self["webpackJsonp"] || []).push([["panel-config-entities"],{

/***/ "./src/common/util/render-status.ts":
/*!******************************************!*\
  !*** ./src/common/util/render-status.ts ***!
  \******************************************/
/*! exports provided: afterNextRender, nextRender */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "afterNextRender", function() { return afterNextRender; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "nextRender", function() { return nextRender; });
const afterNextRender = cb => {
  requestAnimationFrame(() => setTimeout(cb, 0));
};
const nextRender = () => {
  return new Promise(resolve => {
    afterNextRender(resolve);
  });
};

/***/ }),

/***/ "./src/data/entity_registry.ts":
/*!*************************************!*\
  !*** ./src/data/entity_registry.ts ***!
  \*************************************/
/*! exports provided: computeEntityRegistryName, updateEntityRegistryEntry, removeEntityRegistryEntry, subscribeEntityRegistry */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "computeEntityRegistryName", function() { return computeEntityRegistryName; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "updateEntityRegistryEntry", function() { return updateEntityRegistryEntry; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeEntityRegistryEntry", function() { return removeEntityRegistryEntry; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "subscribeEntityRegistry", function() { return subscribeEntityRegistry; });
/* harmony import */ var _websocket_lib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../websocket/lib */ "./src/websocket/lib/index.ts");
/* harmony import */ var _common_entity_compute_state_name__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/entity/compute_state_name */ "./src/common/entity/compute_state_name.ts");
/* harmony import */ var _common_util_debounce__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/util/debounce */ "./src/common/util/debounce.ts");



const computeEntityRegistryName = (opp, entry) => {
  if (entry.name) {
    return entry.name;
  }

  const state = opp.states[entry.entity_id];
  return state ? Object(_common_entity_compute_state_name__WEBPACK_IMPORTED_MODULE_1__["computeStateName"])(state) : null;
};
const updateEntityRegistryEntry = (opp, entityId, updates) => opp.callWS(Object.assign({
  type: "config/entity_registry/update",
  entity_id: entityId
}, updates));
const removeEntityRegistryEntry = (opp, entityId) => opp.callWS({
  type: "config/entity_registry/remove",
  entity_id: entityId
});

const fetchEntityRegistry = conn => conn.sendMessagePromise({
  type: "config/entity_registry/list"
});

const subscribeEntityRegistryUpdates = (conn, store) => conn.subscribeEvents(Object(_common_util_debounce__WEBPACK_IMPORTED_MODULE_2__["debounce"])(() => fetchEntityRegistry(conn).then(entities => store.setState(entities, true)), 500, true), "entity_registry_updated");

const subscribeEntityRegistry = (conn, onChange) => Object(_websocket_lib__WEBPACK_IMPORTED_MODULE_0__["createCollection"])("_entityRegistry", fetchEntityRegistry, subscribeEntityRegistryUpdates, conn, onChange);

/***/ }),

/***/ "./src/panels/config/entities/op-config-entities.ts":
/*!**********************************************************!*\
  !*** ./src/panels/config/entities/op-config-entities.ts ***!
  \**********************************************************/
/*! exports provided: OpConfigEntities */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "OpConfigEntities", function() { return OpConfigEntities; });
/* harmony import */ var _polymer_paper_checkbox_paper_checkbox__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @polymer/paper-checkbox/paper-checkbox */ "./node_modules/@polymer/paper-checkbox/paper-checkbox.js");
/* harmony import */ var _polymer_paper_dropdown_menu_paper_dropdown_menu__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @polymer/paper-dropdown-menu/paper-dropdown-menu */ "./node_modules/@polymer/paper-dropdown-menu/paper-dropdown-menu.js");
/* harmony import */ var _polymer_paper_item_paper_icon_item__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @polymer/paper-item/paper-icon-item */ "./node_modules/@polymer/paper-item/paper-icon-item.js");
/* harmony import */ var _polymer_paper_listbox_paper_listbox__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @polymer/paper-listbox/paper-listbox */ "./node_modules/@polymer/paper-listbox/paper-listbox.js");
/* harmony import */ var _polymer_paper_tooltip_paper_tooltip__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @polymer/paper-tooltip/paper-tooltip */ "./node_modules/@polymer/paper-tooltip/paper-tooltip.js");
/* harmony import */ var lit_element__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! lit-element */ "./node_modules/lit-element/lit-element.js");
/* harmony import */ var lit_html_directives_style_map__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! lit-html/directives/style-map */ "./node_modules/lit-html/directives/style-map.js");
/* harmony import */ var memoize_one__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! memoize-one */ "./node_modules/memoize-one/dist/memoize-one.esm.js");
/* harmony import */ var _common_entity_compute_domain__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../../common/entity/compute_domain */ "./src/common/entity/compute_domain.ts");
/* harmony import */ var _common_entity_domain_icon__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../../common/entity/domain_icon */ "./src/common/entity/domain_icon.ts");
/* harmony import */ var _common_entity_state_icon__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../../common/entity/state_icon */ "./src/common/entity/state_icon.ts");
/* harmony import */ var _components_op_icon__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../../components/op-icon */ "./src/components/op-icon.ts");
/* harmony import */ var _common_search_search_input__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../../common/search/search-input */ "./src/common/search/search-input.ts");
/* harmony import */ var _data_entity_registry__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../../../data/entity_registry */ "./src/data/entity_registry.ts");
/* harmony import */ var _dialogs_generic_show_dialog_box__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../../../dialogs/generic/show-dialog-box */ "./src/dialogs/generic/show-dialog-box.ts");
/* harmony import */ var _layouts_opp_loading_screen__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../../../layouts/opp-loading-screen */ "./src/layouts/opp-loading-screen.ts");
/* harmony import */ var _layouts_opp_tabs_subpage_data_table__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../../../layouts/opp-tabs-subpage-data-table */ "./src/layouts/opp-tabs-subpage-data-table.ts");
/* harmony import */ var _mixins_subscribe_mixin__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../../../mixins/subscribe-mixin */ "./src/mixins/subscribe-mixin.ts");
/* harmony import */ var _show_dialog_entity_registry_detail__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./show-dialog-entity-registry-detail */ "./src/panels/config/entities/show-dialog-entity-registry-detail.ts");
/* harmony import */ var _op_panel_config__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../op-panel-config */ "./src/panels/config/op-panel-config.ts");
/* harmony import */ var lit_html_directives_class_map__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! lit-html/directives/class-map */ "./node_modules/lit-html/directives/class-map.js");
/* harmony import */ var _common_entity_compute_state_name__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../../../common/entity/compute_state_name */ "./src/common/entity/compute_state_name.ts");
function _decorate(decorators, factory, superClass, mixins) { var api = _getDecoratorsApi(); if (mixins) { for (var i = 0; i < mixins.length; i++) { api = mixins[i](api); } } var r = factory(function initialize(O) { api.initializeInstanceElements(O, decorated.elements); }, superClass); var decorated = api.decorateClass(_coalesceClassElements(r.d.map(_createElementDescriptor)), decorators); api.initializeClassElements(r.F, decorated.elements); return api.runClassFinishers(r.F, decorated.finishers); }

function _getDecoratorsApi() { _getDecoratorsApi = function () { return api; }; var api = { elementsDefinitionOrder: [["method"], ["field"]], initializeInstanceElements: function (O, elements) { ["method", "field"].forEach(function (kind) { elements.forEach(function (element) { if (element.kind === kind && element.placement === "own") { this.defineClassElement(O, element); } }, this); }, this); }, initializeClassElements: function (F, elements) { var proto = F.prototype; ["method", "field"].forEach(function (kind) { elements.forEach(function (element) { var placement = element.placement; if (element.kind === kind && (placement === "static" || placement === "prototype")) { var receiver = placement === "static" ? F : proto; this.defineClassElement(receiver, element); } }, this); }, this); }, defineClassElement: function (receiver, element) { var descriptor = element.descriptor; if (element.kind === "field") { var initializer = element.initializer; descriptor = { enumerable: descriptor.enumerable, writable: descriptor.writable, configurable: descriptor.configurable, value: initializer === void 0 ? void 0 : initializer.call(receiver) }; } Object.defineProperty(receiver, element.key, descriptor); }, decorateClass: function (elements, decorators) { var newElements = []; var finishers = []; var placements = { static: [], prototype: [], own: [] }; elements.forEach(function (element) { this.addElementPlacement(element, placements); }, this); elements.forEach(function (element) { if (!_hasDecorators(element)) return newElements.push(element); var elementFinishersExtras = this.decorateElement(element, placements); newElements.push(elementFinishersExtras.element); newElements.push.apply(newElements, elementFinishersExtras.extras); finishers.push.apply(finishers, elementFinishersExtras.finishers); }, this); if (!decorators) { return { elements: newElements, finishers: finishers }; } var result = this.decorateConstructor(newElements, decorators); finishers.push.apply(finishers, result.finishers); result.finishers = finishers; return result; }, addElementPlacement: function (element, placements, silent) { var keys = placements[element.placement]; if (!silent && keys.indexOf(element.key) !== -1) { throw new TypeError("Duplicated element (" + element.key + ")"); } keys.push(element.key); }, decorateElement: function (element, placements) { var extras = []; var finishers = []; for (var decorators = element.decorators, i = decorators.length - 1; i >= 0; i--) { var keys = placements[element.placement]; keys.splice(keys.indexOf(element.key), 1); var elementObject = this.fromElementDescriptor(element); var elementFinisherExtras = this.toElementFinisherExtras((0, decorators[i])(elementObject) || elementObject); element = elementFinisherExtras.element; this.addElementPlacement(element, placements); if (elementFinisherExtras.finisher) { finishers.push(elementFinisherExtras.finisher); } var newExtras = elementFinisherExtras.extras; if (newExtras) { for (var j = 0; j < newExtras.length; j++) { this.addElementPlacement(newExtras[j], placements); } extras.push.apply(extras, newExtras); } } return { element: element, finishers: finishers, extras: extras }; }, decorateConstructor: function (elements, decorators) { var finishers = []; for (var i = decorators.length - 1; i >= 0; i--) { var obj = this.fromClassDescriptor(elements); var elementsAndFinisher = this.toClassDescriptor((0, decorators[i])(obj) || obj); if (elementsAndFinisher.finisher !== undefined) { finishers.push(elementsAndFinisher.finisher); } if (elementsAndFinisher.elements !== undefined) { elements = elementsAndFinisher.elements; for (var j = 0; j < elements.length - 1; j++) { for (var k = j + 1; k < elements.length; k++) { if (elements[j].key === elements[k].key && elements[j].placement === elements[k].placement) { throw new TypeError("Duplicated element (" + elements[j].key + ")"); } } } } } return { elements: elements, finishers: finishers }; }, fromElementDescriptor: function (element) { var obj = { kind: element.kind, key: element.key, placement: element.placement, descriptor: element.descriptor }; var desc = { value: "Descriptor", configurable: true }; Object.defineProperty(obj, Symbol.toStringTag, desc); if (element.kind === "field") obj.initializer = element.initializer; return obj; }, toElementDescriptors: function (elementObjects) { if (elementObjects === undefined) return; return _toArray(elementObjects).map(function (elementObject) { var element = this.toElementDescriptor(elementObject); this.disallowProperty(elementObject, "finisher", "An element descriptor"); this.disallowProperty(elementObject, "extras", "An element descriptor"); return element; }, this); }, toElementDescriptor: function (elementObject) { var kind = String(elementObject.kind); if (kind !== "method" && kind !== "field") { throw new TypeError('An element descriptor\'s .kind property must be either "method" or' + ' "field", but a decorator created an element descriptor with' + ' .kind "' + kind + '"'); } var key = _toPropertyKey(elementObject.key); var placement = String(elementObject.placement); if (placement !== "static" && placement !== "prototype" && placement !== "own") { throw new TypeError('An element descriptor\'s .placement property must be one of "static",' + ' "prototype" or "own", but a decorator created an element descriptor' + ' with .placement "' + placement + '"'); } var descriptor = elementObject.descriptor; this.disallowProperty(elementObject, "elements", "An element descriptor"); var element = { kind: kind, key: key, placement: placement, descriptor: Object.assign({}, descriptor) }; if (kind !== "field") { this.disallowProperty(elementObject, "initializer", "A method descriptor"); } else { this.disallowProperty(descriptor, "get", "The property descriptor of a field descriptor"); this.disallowProperty(descriptor, "set", "The property descriptor of a field descriptor"); this.disallowProperty(descriptor, "value", "The property descriptor of a field descriptor"); element.initializer = elementObject.initializer; } return element; }, toElementFinisherExtras: function (elementObject) { var element = this.toElementDescriptor(elementObject); var finisher = _optionalCallableProperty(elementObject, "finisher"); var extras = this.toElementDescriptors(elementObject.extras); return { element: element, finisher: finisher, extras: extras }; }, fromClassDescriptor: function (elements) { var obj = { kind: "class", elements: elements.map(this.fromElementDescriptor, this) }; var desc = { value: "Descriptor", configurable: true }; Object.defineProperty(obj, Symbol.toStringTag, desc); return obj; }, toClassDescriptor: function (obj) { var kind = String(obj.kind); if (kind !== "class") { throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator' + ' created a class descriptor with .kind "' + kind + '"'); } this.disallowProperty(obj, "key", "A class descriptor"); this.disallowProperty(obj, "placement", "A class descriptor"); this.disallowProperty(obj, "descriptor", "A class descriptor"); this.disallowProperty(obj, "initializer", "A class descriptor"); this.disallowProperty(obj, "extras", "A class descriptor"); var finisher = _optionalCallableProperty(obj, "finisher"); var elements = this.toElementDescriptors(obj.elements); return { elements: elements, finisher: finisher }; }, runClassFinishers: function (constructor, finishers) { for (var i = 0; i < finishers.length; i++) { var newConstructor = (0, finishers[i])(constructor); if (newConstructor !== undefined) { if (typeof newConstructor !== "function") { throw new TypeError("Finishers must return a constructor."); } constructor = newConstructor; } } return constructor; }, disallowProperty: function (obj, name, objectType) { if (obj[name] !== undefined) { throw new TypeError(objectType + " can't have a ." + name + " property."); } } }; return api; }

function _createElementDescriptor(def) { var key = _toPropertyKey(def.key); var descriptor; if (def.kind === "method") { descriptor = { value: def.value, writable: true, configurable: true, enumerable: false }; } else if (def.kind === "get") { descriptor = { get: def.value, configurable: true, enumerable: false }; } else if (def.kind === "set") { descriptor = { set: def.value, configurable: true, enumerable: false }; } else if (def.kind === "field") { descriptor = { configurable: true, writable: true, enumerable: true }; } var element = { kind: def.kind === "field" ? "field" : "method", key: key, placement: def.static ? "static" : def.kind === "field" ? "own" : "prototype", descriptor: descriptor }; if (def.decorators) element.decorators = def.decorators; if (def.kind === "field") element.initializer = def.value; return element; }

function _coalesceGetterSetter(element, other) { if (element.descriptor.get !== undefined) { other.descriptor.get = element.descriptor.get; } else { other.descriptor.set = element.descriptor.set; } }

function _coalesceClassElements(elements) { var newElements = []; var isSameElement = function (other) { return other.kind === "method" && other.key === element.key && other.placement === element.placement; }; for (var i = 0; i < elements.length; i++) { var element = elements[i]; var other; if (element.kind === "method" && (other = newElements.find(isSameElement))) { if (_isDataDescriptor(element.descriptor) || _isDataDescriptor(other.descriptor)) { if (_hasDecorators(element) || _hasDecorators(other)) { throw new ReferenceError("Duplicated methods (" + element.key + ") can't be decorated."); } other.descriptor = element.descriptor; } else { if (_hasDecorators(element)) { if (_hasDecorators(other)) { throw new ReferenceError("Decorators can't be placed on different accessors with for " + "the same property (" + element.key + ")."); } other.decorators = element.decorators; } _coalesceGetterSetter(element, other); } } else { newElements.push(element); } } return newElements; }

function _hasDecorators(element) { return element.decorators && element.decorators.length; }

function _isDataDescriptor(desc) { return desc !== undefined && !(desc.value === undefined && desc.writable === undefined); }

function _optionalCallableProperty(obj, name) { var value = obj[name]; if (value !== undefined && typeof value !== "function") { throw new TypeError("Expected '" + name + "' to be a function"); } return value; }

function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }

function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }

function _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest(); }

function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }

function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }

function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }

function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }

function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }

function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }

function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }

function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }






















 // tslint:disable-next-line: no-duplicate-imports

let OpConfigEntities = _decorate([Object(lit_element__WEBPACK_IMPORTED_MODULE_5__["customElement"])("op-config-entities")], function (_initialize, _SubscribeMixin) {
  class OpConfigEntities extends _SubscribeMixin {
    constructor(...args) {
      super(...args);

      _initialize(this);
    }

  }

  return {
    F: OpConfigEntities,
    d: [{
      kind: "field",
      decorators: [Object(lit_element__WEBPACK_IMPORTED_MODULE_5__["property"])()],
      key: "opp",
      value: void 0
    }, {
      kind: "field",
      decorators: [Object(lit_element__WEBPACK_IMPORTED_MODULE_5__["property"])()],
      key: "isWide",
      value: void 0
    }, {
      kind: "field",
      decorators: [Object(lit_element__WEBPACK_IMPORTED_MODULE_5__["property"])()],
      key: "narrow",
      value: void 0
    }, {
      kind: "field",
      decorators: [Object(lit_element__WEBPACK_IMPORTED_MODULE_5__["property"])()],
      key: "route",
      value: void 0
    }, {
      kind: "field",
      decorators: [Object(lit_element__WEBPACK_IMPORTED_MODULE_5__["property"])()],
      key: "_entities",
      value: void 0
    }, {
      kind: "field",
      decorators: [Object(lit_element__WEBPACK_IMPORTED_MODULE_5__["property"])()],
      key: "_showDisabled",

      value() {
        return false;
      }

    }, {
      kind: "field",
      decorators: [Object(lit_element__WEBPACK_IMPORTED_MODULE_5__["property"])()],
      key: "_showUnavailable",

      value() {
        return true;
      }

    }, {
      kind: "field",
      decorators: [Object(lit_element__WEBPACK_IMPORTED_MODULE_5__["property"])()],
      key: "_showReadOnly",

      value() {
        return true;
      }

    }, {
      kind: "field",
      decorators: [Object(lit_element__WEBPACK_IMPORTED_MODULE_5__["property"])()],
      key: "_filter",

      value() {
        return "";
      }

    }, {
      kind: "field",
      decorators: [Object(lit_element__WEBPACK_IMPORTED_MODULE_5__["property"])()],
      key: "_selectedEntities",

      value() {
        return [];
      }

    }, {
      kind: "field",
      decorators: [Object(lit_element__WEBPACK_IMPORTED_MODULE_5__["query"])("opp-tabs-subpage-data-table")],
      key: "_dataTable",
      value: void 0
    }, {
      kind: "field",
      key: "getDialog",
      value: void 0
    }, {
      kind: "field",
      key: "_columns",

      value() {
        return Object(memoize_one__WEBPACK_IMPORTED_MODULE_7__["default"])((narrow, _language) => {
          const columns = {
            icon: {
              title: "",
              type: "icon",
              template: icon => lit_element__WEBPACK_IMPORTED_MODULE_5__["html"]`
            <op-icon slot="item-icon" .icon=${icon}></op-icon>
          `
            },
            name: {
              title: this.opp.localize("ui.panel.config.entities.picker.headers.name"),
              sortable: true,
              filterable: true,
              direction: "asc"
            }
          };
          const statusColumn = {
            title: this.opp.localize("ui.panel.config.entities.picker.headers.status"),
            type: "icon",
            sortable: true,
            filterable: true,
            template: (_status, entity) => entity.unavailable || entity.disabled_by || entity.readonly ? lit_element__WEBPACK_IMPORTED_MODULE_5__["html"]`
                <div
                  tabindex="0"
                  style="display:inline-block; position: relative;"
                >
                  <op-icon
                    style=${Object(lit_html_directives_style_map__WEBPACK_IMPORTED_MODULE_6__["styleMap"])({
              color: entity.unavailable ? "var(--google-red-500)" : ""
            })}
                    .icon=${entity.unavailable ? "opp:alert-circle" : entity.disabled_by ? "opp:cancel" : "opp:pencil-off"}
                  ></op-icon>
                  <paper-tooltip position="left">
                    ${entity.unavailable ? this.opp.localize("ui.panel.config.entities.picker.status.unavailable") : entity.disabled_by ? this.opp.localize("ui.panel.config.entities.picker.status.disabled") : this.opp.localize("ui.panel.config.entities.picker.status.readonly")}
                  </paper-tooltip>
                </div>
              ` : ""
          };

          if (narrow) {
            columns.name.template = (name, entity) => {
              return lit_element__WEBPACK_IMPORTED_MODULE_5__["html"]`
            ${name}<br />
            ${entity.entity_id} |
            ${this.opp.localize(`component.${entity.platform}.config.title`) || entity.platform}
          `;
            };

            columns.status = statusColumn;
            return columns;
          }

          columns.entity_id = {
            title: this.opp.localize("ui.panel.config.entities.picker.headers.entity_id"),
            sortable: true,
            filterable: true
          };
          columns.platform = {
            title: this.opp.localize("ui.panel.config.entities.picker.headers.integration"),
            sortable: true,
            filterable: true,
            template: platform => this.opp.localize(`component.${platform}.config.title`) || platform
          };
          columns.status = statusColumn;
          return columns;
        });
      }

    }, {
      kind: "field",
      key: "_filteredEntities",

      value() {
        return Object(memoize_one__WEBPACK_IMPORTED_MODULE_7__["default"])((entities, states, showDisabled, showUnavailable, showReadOnly) => {
          const stateEntities = [];

          if (showReadOnly) {
            const regEntityIds = new Set(entities.map(entity => entity.entity_id));

            for (const entityId of Object.keys(states)) {
              if (regEntityIds.has(entityId)) {
                continue;
              }

              stateEntities.push({
                name: Object(_common_entity_compute_state_name__WEBPACK_IMPORTED_MODULE_21__["computeStateName"])(states[entityId]),
                entity_id: entityId,
                platform: Object(_common_entity_compute_domain__WEBPACK_IMPORTED_MODULE_8__["computeDomain"])(entityId),
                disabled_by: null,
                readonly: true,
                selectable: false
              });
            }
          }

          if (!showDisabled) {
            entities = entities.filter(entity => !Boolean(entity.disabled_by));
          }

          const result = [];

          for (const entry of entities.concat(stateEntities)) {
            const state = states[entry.entity_id];
            const unavailable = (state === null || state === void 0 ? void 0 : state.state) === "unavailable";

            if (!showUnavailable && unavailable) {
              continue;
            }

            result.push(Object.assign({}, entry, {
              icon: state ? Object(_common_entity_state_icon__WEBPACK_IMPORTED_MODULE_10__["stateIcon"])(state) : Object(_common_entity_domain_icon__WEBPACK_IMPORTED_MODULE_9__["domainIcon"])(Object(_common_entity_compute_domain__WEBPACK_IMPORTED_MODULE_8__["computeDomain"])(entry.entity_id)),
              name: Object(_data_entity_registry__WEBPACK_IMPORTED_MODULE_13__["computeEntityRegistryName"])(this.opp, entry) || this.opp.localize("state.default.unavailable"),
              unavailable,
              status: unavailable ? this.opp.localize("ui.panel.config.entities.picker.status.unavailable") : entry.disabled_by ? this.opp.localize("ui.panel.config.entities.picker.status.disabled") : this.opp.localize("ui.panel.config.entities.picker.status.ok")
            }));
          }

          return result;
        });
      }

    }, {
      kind: "method",
      key: "oppSubscribe",
      value: function oppSubscribe() {
        return [Object(_data_entity_registry__WEBPACK_IMPORTED_MODULE_13__["subscribeEntityRegistry"])(this.opp.connection, entities => {
          this._entities = entities;
        })];
      }
    }, {
      kind: "method",
      key: "disconnectedCallback",
      value: function disconnectedCallback() {
        _get(_getPrototypeOf(OpConfigEntities.prototype), "disconnectedCallback", this).call(this);

        if (!this.getDialog) {
          return;
        }

        const dialog = this.getDialog();

        if (!dialog) {
          return;
        }

        dialog.closeDialog();
      }
    }, {
      kind: "method",
      key: "render",
      value: function render() {
        if (!this.opp || this._entities === undefined) {
          return lit_element__WEBPACK_IMPORTED_MODULE_5__["html"]`
        <opp-loading-screen></opp-loading-screen>
      `;
        }

        const headerToolbar = this._selectedEntities.length ? lit_element__WEBPACK_IMPORTED_MODULE_5__["html"]`
          <p class="selected-txt">
            ${this.opp.localize("ui.panel.config.entities.picker.selected", "number", this._selectedEntities.length)}
          </p>
          <div class="header-btns">
            ${!this.narrow ? lit_element__WEBPACK_IMPORTED_MODULE_5__["html"]`
                  <mwc-button @click=${this._enableSelected}
                    >${this.opp.localize("ui.panel.config.entities.picker.enable_selected.button")}</mwc-button
                  >
                  <mwc-button @click=${this._disableSelected}
                    >${this.opp.localize("ui.panel.config.entities.picker.disable_selected.button")}</mwc-button
                  >
                  <mwc-button @click=${this._removeSelected}
                    >${this.opp.localize("ui.panel.config.entities.picker.remove_selected.button")}</mwc-button
                  >
                ` : lit_element__WEBPACK_IMPORTED_MODULE_5__["html"]`
                  <paper-icon-button
                    id="enable-btn"
                    icon="opp:undo"
                    @click=${this._enableSelected}
                  ></paper-icon-button>
                  <paper-tooltip for="enable-btn">
                    ${this.opp.localize("ui.panel.config.entities.picker.enable_selected.button")}
                  </paper-tooltip>
                  <paper-icon-button
                    id="disable-btn"
                    icon="opp:cancel"
                    @click=${this._disableSelected}
                  ></paper-icon-button>
                  <paper-tooltip for="disable-btn">
                    ${this.opp.localize("ui.panel.config.entities.picker.disable_selected.button")}
                  </paper-tooltip>
                  <paper-icon-button
                    id="remove-btn"
                    icon="opp:delete"
                    @click=${this._removeSelected}
                  ></paper-icon-button>
                  <paper-tooltip for="remove-btn">
                    ${this.opp.localize("ui.panel.config.entities.picker.remove_selected.button")}
                  </paper-tooltip>
                `}
          </div>
        ` : lit_element__WEBPACK_IMPORTED_MODULE_5__["html"]`
          <search-input
            no-label-float
            no-underline
            @value-changed=${this._handleSearchChange}
            .filter=${this._filter}
          ></search-input>
          <paper-menu-button no-animations horizontal-align="right">
            <paper-icon-button
              aria-label=${this.opp.localize("ui.panel.config.entities.picker.filter.filter")}
              title="${this.opp.localize("ui.panel.config.entities.picker.filter.filter")}"
              icon="opp:filter-variant"
              slot="dropdown-trigger"
            ></paper-icon-button>
            <paper-listbox slot="dropdown-content">
              <paper-icon-item @tap="${this._showDisabledChanged}">
                <paper-checkbox
                  .checked=${this._showDisabled}
                  slot="item-icon"
                ></paper-checkbox>
                ${this.opp.localize("ui.panel.config.entities.picker.filter.show_disabled")}
              </paper-icon-item>
              <paper-icon-item @tap="${this._showRestoredChanged}">
                <paper-checkbox
                  .checked=${this._showUnavailable}
                  slot="item-icon"
                ></paper-checkbox>
                ${this.opp.localize("ui.panel.config.entities.picker.filter.show_unavailable")}
              </paper-icon-item>
              <paper-icon-item @tap="${this._showReadOnlyChanged}">
                <paper-checkbox
                  .checked=${this._showReadOnly}
                  slot="item-icon"
                ></paper-checkbox>
                ${this.opp.localize("ui.panel.config.entities.picker.filter.show_readonly")}
              </paper-icon-item>
            </paper-listbox>
          </paper-menu-button>
        `;
        return lit_element__WEBPACK_IMPORTED_MODULE_5__["html"]`
      <opp-tabs-subpage-data-table
        .opp=${this.opp}
        .narrow=${this.narrow}
        back-path="/config"
        .route=${this.route}
        .tabs=${_op_panel_config__WEBPACK_IMPORTED_MODULE_19__["configSections"].integrations}
        .columns=${this._columns(this.narrow, this.opp.language)}
          .data=${this._filteredEntities(this._entities, this.opp.states, this._showDisabled, this._showUnavailable, this._showReadOnly)}
          .filter=${this._filter}
          selectable
          @selection-changed=${this._handleSelectionChanged}
          @row-click=${this._openEditEntry}
          id="entity_id"
      >
                <div class=${Object(lit_html_directives_class_map__WEBPACK_IMPORTED_MODULE_20__["classMap"])({
          "search-toolbar": this.narrow,
          "table-header": !this.narrow
        })} slot="header">
                  ${headerToolbar}
                </div>
        </op-data-table>
      </opp-tabs-subpage-data-table>
    `;
      }
    }, {
      kind: "method",
      key: "firstUpdated",
      value: function firstUpdated(changedProps) {
        _get(_getPrototypeOf(OpConfigEntities.prototype), "firstUpdated", this).call(this, changedProps);

        Object(_show_dialog_entity_registry_detail__WEBPACK_IMPORTED_MODULE_18__["loadEntityRegistryDetailDialog"])();
      }
    }, {
      kind: "method",
      key: "_showDisabledChanged",
      value: function _showDisabledChanged() {
        this._showDisabled = !this._showDisabled;
      }
    }, {
      kind: "method",
      key: "_showRestoredChanged",
      value: function _showRestoredChanged() {
        this._showUnavailable = !this._showUnavailable;
      }
    }, {
      kind: "method",
      key: "_showReadOnlyChanged",
      value: function _showReadOnlyChanged() {
        this._showReadOnly = !this._showReadOnly;
      }
    }, {
      kind: "method",
      key: "_handleSearchChange",
      value: function _handleSearchChange(ev) {
        this._filter = ev.detail.value;
      }
    }, {
      kind: "method",
      key: "_handleSelectionChanged",
      value: function _handleSelectionChanged(ev) {
        const changedSelection = ev.detail;
        const entity = changedSelection.id;

        if (changedSelection.selected) {
          this._selectedEntities = [...this._selectedEntities, entity];
        } else {
          this._selectedEntities = this._selectedEntities.filter(entityId => entityId !== entity);
        }
      }
    }, {
      kind: "method",
      key: "_enableSelected",
      value: function _enableSelected() {
        Object(_dialogs_generic_show_dialog_box__WEBPACK_IMPORTED_MODULE_14__["showConfirmationDialog"])(this, {
          title: this.opp.localize("ui.panel.config.entities.picker.enable_selected.confirm_title", "number", this._selectedEntities.length),
          text: this.opp.localize("ui.panel.config.entities.picker.enable_selected.confirm_text"),
          confirmText: this.opp.localize("ui.common.yes"),
          dismissText: this.opp.localize("ui.common.no"),
          confirm: () => {
            this._selectedEntities.forEach(entity => Object(_data_entity_registry__WEBPACK_IMPORTED_MODULE_13__["updateEntityRegistryEntry"])(this.opp, entity, {
              disabled_by: null
            }));

            this._clearSelection();
          }
        });
      }
    }, {
      kind: "method",
      key: "_disableSelected",
      value: function _disableSelected() {
        Object(_dialogs_generic_show_dialog_box__WEBPACK_IMPORTED_MODULE_14__["showConfirmationDialog"])(this, {
          title: this.opp.localize("ui.panel.config.entities.picker.disable_selected.confirm_title", "number", this._selectedEntities.length),
          text: this.opp.localize("ui.panel.config.entities.picker.disable_selected.confirm_text"),
          confirmText: this.opp.localize("ui.common.yes"),
          dismissText: this.opp.localize("ui.common.no"),
          confirm: () => {
            this._selectedEntities.forEach(entity => Object(_data_entity_registry__WEBPACK_IMPORTED_MODULE_13__["updateEntityRegistryEntry"])(this.opp, entity, {
              disabled_by: "user"
            }));

            this._clearSelection();
          }
        });
      }
    }, {
      kind: "method",
      key: "_removeSelected",
      value: function _removeSelected() {
        const removeableEntities = this._selectedEntities.filter(entity => {
          const stateObj = this.opp.states[entity];
          return stateObj === null || stateObj === void 0 ? void 0 : stateObj.attributes.restored;
        });

        Object(_dialogs_generic_show_dialog_box__WEBPACK_IMPORTED_MODULE_14__["showConfirmationDialog"])(this, {
          title: this.opp.localize("ui.panel.config.entities.picker.remove_selected.confirm_title", "number", removeableEntities.length),
          text: this.opp.localize("ui.panel.config.entities.picker.remove_selected.confirm_text"),
          confirmText: this.opp.localize("ui.common.yes"),
          dismissText: this.opp.localize("ui.common.no"),
          confirm: () => {
            removeableEntities.forEach(entity => Object(_data_entity_registry__WEBPACK_IMPORTED_MODULE_13__["removeEntityRegistryEntry"])(this.opp, entity));

            this._clearSelection();
          }
        });
      }
    }, {
      kind: "method",
      key: "_clearSelection",
      value: function _clearSelection() {
        this._dataTable.clearSelection();
      }
    }, {
      kind: "method",
      key: "_openEditEntry",
      value: function _openEditEntry(ev) {
        const entityId = ev.detail.id;

        const entry = this._entities.find(entity => entity.entity_id === entityId);

        this.getDialog = Object(_show_dialog_entity_registry_detail__WEBPACK_IMPORTED_MODULE_18__["showEntityRegistryDetailDialog"])(this, {
          entry,
          entity_id: entityId
        });
      }
    }, {
      kind: "get",
      static: true,
      key: "styles",
      value: function styles() {
        return lit_element__WEBPACK_IMPORTED_MODULE_5__["css"]`
      opp-loading-screen {
        --app-header-background-color: var(--sidebar-background-color);
        --app-header-text-color: var(--sidebar-text-color);
      }
      a {
        color: var(--primary-color);
      }
      h2 {
        margin-top: 0;
        font-family: var(--paper-font-headline_-_font-family);
        -webkit-font-smoothing: var(
          --paper-font-headline_-_-webkit-font-smoothing
        );
        font-size: var(--paper-font-headline_-_font-size);
        font-weight: var(--paper-font-headline_-_font-weight);
        letter-spacing: var(--paper-font-headline_-_letter-spacing);
        line-height: var(--paper-font-headline_-_line-height);
        opacity: var(--dark-primary-opacity);
      }
      p {
        font-family: var(--paper-font-subhead_-_font-family);
        -webkit-font-smoothing: var(
          --paper-font-subhead_-_-webkit-font-smoothing
        );
        font-weight: var(--paper-font-subhead_-_font-weight);
        line-height: var(--paper-font-subhead_-_line-height);
      }
      op-data-table {
        width: 100%;
        --data-table-border-width: 0;
      }
      :host(:not([narrow])) op-data-table {
        height: calc(100vh - 65px);
        display: block;
      }
      op-switch {
        margin-top: 16px;
      }
      .table-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-end;
        border-bottom: 1px solid rgba(var(--rgb-primary-text-color), 0.12);
      }
      search-input {
        flex-grow: 1;
        position: relative;
        top: 2px;
      }
      .search-toolbar {
        display: flex;
        justify-content: space-between;
        align-items: flex-end;
        margin-left: -24px;
        color: var(--secondary-text-color);
      }
      .selected-txt {
        font-weight: bold;
        padding-left: 16px;
      }
      .table-header .selected-txt {
        margin-top: 20px;
      }
      .search-toolbar .selected-txt {
        font-size: 16px;
      }
      .header-btns > mwc-button,
      .header-btns > paper-icon-button {
        margin: 8px;
      }
    `;
      }
    }]
  };
}, Object(_mixins_subscribe_mixin__WEBPACK_IMPORTED_MODULE_17__["SubscribeMixin"])(lit_element__WEBPACK_IMPORTED_MODULE_5__["LitElement"]));

/***/ })

}]);
//# sourceMappingURL=data:application/json;charset=utf-8;base64, 