diff --git a/formulaone-card.js b/formulaone-card.js index 9db2f13..a3d2ff6 100644 --- a/formulaone-card.js +++ b/formulaone-card.js @@ -436,8 +436,8 @@ .weather-info td { width: 33%; } -`},98:(t,e)=>{var i,n,r,a;Object.defineProperty(e,"__esModule",{value:!0}),e.FormulaOneCardType=e.PreviousRaceDisplay=e.CountdownType=e.WeatherUnit=void 0,(a=e.WeatherUnit||(e.WeatherUnit={})).Metric="metric",a.MilesCelsius="uk",a.MilesFahrenheit="us",(r=e.CountdownType||(e.CountdownType={})).Race="race",r.Qualifying="qualifying",r.Practice1="practice1",r.Practice2="practice2",r.Practice3="practice3",r.Sprint="sprint",(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",i.Results="results",i.Countdown="countdown"},593:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.renderConstructorColumn=e.reduceArray=e.getRefreshTime=e.calculateWindDirection=e.renderWeatherInfo=e.renderRaceInfo=e.renderHeader=e.clickHandler=e.getEndOfSeasonMessage=e.getApiLoadingMessage=e.getApiErrorMessage=e.getDriverName=e.getCircuitName=e.getTeamImage=e.checkConfig=e.getCountryFlagByName=e.getCountryFlagByNationality=e.getCountries=e.hasConfigOrCardValuesChanged=void 0;const n=i(677),r=i(98),a=i(347),o=i(197),s=i(247),c=i(623),l=i(342),d=i(930),u=i(345);e.hasConfigOrCardValuesChanged=(t,e)=>{if(e.has("config"))return!0;const i=e.get("card");if(i&&i.parent)return i.parent.properties!==t.properties;const n=e.get("cardValues");return!!n&&n!=t.properties},e.getCountries=()=>(new d.default).GetCountriesFromLocalStorage(),e.getCountryFlagByNationality=(t,i)=>{const n=(0,e.getCountries)().filter((t=>t.demonym==i));return n.length>1?t.imageClient.GetImage(n.sort(((t,e)=>t.population>e.population?-1:1))[0].flags.png):t.imageClient.GetImage(n[0].flags.png)},e.getCountryFlagByName=(t,i)=>{const n=(0,e.getCountries)().filter((t=>{var e;return t.name==i||t.nativeName==i||(null===(e=t.altSpellings)||void 0===e?void 0:e.includes(i))}))[0];return t.imageClient.GetImage(n.flags.png)},e.checkConfig=t=>{if(void 0===t.card_type)throw new Error("Please define FormulaOne card type (card_type).")},e.getTeamImage=(t,e)=>{e=e.toLocaleLowerCase().replace("_","-");const i=[{teamName:"red-bull",corrected:"red-bull-racing"},{teamName:"alfa",corrected:"alfa-romeo"},{teamName:"haas",corrected:"haas-f1-team"}].filter((t=>t.teamName==e));return i.length>0&&(e=i[0].corrected),t.imageClient.GetImage(`${c.ImageConstants.TeamLogoCDN}/2023/${e.toLowerCase()}-logo.png.transform/2col-retina/image.png`)},e.getCircuitName=t=>{const e=[{countryDashed:"UAE",name:"Abu_Dhabi"},{countryDashed:"UK",name:"Great_Britain"},{countryDashed:"Monaco",name:"Monoco"},{countryDashed:"Azerbaijan",name:"Baku"},{countryDashed:"Saudi-Arabia",name:"Saudi_Arabia"}].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}`:""}`},e.getApiErrorMessage=t=>n.html`
Error getting ${t}
`,e.getApiLoadingMessage=()=>n.html`
Loading...
`,e.getEndOfSeasonMessage=t=>n.html`
${t}
`,e.clickHandler=(t,e,i,n)=>{(0,o.handleAction)(t,i,e.actions,n.detail.action)},e.renderHeader=(t,i,a=!1)=>{var s,d;const u=i.Circuit.Location.country.replace(" ","-"),h=(0,e.getCircuitName)(u),m=t.config.image_clickable||void 0!==t.config.actions,p=i.Circuit.url;t.config.image_clickable&&!t.config.actions&&(t.config.actions={tap_action:{action:"url",url_path:p}});const f=n.html`{t.hass&&t.config.actions&&i.detail.action&&!a&&(0,e.clickHandler)(t.parent,t.config,t.hass,i)}} - .actionHandler=${(0,l.actionHandler)({hasHold:(0,o.hasAction)(null===(s=t.config.actions)||void 0===s?void 0:s.hold_action),hasDoubleClick:(0,o.hasAction)(null===(d=t.config.actions)||void 0===d?void 0:d.double_tap_action)})} class="${m?" clickable":null}" />`,g=n.html`

  ${i.round} : ${i.raceName}

