1import{j as e,d as s,bt as ue,w as ce,r as g,F as G,X as z,k as A,L as pe,bN as ye,b as _,h as E,v as oe,ap as J,T as he,g as C,q as X,E as be,N as ge,x as fe,a as Z,f as ee,U as je,m as ve,M as Ne}from"./index-k0AW3ROl.js";import{P as we}from"./LoadingSpinner-BPSZkdW1.js";import{e as se,g as ke,n as _e,f as Ce,k as te,l as Se,m as Re,j as Te}from"./contractPersistence-C0vox5UW.js";import{f as q}from"./currency-sRdnheTW.js";import{C as De}from"./copy-BiZqzAuK.js";import{C as W}from"./clock-BUcX_QcR.js";import{S as Pe}from"./shield-alert-D9Hangji.js";import{P as $e}from"./pen-jeyQ6bYX.js";import{S as Ae}from"./save-CXdYw2mt.js";import{S as ae}from"./scan-face-BvJjtkbS.js";import{P as ie}from"./package-BfhdAjyo.js";import{T as Le}from"./trending-up-DtDoxeGp.js";import{S as Ee}from"./StatusBadge-DHzmA3-J.js";import{i as Fe,A as Be}from"./AccessDeniedScreen-CO641g7s.js";import{P as Ie}from"./phone-Bjfd4nwr.js";import"./hourglass-Cu2HOMCR.js";import"./octagon-alert-kfrzQA7J.js";import"./upload-BBqF3Nyr.js";function Ue({schedule:a=[],currency:n="USD"}){if(!a.length)return null;const y=a.reduce((i,f)=>i+(f.amount||0),0);return e.jsxs("div",{className:"p-4",style:{background:`${s.colors.primary}06`,border:`1px solid ${s.colors.primary}20`,borderRadius:s.radius.md},children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(ue,{className:"w-4 h-4",style:{color:s.colors.primary}}),e.jsxs("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:s.colors.primary},children:["Payment schedule (",a.length,")"]})]}),e.jsx("div",{className:"space-y-1.5",children:a.map((i,f)=>e.jsxs("div",{className:"flex items-center justify-between gap-3 text-xs",children:[e.jsxs("span",{className:"truncate",style:{color:s.text.secondary},children:[i.label||i.payment_type," ⢠",i.scheduled_date]}),e.jsx("span",{className:"font-bold flex-shrink-0",style:{color:s.text.primary},children:q(i.amount,n)})]},f))}),e.jsxs("div",{className:"flex items-center justify-between gap-3 mt-3 pt-2 text-xs font-bold",style:{borderTop:"1px solid rgba(0,0,0,0.06)",color:s.text.primary},children:[e.jsx("span",{children:"Total scheduled"}),e.jsx("span",{children:q(y,n)})]})]})}function Oe({isOpen:a,onClose:n,talentId:y,talentName:i,defaultCurrency:f="USD",existingContracts:x=[],onSuccess:c}){const{organizationId:d}=ce(),[p,v]=g.useState(""),[m,u]=g.useState({...se(),currency:f}),[r,l]=g.useState(null),[t,o]=g.useState(null),[h,w]=g.useState(!1),[R,$]=g.useState(null),[L,H]=g.useState(!1),[F,B]=g.useState(null),[T,I]=g.useState(null);if(!a)return null;const V=async j=>{if(l(j),B(null),I(null),!!j)try{const P=await ye(j);B(P);const k=await _.entities.TalentContract.filter({organization_id:d,document_checksum:P},"-created_date",1);k!=null&&k.length&&I(k[0])}catch{}},{warnings:b,hasCritical:N}=ke(m),S=b.filter(j=>j.severity==="critical").length,Y=_e(m),D=x.find(j=>j.id===p)||null,de=j=>{v(j);const P=x.find(k=>k.id===j);u(P?te(P):{...se(),currency:f}),o(null)},xe=async()=>{var j,P;if(!Se(m.total_fee)){$("Enter the total contract fee.");return}if(T){$("This exact document is already on file â remove it or upload the correct one.");return}if(N&&!L){$("This agreement has blocking issues â confirm you understand before saving.");return}w(!0),$(null);try{let k=(t==null?void 0:t.documentUrl)||null;if(r&&!k){const K=await _.integrations.Core.UploadFile({file:r});k=(K==null?void 0:K.file_url)||null}const U=Re({terms:m,organizationId:d,talentId:y,agreementUrl:k});F&&(U.document_checksum=F),D&&(U.amends_contract_id=D.id,U.notes=`Addendum to the ${D.contract_type} contract starting ${D.start_date||"n/a"}. 2 3${U.notes||""}`.trim());const me=await _.entities.TalentContract.create(U);await Te({terms:m,organizationId:d,talentId:y,contractId:me.id}),c==null||c()}catch(k){$(((P=(j=k==null?void 0:k.response)==null?void 0:j.data)==null?void 0:P.error)||k.message||"Failed to create contract.")}finally{w(!1)}};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-start sm:items-center justify-center p-0 sm:p-6 overflow-y-auto",style:{background:"rgba(15,15,20,0.45)",backdropFilter:"blur(4px)",fontFamily:s.font},children:e.jsxs("div",{className:"w-full max-w-2xl my-0 sm:my-8",style:{background:"rgba(255,255,255,0.92)",backdropFilter:"blur(20px)",border:"1px solid rgba(0,0,0,0.06)",borderRadius:s.radius.lg,boxShadow:s.shadow.lg},children:[e.jsxs("div",{className:"flex items-start justify-between gap-4 p-5 sm:p-6",style:{borderBottom:"1px solid rgba(0,0,0,0.06)"},children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 flex items-center justify-center",style:{background:`linear-gradient(135deg, ${s.colors.primary}18 0%, ${s.colors.primary}35 100%)`,borderRadius:s.radius.md},children:e.jsx(G,{className:"w-5 h-5",style:{color:s.colors.primary}})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-bold",style:{color:s.text.primary,letterSpacing:"-0.02em"},children:"New Contract"}),e.jsxs("p",{className:"text-xs",style:{color:s.text.secondary},children:[i," â upload the agreement and we'll read the terms"]})]})]}),e.jsx("button",{onClick:n,className:"p-2",style:{background:"rgba(0,0,0,0.04)",borderRadius:s.radius.sm},children:e.jsx(z,{className:"w-4 h-4",style:{color:s.text.secondary}})})]}),e.jsxs("div",{className:"px-5 sm:px-6 py-5 max-h-[65vh] overflow-y-auto space-y-6",children:[x.length>0&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] font-bold uppercase tracking-wider mb-1.5",style:{color:s.text.tertiary},children:"Is this an addendum?"}),e.jsxs("select",{value:p,onChange:j=>de(j.target.value),className:"w-full px-3.5 py-2.5 text-sm outline-none",style:{background:"rgba(0,0,0,0.02)",border:"1px solid rgba(0,0,0,0.08)",borderRadius:s.radius.md,color:s.text.primary},children:[e.jsx("option",{value:"",children:"No â this is a brand new contract"}),x.map(j=>e.jsxs("option",{value:j.id,children:["Amends: ",j.contract_type," contract",j.start_date?` (from ${j.start_date})`:""]},j.id))]}),e.jsx("p",{className:"text-[11px] mt-1.5",style:{color:s.text.tertiary},children:"An addendum starts from the original terms â anything it doesn't change is carried forward."})]}),T&&e.jsxs("div",{className:"p-3.5 flex items-start gap-2.5",style:{background:`${s.colors.accent}08`,border:`1px solid ${s.colors.accent}30`,borderRadius:s.radius.md},children:[e.jsx(De,{className:"w-4 h-4 flex-shrink-0 mt-0.5",style:{color:s.colors.accent}}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-bold",style:{color:s.colors.accent},children:"This document is already on file"}),e.jsxs("p",{className:"text-[11px] mt-0.5",style:{color:s.text.secondary},children:["The identical file is attached to an existing ",T.contract_type," contract",T.start_date?` starting ${T.start_date}`:"",". Saving is blocked so it isn't duplicated â upload the actual addendum instead."]})]})]}),e.jsx(Ce,{file:r,setFile:V,terms:m,setTerms:u,extracted:t,setExtracted:o,baseTerms:D?te(D):null}),e.jsx(Ue,{schedule:Y,currency:m.currency})]}),e.jsxs("div",{className:"p-5 sm:p-6 space-y-3",style:{borderTop:"1px solid rgba(0,0,0,0.06)"},children:[N&&e.jsxs("button",{type:"button",onClick:()=>H(j=>!j),className:"w-full flex items-start gap-3 p-3.5 text-left",style:{background:`${s.colors.accent}08`,border:`1px solid ${s.colors.accent}30`,borderRadius:s.radius.md},children:[e.jsx("div",{className:"w-4 h-4 mt-0.5 flex-shrink-0 flex items-center justify-center",style:{background:L?s.colors.accent:"transparent",border:`1.5px solid ${s.colors.accent}`,borderRadius:4},children:L&&e.jsx("div",{className:"w-1.5 h-1.5 bg-white",style:{borderRadius:1}})}),e.jsxs("span",{className:"text-xs font-semibold",style:{color:s.colors.accent},children:["I understand this agreement has ",S," blocking issue(s) and I'm saving it for record-keeping only."]})]}),R&&e.jsxs("div",{className:"p-3 flex items-start gap-2",style:{background:`${s.colors.accent}08`,border:`1px solid ${s.colors.accent}25`,borderRadius:s.radius.md},children:[e.jsx(A,{className:"w-4 h-4 flex-shrink-0 mt-0.5",style:{color:s.colors.accent}}),e.jsx("p",{className:"text-xs font-medium",style:{color:s.colors.accent},children:R})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("button",{type:"button",onClick:n,disabled:h,className:"px-4 py-2.5 text-sm font-semibold disabled:opacity-50",style:{background:"rgba(0,0,0,0.04)",color:s.text.secondary,borderRadius:s.radius.md},children:"Cancel"}),e.jsx("button",{type:"button",onClick:xe,disabled:h||!!T||N&&!L,className:"inline-flex items-center gap-2 px-5 py-2.5 text-sm font-semibold text-white disabled:opacity-60",style:{background:s.
3colors.primary,borderRadius:s.radius.md,boxShadow:`0 4px 12px ${s.colors.primary}40`},children:h?e.jsxs(e.Fragment,{children:[e.jsx(pe,{className:"w-4 h-4 animate-spin"})," Saving..."]}):"Create Contract"})]})]})]})})}const Me=()=>new Date(new Date().toDateString());function qe(a){return a?a.status==="Expired"?!0:a.end_date?new Date(`${String(a.end_date).slice(0,10)}T00:00:00`)<Me():!1:!1}function ne(a){return a?["Terminated","Completed","Draft"].includes(a.status)?a.status:qe(a)?"Expired":a.status:"â"}function ze(a){return["Active","Pending Signature"].includes(ne(a))}function Ve({talentId:a,contracts:n,onUpdate:y}){return!n||n.length===0?e.jsxs("div",{className:"bg-white border-2 border-gray-200 p-12 text-center",children:[e.jsx(G,{className:"w-12 h-12 text-gray-300 mx-auto mb-4"}),e.jsx("h3",{className:"font-bold text-gray-900 mb-2",children:"No Contracts Yet"}),e.jsx("p",{className:"text-gray-600",children:"Create a contract to get started"})]}):e.jsx("div",{className:"space-y-4",children:n.map(i=>{const f={Draft:"bg-gray-100 text-gray-700","Pending Signature":"bg-yellow-100 text-yellow-700",Active:"bg-[#025940]/10 text-[#025940]",Completed:"bg-blue-100 text-blue-700",Expired:"bg-red-100 text-red-700",Terminated:"bg-red-100 text-red-700"},x=ne(i);return e.jsxs("div",{className:"bg-white border-2 border-gray-200 p-6",children:[e.jsxs("div",{className:"flex items-start justify-between mb-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsxs("h3",{className:"text-lg font-bold text-black",children:[i.contract_type," Contract"]}),e.jsx("span",{className:`px-2 py-1 text-xs font-bold ${f[x]||"bg-gray-100 text-gray-700"}`,children:x})]}),i.scope_of_work&&e.jsx("p",{className:"text-sm text-gray-600",children:i.scope_of_work})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("div",{className:"text-2xl font-bold text-black",children:q(i.total_fee,i.currency)}),e.jsx("div",{className:"text-xs text-gray-600",children:i.currency||"USD"})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4 pt-4 border-t border-gray-200",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-gray-600 uppercase font-bold mb-1",children:"Start Date"}),e.jsxs("div",{className:"text-sm text-black flex items-center gap-1",children:[e.jsx(E,{className:"w-3 h-3"}),i.start_date?new Date(i.start_date).toLocaleDateString():"â"]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-gray-600 uppercase font-bold mb-1",children:"End Date"}),e.jsxs("div",{className:"text-sm text-black flex items-center gap-1",children:[e.jsx(E,{className:"w-3 h-3"}),i.end_date?new Date(i.end_date).toLocaleDateString():"â"]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-gray-600 uppercase font-bold mb-1",children:"Payment Terms"}),e.jsx("div",{className:"text-sm text-black",children:i.payment_terms||"â"})]})]}),i.exclusivity_clause&&e.jsx("div",{className:"mt-4 pt-4 border-t border-gray-200",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm text-[#0026cf]",children:[e.jsx(oe,{className:"w-4 h-4"}),e.jsx("span",{className:"font-semibold",children:"Exclusivity clause included"})]})})]},i.id)})})}function Ye({talentId:a,payments:n,contracts:y,onUpdate:i}){if(!n||n.length===0)return e.jsxs("div",{className:"bg-white border-2 border-gray-200 p-12 text-center",children:[e.jsx(J,{className:"w-12 h-12 text-gray-300 mx-auto mb-4"}),e.jsx("h3",{className:"font-bold text-gray-900 mb-2",children:"No Payments Scheduled"}),e.jsx("p",{className:"text-gray-600",children:"Add payments to track compensation"})]});const f={Scheduled:e.jsx(W,{className:"w-4 h-4 text-yellow-600"}),Processing:e.jsx(W,{className:"w-4 h-4 text-blue-600"}),Paid:e.jsx(oe,{className:"w-4 h-4 text-[#025940]"}),Failed:e.jsx(A,{className:"w-4 h-4 text-red-600"}),Cancelled:e.jsx(A,{className:"w-4 h-4 text-gray-600"})},x={Scheduled:"bg-yellow-100 text-yellow-700",Processing:"bg-blue-100 text-blue-700",Paid:"bg-[#025940]/10 text-[#025940]",Failed:"bg-red-100 text-red-700",Cancelled:"bg-gray-100 text-gray-700"};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-3 gap-4 mb-6",children:[e.jsxs("div",{className:"bg-white border-2 border-gray-200 p-5",children:[e.jsxs("div",{className:"text-2xl font-bold text-black",children:["$",n.filter(c=>c.status==="Paid").reduce((c,d)=>
3c+(d.amount||0),0).toLocaleString()]}),e.jsx("div",{className:"text-sm text-gray-600",children:"Total Paid"})]}),e.jsxs("div",{className:"bg-white border-2 border-gray-200 p-5",children:[e.jsxs("div",{className:"text-2xl font-bold text-black",children:["$",n.filter(c=>c.status==="Scheduled").reduce((c,d)=>c+(d.amount||0),0).toLocaleString()]}),e.jsx("div",{className:"text-sm text-gray-600",children:"Scheduled"})]}),e.jsxs("div",{className:"bg-white border-2 border-gray-200 p-5",children:[e.jsxs("div",{className:"text-2xl font-bold text-black",children:[n.filter(c=>c.status==="Paid").length," / ",n.length]}),e.jsx("div",{className:"text-sm text-gray-600",children:"Payments Made"})]})]}),e.jsx("div",{className:"space-y-3",children:n.map(c=>{var p;const d=y==null?void 0:y.find(v=>v.id===c.contract_id);return e.jsx("div",{className:"bg-white border-2 border-gray-200 p-5",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsxs("span",{className:`px-2 py-1 text-xs font-bold flex items-center gap-1 ${x[c.status]||"bg-gray-100 text-gray-700"}`,children:[f[c.status],c.status]}),e.jsx("span",{className:"text-xs text-gray-600 uppercase font-bold",children:c.payment_type})]}),d&&e.jsxs("div",{className:"text-sm text-gray-600 mb-1",children:[d.contract_type," Contract"]}),e.jsxs("div",{className:"flex items-center gap-4 text-sm text-gray-600",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(E,{className:"w-3 h-3"}),c.scheduled_date?new Date(c.scheduled_date).toLocaleDateString():"â"]}),c.payment_method&&e.jsxs("div",{children:["via ",c.payment_method]})]}),c.notes&&e.jsx("p",{className:"text-sm text-gray-600 mt-2",children:c.notes})]}),e.jsxs("div",{className:"text-right",children:[e.jsxs("div",{className:"text-xl font-bold text-black",children:["$",(p=c.amount)==null?void 0:p.toLocaleString()]}),e.jsx("div",{className:"text-xs text-gray-600",children:c.currency||"USD"})]})]})},c.id)})})]})}const re={critical:{bg:`${s.colors.accent}12`,border:s.colors.accent,icon:Pe,color:s.colors.accent},high:{bg:`${s.colors.orange}12`,border:s.colors.orange,icon:he,color:s.colors.orange},medium:{bg:`${s.colors.yellow}15`,border:s.colors.yellow,icon:E,color:"#b45309"}},Ge={global_exclusivity_breach:"Exclusivity Breach",contract_exclusivity_overlap:"Overlapping Exclusivity",availability_block_overlap:"Availability Conflict",deliverable_quota_exceeded:"Quota Exceeded"};function He({talentId:a}){const[n,y]=g.useState([]),[i,f]=g.useState(!0),[x,c]=g.useState(!1);if(g.useEffect(()=>{if(!a)return;let m=!1;return(async()=>{var u;try{const r=await _.functions.invoke("detectTalentBookingConflicts",{talentId:a});m||y(((u=r==null?void 0:r.data)==null?void 0:u.conflicts)||[])}catch(r){console.warn("Conflict detection failed:",r==null?void 0:r.message)}finally{m||f(!1)}})(),()=>{m=!0}},[a]),i||x||n.length===0)return null;const d=n.reduce((m,u)=>{const r={critical:3,high:2,medium:1};return(r[u.severity]||0)>(r[m.severity]||0)?u:m},n[0]),p=re[d.severity]||re.medium,v=p.icon;return e.jsxs("div",{className:"mb-4 p-4 flex items-start gap-3",style:{...C,background:p.bg,borderLeft:`4px solid ${p.border}`},children:[e.jsx("div",{className:"w-9 h-9 flex items-center justify-center flex-shrink-0",style:{background:`${p.color}20`,borderRadius:s.radius.md},children:e.jsx(v,{className:"w-5 h-5",style:{color:p.color}})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsxs("h3",{className:"text-sm font-bold",style:{color:s.text.primary},children:[n.length," booking conflict",n.length!==1?"s":""," detected"]}),e.jsx("span",{className:"px-2 py-0.5 text-[10px] font-bold uppercase tracking-wider",style:{background:p.color,color:"white",borderRadius:s.radius.sm},children:d.severity})]}),e.jsx("ul",{className:"space-y-1.5",children:n.slice(0,4).map((m,u)=>e.jsxs("li",{className:"text-xs",style:{color:s.text.secondary},children:[e.jsxs("span",{className:"font-bold",style:{color:p.color},children:[Ge[m.type]||m.type,":"]})," ",m.description]},u))}),n.length>4&&e.jsxs("p",{className:"text-xs mt-2 font-semibold",style:{color:s.text.tertiary},children:["+ ",n.length-4," more conflicts â review each contract below."]})]}),e.jsx("button",{onClick:()=>c(!0),className:"flex-shrink-0 p-1 hover:opacity-70",style:{color:s.text.tertiary},"aria-label":"Dismiss",children:e.jsx(z,{className:"w-4 h-4"})})]})}const Q=[{value:"unavailable",label:"Unavailable",color:s.colors.accent},{value:"tentative_hold",label:"Tentative Hold",color:s.colors.orange},{value:"vacation",label:"Vacation",color:s.colors.blue},{value:"other_commitment",label:"Other Commitment",color:s.colors.purple}];function Ke({talent:a,contracts:n=[],canEdit:y=!1,onUpdate:i}){const[f,x]=g.useState(!1),[c,d]=g.useState({start_date:"",end_date:"",type:"unavailable",reason:""}),[p,v]=g.useState(!1),m=g.useMemo(()=>[...(a==null?void 0:a.availability_blocks)||[]].sort((o,h)=>(o.start_date||"").localeCompare(h.start_date||"")),[a]),u=g.useMemo(()=>n.filter(t=>["Active","Pending Signature"].includes(t.status)&&t.start_date),[n]),r=async()=>
3{if(c.start_date){v(!0);try{const t={...c,end_date:c.end_date||c.start_date,added_by:"",added_date:new Date().toISOString()},o=[...a.availability_blocks||[],t];await _.entities.Talent.update(a.id,{availability_blocks:o}),d({start_date:"",end_date:"",type:"unavailable",reason:""}),x(!1),i==null||i()}finally{v(!1)}}},l=async t=>{if(!confirm("Remove this availability block?"))return;const o=(a.availability_blocks||[]).filter((h,w)=>w!==t);await _.entities.Talent.update(a.id,{availability_blocks:o}),i==null||i()};return e.jsxs("div",{className:"p-5",style:C,children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-8 h-8 flex items-center justify-center",style:{background:`${s.colors.blue}20`,borderRadius:s.radius.md},children:e.jsx(E,{className:"w-4 h-4",style:{color:s.colors.blue}})}),e.jsx("h3",{className:"text-sm font-bold",style:{color:s.text.primary},children:"Availability"})]}),y&&!f&&e.jsxs("button",{onClick:()=>x(!0),className:"px-3 py-1.5 text-xs font-bold text-white flex items-center gap-1.5",style:{background:s.colors.primary,borderRadius:s.radius.md},children:[e.jsx(X,{className:"w-3.5 h-3.5"})," Add Block"]})]}),f&&e.jsxs("div",{className:"p-3 mb-4",style:{background:"rgba(0,0,0,0.03)",borderRadius:s.radius.md},children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2 mb-2",children:[e.jsx("input",{type:"date",value:c.start_date,onChange:t=>d({...c,start_date:t.target.value}),className:"text-xs px-2 py-1.5 border",style:{borderRadius:s.radius.sm,borderColor:"rgba(0,0,0,0.12)"}}),e.jsx("input",{type:"date",value:c.end_date,onChange:t=>d({...c,end_date:t.target.value}),className:"text-xs px-2 py-1.5 border",style:{borderRadius:s.radius.sm,borderColor:"rgba(0,0,0,0.12)"}})]}),e.jsx("select",{value:c.type,onChange:t=>d({...c,type:t.target.value}),className:"w-full text-xs px-2 py-1.5 border mb-2",style:{borderRadius:s.radius.sm,borderColor:"rgba(0,0,0,0.12)"},children:Q.map(t=>e.jsx("option",{value:t.value,children:t.label},t.value))}),e.jsx("input",{type:"text",placeholder:"Reason (optional)",value:c.reason,onChange:t=>d({...c,reason:t.target.value}),className:"w-full text-xs px-2 py-1.5 border mb-2",style:{borderRadius:s.radius.sm,borderColor:"rgba(0,0,0,0.12)"}}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:r,disabled:p||!c.start_date,className:"flex-1 px-3 py-1.5 text-xs font-bold text-white disabled:opacity-50",style:{background:s.colors.primary,borderRadius:s.radius.sm},children:p?"Saving...":"Save Block"}),e.jsx("button",{onClick:()=>x(!1),className:"px-3 py-1.5 text-xs font-semibold",style:{background:"white",border:"1px solid rgba(0,0,0,0.12)",borderRadius:s.radius.sm,color:s.text.secondary},children:e.jsx(z,{className:"w-3.5 h-3.5"})})]})]}),u.length>0&&e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider mb-2",style:{color:s.text.tertiary},children:"Active Bookings"}),e.jsx("div",{className:"space-y-1.5",children:u.map(t=>e.jsxs("div",{className:"flex items-center justify-between px-2.5 py-1.5 text-xs",style:{background:`${s.colors.green}10`,borderRadius:s.radius.sm},children:[e.jsx("span",{className:"font-semibold",style:{color:s.text.primary},children:t.contract_type}),e.jsxs("span",{style:{color:s.text.tertiary},children:[t.start_date||"â"," â ",t.end_date||"ongoing"]})]},t.id))})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider mb-2",style:{color:s.text.tertiary},children:"Blocked Windows"}),m.length===0?e.jsx("p",{className:"text-xs py-3 text-center",style:{color:s.text.tertiary},children:"No availability blocks set."}):e.jsx("div",{className:"space-y-1.5",children:m.map((t,o)=>{const h=Q.find(w=>w.value===t.type)||Q[0];return e.jsxs("div",{className:"flex items-center justify-between px-2.5 py-2 text-xs group",style:{background:`${h.color}10`,borderRadius:s.radius.sm,borderLeft:`3px solid ${h.color}`},children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-bold",style:{color:h.color},children:h.label}),t.reason&&e.jsxs("span",{style:{color:s.text.secondary},children:["â ",t.reason]})]}),e.jsxs("div",{className:"text-[11px] mt-0.5",style:{color:s.text.tertiary},children:[t.start_date," â ",t.end_date||t.start_date]})]}),y&&e.jsx("button",{onClick:()=>l(o),className:"opacity-0 group-hover:opacity-100 p-1 hover:opacity-80",style:{color:s.colors.accent},"aria-label":"Remove",children:e.jsx(be,{className:"w-3.5 h-3.5"})})]},o)})})]})]})}const O=[{key:"social_post",label:"Social Post"},{key:"story",label:"Story"},{key:"reel",label:"Reel"},{key:"video",label:"Video"},{key:"appearance",label:"Appearance"},{key:"photoshoot_day",label:"Photoshoot (per day)"},{key:"ambassador_monthly",label:"Ambassador (monthly)"}];function Qe({talent:a,canEdit:n=!1,onUpdate:y}){var l;const[i,f]=g.useState(!1),[x,c]=g.useState({currency:((l=a==null?void 0:a.rate_card)==null?void 0:l.currency)||"USD",...O.reduce((t,o)=>{var h;return{...t,[o.key]:((h=a==null?void 0:a.rate_card)==null?void 0:h[o.key])||""}},{})}),[d,p]=g.useState(!1),v=(a==null?void 0:a.rate_card)||{},m=v.currency||"USD",u=t=>typeof t!="number"?"â":`${m}
3 ${t.toLocaleString()}`,r=async()=>{p(!0);try{const t={currency:x.currency,last_updated:new Date().toISOString()};for(const o of O)if(x[o.key]!==""&&x[o.key]!==null){const h=Number(x[o.key]);isNaN(h)||(t[o.key]=h)}await _.entities.Talent.update(a.id,{rate_card:t}),f(!1),y==null||y()}finally{p(!1)}};return e.jsxs("div",{className:"p-5",style:C,children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-8 h-8 flex items-center justify-center",style:{background:`${s.colors.green}20`,borderRadius:s.radius.md},children:e.jsx(J,{className:"w-4 h-4",style:{color:s.colors.green}})}),e.jsx("h3",{className:"text-sm font-bold",style:{color:s.text.primary},children:"Rate Card"})]}),n&&!i&&e.jsxs("button",{onClick:()=>f(!0),className:"px-3 py-1.5 text-xs font-bold flex items-center gap-1.5",style:{background:"rgba(0,0,0,0.04)",color:s.text.secondary,borderRadius:s.radius.md},children:[e.jsx($e,{className:"w-3.5 h-3.5"})," Edit"]})]}),i?e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:s.text.tertiary},children:"Currency"}),e.jsx("select",{value:x.currency,onChange:t=>c({...x,currency:t.target.value}),className:"w-full text-xs px-2 py-1.5 border mt-1",style:{borderRadius:s.radius.sm,borderColor:"rgba(0,0,0,0.12)"},children:["USD","EUR","GBP","INR","AUD","CAD"].map(t=>e.jsx("option",{value:t,children:t},t))})]}),e.jsx("div",{className:"grid grid-cols-2 gap-2 mt-3",children:O.map(t=>e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:s.text.tertiary},children:t.label}),e.jsx("input",{type:"number",placeholder:"0",value:x[t.key],onChange:o=>c({...x,[t.key]:o.target.value}),className:"w-full text-xs px-2 py-1.5 border mt-1",style:{borderRadius:s.radius.sm,borderColor:"rgba(0,0,0,0.12)"}})]},t.key))}),e.jsxs("div",{className:"flex gap-2 pt-2",children:[e.jsxs("button",{onClick:r,disabled:d,className:"flex-1 px-3 py-1.5 text-xs font-bold text-white disabled:opacity-50 flex items-center justify-center gap-1.5",style:{background:s.colors.primary,borderRadius:s.radius.sm},children:[e.jsx(Ae,{className:"w-3.5 h-3.5"}),d?"Saving...":"Save Rates"]}),e.jsx("button",{onClick:()=>f(!1),className:"px-3 py-1.5 text-xs font-semibold",style:{background:"white",border:"1px solid rgba(0,0,0,0.12)",borderRadius:s.radius.sm,color:s.text.secondary},children:e.jsx(z,{className:"w-3.5 h-3.5"})})]})]}):e.jsx("div",{children:O.every(t=>!v[t.key])?e.jsxs("p",{className:"text-xs py-4 text-center",style:{color:s.text.tertiary},children:["No rate card set. ",n&&"Click Edit to add rates."]}):e.jsxs("div",{className:"space-y-1.5",children:[O.filter(t=>v[t.key]).map(t=>e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 text-xs",style:{background:"rgba(0,0,0,0.02)",borderRadius:s.radius.sm},children:[e.jsx("span",{style:{color:s.text.secondary},children:t.label}),e.jsx("span",{className:"font-bold",style:{color:s.text.primary},children:u(v[t.key])})]},t.key)),v.last_updated&&e.jsxs("p",{className:"text-[10px] pt-2 text-right",style:{color:s.text.tertiary},children:["Updated ",new Date(v.last_updated).toLocaleDateString()]})]})})]})}function We({talent:a,canEdit:n,onUpdate:y}){const[i,f]=g.useState(!1),[x,c]=g.useState(""),d=a.reference_photos||[],p=async m=>{if(m!=null&&m.length){c(""),f(!0);try{const u=[];for(const r of Array.from(m).slice(0,5)){if(!r.type.startsWith("image/"))continue;const{file_url:l}=await _.integrations.Core.UploadFile({file:r});l&&u.push(l)}if(u.length===0)throw new Error("Please upload image files (JPG/PNG).");await _.entities.Talent.update(a.id,{reference_photos:[...d,...u].slice(0,8)}),y==null||y()}catch(u){c(u.message||"Upload failed")}finally{f(!1)}}},v=async m=>{try{await _.entities.Talent.update(a.id,{reference_photos:d.filter(u=>u!==m)}),y==null||y()}catch(u){c(u.message||"Failed to remove photo")}};return e.jsxs("div",{className:"p-5",style:C,children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("h3",{className:"text-sm font-bold flex items-center gap-2",style:{color:s.text.primary},children:[e.jsx(ae,{className:"w-4 h-4",style:{color:s.colors.primary}}),"Recognition Photos"]}),n&&e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"file",id:`ref-photos-${a.id}`,className:"hidden",accept:"image/*",multiple:!0,disabled:i,onChange:m=>{p(m.target.files),m.target.value=""}}
3),e.jsxs("label",{htmlFor:`ref-photos-${a.id}`,className:"cursor-pointer text-xs font-semibold px-3 py-1.5 flex items-center gap-1.5 text-white",style:{background:s.colors.primary,borderRadius:s.radius.md,opacity:i?.6:1},children:[e.jsx(X,{className:"w-3.5 h-3.5"}),i?"Uploadingâ¦":"Add"]})]})]}),e.jsx("p",{className:"text-xs mb-3",style:{color:s.text.tertiary},children:"Used by AI to auto-detect this talent in uploaded creatives (images and video). Clear, front-facing photos work best."}),x&&e.jsxs("div",{className:"mb-3 p-2 flex items-start gap-2 text-xs",style:{background:`${s.colors.accent}10`,color:s.colors.accent,borderRadius:s.radius.sm},children:[e.jsx(A,{className:"w-3.5 h-3.5 flex-shrink-0 mt-0.5"}),x]}),d.length===0?e.jsxs("div",{className:"py-6 text-center",style:{border:"2px dashed rgba(0,0,0,0.1)",borderRadius:s.radius.md},children:[e.jsx(ae,{className:"w-8 h-8 mx-auto mb-2",style:{color:s.text.tertiary,opacity:.4}}),e.jsx("p",{className:"text-xs font-medium",style:{color:s.text.secondary},children:"No recognition photos yet"}),e.jsxs("p",{className:"text-[11px] mt-0.5",style:{color:s.text.tertiary},children:["Talent detection won't find ",a.name," until photos are added"]})]}):e.jsx("div",{className:"grid grid-cols-4 gap-2",children:d.map(m=>e.jsxs("div",{className:"relative group aspect-square overflow-hidden",style:{borderRadius:s.radius.sm,border:"1px solid rgba(0,0,0,0.08)"},children:[e.jsx("img",{src:m,alt:a.name,className:"w-full h-full object-cover",loading:"lazy"}),n&&e.jsx("button",{onClick:()=>v(m),className:"absolute top-1 right-1 w-5 h-5 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",style:{background:"rgba(0,0,0,0.6)",borderRadius:s.radius.sm},title:"Remove photo",children:e.jsx(z,{className:"w-3 h-3 text-white"})})]},m))})]})}const M={social_posts:"Social Posts",stories:"Stories",reels:"Reels",videos:"Videos",appearances:"Appearances",photoshoots:"Photoshoots"};function Je({contracts:a=[]}){var r;const[n,y]=g.useState(((r=a[0])==null?void 0:r.id)||null),[i,f]=g.useState(!1),[x,c]=g.useState({deliverable_type:"social_posts",count:1,notes:""}),d=g.useMemo(()=>a.filter(l=>["Active","Pending Signature","Completed"].includes(l.status)),[a]),p=a.find(l=>l.id===n)||d[0],v=g.useMemo(()=>{const l={quota:{},used:{}};for(const t of d){for(const[o,h]of Object.entries(t.deliverables_quota||{}))typeof h=="number"&&(l.quota[o]=(l.quota[o]||0)+h);for(const[o,h]of Object.entries(t.deliverables_used||{}))typeof h=="number"&&(l.used[o]=(l.used[o]||0)+h)}return l},[d]),m=async()=>{var l,t;if(p){f(!0);try{await _.functions.invoke("logTalentDeliverableUsage",{contract_id:p.id,deliverable_type:x.deliverable_type,count:Number(x.count)||1,notes:x.notes}),window.location.reload()}catch(o){alert(`Log failed: ${((t=(l=o==null?void 0:o.response)==null?void 0:l.data)==null?void 0:t.error)||o.message}`)}finally{f(!1)}}};if(d.length===0)return e.jsxs("div",{className:"p-12 text-center",style:C,children:[e.jsx(ie,{className:"w-12 h-12 mx-auto mb-3",style:{color:s.text.tertiary}}),e.jsx("h3",{className:"font-bold mb-1",style:{color:s.text.primary},children:"No Active Contracts"}),e.jsx("p",{className:"text-sm",style:{color:s.text.tertiary},children:"Create a contract to start tracking deliverables."})]});const u=((p==null?void 0:p.deliverable_usage_log)||[]).slice().reverse();return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"p-5",style:C,children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx("div",{className:"w-8 h-8 flex items-center justify-center",style:{background:`${s.colors.purple}20`,borderRadius:s.radius.md},children:e.jsx(Le,{className:"w-4 h-4",style:{color:s.colors.purple}})}),e.jsx("h3",{className:"text-sm font-bold",style:{color:s.text.primary},children:"Total Deliverables Across Active Contracts"})]}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-3",children:Object.keys(M).map(l=>{const t=v.used[l]||0,o=v.quota[l]||0,h=o>0?Math.min(100,t/o*100):0,w=o>0&&t>o;return!t&&!o?null:e.jsxs("div",{className:"p-3",style:{background:"rgba(0,0,0,0.02)",borderRadius:s.radius.md},children:[e.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[e.jsx("span",{className:"text-xs font-semibold",style:{color:s.text.secondary},children:M[l]}),w&&e.jsx(A,{className:"w-3.5 h-3.5",style:{color:s.colors.accent}})]}),e.jsxs("div",{className:"text-lg font-bold",style:{color:w?s.colors.accent:s.text.primary},children:[t," ",e.jsxs("span",{className:"text-xs font-medium",style:{color:s.text.tertiary},children:["/ ",o||"â"]})]}),o>0&&e.jsx("div",{className:"mt-1.5 h-1 rounded-full overflow-hidden",style:{background:"rgba(0,0,0,0.06)"},children:e.jsx("div",{className:"h-full transition-all",style:{width:`${h}%`,background:w?s.colors.accent:s.colors.primary}})})]},l)})})]}),e.jsxs("div",{className:"p-5",style:C,children:[e.jsxs("div",{className:"flex items-center justify-between mb-4 flex-wrap gap-2",children:[e.jsx("h3",{className:"text-sm font-bold",style:{color:s.text.primary},children:"Per-Contract Detail"}),d.length>1&&e.jsx("select",{value:n||"",onChange:l=>y(l.target.value),className:"text-xs px-2 py-1.5 border font-semibold",style:{borderRadius:s.radius.sm,borderColor:"rgba(0,0,0,0.12)"}
3,children:d.map(l=>e.jsxs("option",{value:l.id,children:[l.contract_type," ⢠",l.start_date||"no start"]},l.id))})]}),p&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-2 mb-4",children:Object.entries(p.deliverables_quota||{}).map(([l,t])=>{var R;if(typeof t!="number"||t===0)return null;const o=((R=p.deliverables_used)==null?void 0:R[l])||0,h=Math.min(100,o/t*100),w=o>t;return e.jsxs("div",{className:"p-2.5",style:{background:"rgba(0,0,0,0.02)",borderRadius:s.radius.sm},children:[e.jsx("div",{className:"text-[10px] font-bold uppercase mb-1",style:{color:s.text.tertiary},children:M[l]||l}),e.jsxs("div",{className:"text-sm font-bold",style:{color:w?s.colors.accent:s.text.primary},children:[o," / ",t]}),e.jsx("div",{className:"mt-1 h-1 rounded-full overflow-hidden",style:{background:"rgba(0,0,0,0.06)"},children:e.jsx("div",{className:"h-full",style:{width:`${h}%`,background:w?s.colors.accent:s.colors.green}})})]},l)})}),e.jsxs("div",{className:"p-3 mb-4",style:{background:`${s.colors.primary}06`,borderRadius:s.radius.md,border:`1px dashed ${s.colors.primary}30`},children:[e.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider mb-2",style:{color:s.colors.primary},children:"Log Deliverable Usage"}),e.jsxs("div",{className:"flex flex-wrap gap-2 items-end",children:[e.jsx("select",{value:x.deliverable_type,onChange:l=>c({...x,deliverable_type:l.target.value}),className:"text-xs px-2 py-1.5 border",style:{borderRadius:s.radius.sm,borderColor:"rgba(0,0,0,0.12)"},children:Object.entries(M).map(([l,t])=>e.jsx("option",{value:l,children:t},l))}),e.jsx("input",{type:"number",min:"1",value:x.count,onChange:l=>c({...x,count:l.target.value}),className:"text-xs px-2 py-1.5 border w-20",style:{borderRadius:s.radius.sm,borderColor:"rgba(0,0,0,0.12)"}}),e.jsx("input",{type:"text",placeholder:"Notes (optional)",value:x.notes,onChange:l=>c({...x,notes:l.target.value}),className:"text-xs px-2 py-1.5 border flex-1 min-w-[180px]",style:{borderRadius:s.radius.sm,borderColor:"rgba(0,0,0,0.12)"}}),e.jsx("button",{onClick:m,disabled:i,className:"px-3 py-1.5 text-xs font-bold text-white disabled:opacity-50",style:{background:s.colors.primary,borderRadius:s.radius.sm},children:i?"Logging...":"Log"})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[e.jsx(W,{className:"w-3.5 h-3.5",style:{color:s.text.tertiary}}),e.jsxs("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:s.text.tertiary},children:["Usage Log (",u.length,")"]})]}),u.length===0?e.jsx("p",{className:"text-xs py-3 text-center",style:{color:s.text.tertiary},children:"No usage logged yet."}):e.jsx("div",{className:"space-y-1 max-h-64 overflow-y-auto",children:u.map((l,t)=>{var o;return e.jsxs("div",{className:"flex items-center justify-between text-xs px-2.5 py-1.5",style:{background:"rgba(0,0,0,0.02)",borderRadius:s.radius.sm},children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"font-bold",style:{color:s.text.primary},children:M[l.deliverable_type]||l.deliverable_type}),e.jsxs("span",{style:{color:s.colors.primary},children:["Ã",l.count]}),l.notes&&e.jsxs("span",{className:"truncate",style:{color:s.text.tertiary},children:["â ",l.notes]})]}),e.jsxs("span",{className:"text-[10px] flex-shrink-0",style:{color:s.text.tertiary},children:[new Date(l.logged_date).toLocaleDateString()," ⢠",(o=l.logged_by)==null?void 0:o.split("@")[0]]})]},t)})})]})]})]})]})}const le=(a,n)=>n?`/${a}?${n}`:`/${a}`;function hs(){var F,B,T,I,V;const{user:a,organizationId:n}=ce(),[y,i]=g.useState("overview"),[f,x]=g.useState(!1),d=new URLSearchParams(window.location.search).get("id"),{data:p,isLoading:v,error:m,refetch:u}=ge({queryKey:["talentDetails",d],queryFn:async()=>{var N,S,Y;const b=await _.functions.invoke("getTalentDetails",{talentId:d});if(!((N=b==null?void 0:b.data)!=null&&N.success)){const D=new Error(((S=b==null?void 0:b.data)==null?void 0:S.error)||"Talent not found");throw D.code=(Y=b==null?void 0:b.data)==null?void 0:Y.code,D}return b.data},enabled:!!d&&!!n,retry:(b,N)=>
3(N==null?void 0:N.code)==="CROSS_TENANT_DENIED"?!1:b<1});if(v)return e.jsx(we,{text:"Loading talent details..."});if(Fe(m))return e.jsx(Be,{resourceLabel:"talent profile",userEmail:a==null?void 0:a.email,backTo:"talent",backLabel:"Back to Talent"});if(!(p!=null&&p.talent))return e.jsx("div",{className:"min-h-screen flex items-center justify-center p-4",style:{background:s.bg.secondary},children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"w-16 h-16 mx-auto mb-4 flex items-center justify-center",style:{...fe(s.colors.accent),borderRadius:s.radius.xl},children:e.jsx(A,{className:"w-8 h-8",style:{color:s.colors.accent}})}),e.jsx("h2",{className:"text-xl font-bold mb-2",style:{color:s.text.primary},children:"Talent Not Found"}),e.jsxs(Z,{to:le("talent"),className:"inline-flex items-center gap-2 text-sm font-semibold mt-2",style:{color:s.colors.primary},children:[e.jsx(ee,{className:"w-4 h-4"})," Back to Talent List"]})]})});const{talent:r,contracts:l=[],payments:t=[]}=p,o=(a==null?void 0:a.effectiveRole)||(a==null?void 0:a.organization_role)||"Member",h=(a==null?void 0:a.is_superadmin)||(a==null?void 0:a.isSuperAdmin)||["Admin","Owner"].includes(o),w=l.filter(ze),R=((F=l[0])==null?void 0:F.currency)||((B=r.rate_card)==null?void 0:B.currency)||"USD",$=l.reduce((b,N)=>b+(N.total_fee||0),0),L=t.filter(b=>b.status==="Paid").reduce((b,N)=>b+(N.amount||0),0),H=[{id:"overview",label:"Overview",icon:G},{id:"contracts",label:"Contracts",icon:G,count:l.length},{id:"deliverables",label:"Deliverables",icon:ie},{id:"payments",label:"Payments",icon:J,count:t.length},{id:"availability",label:"Availability",icon:E}];return e.jsxs("div",{className:"min-h-screen",style:{background:s.bg.secondary,fontFamily:s.font},children:[e.jsxs("div",{className:"bg-white",style:{borderBottom:"1px solid rgba(0,0,0,0.06)"},children:[e.jsxs("div",{className:"max-w-7xl mx-auto px-5 py-4",children:[e.jsxs(Z,{to:le("talent"),className:"flex items-center gap-2 text-xs uppercase tracking-wide font-semibold mb-3",style:{color:s.text.tertiary},children:[e.jsx(ee,{className:"w-3.5 h-3.5"}),"Back to Talent"]}),e.jsxs("div",{className:"flex items-start justify-between flex-wrap gap-4",children:[e.jsxs("div",{className:"flex items-start gap-4",children:[r.profile_image_url?e.jsx("img",{src:r.profile_image_url,alt:r.name,className:"w-16 h-16 object-cover",style:{borderRadius:s.radius.lg}}):e.jsx("div",{className:"w-16 h-16 flex items-center justify-center text-xl font-bold text-white",style:{background:s.colors.primary,borderRadius:s.radius.lg},children:r.name.charAt(0).toUpperCase()}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[e.jsx(Ee,{status:r.status,type:"talent",size:"sm"}),e.jsx("span",{className:"text-xs font-bold uppercase",style:{color:s.text.tertiary},children:r.category})]}),e.jsx("h1",{className:"text-xl font-bold mb-1",style:{color:s.text.primary},children:r.name}),e.jsxs("div",{className:"flex items-center gap-4 text-xs flex-wrap",style:{color:s.text.tertiary},children:[r.follower_count&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(je,{className:"w-3.5 h-3.5"}),r.follower_count.toLocaleString()," followers"]}),r.engagement_rate&&e.jsxs("span",{children:[r.engagement_rate,"% engagement"]})]})]})]}),h&&e.jsxs("button",{onClick:()=>x(!0),className:"px-4 py-2 text-sm font-bold text-white flex items-center gap-2",style:{background:s.colors.primary,borderRadius:s.radius.md,boxShadow:`0 4px 12px ${s.colors.primary}40`},children:[e.jsx(X,{className:"w-4 h-4"})," New Contract"]})]})]}),e.jsx("div",{style:{background:s.colors.primary},children:e.jsxs("div",{className:"max-w-7xl mx-auto px-5 py-3 grid grid-cols-2 md:grid-cols-4 gap-4 text-white",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider opacity-75",children:"Active Contracts"}),e.jsx("div",{className:"text-lg font-bold",children:w.length})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider opacity-75",children:"Total Contract Value"}),e.jsx("div",{className:"text-lg font-bold",children:q($,R)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider opacity-75",children:"Paid to Date"}),e.jsx("div",{className:"text-lg font-bold",children:q(L,R)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider opacity-75",children:"Exclusivity"}),e.jsx("div",{className:"text-lg font-bold flex items-center gap-1.5",children:(T=r.global_exclusivity)!=null&&T.end_date&&new Date(r.global_exclusivity.end_date)>new Date?e.jsxs(e.Fragment,{children:[e.jsx(ve,{className:"w-4 h-4"}),e.jsxs("span",{className:"text-sm",children:["Until ",r.global_exclusivity.end_date]})]}):e.jsx("span",{className:"text-sm opacity-75",children:"None"})})]})]})})]}),e.jsxs("div",{className:"max-w-7xl mx-auto px-5 py-6",children:[e.jsx(He,{talentId:d}),e.jsx("div",{className:"mb-4",style:C,children:e.jsx("div",{className:"flex overflow-x-auto",children:H.map(b=>{const N=b.icon,S=y===b.id;return e.jsxs("button",{onClick:()=>i(b.id),className:"flex-1 min-w-fit px-4 py-3 text-xs font-semibold flex items-center justify-center gap-1.5 whitespace-nowrap",style:{borderBottom:S?`2px s
3olid ${s.colors.primary}`:"2px solid transparent",color:S?s.colors.primary:s.text.tertiary,background:S?`${s.colors.primary}08`:"transparent"},children:[e.jsx(N,{className:"w-4 h-4"}),e.jsx("span",{children:b.label}),b.count!==void 0&&b.count>0&&e.jsx("span",{className:"ml-1 px-1.5 py-0.5 text-[10px] font-bold",style:{background:S?s.colors.primary:"rgba(0,0,0,0.1)",color:S?"white":s.text.secondary,borderRadius:s.radius.full},children:b.count})]},b.id)})})}),y==="overview"&&e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-4",children:[e.jsxs("div",{className:"p-5",style:C,children:[e.jsx("h3",{className:"text-sm font-bold mb-4",style:{color:s.text.primary},children:"Contact Information"}),e.jsxs("div",{className:"space-y-3",children:[r.email&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(Ne,{className:"w-4 h-4",style:{color:s.text.tertiary}}),e.jsx("a",{href:`mailto:${r.email}`,style:{color:s.colors.primary},children:r.email})]}),r.phone&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(Ie,{className:"w-4 h-4",style:{color:s.text.tertiary}}),e.jsx("span",{style:{color:s.text.primary},children:r.phone})]}),((I=r.platforms)==null?void 0:I.length)>0&&e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider mb-1.5",style:{color:s.text.tertiary},children:"Platforms"}),e.jsx("div",{className:"flex gap-1.5 flex-wrap",children:r.platforms.map(b=>e.jsx("span",{className:"px-2 py-0.5 text-[11px] font-bold",style:{background:`${s.colors.primary}12`,color:s.colors.primary,borderRadius:s.radius.sm},children:b},b))})]}),r.bio&&e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider mb-1",style:{color:s.text.tertiary},children:"Bio"}),e.jsx("p",{className:"text-sm",style:{color:s.text.secondary},children:r.bio})]})]})]}),((V=r.agent_contact)==null?void 0:V.name)&&e.jsxs("div",{className:"p-5",style:C,children:[e.jsx("h3",{className:"text-sm font-bold mb-3",style:{color:s.text.primary},children:"Agent / Manager"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"font-bold text-sm",style:{color:s.text.primary},children:r.agent_contact.name}),r.agent_contact.email&&e.jsx("div",{className:"text-xs",style:{color:s.text.secondary},children:r.agent_contact.email}),r.agent_contact.phone&&e.jsx("div",{className:"text-xs",style:{color:s.text.secondary},children:r.agent_contact.phone})]})]}),r.status==="Blacklisted"&&r.blacklist_reason&&e.jsxs("div",{className:"p-5 border-l-4",style:{...C,borderLeftColor:s.colors.accent,background:`${s.colors.accent}08`},children:[e.jsxs("h3",{className:"text-sm font-bold mb-1 flex items-center gap-2",style:{color:s.colors.accent},children:[e.jsx(A,{className:"w-4 h-4"})," Blacklisted"]}),e.jsx("p",{className:"text-xs",style:{color:s.text.secondary},children:r.blacklist_reason}),r.blacklisted_by&&e.jsxs("p",{className:"text-[10px] mt-2",style:{color:s.text.tertiary},children:["by ",r.blacklisted_by," ⢠",r.blacklisted_date&&new Date(r.blacklisted_date).toLocaleDateString()]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(We,{talent:r,canEdit:h,onUpdate:u}),e.jsx(Qe,{talent:r,canEdit:h,onUpdate:u})]})]}),y==="contracts"&&e.jsx(Ve,{talentId:d,contracts:l,onUpdate:u}),y==="deliverables"&&e.jsx(Je,{contracts:l}),y==="payments"&&e.jsx(Ye,{talentId:d,payments:t,contracts:l,onUpdate:u}),y==="availability"&&e.jsx(Ke,{talent:r,contracts:l,canEdit:h,onUpdate:u})]}),f&&e.jsx(Oe,{isOpen:f,onClose:()=>x(!1),talentId:d,talentName:r.name,defaultCurrency:R,existingContracts:l,onSuccess:()=>{u(),x(!1)}})]})}export{hs 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.