PageSourceSearch

https://deadspin.com/_next/static/chunks/5008-2c0e926704ccc665.js

js deadspin.com collected 2026-10-02 02:18:06 UTC 14,871 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5008],{90839:function(e,t,a){var l=a(85893),o=a(67294),n=a(45752);let Tabs=e=>{let{activeTab:t,setActiveTab:a,numQuarters:n,sport:r}=e,i=(0,o.useMemo)(()=>{let e=[],t=(null==r?void 0:r.toLowerCase())==="mlb",a=(null==r?void 0:r.toLowerCase())==="nhl";for(let l=1;l<=n;l++)t?e.push("Inning ".concat(l)):a?e.push("Period ".concat(l)):e.push("".concat(l).concat(1===l?"st":2===l?"nd":3===l?"rd":"th"));return 0===e.length?t?["Inning 1"]:a?["Period 1"]:["1st"]:e},[n,r]);return(0,l.jsx)("div",{className:"bg-white w-full",children:(0,l.jsx)("div",{className:"max-w-full mx-auto",children:(0,l.jsx)("ul",{className:"border-b border-b-gray-300 flex overflow-x-auto",children:i.map((e,o)=>(0,l.jsx)("li",{className:"h-11 transition-all duration-100 ease-out flex items-center justify-center group cursor-pointer shrink-0 ".concat(t===o?"border-b-2 border-cta":"border-b-0 hover:border-b-2 hover:border-cta"),onClick:()=>a(o),children:(0,l.jsx)("button",{className:"text-sm font-medium px-3 text-center transition-colors duration-200 ".concat(t===o?"text-secondary":"text-gray-400 group-hover:text-secondary"),children:e})},e))})})})};t.Z=e=>{let{plays:t=[],homeTeam:a,awayTeam:r,sport:i}=e,[s,d]=(0,o.useState)(0),[m,y]=(0,o.useState)(new Set),c=(null==i?void 0:i.toLowerCase())==="nhl",p=(null==i?void 0:i.toLowerCase())==="nfl",u=(null==i?void 0:i.toLowerCase())==="mlb",g=c?20:p?15:12;console.log("PlayByPlay component received:",{playsCount:t.length,sport:i,isHockey:c,isNFL:p,isMLB:u,periodLengthMinutes:g,homeTeam:null==a?void 0:a.name,awayTeam:null==r?void 0:r.name}),t.length>0&&(console.log("First play structure:",t[0]),console.log("Play types found:",t.map(e=>Object.keys(e).filter(e=>"playStatus"!==e))));let getTeamById=e=>a&&a.id===e?a:r&&r.id===e?r:void 0,formatTimeFromSecondsElapsed=e=>{if(p)return"".concat(Math.floor(e/60).toString().padStart(2,"0"),":").concat(Math.floor(e%60).toString().padStart(2,"0"));let t=60*g-e;t<0&&(t=0);let a=Math.floor(t/60),l=Math.floor(t%60);return"".concat(a.toString().padStart(2,"0"),":").concat(l.toString().padStart(2,"0"))},transformPlayEventToDisplay=(e,t,l,o)=>{var n,i,s,d,m,y,p,u,g,h,v,f,P,N,x,T,b,A,w,S,j,B,C,I,k,E,G,H,M,O,D,L,U,F,Y,q,R,z,W,_,Z,V,J,K,Q;let $;let X={},ee=e.description,getPlayerName=e=>e&&(e.firstName||e.lastName)?e.firstName?e.lastName?"".concat(e.firstName," ").concat(e.lastName):e.firstName:e.lastName:"Unknown Player";if(!ee&&c){if(console.log("Generating description for NHL play:",{eventKeys:Object.keys(e),goal:e.goal,shotAttempt:e.shotAttempt,faceoff:e.faceoff,hit:e.hit,penalty:e.penalty,playerChange:e.playerChange}),e.goal){let t=getPlayerName(e.goal.goalScorer),a=(Z=e.goal.team)&&Z.abbreviation||"Unknown Team";ee="".concat(t," GOAL (").concat(a,")"),e.goal.isPowerPlay&&(ee+=" (Power Play)"),e.goal.isShortHanded&&(ee+=" (Short Handed)"),e.goal.isEmptyNet&&(ee+=" (Empty Net)")}else if(e.shotAttempt){let t=getPlayerName(e.shotAttempt.shootingPlayer),a=(V=e.shotAttempt.team)&&V.abbreviation||"Unknown Team",l=e.shotAttempt.result;ee="".concat(t," SHOT (").concat(l,") - ").concat(a)}else if(e.faceoff){let t=getPlayerName(e.faceoff.homePlayer),a=getPlayerName(e.faceoff.awayPlayer),l=e.faceoff.wonBy;ee="Faceoff: ".concat(t," vs ").concat(a," - Won by ").concat(l)}else if(e.hit){let t=getPlayerName(e.hit.hittingPlayer),a=e.hit.hitPlayer?getPlayerName(e.hit.hitPlayer):"Unknown",l=(J=e.hit.team)&&J.abbreviation||"Unknown Team";ee="".concat(t," HIT on ").concat(a," (").concat(l,")")}else if(e.penalty){let t=getPlayerName(e.penalty.penalizedPlayer),a=(K=e.penalty.team)&&K.abbreviation||"Unknown Team",l=e.penalty.penaltyMinutes;ee="".concat(t," PENALTY (").concat(l," min) - ").concat(a)}else if(e.playerChange){let t=e.playerChange.incoming?getPlayerName(e.playerChange.incoming):"Unknown",a=e.playerChange.outgoing?getPlayerName(e.playerChange.outgoing):"Unknown",l=(Q=e.playerChange.team)&&Q.abbreviation||"Unknown Team";ee=e.playerChange.incoming&&e.playerChange.outgoing?"Player Change: ".concat(a," → ").concat(t," (").concat(l,")"):e.playerChange.incoming?"Player In: ".concat(t," (").concat(l,")"):e.playerChange.outgoing?"Player Out: ".concat(a," (").concat(l,")"):"Player Change (".concat(l,")")}else ee="Play Event"}if(e.jumpBall?(X={Type:"Jump Ball",HomePlayer:getPlayerName(e.jumpBall.homePlayer),AwayPlayer:getPlayerName(e.jumpBall.awayPlayer),WonBy:e.jumpBall.wonBy,TippedTo:e.jumpBall.tippedToPlayer?getPlayerName(e.jumpBall.tippedToPlayer):"N/A"},$="HOME"===e.jumpBall.wonBy?a:"AWAY"===e.jumpBall.wonBy?r:void 0):e.fieldGoalAttempt?($=e.fieldGoalAttempt.team?getTeamById(e.fieldGoalAttempt.team.id):void 0,X={Type:"Field Goal Attempt",Shooter:getPlayerName(e.fieldGoalAttempt.shootingPlayer),ShotType:e.fieldGoalAttempt.shotType,Distance:"".concat(e.fieldGoalAttempt.distanceFeet,"ft"),Points:e.fieldGoalAttempt.points,Result:e.fieldGoalAttempt.result,AssistedBy:e.fieldGoalAttempt.assistingPlayer?getPlayerName(e.fieldGoalAttempt.assistingPlayer):"N/A",BlockedBy:e.fieldGoalAttempt.blockingPlayer?getPlayerName(e.fieldGoalAttempt.blockingPlayer):"N/A"}):e.rebound?($=e.rebound.team?getTeamById(e.rebound.team.id):void 0,X={Type:"Rebound",Player:e.rebound.retrievingPlayer?getPlayerName(e.rebound.retrievingPlayer):"Team Rebound",ReboundType:e.rebound.type}):e.turnover?($=e.turnover.team?getTeamById(e.turnover.team.id):void 0,X={Type:"Turnover",Player:getPlayerName(e.turnover.lostByPlayer),TurnoverType:e.turnover.type,StolenBy:e.turnover.stolenByPlayer?getPlayerName(e.turnover.stolenByPlayer):"N/A"}):e.foul?($=e.foul.team?getTeamById(e.foul.team.id):void 0,X={Type:"Foul",Player:getPlayerName(e.foul.penalizedPlayer),DrawnBy:e.foul.drawnByPlayer?getPlayerName(e.foul.drawnByPlayer):"N/A",FoulType:e.foul.type}):e.freeThrowAttempt?($=e.freeThrowAttempt.team?getTeamById(e.freeThrowAttempt.team.id):void 0,X={Type:"Free Throw",Shooter:getPlayerName(e.freeThrowAttempt.shootingPlayer),Attempt:"".concat(e.freeThrowAttempt.attemptNum," of ").concat(e.freeThrowAttempt.totalAttempts),Result:e.freeThrowAttempt.result}):e.substitution?($=e.substitution.team?getTeamById(e.substitution.team.id):void 0,X={Type:"Substitution",PlayerIn:getPlayerName(e.substitution.incomingPlayer),PlayerOut:getPlayerName(e.substitution.outgoingPlayer)}):e.violation?($=e.violation.team?getTeamById(e.violation.team.id):void 0,X={Type:"Violation",Player:getPlayerName(e.violation.player),ViolationType:e.violation.type}):e.goal?($=e.goal.team?getTeamById(e.goal.team.id):void 0,X={Type:"Goal",Scorer:getPlayerName(e.goal.goalScorer),PrimaryAssist:e.goal.primaryAssist?getPlayerName(e.goal.primaryAssist):"N/A",SecondaryAssist:e.goal.secondaryAssist?getPlayerName(e.goal.secondaryAssist):"N/A",Goalie:e.goal.goalie?getPlayerName(e.goal.goalie):"N/A",EmptyNet:e.goal.isEmptyNet?"Yes":"No",PowerPlay:e.goal.isPowerPlay?"Yes":"No",ShortHanded:e.goal.isShortHanded?"Yes":"No"}):e.shotAttempt?($=e.shotAttempt.team?getTeamById(e.shotAttempt.team.id):void 0,X={Type:"Shot Attempt",Shooter:getPlayerName(e.shotAttempt.shootingPlayer),Goalie:e.shotAttempt.goalie?getPlayerName(e.shotAttempt.goalie):"N/A",Result:e.shotAttempt.result}):e.faceoff?($=e.faceoff.team?getTeamById(e.faceoff.team.id):void 0,X={Type:"Faceoff",HomePlayer:getPlayerName(e.faceoff.homePlayer),AwayPlayer:getPlayerName(e.faceoff.awayPlayer),WonBy:e.faceoff.wonBy}):e.hit?($=e.hit.team?getTeamById(e.hit.team.id):void 0,X={Type:"Hit",HittingPlayer:getPlayerName(e.hit.hittingPlayer),HitPlayer:e.hit.hitPlayer?getPlayerName(e.hit.hitPlayer):"N/A"}):e.penalty?($=e.penalty.team?getTeamById(e.penalty.team.id):void 0,X={Type:"Penalty",Player:getPlayerName(e.penalty.penalizedPlayer),PenaltyType:e.penalty.penaltyType,Minutes:e.penalty.penaltyMinutes}):e.playerChange&&($=e.playerChange.team?getTeamById(e.playerChange.team.id):void 0,X={Type:"Player Change",PlayerIn:e.playerChange.incoming?getPlayerName(e.playerChange.incoming):"N/A",PlayerOut:e.playerChange.outgoing?getPlayerName(e.playerChange.outgoing):"N/A",IsGoalie:e.playerChange.isGoalie?"Yes":"No"}),!$){let t=null!==(_=null!==(W=null!==(z=null!==(R=null!==(q=null!==(Y=null!==(F=null!==(U=null!==(L=null!==(D=null!==(O=null!==(M=null===(d=e.fieldGoalAttempt)||void 0===d?void 0:null===(s=d.team)||void 0===s?void 0:s.id)&&void 0!==M?M:null===(y=e.rebound)||void 0===y?void 0:null===(m=y.team)||void 0===m?void 0:m.id)&&void 0!==O?O:null===(u=e.turnover)||void 0===u?void 0:null===(p=u.team)||void 0===p?void 0:p.id)&&void 0!==D?D:null===(h=e.foul)||void 0===h?void 0:null===(g=h.team)||void 0===g?void 0:g.id)&&void 0!==L?L:null===(f=e.freeThrowAttempt)||void 0===f?void 0:null===(v=f.team)||void 0===v?void 0:v.id)&&void 0!==U?U:null===(N=e.substitution)||void 0===N?void 0:null===(P=N.team)||void 0===P?void 0:P.id)&&void 0!==F?F:null===(T=e.violation)||void 0===T?void 0:null===(x=T.team)||void 0===x?void 0:x.id)&&void 0!==Y?Y:null===(A=e.goal)||void 0===A?void 0:null===(b=A.team)||void 0===b?void 0:b.id)&&void 0!==q?q:null===(S=e.shotAttempt)||void 0===S?void 0:null===(w=S.team)||void 0===w?void 0:w.id)&&void 0!==R?R:null===(B=e.faceoff)||void 0===B?void 0:null===(j=B.team)||void 0===j?void 0:j.id)&&void 0!==z?z:null===(I=e.hit)||void 0===I?void 0:null===(C=I.team)||void 0===C?void 0:C.id)&&void 0!==W?W:null===(E=e.penalty)||void 0===E?void 0:null===(k=E.team)||void 0===k?void 0:k.id)&&void 0!==_?_:null===(H=e.playerChange)||void 0===H?void 0:null===(G=H.team)||void 0===G?void 0:G.id;t&&($=getTeamById(t))}return{id:(null===(n=e.id)||void 0===n?void 0:n.toString())||"play-".concat(null===(i=e.playStatus)||void 0===i?void 0:i.quarter,"-").concat(t),time:formatTimeFromSecondsElapsed(e.playStatus.secondsElapsed),logo:(null==$?void 0:$.logo)||"",team:(null==$?void 0:$.name)||"N/A",play:ee,minScore:" ",denScore:" ",details:X}},h=(0,o.useMemo)(()=>{let e={},l=0;console.log("Processing plays in PlayByPlay component:",{totalPlays:t.length,plays:t.slice(0,3)}),t.forEach((t,o)=>{var n,i,s;let d=1;d=c?(null===(n=t.playStatus)||void 0===n?void 0:n.period)||1:u?(null===(i=t.playStatus)||void 0===i?void 0:i.inning)||
11:(null===(s=t.playStatus)||void 0===s?void 0:s.quarter)||1,l=Math.max(l,d);let m=transformPlayEventToDisplay(t,o,a.id,r.id);m?(e[d]||(e[d]=[]),e[d].push(m)):console.log("Play ".concat(o," was not transformed successfully"))}),console.log("Processed plays by period:",{grouped:e,maxPeriod:l,periodCounts:Object.keys(e).map(t=>({period:t,count:e[parseInt(t)].length}))});for(let t=1;t<=l;t++)e[t]||(e[t]=[]);return 0===l&&0===t.length&&(l=1,e[1]=[]),{grouped:e,maxPeriod:l}},[t,a,r]),v=Math.min(h.maxPeriod,c?3:4),f=h.grouped[s+1]||[],toggleExpanded=e=>{y(t=>{let a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a})},P=(null==r?void 0:r.name.substring(0,3).toUpperCase())||"AWAY",N=(null==a?void 0:a.name.substring(0,3).toUpperCase())||"HOME";return(0,l.jsxs)(n.Z,{children:[(0,l.jsx)(Tabs,{activeTab:s,setActiveTab:d,numQuarters:v,sport:i}),(0,l.jsxs)("div",{className:"overflow-x-auto",children:[(0,l.jsxs)("table",{className:"w-full override-table",children:[" ",(0,l.jsx)("thead",{children:(0,l.jsxs)("tr",{className:"bg-gray-50 border-b border-gray-200",children:[(0,l.jsx)("th",{className:"p-1 text-left text-xs font-medium text-gray-600 w-20",children:"TIME"}),(0,l.jsx)("th",{className:"p-1 text-left text-xs font-medium text-gray-600",children:"PLAY"}),(0,l.jsx)("th",{className:"p-1 text-center text-xs font-medium text-gray-600 w-16",children:P}),(0,l.jsx)("th",{className:"p-1 text-center text-xs font-medium text-gray-600 w-16",children:N})]})}),(0,l.jsx)("tbody",{className:"max-h-96 overflow-y-auto",children:f.map(e=>(0,l.jsxs)(o.Fragment,{children:[(0,l.jsxs)("tr",{onClick:()=>toggleExpanded(e.id),className:"border-b border-gray-100 hover:bg-gray-50 cursor-pointer transition-colors",children:[(0,l.jsx)("td",{className:"p-1.5 text-sm text-gray-600",children:e.time}),(0,l.jsx)("td",{className:"p-1.5",children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[e.logo&&(0,l.jsx)("img",{src:e.logo,className:"size-5",alt:e.team}),(0,l.jsx)("span",{className:"text-secondary text-sm",children:e.play})]})}),(0,l.jsx)("td",{className:"p-1.5 text-center text-sm font-medium",children:e.minScore}),(0,l.jsx)("td",{className:"p-1.5 text-center text-sm font-medium",children:e.denScore})]}),m.has(e.id)&&(0,l.jsx)("tr",{className:"bg-gray-50",children:(0,l.jsxs)("td",{colSpan:4,className:"px-4 pb-4",children:[" ",(0,l.jsxs)("div",{className:"ml-10 p-3",children:[(0,l.jsx)("h4",{className:"font-medium text-xs text-secondary mb-2",children:"Play Details"}),(0,l.jsx)("div",{className:"space-y-1 text-xs text-gray-600",children:Object.entries(e.details).map(e=>{let[t,a]=e;return(0,l.jsxs)("div",{className:"flex",children:[(0,l.jsxs)("span",{className:"font-medium capitalize w-28",children:[" ",t.replace(/([A-Z])/g," $1").trim(),":"]}),(0,l.jsx)("span",{children:String(a)})," "]},t)})})]})]})})]},e.id))})]}),0===f.length&&(0,l.jsx)("div",{className:"p-8 text-center text-gray-500",children:"No plays recorded for this period"})]})]})}},55607:function(e,t,a){a.d(t,{qo:function(){return mapSportsDataIOPlays}});function mapSportsDataIOPlays(e,t,a){if(!e||!Array.isArray(e))return[];switch(t.toLowerCase()){case"nfl":return e.map(e=>(function(e,t){let{PlayID:a,QuarterName:l,TimeRemainingMinutes:o,TimeRemainingSeconds:n,Description:r,Type:i}=e,s=parseInt(l.replace(/\D/g,""));return{description:r,playStatus:{quarter:s,secondsElapsed:900-(60*o+n)},id:a,type:i,team:e.Team,down:e.Down,distance:e.Distance,yardLine:e.YardLine,yardsGained:e.YardsGained}})(e,0));case"nba":return e.map(e=>(function(e,t){let{PlayID:a,QuarterName:l,TimeRemainingMinutes:o,TimeRemainingSeconds:n,Description:r,Type:i}=e,s=parseInt(l.replace(/\D/g,""));return{description:r||"",playStatus:{quarter:s,secondsElapsed:720-(60*o+n)},id:a||e.Sequence,type:i,team:e.Team,points:e.Points,shotMade:e.ShotMade}})(e,0));case"mlb":return e.map(e=>(function(e,t){let{PlayID:a,InningNumber:l,InningHalf:o,Description:n,Result:r,AtBat:i,Hit:s,Out:d,Strikeout:m,Walk:y,HomeRun:c,RunsBattedIn:p}=e,u=l||1;return{description:n||"",playStatus:{inning:u,secondsElapsed:(u-1)*1800+("T"===o?0:900)},id:a||e.Sequence,type:r,category:i?"At Bat":"Other",team:e.HitterTeamID?"Team ".concat(e.HitterTeamID):void 0,atBat:i,hit:s,out:d,strikeout:m,walk:y,homeRun:c,rbi:p||0,inningHalf:o,balls:e.Balls||0,strikes:e.Strikes||0,outs:e.Outs||0}})(e,0));case"nhl":return e.map(e=>
1(function(e,t){let{PlayID:a,PeriodName:l,ClockMinutes:o,ClockSeconds:n,Description:r,Type:i,Category:s}=e,d=parseInt(l.replace(/\D/g,""));return{description:r||"",playStatus:{period:d,secondsElapsed:1200-(60*o+n)},id:a||e.Sequence,type:i,category:s,team:e.Team,opponent:e.Opponent,playerId:e.PlayerID,clockMinutes:o,clockSeconds:n}})(e,0));default:return console.warn("Unknown sport: ".concat(t)),[]}}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.