1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="2a9fa31e-f25d-407d-9446-2e6d6fa5d40e",e._sentryDebugIdIdentifier="sentry-dbid-2a9fa31e-f25d-407d-9446-2e6d6fa5d40e")}catch(e){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9552,9195],{26869:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/chat/[slug]",function(){return t(99594)}])},13730:function(e,n,t){"use strict";t.d(n,{m:function(){return LivekitWebClient}});var l=t(26729),o=t(95591);new TextDecoder;let LivekitWebClient=class LivekitWebClient extends l.EventEmitter{async startCall(e){try{var n;this.room=new o.du({audioCaptureDefaults:{autoGainControl:!0,echoCancellation:!0,noiseSuppression:!0,channelCount:1,deviceId:e.captureDeviceId,sampleRate:e.sampleRate},audioOutput:{deviceId:e.playbackDeviceId}}),this.handleRoomEvents(),this.handleAudioEvents(e),this.handleDataEvents(),await this.room.connect(null!==(n=e.hostUrl)&&void 0!==n?n:"wss://lexia-z6wyiuzl.livekit.cloud",e.accessToken),console.log("connected to room",this.room.name),this.room.localParticipant.setMicrophoneEnabled(!0),this.connected=!0,this.emit("call_started")}catch(e){this.emit("error","Error starting call"),console.error("Error starting call",e),this.stopCall()}}async startAudioPlayback(){await this.room.startAudio()}stopCall(){if(this.connected){var e;this.connected=!1,this.emit("call_ended"),null===(e=this.room)||void 0===e||e.disconnect()}this.isAgentTalking=!1,delete this.room,this.analyzerComponent&&(this.analyzerComponent.cleanup(),delete this.analyzerComponent),this.captureAudioFrame&&(window.cancelAnimationFrame(this.captureAudioFrame),delete this.captureAudioFrame)}mute(){this.connected&&this.room.localParticipant.setMicrophoneEnabled(!1)}unmute(){this.connected&&this.room.localParticipant.setMicrophoneEnabled(!0)}captureAudioSamples(){if(!this.connected||!this.analyzerComponent)return;let e=this.analyzerComponent.analyser.fftSize,n=new Float32Array(e);this.analyzerComponent.analyser.getFloatTimeDomainData(n),this.emit("audio",n),this.captureAudioFrame=window.requestAnimationFrame(()=>this.captureAudioSamples())}handleRoomEvents(){this.room.on(o.TQ.ParticipantDisconnected,e=>{(null==e?void 0:e.identity)==="server"&&this.stopCall()}),this.room.on(o.TQ.Disconnected,()=>{this.connected&&this.stopCall()})}async sendText(e){console.log("sending text",e),await this.room.localParticipant.publishData(new TextEncoder().encode(JSON.stringify({code:e})),{topic:"user_input",reliable:!0})}handleAudioEvents(e){this.room.on(o.TQ.TrackSubscribed,(n,t,l)=>{n.kind===o.fQ.Kind.Audio&&("agent_audio"===t.trackName&&n instanceof o.rl&&e.emitRawAudioSamples&&(this.analyzerComponent=(0,o.OE)(n),this.captureAudioFrame=window.requestAnimationFrame(()=>this.captureAudioSamples())),n.attach())})}handleDataEvents(){this.room.on(o.TQ.ActiveSpeakersChanged,e=>{if(0===e.length){this.isAgentTalking&&(this.isAgentTalking=!1,setTimeout(()=>{this.isAgentTalking||this.emit("agent_stop_talking")},1e3));return}let n=e[0];n.isAgent?(this.isAgentTalking=!0,this.emit("agent_start_talking")):(this.isAgentTalking=!1,setTimeout(()=>{this.isAgentTalking||(this.isAgentTalking=!1,this.emit("agent_stop_talking"))},1e3))})}constructor(){super(),this.connected=!1,this.isAgentTalking=!1}}},30070:function(e,n,t){"use strict";t.d(n,{Z:function(){return AgentWelcomeMessage}});
1var l=t(85893),o=t(50797),s=t(22338),a=t(57747),i=t(79970),r=t(22757),c=t(71293);function AgentWelcomeMessage(e){var n,t,d;return(0,l.jsx)(s.W,{maxW:"900px",h:"100%",children:(0,l.jsxs)(a.xu,{mt:[10,null],display:"flex",flexDirection:"column",justifyContent:[null,"center"],alignItems:"center",h:"100%",children:[(0,l.jsx)(i.E,{src:(0,o.T3)(e.agent),alt:"".concat(e.agent.name," logo"),boxSize:"80px",rounded:"full",objectFit:"cover",mb:4}),(0,l.jsx)(r.X,{fontSize:"md",textAlign:"center",children:null===(n=e.agent)||void 0===n?void 0:n.name}),(0,l.jsx)(c.x,{mt:2,textAlign:"center",children:null!==(d=null===(t=e.agent)||void 0===t?void 0:t.welcome_message)&&void 0!==d?d:"Hello! How can I help you today?"})]})})}},80783:function(e,n,t){"use strict";t.d(n,{Z:function(){return CodeEditor}});var l=t(85893);t(67294);var o=t(63764),s=t(57747),a=t(41731);function CodeEditor(e){var n,t;return(0,l.jsxs)(s.xu,{position:"relative",h:"100%",children:[(0,l.jsx)(o.ZP,{language:e.language,height:"100%",onChange:n=>e.onChange(n),theme:"vs-dark",value:null!==(n=e.value)&&void 0!==n?n:"// Start coding",defaultValue:"// some comment"}),(0,l.jsx)(s.xu,{position:"absolute",top:0,right:0,mt:2,mr:2,zIndex:100,children:(0,l.jsx)(s.xu,{p:2,children:(0,l.jsxs)(a.P,{color:"white",onChange:n=>e.onLanguageChange(n.target.value),value:null!==(t=e.language)&&void 0!==t?t:"python",children:[(0,l.jsx)("option",{value:"python",children:"Python"}),(0,l.jsx)("option",{value:"javascript",children:"Javascript"}),(0,l.jsx)("option",{value:"typescript",children:"Typescript"}),(0,l.jsx)("option",{value:"java",children:"Java"}),(0,l.jsx)("option",{value:"csharp",children:"C#"}),(0,l.jsx)("option",{value:"go",children:"Go"}),(0,l.jsx)("option",{value:"ruby",children:"Ruby"}),(0,l.jsx)("option",{value:"php",children:"PHP"}),(0,l.jsx)("option",{value:"rust",children:"Rust"}),(0,l.jsx)("option",{value:"swift",children:"Swift"})]})})})]})}},71181:function(e,n,t){"use strict";t.d(n,{Z:function(){return EmailCodeModal}});var l=t(85893),o=t(57747),s=t(85970),a=t(5418),i=t(33090),r=t(93108),c=t(34292),d=t(61639),u=t(67294);function EmailCodeModal(e){var n;let[t,h]=(0,u.useState)(e.email),[g,p]=(0,u.useState)(null!==(n=e.stage)&&void 0!==n?n:"email"),[x,m]=(0,u.useState)(""),[f,v]=(0,u.useState)(!1),onContinueWithEmail=async()=>{v(!0);let n=await e.onContinueWithEmail(t);n&&p("code"),v(!1)};(0,u.useEffect)(()=>{p(e.stage)},[e.stage]);let onSendCode=async()=>{v(!0),await e.onSendCode(x),v(!1)};return(0,l.jsxs)(d.Z,{title:"Log in",isOpen:e.isOpen,onClose:e.onClose,children:["email"==g&&(0,l.jsxs)(o.xu,{children:[(0,l.jsxs)(s.NI,{children:[(0,l.jsx)(a.l,{children:"Email"}),(0,l.jsx)(i.I,{placeholder:"Your email....",value:e.email,onChange:e=>h(e.target.value)})]}),(0,l.jsx)(r.z,{mt:4,colorScheme:"blue",isLoading:f,onClick:()=>onContinueWithEmail(),children:"Continue"})]}),"code"==g&&(0,l.jsxs)(o.xu,{children:[(0,l.jsxs)(s.NI,{children:[(0,l.jsx)(a.l,{children:"Code"}),(0,l.jsx)(i.I,{placeholder:"Your code....",value:x,onChange:e=>m(e.target.value)}),(0,l.jsx)(s.Q6,{children:"We've sent a code to the email you provided in the previous step. It may take a couple of minutes to arrive"})]}),(0,l.jsxs)(c.U,{alignItems:"flex-end",justifyContent:"space-between",children:[(0,l.jsx)(r.z,{mt:4,colorScheme:"blue",isLoading:f,onClick:()=>onSendCode(),children:"Submit"}),(0,l.jsx)(r.z,{onClick:()=>p("email"),variant:"link",mb:2,children:"Go back"})]})]})]})}},72463:function(e,n,t){"use strict";t.d(n,{$:function(){return Footer}});var l=t(85893),o=t(57747),s=t(22338),a=t(79078),i=t(68519),r=t(55281),c=t(34292),d=t(32883),u=t(71293),h=t(78590),g=t(89993),p=t(89583);let Footer=e=>(0,l.jsx)(o.xu,{as:"footer",role:"contentinfo",py:{base:"12",md:"16"},bgColor:"blackAlpha.100",children:(0,l.jsx)(s.W,{maxW:"container.xl",children:(0,l.jsxs)(a.r,{templateColumns:{base:"1fr",md:"repeat(4, 1fr)"},justifyContent:"center",gap:{base:"8",md:"10"},children:[(0,l.jsx)(i.P,{children:(0,l.jsxs)(r.K,{spacing:"2",children:[!e.isFaang&&(0,l.jsxs)(c.U,{justifyContent:"space-between",children:[(0,l.jsx)(d.r,{href:"https://www.agenthost.ai",children:(0,l.jsx)(u.x,{fontWeight:"bold",fontSize:"lg",children:"Agenthost"})}),(0,l.jsx)(h.h,{variant:"tertiary",children:(0,l.jsx)(g.h,{as:"a",href:"https://www.twitter.com/agenthostai","aria-label":"Twitter",icon:(0,l.jsx)(p.fWC,{})})})]}),!e.isFaang&&(0,l.jsx)(u.x,{children:"Create, train and monetize useful AI Agents"}),!e.faang&&(0,l.jsx)("iframe",{src:"https://status.agenthost.ai/badge?theme=light",width:"250",height:"30",frameBorder:"0",scrolling:"no",style:{colorScheme:"normal"}}),(0,l.jsxs)(u.x,{fontSize:"sm",color:"fg.subtle",children:["\xa9 ",new Date().getFullYear()," TheRoaming, Inc. All rights reserved."]}),!e.isFaang&&(0,l.jsxs)(c.U,{children:[(0,l.jsx)(d.r,{href:"/privacy",children:(0,l.jsx)(u.x,{fontSize:"xs",children:"Privacy"})}),(0,l.jsx)(d.r,{href:"/terms",children:(0,l.jsx)(u.x,{fontSize:"xs",children:"Terms of Service"})}),(0,l.jsx)(d.r,{href:"/sitemap",children:(0,l.jsx)(u.x,{fontSize:"xs",children:"Sitemap"})})]})]})}),!e.isFaang&&(0,l.jsx)(i.P,{children:(0,l.jsxs)(r.K,{spacing:"2",children:[(0,l.jsx)(d.r,{href:"https://www.agenthost.ai/blogs",children:(0,l.jsx)(u.x,{fontWeight:"bold",children:"Blogs"})}),(0,l.jsx)(d.r,{href:"https://www.agenthost.ai/blog/open-ai-gpt-to-assistant",children:(0,l.jsx)(u.x,{children:"How to create an OpenAI assistant from a GPT"})}),(0,l.jsx)(d.r,{href:"https://www.agenthost.ai/blog/open-ai-host-gpt-website",children:(0,l.jsx)(u.x,{children:"How to host your GPT on your own website without any coding"})}),(0,l.jsx)(d.r,{href:"https://www.agenthost.ai/blog/monetize-open-ai-gpt",children:(0,l.jsx)(u.x,{children:"How to make money from your OpenAI GPT"})})]})}),!e.isFaang&&(0,l.jsx)(i.P,{children:(0,l.jsxs)(r.K,{spacing:"2",children:[(0,l.jsx)(u.x,{fontWeight:"bold",children:"Learn"}),(0,l.jsx)(d.r,{href:"/marketplace",children:"Agent Marketplace"}),(0,l.jsx)(d.r,{href:"/integrate",children:"Integrations"}),(0,l.jsx)(d.r,{href:"/white-label",children:"White Label AI Platform"}),(0,l.jsx)(d.r,{href:"https://agenthost.getrewardful.com/signup",children:"Affiliate program"}),(0,l.jsx)(d.r,{href:"/alternatives/chatbase",children:"Agenthost vs Chatbase"}),(0,l.jsx)(d.r,{href:"/alternatives/botpress",children:"Agenthost vs Botpress"})]})}),!e.isFaang&&(0,l.jsx)(i.P,{children:(0,l.jsxs)(r.K,{spacing:"2",children:[(0,l.jsx)(u.x,{fontWeight:"bold",children:"Resources"}),(0,l.jsx)(d.r,{href:"https://docs.agenthost.ai",children:"Documentation"}),(0,l.jsx)(d.r,{href:"/tools",children:"AI Tools"}),(0,l.jsx)(d.r,{href:"/tool/assistant-website",children:"OpenAI Assistant to Website Tool"}),(0,l.jsx)(d.r,{href:"/tool/ai-responder",children:"AI Email & Text Responder Tool"})]})})]})})})},74246:function(e,n,t){"use strict";var l=t(85893);t(67294);var o=t(85970),s=t(55281),a=t(57747),i=t(5418),r=t(33090),c=t(57169),d=t(41731),u=t(49269),h=t(45966),g=t(51607),p=t(24259);n.Z=e=>{let{questions:n,answers:t,onAnswerChange:x}=e;console.log("questions",n);let handleFileChange=(e,n)=>{n&&n.length>0&&x(e,n[0])};return(0,l.jsx)(l.Fragment,{children:n&&n.map((e,n)=>{var m,f,v;return(0,l.jsx)(o.NI,{mb:4,children:(0,l.jsx)(s.K,{direction:"row",children:(0,l.jsxs)(a.xu,{flex:1,children:[(0,l.jsx)(i.l,{children:e.question}),e.description&&(0,l.jsx)(o.Q6,{mb:3,children:e.description}),["text","number"].includes(e.inputType)&&(0,l.jsx)(r.I,{mt:1,type:e.inputType,value:t[n]||"",onChange:e=>x(n,e.target.value),autoFocus:!1}),"textarea"===e.inputType&&(0,l.jsx)(c.g,{mt:1,value:t[n]||"",onChange:e=>x(n,e.target.value),autoFocus:!1}),"select"===e.inputType&&(0,l.jsxs)(d.P,{mt:1,width:"100%",value:t[n]||"",onChange:e=>x(n,e.target.value),autoFocus:!1,children:[(0,l.jsx)("option",{value:"",children:"Select an option"}),Array.isArray(e.options)?e.options.map((e,n)=>(0,l.jsx)("option",{value:e,children:e},n)):null===(m=e.options)||void 0===m?void 0:m.trim().split(",").map((e,n)=>(0,l.jsx)("option",{value:e.trim(),children:e.trim()}
1,n))]}),"checkbox"===e.inputType&&(0,l.jsx)(u.c,{colorScheme:"blue",value:t[n]||[],onChange:e=>x(n,e),children:(0,l.jsx)(s.K,{mt:1,spacing:[1,3],direction:["column","row"],children:null===(f=e.options)||void 0===f?void 0:f.trim().split(",").map((e,n)=>(0,l.jsx)(h.X,{value:e.trim(),children:e.trim()},n))})}),"radio"===e.inputType&&(0,l.jsx)(g.E,{onChange:e=>x(n,e),value:t[n]||"",children:(0,l.jsx)(s.K,{direction:"row",mt:1,children:null===(v=e.options)||void 0===v?void 0:v.trim().split(",").map((e,n)=>(0,l.jsx)(p.Y,{value:e.trim(),children:e.trim()},n))})}),"file_input"===e.inputType&&(0,l.jsx)(r.I,{mt:1,type:"file",onChange:e=>handleFileChange(n,e.target.files),autoFocus:!1})]})})},n)})})}},39195:function(e,n,t){"use strict";t.d(n,{Z:function(){return Layout}});var l=t(85893),o=t(57747),s=t(22338),a=t(72463),i=t(66712),r=t(91170),c=t(93108),d=t(4040),u=t(32883),h=t(78230),g=t(83558),p=t(71293),x=t(34292),m=t(87874),f=t(48783),v=t(24880),j=t(78590),_=t(41731),b=t(62877),w=t(47516),y=t(67294),S=t(50797),C=t(67421),k=t(8539),z=t(28743),A=t(14866),E=t(6147);let UsecaseMenu=()=>(0,l.jsxs)(i.v,{children:[(0,l.jsx)(r.j,{as:c.z,rightIcon:(0,l.jsx)(E.v,{}),children:"Usecase"}),(0,l.jsxs)(d.q,{children:[(0,l.jsx)(u.r,{href:"/usecase/ai-saas",children:(0,l.jsx)(h.s,{children:"AI SaaS"})}),(0,l.jsx)(u.r,{href:"/usecase/customer-support",children:(0,l.jsx)(h.s,{children:"Customer Support"})}),(0,l.jsx)(h.s,{as:u.r,href:"/usecase/sms-chatbot",children:"SMS Chatbot"}),(0,l.jsx)(u.r,{href:"/usecase/sales",children:(0,l.jsx)(h.s,{children:"Sales"})}),(0,l.jsx)(u.r,{href:"/usecase/marketing",children:(0,l.jsx)(h.s,{children:"Marketing"})}),(0,l.jsx)(u.r,{href:"/usecase/education",children:(0,l.jsx)(h.s,{children:"Education"})})]})]}),Navbar=e=>{var n,t,a,E,P,I;let T=new z.Z("user"),{i18n:M}=(0,C.$G)(),U=A.ZP.isStage(),[F,O]=(0,y.useState)(!0);(0,y.useEffect)(()=>{if(!localStorage.getItem("language")){var n,t,l,o;(null===(n=e.user)||void 0===n?void 0:n.metadata)&&(0,k.D)(null!==(o=null===(l=e.user)||void 0===l?void 0:null===(t=l.metadata)||void 0===t?void 0:t.defaultLanguage)&&void 0!==o?o:"en")}},[]);let R=(0,g.S)({base:!0,md:!1});return e.hideNav?null:(0,l.jsx)(l.Fragment,{children:(0,l.jsx)(o.xu,{as:"section",pl:3,pr:3,children:(0,l.jsx)(o.xu,{borderBottomWidth:"1px",bgColor:"white",position:"relative",zIndex:"sticky",children:(0,l.jsx)(s.W,{maxW:"container.xl",children:(0,l.jsx)(o.xu,{py:"4",children:(0,l.jsxs)(x.U,{justify:"space-between",spacing:"8",children:[(0,l.jsxs)(x.U,{spacing:"10",children:[F&&(0,l.jsx)(u.r,{href:"/".concat(e.host_only?"?host_only=true":""),children:(0,l.jsxs)(x.U,{spacing:"2",h:"100%",children:[!e.isFaang&&(0,l.jsx)(l.Fragment,{children:(null===(t=e.domainInfo)||void 0===t?void 0:null===(n=t.whitelabel)||void 0===n?void 0:n.icon_url)?(0,l.jsx)(m.q,{size:"sm",src:e.domainInfo.whitelabel.icon_url,name:e.domainInfo.whitelabel.name}):(0,l.jsx)(b.T,{})}),(0,l.jsx)(p.x,{display:["none","block"],fontWeight:"bold",fontSize:"lg",pt:2,children:(null===(E=e.domainInfo)||void 0===E?void 0:null===(a=E.whitelabel)||void 0===a?void 0:a.name)||((null===(I=e.user)||void 0===I?void 0:null===(P=I.creator)||void 0===P?void 0:P.white_label)?"Panel":"Agenthost")}),!e.isFaang&&U&&(0,l.jsx)(v.C,{colorScheme:"orange",children:"STAGE"})]})}),(0,l.jsx)(j.h,{size:"lg",variant:"text",colorScheme:"gray",spacing:"8",display:{base:"none",lg:"flex"}})]}),e.showHashtags&&(0,l.jsxs)(x.U,{spacing:16,display:{base:"none",md:"flex"},children:[(0,l.jsx)(UsecaseMenu,{}),(0,l.jsx)(u.r,{href:"#features",children:"Features"}),(0,l.jsx)(u.r,{href:"#pricing",children:"Pricing"}),(0,l.jsx)(u.r,{href:"https://docs.agenthost.ai",target:"_blank",children:"Docs"})]}),!e.isFaang&&(0,l.jsxs)(x.U,{spacing:{base:"4",md:"8"},children:[!e.hideButtons&&(0,l.jsxs)(l.Fragment,{children:[!e.user&&(0,l.jsx)(u.r,{href:"/login".concat(e.host_only?"?host_only=true":""),children:(0,l.jsx)(c.z,{colorScheme:"blue",children:"Get started"})}),!e.user&&(0,l.jsx)(u.r,{href:"/login".concat(e.host_only?"?host_only=true":""),display:["none","inline-flex"],children:(0,l.jsx)(c.z,{children:"Log in"})})]}),e.buttonRender&&e.buttonRender,e.showLanguageSelect&&(0,l.jsxs)(_.P,{value:M.language,onChange:n=>{let t=n.target.value;(0,k.D)(t,T,e.user)},size:"sm",children:[(0,l.jsx)("option",{value:"en",children:"English (EN)"}),(0,l.jsx)("option",{value:"fr",children:"French (FR)"}),(0,l.jsx)("option",{value:"de",children:"German (DE)"}),(0,l.jsx)("option",{value:"es",children:"Spanish (ES)"}),(0,l.jsx)("option",{value:"it",children:"Italian (IT)"}),(0,l.jsx)("option",{value:"pt",children:"Portuguese (PT)"}),(0,l.jsx)("option",{value:"ja",children:"Japanese (JA)"}),(0,l.jsx)("option",{value:"zh",children:"Chinese (ZH)"})]}),e.user&&(0,l.jsx)(u.r,{href:"/workspace",children:(0,l.jsx)(p.x,{fontWeight:"600",children:"Dashboard"})}),e.user&&e.showApprovals&&(0,l.jsx)(u.r,{href:"/approvals",children:(0,l.jsx)(x.U,{spacing:1,children:(0,l.jsx)(p.x,{fontWeight:"600",children:"Approvals"})})}),e.user&&(0,l.jsx)(()=>{var n,t;return(0,l.jsxs)(i.v,{children:[(0,l.jsx)(r.j,{as:c.z,rightIcon:(0,l.jsx)(w.OrA,{}),minW:R?"auto":"250px",children:R?(0,l.jsx)(p.x,{children:"Account"}):(0,l.jsxs)(x.U,{spacing:2,children:[(0,l.jsx)(m.q,{size:"sm",name:e.user.email,src:e.user.avatar_url}),(0,l.jsxs)(f.g,{align:"start",spacing:0,children:[(0,l.jsx)(p.x,{fontWeight:"bold",fontSize:"sm",children:(0,S.RH)((null===(n=e.user.organization)||void 0===n?void 0:n.name)||"My Account",18)}),(0,l.jsx)(p.x,{fontSize:"xs",color:"gray.500",children:(0,S.RH)(e.user.email,18)})]})]})}),(0,l.jsxs)(d.q,{children:[!(null===(t=e.user)||void 0===t?void 0:t.agency_creator)&&(0,l.jsx)(u.r,{href:"/marketplace",children:(0,l.jsx)(h.s,{children:"Marketplace"})}),(0,l.jsx)(u.r,{href:"/settings",children:(0,l.jsx)(h.s,{children:"Settings"})}),(0,l.jsx)(h.s,{onClick:()=>(0,S.ni)(!0),children:"Log out"})]})]})},{})]})]})})})})})})};function Layout(e){let n=(0,l.jsx)(Navbar,{domainInfo:e.domainInfo,hideNav:e.hideNav,isFaang:e.isFaang,showLanguageSelect:e.showLanguageSelect,showHashtags:e.showHashtags,user:e.user,host_only:e.host_only,showApprovals:e.showApprovals,hideButtons:e.hideButtons,buttonRender:e.buttonRender}),[t,i]=(0,y.useState)(!1);function shouldRenderFooter(){return!!(t&&(window.location.hostname.includes("agenthost.ai")||window.location.hostname.includes("localhost")))&&!e.clear&&!e.isFaang}if((0,y.useEffect)(()=>{console.log("window.location.hostname is ",window.location.hostname),i(!0),console.log("props.domainInfo is ",e.domainInfo)},[]),e.useContainer){var r,c;return(0,l.jsxs)(l.Fragment,{children:[n,(0,l.jsx)(s.W,{maxW:null!==(r=e.maxW)&&void 0!==r?r:"container.xl",minH:"800px",mt:null!==(c=e.mt)&&void 0!==c?c:4,children:e.children}),!e.clear&&(0,l.jsx)(a.$,{isFaang:e.isFaang})]})}return e.sticky?(0,l.jsxs)(o.xu,{style:{height:"100vh",overflow:"scroll",width:"100%",scrollBehavior:"smooth"},children:[(0,l.jsx)(o.xu,{position:"sticky",top:0,left:0,bg:"white",zIndex:100,children:n}),e.children,!e.clear&&(0,l.jsx)(a.$,{isFaang:e.isFaang})]}):(0,l.jsxs)("div",{style:{width:"100%"},children:[n,e.children,shouldRenderFooter()&&(0,l.jsx)(a.$,{isFaang:e.isFaang})]})}},62877:function(e,n,t){"use strict";t.d(n,{T:function(){return Logo}});
1var l=t(85893),o=t(79970);let Logo=e=>(0,l.jsx)(o.E,{src:"https://www.agenthost.ai/agenthostmascotdark.png",alt:"Logo",h:"30",...e})},86560:function(e,n,t){"use strict";t.d(n,{Z:function(){return NonInitFBScript}});var l=t(85893),o=t(4298),s=t.n(o);function NonInitFBScript(){return(0,l.jsx)(s(),{id:"fbScript2",type:"text/javascript",children:"\n !function(f,b,e,v,n,t,s)\n {if(f.fbq)return;n=f.fbq=function(){n.callMethod?\n n.callMethod.apply(n,arguments):n.queue.push(arguments)};\n if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';\n n.queue=[];t=b.createElement(e);t.async=!0;\n t.src=v;s=b.getElementsByTagName(e)[0];\n s.parentNode.insertBefore(t,s)}(window, document,'script',\n 'https://connect.facebook.net/en_US/fbevents.js');\n "})}},65301:function(e,n,t){"use strict";t.d(n,{Z:function(){return NonInitTiktokScript}});var l=t(85893),o=t(4298),s=t.n(o);function NonInitTiktokScript(){return(0,l.jsx)(s(),{id:"tiktokScript",type:"text/javascript",children:'\n !function (w, d, t) {\n w.TiktokAnalyticsObject=t;var ttq=w[t]=w[t]||[];ttq.methods=["page","track","identify","instances","debug","on","off","once","ready","alias","group","enableCookie","disableCookie","holdConsent","revokeConsent","grantConsent"],ttq.setAndDefer=function(t,e){t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}};for(var i=0;i<ttq.methods.length;i++)ttq.setAndDefer(ttq,ttq.methods[i]);ttq.instance=function(t){for(\n var e=ttq._i[t]||[],n=0;n<ttq.methods.length;n++)ttq.setAndDefer(e,ttq.methods[n]);return e},ttq.load=function(e,n){var r="https://analytics.tiktok.com/i18n/pixel/events.js",o=n&&n.partner;ttq._i=ttq._i||{},ttq._i[e]=[],ttq._i[e]._u=r,ttq._t=ttq._t||{},ttq._t[e]=+new Date,ttq._o=ttq._o||{},ttq._o[e]=n||{};n=document.createElement("script")\n ;n.type="text/javascript",n.async=!0,n.src=r+"?sdkid="+e+"&lib="+t;e=document.getElementsByTagName("script")[0];e.parentNode.insertBefore(n,e)};\n }(window, document, \'ttq\');\n '})}},35596:function(e,n,t){"use strict";t.d(n,{Z:function(){return PoweredBy}});var l=t(85893),o=t(57747),s=t(71293),a=t(93108),i=t(79970),r=t(34292),c=t(41664),d=t.n(c),u=t(83198),h=t(67421);function PoweredBy(e){let{t:n}=(0,h.$G)();return(0,l.jsx)(o.xu,{mt:2,children:(0,l.jsxs)(d(),{target:"_blank",href:"https://www.agenthost.ai?via=chat-ad",onClick:()=>{u.Z.track("agenthost_chat_ad_click")},children:[e.useV1&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(s.x,{fontSize:16,mb:1,children:n("powered.built")}),(0,l.jsxs)(a.z,{rounded:"full",size:"sm",disabled:!0,bgColor:"purple",children:[(0,l.jsx)(i.E,{mb:1,mr:2,src:"https://www.agenthost.ai/agenthostmascotdark.ico",alt:"Agenthost",h:8,width:8}),"Agenthost.ai"]})]}),!e.useV1&&(0,l.jsxs)(r.U,{justifyContent:"center",alignItems:"center",children:[(0,l.jsx)(s.x,{mb:1}),(0,l.jsxs)(a.z,{rounded:"full",size:"sm",disabled:!0,colorScheme:"purple",children:[n("powered.built"),(0,l.jsx)(i.E,{ml:2,mb:1,mr:2,src:"https://www.agenthost.ai/agenthostmascotdark.ico",alt:"Agenthost",h:8,width:8}),"Agenthost"]})]})]})})}},99594:function(e,n,t){"use strict";t.r(n),t.d(n,{__N_SSP:function(){return nr},default:function(){return Chat}});
1var l=t(85893),o=t(5379),s=t.n(o),a=t(28743),i=t(7963),r=t(53978),c=t(92717),d=t(20967),u=t(57747),h=t(22338),g=t(34292),p=t(93108),x=t(87874),m=t(71293),f=t(89993),v=t(36948),j=t(41731),_=t(32883),b=t(78590),w=t(55281),y=t(85970),S=t(82140),C=t(33090),k=t(32735),z=t(93717),A=t(79970),E=t(22757),P=t(24880),I=t(81136),T=t(5418),M=t(47010),U=t(67294),F=t(8193),O=t(74804),R=t(39440),L=t(86893),D=t(14866),W=t(50797),N=t(86650),q=t(61639),Z=t(71181),H=t(96137),G=t(44704),K=t(5434),J=t(39424),V=t(35596);t(17338);var B=t(32616),X=t(80783),Y=t(13990),$=t(40607),Q=t(48783),ee=t(41664),en=t.n(ee),et=t(67421);function AgentPlanCard(e){var n,t,o,s;let[a,i]=(0,U.useState)(!1),{t:r}=(0,et.$G)(),c=e.agentPlan;(null==c?void 0:c.metadata)&&JSON.parse(null==c?void 0:c.metadata),(null==c?void 0:c.metadata)&&(null===(n=JSON.parse(null==c?void 0:c.metadata))||void 0===n||n.exclude_skus);let d=[-1!=c.msg_limit?"".concat(null==c?void 0:c.msg_limit," ").concat(r("agentPlanCard.messages")):r("agentPlanCard.unlimited")],h=e.getPlanClicklink?e.getPlanClicklink(c):"";return console.log("stripeLink",h),(0,l.jsx)(Y.Z,{mb:2,children:(0,l.jsx)($.e,{children:(0,l.jsxs)(w.K,{mt:1,mb:1,children:[(0,l.jsxs)(g.U,{justifyContent:"space-between",gap:6,children:[(0,l.jsxs)(w.K,{spacing:0,maxW:"65%",flex:1,children:[(0,l.jsxs)(m.x,{fontSize:20,fontWeight:"semibold",children:[c.name," ",(0,W.hD)(c,"-")," "]}),(0,l.jsx)(G.Z,{text:c.description,limit:100})]}),(0,l.jsx)(w.K,{children:(0,l.jsx)(m.x,{fontSize:24,fontWeight:600,children:"0.0"===c.pretty_price?r("agentPlanCard.free"):(0,H.l_)("currency",c.currency,"symbol")+c.pretty_price})})]}),(0,l.jsx)(m.x,{fontWeight:600,children:r("agentPlanCard.features")}),(0,l.jsx)(Q.g,{justify:"start",align:"start",gap:1,children:d.slice(0,a?d.length:2).map((e,n)=>(0,l.jsxs)(m.x,{children:["- ",e.replaceAll("_"," ")]},n))}),(0,l.jsx)(g.U,{mt:2,children:(0,l.jsx)(u.xu,{children:(s=(0,l.jsx)(p.z,{colorScheme:"blue",onClick:()=>{let n=e.getPlanClicklink(c);n||e.getPlanOnClick(c)},isDisabled:(null===(o=e.user)||void 0===o?void 0:null===(t=o.plan_object)||void 0===t?void 0:t.name)===c.name,children:"Upgrade"}),h?(0,l.jsx)(en(),{href:h,target:"_blank",children:s}):s)})})]},c.id)})})}function UpgradeModal(e){var n,t,o;let{t:s}=(0,et.$G)(),closeModal=()=>{e.setOpenUpgradeModal(!1)};return(0,l.jsxs)(q.Z,{onClose:()=>closeModal(),isOpen:e.isOpen,size:"3xl",isCentered:!0,children:[(0,l.jsxs)(w.K,{mb:2,children:[(0,l.jsx)(E.X,{children:s("upgradeModal.upgrade")}),(0,l.jsx)(m.x,{children:s("upgradeModal.get_access")}),!e.loginUser&&(0,l.jsxs)(g.U,{children:[(0,l.jsx)(m.x,{fontSize:"sm",color:"gray.500",children:"Already have an account? "}),(0,l.jsx)(p.z,{variant:"link",size:"sm",onClick:()=>{e.setOpenUpgradeModal(!1),e.setOpenLoginModal(!0)},children:"Log in"})]}),e.loginUser&&(0,l.jsx)(g.U,{children:(0,l.jsxs)(m.x,{fontSize:"sm",color:"gray.500",children:["Logged in as ",null===(n=e.loginUser)||void 0===n?void 0:n.email]})})]}),(null===(t=e.agent)||void 0===t?void 0:t.plans)&&(null===(o=e.agent)||void 0===o?void 0:o.plans.map((n,t)=>(null==n?void 0:n.pretty_price)==="0.0"&&e.user?null:(0,l.jsx)(AgentPlanCard,{user:e.user,getPlanClicklink:e.getPlanClicklink,getPlanOnClick:e.getPlanOnClick,agentPlan:n,userPlanId:e.userPlanId,skus:e.agentSkus},"".concat(n.id).concat(t))))]})}var el=t(79352),eo=t(23279),es=t.n(eo),ea=t(85518),ei=t(11365),er=t(50151),ec=t(64325),ed=t(72303),eu=t(13591),eh=t(74574),eg=t(82509),ep=t(94160),ex=t(30381),em=t.n(ex),ef=t(11163);function AgentUserPlanManageModal(e){var n,t,o,s,a,r,c,d,u,h;let[g,x]=(0,U.useState)(!1),{t:f}=(0,et.$G)(),closeModal=()=>{e.setManageModalOpen(!1)},upgrade=()=>{e.setManageModalOpen(!1),e.setOpenUpgradeModal(!0)},handleCancelPlan=async()=>{var n;x(!0);let t=await e.agentUserCancelApi.nonStandard("POST","cancel_sub",{agent_id:null==e?void 0:null===(n=e.agent)||void 0===n?void 0:n.id});if(t&&!t.error)e.setManageModalOpen(!1),j.reload(),v({title:f("manageModal.plan_cancelled"),status:"success",duration:3e3,isClosable:!0});else{let e=(0,R.HH)(t.error,f("manageModal.sorry_failed"));alert(e)}x(!1)},v=(0,i.p)(),j=(0,ef.useRouter)(),_=em()(null==e?void 0:null===(n=e.user)||void 0===n?void 0:n.created_at).format("MMMM Do YYYY");return(0,l.jsxs)(q.Z,{onClose:()=>closeModal(),isOpen:e.isOpen,size:"3xl",children:[(0,l.jsxs)(w.K,{mb:2,children:[(0,l.jsx)(E.X,{children:f("manageModal.manage")}),(0,l.jsx)(m.x,{mt:6,children:null==e?void 0:null===(o=e.user)||void 0===o?void 0:null===(t=o.customer_user_data)||void 0===t?void 0:t.email}),(0,l.jsxs)(m.x,{mt:6,children:[f("manageModal.manage")," ",_]})]}),(0,l.jsxs)(w.K,{mt:4,children:[(0,l.jsxs)(m.x,{fontWeight:600,children:[f("manageModal.current_plan"),":"]}),(0,l.jsx)(m.x,{children:null!==(h=null===(a=e.user)||void 0===a?void 0:null===(s=a.plan_object)||void 0===s?void 0:s.name)&&void 0!==h?h:f("manageModal.free")})]}),(0,l.jsxs)(z.k,{mt:8,gap:6,children:[(null===(c=e.user)||void 0===c?void 0:null===(r=c.plan_object)||void 0===r?void 0:r.name)&&(0,l.jsxs)(ei.J,{children:[(0,l.jsx)(er.x,{children:(0,l.jsx)(p.z,{isDisabled:!(null===(u=e.user)||void 0===u?void 0:null===(d=u.plan_object)||void 0===d?void 0:d.name),colorScheme:"red",variant:"outline",children:f("manageModal.cancel")})}),(0,l.jsxs)(ec.y,{children:[(0,l.jsx)(ed.Q,{}),(0,l.jsx)(eu.u,{}),(0,l.jsx)(eh.Y,{children:f("manageModal.confirmation")}),(0,l.jsx)(eg.b,{children:f("manageModal.warning")}),(0,l.jsx)(ep.D,{display:"flex",justifyContent:"flex-end",children:(0,l.jsx)(b.h,{size:"sm",children:(0,l.jsx)(p.z,{colorScheme:"red",onClick:handleCancelPlan,isLoading:g,children:f("manageModal.delete")})})})]})]}),(0,l.jsx)(p.z,{colorScheme:"blue",onClick:()=>{upgrade()},children:f("manageModal.upgrade")})]})]})}var ev=t(57632),ej=t(39503),e_=t(8539);let SpeechUtil=class SpeechUtil{static isSupported(){return"speechSynthesis"in window}static stop(){this.isSupported()&&(window.speechSynthesis.cancel(),this.currentUtterance=null)}static isSpeaking(){return this.isSupported()&&window.speechSynthesis.speaking}static speak(e,n){var t,l,o,s,a;if(!this.isSupported()){null==n||null===(t=n.onError)||void 0===t||t.call(n,Error("Speech synthesis is not supported in this browser"));return}this.stop();let i=this.cleanTextForSpeech(e);if(!i.trim()){null==n||null===(l=n.onEnd)||void 0===l||l.call(n);return}let r=new SpeechSynthesisUtterance(i);this.currentUtterance=r,r.rate=null!==(o=null==n?void 0:n.rate)&&void 0!==o?o:1,r.pitch=null!==(s=null==n?void 0:n.pitch)&&void 0!==s?s:1,r.volume=null!==(a=null==n?void 0:n.volume)&&void 0!==a?a:1,r.onstart=()=>{var e;null==n||null===(e=n.onStart)||void 0===e||e.call(n)},r.onend=()=>{var e;this.currentUtterance=null,null==n||null===(e=n.onEnd)||void 0===e||e.call(n)},r.onerror=e=>{var t;this.currentUtterance=null,null==n||null===(t=n.onError)||void 0===t||t.call(n,e)},window.speechSynthesis.speak(r)}static cleanTextForSpeech(e){let n=e;return(n=(n=(n=(n=(n=(n=(n=n.replace(/```[\s\S]*?```/g," [code block] ")).replace(/`[^`\n]+`/g," [code] ")).replace(/\[([^\]]+)\]\([^)]+\)/g,"$1")).replace(/\*{1,2}([^*]+)\*{1,2}/g,"$1")).replace(/^#{1,6}\s+/gm,"")).replace(/<[^>]*>/g," ")).replace(/\s+/g," ")).trim()}};SpeechUtil.currentUtterance=null;var eb=t(36855),ew=t(45349),ey=t(21818),eS=t(8244);function CopyButton(e){let{onCopy:n,value:t,setValue:o,hasCopied:s}=(0,r.V)(e.text);return(0,l.jsx)(p.z,{onClick:()=>{n(),e.onClick&&e.onClick()},...e.buttonProps,children:s?"Copied":"Copy"})}function BountyWonModal(e){let[n,t]=(0,U.useState)(null);return(0,l.jsxs)(q.Z,{title:"",isOpen:e.isOpen,onClose:e.onClose,hideClose:!0,hideScroll:!0,
1children:[null==n&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(w.K,{children:[(0,l.jsx)(m.x,{fontSize:"50px",textAlign:"center",children:"\uD83C\uDF89"}),(0,l.jsx)(E.X,{textAlign:"center",children:"Congratulations"}),(0,l.jsx)(m.x,{textAlign:"center",children:"Credos believes you have made a compelling argument that is eligible to win the bounty!"})]}),(0,l.jsx)(w.K,{mt:4,children:(0,l.jsx)(p.z,{colorScheme:"blue",onClick:()=>t("done"),children:"Continue"})})]}),"done"==n&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(w.K,{children:[(0,l.jsx)(m.x,{fontSize:"50px",textAlign:"center",children:"\uD83C\uDF89"}),(0,l.jsx)(E.X,{textAlign:"center",children:e.user?"You have claimed the bounty":"Create an account to claim your bounty"}),(0,l.jsx)(m.x,{textAlign:"center",children:e.user?"Use your dashboard to track your payment and other details related to the bounty":"You need to login or create an account and setup payment details in order to receive the payment from winning the bounty. Please continue to get started"})]}),(0,l.jsx)(w.K,{mt:4,children:(0,l.jsx)(_.r,{href:e.user?"/credos/dashboard":"/credos/login",w:"100%",children:(0,l.jsx)(p.z,{w:"100%",colorScheme:"blue",children:"Continue"})})})]})]})}var eC=t(79688),ek=t(37527),ez=t(9008),eA=t.n(ez),eE=t(82215),eP=t(88087),eI=t(64071),eT=t(87334),eM=t(47234);function SimpleAccordion(e){var n;return(0,l.jsx)(eE.U,{allowToggle:!0,children:(0,l.jsxs)(eP.Q,{border:"none",children:[(0,l.jsxs)(eI.K,{fontSize:null!==(n=e.fontSize)&&void 0!==n?n:"sm",children:[e.title,(0,l.jsx)(eT.X,{})]}),(0,l.jsx)(eM.H,{children:e.children})]})})}var eU=t(70231),eF=t(1702),eO=t(35541),eR=t(19778),eL=t(14581),eD=t(64859),eW=t(66205),eN=t(54346),eq=t(22797),eZ=t(49289),eH=t(14253),components_GDPRView=()=>{let[e,n]=(0,U.useState)(!1),[t,o]=(0,U.useState)(!1),[s,a]=(0,U.useState)(!1),[i,r]=(0,U.useState)(!0),{isOpen:c,onOpen:h,onClose:x}=(0,d.q)(),{isOpen:f,onOpen:v,onClose:j}=(0,d.q)();(0,U.useEffect)(()=>{let checkLocation=async()=>{try{a(!0)}catch(e){console.error("Error checking location:",e),a(!0)}finally{r(!1)}};checkLocation()},[]),(0,U.useEffect)(()=>{if(s&&!i){let e=localStorage.getItem("gdprConsent");null===e?n(!0):o("true"===e)}},[s,i]);let handleConsent=e=>{localStorage.setItem("gdprConsent",e),o(e),n(!1)};return i||!s?null:(0,l.jsxs)(eF.h,{children:[(0,l.jsx)(u.xu,{position:"fixed",top:4,right:4,zIndex:9999,children:(0,l.jsx)(p.z,{onClick:h,size:"md",colorScheme:"blue",variant:"ghost","aria-label":"Privacy Settings",leftIcon:(0,l.jsx)(L.nbt,{}),children:"Privacy"})}),e&&(0,l.jsxs)(u.xu,{position:"fixed",bottom:4,left:4,right:4,bg:"white",p:4,shadow:"md",borderRadius:"md",zIndex:9998,width:"300px",children:[(0,l.jsx)(m.x,{mb:4,children:"We use cookies to improve your experience. Do you accept non-essential cookies?"}),(0,l.jsxs)(g.U,{spacing:4,children:[(0,l.jsx)(p.z,{colorScheme:"blue",onClick:()=>handleConsent(!0),children:"Accept"}),(0,l.jsx)(p.z,{variant:"outline",onClick:()=>handleConsent(!1),children:"Reject"})]})]}),(0,l.jsxs)(eO.u_,{isOpen:c,onClose:x,size:"md",children:[(0,l.jsx)(eR.Z,{}),(0,l.jsxs)(eL.h,{children:[(0,l.jsx)(eD.x,{children:"Privacy Settings"}),(0,l.jsx)(eW.o,{}),(0,l.jsx)(eN.f,{children:(0,l.jsxs)(Q.g,{align:"stretch",spacing:4,children:[(0,l.jsxs)(g.U,{justify:"space-between",children:[(0,l.jsx)(m.x,{children:"Accept non-essential cookies"}),(0,l.jsx)(eq.r,{isChecked:t,onChange:()=>{let e=!t;localStorage.setItem("gdprConsent",e.toString()),o(e)}})]}),(0,l.jsx)(_.r,{href:"https://www.agenthost.ai/privacy",isExternal:!0,color:"blue.500",children:"View our Privacy Policy"}),(0,l.jsx)(eZ.i,{}),(0,l.jsx)(p.z,{colorScheme:"red",onClick:v,children:"Request Data Deletion"})]})}),(0,l.jsx)(eH.m,{children:(0,l.jsx)(p.z,{colorScheme:"blue",onClick:x,children:"Close"})})]})]}),(0,l.jsxs)(eO.u_,{isOpen:f,onClose:j,children:[(0,l.jsx)(eR.Z,{}),(0,l.jsxs)(eL.h,{children:[(0,l.jsx)(eD.x,{children:"Confirm Data Deletion"}),(0,l.jsx)(eW.o,{}),(0,l.jsx)(eN.f,{children:(0,l.jsx)(m.x,{children:"Are you sure you want to request data deletion? This action will initiate the process to delete all your personal data from our systems. This process cannot be undone."})}),(0,l.jsxs)(eH.m,{children:[(0,l.jsx)(p.z,{colorScheme:"red",mr:3,onClick:()=>{console.log("Data deletion request initiated"),alert("Your data deletion request has been received. We will process it and contact you soon."),j(),x()},children:"Yes, delete my data"}),(0,l.jsx)(p.z,{variant:"ghost",onClick:j,children:"Cancel"})]})]})]})]})},eG=t(74246),eK=t(37743),eJ=t(63832);let SimpleGoogleSignIn=e=>{let[n,t]=(0,U.useState)(!1),[o,s]=(0,U.useState)(null),handleGoogleSignIn=async()=>{t(!0);try{let n=(0,eK.v0)(),t=await (0,eK.rh)(n,new eK.hJ),{email:l,displayName:o}=t.user;console.log("Email:",l),console.log("Name:",o),s(l),e.onFinish&&e.onFinish(l,o)}catch(e){console.error("Google Sign-In Error:",e)}finally{t(!1)}};return(0,l.jsx)(p.z,{colorScheme:"gray",isLoading:n,leftIcon:(0,l.jsx)(eJ._8,{}),onClick:handleGoogleSignIn,children:o?"Signing in with ".concat(o):"Continue with Google"})};var eV=t(95392),eB=t(13730),eX=t(30070),eY=t(6532),e$=t(99164),eQ=t(9715);function VoiceChat(e){let{agent:n,agentApi:t,isEmbed:o}=e,[a,i]=(0,U.useState)(!1),[r,c]=(0,U.useState)(!1),[d,g]=(0,U.useState)(null),[x,f]=(0,U.useState)(!1),[j,_]=(0,U.useState)(null),[b,y]=(0,U.useState)(null),[S,C]=(0,U.useState)(300);(0,U.useEffect)(()=>{let e=new eB.m;return _(e),()=>{e&&e.stopCall()}},[]),(0,U.useEffect)(()=>
1{if(!a)return;let e=setInterval(()=>{C(e=>e<=1?(endSession(),0):e-1)},1e3);return()=>clearInterval(e)},[a]);let startSession=async()=>{c(!0),g(null);try{let e=await t.nonStandard("POST","".concat(null==n?void 0:n.id,"/speak"),{},null);if(!e||e.error)throw Error("Failed to start voice session");console.log("response is ",e);let l=e.access_token;if(y(l),console.log("Has Access Token: ",!!l),!j)throw Error("SDK not initialized");j.on("call_started",()=>{console.log("Voice session started"),i(!0),c(!1),C(300)}),j.on("call_ended",()=>{console.log("Voice session ended"),i(!1),f(!1)}),j.on("error",e=>{console.error("Voice session error:",e),g("An error occurred during the voice session"),c(!1),i(!1)}),j.on("agent_start_talking",()=>{console.log("Agent started talking"),f(!0)}),j.on("agent_stop_talking",()=>{console.log("Agent stopped talking"),f(!1)}),console.log("start call args: ",{hostUrl:e.livekit_url,accessToken:l,sampleRate:44100}),await j.startCall({hostUrl:e.livekit_url,accessToken:l,sampleRate:44100})}catch(e){console.error("Error starting session:",e),g(e instanceof Error?e.message:"Failed to start voice session"),c(!1)}},endSession=()=>{j&&j.stopCall(),i(!1),f(!1),C(300)};return a||r?r?(0,l.jsx)(z.k,{height:"100vh",width:"100%",alignItems:"center",justifyContent:"center",bgGradient:"linear(to-br, gray.900, gray.800)",children:(0,l.jsxs)(Q.g,{spacing:6,children:[(0,l.jsx)(I.$,{size:"xl",color:"blue.400",thickness:"4px"}),(0,l.jsx)(m.x,{fontSize:"lg",color:"white",children:"Connecting..."})]})}):(0,l.jsx)(z.k,{height:"100vh",width:"100%",alignItems:"center",justifyContent:"center",bgGradient:"linear(to-br, gray.900, gray.800)",position:"relative",children:(0,l.jsx)(h.W,{maxW:"container.md",children:(0,l.jsxs)(Q.g,{spacing:10,children:[(0,l.jsx)(u.xu,{position:"relative",children:n.avatar_url?(0,l.jsx)(u.xu,{w:"200px",h:"200px",borderRadius:"full",overflow:"hidden",border:"4px solid",borderColor:x?"green.400":"whiteAlpha.300",transition:"all 0.3s",boxShadow:x?"0 0 3
10px rgba(72, 187, 120, 0.6)":"none",children:(0,l.jsx)("img",{src:n.avatar_url,alt:n.name,style:{width:"100%",height:"100%",objectFit:"cover"}})}):(0,l.jsx)(u.xu,{w:"200px",h:"200px",borderRadius:"full",bgGradient:"linear(to-br, blue.400, purple.500, pink.400)",border:"4px solid",borderColor:x?"green.400":"whiteAlpha.300",transition:"all 0.3s",boxShadow:x?"0 0 30px rgba(72, 187, 120, 0.6)":"none",position:"relative",overflow:"hidden",_before:{content:'""',position:"absolute",top:"-50%",left:"-50%",width:"200%",height:"200%",background:"radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%)",animation:x?"pulse 2s ease-in-out infinite":"none"},children:(0,l.jsx)(s(),{id:"9bf446790fa8a405",children:"@-webkit-keyframes pulse{0%,100%{-webkit-transform:scale(1);transform:scale(1);opacity:1}50%{-webkit-transform:scale(1.1);transform:scale(1.1);opacity:.8}}@-moz-keyframes pulse{0%,100%{-moz-transform:scale(1);transform:scale(1);opacity:1}50%{-moz-transform:scale(1.1);transform:scale(1.1);opacity:.8}}@-o-keyframes pulse{0%,100%{-o-transform:scale(1);transform:scale(1);opacity:1}50%{-o-transform:scale(1.1);transform:scale(1.1);opacity:.8}}@keyframes pulse{0%,100%{-webkit-transform:scale(1);-moz-transform:scale(1);-o-transform:scale(1);transform:scale(1);opacity:1}50%{-webkit-transform:scale(1.1);-moz-transform:scale(1.1);-o-transform:scale(1.1);transform:scale(1.1);opacity:.8}}"})})}),(0,l.jsxs)(w.K,{spacing:4,textAlign:"center",children:[(0,l.jsx)(m.x,{fontSize:"2xl",fontWeight:"bold",color:"white",children:x?"Speaking...":"Listening..."}),(0,l.jsx)(m.x,{fontSize:"md",color:"whiteAlpha.700",children:x?"The agent is responding":"Speak freely"}),(0,l.jsxs)(m.x,{fontSize:"sm",color:"whiteAlpha.600",mt:2,children:["Time remaining: ","".concat(Math.floor(S/60),":").concat((S%60).toString().padStart(2,"0"))]})]}),(0,l.jsx)(p.z,{size:"lg",colorScheme:"red",leftIcon:(0,l.jsx)(v.J,{as:eU.tNS}),onClick:endSession,_hover:{transform:"scale(1.05)"},transition:"all 0.2s",children:"End Conversation"})]})})}):(0,l.jsx)(z.k,{height:"100vh",width:"100%",alignItems:"center",justifyContent:"center",bgGradient:"linear(to-br, gray.900, gray.800)",position:"relative",children:(0,l.jsx)(h.W,{maxW:"container.md",children:(0,l.jsxs)(Q.g,{spacing:8,children:[n.avatar_url?(0,l.jsx)(u.xu,{w:"150px",h:"150px",borderRadius:"full",overflow:"hidden",border:"4px solid",borderColor:"whiteAlpha.300",children:(0,l.jsx)("img",{src:n.avatar_url,alt:n.name,style:{width:"100%",height:"100%",objectFit:"cover"}})}):(0,l.jsx)(u.xu,{w:"150px",h:"150px",borderRadius:"full",bgGradient:"linear(to-br, blue.400, purple.500, pink.400)",border:"4px solid",borderColor:"whiteAlpha.300",position:"relative",overflow:"hidden",_before:{content:'""',position:"absolute",top:"-50%",left:"-50%",width:"200%",height:"200%",background:"radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%)",animation:x?"pulse 2s ease-in-out infinite":"none"},children:(0,l.jsx)(s(),{id:"cc4b54bb3a220a5f",children:"@-webkit-keyframes pulse{0%,100%{-webkit-transform:scale(1);transform:scale(1);opacity:1}50%{-webkit-transform:scale(1.1);transform:scale(1.1);opacity:.8}}@-moz-keyframes pulse{0%,100%{-moz-transform:scale(1);transform:scale(1);opacity:1}50%{-moz-transform:scale(1.1);transform:scale(1.1);opacity:.8}}@-o-keyframes pulse{0%,100%{-o-transform:scale(1);transform:scale(1);opacity:1}50%{-o-transform:scale(1.1);transform:scale(1.1);opacity:.8}}@keyframes pulse{0%,100%{-webkit-transform:scale(1);-moz-transform:scale(1);-o-transform:scale(1);transform:scale(1);opacity:1}50%{-webkit-transform:scale(1.1);-moz-transform:scale(1.1);-o-transform:scale(1.1);transform:scale(1.1);opacity:.8}}"})}),(0,l.jsxs)(w.K,{spacing:4,textAlign:"center",children:[(0,l.jsx)(m.x,{fontSize:"3xl",fontWeight:"bold",color:"white",children:n.name}),n.description&&(0,l.jsx)(m.x,{fontSize:"lg",color:"whiteAlpha.800",children:n.description})]}),d&&(0,l.jsx)(m.x,{color:"red.400",fontSize:"md",children:d}),(0,l.jsx)(p.z,{size:"lg",colorScheme:"blue",leftIcon:(0,l.jsx)(v.J,{as:eU.I7T}),onClick:startSession,isDisabled:r,_hover:{transform:"scale(1.05)"},transition:"all 0.2s",children:"Start Session"})]})})})}var e0=t(88007);new a.Z("interview");let e1=new eB.m,e2="LOADING_PLACE_HOLDER",e3="// Coding happens here",e5=new a.Z("agent"),e4=new a.Z("agent-action-call"),e8=new a.Z("agent",null,D.ZP.getEnvUrl().substring(0,D.ZP.getEnvUrl().length-4)+":8001/api"),e7=new a.Z("agent_plan");new B.Z("/");
1let e9=new a.Z("form_response"),e6=new a.Z("agent_user"),ne=new a.Z("bounty"),nn=new a.Z("openai"),nt=new a.Z("v1/chat"),nl={overflow:"auto",minHeight:"40px",maxHeight:"250px",paddingTop:"5px",transition:"height 0.2s ease-in-out"},no={"&::-webkit-scrollbar":{width:"8px"},"&::-webkit-scrollbar-thumb":{borderRadius:"4px"},"&::-webkit-scrollbar-track":{}};function ChatPage(e){let n;let{t,i18n:o}=(0,et.$G)(),[a,B]=(0,U.useState)(null),Y=e.slug,$=null===(lf=e.agent)||void 0===lf?void 0:lf.slug.includes("credos-"),Q=$?null===(lj=e.agent)||void 0===lj?void 0:null===(lv=lj.slug)||void 0===lv?void 0:lv.split("credos-")[1]:null,ee=null===(l_=e.agent)||void 0===l_?void 0:l_.bounty,en=e.embed,eo=(0,i.p)(),[ei,er]=(0,U.useState)(null),ec=(0,N.cF)(),ed=D.ZP.getEnvUrl(),{onCopy:eu,value:eh,setValue:eg,hasCopied:ep}=(0,r.V)(""),ex=null===(lb=e.agent)||void 0===lb?void 0:lb.style_json,ef="string"==typeof ex?JSON.parse(ex):ex,ez=(null==ef?void 0:ef.default_style)!="dark",eE=(null==ef?void 0:ef.side_bg_color)?null==ef?void 0:ef.side_bg_color:ez?"black":c.rS.colors.gray[900],eP=(null==ef?void 0:ef.side_text_color)?null==ef?void 0:ef.side_text_color:ez?"white":c.rS.colors.gray[100],eI=(null==ef?void 0:ef.chat_bg_color)?null==ef?void 0:ef.chat_bg_color:ez?"white":c.rS.colors.gray[800],eT=(null==ef?void 0:ef.chat_text_color)?null==ef?void 0:ef.chat_text_color:ez?"black":"white",eM=(null==ef?void 0:ef.side_bg_image_url)?"url(".concat(null==ef?void 0:ef.side_bg_image_url,")"):"null",eF=(null==ef?void 0:ef.chat_bg_image_url)?"url(".concat(null==ef?void 0:ef.chat_bg_image_url,")"):"null",eO=null!==(lT=null==ef?void 0:ef.font_family)&&void 0!==lT?lT:"Inter",eR=(e.agent,!0),eL="string"==typeof(null===(lw=e.agent)||void 0===lw?void 0:lw.custom_data)?JSON.parse(null===(ly=e.agent)||void 0===ly?void 0:ly.custom_data):null!==(lM=null===(lS=e.agent)||void 0===lS?void 0:lS.custom_data)&&void 0!==lM?lM:{},eD=(null===(lC=e.agent)||void 0===lC?void 0:lC.my_user_plan)?null===(lk=e.agent)||void 0===lk?void 0:lk.my_user_plan.message_limit:null===(lz=e.agent)||void 0===lz?void 0:lz.user_thread_message_limit;$&&!e.user&&(eD=25);let eW={},[eN,eq]=(0,U.useState)(""),{isOpen:eZ,onToggle:eH}=(0,d.q)(),[eK,eJ]=(0,U.useState)(null),[eB,ns]=(0,U.useState)([]),[na,ni]=(0,U.useState)(!1),[nr,nc]=(0,U.useState)(!1),[nd,nu]=(0,U.useState)(eD>-1?eD:-1),[nh,ng]=(0,U.useState)(eD),[np,nx]=(0,U.useState)(null!==(lU=e.threadId)&&void 0!==lU?lU:null),[nm,nf]=(0,U.useState)([]),[nv,nj]=(0,U.useState)({}),[n_,nb]=(0,U.useState)(null),[nw,ny]=(0,U.useState)(!1),[nS,nC]=(0,U.useState)(null),[nk,nz]=(0,U.useState)(!1),[nA,nE]=(0,U.useState)(null===(lA=e.agent)||void 0===lA?void 0:lA.my_user_plan),[nP,nI]=(0,U.useState)(e.agent),[nT,nM]=(0,U.useState)([]),[nU,nF]=(0,U.useState)(!1),[nO,nR]=(0,U.useState)(null),[nL,nD]=(0,U.useState)(null),[nW,nN]=(0,U.useState)(!1),[nq,nZ]=(0,U.useState)(!1),[nH,nG]=(0,U.useState)(!1),[nK,nJ]=(0,U.useState)(null),[nV,nB]=(0,U.useState)(!0),[nX,nY]=(0,U.useState)("email"),[n$,nQ]=(0,U.useState)(!1),[n0,n1]=(0,U.useState)(""),[n2,n3]=(0,U.useState)(null!==(lF=null===(lE=e.agent)||void 0===lE?void 0:lE.plans)&&void 0!==lF?lF:[]),[n5,n4]=(0,U.useState)(null!==(lO=null==eL?void 0:eL.form)&&void 0!==lO?lO:[]),[n8,n7]=(0,U.useState)([]),[n9,n6]=(0,U.useState)(null),[te,tn]=(0,U.useState)("text"),[tt,tl]=(0,U.useState)([]),[to,ts]=(0,U.useState)(!1),[ta,ti]=(0,U.useState)(!1),[tr,tc]=(0,U.useState)(!1),[td,tu]=(0,U.useState)(null),[th,tg]=(0,U.useState)(!1),[tp,tx]=(0,U.useState)("raw"),[tm,tf]=(0,U.useState)(!1),[tv,tj]=(0,U.useState)(e3),[t_,tb]=(0,U.useState)(null),[tw,ty]=(0,U.useState)("python"),[tS,tC]=(0,U.useState)(null),[tk,tz]=(0,U.useState)(!1),[tA,tE]=(0,U.useState)(0),tP=(0,U.useRef)(tA),[tI,tT]=(0,U.useState)(!1),[tM,tU]=(0,U.useState)(!1),[tF,tO]=(0,U.useState)(!1),[tR,tL]=(0,U.useState)(!1),[tD,tW]=(0,U.useState)(!1),[tN,tq]=(0,U.useState)({}),[tZ,tH]=(0,U.useState)(null),[tG,tK]=(0,U.useState)([]),[tJ,tV]=(0,U.useState)(null),[tB,tX]=(0,U.useState)(!1),[tY,t$]=(0,U.useState)(!1),[tQ,t0]=(0,U.useState)(!1),t1=e.isLoader,[t2,t3]=(0,U.useState)(0),[t5,t4]=(0,U.useState)(!1),[t8,t7]=(0,U.useState)(0),[t9,t6]=(0,U.useState)(!1),[le,ln]=(0,U.useState)(!t1),[lt,ll]=(0,U.useState)(null),[lo,ls]=(0,U.useState)(null),[la,li]=(0,U.useState)(!1),[lr,lc]=(0,U.useState)(null),ld=new eY.Z(lr,lc),lu=(lm=null,(null===(lp=e.agent)||void 0===lp?void 0:lp.my_user_plan)?lm=null===(lx=e.agent)||void 0===lx?void 0:lx.my_user_plan.plan_object:(null==eL?void 0:eL.default_plan_id)&&
1(lm=n2.find(e=>e.id==eL.default_plan_id)),lm||(lm=n2.find(e=>0==e.price)),lm),lh=(0,U.useRef)(null);(0,U.useEffect)(()=>{let handleResize=()=>{let e=lh.current;e&&(e.style.height="auto",e.style.height="".concat(e.scrollHeight,"px"))},e=lh.current;return e&&e.addEventListener("input",handleResize),()=>{e&&e.removeEventListener("input",handleResize)}},[]),(0,U.useEffect)(()=>{var n,t;if(e.downloading&&nG(!0),D.ZP.setAuth(e.token),console.log("Starting message count",nh),e.agentPlanId){console.log("agent plan id found ",e.agentPlanId);let n=n2.find(n=>n.id==e.agentPlanId);if(n){let e=JSON.parse(n.metadata);if(e&&e.allow_embed){let e=Math.max(n.msg_limit,nh);ng(e)}}else console.log("no agent plan found")}if(tL(!0),(0,W.tM)(nP,"PageView",{},e.user),li(SpeechUtil.isSupported()),getAndLoadThread(),console.log("agent is",e.agent),console.log("is embed",e.embed),console.log("user is",e.user),console.log("is custom domain",(0,W.w)()),"true"===e.pay_success){(0,R.XA)("You have successfully purchased the plan",eo);let n=null==nP?void 0:nP.my_user_plan,t={content_type:"product",content_category:"agent_plan"};(null==n?void 0:n.price)!=null&&(t.value=n.price/100,t.currency=n.currency||"USD"),(0,W.tM)(nP,"Purchase",t,e.user),(0,W.tM)(nP,"CompletePayment",t,e.user),e.token||(nY("code"),nN(!0))}else"false"==e.pay_success&&eo({title:"Sorry, the payment failed. Try again",status:"error"});let onBeforeInstallPrompt=e=>{console.log("BEFORE INSTALL PROMPT TRIGGER"),console.log(e),e.preventDefault(),er(e)};window.addEventListener("beforeinstallprompt",onBeforeInstallPrompt);let onWindowMessage=e=>{"open"===e.data?(console.log("RECIEVED MESSAGE"),ln(!0)):"close"===e.data&&ln(!1)};window.addEventListener("message",onWindowMessage);let l=null!==(n=eL.retell_agent_id)&&void 0!==n?n:eL.voice_agent_id;l&&tn(null!==(t=eL.editor_type)&&void 0!==t?t:"voice");let o=localStorage.getItem("ah_guest_uid");return o||(o=(0,ev.Z)(),localStorage.setItem("ah_guest_uid",o)),nC(o),()=>{window.removeEventListener("beforeinstallprompt",onBeforeInstallPrompt),window.removeEventListener("message",onWindowMessage)}},[]),(0,U.useEffect)(()=>()=>{SpeechUtil.stop()},[]);let setReconnectingLiveVoiceCount=e=>{tP.current=e,tE(e)},emailRequired=n=>{var t,l;return n||(n=getAgentMessageContext()),console.log("agentMessageContextInput",n),console.log("props.agent?.my_user_plan",null===(t=e.agent)||void 0===t?void 0:t.my_user_plan),console.log("customData.email_gate",eL.email_gate),!!eL.email_gate&&(null==n||!n.subscribed)&&(null===(l=e.agent)||void 0===l||!l.my_user_plan)||!!eL.always_show_email};(0,U.useEffect)(()=>{eh&&(eu(),(0,R.XA)("Copied to clipboard",eo))},[eh]);let getAndLoadThread=async()=>{var n,t,l,o,s,a,i,r,c,d;let u=localStorage.getItem("agent_message_data"),h=localStorage.getItem("thread_id_".concat(e.slug));if(h&&(ny(!0),nx(h)),(0,W.ku)().then(e=>{nB(e),console.log("OPEN AI STAUTS",e)}),!u){let e={},n={...localStorage};for(let t of(console.log("Running backfill for all v1 threads"),Object.keys(n)))if(console.log(t),t.startsWith("thread_id_")){console.log("Found thread id");let n=localStorage.getItem(t),l=t.split("_")[2];console.log("agent slug",l),console.log("thread id",n),e[l]={default_thread_id:n,num_messages:0,thread_ids:[n]},console.log(e[l])}localStorage.setItem("agent_message_data",JSON.stringify(e)),u=localStorage.getItem("agent_message_data")}let g=!1,p=!1;if(u){let n=JSON.parse(u);console.log("context json",n);let c=null!==(r=null===(l=n[e.slug])||void 0===l?void 0:null===(t=l.thread_ids)||void 0===t?void 0:t.reverse())&&void 0!==r?r:[];nf([...c.slice(0,10)]);let d=n[e.slug];if(d){let e=d.num_messages;if(nd&&-1!=nd){let n=nd-e;nu(Math.max(n,0))}}else{let t={...n};t[e.slug]={default_thread_id:h,num_messages:0,thread_ids:h?[h]:[]},d=t[e.slug],localStorage.setItem("agent_message_data",JSON.stringify(t))}(d.subscribed||(null===(o=e.agent)||void 0===o?void 0:o.my_user_plan))&&(p=!0),console.log("email required",emailRequired(d)),console.log("already subscribed",p);let x=emailRequired(d)&&!p;eL.always_show_email&&(x=!0),x&&(console.log("email required found in agent message context"),g=!0,tg(!0),(null==eL?void 0:eL.email_gate_type)&&!(0,W.w)()&&tx(null==eL?void 0:eL.email_gate_type)),(null===(i=e.agent)||void 0===i?void 0:null===(a=i.my_user_plan)||void 0===a?void 0:null===(s=a.metadata)||void 0===s?void 0:s.onboarding_required)&&(console.log("onboarding required found in agent user metadata"),g=!0),nJ(d),h||(h=d.default_thread_id)}console.log("needs form input",g);let x=h;console.log("saved thread id",x),nx(x),n5.length>0&&!x&&(g=!0),!g||e.downloading||e.downloaded||ts(!0);let m=null;if(null===(n=e.agent)||void 0===n?void 0:n.my_user_plan)m=null===(d=e.agent)||void 0===d?void 0:null===(c=d.my_user_plan)||void 0===c?void 0:c.plan_obj;else for(let e of n2)0===e.price&&(m=e);m&&m.metadata&&tl(JSON.parse(m.metadata).exclude_skus)};(0,U.useEffect)(()=>{nP.native_rag||e.agent,loadChat(np)},[np]),(0,U.useEffect)(()=>{nm.length>0&&loadThreadObjects()},[nm]);let loadThreadObjects=async()=>{var n;let t=await e5.nonStandard("GET","conversations",null,{thread_ids:nm,agent_id:null===(n=e.agent)||void 0===n?void 0:n.id});if(!t||t.error){console.error("Failed to load thread objects. Please try again",t);return}console.log("thread objects resp",t);let l={};for(let e of null==t?void 0:t.conversations)l[e.thread_id]=e;nj(l)},handleMessageFeedback=async(n,t)=>{var l,o,s,a;let i=await e5.nonStandard("POST","feedback",{type:"message_vote",agent_slug:e.slug,rating:n,message_id:null!==(s=t.ref_id)&&void 0!==s?s:t.id,content:null!==(a=null===(o=t.content)||void 0===o?void 0:null===(l=o.text)||void 0===l?void 0:l.value)&&void 0!==a?a:"",thread_id:np},null);if(!i||i.error){alert("Failed to send feedback. Please try again");return}let r={...tN};r[t.id]=n,(0,R.XA)("Feedback sent",eo),tq(r)},handleSpeakMessage=e=>{var n,t,l;if(!la){alert("Speech synthesis is not supported in this browser");return}let o=null!==(l=null===(t=e.content)||void 0===t?void 0:null===(n=t.text)||void 0===n?void 0:n.value)&&void 0!==l?l:"",s=e.id;if(lo===s){SpeechUtil.stop(),ls(null);return}SpeechUtil.stop(),ls(s),SpeechUtil.speak(o,{onStart:()=>{},onEnd:()=>{ls(null)},onError:e=>{console.error("Speech synthesis error:",e),ls(null),eo({title:"Failed to play message audio",status:"error"})}})},finishInterview=async()=>{},getAgentMessageContext=()=>{let n=localStorage.getItem("agent_message_data");if(n){let t=JSON.parse(n);
1return t[e.slug]}return null},confirmBountyWin=async()=>{let e=await ne.getById(Q);if(!e||e.error){alert("Failed to get prize. Please try again");return}{let n=e.metadata.winning_thread_id==np;n?t0(!0):alert("Sorry, it looks like you didn't win the prize.")}};(0,U.useEffect)(()=>{tk&&(console.log("END CONVERSATION TRIGGERED"),e1.stopCall())},[tk]),(0,U.useEffect)(()=>{if(console.log("change in reconnecting live voice count"),tA>0&&!tk){if(tA>20){console.log("Failed to reconnect after 5 attempts. Stopping");return}console.log("Attempting to reconnect in 1 second"),setTimeout(()=>{console.log("Starting reconnection"),console.log("connecting to callId",n9),handleCallPress(!1)},3e3)}else console.log("Reconnection count is 0"),setReconnectingLiveVoiceCount(0),tz(!1)},[tA]);let handleCallPress=async function(){let n=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(n9&&n){console.log("Stopping call conversation...."),finishInterview();return}n9&&!n&&tA>0&&console.log("Reconnecting live voice call");let t=null;{var l;let n=await e5.nonStandard("POST","".concat(null===(l=e.agent)||void 0===l?void 0:l.id,"/live"),{thread_id:np},null);if(console.log("call resp is",n),!n||n.error){alert("Failed to start call. Please try again");return}n.call_id,tC(t=n.access_token)}e1.removeAllListeners(),e1.on("call_started",()=>{console.log("Conversation started")}),e1.on("call_ended",()=>{console.log("conversation ended -- attempting reconnect"),setReconnectingLiveVoiceCount(tP.current+1)}),e1.on("error",e=>{console.error("An error occurred:",e),console.log("Attempting to reconnect in 1 second"),setReconnectingLiveVoiceCount(tP.current+1)}),e1.on("update",e=>{console.log("update",e);let n=e.transcript[e.transcript.length-1];n&&(console.log("Transcript",n),"agent"==n.role&&(console.log("agent is talking"),console.log("content",n.content),n.content.includes("COMMAND=END")&&(console.log("END DETECTED"),finishInterview())))}),e1.on("disconnect",()=>{console.log("disconnect")}),e1.on("reconnect",()=>{console.log("reconnect")}),e1.on("audio",e=>{}),e1.on("agentStartTalking",()=>{console.log("Agent is talking"),tW(!0)}),e1.on("agentStopTalking",()=>{console.log("Agent stopped talking"),tW(!1)}),await e1.startCall({accessToken:t,sampleRate:44100})},clearThread=async()=>{let n={...getAgentMessageContext()};n.default_thread_id=null,nJ(n);let t=JSON.parse(localStorage.getItem("agent_message_data"));t[e.slug]=n,localStorage.setItem("agent_message_data",JSON.stringify(t)),localStorage.getItem("thread_id_".concat(e.slug))&&localStorage.removeItem("thread_id_".concat(e.slug)),window.location.reload()},scrollToLatestMessageV2=()=>{var e=document.getElementById("end_box");if(e){var n=e.offsetTop;document.getElementById("scrolling_div").scrollTop=n}};(0,U.useEffect)(()=>{(eB.length>0||ea.tq)&&scrollToLatestMessageV2(),0===eB.length?tm||tf(!0):tm&&tf(!1)},[eB]);let loadChat=async n=>{console.log("threadId is",n);let l=await e5.nonStandard("GET","".concat(e.slug,"/load_chat"),null,{thread_id:n});if(l&&!l.error){console.log("messagesResp",l),l.public_id&&nb(l.public_id);let e=l.messages.map(e=>(console.log(e),{content:{text:{value:e.content}},role:e.role,file_data:e.file_data,id:e.id,citations:e.citations}));e.length>0&&ns(e),updateMessageCount(e.filter(e=>"user"==e.role))}else{let e=(0,R.HH)(l.error,t("chat.fail_message")),n=[...eB,{content:{text:{value:e}},role:"assistant"}];ns(n)}},getAndLoadResponse=async function(n){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return new Promise((o,s)=>{let a=[],i="agent/streaming/".concat(n,"/");eR&&(i="v1/chat",e.agentData&&a.push("agent_data="+e.agentData),a.push("thread_id="+n),e.builderThreadId&&a.push("builder_thread_id="+e.builderThreadId),a.push("stream=true"));let r="".concat(D.ZP.getEnvUrl(),"/").concat(i);a.push("agent_id="+nP.id),l&&a.push("run_id="+l),td&&a.push("model="+td),a.length>0&&(r+="?"+a.join("&")),nc(!0);let c=new EventSource(r);var d="";let u={content:{text:{value:e2}},role:"assistant"};var h=[];t?(console.log("existing messages picked up!",t),h=[...t,u]):(console.log("existing messages not picked up!",t),h=[...eB,u]);var g=[];console.log("updated messages",h),ns(h),c.onmessage=e=>{var n,t,l;let s=JSON.parse(e.data);if(s.file_ids&&(g=s.file_ids),s.choices&&tK(s.choices),s.tool_call&&(console.log("tool call is",s.tool_call),nR(s.tool_call[0])),s.status&&(console.log("agent status is",s.status),ll(s.status)),console.log("jsonData is",s),s.request){s.body=s.request,console.log("Approval request detected:",s.request);try{let e="string"==typeof s.body?JSON.parse(s.body):s.body;tV(e),tX(!0)}catch(e){console.error("Error parsing approval request:",e)}}d+=null!==(l=null===(n=s.text)||void 0===n?void 0:n.split("/END/")[0])&&void 0!==l?l:"";let a=[...h],i=a[a.length-1];if(i.content.text.value=d,s.citations&&(console.log("citations are",s.citations),i.citations=s.citations),ns([...a]),null===(t=s.text)||void 0===t?void 0:t.includes("/END/")){let e=d.split("COMMAND="),n=e.length>1?e[1]:null;if(n){"USER_WIN"===n&&(console.log("User has apparent prize win"),confirmBountyWin()),d=d.split("COMMAND=")[0];let e=[...h];e[e.length-1].content.text.value=d,ns([...e]),d.includes("This agent has reached its message limit")&&isUserAgentCreator()&&nz(!0)}g&&(i.file_ids=g,ns([...a])),nc(!1),ni(!1),c.close(),o(!0)}},c.onerror=e=>{if(console.log(e),c.close(),!d){let e=[...h];e[e.length-1].content.text.value="Sorry something went wrong. Please try again",ns([...e])}-1!=nd&&nu(nd+1),ni(!1),nc(!1),s(Error("Stream error"))}})},saveAgentContext=n=>{console.log("Current context",n);let t=JSON.parse(localStorage.getItem("agent_message_data"));nJ(n),t[e.slug]=n,console.log("Updated message data",t),localStorage.setItem("agent_message_data",JSON.stringify(t))},syncAgentMessageContext=(e,n)=>{var t;console.log("UPDATING AGENT MESSAGE CONTEXT");let l={...getAgentMessageContext()};console.log("Current context",l),l.num_messages+=n,l.default_thread_id=e,(null===(t=l.thread_ids)||void 0===t?void 0:t.includes(e))||l.thread_ids.push(e),console.log("Updated context"),saveAgentContext(l)},sendMessage=async n=>{let l=nT.length>0?e8:e5,o=await l.postNonStandardNonJson("".concat(e.slug,"/ingest"),n,"multipart/form-data");if(console.log("send message with rag resp",o),o&&!o.error){console.log("Message sent");var s=np;
1!np&&o.thread_id&&(s=o.thread_id,nx(o.thread_id),nb(o.public_id));let e={content:{text:{value:o.message}},role:"user",file_data:o.file_data},n=[...eB,e];return await getAndLoadResponse(s,n),o}{let e=(0,R.HH)(o.error,t("chat.fail_message")),n=[...eB,{content:{text:{value:e}},role:"assistant"}];return ns(n),o}},updateMessageCount=e=>{if(-1!==nd){let n=nh>-1?nd-e.length:-1;n<=0?nu(0):nd>n&&nu(n)}},syncThreadMessages=async function(n){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;console.log("syncing messages");let o=0,s={thread_id:n};l&&(s.run_id=l);for(var a,i=!1;!i&&o<500;){let l=await e5.nonStandard("GET","".concat(e.slug,"/messages"),null,s);if(console.log(l),l&&!l.error){if(l.messages){let e=[];for(let n of l.messages)console.log(n.content.type),"image_file"==n.content.type&&(console.log("image file found!"),n.file_ids=[n.content.image_file.file_id]),e.push(n);eW[n]=e,eJ(l),updateMessageCount(l.messages.filter(e=>"user"==e.role)),nR(null),ll(null),ns(e)}i=!0}else{let e=(0,R.HH)(l.error,t("chat.fail_message"));if((null===(a=l.error)||void 0===a?void 0:a.statusCode)===500){let n={content:{text:{value:e}},role:"assistant"},t=[...eB,n];ns(t),i=!0}if(e.includes("Run not completed"))await new Promise(e=>setTimeout(e,800)),i=!1;else if(e.includes("require_action")){let n=e.split("?");if(n.length>0){let e=new URLSearchParams(n[1]),t=e.get("run_id"),l=e.get("name");console.log("new runId ".concat(t," and function name ").concat(l)),nR(l)}i=!1}else{let n={content:{text:{value:e}},role:"assistant"},t=[...eB,n];ns(t),i=!0}}o+=1}if(o>=500){let e=t("chat.fail_message"),n=[...eB,{content:{text:{value:e}},role:"assistant"}];ns(n)}console.log("Finished")},postMessageSent=()=>{let e=t2+1;t3(e),e%5!=0||t9||(t4(!0),t6(!0)),lh.current&&(lh.current.style.height="auto",lh.current.style.height=lh.current.scrollHeight+"px")},handleSendLoginCode=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,l={conversation_id:np,agent_id:nP.id};e&&(l.email=e),n&&(l.code=n);let o=await nn.nonStandard("POST","log_in",l);if(o&&!o.error)return n||(0,R.XA)(t("chat.login_success"),eo),o;{let e=(0,R.HH)(o.error,t("chat.fail_message"));alert(e)}},handleVerifyCode=async e=>{let n=await handleSendLoginCode(null,e);if(n&&!n.error)nN(!1),await D.ZP.saveUserToken(n.token),D.ZP.setAuth(n.token),tZ&&(await createAgentUser(tZ),tH(null)),(0,R.XA)("You've logged in..reloading",eo),window.location.reload();else{let e=(0,R.HH)(n.error,t("chat.fail_message"));alert(e)}},downloadFile=async n=>{"temp_file_id"!=n&&window.open("".concat(D.ZP.getEnvUrl(),"/agent/download_file?file_id=").concat(n,"&agent_slug=").concat(e.slug))},onMessageSend=async function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(!na){if(tf(!1),tK(null),t5&&(t4(!1),t3(0)),ny(!0),nw||0!==eB.length||(0,W.tM)(nP,"Lead",{},e.user),0==nd){n2.length>0&&(tU(!0),(0,W.tM)(nP,"ViewContent",{content_type:"product",content_category:"agent_plan"},e.user),(0,e0.T)().track("upgrade_modal_shown",{agent_id:nP.id,agent_slug:nP.slug,message_limit:nh,plan_count:n2.length}));let n=[...eB,{content:{text:{value:"Unfortunately, I can no longer recieve more messages."}},role:"assistant"}];ns(n)}else{let l=null!=n?n:eN;tv!=e3&&""!=tv&&tv!=t_&&(l+="\n\n"+"```".concat(tw," ").concat(tv,"\n```"),tb(tv)),eq(""),ni(!0);let o={content:{text:{value:l}},role:"user"},s=[...eB,o,{content:{text:{value:e2}},role:"assistant"}];ns(s),console.log("new messages",s),console.log("entered text",l);let a=new FormData;for(let e of(a.append("message",l),a.append("is_streaming","true"),nT))if((0,W.CO)(e)){let n=await (0,W.Xs)(e,null,ec,"/agent/chat/".concat(nP.id,"/")),t={file_name:n.name,...n};if(nP.native_rag)a.append("file_datas",JSON.stringify(t));else{let e=l;e+="\n The image is available [here](".concat(n.url,")"),a.append("message",e),a.append("image_url",n.url)}}else a.append(e.name,e);np&&a.append("thread_id",np);let i=null;nP.native_rag?i=await sendMessage(a):eR?(console.log("message form body",a),e.agentData?a.append("agent_data",e.agentData):a.append("agent_id",null==nP?void 0:nP.id),i=await nt.postNonStandardNonJson(null,a)):i=await e5.postNonStandardNonJson("".concat(e.slug,"/message"),a,"multipart/form-data");let r=null;if(console.log("message resp",i),i&&!i.error){if(console.log("Current threadId, ",np),console.log("New thread_id is ",r=i.thread_id),r!=np&&nf([r,...nm]),nb(i.public_id),nM([]),!nP.native_rag){let e={content:{text:{value:l}},role:"user"};nT.length>0&&(e.file_ids=["temp_file_id"]);let n=[...eB,e];await getAndLoadResponse(r,n,i.run_id)}nx(r);
1try{syncAgentMessageContext(i.thread_id,1)}catch(e){J.Tb(e),console.error(e)}postMessageSent()}else{let e=ld.handleError(null==i?void 0:i.error,t("chat.fail_message")),n=[...eB,{content:{text:{value:e}},role:"assistant"}];ns(n),ni(!1)}}null!=nd&&nd>0&&nu(Math.max(nd-1,0)),console.log("Message count is ",nd)}},onSignUpClick=async function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,l=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(!nL)return alert("Please enter your email"),!1;if(!nL.includes("@"))return alert("Please enter a valid email"),!1;let o=await nn.nonStandard("POST","subscribe",{email:nL,agent_slug:e.slug},null);if(o&&!o.error)return onFinishSignUp(),l&&(0,R.XA)("You have successfully subscribed",eo),nD(""),!0;{let e=(0,R.HH)(o.error,t("chat.fail_message"));return(console.log("errorMsg is ",e),n)?n(e):(alert(e),!1)}},renderMessage=(e,n)=>{var o,s,a;let i=null!==(a=null===(s=e.content)||void 0===s?void 0:null===(o=s.text)||void 0===o?void 0:o.value)&&void 0!==a?a:"",r="user"===e.role,c=i===e2,d=nr&&n===eB.length-1&&!r;return(0,l.jsx)(u.xu,{px:[3,5],py:[1.5,2],w:"100%",children:(0,l.jsx)(h.W,{maxW:"760px",children:r?(0,l.jsx)(u.xu,{display:"flex",justifyContent:"flex-end",children:(0,l.jsxs)(u.xu,{maxW:["85%","68%"],bg:eT,color:eI,px:4,py:3,borderRadius:"2xl",borderBottomRightRadius:"md",fontSize:"sm",lineHeight:1.7,children:[(0,l.jsx)(eC.Z,{isEmbed:en,children:i}),e.file_data&&e.file_data.length>0&&(0,l.jsx)(g.U,{mt:2,spacing:2,flexWrap:"wrap",children:e.file_data.map(e=>(0,l.jsx)(p.z,{size:"xs",children:e.file_name},e.doc_id))})]})}):(0,l.jsxs)(g.U,{spacing:3,alignItems:"flex-start",children:[(0,l.jsx)(x.q,{size:"sm",name:nP.name,src:nP.avatar_url,borderRadius:"lg",flexShrink:0,mt:.5}),(0,l.jsxs)(u.xu,{flex:1,minW:0,children:[(0,l.jsx)(m.x,{fontSize:"xs",fontWeight:700,color:eT,opacity:.45,mb:1,letterSpacing:"0.02em",textTransform:"uppercase",children:nP.name}),c?(0,l.jsxs)(g.U,{spacing:2,py:1,children:[(0,l.jsx)(M.Z,{size:6,color:eT}),(0,l.jsx)(m.x,{fontSize:"xs",color:eT,opacity:.45,animation:na?"chatPulse 1.5s infinite":void 0,sx:{"@keyframes chatPulse":{"0%":{opacity:.45},"50%":{opacity:.2},"100%":{opacity:.45}}},children:nO?"Running ".concat(nO,"..."):lt?"".concat(lt,"..."):"Thinking..."})]}):d?(0,l.jsx)(m.x,{whiteSpace:"pre-wrap",children:i}):(0,l.jsx)(eC.Z,{isEmbed:en,children:i}),e.file_data&&e.file_data.length>0&&(0,l.jsx)(g.U,{mt:2,spacing:2,flexWrap:"wrap",children:e.file_data.map(e=>(0,l.jsx)(p.z,{size:"sm",children:e.file_name},e.doc_id))}),e.file_ids&&e.file_ids.length>0&&(0,l.jsx)(g.U,{mt:2,spacing:2,children:e.file_ids.map(e=>(0,l.jsxs)(u.xu,{children:[(0,l.jsx)(m.x,{fontWeight:"bold",fontSize:"sm",children:t("chat.file_attached")}),(0,l.jsx)(p.z,{mt:2,size:"sm",onClick:()=>downloadFile(e),children:t("chat.download")})]},e))}),e.citations&&(0,l.jsx)(ek.Z,{citations:e.citations}),!c&&(0,l.jsxs)(g.U,{mt:2,spacing:.5,opacity:.3,_hover:{opacity:.8},transition:"opacity 0.15s",children:[(0,l.jsx)(f.h,{size:"xs",variant:"ghost",color:eT,onClick:()=>eg(e.content.text.value),icon:(0,l.jsx)(v.J,{as:eU.Dup,boxSize:3}),"aria-label":"Copy"}),la&&(0,l.jsx)(f.h,{size:"xs",variant:"ghost",color:lo===e.id?"orange.400":eT,onClick:()=>handleSpeakMessage(e),icon:(0,l.jsx)(v.J,{as:lo===e.id?L.LIZ:L.l3f,boxSize:3}),"aria-label":lo===e.id?"Stop speaking":"Read aloud"}),(0,l.jsx)(f.h,{size:"xs",variant:"ghost",color:eT,onClick:()=>handleMessageFeedback(1,e),icon:(0,l.jsx)(v.J,{fill:tN[e.id]>0?eT:"none",as:L.fmn,boxSize:3}),"aria-label":"thumbs_up"}),(0,l.jsx)(f.h,{size:"xs",variant:"ghost",color:eT,onClick:()=>handleMessageFeedback(-1,e),icon:(0,l.jsx)(v.J,{fill:tN[e.id]<0?eT:"none",as:L.oLd,boxSize:3}),"aria-label":"thumbs_down"})]})]})]})})})},getPriceStr=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return e.pretty_price?n+" "+(0,H.l_)("currency",e.currency,"symbol")+e.pretty_price:""},createAgentUser=async e=>{let n=await nn.nonStandard("POST","subscribe",{agent_plan_id:e.id,agent_slug:nP.slug});if(n&&!n.error)nE(n),(0,R.XA)("You have successfully changed your plan",eo);else{let e=(0,R.HH)(n.error,t("chat.fail_message"));alert(e)}return n},getPlanClicklink=e=>{if(!e.price_id)return"";var n="agenthost";return en&&(n="openai"),(0,e0.T)().track("upgrade_plan_clicked",{agent_id:nP.id,agent_slug:nP.slug,plan_id:e.id,plan_name:e.name,plan_price:e.price,is_paid:!0}),"".concat(D.ZP.getWebUrl(),"/checkout?agent_plan_id=").concat(e.id,"&context=").concat(n,"&convo_id=").concat(np,"&guest_uuid=").concat(nS,"&agent_id=").concat(nP.id)},getPlanOnClick=async n=>{if(n.price_id&&0!==n.price)return null;console.log("Free plan clicked..."),(0,e0.T)().track("upgrade_plan_clicked",{agent_id:nP.id,agent_slug:nP.slug,plan_id:n.id,plan_name:n.name,plan_price:n.price,is_paid:!1}),e.user?(await createAgentUser(n),window.location.reload()):(nN(!0),nY("email"),tH(n))},getLLMSelect=()=>{var e;if(null==nP?void 0:null===(e=nP.json_data)||void 0===e?void 0:e.is_tool)return(0,l.jsxs)(j.P,{width:"auto",size:"sm",variant:"filled",onChange:e=>{console.log("Selected LLM:",e.target.value),tu(e.target.value)},children:[(0,l.jsx)("option",{value:"gpt-4o-mini",children:"GPT 4o-mini"}),(0,l.jsx)("option",{value:"ollama/llama3",children:"Llama 3"}),(0,l.jsx)("option",{value:"claude-3-haiku-20240307",children:"Claude 3.5 Sonnet"}),(0,l.jsx)("option",{value:"gpt-4o",children:"GPT-4o"})]},"llm-select")},handleFileOnChange=e=>{let n=Array.from(e);if(tt.includes("user_file_uploads")){alert(t("chat.sku_fail"));return}let l=(0,W.MV)(nP.skus,"custom"),o=l?8:2;if(n.length+nT.length>
1o){alert("You can only attach up to ".concat(o," files."));return}nM([...nT,...n])},trackEvent=async(e,n)=>{await e5.nonStandard("POST","".concat(nP.id,"/track"),{event_name:e,event_data:n},null)},getAcceptedUploadFiles=()=>{console.log("agent skus are ",nP.skus);let n=(0,W.sV)(nP.native_rag);return(console.log("default files",n),(0,W.MV)(nP.skus,"vision")&&(null==eL?void 0:eL.use_vision)||e.agentData)?n+",.png,.jpg,.jpeg,.gif":n},handleAgentLinkClick=e=>{"website"==e.type||onMessageSend(e.value)},handleLoginClick=async()=>{e.user?(await (0,W.ni)(!1),window.location.reload()):nN(!0)},isCurrentPlan=e=>(null==e?void 0:e.id)==(null==lu?void 0:lu.id),findPlansByPromotion=async()=>{let e=await e7.query({agent:nP.id,code:n0});if(e&&!e.error){console.log("agent plans find resp",e);let n=[...n2,...e.results];console.log(" existing plans",n),n3(n),nQ(!1)}else{let n=(0,R.HH)(e.error,t("chat.fail_message"));alert(n)}},onFinishSignUp=()=>{let e={...getAgentMessageContext()};e.subscribed||(e.subscribed=!0,saveAgentContext(e))},removeFile=e=>{let n=[...nT];n.splice(e,1),nM(n)},handleEmailGating=async()=>await onSignUpClick(e=>{if(e.includes("You are already subscribed"))return onFinishSignUp(),!0},!1),handleDownloadClick=()=>{trackEvent("download",{agent_id:nP.id}),ei?(ei.prompt(),ei.userChoice.then(e=>{"accepted"===e.outcome?console.log("User accepted the install prompt"):console.log("User dismissed the install prompt")})):(0,W.w)()?window.location.href="https://".concat(D.ZP.testOrProd("stage","www"),".agenthost.ai/chat/").concat(e.slug,"?downloading=true"):nG(!0)},showAgenthostAd=()=>{var e;return null!=eL&&!!eL.show_agenthost_ad||null==nP||null===(e=nP.skus)||void 0===e||!e.includes("hide_ag_promo")},isUserAgentCreator=()=>{var n,t,l;return(null===(t=e.user)||void 0===t?void 0:null===(n=t.creator)||void 0===n?void 0:n.id)==(null==nP?void 0:null===(l=nP.creator)||void 0===l?void 0:l.id)},handleFormSubmit=async()=>{ti(!0);let e=null;if(emailRequired(null)&&(console.log("email is required"),console.log("entered email is",nL),!(e=await handleEmailGating()))){ti(!1);return}if(n5){console.log("form answers are",n8);let s=[];for(var n=0;n<n5.length;n++)s[n]={question:n5[n],answer:n8[n]};nL&&s.unshift({question:{question:"Email"},answer:nL}),console.log("answer json",s);let a=JSON.stringify(s),i={agent:nP.id,agent_slug:nP.slug,response:a};e&&(console.log("resp email is",nL),i.email=nL),console.log("form body is",i);let r=await e9.create(i);if(r&&!r.error){if(console.log("form response is",r),eL.send_form_to_agent){var l="";for(var o of s)"Email"!=o.question.question&&(l+="".concat(o.question.question,": ").concat(o.answer,"\n"));onMessageSend(l)}(0,R.XA)(t("chat.submitted"),eo),ts(!1),onFinishSignUp()}else{let e=(0,R.HH)(r.error,t("chat.fail_message"));alert(e)}}else(0,R.XA)(t("chat.submitted"),eo),ts(!1);ti(!1)},getLegalLinks=()=>{var n,t,l,o,s,a,i,r;let c=null!==(i=null===(l=e.agent)||void 0===l?void 0:null===(t=l.creator)||void 0===t?void 0:null===(n=t.metadata)||void 0===n?void 0:n.privacy_policy_link)&&void 0!==i?i:"https://www.agenthost.ai/privacy",d=null!==(r=null===(a=e.agent)||void 0===a?void 0:null===(s=a.creator)||void 0===s?void 0:null===(o=s.metadata)||void 0===o?void 0:o.terms_of_service_link)&&void 0!==r?r:"https://www.agenthost.ai/terms";return{privacyPolicyLink:c,termsOfServiceLink:d}},isVoiceChat=()=>{var e,n;return(null==nP?void 0:null===(e=nP.metadata)||void 0===e?void 0:e.is_voice)||(null==nP?void 0:null===(n=nP.json_data)||void 0===n?void 0:n.is_voice)},stopAgentResponse=async()=>{let e=await e5.nonStandard("POST","stop",{thread_id:np,agent_id:null==nP?void 0:nP.id},null);if(console.log("stop response",e),e&&!e.error)(0,R.XA)("Agent response stopped",eo);else{let n=(0,R.HH)(e.error,t("chat.fail_message"));alert(n)}},handleApprovalResponse=async e=>{console.log("Approval response:",e?"approved":"rejected"),t$(!0);try{let n=null==tJ?void 0:tJ.id;if(!n)throw Error("No approval request ID found");let l=e?"approve":"reject",o=await e4.nonStandard("POST","".concat(n,"/").concat(l),{});if(console.log("approval response",o),o&&!o.error)(0,R.XA)(e?"Request approved":"Request rejected",eo),tX(!1),tV(null);else{let e=(0,R.HH)(o.error,t("chat.fail_message"));alert(e)}}catch(e){console.error("Error handling approval:",e),alert("Error handling approval request. Please try again.")}finally{t$(!1)}},changeLang=e=>{let n=e.target.value;(0,e_.D)(n)},saveAgentRating=async e=>{t7(e);let n=await e5.nonStandard("POST","feedback",{type:"agent_rating",rating:e,thread_id:np},null);if(n&&!n.error)(0,R.XA)("Rating saved",eo),t3(0);else{let e=(0,R.HH)(n.error,t("chat.fail_message"));alert(e)}},lg=(0,U.useCallback)(es()(e=>{console.log("calling debounce with val",e),a&&a.send(JSON.stringify({interaction_type:"add_context",context:e}))},1e3),[a]);(0,U.useEffect)(()=>()=>{lg.cancel()},[lg]);let onUserCodeInput=e=>{tj(e),lg(e)}
1,getAgentDetailView=()=>{var n,o;if(t1)return(0,l.jsx)(w.K,{children:(0,l.jsx)(g.U,{justifyContent:"space-between",children:(0,l.jsxs)(g.U,{children:[(0,l.jsx)(x.q,{rounded:"sm",size:["sm","md"],name:nP.name,src:nP.avatar_url}),(0,l.jsx)(m.x,{fontSize:"lg",children:nP.name})]})})});let s=(0,l.jsxs)(w.K,{h:"100%",children:[(0,l.jsxs)(w.K,{children:[isUserAgentCreator()&&!$&&!e.isWorkspace&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(m.x,{mb:1,children:"Admin settings"}),(0,l.jsx)(g.U,{children:(0,l.jsx)(_.r,{href:"https://".concat(D.ZP.testOrProd("stage","www"),".agenthost.ai/project/").concat(null==nP?void 0:nP.id),children:(0,l.jsx)(p.z,{colorScheme:"orange",children:"Manage Agent"})})})]}),(0,l.jsxs)(g.U,{justifyContent:"space-between",children:[n2.length>0&&(0,l.jsx)(m.x,{fontSize:"lg",color:"gray.300",children:t("chat.plans")}),(null==nP?void 0:nP.plan_count)>0&&(0,l.jsx)(p.z,{bgColor:eE,size:"sm",onClick:()=>nQ(!0),children:t("chat.code")})]}),n2.map(e=>(0,l.jsx)(w.K,{mt:1,mb:1,children:(0,l.jsxs)(g.U,{justifyContent:"space-between",flexWrap:"wrap",children:[(0,l.jsxs)(w.K,{spacing:0,maxW:"65%",children:[(0,l.jsx)(g.U,{children:e.is_bundle&&(0,l.jsx)(p.z,{mb:1,size:"xs",bgColor:null,colorScheme:"purple",children:"Bundle"})}),(0,l.jsxs)(m.x,{fontSize:"md",fontWeight:"semibold",children:[e.name," ",getPriceStr(e,"-")," "]}),(0,l.jsx)(G.Z,{fontSize:"sm",text:e.description,limit:100}),e.sold_out&&(0,l.jsx)(p.z,{size:"xs",colorScheme:"purple",mt:2,children:"Sold out"}),!e.sold_out&&e.total_quantity&&(0,l.jsx)(p.z,{mt:2,size:"xs",colorScheme:"purple",bgColor:null,children:"Limited numbers"})]}),isCurrentPlan(e)&&(0,l.jsx)(p.z,{bgColor:eE,mt:1,size:"sm",onClick:()=>tT(!0),children:t("chat.manage_plan")}),!isCurrentPlan(e)&&(0,l.jsx)(l.Fragment,{children:getPlanClicklink(e)?(0,l.jsx)(_.r,{href:getPlanClicklink(e),target:"_blank",children:(0,l.jsx)(p.z,{mt:1,bgColor:eE,size:"sm",children:t("chat.get_started")})}):(0,l.jsx)(p.z,{mt:1,bgColor:eE,size:"sm",onClick:()=>getPlanOnClick(e),children:t("chat.get_started")})})]})},e.id))]}),(null==nP?void 0:nP.allow_email_signup)&&(0,l.jsx)(w.K,{mt:10,children:(0,l.jsxs)(y.NI,{children:[(0,l.jsxs)(S.B,{size:"md",children:[(0,l.jsx)(C.I,{placeholder:"Your email....",value:nL,onChange:e=>nD(e.target.value)}),(0,l.jsx)(k.x,{width:"4.5rem",children:(0,l.jsx)(p.z,{bgColor:eE,h:"1.75rem",size:"sm",onClick:()=>onSignUpClick(),children:t("chat.join")})})]}),(0,l.jsx)(y.Q6,{children:null!==(o=eL.email_signup_copy)&&void 0!==o?o:t("chat.sign_up")})]})}),!isVoiceChat()&&(0,l.jsxs)(w.K,{mt:10,children:[(0,l.jsxs)(g.U,{justifyContent:"space-between",flexWrap:"wrap",children:[(0,l.jsx)(m.x,{fontSize:"lg",color:"gray.300",children:"Conversations"}),(0,l.jsx)(p.z,{size:"xs",variant:"outline",onClick:()=>clearThread(),leftIcon:(0,l.jsx)(eb.d,{}),children:"Add"})]}),nm.map(e=>{var n,t,o,s;return(0,l.jsxs)(w.K,{cursor:"pointer",py:1,paddingLeft:1,fontWeight:e===np?"extrabold":"normal",onClick:()=>nx(e),children:[(0,l.jsx)(m.x,{children:null!==(s=(0,W.RH)(null===(n=nv[e])||void 0===n?void 0:n.initial_message,30))&&void 0!==s?s:"..."}),(null===(t=nv[e])||void 0===t?void 0:t.created_at)&&(0,l.jsx)(m.x,{fontSize:"xs",mt:-2,children:em()(null===(o=nv[e])||void 0===o?void 0:o.created_at).format("lll")})]},e)}),0==nm.length&&(0,l.jsx)(m.x,{children:"No conversations yet."})]}),!e.anonMode&&(0,l.jsx)(u.xu,{position:["static",null,null,"fixed"],bottom:0,left:0,width:["100%",null,null,isVoiceChat()?"16%":"20%"],bgColor:eE,borderTop:"1px solid",borderColor:"whiteAlpha.200",pt:2,zIndex:2,children:(0,l.jsxs)(u.xu,{padding:4,children:[(0,l.jsxs)(w.K,{direction:["column","row"],justifyContent:"space-between",children:[(0,l.jsx)(m.x,{fontWeight:"bold",children:e.user?"".concat(t("chat.logged_in_as")," ").concat(e.user.email.substring(0,10),"..."):t("chat.already_have_acc")}),(0,l.jsx)(p.z,{size:"sm",bgColor:eE,onClick:handleLoginClick,children:e.user?t("chat.logout"):t("chat.login")})]}),(0,l.jsx)(z.k,{children:(0,l.jsx)(u.xu,{p:2,children:(0,l.jsxs)(j.P,{onChange:changeLang,size:"xs",rounded:"full",children:[(0,l.jsx)("option",{value:"en",children:"English (EN)"}),(0,l.jsx)("option",{value:"es",children:"Spanish (ES)"}),(0,l.jsx)("option",{value:"de",children:"German (DE)"}),(0,l.jsx)("option",{value:"pt",children:"Portugese (PT)"}),(0,l.jsx)("option",{value:"ja",children:"Japanese (JA)"}),(0,l.jsx)("option",{value:"it",children:"Italian (IT)"}),(0,l.jsx)("option",{value:"zh",children:"Chineese (ZH)"})]})})}),e.agent.support_email&&(0,l.jsx)(_.r,{href:"mailto:".concat(e.agent.support_email,"?subject=RE: ").concat(null===(n=e.agent)||void 0===n?void 0:n.name," ").concat(t("chat.agent")),children:t("chat.contact_creator")}),(0,l.jsxs)(g.U,{children:[(0,l.jsx)(_.r,{href:getLegalLinks().termsOfServiceLink,target:"_parent",children:(0,l.jsx)(m.x,{fontSize:"xs",children:t("chat.terms")})}),(0,l.jsx)(_.r,{href:getLegalLinks().privacyPolicyLink,target:"_parent",children:(0,l.jsx)(m.x,{fontSize:"xs",children:t("chat.privacy_policy")})})]})]})}),!e.anonMode&&(0,l.jsx)(u.xu,{display:["none","block"],minH:"100px"})]});return(0,l.jsxs)(w.K,{spacing:["4","8"],flex:"1",overflow:"auto",pt:["4","8"],children:[(0,l.jsxs)(w.K,{spacing:"3",children:[nP.avatar_url&&(0,l.jsx)(A.E,{src:nP.avatar_url,rounded:"lg",boxSize:"80px",objectFit:"cover"}),(0,l.jsx)(E.X,{size:["md","lg"],children:nP.name}),ee&&(0,l.jsxs)(g.U,{children:[(null==ee?void 0:ee.claimed_at)&&(0,l.jsx)(P.C,{bgColor:"red",rounded:"lg",children:"Prize claimed"}),(0,l.jsxs)(P.C,{bgColor:"orange",rounded:"lg",children:["$",null==ee?void 0:ee.amount," prize"]})]}),!ee&&(0,l.jsx)(G.Z,{fontSize:["sm","md"],text:nP.description,limit:140}),ee&&(0,l.jsxs)(w.K,{children:[(0,l.jsx)(G.Z,{fontSize:["sm","md"],text:ee.title,limit:140}),(0,l.jsx)(m.x,{fontWeight:"bold",children:"Prize eligibility"}),(0,l.jsx)(G.Z,{fontSize:["sm","md"],text:ee.win_condition,limit:40})]}),(0,l.jsxs)(g.U,{children:[nP.allow_install&&!en&&!e.downloaded&&(0,l.jsx)(p.z,{size:"md",display:["block","none"],bgColor:eP,textColor:"".concat(eE," !important"),onClick:handleDownloadClick,children:t("chat.download")}),!e.anonMode&&(0,l.jsx)(p.z,{leftIcon:(0,l.jsx)(ew.h,{}),bgColor:eE,"aria-label":"",onClick:()=>tO(!0),children:t("chat.share_agent")}),Q&&(0,l.jsx)(_.r,{href:"/credos/bounty/".concat(Q),children:(0,l.jsx)(p.z,{bgColor:eE,children:"View prize"})})]})]}),(0,l.jsxs)(w.K,{display:["none","block"],children:[showAgenthostAd()&&!t1&&(0,l.jsx)(u.xu,{mb:6,children:(0,l.jsx)(V.Z,{useV1:!0})}),showAgenthostAd()&&!t1&&!isUserAgentCreator()&&(0,l.jsxs)(u.xu,{mb:4,p:3,bg:"blue.50",border:"1px solid",borderColor:"blue.200",rounded:"lg",children:[(0,l.jsx)(m.x,{fontSize:"sm",fontWeight:"semibold",mb:2,children:"Build your own AI tool like this"}),(0,l.jsx)(_.r,{href:"/signup?utm=chat-build-cta",children:(0,l.jsx)(p.z,{size:"sm",colorScheme:"blue",width:"full",onClick:()=>(0,e0.T)().track("chat_build_cta_click",{agent_slug:Y}),children:"Get started free â"})})]}),s]}),(0,l.jsxs)(w.K,{display:["block","none"],children:[(0,l.jsxs)(u.xu,{mb:4,children:[showAgenthostAd()&&!t1&&(0,l.jsx)(V.Z,{useV1:!0}),showAgenthostAd()&&!t1&&!isUserAgentCreator()&&(0,l.jsxs)(u.xu,{mt:2,p:3,bg:"blue.50",border:"1px solid",borderColor:"blue.200",rounded:"lg",children:[(0,l.jsx)(m.x,{fontSize:"sm",fontWeight:"semibold",mb:2,children:"Build your own AI tool like this"}),(0,l.jsx)(_.r,{href:"/signup?utm=chat-build-cta",children:(0,l.jsx)(p.z,{size:"sm",colorScheme:"blue",width:"full",onClick:()=>(0,e0.T)().track("chat_build_cta_click",{agent_slug:Y}),children:"Get started free â"})})]})]}),(0,l.jsx)(SimpleAccordion,{title:t("chat.view_plan"),fontSize:"lg",children:s})]})]})};var lp,lx,lm,lf,lv,lj,l_,lb,lw,ly,lS,lC,lk,lz,lA,lE,lP,lI,lT,lM,lU,lF,lO,lR,lL,lD=ee?"https://".concat(D.ZP.testOrProd("stage","www"),".credos.ai/api/og?title=").concat(ee.title,"&bounty=").concat(ee.amount,"&attempts=").concat(ee.attempt_count):nP.avatar_url;return((null==ee?void 0:ee.claimed_at)&&$&&(lD+="&claimed=true"),le)?(0,l.jsxs)(u.xu,{height:"100vh",overflow:"hidden",children:[(0,l.jsx)(eA(),{children:(0,l.jsx)("link",{rel:"stylesheet",href:"https://fonts.googleapis.com/css?family=".concat(eO),className:s().dynamic([["acd8932c8b279d6b",[eE,eM,eP,eI,eF,eT,eO]]])})}),(0,l.jsx)(O.Z,{ignoreAdTracking:!0,title:nP.name,manifestUrl:(null==nP?void 0:nP.allow_install)?ed+(n="/manifest.json?agent_slug=".concat(Y),ea.TL&&(0,W.w)()&&(n+="&ignore_start_url=true"),n):null,description:nP.description,imageUrl:lD,canonicalUrl:Q?"https://www.credos.ai/chat/".concat(e.slug):"https://www.agenthost.ai/chat/".concat(e.slug)}),(0,l.jsxs)(z.k,{h:"full",id:"app-container",overflowY:"hidden",children:[!e.hideSidebar&&!tr&&!t1&&(0,l.jsx)(u.xu,{className:"side-agent-view",w:["0%",null,null,"20%"],fontSize:"sm",zIndex:1100,overflowY:"auto",children:(0,l.jsxs)(z.k,{h:"full",direction:"column",px:"4",py:"4",children:[(0,l.jsx)(g.U,{display:["none","none","block"],p:0,pb:0,mb:0,justifyContent:"flex-end",children:(0,l.jsx)(v.J,{boxSize:6,as:el.s3f,onClick:()=>tc(!0),cursor:"pointer"})}
1),getAgentDetailView()]})}),tr&&(0,l.jsx)(u.xu,{className:"side-agent-view",w:["0%",null,null,"5%"],fontSize:"sm",zIndex:1100,children:(0,l.jsx)(z.k,{h:"full",direction:"column",px:"4",py:"4",children:(0,l.jsx)(v.J,{boxSize:6,as:el.v_0,onClick:()=>tc(!1),cursor:"pointer"})})}),"code"==te&&(0,l.jsx)(g.U,{h:"100%",w:tr?"60%":"45%",children:(0,l.jsx)(u.xu,{h:"100%",w:"100%",overflowY:"hidden",children:(0,l.jsx)(X.Z,{language:tw,onLanguageChange:e=>ty(e),value:tv,onChange:e=>onUserCodeInput(e)})})}),"voice"==te&&(0,l.jsx)(g.U,{justifyContent:"center",h:"100%",bgColor:"black",w:tr?"60%":"45%",children:(0,l.jsxs)(w.K,{children:[(0,l.jsx)(A.E,{src:nP.avatar_url,h:"150px",w:"150px",rounded:"full"}),(0,l.jsx)(g.U,{justifyContent:"center",mt:2,children:tD&&(0,l.jsx)(I.$,{color:"green",thickness:"5px",size:"lg"})})]})}),!isVoiceChat()&&(0,l.jsx)(u.xu,{flex:"1",overflowY:"hidden",position:"relative",children:(0,l.jsxs)(u.xu,{w:"full",h:"100%",className:"chat-container",id:"scrolling_div",overflowY:"scroll",position:"absolute",top:"0",bottom:"0",left:"0",right:"0",children:[!nV&&(0,l.jsx)(u.xu,{bgColor:"gray.200",p:2,children:(0,l.jsx)(h.W,{children:(0,l.jsx)(_.r,{href:"https://status.openai.com",children:t("chat.open_ai_issues")})})}),(0,l.jsx)(u.xu,{className:"side-agent-view",display:["block",null,null,"none"],fontSize:"sm",p:"4",children:getAgentDetailView()}),(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(l.Fragment,{children:[tm&&(0,l.jsx)(u.xu,{display:"flex",justifyContent:"center",alignItems:"center",h:[null,"100%"],children:(0,l.jsx)(eX.Z,{agent:nP})}),eB.map((e,n)=>renderMessage(e,n)),t5&&(0,l.jsx)(h.W,{maxW:"760px",px:[3,5],children:(0,l.jsxs)(u.xu,{display:"inline-block",border:"1px solid",borderColor:"".concat(eT,"18"),borderRadius:"2xl",px:5,py:4,mt:1,children:[(0,l.jsx)(m.x,{fontSize:"sm",fontWeight:500,color:eT,opacity:.6,mb:3,children:t("chat.rate")}),(0,l.jsx)(ej.Z,{rating:t8,starHoverColor:"orange",starDimension:"26",starRatedColor:"orange",changeRating:e=>saveAgentRating(e)})]})}),tB&&tJ&&(0,l.jsx)(h.W,{maxW:"760px",px:[3,5],children:(0,l.jsxs)(u.xu,{border:"1px solid",borderColor:"rgba(79,70,229,0.2)",borderRadius:"2xl",overflow:"hidden",mb:4,bg:eI,children:[(0,l.jsx)(u.xu,{px:5,py:3,bg:"rgba(79,70,229,0.06)",borderBottom:"1px solid",borderColor:"rgba(79,70,229,0.12)",children:(0,l.jsxs)(g.U,{spacing:2,children:[(0,l.jsx)(u.xu,{w:2,h:2,borderRadius:"full",bg:"#818CF8"}),(0,l.jsx)(m.x,{fontSize:"sm",fontWeight:700,color:eT,children:"Approval Required"})]})}),(0,l.jsxs)(u.xu,{px:5,py:4,children:[(0,l.jsx)(m.x,{fontSize:"sm",color:eT,mb:3,children:tJ.title||"The agent is requesting your approval"}),tJ.function_name&&(0,l.jsx)(m.x,{fontSize:"sm",color:eT,opacity:.6,mb:3,children:tJ.function_name}),tJ.function_args&&(0,l.jsxs)(u.xu,{mb:4,p:3,bg:"".concat(eT,"08"),borderRadius:"xl",fontFamily:"mono",children:[(0,l.jsx)(m.x,{fontSize:"xs",fontWeight:600,color:eT,opacity:.5,mb:1,children:"Details"}),(0,l.jsx)("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word",fontSize:"12px",color:eT,opacity:.8},className:s().dynamic([["acd8932c8b279d6b",[eE,eM,eP,eI,eF,eT,eO]]]),children:"object"==typeof tJ.function_args?JSON.stringify(tJ.function_args,null,2):tJ.function_args})]}),(0,l.jsxs)(g.U,{spacing:3,justifyContent:"flex-end",children:[(0,l.jsx)(p.z,{size:"sm",variant:"outline",borderColor:"red.300",color:"red.500",borderRadius:"xl",onClick:()=>handleApprovalResponse(!1),isLoading:tY,isDisabled:tY,_hover:{bg:"red.50"},children:"Reject"}),(0,l.jsx)(p.z,{size:"sm",bg:"#4F46E5",color:"white",borderRadius:"xl",onClick:()=>handleApprovalResponse(!0),isLoading:tY,isDisabled:tY,_hover:{bg:"#4338CA"},children:"Approve"})]})]})]})}),tG&&(0,l.jsx)(h.W,{maxW:"760px",px:[3,5],children:(0,l.jsx)(g.U,{flexWrap:"wrap",spacing:2,mt:1,children:null==tG?void 0:tG.map(e=>(0,l.jsx)(p.z,{size:"sm",variant:"outline",borderColor:"".concat(eT,"25"),color:eT,borderRadius:"full",fontWeight:500,fontSize:"sm",_hover:{bg:"".concat(eT,"0D"),borderColor:"".concat(eT,"50")},onClick:()=>onMessageSend(e),children:e},e))})}),(0,l.jsx)("div",{id:"end_box",style:{height:"200px"},className:s().dynamic([["acd8932c8b279d6b",[eE,eM,eP,eI,eF,eT,eO]]])})]}),(0,l.jsx)(g.U,{position:"fixed",bgColor:eI,right:0,bottom:0,zIndex:100,pb:3,pt:2,w:"100%",justifyContent:"center",alignItems:"center",borderTop:"1px solid",borderColor:ez?"rgba(0,0,0,0.07)":"rgba(255,255,255,0.08)",children:(0,l.jsxs)(w.K,{w:["95%",null,null,"50%"],ml:[null,null,null,e.hideSidebar?null:"20%"],justifySelf:"center",alignSelf:"center",spacing:0,children:[(0,l.jsx)(g.U,{mt:1,mb:1,alignItems:"flex-end",children:(()=>{var n,o,s;let a=null!==(s=null==eL?void 0:eL.links)&&void 0!==s?s:[],i=[];for(let s of((null===(n=nP.json_data)||void 0===n?void 0:n.is_tool)&&i.push(getLLMSelect()),(e.agentData||(null==nP?void 0:null===(o=nP.skus)||void 0===o?void 0:o.includes("user_file_uploads")))&&nP.allow_file_uploads&&i.push((0,l.jsx)(eS.Z,{checkFileSuffix:!0,label:"".concat(t("chat.upload"),".."),isLoading:nU,accept:getAcceptedUploadFiles(),onChange:handleFileOnChange,multiple:!0})),t1||i.push((0,l.jsx)(p.z,{isLoading:nq,minW:"100px",onClick:()=>clearThread(),children:t("chat.clear")})),a)){let e=(0,l.jsx)(p.z,{whiteSpace:"nowrap",onClick:()=>handleAgentLinkClick(s),children:s.title});"website"==s.type?i.push((0,l.jsx)(_.r,{href:s.value,target:"_blank",children:e})):i.push((0,l.jsx)(p.z,{whiteSpace:"nowrap",onClick:()=>handleAgentLinkClick(s),children:s.title}))}return(0,l.jsx)(g.U,{alignItems:"flex-end",overflowX:"scroll",className:"action-bar",children:(0,l.jsx)(b.h,{children:i.map(e=>e)})})})()}),(0,l.jsx)(g.U,{mt:0,justifyContent:"center",alignItems:"center",w:"100%",h:"100%",children:(0,l.jsxs)(S.B,{children:[(0,l.jsx)(C.I,{variant:"filled",textColor:eI,borderRadius:"xl",style:{backgroundColor:eT,...nl,...no},_active:{},_focus:{boxShadow:"none",borderColor:"transparent"},placeholder:"".concat(t("chat.send_message_to")," ").concat(nP.name),value:eN,onChange:e=>eq(e.target.value),onKeyDown:e=>{"Enter"!==e.key||na?e.shiftKey&&"Enter"===e.key&&(e.preventDefault(),eq(eN+"\n")):e.shiftKey||(onMessageSend(),e.preventDefault())},resize:"none",rows:1,as:"textarea",ref:lh}),(0,l.jsxs)(k.x,{children:[np&&nr&&(0,l.jsx)(f.h,{"aria-label":"Stop response",icon:(0,l.jsx)(v.J,{as:F.cq1}),bgColor:eT,color:eI,borderRadius:"lg",onClick:stopAgentResponse}),na&&!(np&&nr)&&(0,l.jsx)(I.$,{size:"sm",color:eI}),!na&&!nr&&(0,l.jsx)(f.h,{"aria-label":"Send message",icon:(0,l.jsx)(v.J,{as:F.gYb}),bgColor:eT,color:eI,borderRadius:"lg",onClick:()=>onMessageSend(),isDisabled:na})]})]})}),nT&&nT.length>0&&(0,l.jsx)(g.U,{flexWrap:"wrap",mt:2,mb:2,children:nT.map((e,n)=>(0,l.jsxs)(g.U,{flexDir:"row",children:[(0,l.jsx)(G.Z,{hideShowMore:!0,text:e.name,limit:10}),(0,l.jsx)(p.z,{size:"xs",onClick:()=>removeFile(n),children:"Remove"})]},e.name))}),-1!==nd&&(0,l.jsxs)(m.x,{mt:1,color:eT,textAlign:"center",children:[nd," ",t("chat.out_of")," ",nh," ",t("chat.messages_left")]}),t1&&showAgenthostAd()&&(0,l.jsx)(V.Z,{useV1:!1})]})})]})]})}),isVoiceChat()&&(0,l.jsx)(VoiceChat,{agent:nP,agentApi:e5,isEmbed:en})]}),(0,l.jsx)(q.Z,{size:"md",isOpen:nH,onClose:()=>nG(!1),title:"Download",children:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(g.U,{children:[(0,l.jsxs)(m.x,{children:["1. ",t("chat.click_the")," "]}),(0,l.jsx)(K.aOG,{}),(0,l.jsxs)(m.x,{children:[" ",t("chat.button")]})]}),(0,l.jsxs)(m.x,{children:["2. ",t("chat.scroll_click"),' "',t("chat.add_to_home"),'"']}),(0,l.jsx)(p.z,{onClick:()=>nG(!1),mt:4,children:t("chat.done")})]})}),(0,l.jsx)(q.Z,{size:"3xl",isOpen:nk,onClose:()=>nz(!1),title:"Upgrade",children:(0,l.jsx)(eV.Z,{user:e.user,fetchTargetPlans:!0,customRenderer:n=>(0,l.jsx)(eQ.Z,{plans:n,user:e.user})})}),(0,l.jsx)(q.Z,{size:"md",isOpen:n$,onClose:()=>nQ(!1),title:t("chat.promotion"),children:(0,l.jsxs)(w.K,{spacing:4,children:[(0,l.jsx)(C.I,{value:n0,placeholder:"".concat(t("chat.promotion_placeholder"),"..."),onChange:e=>n1(e.target.value)}),(0,l.jsx)(p.z,{colorScheme:"blue",onClick:()=>findPlansByPromotion(),children:t("chat.apply")})]})}),(0,l.jsxs)(q.Z,{size:"2xl",isOpen:to,onClose:()=>null,hideClose:!0,footer:(0,l.jsx)(p.z,{isLoading:ta,colorScheme:"blue",mr:3,mt:4,onClick:()=>handleFormSubmit(),children:t("chat.submit")}),children:[(0,l.jsx)(w.K,{mb:4,children:(0,l.jsx)(E.X,{children:nP.name})}),th&&(0,l.jsxs)(w.K,{mb:4,children:[(0,l.jsx)(m.x,{children:null!==(lL=eL.email_gate_copy)&&void 0!==lL?lL:t("chat.email_required")}),"raw"==tp&&(0,l.jsx)(l.Fragment,{children:(0,l.jsx)(C.I,{value:nL,placeholder:"".concat(t("chat.your_email"),"..."),onChange:e=>nD(e.target.value)})}),"gmail"==tp&&(0,l.jsx)(l.Fragment,{children:(0,l.jsx)(SimpleGoogleSignIn,{onFinish:(e,n)=>{nD(e)}})})]}),(0,l.jsx)(eG.Z,{questions:n5,answers:n8,onAnswerChange:(e,n)=>{let t=[...n8];t[e]=n,n7(t)}}),(null==nP?void 0:nP.json_data.is_tool)&&(0,l.jsxs)(y.NI,{children:[(0,l.jsx)(T.l,{children:"LLM"}),getLLMSelect()]})]}),(0,l.jsx)(e$.Z,{error:lr,errorManager:ld,user:e.user}),tR&&(0,l.jsx)(q.Z,{isOpen:tF,onClose:()=>tO(!1),title:"",children:(0,l.jsxs)(w.K,{spacing:8,children:[(0,l.jsxs)(w.K,{children:[(0,l.jsx)(m.x,{fontSize:"lg",fontWeight:"bold",children:t("chat.share_agent")}),(0,l.jsxs)(g.U,{children:[(0,l.jsx)(ey.cG,{url:window.location.href,children:(0,l.jsx)(ey.LQ,{size:32,round:!0,onClick:()=>trackEvent("share",{type:"email"})})}),(0,l.jsx)(ey.Dk,{url:window.location.href,onClick:()=>trackEvent("share",{type:"fb"}),children:(0,l.jsx)(ey.Vq,{size:32,round:!0})}),(0,l.jsx)(ey.B,{url:window.location.href,onClick:()=>trackEvent("share",{type:"twitter"}),children:(0,l.jsx)(ey.Zm,{size:32,round:!0})}),(0,l.jsx)(ey.r2,{url:window.location.href,onClick:()=>trackEvent("share",{type:"linkedin"}),children:(0,l.jsx)(ey.pA,{size:32,round:!0})}),(0,l.jsx)(ey.N0,{url:window.location.href,onClick:()=>trackEvent("share",{type:"whatsapp"}),children:(0,l.jsx)(ey.ud,{size:32,round:!0})})]})]}),n_&&(0,l.jsxs)(w.K,{children:[(0,l.jsx)(m.x,{fontSize:"lg",fontWeight:"bold",children:t("chat.share_chat_history")}),(0,l.jsx)(g.U,{children:(0,l.jsx)(CopyButton,{text:"https://".concat(D.ZP.testOrProd("stage","www"),".").concat($?"credos":"agenthost",".ai/chat_history/").concat(n_)})})]})]})}),(0,l.jsx)(BountyWonModal,{isOpen:tQ,user:e.user}),(0,l.jsx)(UpgradeModal,{user:null===(lP=e.agent)||void 0===lP?void 0:lP.my_user_plan,loginUser:e.user,getPlanOnClick:getPlanOnClick,getPlanClicklink:getPlanClicklink,agentSkus:nP.skus,agent:nP,isOpen:tM,setOpenUpgradeModal:tU,setOpenLoginModal:nN}),(0,l.jsx)(AgentUserPlanManageModal,{user:null===(lI=e.agent)||void 0===lI?void 0:lI.my_user_plan,isOpen:tI,agentUserCancelApi:e6,setOpenUpgradeModal:tU,agent:nP,setManageModalOpen:tT}),!t1&&!e.agentData&&(0,l.jsx)(components_GDPRView,{}),(0,l.jsx)(Z.Z,{stage:nX,isOpen:nW,onClose:()=>nN(!1),onContinueWithEmail:e=>handleSendLoginCode(e),onSendCode:handleVerifyCode}),(0,l.jsx)(s(),{id:"acd8932c8b279d6b",dynamic:[eE,eM,eP,eI,eF,eT,eO],children:".side-agent-view{background-color:".concat(eE,"!important;background-image:").concat(eM,"!important}.side-agent-view *{color:").concat(eP,"!important;-ms-overflow-style:none;scrollbar-width:none}.chat-container{background-color:").concat(eI,"!important;background-image:").concat(eF,"!important}.chat-container>*{color:").concat(eT,"!important}.action-bar{-ms-overflow-style:none;scrollbar-width:none}.action-bar::-webkit-scrollbar{display:none}html *{font-family:").concat(eO,",sans-serif!important}html,body{overflow:hidden;position:fixed;width:100%;height:100%}#app-container{height:100%;width:100%;position:fixed;top:0;left:0}.chat-container{-webkit-overflow-scrolling:touch}")})]}):(0,l.jsx)(u.xu,{h:"60px",bgColor:"black",overflow:"hidden",children:(0,l.jsx)(A.E,{onClick:()=>{var e;null===(e=window.parent)||void 0===e||e.postMessage("ag-open-chat","*"),ln(!0)},src:null!==(lR=nP.avatar_url)&&void 0!==lR?lR:"/agenthostmascotdark.ico",objectFit:"cover"})})}var ns=t(39195),na=t(86560),ni=t(65301),nr=!0;function Chat(e){let[n,t]=(0,U.useState)(e.error?{message:(0,R.HH)(e.error)}:null);return(new eY.Z(n,t),e.error)?(0,l.jsx)(ns.Z,{useContainer:!0,user:e.user,children:(0,l.jsxs)(w.K,{textAlign:"center",justifyContent:"center",alignItems:"center",h:"50vh",children:[(0,l.jsx)(E.X,{children:(null==n?void 0:n.error_code)?n.error_code:"An error occurred"}),(0,l.jsx)(m.x,{children:n.message})]})}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(na.Z,{}),(0,l.jsx)(ni.Z,{}
1),(0,l.jsx)(ChatPage,{...e})]})}}},function(e){e.O(0,[3874,4885,5445,1778,1228,6556,1265,5937,5970,4617,3885,3254,5098,4996,8445,4712,1789,1664,5518,9880,2014,6070,4789,4524,4725,8333,878,9844,1786,9774,2888,179],function(){return e(e.s=26869)}),_N_E=e.O()}]);
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.