"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([[1360],{23682:(e,t,r)=>{function a(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}r.d(t,{Z:()=>a})},90394:(e,t,r)=>{function a(e){if(null===e||!0===e||!1===e)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}r.d(t,{Z:()=>a})},79021:(e,t,r)=>{r.d(t,{Z:()=>o});var a=r(90394),n=r(34327),s=r(23682);function o(e,t){(0,s.Z)(2,arguments);var r=(0,n.Z)(e),o=(0,a.Z)(t);return isNaN(o)?new Date(NaN):o?(r.setDate(r.getDate()+o),r):r}},59699:(e,t,r)=>{r.d(t,{Z:()=>i});var a=r(90394),n=r(39244),s=r(23682),o=36e5;function i(e,t){(0,s.Z)(2,arguments);var r=(0,a.Z)(t);return(0,n.Z)(e,r*o)}},39244:(e,t,r)=>{r.d(t,{Z:()=>o});var a=r(90394),n=r(34327),s=r(23682);function o(e,t){(0,s.Z)(2,arguments);var r=(0,n.Z)(e).getTime(),o=(0,a.Z)(t);return new Date(r+o)}},32182:(e,t,r)=>{r.d(t,{Z:()=>o});var a=r(90394),n=r(34327),s=r(23682);function o(e,t){(0,s.Z)(2,arguments);var r=(0,n.Z)(e),o=(0,a.Z)(t);if(isNaN(o))return new Date(NaN);if(!o)return r;var i=r.getDate(),c=new Date(r.getTime());c.setMonth(r.getMonth()+o+1,0);var u=c.getDate();return i>=u?c:(r.setFullYear(c.getFullYear(),c.getMonth(),i),r)}},93752:(e,t,r)=>{r.d(t,{Z:()=>s});var a=r(34327),n=r(23682);function s(e){(0,n.Z)(1,arguments);var t=(0,a.Z)(e);return t.setHours(23,59,59,999),t}},70390:(e,t,r)=>{r.d(t,{Z:()=>n});var a=r(93752);function n(){return(0,a.Z)(Date.now())}},47538:(e,t,r)=>{function a(){var e=new Date,t=e.getFullYear(),r=e.getMonth(),a=e.getDate(),n=new Date(0);return n.setFullYear(t,r,a-1),n.setHours(23,59,59,999),n}r.d(t,{Z:()=>a})},59429:(e,t,r)=>{r.d(t,{Z:()=>s});var a=r(34327),n=r(23682);function s(e){(0,n.Z)(1,arguments);var t=(0,a.Z)(e);return t.setHours(0,0,0,0),t}},13250:(e,t,r)=>{r.d(t,{Z:()=>s});var a=r(34327),n=r(23682);function s(e){(0,n.Z)(1,arguments);var t=(0,a.Z)(e);return t.setDate(1),t.setHours(0,0,0,0),t}},27088:(e,t,r)=>{r.d(t,{Z:()=>n});var a=r(59429);function n(){return(0,a.Z)(Date.now())}},83008:(e,t,r)=>{function a(){var e=new Date,t=e.getFullYear(),r=e.getMonth(),a=e.getDate(),n=new Date(0);return n.setFullYear(t,r,a-1),n.setHours(0,0,0,0),n}r.d(t,{Z:()=>a})},34327:(e,t,r)=>{r.d(t,{Z:()=>n});var a=r(23682);function n(e){(0,a.Z)(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new Date(e.getTime()):"number"==typeof e||"[object Number]"===t?new Date(e):("string"!=typeof e&&"[object String]"!==t||"undefined"==typeof console||(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://git.io/fjule"),console.warn((new Error).stack)),new Date(NaN))}},66054:(e,t,r)=>{r.a(e,(async e=>{r.r(t),r.d(t,{EnergyStrategy:()=>s});var a=r(55424),n=e([a]);a=(n.then?await n:n)[0];class s{static async generateView(e){const t=e.hass,n={cards:[]};let s;try{s=await(0,a.ZC)(t)}catch(e){return"not_found"===e.code?(async()=>(await Promise.all([r.e(878),r.e(8369)]).then(r.bind(r,55158)),{type:"panel",cards:[{type:"custom:energy-setup-wizard-card"}]}))():(n.cards.push({type:"markdown",content:`An error occured while fetching your energy preferences: ${e.message}.`}),n)}n.type="sidebar";const o=s.energy_sources.find((e=>"grid"===e.type)),i=o&&o.flow_to.length,c=s.energy_sources.some((e=>"solar"===e.type)),u=s.energy_sources.some((e=>"gas"===e.type));return e.narrow&&n.cards.push({type:"energy-date-selection",collection_key:"energy_dashboard",view_layout:{position:"sidebar"}}),o&&n.cards.push({title:t.localize("ui.panel.energy.cards.energy_usage_graph_title"),type:"energy-usage-graph",collection_key:"energy_dashboard"}),c&&n.cards.push({title:t.localize("ui.panel.energy.cards.energy_solar_graph_title"),type:"energy-solar-graph",collection_key:"energy_dashboard"}),u&&n.cards.push({title:t.localize("ui.panel.energy.cards.energy_gas_graph_title"),type:"energy-gas-graph",collection_key:"energy_dashboard"}),o&&n.cards.push({title:t.localize("ui.panel.energy.cards.energy_distribution_title"),type:"energy-distribution",view_layout:{position:"sidebar"},collection_key:"energy_dashboard"}),(o||c)&&n.cards.push({title:t.localize("ui.panel.energy.cards.energy_sources_table_title"),type:"energy-sources-table",collection_key:"energy_dashboard"}),i&&n.cards.push({type:"energy-grid-neutrality-gauge",view_layout:{position:"sidebar"},collection_key:"energy_dashboard"}),c&&i&&n.cards.push({type:"energy-solar-consumed-gauge",view_layout:{position:"sidebar"},collection_key:"energy_dashboard"}),o&&n.cards.push({type:"energy-carbon-consumed-gauge",view_layout:{position:"sidebar"},collection_key:"energy_dashboard"}),s.device_consumption.length&&n.cards.push({title:t.localize("ui.panel.energy.cards.energy_devices_graph_title"),type:"energy-devices-graph",collection_key:"energy_dashboard"}),n}}}))}}]);