forked from andrey-git/home-assistant-custom-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
scripts-es5.js.map
1 lines (1 loc) · 120 KB
/
scripts-es5.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.ts","webpack:///../home-assistant-polymer/src/common/entity/compute_state_domain.ts","webpack:///../home-assistant-polymer/src/common/dom/dynamic_content_updater.js","webpack:///../home-assistant-polymer/src/common/entity/supports-feature.ts","webpack:///../home-assistant-polymer/src/common/const.ts","webpack:///../home-assistant-polymer/src/common/entity/state_card_type.ts","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.ts","webpack:///../home-assistant-polymer/src/common/entity/get_group_entities.ts","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.ts","webpack:///../home-assistant-polymer/src/common/entity/can_toggle_domain.ts","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","customEl","rootEl","lastChild","tagName","removeChild","createElement","toLowerCase","setProperties","parentNode","appendChild","supportsFeature","feature","supported_features","DOMAINS_WITH_CARD","_defineProperties","target","props","descriptor","writable","Set","LiteralString","string","this","toString","html","strings","template","_len","values","Array","_key","innerHTML","reduce","acc","v","idx","HTMLTemplateElement","Error","concat","literalValue","events_mixin","superClass","_superClass","EventsMixin","instance","Constructor","TypeError","_getPrototypeOf","apply","subClass","create","constructor","_setPrototypeOf","type","detail","options","event","Event","bubbles","cancelable","Boolean","composed","node","dispatchEvent","ha_config_custom_ui_typeof","obj","Symbol","iterator","_templateObject","raw","data","slice","freeze","defineProperties","ha_config_custom_ui_defineProperties","_get","receiver","Reflect","base","ha_config_custom_ui_getPrototypeOf","desc","getOwnPropertyDescriptor","setPrototypeOf","getPrototypeOf","__proto__","ha_config_custom_ui_setPrototypeOf","ha_config_custom_ui_HaConfigCustomUi","self","ReferenceError","Polymer","Element","isWide","String","observer","protoProps","HaConfigCustomUi","customUI","getName","setName","history","back","fire","staticProps","customElements","define","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","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","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","cui_base_element_typeof","cui_base_element_defineProperties","cui_base_element_getPrototypeOf","cui_base_element_setPrototypeOf","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","_this","context","_setKeep","_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","routerOptions","routes","customui","tag","load","Promise","resolve","update","Map","installStatesHook","whenDefined","then","homeAssistant","_updateHass","originalUpdate","entity","newEntity","_themeWaiters","waiter","stateChanged","installPartialCards","_defaultViewFilter","excludes","excludeEntityId","view","viewEntities","entities","groupEntities","grEntityId","grEntity","filter","id","installActionName","elementName","klass","action_name","__data","set","installHaStateLabelBadge","haStateLabelBadge","startInterval","installStateBadge","stateBadge","_updateIconAppearance","originalUpdateIconAppearance","backgroundImage","color","updated","originalUpdated","changedProps","has","_icon","installHaAttributes","haAttributes","computeFiltersArray","extraFilters","split","installHaFormCustomize","haFormCustomize","haFormCustomizeInitDone","_computeSingleAttribute","secondary","config","_initOpenObject","JSON","stringify","getNewAttributesOptions","localAttributes","globalAttributes","existingAttributes","_this2","includes","filterFromAttributes","sort","installClassHooks","classInitDone","init","initDone","runHooks","console","log","CUSTOM_UI_LIST","version","url","localStorage","getItem","setItem","attribute","functionBody","Function","e","SyntaxError","warn","message","cui_base_element","controlElement","extra","computed","extras","isArray","CuiBaseElement","dynamic_element_typeof","dynamic_element_defineProperties","dynamic_element_getPrototypeOf","dynamic_element_setPrototypeOf","dynamic_element_DynamicElement","toUpperCase","DynamicWithExtra","_customElements$get","dynamic_with_extra_getPrototypeOf","dynamic_with_extra_setPrototypeOf","dynamic_with_extra_templateObject","extraObj","_attached","extraObjVisible","dynamic_with_extra_get","_isAttached","attached","extraBadges","extraBadge","unit","blacklist","blacklist_states","RegExp","test","_entityDisplay","haLocalize","pointerEvents","lock","opacity","stopPropagation","_this3","applyThemes","ha_themed_slider_HaThemedSlider","ha_themed_slider_templateObject","min","Number","max","pin","isOn","disableOffWhenMin","notify","disableReportWhenNotChanged","_themedMin","ha_themed_slider_get","ha_themed_slider_getPrototypeOf","HaThemedSlider","_computeAttribute","computeEnabledThemedReportWhenNotChanged","_enabledThemedReportWhenNotChanged","def","themedMin","ev","state_card_with_slider_StateCardWithSlider","state_card_with_slider_templateObject","serviceMin","serviceMax","valueName","setValueName","nameOn","sliderValue","mode","stretchSlider","breakSlider","hideSlider","lineTooLong","minLineBreak","maxLineBreak","showSlider","state_card_with_slider_get","state_card_with_slider_getPrototypeOf","StateCardWithSlider","_onIronResize","_isConnected","_waitForLayout","removeEventListener","_setMode","_frameId","readyToCompute","requestAnimationFrame","prevBreakSlider","prevHideSlider","container","containerWidth","clientWidth","containerHeight","clientHeight","stateHeight","parseInt","param","isNaN","path","_slicedToArray","composedPath","callService","state_card_without_slider_StateCardWithoutSlider","state_card_without_slider_templateObject","SHOW_LAST_CHANGED_BLACKLISTED_CARDS","DOMAIN_TO_SLIDER_SUPPORT","TYPE_TO_CONTROL","toggle","state_card_custom_ui_StateCardCustomUi","state_card_custom_ui_get","state_card_custom_ui_getPrototypeOf","StateCardCustomUi","classList","contains","_container","setProperty","inputChanged","margin","padding","params","text-align","fontSize","modifiedObj","themeTarget","maybeHideEntity","regularMode_","badgeMode","cleanBadgeStyle","customStateCardType","originalStateCardType","services","control","stateCardType","secondaryStateCardType","sliderEligible_","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,OAAAY,UAAAC,eAAApB,KAAAiB,EAAAC,IAGtDzB,EAAA4B,EAAA,GAIA5B,IAAA6B,EAAA,cAAA1B,EAAA2B,EAAA9B,GAAA,aC3De,SAAS+B,EACtBC,EACAC,EACAC,GAEA,IADAC,EACAC,UAAAC,OAAA,YAAAD,UAAA,IAAAA,UAAA,GACKJ,EAAQM,UACXN,EAAQM,YAEV,IAAIC,EAAYN,EAAOO,eACJ,YAAfN,GAA6BA,GAAcD,EAAOA,OAAOC,MAC3DK,EAAYL,GAEd,IAAMO,EAAS3B,OAAO4B,UAAWV,EAAQM,SACzC,GAAkB,YAAdC,EAAyB,CAC3B,IAAII,EAAQV,EA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WACdD,UAAW,mBACXE,OAAQ,OACR3K,WAEFyO,EAAsB,0BACF,YAAXzO,GAAwBxO,KAAKud,gBAAgB/O,EAAQpQ,EAAUqN,IACxEvQ,OAAO4B,OAAO0f,GACZrH,eAAgB,mBAChBwC,IAAKvZ,EAASK,WAAW+e,WAAa,IACtC3F,IAAKzZ,EAASK,WAAWgf,UAAY,IACrC1E,WAAY,kBACZC,WAAY,kBACZC,UAAW,cACXE,OAAQ,GACR3K,WAEFyO,EAAsB,mCACbtB,GAAgBuB,IACzBV,EAAOrH,eAAiBwG,GAAgBuB,GACxCD,EAAsB,6BACb7e,EAASK,WAAWsJ,oBACnB0T,GAAoC9H,SAASuJ,KACvDV,EAAO/Q,aAEc,gBAAnBrN,EAASkJ,QACXkV,EAAOrH,eAAiB,aAEtB/W,EAASK,WAAW+I,kBACtBgV,EAAOrH,eAAiB/W,EAASK,WAAW+I,iBAG9ClJ,EACE0B,MACCsd,GAA0BL,GAA1B,cAAAjc,OAA+Dkc,IAAyBpH,cACzF0G,uCAjOAX,GAoON5W,eAAeC,OAAO,uBAAwB2W,mBGlP9Cxe,OAAOqgB,0BAA4B,SAASC,GAAQ,OAAOA","file":"scripts-es5.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(\n element,\n themes,\n localTheme,\n updateMeta = false\n) {\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 =\n styles[\"--primary-color\"] || meta.getAttribute(\"default-content\");\n meta.setAttribute(\"content\", themeColor);\n }\n}\n","export default function computeDomain(entityId: string): string {\n return entityId.substr(0, entityId.indexOf(\".\"));\n}\n","import { HassEntity } from \"home-assistant-js-websocket\";\nimport computeDomain from \"./compute_domain\";\n\nexport default function computeStateDomain(stateObj: HassEntity) {\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","import { HassEntity } from \"home-assistant-js-websocket\";\n\nexport const supportsFeature = (\n stateObj: HassEntity,\n feature: number\n): boolean => {\n // tslint:disable-next-line:no-bitwise\n return (stateObj.attributes.supported_features! & feature) !== 0;\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/** Panel to show when no panel is picked. */\nexport const DEFAULT_PANEL = \"states\";\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 \"water_heater\",\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 \"water_heater\",\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 = [\"closed\", \"locked\", \"off\"];\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 { HassEntity } from \"home-assistant-js-websocket\";\nimport canToggleState from \"./can_toggle_state\";\nimport computeStateDomain from \"./compute_state_domain\";\nimport { DOMAINS_WITH_CARD } from \"../const\";\nimport { HomeAssistant } from \"../../types\";\n\nexport default function stateCardType(\n hass: HomeAssistant,\n stateObj: HassEntity\n) {\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 }\n if (\n canToggleState(hass, stateObj) &&\n stateObj.attributes.control !== \"hidden\"\n ) {\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='hass: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 '20190324';\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: [\"battery\", \"humidity\", \"illuminance\", \"temperature\", \"pressure\"],\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 = 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: [\n \"switch\",\n \"light\",\n \"cover\",\n \"climate\",\n \"fan\",\n \"group\",\n \"water_heater\",\n ],\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.ts';\nimport getViewEntities from '../../home-assistant-polymer/src/common/entity/get_view_entities.ts';\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 if (haPanelConfig.shadowRoot) {\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 } else if (haPanelConfig.routerOptions && haPanelConfig.routerOptions.routes) {\n if (!haPanelConfig.routerOptions.routes.customui) {\n haPanelConfig.routerOptions.routes.customui = {\n tag: 'ha-config-custom-ui',\n load: () => Promise.resolve(),\n };\n // CustomUI panel is the entrypoint, so we need to reload the page.\n if (window.location.pathname.startsWith('/config/customui')) {\n haPanelConfig.update(new Map([['route', undefined]]));\n }\n }\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) return;\n if (stateBadge.prototype._updateIconAppearance) {\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 } else if (stateBadge.prototype.updated) {\n const originalUpdated = stateBadge.prototype.updated;\n // Use named function to preserve 'this'.\n stateBadge.prototype.updated = function customUpdated(changedProps) {\n if (!changedProps.has('stateObj')) return;\n const { stateObj } = this;\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 originalUpdated.call(this, changedProps);\n }\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 { HassEntities } from \"home-assistant-js-websocket\";\nimport computeDomain from \"./compute_domain\";\nimport getGroupEntities from \"./get_group_entities\";\nimport { GroupEntity } from \"../../types\";\n\n// Return an object containing all entities that the view will show\n// including embedded groups.\nexport default function getViewEntities(\n entities: HassEntities,\n view: GroupEntity\n): HassEntities {\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 as GroupEntity);\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","import { HassEntities } from \"home-assistant-js-websocket\";\nimport { GroupEntity } from \"../../types\";\n\nexport default function getGroupEntities(\n entities: HassEntities,\n group: GroupEntity\n) {\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 result.attributes = Object.assign({}, { friendly_name: '' });\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.ts';\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.ts';\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 { HassEntity } from \"home-assistant-js-websocket\";\nimport canToggleDomain from \"./can_toggle_domain\";\nimport computeStateDomain from \"./compute_state_domain\";\nimport { HomeAssistant } from \"../../types\";\nimport { supportsFeature } from \"./supports-feature\";\n\nexport default function canToggleState(\n hass: HomeAssistant,\n stateObj: HassEntity\n) {\n const domain = computeStateDomain(stateObj);\n if (domain === \"group\") {\n return stateObj.state === \"on\" || stateObj.state === \"off\";\n }\n if (domain === \"climate\") {\n return supportsFeature(stateObj, 4096);\n }\n\n return canToggleDomain(hass, domain);\n}\n","import { HomeAssistant } from \"../../types\";\n\nexport default function canToggleDomain(hass: HomeAssistant, domain: string) {\n const services = hass.services[domain];\n if (!services) {\n return false;\n }\n\n if (domain === \"lock\") {\n return \"lock\" in services;\n }\n 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":""}