(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[974],{3215:(e,t,l)=>{"use strict";l.r(t),l.d(t,{default:()=>B});var a=l(5155),n=l(6448),r=l(2115),s=l(3868),i=l(2702);let o=e=>{let{children:t,className:l,onClick:n,...r}=e;return(0,a.jsx)("button",{className:"bg-[#7559FF] text-white text-sm px-6 py-2 rounded-lg disabled:opacity-50 h-fit ".concat(l),onClick:r.disabled?void 0:n,...r,children:t})},c=e=>(0,a.jsx)("input",{className:"w-full text-white text-sm bg-zinc-700 py-2 px-6 rounded-lg outline-none ".concat(e.className),placeholder:e.placeholder,type:"text",value:e.value||"",onChange:t=>e.onChange(t.target.value)});var u=l(1918),d=l(9111);function v(e){let[t,l]=(0,r.useState)(!1);return(0,a.jsxs)(u.bL,{disabled:e.disabled,open:t,onOpenChange:l,children:[(0,a.jsxs)(u.l9,{className:"w-full text-white text-sm bg-zinc-700 py-2 px-6 rounded-lg cursor-pointer flex items-center justify-between h-fit disabled:opacity-50 min-h-[36px]",children:[(0,a.jsx)("div",{className:"".concat(e.value?"text-white":"text-zinc-400"),children:e.value?e.value:e.placeholder}),(0,a.jsx)(d.D3,{className:"w-4 h-4"})]}),(0,a.jsx)(u.ZL,{children:(0,a.jsx)(u.UC,{className:"z-50 w-[var(--radix-select-trigger-width)] max-h-[300px] overflow-y-auto",position:"popper",sideOffset:5,children:(0,a.jsx)(u.LM,{className:"rounded-lg border border-zinc-600 bg-zinc-700 shadow-lg py-1",children:e.options.map(t=>{var n;let r=e.isSelected(t);return(0,a.jsx)("div",{className:"py-2 px-4 cursor-pointer hover:bg-zinc-600 outline-none text-sm ".concat(r?"text-white bg-zinc-500":"text-zinc-400"),onClick:()=>{e.onSelect(t),l(!1)},children:e.renderOption(t)},null==(n=e.renderOption(t))?void 0:n.toString())})})})})]})}let C=e=>(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("label",{className:"text-zinc-400 text-sm",children:e.label}),e.children]}),h=[{avatar_id:"Shawn_Therapist_public",name:"Shawn Therapist"},{avatar_id:"Ann_Therapist_public",name:"Ann Therapist"},{avatar_id:"Bryan_FitnessCoach_public",name:"Bryan Fitness Coach"},{avatar_id:"Dexter_Doctor_Standing2_public",name:"Dexter Doctor Standing"},{avatar_id:"Brandon_expressive_public",name:"Elenora Tech Expert"},{avatar_id:"15a6b21bdbe3419a923142150b377034",name:"Test"}],x=[{label:"Bulgarian",value:"bg",key:"bg"},{label:"Chinese",value:"zh",key:"zh"},{label:"Czech",value:"cs",key:"cs"},{label:"Danish",value:"da",key:"da"},{label:"Dutch",value:"nl",key:"nl"},{label:"English",value:"en",key:"en"},{label:"Finnish",value:"fi",key:"fi"},{label:"French",value:"fr",key:"fr"},{label:"German",value:"de",key:"de"},{label:"Greek",value:"el",key:"el"},{label:"Hindi",value:"hi",key:"hi"},{label:"Hungarian",value:"hu",key:"hu"},{label:"Indonesian",value:"id",key:"id"},{label:"Italian",value:"it",key:"it"},{label:"Japanese",value:"ja",key:"ja"},{label:"Korean",value:"ko",key:"ko"},{label:"Malay",value:"ms",key:"ms"},{label:"Norwegian",value:"no",key:"no"},{label:"Polish",value:"pl",key:"pl"},{label:"Portuguese",value:"pt",key:"pt"},{label:"Romanian",value:"ro",key:"ro"},{label:"Russian",value:"ru",key:"ru"},{label:"Slovak",value:"sk",key:"sk"},{label:"Spanish",value:"es",key:"es"},{label:"Swedish",value:"sv",key:"sv"},{label:"Turkish",value:"tr",key:"tr"},{label:"Ukrainian",value:"uk",key:"uk"},{label:"Vietnamese",value:"vi",key:"vi"}],p=e=>{var t,l,s,i,o;let{onConfigChange:u,config:d}=e,p=(e,t)=>{u({...d,[e]:t})},[g,f]=(0,r.useState)(!1),m=(0,r.useMemo)(()=>{let e=h.find(e=>e.avatar_id===d.avatarName);return e?{isCustom:!1,name:e.name,avatarId:e.avatar_id}:{isCustom:!0,name:"Custom Avatar ID",avatarId:null}},[d.avatarName]);return(0,a.jsxs)("div",{className:"relative flex flex-col gap-4 w-full py-8 max-h-full overflow-y-auto px-4",children:[(0,a.jsx)(C,{label:"Custom Knowledge Base ID",children:(0,a.jsx)(c,{placeholder:"Enter custom knowledge base ID",value:d.knowledgeId,onChange:e=>p("knowledgeId",e)})}),(0,a.jsx)(C,{label:"Avatar ID",children:(0,a.jsx)(v,{isSelected:e=>"string"==typeof e?!!(null==m?void 0:m.isCustom):e.avatar_id===(null==m?void 0:m.avatarId),options:[...h,"CUSTOM"],placeholder:"Select Avatar",renderOption:e=>"string"==typeof e?"Custom Avatar ID":e.name,value:(null==m?void 0:m.isCustom)?"Custom Avatar ID":null==m?void 0:m.name,onSelect:e=>{"string"==typeof e?p("avatarName",""):p("avatarName",e.avatar_id)}})}),(null==m?void 0:m.isCustom)&&(0,a.jsx)(C,{label:"Custom Avatar ID",children:(0,a.jsx)(c,{placeholder:"Enter custom avatar ID",value:d.avatarName,onChange:e=>p("avatarName",e)})}),(0,a.jsx)(C,{label:"Language",children:(0,a.jsx)(v,{isSelected:e=>e.value===d.language,options:x,renderOption:e=>e.label,value:null==(t=x.find(e=>e.value===d.language))?void 0:t.label,onSelect:e=>p("language",e.value)})}),(0,a.jsx)(C,{label:"Avatar Quality",children:(0,a.jsx)(v,{isSelected:e=>e===d.quality,options:Object.values(n.dc),renderOption:e=>e,value:d.quality,onSelect:e=>p("quality",e)})}),(0,a.jsx)(C,{label:"Voice Chat Transport",children:(0,a.jsx)(v,{isSelected:e=>e===d.voiceChatTransport,options:Object.values(n.C),renderOption:e=>e,value:d.voiceChatTransport,onSelect:e=>p("voiceChatTransport",e)})}),g&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h1",{className:"text-zinc-100 w-full text-center mt-5",children:"Voice Settings"}),(0,a.jsx)(C,{label:"Custom Voice ID",children:(0,a.jsx)(c,{placeholder:"Enter custom voice ID",value:null==(l=d.voice)?void 0:l.voiceId,onChange:e=>p("voice",{...d.voice,voiceId:e})})}),(0,a.jsx)(C,{label:"Emotion",children:(0,a.jsx)(v,{isSelected:e=>{var t;return e===(null==(t=d.voice)?void 0:t.emotion)},options:Object.values(n.qN),renderOption:e=>e,value:null==(s=d.voice)?void 0:s.emotion,onSelect:e=>p("voice",{...d.voice,emotion:e})})}),(0,a.jsx)(C,{label:"ElevenLabs Model",children:(0,a.jsx)(v,{isSelected:e=>{var t;return e===(null==(t=d.voice)?void 0:t.model)},options:Object.values(n.fr),renderOption:e=>e,value:null==(i=d.voice)?void 0:i.model,onSelect:e=>p("voice",{...d.voice,model:e})})}),(0,a.jsx)("h1",{className:"text-zinc-100 w-full text-center mt-5",children:"STT Settings"}),(0,a.jsx)(C,{label:"Provider",children:(0,a.jsx)(v,{isSelected:e=>{var t;return e===(null==(t=d.sttSettings)?void 0:t.provider)},options:Object.values(n.t$),renderOption:e=>e,value:null==(o=d.sttSettings)?void 0:o.provider,onSelect:e=>p("sttSettings",{...d.sttSettings,provider:e})})})]}),(0,a.jsx)("button",{className:"text-zinc-400 text-sm cursor-pointer w-full text-center bg-transparent",onClick:()=>f(!g),children:g?"Show less":"Show more..."})]})};var g=function(e){return e.INACTIVE="inactive",e.CONNECTING="connecting",e.CONNECTED="connected",e}({}),f=function(e){return e.CLIENT="CLIENT",e.AVATAR="AVATAR",e}({});let m=r.createContext({avatarRef:{current:null},isMuted:!0,setIsMuted:()=>{},isVoiceChatLoading:!1,setIsVoiceChatLoading:()=>{},sessionState:"inactive",setSessionState:()=>{},isVoiceChatActive:!1,setIsVoiceChatActive:()=>{},stream:null,setStream:()=>{},messages:[],clearMessages:()=>{},handleUserTalkingMessage:()=>{},handleStreamingTalkingMessage:()=>{},handleEndMessage:()=>{},isListening:!1,setIsListening:()=>{},isUserTalking:!1,setIsUserTalking:()=>{},isAvatarTalking:!1,setIsAvatarTalking:()=>{},connectionQuality:n._N.UNKNOWN,setConnectionQuality:()=>{}}),A=()=>{let[e,t]=(0,r.useState)("inactive"),[l,a]=(0,r.useState)(null);return{sessionState:e,setSessionState:t,stream:l,setStream:a}},j=()=>{let[e,t]=(0,r.useState)(!0),[l,a]=(0,r.useState)(!1),[n,s]=(0,r.useState)(!1);return{isMuted:e,setIsMuted:t,isVoiceChatLoading:l,setIsVoiceChatLoading:a,isVoiceChatActive:n,setIsVoiceChatActive:s}},w=()=>{let[e,t]=(0,r.useState)([]),l=(0,r.useRef)(null);return{messages:e,clearMessages:()=>{t([]),l.current=null},handleUserTalkingMessage:e=>{let{detail:a}=e;"CLIENT"===l.current?t(e=>[...e.slice(0,-1),{...e[e.length-1],content:[e[e.length-1].content,a.message].join("")}]):(l.current="CLIENT",t(e=>[...e,{id:Date.now().toString(),sender:"CLIENT",content:a.message}]))},handleStreamingTalkingMessage:e=>{let{detail:a}=e;"AVATAR"===l.current?t(e=>[...e.slice(0,-1),{...e[e.length-1],content:[e[e.length-1].content,a.message].join("")}]):(l.current="AVATAR",t(e=>[...e,{id:Date.now().toString(),sender:"AVATAR",content:a.message}]))},handleEndMessage:()=>{l.current=null}}},S=()=>{let[e,t]=(0,r.useState)(!1);return{isListening:e,setIsListening:t}},N=()=>{let[e,t]=(0,r.useState)(!1),[l,a]=(0,r.useState)(!1);return{isUserTalking:e,setIsUserTalking:t,isAvatarTalking:l,setIsAvatarTalking:a}},b=()=>{let[e,t]=(0,r.useState)(n._N.UNKNOWN);return{connectionQuality:e,setConnectionQuality:t}},k=e=>{let{children:t,basePath:l}=e,n=r.useRef(null),s=j(),i=A(),o=w(),c=S(),u=N(),d=b();return(0,a.jsx)(m.Provider,{value:{avatarRef:n,basePath:l,...s,...i,...o,...c,...u,...d},children:t})},T=()=>r.useContext(m),E=()=>{let{connectionQuality:e}=T();return{connectionQuality:e}},y=()=>{let{avatarRef:e,isMuted:t,setIsMuted:l,isVoiceChatActive:a,setIsVoiceChatActive:n,isVoiceChatLoading:s,setIsVoiceChatLoading:i}=T(),o=(0,r.useCallback)(async t=>{var a;e.current&&(i(!0),await (null==(a=e.current)?void 0:a.startVoiceChat({isInputAudioMuted:t})),i(!1),n(!0),l(!!t))},[e,l,n,i]),c=(0,r.useCallback)(()=>{var t;e.current&&(null==(t=e.current)||t.closeVoiceChat(),n(!1),l(!0))},[e,l,n]);return{startVoiceChat:o,stopVoiceChat:c,muteInputAudio:(0,r.useCallback)(()=>{var t;e.current&&(null==(t=e.current)||t.muteInputAudio(),l(!0))},[e,l]),unmuteInputAudio:(0,r.useCallback)(()=>{var t;e.current&&(null==(t=e.current)||t.unmuteInputAudio(),l(!1))},[e,l]),isMuted:t,isVoiceChatActive:a,isVoiceChatLoading:s}},_=()=>{let{messages:e}=T();return{messages:e}},L=()=>{let{avatarRef:e,basePath:t,sessionState:l,setSessionState:a,stream:s,setStream:i,setIsListening:o,setIsUserTalking:c,setIsAvatarTalking:u,setConnectionQuality:d,handleUserTalkingMessage:v,handleStreamingTalkingMessage:C,handleEndMessage:h,clearMessages:x}=T(),{stopVoiceChat:p}=y();_();let f=(0,r.useCallback)(l=>(e.current=new n.Ay({token:l,basePath:t}),e.current),[t,e]),m=(0,r.useCallback)(e=>{let{detail:t}=e;i(t),a(g.CONNECTED)},[a,i]),A=(0,r.useCallback)(async()=>{var t,l,r;null==(t=e.current)||t.off(n.AW.STREAM_READY,m),null==(l=e.current)||l.off(n.AW.STREAM_DISCONNECTED,A),x(),p(),o(!1),c(!1),u(!1),i(null),await (null==(r=e.current)?void 0:r.stopAvatar()),a(g.INACTIVE)},[m,a,i,e,o,p,x,c,u]),j=(0,r.useCallback)(async(t,r)=>{if(l!==g.INACTIVE)throw Error("There is already an active session");if(!e.current){if(!r)throw Error("Token is required");f(r)}if(!e.current)throw Error("Avatar is not initialized");return a(g.CONNECTING),e.current.on(n.AW.STREAM_READY,m),e.current.on(n.AW.STREAM_DISCONNECTED,A),e.current.on(n.AW.CONNECTION_QUALITY_CHANGED,e=>{let{detail:t}=e;return d(t)}),e.current.on(n.AW.USER_START,()=>{c(!0)}),e.current.on(n.AW.USER_STOP,()=>{c(!1)}),e.current.on(n.AW.AVATAR_START_TALKING,()=>{u(!0)}),e.current.on(n.AW.AVATAR_STOP_TALKING,()=>{u(!1)}),e.current.on(n.AW.USER_TALKING_MESSAGE,v),e.current.on(n.AW.AVATAR_TALKING_MESSAGE,C),e.current.on(n.AW.USER_END_MESSAGE,h),e.current.on(n.AW.AVATAR_END_MESSAGE,h),await e.current.createStartAvatar(t),e.current},[f,m,A,a,e,l,d,c,v,C,h,u]);return{avatarRef:e,sessionState:l,stream:s,initAvatar:f,startAvatar:j,stopAvatar:A}},I=()=>{let{avatarRef:e}=T();return{interrupt:(0,r.useCallback)(()=>{e.current&&e.current.interrupt()},[e])}},R=(0,r.forwardRef)((e,t)=>{let{}=e,{sessionState:l,stopAvatar:r}=L(),{connectionQuality:s}=E(),i=l===g.CONNECTED;return(0,a.jsxs)(a.Fragment,{children:[s!==n._N.UNKNOWN&&(0,a.jsxs)("div",{className:"absolute top-3 left-3 bg-black text-white rounded-lg px-3 py-2",children:["Connection Quality: ",s]}),i&&(0,a.jsx)(o,{className:"absolute top-3 right-3 !p-2 bg-zinc-700 bg-opacity-50 z-10",onClick:r,children:(0,a.jsx)(d.US,{})}),(0,a.jsx)("video",{ref:t,autoPlay:!0,playsInline:!0,style:{width:"100%",height:"100%",objectFit:"contain"},children:(0,a.jsx)("track",{kind:"captions"})}),!i&&(0,a.jsx)("div",{className:"w-full h-full flex items-center justify-center absolute top-0 left-0",children:"Loading..."})]})});R.displayName="AvatarVideo";var M=l(4061);let O=()=>{let{avatarRef:e,isAvatarTalking:t,isUserTalking:l,isListening:a}=T();return{isAvatarListening:a,startListening:(0,r.useCallback)(()=>{e.current&&e.current.startListening()},[e]),stopListening:(0,r.useCallback)(()=>{e.current&&e.current.stopListening()},[e]),isUserTalking:l,isAvatarTalking:t}},V=()=>{let{muteInputAudio:e,unmuteInputAudio:t,isMuted:l,isVoiceChatLoading:n}=y(),{isUserTalking:r}=O();return(0,a.jsx)("div",{children:(0,a.jsxs)(o,{className:"!p-2 relative",disabled:n,onClick:()=>{l?t():e()},children:[(0,a.jsx)("div",{className:"absolute left-0 top-0 rounded-lg border-2 border-[#7559FF] w-full h-full ".concat(r?"animate-ping":"")}),n?(0,a.jsx)(d.mP,{className:"animate-spin",size:20}):l?(0,a.jsx)(d.KA,{size:20}):(0,a.jsx)(d.L9,{size:20})]})})};var D=l(9073);let z=()=>{let{avatarRef:e}=T(),t=(0,r.useCallback)(t=>{e.current&&e.current.speak({text:t,taskType:n.wP.TALK,taskMode:n.FL.ASYNC})},[e]),l=(0,r.useCallback)(async t=>{var l;if(e.current)return await (null==(l=e.current)?void 0:l.speak({text:t,taskType:n.wP.TALK,taskMode:n.FL.SYNC}))},[e]);return{sendMessage:t,sendMessageSync:l,repeatMessage:(0,r.useCallback)(t=>{var l;if(e.current)return null==(l=e.current)?void 0:l.speak({text:t,taskType:n.wP.REPEAT,taskMode:n.FL.ASYNC})},[e]),repeatMessageSync:(0,r.useCallback)(async t=>{var l;if(e.current)return await (null==(l=e.current)?void 0:l.speak({text:t,taskType:n.wP.REPEAT,taskMode:n.FL.SYNC}))},[e])}},U=()=>{let{sendMessage:e,sendMessageSync:t,repeatMessage:l,repeatMessageSync:s}=z(),{startListening:i,stopListening:u}=O(),[C,h]=(0,r.useState)(n.wP.TALK),[x,p]=(0,r.useState)(n.FL.ASYNC),[g,f]=(0,r.useState)(""),m=(0,r.useCallback)(()=>{""!==g.trim()&&(C===n.wP.TALK?x===n.FL.SYNC?t(g):e(g):x===n.FL.SYNC?s(g):l(g),f(""))},[C,x,g,e,t,l,s]);(0,r.useEffect)(()=>{let e=e=>{"Enter"===e.key&&m()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[m]);let A=(0,D.A)(g);return(0,r.useEffect)(()=>{!A&&g?i():A&&!g&&u()},[g,A,i,u]),(0,a.jsxs)("div",{className:"flex flex-row gap-2 items-end w-full",children:[(0,a.jsx)(v,{isSelected:e=>e===C,options:Object.values(n.wP),renderOption:e=>e.toUpperCase(),value:C.toUpperCase(),onSelect:h}),(0,a.jsx)(v,{isSelected:e=>e===x,options:Object.values(n.FL),renderOption:e=>e.toUpperCase(),value:x.toUpperCase(),onSelect:p}),(0,a.jsx)(c,{className:"min-w-[500px]",placeholder:"Type something for the avatar to ".concat(C===n.wP.REPEAT?"repeat":"respond","..."),value:g,onChange:f}),(0,a.jsx)(o,{className:"!p-2",onClick:m,children:(0,a.jsx)(d.qx,{size:20})})]})},P=()=>{let{isVoiceChatLoading:e,isVoiceChatActive:t,startVoiceChat:l,stopVoiceChat:n}=y(),{interrupt:r}=I();return(0,a.jsxs)("div",{className:"flex flex-col gap-3 relative w-full items-center",children:[(0,a.jsxs)(M.OY,{className:"bg-zinc-700 rounded-lg p-1 ".concat(e?"opacity-50":""),disabled:e,type:"single",value:t||e?"voice":"text",onValueChange:a=>{"voice"!==a||t||e?"text"===a&&t&&!e&&n():l()},children:[(0,a.jsx)(M.dz,{className:"data-[state=on]:bg-zinc-800 rounded-lg p-2 text-sm w-[90px] text-center",value:"voice",children:"Voice Chat"}),(0,a.jsx)(M.dz,{className:"data-[state=on]:bg-zinc-800 rounded-lg p-2 text-sm w-[90px] text-center",value:"text",children:"Text Chat"})]}),t||e?(0,a.jsx)(V,{}):(0,a.jsx)(U,{}),(0,a.jsx)("div",{className:"absolute top-[-70px] right-3",children:(0,a.jsx)(o,{className:"!bg-zinc-700 !text-white",onClick:r,children:"Interrupt"})})]})},W=()=>{let{messages:e}=_(),t=(0,r.useRef)(null);return(0,r.useEffect)(()=>{let l=t.current;l&&0!==e.length&&(l.scrollTop=l.scrollHeight)},[e]),(0,a.jsx)("div",{ref:t,className:"w-[600px] overflow-y-auto flex flex-col gap-2 px-2 py-2 text-white self-center max-h-[150px]",children:e.map(e=>(0,a.jsxs)("div",{className:"flex flex-col gap-1 max-w-[350px] ".concat(e.sender===f.CLIENT?"self-end items-end":"self-start items-start"),children:[(0,a.jsx)("p",{className:"text-xs text-zinc-400",children:e.sender===f.AVATAR?"Avatar":"You"}),(0,a.jsx)("p",{className:"text-sm",children:e.content})]},e.id))})},G={quality:n.dc.Low,avatarName:h[0].avatar_id,knowledgeId:"a286c58ec5aa402f84998e9f3442818e",voice:{voiceId:"k5s3UySMcUwfAJJGcBEY",rate:.85,emotion:n.qN.EXCITED,model:n.fr.eleven_flash_v2_5},language:"id",voiceChatTransport:n.C.WEBSOCKET,sttSettings:{provider:n.t$.DEEPGRAM}};function F(){let{initAvatar:e,startAvatar:t,stopAvatar:l,sessionState:c,stream:u}=L(),{startVoiceChat:v}=y(),[C,h]=(0,r.useState)(G),x=(0,r.useRef)(null);async function f(){try{let e=await fetch("/api/get-access-token",{method:"POST"}),t=await e.text();return console.log("Access Token:",t),t}catch(e){throw console.error("Error fetching access token:",e),e}}let m=(0,s.A)(async l=>{try{let a=await f(),r=e(a);r.on(n.AW.AVATAR_START_TALKING,e=>{console.log("Avatar started talking",e)}),r.on(n.AW.AVATAR_STOP_TALKING,e=>{console.log("Avatar stopped talking",e)}),r.on(n.AW.STREAM_DISCONNECTED,()=>{console.log("Stream disconnected")}),r.on(n.AW.STREAM_READY,e=>{console.log(">>>>> Stream ready:",e.detail)}),r.on(n.AW.USER_START,e=>{console.log(">>>>> User started talking:",e)}),r.on(n.AW.USER_STOP,e=>{console.log(">>>>> User stopped talking:",e)}),r.on(n.AW.USER_END_MESSAGE,e=>{console.log(">>>>> User end message:",e)}),r.on(n.AW.USER_TALKING_MESSAGE,e=>{console.log(">>>>> User talking message:",e)}),r.on(n.AW.AVATAR_TALKING_MESSAGE,e=>{console.log(">>>>> Avatar talking message:",e)}),r.on(n.AW.AVATAR_END_MESSAGE,e=>{console.log(">>>>> Avatar end message:",e)}),await t(C),l&&await v()}catch(e){console.error("Error starting avatar session:",e)}});return(0,i.A)(()=>{l()}),(0,r.useEffect)(()=>{u&&x.current&&(x.current.srcObject=u,x.current.onloadedmetadata=()=>{x.current.play()})},[x,u]),(0,a.jsxs)("div",{className:"w-full flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex flex-col rounded-xl bg-zinc-900 overflow-hidden",children:[(0,a.jsx)("div",{className:"relative w-full aspect-video overflow-hidden flex flex-col items-center justify-center",children:c!==g.INACTIVE?(0,a.jsx)(R,{ref:x}):(0,a.jsx)(p,{config:C,onConfigChange:h})}),(0,a.jsx)("div",{className:"flex flex-col gap-3 items-center justify-center p-4 border-t border-zinc-700 w-full",children:c===g.CONNECTED?(0,a.jsx)(P,{}):c===g.INACTIVE?(0,a.jsxs)("div",{className:"flex flex-row gap-4",children:[(0,a.jsx)(o,{onClick:()=>m(!0),children:"Start Voice Chat"}),(0,a.jsx)(o,{onClick:()=>m(!1),children:"Start Text Chat"})]}):(0,a.jsx)(d.mP,{})})]}),c===g.CONNECTED&&(0,a.jsx)(W,{})]})}function K(){return(0,a.jsx)(k,{basePath:"https://api.heygen.com",children:(0,a.jsx)(F,{})})}function B(){return(0,a.jsx)("div",{className:"w-screen h-screen flex flex-col",children:(0,a.jsx)("div",{className:"w-[900px] flex flex-col items-start justify-start gap-5 mx-auto pt-4 pb-20",children:(0,a.jsx)("div",{className:"w-full",children:(0,a.jsx)(K,{})})})})}},9111:(e,t,l)=>{"use strict";l.d(t,{D3:()=>r,KA:()=>o,L9:()=>i,US:()=>u,mP:()=>c,qX:()=>n,qx:()=>s});var a=l(5155);function n(){return(0,a.jsx)("img",{alt:"Quiclip Logo",className:"h-8",src:"/quiclip-logo.png"})}function r(e){let{size:t=24,width:l,height:n,...r}=e;return(0,a.jsx)("svg",{fill:"none",height:t||n,viewBox:"0 0 20 20",width:t||l,xmlns:"http://www.w3.org/2000/svg",...r,children:(0,a.jsx)("path",{d:"M4.88231 7.6185C4.7173 7.78351 4.6348 7.86601 4.60389 7.96115C4.5767 8.04483 4.5767 8.13498 4.60389 8.21866C4.6348 8.3138 4.7173 8.3963 4.88231 8.56131L8.82165 12.5007C9.47253 13.1515 10.5278 13.1515 11.1787 12.5007L15.118 8.56131C15.283 8.39631 15.3655 8.3138 15.3964 8.21866C15.4236 8.13498 15.4236 8.04484 15.3964 7.96115C15.3655 7.86601 15.283 7.78351 15.118 7.6185L14.8823 7.3828C14.7173 7.21779 14.6348 7.13529 14.5397 7.10438C14.456 7.07719 14.3658 7.07719 14.2822 7.10438C14.187 7.13529 14.1045 7.21779 13.9395 7.3828L10.4716 10.8507C10.3066 11.0157 10.2241 11.0982 10.1289 11.1292C10.0452 11.1563 9.95509 11.1563 9.87141 11.1292C9.77627 11.0982 9.69377 11.0157 9.52876 10.8507L6.06082 7.3828C5.89582 7.21779 5.81331 7.13529 5.71818 7.10438C5.63449 7.07719 5.54435 7.07719 5.46066 7.10438C5.36552 7.13529 5.28302 7.21779 5.11801 7.3828L4.88231 7.6185Z",fill:"currentColor"})})}function s(e){let{size:t=24,width:l,height:n,...r}=e;return(0,a.jsx)("svg",{fill:"none",height:t||n,viewBox:"0 0 16 16",width:t||l,xmlns:"http://www.w3.org/2000/svg",...r,children:(0,a.jsx)("path",{clipRule:"evenodd",d:"M14.686 7.41437C14.8667 7.78396 14.8667 8.21629 14.686 8.58588C14.5413 8.8817 14.2792 9.05684 14.08 9.17191C13.8742 9.29079 13.6015 9.41707 13.2919 9.56042L3.52078 14.0855C3.29008 14.1924 3.07741 14.2909 2.89693 14.3553C2.70994 14.422 2.46552 14.4879 2.19444 14.442C1.8383 14.3817 1.52185 14.1796 1.3175 13.8817C1.16195 13.655 1.11903 13.4055 1.10097 13.2078C1.08355 13.017 1.08357 12.7826 1.08359 12.5284L1.08359 10.1207C1.08359 10.1021 1.08351 10.0829 1.08343 10.0633C1.08255 9.85606 1.08146 9.59598 1.17301 9.35874C1.252 9.15409 1.38025 8.97208 1.54641 8.82886C1.73903 8.66284 1.98433 8.57639 2.17979 8.5075C2.19829 8.50098 2.21635 8.49461 2.23387 8.48835L3.3612 8.08569L2.23387 7.68302C2.21635 7.67676 2.19829 7.67039 2.17979 7.66387C1.98433 7.59498 1.73903 7.50853 1.54641 7.34251C1.38025 7.19929 1.252 7.01728 1.17301 6.81263C1.08146 6.57539 1.08255 6.3153 1.08343 6.10806C1.08351 6.08844 1.08359 6.0693 1.08359 6.05069L1.08359 3.47182C1.08357 3.21759 1.08355 2.98324 1.10097 2.79242C1.11903 2.59472 1.16195 2.34523 1.3175 2.11853C1.52185 1.82069 1.8383 1.61851 2.19444 1.55824C2.46552 1.51236 2.70994 1.57825 2.89693 1.64495C3.07741 1.70933 3.29007 1.80784 3.52076 1.9147L13.2919 6.43983C13.6015 6.58318 13.8742 6.70946 14.08 6.82834C14.2792 6.94341 14.5413 7.11855 14.686 7.41437ZM13.413 7.98287C13.266 7.89792 13.0493 7.79688 12.7045 7.63716L2.98502 3.13597C2.7214 3.01388 2.56493 2.94215 2.44896 2.90078C2.44246 2.89846 2.43638 2.89635 2.4307 2.89443C2.43005 2.90039 2.42941 2.9068 2.42878 2.91367C2.41759 3.03629 2.41693 3.20842 2.41693 3.49893L2.41693 6.05069C2.41693 6.19492 2.41728 6.27013 2.42098 6.32446C2.4211 6.32621 2.42121 6.32787 2.42133 6.32946C2.42279 6.3301 2.42431 6.33077 2.42591 6.33147C2.47584 6.35323 2.54655 6.37886 2.68238 6.42738L5.56736 7.45787C5.83268 7.55263 6.00978 7.80395 6.00978 8.08569C6.00978 8.36742 5.83268 8.61874 5.56736 8.7135L2.68238 9.74399C2.54655 9.79251 2.47584 9.81814 2.42591 9.8399C2.42431 9.8406 2.42279 9.84127 2.42133 9.84191C2.42121 9.8435 2.4211 9.84516 2.42098 9.84691C2.41728 9.90124 2.41693 9.97645 2.41693 10.1207L2.41693 12.5013C2.41693 12.7918 2.41759 12.964 2.42878 13.0866C2.42941 13.0935 2.43005 13.0999 2.4307 13.1058C2.43638 13.1039 2.44246 13.1018 2.44896 13.0995C2.56493 13.0581 2.7214 12.9864 2.98502 12.8643L12.7045 8.36309C13.0493 8.20337 13.266 8.10233 13.413 8.01737C13.4236 8.01125 13.4333 8.0055 13.4422 8.00012C13.4333 7.99474 13.4236 7.98899 13.413 7.98287Z",fill:"currentColor",fillRule:"evenodd"})})}function i(e){let{size:t=24,width:l,height:n,...r}=e;return(0,a.jsxs)("svg",{fill:"none",height:t||n,viewBox:"0 0 20 20",width:t||l,xmlns:"http://www.w3.org/2000/svg",...r,children:[(0,a.jsx)("g",{clipPath:"url(#clip0_9098_19437)",children:(0,a.jsxs)("g",{filter:"url(#filter0_d_9098_19437)",children:[(0,a.jsx)("path",{clipRule:"evenodd",d:"M5.83341 5.00065C5.83341 2.69946 7.6989 0.833984 10.0001 0.833984C12.3013 0.833984 14.1667 2.69946 14.1667 5.00065L14.1667 8.33398C14.1667 10.6352 12.3013 12.5007 10.0001 12.5007C7.6989 12.5007 5.83341 10.6352 5.83341 8.33398L5.83341 5.00065ZM12.5001 5.00065L12.5001 8.33398C12.5001 9.7147 11.3808 10.834 10.0001 10.834C8.61937 10.834 7.50008 9.7147 7.50008 8.33398V5.00065C7.50008 3.61994 8.61937 2.50065 10.0001 2.50065C11.3808 2.50065 12.5001 3.61994 12.5001 5.00065Z",fill:"#232833",fillRule:"evenodd"}),(0,a.jsx)("path",{d:"M5.66675 17.5007H9.16675V15.3688C5.64744 14.9564 2.91675 11.9641 2.91675 8.33398V8.16732C2.91675 7.93396 2.91675 7.81729 2.96216 7.72816C3.00211 7.64975 3.06585 7.58601 3.14425 7.54607C3.23338 7.50065 3.35006 7.50065 3.58341 7.50065H3.91675C4.1501 7.50065 4.26678 7.50065 4.35591 7.54607C4.43431 7.58601 4.49805 7.64975 4.538 7.72816C4.58341 7.81729 4.58341 7.93396 4.58341 8.16732V8.33398C4.58341 11.3255 7.00854 13.7507 10.0001 13.7507C12.9916 13.7507 15.4167 11.3255 15.4167 8.33398V8.16732C15.4167 7.93396 15.4167 7.81729 15.4622 7.72816C15.5021 7.64975 15.5659 7.58601 15.6443 7.54607C15.7334 7.50065 15.8501 7.50065 16.0834 7.50065H16.4167C16.6501 7.50065 16.7668 7.50065 16.8559 7.54607C16.9343 7.58601 16.9981 7.64975 17.038 7.72816C17.0834 7.81729 17.0834 7.93396 17.0834 8.16732V8.33398C17.0834 11.9641 14.3527 14.9564 10.8334 15.3688V17.5007L14.3334 17.5007C14.5668 17.5007 14.6834 17.5007 14.7726 17.5461C14.851 17.586 14.9147 17.6498 14.9547 17.7282C15.0001 17.8173 15.0001 17.934 15.0001 18.1673V18.5007C15.0001 18.734 15.0001 18.8507 14.9547 18.9398C14.9147 19.0182 14.851 19.082 14.7726 19.1219C14.6834 19.1673 14.5668 19.1673 14.3334 19.1673L5.66675 19.1673C5.43339 19.1673 5.31672 19.1673 5.22759 19.1219C5.14918 19.082 5.08544 19.0182 5.0455 18.9398C5.00008 18.8507 5.00008 18.734 5.00008 18.5007V18.1673C5.00008 17.934 5.00008 17.8173 5.0455 17.7282C5.08544 17.6498 5.14918 17.586 5.22759 17.5461C5.31672 17.5007 5.43339 17.5007 5.66675 17.5007Z",fill:"#232833"})]})}),(0,a.jsxs)("defs",{children:[(0,a.jsxs)("filter",{colorInterpolationFilters:"sRGB",filterUnits:"userSpaceOnUse",height:"22.334",id:"filter0_d_9098_19437",width:"18.1667",x:"0.916748",y:"-0.166016",children:[(0,a.jsx)("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),(0,a.jsx)("feColorMatrix",{in:"SourceAlpha",result:"hardAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"}),(0,a.jsx)("feOffset",{dy:"1"}),(0,a.jsx)("feGaussianBlur",{stdDeviation:"1"}),(0,a.jsx)("feColorMatrix",{type:"matrix",values:"0 0 0 0 0.0627451 0 0 0 0 0.0941176 0 0 0 0 0.156863 0 0 0 0.05 0"}),(0,a.jsx)("feBlend",{in2:"BackgroundImageFix",mode:"normal",result:"effect1_dropShadow_9098_19437"}),(0,a.jsx)("feBlend",{in:"SourceGraphic",in2:"effect1_dropShadow_9098_19437",mode:"normal",result:"shape"})]}),(0,a.jsx)("clipPath",{id:"clip0_9098_19437",children:(0,a.jsx)("rect",{fill:"white",height:"20",width:"20"})})]})]})}function o(e){let{size:t=24,width:l,height:n,...r}=e;return(0,a.jsxs)("svg",{fill:"none",height:t||n,viewBox:"0 0 48 48",width:t||l,xmlns:"http://www.w3.org/2000/svg",...r,children:[(0,a.jsx)("path",{d:"M24 2c2.75 0 5.24 1.11 7.047 2.905l-2.864 2.793A6 6 0 0 0 18 12v5.633l-3.898 3.803A10.09 10.09 0 0 1 14 20v-8c0-5.523 4.477-10 10-10Z","data-follow-fill":"#232833",fill:"#232833"}),(0,a.jsx)("path",{clipRule:"evenodd",d:"m18.151 28.112-2.172 2.12A12.945 12.945 0 0 0 24 33c7.18 0 13-5.82 13-13v-1a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v1c0 8.712-6.554 15.894-15 16.884V42h9a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H13a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1h9v-5.116a16.925 16.925 0 0 1-8.904-3.84l-6.185 6.033a1 1 0 0 1-1.414-.017l-1.292-1.324a1 1 0 0 1 .018-1.414l33.642-32.82a1 1 0 0 1 1.415.017l1.291 1.324a1 1 0 0 1-.017 1.414L34 12.651V20c0 5.523-4.477 10-10 10-2.184 0-4.204-.7-5.849-1.888ZM30 16.552l-8.912 8.695A6 6 0 0 0 30 20v-3.447Z","data-follow-fill":"#232833",fill:"#232833",fillRule:"evenodd"}),(0,a.jsx)("path",{d:"M11 20c0 1.353.207 2.658.59 3.885l-3.119 3.043A16.94 16.94 0 0 1 7 20v-1a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v1Z","data-follow-fill":"#232833",fill:"#232833"})]})}function c(e){let{size:t=24,width:l,height:n,className:r,...s}=e;return(0,a.jsxs)("svg",{className:"animate-spin ".concat(r),fill:"none",height:t||n,viewBox:"0 0 1024 1024",width:t||l,xmlns:"http://www.w3.org/2000/svg",...s,children:[(0,a.jsx)("path",{d:"M512 170.667c-188.523 0-341.333 152.81-341.333 341.333S323.477 853.333 512 853.333a339.84 339.84 0 0 0 208.704-71.232c22.4-17.322 33.621-26.005 39.403-28.842 4.202-2.07 5.781-2.944 7.466-3.499 1.664-.576 3.435-.853 8.043-1.813 6.315-1.28 22.997-1.28 56.384-1.28 13.333 0 20.01 0 22.933 2.325a10.347 10.347 0 0 1 4.011 8.256c.043 3.733-3.627 8.384-10.923 17.707C769.941 874.624 648.448 938.667 512 938.667 276.352 938.667 85.333 747.648 85.333 512S276.352 85.333 512 85.333c136.448 0 257.92 64.043 336.021 163.712 7.318 9.323 10.966 13.974 10.923 17.707a10.347 10.347 0 0 1-4.01 8.256c-2.923 2.325-9.6 2.325-22.934 2.325-33.387 0-50.07 0-56.384-1.28-4.608-.938-6.379-1.237-8.043-1.813-1.685-.555-3.264-1.43-7.466-3.499-5.782-2.837-16.982-11.52-39.403-28.842A339.84 339.84 0 0 0 512 170.667z","data-follow-fill":"#2c2c2c",fill:"currentColor"}),(0,a.jsx)("path",{d:"M832 682.667a170.667 170.667 0 1 0 0-341.334 170.667 170.667 0 0 0 0 341.334z","data-follow-fill":"#2c2c2c",fill:"currentColor"})]})}function u(e){let{size:t=24,width:l,height:n,...r}=e;return(0,a.jsx)("svg",{fill:"none",height:t||n,viewBox:"0 0 20 20",width:t||l,xmlns:"http://www.w3.org/2000/svg",...r,children:(0,a.jsx)("path",{d:"M15.7135 3.43055C15.8086 3.46146 15.8911 3.54396 16.0562 3.70897L16.2919 3.94467C16.4569 4.10968 16.5394 4.19218 16.5703 4.28732C16.5975 4.37101 16.5975 4.46115 16.5703 4.54484C16.5394 4.63997 16.4569 4.72248 16.2919 4.88748L11.1785 10.0008L16.2918 15.1141C16.4568 15.2791 16.5393 15.3616 16.5702 15.4568C16.5974 15.5404 16.5974 15.6306 16.5702 15.7143C16.5393 15.8094 16.4568 15.8919 16.2918 16.0569L16.0561 16.2926C15.8911 16.4576 15.8086 16.5401 15.7135 16.571C15.6298 16.5982 15.5396 16.5982 15.4559 16.571C15.3608 16.5401 15.2783 16.4576 15.1133 16.2926L10 11.1793L4.8868 16.2925C4.7218 16.4575 4.63929 16.5401 4.54415 16.571C4.46047 16.5982 4.37032 16.5982 4.28664 16.571C4.1915 16.5401 4.109 16.4575 3.94399 16.2925L3.70829 16.0568C3.54328 15.8918 3.46078 15.8093 3.42987 15.7142C3.40267 15.6305 3.40267 15.5404 3.42987 15.4567C3.46078 15.3615 3.54328 15.279 3.70829 15.114L8.8215 10.0008L3.70824 4.88756C3.54323 4.72255 3.46073 4.64005 3.42982 4.54491C3.40263 4.46123 3.40263 4.37108 3.42982 4.2874C3.46073 4.19226 3.54323 4.10976 3.70824 3.94475L3.94394 3.70905C4.10895 3.54404 4.19145 3.46154 4.28659 3.43062C4.37027 3.40343 4.46042 3.40343 4.5441 3.43062C4.63924 3.46154 4.72174 3.54404 4.88675 3.70905L10 8.82231L15.1133 3.70897C15.2784 3.54396 15.3609 3.46146 15.456 3.43055C15.5397 3.40336 15.6298 3.40336 15.7135 3.43055Z",fill:"currentColor"})})}},9865:(e,t,l)=>{Promise.resolve().then(l.bind(l,3215))}},e=>{var t=t=>e(e.s=t);e.O(0,[501,45,441,684,358],()=>t(9865)),_N_E=e.O()}]);