1import{a as s,j as e}from"./vendor-core.DkahmlU8.js";import{X as b,aH as E,ae as L,B as u,aZ as j,d as g,as as I,b6 as R,b8 as T,b7 as O,b as y,c as f,R as D,S as C,Y as A,av as _,o as $,n as B,bO as w}from"./bootstrap.KUFis_Od.js";import{h as M,L as N,U,y as z}from"./App.C7HhiLEI.js";import{m as F,O as W}from"./onboardingLocalForage.k21vxsul.js";import{A as G,T as H}from"./VoicesTable.DuoJTFLo.js";import{m as Y}from"./useTTSVoicesV1.DVLeyPnE.js";import{y as h,ae as k,aj as K,aL as X,bc as Z,ag as q}from"./vendor-mui-x.BZ8Y4adA.js";import{u as J,b as Q,a as ee,t as oe,C as te}from"./useCreateVoiceOptions.VioGoVQ1.js";import"./vendor-firebase.dbYXL2Q0.js";import"./constants.DXrIgJP9.js";import{w as ae}from"./voicePickerPersistence.QQ5o5Gv0.js";import"./table.CshLM3h1.js";import"./audioGraph.CpHqc6uT.js";import"./language_codes.pb.BsyMdoj2.js";import"./PublicSignUpGateError.BRwMR1lz.js";import"./ttsService.BSEz1qGS.js";import"./useRuntimeApiKeysManager.Op95Z1ZB.js";import"./markupAnalysis.DjVj_BZV.js";import"./utils.BpN2_kOR.js";import"./formPersistenceScheduler.H8Xo9JBh.js";import"./languages.CzJjrKs_.js";import"./localeCountry.BG_zbFy2.js";import"./voices.CrJAcJ38.js";import"./useQueries.DG8muCoH.js";import"./InputTags.Da_QE0GH.js";import"./debounce.H_SneSgF.js";import"./PlayButton.BgRz8Wov.js";import"./constants.Cu5I1BJ2.js";import"./voiceTagColors.BLy7B0jP.js";import"./ModelProviderLogos.CQZjbC_F.js";import"./useVoiceCloneSampleLimits.CQWpV4AU.js";const ie=({onClose:t,onCopied:i})=>{const{workspace:r}=b(),[n,x]=s.useState(""),[c,l]=s.useState(""),{mutate:p,isLoading:a}=Y(o=>{i==null||i(o),t()},o=>E((o==null?void 0:o.message)||"Failed to copy voice")),d=()=>{!r||!n.trim()||p({destinationParent:`workspaces/${r}`,voiceCopyTokenId:n.trim(),...c.trim()?{displayName:c.trim()}:{}})};return e.jsx(L,{size:"sm",title:"Import Voice",controlled:!0,open:!0,onClose:t,primary:{label:"Copy Voice",onClick:d,loading:a,preventAutoClose:!0,disabled:!n.trim()},secondary:{label:"Cancel",onClick:t,preventAutoClose:!0},backgroundColor:"background.default",sx:{"& .MuiDialog-paper":{mx:["1rem"]}},children:e.jsxs(u,{component:"div",className:"CopyVoiceRedeemDialog",sx:{p:"1.25rem"},children:[e.jsx(h,{variant:"body2",sx:{color:"text.secondary",mb:2},children:"Paste a copy token that a voice owner shared with you. The voice is copied into this workspace as your own private, independent voice."}),e.jsx(j,{label:"Copy token",sx:{mb:2,width:"100%"},children:e.jsx(k,{className:"inworld-text-field",size:"small",fullWidth:!0,value:n,onChange:o=>x(o.target.value),placeholder:"Paste the token you received",slotProps:{htmlInput:{"aria-label":"Copy token"}}})}),e.jsx(j,{label:"Voice name",renderOptionalLabel:!0,sx:{width:"100%"},children:e.jsx(k,{className:"inworld-text-field",size:"small",fullWidth:!0,value:c,onChange:o=>l(o.target.value),placeholder:"Defaults to the original voice name",slotProps:{htmlInput:{"aria-label":"Voice name"}}})})]})})},re=["recording","description"],se=({workspace:t})=>{const i=s.useId(),[r,n]=s.useState(null),{options:x,atOrOverLimit:c}=J(t),l=`/workspaces/${t}/voice-library/create-voice`,p=()=>n(null);return e.jsxs(u,{component:"div",className:"CreateVoiceMenuButton",sx:{display:"inline-flex"},children:[e.jsx(g,{"aria-label":"Create Voice",startIcon:e.jsx(y,{icon:f.faPlus}),component:I,to:l,onClick:()=>{R(O.CLICKED_TTS_CLONE_VOICE,T.VoiceLibrary)},sx:{borderTopRightRadius:0,borderBottomRightRadius:0},children:"Create Voice"}),e.jsx(g,{"aria-label":"Choose how to create a voice","aria-haspopup":"menu","aria-controls":r?i:void 0,"aria-expanded":r?"true":void 0,onClick:a=>n(a.currentTarget),sx:{minWidth:0,px:1,borderTopLeftRadius:0,borderBottomLeftRadius:0,borderLeft:"1px solid",borderLeftColor:"divider"},children:e.jsx(y,{icon:f.faChevronDown})}),e.jsxs(K,{id:i,anchorEl:r,open:!!r,onClose:p,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},slotProps:{paper:{sx:{width:"22rem",mt:.5,borderRadius:D.lg}}},children:[re.map(a=>x.filter(d=>d.group===a)).filter(a=>a.length>0).flatMap((a,d)=>[...d>0?[e.jsx(X,{},`${a[0].group}-divider`)]:[],...a.length>1?[e.jsx(Z,{sx:{backgroundColor:"transparent",lineHeight:"normal",pt:1,pb:.5},children:e.jsx(h,{variant:"caption",sx:{color:"text.secondary"},children:Q[a[0].group]})},`${a[0].group}-heading`)]:[],...a.map(o=>e.jsx(q,{component:I,to:`${l}/${o.path}`,"aria-label":`${o.title}: ${o.hint}`,disabled:c,onClick:()=>{oe(o,"create-voice-menu"),p()},sx:{whiteSpace:"normal",alignItems:"flex-start"},children:e.jsxs(C,{spacing:.25,children:[e.jsxs(C,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(h,{variant:"subtitle2",component:"span",children:o.title}),o.tag&&e.jsx(ee,{children:o.tag})]}),e.jsx(h,{variant:"caption",sx:{color:"text.secondary"},children:o.hint})]})},o.id))]),c&&e.jsx(h,{variant:"caption",component:"p",sx:{color:"text.secondary",px:2,pt:1},children:te})]})]})},ne=()=>{const{workspace:t}=b(),i=A(),[r]=_(),{isEnabled:n}=M(),x=$(B.STUDIO_V2_VOICE_COPY),[c,l]=s.useState(!1),[p,a]=s.useState(),d=m=>{m.voiceId&&a(m.voiceId);const V=new URLSearchParams(r);
1V.set("category",z.CUSTOM),i({pathname:`/workspaces/${t}/voice-library`,search:V.toString()},{replace:!0}),m.name&&i(`/workspaces/${t}/voice-library/voice/${encodeURIComponent(m.name)}`)},[o,P]=s.useState(!1);s.useEffect(()=>{s.startTransition(()=>P(!0))},[]);const v=s.useCallback(()=>{F(W.VOICE_LIBRARY_VISITED)},[]),S=m=>{v(),ae(r),i(`/workspaces/${t}/tts-playground`,{state:{selectedVoiceId:m}})};return e.jsxs(N,{EnhancedPageHeaderProps:{sx:{"& .page-header-column:first-child":{width:"unset",minWidth:"max-content"},"& .MuiTypography-body2":{whiteSpace:"nowrap"},[w.breakpoints.only("sm")]:{"& > div":{flexDirection:"row"},"& .page-header-column:last-child":{justifyContent:"flex-end"}},[w.breakpoints.only("xs")]:{"& > div":{flexDirection:"row","& .page-header-column:first-child":{justifyContent:"flex-start"},"& .page-header-column:last-child":{justifyContent:"flex-end"}}}},title:"Voices",description:"Browse, clone, and create voices for text-to-speech.",primaryAction:e.jsxs(C,{direction:"row",spacing:1,children:[n&&t&&e.jsx(se,{workspace:t}),x&&e.jsx(g,{intent:"secondary","aria-label":"Import Voice",startIcon:e.jsx(y,{icon:f.faCopy}),onClick:()=>l(!0),sx:{display:{xs:"none",sm:"inline-flex"}},children:"Import Voice"})]})},disablePadding:!0,customWrapperSX:{flex:1,overflow:"hidden",display:"flex",flexDirection:"column",paddingTop:0},children:[e.jsx(u,{component:"div",sx:{pt:0,pb:"0.5rem",px:0,flex:1,overflow:"hidden",display:"flex",flexDirection:"column"},children:o&&t?e.jsx(G,{workspace:t,children:e.jsx(H,{onSelectVoice:S,onInteraction:v,scrollToVoiceId:p})},t):e.jsx(U,{label:"Loading voices",sx:{flex:1}})}),c&&e.jsx(ie,{onClose:()=>l(!1),onCopied:d})]})},Me=()=>{const{workspace:t}=b();return e.jsx(e.Fragment,{children:t?e.jsx(ne,{},t):e.jsx(u,{component:"div",sx:{p:4},children:e.jsx(h,{variant:"body1",sx:{color:"text.secondary"},children:"Please select a workspace to continue"})})})};export{Me as PortalVoicesListPage};
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.