Added Alexa Music

This commit is contained in:
francop committed 2026-07-17 10:12:15 -04:00
1 parent 92c5268dc8
commit 28a8cb98f6
757 files changed
+151171 -85450

No files matched your search

@@ -177,7 +177,7 @@ const ne=(e,t)=>"method"===t.kind&&t.descriptor&&!("value"in t.descriptor)?{...t
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/;class we{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,i){this._$Ct=e,this._$AM=t,this._$Ci=i}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}const ve="ontouchstart"in window||navigator.maxTouchPoints>0||navigator.maxTouchPoints>0;class ke extends HTMLElement{constructor(){super(),this.holdTime=500,this.held=!1,this.ripple=document.createElement("mwc-ripple")}connectedCallback(){Object.assign(this.style,{position:"absolute",width:ve?"100px":"50px",height:ve?"100px":"50px",transform:"translate(-50%, -50%)",pointerEvents:"none",zIndex:"999"}),this.appendChild(this.ripple),this.ripple.primary=!0,["touchcancel","mouseout","mouseup","touchmove","mousewheel","wheel","scroll"].forEach(e=>{document.addEventListener(e,()=>{clearTimeout(this.timer),this.stopAnimation(),this.timer=void 0},{passive:!0})})}bind(e,t){if(e.actionHandler)return;e.actionHandler=!0,e.addEventListener("contextmenu",e=>{const t=e||window.event;return t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.cancelBubble=!0,t.returnValue=!1,!1});const i=e=>{var t,i;this.held=!1;const r=null!==(t=e.pageX)&&void 0!==t?t:e.touches[0].pageX,s=null!==(i=e.pageY)&&void 0!==i?i:e.touches[0].pageY;this.timer=window.setTimeout(()=>{this.startAnimation(r,s),this.held=!0},this.holdTime)},r=i=>{i.preventDefault(),["touchend","touchcancel"].includes(i.type)&&void 0===this.timer||(clearTimeout(this.timer),this.stopAnimation(),this.timer=void 0,this.held?me(e,"action",{action:"hold"}):t.hasDoubleClick?"click"===i.type&&i.detail<2||!this.dblClickTimeout?this.dblClickTimeout=window.setTimeout(()=>{this.dblClickTimeout=void 0,me(e,"action",{action:"tap"})},250):(clearTimeout(this.dblClickTimeout),this.dblClickTimeout=void 0,me(e,"action",{action:"double_tap"})):me(e,"action",{action:"tap"}))};e.addEventListener("touchstart",i,{passive:!0}),e.addEventListener("touchend",r),e.addEventListener("touchcancel",r),e.addEventListener("mousedown",i,{passive:!0}),e.addEventListener("click",r),e.addEventListener("keyup",e=>{13===e.keyCode&&r(e)})}startAnimation(e,t){Object.assign(this.style,{left:`${e}px`,top:`${t}px`,display:null}),this.ripple.disabled=!1,this.ripple.active=!0,this.ripple.unbounded=!0}stopAnimation(){this.ripple.active=!1,this.ripple.disabled=!0,this.style.display="none"}}customElements.get("action-handler-clock-weather")||customElements.define("action-handler-clock-weather",ke);const xe=(e,t)=>{const i=(()=>{const e=document.body;if(e.querySelector("action-handler-clock-weather"))return e.querySelector("action-handler-clock-weather");const t=document.createElement("action-handler-clock-weather");return e.appendChild(t),t})();i&&i.bind(e,t)},Te=(e=>(...t)=>({_$litDirective$:e,values:t}))(class extends we{update(e,[t]){return xe(e.element,t),j}render(e){}});var Me={"clear-night":"صافي",cloudy:"غائم",fog:"ضباب",hail:"برد",lightning:"عواصف رعدية","lightning-rainy":"عواصف رعدية ممطرة",partlycloudy:"غائم جزئياً",pouring:"غزير",rainy:"ممطر",snowy:"ثلجي","snowy-rainy":"مطر ثلجي",sunny:"مشمس",windy:"عاصف","windy-variant":"رياح قوية",exceptional:"استثنائي"},Se={1:"الإثنين",2:"الثلاثاء",3:"الأربعاء",4:"الخميس",5:"الجمعة",6:"السبت",7:"الأحد"},_e={aqi:"مؤشر جودة الهواء",humidity:"رطوبة","feels-like":"يشعر كأنه"},Ne={weather:Me,day:Se,misc:_e},Oe=Object.freeze({__proto__:null,day:Se,default:Ne,misc:_e,weather:Me}),Ae={"clear-night":"Ясно",cloudy:"Облачно",fog:"Мъгла",hail:"Градушка",lightning:"Гръмотевични бури","lightning-rainy":"Дъждовни гръмотевични бури",partlycloudy:"Частична облачност",pouring:"Пороен дъжд",rainy:"Дъждовно",snowy:"Сняг","snowy-rainy":"Суграшица",sunny:"Слънчево",windy:"Ветровито","windy-variant":"Силен вятър",exceptional:"Изключително"},$e={1:"Пн",2:"Вт",3:"Ср",4:"Чт",5:"Пт",6:"Сб",7:"Нд"},Ze={aqi:"AQI",humidity:"Влажност","feels-like":"Усеща се като"},Ce={weather:Ae,day:$e,misc:Ze},Be=Object.freeze({__proto__:null,day:$e,default:Ce,misc:Ze,weather:Ae}),Ue={"clear-night":"Klart",cloudy:"Overskyet",fog:"Tåge",hail:"Hagl",lightning:"Lyn","lightning-rainy":"Regnvejr og lyn",partlycloudy:"Delvist overskyet",pouring:"Regnvejr",rainy:"Regnfuldt",snowy:"Sne","snowy-rainy":"Slud",sunny:"Solrigt",windy:"Blæsende","windy-variant":"Stærk vind",exceptional:"Kaos"},Ge={1:"Man",2:"Tir",3:"Ons",4:"Tor",5:"Fre",6:"Lør",7:"Søn"},Ve={aqi:"AQI",humidity:"luftfugtighed","feels-like":"Føles som"},Ee={weather:Ue,day:Ge,misc:Ve},De=Object.freeze({__proto__:null,day:Ge,default:Ee,misc:Ve,weather:Ue}),je={"clear-night":"Serè",cloudy:"Ennuvolat",fog:"Boira",hail:"Calamarsa",lightning:"Tempesta elèctrica","lightning-rainy":"Tempesta",partlycloudy:"Parcialment enLine truncated
*/;class we{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,i){this._$Ct=e,this._$AM=t,this._$Ci=i}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}const ve="ontouchstart"in window||navigator.maxTouchPoints>0||navigator.maxTouchPoints>0;class ke extends HTMLElement{constructor(){super(),this.holdTime=500,this.held=!1,this.ripple=document.createElement("mwc-ripple")}connectedCallback(){Object.assign(this.style,{position:"absolute",width:ve?"100px":"50px",height:ve?"100px":"50px",transform:"translate(-50%, -50%)",pointerEvents:"none",zIndex:"999"}),this.appendChild(this.ripple),this.ripple.primary=!0,["touchcancel","mouseout","mouseup","touchmove","mousewheel","wheel","scroll"].forEach(e=>{document.addEventListener(e,()=>{clearTimeout(this.timer),this.stopAnimation(),this.timer=void 0},{passive:!0})})}bind(e,t){if(e.actionHandler)return;e.actionHandler=!0,e.addEventListener("contextmenu",e=>{const t=e||window.event;return t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.cancelBubble=!0,t.returnValue=!1,!1});const i=e=>{var t,i;this.held=!1;const r=null!==(t=e.pageX)&&void 0!==t?t:e.touches[0].pageX,s=null!==(i=e.pageY)&&void 0!==i?i:e.touches[0].pageY;this.timer=window.setTimeout(()=>{this.startAnimation(r,s),this.held=!0},this.holdTime)},r=i=>{i.preventDefault(),["touchend","touchcancel"].includes(i.type)&&void 0===this.timer||(clearTimeout(this.timer),this.stopAnimation(),this.timer=void 0,this.held?me(e,"action",{action:"hold"}):t.hasDoubleClick?"click"===i.type&&i.detail<2||!this.dblClickTimeout?this.dblClickTimeout=window.setTimeout(()=>{this.dblClickTimeout=void 0,me(e,"action",{action:"tap"})},250):(clearTimeout(this.dblClickTimeout),this.dblClickTimeout=void 0,me(e,"action",{action:"double_tap"})):me(e,"action",{action:"tap"}))};e.addEventListener("touchstart",i,{passive:!0}),e.addEventListener("touchend",r),e.addEventListener("touchcancel",r),e.addEventListener("mousedown",i,{passive:!0}),e.addEventListener("click",r),e.addEventListener("keyup",e=>{13===e.keyCode&&r(e)})}startAnimation(e,t){Object.assign(this.style,{left:`${e}px`,top:`${t}px`,display:null}),this.ripple.disabled=!1,this.ripple.active=!0,this.ripple.unbounded=!0}stopAnimation(){this.ripple.active=!1,this.ripple.disabled=!0,this.style.display="none"}}customElements.get("action-handler-clock-weather")||customElements.define("action-handler-clock-weather",ke);const xe=(e,t)=>{const i=(()=>{const e=document.body;if(e.querySelector("action-handler-clock-weather"))return e.querySelector("action-handler-clock-weather");const t=document.createElement("action-handler-clock-weather");return e.appendChild(t),t})();i&&i.bind(e,t)},Te=(e=>(...t)=>({_$litDirective$:e,values:t}))(class extends we{update(e,[t]){return xe(e.element,t),j}render(e){}});var Me={"clear-night":"صافي",cloudy:"غائم",fog:"ضباب",hail:"برد",lightning:"عواصف رعدية","lightning-rainy":"عواصف رعدية ممطرة",partlycloudy:"غائم جزئياً",pouring:"غزير",rainy:"ممطر",snowy:"ثلجي","snowy-rainy":"مطر ثلجي",sunny:"مشمس",windy:"عاصف","windy-variant":"رياح قوية",exceptional:"استثنائي"},Se={1:"الإثنين",2:"الثلاثاء",3:"الأربعاء",4:"الخميس",5:"الجمعة",6:"السبت",7:"الأحد"},_e={aqi:"مؤشر جودة الهواء",humidity:"رطوبة","feels-like":"يشعر كأنه"},Ne={weather:Me,day:Se,misc:_e},Oe=Object.freeze({__proto__:null,day:Se,default:Ne,misc:_e,weather:Me}),Ae={"clear-night":"Ясно",cloudy:"Облачно",fog:"Мъгла",hail:"Градушка",lightning:"Гръмотевични бури","lightning-rainy":"Дъждовни гръмотевични бури",partlycloudy:"Частична облачност",pouring:"Пороен дъжд",rainy:"Дъждовно",snowy:"Сняг","snowy-rainy":"Суграшица",sunny:"Слънчево",windy:"Ветровито","windy-variant":"Силен вятър",exceptional:"Изключително"},$e={1:"Пн",2:"Вт",3:"Ср",4:"Чт",5:"Пт",6:"Сб",7:"Нд"},Ze={aqi:"AQI",humidity:"Влажност","feels-like":"Усеща се като"},Ce={weather:Ae,day:$e,misc:Ze},Be=Object.freeze({__proto__:null,day:$e,default:Ce,misc:Ze,weather:Ae}),Ue={"clear-night":"Klart",cloudy:"Overskyet",fog:"Tåge",hail:"Hagl",lightning:"Lyn","lightning-rainy":"Regnvejr og lyn",partlycloudy:"Delvist overskyet",pouring:"Regnvejr",rainy:"Regnfuldt",snowy:"Sne","snowy-rainy":"Slud",sunny:"Solrigt",windy:"Blæsende","windy-variant":"Stærk vind",exceptional:"Kaos"},Ge={1:"Man",2:"Tir",3:"Ons",4:"Tor",5:"Fre",6:"Lør",7:"Søn"},Ve={aqi:"AQI",humidity:"luftfugtighed","feels-like":"Føles som"},Ee={weather:Ue,day:Ge,misc:Ve},De=Object.freeze({__proto__:null,day:Ge,default:Ee,misc:Ve,weather:Ue}),je={"clear-night":"Serè",cloudy:"Ennuvolat",fog:"Boira",hail:"Calamarsa",lightning:"Tempesta elèctrica","lightning-rainy":"Tempesta",partlycloudy:"Parcialment enLine truncated
<ha-card
@action=${e=>{this.handleAction(e)}}
.actionHandler=${Te({hasHold:ye(this.config.hold_action),hasDoubleClick:ye(this.config.double_tap_action)})}
@@ -191,15 +191,15 @@ const ne=(e,t)=>"method"===t.kind&&t.descriptor&&!("value"in t.descriptor)?{...t
<div class="card-content">
${e?D`
<clock-weather-card-today>
${Rr(()=>this.renderToday())}
${Kr(()=>this.renderToday())}
</clock-weather-card-today>`:""}
${t?D`
<clock-weather-card-forecast>
${Rr(()=>this.renderForecast())}
${Kr(()=>this.renderForecast())}
</clock-weather-card-forecast>`:""}
</div>
</ha-card>
`}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this.subscribeForecastEvents()}disconnectedCallback(){super.disconnectedCallback(),this.unsubscribeForecastEvents()}willUpdate(e){super.willUpdate(e),this.forecastSubscriber||this.subscribeForecastEvents()}renderToday(){const e=this.getWeather(),t=e.state,i=this.config.show_decimal?this.getCurrentTemperature():Br(this.getCurrentTemperature()),r=e.attributes.temperature_unit,s=this.config.show_decimal?this.getApparentTemperature():Br(this.getApparentTemperature()),a=this.getAqi(),n=this.getAqiBackgroundColor(a),o=this.getAqiTextColor(a),l=Br(this.getCurrentHumidity()),c=this.config.weather_icon_type,d=this.toIcon(t,c,!1,this.getIconAnimationKind()),u=this.localize(`weather.${t}`),h=null!==i?this.toConfiguredTempWithUnit(r,i):null,m=null!==l?`${l}% ${this.localize("misc.humidity")}`:null,f=null!==s?this.toConfiguredTempWithUnit(r,s):null,p=this.localize("misc.feels-like"),y=this.localize("misc.aqi");return D`
`}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this.subscribeForecastEvents()}disconnectedCallback(){super.disconnectedCallback(),this.unsubscribeForecastEvents()}willUpdate(e){super.willUpdate(e),this.forecastSubscriber||this.subscribeForecastEvents()}renderToday(){const e=this.getWeather(),t=e.state,i=this.config.show_decimal?this.getCurrentTemperature():Er(this.getCurrentTemperature()),r=e.attributes.temperature_unit,s=this.config.show_decimal?this.getApparentTemperature():Er(this.getApparentTemperature()),a=this.getAqi(),n=this.getAqiBackgroundColor(a),o=this.getAqiTextColor(a),l=Er(this.getCurrentHumidity()),c=this.config.weather_icon_type,d=this.toIcon(t,c,!1,this.getIconAnimationKind()),u=this.localize(`weather.${t}`),h=null!==i?this.toConfiguredTempWithUnit(r,i):null,m=null!==l?`${l}% ${this.localize("misc.humidity")}`:null,f=null!==s?this.toConfiguredTempWithUnit(r,s):null,p=this.localize("misc.feels-like"),y=this.localize("misc.aqi");return D`
<clock-weather-card-today-left>
<img class="grow-img" src=${d} />
</clock-weather-card-today-left>
@@ -218,7 +218,7 @@ const ne=(e,t)=>"method"===t.kind&&t.descriptor&&!("value"in t.descriptor)?{...t
${this.config.hide_date?"":this.date()}
</clock-weather-card-today-right-wrap-bottom>
</clock-weather-card-today-right-wrap>
</clock-weather-card-today-right>`}renderForecast(){const e=this.getWeather(),t=Br(this.getCurrentTemperature()),i=this.config.forecast_rows,r=this.config.hourly_forecast,s=e.attributes.temperature_unit,a=this.mergeForecasts(i,r),n=a.map(e=>e.templow),o=a.map(e=>e.temperature);null!==t&&(n.push(t),o.push(t));const l=Math.round(Cr(n)),c=Math.round(Zr(o)),d=a.map(e=>e.datetime).map(e=>r?this.time(e):this.localize(`day.${e.weekday}`)),u=d.length?Zr(d.map(e=>e.length)):0;return a.map((e,i)=>Rr(()=>this.renderForecastItem(e,l,c,t,s,r,d[i],u)))}renderForecastItem(e,t,i,r,s,a,n,o){const l="pouring"===e.condition?"raindrops":"rainy"===e.condition?"raindrop":e.condition,c=this.toIcon(l,"fill",!0,"static"),d=this.getWeather().attributes.temperature_unit,u=a?hl.now().hour===e.datetime.hour:hl.now().day===e.datetime.day,h=Math.round(u&&null!==r?Math.min(r,e.templow):e.templow),m=Math.round(u&&null!==r?Math.max(r,e.temperature):e.temperature);return D`
</clock-weather-card-today-right>`}renderForecast(){const e=this.getWeather(),t=Er(this.getCurrentTemperature()),i=this.config.forecast_rows,r=this.config.hourly_forecast,s=e.attributes.temperature_unit,a=this.mergeForecasts(i,r),n=a.map(e=>e.templow),o=a.map(e=>e.temperature);null!==t&&(n.push(t),o.push(t));const l=Math.round(Vr(n)),c=Math.round(Gr(o)),d=a.map(e=>e.datetime).map(e=>r?this.time(e):this.localize(`day.${e.weekday}`)),u=d.length?Gr(d.map(e=>e.length)):0;return a.map((e,i)=>Kr(()=>this.renderForecastItem(e,l,c,t,s,r,d[i],u)))}renderForecastItem(e,t,i,r,s,a,n,o){const l="pouring"===e.condition?"raindrops":"rainy"===e.condition?"raindrop":e.condition,c=this.toIcon(l,"fill",!0,"static"),d=this.getWeather().attributes.temperature_unit,u=a?yl.now().hour===e.datetime.hour:yl.now().day===e.datetime.day,h=Math.round(u&&null!==r?Math.min(r,e.templow):e.templow),m=Math.round(u&&null!==r?Math.max(r,e.temperature):e.temperature);return D`
<clock-weather-card-forecast-row style="--col-one-size: ${.5*o}rem;">
${this.renderText(n)}
${this.renderIcon(c)}
@@ -248,4 +248,4 @@ const ne=(e,t)=>"method"===t.kind&&t.descriptor&&!("value"in t.descriptor)?{...t
<forecast-temperature-bar-current-indicator-dot style="--move-right: ${t===e?0:(i-e)/(t-e)}">
</forecast-temperature-bar-current-indicator-dot>
</forecast-temperature-bar-current-indicator>
`}static get styles(){return ge}createGradientString(e,t,i){function r(e,[t,i],[r,s]){const a=Math.max(Math.min((e-t)/(r-t),1),0);return new be(Math.round(i.r+a*(s.r-i.r)),Math.round(i.g+a*(s.g-i.g)),Math.round(i.b+a*(s.b-i.b)))}const s=this.toCelsius(i,e),a=this.toCelsius(i,t);if(s===a){const e=[...fl.entries()];let t;if(s<=e[0][0])t=e[0][1];else if(s>=e[e.length-1][0])t=e[e.length-1][1];else{const i=e.findIndex(([e])=>e>=s);t=r(s,e[i-1],e[i])}return`${t.toRgbString()} 0%, ${t.toRgbString()} 100%`}const n=[...fl.entries()].reduce((e,[t,i],n,o)=>(0===n?t>s&&(e.set(0,i),e.set((t-s)/(a-s),i)):t<s||(e.has(0)?t<a?e.set((t-s)/(a-s),i):e.has(1)||(t>a?e.set(1,r(a,o[n-1],[t,i])):e.set(1,i)):(e.set(0,r(s,o[n-1],[t,i])),t>a?e.set(1,r(a,o[n-1],[t,i])):e.set((t-s)/(a-s),i))),e),new Map);return n.has(1)||n.set(1,Array.from(n.values()).slice(-1)[0]),[...n.entries()].map(([e,t])=>`${t.toRgbString()} ${Math.round(100*e)}%`).join(", ")}handleAction(e){this.hass&&this.config&&e.detail.action&&((e,t,i,r)=>{let s;"double_tap"===r&&i.double_tap_action?s=i.double_tap_action:"hold"===r&&i.hold_action?s=i.hold_action:"tap"===r&&i.tap_action&&(s=i.tap_action),pe(e,t,i,s)})(this,this.hass,this.config,e.detail.action)}mergeConfig(e){var t,i,r,s,a,n,o,l,c,d,u,h,m,f,p,y,b,g;return Object.assign(Object.assign({},e),{sun_entity:null!==(t=e.sun_entity)&&void 0!==t?t:"sun.sun",temperature_sensor:e.temperature_sensor,humidity_sensor:e.humidity_sensor,weather_icon_type:null!==(i=e.weather_icon_type)&&void 0!==i?i:"line",forecast_rows:null!==(r=e.forecast_rows)&&void 0!==r?r:5,hourly_forecast:null!==(s=e.hourly_forecast)&&void 0!==s&&s,animated_icon:null===(a=e.animated_icon)||void 0===a||a,time_format:null===(n=e.time_format)||void 0===n?void 0:n.toString(),time_pattern:null!==(o=e.time_pattern)&&void 0!==o?o:void 0,show_humidity:null!==(l=e.show_humidity)&&void 0!==l&&l,hide_forecast_section:null!==(c=e.hide_forecast_section)&&void 0!==c&&c,hide_today_section:null!==(d=e.hide_today_section)&&void 0!==d&&d,hide_clock:null!==(u=e.hide_clock)&&void 0!==u&&u,hide_date:null!==(h=e.hide_date)&&void 0!==h&&h,date_pattern:null!==(m=e.date_pattern)&&void 0!==m?m:"D",use_browser_time:null!==(f=e.use_browser_time)&&void 0!==f&&f,time_zone:null!==(p=e.time_zone)&&void 0!==p?p:void 0,show_decimal:null!==(y=e.show_decimal)&&void 0!==y&&y,apparent_sensor:null!==(b=e.apparent_sensor)&&void 0!==b?b:void 0,aqi_sensor:null!==(g=e.aqi_sensor)&&void 0!==g?g:void 0})}toIcon(e,t,i,r){var s;const a=i?"day":"below_horizon"===(null===(s=this.getSun())||void 0===s?void 0:s.state)?"night":"day",n=("animated"===r?Wr:qr)[t][e];return(null==n?void 0:n[a])||n}getWeather(){const e=this.hass.states[this.config.entity];if(!e)throw this.createError(`Weather entity "${this.config.entity}" could not be found.`);return e}getCurrentTemperature(){var e,t;if(this.config.temperature_sensor){const t=this.hass.states[this.config.temperature_sensor],i=(null==t?void 0:t.state)?parseFloat(t.state):void 0,r=null!==(e=null==t?void 0:t.attributes.unit_of_measurement)&&void 0!==e?e:this.getConfiguredTemperatureUnit();if(void 0!==i&&!isNaN(i))return this.toConfiguredTempWithoutUnit(r,i)}return null!==(t=this.getWeather().attributes.temperature)&&void 0!==t?t:null}getCurrentHumidity(){var e;if(this.config.humidity_sensor){const e=this.hass.states[this.config.humidity_sensor],t=(null==e?void 0:e.state)?parseFloat(e.state):void 0;if(void 0!==t&&!isNaN(t))return t}return null!==(e=this.getWeather().attributes.humidity)&&void 0!==e?e:null}getApparentTemperature(){var e;if(this.config.apparent_sensor){const t=this.hass.states[this.config.apparent_sensor],i=(null==t?void 0:t.state)?parseFloat(t.state):void 0,r=null!==(e=null==t?void 0:t.attributes.unit_of_measurement)&&void 0!==e?e:this.getConfiguredTemperatureUnit();if(void 0!==i&&!isNaN(i))return this.toConfiguredTempWithoutUnit(r,i)}return null}getAqi(){if(this.config.aqi_sensor){const e=this.hass.states[this.config.aqi_sensor],t=(null==e?void 0:e.state)?parseInt(e.state):void 0;if(void 0!==t&&!isNaN(t))return t}return null}getAqiBackgroundColor(e){return null==e?null:e<=50?"#00FF00":e<=100?"#FFFF00":e<=150?"#FF8C00":e<=200?"#FF0000":e<=300?"#9400D3":"#8B0000"}getAqiTextColor(e){return null!==e&&e<=150?"#000000":"#FFFFFF"}getSun(){return this.hass.states[this.config.sun_entity]}getLocale(){var e,t;return null!==(t=null!==(e=this.config.locale)&&void 0!==e?e:this.hass.locale.language)&&void 0!==t?t:"en-GB"}date(){return this.toZonedDate(this.currentDate).toFormat(this.config.date_pattern)}time(e=this.currentDate){return this.config.time_pattern?this.toZonedDate(e).toFormat(this.config.time_pattern):this.config.time_format?this.toZonedDate(e).toFormat("24"===this.config.time_format?"HH:mm":"h:mm a"):this.hass.locale.time_format===ue.am_pm?this.toZonedDate(e).toFormat("h:mm a"):this.hass.locale.time_format===ue.twenty_four?this.toZonedDate(e).toFormat("HH:mm"):this.toZonedDate(e).toFormat("t")}getIconAnimationKind(){return this.config.animated_ Line truncated
`}static get styles(){return ge}createGradientString(e,t,i){function r(e,[t,i],[r,s]){const a=Math.max(Math.min((e-t)/(r-t),1),0);return new be(Math.round(i.r+a*(s.r-i.r)),Math.round(i.g+a*(s.g-i.g)),Math.round(i.b+a*(s.b-i.b)))}const s=this.toCelsius(i,e),a=this.toCelsius(i,t);if(s===a){const e=[...gl.entries()];let t;if(s<=e[0][0])t=e[0][1];else if(s>=e[e.length-1][0])t=e[e.length-1][1];else{const i=e.findIndex(([e])=>e>=s);t=r(s,e[i-1],e[i])}return`${t.toRgbString()} 0%, ${t.toRgbString()} 100%`}const n=[...gl.entries()].reduce((e,[t,i],n,o)=>(0===n?t>s&&(e.set(0,i),e.set((t-s)/(a-s),i)):t<s||(e.has(0)?t<a?e.set((t-s)/(a-s),i):e.has(1)||(t>a?e.set(1,r(a,o[n-1],[t,i])):e.set(1,i)):(e.set(0,r(s,o[n-1],[t,i])),t>a?e.set(1,r(a,o[n-1],[t,i])):e.set((t-s)/(a-s),i))),e),new Map);return n.has(1)||n.set(1,Array.from(n.values()).slice(-1)[0]),[...n.entries()].map(([e,t])=>`${t.toRgbString()} ${Math.round(100*e)}%`).join(", ")}handleAction(e){this.hass&&this.config&&e.detail.action&&((e,t,i,r)=>{let s;"double_tap"===r&&i.double_tap_action?s=i.double_tap_action:"hold"===r&&i.hold_action?s=i.hold_action:"tap"===r&&i.tap_action&&(s=i.tap_action),pe(e,t,i,s)})(this,this.hass,this.config,e.detail.action)}mergeConfig(e){var t,i,r,s,a,n,o,l,c,d,u,h,m,f,p,y,b,g;return Object.assign(Object.assign({},e),{sun_entity:null!==(t=e.sun_entity)&&void 0!==t?t:"sun.sun",temperature_sensor:e.temperature_sensor,humidity_sensor:e.humidity_sensor,weather_icon_type:null!==(i=e.weather_icon_type)&&void 0!==i?i:"line",forecast_rows:null!==(r=e.forecast_rows)&&void 0!==r?r:5,hourly_forecast:null!==(s=e.hourly_forecast)&&void 0!==s&&s,animated_icon:null===(a=e.animated_icon)||void 0===a||a,time_format:null===(n=e.time_format)||void 0===n?void 0:n.toString(),time_pattern:null!==(o=e.time_pattern)&&void 0!==o?o:void 0,show_humidity:null!==(l=e.show_humidity)&&void 0!==l&&l,hide_forecast_section:null!==(c=e.hide_forecast_section)&&void 0!==c&&c,hide_today_section:null!==(d=e.hide_today_section)&&void 0!==d&&d,hide_clock:null!==(u=e.hide_clock)&&void 0!==u&&u,hide_date:null!==(h=e.hide_date)&&void 0!==h&&h,date_pattern:null!==(m=e.date_pattern)&&void 0!==m?m:"D",use_browser_time:null!==(f=e.use_browser_time)&&void 0!==f&&f,time_zone:null!==(p=e.time_zone)&&void 0!==p?p:void 0,show_decimal:null!==(y=e.show_decimal)&&void 0!==y&&y,apparent_sensor:null!==(b=e.apparent_sensor)&&void 0!==b?b:void 0,aqi_sensor:null!==(g=e.aqi_sensor)&&void 0!==g?g:void 0})}toIcon(e,t,i,r){var s;const a=i?"day":"below_horizon"===(null===(s=this.getSun())||void 0===s?void 0:s.state)?"night":"day",n=("animated"===r?Jr:Qr)[t][e];return(null==n?void 0:n[a])||n}getWeather(){const e=this.hass.states[this.config.entity];if(!e)throw this.createError(`Weather entity "${this.config.entity}" could not be found.`);return e}getCurrentTemperature(){var e,t;if(this.config.temperature_sensor){const t=this.hass.states[this.config.temperature_sensor],i=(null==t?void 0:t.state)?parseFloat(t.state):void 0,r=null!==(e=null==t?void 0:t.attributes.unit_of_measurement)&&void 0!==e?e:this.getConfiguredTemperatureUnit();if(void 0!==i&&!isNaN(i))return this.toConfiguredTempWithoutUnit(r,i)}return null!==(t=this.getWeather().attributes.temperature)&&void 0!==t?t:null}getCurrentHumidity(){var e;if(this.config.humidity_sensor){const e=this.hass.states[this.config.humidity_sensor],t=(null==e?void 0:e.state)?parseFloat(e.state):void 0;if(void 0!==t&&!isNaN(t))return t}return null!==(e=this.getWeather().attributes.humidity)&&void 0!==e?e:null}getApparentTemperature(){var e;if(this.config.apparent_sensor){const t=this.hass.states[this.config.apparent_sensor],i=(null==t?void 0:t.state)?parseFloat(t.state):void 0,r=null!==(e=null==t?void 0:t.attributes.unit_of_measurement)&&void 0!==e?e:this.getConfiguredTemperatureUnit();if(void 0!==i&&!isNaN(i))return this.toConfiguredTempWithoutUnit(r,i)}return null}getAqi(){if(this.config.aqi_sensor){const e=this.hass.states[this.config.aqi_sensor],t=(null==e?void 0:e.state)?parseInt(e.state):void 0;if(void 0!==t&&!isNaN(t))return t}return null}getAqiBackgroundColor(e){return null==e?null:e<=50?"#00FF00":e<=100?"#FFFF00":e<=150?"#FF8C00":e<=200?"#FF0000":e<=300?"#9400D3":"#8B0000"}getAqiTextColor(e){return null!==e&&e<=150?"#000000":"#FFFFFF"}getSun(){return this.hass.states[this.config.sun_entity]}getLocale(){var e,t;return null!==(t=null!==(e=this.config.locale)&&void 0!==e?e:this.hass.locale.language)&&void 0!==t?t:"en-GB"}date(){return this.toZonedDate(this.currentDate).toFormat(this.config.date_pattern)}time(e=this.currentDate){return this.config.time_pattern?this.toZonedDate(e).toFormat(this.config.time_pattern):this.config.time_format?this.toZonedDate(e).toFormat("24"===this.config.time_format?"HH:mm":"h:mm a"):this.hass.locale.time_format===ue.am_pm?this.toZonedDate(e).toFormat("h:mm a"):this.hass.locale.time_format===ue.twenty_four?this.toZonedDate(e).toFormat("HH:mm"):this.toZonedDate(e).toFormat("t")}getIconAnimationKind(){return this.config.animated_ Line truncated