import{j as e,a,c as Le,u as Pe,r as j,K as Ae,F as n,g as G,L as _e,o as Me,ac as Ne,ad as we}from"./vendor-VJxmgdSZ.js";import{a6 as g,S as L,a7 as i,i0 as ae,ja as ke,u as Re,bu as qe,d_ as ze,_ as Oe,dc as Ie,db as Ge,C as te,h3 as De,O as D,an as H,a9 as U,jb as He,n as r,aJ as m,ew as Ue,aD as re,hn as ie,aI as ne,dM as oe,af as We,bP as _,c as Fe,jc as le,aE as $e,f8 as Ye,ev as Ve,I as Je,dq as Qe,as as Ke,b4 as Xe,b as Ze,bJ as es,l as ss,cR as as}from"./index-8NUjVnN0.js";import{A as ts}from"./index-ZaJOCDGq.js";import{T as rs,a as is,S as ns,R as os}from"./layout-AQvP8bd0.js";import{T as ls,a as cs}from"./page-H9IL-L49.js";import{E as ds}from"./layout-xABgOJw7.js";import{D as us,c as gs}from"./page-Ha8-w6xG.js";import{S as ps}from"./layout-5tCvJ2Qy.js";import{M as ce}from"./mlbTeams-EB-IAfqf.js";import{P as h,C as N,T as he}from"./layout-Oz5HY5bH.js";import{t as de}from"./index-LwviVJzE.js";import"./page-2dFWG2ry.js";import"./useGroupedCreditCardsOption-piCHSwPY.js";import"./index-tV_VcXc1.js";import"./thirdPlace-oLIsMvRC.js";import"./page-tIIW-d7Q.js";import"./page-SXFVKazX.js";import"./page-ZH0Tb7KN.js";import"./page-WEp2OnuO.js";import"./index-XIuy3EpL.js";import"./index-Pw5qSmSM.js";import"./layout-00zBYkvP.js";import"./page-UxF6T42M.js";import"./layout-Hj4n8lo1.js";import"./conversion-credit--FuJu3PT.js";import"./layout-TasLVN-1.js";const M=a.img(["height:var(--quadruple-unit);&.limited{filter:sepia(1) hue-rotate(-10deg) saturate(3);}&.rare{filter:sepia(1) hue-rotate(-55deg) saturate(6);}"]),ms=a.div(["font-size:var(--triple-unit);"]),hs=a(ms)(["font-size:var(--double-unit);margin-top:8px;"]),W=a(ke)(["height:var(--quadruple-unit);"]),xs=[{category:"Experiences",prizes:[{count:1,displayName:"2x World Series",displayName2:"Game Tickets",icon:e.jsxs(g,{gap:0,children:[e.jsx(M,{src:de,className:"limited"}),e.jsx(hs,{children:"👜"})]})},{count:2,displayName:"2x Division Round",displayName2:"Game Tickets",icon:e.jsx(M,{src:de})}]},{category:"46 Cards from Postseason Teams",type:"cards",prizes:[{count:1,rarity:"super_rare",displayName2:"Super Rare Card",displayName:"Postseason Team",icon:e.jsx(W,{sport:L.BASEBALL,season:"2024",rarity:i.super_rare,tier:1})},{count:5,rarity:"rare",displayName2:"Rare Card",displayName:"Postseason Team",icon:e.jsx(W,{sport:L.BASEBALL,season:"2024",rarity:i.rare})},{count:40,rarity:"limited",displayName2:"Limited Card",displayName:"Postseason Team",icon:e.jsx(W,{sport:L.BASEBALL,season:"2024",rarity:i.limited})}]},{category:"75 Reward Boxes",prizes:[{count:25,displayName:"Premium",displayName2:"Rare Box",icon:e.jsx(M,{src:ae,className:"rare"})},{count:50,displayName:"Premium",displayName2:"Limited Box",icon:e.jsx(M,{src:ae,className:"limited"})}]}],xe=["new-york-yankees","cleveland-guardians","baltimore-orioles","kansas-city-royals","houston-astros","minnesota-twins","detroit-tigers","seattle-mariners"],be=["philadelphia-phillies","los-angeles-dodgers","milwaukee-brewers","san-diego-padres","arizona-diamondbacks","new-york-mets","atlanta-braves","chicago-cubs","st-louis-cardinals"],bs=[...xe,...be],vs=ss`query BaseballPlayPostseasonCollectionEventQuery($userSlug:String!$after:String){user(slug:$userSlug){slug cardCollections(startedOnly:false after:$after first:50 rarities:[limited rare super_rare unique]sport:BASEBALL){nodes{slug ...CollectionEventProgress_cardCollection userCardCollection(forUserSlug:$userSlug){id score fulfilledSlotsCount user{slug}}season{id name startYear}rarity team{...on TeamInterface{slug}...TeamLogoWithSeasonOverlay_team}}pageInfo{endCursor hasNextPage}}}}${N.fragments.cardCollection}${he.fragments.team}`,js=a.div(["min-height:var(--100vh);margin-bottom:var(--quadruple-unit);"]),fs=a(g)(["padding:var(--double-unit) 0;"]),Ss=a.div(["display:grid;align-items:flex-start;margin-top:var(--quadruple-unit);grid-template-areas:'summary' 'main' 'prizePool' 'teams';gap:var(--quadruple-unit);@media ","{grid-template-areas:'summary main' 'prizePool main' 'prizePool teams';grid-template-columns:375px 1fr;grid-template-rows:auto auto 1fr;gap:var(--quadruple-unit);}"],Ke),w=a(r).attrs({gap:2})([""]),ys=a(w)(["grid-area:main;box-shadow:0px 0px 128px 64px rgba(163,84,81,0.16);--current-background-color:var(--c-neutral-300);background:var(--c-neutral-200);border-radius:var(--double-unit);overflow:hidden;",""],Xe),Cs=a(w)(["grid-area:summary;"]),Es=a(w)(["grid-area:prizePool;"]),Ts=a(w)(["grid-area:teams;"]),Bs=a(r).attrs({center:!0})(["grid-column:span 2;text-align:center;font:var(--t-label-l);margin-bottom:0;"]),Ls=a(r).attrs({gap:4})(["align-self:center;flex:1;margin:var(--triple-unit);max-width:","px;"],Ze.desktop),Ps=a.div(["display:grid;grid-template-columns:repeat(auto-fill,minmax(var(--quadruple-unit),1fr));gap:var(--double-unit);@media ","{grid-template-columns:repeat( auto-fill,minmax(calc(10 * var(--unit)),1fr) );}"],es),F=a(g).attrs({gap:2})(["display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));"]),As=new Date("2024-10-01T16:00:00.000Z"),ue=(x,c)=>{var o,b;return(((o=c.userCardCollection)==null?void 0:o.score)??0)-(((b=x.userCardCollection)==null?void 0:b.score)??0)},ge=x=>x.reduce((c,o)=>{var f,P,p;const b=o.rarity,T=h[b],l=((f=o.userCardCollection)==null?void 0:f.score)??0,k=((P=o.userCardCollection)==null?void 0:P.fulfilledSlotsCount)??0;return l>=T?(((p=o.season)==null?void 0:p.startYear)===2024&&(c.inseasonEligible+=3),c.eligible.push(o)):k>0?c.started.push(o):c.notStarted.push(o),c.total+=1,c},{eligible:[],started:[],notStarted:[],inseasonEligible:0,total:0}),_s=a(g).attrs({gap:0})(["padding:0 var(--unit);"]),Ms=a(g)(["display:inline-flex;flex-wrap:wrap;row-gap:0;"]),Ns=a.div([""]),ws=a.div([""]),ks=a(as)(["flex:1;color:var(--c-brand-300);border-radius:var(--unit);white-space:nowrap;&:hover,&:focus{color:var(--c-brand-300);}"]),Rs=a.span(["display:inline-flex;align-items:center;gap:var(--half-unit);font:var(--t-body-s);color:var(--c-brand-300);"]),qs=a(r).attrs({gap:2})(["&.isPrimarySection{padding:var(--triple-unit) 0;border-top:1px solid var(--c-neutral-300);}"]),zs=a(r).attrs({gap:2})(["border-top:1px solid var(--c-neutral-300);"]),Os=a(ls)(["margin:0 calc(-1 * var(--double-unit));&.limited{--c-active-tab-bg:rgba(var(--c-rgb-limited),0.1);--c-active-tab-border:var(--c-collection-limited);}&.rare{--c-active-tab-bg:rgba(var(--c-rgb-rare),0.1);--c-active-tab-border:var(--c-collection-rare);}&.super_rare{--c-active-tab-bg:rgba(var(--c-rgb-superRare),0.1);--c-active-tab-border:var(--c-collection-superRare);}&.unique{--c-active-tab-bg:rgba( 221,82,255,0.1 );--c-active-tab-border:var(--c-collection-unique);}&.flat{--bar-bg-color:var(--c-neutral-300) !important;--animated-border-bottom:2px solid var(--c-active-tab-border);--button-border-radius:24px 24px 0 0;}"]),Is=a(cs)(["flex:1 !important;"]),pe=a(g)(["flex-wrap:wrap;"]),Gs=a.div(["> *:first-child{font:var(--t-label-s);}> *:only-child,> *:nth-child(2){font:var(--t-headline-l);}"]),Ds=a.h3(["font:var(--t-body-s);"]),me=a.img(["width:var(--triple-unit);height:var(--triple-unit);"]),Hs=0,ha=()=>{var Q,K,X,Z;const{currentUser:x}=Re(),[c]=Le(),o=qe(),{formatMessage:b}=Pe(),{track:T}=ze(),[l,k]=j.useState(i.limited),[f,P]=j.useState(!1),p=c.get("user")||(x==null?void 0:x.slug)||"",[$,ve]=j.useState(null),{data:v,loading:je,loadMore:Y}=Oe(vs,{variables:{userSlug:p},skip:!p,connection:"CardCollectionConnection",fetchPolicy:"network-only"}),S=(((K=(Q=v==null?void 0:v.user)==null?void 0:Q.cardCollections)==null?void 0:K.nodes)||[]).filter(s=>s.rarity&&s.rarity!==i.common).filter(s=>{var t;return bs.includes(((t=s.team)==null?void 0:t.slug)||"")}),y=(Z=(X=v==null?void 0:v.user)==null?void 0:X.cardCollections)==null?void 0:Z.pageInfo,R=y==null?void 0:y.hasNextPage,A=(y==null?void 0:y.endCursor)??null;j.useEffect(()=>{R&&A!==$&&(Y(!1,{after:A}),ve(A))},[A,R,Y,$]);const C=j.useMemo(()=>{const s=Object.entries(Ie(S,t=>t.rarity||"no_rarity")).map(([t,u])=>[t,ge(u.sort(ue))]);return Object.fromEntries(s)},[S]),d=j.useMemo(()=>{const s=S.filter(t=>t.rarity===l).sort(ue);return ge(s)},[S,l]),fe=S.reduce((s,t)=>{var se;const u=t.rarity;if(!t.userCardCollection)return s;const E=t.userCardCollection.score>=h[u],B=((se=t.season)==null?void 0:se.startYear)===2024,ee=E?1:0;return{inSeason:s.inSeason+(B?ee:0),classic:s.classic+(B?0:ee)}},{inSeason:0,classic:0}),V=S.reduce((s,t)=>{const u=t.rarity;if(!t.userCardCollection)return{...s};const E=t.userCardCollection.score>=h[u];return{...s,[u]:s[u]+(E?1:0)}},{[i.common]:0,[i.limited]:0,[i.rare]:0,[i.super_rare]:0,[i.unique]:0}),J=V[l]>0,q=o?10:5,z=d.eligible.length>0,Se=d.started.slice(0,q),ye=d.started.slice(q,d.started.length),Ce=d.notStarted.length>0,O=d.started.length>0,Ee=d.started.length>q,Te=Ge(s=>{var t;return((t=s.team)==null?void 0:t.slug)||""},d.notStarted),Be=j.useCallback(s=>{k(s);const t=C[i.limited],u=C[i.rare],E=C[i.super_rare],B=C[i.unique];T("Change Collection Event PageTab",{sport:L.BASEBALL,fromRarity:l,toRarity:s,summary:{limited_eligible:t.eligible.length,limited_started:t.started.length,rare_eligible:u.eligible.length,rare_started:u.started.length,super_rare_eligible:E.eligible.length,super_rare_started:E.started.length,unique_eligible:B.eligible.length,unique_started:B.started.length}})},[C,l,T]),I=!!(!v||je||R);return e.jsx(js,{children:e.jsx(te,{header:e.jsx(De,{children:e.jsx(D,{children:e.jsxs(fs,{children:[e.jsx(H,{color:"transparent",icon:Ae,title:b(U.close),to:He}),e.jsx(Gs,{children:e.jsx("h2",{children:e.jsx(ds,{children:b({id:"Baseball.CollectionEvent.Postseason.pageTitle",defaultMessage:"Postseason Collection Event"})})})})]})})}),children:e.jsx(D,{children:e.jsxs(Ss,{children:[e.jsx(Cs,{center:!0,gap:o?4:2,children:e.jsxs(r,{center:!0,children:[e.jsx(rs,{collectionEntries:fe,freeEntries:Hs,loading:I,inSeasonValue:3}),e.jsx(m,{as:"div",color:"var(--c-neutral-600)",children:e.jsx(Ue,{time:As,children:({timeLeft:s,isEnded:t})=>t?e.jsx(n,{id:"Baseball.CollectionEvent.eventEnded",defaultMessage:"This event ended"}):e.jsx(n,{id:"Baseball.CollectionEvent.eventEndsIn",defaultMessage:"This event will end in {timeLeft}",values:{timeLeft:e.jsx(m,{as:"span",bold:!0,color:"var(--c-neutral-1000)",children:s})}})})})]})}),e.jsx(Ts,{children:e.jsxs(r,{children:[e.jsx(re,{as:"span",color:"var(--c-neutral-1000)",children:e.jsx(n,{id:"Baseball.CollectionEvent.EligibleTeams",defaultMessage:"Eligible teams"})}),e.jsx(ie,{children:e.jsxs(r,{gap:2,center:!0,children:[e.jsx(ne,{as:"div",children:e.jsx(n,{id:"Baseball.CollectionEvent.AmericanLeague",defaultMessage:"American League"})}),e.jsx(pe,{gap:2,children:xe.map(s=>ce.findBySlug(s)).map(s=>s?e.jsx(H,{color:"tertiary",to:G(oe,{slug:s.slug}),children:e.jsx(me,{src:s.svgUrl})},s.slug):null)}),e.jsx(ne,{as:"div",children:e.jsx(n,{id:"Baseball.CollectionEvent.NationalLeague",defaultMessage:"National League"})}),e.jsx(pe,{gap:2,children:be.map(s=>ce.findBySlug(s)).map(s=>s?e.jsx(H,{color:"tertiary",to:G(oe,{slug:s.slug}),children:e.jsx(me,{src:s.svgUrl})},s.slug):null)})]})})]})}),e.jsxs(Es,{children:[e.jsxs(r,{children:[e.jsxs(g,{gap:0,children:[e.jsx(re,{as:"span",color:"var(--c-neutral-1000)",children:e.jsx(n,{...We.prizes})})," ",e.jsx(_,{as:"span",color:"var(--c-neutral-600)",children:"*"})]}),e.jsx(ie,{children:e.jsx(r,{gap:2,children:e.jsx(is,{prizePool:xs})})}),e.jsxs(m,{as:"span",color:"var(--c-neutral-500)",children:["*"," ",e.jsx(n,{id:"Baseball.CollectionEvent.TermsAndConditionsLink",defaultMessage:"Terms & Conditions apply. <link>Read more</link>.",values:{link:s=>e.jsx(_e,{to:"/blog/postseason-collection-event-terms-and-conditions-the-sweepstakes",children:e.jsx(m,{as:"span",bold:!0,color:"var(--c-neutral-500)",children:s})})}})]})]}),e.jsx(r,{gap:3,children:e.jsx(us,{thresholds:gs})})]}),e.jsx(ys,{children:e.jsx(Ns,{children:e.jsx(Fe.NoPadding,{children:e.jsx(te,{header:e.jsx(D,{children:e.jsx(Os,{fullWidth:!0,variant:"flat",value:l,className:l,children:[i.limited,i.rare,i.super_rare,i.unique].map(s=>{var t;return e.jsx(Is,{value:s,onClick:()=>Be(s),children:e.jsx(Bs,{children:e.jsxs(r,{center:!0,gap:0,children:[e.jsxs(r,{center:!0,gap:1,children:[e.jsx(ns,{loading:I,children:e.jsx(os,{nb:V[s],max:((t=C[s])==null?void 0:t.total)||0})}),e.jsx(Ds,{children:e.jsx(ps,{scarcity:s})})]}),e.jsx(g,{center:!0,gap:1,children:e.jsx(m,{bold:!0,children:e.jsx(g,{children:o&&e.jsx(n,{id:"Baseball.CollectionEvent.RequiresScore",defaultMessage:"Requires {nb}",values:{nb:e.jsx(le,{score:h[i[s]]})}})})})})]})})},s)})})}),children:e.jsx(ws,{children:!I&&e.jsxs(Ls,{children:[z&&e.jsxs(r,{gap:3,children:[e.jsxs(r,{gap:.5,children:[e.jsx(_,{as:"div",bold:!0,children:e.jsx(Ms,{children:e.jsx(n,{id:"Baseball.CollectionEvent.EligibleSection.Title",defaultMessage:"Congrats, you hit the {score} threshold !",values:{score:e.jsx(le,{score:h[l]})}})})}),e.jsx(m,{as:"div",color:"var(--c-neutral-600)",children:e.jsx(n,{id:"Baseball.CollectionEvent.Postseason.EligibleSection.Subtitle",defaultMessage:"Each In-season Collection gets you 3 entries, each Classic Collection gets you 1 entry"})})]}),e.jsx(F,{children:d.eligible.map(s=>e.jsx(N,{userSlug:p,collection:s,thresholds:h},s.slug))})]}),!z&&!O&&e.jsx(r,{gap:3,children:e.jsxs(r,{gap:.5,children:[e.jsx(_,{as:"div",bold:!0,children:e.jsx(g,{children:e.jsx(n,{id:"Baseball.CollectionEvent.EligibleSection.Title.empty",defaultMessage:"Start a collection for chance to win prizes"})})}),e.jsx(m,{as:"div",color:"var(--c-neutral-600)",children:e.jsx(n,{id:"Baseball.CollectionEvent.Postseason.EligibleSection.Subtitle",defaultMessage:"Each In-season Collection gets you 3 entries, each Classic Collection gets you 1 entry"})})]})}),O&&e.jsxs(qs,{gap:3,className:Me({isPrimarySection:z}),children:[e.jsxs(r,{gap:.5,children:[J?e.jsx($e,{as:"div",bold:!0,children:e.jsx(n,{id:"Baseball.CollectionEvent.StartedSection.Title.another",defaultMessage:"Add to these collections to get another entry:"})}):e.jsx(_,{as:"div",bold:!0,children:e.jsx(n,{id:"Baseball.CollectionEvent.StartedSection.Title.first",defaultMessage:"Add to these collections to get a chance to win prizes"})}),e.jsx(m,{as:"div",color:"var(--c-neutral-600)",children:J?e.jsx(n,{id:"Baseball.CollectionEvent.StartedSection.Subtitle",defaultMessage:"Every entry gives you a better chance to win prizes"}):e.jsx(n,{id:"Baseball.CollectionEvent.Postseason.EligibleSection.Subtitle",defaultMessage:"Each In-season Collection gets you 3 entries, each Classic Collection gets you 1 entry"})})]}),e.jsxs(r,{gap:0,children:[e.jsx(F,{children:Se.map(s=>e.jsx(N,{userSlug:p,collection:s,thresholds:h},s.slug))}),Ee&&e.jsxs(e.Fragment,{children:[e.jsx(Ye,{open:f,hideGap:!0,children:e.jsxs(r,{gap:2,children:[e.jsx(r,{center:!0,children:e.jsx(Ve,{as:"div",color:"var(--c-neutral-400)",children:"• • •"})}),e.jsx(F,{children:ye.map(s=>e.jsx(N,{userSlug:p,collection:s,thresholds:h},s.slug))})]})},l),e.jsx(_s,{children:e.jsx(ks,{onClick:()=>P(s=>!s),children:e.jsxs(Rs,{children:[e.jsx(n,{...f?U.showLess:U.showMore}),e.jsx(Je,{icon:f?Ne:we,size:"sm"})]})})})]})]})]}),Ce&&e.jsx(zs,{gap:2,children:e.jsx(ts,{startsOpen:!O,noTopPadding:!0,noHorizontalPadding:!0,title:e.jsx(r,{center:!0,children:e.jsx(m,{as:"div",bold:!0,color:"var(--c-neutral-600)",children:e.jsx(n,{id:"Baseball.CollectionEvent.NotStartedSection.Title",defaultMessage:"Not started ({nb})",values:{nb:d.notStarted.length}})})}),children:e.jsx(Ps,{children:Te.map(s=>!s.team||!s.season?null:e.jsx(he,{team:s.team,onClick:()=>T("Clicking Collection Event CollectionItem",{sport:L.BASEBALL,filledSlots:0,rarity:l,score:0,passThreshold:!1,season:s.season.startYear}),season:s.season.startYear,to:G(Qe,{slug:p,collectionSlug:s.slug})},s.slug))})},l)})]})},l)})})})})]})})})})};export{ha as default};
//# sourceMappingURL=page-u5CGb81t.js.map
