PageSourceSearch

https://www.generalcreative.ai/assets/AdminCreatorPartners-BvGOnaBk.js

js generalcreative.ai collected 2026-10-05 12:59:07 UTC 41,920 bytes, 1 lines download raw bytes

1import{r,j as e,J as L}from"./vendor-CSpQeQFa.js";import{C as _e,a as Se,b as ke,c as Le}from"./uploadLimits-Bk-o1hAt.js";import{I as p}from"./globalAnnouncements-nxd9yA1b.js";import{S as fe,B as ee}from"./BonusExpiryCountdown-DZAQV4Wx.js";import{B as l,R as b}from"./entry-main-PLc9_a6q.js";import{T as W}from"./useEducators-CyXRHIo7.js";import{L as u}from"./contestTypes-D51N3MT-.js";import{T as Ae,a as Ie,b as Z,c as d,d as Pe,e as c}from"./table-Dm0CIfFe.js";import{D as Oe,a as Ue,b as $e,c as Me,d as We}from"./creationMetadata-DV63esj7.js";import{S as Re,a as De,b as Ee,c as Te,d as pe}from"./contestPrizeTypes-lwm66WfQ.js";import{U as Ge,a as H,j as is}from"./useProductHuntRedemption-zAUPPnZC.js";import{f as Ye,d as Ke,g as ls,h as os,i as ds,j as cs,k as ms,l as xs,m as hs,n as He,o as us,p as ps,q as Ze,r as js,C as gs,s as vs,t as fs,v as Ns,w as bs,x as ws,y as Cs,z as ys,A as _s}from"./useCreatorPartnerProgram-DMoI_okX.js";import{k as Ss}from"./AdminRoutes-CFBORMMb.js";import{S as ks}from"./switch-GJYHQ3u1.js";import{C as qe}from"./complimentaryVideoIntent-BYKb2Exc.js";import{P as Ls,a as As,b as Is}from"./popover-BxDuN_sr.js";import{a as Ps}from"./zerionWallet-YD6NMGW7-anviiTIZ.js";import{P as oe}from"./GcSectionHeading-77mgzsCj.js";import{f as Rs,b as ue,T as es,L as Ds}from"./useCreditPurchaseRedirect-BG4b5Ixo.js";import{S as Es}from"./useBlogPostStats-BEEc1KeM.js";import{P as ze}from"./pen-BWfGhi0O.js";import{B as Je}from"./bookingIdentityPing-D51nG8yv.js";import{F as Ts}from"./filter-DudYWA7W.js";import{S as Xe}from"./plural-BbOexbm1.js";import{U as ss}from"./useAdminPayoutsRealtime-CwtmXiou.js";import{A as zs}from"./useContestQuestions-DnE2mGLW.js";import{A as Fs}from"./arrow-up-pBcUOBFB.js";import{E as Fe}from"./perfConfigSelect-DHd8mvGs.js";import{U as Os}from"./seoScorer-By-P-9cc.js";import{C as je}from"./PendingApproval-BMg-Cjnx.js";import{F as ts}from"./creatorQuality-IctvKKPg.js";import{C as ge}from"./modelFamilies-Dcg73pIM.js";import{C as Qe}from"./judgingPredictionSettings-BfoDoEEc.js";import{H as Us}from"./WatchPage-CCj4J9n9.js";import{C as $s}from"./brandOutreachLogo-DX112xbb.js";const F={applied:{label:"Applied",shortLabel:"Applied",description:"Legacy pending application. New applies auto-approve to Discord pending when Level 1 is met.",color:"bg-blue-500/10 text-blue-400 border-blue-500/30",Icon:ts},invited:{label:"Invited",shortLabel:"Invited",description:"Admin approved and sent an invite. Waiting for the creator to connect Discord.",color:"bg-violet-500/10 text-violet-400 border-violet-500/30",Icon:fe},pending_discord:{label:"Approved — Pending Discord",shortLabel:"Discord Pending",description:"Creator was approved. OAuth flow started; waiting for Discord verification to complete.",color:"bg-yellow-500/10 text-yellow-400 border-yellow-500/30",Icon:$s},active:{label:"Active",shortLabel:"Active",description:"Fully onboarded partner. Discord connected, credits allocated, role assigned.",color:"bg-green-500/10 text-green-400 border-green-500/30",Icon:je},revoked:{label:"Revoked",shortLabel:"Revoked",description:"Partnership was manually revoked by an admin. Cooldown may apply before re-apply.",color:"bg-red-500/10 text-red-400 border-red-500/30",Icon:ge},rejected:{label:"Rejected",shortLabel:"Rejected",description:"Application was rejected. Creator can re-apply after the cooldown period.",color:"bg-orange-500/10 text-orange-400 border-orange-500/30",Icon:es},left:{label:"Left",shortLabel:"Left",description:"Creator voluntarily left the program. They can re-apply at any time.",color:"bg-muted text-muted-foreground border-border",Icon:Ds}},Ms=({status:t})=>{if(t==="applied"||t==="invited")return e.jsxs(ee,{className:"border bg-primary/10 text-primary border-primary/30 gap-1",children:[t==="invited"?e.jsx(fe,{className:"h-3 w-3",role:"img","aria-label":"Admin invited"}):e.jsx(ts,{className:"h-3 w-3",role:"img","aria-label":"Self-applied"}),"Pending"]});const{shortLabel:m,color:w,Icon:j}=F[t]??F.active;return e.jsxs(ee,{className:`border ${w} gap-1`,children:[e.jsx(j,{className:"h-3 w-3"}),m]})},Ws=({record:t})=>{const m=He(),[w,j]=r.useState(!1),[v,f]=r.useState(""),[y,C]=r.useState(30),A=async()=>
1{if(!v.trim()){L.error("Please provide a rejection reason");return}await m.mutateAsync({creatorId:t.creator_id,decision:"reject",rejectionReason:v.trim(),cooldownDays:y}),j(!1),f("")};return e.jsxs(Ls,{open:w,onOpenChange:g=>{j(g),g||f("")},children:[e.jsx(As,{asChild:!0,children:e.jsx(l,{variant:"ghost",size:"sm",title:"Reject",disabled:m.isPending,className:"h-7 w-7 p-0 text-red-400 hover:text-red-300 hover:bg-red-500/10",children:e.jsx(ge,{className:"h-4 w-4"})})}),e.jsxs(Is,{align:"end",className:"w-72 space-y-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Reject application"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:t.creator_display_name??t.creator_email})]}),e.jsxs("div",{children:[e.jsxs(u,{className:"text-xs",children:["Reason ",e.jsx("span",{className:"text-red-400",children:"*"})]}),e.jsx(W,{value:v,onChange:g=>f(g.target.value),placeholder:"Why is this application being rejected?",className:"mt-1",rows:2,autoFocus:!0})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-xs",children:"Cooldown days"}),e.jsx(p,{type:"number",min:"0",step:"7",value:y,onChange:g=>C(parseInt(g.target.value,10)||0),className:"mt-1 w-28 h-8"})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(l,{variant:"outline",size:"sm",onClick:()=>j(!1),children:"Cancel"}),e.jsxs(l,{variant:"destructive",size:"sm",onClick:A,disabled:m.isPending||!v.trim(),children:[m.isPending&&e.jsx(b,{className:"h-3.5 w-3.5 animate-spin mr-1.5"}),"Reject"]})]})]})]})},ve="Welcome to the Anthum Creator Partner Program! Your creative talent and contest performance have earned you a spot among our top creators. Connect your Discord to unlock exclusive perks, monthly credits, and direct access to the Anthum team.",Hs=({open:t,onClose:m})=>{const{data:w=[],isLoading:j}=Ss(),{data:v=[],isLoading:f}=Ye(),y=Ze(),[C,A]=r.useState(""),[g,P]=r.useState(ve),[N,R]=r.useState(""),S=j||f,O=r.useMemo(()=>new Set(v.filter(n=>!gs.includes(n.status)).map(n=>n.creator_id)),[v]),i=r.useMemo(()=>w.filter(n=>!O.has(n.id)&&(C===""||n.display_name?.toLowerCase().includes(C.toLowerCase())||n.email.toLowerCase().includes(C.toLowerCase()))),[w,O,C]),h=async()=>{if(!N){L.error("Please select a creator");return}try{await y.mutateAsync({creatorId:N,notes:g}),R(""),P(ve),A(""),m()}catch{}},D=i.find(n=>n.id===N)??w.find(n=>n.id===N);return e.jsx(Oe,{open:t,onOpenChange:n=>!n&&m(),children:e.jsxs(Ue,{className:"max-w-lg",children:[e.jsxs($e,{children:[e.jsx(Me,{children:"Invite Creator to Partner Program"}),e.jsx(We,{children:"Search and select a creator to invite."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(p,{placeholder:"Search by name or email…",value:C,onChange:n=>{A(n.target.value),R("")},autoFocus:!0}),e.jsx("div",{className:"border border-border rounded-md overflow-hidden",children:S?e.jsx("div",{className:"px-3 py-4 text-sm text-muted-foreground text-center",children:"Loading…"}):i.length===0?e.jsx("div",{className:"px-3 py-4 text-sm text-muted-foreground text-center",children:"No eligible creators found"}):e.jsx("div",{className:"max-h-52 overflow-y-auto divide-y divide-border",children:i.map(n=>e.jsxs("button",{type:"button",onClick:()=>R(n.id),className:`w-full text-left px-3 py-2.5 flex flex-col gap-0.5 transition-colors ${N===n.id?"bg-primary/20 text-foreground":"hover:bg-muted text-foreground"}`,children:[e.jsxs("span",{className:"text-sm font-medium",children:[n.display_name??n.email,e.jsx("span",{className:"ml-2 text-xs text-muted-foreground font-normal",children:n.creator_tier??"bronze"})]}),n.display_name&&e.jsx("span",{className:"text-xs text-muted-foreground",children:n.email})]},n.id))})}),D&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Selected: ",e.jsx("span",{className:"text-foreground",children:D.display_name??D.email})]}),e.jsxs("div",{children:[e.jsx(u,{children:"Notes (optional)"}),e.jsx(W,{placeholder:"Internal notes about this invitation…",value:g,onChange:n=>P(n.target.value),className:"mt-1",rows:2})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(l,{variant:"outline",onClick:m,children:"Cancel"}),e.jsxs(l,{onClick:h,disabled:y.isPending||!N,children:[y.isPending?e.jsx(b,{className:"h-4 w-4 animate-spin mr-2"}):e.jsx(oe,{className:"h-4 w-4 mr-2"}),"Invite"]})]})]})]})})},Bs=({record:t,onClose:m})=>{const w=vs(),j=fs(),v=He(),f=Ns(),y=bs(),C=ws(),{data:A=[]}=Ke({activeOnly:!0}),[g,P]=r.useState(""),[N,R]=r.useState(!1),[S,O]=r.useState(!1),{data:i=[]}=Cs(t?.id),{data:h=[],isFetching:D}=ys(S?t?.creator_id:void 0),[n,de]=r.useState(t?.status??"applied"),[U,se]=r.useState(t?.notes??""),[B,ce]=r.useState(""),[V,me]=r.useState(30),[te,ae]=r.useState(""),[$,G]=r.useState(!1),[M,E]=r.useState(""),[xe,q]=r.useState(""),J=_s(),[I,ne]=r.useState(50),[he,X]=r.useState("");
1if(!t)return null;const re=t.status==="applied",k=re&&n==="pending_discord",Q=re&&n==="rejected",Y=n==="rejected",Ne=["active","invited","pending_discord"].includes(t.status),ie=w.isPending||v.isPending,be=()=>k?"Approve & Save":Q?"Reject & Save":"Save",T=async()=>{if(Y&&n==="rejected"&&re&&!B.trim()){L.error("Please provide a rejection reason");return}await w.mutateAsync({id:t.id,notes:U}),k?await v.mutateAsync({creatorId:t.creator_id,decision:"approve",notes:U}):Q?await v.mutateAsync({creatorId:t.creator_id,decision:"reject",rejectionReason:B,cooldownDays:V,notes:U}):n!==t.status&&await w.mutateAsync({id:t.id,status:n}),m()},K=async()=>{await j.mutateAsync(t.creator_id),m()},we=async()=>{await f.mutateAsync({creatorId:t.creator_id,reason:te||void 0}),m()},Ce=async()=>{await y.mutateAsync({creatorId:t.creator_id,reason:g||void 0}),m()},z=async()=>{if(!M){L.error("Select a level");return}await C.mutateAsync({creatorId:t.creator_id,levelId:M,reason:xe.trim()||null}),E(""),q(""),m()},ye=async()=>{if(!Number.isFinite(I)||I<=0){L.error("Enter a credit amount above zero");return}await J.mutateAsync({creatorId:t.creator_id,amount:I,reason:he.trim()||void 0}),X("")};return e.jsx(Oe,{open:!!t,onOpenChange:a=>!a&&m(),children:e.jsxs(Ue,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[e.jsxs($e,{children:[e.jsxs(Me,{className:"flex items-center gap-2",children:["Edit CPP Record",e.jsxs("a",{href:`/creator/profile/${t.creator_id}`,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-xs font-normal text-blue-400 hover:text-blue-300 transition-colors ml-auto",title:"Open creator profile in new tab",children:["View Profile ",e.jsx(Fe,{className:"h-3 w-3"})]})]}),e.jsx(We,{children:t.creator_display_name??t.creator_email})]}),e.jsxs("div",{className:"space-y-4",children:[(t.discord_username||t.discord_id)&&e.jsxs("div",{className:"rounded-md bg-muted/50 p-3 text-sm space-y-1",children:[t.discord_username&&e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Discord: "}),e.jsx("span",{className:"font-mono",children:t.discord_username})]}),t.discord_id&&e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Discord ID: "}),e.jsx("span",{className:"font-mono text-xs",children:t.discord_id})]})]}),(t.reviewed_at||t.reviewed_by_name||t.rejection_reason||t.cooldown_until)&&e.jsxs("div",{className:"rounded-md bg-muted/50 p-3 text-sm space-y-1",children:[(t.reviewed_at||t.reviewed_by_name)&&e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Reviewed: "}),e.jsxs("span",{children:[t.reviewed_by_name??"Unknown admin",t.reviewed_at?` · ${H(t.reviewed_at)}`:""]})]}),t.rejection_reason&&e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Rejection reason: "}),e.jsx("span",{children:t.rejection_reason})]}),t.cooldown_until&&e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:new Date(t.cooldown_until)>new Date?"Cooldown ends: ":"Cooldown ended: "}),e.jsx("span",{children:H(t.cooldown_until)})]})]}),t.current_level&&e.jsxs("div",{className:"rounded-md border border-violet-500/30 bg-violet-500/5 p-3 text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"Current level: "}),e.jsxs("span",{className:"font-semibold text-violet-300",children:["Rank ",t.current_level.rank," — ",t.current_level.name]}),e.jsxs("span",{className:"text-muted-foreground",children:[" · ",t.current_level.monthly_credits," monthly credits"]})]}),e.jsxs("div",{className:"rounded-md border border-border/60 p-3 space-y-3",children:[e.jsx(u,{className:"text-sm font-medium",children:"Grant level (bypass criteria)"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Manually set this partner's level. Discord roles stack; monthly credits use the highest level. Optional reason is stored on the level event and shown in Discord when provided."}),e.jsxs(Re,{value:M||void 0,onValueChange:E,children:[e.jsx(De,{children:e.jsx(Ee,{placeholder:"Select level…"})}),e.jsx(Te,{children:A.map(a=>e.jsxs(pe,{value:a.id,children:["Rank ",a.rank," — ",a.name," 
1(",a.monthly_credits," cr/mo)"]},a.id))})]}),e.jsxs("div",{children:[e.jsx(u,{htmlFor:"grant-reason",className:"text-xs text-muted-foreground",children:"Reason (optional)"}),e.jsx(W,{id:"grant-reason",value:xe,onChange:a=>q(a.target.value),placeholder:"e.g. Manual exception after contest review",className:"mt-1 min-h-[72px]",maxLength:500})]}),e.jsxs(l,{size:"sm",variant:"outline",onClick:z,disabled:C.isPending||!M,children:[C.isPending?e.jsx(b,{className:"h-4 w-4 animate-spin mr-2"}):e.jsx(fe,{className:"h-4 w-4 mr-2"}),"Grant level"]})]}),e.jsxs("div",{children:[e.jsx(u,{children:"Status"}),e.jsxs(Re,{value:n,onValueChange:a=>de(a),children:[e.jsx(De,{className:"mt-1",children:e.jsx(Ee,{children:(()=>{const a=F[n];return a?e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(a.Icon,{className:"h-3.5 w-3.5"}),a.shortLabel]}):null})()})}),e.jsx(Te,{children:Object.keys(F).map(a=>{const le=F[a];return e.jsx(pe,{value:a,className:"py-2.5",children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsxs("span",{className:"flex items-center gap-1.5 font-medium",children:[e.jsx(le.Icon,{className:"h-3.5 w-3.5"}),le.label]}),e.jsx("span",{className:"text-[11px] text-muted-foreground leading-tight pl-5",children:le.description})]})},a)})})]}),k&&e.jsxs("p",{className:"text-[11px] text-emerald-400 mt-1 flex items-center gap-1",children:[e.jsx(je,{className:"h-3 w-3"}),"Approving will move this creator to Discord verification."]}),n!==t.status&&e.jsxs("p",{className:"text-[11px] text-amber-400/80 mt-1 flex items-center gap-1",children:[e.jsx(es,{className:"h-3 w-3"}),"Changing from ",e.jsx("span",{className:"font-semibold",children:F[t.status]?.shortLabel})," → ",e.jsx("span",{className:"font-semibold",children:F[n]?.shortLabel})]})]}),Y&&e.jsxs("div",{children:[e.jsxs(u,{className:"text-xs",children:["Rejection reason ",Q&&e.jsx("span",{className:"text-red-400",children:"*"})]}),e.jsx(W,{placeholder:"Why is this application being rejected?",value:B,onChange:a=>ce(a.target.value),className:"mt-1",rows:2}),Q&&e.jsxs("div",{className:"mt-2",children:[e.jsx(u,{className:"text-xs",children:"Cooldown days"}),e.jsx(p,{type:"number",min:"0",step:"7",value:V,onChange:a=>me(parseInt(a.target.value,10)||0),className:"mt-1 w-28"})]})]}),e.jsxs("div",{children:[e.jsx(u,{children:"Notes"}),e.jsx(W,{value:U,onChange:a=>se(a.target.value),className:"mt-1",rows:3})]}),e.jsxs("div",{children:[e.jsxs("button",{type:"button",onClick:()=>O(a=>!a),className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[e.jsx(Qe,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"font-medium",children:"Credits"}),t.welcome_credits_granted&&e.jsx(ee,{className:"bg-green-500/10 text-green-400 border-green-500/30 text-[10px] ml-1",children:"Welcome granted"}),e.jsx("span",{className:"ml-auto text-[10px]",children:S?"Hide":"Show"})]}),S&&e.jsxs("div",{className:"mt-2 rounded-md border border-border/40 bg-muted/20 divide-y divide-border/30",children:[t.status==="active"&&e.jsxs("div",{className:"flex flex-col gap-2 px-3 py-3",children:[e.jsx(u,{className:"text-xs font-medium",children:"Grant credits now"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(p,{type:"number",min:"1",step:"10",value:I,onChange:a=>ne(parseInt(a.target.value,10)||0),className:"w-24 h-8 text-xs","aria-label":"Credit amount"}),e.jsx(p,{value:he,onChange:a=>X(a.target.value),placeholder:"Reason (optional)",className:"h-8 text-xs",maxLength:200}),e.jsxs(l,{size:"sm",variant:"outline",className:"h-8 shrink-0",onClick:ye,disabled:J.isPending||I<=0,children:[J.isPending?e.jsx(b,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(Qe,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"ml-1.5",children:"Grant"})]})]})]}),(t.custom_welcome_credits!=null||t.custom_monthly_credits!=null)&&e.jsxs("div",{className:"flex flex-col gap-1 px-3 py-2 text-xs",children:[t.custom_welcome_credits!=null&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-muted-foreground w-24 shrink-0",children:"Custom welcome"}),e.jsx("span",{className:"font-mono font-semibold text-foreground",children:t.custom_welcome_credits}),e.jsx("span",{className:"text-muted-foreground ml-auto",children:"overrides global default"})]}),t.custom_monthly_credits!=null&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-muted-foreground w-24 shrink-0",children:"Custom monthly"}),e.jsx("span",{className:"font-mono font-semibold text-foreground",children:t.custom_monthly_credits}),e.jsx("span",{className:"text-muted-foreground ml-auto",children:"overrides global default"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 text-xs",children:[e.jsx("span",{className:"text-muted-foreground w-24 shrink-0",children:"Welcome"}),t.welcome_credits_granted?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-green-400 font-mono font-semibold",children:h.find(a=>a.source==="cpp_welcome")?.amount!=null?`+${h.find(a=>a.source==="cpp_welcome").amount}`:"+credits"}),e.jsx("span",{className:"text-muted-foreground ml-auto",children:t.welcome_credits_at?H(t.welcome_credits_at):"granted"})]}):e.jsx("span",{className:"text-yellow-400/80",children:"Not yet granted"})]}),D&&!h.length?e.jsxs("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:[e.jsx(b,{className:"h-3 w-3 animate-spin inline mr-1"}),"Loading..."]}):h.filter(a=>a.source==="cpp").length===0?e.jsx("div",{className:"px-3 py-2 text-xs text-muted-foreground italic",children:"No monthly credits granted yet."}):h.filter(a=>a.source==="cpp").map(a=>e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 text-xs",children:[e.jsx("span",{className:"text-muted-foreground w-24 shrink-0",children:"Monthly"}),e.jsxs("span",{className:"text-emerald-400 font-mono font-semibold",children:["+",a.amount]}),a.reason&&e.jsx("span",{className:"text-muted-foreground truncate max-w-[120px]",title:a.reason,children:a.reason}),e.jsx("span",{className:"text-muted-foreground ml-auto shrink-0",children:H(a.created_at)})]},a.id))]})]}),Ne&&e.jsxs("div",{className:"rounded-md border border-red-500/20 bg-red-500/5 p-4 space-y-3",children:[e.jsxs("p",{className:"text-sm font-medium text-red-400 flex items-center gap-1.5",children:[e.jsx(ge,{className:"h-4 w-4"}),"Revoke Partnership"]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-xs",children:"Reason (optional)"}),e.jsx(W,{placeholder:"Why is this partnership being revoked?",value:te,onChange:a=>ae(a.target.value),className:"mt-1",rows:2})]}),e.jsxs(l,{size:"sm",variant:"destructive",onClick:we,disabled:f.isPending,children:[f.isPending?e.jsx(b,{className:"h-4 w-4 animate-spin mr-1"}):e.jsx(ge,{className:"h-4 w-4 mr-1"}),"Revoke (90-day cooldown)"]})]}),e.jsxs("div",{className:"rounded-md border border-border/60 bg-muted/30 p-4 space-y-3",children:[e.jsxs("p",{className:"text-sm font-medium text-muted-foreground flex items-center gap-1.5",children:[e.jsx(ue,{className:"h-4 w-4"}),"Clear Record"]}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Permanently removes this CPP record and any partner role. The creator can apply again from scratch. This cannot be undone."}),N?e.jsxs("div",{className:"space-y-2",children:[e.jsx(W,{placeholder:"Reason for clearing (optional)",value:g,onChange:a=>P(a.target.value),className:"mt-1",rows:2}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(l,{size:"sm",variant:"destructive",onClick:Ce,disabled:y.isPending,children:[y.isPending?e.jsx(b,{className:"h-3.5 w-3.5 animate-spin mr-1"}):e.jsx(ue,{className:"h-3.5 w-3.5 mr-1"}),"Confirm Clear"]}),e.jsx(l,{size:"sm",variant:"ghost",onClick:()=>{R(!1),P("")},children:"Cancel"})]})]}):e.jsxs(l,{size:"sm",variant:"outline",className:"border-border text-muted-foreground hover:border-red-500/60 hover:text-red-400",onClick:()=>R(!0),children:[e.jsx(ue,{className:"h-4 w-4 mr-1"}),"Clear Record"]})]}),e.jsxs("div",{children:[e.jsxs(l,{variant:"ghost",size:"sm",onClick:()=>G(!$),className:"text-xs text-muted-foreground",children:[e.jsx(Us,{className:"h-3 w-3 mr-1"}),$?"Hide":"Show"," Status History (",i.length,")"]}),$&&i.length>0&&e.jsx("div",{className:"mt-2 space-y-1.5 max-h-40 overflow-y-auto",children:i.map(a=>e.jsxs("div",{className:"text-xs flex items-center gap-2 text-muted-foreground",children:[e.jsx("span",{className:"text-muted-foreground
1/70",children:is(a.created_at)}),e.jsxs("span",{children:[a.previous_status??"(new)"," → ",e.jsx("span",{className:"text-white",children:a.new_status})]}),a.changed_by_name&&e.jsxs("span",{className:"text-blue-400/70",children:["by ",a.changed_by_name]}),a.reason&&e.jsxs("span",{className:"italic",children:["— ",a.reason]})]},a.id))}),$&&i.length===0&&e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:"No status changes recorded yet."})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 justify-end",children:[t.status==="pending_discord"&&e.jsxs(l,{variant:"outline",className:"border-green-500/40 text-green-400 hover:bg-green-500/10",onClick:K,disabled:j.isPending,children:[e.jsx(ss,{className:"h-4 w-4 mr-2"}),"Force Activate"]}),e.jsx(l,{variant:"outline",onClick:m,children:"Cancel"}),e.jsxs(l,{onClick:T,disabled:ie,className:k?"bg-emerald-600 hover:bg-emerald-700 text-white":"",children:[ie?e.jsx(b,{className:"h-4 w-4 animate-spin mr-2"}):k?e.jsx(je,{className:"h-4 w-4 mr-2"}):e.jsx(ze,{className:"h-4 w-4 mr-2"}),be()]})]})]})]})})},Vs=["all","applied","invited","pending_discord","active","revoked","rejected","left"];function kt(){const{data:t=[],isLoading:m,refetch:w}=Ye(),[j,v]=r.useState(""),[f,y]=r.useState("all"),[C,A]=r.useState(!1),[g,P]=r.useState(null),{data:N=[],isLoading:R}=Ke(),S=ls(),O=os(),[i,h]=r.useState(null),{data:D=500}=ds(),n=cs(),[de,U]=r.useState(""),[se,B]=r.useState(!1);r.useEffect(()=>{se||U(String(D))},[D,se]);const{data:ce=""}=ms(),V=xs(),[me,te]=r.useState(""),[ae,$]=r.useState(!1);r.useEffect(()=>{ae||te(ce)},[ce,ae]);const G=hs(t),M=He(),{data:E=[],isLoading:xe}=us(),q=ps(),J=Ze(),I=js(),[ne,he]=r.useState(""),[X,re]=r.useState(!1),[k,Q]=r.useState("all"),[Y,Ne]=r.useState("desc"),[ie,be]=r.useState(""),[T,K]=r.useState(new Set),we=()=>({rank:(N.reduce((s,o)=>
1Math.max(s,o.rank),0)||0)+1,name:"",min_wins:1,min_elo:0,monthly_credits:100,discord_role_id:"",is_active:!0}),Ce=r.useMemo(()=>[...N].filter(s=>s.is_active).sort((s,o)=>s.rank-o.rank),[N]),z=r.useMemo(()=>{const s=ne.trim().toLowerCase(),o=k==="all"?null:Number.parseInt(k,10);return[...E.filter(x=>o!=null&&!Number.isNaN(o)&&x.eligible_level?.rank!==o?!1:s?(x.display_name?.toLowerCase().includes(s)??!1)||x.email.toLowerCase().includes(s)||(x.eligible_level?.name.toLowerCase().includes(s)??!1):!0)].sort((x,Ve)=>Y==="desc"?Ve.current_elo-x.current_elo:x.current_elo-Ve.current_elo)},[E,ne,k,Y]),ye=z.length>0&&z.every(s=>T.has(s.user_id)),a=(s,o)=>{K(_=>{const x=new Set(_);return o?x.add(s):x.delete(s),x})},le=s=>{K(o=>{const _=new Set(o);for(const x of z)s?_.add(x.user_id):_.delete(x.user_id);return _})},as=()=>{const s=Number.parseInt(ie.trim(),10);if(Number.isNaN(s)){L.error("Enter a valid ELO threshold");return}const o=z.filter(_=>_.current_elo>=s).map(_=>_.user_id);K(new Set(o)),L.success(`Selected ${o.length} creator${o.length!==1?"s":""} with ELO ≥ ${s}`)},ns=async()=>{const s=[...T];if(s.length===0){L.error("Select at least one creator");return}await I.mutateAsync({creatorIds:s,notes:ve}),K(new Set)},Be=r.useMemo(()=>t.filter(s=>{if(f!=="all"&&s.status!==f)return!1;if(j){const o=j.toLowerCase();return(s.creator_display_name?.toLowerCase().includes(o)??!1)||s.creator_email.toLowerCase().includes(o)||(s.discord_username?.toLowerCase().includes(o)??!1)||(s.current_level?.name?.toLowerCase().includes(o)??!1)}return!0}),[t,f,j]),rs=async()=>{if(i){if(!i.name?.trim()){L.error("Level name is required");return}if(i.rank==null||i.rank<1){L.error("Rank must be >= 1");return}await S.mutateAsync({id:i.id,rank:i.rank,name:i.name,min_wins:i.min_wins??0,min_elo:i.min_elo??0,monthly_credits:i.monthly_credits??0,discord_role_id:i.discord_role_id??null,is_active:i.is_active??!0}),h(null)}};return e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold flex items-center gap-2",children:[e.jsx(Ge,{className:"h-6 w-6 text-primary"}),"Creator Partner Program"]}),e.jsx("p",{className:"text-muted-foreground text-sm mt-1",children:"Manage applications, invitations, and active CPP creators"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(l,{variant:"outline",size:"sm",onClick:()=>w(),children:[e.jsx(b,{className:"h-4 w-4 mr-2"}),"Refresh"]}),e.jsxs(l,{size:"sm",onClick:()=>A(!0),children:[e.jsx(oe,{className:"h-4 w-4 mr-2"}),"Invite Creator"]})]})]}),t.length>0&&e.jsxs("div",{className:"flex gap-4 text-sm text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(Rs,{className:"h-3.5 w-3.5"}),"Conversion: ",e.jsxs("span",{className:"text-white font-medium",children:[G.conversionRate,"%"]})]}),e.jsxs("span",{children:["Avg days to activate: ",e.jsx("span",{className:"text-white font-medium",children:G.avgDaysToActivate})]})]}),e.jsx("div",{className:"grid grid-cols-4 gap-2.5 sm:grid-cols-4 lg:grid-cols-7",children:Vs.map(s=>{const o=s==="all"?null:F[s],_=s==="all"?G.counts.all:G.counts[s]??0,x=f===s;return e.jsxs("button",{type:"button",onClick:()=>y(s),className:`group rounded-xl border p-3 text-left transition-all duration-150 ${x?o?`${o.color} border-current/40 shadow-sm`:"border-primary bg-primary/10 text-primary shadow-sm":"border-border/60 bg-card hover:border-border hover:bg-muted/30"}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[o?e.jsx(o.Icon,{className:`h-3.5 w-3.5 ${x?"":"text-muted-foreground"}`}):e.jsx(Ge,{className:`h-3.5 w-3.5 ${x?"text-primary":"text-muted-foreground"}`}),e.jsx("span",{className:`text-xs font-bold tabular-nums ${x?"":"text-muted-foreground"}`,children:_})]}),e.jsx("p",{className:`text-[10px] font-medium leading-tight ${x?"":"text-muted-foreground"}`,children:o?.shortLabel??"All"}),o&&e.jsx("p",{className:"text-[9px] leading-tight text-muted-foreground/60 mt-0.5 hidden lg:block line-clamp-2",children:o.description})]},s)})}),e.jsxs(_e,{children:[e.jsxs(Se,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[e.jsxs(ke,{className:"text-base flex items-center gap-2",children:[e.jsx(Es,{className:"h-4 w-4 text-muted-foreground"}),"Levels & settings"]}),e.jsxs(l,{size:"sm",variant:"outline",onClick:()=>h(we()),children:[e.jsx(oe,{className:"h-4 w-4 mr-1"}),"Add level"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Level 1 gates apply (auto-approved). Higher levels auto-upgrade active partners when they meet wins + ELO. Discord roles stack; monthly credits use the highest level."})]}),e.jsxs(Le,{className:"space-y-4",children:[R?e.jsx("div",{className:"text-sm text-muted-foreground py-4 text-center",children:"Loading levels…"}):N.length===0?e.jsx("div",{className:"text-sm text-muted-foreground py-4 text-center",children:"No levels configured"}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(Ae,{children:[e.jsx(Ie,{children:e.jsxs(Z,{children:[e.jsx(d,{children:"Rank"}),e.jsx(d,{children:"Name"}),e.jsx(d,{className:"text-right",children:"Min wins/appr"}),e.jsx(d,{className:"text-right",children:"Min ELO"}),e.jsx(d,{className:"text-right",children:"Monthly credits"}),e.jsx(d,{children:"Discord role ID"}),e.jsx(d,{children:"Active"}),e.jsx(d,{className:"text-right",children:"Actions"})]})}),e.jsx(Pe,{children:N.map(s=>e.jsxs(Z,{className:s.is_active?"":"opacity-50",children:[e.jsx(c,{className:"font-mono",children:s.rank}),e.jsx(c,{className:"font-medium",children:s.name}),e.jsx(c,{className:"text-right font-mono",children:s.min_wins}),e.jsx(c,{className:"text-right font-mono",children:s.min_elo}),e.jsx(c,{className:"text-right font-mono",children:s.monthly_credits}),e.jsx(c,{className:"font-mono text-xs max-w-[140px] truncate",children:s.discord_role_id||"—"}),e.jsx(c,{children:e.jsx(ks,{checked:s.is_active,onCheckedChange:o=>{S.mutate({id:s.id,rank:s.rank,name:s.name,min_wins:s.min_wins,min_elo:s.min_elo,monthly_credits:s.monthly_credits,discord_role_id:s.discord_role_id,is_active:o})}})}),e.jsxs(c,{className:"text-right",children:[e.jsx(l,{variant:"ghost",size:"sm",onClick:()=>h(s),children:e.jsx(ze,{className:"h-4 w-4"})}),s.is_active&&e.jsx(l,{variant:"ghost",size:"sm",onClick:()=>O.mutate(s.id),disabled:O.isPending,children:e.jsx(ue,{className:"h-4 w-4 text-red-400"})})]})]},s.id))})]})}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 pt-2",children:[e.jsxs("div",{className:"flex flex-col gap-2 p-3 rounded-lg border border-border/50",children:[e.jsxs("label",{className:"text-sm font-medium flex items-center gap-1.5",children:[e.jsx(fe,{className:"h-3.5 w-3.5 text-yellow-400"}),"Welcome credits"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"One-time credits when a creator first activates in the CPP."}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx(p,{type:"number",min:"0",step:"50",value:de,onChange:s=>{U(s.target.value),B(!0)},className:"w-24"}),e.jsxs(l,{size:"sm",disabled:n.isPending||!se,onClick:()=>{const s=parseInt(de,10);isNaN(s)||s<0||n.mutate(s,{onSuccess:()=>B(!1)})},children:[n.isPending?e.jsx(b,{className:"h-4 w-4 animate-spin mr-2"}):null,"Save"]})]})]}),e.jsxs("div",{className:"flex flex-col gap-2 p-3 rounded-lg border border-border/50",children:[e.jsxs("label",{className:"text-sm font-medium flex items-center gap-1.5",children:[e.jsx(Je,{className:"h-3.5 w-3.5 text-muted-foreground"}),"Level-ups channel ID"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Discord channel for “Congratulations @user on gaining …”."}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx(p,{value:me,onChange:s=>{te(s.target.value),$(!0)},placeholder:"Channel snowflake ID",className:"font-mono text-sm"}),e.jsxs(l,{size:"sm",disabled:V.isPending||!ae,onClick:()=>{V.mutate(me,{onSuccess:()=>$(!1)})},children:[V.isPending?e.jsx(b,{className:"h-4 w-4 animate-spin mr-2"}):null,"Save"]})]})]})]})]})]}),e.jsx(Oe,{open:!!i,onOpenChange:s=>!s&&h(null),children:e.jsxs(Ue,{className:"max-w-md",children:[e.jsxs($e,{children:[e.jsx(Me,{children:i?.id?"Edit level":"Add level"}),e.jsx(We,{children:"Configure criteria, monthly credits, and Discord role for this ladder step."})]}),i&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(u,{children:"Rank"}),e.jsx(p,{type:"number",min:1,value:i.rank??1,onChange:s=>h({...i,rank:parseInt(s.target.value,10)||1})})]}),e.jsxs("div",{children:[e.jsx(u,{children:"Name"}),e.jsx(p,{value:i.name??"",onChange:s=>h({...i,name:s.target.value}),placeholder:"e.g. Gold Partner"})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{children:[e.jsx(u,{children:"Min wins / approved"}),e.jsx(p,{type:"number",min:0,value:i.min_wins??0,onChange:s=>h({...i,min_wins:parseInt(s.target.value,10)||0})}),e.jsx("p",{className:"text-[11px] text-muted-foreground mt-1",children:"Contest wins + approved performance ads"})]}),e.jsxs("div",{children:[e.jsx(u,{children:"Min ELO"}),e.jsx(p,{type:"number",min:0,value:i.min_elo??0,onChange:s=>h({...i,min_elo:parseInt(s.target.value,10)||0})})]}),e.jsxs("div",{children:[e.jsx(u,{children:"Monthly credits"}),e.jsx(p,{type:"number",min:0,value:i.monthly_credits??0,onChange:s=>h({...i,monthly_credits:parseInt(s.target.value,10)||0})})]})]}),e.jsxs("div",{children:[e.jsx(u,{children:"Discord role ID"}),e.jsx(p,{className:"font-mono text-sm",value:i.discord_role_id??"",onChange:s=>h({...i,discord_role_id:s.target.value}),placeholder:"Role snowflake (optional)"})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx(l,{variant:"outline",onClick:()=>h(null),children:"Cancel"}),e.jsxs(l,{onClick:rs,disabled:S.isPending,children:[S.isPending?e.jsx(b,{className:"h-4 w-4 animate-spin mr-2"}):null,"Save level"]})]})]})]})}),e.jsxs(_e,{children:[e.jsxs(Se,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(ke,{className:"text-base flex items-center gap-2",children:[e.jsx(Ts,{className:"h-4 w-4 text-emerald-400"}),"Eligible Creators"]}),e.jsx(ee,{className:"bg-emerald-500/10 text-emerald-400 border-emerald-500/30 text-xs",children:E.length})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs(l,{variant:"outline",size:"sm",onClick:()=>re(!X),children:[X?"Hide":"Show"," List"]}),e.jsxs(l,{size:"sm",variant:"outline",className:"border-violet-500/40 text-violet-300 hover:bg-violet-500/10",onClick:ns,disabled:I.isPending||T.size===0,children:[I.isPending?e.jsx(b,{className:"h-4 w-4 animate-spin mr-2"}):e.jsx(oe,{className:"h-4 w-4 mr-2"}),"Invite Selected (",T.size,")"]}),e.jsxs(l,{size:"sm",variant:"outline",className:"border-emerald-500/40 text-emerald-400 hover:bg-emerald-500/10",onClick:()=>q.mutate(),disabled:q.isPending||E.length===0,children:[q.isPending?e.jsx(b,{className:"h-4 w-4 animate-spin mr-2"}):e.jsx(Je,{className:"h-4 w-4 mr-2"}),"Notify All (",E.length,")"]})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Creators who meet Level 1 wins + ELO but haven't joined the Partner Program yet. Rank is the highest CPP level they currently qualify for. Apply is auto-approved."})]}),X&&e.jsxs(Le,{className:"space-y-3",children:[e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center",children:[e.jsxs("div",{className:"relative flex-1 min-w-[180px]",children:[e.jsx(Xe,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(p,{placeholder:"Search eligible creators…",value:ne,onChange:s=>he(s.target.value),className:"pl-9"})]}),e.jsxs(Re,{value:k,onValueChange:Q,children:[e.jsx(De,{className:"w-full sm:w-[200px]",children:e.jsx(Ee,{placeholder:"Filter by rank"})}),e.jsxs(Te,{children:[e.jsx(pe,{value:"all",children:"All ranks"}),Ce.map(s=>e.jsxs(pe,{value:String(s.rank),children:["Rank ",s.rank," — ",s.name]},s.id))]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(p,{type:"number",inputMode:"numeric",placeholder:"ELO threshold",value:ie,onChange:s=>be(s.target.value),className:"w-[130px]"}),e.jsx(l,{type:"button",variant:"outline",size:"sm",onClick:as,children:"Select ≥ ELO"})]})]}),xe?e.jsx("div",{className:"flex justify-center py-6 text-muted-foreground",children:"Loading…"}):z.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-2 py-8 text-muted-foreground",children:[e.jsx(ss,{className:"h-6 w-6"}),e.jsx("p",{className:"text-sm",children:"No eligible creators found"})]}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(Ae,{children:[e.jsx(Ie,{children:e.jsxs(Z,{children:[e.jsx(d,{className:"w-10",children:e.jsx(qe,{checked:ye,onCheckedChange:s=>le(s===!0),"aria-label":"Select all visible eligible creators"})}),e.jsx(d,{children:"Creator"}),e.jsx(d,{children:"Tier"}),e.jsx(d,{children:"CPP rank"}),e.jsx(d,{className:"text-right",children:e.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 ml-auto hover:text-foreground",onClick:()=>Ne(s=>s==="desc"?"asc":"desc"),children:["ELO",Y==="desc"?e.jsx(zs,{className:"h-3.5 w-3.5","aria-hidden":!0}):e.jsx(Fs,{className:"h-3.5 w-3.5","aria-hidden":!0})]})}),e.jsx(d,{className:"text-right",children:"Wins+Appr"}),e.jsx(d,{className:"text-right",children:"Actions"})]})}),e.jsx(Pe,{children:z.map(s=>
1e.jsxs(Z,{className:Ps(T.has(s.user_id)&&"bg-primary/5"),children:[e.jsx(c,{children:e.jsx(qe,{checked:T.has(s.user_id),onCheckedChange:o=>a(s.user_id,o===!0),"aria-label":`Select ${s.display_name??s.email}`})}),e.jsxs(c,{children:[e.jsx("div",{className:"font-medium",children:s.display_name??"—"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:s.email})]}),e.jsx(c,{children:e.jsx("span",{className:"capitalize text-sm",children:s.creator_tier??"bronze"})}),e.jsx(c,{children:s.eligible_level?e.jsxs(ee,{className:"border bg-violet-500/10 text-violet-300 border-violet-500/30",children:["Rank ",s.eligible_level.rank," — ",s.eligible_level.name]}):e.jsx("span",{className:"text-xs text-muted-foreground",children:"—"})}),e.jsx(c,{className:"text-right font-mono text-sm",children:s.current_elo}),e.jsx(c,{className:"text-right font-mono text-sm",title:`${s.total_wins} wins + ${s.total_approved} approved`,children:s.qualifying_events}),e.jsx(c,{className:"text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-1",children:[e.jsx("a",{href:`/creator/profile/${s.user_id}`,target:"_blank",rel:"noopener noreferrer",title:"View profile",children:e.jsx(l,{variant:"ghost",size:"sm",children:e.jsx(Fe,{className:"h-4 w-4"})})}),e.jsxs(l,{size:"sm",variant:"outline",className:"text-xs",onClick:()=>{J.mutate({creatorId:s.user_id,notes:ve})},disabled:J.isPending,children:[e.jsx(oe,{className:"h-3.5 w-3.5 mr-1"}),"Invite"]})]})})]},s.user_id))})]})})]})]}),e.jsxs(_e,{children:[e.jsx(Se,{className:"pb-3",children:e.jsx(ke,{className:"text-base",children:"Members"})}),e.jsxs(Le,{className:"space-y-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx(Xe,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(p,{placeholder:"Search by name, email, or Discord…",value:j,onChange:s=>v(s.target.value),className:"pl-9"})]}),m?e.jsx("div",{className:"flex justify-center py-8 text-muted-foreground",children:"Loading…"}):Be.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-2 py-10 text-muted-foreground",children:[e.jsx(Os,{className:"h-8 w-8"}),e.jsx("p",{children:"No records found"})]}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(Ae,{children:[e.jsx(Ie,{children:e.jsxs(Z,{children:[e.jsx(d,{children:"Creator"}),e.jsx(d,{children:"Status"}),e.jsx(d,{children:"Level"}),e.jsx(d,{children:"Discord"}),e.jsx(d,{children:"Pending Since"}),e.jsx(d,{children:"Activated"}),e.jsx(d,{className:"text-right",children:"Actions"})]})}),e.jsx(Pe,{children:Be.map(s=>e.jsxs(Z,{children:[e.jsxs(c,{children:[e.jsx("div",{className:"font-medium",children:s.creator_display_name??"—"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:s.creator_email})]}),e.jsx(c,{children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(Ms,{status:s.status}),s.status==="invited"&&e.jsx("span",{className:"text-[10px] text-muted-foreground",title:"Admin invited",children:"admin"})]})}),e.jsx(c,{children:s.current_level?e.jsx(ee,{className:"border bg-violet-500/10 text-violet-300 border-violet-500/30",children:s.current_level.name}):e.jsx("span",{className:"text-xs text-muted-foreground",children:"—"})}),e.jsx(c,{children:s.discord_username?e.jsxs("div",{children:[e.jsx("span",{className:"font-mono text-sm",children:s.discord_username}),s.discord_id&&e.jsx("div",{className:"text-xs text-muted-foreground font-mono",children:s.discord_id})]}):e.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),e.jsx(c,{className:"text-sm text-muted-foreground",children:s.applied_at?H(s.applied_at):H(s.invited_at)}),e.jsx(c,{className:"text-sm text-muted-foreground",children:s.activated_at?H(s.activated_at):"—"}),e.jsx(c,{className:"text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.status==="applied"&&e.jsxs(e.Fragment,{children:[e.jsx(l,{variant:"ghost",size:"sm",title:"Approve",disabled:M.isPending,className:"h-7 w-7 p-0 text-emerald-400 hover:text-emerald-300 hover:bg-emerald-500/10",onClick:()=>M.mutate({creatorId:s.creator_id,decision:"approve"}),children:e.jsx(je,{className:"h-4 w-4"})}),e.jsx(Ws,{record:s})]}),e.jsx("a",{href:`/creator/profile/${s.creator_id}`,target:"_blank",rel:"noopener noreferrer",title:"View creator profile",children:e.jsx(l,{variant:"ghost",size:"sm",children:e.jsx(Fe,{className:"h-4 w-4"})})}),e.jsx(l,{variant:"ghost",size:"sm",onClick:()=>P(s),children:e.jsx(ze,{className:"h-4 w-4"})})]})})]},s.id))})]})})]})]}),e.jsx(Hs,{open:C,onClose:()=>A(!1)}),e.jsx(Bs,{record:g,onClose:()=>P(null)},g?.id??"")]})}export{kt 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.