`;return n.html`${t.config.card_type==r.FormulaOneCardType.Countdown?n.html``:g} ${t.config.hide_tracklayout?n.html``:f}
`},e.renderRaceInfo=(t,i,r)=>{var o;const c=t.config,l=t.hass;if(c.hide_racedatetimes)return n.html``;const d=c.show_weather&&void 0!==(null===(o=c.weather_options)||void 0===o?void 0:o.api_key)?t.weatherClient.getWeatherData(i.Circuit.Location.lat,i.Circuit.Location.long,`${i.date}T${i.time}`):Promise.resolve(null);return n.html`${(0,u.until)(d.then((o=>{const d=null==o?void 0:o.days[0],u=new Date(i.date+"T"+i.time),h=(0,e.renderWeatherInfo)(d,c,null!=r?r:u),m=(0,a.formatDateTimeRaceInfo)(new Date(i.FirstPractice.date+"T"+i.FirstPractice.time),l.locale),p=(0,a.formatDateTimeRaceInfo)(new Date(i.SecondPractice.date+"T"+i.SecondPractice.time),l.locale),f=void 0!==i.ThirdPractice?(0,a.formatDateTimeRaceInfo)(new Date(i.ThirdPractice.date+"T"+i.ThirdPractice.time),l.locale):"-",g=(0,a.formatDateTimeRaceInfo)(u,l.locale),v=(0,a.formatDateTimeRaceInfo)(new Date(i.Qualifying.date+"T"+i.Qualifying.time),l.locale),y=void 0!==i.Sprint?(0,a.formatDateTimeRaceInfo)(new Date(i.Sprint.date+"T"+i.Sprint.time),l.locale):"-";return n.html`${h}${t.translation("date")}${(0,s.formatDateNumeric)(u,l.locale,c.date_locale)} ${t.translation("practice1")}${m} +`},98:(t,e)=>{var i,n,r,a;Object.defineProperty(e,"__esModule",{value:!0}),e.FormulaOneCardType=e.PreviousRaceDisplay=e.CountdownType=e.WeatherUnit=void 0,(a=e.WeatherUnit||(e.WeatherUnit={})).Metric="metric",a.MilesCelsius="uk",a.MilesFahrenheit="us",(r=e.CountdownType||(e.CountdownType={})).Race="race",r.Qualifying="qualifying",r.Practice1="practice1",r.Practice2="practice2",r.Practice3="practice3",r.Sprint="sprint",(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",i.Results="results",i.Countdown="countdown"},593:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.renderConstructorColumn=e.reduceArray=e.getRefreshTime=e.calculateWindDirection=e.renderWeatherInfo=e.renderRaceInfo=e.renderHeader=e.clickHandler=e.getEndOfSeasonMessage=e.getApiLoadingMessage=e.getApiErrorMessage=e.getDriverName=e.getCircuitName=e.getTeamImage=e.checkConfig=e.getCountryFlagByName=e.getCountryFlagByNationality=e.getCountries=e.hasConfigOrCardValuesChanged=void 0;const n=i(677),r=i(98),a=i(347),o=i(197),s=i(247),c=i(623),l=i(342),d=i(930),u=i(345);e.hasConfigOrCardValuesChanged=(t,e)=>{if(e.has("config"))return!0;const i=e.get("card");if(i&&i.parent)return i.parent.properties!==t.properties;const n=e.get("cardValues");return!!n&&n!=t.properties},e.getCountries=()=>(new d.default).GetCountriesFromLocalStorage(),e.getCountryFlagByNationality=(t,i)=>{const n=(0,e.getCountries)().filter((t=>t.demonym==i));return n.length>1?t.imageClient.GetImage(n.sort(((t,e)=>t.population>e.population?-1:1))[0].flags.png):t.imageClient.GetImage(n[0].flags.png)},e.getCountryFlagByName=(t,i)=>{const n=(0,e.getCountries)().filter((t=>{var e;return t.name==i||t.nativeName==i||(null===(e=t.altSpellings)||void 0===e?void 0:e.includes(i))}))[0];return t.imageClient.GetImage(n.flags.png)},e.checkConfig=t=>{if(void 0===t.card_type)throw new Error("Please define FormulaOne card type (card_type).")},e.getTeamImage=(t,e)=>{e=e.toLocaleLowerCase().replace("_","-");const i=[{teamName:"red-bull",corrected:"red-bull-racing"},{teamName:"alfa",corrected:"alfa-romeo"},{teamName:"haas",corrected:"haas-f1-team"}].filter((t=>t.teamName==e));return i.length>0&&(e=i[0].corrected),t.imageClient.GetImage(`${c.ImageConstants.TeamLogoCDN}/2023/${e.toLowerCase()}-logo.png.transform/2col-retina/image.png`)},e.getCircuitName=t=>{let e=t.country.replace(" ","-");const i=[{countryDashed:"UAE",name:"Abu_Dhabi"},{countryDashed:"UK",name:"Great_Britain"},{countryDashed:"Monaco",name:"Monoco"},{countryDashed:"Azerbaijan",name:"Baku"},{countryDashed:"Saudi-Arabia",name:"Saudi_Arabia"}].filter((t=>t.countryDashed==e));return i.length>0&&(e=i[0].name),"USA"==t.country&&"Austin"!=t.locality&&(e=t.locality),e},e.getDriverName=(t,e)=>{const i="VER"==t.code?1:t.permanentNumber;return`${t.givenName} ${t.familyName}${e.show_carnumber?` #${i}`:""}`},e.getApiErrorMessage=t=>n.html`
Error getting ${t}
`,e.getApiLoadingMessage=()=>n.html`
Loading...
`,e.getEndOfSeasonMessage=t=>n.html`
${t}
`,e.clickHandler=(t,e,i,n)=>{(0,o.handleAction)(t,i,e.actions,n.detail.action)},e.renderHeader=(t,i,a=!1)=>{var s,d;const u=(0,e.getCircuitName)(i.Circuit.Location),h=t.config.image_clickable||void 0!==t.config.actions,m=i.Circuit.url;t.config.image_clickable&&!t.config.actions&&(t.config.actions={tap_action:{action:"url",url_path:m}});const p=n.html`{t.hass&&t.config.actions&&i.detail.action&&!a&&(0,e.clickHandler)(t.parent,t.config,t.hass,i)}} + .actionHandler=${(0,l.actionHandler)({hasHold:(0,o.hasAction)(null===(s=t.config.actions)||void 0===s?void 0:s.hold_action),hasDoubleClick:(0,o.hasAction)(null===(d=t.config.actions)||void 0===d?void 0:d.double_tap_action)})} class="${h?" clickable":null}" />`,f=n.html`

  ${i.round} : ${i.raceName}

`;return n.html`${t.config.card_type==r.FormulaOneCardType.Countdown?n.html``:f} ${t.config.hide_tracklayout?n.html``:p}
`},e.renderRaceInfo=(t,i,r)=>{var o;const c=t.config,l=t.hass;if(c.hide_racedatetimes)return n.html``;const d=c.show_weather&&void 0!==(null===(o=c.weather_options)||void 0===o?void 0:o.api_key)?t.weatherClient.getWeatherData(i.Circuit.Location.lat,i.Circuit.Location.long,`${i.date}T${i.time}`):Promise.resolve(null);return n.html`${(0,u.until)(d.then((o=>{const d=null==o?void 0:o.days[0],u=new Date(i.date+"T"+i.time),h=(0,e.renderWeatherInfo)(d,c,null!=r?r:u),m=(0,a.formatDateTimeRaceInfo)(new Date(i.FirstPractice.date+"T"+i.FirstPractice.time),l.locale),p=(0,a.formatDateTimeRaceInfo)(new Date(i.SecondPractice.date+"T"+i.SecondPractice.time),l.locale),f=void 0!==i.ThirdPractice?(0,a.formatDateTimeRaceInfo)(new Date(i.ThirdPractice.date+"T"+i.ThirdPractice.time),l.locale):"-",g=(0,a.formatDateTimeRaceInfo)(u,l.locale),v=(0,a.formatDateTimeRaceInfo)(new Date(i.Qualifying.date+"T"+i.Qualifying.time),l.locale),y=void 0!==i.Sprint?(0,a.formatDateTimeRaceInfo)(new Date(i.Sprint.date+"T"+i.Sprint.time),l.locale):"-";return n.html`${h}${t.translation("date")}${(0,s.formatDateNumeric)(u,l.locale,c.date_locale)} ${t.translation("practice1")}${m} ${t.translation("race")}${i.round} ${t.translation("practice2")}${p} ${t.translation("racename")}${i.raceName} ${t.translation("practice3")}${f} ${t.translation("circuitname")}${i.Circuit.circuitName} ${t.translation("qualifying")}${v} @@ -458,4 +458,4 @@ -  `},e.calculateWindDirection=t=>{const e=[{label:"N",range:[0,11.25]},{label:"NNE",range:[11.25,33.75]},{label:"NE",range:[33.75,56.25]},{label:"ENE",range:[56.25,78.75]},{label:"E",range:[78.75,101.25]},{label:"ESE",range:[101.25,123.75]},{label:"SE",range:[123.75,146.25]},{label:"SSE",range:[146.25,168.75]},{label:"S",range:[168.75,191.25]},{label:"SSW",range:[191.25,213.75]},{label:"SW",range:[213.75,236.25]},{label:"WSW",range:[236.25,258.75]},{label:"W",range:[258.75,281.25]},{label:"WNW",range:[281.25,303.75]},{label:"NW",range:[303.75,326.25]},{label:"NNW",range:[326.25,348.75]},{label:"N",range:[348.75,360]}];for(const{label:i,range:n}of e)if(t>=n[0]&&t<=n[1])return i},e.getRefreshTime=t=>{let e=24;const i=new Date,n=localStorage.getItem(`${i.getFullYear()}.json`);if(n){const r=JSON.parse(n),a=JSON.parse(r.data).MRData.RaceTable.Races.filter((t=>new Date(t.date).toLocaleDateString==i.toLocaleDateString));if(a.length>0){const i=a[0],n=new Date(i.date+"T"+i.time),r=localStorage.getItem(t);if(r){const t=JSON.parse(r);new Date(t.created)void 0===t?[]:e?t.slice(0,e):t,e.renderConstructorColumn=(t,i)=>n.html`${t.config.standings.show_teamlogo?n.html` `:""}${i.name}`},206:(t,e,i)=>{i.d(e,{sR:()=>u});var n=i(232),r=i(875);const a=(t,e)=>{var i,n;const r=t._$AN;if(void 0===r)return!1;for(const t of r)null===(n=(i=t)._$AO)||void 0===n||n.call(i,e,!1),a(t,e);return!0},o=t=>{let e,i;do{if(void 0===(e=t._$AM))break;i=e._$AN,i.delete(t),t=e}while(0===(null==i?void 0:i.size))},s=t=>{for(let e;e=t._$AM;t=e){let i=e._$AN;if(void 0===i)e._$AN=i=new Set;else if(i.has(t))break;i.add(t),d(e)}};function c(t){void 0!==this._$AN?(o(this),this._$AM=t,s(this)):this._$AM=t}function l(t,e=!1,i=0){const n=this._$AH,r=this._$AN;if(void 0!==r&&0!==r.size)if(e)if(Array.isArray(n))for(let t=i;t{var e,i,n,a;t.type==r.pX.CHILD&&(null!==(e=(n=t)._$AP)&&void 0!==e||(n._$AP=l),null!==(i=(a=t)._$AQ)&&void 0!==i||(a._$AQ=c))};class u extends r.Xe{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,i){super._$AT(t,e,i),s(this),this.isConnected=t._$AU}_$AO(t,e=!0){var i,n;t!==this.isConnected&&(this.isConnected=t,t?null===(i=this.reconnected)||void 0===i||i.call(this):null===(n=this.disconnected)||void 0===n||n.call(this)),e&&(a(this,t),o(this))}setValue(t){if((0,n.OR)(this._$Ct))this._$Ct._$AI(t,this);else{const e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}}},232:(t,e,i)=>{i.d(e,{OR:()=>o,pt:()=>a});var n=i(692);const{I:r}=n._$LH,a=t=>null===t||"object"!=typeof t&&"function"!=typeof t,o=t=>void 0===t.strings},875:(t,e,i)=>{i.d(e,{XM:()=>r,Xe:()=>a,pX:()=>n});const n={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},r=t=>(...e)=>({_$litDirective$:t,values:e});class a{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}},69:(t,e,i)=>{i.d(e,{dS:()=>a,gw:()=>n,nX:()=>r});const n=async(t,e)=>{for await(const i of t)if(!1===await e(i))return};class r{constructor(t){this.Y=t}disconnect(){this.Y=void 0}reconnect(t){this.Y=t}deref(){return this.Y}}class a{constructor(){this.Z=void 0,this.q=void 0}get(){return this.Z}pause(){var t;null!==(t=this.Z)&&void 0!==t||(this.Z=new Promise((t=>this.q=t)))}resume(){var t;null===(t=this.q)||void 0===t||t.call(this),this.Z=this.q=void 0}}},345:(t,e,i)=>{i.r(e),i.d(e,{UntilDirective:()=>l,until:()=>d});var n=i(692),r=i(232),a=i(206),o=i(69),s=i(875);const c=t=>!(0,r.pt)(t)&&"function"==typeof t.then;class l extends a.sR{constructor(){super(...arguments),this._$Cwt=1073741823,this._$Cyt=[],this._$CK=new o.nX(this),this._$CX=new o.dS}render(...t){var e;return null!==(e=t.find((t=>!c(t))))&&void 0!==e?e:n.noChange}update(t,e){const i=this._$Cyt;let r=i.length;this._$Cyt=e;const a=this._$CK,o=this._$CX;this.isConnected||this.disconnected();for(let t=0;tthis._$Cwt);t++){const n=e[t];if(!c(n))return this._$Cwt=t,n;t{for(;o.get();)await o.get();const e=a.deref();if(void 0!==e){const i=e._$Cyt.indexOf(n);i>-1&&i{var n;i.r(e),i.d(e,{_$LH:()=>H,html:()=>C,noChange:()=>A,nothing:()=>T,render:()=>G,svg:()=>S});const r=window,a=r.trustedTypes,o=a?a.createPolicy("lit-html",{createHTML:t=>t}):void 0,s=`lit$${(Math.random()+"").slice(9)}$`,c="?"+s,l=`<${c}>`,d=document,u=(t="")=>d.createComment(t),h=t=>null===t||"object"!=typeof t&&"function"!=typeof t,m=Array.isArray,p=t=>m(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]),f=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,g=/-->/g,v=/>/g,y=RegExp(">|[ \t\n\f\r](?:([^\\s\"'>=/]+)([ \t\n\f\r]*=[ \t\n\f\r]*(?:[^ \t\n\f\r\"'`<>=]|(\"|')|))|$)","g"),_=/'/g,b=/"/g,$=/^(?:script|style|textarea|title)$/i,w=t=>(e,...i)=>({_$litType$:t,strings:e,values:i}),C=w(1),S=w(2),A=Symbol.for("lit-noChange"),T=Symbol.for("lit-nothing"),D=new WeakMap,x=d.createTreeWalker(d,129,null,!1),k=(t,e)=>{const i=t.length-1,n=[];let r,a=2===e?"":"",c=f;for(let e=0;e"===d[0]?(c=null!=r?r:f,u=-1):void 0===d[1]?u=-2:(u=c.lastIndex-d[2].length,o=d[1],c=void 0===d[3]?y:'"'===d[3]?b:_):c===b||c===_?c=y:c===g||c===v?c=f:(c=y,r=void 0);const m=c===y&&t[e+1].startsWith("/>")?" ":"";a+=c===f?i+l:u>=0?(n.push(o),i.slice(0,u)+"$lit$"+i.slice(u)+s+m):i+s+(-2===u?(n.push(void 0),e):m)}const d=a+(t[i]||"")+(2===e?"":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==o?o.createHTML(d):d,n]};class R{constructor({strings:t,_$litType$:e},i){let n;this.parts=[];let r=0,o=0;const l=t.length-1,d=this.parts,[h,m]=k(t,e);if(this.el=R.createElement(h,i),x.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(n=x.nextNode())&&d.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=T}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=E(this,t,e,0),a=!h(t)||t!==this._$AH&&t!==A,a&&(this._$AH=t);else{const n=t;let o,s;for(t=r[0],o=0;o{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 N(e.insertBefore(u(),t),t,void 0,null!=i?i:{})}return o._$AI(t),o}},595:(t,e,i)=>{i.r(e),i.d(e,{customElement:()=>n,eventOptions:()=>c,property:()=>a,query:()=>l,queryAll:()=>d,queryAssignedElements:()=>p,queryAssignedNodes:()=>f,queryAsync:()=>u,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 c(t){return s({finisher:(e,i)=>{Object.assign(e.prototype[i],t)}})}function l(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 d(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 u(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 p(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 f(t,e,i){let n,r=t;return"object"==typeof t?(r=t.slot,n=t):n={flatten:e},i?p({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})})}},82:(t,e,i)=>{i.r(e),i.d(e,{Directive:()=>n.Xe,PartType:()=>n.pX,directive:()=>n.XM});var n=i(875)},530:(t,e,i)=>{i.r(e),i.d(e,{AsyncReplaceDirective:()=>s,asyncReplace:()=>c});var n=i(692),r=i(206),a=i(69),o=i(875);class s extends r.sR{constructor(){super(...arguments),this._$CK=new a.nX(this),this._$CX=new a.dS}render(t,e){return n.noChange}update(t,[e,i]){if(this.isConnected||this.disconnected(),e===this._$CJ)return;this._$CJ=e;let r=0;const{_$CK:o,_$CX:s}=this;return(0,a.gw)(e,(async t=>{for(;s.get();)await s.get();const n=o.deref();if(void 0!==n){if(n._$CJ!==e)return!1;void 0!==i&&(t=i(t,r)),n.commitValue(t,r),r++}return!0})),n.noChange}commitValue(t,e){this.setValue(t)}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}}const c=(0,o.XM)(s)},677:(t,e,i)=>{i.r(e),i.d(e,{CSSResult:()=>s,LitElement:()=>A,ReactiveElement:()=>b,UpdatingElement:()=>S,_$LE:()=>D,_$LH:()=>C._$LH,adoptStyles:()=>d,css:()=>l,defaultConverter:()=>v,getCompatibleStyle:()=>u,html:()=>C.html,isServer:()=>x,noChange:()=>C.noChange,notEqual:()=>y,nothing:()=>C.nothing,render:()=>C.render,supportsAdoptingStyleSheets:()=>r,svg:()=>C.svg,unsafeCSS:()=>c});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 c=t=>new s("string"==typeof t?t:t+"",void 0,a),l=(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)},d=(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)}))},u=r?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return c(e)})(t):t;var h;const m=window,p=m.trustedTypes,f=p?p.emptyScript:"",g=m.reactiveElementPolyfillSupport,v={toAttribute(t,e){switch(e){case Boolean:t=t?f: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}},y=(t,e)=>e!==t&&(e==e||t==t),_={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:y};class b extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(t){var e;this.finalize(),(null!==(e=this.h)&&void 0!==e?e:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,i)=>{const n=this._$Ep(i,e);void 0!==n&&(this._$Ev.set(n,i),t.push(n))})),t}static createProperty(t,e=_){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(),void 0!==t.h&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const i of e)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(u(t))}else void 0!==t&&e.push(u(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 d(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:v).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:v;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||y)(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){}}b.finalized=!0,b.elementProperties=new Map,b.elementStyles=[],b.shadowRootOptions={mode:"open"},null==g||g({ReactiveElement:b}),(null!==(h=m.reactiveElementVersions)&&void 0!==h?h:m.reactiveElementVersions=[]).push("1.6.1");var $,w,C=i(692);const S=b;class A extends b{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,C.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 C.noChange}}A.finalized=!0,A._$litElement$=!0,null===($=globalThis.litElementHydrateSupport)||void 0===$||$.call(globalThis,{LitElement:A});const T=globalThis.litElementPolyfillSupport;null==T||T({LitElement:A});const D={_$AK:(t,e,i)=>{t._$AK(e,i)},_$AL:t=>t._$AL};(null!==(w=globalThis.litElementVersions)&&void 0!==w?w:globalThis.litElementVersions=[]).push("3.2.2");const x=!1},147:t=>{t.exports=JSON.parse('{"name":"formulaone-card","version":"1.5.0","description":"Frontend card for Home Assistant to display Formula One data","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","prebuild":"copy git-hooks\\\\pre-commit .git\\\\hooks\\\\ && echo \'hook copied\'"},"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.5.0","@typescript-eslint/eslint-plugin":"^5.57.1","@typescript-eslint/parser":"^5.57.1","codecov":"^3.8.3","eslint":"^8.38.0","home-assistant-js-websocket":"^8.0.1","lit":"^2.7.2","typescript":"^4.9.5","webpack":"^5.78.0","webpack-cli":"^5.0.1"},"dependencies":{"@babel/plugin-transform-runtime":"^7.21.4","@babel/preset-env":"^7.21.4","@lit-labs/scoped-registry-mixin":"^1.0.1","babel-jest":"^29.5.0","compression-webpack-plugin":"^10.0.0","custom-card-helpers":"^1.9.0","isomorphic-fetch":"^3.0.0","jest-environment-jsdom":"^29.5.0","jest-fetch-mock":"^3.0.3","jest-ts-auto-mock":"^2.1.0","ts-auto-mock":"^3.6.4","ts-jest":"^29.1.0","ts-loader":"^9.4.2","ttypescript":"^1.5.15","yarn":"^1.22.19"}}')}},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 +  `},e.calculateWindDirection=t=>{const e=[{label:"N",range:[0,11.25]},{label:"NNE",range:[11.25,33.75]},{label:"NE",range:[33.75,56.25]},{label:"ENE",range:[56.25,78.75]},{label:"E",range:[78.75,101.25]},{label:"ESE",range:[101.25,123.75]},{label:"SE",range:[123.75,146.25]},{label:"SSE",range:[146.25,168.75]},{label:"S",range:[168.75,191.25]},{label:"SSW",range:[191.25,213.75]},{label:"SW",range:[213.75,236.25]},{label:"WSW",range:[236.25,258.75]},{label:"W",range:[258.75,281.25]},{label:"WNW",range:[281.25,303.75]},{label:"NW",range:[303.75,326.25]},{label:"NNW",range:[326.25,348.75]},{label:"N",range:[348.75,360]}];for(const{label:i,range:n}of e)if(t>=n[0]&&t<=n[1])return i},e.getRefreshTime=t=>{let e=24;const i=new Date,n=localStorage.getItem(`${i.getFullYear()}.json`);if(n){const r=JSON.parse(n),a=JSON.parse(r.data).MRData.RaceTable.Races.filter((t=>new Date(t.date).toLocaleDateString==i.toLocaleDateString));if(a.length>0){const i=a[0],n=new Date(i.date+"T"+i.time),r=localStorage.getItem(t);if(r){const t=JSON.parse(r);new Date(t.created)void 0===t?[]:e?t.slice(0,e):t,e.renderConstructorColumn=(t,i)=>n.html`${t.config.standings.show_teamlogo?n.html` `:""}${i.name}`},206:(t,e,i)=>{i.d(e,{sR:()=>u});var n=i(232),r=i(875);const a=(t,e)=>{var i,n;const r=t._$AN;if(void 0===r)return!1;for(const t of r)null===(n=(i=t)._$AO)||void 0===n||n.call(i,e,!1),a(t,e);return!0},o=t=>{let e,i;do{if(void 0===(e=t._$AM))break;i=e._$AN,i.delete(t),t=e}while(0===(null==i?void 0:i.size))},s=t=>{for(let e;e=t._$AM;t=e){let i=e._$AN;if(void 0===i)e._$AN=i=new Set;else if(i.has(t))break;i.add(t),d(e)}};function c(t){void 0!==this._$AN?(o(this),this._$AM=t,s(this)):this._$AM=t}function l(t,e=!1,i=0){const n=this._$AH,r=this._$AN;if(void 0!==r&&0!==r.size)if(e)if(Array.isArray(n))for(let t=i;t{var e,i,n,a;t.type==r.pX.CHILD&&(null!==(e=(n=t)._$AP)&&void 0!==e||(n._$AP=l),null!==(i=(a=t)._$AQ)&&void 0!==i||(a._$AQ=c))};class u extends r.Xe{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,i){super._$AT(t,e,i),s(this),this.isConnected=t._$AU}_$AO(t,e=!0){var i,n;t!==this.isConnected&&(this.isConnected=t,t?null===(i=this.reconnected)||void 0===i||i.call(this):null===(n=this.disconnected)||void 0===n||n.call(this)),e&&(a(this,t),o(this))}setValue(t){if((0,n.OR)(this._$Ct))this._$Ct._$AI(t,this);else{const e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}}},232:(t,e,i)=>{i.d(e,{OR:()=>o,pt:()=>a});var n=i(692);const{I:r}=n._$LH,a=t=>null===t||"object"!=typeof t&&"function"!=typeof t,o=t=>void 0===t.strings},875:(t,e,i)=>{i.d(e,{XM:()=>r,Xe:()=>a,pX:()=>n});const n={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},r=t=>(...e)=>({_$litDirective$:t,values:e});class a{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}},69:(t,e,i)=>{i.d(e,{dS:()=>a,gw:()=>n,nX:()=>r});const n=async(t,e)=>{for await(const i of t)if(!1===await e(i))return};class r{constructor(t){this.Y=t}disconnect(){this.Y=void 0}reconnect(t){this.Y=t}deref(){return this.Y}}class a{constructor(){this.Z=void 0,this.q=void 0}get(){return this.Z}pause(){var t;null!==(t=this.Z)&&void 0!==t||(this.Z=new Promise((t=>this.q=t)))}resume(){var t;null===(t=this.q)||void 0===t||t.call(this),this.Z=this.q=void 0}}},345:(t,e,i)=>{i.r(e),i.d(e,{UntilDirective:()=>l,until:()=>d});var n=i(692),r=i(232),a=i(206),o=i(69),s=i(875);const c=t=>!(0,r.pt)(t)&&"function"==typeof t.then;class l extends a.sR{constructor(){super(...arguments),this._$Cwt=1073741823,this._$Cyt=[],this._$CK=new o.nX(this),this._$CX=new o.dS}render(...t){var e;return null!==(e=t.find((t=>!c(t))))&&void 0!==e?e:n.noChange}update(t,e){const i=this._$Cyt;let r=i.length;this._$Cyt=e;const a=this._$CK,o=this._$CX;this.isConnected||this.disconnected();for(let t=0;tthis._$Cwt);t++){const n=e[t];if(!c(n))return this._$Cwt=t,n;t{for(;o.get();)await o.get();const e=a.deref();if(void 0!==e){const i=e._$Cyt.indexOf(n);i>-1&&i{var n;i.r(e),i.d(e,{_$LH:()=>H,html:()=>C,noChange:()=>A,nothing:()=>T,render:()=>G,svg:()=>S});const r=window,a=r.trustedTypes,o=a?a.createPolicy("lit-html",{createHTML:t=>t}):void 0,s=`lit$${(Math.random()+"").slice(9)}$`,c="?"+s,l=`<${c}>`,d=document,u=(t="")=>d.createComment(t),h=t=>null===t||"object"!=typeof t&&"function"!=typeof t,m=Array.isArray,p=t=>m(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]),f=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,g=/-->/g,v=/>/g,y=RegExp(">|[ \t\n\f\r](?:([^\\s\"'>=/]+)([ \t\n\f\r]*=[ \t\n\f\r]*(?:[^ \t\n\f\r\"'`<>=]|(\"|')|))|$)","g"),_=/'/g,b=/"/g,$=/^(?:script|style|textarea|title)$/i,w=t=>(e,...i)=>({_$litType$:t,strings:e,values:i}),C=w(1),S=w(2),A=Symbol.for("lit-noChange"),T=Symbol.for("lit-nothing"),D=new WeakMap,x=d.createTreeWalker(d,129,null,!1),k=(t,e)=>{const i=t.length-1,n=[];let r,a=2===e?"":"",c=f;for(let e=0;e"===d[0]?(c=null!=r?r:f,u=-1):void 0===d[1]?u=-2:(u=c.lastIndex-d[2].length,o=d[1],c=void 0===d[3]?y:'"'===d[3]?b:_):c===b||c===_?c=y:c===g||c===v?c=f:(c=y,r=void 0);const m=c===y&&t[e+1].startsWith("/>")?" ":"";a+=c===f?i+l:u>=0?(n.push(o),i.slice(0,u)+"$lit$"+i.slice(u)+s+m):i+s+(-2===u?(n.push(void 0),e):m)}const d=a+(t[i]||"")+(2===e?"":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==o?o.createHTML(d):d,n]};class R{constructor({strings:t,_$litType$:e},i){let n;this.parts=[];let r=0,o=0;const l=t.length-1,d=this.parts,[h,m]=k(t,e);if(this.el=R.createElement(h,i),x.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(n=x.nextNode())&&d.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=T}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=E(this,t,e,0),a=!h(t)||t!==this._$AH&&t!==A,a&&(this._$AH=t);else{const n=t;let o,s;for(t=r[0],o=0;o{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 N(e.insertBefore(u(),t),t,void 0,null!=i?i:{})}return o._$AI(t),o}},595:(t,e,i)=>{i.r(e),i.d(e,{customElement:()=>n,eventOptions:()=>c,property:()=>a,query:()=>l,queryAll:()=>d,queryAssignedElements:()=>p,queryAssignedNodes:()=>f,queryAsync:()=>u,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 c(t){return s({finisher:(e,i)=>{Object.assign(e.prototype[i],t)}})}function l(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 d(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 u(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 p(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 f(t,e,i){let n,r=t;return"object"==typeof t?(r=t.slot,n=t):n={flatten:e},i?p({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})})}},82:(t,e,i)=>{i.r(e),i.d(e,{Directive:()=>n.Xe,PartType:()=>n.pX,directive:()=>n.XM});var n=i(875)},530:(t,e,i)=>{i.r(e),i.d(e,{AsyncReplaceDirective:()=>s,asyncReplace:()=>c});var n=i(692),r=i(206),a=i(69),o=i(875);class s extends r.sR{constructor(){super(...arguments),this._$CK=new a.nX(this),this._$CX=new a.dS}render(t,e){return n.noChange}update(t,[e,i]){if(this.isConnected||this.disconnected(),e===this._$CJ)return;this._$CJ=e;let r=0;const{_$CK:o,_$CX:s}=this;return(0,a.gw)(e,(async t=>{for(;s.get();)await s.get();const n=o.deref();if(void 0!==n){if(n._$CJ!==e)return!1;void 0!==i&&(t=i(t,r)),n.commitValue(t,r),r++}return!0})),n.noChange}commitValue(t,e){this.setValue(t)}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}}const c=(0,o.XM)(s)},677:(t,e,i)=>{i.r(e),i.d(e,{CSSResult:()=>s,LitElement:()=>A,ReactiveElement:()=>b,UpdatingElement:()=>S,_$LE:()=>D,_$LH:()=>C._$LH,adoptStyles:()=>d,css:()=>l,defaultConverter:()=>v,getCompatibleStyle:()=>u,html:()=>C.html,isServer:()=>x,noChange:()=>C.noChange,notEqual:()=>y,nothing:()=>C.nothing,render:()=>C.render,supportsAdoptingStyleSheets:()=>r,svg:()=>C.svg,unsafeCSS:()=>c});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 c=t=>new s("string"==typeof t?t:t+"",void 0,a),l=(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)},d=(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)}))},u=r?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return c(e)})(t):t;var h;const m=window,p=m.trustedTypes,f=p?p.emptyScript:"",g=m.reactiveElementPolyfillSupport,v={toAttribute(t,e){switch(e){case Boolean:t=t?f: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}},y=(t,e)=>e!==t&&(e==e||t==t),_={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:y};class b extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(t){var e;this.finalize(),(null!==(e=this.h)&&void 0!==e?e:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,i)=>{const n=this._$Ep(i,e);void 0!==n&&(this._$Ev.set(n,i),t.push(n))})),t}static createProperty(t,e=_){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(),void 0!==t.h&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const i of e)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(u(t))}else void 0!==t&&e.push(u(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 d(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:v).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:v;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||y)(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){}}b.finalized=!0,b.elementProperties=new Map,b.elementStyles=[],b.shadowRootOptions={mode:"open"},null==g||g({ReactiveElement:b}),(null!==(h=m.reactiveElementVersions)&&void 0!==h?h:m.reactiveElementVersions=[]).push("1.6.1");var $,w,C=i(692);const S=b;class A extends b{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,C.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 C.noChange}}A.finalized=!0,A._$litElement$=!0,null===($=globalThis.litElementHydrateSupport)||void 0===$||$.call(globalThis,{LitElement:A});const T=globalThis.litElementPolyfillSupport;null==T||T({LitElement:A});const D={_$AK:(t,e,i)=>{t._$AK(e,i)},_$AL:t=>t._$AL};(null!==(w=globalThis.litElementVersions)&&void 0!==w?w:globalThis.litElementVersions=[]).push("3.2.2");const x=!1},147:t=>{t.exports=JSON.parse('{"name":"formulaone-card","version":"1.5.0","description":"Frontend card for Home Assistant to display Formula One data","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","prebuild":"copy git-hooks\\\\pre-commit .git\\\\hooks\\\\ && echo \'hook copied\'"},"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.5.0","@typescript-eslint/eslint-plugin":"^5.59.1","@typescript-eslint/parser":"^5.59.1","codecov":"^3.8.3","eslint":"^8.39.0","home-assistant-js-websocket":"^8.0.1","lit":"^2.7.2","typescript":"^4.9.5","webpack":"^5.81.0","webpack-cli":"^5.0.2"},"dependencies":{"@babel/plugin-transform-runtime":"^7.21.4","@babel/preset-env":"^7.21.4","@lit-labs/scoped-registry-mixin":"^1.0.1","babel-jest":"^29.5.0","compression-webpack-plugin":"^10.0.0","custom-card-helpers":"^1.9.0","isomorphic-fetch":"^3.0.0","jest-environment-jsdom":"^29.5.0","jest-fetch-mock":"^3.0.3","jest-ts-auto-mock":"^2.1.0","ts-auto-mock":"^3.6.4","ts-jest":"^29.1.0","ts-loader":"^9.4.2","ttypescript":"^1.5.15","yarn":"^1.22.19"}}')}},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 86f92e3..663b373 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 1cd01d8..09241bf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "formulaone-card", - "version": "1.5.0", + "version": "1.5.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "formulaone-card", - "version": "1.5.0", + "version": "1.5.1", "license": "ISC", "dependencies": { "@babel/plugin-transform-runtime": "^7.21.4", diff --git a/package.json b/package.json index 418c458..a419620 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "formulaone-card", - "version": "1.5.0", + "version": "1.5.1", "description": "Frontend card for Home Assistant to display Formula One data", "main": "index.js", "scripts": { diff --git a/src/utils.ts b/src/utils.ts index 1a942ea..d206fcb 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,6 +1,6 @@ import { html, HTMLTemplateResult, LitElement, PropertyValues } from "lit"; import { FormulaOneCardConfig, FormulaOneCardType, LocalStorageItem, WeatherUnit } from "./types/formulaone-card-types"; -import { Constructor, Driver, Race, Root } from "./api/f1-models"; +import { Constructor, Driver, Race, Root, Location } from "./api/f1-models"; import FormulaOneCard from "."; import { BaseCard } from "./cards/base-card"; import { formatDateTimeRaceInfo } from "./lib/format_date_time"; @@ -75,7 +75,9 @@ export const getTeamImage = (card: BaseCard, teamName: string) => { return card.imageClient.GetImage(`${ImageConstants.TeamLogoCDN}/2023/${teamName.toLowerCase()}-logo.png.transform/2col-retina/image.png`); } -export const getCircuitName = (circuitName: string) => { +export const getCircuitName = (location: Location) => { + + let circuitName = location.country.replace(" ","-") const exceptions = [{ countryDashed: 'UAE', name: 'Abu_Dhabi'}, { countryDashed: 'UK', name: 'Great_Britain'}, { countryDashed: 'Monaco', name: 'Monoco'}, { countryDashed: 'Azerbaijan', name: 'Baku'}, { countryDashed: 'Saudi-Arabia', name: 'Saudi_Arabia'}]; @@ -85,6 +87,11 @@ export const getCircuitName = (circuitName: string) => { circuitName = exception[0].name; } + if(location.country == 'USA' && location.locality != 'Austin') + { + circuitName = location.locality; + } + return circuitName; } @@ -111,8 +118,7 @@ export const clickHandler = (node: LitElement, config: FormulaOneCardConfig, has export const renderHeader = (card: BaseCard, race: Race, preventClick = false): HTMLTemplateResult => { - const countryDashed = race.Circuit.Location.country.replace(" ","-") - const circuitName = getCircuitName(countryDashed); + const circuitName = getCircuitName(race.Circuit.Location); const _handleAction = (ev: ActionHandlerEvent): void => { if (card.hass && card.config.actions && ev.detail.action && !preventClick) { diff --git a/tests/utils/getCircuitName.test.ts b/tests/utils/getCircuitName.test.ts index e104625..bf2d82f 100644 --- a/tests/utils/getCircuitName.test.ts +++ b/tests/utils/getCircuitName.test.ts @@ -2,10 +2,20 @@ import { getCircuitName } from '../../src/utils'; describe('Testing util file function getCircuitName', () => { test('Passing Japan should return expected circuit name', () => { - expect(getCircuitName('Japan')).toBe('Japan') + expect(getCircuitName({ + country: 'Japan', + lat: '', + long: '', + locality: '' + })).toBe('Japan') }), test('Passing UAE should return expected circuit name', () => { - expect(getCircuitName('UAE')).toBe('Abu_Dhabi') + expect(getCircuitName({ + country: 'UAE', + lat: '', + long: '', + locality: '' + })).toBe('Abu_Dhabi') }) }) diff --git a/tests/utils/renderHeader.test.ts b/tests/utils/renderHeader.test.ts index e7818a7..01bb887 100644 --- a/tests/utils/renderHeader.test.ts +++ b/tests/utils/renderHeader.test.ts @@ -130,5 +130,16 @@ describe('Testing util file function renderHeader', () => { const htmlResult = getRenderString(result); expect(htmlResult).toMatch(`

  17 : Singapore Grand Prix

`); + }), + test('Calling renderHeader with Miami with image not clickable', async () => { + card.config.image_clickable = undefined; + card.config.hide_tracklayout = false; + lastRace.Circuit.Location.country = "USA"; + lastRace.Circuit.Location.locality = "Miami"; + + const result = renderHeader(card, lastRace); + const htmlResult = getRenderString(result); + + expect(htmlResult).toMatch(`

  17 : Singapore Grand Prix


`); }) });