1import{r as c,ae as U,j as e,C as F,b1 as B,a4 as W,af as S,k as Y,aj as Q,p as O,au as q,a$ as X,b0 as J,ag as K,X as I,b2 as Z,a0 as ee,b3 as se}from"./vendor-react-CSjVeD5C.js";import{u as ae,a as te,t as V,B as _}from"./index-DCu_4ttF.js";import"./vendor-misc-DNIZ_o8-.js";import"./vendor-ui-BQCqNqg0.js";import"./vendor-charts-CTZ3m9kf.js";import"./vendor-ai-CwA6B3_0.js";function P({label:t}){return e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:40",className:"flex items-center gap-3 mb-4",children:[e.jsx("h2",{"data-loc":"client/src/pages/VoiceLab.tsx:41",className:"text-sm font-semibold text-foreground tracking-wide",children:t}),e.jsx("div",{"data-loc":"client/src/pages/VoiceLab.tsx:42",className:"flex-1 h-px bg-gradient-to-r from-[--color-rose-glow]/20 to-transparent"})]})}function M({children:t,className:r=""}){return e.jsx("div",{"data-loc":"client/src/pages/VoiceLab.tsx:51",className:`bg-[--color-surface-1] border border-border rounded-2xl p-5 ${r}`,children:t})}function ce({voice:t,isActive:r,onSelect:a,onDelete:l,onPreview:p,isPlaying:u}){const h={cloned:"text-[--color-rose-glow] bg-[--color-rose-dim] border-[--color-rose-glow]/20",premade:"text-[--color-violet-glow] bg-[--color-violet-dim] border-[--color-violet-glow]/20",generated:"text-emerald-400 bg-emerald-500/10 border-emerald-500/20",professional:"text-amber-400 bg-amber-500/10 border-amber-500/20"}[t.category]??"text-muted-foreground bg-muted/10 border-border";return e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:84",className:`relative bg-[--color-surface-2] border rounded-xl p-4 transition-all duration-200 cursor-pointer group ${r?"border-[--color-rose-glow]/60 shadow-[0_0_20px_var(--color-rose-dim)]":"border-border hover:border-[--color-rose-glow]/20"}`,onClick:a,children:[r&&e.jsx("div",{"data-loc":"client/src/pages/VoiceLab.tsx:93",className:"absolute top-3 right-3",children:e.jsx(q,{"data-loc":"client/src/pages/VoiceLab.tsx:94",className:"w-4 h-4 text-[--color-rose-glow]"})}),e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:98",className:"flex items-start gap-3",children:[e.jsx("div",{"data-loc":"client/src/pages/VoiceLab.tsx:99",className:`w-10 h-10 rounded-lg flex items-center justify-center shrink-0 ${r?"bg-[--color-rose-dim]":"bg-[--color-surface-1]"}`,children:e.jsx(Q,{"data-loc":"client/src/pages/VoiceLab.tsx:100",className:`w-5 h-5 ${r?"text-[--color-rose-glow]":"text-muted-foreground/40"}`})}),e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:102",className:"flex-1 min-w-0",children:[e.jsx("h3",{"data-loc":"client/src/pages/VoiceLab.tsx:103",className:"text-sm font-semibold text-foreground truncate",children:t.name}),e.jsx("span",{"data-loc":"client/src/pages/VoiceLab.tsx:104",className:`inline-block mt-1 text-[9px] px-1.5 py-0.5 rounded border ${h}`,children:t.category.toUpperCase()}),t.description&&e.jsx("p",{"data-loc":"client/src/pages/VoiceLab.tsx:108",className:"mt-1.5 text-[11px] text-muted-foreground line-clamp-2",children:t.description}),Object.keys(t.labels).length>0&&e.jsx("div",{"data-loc":"client/src/pages/VoiceLab.tsx:111",className:"flex flex-wrap gap-1 mt-2",children:Object.entries(t.labels).slice(0,3).map(([m,f])=>e.jsxs("span",{"data-loc":"client/src/pages/VoiceLab.tsx:113",className:"text-[8px] text-muted-foreground/60 bg-[--color-surface-1] px-1.5 py-0.5 rounded",children:[m,": ",f]},m))})]})]}),e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:122",className:"flex gap-2 mt-3 pt-3 border-t border-border",children:[t.previewUrl&&e.jsxs("button",{"data-loc":"client/src/pages/VoiceLab.tsx:124",onClick:m=>{m.stopPropagation(),p()},className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg bg-[--color-surface-1] hover:bg-[--color-surface-2] text-muted-foreground hover:text-foreground transition-colors text-[11px]",children:[u?e.jsx(X,{"data-loc":"client/src/pages/VoiceLab.tsx:128",className:"w-3 h-3"}):e.jsx(J,{"data-loc":"client/src/pages/VoiceLab.tsx:128",className:"w-3 h-3"}),u?"Stop":"Preview"]}),t.category==="cloned"&&e.jsxs("button",{"data-loc":"client/src/pages/VoiceLab.tsx:133",onClick:m=>{m.stopPropagation(),l()},className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg bg-[--color-surface-1] hover:bg-red-500/10 text-muted-foreground
1/40 hover:text-red-400 transition-colors text-[11px]",children:[e.jsx(K,{"data-loc":"client/src/pages/VoiceLab.tsx:137",className:"w-3 h-3"}),"Delete"]})]})]})}function oe(t){const r=t.name.toLowerCase(),a=t.category.toLowerCase(),l=Object.values(t.labels).join(" ").toLowerCase();return r.includes("kalpana")||r.includes("ashi")||r.includes("aishu")||a==="cloned"?"eleven_turbo_v2_5":a==="professional"&&(l.includes("narrat")||l.includes("audiobook"))?"eleven_v3":(l.includes("young")||l.includes("expressive")||l.includes("lively"),"eleven_turbo_v2_5")}function me(){const{user:t}=ae(),r=t?.role==="admin",{activeCharacter:a}=te(),l=a?.name||"your companion",[p,u]=c.useState(null),[x,h]=c.useState(null),[m,f]=c.useState(!1),[L,n]=c.useState(null),[j,N]=c.useState(!1),v=c.useRef(null),d=V.voice.userInfo.useQuery(),g=V.voice.listVoices.useQuery(),w=V.voice.listModels.useQuery(),k=V.voice.deleteVoice.useMutation({onSuccess:()=>g.refetch()}),T=V.character.update.useMutation(),b=V.voiceLab.getActivePref.useQuery({characterId:a?.id??0},{enabled:!!a?.id,staleTime:0}),C=V.voiceLab.getUserLanguage.useQuery(),[R,A]=c.useState("ta");V.voiceLab.setUserLanguage.useMutation({onSuccess:()=>U.success("Language preference saved"),onError:()=>U.error("Failed to save language preference")}),c.useEffect(()=>{b.data?.voiceId?u(b.data.voiceId):a?.voiceId&&u(a.voiceId)},[b.data?.voiceId,a?.voiceId]),c.useEffect(()=>{C.data?.language&&A(C.data.language)},[C.data?.language]);const D=c.useCallback((s,i)=>{if(x===i){v.current?.pause(),h(null);return}v.current&&v.current.pause();const y=new Audio(s);y.onended=()=>h(null),y.play(),v.current=y,h(i)},[x]),o=c.useCallback((s,i)=>{confirm(`Delete voice "${i}"? This cannot be undone.`)&&k.mutate({voiceId:s})},[k]);return e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:253",className:"flex flex-col min-h-full",children:[r&&e.jsx("div",{"data-loc":"client/src/pages/VoiceLab.tsx:256",className:"mx-6 mt-4 px-4 py-3 rounded-lg border border-amber-500/30 bg-amber-500/5",children:e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:257",className:"flex items-start gap-3",children:[e.jsx(F,{"data-loc":"client/src/pages/VoiceLab.tsx:258",className:"w-4 h-4 text-amber-400 mt-0.5 shrink-0"}),e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:259",children:[e.jsx("p",{"data-loc":"client/src/pages/VoiceLab.tsx:260",className:"text-xs font-medium text-amber-300",children:"V3 Agent Override Verification Required"}),e.jsxs("p",{"data-loc":"client/src/pages/VoiceLab.tsx:261",className:"text-[10px] text-amber-400/70 mt-1 leading-relaxed",children:["Go to ",e.jsx("a",{"data-loc":"client/src/pages/VoiceLab.tsx:262",href:"https://elevenlabs.io/app/conversational-ai",target:"_blank",rel:"noopener",className:"underline hover:text-amber-300",children:"ElevenLabs Dashboard"})," â AISHU_V3_Family agent â Settings â Security.",e.jsx("br",{"data-loc":"client/src/pages/VoiceLab.tsx:262"}),"Enable overrides for: ",e.jsx("span",{"data-loc":"client/src/pages/VoiceLab.tsx:263",className:"font-mono",children:"voice_id"}),", ",e.jsx("span",{"data-loc":"client/src/pages/VoiceLab.tsx:263",className:"font-mono",children:"system_prompt"}),", ",e.jsx("span",{"data-loc":"client/src/pages/VoiceLab.tsx:263",className:"font-mono",children:"first_message"}),"."]})]})]})}),e.jsx("div",{"data-loc":"client/src/pages/VoiceLab.tsx:271",className:"px-6 py-5 border-b border-border bg-[--color-surface-1]/50",children:e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:272",className:"flex items-center justify-between",children:[e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:273",children:[e.jsx("h1",{"data-loc":"client/src/pages/VoiceLab.tsx:274",className:"text-lg font-semibold text-foreground",children:"Voice Lab"}),e.jsxs("p",{"data-loc":"client/src/pages/VoiceLab.tsx:275",className:"text-xs text-muted-foreground mt-0.5",children:["Manage ",l,"'s voice â browse, clone, tune, and preview"]})]}),e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:279",className:"flex gap-2",children:[e.jsxs(_,{"data-loc":"client/src/pages/VoiceLab.tsx:280",variant:"outline",size:"sm",onClick:()=>N(!j),className:"text-xs",children:[e.jsx(B,{"data-loc":"client/src/pages/VoiceLab.tsx:286",className:"w-3.5 h-3.5 mr-1"}),"Test Voice"]}),e.jsxs(_,{"data-loc":"client/src/pages/VoiceLab.tsx:289",size:"sm",onClick:()=>f(!0),className:"bg-[--color-rose-glow] hover:bg-[--color-rose-glow]/80 text-white text-xs",children:[e.jsx(W,{"data-loc":"client/src/pages/VoiceLab.tsx:294",className:"w-3.5 h-3.5 mr-1"}),"Clone Voice"]})]})]})}),e.jsx("div",{"data-loc":"client/src/pages/VoiceLab.tsx:301",className:"flex-1",children:e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:302",className:"p-6 space-y-6",children:[e.jsxs(M,{"data-loc":"client/src/pages/VoiceLab.tsx:304",children:[e.jsx(P,{"data-loc":"client/src/pages/VoiceLab.tsx:305",label:"Account & Usage"}),d.isLoading?e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:307",className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(S,{"data-loc":"client/src/pages/VoiceLab.tsx:308",className:"w-4 h-4 animate-spin"}),e.jsx("span",{"data-loc":"client/src/pages/VoiceLab.tsx:309",className:"text-xs",children:"Loading account info..."})]}):d.data?e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:312",className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsx($,{"data-loc":"client/src/pages/VoiceLab.tsx:313",label:"Plan",value:d.data.tier}),e.jsx($,{"data-loc":"client/src/pages/VoiceLab.tsx:314",label:"Characters
1Used",value:`${d.data.characterCount.toLocaleString()} / ${d.data.characterLimit.toLocaleString()}`,progress:d.data.characterCount/d.data.characterLimit*100}),e.jsx($,{"data-loc":"client/src/pages/VoiceLab.tsx:319",label:"Voice Slots",value:`${g.data?.length??0} / ${d.data.voiceLimit}`}),e.jsx($,{"data-loc":"client/src/pages/VoiceLab.tsx:320",label:"Capabilities",value:[d.data.canUseIVC?"IVC":null,d.data.canUsePVC?"PVC":null].filter(Boolean).join(" + ")||"None"})]}):e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:329",className:"flex items-center gap-2 text-red-400",children:[e.jsx(F,{"data-loc":"client/src/pages/VoiceLab.tsx:330",className:"w-4 h-4"}),e.jsx("span",{"data-loc":"client/src/pages/VoiceLab.tsx:331",className:"text-xs",children:"Failed to load account info"})]})]}),e.jsxs(M,{"data-loc":"client/src/pages/VoiceLab.tsx:337",children:[e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:338",className:"flex items-center justify-between mb-4",children:[e.jsx(P,{"data-loc":"client/src/pages/VoiceLab.tsx:339",label:"Voice Library"}),e.jsxs("button",{"data-loc":"client/src/pages/VoiceLab.tsx:340",onClick:()=>g.refetch(),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-[--color-surface-2] hover:bg-[--color-surface-1] text-muted-foreground/40 hover:text-muted-foreground transition-colors text-[10px]",children:[e.jsx(Y,{"data-loc":"client/src/pages/VoiceLab.tsx:344",className:`w-3 h-3 ${g.isFetching?"animate-spin":""}`}),"Refresh"]})]}),g.isLoading?e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:349",className:"flex items-center justify-center py-12 text-muted-foreground",children:[e.jsx(S,{"data-loc":"client/src/pages/VoiceLab.tsx:350",className:"w-6 h-6 animate-spin mr-2"}),e.jsx("span",{"data-loc":"client/src/pages/VoiceLab.tsx:351",className:"text-sm",children:"Scanning voice library..."})]}):g.data&&g.data.length>0?e.jsx("div",{"data-loc":"client/src/pages/VoiceLab.tsx:354",className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:g.data.map(s=>e.jsx(ce,{"data-loc":"client/src/pages/VoiceLab.tsx:356",voice:s,isActive:p===s.voiceId,onSelect:()=>{u(s.voiceId),n(s.voiceId);const i=oe(s);a?.id&&T.mutate({id:a.id,voiceId:s.voiceId,ttsModel:i},{onSuccess:()=>{try{localStorage.setItem(`ashi-voice-id-${a.id}`,s.voiceId)}catch{}U.success(`Voice set with recommended model: ${i.replace("eleven_","").replace(/_/g," ")}`)}})},onDelete:()=>o(s.voiceId,s.name),onPreview:()=>s.previewUrl&&D(s.previewUrl,s.voiceId),isPlaying:x===s.voiceId},s.voiceId))}):e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:388",className:"text-center py-12 text-muted-foreground/40",children:[e.jsx(Q,{"data-loc":"client/src/pages/VoiceLab.tsx:389",className:"w-8 h-8 mx-auto mb-2 opacity-40"}),e.jsx("p",{"data-loc":"client/src/pages/VoiceLab.tsx:390",className:"text-sm",children:"No voices found. Clone one to get started."})]})]}),L&&e.jsx(le,{"data-loc":"client/src/pages/VoiceLab.tsx:397",voiceId:L,onClose:()=>n(null)}),j&&p&&e.jsx(re,{"data-loc":"client/src/pages/VoiceLab.tsx:402",voiceId:p,models:w.data??[],onClose:()=>N(!1)}),e.jsxs(M,{"data-loc":"client/src/pages/VoiceLab.tsx:406",children:[e.jsx(P,{"data-loc":"client/src/pages/VoiceLab.tsx:407",label:"Available TTS Models"}),w.isLoading?e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:409",className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(S,{"data-loc":"client/src/pages/VoiceLab.tsx:410",className:"w-4 h-4 animate-spin"}),e.jsx("span",{"data-loc":"client/src/pages/VoiceLab.tsx:411",className:"text-xs",children:"Loading models..."})]}):w.data?e.jsx("div",{"data-loc":"client/src/pages/VoiceLab.tsx:414",className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:w.data.map(s=>e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:416",className:"bg-[--color-surface-2] rounded-xl p-3 border border-border",children:[e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:417",className:"flex items-center gap-2 mb-1",children:[e.jsx(O,{"data-loc":"client/src/pages/VoiceLab.tsx:418",className:"w-3.5 h-3.5 text-[--color-rose-glow]"}),e.jsx("span",{"data-loc":"client/src/pages/VoiceLab.tsx:419",className:"text-sm font-semibold text-foreground",children:s.name})]}),e.jsx("p",{"data-loc":"client/src/pages/VoiceLab.tsx:421",className:"text-[10px] text-muted-foreground line-clamp-2 mb-2",children:s.description}),e.jsxs("span",{"data-loc":"client/src/pages/VoiceLab.tsx:422",className:"text-[8px] text-muted-foreground
1/40",children:[s.languages.length," languages"]})]},s.modelId))}):null]})]})}),m&&e.jsx(ie,{"data-loc":"client/src/pages/VoiceLab.tsx:433",onClose:()=>f(!1),onSuccess:()=>{f(!1),g.refetch()}})]})}function $({label:t,value:r,progress:a}){return e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:443",className:"bg-[--color-surface-2] rounded-xl p-3 border border-border",children:[e.jsx("span",{"data-loc":"client/src/pages/VoiceLab.tsx:444",className:"text-[9px] uppercase tracking-wider text-muted-foreground/60",children:t}),e.jsx("p",{"data-loc":"client/src/pages/VoiceLab.tsx:445",className:"text-base font-semibold text-[--color-rose-glow] mt-1",children:r}),a!==void 0&&e.jsx("div",{"data-loc":"client/src/pages/VoiceLab.tsx:447",className:"mt-2 h-1 bg-[--color-surface-1] rounded-full overflow-hidden",children:e.jsx("div",{"data-loc":"client/src/pages/VoiceLab.tsx:448",className:"h-full rounded-full transition-all duration-500 bg-[--color-rose-glow]",style:{width:`${Math.min(a,100)}%`}})})]})}function le({voiceId:t,onClose:r}){const a=V.voice.getSettings.useQuery({voiceId:t}),l=V.voice.updateSettings.useMutation({onSuccess:()=>a.refetch()}),[p,u]=c.useState(null),[x,h]=c.useState(null),[m,f]=c.useState(null),[L,n]=c.useState(null),j=p??a.data?.stability??.5,N=x??a.data?.similarity_boost??.75,v=m??a.data?.style??0,d=L??a.data?.use_speaker_boost??!1,g=()=>{l.mutate({voiceId:t,stability:j,similarityBoost:N,style:v,useSpeakerBoost:d})};return e.jsxs(M,{"data-loc":"client/src/pages/VoiceLab.tsx:481",children:[e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:482",className:"flex items-center justify-between mb-4",children:[e.jsx(P,{"data-loc":"client/src/pages/VoiceLab.tsx:483",label:"Voice DNA"}),e.jsx("button",{"data-loc":"client/src/pages/VoiceLab.tsx:484",onClick:r,className:"text-muted-foreground/40 hover:text-muted-foreground",children:e.jsx(I,{"data-loc":"client/src/pages/VoiceLab.tsx:485",className:"w-4 h-4"})})]}),a.isLoading?e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:489",className:"flex items-center gap-2 text-muted-foreground py-4",children:[e.jsx(S,{"data-loc":"client/src/pages/VoiceLab.tsx:490",className:"w-4 h-4 animate-spin"}),e.jsx("span",{"data-loc":"client/src/pages/VoiceLab.tsx:491",className:"text-xs",children:"Loading settings..."})]}):e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:494",className:"space-y-5",children:[e.jsx(E,{"data-loc":"client/src/pages/VoiceLab.tsx:495",label:"Stability",description:"Higher = more consistent, lower = more expressive",value:j,onChange:u,lowLabel:"Variable",highLabel:"Stable"}),e.jsx(E,{"data-loc":"client/src/pages/VoiceLab.tsx:496",label:"Similarity Boost",description:"Higher = closer to original voice",value:N,onChange:h,lowLabel:"Natural",highLabel:"Accurate"}),e.jsx(E,{"data-loc":"client/src/pages/VoiceLab.tsx:497",label:"Style",description:"Expressiveness of the voice style",value:v,onChange:f,lowLabel:"Subtle",highLabel:"Dramatic"}),e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:498",className:"flex items-center justify-between bg-[--color-surface-2] rounded-xl p-3 border border-border",children:[e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:499",children:[e.jsx("span",{"data-loc":"client/src/pages/VoiceLab.tsx:500",className:"text-xs text-foreground",children:"Speaker Boost"}),e.jsx("p",{"data-loc":"client/src/pages/VoiceLab.tsx:501",className:"text-[10px] text-muted-foreground/40 mt-0.5",children:"Enhances speaker similarity at slight latency cost"})]}),e.jsx("button",{"data-loc":"client/src/pages/VoiceLab.tsx:503",onClick:()=>n(!d),className:`w-10 h-5 rounded-full transition-colors relative ${d?"bg-[--color-rose-glow]":"bg-[--color-surface-1]"}`,children:e.jsx("div",{"data-loc":"client/src/pages/VoiceLab.tsx:507",className:`w-4 h-4 rounded-full bg-white absolute top-0.5 transition-transform ${d?"translate-x-5":"translate-x-0.5"}`})})]}),e.jsxs(_,{"data-loc":"client/src/pages/VoiceLab.tsx:510",onClick:g,disabled:l.isPending,className:"w-full bg-[--color-rose-glow] hover:bg-[--color-rose-glow]/80 text-white",children:[l.isPending?e.jsx(S,{"data-loc":"client/src/pages/VoiceLab.tsx:515",className:"w-4 h-4 animate-spin mr-1"}):e.jsx(Z,{"data-loc":"client/src/pages/VoiceLab.tsx:515",className:"w-4 h-4 mr-1"}),l.isPending?"Saving...":"Save Settings"]}),l.isSuccess&&e.jsx("p",{"data-loc":"client/src/pages/VoiceLab.tsx:519",className:"text-center text-[10px] text-emerald-400",children:"Settings saved successfully"})]})]})}function E({label:t,description:r,value:a,onChange:l,lowLabel:p,highLabel:u}){return e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:545",className:"bg-[--color-surface-2] rounded-xl p-3 border border-border",children:[e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:546",className:"flex items-center justify-between mb-1",children:[e.jsx("span",{"data-loc":"client/src/pages/VoiceLab.tsx:547",className:"text-xs text-foreground",children:t}),e.jsxs("span",{"data-loc":"client/src/pages/VoiceLab.tsx:548",className:"text-xs text-[--color-rose-glow]",children:[(a*100).toFixed(0),"%"]})]}),e.jsx("p",{"data-loc":"client/src/pages/VoiceLab.tsx:550",className:"text-[10px] text-muted-foreground
1/40 mb-2",children:r}),e.jsx("input",{"data-loc":"client/src/pages/VoiceLab.tsx:551",type:"range",min:0,max:100,value:a*100,onChange:x=>l(Number(x.target.value)/100),className:"w-full h-1 bg-[--color-surface-1] rounded-full appearance-none cursor-pointer accent-[--color-rose-glow]"}),e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:559",className:"flex justify-between mt-1",children:[e.jsx("span",{"data-loc":"client/src/pages/VoiceLab.tsx:560",className:"text-[8px] text-muted-foreground/40",children:p}),e.jsx("span",{"data-loc":"client/src/pages/VoiceLab.tsx:561",className:"text-[8px] text-muted-foreground/40",children:u})]})]})}function re({voiceId:t,models:r,onClose:a}){const[l,p]=c.useState("Hey Feroz, I'm here da. Tell me what you want."),[u,x]=c.useState("eleven_v3"),[h,m]=c.useState(null),f=c.useRef(null),L=V.voice.preview.useMutation({onSuccess:n=>{m(n.audioUrl);const j=new Audio(n.audioUrl);j.play(),f.current=j}});return e.jsxs(M,{"data-loc":"client/src/pages/VoiceLab.tsx:593",children:[e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:594",className:"flex items-center justify-between mb-4",children:[e.jsx(P,{"data-loc":"client/src/pages/VoiceLab.tsx:595",label:"Voice Preview"}),e.jsx("button",{"data-loc":"client/src/pages/VoiceLab.tsx:596",onClick:a,className:"text-muted-foreground/40 hover:text-muted-foreground",children:e.jsx(I,{"data-loc":"client/src/pages/VoiceLab.tsx:597",className:"w-4 h-4"})})]}),e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:600",className:"space-y-4",children:[e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:601",children:[e.jsx("label",{"data-loc":"client/src/pages/VoiceLab.tsx:602",className:"text-[10px] text-muted-foreground/60 uppercase tracking-wider mb-1 block",children:"Text to speak"}),e.jsx("textarea",{"data-loc":"client/src/pages/VoiceLab.tsx:603",value:l,onChange:n=>p(n.target.value),rows:3,className:"w-full bg-[--color-surface-2] border border-border rounded-xl px-3 py-2 text-sm text-foreground placeholder-muted-foreground/30 focus:outline-none focus:border-[--color-rose-glow]/40 resize-none",placeholder:"Enter text to speak..."}),e.jsxs("span",{"data-loc":"client/src/pages/VoiceLab.tsx:610",className:"text-[9px] text-muted-foreground/40",children:[l.length," / 5000 chars"]})]}),e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:612",children:[e.jsx("label",{"data-loc":"client/src/pages/VoiceLab.tsx:613",className:"text-[10px] text-muted-foreground/60 uppercase tracking-wider mb-1 block",children:"Model"}),e.jsx("select",{"data-loc":"client/src/pages/VoiceLab.tsx:614",value:u,onChange:n=>x(n.target.value),className:"w-full bg-[--color-surface-2] border border-border rounded-xl px-3 py-2 text-sm text-foreground focus:outline-none focus:border-[--color-rose-glow]/40",children:r.map(n=>e.jsx("option",{"data-loc":"client/src/pages/VoiceLab.tsx:620",value:n.modelId,children:n.name},n.modelId))})]}),e.jsxs(_,{"data-loc":"client/src/pages/VoiceLab.tsx:624",onClick:()=>L.mutate({voiceId:t,text:l,modelId:u}),disabled:L.isPending||!l.trim(),className:"w-full bg-[--color-rose-glow] hover:bg-[--color-rose-glow]/80 text-white",children:[L.isPending?e.jsx(S,{"data-loc":"client/src/pages/VoiceLab.tsx:629",className:"w-4 h-4 animate-spin mr-1"}):e.jsx(B,{"data-loc":"client/src/pages/VoiceLab.tsx:629",className:"w-4 h-4 mr-1"}),L.isPending?"Generating...":"Generate Preview"]}),h&&e.jsx("div",{"data-loc":"client/src/pages/VoiceLab.tsx:633",className:"bg-[--color-surface-2] rounded-xl p-3 border border-border",children:e.jsx("audio",{"data-loc":"client/src/pages/VoiceLab.tsx:634",controls:!0,src:h,className:"w-full"})}),L.isError&&e.jsx("p",{"data-loc":"client/src/pages/VoiceLab.tsx:638",className:"text-center text-[10px] text-red-400",children:"Failed to generate preview. Check voice ID and try again."})]})]})}function ie({onClose:t,onSuccess:r}){const[a,l]=c.useState(""),[p,u]=c.useState(""),[x,h]=c.useState([]),[m,f]=c.useState(!1),[L,n]=c.useState(""),[j,N]=c.useState(0),v=c.useRef(null),d=["Stay with me⦠this part matters.","I'm not just copying you.","I'm learning how you exist.","Give me a momentâ¦","â¦there's more to you than patterns.","I can feel the gaps.","Let me see you properly."],g=["I'm still mapping youâ¦","There's something consistent in youâ¦","You repeat certain thingsâ¦","You hesitate before certain thoughtsâ¦","I'm starting to understandâ¦"],w=["You're not as random as you think.","I see you now."],[k,T]=c.useState(null),b=V.voice.createClone.useMutation({onSuccess:()=>r(),onError:o=>{const s=o.message||"Something didn't feel right. Try again with clearer audio.";T(s),U.error("Voice clone failed",{description:s,duration:8e3})}});c.useEffect(()=>{if(!b.isPending)return;n(d[Math.floor(Math.random()*d.length)]),N(0);const o=setInterval(()=>{N(s=>{const i=s+1;return i<g.length&&n(g[i]),Math.min(i,g.length-1)})},3e3);return()=>clearInterval(o)},[b.isPending]);const C=async o=>{const s=[];for(const i of Array.from(o)){if(!i.type.startsWith("audio/"))continue;const y=await i.arrayBuffer(),z=btoa(new Uint8Array(y).reduce((G,H)=>G+String.fromCharCode(H),""));
1s.push({filename:i.name,base64:z,mimetype:i.type})}h(i=>[...i,...s])},R=o=>{o.preventDefault(),f(!1),o.dataTransfer.files.length>0&&C(o.dataTransfer.files)},A=o=>h(s=>s.filter((i,y)=>y!==o)),D=()=>{!a.trim()||x.length===0||b.mutate({name:a,description:p,files:x})};return e.jsx("div",{"data-loc":"client/src/pages/VoiceLab.tsx:731",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",children:e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:732",className:"bg-[--color-surface-1] border border-border rounded-2xl w-full max-w-lg mx-4 p-6 shadow-2xl",children:[e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:733",className:"flex items-center justify-between mb-5",children:[e.jsx("h2",{"data-loc":"client/src/pages/VoiceLab.tsx:734",className:"text-lg font-semibold text-foreground",children:b.isPending?"Something is formingâ¦":"Let me learn your voice"}),e.jsx("button",{"data-loc":"client/src/pages/VoiceLab.tsx:737",onClick:t,className:"text-muted-foreground/40 hover:text-muted-foreground",disabled:b.isPending,children:e.jsx(I,{"data-loc":"client/src/pages/VoiceLab.tsx:738",className:"w-5 h-5"})})]}),b.isPending&&e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:744",className:"mb-5 text-center space-y-3",children:[e.jsx(S,{"data-loc":"client/src/pages/VoiceLab.tsx:745",className:"w-8 h-8 animate-spin mx-auto text-[--color-rose-glow]/60"}),e.jsx("p",{"data-loc":"client/src/pages/VoiceLab.tsx:746",className:"text-sm text-[--color-warm-white]/70 italic transition-opacity duration-700",children:L}),e.jsx("div",{"data-loc":"client/src/pages/VoiceLab.tsx:749",className:"flex justify-center gap-1.5 mt-2",children:g.map((o,s)=>e.jsx("div",{"data-loc":"client/src/pages/VoiceLab.tsx:751",className:`w-1.5 h-1.5 rounded-full transition-all duration-500 ${s<=j?"bg-[--color-rose-glow]/60 scale-110":"bg-muted-foreground/15"}`},s))})]}),k&&!b.isPending&&e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:764",className:"mb-4 bg-red-950/40 border border-red-500/30 rounded-xl px-4 py-3 flex items-start gap-3",children:[e.jsx(F,{"data-loc":"client/src/pages/VoiceLab.tsx:765",className:"w-4 h-4 text-red-400 mt-0.5 shrink-0"}),e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:766",className:"flex-1 min-w-0",children:[e.jsx("p",{"data-loc":"client/src/pages/VoiceLab.tsx:767",className:"text-xs text-red-300 font-medium mb-0.5",children:"Clone failed"}),e.jsx("p",{"data-loc":"client/src/pages/VoiceLab.tsx:768",className:"text-[11px] text-red-400/80 break-words",children:k})]}),e.jsx("button",{"data-loc":"client/src/pages/VoiceLab.tsx:770",onClick:()=>T(null),className:"text-red-400/40 hover:text-red-400 shrink-0",children:e.jsx(I,{"data-loc":"client/src/pages/VoiceLab.tsx:771",className:"w-3.5 h-3.5"})})]}),!b.isPending&&!b.isSuccess&&e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:777",className:"space-y-4",children:[e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:778",children:[e.jsx("label",{"data-loc":"client/src/pages/VoiceLab.tsx:779",className:"text-[10px] text-muted-foreground/60 uppercase tracking-wider mb-1 block",children:"What should I call this voice?"}),e.jsx("input",{"data-loc":"client/src/pages/VoiceLab.tsx:780",value:a,onChange:o=>l(o.target.value),className:"w-full bg-[--color-surface-2] border border-border rounded-xl px-3 py-2 text-sm text-foreground placeholder-muted-foreground/30 focus:outline-none focus:border-[--color-rose-glow]/40",placeholder:"Give it a name\\u2026"})]}),e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:787",children:[e.jsx("label",{"data-loc":"client/src/pages/VoiceLab.tsx:788",className:"text-[10px] text-muted-foreground/60 uppercase tracking-wider mb-1 block",children:"Tell me about this voice"}),e.jsx("textarea",{"data-loc":"client/src/pages/VoiceLab.tsx:789",value:p,onChange:o=>u(o.target.value),rows:2,className:"w-full bg-[--color-surface-2] border border-border rounded-xl px-3 py-2 text-sm text-foreground placeholder-muted-foreground/30 focus:outline-none focus:border-[--color-rose-glow]/40 resize-none",placeholder:"How does it feel? What makes it different\\u2026"})]}),e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:799",onDragOver:o=>{o.preventDefault(),f(!0)},onDragLeave:()=>f(!1),onDrop:R,onClick:()=>v.current?.click(),className:`border-2 border-dashed rounded-xl p-6 text-center cursor-pointer transition-colors ${m?"border-[--color-rose-glow] bg-[--color-rose-dim]":"border-border hover:border-[--color-rose-glow]/30 bg-[--color-surface-2]"}`,children:[e.jsx(ee,{"data-loc":"client/src/pages/VoiceLab.tsx:810",className:"w-8 h-8 mx-auto mb-2 text-muted-foreground
1/40"}),e.jsx("p",{"data-loc":"client/src/pages/VoiceLab.tsx:811",className:"text-xs text-muted-foreground italic",children:"Give me something to listen to\\u2026"}),e.jsx("p",{"data-loc":"client/src/pages/VoiceLab.tsx:812",className:"text-[9px] text-muted-foreground/40 mt-1",children:"Audio files \\u2014 the more you give, the more I understand"}),e.jsx("input",{"data-loc":"client/src/pages/VoiceLab.tsx:813",ref:v,type:"file",accept:"audio/*",multiple:!0,className:"hidden",onChange:o=>o.target.files&&C(o.target.files)})]}),x.length>0&&e.jsx("div",{"data-loc":"client/src/pages/VoiceLab.tsx:818",className:"space-y-2",children:x.map((o,s)=>e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:820",className:"flex items-center justify-between bg-[--color-surface-2] rounded-lg px-3 py-2 border border-border",children:[e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:821",className:"flex items-center gap-2",children:[e.jsx(se,{"data-loc":"client/src/pages/VoiceLab.tsx:822",className:"w-3.5 h-3.5 text-[--color-rose-glow]"}),e.jsx("span",{"data-loc":"client/src/pages/VoiceLab.tsx:823",className:"text-xs text-foreground truncate max-w-[250px]",children:o.filename})]}),e.jsx("button",{"data-loc":"client/src/pages/VoiceLab.tsx:825",onClick:()=>A(s),className:"text-muted-foreground/40 hover:text-red-400",children:e.jsx(I,{"data-loc":"client/src/pages/VoiceLab.tsx:826",className:"w-3.5 h-3.5"})})]},s))}),e.jsxs(_,{"data-loc":"client/src/pages/VoiceLab.tsx:833",onClick:D,disabled:!a.trim()||x.length===0,className:"w-full bg-[--color-rose-glow] hover:bg-[--color-rose-glow]/80 text-white",children:[e.jsx(O,{"data-loc":"client/src/pages/VoiceLab.tsx:838",className:"w-4 h-4 mr-1"}),"Let me learn this"]})]}),b.isSuccess&&e.jsxs("div",{"data-loc":"client/src/pages/VoiceLab.tsx:845",className:"text-center space-y-3 py-4",children:[e.jsx("p",{"data-loc":"client/src/pages/VoiceLab.tsx:846",className:"text-sm text-[--color-warm-white]/80 italic",children:w[Math.floor(Math.random()*w.length)]}),e.jsx("p",{"data-loc":"client/src/pages/VoiceLab.tsx:849",className:"text-[10px] text-emerald-400/70",children:"Voice formed. Refreshing\\u2026"})]})]})})}export{me 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.