PageSourceSearch

https://faf.co.ao/assets/AdminPlayers-BRNUEEvo.js

js faf.co.ao collected 2026-10-02 19:09:57 UTC 22,479 bytes, 1 lines download raw bytes

1import{r as P,s as O,t as K,j as e,b as T,L as se}from"./vendor-react-core-_0sZDOLQ.js";import{B as f,b as C,c as re}from"./index-j07E1qHv.js";import{I as q}from"./input-rti45mgP.js";import{C as V,b as te,c as le,a as J}from"./card-DHmBnTdH.js";import{t as g}from"./index-CDqomOa1.js";import{D as ie,a as ne,b as oe,c as ce,d as de,e as me}from"./dialog-C9ty4md6.js";import{L as _}from"./label-7HT5__eZ.js";import{S as D,a as B,b as Q,c as U,d as t}from"./select-DHshRvNJ.js";import{S as ue}from"./scroll-area-BgfaAh_s.js";import{ab as H,aj as $,X as he,L as k,ak as W,y as G,al as xe,i as ge,a1 as pe,U as z,S as R,a2 as je,Q as fe}from"./vendor-lucide-Ddz0eB7N.js";import{u as ye}from"./playerPhotoUpload-CFYZxVol.js";import{m as be}from"./vendor-framer-motion-C1oRD-X5.js";import"./vendor-radix-CFmJ1img.js";import"./vendor-utils-BRu4i-LD.js";import"./vendor-supabase-Ca6cp8v2.js";function ve(){const[F,m]=P.useState(!1),[y,b]=P.useState("single"),[h,v]=P.useState(!1),[l,N]=P.useState(0),x=O(),[d,j]=P.useState({name:"",position:"",current_club:"",jersey_number:"",team_type:"principal",photo_url:""}),[u,s]=P.useState([]),o=()=>{j({name:"",position:"",current_club:"",jersey_number:"",team_type:"principal",photo_url:""}),s([]),N(0),b("single")},c=K({mutationFn:async a=>await C.entities.Player.create(a),onSuccess:()=>{x.invalidateQueries({queryKey:["players"]}),x.invalidateQueries({queryKey:["admin-players"]}),x.invalidateQueries({queryKey:["admin-players-count"]}),x.invalidateQueries({queryKey:["player"]}),x.invalidateQueries({queryKey:["player-stats"]}),x.invalidateQueries({queryKey:["player-transfers"]})},onError:a=>{g.error("Erro ao adicionar jogador: "+a.message)}}),A=async a=>{const r=a.target.files[0];if(r){v(!0);try{const{url:n}=await C.storage.upload(r);j(i=>({...i,photo_url:n})),g.success("Foto carregada com sucesso!")}catch(n){g.error("Erro ao carregar foto: "+n.message)}finally{v(!1)}}},E=async a=>{const r=Array.from(a.target.files);if(!r.length)return;v(!0);const n=[];for(const i of r)try{const{url:w}=await C.storage.upload(i),M=i.name.replace(/\.(jpg|jpeg|png|webp|gif)$/i,"").replace(/[-_]/g," ").replace(/\b\w/g,ae=>ae.toUpperCase());n.push({id:Date.now()+Math.random(),photo_url:w,name:M,position:"",current_club:"",jersey_number:"",team_type:"principal",saved:!1})}catch(w){g.error(`Erro ao carregar ${i.name}: ${w.message}`)}s(i=>[...i,...n]),v(!1),g.success(`${n.length} foto(s) carregada(s) com sucesso!`)},L=(a,r,n)=>{s(i=>{const w=[...i];return w[a]={...w[a],[r]:n},w})},X=a=>{s(r=>r.filter((n,i)=>i!==a)),l>=u.length-1&&l>0&&N(l-1)},Y=async a=>{const r=u[a];if(!r.name){g.error("O nome é obrigatório");return}try{await c.mutateAsync({name:r.name,position:r.position,current_club:r.current_club,jersey_number:r.jersey_number,team_type:r.team_type,photo_url:r.photo_url}),s(n=>{const i=[...n];return i[a]={...i[a],saved:!0},i}),g.success(`${r.name} guardado com sucesso!`),a<u.length-1&&N(a+1)}catch{}},Z=async()=>{if(u.filter(n=>!n.saved&&n.name).length===0){g.error("Nenhum jogador para guardar. Preencha os nomes.");return}let r=0;for(let n=0;n<u.length;n++){const i=u[n];if(!i.saved&&i.name)try{await c.mutateAsync({name:i.name,position:i.position,current_club:i.current_club,jersey_number:i.jersey_number,team_type:i.team_type,photo_url:i.photo_url}),s(w=>{const M=[...w];return M[n]={...M[n],saved:!0},M}),r++}catch{}}g.success(`${r} jogador(es) guardado(s) com sucesso!`)},ee=a=>{if(a.preventDefault(),!d.name){g.error("O nome é obrigatório");return}c.mutate(d,{onSuccess:()=>{g.success("Jogador adicionado com sucesso!"),m(!1),o()}})},p=u[l],I=u.filter(a=>a.saved).length,S=u.length;return e.jsxs(ie,{open:F,onOpenChange:a=>{m(a),a||o()},children:[e.jsx(ne,{asChild:!0,children:e.jsxs(f,{className:"bg-gradient-to-r from-red-600 to-yellow-500 hover:from-red-700 hover:to-yellow-600 text-white shadow-lg border-none",children:[e.jsx(H,{className:"w-4 h-4 mr-2"}),"Adicionar Jogador"]})}),e.jsxs(oe,{className:"sm:max-w-[700px] max-h-[90vh] bg-white rounded-2xl border-none shadow-2xl",children:[e.jsx(ce,{children:e.jsx(de,{className:"text-2xl font-bold text-gray-900",children:y==="single"?"Novo Jogador":`Importar Fotos em Lote (${I}/${S})`})}),e.jsxs("div",{className:"flex gap-2 mb-4",children:[e.jsxs(f,{variant:y==="single"?"default":"outline",onClick:()=>b("single"),className:y==="single"?"bg-red-600 hover:bg-red-700":"",children:[e.jsx(H,{className:"w-4 h-4 mr-2"}),"Individual"]}),e.jsxs(f,{variant:y==="batch"?"default":"outline",onClick:()=>b("batch"),className:y==="batch"?"bg-red-600 hover:bg-red-700":"",children:[e.jsx($,{className:"w-4 h-4 mr-2"}),"Várias Fotos"]})]}),y==="single"?e.jsxs("form",{onSubmit:ee,className:"space-y-6 py-4",children:[e.jsx("div",{className:"flex flex-col items-center justify-center space-y-4",children:e.jsxs("div",{className:"relative group",children:[e.jsx("div",{className:"w-32 h-32 rounded-2xl bg-gray-100 border-2 border-dashed border-gray-300 flex items-center justify-center overflow-hidden transition-all group-hover:border-red-500",children:d.photo_url?e.jsxs(e.Fragment,{children:[e.jsx("img",{src:d.photo_url,alt:"Preview",className:"w-full h-full object-cover"}),e.jsx("button",{type:"button",onClick:()=>j(a=>({...a,photo_url:""})),className:"absolute top-1 right-1 bg-red-500 text-white rounded-full p-1 opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx(he,{className:"w-3 h-3"})})]}):e.jsx("div",{className:"text-center p-4",children:h?e.jsx(k,{className:"w-8 h-8 animate-spin text-gray-400 mx-auto"}):e.jsxs(e.Fragment,{children:[e.jsx(W,{className:"w-8 h-8 text-gray-400 mx-auto mb-2"}),e.jsx("span",{className:"text-xs text-gray-500",children:"Carregar Foto"})]})})}),e.jsx("input",{type:"file",accept:"image/*",onChange:A,className:"absolute inset-0 opacity-0 cursor-pointer",disabled:h})]})}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"col-span-2 space-y-2",children:[e.jsx(_,{htmlFor:"name",children:"Nome Completo"}),e.jsx(q,{id:"name",placeholder:"Ex: Gilberto Macandza",value:d.name,onChange:a=>j(r=>({...r,name:a.target.value})),className:"bg-gray-50 border-gray-200 focus:ring-red-500"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(_,{htmlFor:"position",children:"Posição"}),e.jsxs(D,{onValueChange:a=>j(r=>({...r,position:a})),value:d.position,children:[e.jsx(B,{className:"bg-gray-50 border-gray-200",children:e.jsx(Q,{placeholder:"Selecione..."})}),e.jsxs(U,{children:[e.jsx(t,{value:"Guarda-redes",children:"Guarda-redes"}),e.jsx(t,{value:"Defesa",children:"Defesa"}),e.jsx(t,{value:"Médio",children:"Médio"}),e.jsx(t,{value:"Avançado",children:"Avançado"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(_,{htmlFor:"jersey",children:"Número da Camisola"}),e.jsx(q,{id:"jersey",type:"text",placeholder:"Ex: 7",value:d.jersey_number,onChange:a=>j(r=>({...r,jersey_number:a.target.value})),className:"bg-gray-50 border-gray-200"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(_,{htmlFor:"club",children:"Clube Atual"}),e.jsx(q,{id:"club",placeholder:"Ex: Petro de Luanda",value:d.current_club,onChange:a=>j(r=>({...r,current_club:a.target.value})),className:"bg-gray-50 border-gray-200"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(_,{htmlFor:"team_type",children:"Tipo de Seleção"}),e.jsxs(D,{onValueChange:a=>j(r=>({...r,team_type:a})),value:d.team_type,children:[e.jsx(B,{className:"bg-gray-50 border-gray-200",children:e.jsx(Q,{placeholder:"Selecione..."})}),e.jsxs(U,{children:[e.jsx(t,{value:"principal",children:"Palancas Negras (Principal)"}),e.jsx(t,{value:"sub23",children:"Sub-23"}),e.jsx(t,{value:"sub20",children:"Sub-20"}
1),e.jsx(t,{value:"sub17",children:"Sub-17"}),e.jsx(t,{value:"feminina",children:"Feminina (Principal)"}),e.jsx(t,{value:"feminina_sub20",children:"Feminina Sub-20"}),e.jsx(t,{value:"feminina_sub17",children:"Feminina Sub-17"}),e.jsx(t,{value:"praia_masculino",children:"Praia (Masculino)"}),e.jsx(t,{value:"praia_feminino",children:"Praia (Feminino)"}),e.jsx(t,{value:"futsal_masculino",children:"Futsal (Masculino)"}),e.jsx(t,{value:"futsal_feminino",children:"Futsal (Feminino)"}),e.jsx(t,{value:"staff",children:"Equipa Técnica"})]})]})]})]}),e.jsx(me,{children:e.jsx(f,{type:"submit",disabled:c.isPending||h,className:"w-full bg-gradient-to-r from-red-600 to-yellow-500 hover:from-red-700 hover:to-yellow-600 text-white h-12 text-lg font-bold",children:c.isPending?e.jsxs(e.Fragment,{children:[e.jsx(k,{className:"w-5 h-5 mr-2 animate-spin"}),"A Guardar..."]}):"Guardar Jogador"})})]}):e.jsx("div",{className:"space-y-4",children:u.length===0?e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"border-2 border-dashed border-gray-300 rounded-xl p-12 text-center hover:border-red-500 transition-colors cursor-pointer",children:h?e.jsx(k,{className:"w-12 h-12 animate-spin text-red-500 mx-auto mb-4"}):e.jsxs(e.Fragment,{children:[e.jsx($,{className:"w-12 h-12 text-gray-400 mx-auto mb-4"}),e.jsx("h3",{className:"text-lg font-semibold text-gray-800 mb-2",children:"Carregar Várias Fotos"}),e.jsxs("p",{className:"text-sm text-gray-500 mb-4",children:["Selecione múltiplas fotos de jogadores de uma vez.",e.jsx("br",{}),"Os nomes dos ficheiros serão usados como sugestão de nome."]}),e.jsx("span",{className:"text-xs text-gray-400",children:"JPG, PNG, WEBP"})]})}),e.jsx("input",{type:"file",accept:"image/*",multiple:!0,onChange:E,className:"absolute inset-0 opacity-0 cursor-pointer",disabled:h})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"bg-gray-50 rounded-xl p-3",children:e.jsx(ue,{className:"w-full",children:e.jsxs("div",{className:"flex gap-2 pb-2",children:[u.map((a,r)=>e.jsxs("button",{onClick:()=>N(r),className:`relative flex-shrink-0 w-16 h-16 rounded-lg overflow-hidden border-2 transition-all ${r===l?"border-red-500 ring-2 ring-red-200":a.saved?"border-green-500":"border-gray-200"}`,children:[e.jsx("img",{src:a.photo_url,alt:"",className:"w-full h-full object-cover"}),a.saved&&e.jsx("div",{className:"absolute inset-0 bg-green-500/30 flex items-center justify-center",children:e.jsx(G,{className:"w-6 h-6 text-white drop-shadow-lg"})}),!a.name&&!a.saved&&e.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-yellow-500 text-white text-[8px] text-center py-0.5",children:"Sem nome"})]},a.id)),e.jsxs("div",{className:"relative flex-shrink-0 w-16 h-16 rounded-lg border-2 border-dashed border-gray-300 flex items-center justify-center hover:border-red-500 transition-colors cursor-pointer",children:[e.jsx($,{className:"w-6 h-6 text-gray-400"}),e.jsx("input",{type:"file",accept:"image/*",multiple:!0,onChange:E,className:"absolute inset-0 opacity-0 cursor-pointer",disabled:h})]})]})})}),p&&e.jsxs("div",{className:"flex gap-6",children:[e.jsxs("div",{className:"flex-shrink-0",children:[e.jsxs("div",{className:"w-40 h-52 rounded-xl overflow-hidden bg-gray-100 relative",children:[e.jsx("img",{src:p.photo_url,alt:"",className:"w-full h-full object-cover"}),p.saved&&e.jsx("div",{className:"absolute top-2 right-2 bg-green-500 text-white rounded-full p-1",children:e.jsx(G,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"flex items-center justify-between mt-2",children:[e.jsx(f,{variant:"outline",size:"icon",onClick:()=>N(a=>Math.max(0,a-1)),disabled:l===0,children:e.jsx(xe,{className:"w-4 h-4"})}),e.jsxs("span",{className:"text-sm text-gray-600 font-medium",children:[l+1," / ",S]}),e.jsx(f,{variant:"outline",size:"icon",onClick:()=>N(a=>Math.min(S-1,a+1)),disabled:l===S-1,children:e.jsx(ge,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"flex-1 space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(_,{className:"text-xs",children:"Nome Completo *"}),e.jsx(q,{placeholder:"Nome do jogador",value:p.name,onChange:a=>L(l,"name",a.target.value),disabled:p.saved,className:"bg-gray-50 border-gray-200"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(_,{className:"text-xs",children:"Posição"}),e.jsxs(D,{onValueChange:a=>L(l,"position",a),value:p.position,disabled:p.saved,children:[e.jsx(B,{className:"bg-gray-50 border-gray-200",children:e.jsx(Q,{placeholder:"Selecione..."})}),e.jsxs(U,{children:[e.jsx(t,{value:"Guarda-redes",children:"Guarda-redes"}),e.jsx(t,{value:"Defesa",children:"Defesa"}),e.jsx(t,{value:"Médio",children:"Médio"}),e.jsx(t,{value:"Avançado",children:"Avançado"})]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(_,{className:"text-xs",children:"Nº Camisola"}),e.jsx(q,{placeholder:"Ex: 7",value:p.jersey_number,onChange:a=>L(l,"jersey_number",a.target.value),disabled:p.saved,className:"bg-gray-50 border-gray-200"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(_,{className:"text-xs",children:"Clube Atual"}),e.jsx(q,{placeholder:"Ex: Petro de Luanda",value:p.current_club,onChange:a=>L(l,"current_club",a.target.value),disabled:p.saved,className:"bg-gray-50 border-gray-200"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(_,{className:"text-xs",children:"Seleção"}),e.jsxs(D,{onValueChange:a=>L(l,"team_type",a),value:p.team_type,disabled:p.saved,children:[e.jsx(B,{className:"bg-gray-50 border-gray-200",children:e.jsx(Q,{placeholder:"Selecione..."})}),e.jsxs(U,{children:[e.jsx(t,{value:"principal",children:"Palancas Negras (Principal)"}),e.jsx(t,{value:"sub23",children:"Sub-23"}),e.jsx(t,{value:"sub20",children:"Sub-20"}
1),e.jsx(t,{value:"sub17",children:"Sub-17"}),e.jsx(t,{value:"feminina",children:"Feminina (Principal)"}),e.jsx(t,{value:"feminina_sub20",children:"Feminina Sub-20"}),e.jsx(t,{value:"feminina_sub17",children:"Feminina Sub-17"}),e.jsx(t,{value:"praia_masculino",children:"Praia (Masculino)"}),e.jsx(t,{value:"praia_feminino",children:"Praia (Feminino)"}),e.jsx(t,{value:"futsal_masculino",children:"Futsal (Masculino)"}),e.jsx(t,{value:"futsal_feminino",children:"Futsal (Feminino)"}),e.jsx(t,{value:"staff",children:"Equipa Técnica"})]})]})]})]}),e.jsx("div",{className:"flex gap-2 pt-2",children:p.saved?e.jsx("div",{className:"flex-1 bg-green-50 text-green-700 rounded-lg p-3 text-center font-medium",children:"✓ Jogador guardado com sucesso"}):e.jsxs(e.Fragment,{children:[e.jsxs(f,{onClick:()=>Y(l),disabled:c.isPending,className:"flex-1 bg-gradient-to-r from-red-600 to-yellow-500 hover:from-red-700 hover:to-yellow-600",children:[c.isPending?e.jsx(k,{className:"w-4 h-4 animate-spin mr-2"}):e.jsx(G,{className:"w-4 h-4 mr-2"}),"Guardar Este"]}),e.jsx(f,{variant:"outline",onClick:()=>X(l),className:"text-red-600 border-red-200 hover:bg-red-50",children:e.jsx(pe,{className:"w-4 h-4"})})]})})]})]}),e.jsxs("div",{className:"border-t pt-4 flex gap-3",children:[e.jsxs(f,{onClick:Z,disabled:c.isPending||I===S,className:"flex-1 bg-gradient-to-r from-green-600 to-emerald-600 hover:from-green-700 hover:to-emerald-700 h-12",children:[c.isPending?e.jsx(k,{className:"w-5 h-5 animate-spin mr-2"}):e.jsx(G,{className:"w-5 h-5 mr-2"}),"Guardar Todos (",S-I," restantes)"]}),I===S&&S>0&&e.jsx(f,{onClick:()=>{m(!1),o()},className:"bg-gray-800 hover:bg-gray-900 h-12",children:"Concluir"})]})]})})]})]})}function Ne(){const F=O(),{data:m}=T({queryKey:["admin-players"],queryFn:()=>C.entities.Player.list()}),y=K({mutationFn:async()=>{var b;console.log("[AI Organizer] A iniciar processamento automático...");try{const v=await(await fetch("/uploads/players_staging/metadata.json")).json();for(const l of v.staff){const N=l.fileName.replace(/\.(jpg|jpeg|png|webp)$/i,"").replace(/[,.]/g," ").replace(/\s+/g," ").trim(),x=m==null?void 0:m.find(d=>N.toLowerCase().includes(d.name.toLowerCase().split(" ")[0]));x?await C.entities.Player.update(x.id,{photo_url:l.targetUrl,team_type:"staff"}):await C.entities.Player.create({name:N,team_type:"staff",position:"Staff Técnico",photo_url:l.targetUrl})}for(const{folder:l,image:N,targetUrl:x}of v.players){const d=((b=l.split("_")[1])==null?void 0:b.trim())||l,j=m==null?void 0:m.find(u=>u.name.toLowerCase().includes(d.toLowerCase().split(" ")[0])||d.toLowerCase().includes(u.name.toLowerCase().split(" ")[0]));j&&await C.entities.Player.update(j.id,{photo_url:x})}console.log("[AI Organizer] Processamento concluído com sucesso."),F.invalidateQueries({queryKey:["admin-players"]})}catch(h){console.error("[AI Organizer] Erro ao processar metadados:",h)}}});return P.useEffect(()=>{const b=setTimeout(()=>{m&&m.length>0&&y.mutate()},5e3),h=setInterval(()=>{m&&m.length>0&&y.mutate()},3e5);return()=>{clearTimeout(b),clearInterval(h)}},[m]),null}function Qe(){const[F,m]=P.useState(""),[y,b]=P.useState(null),h=O(),{data:v}=T({queryKey:["current-user"],queryFn:()=>C.auth.me()}),{data:l,isLoading:N}=T({queryKey:["admin-players"],queryFn:async()=>(await C.entities.Player.list("-created_at",500)).sort((o,c)=>{const A=o.status==="retired"?1:0,E=c.status==="retired"?1:0;return A!==E?A-E:(o.name||"").localeCompare(c.name||"")}),initialData:[]}),x=K({mutationFn:async s=>(await C.functions.invoke("generatePlayerBio",{player_id:s})).data,onSuccess:s=>{g.success(s.message),h.invalidateQueries({queryKey:["admin-players"]})},onError:s=>{g.error("Erro ao gerar biografia: "+s.message)}}),d=K({mutationFn:({player:s,file:o})=>ye(s,o),onMutate:({player:s})=>{b(s.id)},onSuccess:(s,{player:o})=>{g.success(`Fotografia de ${o.name} carregada com sucesso!`),h.invalidateQueries({queryKey:["admin-players"]}),h.invalidateQueries({queryKey:["players"]}),h.invalidateQueries({queryKey:["player"]})},onError:s=>{g.error(`Erro ao carregar fotografia: ${s.message}`)},onSettled:()=>{b(null)}}),j=(s,o)=>{var A;const c=(A=o.target.files)==null?void 0:A[0];o.target.value="",c&&d.mutate({player:s,file:c})};if((v==null?void 0:v.role)!=="admin")return e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(z,{className:"w-20 h-20 text-red-600 mx-auto mb-4"}),e.jsx("h2",{className:"text-2xl font-bold text-gray-900 mb-2",children:"Acesso Negado"}),e.jsx("p",{className:"text-gray-600",children:"Apenas administradores podem aceder a esta área"})]})});const u=l.filter(s=>{var o,c;return((o=s.name)==null?void 0:o.toLowerCase().includes(F.toLowerCase()))||((c=s.current_club)==null?void 0:c.toLowerCase().includes(F.toLowerCase()))});return e.jsxs("main",{className:"min-h-screen bg-gray-50",children:[e.jsx("section",{className:"bg-gradient-to-br from-gray-900 via-gray-800 to-black py-20",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsx(be.div,{initial:{opacity:0,y:20}
1,animate:{opacity:1,y:0},children:e.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-6",children:[e.jsxs("div",{children:[e.jsx(z,{className:"w-16 h-16 mb-4 text-white"}),e.jsx("h1",{className:"text-4xl md:text-5xl font-bold mb-4 text-white",children:"Gestão de Jogadores"}),e.jsx("p",{className:"text-xl text-white/90",children:"Gerar biografias automáticas com IA"})]}),e.jsx(ve,{})]})})})}),e.jsx("section",{className:"py-12",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsxs(V,{className:"mb-8",children:[e.jsx(te,{children:e.jsxs(le,{className:"flex items-center gap-3",children:[e.jsx(R,{className:"w-6 h-6 text-yellow-500"}),"Geração Automática de Conteúdo"]})}),e.jsxs(J,{children:[e.jsx("p",{className:"text-gray-600 mb-4",children:"A IA irá pesquisar informações oficiais sobre cada jogador no site da FAF (faf.co.ao) e outras fontes desportivas confiáveis para gerar biografias detalhadas e precisas."}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[e.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),e.jsx("span",{children:"Fontes: faf.co.ao, cafonline.com e outras fontes verificadas"})]})]})]}),e.jsx(Ne,{}),e.jsx("div",{className:"mb-6",children:e.jsx(q,{placeholder:"Pesquisar jogadores...",value:F,onChange:s=>m(s.target.value),className:"max-w-md",icon:e.jsx(je,{className:"w-4 h-4"})})}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:u.map(s=>{var o;return e.jsx(V,{className:"hover:shadow-lg transition-shadow",children:e.jsxs(J,{className:"pt-6",children:[e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-gradient-to-br from-red-600 to-yellow-500 flex items-center justify-center text-white text-xl font-bold flex-shrink-0",children:s.photo_url?e.jsx("img",{src:s.photo_url,alt:s.name,className:"w-full h-full rounded-full object-cover"}):(o=s.name)==null?void 0:o.charAt(0)}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"font-bold text-gray-900 truncate",children:s.name}),e.jsx("p",{className:"text-sm text-gray-600",children:s.position}),e.jsx("p",{className:"text-xs text-gray-500 truncate",children:s.current_club||"Sem clube"}),s.bio&&e.jsxs("div",{className:"mt-2 flex items-center gap-1 text-xs text-green-600",children:[e.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),e.jsx("span",{children:"Bio gerada"})]})]})]}),e.jsxs("div",{className:"mt-4 flex gap-2",children:[e.jsx(se,{to:re(`PlayerDetail?id=${s.id}`),className:"flex-1",children:e.jsx(f,{variant:"outline",className:"w-full",size:"sm",children:"Ver Detalhes"})}),e.jsx(f,{onClick:()=>x.mutate(s.id),disabled:x.isPending,size:"sm",className:"bg-gradient-to-r from-purple-600 to-blue-600 hover:from-purple-700 hover:to-blue-700 text-white",children:x.isPending?e.jsx(k,{className:"w-4 h-4 animate-spin"}):e.jsxs(e.Fragment,{children:[e.jsx(R,{className:"w-4 h-4 mr-1"}),"Gerar Bio"]})})]}),e.jsx(f,{asChild:!0,variant:"outline",size:"sm",className:`mt-2 w-full cursor-pointer border-dashed ${d.isPending?"pointer-events-none opacity-50":""}`,children:e.jsxs("label",{"aria-disabled":d.isPending,children:[y===s.id?e.jsxs(e.Fragment,{children:[e.jsx(k,{className:"w-4 h-4 mr-2 animate-spin"}),"A carregar..."]}):e.jsxs(e.Fragment,{children:[s.photo_url?e.jsx(fe,{className:"w-4 h-4 mr-2"}):e.jsx(W,{className:"w-4 h-4 mr-2"}),s.photo_url?"Substituir fotografia":"Carregar fotografia"]}),e.jsx("input",{type:"file",accept:"image/jpeg,image/png,image/webp",className:"sr-only",disabled:d.isPending,onChange:c=>j(s,c)})]})})]})},s.id)})}),u.length===0&&e.jsxs("div",{className:"text-center py-12",children:[e.jsx(z,{className:"w-16 h-16 text-gray-400 mx-auto mb-4"}),e.jsx("p",{className:"text-gray-600",children:"Nenhum jogador encontrado"})]})]})})]})}export{Qe 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.