forked from andrey-git/home-assistant-custom-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscripts.js.map
1 lines (1 loc) · 109 KB
/
scripts.js.map
1
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///../home-assistant-polymer/src/common/dom/apply_themes_on_element.js","webpack:///../home-assistant-polymer/src/common/entity/compute_domain.js","webpack:///../home-assistant-polymer/src/common/entity/compute_state_domain.js","webpack:///../home-assistant-polymer/src/common/dom/dynamic_content_updater.js","webpack:///../home-assistant-polymer/src/common/const.js","webpack:///../home-assistant-polymer/src/common/entity/state_card_type.js","webpack:///./node_modules/@polymer/polymer/lib/utils/html-tag.js","webpack:///./src/mixins/events-mixin.js","webpack:///./src/elements/ha-config-custom-ui.js","webpack:///./src/utils/version.js","webpack:///../home-assistant-polymer/src/util/hass-attributes-util.js","webpack:///./src/utils/hass-attribute-util.js","webpack:///./src/utils/hooks.js","webpack:///../home-assistant-polymer/src/common/entity/get_view_entities.js","webpack:///../home-assistant-polymer/src/common/entity/get_group_entities.js","webpack:///./src/elements/cui-base-element.js","webpack:///./src/elements/dynamic-element.js","webpack:///./src/elements/dynamic-with-extra.js","webpack:///./src/elements/ha-themed-slider.js","webpack:///./src/elements/state-card-with-slider.js","webpack:///./src/elements/state-card-without-slider.js","webpack:///./src/elements/state-card-custom-ui.js","webpack:///../home-assistant-polymer/src/common/entity/can_toggle_state.js","webpack:///../home-assistant-polymer/src/common/entity/can_toggle_domain.js","webpack:///./node_modules/@polymer/polymer/lib/utils/boot.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","r","value","n","__esModule","default","object","property","prototype","hasOwnProperty","p","s","__webpack_exports__","applyThemesOnElement","element","themes","localTheme","updateMeta","arguments","length","_themes","themeName","default_theme","styles","assign","theme","keys","forEach","key","prefixedKey","updateStyles","window","ShadyCSS","styleSubtree","meta","document","querySelector","hasAttribute","setAttribute","getAttribute","themeColor","computeDomain","entityId","substr","indexOf","computeStateDomain","stateObj","entity_id","dynamicContentUpdater","root","newElementTag","attributes","rootEl","customEl","lastChild","tagName","removeChild","createElement","toLowerCase","setProperties","parentNode","appendChild","DOMAINS_WITH_CARD","Set","LiteralString","constructor","string","this","toString","html","strings","template","_len","values","Array","_key","innerHTML","reduce","acc","v","idx","HTMLTemplateElement","Error","literalValue","events_mixin","superClass","fire","type","detail","options","event","Event","bubbles","cancelable","Boolean","composed","node","dispatchEvent","customElements","define","Polymer","Element","properties","isWide","String","observer","ready","super","customUI","getName","nameChanged","setName","_backHandler","history","back","hassAttributeUtil","binary_sensor","cover","sensor","json","icon","boolean","array","key-value","LOGIC_STATE_ATTRIBUTES","entity_picture","friendly_name","description","emulated_hue","domains","emulated_hue_name","haaska_hidden","haaska_name","homebridge_hidden","homebridge_name","supported_features","attribution","custom_ui_more_info","custom_ui_state_card","device_class","DOMAIN_DEVICE_CLASS","hidden","assumed_state","initial_state","unit_of_measurement","hass_attributes_util","SUPPORTED_SLIDER_MODES","customUiAttributes","group","device","templates","state","_stateDisplay","control_element","state_card_mode","light","concat","climate","*","state_card_custom_ui_secondary","badges_list","show_last_changed","hide_control","extra_data_template","extra_badge","stretch_slider","slider_theme","confirm_controls","confirm_controls_show_lock","hide_in_default_view","icon_color","UNKNOWN_TYPE","domHost","elem","getRootNode","DocumentFragment","host","lightOrShadow","selector","shadowRoot","getElementHierarchy","hierarchy","shift","getContext","_context","groupEntity","push","states","reverse","findMatch","find","option","match","maybeChangeObjectByDevice","applyAttributes","maybeChangeObjectByGroup","context","_setKeep","obj","_cui_keep","maybeApplyTemplateAttributes","hass","newAttributes","hasGlobal","hasChanges","computeTemplate","untemplated_attributes","untemplated_state","result","untemplated_stateDisplay","maybeApplyTemplates","newResult","checkAttributes","last_changed","maybeChangeObject","inDialog","allowHidden","fixGroupTitles","homeAssistantMain","haCards","$","main","querySelectorAll","card","textContent","setTimeout","controlColumns","columns","partialCards","f","handleWindowChange","_updateColumns","mqls","mql","removeListener","map","width","matchMedia","addListener","bind","useCustomizer","customizer","hide_attributes","attr","updateConfigPanel","location","pathname","startsWith","haPanelConfig","haConfigNavigation","localize","cuiPatch","_originalComputeLoaded","_computeLoaded","_originalComputeCaption","_computeCaption","_originalComputeDescription","_computeDescription","page","pages","some","conf","domain","caption","loaded","getHaConfigCustomUi","haConfigCustomUi","ironPages","lastElementChild","addEventListener","select","visible","style","display","installStatesHook","whenDefined","then","homeAssistant","_updateHass","originalUpdate","entity","newEntity","_themeWaiters","waiter","stateChanged","installPartialCards","entities","_defaultViewFilter","excludes","excludeEntityId","view","viewEntities","groupEntities","grEntityId","grEntity","filter","id","installActionName","elementName","klass","action_name","__data","set","installHaStateLabelBadge","haStateLabelBadge","startInterval","installStateBadge","stateBadge","_updateIconAppearance","originalUpdateIconAppearance","backgroundImage","color","installHaAttributes","haAttributes","computeFiltersArray","extraFilters","split","installHaFormCustomize","haFormCustomize","haFormCustomizeInitDone","_computeSingleAttribute","secondary","config","_initOpenObject","JSON","stringify","getNewAttributesOptions","localAttributes","globalAttributes","existingAttributes","includes","filterFromAttributes","sort","installClassHooks","classInitDone","init","initDone","runHooks","console","log","CUSTOM_UI_LIST","version","url","localStorage","getItem","setItem","attribute","functionBody","Function","e","SyntaxError","ReferenceError","warn","message","cui_base_element","controlElement","extra","computed","computeExtra","extras","isArray","showLastChanged","hasExtra","observers","observerFunc","toUpperCase","extraObj","_attached","extraObjVisible","connectedCallback","disconnectedCallback","_isAttached","attached","extraBadges","extraBadge","unit","blacklist","blacklist_states","RegExp","test","_entityDisplay","computeExtraVisible","extraClass","_showControl","computeStateDisplay","haLocalize","isConfirmControls","clickHandler","pointerEvents","lock","opacity","stopPropagation","applyThemes","extraDomChanged","disableOffWhenMin","_computeAttribute","computeEnabledThemedReportWhenNotChanged","disableReportWhenNotChanged","min","Number","max","pin","isOn","notify","_themedMin","_enabledThemedReportWhenNotChanged","def","computeClass","themedMin","valueChanged","ev","target","serviceMin","serviceMax","valueName","setValueName","nameOn","sliderValue","mode","stretchSlider","breakSlider","hideSlider","lineTooLong","minLineBreak","maxLineBreak","showSlider","_onIronResize","_isConnected","_waitForLayout","removeEventListener","_setMode","_frameId","readyToCompute","requestAnimationFrame","prevBreakSlider","prevHideSlider","container","containerWidth","clientWidth","containerHeight","clientHeight","stateHeight","_computeWrapClass","_showSlider","sliderChanged","parseInt","param","isNaN","path","_slicedToArray","composedPath","_ev$composedPath","callService","stateObjChanged","SHOW_LAST_CHANGED_BLACKLISTED_CARDS","DOMAIN_TO_SLIDER_SUPPORT","TYPE_TO_CONTROL","toggle","classList","contains","_container","setProperty","inputChanged","margin","padding","badgeMode","params","text-align","fontSize","cleanBadgeStyle","modifiedObj","themeTarget","maybeHideEntity","sliderEligible_","regularMode_","originalStateCardType","services","control","stateCardType","customStateCardType","secondaryStateCardType","min_temp","max_temp","JSCompiler_renameProperty","prop"],"mappings":";aACA,IAAAA,KAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAC,QAGA,IAAAC,EAAAJ,EAAAE,IACAG,EAAAH,EACAI,KACAH,YAUA,OANAI,EAAAL,GAAAM,KAAAJ,EAAAD,QAAAC,IAAAD,QAAAF,GAGAG,EAAAE,KAGAF,EAAAD,QAKAF,EAAAQ,EAAAF,EAGAN,EAAAS,EAAAV,EAGAC,EAAAU,EAAA,SAAAR,EAAAS,EAAAC,GACAZ,EAAAa,EAAAX,EAAAS,IACAG,OAAAC,eAAAb,EAAAS,GACAK,gBACAC,cACAC,IAAAN,KAMAZ,EAAAmB,EAAA,SAAAjB,GACAY,OAAAC,eAAAb,EAAA,cAAiDkB,YAIjDpB,EAAAqB,EAAA,SAAAlB,GACA,IAAAS,EAAAT,KAAAmB,WACA,WAA2B,OAAAnB,EAAAoB,SAC3B,WAAiC,OAAApB,GAEjC,OADAH,EAAAU,EAAAE,EAAA,IAAAA,GACAA,GAIAZ,EAAAa,EAAA,SAAAW,EAAAC,GAAsD,OAAAX,O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FyN,EAAsB,0BACF,UAAXzN,GAAsBnM,KAAKsZ,gBAAgBnN,EAAQxN,EAAUyK,IACtE3N,OAAO4B,OAAO0b,GACZ/G,eAAgB,oBAChB6C,IAAK,IACLY,WAAY,cACZC,WAAY,qBACZE,aAAc,WACdD,UAAW,mBACXE,OAAQ,OACR1J,WAEFyN,EAAsB,0BACF,YAAXzN,GAAwBnM,KAAKsZ,gBAAgBnN,EAAQxN,EAAUyK,IACxE3N,OAAO4B,OAAO0b,GACZ/G,eAAgB,mBAChB2C,IAAKhW,EAASK,WAAW8a,WAAa,IACtCjF,IAAKlW,EAASK,WAAW+a,UAAY,IACrCtE,WAAY,kBACZC,WAAY,kBACZC,UAAW,cACXE,OAAQ,GACR1J,WAEFyN,EAAsB,mCACbvB,EAAgBmB,IACzBT,EAAO/G,eAAiBqG,EAAgBmB,GACxCI,EAAsB,6BACbjb,EAASK,WAAW8G,oBACnBqS,EAAoC5H,SAASiJ,KACvDT,EAAO3P,aAEc,gBAAnBzK,EAASyG,QACX2T,EAAO/G,eAAiB,aAEtBrT,EAASK,WAAWsG,kBACtByT,EAAO/G,eAAiBrT,EAASK,WAAWsG,iBAG9CzG,EACEmB,MACC6Z,GAA0BD,iBAAqCJ,KAAyB9G,cACzFqG,qBG/ONnb,OAAOoc,0BAA4B,SAASC,GAAQ,OAAOA","file":"scripts.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","/**\n * Apply a theme to an element by setting the CSS variables on it.\n *\n * element: Element to apply theme on.\n * themes: HASS Theme information\n * localTheme: selected theme.\n * updateMeta: boolean if we should update the theme-color meta element.\n*/\nexport default function applyThemesOnElement(element, themes, localTheme, updateMeta = false) {\n if (!element._themes) {\n element._themes = {};\n }\n let themeName = themes.default_theme;\n if (localTheme === 'default' || (localTheme && themes.themes[localTheme])) {\n themeName = localTheme;\n }\n const styles = Object.assign({}, element._themes);\n if (themeName !== 'default') {\n var theme = themes.themes[themeName];\n Object.keys(theme).forEach((key) => {\n var prefixedKey = '--' + key;\n element._themes[prefixedKey] = '';\n styles[prefixedKey] = theme[key];\n });\n }\n if (element.updateStyles) {\n element.updateStyles(styles);\n } else if (window.ShadyCSS) {\n // implement updateStyles() method of Polemer elements\n window.ShadyCSS.styleSubtree(/** @type {!HTMLElement} */(element), styles);\n }\n\n if (!updateMeta) return;\n\n const meta = document.querySelector('meta[name=theme-color]');\n if (meta) {\n if (!meta.hasAttribute('default-content')) {\n meta.setAttribute('default-content', meta.getAttribute('content'));\n }\n const themeColor = styles['--primary-color'] || meta.getAttribute('default-content');\n meta.setAttribute('content', themeColor);\n }\n}\n","export default function computeDomain(entityId) {\n return entityId.substr(0, entityId.indexOf('.'));\n}\n","import computeDomain from './compute_domain.js';\n\nexport default function computeStateDomain(stateObj) {\n return computeDomain(stateObj.entity_id);\n}\n","/**\n * Update root's child element to be newElementTag replacing another existing child if any.\n * Copy attributes into the child element.\n */\nexport default function dynamicContentUpdater(root, newElementTag, attributes) {\n const rootEl = root;\n let customEl;\n\n if (rootEl.lastChild && rootEl.lastChild.tagName === newElementTag) {\n customEl = rootEl.lastChild;\n } else {\n if (rootEl.lastChild) {\n rootEl.removeChild(rootEl.lastChild);\n }\n // Creating an element with upper case works fine in Chrome, but in FF it doesn't immediately\n // become a defined Custom Element. Polymer does that in some later pass.\n customEl = document.createElement(newElementTag.toLowerCase());\n }\n\n if (customEl.setProperties) {\n customEl.setProperties(attributes);\n } else {\n // If custom element definition wasn't loaded yet - setProperties would be\n // missing, but no harm in setting attributes one-by-one then.\n Object.keys(attributes).forEach((key) => {\n customEl[key] = attributes[key];\n });\n }\n\n if (customEl.parentNode === null) {\n rootEl.appendChild(customEl);\n }\n}\n","/** Constants to be used in the frontend. */\n\n// Constants should be alphabetically sorted by name.\n// Arrays with values should be alphabetically sorted if order doesn't matter.\n// Each constant should have a description what it is supposed to be used for.\n\n/** Icon to use when no icon specified for domain. */\nexport const DEFAULT_DOMAIN_ICON = 'hass:bookmark';\n\n/** Domains that have a state card. */\nexport const DOMAINS_WITH_CARD = [\n 'climate',\n 'cover',\n 'configurator',\n 'input_select',\n 'input_number',\n 'input_text',\n 'lock',\n 'media_player',\n 'scene',\n 'script',\n 'timer',\n 'vacuum',\n 'weblink',\n];\n\n/** Domains with separate more info dialog. */\nexport const DOMAINS_WITH_MORE_INFO = [\n 'alarm_control_panel',\n 'automation',\n 'camera',\n 'climate',\n 'configurator',\n 'cover',\n 'fan',\n 'group',\n 'history_graph',\n 'input_datetime',\n 'light',\n 'lock',\n 'media_player',\n 'script',\n 'sun',\n 'updater',\n 'vacuum',\n 'weather'\n];\n\n/** Domains that show no more info dialog. */\nexport const DOMAINS_HIDE_MORE_INFO = [\n 'input_number',\n 'input_select',\n 'input_text',\n 'scene',\n 'weblink'\n];\n\n/** Domains that should have the history hidden in the more info dialog. */\nexport const DOMAINS_MORE_INFO_NO_HISTORY = [\n 'camera',\n 'configurator',\n 'history_graph',\n 'scene',\n];\n\n/** States that we consider \"off\". */\nexport const STATES_OFF = [\n 'closed',\n 'locked',\n 'off'\n];\n\n/** Domains where we allow toggle in Lovelace. */\nexport const DOMAINS_TOGGLE = new Set([\n 'fan',\n 'input_boolean',\n 'light',\n 'switch'\n]);\n\n/** Temperature units. */\nexport const UNIT_C = '°C';\nexport const UNIT_F = '°F';\n\n/** Entity ID of the default view. */\nexport const DEFAULT_VIEW_ENTITY_ID = 'group.default_view';\n","import canToggleState from './can_toggle_state.js';\nimport computeStateDomain from './compute_state_domain.js';\nimport { DOMAINS_WITH_CARD } from '../const.js';\n\nexport default function stateCardType(hass, stateObj) {\n if (stateObj.state === 'unavailable') {\n return 'display';\n }\n\n const domain = computeStateDomain(stateObj);\n\n if (DOMAINS_WITH_CARD.includes(domain)) {\n return domain;\n } else if (canToggleState(hass, stateObj) &&\n stateObj.attributes.control !== 'hidden') {\n return 'toggle';\n }\n return 'display';\n}\n","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\nimport './boot.js';\n\n/**\n * Class representing a static string value which can be used to filter\n * strings by asseting that they have been created via this class. The\n * `value` property returns the string passed to the constructor.\n */\nclass LiteralString {\n constructor(string) {\n /** @type {string} */\n this.value = string.toString();\n }\n /**\n * @return {string} LiteralString string value\n */\n toString() {\n return this.value;\n }\n}\n\n/**\n * @param {*} value Object to stringify into HTML\n * @return {string} HTML stringified form of `obj`\n */\nfunction literalValue(value) {\n if (value instanceof LiteralString) {\n return /** @type {!LiteralString} */(value).value;\n } else {\n throw new Error(\n `non-literal value passed to Polymer's htmlLiteral function: ${value}`\n );\n }\n}\n\n/**\n * @param {*} value Object to stringify into HTML\n * @return {string} HTML stringified form of `obj`\n */\nfunction htmlValue(value) {\n if (value instanceof HTMLTemplateElement) {\n return /** @type {!HTMLTemplateElement } */(value).innerHTML;\n } else if (value instanceof LiteralString) {\n return literalValue(value);\n } else {\n throw new Error(\n `non-template value passed to Polymer's html function: ${value}`);\n }\n}\n\n/**\n * A template literal tag that creates an HTML <template> element from the\n * contents of the string.\n *\n * This allows you to write a Polymer Template in JavaScript.\n *\n * Templates can be composed by interpolating `HTMLTemplateElement`s in\n * expressions in the JavaScript template literal. The nested template's\n * `innerHTML` is included in the containing template. The only other\n * values allowed in expressions are those returned from `htmlLiteral`\n * which ensures only literal values from JS source ever reach the HTML, to\n * guard against XSS risks.\n *\n * All other values are disallowed in expressions to help prevent XSS\n * attacks; however, `htmlLiteral` can be used to compose static\n * string values into templates. This is useful to compose strings into\n * places that do not accept html, like the css text of a `style`\n * element.\n *\n * Example:\n *\n * static get template() {\n * return html`\n * <style>:host{ content:\"...\" }</style>\n * <div class=\"shadowed\">${this.partialTemplate}</div>\n * ${super.template}\n * `;\n * }\n * static get partialTemplate() { return html`<span>Partial!</span>`; }\n *\n * @param {!ITemplateArray} strings Constant parts of tagged template literal\n * @param {...*} values Variable parts of tagged template literal\n * @return {!HTMLTemplateElement} Constructed HTMLTemplateElement\n */\nexport const html = function html(strings, ...values) {\n const template = /** @type {!HTMLTemplateElement} */(document.createElement('template'));\n template.innerHTML = values.reduce((acc, v, idx) =>\n acc + htmlValue(v) + strings[idx + 1], strings[0]);\n return template;\n};\n\n/**\n * An html literal tag that can be used with `html` to compose.\n * a literal string.\n *\n * Example:\n *\n * static get template() {\n * return html`\n * <style>\n * :host { display: block; }\n * ${this.styleTemplate()}\n * </style>\n * <div class=\"shadowed\">${staticValue}</div>\n * ${super.template}\n * `;\n * }\n * static get styleTemplate() {\n * return htmlLiteral`.shadowed { background: gray; }`;\n * }\n *\n * @param {!ITemplateArray} strings Constant parts of tagged template literal\n * @param {...*} values Variable parts of tagged template literal\n * @return {!LiteralString} Constructed literal string\n */\nexport const htmlLiteral = function(strings, ...values) {\n return new LiteralString(values.reduce((acc, v, idx) =>\n acc + literalValue(v) + strings[idx + 1], strings[0]));\n};\n","// Polymer legacy event helpers used courtesy of the Polymer project.\n//\n// Copyright (c) 2017 The Polymer Authors. All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n// * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n// * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n// * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\nexport default (superClass) => {\n /**\n * @extends HTMLElement\n */\n class EventsMixin extends superClass {\n /**\n * Dispatches a custom event with an optional detail value.\n *\n * @param {string} type Name of event type.\n * @param {*=} detail Detail value containing event-specific\n * payload.\n * @param {{ bubbles: (boolean|undefined),\n cancelable: (boolean|undefined),\n composed: (boolean|undefined) }=}\n * options Object specifying options. These may include:\n * `bubbles` (boolean, defaults to `true`),\n * `cancelable` (boolean, defaults to false), and\n * `node` on which to fire the event (HTMLElement, defaults to `this`).\n * @return {Event} The new event that was fired.\n */\n fire(type, detail = {}, options = {}) {\n const event = new Event(type, {\n bubbles: options.bubbles === undefined ? true : options.bubbles,\n cancelable: Boolean(options.cancelable),\n composed: options.composed === undefined ? true : options.composed,\n });\n event.detail = detail;\n const node = options.node || this;\n node.dispatchEvent(event);\n return event;\n }\n }\n return EventsMixin;\n};\n","import { html } from '@polymer/polymer/lib/utils/html-tag.js';\nimport EventsMixin from '../mixins/events-mixin.js';\nimport '../utils/hooks.js';\n\n/**\n * @extends HTMLElement\n */\nclass HaConfigCustomUi extends EventsMixin(Polymer.Element) {\n static get template() {\n return html`\n <style include=\"ha-style\"></style>\n <app-header-layout has-scrolling-region>\n <app-header slot=\"header\" fixed>\n <app-toolbar>\n <paper-icon-button\n icon='mdi:arrow-left'\n on-click='_backHandler'\n ></paper-icon-button>\n <div main-title>Custom UI settings</div>\n </app-toolbar>\n </app-header>\n\n <ha-config-section is-wide='[[isWide]]'>\n <paper-card heading='Device name'>\n <div class='card-content'>\n Set device name so that you can reference it in per-device settings\n <paper-input\n label='Name'\n value='{{name}}'\n ></paper-input>\n </div>\n </paper-card>\n </ha-config-section>\n </app-header-layout>\n `;\n }\n\n static get properties() {\n return {\n isWide: Boolean,\n\n name: {\n type: String,\n observer: 'nameChanged',\n },\n };\n }\n\n ready() {\n super.ready();\n this.name = window.customUI.getName();\n }\n\n nameChanged(name) {\n window.customUI.setName(name);\n }\n\n _backHandler() {\n window.history.back();\n this.fire('location-changed');\n }\n}\ncustomElements.define('ha-config-custom-ui', HaConfigCustomUi);\n","export default '20181217';\n","const hassAttributeUtil = {};\n\nhassAttributeUtil.DOMAIN_DEVICE_CLASS = {\n binary_sensor: [\n 'battery',\n 'cold',\n 'connectivity',\n 'door',\n 'garage_door',\n 'gas',\n 'heat',\n 'light',\n 'lock',\n 'moisture',\n 'motion',\n 'moving',\n 'occupancy',\n 'opening',\n 'plug',\n 'power',\n 'presence',\n 'problem',\n 'safety',\n 'smoke',\n 'sound',\n 'vibration',\n 'window'\n ],\n cover: ['garage'],\n sensor: [\n 'battery',\n 'humidity',\n 'illuminance',\n 'temperature'\n ],\n};\n\nhassAttributeUtil.UNKNOWN_TYPE = 'json';\nhassAttributeUtil.ADD_TYPE = 'key-value';\n\nhassAttributeUtil.TYPE_TO_TAG = {\n string: 'ha-customize-string',\n json: 'ha-customize-string',\n icon: 'ha-customize-icon',\n boolean: 'ha-customize-boolean',\n array: 'ha-customize-array',\n 'key-value': 'ha-customize-key-value',\n};\n\n// Attributes here serve dual purpose:\n// 1) Any key of this object won't be shown in more-info window.\n// 2) Any key which has value other than undefined will appear in customization\n// config according to its value.\nhassAttributeUtil.LOGIC_STATE_ATTRIBUTES =\n hassAttributeUtil.LOGIC_STATE_ATTRIBUTES || {\n entity_picture: undefined,\n friendly_name: { type: 'string', description: 'Name' },\n icon: { type: 'icon' },\n emulated_hue: {\n type: 'boolean',\n domains: ['emulated_hue']\n },\n emulated_hue_name: {\n type: 'string',\n domains: ['emulated_hue']\n },\n haaska_hidden: undefined,\n haaska_name: undefined,\n homebridge_hidden: { type: 'boolean' },\n homebridge_name: { type: 'string' },\n supported_features: undefined,\n attribution: undefined,\n custom_ui_more_info: { type: 'string' },\n custom_ui_state_card: { type: 'string' },\n device_class: {\n type: 'array',\n options: hassAttributeUtil.DOMAIN_DEVICE_CLASS,\n description: 'Device class',\n domains: ['binary_sensor', 'cover', 'sensor']\n },\n hidden: { type: 'boolean', description: 'Hide from UI' },\n assumed_state: {\n type: 'boolean',\n domains: ['switch', 'light', 'cover', 'climate', 'fan', 'group']\n },\n initial_state: {\n type: 'string',\n domains: ['automation']\n },\n unit_of_measurement: { type: 'string' },\n };\n\nexport default hassAttributeUtil;\n","import hassAttributesUtil from '../../home-assistant-polymer/src/util/hass-attributes-util.js';\n\nwindow.hassAttributeUtil = window.hassAttributeUtil || {};\nconst SUPPORTED_SLIDER_MODES = [\n 'single-line', 'break-slider', 'break-slider-toggle', 'hide-slider', 'no-slider',\n];\n\nconst customUiAttributes = {\n group: undefined,\n device: undefined,\n templates: undefined,\n state: undefined,\n _stateDisplay: undefined,\n control_element: { type: 'string' },\n state_card_mode: {\n type: 'array',\n options: {\n light: SUPPORTED_SLIDER_MODES.concat('badges'),\n cover: SUPPORTED_SLIDER_MODES.concat('badges'),\n climate: SUPPORTED_SLIDER_MODES.concat('badges'),\n '*': ['badges'],\n },\n },\n state_card_custom_ui_secondary: { type: 'string' },\n badges_list: { type: 'json' },\n show_last_changed: { type: 'boolean' },\n hide_control: { type: 'boolean' },\n extra_data_template: { type: 'string' },\n extra_badge: { type: 'json' },\n stretch_slider: { type: 'boolean' },\n slider_theme: { type: 'json' },\n theme: { type: 'string' },\n confirm_controls: { type: 'boolean' },\n confirm_controls_show_lock: { type: 'boolean' },\n hide_in_default_view: { type: 'boolean' },\n icon_color: { type: 'string' },\n};\nwindow.hassAttributeUtil.LOGIC_STATE_ATTRIBUTES = hassAttributesUtil.LOGIC_STATE_ATTRIBUTES;\nwindow.hassAttributeUtil.UNKNOWN_TYPE = hassAttributesUtil.UNKNOWN_TYPE;\nObject.assign(window.hassAttributeUtil.LOGIC_STATE_ATTRIBUTES, customUiAttributes);\n","import applyThemesOnElement from '../../home-assistant-polymer/src/common/dom/apply_themes_on_element.js';\nimport computeStateDomain from '../../home-assistant-polymer/src/common/entity/compute_state_domain.js';\nimport getViewEntities from '../../home-assistant-polymer/src/common/entity/get_view_entities.js';\n\nimport '../elements/ha-config-custom-ui.js';\nimport VERSION from './version.js';\nimport './hass-attribute-util.js';\n\nwindow.customUI = window.customUI || {\n SUPPORTED_SLIDER_MODES: [\n 'single-line', 'break-slider', 'break-slider-toggle', 'hide-slider', 'no-slider',\n ],\n\n domHost(elem) {\n if (elem === document) return null;\n const root = elem.getRootNode();\n return (root instanceof DocumentFragment) ? /** @type {ShadowRoot} */ (root).host : root;\n },\n\n lightOrShadow(elem, selector) {\n return elem.shadowRoot ?\n elem.shadowRoot.querySelector(selector) :\n elem.querySelector(selector);\n },\n\n getElementHierarchy(root, hierarchy) {\n if (root === null) return null;\n const elem = hierarchy.shift();\n if (elem) {\n return window.customUI.getElementHierarchy(\n window.customUI.lightOrShadow(root, elem), hierarchy);\n }\n return root;\n },\n\n getContext(elem) {\n if (elem._context === undefined) {\n elem._context = [];\n for (let element = (elem.tagName === 'HA-ENTITIES-CARD' ? window.customUI.domHost(elem) : elem);\n element; element = window.customUI.domHost(element)) {\n switch (element.tagName) {\n case 'HA-ENTITIES-CARD':\n if (element.groupEntity) {\n elem._context.push(element.groupEntity.entity_id);\n } else if (element.groupEntity === false && element.states && element.states.length) {\n elem._context.push(`group.${computeStateDomain(element.states[0])}`);\n }\n break;\n case 'MORE-INFO-GROUP':\n case 'STATE-CARD-CONTENT':\n if (element.stateObj) {\n elem._context.push(element.stateObj.entity_id);\n }\n break;\n case 'HA-CARDS':\n elem._context.push(element.getAttribute('data-view') || 'default_view');\n break;\n // no default\n }\n }\n elem._context.reverse();\n }\n return elem._context;\n },\n\n findMatch(key, options) {\n if (!options) return null;\n if (options[key]) return key;\n return Object.keys(options).find(option => key.match(`^${option}$`));\n },\n\n maybeChangeObjectByDevice(stateObj) {\n const name = window.customUI.getName();\n if (!name) return stateObj;\n const match = this.findMatch(name, stateObj.attributes.device);\n if (!match) return stateObj;\n const attributes = Object.assign({}, stateObj.attributes.device[match]);\n\n if (!Object.keys(attributes).length) return stateObj;\n return window.customUI.applyAttributes(stateObj, attributes);\n },\n\n maybeChangeObjectByGroup(elem, stateObj) {\n const context = window.customUI.getContext(elem);\n if (!context) return stateObj;\n\n if (!stateObj.attributes.group) {\n return stateObj;\n }\n const attributes = {};\n context.forEach((c) => {\n const match = this.findMatch(c, stateObj.attributes.group);\n if (stateObj.attributes.group[match]) {\n Object.assign(attributes, stateObj.attributes.group[match]);\n }\n });\n\n if (!Object.keys(attributes).length) return stateObj;\n\n return window.customUI.applyAttributes(stateObj, attributes);\n },\n\n _setKeep(obj, value) {\n if (obj._cui_keep === undefined) {\n obj._cui_keep = value;\n } else {\n obj._cui_keep = obj._cui_keep && value;\n }\n },\n\n maybeApplyTemplateAttributes(hass, states, stateObj, attributes) {\n if (!attributes.templates) {\n window.customUI._setKeep(stateObj, true);\n return stateObj;\n }\n const newAttributes = {};\n let hasGlobal = false;\n let hasChanges = false;\n Object.keys(attributes.templates).forEach((key) => {\n const template = attributes.templates[key];\n if (template.match(/\\b(entities|hass)\\b/)) {\n hasGlobal = true;\n }\n const value = window.customUI.computeTemplate(\n template, hass, states, stateObj, attributes,\n (stateObj.untemplated_attributes && stateObj.untemplated_attributes[key]) ||\n attributes[key],\n stateObj.untemplated_state || stateObj.state);\n // In case of null don't set the value.\n if (value === null) return;\n newAttributes[key] = value;\n if (key === 'state') {\n if (value !== stateObj.state) {\n hasChanges = true;\n }\n } else if (key === '_stateDisplay') {\n if (value !== stateObj._stateDisplay) {\n hasChanges = true;\n }\n } else if (value !== attributes[key]) {\n hasChanges = true;\n }\n });\n window.customUI._setKeep(stateObj, !hasGlobal);\n if (!hasChanges) {\n return stateObj;\n }\n if (stateObj.attributes === attributes) {\n // We are operating on real attributes. Replace them.\n const result = window.customUI.applyAttributes(stateObj, newAttributes);\n if (Object.prototype.hasOwnProperty.call(newAttributes, 'state')) {\n if (newAttributes.state !== null) {\n result.state = String(newAttributes.state);\n result.untemplated_state = stateObj.state;\n }\n }\n if (Object.prototype.hasOwnProperty.call(newAttributes, '_stateDisplay')) {\n result._stateDisplay = newAttributes._stateDisplay;\n result.untemplated_stateDisplay = stateObj._stateDisplay;\n }\n window.customUI._setKeep(result, !hasGlobal);\n return result;\n }\n // Operating on context-aware attributes. Return shallow copy of object.\n return Object.assign({}, stateObj);\n },\n\n maybeApplyTemplates(hass, states, stateObj) {\n const newResult = window.customUI.maybeApplyTemplateAttributes(\n hass, states, stateObj, stateObj.attributes);\n let hasChanges = (newResult !== stateObj);\n\n function checkAttributes(obj) {\n if (!obj) return;\n Object.values(obj).forEach((attributes) => {\n const result = window.customUI.maybeApplyTemplateAttributes(\n hass, states, newResult, attributes);\n hasChanges |= (result !== newResult);\n });\n checkAttributes(obj.device);\n checkAttributes(obj.group);\n }\n\n checkAttributes(stateObj.attributes.device);\n checkAttributes(stateObj.attributes.group);\n if (newResult !== stateObj) return newResult;\n if (hasChanges) {\n return Object.assign({}, stateObj);\n }\n return stateObj;\n },\n\n applyAttributes(stateObj, attributes) {\n return {\n entity_id: stateObj.entity_id,\n state: stateObj.state,\n attributes: Object.assign({}, stateObj.attributes, attributes),\n untemplated_attributes: stateObj.attributes,\n last_changed: stateObj.last_changed,\n };\n },\n\n maybeChangeObject(elem, stateObj, inDialog, allowHidden) {\n if (inDialog) return stateObj;\n let obj = window.customUI.maybeChangeObjectByDevice(stateObj);\n obj = window.customUI.maybeChangeObjectByGroup(elem, obj);\n obj = window.customUI.maybeApplyTemplateAttributes(\n elem.hass, elem.hass.states, obj, obj.attributes);\n\n if (obj !== stateObj && obj.attributes.hidden && allowHidden) {\n return null;\n }\n return obj;\n },\n\n fixGroupTitles() {\n const homeAssistantMain = window.customUI.getElementHierarchy(document, [\n 'home-assistant',\n 'home-assistant-main']);\n if (homeAssistantMain === null) {\n // DOM not ready. Wait 1 second.\n window.setTimeout(window.customUI.fixGroupTitles, 1000);\n return;\n }\n\n const haCards = window.customUI.getElementHierarchy(homeAssistantMain, [\n 'partial-cards',\n 'ha-cards[view-visible]']);\n if (haCards === null) return;\n const main = window.customUI.lightOrShadow(haCards, '.main') || haCards.$.main;\n const cards = main.querySelectorAll('ha-entities-card');\n cards.forEach((card) => {\n if (card.groupEntity) {\n const obj = window.customUI.maybeChangeObject(\n card,\n card.groupEntity,\n false /* inDialog */,\n false /* allowHidden */);\n if (obj !== card.groupEntity && obj.attributes.friendly_name) {\n const nameElem = window.customUI.lightOrShadow(card, '.name');\n nameElem.textContent = obj.attributes.friendly_name;\n }\n }\n });\n },\n\n controlColumns(columns) {\n const partialCards = window.customUI.getElementHierarchy(document, [\n 'home-assistant',\n 'home-assistant-main',\n 'partial-cards']);\n if (partialCards === null) {\n // DOM not ready. Wait 1 second.\n window.setTimeout(\n window.customUI.controlColumns.bind(null, columns),\n 1000);\n return;\n }\n // Function renamed from handleWindowChange to _updateColumns on 3.7.18\n const f = partialCards.handleWindowChange || partialCards._updateColumns;\n partialCards.mqls.forEach((mql) => {\n mql.removeListener(f);\n });\n partialCards.mqls = columns.map((width) => {\n const mql = window.matchMedia(`(min-width: ${width}px)`);\n mql.addListener(f);\n return mql;\n });\n f();\n },\n\n useCustomizer() {\n const main = window.customUI.lightOrShadow(document, 'home-assistant');\n const customizer = main.hass.states['customizer.customizer'];\n if (!customizer) return;\n if (customizer.attributes.columns) {\n window.customUI.controlColumns(customizer.attributes.columns);\n }\n if (customizer.attributes.hide_attributes) {\n if (window.hassAttributeUtil && window.hassAttributeUtil.LOGIC_STATE_ATTRIBUTES) {\n customizer.attributes.hide_attributes.forEach((attr) => {\n if (!Object.prototype.hasOwnProperty.call(\n window.hassAttributeUtil.LOGIC_STATE_ATTRIBUTES, attr)) {\n window.hassAttributeUtil.LOGIC_STATE_ATTRIBUTES[attr] = undefined;\n }\n });\n }\n }\n },\n\n updateConfigPanel() {\n if (!window.location.pathname.startsWith('/config')) return;\n const haPanelConfig = window.customUI.getElementHierarchy(document, [\n 'home-assistant',\n 'home-assistant-main',\n 'partial-panel-resolver',\n 'ha-panel-config']);\n if (!haPanelConfig) {\n // DOM not ready. Wait 100ms.\n window.setTimeout(window.customUI.updateConfigPanel, 100);\n return;\n }\n const haConfigNavigation = window.customUI.getElementHierarchy(haPanelConfig, [\n 'ha-config-dashboard',\n 'ha-config-navigation']);\n if (haConfigNavigation) {\n // HaConfigNavigation started using localize on 21.01.2018\n if (haConfigNavigation.localize && !haConfigNavigation.cuiPatch) {\n haConfigNavigation.cuiPatch = true;\n haConfigNavigation._originalComputeLoaded = haConfigNavigation._computeLoaded;\n haConfigNavigation._originalComputeCaption = haConfigNavigation._computeCaption;\n haConfigNavigation._originalComputeDescription = haConfigNavigation._computeDescription;\n haConfigNavigation._computeLoaded = (hass, page) =>\n page === 'customui' || haConfigNavigation._originalComputeLoaded(hass, page);\n haConfigNavigation._computeCaption = (page, localize) =>\n (page === 'customui' ? 'Custom UI' : haConfigNavigation._originalComputeCaption(page, localize));\n haConfigNavigation._computeDescription = (page, localize) =>\n (page === 'customui' ? 'SetUI tweaks' : haConfigNavigation._originalComputeDescription(page, localize));\n }\n if (!haConfigNavigation.pages.some(conf => conf === 'customui' || conf.domain === 'customui')) {\n haConfigNavigation.push('pages', haConfigNavigation.localize ? 'customui' : {\n domain: 'customui',\n caption: 'Custom UI',\n description: 'Set UI tweaks.',\n loaded: true,\n });\n }\n }\n const getHaConfigCustomUi = () => {\n const haConfigCustomUi = document.createElement('ha-config-custom-ui');\n haConfigCustomUi.isWide = haPanelConfig.isWide;\n haConfigCustomUi.setAttribute('page-name', 'customui');\n return haConfigCustomUi;\n };\n\n const ironPages = window.customUI.lightOrShadow(haPanelConfig, 'iron-pages');\n if (ironPages) {\n if (ironPages.lastElementChild.tagName !== 'HA-CONFIG-CUSTOM-UI') {\n const haConfigCustomUi = getHaConfigCustomUi();\n ironPages.appendChild(haConfigCustomUi);\n ironPages.addEventListener('iron-items-changed', () => {\n if (window.location.pathname.startsWith('/config/customui')) {\n ironPages.select('customui');\n }\n });\n }\n } else {\n const root = haPanelConfig.shadowRoot || haPanelConfig;\n if (root.lastElementChild.tagName !== 'HA-CONFIG-CUSTOM-UI') {\n const haConfigCustomUi = getHaConfigCustomUi();\n root.appendChild(haConfigCustomUi);\n }\n const visible = window.location.pathname.startsWith('/config/customui');\n root.lastElementChild.style.display = visible ? '' : 'none';\n }\n },\n\n installStatesHook() {\n customElements.whenDefined('home-assistant').then(() => {\n const homeAssistant = customElements.get('home-assistant');\n if (!homeAssistant || !homeAssistant.prototype._updateHass) return;\n const originalUpdate = homeAssistant.prototype._updateHass;\n homeAssistant.prototype._updateHass = function update(obj) {\n // Use named function to preserve 'this'.\n const { hass } = this;\n if (obj.states) {\n Object.keys(obj.states).forEach((key) => {\n const entity = obj.states[key];\n if (entity._cui_keep) return;\n const newEntity = window.customUI.maybeApplyTemplates(hass, obj.states, entity);\n if (hass.states && entity !== hass.states[key]) {\n // New state arrived. Put modified state in.\n obj.states[key] = newEntity;\n } else if (entity !== newEntity) {\n // It's the same state but contents changed due to other state changes.\n obj.states[key] = newEntity;\n }\n });\n }\n originalUpdate.call(this, obj);\n if (obj.themes && hass._themeWaiters) {\n hass._themeWaiters.forEach(waiter => waiter.stateChanged(waiter.state));\n hass._themeWaiters = undefined;\n }\n };\n const main = window.customUI.lightOrShadow(document, 'home-assistant');\n if (main.hass && main.hass.states) {\n main._updateHass({ states: main.hass.states });\n }\n });\n },\n\n installPartialCards() {\n customElements.whenDefined('partial-cards').then(() => {\n const partialCards = customElements.get('partial-cards');\n if (!partialCards || !partialCards.prototype._defaultViewFilter) return;\n partialCards.prototype._defaultViewFilter = (hass, entityId) => {\n if (hass.states[entityId].attributes.hidden) return false;\n const excludes = {};\n Object.values(hass.states).forEach((entity) => {\n if (entity.attributes && entity.attributes.hide_in_default_view) {\n const excludeEntityId = entity.entity_id;\n if (excludes[excludeEntityId]) return;\n excludes[excludeEntityId] = entity;\n if (entity.attributes.view) {\n const viewEntities = getViewEntities(hass.states, entity);\n Object.keys(viewEntities)\n .filter(\n id => viewEntities[id].attributes.hide_in_default_view !== false)\n .forEach((id) => {\n excludes[id] = viewEntities[id];\n });\n }\n }\n });\n return !excludes[entityId];\n };\n });\n },\n\n // Allows changing the 'Execute' / 'Activate' text on script/scene cards.\n installActionName(elementName) {\n customElements.whenDefined(elementName).then(() => {\n const klass = customElements.get(elementName);\n if (!klass || !klass.prototype) return;\n Object.defineProperty(klass.prototype, 'localize', {\n get() {\n function customLocalize(v) {\n if (this.stateObj && this.stateObj.attributes &&\n this.stateObj.attributes.action_name) {\n return this.stateObj.attributes.action_name;\n }\n return this.__data.localize(v);\n }\n return customLocalize;\n },\n set() {},\n });\n });\n },\n\n // Allows theming \"regular\" top badges.\n installHaStateLabelBadge() {\n customElements.whenDefined('ha-state-label-badge').then(() => {\n const haStateLabelBadge = customElements.get('ha-state-label-badge');\n if (!haStateLabelBadge || !haStateLabelBadge.prototype.stateChanged) return;\n // Use named function to preserve 'this'.\n haStateLabelBadge.prototype.stateChanged = function update(stateObj) {\n // TODO: Call window.customUI.maybeChangeObject\n if (stateObj.attributes.theme) {\n if (this.hass.themes === null) {\n this.hass._themeWaiters = this.hass._themeWaiters || [];\n this.hass._themeWaiters.push(this);\n } else {\n applyThemesOnElement(\n this,\n this.hass.themes || { default_theme: 'default', themes: {} },\n stateObj.attributes.theme || 'default');\n }\n }\n this.updateStyles();\n if (this.startInterval) {\n // Added on 19.1.2018\n this.startInterval(stateObj);\n }\n };\n });\n },\n\n installStateBadge() {\n customElements.whenDefined('state-badge').then(() => {\n const stateBadge = customElements.get('state-badge');\n if (!stateBadge || !stateBadge.prototype._updateIconAppearance) return;\n const originalUpdateIconAppearance = stateBadge.prototype._updateIconAppearance;\n // Use named function to preserve 'this'.\n stateBadge.prototype._updateIconAppearance = function customUpdateIconAppearance(stateObj) {\n if (stateObj.attributes.icon_color && !stateObj.attributes.entity_picture) {\n this.style.backgroundImage = '';\n Object.assign(this.$.icon.style, {\n color: stateObj.attributes.icon_color,\n filter: '',\n });\n } else {\n originalUpdateIconAppearance.call(this, stateObj);\n }\n };\n });\n },\n\n installHaAttributes() {\n customElements.whenDefined('ha-attributes').then(() => {\n const haAttributes = customElements.get('ha-attributes');\n if (!haAttributes || !haAttributes.prototype.computeFiltersArray ||\n !window.hassAttributeUtil) return;\n // Use named function to preserve 'this'.\n haAttributes.prototype.computeFiltersArray =\n function customComputeFiltersArray(extraFilters) {\n return Object.keys(window.hassAttributeUtil.LOGIC_STATE_ATTRIBUTES).concat(\n extraFilters ? extraFilters.split(',') : []);\n };\n });\n },\n\n installHaFormCustomize() {\n if (!window.location.pathname.startsWith('/config')) return;\n customElements.whenDefined('ha-form-customize').then(() => {\n const haFormCustomize = customElements.get('ha-form-customize');\n if (!haFormCustomize) {\n // DOM not ready. Wait 100ms.\n window.setTimeout(window.customUI.installHaFormCustomize, 100);\n return;\n }\n if (window.customUI.haFormCustomizeInitDone) return;\n window.customUI.haFormCustomizeInitDone = true;\n\n if (!window.hassAttributeUtil) return;\n if (haFormCustomize.prototype._computeSingleAttribute) {\n // Use named function to preserve 'this'.\n haFormCustomize.prototype._computeSingleAttribute =\n function customComputeSingleAttribute(key, value, secondary) {\n const config = window.hassAttributeUtil.LOGIC_STATE_ATTRIBUTES[key]\n || { type: window.hassAttributeUtil.UNKNOWN_TYPE };\n return this._initOpenObject(key, config.type === 'json' ? JSON.stringify(value) : value, secondary, config);\n };\n }\n if (haFormCustomize.prototype.getNewAttributesOptions) {\n // Use named function to preserve 'this'.\n haFormCustomize.prototype.getNewAttributesOptions =\n function customgetNewAttributesOptions(\n localAttributes, globalAttributes, existingAttributes, newAttributes) {\n const knownKeys =\n Object.keys(window.hassAttributeUtil.LOGIC_STATE_ATTRIBUTES)\n .filter((key) => {\n const conf = window.hassAttributeUtil.LOGIC_STATE_ATTRIBUTES[key];\n return conf && (!conf.domains || !this.entity ||\n conf.domains.includes(computeStateDomain(this.entity)));\n })\n .filter(this.filterFromAttributes(localAttributes))\n .filter(this.filterFromAttributes(globalAttributes))\n .filter(this.filterFromAttributes(existingAttributes))\n .filter(this.filterFromAttributes(newAttributes));\n return knownKeys.sort().concat('Other');\n };\n }\n });\n },\n\n installClassHooks() {\n if (window.customUI.classInitDone) return;\n window.customUI.classInitDone = true;\n window.customUI.installPartialCards();\n window.customUI.installStatesHook();\n window.customUI.installHaStateLabelBadge();\n window.customUI.installStateBadge();\n window.customUI.installHaAttributes();\n window.customUI.installActionName('state-card-scene');\n window.customUI.installActionName('state-card-script');\n },\n\n init() {\n if (window.customUI.initDone) return;\n window.customUI.installClassHooks();\n const main = window.customUI.lightOrShadow(document, 'home-assistant');\n if (!main.hass || !main.hass.states) {\n // Connection wasn't made yet. Try in 1 second.\n window.setTimeout(window.customUI.init, 1000);\n return;\n }\n window.customUI.initDone = true;\n\n window.customUI.useCustomizer();\n\n window.customUI.runHooks();\n window.addEventListener('location-changed', window.setTimeout.bind(null, window.customUI.runHooks, 100));\n /* eslint-disable no-console */\n console.log(`Loaded CustomUI ${VERSION}`);\n /* eslint-enable no-console */\n if (!window.CUSTOM_UI_LIST) {\n window.CUSTOM_UI_LIST = [];\n }\n window.CUSTOM_UI_LIST.push({\n name: 'CustomUI',\n version: VERSION,\n url: 'https://github.com/andrey-git/home-assistant-custom-ui',\n });\n },\n\n runHooks() {\n window.customUI.fixGroupTitles();\n window.customUI.updateConfigPanel();\n window.customUI.installHaFormCustomize();\n },\n\n getName() {\n return window.localStorage.getItem('ha-device-name') || '';\n },\n\n setName(name) {\n window.localStorage.setItem('ha-device-name', name || '');\n },\n\n computeTemplate(template, hass, entities, entity, attributes, attribute, state) {\n const functionBody = (template.indexOf('return') >= 0) ? template : `return \\`${template}\\`;`;\n try {\n /* eslint-disable no-new-func */\n const func = new Function(\n 'hass', 'entities', 'entity', 'attributes', 'attribute', 'state', functionBody);\n /* eslint-enable no-new-func */\n return func(hass, entities, entity, attributes, attribute, state);\n } catch (e) {\n /* eslint-disable no-console */\n if ((e instanceof SyntaxError) || e instanceof ReferenceError) {\n console.warn(`${e.name}: ${e.message} in template ${functionBody}`);\n return null;\n }\n /* eslint-enable no-console */\n throw e;\n }\n },\n};\nwindow.customUI.init();\n","import computeDomain from './compute_domain.js';\nimport getGroupEntities from './get_group_entities.js';\n\n// Return an object containing all entities that the view will show\n// including embedded groups.\nexport default function getViewEntities(entities, view) {\n const viewEntities = {};\n\n view.attributes.entity_id.forEach((entityId) => {\n const entity = entities[entityId];\n\n if (entity && !entity.attributes.hidden) {\n viewEntities[entity.entity_id] = entity;\n\n if (computeDomain(entity.entity_id) === 'group') {\n const groupEntities = getGroupEntities(entities, entity);\n\n Object.keys(groupEntities).forEach((grEntityId) => {\n const grEntity = groupEntities[grEntityId];\n\n if (!grEntity.attributes.hidden) {\n viewEntities[grEntityId] = grEntity;\n }\n });\n }\n }\n });\n\n return viewEntities;\n}\n","export default function getGroupEntities(entities, group) {\n const result = {};\n\n group.attributes.entity_id.forEach((entityId) => {\n const entity = entities[entityId];\n\n if (entity) {\n result[entity.entity_id] = entity;\n }\n });\n\n return result;\n}\n","import '../utils/hooks.js';\n\n/**\n * @extends HTMLElement\n */\nclass CuiBaseElement extends Polymer.Element {\n static get properties() {\n return {\n hass: Object,\n inDialog: {\n type: Boolean,\n value: false,\n },\n stateObj: Object,\n controlElement: String,\n extra: {\n type: Array,\n computed: 'computeExtra(hass, stateObj)',\n },\n };\n }\n\n computeExtra(hass, stateObj) {\n let extras = stateObj.attributes.extra_data_template;\n if (extras) {\n if (!Array.isArray(extras)) {\n extras = [extras];\n }\n return extras.map(extra => window.customUI.computeTemplate(\n extra,\n hass,\n hass.states,\n stateObj,\n stateObj.attributes,\n /* attribute= */ undefined,\n stateObj.state,\n )).filter(result => result !== null);\n }\n return [];\n }\n\n showLastChanged(stateObj, inDialog, extra) {\n if (inDialog) return true;\n if (extra.length) return false;\n return !!stateObj.attributes.show_last_changed;\n }\n\n hasExtra(extra) {\n return extra.length > 0;\n }\n}\nexport default CuiBaseElement;\n","import dynamicContentUpdater from '../../home-assistant-polymer/src/common/dom/dynamic_content_updater.js';\n\n/**\n * @extends HTMLElement\n */\nclass DynamicElement extends Polymer.Element {\n static get properties() {\n return {\n hass: Object,\n stateObj: Object,\n elementName: String,\n\n inDialog: {\n type: Boolean,\n value: false,\n },\n };\n }\n\n static get observers() {\n return [\n 'observerFunc(hass, stateObj, elementName, inDialog)',\n ];\n }\n\n observerFunc(hass, stateObj, elementName, inDialog) {\n dynamicContentUpdater(\n this,\n elementName ? elementName.toUpperCase() : 'DIV',\n { hass, stateObj, inDialog });\n }\n}\ncustomElements.define('dynamic-element', DynamicElement);\n","import { html } from '@polymer/polymer/lib/utils/html-tag.js';\nimport applyThemesOnElement from '../../home-assistant-polymer/src/common/dom/apply_themes_on_element.js';\n\nimport './dynamic-element.js';\nimport '../utils/hooks.js';\n\ncustomElements.whenDefined('state-card-display').then(() => {\n /**\n * @extends HTMLElement\n */\n class DynamicWithExtra extends customElements.get('state-card-display') {\n static get template() {\n return html`\n <style is=\"custom-style\" include=\"iron-flex iron-flex-alignment iron-flex-factors\"></style>\n <style>\n :host {\n display: inline-block;\n }\n .control-wrapper {\n margin: -4px -16px -4px 0;\n padding: 4px 16px;\n }\n ha-state-label-badge {\n margin-left: 8px;\n }\n dynamic-element {\n display: block;\n text-align: right;\n }\n #overlay {\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n text-align: right;\n z-index: 1;\n }\n #lock {\n margin-top: 8px;\n opacity: 0.3;\n margin-right: 7px;\n }\n #lock.ha-cover-controls {\n margin-right: 52px;\n background-color: white;\n }\n .extra {\n margin-bottom: -16px;\n --ha-label-badge-size: 36px;\n --ha-label-badge-font-size: 1.2em;\n }\n .state {\n @apply --paper-font-body1;\n color: var(--primary-text-color);\n margin-left: 16px;\n text-align: right;\n line-height: 40px;\n }\n </style>\n <div class$='[[extraClass(extraObjVisible)]] horizontal layout'>\n <template is='dom-if' if='[[extraObjVisible]]'>\n <template is='dom-repeat'\n items='[[extraObj]]'\n on-dom-change='extraDomChanged'>\n <ha-state-label-badge hass='[[hass]]' state='[[item]]'></ha-state-label-badge>\n </template>\n </template>\n <template is='dom-if' if='[[_showControl(inDialog, stateObj)]]'>\n <template is='dom-if' if='[[controlElement]]'>\n <div class=\"control-wrapper\">\n <dynamic-element\n class='flex'\n state-obj=\"[[stateObj]]\"\n hass='[[hass]]'\n element-name='[[controlElement]]'>\n </dynamic-element>\n <template is='dom-if' if='[[isConfirmControls(stateObj)]]'>\n <div id=\"overlay\" on-click='clickHandler'>\n <template is='dom-if' if='[[stateObj.attributes.confirm_controls_show_lock]]'>\n <iron-icon id=\"lock\" class$=\"[[controlElement]]\" icon=\"mdi:lock-outline\"></iron-icon>\n </template>\n </div>\n </template>\n </div>\n </template>\n <template is='dom-if' if='[[!controlElement]]'>\n <div class='state'>[[computeStateDisplay(stateObj)]]</div>\n </template>\n </template>\n </div>\n `;\n }\n\n static get properties() {\n return {\n hass: Object,\n inDialog: {\n type: Boolean,\n value: false,\n },\n stateObj: Object,\n controlElement: String,\n extraObj: {\n type: Array,\n computed: 'computeExtra(hass, stateObj, _attached)',\n },\n _attached: Boolean,\n extraObjVisible: {\n type: Boolean,\n computed: 'computeExtraVisible(extraObj, inDialog)',\n },\n };\n }\n\n connectedCallback() {\n super.connectedCallback();\n this._attached = true;\n }\n\n disconnectedCallback() {\n this._isAttached = false;\n super.disconnectedCallback();\n }\n\n computeExtra(hass, stateObj, attached) {\n if (!stateObj.attributes.extra_badge || !attached) return [];\n let extraBadges = stateObj.attributes.extra_badge;\n if (!Array.isArray(extraBadges)) {\n extraBadges = [extraBadges];\n }\n return extraBadges.map((extraBadge) => {\n let result = null;\n if (extraBadge.entity_id && hass.states[extraBadge.entity_id]) {\n result = Object.assign({}, window.customUI.maybeChangeObject(\n this, hass.states[extraBadge.entity_id], this.inDialog,\n /* allowHidden= */false));\n } else if (extraBadge.attribute &&\n stateObj.attributes[extraBadge.attribute] !== undefined) {\n result = {\n state: String(stateObj.attributes[extraBadge.attribute]),\n entity_id: 'none.none',\n attributes: { unit_of_measurement: extraBadge.unit },\n };\n }\n if (!result) return null;\n let blacklist = extraBadge.blacklist_states;\n if (blacklist !== undefined) {\n if (!Array.isArray(blacklist)) {\n blacklist = [blacklist];\n }\n if (blacklist.some(v => RegExp(v).test(result.state.toString()))) {\n return null;\n }\n }\n result._entityDisplay = '';\n return result;\n }).filter(extraBadge => extraBadge != null);\n }\n\n computeExtraVisible(extraObj, inDialog) {\n if (inDialog || !extraObj) return false;\n return extraObj.length !== 0;\n }\n\n extraClass(extraObjVisible) {\n return extraObjVisible ? 'extra' : '';\n }\n\n _showControl(inDialog, stateObj) {\n if (inDialog) return true;\n return !stateObj.attributes.hide_control;\n }\n\n computeStateDisplay(stateObj) {\n // haLocalize removed in 0.61\n return super.computeStateDisplay(this.haLocalize || this.localize, stateObj);\n }\n\n isConfirmControls(stateObj) {\n return stateObj.attributes.confirm_controls ||\n stateObj.attributes.confirm_controls_show_lock;\n }\n\n clickHandler(e) {\n this.root.querySelector('#overlay').style.pointerEvents = 'none';\n const lock = this.root.querySelector('#lock');\n if (lock) {\n lock.icon = 'mdi:lock-open-outline';\n lock.style.opacity = '0.1';\n }\n window.setTimeout(() => {\n this.root.querySelector('#overlay').style.pointerEvents = '';\n if (lock) {\n lock.icon = 'mdi:lock-outline';\n lock.style.opacity = '';\n }\n }, 5000);\n e.stopPropagation();\n }\n\n applyThemes(hass, element, stateObj) {\n const themeName = stateObj.attributes.theme || 'default';\n applyThemesOnElement(\n element, hass.themes || { default_theme: 'default', themes: {} }, themeName);\n }\n\n extraDomChanged() {\n this.root.querySelectorAll('ha-state-label-badge')\n .forEach((elem) => {\n this.applyThemes(this.hass, elem, elem.state);\n });\n }\n }\n customElements.define('dynamic-with-extra', DynamicWithExtra);\n});\n","import { html } from '@polymer/polymer/lib/utils/html-tag.js';\n\n/**\n * @extends HTMLElement\n */\nclass HaThemedSlider extends Polymer.Element {\n static get template() {\n return html`\n <style>\n :host {\n margin: var(--ha-themed-slider-margin, initial);\n }\n .disable-off-when-min {\n --paper-slider-pin-start-color: var(--paper-slider-pin-color);\n }\n\n .disable-off-when-min.is-on {\n --paper-slider-knob-start-color: var(--paper-slider-knob-color);\n --paper-slider-knob-start-border-color: var(--paper-slider-knob-color);\n }\n paper-slider {\n margin: 4px 0;\n max-width: 100%;\n min-width: 100px;\n width: var(--ha-paper-slider-width, 200px);\n }\n </style>\n\n <paper-slider\n min='[[_themedMin]]'\n max='[[_computeAttribute(theme, \"max\", max)]]'\n pin='[[_computeAttribute(theme, \"pin\", pin)]]'\n class$='[[computeClass(theme, isOn, _themedMin)]]' value='[[value]]'\n on-change='valueChanged'>\n </paper-slider>\n `;\n }\n\n ready() {\n super.ready();\n this.disableOffWhenMin = !this._computeAttribute(this.theme, 'off_when_min', !this.disableOffWhenMin);\n this.computeEnabledThemedReportWhenNotChanged(this.theme, this.disableReportWhenNotChanged);\n }\n\n static get properties() {\n return {\n min: {\n type: Number,\n value: 0,\n },\n max: {\n type: Number,\n value: 100,\n },\n pin: {\n type: Boolean,\n value: false,\n },\n isOn: {\n type: Boolean,\n value: false,\n },\n disableOffWhenMin: {\n type: Boolean,\n value: false,\n notify: true,\n },\n disableReportWhenNotChanged: {\n type: Boolean,\n value: false,\n },\n\n theme: Object,\n value: {\n type: Number,\n notify: true,\n },\n _themedMin: {\n type: Number,\n computed: '_computeAttribute(theme, \"min\", min)',\n },\n };\n }\n\n static get observers() {\n return [\n 'computeEnabledThemedReportWhenNotChanged(theme, disableReportWhenNotChanged)',\n ];\n }\n\n computeEnabledThemedReportWhenNotChanged(theme, disableReportWhenNotChanged) {\n this._enabledThemedReportWhenNotChanged = this._computeAttribute(\n theme, 'report_when_not_changed', !disableReportWhenNotChanged);\n }\n\n _computeAttribute(theme, attr, def) {\n if (theme) {\n if (attr in theme) {\n return theme[attr];\n }\n }\n return def;\n }\n\n computeClass(theme, isOn, themedMin) {\n let result = '';\n if (isOn) {\n result += 'is-on ';\n }\n if (this._computeAttribute(theme, 'off_when_min', !this.disableOffWhenMin) || themedMin === 0) {\n // If offWhenMin is enabled don't customize.\n return '';\n }\n return `${result}disable-off-when-min`;\n }\n\n valueChanged(ev) {\n if (!this._enabledThemedReportWhenNotChanged && this.value === ev.target.value) {\n ev.stopPropagation();\n return;\n }\n this.value = ev.target.value;\n }\n}\ncustomElements.define('ha-themed-slider', HaThemedSlider);\n","import { html } from '@polymer/polymer/lib/utils/html-tag.js';\nimport CuiBaseElement from './cui-base-element.js';\nimport './dynamic-with-extra.js';\nimport './ha-themed-slider.js';\n\n/**\n * @extends HTMLElement\n */\nclass StateCardWithSlider extends CuiBaseElement {\n static get template() {\n return html`\n <style is=\"custom-style\" include=\"iron-flex iron-flex-alignment iron-flex-factors\"></style>\n <style>\n #container {\n position: relative;\n }\n .second-line, .state-and-toggle, .state-info {\n max-width: 100%;\n }\n .nowrap .state-and-toggle {\n overflow: hidden;\n flex-grow: 0;\n }\n .nowrap .second-line {\n overflow: hidden;\n }\n\n .second-line {\n padding-top: 20px;\n padding-bottom: 16px;\n margin-top: -20px;\n margin-bottom: -16px;\n }\n .stretch .second-line, .stretch ha-themed-slider {\n width: 100%;\n --ha-paper-slider-width: 100%;\n }\n .nowrap .state-info {\n min-width: initial;\n }\n ha-themed-slider, .top-wrapper {\n min-width: 100px;\n max-width: 100%;\n }\n .top-wrapper.stretch {\n display: block;\n }\n\n .hidden {\n display: none;\n }\n </style>\n\n <div id='container' class$='horizontal layout flex top-wrapper [[_computeWrapClass(mode, stretchSlider, lineTooLong, inDialog)]]'>\n <div class='horizontal layout justified flex-auto state-and-toggle'>\n <state-info\n class='state-info flex-auto'\n hass='[[hass]]'\n state-obj='[[stateObj]]'\n in-dialog='[[showLastChanged(stateObj, inDialog, extra)]]'\n secondary-line$='[[hasExtra(extra)]]'\n >\n <template is='dom-repeat' items='[[extra]]'>\n <div>[[item]]</div>\n </template>\n </state-info>\n <template is='dom-if' if='[[breakSlider]]' class='hidden'>\n <dynamic-with-extra hass='[[hass]]' state-obj='[[stateObj]]' control-element='[[controlElement]]' in-dialog='[[inDialog]]'></dynamic-with-extra>\n </template>\n </div>\n <template is='dom-if' if='[[showSlider]]' restamp>\n <div class='horizontal layout flex-auto end-justified second-line'>\n <ha-themed-slider\n id='slider'\n max=[[max]]\n min=[[min]]\n theme='[[stateObj.attributes.slider_theme]]'\n is-on='[[isOn(stateObj, nameOn)]]'\n value='{{sliderValue}}'\n disable-off-when-min='{{disableOffWhenMin}}'\n on-change='sliderChanged'\n on-click='stopPropagation'>\n </ha-themed-slider>\n <template is='dom-if' if='[[!breakSlider]]'>\n <dynamic-with-extra hass='[[hass]]' state-obj='[[stateObj]]' control-element='[[controlElement]]' in-dialog='[[inDialog]]'></dynamic-with-extra>\n </template>\n </div>\n </template>\n </div>\n `;\n }\n\n static get properties() {\n return {\n domain: String,\n serviceMin: String,\n serviceMax: String,\n valueName: String,\n setValueName: String,\n nameOn: { type: String, value: 'on' },\n min: { type: Number, value: 0 },\n max: { type: Number, value: 255 },\n\n sliderValue: {\n type: Number,\n value: 0,\n },\n disableOffWhenMin: Boolean,\n mode: String,\n stretchSlider: {\n type: Boolean,\n value: false,\n },\n breakSlider: {\n type: Boolean,\n value: false,\n },\n hideSlider: {\n type: Boolean,\n value: false,\n },\n lineTooLong: {\n type: Boolean,\n value: false,\n },\n minLineBreak: Number,\n maxLineBreak: Number,\n showSlider: {\n type: Number,\n computed: '_showSlider(inDialog, stateObj, hideSlider)',\n },\n };\n }\n\n ready() {\n super.ready();\n this._onIronResize = this._onIronResize.bind(this);\n }\n\n connectedCallback() {\n super.connectedCallback();\n this._isConnected = true;\n window.addEventListener('resize', this._onIronResize);\n this._waitForLayout();\n }\n\n disconnectedCallback() {\n window.removeEventListener('resize', this._onIronResize);\n this._isConnected = false;\n super.disconnectedCallback();\n }\n\n static get observers() {\n return [\n 'stateObjChanged(stateObj, nameOn, valueName)',\n ];\n }\n\n _waitForLayout() {\n if (!this._isConnected) return;\n this._setMode();\n if (this._frameId) return;\n this.readyToCompute = false;\n this._frameId = window.requestAnimationFrame(() => {\n this._frameId = null;\n this.readyToCompute = true;\n this._onIronResize();\n });\n }\n\n _setMode() {\n const obj = {\n hideSlider: this.mode === 'hide-slider' && this.lineTooLong,\n breakSlider:\n (this.mode === 'break-slider' || this.mode === 'hide-slider') &&\n this.lineTooLong,\n };\n if (!this.showSlider) {\n obj.breakSlider = true;\n }\n this.setProperties(obj);\n }\n\n _onIronResize() {\n if (!this.readyToCompute) return;\n if (this.mode === 'no-slider') {\n this.setProperties({\n hideSlider: true,\n breakSlider: true,\n });\n return;\n }\n const prevBreakSlider = this.breakSlider;\n const prevHideSlider = this.hideSlider;\n this.setProperties({\n lineTooLong: false,\n hideSlider: false,\n breakSlider: false,\n });\n const { container } = this.$;\n const containerWidth = container.clientWidth;\n if (containerWidth === 0) return;\n if (containerWidth <= this.minLineBreak) {\n this.lineTooLong = true;\n } else if (containerWidth >= this.maxLineBreak) {\n this.lineTooLong = false;\n } else {\n if (prevHideSlider && this.mode === 'hide-slider') {\n // We need to unhide the slider in order to recalculate height.\n this._waitForLayout();\n return;\n }\n const containerHeight = container.clientHeight;\n const stateHeight = this.root.querySelector('.state-info').clientHeight;\n this.lineTooLong = containerHeight > stateHeight * 1.5;\n if (this.lineTooLong) {\n this.minLineBreak = containerWidth;\n } else if (!prevBreakSlider) {\n this.maxLineBreak = containerWidth;\n }\n }\n this._setMode();\n }\n\n _computeWrapClass(mode, stretchSlider, lineTooLong, inDialog) {\n if (inDialog) {\n return '';\n }\n if (mode === 'single-line') {\n return 'nowrap';\n }\n if (stretchSlider && lineTooLong) {\n return 'stretch wrap';\n }\n return 'wrap';\n }\n\n _showSlider(inDialog, stateObj, hideSlider) {\n if (inDialog || hideSlider) {\n return false;\n }\n return true;\n }\n\n sliderChanged(ev) {\n const value = parseInt(ev.target.value, 10);\n const param = { entity_id: this.stateObj.entity_id };\n if (Number.isNaN(value)) return;\n let target = this.root.querySelector('#slider');\n if (ev.target !== target) {\n // No Shadow DOM - we have access to original target.\n ({ target } = ev);\n } else if (ev.path) {\n [target] = ev.path;\n } else if (ev.composedPath) {\n [target] = ev.composedPath();\n }\n if (value === 0 || (value <= target.min && !this.disableOffWhenMin)) {\n this.hass.callService(this.domain, this.serviceMin, param);\n } else {\n param[this.setValueName || this.valueName] = value;\n this.hass.callService(this.domain, this.serviceMax, param);\n }\n }\n\n stateObjChanged(stateObj, nameOn, valueName) {\n const obj = {\n sliderValue: this.isOn(stateObj, nameOn) ? stateObj.attributes[valueName] : 0,\n };\n if (stateObj) {\n Object.assign(obj, {\n minLineBreak: 0,\n maxLineBreak: 999,\n hideSlider: false,\n breakSlider: false,\n lineTooLong: false,\n mode: stateObj.attributes.state_card_mode,\n stretchSlider: !!stateObj.attributes.stretch_slider,\n });\n }\n this.setProperties(obj);\n if (stateObj) {\n this._waitForLayout();\n }\n }\n\n isOn(stateObj, nameOn) {\n return stateObj && (!nameOn || stateObj.state === nameOn);\n }\n\n stopPropagation(ev) {\n ev.stopPropagation();\n }\n}\ncustomElements.define('state-card-with-slider', StateCardWithSlider);\n","import { html } from '@polymer/polymer/lib/utils/html-tag.js';\nimport CuiBaseElement from './cui-base-element.js';\nimport './dynamic-with-extra.js';\n\n/**\n * @extends HTMLElement\n */\nclass StateCardWithoutSlider extends CuiBaseElement {\n static get template() {\n return html`\n <style is=\"custom-style\" include=\"iron-flex iron-flex-alignment\"></style>\n <style>\n #container {\n position: relative;\n }\n </style>\n\n <div id='container' class='horizontal layout justified'>\n <state-info\n hass='[[hass]]'\n class='state-info'\n state-obj='[[stateObj]]'\n in-dialog='[[showLastChanged(stateObj, inDialog, extra)]]'\n secondary-line$='[[hasExtra(extra)]]'>\n <template is='dom-repeat' items='[[extra]]'>\n <div>[[item]]</div>\n </template>\n </state-info>\n <dynamic-with-extra\n hass='[[hass]]'\n state-obj='[[stateObj]]'\n control-element='[[controlElement]]'\n in-dialog='[[inDialog]]'>\n </dynamic-with-extra>\n </div>\n `;\n }\n}\ncustomElements.define('state-card-without-slider', StateCardWithoutSlider);\n","import applyThemesOnElement from '../../home-assistant-polymer/src/common/dom/apply_themes_on_element.js';\nimport computeStateDomain from '../../home-assistant-polymer/src/common/entity/compute_state_domain.js';\nimport dynamicContentUpdater from '../../home-assistant-polymer/src/common/dom/dynamic_content_updater.js';\nimport stateCardType from '../../home-assistant-polymer/src/common/entity/state_card_type.js';\n\nimport '../utils/hooks.js';\nimport './state-card-with-slider.js';\nimport './state-card-without-slider.js';\n\nconst SHOW_LAST_CHANGED_BLACKLISTED_CARDS = ['configurator'];\nconst DOMAIN_TO_SLIDER_SUPPORT = {\n light: 1, // SUPPORT_BRIGHTNESS\n cover: 4, // SUPPORT_SET_POSITION\n climate: 1, // SUPPORT_TARGET_TEMPERATURE\n};\nconst TYPE_TO_CONTROL = {\n toggle: 'ha-entity-toggle',\n display: '',\n cover: 'ha-cover-controls',\n};\n\n/**\n * @extends HTMLElement\n */\nclass StateCardCustomUi extends Polymer.Element {\n static get properties() {\n return {\n hass: Object,\n\n inDialog: {\n type: Boolean,\n value: false,\n },\n\n stateObj: Object,\n };\n }\n\n static get observers() {\n return [\n 'inputChanged(hass, inDialog, stateObj)',\n ];\n }\n\n connectedCallback() {\n super.connectedCallback();\n const container = this.parentNode.parentNode;\n if (container.tagName === 'DIV' &&\n (container.classList.contains('state') || container.classList.contains('child-card'))) {\n this._container = container;\n\n // Since this doesn't actually change the background - no need to clear it.\n container.style.setProperty(\n 'background-color', 'var(--paper-card-background-color, inherit)');\n\n // Polyfill 'updateStyles'.\n if (!container.updateStyles) {\n container.updateStyles = (styles) => {\n Object.keys(styles).forEach((key) => {\n container.style.setProperty(key, styles[key]);\n });\n };\n }\n }\n this._isAttached = true;\n this.inputChanged(this.hass, this.inDialog, this.stateObj);\n }\n\n disconnectedCallback() {\n this._isAttached = false;\n if (this._container) {\n this._container.updateStyles({ display: '', margin: '', padding: '' });\n applyThemesOnElement(\n this._container, this.hass.themes || { default_theme: 'default', themes: {} }, 'default');\n this._container = null;\n }\n super.disconnectedCallback();\n }\n\n badgeMode(hass, stateObj, domain) {\n const states = [];\n if (domain === 'group') {\n stateObj.attributes.entity_id.forEach((id) => {\n const state = hass.states[id];\n if (!state) {\n /* eslint-disable no-console */\n console.warn(`Unknown ID ${id} in group ${stateObj.entity_id}`);\n /* eslint-enable no-console */\n return;\n }\n if (!stateObj.attributes.badges_list ||\n stateObj.attributes.badges_list.includes(state.entity_id)) {\n states.push(window.customUI.maybeChangeObject(\n this, state, false /* inDialog */, false /* allowHidden */));\n }\n });\n } else {\n states.push(stateObj);\n if (this._container) {\n this._container.style.display = 'inline-block';\n const params = { display: 'inline-block' };\n if (this._container.classList.contains('state')) {\n params.margin = 'var(--ha-badges-card-margin, 0)';\n }\n this.updateStyles(params);\n }\n }\n dynamicContentUpdater(\n this,\n 'HA-BADGES-CARD',\n { hass, states });\n if (this._container) {\n this._container.updateStyles({\n width: 'var(--ha-badges-card-width, initial)',\n 'text-align': 'var(--ha-badges-card-text-align, initial)',\n });\n }\n this.lastChild.style.fontSize = '85%';\n\n // Since this variable only affects badges mode - no need to clean it up.\n this.style.setProperty('--ha-state-label-badge-margin-bottom', '0');\n }\n\n cleanBadgeStyle() {\n if (this._container) {\n this._container.updateStyles({\n display: '',\n width: '',\n 'text-align': '',\n });\n }\n this.updateStyles({ display: '', margin: '' });\n }\n\n applyThemes(hass, modifiedObj) {\n let themeTarget = this;\n let themeName = 'default';\n if (this._container) {\n themeTarget = this._container;\n }\n if (modifiedObj.attributes.theme) {\n themeName = modifiedObj.attributes.theme;\n }\n applyThemesOnElement(\n themeTarget, hass.themes || { default_theme: 'default', themes: {} }, themeName);\n }\n\n maybeHideEntity(modifiedObj) {\n if (!modifiedObj) {\n if (this.lastChild) {\n this.removeChild(this.lastChild);\n }\n if (this._container) {\n this._container.updateStyles({ margin: '0', padding: '0' });\n }\n return true;\n }\n if (this._container) {\n this._container.updateStyles({ margin: '', padding: '' });\n }\n return false;\n }\n\n sliderEligible_(domain, obj, inDialog) {\n if (inDialog) return false;\n return DOMAIN_TO_SLIDER_SUPPORT[domain] &&\n (DOMAIN_TO_SLIDER_SUPPORT[domain] & obj.attributes.supported_features) &&\n obj.attributes.state_card_mode && obj.attributes.state_card_mode !== 'no-slider';\n }\n\n inputChanged(hass, inDialog, stateObj) {\n if (!stateObj || !hass || !this._isAttached) return;\n const domain = computeStateDomain(stateObj);\n const modifiedObj = window.customUI.maybeChangeObject(\n this, stateObj, inDialog, true /* allowHidden */);\n\n if (this.maybeHideEntity(modifiedObj)) return;\n\n this.applyThemes(hass, modifiedObj);\n\n if (!inDialog && modifiedObj.attributes.state_card_mode === 'badges') {\n this.badgeMode(hass, modifiedObj, domain);\n } else {\n this.regularMode_(hass, inDialog, modifiedObj, domain);\n }\n }\n\n regularMode_(hass, inDialog, stateObj, domain) {\n this.cleanBadgeStyle();\n\n const params = {\n hass,\n stateObj,\n inDialog,\n };\n const originalStateCardType = stateCardType(hass, stateObj);\n let customStateCardType;\n const secondaryStateCardType = stateObj.attributes.state_card_custom_ui_secondary;\n\n if (domain === 'light' && this.sliderEligible_(domain, stateObj, inDialog)) {\n Object.assign(params, {\n controlElement: 'ha-entity-toggle',\n serviceMin: 'turn_off',\n serviceMax: 'turn_on',\n valueName: 'brightness',\n domain,\n });\n customStateCardType = 'state-card-with-slider';\n } else if (domain === 'cover' && this.sliderEligible_(domain, stateObj, inDialog)) {\n Object.assign(params, {\n controlElement: 'ha-cover-controls',\n max: 100,\n serviceMin: 'close_cover',\n serviceMax: 'set_cover_position',\n setValueName: 'position',\n valueName: 'current_position',\n nameOn: 'open',\n domain,\n });\n customStateCardType = 'state-card-with-slider';\n } else if (domain === 'climate' && this.sliderEligible_(domain, stateObj, inDialog)) {\n Object.assign(params, {\n controlElement: 'ha-climate-state',\n min: stateObj.attributes.min_temp || -100,\n max: stateObj.attributes.max_temp || 200,\n serviceMin: 'set_temperature',\n serviceMax: 'set_temperature',\n valueName: 'temperature',\n nameOn: '',\n domain,\n });\n customStateCardType = 'state-card-with-slider';\n } else if (TYPE_TO_CONTROL[originalStateCardType] !== undefined) {\n params.controlElement = TYPE_TO_CONTROL[originalStateCardType];\n customStateCardType = 'state-card-without-slider';\n } else if (stateObj.attributes.show_last_changed &&\n !SHOW_LAST_CHANGED_BLACKLISTED_CARDS.includes(originalStateCardType)) {\n params.inDialog = true;\n }\n if (stateObj.state === 'unavailable') {\n params.controlElement = '';\n }\n if (stateObj.attributes.control_element !== undefined) {\n params.controlElement = stateObj.attributes.control_element;\n }\n\n dynamicContentUpdater(\n this,\n (secondaryStateCardType || customStateCardType || `STATE-CARD-${originalStateCardType}`).toUpperCase(),\n params);\n }\n}\ncustomElements.define('state-card-custom-ui', StateCardCustomUi);\n","import canToggleDomain from './can_toggle_domain.js';\nimport computeStateDomain from './compute_state_domain.js';\n\nexport default function canToggleState(hass, stateObj) {\n const domain = computeStateDomain(stateObj);\n if (domain === 'group') {\n return stateObj.state === 'on' || stateObj.state === 'off';\n }\n if (domain === 'climate') {\n return !!((stateObj.attributes || {}).supported_features & 4096);\n }\n\n return canToggleDomain(hass, domain);\n}\n","export default function canToggleDomain(hass, domain) {\n const services = hass.services[domain];\n if (!services) { return false; }\n\n if (domain === 'lock') {\n return 'lock' in services;\n } else if (domain === 'cover') {\n return 'open_cover' in services;\n }\n return 'turn_on' in services;\n}\n","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\nwindow.JSCompiler_renameProperty = function(prop) { return prop; };\n"],"sourceRoot":""}