1import{j as e,n as f,C as y,i as j,l as B,G as x,B as z,k as a,w as N,T as h,x as L,A as F,h as g,q as w,L as I,p as E}from"./vendor-mantine-DnsVasE9.js";import{r as b,i as M,u as G,L as S}from"./vendor-react-DEH02D30.js";import{u as _,T as W,f as O,t as D,s as H}from"./index-BFBzg06E.js";import"./vendor-supabase-D8ud9Cwr.js";function P(n){if(n==="positive")return"var(--mantine-color-green-6)";if(n==="negative")return"var(--mantine-color-red-6)"}function v(n){const r=n.replace("â","-").match(/-?\d+(\.\d+)?/);return r?Math.abs(parseFloat(r[0])):null}function V(n,r){if(n!=="positive"&&n!=="negative")return;const s=v(r)??0;if(s<.05)return;const i=Math.min(.07+s/3*.23,.3),t=n==="positive"?"64,145,108":"214,69,69";return`light-dark(rgba(${t}, ${(i*.7).toFixed(3)}), rgba(${t}, ${i.toFixed(3)}))`}const q=["Before","After","Change"],U={textAlign:"left",position:"sticky",left:0,zIndex:2,background:"var(--mantine-color-body)",minWidth:86},Y={position:"sticky",left:0,zIndex:1,background:"var(--mantine-color-body)"},J={backgroundColor:"light-dark(var(--mantine-color-gray-1), var(--mantine-color-dark-6))",borderLeft:"3px solid var(--mantine-color-blue-5)"};function $({section:n,tintChanges:r=!1}){return e.jsx(N,{type:"auto",children:e.jsxs(h,{className:"clean-table",style:{fontSize:12.5},children:[e.jsx(h.Thead,{children:e.jsxs(h.Tr,{children:[e.jsx(h.Th,{style:U}),n.columns.map(s=>e.jsx(h.Th,{style:{textAlign:"right",minWidth:50},children:e.jsx(a,{size:"10px",tt:"uppercase",c:"dimmed",fw:600,children:s})},s))]})}),e.jsx(h.Tbody,{children:n.groups.map((s,i)=>e.jsxs(b.Fragment,{children:[s.heading&&e.jsx(h.Tr,{children:e.jsx(h.Td,{colSpan:n.columns.length+1,fw:700,pt:6,pb:4,style:J,children:s.heading})}),s.rows.map((t,o)=>{const d=t.label==="Change";return e.jsxs(h.Tr,{children:[e.jsx(h.Td,{className:"clean-sticky",style:Y,children:q.includes(t.label)?e.jsx(a,{size:"11px",c:"dimmed",fw:d?700:600,tt:"uppercase",style:{letterSpacing:"0.03em"},children:t.label}):e.jsx(a,{size:"sm",fw:t.strong?700:600,truncate:!0,style:{maxWidth:180},children:t.label})}),t.cells.map((l,c)=>{const m=t.cellTones?.[c],p=l==="0"||l==="â";return e.jsx(h.Td,{style:{textAlign:"right",backgroundColor:r&&d?V(m,l):void 0},children:e.jsx(a,{fw:t.strong?700:void 0,c:P(m)||(p?"dimmed":void 0),style:{fontSize:12.5,fontVariantNumeric:"tabular-nums"},children:l==="0"?"â":l})},`${t.label}-${c}`)})]},`${s.heading||i}-${t.label}-${o}`)})]},`${n.title}-${s.heading||i}`))})]})})}function T(n){return e.jsxs(y,{withBorder:!0,p:"md",children:[e.jsx(a,{size:"xs",c:"dimmed",tt:"uppercase",fw:600,mb:6,style:{letterSpacing:"0.04em"},children:n.title}),e.jsx($,{section:n}),n.note&&e.jsx(a,{size:"xs",c:"dimmed",mt:"sm",children:n.note})]},n.title)}function K(n,r){const i=n.standingsImpact.groups.find(t=>t.heading===r)?.rows.find(t=>t.label==="Change");if(i){const t=[];return n.standingsImpact.columns.forEach((o,d)=>{if(o==="Total"||o==="Rank")return;const l=i.cells[d],c=l?v(l):null;l&&c!==null&&c>=.05&&t.push({cat:o,text:l,tone:i.cellTones?.[d],mag:c})}),t.sort((o,d)=>d.mag-o.mag)}for(const t of n.statsImpact){const d=t.groups.find(c=>c.heading===r)?.rows.find(c=>c.label==="Change");if(!d)continue;const l=[];if(t.columns.forEach((c,m)=>{if(!/PTS$/.test(c)||c==="Total PTS")return;const p=d.cells[m],u=p?v(p):null;p&&u!==null&&u>=.05&&l.push({cat:c.replace(" PTS",""),text:p,tone:d.cellTones?.[m],mag:u})}),l.length>0)return l.sort((c,m)=>m.mag-c.mag)}return[]}function C({label:n,before:r,after:s,deltaText:i,deltaColor:t}){return e.jsxs(x,{gap:6,wrap:"nowrap",children:[e.jsx(a,{size:"9px",tt:"uppercase",c:"dimmed",fw:700,style:{letterSpacing:"0.05em"},children:n}),e.jsxs(a,{size:"sm",fw:600,style:{fontVariantNumeric:"tabular-nums"},children:[r," ",e.jsx(a,{span:!0,c:"dimmed",children:"â"})," ",s]}),e.jsx(a,{size:"sm",fw:700,c:t,style:{minWidth:30,textAlign:"right"},children:i})]})}function Q({payload:n,status:r,index:s}){const i=K(n,r.name),t=r.beforeRank-r.afterRank,o=typeof r.beforePoints=="number"&&typeof r.afterPoints=="number",d=o?r.afterPoints-r.beforePoints:0;return e.jsxs(x,{justify:"space-between",wrap:"wrap",gap:"xs",align:"center",style:{padding:"8px 2px",borderTop:s===0?void 0:"1px solid var(--mantine-color-default-border)"},children:[e.jsxs(x,{gap:"md",wrap:"wrap",style:{minWidth:0,flex:"1 1 300px",rowGap:3},children:[e.jsx(a,{fw:700,size:"sm",style:{flexShrink:0},children:r.name}),i.length>0&&e.jsx(x,{gap:12,wrap:"wrap",style:{rowGap:2},children:i.map(l=>e.jsxs(a,{size:"xs",style:{fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap"},children:[e.jsx(a,{span:!0,c:"dimmed",fw:600,children:l.cat})," ",e.jsx(a,{span:!0,c:P(l.tone)||"dimmed",fw:700,children:l.text})]},l.cat))})]}),e.jsxs(x,{gap:"lg",wrap:"wrap",style:{maxWidth:"100%"},children:[e.jsx(C,{label:"Rank",before:`${r.beforeRank}`,after:`${r.afterRank}`,deltaText:t===0?"â":`${t>0?"â":"â"}${Math.abs(t)}`,deltaColor:t>0?"green":t<0?"red":"dimmed"}),o&&e.jsx(C,{label:n.summary.pointsLabel==="Standings Pts"?"Std Pts":n.summary.pointsLabel,before:r.beforePoints.toFixed(1),after:r.afterPoints.toFixed(1),deltaText:Math.abs(d)<.05?"â":`${d>0?"+":""}${d.toFixed(1)}`,deltaColor:Math.abs(d)<.05?"dimmed":d>0?"green":"red"})]})]})}function X({payload:n,afterSummary:r}){const s=n.summary,i=[s.teamAStatus,s.teamBStatus].filter(t=>!!t);return i.length===0&&s.beforeRank!==void 0&&s.afterRank!==void 0&&s.beforePoints!==void 0&&s.afterPoints!==void 0&&i.push({name:s.teamAName,beforeRank:s.beforeRank,afterRank:s.afterRank,beforePoints:s.beforePoints,afterPoints:s.afterPoints}),e.jsxs(f,{gap:"md",children:[e.jsxs(y,{withBorder:!0,p:"lg",children:[e.jsxs(j,{mb:"md",children:[e.jsx(B,{order:2,children:n.leagueName}),e.jsxs(x,{gap:"xs",mt:6,children:[e.jsx(z,{variant:"light",children:n.scoringFormat}),e.jsx(z,{variant:"outline",children:"Trade Analyzer Snapshot"})]}),n.projectionsSource&&e.jsxs(a,{size:"sm",c:"dimmed",mt:6,children:["Projections: ",n.projectionsSource]})]}),e.jsxs(x,{gap:"xl",align:"flex-start",wrap:"wrap",children:[e.jsxs(j,{miw:240,children:[e.jsxs(a,{size:"sm",fw:700,mb:6,children:[s.teamAName," receives"]}),e.jsx(f,{gap:4,children:s.teamAReceives.map(t=>e.jsx(a,{size:"sm",children:t},`a-${t}`))})]}),e.jsxs(j,{miw:240,children:[e.jsxs(a,{size:"sm",fw:700,mb:6,children:[s.teamBName," receives"]}),e.jsx(f,{gap:4,children:s.teamBReceives.map(t=>e.jsx(a,{size:"sm",children:t},`b-${t}`))})]})]}),i.length>0&&e.jsx(f,{gap:0,mt:"md",children:i.map((t,o)=>e.jsx(Q,{payload:n,status:t,index:o},t.name))}),s.loanSummary&&e.jsx(a,{size:"sm",c:"dimmed",mt:4,children:s.loanSummary}),e.jsxs(x,{justify:"space-between",align:"center",mt:"sm",mb:4,children:[e.jsx(a,{size:"xs",c:"dimmed",tt:"uppercase",fw:600,style:{letterSpacing:"0.04em"},children:n.standingsImpact.title}),e.jsx(a,{size:"10px",c:"dimmed",children:"change vs. before trade"})]}),e.jsx($,{section:n.standingsImpact,tintChanges:!0}),n.standingsImpact.note&&e.jsx(a,{size:"xs",c:"dimmed",mt:"sm",children:n.standingsImpact.note})]}),r,n.tradedPlayerStats.map(T),n.statsImpact.map(T),n.lineupChanges&&n.lineupChanges.length>0&&e.jsxs(y,{withBorder:!0,p:"md",children:[e.jsx(a,{size:"xs",c:"dimmed",tt:"uppercase",fw:600,mb:"sm",style:{letterSpacing:"0.04em"},children:"Projected Lineup Changes"}),e.jsx(f,{gap:"md",children:n.lineupChanges.map(t=>e.jsxs(j,{children:[e.jsx(a,{fw:600,mb:6,children:t.teamName}),t.items.length>0?e.jsx(f,{gap:4,children:t.items.map(o=>e.jsx(a,{size:"sm",children:o},`${t.teamName}-${o}`))}):e.jsx(a,{size:"sm",c:"dimmed",children:"No projected lineup changes"})]},t.teamName))})]})]})}function se(){const{snapshotId:n}=M(),{session:r}=_(),s=G(),[i,t]=b.useState(!0),[o,d]=b.useState(null),[l,c]=b.useState(null);b.useEffect(()=>{let u=!1;async function R(){if(!n){c("Missing trade snapshot id."),t(!1);return}const{data:k,error:A}=await O.from("shared_trade_snapshots").select("payload").eq("id",n).maybeSingle();if(!u){if(A||!k?.payload){c("That trade snapshot could not be found."),t(!1);return}d(k.payload),t(!1)}}return R(),()=>{u=!0}},[n]);const m=u=>{if(D({feature:"/trade-analyzer",platform:null,source:u,signedIn:!!r}),r){s("/trade-analyzer");return}H(`/league-setup?next=${encodeURIComponent("/trade-analyzer")}`),s("/login?mode=signup")},p=e.jsxs(y,{withBorder:!0,p:"lg",style:{borderLeft:"3px solid var(--mantine-color-blue-5)"},children:[e.jsx(a,{fw:700,mb:4,children:"Analyze trades in your own league"}),e.jsx(a,{size:"sm",c:"dimmed",mb:"md",maw:640,children:"This snapshot came from RotoHound's free Trade Analyzer. Import your league from Yahoo, ESPN, CBS, Fantrax, Ottoneu, NFBC, or another platform, and it scores any trade in projected standings points under your league's exact scoring format. Free for the 2026 season."}),e.jsx(x,{gap:"sm",children:r?e.jsx(g,{onClick:()=>m("shared_trade"),children:"Open Trade Analyzer"}):e.jsxs(e.Fragment,{children:[e.jsx(g,{onClick:()=>m("shared_trade"),children:"Get started free"}),e.jsx(g,{component:S,to:"/features/trade-analyzer",variant:"default",children:"See how it works"})]})})]});return e.jsx(L,{size:"xl",py:"xl",children:e.jsxs(f,{gap:"lg",children:[e.jsxs(x,{justify:"space-between",align:"center",wrap:"wrap",children:[e.jsxs(j,{children:[e.jsx("style",{children:` 2 html:not([data-mantine-color-scheme="dark"]) .theme-dark, 3 [data-mantine-color-scheme="dark"] .theme-light { display: none !important; } 4 `}),e.jsxs(F,{component:S,to:"/",style:{display:"inline-flex",alignItems:"center",gap:8,textDecoration:"none"},children:[e.jsx(W,{height:34}),e.jsxs(a,{fw:600,size:"md",style:{letterSpacing:.75},children:[e.jsx("span",{style:{color:"light-dark(#1B1F24, #E6E9ED)"},children:"Roto"}),e.jsx("span",{style:{color:"#B22234"},children:"Hound"})]})]})]}),!i&&!r&&e.jsx(g,{size:"xs",variant:"default",onClick:()=>m("shared_trade"),children:"Sign up free"})]}),i&&e.jsx(w,{py:"xl",children:e.jsx(I,{})}),!i&&l&&e.jsx(E,{color:"red",title:"Snapshot unavailable",children:l}),!i&&o&&e.jsx(X,{payload:o,afterSummary:p}),!i&&o&&e.jsx(w,{pt:"xs",children:e.jsxs(f,{gap:6,align:"center",children:[e.jsx(a,{size:"sm",c:"dimmed",children:r?"Score a trade like this one in your own league.":"RotoHound is free for the 2026 season."}),e.jsx(g,{variant:"light",onClick:()=>m("shared_trade_bottom"),children:r?"Open Trade Analyzer":"Get started free"})]})}),!i&&l&&e.jsx(w,{pt:"md",children:e.jsx(g,{component:S,to:"/",variant:"light",children:"Try RotoHound"})}),!i&&!o&&!l&&e.jsx(a,{c:"dimmed",ta:"center",children:"This trade snapshot is empty."})]})})}export{se as SharedTradePage};
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.