[
  {
    "path": ".babelrc",
    "content": "{\n  \"presets\": [\n    [\n      \"@babel/preset-env\",\n      {\n        \"modules\": false,\n        \"targets\": {\n          \"esmodules\": true\n        }\n      }\n    ],\n    [\"minify\"]\n  ],\n  \"comments\": false,\n  \"plugins\": [\n    [\n      \"@babel/plugin-proposal-decorators\",\n      { \"legacy\": true }\n    ],\n    [\n      \"@babel/plugin-proposal-class-properties\",\n      { \"loose\": true }\n    ],\n    [\"@babel/plugin-transform-template-literals\"],\n    [\"iife-wrap\"]\n  ]\n}\n"
  },
  {
    "path": ".eslintrc.yaml",
    "content": "extends: airbnb-base\r\nrules:\r\n  no-else-return: 0\r\n  no-underscore-dangle: 0\r\n  nonblock-statement-body-position: 0\r\n  curly: 0\r\n  no-return-assign: 0\r\n  consistent-return: 0\r\n  no-mixed-operators: 0\r\n  class-methods-use-this: 0\r\n  no-nested-ternary: 0\r\n  camelcase: 0\r\n  no-bitwise: 0\r\n  max-len: 0\r\n  no-useless-constructor: 0\r\n  no-restricted-globals: 0\r\nglobals:\r\n  window: true\r\n  Event: true\r\n  customElements: true"
  },
  {
    "path": ".gitattributes",
    "content": "*.js text eol=lf"
  },
  {
    "path": ".github/workflows/deploy.yaml",
    "content": "name: Build and Release on Tag\n\non:\n  workflow_dispatch:\n  push:\n    tags:\n      - '*'\n\njobs:\n  build-and-release:\n    runs-on: ubuntu-latest\n\n    steps:\n    - name: Checkout Repository\n      uses: actions/checkout@v3\n\n    - name: Set up Node.js\n      uses: actions/setup-node@v3\n      with:\n        node-version: '16'\n\n    - name: Install Dependencies\n      run: npm install\n\n    - name: Run Build\n      run: npm run build\n\n    - name: Commit dist folder\n      run: |\n        git config --local user.email \"action@github.com\"\n        git config --local user.name \"GitHub Action\"\n        git add dist/\n        git commit -m \"Add dist folder\"\n    \n    - name: Push changes\n      uses: ad-m/github-push-action@master\n      with:\n        github_token: ${{ secrets.GITHUB_TOKEN }}\n        force: true\n        directory: dist\n\n    - name: Get current and previous tags\n      id: tags\n      run: |\n        current_tag=$(git describe --tags --abbrev=0)\n        previous_tag=$(git describe --tags --abbrev=0 $(git rev-list --tags --skip=1 --max-count=1))\n        echo ::set-output name=current_tag::${current_tag}\n        echo ::set-output name=previous_tag::${previous_tag}\n\n    - name: Generate release notes\n      id: releasenotes\n      run: |\n        echo \"Release Notes:\" > release_notes.md\n        git log ${previous_tag}..${current_tag} --pretty=format:\"%h - %s\" >> release_notes.md\n        echo ::set-output name=notes::$(cat release_notes.md)\n\n    - name: Create Release\n      uses: actions/create-release@v1\n      env:\n        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n      with:\n        tag_name: ${{ steps.tags.outputs.current_tag }}\n        release_name: Release ${{ steps.tags.outputs.current_tag }}\n        body: ${{ steps.releasenotes.outputs.notes }}\n        draft: false\n        prerelease: false\n\n    - name: Upload light-entity-card.js to Release\n      uses: actions/upload-release-asset@v1\n      env:\n        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n      with:\n        upload_url: ${{ steps.create_release.outputs.upload_url }}\n        asset_path: ./dist/light-entity-card.js\n        asset_name: light-entity-card.js\n        asset_content_type: application/javascript\n"
  },
  {
    "path": ".github/workflows/validate.yaml",
    "content": "name: Validate\n\non:\n  push:\n  pull_request:\n  schedule:\n    - cron: \"0 0 * * *\"\n\njobs:\n  validate:\n    runs-on: \"ubuntu-latest\"\n    steps:\n      - uses: \"actions/checkout@v2\"\n      - name: HACS validation\n        uses: \"hacs/action@main\"\n        with:\n          category: \"plugin\"\n"
  },
  {
    "path": ".gitignore",
    "content": "/node_modules/\r\n"
  },
  {
    "path": ".prettierrc.json",
    "content": "{\n  \"trailingComma\": \"es5\",\n  \"singleQuote\": true,\n  \"printWidth\": 120,\n  \"arrowParens\": \"avoid\"\n}\n"
  },
  {
    "path": "LICENSE",
    "content": "MIT License\n\nCopyright (c) 2019 Leonardo Merza\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "# Light Entity Card\r\n\r\nControl any light/switch entity through lovelace\r\n\r\n## Support\r\n\r\nFor help, visit the light entity support thread [here](https://community.home-assistant.io/t/light-entity-card/96146)\r\n\r\n<img src='https://raw.githubusercontent.com/ljmerza/light-entity-card/master/card.png' />\r\n\r\n[![GitHub Release][releases-shield]][releases]\r\n[![License][license-shield]](LICENSE.md)\r\n![Project Maintenance][maintenance-shield]\r\n[![hacs_badge](https://img.shields.io/badge/HACS-Default-orange.svg?style=for-the-badge)](https://github.com/hacs/integration)\r\n\r\n## Features\r\n\r\n* Works on any light and switch based entity\r\n* Toggle on/off\r\n* HS Color wheel\r\n* Color temperature and white value support\r\n* Support for configured language\r\n* Compact card support for grouped entities\r\n* use `persist_features: true` to always show entity features\r\n* use `effects_list` to add custom effects list or use `input_select` entity\r\n* always show or hide header and each input \r\n\r\n## Installation\r\n\r\nAdd through  [HACS](https://github.com/custom-components/hacs)\r\n\r\nIssues with the installation should be asked in the [Home Assistant forums](https://community.home-assistant.io/t/light-entity-card/96146)\r\n\r\n## Configurations\r\n\r\n```yaml\r\ntype: custom:light-entity-card\r\nentity: light.downstairs\r\n```\r\n\r\n```yaml\r\ntype: custom:light-entity-card\r\nentity: light.downstairs\r\neffects_list:\r\n  - effect1\r\n  - effect2\r\n```\r\n\r\n```yaml\r\ntype: custom:light-entity-card\r\nentity: light.downstairs\r\neffects_list: input_select.custom_effect_list\r\n```\r\n\r\n```yaml\r\ntype: custom:light-entity-card\r\nentity: light.downstairs\r\ngroup: true\r\n```\r\n\r\n## Options\r\n\r\n| Name                 | Type                | Requirement  | `Default value` Description                                                 |\r\n| -------------------- | ------------------- | ------------ | --------------------------------------------------------------------------- |\r\n| type                 | string              | **Required** | `custom:light-entity-card`                                                  |\r\n| entity               | string              | **Required** | The entity name of the light entity to control                              |\r\n| shorten_cards        | boolean             | **Optional** | `false` show a compact version of the card                                  |\r\n| consolidate_entities | boolean             | **Optional** | `false` if entity is a group you can consolidate all entities into one      |\r\n| persist_features     | boolean             | **Optional** | `false` always show entity features                                         |\r\n| effects_list         | list/string/boolean | **Optional** | custom list of effects, an input_select entity, or set false to always hide |\r\n| header               | string              | **Optional** | custom header name                                                          |\r\n| hide_header          | boolean             | **Optional** | `false` hides the entity header of the card including toggle                |\r\n| show_header_icon     | boolean             | **Optional** | `false` shows the entity icon of the card including toggle                  |\r\n| brightness           | boolean             | **Optional** | `true` show brightness slider if available                                  |\r\n| color_temp           | boolean             | **Optional** | `true` show color temp slider if available                                  |\r\n| white_value          | boolean             | **Optional** | `true` show white value slider if available                                 |\r\n| color_picker         | boolean             | **Optional** | `true` show color picker wheel if available                                 |\r\n| speed                | boolean             | **Optional** | `false` show speed slider if available                                      |\r\n| intensity            | boolean             | **Optional** | `false` show intensity slider if available                                  |\r\n| force_features       | boolean             | **Optional** | `false` force showing all features in card                                  |\r\n| full_width_sliders   | boolean             | **Optional** | `false` makes slider the full width of card                                 |\r\n| brightness_icon      | string              | **Optional** | `weather-sunny` change the brightness slider icon                           |\r\n| white_icon           | string              | **Optional** | `file-word-box` change the white slider icon                                |\r\n| temperature_icon     | string              | **Optional** | `thermometer` change the temperature slider icon                            |\r\n| speed_icon           | string              | **Optional** | `speedometer` change the speed slider icon                                  |\r\n| intensity_icon       | string              | **Optional** | `transit-connection-horizontal` change the intensity slider icon            |\r\n| show_slider_percent  | boolean             | **Optional** | `false` show percent next to sliders                                        |\r\n| child_card           | boolean             | **Optional** | `false` remove padding/margin to make this card within another card         |\r\n\r\n---\r\n\r\nEnjoy my card? Help me out for a couple of :beers: or a :coffee:!\r\n\r\n[![coffee](https://www.buymeacoffee.com/assets/img/custom_images/black_img.png)](https://www.buymeacoffee.com/JMISm06AD)\r\n\r\n[commits-shield]: https://img.shields.io/github/commit-activity/y/ljmerza/light-entity-card.svg?style=for-the-badge\r\n[commits]: https://github.com/ljmerza/light-entity-card/commits/master\r\n[license-shield]: https://img.shields.io/github/license/ljmerza/light-entity-card.svg?style=for-the-badge\r\n[maintenance-shield]: https://img.shields.io/badge/maintainer-Leonardo%20Merza%20%40ljmerza-blue.svg?style=for-the-badge\r\n[releases-shield]: https://img.shields.io/github/release/ljmerza/light-entity-card.svg?style=for-the-badge\r\n[releases]: https://github.com/ljmerza/light-entity-card/releases\r\n"
  },
  {
    "path": "babel.config.js",
    "content": "module.exports = {\n    \"presets\": [\n        [\n            \"@babel/preset-env\",\n            {\n                \"useBuiltIns\": \"usage\",\n                \"debug\": true,\n                \"targets\": \"> 0.25%, not dead\",\n                \"shippedProposals\": true\n            }\n        ]\n    ]\n}"
  },
  {
    "path": "dist/light-entity-card.js",
    "content": "/*! For license information please see light-entity-card.js.LICENSE.txt */\n(()=>{\"use strict\";const t=window,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&\"adoptedStyleSheets\"in Document.prototype&&\"replace\"in CSSStyleSheet.prototype,i=Symbol(),n=new WeakMap;class r{constructor(t,e,n){if(this._$cssResult$=!0,n!==i)throw Error(\"CSSResult is not constructable. Use `unsafeCSS` or `css` instead.\");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const i=this.t;if(e&&void 0===t){const e=void 0!==i&&1===i.length;e&&(t=n.get(i)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&n.set(i,t))}return t}toString(){return this.cssText}}const o=(t,...e)=>{const n=1===t.length?t[0]:e.reduce((e,i,n)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if(\"number\"==typeof t)return t;throw Error(\"Value passed to 'css' function must be a 'css' function result: \"+t+\". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.\")})(i)+t[n+1],t[0]);return new r(n,t,i)},s=(i,n)=>{e?i.adoptedStyleSheets=n.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet):n.forEach(e=>{const n=document.createElement(\"style\"),r=t.litNonce;void 0!==r&&n.setAttribute(\"nonce\",r),n.textContent=e.cssText,i.appendChild(n)})},a=e?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e=\"\";for(const i of t.cssRules)e+=i.cssText;return(t=>new r(\"string\"==typeof t?t:t+\"\",void 0,i))(e)})(t):t;var c;const h=window,l=h.trustedTypes,d=l?l.emptyScript:\"\",u=h.reactiveElementPolyfillSupport,f={toAttribute(t,e){switch(e){case Boolean:t=t?d:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},p=(t,e)=>e!==t&&(e==e||t==t),g={attribute:!0,type:String,converter:f,reflect:!1,hasChanged:p},_=\"finalized\";class v extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(t){var e;this.finalize(),(null!==(e=this.h)&&void 0!==e?e:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach((e,i)=>{const n=this._$Ep(i,e);void 0!==n&&(this._$Ev.set(n,i),t.push(n))}),t}static createProperty(t,e=g){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i=\"symbol\"==typeof t?Symbol():\"__\"+t,n=this.getPropertyDescriptor(t,i,e);void 0!==n&&Object.defineProperty(this.prototype,t,n)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(n){const r=this[t];this[e]=n,this.requestUpdate(t,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||g}static finalize(){if(this.hasOwnProperty(_))return!1;this[_]=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),void 0!==t.h&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty(\"properties\")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const i of e)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(a(t))}else void 0!==t&&e.push(a(t));return e}static _$Ep(t,e){const i=e.attribute;return!1===i?void 0:\"string\"==typeof i?i:\"string\"==typeof t?t.toLowerCase():void 0}_$Eu(){var t;this._$E_=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach(t=>t(this))}addController(t){var e,i;(null!==(e=this._$ES)&&void 0!==e?e:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(i=t.hostConnected)||void 0===i||i.call(t))}removeController(t){var e;null===(e=this._$ES)||void 0===e||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])})}createRenderRoot(){var t;const e=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return s(e,this.constructor.elementStyles),e}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$ES)||void 0===t||t.forEach(t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)})}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach(t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)})}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EO(t,e,i=g){var n;const r=this.constructor._$Ep(t,i);if(void 0!==r&&!0===i.reflect){const o=(void 0!==(null===(n=i.converter)||void 0===n?void 0:n.toAttribute)?i.converter:f).toAttribute(e,i.type);this._$El=t,null==o?this.removeAttribute(r):this.setAttribute(r,o),this._$El=null}}_$AK(t,e){var i;const n=this.constructor,r=n._$Ev.get(t);if(void 0!==r&&this._$El!==r){const t=n.getPropertyOptions(r),o=\"function\"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(i=t.converter)||void 0===i?void 0:i.fromAttribute)?t.converter:f;this._$El=r,this[r]=o.fromAttribute(e,t.type),this._$El=null}}requestUpdate(t,e,i){let n=!0;void 0!==t&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||p)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===i.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,i))):n=!1),!this.isUpdatePending&&n&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((t,e)=>this[e]=t),this._$Ei=void 0);let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),null===(t=this._$ES)||void 0===t||t.forEach(t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)}),this.update(i)):this._$Ek()}catch(t){throw e=!1,this._$Ek(),t}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;null===(e=this._$ES)||void 0===e||e.forEach(t=>{var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach((t,e)=>this._$EO(e,this[e],t)),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}}function y(t,e,i){return e=b(e),function(t,e){if(e&&(\"object\"==O(e)||\"function\"==typeof e))return e;if(void 0!==e)throw new TypeError(\"Derived constructors may only return object or undefined\");return function(t){if(void 0===t)throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");return t}(t)}(t,m()?Reflect.construct(e,i||[],b(t).constructor):e.apply(t,i))}function m(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(m=function(){return!!t})()}function b(t){return b=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},b(t)}function $(t,e){if(\"function\"!=typeof e&&null!==e)throw new TypeError(\"Super expression must either be null or a function\");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,\"prototype\",{writable:!1}),e&&w(t,e)}function w(t,e){return w=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},w(t,e)}function k(t,e){var i=\"undefined\"!=typeof Symbol&&t[Symbol.iterator]||t[\"@@iterator\"];if(!i){if(Array.isArray(t)||(i=S(t))||e&&t&&\"number\"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\")}var o,s=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==i.return||i.return()}finally{if(a)throw o}}}}function S(t,e){if(t){if(\"string\"==typeof t)return x(t,e);var i={}.toString.call(t).slice(8,-1);return\"Object\"===i&&t.constructor&&(i=t.constructor.name),\"Map\"===i||\"Set\"===i?Array.from(t):\"Arguments\"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?x(t,e):void 0}}function x(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function C(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}function A(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,\"value\"in n&&(n.writable=!0),Object.defineProperty(t,P(n.key),n)}}function E(t,e,i){return e&&A(t.prototype,e),i&&A(t,i),Object.defineProperty(t,\"prototype\",{writable:!1}),t}function P(t){var e=function(t){if(\"object\"!=O(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,\"string\");if(\"object\"!=O(i))return i;throw new TypeError(\"@@toPrimitive must return a primitive value.\")}return String(t)}(t);return\"symbol\"==O(e)?e:e+\"\"}function O(t){return O=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&\"function\"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?\"symbol\":typeof t},O(t)}var T;v[_]=!0,v.elementProperties=new Map,v.elementStyles=[],v.shadowRootOptions={mode:\"open\"},null==u||u({ReactiveElement:v}),(null!==(c=h.reactiveElementVersions)&&void 0!==c?c:h.reactiveElementVersions=[]).push(\"1.6.3\");var j=window,U=j.trustedTypes,I=U?U.createPolicy(\"lit-html\",{createHTML:function(t){return t}}):void 0,N=\"$lit$\",R=\"lit$\".concat((Math.random()+\"\").slice(9),\"$\"),H=\"?\"+R,V=\"<\".concat(H,\">\"),M=document,W=function(){return M.createComment(\"\")},L=function(t){return null===t||\"object\"!=O(t)&&\"function\"!=typeof t},B=Array.isArray,D=\"[ \\t\\n\\f\\r]\",F=/<(?:(!--|\\/[^a-zA-Z])|(\\/?[a-zA-Z][^>\\s]*)|(\\/?$))/g,z=/-->/g,q=/>/g,K=RegExp(\">|\".concat(D,\"(?:([^\\\\s\\\"'>=/]+)(\").concat(D,\"*=\").concat(D,\"*(?:[^ \\t\\n\\f\\r\\\"'`<>=]|(\\\"|')|))|$)\"),\"g\"),J=/'/g,Z=/\"/g,G=/^(?:script|style|textarea|title)$/i,Q=function(t){return function(e){for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];return{_$litType$:t,strings:e,values:n}}},X=Q(1),Y=(Q(2),Symbol.for(\"lit-noChange\")),tt=Symbol.for(\"lit-nothing\"),et=new WeakMap,it=M.createTreeWalker(M,129,null,!1);function nt(t,e){if(!Array.isArray(t)||!t.hasOwnProperty(\"raw\"))throw Error(\"invalid template strings array\");return void 0!==I?I.createHTML(e):e}var rt=function(t,e){for(var i,n=t.length-1,r=[],o=2===e?\"<svg>\":\"\",s=F,a=0;a<n;a++){for(var c=t[a],h=void 0,l=void 0,d=-1,u=0;u<c.length&&(s.lastIndex=u,null!==(l=s.exec(c)));)u=s.lastIndex,s===F?\"!--\"===l[1]?s=z:void 0!==l[1]?s=q:void 0!==l[2]?(G.test(l[2])&&(i=RegExp(\"</\"+l[2],\"g\")),s=K):void 0!==l[3]&&(s=K):s===K?\">\"===l[0]?(s=null!=i?i:F,d=-1):void 0===l[1]?d=-2:(d=s.lastIndex-l[2].length,h=l[1],s=void 0===l[3]?K:'\"'===l[3]?Z:J):s===Z||s===J?s=K:s===z||s===q?s=F:(s=K,i=void 0);var f=s===K&&t[a+1].startsWith(\"/>\")?\" \":\"\";o+=s===F?c+V:d>=0?(r.push(h),c.slice(0,d)+N+c.slice(d)+R+f):c+R+(-2===d?(r.push(void 0),a):f)}return[nt(t,o+(t[n]||\"<?>\")+(2===e?\"</svg>\":\"\")),r]},ot=function(){return E(function t(e,i){var n,r=e.strings,o=e._$litType$;C(this,t),this.parts=[];var s=0,a=0,c=r.length-1,h=this.parts,l=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:\"undefined\"!=typeof Symbol&&t[Symbol.iterator]||t[\"@@iterator\"];if(null!=i){var n,r,o,s,a=[],c=!0,h=!1;try{if(o=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;c=!1}else for(;!(c=(n=o.call(i)).done)&&(a.push(n.value),a.length!==e);c=!0);}catch(t){h=!0,r=t}finally{try{if(!c&&null!=i.return&&(s=i.return(),Object(s)!==s))return}finally{if(h)throw r}}return a}}(t,e)||S(t,e)||function(){throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\")}()}(rt(r,o),2),d=l[0],u=l[1];if(this.el=t.createElement(d,i),it.currentNode=this.el.content,2===o){var f=this.el.content,p=f.firstChild;p.remove(),f.append.apply(f,function(t){return function(t){if(Array.isArray(t))return x(t)}(t)||function(t){if(\"undefined\"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t[\"@@iterator\"])return Array.from(t)}(t)||S(t)||function(){throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\")}()}(p.childNodes))}for(;null!==(n=it.nextNode())&&h.length<c;){if(1===n.nodeType){if(n.hasAttributes()){var g,_=[],v=k(n.getAttributeNames());try{for(v.s();!(g=v.n()).done;){var y=g.value;if(y.endsWith(N)||y.startsWith(R)){var m=u[a++];if(_.push(y),void 0!==m){var b=n.getAttribute(m.toLowerCase()+N).split(R),$=/([.?@])?(.*)/.exec(m);h.push({type:1,index:s,name:$[2],strings:b,ctor:\".\"===$[1]?ut:\"?\"===$[1]?pt:\"@\"===$[1]?gt:dt})}else h.push({type:6,index:s})}}}catch(t){v.e(t)}finally{v.f()}for(var w=0,A=_;w<A.length;w++){var E=A[w];n.removeAttribute(E)}}if(G.test(n.tagName)){var P=n.textContent.split(R),O=P.length-1;if(O>0){n.textContent=U?U.emptyScript:\"\";for(var T=0;T<O;T++)n.append(P[T],W()),it.nextNode(),h.push({type:2,index:++s});n.append(P[O],W())}}}else if(8===n.nodeType)if(n.data===H)h.push({type:2,index:s});else for(var j=-1;-1!==(j=n.data.indexOf(R,j+1));)h.push({type:7,index:s}),j+=R.length-1;s++}},null,[{key:\"createElement\",value:function(t,e){var i=M.createElement(\"template\");return i.innerHTML=t,i}}])}();function st(t,e){var i,n,r,o,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,a=arguments.length>3?arguments[3]:void 0;if(e===Y)return e;var c=void 0!==a?null===(i=s._$Co)||void 0===i?void 0:i[a]:s._$Cl,h=L(e)?void 0:e._$litDirective$;return(null==c?void 0:c.constructor)!==h&&(null===(n=null==c?void 0:c._$AO)||void 0===n||n.call(c,!1),void 0===h?c=void 0:(c=new h(t))._$AT(t,s,a),void 0!==a?(null!==(r=(o=s)._$Co)&&void 0!==r?r:o._$Co=[])[a]=c:s._$Cl=c),void 0!==c&&(e=st(t,c._$AS(t,e.values),c,a)),e}var at,ct,ht=function(){return E(function t(e,i){C(this,t),this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=i},[{key:\"parentNode\",get:function(){return this._$AM.parentNode}},{key:\"_$AU\",get:function(){return this._$AM._$AU}},{key:\"u\",value:function(t){var e,i=this._$AD,n=i.el.content,r=i.parts,o=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:M).importNode(n,!0);it.currentNode=o;for(var s=it.nextNode(),a=0,c=0,h=r[0];void 0!==h;){if(a===h.index){var l=void 0;2===h.type?l=new lt(s,s.nextSibling,this,t):1===h.type?l=new h.ctor(s,h.name,h.strings,this,t):6===h.type&&(l=new _t(s,this,t)),this._$AV.push(l),h=r[++c]}a!==(null==h?void 0:h.index)&&(s=it.nextNode(),a++)}return it.currentNode=M,o}},{key:\"v\",value:function(t){var e,i=0,n=k(this._$AV);try{for(n.s();!(e=n.n()).done;){var r=e.value;void 0!==r&&(void 0!==r.strings?(r._$AI(t,r,i),i+=r.strings.length-2):r._$AI(t[i])),i++}}catch(t){n.e(t)}finally{n.f()}}}])}(),lt=function(){function t(e,i,n,r){var o;C(this,t),this.type=2,this._$AH=tt,this._$AN=void 0,this._$AA=e,this._$AB=i,this._$AM=n,this.options=r,this._$Cp=null===(o=null==r?void 0:r.isConnected)||void 0===o||o}return E(t,[{key:\"_$AU\",get:function(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$Cp}},{key:\"parentNode\",get:function(){var t=this._$AA.parentNode,e=this._$AM;return void 0!==e&&11===(null==t?void 0:t.nodeType)&&(t=e.parentNode),t}},{key:\"startNode\",get:function(){return this._$AA}},{key:\"endNode\",get:function(){return this._$AB}},{key:\"_$AI\",value:function(t){t=st(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:this),L(t)?t===tt||null==t||\"\"===t?(this._$AH!==tt&&this._$AR(),this._$AH=tt):t!==this._$AH&&t!==Y&&this._(t):void 0!==t._$litType$?this.g(t):void 0!==t.nodeType?this.$(t):function(t){return B(t)||\"function\"==typeof(null==t?void 0:t[Symbol.iterator])}(t)?this.T(t):this._(t)}},{key:\"k\",value:function(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}},{key:\"$\",value:function(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}},{key:\"_\",value:function(t){this._$AH!==tt&&L(this._$AH)?this._$AA.nextSibling.data=t:this.$(M.createTextNode(t)),this._$AH=t}},{key:\"g\",value:function(t){var e,i=t.values,n=t._$litType$,r=\"number\"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=ot.createElement(nt(n.h,n.h[0]),this.options)),n);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===r)this._$AH.v(i);else{var o=new ht(r,this),s=o.u(this.options);o.v(i),this.$(s),this._$AH=o}}},{key:\"_$AC\",value:function(t){var e=et.get(t.strings);return void 0===e&&et.set(t.strings,e=new ot(t)),e}},{key:\"T\",value:function(e){B(this._$AH)||(this._$AH=[],this._$AR());var i,n,r=this._$AH,o=0,s=k(e);try{for(s.s();!(n=s.n()).done;){var a=n.value;o===r.length?r.push(i=new t(this.k(W()),this.k(W()),this,this.options)):i=r[o],i._$AI(a),o++}}catch(t){s.e(t)}finally{s.f()}o<r.length&&(this._$AR(i&&i._$AB.nextSibling,o),r.length=o)}},{key:\"_$AR\",value:function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._$AA.nextSibling,i=arguments.length>1?arguments[1]:void 0;for(null===(t=this._$AP)||void 0===t||t.call(this,!1,!0,i);e&&e!==this._$AB;){var n=e.nextSibling;e.remove(),e=n}}},{key:\"setConnected\",value:function(t){var e;void 0===this._$AM&&(this._$Cp=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}])}(),dt=function(){return E(function t(e,i,n,r,o){C(this,t),this.type=1,this._$AH=tt,this._$AN=void 0,this.element=e,this.name=i,this._$AM=r,this.options=o,n.length>2||\"\"!==n[0]||\"\"!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=tt},[{key:\"tagName\",get:function(){return this.element.tagName}},{key:\"_$AU\",get:function(){return this._$AM._$AU}},{key:\"_$AI\",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this,i=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,r=this.strings,o=!1;if(void 0===r)t=st(this,t,e,0),(o=!L(t)||t!==this._$AH&&t!==Y)&&(this._$AH=t);else{var s,a,c=t;for(t=r[0],s=0;s<r.length-1;s++)(a=st(this,c[i+s],e,s))===Y&&(a=this._$AH[s]),o||(o=!L(a)||a!==this._$AH[s]),a===tt?t=tt:t!==tt&&(t+=(null!=a?a:\"\")+r[s+1]),this._$AH[s]=a}o&&!n&&this.j(t)}},{key:\"j\",value:function(t){t===tt?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:\"\")}}])}(),ut=function(t){function e(){var t;return C(this,e),(t=y(this,e,arguments)).type=3,t}return $(e,t),E(e,[{key:\"j\",value:function(t){this.element[this.name]=t===tt?void 0:t}}])}(dt),ft=U?U.emptyScript:\"\",pt=function(t){function e(){var t;return C(this,e),(t=y(this,e,arguments)).type=4,t}return $(e,t),E(e,[{key:\"j\",value:function(t){t&&t!==tt?this.element.setAttribute(this.name,ft):this.element.removeAttribute(this.name)}}])}(dt),gt=function(t){function e(t,i,n,r,o){var s;return C(this,e),(s=y(this,e,[t,i,n,r,o])).type=5,s}return $(e,t),E(e,[{key:\"_$AI\",value:function(t){var e;if((t=null!==(e=st(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:this,0))&&void 0!==e?e:tt)!==Y){var i=this._$AH,n=t===tt&&i!==tt||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,r=t!==tt&&(i===tt||n);n&&this.element.removeEventListener(this.name,this,i),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}}},{key:\"handleEvent\",value:function(t){var e,i;\"function\"==typeof this._$AH?this._$AH.call(null!==(i=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==i?i:this.element,t):this._$AH.handleEvent(t)}}])}(dt),_t=function(){return E(function t(e,i,n){C(this,t),this.element=e,this.type=6,this._$AN=void 0,this._$AM=i,this.options=n},[{key:\"_$AU\",get:function(){return this._$AM._$AU}},{key:\"_$AI\",value:function(t){st(this,t)}}])}(),vt=j.litHtmlPolyfillSupport;function yt(t){return yt=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&\"function\"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?\"symbol\":typeof t},yt(t)}function mt(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,\"value\"in n&&(n.writable=!0),Object.defineProperty(t,bt(n.key),n)}}function bt(t){var e=function(t){if(\"object\"!=yt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,\"string\");if(\"object\"!=yt(i))return i;throw new TypeError(\"@@toPrimitive must return a primitive value.\")}return String(t)}(t);return\"symbol\"==yt(e)?e:e+\"\"}function $t(t){if(void 0===t)throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");return t}function wt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(wt=function(){return!!t})()}function kt(t,e,i,n){var r=St(xt(1&n?t.prototype:t),e,i);return 2&n&&\"function\"==typeof r?function(t){return r.apply(i,t)}:r}function St(){return St=\"undefined\"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,i){var n=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=xt(t)););return t}(t,e);if(n){var r=Object.getOwnPropertyDescriptor(n,e);return r.get?r.get.call(arguments.length<3?t:i):r.value}},St.apply(null,arguments)}function xt(t){return xt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},xt(t)}function Ct(t,e){return Ct=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ct(t,e)}null==vt||vt(ot,lt),(null!==(T=j.litHtmlVersions)&&void 0!==T?T:j.litHtmlVersions=[]).push(\"2.8.0\");var At=function(t){function e(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}(this,e),(t=function(t,e,i){return e=xt(e),function(t,e){if(e&&(\"object\"==yt(e)||\"function\"==typeof e))return e;if(void 0!==e)throw new TypeError(\"Derived constructors may only return object or undefined\");return $t(t)}(t,wt()?Reflect.construct(e,i||[],xt(t).constructor):e.apply(t,i))}(this,e,arguments)).renderOptions={host:$t(t)},t._$Do=void 0,t}return function(t,e){if(\"function\"!=typeof e&&null!==e)throw new TypeError(\"Super expression must either be null or a function\");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,\"prototype\",{writable:!1}),e&&Ct(t,e)}(e,t),function(t,e){return e&&mt(t.prototype,e),Object.defineProperty(t,\"prototype\",{writable:!1}),t}(e,[{key:\"createRenderRoot\",value:function(){var t,i,n=kt(e,\"createRenderRoot\",this,3)([]);return null!==(t=(i=this.renderOptions).renderBefore)&&void 0!==t||(i.renderBefore=n.firstChild),n}},{key:\"update\",value:function(t){var i=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),kt(e,\"update\",this,3)([t]),this._$Do=function(t,e,i){var n,r,o=null!==(n=null==i?void 0:i.renderBefore)&&void 0!==n?n:e,s=o._$litPart$;if(void 0===s){var a=null!==(r=null==i?void 0:i.renderBefore)&&void 0!==r?r:null;o._$litPart$=s=new lt(e.insertBefore(W(),a),a,void 0,null!=i?i:{})}return s._$AI(t),s}(i,this.renderRoot,this.renderOptions)}},{key:\"connectedCallback\",value:function(){var t;kt(e,\"connectedCallback\",this,3)([]),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}},{key:\"disconnectedCallback\",value:function(){var t;kt(e,\"disconnectedCallback\",this,3)([]),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}},{key:\"render\",value:function(){return Y}}])}(v);At.finalized=!0,At._$litElement$=!0,null===(at=globalThis.litElementHydrateSupport)||void 0===at||at.call(globalThis,{LitElement:At});var Et=globalThis.litElementPolyfillSupport;null==Et||Et({LitElement:At}),(null!==(ct=globalThis.litElementVersions)&&void 0!==ct?ct:globalThis.litElementVersions=[]).push(\"3.3.3\");const Pt=globalThis,Ot=Pt.ShadowRoot&&(void 0===Pt.ShadyCSS||Pt.ShadyCSS.nativeShadow)&&\"adoptedStyleSheets\"in Document.prototype&&\"replace\"in CSSStyleSheet.prototype;function Tt(t){return class extends t{createRenderRoot(){const t=this.constructor,{registry:e,elementDefinitions:i,shadowRootOptions:n}=t;i&&!e&&(t.registry=new CustomElementRegistry,Object.entries(i).forEach(([e,i])=>t.registry.define(e,i)));const r=this.renderOptions.creationScope=this.attachShadow({...n,customElements:t.registry});return((t,e)=>{if(Ot)t.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const i of e){const e=document.createElement(\"style\"),n=Pt.litNonce;void 0!==n&&e.setAttribute(\"nonce\",n),e.textContent=i.cssText,t.appendChild(e)}})(r,this.constructor.elementStyles),r}}}Symbol(),new WeakMap;const jt=o`\n  .light-entity-card {\n    padding: 16px;\n  }\n\n  .light-entity-child-card {\n    box-shadow: none !important;\n    padding: 0 !important;\n  }\n\n  .light-entity-card.group {\n    padding-bottom: 5;\n    padding-top: 0;\n  }\n\n  .ha-slider-full-width ha-slider {\n    width: 100%;\n  }\n\n  .percent-slider {\n    color: var(--primary-text-color);\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    margin-left: 8px;\n    min-width: 40px;\n    text-align: right;\n  }\n\n  .light-entity-card__header {\n    display: flex;\n    justify-content: space-between;\n    @apply --paper-font-headline;\n    line-height: 40px;\n    color: var(--primary-text-color);\n  }\n\n  .group .light-entity-card__header {\n  }\n\n  .light-entity-card-sliders > div {\n    margin-top: 10px;\n  }\n\n  .group .light-entity-card-sliders > div {\n    margin-top: 0px;\n  }\n\n  .light-entity-card__toggle {\n    display: flex;\n    cursor: pointer;\n  }\n\n  .light-entity-card__color-picker {\n    display: flex;\n    justify-content: center;\n    margin-top: 10px;\n  }\n\n  .light-entity-card__color-picker ha-hs-color-picker {\n    max-width: 300px;\n    width: 100%;\n  }\n  \n  .light-entity-card-color_temp {\n    background-image: var(--ha-slider-background, linear-gradient(to right, #a6d1ff, #ffb74d));\n    border-radius: 4px;\n  }\n\n  .light-entity-card-color_temp--kelvin {\n    background-image: var(--ha-slider-background, linear-gradient(to right, #ffb74d, #a6d1ff));\n  }\n\n  .light-entity-card-effectlist {\n    padding-top: 10px;\n    padding-bottom: 10px;\n  }\n\n  .group .light-entity-card-effectlist {\n    padding-bottom: 20px;\n  }\n\n  .light-entity-card-center {\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    cursor: pointer;\n  }\n\n  .hidden {\n    display: none;\n  }\n\n  .icon-container {\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    margin-right: 8px;\n  }\n\n`,Ut={shorten_cards:!1,consolidate_entities:!1,child_card:!1,hide_header:!1,show_header_icon:!1,header:\"\",persist_features:!1,brightness:!0,color_temp:!0,white_value:!0,warm_white_value:!0,color_picker:!0,effects_list:!0,speed:!0,intensity:!0,force_features:!1,show_slider_percent:!1,full_width_sliders:!1,color_temp_in_kelvin:!1,transition:0,brightness_icon:\"weather-sunny\",white_icon:\"file-word-box\",warm_white_icon:\"weather-sunset\",temperature_icon:\"thermometer\",speed_icon:\"speedometer\",intensity_icon:\"transit-connection-horizontal\"},It=o`\n  .entities {\n    padding-top: 10px;\n    padding-bottom: 10px;\n    display: flex;\n  }\n\n  .entities ha-formfield {\n    display: block;\n    margin-bottom: 10px;\n    margin-left: 10px;\n  }\n\n  .checkbox-options {\n    display: flex;\n  }\n  \n  ha-entity-picker {\n    width: 100%;\n  }\n\n  .checkbox-options ha-formfield,\n  .entities mwc-switch,\n  .entities ha-form-string {\n    padding-right: 2%;\n    width: 48%;\n  }\n\n  .checkbox-options ha-formfield {\n    margin-top: 10px;\n  }\n\n  .overall-config {\n    margin-bottom: 20px;\n  }\n`,Nt=(t,e)=>t.reduce((t,i)=>(i.defineId?t[i.defineId]=i:i.promise.then(t=>{void 0===e.registry.get(i.name)&&e.registry.define(i.name,t)}),t),{}),Rt=t=>({name:t,promise:customElements.whenDefined(t).then(()=>customElements.get(t))}),Ht=(t,e,i={},n={})=>{const r=new Event(e,{bubbles:void 0===n.bubbles||n.bubbles,cancelable:Boolean(n.cancelable),composed:void 0===n.composed||n.composed});return r.detail=i,t.dispatchEvent(r),r};class Vt extends(Tt(At)){static get elementDefinitions(){return Nt([Rt(\"ha-checkbox\"),Rt(\"ha-formfield\"),Rt(\"ha-form-string\"),Rt(\"ha-entity-picker\")],Vt)}static get styles(){return It}static get properties(){return{hass:{},_config:{}}}setConfig(t){this._config={...Ut,...t}}get entityDomains(){return[\"switch\",\"light\",\"group\"]}firstUpdated(){this._firstRendered=!0}render(){if(!this.hass||!this._config)return X``;let{header:t}=this._config;if(!t&&this._config.entity){let e=this._config.entity.split(\".\")[1]||\"\";e&&(e=e.charAt(0).toUpperCase()+e.slice(1),t=e)}return X`\n      <div class=\"card-config\">\n\n        <div class=overall-config'>\n          <ha-form-string\n            .schema=${{name:\"header\",type:\"string\"}}\n            label=\"Header\"\n            .data=\"${t}\"\n            .configValue=\"${\"header\"}\"\n            @changed=\"${this.configChanged}\"\n          ></ha-form-string>\n        </div>\n\n        <div class='entities'>\n          <ha-entity-picker\n            .hass=${this.hass}\n            .value=${this._config.entity}\n            .includeDomains=${this.entityDomains}\n            label=\"Entity\"\n            @value-changed=${this.entityChanged}\n            allow-custom-entity\n          ></ha-entity-picker>\n          <ha-form-string\n            .schema=${{name:\"brightness_icon\",type:\"string\"}}\n            label=\"Brightness Icon\"\n            .data=\"${this._config.brightness_icon}\"\n            .configValue=\"${\"brightness_icon\"}\"\n            @changed=\"${this.configChanged}\"\n          ></ha-form-string>\n        </div>\n\n        <div class='entities'>\n         <ha-form-string\n           .schema=${{name:\"white_icon\",type:\"string\"}}\n           label=\"White Icon\"\n            .data=\"${this._config.white_icon}\"\n            .configValue=\"${\"white_icon\"}\"\n            @changed=\"${this.configChanged}\"\n          ></ha-form-string>\n          <ha-form-string\n            .schema=${{name:\"warm_white_icon\",type:\"string\"}}\n            label=\"Warm White Icon\"\n            .data=\"${this._config.warm_white_icon}\"\n            .configValue=\"${\"warm_white_icon\"}\"\n            @changed=\"${this.configChanged}\"\n          ></ha-form-string>\n        </div>\n\n        <div class='entities'>\n          <ha-form-string\n            .schema=${{name:\"temperature_icon\",type:\"string\"}}\n            label=\"Temperature Icon\"\n            .data=\"${this._config.temperature_icon}\"\n            .configValue=\"${\"temperature_icon\"}\"\n            @changed=\"${this.configChanged}\"\n          ></ha-form-string>\n          <ha-form-string\n            .schema=${{name:\"transition\",type:\"string\"}}\n            label=\"Transition (seconds)\"\n            .data=\"${String(this._config.transition||\"\")}\"\n            .configValue=\"${\"transition\"}\"\n            @changed=\"${this.configChanged}\"\n          ></ha-form-string>\n        </div>\n\n        <div class='overall-config'>\n          <div class='checkbox-options'>\n            <ha-formfield label=\"Shorten Cards\">\n              <ha-checkbox\n                @change=\"${this.checkboxConfigChanged}\"\n                .checked=${this._config.shorten_cards}\n                .value=\"${\"shorten_cards\"}\"\n              ></ha-checkbox>\n            </ha-formfield>\n            </div>\n\n            <div class='checkbox-options'>\n              <ha-formfield label=\"Persist Features\">\n                <ha-checkbox\n                  @change=\"${this.checkboxConfigChanged}\"\n                  .checked=${this._config.persist_features}\n                  .value=\"${\"persist_features\"}\"\n                ></ha-checkbox>\n              </ha-formfield>\n              <ha-formfield label=\"Show Brightness\">\n                <ha-checkbox\n                  @change=\"${this.checkboxConfigChanged}\"\n                  .checked=${this._config.brightness}\n                  .value=\"${\"brightness\"}\"\n                ></ha-checkbox>\n              </ha-formfield>\n            </div>\n\n            <div class='checkbox-options'>\n              <ha-formfield label=\"Show Color Temp\">\n                <ha-checkbox\n                  @change=\"${this.checkboxConfigChanged}\"\n                  .checked=${this._config.color_temp}\n                  .value=\"${\"color_temp\"}\"\n                ></ha-checkbox>\n              </ha-formfield>\n              <ha-formfield label=\"Color Temp in Kelvin\">\n                <ha-checkbox\n                  @change=\"${this.checkboxConfigChanged}\"\n                  .checked=${this._config.color_temp_in_kelvin}\n                  .value=\"${\"color_temp_in_kelvin\"}\"\n                ></ha-checkbox>\n              </ha-formfield>\n            </div>\n\n            <div class='checkbox-options'>\n              <ha-formfield label=\"Show White Channel\">\n                <ha-checkbox\n                  @change=\"${this.checkboxConfigChanged}\"\n                  .checked=${this._config.white_value}\n                  .value=\"${\"white_value\"}\"\n                ></ha-checkbox>\n              </ha-formfield>\n            </div>\n\n            <div class='checkbox-options'>\n              <ha-formfield label=\"Show Warm White\">\n                <ha-checkbox\n                  @change=\"${this.checkboxConfigChanged}\"\n                  .checked=${this._config.warm_white_value}\n                  .value=\"${\"warm_white_value\"}\"\n                ></ha-checkbox>\n              </ha-formfield>\n            </div>\n\n            <div class='checkbox-options'>\n              <ha-formfield label=\"Show Speed\">\n                <ha-checkbox\n                  @change=\"${this.checkboxConfigChanged}\"\n                  .checked=${this._config.speed}\n                  .value=\"${\"speed\"}\"\n                ></ha-checkbox>\n              </ha-formfield>\n              <ha-formfield label=\"Show Intensity\">\n                <ha-checkbox\n                  @change=\"${this.checkboxConfigChanged}\"\n                  .checked=${this._config.intensity}\n                  .value=\"${\"intensity\"}\"\n                ></ha-checkbox>\n              </ha-formfield>\n            </div>\n\n            <div class='checkbox-options'>\n              <ha-formfield label=\"Show Color Picker\">\n                <ha-checkbox\n                  @change=\"${this.checkboxConfigChanged}\"\n                  .checked=${this._config.color_picker}\n                  .value=\"${\"color_picker\"}\"\n                ></ha-checkbox>\n              </ha-formfield>\n              <ha-formfield label=\"Show Effects List\">\n                <ha-checkbox\n                  @change=\"${this.checkboxConfigChanged}\"\n                  .checked=${this._config.effects_list}\n                  .value=\"${\"effects_list\"}\"\n                ></ha-checkbox>\n              </ha-formfield>\n            </div>\n\n            <div class='checkbox-options'>\n              <ha-formfield label=\"Full Width Sliders\">\n                <ha-checkbox\n                  @change=\"${this.checkboxConfigChanged}\"\n                  .checked=${this._config.full_width_sliders}\n                  .value=\"${\"full_width_sliders\"}\"\n                ></ha-checkbox>\n              </ha-formfield>\n              <ha-formfield label=\"Show Slider Percent\">\n                <ha-checkbox\n                  @change=\"${this.checkboxConfigChanged}\"\n                  .checked=${this._config.show_slider_percent}\n                  .value=\"${\"show_slider_percent\"}\"\n                ></ha-checkbox>\n              </ha-formfield>\n            </div>\n\n            <div class='checkbox-options'>\n              <ha-formfield label=\"Show Brightness %\">\n                <ha-checkbox\n                  @change=\"${this.checkboxConfigChanged}\"\n                  .checked=${this._config.show_brightness_percent}\n                  .value=\"${\"show_brightness_percent\"}\"\n                ></ha-checkbox>\n              </ha-formfield>\n              <ha-formfield label=\"Show Color Temp %\">\n                <ha-checkbox\n                  @change=\"${this.checkboxConfigChanged}\"\n                  .checked=${this._config.show_color_temp_percent}\n                  .value=\"${\"show_color_temp_percent\"}\"\n                ></ha-checkbox>\n              </ha-formfield>\n            </div>\n\n            <div class='checkbox-options'>\n              <ha-formfield label=\"Hide Header\">\n                <ha-checkbox\n                  @change=\"${this.checkboxConfigChanged}\"\n                  .checked=${this._config.hide_header}\n                  .value=\"${\"hide_header\"}\"\n                ></ha-checkbox>\n              </ha-formfield>\n              <ha-formfield label=\"Show Header Icon\">\n                <ha-checkbox\n                  @change=\"${this.checkboxConfigChanged}\"\n                  .checked=${this._config.show_header_icon}\n                  .value=\"${\"show_header_icon\"}\"\n                ></ha-checkbox>\n              </ha-formfield>\n              <ha-formfield label=\"Child Card\">\n                <ha-checkbox\n                  @change=\"${this.checkboxConfigChanged}\"\n                  .checked=${this._config.child_card}\n                  .value=\"${\"child_card\"}\"\n                ></ha-checkbox>\n              </ha-formfield>\n            </div>\n\n            <div class='checkbox-options'>\n              <ha-formfield label=\"Force Features\">\n                <ha-checkbox\n                  @change=\"${this.checkboxConfigChanged}\"\n                  .checked=${this._config.force_features}\n                  .value=\"${\"force_features\"}\"\n                ></ha-checkbox>\n              </ha-formfield>\n            </div>\n\n            <div class='checkbox-options'>\n            <ha-formfield label=\"Consolidate Entities\">\n              <ha-checkbox\n                @change=\"${this.checkboxConfigChanged}\"\n                .checked=${this._config.consolidate_entities}\n                .value=\"${\"consolidate_entities\"}\"\n              ></ha-checkbox>\n            </ha-formfield>\n          </div>\n          </div>\n      </div>\n    `}entityChanged(t){if(!this._config||!this.hass||!this._firstRendered)return;const e=t.detail.value;e!==this._config.entity&&(this._config={...this._config,entity:e},Ht(this,\"config-changed\",{config:this._config}))}configChanged(t){if(!this._config||!this.hass||!this._firstRendered)return;const{target:{configValue:e,value:i},detail:{value:n}}=t;this._config=null!=n?{...this._config,[e]:n}:{...this._config,[e]:i},Ht(this,\"config-changed\",{config:this._config})}checkboxConfigChanged(t){if(!this._config||!this.hass||!this._firstRendered)return;const{target:{value:e,checked:i}}=t;this._config={...this._config,[e]:i},Ht(this,\"config-changed\",{config:this._config})}}const Mt=\"light-entity-card-editor\";customElements.define(Mt,Vt),console.info(\"light-entity-card v6.3.1\");class Wt extends(Tt(At)){static get elementDefinitions(){return Nt([Rt(\"ha-card\"),Rt(\"more-info-light\"),Rt(\"ha-switch\"),Rt(\"ha-icon\"),Rt(\"state-badge\"),Rt(\"ha-slider\"),Rt(\"ha-hs-color-picker\"),Rt(\"ha-select\"),Rt(\"mwc-list-item\")],Wt)}static get properties(){return{hass:{},config:{},_colorPickerValues:{state:!0}}}async firstUpdated(){if(this._firstUpdate=!0,!1!==this.config.color_picker&&this.config.entity.startsWith(\"light.\")&&!customElements.get(\"ha-hs-color-picker\")){const t=document.querySelector(\"home-assistant\");if(t){const e=document.createElement(\"style\");e.textContent=\"ha-more-info-dialog { display: none !important; }\",t.shadowRoot.appendChild(e);const i=new CustomEvent(\"hass-more-info\",{detail:{entityId:this.config.entity},bubbles:!0,composed:!0});t.dispatchEvent(i);try{await Promise.race([customElements.whenDefined(\"ha-hs-color-picker\"),new Promise((t,e)=>setTimeout(()=>e(new Error(\"timeout\")),5e3))])}catch(t){}finally{const i=new CustomEvent(\"hass-more-info\",{detail:{entityId:\"\"},bubbles:!0,composed:!0});t.dispatchEvent(i),e.remove()}}this.requestUpdate()}}setConfig(t){if(!t.entity)throw Error(\"entity required.\");this.config={...Ut,...t}}static async getConfigElement(){return document.createElement(Mt)}static get featureNames(){return{brightness:1,colorTemp:2,effectList:4,color:16,whiteValue:128}}static get cmdToggle(){return{on:\"turn_on\",off:\"turn_off\"}}static get entityLength(){return{light:10,switch:1}}getCardSize(){if(!this.config||!this.__hass||!this.__hass.states[this.config.entity])return 1;let t=0;const e=this.__hass.states[this.config.entity];return Array.isArray(e.attributes.entity_id)?e.attributes.entity_id.forEach(e=>t+=this.getEntityLength(e)):t+=this.getEntityLength(e.attributes.entity_id),this.config.group&&(t*=.8),parseInt(t,10)}getEntityLength(t){return/^light\\./.test(t)?Wt.entityLength.light:/^switch\\./.test(t)?Wt.entityLength.switch:0}get styles(){return jt}isEntityOn(t){return\"on\"===t.state}render(){const t=this.hass.states[this.config.entity];if(!t)return X`\n        <style>\n          ${this.styles}\n        </style>\n        <ha-card> ${`Invalid entity: ${this.config.entity}`} </ha-card>\n      `;this._stateObjects=this.getEntitiesToShow(t),this.config.consolidate_entities?this._shownStateObjects=[t]:this._shownStateObjects=[...this._stateObjects];const e=this._shownStateObjects.reduce((t,e)=>X`${t}${this.createEntityTemplate(e)}`,\"\"),i=`light-entity-card ${this.config.shorten_cards?\" group\":\"\"} ${this.config.child_card?\" light-entity-child-card\":\"\"}`;return X`\n      <style>\n        ${this.styles}\n      </style>\n      <ha-card class=\"${i}\">\n        ${e}\n      </ha-card>\n    `}getEntitiesToShow(t){return t.attributes.entity_id&&Array.isArray(t.attributes.entity_id)?t.attributes.entity_id.map(t=>this.hass.states[t]).filter(Boolean):[t]}createEntityTemplate(t){const e=this.config.full_width_sliders?\"ha-slider-full-width\":\"\";return X`\n      ${this.createHeader(t)}\n      <div class=\"light-entity-card-sliders ${e}\">\n        ${this.createBrightnessSlider(t)} ${this.createSpeedSlider(t)}\n        ${this.createIntensitySlider(t)} ${this.createColorTemperature(t)}\n        ${this.createWhiteValue(t)}\n        ${this.createWarmWhiteValue(t)}\n      </div>\n      ${this.createColorPicker(t)} ${this.createEffectList(t)}\n    `}createHeader(t){if(this.config.hide_header)return X``;const e=this.config.header||t.attributes.friendly_name||t.entity_id;return X`\n      <div class=\"light-entity-card__header\">\n        ${this.showHeaderIcon(t)}\n        <div class=\"light-entity-card__title\">${e}</div>\n        <div class=\"light-entity-card-toggle\">\n          <ha-switch .checked=${this.isEntityOn(t)} @change=${e=>this.setToggle(e,t)}></ha-switch>\n        </div>\n      </div>\n    `}showHeaderIcon(t){return this.config.show_header_icon?X`\n      <div class=\"icon-container\">\n        <state-badge .stateObj=${t}></state-badge>\n      </div>\n    `:X``}createBrightnessSlider(t){return!1===this.config.brightness||this.dontShowFeature(\"brightness\",t)?X``:X`\n      <div class=\"control light-entity-card-center\">\n        <div class=\"icon-container\" title=\"Brightness\">\n          <ha-icon icon=\"hass:${this.config.brightness_icon}\"></ha-icon>\n        </div>\n        <ha-slider\n          .value=\"${t.attributes.brightness||0}\"\n          @change=\"${e=>this._setValue(e,t,\"brightness\")}\"\n          min=\"1\"\n          max=\"255\"\n        ></ha-slider>\n        ${this.showPercent(t.attributes.brightness,0,254,\"brightness\")}\n      </div>\n    `}createSpeedSlider(t){return!1===this.config.speed||this.dontShowFeature(\"speed\",t)?X``:X`\n      <div class=\"control light-entity-card-center\">\n        <div class=\"icon-container\" title=\"Speed\">\n          <ha-icon icon=\"hass:${this.config.speed_icon}\"></ha-icon>\n        </div>\n        <ha-slider\n          .value=\"${t.attributes.speed||0}\"\n          @change=\"${e=>this._setValue(e,t,\"speed\")}\"\n          min=\"1\"\n          max=\"255\"\n        ></ha-slider>\n        ${this.showPercent(t.attributes.speed,0,254)}\n      </div>\n    `}createIntensitySlider(t){return!1===this.config.intensity||this.dontShowFeature(\"intensity\",t)?X``:X`\n      <div class=\"control light-entity-card-center\">\n        <div class=\"icon-container\" title=\"Intensity\">\n          <ha-icon icon=\"hass:${this.config.intensity_icon}\"></ha-icon>\n        </div>\n        <ha-slider\n          .value=\"${t.attributes.intensity||0}\"\n          @change=\"${e=>this._setValue(e,t,\"intensity\")}\"\n          min=\"1\"\n          max=\"255\"\n        ></ha-slider>\n        ${this.showPercent(t.attributes.intensity,0,254)}\n      </div>\n    `}showPercent(t,e,i,n){if(\"brightness\"===n&&void 0!==this.config.show_brightness_percent){if(!this.config.show_brightness_percent)return X``}else if(\"color_temp\"===n&&void 0!==this.config.show_color_temp_percent){if(!this.config.show_color_temp_percent)return X``}else if(\"color_temp\"===n&&this.config.color_temp_in_kelvin);else if(!this.config.show_slider_percent)return X``;if(\"color_temp\"===n&&this.config.color_temp_in_kelvin)return X` <div class=\"percent-slider\">${t}K</div> `;let r=parseInt(100*(t-e)/(i-e),10);return isNaN(r)&&(r=0),X` <div class=\"percent-slider\">${r}%</div> `}createColorTemperature(t){if(!1===this.config.color_temp)return X``;if(this.dontShowFeature(\"colorTemp\",t))return X``;const e=void 0!==t.attributes.min_color_temp_kelvin;let i,n,r,o,s,a;if(this.config.color_temp_in_kelvin){let o,s,a;if(e?(a=t.attributes.color_temp_kelvin,o=t.attributes.min_color_temp_kelvin,s=t.attributes.max_color_temp_kelvin):(a=t.attributes.color_temp?Math.round(1e6/t.attributes.color_temp):null,o=t.attributes.max_mireds?Math.round(1e6/t.attributes.max_mireds):null,s=t.attributes.min_mireds?Math.round(1e6/t.attributes.min_mireds):null),!o||!s)return X``;const c=Math.round((o+s)/2);i=\"number\"==typeof a&&Number.isFinite(a)&&a>0?a:null,n=o,r=s;const h=i||c,l=this.showPercent(h,n,r,\"color_temp\");return X`\n        <div class=\"control light-entity-card-center\">\n          <div class=\"icon-container\" title=\"Color Temperature\">\n            <ha-icon icon=\"hass:${this.config.temperature_icon}\"></ha-icon>\n          </div>\n          <ha-slider\n            class=\"light-entity-card-color_temp light-entity-card-color_temp--kelvin\"\n            min=\"${n}\"\n            max=\"${r}\"\n            .value=${h}\n            @change=\"${i=>this._setColorTemp(i,t,e,!0)}\"\n          >\n          </ha-slider>\n          ${l}\n        </div>\n      `}if(e){const e=t.attributes.color_temp_kelvin,i=t.attributes.min_color_temp_kelvin,n=t.attributes.max_color_temp_kelvin;if(!i||!n)return X``;a=\"number\"==typeof e&&Number.isFinite(e)&&e>0?Math.round(1e6/e):null,o=Math.round(1e6/n),s=Math.round(1e6/i)}else if(a=t.attributes.color_temp,o=t.attributes.min_mireds,s=t.attributes.max_mireds,!o||!s)return X``;const c=s&&o?s-o:0,h=c>0&&null!=a?Math.round((a-o)/c*100):50,l=this.showPercent(h,0,100,\"color_temp\");return X`\n      <div class=\"control light-entity-card-center\">\n        <div class=\"icon-container\" title=\"Color Temperature\">\n          <ha-icon icon=\"hass:${this.config.temperature_icon}\"></ha-icon>\n        </div>\n        <ha-slider\n          class=\"light-entity-card-color_temp\"\n          min=\"0\"\n          max=\"100\"\n          .value=${h}\n          @change=\"${i=>this._setColorTemp(i,t,e,!1,o,s)}\"\n        >\n        </ha-slider>\n        ${l}\n      </div>\n    `}getWhiteValue(t,e=3){const i=t.attributes.rgbw_color,n=t.attributes.rgbww_color;return i&&3===e?i[3]||0:n&&e<n.length?n[e]||0:3===e&&void 0!==t.attributes.white_value?t.attributes.white_value??0:0}createWhiteValue(t){if(!1===this.config.white_value)return X``;if(this.dontShowFeature(\"whiteValue\",t))return X``;const e=this.getWhiteValue(t,3);return X`\n      <div class=\"control light-entity-card-center\">\n        <div class=\"icon-container\" title=\"White\">\n          <ha-icon icon=\"hass:${this.config.white_icon}\"></ha-icon>\n        </div>\n        <ha-slider\n          max=\"255\"\n          .value=\"${e}\"\n          @change=\"${e=>this._setWhiteValue(e,t,3)}\"\n        >\n        </ha-slider>\n        ${this.showPercent(e,0,254)}\n      </div>\n    `}createWarmWhiteValue(t){if(!1===this.config.warm_white_value)return X``;if(this.dontShowFeature(\"warmWhiteValue\",t))return X``;const e=this.getWhiteValue(t,4);return X`\n      <div class=\"control light-entity-card-center\">\n        <div class=\"icon-container\" title=\"Warm White\">\n          <ha-icon icon=\"hass:${this.config.warm_white_icon}\"></ha-icon>\n        </div>\n        <ha-slider\n          max=\"255\"\n          .value=\"${e}\"\n          @change=\"${e=>this._setWhiteValue(e,t,4)}\"\n        >\n        </ha-slider>\n        ${this.showPercent(e,0,254)}\n      </div>\n    `}_setWhiteValue(t,e,i){const n=parseInt(t.target.value,10);if(isNaN(n))return;const r=e.attributes.supported_color_modes||[],o=e.attributes.rgbw_color,s=e.attributes.rgbww_color;if(r.includes(\"rgbw\")&&3===i){const t=o?o.slice(0,3):e.attributes.rgb_color||[255,255,255];this.callEntityService({rgbw_color:[t[0],t[1],t[2],n]},e)}else if(r.includes(\"rgbww\")){let t;if(s)t=s;else if(o)t=[o[0],o[1],o[2],o[3],0];else{const i=e.attributes.rgb_color||[255,255,255];t=[i[0],i[1],i[2],0,0]}const r=[...t];r[i]=n,this.callEntityService({rgbww_color:r},e)}else this.callEntityService({white_value:n},e)}createEffectList(t){if(!1===this.config.effects_list)return X``;if(!this.config.persist_features&&!this.isEntityOn(t))return X``;let e=t.attributes.effect_list||[];if(this.config.effects_list&&Array.isArray(this.config.effects_list))e=this.config.effects_list;else if(this.config.effects_list&&this.hass.states[this.config.effects_list]){const t=this.hass.states[this.config.effects_list];e=t.attributes&&t.attributes.options||[]}else if(this.dontShowFeature(\"effectList\",t))return X``;const i=e.map(e=>this.createListItem(t,e)),n=this.hass.localize(\"ui.card.light.effect\")||\"Effect\";return X`\n      <div class=\"control light-entity-card-center light-entity-card-effectlist\">\n        <ha-select \n          @closed=\"${t=>t.stopPropagation()}\" \n          @selected=${e=>this.setEffect(e,t)} \n          label=\"${n}\" \n        >\n          ${i}\n        </ha-select>\n      </div>\n    `}createListItem(t,e){return X`<mwc-list-item value=\"${e}\" ?selected=${e===t.attributes.effect}\n      >${e}</mwc-list-item\n    >`}createColorPicker(t){if(!1===this.config.color_picker)return X``;if(this.dontShowFeature(\"color\",t))return X``;const e=t.attributes.hs_color||[0,0],i=this._colorPickerValues&&this._colorPickerValues[t.entity_id]||[e[0],e[1]/100];return X`\n      <div class=\"light-entity-card__color-picker\">\n        <ha-hs-color-picker\n          .value=${i}\n          @cursor-moved=${e=>{this._colorPickerValues={...this._colorPickerValues,[t.entity_id]:e.detail.value}}}\n          @value-changed=${e=>this._onColorPickerChanged(e.detail.value,t)}\n        ></ha-hs-color-picker>\n      </div>\n    `}dontShowFeature(t,e){if(this.config.force_features)return!1;if(\"speed\"===t&&\"speed\"in e.attributes)return!1;if(\"intensity\"===t&&\"intensity\"in e.attributes)return!1;let i=Wt.featureNames[t]&e.attributes.supported_features;const n=e.attributes.supported_color_modes||[];if(!i)switch(t){case\"brightness\":if(i=Object.prototype.hasOwnProperty.call(e.attributes,\"brightness\"),!i){const t=[\"hs\",\"rgb\",\"rgbw\",\"rgbww\",\"white\",\"brightness\",\"color_temp\",\"xy\"];i=[...new Set(n.filter(e=>t.includes(e)))].length>0}break;case\"colorTemp\":if(n){const t=[\"color_temp\"];i=[...new Set(n.filter(e=>t.includes(e)))].length>0}break;case\"effectList\":i=e.attributes.effect_list&&e.attributes.effect_list.length;break;case\"color\":{const t=[\"hs\",\"rgb\",\"rgbw\",\"rgbww\",\"xy\"];i=[...new Set(n.filter(e=>t.includes(e)))].length>0;break}case\"whiteValue\":if(i=Object.prototype.hasOwnProperty.call(e.attributes,\"white_value\"),!i){const t=[\"rgbw\",\"rgbww\"];i=n.some(e=>t.includes(e))}break;case\"warmWhiteValue\":{const t=[\"rgbww\"];i=n.some(e=>t.includes(e));break}default:i=!1}return!i||!this.config.persist_features&&!this.isEntityOn(e)}_onColorPickerChanged(t,e){if(this._colorPickerValues){const{[e.entity_id]:t,...i}=this._colorPickerValues;this._colorPickerValues=i}this.setColorPicker(t,e)}setColorPicker(t,e){t&&this.callEntityService({hs_color:[t[0],100*t[1]]},e)}_setValue(t,e,i){const n=parseInt(t.target.value,10);isNaN(n)||parseInt(e.attributes[i],10)===n||this.callEntityService({[i]:n},e)}_setColorTemp(t,e,i,n,r,o){const s=parseInt(t.target.value,10);if(!isNaN(s))if(n)if(i){if(s===parseInt(e.attributes.color_temp_kelvin,10))return;this.callEntityService({color_temp_kelvin:s},e)}else{const t=Math.round(1e6/s);if(t===parseInt(e.attributes.color_temp,10))return;this.callEntityService({color_temp:t},e)}else{if(!Number.isFinite(r)||!Number.isFinite(o)||o<=r)return;const t=Math.round(r+s/100*(o-r));if(i){const i=Math.round(1e6/t);if(i===parseInt(e.attributes.color_temp_kelvin,10))return;this.callEntityService({color_temp_kelvin:i},e)}else{if(t===parseInt(e.attributes.color_temp,10))return;this.callEntityService({color_temp:t},e)}}}setToggle(t,e){const i=this.isEntityOn(e)?Wt.cmdToggle.off:Wt.cmdToggle.on;this.callEntityService({},e,i)}setEffect(t,e){t.target.value&&this.callEntityService({effect:t.target.value},e)}callEntityService(t,e,i){if(!this._firstUpdate)return;let n=e.entity_id.split(\".\")[0];\"group\"===n&&(n=\"homeassistant\");const r=parseFloat(this.config.transition)||0;r>0&&\"light\"===n&&(t={...t,transition:r}),this.hass.callService(n,i||Wt.cmdToggle.on,{entity_id:e.entity_id,...t})}}customElements.define(\"light-entity-card\",Wt),window.customCards=window.customCards||[],window.customCards.push({type:\"light-entity-card\",name:\"Light Entity Card\",description:\"Control lights and switches\"})})();"
  },
  {
    "path": "dist/light-entity-card.js.LICENSE.txt",
    "content": "/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n"
  },
  {
    "path": "hacs.json",
    "content": "{\n    \"name\": \"Light Entity Card\",\n    \"render_readme\": true,\n    \"filename\": \"light-entity-card.js\"\n}"
  },
  {
    "path": "package.json",
    "content": "{\r\n  \"name\": \"light-entity-card\",\r\n  \"version\": \"6.3.1\",\r\n  \"description\": \"A light-entity card for Home Assistant Lovelace UI\",\r\n  \"keywords\": [\r\n    \"home-assistant\",\r\n    \"homeassistant\",\r\n    \"hass\",\r\n    \"automation\",\r\n    \"lovelace\",\r\n    \"custom-cards\",\r\n    \"light-entity\"\r\n  ],\r\n  \"repository\": \"git@github.com:ljmerza/light-entity-card.git\",\r\n  \"author\": \"Leonardo Merza <ljmerza@gmail.com>\",\r\n  \"license\": \"MIT\",\r\n  \"dependencies\": {\r\n    \"@babel/polyfill\": \"^7.4.4\",\r\n\"@lit-labs/scoped-registry-mixin\": \"^1.0.0\",\r\n    \"@material/mwc-icon\": \"^0.25.3\",\r\n    \"@material/mwc-list\": \"^0.25.3\",\r\n    \"@material/mwc-menu\": \"^0.25.3\",\r\n    \"@material/mwc-notched-outline\": \"^0.25.3\",\r\n    \"@material/mwc-select\": \"^0.25.3\",\r\n    \"core-js\": \"^2.6.5\",\r\n    \"lit\": \"^2.1.2\",\r\n    \"lit-element\": \"^2.2.1\"\r\n  },\r\n  \"devDependencies\": {\r\n    \"@babel/cli\": \"^7.5.5\",\r\n    \"@babel/core\": \"^7.5.5\",\r\n    \"@babel/preset-env\": \"^7.5.5\",\r\n    \"babel-loader\": \"^8.0.6\",\r\n    \"eslint\": \"^6.1.0\",\r\n    \"webpack\": \"^5.95.0\",\r\n    \"webpack-cli\": \"^5.1.4\",\r\n    \"webpack-merge\": \"^6.0.1\"\r\n  },\r\n  \"scripts\": {\r\n    \"lint\": \"eslint  --fix ./src\",\r\n    \"start\": \"webpack --watch --config webpack/config.dev.js\",\r\n    \"build\": \"webpack --config webpack/config.prod.js\"\r\n  }\r\n}\r\n"
  },
  {
    "path": "rollup-plugins/ignore.js",
    "content": "export default function (userOptions = {}) {\n  // Files need to be absolute paths.\n  // This only works if the file has no exports\n  // and only is imported for its side effects\n  const files = userOptions.files || [];\n\n  if (files.length === 0) {\n    return {\n      name: 'ignore',\n    };\n  }\n\n  return {\n    name: 'ignore',\n\n    load(id) {\n      return files.some(toIgnorePath => id.startsWith(toIgnorePath))\n        ? {\n          code: '',\n        }\n        : null;\n    },\n  };\n}\n"
  },
  {
    "path": "src/buildElementDefinitions.js",
    "content": "const buildElementDefinitions = (elements, constructor) => elements.reduce((aggregate, element) => {\n  if (element.defineId) {\n    // eslint-disable-next-line no-param-reassign\n    aggregate[element.defineId] = element;\n  } else {\n    element.promise.then((clazz) => {\n      if (constructor.registry.get(element.name) === undefined) {\n        constructor.registry.define(element.name, clazz);\n      }\n    });\n  }\n  return aggregate;\n}, {});\n\nexport default buildElementDefinitions;\n"
  },
  {
    "path": "src/color-wheel/color-picker.js",
    "content": "import { LitElement, html } from 'lit';\nimport { ScopedRegistryHost } from '@lit-labs/scoped-registry-mixin';\n\nimport { hs2rgb, rgb2hs } from \"./convert-color\";\n\nclass LmeColorPicker extends ScopedRegistryHost(LitElement) {\n  static get properties() {\n    return {\n      hsColor: {\n        type: Object,\n      },\n\n      // use these properties to update the state via attributes\n      desiredHsColor: {\n        type: Object,\n        observer: \"applyHsColor\",\n      },\n\n      // use these properties to update the state via attributes\n      desiredRgbColor: {\n        type: Object,\n        observer: \"applyRgbColor\",\n      },\n\n      // width, height and radius apply to the coordinates of\n      // of the canvas.\n      // border width are relative to these numbers\n      // the onscreen displayed size should be controlled with css\n      // and should be the same or smaller\n      width: {\n        type: Number,\n        value: 500,\n      },\n\n      height: {\n        type: Number,\n        value: 500,\n      },\n\n      radius: {\n        type: Number,\n        value: 225,\n      },\n\n      // the amount segments for the hue\n      // 0 = continuous gradient\n      // other than 0 gives 'pie-pieces'\n      hueSegments: {\n        type: Number,\n        value: 0,\n        observer: \"segmentationChange\",\n      },\n\n      // the amount segments for the hue\n      // 0 = continuous gradient\n      // 1 = only fully saturated\n      // > 1 = segments from white to fully saturated\n      saturationSegments: {\n        type: Number,\n        value: 0,\n        observer: \"segmentationChange\",\n      },\n\n      // set to true to make the segments purely esthetical\n      // this allows selection off all collors, also\n      // interpolated between the segments\n      ignoreSegments: {\n        type: Boolean,\n        value: false,\n      },\n\n      // throttle te amount of 'colorselected' events fired\n      // value is timeout in milliseconds\n      throttle: {\n        type: Number,\n        value: 500,\n      },\n    };\n  }\n\n  render() {\n    console.log('test')\n    return html`\n      <style>\n        :host {\n          user-select: none;\n          -webkit-user-select: none;\n        }\n\n        #canvas {\n          position: relative;\n          width: 100%;\n          max-width: 330px;\n        }\n        #canvas > * {\n          display: block;\n        }\n        #interactionLayer {\n          color: white;\n          position: absolute;\n          cursor: crosshair;\n          width: 100%;\n          height: 100%;\n          overflow: visible;\n        }\n        #backgroundLayer {\n          width: 100%;\n          overflow: visible;\n          --wheel-bordercolor: var(--ha-color-picker-wheel-bordercolor, white);\n          --wheel-borderwidth: var(--ha-color-picker-wheel-borderwidth, 3);\n          --wheel-shadow: var(\n            --ha-color-picker-wheel-shadow,\n            rgb(15, 15, 15) 10px 5px 5px 0px\n          );\n        }\n\n        #marker {\n          fill: currentColor;\n          stroke: var(--ha-color-picker-marker-bordercolor, white);\n          stroke-width: var(--ha-color-picker-marker-borderwidth, 3);\n          filter: url(#marker-shadow);\n        }\n        .dragging #marker {\n        }\n\n        #colorTooltip {\n          display: none;\n          fill: currentColor;\n          stroke: var(--ha-color-picker-tooltip-bordercolor, white);\n          stroke-width: var(--ha-color-picker-tooltip-borderwidth, 3);\n        }\n\n        .touch.dragging #colorTooltip {\n          display: inherit;\n        }\n      </style>\n      <div id=\"canvas\">\n        <svg id=\"interactionLayer\">\n          <defs>\n            <filter\n              id=\"marker-shadow\"\n              x=\"-50%\"\n              y=\"-50%\"\n              width=\"200%\"\n              height=\"200%\"\n              filterUnits=\"objectBoundingBox\"\n            >\n              <feOffset\n                result=\"offOut\"\n                in=\"SourceAlpha\"\n                dx=\"2\"\n                dy=\"2\"\n              ></feOffset>\n              <feGaussianBlur\n                result=\"blurOut\"\n                in=\"offOut\"\n                stdDeviation=\"2\"\n              ></feGaussianBlur>\n              <feComponentTransfer in=\"blurOut\" result=\"alphaOut\">\n                <feFuncA type=\"linear\" slope=\"0.3\"></feFuncA>\n              </feComponentTransfer>\n              <feBlend\n                in=\"SourceGraphic\"\n                in2=\"alphaOut\"\n                mode=\"normal\"\n              ></feBlend>\n            </filter>\n          </defs>\n        </svg>\n        <canvas id=\"backgroundLayer\"></canvas>\n      </div>\n    `;\n  }\n\n  \n\n  firstUpdated() {\n    super.firstUpdated();\n    this.setupLayers();\n    this.drawColorWheel();\n    this.drawMarker();\n\n    if (this.desiredHsColor) {\n      this.applyHsColor(this.desiredHsColor);\n    }\n\n    if (this.desiredRgbColor) {\n      this.applyRgbColor(this.desiredRgbColor);\n    }\n\n    this.interactionLayer.addEventListener(\"mousedown\", (ev) =>\n      this.onMouseDown(ev)\n    );\n    this.interactionLayer.addEventListener(\"touchstart\", (ev) =>\n      this.onTouchStart(ev)\n    );\n  }\n\n  // converts browser coordinates to canvas canvas coordinates\n  // origin is wheel center\n  // returns {x: X, y: Y} object\n  convertToCanvasCoordinates(clientX, clientY) {\n    const svgPoint = this.interactionLayer.createSVGPoint();\n    svgPoint.x = clientX;\n    svgPoint.y = clientY;\n    const cc = svgPoint.matrixTransform(\n      this.interactionLayer.getScreenCTM().inverse()\n    );\n    return { x: cc.x, y: cc.y };\n  }\n\n  // Mouse events\n\n  onMouseDown(ev) {\n    const cc = this.convertToCanvasCoordinates(ev.clientX, ev.clientY);\n    // return if we're not on the wheel\n    if (!this.isInWheel(cc.x, cc.y)) {\n      return;\n    }\n    // a mousedown in wheel is always a color select action\n    this.onMouseSelect(ev);\n    // allow dragging\n    this.canvas.classList.add(\"mouse\", \"dragging\");\n    this.addEventListener(\"mousemove\", this.onMouseSelect);\n    this.addEventListener(\"mouseup\", this.onMouseUp);\n  }\n\n  onMouseUp() {\n    this.canvas.classList.remove(\"mouse\", \"dragging\");\n    this.removeEventListener(\"mousemove\", this.onMouseSelect);\n  }\n\n  onMouseSelect(ev) {\n    requestAnimationFrame(() => this.processUserSelect(ev));\n  }\n\n  // Touch events\n  onTouchStart(ev) {\n    const touch = ev.changedTouches[0];\n    const cc = this.convertToCanvasCoordinates(touch.clientX, touch.clientY);\n    // return if we're not on the wheel\n    if (!this.isInWheel(cc.x, cc.y)) {\n      return;\n    }\n    if (ev.target === this.marker) {\n      // drag marker\n      ev.preventDefault();\n      this.canvas.classList.add(\"touch\", \"dragging\");\n      this.addEventListener(\"touchmove\", this.onTouchSelect);\n      this.addEventListener(\"touchend\", this.onTouchEnd);\n      return;\n    }\n    // don't fire color selection immediately,\n    // wait for touchend and invalidate when we scroll\n    this.tapBecameScroll = false;\n    this.addEventListener(\"touchend\", this.onTap);\n    this.addEventListener(\n      \"touchmove\",\n      () => {\n        this.tapBecameScroll = true;\n      },\n      { passive: true }\n    );\n  }\n\n  onTap(ev) {\n    if (this.tapBecameScroll) {\n      return;\n    }\n    ev.preventDefault();\n    this.onTouchSelect(ev);\n  }\n\n  onTouchEnd() {\n    this.canvas.classList.remove(\"touch\", \"dragging\");\n    this.removeEventListener(\"touchmove\", this.onTouchSelect);\n  }\n\n  onTouchSelect(ev) {\n    requestAnimationFrame(() => this.processUserSelect(ev.changedTouches[0]));\n  }\n\n  /*\n   * General event/selection handling\n   */\n\n  // Process user input to color\n  processUserSelect(ev) {\n    const canvasXY = this.convertToCanvasCoordinates(ev.clientX, ev.clientY);\n    const hs = this.getColor(canvasXY.x, canvasXY.y);\n    let rgb;\n    if (!this.isInWheel(canvasXY.x, canvasXY.y)) {\n      const [r, g, b] = hs2rgb([hs.h, hs.s]);\n      rgb = { r, g, b };\n    } else {\n      rgb = this.getRgbColor(canvasXY.x, canvasXY.y);\n    }\n    this.onColorSelect(hs, rgb);\n  }\n\n  // apply color to marker position and canvas\n  onColorSelect(hs, rgb) {\n    this.setMarkerOnColor(hs); // marker always follows mouse 'raw' hs value (= mouse position)\n    if (!this.ignoreSegments) {\n      // apply segments if needed\n      hs = this.applySegmentFilter(hs);\n    }\n    // always apply the new color to the interface / canvas\n    this.applyColorToCanvas(hs);\n    // throttling is applied to updating the exposed colors (properties)\n    // and firing of events\n    if (this.colorSelectIsThrottled) {\n      // make sure we apply the last selected color\n      // eventually after throttle limit has passed\n      clearTimeout(this.ensureFinalSelect);\n      this.ensureFinalSelect = setTimeout(() => {\n        this.fireColorSelected(hs, rgb); // do it for the final time\n      }, this.throttle);\n      return;\n    }\n    this.fireColorSelected(hs, rgb); // do it\n    this.colorSelectIsThrottled = true;\n    setTimeout(() => {\n      this.colorSelectIsThrottled = false;\n    }, this.throttle);\n  }\n\n  // set color values and fire colorselected event\n  fireColorSelected(hs, rgb) {\n    this.hsColor = hs;\n    this.fire(\"colorselected\", { hs, rgb });\n  }\n\n  /*\n   * Interface updating\n   */\n\n  // set marker position to the given color\n  setMarkerOnColor(hs) {\n    if (!this.marker || !this.tooltip) {\n      return;\n    }\n    const dist = hs.s * this.radius;\n    const theta = ((hs.h - 180) / 180) * Math.PI;\n    const markerdX = -dist * Math.cos(theta);\n    const markerdY = -dist * Math.sin(theta);\n    const translateString = `translate(${markerdX},${markerdY})`;\n    this.marker.setAttribute(\"transform\", translateString);\n    this.tooltip.setAttribute(\"transform\", translateString);\n  }\n\n  // apply given color to interface elements\n  applyColorToCanvas(hs) {\n    if (!this.interactionLayer) {\n      return;\n    }\n    // we're not really converting hs to hsl here, but we keep it cheap\n    // setting the color on the interactionLayer, the svg elements can inherit\n    this.interactionLayer.style.color = `hsl(${hs.h}, 100%, ${\n      100 - hs.s * 50\n    }%)`;\n  }\n\n  applyHsColor(hs) {\n    // do nothing is we already have the same color\n    if (this.hsColor && this.hsColor.h === hs.h && this.hsColor.s === hs.s) {\n      return;\n    }\n    this.setMarkerOnColor(hs); // marker is always set on 'raw' hs position\n    if (!this.ignoreSegments) {\n      // apply segments if needed\n      hs = this.applySegmentFilter(hs);\n    }\n    this.hsColor = hs;\n    // always apply the new color to the interface / canvas\n    this.applyColorToCanvas(hs);\n  }\n\n  applyRgbColor(rgb) {\n    const [h, s] = rgb2hs(rgb);\n    this.applyHsColor({ h, s });\n  }\n\n  /*\n   * input processing helpers\n   */\n\n  // get angle (degrees)\n  getAngle(dX, dY) {\n    const theta = Math.atan2(-dY, -dX); // radians from the left edge, clockwise = positive\n    const angle = (theta / Math.PI) * 180 + 180; // degrees, clockwise from right\n    return angle;\n  }\n\n  // returns true when coordinates are in the colorwheel\n  isInWheel(x, y) {\n    return this.getDistance(x, y) <= 1;\n  }\n\n  // returns distance from wheel center, 0 = center, 1 = edge, >1 = outside\n  getDistance(dX, dY) {\n    return Math.sqrt(dX * dX + dY * dY) / this.radius;\n  }\n\n  /*\n   * Getting colors\n   */\n\n  getColor(x, y) {\n    const hue = this.getAngle(x, y); // degrees, clockwise from right\n    const relativeDistance = this.getDistance(x, y); // edge of radius = 1\n    const sat = Math.min(relativeDistance, 1); // Distance from center\n    return { h: hue, s: sat };\n  }\n\n  getRgbColor(x, y) {\n    // get current pixel\n    const imageData = this.backgroundLayer\n      .getContext(\"2d\")\n      .getImageData(x + 250, y + 250, 1, 1);\n    const pixel = imageData.data;\n    return { r: pixel[0], g: pixel[1], b: pixel[2] };\n  }\n\n  applySegmentFilter(hs) {\n    // apply hue segment steps\n    if (this.hueSegments) {\n      const angleStep = 360 / this.hueSegments;\n      const halfAngleStep = angleStep / 2;\n      hs.h -= halfAngleStep; // take the 'centered segemnts' into account\n      if (hs.h < 0) {\n        hs.h += 360;\n      } // don't end up below 0\n      const rest = hs.h % angleStep;\n      hs.h -= rest - angleStep;\n    }\n\n    // apply saturation segment steps\n    if (this.saturationSegments) {\n      if (this.saturationSegments === 1) {\n        hs.s = 1;\n      } else {\n        const segmentSize = 1 / this.saturationSegments;\n        const saturationStep = 1 / (this.saturationSegments - 1);\n        const calculatedSat = Math.floor(hs.s / segmentSize) * saturationStep;\n        hs.s = Math.min(calculatedSat, 1);\n      }\n    }\n    return hs;\n  }\n\n  /*\n   * Drawing related stuff\n   */\n\n  setupLayers() {\n    this.canvas = this.$.canvas;\n    this.backgroundLayer = this.$.backgroundLayer;\n    this.interactionLayer = this.$.interactionLayer;\n\n    // coordinate origin position (center of the wheel)\n    this.originX = this.width / 2;\n    this.originY = this.originX;\n\n    // synchronise width/height coordinates\n    this.backgroundLayer.width = this.width;\n    this.backgroundLayer.height = this.height;\n    this.interactionLayer.setAttribute(\n      \"viewBox\",\n      `${-this.originX} ${-this.originY} ${this.width} ${this.height}`\n    );\n  }\n\n  drawColorWheel() {\n    /*\n     *  Setting up all paremeters\n     */\n    let shadowColor;\n    let shadowOffsetX;\n    let shadowOffsetY;\n    let shadowBlur;\n    const context = this.backgroundLayer.getContext(\"2d\");\n    // postioning and sizing\n    const cX = this.originX;\n    const cY = this.originY;\n    const radius = this.radius;\n    const counterClockwise = false;\n    // styling of the wheel\n    const wheelStyle = window.getComputedStyle(this.backgroundLayer, null);\n    const borderWidth = parseInt(\n      wheelStyle.getPropertyValue(\"--wheel-borderwidth\"),\n      10\n    );\n    const borderColor = wheelStyle\n      .getPropertyValue(\"--wheel-bordercolor\")\n      .trim();\n    const wheelShadow = wheelStyle.getPropertyValue(\"--wheel-shadow\").trim();\n    // extract shadow properties from CSS variable\n    // the shadow should be defined as: \"10px 5px 5px 0px COLOR\"\n    if (wheelShadow !== \"none\") {\n      const values = wheelShadow.split(\"px \");\n      shadowColor = values.pop();\n      shadowOffsetX = parseInt(values[0], 10);\n      shadowOffsetY = parseInt(values[1], 10);\n      shadowBlur = parseInt(values[2], 10) || 0;\n    }\n    const borderRadius = radius + borderWidth / 2;\n    const wheelRadius = radius;\n    const shadowRadius = radius + borderWidth;\n\n    /*\n     *  Drawing functions\n     */\n    function drawCircle(hueSegments, saturationSegments) {\n      hueSegments = hueSegments || 360; // reset 0 segments to 360\n      const angleStep = 360 / hueSegments;\n      const halfAngleStep = angleStep / 2; // center segments on color\n      for (let angle = 0; angle <= 360; angle += angleStep) {\n        const startAngle = (angle - halfAngleStep) * (Math.PI / 180);\n        const endAngle = (angle + halfAngleStep + 1) * (Math.PI / 180);\n        context.beginPath();\n        context.moveTo(cX, cY);\n        context.arc(\n          cX,\n          cY,\n          wheelRadius,\n          startAngle,\n          endAngle,\n          counterClockwise\n        );\n        context.closePath();\n        // gradient\n        const gradient = context.createRadialGradient(\n          cX,\n          cY,\n          0,\n          cX,\n          cY,\n          wheelRadius\n        );\n        let lightness = 100;\n        // first gradient stop\n        gradient.addColorStop(0, `hsl(${angle}, 100%, ${lightness}%)`);\n        // segment gradient stops\n        if (saturationSegments > 0) {\n          const ratioStep = 1 / saturationSegments;\n          let ratio = 0;\n          for (let stop = 1; stop < saturationSegments; stop += 1) {\n            const prevLighness = lightness;\n            ratio = stop * ratioStep;\n            lightness = 100 - 50 * ratio;\n            gradient.addColorStop(\n              ratio,\n              `hsl(${angle}, 100%, ${prevLighness}%)`\n            );\n            gradient.addColorStop(ratio, `hsl(${angle}, 100%, ${lightness}%)`);\n          }\n          gradient.addColorStop(ratio, `hsl(${angle}, 100%, 50%)`);\n        }\n        // last gradient stop\n        gradient.addColorStop(1, `hsl(${angle}, 100%, 50%)`);\n\n        context.fillStyle = gradient;\n        context.fill();\n      }\n    }\n\n    function drawShadow() {\n      context.save();\n      context.beginPath();\n      context.arc(cX, cY, shadowRadius, 0, 2 * Math.PI, false);\n      context.shadowColor = shadowColor;\n      context.shadowOffsetX = shadowOffsetX;\n      context.shadowOffsetY = shadowOffsetY;\n      context.shadowBlur = shadowBlur;\n      context.fillStyle = \"white\";\n      context.fill();\n      context.restore();\n    }\n\n    function drawBorder() {\n      context.beginPath();\n      context.arc(cX, cY, borderRadius, 0, 2 * Math.PI, false);\n      context.lineWidth = borderWidth;\n      context.strokeStyle = borderColor;\n      context.stroke();\n    }\n\n    /*\n     *   Call the drawing functions\n     *   draws the shadow, wheel and border\n     */\n    if (wheelStyle.shadow !== \"none\") {\n      drawShadow();\n    }\n    drawCircle(this.hueSegments, this.saturationSegments);\n    if (borderWidth > 0) {\n      drawBorder();\n    }\n  }\n\n  /*\n   *   Draw the (draggable) marker and tooltip\n   *   on the interactionLayer)\n   */\n\n  drawMarker() {\n    const svgElement = this.interactionLayer;\n    const markerradius = this.radius * 0.08;\n    const tooltipradius = this.radius * 0.15;\n    const TooltipOffsetY = -(tooltipradius * 3);\n    const TooltipOffsetX = 0;\n\n    svgElement.marker = document.createElementNS(\n      \"http://www.w3.org/2000/svg\",\n      \"circle\"\n    );\n    svgElement.marker.setAttribute(\"id\", \"marker\");\n    svgElement.marker.setAttribute(\"r\", markerradius);\n    this.marker = svgElement.marker;\n    svgElement.appendChild(svgElement.marker);\n\n    svgElement.tooltip = document.createElementNS(\n      \"http://www.w3.org/2000/svg\",\n      \"circle\"\n    );\n    svgElement.tooltip.setAttribute(\"id\", \"colorTooltip\");\n    svgElement.tooltip.setAttribute(\"r\", tooltipradius);\n    svgElement.tooltip.setAttribute(\"cx\", TooltipOffsetX);\n    svgElement.tooltip.setAttribute(\"cy\", TooltipOffsetY);\n    this.tooltip = svgElement.tooltip;\n    svgElement.appendChild(svgElement.tooltip);\n  }\n\n  segmentationChange() {\n    if (this.backgroundLayer) {\n      this.drawColorWheel();\n    }\n  }\n}\n\nexport default LmeColorPicker;\n\n"
  },
  {
    "path": "src/color-wheel/convert-color.js",
    "content": "export const rgb2hsv = (rgb) => {\n  const [r, g, b] = rgb;\n  const v = Math.max(r, g, b);\n  const c = v - Math.min(r, g, b);\n  const h =\n    c && (v === r ? (g - b) / c : v === g ? 2 + (b - r) / c : 4 + (r - g) / c);\n  return [60 * (h < 0 ? h + 6 : h), v && c / v, v];\n};\n\nexport const hsv2rgb = (hsv) => {\n  const [h, s, v] = hsv;\n  const f = (n) => {\n    const k = (n + h / 60) % 6;\n    return v - v * s * Math.max(Math.min(k, 4 - k, 1), 0);\n  };\n  return [f(5), f(3), f(1)];\n};\n\nexport const rgb2hs = (rgb) => rgb2hsv(rgb).slice(0, 2);\n\nexport const hs2rgb = (hs) => hsv2rgb([hs[0], hs[1], 255]);\n"
  },
  {
    "path": "src/color-wheel/events-mixin.js",
    "content": "import { dedupingMixin } from \"@polymer/polymer/lib/utils/mixin\";\nimport { fireEvent } from \"./fire_event\";\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\n/* @polymerMixin */\nexport const EventsMixin = dedupingMixin(\n  (superClass) =>\n    class 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        options = options || {};\n        return fireEvent(options.node || this, type, detail, options);\n      }\n    }\n);\n"
  },
  {
    "path": "src/color-wheel/fire_event.js",
    "content": "// 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\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 */\nexport const fireEvent = (\n  node,\n  type,\n  detail,\n  options\n) => {\n  options = options || {};\n\n  detail = detail === null || detail === undefined ? {} : detail;\n\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\n  event.detail = detail;\n  node.dispatchEvent(event);\n  return event;\n};\n"
  },
  {
    "path": "src/defaults.js",
    "content": "export default {\n  shorten_cards: false,\n  consolidate_entities: false,\n  child_card: false,\n  hide_header: false,\n  show_header_icon: false,\n  header: '',\n\n  persist_features: false,\n  brightness: true,\n  color_temp: true,\n  white_value: true,\n  warm_white_value: true,\n  color_picker: true,\n  effects_list: true,\n  speed: true,\n  intensity: true,\n\n  force_features: false,\n\n  show_slider_percent: false,\n  full_width_sliders: false,\n  color_temp_in_kelvin: false,\n  transition: 0,\n\n  brightness_icon: 'weather-sunny',\n  white_icon: 'file-word-box',\n  warm_white_icon: 'weather-sunset',\n  temperature_icon: 'thermometer',\n  speed_icon: 'speedometer',\n  intensity_icon: 'transit-connection-horizontal',\n};\n"
  },
  {
    "path": "src/globalElementLoader.js",
    "content": "const globalElementLoader = name => ({\n  name,\n  promise: customElements.whenDefined(name).then(() => customElements.get(name)),\n});\n\nexport default globalElementLoader;\n"
  },
  {
    "path": "src/index-editor.js",
    "content": "import { LitElement, html } from 'lit';\nimport { ScopedRegistryHost } from '@lit-labs/scoped-registry-mixin';\nimport style from './style-editor';\nimport defaultConfig from './defaults';\nimport buildElementDefinitions from './buildElementDefinitions';\nimport globalElementLoader from './globalElementLoader';\n\nexport const fireEvent = (node, 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\n  event.detail = detail;\n  node.dispatchEvent(event);\n  return event;\n};\n\nexport default class LightEntityCardEditor extends ScopedRegistryHost(LitElement) {\n  static get elementDefinitions() {\n    return buildElementDefinitions([\n      globalElementLoader('ha-checkbox'),\n      globalElementLoader('ha-formfield'),\n      globalElementLoader('ha-form-string'),\n      globalElementLoader('ha-entity-picker'),\n    ], LightEntityCardEditor);\n  }\n\n  static get styles() {\n    return style;\n  }\n\n  static get properties() {\n    return { hass: {}, _config: {} };\n  }\n\n  setConfig(config) {\n    this._config = {\n      ...defaultConfig,\n      ...config,\n    };\n  }\n\n  get entityDomains() {\n    return ['switch', 'light', 'group'];\n  }\n\n  firstUpdated() {\n    this._firstRendered = true;\n  }\n\n  render() {\n    if (!this.hass || !this._config) {\n      return html``;\n    }\n\n    // get header name\n    let { header } = this._config;\n    if (!header && this._config.entity) {\n      let name = this._config.entity.split('.')[1] || '';\n      if (name) {\n        name = name.charAt(0).toUpperCase() + name.slice(1);\n        header = name;\n      }\n    }\n\n    return html`\n      <div class=\"card-config\">\n\n        <div class=overall-config'>\n          <ha-form-string\n            .schema=${{ name: 'header', type: 'string' }}\n            label=\"Header\"\n            .data=\"${header}\"\n            .configValue=\"${'header'}\"\n            @changed=\"${this.configChanged}\"\n          ></ha-form-string>\n        </div>\n\n        <div class='entities'>\n          <ha-entity-picker\n            .hass=${this.hass}\n            .value=${this._config.entity}\n            .includeDomains=${this.entityDomains}\n            label=\"Entity\"\n            @value-changed=${this.entityChanged}\n            allow-custom-entity\n          ></ha-entity-picker>\n          <ha-form-string\n            .schema=${{ name: 'brightness_icon', type: 'string' }}\n            label=\"Brightness Icon\"\n            .data=\"${this._config.brightness_icon}\"\n            .configValue=\"${'brightness_icon'}\"\n            @changed=\"${this.configChanged}\"\n          ></ha-form-string>\n        </div>\n\n        <div class='entities'>\n         <ha-form-string\n           .schema=${{ name: 'white_icon', type: 'string' }}\n           label=\"White Icon\"\n            .data=\"${this._config.white_icon}\"\n            .configValue=\"${'white_icon'}\"\n            @changed=\"${this.configChanged}\"\n          ></ha-form-string>\n          <ha-form-string\n            .schema=${{ name: 'warm_white_icon', type: 'string' }}\n            label=\"Warm White Icon\"\n            .data=\"${this._config.warm_white_icon}\"\n            .configValue=\"${'warm_white_icon'}\"\n            @changed=\"${this.configChanged}\"\n          ></ha-form-string>\n        </div>\n\n        <div class='entities'>\n          <ha-form-string\n            .schema=${{ name: 'temperature_icon', type: 'string' }}\n            label=\"Temperature Icon\"\n            .data=\"${this._config.temperature_icon}\"\n            .configValue=\"${'temperature_icon'}\"\n            @changed=\"${this.configChanged}\"\n          ></ha-form-string>\n          <ha-form-string\n            .schema=${{ name: 'transition', type: 'string' }}\n            label=\"Transition (seconds)\"\n            .data=\"${String(this._config.transition || '')}\"\n            .configValue=\"${'transition'}\"\n            @changed=\"${this.configChanged}\"\n          ></ha-form-string>\n        </div>\n\n        <div class='overall-config'>\n          <div class='checkbox-options'>\n            <ha-formfield label=\"Shorten Cards\">\n              <ha-checkbox\n                @change=\"${this.checkboxConfigChanged}\"\n                .checked=${this._config.shorten_cards}\n                .value=\"${'shorten_cards'}\"\n              ></ha-checkbox>\n            </ha-formfield>\n            </div>\n\n            <div class='checkbox-options'>\n              <ha-formfield label=\"Persist Features\">\n                <ha-checkbox\n                  @change=\"${this.checkboxConfigChanged}\"\n                  .checked=${this._config.persist_features}\n                  .value=\"${'persist_features'}\"\n                ></ha-checkbox>\n              </ha-formfield>\n              <ha-formfield label=\"Show Brightness\">\n                <ha-checkbox\n                  @change=\"${this.checkboxConfigChanged}\"\n                  .checked=${this._config.brightness}\n                  .value=\"${'brightness'}\"\n                ></ha-checkbox>\n              </ha-formfield>\n            </div>\n\n            <div class='checkbox-options'>\n              <ha-formfield label=\"Show Color Temp\">\n                <ha-checkbox\n                  @change=\"${this.checkboxConfigChanged}\"\n                  .checked=${this._config.color_temp}\n                  .value=\"${'color_temp'}\"\n                ></ha-checkbox>\n              </ha-formfield>\n              <ha-formfield label=\"Color Temp in Kelvin\">\n                <ha-checkbox\n                  @change=\"${this.checkboxConfigChanged}\"\n                  .checked=${this._config.color_temp_in_kelvin}\n                  .value=\"${'color_temp_in_kelvin'}\"\n                ></ha-checkbox>\n              </ha-formfield>\n            </div>\n\n            <div class='checkbox-options'>\n              <ha-formfield label=\"Show White Channel\">\n                <ha-checkbox\n                  @change=\"${this.checkboxConfigChanged}\"\n                  .checked=${this._config.white_value}\n                  .value=\"${'white_value'}\"\n                ></ha-checkbox>\n              </ha-formfield>\n            </div>\n\n            <div class='checkbox-options'>\n              <ha-formfield label=\"Show Warm White\">\n                <ha-checkbox\n                  @change=\"${this.checkboxConfigChanged}\"\n                  .checked=${this._config.warm_white_value}\n                  .value=\"${'warm_white_value'}\"\n                ></ha-checkbox>\n              </ha-formfield>\n            </div>\n\n            <div class='checkbox-options'>\n              <ha-formfield label=\"Show Speed\">\n                <ha-checkbox\n                  @change=\"${this.checkboxConfigChanged}\"\n                  .checked=${this._config.speed}\n                  .value=\"${'speed'}\"\n                ></ha-checkbox>\n              </ha-formfield>\n              <ha-formfield label=\"Show Intensity\">\n                <ha-checkbox\n                  @change=\"${this.checkboxConfigChanged}\"\n                  .checked=${this._config.intensity}\n                  .value=\"${'intensity'}\"\n                ></ha-checkbox>\n              </ha-formfield>\n            </div>\n\n            <div class='checkbox-options'>\n              <ha-formfield label=\"Show Color Picker\">\n                <ha-checkbox\n                  @change=\"${this.checkboxConfigChanged}\"\n                  .checked=${this._config.color_picker}\n                  .value=\"${'color_picker'}\"\n                ></ha-checkbox>\n              </ha-formfield>\n              <ha-formfield label=\"Show Effects List\">\n                <ha-checkbox\n                  @change=\"${this.checkboxConfigChanged}\"\n                  .checked=${this._config.effects_list}\n                  .value=\"${'effects_list'}\"\n                ></ha-checkbox>\n              </ha-formfield>\n            </div>\n\n            <div class='checkbox-options'>\n              <ha-formfield label=\"Full Width Sliders\">\n                <ha-checkbox\n                  @change=\"${this.checkboxConfigChanged}\"\n                  .checked=${this._config.full_width_sliders}\n                  .value=\"${'full_width_sliders'}\"\n                ></ha-checkbox>\n              </ha-formfield>\n              <ha-formfield label=\"Show Slider Percent\">\n                <ha-checkbox\n                  @change=\"${this.checkboxConfigChanged}\"\n                  .checked=${this._config.show_slider_percent}\n                  .value=\"${'show_slider_percent'}\"\n                ></ha-checkbox>\n              </ha-formfield>\n            </div>\n\n            <div class='checkbox-options'>\n              <ha-formfield label=\"Show Brightness %\">\n                <ha-checkbox\n                  @change=\"${this.checkboxConfigChanged}\"\n                  .checked=${this._config.show_brightness_percent}\n                  .value=\"${'show_brightness_percent'}\"\n                ></ha-checkbox>\n              </ha-formfield>\n              <ha-formfield label=\"Show Color Temp %\">\n                <ha-checkbox\n                  @change=\"${this.checkboxConfigChanged}\"\n                  .checked=${this._config.show_color_temp_percent}\n                  .value=\"${'show_color_temp_percent'}\"\n                ></ha-checkbox>\n              </ha-formfield>\n            </div>\n\n            <div class='checkbox-options'>\n              <ha-formfield label=\"Hide Header\">\n                <ha-checkbox\n                  @change=\"${this.checkboxConfigChanged}\"\n                  .checked=${this._config.hide_header}\n                  .value=\"${'hide_header'}\"\n                ></ha-checkbox>\n              </ha-formfield>\n              <ha-formfield label=\"Show Header Icon\">\n                <ha-checkbox\n                  @change=\"${this.checkboxConfigChanged}\"\n                  .checked=${this._config.show_header_icon}\n                  .value=\"${'show_header_icon'}\"\n                ></ha-checkbox>\n              </ha-formfield>\n              <ha-formfield label=\"Child Card\">\n                <ha-checkbox\n                  @change=\"${this.checkboxConfigChanged}\"\n                  .checked=${this._config.child_card}\n                  .value=\"${'child_card'}\"\n                ></ha-checkbox>\n              </ha-formfield>\n            </div>\n\n            <div class='checkbox-options'>\n              <ha-formfield label=\"Force Features\">\n                <ha-checkbox\n                  @change=\"${this.checkboxConfigChanged}\"\n                  .checked=${this._config.force_features}\n                  .value=\"${'force_features'}\"\n                ></ha-checkbox>\n              </ha-formfield>\n            </div>\n\n            <div class='checkbox-options'>\n            <ha-formfield label=\"Consolidate Entities\">\n              <ha-checkbox\n                @change=\"${this.checkboxConfigChanged}\"\n                .checked=${this._config.consolidate_entities}\n                .value=\"${'consolidate_entities'}\"\n              ></ha-checkbox>\n            </ha-formfield>\n          </div>\n          </div>\n      </div>\n    `;\n  }\n\n  entityChanged(ev) {\n    if (!this._config || !this.hass || !this._firstRendered) return;\n    const entity = ev.detail.value;\n    if (entity === this._config.entity) return;\n    this._config = { ...this._config, entity };\n    fireEvent(this, 'config-changed', { config: this._config });\n  }\n\n  configChanged(ev) {\n    if (!this._config || !this.hass || !this._firstRendered) return;\n    const {\n      target: { configValue, value },\n      detail: { value: checkedValue },\n    } = ev;\n\n    if (checkedValue !== undefined && checkedValue !== null) {\n      this._config = { ...this._config, [configValue]: checkedValue };\n    } else {\n      this._config = { ...this._config, [configValue]: value };\n    }\n\n    fireEvent(this, 'config-changed', { config: this._config });\n  }\n\n  checkboxConfigChanged(ev) {\n    if (!this._config || !this.hass || !this._firstRendered) return;\n    const {\n      target: { value, checked },\n    } = ev;\n\n    this._config = { ...this._config, [value]: checked };\n\n    fireEvent(this, 'config-changed', { config: this._config });\n  }\n}\n"
  },
  {
    "path": "src/index.js",
    "content": "import { LitElement, html } from 'lit';\n\nimport { ScopedRegistryHost } from '@lit-labs/scoped-registry-mixin';\n\nimport style from './style';\nimport defaultConfig from './defaults';\nimport LightEntityCardEditor from './index-editor';\nimport packageJson from '../package.json';\nimport buildElementDefinitions from './buildElementDefinitions';\nimport globalElementLoader from './globalElementLoader';\n\nconst editorName = 'light-entity-card-editor';\ncustomElements.define(editorName, LightEntityCardEditor);\n\nconsole.info(`light-entity-card v${packageJson.version}`);\n\nclass LightEntityCard extends ScopedRegistryHost(LitElement) {\n  static get elementDefinitions() {\n    return buildElementDefinitions(\n      [\n        globalElementLoader('ha-card'),\n        globalElementLoader('more-info-light'),\n        globalElementLoader('ha-switch'),\n        globalElementLoader('ha-icon'),\n        globalElementLoader('state-badge'),\n        globalElementLoader('ha-slider'),\n        globalElementLoader('ha-hs-color-picker'),\n        globalElementLoader('ha-select'),\n        globalElementLoader('mwc-list-item'),\n      ],\n      LightEntityCard\n    );\n  }\n  \n  static get properties() {\n    return {\n      hass: {},\n      config: {},\n      _colorPickerValues: { state: true },\n    };\n  }\n\n  async firstUpdated() {\n    this._firstUpdate = true;\n\n    // ha-hs-color-picker is lazy-loaded by HA (only when more-info dialog opens).\n    // Force it to load by opening a more-info dialog hidden via CSS, then closing it.\n    const needsColorPicker = this.config.color_picker !== false\n      && this.config.entity.startsWith('light.');\n    if (needsColorPicker && !customElements.get('ha-hs-color-picker')) {\n      const ha = document.querySelector('home-assistant');\n      if (ha) {\n        // Hide the dialog to prevent visible flash\n        const hideStyle = document.createElement('style');\n        hideStyle.textContent = 'ha-more-info-dialog { display: none !important; }';\n        ha.shadowRoot.appendChild(hideStyle);\n\n        const ev = new CustomEvent('hass-more-info', {\n          detail: { entityId: this.config.entity },\n          bubbles: true, composed: true,\n        });\n        ha.dispatchEvent(ev);\n\n        try {\n          await Promise.race([\n            customElements.whenDefined('ha-hs-color-picker'),\n            new Promise((_, reject) => setTimeout(() => reject(new Error('timeout')), 5000)),\n          ]);\n        } catch (e) {\n          // Timed out — color picker element not available, continue gracefully\n        } finally {\n          // Always close the hidden dialog and remove the style\n          const closeEv = new CustomEvent('hass-more-info', {\n            detail: { entityId: '' },\n            bubbles: true, composed: true,\n          });\n          ha.dispatchEvent(closeEv);\n          hideStyle.remove();\n        }\n      }\n      this.requestUpdate();\n    }\n  }\n\n  /**\n   * checks and saves config of entity\n   * @param {*} config\n   */\n  setConfig(config) {\n    if (!config.entity) throw Error('entity required.');\n\n    this.config = {\n      ...defaultConfig,\n      ...config,\n    };\n  }\n\n  static async getConfigElement() {\n    // eslint-disable-next-line no-undef\n    return document.createElement(editorName);\n  }\n\n  static get featureNames() {\n    return {\n      brightness: 1,\n      colorTemp: 2,\n      effectList: 4,\n      color: 16,\n      whiteValue: 128,\n    };\n  }\n\n  static get cmdToggle() {\n    return {\n      on: 'turn_on',\n      off: 'turn_off',\n    };\n  }\n\n  static get entityLength() {\n    return {\n      light: 10,\n      switch: 1,\n    };\n  }\n\n  /**\n   * get the current size of the card\n   * @return {Number}\n   */\n  getCardSize() {\n    if (!this.config || !this.__hass || !this.__hass.states[this.config.entity]) {\n      return 1;\n    }\n\n    let cardLength = 0;\n    const entities = this.__hass.states[this.config.entity];\n\n    // if given a group entity then sum length of each entity by type\n    // else just get the sible entity length\n    if (Array.isArray(entities.attributes.entity_id)) {\n      entities.attributes.entity_id.forEach(entity_id => (cardLength += this.getEntityLength(entity_id)));\n    } else {\n      cardLength += this.getEntityLength(entities.attributes.entity_id);\n    }\n\n    // if we are compacting the card account for that\n    if (this.config.group) {\n      cardLength *= 0.8;\n    }\n\n    return parseInt(cardLength, 10);\n  }\n\n  /**\n   * determines the UI length of an entity\n   * @param {string} entity_id\n   */\n  getEntityLength(entity_id) {\n    if (/^light\\./.test(entity_id)) {\n      return LightEntityCard.entityLength.light;\n    } else if (/^switch\\./.test(entity_id)) {\n      return LightEntityCard.entityLength.switch;\n    } else {\n      return 0;\n    }\n  }\n\n  /**\n   * generates the CSS styles for this card\n   * @return {TemplateResult}\n   */\n  get styles() {\n    return style;\n  }\n\n\n  /**\n   * check if the given entity is on or off\n   * @param {LightEntity} stateObj\n   * @return {Boolean}\n   */\n  isEntityOn(stateObj) {\n    return stateObj.state === 'on';\n  }\n\n  /**\n   * generates a card for each given entiy in the config\n   * @return {TemplateResult}\n   */\n  render() {\n    const entity = this.hass.states[this.config.entity];\n    if (!entity) {\n      return html`\n        <style>\n          ${this.styles}\n        </style>\n        <ha-card> ${`Invalid entity: ${this.config.entity}`} </ha-card>\n      `;\n    }\n\n    this._stateObjects = this.getEntitiesToShow(entity);\n\n    // need to find what state objects are actually going to be shown\n    if (this.config.consolidate_entities) {\n      this._shownStateObjects = [entity];\n    } else {\n      this._shownStateObjects = [...this._stateObjects];\n    }\n\n    const templates = this._shownStateObjects.reduce(\n      (htmlTemplate, stateObj) => html`${htmlTemplate}${this.createEntityTemplate(stateObj)}`,\n      // eslint-disable-next-line comma-dangle\n      ''\n    );\n\n    const css = `light-entity-card ${this.config.shorten_cards ? ' group' : ''} ${\n      this.config.child_card ? ' light-entity-child-card' : ''\n    }`;\n\n    return html`\n      <style>\n        ${this.styles}\n      </style>\n      <ha-card class=\"${css}\">\n        ${templates}\n      </ha-card>\n    `;\n  }\n\n  /**\n   * gets all the entities we need to build this card for\n   * @param {LightEntity|GroupEntity} entities\n   * @return {Array<LightEntity>}\n   */\n  getEntitiesToShow(entities) {\n    if (entities.attributes.entity_id && Array.isArray(entities.attributes.entity_id))\n      return entities.attributes.entity_id.map(entity_id => this.hass.states[entity_id]).filter(Boolean);\n\n    return [entities];\n  }\n\n  /**\n   * creates an entity's template\n   * @param {LightEntity} stateObj\n   * @return {TemplateResult}\n   */\n  createEntityTemplate(stateObj) {\n    const sliderClass = this.config.full_width_sliders ? 'ha-slider-full-width' : '';\n\n    return html`\n      ${this.createHeader(stateObj)}\n      <div class=\"light-entity-card-sliders ${sliderClass}\">\n        ${this.createBrightnessSlider(stateObj)} ${this.createSpeedSlider(stateObj)}\n        ${this.createIntensitySlider(stateObj)} ${this.createColorTemperature(stateObj)}\n        ${this.createWhiteValue(stateObj)}\n        ${this.createWarmWhiteValue(stateObj)}\n      </div>\n      ${this.createColorPicker(stateObj)} ${this.createEffectList(stateObj)}\n    `;\n  }\n\n  /**\n   * creates card header with state toggle for a given entity\n   * @param {LightEntity} stateObj\n   * @return {TemplateResult}\n   */\n  createHeader(stateObj) {\n    if (this.config.hide_header) return html``;\n    const title = this.config.header || stateObj.attributes.friendly_name || stateObj.entity_id;\n\n    return html`\n      <div class=\"light-entity-card__header\">\n        ${this.showHeaderIcon(stateObj)}\n        <div class=\"light-entity-card__title\">${title}</div>\n        <div class=\"light-entity-card-toggle\">\n          <ha-switch .checked=${this.isEntityOn(stateObj)} @change=${e => this.setToggle(e, stateObj)}></ha-switch>\n        </div>\n      </div>\n    `;\n  }\n\n  showHeaderIcon(stateObj) {\n    if (!this.config.show_header_icon) return html``;\n\n    return html`\n      <div class=\"icon-container\">\n        <state-badge .stateObj=${stateObj}></state-badge>\n      </div>\n    `;\n  }\n\n  /**\n   * creates brightness slider\n   * @param {LightEntity} stateObj\n   * @return {TemplateResult}\n   */\n  createBrightnessSlider(stateObj) {\n    if (this.config.brightness === false) return html``;\n    if (this.dontShowFeature('brightness', stateObj)) return html``;\n\n    return html`\n      <div class=\"control light-entity-card-center\">\n        <div class=\"icon-container\" title=\"Brightness\">\n          <ha-icon icon=\"hass:${this.config.brightness_icon}\"></ha-icon>\n        </div>\n        <ha-slider\n          .value=\"${stateObj.attributes.brightness || 0}\"\n          @change=\"${event => this._setValue(event, stateObj, 'brightness')}\"\n          min=\"1\"\n          max=\"255\"\n        ></ha-slider>\n        ${this.showPercent(stateObj.attributes.brightness, 0, 254, 'brightness')}\n      </div>\n    `;\n  }\n\n  /**\n   * creates speed slider\n   * @param {LightEntity} stateObj\n   * @return {TemplateResult}\n   */\n  createSpeedSlider(stateObj) {\n    if (this.config.speed === false) return html``;\n    if (this.dontShowFeature('speed', stateObj)) return html``;\n\n    return html`\n      <div class=\"control light-entity-card-center\">\n        <div class=\"icon-container\" title=\"Speed\">\n          <ha-icon icon=\"hass:${this.config.speed_icon}\"></ha-icon>\n        </div>\n        <ha-slider\n          .value=\"${stateObj.attributes.speed || 0}\"\n          @change=\"${event => this._setValue(event, stateObj, 'speed')}\"\n          min=\"1\"\n          max=\"255\"\n        ></ha-slider>\n        ${this.showPercent(stateObj.attributes.speed, 0, 254)}\n      </div>\n    `;\n  }\n\n  /**\n   * creates intensity slider\n   * @param {LightEntity} stateObj\n   * @return {TemplateResult}\n   */\n  createIntensitySlider(stateObj) {\n    if (this.config.intensity === false) return html``;\n    if (this.dontShowFeature('intensity', stateObj)) return html``;\n\n    return html`\n      <div class=\"control light-entity-card-center\">\n        <div class=\"icon-container\" title=\"Intensity\">\n          <ha-icon icon=\"hass:${this.config.intensity_icon}\"></ha-icon>\n        </div>\n        <ha-slider\n          .value=\"${stateObj.attributes.intensity || 0}\"\n          @change=\"${event => this._setValue(event, stateObj, 'intensity')}\"\n          min=\"1\"\n          max=\"255\"\n        ></ha-slider>\n        ${this.showPercent(stateObj.attributes.intensity, 0, 254)}\n      </div>\n    `;\n  }\n\n  /**\n   * shows slider value label if config is set\n   * @param {number} value\n   * @param {number} min\n   * @param {number} max\n   * @param {string} [sliderType] - 'brightness' or 'color_temp' for per-slider overrides\n   * @return {TemplateResult}\n   */\n  showPercent(value, min, max, sliderType) {\n    // Per-slider visibility overrides\n    if (sliderType === 'brightness' && this.config.show_brightness_percent !== undefined) {\n      if (!this.config.show_brightness_percent) return html``;\n    } else if (sliderType === 'color_temp' && this.config.show_color_temp_percent !== undefined) {\n      if (!this.config.show_color_temp_percent) return html``;\n    } else if (sliderType === 'color_temp' && this.config.color_temp_in_kelvin) {\n      // color_temp_in_kelvin implies showing the value label\n    } else if (!this.config.show_slider_percent) {\n      return html``;\n    }\n\n    // Show kelvin for color temp if configured (slider value is already in kelvin)\n    if (sliderType === 'color_temp' && this.config.color_temp_in_kelvin) {\n      return html` <div class=\"percent-slider\">${value}K</div> `;\n    }\n\n    let percent = parseInt(((value - min) * 100) / (max - min), 10);\n    if (isNaN(percent)) percent = 0;\n\n    return html` <div class=\"percent-slider\">${percent}%</div> `;\n  }\n\n  /**\n   * creates color temperature slider for a given entity\n   * @param {LightEntity} stateObj\n   * @return {TemplateResult}\n   */\n  createColorTemperature(stateObj) {\n    if (this.config.color_temp === false) return html``;\n    if (this.dontShowFeature('colorTemp', stateObj)) return html``;\n\n    // HA 2026.3+ uses kelvin-based attributes; fall back to mireds for older HA\n    const usesKelvin = stateObj.attributes.min_color_temp_kelvin !== undefined;\n    const showInKelvin = this.config.color_temp_in_kelvin;\n\n    let currentTemp, minTemp, maxTemp;\n    if (showInKelvin) {\n      // Slider works in kelvin so the native popup shows kelvin values.\n      // Kelvin: low=warm, high=cool — slider left=warm, right=cool.\n      let minK, maxK, kelvin;\n      if (usesKelvin) {\n        kelvin = stateObj.attributes.color_temp_kelvin;\n        minK = stateObj.attributes.min_color_temp_kelvin;\n        maxK = stateObj.attributes.max_color_temp_kelvin;\n      } else {\n        kelvin = stateObj.attributes.color_temp\n          ? Math.round(1000000 / stateObj.attributes.color_temp) : null;\n        minK = stateObj.attributes.max_mireds\n          ? Math.round(1000000 / stateObj.attributes.max_mireds) : null;\n        maxK = stateObj.attributes.min_mireds\n          ? Math.round(1000000 / stateObj.attributes.min_mireds) : null;\n      }\n      if (!minK || !maxK) return html``;\n      const midpoint = Math.round((minK + maxK) / 2);\n      currentTemp = (typeof kelvin === 'number' && Number.isFinite(kelvin) && kelvin > 0)\n        ? kelvin : null;\n      minTemp = minK;\n      maxTemp = maxK;\n      const sliderValue = currentTemp || midpoint;\n      const label = this.showPercent(sliderValue, minTemp, maxTemp, 'color_temp');\n\n      return html`\n        <div class=\"control light-entity-card-center\">\n          <div class=\"icon-container\" title=\"Color Temperature\">\n            <ha-icon icon=\"hass:${this.config.temperature_icon}\"></ha-icon>\n          </div>\n          <ha-slider\n            class=\"light-entity-card-color_temp light-entity-card-color_temp--kelvin\"\n            min=\"${minTemp}\"\n            max=\"${maxTemp}\"\n            .value=${sliderValue}\n            @change=\"${event => this._setColorTemp(event, stateObj, usesKelvin, true)}\"\n          >\n          </ha-slider>\n          ${label}\n        </div>\n      `;\n    }\n\n    // Compute mired range for percentage-based slider.\n    // Slider works in 0–100 so the native popup shows a percentage value.\n    let minMired, maxMired, currentMired;\n    if (usesKelvin) {\n      const kelvin = stateObj.attributes.color_temp_kelvin;\n      const minK = stateObj.attributes.min_color_temp_kelvin;\n      const maxK = stateObj.attributes.max_color_temp_kelvin;\n      if (!minK || !maxK) return html``;\n      currentMired = (typeof kelvin === 'number' && Number.isFinite(kelvin) && kelvin > 0)\n        ? Math.round(1000000 / kelvin) : null;\n      minMired = Math.round(1000000 / maxK);\n      maxMired = Math.round(1000000 / minK);\n    } else {\n      currentMired = stateObj.attributes.color_temp;\n      minMired = stateObj.attributes.min_mireds;\n      maxMired = stateObj.attributes.max_mireds;\n      if (!minMired || !maxMired) return html``;\n    }\n\n    const miredRange = (maxMired && minMired) ? maxMired - minMired : 0;\n    const percentValue = (miredRange > 0 && currentMired != null)\n      ? Math.round(((currentMired - minMired) / miredRange) * 100) : 50;\n    const label = this.showPercent(percentValue, 0, 100, 'color_temp');\n\n    return html`\n      <div class=\"control light-entity-card-center\">\n        <div class=\"icon-container\" title=\"Color Temperature\">\n          <ha-icon icon=\"hass:${this.config.temperature_icon}\"></ha-icon>\n        </div>\n        <ha-slider\n          class=\"light-entity-card-color_temp\"\n          min=\"0\"\n          max=\"100\"\n          .value=${percentValue}\n          @change=\"${event => this._setColorTemp(event, stateObj, usesKelvin, false, minMired, maxMired)}\"\n        >\n        </ha-slider>\n        ${label}\n      </div>\n    `;\n  }\n\n  /**\n   * gets the current white value from entity state\n   * supports modern rgbw_color/rgbww_color and legacy white_value\n   * @param {LightEntity} stateObj\n   * @param {number} index - index in the color tuple (3 for white/cool white, 4 for warm white)\n   * @return {number}\n   */\n  getWhiteValue(stateObj, index = 3) {\n    const rgbwColor = stateObj.attributes.rgbw_color;\n    const rgbwwColor = stateObj.attributes.rgbww_color;\n\n    if (rgbwColor && index === 3) return rgbwColor[3] || 0;\n    if (rgbwwColor && index < rgbwwColor.length) return rgbwwColor[index] || 0;\n\n    // Legacy fallback\n    if (index === 3 && stateObj.attributes.white_value !== undefined) {\n      return stateObj.attributes.white_value ?? 0;\n    }\n\n    return 0;\n  }\n\n  /**\n   * creates white value slider for a given entity\n   * supports modern RGBW/RGBWW color modes and legacy white_value\n   * @param {LightEntity} stateObj\n   * @return {TemplateResult}\n   */\n  createWhiteValue(stateObj) {\n    if (this.config.white_value === false) return html``;\n    if (this.dontShowFeature('whiteValue', stateObj)) return html``;\n\n    const whiteValue = this.getWhiteValue(stateObj, 3);\n\n    return html`\n      <div class=\"control light-entity-card-center\">\n        <div class=\"icon-container\" title=\"White\">\n          <ha-icon icon=\"hass:${this.config.white_icon}\"></ha-icon>\n        </div>\n        <ha-slider\n          max=\"255\"\n          .value=\"${whiteValue}\"\n          @change=\"${event => this._setWhiteValue(event, stateObj, 3)}\"\n        >\n        </ha-slider>\n        ${this.showPercent(whiteValue, 0, 254)}\n      </div>\n    `;\n  }\n\n  /**\n   * creates warm white value slider for RGBWW entities\n   * @param {LightEntity} stateObj\n   * @return {TemplateResult}\n   */\n  createWarmWhiteValue(stateObj) {\n    if (this.config.warm_white_value === false) return html``;\n    if (this.dontShowFeature('warmWhiteValue', stateObj)) return html``;\n\n    const warmWhiteValue = this.getWhiteValue(stateObj, 4);\n\n    return html`\n      <div class=\"control light-entity-card-center\">\n        <div class=\"icon-container\" title=\"Warm White\">\n          <ha-icon icon=\"hass:${this.config.warm_white_icon}\"></ha-icon>\n        </div>\n        <ha-slider\n          max=\"255\"\n          .value=\"${warmWhiteValue}\"\n          @change=\"${event => this._setWhiteValue(event, stateObj, 4)}\"\n        >\n        </ha-slider>\n        ${this.showPercent(warmWhiteValue, 0, 254)}\n      </div>\n    `;\n  }\n\n  /**\n   * sets the white value for RGBW/RGBWW lights using modern color mode API\n   * falls back to legacy white_value for older HA installations\n   * @param {CustomEvent} event\n   * @param {LightEntity} stateObj\n   * @param {number} index - 3 for white/cool white, 4 for warm white\n   */\n  _setWhiteValue(event, stateObj, index) {\n    const newValue = parseInt(event.target.value, 10);\n    if (isNaN(newValue)) return;\n\n    const colorModes = stateObj.attributes.supported_color_modes || [];\n    const rgbwColor = stateObj.attributes.rgbw_color;\n    const rgbwwColor = stateObj.attributes.rgbww_color;\n\n    if (colorModes.includes('rgbw') && index === 3) {\n      const rgb = rgbwColor ? rgbwColor.slice(0, 3) : (stateObj.attributes.rgb_color || [255, 255, 255]);\n      this.callEntityService({ rgbw_color: [rgb[0], rgb[1], rgb[2], newValue] }, stateObj);\n    } else if (colorModes.includes('rgbww')) {\n      let base;\n      if (rgbwwColor) {\n        base = rgbwwColor;\n      } else if (rgbwColor) {\n        base = [rgbwColor[0], rgbwColor[1], rgbwColor[2], rgbwColor[3], 0];\n      } else {\n        const rgb = stateObj.attributes.rgb_color || [255, 255, 255];\n        base = [rgb[0], rgb[1], rgb[2], 0, 0];\n      }\n      const newColor = [...base];\n      newColor[index] = newValue;\n      this.callEntityService({ rgbww_color: newColor }, stateObj);\n    } else {\n      // Legacy fallback\n      this.callEntityService({ white_value: newValue }, stateObj);\n    }\n  }\n\n  /**\n   * creates effect list dropdown for a given entity\n   * @param {LightEntity} stateObj\n   * @return {TemplateResult}\n   */\n  createEffectList(stateObj) {\n    // do we disable effect list always?\n    if (this.config.effects_list === false) return html``;\n\n    // need to check state and persist_features here because if given custom effect list we may\n    // want to sho that even if the feature doesn't exist so dont check that part to move forward just persist_features/state\n    if (!this.config.persist_features && !this.isEntityOn(stateObj)) return html``;\n\n    let effect_list = stateObj.attributes.effect_list || [];\n\n    // if we were given a custom list then use that\n    if (this.config.effects_list && Array.isArray(this.config.effects_list)) {\n      effect_list = this.config.effects_list;\n    } else if (this.config.effects_list && this.hass.states[this.config.effects_list]) {\n      // else if given an input_select entity use that as effect list\n      const inputSelect = this.hass.states[this.config.effects_list];\n      effect_list = (inputSelect.attributes && inputSelect.attributes.options) || [];\n    } else if (this.dontShowFeature('effectList', stateObj)) {\n      // finally if no custom list nor feature exists then dont show effect list\n      return html``;\n    }\n\n    const listItems = effect_list.map(effect => this.createListItem(stateObj, effect));\n    const caption = this.hass.localize('ui.card.light.effect') || 'Effect';\n\n    return html`\n      <div class=\"control light-entity-card-center light-entity-card-effectlist\">\n        <ha-select \n          @closed=\"${e => e.stopPropagation()}\" \n          @selected=${e => this.setEffect(e, stateObj)} \n          label=\"${caption}\" \n        >\n          ${listItems}\n        </ha-select>\n      </div>\n    `;\n  }\n\n  createListItem(stateObj, effect) {\n    return html`<mwc-list-item value=\"${effect}\" ?selected=${effect === stateObj.attributes.effect}\n      >${effect}</mwc-list-item\n    >`;\n  }\n\n  /**\n   * creates color picker wheel for a given entity\n   * @param {LightEntity} stateObj\n   * @return {TemplateResult}\n   */\n  createColorPicker(stateObj) {\n    if (this.config.color_picker === false) return html``;\n    if (this.dontShowFeature('color', stateObj)) return html``;\n\n    // ha-hs-color-picker uses saturation 0-1, HA uses 0-100\n    const haHs = stateObj.attributes.hs_color || [0, 0];\n    const pickerValue = (this._colorPickerValues && this._colorPickerValues[stateObj.entity_id])\n      || [haHs[0], haHs[1] / 100];\n\n    return html`\n      <div class=\"light-entity-card__color-picker\">\n        <ha-hs-color-picker\n          .value=${pickerValue}\n          @cursor-moved=${(e) => { this._colorPickerValues = { ...this._colorPickerValues, [stateObj.entity_id]: e.detail.value }; }}\n          @value-changed=${(e) => this._onColorPickerChanged(e.detail.value, stateObj)}\n        ></ha-hs-color-picker>\n      </div>\n    `;\n  }\n\n  /**\n   * do we show a feature or not?\n   * @param {string} featureName\n   * @param {LightEntity} stateObj\n   * @return {boolean}\n   */\n  dontShowFeature(featureName, stateObj) {\n    // show all feature if this is set to true\n    if (this.config.force_features) return false;\n\n    // WLED support\n    if (featureName === 'speed' && 'speed' in stateObj.attributes) return false;\n    if (featureName === 'intensity' && 'intensity' in stateObj.attributes) return false;\n\n    // old deprecated way to seeing if supported feature\n    let featureSupported = LightEntityCard.featureNames[featureName] & stateObj.attributes.supported_features;\n\n    // support new color modes https://developers.home-assistant.io/docs/core/entity/light/#color-modes\n    const colorModes = stateObj.attributes.supported_color_modes || [];\n\n    if (!featureSupported) {\n      switch (featureName) {\n        case 'brightness':\n          featureSupported = Object.prototype.hasOwnProperty.call(stateObj.attributes, 'brightness');\n          if (!featureSupported) {\n            const supportedModes = ['hs', 'rgb', 'rgbw', 'rgbww', 'white', 'brightness', 'color_temp', 'xy'];\n            featureSupported = [...new Set(colorModes.filter(mode => supportedModes.includes(mode)))].length > 0;\n          }\n\n          break;\n        case 'colorTemp':\n          if (colorModes) {\n            const supportedModes = ['color_temp'];\n            featureSupported = [...new Set(colorModes.filter(mode => supportedModes.includes(mode)))].length > 0;\n          }\n          break;\n        case 'effectList':\n          featureSupported = stateObj.attributes.effect_list && stateObj.attributes.effect_list.length;\n          break;\n        case 'color': {\n          const supportedModes = ['hs', 'rgb', 'rgbw', 'rgbww', 'xy'];\n          featureSupported = [...new Set(colorModes.filter(mode => supportedModes.includes(mode)))].length > 0;\n          break;\n        }\n        case 'whiteValue':\n          featureSupported = Object.prototype.hasOwnProperty.call(stateObj.attributes, 'white_value');\n          if (!featureSupported) {\n            const supportedModes = ['rgbw', 'rgbww'];\n            featureSupported = colorModes.some(mode => supportedModes.includes(mode));\n          }\n          break;\n        case 'warmWhiteValue': {\n          const supportedModes = ['rgbww'];\n          featureSupported = colorModes.some(mode => supportedModes.includes(mode));\n          break;\n        }\n        default:\n          featureSupported = false;\n          break;\n      }\n    }\n\n    if (!featureSupported) return true;\n    if (!this.config.persist_features && !this.isEntityOn(stateObj)) return true;\n    return false;\n  }\n\n  /**\n   * change to hs color for a given entity\n   * @param {HSV} hsv\n   * @param {LightEntity} stateObj\n   */\n  _onColorPickerChanged(value, stateObj) {\n    if (this._colorPickerValues) {\n      const { [stateObj.entity_id]: _, ...rest } = this._colorPickerValues;\n      this._colorPickerValues = rest;\n    }\n    this.setColorPicker(value, stateObj);\n  }\n\n  setColorPicker(value, stateObj) {\n    if (!value) return;\n    // Convert saturation back from 0-1 to 0-100 for HA\n    this.callEntityService({ hs_color: [value[0], value[1] * 100] }, stateObj);\n  }\n\n  _setValue(event, stateObj, valueName) {\n    const newValue = parseInt(event.target.value, 10);\n    if (isNaN(newValue) || parseInt(stateObj.attributes[valueName], 10) === newValue) return;\n\n    this.callEntityService({ [valueName]: newValue }, stateObj);\n  }\n\n  /**\n   * handles color temperature slider changes, converting to the correct unit for HA\n   * @param {CustomEvent} event\n   * @param {LightEntity} stateObj\n   * @param {boolean} usesKelvin - whether the HA entity uses kelvin-based attributes\n   * @param {boolean} sliderInKelvin - whether the slider value is in kelvin\n   * @param {number} [minMired] - min mired value (needed for percentage→mired conversion)\n   * @param {number} [maxMired] - max mired value (needed for percentage→mired conversion)\n   */\n  _setColorTemp(event, stateObj, usesKelvin, sliderInKelvin, minMired, maxMired) {\n    const rawValue = parseInt(event.target.value, 10);\n    if (isNaN(rawValue)) return;\n\n    if (sliderInKelvin) {\n      // Slider value is kelvin\n      if (usesKelvin) {\n        if (rawValue === parseInt(stateObj.attributes.color_temp_kelvin, 10)) return;\n        this.callEntityService({ color_temp_kelvin: rawValue }, stateObj);\n      } else {\n        const miredValue = Math.round(1000000 / rawValue);\n        if (miredValue === parseInt(stateObj.attributes.color_temp, 10)) return;\n        this.callEntityService({ color_temp: miredValue }, stateObj);\n      }\n    } else {\n      // Slider value is percentage (0–100), convert back to mireds\n      if (!Number.isFinite(minMired) || !Number.isFinite(maxMired) || maxMired <= minMired) return;\n      const miredValue = Math.round(minMired + (rawValue / 100) * (maxMired - minMired));\n      if (usesKelvin) {\n        const kelvinValue = Math.round(1000000 / miredValue);\n        if (kelvinValue === parseInt(stateObj.attributes.color_temp_kelvin, 10)) return;\n        this.callEntityService({ color_temp_kelvin: kelvinValue }, stateObj);\n      } else {\n        if (miredValue === parseInt(stateObj.attributes.color_temp, 10)) return;\n        this.callEntityService({ color_temp: miredValue }, stateObj);\n      }\n    }\n  }\n\n  /**\n   * sets the toggle state based on the given entity state\n   * @param {CustomEvent} event\n   * @param {LightEntity} stateObj\n   */\n  setToggle(event, stateObj) {\n    const newState = this.isEntityOn(stateObj) ? LightEntityCard.cmdToggle.off : LightEntityCard.cmdToggle.on;\n    this.callEntityService({}, stateObj, newState);\n  }\n\n  /**\n   * sets the current effect selected for an entity\n   * @param {CustomEvent} event\n   * @param {LightEntity} entity\n   */\n  setEffect(event, stateObj) {\n    if(!event.target.value ) return;\n    this.callEntityService({ effect: event.target.value }, stateObj);\n  }\n\n  /**\n   * call light service to update a state of an entity\n   * @param {Object} payload\n   * @param {LightEntity} entity\n   * @param {String} state\n   */\n  callEntityService(payload, stateObj, state) {\n    if(!this._firstUpdate) return;\n\n    let entityType = stateObj.entity_id.split('.')[0];\n    if (entityType === 'group') entityType = 'homeassistant';\n\n    const transition = parseFloat(this.config.transition) || 0;\n    if (transition > 0 && entityType === 'light') {\n      payload = { ...payload, transition };\n    }\n\n    this.hass.callService(entityType, state || LightEntityCard.cmdToggle.on, {\n      entity_id: stateObj.entity_id,\n      ...payload,\n    });\n  }\n}\n\ncustomElements.define('light-entity-card', LightEntityCard);\nwindow.customCards = window.customCards || [];\nwindow.customCards.push({\n  type: 'light-entity-card',\n  name: 'Light Entity Card',\n  description: 'Control lights and switches',\n});\n"
  },
  {
    "path": "src/style-editor.js",
    "content": "import { css } from 'lit';\n\nconst style = css`\n  .entities {\n    padding-top: 10px;\n    padding-bottom: 10px;\n    display: flex;\n  }\n\n  .entities ha-formfield {\n    display: block;\n    margin-bottom: 10px;\n    margin-left: 10px;\n  }\n\n  .checkbox-options {\n    display: flex;\n  }\n  \n  ha-entity-picker {\n    width: 100%;\n  }\n\n  .checkbox-options ha-formfield,\n  .entities mwc-switch,\n  .entities ha-form-string {\n    padding-right: 2%;\n    width: 48%;\n  }\n\n  .checkbox-options ha-formfield {\n    margin-top: 10px;\n  }\n\n  .overall-config {\n    margin-bottom: 20px;\n  }\n`;\n\nexport default style;\n"
  },
  {
    "path": "src/style.js",
    "content": "import { css } from 'lit';\n\nconst style = css`\n  .light-entity-card {\n    padding: 16px;\n  }\n\n  .light-entity-child-card {\n    box-shadow: none !important;\n    padding: 0 !important;\n  }\n\n  .light-entity-card.group {\n    padding-bottom: 5;\n    padding-top: 0;\n  }\n\n  .ha-slider-full-width ha-slider {\n    width: 100%;\n  }\n\n  .percent-slider {\n    color: var(--primary-text-color);\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    margin-left: 8px;\n    min-width: 40px;\n    text-align: right;\n  }\n\n  .light-entity-card__header {\n    display: flex;\n    justify-content: space-between;\n    @apply --paper-font-headline;\n    line-height: 40px;\n    color: var(--primary-text-color);\n  }\n\n  .group .light-entity-card__header {\n  }\n\n  .light-entity-card-sliders > div {\n    margin-top: 10px;\n  }\n\n  .group .light-entity-card-sliders > div {\n    margin-top: 0px;\n  }\n\n  .light-entity-card__toggle {\n    display: flex;\n    cursor: pointer;\n  }\n\n  .light-entity-card__color-picker {\n    display: flex;\n    justify-content: center;\n    margin-top: 10px;\n  }\n\n  .light-entity-card__color-picker ha-hs-color-picker {\n    max-width: 300px;\n    width: 100%;\n  }\n  \n  .light-entity-card-color_temp {\n    background-image: var(--ha-slider-background, linear-gradient(to right, #a6d1ff, #ffb74d));\n    border-radius: 4px;\n  }\n\n  .light-entity-card-color_temp--kelvin {\n    background-image: var(--ha-slider-background, linear-gradient(to right, #ffb74d, #a6d1ff));\n  }\n\n  .light-entity-card-effectlist {\n    padding-top: 10px;\n    padding-bottom: 10px;\n  }\n\n  .group .light-entity-card-effectlist {\n    padding-bottom: 20px;\n  }\n\n  .light-entity-card-center {\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    cursor: pointer;\n  }\n\n  .hidden {\n    display: none;\n  }\n\n  .icon-container {\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    margin-right: 8px;\n  }\n\n`;\n\nexport default style;\n"
  },
  {
    "path": "webpack/config.common.js",
    "content": "const path = require(\"path\");\n\nmodule.exports = {\n  entry: \"./src/index.js\",\n  devtool: \"source-map\",\n  output: {\n    filename: \"light-entity-card.js\",\n    path: path.resolve(__dirname, \"../dist\"),\n  },\n  module: {\n    rules: [\n      {\n        test: /\\.js$/,\n        include: [/node_modules(?:\\/|\\\\)lit-element|lit-html/],\n        use: {\n          loader: \"babel-loader\",\n          options: {\n            presets: [\"@babel/preset-env\"],\n          },\n        },\n      },\n    ],\n  },\n};\n"
  },
  {
    "path": "webpack/config.dev.js",
    "content": "const { merge } = require('webpack-merge');\nconst commonConfig = require('./config.common');\n\n\nmodule.exports = merge(commonConfig, {\n    mode: 'development'\n});"
  },
  {
    "path": "webpack/config.prod.js",
    "content": "const { merge } = require('webpack-merge');\nconst commonConfig = require('./config.common');\n\n\nmodule.exports = merge(commonConfig, {\n    mode: 'production',\n    devtool: false,\n    optimization: {\n        minimize: true\n    },\n    output: {\n        publicPath: '/local/'\n    },\n});"
  }
]