1try{let e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="6ce863f6-b623-4dd0-9b20-e663c3aa0af5",e._sentryDebugIdIdentifier="sentry-dbid-6ce863f6-b623-4dd0-9b20-e663c3aa0af5")}catch(e){}"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3601],{13130:(e,t,a)=>{a.d(t,{A:()=>r}),a(83225);var n=a(21338),s=a(66609);let l=n.A.create({baseURL:"https://platform.socbyte.ai/api/phishing",paramsSerializer:e=>{let t=new URLSearchParams;return Object.entries(e||{}).forEach(e=>{let[a,n]=e;if(null==n)return;if(Array.isArray(n)){let e=n.filter(e=>null!=e).map(e=>String(e).trim()).filter(Boolean);e.length>0&&t.append(a,e.join(","));return}let s="object"==typeof n?JSON.stringify(n):String(n);s.trim()&&t.append(a,s)}),t.toString()}});console.log("phishingAxiosInstance>>>","https://platform.socbyte.ai/api/phishing"),l.interceptors.request.use(e=>{e.withCredentials=!0;try{{let t=localStorage.getItem("sb:lastActivityAtMs"),a=t?Number(t):NaN;Number.isFinite(a)&&Date.now()-a<15e3&&(e.headers=e.headers||{},e.headers["X-SB-User-Active"]="1")}}catch(e){}return e}),l.interceptors.response.use(e=>e,e=>{var t,a,n;return(null==(t=e.response)?void 0:t.status)===403&&s.oR.error(null==(n=e.response)||null==(a=n.data)?void 0:a.message),Promise.reject(e)});let r=l},57518:(e,t,a)=>{a.d(t,{B8:()=>_,UC:()=>A,av:()=>k,bL:()=>N,l9:()=>T});var n=a(12115),s=a(70379),l=a(68599),r=a(83478),i=a(83935),o=a(99354),c=a(1933),d=a(98979),u=a(89971),p=a(95155),m="Tabs",[g,v]=(0,l.A)(m,[r.RG]),f=(0,r.RG)(),[h,x]=g(m),y=n.forwardRef((e,t)=>{let{__scopeTabs:a,value:n,onValueChange:s,defaultValue:l,orientation:r="horizontal",dir:i,activationMode:g="automatic",...v}=e,f=(0,c.jH)(i),[x,y]=(0,d.i)({prop:n,onChange:s,defaultProp:null!=l?l:"",caller:m});return(0,p.jsx)(h,{scope:a,baseId:(0,u.B)(),value:x,onValueChange:y,orientation:r,dir:f,activationMode:g,children:(0,p.jsx)(o.sG.div,{dir:f,"data-orientation":r,...v,ref:t})})});y.displayName=m;var j="TabsList",b=n.forwardRef((e,t)=>{let{__scopeTabs:a,loop:n=!0,...s}=e,l=x(j,a),i=f(a);return(0,p.jsx)(r.bL,{asChild:!0,...i,orientation:l.orientation,dir:l.dir,loop:n,children:(0,p.jsx)(o.sG.div,{role:"tablist","aria-orientation":l.orientation,...s,ref:t})})});b.displayName=j;var C="TabsTrigger",S=n.forwardRef((e,t)=>{let{__scopeTabs:a,value:n,disabled:l=!1,...i}=e,c=x(C,a),d=f(a),u=D(c.baseId,n),m=F(c.baseId,n),g=n===c.value;return(0,p.jsx)(r.q7,{asChild:!0,...d,focusable:!l,active:g,children:(0,p.jsx)(o.sG.button,{type:"button",role:"tab","aria-selected":g,"aria-controls":m,"data-state":g?"active":"inactive","data-disabled":l?"":void 0,disabled:l,id:u,...i,ref:t,onMouseDown:(0,s.mK)(e.onMouseDown,e=>{l||0!==e.button||!1!==e.ctrlKey?e.preventDefault():c.onValueChange(n)}),onKeyDown:(0,s.mK)(e.onKeyDown,e=>{[" ","Enter"].includes(e.key)&&c.onValueChange(n)}),onFocus:(0,s.mK)(e.onFocus,()=>{let e="manual"!==c.activationMode;g||l||!e||c.onValueChange(n)})})})});S.displayName=C;var w="TabsContent",k=n.forwardRef((e,t)=>{let{__scopeTabs:a,value:s,forceMount:l,children:r,...c}=e,d=x(w,a),u=D(d.baseId,s),m=F(d.baseId,s),g=s===d.value,v=n.useRef(g);return n.useEffect(()=>{let e=requestAnimationFrame(()=>v.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,p.jsx)(i.C,{present:l||g,children:a=>{let{present:n}=a;return(0,p.jsx)(o.sG.div,{"data-state":g?"active":"inactive","data-orientation":d.orientation,role:"tabpanel","aria-labelledby":u,hidden:!n,id:m,tabIndex:0,...c,ref:t,style:{...e.style,animationDuration:v.current?"0s":void 0},children:n&&r})}})});function D(e,t){return"".concat(e,"-trigger-").concat(t)}function F(e,t){return"".concat(e,"-content-").concat(t)}k.displayName=w;var N=y,_=b,T=S,A=k},67842:(e,t,a)=>{a.d(t,{A3:()=>l,DB:()=>h,J:()=>p,Nz:()=>f,Ym:()=>g,bD:()=>i,cS:()=>r,j8:()=>m,lD:()=>d,ll:()=>o,o3:()=>v,uH:()=>u,yc:()=>c});var n=a(13130),s=a(34686);let l=async(e,t)=>{var a,l,r;try{let l={...Object.fromEntries(Object.entries(e).filter(e=>{let[,t]=e;return null!=t&&("string"!=typeof t||""!==t.trim())&&(Array.isArray(t)?t.length>0:"object"!=typeof t||Object.keys(t).length>0)}))},r=(0,s.jN)(t);void 0===l.requestedTenant&&Array.isArray(r)&&r.length>0&&(l.requestedTenant=r),"object"==typeof l.fieldSearch&&null!==l.fieldSearch&&(l.fieldSearch=JSON.stringify(l.fieldSearch));let i=await n.A.get("/get_list_deepfake_personas",{params:l});return{success:!0,...null==i||null==(a=i.data)?void 0:a.data}}catch(e){return{success:!1,message:(null==e||null==(r=e.response)||null==(l=r.data)?void 0:l.message)||"Failed to fetch deepfake persona list"}}},r=async(e,t)=>{try{let a={};return null!=e&&(a.requestedTenant=String(e)),(await n.A.post("/create_deepfake_persona",t,Object.keys(a).length?{params:a}:{})).data}catch(e){var a;return null==e||null==(a=e.response)?void 0:a.data}},i=async(e,t)=>{try{let a=await n.A.put("/update_deepfake_persona/".concat(e),t);return{success:!0,...a.data}}catch(e){var a,s;return{success:!1,message:(null==e||null==(s=e.response)||null==(a=s.data)?void 0:a.message)||"Failed to update deepfake persona"}}},o=async e=>{try{return(await n.A.delete("/delete_deepfake_persona/".concat(e))).data}catch(e){var t;return null==e||null==(t=e.response)?void 0:t.data}},c=async(e,t)=>{var a,l,r;try{let l={...Object.fromEntries(Object.entries(e).filter(e=>{let[,t]=e;return null!=t&&("string"!=typeof t||""!==t.trim())&&(Array.isArray(t)?t.length>0:"object"!=typeof t||Object.keys(t).length>0)}))},r=(0,s.jN)(t);void 0===l.requestedTenant&&Array.isArray(r)&&r.length>0&&(l.requestedTenant=r),"object"==typeof l.fieldSearch&&null!==l.fieldSearch&&(l.fieldSearch=JSON.stringify(l.fieldSearch));let i=await n.A.get("/get_list_deepfake_replicas",{params:l});return{success:!0,...null==i||null==(a=i.data)?void 0:a.data}}catch(e){return{success:!1,message:(null==e||null==(r=e.response)||null==(l=r.data)?void 0:l.message)||"Failed to fetch deepfake replica list"}}},d=async e=>{try{let t=new FormData;return t.append("video",e),(await n.A.post("/upload_replica_video",t)).data}catch(e){var t;return null==e||null==(t=e.response)?void 0:t.data}},u=async(e,t)=>{try{let a={};return null!=e&&(a.requestedTenant=String(e)),(await n.A.post("/create_deepfake_replica",t,Object.keys(a).length?{params:a}:{})).data}catch(e){var a;return null==e||null==(a=e.response)?void 0:a.data}},p=async(e,t)=>{try{let a=await n.A.put("/update_deepfake_replica/".concat(e),t);return{success:!0,...a.data}}catch(e){var a,s;return{success:!1,message:(null==e||null==(s=e.response)||null==(a=s.data)?void 0:a.message)||"Failed to update deepfake replica"}}},m=async e=>{try{return(await n.A.delete("/delete_deepfake_replica/".concat(e))).data}catch(e){var t;return null==e||null==(t=e.response)?void 0:t.data}},g=async(e,t)=>{var a,l,r;try{let l={...Object.fromEntries(Object.entries(e).filter(e=>{let[,t]=e;return null!=t&&("string"!=typeof t||""!==t.trim())&&(!Array.isArray(t)||t.length>0)}))},r=(0,s.jN)(t);void 0===l.requestedTenant&&Array.isArray(r)&&r.length>0&&(l.requestedTenant=r);let i=await n.A.get("/get_list_deepfake_voices",{params:l});return{success:!0,...null==i||null==(a=i.data)?void 0:a.data}}catch(e){return{success:!1,message:(null==e||null==(r=e.response)||null==(l=r.data)?void 0:l.message)||"Failed to fetch deepfake voice list"}}},v=async(e,t)=>{try{let a={};null!=e&&(a.requestedTenant=String(e));let s=t;if(t.audio_file){let e=new FormData;
1e.append("voice_name",t.voice_name),e.append("audio_file",t.audio_file),t.description&&e.append("description",t.description),s=e}return(await n.A.post("/create_deepfake_voice",s,Object.keys(a).length?{params:a}:{})).data}catch(e){var a;return null==e||null==(a=e.response)?void 0:a.data}},f=async(e,t)=>{try{let a=await n.A.put("/update_deepfake_voice/".concat(e,"/"),t);return{success:!0,...a.data}}catch(e){var a,s;return{success:!1,message:(null==e||null==(s=e.response)||null==(a=s.data)?void 0:a.message)||"Failed to update deepfake voice"}}},h=async e=>{try{return(await n.A.delete("/delete_deepfake_voice/".concat(e,"/"))).data}catch(e){var t;return null==e||null==(t=e.response)?void 0:t.data}}},74331:(e,t,a)=>{a.d(t,{Xi:()=>c,av:()=>d,j7:()=>o,tU:()=>i});var n=a(95155);a(12115);var s=a(57518),l=a(40980),r=a(45981);function i(e){let{className:t,...a}=e;return(0,n.jsx)(s.bL,{"data-slot":"tabs",className:(0,l.cn)("flex flex-col gap-2",t),...a,"data-sentry-element":"TabsPrimitive.Root","data-sentry-component":"Tabs","data-sentry-source-file":"tabs.tsx"})}function o(e){let{className:t,...a}=e;return(0,n.jsx)(s.B8,{"data-slot":"tabs-list",className:(0,l.cn)("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[0px]",t),...a,"data-sentry-element":"TabsPrimitive.List","data-sentry-component":"TabsList","data-sentry-source-file":"tabs.tsx"})}function c(e){let{className:t,children:a,...i}=e,o=(0,r.R_)();return(0,n.jsx)(s.l9,{"data-slot":"tabs-trigger",className:(0,l.cn)("data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 !cursor-pointer items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm dark:data-[state=active]:bg-[var(--primary)] [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...i,"data-sentry-element":"TabsPrimitive.Trigger","data-sentry-component":"TabsTrigger","data-sentry-source-file":"tabs.tsx",children:o(a)})}function d(e){let{className:t,...a}=e;return(0,n.jsx)(s.UC,{"data-slot":"tabs-content",className:(0,l.cn)("flex-1 outline-none",t),...a,"data-sentry-element":"TabsPrimitive.Content","data-sentry-component":"TabsContent","data-sentry-source-file":"tabs.tsx"})}},93601:(e,t,a)=>{a.r(t),a.d(t,{default:()=>I});var n=a(95155),s=a(12115),l=a(65957),r=a(15007),i=a(80069);let o=(0,a(98422).A)("outline","masks-theater","MasksTheater",[["path",{d:"M13.192 9h6.616a2 2 0 0 1 1.992 2.183l-.567 6.182a4 4 0 0 1 -3.983 3.635h-1.5a4 4 0 0 1 -3.983 -3.635l-.567 -6.182a2 2 0 0 1 1.992 -2.183",key:"svg-0"}],["path",{d:"M15 13h.01",key:"svg-1"}],["path",{d:"M18 13h.01",key:"svg-2"}],["path",{d:"M15 16.5c1 .667 2 .667 3 0",key:"svg-3"}],["path",{d:"M8.632 15.982a4.037 4.037 0 0 1 -.382 .018h-1.5a4 4 0 0 1 -3.983 -3.635l-.567 -6.182a2 2 0 0 1 1.992 -2.183h6.616a2 2 0 0 1 2 2",key:"svg-4"}],["path",{d:"M6 8h.01",key:"svg-5"}],["path",{d:"M9 8h.01",key:"svg-6"}],["path",{d:"M6 12c.764 -.51 1.528 -.63 2.291 -.36",key:"svg-7"}]]);var c=a(70747),d=a(37911),u=a(20363),p=a(12877),m=a(73344),g=a(25475),v=a(8213),f=a(73124),h=a(60002),x=a(3134),y=a(33936),j=a(51588),b=a(60285),C=a(57828),S=a(31376),w=a(22980),k=a(45981),D=a(14749),F=a(76426),N=a(74331),_=a(67842);function T(){let{user:e}=(0,w.J)(),{t}=(0,k.Jl)("administration"),a=(null==e?void 0:e.tenantType)==="customer",[o,N]=(0,s.useState)([]),[T,A]=(0,s.useState)(!1),[I,V]=(0,s.useState)(null),[R,q]=(0,s.useState)({pageIndex:0,pageSize:10}),[M,O]=(0,s.useState)(0),[E,P]=(0,s.useState)([]),[z,B]=(0,s.use
1State)(!1),[U,L]=(0,s.useState)(!0),[J,K]=(0,s.useState)(""),[$,G]=(0,s.useState)(""),[H,X]=(0,s.useState)(!1),[Q,W]=(0,s.useState)(!1),[Y,Z]=(0,s.useState)(null),[ee,et]=(0,s.useState)(""),[ea,en]=(0,s.useState)("new"),[es,el]=(0,s.useState)(""),[er,ei]=(0,s.useState)(""),[eo,ec]=(0,s.useState)(""),[ed,eu]=(0,s.useState)(null),[ep,em]=(0,s.useState)(!1),[eg,ev]=(0,s.useState)({}),[ef,eh]=(0,s.useState)(!1),[ex,ey]=(0,s.useState)(null),ej=(0,s.useMemo)(()=>({tenantType:"customer"}),[]),eb=async()=>{try{A(!0),V(null);let n=await (0,_.yc)({page:R.pageIndex+1,size:R.pageSize,search:$.trim()?$.trim():void 0},e);if(n&&!1!==n.success){var t,a;let e=null!=(t=null==n?void 0:n.data)?t:[],s=null!=(a=null==n?void 0:n.total)?a:e.length;N(e),O(s)}else V((null==n?void 0:n.message)||"Failed to fetch replicas"),N([]),O(0)}catch(e){V((null==e?void 0:e.message)||"Failed to fetch replicas"),N([]),O(0)}finally{A(!1)}};(0,s.useEffect)(()=>{eb(),B(!1)},[R.pageIndex,R.pageSize,z,$]),(0,s.useEffect)(()=>{if(!H)return void et("");if(a){var t;et(String(null!=(t=null==e?void 0:e.tenantId)?t:""))}else Q||et("")},[a,Q,H,null==e?void 0:e.tenantId]);let eC=a?null==e?void 0:e.tenantId:ee||"",eS=()=>{X(!1),W(!1),Z(null),et(""),en("new"),el(""),ei(""),ec(""),eu(null),ev({})},ew="new"===ea,ek=async()=>{var e,t,n,s;let l,r={tenant:!Q&&!a&&!ee,idValue:"existing"===ea&&!es.trim(),nameValue:!er.trim(),trainVideo:ew&&!eo.trim()&&!ed};if(ev(r),Object.values(r).some(Boolean))return void S.toast.error("Please fill in all required fields");if(ew)if(ed){em(!0);let a=await (0,_.lD)(ed);if(em(!1),l=(null==a||null==(e=a.data)?void 0:e.url)||(null==a||null==(t=a.data)?void 0:t.train_video_url)||(null==a?void 0:a.url)||(null==a?void 0:a.train_video_url),!(null==a?void 0:a.success)||!l)return void S.toast.error((null==a?void 0:a.message)||"Failed to upload training video")}else eo.trim()&&(l=eo.trim());let i={replica_name:er};"existing"===ea&&es.trim()&&(i.replica_id=es.trim()),l&&(i.train_video_url=l);try{if(Q&&Y){let e=await (0,_.J)(Y,i);(null==e?void 0:e.success)?(S.toast.success((null==e?void 0:e.message)||"Replica updated successfully"),eS(),B(!0)):S.toast.error((null==e?void 0:e.message)||"Failed to update replica")}else{let e=await (0,_.uH)(eC||null,i);(null==e?void 0:e.success)?(S.toast.success((null==e?void 0:e.message)||"Replica created successfully"),eS(),B(!0)):S.toast.error((null==e?void 0:e.message)||"Failed to create replica")}}catch(e){S.toast.error((null==e||null==(s=e.response)||null==(n=s.data)?void 0:n.message)||(null==e?void 0:e.message)||"Failed to save replica")}},eD=(0,s.useMemo)(()=>[{accessorKey:"replica_name",header:e=>{let{column:t}=e;return(0,n.jsx)(y.w,{column:t,title:"Replica Name"})},cell:e=>{let{cell:t}=e;return t.getValue()}},{accessorKey:"replica_id",header:e=>{let{column:t}=e;return(0,n.jsx)(y.w,{column:t,title:"Replica ID"})},cell:e=>{let{cell:t}=e;return t.getValue()}},{accessorKey:"tenant_name",header:e=>{let{column:t}=e;return(0,n.jsx)(y.w,{column:t,title:"Tenant"})},cell:e=>{let{cell:t}=e;return t.getValue()}},{accessorKey:"is_active",header:e=>{let{column:t}=e;return(0,n.jsx)(y.w,{column:t,title:"Status"})},cell:e=>{let{cell:t}=e,a=t.getValue();return(0,n.jsx)("span",{className:"capitalize ".concat(a?"text-green-500":"text-red-500"),children:a?"Active":"Inactive"})}},{id:"actions",header:()=>(0,n.jsx)("div",{className:"text-center",children:"Actions"}),cell:e=>{let{row:a}=e,s=a.original;return(0,n.jsx)("div",{className:"flex justify-center",children:(0,n.jsxs)(j.rI,{children:[(0,n.jsx)(j.ty,{asChild:!0,children:(0,n.jsx)(c.$,{className:"h-8 w-8 bg-transparent p-0 hover:bg-transparent",children:(0,n.jsx)(b.A,{className:"h-4 w-4"})})}),(0,n.jsxs)(j.SQ,{align:"end",children:[(0,n.jsxs)(j._2,{onClick:()=>{W(!0),Z(s.id);let e=s.replica_id||"";el(e),en(e?"existing":"new"),ei(s.replica_name||""),ec(""),eu(null),s.tenant&&et(s.tenant),X(!0)},children:[(0,n.jsx)(l.A,{className:"h-4 w-4 text-[var(--editIcon)]"}),t("Edit")]}),(0,n.jsxs)(j._2,{onClick:()=>{ey(s),eh(!0)},children:[(0,n.jsx)(r.A,{className:"h-4 w-4 text-[var(--deleteIcon)]"}),t("Delete")]})]})]})})}}],[t]),eF=(0,h.N4)({data:o,columns:eD,getCoreRowModel:(0,x.HT)(),getPaginationRowModel:(0,x.kW)(),getSortedRowModel:(0,x.h5)(),onPaginationChange:q,onSortingChange:P,manualPagination:!0,pageCount:M>0?Math.ceil(M/R.pageSize):1,meta:{totalRows:M},state:{pagination:R,sorting:E}});return(0,n.jsxs)("div",{className:"space-y-3","data-sentry-component":"ReplicaSection","data-sentry-source-file":"DeepFakeConfig.tsx",children:[(0,n.jsxs)("div",{className:"mb-3 flex items-center justify-between",children:[(0,n.jsxs)(c.$,{onClick:()=>X(!0),"data-sentry-element":"Button","data-sentry-source-file":"DeepFakeConfig.tsx",children:[(0,n.jsx)(i.A,{className:"!h-6 !w-6 text-white","data-sentry-element":"IconPlus","data-sentry-source-file":"DeepFakeConfig.tsx"}),(0,n.jsx)("span",{className:"text-sm font-medium text-gray-100",children:"New Replica"})]}),(0,n.jsx)(F.i,{searchOpen:U,onToggleOpen:()=>L(e=>!e),searchInput:J,onSearchInputChange:K,onSearch:()=>{J.trim()&&(G(J),q(e=>({...e,pageIndex:0})))},onClear:()=>{K(""),G(""),q(e=>({...e,pageIndex:0}))},onEmptied:()=>
1{G(""),q(e=>({...e,pageIndex:0}))},placeholder:"Search replicas...","data-sentry-element":"TableSearchBox","data-sentry-source-file":"DeepFakeConfig.tsx"})]}),T?(0,n.jsx)(v.O,{columnCount:5,rowCount:5,withPagination:!0}):(0,n.jsx)(f.b,{table:eF}),(0,n.jsx)(d.a,{heading:Q?"Edit Replica":"New Replica",open:H,onOpenChange:e=>e?X(!0):eS(),showClose:!0,"data-sentry-element":"Modal","data-sentry-source-file":"DeepFakeConfig.tsx",children:(0,n.jsxs)("div",{className:"space-y-4",children:[!a&&!Q&&(0,n.jsx)(D.F,{id:"deepfake-replica-tenant-select",label:"Tenant",placeholder:"Select a tenant",fetchParams:ej,value:ee,onValueChange:e=>{et(e),e&&ev(e=>({...e,tenant:!1}))},required:!0,error:eg.tenant?"Tenant is required":void 0}),(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)(u.J,{htmlFor:"replica-mode","data-sentry-element":"Label","data-sentry-source-file":"DeepFakeConfig.tsx",children:"Mode"}),(0,n.jsxs)(g.l6,{value:ea,onValueChange:e=>en(e),disabled:Q,"data-sentry-element":"Select","data-sentry-source-file":"DeepFakeConfig.tsx",children:[(0,n.jsx)(g.bq,{id:"replica-mode",className:"w-full","data-sentry-element":"SelectTrigger","data-sentry-source-file":"DeepFakeConfig.tsx",children:(0,n.jsx)(g.yv,{placeholder:"Select mode","data-sentry-element":"SelectValue","data-sentry-source-file":"DeepFakeConfig.tsx"})}),(0,n.jsxs)(g.gC,{"data-sentry-element":"SelectContent","data-sentry-source-file":"DeepFakeConfig.tsx",children:[(0,n.jsx)(g.eb,{value:"new","data-sentry-element":"SelectItem","data-sentry-source-file":"DeepFakeConfig.tsx",children:"Trigger New Training"}),(0,n.jsx)(g.eb,{value:"existing","data-sentry-element":"SelectItem","data-sentry-source-file":"DeepFakeConfig.tsx",children:"Register Existing"})]})]})]}),(0,n.jsx)(m.D,{id:"replica-name",label:"Replica Name",placeholder:"Enter Replica Name",required:!0,value:er,onChange:e=>{ei(e.target.value),e.target.value.trim()&&ev(e=>({...e,nameValue:!1}))},error:eg.nameValue?"Replica Name is required":void 0,"data-sentry-element":"ValidatedInput","data-sentry-source-file":"DeepFakeConfig.tsx"}),"existing"===ea&&(0,n.jsx)(m.D,{id:"replica-id",label:"Replica ID",placeholder:"Enter Replica ID",required:!0,value:es,onChange:e=>{el(e.target.value),e.target.value.trim()&&ev(e=>({...e,idValue:!1}))},error:eg.idValue?"Replica ID is required":void 0}),ew&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(m.D,{id:"replica-train-video-url",label:"Training Video URL (optional)",placeholder:"https://cdn.example.com/training.mp4",value:eo,onChange:e=>{ec(e.target.value),e.target.value.trim()&&ev(e=>({...e,trainVideo:!1}))}}),(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)(u.J,{htmlFor:"replica-train-video",children:"Or Upload Training Video (optional)"}),(0,n.jsx)(p.p,{id:"replica-train-video",type:"file",accept:"video/*",disabled:ep,onChange:e=>{var t;let a=(null==(t=e.target.files)?void 0:t[0])||null;eu(a),a&&ev(e=>({...e,trainVideo:!1}))},className:eg.trainVideo?"border-red-500":""}),eg.trainVideo&&(0,n.jsx)("p",{className:"text-xs text-red-400",children:"Provide a training video URL or upload a file"})]})]}),(0,n.jsx)("div",{className:"flex justify-end space-y-2",children:(0,n.jsx)(c.$,{onClick:ek,disabled:ep,"data-sentry-element":"Button","data-sentry-source-file":"DeepFakeConfig.tsx",children:ep?"Uploading video...":Q?"Update":"Create"})})]})}),(0,n.jsx)(C.T,{open:ef,onOpenChange:eh,title:"Are you sure?",description:"This will permanently delete the replica '".concat(null==ex?void 0:ex.replica_name,"'. This action cannot be undone."),confirmText:"Delete",cancelText:"Cancel",variant:"destructive",onConfirm:async()=>{if(ex)try{let e=await (0,_.j8)(ex.id);(null==e?void 0:e.success)!==!1?(S.toast.success((null==e?void 0:e.message)||"Replica deleted successfully"),ey(null),eh(!1),await eb()):S.toast.error((null==e?void 0:e.message)||"Failed to delete replica")}catch(e){S.toast.error((null==e?void 0:e.message)||"Failed to delete replica")}},"data-sentry-element":"ConfirmDialog","data-sentry-source-file":"DeepFakeConfig.tsx"})]})}function A(){let{user:e}=(0,w.J)(),{t}=(0,k.Jl)("administration"),a=(null==e?void 0:e.tenantType)==="customer",[o,N]=(0,s.use
1State)([]),[T,A]=(0,s.useState)(!1),[I,V]=(0,s.useState)(null),[R,q]=(0,s.useState)({pageIndex:0,pageSize:10}),[M,O]=(0,s.useState)(0),[E,P]=(0,s.useState)([]),[z,B]=(0,s.useState)(!1),[U,L]=(0,s.useState)(!0),[J,K]=(0,s.useState)(""),[$,G]=(0,s.useState)(""),[H,X]=(0,s.useState)(!1),[Q,W]=(0,s.useState)(!1),[Y,Z]=(0,s.useState)(null),[ee,et]=(0,s.useState)(""),[ea,en]=(0,s.useState)("new"),[es,el]=(0,s.useState)(""),[er,ei]=(0,s.useState)(""),[eo,ec]=(0,s.useState)(""),[ed,eu]=(0,s.useState)("url"),[ep,em]=(0,s.useState)(""),[eg,ev]=(0,s.useState)(null),[ef,eh]=(0,s.useState)(!1),[ex,ey]=(0,s.useState)({}),[ej,eb]=(0,s.useState)(!1),[eC,eS]=(0,s.useState)(null),ew=(0,s.useMemo)(()=>({tenantType:"customer"}),[]),ek=async()=>{try{A(!0),V(null);let n=await (0,_.Ym)({page:R.pageIndex+1,size:R.pageSize,search:$.trim()?$.trim():void 0},e);if(n&&!1!==n.success){var t,a;let e=null!=(t=null==n?void 0:n.data)?t:[],s=null!=(a=null==n?void 0:n.total)?a:e.length;N(e),O(s)}else V((null==n?void 0:n.message)||"Failed to fetch custom voices"),N([]),O(0)}catch(e){V((null==e?void 0:e.message)||"Failed to fetch custom voices"),N([]),O(0)}finally{A(!1)}};(0,s.useEffect)(()=>{ek(),B(!1)},[R.pageIndex,R.pageSize,z,$]),(0,s.useEffect)(()=>{if(!H)return void et("");if(a){var t;et(String(null!=(t=null==e?void 0:e.tenantId)?t:""))}else Q||et("")},[a,Q,H,null==e?void 0:e.tenantId]);let eD=a?null==e?void 0:e.tenantId:ee||"",eF=()=>{X(!1),W(!1),Z(null),et(""),en("new"),el(""),ei(""),ec(""),eu("url"),em(""),ev(null),ey({})},eN="new"===ea,e_=async()=>{let e={tenant:!Q&&!a&&!ee,idValue:"existing"===ea&&!es.trim(),nameValue:!er.trim(),trainAudio:eN&&("file"===ed?!eg:!ep.trim())};if(ey(e),Object.values(e).some(Boolean))return void S.toast.error("Please fill in all required fields");let t={voice_name:er};eo.trim()&&(t.description=eo.trim()),"existing"===ea&&es.trim()&&(t.voice_id=es.trim()),eN&&("file"===ed&&eg?t.audio_file=eg:"url"===ed&&ep.trim()&&(t.training_audio_url=ep.trim())),eh(!0);try{if(Q&&Y){let e=await (0,_.Nz)(Y,t);(null==e?void 0:e.success)?(S.toast.success((null==e?void 0:e.message)||"Custom voice updated successfully"),eF(),B(!0)):S.toast.error((null==e?void 0:e.message)||"Failed to update custom voice")}else{let e=await (0,_.o3)(eD||null,t);(null==e?void 0:e.success)?(S.toast.success((null==e?void 0:e.message)||"Custom voice created successfully"),eF(),B(!0)):S.toast.error((null==e?void 0:e.message)||"Failed to create custom voice")}}catch(e){var n,s;S.toast.error((null==e||null==(s=e.response)||null==(n=s.data)?void 0:n.message)||(null==e?void 0:e.message)||"Failed to save custom voice")}finally{eh(!1)}},eT=(0,s.useMemo)(()=>[{accessorKey:"voice_name",header:e=>{let{column:t}=e;return(0,n.jsx)(y.w,{column:t,title:"Voice Name"})},cell:e=>{let{cell:t}=e;return t.getValue()}},{accessorKey:"voice_id",header:e=>{let{column:t}=e;return(0,n.jsx)(y.w,{column:t,title:"Voice ID"})},cell:e=>{let{cell:t}=e;return t.getValue()}},{accessorKey:"tenant_name",header:e=>{let{column:t}=e;return(0,n.jsx)(y.w,{column:t,title:"Tenant"})},cell:e=>{let{cell:t}=e;return t.getValue()}},{accessorKey:"tavus_status",header:e=>{let{column:t}=e;return(0,n.jsx)(y.w,{column:t,title:"Training Status"})},cell:e=>{let{cell:t}=e;return(0,n.jsx)("span",{className:"capitalize",children:t.getValue()||"-"})}},{accessorKey:"is_active",header:e=>{let{column:t}=e;return(0,n.jsx)(y.w,{column:t,title:"Status"})},cell:e=>{let{cell:t}=e,a=t.getValue();return(0,n.jsx)("span",{className:"capitalize ".concat(a?"text-green-500":"text-red-500"),children:a?"Active":"Inactive"})}},{id:"actions",header:()=>(0,n.jsx)("div",{className:"text-center",children:"Actions"}),cell:e=>{let{row:a}=e,s=a.original;return(0,n.jsx)("div",{className:"flex justify-center",children:(0,n.jsxs)(j.rI,{children:[(0,n.jsx)(j.ty,{asChild:!0,children:(0,n.jsx)(c.$,{className:"h-8 w-8 bg-transparent p-0 hover:bg-transparent",children:(0,n.jsx)(b.A,{className:"h-4 w-4"})})}),(0,n.jsxs)(j.SQ,{align:"end",children:[(0,n.jsxs)(j._2,{onClick:()=>{W(!0),Z(s.id);let e=s.voice_id||"";el(e),en(e?"existing":"new"),ei(s.voice_name||""),ec(s.description||""),eu("url"),em(""),ev(null),s.tenant&&et(s.tenant),X(!0)},children:[(0,n.jsx)(l.A,{className:"h-4 w-4 text-[var(--editIcon)]"}),t("Edit")]}),(0,n.jsxs)(j._2,{onClick:()=>{eS(s),eb(!0)},children:[(0,n.jsx)(r.A,{className:"h-4 w-4 text-[var(--deleteIcon)]"}),t("Delete")]})]})]})})}}],[t]),eA=(0,h.N4)({data:o,columns:eT,getCoreRowModel:(0,x.HT)(),getPaginationRowModel:(0,x.kW)(),getSortedRowModel:(0,x.h5)(),onPaginationChange:q,onSortingChange:P,manualPagination:!0,pageCount:M>0?Math.ceil(M/R.pageSize):1,meta:{totalRows:M},state:{pagination:R,sorting:E}});return(0,n.jsxs)("div",{className:"space-y-3","data-sentry-component":"CustomVoicesSection","data-sentry-source-file":"DeepFakeConfig.tsx",children:[(0,n.jsxs)("div",{className:"mb-3 flex items-center justify-between",children:[(0,n.jsxs)(c.$,{onClick:()=>X(!0),"data-sentry-element":"Button","data-sentry-source-file":"DeepFakeConfig.tsx",children:[(0,n.jsx)(i.A,{className:"!h-6 !w-6 text-white","data-sentry-element":"IconPlus","data-sentry-source-file":"DeepFakeConfig.tsx"}),(0,n.jsx)("span",{className:"text-sm font-medium text-gray-100",children:"New Custom Voice"})]}),(0,n.jsx)(F.i,{searchOpen:U,onToggleOpen:()=>L(e=>!e),searchInput:J,onSearchInputChange:K,onSearch:()=>{J.trim()&&(G(J),q(e=>({...e,pageIndex:0})))},onClear:()=>{K(""),G(""),q(e=>({...e,pageIndex:0}))},onEmptied:()=>
1{G(""),q(e=>({...e,pageIndex:0}))},placeholder:"Search custom voices...","data-sentry-element":"TableSearchBox","data-sentry-source-file":"DeepFakeConfig.tsx"})]}),T?(0,n.jsx)(v.O,{columnCount:6,rowCount:5,withPagination:!0}):(0,n.jsx)(f.b,{table:eA}),(0,n.jsx)(d.a,{heading:Q?"Edit Custom Voice":"New Custom Voice",open:H,onOpenChange:e=>e?X(!0):eF(),showClose:!0,"data-sentry-element":"Modal","data-sentry-source-file":"DeepFakeConfig.tsx",children:(0,n.jsxs)("div",{className:"space-y-4",children:[!a&&!Q&&(0,n.jsx)(D.F,{id:"deepfake-voice-tenant-select",label:"Tenant",placeholder:"Select a tenant",fetchParams:ew,value:ee,onValueChange:e=>{et(e),e&&ey(e=>({...e,tenant:!1}))},required:!0,error:ex.tenant?"Tenant is required":void 0}),(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)(u.J,{htmlFor:"voice-mode","data-sentry-element":"Label","data-sentry-source-file":"DeepFakeConfig.tsx",children:"Mode"}),(0,n.jsxs)(g.l6,{value:ea,onValueChange:e=>en(e),disabled:Q,"data-sentry-element":"Select","data-sentry-source-file":"DeepFakeConfig.tsx",children:[(0,n.jsx)(g.bq,{id:"voice-mode",className:"w-full","data-sentry-element":"SelectTrigger","data-sentry-source-file":"DeepFakeConfig.tsx",children:(0,n.jsx)(g.yv,{placeholder:"Select mode","data-sentry-element":"SelectValue","data-sentry-source-file":"DeepFakeConfig.tsx"})}),(0,n.jsxs)(g.gC,{"data-sentry-element":"SelectContent","data-sentry-source-file":"DeepFakeConfig.tsx",children:[(0,n.jsx)(g.eb,{value:"new","data-sentry-element":"SelectItem","data-sentry-source-file":"DeepFakeConfig.tsx",children:"Create New Voice"}),(0,n.jsx)(g.eb,{value:"existing","data-sentry-element":"SelectItem","data-sentry-source-file":"DeepFakeConfig.tsx",children:"Register Existing"})]})]})]}),(0,n.jsx)(m.D,{id:"voice-name",label:"Voice Name",placeholder:"Enter Voice Name",required:!0,value:er,onChange:e=>{ei(e.target.value),e.target.value.trim()&&ey(e=>({...e,nameValue:!1}))},error:ex.nameValue?"Voice Name is required":void 0,"data-sentry-element":"ValidatedInput","data-sentry-source-file":"DeepFakeConfig.tsx"}),"existing"===ea&&(0,n.jsx)(m.D,{id:"voice-id",label:"Voice ID",placeholder:"Enter Voice ID",required:!0,value:es,onChange:e=>{el(e.target.value),e.target.value.trim()&&ey(e=>({...e,idValue:!1}))},error:ex.idValue?"Voice ID is required":void 0}),eN&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)(u.J,{htmlFor:"voice-audio-source",children:"Training Audio Source"}),(0,n.jsxs)(g.l6,{value:ed,onValueChange:e=>{eu(e),em(""),ev(null),ey(e=>({...e,trainAudio:!1}))},children:[(0,n.jsx)(g.bq,{id:"voice-audio-source",className:"w-full",children:(0,n.jsx)(g.yv,{placeholder:"Select source"})}),(0,n.jsxs)(g.gC,{children:[(0,n.jsx)(g.eb,{value:"url",children:"Provide Audio URL"}),(0,n.jsx)(g.eb,{value:"file",children:"Upload Audio File"})]})]})]}),"url"===ed?(0,n.jsx)(m.D,{id:"voice-train-audio-url",label:"Training Audio URL",placeholder:"https://cdn.example.com/training.mp3",required:!0,value:ep,onChange:e=>{em(e.target.value),e.target.value.trim()&&ey(e=>({...e,trainAudio:!1}))},error:ex.trainAudio?"Training Audio URL is required":void 0}):(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)(u.J,{htmlFor:"voice-train-audio-file",children:"Training Audio File"}),(0,n.jsx)(p.p,{id:"voice-train-audio-file",type:"file",accept:".mp3,.wav,.m4a,.flac,.ogg,.oga,.webm,.mp4,.mov,audio/*,video/mp4,video/quicktime,video/webm",onChange:e=>{var t;let a=(null==(t=e.target.files)?void 0:t[0])||null;ev(a),a&&ey(e=>({...e,trainAudio:!1}))},className:ex.trainAudio?"border-red-500":""}),ex.trainAudio&&(0,n.jsx)("p",{className:"text-xs text-red-400",children:"Please upload a training audio file"}),(0,n.jsx)("p",{className:"text-muted-foreground text-xs",children:"mp3, wav, m4a, flac, ogg, oga, webm, mp4 or mov â max 100 MB"})]})]}),(0,n.jsx)(m.D,{id:"voice-description",label:"Description (optional)",placeholder:"Enter a description",value:eo,onChange:e=>ec(e.target.value),"data-sentry-element":"ValidatedInput","data-sentry-source-file":"DeepFakeConfig.tsx"}),(0,n.jsx)("div",{className:"flex justify-end space-y-2",children:(0,n.jsx)(c.$,{onClick:e_,disabled:ef,"data-sentry-element":"Button","data-sentry-source-file":"DeepFakeConfig.tsx",children:ef?"Saving...":Q?"Update":"Create"})})]})}),(0,n.jsx)(C.T,{open:ej,onOpenChange:eb,title:"Are you sure?",description:"This will permanently delete the custom voice '".concat(null==eC?void 0:eC.voice_name,"'. This action cannot be undone."),confirmText:"Delete",cancelText:"Cancel",variant:"destructive",onConfirm:async()=>
1{if(eC)try{let e=await (0,_.DB)(eC.id);(null==e?void 0:e.success)!==!1?(S.toast.success((null==e?void 0:e.message)||"Custom voice deleted successfully"),eS(null),eb(!1),await ek()):S.toast.error((null==e?void 0:e.message)||"Failed to delete custom voice")}catch(e){S.toast.error((null==e?void 0:e.message)||"Failed to delete custom voice")}},"data-sentry-element":"ConfirmDialog","data-sentry-source-file":"DeepFakeConfig.tsx"})]})}function I(){let{t:e}=(0,k.Jl)("administration"),[t,a]=(0,s.useState)(!1);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(c.$,{onClick:()=>a(!0),variant:"icon","data-sentry-element":"Button","data-sentry-source-file":"DeepFakeConfig.tsx",children:[(0,n.jsx)(o,{className:"text-primary !h-6 !w-6","data-sentry-element":"IconMasksTheater","data-sentry-source-file":"DeepFakeConfig.tsx"}),(0,n.jsx)("span",{className:"text-[11px] font-medium text-gray-100",children:e("Deepfake Config")})]}),(0,n.jsx)(d.a,{heading:"Deepfake Configuration",open:t,onOpenChange:a,showClose:!0,"data-sentry-element":"Modal","data-sentry-source-file":"DeepFakeConfig.tsx",children:(0,n.jsxs)(N.tU,{defaultValue:"replica","data-sentry-element":"Tabs","data-sentry-source-file":"DeepFakeConfig.tsx",children:[(0,n.jsxs)(N.j7,{className:"grid w-fit grid-cols-2","data-sentry-element":"TabsList","data-sentry-source-file":"DeepFakeConfig.tsx",children:[(0,n.jsx)(N.Xi,{value:"replica","data-sentry-element":"TabsTrigger","data-sentry-source-file":"DeepFakeConfig.tsx",children:"Replica"}),(0,n.jsx)(N.Xi,{value:"custom-voices","data-sentry-element":"TabsTrigger","data-sentry-source-file":"DeepFakeConfig.tsx",children:"Custom Voices"})]}),(0,n.jsx)(N.av,{value:"replica","data-sentry-element":"TabsContent","data-sentry-source-file":"DeepFakeConfig.tsx",children:(0,n.jsx)(T,{"data-sentry-element":"ReplicaSection","data-sentry-source-file":"DeepFakeConfig.tsx"})}),(0,n.jsx)(N.av,{value:"custom-voices","data-sentry-element":"TabsContent","data-sentry-source-file":"DeepFakeConfig.tsx",children:(0,n.jsx)(A,{"data-sentry-element":"CustomVoicesSection","data-sentry-source-file":"DeepFakeConfig.tsx"})})]})})]})}}}]);
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.