1import{r as i,a as pe,d as ve,j as e,B as we,I as je}from"./index-Ba4BgsO5.js";import{h as Y,T as Z,a as K,F as J,P as be}from"./PlayerDetailsDialog-BbCzrYin.js";import{Y as X}from"./YouTubePlayIcon-B2nWFaC_.js";import{P as ee}from"./plus-BbQBPcW1.js";import{G as Ne}from"./grip-vertical-BlgxowHx.js";import{A as ke,a as ye,b as Se}from"./arrow-up-BrLn03xo.js";const Pe=y=>{const j=String(y.size||"").trim();if(j)return j;const L=String(y.height||"").trim(),B=String(y.weight||"").trim();return[L,B].filter(Boolean).join(" - ")||"-"},_e=i.forwardRef(function({playerDescriptions:j={},suppressOuterPadding:L=!1,hideHeader:B=!1,externalSearch:R,externalSelectedPosition:$,externalViewMode:T,externalIsEditing:z},te){const{data:u=[],isLoading:se,error:O}=pe({queryKey:["/api/players"],staleTime:3e5,gcTime:6e5,retry:3,refetchOnWindowFocus:!1});O&&console.error("MyBigBoard: Error fetching prospects:",O),i.useMemo(()=>j,[j]);const[F,re]=i.useState(""),[E,ae]=i.useState("All"),[ne,De]=i.useState("cards"),[Ce,ie]=i.useState(!1),[oe,le]=i.useState(!1),[Le,S]=i.useState(!1),[d,A]=i.useState([]),[c,f]=i.useState(null),[p,g]=i.useState(null),[ce,de]=i.useState(null),[ge,xe]=i.useState(!1),[P,he]=i.useState("rank"),[b,q]=i.useState("asc"),{myBigBoardOrder:M,updateMyBigBoardOrder:_,saveMyBigBoardOrder:me,user:H}=ve(),I=R!==void 0?R:F,Q=$!==void 0?$:E,W=T!==void 0?T:ne,l=z!==void 0?z:oe;i.useImperativeHandle(te,()=>({save:async()=>{if(!H)return!1;S(!0);try{d.length>0&&_(d);const t=await me();return setTimeout(()=>S(!1),2e3),t}catch(t){return console.error("Failed to save custom board:",t),S(!1),!1}},reset:()=>{if(!u.length)return;const t=u.map((s,r)=>({...s,displayRank:r+1,rank:r+1}));A(t),_(t)}})),i.useEffect(()=>{const t=()=>{console.log("MyBigBoard: Login event received, refreshing state"),window.location.reload()},s=()=>{console.log("MyBigBoard: Logout event received, resetting state"),ie(!1),le(!1),S(!1),window.location.reload()};return document.addEventListener("globalLogin",t),document.addEventListener("loginStatusChanged",t),document.addEventListener("globalLogout",s),document.addEventListener("loginStatusChanged",s),()=>{document.removeEventListener("globalLogin",t),document.removeEventListener("loginStatusChanged",t),document.removeEventListener("globalLogout",s),document.removeEventListener("loginStatusChanged",s)}},[]),i.useEffect(()=>{if(u.length>0){let t;const s=new Map(u.map(r=>[r.id,r]));M.length>0?t=M.map((r,a)=>({...s.get(r.id)||{},...r,displayRank:a+1})):t=[...u].sort((a,n)=>(a.rank||999)-(n.rank||999)).map((a,n)=>({...a,displayRank:n+1})),A(t)}},[u,M]);const U=["All","QB","RB","WR","TE","OT","OG","OC","DT","ED","LB","CB","SF"],ue=t=>{const s=parseFloat(t);if(!isNaN(s))return s>=90?"bg-teal-600/70":s>=80?"bg-green-600/70":s>=70?"bg-yellow-600/70":s>=60?"bg-orange-500/70":"bg-red-600/70";switch(t){case"A":return"bg-teal-600/70";case"A-":return"bg-teal-700/70";case"B+":return"bg-green-500/70";case"B":return"bg-green-600/70";case"B-":return"bg-yellow-500/70";
1case"C+":return"bg-yellow-600/70";case"C":return"bg-orange-500/70";case"C-":return"bg-red-600/70";default:return"bg-gray-600/70"}},fe=t=>{const s=t.position.substring(0,2),a=d.filter(n=>n.position.substring(0,2)===s).sort((n,v)=>n.displayRank-v.displayRank).findIndex(n=>n.id===t.id);return`${s}${a+1}`},G=i.useMemo(()=>d.filter(s=>{const r=I===""||s.name.toLowerCase().includes(I.toLowerCase())||s.college.toLowerCase().includes(I.toLowerCase()),a=Q==="All"||s.position&&s.position.substring(0,2)===Q;return r&&a}).sort((s,r)=>{let a,n;switch(P){case"rank":a=s.displayRank,n=r.displayRank;break;case"position":const v=s.position||"",m=r.position||"",N=v.match(/^([A-Z]+)(\d*)$/),k=m.match(/^([A-Z]+)(\d*)$/);if(N&&k){const[,D,C]=N,[,o,w]=k;D!==o?(a=D,n=o):(a=parseInt(C||"0",10),n=parseInt(w||"0",10))}else a=v,n=m;break;case"name":a=s.name||"",n=r.name||"";break;case"college":a=s.college||"",n=r.college||"";break;case"age":a=parseFloat(s.age||s.draftDayAge)||0,n=parseFloat(r.age||r.draftDayAge)||0;break;case"size":a=s.size||"",n=r.size||"";break;case"grade":a=s.grade2025||s.grade2024||"",n=r.grade2025||r.grade2024||"";break;case"athleticScore":a=parseFloat(s.athleticScore)||0,n=parseFloat(r.athleticScore)||0;break;default:a=s.displayRank,n=r.displayRank}return a<n?b==="asc"?-1:1:a>n?b==="asc"?1:-1:0}),[d,F,E,R,$,P,b]),x=t=>{P===t?q(b==="asc"?"desc":"asc"):(he(t),q("asc"))},h=({field:t})=>P!==t?e.jsx(ke,{className:"ml-1 h-3 w-3 inline opacity-50"}):b==="asc"?e.jsx(ye,{className:"ml-1 h-3 w-3 inline text-blue-400"}):e.jsx(Se,{className:"ml-1 h-3 w-3 inline text-blue-400"}),V=(t,s)=>{const r=d.find(o=>o.id===t),a=d.find(o=>o.id===s);if(!r||!a){console.log("Could not find dragged or target player");return}const n=r.displayRank,v=a.displayRank;console.log(`Swapping player ${t} (${r.name}, rank ${n}) with player ${s} (${a.name}, rank ${v})`);const m=[...d].sort((o,w)=>o.displayRank-w.displayRank),N=m.findIndex(o=>o.id===t),k=m.findIndex(o=>o.id===s);if(N===-1||k===-1)return;const[D]=m.splice(N,1);m.splice(k,0,D);const C=m.map((o,w)=>({...o,displayRank:w+1,rank:w+1}));A(C),_(C)};return se?e.jsx("div",{className:"space-y-4",children:e.jsx("div",{className:"text-center text-white",children:"Loading players..."})}):H?e.jsxs("div",{className:`bg-gray-800 max-w-full overflow-hidden ${L?"pb-4":"p-4"}`,children:[!B&&e.jsx("div",{className:"mb-4 space-y-3 max-w-7xl mx-auto",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"flex border-2 border-gray-400 rounded-lg overflow-hidden bg-gray-600 flex-shrink-0",children:U.map((t,s)=>e.jsx("button",{onClick:()=>ae(t),className:`w-10 h-8 text-sm font-bold transition-colors ${s!==U.length-1?"border-r-2 border-gray-400":""} ${E===t?"bg-blue-600 text-white":"text-white hover:bg-gray-500"}`,children:t},t))}),e.jsx("div",{className:"relative w-full max-w-[225px] ml-auto",children:e.jsx(je,{type:"text",placeholder:"Search players...",value:F,onChange:t=>re(t.target.value),className:"pl-4 bg-gray-700 border-gray-600 text-white h-10 placeholder:text-gray-400"})})]})}),W==="cards"?e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-6 gap-2 max-w-7xl mx-auto",children:G.map((t,s)=>e.jsxs("div",{draggable:l,onDragStart:r=>{l&&(f(t.id),r.dataTransfer.effectAllowed="move")},onDragOver:r=>{!l||c===null||(r.preventDefault(),r.dataTransfer.dropEffect="move",p!==s&&g(s))},onDragLeave:r=>{l&&p===s&&g(null)},onDrop:r=>{r.preventDefault(),!(!l||c===null||c===t.id)&&(V(c,t.id),f(null),g(null))},onDragEnd:()=>{f(null),g(null)},className:`bg-slate-700 rounded-lg p-1.5 border border-slate-600 relative transition-all duration-200 w-full h-16 select-none touch-none flex flex-col ${c===t.id?"opacity-50 scale-105":""} ${p===s?"border-green-400 bg-slate-600":""} ${l?"cursor-grab active:cursor-grabbing hover:bg-slate-600":""}`,children:[e.jsxs("div",{className:"absolute top-0 right-0 z-10 flex flex-row items-center gap-1",children:[t.hqFavorite==="1"&&e.jsx("div",{title:"HQ Favorite Prospect",className:"",children:e.jsx("img",{src:Y,alt:"HQ Favorite",className:"h-6 w-6 object-contain"})}),e.jsxs("div",{className:"flex flex-row items-center gap-1 p-1",children:[t.hqUpgrade==="1"&&e.jsx("div",{title:"HQ Likes",className:"p-0.5",children:e.jsx(Z,{className:"h-3.5 w-3.5 text-green-400",strokeWidth:3.5})}),t.hqDowngrade==="1"&&e.jsx("div",{title:"HQ Dislikes",className:"p-0.5",children:e.jsx(K,{className:"h-3.5 w-3.5 text-red-500",strokeWidth:3.5})}),t.medical==="1"&&e.jsx("div",{title:"Medical Concerns",className:"bg-white rounded border border-red-500 p-0.5 hover:bg-gray-100 transition-colors",children:e.jsx(ee,{className:"h-3 w-3 text-red-500",strokeWidth:5})}),t.character==="1"&&e.jsx("div",{title:"Character Concerns",className:"p-0.5",children:e.jsx(J,{className:"h-3 w-3 text-red-500 fill-red-500"})})]})]}),e.jsxs("div",{className:"min-w-0 leading-[13px] space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-1 pr-9 text-white font-bold text-[11px] whitespace-nowrap overflow-hidden",children:[e.jsx("span",{className:"relative -left-1 w-7 shrink-0 text-right",children:t.displayRank}),e.jsx("span",{className:"truncate text-white font-bold",children:t.name})]}),e.jsxs("div",{className:"flex items-center gap-2 pl-8 pr-9 text-[11px] text-gray-300 min-w-0",children:[e.jsx("span",{className:"truncate",children:t.college}),e.jsx("span",{className:"shrink-0",children:Pe(t)})]}),e.jsxs("div",{className:"flex items-center gap-2 pl-8 pr-9 leading-none",children:[e.jsx("span",{className:"font-bold text-white text-xs",children:t.position}),e.jsx("a",{href:`https://www.youtube.com/results?search_query=${encodeURIComponent(t.name)}`,target:"_blank",rel:"noopener noreferrer",className:"relative top-[1px] inline-flex items-center translate-x-1 hover:scale-110 transition-transform",title:`Search YouTube for ${t.name}`,children:e.jsx(X,{className:"h-3 w-4"})})]})]})]},t.id))}):e.jsxs(e.Fragment,{children:[W==="list"&&e.jsx("div",{className:"max-w-7xl mx-auto bg-slate-800 rounded-lg border border-slate-700 overflow-hidden select-none touch-none",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("div",{className:"min-w-[1000px] p-2",children:[e.jsxs("div",{className:"grid grid-cols-[60px_80px_1.2fr_0.8fr_60px_120px_90px_120px_60px] gap-4 text-sm font-bold text-gray-300 border-b border-slate-600 pb-2 mb-2 items-center px-2",children:[e.jsxs("div",{className:"cursor-pointer hover:text-white transition-colors flex items-center justify-center",onClick:()=>x("rank"),children:["Rank ",e.jsx(h,{field:"rank"})]}),e.jsxs("div",{className:"cursor-pointer hover:text-white transition-colors flex items-center justify-center",onClick:()=>x("position"),children:["Position ",e.jsx(h,{field:"position"})]}),e.jsxs("div",{className:"cursor-pointer hover:text-white transition-colors flex items-center",onClick:()=>x("name"),children:["Player ",e.jsx(h,{field:"name"})]}),e.jsxs("div",{className:"cursor-pointer hover:text-white transition-colors flex items-center justify-center",onClick:()=>x("college"),children:["College ",e.jsx(h,{field:"college"})]}),e.jsxs("div",{className:"cursor-pointer hover:text-white transition-colors flex items-center justify-center",onClick:()=>x("age"),children:["Age ",e.jsx(h,{field:"age"})]}),e.jsxs("div",{className:"cursor-pointer hover:text-white transition-colors flex items-center justify-center",onClick:()=>x("size"),children:["Size ",e.jsx(h,{field:"size"})]}),e.jsxs("div",{className:"cursor-pointer hover:text-white transition-colors flex items-center justify-center whitespace-nowrap",onClick:()=>x("grade"),children:["2027 Grade ",e.jsx(h,{field:"grade"})]}),e.jsxs("div",{className:"cursor-pointer hover:text-white transition-colors flex items-center justify-center whitespace-nowrap",onClick:()=>x("athleticScore"),children:["Athletic Score ",e.jsx(h,{field:"athleticScore"})]}),e.jsx("div",{className:"text-center",children:"Highlights"})]}),G.map((t,s)=>e.jsxs("div",{draggable:l,onDragStart:r=>{l&&(f(t.id),r.dataTransfer.effectAllowed="move")},onDragOver:r=>{!l||c===null||(r.preventDefault(),r.dataTransfer.dropEffect="move",p!==s&&g(s))},onDragLeave:()=>{l&&p===s&&g(null)},onDrop:r=>{r.preventDefault(),!(!l||c===null||c===t.id)&&(V(c,t.id),f(null),g(null))},onDragEnd:()=>{f(null),g(null)},className:`grid grid-cols-[60px_80px_1.2fr_0.8fr_60px_120px_90px_120px_60px] gap-4 text-sm py-1.5 border-b border-slate-700 last:border-b-0 hover:bg-slate-700 items-center px-2 transition-colors ${l?"curs
1or-grab active:cursor-grabbing":""} ${c===t.id?"opacity-50":""} ${p===s?"bg-slate-600 border-green-400":""}`,children:[e.jsxs("div",{className:"flex items-center justify-center gap-1 text-white font-bold text-sm",children:[l&&e.jsx(Ne,{className:"h-3.5 w-3.5 text-gray-400 shrink-0","aria-label":"Drag to reorder"}),t.displayRank]}),e.jsx("div",{className:"flex justify-center",children:e.jsx("span",{className:"text-white font-medium text-sm",children:fe(t)})}),e.jsxs("div",{className:"text-white font-medium text-sm flex min-w-0 items-center gap-1.5",children:[e.jsx("span",{className:"truncate",children:t.name}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[t.hqFavorite==="1"&&e.jsx("div",{title:"HQ Favorite Prospect",className:"p-0.5",children:e.jsx("img",{src:Y,alt:"HQ Favorite",className:"h-6 w-6 object-contain"})}),t.hqUpgrade==="1"&&e.jsx("div",{title:"HQ Likes",className:"p-0.5",children:e.jsx(Z,{className:"h-3.5 w-3.5 text-green-400 flex-shrink-0",strokeWidth:3.5})}),t.hqDowngrade==="1"&&e.jsx("div",{title:"HQ Dislikes",className:"p-0.5",children:e.jsx(K,{className:"h-3.5 w-3.5 text-red-500 flex-shrink-0",strokeWidth:3.5})}),t.medical==="1"&&e.jsx("div",{title:"Medical Concerns",className:"bg-white rounded border border-red-500 p-0.5 hover:bg-gray-100 transition-colors",children:e.jsx(ee,{className:"h-3 w-3 text-red-500 flex-shrink-0",strokeWidth:5})}),t.character==="1"&&e.jsx("div",{title:"Character Concerns",className:"p-0.5",children:e.jsx(J,{className:"h-3 w-3 text-red-500 fill-red-500 flex-shrink-0"})})]})]}),e.jsx("div",{className:"text-gray-300 font-medium truncate text-sm text-center",children:t.college}),e.jsx("div",{className:"text-gray-300 font-medium text-sm text-center",children:t.age||t.draftDayAge||"-"}),e.jsx("div",{className:"text-gray-300 font-medium text-sm text-center",children:t.size||(t.height&&t.weight?`${t.height} - ${t.weight}`:"-")}),e.jsx("div",{className:"flex justify-center",children:t.grade2025||t.grade2024?e.jsx("div",{className:`px-2 py-0.5 rounded text-white font-bold text-sm ${ue(t.grade2025||t.grade2024)}`,children:t.grade2025||t.grade2024}):e.jsx("span",{className:"text-gray-400 text-sm",children:"-"})}),e.jsx("div",{className:"flex justify-center",children:t.athleticScore?e.jsx("div",{className:`px-2 py-0.5 rounded text-white font-bold text-sm ${parseFloat(t.athleticScore)>=8?"bg-green-600":parseFloat(t.athleticScore)<5?"bg-red-600":"bg-yellow-600"}`,children:t.athleticScore}):e.jsx("span",{className:"text-gray-400 text-sm",children:"-"})}),e.jsx("div",{className:"flex justify-center",children:e.jsx("a",{href:`https://www.youtube.com/results?search_query=${encodeURIComponent(t.name)}`,target:"_blank",rel:"noopener noreferrer",className:"relative top-[1px] hover:scale-125 transition-transform",title:`Search YouTube for ${t.name}`,children:e.jsx(X,{className:"h-4 w-5"})})})]},t.id))]})})}),e.jsx("div",{className:"h-4"})," "]}),e.jsx(be,{player:ce,open:ge,onOpenChange:t=>{xe(t),t||de(null)},showDraftBuzzLink:!0})]}):e.jsx("div",{className:"min-h-screen bg-gray-800 flex justify-center p-6 pt-[100px]",children:e.jsxs("div",{className:"max-w-4xl text-center space-y-4",children:[e.jsx("h2",{className:"text-xl font-bold text-white whitespace-nowrap",children:"Log in or create a free Login to create your own NFL Draft Big Board."}),e.jsx("p",{className:"text-lg text-gray-300",children:"We will provide all of our players and you organize them accordingly."}),e.jsx("div",{className:"pt-4",children:e.jsx(we,{variant:"destructive",size:"lg",onClick:()=>{var t;return(t=window.openLoginDialog)==null?void 0:t.call(window)},className:"font-bold px-8",children:"Free Login"})})]})})});export{_e as default};
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.