From 421de8cec7a0e1dc7655fa78d66c3f3b6c141196 Mon Sep 17 00:00:00 2001 From: Ferry Cools Date: Tue, 5 Aug 2025 12:28:21 +0200 Subject: [PATCH] Refactors view creation to support sections Updates view creation to leverage sections for improved layout control, especially on the home view. The home view now uses a grid layout via sections. This change makes it easier to create complex layouts and improves responsiveness. Previously, the card creation logic was embedded directly within each view, leading to code duplication and difficulty in customizing layouts. The changes introduce the concept of sections, which are distinct areas within a view that can contain multiple cards. The home view is updated to use sections for the persons, areas, and quick access cards. This makes it easier to create responsive layouts that adapt to different screen sizes. --- dist/mushroom-strategy.js | 1 - src/mushroom-strategy.ts | 9 +- src/utilities/cardStacking.ts | 2 +- src/views/AbstractView.ts | 79 ++++++++++-------- src/views/HomeView.ts | 149 ++++++++++++++++++++-------------- 5 files changed, 139 insertions(+), 101 deletions(-) delete mode 100644 dist/mushroom-strategy.js diff --git a/dist/mushroom-strategy.js b/dist/mushroom-strategy.js deleted file mode 100644 index 019874e..0000000 --- a/dist/mushroom-strategy.js +++ /dev/null @@ -1 +0,0 @@ -(()=>{var e,t,r={144:(e,t,r)=>{"use strict";const s=r(3908);e.exports=(e,t,r=!1)=>{if(e instanceof s)return e;try{return new s(e,t)}catch(e){if(!r)return null;throw e}}},245:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>a});var s=r(1241),i=r(5987),n=r(1122);class o extends n.default{static getDefaultConfig(){return{title:(0,i.k)("fan.fans"),path:"fans",icon:"mdi:fan",subview:!1,headerCardConfiguration:{iconOn:"mdi:fan",iconOff:"mdi:fan-off",onService:"fan.turn_on",offService:"fan.turn_off"}}}static getViewHeaderCardConfig(){return{title:(0,i.k)("fan.all_fans"),subtitle:`${s.O.getCountTemplate(o.domain,"eq","on")} ${(0,i.k)("fan.fans")} `+(0,i.k)("generic.on")}}constructor(e){super(),this.initializeViewConfig(o.getDefaultConfig(),e,o.getViewHeaderCardConfig())}}o.domain="fan";const a=o},270:(e,t,r)=>{"use strict";const s=r(3908),i=r(8311);e.exports=(e,t,r)=>{let n=null,o=null,a=null;try{a=new i(t,r)}catch(e){return null}return e.forEach((e=>{a.test(e)&&(n&&1!==o.compare(e)||(n=e,o=new s(n,r)))})),n}},560:(e,t,r)=>{"use strict";const s=r(3908);e.exports=(e,t,r)=>new s(e,r).compare(new s(t,r))},845:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>n});var s=r(4818);class i extends s.default{static getDefaultConfig(){return{type:"custom:mushroom-person-card",layout:"vertical",primary_info:"none",secondary_info:"none",icon_type:"entity-picture"}}constructor(e,t){super(e),this.configuration={...this.configuration,...i.getDefaultConfig(),...t}}}const n=i},909:(e,t,r)=>{"use strict";const s=r(3908);e.exports=(e,t,r)=>{const i=new s(e,r),n=new s(t,r);return i.compare(n)||i.compareBuild(n)}},1122:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>l});var s=r(4137),i=r(1241),n=r(3007),o=r(6964),a=r(2682),c=r(2737);const l=class{get domain(){return this.constructor.domain}constructor(){this.baseConfiguration={icon:"mdi:view-dashboard",subview:!1},this.viewHeaderCardConfiguration={cards:[],type:""},i.O.initialized||(0,o.OG)(o.ZY,"Registry is not initialized!")}async createCardConfigurations(){const e=[],t=(0,n.p)(this.domain+"Card"),o=(await r(2560)(`./${t}`)).default,l=new a.A(i.O.entities).whereDomain(this.domain).where((e=>!e.entity_id.endsWith("_stateful_scene"))).toList();for(const t of i.O.areas){let r=[],n={area_id:[t.area_id]};const u=new a.A(l).whereAreaId(t.area_id).toList();if("undisclosed"===t.area_id&&(n={entity_id:u.map((e=>e.entity_id))}),r.push(...u.map((e=>new o(e,i.O.strategyOptions.card_options?.[e.entity_id]).getCard()))),r.length){r=(0,c.P)(r,i.O.strategyOptions.domains[this.domain].stack_count??i.O.strategyOptions.domains._.stack_count);const o="headerCardConfiguration"in this.baseConfiguration?this.baseConfiguration.headerCardConfiguration:{};r.unshift(new s.default(n,{title:t.name,...o}).createCard()),e.push({type:"vertical-stack",cards:r})}}return this.viewHeaderCardConfiguration.cards.length&&e.length&&e.unshift(this.viewHeaderCardConfiguration),e}async getView(){return{...this.baseConfiguration,cards:await this.createCardConfigurations()}}getDomainTargets(){return{entity_id:i.O.entities.filter((e=>e.entity_id.startsWith(this.domain+"."))).map((e=>e.entity_id))}}initializeViewConfig(e,t={},r){this.baseConfiguration={...this.baseConfiguration,...e,...t},this.baseConfiguration.headerCardConfiguration={...this.baseConfiguration.headerCardConfiguration,showControls:i.O.strategyOptions.domains[this.domain]?.showControls??i.O.strategyOptions.domains._.showControls},this.viewHeaderCardConfiguration=new s.default(this.getDomainTargets(),{...this.baseConfiguration.headerCardConfiguration,...r}).createCard()}}},1123:e=>{"use strict";const t=/^[0-9]+$/,r=(e,r)=>{const s=t.test(e),i=t.test(r);return s&&i&&(e=+e,r=+r),e===r?0:s&&!i?-1:i&&!s?1:er(t,e)}},1151:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>n});var s=r(5982);class i extends s.default{static getDefaultConfig(){return{type:"custom:mushroom-entity-card",icon:"mdi:power-cycle",icon_color:"green"}}constructor(e,t){super(e),this.configuration={...this.configuration,...i.getDefaultConfig(),...t}}}const n=i},1216:(e,t,r)=>{var s={"./AbstractChip":[8222,792],"./AbstractChip.ts":[8222,792],"./ClimateChip":[7757,792],"./ClimateChip.ts":[7757,792],"./CoverChip":[1970,792],"./CoverChip.ts":[1970,792],"./FanChip":[1867,792],"./FanChip.ts":[1867,792],"./LightChip":[3122,792],"./LightChip.ts":[3122,792],"./SwitchChip":[9908,792],"./SwitchChip.ts":[9908,792],"./WeatherChip":[1778,792],"./WeatherChip.ts":[1778,792]};function i(e){if(!r.o(s,e))return Promise.resolve().then((()=>{var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}));var t=s[e],i=t[0];return r.e(t[1]).then((()=>r(i)))}i.keys=()=>Object.keys(s),i.id=1216,e.exports=i},1241:(e,t,r)=>{"use strict";r.d(t,{O:()=>l});var s=r(4744),i=r.n(s),n=r(2700),o=r(6964),a=r(5987),c=r(2682);class l{constructor(){}static get devices(){return l._devices}static get hassStates(){return l._hassStates}static get initialized(){return l._initialized}static get entities(){return l._entities}static get areas(){return l._areas}static get strategyOptions(){return l._strategyOptions}static async initialize(e){(0,a.A)(e.hass),l._hassStates=e.hass.states;const{ConfigurationDefaults:t}=await Promise.resolve().then(r.bind(r,7688));try{l._strategyOptions=i()(t,e.config?.strategy?.options??{})}catch(e){(0,o.OG)(o.ZY,"Error importing strategy options!",e)}(0,o.Ux)(l.strategyOptions.debug?o.ZY:o.QC);try{[l._entities,l._devices,l._areas]=await Promise.all([e.hass.callWS({type:"config/entity_registry/list"}),e.hass.callWS({type:"config/device_registry/list"}),e.hass.callWS({type:"config/area_registry/list"})])}catch(e){(0,o.OG)(o.ZY,"Error importing Home Assistant registries!",e)}l._strategyOptions.extra_views.map((e=>({...e,subview:!1}))),l._entities=new c.A(l.entities).not().whereEntityCategory("config").not().whereEntityCategory("diagnostic").isNotHidden().whereDisabledBy(null).orderBy(["name","original_name"],"asc").toList(),l._entities=l.entities.map((e=>({...e,area_id:e.area_id??"undisclosed"}))),l._devices=new c.A(l.devices).isNotHidden().whereDisabledBy(null).orderBy(["name_by_user","name"],"asc").toList(),l._devices=l.devices.map((e=>({...e,area_id:e.area_id??"undisclosed"}))),l.strategyOptions.areas._.hidden?l._areas=[]:(l.strategyOptions.areas.undisclosed?.hidden||l.areas.push(t.areas.undisclosed),l._areas=l.areas.map((e=>({...e,...l.strategyOptions.areas._,...l.strategyOptions.areas?.[e.area_id]}))),l.strategyOptions.areas.undisclosed.area_id="undisclosed",l.strategyOptions.areas.undisclosed.type="default",l._areas=new c.A(l.areas).isNotHidden().orderBy(["order","name"],"asc").toList()),(()=>{const e=Object.entries(l.strategyOptions.views);l.strategyOptions.views=Object.fromEntries(e.sort((([e,t],[r,s])=>(t.order??1/0)-(s.order??1/0)||(t.title??"").localeCompare(s.title??""))))})(),(()=>{const e=Object.entries(l.strategyOptions.domains);l.strategyOptions.domains=Object.fromEntries(e.sort((([,e],[,t])=>(0,n.vv)(e)&&(0,n.vv)(t)?(e.order??1/0)-(t.order??1/0)||(e.title??"").localeCompare(t.title??""):0)))})(),l._initialized=!0}static getCountTemplate(e,t,r){const s=[];return l.initialized?(s.push(...new c.A(l.entities).whereDomain(e).where((e=>!e.entity_id.endsWith("_stateful_scene")&&"group"!==e.platform)).toList().map((e=>`states['${e.entity_id}']`))),`{% set entities = [${s}] %}\n {{ entities\n | selectattr('state','${t}','${r}')\n | selectattr('state','ne','unavailable')\n | selectattr('state','ne','unknown')\n | list\n | count\n }}`):((0,o.OG)(o.br,"Registry is not initialized!"),"?")}static getExposedNames(e){if("chip"===e)return Object.entries(l.strategyOptions.chips).filter((([e,t])=>!0===t)).map((([e])=>e.split("_")[0]));const t=l.strategyOptions[`${e}s`];return Object.keys(t).filter((e=>"_"!==e&&"default"!==e&&!t[e].hidden))}}l._initialized=!1,l._areas=[]},1255:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>a});var s=r(1241),i=r(5987),n=r(1122);class o extends n.default{static getDefaultConfig(){return{title:(0,i.k)("camera.cameras"),path:"cameras",icon:"mdi:cctv",subview:!1,headerCardConfiguration:{showControls:!1}}}static getViewHeaderCardConfig(){return{title:(0,i.k)("camera.all_cameras"),subtitle:`${s.O.getCountTemplate(o.domain,"ne","off")} ${(0,i.k)("camera.cameras")} `+(0,i.k)("generic.busy")}}constructor(e){super(),this.initializeViewConfig(o.getDefaultConfig(),e,o.getViewHeaderCardConfig())}}o.domain="camera";const a=o},1261:(e,t,r)=>{"use strict";const s=r(3908),i=r(8311),n=r(5580);e.exports=(e,t)=>{e=new i(e,t);let r=new s("0.0.0");if(e.test(r))return r;if(r=new s("0.0.0-0"),e.test(r))return r;r=null;for(let t=0;t{const t=new s(e.semver.version);switch(e.operator){case">":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":o&&!n(t,o)||(o=t);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${e.operator}`)}})),!o||r&&!n(r,o)||(r=o)}return r&&e.test(r)?r:null}},1729:(e,t,r)=>{"use strict";const s=r(144);e.exports=(e,t)=>{const r=s(e,t);return r&&r.prerelease.length?r.prerelease:null}},1763:(e,t,r)=>{"use strict";const s=r(560);e.exports=(e,t)=>s(e,t,!0)},1778:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>n});var s=r(8222);class i extends s.default{static getDefaultConfig(e){return{type:"weather",entity:e,show_temperature:!0,show_conditions:!0}}constructor(e,t){super(),this.configuration={...this.configuration,...i.getDefaultConfig(e),...t}}}const n=i},1810:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>n});var s=r(7212);class i extends s.default{static getDefaultConfig(){return{type:"custom:mushroom-select-card",icon:void 0}}constructor(e,t){super(e),this.configuration={...this.configuration,...i.getDefaultConfig(),...t}}}const n=i},1832:(e,t,r)=>{"use strict";const s=r(144);e.exports=(e,t)=>{const r=s(e,null,!0),i=s(t,null,!0),n=r.compare(i);if(0===n)return null;const o=n>0,a=o?r:i,c=o?i:r,l=!!a.prerelease.length;if(c.prerelease.length&&!l){if(!c.patch&&!c.minor)return"major";if(0===c.compareMain(a))return c.minor&&!c.patch?"minor":"patch"}const u=l?"pre":"";return r.major!==i.major?u+"major":r.minor!==i.minor?u+"minor":r.patch!==i.patch?u+"patch":"prerelease"}},1867:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>a});var s=r(1241),i=r(8222),n=r(2682);class o extends i.default{static getDefaultConfig(){return{type:"template",icon:"mdi:fan",icon_color:"green",content:s.O.getCountTemplate("fan","eq","on"),tap_action:{action:"perform-action",perform_action:"fan.turn_off",target:{entity_id:new n.A(s.O.entities).whereDomain("fan").getValuesByProperty("entity_id")}},hold_action:{action:"navigate",navigation_path:"fans"}}}constructor(e){super(),this.configuration={...this.configuration,...o.getDefaultConfig(),...e}}}const a=o},1970:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>o});var s=r(1241),i=r(8222);class n extends i.default{static getDefaultConfig(){return{type:"template",icon:"mdi:window-open",icon_color:"cyan",content:s.O.getCountTemplate("cover","search","(open|opening|closing)"),tap_action:{action:"none"},hold_action:{action:"navigate",navigation_path:"covers"}}}constructor(e){super(),this.configuration={...this.configuration,...n.getDefaultConfig(),...e}}}const o=n},2111:(e,t,r)=>{"use strict";const s=r(4641),i=r(3999),n=r(5580),o=r(4089),a=r(7059),c=r(5200);e.exports=(e,t,r,l)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return s(e,r,l);case"!=":return i(e,r,l);case">":return n(e,r,l);case">=":return o(e,r,l);case"<":return a(e,r,l);case"<=":return c(e,r,l);default:throw new TypeError(`Invalid operator: ${t}`)}}},2137:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>n});var s=r(4818);class i extends s.default{static getDefaultConfig(){return{type:"custom:mushroom-number-card",icon:void 0}}constructor(e,t){super(e),this.configuration={...this.configuration,...i.getDefaultConfig(),...t}}}const n=i},2464:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>a});var s=r(1241),i=r(5987),n=r(1122);class o extends n.default{static getDefaultConfig(){return{title:(0,i.k)("switch.switches"),path:"switches",icon:"mdi:dip-switch",subview:!1,headerCardConfiguration:{iconOn:"mdi:power-plug",iconOff:"mdi:power-plug-off",onService:"switch.turn_on",offService:"switch.turn_off"}}}static getViewHeaderCardConfig(){return{title:(0,i.k)("switch.all_switches"),subtitle:`${s.O.getCountTemplate(o.domain,"eq","on")} ${(0,i.k)("switch.switches")} `+(0,i.k)("generic.on")}}constructor(e){super(),this.initializeViewConfig(o.getDefaultConfig(),e,o.getViewHeaderCardConfig())}}o.domain="switch";const a=o},2525:(e,t,r)=>{"use strict";const s=r(7638),i=r(560);e.exports=(e,t,r)=>{const n=[];let o=null,a=null;const c=e.sort(((e,t)=>i(e,t,r)));for(const e of c)s(e,t,r)?(a=e,o||(o=e)):(a&&n.push([o,a]),a=null,o=null);o&&n.push([o,null]);const l=[];for(const[e,t]of n)e===t?l.push(e):t||e!==c[0]?t?e===c[0]?l.push(`<=${t}`):l.push(`${e} - ${t}`):l.push(`>=${e}`):l.push("*");const u=l.join(" || "),d="string"==typeof t.raw?t.raw:String(t);return u.length{var s={"./AbstractCard":[4818],"./AbstractCard.ts":[4818],"./AreaCard":[4301,792],"./AreaCard.ts":[4301,792],"./BinarySensorCard":[1151,792],"./BinarySensorCard.ts":[1151,792],"./CameraCard":[2723,792],"./CameraCard.ts":[2723,792],"./ClimateCard":[8721,792],"./ClimateCard.ts":[8721,792],"./CoverCard":[8033,792],"./CoverCard.ts":[8033,792],"./FanCard":[2667,792],"./FanCard.ts":[2667,792],"./HaAreaCard":[9042,792],"./HaAreaCard.ts":[9042,792],"./HeaderCard":[4137],"./HeaderCard.ts":[4137],"./InputSelectCard":[1810,792],"./InputSelectCard.ts":[1810,792],"./LightCard":[8254,792],"./LightCard.ts":[8254,792],"./LockCard":[6555,792],"./LockCard.ts":[6555,792],"./MediaPlayerCard":[9879,792],"./MediaPlayerCard.ts":[9879,792],"./MiscellaneousCard":[4486,792],"./MiscellaneousCard.ts":[4486,792],"./NumberCard":[2137,792],"./NumberCard.ts":[2137,792],"./PersonCard":[845,792],"./PersonCard.ts":[845,792],"./SceneCard":[2858,792],"./SceneCard.ts":[2858,792],"./SelectCard":[7212,792],"./SelectCard.ts":[7212,792],"./SensorCard":[5982],"./SensorCard.ts":[5982],"./SwitchCard":[3708,792],"./SwitchCard.ts":[3708,792],"./VacuumCard":[7430,792],"./VacuumCard.ts":[7430,792],"./ValveCard":[8868,792],"./ValveCard.ts":[8868,792]};function i(e){if(!r.o(s,e))return Promise.resolve().then((()=>{var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}));var t=s[e],i=t[0];return Promise.all(t.slice(1).map(r.e)).then((()=>r(i)))}i.keys=()=>Object.keys(s),i.id=2560,e.exports=i},2667:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>n});var s=r(4818);class i extends s.default{static getDefaultConfig(){return{type:"custom:mushroom-fan-card",icon:void 0,show_percentage_control:!0,show_oscillate_control:!0,icon_animation:!0}}constructor(e,t){super(e),this.configuration={...this.configuration,...i.getDefaultConfig(),...t}}}const n=i},2682:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});var s=r(1241),i=r(6964);class n{constructor(e){this.filters=[],this.invertNext=!1,this.entries=e,this.entryIdentifier=0===e.length||"entity_id"in e[0]?"entity_id":"floor_id"in e[0]?"area_id":"id"}not(){return this.invertNext=!this.invertNext,this}resetFilters(){return this.filters=[],this.invertNext=!1,this}where(e){return this.filters.push(this.checkInversion(e)),this}whereAreaId(e,t=!0){return this.filters.push(this.checkInversion((r=>{let i;const n=r;return t&&n.device_id&&(i=s.O.devices.find((e=>e.id===n.device_id))?.area_id),e?"undisclosed"===e?r.area_id===e&&(i===e||null==i):r.area_id===e||"undisclosed"===r.area_id&&i===e:r.area_id===e&&i===e}))),this}whereNameContains(e){const t=e.toLowerCase();return this.filters.push(this.checkInversion((e=>{const r=e;return[r.name,r.original_name,r.name_by_user].filter((e=>"string"==typeof e)).some((e=>e.toLowerCase().includes(t)))}))),this}whereDomain(e){const t=e+".";return this.filters.push(this.checkInversion((e=>"entity_id"in e&&e.entity_id.startsWith(t)))),this}whereFloorId(e){return this.filters.push(this.checkInversion((t=>{const r="floor_id"in t;return void 0===e?!r:r&&t.floor_id===e}))),this}whereDeviceId(e){return this.filters.push(this.checkInversion((t=>{const r="id"in t,s="device_id"in t;return void 0===e?!r&&!s:r&&t.id===e||s&&t.device_id===e}))),this}whereEntityId(e){return this.filters.push(this.checkInversion((t=>void 0===e?!("entity_id"in t):"entity_id"in t&&t.entity_id===e))),this}whereDisabledBy(e){return this.filters.push(this.checkInversion((t=>{const r="disabled_by"in t;return void 0===e?!r:r&&t.disabled_by===e}))),this}whereHiddenBy(e){return this.filters.push(this.checkInversion((t=>{const r="hidden_by"in t;return void 0===e?!r:r&&t.hidden_by===e}))),this}isNotHidden(e=!0){return this.filters.push(this.checkInversion((t=>{const r="hidden_by"in t&&t.hidden_by;if(!e)return!r;const i=t[this.entryIdentifier],n="area_id"===this.entryIdentifier?{...s.O.strategyOptions.areas._,...s.O.strategyOptions.areas[i]}:s.O.strategyOptions.card_options?.[i];return!(r||!0===n?.hidden)}))),this}whereEntityCategory(e){const t=this.invertNext;return this.invertNext=!1,this.filters.push((r=>{const i="entity_category"in r?r.entity_category:void 0,n="string"==typeof i?s.O.strategyOptions?.domains?._?.[`hide_${i}_entities`]:void 0;return!0!==n&&(!1===n&&i===e||(t?i!==e:i===e))})),this}orderBy(e,t="asc"){const r=(e,t)=>{for(const r of t){const t=e[r];if(null!=t)return t}},s=e=>{switch(e){case-1/0:return[0,0];case void 0:case null:return[2,0];case 1/0:return[3,0];default:return[1,e]}},i=[...this.entries].sort(((i,n)=>{const o=r(i,e),a=r(n,e);if(o===a)return 0;const[c,l]=s(o),[u,d]=s(a);return c!==u?(c-u)*("asc"===t?1:-1):null==l?1:null==d?-1:"string"==typeof l&&"string"==typeof d?l.localeCompare(d)*("asc"===t?1:-1):(lrr>=t)),this}toList(){const e=new n(this.entries);return e.filters=[...this.filters],e.entries.filter(((t,r)=>e.filters.every((e=>e(t,r)))))}getValuesByProperty(e){return this.toList().map((t=>t[e])).filter((e=>void 0!==e))}first(){const e=new n(this.entries);return e.filters=[...this.filters],e.entries.find(((t,r)=>e.filters.every((e=>e(t,r)))))}single(){const e=new n(this.entries);e.filters=[...this.filters];const t=e.entries.filter(((t,r)=>e.filters.every((e=>e(t,r)))));if(1===t.length)return t[0];(0,i.OG)(i.br,`Expected a single element, but found ${t.length}.`)}count(){const e=new n(this.entries);return e.filters=[...this.filters],e.entries.filter(((t,r)=>e.filters.every((e=>e(t,r))))).length}checkInversion(e){return this.invertNext?(this.invertNext=!1,t=>!e(t)):e}}const o=n},2700:(e,t,r)=>{"use strict";r.d(t,{dQ:()=>u,eq:()=>a,ln:()=>d,uS:()=>l,vv:()=>o});const s=["_","binary_sensor","camera","climate","cover","default","fan","input_select","light","lock","media_player","number","scene","select","sensor","switch","vacuum","valve"],i=["camera","climate","cover","fan","home","light","lock","scene","switch","vacuum","valve"],n=["light","fan","cover","switch","climate","weather"];function o(e){return e&&("order"in e||"title"in e||"name"in e)}function a(e){return!!e&&("perform-action"===e.action||"call-service"===e.action)&&"perform_action"in e}function c(e,t){return t.includes(e)}function l(e){return c(e,i)}function u(e){return c(e,s)}function d(e){return c(e,n)}},2723:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>n});var s=r(4818);class i extends s.default{static getDefaultConfig(){return{entity:"",type:"picture-entity",show_name:!1,show_state:!1,camera_view:"live"}}constructor(e,t){super(e),this.configuration={...this.configuration,...i.getDefaultConfig(),...t}}}const n=i},2737:(e,t,r)=>{"use strict";function s(e,t=2,r){if(e.length<=1)return e;const s=(e,t)=>{if(e.length<=1)return e;const r=[];for(let s=0;ss})},2858:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>c});var s=r(1241),i=r(4818),n=r(3708),o=r(2700);class a extends i.default{static getDefaultConfig(){return{type:"custom:mushroom-entity-card",tap_action:{action:"perform-action",perform_action:"scene.turn_on",target:{}}}}constructor(e,t){const r=e.entity_id.split(".").pop(),i=s.O.entities.find((e=>e.entity_id===`switch.${r}_stateful_scene`));if(super(i??e),i)return void(this.configuration=new n.default(i).getCard());const c=a.getDefaultConfig();(0,o.eq)(c.tap_action)&&(c.tap_action.target={entity_id:e.entity_id}),c.icon=s.O.hassStates[e.entity_id]?.attributes.icon??c.icon,this.configuration={...this.configuration,...c,...t}}}const c=a},2938:(e,t,r)=>{"use strict";const s=r(3908);e.exports=(e,t)=>new s(e,t).major},3007:(e,t,r)=>{"use strict";function s(e){return e.replace(/^([a-z])|([-_][a-z])/g,(e=>e.toUpperCase().replace(/[-_]/g,"")))}function i(e){if("function"==typeof structuredClone)try{return structuredClone(e)}catch{}try{return JSON.parse(JSON.stringify(e))}catch{return e}}r.d(t,{G:()=>i,p:()=>s})},3122:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>a});var s=r(1241),i=r(8222),n=r(2682);class o extends i.default{static getDefaultConfig(){return{type:"template",icon:"mdi:lightbulb-group",icon_color:"amber",content:s.O.getCountTemplate("light","eq","on"),tap_action:{action:"perform-action",perform_action:"light.turn_off",target:{entity_id:new n.A(s.O.entities).whereDomain("light").getValuesByProperty("entity_id")}},hold_action:{action:"navigate",navigation_path:"lights"}}}constructor(e){super(),this.configuration={...this.configuration,...o.getDefaultConfig(),...e}}}const a=o},3708:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>n});var s=r(4818);class i extends s.default{static getDefaultConfig(){return{type:"custom:mushroom-entity-card",icon:void 0,tap_action:{action:"toggle"}}}constructor(e,t){super(e),this.configuration={...this.configuration,...i.getDefaultConfig(),...t}}}const n=i},3874:(e,t,r)=>{"use strict";const s=r(8311);e.exports=(e,t)=>{try{return new s(e,t).range||"*"}catch(e){return null}}},3904:(e,t,r)=>{"use strict";const s=Symbol("SemVer ANY");class i{static get ANY(){return s}constructor(e,t){if(t=n(t),e instanceof i){if(e.loose===!!t.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),l("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===s?this.value="":this.value=this.operator+this.semver.version,l("comp",this)}parse(e){const t=this.options.loose?o[a.COMPARATORLOOSE]:o[a.COMPARATOR],r=e.match(t);if(!r)throw new TypeError(`Invalid comparator: ${e}`);this.operator=void 0!==r[1]?r[1]:"","="===this.operator&&(this.operator=""),r[2]?this.semver=new u(r[2],this.options.loose):this.semver=s}toString(){return this.value}test(e){if(l("Comparator.test",e,this.options.loose),this.semver===s||e===s)return!0;if("string"==typeof e)try{e=new u(e,this.options)}catch(e){return!1}return c(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof i))throw new TypeError("a Comparator is required");return""===this.operator?""===this.value||new d(e.value,t).test(this.value):""===e.operator?""===e.value||new d(this.value,t).test(e.semver):!((t=n(t)).includePrerelease&&("<0.0.0-0"===this.value||"<0.0.0-0"===e.value)||!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))||(!this.operator.startsWith(">")||!e.operator.startsWith(">"))&&(!this.operator.startsWith("<")||!e.operator.startsWith("<"))&&(this.semver.version!==e.semver.version||!this.operator.includes("=")||!e.operator.includes("="))&&!(c(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))&&!(c(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}}e.exports=i;const n=r(8587),{safeRe:o,t:a}=r(9718),c=r(2111),l=r(7272),u=r(3908),d=r(8311)},3908:(e,t,r)=>{"use strict";const s=r(7272),{MAX_LENGTH:i,MAX_SAFE_INTEGER:n}=r(6874),{safeRe:o,t:a}=r(9718),c=r(8587),{compareIdentifiers:l}=r(1123);class u{constructor(e,t){if(t=c(t),e instanceof u){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if("string"!=typeof e)throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>i)throw new TypeError(`version is longer than ${i} characters`);s("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;const r=e.trim().match(t.loose?o[a.LOOSE]:o[a.FULL]);if(!r)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>n||this.major<0)throw new TypeError("Invalid major version");if(this.minor>n||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>n||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t=0;)"number"==typeof this.prerelease[s]&&(this.prerelease[s]++,s=-2);if(-1===s){if(t===this.prerelease.join(".")&&!1===r)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let s=[t,e];!1===r&&(s=[t]),0===l(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}e.exports=u},3927:(e,t,r)=>{"use strict";const s=r(909);e.exports=(e,t)=>e.sort(((e,r)=>s(e,r,t)))},3999:(e,t,r)=>{"use strict";const s=r(560);e.exports=(e,t,r)=>0!==s(e,t,r)},4089:(e,t,r)=>{"use strict";const s=r(560);e.exports=(e,t,r)=>s(e,t,r)>=0},4137:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>i});class s{static getDefaultConfig(){return{type:"custom:mushroom-title-card",iconOn:"mdi:power-on",iconOff:"mdi:power-off",onService:"none",offService:"none"}}constructor(e,t){this.target=e,this.configuration={...s.getDefaultConfig(),...t}}createCard(){const e=[{type:"custom:mushroom-title-card",title:this.configuration.title,subtitle:this.configuration.subtitle}];return this.configuration.showControls&&e.push({type:"horizontal-stack",cards:[{type:"custom:mushroom-template-card",icon:this.configuration.iconOff,layout:"vertical",icon_color:"red",tap_action:{action:"call-service",service:this.configuration.offService,target:this.target,data:{}}},{type:"custom:mushroom-template-card",icon:this.configuration.iconOn,layout:"vertical",icon_color:"amber",tap_action:{action:"call-service",service:this.configuration.onService,target:this.target,data:{}}}]}),{type:"horizontal-stack",cards:e}}}const i=s},4277:(e,t,r)=>{"use strict";const s=r(909);e.exports=(e,t)=>e.sort(((e,r)=>s(r,e,t)))},4301:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>n});var s=r(4818);class i extends s.default{static getDefaultConfig(){return{type:"custom:mushroom-template-card",primary:void 0,icon:"mdi:floor-plan",icon_color:"blue",tap_action:{action:"navigate",navigation_path:""},hold_action:{action:"none"}}}constructor(e,t){super(e);const r=i.getDefaultConfig();let s=t;r.primary=e.name,r.icon=e.icon||r.icon,r.tap_action&&"navigation_path"in r.tap_action&&(r.tap_action.navigation_path=e.area_id),s&&(s={...s,type:r.type}),this.configuration={...this.configuration,...r,...s}}}const n=i},4486:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>n});var s=r(4818);class i extends s.default{static getDefaultConfig(){return{type:"custom:mushroom-entity-card",icon_color:"blue-grey"}}constructor(e,t){super(e),this.configuration={...this.configuration,...i.getDefaultConfig(),...t}}}const n=i},4493:(e,t,r)=>{"use strict";const s=r(3908);e.exports=(e,t)=>new s(e,t).patch},4641:(e,t,r)=>{"use strict";const s=r(560);e.exports=(e,t,r)=>0===s(e,t,r)},4744:e=>{"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===r}(e)}(e)},r="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function s(e,t){return!1!==t.clone&&t.isMergeableObject(e)?a((r=e,Array.isArray(r)?[]:{}),e,t):e;var r}function i(e,t,r){return e.concat(t).map((function(e){return s(e,r)}))}function n(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return Object.propertyIsEnumerable.call(e,t)})):[]}(e))}function o(e,t){try{return t in e}catch(e){return!1}}function a(e,r,c){(c=c||{}).arrayMerge=c.arrayMerge||i,c.isMergeableObject=c.isMergeableObject||t,c.cloneUnlessOtherwiseSpecified=s;var l=Array.isArray(r);return l===Array.isArray(e)?l?c.arrayMerge(e,r,c):function(e,t,r){var i={};return r.isMergeableObject(e)&&n(e).forEach((function(t){i[t]=s(e[t],r)})),n(t).forEach((function(n){(function(e,t){return o(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,n)||(o(e,n)&&r.isMergeableObject(t[n])?i[n]=function(e,t){if(!t.customMerge)return a;var r=t.customMerge(e);return"function"==typeof r?r:a}(n,r)(e[n],t[n],r):i[n]=s(t[n],r))})),i}(e,r,c):s(r,c)}a.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,r){return a(e,r,t)}),{})};var c=a;e.exports=c},4818:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>n});var s=r(1241),i=r(6964);const n=class{constructor(e){this.configuration={type:"custom:mushroom-entity-card",icon:"mdi:help-circle"},s.O.initialized||(0,i.OG)(i.ZY,"Registry not initialized!"),this.entity=e}getCard(){return{...this.configuration,entity:"entity_id"in this.entity?this.entity.entity_id:void 0}}}},5032:(e,t,r)=>{"use strict";const s=r(8311),i=r(3904),{ANY:n}=i,o=r(7638),a=r(560),c=[new i(">=0.0.0-0")],l=[new i(">=0.0.0")],u=(e,t,r)=>{if(e===t)return!0;if(1===e.length&&e[0].semver===n){if(1===t.length&&t[0].semver===n)return!0;e=r.includePrerelease?c:l}if(1===t.length&&t[0].semver===n){if(r.includePrerelease)return!0;t=l}const s=new Set;let i,u,f,p,g,m,v;for(const t of e)">"===t.operator||">="===t.operator?i=d(i,t,r):"<"===t.operator||"<="===t.operator?u=h(u,t,r):s.add(t.semver);if(s.size>1)return null;if(i&&u){if(f=a(i.semver,u.semver,r),f>0)return null;if(0===f&&(">="!==i.operator||"<="!==u.operator))return null}for(const e of s){if(i&&!o(e,String(i),r))return null;if(u&&!o(e,String(u),r))return null;for(const s of t)if(!o(e,String(s),r))return!1;return!0}let _=!(!u||r.includePrerelease||!u.semver.prerelease.length)&&u.semver,y=!(!i||r.includePrerelease||!i.semver.prerelease.length)&&i.semver;_&&1===_.prerelease.length&&"<"===u.operator&&0===_.prerelease[0]&&(_=!1);for(const e of t){if(v=v||">"===e.operator||">="===e.operator,m=m||"<"===e.operator||"<="===e.operator,i)if(y&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===y.major&&e.semver.minor===y.minor&&e.semver.patch===y.patch&&(y=!1),">"===e.operator||">="===e.operator){if(p=d(i,e,r),p===e&&p!==i)return!1}else if(">="===i.operator&&!o(i.semver,String(e),r))return!1;if(u)if(_&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===_.major&&e.semver.minor===_.minor&&e.semver.patch===_.patch&&(_=!1),"<"===e.operator||"<="===e.operator){if(g=h(u,e,r),g===e&&g!==u)return!1}else if("<="===u.operator&&!o(u.semver,String(e),r))return!1;if(!e.operator&&(u||i)&&0!==f)return!1}return!(i&&m&&!u&&0!==f||u&&v&&!i&&0!==f||y||_)},d=(e,t,r)=>{if(!e)return t;const s=a(e.semver,t.semver,r);return s>0?e:s<0||">"===t.operator&&">="===e.operator?t:e},h=(e,t,r)=>{if(!e)return t;const s=a(e.semver,t.semver,r);return s<0?e:s>0||"<"===t.operator&&"<="===e.operator?t:e};e.exports=(e,t,r={})=>{if(e===t)return!0;e=new s(e,r),t=new s(t,r);let i=!1;e:for(const s of e.set){for(const e of t.set){const t=u(s,e,r);if(i=i||null!==t,t)continue e}if(i)return!1}return!0}},5200:(e,t,r)=>{"use strict";const s=r(560);e.exports=(e,t,r)=>s(e,t,r)<=0},5342:(e,t,r)=>{"use strict";const s=r(7075);e.exports=(e,t,r)=>s(e,t,"<",r)},5388:(e,t,r)=>{"use strict";const s=r(3908);e.exports=(e,t,r,i,n)=>{"string"==typeof r&&(n=i,i=r,r=void 0);try{return new s(e instanceof s?e.version:e,r).inc(t,i,n).version}catch(e){return null}}},5571:(e,t,r)=>{"use strict";const s=r(7075);e.exports=(e,t,r)=>s(e,t,">",r)},5580:(e,t,r)=>{"use strict";const s=r(560);e.exports=(e,t,r)=>s(e,t,r)>0},5982:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>n});var s=r(4818);class i extends s.default{static getDefaultConfig(){return{type:"custom:mushroom-entity-card",icon:"mdi:information",animate:!0,line_color:"green"}}constructor(e,t){super(e),this.configuration={...this.configuration,...i.getDefaultConfig(),...t}}}const n=i},5987:(e,t,r)=>{"use strict";r.d(t,{A:()=>_,k:()=>y});const s=JSON.parse('{"camera":{"all_cameras":"Alle Kameras","cameras":"Kameras"},"climate":{"all_climates":"Alle Klimaanlagen","climates":"Klimaanlagen"},"cover":{"all_covers":"Alle Abdeckungen","covers":"Abdeckungen"},"fan":{"all_fans":"Alle Ventilatoren","fans":"Ventilatoren"},"generic":{"all":"Alle","areas":"Bereiche","busy":"Beschäftigt","good_afternoon":"Guten Nachmittag","good_evening":"Guten Abend","good_morning":"Guten Morgen","hello":"Hallo","home":"Start","miscellaneous":"Sonstiges","numbers":"Zahlen","off":"Aus","on":"Ein","open":"Offen","unavailable":"Nicht verfügbar","unclosed":"Nicht Geschlossen","undisclosed":"Sonstiges","unknown":"Unbekannt"},"input_select":{"input_selects":"Auswahl-Eingaben"},"light":{"all_lights":"Alle Leuchten","lights":"Leuchten"},"lock":{"locked":"Gesperrt","all_locks":"Alle Schlösser","locks":"Schlösser","unlocked":"Entsperrt"},"media_player":{"media_players":"Wiedergabegeräte"},"scene":{"scenes":"Szenen"},"select":{"selects":"Auswahlen"},"sensor":{"binary":"Binäre","sensors":"Sensoren"},"switch":{"all_switches":"Alle Schalter","switches":"Schalter"},"vacuum":{"all_vacuums":"Alle Staubsauger","vacuums":"Staubsauger"},"valve":{"all_valves":"Alle Ventile","valves":"Ventile","open":"Offen","opening":"Öffnet","closed":"Geschlossen","closing":"Schließt","stopped":"Gestoppt","unclosed":"Nicht geschlossen"}}');var i=r.t(s,2);const n=JSON.parse('{"camera":{"all_cameras":"All Cameras","cameras":"Cameras"},"climate":{"all_climates":"All Climates","climates":"Climates"},"cover":{"all_covers":"All Covers","covers":"Covers"},"fan":{"all_fans":"All Fans","fans":"Fans"},"generic":{"all":"All","areas":"Areas","busy":"Busy","good_afternoon":"Good afternoon","good_evening":"Good evening","good_morning":"Good morning","hello":"Hello","home":"Home","miscellaneous":"Miscellaneous","numbers":"Numbers","off":"Off","on":"On","open":"Open","unavailable":"Unavailable","unclosed":"Unclosed","undisclosed":"Other","unknown":"Unknown"},"input_select":{"input_selects":"Input Selects"},"light":{"all_lights":"All Lights","lights":"Lights"},"lock":{"all_locks":"All Locks","locked":"Locked","locks":"Locks","unlocked":"Unlocked"},"media_player":{"media_players":"Media Players"},"scene":{"scenes":"Scenes"},"select":{"selects":"Selects"},"sensor":{"binary":"Binary","sensors":"Sensors"},"switch":{"all_switches":"All Switches","switches":"Switches"},"vacuum":{"all_vacuums":"All Vacuums","vacuums":"Vacuums"},"valve":{"all_valves":"All Valves","valves":"Valves","open":"Open","opening":"Opening","closed":"Closed","closing":"Closing","stopped":"Stopped","unclosed":"Unclosed"}}');var o=r.t(n,2);const a=JSON.parse('{"camera":{"all_cameras":"Todas las Cámaras","cameras":"Cámaras"},"climate":{"all_climates":"Todos los Termostatos","climates":"Termostatos"},"cover":{"all_covers":"Todas las Cubiertas","covers":"Cubiertas"},"fan":{"all_fans":"Todos los Ventiladores","fans":"Ventiladores"},"generic":{"all":"Todo","areas":"Áreas","busy":"Ocupado","good_afternoon":"Buenas tardes","good_evening":"Buenas noches","good_morning":"Buenos días","hello":"Hola","home":"Inicio","miscellaneous":"Varios","numbers":"Números","off":"Apagado","on":"Encendido","open":"Abierto","unavailable":"No Disponible","unclosed":"Sin Cerrar","undisclosed":"Varios","unknown":"Desconocido"},"input_select":{"input_selects":"Selecciones de Entrada"},"light":{"all_lights":"Todas las Luces","lights":"Luces"},"lock":{"all_locks":"Todas las Candados","locked":"Locked","locks":"Candados","unlocked":"Desbloqueado"},"media_player":{"media_players":"Reproductores Multimedia"},"scene":{"scenes":"Scenas"},"select":{"selects":"Seleccionar"},"sensor":{"binary":"Binario","sensors":"Sensores"},"switch":{"all_switches":"Todos los Apagadores","switches":"Apagadores"},"vacuum":{"all_vacuums":"Todas las Aspiradoras","vacuums":"Aspiradoras"},"valve":{"all_valves":"Todas las válvulas","valves":"Válvulas","open":"Abierta","opening":"Abriendo","closed":"Cerrada","closing":"Cerrando","stopped":"Detenida","unclosed":"No Cerrada"}}');var c=r.t(a,2);const l=JSON.parse('{"camera":{"all_cameras":"Alle Cameras","cameras":"Cameras"},"climate":{"all_climates":"Alle Klimaatregelingen","climates":"Klimaatregelingen"},"cover":{"all_covers":"Alle Bedekkingen","covers":"Bedekkingen"},"fan":{"all_fans":"Alle Ventilatoren","fans":"Ventilatoren"},"generic":{"all":"Alle","areas":"Ruimtes","busy":"Bezig","good_afternoon":"Goedemiddag","good_evening":"Goedeavond","good_morning":"Goedemorgen","hello":"Hallo","home":"Start","miscellaneous":"Overige","numbers":"Nummers","off":"Uit","on":"Aan","open":"Open","unavailable":"Onbeschikbaar","unclosed":"Niet Gesloten","undisclosed":"Overige","unknown":"Onbekend"},"input_select":{"input_selects":"Lijsten"},"light":{"all_lights":"Alle Lampen","lights":"Lampen"},"lock":{"all_locks":"Alle Sloten","locked":"Vergrendeld","locks":"Sloten","unlocked":"Ontgrendeld"},"media_player":{"media_players":"Mediaspelers"},"scene":{"scenes":"Scenes"},"select":{"selects":"Statuslijsten"},"sensor":{"binary":"Binaire","sensors":"Sensoren"},"switch":{"all_switches":"Alle Schakelaars","switches":"Schakelaars"},"vacuum":{"all_vacuums":"Alle Afzuiging","vacuums":"Afzuiging"},"valve":{"all_valves":"Alle kleppen","valves":"Kleppen","open":"Open","opening":"Openen","closed":"Gesloten","closing":"Sluiten","stopped":"Gestopt","unclosed":"Niet gesloten"}}');var u=r.t(l,2);const d=JSON.parse('{"camera":{"all_cameras":"Todas as câmeras","cameras":"Câmeras"},"climate":{"all_climates":"Todos os climatizadores","climates":"Climatizadores"},"cover":{"all_covers":"Todas as persianas","covers":"Persianas"},"fan":{"all_fans":"Todos os ventiladores","fans":"Ventiladores"},"generic":{"all":"Todos","areas":"Áreas","busy":"Ocupado","good_afternoon":"Boa tarde","good_evening":"Boa noite","good_morning":"Bom dia","hello":"Olá","home":"Início","miscellaneous":"Variados","numbers":"Números","off":"Desligado","on":"Ligado","open":"Aberto","unavailable":"Indisponível","unclosed":"Não fechado","undisclosed":"Outro","unknown":"Desconhecido"},"input_select":{"input_selects":"Seleção de entrada"},"light":{"all_lights":"Todas as luzes","lights":"Luzes"},"lock":{"all_locks":"Todas as fechaduras","locked":"Travado","locks":"Fechaduras","unlocked":"Destravado"},"media_player":{"media_players":"Reprodutores de mídia"},"scene":{"scenes":"Cenas"},"select":{"selects":"Seleção"},"sensor":{"binary":"Binário","sensors":"Sensores"},"switch":{"all_switches":"Todos os interruptores","switches":"Interruptores"},"vacuum":{"all_vacuums":"Todos os aspiradores","vacuums":"Aspiradores"},"valve":{"all_valves":"Todas as válvulas","valves":"Válvulas","open":"Aberto","opening":"Abrindo","closed":"Fechado","closing":"Fechando","stopped":"Parado","unclosed":"Nao fechado"}}');var h=r.t(d,2),f=r(6964);const p={de:i,en:o,es:c,nl:u,"pt-BR":h},g="en";function m(e,t){try{return e.split(".").reduce(((e,t)=>e[t]),p[t])}catch{return}}let v;function _(e){const t=e?.locale.language??g;v=e=>m(e,t)??m(e,g)??e}function y(e){return v?v(e):((0,f.OG)(f.br,"localize is not initialized! Call setupCustomLocalize first."),e)}},6170:(e,t,r)=>{"use strict";const s=r(3908),i=r(144),{safeRe:n,t:o}=r(9718);e.exports=(e,t)=>{if(e instanceof s)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let r=null;if((t=t||{}).rtl){const s=t.includePrerelease?n[o.COERCERTLFULL]:n[o.COERCERTL];let i;for(;(i=s.exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&i.index+i[0].length===r.index+r[0].length||(r=i),s.lastIndex=i.index+i[1].length+i[2].length;s.lastIndex=-1}else r=e.match(t.includePrerelease?n[o.COERCEFULL]:n[o.COERCE]);if(null===r)return null;const a=r[2],c=r[3]||"0",l=r[4]||"0",u=t.includePrerelease&&r[5]?`-${r[5]}`:"",d=t.includePrerelease&&r[6]?`+${r[6]}`:"";return i(`${a}.${c}.${l}${u}${d}`,t)}},6254:(e,t,r)=>{"use strict";const s=r(3908);e.exports=(e,t)=>new s(e,t).minor},6555:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>n});var s=r(4818);class i extends s.default{static getDefaultConfig(){return{type:"custom:mushroom-lock-card",icon:void 0}}constructor(e,t){super(e),this.configuration={...this.configuration,...i.getDefaultConfig(),...t}}}const n=i},6559:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>a});var s=r(1241),i=r(5987),n=r(1122);class o extends n.default{static getDefaultConfig(){return{title:(0,i.k)("climate.climates"),path:"climates",icon:"mdi:thermostat",subview:!1,headerCardConfiguration:{showControls:!1}}}static getViewHeaderCardConfig(){return{title:(0,i.k)("climate.all_climates"),subtitle:`${s.O.getCountTemplate(o.domain,"ne","off")} ${(0,i.k)("climate.climates")} `+(0,i.k)("generic.busy")}}constructor(e){super(),this.initializeViewConfig(o.getDefaultConfig(),e,o.getViewHeaderCardConfig())}}o.domain="climate";const a=o},6780:(e,t,r)=>{"use strict";const s=r(8311);e.exports=(e,t,r)=>(e=new s(e,r),t=new s(t,r),e.intersects(t,r))},6874:e=>{"use strict";const t=Number.MAX_SAFE_INTEGER||9007199254740991;e.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:t,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}},6953:(e,t,r)=>{"use strict";const s=r(144);e.exports=(e,t)=>{const r=s(e,t);return r?r.version:null}},6964:(e,t,r)=>{"use strict";r.d(t,{OG:()=>f,QC:()=>n,Ux:()=>h,WU:()=>o,ZY:()=>u,br:()=>c,nR:()=>l,tm:()=>a});var s,i=r(3007);!function(e){e[e.Off=0]="Off",e[e.Debug=1]="Debug",e[e.Info=2]="Info",e[e.Warn=3]="Warn",e[e.Error=4]="Error",e[e.Fatal=5]="Fatal"}(s||(s={}));const{Off:n,Debug:o,Info:a,Warn:c,Error:l,Fatal:u}=s;let d=s.Fatal;function h(e){d=e}function f(e,t,...r){if(d===s.Off||e>d)return;const n="Mushroom Strategy - An error occurred. Check the console (F12) for details.",o=`[${s[e].toUpperCase()}]`,a=r.map(i.G),c=`[at ${function(e){if(!e)return"unknown";const t=e.split("\n").filter(Boolean);for(let e=1;e{"use strict";const s=r(560);e.exports=(e,t,r)=>s(e,t,r)<0},7075:(e,t,r)=>{"use strict";const s=r(3908),i=r(3904),{ANY:n}=i,o=r(8311),a=r(7638),c=r(5580),l=r(7059),u=r(5200),d=r(4089);e.exports=(e,t,r,h)=>{let f,p,g,m,v;switch(e=new s(e,h),t=new o(t,h),r){case">":f=c,p=u,g=l,m=">",v=">=";break;case"<":f=l,p=d,g=c,m="<",v="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(a(e,t,h))return!1;for(let r=0;r{e.semver===n&&(e=new i(">=0.0.0")),o=o||e,a=a||e,f(e.semver,o.semver,h)?o=e:g(e.semver,a.semver,h)&&(a=e)})),o.operator===m||o.operator===v)return!1;if((!a.operator||a.operator===m)&&p(e,a.semver))return!1;if(a.operator===v&&g(e,a.semver))return!1}return!0}},7204:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>o});var s=r(5987),i=r(1122);class n extends i.default{static getDefaultConfig(){return{title:(0,s.k)("scene.scenes"),path:"scenes",icon:"mdi:palette",subview:!1,headerCardConfiguration:{showControls:!1}}}static getViewHeaderCardConfig(){return{}}constructor(e){super(),this.initializeViewConfig(n.getDefaultConfig(),e,n.getViewHeaderCardConfig())}}n.domain="scene";const o=n},7212:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>n});var s=r(4818);class i extends s.default{static getDefaultConfig(){return{type:"custom:mushroom-select-card",icon:void 0}}constructor(e,t){super(e),this.configuration={...this.configuration,...i.getDefaultConfig(),...t}}}const n=i},7272:e=>{"use strict";const t="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};e.exports=t},7414:(e,t,r)=>{"use strict";const s=r(144);e.exports=(e,t)=>{const r=s(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null}},7430:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>o});const s=["on_off","start_pause","stop","locate","clean_spot","return_home"];var i=r(4818);class n extends i.default{static getDefaultConfig(){return{type:"custom:mushroom-vacuum-card",icon:void 0,icon_animation:!0,commands:[...s],tap_action:{action:"more-info"}}}constructor(e,t){super(e),this.configuration={...this.configuration,...n.getDefaultConfig(),...t}}}const o=n},7547:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>a});var s=r(1241),i=r(5987),n=r(1122);class o extends n.default{static getDefaultConfig(){return{title:(0,i.k)("cover.covers"),path:"covers",icon:"mdi:window-open",subview:!1,headerCardConfiguration:{iconOn:"mdi:arrow-up",iconOff:"mdi:arrow-down",onService:"cover.open_cover",offService:"cover.close_cover"}}}static getViewHeaderCardConfig(){return{title:(0,i.k)("cover.all_covers"),subtitle:`${s.O.getCountTemplate(o.domain,"search","(open|opening|closing)")} ${(0,i.k)("cover.covers")} ${(0,i.k)("generic.unclosed")}`}}constructor(e){super(),this.initializeViewConfig(o.getDefaultConfig(),e,o.getViewHeaderCardConfig())}}o.domain="cover";const a=o},7631:(e,t,r)=>{"use strict";const s=r(8311);e.exports=(e,t)=>new s(e,t).set.map((e=>e.map((e=>e.value)).join(" ").trim().split(" ")))},7638:(e,t,r)=>{"use strict";const s=r(8311);e.exports=(e,t,r)=>{try{t=new s(t,r)}catch(e){return!1}return t.test(e)}},7688:(e,t,r)=>{"use strict";r.d(t,{ConfigurationDefaults:()=>i});var s=r(5987);const i={areas:{_:{type:"AreaCard"},undisclosed:{aliases:[],area_id:"undisclosed",created_at:0,floor_id:null,hidden:!1,humidity_entity_id:null,icon:"mdi:floor-plan",labels:[],modified_at:0,name:(0,s.k)("generic.undisclosed"),picture:null,temperature_entity_id:null,order:1/0}},card_options:{},chips:{weather_entity:"auto",light_count:!0,fan_count:!0,cover_count:!0,switch_count:!0,climate_count:!0,extra_chips:[]},debug:!1,domains:{_:{hide_config_entities:void 0,hide_diagnostic_entities:void 0,showControls:!0,stack_count:1},binary_sensor:{title:`${(0,s.k)("sensor.binary")} `+(0,s.k)("sensor.sensors"),showControls:!1,hidden:!1,stack_count:2},camera:{title:(0,s.k)("camera.cameras"),showControls:!1,hidden:!1},climate:{title:(0,s.k)("climate.climates"),showControls:!1,hidden:!1},cover:{title:(0,s.k)("cover.covers"),iconOn:"mdi:arrow-up",iconOff:"mdi:arrow-down",onService:"cover.open_cover",offService:"cover.close_cover",hidden:!1},default:{title:(0,s.k)("generic.miscellaneous"),showControls:!1,hidden:!1},fan:{title:(0,s.k)("fan.fans"),iconOn:"mdi:fan",iconOff:"mdi:fan-off",onService:"fan.turn_on",offService:"fan.turn_off",hidden:!1},input_select:{title:(0,s.k)("input_select.input_selects"),showControls:!1,hidden:!1},light:{title:(0,s.k)("light.lights"),iconOn:"mdi:lightbulb",iconOff:"mdi:lightbulb-off",onService:"light.turn_on",offService:"light.turn_off",hidden:!1},lock:{title:(0,s.k)("lock.locks"),showControls:!1,hidden:!1},media_player:{title:(0,s.k)("media_player.media_players"),showControls:!1,hidden:!1},number:{title:(0,s.k)("generic.numbers"),showControls:!1,hidden:!1},scene:{title:(0,s.k)("scene.scenes"),showControls:!1,onService:"scene.turn_on",hidden:!1},select:{title:(0,s.k)("select.selects"),showControls:!1,hidden:!1},sensor:{title:(0,s.k)("sensor.sensors"),showControls:!1,hidden:!1},switch:{title:(0,s.k)("switch.switches"),iconOn:"mdi:power-plug",iconOff:"mdi:power-plug-off",onService:"switch.turn_on",offService:"switch.turn_off",hidden:!1},vacuum:{title:(0,s.k)("vacuum.vacuums"),iconOn:"mdi:robot-vacuum",iconOff:"mdi:robot-vacuum-off",onService:"vacuum.start",offService:"vacuum.stop",hidden:!1},valve:{title:(0,s.k)("valve.valves"),iconOn:"mdi:valve-open",iconOff:"mdi:valve-closed",onService:"valve.open_valve",offService:"valve.close_valve",hidden:!1}},extra_cards:[],extra_views:[],home_view:{hidden:[],stack_count:{_:2}},views:{camera:{order:7,hidden:!1},climate:{order:6,hidden:!1},cover:{order:4,hidden:!1},fan:{order:3,hidden:!1},home:{order:1,hidden:!1},light:{order:2,hidden:!1},lock:{order:10,hidden:!1},scene:{order:9,hidden:!1},switch:{order:5,hidden:!1},vacuum:{order:8,hidden:!1},valve:{order:11,hidden:!1}},quick_access_cards:[]}},7716:(e,t,r)=>{"use strict";e.exports=r(9589)},7757:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>o});var s=r(1241),i=r(8222);class n extends i.default{static getDefaultConfig(){return{type:"template",icon:"mdi:thermostat",icon_color:"orange",content:s.O.getCountTemplate("climate","ne","off"),tap_action:{action:"none"},hold_action:{action:"navigate",navigation_path:"climates"}}}constructor(e){super(),this.configuration={...this.configuration,...n.getDefaultConfig(),...e}}}const o=n},7935:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>a});var s=r(1241),i=r(5987),n=r(1122);class o extends n.default{static getDefaultConfig(){return{title:(0,i.k)("locks.locks"),path:"locks",icon:"mdi:lock-open",subview:!1,headerCardConfiguration:{iconOn:"mdi:lock-open",iconOff:"mdi:lock",onService:"lock.lock",offService:"lock.unlock"}}}static getViewHeaderCardConfig(){return{title:(0,i.k)("lock.all_locks"),subtitle:`${s.O.getCountTemplate(o.domain,"ne","locked")} ${(0,i.k)("lock.locks")} `+(0,i.k)("lock.unlocked")}}constructor(e){super(),this.initializeViewConfig(o.getDefaultConfig(),e,o.getViewHeaderCardConfig())}}o.domain="lock";const a=o},8033:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>n});var s=r(4818);class i extends s.default{static getDefaultConfig(){return{type:"custom:mushroom-cover-card",icon:void 0,show_buttons_control:!0,show_position_control:!0,show_tilt_position_control:!0}}constructor(e,t){super(e),this.configuration={...this.configuration,...i.getDefaultConfig(),...t}}}const n=i},8222:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>n});var s=r(1241),i=r(6964);const n=class{constructor(){this.configuration={type:"template"},s.O.initialized||(0,i.OG)(i.ZY,"Registry not initialized!")}getChipConfiguration(){return this.configuration}}},8254:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>o});var s=r(2700),i=r(4818);class n extends i.default{static getDefaultConfig(){return{type:"custom:mushroom-light-card",icon:void 0,show_brightness_control:!0,show_color_control:!0,show_color_temp_control:!0,use_light_color:!0,double_tap_action:{action:"call-service",perform_action:"light.turn_on",target:{entity_id:void 0},data:{rgb_color:[255,255,255]}}}}constructor(e,t){super(e);const r=n.getDefaultConfig();(0,s.eq)(r.double_tap_action)&&(r.double_tap_action.target={entity_id:e.entity_id}),this.configuration={...this.configuration,...r,...t}}}const o=n},8311:(e,t,r)=>{"use strict";const s=/\s+/g;class i{constructor(e,t){if(t=o(t),e instanceof i)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new i(e.raw,t);if(e instanceof a)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().replace(s," "),this.set=this.raw.split("||").map((e=>this.parseRange(e.trim()))).filter((e=>e.length)),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter((e=>!v(e[0]))),0===this.set.length)this.set=[e];else if(this.set.length>1)for(const e of this.set)if(1===e.length&&_(e[0])){this.set=[e];break}}this.formatted=void 0}get range(){if(void 0===this.formatted){this.formatted="";for(let e=0;e0&&(this.formatted+="||");const t=this.set[e];for(let e=0;e0&&(this.formatted+=" "),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){const t=((this.options.includePrerelease&&g)|(this.options.loose&&m))+":"+e,r=n.get(t);if(r)return r;const s=this.options.loose,i=s?u[d.HYPHENRANGELOOSE]:u[d.HYPHENRANGE];e=e.replace(i,R(this.options.includePrerelease)),c("hyphen replace",e),e=e.replace(u[d.COMPARATORTRIM],h),c("comparator trim",e),e=e.replace(u[d.TILDETRIM],f),c("tilde trim",e),e=e.replace(u[d.CARETTRIM],p),c("caret trim",e);let o=e.split(" ").map((e=>w(e,this.options))).join(" ").split(/\s+/).map((e=>k(e,this.options)));s&&(o=o.filter((e=>(c("loose invalid filter",e,this.options),!!e.match(u[d.COMPARATORLOOSE]))))),c("range list",o);const l=new Map,_=o.map((e=>new a(e,this.options)));for(const e of _){if(v(e))return[e];l.set(e.value,e)}l.size>1&&l.has("")&&l.delete("");const y=[...l.values()];return n.set(t,y),y}intersects(e,t){if(!(e instanceof i))throw new TypeError("a Range is required");return this.set.some((r=>y(r,t)&&e.set.some((e=>y(e,t)&&r.every((r=>e.every((e=>r.intersects(e,t)))))))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new l(e,this.options)}catch(e){return!1}for(let t=0;t"<0.0.0-0"===e.value,_=e=>""===e.value,y=(e,t)=>{let r=!0;const s=e.slice();let i=s.pop();for(;r&&s.length;)r=s.every((e=>i.intersects(e,t))),i=s.pop();return r},w=(e,t)=>(c("comp",e,t),e=$(e,t),c("caret",e),e=O(e,t),c("tildes",e),e=S(e,t),c("xrange",e),e=I(e,t),c("stars",e),e),C=e=>!e||"x"===e.toLowerCase()||"*"===e,O=(e,t)=>e.trim().split(/\s+/).map((e=>E(e,t))).join(" "),E=(e,t)=>{const r=t.loose?u[d.TILDELOOSE]:u[d.TILDE];return e.replace(r,((t,r,s,i,n)=>{let o;return c("tilde",e,t,r,s,i,n),C(r)?o="":C(s)?o=`>=${r}.0.0 <${+r+1}.0.0-0`:C(i)?o=`>=${r}.${s}.0 <${r}.${+s+1}.0-0`:n?(c("replaceTilde pr",n),o=`>=${r}.${s}.${i}-${n} <${r}.${+s+1}.0-0`):o=`>=${r}.${s}.${i} <${r}.${+s+1}.0-0`,c("tilde return",o),o}))},$=(e,t)=>e.trim().split(/\s+/).map((e=>b(e,t))).join(" "),b=(e,t)=>{c("caret",e,t);const r=t.loose?u[d.CARETLOOSE]:u[d.CARET],s=t.includePrerelease?"-0":"";return e.replace(r,((t,r,i,n,o)=>{let a;return c("caret",e,t,r,i,n,o),C(r)?a="":C(i)?a=`>=${r}.0.0${s} <${+r+1}.0.0-0`:C(n)?a="0"===r?`>=${r}.${i}.0${s} <${r}.${+i+1}.0-0`:`>=${r}.${i}.0${s} <${+r+1}.0.0-0`:o?(c("replaceCaret pr",o),a="0"===r?"0"===i?`>=${r}.${i}.${n}-${o} <${r}.${i}.${+n+1}-0`:`>=${r}.${i}.${n}-${o} <${r}.${+i+1}.0-0`:`>=${r}.${i}.${n}-${o} <${+r+1}.0.0-0`):(c("no pr"),a="0"===r?"0"===i?`>=${r}.${i}.${n}${s} <${r}.${i}.${+n+1}-0`:`>=${r}.${i}.${n}${s} <${r}.${+i+1}.0-0`:`>=${r}.${i}.${n} <${+r+1}.0.0-0`),c("caret return",a),a}))},S=(e,t)=>(c("replaceXRanges",e,t),e.split(/\s+/).map((e=>A(e,t))).join(" ")),A=(e,t)=>{e=e.trim();const r=t.loose?u[d.XRANGELOOSE]:u[d.XRANGE];return e.replace(r,((r,s,i,n,o,a)=>{c("xRange",e,r,s,i,n,o,a);const l=C(i),u=l||C(n),d=u||C(o),h=d;return"="===s&&h&&(s=""),a=t.includePrerelease?"-0":"",l?r=">"===s||"<"===s?"<0.0.0-0":"*":s&&h?(u&&(n=0),o=0,">"===s?(s=">=",u?(i=+i+1,n=0,o=0):(n=+n+1,o=0)):"<="===s&&(s="<",u?i=+i+1:n=+n+1),"<"===s&&(a="-0"),r=`${s+i}.${n}.${o}${a}`):u?r=`>=${i}.0.0${a} <${+i+1}.0.0-0`:d&&(r=`>=${i}.${n}.0${a} <${i}.${+n+1}.0-0`),c("xRange return",r),r}))},I=(e,t)=>(c("replaceStars",e,t),e.trim().replace(u[d.STAR],"")),k=(e,t)=>(c("replaceGTE0",e,t),e.trim().replace(u[t.includePrerelease?d.GTE0PRE:d.GTE0],"")),R=e=>(t,r,s,i,n,o,a,c,l,u,d,h)=>`${r=C(s)?"":C(i)?`>=${s}.0.0${e?"-0":""}`:C(n)?`>=${s}.${i}.0${e?"-0":""}`:o?`>=${r}`:`>=${r}${e?"-0":""}`} ${c=C(l)?"":C(u)?`<${+l+1}.0.0-0`:C(d)?`<${l}.${+u+1}.0-0`:h?`<=${l}.${u}.${d}-${h}`:e?`<${l}.${u}.${+d+1}-0`:`<=${c}`}`.trim(),N=(e,t,r)=>{for(let r=0;r0){const s=e[r].semver;if(s.major===t.major&&s.minor===t.minor&&s.patch===t.patch)return!0}return!1}return!0}},8499:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>a});var s=r(1241),i=r(5987),n=r(1122);class o extends n.default{static getDefaultConfig(){return{title:(0,i.k)("vacuum.vacuums"),path:"vacuums",icon:"mdi:robot-vacuum",subview:!1,headerCardConfiguration:{iconOn:"mdi:robot-vacuum",iconOff:"mdi:robot-vacuum-off",onService:"vacuum.start",offService:"vacuum.stop"}}}static getViewHeaderCardConfig(){return{title:(0,i.k)("vacuum.all_vacuums"),subtitle:s.O.getCountTemplate(o.domain,"in","[cleaning, returning]")+` ${(0,i.k)("vacuum.vacuums")} ${(0,i.k)("generic.busy")}`}}constructor(e){super(),this.initializeViewConfig(o.getDefaultConfig(),e,o.getViewHeaderCardConfig())}}o.domain="vacuum";const a=o},8587:e=>{"use strict";const t=Object.freeze({loose:!0}),r=Object.freeze({});e.exports=e=>e?"object"!=typeof e?t:e:r},8721:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>n});var s=r(4818);class i extends s.default{static getDefaultConfig(){return{type:"custom:mushroom-climate-card",icon:void 0,hvac_modes:["off","cool","heat","fan_only"],show_temperature_control:!0}}constructor(e,t){super(e),this.configuration={...this.configuration,...i.getDefaultConfig(),...t}}}const n=i},8794:e=>{"use strict";e.exports=class{constructor(){this.max=1e3,this.map=new Map}get(e){const t=this.map.get(e);return void 0===t?void 0:(this.map.delete(e),this.map.set(e,t),t)}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&void 0!==t){if(this.map.size>=this.max){const e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}}},8868:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>o});var s=r(5987),i=r(4818);class n extends i.default{static getDefaultConfig(){return{type:"custom:mushroom-template-card",icon:"mdi:valve",icon_color:"blue",double_tap_action:{action:"toggle"}}}constructor(e,t){super(e);const r=n.getDefaultConfig();r.entity=e.entity_id,r.icon=e.icon??r.icon,r.primary=e.name??e.original_name??"?",r.secondary=`{% \n set mapping = {\n 'open': '${(0,s.k)("valve.open")}',\n 'opening': '${(0,s.k)("valve.opening")}',\n 'closed': '${(0,s.k)("valve.closed")}',\n 'closing': '${(0,s.k)("valve.closing")}',\n 'stopped': '${(0,s.k)("valve.stopped")}',\n 'unavailable': '${(0,s.k)("generic.unavailable")}'\n }\n %}\n {{ mapping.get(states('${e.entity_id}'), '${(0,s.k)("generic.unknown")}') }}`,this.configuration={...this.configuration,...r,...t}}}const o=n},9031:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>h});var s=r(1241),i=r(2700),n=r(3007),o=r(6964),a=r(5987),c=r(1122),l=r(2682),u=r(2737);class d extends c.default{constructor(e){super(),this.baseConfiguration={...this.baseConfiguration,...d.getDefaultConfig(),...e}}static getDefaultConfig(){return{title:(0,a.k)("generic.home"),icon:"mdi:home-assistant",path:"home",subview:!1}}async createCardConfigurations(){const e=[];let t,r,i;try{[t,r,i]=await Promise.all([this.createChipsSection(),this.createPersonsSection(),this.createAreasSection()])}catch(t){return(0,o.OG)(o.nR,"Error importing created sections!",t),e}return t&&e.push(t),r&&e.push(r),s.O.strategyOptions.home_view.hidden.includes("greeting")||e.push({type:"custom:mushroom-template-card",primary:`{% set time = now().hour %}\n {% if (time >= 18) %}\n ${(0,a.k)("generic.good_evening")},{{user}}!\n {% elif (time >= 12) %}\n ${(0,a.k)("generic.good_afternoon")}, {{user}}!\n {% elif (time >= 6) %}\n ${(0,a.k)("generic.good_morning")}, {{user}}!\n {% else %}\n ${(0,a.k)("generic.hello")}, {{user}}! {% endif %}`,icon:"mdi:hand-wave",icon_color:"orange",tap_action:{action:"none"},double_tap_action:{action:"none"},hold_action:{action:"none"}}),s.O.strategyOptions.quick_access_cards&&e.push(...s.O.strategyOptions.quick_access_cards),i&&e.push(i),s.O.strategyOptions.extra_cards&&e.push(...s.O.strategyOptions.extra_cards),[{type:"vertical-stack",cards:e}]}async createChipsSection(){if(s.O.strategyOptions.home_view.hidden.includes("chips"))return;const e=[],t=s.O.getExposedNames("chip");let a;const c="auto"===s.O.strategyOptions.chips.weather_entity?s.O.entities.find((e=>e.entity_id.startsWith("weather.")))?.entity_id:s.O.strategyOptions.chips.weather_entity;if(c)try{a=(await Promise.resolve().then(r.bind(r,1778))).default;const t=new a(c);e.push(t.getChipConfiguration())}catch(e){(0,o.OG)(o.nR,"Error importing chip weather!",e)}else(0,o.OG)(o.tm,"Weather chip has no entities available.");for(const c of t){if(!(0,i.ln)(c)||!new l.A(s.O.entities).whereDomain(c).count()){(0,o.OG)(o.tm,`Chip for domain ${c} is unsupported or has no entities available.`);continue}const t=(0,n.p)(c+"Chip");try{a=(await r(1216)(`./${t}`)).default;const s=new a;e.push(s.getChipConfiguration())}catch(e){(0,o.OG)(o.nR,`Error importing chip ${c}!`,e)}}return s.O.strategyOptions.chips?.extra_chips&&e.push(...s.O.strategyOptions.chips.extra_chips),{type:"custom:mushroom-chips-card",alignment:"center",chips:e}}async createPersonsSection(){if(s.O.strategyOptions.home_view.hidden.includes("persons"))return;const e=[],t=(await Promise.resolve().then(r.bind(r,845))).default;return e.push(...s.O.entities.filter((e=>e.entity_id.startsWith("person."))).map((e=>new t(e).getCard()))),{type:"vertical-stack",cards:(0,u.P)(e,s.O.strategyOptions.home_view.stack_count.persons??s.O.strategyOptions.home_view.stack_count._)}}async createAreasSection(){if(s.O.strategyOptions.home_view.hidden.includes("areas"))return;const e=[];for(const t of s.O.areas){const i=s.O.strategyOptions.areas[t.area_id]?.type??s.O.strategyOptions.areas._?.type??"default";let n;try{n=(await r(2560)(`./${i}`)).default}catch(e){n=(await Promise.resolve().then(r.bind(r,4301))).default,s.O.strategyOptions.debug&&"default"!==i&&(0,o.OG)(o.nR,`Error importing ${i}: card!`,e)}e.push(new n(t,{...s.O.strategyOptions.areas._,...s.O.strategyOptions.areas[t.area_id]}).getCard())}return{type:"vertical-stack",title:s.O.strategyOptions.home_view.hidden.includes("areasTitle")?void 0:(0,a.k)("generic.areas"),cards:(0,u.P)(e,s.O.strategyOptions.home_view.stack_count._,{"custom:mushroom-template-card":s.O.strategyOptions.home_view.stack_count.areas?.[0],area:s.O.strategyOptions.home_view.stack_count.areas?.[1]})}}}d.domain="home";const h=d},9042:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>n});var s=r(4818);class i extends s.default{static getDefaultConfig(){return{type:"area",area:""}}constructor(e,t){super(e);const r=i.getDefaultConfig();r.area=e.area_id,r.navigation_path=r.area,this.configuration={...this.configuration,...r,...t,type:r.type}}}const n=i},9304:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>a});var s=r(1241),i=r(5987),n=r(1122);class o extends n.default{static getDefaultConfig(){return{title:(0,i.k)("light.lights"),path:"lights",icon:"mdi:lightbulb-group",subview:!1,headerCardConfiguration:{iconOn:"mdi:lightbulb",iconOff:"mdi:lightbulb-off",onService:"light.turn_on",offService:"light.turn_off"}}}static getViewHeaderCardConfig(){return{title:(0,i.k)("light.all_lights"),subtitle:`${s.O.getCountTemplate(o.domain,"eq","on")} ${(0,i.k)("light.lights")} `+(0,i.k)("generic.on")}}constructor(e){super(),this.initializeViewConfig(o.getDefaultConfig(),e,o.getViewHeaderCardConfig())}}o.domain="light";const a=o},9555:(e,t,r)=>{var s={"./AbstractView":[1122,792],"./AbstractView.ts":[1122,792],"./CameraView":[1255,792],"./CameraView.ts":[1255,792],"./ClimateView":[6559,792],"./ClimateView.ts":[6559,792],"./CoverView":[7547,792],"./CoverView.ts":[7547,792],"./FanView":[245,792],"./FanView.ts":[245,792],"./HomeView":[9031,792],"./HomeView.ts":[9031,792],"./LightView":[9304,792],"./LightView.ts":[9304,792],"./LockView":[7935,792],"./LockView.ts":[7935,792],"./SceneView":[7204,792],"./SceneView.ts":[7204,792],"./SwitchView":[2464,792],"./SwitchView.ts":[2464,792],"./VacuumView":[8499,792],"./VacuumView.ts":[8499,792],"./ValveView":[9798,792],"./ValveView.ts":[9798,792]};function i(e){if(!r.o(s,e))return Promise.resolve().then((()=>{var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}));var t=s[e],i=t[0];return r.e(t[1]).then((()=>r(i)))}i.keys=()=>Object.keys(s),i.id=9555,e.exports=i},9589:(e,t,r)=>{"use strict";const s=r(9718),i=r(6874),n=r(3908),o=r(1123),a=r(144),c=r(6953),l=r(7414),u=r(5388),d=r(1832),h=r(2938),f=r(6254),p=r(4493),g=r(1729),m=r(560),v=r(9970),_=r(1763),y=r(909),w=r(3927),C=r(4277),O=r(5580),E=r(7059),$=r(4641),b=r(3999),S=r(4089),A=r(5200),I=r(2111),k=r(6170),R=r(3904),N=r(8311),L=r(7638),T=r(7631),D=r(9628),x=r(270),P=r(1261),V=r(3874),G=r(7075),M=r(5571),F=r(5342),j=r(6780),U=r(2525),H=r(5032);e.exports={parse:a,valid:c,clean:l,inc:u,diff:d,major:h,minor:f,patch:p,prerelease:g,compare:m,rcompare:v,compareLoose:_,compareBuild:y,sort:w,rsort:C,gt:O,lt:E,eq:$,neq:b,gte:S,lte:A,cmp:I,coerce:k,Comparator:R,Range:N,satisfies:L,toComparators:T,maxSatisfying:D,minSatisfying:x,minVersion:P,validRange:V,outside:G,gtr:M,ltr:F,intersects:j,simplifyRange:U,subset:H,SemVer:n,re:s.re,src:s.src,tokens:s.t,SEMVER_SPEC_VERSION:i.SEMVER_SPEC_VERSION,RELEASE_TYPES:i.RELEASE_TYPES,compareIdentifiers:o.compareIdentifiers,rcompareIdentifiers:o.rcompareIdentifiers}},9628:(e,t,r)=>{"use strict";const s=r(3908),i=r(8311);e.exports=(e,t,r)=>{let n=null,o=null,a=null;try{a=new i(t,r)}catch(e){return null}return e.forEach((e=>{a.test(e)&&(n&&-1!==o.compare(e)||(n=e,o=new s(n,r)))})),n}},9718:(e,t,r)=>{"use strict";const{MAX_SAFE_COMPONENT_LENGTH:s,MAX_SAFE_BUILD_LENGTH:i,MAX_LENGTH:n}=r(6874),o=r(7272),a=(t=e.exports={}).re=[],c=t.safeRe=[],l=t.src=[],u=t.safeSrc=[],d=t.t={};let h=0;const f="[a-zA-Z0-9-]",p=[["\\s",1],["\\d",n],[f,i]],g=(e,t,r)=>{const s=(e=>{for(const[t,r]of p)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e})(t),i=h++;o(e,i,t),d[e]=i,l[i]=t,u[i]=s,a[i]=new RegExp(t,r?"g":void 0),c[i]=new RegExp(s,r?"g":void 0)};g("NUMERICIDENTIFIER","0|[1-9]\\d*"),g("NUMERICIDENTIFIERLOOSE","\\d+"),g("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${f}*`),g("MAINVERSION",`(${l[d.NUMERICIDENTIFIER]})\\.(${l[d.NUMERICIDENTIFIER]})\\.(${l[d.NUMERICIDENTIFIER]})`),g("MAINVERSIONLOOSE",`(${l[d.NUMERICIDENTIFIERLOOSE]})\\.(${l[d.NUMERICIDENTIFIERLOOSE]})\\.(${l[d.NUMERICIDENTIFIERLOOSE]})`),g("PRERELEASEIDENTIFIER",`(?:${l[d.NONNUMERICIDENTIFIER]}|${l[d.NUMERICIDENTIFIER]})`),g("PRERELEASEIDENTIFIERLOOSE",`(?:${l[d.NONNUMERICIDENTIFIER]}|${l[d.NUMERICIDENTIFIERLOOSE]})`),g("PRERELEASE",`(?:-(${l[d.PRERELEASEIDENTIFIER]}(?:\\.${l[d.PRERELEASEIDENTIFIER]})*))`),g("PRERELEASELOOSE",`(?:-?(${l[d.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${l[d.PRERELEASEIDENTIFIERLOOSE]})*))`),g("BUILDIDENTIFIER",`${f}+`),g("BUILD",`(?:\\+(${l[d.BUILDIDENTIFIER]}(?:\\.${l[d.BUILDIDENTIFIER]})*))`),g("FULLPLAIN",`v?${l[d.MAINVERSION]}${l[d.PRERELEASE]}?${l[d.BUILD]}?`),g("FULL",`^${l[d.FULLPLAIN]}$`),g("LOOSEPLAIN",`[v=\\s]*${l[d.MAINVERSIONLOOSE]}${l[d.PRERELEASELOOSE]}?${l[d.BUILD]}?`),g("LOOSE",`^${l[d.LOOSEPLAIN]}$`),g("GTLT","((?:<|>)?=?)"),g("XRANGEIDENTIFIERLOOSE",`${l[d.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),g("XRANGEIDENTIFIER",`${l[d.NUMERICIDENTIFIER]}|x|X|\\*`),g("XRANGEPLAIN",`[v=\\s]*(${l[d.XRANGEIDENTIFIER]})(?:\\.(${l[d.XRANGEIDENTIFIER]})(?:\\.(${l[d.XRANGEIDENTIFIER]})(?:${l[d.PRERELEASE]})?${l[d.BUILD]}?)?)?`),g("XRANGEPLAINLOOSE",`[v=\\s]*(${l[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[d.XRANGEIDENTIFIERLOOSE]})(?:${l[d.PRERELEASELOOSE]})?${l[d.BUILD]}?)?)?`),g("XRANGE",`^${l[d.GTLT]}\\s*${l[d.XRANGEPLAIN]}$`),g("XRANGELOOSE",`^${l[d.GTLT]}\\s*${l[d.XRANGEPLAINLOOSE]}$`),g("COERCEPLAIN",`(^|[^\\d])(\\d{1,${s}})(?:\\.(\\d{1,${s}}))?(?:\\.(\\d{1,${s}}))?`),g("COERCE",`${l[d.COERCEPLAIN]}(?:$|[^\\d])`),g("COERCEFULL",l[d.COERCEPLAIN]+`(?:${l[d.PRERELEASE]})?`+`(?:${l[d.BUILD]})?(?:$|[^\\d])`),g("COERCERTL",l[d.COERCE],!0),g("COERCERTLFULL",l[d.COERCEFULL],!0),g("LONETILDE","(?:~>?)"),g("TILDETRIM",`(\\s*)${l[d.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",g("TILDE",`^${l[d.LONETILDE]}${l[d.XRANGEPLAIN]}$`),g("TILDELOOSE",`^${l[d.LONETILDE]}${l[d.XRANGEPLAINLOOSE]}$`),g("LONECARET","(?:\\^)"),g("CARETTRIM",`(\\s*)${l[d.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",g("CARET",`^${l[d.LONECARET]}${l[d.XRANGEPLAIN]}$`),g("CARETLOOSE",`^${l[d.LONECARET]}${l[d.XRANGEPLAINLOOSE]}$`),g("COMPARATORLOOSE",`^${l[d.GTLT]}\\s*(${l[d.LOOSEPLAIN]})$|^$`),g("COMPARATOR",`^${l[d.GTLT]}\\s*(${l[d.FULLPLAIN]})$|^$`),g("COMPARATORTRIM",`(\\s*)${l[d.GTLT]}\\s*(${l[d.LOOSEPLAIN]}|${l[d.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",g("HYPHENRANGE",`^\\s*(${l[d.XRANGEPLAIN]})\\s+-\\s+(${l[d.XRANGEPLAIN]})\\s*$`),g("HYPHENRANGELOOSE",`^\\s*(${l[d.XRANGEPLAINLOOSE]})\\s+-\\s+(${l[d.XRANGEPLAINLOOSE]})\\s*$`),g("STAR","(<|>)?=?\\s*\\*"),g("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),g("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")},9798:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>a});var s=r(1241),i=r(5987),n=r(1122);class o extends n.default{constructor(e){super(),this.initializeViewConfig(o.getDefaultConfig(),e,o.getViewHeaderCardConfig())}static getDefaultConfig(){return{title:(0,i.k)("valve.valves"),path:"valves",icon:"mdi:valve",subview:!1,headerCardConfiguration:{iconOn:"mdi:valve-open",iconOff:"mdi:valve-closed",onService:"valve.open_valve",offService:"valve.close_valve"}}}static getViewHeaderCardConfig(){return{title:(0,i.k)("valve.all_valves"),subtitle:s.O.getCountTemplate(o.domain,"in","[closed]")+` ${(0,i.k)("valve.valves")} ${(0,i.k)("valve.unclosed")}`}}}o.domain="valve";const a=o},9879:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>n});var s=r(4818);class i extends s.default{static getDefaultConfig(){return{type:"custom:mushroom-media-player-card",use_media_info:!0,media_controls:["on_off","play_pause_stop"],show_volume_level:!0,volume_controls:["volume_mute","volume_set","volume_buttons"]}}constructor(e,t){super(e),this.configuration={...this.configuration,...i.getDefaultConfig(),...t}}}const n=i},9908:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>a});var s=r(1241),i=r(8222),n=r(2682);class o extends i.default{static getDefaultConfig(){return{type:"template",icon:"mdi:dip-switch",icon_color:"blue",content:s.O.getCountTemplate("switch","eq","on"),tap_action:{action:"perform-action",perform_action:"switch.turn_off",target:{entity_id:new n.A(s.O.entities).whereDomain("switch").getValuesByProperty("entity_id")}},hold_action:{action:"navigate",navigation_path:"switches"}}}constructor(e){super(),this.configuration={...this.configuration,...o.getDefaultConfig(),...e}}}const a=o},9970:(e,t,r)=>{"use strict";const s=r(560);e.exports=(e,t,r)=>s(t,e,r)}},s={};function i(e){var t=s[e];if(void 0!==t)return t.exports;var n=s[e]={exports:{}};return r[e](n,n.exports,i),n.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(r,s){if(1&s&&(r=this(r)),8&s)return r;if("object"==typeof r&&r){if(4&s&&r.__esModule)return r;if(16&s&&"function"==typeof r.then)return r}var n=Object.create(null);i.r(n);var o={};e=e||[null,t({}),t([]),t(t)];for(var a=2&s&&r;"object"==typeof a&&!~e.indexOf(a);a=t(a))Object.getOwnPropertyNames(a).forEach((e=>o[e]=()=>r[e]));return o.default=()=>r,i.d(n,o),n},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.e=()=>Promise.resolve(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{"use strict";var e=i(4137),t=i(5982),r=i(1241),s=i(2700),n=i(3007),o=i(6964),a=i(2682),c=i(2737);class l{constructor(e,t=l.DEFAULT_NAMESPACE){this.hass=e,this.namespace=t}async showNotification(e,t,r={}){if(this.hasBeenShown(e))return;const s=this.compileStorageKey(e,r.storageKey),i=r.hassId||s,n=r.title||l.DEFAULT_TITLE;try{await this.hass.callService("persistent_notification","create",{title:n,message:t,notification_id:i}),this.markAsShown(e,r.version||"1.0.0",i)}catch(r){(0,o.OG)(o.nR,`Failed to show notification '${e}'!`,r),(0,o.OG)(o.tm,`[${n}] ${t}`)}}async dismissNotification(e,t){e=this.compileStorageKey(e,t);try{const t=localStorage.getItem(e),r=t?JSON.parse(t):null;if(localStorage.removeItem(e),r?.hassId)return void await this.hass.callService("persistent_notification","dismiss",{notification_id:r.hassId});(0,o.OG)(o.WU,`Notification '${e}' cleared from storage!`)}catch(t){(0,o.OG)(o.nR,`Failed to clear notification '${e}'!`,t)}}hasBeenShown(e,t){e=this.compileStorageKey(e,t);try{const t=localStorage.getItem(e);return!!t&&JSON.parse(t).shown}catch{return!1}}compileStorageKey(e,t){return t||`${this.namespace||l.DEFAULT_NAMESPACE}_${e}`}markAsShown(e,t,r){e=this.compileStorageKey(e);const s={shown:!0,timestamp:(new Date).toISOString(),version:t,hassId:r};try{localStorage.setItem(e,JSON.stringify(s))}catch(e){(0,o.OG)(o.nR,"Failed to save the notification state!",e)}}}l.DEFAULT_NAMESPACE="mushroom_strategy",l.DEFAULT_TITLE="Mushroom Strategy Notification";var u=i(7716),d=i.n(u);const h=[{storageKey:"chips_deprecation",title:"Mushroom Strategy",message:"## Deprecation Notice\nAs of v3.0.0, chips are replaced by badges.\nFrom that version on, you must rename all `chip` or `chips` references and settings in your YAML configuration.\nThe [documentation](https://digilive.github.io/mushroom-strategy/options/home-view-options/) will be updated accordingly.",fromVersion:"2.3.5",toVersion:"3.0.0"}];class f extends HTMLTemplateElement{static async generateDashboard(e){await r.O.initialize(e),await f.handleNotifications(e.hass);const t=[],a=r.O.getExposedNames("view").filter(s.uS).map((async e=>{try{const t=(0,n.p)(`${e}View`),s=new(0,(await i(9555)(`./${t}`)).default)(r.O.strategyOptions.views[e]),a=await s.getView();if(a.cards.length)return a;(0,o.OG)(o.tm,`View ${e} has no entities available!`)}catch(t){(0,o.OG)(o.nR,`Error importing ${e} view!`,t)}return null})),c=(await Promise.all(a)).filter(Boolean);return t.push(...c),r.O.strategyOptions.extra_views&&(t.push(...r.O.strategyOptions.extra_views),t.sort(((e,t)=>(e.order??1/0)-(t.order??1/0)||(e.title??"").localeCompare(t.title??"")))),t.push(...r.O.areas.map((e=>({title:e.name,path:e.area_id,subview:!0,hidden:e.hidden??!1,order:e.order??1/0,strategy:{type:"custom:mushroom-strategy",options:{area:e}}})))),{views:t}}static async generateView(l){const u=r.O.getExposedNames("domain"),d=l.view.strategy?.options?.area??{},h=new a.A(r.O.entities).whereAreaId(d.area_id).toList(),f=[...d.extra_cards??[]],p={area_id:[d.area_id]},g=u.filter(s.dQ).map((async s=>{const l=(0,n.p)(s+"Card"),u=new a.A(h).whereDomain(s).where((e=>!("switch"===s&&e.entity_id.endsWith("_stateful_scene")))).toList();if(!u.length)return null;const d=new e.default({entity_id:u.map((e=>e.entity_id))},{...r.O.strategyOptions.domains._,...r.O.strategyOptions.domains[s]}).createCard();try{const e=(await i(2560)(`./${l}`)).default;if("sensor"===s){let e=u.filter((e=>r.O.hassStates[e.entity_id]?.attributes.unit_of_measurement)).map((e=>{const s={...e.device_id&&r.O.strategyOptions.card_options?.[e.device_id],...r.O.strategyOptions.card_options?.[e.entity_id],type:"custom:mini-graph-card",entities:[e.entity_id]};return new t.default(e,s).getCard()}));return e.length?(e=(0,c.P)(e,r.O.strategyOptions.domains[s].stack_count??r.O.strategyOptions.domains._.stack_count),{type:"vertical-stack",cards:[d,...e]}):null}let n=u.map((t=>{const s={...t.device_id&&r.O.strategyOptions.card_options?.[t.device_id],...r.O.strategyOptions.card_options?.[t.entity_id]};return new e(t,s).getCard()}));return n=(0,c.P)(n,r.O.strategyOptions.domains[s].stack_count??r.O.strategyOptions.domains._.stack_count),n.length?{type:"vertical-stack",cards:[d,...n]}:null}catch(e){return(0,o.OG)(o.nR,`Error creating card configurations for domain ${s}`,e),null}})),m=(await Promise.all(g)).filter(Boolean);if(f.push(...m),!r.O.strategyOptions.domains.default.hidden){const t=new a.A(h).not().where((e=>(0,s.dQ)(e.entity_id.split(".",1)[0]))).toList();if(t.length)try{const s=(await Promise.resolve().then(i.bind(i,4486))).default;let n=t.map((e=>new s(e,r.O.strategyOptions.card_options?.[e.entity_id]).getCard()));const o=new e.default(p,{...r.O.strategyOptions.domains._,...r.O.strategyOptions.domains.default}).createCard();n.length&&(n=(0,c.P)(n,r.O.strategyOptions.domains.default.stack_count??r.O.strategyOptions.domains._.stack_count),f.push({type:"vertical-stack",cards:[o,...n]}))}catch(e){(0,o.OG)(o.nR,"Error creating card configurations for domain `miscellaneous`",e)}}return{cards:f}}static async handleNotifications(e){const t=new l(e,"mushroom_strategy"),r=p.replace(/^v/,""),s=d().coerce(r)||"0.0.0";try{await Promise.all(h.map((async e=>d().gte(s,e.fromVersion)&&d().lte(s,e.toVersion)?t.showNotification(e.storageKey,e.message,{title:e.title,version:r}):t.dismissNotification(e.storageKey))))}catch(e){(0,o.OG)(o.nR,"Error while handling persistent notifications for Mushroom Strategy",e)}}}customElements.define("ll-strategy-mushroom-strategy",f);const p="v2.3.5";console.info("%c Mushroom Strategy %c ".concat(p," "),"color: white; background: coral; font-weight: 700;","color: coral; background: white; font-weight: 700;")})()})(); \ No newline at end of file diff --git a/src/mushroom-strategy.ts b/src/mushroom-strategy.ts index 5d42585..6254f1c 100644 --- a/src/mushroom-strategy.ts +++ b/src/mushroom-strategy.ts @@ -14,7 +14,7 @@ import { ViewInfo, } from './types/strategy/strategy-generics'; import { sanitizeClassName } from './utilities/auxiliaries'; -import { logMessage, lvlError, lvlInfo } from './utilities/debug'; +import { logMessage, lvlError } from './utilities/debug'; import RegistryFilter from './utilities/RegistryFilter'; import { stackHorizontal } from './utilities/cardStacking'; import { PersistentNotification } from './utilities/PersistentNotification'; @@ -57,13 +57,8 @@ class MushroomStrategy extends HTMLTemplateElement { const moduleName = sanitizeClassName(`${viewName}View`); const View = (await import(`./views/${moduleName}`)).default; const currentView = new View(Registry.strategyOptions.views[viewName]); - const viewConfiguration = await currentView.getView(); - if (viewConfiguration.cards.length) { - return viewConfiguration; - } - - logMessage(lvlInfo, `View ${viewName} has no entities available!`); + return await currentView.getView(); } catch (e) { logMessage(lvlError, `Error importing ${viewName} view!`, e); } diff --git a/src/utilities/cardStacking.ts b/src/utilities/cardStacking.ts index 61b462f..d8a9a3d 100644 --- a/src/utilities/cardStacking.ts +++ b/src/utilities/cardStacking.ts @@ -26,7 +26,7 @@ export function stackHorizontal( defaultCount: number = 2, columnCounts?: { [key: string]: number | undefined; - }, + } ): LovelaceCardConfig[] { if (cardConfigurations.length <= 1) { return cardConfigurations; diff --git a/src/views/AbstractView.ts b/src/views/AbstractView.ts index bb29e5e..5db581c 100644 --- a/src/views/AbstractView.ts +++ b/src/views/AbstractView.ts @@ -11,6 +11,7 @@ import { sanitizeClassName } from '../utilities/auxiliaries'; import { logMessage, lvlFatal } from '../utilities/debug'; import RegistryFilter from '../utilities/RegistryFilter'; import { stackHorizontal } from '../utilities/cardStacking'; +import { LovelaceSectionRawConfig } from '../types/homeassistant/data/lovelace/config/section'; /** * Abstract View Class. @@ -34,10 +35,6 @@ abstract class AbstractView { type: '', }; - protected get domain(): SupportedDomains | 'home' { - return (this.constructor as unknown as ViewConstructor).domain; - } - /** * Class constructor. * @@ -50,10 +47,40 @@ abstract class AbstractView { } } + protected get domain(): SupportedDomains | 'home' { + return (this.constructor as unknown as ViewConstructor).domain; + } + + // noinspection JSUnusedGlobalSymbols Methodd is dynamically called. + /** + * Get a view configuration. + * + * The configuration includes the card configurations which are created by createCardConfigurations(). + */ + async getView(): Promise { + const sectionsCards = await this.createSections(); + + if (!sectionsCards.length) { + return false; + } + + if (this.domain === 'home') { + return { + ...this.baseConfiguration, + sections: sectionsCards, + }; + } + + return { + ...this.baseConfiguration, + cards: sectionsCards as LovelaceCardConfig[], + }; + } + /** * Create the configuration of the cards to include in the view. */ - protected async createCardConfigurations(): Promise { + protected async createSections(): Promise { const viewCards: LovelaceCardConfig[] = []; const moduleName = sanitizeClassName(this.domain + 'Card'); const DomainCard = (await import(`../cards/${moduleName}`)).default; @@ -82,8 +109,8 @@ abstract class AbstractView { // Create a card configuration for each entity in the current area. areaCards.push( ...areaEntities.map((entity) => - new DomainCard(entity, Registry.strategyOptions.card_options?.[entity.entity_id]).getCard(), - ), + new DomainCard(entity, Registry.strategyOptions.card_options?.[entity.entity_id]).getCard() + ) ); // Stack the cards of the current area. @@ -91,7 +118,7 @@ abstract class AbstractView { areaCards = stackHorizontal( areaCards, Registry.strategyOptions.domains[this.domain as SupportedDomains].stack_count ?? - Registry.strategyOptions.domains['_'].stack_count, + Registry.strategyOptions.domains['_'].stack_count ); // Create and insert a Header card. @@ -113,29 +140,6 @@ abstract class AbstractView { return viewCards; } - /** - * Get a view configuration. - * - * The configuration includes the card configurations which are created by createCardConfigurations(). - */ - async getView(): Promise { - return { - ...this.baseConfiguration, - cards: await this.createCardConfigurations(), - }; - } - - /** - * Get the domain's entity ids to target for a HASS service call. - */ - private getDomainTargets(): HassServiceTarget { - return { - entity_id: Registry.entities - .filter((entity) => entity.entity_id.startsWith(this.domain + '.')) - .map((entity) => entity.entity_id), - }; - } - /** * Initialize the view configuration with defaults and custom settings. * @@ -146,7 +150,7 @@ abstract class AbstractView { protected initializeViewConfig( viewConfiguration: ViewConfig, customConfiguration: ViewConfig = {}, - headerCardConfig: CustomHeaderCardConfig, + headerCardConfig: CustomHeaderCardConfig ): void { this.baseConfiguration = { ...this.baseConfiguration, ...viewConfiguration, ...customConfiguration }; @@ -162,6 +166,17 @@ abstract class AbstractView { ...headerCardConfig, }).createCard(); } + + /** + * Get the domain's entity ids to target for a HASS service call. + */ + private getDomainTargets(): HassServiceTarget { + return { + entity_id: Registry.entities + .filter((entity) => entity.entity_id.startsWith(this.domain + '.')) + .map((entity) => entity.entity_id), + }; + } } export default AbstractView; diff --git a/src/views/HomeView.ts b/src/views/HomeView.ts index 5e4f20e..2a405bb 100644 --- a/src/views/HomeView.ts +++ b/src/views/HomeView.ts @@ -1,8 +1,6 @@ // noinspection JSUnusedGlobalSymbols Class is dynamically imported. import { Registry } from '../Registry'; -import { ActionConfig } from '../types/homeassistant/data/lovelace/config/action'; -import { LovelaceCardConfig } from '../types/homeassistant/data/lovelace/config/card'; import { AreaCardConfig, StackCardConfig } from '../types/homeassistant/panels/lovelace/cards/types'; import { PersonCardConfig } from '../types/lovelace-mushroom/cards/person-card-config'; import { TemplateCardConfig } from '../types/lovelace-mushroom/cards/template-card-config'; @@ -13,9 +11,13 @@ import { logMessage, lvlError, lvlInfo } from '../utilities/debug'; import { localize } from '../utilities/localize'; import AbstractView from './AbstractView'; import registryFilter from '../utilities/RegistryFilter'; -import { stackHorizontal } from '../utilities/cardStacking'; import { LovelaceViewConfig } from '../types/homeassistant/data/lovelace/config/view'; import { LovelaceBadgeConfig } from '../types/homeassistant/data/lovelace/config/badge'; +import { LovelaceSectionRawConfig } from '../types/homeassistant/data/lovelace/config/section'; +import { ActionConfig } from '../types/homeassistant/data/lovelace/config/action'; +import HeaderCard from '../cards/HeaderCard'; +import { stackHorizontal } from '../utilities/cardStacking'; +import { LovelaceCardConfig } from '../types/homeassistant/data/lovelace/config/card'; /** * Home View Class. @@ -41,8 +43,8 @@ class HomeView extends AbstractView { // TODO: Move type and max_columns to the abstract class. static getDefaultConfig(): ViewConfig { return { - //type: 'sections', - //max_columns: 4, + type: 'sections', + max_columns: 3, header: { badges_position: 'top', layout: 'center', @@ -60,38 +62,8 @@ class HomeView extends AbstractView { * The configuration includes the card configurations which are created by createCardConfigurations(). */ async getView(): Promise { - return { - ...this.baseConfiguration, - badges: await this.createBadgeSection(), - cards: await this.createCardConfigurations(), - }; - } - - /** - * Create the configuration of the cards to include in the view. - * - * @override - */ - async createCardConfigurations(): Promise { - const homeViewCards: LovelaceCardConfig[] = []; - - let personsSection, areasSection; - - try { - [personsSection, areasSection] = await Promise.all([this.createPersonsSection(), this.createAreasSection()]); - } catch (e) { - logMessage(lvlError, 'Error importing created sections!', e); - - return homeViewCards; - } - - if (personsSection) { - homeViewCards.push(personsSection); - } - - // Create the greeting section. - if (!Registry.strategyOptions.home_view.hidden.includes('greeting')) { - homeViewCards.push({ + if (this.baseConfiguration.header && !Registry.strategyOptions.home_view.hidden.includes('greeting')) { + this.baseConfiguration.header.card = { type: 'custom:mushroom-template-card', primary: `{% set time = now().hour %} {% if (time >= 18) %} @@ -113,27 +85,76 @@ class HomeView extends AbstractView { hold_action: { action: 'none', } as ActionConfig, - } as TemplateCardConfig); + } as TemplateCardConfig; } - if (Registry.strategyOptions.quick_access_cards) { - homeViewCards.push(...Registry.strategyOptions.quick_access_cards); + return { + ...this.baseConfiguration, + badges: await this.createBadgeSection(), + sections: await this.createSections(), + }; + } + + /** + * Create the configuration of the cards to include in the view. + * + * @override + */ + async createSections(): Promise { + const MEDIA_QUERY = { + SMALL: '(max-width: 1343px)', + LARGE: '(min-width: 1344px)', + }; + const sections: LovelaceSectionRawConfig[] = []; + + const addSection = (title: string, cards: LovelaceCardConfig[], mediaQuery?: string) => { + const section: LovelaceSectionRawConfig = { + type: 'grid', + /*title: title,*/ // TODO: Property is deprecated. + cards: cards, + }; + + if (mediaQuery) { + section.visibility = [ + { + condition: 'screen', + media_query: mediaQuery, + }, + ]; + } + + sections.push(section); + }; + + try { + const [personCards, areaCards] = await Promise.all([this.createPersonCards(), this.createAreaCards()]); + + const sectionConfigurations = [ + ['Persons', [personCards], MEDIA_QUERY.SMALL, !!personCards], + ['Quick Access Wide', Registry.strategyOptions.quick_access_cards, MEDIA_QUERY.LARGE, true], + [ + 'Persons and Areas', + [personCards, areaCards].filter(Boolean), + MEDIA_QUERY.LARGE, + !!(personCards || areaCards), + ], + ['Quick Access Narrow', Registry.strategyOptions.quick_access_cards, MEDIA_QUERY.SMALL, true], + ['Areas', [areaCards], MEDIA_QUERY.SMALL, !!areaCards], + ['Extra', Registry.strategyOptions.extra_cards, undefined, true], + ] as const; + + sectionConfigurations.forEach(([title, cards, mediaQuery, condition]) => { + if (condition && cards.length) { + addSection(title, cards as LovelaceCardConfig[], mediaQuery); + return; + } + logMessage(lvlInfo, `Section ${title} has no entities available.`); + }); + } catch (e) { + logMessage(lvlError, 'Error importing section cards!', e); } - if (areasSection) { - homeViewCards.push(areasSection); - } - - if (Registry.strategyOptions.extra_cards) { - homeViewCards.push(...Registry.strategyOptions.extra_cards); - } - - return [ - { - type: 'vertical-stack', - cards: homeViewCards, - }, - ]; + return sections; } /** @@ -205,10 +226,9 @@ class HomeView extends AbstractView { * * If the section is marked as hidden in the strategy option, then the section is not created. */ - private async createPersonsSection(): Promise { + private async createPersonCards(): Promise { if (Registry.strategyOptions.home_view.hidden.includes('persons')) { - // The section is hidden. - + logMessage(lvlInfo, 'Persons section is hidden.'); return; } @@ -221,8 +241,13 @@ class HomeView extends AbstractView { .map((person) => new PersonCard(person).getCard()) ); + cardConfigurations.push(...cardConfigurations); + return { type: 'vertical-stack', + grid_options: { + columns: 'full', + }, cards: stackHorizontal( cardConfigurations, Registry.strategyOptions.home_view.stack_count['persons'] ?? Registry.strategyOptions.home_view.stack_count['_'] @@ -236,9 +261,9 @@ class HomeView extends AbstractView { * Area cards are grouped into two areas per row. * If the section is marked as hidden in the strategy option, then the section is not created. */ - private async createAreasSection(): Promise { + private async createAreaCards(): Promise { if (Registry.strategyOptions.home_view.hidden.includes('areas')) { - // Areas section is hidden. + logMessage(lvlInfo, 'Areas section is hidden.'); return; } @@ -269,9 +294,13 @@ class HomeView extends AbstractView { ); } + if (!Registry.strategyOptions.home_view.hidden.includes('areasTitle')) { + cardConfigurations.unshift(new HeaderCard({}, { title: localize('generic.areas') }).createCard()); + } + return { type: 'vertical-stack', - title: Registry.strategyOptions.home_view.hidden.includes('areasTitle') ? undefined : localize('generic.areas'), + columns: 'full', cards: stackHorizontal(cardConfigurations, Registry.strategyOptions.home_view.stack_count['_'], { 'custom:mushroom-template-card': Registry.strategyOptions.home_view.stack_count.areas?.[0], area: Registry.strategyOptions.home_view.stack_count.areas?.[1],