document.addEventListener("DOMContentLoaded",function(){if(0===document.getElementsByClassName("tpd-nhl-franchise-game-schedule").length)return;const e=async e=>{try{const a=new URLSearchParams({teamName:e}),t=await fetch(`${gameObj.endpoint}?${a.toString()}`,{method:"GET",headers:{"Content-Type":"application/json"}}),n=await t.json(),r=new Date,s=n.filter(e=>new Date(e.startTimeUTC)<=r),o=s.length>0?s.sort((e,a)=>new Date(a.startTimeUTC)-new Date(e.startTimeUTC))[0]:null,i=new Date;i.setDate(r.getDate()+7);const m=n.filter(e=>{const a=new Date(e.startTimeUTC);return a>r&&a<=i});return o?[o,...m]:m}catch(e){return console.error("Error:",e),[]}};(async()=>{const a=Array.from(document.getElementsByClassName("tpd-nhl-franchise-game-schedule"));for(const r of a){var t;const a=r.getAttribute("data-ticket"),s="true"===a||"1"===a,o=r.getAttribute("data-lazyload"),i=null===o||"true"===o||"1"===o;let m=null!==(t=r.getAttribute("data-team"))&&void 0!==t?t:"";var n;if(0===m.length&&(m=null!==(n=gameObj.team)&&void 0!==n?n:null),!m)continue;const l=async()=>{const a=await e(m);r.innerHTML=a.map(e=>{var a,t,n,r;const o=new Date(e.startTimeUTC),i=new Date,l=null!==(a=e.awayTeam.placeName.default)&&void 0!==a?a:"",c=null!==(t=e.awayTeam.commonName.default)&&void 0!==t?t:"",d=`${l} ${c}`,u=`${null!==(n=e.homeTeam.placeName.default)&&void 0!==n?n:""} ${null!==(r=e.homeTeam.commonName.default)&&void 0!==r?r:""}`,h=`${l} ${c}`!==m?d:u,g=`${gameObj.nhlLogo}/${e.homeTeam.abbrev}.png`,v=`${gameObj.nhlLogo}/${e.awayTeam.abbrev}.png`,$=new Intl.DateTimeFormat("en-US",{weekday:"short",month:"short",day:"numeric",hour:"numeric",minute:"numeric",hour12:!0}).format(o).split(","),p=$[0]||"",w=($[1]||"").trim().replace(/\s+/g,". "),T=($[2]||"").trim();let y=`

${p}, ${w} | ${T}

`,b=`

vs. ${h}

`,f=s?"Buy Tickets":"";var D,C;return void 0!==e.homeTeam.score&&void 0!==e.awayTeam.score&&o<=i&&(y=`

${p}, ${w} | ${T}

`,b=`

\n ${null!==(D=e.homeTeam.score)&&void 0!==D?D:0}\n |\n ${null!==(C=e.awayTeam.score)&&void 0!==C?C:0}\n

`,f=""),`\n
\n
\n ${u}\n \n ${d}\n
\n
\n ${y}\n ${b}\n ${f}\n
\n
\n `}).join("")};i&&"IntersectionObserver"in window?new IntersectionObserver((e,a)=>{e.forEach(e=>{e.isIntersecting&&(l(),a.unobserve(e.target))})},{threshold:.1}).observe(r):await l()}})()});