1import{r as i,j as e,ah as R,a6 as f,w as $,l as k,A as S,a7 as P,g as T,ak as D,n as L}from"./index-Bzn9Wj-r.js";import{A as F,a as U}from"./AdminNav-D7kGK3jg.js";import{S as V}from"./shield-alert-DSscaFdQ.js";import"./clapperboard-7O0lljJl.js";import"./mail-CmCIeWT_.js";const B=["all","validating","validated","rejected","failed","pending"],v={credentials:"include"};function w(){window.location.href="/admin/login"}function C({status:t}){const a={validated:{bg:"bg-emerald-500/15",fg:"text-emerald-400",icon:R},rejected:{bg:"bg-rose-500/15",fg:"text-rose-400",icon:D},failed:{bg:"bg-amber-500/15",fg:"text-amber-400",icon:V},validating:{bg:"bg-blue-500/15",fg:"text-blue-400",icon:T},pending:{bg:"bg-gray-500/15",fg:"text-gray-400",icon:T}}[t]||{bg:"bg-gray-500/15",fg:"text-gray-300",icon:L},m=a.icon;return e.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs font-medium ${a.bg} ${a.fg}`,"data-testid":`status-${t}`,children:[e.jsx(m,{className:"w-3 h-3"})," ",t]})}function N(t){return t?new Date(t).toLocaleString():"â"}function E(t){return t.liveness_phrase?t.liveness_phrase:[t.liveness_color,t.liveness_animal,t.liveness_number].filter(Boolean).join(" · ")||"â"}function z(){const[t,x]=i.useState("all"),[a,m]=i.useState(null),[r,h]=i.useState(!1),[g,c]=i.useState(null),[n,p]=i.useState(null);return i.useEffect(()=>{let s=!1;const o=async()=>{h(!0),c(null);try{const b=t==="all"?"":`?status=${encodeURIComponent(t)}`,l=await fetch(`/api/admin/voice-clone/consents${b}`,v);if(l.status===401){w();return}if(!l.ok)throw new Error(`HTTP ${l.status}`);const d=await l.json();s||m(d)}catch(b){s||c(b?.message||"Failed to load.")}finally{s||h(!1)}};o();const j=window.setInterval(o,3e4);return()=>{s=!0,window.clearInterval(j)}},[t]),e.jsxs("div",{className:"lg:pl-56",children:[e.jsx(F,{}),e.jsx("div",{className:"min-h-screen bg-gray-950 text-white p-6 md:p-10",children:e.jsxs("div",{className:"max-w-7xl mx-auto space-y-6",children:[e.jsxs("header",{className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl md:text-3xl font-bold flex items-center gap-2","data-testid":"title-voice-consents",children:[e.jsx(R,{className:"w-6 h-6 text-emerald-400"})," Voice Clone Consents"]}),e.jsx("p",{className:"text-sm text-gray-400 mt-1",children:"Live audit trail for the impersonation gate. Each row is one consent + liveness attempt."})]}),e.jsx("div",{className:"flex items-center gap-3",children:r&&e.jsx(f,{className:"w-5 h-5 animate-spin text-gray-500"})})]}),g&&e.jsx("div",{className:"rounded-lg border border-rose-500/40 bg-rose-500/10 p-3 text-sm text-rose-300","data-testid":"error-load",children:g}),e.jsx(O,{}),e.jsx(q,{}),e.jsx(M,{}),a&&e.jsxs("section",{className:"grid grid-cols-2 md:grid-cols-4 gap-3","data-testid":"rollup-24h",children:[e.jsx(_,{label:"Attempts (24h)",value:a.last24h?.total??0}),e.jsx(_,{label:"Validated (24h)",value:a.last24h?.validated??0,tone:"emerald"}),e.jsx(_,{label:"Rejected (24h)",value:a.last24h?.rejected??0,tone:"rose"}),e.jsx(_,{label:"Failed (24h)",value:a.last24h?.failed??0,tone:"amber"})]}),a?.rollup_30d?.length?e.jsxs("section",{className:"rounded-xl border border-gray-800 bg-gray-900/40 p-4","data-testid":"rollup-30d",children:[e.jsx("h2",{className:"text-sm font-semibold text-gray-300 mb-2",children:"Status mix (30 days)"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:a.rollup_30d.map(s=>e.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-gray-800/60 px-3 py-1.5",children:[e.jsx(C,{status:s.status}),e.jsx("span",{className:"text-sm tabular-nums",children:s.n})]},s.status))})]}):null,e.jsx("nav",{className:"flex gap-2 flex-wrap","data-testid":"status-tabs",children:B.map(s=>e.jsx("button",{onClick:()=>x(s),"data-testid":`tab-${s}`,className:`px-3 py-1.5 rounded-lg text-sm font-medium transition ${t===s?"bg-emerald-500/20 text-emerald-300 border border-emerald-500/40":"bg-gray-900 text-gray-400 border border-gray-800 hover:text-gray-200"}`,children:s},s))}),e.jsxs("section",{className:"rounded-xl border border-gray-800 bg-gray-900/40 overflow-hidden",children:[!a&&r&&e.jsx("div",{className:"p-8 flex items-center justify-center text-gray-500",children:e.jsx(f,{className:"w-6 h-6 animate-spin"})}),a&&e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"text-left text-xs uppercase tracking-wider text-gray-500 bg-gray-900/60",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-3 py-2",children:"When"}),e.jsx("th",{className:"px-3 py-2",children:"Phone"}),e.jsx("th",{className:"px-3 py-2",children:"Lang"}),e.jsx("th",{className:"px-3 py-2",children:"Status"}),e.jsx("th",{className:"px-3 py-2",children:"Phrase"}),e.jsx("th",{className:"px-3 py-2",children:"IP"}),e.jsx("th",{className:"px-3 py-2",children:"Error"})]})}),e.jsxs("tbody",{className:"divide-y divide-gray-800",children:[a.rows.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"px-3 py-10 text-center text-gray-500",children:"No consent attempts in this view yet."})}),a.rows.map(s=>e.jsxs(i.Fragment,{children:[e.jsxs("tr",{className:"hover:bg-gray-800/30 cursor-pointer",onClick:()=>p(n===s.id?null:s.id),"data-testid":`row-consent-${s.id}`,children:[e.jsx("td",{className:"px-3 py-2 text-gray-300 whitespace-nowrap","data-testid":`text-time-${s.id}`,children:N(s.created_at)}),e.jsx("td",{className:"px-3 py-2 font-mono text-xs",children:s.phone}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("span",{className:"uppercase text-xs text-gray-400",children:s.lang})}),e.jsx("td",{className:"px-3 py-2",children:e.jsx(C,{status:s.status})}),e.jsx("td",{className:"px-3 py-2 text-gray-400 truncate max-w-[260px]",title:E(s),children:E(s)}),e.jsx("td",{className:"px-3 py-2 font-mono text-xs text-gray-500",children:s.ip_address||"â"}),e.jsx("td",{className:"px-3 py-2 text-rose-400 text-xs truncate max-w-[200px]",children:s.error_message||""})]}),n===s.id&&e.jsx("tr",{className:"bg-gray-950/80",children:e.jsx("td",{colSpan:7,className:"px-3 py-4",children:e.jsxs("div",{className:"grid md:grid-cols-2 gap-4 text-xs",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(y,{label:"Session ID",value:s.id,mono:!0}),e.jsx(y,{label:"User ID",value:s.user_id,mono:!0}),e.jsx(y,{label:"Consent checked",value:String(s.consent_checked)}),e.jsx(y,{label:"Liveness phrase",value:s.liveness_phrase||"â"}),e.jsx(y,{label:"Color · Animal · Number",value:`${s.liveness_color||"â"} · ${s.liveness_animal||"â"} · ${s.liveness_number??"â"}`}),e.jsx(y,{label:"Completed at",value:N(s.completed_at)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(y,{label:"Kie task ID",value:s.kie_task_id||"â",mono:!0}),e.jsx(y,{label:"Kie voice ID",value:s.kie_voice_id||"â",mono:!0}),e.jsx(y,{label:"User agent",value:s.user_agent||"â"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-gray-500 mb-1",children:"Clip 1 (natural)"}),s.clip1_url?e.jsx("audio",{controls:!0,src:s.clip1_url,className:"w-full","data-testid":`audio-clip1-${s.id}`}):e.jsx("span",{className:"text-gray-600",children:"â"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-gray-500 mb-1",children:"Clip 2 (phrase)"}),s.clip2_url?e.jsx("audio",{controls:!0,src:s.clip2_url,className:"w-full","data-testid":`audio-clip2-${s.id}`}):e.jsx("span",{className:"text-gray-600",children:"â"})]})]})]})})})]},s.id))]})]})]})]})})]})}function _({label:t,value:x,tone:a}){const m=a==="emerald"?"text-emerald-400":a==="rose"?"text-rose-400":a==="amber"?"text-amber-400":"text-white";return e.jsxs("div",{className:"rounded-xl border border-gray-800 bg-gray-900/40 p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-wider text-gray-500",children:t}),e.jsx("div",{className:`text-2xl font-bold mt-1 tabular-nums ${m}`,children:x})]})}function y({label:t,value:x,mono:a}){return e.jsxs("div",{children:[e.jsx("div",{className:"text-gray-500",children:t}),e.jsx("div",{className:a?"font-mono text-gray-200 break-all":"text-gray-200 break-words",children:x})]})}const H=[{key:"voice_clone_prompted",label:"Prompted"},{key:"voice_clone_phrase_ready",label:"Phrase ready"},{key:"voice_clone_validated",label:"Validated"},{key:"voice_clone_song_resume",label:"Song resumed"},{key:"voice_clone_validate_failed",label:"Validate failed"},{key:"voice_clone_failed",label:"Generate failed"},{key:"voice_clone_blocked_not_allowlisted",label:"Blocked (allowlist)"}];function O(){const[t,x]=i.useState(null),[a,m]=i.useState(null),[r,h]=i.useState(!1);i.useEffect(()=>{let n=!1;const p=async()=>{h(!0);try{const o=await fetch("/api/admin/voice-clone/funnel",v);if(o.status===401){w();return}if(!o.ok)throw new Error(`HTTP ${o.status}`);const j=await o.json();n||(x(j),m(null))}catch(o){n||m(o?.message||"Failed to load funnel")}finally{n||h(!1)}};p();const s=window.setInterval(p,3e4);return()=>{n=!0,window.clearInterval(s)}},[]);const g=t?Math.round(t.last_1h.failure_rate*100):0,c=t?.last_1h.would_alert;return e.jsxs("section",{className:"rounded-xl border border-gray-800 bg-gray-900/40 p-4","data-testid":"card-voice-clone-funnel",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3 flex-wrap gap-2",children:[e.jsxs("h2",{className:"text-sm font-semibold text-gray-200 flex items-center gap-2",children:[e.jsx(U,{className:"w-4 h-4 text-emerald-400"}),"Voice-clone funnel (last 24h)"]}),e.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[r&&e.jsx(f,{className:"w-3 h-3 animate-spin text-gray-500"}),t&&e.jsxs("span",{"data-testid":"text-failure-rate-1h",className:`px-2 py-1 rounded-md font-mono ${c?"bg-rose-500/15 text-rose-300 border border-rose-500/40":"bg-gray-800 text-gray-300 border border-gray-700"}`,title:`Alert fires when prompted ⥠${t.last_1h.alert_min_prompts} AND failure rate > ${Math.round(t.last_1h.alert_threshold*100)}%`,children:["1h failure rate: ",g,"% (",t.last_1h.failed,"/",t.last_1h.prompted,")",c?" â ALERTING":""]})]})]}),a&&e.jsx("div",{className:"text-xs text-rose-300 mb-2","data-testid":"error-funnel",children:a}),t&&e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-7 gap-2","data-testid":"grid-funnel-stages",children:H.map(n=>{const p=t.stages[n.key]||{n:0,unique_phones:0},s=n.key.includes("failed")||n.key.includes("blocked");return e.jsxs("div",{"data-testid":`stage-${n.key}`,className:`rounded-lg border px-3 py-2 ${s?"border-rose-500/30 bg-rose-500/[0.05]":"border-gray-800 bg-gray-950/60"}`,children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wider text-gray-500",children:n.label}),e.jsx("div",{className:`text-xl font-bold tabular-nums mt-0.5 ${s?"text-rose-300":"text-white"}`,children:p.n}),e.jsxs("div",{className:"text-[10px] text-gray-500 mt-0.5",children:[p.unique_phones," unique"]})]},n.key)})})]})}function q(){const[t,x]=i.useState(""),[a,m]=i.useState(!1),[r,h]=i.useState(null),[g,c]=i.useState(null),[n,p]=i.useState(!1),[s,o]=i.useState(null);async function j(){const l=t.trim();if(!l){c("Enter a phone number first.");return}m(!0),c(null),h(null),o(null);try{const d=await fetch(`/api/admin/voice-clone/user?phone=${encodeURIComponent(l)}`,v);if(d.status===401){w();return}const u=await d.json().catch(()=>({}));if(!d.ok){c(u?.error||`HTTP ${d.status}`);return}h(u)}catch(d){c(d?.message||"Network error")}finally{m(!1)}}async function b(){const l=r?.user?.phone;if(l&&confirm(`Reset voice clone for ${l}? They will start the flow from scratch.`)){p(!0),o(null);try{const d=await fetch("/api/admin/voice-clone/reset",{method:"POST",...v,headers:{"Content-Type":"application/json"},body:JSON.stringify({phone:l})});if(d.status===401){w();return}const u=await d.json().catch(()=>({}));if(!d.ok){o({ok:!1,msg:u?.error||`HTTP ${d.status}`});return}o({ok:!0,msg:`Reset complete for ${u.phone}. Re-running lookupâ¦`}),await j()}catch(d){o({ok:!1,msg:d?.message||"Network error"})}finally{p(!1)}}}return e.jsxs("section",{className:"rounded-xl border border-emerald-500/30 bg-emerald-500/[0.04] p-4","data-testid":"card-user-lookup",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx($,{className:"w-4 h-4 text-emerald-400"}),e.jsx("h2",{className:"text-sm font-semibold text-gray-200",children:"Look up a user's voice-clone history"})]}),e.jsxs("p",{className:"text-xs text-gray-400 mb-3 leading-relaxed",children:["Returns every consent attempt + every ",e.jsx("code",{className:"text-gray-300",children:"voice_clone_*"})," event for the given phone (last 30 days). Use the digits-only WA number (e.g. ",e.jsx("code",{className:"text-gray-300",children:"2348091465902"}),") or a synthetic ID like ",e.jsx("code",{className:"text-gray-300",children:"tg_123456789"})," for Telegram users."]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsx("input",{type:"text",value:t,onChange:l=>x(l.target.value),onKeyDown:l=>{l.key==="Enter"&&!a&&j()},placeholder:"Phone (e.g. 2348091465902 or tg_â¦)",className:"flex-1 px-3 py-2 rounded-lg bg-gray-950 border border-gray-800 text-white text-sm font-mono focus:outline-none focus:border-emerald-500/60","data-testid":"input-lookup-phone",disabled:a}),e.jsxs("button",{onClick:j,disabled:a||!t.trim(),className:"px-4 py-2 rounded-lg bg-emerald-500 text-gray-950 font-semibold text-sm hover:bg-emerald-400 transition disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2","data-testid":"button-lookup",children:[a?e.jsx(f,{className:"w-4 h-4 animate-spin"}):e.jsx($,{className:"w-4 h-4"}),"Look up"]})]}),g&&e.jsxs("div",{className:"mt-3 rounded-lg border border-rose-500/40 bg-rose-500/10 text-rose-300 p-3 text-xs flex items-start gap-2","data-testid":"error-lookup",children:[e.jsx(k,{className:"w-4 h-4 mt-0.5 shrink-0"}),e.jsx("div",{children:g})]}),r&&e.jsxs("div",{className:"mt-4 space-y-4",children:[e.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-950/60 p-3 text-xs","data-testid":"user-summary",children:[r.user?e.jsxs("div",{className:"grid sm:grid-cols-2 gap-x-4 gap-y-1 font-mono text-gray-300",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-500",children:"phone:"})," ",r.user.phone]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-500",children:"channel:"})," ",r.user.channel||"â"]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-500",children:"lang:"})," ",r.user.language||"â"]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-500",children:"voice_clone_status:"})," ",r.user.voice_clone_status||"â"]}
1),e.jsxs("div",{className:"sm:col-span-2",children:[e.jsx("span",{className:"text-gray-500",children:"voice_id:"})," ",r.user.voice_clone_voice_id||"â"]}),e.jsxs("div",{className:"sm:col-span-2",children:[e.jsx("span",{className:"text-gray-500",children:"last_active_at:"})," ",N(r.user.last_active_at)]})]}):e.jsxs("div",{className:"text-gray-400",children:["No user row found for ",e.jsx("span",{className:"font-mono",children:r.phone}),"."]}),r.user&&e.jsxs("div",{className:"mt-3 pt-3 border-t border-gray-800 flex flex-wrap items-center gap-3",children:[e.jsxs("button",{onClick:b,disabled:n,className:"px-3 py-1.5 rounded-lg bg-amber-500 text-gray-950 font-semibold text-xs hover:bg-amber-400 transition disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2","data-testid":"button-inline-reset-voice-clone",children:[n?e.jsx(f,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(S,{className:"w-3.5 h-3.5"}),"Reset this voice clone"]}),s&&e.jsxs("span",{className:`text-xs flex items-center gap-1 ${s.ok?"text-emerald-300":"text-rose-300"}`,"data-testid":s.ok?"status-inline-reset-ok":"status-inline-reset-error",children:[s.ok?e.jsx(P,{className:"w-3.5 h-3.5"}):e.jsx(k,{className:"w-3.5 h-3.5"}),s.msg]})]})]}),e.jsxs("div",{children:[e.jsxs("h3",{className:"text-xs uppercase tracking-wider text-gray-500 mb-2",children:["Consent attempts (",r.consents.length,")"]}),r.consents.length===0?e.jsx("div",{className:"text-xs text-gray-500",children:"No consent rows."}):e.jsx("div",{className:"overflow-x-auto rounded-lg border border-gray-800",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{className:"text-left text-[10px] uppercase tracking-wider text-gray-500 bg-gray-900/60",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-2 py-1.5",children:"When"}),e.jsx("th",{className:"px-2 py-1.5",children:"Phase"}),e.jsx("th",{className:"px-2 py-1.5",children:"Status"}),e.jsx("th",{className:"px-2 py-1.5",children:"Validate task"}),e.jsx("th",{className:"px-2 py-1.5",children:"Generate task"}),e.jsx("th",{className:"px-2 py-1.5",children:"Voice ID"}),e.jsx("th",{className:"px-2 py-1.5",children:"Error"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-800",children:r.consents.map(l=>e.jsxs("tr",{"data-testid":`consent-row-${l.id}`,className:"hover:bg-gray-800/30",children:[e.jsx("td",{className:"px-2 py-1.5 text-gray-300 whitespace-nowrap",children:N(l.created_at)}),e.jsx("td",{className:"px-2 py-1.5",children:e.jsx("span",{className:"text-gray-300",children:l.phase||"â"})}),e.jsx("td",{className:"px-2 py-1.5",children:e.jsx(C,{status:l.status})}),e.jsx("td",{className:"px-2 py-1.5 font-mono text-[10px] text-gray-400 break-all",children:l.kie_task_id||"â"}),e.jsx("td",{className:"px-2 py-1.5 font-mono text-[10px] text-gray-400 break-all",children:l.generate_task_id||"â"}),e.jsx("td",{className:"px-2 py-1.5 font-mono text-[10px] text-gray-400 break-all",children:l.kie_voice_id||"â"}),e.jsx("td",{className:"px-2 py-1.5 text-rose-300",children:l.error_message||""})]},l.id))})]})})]}),e.jsxs("div",{children:[e.jsxs("h3",{className:"text-xs uppercase tracking-wider text-gray-500 mb-2",children:["Events (",r.events.length,", last 30d)"]}),r.events.length===0?e.jsx("div",{className:"text-xs text-gray-500",children:"No voice-clone events."}):e.jsx("div",{className:"rounded-lg border border-gray-800 max-h-72 overflow-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{className:"text-left text-[10px] uppercase tracking-wider text-gray-500 bg-gray-900/60 sticky top-0",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-2 py-1.5",children:"When"}),e.jsx("th",{className:"px-2 py-1.5",children:"Event"}),e.jsx("th",{className:"px-2 py-1.5",children:"Channel"}),e.jsx("th",{className:"px-2 py-1.5",children:"Detail"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-800",children:r.events.map((l,d)=>{const u=l.metadata||{},I=l.event_type.includes("failed"),A=u.reason||u.kie_status||u.taskId||u.voiceId||u.genre||u.source||"";return e.jsxs("tr",{"data-testid":`event-row-${d}`,className:"hover:bg-gray-800/30",children:[e.jsx("td",{className:"px-2 py-1.5 text-gray-300 whitespace-nowrap",children:N(l.created_at)}),e.jsx("td",{className:`px-2 py-1.5 font-mono text-[10px] ${I?"text-rose-300":"text-gray-200"}`,children:l.event_type}),e.jsx("td",{className:"px-2 py-1.5 text-gray-400",children:u.channel||"â"}),e.jsx("td",{className:"px-2 py-1.5 text-gray-400 break-all",children:String(A)})]},d)})})]})})]})]})]})}function M(){const[t,x]=i.useState(""),[a,m]=i.useState(!1),[r,h]=i.useState(null);async function g(){const c=t.replace(/[^\d+]/g,"");if(!c){h({ok:!1,msg:"Enter a phone number first (digits only, e.g. 2348091465902)."});return}if(confirm(`Reset voice clone for ${c}? They will start the flow from scratch.`)){m(!0),h(null);try{const n=await fetch("/api/admin/voice-clone/reset",{method:"POST",...v,headers:{"Content-Type":"application/json"},body:JSON.stringify({phone:c})});if(n.status===401){w();return}const p=await n.json().catch(()=>({}));n.ok?h({ok:!0,msg:`Reset complete for ${p.phone}.`,after:p.after}):h({ok:!1,msg:p?.error||`HTTP ${n.status}`})}catch(n){h({ok:!1,msg:n?.message||"Network error"})}finally{m(!1)}}}return e.jsxs("section",{className:"rounded-xl border border-amber-500/30 bg-amber-500/[0.04] p-4","data-testid":"card-reset-voice-clone",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(S,{className:"w-4 h-4 text-amber-400"}),e.jsx("h2",{className:"text-sm font-semibold text-gray-200",children:"Reset a user's voice clone"})]}),e.jsxs("p",{className:"text-xs text-gray-400 mb-3 leading-relaxed",children:["Clears ",e.jsx("code",{className:"text-gray-300",children:"voice_clone_task_id"}),","," ",e.jsx("code",{className:"text-gray-300",children:"voice_clone_voice_id"}),","," ",e.jsx("code",{className:"text-gray-300",children:"voice_clone_status"}),", audio URL and the pending-song-idea stash. The user can then redo the whole flow from scratch."]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsx("input",{type:"tel",value:t,onChange:c=>x(c.target.value),onKeyDown:c=>{c.key==="Enter"&&!a&&g()},placeholder:"Phone number (e.g. 2348091465902)",className:"flex-1 px-3 py-2 rounded-lg bg-gray-950 border border-gray-800 text-white text-sm font-mono focus:outline-none focus:border-amber-500/60","data-testid":"input-reset-phone",disabled:a}),e.jsxs("button",{onClick:g,disabled:a||!t.trim(),className:"px-4 py-2 rounded-lg bg-amber-500 text-gray-950 font-semibold text-sm hover:bg-amber-400 transition disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2","data-testid":"button-reset-voice-clone",children:[a?e.jsx(f,{className:"w-4 h-4 animate-spin"}):e.jsx(S,{className:"w-4 h-4"}),"Reset"]})]}),r&&e.jsxs("div",{className:`mt-3 rounded-lg border p-3 text-xs flex items-start gap-2 ${r.ok?"border-emerald-500/40 bg-emerald-500/10 text-emerald-300":"border-rose-500/40 bg-rose-500/10 text-rose-300"}`,"data-testid":r.ok?"status-reset-ok":"status-reset-error",children:[r.ok?e.jsx(P,{className:"w-4 h-4 mt-0.5 shrink-0"}):e.jsx(k,{className:"w-4 h-4 mt-0.5 shrink-0"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{children:r.msg}),r.after&&e.jsx("pre",{className:"text-[10px] text-emerald-200/80 font-mono whitespace-pre-wrap break-all",children:JSON.stringify(r.after,null,2)})]})]})]})}export{z 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.