diff --git a/formulaone-card.js b/formulaone-card.js index 5f534ea..da22f5a 100644 --- a/formulaone-card.js +++ b/formulaone-card.js @@ -1,5 +1,5 @@ /*! For license information please see formulaone-card.js.LICENSE.txt */ -(()=>{"use strict";var t={197:(t,e,i)=>{i.r(e),i.d(e,{DEFAULT_DOMAIN_ICON:()=>J,DEFAULT_PANEL:()=>Q,DEFAULT_VIEW_ENTITY_ID:()=>st,DOMAINS_HIDE_MORE_INFO:()=>et,DOMAINS_MORE_INFO_NO_HISTORY:()=>it,DOMAINS_TOGGLE:()=>rt,DOMAINS_WITH_CARD:()=>X,DOMAINS_WITH_MORE_INFO:()=>tt,NumberFormat:()=>n,STATES_OFF:()=>nt,TimeFormat:()=>r,UNIT_C:()=>at,UNIT_F:()=>ot,applyThemesOnElement:()=>F,computeCardSize:()=>L,computeDomain:()=>B,computeEntity:()=>H,computeRTL:()=>j,computeRTLDirection:()=>z,computeStateDisplay:()=>Z,computeStateDomain:()=>K,createThing:()=>dt,debounce:()=>ht,domainIcon:()=>yt,evaluateFilter:()=>pt,fireEvent:()=>lt,fixedIcons:()=>mt,formatDate:()=>c,formatDateMonth:()=>v,formatDateMonthYear:()=>f,formatDateNumeric:()=>h,formatDateShort:()=>y,formatDateTime:()=>w,formatDateTimeNumeric:()=>A,formatDateTimeWithSeconds:()=>N,formatDateWeekday:()=>l,formatDateYear:()=>C,formatNumber:()=>V,formatTime:()=>E,formatTimeWeekday:()=>D,formatTimeWithSeconds:()=>k,forwardHaptic:()=>ft,getLovelace:()=>At,handleAction:()=>bt,handleActionConfig:()=>Ct,handleClick:()=>St,hasAction:()=>wt,hasConfigOrEntityChanged:()=>$t,hasDoubleClick:()=>Nt,isNumericState:()=>W,navigate:()=>gt,numberFormatToLocale:()=>G,relativeTime:()=>M,round:()=>q,stateIcon:()=>Tt,timerTimeRemaining:()=>R,toggleEntity:()=>_t,turnOnOffEntities:()=>Ot,turnOnOffEntity:()=>vt});var n,r,a,o=function(){return o=Object.assign||function(t){for(var e,i=1,n=arguments.length;i0)return{value:Math.round(h),unit:"year"};var m=12*h+c.getMonth()-d.getMonth();if(Math.round(Math.abs(m))>0)return{value:Math.round(m),unit:"month"};var y=r/604800;return{value:Math.round(y),unit:"week"}}(t,i);return n?function(t){return new Intl.RelativeTimeFormat(t.language,{numeric:"auto"})}(e).format(r.value,r.unit):Intl.NumberFormat(e.language,{style:"unit",unit:r.unit,unitDisplay:"long"}).format(Math.abs(r.value))};function R(t){var e,i=3600*(e=t.attributes.remaining.split(":").map(Number))[0]+60*e[1]+e[2];if("active"===t.state){var n=(new Date).getTime(),r=new Date(t.last_changed).getTime();i=Math.max(i-(n-r)/1e3,0)}return i}function U(){return(U=Object.assign||function(t){for(var e=1;e-1?t.split(".")[1].length:0;i.minimumFractionDigits=n,i.maximumFractionDigits=n}return i},Z=function(t,e,i,n){var r=void 0!==n?n:e.state;if("unknown"===r||"unavailable"===r)return t("state.default."+r);if(W(e)){if("monetary"===e.attributes.device_class)try{return V(r,i,{style:"currency",currency:e.attributes.unit_of_measurement})}catch(t){}return V(r,i)+(e.attributes.unit_of_measurement?" "+e.attributes.unit_of_measurement:"")}var a=K(e);if("input_datetime"===a){var o;if(void 0===n)return e.attributes.has_date&&e.attributes.has_time?(o=new Date(e.attributes.year,e.attributes.month-1,e.attributes.day,e.attributes.hour,e.attributes.minute),w(o,i)):e.attributes.has_date?(o=new Date(e.attributes.year,e.attributes.month-1,e.attributes.day),c(o,i)):e.attributes.has_time?((o=new Date).setHours(e.attributes.hour,e.attributes.minute),E(o,i)):e.state;try{var s=n.split(" ");if(2===s.length)return w(new Date(s.join("T")),i);if(1===s.length){if(n.includes("-"))return c(new Date(n+"T00:00"),i);if(n.includes(":")){var l=new Date;return E(new Date(l.toISOString().split("T")[0]+"T"+n),i)}}return n}catch(t){return n}}return"humidifier"===a&&"on"===r&&e.attributes.humidity?e.attributes.humidity+" %":"counter"===a||"number"===a||"input_number"===a?V(r,i):e.attributes.device_class&&t("component."+a+".state."+e.attributes.device_class+"."+r)||t("component."+a+".state._."+r)||r},J="mdi:bookmark",Q="lovelace",X=["climate","cover","configurator","input_select","input_number","input_text","lock","media_player","scene","script","timer","vacuum","water_heater","weblink"],tt=["alarm_control_panel","automation","camera","climate","configurator","cover","fan","group","history_graph","input_datetime","light","lock","media_player","script","sun","updater","vacuum","water_heater","weather"],et=["input_number","input_select","input_text","scene","weblink"],it=["camera","configurator","history_graph","scene"],nt=["closed","locked","off"],rt=new Set(["fan","input_boolean","light","switch","group","automation"]),at="°C",ot="°F",st="group.default_view",lt=function(t,e,i,n){n=n||{},i=null==i?{}:i;var r=new Event(e,{bubbles:void 0===n.bubbles||n.bubbles,cancelable:Boolean(n.cancelable),composed:void 0===n.composed||n.composed});return r.detail=i,t.dispatchEvent(r),r},ut=new Set(["call-service","divider","section","weblink","cast","select"]),ct={alert:"toggle",automation:"toggle",climate:"climate",cover:"cover",fan:"toggle",group:"group",input_boolean:"toggle",input_number:"input-number",input_select:"input-select",input_text:"input-text",light:"toggle",lock:"lock",media_player:"media-player",remote:"toggle",scene:"scene",script:"script",sensor:"sensor",timer:"timer",switch:"toggle",vacuum:"toggle",water_heater:"climate",input_datetime:"input-datetime"},dt=function(t,e){void 0===e&&(e=!1);var i=function(t,e){return n("hui-error-card",{type:"error",error:t,config:e})},n=function(t,e){var n=window.document.createElement(t);try{if(!n.setConfig)return;n.setConfig(e)}catch(n){return console.error(t,n),i(n.message,e)}return n};if(!t||"object"!=typeof t||!e&&!t.type)return i("No type defined",t);var r=t.type;if(r&&r.startsWith("custom:"))r=r.substr("custom:".length);else if(e)if(ut.has(r))r="hui-"+r+"-row";else{if(!t.entity)return i("Invalid config given.",t);var a=t.entity.split(".",1)[0];r="hui-"+(ct[a]||"text")+"-entity-row"}else r="hui-"+r+"-card";if(customElements.get(r))return n(r,t);var o=i("Custom element doesn't exist: "+t.type+".",t);o.style.display="None";var s=setTimeout((function(){o.style.display=""}),2e3);return customElements.whenDefined(t.type).then((function(){clearTimeout(s),lt(o,"ll-rebuild",{},o)})),o},ht=function(t,e,i){var n;return void 0===i&&(i=!1),function(){var r=[].slice.call(arguments),a=this,o=function(){n=null,i||t.apply(a,r)},s=i&&!n;clearTimeout(n),n=setTimeout(o,e),s&&t.apply(a,r)}},mt={alert:"mdi:alert",automation:"mdi:playlist-play",calendar:"mdi:calendar",camera:"mdi:video",climate:"mdi:thermostat",configurator:"mdi:settings",conversation:"mdi:text-to-speech",device_tracker:"mdi:account",fan:"mdi:fan",group:"mdi:google-circles-communities",history_graph:"mdi:chart-line",homeassistant:"mdi:home-assistant",homekit:"mdi:home-automation",image_processing:"mdi:image-filter-frames",input_boolean:"mdi:drawing",input_datetime:"mdi:calendar-clock",input_number:"mdi:ray-vertex",input_select:"mdi:format-list-bulleted",input_text:"mdi:textbox",light:"mdi:lightbulb",mailbox:"mdi:mailbox",notify:"mdi:comment-alert",person:"mdi:account",plant:"mdi:flower",proximity:"mdi:apple-safari",remote:"mdi:remote",scene:"mdi:google-pages",script:"mdi:file-document",sensor:"mdi:eye",simple_alarm:"mdi:bell",sun:"mdi:white-balance-sunny",switch:"mdi:flash",timer:"mdi:timer",updater:"mdi:cloud-upload",vacuum:"mdi:robot-vacuum",water_heater:"mdi:thermometer",weblink:"mdi:open-in-new"};function yt(t,e){if(t in mt)return mt[t];switch(t){case"alarm_control_panel":switch(e){case"armed_home":return"mdi:bell-plus";case"armed_night":return"mdi:bell-sleep";case"disarmed":return"mdi:bell-outline";case"triggered":return"mdi:bell-ring";default:return"mdi:bell"}case"binary_sensor":return e&&"off"===e?"mdi:radiobox-blank":"mdi:checkbox-marked-circle";case"cover":return"closed"===e?"mdi:window-closed":"mdi:window-open";case"lock":return e&&"unlocked"===e?"mdi:lock-open":"mdi:lock";case"media_player":return e&&"off"!==e&&"idle"!==e?"mdi:cast-connected":"mdi:cast";case"zwave":switch(e){case"dead":return"mdi:emoticon-dead";case"sleeping":return"mdi:sleep";case"initializing":return"mdi:timer-sand";default:return"mdi:z-wave"}default:return console.warn("Unable to find icon for domain "+t+" ("+e+")"),"mdi:bookmark"}}var pt=function(t,e){var i=e.value||e,n=e.attribute?t.attributes[e.attribute]:t.state;switch(e.operator||"=="){case"==":return n===i;case"<=":return n<=i;case"<":return n=":return n>=i;case">":return n>i;case"!=":return n!==i;case"regex":return n.match(i);default:return!1}},ft=function(t){lt(window,"haptic",t)},gt=function(t,e,i){void 0===i&&(i=!1),i?history.replaceState(null,"",e):history.pushState(null,"",e),lt(window,"location-changed",{replace:i})},vt=function(t,e,i){void 0===i&&(i=!0);var n,r=B(e),a="group"===r?"homeassistant":r;switch(r){case"lock":n=i?"unlock":"lock";break;case"cover":n=i?"open_cover":"close_cover";break;default:n=i?"turn_on":"turn_off"}return t.callService(a,n,{entity_id:e})},_t=function(t,e){var i=nt.includes(t.states[e].state);return vt(t,e,i)},Ct=function(t,e,i,n){if(n||(n={action:"more-info"}),!n.confirmation||n.confirmation.exemptions&&n.confirmation.exemptions.some((function(t){return t.user===e.user.id}))||(ft("warning"),confirm(n.confirmation.text||"Are you sure you want to "+n.action+"?")))switch(n.action){case"more-info":(i.entity||i.camera_image)&<(t,"hass-more-info",{entityId:i.entity?i.entity:i.camera_image});break;case"navigate":n.navigation_path&>(0,n.navigation_path);break;case"url":n.url_path&&window.open(n.url_path);break;case"toggle":i.entity&&(_t(e,i.entity),ft("success"));break;case"call-service":if(!n.service)return void ft("failure");var r=n.service.split(".",2);e.callService(r[0],r[1],n.service_data,n.target),ft("success");break;case"fire-dom-event":lt(t,"ll-custom",n)}},bt=function(t,e,i,n){var r;"double_tap"===n&&i.double_tap_action?r=i.double_tap_action:"hold"===n&&i.hold_action?r=i.hold_action:"tap"===n&&i.tap_action&&(r=i.tap_action),Ct(t,e,i,r)},St=function(t,e,i,n,r){var a;if(r&&i.double_tap_action?a=i.double_tap_action:n&&i.hold_action?a=i.hold_action:!n&&i.tap_action&&(a=i.tap_action),a||(a={action:"more-info"}),!a.confirmation||a.confirmation.exemptions&&a.confirmation.exemptions.some((function(t){return t.user===e.user.id}))||confirm(a.confirmation.text||"Are you sure you want to "+a.action+"?"))switch(a.action){case"more-info":(a.entity||i.entity||i.camera_image)&&(lt(t,"hass-more-info",{entityId:a.entity?a.entity:i.entity?i.entity:i.camera_image}),a.haptic&&ft(a.haptic));break;case"navigate":a.navigation_path&&(gt(0,a.navigation_path),a.haptic&&ft(a.haptic));break;case"url":a.url_path&&window.open(a.url_path),a.haptic&&ft(a.haptic);break;case"toggle":i.entity&&(_t(e,i.entity),a.haptic&&ft(a.haptic));break;case"call-service":if(!a.service)return;var o=a.service.split(".",2),s=o[0],l=o[1],u=U({},a.service_data);"entity"===u.entity_id&&(u.entity_id=i.entity),e.callService(s,l,u,a.target),a.haptic&&ft(a.haptic);break;case"fire-dom-event":lt(t,"ll-custom",a),a.haptic&&ft(a.haptic)}};function wt(t){return void 0!==t&&"none"!==t.action}function $t(t,e,i){if(e.has("config")||i)return!0;if(t.config.entity){var n=e.get("hass");return!n||n.states[t.config.entity]!==t.hass.states[t.config.entity]}return!1}function Nt(t){return void 0!==t&&"none"!==t.action}var Ot=function(t,e,i){void 0===i&&(i=!0);var n={};e.forEach((function(e){if(nt.includes(t.states[e].state)===i){var r=B(e),a=["cover","lock"].includes(r)?r:"homeassistant";a in n||(n[a]=[]),n[a].push(e)}})),Object.keys(n).forEach((function(e){var r;switch(e){case"lock":r=i?"unlock":"lock";break;case"cover":r=i?"open_cover":"close_cover";break;default:r=i?"turn_on":"turn_off"}t.callService(e,r,{entity_id:n[e]})}))},At=function(){var t=document.querySelector("home-assistant");if(t=(t=(t=(t=(t=(t=(t=(t=t&&t.shadowRoot)&&t.querySelector("home-assistant-main"))&&t.shadowRoot)&&t.querySelector("app-drawer-layout partial-panel-resolver"))&&t.shadowRoot||t)&&t.querySelector("ha-panel-lovelace"))&&t.shadowRoot)&&t.querySelector("hui-root")){var e=t.lovelace;return e.current_view=t.___curView,e}return null},It={humidity:"mdi:water-percent",illuminance:"mdi:brightness-5",temperature:"mdi:thermometer",pressure:"mdi:gauge",power:"mdi:flash",signal_strength:"mdi:wifi"},Et={binary_sensor:function(t,e){var i="off"===t;switch(null==e?void 0:e.attributes.device_class){case"battery":return i?"mdi:battery":"mdi:battery-outline";case"battery_charging":return i?"mdi:battery":"mdi:battery-charging";case"cold":return i?"mdi:thermometer":"mdi:snowflake";case"connectivity":return i?"mdi:server-network-off":"mdi:server-network";case"door":return i?"mdi:door-closed":"mdi:door-open";case"garage_door":return i?"mdi:garage":"mdi:garage-open";case"power":case"plug":return i?"mdi:power-plug-off":"mdi:power-plug";case"gas":case"problem":case"safety":case"tamper":return i?"mdi:check-circle":"mdi:alert-circle";case"smoke":return i?"mdi:check-circle":"mdi:smoke";case"heat":return i?"mdi:thermometer":"mdi:fire";case"light":return i?"mdi:brightness-5":"mdi:brightness-7";case"lock":return i?"mdi:lock":"mdi:lock-open";case"moisture":return i?"mdi:water-off":"mdi:water";case"motion":return i?"mdi:walk":"mdi:run";case"occupancy":case"presence":return i?"mdi:home-outline":"mdi:home";case"opening":return i?"mdi:square":"mdi:square-outline";case"running":return i?"mdi:stop":"mdi:play";case"sound":return i?"mdi:music-note-off":"mdi:music-note";case"update":return i?"mdi:package":"mdi:package-up";case"vibration":return i?"mdi:crop-portrait":"mdi:vibrate";case"window":return i?"mdi:window-closed":"mdi:window-open";default:return i?"mdi:radiobox-blank":"mdi:checkbox-marked-circle"}},cover:function(t){var e="closed"!==t.state;switch(t.attributes.device_class){case"garage":return e?"mdi:garage-open":"mdi:garage";case"door":return e?"mdi:door-open":"mdi:door-closed";case"shutter":return e?"mdi:window-shutter-open":"mdi:window-shutter";case"blind":return e?"mdi:blinds-open":"mdi:blinds";case"window":return e?"mdi:window-open":"mdi:window-closed";default:return yt("cover",t.state)}},sensor:function(t){var e=t.attributes.device_class;if(e&&e in It)return It[e];if("battery"===e){var i=Number(t.state);if(isNaN(i))return"mdi:battery-unknown";var n=10*Math.round(i/10);return n>=100?"mdi:battery":n<=0?"mdi:battery-alert":"hass:battery-"+n}var r=t.attributes.unit_of_measurement;return"°C"===r||"°F"===r?"mdi:thermometer":yt("sensor")},input_datetime:function(t){return t.attributes.has_date?t.attributes.has_time?yt("input_datetime"):"mdi:calendar":"mdi:clock"}},Tt=function(t){if(!t)return"mdi:bookmark";if(t.attributes.icon)return t.attributes.icon;var e=B(t.entity_id);return e in Et?Et[e](t):yt(e,t.state)}},243:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BaseCard=void 0,e.BaseCard=class{constructor(t,e,i){this.sensor_entity_id=t,this.hass=e,this.config=i,this.sensor=this.getSensor()}getSensor(){const t=this.hass.states[this.sensor_entity_id];return{last_update:new Date(t.attributes.last_update),data:t.attributes.data}}}},521:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0});const n=i(692),r=i(243);class a extends r.BaseCard{constructor(t,e,i){super(t,e,i)}renderStandingRow(t){return n.html` +(()=>{"use strict";var t={197:(t,e,i)=>{i.r(e),i.d(e,{DEFAULT_DOMAIN_ICON:()=>J,DEFAULT_PANEL:()=>Q,DEFAULT_VIEW_ENTITY_ID:()=>st,DOMAINS_HIDE_MORE_INFO:()=>et,DOMAINS_MORE_INFO_NO_HISTORY:()=>it,DOMAINS_TOGGLE:()=>rt,DOMAINS_WITH_CARD:()=>X,DOMAINS_WITH_MORE_INFO:()=>tt,NumberFormat:()=>n,STATES_OFF:()=>nt,TimeFormat:()=>r,UNIT_C:()=>at,UNIT_F:()=>ot,applyThemesOnElement:()=>F,computeCardSize:()=>L,computeDomain:()=>B,computeEntity:()=>H,computeRTL:()=>j,computeRTLDirection:()=>z,computeStateDisplay:()=>Z,computeStateDomain:()=>K,createThing:()=>dt,debounce:()=>ht,domainIcon:()=>yt,evaluateFilter:()=>pt,fireEvent:()=>lt,fixedIcons:()=>mt,formatDate:()=>c,formatDateMonth:()=>v,formatDateMonthYear:()=>f,formatDateNumeric:()=>h,formatDateShort:()=>y,formatDateTime:()=>w,formatDateTimeNumeric:()=>O,formatDateTimeWithSeconds:()=>$,formatDateWeekday:()=>l,formatDateYear:()=>C,formatNumber:()=>V,formatTime:()=>E,formatTimeWeekday:()=>D,formatTimeWithSeconds:()=>k,forwardHaptic:()=>ft,getLovelace:()=>Ot,handleAction:()=>bt,handleActionConfig:()=>Ct,handleClick:()=>St,hasAction:()=>wt,hasConfigOrEntityChanged:()=>Nt,hasDoubleClick:()=>$t,isNumericState:()=>W,navigate:()=>gt,numberFormatToLocale:()=>G,relativeTime:()=>M,round:()=>q,stateIcon:()=>Tt,timerTimeRemaining:()=>R,toggleEntity:()=>_t,turnOnOffEntities:()=>At,turnOnOffEntity:()=>vt});var n,r,a,o=function(){return o=Object.assign||function(t){for(var e,i=1,n=arguments.length;i0)return{value:Math.round(h),unit:"year"};var m=12*h+c.getMonth()-d.getMonth();if(Math.round(Math.abs(m))>0)return{value:Math.round(m),unit:"month"};var y=r/604800;return{value:Math.round(y),unit:"week"}}(t,i);return n?function(t){return new Intl.RelativeTimeFormat(t.language,{numeric:"auto"})}(e).format(r.value,r.unit):Intl.NumberFormat(e.language,{style:"unit",unit:r.unit,unitDisplay:"long"}).format(Math.abs(r.value))};function R(t){var e,i=3600*(e=t.attributes.remaining.split(":").map(Number))[0]+60*e[1]+e[2];if("active"===t.state){var n=(new Date).getTime(),r=new Date(t.last_changed).getTime();i=Math.max(i-(n-r)/1e3,0)}return i}function U(){return(U=Object.assign||function(t){for(var e=1;e-1?t.split(".")[1].length:0;i.minimumFractionDigits=n,i.maximumFractionDigits=n}return i},Z=function(t,e,i,n){var r=void 0!==n?n:e.state;if("unknown"===r||"unavailable"===r)return t("state.default."+r);if(W(e)){if("monetary"===e.attributes.device_class)try{return V(r,i,{style:"currency",currency:e.attributes.unit_of_measurement})}catch(t){}return V(r,i)+(e.attributes.unit_of_measurement?" "+e.attributes.unit_of_measurement:"")}var a=K(e);if("input_datetime"===a){var o;if(void 0===n)return e.attributes.has_date&&e.attributes.has_time?(o=new Date(e.attributes.year,e.attributes.month-1,e.attributes.day,e.attributes.hour,e.attributes.minute),w(o,i)):e.attributes.has_date?(o=new Date(e.attributes.year,e.attributes.month-1,e.attributes.day),c(o,i)):e.attributes.has_time?((o=new Date).setHours(e.attributes.hour,e.attributes.minute),E(o,i)):e.state;try{var s=n.split(" ");if(2===s.length)return w(new Date(s.join("T")),i);if(1===s.length){if(n.includes("-"))return c(new Date(n+"T00:00"),i);if(n.includes(":")){var l=new Date;return E(new Date(l.toISOString().split("T")[0]+"T"+n),i)}}return n}catch(t){return n}}return"humidifier"===a&&"on"===r&&e.attributes.humidity?e.attributes.humidity+" %":"counter"===a||"number"===a||"input_number"===a?V(r,i):e.attributes.device_class&&t("component."+a+".state."+e.attributes.device_class+"."+r)||t("component."+a+".state._."+r)||r},J="mdi:bookmark",Q="lovelace",X=["climate","cover","configurator","input_select","input_number","input_text","lock","media_player","scene","script","timer","vacuum","water_heater","weblink"],tt=["alarm_control_panel","automation","camera","climate","configurator","cover","fan","group","history_graph","input_datetime","light","lock","media_player","script","sun","updater","vacuum","water_heater","weather"],et=["input_number","input_select","input_text","scene","weblink"],it=["camera","configurator","history_graph","scene"],nt=["closed","locked","off"],rt=new Set(["fan","input_boolean","light","switch","group","automation"]),at="°C",ot="°F",st="group.default_view",lt=function(t,e,i,n){n=n||{},i=null==i?{}:i;var r=new Event(e,{bubbles:void 0===n.bubbles||n.bubbles,cancelable:Boolean(n.cancelable),composed:void 0===n.composed||n.composed});return r.detail=i,t.dispatchEvent(r),r},ut=new Set(["call-service","divider","section","weblink","cast","select"]),ct={alert:"toggle",automation:"toggle",climate:"climate",cover:"cover",fan:"toggle",group:"group",input_boolean:"toggle",input_number:"input-number",input_select:"input-select",input_text:"input-text",light:"toggle",lock:"lock",media_player:"media-player",remote:"toggle",scene:"scene",script:"script",sensor:"sensor",timer:"timer",switch:"toggle",vacuum:"toggle",water_heater:"climate",input_datetime:"input-datetime"},dt=function(t,e){void 0===e&&(e=!1);var i=function(t,e){return n("hui-error-card",{type:"error",error:t,config:e})},n=function(t,e){var n=window.document.createElement(t);try{if(!n.setConfig)return;n.setConfig(e)}catch(n){return console.error(t,n),i(n.message,e)}return n};if(!t||"object"!=typeof t||!e&&!t.type)return i("No type defined",t);var r=t.type;if(r&&r.startsWith("custom:"))r=r.substr("custom:".length);else if(e)if(ut.has(r))r="hui-"+r+"-row";else{if(!t.entity)return i("Invalid config given.",t);var a=t.entity.split(".",1)[0];r="hui-"+(ct[a]||"text")+"-entity-row"}else r="hui-"+r+"-card";if(customElements.get(r))return n(r,t);var o=i("Custom element doesn't exist: "+t.type+".",t);o.style.display="None";var s=setTimeout((function(){o.style.display=""}),2e3);return customElements.whenDefined(t.type).then((function(){clearTimeout(s),lt(o,"ll-rebuild",{},o)})),o},ht=function(t,e,i){var n;return void 0===i&&(i=!1),function(){var r=[].slice.call(arguments),a=this,o=function(){n=null,i||t.apply(a,r)},s=i&&!n;clearTimeout(n),n=setTimeout(o,e),s&&t.apply(a,r)}},mt={alert:"mdi:alert",automation:"mdi:playlist-play",calendar:"mdi:calendar",camera:"mdi:video",climate:"mdi:thermostat",configurator:"mdi:settings",conversation:"mdi:text-to-speech",device_tracker:"mdi:account",fan:"mdi:fan",group:"mdi:google-circles-communities",history_graph:"mdi:chart-line",homeassistant:"mdi:home-assistant",homekit:"mdi:home-automation",image_processing:"mdi:image-filter-frames",input_boolean:"mdi:drawing",input_datetime:"mdi:calendar-clock",input_number:"mdi:ray-vertex",input_select:"mdi:format-list-bulleted",input_text:"mdi:textbox",light:"mdi:lightbulb",mailbox:"mdi:mailbox",notify:"mdi:comment-alert",person:"mdi:account",plant:"mdi:flower",proximity:"mdi:apple-safari",remote:"mdi:remote",scene:"mdi:google-pages",script:"mdi:file-document",sensor:"mdi:eye",simple_alarm:"mdi:bell",sun:"mdi:white-balance-sunny",switch:"mdi:flash",timer:"mdi:timer",updater:"mdi:cloud-upload",vacuum:"mdi:robot-vacuum",water_heater:"mdi:thermometer",weblink:"mdi:open-in-new"};function yt(t,e){if(t in mt)return mt[t];switch(t){case"alarm_control_panel":switch(e){case"armed_home":return"mdi:bell-plus";case"armed_night":return"mdi:bell-sleep";case"disarmed":return"mdi:bell-outline";case"triggered":return"mdi:bell-ring";default:return"mdi:bell"}case"binary_sensor":return e&&"off"===e?"mdi:radiobox-blank":"mdi:checkbox-marked-circle";case"cover":return"closed"===e?"mdi:window-closed":"mdi:window-open";case"lock":return e&&"unlocked"===e?"mdi:lock-open":"mdi:lock";case"media_player":return e&&"off"!==e&&"idle"!==e?"mdi:cast-connected":"mdi:cast";case"zwave":switch(e){case"dead":return"mdi:emoticon-dead";case"sleeping":return"mdi:sleep";case"initializing":return"mdi:timer-sand";default:return"mdi:z-wave"}default:return console.warn("Unable to find icon for domain "+t+" ("+e+")"),"mdi:bookmark"}}var pt=function(t,e){var i=e.value||e,n=e.attribute?t.attributes[e.attribute]:t.state;switch(e.operator||"=="){case"==":return n===i;case"<=":return n<=i;case"<":return n=":return n>=i;case">":return n>i;case"!=":return n!==i;case"regex":return n.match(i);default:return!1}},ft=function(t){lt(window,"haptic",t)},gt=function(t,e,i){void 0===i&&(i=!1),i?history.replaceState(null,"",e):history.pushState(null,"",e),lt(window,"location-changed",{replace:i})},vt=function(t,e,i){void 0===i&&(i=!0);var n,r=B(e),a="group"===r?"homeassistant":r;switch(r){case"lock":n=i?"unlock":"lock";break;case"cover":n=i?"open_cover":"close_cover";break;default:n=i?"turn_on":"turn_off"}return t.callService(a,n,{entity_id:e})},_t=function(t,e){var i=nt.includes(t.states[e].state);return vt(t,e,i)},Ct=function(t,e,i,n){if(n||(n={action:"more-info"}),!n.confirmation||n.confirmation.exemptions&&n.confirmation.exemptions.some((function(t){return t.user===e.user.id}))||(ft("warning"),confirm(n.confirmation.text||"Are you sure you want to "+n.action+"?")))switch(n.action){case"more-info":(i.entity||i.camera_image)&<(t,"hass-more-info",{entityId:i.entity?i.entity:i.camera_image});break;case"navigate":n.navigation_path&>(0,n.navigation_path);break;case"url":n.url_path&&window.open(n.url_path);break;case"toggle":i.entity&&(_t(e,i.entity),ft("success"));break;case"call-service":if(!n.service)return void ft("failure");var r=n.service.split(".",2);e.callService(r[0],r[1],n.service_data,n.target),ft("success");break;case"fire-dom-event":lt(t,"ll-custom",n)}},bt=function(t,e,i,n){var r;"double_tap"===n&&i.double_tap_action?r=i.double_tap_action:"hold"===n&&i.hold_action?r=i.hold_action:"tap"===n&&i.tap_action&&(r=i.tap_action),Ct(t,e,i,r)},St=function(t,e,i,n,r){var a;if(r&&i.double_tap_action?a=i.double_tap_action:n&&i.hold_action?a=i.hold_action:!n&&i.tap_action&&(a=i.tap_action),a||(a={action:"more-info"}),!a.confirmation||a.confirmation.exemptions&&a.confirmation.exemptions.some((function(t){return t.user===e.user.id}))||confirm(a.confirmation.text||"Are you sure you want to "+a.action+"?"))switch(a.action){case"more-info":(a.entity||i.entity||i.camera_image)&&(lt(t,"hass-more-info",{entityId:a.entity?a.entity:i.entity?i.entity:i.camera_image}),a.haptic&&ft(a.haptic));break;case"navigate":a.navigation_path&&(gt(0,a.navigation_path),a.haptic&&ft(a.haptic));break;case"url":a.url_path&&window.open(a.url_path),a.haptic&&ft(a.haptic);break;case"toggle":i.entity&&(_t(e,i.entity),a.haptic&&ft(a.haptic));break;case"call-service":if(!a.service)return;var o=a.service.split(".",2),s=o[0],l=o[1],u=U({},a.service_data);"entity"===u.entity_id&&(u.entity_id=i.entity),e.callService(s,l,u,a.target),a.haptic&&ft(a.haptic);break;case"fire-dom-event":lt(t,"ll-custom",a),a.haptic&&ft(a.haptic)}};function wt(t){return void 0!==t&&"none"!==t.action}function Nt(t,e,i){if(e.has("config")||i)return!0;if(t.config.entity){var n=e.get("hass");return!n||n.states[t.config.entity]!==t.hass.states[t.config.entity]}return!1}function $t(t){return void 0!==t&&"none"!==t.action}var At=function(t,e,i){void 0===i&&(i=!0);var n={};e.forEach((function(e){if(nt.includes(t.states[e].state)===i){var r=B(e),a=["cover","lock"].includes(r)?r:"homeassistant";a in n||(n[a]=[]),n[a].push(e)}})),Object.keys(n).forEach((function(e){var r;switch(e){case"lock":r=i?"unlock":"lock";break;case"cover":r=i?"open_cover":"close_cover";break;default:r=i?"turn_on":"turn_off"}t.callService(e,r,{entity_id:n[e]})}))},Ot=function(){var t=document.querySelector("home-assistant");if(t=(t=(t=(t=(t=(t=(t=(t=t&&t.shadowRoot)&&t.querySelector("home-assistant-main"))&&t.shadowRoot)&&t.querySelector("app-drawer-layout partial-panel-resolver"))&&t.shadowRoot||t)&&t.querySelector("ha-panel-lovelace"))&&t.shadowRoot)&&t.querySelector("hui-root")){var e=t.lovelace;return e.current_view=t.___curView,e}return null},It={humidity:"mdi:water-percent",illuminance:"mdi:brightness-5",temperature:"mdi:thermometer",pressure:"mdi:gauge",power:"mdi:flash",signal_strength:"mdi:wifi"},Et={binary_sensor:function(t,e){var i="off"===t;switch(null==e?void 0:e.attributes.device_class){case"battery":return i?"mdi:battery":"mdi:battery-outline";case"battery_charging":return i?"mdi:battery":"mdi:battery-charging";case"cold":return i?"mdi:thermometer":"mdi:snowflake";case"connectivity":return i?"mdi:server-network-off":"mdi:server-network";case"door":return i?"mdi:door-closed":"mdi:door-open";case"garage_door":return i?"mdi:garage":"mdi:garage-open";case"power":case"plug":return i?"mdi:power-plug-off":"mdi:power-plug";case"gas":case"problem":case"safety":case"tamper":return i?"mdi:check-circle":"mdi:alert-circle";case"smoke":return i?"mdi:check-circle":"mdi:smoke";case"heat":return i?"mdi:thermometer":"mdi:fire";case"light":return i?"mdi:brightness-5":"mdi:brightness-7";case"lock":return i?"mdi:lock":"mdi:lock-open";case"moisture":return i?"mdi:water-off":"mdi:water";case"motion":return i?"mdi:walk":"mdi:run";case"occupancy":case"presence":return i?"mdi:home-outline":"mdi:home";case"opening":return i?"mdi:square":"mdi:square-outline";case"running":return i?"mdi:stop":"mdi:play";case"sound":return i?"mdi:music-note-off":"mdi:music-note";case"update":return i?"mdi:package":"mdi:package-up";case"vibration":return i?"mdi:crop-portrait":"mdi:vibrate";case"window":return i?"mdi:window-closed":"mdi:window-open";default:return i?"mdi:radiobox-blank":"mdi:checkbox-marked-circle"}},cover:function(t){var e="closed"!==t.state;switch(t.attributes.device_class){case"garage":return e?"mdi:garage-open":"mdi:garage";case"door":return e?"mdi:door-open":"mdi:door-closed";case"shutter":return e?"mdi:window-shutter-open":"mdi:window-shutter";case"blind":return e?"mdi:blinds-open":"mdi:blinds";case"window":return e?"mdi:window-open":"mdi:window-closed";default:return yt("cover",t.state)}},sensor:function(t){var e=t.attributes.device_class;if(e&&e in It)return It[e];if("battery"===e){var i=Number(t.state);if(isNaN(i))return"mdi:battery-unknown";var n=10*Math.round(i/10);return n>=100?"mdi:battery":n<=0?"mdi:battery-alert":"hass:battery-"+n}var r=t.attributes.unit_of_measurement;return"°C"===r||"°F"===r?"mdi:thermometer":yt("sensor")},input_datetime:function(t){return t.attributes.has_date?t.attributes.has_time?yt("input_datetime"):"mdi:calendar":"mdi:clock"}},Tt=function(t){if(!t)return"mdi:bookmark";if(t.attributes.icon)return t.attributes.icon;var e=B(t.entity_id);return e in Et?Et[e](t):yt(e,t.state)}},243:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BaseCard=void 0,e.BaseCard=class{constructor(t,e,i){this.sensor_entity_id=t,this.hass=e,this.config=i,this.sensor=this.getSensor()}getSensor(){const t=this.hass.states[this.sensor_entity_id];return{last_update:new Date(t.attributes.last_update),data:t.attributes.data}}}},521:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0});const n=i(692),r=i(243);class a extends r.BaseCard{constructor(t,e,i){super(t,e,i)}renderStandingRow(t){return n.html` ${t.position} ${t.Constructor.name} @@ -49,7 +49,7 @@ ${t.grid} ${t.points} ${t.status} - `}renderHeader(){const t=this.sensor.data,e=t.Circuit.Location.country.replace(" ","-"),i=n.html``,a=this.config.image_clickable?n.html`${i}`:i;return n.html`

  ${t.round} : ${t.raceName}

${a}
`}render(){const t=this.sensor.data;if(!this.sensor_entity_id.endsWith("_last_result")||void 0===t)throw new Error("Please pass the correct sensor (last_result)");return n.html` + `}renderHeader(){const t=this.sensor.data,e=t.Circuit.Location.country.replace(" ","-"),i=(0,r.getCircuitName)(e),a=n.html``,o=this.config.image_clickable?n.html`${a}`:a;return n.html`

  ${t.round} : ${t.raceName}

${o}
`}render(){const t=this.sensor.data;if(!this.sensor_entity_id.endsWith("_last_result")||void 0===t)throw new Error("Please pass the correct sensor (last_result)");return n.html` @@ -70,7 +70,7 @@ ${t.Results.map((t=>this.renderResultRow(t)))}
- `}}e.default=o},249:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0});const n=i(692),r=i(247),a=i(347),o=i(593),s=i(243);class l extends s.BaseCard{constructor(t,e,i){super(t,e,i);const n=this.hass.states[this.sensor_entity_id];this.next_race=n.attributes.next_race}renderHeader(){const t=this.next_race.Circuit.Location.country.replace(" ","-"),e=n.html``,i=this.config.image_clickable?n.html`${e}`:e;return n.html`

  ${this.next_race.round} : ${this.next_race.raceName}

${i}
`}render(){if(!this.sensor_entity_id.endsWith("_races")||void 0===this.next_race)throw new Error("Please pass the correct sensor (races)");const t=new Date(this.next_race.date+"T"+this.next_race.time),e=(0,a.formatDateTimeRaceInfo)(new Date(this.next_race.FirstPractice.date+"T"+this.next_race.FirstPractice.time),this.hass.locale),i=(0,a.formatDateTimeRaceInfo)(new Date(this.next_race.SecondPractice.date+"T"+this.next_race.SecondPractice.time),this.hass.locale),o=void 0!==this.next_race.ThirdPractice?(0,a.formatDateTimeRaceInfo)(new Date(this.next_race.ThirdPractice.date+"T"+this.next_race.ThirdPractice.time),this.hass.locale):"-",s=(0,a.formatDateTimeRaceInfo)(t,this.hass.locale),l=void 0!==this.next_race.Qualifying?(0,a.formatDateTimeRaceInfo)(new Date(this.next_race.Qualifying.date+"T"+this.next_race.Qualifying.time),this.hass.locale):"-",u=void 0!==this.next_race.Sprint?(0,a.formatDateTimeRaceInfo)(new Date(this.next_race.Sprint.date+"T"+this.next_race.Sprint.time),this.hass.locale):"-";return n.html` + `}}e.default=o},249:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0});const n=i(692),r=i(247),a=i(347),o=i(593),s=i(243);class l extends s.BaseCard{constructor(t,e,i){super(t,e,i);const n=this.hass.states[this.sensor_entity_id];this.next_race=n.attributes.next_race}renderHeader(){const t=this.next_race.Circuit.Location.country.replace(" ","-"),e=(0,o.getCircuitName)(t),i=n.html``,r=this.config.image_clickable?n.html`${i}`:i;return n.html`

  ${this.next_race.round} : ${this.next_race.raceName}

${r}
`}render(){if(!this.sensor_entity_id.endsWith("_races")||void 0===this.next_race)throw new Error("Please pass the correct sensor (races)");const t=new Date(this.next_race.date+"T"+this.next_race.time),e=(0,a.formatDateTimeRaceInfo)(new Date(this.next_race.FirstPractice.date+"T"+this.next_race.FirstPractice.time),this.hass.locale),i=(0,a.formatDateTimeRaceInfo)(new Date(this.next_race.SecondPractice.date+"T"+this.next_race.SecondPractice.time),this.hass.locale),o=void 0!==this.next_race.ThirdPractice?(0,a.formatDateTimeRaceInfo)(new Date(this.next_race.ThirdPractice.date+"T"+this.next_race.ThirdPractice.time),this.hass.locale):"-",s=(0,a.formatDateTimeRaceInfo)(t,this.hass.locale),l=void 0!==this.next_race.Qualifying?(0,a.formatDateTimeRaceInfo)(new Date(this.next_race.Qualifying.date+"T"+this.next_race.Qualifying.time),this.hass.locale):"-",u=void 0!==this.next_race.Sprint?(0,a.formatDateTimeRaceInfo)(new Date(this.next_race.Sprint.date+"T"+this.next_race.Sprint.time),this.hass.locale):"-";return n.html` @@ -157,4 +157,4 @@ text-decoration: none; color: var(--secondary-text-color); } -`},98:(t,e)=>{var i,n;Object.defineProperty(e,"__esModule",{value:!0}),e.FormulaOneCardType=e.PreviousRaceDisplay=void 0,(n=e.PreviousRaceDisplay||(e.PreviousRaceDisplay={})).Strikethrough="strikethrough",n.Italic="italic",n.Hide="hide",(i=e.FormulaOneCardType||(e.FormulaOneCardType={})).DriverStandings="driver_standings",i.ConstructorStandings="constructor_standings",i.NextRace="next_race",i.Schedule="schedule",i.LastResult="last_result"},593:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getDriverName=e.getCountryFlagUrl=e.checkConfig=e.hasConfigOrEntitiesChanged=void 0,e.hasConfigOrEntitiesChanged=(t,e)=>{if(e.has("config"))return!0;const i=e.get("_hass");return!!i&&i.states[t.sensor]!==t.hass.states[t.sensor]},e.checkConfig=t=>{if(void 0===t.card_type)throw new Error("Please define FormulaOne card type (card_type).");if(void 0===t.sensor)throw new Error("Please define FormulaOne sensor.")},e.getCountryFlagUrl=t=>{const e=[{countryDashed:"USA",name:"United-States-of-America"}].filter((e=>e.countryDashed==t));return e.length>0&&(t=e[0].name),`https://www.countries-ofthe-world.com/flags-normal/flag-of-${t}.png`},e.getDriverName=(t,e)=>{const i="VER"==t.code?1:t.permanentNumber;return`${t.givenName} ${t.familyName}${e.show_carnumber?` #${i}`:""}`}},692:(t,e,i)=>{var n;i.r(e),i.d(e,{_$LH:()=>H,html:()=>w,noChange:()=>N,nothing:()=>O,render:()=>I,svg:()=>$});const r=window,a=r.trustedTypes,o=a?a.createPolicy("lit-html",{createHTML:t=>t}):void 0,s=`lit$${(Math.random()+"").slice(9)}$`,l="?"+s,u=`<${l}>`,c=document,d=(t="")=>c.createComment(t),h=t=>null===t||"object"!=typeof t&&"function"!=typeof t,m=Array.isArray,y=t=>m(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]),p=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,f=/-->/g,g=/>/g,v=RegExp(">|[ \t\n\f\r](?:([^\\s\"'>=/]+)([ \t\n\f\r]*=[ \t\n\f\r]*(?:[^ \t\n\f\r\"'`<>=]|(\"|')|))|$)","g"),_=/'/g,C=/"/g,b=/^(?:script|style|textarea|title)$/i,S=t=>(e,...i)=>({_$litType$:t,strings:e,values:i}),w=S(1),$=S(2),N=Symbol.for("lit-noChange"),O=Symbol.for("lit-nothing"),A=new WeakMap,I=(t,e,i)=>{var n,r;const a=null!==(n=null==i?void 0:i.renderBefore)&&void 0!==n?n:e;let o=a._$litPart$;if(void 0===o){const t=null!==(r=null==i?void 0:i.renderBefore)&&void 0!==r?r:null;a._$litPart$=o=new P(e.insertBefore(d(),t),t,void 0,null!=i?i:{})}return o._$AI(t),o},E=c.createTreeWalker(c,129,null,!1),T=(t,e)=>{const i=t.length-1,n=[];let r,a=2===e?"":"",l=p;for(let e=0;e"===c[0]?(l=null!=r?r:p,d=-1):void 0===c[1]?d=-2:(d=l.lastIndex-c[2].length,o=c[1],l=void 0===c[3]?v:'"'===c[3]?C:_):l===C||l===_?l=v:l===f||l===g?l=p:(l=v,r=void 0);const m=l===v&&t[e+1].startsWith("/>")?" ":"";a+=l===p?i+u:d>=0?(n.push(o),i.slice(0,d)+"$lit$"+i.slice(d)+s+m):i+s+(-2===d?(n.push(void 0),e):m)}const c=a+(t[i]||"")+(2===e?"":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==o?o.createHTML(c):c,n]};class k{constructor({strings:t,_$litType$:e},i){let n;this.parts=[];let r=0,o=0;const u=t.length-1,c=this.parts,[h,m]=T(t,e);if(this.el=k.createElement(h,i),E.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(n=E.nextNode())&&c.length0){n.textContent=a?a.emptyScript:"";for(let i=0;i2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=O}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,n){const r=this.strings;let a=!1;if(void 0===r)t=x(this,t,e,0),a=!h(t)||t!==this._$AH&&t!==N,a&&(this._$AH=t);else{const n=t;let o,s;for(t=r[0],o=0;o{i.r(e),i.d(e,{customElement:()=>n,eventOptions:()=>l,property:()=>a,query:()=>u,queryAll:()=>c,queryAssignedElements:()=>y,queryAssignedNodes:()=>p,queryAsync:()=>d,state:()=>o});const n=t=>e=>"function"==typeof e?((t,e)=>(customElements.define(t,e),e))(t,e):((t,e)=>{const{kind:i,elements:n}=e;return{kind:i,elements:n,finisher(e){customElements.define(t,e)}}})(t,e),r=(t,e)=>"method"===e.kind&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(i){i.createProperty(e.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){"function"==typeof e.initializer&&(this[e.key]=e.initializer.call(this))},finisher(i){i.createProperty(e.key,t)}};function a(t){return(e,i)=>void 0!==i?((t,e,i)=>{e.constructor.createProperty(i,t)})(t,e,i):r(t,e)}function o(t){return a({...t,state:!0})}const s=({finisher:t,descriptor:e})=>(i,n)=>{var r;if(void 0===n){const n=null!==(r=i.originalKey)&&void 0!==r?r:i.key,a=null!=e?{kind:"method",placement:"prototype",key:n,descriptor:e(i.key)}:{...i,key:n};return null!=t&&(a.finisher=function(e){t(e,n)}),a}{const r=i.constructor;void 0!==e&&Object.defineProperty(i,n,e(n)),null==t||t(r,n)}};function l(t){return s({finisher:(e,i)=>{Object.assign(e.prototype[i],t)}})}function u(t,e){return s({descriptor:i=>{const n={get(){var e,i;return null!==(i=null===(e=this.renderRoot)||void 0===e?void 0:e.querySelector(t))&&void 0!==i?i:null},enumerable:!0,configurable:!0};if(e){const e="symbol"==typeof i?Symbol():"__"+i;n.get=function(){var i,n;return void 0===this[e]&&(this[e]=null!==(n=null===(i=this.renderRoot)||void 0===i?void 0:i.querySelector(t))&&void 0!==n?n:null),this[e]}}return n}})}function c(t){return s({descriptor:e=>({get(){var e,i;return null!==(i=null===(e=this.renderRoot)||void 0===e?void 0:e.querySelectorAll(t))&&void 0!==i?i:[]},enumerable:!0,configurable:!0})})}function d(t){return s({descriptor:e=>({async get(){var e;return await this.updateComplete,null===(e=this.renderRoot)||void 0===e?void 0:e.querySelector(t)},enumerable:!0,configurable:!0})})}var h;const m=null!=(null===(h=window.HTMLSlotElement)||void 0===h?void 0:h.prototype.assignedElements)?(t,e)=>t.assignedElements(e):(t,e)=>t.assignedNodes(e).filter((t=>t.nodeType===Node.ELEMENT_NODE));function y(t){const{slot:e,selector:i}=null!=t?t:{};return s({descriptor:n=>({get(){var n;const r="slot"+(e?`[name=${e}]`:":not([name])"),a=null===(n=this.renderRoot)||void 0===n?void 0:n.querySelector(r),o=null!=a?m(a,t):[];return i?o.filter((t=>t.matches(i))):o},enumerable:!0,configurable:!0})})}function p(t,e,i){let n,r=t;return"object"==typeof t?(r=t.slot,n=t):n={flatten:e},i?y({slot:r,flatten:e,selector:i}):s({descriptor:t=>({get(){var t,e;const i="slot"+(r?`[name=${r}]`:":not([name])"),a=null===(t=this.renderRoot)||void 0===t?void 0:t.querySelector(i);return null!==(e=null==a?void 0:a.assignedNodes(n))&&void 0!==e?e:[]},enumerable:!0,configurable:!0})})}},392:(t,e,i)=>{i.r(e),i.d(e,{CSSResult:()=>s,LitElement:()=>N,ReactiveElement:()=>C,UpdatingElement:()=>$,_$LE:()=>A,_$LH:()=>w._$LH,adoptStyles:()=>c,css:()=>u,defaultConverter:()=>g,getCompatibleStyle:()=>d,html:()=>w.html,noChange:()=>w.noChange,notEqual:()=>v,nothing:()=>w.nothing,render:()=>w.render,supportsAdoptingStyleSheets:()=>r,svg:()=>w.svg,unsafeCSS:()=>l});const n=window,r=n.ShadowRoot&&(void 0===n.ShadyCSS||n.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,a=Symbol(),o=new WeakMap;class s{constructor(t,e,i){if(this._$cssResult$=!0,i!==a)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(r&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=o.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&o.set(e,t))}return t}toString(){return this.cssText}}const l=t=>new s("string"==typeof t?t:t+"",void 0,a),u=(t,...e)=>{const i=1===t.length?t[0]:e.reduce(((e,i,n)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[n+1]),t[0]);return new s(i,t,a)},c=(t,e)=>{r?t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((e=>{const i=document.createElement("style"),r=n.litNonce;void 0!==r&&i.setAttribute("nonce",r),i.textContent=e.cssText,t.appendChild(i)}))},d=r?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return l(e)})(t):t;var h;const m=window,y=m.trustedTypes,p=y?y.emptyScript:"",f=m.reactiveElementPolyfillSupport,g={toAttribute(t,e){switch(e){case Boolean:t=t?p:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},v=(t,e)=>e!==t&&(e==e||t==t),_={attribute:!0,type:String,converter:g,reflect:!1,hasChanged:v};class C extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(t){var e;null!==(e=this.h)&&void 0!==e||(this.h=[]),this.h.push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,i)=>{const n=this._$Ep(i,e);void 0!==n&&(this._$Ev.set(n,i),t.push(n))})),t}static createProperty(t,e=_){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i="symbol"==typeof t?Symbol():"__"+t,n=this.getPropertyDescriptor(t,i,e);void 0!==n&&Object.defineProperty(this.prototype,t,n)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(n){const r=this[t];this[e]=n,this.requestUpdate(t,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||_}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const i of e)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(d(t))}else void 0!==t&&e.push(d(t));return e}static _$Ep(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}u(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,i;(null!==(e=this._$ES)&&void 0!==e?e:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(i=t.hostConnected)||void 0===i||i.call(t))}removeController(t){var e;null===(e=this._$ES)||void 0===e||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])}))}createRenderRoot(){var t;const e=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return c(e,this.constructor.elementStyles),e}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EO(t,e,i=_){var n;const r=this.constructor._$Ep(t,i);if(void 0!==r&&!0===i.reflect){const a=(void 0!==(null===(n=i.converter)||void 0===n?void 0:n.toAttribute)?i.converter:g).toAttribute(e,i.type);this._$El=t,null==a?this.removeAttribute(r):this.setAttribute(r,a),this._$El=null}}_$AK(t,e){var i;const n=this.constructor,r=n._$Ev.get(t);if(void 0!==r&&this._$El!==r){const t=n.getPropertyOptions(r),a="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(i=t.converter)||void 0===i?void 0:i.fromAttribute)?t.converter:g;this._$El=r,this[r]=a.fromAttribute(e,t.type),this._$El=null}}requestUpdate(t,e,i){let n=!0;void 0!==t&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||v)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===i.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,i))):n=!1),!this.isUpdatePending&&n&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((t,e)=>this[e]=t)),this._$Ei=void 0);let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(i)):this._$Ek()}catch(t){throw e=!1,this._$Ek(),t}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;null===(e=this._$ES)||void 0===e||e.forEach((t=>{var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,e)=>this._$EO(e,this[e],t))),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}}C.finalized=!0,C.elementProperties=new Map,C.elementStyles=[],C.shadowRootOptions={mode:"open"},null==f||f({ReactiveElement:C}),(null!==(h=m.reactiveElementVersions)&&void 0!==h?h:m.reactiveElementVersions=[]).push("1.4.1");var b,S,w=i(692);const $=C;class N extends C{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=i.firstChild),i}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=(0,w.render)(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}render(){return w.noChange}}N.finalized=!0,N._$litElement$=!0,null===(b=globalThis.litElementHydrateSupport)||void 0===b||b.call(globalThis,{LitElement:N});const O=globalThis.litElementPolyfillSupport;null==O||O({LitElement:N});const A={_$AK:(t,e,i)=>{t._$AK(e,i)},_$AL:t=>t._$AL};(null!==(S=globalThis.litElementVersions)&&void 0!==S?S:globalThis.litElementVersions=[]).push("3.2.2")},147:t=>{t.exports=JSON.parse('{"name":"formulaone-card","version":"0.1.2","description":"Frontend card for hass-formulaoneapi","main":"index.js","scripts":{"lint":"eslint src/**/*.ts","dev":"webpack -c webpack.config.js","build":"yarn lint && webpack -c webpack.config.js","test":"jest","coverage":"jest --coverage","workflow":"jest --coverage --json --outputFile=/home/runner/work/formulaone-card/formulaone-card/jest.results.json"},"repository":{"type":"git","url":"git+https://github.com/marcokreeft87/formulaone-card.git"},"keywords":[],"author":"","license":"ISC","bugs":{"url":"https://github.com/marcokreeft87/formulaone-card/issues"},"homepage":"https://github.com/marcokreeft87/formulaone-card#readme","devDependencies":{"@types/jest":"^29.1.1","@typescript-eslint/eslint-plugin":"^5.39.0","@typescript-eslint/parser":"^5.39.0","eslint":"^8.24.0","home-assistant-js-websocket":"^8.0.0","lit":"^2.3.1","typescript":"^4.8.4","webpack":"^5.74.0","webpack-cli":"^4.10.0"},"dependencies":{"@babel/plugin-transform-runtime":"^7.19.1","@babel/preset-env":"^7.19.3","@lit-labs/scoped-registry-mixin":"^1.0.1","babel-jest":"^29.1.2","compression-webpack-plugin":"^10.0.0","custom-card-helpers":"^1.9.0","jest-environment-jsdom":"^29.1.2","jest-ts-auto-mock":"^2.1.0","ts-auto-mock":"^3.6.2","ts-jest":"^29.0.3","ts-loader":"^9.4.1","ttypescript":"^1.5.13","yarn":"^1.22.19"}}')},634:t=>{t.exports=JSON.parse('[{"Code":"AD","Country":"Andorra","ISO":"53","Nationality":"Andorian"},{"Code":"AE","Country":"United Arab Emirates","ISO":"126","Nationality":"Emirian"},{"Code":"AF","Country":"Afghanistan","ISO":"133","Nationality":"Afghani"},{"Code":"AI","Country":"Anguilla","ISO":"55","Nationality":"Anguillan"},{"Code":"AM","Country":"Armenia","ISO":"58","Nationality":"Armenian"},{"Code":"AO","Country":"Angola","ISO":"54","Nationality":"Angolian"},{"Code":"AQ","Country":"Antarctica","ISO":"55","Nationality":"Antarctic"},{"Code":"AR","Country":"Argentina","ISO":"57","Nationality":"Argentine"},{"Code":"AS","Country":"Austria","ISO":"3","Nationality":"Austrian"},{"Code":"AU","Country":"Australia","ISO":"2","Nationality":"Australian"},{"Code":"AW","Country":"Aruba","ISO":"59","Nationality":"Arubian"},{"Code":"BA","Country":"Bangladesh","ISO":"45","Nationality":"Bangladeshi"},{"Code":"BB","Country":"Barbados","ISO":"63","Nationality":"Barbadian"},{"Code":"BE","Country":"Belgium","ISO":"4","Nationality":"Belgian"},{"Code":"BH","Country":"Bahrain","ISO":"62","Nationality":"Bahrainian"},{"Code":"BM","Country":"Bermuda","ISO":"67","Nationality":"Bermuda"},{"Code":"BO","Country":"Bolivia","ISO":"69","Nationality":"Bolivian"},{"Code":"BR","Country":"Brazil","ISO":"43","Nationality":"Brazilian"},{"Code":"BS","Country":"Bahamas","ISO":"61","Nationality":"Bahameese"},{"Code":"BT","Country":"Bhutan","ISO":"68","Nationality":"Bhutanese"},{"Code":"BU","Country":"Bulgaria","ISO":"44","Nationality":"Bulgarian"},{"Code":"BY","Country":"Belarus","ISO":"64","Nationality":"Belarusian"},{"Code":"BZ","Country":"Belize","ISO":"65","Nationality":"Belizean"},{"Code":"CA","Country":"Canada","ISO":"6","Nationality":"Canadian"},{"Code":"CG","Country":"Congo","ISO":"72","Nationality":"Congolese"},{"Code":"CH","Country":"China","ISO":"51","Nationality":"Chinese"},{"Code":"CH","Country":"Switzerland","ISO":"35","Nationality":"Swiss"},{"Code":"CL","Country":"Chile","ISO":"71","Nationality":"Chilean"},{"Code":"CM","Country":"Cambodia","ISO":"5","Nationality":"Cambodian"},{"Code":"CM","Country":"Cameroon","ISO":"70","Nationality":"Cameroonian"},{"Code":"CO","Country":"Columbia","ISO":"46","Nationality":"Columbian"},{"Code":"CR","Country":"Czech Republic","ISO":"50","Nationality":"Czech"},{"Code":"CR","Country":"Costa Rica","ISO":"73","Nationality":"Costa Rican"},{"Code":"CU","Country":"Cuba","ISO":"75","Nationality":"Cuban"},{"Code":"CY","Country":"Cyprus","ISO":"76","Nationality":"Cypriot"},{"Code":"DE","Country":"Germany","ISO":"10","Nationality":"German"},{"Code":"DK","Country":"Denmark","ISO":"7","Nationality":"Danish"},{"Code":"DM","Country":"Dominica","ISO":"77","Nationality":"Dominican"},{"Code":"EC","Country":"Ecuador","ISO":"78","Nationality":"Ecuadorean"},{"Code":"EE","Country":"Estonia","ISO":"79","Nationality":"Estonian"},{"Code":"EG","Country":"Egypt","ISO":"8","Nationality":"Egyptian"},{"Code":"ET","Country":"Ethiopia","ISO":"80","Nationality":"Ethiopian"},{"Code":"FI","Country":"Finland","ISO":"82","Nationality":"Finnish"},{"Code":"FJ","Country":"Fiji","ISO":"81","Nationality":"Fijian"},{"Code":"FR","Country":"France","ISO":"9","Nationality":"French"},{"Code":"GB","Country":"United Kingdom","ISO":"39","Nationality":"British"},{"Code":"GE","Country":"Georgia","ISO":"83","Nationality":"Georgian"},{"Code":"GH","Country":"Ghana","ISO":"84","Nationality":"Ghanaian"},{"Code":"GN","Country":"Guinea","ISO":"86","Nationality":"Guinean"},{"Code":"GR","Country":"Greece","ISO":"11","Nationality":"Greek"},{"Code":"GY","Country":"Guyana","ISO":"87","Nationality":"Guyanese"},{"Code":"HK","Country":"Hong Kong","ISO":"13","Nationality":"Chinese"},{"Code":"HR","Country":"Croatia","ISO":"74","Nationality":"Croatian"},{"Code":"HU","Country":"Hungary","ISO":"14","Nationality":"Hungarian"},{"Code":"ID","Country":"Indonesia","ISO":"16","Nationality":"Indonesian"},{"Code":"IE","Country":"Ireland","ISO":"90","Nationality":"Irish"},{"Code":"IN","Country":"India","ISO":"15","Nationality":"Indian"},{"Code":"IQ","Country":"Iraq","ISO":"89","Nationality":"Iraqi"},{"Code":"IR","Country":"Iran","ISO":"17","Nationality":"Iranian"},{"Code":"IS","Country":"Israel","ISO":"18","Nationality":"Israeli"},{"Code":"IS","Country":"Iceland","ISO":"88","Nationality":"Icelander"},{"Code":"IT","Country":"Italy","ISO":"19","Nationality":"Italian"},{"Code":"JM","Country":"Jamaica","ISO":"91","Nationality":"Jamaican"},{"Code":"JO","Country":"Jordan","ISO":"92","Nationality":"Jordanian"},{"Code":"JP","Country":"Japan","ISO":"20","Nationality":"Japanese"},{"Code":"KE","Country":"Kenya","ISO":"94","Nationality":"Kenyan"},{"Code":"KO","Country":"Korea","ISO":"21","Nationality":"Korean"},{"Code":"KW","Country":"Kuwait","ISO":"95","Nationality":"Kuwaiti"},{"Code":"KZ","Country":"Kazakhstan","ISO":"134","Nationality":"Kazakhstani"},{"Code":"KZ","Country":"Kazakhstan","ISO":"93","Nationality":"Kazakhstani"},{"Code":"LB","Country":"Lebanon","ISO":"96","Nationality":"Lebanese"},{"Code":"LK","Country":"Sri Lanka","ISO":"33","Nationality":"Sri Lankan"},{"Code":"LT","Country":"Lithuania","ISO":"97","Nationality":"Lithuanian"},{"Code":"LU","Country":"Luxembourg","ISO":"98","Nationality":"Luxembourger"},{"Code":"MA","Country":"Morocco","ISO":"104","Nationality":"Moroccan"},{"Code":"MC","Country":"Monaco","ISO":"102","Nationality":"Monegasque"},{"Code":"ME","Country":"Mexico","ISO":"47","Nationality":"Mexican"},{"Code":"MM","Country":"Myanmar","ISO":"105","Nationality":"Mayanmarese"},{"Code":"MN","Country":"Mongolia","ISO":"103","Nationality":"Mongolian"},{"Code":"MO","Country":"Macau","ISO":"42","Nationality":"Macau"},{"Code":"MU","Country":"Mauritius","ISO":"100","Nationality":"Mauritian"},{"Code":"MV","Country":"Maldives","ISO":"99","Nationality":"Maldivan"},{"Code":"MY","Country":"Malaysia","ISO":"22","Nationality":"Malaysian"},{"Code":"NA","Country":"Namibia","ISO":"106","Nationality":"Namibian"},{"Code":"NG","Country":"Nigeria","ISO":"108","Nationality":"Nigerian"},{"Code":"NL","Country":"Netherlands","ISO":"12","Nationality":"Dutch"},{"Code":"NO","Country":"Norway","ISO":"24","Nationality":"Norwegian"},{"Code":"NP","Country":"Nepal","ISO":"107","Nationality":"Nepalese"},{"Code":"NZ","Country":"New Zealand","ISO":"23","Nationality":"New Zealander"},{"Code":"OM","Country":"Oman","ISO":"109","Nationality":"Omani"},{"Code":"PA","Country":"Panama","ISO":"110","Nationality":"Panamanian"},{"Code":"PE","Country":"Peru","ISO":"112","Nationality":"Peruvian"},{"Code":"PH","Country":"Philippines","ISO":"27","Nationality":"Filipino"},{"Code":"PK","Country":"Pakistan","ISO":"26","Nationality":"Pakistani"},{"Code":"PO","Country":"Poland","ISO":"28","Nationality":"Polish"},{"Code":"PT","Country":"Portugal","ISO":"113","Nationality":"Portugees"},{"Code":"PY","Country":"Paraguay","ISO":"111","Nationality":"Paraguayan"},{"Code":"QA","Country":"Qatar","ISO":"115","Nationality":"Qatari"},{"Code":"RO","Country":"Romania","ISO":"48","Nationality":"Romanian"},{"Code":"RU","Country":"Russia","ISO":"29","Nationality":"Russian"},{"Code":"SA","Country":"Saudi Arabia","ISO":"116","Nationality":"Saudi Arabian"},{"Code":"SC","Country":"Seychelles","ISO":"119","Nationality":"Seychellois"},{"Code":"SE","Country":"Sweden","ISO":"34","Nationality":"Swedish"},{"Code":"SG","Country":"Singapore","ISO":"30","Nationality":"Singaporean"},{"Code":"SK","Country":"Slovakia","ISO":"120","Nationality":"Slovakian"},{"Code":"SN","Country":"Senegal","ISO":"117","Nationality":"Senegalese"},{"Code":"SO","Country":"Somalia","ISO":"121","Nationality":"Somali"},{"Code":"SP","Country":"Spain","ISO":"32","Nationality":"Spanish"},{"Code":"TH","Country":"Thailand","ISO":"37","Nationality":"Thai"},{"Code":"TN","Country":"Tunisia","ISO":"123","Nationality":"Tunisian"},{"Code":"TR","Country":"Turkey","ISO":"38","Nationality":"Turkish"},{"Code":"TW","Country":"Taiwan","ISO":"36","Nationality":"Taiwanese"},{"Code":"TZ","Country":"Tanzania","ISO":"122","Nationality":"Tanzanian"},{"Code":"UA","Country":"Ukraine","ISO":"125","Nationality":"Ukrainian"},{"Code":"UG","Country":"Uganda","ISO":"124","Nationality":"Ugandan"},{"Code":"US","Country":"United States of America","ISO":"40","Nationality":"American"},{"Code":"UY","Country":"Uruguay","ISO":"127","Nationality":"Uruguayan"},{"Code":"UZ","Country":"Uzbekistan","ISO":"128","Nationality":"Uzbekistani"},{"Code":"VE","Country":"Venezuela","ISO":"49","Nationality":"Venezuelan"},{"Code":"VN","Country":"Vietnam","ISO":"1","Nationality":"Vietnamese"},{"Code":"YE","Country":"Yemen","ISO":"130","Nationality":"Yemeni"},{"Code":"ZA","Country":"South Africa","ISO":"31","Nationality":"South African"},{"Code":"ZM","Country":"Zambia","ISO":"131","Nationality":"Zambian"},{"Code":"ZW","Country":"Zimbabwe","ISO":"132","Nationality":"Zimbabwean"}]')}},e={};function i(n){var r=e[n];if(void 0!==r)return r.exports;var a=e[n]={exports:{}};return t[n].call(a.exports,a,a.exports,i),a.exports}i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i(607)})(); \ No newline at end of file +`},98:(t,e)=>{var i,n;Object.defineProperty(e,"__esModule",{value:!0}),e.FormulaOneCardType=e.PreviousRaceDisplay=void 0,(n=e.PreviousRaceDisplay||(e.PreviousRaceDisplay={})).Strikethrough="strikethrough",n.Italic="italic",n.Hide="hide",(i=e.FormulaOneCardType||(e.FormulaOneCardType={})).DriverStandings="driver_standings",i.ConstructorStandings="constructor_standings",i.NextRace="next_race",i.Schedule="schedule",i.LastResult="last_result"},593:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getDriverName=e.getCircuitName=e.getCountryFlagUrl=e.checkConfig=e.hasConfigOrEntitiesChanged=void 0,e.hasConfigOrEntitiesChanged=(t,e)=>{if(e.has("config"))return!0;const i=e.get("_hass");return!!i&&i.states[t.sensor]!==t.hass.states[t.sensor]},e.checkConfig=t=>{if(void 0===t.card_type)throw new Error("Please define FormulaOne card type (card_type).");if(void 0===t.sensor)throw new Error("Please define FormulaOne sensor.")},e.getCountryFlagUrl=t=>{const e=[{countryDashed:"USA",name:"United-States-of-America"},{countryDashed:"UAE",name:"United-Arab-Emirates"}].filter((e=>e.countryDashed==t));return e.length>0&&(t=e[0].name),`https://www.countries-ofthe-world.com/flags-normal/flag-of-${t}.png`},e.getCircuitName=t=>{const e=[{countryDashed:"UAE",name:"Abu_Dhabi"}].filter((e=>e.countryDashed==t));return e.length>0&&(t=e[0].name),t},e.getDriverName=(t,e)=>{const i="VER"==t.code?1:t.permanentNumber;return`${t.givenName} ${t.familyName}${e.show_carnumber?` #${i}`:""}`}},692:(t,e,i)=>{var n;i.r(e),i.d(e,{_$LH:()=>H,html:()=>w,noChange:()=>$,nothing:()=>A,render:()=>I,svg:()=>N});const r=window,a=r.trustedTypes,o=a?a.createPolicy("lit-html",{createHTML:t=>t}):void 0,s=`lit$${(Math.random()+"").slice(9)}$`,l="?"+s,u=`<${l}>`,c=document,d=(t="")=>c.createComment(t),h=t=>null===t||"object"!=typeof t&&"function"!=typeof t,m=Array.isArray,y=t=>m(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]),p=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,f=/-->/g,g=/>/g,v=RegExp(">|[ \t\n\f\r](?:([^\\s\"'>=/]+)([ \t\n\f\r]*=[ \t\n\f\r]*(?:[^ \t\n\f\r\"'`<>=]|(\"|')|))|$)","g"),_=/'/g,C=/"/g,b=/^(?:script|style|textarea|title)$/i,S=t=>(e,...i)=>({_$litType$:t,strings:e,values:i}),w=S(1),N=S(2),$=Symbol.for("lit-noChange"),A=Symbol.for("lit-nothing"),O=new WeakMap,I=(t,e,i)=>{var n,r;const a=null!==(n=null==i?void 0:i.renderBefore)&&void 0!==n?n:e;let o=a._$litPart$;if(void 0===o){const t=null!==(r=null==i?void 0:i.renderBefore)&&void 0!==r?r:null;a._$litPart$=o=new P(e.insertBefore(d(),t),t,void 0,null!=i?i:{})}return o._$AI(t),o},E=c.createTreeWalker(c,129,null,!1),T=(t,e)=>{const i=t.length-1,n=[];let r,a=2===e?"":"",l=p;for(let e=0;e"===c[0]?(l=null!=r?r:p,d=-1):void 0===c[1]?d=-2:(d=l.lastIndex-c[2].length,o=c[1],l=void 0===c[3]?v:'"'===c[3]?C:_):l===C||l===_?l=v:l===f||l===g?l=p:(l=v,r=void 0);const m=l===v&&t[e+1].startsWith("/>")?" ":"";a+=l===p?i+u:d>=0?(n.push(o),i.slice(0,d)+"$lit$"+i.slice(d)+s+m):i+s+(-2===d?(n.push(void 0),e):m)}const c=a+(t[i]||"")+(2===e?"":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==o?o.createHTML(c):c,n]};class k{constructor({strings:t,_$litType$:e},i){let n;this.parts=[];let r=0,o=0;const u=t.length-1,c=this.parts,[h,m]=T(t,e);if(this.el=k.createElement(h,i),E.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(n=E.nextNode())&&c.length0){n.textContent=a?a.emptyScript:"";for(let i=0;i2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=A}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,n){const r=this.strings;let a=!1;if(void 0===r)t=x(this,t,e,0),a=!h(t)||t!==this._$AH&&t!==$,a&&(this._$AH=t);else{const n=t;let o,s;for(t=r[0],o=0;o{i.r(e),i.d(e,{customElement:()=>n,eventOptions:()=>l,property:()=>a,query:()=>u,queryAll:()=>c,queryAssignedElements:()=>y,queryAssignedNodes:()=>p,queryAsync:()=>d,state:()=>o});const n=t=>e=>"function"==typeof e?((t,e)=>(customElements.define(t,e),e))(t,e):((t,e)=>{const{kind:i,elements:n}=e;return{kind:i,elements:n,finisher(e){customElements.define(t,e)}}})(t,e),r=(t,e)=>"method"===e.kind&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(i){i.createProperty(e.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){"function"==typeof e.initializer&&(this[e.key]=e.initializer.call(this))},finisher(i){i.createProperty(e.key,t)}};function a(t){return(e,i)=>void 0!==i?((t,e,i)=>{e.constructor.createProperty(i,t)})(t,e,i):r(t,e)}function o(t){return a({...t,state:!0})}const s=({finisher:t,descriptor:e})=>(i,n)=>{var r;if(void 0===n){const n=null!==(r=i.originalKey)&&void 0!==r?r:i.key,a=null!=e?{kind:"method",placement:"prototype",key:n,descriptor:e(i.key)}:{...i,key:n};return null!=t&&(a.finisher=function(e){t(e,n)}),a}{const r=i.constructor;void 0!==e&&Object.defineProperty(i,n,e(n)),null==t||t(r,n)}};function l(t){return s({finisher:(e,i)=>{Object.assign(e.prototype[i],t)}})}function u(t,e){return s({descriptor:i=>{const n={get(){var e,i;return null!==(i=null===(e=this.renderRoot)||void 0===e?void 0:e.querySelector(t))&&void 0!==i?i:null},enumerable:!0,configurable:!0};if(e){const e="symbol"==typeof i?Symbol():"__"+i;n.get=function(){var i,n;return void 0===this[e]&&(this[e]=null!==(n=null===(i=this.renderRoot)||void 0===i?void 0:i.querySelector(t))&&void 0!==n?n:null),this[e]}}return n}})}function c(t){return s({descriptor:e=>({get(){var e,i;return null!==(i=null===(e=this.renderRoot)||void 0===e?void 0:e.querySelectorAll(t))&&void 0!==i?i:[]},enumerable:!0,configurable:!0})})}function d(t){return s({descriptor:e=>({async get(){var e;return await this.updateComplete,null===(e=this.renderRoot)||void 0===e?void 0:e.querySelector(t)},enumerable:!0,configurable:!0})})}var h;const m=null!=(null===(h=window.HTMLSlotElement)||void 0===h?void 0:h.prototype.assignedElements)?(t,e)=>t.assignedElements(e):(t,e)=>t.assignedNodes(e).filter((t=>t.nodeType===Node.ELEMENT_NODE));function y(t){const{slot:e,selector:i}=null!=t?t:{};return s({descriptor:n=>({get(){var n;const r="slot"+(e?`[name=${e}]`:":not([name])"),a=null===(n=this.renderRoot)||void 0===n?void 0:n.querySelector(r),o=null!=a?m(a,t):[];return i?o.filter((t=>t.matches(i))):o},enumerable:!0,configurable:!0})})}function p(t,e,i){let n,r=t;return"object"==typeof t?(r=t.slot,n=t):n={flatten:e},i?y({slot:r,flatten:e,selector:i}):s({descriptor:t=>({get(){var t,e;const i="slot"+(r?`[name=${r}]`:":not([name])"),a=null===(t=this.renderRoot)||void 0===t?void 0:t.querySelector(i);return null!==(e=null==a?void 0:a.assignedNodes(n))&&void 0!==e?e:[]},enumerable:!0,configurable:!0})})}},392:(t,e,i)=>{i.r(e),i.d(e,{CSSResult:()=>s,LitElement:()=>$,ReactiveElement:()=>C,UpdatingElement:()=>N,_$LE:()=>O,_$LH:()=>w._$LH,adoptStyles:()=>c,css:()=>u,defaultConverter:()=>g,getCompatibleStyle:()=>d,html:()=>w.html,noChange:()=>w.noChange,notEqual:()=>v,nothing:()=>w.nothing,render:()=>w.render,supportsAdoptingStyleSheets:()=>r,svg:()=>w.svg,unsafeCSS:()=>l});const n=window,r=n.ShadowRoot&&(void 0===n.ShadyCSS||n.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,a=Symbol(),o=new WeakMap;class s{constructor(t,e,i){if(this._$cssResult$=!0,i!==a)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(r&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=o.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&o.set(e,t))}return t}toString(){return this.cssText}}const l=t=>new s("string"==typeof t?t:t+"",void 0,a),u=(t,...e)=>{const i=1===t.length?t[0]:e.reduce(((e,i,n)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[n+1]),t[0]);return new s(i,t,a)},c=(t,e)=>{r?t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((e=>{const i=document.createElement("style"),r=n.litNonce;void 0!==r&&i.setAttribute("nonce",r),i.textContent=e.cssText,t.appendChild(i)}))},d=r?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return l(e)})(t):t;var h;const m=window,y=m.trustedTypes,p=y?y.emptyScript:"",f=m.reactiveElementPolyfillSupport,g={toAttribute(t,e){switch(e){case Boolean:t=t?p:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},v=(t,e)=>e!==t&&(e==e||t==t),_={attribute:!0,type:String,converter:g,reflect:!1,hasChanged:v};class C extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(t){var e;null!==(e=this.h)&&void 0!==e||(this.h=[]),this.h.push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,i)=>{const n=this._$Ep(i,e);void 0!==n&&(this._$Ev.set(n,i),t.push(n))})),t}static createProperty(t,e=_){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i="symbol"==typeof t?Symbol():"__"+t,n=this.getPropertyDescriptor(t,i,e);void 0!==n&&Object.defineProperty(this.prototype,t,n)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(n){const r=this[t];this[e]=n,this.requestUpdate(t,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||_}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const i of e)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(d(t))}else void 0!==t&&e.push(d(t));return e}static _$Ep(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}u(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,i;(null!==(e=this._$ES)&&void 0!==e?e:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(i=t.hostConnected)||void 0===i||i.call(t))}removeController(t){var e;null===(e=this._$ES)||void 0===e||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])}))}createRenderRoot(){var t;const e=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return c(e,this.constructor.elementStyles),e}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EO(t,e,i=_){var n;const r=this.constructor._$Ep(t,i);if(void 0!==r&&!0===i.reflect){const a=(void 0!==(null===(n=i.converter)||void 0===n?void 0:n.toAttribute)?i.converter:g).toAttribute(e,i.type);this._$El=t,null==a?this.removeAttribute(r):this.setAttribute(r,a),this._$El=null}}_$AK(t,e){var i;const n=this.constructor,r=n._$Ev.get(t);if(void 0!==r&&this._$El!==r){const t=n.getPropertyOptions(r),a="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(i=t.converter)||void 0===i?void 0:i.fromAttribute)?t.converter:g;this._$El=r,this[r]=a.fromAttribute(e,t.type),this._$El=null}}requestUpdate(t,e,i){let n=!0;void 0!==t&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||v)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===i.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,i))):n=!1),!this.isUpdatePending&&n&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((t,e)=>this[e]=t)),this._$Ei=void 0);let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(i)):this._$Ek()}catch(t){throw e=!1,this._$Ek(),t}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;null===(e=this._$ES)||void 0===e||e.forEach((t=>{var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,e)=>this._$EO(e,this[e],t))),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}}C.finalized=!0,C.elementProperties=new Map,C.elementStyles=[],C.shadowRootOptions={mode:"open"},null==f||f({ReactiveElement:C}),(null!==(h=m.reactiveElementVersions)&&void 0!==h?h:m.reactiveElementVersions=[]).push("1.4.1");var b,S,w=i(692);const N=C;class $ extends C{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=i.firstChild),i}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=(0,w.render)(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}render(){return w.noChange}}$.finalized=!0,$._$litElement$=!0,null===(b=globalThis.litElementHydrateSupport)||void 0===b||b.call(globalThis,{LitElement:$});const A=globalThis.litElementPolyfillSupport;null==A||A({LitElement:$});const O={_$AK:(t,e,i)=>{t._$AK(e,i)},_$AL:t=>t._$AL};(null!==(S=globalThis.litElementVersions)&&void 0!==S?S:globalThis.litElementVersions=[]).push("3.2.2")},147:t=>{t.exports=JSON.parse('{"name":"formulaone-card","version":"0.1.4","description":"Frontend card for hass-formulaoneapi","main":"index.js","scripts":{"lint":"eslint src/**/*.ts","dev":"webpack -c webpack.config.js","build":"yarn lint && webpack -c webpack.config.js","test":"jest","coverage":"jest --coverage","workflow":"jest --coverage --json --outputFile=/home/runner/work/formulaone-card/formulaone-card/jest.results.json"},"repository":{"type":"git","url":"git+https://github.com/marcokreeft87/formulaone-card.git"},"keywords":[],"author":"","license":"ISC","bugs":{"url":"https://github.com/marcokreeft87/formulaone-card/issues"},"homepage":"https://github.com/marcokreeft87/formulaone-card#readme","devDependencies":{"@types/jest":"^29.1.1","@typescript-eslint/eslint-plugin":"^5.39.0","@typescript-eslint/parser":"^5.39.0","eslint":"^8.24.0","home-assistant-js-websocket":"^8.0.0","lit":"^2.3.1","typescript":"^4.8.4","webpack":"^5.74.0","webpack-cli":"^4.10.0"},"dependencies":{"@babel/plugin-transform-runtime":"^7.19.1","@babel/preset-env":"^7.19.3","@lit-labs/scoped-registry-mixin":"^1.0.1","babel-jest":"^29.1.2","compression-webpack-plugin":"^10.0.0","custom-card-helpers":"^1.9.0","jest-environment-jsdom":"^29.1.2","jest-ts-auto-mock":"^2.1.0","ts-auto-mock":"^3.6.2","ts-jest":"^29.0.3","ts-loader":"^9.4.1","ttypescript":"^1.5.13","yarn":"^1.22.19"}}')},634:t=>{t.exports=JSON.parse('[{"Code":"AD","Country":"Andorra","ISO":"53","Nationality":"Andorian"},{"Code":"AE","Country":"United Arab Emirates","ISO":"126","Nationality":"Emirian"},{"Code":"AF","Country":"Afghanistan","ISO":"133","Nationality":"Afghani"},{"Code":"AI","Country":"Anguilla","ISO":"55","Nationality":"Anguillan"},{"Code":"AM","Country":"Armenia","ISO":"58","Nationality":"Armenian"},{"Code":"AO","Country":"Angola","ISO":"54","Nationality":"Angolian"},{"Code":"AQ","Country":"Antarctica","ISO":"55","Nationality":"Antarctic"},{"Code":"AR","Country":"Argentina","ISO":"57","Nationality":"Argentine"},{"Code":"AS","Country":"Austria","ISO":"3","Nationality":"Austrian"},{"Code":"AU","Country":"Australia","ISO":"2","Nationality":"Australian"},{"Code":"AW","Country":"Aruba","ISO":"59","Nationality":"Arubian"},{"Code":"BA","Country":"Bangladesh","ISO":"45","Nationality":"Bangladeshi"},{"Code":"BB","Country":"Barbados","ISO":"63","Nationality":"Barbadian"},{"Code":"BE","Country":"Belgium","ISO":"4","Nationality":"Belgian"},{"Code":"BH","Country":"Bahrain","ISO":"62","Nationality":"Bahrainian"},{"Code":"BM","Country":"Bermuda","ISO":"67","Nationality":"Bermuda"},{"Code":"BO","Country":"Bolivia","ISO":"69","Nationality":"Bolivian"},{"Code":"BR","Country":"Brazil","ISO":"43","Nationality":"Brazilian"},{"Code":"BS","Country":"Bahamas","ISO":"61","Nationality":"Bahameese"},{"Code":"BT","Country":"Bhutan","ISO":"68","Nationality":"Bhutanese"},{"Code":"BU","Country":"Bulgaria","ISO":"44","Nationality":"Bulgarian"},{"Code":"BY","Country":"Belarus","ISO":"64","Nationality":"Belarusian"},{"Code":"BZ","Country":"Belize","ISO":"65","Nationality":"Belizean"},{"Code":"CA","Country":"Canada","ISO":"6","Nationality":"Canadian"},{"Code":"CG","Country":"Congo","ISO":"72","Nationality":"Congolese"},{"Code":"CH","Country":"China","ISO":"51","Nationality":"Chinese"},{"Code":"CH","Country":"Switzerland","ISO":"35","Nationality":"Swiss"},{"Code":"CL","Country":"Chile","ISO":"71","Nationality":"Chilean"},{"Code":"CM","Country":"Cambodia","ISO":"5","Nationality":"Cambodian"},{"Code":"CM","Country":"Cameroon","ISO":"70","Nationality":"Cameroonian"},{"Code":"CO","Country":"Columbia","ISO":"46","Nationality":"Columbian"},{"Code":"CR","Country":"Czech Republic","ISO":"50","Nationality":"Czech"},{"Code":"CR","Country":"Costa Rica","ISO":"73","Nationality":"Costa Rican"},{"Code":"CU","Country":"Cuba","ISO":"75","Nationality":"Cuban"},{"Code":"CY","Country":"Cyprus","ISO":"76","Nationality":"Cypriot"},{"Code":"DE","Country":"Germany","ISO":"10","Nationality":"German"},{"Code":"DK","Country":"Denmark","ISO":"7","Nationality":"Danish"},{"Code":"DM","Country":"Dominica","ISO":"77","Nationality":"Dominican"},{"Code":"EC","Country":"Ecuador","ISO":"78","Nationality":"Ecuadorean"},{"Code":"EE","Country":"Estonia","ISO":"79","Nationality":"Estonian"},{"Code":"EG","Country":"Egypt","ISO":"8","Nationality":"Egyptian"},{"Code":"ET","Country":"Ethiopia","ISO":"80","Nationality":"Ethiopian"},{"Code":"FI","Country":"Finland","ISO":"82","Nationality":"Finnish"},{"Code":"FJ","Country":"Fiji","ISO":"81","Nationality":"Fijian"},{"Code":"FR","Country":"France","ISO":"9","Nationality":"French"},{"Code":"GB","Country":"United Kingdom","ISO":"39","Nationality":"British"},{"Code":"GE","Country":"Georgia","ISO":"83","Nationality":"Georgian"},{"Code":"GH","Country":"Ghana","ISO":"84","Nationality":"Ghanaian"},{"Code":"GN","Country":"Guinea","ISO":"86","Nationality":"Guinean"},{"Code":"GR","Country":"Greece","ISO":"11","Nationality":"Greek"},{"Code":"GY","Country":"Guyana","ISO":"87","Nationality":"Guyanese"},{"Code":"HK","Country":"Hong Kong","ISO":"13","Nationality":"Chinese"},{"Code":"HR","Country":"Croatia","ISO":"74","Nationality":"Croatian"},{"Code":"HU","Country":"Hungary","ISO":"14","Nationality":"Hungarian"},{"Code":"ID","Country":"Indonesia","ISO":"16","Nationality":"Indonesian"},{"Code":"IE","Country":"Ireland","ISO":"90","Nationality":"Irish"},{"Code":"IN","Country":"India","ISO":"15","Nationality":"Indian"},{"Code":"IQ","Country":"Iraq","ISO":"89","Nationality":"Iraqi"},{"Code":"IR","Country":"Iran","ISO":"17","Nationality":"Iranian"},{"Code":"IS","Country":"Israel","ISO":"18","Nationality":"Israeli"},{"Code":"IS","Country":"Iceland","ISO":"88","Nationality":"Icelander"},{"Code":"IT","Country":"Italy","ISO":"19","Nationality":"Italian"},{"Code":"JM","Country":"Jamaica","ISO":"91","Nationality":"Jamaican"},{"Code":"JO","Country":"Jordan","ISO":"92","Nationality":"Jordanian"},{"Code":"JP","Country":"Japan","ISO":"20","Nationality":"Japanese"},{"Code":"KE","Country":"Kenya","ISO":"94","Nationality":"Kenyan"},{"Code":"KO","Country":"Korea","ISO":"21","Nationality":"Korean"},{"Code":"KW","Country":"Kuwait","ISO":"95","Nationality":"Kuwaiti"},{"Code":"KZ","Country":"Kazakhstan","ISO":"134","Nationality":"Kazakhstani"},{"Code":"KZ","Country":"Kazakhstan","ISO":"93","Nationality":"Kazakhstani"},{"Code":"LB","Country":"Lebanon","ISO":"96","Nationality":"Lebanese"},{"Code":"LK","Country":"Sri Lanka","ISO":"33","Nationality":"Sri Lankan"},{"Code":"LT","Country":"Lithuania","ISO":"97","Nationality":"Lithuanian"},{"Code":"LU","Country":"Luxembourg","ISO":"98","Nationality":"Luxembourger"},{"Code":"MA","Country":"Morocco","ISO":"104","Nationality":"Moroccan"},{"Code":"MC","Country":"Monaco","ISO":"102","Nationality":"Monegasque"},{"Code":"ME","Country":"Mexico","ISO":"47","Nationality":"Mexican"},{"Code":"MM","Country":"Myanmar","ISO":"105","Nationality":"Mayanmarese"},{"Code":"MN","Country":"Mongolia","ISO":"103","Nationality":"Mongolian"},{"Code":"MO","Country":"Macau","ISO":"42","Nationality":"Macau"},{"Code":"MU","Country":"Mauritius","ISO":"100","Nationality":"Mauritian"},{"Code":"MV","Country":"Maldives","ISO":"99","Nationality":"Maldivan"},{"Code":"MY","Country":"Malaysia","ISO":"22","Nationality":"Malaysian"},{"Code":"NA","Country":"Namibia","ISO":"106","Nationality":"Namibian"},{"Code":"NG","Country":"Nigeria","ISO":"108","Nationality":"Nigerian"},{"Code":"NL","Country":"Netherlands","ISO":"12","Nationality":"Dutch"},{"Code":"NO","Country":"Norway","ISO":"24","Nationality":"Norwegian"},{"Code":"NP","Country":"Nepal","ISO":"107","Nationality":"Nepalese"},{"Code":"NZ","Country":"New Zealand","ISO":"23","Nationality":"New Zealander"},{"Code":"OM","Country":"Oman","ISO":"109","Nationality":"Omani"},{"Code":"PA","Country":"Panama","ISO":"110","Nationality":"Panamanian"},{"Code":"PE","Country":"Peru","ISO":"112","Nationality":"Peruvian"},{"Code":"PH","Country":"Philippines","ISO":"27","Nationality":"Filipino"},{"Code":"PK","Country":"Pakistan","ISO":"26","Nationality":"Pakistani"},{"Code":"PO","Country":"Poland","ISO":"28","Nationality":"Polish"},{"Code":"PT","Country":"Portugal","ISO":"113","Nationality":"Portugees"},{"Code":"PY","Country":"Paraguay","ISO":"111","Nationality":"Paraguayan"},{"Code":"QA","Country":"Qatar","ISO":"115","Nationality":"Qatari"},{"Code":"RO","Country":"Romania","ISO":"48","Nationality":"Romanian"},{"Code":"RU","Country":"Russia","ISO":"29","Nationality":"Russian"},{"Code":"SA","Country":"Saudi Arabia","ISO":"116","Nationality":"Saudi Arabian"},{"Code":"SC","Country":"Seychelles","ISO":"119","Nationality":"Seychellois"},{"Code":"SE","Country":"Sweden","ISO":"34","Nationality":"Swedish"},{"Code":"SG","Country":"Singapore","ISO":"30","Nationality":"Singaporean"},{"Code":"SK","Country":"Slovakia","ISO":"120","Nationality":"Slovakian"},{"Code":"SN","Country":"Senegal","ISO":"117","Nationality":"Senegalese"},{"Code":"SO","Country":"Somalia","ISO":"121","Nationality":"Somali"},{"Code":"SP","Country":"Spain","ISO":"32","Nationality":"Spanish"},{"Code":"TH","Country":"Thailand","ISO":"37","Nationality":"Thai"},{"Code":"TN","Country":"Tunisia","ISO":"123","Nationality":"Tunisian"},{"Code":"TR","Country":"Turkey","ISO":"38","Nationality":"Turkish"},{"Code":"TW","Country":"Taiwan","ISO":"36","Nationality":"Taiwanese"},{"Code":"TZ","Country":"Tanzania","ISO":"122","Nationality":"Tanzanian"},{"Code":"UA","Country":"Ukraine","ISO":"125","Nationality":"Ukrainian"},{"Code":"UG","Country":"Uganda","ISO":"124","Nationality":"Ugandan"},{"Code":"US","Country":"United States of America","ISO":"40","Nationality":"American"},{"Code":"UY","Country":"Uruguay","ISO":"127","Nationality":"Uruguayan"},{"Code":"UZ","Country":"Uzbekistan","ISO":"128","Nationality":"Uzbekistani"},{"Code":"VE","Country":"Venezuela","ISO":"49","Nationality":"Venezuelan"},{"Code":"VN","Country":"Vietnam","ISO":"1","Nationality":"Vietnamese"},{"Code":"YE","Country":"Yemen","ISO":"130","Nationality":"Yemeni"},{"Code":"ZA","Country":"South Africa","ISO":"31","Nationality":"South African"},{"Code":"ZM","Country":"Zambia","ISO":"131","Nationality":"Zambian"},{"Code":"ZW","Country":"Zimbabwe","ISO":"132","Nationality":"Zimbabwean"}]')}},e={};function i(n){var r=e[n];if(void 0!==r)return r.exports;var a=e[n]={exports:{}};return t[n].call(a.exports,a,a.exports,i),a.exports}i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i(607)})(); \ No newline at end of file diff --git a/formulaone-card.js.gz b/formulaone-card.js.gz index e4967fc..058d4f5 100644 Binary files a/formulaone-card.js.gz and b/formulaone-card.js.gz differ diff --git a/package-lock.json b/package-lock.json index 3ad3bd3..981b020 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "formulaone-card", - "version": "0.0.3", + "version": "0.1.4", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "formulaone-card", - "version": "0.0.3", + "version": "0.1.4", "license": "ISC", "dependencies": { "@babel/plugin-transform-runtime": "^7.19.1", diff --git a/package.json b/package.json index b928b9f..219f805 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "formulaone-card", - "version": "0.1.3", + "version": "0.1.4", "description": "Frontend card for hass-formulaoneapi", "main": "index.js", "scripts": { diff --git a/src/cards/last-result.ts b/src/cards/last-result.ts index f9ccd7a..021bca1 100644 --- a/src/cards/last-result.ts +++ b/src/cards/last-result.ts @@ -1,7 +1,7 @@ import { HomeAssistant } from "custom-card-helpers"; import { html, HTMLTemplateResult } from "lit-html"; import { FormulaOneCardConfig, Race, Result } from "../types/formulaone-card-types"; -import { getCountryFlagUrl, getDriverName } from "../utils"; +import { getCircuitName, getCountryFlagUrl, getDriverName } from "../utils"; import { BaseCard } from "./base-card"; export default class LastResult extends BaseCard { @@ -26,7 +26,8 @@ export default class LastResult extends BaseCard { const data = this.sensor.data as Race; const countryDashed = data.Circuit.Location.country.replace(" ","-"); - const imageHtml = html``; + const circuitName = getCircuitName(countryDashed); + const imageHtml = html``; const imageWithLinkHtml = this.config.image_clickable ? html`${imageHtml}` : imageHtml; return html`

  ${data.round} : ${data.raceName}

${imageWithLinkHtml}
` diff --git a/src/cards/next-race.ts b/src/cards/next-race.ts index f7b7fdf..caebbe2 100644 --- a/src/cards/next-race.ts +++ b/src/cards/next-race.ts @@ -3,7 +3,7 @@ import { html, HTMLTemplateResult } from "lit-html"; import { formatDateNumeric } from "../lib/format_date"; import { formatDateTimeRaceInfo } from "../lib/format_date_time"; import { FormulaOneCardConfig, Race } from "../types/formulaone-card-types"; -import { getCountryFlagUrl } from "../utils"; +import { getCircuitName, getCountryFlagUrl } from "../utils"; import { BaseCard } from "./base-card"; export default class NextRace extends BaseCard { @@ -20,8 +20,10 @@ export default class NextRace extends BaseCard { renderHeader(): HTMLTemplateResult { - const countryDashed = this.next_race.Circuit.Location.country.replace(" ","-"); - const imageHtml = html``; + const countryDashed = this.next_race.Circuit.Location.country.replace(" ","-") + const circuitName = getCircuitName(countryDashed); + + const imageHtml = html``; const imageWithLinkHtml = this.config.image_clickable ? html`${imageHtml}` : imageHtml; return html`

  ${this.next_race.round} : ${this.next_race.raceName}

${imageWithLinkHtml}
` diff --git a/src/utils.ts b/src/utils.ts index f9425d8..968920b 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -25,7 +25,7 @@ export const checkConfig = (config: FormulaOneCardConfig) => { }; export const getCountryFlagUrl = (countryDashed: string) => { - const exceptions = [{ countryDashed: 'USA', name: 'United-States-of-America'}]; + const exceptions = [{ countryDashed: 'USA', name: 'United-States-of-America'}, { countryDashed: 'UAE', name: 'United-Arab-Emirates'}]; const exception = exceptions.filter(exception => exception.countryDashed == countryDashed); if(exception.length > 0) @@ -36,6 +36,18 @@ export const getCountryFlagUrl = (countryDashed: string) => { return `https://www.countries-ofthe-world.com/flags-normal/flag-of-${countryDashed}.png`; } +export const getCircuitName = (circuitName: string) => { + const exceptions = [{ countryDashed: 'UAE', name: 'Abu_Dhabi'}]; + + const exception = exceptions.filter(exception => exception.countryDashed == circuitName); + if(exception.length > 0) + { + circuitName = exception[0].name; + } + + return circuitName; +} + export const getDriverName = (driver: Driver, config: FormulaOneCardConfig) => { const permanentNumber = driver.code == 'VER' ? 1 : driver.permanentNumber; return `${driver.givenName} ${driver.familyName}${(config.show_carnumber ? ` #${permanentNumber}` : '')}`; diff --git a/tests/utils/getCircuitName.test.ts b/tests/utils/getCircuitName.test.ts new file mode 100644 index 0000000..e104625 --- /dev/null +++ b/tests/utils/getCircuitName.test.ts @@ -0,0 +1,11 @@ +import { getCircuitName } from '../../src/utils'; + +describe('Testing util file function getCircuitName', () => { + test('Passing Japan should return expected circuit name', () => { + expect(getCircuitName('Japan')).toBe('Japan') + }), + test('Passing UAE should return expected circuit name', () => { + expect(getCircuitName('UAE')).toBe('Abu_Dhabi') + }) +}) + diff --git a/tests/utils/getCountryFlagUrl.test.ts b/tests/utils/getCountryFlagUrl.test.ts index fced90f..1370692 100644 --- a/tests/utils/getCountryFlagUrl.test.ts +++ b/tests/utils/getCountryFlagUrl.test.ts @@ -7,6 +7,9 @@ describe('Testing util file function getCountryFlagUrl', () => { test('Passing USA should return expected flag url', () => { expect(getCountryFlagUrl('USA')).toBe('https://www.countries-ofthe-world.com/flags-normal/flag-of-United-States-of-America.png') }), + test('Passing UAE should return expected flag url', () => { + expect(getCountryFlagUrl('UAE')).toBe('https://www.countries-ofthe-world.com/flags-normal/flag-of-United-Arab-Emirates.png') + }), test('Passing Saudi Arabia should return expected flag url', () => { expect(getCountryFlagUrl('Saudi-Arabia')).toBe('https://www.countries-ofthe-world.com/flags-normal/flag-of-Saudi-Arabia.png') })