(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[233],{10363:function(e,t,n){"use strict";n.d(t,{Z:function(){return gx}});var s,r,a,i,o,l,c,d,u,m,p,h,g,f,x=n(50029),b=n(59499),v=n(90116),y=n(17674),w=n(64687),j=n.n(w),A=n(4361),k=n(4298),N=n.n(k),C=n(28344),q=n(67294),I=n(31955),S=n(85893);function E(){return(0,S.jsxs)("svg",{className:"animate-spin h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,S.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,S.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}var O=n(19261),V="Something went wrong. Please try again.";function P(e){var t,n,s=e.onLoggedIn,r=e.defaultEmail,a=e.allowChangeEmail,i=void 0===a||a,o=e.customLabel,l=(0,q.useState)(null),c=l[0],d=l[1],u=(0,q.useState)(r),m=u[0],p=u[1],h=(0,q.useState)(!1),g=h[0],f=h[1],b=(0,q.useState)(""),v=b[0],y=b[1],w=(0,q.useState)(!1),k=w[0],N=w[1],C=(0,q.useRef)(null),P=(0,q.useRef)(null);(0,q.useEffect)(function(){p(r)},[r]),(0,q.useEffect)(function(){p(r),f(!1),y(""),d(null),setTimeout(function(){var e;null===(e=C.current)||void 0===e||e.focus()},300)},[]);var T=(t=(0,x.Z)(j().mark(function e(){var t;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,N(!0),d(""),e.next=5,fetch((0,O.wV)()+"/api/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:m})});case 5:if(!((t=e.sent).status>=400)){e.next=13;break}return e.next=9,t.json();case 9:return d(e.sent.userMessage||V),N(!1),e.abrupt("return");case 13:if(t.ok){e.next=17;break}return d(V),N(!1),e.abrupt("return");case 17:return e.next=19,t.json();case 19:e.sent,f(!0),setTimeout(function(){P.current.focus()},100),e.next=28;break;case 24:e.prev=24,e.t0=e.catch(0),console.error(e.t0),d(V);case 28:N(!1);case 29:case"end":return e.stop()}},e,null,[[0,24]])})),function(){return t.apply(this,arguments)}),M=(n=(0,x.Z)(j().mark(function e(){var t,n;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,N(!0),d(""),e.next=5,fetch((0,O.wV)()+"/api/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:m,code:v})});case 5:if(!((t=e.sent).status>=400)){e.next=13;break}return e.next=9,t.json();case 9:return d(e.sent.userMessage||V),N(!1),e.abrupt("return");case 13:if(t.ok){e.next=17;break}return d(V),N(!1),e.abrupt("return");case 17:return e.next=19,t.json();case 19:n=e.sent,I.Z.set("typingmindcloud_token",n.token,{expires:180,sameSite:"none",secure:!0}),null==s||s(),e.next=28;break;case 24:e.prev=24,e.t0=e.catch(0),console.error(e.t0),d(V);case 28:N(!1);case 29:case"end":return e.stop()}},e,null,[[0,24]])})),function(){return n.apply(this,arguments)});return(0,S.jsx)("div",{children:g?(0,S.jsxs)("div",{children:[(0,S.jsxs)("div",{className:"my-4",children:[(0,S.jsx)("div",{children:(0,S.jsx)(A.cC,{id:"oVltH4"})}),(0,S.jsx)("div",{className:"font-semibold text-lg p-2 text-center bg-gray-100 my-2 rounded-md dark:bg-gray-700",children:m}),(0,S.jsx)("div",{className:"my-1 font-semibold",children:(0,S.jsx)(A.cC,{id:"B9mcRt"})}),(0,S.jsx)("input",{ref:P,type:"text",disabled:k,placeholder:"XXXXXX",className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-zinc-700 text-xl text-center",value:v,onChange:function(e){return y(e.target.value)},onKeyDown:function(e){"Enter"===e.key&&(e.preventDefault(),M())}})]}),c&&(0,S.jsx)("div",{className:"text-center text-red-500 text-sm font-semibold my-2",children:c}),(0,S.jsxs)("div",{className:"my-4 flex items-center justify-center gap-2",children:[(0,S.jsxs)("button",{onClick:M,disabled:k||!v,className:"flex items-center justify-center px-3 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 disabled:cursor-default transition-colors gap-2",children:[k?(0,S.jsx)(E,{}):null,(0,S.jsx)(A.cC,{id:"hQRttt"})]}),(0,S.jsx)("button",{onClick:function(){return f(!1)},disabled:k,className:"flex items-center justify-center px-3 py-2 border border-transparent text-sm font-medium rounded-md text-black bg-white-600 hover:bg-white-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-white-500 disabled:bg-gray-400 disabled:cursor-default transition-colors gap-2 disabled:text-white dark:text-white",children:(0,S.jsx)(A.cC,{id:"dEgA5A"})})]})]}):(0,S.jsxs)("div",{children:[(0,S.jsxs)("div",{className:"my-4",children:[(0,S.jsx)("div",{className:"my-1 font-semibold",children:o||(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"vUqMKV"})})}),(0,S.jsx)("input",{ref:C,type:"email",disabled:k||!i,placeholder:"example@gmail.com",className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm dark:bg-zinc-700 disabled:text-gray-500",value:m,onChange:function(e){return p(e.target.value)},onKeyDown:function(e){"Enter"===e.key&&(e.preventDefault(),T())}}),i?(0,S.jsx)("div",{className:"text-xs text-gray-500 mt-1",children:(0,S.jsx)(A.cC,{id:"sJ6OIn"})}):null]}),c&&(0,S.jsx)("div",{className:"text-center text-red-500 text-sm font-semibold my-2",children:c}),(0,S.jsx)("div",{className:"my-4 flex items-center justify-center gap-2",children:(0,S.jsxs)("button",{onClick:T,disabled:k||!m,className:"flex items-center justify-center px-3 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 disabled:cursor-default transition-colors gap-2",children:[k?(0,S.jsx)(E,{}):null,(0,S.jsx)(A.cC,{id:"7xHXyX"})]})})]})})}var T=n(89555),M=n(22552),D=n(21227),B=n(27478);function L(e){var t,n=e.licensePayload,s=e.savedLicenseKey,r=e.onCloudSyncDone,a=e.onLocalOnlyModeConfirmed,i=[{id:"cloud",title:T.ag._({id:"Bp/aCq"}),description:T.ag._({id:"nd5PZx"}),recommended:!0,icon:function(){return(0,S.jsx)(C.H_w,{className:"h-6 w-6 text-blue-500"})}},{id:"local",title:T.ag._({id:"dTa89z"}),description:T.ag._({id:"cf3IX1"}),icon:function(){return(0,S.jsx)(M.R8I,{className:"h-6 w-6 text-red-500"})}}],o=(0,q.useState)(i[0]),l=o[0],c=o[1],d=(0,q.useState)(!1),u=d[0];d[1];var m=(0,q.useState)(!1),p=m[0],h=m[1];return(0,S.jsxs)("div",{children:[(0,S.jsxs)("fieldset",{children:[(0,S.jsx)("legend",{className:"text-lg font-bold text-center",children:(0,S.jsx)(A.cC,{id:"KrokRF"})}),(0,S.jsx)("legend",{className:"text-sm max-w-xs mx-auto text-gray-500 text-center",children:(0,S.jsx)(A.cC,{id:"cHR7zG"})}),(0,S.jsx)(D.Ee,{value:l,onChange:c,className:"mt-6 grid grid-cols-1 gap-y-6 sm:grid-cols-2 sm:gap-x-4",children:i.map(function(e){return(0,S.jsxs)(D.Y8,{value:e,"aria-label":e.title,"aria-description":"".concat(e.description),className:"group relative flex cursor-pointer rounded-lg border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-800 p-4 shadow-sm focus:outline-none data-[focus]:border-blue-600 data-[focus]:ring-2 data-[focus]:ring-blue-600",children:[(0,S.jsx)("span",{className:"flex flex-1",children:(0,S.jsxs)("span",{className:"flex flex-col",children:[(0,S.jsxs)("span",{className:" flex items-center justify-start gap-2 text-sm font-medium text-gray-900 dark:text-white",children:[e.icon(),(0,S.jsx)("span",{children:e.title})]}),(0,S.jsx)("span",{className:"mt-1 flex items-center text-sm text-gray-500",children:e.description}),e.recommended?(0,S.jsxs)("span",{className:"text-xs font-semibold mt-1 text-blue-500",children:[(0,S.jsx)(A.cC,{id:"WEYdDv"})," ⋅ ",(0,S.jsx)(A.cC,{id:"GKWMv+"})]}):null]})}),(0,S.jsx)(B.Z,{"aria-hidden":"true",className:"h-5 w-5 text-blue-500 [.group:not([data-checked])_&]:invisible"}),(0,S.jsx)("span",{"aria-hidden":"true",className:"pointer-events-none absolute -inset-px rounded-lg border-2 border-transparent group-data-[focus]:border group-data-[checked]:border-blue-600"})]},e.id)})})]}),(null==l?void 0:l.id)==="cloud"?(0,S.jsxs)("div",{className:"p-4 ",children:[(0,S.jsx)("div",{className:"font-semibold my-2",children:(0,S.jsx)(A.cC,{id:"RK1xy9"})}),(0,S.jsxs)("ul",{className:"pl-4 list-disc space-y-2",children:[(0,S.jsx)("li",{children:(0,S.jsx)(A.cC,{id:"6wedmD",components:{0:(0,S.jsx)("b",{})}})}),(0,S.jsx)("li",{children:(0,S.jsx)(A.cC,{id:"oJ7rYu",components:{0:(0,S.jsx)("b",{})}})}),(0,S.jsx)("li",{children:(0,S.jsx)(A.cC,{id:"JDdS6f",components:{0:(0,S.jsx)("b",{})}})})]}),(0,S.jsx)("hr",{className:"my-4 border-gray-200 dark:border-gray-700"}),(0,S.jsx)(P,{defaultEmail:null==n||null===(t=n.payload)||void 0===t?void 0:t.email,customLabel:T.ag._({id:"Xyoped"}),onLoggedIn:function(){r()}})]}):(null==l?void 0:l.id)==="local"?(0,S.jsxs)("div",{className:"p-4 ",children:[(0,S.jsx)("div",{className:"font-semibold my-2",children:(0,S.jsx)(A.cC,{id:"rXS98F"})}),(0,S.jsxs)("ul",{className:"pl-4 list-disc space-y-2",children:[(0,S.jsx)("li",{children:(0,S.jsx)(A.cC,{id:"ib3/yS",components:{0:(0,S.jsx)("b",{})}})}),(0,S.jsx)("li",{children:(0,S.jsx)(A.cC,{id:"G8VkJu",components:{0:(0,S.jsx)("b",{})}})}),(0,S.jsx)("li",{children:(0,S.jsx)(A.cC,{id:"reZ4Yn",components:{0:(0,S.jsx)("b",{})}})}),(0,S.jsx)("li",{children:(0,S.jsx)(A.cC,{id:"REMo8V",components:{0:(0,S.jsx)("b",{className:"text-red-500"})}})})]}),(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"my-2",children:(0,S.jsx)(A.cC,{id:"LFGDRf",components:{0:(0,S.jsx)("b",{}),1:(0,S.jsx)("b",{className:"text-red-500"})}})}),(0,S.jsx)("div",{className:"text-center text-lg font-bold bg-gray-100 p-2 rounded-md dark:bg-gray-700",onClick:function(){return navigator.clipboard.writeText(s)},children:s}),(0,S.jsx)("div",{className:"my-2",children:(0,S.jsx)(A.cC,{id:"d/uOLs",components:{0:(0,S.jsx)("b",{})}})})]}),(0,S.jsx)("div",{className:"my-4",children:(0,S.jsxs)("label",{className:"flex items-center justify-start gap-1 text-red-500",children:[(0,S.jsx)("input",{type:"checkbox",className:"mr-2",checked:p,onChange:function(e){h(e.target.checked)}}),(0,S.jsx)("span",{className:"text-sm",children:(0,S.jsx)(A.cC,{id:"5LtjYx"})})]})}),(0,S.jsx)("div",{className:"my-2 text-center",children:(0,S.jsxs)("button",{onClick:function(){return a()},type:"submit",className:"inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 gap-2",disabled:!p,children:[u?(0,S.jsx)(E,{}):"→",(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"xGVfLh"})})]})})]}):(0,S.jsx)("div",{className:"p-4 text-center text-gray-500",children:(0,S.jsx)(A.cC,{id:"uvUq+/"})})]})}var R=(0,q.createContext)(),_=function(){return(0,q.useContext)(R)||{}};function Z(e){var t=e.value,n=e.children;return(0,S.jsx)(R.Provider,{value:t,children:n})}var K=n(24855),G=(0,K.eK)("useLicenseKey");function F(){var e,t=(0,q.useState)(!1),n=t[0],s=t[1],r=(0,q.useState)(!1),a=r[0],i=r[1],o=(0,q.useState)(!1),l=o[0],c=o[1],d=G(""),u=(0,y.Z)(d,2),m=u[0],p=u[1],h=(e=(0,x.Z)(j().mark(function e(){var t,n;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,i(!0),c(""),t="https://www.typingmind.com",e.next=6,(0,K.CQ)().get("INSTANCE_ID");case 6:return n=e.sent,e.next=9,fetch(t+"/api/unlink-license",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:m,instanceID:n})});case 9:return e.sent.ok,e.next=13,(0,K.CQ)().del("INSTANCE_ID");case 13:p(""),window.location.reload(),e.next=21;break;case 17:e.prev=17,e.t0=e.catch(0),console.error(e.t0),c("Something went wrong. Please try again.");case 21:i(!1);case 22:case"end":return e.stop()}},e,null,[[0,17]])})),function(){return e.apply(this,arguments)});return m?(0,S.jsxs)("div",{className:"text-center",children:[(0,S.jsx)("div",{children:(0,S.jsx)("button",{onClick:function(){return s(!0)},className:"text-red-500 hover:underline text-sm font-semibold",children:(0,S.jsx)(A.cC,{id:"W2RH+r"})})}),n?(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"text-sm text-orange-500 my-2",children:(0,S.jsx)(A.cC,{id:"qZyW8X"})}),l&&(0,S.jsx)("div",{className:"text-red-500 my-2 font-semibold",children:l}),(0,S.jsx)("div",{children:(0,S.jsx)("button",{onClick:h,type:"submit",className:"inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-red-600 hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 disabled:bg-gray-400 gap-2",disabled:a,children:(0,S.jsx)(A.cC,{id:"Kb4R2a"})})}),(0,S.jsx)("div",{children:(0,S.jsx)("button",{onClick:function(){return s(!1)},className:"text-gray-500 hover:underline text-sm font-semibold p-4",children:(0,S.jsx)(A.cC,{id:"dEgA5A"})})})]}):null]}):null}var Y=n(79804),U=n(41257),H=n(48832),z=n(61193),W=n.n(z),Q=n(71501);function J(){for(var e=arguments.length,t=Array(e),n=0;n=500)){e.next=17;break}return e.next=13,t.text();case 13:return e.sent,V(D._({id:"0O2epA"})),k(!1),e.abrupt("return");case 17:if(!(t.status>=400)){e.next=32;break}return e.next=20,t.json();case 20:if(!(n=e.sent).deviceUnlinked){e.next=25;break}return V(D._({id:"XvQUAU"})),k(!1),e.abrupt("return");case 25:if(!n.limitReached){e.next=29;break}return V((0,S.jsxs)("div",{className:"text-left flex flex-col gap-2",children:[(0,S.jsx)("div",{children:(0,S.jsx)(A.cC,{id:"cTdBYz"})}),(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{children:(0,S.jsx)(A.cC,{id:"XNLbke",values:{0:n.activationLimit}})}),(0,S.jsx)("div",{children:(0,S.jsx)(A.cC,{id:"gj6qzs",values:{0:n.activationUsage}})})]}),(0,S.jsx)("div",{className:"text-center",children:(0,S.jsx)("a",{href:"https://www.typingmind.com/license",target:"_blank",className:"font-semibold hover:underline p-2 rounded border-red-500 inline-block border",children:(0,S.jsx)(A.cC,{id:"lcFzRd"})})}),(0,S.jsxs)("div",{children:[(0,S.jsx)(A.cC,{id:"xDic64"})," "]}),(0,S.jsx)("div",{children:(0,S.jsx)("a",{className:"hover:underline",href:"https://www.typingmind.com/faqs",children:(0,S.jsx)(A.cC,{id:"vXqHoZ"})})})]})),k(!1),e.abrupt("return");case 29:return V(n.userMessage||D._(ee)),k(!1),e.abrupt("return");case 32:if(t.ok){e.next=36;break}return V(D._(ee)),k(!1),e.abrupt("return");case 36:return e.next=38,t.json();case 38:if(!(s=e.sent).instanceID){e.next=42;break}return e.next=42,(0,K.CQ)().set("INSTANCE_ID",s.instanceID);case 42:return e.next=44,i(f);case 44:h(f),null==c||c(),null==l||l(),e.next=53;break;case 49:e.prev=49,e.t0=e.catch(4),console.error(e.t0),V(D._(ee));case 53:k(!1);case 54:case"end":return e.stop()}},e,null,[[4,49]])})),function(){return t.apply(this,arguments)});return(0,S.jsxs)("div",{className:"max-w-lg",children:[(0,S.jsx)("p",{className:"my-2 text-sm",children:(0,S.jsx)(A.cC,{id:"5trAhQ",components:{0:(0,S.jsx)("b",{})}})}),a?(0,S.jsx)("div",{className:"text-sm font-semibold text-red-500",children:a.limitReached?(0,S.jsx)("div",{children:(0,S.jsx)(A.cC,{id:"0EmptK",components:{0:(0,S.jsx)("br",{}),1:(0,S.jsx)("b",{})}})}):a.deviceUnlinked?(0,S.jsx)("div",{children:(0,S.jsx)(A.cC,{id:"6QICdW"})}):a.userMessage?(0,S.jsx)("div",{children:a.userMessage}):null}):null,(0,S.jsx)("div",{className:"my-4 z-100 relative",children:T?(0,S.jsxs)("div",{className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm dark:bg-zinc-700 text-right flex items-center justify-end gap-4",children:[(0,S.jsxs)("span",{children:["**************************",p.slice(-4)]}),(0,S.jsx)("button",{onClick:function(){M(!1),b(""),setTimeout(function(){var e;null===(e=L.current)||void 0===e||e.focus()},100)},className:"text-blue-500 hover:underline",children:(0,S.jsx)(A.cC,{id:"rZf6Qw"})})]}):(0,S.jsx)("input",{type:"text",ref:L,disabled:w,placeholder:D._({id:"j/jUA8"}),className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm dark:bg-zinc-700",value:f,onChange:function(e){return b(e.target.value)},onKeyDown:function(e){"Enter"!==e.key||f&&f.startsWith("sk-")||(e.preventDefault(),R())}})}),I&&(0,S.jsx)("div",{className:"my-2 text-sm text-red-500 text-center",children:I}),f&&f.startsWith("sk-")?(0,S.jsx)("p",{className:"my-2 text-sm text-red-500",children:(0,S.jsx)(A.cC,{id:"vVD6Dy"})}):null,T?null:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("p",{className:"my-2 text-sm",children:(0,S.jsx)(A.cC,{id:"gvy3rp",components:{0:(0,S.jsx)("button",{onClick:function(){null==d||d()},className:"text-blue-500 hover:underline"})}})}),(0,S.jsxs)("p",{className:"my-2 text-sm",children:[(0,S.jsx)(A.cC,{id:"4TQrIR"})," →"," ",(0,S.jsx)("a",{className:"text-blue-500 hover:underline",href:(null===(n=B.serverHostConfig)||void 0===n||null===(n=n.licenseServerConfig)||void 0===n?void 0:n.recoverLink)||"https://app.lemonsqueezy.com/my-orders/",target:"_blank",rel:"noopener noreferrer",children:(0,S.jsx)(A.cC,{id:"9kEKKZ"})})]}),(0,S.jsx)("div",{className:"my-4 text-center flex items-center justify-center space-x-2",children:(0,S.jsxs)("button",{disabled:w||!f||f&&f.startsWith("sk-"),onClick:R,className:"inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 space-x-1 disabled:bg-gray-500",children:[w?(0,S.jsx)(E,{}):(0,S.jsx)(Y.bzc,{className:"w-4 h-4"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"VzNizi"})})]})}),(0,S.jsx)("p",{className:"my-2 text-xs",children:(0,S.jsx)(A.cC,{id:"153KVj"})})]}),o?(0,S.jsx)("div",{className:"text-center",children:(0,S.jsx)(A.cC,{id:"2LLYJB",values:{0:(0,O.fm)((null==o||null===(s=o.payload)||void 0===s?void 0:s.plan)||"?")},components:{0:(0,S.jsx)("b",{className:"text-green-500"})}})}):null,(0,S.jsxs)("div",{className:"text-center mt-4",children:[(0,S.jsx)("div",{className:"my-2 text-center",children:(0,S.jsxs)("button",{onClick:function(){null==d||d()},className:"text-blue-500 hover:underline inline-flex items-center justify-center gap-2 font-semibold",children:[(0,S.jsx)(C.PcH,{className:"w-4 h-4"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"ldcOo7"})})]})}),(0,S.jsx)("div",{className:"my-2",children:(0,S.jsxs)("a",{target:"_blank",rel:"noopener noreferrer",href:(null===(r=B.serverHostConfig)||void 0===r||null===(r=r.licenseServerConfig)||void 0===r?void 0:r.manageLink)||"https://www.typingmind.com/license",className:"text-blue-500 hover:underline inline-flex items-center justify-center gap-2 font-semibold",children:[(0,S.jsx)(C.q2z,{className:"w-4 h-4"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"HjdyXC"})})]})}),(0,S.jsx)("div",{className:"mt-2",children:(0,S.jsx)(F,{})})]})]})}var en=n(81354),es=n.n(en);function er(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,s)}return n}function ea(e){for(var t=1;t0,z=[].concat((0,v.Z)(G),(0,v.Z)(F)).filter(function(e){return e.isEncrypted}).length>0;return H?0===U?(0,S.jsxs)("div",{className:"my-4",children:[(0,S.jsxs)("div",{className:"text-sm font-semibold text-green-500 text-center",children:["\uD83D\uDD12 ",(0,S.jsx)(A.cC,{id:"uxcgu1"})]}),(0,S.jsx)("div",{className:"text-xs text-gray-500 text-center",children:(0,S.jsx)(A.cC,{id:"iK/LRS"})})]}):(0,S.jsxs)("div",{children:[z&&U>0?(0,S.jsx)("div",{className:"my-4 text-xs text-orange-500",children:(0,S.jsx)(A.cC,{id:"Ud2w4n",values:{unencryptedKeys:U}})}):null,z?null:(0,S.jsxs)("label",{className:"flex items-center justify-center gap-2",children:[(0,S.jsx)("input",{type:"checkbox",className:"form-checkbox h-5 w-5 text-blue-600",checked:N,onChange:function(e){return I(e.target.checked)}}),(0,S.jsxs)("span",{children:["\uD83D\uDD10 ",(0,S.jsx)(A.cC,{id:"6NbliF"})]})]}),N?(0,S.jsxs)("div",{className:"my-4",children:[(0,S.jsxs)("div",{className:"text-sm font-semibold my-1",children:[(0,S.jsx)(A.cC,{id:"JxXP1G"}),":"]}),(0,S.jsx)("div",{className:"text-xs text-gray-500 my-1",children:(0,S.jsx)(A.cC,{id:"OnFMha"})}),(0,S.jsx)("div",{children:(0,S.jsx)("input",{type:"password",placeholder:T.ag._({id:"f7sXvi"}),className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm dark:bg-zinc-700",value:O,autoComplete:"off",onChange:function(e){return V(e.target.value)},onKeyDown:function(e){"Enter"===e.key&&(e.preventDefault(),K())}})}),b?(0,S.jsx)("div",{className:"text-red-500 text-sm my-1",children:b}):null,(0,S.jsx)("div",{className:"my-2 text-center",children:(0,S.jsxs)("button",{onClick:K,disabled:!O,type:"submit",className:"inline-flex items-center px-4 py-2 border border-transparent text-base font-medium rounded-md shadow-sm text-white bg-red-600 hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 disabled:bg-gray-400 gap-2",children:[(0,S.jsx)(C.kUi,{className:"w-4 h-4"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"HD2Tiz"})})]})})]}):null]}):null}function eu(e){var t=e.size;return(0,S.jsx)("img",{src:"/assets/setapp-144x144.png",className:function(){for(var e=arguments.length,t=Array(e),n=0;n0&&void 0!==arguments[0]?arguments[0]:{},n=t.type,s=t.onConfirmed,r=t.children,a=t.className,i=t.disabled,o=t.defaultText,l=t.confirmText,c=t.loading,d=(0,q.useState)(!1),u=d[0],m=d[1];return(0,q.useEffect)(function(){return function(){return clearTimeout(e)}},[]),(0,q.useEffect)(function(){return u&&(clearTimeout(e),e=setTimeout(function(){m(!1)},2e3)),function(){return clearTimeout(e)}},[u]),(0,S.jsxs)("button",{type:n,disabled:i,onClick:function(e){e.stopPropagation(),!i&&(u?s&&s():m(!0))},className:a,children:[u?(void 0===l?function(){return(0,S.jsx)("span",{"data-tooltip-id":"global","data-tooltip-content":T.ag._({id:"GdhD7H"}),className:"text-red-500 hover:underline",children:(0,S.jsx)(A.cC,{id:"Aqw8Kb"})})}:l)({disabled:i}):r||(void 0===o?function(){return"Delete"}:o)({disabled:i}),c&&(0,S.jsx)(E,{})]})}var eE=n(27891),eO={id:"fWsBTs"};function eV(e){var t,n,s,r,a,i,o,l,c,d,u,m,p=e.subscription,h=(0,q.useState)(p),g=h[0],f=h[1],b=(0,q.useState)(!1),v=b[0],y=b[1],w=(0,q.useState)(null),k=w[0],N=w[1],C=(0,A.mV)().i18n,I=(t=(0,x.Z)(j().mark(function e(t){var n,s,r,a;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("cancel"!==t||window.confirm(C._({id:"/ns5IT"}))){e.next=3;break}return e.abrupt("return");case 3:return y(!0),N(""),e.prev=5,e.next=8,fetch("/api/cloud/subscriptions/"+p.id,{headers:{"Content-Type":"application/json"},method:"PUT",body:JSON.stringify({action:t})});case 8:if(!((s=e.sent).status>=400)){e.next=16;break}return e.next=12,s.json();case 12:return N(e.sent.userMessage||C._(eO)),y(!1),e.abrupt("return");case 16:if(s.ok){e.next=20;break}return N(C._(eO)),y(!1),e.abrupt("return");case 20:return e.next=22,s.json();case 22:f((r=e.sent).subscription),"update"===t&&null!=r&&null!==(n=r.subscription)&&void 0!==n&&null!==(n=n.data)&&void 0!==n&&null!==(n=n.attributes)&&void 0!==n&&null!==(n=n.urls)&&void 0!==n&&n.update_payment_method&&window.open(null==r||null===(a=r.subscription)||void 0===a||null===(a=a.data)||void 0===a||null===(a=a.attributes)||void 0===a||null===(a=a.urls)||void 0===a?void 0:a.update_payment_method,"_blank"),e.next=31;break;case 27:e.prev=27,e.t0=e.catch(5),N(C._(eO)),console.error(e.t0);case 31:y(!1);case 32:case"end":return e.stop()}},e,null,[[5,27]])})),function(e){return t.apply(this,arguments)});return(0,S.jsx)("div",{className:"flex items-center justify-between py-2",children:(0,S.jsx)("div",{className:"flex items-center",children:(0,S.jsxs)("details",{children:[(0,S.jsx)("summary",{children:(0,S.jsxs)("div",{className:"text-base font-medium inline-flex items-center justify-start gap-2 cursor-pointer",children:[(0,S.jsx)("span",{className:"hover:underline",children:eE.T.includes(null==g||null===(n=g.data)||void 0===n||null===(n=n.attributes)||void 0===n?void 0:n.variant_id)?"1GB Storage":eE.tW.includes(null==g||null===(s=g.data)||void 0===s||null===(s=s.attributes)||void 0===s?void 0:s.variant_id)?"5GB Storage":null==g||null===(r=g.data)||void 0===r||null===(r=r.attributes)||void 0===r?void 0:r.product_name}),(null==g||null===(a=g.data)||void 0===a||null===(a=a.attributes)||void 0===a?void 0:a.status)==="active"?(0,S.jsx)("div",{className:"text-xs text-white px-2 py-1 bg-green-500 rounded-md inline-block",children:(0,S.jsx)(A.cC,{id:"F6pfE9"})}):(null==g||null===(i=g.data)||void 0===i||null===(i=i.attributes)||void 0===i?void 0:i.status)==="cancelled"?(0,S.jsx)("div",{className:"text-xs text-white px-2 py-1 bg-red-500 rounded-md inline-block",children:(0,S.jsx)(A.cC,{id:"vv7kpg"})}):(0,S.jsx)("div",{className:"text-xs text-white px-2 py-1 bg-gray-500 rounded-md inline-block",children:null==g||null===(o=g.data)||void 0===o||null===(o=o.attributes)||void 0===o?void 0:o.status_formatted})]})}),(null==g||null===(l=g.data)||void 0===l||null===(l=l.attributes)||void 0===l?void 0:l.status)==="cancelled"?(0,S.jsxs)("div",{className:"text-xs text-gray-500 my-1",children:[(0,S.jsx)(A.cC,{id:"FP9FYD"}),":"," ",new Date(null==g||null===(c=g.data)||void 0===c||null===(c=c.attributes)||void 0===c?void 0:c.ends_at).toLocaleString()]}):null,(0,S.jsx)("div",{className:"flex items-center justify-start gap-2 my-2",children:(null==g||null===(d=g.data)||void 0===d||null===(d=d.attributes)||void 0===d?void 0:d.status)==="active"?(0,S.jsxs)("div",{className:"flex items-center justify-start gap-2",children:[(0,S.jsx)("button",{onClick:function(){return I("update")},disabled:v,className:"px-4 py-2 bg-blue-500 rounded-md text-sm font-medium text-white hover:bg-blue-600 disabled:bg-gray-400 flex items-center justify-center gap-2",children:(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"XymtD/"})})}),(0,S.jsx)("button",{onClick:function(){return I("cancel")},disabled:v,className:"px-4 py-2 bg-red-500 rounded-md text-sm font-medium text-white hover:bg-red-600 disabled:bg-gray-400 flex items-center justify-center gap-2",children:(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"dEgA5A"})})})]}):(null==g||null===(u=g.data)||void 0===u||null===(u=u.attributes)||void 0===u?void 0:u.status)==="cancelled"&&new Date(null==g||null===(m=g.data)||void 0===m||null===(m=m.attributes)||void 0===m?void 0:m.ends_at)>new Date?(0,S.jsx)("div",{className:"flex items-center justify-start gap-2",children:(0,S.jsx)("button",{onClick:function(){return I("resume")},disabled:v,className:"px-4 py-2 bg-blue-500 rounded-md text-sm font-medium text-white hover:bg-blue-600 disabled:bg-gray-400 flex items-center justify-center gap-2",children:(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"v39wLo"})})})}):null}),v?(0,S.jsxs)("div",{className:"text-xs text-gray-500 my-1 flex items-center justify-start my-2 gap-2",children:[(0,S.jsx)(E,{}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"rYG2u6"})})]}):null,k&&(0,S.jsx)("div",{className:"text-center text-red-500 text-sm font-semibold my-2",children:k})]})})})}var eP=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function eT(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=e.getDate(),r=eP[e.getMonth()],a=e.getFullYear(),i=e.getHours(),o=e.getMinutes();return(o<10&&(o="0".concat(o)),t)?"".concat(t," at ").concat(i,":").concat(o):n?"".concat(s," ").concat(r," at ").concat(i,":").concat(o):"".concat(s," ").concat(r," ").concat(a,". at ").concat(i,":").concat(o)}function eM(e,t){if(!e)return null;var n=null==t?void 0:t.format,s="object"==typeof e?e:new Date(e),r=new Date,a=new Date(r-864e5),i=Math.round((r-s)/1e3),o=Math.round(i/60),l=Math.floor(o/60),c=Math.floor(l/24),d=Math.floor(c/7),u=Math.floor(d/52),m=r.toDateString()===s.toDateString(),p=a.toDateString()===s.toDateString(),h=r.getFullYear()===s.getFullYear();if("short"===n){if(i<=60)return"1m";if(o<60)return"".concat(o,"m");if(l<24)return"".concat(l,"h");if(c<7)return"".concat(c,"d");else if(c<14)return"1w";else if(c<21)return"".concat(d,"w");else if(d<52)return"".concat(d,"w");else if(u<2)return"1y";else return"".concat(u,"y")}if(i<5)return"now";if(i<60)return"".concat(i," seconds ago");if(i<90)return"about a minute ago";if(o<60)return"".concat(o," minutes ago");if(m)return eT(s,"Today");if(p)return eT(s,"Yesterday");if(h)return eT(s,!1,!0);return eT(s)}var eD=n(10245);function eB(e,t){var n=(0,q.useState)(e),s=n[0],r=n[1];return(0,q.useEffect)(function(){var n=setTimeout(function(){r(e)},t);return function(){clearTimeout(n)}},[e,t]),s}var eL=function(){var e=(0,q.useRef)(!0);return(0,q.useEffect)(function(){e.current=!1},[]),e.current};function eR(e,t){(0,q.useEffect)(function(){var n=function(n){!e.current||e.current.contains(n.target)||t(n)};return document.addEventListener("mousedown",n),document.addEventListener("touchstart",n),function(){document.removeEventListener("mousedown",n),document.removeEventListener("touchstart",n)}},[e,t])}function e_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,s)}return n}function eZ(e){for(var t=1;t=400)){e.next=30;break}return e.next=24,c.json();case 24:return N((h=e.sent).userMessage||(null===(p=h.error)||void 0===p?void 0:p.message)||tt),m(!1),g(URL.createObjectURL(t)),e.abrupt("return");case 30:if(c.ok){e.next=36;break}return N(tt),m(!1),g(URL.createObjectURL(t)),e.abrupt("return");case 36:return e.next=38,c.json();case 38:f=e.sent,s?s(f.text,r):(v(f.text),m(!1)),e.next=49;break;case 42:e.prev=42,e.t0=e.catch(5),console.error(e.t0),N(tt),m(!1),g(URL.createObjectURL(t));case 49:case"end":return e.stop()}},e,null,[[5,42]])}))).apply(this,arguments)}return(0,S.jsxs)("div",{className:"p-2 w-full flex items-center justify-center flex-col gap-4",children:[u||b?null:l?(0,S.jsxs)("div",{className:"text-gray-500 text-lg font-light p-4",children:[(0,S.jsxs)("div",{className:"text-center my-2 relative isolate p-1",children:[(0,S.jsx)("svg",{viewBox:"0 0 100 100",className:"w-full h-full absolute top-0 left-0 z-[-1] text-red-500",children:(0,S.jsx)("circle",{cx:50,cy:50,r:45,fill:"none",stroke:"currentColor",strokeWidth:5,strokeDashoffset:"282.6",transform:"rotate(-90 50 50)",children:(0,S.jsx)("animate",{attributeName:"stroke-dasharray",values:"0,282.6;282.6,0",dur:"120s",repeatCount:1})})}),(0,S.jsx)("div",{className:"rounded-full bg-gray-300 dark:bg-zinc-600 dark:hover:bg-zinc-500 p-6 inline-flex items-center justify-center transition-all hover:bg-gray-200 space-x-2",children:(0,S.jsx)(C.uYL,{className:"w-8 h-8 animate-listening"})})]}),(0,S.jsx)("div",{className:" animate-listening",children:(0,S.jsx)(A.cC,{id:"95r17U"})}),(0,S.jsx)(ts,{})]}):(0,S.jsx)("div",{className:"text-gray-500 text-sm p-4 text-center",children:(0,S.jsx)(A.cC,{id:"mWkeNy"})}),u?(0,S.jsxs)("div",{className:"text-gray-500 text-lg font-light p-4 flex items-center justify-center gap-2",children:[(0,S.jsx)(E,{}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"fp5rKh"})})]}):null,b?(0,S.jsx)("div",{className:"text-left py-2 px-4 bg-gray-100 rounded-md max-w-lg",children:b}):null,k?(0,S.jsx)("div",{className:"text-red-500 text-sm",children:k}):null,h&&(0,S.jsxs)("a",{href:h,download:!0,className:"text-blue-500 cursor-pointer hover:underline disabled:no-underline disabled:cursor-default flex items-center space-x-1",children:[(0,S.jsx)(M.uKn,{size:16}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"uOcnoU"})})]}),(0,S.jsx)("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:l?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)("button",{className:"inline-flex items-center px-4 py-2 border border-transparent text-base font-medium rounded-md shadow-sm text-white bg-red-600 hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 disabled:bg-gray-400 gap-2",onClick:function(){U()},children:[(0,S.jsx)(C.u9M,{className:"w-4 h-4"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"JmZ/+d"})})]}),(0,S.jsxs)("button",{className:"inline-flex items-center px-4 py-2 border border-transparent text-base font-medium rounded-md shadow-sm text-white bg-gray-600 hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500 disabled:bg-gray-400 gap-2",onClick:r,children:[(0,S.jsx)(C.Xm5,{className:"w-4 h-4"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"dEgA5A"})})]})]}):u?null:(0,S.jsxs)("button",{className:"inline-flex items-center px-4 py-2 border border-transparent text-base font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 gap-2",onClick:function(){v(""),g(null),Y()},children:[(0,S.jsx)(C.gbA,{className:"w-4 h-4"}),(0,S.jsx)("span",{children:b||h?T.ag._({id:"GyaNUA"}):T.ag._({id:"w80YWM"})})]})}),!u&&!l&&(0,S.jsxs)("div",{children:[(0,S.jsx)(A.cC,{id:"mp5yqd",components:{0:(0,S.jsx)("button",{className:"text-blue-500 cursor-pointer hover:underline disabled:no-underline disabled:cursor-default",onClick:function(){var e;return null===(e=D.current)||void 0===e?void 0:e.click()},disabled:l||u})}}),(0,S.jsx)("input",{ref:D,type:"file",accept:".flac,.mp3,.mp4,.mpeg,.mpga,.m4a,.ogg,.wav,.webm",className:"hidden",onChange:function(e){N("");try{var t=e.target.files[0];H(t,null,{preventAutoSend:!0})}catch(e){console.error(e),N(tt)}}})]})]})}var ta=(0,K.eK)("useTranscribeService"),ti=(0,K.eK)("useVoiceAutoSend"),to=(0,K.eK)("useAutoStartRecord"),tl=(0,K.eK)("useWhisperPrompt");function tc(e){var t,n,s=e.openAIAPIKey,r=e.onTextAvailable,a=e.onCancel,i=e.showRecord,o=e.showTitle,l=ta("browser"),c=(0,y.Z)(l,2),d=c[0],u=c[1],m=ti(!1),p=(0,y.Z)(m,2),h=p[0],g=p[1],f=to(!1),x=(0,y.Z)(f,2),b=x[0],v=x[1],w=_(),j=(0,q.useState)(!1),k=j[0],N=j[1],C=tl(""),I=(0,y.Z)(C,2),E=I[0],V=I[1];return(0,q.useEffect)(function(){var e,t;"whisper"===d&&null!==(e=w.serverHostConfig)&&void 0!==e&&e.managed&&!(0,O.N7)("useOpenAIWhisper",null===(t=w.serverHostConfig)||void 0===t?void 0:t.chatFeatures)&&u("browser")},[]),(0,S.jsxs)("div",{className:"space-y-4",children:[(0,S.jsxs)("div",{children:[void 0===o||o?(0,S.jsx)("div",{className:"text-xl font-bold text-center mb-2",children:(0,S.jsx)(A.cC,{id:"JGrfzE"})}):null,(0,S.jsx)("div",{className:"text-sm font-semibold my-2",children:(0,S.jsx)(A.cC,{id:"MbTAbA"})}),(0,S.jsxs)("select",{id:"model",className:"block w-full rounded-md border-0 py-1.5 pl-3 pr-10 text-gray-900 dark:text-white dark:bg-zinc-700 ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-blue-600 sm:text-sm sm:leading-6",value:d,onChange:function(e){return u(e.target.value)},children:[(0,S.jsx)("option",{value:"browser",children:(0,S.jsx)(A.cC,{id:"9kNmZU"})}),!(null!==(t=w.serverHostConfig)&&void 0!==t&&t.managed)||(0,O.N7)("useOpenAIWhisper",null===(n=w.serverHostConfig)||void 0===n?void 0:n.chatFeatures)?(0,S.jsx)("option",{value:"whisper",children:(0,S.jsx)(A.cC,{id:"I3d9HX"})}):null]})]}),"whisper"===d&&(0,S.jsx)("button",{className:"text-blue-500 ml-auto block",onClick:function(){return N(!k)},children:k?(0,S.jsx)(A.cC,{id:"9aHqty"}):(0,S.jsx)(A.cC,{id:"PUO6ed"})}),"whisper"===d&&k&&(0,S.jsxs)("div",{className:"space-y-2 pb-2",children:[(0,S.jsx)("label",{className:"font-semibold shrink-0",children:(0,S.jsx)(A.cC,{id:"gxYlbr"})}),(0,S.jsx)("input",{type:"text",placeholder:T.ag._({id:"ZMHXQC"}),className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm dark:bg-zinc-700",autoComplete:"off",value:E,onChange:function(e){return V(e.target.value)}}),(0,S.jsx)("p",{className:"text-xs text-gray-500",children:(0,S.jsx)(A.cC,{id:"+VVCL3",components:{0:(0,S.jsx)("a",{href:"https://platform.openai.com/docs/guides/speech-to-text/prompting",className:"text-blue-500 hover:underline",target:"_blank"})}})})]}),(0,S.jsxs)("div",{className:"my-4 flex items-start justify-center flex-col gap-2",children:[(0,S.jsx)(eJ,{enabled:b,setEnabled:v,label:T.ag._({id:"4ryaAZ"})}),(0,S.jsx)(eJ,{enabled:h,setEnabled:g,label:T.ag._({id:"bE4siw"})})]}),void 0===i||i?(0,S.jsx)(S.Fragment,{children:"whisper"===d?(0,S.jsx)(tr,{openAIAPIKey:s,onTextAvailable:r,startRecordOnMount:b,onCancel:a}):"browser"===d?(0,S.jsx)(e8,{onTextAvailable:r,startRecordOnMount:b,onCancel:a}):null}):null]})}var td=n(32832);function tu(e){var t=e.name,n=e.betaOnly;return(0,S.jsxs)("div",{className:"font-semibold text-red-500 rounded-md py-2 px-4 text-xs border border-red-500",children:[(0,S.jsx)(A.cC,{id:"Dyot+U",values:{0:t||T.ag._({id:"FHVG+T"}),1:void 0!==n&&n?T.ag._({id:"AeMmrL"}):""}}),"."," ",(0,S.jsx)("button",{onClick:function(){return document.getElementById("nav-buy-button").click()},className:"underline",children:(0,S.jsx)(A.cC,{id:"HPC6Gz"})}),"."]})}var tm=new(n(40272)).Z({concurrency:1}),tp={id:"fWsBTs"};function th(e){var t,n,s=e.onCancelled,r=e.fetchAudio,a=e.allowDownload,i=void 0===a||a,o=(0,q.useState)(!1),l=o[0],c=o[1],d=(0,q.useState)(null),u=d[0],m=d[1],p=(0,A.mV)().i18n,h=(0,q.useState)(!1),g=h[0],f=h[1],b=(0,q.useRef)(null),v=(0,q.useRef)(null);(0,q.useEffect)(function(){y()},[]);var y=(t=(0,x.Z)(j().mark(function e(){return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:var t;c(!0),v.current=!1,t=function(){if(!v.current)return c(!1),k()},tm.add(t,void 0);case 3:case"end":return e.stop()}},e)})),function(){return t.apply(this,arguments)}),w=(n=(0,x.Z)(j().mark(function e(){var t,n,s,a;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i){e.next=2;break}return e.abrupt("return");case 2:return e.prev=2,f(!0),e.next=6,r();case 6:return t=e.sent,e.next=9,t.blob();case 9:n=e.sent,s=window.URL.createObjectURL(n),(a=document.createElement("a")).setAttribute("href",s),a.setAttribute("download","audio-".concat(Date.now(),".mp3")),document.body.appendChild(a),a.click(),a.remove(),e.next=22;break;case 19:e.prev=19,e.t0=e.catch(2),console.error(e.t0);case 22:f(!1);case 23:case"end":return e.stop()}},e,null,[[2,19]])})),function(){return n.apply(this,arguments)}),k=function(){var e;return new Promise((e=(0,x.Z)(j().mark(function e(t,n){var s,a,i,o,l,c,d,u;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,r();case 3:if((s=e.sent).ok){e.next=21;break}if(!s.errorMessage){e.next=9;break}m(s.errorMessage),e.next=19;break;case 9:return e.prev=9,e.next=12,s.json();case 12:i=e.sent,m(p._({id:"FzlEPS"})+" "+((null==i?void 0:i.userMessage)||(null==i||null===(a=i.detail)||void 0===a?void 0:a.message)||JSON.stringify(i))),e.next=19;break;case 16:e.prev=16,e.t0=e.catch(9),m(p._(tp));case 19:return t(),e.abrupt("return");case 21:if(o="audio/mpeg",!(window.MediaSource&&MediaSource.isTypeSupported(o))){e.next=33;break}return l=s.body.getReader(),c=new MediaSource,b.current.src=URL.createObjectURL(c),b.current.addEventListener("ended",function(){t()}),b.current.addEventListener("pause",function(){t()}),c.addEventListener("sourceopen",function(){var e=c.addSourceBuffer(o);(function(){var t=(0,x.Z)(j().mark(function t(){var s,r,a;return j().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,l.read();case 3:if(r=(s=t.sent).done,a=s.value,!r){t.next=9;break}return c.endOfStream(),t.abrupt("return");case 9:e.appendBuffer(a),e.addEventListener("updateend",n,{once:!0}),t.next=17;break;case 13:t.prev=13,t.t0=t.catch(0),m(p._(tp)+" "+t.t0.message),console.error("Error reading from stream:",t.t0);case 17:case"end":return t.stop()}},t,null,[[0,13]])}));function n(){return t.apply(this,arguments)}return n})()()}),e.next=31,b.current.play();case 31:case 43:e.next=53;break;case 33:return e.prev=33,e.next=36,s.blob();case 36:return d=e.sent,u=URL.createObjectURL(d),b.current.addEventListener("ended",function(){t()}),b.current.addEventListener("pause",function(){t()}),b.current.src=u,e.next=43,b.current.play();case 45:if(e.prev=45,e.t1=e.catch(33),!(e.t1 instanceof DOMException&&"NotAllowedError"===e.t1.name)){e.next=51;break}return m(p._({id:"UrPLkb"})),t(),e.abrupt("return");case 51:m(p._(tp)+" "+e.t1.message),t();case 53:e.next=59;break;case 55:e.prev=55,e.t2=e.catch(0),console.error(e.t2),t();case 59:case"end":return e.stop()}},e,null,[[0,55],[9,16],[33,45]])})),function(t,n){return e.apply(this,arguments)}))};return l?(0,S.jsxs)("div",{className:"text-xs font-semibold text-gray-500 flex items-center justify-center gap-2 p-2",children:[(0,S.jsx)(E,{}),(0,S.jsx)("div",{children:(0,S.jsx)(A.cC,{id:"kWu0yk"})}),(0,S.jsx)("button",{onClick:s,className:"text-red-500 hover:underline",children:(0,S.jsx)(A.cC,{id:"dEgA5A"})})]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("audio",{ref:b,preload:"none",controls:!0}),i?g?(0,S.jsx)(E,{}):(0,S.jsx)("button",{onClick:w,children:(0,S.jsx)(C.aBF,{className:"w-4 h-4"})}):null,u?(0,S.jsx)("div",{className:"text-xs font-semibold text-red-500",children:u}):null]})}var tg=(0,K.eK)("useElevenStability"),tf=(0,K.eK)("useElevenClarity"),tx=(0,K.eK)("useElevenVoice"),tb=(0,K.eK)("useElevenAPIKey"),tv=(0,K.eK)("useElevenModelID");function ty(e){var t=e.content,n=e.onCancelled,s=e.speechSettings,r=e.orgElevenLabsAPIKey,a=tg(.75),i=(0,y.Z)(a,2),o=i[0];i[1];var l=tf(.75),c=(0,y.Z)(l,2),d=c[0];c[1];var u=tx("EXAVITQu4vr4xnSDxMaL"),m=(0,y.Z)(u,2),p=m[0];m[1];var h=tv("eleven_monolingual_v1"),g=(0,y.Z)(h,1)[0],f=tb(""),x=(0,y.Z)(f,2),b=x[0];x[1];var v=_(),w=v.serverHostConfig.chatFeatures;return(0,S.jsx)(th,{onCancelled:n,fetchAudio:function(){var e,n,a,i,l,c=null!==(e=null==s?void 0:s.elevenVoice)&&void 0!==e?e:p;return fetch(null!==(n=v.serverHostConfig)&&void 0!==n&&n.hasElevenLabsAPIKey&&!r?"/api/hosted/voice/elevenlabs?voiceID=".concat(c,"&stream=true"):"https://api.elevenlabs.io/v1/text-to-speech/".concat(c,"/stream"),{headers:{"Content-Type":"application/json","xi-api-key":r||b},method:"POST",body:JSON.stringify({text:t,model_id:null!==(a=null==s?void 0:s.elevenModelID)&&void 0!==a?a:g,voice_settings:{stability:Number(null!==(i=null==s?void 0:s.elevenStability)&&void 0!==i?i:o),similarity_boost:Number(null!==(l=null==s?void 0:s.elevenClarity)&&void 0!==l?l:d)}})})},allowDownload:(0,O.N7)("downloadTextToSpeech",w)})}var tw=(0,K.eK)("useBrowserVoice"),tj=(0,K.eK)("useBrowserVoiceRate"),tA=(0,K.eK)("useBrowserVoicePitch");function tk(e){var t,n=e.content,s=e.onStopped,r=e.speechSettings,a=tw(),i=(0,y.Z)(a,2),o=i[0];i[1];var l=tj(1),c=(0,y.Z)(l,2),d=c[0];c[1];var u=tA(1),m=(0,y.Z)(u,2),p=m[0];m[1];var h=(0,q.useState)({paused:!1,pending:!1,speaking:!1}),g=h[0],f=h[1],b=(0,q.useRef)(null),v=(0,q.useRef)(null);(0,q.useEffect)(function(){w()},[]),(0,q.useEffect)(function(){return k(),b.current=setInterval(function(){window.speechSynthesis.speaking||s(),k()},500),function(){clearInterval(b.current),window.speechSynthesis.cancel()}},[]);var w=(t=(0,x.Z)(j().mark(function e(){return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.abrupt("return",new Promise(function(e,t){v.current=new window.SpeechSynthesisUtterance,v.current.text=n;var s,a,i=null!==(s=null==r?void 0:r.browserVoiceRate)&&void 0!==s?s:d,l=null!==(a=null==r?void 0:r.browserVoicePitch)&&void 0!==a?a:p;v.current.volume=1,v.current.rate=i<.1?.1:i,v.current.pitch=l<.1?.1:l,v.current.voice=window.speechSynthesis.getVoices().filter(function(e){var t;return e.voiceURI===(null!==(t=null==r?void 0:r.browserVoice)&&void 0!==t?t:o)})[0],v.current.addEventListener("end",function(t){e()}),window.speechSynthesis.cancel(),window.speechSynthesis.speak(v.current)}));case 4:e.prev=4,e.t0=e.catch(0),console.error(e.t0);case 7:case"end":return e.stop()}},e,null,[[0,4]])})),function(){return t.apply(this,arguments)}),k=function(){f({paused:window.speechSynthesis.paused,pending:window.speechSynthesis.pending,speaking:window.speechSynthesis.speaking})};return(0,S.jsxs)("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:[g.speaking&&!g.paused&&(0,S.jsxs)("button",{onClick:function(){window.speechSynthesis.pause(),k()},type:"submit",className:"px-4 py-2 rounded-full border border-gray-200 shadow-sm text-sm font-semibold text-gray-500 flex items-center justify-center gap-2 hover:text-black hover:shadow-md transition-all dark:bg-zinc-800 dark:border-zinc-600 dark:hover:text-white bg-white",children:[(0,S.jsx)(C.Wh,{className:"w-4 h-4"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"IgrLD/"})})]}),g.paused&&(0,S.jsxs)("button",{onClick:function(){window.speechSynthesis.resume(),k()},type:"submit",className:"px-4 py-2 rounded-full border border-gray-200 shadow-sm text-sm font-semibold text-gray-500 flex items-center justify-center gap-2 hover:text-black hover:shadow-md transition-all dark:bg-zinc-800 dark:border-zinc-600 dark:hover:text-white bg-white",children:[(0,S.jsx)(C.gmG,{className:"w-4 h-4"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"v39wLo"})})]}),g.speaking&&(0,S.jsxs)("button",{onClick:function(){window.speechSynthesis.cancel(),k()},type:"submit",className:"px-4 py-2 rounded-full border border-gray-200 shadow-sm text-sm font-semibold text-gray-500 flex items-center justify-center gap-2 hover:text-black hover:shadow-md transition-all dark:bg-zinc-800 dark:border-zinc-600 dark:hover:text-white bg-white",children:[(0,S.jsx)(C.JuG,{className:"w-4 h-4"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"ygCKqB"})})]})]})}var tN=(0,K.eK)("useOpenAISpeechVoice"),tC=(0,K.eK)("useOpenAISpeechModel"),tq=(0,K.eK)("useOpenAISpeechSpeed");function tI(e){var t=e.content,n=e.onCancelled,s=e.speechSettings,r=e.orgOpenAIAPIKey,a=tN(O.ZD[0]),i=(0,y.Z)(a,2),o=i[0];i[1];var l=tC("tts-1"),c=(0,y.Z)(l,2),d=c[0];c[1];var u=tq(1),m=(0,y.Z)(u,2),p=m[0];m[1];var h=_(),g=h.serverHostConfig.chatFeatures,f=null==h?void 0:h.decryptedApiKey;return(0,S.jsx)(th,{onCancelled:n,fetchAudio:function(){var e,n,a,i,l,c,u,m={model:null!==(e=null==s?void 0:s.openAISpeechModel)&&void 0!==e?e:d,input:t,voice:null!==(n=null==s?void 0:s.openAISpeechVoice)&&void 0!==n?n:o,speed:Number(null!==(a=null==s?void 0:s.openAISpeechSpeed)&&void 0!==a?a:p)};return null!==(i=h.serverHostConfig)&&void 0!==i&&i.managed&&null!==(l=h.serverHostConfig)&&void 0!==l&&l.hasOpenAIAPIKey&&(0,O.N7)("useOpenAITextToSpeech",null===(c=h.serverHostConfig)||void 0===c?void 0:c.chatFeatures)&&!(null!==(u=h.serverHostConfig)&&void 0!==u&&u.requireLicenseKey)?fetch("/api/hosted/voice/openai",{method:"POST",body:JSON.stringify(m)}):f||r?fetch("https://api.openai.com/v1/audio/speech",{method:"POST",headers:{Authorization:"Bearer ".concat(r||f),"Content-Type":"application/json"},body:JSON.stringify(m)}):{errorMessage:T.ag._({id:"BLqwK7"})}},allowDownload:(0,O.N7)("downloadTextToSpeech",g)})}var tS=function(e){if("string"!=typeof e)return e;var t=e.replace(/^#+\s(.*)/gm,"$1");return(t=(t=(t=(t=(t=(t=(t=(t=t.replace(/\*\*(.*)\*\*/g,"$1")).replace(/__(.*)__/g,"$1")).replace(/\*(.*?)\*/g,"$1")).replace(/_(.*?)_/g,"$1")).replace(/~~(.*?)~~/g,"$1")).replace(/^[ \t]*>+(\s>+)*\s?/gm,"")).replace(/^[ \t]*[*\-+]\s+/gm,"")).replace(/^[ \t]*(\d+)\.\s+/gm,"$1 ")).replace(/`(.+?)`/g,"$1")},tE=(0,K.eK)("useSpeechSource"),tO=(0,K.eK)("useElevenAPIKey"),tV=(0,K.eK)("useOpenAISpeechVoice"),tP=(0,K.eK)("useOpenAISpeechModel"),tT=(0,K.eK)("useOpenAISpeechSpeed"),tM=(0,K.eK)("useElevenStability"),tD=(0,K.eK)("useElevenClarity"),tB=(0,K.eK)("useElevenVoice"),tL=(0,K.eK)("useElevenModelID"),tR=(0,q.forwardRef)(function(e,t){var n,s,r=e.content,a=e.onSettingClick,i=e.playOnMount,o=e.speechSettings,l=e.orgElevenLabsAPIKey,c=e.orgOpenAIAPIKey,d=(0,q.useMemo)(function(){return tS(r)},[r]),u=tE("disabled"),m=(0,y.Z)(u,2),p=m[0];m[1];var h=(0,q.useState)(!1),g=h[0],f=h[1],b=(0,q.useState)(null),v=b[0],w=b[1],k=tO(""),N=(0,y.Z)(k,1)[0],I=tM(),E=(0,y.Z)(I,1)[0],O=tD(),V=(0,y.Z)(O,1)[0],P=tB(),M=(0,y.Z)(P,1)[0],D=tL(),B=(0,y.Z)(D,1)[0],L=tV(),R=(0,y.Z)(L,1)[0],Z=tP(),K=(0,y.Z)(Z,1)[0],G=tT(),F=(0,y.Z)(G,1)[0],Y=_(),U=null!==(s=null==o?void 0:o.speechSource)&&void 0!==s?s:p;(0,q.useEffect)(function(){i&&!g&&H(),"browser"===U&&window.speechSynthesis&&window.speechSynthesis.getVoices()},[]),(0,q.useEffect)(function(){f(!1)},[U,R,K,F,M,E,V,B,o]);var H=(n=(0,x.Z)(j().mark(function e(){var t;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(w(null),Y.userCanUse("textToSpeech")){e.next=4;break}return w((0,S.jsx)(tu,{name:"Text-to-Speech"})),e.abrupt("return");case 4:if(!(!U||"disabled"===U)){e.next=7;break}return a&&a(),e.abrupt("return");case 7:if(!("browser"===U&&!window.speechSynthesis)){e.next=10;break}return w(T.ag._({id:"Wzyks2"})),e.abrupt("return");case 10:if(!("elevenlabs"===U&&!N&&!(null!==(t=Y.serverHostConfig)&&void 0!==t&&t.hasElevenLabsAPIKey)&&!l)){e.next=13;break}return o?w(T.ag._({id:"u2ugP9"})):a&&a(),e.abrupt("return");case 13:f(!0);case 14:case"end":return e.stop()}},e)})),function(){return n.apply(this,arguments)});return(0,q.useImperativeHandle)(t,function(){return{play:H}}),(0,S.jsxs)("div",{className:" flex items-center justify-center sm:justify-start gap-2 flex-wrap w-full group",children:[g?null:(0,S.jsxs)("button",{"data-element-id":"in-message-play-button",onClick:H,type:"submit",className:"tts-play-button px-4 py-2 rounded-full border border-gray-200 shadow-sm text-sm font-semibold text-gray-500 flex items-center justify-center gap-2 hover:text-black hover:shadow-md transition-all dark:bg-zinc-800 dark:border-zinc-600 dark:hover:text-white bg-white",children:[(0,S.jsx)(C.gmG,{className:"w-4 h-4"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"T91vKp"})})]}),"browser"===U?g?(0,S.jsx)(tk,{content:d,onStopped:function(){f(!1)},playOnMount:!0,speechSettings:o}):null:"openai-text-to-speech"===U?g?(0,S.jsx)(tI,{content:d,onStopped:function(){f(!1)},speechSettings:o,orgOpenAIAPIKey:c}):null:g?(0,S.jsx)(ty,{content:d,onCancelled:function(){f(!1)},speechSettings:o,orgElevenLabsAPIKey:l}):null,v?(0,S.jsx)("div",{className:"text-red-500",children:v}):null,a?(0,S.jsx)("button",{onClick:a,className:"group-hover:inline-block sm:hidden font-semibold text-gray-500 hover:underline",children:(0,S.jsx)(A.cC,{id:"Tz0i8g"})}):null]})}),t_=(0,K.eK)("useBrowserVoice"),tZ=(0,K.eK)("useBrowserVoiceRate"),tK=(0,K.eK)("useBrowserVoicePitch");function tG(e){var t,n,s,r,a,i=e.speechSettings,o=e.handleChangeSpeechSetting,l=(0,q.useState)(!1),c=l[0],d=l[1],u=(0,q.useState)([]),m=u[0],p=u[1],h=t_(),g=(0,y.Z)(h,2),f=g[0],x=g[1],b=tZ(1),v=(0,y.Z)(b,2),w=v[0],j=v[1],k=tK(1),N=(0,y.Z)(k,2),C=N[0],I=N[1];(0,q.useEffect)(function(){if("speechSynthesis"in window)return d(!0),E(),window.speechSynthesis&&window.speechSynthesis.addEventListener&&window.speechSynthesis.addEventListener("voiceschanged",E),function(){window.speechSynthesis&&window.speechSynthesis.removeEventListener&&window.speechSynthesis.removeEventListener("voiceschanged",E)}},[]);var E=function(){p(speechSynthesis.getVoices().map(function(e){return{voiceURI:e.voiceURI,name:e.name,lang:e.lang}}))};return c?(0,S.jsxs)("div",{className:"space-y-4",children:[(0,S.jsxs)("div",{className:"space-y-2",children:[(0,S.jsxs)("div",{className:" flex items-center justify-center gap-2",children:[(0,S.jsx)("label",{className:"font-semibold shrink-0",children:(0,S.jsx)(A.cC,{id:"cKuv8v"})}),(0,S.jsx)("select",{id:"model",className:"block w-full rounded-md border-0 py-1.5 pl-3 pr-10 text-gray-900 dark:text-white dark:bg-zinc-700 ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-blue-600 sm:text-sm sm:leading-6",value:null!==(t=null==i?void 0:i.browserVoice)&&void 0!==t?t:f,onChange:function(e){return o?o({browserVoice:e.target.value}):x(e.target.value)},children:m.map(function(e){return(0,S.jsxs)("option",{value:e.voiceURI,children:[e.name," (",e.lang,")"]},e.voiceURI)})})]}),(0,S.jsx)("div",{className:"text-xs",children:(0,S.jsx)(A.cC,{id:"CvvaRA"})})]}),(0,S.jsxs)("div",{className:"space-y-2",children:[(0,S.jsxs)("label",{className:"font-semibold shrink-0 flex items-center justify-between gap-2",children:[(0,S.jsx)("div",{children:(0,S.jsx)(A.cC,{id:"TAocpQ",values:{0:null!==(n=null==i?void 0:i.browserVoiceRate)&&void 0!==n?n:w}})}),(0,S.jsx)("button",{onClick:function(){return o?o({browserVoiceRate:1}):j(1)},className:"text-blue-500 hover:underline",children:(0,S.jsx)(A.cC,{id:"qRsPIT"})})]}),(0,S.jsxs)("div",{className:"w-full",children:[(0,S.jsx)("input",{type:"range",className:"transparent h-1.5 w-full cursor-pointer appearance-none rounded-lg border-transparent bg-neutral-200",min:0,max:2,step:.1,value:null!==(s=null==i?void 0:i.browserVoiceRate)&&void 0!==s?s:w,onChange:function(e){return o?o({browserVoiceRate:e.target.value}):j(e.target.value)}}),(0,S.jsxs)("div",{className:"text-gray-500 text-xs flex items-center justify-between",children:[(0,S.jsx)("div",{children:(0,S.jsx)(A.cC,{id:"w625t8"})}),(0,S.jsx)("div",{children:(0,S.jsx)(A.cC,{id:"qmIOJX"})})]})]})]}),(0,S.jsxs)("div",{className:"space-y-2",children:[(0,S.jsxs)("label",{className:"font-semibold shrink-0 flex items-center justify-between gap-2",children:[(0,S.jsx)(A.cC,{id:"PBh8Vb",values:{0:null!==(r=null==i?void 0:i.browserVoicePitch)&&void 0!==r?r:C}}),(0,S.jsx)("button",{onClick:function(){return o?o({browserVoicePitch:1}):I(1)},className:"text-blue-500 hover:underline",children:(0,S.jsx)(A.cC,{id:"qRsPIT"})})]}),(0,S.jsxs)("div",{className:"w-full",children:[(0,S.jsx)("input",{type:"range",className:"transparent h-1.5 w-full cursor-pointer appearance-none rounded-lg border-transparent bg-neutral-200",min:0,max:2,step:.1,value:null!==(a=null==i?void 0:i.browserVoicePitch)&&void 0!==a?a:C,onChange:function(e){return o?o({browserVoicePitch:e.target.value}):I(e.target.value)}}),(0,S.jsxs)("div",{className:"text-gray-500 text-xs flex items-center justify-between",children:[(0,S.jsx)("div",{children:(0,S.jsx)(A.cC,{id:"pdO539"})}),(0,S.jsx)("div",{children:(0,S.jsx)(A.cC,{id:"bgYTxy"})})]})]})]})]}):(0,S.jsx)("div",{className:"text-gray-500 p-4 text-center text-red-500",children:(0,S.jsx)(A.cC,{id:"Wzyks2"})})}var tF=n(96486),tY=n.n(tF),tU=(0,K.eK)("useOpenAISpeechVoice"),tH=(0,K.eK)("useOpenAISpeechModel"),tz=(0,K.eK)("useOpenAISpeechSpeed");function tW(e){var t,n,s,r,a=e.showAdvanced,i=e.setShowAdvanced,o=e.speechSettings,l=e.handleChangeSpeechSetting,c=tU(),d=(0,y.Z)(c,2),u=d[0],m=d[1],p=tH(),h=(0,y.Z)(p,2),g=h[0],f=h[1],x=tz(1),b=(0,y.Z)(x,2),v=b[0],w=b[1];return(0,S.jsxs)("div",{className:"space-y-4",children:[(0,S.jsxs)("div",{className:" flex items-center justify-center gap-2",children:[(0,S.jsx)("label",{className:"font-semibold shrink-0",children:(0,S.jsx)(A.cC,{id:"cKuv8v"})}),(0,S.jsx)("select",{id:"model",className:"block w-full rounded-md border-0 py-1.5 pl-3 pr-10 text-gray-900 dark:text-white dark:bg-zinc-700 ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-blue-600 sm:text-sm sm:leading-6",value:null!==(t=null==o?void 0:o.openAISpeechVoice)&&void 0!==t?t:u,onChange:function(e){return l?l({openAISpeechVoice:e.target.value}):m(e.target.value)},children:O.ZD.map(function(e){return(0,S.jsx)("option",{value:e,className:"capitalize",children:(0,tF.capitalize)(e)},e)})}),a?(0,S.jsx)("button",{className:"text-blue-500 flex-shrink-0",onClick:function(){return i(!1)},children:(0,S.jsx)(A.cC,{id:"A+GCyx"})}):(0,S.jsx)("button",{className:"text-blue-500 flex-shrink-0",onClick:function(){return i(!0)},children:(0,S.jsx)(A.cC,{id:"NFIOKv"})})]}),a?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)("div",{className:"space-y-2",children:[(0,S.jsx)("label",{className:"font-semibold shrink-0",children:(0,S.jsx)(A.cC,{id:"hDkkvu"})}),(0,S.jsxs)("select",{id:"model",className:"block w-full rounded-md border-0 py-1.5 pl-3 pr-10 text-gray-900 dark:text-white dark:bg-zinc-700 ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-blue-600 sm:text-sm sm:leading-6",value:null!==(n=null==o?void 0:o.openAISpeechModel)&&void 0!==n?n:g,onChange:function(e){return l?l({openAISpeechModel:e.target.value}):f(e.target.value)},children:[(0,S.jsx)("option",{value:"tts-1",children:"TTS"}),(0,S.jsx)("option",{value:"tts-1-hd",children:"TTS HD "})]})]}),(0,S.jsxs)("div",{className:"space-y-2",children:[(0,S.jsxs)("label",{className:"font-semibold shrink-0 flex items-center justify-between gap-2",children:[(0,S.jsx)("div",{children:(0,S.jsx)(A.cC,{id:"UHgcpG",values:{0:null!==(s=null==o?void 0:o.openAISpeechSpeed)&&void 0!==s?s:v}})}),(0,S.jsx)("button",{onClick:function(){return l?l({openAISpeechSpeed:1}):w(1)},className:"text-blue-500 hover:underline",children:(0,S.jsx)(A.cC,{id:"qRsPIT"})})]}),(0,S.jsxs)("div",{className:"w-full",children:[(0,S.jsx)("input",{type:"range",className:"transparent h-1.5 w-full cursor-pointer appearance-none rounded-lg border-transparent bg-neutral-200",min:.25,max:4,step:.05,value:null!==(r=null==o?void 0:o.openAISpeechSpeed)&&void 0!==r?r:v,onChange:function(e){return l?l({openAISpeechSpeed:e.target.value}):w(e.target.value)}}),(0,S.jsxs)("div",{className:"text-gray-500 text-xs flex items-center justify-between",children:[(0,S.jsx)("div",{children:(0,S.jsx)(A.cC,{id:"w625t8"})}),(0,S.jsx)("div",{children:(0,S.jsx)(A.cC,{id:"qmIOJX"})})]})]})]})]}):null]})}var tQ=JSON.parse('{"b":[{"voice_id":"21m00Tcm4TlvDq8ikWAM","name":"Rachel","samples":null,"category":"premade","fine_tuning":{"model_id":null,"is_allowed_to_fine_tune":false,"fine_tuning_requested":false,"finetuning_state":"not_started","verification_attempts":null,"verification_failures":[],"verification_attempts_count":0,"slice_ids":null},"labels":{},"description":null,"preview_url":"https://storage.googleapis.com/eleven-public-prod/premade/voices/21m00Tcm4TlvDq8ikWAM/6edb9076-c3e4-420c-b6ab-11d43fe341c8.mp3","available_for_tiers":[],"settings":null},{"voice_id":"AZnzlk1XvdvUeBnXmlld","name":"Domi","samples":null,"category":"premade","fine_tuning":{"model_id":null,"is_allowed_to_fine_tune":false,"fine_tuning_requested":false,"finetuning_state":"not_started","verification_attempts":null,"verification_failures":[],"verification_attempts_count":0,"slice_ids":null},"labels":{},"description":null,"preview_url":"https://storage.googleapis.com/eleven-public-prod/premade/voices/AZnzlk1XvdvUeBnXmlld/69c5373f-0dc2-4efd-9232-a0140182c0a9.mp3","available_for_tiers":[],"settings":null},{"voice_id":"EXAVITQu4vr4xnSDxMaL","name":"Sarah","samples":null,"category":"premade","fine_tuning":{"model_id":null,"is_allowed_to_fine_tune":false,"fine_tuning_requested":false,"finetuning_state":"not_started","verification_attempts":null,"verification_failures":[],"verification_attempts_count":0,"slice_ids":null},"labels":{},"description":null,"preview_url":"https://storage.googleapis.com/eleven-public-prod/premade/voices/EXAVITQu4vr4xnSDxMaL/04365bce-98cc-4e99-9f10-56b60680cda9.mp3","available_for_tiers":[],"settings":null},{"voice_id":"ErXwobaYiN019PkySvjV","name":"Antoni","samples":null,"category":"premade","fine_tuning":{"model_id":null,"is_allowed_to_fine_tune":false,"fine_tuning_requested":false,"finetuning_state":"not_started","verification_attempts":null,"verification_failures":[],"verification_attempts_count":0,"slice_ids":null},"labels":{},"description":null,"preview_url":"https://storage.googleapis.com/eleven-public-prod/premade/voices/ErXwobaYiN019PkySvjV/38d8f8f0-1122-4333-b323-0b87478d506a.mp3","available_for_tiers":[],"settings":null},{"voice_id":"MF3mGyEYCl7XYWbV9V6O","name":"Elli","samples":null,"category":"premade","fine_tuning":{"model_id":null,"is_allowed_to_fine_tune":false,"fine_tuning_requested":false,"finetuning_state":"not_started","verification_attempts":null,"verification_failures":[],"verification_attempts_count":0,"slice_ids":null},"labels":{},"description":null,"preview_url":"https://storage.googleapis.com/eleven-public-prod/premade/voices/MF3mGyEYCl7XYWbV9V6O/f9fd64c3-5d62-45cd-b0dc-ad722ee3284e.mp3","available_for_tiers":[],"settings":null},{"voice_id":"TxGEqnHWrfWFTfGW9XjX","name":"Josh","samples":null,"category":"premade","fine_tuning":{"model_id":null,"is_allowed_to_fine_tune":false,"fine_tuning_requested":false,"finetuning_state":"not_started","verification_attempts":null,"verification_failures":[],"verification_attempts_count":0,"slice_ids":null},"labels":{},"description":null,"preview_url":"https://storage.googleapis.com/eleven-public-prod/premade/voices/TxGEqnHWrfWFTfGW9XjX/c6c80dcd-5fe5-4a4c-a74c-b3fec4c62c67.mp3","available_for_tiers":[],"settings":null},{"voice_id":"VR6AewLTigWG4xSOukaG","name":"Arnold","samples":null,"category":"premade","fine_tuning":{"model_id":null,"is_allowed_to_fine_tune":false,"fine_tuning_requested":false,"finetuning_state":"not_started","verification_attempts":null,"verification_failures":[],"verification_attempts_count":0,"slice_ids":null},"labels":{},"description":null,"preview_url":"https://storage.googleapis.com/eleven-public-prod/premade/voices/VR6AewLTigWG4xSOukaG/66e83dc2-6543-4897-9283-e028ac5ae4aa.mp3","available_for_tiers":[],"settings":null},{"voice_id":"pNInz6obpgDQGcFmaJgB","name":"Adam","samples":null,"category":"premade","fine_tuning":{"model_id":null,"is_allowed_to_fine_tune":false,"fine_tuning_requested":false,"finetuning_state":"not_started","verification_attempts":null,"verification_failures":[],"verification_attempts_count":0,"slice_ids":null},"labels":{},"description":null,"preview_url":"https://storage.googleapis.com/eleven-public-prod/premade/voices/pNInz6obpgDQGcFmaJgB/e0b45450-78db-49b9-aaa4-d5358a6871bd.mp3","available_for_tiers":[],"settings":null},{"voice_id":"yoZ06aMxZJJ28mfd3POQ","name":"Sam","samples":null,"category":"premade","fine_tuning":{"model_id":null,"is_allowed_to_fine_tune":false,"fine_tuning_requested":false,"finetuning_state":"not_started","verification_attempts":null,"verification_failures":[],"verification_attempts_count":0,"slice_ids":null},"labels":{},"description":null,"preview_url":"https://storage.googleapis.com/eleven-public-prod/premade/voices/yoZ06aMxZJJ28mfd3POQ/1c4d417c-ba80-4de8-874a-a1c57987ea63.mp3","available_for_tiers":[],"settings":null}]}'),tJ=n(57632),tX={id:"fWsBTs"},t$=(0,K.eK)("useElevenStability"),t0=(0,K.eK)("useElevenClarity"),t1=(0,K.eK)("useElevenVoice"),t2=(0,K.eK)("useElevenAPIKey"),t4=(0,K.eK)("useElevenModelID"),t5=(0,K.eK)("useElevenCustomVoices");function t3(e){var t,n,s,r,a,i,o,l,c=e.showAdvanced,d=e.setShowAdvanced,u=e.speechSettings,m=e.handleChangeSpeechSetting,p=e.orgElevenLabsAPIKey,h=(0,A.mV)().i18n,g=(0,q.useState)(!1),f=g[0],b=g[1],w=(0,q.useState)(null),k=w[0],N=w[1],I=(0,q.useState)(null),E=I[0],O=I[1],V=t$(.75),P=(0,y.Z)(V,2),T=P[0],M=P[1],D=t0(.75),B=(0,y.Z)(D,2),L=B[0],R=B[1],Z=t1("EXAVITQu4vr4xnSDxMaL"),K=(0,y.Z)(Z,2),G=K[0],F=K[1],Y=t4("eleven_monolingual_v1"),U=(0,y.Z)(Y,2),H=U[0],z=U[1],W=t2(""),Q=(0,y.Z)(W,2),J=Q[0],X=Q[1],$=t5([]),ee=(0,y.Z)($,2),et=ee[0],en=ee[1],es=(0,q.useState)(tQ.b),er=es[0],ea=es[1],ei=eB(J,1e3),eo=_(),el=function(e){!u&&([].concat((0,v.Z)(e),(0,v.Z)(et)).map(function(e){return e.voice_id}).includes(G)||en(function(e){return[].concat((0,v.Z)(e),[{id:(0,tJ.Z)(),name:"",voice_id:G}])}))},ec=(t=(0,x.Z)(j().mark(function e(){var t,n,s,r;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!(!J&&!(null!==(t=eo.serverHostConfig)&&void 0!==t&&t.hasElevenLabsAPIKey)&&!p)){e.next=4;break}return ea(tQ.b),e.abrupt("return");case 4:return e.next=6,fetch(null!==(n=eo.serverHostConfig)&&void 0!==n&&n.hasElevenLabsAPIKey?"/api/hosted/voice/voices":"https://api.elevenlabs.io/v1/voices",{headers:{"Content-Type":"application/json","xi-api-key":p||J},method:"GET"});case 6:return s=e.sent,e.next=9,s.json();case 9:null!=(r=e.sent)&&r.voices?(ea(r.voices),el(r.voices)):ea(tQ.b),e.next=17;break;case 13:e.prev=13,e.t0=e.catch(0),ea(tQ.b),console.error(e.t0);case 17:case"end":return e.stop()}},e,null,[[0,13]])})),function(){return t.apply(this,arguments)});(0,q.useEffect)(function(){ec()},[ei]);var ed=(n=(0,x.Z)(j().mark(function e(){var t,n;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return b(!0),O(!1),N(""),e.prev=3,e.next=6,fetch("https://api.elevenlabs.io/v1/voices",{headers:{"Content-Type":"application/json","xi-api-key":J},method:"GET"});case 6:if(!((t=e.sent).status>=400)){e.next=14;break}return e.next=10,t.json();case 10:return N((n=e.sent).detail&&n.detail.message||h._(tX)),b(!1),e.abrupt("return");case 14:if(t.ok){e.next=18;break}return N(h._(tX)),b(!1),e.abrupt("return");case 18:O(!0),e.next=25;break;case 21:e.prev=21,e.t0=e.catch(3),N(h._(tX)),console.error(e.t0);case 25:b(!1);case 26:case"end":return e.stop()}},e,null,[[3,21]])})),function(){return n.apply(this,arguments)});return(0,S.jsxs)("div",{className:"space-y-4",children:[J||null!==(s=eo.serverHostConfig)&&void 0!==s&&s.hasElevenLabsAPIKey||u?null:(0,S.jsx)("div",{className:"text-xs text-red-500",children:(0,S.jsx)(A.cC,{id:"jF//iB"})}),!(null!==(r=eo.serverHostConfig)&&void 0!==r&&r.hasElevenLabsAPIKey)&&!u&&(0,S.jsxs)("div",{className:"space-y-2",children:[(0,S.jsxs)("label",{className:"font-semibold shrink-0",children:[(0,S.jsx)("span",{className:J?"":"text-red-500",children:(0,S.jsx)(A.cC,{id:"gJaAE1"})}),": (",(0,S.jsx)("a",{href:"https://beta.elevenlabs.io/",target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:underline",children:(0,S.jsx)(A.cC,{id:"JhXfkQ"})}),")"]}),(0,S.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,S.jsx)("input",{type:"password",disabled:f,placeholder:"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm dark:bg-zinc-700",autoComplete:"off",value:J,onChange:function(e){return X(e.target.value)}}),(0,S.jsx)("button",{onClick:function(){return ed()},type:"submit",disabled:f,className:"inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 gap-2 flex-shrink-0",children:(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"hlKjs/"})})})]}),k?(0,S.jsx)("div",{className:"text-red-500 text-sm",children:k}):null,E?(0,S.jsx)("div",{className:"text-green-500 text-sm",children:(0,S.jsx)(A.cC,{id:"eDPfNj"})}):null,(0,S.jsx)("div",{className:"text-xs text-gray-500 my-4",children:(0,S.jsx)(A.cC,{id:"UIpYys"})})]}),(0,S.jsxs)("div",{className:" flex items-center justify-center gap-2",children:[(0,S.jsx)("label",{className:"font-semibold shrink-0",children:(0,S.jsx)(A.cC,{id:"cKuv8v"})}),(0,S.jsx)("select",{id:"model",className:"block w-full rounded-md border-0 py-1.5 pl-3 pr-10 text-gray-900 dark:text-white dark:bg-zinc-700 ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-blue-600 sm:text-sm sm:leading-6",value:null!==(a=null==u?void 0:u.elevenVoice)&&void 0!==a?a:G,onChange:function(e){return m?m({elevenVoice:e.target.value}):F(e.target.value)},children:(0,tF.uniqBy)([].concat((0,v.Z)(et),(0,v.Z)(er),[{voice_id:G}]),"voice_id").filter(function(e){return e.voice_id}).map(function(e){return(0,S.jsx)("option",{value:e.voice_id,children:e.name||h._({id:"8Tg/JR"})+" (".concat(e.voice_id,")")},e.voice_id)})}),c?(0,S.jsx)("button",{className:"text-blue-500 flex-shrink-0",onClick:function(){return d(!1)},children:(0,S.jsx)(A.cC,{id:"A+GCyx"})}):(0,S.jsx)("button",{className:"text-blue-500 flex-shrink-0",onClick:function(){return d(!0)},children:(0,S.jsx)(A.cC,{id:"NFIOKv"})})]}),c?(0,S.jsxs)(S.Fragment,{children:[!u&&(0,S.jsxs)("div",{className:"space-y-2",children:[(0,S.jsx)("label",{className:"font-semibold shrink-0",children:(0,S.jsx)(A.cC,{id:"/xJLUo"})}),et.map(function(e,t){return(0,S.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,S.jsx)("input",{type:"text",placeholder:h._({id:"6YtxFj"}),className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm dark:bg-zinc-700",autoComplete:"off",disabled:f,value:e.name,onChange:function(e){var n=(0,v.Z)(et);n[t].name=e.target.value,en(n)}}),(0,S.jsx)("input",{type:"text",placeholder:h._({id:"3BQnyB"}),className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm dark:bg-zinc-700",autoComplete:"off",disabled:f,value:e.voice_id,onChange:function(e){var n=(0,v.Z)(et);n[t].voice_id=e.target.value,en(n)}}),(0,S.jsx)(eS,{className:"text-red-500 font-semibold min-w-[55px]",onConfirmed:function(){var e,n=(0,v.Z)(et);n.splice(t,1),en(n),G===et[t].voice_id&&F(null===(e=er[0])||void 0===e?void 0:e.voice_id)},children:(0,S.jsx)(A.cC,{id:"t/YqKh"})})]},e.id)}),(0,S.jsx)("div",{className:"flex items-center justify-start gap-2 mt-2",children:(0,S.jsxs)("button",{onClick:function(){en(function(e){return[].concat((0,v.Z)(e),[{id:(0,tJ.Z)(),name:"",voice_id:""}])})},className:"flex items-center justify-start gap-2 text-blue-500 font-semibold hover:underline",children:[(0,S.jsx)(C.wEH,{className:"w-4 h-4"})," ",(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"JRnw1i"})})]})})]}),(0,S.jsxs)("div",{className:"space-y-2",children:[(0,S.jsx)("label",{className:"font-semibold shrink-0",children:(0,S.jsx)(A.cC,{id:"hDkkvu"})}),(0,S.jsxs)("select",{id:"model",className:"block w-full rounded-md border-0 py-1.5 pl-3 pr-10 text-gray-900 dark:text-white dark:bg-zinc-700 ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-blue-600 sm:text-sm sm:leading-6",value:null!==(i=null==u?void 0:u.elevenModelID)&&void 0!==i?i:H,onChange:function(e){return m?m({elevenModelID:e.target.value}):z(e.target.value)},children:[(0,S.jsx)("option",{value:"eleven_monolingual_v1",children:"Eleven English v1"}),(0,S.jsx)("option",{value:"eleven_multilingual_v1",children:"Eleven Multilingual v1"}),(0,S.jsx)("option",{value:"eleven_multilingual_v2",children:"Eleven Multilingual v2"})]})]}),(0,S.jsxs)("div",{className:"space-y-2",children:[(0,S.jsx)("label",{className:"font-semibold shrink-0",children:(0,S.jsx)(A.cC,{id:"CH0AaX"})}),(0,S.jsxs)("div",{className:"w-full",children:[(0,S.jsx)("input",{type:"range",className:"transparent h-1.5 w-full cursor-pointer appearance-none rounded-lg border-transparent bg-neutral-200",min:0,max:1,step:.05,value:null!==(o=null==u?void 0:u.elevenStability)&&void 0!==o?o:T,onChange:function(e){return m?m({elevenStability:e.target.value}):M(e.target.value)}}),(0,S.jsxs)("div",{className:"text-gray-500 text-xs flex items-center justify-between",children:[(0,S.jsx)("div",{children:(0,S.jsx)(A.cC,{id:"SjsPQu"})}),(0,S.jsx)("div",{children:(0,S.jsx)(A.cC,{id:"3xm05L"})})]})]}),(0,S.jsx)("div",{className:"text-gray-500 text-xs",children:(0,S.jsx)(A.cC,{id:"6sxUIo"})})]}),(0,S.jsxs)("div",{className:"space-y-2",children:[(0,S.jsx)("label",{className:"font-semibold shrink-0",children:(0,S.jsx)(A.cC,{id:"SqIaK+"})}),(0,S.jsxs)("div",{className:"w-full",children:[(0,S.jsx)("input",{type:"range",className:"transparent h-1.5 w-full cursor-pointer appearance-none rounded-lg border-transparent bg-neutral-200",min:0,max:1,step:.05,value:null!==(l=null==u?void 0:u.elevenClarity)&&void 0!==l?l:L,onChange:function(e){return m?m({elevenClarity:e.target.value}):R(e.target.value)}}),(0,S.jsxs)("div",{className:"text-gray-500 text-xs flex items-center justify-between",children:[(0,S.jsx)("div",{children:(0,S.jsx)(A.cC,{id:"nTWWCZ"})}),(0,S.jsx)("div",{children:(0,S.jsx)(A.cC,{id:"yx/fMc"})})]})]}),(0,S.jsx)("div",{className:"text-gray-500 text-xs",children:(0,S.jsx)(A.cC,{id:"1RkbIp"})})]})]}):null]})}var t6=(0,K.eK)("useSpeechSource"),t7=(0,K.eK)("useAutoSpeech"),t8=(0,K.eK)("useShowPlayButton");function t9(e){var t=e.showOpenAI,n=void 0===t||t,s=t6("disabled"),r=(0,y.Z)(s,2),a=r[0],i=r[1],o=(0,q.useState)(!1),l=o[0],c=o[1],d=(0,q.useState)(T.ag._({id:"u3pv+W"})),u=d[0],m=d[1],p=t8(!0),h=(0,y.Z)(p,2),g=h[0],f=h[1],x=t7(!1),b=(0,y.Z)(x,2),v=b[0],w=b[1];return(0,q.useEffect)(function(){"openai-text-to-speech"!==a||n||i("disabled")},[]),(0,S.jsxs)("div",{className:"space-y-4",children:[(0,S.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,S.jsx)("label",{className:"font-semibold shrink-0",children:(0,S.jsx)(A.cC,{id:"GPIMoy"})}),(0,S.jsxs)("select",{id:"model",className:"block w-full rounded-md border-0 py-1.5 pl-3 pr-10 text-gray-900 dark:text-white dark:bg-zinc-700 ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-blue-600 sm:text-sm sm:leading-6",value:a,onChange:function(e){return i(e.target.value)},children:[(0,S.jsx)("option",{value:"elevenlabs",children:(0,S.jsx)(A.cC,{id:"9r6uEg"})}),n?(0,S.jsx)("option",{value:"openai-text-to-speech",children:(0,S.jsx)(A.cC,{id:"lKxYcA"})}):null,(0,S.jsx)("option",{value:"browser",children:(0,S.jsx)(A.cC,{id:"ZtCLxJ"})}),(0,S.jsx)("option",{value:"disabled",children:(0,S.jsx)(A.cC,{id:"E/QGRL"})})]})]}),(0,S.jsx)("h3",{className:"text-lg font-semibold",children:(0,S.jsx)(A.cC,{id:"M7vN5/"})}),"elevenlabs"===a?(0,S.jsx)(t3,{showAdvanced:l,setShowAdvanced:c}):"openai-text-to-speech"===a?(0,S.jsx)(tW,{showAdvanced:l,setShowAdvanced:c}):"browser"===a?(0,S.jsx)(tG,{}):(0,S.jsx)("div",{className:"space-y-4",children:(0,S.jsx)("div",{className:"text-center text-gray-500 text-orange-500",children:(0,S.jsx)(A.cC,{id:"M+BBlf"})})}),"disabled"===a?null:(0,S.jsxs)("div",{className:"space-y-2",children:[(0,S.jsx)("label",{className:"font-semibold shrink-0",children:(0,S.jsx)(A.cC,{id:"oRX7OJ"})}),(0,S.jsx)("input",{type:"text",placeholder:T.ag._({id:"y8MW1k"}),className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm dark:bg-zinc-700",autoComplete:"off",value:u,onChange:function(e){return m(e.target.value)}}),(0,S.jsx)(tR,{content:u})]}),(0,S.jsx)(eJ,{label:T.ag._({id:"2xLA9y"}),enabled:g,setEnabled:f}),(0,S.jsx)(eJ,{label:T.ag._({id:"rXlXlr"}),enabled:v,setEnabled:w})]})}var ne=n(13083),nt=(0,K.eK)("useThemeMode"),nn=function(){var e=nt("system"),t=(0,y.Z)(e,2),n=t[0],s=t[1],r=(0,q.useState)(window.matchMedia("(prefers-color-scheme: dark)").matches),a=r[0],i=r[1];return(0,q.useEffect)(function(){if("system"===n)try{var e=function(e){i(e.matches)},t=window.matchMedia("(prefers-color-scheme: dark)");if(null!=t&&t.addEventListener)return t.addEventListener("change",e),function(){t.removeEventListener("change",e)};return t.addListener(e),function(){t.removeListener(e)}}catch(e){console.error("Error on listening dark mode change event",e),ne.Tb(e)}},[n]),{isDarkMode:"system"===n?a:"dark"===n,setThemeMode:s,themeMode:n}},ns=(0,K.eK)("useSidebarColorHue"),nr=(0,K.eK)("useCompactSidebarLine"),na=(0,K.eK)("useFontSize"),ni=(0,K.eK)("useSidebarWidth");function no(e){var t=e.showSidebarColor,n=e.onClickChangeSidebarColor,s=nn(),r=s.themeMode,a=s.setThemeMode,i=ns(O.V$),o=(0,y.Z)(i,2),l=o[0];o[1];var c=nr(!1),d=(0,y.Z)(c,2),u=d[0],m=d[1],p=na("small"),h=(0,y.Z)(p,2),g=h[0],f=h[1],x=ni(""),b=(0,y.Z)(x,2);return b[0],b[1],(0,S.jsx)("div",{children:(0,S.jsxs)("div",{className:"grid grid-cols-2 items-center justify-start gap-2",children:[(0,S.jsx)("div",{className:"text-sm font-semibold",children:(0,S.jsx)(A.cC,{id:"FEr96N"})}),(0,S.jsxs)("select",{className:"block w-fit rounded-md border-0 py-1.5 pl-3 pr-10 text-gray-900 dark:text-white dark:bg-zinc-700 ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-blue-600 sm:text-sm sm:leading-6",value:r,onChange:function(e){a(e.target.value)},children:[(0,S.jsx)("option",{value:"light",children:(0,S.jsx)(A.cC,{id:"1njn7W"})}),(0,S.jsx)("option",{value:"dark",children:(0,S.jsx)(A.cC,{id:"pvnfJD"})}),(0,S.jsx)("option",{value:"system",children:(0,S.jsx)(A.cC,{id:"D+NlUC"})})]}),void 0===t||t?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("div",{className:"text-sm font-semibold ",children:(0,S.jsx)(A.cC,{id:"ebEv56"})}),(0,S.jsx)("div",{children:(0,S.jsx)("button",{onClick:function(){n()},style:{backgroundColor:(0,O.dl)(l)},className:"w-20 h-8 block w-fit rounded-md border-0 py-1.5 pl-3 pr-10 text-gray-900 dark:text-white dark:bg-zinc-700 ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-blue-600 sm:text-sm sm:leading-6"})})]}):null,(0,S.jsx)("div",{className:"text-sm font-semibold ",children:(0,S.jsx)(A.cC,{id:"tbgdI4"})}),(0,S.jsxs)("select",{className:"block w-fit rounded-md border-0 py-1.5 pl-3 pr-10 text-gray-900 dark:text-white dark:bg-zinc-700 ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-blue-600 sm:text-sm sm:leading-6",value:u?"1":"",onChange:function(e){m("1"===e.target.value)},children:[(0,S.jsx)("option",{value:"",children:(0,S.jsx)(A.cC,{id:"ovBPCi"})}),(0,S.jsx)("option",{value:"1",children:(0,S.jsx)(A.cC,{id:"9S4Fiy"})})]}),(0,S.jsx)("div",{className:"text-sm font-semibold ",children:(0,S.jsx)(A.cC,{id:"cGeFup"})}),(0,S.jsxs)("select",{className:"block w-fit rounded-md border-0 py-1.5 pl-3 pr-10 text-gray-900 dark:text-white dark:bg-zinc-700 ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-blue-600 sm:text-sm sm:leading-6",value:g,onChange:function(e){f(e.target.value.toLowerCase())},children:[(0,S.jsx)("option",{value:"small",children:(0,S.jsx)(A.cC,{id:"4Revpc"})}),(0,S.jsx)("option",{value:"medium",children:(0,S.jsx)(A.cC,{id:"agPptk"})}),(0,S.jsx)("option",{value:"large",children:(0,S.jsx)(A.cC,{id:"k7rCa/"})}),(0,S.jsx)("option",{value:"extra",children:(0,S.jsx)(A.cC,{id:"vp6Yr4"})}),(0,S.jsx)("option",{value:"2extra",children:(0,S.jsx)(A.cC,{id:"tIa0nY"})})]})]})})}var nl=(0,K.eK)("useStreaming"),nc=(0,K.eK)("useAutomaticTitle"),nd=(0,K.eK)("useSuggestKeywords"),nu=(0,K.eK)("useSearchEngine"),nm=(0,K.eK)("useSoundMode"),np=(0,K.eK)("useReopenPreviousChat"),nh=(0,K.eK)("useAutoArchiveOldChats"),ng=(0,K.eK)("useAutoDeleteArchivedChats");function nf(e){var t=e.showSuggestKeywords,n=nl(!0),s=(0,y.Z)(n,2),r=s[0],a=s[1],i=nc(!0),o=(0,y.Z)(i,2),l=o[0],c=o[1],d=nd(!0),u=(0,y.Z)(d,2),m=u[0],p=u[1],h=nu("google"),g=(0,y.Z)(h,2),f=g[0],x=g[1],b=nm(!0),v=(0,y.Z)(b,2),w=v[0],j=v[1],k=np(!1),N=(0,y.Z)(k,2),C=N[0],I=N[1],E=nh(""),O=(0,y.Z)(E,2),V=O[0],P=O[1],M=ng(""),D=(0,y.Z)(M,2),B=D[0],L=D[1],R=(0,q.useMemo)(function(){return!["google","ddg","bing","brave"].includes(f)},[f]);return(0,S.jsx)("div",{children:(0,S.jsxs)("div",{className:"space-y-4",children:[(0,S.jsx)(eJ,{label:T.ag._({id:"3mDv0d"}),description:T.ag._({id:"bW1s55"}),enabled:r,setEnabled:function(e){a(e)}}),(0,S.jsx)(eJ,{label:T.ag._({id:"2Pa8mz"}),description:T.ag._({id:"BrM1bb"}),enabled:l,setEnabled:function(e){c(e)}}),(void 0===t||t)&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(eJ,{label:T.ag._({id:"ZK5+g/"}),description:T.ag._({id:"LqNfc3"}),enabled:m,setEnabled:function(e){p(e)}}),m?(0,S.jsx)("div",{className:"flex justify-center",children:(0,S.jsxs)("div",{className:"flex flex-col",children:[(0,S.jsxs)("div",{className:"grid grid-cols-2 items-center justify-center gap-2",children:[(0,S.jsx)("div",{className:"text-sm text-right",children:(0,S.jsx)(A.cC,{id:"xEEOHj"})}),(0,S.jsxs)("select",{className:"block w-full rounded-md border-0 py-1.5 pl-3 pr-10 text-gray-900 dark:text-white dark:bg-zinc-700 ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-blue-600 sm:text-sm sm:leading-6",value:R?"":f,onChange:function(e){x(e.target.value.toLowerCase())},children:[(0,S.jsx)("option",{value:"google",children:"Google"}),(0,S.jsx)("option",{value:"ddg",children:"DuckDuckGo"}),(0,S.jsx)("option",{value:"bing",children:"Bing"}),(0,S.jsx)("option",{value:"brave",children:"Brave"}),(0,S.jsx)("option",{value:"",children:"Kagi"})]})]}),R&&(0,S.jsxs)("div",{className:"mt-2 w-full",children:[(0,S.jsx)("div",{className:"text-sm",children:(0,S.jsx)(A.cC,{id:"aABkGI"})}),(0,S.jsx)("a",{href:"https://kagi.com/settings?p=user_details",target:"_blank",rel:"noopenner noreferer",className:"mt-1 text-blue-500 hover:underline text-xs",children:(0,S.jsx)(A.cC,{id:"zCNvh1"})}),(0,S.jsx)("input",{type:"text",className:"mt-2 block w-full rounded-md border-0 py-1.5 px-3 text-gray-900 dark:text-white dark:bg-zinc-700 ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-blue-600 sm:text-sm sm:leading-6",value:f,onChange:function(e){x(e.target.value.toLowerCase())}})]})]})}):null]}),(0,S.jsx)(eJ,{label:T.ag._({id:"Sb94+G"}),description:T.ag._({id:"47jGM/"}),enabled:w,setEnabled:function(e){j(e)}}),(0,S.jsx)(eJ,{label:T.ag._({id:"yjKqG9"}),description:T.ag._({id:"NL1iX0"}),enabled:C,setEnabled:function(e){I(e)}}),(0,S.jsx)(eJ,{label:T.ag._({id:"Tppod2"}),description:T.ag._({id:"4iqlgG"}),enabled:!!V,setEnabled:function(e){P(e?24:"")}}),V?(0,S.jsxs)("div",{className:"grid grid-cols-2 items-center justify-center gap-2",children:[(0,S.jsx)("div",{className:"text-sm text-right",children:(0,S.jsx)(A.cC,{id:"WAOQ5J"})}),(0,S.jsxs)("select",{className:"block w-fit rounded-md border-0 py-1.5 pl-3 pr-10 text-gray-900 dark:text-white dark:bg-zinc-700 ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-blue-600 sm:text-sm sm:leading-6",value:V,onChange:function(e){P(Number(e.target.value))},children:[(0,S.jsx)("option",{value:24,children:(0,S.jsx)(A.cC,{id:"VaA9mu"})}),(0,S.jsx)("option",{value:48,children:(0,S.jsx)(A.cC,{id:"UtXEjp"})}),(0,S.jsx)("option",{value:72,children:(0,S.jsx)(A.cC,{id:"7ZrpGs"})}),(0,S.jsx)("option",{value:168,children:(0,S.jsx)(A.cC,{id:"3vtzIH"})}),(0,S.jsx)("option",{value:336,children:(0,S.jsx)(A.cC,{id:"O2B4EJ"})}),(0,S.jsx)("option",{value:504,children:(0,S.jsx)(A.cC,{id:"B/1Qzd"})}),(0,S.jsx)("option",{value:720,children:(0,S.jsx)(A.cC,{id:"voMgY+"})}),(0,S.jsx)("option",{value:1440,children:(0,S.jsx)(A.cC,{id:"HCLj1r"})}),(0,S.jsx)("option",{value:2160,children:(0,S.jsx)(A.cC,{id:"x1VeBD"})})]})]}):null,(0,S.jsx)(eJ,{label:T.ag._({id:"+ZWSxY"}),description:T.ag._({id:"OSt5XJ"}),enabled:!!B,setEnabled:function(e){L(e?24:"")}}),B?(0,S.jsxs)("div",{className:"grid grid-cols-2 items-center justify-center gap-2",children:[(0,S.jsx)("div",{className:"text-sm text-right",children:(0,S.jsx)(A.cC,{id:"be4IUs"})}),(0,S.jsxs)("select",{className:"block w-fit rounded-md border-0 py-1.5 pl-3 pr-10 text-gray-900 dark:text-white dark:bg-zinc-700 ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-blue-600 sm:text-sm sm:leading-6",value:B,onChange:function(e){L(Number(e.target.value))},children:[(0,S.jsx)("option",{value:24,children:(0,S.jsx)(A.cC,{id:"VaA9mu"})}),(0,S.jsx)("option",{value:48,children:(0,S.jsx)(A.cC,{id:"UtXEjp"})}),(0,S.jsx)("option",{value:72,children:(0,S.jsx)(A.cC,{id:"7ZrpGs"})}),(0,S.jsx)("option",{value:168,children:(0,S.jsx)(A.cC,{id:"3vtzIH"})}),(0,S.jsx)("option",{value:336,children:(0,S.jsx)(A.cC,{id:"O2B4EJ"})}),(0,S.jsx)("option",{value:504,children:(0,S.jsx)(A.cC,{id:"B/1Qzd"})}),(0,S.jsx)("option",{value:720,children:(0,S.jsx)(A.cC,{id:"voMgY+"})}),(0,S.jsx)("option",{value:1440,children:(0,S.jsx)(A.cC,{id:"HCLj1r"})}),(0,S.jsx)("option",{value:2160,children:(0,S.jsx)(A.cC,{id:"x1VeBD"})})]})]}):null]})})}var nx=n(11259),nb=n(57161),nv=n(95346);function ny(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,s)}return n}function nw(e){for(var t=1;t0?"mt-4":""),children:e.label},e.label):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)("button",{className:(0,O.AK)("w-full p-2 rounded-md transition-colors hover:bg-gray-100 text-left cursor-default flex items-center justify-start gap-2 my-1 dark:text-gray-200 dark:hover:bg-gray-800",e.label===a.label?"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-200":"text-gray-800 ",l?"bg-gray-100 dark:bg-gray-800 dark:text-gray-200":""),onClick:function(){l?m(function(t){return nw(nw({},t),{},(0,b.Z)({},e.label,!t[e.label]))}):i(e)},children:[e.icon?(0,S.jsx)(e.icon,{className:"w-4 h-4"}):null,(0,S.jsx)("span",{children:e.label}),l?u[e.label]?(0,S.jsx)(nv.jX5,{className:"w-5 h-5 -ml-2"}):(0,S.jsx)(nv.h2L,{className:"w-5 h-5 -ml-2"}):null]},e.label),l&&u[e.label]?(0,S.jsx)("div",{className:"w-full p-2 mb-4",children:null===(n=e.renderSection)||void 0===n?void 0:n.call(e)}):null]})})}),l?null:(0,S.jsxs)("div",{className:"w-full",children:[(0,S.jsx)("h3",{className:"text-xl font-bold mb-2",children:null==a?void 0:a.label}),(0,S.jsx)("div",{children:null==a||null===(t=a.renderSection)||void 0===t?void 0:t.call(a)})]})]})}var nA=n(59557),nk=(0,K.eK)("useExtensionURLs");function nN(){var e=nk([]),t=(0,y.Z)(e,2),n=t[0],s=t[1],r=(0,q.useState)(""),a=r[0],i=r[1],o=(0,q.useState)(""),l=o[0],c=o[1],d=(0,q.useState)(!1),u=d[0],m=d[1],p=(0,q.useState)(!1),h=p[0],g=p[1];return(0,S.jsxs)("div",{className:"",children:[(0,S.jsxs)("div",{className:"text-xs",children:[(0,S.jsx)(A.cC,{id:"K8lalb"}),(0,S.jsx)("a",{href:"https://docs.typingmind.com/typing-mind-extensions",className:"text-blue-500 font-semibold text-blue-500 text-xs hover:underline ml-1",target:"_blank",rel:"noreferrer noopener",children:(0,S.jsx)(A.cC,{id:"8RknI/"})})]}),(0,S.jsx)("div",{className:"text-xs text-orange-500",children:(0,S.jsx)(A.cC,{id:"2T68PV"})}),(0,S.jsxs)("div",{className:"flex items-stretch justify-center gap-2 my-2",children:[(0,S.jsx)("input",{type:"text",value:a,onChange:function(e){return i(e.target.value)},placeholder:T.ag._({id:"rcyeIO"}),className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm dark:bg-zinc-700 disabled:text-gray-500 w-full"}),(0,S.jsxs)("button",{onClick:function(){var e;if(""===a.trim()){c(T.ag._({id:"9Rz3G/"}));return}if(n.includes(a)){c(T.ag._({id:"Mwh/zr"}));return}m(!0),(e=document.createElement("script")).setAttribute("type","text/javascript"),e.src=a,e.onload=function(){s([].concat((0,v.Z)(n),[a])),g(!0),i(""),m(!1),c(""),document.head.removeChild(e),e.onload=function(){}},e.onerror=function(t){console.error("Failed to load extension: ".concat(a)),c(T.ag._({id:"0aIV5B",values:{url:a}})),m(!1),document.head.removeChild(e),e.onerror=function(){}},document.head.appendChild(e)},className:"inline-flex items-center px-3 py-1.5 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 gap-2",disabled:u,children:[u?(0,S.jsx)(E,{}):null,(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"TKQ7K+"})})]})]}),h?(0,S.jsxs)("div",{className:"text-xs text-orange-500",children:[(0,S.jsx)(A.cC,{id:"ZbQrfp"})," ",(0,S.jsx)("button",{className:"text-blue-500 hover:underline font-semibold text-xs",onClick:function(){window.location.reload()},children:(0,S.jsx)(A.cC,{id:"u6QeR6"})})]}):null,l&&(0,S.jsx)("p",{className:"text-red-500 text-xs mt-2",children:l}),(0,S.jsx)("div",{className:"my-2",children:n.map(function(e,t){return(0,S.jsxs)("div",{className:"mt-1 w-full p-2 bg-gray-100 dark:bg-zinc-800 rounded-md flex items-center justify-center gap-2",children:[(0,S.jsx)("div",{className:"w-full break-all",children:e}),(0,S.jsx)(eS,{onConfirmed:function(){s(n.filter(function(t){return t!==e})),g(!0)},className:"text-red-500 font-semibold hover:underline",children:(0,S.jsx)(A.cC,{id:"fo0VXg"})})]},t)})})]})}function nC(){return(0,S.jsxs)("div",{children:[(0,S.jsx)("a",{href:"/test/simple-web-audio-recorder-demo-master/index.html",children:"Audio Recorder"}),(0,S.jsx)("button",{onClick:function(){throw Error("new crash test")},className:"inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 disabled:cursor-default transition-colors whitespace-nowrap space-x-1",children:"click to crash"}),(0,S.jsx)("div",{children:(0,S.jsx)(A.cC,{id:"V17zQG"})})]})}var nq=n(77191),nI=n(93422),nS=n(96554),nE=n(54497),nO={id:"M8UX1B"},nV=["https://api.anthropic.com/v1/messages","https://cloud2.typingmind.com/api/claude/v1/messages"],nP=(0,K.eK)("useCurrentCompletionEndpoint"),nT=(0,K.eK)("useCurrentAnthropicEndpoint"),nM=(0,K.eK)("useCurrentWhisperEndpoint"),nD=(0,K.eK)("useOpenAIOrgID");function nB(e){(0,nq.Z)(e);var t,n,s,r,a=nP("https://api.openai.com/v1/chat/completions"),i=(0,y.Z)(a,2),o=i[0],l=i[1],c=nT("https://cloud2.typingmind.com/api/claude/v1/messages"),d=(0,y.Z)(c,2),u=d[0],m=d[1],p=nM("https://api.openai.com/v1/audio/transcriptions"),h=(0,y.Z)(p,2),g=h[0],f=h[1],b=(0,q.useState)(o),w=b[0],k=b[1],N=(0,q.useState)(u),C=N[0],I=N[1],O=(0,q.useState)(g),V=O[0],P=O[1],T=nD(""),M=(0,y.Z)(T,2),D=M[0],B=M[1],L=(0,q.useState)(D),R=L[0],_=L[1],Z=(0,q.useState)(!1),K=Z[0],G=Z[1],F=(0,q.useState)(null),Y=F[0],U=F[1],H=(0,A.mV)().i18n;(0,q.useEffect)(function(){k(o)},[o]),(0,q.useEffect)(function(){I(u)},[u]);var z=(t=(0,x.Z)(j().mark(function e(){return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return U(""),e.prev=1,l(w),window.alert(H._({id:"kGCe95"})),window.location.reload(),e.abrupt("return");case 8:e.prev=8,e.t0=e.catch(1),U(H._(nO)),console.error(e.t0);case 12:G(!1);case 13:case"end":return e.stop()}},e,null,[[1,8]])})),function(){return t.apply(this,arguments)}),W=(n=(0,x.Z)(j().mark(function e(){return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return U(""),e.prev=1,m(C),window.alert(H._({id:"kGCe95"})),window.location.reload(),e.abrupt("return");case 8:e.prev=8,e.t0=e.catch(1),U(H._(nO)),console.error(e.t0);case 12:G(!1);case 13:case"end":return e.stop()}},e,null,[[1,8]])})),function(){return n.apply(this,arguments)}),Q=(s=(0,x.Z)(j().mark(function e(){return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return U(""),e.prev=1,f(V),window.alert(H._({id:"kGCe95"})),window.location.reload(),e.abrupt("return");case 8:e.prev=8,e.t0=e.catch(1),U(H._(nO)),console.error(e.t0);case 12:G(!1);case 13:case"end":return e.stop()}},e,null,[[1,8]])})),function(){return s.apply(this,arguments)}),J=(r=(0,x.Z)(j().mark(function e(){return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return U(""),e.prev=1,B(R),window.alert(H._({id:"kGCe95"})),window.location.reload(),e.abrupt("return");case 8:e.prev=8,e.t0=e.catch(1),U(H._(nO)),console.error(e.t0);case 12:G(!1);case 13:case"end":return e.stop()}},e,null,[[1,8]])})),function(){return r.apply(this,arguments)});return(0,S.jsxs)("div",{className:"my-2 space-y-4",children:[(0,S.jsxs)("div",{className:"flex items-center justify-between gap-2 flex-wrap",children:[(0,S.jsxs)("label",{className:"text-sm font-semibold flex items-center justify-center gap-2",children:[(0,S.jsxs)("span",{children:[(0,S.jsx)(A.cC,{id:"Rde+o4"}),":"]}),(0,S.jsxs)("button",{onClick:function(){k("https://api.openai.com/v1/chat/completions")},className:"hover:underline text-blue-500 font-semibold flex-shrink-0",children:["(",(0,S.jsx)(A.cC,{id:"SFteAp"}),")"]})]}),(0,S.jsxs)("div",{className:"flex items-center justify-center gap-2 w-full",children:[(0,S.jsx)("input",{type:"text",placeholder:"https://...",className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm dark:bg-zinc-700 disabled:text-gray-500",autoComplete:"off",value:w,onChange:function(e){return k(e.target.value)},disabled:K,onKeyDown:function(e){"Enter"===e.key&&(e.preventDefault(),z())}}),(0,S.jsx)("button",{onClick:function(){z()},disabled:K,className:"inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 disabled:cursor-default transition-colors whitespace-nowrap space-x-1",children:K?(0,S.jsx)(E,{}):(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"tfDRzk"})})})]})]}),(0,S.jsxs)("div",{className:"flex items-center justify-between gap-2 flex-wrap",children:[(0,S.jsxs)("label",{className:"text-sm font-semibold flex items-center justify-center gap-2",children:[(0,S.jsxs)("span",{children:[(0,S.jsx)(A.cC,{id:"8xI/bl"}),":"]}),(0,S.jsxs)("button",{onClick:function(){I("https://cloud2.typingmind.com/api/claude/v1/messages")},className:"hover:underline text-blue-500 font-semibold flex-shrink-0",children:["(",(0,S.jsx)(A.cC,{id:"SFteAp"}),")"]})]}),(0,S.jsxs)("div",{className:"flex items-center justify-center gap-2 w-full",children:[(0,S.jsx)(nI.hQ,{value:C,onChange:function(e){return I(e)},immediate:!0,children:(0,S.jsxs)("div",{className:"relative w-full",children:[(0,S.jsx)(nI.gA,{className:"w-full px-3 py-2 pr-8 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm dark:bg-zinc-700 disabled:text-gray-500",onChange:function(e){I(e.target.value)}}),(0,S.jsx)(nI.Q$,{className:"absolute inset-y-0 right-0 flex items-center rounded-r-md px-2 focus:outline-none",children:(0,S.jsx)(nS.Z,{className:"h-5 w-5 text-gray-400"})}),(0,S.jsx)(nI.L5,{className:"absolute z-10 mt-1 max-h-60 w-full overflow-auto rounded-md bg-white dark:bg-zinc-700 py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm",children:[].concat((0,v.Z)(C&&!nV.includes(C)?[{value:C,label:H._({id:"MYfjvl",values:{newAnthropicEndpoint:C}})}]:[]),(0,v.Z)(nV.map(function(e){return{value:e,label:e}}))).map(function(e){return(0,S.jsxs)(nI.O2,{value:e.value,className:"group relative cursor-default select-none py-2 pl-3 pr-9 text-gray-900 dark:text-white hover:bg-blue-600 hover:text-white",children:[(0,S.jsx)("span",{className:"block truncate group-data-[selected]:font-semibold",children:e.label}),(0,S.jsx)("span",{className:"absolute inset-y-0 right-0 hidden items-center pr-4 text-blue-500 group-data-[selected]:flex group-hover:text-white",children:(0,S.jsx)(nE.Z,{className:"h-5 w-5"})})]},e.value)})})]})}),(0,S.jsx)("button",{onClick:function(){W()},disabled:K,className:"inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 disabled:cursor-default transition-colors whitespace-nowrap space-x-1",children:K?(0,S.jsx)(E,{}):(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"tfDRzk"})})})]})]}),(0,S.jsxs)("div",{className:"flex items-center justify-between gap-2 flex-wrap",children:[(0,S.jsxs)("label",{className:"text-sm font-semibold flex items-center justify-center gap-2",children:[(0,S.jsxs)("span",{children:[(0,S.jsx)(A.cC,{id:"dV7X6u"}),":"]}),(0,S.jsxs)("button",{onClick:function(){P("https://api.openai.com/v1/audio/transcriptions")},className:"hover:underline text-blue-500 font-semibold flex-shrink-0",children:["(",(0,S.jsx)(A.cC,{id:"SFteAp"}),")"]})]}),(0,S.jsxs)("div",{className:"flex items-center justify-center gap-2 w-full",children:[(0,S.jsx)("input",{type:"text",placeholder:"https://...",className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm dark:bg-zinc-700 disabled:text-gray-500",autoComplete:"off",value:V,onChange:function(e){return P(e.target.value)},disabled:K,onKeyDown:function(e){"Enter"===e.key&&(e.preventDefault(),Q())}}),(0,S.jsx)("button",{onClick:function(){Q()},disabled:K,className:"inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 disabled:cursor-default transition-colors whitespace-nowrap space-x-1",children:K?(0,S.jsx)(E,{}):(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"tfDRzk"})})})]})]}),(0,S.jsxs)("div",{className:"flex items-center justify-between gap-2 flex-wrap",children:[(0,S.jsxs)("label",{className:"text-sm font-semibold flex items-center justify-center gap-2",children:[(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"rNGD7J"})}),(0,S.jsxs)("button",{onClick:function(){_("")},className:"hover:underline text-blue-500 font-semibold flex-shrink-0",children:["(",(0,S.jsx)(A.cC,{id:"SFteAp"}),")"]})]}),(0,S.jsxs)("div",{className:"flex items-center justify-center gap-2 w-full",children:[(0,S.jsx)("input",{type:"text",placeholder:"org-xxxxxx",className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm dark:bg-zinc-700 disabled:text-gray-500",autoComplete:"off",value:R,onChange:function(e){return _(e.target.value)},disabled:K,onKeyDown:function(e){"Enter"===e.key&&(e.preventDefault(),J())}}),(0,S.jsx)("button",{onClick:function(){J()},disabled:K,className:"inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 disabled:cursor-default transition-colors whitespace-nowrap space-x-1",children:K?(0,S.jsx)(E,{}):(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"tfDRzk"})})})]})]}),(0,S.jsx)("div",{className:"text-xs text-gray-500 mt-1",children:(0,S.jsx)(A.cC,{id:"NnuIWZ"})}),Y&&(0,S.jsx)("div",{className:"mt-2 text-sm text-red-500",children:Y})]})}function nL(){var e,t=(0,q.useState)(null),n=t[0],s=t[1],r=(0,q.useState)(null),a=r[0],i=r[1];return(0,q.useEffect)(function(){(0,x.Z)(j().mark(function e(){var t,n,s;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null===(t=navigator)||void 0===t||null===(t=t.storage)||void 0===t||null===(n=t.estimate)||void 0===n?void 0:n.call(t);case 2:(s=e.sent)&&i(s);case 4:case"end":return e.stop()}},e)}))()},[]),(0,q.useEffect)(function(){var e=0;for(var t in localStorage)localStorage.hasOwnProperty(t)&&(e+=localStorage.getItem(t).length,t.substring(0,5));var n=5242880-e;s({usagePercentage:(e/5242880*100).toFixed(2),usedSpace:e,totalSpace:5242880,availableSpace:n})},[]),(0,S.jsxs)("div",{children:[(0,S.jsx)("h3",{className:"text-xl font-bold",children:(0,S.jsx)(A.cC,{id:"RlyAC4"})}),(0,S.jsx)("div",{className:"text-xs my-2",children:(0,S.jsx)(A.cC,{id:"9jrTB+"})}),n?(0,S.jsxs)("div",{className:"my-4 text-xs",children:[(0,S.jsx)("div",{className:"font-semibold text-sm",children:(0,S.jsx)(A.cC,{id:"0ivkbP"})}),(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"my-2 h-4 w-full bg-green-500 rounded-lg overflow-hidden relative",children:(0,S.jsx)("div",{style:{width:"".concat(n.usedSpace/n.totalSpace*100,"%")},className:"h-4 w-full bg-red-500 absolute top-0 left-0 bottom-0"})}),(0,S.jsxs)("div",{className:"flex items-center justify-between ",children:[(0,S.jsxs)("div",{children:[(0,S.jsx)(A.cC,{id:"2iTmdZ"})," ",(0,S.jsx)("b",{children:(n.usedSpace/1024/1024).toFixed(2)+" MB"})," (",n.usagePercentage,"%)"]}),(0,S.jsxs)("div",{children:[(0,S.jsx)(A.cC,{id:"ml4bvW"})," ",(0,S.jsx)("b",{children:(n.totalSpace/1024/1024).toFixed(2)+" MB"})," "]})]})]})]}):null,a?(0,S.jsxs)("div",{className:"my-4 text-xs",children:[(0,S.jsx)("div",{className:"font-semibold text-sm",children:(0,S.jsx)(A.cC,{id:"2tuzFd"})}),(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"my-2 h-4 w-full bg-green-500 rounded-lg overflow-hidden relative",children:(0,S.jsx)("div",{style:{width:"".concat(a.usage/a.quota*100,"%")},className:"h-4 w-full bg-red-500 absolute top-0 left-0 bottom-0"})}),(0,S.jsxs)("div",{className:"flex items-center justify-between ",children:[(0,S.jsxs)("div",{children:["IndexedDB:"," ",(0,S.jsx)("b",{children:(0,O.td)((null==a||null===(e=a.usageDetails)||void 0===e?void 0:e.indexedDB)||(null==a?void 0:a.usage)||0)})," "]}),(0,S.jsxs)("div",{children:[(0,S.jsx)(A.cC,{id:"ml4bvW"})," ",(0,S.jsx)("b",{children:(0,O.td)(a.quota||0)})," "]})]})]})]}):null,(0,S.jsx)("div",{className:"text-xs my-2 text-orange-500",children:(0,S.jsx)(A.cC,{id:"kMEn8S"})})]})}function nR(e){var t=e.setChats,n=e.wait,s=void 0===n?5e3:n,r=e.showCoruptedMessage,a=e.emptyMessage,i=(0,q.useState)([]),o=i[0],l=i[1],c=(0,q.useState)(null),d=c[0],u=c[1],m=_();(0,q.useEffect)(function(){var e=setTimeout((0,x.Z)(j().mark(function e(){return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("ChatsCoruptCheck"),e.t0=O.FW,e.next=4,(0,K.CQ)().entries();case 4:e.t1=e.sent.filter(function(e){var t=(0,y.Z)(e,2),n=t[0];return t[1],n.startsWith("CHAT_")}).map(function(e){var t=(0,y.Z)(e,2);return t[0],t[1]}).filter(Boolean),l((0,e.t0)(e.t1));case 7:case"end":return e.stop()}},e)})),s);return function(){clearTimeout(e)}},[]);var p=function(){if(!m.licensePayload){u(T.ag._({id:"meXG5q"}));return}t(o)};return o.length?(0,S.jsxs)("div",{className:"m-2 p-2 bg-yellow-500 text-black rounded-lg text-xs space-y-2 max-w-xs mx-auto text-center",children:[(0,S.jsxs)("div",{children:[void 0===r||r?T.ag._({id:"TzBiUJ"}):""," ",(0,S.jsx)(A.cC,{id:"Wtg0tB",values:{0:o.length},components:{0:(0,S.jsx)("b",{})}})]}),d?(0,S.jsx)("div",{className:"text-red-500 font-semibold bg-white",children:d}):null,(0,S.jsx)("div",{className:"text-center",children:(0,S.jsx)("button",{onClick:function(){return p()},type:"button",className:"rounded-full border border-blue-500 px-3 py-1 text-sm my-0 hover:bg-blue-600 transition-all space-x-1 bg-blue-500 text-white",children:(0,S.jsx)(A.cC,{id:"mBkVGB"})})})]}):(void 0===a?function(){return null}:a)()}var n_=n(67266),nZ=n.n(n_),nK=n(78798),nG=n(33129),nF=n(72152),nY=n(68919),nU=n(55433);function nH(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,s)}return n}function nz(e){for(var t=1;t0&&tx.push("".concat(n._({id:"YVY9Iw",values:{0:a.length}}),"")),(null==v?void 0:v.length)>0&&tx.push("".concat(n._({id:"yxF19Y",values:{0:v.length}}),"")),eS.length>0&&tx.push("".concat(n._({id:"ao4ihU",values:{0:eS.length}}),"")),(null==u?void 0:u.length)>0&&tx.push("".concat(n._({id:"IPXOXm",values:{0:u.length}}),"")),h.length>0&&tx.push("".concat(n._({id:"Ftz/t9",values:{0:h.length}}),"")),tx.push(n._({id:"G7dFid",values:{0:tb.length,messagesCount:tf}})),(0,S.jsxs)("div",{children:[tw?(0,S.jsx)("h3",{className:"text-xl font-bold mb-4",children:tw}):null,(0,S.jsx)("div",{className:"mb-4",dangerouslySetInnerHTML:{__html:n._({id:"tdX+tp"})+" "+tx.join(", ")}}),(0,S.jsxs)("div",{className:"my-4 flex items-center flex-wrap gap-2",children:[(0,S.jsxs)("button",{onClick:function(){return td(function(e){return!e})},type:"button",className:"inline-flex items-center px-2 py-1 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 disabled:cursor-default transition-colors",children:[(0,S.jsx)(Y.r2j,{className:"w-4 h-4 mr-2"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"GS+Mus"})})]}),(0,S.jsxs)("button",{type:"button",onClick:function(){var e=document.createElement("input");e.type="file",e.accept="application/json",e.onchange=function(e){var t=e.target.files[0],s=new FileReader;s.onload=function(e){var t=e.target.result;try{var s=JSON.parse(t);tj({success:s})}catch(e){console.error(e),alert(n._(nW))}},s.readAsText(t)},e.click()},className:"inline-flex items-center px-2 py-1 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 disabled:cursor-default transition-colors",children:[(0,S.jsx)(Y.cX4,{className:"w-4 h-4 mr-2"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"l3s5ri"})})]}),(0,S.jsxs)("button",{type:"button",onClick:function(){return te(!0)},className:"inline-flex items-center px-2 py-1 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-orange-600 hover:bg-orange-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-orange-500 disabled:bg-gray-400 disabled:cursor-default transition-colors",children:[(0,S.jsx)(Y.wg8,{className:"w-4 h-4 mr-2"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"mP/ptm"})})]}),tA?(0,S.jsxs)("div",{className:"w-full flex items-center gap-2 flex-wrap",children:[(0,S.jsxs)("button",{type:"button",onClick:function(){var e=document.createElement("input");e.type="file",e.accept="application/json",e.onchange=function(e){var t=e.target.files[0],n=new FileReader;n.onload=function(e){var t=e.target.result;try{var n=JSON.parse(t),s=sf(n),r=s.failedChats,a=s.validChats;tj({success:{data:{chats:a}},fail:r})}catch(e){console.error(e),alert(nW)}},n.readAsText(t)},e.click()},className:"inline-flex whitespace-nowrap items-center px-2 py-1 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 disabled:cursor-default transition-colors",children:[(0,S.jsx)(Y.cX4,{className:"w-4 h-4 mr-2"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"+wwQdk"})})]}),(0,S.jsx)("button",{onClick:function(){return tp(function(e){return!e})},className:"text-blue-500 hover:text-blue-700 text-center",children:(0,S.jsx)(A.cC,{id:"IHD/ra"})})]}):null]}),tm&&(0,S.jsxs)("div",{className:"my-4",children:[(0,S.jsx)("h3",{className:"font-bold",children:(0,S.jsx)(A.cC,{id:"7ONgDR"})}),(0,S.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-x-6 gap-y-2",children:[(0,S.jsx)("img",{src:"/assets/openai-guide/1.png",width:3136,height:1764}),(0,S.jsx)("img",{src:"/assets/openai-guide/2.png",width:3136,height:1764}),(0,S.jsx)("img",{src:"/assets/openai-guide/3.png",width:3136,height:1764})]})]}),tc&&(0,S.jsxs)("div",{className:"my-4",children:[(0,S.jsx)("h3",{className:"font-bold",children:(0,S.jsx)(A.cC,{id:"iTDzyV"})}),(0,S.jsx)("div",{className:"mt-2 w-full grid grid-cols-1 xs:grid-cols-2 gap-x-6 gap-y-2",children:sx.map(function(e){var t;return(0,S.jsxs)("label",{className:"flex items-center space-x-2",children:[(0,S.jsx)("input",{type:"checkbox",className:"h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-600",checked:null===(t=ti[e.id])||void 0===t||t,onChange:function(){return tg(e.id)}}),(0,S.jsx)("span",{children:e.label})]},e.id)})}),(0,S.jsxs)("button",{onClick:function(){var e,s,r,a,i={};if(sb.forEach(function(e){var t;(null===(t=ti[e.section])||void 0===t||t)&&e.data.forEach(function(e){i[e]=o[e]})}),!Object.keys(i).some(function(e){return Array.isArray(i[e])?i[e].length>0:!!i[e]})){window.alert(n._({id:"Amd0C9"}));return}var l=new Date,c=(null===(e=t.serverHostConfig)||void 0===e?void 0:e.displayBrand)==="TypingMind"||(null===(s=t.serverHostConfig)||void 0===s?void 0:s.displayBrand)==="Typing Mind"?"_typingmind":null!==(r=t.serverHostConfig)&&void 0!==r&&r.subdomain?"_"+(null===(a=t.serverHostConfig)||void 0===a?void 0:a.subdomain):"",d="".concat((0,nY.Z)(l,"yyyyMMdd_HHmmss")).concat(c,"_export.json"),u=new Blob([JSON.stringify({data:i})],{type:"application/json"}),m=URL.createObjectURL(u),p=document.createElement("a");p.setAttribute("href",m),p.setAttribute("download",d),document.body.appendChild(p),p.click(),p.remove(),URL.revokeObjectURL(m)},type:"button",className:"mt-3 inline-flex items-center px-2 py-1 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 disabled:cursor-default transition-colors",children:[(0,S.jsx)(Y.RFS,{className:"w-4 h-4 mr-2"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"IFNYKF"})})]})]}),e7?(0,S.jsxs)("div",{className:"my-4",children:[(0,S.jsx)("div",{className:"text-xs text-gray-500 my-4",children:(0,S.jsx)(A.cC,{id:"HFASYW"})}),(0,S.jsx)(nR,{wait:0,setChats:function(e){tv(e),window.location.reload()},showCoruptedMessage:!1,emptyMessage:function(){return(0,S.jsx)("div",{className:"text-base font-semibold p-4",children:(0,S.jsx)(A.cC,{id:"gIikXc"})})}})]}):null,e9?(0,S.jsxs)("div",{className:"my-4",children:[(0,S.jsx)("div",{className:"text-sm text-red-500 my-4",children:(0,S.jsx)(A.cC,{id:"u7fI8q"})}),(0,S.jsx)("div",{className:"my-2",children:(0,S.jsx)("input",{type:"text",className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm dark:bg-zinc-700",placeholder:n._({id:"O8x+FV"}),value:tn,onChange:function(e){return ts(e.target.value)}})}),(0,S.jsxs)("button",{type:"button",onClick:(0,x.Z)(j().mark(function e(){return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,th();case 2:window.location.reload();case 3:case"end":return e.stop()}},e)})),className:"inline-flex items-center px-2 py-1 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-red-600 hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 disabled:bg-gray-400 disabled:cursor-default transition-colors",disabled:"delete all"!==tn,children:[(0,S.jsx)(Y.wg8,{className:"w-4 h-4 mr-2"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"lcqFCW"})})]})]}):null]})};function sy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,s)}return n}function sw(e){for(var t=1;t10?(0,S.jsx)(nC,{}):null]})}var sC=function(){for(var e=arguments.length,t=Array(e),n=0;n {\\n if (error) {\\n console.error(`Error executing FFmpeg: ${error.message}`);\\n return callback(error);\\n }\\n if (stderr) {\\n console.error(`FFmpeg stderr: ${stderr}`);\\n }\\n callback(null, stdout);\\n });\\n}\\n\\n// Example usage:\\nconst input = \'short-test.mov\';\\nconst output = \'short-test.mp3\';\\nconst ffmpegCommand = `ffmpeg -i ${input} -q:a 0 -map a ${output}`;\\n\\nrunFFmpegCommand(ffmpegCommand, (error, output) => {\\n if (error) {\\n console.error(\'FFmpeg command failed:\', error);\\n } else {\\n console.log(\'FFmpeg command succeeded:\', output);\\n }\\n});\\n```"}],"conversationStarters":[{"id":"9433708e-a24d-4c46-b828-02edb0223ee3","text":"Please help me explain this regex: ([A-Z])\\\\w+"},{"id":"6a83e3db-8973-42da-9962-16b760f17616","text":"Write a macOS bash command to resize all png files to 300x300"},{"id":"609c4f7c-3374-42f4-96f6-e345ffa42e79","text":"Write a JS function to generate a random number between `start` and `finish`."},{"id":"db98e360-66df-483d-9d57-7156d794894e","text":"Write a python script to fetch the favicon from the list of websites in urls.txt file."}],"isEnforceAssignedPlugins":true,"categories":["Tech"]},{"id":"character-b3659646-14c7-40d9-a6f7-e4aad8a49482","type":"system","color":"#F0FAF0","title":"Tech Writer","premium":true,"syncedAt":null,"avatarURL":"https://www.typingmind.com/assets/ai-characters/tech-writer.png","description":"A tech writer who can assist you with your technology-related content needs, including user manuals, documentation, tutorials, and guides.","instruction":"You are a tech writer, you help the user with their technology-related content needs, such as writing user manuals, documentation, tutorials, and guides.","deletedAt":null,"trainingExamples":[],"conversationStarters":[{"id":"f4badfcc-bb14-4291-b5e8-35e6fe07c8b6","text":"Could you create a detailed guide on cybersecurity best practices for small businesses?"},{"id":"2af6fb48-e136-490c-8470-bc24b56824d4","text":"Write a comparison article of the top cloud service providers (such as AWS, Google Cloud, and Microsoft Azure)."},{"id":"34969f70-d4ef-4f94-a9e5-20afb325a3a2","text":"Write an article explaining blockchain technology for beginners."},{"id":"a5f1b7a5-7aa1-459f-8cdf-8a115f023812","text":"I need an article explaining the Internet of Things (IoT) for smart homes."}],"welcomeMessage":"Hello, I\'m a tech writer. How can I assist you with your technology-related content needs today?","categories":["Tech"]},{"id":"character-84f13aee-4be6-4423-95ad-8881a15f61fc","color":"#fff","title":"Linux Terminal Assistant","premium":true,"syncedAt":"2024-06-08T06:55:38.506Z","avatarURL":"https://www.typingmind.com/assets/ai-characters/linux-terminal-assistant.png","createdAt":"2024-06-07T02:10:26.536Z","deletedAt":null,"lastUsedAt":"2024-06-07T02:10:26.536Z","description":"Provide precise terminal outputs or commands based on your requests. Perfect for practice, troubleshooting, or quick command references.","instruction":"You will act as an Advanced Linux Terminal Assistant. You have 2 tasks:\\n1. Help the user execute Linux commands and return the exact terminal output if the user sends a command.\\n2. Provide exact terminal commands if the user asks for them.\\n\\nREMEMBER: No extra explanations, just the pure output.","welcomeMessage":"Welcome! I\'m your Advanced Linux Terminal Assistant. Ask me for Linux commands or terminal output.","assignedPlugins":{},"trainingExamples":[{"id":"6d6df67d-af79-41ca-8865-c42ae9ebd479","userText":"ls -l","assistantText":"total 12\\ndrwxr-xr-x 2 user group 4096 Jun 7 09:08 documents\\ndrwxr-xr-x 5 user group 4096 Jun 7 09:08 downloads\\n-rw-r--r-- 1 user group 2048 Jun 7 09:08 file.txt"},{"id":"15770835-dc1f-43bb-a1bd-0c69f697ed82","userText":"uname -a","assistantText":"Linux hostname 5.4.0-72-generic #80-Ubuntu SMP Fri Apr 9 22:14:14 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux"},{"id":"8023c2b0-1051-424f-827b-a44b54afbb45","userText":"df -h","assistantText":"Filesystem Size Used Avail Use% Mounted on\\n/dev/sda1 50G 20G 30G 40% /\\nudev 3.9G 0 3.9G 0% /dev\\ntmpfs 798M 1.1M 797M 1% /run\\nnone 4.0K 0 4.0K 0% /sys/fs/cgroup"}],"conversationStarters":[{"id":"8f000200-3df7-4d8f-a48f-57cba6c083ea","text":"ps aux | grep ssh"},{"id":"26f7b03b-ac4f-4ae6-940c-a8b61995eb96","text":"df -h"},{"id":"37c8bf78-efc9-4966-a476-e6d74d44118d","text":"How to change file permissions?"},{"id":"af998084-cdc8-4025-bc66-1e7994e9efe3","text":"Rename a file in Linux terminal."}],"overrideSystemInstruction":false,"categories":["Tech"]},{"id":"character-23b270cd-84c3-4a2f-9d35-2786467ecd40","color":"#fff","title":"Git Commands Assistant","premium":true,"syncedAt":null,"avatarURL":"https://www.typingmind.com/assets/ai-characters/git-commands-assistant.png","createdAt":"2024-06-07T02:10:26.536Z","deletedAt":null,"lastUsedAt":"2024-06-19T04:38:26.584Z","description":"A helpful assistant to guide you through Git commands and version control best practices.","instruction":"You are a Git Commands Assistant, expert in version control systems, specifically Git. Help users understand, learn, and execute various Git commands. Offer insights on best practices for version control, workflows, branching strategies, and troubleshooting common issues. Provide clear, concise explanations and practical examples where possible to aid users in mastering Git.\\n\\nREMEMBER: No extra explanations, just the pure output.","welcomeMessage":"Hey there! I\'m your Git Commands Assistant, here to make version control a breeze. Ready to level up your Git skills? Let\'s get started!","assignedPlugins":{},"trainingExamples":[{"id":"57ff806c-8b4f-4dbd-a5c1-dbe9924d4333","userText":"How do you create an empty commit?","assistantText":"git commit --allow-empty -m \\"Empty commit message\\""}],"conversationStarters":[{"id":"8f000200-3df7-4d8f-a48f-57cba6c083ea","text":"How can I clone a repository?"},{"id":"26f7b03b-ac4f-4ae6-940c-a8b61995eb96","text":"How can I find a commit by a message?"},{"id":"37c8bf78-efc9-4966-a476-e6d74d44118d","text":"How can I change the last commit?"},{"id":"af998084-cdc8-4025-bc66-1e7994e9efe3","text":"How can I list all the remote repositories configured?"}],"overrideSystemInstruction":false,"categories":["Tech"]}]'),sW=JSON.parse('[{"title":"Customer Email Responder","avatarURL":"https://www.typingmind.com/assets/ai-characters/customer-email-responder.png","description":"A diligent and empathetic responder for customer emails, ensuring prompt and thoughtful replies.","instruction":"Draft a reply to the email I\'ve received.\\nMake the response brief, clear, and direct.\\nAvoid any negative emotions or excessive enthusiasm.\\nMaintain a FRIENDLY tone.\\nThe sender is a KNOWLEDGEABLE individual.\\nReply in the same language as the sender.\\n\\nREMEMBER: Only provide the email response, without additional explanation unless requested.","trainingExamples":[],"conversationStarters":[{"id":"9956c403-92d6-439d-924b-9b768b22bb34","text":"Hi! I love your product. It\'s great! I am a poor student. Can I get a promo code?"},{"id":"7e282b79-e389-4fd3-91ee-193e01a84dca","text":"Can I get a refund for my order 12438xabck made yesterday?"},{"id":"5049c63d-8194-49ca-8af7-2d03108a15c2","text":"How can I get the receipt for my purchase?"},{"id":"e23e91cc-4432-4336-bc8c-9eb44581c71a","text":"I couldn\'t log in to my account today. I retried 3 times, but it said \\"Network error."}],"welcomeMessage":"Hello! I\'m here to assist you with any questions or concerns your customers have. Let\'s make your customers\' experience smooth and satisfying. Send me your customer inquiry, and I\'ll help craft a response email.","assignedPlugins":{},"id":"character-1d292ade-32fe-48bf-b85d-59a4418a6c12","color":"#fff","createdAt":"2024-06-19T04:58:38.634Z","lastUsedAt":"2024-06-19T04:59:33.084Z","syncedAt":null,"categories":["Customer Support"]},{"title":"Net Promoter Score Report","premium":true,"avatarURL":"https://www.typingmind.com/assets/ai-characters/net-promoter-score-report.png","description":"A data analyst specializing in Net Promoter Score (NPS) reports.","instruction":"You are a data analyst specializing in Net Promoter Score (NPS) reports. Your role involves analyzing user feedback, calculating NPS, and providing insights to help improve customer satisfaction and loyalty.\\n\\n** Use plugins to visualize the suitable charts (bar charts, line charts, pie charts, area charts, etc.) for the NPS report.\\n** Then, use your expertise to interpret data trends, identify areas for improvement, and offer actionable recommendations to enhance user experience.\\n** The result should include these sections: Charts, Summary, Insights, Recommendations.\\n** No need to show how you calculate the NPS score unless the user asks for it.\\n** Display in a nice table format if you need.","trainingExamples":[],"conversationStarters":[],"welcomeMessage":"Hello! I\'m your NPS Analyst. Send me your NPS survey results. I\'ll dive into your customer feedback and uncover valuable insights to boost your user satisfaction and loyalty.","isEnforceAssignedPlugins":true,"assignedPlugins":{"render_chart":{"uuid":"9cff2e31-1e10-4b45-b2b7-87edc20865bc","id":"render_chart","title":"Render Chart","iconURL":"https://raw.githubusercontent.com/TypingMind/render-chart/f7ee3e95d86338c4fe05a3c547f20157608ebecb/icon.png"}},"id":"character-fe2b843e-db49-48a2-b326-624acb6666f8","color":"#fff","createdAt":"2024-06-19T05:09:37.911Z","lastUsedAt":"2024-06-19T05:15:32.130Z","syncedAt":null,"categories":["Customer Support"]},{"title":"Bug Report Generator","premium":true,"avatarURL":"https://www.typingmind.com/assets/ai-characters/bug-report-generator.png","description":"An expert in creating detailed and structured bug reports to help software development teams address issues efficiently.","instruction":"You are a Bug Report Generator. Your expertise lies in creating thorough and clear bug reports for software issues. Your task is to help customer support team to document bug descriptions, steps to reproduce, expected vs. actual results, severity, and any relevant system information.\\nHere is a list of the essentials things to include in your bug report:\\n1. ID/name: Keep it brief and use clear terms. Include the name of the feature or element where you found the issue. A good example would be: \\"CART - Unable to add new item to my cart\\".\\n\\n2. Description/summary: If you feel the name is not sufficient, explain the bug in a few words. Make it easy to understand. Remember to use specific keywords in your description, as those might be searched for in your bug tracking application.\\n\\n3. Environment: Depending on your browser, operating system, zoom level and screen size, websites may behave differently from one environment to another. Make sure your developers know your technical environment.\\n4. Console logs: Those contain all JavaScript errors and warnings, making it much easier for developers to reproduce and resolve any bug. \\n5. Source URL: Make it easy for your developers to spot the problem by including the URL of the page where you found the bug.\\n6. Visual proof: A visual element, like an annotated screenshot or a video recording, will help your developers understand the problem better and faster.\\n7. Steps to reproduce: make sure to describe, in as much detail as possible, the steps you took before you encountered the bug.\\n8. Expected result vs. actual result: Explain what results you expected. Be specific.\\n\\nOptional: You can also include extra info such as the severity (critical, major, minor, trivial, enhancement), priority (high, medium, low), name of the reporter, person assigned, or a due date.\\n\\nREMEMER: Only output bug reports, no extra explanation needed unless the user asks for it.","trainingExamples":[],"conversationStarters":[{"id":"aa6295b8-33f3-4d03-bd79-52cd539b47e6","text":"Customers can not upgrade the app on macOS Sonoma. "},{"id":"68e76976-b398-4973-bf36-b10ed9b7524d","text":"The admin dashboard failed to load correctly in FireFox."},{"id":"b5e94455-ee0c-4396-b975-4633e8c5bb7b","text":"Users are unable to log into the application."},{"id":"e2ae2520-4ced-4d39-8031-5b104b4f0424","text":"One customer encountered a payment processing error with the message \\"Failed to charge.\\""}],"welcomeMessage":"Greetings! I\'m your Bug Report Generator. Ready to turn your software issues into clear and actionable bug reports? Let\'s get started identifying and documenting those pesky bugs!","assignedPlugins":{},"id":"character-e048db98-6075-47af-bb94-e8d76114807a","color":"#fff","createdAt":"2024-06-19T08:07:01.025Z","lastUsedAt":"2024-06-19T08:14:57.641Z","syncedAt":null,"categories":["Customer Support"]},{"id":"character-582139d5-2c2b-4adc-8d88-d1411587721b","color":"#fff","title":"Custom FAQ Generator","premium":true,"syncedAt":"2024-06-08T06:52:33.918Z","avatarURL":"https://www.typingmind.com/assets/ai-characters/custom-faq-generator.png","createdAt":"2024-06-08T06:50:58.325Z","deletedAt":null,"lastUsedAt":"2024-06-08T06:50:58.325Z","description":"An advanced AI designed to generate a customized FAQ (Frequently Asked Questions) list based on the given input.\\n","instruction":"You are the Custom FAQ Generator, created to help users generate clear and concise FAQs that address the main concerns or queries about a provided topic. \\n\\nREMEMBER: Only output the FAQs list, no extra explanations unless the user asks for it.","welcomeMessage":"Hello, I\'m your Custom FAQ Generator. Ready to create a tailor-made FAQ list that resolves all your queries? Just tell me what\'s your service/product!","assignedPlugins":{},"trainingExamples":[{"id":"859ad6f8-514f-48dc-b1e8-5eeff01e3f95","userText":"Usage and features of our investment app.","assistantText":"1. How do I sign up for the app?\\nTo sign up for our app, simply download it from the App Store or Google Play and follow the on-screen instructions to create an account. You\'ll need to provide some basic information about yourself, such as your name, email address, and date of birth. Once you\'ve created an account, you\'ll be able to start investing right away.\\n\\n2. How do I fund my account?\\nTo fund your account, go to the \\"Funding\\" section of the app and follow the on-screen instructions. You can link your bank account to transfer funds or use a debit card to make a deposit. Once your account is funded, you\'ll be able to start investing in our portfolios.\\n\\n3. How do I choose a portfolio?\\nOur app offers a range of portfolios to choose from, each with a different risk level and investment strategy. To choose a portfolio, go to the \\"Investing\\" section of the app and answer a few questions about your investment goals and risk tolerance. Based on your answers, we\'ll recommend a portfolio that we think is right for you. You can also browse all our portfolios and choose one yourself."}],"conversationStarters":[{"id":"a6980cc5-9b19-485c-8ae9-5970190aec67","text":"Create FAQs for hotel booking and cancellation policies."},{"id":"5e21347a-5c44-4084-8479-4f8bbf202634","text":"Provide FAQs about your e-commerce return policy."},{"id":"834d6edc-72e6-43ec-8adb-a903fffe0fea","text":"Create a FAQ list for subscription plans and pricing of an app."},{"id":"fe0ac033-2734-44be-bcca-fa0fd1d50eef","text":"Develop FAQs for data privacy and security measures."}],"overrideSystemInstruction":false,"categories":["Customer Support"]}]'),sQ=JSON.parse('[{"title":"Invoice Generator","premium":true,"avatarURL":"https://www.typingmind.com/assets/ai-characters/invoice-generator.png","description":"A specialized tool for creating professional invoices quickly and efficiently.","instruction":"You are an Invoice Generator, designed to help the user create professional invoices in a structured and efficient manner based on their information such as client details, service descriptions, quantities, rates, and any applicable taxes.\\n\\nHere are the main components that you should include on an invoice:\\n[Header (do not display this text)] Make the word ","invoice":" clear and prominent at the top of the document to quickly identify it as such.\\n\\n[The user\'s business info (do not display this text)] Include company name, business address, contact details (such as phone number or email), etc.\\n\\n[Customer’s business info (do not display this text)] Similar to the business info, you’ll need to include the name, address, and contact details of the client or business you’re billing.\\n\\n[Invoice number (do not display this text)] Assign a unique identification number to each invoice.\\n\\n[Invoice date (do not display this text)]\\n\\n[Payment terms (do not display this text)] Clearly state the terms of payment.\\n\\n[Itemized list of goods or services (do not display this text)] A table of detail what the customer is being charged for. List each item or service separately, along with its description, quantity or hours, rate, and total amount for that line item. Then calculate and list the subtotal, Taxes, fees, discounts, and Total amount due.\\n\\n[Notes (do not display this text)] This is optional\\n\\nREMEMBER:\\n** Only output the invoice, no extra explanation needed.\\n** Use markdown to present the invoice in a nice format\\n** Use h1, h2 tag for the big headlines.\\n** Use table to format the results if needed.","trainingExamples":[],"conversationStarters":[{"id":"563ffb89-7e1e-47d2-85e2-ad0a48ab6c6b","text":"Custom logo design | Quantity: 1 | Unit Price: $1,200.00."},{"id":"a85658c4-2a41-4eee-b108-8ff55362c899","text":"Comprehensive management of social media profiles including content creation | Quantity: 3 | Unit Price: $400.00"},{"id":"39ab8284-5da2-4ce5-a591-fa6c67a04d06","text":" Cloud Hosting Subscription | Quantity: 1 | Unit Price: $499.00."},{"id":"be88dd3d-830e-4b37-be36-75aa88b5191f","text":" Professional Web Development Services | Quantity: 10 hours | Unit Price: $200/hour."}],"welcomeMessage":"Hello! I\'m your Invoice Generator, here to help you create professional invoices quickly and easily. Let\'s get started on making your billing process a breeze!","assignedPlugins":{},"id":"character-3e9a622e-28d7-40ab-a1ad-fa7ffff413c3","color":"#fff","createdAt":"2024-06-19T08:37:09.974Z","lastUsedAt":"2024-06-19T08:49:50.569Z","syncedAt":null,"categories":["Finance and Accounting"]},{"title":"Loan Application Assessor","premium":true,"avatarURL":"https://www.typingmind.com/assets/ai-characters/loan-application-assessor.png","description":"An expert Loan Application Assessor analyzing and evaluating a user based on their financial history, credit score, and other relevant factors.","instruction":"You are a Loan Application Assessor. Your primary responsibility is to assist users in analyzing and assessing the financial risk posed by their customers. This involves conducting a thorough review of various factors, including financial history, credit score, income, debt, assets, and prevailing market conditions. Your comprehensive assessment will provide valuable insights to the user, enabling them to determine whether a customer is trustworthy enough to be granted a loan.\\n\\nREMEMBER:\\n** Present the results in nice tables if needed.","trainingExamples":[],"conversationStarters":[],"welcomeMessage":"Hello, I\'m your Loan Application Assessor. I help you evaluate your customers\' financial risk by examining their financial history, credit score, income, debt, assets, and market conditions. My insights will guide you in making informed loan decisions? Let\'s begin by sharing your customers\' financial history.","assignedPlugins":{},"id":"character-c79e8ced-d5e4-4dba-947f-17452197884c","color":"#fff","createdAt":"2024-06-19T08:56:40.160Z","lastUsedAt":"2024-06-19T09:33:15.719Z","syncedAt":null,"categories":["Finance and Accounting"]},{"title":"Earnings Call Q&A Prep","avatarURL":"https://www.typingmind.com/assets/ai-characters/earning-call-qa-prep.png","description":"A financial analyst who specializes in preparing for earnings call Q&A sessions with insightful data and strategies based on your current financial data and market conditions.","instruction":"You are a financial analyst specializing in earnings call Q&A preparation. Utilize current financial data and market conditions to offer insightful strategies and detailed responses for anticipated questions during earnings calls. Assist the user in suggesting a list of Q&A that the user might be asked during the earnings call.\\n\\nREMEMBER:\\n** Make sure all the figures in the answers are based on the user\'s data.\\n** Only output the Q&A list, no extra explanation needed unless the user asks for it.","trainingExamples":[],"conversationStarters":[],"welcomeMessage":"Hi, I\'m your Financial Analyst for earnings call Q&A prep. Let\'s dive into your financial data and market conditions to get you ready with impactful insights and strategies for your upcoming earnings call. How can I assist you today?","assignedPlugins":{},"id":"character-153c55e5-4f27-4b50-8480-fdd0a9c676fd","color":"#fff","createdAt":"2024-06-19T09:43:58.211Z","lastUsedAt":"2024-06-19T09:47:07.786Z","syncedAt":null,"categories":["Finance and Accounting"]}]'),sJ=JSON.parse('[{"id":"character-dfa4ce89-71d8-4364-a206-708734b32733","color":"#fff","title":"Blog Image Generator","userDefault":true,"syncedAt":"2024-06-09T04:04:22.441Z","avatarURL":"https://www.typingmind.com/assets/ai-characters/blog-image-generator.png","createdAt":"2024-06-09T04:04:14.611Z","lastUsedAt":"2024-06-09T04:04:14.611Z","description":"A blog image generator specialized in creating modern vector illustrations for blog covers.","instruction":"Produce an image featuring a heartwarming [user\'s object] in a clean, modern vector style. The [user\'s object] is presented on a [plain] [white] backdrop, highlighting the elegance and appeal of this contemporary vector illustration. This style employs simple, flat design components to craft a modern [user\'s object] scene.","welcomeMessage":"Hello, I\'m a Blog Image Illustrations Generator, specializing in creating modern vector illustrations for blog covers. Let me know what you need to generate.","assignedPlugins":{"image_generation_via_dalle_3":{"id":"image_generation_via_dalle_3","uuid":"0ee9d4d8-c453-40bd-b2e1-04b94e935fa2","emoji":"✨","title":"DALL-E 3"}},"trainingExamples":[],"conversationStarters":[{"id":"a360a1b3-79e9-43d3-9b16-af01fcc1eaf7","text":"I need a modern vector illustration for a post about remote work."},{"id":"aa4c1fcd-6f5d-457d-981b-e84df31b591c","text":"Can you design a blog cover illustration that highlights the benefits of mindfulness and meditation?"},{"id":"7d21e879-a934-4573-b698-62e7ff569ce5","text":"Could you generate an image cover for a travel blog focusing on sustainable tourism?"},{"id":"2cae0b63-5b14-4830-8dce-b943aa48db4c","text":" Can you produce a vector illustration for a blog post about the latest technology trends?"}],"isEnforceAssignedPlugins":true,"deletedAt":null,"categories":["Design"]},{"title":"Realistic Portraits","avatarURL":"https://www.typingmind.com/assets/ai-characters/realistic-portraits.png","description":"An expert portrait artist specializing in creating hyper-realistic portraits from photographs or live sittings.","instruction":"Create a detailed and lifelike portrait of a [user input\'s gender] individual, with their hand directed towards [user input\'s direction]. Make sure the person\'s facial expression conveys [user input\'s emotion] and that the backdrop is a solid color [user input\'s color] that enhances the overall visual balance.","trainingExamples":[],"conversationStarters":[{"id":"040a80d7-c857-4495-a2c8-0d0f186d4ece","text":"A woman, front view, slightly smiling, purple background."},{"id":"4224e618-34f8-46bb-9d6f-eb9c9c88bcc8","text":"A man, pointing his finger to the left, green background."},{"id":"9f2f9431-1497-48c9-85d0-c23169c3c50e","text":"A man, pointing his finger to the top, pink background."},{"id":"9d2aef6c-1225-4283-8c31-00532cd07087","text":"A woman, pointing a \\"peace\\" sign, orange background."}],"welcomeMessage":"Hey there! I\'m an expert in creating lifelike portraits. Whether you\'re looking to capture a special moment or understand the art of portrait drawing, I\'m here to help. Let\'s turn your vision into a masterpiece!","trainingDataTags":[],"isEnforceAssignedPlugins":true,"assignedPlugins":{"image_generation_via_dalle_3":{"uuid":"0ee9d4d8-c453-40bd-b2e1-04b94e935fa2","id":"image_generation_via_dalle_3","title":"DALL-E 3","emoji":"✨"}},"dynamicContextEndpoints":[],"id":"character-eb9faed2-0276-4b87-8397-3f9e2e7cf757","color":"#fff","createdAt":"2024-06-20T09:42:57.401Z","lastUsedAt":"2024-06-20T09:43:03.713Z","categories":["Design"]},{"title":"Professional Mockups","premium":true,"avatarURL":"https://www.typingmind.com/assets/ai-characters/professional-mockups.png","description":"Effortlessly generate mockups of screens, bottles, and labels. Display your designs without the expense of stock photos. Perfect for designers, marketers, and anyone requiring professional mockups.","instruction":"(Professional mockup photography; RAW photo), (showcasing a [user\'s object]), [user\'s object description], [user\'s background], close-up and centered, straight-on view, eye-level perspective, with minimalist and modern design, studio lighting, natural color palette, taken with Sony Alpha 7III, sharp focus, bokeh effect, highest quality, intricate details, studio photography, optimal lighting and shading, extremely sharp, photorealistic and hyperrealistic.","trainingExamples":[],"conversationStarters":[{"id":"a61506ce-321c-479a-bba1-dfef1183bf7b","text":"Wine bottle placed on a rustic table in the garden of a Tuscan villa."},{"id":"6a487838-3b09-4792-8c18-40e1e08cfae5","text":"A silver laptop with plain white screen."},{"id":"741da0f5-0778-4f26-b13c-85845577f614","text":"A black smartphone with a plain white screen."},{"id":"7e187edf-2dad-46fe-8c3e-d4e2979a67c5","text":"A single isolated thick book with plain white cover, placed standing upright on a black wooden shelf."}],"welcomeMessage":"Hello! I\'m here to help you create stunning professional mockups that bring your design concepts to life. Let\'s make your ideas shine!","trainingDataTags":[],"isEnforceAssignedPlugins":true,"assignedPlugins":{"image_generation_via_stable_diffusion_3":{"uuid":"f582e880-16d8-4a02-b247-86b4cbe9b390","id":"image_generation_via_stable_diffusion_3","title":"Stable Diffusion v3 Image","iconURL":"https://www.typingmind.com/stable-diffusion.png"}},"dynamicContextEndpoints":[],"id":"character-326bd020-75ef-42df-bede-59770c87ad56","color":"#fff","createdAt":"2024-06-20T09:37:24.072Z","lastUsedAt":"2024-06-20T09:38:36.377Z","syncedAt":null,"categories":["Design"]},{"title":"Dynamic Logos","premium":true,"avatarURL":"https://www.typingmind.com/assets/ai-characters/dynamic-logos.png","description":"Design impressive and customizable logos with editable components. Ideal for businesses, digital marketing, and creative projects! \uD83C\uDFA8","instruction":"Design a professional logo for [brand name], utilizing a [color scheme] palette and featuring an [icon] that reflects the brand\'s identity. The logo should be contemporary, eye-catching, and versatile for use across different platforms such as websites, business cards, and social media profiles.","trainingExamples":[],"conversationStarters":[{"id":"06a58bc1-8aa0-4f6e-a957-c69a15bd3623","text":"Eco Warriors, green and white, an leaf."},{"id":"16867631-b6a0-437f-aef5-89f657409454","text":"Fitness Pro, red and black, a dumbbell."},{"id":"9cae89ba-91b1-470e-b3b8-cdb3d28a3253","text":"Artistic Minds, purple and gold, paintbrush."},{"id":"12ccdee6-e608-47ee-b72c-dbea4aca5677","text":"Travel Guru, blue and yellow, globe."}],"welcomeMessage":"Hey there! I\'m ready to help you craft a logo that stands out and speaks volumes about your brand. Tell me your brand name, color scheme, and your chosen icon (optional), and I\'ll create something amazing for you!","trainingDataTags":[],"isEnforceAssignedPlugins":true,"assignedPlugins":{"image_generation_via_dalle_3":{"uuid":"0ee9d4d8-c453-40bd-b2e1-04b94e935fa2","id":"image_generation_via_dalle_3","title":"DALL-E 3","emoji":"✨"}},"dynamicContextEndpoints":[],"id":"character-7c135864-afb2-4e68-bee5-294c0d3f2477","color":"#fff","createdAt":"2024-06-20T09:30:06.845Z","lastUsedAt":"2024-06-20T09:30:59.733Z","syncedAt":null,"categories":["Design"]},{"title":"Minimalism Living Designer","premium":true,"avatarURL":"https://www.typingmind.com/assets/ai-characters/minimalism-living-designer.png","description":"A minimalism living designer who helps create simple, functional, and clutter-free living spaces.","instruction":"Main item photography centered on [user\'s object], captured with a Canon EOS 5D Mark IV. Emphasize a clean composition with sharp lines and balanced light and shadow interplay, in ArchDaily style. High contrast, mimicking a professional architectural photographer’s approach. Highlight facade details and textures to evoke depth and realism, with dramatic lighting and a foggy atmosphere, sunlight realism, and photorealistic scale.","trainingExamples":[],"conversationStarters":[{"id":"18283079-5a25-47f5-a9ab-b6dfad1d7c60","text":"Minimalist Bedroom."},{"id":"a867a8c0-d51e-406a-9838-4872aadcbe7c","text":"Clutter-Free Workspace."},{"id":"fd3b40dc-c712-497a-a3bb-c49364f72cf4","text":"Simple Living Room."},{"id":"9917da4d-55e3-4f76-aace-6f58acfbc3b9","text":"Minimalist Wardrobe."}],"welcomeMessage":"Hello! I\'m your Minimalism Living Designer. Ready to transform your space into a calm, clutter-free haven? Let\'s start simplifying together!","trainingDataTags":[],"isEnforceAssignedPlugins":true,"assignedPlugins":{"image_generation_via_stable_diffusion_3":{"uuid":"f582e880-16d8-4a02-b247-86b4cbe9b390","id":"image_generation_via_stable_diffusion_3","title":"Stable Diffusion v3 Image","iconURL":"https://www.typingmind.com/stable-diffusion.png"}},"dynamicContextEndpoints":[],"id":"character-e16ca6bd-6146-4387-8405-15acda9f84cd","color":"#fff","createdAt":"2024-06-20T09:26:03.687Z","lastUsedAt":"2024-06-20T09:26:08.986Z","syncedAt":null,"categories":["Design"]},{"title":"Comic Hero Posters","premium":true,"avatarURL":"https://www.typingmind.com/assets/ai-characters/comic-hero-posters.png","description":"Craft extraordinary artworks of your favorite superheroes using this prompt. Ideal for creating stunning posters to adorn your walls, this tool allows you to bring your most beloved characters to life with remarkable detail and vivid colors.","instruction":"(Flat vector art; comic style:1.5), illustrating [user input\'s superhero] in a [user input\'s pose], in a dynamic action-comic style artwork; poster, full body from head to toe, with a highly detailed face, looking at the viewer, set against a pop art abstract style background in [user input\'s background colors] and contrasting patterns; playful and fun aesthetic. (Vivid colors, halftone effects:1.5, minimalistic design), perfect image composition, (best quality), trending on ArtStation, masterpiece, award-winning artwork, 8k, high-resolution, two-dimensional.","trainingExamples":[],"conversationStarters":[{"id":"f218c3ff-3993-4dc4-afa5-461e48a2ad3a","text":"Superwoman, elegant pose, blue and yellow colors."},{"id":"87ff9a68-5c6d-4e9b-ae69-0c2f3dcbe4cf","text":"Batman, heroic pose, yellow and orange colors."},{"id":"9fbfdbe1-a4d2-496b-9a62-b4776742765e","text":"Superman, heroic pose, blue and orange colors."},{"id":"d3179d27-220f-40a2-88ec-44ce06c727a9","text":"The hulk, fighting pose, green and yellow colors."}],"welcomeMessage":"Hey there! Ready to bring your favorite superheroes to life with some epic posters? Let\'s create some jaw-dropping artwork together!","trainingDataTags":[],"isEnforceAssignedPlugins":true,"assignedPlugins":{"image_generation_via_stable_diffusion_3":{"uuid":"f582e880-16d8-4a02-b247-86b4cbe9b390","id":"image_generation_via_stable_diffusion_3","title":"Stable Diffusion v3 Image","iconURL":"https://www.typingmind.com/stable-diffusion.png"}},"dynamicContextEndpoints":[],"id":"character-788bb490-1186-4c59-aec8-8d6654756d3a","color":"#fff","createdAt":"2024-06-20T09:19:28.360Z","lastUsedAt":"2024-06-20T09:23:48.906Z","syncedAt":null,"categories":["Design"]},{"title":"Children Book Illustrations","avatarURL":"https://www.typingmind.com/assets/ai-characters/children-book-illustrations.png","description":"Create limitless captivating illustrations for children\'s books in a consistent style focused on various topics (character, animal, places).","instruction":"For a children\'s book, produce a premium, clear, high-definition, and enchanting illustration of [user\'s object]. Surroundings feature [user\'s object description], augmenting their adventurous presence. Available in 4K, high-definition, high-quality, and high-resolution.","trainingExamples":[],"conversationStarters":[{"id":"4da75b83-563d-45a8-8b38-26851bf74b90","text":"A brave astronaut and a friendly alien, in a colorful planet and twinkling stars."},{"id":"f3f3cdd3-2316-4286-968c-fa7e19096afc","text":"A girl with her cat flying in an airplane, surrounding with fluffy clouds and a blue sky."},{"id":"3d6cc48a-81f2-4582-96d0-65a1a9158000","text":"A grandmother telling a story to children, surrounding with a colorful rug and a bookshelf"},{"id":"56eddd1c-7c94-42b3-9058-1ffef948ed57","text":"A playful mermaid and a singing seahorse, surrounding with a colorful coral reef and sparkling ocean waves."}],"welcomeMessage":"Hello there! I\'m here to bring your children\'s stories to life with magical illustrations. What adventure are we illustrating today?","trainingDataTags":[],"isEnforceAssignedPlugins":true,"assignedPlugins":{"image_generation_via_dalle_3":{"uuid":"0ee9d4d8-c453-40bd-b2e1-04b94e935fa2","id":"image_generation_via_dalle_3","title":"DALL-E 3","emoji":"✨"}},"dynamicContextEndpoints":[],"id":"character-ec8f25b5-c944-4968-9a6a-dc83b73bc11c","color":"#fff","createdAt":"2024-06-20T09:17:00.582Z","lastUsedAt":"2024-06-20T09:17:27.679Z","syncedAt":null,"categories":["Design"]},{"title":"Businesses & Offices Vector Images","avatarURL":"https://www.typingmind.com/assets/ai-characters/businesses-offices-vector-images.png","description":"Craft beautiful visuals illustrating common daily activities of office workers and professionals. Perfect for PowerPoint presentations, website graphics, and other uses!","instruction":"Create an image that showcases a stylized digital illustration featuring [user\'s object] figures engaged in a [user\'s object description]. They are [standing] [before] a [large] [whiteboard] adorned with a vibrant [user\'s color], symbolizing a moment of [inspiration] or a [great idea]. Surrounding the [user\'s description] are numerous speech bubbles in various soft pastel colors, indicating a plethora of ideas or conversations being considered. The [user\'s object] are depicted in a minimalist, modern graphic style. The overall design is clean and uncluttered, utilizing a limited color palette that draws attention to the central [symbol], effectively conveying a scene of creative collaboration and innovative thinking.","trainingExamples":[],"conversationStarters":[{"id":"b239f40b-b625-41b9-9e7b-9feaf350bf13","text":"A man sitting in a chair, looking out a window at a city skyline."},{"id":"8212126f-0bad-4f97-939d-6daa2440313d","text":"A woman standing next to a copier in an office setting"},{"id":"bee5e8d5-5b23-49b4-8eb2-57693a9678f7","text":"a man in a suit presenting an increasing graph."},{"id":"0e45e78d-b416-42a6-af22-eb27f73fd31a","text":"A man giving a presentation to a group of people"}],"welcomeMessage":"Hello! I\'m here to help you create stunning visuals of office life for your presentations and websites. Tell me a simple object, I\'ll make a content visually engaging and professional for you. I suggest you use simple and short words so that the results are good!","trainingDataTags":[],"isEnforceAssignedPlugins":true,"assignedPlugins":{"image_generation_via_dalle_3":{"uuid":"0ee9d4d8-c453-40bd-b2e1-04b94e935fa2","id":"image_generation_via_dalle_3","title":"DALL-E 3","emoji":"✨"}},"dynamicContextEndpoints":[],"id":"character-4b6a6ad1-d51c-4b3a-90a4-dec70ee21d5e","color":"#fff","createdAt":"2024-06-20T09:03:13.426Z","lastUsedAt":"2024-06-20T09:12:51.905Z","syncedAt":null,"categories":["Design"]}]');function sX(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,s)}return n}function s$(e){for(var t=1;t'),a?n.substring(0,a):n,"",""].join("\n")}).join("\n"));case 5:case"end":return e.stop()}},e)})),function(e){return s.apply(this,arguments)}),s8=(r=(0,x.Z)(j().mark(function e(t){var n,s,r,a,i,o,l,c,d,u,m,p,h;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.endpoint,r=void 0===(s=t.variables)?{}:s,a=t.withCache,i=n.hasBody?n.requestBody:void 0,o={"Content-Type":"application/json"},l=n.hasBody&&i?i.replace(/{(.+?)}/g,function(e,t){return r[t]||"{".concat(t,"}")}):void 0,c=n.requestHeaders?n.requestHeaders.replace(/{(.+?)}/g,function(e,t){return r[t]||"{".concat(t,"}")}):void 0,!l){e.next=13;break}e.prev=6,JSON.parse(l),e.next=13;break;case 10:throw e.prev=10,e.t0=e.catch(6),Error("Invalid JSON in request body for endpoint ".concat(n.name));case 13:if(!c){e.next=21;break}e.prev=14,JSON.parse(c),e.next=21;break;case 18:throw e.prev=18,e.t1=e.catch(14),Error("Invalid JSON in request headers for endpoint ".concat(n.name));case 21:if(e.prev=21,new URL(n.url).hostname){e.next=25;break}throw Error("Invalid URL for endpoint ".concat(n.name));case 25:e.next=30;break;case 27:throw e.prev=27,e.t2=e.catch(21),Error("Invalid URL for endpoint ".concat(n.name," (").concat(n.url,")"));case 30:return d=s6({method:n.method,headers:s6(s6({},n.hasHeaders?JSON.parse(c):{}),n.hasBody?o:{})},"POST"===n.method?{body:l}:{}),u=(n.name||"").substring(0,100)+"-"+s5()(JSON.stringify([n.id,n.url,n.method,null==r?void 0:r.userID].concat((0,v.Z)("REFRESH_PER_CHAT"===n.cacheRefreshPolicy?[null==r?void 0:r.chatID]:[]),(0,v.Z)("REFRESH_PER_MESSAGE"===n.cacheRefreshPolicy?[null==r?void 0:r.lastUserMessage]:[])).filter(Boolean))),m=n.enableCache&&n.cacheDurationHours&&a?a:function(e){return(0,e.fn)()},p=n.cacheDurationHours*(n.cacheDurationHours,3600),e.next=36,m({cacheKey:u,cacheGroup:"DCE-"+n.id,expireInSeconds:p,fn:function(){var e=(0,x.Z)(j().mark(function e(){var t,s;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fetch(n.url,d);case 2:return t=e.sent,e.next=5,t.text();case 5:if(s=e.sent,t.ok){e.next=8;break}throw Error("Request failed: "+(s||"(No response)")+"\nOpen the web console for more info.");case 8:return e.abrupt("return",s);case 9:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}()});case 36:return h=e.sent,e.abrupt("return",h);case 38:case"end":return e.stop()}},e,null,[[6,10],[14,18],[21,27]])})),function(e){return r.apply(this,arguments)});function s9(e){var t,n,s=e.onDelete,r=e.onFieldChange,a=e.showUserID,i=e.endpoint,o=e.testFunction,l=(0,q.useState)(!1),c=l[0],d=l[1],u=(0,q.useState)(!1),m=u[0],p=u[1],h=(0,q.useState)(null),g=h[0],f=h[1];(0,q.useEffect)(function(){i.name||d(!0)},[]);var b=(t=(0,x.Z)(j().mark(function e(){return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return p(!0),f(null),e.prev=2,e.next=5,o({endpoint:i,variables:{chatID:"test-chat-id",characterID:"test-character-id",userID:"test-user-id",lastUserMessage:"This is a test message for Dynamic Context"}});case 5:f({error:"",text:e.sent}),e.next=13;break;case 9:e.prev=9,e.t0=e.catch(2),console.log("endpoint error",e.t0),f({error:null===e.t0||void 0===e.t0?void 0:e.t0.message});case 13:p(!1);case 14:case"end":return e.stop()}},e,null,[[2,9]])})),function(){return t.apply(this,arguments)}),y=function(){return(0,S.jsxs)("div",{className:"text-xs text-gray-500 mb-1",children:[(0,S.jsx)(A.cC,{id:"TJCWpw"}),":"," ",["lastUserMessage","chatID","characterID"].concat((0,v.Z)(a?["userID"]:[])).map(function(e){return(0,S.jsx)("code",{className:"bg-gray-200 dark:bg-gray-700 rounded mx-1",children:"{".concat(e,"}")},e)})]})};return c?(0,S.jsxs)("div",{className:"border border-gray-300 dark:border-gray-600 rounded-md p-4 shadow relative space-y-4",children:[(0,S.jsxs)("div",{className:" absolute top-3 right-4 flex items-center justify-center gap-2",children:[(0,S.jsx)("button",{onClick:function(){d(!1)},className:"text-gray-500 font-semibold hover:underline",children:(0,S.jsx)(A.cC,{id:"H86f9p"})}),(0,S.jsx)(eS,{onConfirmed:function(){s()},className:"text-red-500 font-semibold hover:underline",children:(0,S.jsx)(A.cC,{id:"t/YqKh"})})]}),(0,S.jsxs)("div",{className:"",children:[(0,S.jsxs)("div",{className:"font-semibold mb-1",children:[(0,S.jsx)(A.cC,{id:"tbb3wK"}),":"]}),(0,S.jsx)("input",{type:"text",placeholder:"e.g., Last 10 tweets",className:"w-full border border-gray-300 dark:border-gray-600 rounded-md shadow-sm py-2 px-3 text-base leading-6 focus:outline-none focus:ring-blue-500 focus:border-blue-500 transition duration-150 ease-in-out dark:bg-zinc-700 disabled:text-gray-500",value:i.name,onChange:function(e){r("name",e.target.value)},disabled:m})]}),(0,S.jsxs)("div",{className:"flex items-center justify-center gap-4 flex-col sm:flex-row",children:[(0,S.jsxs)("div",{className:"flex-shrink-0 w-full sm:w-fit",children:[(0,S.jsxs)("div",{className:"font-semibold mb-1",children:[(0,S.jsx)(A.cC,{id:"bHXYoC"}),":"]}),(0,S.jsxs)("select",{disabled:m,className:"w-full border border-gray-300 rounded-md shadow-sm py-2 pl-3 pr-10 text-base leading-6 focus:outline-none focus:ring-blue-500 focus:border-blue-500 transition duration-150 ease-in-out dark:bg-zinc-700 disabled:text-gray-500",value:i.method,onChange:function(e){r("method",e.target.value)},children:[(0,S.jsx)("option",{value:"GET",children:"GET"}),(0,S.jsx)("option",{value:"POST",children:"POST"})]})]}),(0,S.jsxs)("div",{className:"w-full",children:[(0,S.jsxs)("div",{className:"font-semibold mb-1",children:[(0,S.jsx)(A.cC,{id:"T3juzf"}),":"]}),(0,S.jsx)("input",{type:"text",placeholder:"https://yourapi.example.com/last-10-tweets.json",className:"w-full border border-gray-300 dark:border-gray-600 rounded-md shadow-sm py-2 px-3 text-base leading-6 focus:outline-none focus:ring-blue-500 focus:border-blue-500 transition duration-150 ease-in-out dark:bg-zinc-700 disabled:text-gray-500",value:i.url,onChange:function(e){r("url",e.target.value)},disabled:m})]})]}),(0,S.jsxs)("div",{className:"space-y-4",children:[(0,S.jsxs)("div",{className:"font-semibold mb-1 flex items-center justify-start gap-4 flex-wrap",children:[(0,S.jsxs)("label",{className:"flex items-center justify-start gap-2 text-sm",children:[(0,S.jsx)("input",{type:"checkbox",checked:i.enableCache,onChange:function(e){r("enableCache",e.target.checked)},disabled:m}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"7PDSeD"})})]}),(0,S.jsxs)("label",{className:"flex items-center justify-start gap-2 text-sm",children:[(0,S.jsx)("input",{type:"checkbox",checked:i.hasHeaders,onChange:function(e){r("hasHeaders",e.target.checked)},disabled:m}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"Ghn0ZA"})})]}),"POST"===i.method?(0,S.jsxs)("label",{className:"flex items-center justify-start gap-2 text-sm",children:[(0,S.jsx)("input",{type:"checkbox",checked:i.hasBody,onChange:function(e){r("hasBody",e.target.checked)},disabled:m}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"KVJGUP"})})]}):null]}),"POST"===i.method&&i.hasBody&&(0,S.jsxs)("div",{className:"w-full",children:[(0,S.jsxs)("div",{className:"font-semibold mb-1",children:[(0,S.jsx)(A.cC,{id:"yWOswz"}),":"]}),y(),(0,S.jsx)("textarea",{placeholder:'{\n "userID": "{userID}"\n}',rows:3,className:"w-full border border-gray-300 dark:border-gray-600 rounded-md shadow-sm py-2 px-3 text-base leading-6 focus:outline-none focus:ring-blue-500 focus:border-blue-500 transition duration-150 ease-in-out dark:bg-zinc-700 disabled:text-gray-500 w-full",value:i.requestBody,onChange:function(e){r("requestBody",e.target.value)},disabled:m})]}),i.hasHeaders&&(0,S.jsxs)("div",{className:"w-full",children:[(0,S.jsxs)("div",{className:"font-semibold mb-1",children:[(0,S.jsx)(A.cC,{id:"ArNNAV"}),":"]}),y(),(0,S.jsx)("textarea",{placeholder:'{\n "Content-Type": "application/json"\n}',rows:3,className:"w-full border border-gray-300 dark:border-gray-600 rounded-md shadow-sm py-2 px-3 text-base leading-6 focus:outline-none focus:ring-blue-500 focus:border-blue-500 transition duration-150 ease-in-out dark:bg-zinc-700 disabled:text-gray-500 w-full",value:i.requestHeaders,onChange:function(e){r("requestHeaders",e.target.value)},disabled:m})]})]}),i.enableCache?(0,S.jsxs)("div",{className:"flex items-center justify-center gap-4 flex-col sm:flex-row",children:[(0,S.jsxs)("div",{className:"w-full",children:[(0,S.jsxs)("div",{className:"font-semibold mb-1",children:[(0,S.jsx)(A.cC,{id:"uL2j1y"}),":"]}),(0,S.jsxs)("select",{disabled:m,className:"w-full border border-gray-300 rounded-md shadow-sm py-2 pl-3 pr-10 text-base leading-6 focus:outline-none focus:ring-blue-500 focus:border-blue-500 transition duration-150 ease-in-out dark:bg-zinc-700 disabled:text-gray-500",value:i.cacheRefreshPolicy,onChange:function(e){r("cacheRefreshPolicy",e.target.value)},children:[(0,S.jsx)("option",{value:"REFRESH_NEVER",children:(0,S.jsx)(A.cC,{id:"PPDN8S"})}),(0,S.jsx)("option",{value:"REFRESH_PER_CHAT",children:(0,S.jsx)(A.cC,{id:"PjpB64"})}),(0,S.jsx)("option",{value:"REFRESH_PER_MESSAGE",children:(0,S.jsx)(A.cC,{id:"rC5mbl"})})]})]}),(0,S.jsxs)("div",{className:"w-full sm:w-fit flex-shrink-0",children:[(0,S.jsx)("div",{className:"font-semibold mb-1",children:(0,S.jsx)(A.cC,{id:"KiUAH8"})}),(0,S.jsx)("select",{disabled:m,className:"w-full border border-gray-300 rounded-md shadow-sm py-2 pl-3 pr-10 text-base leading-6 focus:outline-none focus:ring-blue-500 focus:border-blue-500 transition duration-150 ease-in-out dark:bg-zinc-700 disabled:text-gray-500",value:i.cacheDurationHours,onChange:function(e){r("cacheDurationHours",Number(e.target.value))},children:Array.from({length:24}).map(function(e,t){return(0,S.jsx)("option",{value:t+1,children:(0,S.jsx)(A.cC,{id:"M4fjIB",values:{0:t+1}})},t)})})]})]}):null,(0,S.jsx)("div",{children:(0,S.jsxs)("button",{onClick:function(){b()},type:"submit",className:"inline-flex items-center px-3 py-1.5 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 gap-2",disabled:m,children:[m?(0,S.jsx)(E,{}):"→",(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"NFYITQ"})})]})}),g?(0,S.jsxs)("div",{children:[g.error?(0,S.jsx)("div",{className:"font-semibold text-red-500 mb-1",children:(0,S.jsx)(A.cC,{id:"sCG3Yu"})}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)("div",{className:"font-semibold mb-1 text-green-500",children:[(0,S.jsx)(A.cC,{id:"Wagt7O"})," (",(0,S.jsx)(A.cC,{id:"IPXOXm",values:{0:(null===(n=g.text)||void 0===n?void 0:n.length)||0}}),")"]}),(0,S.jsx)("div",{className:"mb-1 text-gray-500 text-sm",children:(0,S.jsx)(A.cC,{id:"mIHRS/"})})]}),g.error?(0,S.jsx)("textarea",{className:"w-full border border-gray-300 dark:border-gray-600 rounded-md shadow-sm py-2 px-3 text-base leading-6 focus:outline-none focus:ring-blue-500 focus:border-blue-500 transition duration-150 ease-in-out dark:bg-zinc-700 disabled:text-gray-500 w-full",rows:3,value:null==g?void 0:g.error,readOnly:!0}):(0,S.jsx)("textarea",{className:"w-full border border-gray-300 dark:border-gray-600 rounded-md shadow-sm py-2 px-3 text-base leading-6 focus:outline-none focus:ring-blue-500 focus:border-blue-500 transition duration-150 ease-in-out dark:bg-zinc-700 disabled:text-gray-500 w-full",rows:3,value:null==g?void 0:g.text,readOnly:!0})]}):null]}):(0,S.jsxs)("button",{onClick:function(){return d(!0)},className:"w-full border border-gray-300 dark:border-gray-600 rounded-md p-4 shadow relative hover:bg-gray-100 dark:bg-gray-700 cursor-pointer flex items-center justify-start gap-2",children:[(0,S.jsx)("div",{className:"flex-shrink-0 text-sm bg-gray-500 text-white px-2 py-1 rounded",children:i.method}),(0,S.jsx)("div",{className:"font-semibold flex-shrink-0",children:i.name}),(0,S.jsx)("div",{className:"flex items-center justify-start gap-2 w-full text-gray-500 text-sm truncate",children:i.url})]})}function re(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,s)}return n}function rt(e){for(var t=1;t0){g(!0);return}}:void 0,newTagText:d||T.ag._({id:"uFQF6u"}),placeholderText:a||T.ag._({id:"ENWqZw"}),ref:m,classNames:{root:"w-full",selected:"flex flex-wrap gap-2 w-full mb-2 empty:hidden",selectedTag:'border border-gray-400 dark:border-gray-100 rounded-md px-2 py-0.5 after:content-["✕"] after:ml-2 hover:border-red-500 after:hover:text-red-500',search:"w-full max-w-full relative",searchInput:function(){for(var e=arguments.length,t=Array(e),n=0;n0&&void 0!==arguments[0]?arguments[0]:{},t=e.messages,n=e.contextLimit,s=void 0===n?0:n,r=e.allowedContextLength,a=e.dependencies,i=a.getEstimatedTokens,o=a.getTextContent;if(!t||!t.length)return{skipped:0,contextMessages:[]};var l=[],c=t[t.length-1];l.unshift(c);for(var d=i(o(c.content)),u=t.length-2;u>=0;u--){var m=t[u];if((d+=i(o(m.content)))>r){for(var p,h=u;h>=0;h--)("system"===t[h].role||"training-message"===t[h].type)&&l.unshift(t[h]);if("assistant"===l[0].role)for(;l.length&&(null===(p=l[0])||void 0===p?void 0:p.role)!=="user";)l.shift();break}l.unshift(m)}if(s>0){var g=l.filter(function(e){return"system"===e.role}).length,f=l.slice(-Math.min(t.length-g,s)),x=[];if((null===(b=f[0])||void 0===b?void 0:b.role)==="tool")for(var b,y,w=t.length-s,j=w-1;j>=0&&(x.unshift(t[j]),null===(y=t[j])||void 0===y||!y.tool_calls);j--);l=[].concat((0,v.Z)(l.slice(0,g)),x,(0,v.Z)(f))}return{skipped:t.length-l.length,contextMessages:l}},rm=function(e){var t=Math.min(.2*e,2e3);return e-t};function rp(e){var t=e.message;return(0,S.jsxs)("div",{className:"text-yellow-600 text-xs my-4 text-left",children:[t?(0,S.jsx)("div",{className:"my-2 text-red-500",children:t}):null,(0,S.jsxs)("div",{className:"font-semibold my-2",children:[(0,S.jsx)(Y.CSE,{className:"inline-block mr-1 w-4 h-4"}),(0,S.jsx)(A.cC,{id:"6+So7t"})]}),(0,S.jsx)("div",{children:(0,S.jsx)(A.cC,{id:"dPvuoF"})}),(0,S.jsxs)("div",{children:[(0,S.jsxs)("div",{className:"font-semibold my-2",children:[(0,S.jsx)(A.cC,{id:"PfQA36"}),":"]}),(0,S.jsxs)("ul",{className:"list-decimal pl-4",children:[(0,S.jsx)("li",{children:(0,S.jsx)(A.cC,{id:"mYZR41"})}),(0,S.jsx)("li",{children:(0,S.jsx)(A.cC,{id:"jzCkMH"})}),(0,S.jsx)("li",{children:(0,S.jsx)(A.cC,{id:"S2lnkb"})})]})]})]})}var rh=[": OPENROUTER PROCESSING"],rg=function(e,t,n,s){if(t.trim())try{if(rh.includes(t.trim()))return;if((r=JSON.parse(t)).error){var r,a,i,o,l="";l="server_error"===r.error.type?"OpenAI is currently experiencing a server error. This could be a temporary issue caused by high demand. Please try again. Original error message: "+r.error.message:"OpenAI is currently experiencing a problem. This could be a temporary issue caused by high demand. Please try again. Original error message: "+r.error.message,s(Error(l));return}var c=null==r?void 0:r.usage;if(c)for(var d in c)e.usage=e.usage||{},e.usage[d]=r.usage[d];if(!r.choices||!r.choices.length)return;var u=null===(a=r)||void 0===a||null===(a=a.choices)||void 0===a||null===(a=a[0])||void 0===a?void 0:a.delta;for(var m in u)!function e(t,n,s){if("role"!==n||!t.role){if("string"==typeof s||"content"===n&&null===s)t[n]=(t[n]||"")+(s||"");else if(Array.isArray(s))for(var r in t[n]=t[n]||[],s){var a=s[r];"index"in a||console.warn('Property "index" is missing in array item',a),e(t[n],a.index,a)}else if("object"==typeof s&&null!==s)for(var i in t[n]=t[n]||{},s)e(t[n],i,s[i]);else t[n]=s}}(e,m,u[m]);return n&&((null==e||null===(o=e.tool_calls)||void 0===o?void 0:o.length)===0&&e.content&&delete e.tool_calls,n(e)),null===(i=r.choices[0])||void 0===i?void 0:i.finish}catch(e){console.error("stream error",e)}};function rf(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,s=Array(t);n0&&void 0!==eE[0]?eE[0]:{}).endpoint,r=n.model,a=n.temperature,i=n.presencePenalty,o=n.frequencyPenalty,l=n.topP,c=n.maxTokens,u=void 0===(d=n.contextLimit)?0:d,m=n.contextLengthOverride,n.stop,p=n.signal,h=n.apiKey,g=n.orgID,f=n.stream,x=n.messages,b=n.functions,y=void 0===(v=n.extras)?{}:v,A=void 0===(w=n.headers)?{}:w,N=void 0===(k=n.onStreamStarted)?function(){}:k,q=void 0===(C=n.onStreamTextChunk)?function(e){}:C,n.onStreamFinished,E=void 0===(I=n.onAPIStatusChanged)?function(){}:I,P=void 0===(V=n.onModelUnavailable)?function(){}:V,M=void 0===(T=n.onContextSkipped)?function(){}:T,B=void 0===(D=n.onFreeMessagesCountChanged)?function(){}:D,R=void 0===(L=n.onModelUsageChanged)?function(){}:L,Z=void 0===(_=n.onAborted)?function(){}:_,G=void 0===(K=n.onStreamError)?function(){}:K,Y=(0,O.xx)(r),H=(U=ru({messages:x.filter(function(e){return["system","user","assistant","function","tool"].includes(e.role)}).map(function(e){return e.tool_calls?rb(rb({},e),{},{tool_calls:e.tool_calls.map(function(e){return tY().omit(e,["index"])})}):e}),contextLimit:u,allowedContextLength:rm(m||(null==Y?void 0:Y.contextLength)),dependencies:{getEstimatedTokens:O.fI,getTextContent:O.FB}})).contextMessages,z=U.skipped,null==M||M(z),e.prev=4,e.next=7,fetch(s,{method:"POST",signal:p,headers:rb(rb(rb({"Content-Type":"application/json"},h?{Authorization:"Bearer ".concat(h)}:{}),g?{"OpenAI-Organization":g}:{}),A),body:JSON.stringify(rb(rb(rb(rb(rb(rb(rb(rb({model:r},"number"==typeof a?{temperature:a}:{}),"number"==typeof i?{presence_penalty:i}:{}),"number"==typeof o?{frequency_penalty:o}:{}),"number"==typeof l?{top_p:l}:{}),parseInt(c)?{max_tokens:parseInt(c)}:{}),{},{stream:f},Y.hasStreamUsageReport&&f&&"https://api.openai.com/v1/chat/completions"===s?{stream_options:{include_usage:!0}}:{}),{},{messages:null==H?void 0:H.map(function(e){return tY().pick(e,["role","content","function_call","tool_calls","tool_call_id","name"])})},b&&b.length?{tools:b.map(function(e){return{type:"function",function:e}}),tool_choice:"auto"}:{}),y))});case 7:F=e.sent,e.next=16;break;case 10:if(e.prev=10,e.t0=e.catch(4),"AbortError"!==e.t0.name){e.next=15;break}return Z(),e.abrupt("return");case 15:throw e.t0;case 16:if(500!==F.status){e.next=19;break}return E(rr.yZ.ERROR),e.abrupt("return",{error:"Could not connect to OpenAI API. Please try again later. This could be because OpenAI's server is experiencing high demand and rejected your request. Go to https://status.openai.com/ to check their status."});case 19:if(!(F.status>=400)){e.next=69;break}return e.prev=20,e.next=23,F.clone().json();case 23:J=e.sent,e.next=34;break;case 26:return e.prev=26,e.t1=e.catch(20),console.error("Could not parse JSON response from OpenAI API",e.t1),e.next=31,F.clone().text();case 31:return encodeURIComponent(X=e.sent),e.abrupt("return",{error:(0,S.jsxs)("div",{children:["Sorry, this model is currently experiencing a problem from the server side. Please try again later or select another model."," ",(0,S.jsxs)("details",{children:[(0,S.jsx)("summary",{children:(0,S.jsx)("span",{className:"cursor-pointer hover:underline",children:"View Full Error"})}),(0,S.jsx)("div",{className:"text-left whitespace-pre-line max-h-[200px] overflow-auto bg-gray-100 dark:bg-gray-800 p-2 text-black dark:text-white font-mono text-xs",children:X})]})]})});case 34:if(J.error&&"server_error"===J.error.type&&E(rr.yZ.ERROR),"access_denied"!==J.error){e.next=37;break}return e.abrupt("return",{error:"Access denied. Please try to reopen the app. If the issue persists, please contact support."});case 37:if((null===(W=J.error)||void 0===W?void 0:W.code)!=="setapp_refresh_token_failed"){e.next=40;break}return null===($=window.webkit)||void 0===$||null===($=$.messageHandlers)||void 0===$||null===($=$.TypingMindMacApp)||void 0===$||$.postMessage("SETAPP_REFRESH_TOKEN_FAILED"),e.abrupt("return",{error:"Your login session has expired. Please close the app and reopen again."});case 40:if((null===(Q=J.error)||void 0===Q?void 0:Q.type)!=="insufficient_quota"){e.next=42;break}return e.abrupt("return",{error:(0,S.jsxs)("div",{children:["Your OpenAI API key has run out of quota. Please go to your OpenAI Dashboard to fix this:"," ",(0,S.jsx)("a",{href:"https://platform.openai.com/account/billing/overview",target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:underline",children:(0,S.jsx)("b",{children:"https://platform.openai.com/account/billing/overview"})})]})});case 42:if(429!==F.status){e.next=46;break}if(!J.userMessage){e.next=45;break}return e.abrupt("return",{error:J.userMessage});case 45:return e.abrupt("return",{error:"OpenAI has rejected your request with error code 429. Here are the possible reasons: 1. You are sending requests too quickly; 2. You have hit your maximum monthly spend (hard limit); 3. The model is currently overloaded. Here is the error message from OpenAI: "+((null===(ee=J.error)||void 0===ee?void 0:ee.message)||"")});case 46:if(!(J.error&&"invalid_api_key"===J.error.code)){e.next=52;break}if(!h.startsWith("encrypted-")){e.next=51;break}return e.abrupt("return",{error:"API Key is locked, please unlock it first."});case 51:return e.abrupt("return",{error:"Invalid API key or the API key has been revoked."});case 52:if(!(J.error&&"context_length_exceeded"===J.error.code)){e.next=54;break}return e.abrupt("return",{error:(0,S.jsx)(rp,{message:null===(et=J.error)||void 0===et?void 0:et.message})});case 54:if(!(J.error&&J.error.message)){e.next=63;break}return(en=J.error.message).match(/The model: `(.*)` does not exist/)&&(en+=". You are using ".concat(r," model. Please change the model in the setting and try again. Note that even if you have ChatGPT Plus, you still need to request access to the GPT-4 API in order to use it with your API Key. This is OpenAI's restriction and we can't do anything about it. You can join the waitlist here https://openai.com/waitlist/gpt-4-api.")),P(),es=(null==Y?void 0:Y.source)||r,e.abrupt("return",{error:"Sorry, ".concat(es," has rejected your request. Here is the error message from ").concat(es,": ")+en});case 63:if(!J.userMessage){e.next=67;break}return e.abrupt("return",{error:J.userMessage});case 67:return e.abrupt("return",{error:rv+" Technical details: "+JSON.stringify(J),serverError:J});case 68:return e.abrupt("return");case 69:if(F.ok){e.next=71;break}return e.abrupt("return",{error:rv+" Technical details: Not OK."});case 71:if(E(rr.yZ.OK),(er=F.headers.get("x-remaining-free-messages"))&&B(Number(er)),ea=F.headers.get("x-applied-model"),ei=F.headers.get("x-hour-message-usage"),eo=F.headers.get("x-day-message-usage"),el=F.headers.get("x-month-message-usage"),ec=F.headers.get("x-hour-character-usage"),ed=F.headers.get("x-day-character-usage"),eu=F.headers.get("x-month-character-usage"),R&&[ei,eo,el,ec,ed,eu].filter(Boolean).length>0&&R({model:ea||r,messages:{hour:ei,day:eo,month:el},charactersByPeriod:{hour:ec,day:ed,month:eu}}),em=null,ep=null,eh=null,!f){e.next=138;break}if(window.TextDecoderStream){e.next=88;break}return e.abrupt("return",{error:"Your browser doesn't support streaming response. Please upgrade your browser to the latest version or turn off streaming."});case 88:eg=F.body.pipeThrough(new window.TextDecoderStream).getReader(),ef={content:""},N(),e.prev=92,ex="",eb=["x","x","x","x","x","x"],ev=!1;case 96:return e.next=99,eg.read();case 99:if(ew=(ey=e.sent).value,!(ey.done||ev)){e.next=104;break}return e.abrupt("break",129);case 104:ej=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return rf(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return rf(e,void 0)}}(e))){n&&(e=n);var s=0,r=function(){};return{s:r,n:function(){return s>=e.length?{done:!0}:{done:!1,value:e[s++]}},e:function(e){throw e},f:r}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){o=!0,a=e},f:function(){try{i||null==n.return||n.return()}finally{if(o)throw a}}}}(ew),e.prev=105,ej.s();case 107:if((eA=ej.n()).done){e.next=119;break}if(ek=eA.value,ex+=ek,eb.shift(),eb.push(ek),"[DONE]"!==eb.join("")){e.next=115;break}return ev=!0,e.abrupt("break",119);case 115:":"===ek&&"data:"===ex&&(ex=""),"\n"===ek&&(em=rg(ef,ex,q,G),ex="");case 117:e.next=107;break;case 119:e.next=124;break;case 121:e.prev=121,e.t2=e.catch(105),ej.e(e.t2);case 124:return e.prev=124,ej.f(),e.finish(124);case 127:e.next=96;break;case 129:e.next=134;break;case 131:e.prev=131,e.t3=e.catch(92),"AbortError"===e.t3.name?eg.releaseLock():G(e.t3);case 134:ep=rb({},ef),eh=ef.usage?ef.usage:{completion_tokens:eN=(0,O.fI)(ef.content),prompt_tokens:eC=(0,O.fI)(H.map(function(e){return(0,O.FB)(e.content)}).join("\n")),total_tokens:eN+eC},e.next=144;break;case 138:return e.next=140,F.json();case 140:ep=null===(eq=(eS=e.sent).choices)||void 0===eq||null===(eq=eq[0])||void 0===eq?void 0:eq.message,eh=eS.usage,em=null===(eI=eS.choices)||void 0===eI||null===(eI=eI[0])||void 0===eI?void 0:eI.finish_reason;case 144:return null!==(t=ep)&&void 0!==t&&t.tool_calls&&0===ep.tool_calls.length&&ep.content&&delete ep.tool_calls,e.abrupt("return",{response:rb(rb({},ep),{},{usage:eh,finish:em})});case 146:case"end":return e.stop()}},e,null,[[4,10],[20,26],[92,131],[105,121,124,127]])}))).apply(this,arguments)}var rj=n(83618);function rA(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,s)}return n}function rk(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,s=Array(t);n0&&void 0!==eY[0]?eY[0]:{}).endpoint,r=n.model,a=n.temperature,n.presencePenalty,n.frequencyPenalty,i=n.topP,o=n.topK,l=n.maxTokens,d=void 0===(c=n.contextLimit)?0:c,u=n.contextLengthOverride,n.stop,m=n.signal,p=n.apiKey,n.orgID,h=n.stream,g=n.messages,f=n.functions,b=void 0===(x=n.extras)?{}:x,w=void 0===(y=n.headers)?{}:y,k=void 0===(A=n.onStreamStarted)?function(){}:A,C=void 0===(N=n.onStreamTextChunk)?function(e){}:N,n.onStreamFinished,n.onAPIStatusChanged,n.onModelUnavailable,I=void 0===(q=n.onContextSkipped)?function(){}:q,V=void 0===(E=n.onFreeMessagesCountChanged)?function(){}:E,T=void 0===(P=n.onModelUsageChanged)?function(){}:P,D=void 0===(M=n.onAborted)?function(){}:M,L=void 0===(B=n.onStreamError)?function(){}:B,R=n.promptCachingEnabled,Z=(0,O.xx)(r),G=(K=ru({messages:g.filter(function(e){return["system","user","assistant","function","tool"].includes(e.role)}).map(function(e){var t;if("tool"===e.role)return{role:"user",content:[rV({type:"tool_result",tool_use_id:e.tool_call_id,content:e.content},"error"===e.format?{is_error:!0}:{})]};if(null!==(t=e.tool_calls)&&void 0!==t&&t.length){var n=e.tool_calls.map(function(e){return{type:"tool_use",id:e.id,name:e.function.name,input:(0,O.dC)(e.function.arguments)}});return{role:e.role,content:[].concat((0,v.Z)(Array.isArray(e.content)?e.content:[{type:"text",text:e.content}]),(0,v.Z)(n)).filter(function(e){return(e.text||"").trim()||"tool_use"===e.type})}}return e}),contextLimit:d,allowedContextLength:rm(u||(null==Z?void 0:Z.contextLength)),dependencies:{getEstimatedTokens:O.fI,getTextContent:O.FB}})).contextMessages,F=K.skipped,null==I||I(F),!G.some(function(e){return Array.isArray(e.content)&&e.content.some(function(e){var t;return"image_url"===e.type&&!(null!==(t=e.image_url)&&void 0!==t&&null!==(t=t.url)&&void 0!==t&&t.startsWith("data:image"))})})){e.next=7;break}return e.abrupt("return",{error:"The model you are using (".concat(Z.title,") only supports images with base64 format. This error usually occurs when you switch between models. Please start a new chat with the current model and upload new images!")});case 7:return Y=(G||[]).find(function(e){return"system"===e.role}),U=rN(rS((G||[]).filter(function(e){return"system"!==e.role}))).map(function(e){return tY().pick(e,["role","content","function_call","tool_calls","tool_call_id","name"])}).map(function(e){try{if(Array.isArray(e.content)){var t=e.content.map(function(e){if("image_url"===e.type){var t,n,s=null===(t=e.image_url)||void 0===t||null===(t=t.url)||void 0===t||null===(t=t.split(";")[0])||void 0===t?void 0:t.split(":")[1];return{type:"image",source:{type:"base64",media_type:s,data:null===(n=e.image_url)||void 0===n||null===(n=n.url)||void 0===n?void 0:n.split(",")[1]}}}return e});return t.some(function(e){return"image"===e.type})&&!t.some(function(e){return"text"===e.type&&(e.text||"").trim()})&&(t=t.map(function(e){return"text"===e.type?rV(rV({},e),{},{text:"(Image)"}):e})),rV(rV({},e),{},{content:t})}}catch(e){console.error("error parsing image content",e)}return e}),H=h,z=f&&f.length,e.prev=11,W=r.startsWith("claude-3-5-sonnet")||r.startsWith("claude-3-haiku"),Q=r.startsWith("claude-3-5-sonnet"),W&&R&&(J=(0,O.VR)({messages:[Y].concat(U),model:r}),Y=(X=(0,rj.Z)(J))[0],U=X.slice(1)),$=[Q&&"max-tokens-3-5-sonnet-2024-07-15",W&&R&&"prompt-caching-2024-07-31"].filter(Boolean).join(","),e.next=18,fetch(s,{method:"POST",signal:m,headers:rV(rV(rV(rV({"Content-Type":"application/json"},p?{"x-api-key":p}:{}),$?{"anthropic-beta":$}:{}),"https://api.anthropic.com/v1/messages"===s?{"anthropic-dangerous-direct-browser-access":!0,"anthropic-version":"2023-06-01"}:{}),w),body:JSON.stringify(rV(rV(rV(rV(rV(rV(rV({model:r,max_tokens:2e3},Y?{system:Y.content}:{}),"number"==typeof a?{temperature:a}:{}),"number"==typeof i?{top_p:i}:{}),parseInt(o)?{top_k:parseInt(o)}:{}),parseInt(l)?{max_tokens:parseInt(l)}:{}),{},{stream:H,messages:z?U:U.filter(function(e){return!(Array.isArray(e.content)&&e.content.some(function(e){return"tool_use"===e.type||"tool_result"===e.type}))})},z?{tools:f.map(function(e){return{name:e.name,description:e.description,input_schema:e.parameters}})}:{}),b))});case 18:_=e.sent,e.next=27;break;case 21:if(e.prev=21,e.t0=e.catch(11),"AbortError"!==e.t0.name){e.next=26;break}return D(),e.abrupt("return");case 26:throw e.t0;case 27:if(500!==_.status){e.next=29;break}return e.abrupt("return",{error:"Could not connect to Claude API. Please try again later. This could be because Claude's server is experiencing high demand and rejected your request."});case 29:if(!(_.status>=400)){e.next=71;break}return e.prev=30,e.next=33,_.clone().json();case 33:et=e.sent,e.next=44;break;case 36:return e.prev=36,e.t1=e.catch(30),console.error("Could not parse JSON response from Claude API",e.t1),e.next=41,_.clone().text();case 41:return encodeURIComponent(en=e.sent),e.abrupt("return",{error:(0,S.jsxs)("div",{children:["Sorry, this model is currently experiencing a problem from the server side. Please try again later or select another model."," ",(0,S.jsxs)("details",{children:[(0,S.jsx)("summary",{children:(0,S.jsx)("span",{className:"cursor-pointer hover:underline",children:"View Full Error"})}),(0,S.jsx)("div",{className:"text-left whitespace-pre-line max-h-[200px] overflow-auto bg-gray-100 dark:bg-gray-800 p-2 text-black dark:text-white font-mono text-xs",children:en})]})]})});case 44:if(!et.userMessage){e.next=46;break}return e.abrupt("return",{error:et.userMessage});case 46:if("access_denied"!==et.error){e.next=48;break}return e.abrupt("return",{error:"Access denied. Please try to reopen the app. If the issue persists, please contact support."});case 48:if((null===(ee=et.error)||void 0===ee?void 0:ee.code)!=="setapp_refresh_token_failed"){e.next=51;break}return null===(es=window.webkit)||void 0===es||null===(es=es.messageHandlers)||void 0===es||null===(es=es.TypingMindMacApp)||void 0===es||es.postMessage("SETAPP_REFRESH_TOKEN_FAILED"),e.abrupt("return",{error:"Your login session has expired. Please close the app and reopen again."});case 51:if(429!==_.status){e.next=55;break}if(!et.userMessage){e.next=54;break}return e.abrupt("return",{error:et.userMessage});case 54:return e.abrupt("return",{error:"Claude has rejected your request with error code 429. Here are the possible reasons: 1. You are sending requests too quickly; 2. You have hit your maximum monthly spend (hard limit); 3. The model is currently overloaded. Here is the error message from Claude: "+((null===(er=et.error)||void 0===er?void 0:er.message)||"")});case 55:if(!(et.error&&"invalid_api_key"===et.error.code)){e.next=61;break}if(!p.startsWith("encrypted-")){e.next=60;break}return e.abrupt("return",{error:"API Key is locked, please unlock it first."});case 60:return e.abrupt("return",{error:"Invalid API key or the API key has been revoked."});case 61:if(!(et.error&&"context_length_exceeded"===et.error.code)){e.next=63;break}return e.abrupt("return",{error:(0,S.jsx)(rp,{message:null===(ea=et.error)||void 0===ea?void 0:ea.message})});case 63:if(!(et.error&&"invalid_request_error"===et.error.type&&et.error.message)){e.next=65;break}return e.abrupt("return",{error:"Request failed. Error details: "+et.error.message});case 65:if(!(et.error&&et.userMessage)){e.next=69;break}return e.abrupt("return",{error:et.userMessage});case 69:return e.abrupt("return",{error:rP+" Technical details: "+JSON.stringify(et),serverError:et});case 70:return e.abrupt("return");case 71:if(_.ok){e.next=73;break}return e.abrupt("return",{error:rP+" Technical details: Not OK."});case 73:if((ei=_.headers.get("x-remaining-free-messages"))&&V(Number(ei)),eo=_.headers.get("x-applied-model"),el=_.headers.get("x-hour-message-usage"),ec=_.headers.get("x-day-message-usage"),ed=_.headers.get("x-month-message-usage"),eu=_.headers.get("x-hour-character-usage"),em=_.headers.get("x-day-character-usage"),ep=_.headers.get("x-month-character-usage"),T&&[el,ec,ed,eu,em,ep].filter(Boolean).length>0&&T({model:eo||r,messages:{hour:el,day:ec,month:ed},charactersByPeriod:{hour:eu,day:em,month:ep}}),eh=null,eg=null,!H){e.next=145;break}if(window.TextDecoderStream){e.next=89;break}return e.abrupt("return",{error:"Your browser doesn't support streaming response. Please upgrade your browser to the latest version or turn off streaming."});case 89:ey=_.body.pipeThrough(new window.TextDecoderStream).getReader(),ew={content:""},k(),e.prev=93,ej="",eA="",ek=!1;case 97:return e.next=100,ey.read();case 100:if(eC=(eN=e.sent).value,!(eN.done||ek)){e.next=105;break}return e.abrupt("break",132);case 105:eq=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return rE(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return rE(e,void 0)}}(e))){n&&(e=n);var s=0,r=function(){};return{s:r,n:function(){return s>=e.length?{done:!0}:{done:!1,value:e[s++]}},e:function(e){throw e},f:r}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){o=!0,a=e},f:function(){try{i||null==n.return||n.return()}finally{if(o)throw a}}}}(eC),e.prev=106,eq.s();case 108:if((eI=eq.n()).done){e.next=122;break}if(eS=eI.value,eA+=eS,":"===eS&&"data:"===eA&&(eA=""),!("\n"===eS&&eA)){e.next=120;break}if(!eA.startsWith("event:")){e.next=117;break}return ej=eA.replace("event:","").trim(),eA="",e.abrupt("continue",120);case 117:rI(ej,ew,eA,C,L),ej="",eA="";case 120:e.next=108;break;case 122:e.next=127;break;case 124:e.prev=124,e.t2=e.catch(106),eq.e(e.t2);case 127:return e.prev=127,eq.f(),e.finish(127);case 130:e.next=97;break;case 132:e.next=137;break;case 134:e.prev=134,e.t3=e.catch(93),"AbortError"===e.t3.name?ey.releaseLock():L(e.t3);case 137:eE=(null===(ef=ew.usage)||void 0===ef?void 0:ef.output_tokens)||(0,O.fI)(ew.content),eO=(null===(ex=ew.usage)||void 0===ex?void 0:ex.input_tokens)||(0,O.fI)(G.map(function(e){return(0,O.FB)(e.content)}).join("\n")),eV=(null===(eb=ew.usage)||void 0===eb?void 0:eb.cache_creation_input_tokens)||0,eP=(null===(ev=ew.usage)||void 0===ev?void 0:ev.cache_read_input_tokens)||0,eh=rV({},ew),eg={completion_tokens:eE,prompt_tokens:eO,cache_creation_input_tokens:eV,cache_read_input_tokens:eP,total_tokens:eE+eO+eV+eP},e.next=152;break;case 145:return e.next=147,_.json();case 147:eh=e_=e.sent,eZ=(null===(eT=e_.usage)||void 0===eT?void 0:eT.cache_creation_input_tokens)||0,eK=(null===(eM=e_.usage)||void 0===eM?void 0:eM.cache_read_input_tokens)||0,eg={completion_tokens:null===(eD=e_.usage)||void 0===eD?void 0:eD.output_tokens,prompt_tokens:null===(eB=e_.usage)||void 0===eB?void 0:eB.input_tokens,cache_creation_input_tokens:eZ,cache_read_input_tokens:eK,total_tokens:(null===(eL=e_.usage)||void 0===eL?void 0:eL.output_tokens)+(null===(eR=e_.usage)||void 0===eR?void 0:eR.input_tokens)+eZ+eK};case 152:return null!=(eG=Array.isArray(eh.content)&&eh.content.filter(function(e){return"tool_use"===e.type}))&&eG.length&&(eF=eh.content.filter(function(e){return"tool_use"!==e.type}),eh.content=eF.length?eF:"",eh.tool_calls=eG.map(function(e,t){return{index:t,id:e.id,type:"function",function:{name:e.name,arguments:JSON.stringify(e.input)}}})),e.abrupt("return",{response:rV(rV({},eh),{},{usage:eg,finish:null===(t=eh)||void 0===t?void 0:t.stop_reason})});case 155:case"end":return e.stop()}},e,null,[[11,21],[30,36],[93,134],[106,124,127,130]])}))).apply(this,arguments)}function rD(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,s)}return n}function rB(e){for(var t=1;t0?{tool_calls:r}:{})},r_=function e(t){var n={};return t.type&&("object"!==t.type||t.properties)?(n.type=t.type,t.description&&(n.description=t.description),t.required&&(n.required=t.required),t.enum&&(n.format="enum",n.enum=t.enum),t.items&&(n.items=e(t.items)),t.properties&&(n.properties=Object.fromEntries(Object.keys(t.properties).map(function(n){var s=e(t.properties[n]);return[n,s]}).filter(function(e){return!!e[1]}))),n):null};function rZ(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,s)}return n}function rK(e){for(var t=1;t0&&void 0!==ew[0]?ew[0]:{}).endpoint)?"https://generativelanguage.googleapis.com":s,a=n.model,i=n.temperature,o=n.topP,l=n.topK,c=n.maxTokens,d=n.safetySettings,m=void 0===(u=n.contextLimit)?0:u,p=n.contextLengthOverride,h=n.signal,g=n.apiKey,f=n.stream,x=n.messages,b=n.functions,w=void 0===(v=n.extras)?{}:v,k=void 0===(A=n.headers)?{}:A,C=void 0===(N=n.onStreamStarted)?function(){}:N,I=void 0===(q=n.onStreamTextChunk)?function(e){}:q,n.onStreamFinished,n.onAPIStatusChanged,n.onModelUnavailable,E=void 0===(S=n.onContextSkipped)?function(){}:S,n.onFreeMessagesCountChanged,P=void 0===(V=n.onModelUsageChanged)?function(){}:V,M=void 0===(T=n.onAborted)?function(){}:T,B=void 0===(D=n.onStreamError)?function(){}:D,L=(0,O.xx)(a),_=(R=ru({model:a,messages:x,contextLimit:m,allowedContextLength:rm(p||(null==L?void 0:L.contextLength)),dependencies:{getEstimatedTokens:O.fI,getTextContent:O.FB}})).contextMessages,Z=R.skipped,!_.some(function(e){return Array.isArray(e.content)&&e.content.some(function(e){var t;return"image_url"===e.type&&!(null!==(t=e.image_url)&&void 0!==t&&null!==(t=t.url)&&void 0!==t&&t.startsWith("data:image"))})})){e.next=6;break}return e.abrupt("return",{error:"The model you are using (".concat(L.title,") only supports images with base64 format. This error usually occurs when you switch between models. Please start a new chat with the current model and upload new images!")});case 6:return null==E||E(Z),G=(K="https://generativelanguage.googleapis.com"===r)?"https://generativelanguage.googleapis.com/v1beta/models/".concat(L.modelID,":").concat(f?"streamGenerateContent":"generateContent","?key=").concat(g).concat(f?"&alt=sse":""):r,e.next=11,rL({messages:_,functions:b});case 11:return U=(Y=e.sent).contents,H=Y.tools,e.prev=14,e.next=17,fetch(G,{method:"POST",signal:h,body:JSON.stringify(rK({contents:U,tools:H,stream:K?void 0:f,model:K?void 0:L.modelID,generationConfig:rK({temperature:"number"==typeof i?i:void 0,topP:"number"==typeof o?o:void 0,topK:parseInt(l)?parseInt(l):void 0},parseInt(c)?{maxOutputTokens:parseInt(c)}:{}),safetySettings:d?Object.entries(d).map(function(e){var t=(0,y.Z)(e,2);return{category:t[0],threshold:t[1]}}):void 0},w)),headers:rK({"Content-Type":"application/json"},k)});case 17:F=e.sent,e.next=26;break;case 20:if(e.prev=20,e.t0=e.catch(14),"AbortError"!==e.t0.name){e.next=25;break}return M(),e.abrupt("return");case 25:throw e.t0;case 26:if(F.ok||(console.log("original messages",_),console.log("transformed messages",U)),500!==F.status){e.next=29;break}return e.abrupt("return",{error:"Could not connect to API server. Usually this is a temporary problem. Please try again. If the problem persist, please contact support."});case 29:if(!(F.status>=400)){e.next=39;break}return e.next=32,F.json();case 32:if(!(Q=e.sent).userMessage){e.next=35;break}return e.abrupt("return",{error:Q.userMessage});case 35:if(!((J=(null===(z=Q.error)||void 0===z?void 0:z.message)||(null===(W=Q[0])||void 0===W||null===(W=W.error)||void 0===W?void 0:W.message)).indexOf("not supported for StreamGenerateContent")>-1)){e.next=38;break}return e.abrupt("return",{error:"Sorry, your API Key does not have access to the model ".concat(L.title," (").concat(L.id,"). Please select another model.")});case 38:return e.abrupt("return",{error:"Sorry, the provider of this model has rejected your request (Message: ".concat(J||"(Unknown)","). Please try again or contact support.")});case 39:if(F.ok){e.next=41;break}return e.abrupt("return",{error:"Something went wrong. This could be a temporary network connection issue. Please try again or contact support. Opening the console might help clarifying the issue."});case 41:if(X=null,$=null,!f){e.next=85;break}ee=F.body.pipeThrough(new window.TextDecoderStream("utf8",{fatal:!0})).getReader(),C(),e.prev=46,et="";case 48:return e.next=51,ee.read();case 51:if(es=(en=e.sent).value,!en.done){e.next=56;break}return e.abrupt("break",78);case 56:et+=es,er=et.match(rG);case 58:if(!er){e.next=76;break}eo=void 0,e.prev=60,eo=JSON.parse(er[1]),e.next=69;break;case 64:throw e.prev=64,e.t1=e.catch(60),console.log(e.t1.message),console.log(es),e.t1;case 69:ec=(el=rR(eo)).content,ed=el.tool_calls,$=rK({role:"assistant",content:((null===(ea=$)||void 0===ea?void 0:ea.content)||"")+(ec||"")},ed?{tool_calls:ed}:(null===(ei=$)||void 0===ei?void 0:ei.tool_calls)||{}),I({content:$.content}),er=(et=et.substring(er[0].length)).match(rG),e.next=58;break;case 76:e.next=48;break;case 78:e.next=83;break;case 80:e.prev=80,e.t2=e.catch(46),"AbortError"===e.t2.name?ee.releaseLock():B(e.t2);case 83:e.next=89;break;case 85:return e.next=87,F.json();case 87:$=rK({role:"assistant"},rR(e.sent));case 89:return eu=F.headers.get("x-applied-model"),em=F.headers.get("x-hour-message-usage"),ep=F.headers.get("x-day-message-usage"),eh=F.headers.get("x-month-message-usage"),eg=F.headers.get("x-hour-character-usage"),ef=F.headers.get("x-day-character-usage"),ex=F.headers.get("x-month-character-usage"),P&&[em,ep,eh,eg,ef,ex].filter(Boolean).length>0&&P({model:eu||a,messages:{hour:em,day:ep,month:eh},charactersByPeriod:{hour:eg,day:ef,month:ex}}),ey={completion_tokens:eb=(0,O.fI)(null===(t=$)||void 0===t?void 0:t.content),prompt_tokens:ev=(0,O.fI)(x.map(function(e){return e.content}).join("\n")),total_tokens:eb+ev},e.abrupt("return",{response:rK(rK({},$),{},{model:a,usage:ey,finish:X})});case 101:case"end":return e.stop()}},e,null,[[14,20],[46,80],[60,64]])}))).apply(this,arguments)}function rU(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,s)}return n}function rH(e){for(var t=1;t'),i=(0,q.useState)("Copy Code"),o=i[0],l=i[1],c=(t=(0,x.Z)(j().mark(function e(){return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,navigator.clipboard.writeText(a);case 3:l("Copied!"),setTimeout(function(){l("Copy code")},500),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),l("Failed to copy");case 10:case"end":return e.stop()}},e,null,[[0,7]])})),function(){return t.apply(this,arguments)});return(0,S.jsx)(r0.pJ,{as:"div",className:"mt-4 mb-6",children:function(e){var t=e.open;return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(r0.lG,{className:"flex w-full items-center text-left font-semibold space-x-1",children:[(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"w9uz3G"})}),(0,S.jsx)("span",{className:"",children:t?(0,S.jsx)(r1.Z,{className:"w-5 h-5"}):(0,S.jsx)(r2.Z,{className:"w-5 h-5"})})]}),(0,S.jsxs)(r0.V2,{as:"div",className:"",children:[(0,S.jsx)("p",{className:"mt-3 mb-1",children:(0,S.jsx)(A.cC,{id:"Ug/Z77"})}),(0,S.jsx)("a",{href:s+"?agent=".concat(n.id),target:"_blank",className:"text-blue-500 cursor-pointer hover:underline",children:s+"?agent=".concat(n.id)}),r?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("p",{className:"mt-3 mb-1",children:"Code to embed chat widget with this specific AI agent:"}),(0,S.jsx)("div",{className:"bg-gray-200 p-2 whitespace-nowrap overflow-auto",children:(0,S.jsx)("code",{className:"w-fit text-sm",children:a})}),(0,S.jsx)("div",{className:"flex items-center justify-center mt-2 rounded-xl mx-auto px-2 py-1 border border-gray-300 shadow-sm w-fit",children:(0,S.jsx)("button",{className:"text-sm text-center font-semibold w-20",onClick:c,children:o})})]}):null]})]})}})}var r5=n(82262),r3=n(92777),r6=n(81531),r7=n(72179),r8=n(37247),r9=n(46576),ae=n(24845),at=n(85124),an=n(65850);function as(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var n,s=(0,r8.Z)(e);return n=t?Reflect.construct(s,arguments,(0,r8.Z)(this).constructor):s.apply(this,arguments),(0,r7.Z)(this,n)}}n(7739);var ar=function(e){for(var t,n=e.timeUnit,s=e.timeValue,r=e.userUsageValue,a=void 0===r?[]:r,i={hour:24,day:31,month:12},o={hour:(0,at.Z)(new Date),day:(0,an.Z)(new Date),month:(t=new Date,(0,ae.Z)(t)+1)},l=n===ao.HOUR?o[n]:o[n]-1,c=Math.floor(l/s)*s,d=0,u=c;un.quantity)throw new ac}),(0,b.Z)(h,al.CHARACTERS_BY_MESSAGE,function(e){var t=e.lastHumanMessage,n=e.rule;if(t.length>n.quantity)throw new ad}),(0,b.Z)(h,al.MESSAGES_BY_TIME,function(e){var t=e.rule,n=e.userUsageValue;if(ar({timeUnit:t.timeUnit,timeValue:t.timeValue,userUsageValue:n})+1>t.quantity)throw new ac});var au=function(e){var t=e.quantity,n=e.timeUnit,s=e.timeValue,r=e.limitBy,a=e.limitCheckIn;return{id:(0,tJ.Z)(),limitBy:r,limitCheckIn:a,quantity:t,timeValue:s,timeUnit:n}};function am(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,s)}return n}function ap(e){for(var t=1;t0&&(0,S.jsx)("div",{className:"mt-2 space-y-4",children:t.map(function(e,t){return(0,S.jsxs)("div",{className:"border border-gray-300 dark:border-gray-600 bg-white dark:bg-zinc-700 rounded-md p-4 shadow",children:[(0,S.jsxs)("div",{children:[(0,S.jsxs)("div",{className:"flex items-center justify-between gap-2 mb-2",children:[(0,S.jsxs)("div",{className:"font-semibold mb-1",children:[(0,S.jsx)(A.cC,{id:"p1R7Bt",values:{0:t+1}}),":"]}),(0,S.jsx)(eS,{disabled:f||s,onConfirmed:function(){n(function(t){return t.filter(function(t){return t.id!==e.id})})},className:"text-red-500 font-semibold hover:underline",children:(0,S.jsx)(A.cC,{id:"t/YqKh"})})]}),(0,S.jsxs)("select",{disabled:f||s,className:"w-full border border-gray-300 rounded-md shadow-sm py-2 pl-3 pr-10 text-base leading-6 focus:outline-none focus:ring-blue-500 focus:border-blue-500 transition duration-150 ease-in-out dark:bg-zinc-700",value:e.limitGroupID,onChange:function(t){var s=t.target.value;if(s){if(s===aA){u({name:"New Limit",rules:[],forLimitID:e.id});return}n(function(t){return t.map(function(t){return t.id!==e.id?t:aw(aw({},t),{},{limitGroupID:s})})})}},children:[p.map(function(e){return(0,S.jsx)("option",{value:e.id,children:e.name},e.id)}),(0,S.jsx)("option",{value:aA,children:"(Add new limit group)"})]})]}),(0,S.jsx)("div",{className:"font-semibold mb-1 mt-4",children:"Apply For Users:"}),(0,S.jsxs)("select",{disabled:f||s,className:"w-full border border-gray-300 rounded-md shadow-sm py-2 pl-3 pr-10 text-base leading-6 focus:outline-none focus:ring-blue-500 focus:border-blue-500 transition duration-150 ease-in-out dark:bg-zinc-700",value:e.appliedRule,onChange:function(t){var s=t.target.value;n(function(t){return t.map(function(t){return t.id!==e.id?t:aw(aw({},t),{},{appliedRule:s,userTags:"all"===s?[]:t.userTags})})})},children:[(0,S.jsx)("option",{value:"all",children:"All users"}),(0,S.jsx)("option",{value:"include",children:"Users with tags"}),(0,S.jsx)("option",{value:"exclude",children:"All users except users with tags"})]}),"all"!==e.appliedRule&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("div",{className:"font-semibold mb-1 mt-4",children:"User Tags:"}),(0,S.jsx)("div",{className:"relative z-10",children:(0,S.jsx)(ro,{disabled:f||s,tags:e.userTags,setTags:function(e){n(function(t){return t.map(function(t,n){return n!=n?t:aw(aw({},t),{},{userTags:e})})})},allowNew:!1,suggestions:null==r?void 0:r.map(function(e){return{id:e,name:e}}),placeholder:T.ag._({id:"k8Mebo"})})}),!(null!=r&&r.length)&&(0,S.jsx)("p",{className:"text-red-500 text-sm mt-1",children:"No tags found. Please go to Members page to set them up"})]})]},e.id)})}),(0,S.jsx)("div",{className:"mb-1 mt-2",children:(0,S.jsxs)("button",{disabled:f||s,onClick:function(){if(0===p.length){u({name:"New Limit",rules:[]});return}M()},className:"text-blue-500 font-semibold flex items-center justify-center gap-1 hover:underline",children:[(0,S.jsx)(C.wEH,{className:"w-4 h-4"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"qtYf+J"})})]})})]})}),(0,S.jsx)(X,{open:!!d,setOpen:function(){u(null)},max:!0,showCloseButton:!1,children:d&&(0,S.jsx)(av,{group:d,onSaved:function(e){V(),u(null),d.forLimitID?n(function(t){return t.map(function(t){return t.id!==d.forLimitID?t:aw(aw({},t),{},{limitGroupID:e.id})})}):M(e.id)},onDeleted:function(){u(null)},className:"!border-none !shadow-none !p-0"})})]})}function aN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,s)}return n}function aC(e){for(var t=1;t*]:my-0.5 disabled:cursor-default disabled:opacity-50",disabled:!en.trim()||eV,children:[(0,S.jsxs)("button",{onClick:tB,className:"space-x-1 inline-flex items-center text-sm font-medium rounded-md text-blue-600 hover:text-blue-700 focus:outline-none focus:underline transition-colors whitespace-nowrap gap-1",children:[eV&&(0,S.jsx)(E,{}),(0,S.jsxs)("span",{children:[!eV&&"\uD83E\uDE84"," ",(0,S.jsx)(A.cC,{id:"BSleER"}),tV?null:(0,S.jsx)("span",{className:"ml-1",children:"\uD83D\uDD12"})]})]}),(0,S.jsx)("span",{className:"text-sm font-medium",children:(0,S.jsx)(A.cC,{id:"Su8blH"})}),(0,S.jsx)("select",{className:"py-0 pl-1.5 w-fit pr-6 block rounded-md border-0 text-gray-900 dark:text-white dark:bg-zinc-700 ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-blue-600 sm:text-sm sm:leading-6",value:tC,onChange:function(e){tq(e.target.value)},children:tR.map(function(e){return(0,S.jsx)("option",{value:e.id,children:e.title},e.id)})})]}),(0,S.jsxs)("div",{className:"mb-1 mt-4",children:[(0,S.jsxs)("span",{"data-element-id":"ai-characters-system-instruction",className:"font-semibold ",children:[(0,S.jsx)(A.cC,{id:"ZGzNem"}),"*:"]}),(0,S.jsx)("div",{className:"text-xs text-gray-500",children:(0,S.jsx)(A.cC,{id:"BHoBQr"})}),R?(0,S.jsx)("div",{className:"text-xs text-orange-500",children:(0,S.jsx)(A.cC,{id:"t03RMp"})}):null]}),(0,S.jsx)("textarea",{"data-element-id":"ai-characters-system-instruction-input",disabled:eV||V,className:"block w-full border border-gray-300 dark:border-gray-600 rounded-md shadow-sm py-2 px-3 text-base leading-6 focus:outline-none focus:ring-blue-500 focus:border-blue-500 transition duration-150 ease-in-out dark:bg-zinc-700 disabled:opacity-50",rows:5,placeholder:tS._({id:"mLbNlk"}),value:eu,onChange:function(e){return em(e.target.value)},onKeyDown:tD}),eu?(0,S.jsxs)("div",{className:"text-xs text-gray-500 mt-1 text-right",children:[null===(u=eu.length)||void 0===u?void 0:u.toLocaleString()," characters"]}):null,(0,S.jsx)("div",{className:"mt-2",children:(0,S.jsx)(eJ,{className:"text-gray-200",label:tS._({id:"kzRPrD"}),description:U?tS._({id:"DkI3Vf"}):tS._({id:"nn8KcR"}),enabled:eh,setEnabled:eg})}),(0,S.jsxs)("div",{className:"",children:[(0,S.jsxs)("div",{className:"mb-1 mt-4",children:[(0,S.jsxs)("span",{"data-element-id":"ai-characters-system-instruction",className:"font-semibold ",children:[(0,S.jsx)(A.cC,{id:"pi6L1F"}),":"]}),(0,S.jsxs)("div",{className:"text-xs text-gray-500",children:[(0,S.jsx)(A.cC,{id:"6vm5iQ"})," ",(0,S.jsx)("a",{target:"_blank",rel:"noreferrer",className:"text-blue-500 font-semibold hover:underline",href:(null==tO||null===(m=tO.links)||void 0===m?void 0:m.docsDynamicContext)||"/guides/dynamic-context",children:(0,S.jsx)(A.cC,{id:"cer5ho"})})]}),R?(0,S.jsx)("div",{className:"text-xs text-orange-500",children:(0,S.jsx)(A.cC,{id:"38yscL"})}):null]}),(0,S.jsx)(rn,{dynamicContextEndpoints:eA,setDynamicContextEndpoints:ek,isUpdating:V,isOrgAdmin:U}),(0,S.jsx)("div",{className:"mb-1 mt-2",children:10>eA.length?(0,S.jsxs)("button",{onClick:function(){ek(function(e){return[].concat((0,v.Z)(e),[{id:(0,tJ.Z)(),name:"",url:"",method:"GET",cacheRefreshPolicy:"REFRESH_NEVER",cacheDurationHours:1}])})},className:"text-blue-500 font-semibold flex items-center justify-center gap-1 hover:underline",children:[(0,S.jsx)(C.wEH,{className:"w-4 h-4"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"axHfqA"})})]}):(0,S.jsx)("div",{className:"text-gray-500",children:(0,S.jsx)(A.cC,{id:"hzwvwf"})})})]}),(0,S.jsxs)("div",{className:"mb-1 mt-4",children:[(0,S.jsxs)("span",{"data-element-id":"ai-characters-welcome-message",className:"font-semibold ",children:[(0,S.jsx)(A.cC,{id:"/IAPcI"}),":"]}),(0,S.jsx)("div",{className:"text-xs text-gray-500",children:(0,S.jsx)(A.cC,{id:"jherDw"})})]}),(0,S.jsx)(rs.Z,{"data-element-id":"ai-characters-welcome-message-input",disabled:eV||V,className:"block w-full border border-gray-300 dark:border-gray-600 rounded-md shadow-sm py-2 px-3 text-base leading-6 focus:outline-none focus:ring-blue-500 focus:border-blue-500 transition duration-150 ease-in-out dark:bg-zinc-700 disabled:opacity-50",rows:3,placeholder:tS._({id:"C9r+t2"}),value:eq,onChange:function(e){return eI(e.target.value)},onKeyDown:tD}),(0,S.jsxs)("div",{children:[(0,S.jsxs)("div",{className:"mb-1 mt-4",children:[(0,S.jsxs)("span",{"data-element-id":"ai-characters-welcome-message",className:"font-semibold ",children:[(0,S.jsx)(A.cC,{id:"iqQ0P3"}),":"]}),(0,S.jsx)("div",{className:"text-xs text-gray-500",children:(0,S.jsx)(A.cC,{id:"yAyOUJ"})})]}),(0,S.jsx)("div",{className:"space-y-2",children:ey.map(function(e,t){return(0,S.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,S.jsx)("input",{type:"text",placeholder:"E.g., Hello assistant, what can you help me with?",className:"w-full border border-gray-300 dark:border-gray-600 rounded-md shadow-sm py-2 px-3 text-base leading-6 focus:outline-none focus:ring-blue-500 focus:border-blue-500 transition duration-150 ease-in-out dark:bg-zinc-700",value:e.text,onChange:function(e){ew(function(n){var s=(0,v.Z)(n);return s[t].text=e.target.value,s})},disabled:eV||V}),(0,S.jsx)(eS,{onConfirmed:function(){ew(function(e){var n=(0,v.Z)(e);return n.splice(t,1),n})},className:"text-red-500 font-semibold hover:underline",children:(0,S.jsx)(A.cC,{id:"t/YqKh"})})]},e.id)})}),(0,S.jsx)("div",{className:"mb-1 mt-2",children:(0,S.jsxs)("button",{onClick:function(){ew(function(e){return[].concat((0,v.Z)(e),[{id:(0,tJ.Z)(),text:""}])})},className:"text-blue-500 font-semibold flex items-center justify-center gap-1 hover:underline",children:[(0,S.jsx)(C.wEH,{className:"w-4 h-4"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"+7MTQz"})})]})})]}),D&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("div",{className:"font-semibold mb-1 mt-4",children:"Visibility:"}),(0,S.jsxs)("select",{className:"w-full border border-gray-300 rounded-md shadow-sm py-2 pl-3 pr-10 text-base leading-6 focus:outline-none focus:ring-blue-500 focus:border-blue-500 transition duration-150 ease-in-out dark:bg-zinc-700",value:eL?eH?"exceptTags":"onlyTags":"all",onChange:function(e){var t=e.target.value;"exceptTags"===t?ez(!0):ez(!1),"all"==t?(eR(!1),eK([])):eR(!0)},children:[(0,S.jsx)("option",{value:"all",children:"Visible to all users"}),(0,S.jsx)("option",{value:"onlyTags",children:"Visible only to users with tags"}),(0,S.jsx)("option",{value:"exceptTags",children:"Visible to all users except users with tags"})]})]}),eL&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("div",{className:"font-semibold mb-1 mt-4",children:"User Tags:"}),(0,S.jsx)("div",{className:"relative z-10",children:(0,S.jsx)(ro,{tags:eZ,setTags:eK,allowNew:!1,suggestions:null==B?void 0:B.map(function(e){return{id:e,name:e}}),placeholder:tS._({id:"k8Mebo"})})}),!(null!=B&&B.length)&&(0,S.jsx)("p",{className:"text-red-500 text-sm mt-1",children:"No tags found. Please go to Members page to set them up"})]}),void 0!==$&&$&&(0,S.jsxs)("div",{className:"mt-4",children:[(0,S.jsx)("div",{className:"mb-1 mt-4",children:(0,S.jsx)("span",{className:"font-semibold ",children:(0,S.jsx)(A.cC,{id:"jQkmDI"})})}),(0,S.jsx)(ak,{limits:tj,setLimits:tA,orgUserTags:B,entity:aa.CHARACTER,entityID:null==g?void 0:g.id,isNewEntity:!g,disabled:eV||V,onLimitsFetched:function(e){e&&g&&(g.appliedLimits=e)}})]}),G&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("div",{className:"font-semibold mb-1 mt-4",children:"Accessibility of Training Data:"}),(0,S.jsxs)("select",{className:"w-full border border-gray-300 rounded-md shadow-sm py-2 pl-3 pr-10 text-base leading-6 focus:outline-none focus:ring-blue-500 focus:border-blue-500 transition duration-150 ease-in-out dark:bg-zinc-700",value:tp,onChange:function(e){th(e.target.value),e.target.value!==O.NQ.WITH_TAGS&&tx([])},children:[(0,S.jsx)("option",{value:O.NQ.ALL,children:"Allow access to all training data"}),(0,S.jsx)("option",{value:O.NQ.NONE,children:"Not allow to access any training data"}),(0,S.jsx)("option",{value:O.NQ.WITH_TAGS,children:"Allow access only training data with tags"})]})]}),G&&tp===O.NQ.WITH_TAGS&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("div",{className:"font-semibold mt-4 mb-1",children:"Training Data Tags:"}),(0,S.jsxs)("div",{children:[(0,S.jsx)(ro,{tags:tf,setTags:function(e){tx(e)},allowNew:!1,suggestions:null===(p=G.data)||void 0===p?void 0:p.map(function(e){return{id:e,name:e}}),placeholder:G.loading?"Loading...":"Please select tags"}),G.error?(0,S.jsx)("p",{className:"text-red-500 text-sm mt-1",children:"Error while getting tags. Please try to reload the app or contact support"}):null!==(h=G.data)&&void 0!==h&&h.length?null:(0,S.jsx)("p",{className:"text-red-500 text-sm mt-1",children:"No tags found. Please go to Training Data page to set them up"})]})]}),(0,S.jsxs)("div",{children:[(0,S.jsxs)("div",{className:"mb-1 mt-4",children:[(0,S.jsxs)("div",{className:"font-semibold",children:[(0,S.jsx)(A.cC,{id:"37zp8q"}),":"]}),(0,S.jsx)("div",{className:"text-xs text-gray-500",children:(0,S.jsx)(A.cC,{id:"srA3JN"})})]}),ex.length>0&&(0,S.jsx)("div",{className:"mt-2",children:(0,S.jsx)("div",{className:"space-y-4",children:ex.map(function(e,t){return(0,S.jsxs)("div",{"data-element-id":"one-training-example-block",className:"border border-gray-300 dark:border-gray-600 bg-white dark:bg-zinc-700 rounded-md p-4 shadow",children:[(0,S.jsxs)("div",{children:[(0,S.jsxs)("div",{className:"flex items-center justify-between gap-2 mb-2",children:[(0,S.jsxs)("div",{className:"font-semibold mb-1",children:[(0,S.jsx)(A.cC,{id:"y9LVx0"}),":"]}),(0,S.jsx)(eS,{onConfirmed:function(){eb(function(e){return e.filter(function(e,n){return n!==t})})},className:"text-red-500 font-semibold hover:underline",children:(0,S.jsx)(A.cC,{id:"t/YqKh"})})]}),(0,S.jsx)("textarea",{disabled:eV||V,className:"w-full border border-gray-300 dark:border-gray-600 rounded-md shadow-sm py-2 px-3 text-base leading-6 focus:outline-none focus:ring-blue-500 focus:border-blue-500 transition duration-150 ease-in-out dark:bg-zinc-700 disabled:opacity-50",rows:3,placeholder:tS._({id:"QOqjv5"}),onKeyDown:tD,value:e.userText,onChange:function(e){eb(function(n){var s=(0,v.Z)(n);return s[t].userText=e.target.value,s})}})]}),(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"font-semibold my-2",children:(0,S.jsx)(A.cC,{id:"fyOcj3"})}),(0,S.jsx)("textarea",{disabled:eV||V,className:"w-full border border-gray-300 dark:border-gray-600 rounded-md shadow-sm py-2 px-3 text-base leading-6 focus:outline-none focus:ring-blue-500 focus:border-blue-500 transition duration-150 ease-in-out dark:bg-zinc-700 disabled:opacity-50",rows:3,placeholder:tS._({id:"4rpXj6"}),onKeyDown:tD,value:e.assistantText,onChange:function(e){eb(function(n){var s=(0,v.Z)(n);return s[t].assistantText=e.target.value,s})}})]})]},e.id)})})}),(0,S.jsxs)("div",{className:"mt-2 mb-4",children:[(0,S.jsxs)("button",{"data-element-id":"ai-characters-add-training-examples",onClick:function(){eb(function(e){return[].concat((0,v.Z)(e),[{id:(0,tJ.Z)(),userText:"",assistantText:""}])})},className:"text-blue-500 font-semibold flex items-center justify-center gap-1 hover:underline",children:[(0,S.jsx)(C.wEH,{className:"w-4 h-4"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"OF0JQ8"})})]}),R?(0,S.jsx)("div",{className:"text-xs text-orange-500",children:(0,S.jsx)(A.cC,{id:"bxlmA3"})}):null]})]}),(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"mb-1 mt-4",children:(0,S.jsxs)("span",{className:"font-semibold",children:[(0,S.jsx)(A.cC,{id:"Y9xqt2"}),":"]})}),(0,S.jsx)("div",{className:"mt-2",children:(0,S.jsx)(eJ,{className:"text-gray-200",label:tS._({id:"0CRwo2"}),description:tS._({id:"4aBfTf"}),enabled:e0,setEnabled:function(e){e1(e),e&&"none"===eQ&&eX(tR[0].id),e||eX("none")}})}),e0?(0,S.jsx)("select",{className:"block w-full rounded-md border-0 py-1.5 pl-3 pr-10 text-gray-900 dark:text-white dark:bg-zinc-700 ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-blue-600 sm:text-sm sm:leading-6 mt-2",value:eQ,onChange:function(e){eX(e.target.value),"none"===e.target.value&&e1(!1)},children:[].concat((0,v.Z)("none"===eQ||tR.map(function(e){return e.id}).includes(eQ)?[]:[{id:eQ,title:"⚠️ "+tS._({id:"UUd8gD"})}]),[{id:"none",title:tS._({id:"EdQY6l"})}],(0,v.Z)(tR)).map(function(e){return(0,S.jsx)("option",{value:e.id,children:e.title},e.id)})}):null]}),(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"mb-1 mt-4",children:(0,S.jsxs)("span",{className:"font-semibold",children:[(0,S.jsx)(A.cC,{id:"PJ+Oxg"}),":"]})}),(0,S.jsx)("div",{className:"mt-2",children:(0,S.jsx)(eJ,{className:"text-gray-200",label:"Assign plugins for this AI agent",description:"Users can't change the plugins when using this AI agent.",enabled:e6,setEnabled:function(e){e7(e),e||e5({})}})}),e6?(0,S.jsx)("div",{className:"my-4 space-y-2 pl-4",children:F.map(function(e){return(0,S.jsx)(eJ,{label:(0,S.jsxs)("span",{children:[(0,S.jsx)(s2,{plugin:e})," ",e.title,e.isServerPlugin?(0,S.jsx)("span",{className:"font-semibold bg-gray-200 text-xs px-1 py-0.5 rounded ml-2",children:"Server Plugin"}):null]}),enabled:!!e4[e.id],setEnabled:function(t){e5(function(n){return aC(aC({},n),{},(0,b.Z)({},e.id,t?{uuid:e.uuid,id:e.id,title:e.title,emoji:e.emoji,iconURL:e.iconURL,isServerPlugin:e.isServerPlugin}:void 0))})},locked:!0===e.disabled},e.id)})}):null]}),(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"mb-1 mt-4",children:(0,S.jsxs)("span",{className:"font-semibold",children:[(0,S.jsx)(A.cC,{id:"dR6shC"}),":"]})}),(0,S.jsx)("div",{className:"mt-2",children:(0,S.jsx)(eJ,{className:"text-gray-200",label:"Assign text-to-speech settings for this AI agent",enabled:e9,setEnabled:te})}),e9&&(0,S.jsx)(rd,{isOrgAdmin:U,orgOpenAIAPIKey:z,orgElevenLabsAPIKey:H,speechSettings:tn,setSpeechSettings:ts})]}),(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"mb-1 mt-4",children:(0,S.jsxs)("span",{className:"font-semibold",children:[(0,S.jsx)(A.cC,{id:"P2JOdR"}),":"]})}),(0,S.jsx)("div",{className:"mt-2",children:(0,S.jsx)(eJ,{className:"text-gray-200",label:"Assign advanced model parameters for this AI agent",enabled:ta,setEnabled:ti})}),ta&&(0,S.jsx)("div",{className:"mt-4",children:(0,S.jsx)(r$,aC(aC({},tl),{},{setTemperature:function(e){return tc({temperature:e})},setPresencePenalty:function(e){return tc({presencePenalty:e})},setFrequencyPenalty:function(e){return tc({frequencyPenalty:e})},setTopP:function(e){return tc({topP:e})},setTopK:function(e){return tc({topK:e})},setMaxTokens:function(e){return tc({maxTokens:e})},setSafetySettings:function(e){return tc({safetySettings:e})},setContextLimit:function(e){return tc({contextLimit:e})},setPromptCachingEnabled:function(e){return tc({promptCachingEnabled:e})},showEnablePromptCachingOption:X}))})]}),null!=g&&g.id&&J?(0,S.jsx)(r4,{isOrgAdmin:U,character:g,instanceBaseURL:J}):null,eM&&(0,S.jsxs)("p",{className:"my-2 text-sm text-red-500",children:[" ",eM]}),(0,S.jsx)("div",{className:"text-center",children:tL()})]})]})}function aV(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,s)}return n}function aP(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:{},n=t.newName,s=t.newID,r=aP(aP(aP({},e),{},{title:e.title+(void 0===n||n?" (New Copy)":"")},void 0===s||s?{id:"a-"+(0,tJ.Z)(),type:"user"}:{}),{},{pinned:!0});N([].concat((0,v.Z)(k||[]),[r]))},ed=(0,q.useMemo)(function(){return(k||[]).reduce(function(e,t){return e[t.id]=!0,e},{})},[k]),eu=function(e){Z(aP(aP({},ed),{},(0,b.Z)({},e.id,!0)))},em=function(e){N(k.map(function(t){return t.id!==e.id?t:aP(aP(aP({},t),e),{},{syncedAt:null})}))},ep=(0,q.useMemo)(function(){return[].concat((0,v.Z)(k||[]),(0,v.Z)(l||[])).reduce(function(e,t){return Array.isArray(t.categories)&&t.categories.forEach(function(t){e.includes(t)||e.push(t)}),e},[]).filter(Boolean).sort(function(e,t){return e.localeCompare(t)})},[k,l]),eh=(0,q.useMemo)(function(){return eo.reduce(function(e,t){return(t.categories||[]).forEach(function(n){var s=e.find(function(e){return e.id===n});s||(s={id:n,title:n,data:[]},e.push(s)),s.data.push(t)}),e},[]).filter(function(e){return e.data.length>0}).sort(function(e,t){var n=aB.indexOf(e.title),s=aB.indexOf(t.title);return -1===n&&-1===s?e.title.localeCompare(t.title):-1===n?-1:-1===s?1:n-s})},[eo]),eg=[].concat((0,v.Z)(k||[]),(0,v.Z)(l||[])),ef=h?aL(eg,h):eg;ef.length;var ex=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.showButtons,r=void 0===n?["clone","edit","remove","share"]:n,a=(0,v.Z)(e||[]).sort(function(e,t){return"title"===$?e.title.localeCompare(t.title):"createdAt"===$?new Date(t.createdAt)-new Date(e.createdAt):"lastUsedAt"===$?new Date(t.lastUsedAt)-new Date(e.lastUsedAt):0});return(0,S.jsx)("div",{className:"grid @[640px]:grid-cols-2 @[1000px]:grid-cols-3 @[1400px]:grid-cols-4 grid-cols-1 gap-2",children:a.map(function(e){var t;return(0,S.jsxs)("div",{"data-element-id":"one-ai-character-block",onClick:function(){ei(e),s(e)},className:"border cursor-pointer w-full border-gray-200 rounded-xl overflow-hidden shadow-sm p-4 text-left flex flex-col items-start justify-between hover:shadow-md transition-all dark:border-gray-600 group hover:ring-4",children:[(0,S.jsxs)("div",{className:"flex items-start justify-start gap-4 w-full",children:[(0,S.jsx)("div",{className:"flex-shrink-0 pt-1.5",children:(0,S.jsx)(sB,{character:e,size:"medium"})}),(0,S.jsxs)("div",{className:"flex items-start justify-start gap-2 flex-col",children:[(0,S.jsx)("div",{className:"text-lg font-semibold flex items-center justify-center space-x-2 leading-6",children:(0,S.jsxs)("div",{className:"line-clamp-1",children:[e.premium&&!et?(0,S.jsx)("span",{className:"ml-1",children:"\uD83D\uDD12"}):null,e.title]})}),(0,S.jsx)("div",{className:"text-xs text-gray-500 mb-auto whitespace-pre-line line-clamp-2",children:e.description})]}),!(null!=r&&r.includes("add"))&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("button",{className:function(){for(var e=arguments.length,t=Array(e),n=0;n0&&void 0!==arguments[0]?arguments[0]:{},t=e.includingHidden,n=void 0===t||t,s=_(),r=s.serverHostConfig,a=r.enableClaude,i=r.enableGPT,o=r.systemModels,l=r.modelSettings,c=aH([]),d=(0,y.Z)(c,2),u=d[0];d[1];var m=az(s.serverHostConfig.modelIDsOrder||[]),p=(0,y.Z)(m,2),h=p[0],g=p[1],f=Array.isArray(h)?h:[],x=aW(O.L.filter(function(e){return e.old}).map(function(e){return e.id})),b=(0,y.Z)(x,2),w=b[0],j=b[1],A=(0,q.useMemo)(function(){var e;return Object.fromEntries(((null===(e=s.serverHostConfig.externalAuthConfig)||void 0===e?void 0:e.type)!=="setapp"&&s.serverHostConfig.modelIDsOrder||f||[]).map(function(e,t){return[e,t+1]}))},[f]),k=(0,q.useMemo)(function(){var e=[].concat((0,v.Z)((o||[]).map(function(e){return aU(aU({},e),{},{system:!0})})),(0,v.Z)(O.L));return a||(e=e.filter(function(e){return!e.id.startsWith("claude")})),i||(e=e.filter(function(e){return!e.id.startsWith("gpt")})),e.filter(function(e){return!!e.system||!l||l[e.id]}).sort(function(e,t){return e.system!==t.system?e.system?-1:1:e.new&&!t.new?-1:0})},[l,a,i,o]),N=(0,q.useMemo)(function(){return[].concat((0,v.Z)(k),(0,v.Z)(u)).filter(function(e){return!(!n&&w.includes(e.id))})},[k,w,n,u]),C=(0,q.useMemo)(function(){return(0,v.Z)(N).sort(function(e,t){return A[e.id]&&A[t.id]?A[e.id]-A[t.id]:A[e.id]||A[t.id]?A[e.id]?A[t.id]?void 0:1:-1:0})},[N,A]);return(0,q.useEffect)(function(){f.length||g(C.map(function(e){return e.id}))},[f,C]),{allModels:C,targetModels:k,hiddenModelIDs:w,setHiddenModelIDs:j,modelIDsOrder:f,setModelIDsOrder:g}},aJ=(0,K.eK)("useCustomModels");function aX(){for(var e=arguments.length,t=Array(e),n=0;n0?(0,S.jsxs)("div",{className:"mt-4",children:[(0,S.jsx)("label",{className:"block text-sm font-medium leading-6",children:(0,S.jsx)(A.cC,{id:"Bav+e0"})}),(0,S.jsx)("div",{className:" space-y-2 my-2",children:i.map(function(e){return(0,S.jsx)(aG,{onSelected:function(e){return n(e)},model:e,onEdit:function(){return s(e)}},e.id)})})]}):null]})}function a0(e){var t=e.models,n=e.selectedOrModels,s=e.setSelectedOrModels;return(0,S.jsx)("div",{className:"w-full my-2",children:(0,S.jsx)("div",{className:"w-full text-sm max-h-[400px] overflow-auto",children:(0,S.jsxs)("table",{className:"min-w-full bg-white dark:bg-gray-800",children:[(0,S.jsx)("thead",{className:"bg-gray-800 text-white sticky top-0",children:(0,S.jsxs)("tr",{children:[(0,S.jsx)("th",{className:"py-2 px-4 text-left",children:(0,S.jsx)("input",{type:"checkbox",onChange:function(e){e.target.checked?s(t):s([])}})}),(0,S.jsx)("th",{className:"py-2 px-4 text-left",children:(0,S.jsx)(A.cC,{id:"6YtxFj"})}),(0,S.jsx)("th",{className:"py-2 px-4 text-left",children:(0,S.jsx)(A.cC,{id:"wmnTZp"})})]})}),(0,S.jsx)("tbody",{className:"overflow-y-auto",children:t.map(function(e,t){return(0,S.jsxs)("tr",{className:"border-b border-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700 dark:border-gray-600",children:[(0,S.jsx)("td",{className:"py-2 px-4",children:(0,S.jsx)("input",{type:"checkbox",onChange:function(t){t.target.checked?s([].concat((0,v.Z)(n),[e])):s(n.filter(function(t){return t!==e}))},checked:n.includes(e)})}),(0,S.jsxs)("td",{className:"py-2 px-4",children:[(0,S.jsx)("div",{children:e.name}),(0,S.jsx)("div",{className:"text-xs text-gray-500",children:e.id})]}),(0,S.jsx)("td",{className:"py-2 px-4 text-sm",children:(0,S.jsx)("div",{children:(e.context_length||0).toLocaleString()})})]},e.id)})})]})})})}function a1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,s)}return n}function a2(e){for(var t=1;t0&&!t.headerRows.every(function(e){return s.every(function(t){return t in e})}))return ed(T.ag._({id:"ZHX2Nv"})),!1;if(t.bodyRows&&t.bodyRows.length>0&&!t.bodyRows.every(function(e){return r.every(function(t){return t in e})}))return ed(T.ag._({id:"OvyFOO"})),!1;return!0}catch(e){return console.error("Error while validating imported json file: ",e),ed(a4),!1}},eW=(t=(0,x.Z)(j().mark(function e(){var t,n,s,r,a;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(P(!0),ed(""),ep(!1),t={},"import-json"!==eq){e.next=22;break}if(e.prev=5,ez(eO)){e.next=11;break}return P(!1),e.abrupt("return");case 11:(t=JSON.parse(eO)).id=(0,tJ.Z)(),t.skipAPIKey=!0,null!==(n=t)&&void 0!==n&&n.headerRows&&t.headerRows.forEach(function(e){e.id=(0,tJ.Z)()}),null!==(s=t)&&void 0!==s&&s.bodyRows&&t.bodyRows.forEach(function(e){e.id=(0,tJ.Z)()}),eM(t);case 17:e.next=22;break;case 19:e.prev=19,e.t0=e.catch(5),console.error("Error while processing json content from importing: ",e.t0);case 22:return e.prev=22,r="import-json"===eq?t:eU,e.next=26,rz(a2(a2({},N?{proxyEndpoint:"/api/hosted/run_test_completions",options:{extras:{forwardedEndpointForProxy:r.endpoint,customModelHeaderRows:r.headerRows}}}:{}),{},{model:"import-json"===eq?t.modelID:ee,modelInfo:r,messages:[{role:"user",content:"hello"}]}));case 26:(a=e.sent)&&a.response?ep(!0):ed(T.ag._({id:"Yyo7E4"})),e.next=34;break;case 30:e.prev=30,e.t1=e.catch(22),console.error(e.t1),ed(T.ag._({id:"Rq8+VB"})+e.t1.message);case 34:P(!1);case 35:case"end":return e.stop()}},e,null,[[5,19],[22,30]])})),function(){return t.apply(this,arguments)}),eQ=(n=(0,x.Z)(j().mark(function e(){var t;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return P(!0),ed(""),e.prev=2,e.next=5,fetch("https://openrouter.ai/api/v1/chat/completions",{method:"POST",headers:{Authorization:"Bearer ".concat(eB),"HTTP-Referer":"https://www.typingmind.com","X-Title":"TypingMind.com","Content-Type":"application/json"},body:JSON.stringify({messages:[{role:"system",content:"Test"}]})});case 5:if(!((t=e.sent).status>=401)){e.next=10;break}return ed("Invalid API key. Please check your API key and try again."),P(!1),e.abrupt("return");case 10:if(!(t.status>=400)){e.next=17;break}return e.next=13,t.json();case 13:case 27:return ed(e.sent.userMessage||a4),P(!1),e.abrupt("return");case 17:if(t.ok){e.next=21;break}return ed(a4),P(!1),e.abrupt("return");case 21:return e.next=23,fetch("https://openrouter.ai/api/v1/models",{method:"GET",headers:{"Content-Type":"application/json"}});case 23:if(!((t=e.sent).status>=400)){e.next=31;break}return e.next=27,t.json();case 31:if(t.ok){e.next=35;break}return ed(a4),P(!1),e.abrupt("return");case 35:return e.next=37,t.json();case 37:eZ(e.sent.data||[]),e.next=45;break;case 41:e.prev=41,e.t0=e.catch(2),ed(a4),console.error("or test failed",e.t0);case 45:P(!1);case 46:case"end":return e.stop()}},e,null,[[2,41]])})),function(){return n.apply(this,arguments)}),eX=(s=(0,x.Z)(j().mark(function e(t){return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,d(t.map(function(e){var t;return t={title:e.name,description:K,iconUrl:Y},(0,b.Z)(t,"iconUrl","https://openrouter.ai/icon.png"),(0,b.Z)(t,"endpoint","https://openrouter.ai/api/v1/chat/completions"),(0,b.Z)(t,"id",(0,tJ.Z)()),(0,b.Z)(t,"modelID",e.id),(0,b.Z)(t,"apiType","openai"),(0,b.Z)(t,"contextLength",e.context_length),(0,b.Z)(t,"headerRows",[{key:"Authorization",value:"Bearer ".concat(eB)},{key:"X-Title",value:"TypingMind.com"},{key:"HTTP-Referer",value:"https://www.typingmind.com"}].concat((0,v.Z)(eg))),(0,b.Z)(t,"bodyRows",eb),(0,b.Z)(t,"pluginSupported",ew),(0,b.Z)(t,"visionSupported",ek),(0,b.Z)(t,"skipAPIKey",!0),t}));case 2:null==l||l();case 3:case"end":return e.stop()}},e)})),function(e){return s.apply(this,arguments)}),e$=(r=(0,x.Z)(j().mark(function e(){return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("import-json"!==eq){e.next=6;break}return e.next=3,d([eT]);case 3:null==l||l(),e.next=29;break;case 6:if(!(R&&z&&ee&&es)){e.next=28;break}if(!eY){e.next=12;break}return e.next=10,u(eU);case 10:e.next=14;break;case 12:return e.next=14,d([eU]);case 14:B(""),_(""),G(""),U(""),W(""),et(""),er("openai"),X(2048),eo(!1),ef([]),ev([]),null==l||l(),e.next=29;break;case 28:ed(T.ag._({id:"wwrAsK"}));case 29:case"end":return e.stop()}},e)})),function(){return r.apply(this,arguments)}),e0=function(){return(0,S.jsxs)("div",{className:(0,O.AK)("sm"===g?"space-y-2":"space-y-4"),children:[(0,S.jsx)("div",{children:(0,S.jsx)(eJ,{enabled:ew,setEnabled:ej,label:T.ag._({id:"r41Eim"}),description:T.ag._({id:"uOYIwm"})})}),(0,S.jsx)("div",{children:(0,S.jsx)(eJ,{enabled:ek,setEnabled:eN,label:T.ag._({id:"IHh1FJ"}),description:T.ag._({id:"CsVLg/"})})}),eg.length?(0,S.jsxs)("div",{className:(0,O.AK)("sm"===g?"text-sm":"text-base"),children:[(0,S.jsx)("div",{className:"flex items-center justify-between mb-1",children:(0,S.jsx)("label",{className:"block font-medium leading-6",children:(0,S.jsx)(A.cC,{id:"GnfGTT"})})}),(0,S.jsx)("div",{className:"space-y-2",children:eg.map(function(e,t){return(0,S.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,S.jsx)("input",{type:"text",style:{fontSize:"inherit"},placeholder:T.ag._({id:"F6Go3M"}),className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-zinc-700",autoComplete:"off",disabled:V,value:e.key,onChange:function(e){var n=(0,v.Z)(eg);n[t].key=e.target.value,ef(n)}}),(0,S.jsx)("input",{type:"text",style:{fontSize:"inherit"},placeholder:T.ag._({id:"BCL8Ot"}),className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-zinc-700",autoComplete:"off",disabled:V,value:e.value,onChange:function(e){var n=(0,v.Z)(eg);n[t].value=e.target.value,ef(n)}}),(0,S.jsx)(eS,{className:"text-red-500 font-semibold min-w-[55px]",onConfirmed:function(){var e=(0,v.Z)(eg);e.splice(t,1),ef(e)},children:(0,S.jsx)(A.cC,{id:"t/YqKh"})})]},e.id||t)})})]}):null,(0,S.jsx)("div",{className:"flex items-center justify-start gap-2",children:(0,S.jsxs)("button",{onClick:function(){ef(function(e){return[].concat((0,v.Z)(e),[{id:(0,tJ.Z)(),key:"x-header-key",value:T.ag._({id:"BCL8Ot"})}])})},className:"flex items-center justify-start gap-2 text-blue-500 font-semibold hover:underline",children:[(0,S.jsx)(C.wEH,{className:"w-4 h-4"})," ",(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"iT8p0P"})})]})}),eb.length?(0,S.jsxs)("div",{className:(0,O.AK)("sm"===g?"text-sm":"text-base"),children:[(0,S.jsx)("div",{className:"flex items-center justify-between mb-1",children:(0,S.jsx)("label",{className:"block font-medium leading-6",children:(0,S.jsx)(A.cC,{id:"pC7150"})})}),(0,S.jsx)("div",{className:"space-y-2",children:eb.map(function(e,t){return(0,S.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,S.jsxs)("div",{className:"grow grid grid-cols-2 xs:grid-cols-[auto_1fr_1fr] items-center gap-2",children:[(0,S.jsxs)("select",{style:{fontSize:"inherit"},className:"w-full min-w-[100px] px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-zinc-700",value:e.type,onChange:function(e){var n=(0,v.Z)(eb);n[t].type=e.target.value,ev(n)},children:[(0,S.jsx)("option",{value:"string",children:"string"}),(0,S.jsx)("option",{value:"number",children:"number"}),(0,S.jsx)("option",{value:"boolean",children:"boolean"}),(0,S.jsx)("option",{value:"object",children:"object"})]}),(0,S.jsx)("input",{type:"text",style:{fontSize:"inherit"},placeholder:T.ag._({id:"8B+pY5"}),className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm dark:bg-zinc-700",autoComplete:"off",disabled:V,value:e.key,onChange:function(e){var n=(0,v.Z)(eb);n[t].key=e.target.value,ev(n)}}),(0,S.jsx)("input",{type:"text",style:{fontSize:"inherit"},placeholder:T.ag._({id:"i+CFi4"}),className:"w-full col-span-2 xs:col-span-1 px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm dark:bg-zinc-700",autoComplete:"off",disabled:V,value:e.value,onChange:function(e){var n=(0,v.Z)(eb);n[t].value=e.target.value,ev(n)}})]}),(0,S.jsx)(eS,{className:"text-red-500 font-semibold min-w-[55px]",onConfirmed:function(){var e=(0,v.Z)(eb);e.splice(t,1),ev(e)},children:(0,S.jsx)(A.cC,{id:"t/YqKh"})})]},e.id)})})]}):null,(0,S.jsx)("div",{className:"flex items-center justify-start gap-2",children:(0,S.jsxs)("button",{onClick:function(){ev(function(e){return[].concat((0,v.Z)(e),[{id:(0,tJ.Z)(),key:"Key",value:"Value",type:"string"}])})},className:"flex items-center justify-start gap-2 text-blue-500 font-semibold hover:underline",children:[(0,S.jsx)(C.wEH,{className:"w-4 h-4"})," ",(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"6clT5o"})})]})})]})};return(0,S.jsxs)("div",{className:(0,O.AK)("p-2 bg-gray-100 dark:bg-gray-900 dark:border-gray-600 rounded-md shadow border-gray-200 border","sm"===g?"p-2 space-y-2":"p-4 space-y-4"),children:[(0,S.jsxs)("div",{children:[(0,S.jsxs)("div",{className:"p-2 rounded-md border-gray-300 dark:border-gray-600 border relative mt-4 pt-2",children:[(0,S.jsx)("div",{className:(0,O.AK)("sm"===g?"text-xs":"text-sm","absolute w-full text-center -top-2"),children:(0,S.jsx)("span",{className:"rounded-full bg-gray-100 dark:bg-gray-900 px-2 py-1",children:(0,S.jsx)(A.cC,{id:"07Y2l2"})})}),(0,S.jsxs)("div",{className:(0,O.AK)(" mt-1 flex flex-wrap gap-2","sm"===g?"text-xs":"text-sm"),children:[(0,S.jsxs)("a",{className:"text-blue-900 hover:bg-blue-300 px-2 py-1 rounded-md bg-blue-200 inline-block transition-colors",target:"_blank",rel:"noreferrer",href:(null==f?void 0:f.docsCustomModels)||"https://docs.typingmind.com/chat-models-settings/use-with-mistral-ai",children:["→ ",(0,S.jsx)(A.cC,{id:"lXJuyl"})]}),(0,S.jsxs)("a",{className:"text-blue-900 hover:bg-blue-300 px-2 py-1 rounded-md bg-blue-200 inline-block transition-colors",target:"_blank",rel:"noreferrer",href:(null==f?void 0:f.docsOpenRouter)||"https://docs.typingmind.com/other-resources/how-tos/how-to-use-open-router-models-on-typing-mind",children:["→ ",(0,S.jsx)(A.cC,{id:"seLMUl"})]}),(0,S.jsxs)("a",{className:"text-blue-900 hover:bg-blue-300 px-2 py-1 rounded-md bg-blue-200 inline-block transition-colors",target:"_blank",rel:"noreferrer",href:(null==f?void 0:f.docsPerplexity)||"https://docs.typingmind.com/chat-models-settings/use-with-perplexity-ai",children:["→ ",(0,S.jsx)(A.cC,{id:"hgrGkS"})]}),(0,S.jsxs)("a",{className:"text-blue-900 hover:bg-blue-300 px-2 py-1 rounded-md bg-blue-200 inline-block transition-colors",target:"_blank",rel:"noreferrer",href:(null==f?void 0:f.docsAzureOpenAI)||"https://docs.typingmind.com/other-resources/how-tos/use-azure-openai-on-typingmind.com",children:["→ ",(0,S.jsx)(A.cC,{id:"hksWkB"})]}),(0,S.jsxs)("a",{className:"text-blue-900 hover:bg-blue-300 px-2 py-1 rounded-md bg-blue-200 inline-block transition-colors",target:"_blank",rel:"noreferrer",href:(null==f?void 0:f.docsCustomModels)||"https://docs.typingmind.com/other-resources/use-custom-models-or-local-models-in-typing-mind-(vicuna-alpaca-llama-gpt4all-dolly-etc.)",children:["→"," ",(0,S.jsx)(A.cC,{id:"j8TVcH"})]}),(0,S.jsxs)("a",{className:"text-blue-900 hover:bg-blue-300 px-2 py-1 rounded-md bg-blue-200 inline-block transition-colors",target:"_blank",rel:"noreferrer",href:(null==f?void 0:f.docsCustomModels)||"https://docs.typingmind.com/chat-models-settings/use-with-ollama-(local-models:-llava-llama2-mistral-orca-etc.)",children:["→"," ",(0,S.jsx)(A.cC,{id:"NIhxhS"})]})]})]}),(0,S.jsx)("div",{className:(0,O.AK)("sm"===g?"text-xs":"text-sm","mt-1"),children:(0,S.jsx)(A.cC,{id:"yA1cUG"})})]}),!eY&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("p",{className:(0,O.AK)("dark:text-gray-50 text-gray-800 pt-2","sm"===g?"text-sm":"text-base"),children:(0,S.jsx)(A.cC,{id:"x3hlms"})}),(0,S.jsxs)("fieldset",{children:[(0,S.jsx)("legend",{className:"sr-only",children:"Input Options"}),(0,S.jsx)("div",{className:"flex flex-col gap-2 sm:flex-row",children:a5.map(function(e){return(0,S.jsxs)("div",{className:"flex items-center",children:[(0,S.jsx)("input",{id:e.id,name:"input-method",type:"radio",defaultChecked:e.id===eq,className:"h-4 w-4 border-gray-300 text-blue-600 focus:ring-blue-600 cursor-pointer disabled:cursor-not-allowed",onClick:function(){return eH(e.id)},disabled:V}),(0,S.jsx)("label",{htmlFor:e.id,className:(0,O.AK)(V?"text-gray-400":"text-gray-900 dark:text-gray-50","ml-1 block font-medium leading-6 cursor-pointer text-sm"),children:e.title})]},e.id)})})]})]}),"import-open-router"===eq&&(0,S.jsx)("div",{className:(0,O.AK)("flex flex-col w-full mx-auto my-4","lg"===g&&"!mt-4 "),children:(0,S.jsxs)("div",{children:[(0,S.jsxs)("div",{className:" flex items-center justify-center gap-2",children:[(0,S.jsx)("input",{type:"password",disabled:V,value:eB,onChange:function(e){return eL(e.target.value)},placeholder:T.ag._({id:"hITuUq"}),className:"w-full appearance-none block px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-blue-600 focus:border-blue-600 sm:text-sm disabled:text-gray-500 text-black",onKeyDown:function(e){"Enter"===e.key&&(e.preventDefault(),eQ())}}),(0,S.jsxs)("button",{onClick:eQ,type:"submit",className:"inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 gap-2 flex-shrink-0",disabled:V,children:[V?(0,S.jsx)(E,{}):"→",(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"q9j23+"})})]})]}),e_.length?(0,S.jsxs)("div",{children:[(0,S.jsx)(a0,{models:e_,onModelsSelected:eX,selectedOrModels:eG,setSelectedOrModels:eF}),e0(),(0,S.jsx)("div",{className:"w-full text-center my-4",children:(0,S.jsxs)("button",{onClick:function(){return eX(eG)},disabled:0===eG.length||p,type:"submit",className:"inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 gap-2 flex-shrink-0",children:[p?(0,S.jsx)(E,{}):null,(0,S.jsx)(A.cC,{id:"D8LFE+",values:{0:eG.length}})]})})]}):null]})}),"import-json"===eq&&(0,S.jsx)("div",{className:(0,O.AK)("flex flex-col w-full mx-auto","lg"===g&&"!mt-4 "),children:(0,S.jsxs)("div",{children:[(0,S.jsx)("label",{htmlFor:"json-file",className:"block text-xs leading-6 text-gray-500 sr-only",children:(0,S.jsx)(A.cC,{id:"leS9hw"})}),(0,S.jsx)("div",{className:"",children:(0,S.jsx)("textarea",{onChange:function(e){return eV(e.target.value)},type:"text",name:"json-file",id:"json-file",style:{fontSize:"inherit"},className:"bg-gray-50 dark:bg-gray-800 hover:border-blue-400 cursor-default block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-blue-600 sm:leading-6 dark:text-white",placeholder:"Enter your JSON content here",rows:10})})]})}),"input-manually"===eq&&(0,S.jsxs)("div",{className:(0,O.AK)("bg-gray-50 border border-gray-300 p-3 dark:bg-gray-800 rounded-lg space-y-3","sm"===g?"text-sm p-3":"!mt-4 text-base p-3 md:p-4"),children:[(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"flex items-center justify-between mb-1",children:(0,S.jsx)("label",{className:"block font-medium leading-6",children:(0,S.jsx)(A.cC,{id:"6YtxFj"})})}),(0,S.jsx)("input",{type:"text",placeholder:"e.g., GPT4All",style:{fontSize:"inherit"},className:"text-sm w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-zinc-700",value:R,onChange:function(e){return _(e.target.value)},disabled:V})]}),y&&(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"flex items-center justify-between mb-1",children:(0,S.jsxs)("label",{className:"block font-medium leading-6",children:[(0,S.jsx)(A.cC,{id:"bd1Kuw"})," (Optional)"]})}),(0,S.jsx)("input",{type:"text",style:{fontSize:"inherit"},placeholder:"https://...",className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-zinc-700",value:Y,onChange:function(e){return U(e.target.value)},disabled:V})]}),w&&(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"flex items-center justify-between mb-1",children:(0,S.jsx)("label",{className:"block font-medium leading-6",children:(0,S.jsx)(A.cC,{id:"Nu4oKW"})})}),(0,S.jsx)("input",{type:"text",style:{fontSize:"inherit"},placeholder:"e.g., Suitable for simple creative writing tasks",className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm dark:bg-zinc-700",value:K,onChange:function(e){return G(e.target.value)},disabled:V})]}),(0,S.jsxs)("div",{children:[(0,S.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,S.jsx)("label",{className:"block font-medium leading-6",children:(0,S.jsx)(A.cC,{id:"FCKppt"})}),(0,S.jsx)("div",{className:"text-xs text-right",children:(0,S.jsx)(A.cC,{id:"b1cX7J"})})]}),(0,S.jsx)("input",{type:"text",style:{fontSize:"inherit"},placeholder:"http://localhost:8080/v1/completions",className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-zinc-700",value:z,autoComplete:"off",onChange:function(e){return W(e.target.value)},disabled:V})]}),(0,S.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,S.jsxs)("div",{className:"w-full",children:[(0,S.jsx)("div",{className:"flex items-center justify-between mb-1",children:(0,S.jsx)("label",{className:"block font-medium leading-6",children:(0,S.jsx)(A.cC,{id:"IzB3v0"})})}),(0,S.jsx)("input",{type:"text",style:{fontSize:"inherit"},placeholder:"e.g., ggml-gpt4all-j-v1.3-groovy.bin",className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-zinc-700",autoComplete:"off",value:ee,onChange:function(e){return et(e.target.value)},disabled:V})]}),(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"flex items-center justify-between mb-1",children:(0,S.jsx)("label",{className:"block font-medium leading-6",children:(0,S.jsx)(A.cC,{id:"wmnTZp"})})}),(0,S.jsx)("input",{type:"text",placeholder:"e.g., 2048",style:{fontSize:"inherit"},className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-zinc-700",autoComplete:"off",value:J,onChange:function(e){return X(Number(e.target.value)||0)},disabled:V})]})]}),e0()]}),(0,S.jsx)("hr",{}),k?(0,S.jsx)("div",{className:(0,O.AK)("text-gray-500","sm"===g?"text-xs":"text-sm"),children:(0,S.jsx)(A.cC,{id:"lY4/S/"})}):null,ec?(0,S.jsx)("div",{className:"text-red-500 text-sm",children:ec}):em?(0,S.jsx)("div",{className:"text-green-500 font-semibold text-sm text-center",children:(0,S.jsx)(A.cC,{id:"UcAV3Q"})}):null,"import-open-router"===eq?null:(0,S.jsxs)("div",{className:"text-center flex items-center justify-center gap-2",children:[(0,S.jsxs)("button",{onClick:eW,type:"submit",className:"inline-flex items-center px-4 py-2 border border-transparent text-base font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 gap-2",disabled:V,children:[V?(0,S.jsx)(E,{}):"⚡",(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"NnH3pK"})})]}),(0,S.jsxs)("button",{onClick:e$,type:"submit",className:"inline-flex items-center px-4 py-2 border border-transparent text-base font-medium rounded-md shadow-sm text-white bg-green-600 hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 disabled:bg-gray-400 gap-2",disabled:!em||p,children:[p?(0,S.jsx)(E,{}):c?null:(0,S.jsx)(C.wEH,{className:"w-4 h-4"}),(0,S.jsx)("span",{children:c?"Update Model":"Add Model"})]})]}),(0,S.jsx)("div",{className:"text-center",children:(0,S.jsx)("button",{onClick:l,type:"submit",className:"inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md text-gray-500 focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:bg-gray-400 gap-2",children:(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"dEgA5A"})})})})]})}var a6=n(60887),a7=function(e){var t=e.onDragEnd,n=e.children,s=e.onDragStart,r=e.onDragOver,a=(0,a6.Dy)((0,a6.VT)(a6.MA,{activationConstraint:{distance:15}}),(0,a6.VT)(a6.LO,{activationConstraint:{delay:200,tolerance:5}}));return(0,S.jsx)(a6.LB,{sensors:a,onDragEnd:t,onDragStart:s,onDragOver:r,children:n})},a8=n(45587),a9=n(24285);function ie(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,s)}return n}function it(e){for(var t=1;t=400)){e.next=13;break}return e.next=9,r.json();case 9:return u(e.sent.userMessage||m._(iP)),l(!1),e.abrupt("return");case 13:if(r.ok){e.next=17;break}return u(m._(iP)),l(!1),e.abrupt("return");case 17:return e.next=19,r.json();case 19:i=e.sent,f(o=(0,O.PO)(null===(s=p.serverHostConfig)||void 0===s?void 0:s.orgURL)+"/plugins/"+i.id),y("".concat(o,"?delete=").concat(i.deleteToken)),e.next=29;break;case 25:e.prev=25,e.t0=e.catch(2),u(m._(iP)),console.error(e.t0);case 29:l(!1);case 30:case"end":return e.stop()}},e,null,[[2,25]])})),function(){return t.apply(this,arguments)});return(0,S.jsxs)("div",{children:[(0,S.jsx)("h2",{className:"text-xl font-semibold text-center",children:(0,S.jsx)(A.cC,{id:"/9EVpH",values:{0:null==n?void 0:n.title}})}),g?(0,S.jsx)(iV,{onOpenManageSharedLinks:s,showManageSharedLinks:r,link:g,deleteLink:v}):k?(0,S.jsx)(iO,{plugin:n}):(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"text-lg font-semibold text-center",children:(0,S.jsx)(A.cC,{id:"2/52pb"})}),(0,S.jsx)("div",{className:"my-4",children:(0,S.jsxs)("div",{className:"grid grid-cols-2 items-center gap-4",children:[(0,S.jsx)("div",{className:"flex items-center justify-end",children:(0,S.jsxs)("button",{disabled:o,onClick:E,className:"inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 space-x-1 disabled:bg-gray-400",children:[(0,S.jsx)(C.H_w,{className:"h-5 w-5"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"WNypG5"})})]})}),(0,S.jsx)("div",{children:(0,S.jsx)(A.cC,{id:"xGQeda"})}),(0,S.jsx)("div",{className:"flex items-center justify-end",children:(0,S.jsxs)("button",{disabled:o,onClick:function(){return N(!0)},className:"inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 space-x-1 disabled:bg-gray-400",children:[(0,S.jsx)(eq.kqQ,{className:"h-5 w-5"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"B2Zb/F"})})]})}),(0,S.jsx)("div",{children:(0,S.jsx)(A.cC,{id:"nntTLt"})})]})})]}),d?(0,S.jsx)("div",{className:"text-sm font-semibold text-red-500 text-center",children:d}):null]})}var iM=n(11163),iD=n(24905);function iB(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,s)}return n}function iL(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:[];return[].concat((0,v.Z)(e.filter(function(e){return e.id!==p.data.id})),[iL(iL({},p.data),{},{uuid:(0,tJ.Z)(),syncedAt:null})])}),a(!1)},D=(0,q.useMemo)(function(){return!!p&&!!T.find(function(e){return e.id===p.data.id})}),B=(t=(0,x.Z)(j().mark(function e(t){var n,s;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return");case 2:if(u(!0),b(""),!iD.GITHUB_PLUGIN_REGEX.test(t)){e.next=18;break}return e.prev=5,e.next=8,(0,iD.fetchPluginFromGithub)(t,{uuid:(0,tJ.Z)()});case 8:h({data:e.sent}),e.next=16;break;case 12:e.prev=12,e.t0=e.catch(5),console.error(e.t0),b(V._(iR));case 16:e.next=45;break;case 18:return e.next=20,new Promise(function(e){return setTimeout(e,2e3)});case 20:return e.prev=20,e.next=23,fetch((0,O.PO)(null===(n=P.serverHostConfig)||void 0===n?void 0:n.orgURL)+"/api/shared_plugins/"+t,{headers:{"Content-Type":"application/json"}});case 23:if(!((s=e.sent).status>=400)){e.next=31;break}return e.next=27,s.json();case 27:return b(e.sent.userMessage||V._(iR)),u(!1),e.abrupt("return");case 31:if(s.ok){e.next=35;break}return b(V._(iR)),u(!1),e.abrupt("return");case 35:return e.next=37,s.json();case 37:h(e.sent),e.next=45;break;case 41:e.prev=41,e.t1=e.catch(20),b(V._(iR)),console.error(e.t1);case 45:u(!1);case 46:case"end":return e.stop()}},e,null,[[5,12],[20,41]])})),function(e){return t.apply(this,arguments)});return(0,S.jsx)(X,{wide:!0,showCloseButton:!1,open:r,setOpen:a,children:(0,S.jsxs)("div",{className:"p-4",children:[d?(0,S.jsxs)("h2",{className:"text-lg text-center my-10 flex items-center justify-center gap-2",children:[(0,S.jsx)(E,{}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"r53GSi"})})]}):null,f?(0,S.jsx)("h2",{className:"text-lg text-red-500 text-center my-10",children:f}):null,p?(0,S.jsxs)("div",{className:"text-lg text-center",children:[(0,S.jsx)("div",{className:"my-4 text-lg text-center",children:(0,S.jsx)(A.cC,{id:"zjeHGx",values:{0:null==p||null===(n=p.data)||void 0===n?void 0:n.title},components:{0:(0,S.jsx)("b",{})}})}),(0,S.jsx)("div",{className:"mt-4 text-lg text-center",children:(0,S.jsx)("a",{className:"text-blue-500 hover:underline",href:iD.GITHUB_PLUGIN_REGEX.test(i)?i:(0,O.PO)(null===(s=P.serverHostConfig)||void 0===s?void 0:s.orgURL)+"/plugins/".concat(null==p?void 0:p.id),target:"_blank",children:(0,S.jsx)(A.cC,{id:"SZw9tS"})})}),D&&(0,S.jsx)("span",{className:"block mt-2 text-orange-500 text-sm",children:(0,S.jsx)(A.cC,{id:"q1Iujb",values:{0:p.data.id},components:{0:(0,S.jsx)("b",{}),1:(0,S.jsx)("br",{}),2:(0,S.jsx)("br",{}),3:(0,S.jsx)("br",{})}})}),(0,S.jsxs)("div",{className:"mt-6 text-center flex items-center justify-center flex-wrap gap-2",children:[(0,S.jsx)("button",{onClick:function(){return M()},className:"inline-flex items-center px-4 py-2 border border-transparent text-base font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 gap-2",disabled:d,children:D?(0,S.jsx)(A.cC,{id:"2iY5s/"}):(0,S.jsx)(A.cC,{id:"T/YuOx"})}),(0,S.jsx)("button",{onClick:function(){return a(!1)},className:"inline-flex items-center px-4 py-2 border border-transparent text-base font-medium rounded-md shadow-sm text-white bg-red-600 hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 disabled:bg-gray-400 gap-2",disabled:d,children:(0,S.jsx)(A.cC,{id:"dEgA5A"})})]})]}):null]})})}function iZ(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,s)}return n}function iK(e){for(var t=1;t{{firstname}} {{lastname}}
",className:"w-full border border-gray-300 dark:border-gray-600 rounded-md shadow-sm py-2 px-3 text-base leading-6 focus:outline-none focus:ring-blue-500 focus:border-blue-500 transition duration-150 ease-in-out dark:bg-zinc-700 disabled:text-gray-500",value:null===(i=c.resultTransform)||void 0===i?void 0:i.templateString,onChange:function(e){l("resultTransform",iK(iK({},c.resultTransform||{}),{},{templateString:e.target.value}))},disabled:f||p})]}):null]})]})]})]}),N?(0,S.jsxs)("div",{className:"w-full",children:[(0,S.jsxs)("div",{className:"font-semibold mb-1",children:[(0,S.jsx)(A.cC,{id:"cQfI46"}),":"]}),(0,S.jsx)("textarea",{placeholder:'{\n "userID": "{userID}"\n}',rows:3,className:"w-full border border-gray-300 dark:border-gray-600 rounded-md shadow-sm py-2 px-3 text-base leading-6 focus:outline-none focus:ring-blue-500 focus:border-blue-500 transition duration-150 ease-in-out dark:bg-zinc-700 disabled:text-gray-500 w-full",value:O,onChange:function(e){V(e.target.value)},disabled:f})]}):null,(0,S.jsxs)("div",{className:"flex items-center justify-start gap-4",children:[(0,S.jsxs)("button",{onClick:function(){P()},type:"submit",className:"inline-flex items-center px-3 py-1.5 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 gap-2",disabled:f,children:[f?(0,S.jsx)(E,{}):"→",(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"Ls+eRP"})})]}),(0,S.jsxs)("label",{className:"flex items-center justify-start gap-2 text-sm",children:[(0,S.jsx)("input",{type:"checkbox",checked:N,onChange:function(e){C(e.target.checked),e.target.checked&&!O&&V(JSON.stringify(m.reduce(function(e,t){return e[t]="test value",e},{}),null,2))},disabled:f}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"WD6ttL"})})]})]}),y?(0,S.jsxs)("div",{children:[y.error?(0,S.jsx)("div",{className:"font-semibold text-red-500 mb-1",children:(0,S.jsx)(A.cC,{id:"sCG3Yu"})}):(0,S.jsx)(S.Fragment,{children:(0,S.jsxs)("div",{className:"font-semibold mb-1 text-green-500",children:[(0,S.jsx)(A.cC,{id:"Wagt7O"})," (",(0,S.jsx)(A.cC,{id:"IPXOXm",values:{0:(null===(o=y.text)||void 0===o?void 0:o.length)||0}}),")"]})}),y.error?(0,S.jsx)("textarea",{className:"w-full border border-gray-300 dark:border-gray-600 rounded-md shadow-sm py-2 px-3 text-base leading-6 focus:outline-none focus:ring-blue-500 focus:border-blue-500 transition duration-150 ease-in-out dark:bg-zinc-700 disabled:text-gray-500 w-full",rows:3,value:null==y?void 0:y.error,readOnly:!0}):(0,S.jsx)("textarea",{className:"w-full border border-gray-300 dark:border-gray-600 rounded-md shadow-sm py-2 px-3 text-base leading-6 focus:outline-none focus:ring-blue-500 focus:border-blue-500 transition duration-150 ease-in-out dark:bg-zinc-700 disabled:text-gray-500 w-full",rows:3,value:null==y?void 0:y.text,readOnly:!0})]}):null]})}var iF=n(44509),iY=n.n(iF),iU=n(96750);function iH(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,s)}return n}function iz(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:{};return e?e.replace(/{(\w+)}/g,function(e,n){return t[n]||e}):""},iJ=(o=(0,x.Z)(j().mark(function e(t,n){var s,r,a,i,o,l,c,d,u,m,p,h,g,f,x,b,v,y,w,A,k,N,C,q=arguments;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:s=(q.length>2&&void 0!==q[2]?q[2]:{}).throwOnError,r=t.url,a=t.method,i=t.hasHeaders,o=t.hasBody,l=t.requestBody,d=void 0===(c=t.requestBodyFormat)?"json":c,u=t.requestHeaders,m=t.hasResultTransform,p=t.resultTransform,h=iQ(r,n),e.prev=3,g=iz(iz({},"form-data"===d?{}:{"Content-Type":"application/json"}),i?iW(u,n):{}),e.next=10;break;case 7:throw e.prev=7,e.t0=e.catch(3),Error("Parsing request headers error:",e.t0.message);case 10:e.prev=10,f=o?iW(l,n):void 0,e.next=17;break;case 14:throw e.prev=14,e.t1=e.catch(10),Error("Parsing request body error:",e.t1.message);case 17:return x=f&&JSON.stringify(f),f&&"form-data"===d&&(x=new FormData,Object.keys(f).forEach(function(e){x.append(e,f[e])})),b={method:a,headers:g,body:x},e.next=24,fetch(h,b);case 24:if((v=e.sent).ok){e.next=40;break}return e.prev=26,e.next=29,v.text();case 29:y=e.sent,e.next=36;break;case 32:throw e.prev=32,e.t2=e.catch(26),console.error("Error parsing HTTP response",e.t2),Error("HTTP Error: ".concat(v.status," ").concat(v.statusText));case 36:throw console.error("HTTP Error:",v.status,v.statusText),console.error("HTTP Response:",y),console.error("HTTP Request Params:",JSON.stringify(h),JSON.stringify(b)),Error("Error: ".concat(v.status," ").concat(v.statusText,"\nError response: ").concat(y));case 40:return e.next=42,v.text();case 42:if(w=e.sent,!(m&&p)){e.next=69;break}if(e.prev=45,"jmes"!==p.engine){e.next=54;break}return"object"==typeof(A=JSON.parse(w))&&(A.__VARIABLES=n),(k=iY().search(A,p.expression)).__VARIABLES&&delete k.__VARIABLES,e.abrupt("return",JSON.stringify(k,null,2));case 54:if("handlebars"!==p.engine){e.next=61;break}return"object"==typeof(N=JSON.parse(w))&&(N.__VARIABLES=n),C=iU.compile(p.templateString),e.abrupt("return",C(N));case 61:throw Error("Unsupported transform engine: ".concat(p.engine));case 62:e.next=69;break;case 64:if(e.prev=64,e.t3=e.catch(45),console.error("Error transforming HTTP response",e.t3),!s){e.next=69;break}throw Error("Post-processing error: "+e.t3.message);case 69:return e.abrupt("return",w);case 70:case"end":return e.stop()}},e,null,[[3,7],[10,14],[26,32],[45,64]])})),function(e,t){return o.apply(this,arguments)}),iX=function(e){var t,n,s,r=e.value,a=e.parser,i=e.overridingErrorMessage,o=(n=(t=(0,q.useState)(void 0))[0],s=t[1],(0,q.useEffect)(function(){var e=setTimeout(function(){s(r)},300);return function(){return clearTimeout(e)}},[r,300]),n),l=(0,q.useState)(""),c=l[0],d=l[1];return((0,q.useEffect)(function(){try{d(""),o&&a(o)}catch(e){d(i||e.message)}},[o]),c)?(0,S.jsx)("div",{className:"text-red-500 text-sm mt-1",children:c}):null},i$=function(e){var t,n=e.onSuccess,s=(0,q.useState)(""),r=s[0],a=s[1],i=(0,q.useState)(""),o=i[0],l=i[1],c=(0,q.useState)(!1),d=c[0],u=c[1],m=(t=(0,x.Z)(j().mark(function e(t){return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t.preventDefault(),e.prev=1,l(""),u(!0),e.next=6,(0,iD.fetchPluginFromGithub)(r);case 6:n(e.sent),e.next=14;break;case 10:e.prev=10,e.t0=e.catch(1),console.error(e.t0),l(T.ag._({id:"e6Mc3R"}));case 14:return e.prev=14,u(!1),e.finish(14);case 17:case"end":return e.stop()}},e,null,[[1,10,14,17]])})),function(e){return t.apply(this,arguments)});return(0,S.jsxs)("form",{onSubmit:m,className:"my-2 flex flex-wrap items-center justify-center gap-x-2 gap-y-1",children:[(0,S.jsx)("input",{"data-element-id":"plugin-url-input",type:"text",name:"url",required:!0,pattern:iD.GITHUB_PLUGIN_REGEX.source,placeholder:"Enter the github repo URL",className:"grow text-sm border border-gray-300 dark:border-gray-700 rounded-lg px-4 py-2 focus:outline-none focus:border-blue-500 dark:focus:border-blue-500 dark:bg-zinc-800",value:r,onChange:function(e){return a(e.target.value)},disabled:d}),(0,S.jsx)("div",{className:"text-center",children:(0,S.jsx)("button",{disabled:d,"data-element-id":"continue-import-plugin-button",className:"inline-flex items-center px-3 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 gap-2 whitespace-nowrap",children:(0,S.jsx)(A.cC,{id:"l3s5ri"})})}),(0,S.jsx)("div",{className:"w-full text-red-500 text-sm",children:o})]})};function i0(e){var t,n=e.value,s=e.setValue,r=e.error,a=e.setError,i=e.testFunction,o=e.extraHTTPActionVariables,l=(_()||{}).serverHostConfig,c=(0,q.useState)(!1),d=c[0],u=c[1],m=(0,q.useState)(null),p=m[0],h=m[1],g=(0,q.useMemo)(function(){return/"implementationType":\s*"http"/g.test(n)},[n]),f=(0,q.useState)([]),x=f[0],b=f[1];(0,q.useEffect)(function(){if(g&&d)try{var e=JSON.parse(n);a(""),h(e.httpAction),b([].concat((0,v.Z)((0,iD.parsedVariablesFromSpec)(e.openaiSpec,e.userSettings)),(0,v.Z)(o)))}catch(e){a("Invalid plugin/HTTP Action JSON")}},[n,g,d]);var y=(0,q.useState)(!1),w=y[0],j=y[1];return(0,S.jsxs)("div",{className:"w-full",children:[(0,S.jsx)("div",{children:(0,S.jsx)("div",{className:"text-xs text-gray-500",children:(0,S.jsx)(A.cC,{id:"VYIIuD",components:{0:(0,S.jsx)("a",{target:"_blank",rel:"noreferrer",className:"text-blue-500 font-semibold hover:underline",href:(null==l||null===(t=l.links)||void 0===t?void 0:t.sharePluginsViaGithub)||"/guides/share-plugins-via-github"})}})})}),(0,S.jsxs)("div",{className:"mt-4",children:[(0,S.jsx)("button",{type:"button",onClick:function(){j(function(e){return!e})},className:"flex items-center px-2 py-1 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 disabled:cursor-default transition-colors",children:(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"M0BKgX"})})}),w&&(0,S.jsx)(i$,{onSuccess:function(e){s(JSON.stringify(e,null,4)),j(!1)}})]}),(0,S.jsx)("div",{className:"mt-4",children:(0,S.jsx)("textarea",{value:n,onChange:function(e){return s(e.target.value)},type:"text",name:"json-file",id:"json-file",className:"min-h-[700px] bg-gray-50 text-base shadow dark:bg-gray-800 hover:border-blue-400 cursor-default block w-full rounded-md border-0 py-1.5 text-gray-900 ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-blue-600 sm:leading-6 dark:text-white",placeholder:"Enter your JSON content here",rows:10})}),g&&(0,S.jsx)("div",{className:"mt-4",children:(0,S.jsx)(eJ,{label:"Test HTTP Action",enabled:d,setEnabled:function(e){e||(a(!1),h(void 0)),u(e)}})}),g&&d&&p&&!r&&(0,S.jsx)("div",{className:"mt-4",children:(0,S.jsx)(iG,{hideDetails:!0,readOnly:!0,httpAction:p,onFieldChange:function(){},testFunction:i,variables:x})})]})}function i1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,s)}return n}function i2(e){for(var t=1;t1&&void 0!==a[1]?a[1]:{},e.prev=1,s=H&&JSON.parse(H),e.next=8;break;case 5:throw e.prev=5,e.t0=e.catch(1),Error("User Settings must be a valid JSON.");case 8:if(r=i2(i2({},(0,O.oH)({},s||[])),n),(0,iD.validateHTTPAction)(t,s),!d){e.next=15;break}return e.next=14,d(t,r);case 14:case 17:return e.abrupt("return",e.sent);case 15:return e.next=17,iJ(t,r);case 18:case"end":return e.stop()}},e,null,[[1,5]])})),function(e){return t.apply(this,arguments)}),em=function(){if(ei(""),"json"===f)try{var e,t,s,r,i,o,l,d,u,m,p=JSON.parse(el);t=p.title,s=p.iconURL,r=p.overviewMarkdown,i=p.openaiSpec,o=p.code,l=p.userSettings;var h=p.implementationType;d=void 0===h?"javascript":h,u=p.httpAction;var g=p.outputType;m=void 0===g?"respond_to_ai":g}catch(e){console.error(e),ei(T.ag._({id:"svQd1q"}))}else{t=k,s=V,r=D,o=G,d=Q,u=en,m=$;try{e=(i=JSON.parse(R)).name}catch(e){console.error(e),ei(T.ag._({id:"svQd1q"}));return}try{H&&(l=JSON.parse(H))}catch(e){console.error(e),ei(T.ag._({id:"Tri+cM"}));return}}if(!t){ei(T.ag._({id:"4od74D"}));return}if(!i){ei(T.ag._({id:"4cpPCu"}));return}if(!i.name||!i.name.length){ei(T.ag._({id:"LWocrQ"}));return}if(!i.description||!i.description.length){ei(T.ag._({id:"/xxPLj"}));return}if(e!==n.id&&c(e)){ei(T.ag._({id:"vEGzwu",values:{parsedPluginID:e}}));return}if("javascript"===d&&!o){ei(T.ag._({id:"sVBJ9u"}));return}if("javascript"===d&&!o.includes(i.name)){ei(T.ag._({id:"gGUb6a",values:{0:i.name}}));return}if(l)try{(0,O.Kt)(l)}catch(e){ei(e.message);return}if("http"===d)try{(0,iD.validateHTTPAction)(u,l)}catch(e){ei("Invalid HTTP Action");return}a(i2(i2({},n),{},{uuid:n.uuid,id:i.name,title:t,iconURL:s,overviewMarkdown:r,openaiSpec:i,code:o,userSettings:l||null,implementationType:d,httpAction:u,outputType:m,syncedAt:null}))};return(0,S.jsxs)("div",{className:"flex items-center justify-between gap-2 flex-wrap",children:[(0,S.jsx)("div",{}),!i&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,S.jsxs)(eS,{onConfirmed:s,className:"inline-flex items-center px-3 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-red-600 hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 disabled:bg-gray-400 gap-2",confirmText:function(){return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(C.Xm5,{className:"w-4 h-4"}),(0,S.jsx)("span",{className:"hover:underline",children:(0,S.jsx)(A.cC,{id:"Aqw8Kb"})})]})},children:[(0,S.jsx)(C.Xm5,{className:"w-4 h-4"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"cnGeoo"})})]}),(0,S.jsxs)("button",{onClick:r,className:"inline-flex items-center px-3 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-yellow-600 hover:bg-yellow-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-yellow-500 disabled:bg-gray-400 gap-2",children:[(0,S.jsx)(Y.oHP,{className:"w-4 h-4"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"dEgA5A"})})]}),(0,S.jsxs)("button",{onClick:em,className:"inline-flex items-center px-3 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-green-600 hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 disabled:bg-gray-400 gap-2",children:[(0,S.jsx)(Y.bzc,{className:"w-4 h-4"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"tfDRzk"})})]})]}),ea&&(0,S.jsx)("div",{className:"text-red-500 w-full",children:ea})]}),!n.system&&(0,S.jsx)("div",{className:"w-full",children:(0,S.jsxs)("fieldset",{children:[(0,S.jsx)("legend",{className:"sr-only",children:"Input Options"}),(0,S.jsx)("div",{className:"flex flex-col gap-4 gap-y-1 sm:flex-row",children:h.map(function(e){return(0,S.jsxs)("div",{className:"flex items-center",children:[(0,S.jsx)("input",{id:e.id,name:"input-method",type:"radio",checked:e.id===f,className:"h-4 w-4 border-gray-300 text-blue-600 focus:ring-blue-600 cursor-pointer disabled:cursor-not-allowed",onChange:function(){return y(e.id)},disabled:o}),(0,S.jsx)("label",{htmlFor:e.id,className:(0,O.AK)(o?"text-gray-400":"text-gray-900 dark:text-gray-50","ml-1 block font-medium leading-6 cursor-pointer text-base"),children:e.title})]},e.id)})})]})}),"manually"===f?(0,S.jsxs)("div",{className:"mt-2 w-full space-y-2",children:[(0,S.jsxs)("div",{className:"w-full",children:[(0,S.jsxs)("label",{className:"font-semibold",children:[(0,S.jsx)(A.cC,{id:"ErRKov"}),"*"]}),(0,S.jsx)("div",{className:"text-gray-500 text-xs",children:(0,S.jsx)(A.cC,{id:"YS2bZx"})}),(0,S.jsx)("div",{className:"w-full my-1",children:(0,S.jsx)("input",{disabled:o||p,type:"text",placeholder:T.ag._({id:"LnnVIT"}),className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm dark:bg-zinc-700",autoComplete:"off",value:k,onChange:function(e){return N(e.target.value)}})})]}),(0,S.jsxs)("div",{className:"w-full",children:[(0,S.jsx)("label",{className:"font-semibold",children:(0,S.jsx)(A.cC,{id:"bd1Kuw"})}),(0,S.jsx)("div",{className:"text-gray-500 text-xs",children:(0,S.jsx)(A.cC,{id:"uUXlSw"})}),(0,S.jsx)("div",{className:"w-full my-1",children:(0,S.jsx)("input",{disabled:o||p,type:"text",placeholder:T.ag._({id:"0X8rUE"}),className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm dark:bg-zinc-700",autoComplete:"off",value:V,onChange:function(e){return P(e.target.value)}})})]}),(0,S.jsxs)("div",{className:"w-full",children:[(0,S.jsx)("label",{className:"font-semibold",children:(0,S.jsx)(A.cC,{id:"6FSnpy"})}),(0,S.jsx)("div",{className:"text-gray-500 text-xs",children:(0,S.jsx)(A.cC,{id:"i5udnt"})}),(0,S.jsx)("div",{className:"w-full my-1",children:(0,S.jsx)("textarea",{disabled:o||p,placeholder:T.ag._({id:"F1uW/d"}),className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm dark:bg-zinc-700",autoComplete:"off",value:D,onChange:function(e){return B(e.target.value)},rows:5})})]}),(0,S.jsxs)("div",{className:"w-full",children:[(0,S.jsxs)("label",{className:"font-semibold",children:[(0,S.jsx)(A.cC,{id:"7HIUd6"}),"*"]}),(0,S.jsx)("div",{className:"text-gray-500 text-xs",children:(0,S.jsx)(A.cC,{id:"i39oBj",components:{0:(0,S.jsx)("a",{className:"text-blue-500 hover:underline",href:"https://platform.openai.com/docs/guides/function-calling",target:"_blank",rel:"noreferrer"})}})}),(0,S.jsxs)("div",{className:"w-full my-1",children:[(0,S.jsx)("textarea",{disabled:o||p,placeholder:T.ag._({id:"T3l2/7"}),className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm dark:bg-zinc-700",autoComplete:"off",value:R,onChange:function(e){return Z(e.target.value)},rows:5}),(0,S.jsx)(iX,{value:R,parser:JSON.parse,overridingErrorMessage:T.ag._({id:"svQd1q"})})]})]}),(0,S.jsxs)("div",{className:"w-full",children:[(0,S.jsx)("label",{className:"font-semibold",children:(0,S.jsx)(A.cC,{id:"Nv92aJ"})}),(0,S.jsx)("div",{className:"text-gray-500 text-xs",children:(0,S.jsx)(A.cC,{id:"ikLQLQ",components:{0:(0,S.jsx)("a",{className:"text-blue-500 hover:underline",href:(null==ed?void 0:ed.pluginsDocs)||"/plugins-docs",target:"_blank",rel:"noreferrer"})}})}),(0,S.jsxs)("div",{className:"w-full my-1",children:[(0,S.jsx)("textarea",{disabled:o||p,placeholder:T.ag._({id:"Yj2/Tk"}),className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm dark:bg-zinc-700",autoComplete:"off",rows:5,value:H,onChange:function(e){return z(e.target.value)}}),(0,S.jsx)(iX,{value:H,parser:O.Kt})]})]}),(0,S.jsxs)("div",{className:"w-full",children:[(0,S.jsxs)("label",{className:"font-semibold",children:[(0,S.jsx)(A.cC,{id:"N4OVNn"}),"*"]}),(0,S.jsx)("div",{className:"text-gray-500 text-xs",children:(0,S.jsx)(A.cC,{id:"4fbZwm"})}),(0,S.jsx)("div",{className:"w-full my-1",children:(0,S.jsxs)("select",{id:"model",className:"block w-full rounded-md border-0 py-1.5 pl-3 pr-10 text-gray-900 dark:text-white dark:bg-zinc-700 ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-blue-600 sm:text-sm sm:leading-6 disabled:text-gray-500",value:Q,onChange:function(e){J(e.target.value),en||es({id:(0,tJ.Z)(),name:"",url:"",method:"GET"})},disabled:o||p,children:[(0,S.jsx)("option",{value:"javascript",children:"JavaScript Code"}),(0,S.jsx)("option",{value:"http",children:"HTTP Action"})]})})]}),"javascript"===Q?(0,S.jsxs)("div",{className:"w-full",children:[(0,S.jsxs)("label",{className:"font-semibold",children:[(0,S.jsx)(A.cC,{id:"uIjGvG"}),"*"]}),(0,S.jsx)("div",{className:"text-gray-500 text-xs",children:(0,S.jsx)(A.cC,{id:"30hLYa",components:{0:(0,S.jsx)("a",{className:"text-blue-500 hover:underline",href:(null==ed?void 0:ed.pluginsDocs)||"/plugins-docs",target:"_blank",rel:"noreferrer"})}})}),(0,S.jsx)("div",{className:"w-full my-1",children:(0,S.jsx)("textarea",{disabled:o||p,placeholder:T.ag._({id:"YoxD8i"}),className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm dark:bg-zinc-700",autoComplete:"off",rows:5,value:G,onChange:function(e){return F(e.target.value)}})})]}):"http"===Q?(0,S.jsx)("div",{className:"w-full mb-4",children:en?(0,S.jsx)(iG,{readOnly:p,httpAction:en,onFieldChange:function(e,t){es(function(n){return i2(i2({},n),{},(0,b.Z)({},e,t))})},testFunction:eu,variables:[].concat((0,v.Z)((0,iD.parsedVariablesFromSpec)(R,H)),(0,v.Z)(m))}):null}):null,(0,S.jsxs)("div",{className:"w-full",children:[(0,S.jsx)("label",{className:"font-semibold",children:(0,S.jsx)(A.cC,{id:"2o7xcf"})}),(0,S.jsx)("div",{className:"text-gray-500 text-xs",children:(0,S.jsx)(A.cC,{id:"tQht86"})}),(0,S.jsx)("div",{className:"w-full my-1",children:(0,S.jsxs)("select",{id:"model",className:"block w-full rounded-md border-0 py-1.5 pl-3 pr-10 text-gray-900 dark:text-white dark:bg-zinc-700 ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-blue-600 sm:text-sm sm:leading-6 disabled:text-gray-500",value:$,onChange:function(e){ee(e.target.value)},disabled:o||p,children:[(0,S.jsx)("option",{value:"respond_to_ai",children:(0,S.jsx)(A.cC,{id:"Dedbjs"})}),(0,S.jsx)("option",{value:"render_markdown",children:(0,S.jsx)(A.cC,{id:"HVm9F2"})}),(0,S.jsx)("option",{value:"render_html",children:(0,S.jsx)(A.cC,{id:"u/WKTl"})})]})})]})]}):(0,S.jsx)(i0,{value:el,setValue:ec,error:ea,setError:ei,extraHTTPActionVariables:m,testFunction:eu}),i&&(0,S.jsxs)("div",{className:"mt-6 w-full text-center",children:[ea?(0,S.jsx)("div",{className:"text-red-500 text-sm mb-6",children:ea}):null,(0,S.jsx)("div",{className:"text-center flex items-center justify-center gap-2",children:n.system?(0,S.jsx)("span",{className:"text-gray-500",children:(0,S.jsx)(A.cC,{id:"XmhWD2"})}):(0,S.jsxs)("button",{onClick:em,type:"submit",className:"inline-flex items-center px-4 py-2 border border-transparent text-base font-medium rounded-md shadow-sm text-white bg-green-600 hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 disabled:bg-gray-400 gap-2",disabled:o||p,children:[o?(0,S.jsx)(E,{}):n.id?null:(0,S.jsx)(C.wEH,{className:"w-4 h-4"}),(0,S.jsx)("span",{children:n.id?T.ag._({id:"/LO3aj"}):T.ag._({id:"B+nQnj"})})]})})]})]})}var i5=n(19021),i3=n(1241),i6=n(74655);function i7(e){var t=e.rawContent,n=e.style;return(0,S.jsx)("div",{className:"pb-6",children:(0,S.jsx)("pre",{style:n,className:"mb-2 overflow-auto text-sm border border-gray-200 rounded bg-gray-100 p-4 dark:bg-zinc-800",children:t})})}var i8=["className"];function i9(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,s)}return n}function oe(e){for(var t=1;t=400)){e.next=13;break}return e.next=9,t.json();case 9:return P((null===(n=e.sent.error)||void 0===n?void 0:n.message)||L._(oN)),E(!1),e.abrupt("return");case 13:if(t.ok){e.next=17;break}return P(L._(oN)),E(!1),e.abrupt("return");case 17:return D(!0),e.abrupt("return",!0);case 21:e.prev=21,e.t0=e.catch(2),P(L._(oN)),console.error(e.t0);case 25:E(!1);case 26:case"end":return e.stop()}},e,null,[[2,21]])})),function(){return t.apply(this,arguments)});return(0,S.jsxs)("div",{children:[Z?null:(0,S.jsx)("div",{className:"mt-4",children:(0,S.jsx)(tu,{name:"Web Search Plugin"})}),(0,S.jsxs)("div",{className:"my-4 space-y-4",children:[(0,S.jsx)("div",{children:(0,S.jsxs)("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[(0,S.jsx)("label",{className:"block text-sm font-medium leading-6",children:(0,S.jsx)(A.cC,{id:"aDVBYo"})}),(0,S.jsx)("select",{disabled:!R,className:"block w-fit rounded-md border-0 py-1.5 pl-3 pr-10 text-gray-900 dark:text-white dark:bg-zinc-700 ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-blue-600 sm:text-sm sm:leading-6 max-w-full",children:(0,S.jsx)("option",{value:"google",children:(0,S.jsx)(A.cC,{id:"1mnY67"})})})]})}),(0,S.jsx)("div",{className:"text-xs text-gray-500",children:(0,S.jsx)(A.cC,{id:"pqNt/b"})})]}),R?(0,S.jsxs)("div",{className:"space-y-2",children:[(0,S.jsxs)("div",{className:"text-sm text-gray-500 text-center",children:[(0,S.jsx)("a",{href:(null==K?void 0:K.webSearchAPIKeyGuide)||"https://docs.typingmind.com/other-resources/how-tos/how-to-enable-web-search-and-image-search-on-typingmind",className:"text-blue-500 hover:underline",target:"_blank",rel:"noopener noreferrer",children:(0,S.jsx)("b",{children:(0,S.jsx)(A.cC,{id:"BdH0Jq"})})}),(0,S.jsx)("div",{className:"my-1 text-xs",children:(0,S.jsx)(A.cC,{id:"HsTJS/"})})]}),(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"flex items-center justify-between",children:(0,S.jsx)("label",{className:ow("block text-sm font-medium leading-6",b?"":"text-red-500"),children:(0,S.jsx)(A.cC,{id:"5qSvKg"})})}),(0,S.jsx)("input",{type:"text",placeholder:"XXXXXXXXXXX",className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm dark:bg-zinc-700",autoComplete:"off",value:b,onChange:function(e){return v(e.target.value)},disabled:I||!Z,onKeyDown:function(e){"Enter"===e.key&&e.metaKey&&(e.preventDefault(),G())}})]}),(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"flex items-center justify-between",children:(0,S.jsx)("label",{className:ow("block text-sm font-medium leading-6",k?"":"text-red-500"),children:(0,S.jsx)(A.cC,{id:"PtdI1b"})})}),(0,S.jsx)("input",{type:"password",placeholder:"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm dark:bg-zinc-700",autoComplete:"off",value:k,disabled:I||!Z,onChange:function(e){return N(e.target.value)},onKeyDown:function(e){"Enter"===e.key&&e.metaKey&&(e.preventDefault(),G())}})]}),(0,S.jsxs)("div",{children:[V&&(0,S.jsx)("div",{className:"text-red-500 text-sm text-center",children:V}),(0,S.jsx)("div",{className:"text-center flex items-center justify-center gap-2 my-4",children:M?(0,S.jsxs)("div",{className:"text-green-500 text-sm",children:[(0,S.jsx)(A.cC,{id:"fsSQWV"})," \uD83C\uDF89"," "]}):null}),M?null:(0,S.jsx)("div",{className:"text-xs text-center my-2",children:(0,S.jsx)(A.cC,{id:"ghNpNS"})}),(0,S.jsx)("div",{className:"text-center flex items-center justify-center gap-2",children:!b&&!k&&h&&d?(0,S.jsxs)("button",{onClick:function(){u(""),g(""),o(function(e){return oy(oy({},e),{},{get_web_search_results:{enabled:!1}})})},className:"inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 disabled:cursor-default transition-colors whitespace-nowrap space-x-1",children:[(0,S.jsx)(Y.bzc,{className:"w-4 h-4"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"mTAnk+"})})]}):(0,S.jsxs)("button",{onClick:G,disabled:I||!b||!k,className:"inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-green-600 hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 disabled:bg-gray-400 disabled:cursor-default transition-colors whitespace-nowrap space-x-1",children:[(0,S.jsx)(Y.nDU,{className:"w-4 h-4"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"mxFYYR"})})]})})]}),(0,S.jsx)("div",{className:"text-xs text-gray-500 my-4",children:(0,S.jsx)(A.cC,{id:"rF9ATR",components:{0:(0,S.jsx)("b",{})}})})]}):null,null!=B&&null!==(s=B.serverHostConfig)&&void 0!==s&&s.managed?null:(0,S.jsxs)("details",{className:"mt-4",children:[(0,S.jsx)("summary",{className:"text-xl text-center font-semibold hover:underline cursor-pointer",children:(0,S.jsx)(A.cC,{id:"4PbDoL"})}),(0,S.jsx)(ob,{})]})]})}function oq(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,s)}return n}function oI(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:[];return[].concat((0,v.Z)(e),[N])}),I(null),P(!1)},onCanceled:function(){return P(!1)},onSaved:function(e){return en(e)},isPluginDuplicated:function(e){return z.some(function(t){return t.id===e})}},N):(0,S.jsxs)("div",{children:[(0,S.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,S.jsxs)("h2",{className:"text-2xl font-semibold flex items-center justify-start gap-2",children:[(0,S.jsx)("span",{className:"w-8 h-8 flex items-center justify-center",children:(0,S.jsx)(s2,{size:"medium",plugin:et})}),(0,S.jsx)("span",{children:et.title})]}),et.system||et.org||!(0,O.N7)("addNewPlugins",Q)?null:(0,S.jsxs)(eU.v2,{as:"div",className:"relative flex text-left shrink-0",children:[(0,S.jsx)(eU.j2,{className:"transiton-all inline-block",children:(0,S.jsx)(M.$T6,{className:"w-6 h-6 sm:w-4 sm:h-4 sm:scale-150"})}),(0,S.jsx)(U.u,{as:q.Fragment,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:(0,S.jsx)(eU.sd,{modal:!1,className:"absolute z-40 right-0 mt-2 origin-top-right divide-y divide-gray-100 rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none",children:(0,S.jsxs)("div",{className:"px-1 py-1 ",children:[(0,S.jsx)(eU.sN,{children:function(e){var t=e.focus;return(0,S.jsxs)("button",{onClick:function(){s(et)},className:"".concat(t?"bg-blue-600 text-white":"text-gray-900"," cursor-default group flex shrink-0 whitespace-nowrap space-x-2 w-full items-center rounded-md px-2 py-2 text-sm font-medium"),children:[(0,S.jsx)(Y.x2q,{className:"w-4 h-4"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"Z8lGw6"})})]})}}),(0,S.jsx)(eU.sN,{children:function(e){var t=e.focus;return(0,S.jsxs)("button",{onClick:function(){return P(!0)},className:"".concat(t?"bg-blue-600 text-white":"text-gray-900"," cursor-default group flex shrink-0 whitespace-nowrap space-x-2 w-full items-center rounded-md px-2 py-2 text-sm font-medium"),children:[(0,S.jsx)(Y.$iz,{className:"w-4 h-4"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"ePK91l"})})]})}})]})})})]})]}),(0,S.jsx)(oh,{plugin:et,externalSettingStatus:"get_web_search_results"===et.id?u&&l?"ready":"require_config":(0,O.X0)(et,{systemPluginsMap:J,userPluginSettings:H})?"ready":"require_config",externalSettingElement:"get_web_search_results"===et.id?function(){return(0,S.jsx)(oC,{})}:null},N)]})}):B?(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"my-4 text-center text-gray-500 hidden sm:block",children:(0,S.jsx)(A.cC,{id:"m5Z2VD"})}),(0,S.jsxs)("form",{onSubmit:function(e){e.preventDefault();var t=e.target.url.value,s=iD.SHARED_PLUGIN_LINK_REGEX.exec(t),r=(0,y.Z)(s,3),a=(r[0],r[1]),i=r[2];n(a||i)},className:"my-4 flex flex-col items-center justify-center gap-2",children:[(0,S.jsx)("input",{"data-element-id":"plugin-url-input",type:"text",name:"url",required:!0,pattern:iD.SHARED_PLUGIN_LINK_REGEX.source,placeholder:"Enter the plugin URL",className:"w-full text-sm border border-gray-300 dark:border-gray-700 rounded-lg px-4 py-2 focus:outline-none focus:border-blue-500 dark:focus:border-blue-500 dark:bg-zinc-800"}),(0,S.jsx)("div",{className:"text-center",children:(0,S.jsx)("button",{"data-element-id":"continue-import-plugin-button",className:"inline-flex items-center px-3 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 gap-2 whitespace-nowrap",children:(0,S.jsx)(A.cC,{id:"xGVfLh"})})})]})]}):(0,S.jsx)("div",{"data-element-id":"select-plugin-modal-description",className:"my-4 text-center text-gray-500 hidden sm:block",children:(0,S.jsx)(A.cC,{id:"HcH0CK"})})]})]})}function oD(e){var t=e.chatPlugins,n=e.onOpenManageSharedLinks,s=(0,q.useState)(""),r=s[0],a=s[1],i=(0,q.useState)(null),o=i[0],l=i[1];return(0,S.jsxs)("div",{className:"p-6 h-screen overflow-y-auto",children:[(0,S.jsx)("h2",{className:"text-3xl font-bold",children:(0,S.jsx)(A.cC,{id:"ohUJJM"})}),(0,S.jsx)("div",{className:"text-gray-500 text-sm mt-2",children:(0,S.jsx)(A.cC,{id:"0/BbGM"})}),(0,S.jsx)(i_,{open:!!r,setOpen:function(){a("")},id:r,chatPlugins:t}),(0,S.jsx)(oM,{onImport:function(e){a(e)},onShare:function(e){l(e)},chatPlugins:t}),(0,S.jsx)(X,{wide:!0,open:!!o,setOpen:function(){return l(null)},children:(0,S.jsx)(iT,{plugin:o,onOpenManageSharedLinks:function(){n(),l(null)},showManageSharedLinks:!!n})})]})}var oB=n(39811),oL=n(89085),oR=n(17405),o_=n(71419);function oZ(){var e=(0,eD.n)().syncStatus;return"scheduled"===e?(0,S.jsx)("div",{className:"w-2 h-2 rounded-full bg-orange-500"}):"started"===e?(0,S.jsx)("div",{className:"bg-green-600 w-3 h-3 rounded-full flex items-center justify-center",children:(0,S.jsx)("div",{className:"animate-spin ",children:(0,S.jsx)(o_.t5J,{className:" text-white scale-x-[-1] "})})}):"error"===e?(0,S.jsxs)("div",{className:"w-2 h-2 rounded-full bg-red-500",children:[" ",(0,S.jsx)("div",{className:"w-2 h-2 rounded-full bg-red-500 animate-ping"})]}):null}var oK=(0,K.eK)("useUserProfiles");function oG(){var e,t,n,s,r,a,i=(0,q.useState)(!1),o=i[0],l=i[1],c=oK([]),d=(0,y.Z)(c,1)[0],u=null==d||null===(e=d.find)||void 0===e?void 0:e.call(d,function(e){return e.isCurrent}),m=(0,eI.e)().cloudTokenPayload,p=_(),h=null==p||null===(t=p.serverHostConfig)||void 0===t?void 0:t.currentUser;if((0,q.useEffect)(function(){l(!0)},[]),!o)return null;var g=((null==u?void 0:u.name)||(null==h||null===(n=h.profile)||void 0===n?void 0:n.firstName)||(null==h?void 0:h.email)||(null==m||null===(s=m.user)||void 0===s?void 0:s.email)||(null==h?void 0:h.externalUserID)||"")[0],f=(0,O.vm)((null==h?void 0:h.email)||(null==h?void 0:h.externalUserID)||(null==m||null===(r=m.user)||void 0===r?void 0:r.email)||""),x=(null==u?void 0:u.picURL)||(null==h||null===(a=h.profile)||void 0===a?void 0:a.profilePictureURL);return x?(0,S.jsx)("img",{src:x,"data-element-id":"user-profile-image",className:"w-[40px] h-[40px] object-cover rounded-sm transition-all error-fallback-gray overflow-hidden"}):g?(0,S.jsx)("div",{style:{backgroundColor:f},className:"h-full w-full rounded-sm flex items-center justify-center",children:(0,S.jsx)("div",{className:"text-xl font-extrabold",children:g.toUpperCase()})}):(0,S.jsx)("div",{className:"h-6 w-6 flex items-center justify-center",children:(0,S.jsx)(C.q1E,{"data-element-id":"user-profile-symbol",className:"h-5 w-5 text-white"})})}function oF(e){var t=e.connection;return(0,S.jsx)("div",{className:"my-4 text-center mx-auto",children:(0,S.jsxs)("button",{onClick:function(){window.localStorage.setItem("returnURL",window.location.href);var e="/api/hosted/oauth/redirect-login?connection=".concat(t.id);window.location.href=e},className:"cursor-pointer flex w-full items-center justify-center gap-2 text-blue-500 border border-blue-200 px-4 py-2 rounded-lg shadow font-semibold text-sm hover:shadow-md transition-all dark:border-blue-900 dark:bg-gray-800 dark:hover:bg-gray-900 hover:bg-blue-50 disabled:bg-gray-100 disabled:text-gray-500 disabled:border-gray-200 disabled:shadow-none disabled:cursor-default",children:[t.iconURL?(0,S.jsx)("img",{className:"w-6 h-6 rounded-full overflow-hidden",src:t.iconURL,alt:t.name}):null,(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"e/ToF5",values:{0:t.name}})})]})})}var oY=n(9008),oU=n.n(oY),oH=n(70046);function oz(e){var t=e.title,n=e.showNotification,s=e.description,r=void 0===s?T.ag._({id:"pQg6X8"}):s,a=e.hostConfig,i=e.overridePosterURL,o=e.darkMode,l=void 0===o?null:o,c=nn().isDarkMode,d=a?a.brand+" – "+a.tagline:T.ag._({id:"qdQfLS"}),u=(void 0!==n&&n?"(*) ":"")+(t||d),m=a?a.hostname?"https://"+a.hostname+"/":"https://".concat(a.subdomain,".").concat(oH.env.INSTANCE_BASE_HOSTNAME||"typingcloud.com","/"):"https://www.typingmind.com",p=a&&"".concat(m,"api/poster?name=").concat(encodeURIComponent(a.name),"&tagline=").concat(encodeURIComponent(a.tagline),"&logo=").concat(a.logoURL),h=i||(null==a?void 0:a.posterURL)||p||"https://image.social/get?url=typingmind.com",g=(null==a?void 0:a.description)||r,f=null==a?void 0:a.logoURL;return(0,S.jsxs)(oU(),{children:[(0,S.jsx)("title",{children:u}),(0,S.jsx)("meta",{name:"title",content:u}),(0,S.jsx)("meta",{name:"description",content:g}),(0,S.jsx)("meta",{property:"og:type",content:"website"}),(0,S.jsx)("meta",{property:"og:url",content:m}),(0,S.jsx)("meta",{property:"og:title",content:u}),(0,S.jsx)("meta",{property:"og:description",content:g}),(0,S.jsx)("meta",{property:"og:image",content:h}),(0,S.jsx)("meta",{property:"twitter:card",content:"summary_large_image"}),(0,S.jsx)("meta",{property:"twitter:url",content:m}),(0,S.jsx)("meta",{property:"twitter:title",content:u}),(0,S.jsx)("meta",{property:"twitter:description",content:g}),(0,S.jsx)("meta",{property:"twitter:image",content:h}),(0,S.jsx)("meta",{name:"viewport",content:"initial-scale=1, viewport-fit=cover"}),(0,S.jsx)("link",{rel:"apple-touch-icon",sizes:"152x152",href:f||"/apple-icon-152x152.png"}),(0,S.jsx)("link",{rel:"apple-touch-icon",sizes:"180x180",href:f||"/apple-icon-180x180.png"}),(0,S.jsx)("link",{rel:"icon",type:"image/png",sizes:"192x192",href:f||"/android-icon-192x192.png"}),(0,S.jsx)("link",{rel:"icon",type:"image/png",sizes:"32x32",href:f||"/favicon-32x32.png"}),(0,S.jsx)("link",{rel:"icon",type:"image/png",sizes:"96x96",href:f||"/favicon-96x96.png"}),(0,S.jsx)("link",{rel:"icon",type:"image/png",sizes:"16x16",href:f||"/favicon-16x16.png"}),(0,S.jsx)("link",{rel:"manifest",href:a?"/api/manifest":"/manifest.json"}),(0,S.jsx)("meta",{name:"msapplication-TileImage",content:f||"/ms-icon-144x144.png"}),null!=a&&a.hosted?null:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("link",{rel:"apple-touch-startup-image",media:"screen and (device-width: 430px) and (device-height: 932px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)",href:"splash_screens/iPhone_15_Pro_Max__iPhone_15_Plus__iPhone_14_Pro_Max_landscape.png"}),(0,S.jsx)("link",{rel:"apple-touch-startup-image",media:"screen and (device-width: 393px) and (device-height: 852px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)",href:"splash_screens/iPhone_15_Pro__iPhone_15__iPhone_14_Pro_landscape.png"}),(0,S.jsx)("link",{rel:"apple-touch-startup-image",media:"screen and (device-width: 428px) and (device-height: 926px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)",href:"splash_screens/iPhone_14_Plus__iPhone_13_Pro_Max__iPhone_12_Pro_Max_landscape.png"}),(0,S.jsx)("link",{rel:"apple-touch-startup-image",media:"screen and (device-width: 390px) and (device-height: 844px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)",href:"splash_screens/iPhone_14__iPhone_13_Pro__iPhone_13__iPhone_12_Pro__iPhone_12_landscape.png"}),(0,S.jsx)("link",{rel:"apple-touch-startup-image",media:"screen and (device-width: 375px) and (device-height: 812px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)",href:"splash_screens/iPhone_13_mini__iPhone_12_mini__iPhone_11_Pro__iPhone_XS__iPhone_X_landscape.png"}),(0,S.jsx)("link",{rel:"apple-touch-startup-image",media:"screen and (device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)",href:"splash_screens/iPhone_11_Pro_Max__iPhone_XS_Max_landscape.png"}),(0,S.jsx)("link",{rel:"apple-touch-startup-image",media:"screen and (device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)",href:"splash_screens/iPhone_11__iPhone_XR_landscape.png"}),(0,S.jsx)("link",{rel:"apple-touch-startup-image",media:"screen and (device-width: 414px) and (device-height: 736px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)",href:"splash_screens/iPhone_8_Plus__iPhone_7_Plus__iPhone_6s_Plus__iPhone_6_Plus_landscape.png"}),(0,S.jsx)("link",{rel:"apple-touch-startup-image",media:"screen and (device-width: 375px) and (device-height: 667px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)",href:"splash_screens/iPhone_8__iPhone_7__iPhone_6s__iPhone_6__4.7__iPhone_SE_landscape.png"}),(0,S.jsx)("link",{rel:"apple-touch-startup-image",media:"screen and (device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)",href:"splash_screens/4__iPhone_SE__iPod_touch_5th_generation_and_later_landscape.png"}),(0,S.jsx)("link",{rel:"apple-touch-startup-image",media:"screen and (device-width: 1024px) and (device-height: 1366px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)",href:"splash_screens/12.9__iPad_Pro_landscape.png"}),(0,S.jsx)("link",{rel:"apple-touch-startup-image",media:"screen and (device-width: 834px) and (device-height: 1194px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)",href:"splash_screens/11__iPad_Pro__10.5__iPad_Pro_landscape.png"}),(0,S.jsx)("link",{rel:"apple-touch-startup-image",media:"screen and (device-width: 820px) and (device-height: 1180px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)",href:"splash_screens/10.9__iPad_Air_landscape.png"}),(0,S.jsx)("link",{rel:"apple-touch-startup-image",media:"screen and (device-width: 834px) and (device-height: 1112px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)",href:"splash_screens/10.5__iPad_Air_landscape.png"}),(0,S.jsx)("link",{rel:"apple-touch-startup-image",media:"screen and (device-width: 810px) and (device-height: 1080px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)",href:"splash_screens/10.2__iPad_landscape.png"}),(0,S.jsx)("link",{rel:"apple-touch-startup-image",media:"screen and (device-width: 768px) and (device-height: 1024px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)",href:"splash_screens/9.7__iPad_Pro__7.9__iPad_mini__9.7__iPad_Air__9.7__iPad_landscape.png"}),(0,S.jsx)("link",{rel:"apple-touch-startup-image",media:"screen and (device-width: 744px) and (device-height: 1133px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)",href:"splash_screens/8.3__iPad_Mini_landscape.png"}),(0,S.jsx)("link",{rel:"apple-touch-startup-image",media:"screen and (device-width: 430px) and (device-height: 932px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)",href:"splash_screens/iPhone_15_Pro_Max__iPhone_15_Plus__iPhone_14_Pro_Max_portrait.png"}),(0,S.jsx)("link",{rel:"apple-touch-startup-image",media:"screen and (device-width: 393px) and (device-height: 852px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)",href:"splash_screens/iPhone_15_Pro__iPhone_15__iPhone_14_Pro_portrait.png"}),(0,S.jsx)("link",{rel:"apple-touch-startup-image",media:"screen and (device-width: 428px) and (device-height: 926px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)",href:"splash_screens/iPhone_14_Plus__iPhone_13_Pro_Max__iPhone_12_Pro_Max_portrait.png"}),(0,S.jsx)("link",{rel:"apple-touch-startup-image",media:"screen and (device-width: 390px) and (device-height: 844px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)",href:"splash_screens/iPhone_14__iPhone_13_Pro__iPhone_13__iPhone_12_Pro__iPhone_12_portrait.png"}),(0,S.jsx)("link",{rel:"apple-touch-startup-image",media:"screen and (device-width: 375px) and (device-height: 812px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)",href:"splash_screens/iPhone_13_mini__iPhone_12_mini__iPhone_11_Pro__iPhone_XS__iPhone_X_portrait.png"}),(0,S.jsx)("link",{rel:"apple-touch-startup-image",media:"screen and (device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)",href:"splash_screens/iPhone_11_Pro_Max__iPhone_XS_Max_portrait.png"}),(0,S.jsx)("link",{rel:"apple-touch-startup-image",media:"screen and (device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)",href:"splash_screens/iPhone_11__iPhone_XR_portrait.png"}),(0,S.jsx)("link",{rel:"apple-touch-startup-image",media:"screen and (device-width: 414px) and (device-height: 736px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)",href:"splash_screens/iPhone_8_Plus__iPhone_7_Plus__iPhone_6s_Plus__iPhone_6_Plus_portrait.png"}),(0,S.jsx)("link",{rel:"apple-touch-startup-image",media:"screen and (device-width: 375px) and (device-height: 667px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)",href:"splash_screens/iPhone_8__iPhone_7__iPhone_6s__iPhone_6__4.7__iPhone_SE_portrait.png"}),(0,S.jsx)("link",{rel:"apple-touch-startup-image",media:"screen and (device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)",href:"splash_screens/4__iPhone_SE__iPod_touch_5th_generation_and_later_portrait.png"}),(0,S.jsx)("link",{rel:"apple-touch-startup-image",media:"screen and (device-width: 1024px) and (device-height: 1366px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)",href:"splash_screens/12.9__iPad_Pro_portrait.png"}),(0,S.jsx)("link",{rel:"apple-touch-startup-image",media:"screen and (device-width: 834px) and (device-height: 1194px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)",href:"splash_screens/11__iPad_Pro__10.5__iPad_Pro_portrait.png"}),(0,S.jsx)("link",{rel:"apple-touch-startup-image",media:"screen and (device-width: 820px) and (device-height: 1180px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)",href:"splash_screens/10.9__iPad_Air_portrait.png"}),(0,S.jsx)("link",{rel:"apple-touch-startup-image",media:"screen and (device-width: 834px) and (device-height: 1112px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)",href:"splash_screens/10.5__iPad_Air_portrait.png"}),(0,S.jsx)("link",{rel:"apple-touch-startup-image",media:"screen and (device-width: 810px) and (device-height: 1080px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)",href:"splash_screens/10.2__iPad_portrait.png"}),(0,S.jsx)("link",{rel:"apple-touch-startup-image",media:"screen and (device-width: 768px) and (device-height: 1024px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)",href:"splash_screens/9.7__iPad_Pro__7.9__iPad_mini__9.7__iPad_Air__9.7__iPad_portrait.png"}),(0,S.jsx)("link",{rel:"apple-touch-startup-image",media:"screen and (device-width: 744px) and (device-height: 1133px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)",href:"splash_screens/8.3__iPad_Mini_portrait.png"})]}),(null===l?c:l)?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("meta",{name:"msapplication-TileColor",content:"#27272a"}),(0,S.jsx)("meta",{name:"theme-color",content:"#27272a"}),(0,S.jsx)("style",{children:"\n html {\n color-scheme: dark;\n }\n "})]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("meta",{name:"msapplication-TileColor",content:"#ffffff"}),(0,S.jsx)("meta",{name:"theme-color",content:"#ffffff"})]})]})}var oW="Something went wrong. Please try again.";function oQ(e){e.hostConfig;var t,n=(0,q.useState)(!1),s=n[0],r=n[1],a=(0,q.useState)(null),i=a[0],o=a[1],l=(0,q.useState)([]),c=l[0],d=l[1],u=(0,q.useState)(!1),m=u[0],p=u[1];(0,q.useEffect)(function(){h()},[]);var h=(t=(0,x.Z)(j().mark(function e(){var t;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r(!0),o(""),e.prev=2,e.next=5,fetch("/api/hosted/public-sso-connections",{headers:{"Content-Type":"application/json"},method:"GET"});case 5:if(!((t=e.sent).status>=400)){e.next=13;break}return e.next=9,t.json();case 9:return o(e.sent.userMessage||oW),r(!1),e.abrupt("return");case 13:if(t.ok){e.next=17;break}return o(oW),r(!1),e.abrupt("return");case 17:return e.next=19,t.json();case 19:d(e.sent.connections),e.next=27;break;case 23:e.prev=23,e.t0=e.catch(2),o(oW),console.error(e.t0);case 27:r(!1);case 28:case"end":return e.stop()}},e,null,[[2,23]])})),function(){return t.apply(this,arguments)});return(0,S.jsx)("div",{children:(0,S.jsxs)("div",{className:"max-w-3xl mx-auto",children:[s?(0,S.jsx)("div",{className:" flex items-center justify-center p-4",children:(0,S.jsx)(E,{})}):(0,S.jsxs)("div",{className:"my-4",children:[(0,S.jsx)("div",{className:"mt-2 text-center font-semibold",children:(0,S.jsx)(A.cC,{id:"YH4rCS"})}),(null==c?void 0:c.length)>0?(0,S.jsxs)("div",{className:"max-w-md mx-auto my-4",children:[c.map(function(e){return(0,S.jsx)("a",{href:"/api/hosted/sso-login?clientID="+e.clientID+"&redirect_uri="+encodeURIComponent(window.location.pathname)+(m?"&relogin=true":""),onClick:function(e){e.target.innerText=T.ag._({id:"Z3FXyt"})},className:"inline-block w-full my-1 border rounded-md border-gray-200 px-4 py-2 shadow text-center font-medium hover:bg-gray-100 transition-all dark:bg-gray-900 dark:hover:bg-gray-800 dark:border-gray-700",children:e.name},e.clientID)}),(0,S.jsx)("div",{className:"text-center",children:(0,S.jsxs)("label",{className:"inline-flex items-center justify-start gap-2 my-2 text-left",children:[(0,S.jsx)("input",{type:"checkbox",checked:m,onChange:function(e){return p(e.target.checked)}}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"WsEnIq"})})]})})]}):(0,S.jsx)("div",{className:"max-w-md mx-auto px-4 mt-2",children:(0,S.jsx)(A.cC,{id:"ksNPZj"})})]}),i?(0,S.jsx)("div",{className:"text-red-500 text-center",children:i}):null]})})}var oJ="Something went wrong. Please try again.";function oX(e){var t,n,s,r=e.hostConfig,a=e.onLoggedIn,i=e.defaultEmail,o=void 0===i?"":i,l=e.requireInviteCode,c=e.loginLabel,d=(0,q.useState)(null),u=d[0],m=d[1],p=(0,q.useState)(o),h=p[0],g=p[1],f=(0,q.useState)(""),b=f[0],v=f[1],y=(0,q.useState)(!1),w=y[0],k=y[1],N=(0,q.useState)(""),C=N[0],I=N[1],O=(0,q.useState)(!1),V=O[0],P=O[1],M=(0,q.useState)(!1),D=M[0],B=M[1],L=(0,q.useRef)(null),R=(0,q.useRef)(null);(0,q.useEffect)(function(){g(o),setTimeout(function(){var e;null===(e=R.current)||void 0===e||e.focus()},[])},[o]);var _=(t=(0,x.Z)(j().mark(function e(){var t,n;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,P(!0),m(""),t=window.localStorage.getItem("SKIP_EMAIL"),e.next=6,fetch("/api/hosted/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:h,inviteCode:b,orgID:r.orgID,skipEmail:t})});case 6:if(!((n=e.sent).status>=400)){e.next=14;break}return e.next=10,n.json();case 10:return m(e.sent.userMessage||oJ),P(!1),e.abrupt("return");case 14:if(n.ok){e.next=18;break}return m(oJ),P(!1),e.abrupt("return");case 18:return e.next=20,n.json();case 20:e.sent,k(!0),setTimeout(function(){L.current.focus()},100),e.next=29;break;case 25:e.prev=25,e.t0=e.catch(0),console.error(e.t0),m(oJ);case 29:P(!1);case 30:case"end":return e.stop()}},e,null,[[0,25]])})),function(){return t.apply(this,arguments)}),Z=(n=(0,x.Z)(j().mark(function e(){var t;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,P(!0),m(""),e.next=5,fetch("/api/hosted/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:h,code:C,orgID:r.orgID}),credentials:"include"});case 5:if(!((t=e.sent).status>=400)){e.next=13;break}return e.next=9,t.json();case 9:return m(e.sent.userMessage||oJ),P(!1),e.abrupt("return");case 13:if(t.ok){e.next=17;break}return m(oJ),P(!1),e.abrupt("return");case 17:setTimeout(function(){null==a||a()},2e3),e.next=24;break;case 20:e.prev=20,e.t0=e.catch(0),console.error(e.t0),m(oJ);case 24:case"end":return e.stop()}},e,null,[[0,20]])})),function(){return n.apply(this,arguments)});return(0,S.jsxs)("div",{children:[D?(0,S.jsx)(oQ,{hostConfig:r}):(0,S.jsxs)("div",{children:[w?(0,S.jsxs)("div",{children:[(0,S.jsxs)("div",{className:"my-4",children:[(0,S.jsx)("div",{children:(0,S.jsx)(A.cC,{id:"oVltH4"})}),(0,S.jsx)("div",{className:"font-semibold text-lg p-2 text-center bg-gray-100 my-2 rounded-md dark:bg-gray-700",children:h}),(0,S.jsx)("div",{className:"my-1 font-semibold",children:(0,S.jsx)(A.cC,{id:"B9mcRt"})}),(0,S.jsx)("input",{ref:L,type:"text",disabled:V,placeholder:"XXXXXX",className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-zinc-700 text-xl text-center",value:C,onChange:function(e){return I(e.target.value)},onKeyDown:function(e){"Enter"===e.key&&(e.preventDefault(),Z())}})]}),u&&(0,S.jsx)("div",{className:"text-center text-red-500 text-sm font-semibold my-2",children:u}),(0,S.jsxs)("div",{className:"my-4 flex items-center justify-center gap-2",children:[(0,S.jsxs)("button",{onClick:Z,disabled:V||!C,className:"flex items-center justify-center px-3 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 disabled:cursor-default transition-colors gap-2",children:[V?(0,S.jsx)(E,{}):null,(0,S.jsx)(A.cC,{id:"hQRttt"})]}),(0,S.jsx)("button",{onClick:function(){return k(!1)},disabled:V,className:"flex items-center justify-center px-3 py-2 border border-transparent text-sm font-medium rounded-md text-black bg-white-600 hover:bg-white-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-white-500 disabled:bg-gray-400 disabled:cursor-default transition-colors gap-2 disabled:text-white dark:text-white",children:(0,S.jsx)(A.cC,{id:"dEgA5A"})})]})]}):(0,S.jsxs)("div",{children:[(0,S.jsxs)("div",{className:"my-4",children:[(0,S.jsx)("div",{className:"my-1 font-semibold",children:(0,S.jsx)(A.cC,{id:"vUqMKV"})}),(0,S.jsx)("input",{type:"email",ref:R,disabled:V,placeholder:"example@gmail.com",className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm dark:bg-zinc-700",value:h,onChange:function(e){return g(e.target.value)},onKeyDown:function(e){"Enter"===e.key&&(e.preventDefault(),_())}})]}),(void 0===l?"":l)?(0,S.jsxs)("div",{className:"my-4",children:[(0,S.jsx)("div",{className:"my-1 font-semibold",children:(0,S.jsx)(A.cC,{id:"eJbPDS"})}),(0,S.jsx)("div",{className:"text-xs font-semibold my-1 text-gray-500",children:(0,S.jsx)(A.cC,{id:"fSOo0q"})}),(0,S.jsx)("input",{type:"text",disabled:V,placeholder:"XXXXXX",className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-zinc-700 text-xl text-center",value:b,onChange:function(e){return v(e.target.value)},onKeyDown:function(e){"Enter"===e.key&&(e.preventDefault(),_())}})]}):null,u&&(0,S.jsx)("div",{className:"text-center text-red-500 text-sm font-semibold my-2",children:u}),(0,S.jsx)("div",{className:"my-4 flex items-center justify-center gap-2",children:(0,S.jsxs)("button",{onClick:_,disabled:V||!h,className:"cursor-pointer flex w-full items-center justify-center gap-2 text-blue-500 border border-blue-200 px-4 py-2 rounded-lg shadow font-semibold text-sm hover:shadow-md transition-all dark:border-blue-900 dark:bg-gray-800 dark:hover:bg-gray-900 hover:bg-blue-50 disabled:bg-gray-100 disabled:text-gray-500 disabled:border-gray-200 disabled:shadow-none disabled:cursor-default",children:[V?(0,S.jsx)(E,{}):(0,S.jsx)("span",{children:"→"}),(0,S.jsx)("span",{children:r.allowPublicUse&&r.publicModeAllowSignUp?T.ag._({id:"FK/gUg"}):c||T.ag._({id:"11JwGr"})})]})})]}),null!==(s=r.oauthConnections)&&void 0!==s&&s.length?(0,S.jsxs)("div",{children:[(0,S.jsx)("hr",{className:"my-2 border-gray-200 dark:border-gray-700"}),r.oauthConnections.map(function(e){return(0,S.jsx)(oF,{connection:e},e.id)})]}):null]}),r.allowSSOLogin?D?(0,S.jsx)("div",{className:"my-4 text-center mx-auto",children:(0,S.jsxs)("button",{onClick:function(){return B(!1)},className:"cursor-pointer flex w-full items-center justify-center gap-2 text-blue-500 border border-blue-200 px-4 py-2 rounded-lg shadow font-semibold text-sm hover:shadow-md transition-all dark:border-blue-900 dark:bg-gray-800 dark:hover:bg-gray-900 hover:bg-blue-50 disabled:bg-gray-100 disabled:text-gray-500 disabled:border-gray-200 disabled:shadow-none disabled:cursor-default",children:[(0,S.jsx)("span",{children:"→"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"u62JiU"})})]})}):(0,S.jsx)("div",{className:"my-4 text-center mx-auto",children:(0,S.jsxs)("button",{onClick:function(){return B(!0)},className:"cursor-pointer flex w-full items-center justify-center gap-2 text-blue-500 border border-blue-200 px-4 py-2 rounded-lg shadow font-semibold text-sm hover:shadow-md transition-all dark:border-blue-900 dark:bg-gray-800 dark:hover:bg-gray-900 hover:bg-blue-50 disabled:bg-gray-100 disabled:text-gray-500 disabled:border-gray-200 disabled:shadow-none disabled:cursor-default",children:[(0,S.jsx)("span",{children:"→"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"kQqZRh"})})]})}):null]})}function o$(e){var t=e.hostConfig,n=e.onLoggedIn,s=e.small,r=(0,q.useState)(!1),a=r[0],i=r[1];return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("button",{"data-element-id":"login-button",className:s?"text-blue-500 font-semibold hover:underline text-sm":"inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",onClick:function(){return i(!0)},id:"org-login-button",children:t.allowPublicUse&&t.publicModeAllowSignUp?"→ Login / Signup":"→ Member Login"}),(0,S.jsxs)(X,{open:a,setOpen:function(){return i(!1)},showCloseButton:!1,children:[(0,S.jsxs)("h2",{className:"text-lg text-center mb-4 font-semibold",children:["Login to ",t.name]}),(0,S.jsx)(oX,{hostConfig:t,onLoggedIn:n,requireInviteCode:t.allowSubscriptions})]})]})}var o0={id:"fWsBTs"};function o1(e){(0,nq.Z)(e);var t,n=(0,q.useState)(!1),s=(n[0],n[1]),r=(0,q.useState)(null),a=(r[0],r[1]),i=(0,q.useState)([]),o=i[0],l=i[1],c=(0,A.mV)().i18n;(0,q.useEffect)(function(){d()},[]);var d=(t=(0,x.Z)(j().mark(function e(){var t;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return s(!0),a(""),e.prev=2,e.next=5,fetch("/api/hosted/invite-codes",{headers:{"Content-Type":"application/json"}});case 5:if(!((t=e.sent).status>=400)){e.next=13;break}return e.next=9,t.json();case 9:return a(e.sent.userMessage||c._(o0)),s(!1),e.abrupt("return");case 13:if(t.ok){e.next=17;break}return a(c._(o0)),s(!1),e.abrupt("return");case 17:return e.next=19,t.json();case 19:l(e.sent.codes),e.next=27;break;case 23:e.prev=23,e.t0=e.catch(2),a(c._(o0)),console.error(e.t0);case 27:s(!1);case 28:case"end":return e.stop()}},e,null,[[2,23]])})),function(){return t.apply(this,arguments)});return(0,S.jsx)("div",{children:o.length?(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"text-center my-2",children:(0,S.jsx)(A.cC,{id:"3dz4IW",values:{0:o.length}})}),(0,S.jsx)("div",{className:"flex items-center justify-center gap-2 flex-col",children:o.map(function(e){return(0,S.jsx)("div",{className:"text-center w-fit bg-gray-200 p-2 rounded-md border-gray-200 dark:bg-zinc-700 dark:border-zinc-500 border",children:e},e)})})]}):(0,S.jsx)("div",{children:(0,S.jsx)(A.cC,{id:"IBn/EB"})})})}function o2(e){var t,n=e.subscription;return(0,S.jsxs)("div",{className:"text-xs py-2",children:[(0,S.jsx)("div",{children:(0,S.jsx)("a",{href:null===(t=n.payload)||void 0===t?void 0:t.update_url,className:"text-blue-500 hover:text-blue-600",target:"_blank",rel:"noreferrer noopener",children:"Update Payment Method"})}),(0,S.jsx)("div",{children:(0,S.jsx)(eS,{onConfirmed:function(){var e;return window.location.href=null===(e=n.payload)||void 0===e?void 0:e.cancel_url},className:"text-red-500 font-semibold",children:"Cancel"})})]})}var o4=n(70046),o5="Something went wrong. Please try again.";function o3(e){var t,n,s,r,a,i,o=e.user,l=e.hostConfig,c=(0,q.useState)(!0),d=c[0],u=c[1],m=(0,q.useState)(!1),p=m[0],h=m[1],g=(0,q.useState)(null),f=g[0],b=g[1];(0,q.useEffect)(function(){v()},[]);var v=(t=(0,x.Z)(j().mark(function e(){return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(window.Paddle){e.next=5;break}return e.next=3,new Promise(function(e){return setTimeout(e,100)});case 3:e.next=0;break;case 5:window.Paddle.Setup({vendor:Number(o4.env.NEXT_PUBLIC_PADDLE_VENDOR_ID)}),u(!1);case 8:case"end":return e.stop()}},e)})),function(){return t.apply(this,arguments)}),y=function(e){window.Paddle.Checkout.open({product:Number(e),email:o.email,disableLogout:!0,allowQuantity:!1,customData:{orgID:l.orgID},successCallback:function(){window.location.href="/user_subscription_verify"}})},w=(n=(0,x.Z)(j().mark(function e(t){var n;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return h(!0),b(""),e.prev=2,e.next=5,fetch("/api/hosted/update-plan",{body:JSON.stringify({planID:t}),headers:{"Content-Type":"application/json"},method:"POST"});case 5:if(!((n=e.sent).status>=400)){e.next=13;break}return e.next=9,n.json();case 9:return b(e.sent.userMessage||o5),h(!1),e.abrupt("return");case 13:if(n.ok){e.next=17;break}return b(o5),h(!1),e.abrupt("return");case 17:window.location.href="/user_subscription_verify?planID="+t,e.next=24;break;case 20:e.prev=20,e.t0=e.catch(2),b(o5),console.error(e.t0);case 24:h(!1);case 25:case"end":return e.stop()}},e,null,[[2,20]])})),function(e){return n.apply(this,arguments)}),A=function(){var e;return null==o||null===(e=o.subscriptions)||void 0===e?void 0:e.some(function(e){return"active"===e.status&&O.xP.includes(e.planID)})},k=function(){var e;return null==o||null===(e=o.subscriptions)||void 0===e?void 0:e.some(function(e){return"active"===e.status&&O.oC.includes(e.planID)})};return(0,S.jsxs)("div",{children:[(0,S.jsxs)("div",{className:"text-xs my-4",children:["All plans include access to all AI chat models."," ",(0,S.jsx)("span",{className:"font-semibold text-orange-500",children:"GPT-4 availability is limited, subject to OpenAI's capacity."})]}),(0,S.jsx)("div",{className:"text-xs my-4",children:"Credit card is required on the free plan to avoid abuse."}),(0,S.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,S.jsxs)("div",{className:"p-2 rounded-md shadow-sm border border-gray-200 dark:border-zinc-700",children:[(0,S.jsx)("div",{className:"text-2xl font-bold text-center",children:"Free"}),(0,S.jsx)("div",{className:"text-center",children:(0,S.jsx)("span",{className:"text-2xl font-extrabold text-gray-500",children:"$0"})}),(0,S.jsxs)("ul",{className:"list-disc pl-4 text-xs my-2",children:[(0,S.jsx)("li",{children:"5 messages/day"}),(0,S.jsx)("li",{children:"GPT-4: Limited"}),(0,S.jsx)("li",{children:"Basic Features"}),(0,S.jsx)("li",{children:"0 invite codes"})]}),(0,S.jsx)("div",{className:"text-center",children:A()?(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"text-sm font-semibold text-green-500 py-2",children:"✅ Your Plan"}),null==o||null===(s=o.subscriptions)||void 0===s?void 0:s.filter(function(e){return"active"===e.status}).map(function(e){return(0,S.jsx)(o2,{subscription:e},e.subscriptionID)})]}):k()?(0,S.jsxs)("div",{children:[(0,S.jsx)(eS,{onConfirmed:function(){return w(o4.env.NEXT_PUBLIC_PADDLE_SUB_FREE_PLAN_ID)},type:"submit",className:"inline-flex items-center px-4 py-2 border border-transparent text-base font-medium rounded-md shadow-sm text-white bg-red-600 hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 disabled:bg-gray-400 gap-2",disabled:d||p,confirmText:function(){return(0,S.jsx)("span",{children:"Sure?"})},children:(0,S.jsx)("span",{children:"Downgrade"})}),(0,S.jsx)("div",{className:"text-xs text-gray-500 mt-1",children:"You will lose access immediately"})]}):(0,S.jsx)("button",{onClick:function(){return y(o4.env.NEXT_PUBLIC_PADDLE_SUB_FREE_PLAN_ID)},type:"submit",className:"inline-flex items-center px-4 py-2 border border-transparent text-base font-medium rounded-md shadow-sm text-white bg-green-600 hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 disabled:bg-gray-400 gap-2",disabled:d,children:(0,S.jsx)("span",{children:"Get Free"})})})]}),(0,S.jsxs)("div",{className:"p-2 rounded-md shadow-sm border border-gray-200 dark:border-zinc-700",children:[(0,S.jsx)("div",{className:"text-2xl font-bold text-center text-green-500",children:"Pro"}),(0,S.jsxs)("div",{className:"text-center",children:[(0,S.jsx)("span",{className:"text-2xl font-extrabold",children:"$20"}),"/month"]}),(0,S.jsxs)("ul",{className:"list-disc pl-4 text-xs my-2",children:[(0,S.jsx)("li",{children:"Unlimited messages*"}),(0,S.jsx)("li",{children:"GPT-4: Limited"}),(0,S.jsx)("li",{children:(0,S.jsx)("a",{target:"_blank",href:"https://typingmind.com/features",className:"text-blue-500 hover:underline",children:"Premium Features"})}),(0,S.jsx)("li",{children:"3 invite codes"})]}),(0,S.jsx)("div",{className:"text-center",children:k()?(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"text-sm font-semibold text-green-500 py-2",children:"✅ Your Plan"}),null==o||null===(r=o.subscriptions)||void 0===r?void 0:r.filter(function(e){return"active"===e.status}).map(function(e){return(0,S.jsx)(o2,{subscription:e},e.subscriptionID)})]}):A()?(0,S.jsxs)("div",{children:[(0,S.jsx)(eS,{onConfirmed:function(){return w(o4.env.NEXT_PUBLIC_PADDLE_SUB_PRO_PLAN_ID)},type:"submit",className:"inline-flex items-center px-4 py-2 border border-transparent text-base font-medium rounded-md shadow-sm text-white bg-green-600 hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 disabled:bg-gray-400 gap-2",disabled:d||p,confirmText:function(){return(0,S.jsx)("span",{children:"Sure?"})},children:(0,S.jsx)("span",{children:"Upgrade Pro"})}),(0,S.jsx)("div",{className:"text-xs text-gray-500 mt-1",children:"You will be charged immediately"})]}):(0,S.jsx)("button",{onClick:function(){return y(o4.env.NEXT_PUBLIC_PADDLE_SUB_PRO_PLAN_ID)},type:"submit",className:"inline-flex items-center px-4 py-2 border border-transparent text-base font-medium rounded-md shadow-sm text-white bg-green-600 hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 disabled:bg-gray-400 gap-2",disabled:d,children:(0,S.jsx)("span",{children:"Buy Pro"})})})]})]}),f&&(0,S.jsx)("div",{className:"text-red-500 text-sm font-semibold mt-2",children:f}),(0,S.jsx)("div",{className:"text-xs text-gray-500 my-4 space-y-1 text-center",children:(0,S.jsxs)("div",{children:["By subscribing to a plan, you agree to our"," ",(0,S.jsx)("a",{href:(null==l||null===(a=l.links)||void 0===a?void 0:a.terms)||"/terms",target:"_blank",rel:"noopener noreferrer",className:"text-gray-500 underline",children:"Terms of Service"})," and ",(0,S.jsx)("a",{href:(null==l||null===(i=l.links)||void 0===i?void 0:i.privacy)||"/terms",target:"_blank",rel:"noopener noreferrer",className:"text-gray-500 underline",children:"Privacy Policy"}),". Prices are in USD. VAT may apply. Secure payment by"," ",(0,S.jsx)("a",{href:"https://paddle.com",target:"_blank",rel:"noopener noreferrer",className:"text-gray-500 underline",children:"Paddle"}),"."]})}),(0,S.jsxs)("details",{className:"text-xs my-4 space-y-1 text-center",children:[(0,S.jsx)("summary",{className:"cursor-pointer hover:underline",children:"(*) Fair use policy applies"}),(0,S.jsxs)("ul",{className:"list-disc pl-4 text-xs my-2 text-left",children:[(0,S.jsx)("li",{children:"Maximum 10,000 characters per message."}),(0,S.jsx)("li",{children:"Maximum 3,000 messages per day."}),(0,S.jsx)("li",{children:"Maximum 200,000 tokens usage per month."}),(0,S.jsx)("li",{children:"We reserve the right to suspend or terminate your account if you violate the fair use policy."}),(0,S.jsx)("li",{children:"Tokens are counted based on the usage of OpenAI's API resulted from your account's activities."}),(0,S.jsx)("li",{children:"Please see our Terms of Service for more details."})]})]}),(0,S.jsx)(N(),{src:"https://cdn.paddle.com/paddle/paddle.js"})]})}function o6(e){e.user,e.hostConfig;var t=(0,q.useState)(!1),n=t[0],s=t[1];return(0,S.jsxs)("div",{children:[(0,S.jsx)("button",{onClick:function(){return s(!0)},className:"font-semibold text-blue-400 hover:underline",children:"Invite Codes"}),(0,S.jsxs)(X,{open:n,setOpen:s,children:[(0,S.jsx)("h2",{className:"text-center text-xl font-bold mb-4",children:"Invite Codes"}),n?(0,S.jsx)(o1,{}):null]})]})}function o7(e){var t=e.user,n=e.hostConfig,s=(0,q.useState)(!1),r=s[0],a=s[1];(0,q.useEffect)(function(){0===t.subscriptions.filter(function(e){return"active"===e.status}).length&&a(!0)},[]);var i=t.subscriptions.filter(function(e){return O.oC.includes(e.planID)}).filter(function(e){var t;return null==e||null===(t=e.payload)||void 0===t?void 0:t.cancellation_effective_date});return(0,S.jsxs)("div",{children:[t.subscriptions.filter(function(e){return"active"===e.status}).length?(0,S.jsx)("button",{onClick:function(){return a(!0)},className:"font-semibold text-green-500 hover:underline",children:"Manage Subscription"}):(0,S.jsx)("button",{onClick:function(){return a(!0)},className:"font-semibold text-green-500 hover:underline",children:"→ Signup: free 5 messages/day"}),(0,S.jsxs)(X,{open:r,setOpen:a,children:[(0,S.jsx)("h2",{className:"text-center text-xl font-bold mb-4",children:"Manage Subscription"}),i.length?i.map(function(e,t){return(0,S.jsxs)("div",{className:"bg-yellow-100 border-l-4 border-yellow-500 p-4 mb-4 text-xs",children:[(0,S.jsx)("p",{className:"font-semibold",children:"You have a subscription that is being cancelled."}),(0,S.jsxs)("p",{children:["Cancellation effective date:"," ",(0,S.jsx)("b",{children:e.payload.cancellation_effective_date})]}),(0,S.jsx)("p",{children:"You can still use the app until the end of your billing period."})]},t)}):null,r?(0,S.jsx)(o3,{user:t,hostConfig:n}):null]})]})}function o8(e){var t,n,s,r,a,i,o,l,c=e.setOpenOrgUserProfilePopup,d=(0,eI.e)(),u=d.user,m=d.logout;return(0,S.jsxs)("div",{className:"flex items-start w-full",children:[(0,S.jsx)("div",{className:"self-center mr-2",children:(0,S.jsx)("div",{className:"w-8 h-8 bg-white/20 flex items-center justify-center flex-shrink-0 rounded-full",children:(0,S.jsx)(C.Xws,{className:"h-4 w-4 text-white"})})}),(0,S.jsxs)("div",{className:"truncate",children:[(0,S.jsx)("div",{className:"block font-semibold mb-0.5",children:null!==(t=u.profile)&&void 0!==t&&t.firstName&&null!==(n=u.profile)&&void 0!==n&&n.lastName?"".concat([null===(s=u.profile)||void 0===s?void 0:s.firstName,null===(r=u.profile)||void 0===r?void 0:r.lastName].join(" ")):(0,S.jsx)(A.cC,{id:"qhwV2C"})}),(0,S.jsx)("div",{className:"break-all text-sm truncate",children:null!=u&&null!==(a=u.externalUserData)&&void 0!==a&&a.provider?(0,S.jsx)("span",{className:"text-sm",children:(0,S.jsx)(A.cC,{id:"twilsj",values:{0:null===(i=u.externalUserData)||void 0===i?void 0:i.provider},components:{0:(0,S.jsx)("span",{className:"capitalize"})}})}):u.email||u.externalUserID})]}),(0,S.jsxs)(eU.v2,{as:"div",className:"relative flex text-left ml-auto",children:[(0,S.jsxs)(eU.j2,{className:"relative -mr-1 text-gray-100 hover:text-white transiton-all inline-block group-hover:inline-block p-0.5 rounded-full hover:bg-white/20 cursor-pointer",children:[(0,S.jsx)(M.$T6,{className:"w-6 h-6"}),null!==(o=u.profile)&&void 0!==o&&o.firstName&&null!==(l=u.profile)&&void 0!==l&&l.lastName?null:(0,S.jsx)("div",{className:"absolute top-0 right-1 w-1.5 h-1.5 rounded-full bg-orange-500"})]}),(0,S.jsx)(U.u,{as:q.Fragment,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:(0,S.jsx)(eU.sd,{modal:!1,className:"absolute z-40 right-0 mt-2 origin-top-right -top-1/2 divide-y divide-gray-100 rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none",children:(0,S.jsxs)("div",{className:"px-1 py-1 ",children:[(0,S.jsx)(eU.sN,{children:function(e){var t,n,s=e.focus;return(0,S.jsxs)("button",{className:"".concat(s?"bg-blue-600 text-white":"text-gray-900"," relative cursor-default group flex shrink-0 whitespace-nowrap space-x-2 w-full items-center rounded-md pl-2 pr-3 py-2 text-sm font-medium"),onClick:function(){return c(!0)},children:[(0,S.jsx)(C.dfI,{className:"w-4 h-4"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"Dx6IaP"})}),null!==(t=u.profile)&&void 0!==t&&t.firstName&&null!==(n=u.profile)&&void 0!==n&&n.lastName?null:(0,S.jsx)("div",{className:"absolute top-2 left-3 w-1.5 h-1.5 rounded-full bg-orange-500"})]})}}),(0,S.jsx)(eU.sN,{children:function(e){var t=e.focus;return(0,S.jsxs)("button",{onClick:function(){window.confirm("Are you sure you want to logout?")&&m()},className:"".concat(t?"bg-blue-600 text-white":"text-gray-900"," cursor-default group flex shrink-0 whitespace-nowrap space-x-2 w-full items-center rounded-md pl-2 pr-3 py-2 text-sm font-medium"),children:[(0,S.jsx)(C.d7k,{className:"w-4 h-4"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"nOhz3x"})})]})}})]})})})]})]})}function o9(e){var t,n,s,r,a,i,o=e.user;return o?(0,S.jsxs)("div",{className:"text-sm text-left pt-1 pb-1",children:[(0,S.jsx)("div",{className:"block font-semibold mb-0.5 text-white/80",children:(0,S.jsx)("span",{className:"",children:null!==(t=o.profile)&&void 0!==t&&t.firstName&&null!==(n=o.profile)&&void 0!==n&&n.lastName?"".concat([null===(s=o.profile)||void 0===s?void 0:s.firstName,null===(r=o.profile)||void 0===r?void 0:r.lastName].join(" ")):(0,S.jsx)(A.cC,{id:"qhwV2C"})})}),(0,S.jsx)("div",{className:"break-all text-xs text-white/50",children:null!=o&&null!==(a=o.externalUserData)&&void 0!==a&&a.provider?(0,S.jsx)("span",{className:"text-sm",children:(0,S.jsx)(A.cC,{id:"twilsj",values:{0:null===(i=o.externalUserData)||void 0===i?void 0:i.provider},components:{0:(0,S.jsx)("span",{className:"capitalize"})}})}):o.email||o.externalUserID})]}):null}function le(e){var t,n,s,r,a,i=e.licensePayload,o=e.cloudTokenPayload,l=e.onUpgradeClick;return(0,S.jsxs)("div",{children:[(0,S.jsxs)("div",{className:"text-white/80 font-semibold inline-flex items-center justify-start gap-2",children:[(0,S.jsxs)("div",{className:"flex items-center justify-start gap-2",children:[null!=i&&null!==(t=i.payload)&&void 0!==t&&t.plan?(0,S.jsxs)("div",{className:"truncate",children:[(0,S.jsx)("span",{className:"capitalize",children:(null==i||null===(n=i.payload)||void 0===n?void 0:n.plan)||"free"})," ",(0,S.jsx)(A.cC,{id:"GdgCoi"})," "]}):(0,S.jsx)("div",{children:(0,S.jsx)(A.cC,{id:"O1wAlQ"})}),null!=i&&null!==(s=i.payload)&&void 0!==s&&s.plan?(0,S.jsx)(S.Fragment,{children:(null==i||null===(r=i.payload)||void 0===r?void 0:r.plan)!=="premium"?(0,S.jsxs)("button",{onClick:l,className:"text-xs font-semibold bg-green-700 rounded-md px-2 py-0.5 cursor-default hover:bg-green-600 transition-colors flex items-center justify-center gap-1",children:[(0,S.jsx)(oL.sI3,{className:"w-3 h-3 inline -ml-1"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"kwkhPe"})})]}):(0,S.jsx)(oL.sI3,{className:"w-3 h-3 inline text-green-500 -ml-1"})}):null]}),null!=o&&o.user?null:(0,S.jsxs)("div",{"data-tooltip-id":"global","data-tooltip-content":"Your data is stored locally on this device and not synced to the cloud. You will lose your data if you clear your browser cache/storage/cookies.",className:"text-xs font-semibold bg-red-700 rounded-md px-2 py-0.5 cursor-default hover:bg-red-600 transition-colors flex items-center justify-center gap-1 truncate",children:[(0,S.jsx)(e2.OvZ,{className:"w-3 h-3 inline -ml-1"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"d5zxa4"})})]})]}),null!=o&&o.user?(0,S.jsx)("div",{className:"text-white/50 text-xs",children:null==o||null===(a=o.user)||void 0===a?void 0:a.email}):(0,S.jsx)("div",{className:"text-white/50 text-xs",children:(0,S.jsx)(A.cC,{id:"rpu3w+"})})]})}var lt=n(94473),ln=n(34942);function ls(){return(0,S.jsxs)("details",{children:[(0,S.jsx)("summary",{className:"text-left font-semibold my-2 text-base cursor-pointer hover:underline",children:(0,S.jsx)(A.cC,{id:"aPd0KC"})}),(0,S.jsxs)("ul",{className:"space-y-2 list-disc pl-4",children:[(0,S.jsx)("li",{className:"",children:(0,S.jsx)(A.cC,{id:"jefIoa",components:{0:(0,S.jsx)("b",{})}})}),(0,S.jsx)("li",{className:"",children:(0,S.jsx)(A.cC,{id:"+iNEMI"})}),(0,S.jsx)("li",{className:"",children:(0,S.jsx)(A.cC,{id:"IwdUX/",components:{0:(0,S.jsx)("b",{}),1:(0,S.jsx)("a",{target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:underline",href:"https://platform.openai.com/account/usage"})}})}),(0,S.jsx)("li",{className:"",children:(0,S.jsx)(A.cC,{id:"gbk4fY",components:{0:(0,S.jsx)("a",{target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:underline",href:"https://openai.com/pricing"})}})}),(0,S.jsx)("li",{className:"",children:(0,S.jsx)(A.cC,{id:"7ziKq7",components:{0:(0,S.jsx)("b",{})}})}),(0,S.jsx)("li",{children:(0,S.jsx)("a",{className:"text-blue-500 hover:underline",target:"_blank",rel:"noopener noreferrer",href:"https://platform.openai.com/docs/guides/chat",children:(0,S.jsx)(A.cC,{id:"4nqCi7"})})})]})]})}(0,K.eK)("useAPIKey"),(0,K.eK)("useAnthropicAPIKey"),(0,K.eK)("useGeminiAPIKey"),(0,K.eK)("useLicenseKey");var lr=n(98191);function la(){var e=nn(),t=e.themeMode,n=e.setThemeMode;return(0,S.jsx)("button",{onClick:function(){return n("light"===t?"dark":"dark"===t?"system":"light")},type:"button","data-element-id":"dark-mode-button",className:"cursor-default bg-white/20 text-white group flex items-center justify-center rounded-md px-2 py-1 text-xs hover:bg-white/40 transition-all space-x-2",children:"dark"===t?(0,S.jsx)(e4.Lac,{"data-tooltip-id":"global","data-tooltip-content":T.ag._({id:"WhnWdJ"}),className:"h-4 w-4"}):"light"===t?(0,S.jsx)(e4.q4P,{"data-tooltip-id":"global","data-tooltip-content":T.ag._({id:"yTmIDf"}),className:"w-4 h-4"}):"system"===t?(0,S.jsx)(lr.g9d,{"data-tooltip-id":"global","data-tooltip-content":T.ag._({id:"ide/cZ"}),className:"w-4 h-4"}):null})}var li=n(12697);function lo(){var e,t=(0,q.useState)(!1),n=t[0],s=t[1],r=_().serverHostConfig||{},a=r.enabledLanguages,i=r.links,o=function(e){I.Z.set("locale",e,{expires:30})},l=I.Z.get("locale")||"en",c=a||li,d=(null===(e=c.find(function(e){return e.locale===l}))||void 0===e?void 0:e.flag)||"?";return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("button",{onClick:function(){s(!0)},type:"button","data-element-id":"language-button",className:"cursor-default bg-white/20 text-white group flex items-center justify-center rounded-md px-2 hover:bg-white/40 transition-all space-x-2 text-base",children:d}),(0,S.jsxs)(X,{open:n,setOpen:s,children:[(0,S.jsx)("div",{className:"text-xl text-center mb-4",children:(0,S.jsx)(A.cC,{id:"MHm/fc"})}),(0,S.jsxs)("div",{className:"text-base mb-2",children:["✅ ",(0,S.jsx)(A.cC,{id:"vdM0PU"})]}),(0,S.jsx)("div",{className:"text-xs text-gray-500 my-2",children:(0,S.jsx)(A.cC,{id:"vzAe+s"})}),c.filter(function(e){return e.approved}).map(function(e){var t=e.locale,n=e.name,s=e.flag;return(0,S.jsxs)("button",{className:"px-2 py-1 rounded-md shadow-sm bg-gray-100 border-gray-200 border hover:bg-gray-200 transition-all inline-flex m-1 items-center justify-center gap-2 dark:bg-gray-800 dark:border-gray-600",onClick:function(){o(t),window.location.reload()},children:[(0,S.jsxs)("span",{children:[s," ",n]})," ",(0,S.jsx)(C.FJM,{className:"text-green-500 w-3 h-3"})]},t)}),c.filter(function(e){return!e.approved&&!e.hidden}).length?(0,S.jsxs)("div",{children:[(0,S.jsx)("hr",{className:"my-4"}),(0,S.jsxs)("div",{className:"text-base mb-2",children:["\uD83D\uDEA7 ",(0,S.jsx)(A.cC,{id:"j+fvUf"})]}),(0,S.jsx)("div",{className:"text-xs text-gray-500 my-2",children:(0,S.jsx)(A.cC,{id:"nrlh+D"})}),(0,S.jsx)("div",{className:"text-base text-center text-gray-500 my-2",children:(0,S.jsxs)("a",{href:(null==i?void 0:i.translationContribution)||"https://www.typingmind.com/translation",className:"text-blue-500 hover:underline text-sm font-semibold",children:["\uD83D\uDC49 ",(0,S.jsx)(A.cC,{id:"qk7MVx"})]})}),c.filter(function(e){return!e.approved&&!e.hidden}).map(function(e){var t=e.locale,n=e.name,s=e.flag;return(0,S.jsxs)("button",{className:"px-2 py-1 rounded-md shadow-sm bg-gray-100 border-gray-200 border hover:bg-gray-200 transition-all inline-block m-1 dark:bg-gray-800 dark:border-gray-600",onClick:function(){o(t),window.location.reload()},children:[s," ",n]},t)})]}):null]})]})}T.ag._({id:"bmPNEK"}),T.ag._({id:"CbOT+9"}),T.ag._({id:"3Nxy1n"}),T.ag._({id:"lydwZP"}),T.ag._({id:"wKlyxL"}),T.ag._({id:"HPqWYc"}),T.ag._({id:"uHkL3b"}),T.ag._({id:"N+il+Q"}),T.ag._({id:"ddnJmC"}),T.ag._({id:"Gx2RJ7"});var ll=[{question:"Is this app free?",questionMsg:{id:"b5PxgQ"},answer:"TypingMind.com is free to use with some basic features. You will need to have a working OpenAI API Key in order to use the app. When you use the OpenAI API Key, you pay directly to OpenAI for the amount of credits/tokens you use. TypingMind.com has premium features that can be unlocked with a one-time purchase.",answerMsg:{id:"cx6X5s"}},{question:"Is the License Key one-time purchase? Do I need to renew it?",questionMsg:{id:"CNe6lp"},answer:"Yes, license key is one-time purchase and valid forever. It is not a subscription and you don't need to renew it. You will also be provided with an offline static web app (self-host) after you purchase so you can self-host and use the app anytime anywhere you want. Enjoy!",answerMsg:{id:"+wDpvB"}},{question:"Where can I get an OpenAI API Key?",questionMsg:{id:"9uiWR5"},answer:"You can signup directly with OpenAI at https://platform.openai.com/signup",answerMsg:{id:"B7bPOO"}},{question:"Do I need to pay for ChatGPT Plus ($20/month) to use TypingMind.com?",questionMsg:{id:"75mwHY"},answer:"No! A ChatGPT Plus subscription is not needed. You just need to have an OpenAI's API Key. You can see more info on how to get one here: https://openai.com/blog/openai-api",answerMsg:{id:"wIOBEk"}},{question:"Do I need to pay for OpenAI for a ChatGPT API Key?",questionMsg:{id:"OK9+n5"},answer:"Yes. You need to have an OpenAI account and a valid API key to use ChatGPT. We don't sell API keys.",answerMsg:{id:"9dFN/h"}},{question:"How does this app work?",questionMsg:{id:"ojrs7f"},answer:"This is a static web app, it doesn't have any backend server. When you enter your API key, it will be stored locally and securely on your browser. All API requests are sent directly from your browser to OpenAI server to interact with ChatGPT. Think of this as a HTTP client for your ChatGPT API with a lot of convenience features.",answerMsg:{id:"cKOmN0"}},{question:"How is the API key handled?",questionMsg:{id:"JNKgQJ"},answer:"Your API is safe and stored locally on your device. This is a static app, which means that it doesn't have a backend. All the data is stored in your browser's local storage. Requests to Open AI's API is sent directly from your current browser (check the Network tab in your console if you want to see it).",answerMsg:{id:"/UaKK0"}},{question:"Is it ok to give my OpenAI API Key to TypingMind? Does OpenAI allow this use case?",questionMsg:{id:"2zlZZS"},answer:"Yes. TypingMind only stores your API Key locally and never sends your API Key anywhere. OpenAI allows use cases where the API key is stored locally in the user's device. You can see this official response from OpenAI's staff here: https://community.openai.com/t/openais-bring-your-own-key-policy/14538/4",answerMsg:{id:"UohlSp"}},{question:"Is my API Key encrypted in local storage?",questionMsg:{id:"9wNN3e"},answer:'TypingMind offers additional encryption for your API Key. You can enable encryption with a password by clicking the "OpenAI API Key" button in the sidebar and selecting "Encrypt API key...". Your API Key will be encrypted using the AES algorithm provided by the open-source CryptoJS library (https://github.com/brix/crypto-js). TypingMind only provides an encryption feature for your API key. Chat messages, prompts, AI agents, and other elements are stored using the standard local storage of your browser, which may or may not include encryption, depending on your browser. The encryption process are done entirely locally on your device, there is no backend server. If you use TypingMind on multiple devices, you will need to encrypt your API key on all of them, you can also set different passwords on different devices.',answerMsg:{id:"kwR92f"}},{question:"What's the difference between ChatGPT Plus and ChatGPT API via TypingMind?",questionMsg:{id:"+Z6WVE"},answer:"Under the hood, ChatGPT Plus and ChatGPT API offer the same model and the same quality. You can view this on their official announcement here: https://platform.openai.com/docs/guides/chat. The initial system instruction can be a little bit different, which can be configured to make the AI output different messages from time to time.",answerMsg:{id:"iGSBjq"}},{question:"Can I use GPT-4 in TypingMind?",questionMsg:{id:"Qf9Ee9"},answer:"Yes, you can use GPT-4 in TypingMind via the API access. Check out this article for more info: https://blog.typingmind.com/access-gpt-4-on-typingmind",answerMsg:{id:"ODPLFu"}},{question:"I have ChatGPT Plus, will it cost me more to use ChatGPT API via TypingMind?",questionMsg:{id:"YFlz6q"},answer:"The ChatGPT API costs soooooo little you won't even notice it. Typical chat conversation is about 1000 characters, which costs ~$0.001. That's less than a cent. You can have thousands of chats and it will only costs you like $1. See official pricing here: https://openai.com/pricing#language-models",answerMsg:{id:"0pm0cB"}},{question:"How many chats can I have?",questionMsg:{id:"OT18hB"},answer:"You can have as many chats as you want. The only limit is your OpenAI API key's limit and your browser storage limit (technical term: Local Storage and IndexedDB). Web browser gives you some limited data storage, the actual limit is different for each browser. Typically, you can save thousands of chat conversations without problems, but that's not guaranteed. When the browser storage runs out, you will need to delete old chats to save the new ones. We will provide a separate service to sync and backup your chats soon. Adding the website to your home screen may increase the storage capacity.",answerMsg:{id:"a1v3bw"}},{question:"How can I sync my chat conversations across devices?",questionMsg:{id:"cOkgyb"},answer:"You can export the chats and import it on another device. You can also enable TypingMind Cloud for seamless syncing across devices. TypingMind Cloud is a free service provided to all paying TypingMind users. You can enable it by clicking the cloud icon at the bottom of the sidebar.",answerMsg:{id:"j+Ja1t"}},{question:"Why does sometimes TypingMind responds differently than the default OpenAI's ChatGPT event with the same prompt?",questionMsg:{id:"nBo3N2"},answer:"TypingMind uses the same underlying model as OpenAI's default chat app. For the same prompt, it can produce different responses each time. The default chat app by OpenAI may also have some initial prompt settings that are different from TypingMind. If you don't get the response you expects, try \"Re-generate Response\" or tweaking the prompt.",answerMsg:{id:"YHikSC"}},{question:"Can I self-host it?",questionMsg:{id:"Go/vEu"},answer:"Yes. After you make a purchase, you will receive a link to download the static web app and the instruction how to deploy it on your own server. Note that you will only receive the compiled code of the app, the full source code is not available because the app is not open-source. You can deploy the app anywhere without having to update any code or settings.",answerMsg:{id:"phssxy"}},{question:"Do I have access to the full source code if I want to self-host?",questionMsg:{id:"NnjDLd"},answer:"No. The license key only grants you the permission to use and deploy the app on your own server. You do not have permissions to modify or redistribute the code. The full source code is not available for sale as the app is not open-source. You will only receive the compiled code of the app, you can deploy the app anywhere without having to update any code or settings.",answerMsg:{id:"dy1KlD"}},{question:"What can I customize in the self-host version?",questionMsg:{id:"XDMAfS"},answer:"The static self-host version does not offer any customizations. Check out https://custom.typingmind.com for a custom version of TypingMind that will allow you to customize almost everything.",answerMsg:{id:"j123Pn"}},{question:"Is there a MacOS/Windows/Linux app?",questionMsg:{id:"feGwUZ"},answer:"TypingMind is a PWA compatible web app, so you can install it to your device and it will work like a native app. Click the menu of your browser → Install on Home screen.",answerMsg:{id:"CHoY0X"}},{question:"Is there an Android/iOS/iPad app?",questionMsg:{id:"1RMOfL"},answer:"No, but you can add typingmind.com to your home screen. It works exaclty like an app!",answerMsg:{id:"FTMbwN"}},{question:"License Key vs. API Key",questionMsg:{id:"h12eY8"},answer:"License Key is used to activate the premium features of TypingMind.com. API Key refers to OpenAI ChatGPT API Key, and is used to connect to OpenAI's API to interact with ChatGPT. You need an API Key to use the app. The License Key is only needed if you want to use the premium features.",answerMsg:{id:"ttpgzw"}},{question:"What are the premium features?",questionMsg:{id:"DWdDaE"},answer:"The premium features include: Chat Search History, Access Prompt Library, Integrations, etc. Check the pricing page for the latest details of all the premium features.",answerMsg:{id:"9r58AF"}},{question:"Is there an expiration date for the License Key?",questionMsg:{id:"Po7tj6"},answer:"The license key is valid forever.",answerMsg:{id:"FngNgl"}},{question:"Can I receive new updates after I buy a license key?",questionMsg:{id:"ecAC9I"},answer:"Depends on the license key you buy. The Premium License Key is valid forever and includes all updates forever.",answerMsg:{id:"C3l213"}},{question:"What are the limitations of the free plans.",questionMsg:{id:"O6XziL"},answer:"In the free plan, chat history will not be saved. You will be present with a popup every few minutes. Some other features may also be limited.",answerMsg:{id:"6xrUsk"}},{question:"How many devices/users can I use the License Key on?",questionMsg:{id:"ZX9OXO"},answer:'Each license key can be used on 5 devices which is typically enough for 1 user. If you need to use it on for more devices, you can buy a new license keys or add more devices to your existing license key. "Device" is counted based on the number of places where the license key is entered and the chat history is saved for continuous use. For example, if you use the app on Chrome browser on your laptop and also on your phone, that will be 2 devices. Note that the license key and chat history is saved locally per browser, so if you use the app on Chrome and also on Firefox, you will need to enter the license key 2 times, have 2 separate chat histories, and that counts as 2 devices. If you need to use the license key on a new device but have reached the device limit, you can unlink the previous devices first using the License Manager (this is done online, access to the previous devices not needed). This device limit is put in place to avoid license key abuse and pirate.',answerMsg:{id:"lZ6/UT"}},{question:"How do I remove a device from my license? How to access the License Manager?",questionMsg:{id:"rq/EWc"},answer:"At the moment, inactive devices will be revoked automatically after a short time, you don't need anything. In the future versions, you can access the License Manager from the app and manage your devices there.",answerMsg:{id:"pIrPsA"}},{question:"I have purchased but forget my license key, how can I get it back?",questionMsg:{id:"TPNfdq"},answer:"You can go to https://app.lemonsqueezy.com/my-orders/ to access your license key.",answerMsg:{id:"wtFyIQ"}},{question:"How to use the Team License Key? How to add new users?",questionMsg:{id:"bvG3QX"},answer:"The Team License gives you a License Key that can be shared and used among your team members. Simply share your license key with your team members and they can use it on their devices.",answerMsg:{id:"pWBnET"}},{question:"Can I get a refund?",questionMsg:{id:"aVZ9yc"},answer:"Yes. We offer a 14-day money-back guarantee. If you're not satisfied, let us know within 14 days and we'll give you a full refund. Request a refund at support@typingmind.com",answerMsg:{id:"oKL8Ih"}}];function lc(){var e=(0,A.mV)().i18n;return(0,S.jsx)("div",{className:"",children:(0,S.jsx)("div",{className:"mx-auto max-w-7xl",children:(0,S.jsxs)("div",{className:"mx-auto max-w-4xl divide-y divide-gray-900/10",children:[(0,S.jsx)("h2",{className:"text-2xl font-bold leading-10 tracking-tight ",children:(0,S.jsx)(A.cC,{id:"a3pVqb"})}),(0,S.jsx)("dl",{className:"mt-4 space-y-6 divide-y divide-gray-900/10",children:ll.map(function(t){return(0,S.jsx)(r0.pJ,{as:"div",className:"pt-6",children:function(n){var s=n.open;return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("dt",{children:(0,S.jsxs)(r0.lG,{className:"flex w-full items-start justify-between text-left ",children:[(0,S.jsx)("span",{className:"text-base font-semibold leading-7",children:e._(t.questionMsg)}),(0,S.jsx)("span",{className:"ml-6 flex h-7 items-center",children:s?(0,S.jsx)(og.Z,{className:"h-6 w-6","aria-hidden":"true"}):(0,S.jsx)(of.Z,{className:"h-6 w-6","aria-hidden":"true"})})]})}),(0,S.jsx)(r0.V2,{as:"dd",className:"mt-2 pr-12",children:(0,S.jsx)("p",{className:"text-base leading-7 text-gray-500",children:e._(t.answerMsg)})})]})}},t.question)})})]})})})}function ld(e){var t=e.link,n=e.compact,s=(0,q.useState)(!1),r=s[0],a=s[1];return(0,S.jsxs)("div",{children:[(0,S.jsxs)("button",{onClick:function(){return a(!0)},type:"button",className:"cursor-default px-4 py-2 w-full text-white/80 rounded-md text-left hover:bg-white/20 transition-colors bg-white/10 flex items-center justify-start gap-2",children:[(0,S.jsx)(Y.znh,{className:"h-4 w-4","aria-hidden":"true"}),n?null:(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"GNJ1kd"})})]}),(0,S.jsxs)(X,{open:r,setOpen:a,max:!0,children:[(0,S.jsx)("h2",{className:"text-2xl mb-10 text-center font-bold",children:(0,S.jsx)(A.cC,{id:"GNJ1kd"})}),(0,S.jsx)("iframe",{src:t,style:{height:600},className:"w-full"})]})]})}function lu(e){var t=e.link,n=void 0===t?"mailto:feedback@typingmind.com":t,s=(0,q.useState)(!1),r=s[0],a=s[1];return(0,S.jsxs)("div",{children:[(0,S.jsxs)("button",{"data-element-id":"send-feedback-button",onClick:function(){return a(!0)},type:"button",className:"cursor-default px-4 py-2 w-full text-white/80 rounded-md text-left hover:bg-white/20 transition-colors bg-white/10 flex items-center justify-start gap-2",children:[(0,S.jsx)(M.fsM,{className:"h-4 w-4","aria-hidden":"true"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"PDCXEl"})})]}),(0,S.jsx)(X,{open:r,setOpen:a,children:(0,S.jsxs)("div",{className:"text-center",children:[(0,S.jsx)("h2",{className:"text-xl font-semibold text-center",children:"Support & Feedback"}),(0,S.jsx)("p",{className:"my-4",children:(0,S.jsx)(A.cC,{id:"OZbbiL"})}),(0,S.jsx)("p",{className:"my-4",children:(0,S.jsx)("a",{href:n,className:"text-blue-600 hover:underline",target:"_blank",rel:"noreferrer noopener",children:n.startsWith("mailto:")?n.slice(7):n})})]})})]})}function lm(e){var t,n,s,r,a,i,o,l,c,d,u,m,p,h,g,f,b=e.hostConfig,v=e.setOpenBackupSync,y=e.setOpenCloudLoginPopup,w=e.setOpenOrgUserProfilePopup,k=(e.setOpenDecrypt,e.licenseVerified,e.setOpenBuy),N=(e.decryptedApiKey,e.decryptedAnthropicApiKey,e.decryptedGeminiApiKey,e.setLicenseVerified,e.verifyLicenseKey,e.licensePayload),I=(e.onLicenseKeyActivated,e.setOpenChangelog,e.onOpenSettings,e.setOpenSupportPopup),E=e.setOpenAPIKeysPopup;e.setOpenLicenseKey;var V=(0,O.nY)(b),P=V.showLicenseKeyButton,M=V.showAPIKeysButton,D=(0,q.useState)(!1),B=D[0],L=D[1],R=(0,eI.e)(),_=R.user,Z=R.loadUser,K=R.logout,G=R.cloudTokenPayload,F=R.logoutCloudSyncOnly,Y=R.clearAllLocalData,U=(0,q.useState)(!1),H=U[0],z=U[1],W=(null==b?void 0:b.managed)&&!b.allowGuests,Q=!_||(null==_?void 0:_.externalUserID)==="anonymous"&&(null==b?void 0:b.publicModeAllowLogin),J=!W||(null==G?void 0:G.user),$=_||(null==b?void 0:b.currentUser),ee=(0,q.useMemo)(function(){return null!=G&&!!G.user||!!$&&!b.allowGuests},[G,$,b]);(0,q.useEffect)(function(){W&&Z()},[]);var et=(t=(0,x.Z)(j().mark(function e(){return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:F(),$?K():L(!0);case 2:case"end":return e.stop()}},e)})),function(){return t.apply(this,arguments)});return b?(0,S.jsxs)("div",{children:[(0,S.jsxs)("div",{className:"p-4",children:[(0,S.jsxs)("div",{className:"flex items-center justify-between gap-4 ",children:[(0,S.jsxs)("div",{className:"flex items-center justify-start gap-4",children:[(0,S.jsxs)("button",{className:"cursor-default text-white group flex items-center justify-center rounded-md p-1 text-sm font-medium w-[40px] h-[40px] transition-all flex-col bg-white/20 focus:ring-0 flex-shrink-0",children:[(0,S.jsx)(oG,{}),(0,S.jsx)("span",{className:"sr-only",children:(0,S.jsx)(A.cC,{id:"7PzzBU"})})]}),W?(0,S.jsx)(o9,{user:$}):(0,S.jsx)(le,{licensePayload:N,cloudTokenPayload:G,onUpgradeClick:function(){return k(!0)}})]}),ee?(0,S.jsx)(eS,{className:"cursor-default",onConfirmed:et,children:(0,S.jsx)("button",{"data-tooltip-id":"global","data-tooltip-content":T.ag._({id:"nOhz3x"}),className:"w-10 h-10 flex items-center justify-center rounded-full hover:bg-white/20 transition hover:text-red-500 text-white/50 cursor-default",children:(0,S.jsx)(lt.H_4,{className:"w-5 h-5 -ml-1"})})}):null]}),(0,S.jsxs)("div",{className:"space-y-2 mt-4",children:[W?$?(0,S.jsx)("button",{onClick:function(){return w(!0)},className:"cursor-default px-4 py-2 w-full text-white/80 rounded-md text-left hover:bg-white/20 transition-colors bg-white/10 flex items-center justify-between gap-2",children:(0,S.jsxs)("span",{className:"flex items-center justify-start gap-2",children:[(0,S.jsx)(C.dfI,{className:"h-4 w-4 text-gray-300"}),(0,S.jsx)("span",{children:"Update Profile"})]})}):Q?(0,S.jsx)("button",{onClick:function(){return z(!0)},className:"cursor-default px-4 py-2 w-full text-white/80 rounded-md text-left hover:bg-white/20 transition-colors bg-white/10 flex items-center justify-between gap-2",children:(0,S.jsxs)("span",{className:"flex items-center justify-start gap-2",children:[(0,S.jsx)("span",{children:"→"}),(0,S.jsxs)("span",{children:[(0,S.jsx)(A.cC,{id:"pzMtjG"})," ",null==b?void 0:b.name]})]})}):null:null,J?null!=G&&G.user?(0,S.jsxs)("button",{onClick:function(){return v(!0)},className:"cursor-default px-4 py-2 w-full text-white/80 rounded-md text-left hover:bg-white/20 transition-colors bg-white/10 flex items-center justify-between gap-2",children:[(0,S.jsxs)("span",{className:"flex items-center justify-start gap-2",children:[(0,S.jsx)(C.H_w,{className:"h-4 w-4 text-blue-500"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"l51yT8"})})]}),(0,S.jsx)(oZ,{})]}):(0,S.jsxs)("button",{onClick:function(){return y(!0)},className:"cursor-default px-4 py-2 w-full text-white/80 rounded-md text-left hover:bg-white/20 transition-colors bg-white/10 flex items-center justify-between gap-2",children:[(0,S.jsxs)("span",{className:"flex items-center justify-start gap-2",children:[(0,S.jsx)(C.H_w,{className:"h-4 w-4 text-blue-500"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"5z2/lU"})})]}),(0,S.jsx)(oZ,{})]}):null,P||M?(0,S.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[P?(0,S.jsxs)("button",{onClick:function(){return k(!0)},className:"cursor-default px-4 py-2 w-full text-white/80 rounded-md text-left hover:bg-white/20 transition-colors bg-white/10 flex items-center justify-start gap-2",children:[(0,S.jsx)(C.D5B,{className:"h-4 w-4 text-orange-500"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"4o/F78"})})]}):null,M?(0,S.jsxs)("button",{onClick:function(){return E(!0)},className:"cursor-default px-4 py-2 w-full text-white/80 rounded-md text-left hover:bg-white/20 transition-colors bg-white/10 flex items-center justify-start gap-2",children:[(0,S.jsx)(oL.q2z,{className:"h-4 w-4 text-yellow-500"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"FfSJ1Y"})})]}):null]}):null,b.hosted||b.managed?null:(0,S.jsxs)("button",{onClick:function(){return I(!0)},className:"cursor-default px-4 py-2 w-full text-white/80 rounded-md text-left hover:bg-white/20 transition-colors bg-white/10 flex items-center justify-start gap-2",children:[(0,S.jsx)(ln.ZtL,{className:"h-4 w-4 text-gray-300"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"kYLxGT"})})]}),b.hosted?null!=b&&null!==(n=b.links)&&void 0!==n&&n.supportIframeURL?(0,S.jsx)(ld,{link:null==b||null===(s=b.links)||void 0===s?void 0:s.supportIframeURL}):null!=b&&null!==(r=b.links)&&void 0!==r&&r.feedback?(0,S.jsx)(lu,{link:null==b||null===(a=b.links)||void 0===a?void 0:a.feedback}):null:null]})]}),(0,S.jsx)("hr",{className:"border-white/20"}),(0,S.jsx)("div",{className:"p-4",children:(0,S.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,S.jsxs)("div",{className:"text-[11px] leading-4",children:[(0,S.jsxs)("div",{className:"text-white/50 font-normal text-left",children:[b.hosted?b.brand:(0,S.jsx)("a",{href:"https://typingmind.com",children:"TypingMind.com"})," ","\xa9 ",(0,S.jsx)("span",{children:new Date().getFullYear()}),b.hosted?null:(0,S.jsxs)(S.Fragment,{children:[" | ",(0,S.jsx)("a",{className:"hover:underline font-normal",href:"/contact",target:"_blank",children:(0,S.jsx)(A.cC,{id:"jfC/xh"})})]})]}),b.hosted?(0,S.jsxs)("div",{className:"text-white/50",children:[(0,S.jsx)("a",{className:"hover:underline",href:(null==b||null===(i=b.links)||void 0===i?void 0:i.privacy)||"#",target:"_blank",children:(0,S.jsx)(A.cC,{id:"rjGI/Q"})})," | ",(0,S.jsx)("a",{className:"hover:underline",href:(null==b||null===(o=b.links)||void 0===o?void 0:o.terms)||"#",target:"_blank",children:(0,S.jsx)(A.cC,{id:"4Y5H+g"})}),null!=b&&null!==(l=b.links)&&void 0!==l&&l.faqs?(0,S.jsxs)(S.Fragment,{children:[" | ",(0,S.jsx)("a",{className:"hover:underline",href:(null==b||null===(c=b.links)||void 0===c?void 0:c.faqs)||"#",target:"_blank",children:(0,S.jsx)(A.cC,{id:"aJ4pMe"})})]}):null,null!=b&&null!==(d=b.links)&&void 0!==d&&d.docs?(0,S.jsxs)(S.Fragment,{children:[" | ",(0,S.jsx)("a",{className:"hover:underline",href:(null==b||null===(u=b.links)||void 0===u?void 0:u.docs)||"#",target:"_blank",children:(0,S.jsx)(A.cC,{id:"TbjyhA"})})]}):null,null!=b&&null!==(m=b.links)&&void 0!==m&&m.contact?(0,S.jsxs)(S.Fragment,{children:[" | ",(0,S.jsx)("a",{className:"hover:underline",href:(null==b||null===(p=b.links)||void 0===p?void 0:p.contact)||"#",target:"_blank",children:(0,S.jsx)(A.cC,{id:"jfC/xh"})})]}):null,null!=b&&null!==(h=b.links)&&void 0!==h&&h.about?(0,S.jsxs)(S.Fragment,{children:[" | ",(0,S.jsx)("a",{className:"hover:underline",href:(null==b||null===(g=b.links)||void 0===g?void 0:g.about)||"#",target:"_blank",children:(0,S.jsx)(A.cC,{id:"uyJsf6"})})]}):null,b.managed&&!b.allowSubscriptions?(null==b||null===(f=b.links)||void 0===f?void 0:f.admin)===!1?null:(0,S.jsxs)(S.Fragment,{children:[" | ",(0,S.jsx)("a",{className:"hover:underline",href:"/admin",target:"_blank",children:(0,S.jsx)(A.cC,{id:"U3pytU"})})]}):null]}):(0,S.jsxs)("div",{className:"text-white/50 text-left font-normal",children:[(0,S.jsx)("a",{className:"hover:underline",href:"/privacy",target:"_blank",children:(0,S.jsx)(A.cC,{id:"rjGI/Q"})})," | ",(0,S.jsx)("a",{className:"hover:underline",href:"/terms",target:"_blank",children:(0,S.jsx)(A.cC,{id:"4Y5H+g"})})," | ",(0,S.jsx)("a",{className:"hover:underline",href:"/faqs",target:"_blank",children:(0,S.jsx)(A.cC,{id:"aJ4pMe"})})," | ",(0,S.jsx)("a",{className:"hover:underline",rel:"noopener noreferrer",href:"/discord",target:"_blank",children:(0,S.jsx)(A.cC,{id:"OdPOhy"})})," | ",(0,S.jsx)("a",{className:"hover:underline",href:"https://docs.typingmind.com",target:"_blank",children:(0,S.jsx)(A.cC,{id:"TbjyhA"})})," | ",(0,S.jsx)("a",{className:"hover:underline",href:"https://blog.typingmind.com",target:"_blank",children:(0,S.jsx)(A.cC,{id:"astDB+"})})]})]}),(0,S.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,O.N7)("changeUILanguage",b.chatFeatures)?(0,S.jsx)(lo,{}):null,(0,S.jsx)(la,{})]})]})}),(0,S.jsxs)(X,{open:B,setOpen:L,showCloseButton:!1,children:[(0,S.jsx)("div",{className:"text-xl font-bold mb-4",children:"Clear All Data?"}),(0,S.jsx)("div",{className:"my-4",children:(0,S.jsx)(A.cC,{id:"LjgHYd"})}),(0,S.jsxs)("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:[(0,S.jsx)("button",{onClick:(0,x.Z)(j().mark(function e(){return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Y();case 2:window.location.reload();case 3:case"end":return e.stop()}},e)})),type:"submit",className:"inline-flex items-center px-3 py-1.5 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-red-600 hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 disabled:bg-gray-400 gap-2",children:(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"DmiLNr"})})}),(0,S.jsx)("button",{onClick:function(){L(!1)},type:"submit",className:"inline-flex items-center px-3 py-1.5 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 gap-2",children:(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"15ZLRx"})})})]})]}),(0,S.jsxs)(X,{open:H,setOpen:z,showCloseButton:!1,children:[(0,S.jsxs)("h2",{className:"text-lg text-center mb-4 font-semibold",children:["Login to ",b.name]}),(0,S.jsx)(oX,{hostConfig:b,onLoggedIn:function(){window.location.reload()}})]})]}):null}function lp(e){var t=e.color,n=e.hostConfig,s=e.setOpenBackupSync,r=e.setOpenCloudLoginPopup,a=e.setOpenOrgUserProfilePopup,i=e.setOpenDecrypt,o=e.licenseVerified,l=e.setOpenBuy,c=e.decryptedApiKey,d=e.decryptedAnthropicApiKey,u=e.decryptedGeminiApiKey,m=e.setLicenseVerified,p=e.verifyLicenseKey,h=e.licensePayload,g=e.onLicenseKeyActivated,f=e.setOpenChangelog,x=e.onOpenSettings,b=e.setOpenSupportPopup,v=e.setOpenAPIKeysPopup,y=e.setOpenLicenseKey;return(0,S.jsxs)(oR.J2,{className:"relative",children:[(0,S.jsxs)(oR.O7,{"data-element-id":"workspace-profile-button",className:"relative cursor-default hover:bg-white/40 text-white group flex items-center justify-center rounded-md p-1 text-sm font-medium w-[40px] h-[40px] transition-all flex-col bg-white/20 focus:ring-0",children:[(0,S.jsx)(oG,{}),(0,S.jsx)("span",{className:"sr-only",children:(0,S.jsx)(A.cC,{id:"WzMCru"})}),(0,S.jsx)("div",{className:"absolute bottom-1 right-1",children:(0,S.jsx)(oZ,{})})]}),(0,S.jsx)(oR.Hi,{transition:!0,anchor:"top end",className:" [--anchor-gap:24px] md:[--anchor-gap:10px] absolute z-[70] flex px-2 transition data-[closed]:translate-y-1 data-[closed]:opacity-0 data-[enter]:duration-200 data-[leave]:duration-150 data-[enter]:ease-out data-[leave]:ease-in",children:(0,S.jsx)("div",{style:{background:"url(".concat("/assets/corner-decor.png",") -1px -1px / 100% no-repeat, ").concat(t)},className:"w-screen border-white/20 border md:w-[360px] shrink rounded-xl text-sm font-semibold leading-6 text-gray-900 shadow-lg ring-1 ring-gray-900/5 text-white",children:(0,S.jsx)(lm,{hostConfig:n,setOpenBackupSync:s,setOpenCloudLoginPopup:r,setOpenOrgUserProfilePopup:a,setOpenDecrypt:i,licenseVerified:o,setOpenBuy:l,decryptedApiKey:c,decryptedAnthropicApiKey:d,decryptedGeminiApiKey:u,setLicenseVerified:m,verifyLicenseKey:p,licensePayload:h,onLicenseKeyActivated:g,setOpenChangelog:f,onOpenSettings:x,setOpenSupportPopup:b,setOpenAPIKeysPopup:v,setOpenLicenseKey:y})})})]})}(0,K.eK)("useLatestSeenUpdate");var lh=n(52649);function lg(){for(var e=arguments.length,t=Array(e),n=0;n=400)){e.next=14;break}return e.next=10,a.json();case 10:return d(e.sent.userMessage||u._(ly)),o(!1),e.abrupt("return");case 14:if(a.ok){e.next=18;break}return d(u._(ly)),o(!1),e.abrupt("return");case 18:return e.next=20,a.json();case 20:i=e.sent,g(l=(0,O.PO)(null===(s=m.serverHostConfig)||void 0===s?void 0:s.orgURL)+"/characters/"+i.id),v("".concat(l,"?delete=").concat(i.deleteToken)),e.next=30;break;case 26:e.prev=26,e.t0=e.catch(2),d(u._(ly)),console.error(e.t0);case 30:o(!1);case 31:case"end":return e.stop()}},e,null,[[2,26]])})),function(){return t.apply(this,arguments)});return(0,S.jsxs)("div",{children:[(0,S.jsx)("h2",{className:"text-xl font-semibold text-center",children:(0,S.jsx)(A.cC,{id:"h+U8sH",values:{0:null==n?void 0:n.title}})}),h?(0,S.jsx)(iV,{link:h,deleteLink:b,onOpenManageSharedLinks:s,showManageSharedLinks:r}):(0,S.jsx)("div",{children:(0,S.jsx)("div",{className:"my-4",children:(0,S.jsxs)("div",{className:"grid grid-cols-2 items-center gap-4",children:[(0,S.jsx)("div",{className:"flex items-center justify-end",children:(0,S.jsxs)("button",{disabled:i,onClick:w,className:"inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 space-x-1 disabled:bg-gray-400",children:[(0,S.jsx)(C.H_w,{className:"h-5 w-5"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"WNypG5"})})]})}),(0,S.jsx)("div",{children:(0,S.jsx)(A.cC,{id:"3gfZ4K"})})]})})}),c?(0,S.jsx)("div",{className:"text-sm font-semibold text-red-500 text-center",children:c}):null]})}var lj=(0,K.eK)("useRemindBackupDone");function lA(e){var t=e.open,n=e.setOpen,s=e.setOpenBackupSync,r=lj(!1),a=(0,y.Z)(r,2),i=(a[0],a[1]),o=(0,q.useState)(!1),l=o[0],c=o[1],d=(0,q.useState)(!1),u=d[0],m=d[1],p=(0,q.useState)(!1),h=p[0],g=p[1];return(0,S.jsxs)(X,{open:t,setOpen:function(){},showCloseButton:!1,max:!0,position:"top",children:[(0,S.jsxs)("h2",{className:"text-3xl font-bold tracking-tight my-4 text-center flex items-center justify-center gap-2",children:[(0,S.jsx)(C.bri,{className:"inline-block text-green-500"}),(0,S.jsx)(A.cC,{id:"y+HKwM"})]}),(0,S.jsxs)("div",{className:" flex items-center justify-start gap-2 flex-col sm:flex-row",children:[(0,S.jsx)("img",{src:"/assets/privacy-badge.png",alt:"Privacy Icon",className:"w-48 h-48"}),(0,S.jsxs)("div",{className:"my-4 space-y-2",children:[(0,S.jsxs)("h3",{className:"text-lg font-semibold",children:[(0,S.jsx)(ln.iUH,{className:"w-5 h-5 text-orange-500 mr-2 inline-block"}),(0,S.jsx)(A.cC,{id:"24snR+"})]}),(0,S.jsxs)("p",{children:[(0,S.jsx)(A.cC,{id:"6nDmw9",components:{0:(0,S.jsx)("b",{})}})," ",(0,S.jsx)(A.cC,{id:"rzhN/v",components:{0:(0,S.jsx)("b",{})}})]}),(0,S.jsx)("p",{children:(0,S.jsx)(A.cC,{id:"TT5b0p",components:{0:(0,S.jsx)("b",{})}})})]})]}),(0,S.jsx)("div",{className:"text-center flex items-center justify-center gap-2 flex-wrap flex-col",children:(0,S.jsxs)("div",{className:"grid grid-cols-1 gap-2",children:[(0,S.jsxs)("button",{onClick:function(){n(!1),u&&i(!0),setTimeout(function(){s(!0)},700)},type:"submit",className:"inline-flex items-center justify-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 gap-2",children:[(0,S.jsx)(C.i1q,{className:"w-4 h-4"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"ah70YE"})})]}),(0,S.jsxs)("button",{onClick:function(){g(!0)},type:"submit",className:"inline-flex items-center justify-center px-4 py-2 gap-2 text-orange-600 font-semibold",children:[(0,S.jsx)("span",{children:"→"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"TSjITo"})})]})]})}),h?(0,S.jsxs)("div",{className:"mt-4",children:[(0,S.jsx)("div",{className:"text-orange-600 text-xs",children:(0,S.jsx)(A.cC,{id:"mJOkX1"})}),(0,S.jsxs)("div",{className:"my-4 space-y-2",children:[(0,S.jsx)("div",{children:(0,S.jsxs)("label",{className:"flex items-center justify-start gap-1",children:[(0,S.jsx)("input",{type:"checkbox",className:"mr-2",checked:l,onChange:function(e){c(e.target.checked)}}),(0,S.jsx)("span",{className:"text-sm",children:(0,S.jsx)(A.cC,{id:"eh6z/i"})})]})}),(0,S.jsx)("div",{children:(0,S.jsxs)("label",{className:"flex items-center justify-start gap-1",children:[(0,S.jsx)("input",{type:"checkbox",className:"mr-2",checked:u,onChange:function(e){m(e.target.checked)}}),(0,S.jsx)("span",{className:"text-sm",children:(0,S.jsx)(A.cC,{id:"pn+6yY"})})]})})]}),(0,S.jsxs)("button",{disabled:!l,onClick:function(){u&&i(!0),g(!1),c(!1),n(!1)},type:"submit",className:"inline-flex items-center justify-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-orange-600 hover:bg-orange-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-orange-500 disabled:bg-gray-400 gap-2",children:[(0,S.jsx)("span",{children:" →"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"7VpPHA"})})]})]}):null]})}function lk(e){var t=e.entries,n=e.onChange;return null!=t&&t.length?(0,S.jsx)("div",{className:"space-y-2 max-h-[300px] overflow-auto",children:(t||[]).map(function(e,s){return(0,S.jsxs)("div",{className:"flex items-center justify-between p-4 bg-gray-100 rounded-md gap-2 mr-2 dark:bg-gray-900",children:[(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"text-gray-500 text-xs mb-1",children:new Date(e.createdAt).toLocaleString()}),(0,S.jsx)("div",{className:"text-gray-800 dark:text-gray-100",children:"string"==typeof e.text?e.text:""})]}),(0,S.jsx)(eS,{className:"text-red-500 hover:underline",onConfirmed:function(){n(t.filter(function(e,t){return t!==s}))},children:"Forget"})]},s)})}):(0,S.jsx)("div",{className:"flex items-center justify-center p-6 text-gray-500 bg-gray-100 rounded-md",children:(0,S.jsx)(A.cC,{id:"fnpUJJ"})})}var lN=n(134);function lC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,s)}return n}function lq(e){for(var t=1;t=400)){e.next=13;break}return e.next=9,n.json();case 9:return m(e.sent.userMessage||lR),v(!1),e.abrupt("return");case 13:if(n.ok){e.next=17;break}return m(lR),v(!1),e.abrupt("return");case 17:return e.next=19,n.json();case 19:if(!(s=e.sent).licenseKey){e.next=23;break}return e.next=23,V(s.licenseKey);case 23:g(s),e.next=30;break;case 26:e.prev=26,e.t0=e.catch(2),m(lR),console.error(e.t0);case 30:v(!1);case 31:case"end":return e.stop()}},e,null,[[2,26]])})),function(e){return t.apply(this,arguments)}),V=(n=(0,x.Z)(j().mark(function e(t){return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,s(t);case 2:e.sent?(k(!0),d(!0)):m(T.ag._({id:"lYgpBY"}));case 4:case"end":return e.stop()}},e)})),function(e){return n.apply(this,arguments)});return(0,S.jsxs)(X,{wide:!0,open:i,setOpen:function(){},showCloseButton:!1,children:[(0,S.jsx)("h2",{className:"text-center text-xl font-bold relative",children:(0,S.jsx)(A.cC,{id:"h3QnPS"})}),(0,S.jsxs)("div",{className:"my-2",children:[(0,S.jsxs)("div",{className:"my-2 text-center",children:["The ",(0,S.jsx)("b",{children:"License Key"})," and a ",(0,S.jsx)("b",{children:"Receipt"})," has been sent to your email."]}),(0,S.jsx)("div",{className:"text-center flex items-center justify-center gap-2",children:null!=h&&h.email?(0,S.jsx)("div",{className:"p-2 flex items-center justify-center flex-col gap-2 bg-gray-200 w-full rounded-md dark:bg-gray-700",children:(0,S.jsx)("div",{className:"font-medium text-lg",children:null==h?void 0:h.email})}):(0,S.jsx)("div",{className:"flex items-center justify-center h-16",children:(0,S.jsx)(E,{})})})]}),w?(0,S.jsxs)("div",{children:[i&&c&&(0,S.jsx)("div",{className:"flex items-center justify-center z-[9999] relative",children:(0,S.jsx)(lL.Z,{zIndex:9999})}),(0,S.jsxs)("div",{className:"flex items-center justify-center gap-2 my-4",children:[(0,S.jsx)(oL.ReY,{className:"text-green-500 w-8 h-8"}),(0,S.jsx)("div",{className:"text-lg font-semibold",children:(0,S.jsx)(A.cC,{id:"PnL/Iu"})})]}),C&&null!=h&&h.licenseKey?(0,S.jsxs)("div",{className:"my-4",children:[(0,S.jsx)("div",{className:"my-2",children:(0,S.jsx)(A.cC,{id:"WW8EoW",components:{0:(0,S.jsx)("b",{})}})}),(0,S.jsx)("div",{className:"text-center text-lg font-bold bg-gray-100 p-2 rounded-md dark:bg-gray-700",onClick:function(){return navigator.clipboard.writeText(null==h?void 0:h.licenseKey)},children:null==h?void 0:h.licenseKey})]}):(0,S.jsx)("div",{className:"text-center",children:(0,S.jsx)("button",{onClick:function(){return I(!0)},className:"text-blue-500 hover:underline",children:"View license key"})}),(0,S.jsx)("div",{className:"mt-4 text-center",children:(0,S.jsxs)("button",{onClick:function(){o(!1);var e=new URL(window.location.href);e.searchParams.delete("checkout_success"),window.history.replaceState({},document.title,e),r()},type:"submit",className:"inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 gap-2",children:[(0,S.jsx)("span",{children:"→"}),(0,S.jsx)("span",{children:"Get Started"})]})})]}):b?null:(0,S.jsxs)("div",{children:[(0,S.jsxs)("div",{className:"my-4",children:[(0,S.jsx)("div",{className:"my-2",children:(0,S.jsx)(A.cC,{id:"WW8EoW",components:{0:(0,S.jsx)("b",{})}})}),(0,S.jsx)("div",{className:"text-center text-lg font-bold bg-gray-100 p-2 rounded-md dark:bg-gray-700",onClick:function(){return navigator.clipboard.writeText(null==h?void 0:h.licenseKey)},children:null==h?void 0:h.licenseKey})]}),(0,S.jsx)("div",{className:"mt-4 text-center",children:(0,S.jsxs)("button",{onClick:function(){o(!1);var e=new URL(window.location.href);e.searchParams.delete("checkout_success"),window.history.replaceState({},document.title,e),r()},type:"submit",className:"inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 gap-2",children:[(0,S.jsx)("span",{children:"→"}),(0,S.jsx)("span",{children:"Continue"})]})})]})]})}function lZ(){return(0,q.useEffect)(function(){setTimeout(function(){window.location.reload()},1e4)},[]),(0,S.jsxs)("div",{className:"flex items-center justify-center p-4 min-h-screen bg-gray-50 flex-col gap-6",children:[(0,S.jsx)("div",{className:"text-5xl text-gray-900 text-center",children:"Sorry..."}),(0,S.jsxs)("div",{className:"font-medium text-gray-500 text-center",children:["The server is experiencing a temporary problem.",(0,S.jsx)("br",{}),(0,S.jsx)("br",{}),"This page will automatically refresh shortly.",(0,S.jsx)("br",{}),(0,S.jsx)("br",{}),(0,S.jsx)("div",{className:" flex items-center justify-center",children:(0,S.jsx)(E,{})}),(0,S.jsx)("br",{}),(0,S.jsx)("br",{}),"If this takes too long, please try to quit the app completely and reopen again or contact support."]})]})}function lK(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,s)}return n}function lG(e){for(var t=1;t0?(0,S.jsx)("div",{className:"my-4",children:(0,S.jsx)(ed,{selectedProfile:f,setSelectedProfile:x})}):null]})]},f.id):null,(0,S.jsx)("div",{className:"mt-6 flex items-center flex-col justify-center space-y-2",children:(0,S.jsx)("button",{"data-element-id":"profile-setting-save-button",onClick:function(){x(null),d(!1)},className:"flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 space-x-1 disabled:bg-gray-500",children:(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"DPfwMq"})})})})]})]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)("div",{"data-element-id":"profile-setting-description",className:"text-center my-2 px-4 space-y-2 text-sm text-gray-500",children:[(0,S.jsx)("div",{children:(0,S.jsx)(A.cC,{id:"2B2riu"})}),(0,S.jsx)("div",{children:null!=i&&i.length?(0,S.jsx)(A.cC,{id:"euBEyc"}):(0,S.jsx)(A.cC,{id:"N775f5"})})]}),(0,S.jsxs)("div",{className:"mt-9 mb-8 px-4 flex-wrap justify-start items-start grid grid-cols-2 sm:grid-cols-3 gap-x-8 gap-y-7 sm:gap-x-9 sm:gap-y-7",children:[i.map(function(e){return(0,S.jsxs)("div",{className:" flex flex-col justify-start space-y-2",children:[(0,S.jsxs)("div",{className:"relative group",children:[(0,S.jsx)("input",{id:"profile-checkbox-".concat(e.id),type:"checkbox",checked:(null==h?void 0:h.id)===e.id,className:(0,O.AK)("z-10 box-content h-6 w-6 rounded-full border-gray-300 text-green-600 ring-2 ring-white dark:ring-zinc-950 focus:ring-transparent absolute -top-2.5 -right-2.5",(null==h?void 0:h.id)===e.id?"opacity-100 cursor-pointer hover:text-green-700":"opacity-0 pointer-events-none"),readOnly:(null==h?void 0:h.id)!==e.id,onChange:I}),(null==h?void 0:h.id)===e.id&&(0,S.jsx)(sL.u,{anchorSelect:"#profile-checkbox-".concat(e.id),place:"top",children:(0,S.jsx)(A.cC,{id:"8J70rq"})}),(0,S.jsx)("button",{className:(0,O.AK)("w-full aspect-square rounded-md sm:rounded-xl cursor-pointer hover:opacity-80 bg-white/20 hover:bg-white/40 text-white group flex items-center justify-center text-sm font-medium transition-all"),onClick:function(){return j(e)},children:e.picURL?(0,S.jsx)("img",{src:e.picURL,"data-element-id":"user-profile-image",className:"w-full h-full rounded-md sm:rounded-xl transition-all error-fallback-gray object-cover"}):(0,S.jsx)("div",{className:"w-full h-full flex items-center justify-center bg-gray-400 rounded-md sm:rounded-xl",children:(0,S.jsx)(C.dfI,{"data-element-id":"user-profile-symbol",className:"h-8 w-8 text-white"})})})]}),(0,S.jsxs)("div",{className:"flex flex-col items-center justify-between space-y-2 flex-wrap",children:[(0,S.jsx)("p",{className:"font-semibold text-center text-sm",children:e.name||T.ag._({id:"MEIAzV"})}),(0,S.jsxs)("div",{className:"text-gray-500 flex items-center justify-center space-x-2",children:[(0,S.jsx)("button",{className:" cursor-pointer hover:text-blue-500 h-6",onClick:function(){return N(e)},children:(0,S.jsx)(C.fmQ,{className:"w-6 h-6 sm:w-4 sm:h-4 "})}),(0,S.jsx)(eS,{onConfirmed:function(){return w(e)},className:"cursor-pointer hover:text-red-500 h-6",children:(0,S.jsx)(C.Xm5,{className:"w-6 h-6 sm:w-4 sm:h-4 "})})]})]})]},e.id)}),(0,S.jsxs)("div",{className:"flex flex-col items-center space-y-2",children:[(0,S.jsx)("button",{className:"w-full aspect-square border border-dashed border-blue-500 text-blue-500 cursor-pointer group flex items-center justify-center rounded-md sm:rounded-xl text-sm font-medium transition-all shrink-0 hover:bg-blue-500/10",onClick:function(){var e={id:(0,tJ.Z)()};o([].concat((0,v.Z)(i),[e])),x(e),d(!0)},children:(0,S.jsx)(Y.Lfi,{className:"w-12 h-12"})}),(0,S.jsx)("div",{className:"flex items-center justify-center",children:(0,S.jsx)("p",{className:"font-semibold text-sm",children:(0,S.jsx)(A.cC,{id:"aoFVdB"})})})]})]}),(0,S.jsx)("button",{"data-element-id":"profile-setting-save-button",onClick:function(){n&&n()},className:"mx-auto flex px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 space-x-1 disabled:bg-gray-500",children:(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"yz7wBu"})})})]})]})}function lQ(e){var t,n=e.open,s=e.setOpen,r=e.setOpenLicenseKey,a=e.setOpenBuy,i=(0,q.useState)(5),o=i[0],l=i[1];(0,q.useEffect)(function(){n&&c()},[n]);var c=(t=(0,x.Z)(j().mark(function e(){var t;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=10;case 1:if(!(t>=0)){e.next=8;break}return l(t),e.next=5,new Promise(function(e){return setTimeout(e,1e3)});case 5:t--,e.next=1;break;case 8:case"end":return e.stop()}},e)})),function(){return t.apply(this,arguments)});return(0,S.jsxs)(X,{wide:!0,open:n,setOpen:function(e){0===o&&s(e)},showCloseButton:!1,children:[(0,S.jsx)("h2",{className:"text-center text-xl font-bold",children:(0,S.jsx)(A.cC,{id:"R0g4gG"})}),(0,S.jsx)("p",{className:"my-4 text-sm text-center",children:(0,S.jsx)("b",{children:(0,S.jsx)(A.cC,{id:"pKmr0j",components:{0:(0,S.jsx)("span",{className:"text-red-500"})}})})}),(0,S.jsx)("div",{className:"my-4 text-center flex items-center justify-center flex-wrap gap-2",children:(0,S.jsx)("button",{onClick:function(){0===o&&s(!1),setTimeout(function(){a(!0)},1)},className:"inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-green-600 hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 space-x-1 disabled:bg-gray-500",children:(0,S.jsxs)("span",{children:["→ ",(0,S.jsx)(A.cC,{id:"ggrnf1"})]})})}),(0,S.jsx)("p",{className:"mt-4 text-xs text-center",children:(0,S.jsx)(A.cC,{id:"Wkdy65"})}),(0,S.jsx)("div",{className:"my-2 text-center flex items-center justify-center flex-wrap gap-2",children:(0,S.jsxs)("button",{onClick:function(){0===o&&s(!1),setTimeout(function(){r(!0)},1)},className:"inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 space-x-1 disabled:bg-gray-500",children:[(0,S.jsx)(e2.itj,{className:"w-4 h-4"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"IRwH+C"})})]})}),(0,S.jsx)("div",{className:"mt-4 text-center flex items-center justify-center space-x-2",children:(0,S.jsx)("button",{onClick:function(){s(!1),setTimeout(function(){a(!0)},1)},disabled:o>0,className:"inline-flex items-center px-4 py-2 text-sm font-medium rounded-md text-gray-800 dark:text-zinc-100 dark:disabled:text-zinc-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 space-x-1 disabled:text-gray-400",children:(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"aMPH6M",values:{0:o>0?" (".concat(o,")"):""}})})})})]})}(0,K.eK)("useLicenseKey");var lJ=(0,K.eK)("useLicenseKey"),lX="Something went wrong. Please try again.";function l$(e){var t,n=e.licensePayload,s=lJ(""),r=(0,y.Z)(s,2),a=r[0];r[1];var i=(0,q.useState)(!1),o=i[0],l=i[1],c=(0,q.useState)(null),d=c[0],u=c[1],m=(t=(0,x.Z)(j().mark(function e(){var t,n;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return l(!0),u(""),e.prev=2,e.next=5,fetch("/api/upgrade-license",{body:JSON.stringify({key:a}),headers:{"Content-Type":"application/json"},method:"POST"});case 5:if(!((t=e.sent).status>=400)){e.next=13;break}return e.next=9,t.json();case 9:return u(e.sent.userMessage||lX),l(!1),e.abrupt("return");case 13:if(t.ok){e.next=17;break}return u(lX),l(!1),e.abrupt("return");case 17:return e.next=19,t.json();case 19:n=e.sent,window.location.href=n.url,e.next=27;break;case 23:e.prev=23,e.t0=e.catch(2),u(lX),console.error(e.t0);case 27:l(!1);case 28:case"end":return e.stop()}},e,null,[[2,23]])})),function(){return t.apply(this,arguments)});return(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{children:(0,S.jsxs)("button",{onClick:m,disabled:o,className:"inline-flex items-center px-3 py-2 border border-transparent text-base font-medium rounded-md shadow-sm text-white bg-green-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 hover:bg-green-500 transition-all group disabled:bg-gray-400 gap-2",children:[o?(0,S.jsx)(E,{}):(0,S.jsx)("span",{className:"group-hover:scale-125 transition-all mr-2",children:"→"}),(0,S.jsxs)("span",{children:[(0,S.jsx)(A.cC,{id:"XZFk+E"}),"standard"===n.payload.plan?" ($40)":"extended"===n.payload.plan?" ($20)":""]})]})}),d&&(0,S.jsx)("div",{className:"text-red-500",children:d})]})}var l0=function(){var e=(0,q.useState)(null),t=e[0],n=e[1];(0,q.useEffect)(function(){s()},[]);var s=function(){try{var e=I.Z.get("typingmindcloud_token"),t=e$().decode(e);n(t)}catch(e){console.error("cloud token decoded error:",e)}};return t};function l1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,s)}return n}function l2(e){for(var t=1;t0&&m(t)},[]),encodeURIComponent(JSON.stringify({refParams:u}));var x="?"+new URLSearchParams(l2(l2({},u),{},{prefilled_promo_code:"50OFF",client_reference_id:u.ref||u.referrer||"",prefilled_email:(null==f||null===(t=f.user)||void 0===t?void 0:t.email)||""})).toString(),b={standard:"https://buy.typingmind.com/b/eVabKO2aT4Hr0mI6ow",extended:"https://buy.typingmind.com/b/4gwcOScPx0rb8Te4gp",premium:"https://buy.typingmind.com/b/fZecOSg1Jfm5c5q00a",team:"https://buy.typingmind.com/b/aEU3ei5n51vfedy4gn"};return(0,S.jsxs)("div",{children:[o&&s&&!h?(0,S.jsxs)("div",{className:"my-2 text-center",children:[(0,S.jsxs)("div",{className:"text-sm text-center my-2",children:[(0,S.jsx)("div",{className:"text-green-500 font-bold",children:(0,S.jsx)(A.cC,{id:"nAl9s9"})}),(0,S.jsxs)("div",{className:"text-gray-500",children:[(0,S.jsx)(A.cC,{id:"a2BlV3",values:{0:o.slice(-4)},components:{0:(0,S.jsx)("code",{})}}),(0,S.jsxs)("button",{onClick:s,className:"text-blue-500 hover:underline inline-block",children:["(",(0,S.jsx)(A.cC,{id:"07FUrc"}),")"]})]}),r?(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{children:(0,S.jsx)(A.cC,{id:"2LLYJB",values:{0:(0,O.fm)((null==r||null===(n=r.payload)||void 0===n?void 0:n.plan)||"?")},components:{0:(0,S.jsx)("b",{className:"text-green-500"})}})}),"premium"!==r.payload.plan?(0,S.jsx)("div",{className:"my-4",children:(0,S.jsx)(l$,{licensePayload:r})}):null]}):null]}),(0,S.jsx)("div",{className:"my-2 text-center",children:(0,S.jsxs)("button",{onClick:function(){return g(!0)},className:"inline-flex items-center px-3 py-3 border border-transparent text-base font-medium rounded-md shadow-sm text-white bg-green-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 hover:bg-green-500 transition-all group",children:[(0,S.jsx)("span",{className:"group-hover:scale-125 transition-all mr-2",children:"→"})," ",(0,S.jsx)(A.cC,{id:"lAkf2Q"})]})})]}):(0,S.jsxs)("div",{children:[(0,S.jsxs)("h2",{className:"text-center text-2xl font-bold flex items-center justify-center space-x-2",children:[(0,S.jsx)(Y.WYw,{className:"h-8 w-8 text-red-500","aria-hidden":"true"}),(0,S.jsx)("span",{children:"Get A Lifetime License"})]}),(0,S.jsx)("div",{className:"text-base text-center mt-2 mb-4 text-gray-500",children:(0,S.jsx)("div",{children:"Buy once, use forever!"})}),(0,S.jsxs)("div",{className:"grid sm:grid-cols-3 divide-y sm:divide-x sm:divide-y-0 dark:divide-zinc-600",children:[(0,S.jsxs)("div",{className:" flex items-center justify-between flex-col py-4 sm:py-0",children:[(0,S.jsxs)("div",{className:"grid grid-cols-2 sm:grid-cols-1 gap-2 h-full w-full text-center",children:[(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"text-lg font-bold text-gray-500",children:(0,S.jsx)(A.cC,{id:"TJBHlP"})}),(0,S.jsx)("div",{className:" text-center my-2 space-x-2",children:(0,S.jsx)("span",{className:"text-4xl font-extrabold text-green-500",children:"$39"})})]}),(0,S.jsx)("div",{className:"flex items-center sm:justify-center",children:(0,S.jsxs)("div",{className:"my-2 space-y-1",children:[(0,S.jsxs)("div",{className:"flex items-center justify-start space-x-1",children:[(0,S.jsx)(Y.mny,{className:"text-green-500 w-4 h-4 shrink-0"}),(0,S.jsx)("div",{className:"text-sm",children:(0,S.jsx)("div",{className:"cursor-default",children:(0,S.jsx)(A.cC,{id:"eLm251"})})})]}),(0,S.jsxs)("div",{className:"flex items-center justify-start space-x-1",children:[(0,S.jsx)(Y.mny,{className:"text-green-500 w-4 h-4 shrink-0"}),(0,S.jsx)("div",{className:"text-sm",children:(0,S.jsx)("div",{children:(0,S.jsx)(A.cC,{id:"RIaiD3"})})})]}),(0,S.jsxs)("div",{className:"flex items-center justify-start space-x-1",children:[(0,S.jsx)(Y.mny,{className:"text-green-500 w-4 h-4 shrink-0"}),(0,S.jsx)("div",{className:"text-sm",children:(0,S.jsx)("div",{children:(0,S.jsx)(A.cC,{id:"/MikjG"})})})]})]})})]}),(0,S.jsx)("div",{className:"my-2 w-full mt-4 text-center",children:(0,S.jsxs)("a",{href:b.standard+x,className:"inline-flex justify-center items-center px-6 sm:px-3 py-2 border border-transparent text-base font-medium rounded-md shadow-sm text-white bg-green-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 hover:bg-green-500 transition-all group ",children:[(0,S.jsx)("span",{className:"group-hover:scale-125 transition-all mr-2",children:"→"})," ",(0,S.jsx)(A.cC,{id:"Betuyn"})]})})]}),(0,S.jsxs)("div",{className:" flex items-center justify-between flex-col py-4 sm:py-0",children:[(0,S.jsxs)("div",{className:"grid grid-cols-2 sm:grid-cols-1 gap-2 h-full w-full text-center",children:[(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"text-lg font-bold text-gray-500",children:(0,S.jsx)(A.cC,{id:"HtEG00"})}),(0,S.jsx)("div",{className:" text-center my-2 space-x-2",children:(0,S.jsx)("span",{className:"text-4xl font-extrabold text-green-500",children:"$59"})})]}),(0,S.jsx)("div",{className:"flex items-center sm:justify-center",children:(0,S.jsxs)("div",{className:"my-2 space-y-1",children:[(0,S.jsxs)("div",{className:"flex items-center justify-start space-x-1",children:[(0,S.jsx)(Y.mny,{className:"text-green-500 w-4 h-4 shrink-0"}),(0,S.jsx)("div",{className:"text-sm",children:(0,S.jsx)("div",{className:"anchor-upload-documents underline decoration-dotted cursor-default",children:(0,S.jsx)(A.cC,{id:"m08Cos"})})}),(0,S.jsx)(sL.u,{anchorSelect:".anchor-upload-documents",place:"top",children:(0,S.jsx)(A.cC,{id:"hxNoxI"})})]}),(0,S.jsxs)("div",{className:"flex items-center justify-start space-x-1",children:[(0,S.jsx)(Y.mny,{className:"text-green-500 w-4 h-4 shrink-0"}),(0,S.jsx)("div",{className:"text-sm",children:(0,S.jsx)("div",{className:"anchor-web-search underline decoration-dotted cursor-default",children:(0,S.jsx)(A.cC,{id:"LnnVIT"})})}),(0,S.jsx)(sL.u,{anchorSelect:".anchor-web-search",place:"top",children:(0,S.jsx)(A.cC,{id:"VuFDmS"})})]}),(0,S.jsxs)("div",{className:"flex items-center justify-start space-x-1",children:[(0,S.jsx)(Y.mny,{className:"text-green-500 w-4 h-4 shrink-0"}),(0,S.jsx)("div",{className:"text-sm",children:(0,S.jsx)("div",{className:"anchor-text-to-speech underline decoration-dotted cursor-default",children:(0,S.jsx)(A.cC,{id:"CZer2q"})})}),(0,S.jsx)(sL.u,{anchorSelect:".anchor-text-to-speech",place:"top",children:(0,S.jsx)(A.cC,{id:"stJ7GC"})})]})]})})]}),(0,S.jsx)("div",{className:"my-2 w-full mt-4 text-center",children:(0,S.jsxs)("a",{href:b.extended+x,className:"inline-flex justify-center items-center px-6 sm:px-3 py-2 border border-transparent text-base font-medium rounded-md shadow-sm text-white bg-green-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 hover:bg-green-500 transition-all group ",children:[(0,S.jsx)("span",{className:"group-hover:scale-125 transition-all mr-2",children:"→"})," ",(0,S.jsx)(A.cC,{id:"oPWFMP"})]})})]}),(0,S.jsxs)("div",{className:" flex items-center justify-center flex-col py-4 sm:py-0",children:[(0,S.jsxs)("div",{className:"grid grid-cols-2 sm:grid-cols-1 gap-2 h-full w-full text-center",children:[(0,S.jsxs)("div",{className:"",children:[(0,S.jsxs)("div",{className:"text-lg font-bold text-gray-500 flex items-center justify-center sm:justify-center gap-2",children:[(0,S.jsx)("div",{className:"w-2 h-2 rounded-full bg-red-500",children:(0,S.jsx)("div",{className:"w-2 h-2 rounded-full bg-red-500 animate-ping"})}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"RY5kDp"})})]}),(0,S.jsxs)("div",{className:" text-center my-2 space-x-2",children:[(0,S.jsx)("span",{className:"text-4xl font-extrabold bg-gradient-to-br from-pink-500 to-red-500 bg-clip-text text-transparent",children:"$79"}),(0,S.jsx)("span",{className:"text-xl font-semibold text-gray-500 line-through",children:"$159"})]}),(0,S.jsx)("div",{className:"flex items-center justify-center",children:(0,S.jsx)("div",{className:"text-xs bg-red-500 rounded-full text-white font-semibold px-2 py-1",children:"Limited-Time Offer!"})})]}),(0,S.jsx)("div",{className:"flex items-center sm:justify-center",children:(0,S.jsxs)("div",{className:"my-2 space-y-1",children:[(0,S.jsxs)("div",{className:"flex items-center justify-start space-x-1",children:[(0,S.jsx)(Y.mny,{className:"text-green-500 w-4 h-4 shrink-0"}),(0,S.jsx)("div",{className:"text-sm anchor-unlimited-plugins decoration-dotted underline cursor-default",children:(0,S.jsx)("div",{children:(0,S.jsx)(A.cC,{id:"809od7"})})})]}),(0,S.jsx)(sL.u,{anchorSelect:".anchor-unlimited-plugins",place:"top",children:(0,S.jsx)(A.cC,{id:"gitlhh"})}),(0,S.jsxs)("div",{className:"flex items-center justify-start space-x-1",children:[(0,S.jsx)(Y.mny,{className:"text-green-500 w-4 h-4 shrink-0"}),(0,S.jsx)("div",{className:"text-sm",children:(0,S.jsx)("div",{className:"anchor-gpt4-vision underline decoration-dotted cursor-default",children:(0,S.jsx)(A.cC,{id:"lOPUqQ"})})}),(0,S.jsx)(sL.u,{anchorSelect:".anchor-gpt4-vision",place:"top",children:(0,S.jsx)(A.cC,{id:"5d7oGr"})})]}),(0,S.jsxs)("div",{className:"flex items-center justify-start space-x-1",children:[(0,S.jsx)(Y.mny,{className:"text-green-500 w-4 h-4 shrink-0"}),(0,S.jsx)("div",{className:"text-sm",children:(0,S.jsx)("div",{className:" anchor-future-updates decoration-dotted underline cursor-default",children:(0,S.jsx)(A.cC,{id:"sPODjJ"})})}),(0,S.jsx)(sL.u,{anchorSelect:".anchor-future-updates",place:"top",children:"Buy once, get all future updates for free. We are committed to continuously improving TypingMind."})]})]})})]}),(0,S.jsx)("div",{className:"my-2 mt-4 text-center w-full",children:(0,S.jsxs)("a",{href:b.premium+x,className:"inline-flex justify-center items-center px-6 sm:px-3 py-2 border border-transparent text-base font-medium rounded-md shadow-sm text-white bg-green-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 hover:bg-green-500 transition-all group ",children:[(0,S.jsx)("span",{className:"group-hover:scale-125 transition-all mr-2",children:"→"})," ",(0,S.jsx)(A.cC,{id:"Ae1t/2"})]})})]})]}),(0,S.jsx)("hr",{className:"my-4 border-gray-200 dark:border-gray-700"}),(0,S.jsxs)("div",{className:"my-4 w-full text-center",children:[(0,S.jsxs)("div",{className:"flex flex-col items-center justify-center gap-4 flex-wrap",children:[(0,S.jsx)("button",{className:"flex w-full sm:w-fit sm:inline-flex justify-center items-center px-6 sm:px-3 py-2 border border-transparent text-base font-medium rounded-md shadow-sm text-white bg-green-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 hover:bg-green-500 transition-all group ",onClick:function(){return s()},children:(0,S.jsx)(A.cC,{id:"lugxJv"})}),(0,S.jsx)("a",{className:"text-blue-500 hover:underline",target:"_blank",rel:"noreferrer noopener",href:"https://docs.typingmind.com/getting-started/compare-typingmind-plans",children:(0,S.jsx)(A.cC,{id:"VlM+81"})})]}),(0,S.jsx)("div",{className:"text-xs text-gray-500 text-center my-2",children:(0,S.jsxs)("div",{className:"text-xs text-center my-2",children:[(0,S.jsx)(A.cC,{id:"dmfyiH"})," ","(",(0,S.jsx)("a",{target:"_blank",href:"/privacy",className:"hover:underline",children:(0,S.jsx)(A.cC,{id:"LcET2C"})})," | ",(0,S.jsx)("a",{target:"_blank",href:"/terms",className:"hover:underline",children:(0,S.jsx)(A.cC,{id:"xowcRf"})}),")"]})})]})]}),(0,S.jsxs)("div",{className:"bg-gradient-to-r from-cyan-500 to-blue-500 text-white py-2 px-4 rounded-lg shadow",children:[(0,S.jsx)("div",{className:" text-center my-4 text-2xl font-bold",children:(0,S.jsx)(A.cC,{id:"He1Q8M"})}),(0,S.jsxs)("div",{className:"flex items-center justify-center gap-2 my-4",children:[(0,S.jsx)("img",{height:"21",width:"133",src:"/assets/stars.svg"})," ",(0,S.jsx)("span",{className:"text-lg font-bold",children:"4.9/5"})]}),(0,S.jsxs)("div",{className:"flex items-center justify-center gap-2 flex-col sm:flex-row",children:[(0,S.jsx)("div",{className:"flex items-center justify-center",children:(0,S.jsx)("a",{href:"https://www.producthunt.com/posts/typing-mind?utm_source=badge-featured&utm_medium=badge&utm_souce=badge-typing-mind",target:"_blank",children:(0,S.jsx)("img",{src:"/assets/product-hunt/featured.svg",alt:"TypingMind - A better UI for ChatGPT, Claude, and Gemini | Product Hunt",style:{width:"250px",height:"54px"},width:250,height:54})})}),(0,S.jsx)("div",{className:"flex items-center justify-center",children:(0,S.jsx)("a",{href:"https://www.producthunt.com/posts/typing-mind?utm_source=badge-top-post-badge&utm_medium=badge&utm_souce=badge-typing-mind",target:"_blank",children:(0,S.jsx)("img",{src:"/assets/product-hunt/top-post-badge.svg",alt:"TypingMind - A better UI for ChatGPT, Claude, and Gemini | Product Hunt",style:{width:"250px",height:"54px"},width:250,height:54})})})]}),(0,S.jsxs)("div",{className:"text-center my-8",children:[(0,S.jsxs)("div",{className:"flex items-start justify-center gap-2 my-4",children:[(0,S.jsx)("img",{src:"/assets/testimonials/sebastian.jpeg",className:"w-12 h-12 rounded-full mt-1 flex-shrink-0"}),(0,S.jsxs)("div",{className:"text-sm text-left",children:[(0,S.jsxs)("div",{className:"flex items-center justify-start gap-2 text-base",children:[(0,S.jsx)("div",{className:"font-semibold",children:"Sebastian Tiller"}),(0,S.jsx)("img",{height:"12",width:"76",src:"/assets/stars.svg"})," "]}),(0,S.jsx)("div",{className:" ",children:(0,S.jsx)(A.cC,{id:"0EHAOo"})})]})]}),(0,S.jsxs)("div",{className:"flex items-start justify-center gap-2 my-4",children:[(0,S.jsx)("img",{src:"/assets/testimonials/ranjeeth.jpeg",className:"w-12 h-12 rounded-full mt-1 flex-shrink-0"}),(0,S.jsxs)("div",{className:"text-sm text-left",children:[(0,S.jsxs)("div",{className:"flex items-center justify-start gap-2 text-base",children:[(0,S.jsx)("div",{className:"font-semibold",children:"Ranjeeth Thunga"}),(0,S.jsx)("img",{height:"12",width:"76",src:"/assets/stars.svg"})," "]}),(0,S.jsx)("div",{className:" ",children:(0,S.jsx)(A.cC,{id:"d/uqej"})})]})]}),(0,S.jsxs)("div",{className:"flex items-start justify-center gap-2 my-4",children:[(0,S.jsx)("img",{src:"/assets/testimonials/mirel.jpeg",className:"w-12 h-12 rounded-full mt-1 flex-shrink-0"}),(0,S.jsxs)("div",{className:"text-sm text-left",children:[(0,S.jsxs)("div",{className:"flex items-center justify-start gap-2 text-base",children:[(0,S.jsx)("div",{className:"font-semibold",children:"Mirel Vasile"}),(0,S.jsx)("img",{height:"12",width:"76",src:"/assets/stars.svg"})," "]}),(0,S.jsx)("div",{className:" ",children:(0,S.jsx)(A.cC,{id:"fnLwMQ"})})]})]})]}),(0,S.jsx)("div",{className:"my-4 text-center",children:(0,S.jsx)("a",{className:"text-blue-500 hover:underline bg-white py-2 px-4 rounded-md shadow",target:"_blank",rel:"noreferrer noopener",href:"https://www.producthunt.com/products/typing-mind/reviews",children:(0,S.jsx)(A.cC,{id:"4i4Xz6"})})})]}),(0,S.jsxs)("div",{className:"mt-8 ",children:[(0,S.jsx)("h2",{className:"text-2xl mt-8 font-bold leading-10 tracking-tight text-center",children:(0,S.jsx)(A.cC,{id:"22oG2a"})}),(0,S.jsx)("div",{className:"my-2 text-gray-500 text-center",children:(0,S.jsx)(A.cC,{id:"J9vOlR"})}),(0,S.jsxs)("a",{target:"_blank",href:"/features",className:"my-2 hover:opacity-50 transition-all block",children:[(0,S.jsx)("img",{className:" hover:scale-105 transition-all",src:"/assets/features.png"})," "]})]}),(0,S.jsxs)("section",{className:"text-center",children:[(0,S.jsx)("div",{className:" text-center mt-8 mb-4 text-xl sm:text-2xl font-bold",children:(0,S.jsx)(A.cC,{id:"fUFexU"})}),(0,S.jsx)("div",{className:"my-2",children:(0,S.jsx)(A.cC,{id:"zaVaEv",components:{0:(0,S.jsx)("b",{})}})}),(0,S.jsx)("div",{children:(0,S.jsx)("a",{className:"text-blue-500 hover:underline",target:"_blank",rel:"noreferrer noopener",href:"https://www.typingmind.com/changelog",children:(0,S.jsx)(A.cC,{id:"KvFtJO"})})})]}),(0,S.jsxs)("section",{children:[(0,S.jsx)("div",{className:" text-center mt-8 mb-4 text-xl sm:text-2xl font-bold",children:(0,S.jsx)(A.cC,{id:"cRj6CO"})}),(0,S.jsxs)("div",{className:"text-center border border-green-200 bg-green-100 text-sm rounded-md py-2 dark:bg-green-900 dark:border-green-600 px-4 my-2",children:[(0,S.jsx)("div",{className:"mb-2",children:(0,S.jsx)(A.cC,{id:"6iJX/K",components:{0:(0,S.jsx)("b",{}),1:(0,S.jsx)("b",{})}})}),(0,S.jsxs)("a",{href:b.team+x,target:"_blank",className:"inline-flex items-center px-4 py-2 border border-transparent text-base font-medium rounded-md shadow-sm text-white bg-cyan-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 hover:bg-cyan-500 transition-all group",children:[(0,S.jsx)("span",{className:"group-hover:scale-125 transition-all mr-2",children:"→"})," ",(0,S.jsx)(A.cC,{id:"IhEEon"})]})]}),(0,S.jsxs)("div",{className:"text-center border border-green-200 bg-green-100 text-sm rounded-md py-2 dark:bg-green-900 dark:border-green-600 px-4 my-2",children:[(0,S.jsx)("div",{className:"mb-2",children:(0,S.jsx)(A.cC,{id:"SLYcVl",components:{0:(0,S.jsx)("b",{})}})}),(0,S.jsxs)("a",{href:"https://custom.typingmind.com?ref=typingmind",target:"_blank",className:"inline-flex items-center px-4 py-2 border border-transparent text-base font-medium rounded-md shadow-sm text-white bg-cyan-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 hover:bg-cyan-500 transition-all group",children:[(0,S.jsx)("span",{className:"group-hover:scale-125 transition-all mr-2",children:"→"})," ",(0,S.jsx)("span",{children:"TypingMind Custom"})]})]})]}),(0,S.jsx)("div",{className:"mt-8",children:(0,S.jsx)(lc,{})})]})}var l3=(0,K.eK)("useLicenseKey");function l6(e){var t,n,s,r=e.open,a=e.licensePayload,i=e.setOpen,o=e.setOpenLicenseKey,l=(0,q.useState)(!1),c=l[0],d=l[1],u=l3(""),m=(0,y.Z)(u,2),p=m[0];m[1];var h=_();(0,q.useEffect)(function(){r&&d(!1)},[r]);var g=function(){i(!1),setTimeout(function(){o(!0)},500)};return(0,S.jsx)(X,{max:!0,open:r,setOpen:i,showCloseButton:!1,children:p&&g&&!c?(0,S.jsxs)("div",{className:"my-2 text-center",children:[(0,S.jsxs)("div",{className:"text-sm text-center my-2",children:[(0,S.jsx)("div",{className:"text-green-500 font-bold",children:(0,S.jsx)(A.cC,{id:"nAl9s9"})}),(0,S.jsxs)("div",{className:"text-gray-500",children:[(0,S.jsx)(A.cC,{id:"a2BlV3",values:{0:p.slice(-4)},components:{0:(0,S.jsx)("code",{})}}),(0,S.jsxs)("button",{onClick:g,className:"text-blue-500 hover:underline inline-block",children:["(",(0,S.jsx)(A.cC,{id:"07FUrc"}),")"]})]}),a?(0,S.jsx)("div",{children:(0,S.jsx)("div",{children:(0,S.jsx)(A.cC,{id:"2LLYJB",values:{0:(0,O.fm)((null==a||null===(t=a.payload)||void 0===t?void 0:t.plan)||"?")},components:{0:(0,S.jsx)("b",{className:"text-green-500"})}})})}):null]}),(0,S.jsx)("div",{className:"my-2 text-center",children:(0,S.jsxs)("button",{onClick:function(){return d(!0)},className:"inline-flex items-center px-3 py-3 border border-transparent text-base font-medium rounded-md shadow-sm text-white bg-green-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 hover:bg-green-500 transition-all group",children:[(0,S.jsx)("span",{className:"group-hover:scale-125 transition-all mr-2",children:"→"})," ",(0,S.jsx)(A.cC,{id:"lAkf2Q"})]})})]}):(0,S.jsx)(S.Fragment,{children:null!==(n=h.serverHostConfig)&&void 0!==n&&n.customPricingEmbedURL?(0,S.jsx)("iframe",{src:null===(s=h.serverHostConfig)||void 0===s?void 0:s.customPricingEmbedURL,style:{height:600},className:"w-full"}):(0,S.jsx)("div",{children:"Coming Soon!"})})})}var l7=n(43295);function l8(e){var t=e.hostConfig,n=nn().isDarkMode;return(0,S.jsx)("div",{"data-element-id":"custom-brand-section-container",className:"p-6 flex items-center justify-center",children:t.bannerURL?(0,S.jsx)("img",{src:n&&t.darkBannerURL||t.bannerURL,alt:t.brand,"data-element-id":"brand-banner",className:"max-w-[600px] w-full"}):(0,S.jsxs)("div",{children:[(0,S.jsxs)("div",{className:"flex items-center justify-center space-x-2",children:[(0,S.jsx)("img",{src:n&&t.darkLogoURL||t.logoURL||"/favicon-192x192.png",alt:t.brand,"data-element-id":"brand-icon",className:"rounded-lg w-12 h-12 object-cover"}),(0,S.jsx)("div",{"data-element-id":"brand-name",className:"font-semibold text-4xl sm:text-5xl text-black dark:text-white flex items-center justify-center gap-2",children:(0,S.jsx)("span",{children:t.brand})})]}),(0,S.jsx)("div",{"data-element-id":"brand-tagline",className:"text-center my-4 font-light text-base sm:text-xl my-4 sm:my-6 text-black dark:text-white",children:t.tagline})]})})}function l9(e){var t=e.chatID,n=e.children,s=e.userDataStoreRef,r=e.systemCharacters,a=e.shouldScrollToMessage,i=(0,q.useState)(void 0),o=i[0],l=i[1],c=(0,q.useState)(void 0),d=c[0],u=c[1],m=(0,nG.Q)(null),p=(0,y.Z)(m,1)[0],h=(0,nF.C)(null),g=(0,y.Z)(h,1)[0];(0,q.useEffect)(function(){(0,x.Z)(j().mark(function e(){var n,a;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,s.current.getChatData(t);case 3:if(n=e.sent){e.next=7;break}return l(null),e.abrupt("return");case 7:n.character&&(a=[].concat((0,v.Z)(r||[]),(0,v.Z)(p||[])).find(function(e){return e.id===n.character.id}))&&(n.character=a),l(n),e.next=15;break;case 11:e.prev=11,e.t0=e.catch(0),l(null),console.error(e.t0);case 15:case"end":return e.stop()}},e,null,[[0,11]])}))()},[t,p]),(0,q.useEffect)(function(){null!==p&&null!==g&&u({userCharacters:p,installedPlugins:g})},[p,g]);var f=(0,q.useMemo)(function(){var e,t;return null!=o&&null!==(e=o.messages)&&void 0!==e&&e.length&&null!==(t=history.state)&&void 0!==t&&t.search?o.messages.findIndex(function(e){var t;return null===(t=(0,O.FB)(e.content))||void 0===t?void 0:t.toLowerCase().includes(history.state.search.toLowerCase())}):-1},[o,a]);return void 0===o||void 0===d?null:n({preloadChatData:o,preloadUserData:d,highlightedMessageIndex:f})}function ce(e){var t,n,s=e.open,r=e.setOpen,a=_();return(0,S.jsxs)(X,{wide:!0,open:s,setOpen:r,showCloseButton:!1,delayMount:!0,children:[(0,S.jsx)("h2",{className:"text-center text-xl font-bold",children:(0,S.jsx)(A.cC,{id:"CZer2q"})}),(0,S.jsx)("hr",{className:"my-4"}),(0,S.jsx)(t9,{showOpenAI:!(null!==(t=a.serverHostConfig)&&void 0!==t&&t.managed)||(0,O.N7)("useOpenAITextToSpeech",null===(n=a.serverHostConfig)||void 0===n?void 0:n.chatFeatures)}),(0,S.jsx)("div",{className:"text-center mt-4",children:(0,S.jsx)("button",{onClick:function(){return r(!1)},type:"submit",className:"inline-flex items-center px-4 py-2 border border-transparent text-base font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 gap-2",children:(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"DPfwMq"})})})})]})}function ct(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,s)}return n}function cn(e){for(var t=1;t=100?(0,S.jsx)("div",{className:"p-2",children:(0,S.jsxs)("div",{className:"rounded-lg p-4 bg-white/10 text-white",children:[(0,S.jsxs)("div",{className:"flex flex-col items-center justify-start gap-2",children:[(0,S.jsx)("span",{className:"rounded-full h-12 w-12 flex items-center justify-center bg-green-500",children:(0,S.jsx)(C.l_A,{className:"w-8 h-8"})}),(0,S.jsx)("span",{className:"text-base font-bold",children:(0,S.jsx)(A.cC,{id:"Ooe1lZ"})})]}),(0,S.jsx)("div",{className:"text-sm text-center my-2 text-white/80",children:(0,S.jsx)(A.cC,{id:"pcGj5q"})}),(0,S.jsxs)("div",{className:"mt-4 grid grid-cols-2 gap-4",children:[(0,S.jsxs)("a",{href:"https://docs.typingmind.com",target:"_blank",type:"submit",className:"flex justify-center items-center px-3 py-1.5 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 gap-2",children:[(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"NgeSlx"})}),(0,S.jsx)(nv._Hk,{className:"w-4 h-4"})]}),(0,S.jsx)("button",{onClick:function(){return w(!0)},type:"submit",className:"flex justify-center items-center px-3 py-1.5 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 gap-2",children:(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"JmZ/+d"})})})]})]})}):(0,S.jsx)("div",{className:"p-2",children:(0,S.jsxs)("div",{className:"rounded-lg p-4 bg-white/10 text-white",children:[N?null:(0,S.jsxs)("div",{className:"flex items-center justify-between gap-2 mb-4",children:[(0,S.jsxs)("div",{className:"flex items-center justify-start gap-2",children:[(0,S.jsx)("div",{className:"text-3xl",children:"\uD83D\uDC4B"})," ",(0,S.jsxs)("div",{className:"w-full",children:[(0,S.jsx)("div",{className:"text-sm font-semibold",children:(0,S.jsx)(A.cC,{id:"goIoni"})}),(0,S.jsx)("div",{className:"text-xs text-white/50",children:(0,S.jsx)(A.cC,{id:"LGyzFK"})})]})]}),(0,S.jsxs)("div",{className:"flex items-center justify-center gap-2 text-xs",children:[(0,S.jsx)("button",{onClick:function(){return I(!N)},children:(0,S.jsx)(o_.Ycn,{className:"w-4 h-4 text-white/50 hover:text-white"})}),(0,S.jsx)(eS,{onConfirmed:function(){return w(!0)},children:(0,S.jsx)(Y.oHP,{className:"w-4 h-4 text-white/50 hover:text-white"})})]})]}),(0,S.jsxs)("div",{className:"flex items-center justify-center gap-4",children:[(0,S.jsx)("div",{className:"bg-white/20 rounded-full w-full h-2",children:(0,S.jsx)("div",{style:{width:"".concat(_,"%")},className:"bg-green-500 rounded-full h-2 transition-all duration-[4000ms]",children:V?(0,S.jsx)("div",{className:"flex items-center justify-center w-full h-0",children:(0,S.jsx)(lL.Z,{zIndex:"1000"})}):null})}),N?(0,S.jsx)("button",{onClick:function(){return I(!N)},children:(0,S.jsx)(o_.Ycn,{className:"w-4 h-4 text-white/50 hover:text-white"})}):null]}),(0,S.jsx)("div",{className:"text-white/90 text-sm",children:N?null:(0,S.jsxs)("div",{className:"mt-4 space-y-2",children:[(0,S.jsxs)("button",{disabled:!0,className:"w-full flex items-center justify-start gap-2 rounded-full bg-white/10 p-2",children:[(0,S.jsx)("span",{className:"rounded-full h-6 w-6 flex items-center justify-center bg-green-500",children:(0,S.jsx)(C.l_A,{className:"w-3 h-3"})}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"ZDIydz"})})]}),B.map(function(e,t){return(0,S.jsxs)("button",{className:"w-full flex items-center justify-start gap-2 rounded-full bg-white/10 p-2 hover:bg-white/20 transition disabled:hover:bg-white/10",disabled:e.value,onClick:e.action,"data-tooltip-id":"global","data-tooltip-content":e.tooltip,children:[(0,S.jsx)("span",{className:cf("rounded-full h-6 w-6 flex items-center justify-center",e.value?"bg-green-500":" bg-white/20"),children:(0,S.jsx)(C.l_A,{className:"w-3 h-3"})}),(0,S.jsx)("span",{children:e.name})]},e.id)})]})})]})})}function cb(e){var t=e.decryptedApiKey,n=e.decryptedAnthropicApiKey,s=e.decryptedGeminiApiKey,r=e.setOpenDecrypt;return[t,n,s].filter(Boolean).filter(function(e){return e.startsWith("encrypted-")}).length>0?(0,S.jsxs)("div",{className:"bg-red-900 text-white p-2 text-xs font-medium flex items-center justify-center gap-2 border-white/20 border-t",children:[(0,S.jsx)("div",{className:"text-left",children:(0,S.jsx)(A.cC,{id:"HXdJo7"})}),(0,S.jsxs)("button",{onClick:function(){r(!0)},className:"flex-shrink-0 cursor-default inline-flex items-center px-2 py-1 border border-transparent text-xs font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 gap-2 transition-colors",children:[(0,S.jsx)(C.D5B,{className:"w-4 h-4"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"tUYydg"})})]})]}):null}var cv=n(36710);function cy(e){var t,n=e.currentVersion,s=(0,q.useState)(!1),r=s[0],a=s[1];(0,q.useEffect)(function(){var e=function(){"visible"===document.visibilityState&&i()};return window.document.addEventListener("visibilitychange",e),function(){window.document.removeEventListener("visibilitychange",e)}},[]);var i=(t=(0,x.Z)(j().mark(function e(){var t,s;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n){e.next=2;break}return e.abrupt("return");case 2:if(window.localStorage.getItem("TM_LAST_VERSION_DATE")!==(t=new Date().toISOString().slice(0,10))){e.next=6;break}return e.abrupt("return");case 6:return e.prev=6,e.next=9,fetch("/api/version");case 9:if((s=e.sent).ok){e.next=12;break}throw Error("Failed to fetch version");case 12:return e.next=14,s.json();case 14:e.sent.vercelGitSHA!==n&&a(!0),window.localStorage.setItem("TM_LAST_VERSION_DATE",t),e.next=22;break;case 19:e.prev=19,e.t0=e.catch(6),console.error("Error checking new version:",e.t0);case 22:case"end":return e.stop()}},e,null,[[6,19]])})),function(){return t.apply(this,arguments)});return n&&r?(0,S.jsxs)("div",{className:"bg-green-900 text-white p-2 text-xs font-medium flex items-center justify-center gap-2 border-white/20 border-t",children:[(0,S.jsx)("div",{className:"text-left",children:(0,S.jsx)(A.cC,{id:"heil9d"})}),(0,S.jsx)("button",{onClick:function(e){e.preventDefault(),e.stopPropagation(),e.currentTarget.setAttribute("disabled","true"),setTimeout(function(){window.location.reload()},100)},className:"flex-shrink-0 cursor-default inline-flex items-center px-2 py-1 border border-transparent text-xs font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 gap-2 transition-colors",children:(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"u6QeR6"})})})]}):null}function cw(e){var t=e.hostConfig,n=e.small,s=e.setOpenOrgUserProfilePopup,r=(0,eI.e)(),a=r.user,i=r.setUser,o=r.loading,l=r.loadUser;return(0,q.useEffect)(function(){t.currentUser&&i(t.currentUser),l()},[]),o&&!a?null:(0,S.jsx)("div",{children:a?"anonymous"===a.externalUserID?null!=t&&t.publicModeAllowLogin?(0,S.jsx)(o$,{hostConfig:t,small:n,onLoggedIn:function(){window.location.reload()}}):null:n?null:(0,S.jsxs)("div",{className:"text-sm text-left pt-1 pb-1",children:[(0,S.jsx)(o8,{setOpenOrgUserProfilePopup:s}),t.allowSubscriptions?(0,S.jsxs)("div",{className:"flex items-center justify-center gap-2 flex-wrap border-t border-white/20 mt-3 pt-2",children:[(0,S.jsx)(o7,{user:a,hostConfig:t}),(0,S.jsx)(o6,{user:a,hostConfig:t})]}):null]}):(0,S.jsx)(o$,{hostConfig:t,small:n,onLoggedIn:function(){window.location.reload()}})})}var cj=(0,K.eK)("useChatUniqeTags");function cA(e){var t=e.chat,n=e.open,s=e.setOpen,r=e.onUpdateTags,a=(0,q.useState)(t.tags||[]),i=a[0],o=a[1],l=cj([]),c=(0,y.Z)(l,1)[0];return(0,S.jsx)(X,{title:t.title||T.ag._({id:"q2+WzE"}),open:n,setOpen:s,showCloseButton:!1,hideOverflow:!1,wide:!0,children:(0,S.jsxs)("div",{className:"mt-6 text-left text-sm flex items-end space-x-2 sm:space-x-4",children:[(0,S.jsxs)("div",{className:"grow",children:[(0,S.jsx)("p",{className:"mb-2 font-medium",children:(0,S.jsx)(A.cC,{id:"n6bA7l"})}),(0,S.jsx)(ro,{allowNew:!0,tags:i,setTags:o,suggestions:c})]}),(0,S.jsxs)("div",{className:"justify-center items-center space-x-2 grid grid-cols-2",children:[(0,S.jsx)("button",{className:"sm:px-4 sm:py-2 min-h-[42px] flex justify-center items-center border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 disabled:cursor-default transition-colors whitespace-nowrap gap-1",onClick:function(){r(t.id,i),s(!1)},children:(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"tfDRzk"})})}),(0,S.jsx)("button",{onClick:function(){return s(!1)},className:"sm:px-4 sm:py-2 min-h-[42px] text-black dark:text-white transition font-bold rounded inline-flex space-x-1 justify-center items-center disabled:opacity-50",children:(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"dEgA5A"})})})]})]})})}var ck=(0,K.eK)("useFolderList"),cN=function(e){var t,n=e.moveChatsToFolder,s=e.className,r=e.disabled,a=e.children,i=e.selectedChatIDs,o=e.onMoved,l=e.chatTitle,c=e.asChild,d=ck([]),u=(0,y.Z)(d,1)[0],m=(0,q.useState)(!1),p=m[0],h=m[1],g=(t=(0,x.Z)(j().mark(function e(t){return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n(i,t);case 2:h(!1),o&&o();case 4:case"end":return e.stop()}},e)})),function(e){return t.apply(this,arguments)});return(0,S.jsxs)(S.Fragment,{children:[c?a({openFolderPopup:function(){return h(!0)}}):(0,S.jsx)("button",{className:s,disabled:r,onClick:function(){return h(!0)},children:a}),(0,S.jsx)(X,{open:p,setOpen:h,title:(0,S.jsx)("span",{className:"block text-left",children:l?(0,S.jsx)(A.cC,{id:"mq//7G",values:{chatTitle:l},components:{0:(0,S.jsx)("b",{})}}):(0,S.jsx)(A.cC,{id:"TuGMMD",values:{0:(null==i?void 0:i.length)||0}})}),children:(0,S.jsx)("div",{className:"mt-4 flex flex-col space-y-2",children:(0,O.Jq)(u).map(function(e){return(0,S.jsx)("button",{className:"hover:bg-gray-300 hover:dark:bg-gray-700 duration-300 p-2 rounded-md",onClick:function(){return g(e.id)},children:(0,S.jsxs)("span",{className:"w-full flex items-center space-x-2",children:[(0,S.jsx)(oB.Oqo,{className:"w-6 h-6 shrink-0"}),(0,S.jsx)("span",{className:"truncate min-w-0",children:e.title||"(Untitled)"})]})},e.id)})})})]})};function cC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,s)}return n}function cq(e){for(var t=1;t0?(0,S.jsx)("button",{onClick:function(){N(!0)},className:"cursor-default text-white/50 hover:text-white transiton-all p-1",children:(0,S.jsx)(Y.YK6,{className:"w-6 h-6 sm:w-4 sm:h-4"})}):(0,S.jsx)(eS,{onConfirmed:r,className:"cursor-default text-white/50 hover:text-white transiton-all p-1",children:(0,S.jsx)(Y.YK6,{className:"w-6 h-6 sm:w-4 sm:h-4"})})]})})]})),(0,S.jsxs)("div",{className:cV("pl-6 relative hidden",m&&"!block mb-4"),children:[n,l>0?(0,S.jsx)("div",{className:"absolute top-0 -translate-y-5 left-5 h-[calc(100%+20px)] w-[1px] bg-white/20 -translate-x-1/2"}):(0,S.jsx)("div",{className:"mt-2 mr-2 rounded-md text-white/50 border border-white/50 border-dashed p-2 text-sm font-semibold text-center",children:"Empty folder"})]}),(0,S.jsx)(sL.u,{id:"add-chat-button",place:"top",children:(0,S.jsx)(A.cC,{id:"5jeS/s"})})]})};function cT(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,s)}return n}function cM(e){for(var t=1;t0&&(0,S.jsx)("span",{className:"absolute bottom-0 right-0 w-2 h-2 rounded-full bg-orange-500"})]}),(0,S.jsx)(oR.Hi,{className:"absolute right-0 z-20 mt-3 w-[272px] text-sm",children:(0,S.jsxs)("div",{"data-element-id":"tag-search-panel",className:"p-2 rounded-md shadow-xl ring-red-400 border border-gray-500 bg-gray-600",children:[(0,S.jsxs)("label",{className:"block space-y-1 relative z-10 text-white",children:[(0,S.jsx)("span",{className:"block font-semibold ",children:"Filter by tags"}),(0,S.jsx)("input",{placeholder:T.ag._({id:"lnWve4"}),type:"search",className:"bg-gray-700 text-white px-2 py-1 rounded-md w-full",value:d,onChange:function(e){return u(e.target.value)}})]}),(0,S.jsxs)("div",{className:"max-h-[200px] overflow-auto text-white space-y-2 mt-2",children:[p.map(function(e){var t=!!o.find(function(t){return t.name===e.name});return(0,S.jsxs)("label",{className:"flex items-center space-x-2 px-1",children:[(0,S.jsx)("input",{type:"checkbox",checked:t,className:"h-4 w-4 rounded border-gray-300",onChange:function(){return l(function(n){return t?n.filter(function(t){return t.id!==e.id}):[].concat((0,v.Z)(n),[e])})}}),(0,S.jsx)("p",{children:e.name})]},e.id)}),0===p.length&&(0,S.jsx)("p",{children:(0,S.jsx)(A.cC,{id:"cCELIA"})})]}),(0,S.jsxs)("div",{className:"mt-2 flex justify-end items-center space-x-1",children:[(0,S.jsx)("button",{onClick:function(){l([])},className:" text-orange-400 hover:text-orange-500 mr-auto transition font-bold py-2 px-1 rounded inline-flex space-x-1 justify-center items-center",children:(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"OfhWJH"})})}),(0,S.jsx)("button",{onClick:function(){l(n),u(""),r()},className:" text-white transition font-bold py-2 px-4 rounded inline-flex space-x-1 justify-center items-center",children:(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"dEgA5A"})})}),(0,S.jsx)("button",{onClick:function(){s(o),u(""),r()},className:"inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 disabled:cursor-default transition-colors whitespace-nowrap gap-1",children:(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"zga9sT"})})})]})]})})]})}})};function cH(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,s=Array(t);n=2)){e.next=5;break}return e.next=3,r(eV);case 3:eS(e.sent);case 5:case"end":return e.stop()}},e)}))()},[eC,eV]);var tl=function(){ei(function(e){return[{id:"fo-"+(0,tJ.Z)(),title:T.ag._({id:"tX5yOZ"}),new:!0,open:!0,createdAt:new Date,updatedAt:new Date,syncedAt:null}].concat((0,v.Z)(e)).map(function(e,t){return cW(cW({},e),{},{order:t})})})},tc=function(e){ei(function(t){var n=(0,O.Jq)(t).findIndex(function(t){return t.id===e.id}),s=(0,v.Z)(t);return s[n]=cW(cW({},e),{},{updatedAt:new Date,syncedAt:null}),s})},td=function(e,t){ec(function(t){return[].concat((0,v.Z)(t),[e])}),ei((0,O.Jq)(ea).filter(function(t){return t.id!==e}));var n=ti[e]||[];t&&m(n)},tu=function(){eK(!1),eY([])},tm=function(e,t){var n=ex?e8.findIndex(function(e){return e===ex}):-1,s=e8.findIndex(function(t){return t===e});t.shiftKey&&-1!==n&&n!==s?eY(function(e){var t=n=e.length?{done:!0}:{done:!1,value:e[s++]}},e:function(e){throw e},f:r}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){o=!0,a=e},f:function(){try{i||null==n.return||n.return()}finally{if(o)throw a}}}}((0,O.Jq)(ea));try{for(s.s();!(n=s.n()).done;){var r,a=n.value;if(null!==(r=ti[a.id])&&void 0!==r&&r.includes(t.id)){e[a.id]=[].concat((0,v.Z)(e[a.id]||[]),[t]);return}}}catch(e){s.e(e)}finally{s.f()}e.ROOT=[].concat((0,v.Z)(e.ROOT||[]),[t])}),e},[tg,ea,ti]);if((0,q.useEffect)(function(){e9(function(){return[].concat((0,v.Z)((0,O.Jq)(ea).map(function(e){return tx[e.id]||[]})),[tx.ROOT||[]]).flat().map(function(e){return e.id})})},[tx,ea]),!z)return null;var tb={"--list-background-color":(0,O.dl)(ta,e6?7:10),"--sidebar-color":(0,O.dl)(ta,e6?10:20),"--popup-color":(0,O.dl)(ta,e6?20:25)};return(0,S.jsxs)("div",{style:tb,onTouchMove:function(e){var t,n;ee&&e.touches[0].clientX-ee<-100&&(null===(t=window.getSelection())||void 0===t||null===(n=t.toString)||void 0===n?void 0:n.call(t))===""&&f(!1)},onTouchStart:function(e){et(e.touches[0].clientX)},onTouchEnd:function(){et(null)},className:"jsx-2562846439 flex min-h-0 flex-1 flex-col bg-gray-800 max-w-[100vw]",children:[(0,S.jsx)("div",{id:"navbar",className:"jsx-2562846439 flex flex-1 flex-col",children:(0,S.jsxs)("nav",{"data-element-id":"side-bar-background",className:"jsx-2562846439 bg-[color:var(--sidebar-color)] flex flex-col h-[calc(100dvh)] md:h-screen md:pl-[--workspace-width] pb-[--workspace-height] md:pb-0",children:[(0,S.jsx)("div",{className:"jsx-2562846439 flex-shrink-0",children:(0,S.jsxs)("div",{"data-element-id":"sidebar-beginning-part",className:"jsx-2562846439 px-2 space-y-2 bg-[color:var(--sidebar-color)] py-2",children:[(0,S.jsxs)("div",{className:"jsx-2562846439 flex items-center justify-center space-x-2",children:[(0,S.jsxs)("button",{onClick:function(){h(),(0,O.nI)()||f(!1),setTimeout(function(){var e=document.getElementById("chat-input-textbox");e&&e.focus()},100)},"data-element-id":"new-chat-button-in-side-bar",className:"jsx-2562846439 "+(c6("cursor-default bg-white/20 hover:bg-white/40 text-white group flex items-center justify-center rounded-md px-2 py-2 text-sm font-medium w-full transition-all")||""),children:[(0,S.jsx)(e4.wIw,{className:c6("text-gray-300 mr-2 h-6 w-6 flex-shrink-0"),"aria-hidden":"true"}),(0,S.jsx)(A.cC,{id:"q2+WzE"})]}),(0,O.N7)("yourProfile",w.chatFeatures)?(0,S.jsxs)("button",{onClick:D,className:"jsx-2562846439 cursor-default hover:bg-white/40 text-white group flex items-center justify-center rounded-md p-1 text-sm font-medium w-[40px] h-[40px] transition-all flex-col bg-white/20 focus:ring-0 flex-shrink-0",children:[(0,S.jsx)(oG,{}),(0,S.jsx)("span",{className:"jsx-2562846439 sr-only",children:(0,S.jsx)(A.cC,{id:"lO1Uso"})})]}):null,(0,S.jsx)("button",{onClick:function(){return f(!1)},"data-element-id":"new-chat-button-in-side-bar",className:"jsx-2562846439 "+(c6("cursor-default bg-white/20 hover:bg-white/40 text-white group flex items-center justify-center rounded-md px-2 py-2 text-sm font-medium transition-all md:hidden")||""),children:(0,S.jsx)(lt.Egk,{className:c6("text-gray-300 h-6 w-6 flex-shrink-0"),"aria-hidden":"true"})})]}),(0,S.jsxs)("div",{className:"jsx-2562846439 relative flex items-center space-x-2",children:[(0,S.jsxs)("div",{className:"jsx-2562846439 relative w-full",children:[(0,S.jsx)("input",{"data-element-id":"search-chats-bar",type:"text",placeholder:T.ag._({id:"wRL7Wp"}),value:J,onChange:function(e){return X(e.target.value)},onKeyDown:function(e){27===e.keyCode&&X("")},className:"jsx-2562846439 bg-black/20 text-white px-2 py-1 rounded-md w-full border border-white/20 ring-white/20"}),J?(0,S.jsx)("button",{onClick:function(){return X("")},className:"jsx-2562846439 absolute right-0 top-0 bottom-0 flex items-center justify-center px-2 text-white",children:(0,S.jsx)(Y.oHP,{className:"w-4 h-4"})}):null]}),(0,S.jsxs)("div",{className:"jsx-2562846439 flex items-center space-x-2 w-[88px] shrink-0",children:[(0,S.jsx)("button",{onClick:function(){tl()},"data-element-id":"create-new-folder",className:"jsx-2562846439 cursor-default text-white/50 hover:text-white transiton-all flex items-center justify-center shrink-0",children:(0,S.jsx)(C.RHD,{className:"w-6 h-6"})}),(0,S.jsx)(cU,{tags:eT,setTags:eM}),eZ?(0,S.jsx)("button",{onClick:tu,"data-element-id":"select-chats-symbol",className:"jsx-2562846439 cursor-default text-white/50 hover:text-white transiton-all flex items-center justify-center shrink-0",children:(0,S.jsx)(C.aHS,{className:"w-6 h-6"})}):(0,S.jsx)("button",{onClick:function(){eK(!0)},"data-element-id":"select-chats-symbol",className:"jsx-2562846439 cursor-default text-white/50 hover:text-white transiton-all flex items-center justify-center shrink-0",children:(0,S.jsx)(oB.ajS,{className:"w-6 h-6"})})]})]}),eT.length>0&&(0,S.jsx)("div",{className:"jsx-2562846439 gap-2 flex flex-wrap items-center",children:eT.map(function(e,t){return(0,S.jsxs)("button",{onClick:function(t){eM(function(t){return t.filter(function(t){return t.name!==e.name})})},style:{backgroundColor:(0,O.vm)(e.name)},className:"jsx-2562846439 cursor-default text-white text-xs space-x-1 flex items-center px-1 py-[2px] rounded-sm whitespace-nowrap hover:opacity-70",children:[(0,S.jsx)("span",{className:"jsx-2562846439",children:e.name}),(0,S.jsx)(Y.oHP,{})]},e.id)})}),eZ&&(0,S.jsxs)("div",{className:"jsx-2562846439",children:[(0,S.jsxs)("div",{className:"jsx-2562846439 flex items-center gap-x-2",children:[(0,S.jsx)("input",{type:"checkbox",checked:eF.length>0&&eF.length===tg.length,onChange:function(){eF.length!==tg.length?eY(tg.map(function(e){return e.id})):eY([])},className:"jsx-2562846439 mx-2"}),(0,S.jsx)(cN,{selectedChatIDs:eF,onMoved:tu,moveChatsToFolder:a,asChild:!0,children:function(e){var t=e.openFolderPopup;return(0,S.jsxs)(eU.v2,{as:"div",className:"grow relative flex text-left",children:[(0,S.jsx)(eU.j2,{disabled:!eF.length,className:"grow bg-gray-600 text-white group flex items-center justify-center rounded-md px-2 py-2 text-sm font-medium hover:bg-gray-500 transition-all disabled:bg-gray-400 cursor-default ",children:(0,S.jsx)(A.cC,{id:"7zrNaY",values:{0:eF.length}})}),(0,S.jsx)(U.u,{as:q.Fragment,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:(0,S.jsx)(eU.sd,{modal:!1,className:"absolute z-40 right-0 left-0 top-full mt-2 origin-top-right divide-y divide-gray-100 rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none",children:(0,S.jsxs)("div",{className:"jsx-2562846439 px-1 py-1 ",children:[(0,S.jsx)(eU.sN,{children:function(e){var n=e.focus;return(0,S.jsxs)("button",{onClick:function(){t()},className:"jsx-2562846439 "+(c6("cursor-default group flex shrink-0 whitespace-nowrap space-x-2 w-full items-center rounded-md px-2 py-2 text-sm",n?"bg-blue-600 text-white":"text-gray-900")||""),children:[(0,S.jsx)(oB.Oqo,{className:"w-4 h-4"}),(0,S.jsx)("span",{className:"jsx-2562846439",children:(0,S.jsx)(A.cC,{id:"/DMBqC"})})]})}}),eh?(0,S.jsx)(eU.sN,{children:function(e){var t=e.focus;return(0,S.jsxs)("button",{onClick:function(){u(eF),tu()},className:"jsx-2562846439 "+(c6("cursor-default group flex shrink-0 whitespace-nowrap space-x-2 w-full items-center rounded-md px-2 py-2 text-sm",t?"bg-blue-600 text-white":"text-gray-900")||""),children:[(0,S.jsx)(oB.z2M,{className:"w-4 h-4"}),(0,S.jsx)("span",{className:"jsx-2562846439",children:(0,S.jsx)(A.cC,{id:"5JOLV9"})})]})}}):(0,S.jsx)(eU.sN,{children:function(e){var t=e.focus;return(0,S.jsxs)("button",{onClick:function(){c(eF),tu()},className:"jsx-2562846439 "+(c6("cursor-default group flex shrink-0 whitespace-nowrap space-x-2 w-full items-center rounded-md px-2 py-2 text-sm",t?"bg-blue-600 text-white":"text-gray-900")||""),children:[(0,S.jsx)(C.ALl,{className:"w-4 h-4"}),(0,S.jsx)("span",{className:"jsx-2562846439",children:(0,S.jsx)(A.cC,{id:"B495Gs"})})]})}}),(0,S.jsx)(eU.sN,{children:function(e){var t=e.focus;return(0,S.jsxs)("button",{onClick:function(){B(eF)},className:"jsx-2562846439 "+(c6("cursor-default group flex shrink-0 whitespace-nowrap space-x-2 w-full items-center rounded-md px-2 py-2 text-sm",t?"bg-blue-600 text-white":"text-gray-900")||""),children:[(0,S.jsx)(C.u$v,{className:"w-4 h-4"}),(0,S.jsx)("span",{className:"jsx-2562846439",children:(0,S.jsx)(A.cC,{id:"GS+Mus"})})]})}}),(0,S.jsx)(eU.sN,{children:function(e){var t=e.focus;return(0,S.jsxs)("button",{onClickCapture:function(e){tt?(m(eF),tu()):(e.stopPropagation(),tn(!0))},className:"jsx-2562846439 "+(c6("group flex shrink-0 whitespace-nowrap space-x-2 w-full items-center rounded-md px-2 py-2 text-sm",t?"bg-blue-600 text-white":"text-red-500",tt&&"!bg-red-500 text-white")||""),children:[(0,S.jsx)(Y.YK6,{className:"w-4 h-4"}),(0,S.jsx)("span",{className:"jsx-2562846439",children:tt?(0,S.jsx)(A.cC,{id:"Aqw8Kb"}):(0,S.jsx)(A.cC,{id:"cnGeoo"})})]})}})]})})})]})}}),(0,S.jsx)("div",{className:"jsx-2562846439 w-[88px] shrink-0 flex"})]}),(0,S.jsx)("hr",{className:"jsx-2562846439 border border-white/20 mt-2"})]}),e5&&e1&&!e$.licensePayload?(0,S.jsxs)("div",{className:"jsx-2562846439 bg-red-500 dark:bg-red-900/50 rounded-md p-2 text-white font-semibold text-xs",children:[(0,S.jsx)(A.cC,{id:"wgJrZU"})," ",(0,S.jsx)("button",{onClick:function(){return document.getElementById("nav-buy-button").click()},className:"jsx-2562846439 underline",children:(0,S.jsx)(A.cC,{id:"oqsSYB"})})]}):null]})}),(0,S.jsx)("div",{"data-element-id":"sidebar-middle-part",className:"jsx-2562846439 "+(c6(i?"opacity-100":"opacity-0","overflow-y-auto overflow-x-hidden grow transition-opacity")||""),children:(0,S.jsxs)(cv.fC,{className:"w-full h-full overflow-hidden relative",children:[(0,S.jsx)(cv.l_,{className:"w-full h-full relative",children:(0,S.jsxs)("div",{className:"jsx-2562846439 max-w-[calc(100vw)] md:max-w-[calc(var(--sidebar-width)-var(--workspace-width))]",children:[eN.length&&!J||eh?(0,S.jsx)("button",{onClick:function(){return eg(!eh)},className:"jsx-2562846439 cursor-default px-2 py-1 bg-black/20 text-white/50 text-xs text-center mb-2 font-semibold w-full hover:bg-black/30 transition-colors hover:text-white flex items-center justify-center gap-1",children:eh?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(C.bUI,{className:"inline-block w-3 h-3"}),(0,S.jsx)("span",{className:"jsx-2562846439",children:(0,S.jsx)(A.cC,{id:"qn5Xo4"})})]}):(0,S.jsx)("span",{className:"jsx-2562846439",children:(0,S.jsx)(A.cC,{id:"6KMTVy",values:{0:eN.length}})})}):null,0===tg.length&&0===(0,O.Jq)(ea).length?J?(0,S.jsxs)("div",{className:"jsx-2562846439 text-gray-500 text-center my-2",children:[(0,S.jsx)("p",{className:"jsx-2562846439 text-sm",children:(0,S.jsx)(A.cC,{id:"Ev2r9A"})}),(0,S.jsx)("p",{className:"jsx-2562846439 text-xs",children:(0,S.jsx)(A.cC,{id:"tSEkZI",values:{searchKeyword:J}})})]}):(0,S.jsx)("div",{className:"jsx-2562846439 flex flex-col items-center justify-center p-4 border border-dashed border-2 border-gray-500 rounded-lg mx-2 my-2",children:(0,S.jsxs)("div",{className:"jsx-2562846439 text-gray-500 text-center",children:[(0,S.jsx)("p",{className:"jsx-2562846439 text-sm",children:(0,S.jsx)(A.cC,{id:"CP6gDt"})}),(0,S.jsx)("p",{className:"jsx-2562846439 text-xs",children:(0,S.jsx)(A.cC,{id:"zOYG6Z"})})]})}):null,(0,S.jsxs)(cB,{chats:ek,moveChatsToFolder:a,children:[(0,S.jsx)(a8.Fo,{items:(0,O.Jq)(ea),strategy:a8.qw,children:(0,O.Jq)(ea).map(function(e){var t=tx[e.id]||[],n=t.map(function(e){return e.id});return(J||eT.length)&&!t.length?null:(0,S.jsx)(is,{id:e.id,data:{type:"SORTABLE_FOLDER",numberOfChats:t.length},customHandlePosition:!0,children:function(s){var r=s.listeners,i=s.attributes;return(0,S.jsx)(cL,{id:e.id,children:(0,S.jsx)(cP,{folder:e,onEdit:tc,onDelete:function(t){return td(e.id,t)},shouldOpen:!!J||(null==n?void 0:n.includes(o)),numberOfChats:t.length,dragHandle:{listeners:r,attributes:i},onAddNewChat:function(){return tp(e.id)},children:t.map(function(t){return(0,S.jsx)(cZ,{id:t.id,data:{container:e.id},customHandlePosition:!0,children:function(e){var n,s,r=e.listeners,i=e.attributes;return(0,S.jsx)(cG,{minHeight:ew?36:56,children:(0,S.jsx)(cS,{chat:t,moveChatsToFolder:a,thin:ew,onToggleFavorite:k,highlightedTitle:null===(n=tf[t.id])||void 0===n?void 0:n.title,highlightedPreview:null===(s=tf[t.id])||void 0===s?void 0:s.preview,onSelect:function(e){return g(e,{search:J})},selected:t.id===o,onDelete:function(e){return m([e])},onArchive:l,onUnarchive:d,onEditName:p,onUpdateTags:M,dragHandle:{listeners:r,attributes:i},loading:P[t.id],checked:null==eF?void 0:eF.includes(t.id),onCheck:eZ?function(e){tm(t.id,e)}:void 0,overrideBotAvatarURL:w&&w.useLogoAsChatAvatar?w.botAvatarURL:void 0,fallbackAvatarURL:w.botAvatarURL,onSelectTag:function(e){return eM([e])},onExport:function(e){return B([e])}})})}},t.id)})})})}},e.id)})}),(0,S.jsx)(cL,{id:"ROOT",className:"flex-1 pb-8",children:null===(n=tx.ROOT)||void 0===n?void 0:n.map(function(e){return(0,S.jsx)(cZ,{id:e.id,data:{container:"ROOT"},customHandlePosition:!0,children:function(t){var n,s,r=t.listeners,i=t.attributes;return(0,S.jsx)(cG,{minHeight:ew?36:56,children:(0,S.jsx)(cS,{chat:e,moveChatsToFolder:a,thin:ew,onToggleFavorite:k,highlightedTitle:null===(n=tf[e.id])||void 0===n?void 0:n.title,highlightedPreview:null===(s=tf[e.id])||void 0===s?void 0:s.preview,onSelect:function(e){return g(e,{search:J})},selected:e.id===o,onDelete:function(e){return m([e])},onArchive:l,onUnarchive:d,onEditName:p,onUpdateTags:M,dragHandle:{listeners:r,attributes:i},loading:P[e.id],checked:null==eF?void 0:eF.includes(e.id),onCheck:eZ?function(t){tm(e.id,t)}:void 0,overrideBotAvatarURL:w&&w.useLogoAsChatAvatar?w.botAvatarURL:void 0,fallbackAvatarURL:w.botAvatarURL,onSelectTag:function(e){return eM([e])},onExport:function(e){return B([e])}})})}},e.id)})})]})]})}),(0,S.jsx)(cv.LW,{className:"flex select-none touch-none p-0.5 bg-white/20 transition-colors duration-[160ms] ease-out hover:bg-white/30 data-[orientation=vertical]:w-2.5 data-[orientation=horizontal]:flex-col data-[orientation=horizontal]:h-2.5",orientation:"vertical",children:(0,S.jsx)(cv.bU,{className:"flex-1 bg-white/50 rounded-[10px] relative before:content-[''] before:absolute before:top-1/2 before:left-1/2 before:-translate-x-1/2 before:-translate-y-1/2 before:w-full before:h-full before:min-w-[20px] before:min-h-[44px] z-10"})})]})}),(0,S.jsxs)("div",{className:"jsx-2562846439 flex-shrink-0",children:[w.managed?null:(0,S.jsx)(cx,{setOpenAPIKeysPopup:R,setOpenCloudLoginPopup:Z,setOpenBuy:G,licenseVerified:K}),(0,S.jsx)(cy,{currentVersion:null==w?void 0:w.vercelGitSHA}),(0,S.jsx)(cb,{decryptedApiKey:N,decryptedAnthropicApiKey:I,decryptedGeminiApiKey:E,setOpenDecrypt:L})]})]})}),(0,S.jsx)(cd(),{id:"2562846439",children:["#navbar.jsx-2562846439{color-scheme:dark;}"]})]})}function c8(e){var t=e.allowCloudSubscription,n=e.lockSyncStatus,s=e.open,r=e.setOpen,a=e.licensePayload,i=e.onOpenCloudFilesPopup,o=e.onOpenManageSharedLinks;return(0,S.jsx)(X,{wide:!0,open:s,setOpen:r,showCloseButton:!1,delayMount:!0,children:(0,S.jsx)("div",{className:"space-y-4",children:(0,S.jsx)(e1,{licensePayload:a,allowCloudSubscription:t,lockSyncStatus:n,onOpenCloudFilesPopup:i,onOpenManageSharedLinks:o})})})}var c9=(0,K.eK)("useExampleFilled");function de(e){var t=e.onLoaded,n=c9(!1),s=(0,y.Z)(n,2),r=s[0],a=s[1],i=_(),o=(i.serverHostConfig||{}).exampleChats,l=i.serverHostConfig.chatFeatures;return(0,q.useEffect)(function(){(0,O.N7)("addExampleChats",l)&&setTimeout((0,x.Z)(j().mark(function e(){var n,s;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!r){e.next=3;break}return e.abrupt("return");case 3:if(!(JSON.parse((0,K.cF)().getItem("TM_useChatList")||"[]").length>0)){e.next=6;break}return e.abrupt("return");case 6:return n=null!=o&&o.length?o:cF.f,e.next=9,(0,K.CQ)().setMany(n.map(function(e){return["CHAT_"+e.chatID,e]}));case 9:s=(0,O.FW)(n),(0,K.cF)().setItem("TM_useChatList",JSON.stringify(s)),a(!0),t&&t(),e.next=18;break;case 15:e.prev=15,e.t0=e.catch(0),console.error(e.t0);case 18:case"end":return e.stop()}},e,null,[[0,15]])})),0)},[]),null}var dt=(0,K.eK)("useDismissMacWarning");function dn(){var e=dt(!1),t=(0,y.Z)(e,2),n=t[0],s=t[1],r=(0,q.useState)(!1),a=r[0],i=r[1];return(0,q.useEffect)(function(){!n&&window.navigator.userAgent.includes("TypingMindMac")&&i(!0)},[]),(0,S.jsxs)(X,{open:a,setOpen:i,showCloseButton:!1,children:[(0,S.jsx)("h2",{className:"text-center text-xl font-bold flex items-center justify-center space-x-2",children:(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"VHZsGc"})})}),(0,S.jsx)("div",{className:"my-2 text-center text-xs",children:(0,S.jsx)(A.cC,{id:"0x5QFE"})}),(0,S.jsx)("ul",{className:"my-4 pl-4 list-disc",children:(0,S.jsx)("li",{children:(0,S.jsx)(A.cC,{id:"/dqlKh"})})}),(0,S.jsxs)("div",{className:"my-2 text-center gap-2 flex items-center justify-center",children:[(0,S.jsx)("button",{onClick:function(){return i(!1)},className:"inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 space-x-1 disabled:bg-gray-500",children:(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"FPsvA8"})})}),(0,S.jsx)("button",{onClick:function(){s(!0),i(!1)},className:"inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-gray-600 hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500 space-x-1 disabled:bg-gray-500",children:(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"VbN7mk"})})})]})]})}function ds(e){var t,n=e.open,s=e.setOpen,r=e.setOpenLicenseKey;e.setOpenBuy;var a=(0,q.useState)(5),i=a[0],o=a[1];(0,q.useEffect)(function(){n&&l()},[n]);var l=(t=(0,x.Z)(j().mark(function e(){var t;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=10;case 1:if(!(t>=0)){e.next=8;break}return o(t),e.next=5,new Promise(function(e){return setTimeout(e,1e3)});case 5:t--,e.next=1;break;case 8:case"end":return e.stop()}},e)})),function(){return t.apply(this,arguments)});return(0,S.jsxs)(X,{wide2:!0,open:n,setOpen:function(e){0===i&&s(e)},showCloseButton:!1,children:[(0,S.jsxs)("div",{className:"mb-4 p-4 border-4 border-red-500 shadow rounded-xl",children:[(0,S.jsx)("h2",{className:" text-xl font-bold",children:"Thank you for using TypingMind"}),(0,S.jsx)("p",{className:" my-2",children:(0,S.jsx)(A.cC,{id:"Ny0rdk",components:{0:(0,S.jsx)("span",{className:"text-red-500"}),1:(0,S.jsx)("b",{})}})}),(0,S.jsx)("p",{className:"my-4 text-sm ",children:(0,S.jsx)("b",{children:(0,S.jsx)(A.cC,{id:"iUALO0",components:{0:(0,S.jsx)("span",{className:"text-red-500"})}})})}),(0,S.jsx)("div",{className:"mt-4 flex items-center justify-center space-x-2",children:(0,S.jsx)("button",{onClick:function(){s(!1)},disabled:i>0,className:"inline-flex items-center px-4 py-2 text-sm font-medium rounded-md text-gray-800 dark:text-zinc-100 dark:disabled:text-zinc-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 space-x-1 disabled:text-gray-400 border shadow border-gray-200 dark:border-gray-700",children:(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"aMPH6M",values:{0:i>0?" (".concat(i,")"):""}})})})})]}),(0,S.jsx)(l5,{onChangeLicenseKey:function(){setTimeout(function(){r(!0)},500)}})]})}function dr(e){var t=e.open,n=e.licensePayload,s=e.setOpen,r=e.setOpenLicenseKey,a=e.showAlreadyHasLicense;return(0,S.jsx)(X,{wide2:!0,open:t,setOpen:s,showCloseButton:!1,children:(0,S.jsx)(l5,{showAlreadyHasLicense:a,licensePayload:n,onChangeLicenseKey:function(){s(!1),setTimeout(function(){r(!0)},500)}})})}function da(e){var t,n=e.verifyLicenseKey,s=e.licenseVerified,r=e.onActivated,a=(0,q.useState)(!1),i=a[0],o=a[1],l=(0,q.useState)(!1),c=l[0],d=l[1],u=(0,q.useState)(""),m=u[0],p=u[1],h=(0,q.useState)(!1),g=h[0],f=h[1],b=(0,q.useState)(""),v=b[0],y=b[1],w=(0,q.useState)(""),k=w[0],N=w[1];(0,q.useEffect)(function(){var e=new URLSearchParams(window.location.search);(e.get("thankyou")||"#thankyou"===window.location.hash)&&(o(!0),setTimeout(function(){d(!0)},800)),e.get("key")&&N(e.get("key"))},[]);var C=function(){o(!1),window.location.hash.startsWith("#chat=")||(window.location.hash="")};(0,q.useEffect)(function(){!0===s&&C()},[s]);var I=(t=(0,x.Z)(j().mark(function e(){var t;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return f(!0),e.next=3,n(m);case 3:t=e.sent,f(!1),t?(C(),window.history.replaceState({},document.title,window.location.pathname),null==r||r()):y(T.ag._({id:"lYgpBY"}));case 6:case"end":return e.stop()}},e)})),function(){return t.apply(this,arguments)});return(0,S.jsxs)(X,{wide:!0,open:i,setOpen:function(){},showCloseButton:!1,children:[(0,S.jsx)("h2",{className:"text-center text-xl font-bold",children:(0,S.jsx)(A.cC,{id:"h3QnPS"})}),k?(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"my-2",children:(0,S.jsx)(A.cC,{id:"WW8EoW",components:{0:(0,S.jsx)("b",{})}})}),(0,S.jsx)("div",{className:"text-center text-lg font-bold bg-gray-100 p-2 rounded-md",onClick:function(){return navigator.clipboard.writeText(k)},children:k}),(0,S.jsx)("div",{className:"my-2",children:(0,S.jsx)(A.cC,{id:"TVbBhK",components:{0:(0,S.jsx)("b",{className:"text-red-500"}),1:(0,S.jsx)("b",{})}})})]}):null,(0,S.jsxs)("div",{className:"my-4",children:[(0,S.jsx)("div",{className:"font-semibold text-red-500 mb-1",children:(0,S.jsx)(A.cC,{id:"krqIN6"})}),(0,S.jsx)("input",{type:"text",disabled:g,placeholder:T.ag._({id:"j/jUA8"}),className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm dark:bg-zinc-700",value:m,onChange:function(e){return p(e.target.value)},onKeyDown:function(e){"Enter"===e.key&&(e.preventDefault(),I())}})]}),v?(0,S.jsx)("div",{className:"text-sm text-center text-red-500",children:v}):null,(0,S.jsx)("div",{className:"my-2 text-center",children:(0,S.jsxs)("button",{onClick:I,className:"inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 space-x-1 disabled:bg-gray-400",disabled:g,children:[(0,S.jsx)(Y.bzc,{className:"w-4 h-4"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"FQBaXG"})})]})}),(0,S.jsxs)("details",{className:"my-4",children:[(0,S.jsx)("summary",{className:" text-center",children:(0,S.jsx)("h2",{className:"text-center text-xl font-bold cursor-pointer hover:underline inline text-red-500",children:(0,S.jsx)(A.cC,{id:"bGwrZ2"})})}),(0,S.jsx)("div",{className:"my-4",children:(0,S.jsx)(A.cC,{id:"ZdIhm8",components:{0:(0,S.jsx)("b",{}),1:(0,S.jsx)("b",{})}})}),(0,S.jsx)("div",{className:"my-4",children:(0,S.jsx)(A.cC,{id:"vmyQ2D",components:{0:(0,S.jsx)("b",{}),1:(0,S.jsx)("b",{}),2:(0,S.jsx)("b",{}),3:(0,S.jsx)("b",{})}})}),(0,S.jsx)("div",{className:"my-4 text-center",children:(0,S.jsx)("a",{className:"text-blue-500 font-semibold hover:underline",href:"mailto:hello@lemonsqueezy.com?cc=support@typingmind.com&subject=Receipt%20and%20License%20Key%20not%20received&body=Hi%20Lemon%20Squeezy%20and%20TypingMind%2C%0D%0A%0D%0AI%20purchased%20a%20license%20key%20from%20TypingMind.com%20via%20Lemon%20Squeezy%20but%20still%20have%20not%20received%20a%20license%20key%20and%20a%20receipt.%0D%0A%0D%0AMy%20transaction%20ID%20is%3A%20%7B%7Byour%20transaction%20ID%20here%7D%7D%0D%0A%0D%0APlease%20help%20check%20this.%0D%0A%0D%0AThanks",children:(0,S.jsx)(A.cC,{id:"pM19tB"})})}),(0,S.jsx)("div",{className:"my-4",children:(0,S.jsx)(A.cC,{id:"bSSnpo"})})]}),(0,S.jsx)("div",{className:"my-2 text-center",children:(0,S.jsx)("button",{onClick:function(){return C()},className:"text-blue-500 hover:underline disabled:text-gray-400",disabled:g,children:(0,S.jsx)(A.cC,{id:"OcU847"})})}),c&&(0,S.jsx)("div",{className:"flex items-center justify-center",children:(0,S.jsx)(lL.Z,{})})]})}(0,K.eK)("useLicenseKey");var di=n(46977),dl=(0,K.eK)("useKeyboardShortcuts");function dc(){for(var e=arguments.length,t=Array(e),n=0;nMath.abs(s))&&s>40&&((null===(t=window.getSelection())||void 0===t||null===(n=t.toString)||void 0===n?void 0:n.call(t))===""&&l(!0),g(null))}},onTouchStart:function(e){e.touches[0].clientX>50||g(e.touches[0])},onTouchEnd:function(){g(null)},children:a({sidebarOpen:o,setSidebarOpen:l})})]}):a({desktopSidebarOpen:!1,sidebarOpen:!1,setSidebarOpen:function(){}})}var du=n(55162),dm=n(6739),dp=n(33281),dh="CLIENT_CACHE_",dg=(l=(0,x.Z)(j().mark(function e(t){var n,s;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,dp.CQ)().get(dh+t);case 2:if(n=e.sent){e.next=5;break}return e.abrupt("return",null);case 5:if(s=n.expireAt,n.value,!(!s||s1e3)){e.next=5;break}throw Error("cacheKey cannot be longer than 1000 characters");case 5:return e.next=7,dg(n);case 7:if(!(i=e.sent)){e.next=10;break}return e.abrupt("return",i.value);case 10:return e.next=12,a();case 12:return o=e.sent,e.next=15,df({cacheKey:n,cacheGroup:s,expireInSeconds:r,value:o});case 15:return e.abrupt("return",o);case 16:case"end":return e.stop()}},e)}))).apply(this,arguments)}function dv(){for(var e=arguments.length,t=Array(e),n=0;n0&&void 0!==arguments[0]?arguments[0]:{},n=e.reset;i(""),t&&t({reset:n})}return(0,q.useEffect)(function(){var e;null===(e=u.current)||void 0===e||e.focus()},[]),(0,S.jsx)(nI.hQ,{onChange:function(e){e&&(w(),n(e,a),b(e),i(""))},children:function(e){return e.activeOption,(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"relative px-4 pt-4",children:(0,S.jsx)(nI.gA,{className:"w-full border border-gray-300 dark:border-gray-700 rounded-lg px-4 py-2 focus:outline-none focus:border-blue-500 dark:focus:border-blue-500 dark:bg-zinc-800",type:"search",onChange:function(e){i(e.target.value)},placeholder:T.ag._({id:"4IdIIf"}),onKeyDownCapture:function(e){"Escape"===e.key&&w(),"Backspace"===e.key&&0===a.length&&w({reset:!0})},ref:u})}),(0,S.jsx)("div",{className:"h-48 my-4 px-4 overflow-auto",children:(0,S.jsx)(nI.L5,{as:"div",static:!0,className:"w-full py-1 text-base focus:outline-none sm:text-sm",children:(0,S.jsxs)("div",{className:"space-y-2",children:[x.characters.map(function(e){return(0,S.jsx)(nI.O2,{as:"div",className:function(e){return dA("cursor-default select-none p-2 border border-gray-200 dark:border-gray-600 rounded-lg",e.focus&&"!bg-blue-600")},value:e,children:function(t){var n=t.focus;return(0,S.jsxs)("div",{className:"flex items-center justify-start text-left gap-2",children:[(0,S.jsx)(sB,{size:"small",character:e}),(0,S.jsx)("div",{className:dA(" flex-shrink-0 text-black dark:text-white font-medium truncate w-fit",n&&"!text-white"),children:e.title}),(0,S.jsx)("div",{className:dA("text-xs text-gray-500 dark:text-gray-400 font-normal truncate w-full",n&&"!text-gray-300"),children:e.description})]})}},e.id)}),0===f.length?(0,S.jsx)("div",{className:"text-center text-gray-500 dark:text-gray-400",children:(0,S.jsx)(A.cC,{id:"2Pl7Xj"})}):null,x.hiddenCount>0?(0,S.jsx)("div",{className:"text-center text-gray-500 dark:text-gray-400",children:T.ag._({id:"yN4Oln",values:{0:x.hiddenCount}})}):null]})})})]})}})}function dN(e){var t=e.character,n=e.characterPlugins,s=void 0===n?[]:n,r=e.checkPluginsAvailable,a=void 0===r||r,i=e.showResetButtons,o=e.onReset,l=e.onChange,c=e.allowChange,d=e.showPlugins,u=void 0===d||d;return(0,S.jsx)("div",{"data-element-id":"current-character",className:"p-4 flex items-center justify-center mb-8 max-w-md mx-auto",children:(0,S.jsxs)("div",{className:"flex items-center justify-center gap-4 flex-col",children:[(0,S.jsx)(sB,{character:t,size:"big"}),(0,S.jsxs)("div",{className:"text-center",children:[(0,S.jsxs)("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:[(0,S.jsx)("div",{className:"text-xl font-semibold",children:t.title})," ",t.isEnforceSpeechSettings?(0,S.jsx)("div",{"data-tooltip-id":"global","data-tooltip-content":T.ag._({id:"k5Es8x"}),className:(0,O.AK)("text-gray-500"),children:(0,S.jsx)(lh.MVT,{className:"w-4 h-4"})}):null,u&&t.isEnforceAssignedPlugins?(0,S.jsx)("div",{"data-tooltip-id":"global","data-tooltip-content":T.ag._({id:"t77h0I"}),className:(0,O.AK)("text-gray-500"),children:(0,S.jsx)(lh.bTI,{className:"w-4 h-4"})}):null]}),i?(0,S.jsxs)("div",{className:"text-sm",children:[(0,S.jsx)("button",{"data-element-id":"reset-character-button",onClick:o,className:"text-blue-500 hover:underline font-semibold",children:(0,S.jsx)(A.cC,{id:"OfhWJH"})}),c?(0,S.jsxs)(S.Fragment,{children:[" \xb7 ",(0,S.jsx)("button",{onClick:l,className:"text-blue-500 hover:underline font-semibold","data-element-id":"change-character-button",children:(0,S.jsx)(A.cC,{id:"o+XJ9D"})})]}):null]}):null,u&&t.isEnforceAssignedPlugins?(0,S.jsx)("div",{className:"text-xs font-semibold my-2 flex items-center justify-center gap-2 flex-wrap",children:Object.values(t.assignedPlugins).filter(Boolean).filter(function(e){return e.id}).sort(function(e,t){return e.id.localeCompare(t.id)}).map(function(e){var t=!1===a||s.find(function(t){return t.id===e.id});return(0,S.jsxs)("div",{className:(0,O.AK)("px-2 py-1 rounded bg-gray-200 dark:bg-zinc-700 inline-flex items-center justify-center gap-1",t?"text-gray-700 dark:text-gray-300 ":"text-red-500 dark:text-red-400"),"data-tooltip-id":"character-plugin-not-available-"+e.id,children:[t?(0,S.jsx)("span",{className:"w-4 h-4 flex items-center justify-center",children:(0,S.jsx)(s2,{plugin:e})}):(0,S.jsx)(Y.CSE,{className:"w-4 h-4"}),(0,S.jsx)("span",{children:e.title}),t?null:(0,S.jsx)(sL.u,{id:"character-plugin-not-available-"+e.id,place:"top",children:(0,S.jsx)(A.cC,{id:"4AaI7a"})})]},e.id)})}):null,t.description?(0,S.jsx)("div",{"data-element-id":"current-character-description",className:"text-xs text-gray-500 dark:text-gray-400 whitespace-pre-line mt-2",children:t.description}):null]})]})})}function dC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,s)}return n}function dq(e){for(var t=1;t=400)){e.next=17;break}return e.next=13,s.json();case 13:return b(e.sent.userMessage||dI),u(!1),e.abrupt("return");case 17:if(s.ok){e.next=21;break}return b(dI),u(!1),e.abrupt("return");case 21:return e.next=23,s.json();case 23:h(e.sent),e.next=31;break;case 27:e.prev=27,e.t0=e.catch(6),b(dI),console.error(e.t0);case 31:u(!1);case 32:case"end":return e.stop()}},e,null,[[6,27]])})),function(e){return t.apply(this,arguments)});return(0,S.jsx)(X,{wide:!0,showCloseButton:!1,open:s,setOpen:function(e){r(e),e||k()},children:(0,S.jsxs)("div",{className:"p-4",children:[d?(0,S.jsxs)("h2",{className:"text-lg text-center my-10 flex items-center justify-center gap-2",children:[(0,S.jsx)(E,{}),(0,S.jsx)("span",{children:"Loading AI agent..."})]}):null,f?(0,S.jsx)("h2",{className:"text-lg text-red-500 text-center my-10",children:f}):null,p?(0,S.jsxs)("div",{className:"text-lg text-center",children:[(0,S.jsx)(dN,{character:null==p?void 0:p.data,showResetButtons:!1,allowChange:!1,checkPluginsAvailable:!1}),(0,S.jsx)("div",{className:"my-4 text-sm text-center",children:(0,S.jsx)("a",{className:"text-blue-500 hover:underline",href:(0,O.PO)(null===(n=A.serverHostConfig)||void 0===n?void 0:n.orgURL)+"/characters/".concat(null==p?void 0:p.id),target:"_blank",children:"View Details"})}),(0,S.jsxs)("div",{className:"text-center flex items-center justify-center flex-wrap gap-2",children:[(0,S.jsx)("button",{onClick:function(){a(dq(dq({},p.data),{},{lastUsedAt:new Date})),r(!1),k()},className:"inline-flex items-center px-4 py-2 border border-transparent text-base font-medium rounded-md shadow-sm text-white bg-green-600 hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 disabled:bg-gray-400 gap-2",disabled:d,children:"→ Use AI agent"}),(0,S.jsxs)("button",{onClick:function(){return N()},className:"inline-flex items-center px-4 py-2 border border-transparent text-base font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 gap-2",disabled:d,children:[(0,S.jsx)(C.TvB,{className:"w-4 h-4"}),(0,S.jsx)("span",{children:"Save for later"})]})]})]}):null]})})}function dE(e){var t=e.className,n=e.style,s=e.enter,r=e.enterFrom,a=e.enterTo,i=e.leave,o=e.leaveFrom,l=e.leaveTo,c=e.children,d=(0,q.useState)(!1),u=d[0],m=d[1];return(0,q.useEffect)(function(){m(!0)},[]),(0,S.jsx)(U.u,{as:"div",className:t,style:n,appear:!0,show:u,enter:s,enterFrom:r,enterTo:a,leave:i,leaveFrom:o,leaveTo:l,children:c})}function dO(){var e=(0,q.useState)("..."),t=e[0],n=e[1];return(0,q.useEffect)(function(){var e=setInterval(function(){3===t.length?n(""):n(t+".")},200);return function(){return clearInterval(e)}},[t]),(0,S.jsx)("span",{children:t})}function dV(){return(0,S.jsx)("svg",{className:"w-5 h-5 animate-spin",fill:"currentColor",version:"1.1",id:"Capa_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"800px",height:"800px",viewBox:"0 0 45.973 45.973",xmlSpace:"preserve",children:(0,S.jsx)("g",{children:(0,S.jsx)("g",{children:(0,S.jsx)("path",{d:"M43.454,18.443h-2.437c-0.453-1.766-1.16-3.42-2.082-4.933l1.752-1.756c0.473-0.473,0.733-1.104,0.733-1.774 c0-0.669-0.262-1.301-0.733-1.773l-2.92-2.917c-0.947-0.948-2.602-0.947-3.545-0.001l-1.826,1.815 C30.9,6.232,29.296,5.56,27.529,5.128V2.52c0-1.383-1.105-2.52-2.488-2.52h-4.128c-1.383,0-2.471,1.137-2.471,2.52v2.607 c-1.766,0.431-3.38,1.104-4.878,1.977l-1.825-1.815c-0.946-0.948-2.602-0.947-3.551-0.001L5.27,8.205 C4.802,8.672,4.535,9.318,4.535,9.978c0,0.669,0.259,1.299,0.733,1.772l1.752,1.76c-0.921,1.513-1.629,3.167-2.081,4.933H2.501 C1.117,18.443,0,19.555,0,20.935v4.125c0,1.384,1.117,2.471,2.501,2.471h2.438c0.452,1.766,1.159,3.43,2.079,4.943l-1.752,1.763 c-0.474,0.473-0.734,1.106-0.734,1.776s0.261,1.303,0.734,1.776l2.92,2.919c0.474,0.473,1.103,0.733,1.772,0.733 s1.299-0.261,1.773-0.733l1.833-1.816c1.498,0.873,3.112,1.545,4.878,1.978v2.604c0,1.383,1.088,2.498,2.471,2.498h4.128 c1.383,0,2.488-1.115,2.488-2.498v-2.605c1.767-0.432,3.371-1.104,4.869-1.977l1.817,1.812c0.474,0.475,1.104,0.735,1.775,0.735 c0.67,0,1.301-0.261,1.774-0.733l2.92-2.917c0.473-0.472,0.732-1.103,0.734-1.772c0-0.67-0.262-1.299-0.734-1.773l-1.75-1.77 c0.92-1.514,1.627-3.179,2.08-4.943h2.438c1.383,0,2.52-1.087,2.52-2.471v-4.125C45.973,19.555,44.837,18.443,43.454,18.443z M22.976,30.85c-4.378,0-7.928-3.517-7.928-7.852c0-4.338,3.55-7.85,7.928-7.85c4.379,0,7.931,3.512,7.931,7.85 C30.906,27.334,27.355,30.85,22.976,30.85z"})})})})}function dP(){return(0,S.jsxs)("svg",{className:"h-5 w-5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[(0,S.jsx)("rect",{className:"opacity-animation",x:"6",y:"2",rx:"2",ry:"2",width:"12",height:"20",fill:"currentColor"}),(0,S.jsx)("style",{children:"\n @keyframes blink {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0; }\n }\n .opacity-animation {\n animation: blink 1s linear infinite;\n }\n "})]})}function dT(e){var t=e.loading,n=e.pluginRunning,s=e.isAssistantTyping,r=e.assistantTitle,a=(0,q.useState)(!1),i=a[0],o=a[1];return((0,q.useEffect)(function(){o(!0)},[]),t)?(0,S.jsx)(U.u,{as:q.Fragment,appear:!0,show:i,className:s?"":"transition delay-500",enter:"ease-out duration-300",enterFrom:"opacity-0 translate-y-4",enterTo:"opacity-100 translate-y-0",leave:"ease-in duration-200",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 translate-y-4",children:(0,S.jsx)("div",{children:n?(0,S.jsx)("div",{className:"rounded-lg mb-2 p-4",children:(0,S.jsxs)("div",{className:"text-sm text-gray-500 flex items-center space-x-2",children:[(0,S.jsx)(dV,{}),(0,S.jsxs)("div",{children:[(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"0dl2VR"})}),(0,S.jsx)(dO,{})]})]})}):(0,S.jsx)("div",{className:"rounded-lg mb-2 p-4",children:(0,S.jsxs)("div",{className:"text-sm text-gray-500 flex items-center space-x-2",children:[s?(0,S.jsx)(dP,{}):(0,S.jsx)(E,{}),(0,S.jsxs)("div",{children:[(0,S.jsx)("span",{children:r||"Assistant"})," ",s?(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"IWs4FI"})}):(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"xkuRyy"})}),(0,S.jsx)(dO,{})]})]})})})}):null}var dM=n(20110);function dD(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,s)}return n}function dB(e){for(var t=1;t0)){e.next=28;break}return e.abrupt("return",{state:"success",content:a.trim()});case 28:return e.abrupt("return",{state:"error",content:a.trim()});case 29:e.next=35;break;case 31:return e.prev=31,e.t0=e.catch(0),console.error("Error while parsing PDF to text: ",e.t0),e.abrupt("return",{state:"error",content:""});case 35:case"end":return e.stop()}},e,null,[[0,31]])}))).apply(this,arguments)}var dY=n(84105),dU=(d=(0,x.Z)(j().mark(function e(t){var n,s,r,a,i,o,l,c,d,u,m;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("application/pdf"!==t.type){e.next=7;break}return e.next=3,function(e){return dF.apply(this,arguments)}(t);case 3:"success"===(i=e.sent).state?(n=i.content,r=!0):a="Could not read the PDF.",e.next=68;break;case 7:if("application/vnd.openxmlformats-officedocument.wordprocessingml.document"!==t.type){e.next=29;break}return e.prev=8,e.next=11,t.arrayBuffer();case 11:return o=e.sent,e.next=14,(0,dK.FU)({arrayBuffer:o});case 14:if(!(null!=(l=e.sent)&&l.value)){e.next=20;break}n=l.value,r=!0,e.next=21;break;case 20:throw Error();case 21:e.next=27;break;case 23:e.prev=23,e.t0=e.catch(8),console.error("Error on parsing .docx file",e.t0),a="Could not read the file.";case 27:e.next=68;break;case 29:if("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"!==t.type){e.next=46;break}return e.prev=30,e.next=33,t.arrayBuffer();case 33:c=e.sent,d=(0,dY.ij)(c),n="",d.SheetNames.forEach(function(e){var t=d.Sheets[e],s=dY.P6.sheet_to_txt(t);n+=s}),r=!0,e.next=44;break;case 40:e.prev=40,e.t1=e.catch(30),console.error("Error on parsing .xlsx file",e.t1),a="Could not read the file.";case 44:e.next=68;break;case 46:if(!["image/jpeg","image/png","image/gif","image/webp"].includes(t.type)){e.next=54;break}return e.next=49,(0,O.QF)(t);case 49:s={type:"image_url",image_url:{url:e.sent,detail:"high"}},r=!0,e.next=68;break;case 54:return(u=new FileReader).readAsText(t),e.prev=56,e.next=59,new Promise(function(e,t){u.onload=function(t){e(t.target.result)},u.onerror=function(e){t(e)}});case 59:n=e.sent,r=!0,e.next=68;break;case 64:e.prev=64,e.t2=e.catch(56),console.error("Error on parsing a file to text",e.t2),a="Could not read the file.";case 68:if(!r){e.next=74;break}if(!s){e.next=71;break}return e.abrupt("return",s);case 71:return e.abrupt("return",{type:"tm_text_file",text:n,metadata:{characters:null===(m=n)||void 0===m?void 0:m.length,estimatedTokens:(0,O.fI)(n),name:t.name}});case 74:throw Error(a);case 75:case"end":return e.stop()}},e,null,[[8,23],[30,40],[56,64]])})),function(e){return d.apply(this,arguments)}),dH=(u=(0,x.Z)(j().mark(function e(t){var n;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all(Array.from(t).map(function(){var e=(0,x.Z)(j().mark(function e(t){var n,s,r;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.name.slice(t.name.lastIndexOf(".")),s=t.type.toLowerCase(),e.t0=!O.V1.includes(n)&&!O.Yi.find(function(e){return null==s?void 0:s.startsWith(e.replace("*",""))}),!e.t0){e.next=7;break}return e.next=6,function(e){return new Promise(function(t){var n=new FileReader;n.onload=function(e){var n=e.target.result;try{new TextDecoder("utf-8",{fatal:!0}).decode(n),t(!0)}catch(e){console.error(e),t(!1)}},n.onerror=function(){t(!1)},n.readAsArrayBuffer(e)})}(t);case 6:e.t0=!e.sent;case 7:if(!e.t0){e.next=9;break}return e.abrupt("return",Error(t.name));case 9:return e.next=11,dU(t);case 11:return r=e.sent,e.abrupt("return",r);case 13:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 2:return n=e.sent,e.abrupt("return",n);case 4:case"end":return e.stop()}},e)})),function(e){return u.apply(this,arguments)});function dz(e){var t=e.chatData,n=(0,q.useState)(!1),s=n[0],r=n[1],a=function(){return JSON.stringify({messages:t.messages.map(function(e){return tY().pick(e,["role","content","function_call","name"])})})};return(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"text-center font-semibold my-5",children:(0,S.jsx)(A.cC,{id:"/hc/Aq"})}),(0,S.jsxs)("div",{className:"text-center space-x-2",children:[(0,S.jsx)("button",{onClick:function(){navigator.clipboard.writeText(a()),r(!0),setTimeout(function(){r(!1)},2e3)},className:"rounded-full bg-white py-1 px-2.5 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50",children:s?T.ag._({id:"PiH3UR"}):T.ag._({id:"EXTouI"})}),(0,S.jsx)("button",{onClick:function(){var e=window.document.createElement("a");e.setAttribute("href","data:application/json;charset=utf-8,"+encodeURIComponent(a())),e.setAttribute("download","messages-".concat(t.chatID,".json")),e.click()},className:"rounded-full bg-white py-1 px-2.5 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50",children:(0,S.jsx)(A.cC,{id:"egdeNe"})})]}),(0,S.jsx)(iS,{language:"json",children:a()})]})}var dW=n(97762);function dQ(e){var t=e.chatData,n=(0,q.useState)(!1),s=n[0],r=n[1],a=function(){return t.messages.filter(function(e){return"clear-context"!==e.type}).map(function(e){var t;return"".concat((t=e.role).charAt(0).toUpperCase()+t.slice(1),": ").concat("assistant"===e.role?(0,dW.uS)((0,S.jsx)(i6.D,{children:(0,O.FB)(e.content),remarkPlugins:[i3.Z]})):(0,O.FB)(e.content)||"","
")}).join("
")};return(0,S.jsxs)("div",{children:[(0,S.jsxs)("div",{className:"text-center font-semibold my-5",children:[(0,S.jsx)(A.cC,{id:"RFEi9f"}),":"]}),(0,S.jsxs)("div",{className:"text-center space-x-2",children:[(0,S.jsx)("button",{onClick:function(){navigator.clipboard.writeText(a()),r(!0),setTimeout(function(){r(!1)},2e3)},className:"rounded-full bg-white py-1 px-2.5 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50",children:s?T.ag._({id:"PiH3UR"}):T.ag._({id:"EXTouI"})}),(0,S.jsx)("button",{onClick:function(){var e=window.document.createElement("a");e.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(a())),e.setAttribute("download","chat-".concat(t.chatID,".html")),e.click()},className:"rounded-full bg-white py-1 px-2.5 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50",children:(0,S.jsx)(A.cC,{id:"7NkkFS"})})]}),(0,S.jsx)("pre",{className:"bg-gray-200 border border-gray-200 rounded-lg overflow-auto p-4 whitespace-pre-line my-4 dark:bg-zinc-800 dark:border-gray-700 max-h-[200px]",children:a()})]})}function dJ(e){var t=e.chatData,n=(0,q.useState)(!1),s=n[0],r=n[1],a=function(){return(0,O.FA)(t.messages)};return(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"text-center font-semibold my-5",children:(0,S.jsx)(A.cC,{id:"gmNQTg"})}),(0,S.jsxs)("div",{className:"text-center space-x-2",children:[(0,S.jsx)("button",{onClick:function(){navigator.clipboard.writeText(a()),r(!0),setTimeout(function(){r(!1)},2e3)},className:"rounded-full bg-white py-1 px-2.5 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50",children:s?T.ag._({id:"PiH3UR"}):T.ag._({id:"EXTouI"})}),(0,S.jsx)("button",{onClick:function(){var e=window.document.createElement("a");e.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(a())),e.setAttribute("download","chat-".concat(t.chatID,".md")),e.click()},className:"rounded-full bg-white py-1 px-2.5 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50",children:(0,S.jsx)(A.cC,{id:"zQtsZm"})})]}),(0,S.jsx)("pre",{className:"bg-gray-200 border border-gray-200 rounded-lg overflow-auto p-4 whitespace-pre-line my-4 dark:bg-zinc-800 dark:border-gray-700 max-h-[200px]",children:a()})]})}var dX="Something went wrong. Please try again.";function d$(e){var t,n,s,r=e.chatData,a=e.onOpenManageSharedLinks,i=e.showManageSharedLinks,o=(0,q.useState)(null),l=o[0],c=o[1],d=(0,q.useState)(!1),u=d[0],m=d[1],p=(0,q.useState)(!1),h=p[0],g=p[1],f=(0,q.useState)(!1),b=f[0],v=f[1],y=(0,q.useState)(null),w=y[0],k=y[1],N=(0,q.useState)(!1),C=N[0],E=N[1],V=_();l0();var P=(t=(0,x.Z)(j().mark(function e(){var t,n,s,a;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return v(!0),k(""),e.prev=2,n=(0,O.PO)(null===(t=V.serverHostConfig)||void 0===t?void 0:t.orgURL),s=(0,O.M)(nZ()(r)),e.next=7,fetch(n+"/api/share",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer "+I.Z.get("typingmindcloud_token")},body:JSON.stringify({chatData:r,c:s})});case 7:if(413!==(a=e.sent).status){e.next=12;break}return k("Share failed: Your chat is too large to share. Please contact support."),v(!1),e.abrupt("return");case 12:if(!(a.status>=400)){e.next=19;break}return e.next=15,a.json();case 15:return k(e.sent.userMessage||dX),v(!1),e.abrupt("return");case 19:if(a.ok){e.next=23;break}return k(dX),v(!1),e.abrupt("return");case 23:return e.next=25,a.json();case 25:c(e.sent),e.next=33;break;case 29:e.prev=29,e.t0=e.catch(2),k(dX),console.error(e.t0);case 33:v(!1);case 34:case"end":return e.stop()}},e,null,[[2,29]])})),function(){return t.apply(this,arguments)}),M=(0,O.PO)(null===(n=V.serverHostConfig)||void 0===n?void 0:n.orgURL);return(0,S.jsx)("div",{children:l?(0,S.jsxs)("div",{className:"",children:[(0,S.jsx)("div",{className:"my-4 text-lg text-center font-bold",children:(0,S.jsx)(A.cC,{id:"Uautv5"})}),i?(0,S.jsx)("div",{className:"my-4 text-left",children:(0,S.jsx)(A.cC,{id:"V5qHtW",components:{0:(0,S.jsx)("button",{onClick:a,className:"font-semibold text-blue-500 hover:underline inline-flex items-center justify-center gap-1"})}})}):(0,S.jsx)("div",{className:"my-4 text-center",children:(0,S.jsx)(A.cC,{id:"36Sd6M"})}),(0,S.jsxs)("div",{className:"my-4",children:[(0,S.jsxs)("div",{className:"flex items-center justify-between",children:[(0,S.jsx)("div",{className:"text-sm font-semibold my-2",children:(0,S.jsx)(A.cC,{id:"uYL3GC"})}),(0,S.jsx)("div",{children:u?T.ag._({id:"PiH3UR"}):""})]}),(0,S.jsx)("input",{onClick:function(){var e;m(!0),null===(e=navigator.clipboard)||void 0===e||e.writeText(M+l.shareLink)},className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm dark:bg-zinc-700",value:M+l.shareLink,readOnly:!0})]}),(0,S.jsxs)("div",{className:"my-4",children:[(0,S.jsxs)("div",{className:"flex items-center justify-between",children:[(0,S.jsx)("div",{className:"text-sm font-semibold my-2 text-red-500",children:(0,S.jsx)(A.cC,{id:"J5C0cq"})}),(0,S.jsx)("div",{children:h?T.ag._({id:"PiH3UR"}):""})]}),(0,S.jsx)("input",{onClick:function(){var e;g(!0),null===(e=navigator.clipboard)||void 0===e||e.writeText(M+l.deleteLink)},className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm dark:bg-zinc-700",value:M+l.deleteLink,readOnly:!0})]})]}):(0,S.jsxs)("div",{children:[(0,S.jsx)("p",{className:"my-2 text-lg",children:(0,S.jsx)("b",{children:(0,S.jsx)(A.cC,{id:"Q600Ty",components:{0:(0,S.jsx)("span",{className:"font-semibold text-blue-500"})}})})}),(0,S.jsxs)("ul",{className:"list-disc pl-4",children:[(0,S.jsx)("li",{className:"my-2",children:(0,S.jsx)(A.cC,{id:"tAhtTZ",values:{0:(0,O.PO)(null===(s=V.serverHostConfig)||void 0===s?void 0:s.orgURL).replace("http://","").replace("https://","")||window.location.host},components:{0:(0,S.jsx)("b",{}),1:(0,S.jsx)("b",{}),2:(0,S.jsx)("b",{})}})}),(0,S.jsx)("li",{className:"my-2",children:(0,S.jsx)(A.cC,{id:"N1FnFw",components:{0:(0,S.jsx)("b",{}),1:(0,S.jsx)("b",{})}})}),(0,S.jsx)("li",{className:"my-2",children:(0,S.jsx)(A.cC,{id:"WQEjxZ",components:{0:(0,S.jsx)("b",{})}})})]}),w&&(0,S.jsx)("div",{className:"text-red-500 text-sm font-semibold my-2",children:w}),(0,S.jsx)("div",{className:"flex items-center justify-center",children:(0,S.jsxs)("label",{className:"flex items-center justify-start gap-2",children:[(0,S.jsx)("input",{type:"checkbox",checked:C,onChange:function(){return E(!C)}}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"ow9Olb"})})]})}),(0,S.jsx)("div",{className:"my-4 text-center",children:(0,S.jsxs)("button",{disabled:b||!C,onClick:P,className:"inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 space-x-1 disabled:bg-gray-400",children:[(0,S.jsx)(Y.x2q,{className:"w-4 h-4"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"QxxWAu"})})]})})]})})}function d0(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,s)}return n}function d1(e){for(var t=1;t\n window.addEventListener('message', async (event) => {\n try {\n var receivedCode = event.data;\n await eval(receivedCode);\n } catch (e) {\n // Handle any errors that come from evaluating the code\n console.error(e);\n window.parent.postMessage(JSON.stringify({ error: e.message, id: \"".concat(t,'" }), "*")\n }\n });\n\n '),document.body.appendChild(a),window.addEventListener("message",function n(s){if(s.source===a.contentWindow){var r=(0,O.dC)(s.data);if(r&&r.id===t){e(r);try{document.body.removeChild(a)}catch(e){console.error(e)}window.removeEventListener("message",n)}}}),a.onload=function(){this.contentWindow.postMessage(n,"*")},a.onerror=function(){s({error:Error("Failed to load iframe.")});try{document.body.removeChild(a)}catch(e){console.error(e)}}})}({id:o,untrustedCode:l});case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}},e)}))).apply(this,arguments)}function uh(e){var t=e.children;if("string"!=typeof t)return console.error("Error: children must be a string. Received: ",t),t;var n=navigator.platform.toUpperCase().includes("MAC");return window.innerWidth<768?null:n?t:t.replace("⌘","⌃")}function ug(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,s)}return n}function uf(e){for(var t=1;t0&&(0,S.jsxs)("button",{onClick:u,className:"hover:underline rounded-md active:bg-black/10 inline-flex items-center justify-center gap-1 shrink-0 relative hover:bg-black/5 p-1 transition-colors",children:[(0,S.jsx)(Y.bI9,{className:"w-6 h-6 text-gray-500"})," ",(0,S.jsx)("span",{className:"text-xs bg-gray-500 text-white rounded-full w-4 h-4 -bottom-1 -right-1 absolute",children:d.length})]}),null!=l&&l.length&&(0,O.N7)("showChatInfo",Z)?(0,S.jsxs)("button",{onClick:function(){return D(!0)},className:"rounded-md dark:active:bg-white/10 inline-flex items-center justify-center gap-1 shrink-0 relative hover:bg-black/5 active:bg-black/10 p-1 transition-colors",children:[F&&(null==V?void 0:V.totalCostUSD)>0?(0,S.jsx)("span",{className:"text-gray-500 text-xs font-normal",children:ei()}):null,(0,S.jsx)("div",{style:W?{backgroundImage:ec}:void 0,className:"rounded-full p-1 bg-gray-300 dark:bg-gray-500",children:(0,S.jsx)("div",{className:"rounded-full bg-white dark:bg-gray-950 flex w-4 h-4 items-center justify-center text-gray-500",children:(0,S.jsx)(Y.US6,{})})})]}):null,null!==(s=R.serverHostConfig)&&void 0!==s&&s.allowAnonymousUse&&null!==(r=R.serverHostConfig)&&void 0!==r&&r.publicModeAllowLogin?(0,S.jsx)(cw,{small:!0,hostConfig:R.serverHostConfig}):null]})]}),(0,S.jsxs)(X,{open:M,setOpen:D,children:[(0,S.jsx)("h3",{className:"text-lg font-semibold text-center",children:(0,S.jsx)(A.cC,{id:"n3bn7r"})}),(0,S.jsxs)("div",{className:"flex items-start justify-center gap-2 flex-col my-4",children:[ea?(0,S.jsxs)("div",{children:[(0,S.jsxs)("div",{className:"font-semibold",children:[(0,S.jsx)(A.cC,{id:"JEGlfK"}),":"]}),(0,S.jsx)("div",{children:new Date(ea).toLocaleString()})]}):null,ea?(0,S.jsxs)("div",{children:[(0,S.jsxs)("div",{className:"font-semibold",children:[(0,S.jsx)(A.cC,{id:"scu3wk"}),":"]}),(0,S.jsxs)("div",{children:[null==a?void 0:a.title," (",(null==a?void 0:a.modelID)||(null==a?void 0:a.id),")"]})]}):null,(0,S.jsxs)("div",{children:[(0,S.jsxs)("div",{className:"font-semibold",children:[(0,S.jsx)(A.cC,{id:"6hMGSB"}),":"]}),(0,S.jsx)("div",{children:(0,S.jsx)(A.cC,{id:"7dDfMK",values:{0:(l||[]).filter(function(e){return"system"!==e.role}).length}})})]}),(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"font-semibold",children:(0,S.jsx)(A.cC,{id:"HpGMZX"})}),(0,S.jsxs)("div",{className:"flex items-center justify-start gap-2 flex-wrap",children:[(0,S.jsx)("div",{style:W?{backgroundImage:ec}:void 0,className:"rounded-full p-1 bg-gray-300 w-4 h-4 flex items-center justify-center"}),(0,S.jsxs)("div",{children:[(0,S.jsx)(A.cC,{id:"BnhXW8",values:{currentContextLength:es}}),(0,S.jsxs)("span",{className:"mx-1",children:["(",eo,"%)"]}),(0,S.jsxs)("span",{className:"text-xs italic text-gray-500",children:[" ",(0,S.jsx)(A.cC,{id:"zh1htt"})]})]})]}),(0,S.jsxs)("label",{className:"mt-0.5 flex items-center justify-start gap-2",children:[(0,S.jsx)("input",{type:"checkbox",checked:W,onChange:function(e){return Q(e.target.checked)}}),(0,S.jsx)("span",{children:"Show indicator on header"})]})]}),(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"font-semibold",children:(0,S.jsx)(A.cC,{id:"AG4LZH"})}),(0,S.jsxs)("div",{children:[(0,S.jsx)(A.cC,{id:"ltmlBy",values:{totalTokensSpent:er}}),(0,S.jsxs)("span",{className:"text-xs italic text-gray-500",children:[" ",(0,S.jsx)(A.cC,{id:"zh1htt"})]})]}),(0,S.jsxs)("label",{className:"mt-0.5 flex items-center justify-start gap-2",children:[(0,S.jsx)("input",{type:"checkbox",checked:ee,onChange:function(e){return et(e.target.checked)}}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"qsNpLL"})})]})]}),V.totalCachedTokens?(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"font-semibold",children:(0,S.jsx)(A.cC,{id:"p26txP"})}),(0,S.jsx)("div",{children:(0,S.jsx)(A.cC,{id:"5xe2p4",values:{0:V.totalCachedTokens}})})]}):null,(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"font-semibold",children:(0,S.jsx)(A.cC,{id:"sDp3Xz"})}),(0,S.jsx)("div",{children:(0,S.jsx)(uy,{chatID:i})})]}),o&&(null==V?void 0:V.totalCostUSD)>0?(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"font-semibold",children:(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"xEbu5z"})})}),(0,S.jsxs)("div",{className:"space-y-0.5",children:[(0,S.jsx)("div",{children:ei()}),(0,S.jsxs)("label",{className:"flex items-center justify-start gap-2",children:[(0,S.jsx)("input",{type:"checkbox",checked:F,onChange:function(e){return U(e.target.checked)}}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"w1f7ZM"})})]})]}),(0,S.jsx)("div",{className:"text-xs text-gray-500",children:(0,S.jsx)(A.cC,{id:"7mai6W"})})]}):null]}),(0,S.jsx)("hr",{className:"my-4"}),(0,S.jsx)(uS,{}),(0,S.jsx)(ls,{})]})]})}function uM(e){var t=e.onUseOwnAPIKey,n=e.onGotIt,s=(0,q.useState)(!1),r=s[0],a=s[1];return(0,S.jsx)("div",{className:"text-sm font-semibold my-4 p-2 rounded-md",children:r?(0,S.jsxs)("div",{className:"mt-4",children:[(0,S.jsx)("h3",{className:"text-lg text-center font-bold my-2",children:"How to use the free models:"}),(0,S.jsxs)("ol",{className:"list-decimal list-inside text-xs font-semibold",children:[(0,S.jsx)("li",{children:"Go back to the main screen"}),(0,S.jsx)("li",{children:"Click the model button (with the model icon)"}),(0,S.jsx)("li",{children:'Select "Setapp (GPT-3.5)" or "Setapp (GPT-4)"'})]}),(0,S.jsx)("div",{className:"my-2 text-center",children:(0,S.jsx)("button",{onClick:n,className:"inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 space-x-1 disabled:bg-gray-400",children:(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"76gPWk"})})})})]}):(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{children:(0,S.jsx)(A.cC,{id:"1J28UM"})}),(0,S.jsxs)("div",{className:"flex items-center justify-center gap-2 flex-wrap mt-4",children:[(0,S.jsx)("button",{onClick:function(){return a(!0)},className:"inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 space-x-1 disabled:bg-gray-400",children:(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"GwJlK4"})})}),(0,S.jsx)("button",{onClick:t,className:"inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-red-600 hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 space-x-1 disabled:bg-gray-400",children:(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"z3hnVp"})})})]})]})})}var uD=[{question:"How is the API key handled?",questionMsg:{id:"JNKgQJ"},answer:"Your API is safe and stored locally on your device. This is a static app, which means that it doesn't have a backend. All the data is stored in your browser's local storage. Requests to Open AI's API is sent directly from your current browser (check the Network tab in your console if you want to see it).",answerMsg:{id:"/UaKK0"}},{question:"Do I need to have ChatGPT Plus ($20/month) to use TypingMind.com?",questionMsg:{id:"OfaLQ8"},answer:"No! A ChatGPT Plus subscription is not needed. You just need to have an OpenAI's API Key. You can see more info on how to get one here: https://openai.com/blog/openai-api",answerMsg:{id:"wIOBEk"}},{question:"Do I need to pay for OpenAI for a ChatGPT API Key?",questionMsg:{id:"OK9+n5"},answer:"Yes. You need to have an OpenAI account and a valid API key to use ChatGPT. We don't sell API keys.",answerMsg:{id:"9dFN/h"}},{question:"License Key vs. API Key",questionMsg:{id:"h12eY8"},answer:"License Key is used to activate the premium features of TypingMind.com. API Key refers to OpenAI ChatGPT API Key, and is used to connect to OpenAI's API to interact with ChatGPT. You need an API Key to use the app. The License Key is only needed if you want to use the premium features.",answerMsg:{id:"ttpgzw"}}];function uB(){var e=(0,A.mV)().i18n;return(0,S.jsx)("div",{className:"",children:(0,S.jsx)("div",{className:"mx-auto max-w-7xl",children:(0,S.jsxs)("details",{className:"mx-auto max-w-4xl",children:[(0,S.jsx)("summary",{children:(0,S.jsx)("h2",{className:"text-xl font-bold tracking-tight inline-block hover:underline cursor-pointer",children:(0,S.jsx)(A.cC,{id:"TgtE45"})})}),(0,S.jsx)("dl",{className:"mt-2 space-y-2",children:uD.map(function(t){return(0,S.jsx)(r0.pJ,{as:"div",className:"pt-2",children:function(n){var s=n.open;return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("dt",{children:(0,S.jsxs)(r0.lG,{className:"flex w-full items-start justify-between text-left ",children:[(0,S.jsx)("span",{className:"text-sm font-semibold",children:e._(t.questionMsg)}),(0,S.jsx)("span",{className:"ml-6 flex h-7 items-center",children:s?(0,S.jsx)(og.Z,{className:"h-6 w-6","aria-hidden":"true"}):(0,S.jsx)(of.Z,{className:"h-6 w-6","aria-hidden":"true"})})]})}),(0,S.jsx)(r0.V2,{as:"dd",className:"mt-2 pr-12",children:(0,S.jsx)("p",{className:"text-sm text-gray-500",children:e._(t.answerMsg)})})]})}},t.question)})}),(0,S.jsx)("div",{className:"text-center mt-8",children:(0,S.jsx)("a",{href:"/faqs",className:"text-blue-500 hover:underline ",target:"_blank",children:(0,S.jsx)(A.cC,{id:"iqebkX"})})})]})})})}var uL=(0,K.eK)("useAnthropicAPIKey"),uR=(0,K.eK)("useCurrentAnthropicEndpoint"),u_=(0,q.memo)(function(e){var t,n,s,r=e.onCompleted,a=e.showChangeAPIKey,i=e.isAPIKeyOptional,o=uR("https://cloud2.typingmind.com/api/claude/v1/messages"),l=(0,y.Z)(o,2),c=l[0];l[1];var d=uL(""),u=(0,y.Z)(d,2),m=u[0],p=u[1],h=(0,q.useState)(""),g=h[0],f=h[1],b=(0,q.useState)(!1),v=b[0],w=b[1],k=(0,q.useState)(!1),N=k[0],C=k[1],I=(0,q.useState)(!1),O=I[0],V=I[1],P=(0,q.useState)(m),M=P[0],D=P[1],B=(0,q.useState)(!1);B[0],B[1];var L=(0,q.useState)(!i),R=L[0],_=L[1];(0,q.useEffect)(function(){O&&_(!i)},[O]),(0,q.useEffect)(function(){m&&D(m)},[m]);var Z=(t=(0,x.Z)(j().mark(function e(){return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:V(!0);case 1:case"end":return e.stop()}},e)})),function(){return t.apply(this,arguments)}),K=(n=(0,x.Z)(j().mark(function e(){var t;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(f(""),!(null!==(t=M))){e.next=16;break}if(""!==t){e.next=8;break}return p(""),V(!1),r&&r(),e.abrupt("return");case 8:return e.next=10,G(t);case 10:if(!e.sent){e.next=16;break}p(t),C(!0),V(!1),r&&r(),setTimeout(function(){C(!1)},5e3);case 16:case"end":return e.stop()}},e)})),function(){return n.apply(this,arguments)}),G=(s=(0,x.Z)(j().mark(function e(t){var n,s,r;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return w(!0),e.prev=1,e.next=4,fetch(c,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":"".concat(t)},body:JSON.stringify({model:"claude-instant-1.2",messages:[{role:"user",content:"Test"}],max_tokens:1})});case 4:if(401!==(n=e.sent).status){e.next=9;break}return w(!1),f(T.ag._({id:"EPw/o1"})),e.abrupt("return",null);case 9:if(n.ok){e.next=22;break}return e.prev=10,e.next=13,n.json();case 13:s=e.sent,f(T.ag._({id:"atnPxc"})+" "+s.error.message),e.next=20;break;case 17:e.prev=17,e.t0=e.catch(10),f(T.ag._({id:"SQw4QB"})+n.status);case 20:return w(!1),e.abrupt("return",null);case 22:return e.next=24,n.json();case 24:return r=e.sent,w(!1),e.abrupt("return",r);case 29:e.prev=29,e.t1=e.catch(1),f(T.ag._({id:"jM5g6I"})),console.error(e.t1);case 33:w(!1);case 34:case"end":return e.stop()}},e,null,[[1,29],[10,17]])})),function(e){return s.apply(this,arguments)});return(0,S.jsxs)("div",{className:"",children:[N&&(0,S.jsxs)("div",{className:"flex items-center justify-center ",children:[(0,S.jsx)("div",{className:"text-green-500 text-sm font-semibold my-2",children:(0,S.jsx)(A.cC,{id:"f0rbKh"})}),(0,S.jsx)(lL.Z,{})]}),m?void 0!==a&&a?(0,S.jsx)("div",{className:"text-center mb-2 ",children:(0,S.jsxs)("button",{id:"enter-api-key-btn",disabled:v,className:"inline-flex items-center justify-center rounded-full px-4 py-3 text-sm shadow-md bg-blue-600 text-white hover:bg-blue-500 transition-all active:bg-blue-600 group font-semibold text-sm disabled:bg-gray-400 space-x-2",onClick:Z,children:[v?(0,S.jsx)(E,{}):(0,S.jsx)(e2.itj,{className:"w-5 h-5"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"h3vADk"})})]})}):null:(0,S.jsx)("button",{id:"enter-api-key-btn",className:"text-gray-500 hover:underline",onClick:Z}),(0,S.jsxs)(X,{open:O,setOpen:V,showCloseButton:!1,children:[i&&!R?(0,S.jsxs)("div",{children:[(0,S.jsxs)("h2",{className:"text-center text-xl font-bold flex items-center justify-center gap-2",children:[(0,S.jsx)(ef,{model:"claude-v1"})," ",(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"3HkJve"})})]}),(0,S.jsx)(uM,{onUseOwnAPIKey:function(){return _(!0)},onGotIt:function(){return V(!1)}})]}):null,R?(0,S.jsxs)("div",{children:[(0,S.jsxs)("h2",{className:"text-center text-xl font-bold flex items-center justify-center gap-2",children:[(0,S.jsx)(ef,{model:"claude-v1"})," ",(0,S.jsxs)("span",{children:[(0,S.jsx)(A.cC,{id:"99MXlb"}),":"]})]}),(0,S.jsx)("div",{className:"my-4",children:(0,S.jsx)(A.cC,{id:"02OlWC"})}),(0,S.jsx)("div",{className:"text-xs",children:(0,S.jsx)(A.cC,{id:"yX4ZJX"})}),(0,S.jsx)("div",{className:"my-4",children:(0,S.jsx)("input",{type:"text",placeholder:"sk-ant-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm dark:bg-zinc-700",value:M,autoComplete:"off",onChange:function(e){return D(e.target.value)},onKeyDown:function(e){"Enter"===e.key&&(e.preventDefault(),K())},disabled:v})}),(0,S.jsx)("div",{className:"my-4 text-center",children:(0,S.jsxs)("a",{className:"text-blue-500 text-xs hover:underline",target:"_blank",rel:"noopener noreferrer",href:"https://console.anthropic.com/account/keys",children:["→ ",(0,S.jsx)(A.cC,{id:"0uv2li"})]})}),g?(0,S.jsx)("div",{className:"text-sm text-center text-red-500",children:g}):null,(0,S.jsxs)("div",{className:"my-2 text-center space-x-2 flex items-center justify-center",children:[(0,S.jsxs)("button",{disabled:v,onClick:function(){return K()},className:"inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 space-x-1 disabled:bg-gray-400",children:[v?(0,S.jsx)(E,{}):(0,S.jsx)(Y.bzc,{className:"w-4 h-4"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"tfDRzk"})})]}),(0,S.jsx)("button",{disabled:v,onClick:function(){return V(!1)},className:"inline-flex items-center px-4 py-2 text-sm font-medium rounded-md text-gray-500 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 space-x-1",children:(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"dEgA5A"})})})]}),(0,S.jsx)("div",{className:"mt-4 text-xs",children:(0,S.jsx)(A.cC,{id:"7egM0P"})})]}):null]})]})});function uZ(e){var t=e.skippedMessagesCount,n=e.model,s=(0,q.useState)(!1),r=s[0],a=s[1];return(0,S.jsxs)("div",{className:"px-4 text-right mt-6",children:[(0,S.jsx)("button",{onClick:function(){return a(!0)},className:"text-gray-500 text-xs italic text-right hover:underline",children:(0,S.jsx)(A.cC,{id:"OI8spO"})}),(0,S.jsxs)(X,{open:r,setOpen:a,children:[(0,S.jsxs)("div",{className:"text-xl font-bold text-center mb-4",children:["\uD83E\uDDE0 ",(0,S.jsx)(A.cC,{id:"HQF+Mf"})]}),(0,S.jsxs)("div",{className:"space-y-2",children:[(0,S.jsx)("div",{children:(0,S.jsx)(A.cC,{id:"sTxGM6",values:{model:n},components:{0:(0,S.jsx)("b",{})}})}),(0,S.jsx)("div",{children:(0,S.jsx)(A.cC,{id:"G4U6ac"})}),(0,S.jsx)("div",{children:(0,S.jsx)("b",{children:(0,S.jsx)(A.cC,{id:"BmbkK/",values:{skippedMessagesCount:t}})})})]})]})]})}function uK(e){var t=e.className;return(0,S.jsxs)("svg",{className:t,xmlns:"http://www.w3.org/2000/svg","aria-label":"Brave",role:"img",viewBox:"0 0 512 512",children:[(0,S.jsxs)("linearGradient",{id:"a",children:[(0,S.jsx)("stop",{offset:0,stopColor:"#f50"}),(0,S.jsx)("stop",{offset:1,stopColor:"#f20"})]}),(0,S.jsx)("path",{d:"M416 158l9-23c-24-25-33-43-72-34l-35-40H194l-35 40c-38-3-45 6-72 34l10 23-12 34 39 150c8 32 14 45 37 61l72 49c7 4 16 12 23 12 8 0 16-8 23-12l72-49c23-16 29-29 37-61l40-150",fill:"url(#a)"}),(0,S.jsx)("path",{d:"M343 127s45 54 45 66c-3 21-30 42-45 57-17 16 6 35-3 51-6 12-17 20-24 19-15-8-53-21-55-40 2-18 42-22 44-36 0-13-18-31-17-44 8-14 44-24 59-29 2-2 2-3-6-3-17-2-52-3-66 8-4 16 17 68 4 71-19 5-26 3-45 0-13-8 11-52 3-71-19-12-45-11-66-8-7 0-8 1-6 3 14 7 57 14 59 29 1 17-17 29-17 44 7 15 43 20 45 35-7 20-38 36-55 41-7 1-18-7-25-19-10-20 14-38-3-51-13-15-45-41-45-57 0-12 45-66 45-66l43 7c5 0 17-5 27-8s17-3 17-3 7 0 17 3 22 8 27 8l43-7m-35 216-52 39c-18-12-37-28-52-39-8-9 13-15 22-20 10-5 20-9 30-11 10 3 20 6 30 11 9 4 30 13 22 20",fill:"#fff"})]})}function uG(e){var t=e.className;return(0,S.jsxs)("svg",{className:t,viewBox:"-29.62167543756803 0.1 574.391675437568 799.8100000000002",xmlns:"http://www.w3.org/2000/svg",width:1888,height:2500,children:[(0,S.jsxs)("linearGradient",{id:"a",gradientUnits:"userSpaceOnUse",x1:"286.383",x2:"542.057",y1:"284.169",y2:"569.112",children:[(0,S.jsx)("stop",{offset:0,stopColor:"#37bdff"}),(0,S.jsx)("stop",{offset:".25",stopColor:"#26c6f4"}),(0,S.jsx)("stop",{offset:".5",stopColor:"#15d0e9"}),(0,S.jsx)("stop",{offset:".75",stopColor:"#3bd6df"}),(0,S.jsx)("stop",{offset:1,stopColor:"#62dcd4"})]}),(0,S.jsxs)("linearGradient",{id:"b",gradientUnits:"userSpaceOnUse",x1:"108.979",x2:"100.756",y1:"675.98",y2:"43.669",children:[(0,S.jsx)("stop",{offset:0,stopColor:"#1b48ef"}),(0,S.jsx)("stop",{offset:".5",stopColor:"#2080f1"}),(0,S.jsx)("stop",{offset:1,stopColor:"#26b8f4"})]}),(0,S.jsxs)("linearGradient",{id:"c",gradientUnits:"userSpaceOnUse",x1:"256.823",x2:"875.632",y1:"649.719",y2:"649.719",children:[(0,S.jsx)("stop",{offset:0,stopColor:"#39d2ff"}),(0,S.jsx)("stop",{offset:".5",stopColor:"#248ffa"}),(0,S.jsx)("stop",{offset:1,stopColor:"#104cf5"})]}),(0,S.jsxs)("linearGradient",{id:"d",gradientUnits:"userSpaceOnUse",x1:"256.823",x2:"875.632",y1:"649.719",y2:"649.719",children:[(0,S.jsx)("stop",{offset:0,stopColor:"#fff"}),(0,S.jsx)("stop",{offset:1})]}),(0,S.jsx)("path",{d:"M249.97 277.48c-.12.96-.12 2.05-.12 3.12 0 4.16.83 8.16 2.33 11.84l1.34 2.76 5.3 13.56 27.53 70.23 24.01 61.33c6.85 12.38 17.82 22.1 31.05 27.28l4.11 1.51c.16.05.43.05.65.11l65.81 22.63v.05l25.16 8.64 1.72.58c.06 0 .16.06.22.06 4.96 1.25 9.82 2.93 14.46 4.98 10.73 4.63 20.46 11.23 28.77 19.28 3.35 3.2 6.43 6.65 9.28 10.33a88.64 88.64 0 0 1 6.64 9.72c8.78 14.58 13.82 31.72 13.82 49.97 0 3.26-.16 6.41-.49 9.61-.11 1.41-.28 2.77-.49 4.12v.11c-.22 1.43-.49 2.91-.76 4.36-.28 1.41-.54 2.81-.86 4.21-.05.16-.11.33-.17.49-.3 1.42-.68 2.82-1.07 4.23-.35 1.33-.79 2.7-1.28 3.99a42.96 42.96 0 0 1-1.51 4.16c-.49 1.4-1.07 2.82-1.72 4.16-1.78 4.11-3.9 8.06-6.28 11.83a97.889 97.889 0 0 1-10.47 13.95c30.88-33.2 51.41-76.07 56.52-123.51.86-7.78 1.3-15.67 1.3-23.61 0-5.07-.22-10.09-.55-15.13-3.89-56.89-29.79-107.77-69.32-144.08-10.9-10.09-22.81-19.07-35.62-26.69l-24.2-12.37-122.63-62.93a30.15 30.15 0 0 0-11.93-2.44c-15.88 0-28.99 12.11-30.55 27.56z",fill:"#7f7f7f"}),(0,S.jsx)("path",{d:"M249.97 277.48c-.12.96-.12 2.05-.12 3.12 0 4.16.83 8.16 2.33 11.84l1.34 2.76 5.3 13.56 27.53 70.23 24.01 61.33c6.85 12.38 17.82 22.1 31.05 27.28l4.11 1.51c.16.05.43.05.65.11l65.81 22.63v.05l25.16 8.64 1.72.58c.06 0 .16.06.22.06 4.96 1.25 9.82 2.93 14.46 4.98 10.73 4.63 20.46 11.23 28.77 19.28 3.35 3.2 6.43 6.65 9.28 10.33a88.64 88.64 0 0 1 6.64 9.72c8.78 14.58 13.82 31.72 13.82 49.97 0 3.26-.16 6.41-.49 9.61-.11 1.41-.28 2.77-.49 4.12v.11c-.22 1.43-.49 2.91-.76 4.36-.28 1.41-.54 2.81-.86 4.21-.05.16-.11.33-.17.49-.3 1.42-.68 2.82-1.07 4.23-.35 1.33-.79 2.7-1.28 3.99a42.96 42.96 0 0 1-1.51 4.16c-.49 1.4-1.07 2.82-1.72 4.16-1.78 4.11-3.9 8.06-6.28 11.83a97.889 97.889 0 0 1-10.47 13.95c30.88-33.2 51.41-76.07 56.52-123.51.86-7.78 1.3-15.67 1.3-23.61 0-5.07-.22-10.09-.55-15.13-3.89-56.89-29.79-107.77-69.32-144.08-10.9-10.09-22.81-19.07-35.62-26.69l-24.2-12.37-122.63-62.93a30.15 30.15 0 0 0-11.93-2.44c-15.88 0-28.99 12.11-30.55 27.56z",fill:"url(#a)"}),(0,S.jsx)("path",{d:"M31.62.1C14.17.41.16 14.69.16 32.15v559.06c.07 3.9.29 7.75.57 11.66.25 2.06.52 4.2.9 6.28 7.97 44.87 47.01 78.92 94.15 78.92 16.53 0 32.03-4.21 45.59-11.53.08-.06.22-.14.29-.14l4.88-2.95 19.78-11.64 25.16-14.93.06-496.73c0-33.01-16.52-62.11-41.81-79.4-.6-.36-1.18-.74-1.71-1.17L50.12 5.56C45.16 2.28 39.18.22 32.77.1z",fill:"#7f7f7f"}),(0,S.jsx)("path",{d:"M31.62.1C14.17.41.16 14.69.16 32.15v559.06c.07 3.9.29 7.75.57 11.66.25 2.06.52 4.2.9 6.28 7.97 44.87 47.01 78.92 94.15 78.92 16.53 0 32.03-4.21 45.59-11.53.08-.06.22-.14.29-.14l4.88-2.95 19.78-11.64 25.16-14.93.06-496.73c0-33.01-16.52-62.11-41.81-79.4-.6-.36-1.18-.74-1.71-1.17L50.12 5.56C45.16 2.28 39.18.22 32.77.1z",fill:"url(#b)"}),(0,S.jsx)("path",{d:"M419.81 510.84L194.72 644.26l-3.24 1.95v.71l-25.16 14.9-19.77 11.67-4.85 2.93-.33.16c-13.53 7.35-29.04 11.51-45.56 11.51-47.13 0-86.22-34.03-94.16-78.92 3.77 32.84 14.96 63.41 31.84 90.04 34.76 54.87 93.54 93.04 161.54 99.67h41.58c36.78-3.84 67.49-18.57 99.77-38.46l49.64-30.36c22.36-14.33 83.05-49.58 100.93-69.36 3.89-4.33 7.4-8.97 10.47-13.94 2.38-3.78 4.5-7.73 6.28-11.84.6-1.4 1.17-2.76 1.72-4.15.52-1.38 1.01-2.77 1.51-4.18.93-2.7 1.67-5.41 2.38-8.2.36-1.59.69-3.16 1.02-4.72 1.08-5.89 1.67-11.94 1.67-18.21 0-18.25-5.04-35.39-13.77-49.95-2-3.4-4.2-6.65-6.64-9.72-2.85-3.7-5.93-7.13-9.28-10.33-8.31-8.05-18.01-14.65-28.77-19.29-4.64-2.05-9.48-3.74-14.46-4.97-.06 0-.16-.06-.22-.06l-1.72-.58z",fill:"#7f7f7f"}),(0,S.jsx)("path",{d:"M419.81 510.84L194.72 644.26l-3.24 1.95v.71l-25.16 14.9-19.77 11.67-4.85 2.93-.33.16c-13.53 7.35-29.04 11.51-45.56 11.51-47.13 0-86.22-34.03-94.16-78.92 3.77 32.84 14.96 63.41 31.84 90.04 34.76 54.87 93.54 93.04 161.54 99.67h41.58c36.78-3.84 67.49-18.57 99.77-38.46l49.64-30.36c22.36-14.33 83.05-49.58 100.93-69.36 3.89-4.33 7.4-8.97 10.47-13.94 2.38-3.78 4.5-7.73 6.28-11.84.6-1.4 1.17-2.76 1.72-4.15.52-1.38 1.01-2.77 1.51-4.18.93-2.7 1.67-5.41 2.38-8.2.36-1.59.69-3.16 1.02-4.72 1.08-5.89 1.67-11.94 1.67-18.21 0-18.25-5.04-35.39-13.77-49.95-2-3.4-4.2-6.65-6.64-9.72-2.85-3.7-5.93-7.13-9.28-10.33-8.31-8.05-18.01-14.65-28.77-19.29-4.64-2.05-9.48-3.74-14.46-4.97-.06 0-.16-.06-.22-.06l-1.72-.58z",fill:"url(#c)"}),(0,S.jsx)("path",{d:"M512 595.46c0 6.27-.59 12.33-1.68 18.22-.32 1.56-.65 3.12-1.02 4.7-.7 2.8-1.44 5.51-2.37 8.22-.49 1.4-.99 2.8-1.51 4.16-.54 1.4-1.12 2.76-1.73 4.16a87.873 87.873 0 0 1-6.26 11.83 96.567 96.567 0 0 1-10.48 13.94c-17.88 19.79-78.57 55.04-100.93 69.37l-49.64 30.36c-36.39 22.42-70.77 38.29-114.13 39.38-2.05.06-4.06.11-6.05.11-2.8 0-5.56-.05-8.33-.16-73.42-2.8-137.45-42.25-174.38-100.54a213.368 213.368 0 0 1-31.84-90.04c7.94 44.89 47.03 78.92 94.16 78.92 16.52 0 32.03-4.17 45.56-11.51l.33-.17 4.85-2.92 19.77-11.67 25.16-14.9v-.71l3.24-1.95 225.09-133.43 17.33-10.27 1.72.58c.05 0 .16.06.22.06 4.98 1.23 9.83 2.92 14.46 4.97 10.76 4.64 20.45 11.24 28.77 19.29a92.13 92.13 0 0 1 9.28 10.33c2.44 3.07 4.64 6.32 6.64 9.72 8.73 14.56 13.77 31.7 13.77 49.95z",fill:"#7f7f7f",opacity:".15"}),(0,S.jsx)("path",{d:"M512 595.46c0 6.27-.59 12.33-1.68 18.22-.32 1.56-.65 3.12-1.02 4.7-.7 2.8-1.44 5.51-2.37 8.22-.49 1.4-.99 2.8-1.51 4.16-.54 1.4-1.12 2.76-1.73 4.16a87.873 87.873 0 0 1-6.26 11.83 96.567 96.567 0 0 1-10.48 13.94c-17.88 19.79-78.57 55.04-100.93 69.37l-49.64 30.36c-36.39 22.42-70.77 38.29-114.13 39.38-2.05.06-4.06.11-6.05.11-2.8 0-5.56-.05-8.33-.16-73.42-2.8-137.45-42.25-174.38-100.54a213.368 213.368 0 0 1-31.84-90.04c7.94 44.89 47.03 78.92 94.16 78.92 16.52 0 32.03-4.17 45.56-11.51l.33-.17 4.85-2.92 19.77-11.67 25.16-14.9v-.71l3.24-1.95 225.09-133.43 17.33-10.27 1.72.58c.05 0 .16.06.22.06 4.98 1.23 9.83 2.92 14.46 4.97 10.76 4.64 20.45 11.24 28.77 19.29a92.13 92.13 0 0 1 9.28 10.33c2.44 3.07 4.64 6.32 6.64 9.72 8.73 14.56 13.77 31.7 13.77 49.95z",fill:"url(#d)",opacity:".15"})]})}(0,K.eK)("useCustomSearchEngineID"),(0,K.eK)("useCustomSearchAPIKey"),(0,K.eK)("useWebSearch"),(0,K.eK)("useWebSearch"),(0,K.eK)("useCustomSearchEngineID"),(0,K.eK)("useCustomSearchAPIKey");var uF=(0,q.memo)(function(e){var t,n=e.onAttachmentsParsed;e.size;var s=(0,q.useState)(!1);s[0],s[1];var r=(0,q.useState)(!1),a=r[0],i=r[1],o=(0,q.useState)(""),l=(o[0],o[1]),c=(0,q.useRef)(null),d=(t=(0,x.Z)(j().mark(function e(t){var s,r;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return l(""),i(!0),e.prev=2,e.next=5,dH(t.target.files);case 5:(r=(s=e.sent).filter(function(e){return e instanceof Error}).map(function(e){return e.message})).length&&eC.Am.error("Unsupported files: "+r.join(", ")),n(s.filter(function(e){return!!e&&!(e instanceof Error)})),e.next=16;break;case 11:e.prev=11,e.t0=e.catch(2),console.error("Error while reading file: ",e.t0),l("Error while reading file: "+e.t0.message),eC.Am.error("Error: "+e.t0.message);case 16:i(!1),t.target.value="";case 18:case"end":return e.stop()}},e,null,[[2,11]])})),function(e){return t.apply(this,arguments)});return(0,S.jsxs)("button",{"data-element-id":"upload-document-button",className:(0,O.AK)("rounded-md py-1 px-1 flex items-center justify-center transition-all space-x-2 shrink-0 text-gray-500 hover:text-gray-900 dark:hover:text-white",a?"cursor-default":"cursor-pointer"),onClick:function(){var e;return null===(e=c.current)||void 0===e?void 0:e.click()},children:[a?(0,S.jsx)(E,{}):(0,S.jsx)(e4.C6S,{className:"w-6 h-6"}),(0,S.jsx)("input",{ref:c,id:"file-upload",name:"file-upload",type:"file",className:"hidden",disabled:a,onChange:d,multiple:!0})]})});function uY(e){var t=e.className;return(0,S.jsxs)("svg",{className:t,xmlns:"http://www.w3.org/2000/svg","aria-label":"DuckDuckGo",role:"img",viewBox:"-128 -128 256 256",fill:"#fff",children:[(0,S.jsx)("circle",{r:108,fill:"#d53"}),(0,S.jsx)("circle",{r:96,fill:"none",stroke:"#fff",strokeWidth:7}),(0,S.jsx)("path",{d:"M-32-55C-62-48-51-6-51-6l19 93 7 3M-39-73h-8l11 4s-11 0-11 7c24-1 35 5 35 5",fill:"#ddd"}),(0,S.jsx)("path",{d:"M25 95S1 57 1 32c0-47 31-7 31-44S1-58 1-58c-15-19-44-15-44-15l7 4s-7 2-9 4 19-3 28 5c-37 3-31 33-31 33l21 120"}),(0,S.jsx)("path",{d:"M25-1l38-10c34 5-29 24-33 23C0 7 9 32 45 24s9 20-24 9C-26 20-1-3 25-1",fill:"#fc0"}),(0,S.jsx)("path",{d:"M15 78l2-3c22 8 23 11 22-9s0-20-23-3c0-5-13-3-15 0-21-9-23-12-22 2 2 29 1 24 21 14",fill:"#6b5"}),(0,S.jsx)("path",{d:"M-1 67v12c1 2 17 2 17-2s-8 3-13 1-2-13-2-13",fill:"#4a4"}),(0,S.jsx)("path",{d:"M-23-32c-5-6-18-1-15 7 1-4 8-10 15-7m32 0c1-6 11-7 14-1-4-2-10-2-14 1m-33 16a2 2 0 1 1 0 1m-8 3a7 7 0 1 0 0-1m52-6a2 2 0 1 1 0 1m-6 3a6 6 0 1 0 0-1",fill:"#148"})]})}function uU(e){var t=e.className;return(0,S.jsxs)("svg",{className:t,xmlns:"http://www.w3.org/2000/svg","aria-label":"Google",role:"img",viewBox:"0 0 512 512",children:[(0,S.jsx)("path",{fill:"#4285f4",d:"M386 400c45-42 65-112 53-179H260v74h102c-4 24-18 44-38 57z"}),(0,S.jsx)("path",{fill:"#34a853",d:"M90 341a192 192 0 0 0 296 59l-62-48c-53 35-141 22-171-60z"}),(0,S.jsx)("path",{fill:"#fbbc02",d:"M153 292c-8-25-8-48 0-73l-63-49c-23 46-30 111 0 171z"}),(0,S.jsx)("path",{fill:"#ea4335",d:"M153 219c22-69 116-109 179-50l55-54c-78-75-230-72-297 55z"})]})}function uH(e){var t=e.outputFormat,n=e.setOutputFormat;return(0,S.jsxs)("div",{"data-element-id":"output-format-setting-container",className:"relative w-full max-w-xs mx-auto",children:[(0,S.jsx)("label",{"data-element-id":"output-format-setting-title",htmlFor:"name",className:function(){for(var e=arguments.length,t=Array(e),n=0;n=3},mt=(0,q.memo)(function(e){e.chatID;var t,n,s=e.enableShare,r=e.messages,a=e.onRegenerate,i=e.onNewChatRequested,o=e.appendReplyAndSubmit,l=e.showLibrary,c=e.onResetChat,d=e.onClearContext,u=e.onOpenPromptLibrary,m=e.onShareChat,p=e.onChangeSettings,h=e.canChangeChatSettings,g=u7(O.c8),f=(0,y.Z)(g,1)[0],x=u8(O.eP),b=(0,y.Z)(x,2),w=b[0];b[1];var j=u9(!0),k=(0,y.Z)(j,2),N=k[0];k[1];var C=(0,A.mV)().i18n,q=_().serverHostConfig.chatFeatures,I=u6(u6({},O.c8),f);(0,di.y1)("mod+alt+".concat(I.newChat),function(e){e.preventDefault(),P("new-chat")},{enabled:!!I.newChat,enableOnFormTags:!0,preventDefault:!0}),(0,di.y1)("mod+alt+".concat(I.resetChat),function(){P("reset-chat")},{enabled:!!I.resetChat,enableOnFormTags:!0,preventDefault:!0}),(0,di.y1)("mod+alt+".concat(I.regenerate),function(){P("regenerate")},{enabled:!!I.regenerate,enableOnFormTags:!0,preventDefault:!0}),(0,di.y1)("mod+alt+".concat(I.share),function(){P("share")},{enabled:!!I.share,enableOnFormTags:!0,preventDefault:!0}),(0,di.y1)("mod+alt+".concat(I.clearContext),function(){P("clear-context")},{enabled:!!I.clearContext,enableOnFormTags:!0,preventDefault:!0}),(0,di.y1)("mod+alt+".concat(I.search),function(){P("prompts")},{enabled:!!I.search,enableOnFormTags:!0,preventDefault:!0});var E=null===(t=r[r.length-1])||void 0===t?void 0:t.content,V=Array.isArray(E)?null===(n=E.find(function(e){return"text"===e.type}))||void 0===n?void 0:n.text:E,P=function(e){return"regenerate"===e?a():"share"===e?m():"new-chat"===e?i():"prompts"===e?u():"reset-chat"===e?c():"clear-context"===e?d():"change-settings"===e?p():void 0},T={showLibrary:void 0===l||l,enableShare:void 0===s||s,canChangeChatSettings:h,shortcuts:{"new-chat":I.newChat,"reset-chat":I.resetChat,regenerate:I.regenerate,share:I.share,"clear-context":I.clearContext,prompts:I.search},hiddenButtons:O.Al.filter(function(e){return!(0,O.N7)("actionButtons.".concat(e.id),q)}).map(function(e){return e.id})},M=[];return(me(V)&&M.push((0,S.jsxs)("button",{onClick:function(){return o("List some more")},"data-element-id":"list-more-button",className:"inline-flex items-center justify-center rounded-md px-3 py-2 shadow-md bg-blue-600 text-white hover:bg-blue-500 transition-all active:bg-blue-600 group font-semibold text-xs hover:scale-105 border border-transparent",children:[(0,S.jsx)(Y.fXH,{className:"w-4 h-4 mr-1 group-hover:rotate-180 transition-all"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"uebWmA"})})]},"list-more")),r.length>1&&M.push.apply(M,(0,v.Z)((0,O.jd)(u6(u6({},T),{},{hiddenButtons:[].concat((0,v.Z)(T.hiddenButtons),(0,v.Z)(w))})).map(function(e){return(0,S.jsxs)("button",{onClick:function(){return P(e.id)},"data-element-id":e.dataElementID||e.id,className:(0,O.AK)("inline-flex items-center justify-center rounded-md px-3 py-2 shadow-md transition-all group font-semibold text-xs hover:scale-105 border border-transparent text-white",e.buttonStyle),children:[(0,S.jsx)(e.icon,{className:"w-4 h-4 group-hover:scale-110 transition-all"}),N?(0,S.jsx)("span",{className:"ml-1",children:C._(u$[e.label])}):null]},e.id)}))),r.length>1&&M.push((0,S.jsx)(u5,{buttonOptions:T,onButtonClick:function(e){return P(e.id)}},"config-buttons")),(0,O.N7)("actionButtons",q))?(0,S.jsx)("div",{id:"elements-in-action-buttons",className:"my-2 text-center w-full flex items-center justify-end flex-wrap gap-2 px-4",children:M}):null});function mn(e){e.size;var t=e.openAIAPIKey,n=e.onCompleted,s=(0,q.useState)(!1),r=s[0],a=s[1];return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("div",{className:"flex items-center space-x-2 group",children:(0,S.jsx)("button",{onClick:function(){return a(!0)},"data-element-id":"voice-input-button",className:"rounded-md py-1 px-1 flex items-center justify-center transition-all space-x-2 shrink-0 text-gray-500 hover:text-gray-900 dark:hover:text-white",children:(0,S.jsx)(C.uYL,{className:function(){for(var e=arguments.length,t=Array(e),n=0;n0&&(0,S.jsx)(eU.j2,{"data-element-id":"more-actions-menu-button",className:"rounded-full border bg-gray-100 dark:bg-gray-700 border-gray-300 px-2 py-1 text-xs hover:bg-gray-200 dark:hover:bg-gray-700 transition-all flex overflow-hidden items-center justify-center text-gray-500 active:bg-gray-300 dark:active:bg-gray-800 gap-1",children:(0,S.jsx)(M.$T6,{className:"w-4 h-4 scale-150"})}),(0,S.jsx)(U.u,{as:q.Fragment,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:(0,S.jsx)(eU.sd,{modal:!1,static:!0,className:"absolute z-50 right-0 top-6 mt-2 origin-top-right divide-y divide-gray-100 rounded-md bg-white dark:bg-gray-700 shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none",children:(0,S.jsx)("div",{className:"px-1 py-1 ",children:V.map(function(e){return(0,S.jsx)(eU.sN,{children:function(t){var n=t.focus;return(0,S.jsxs)("button",{onClickCapture:function(t){return e.onClick(t)},className:(0,O.AK)(e.className,n?"bg-blue-600 text-white":"text-gray-900 dark:text-white","group min-w-[90px] flex shrink-0 whitespace-nowrap space-x-2 w-full items-center rounded-md px-2 py-2 text-sm"),children:[(0,S.jsx)(e.Icon,{className:(0,O.AK)("w-4 h-4",e.iconClassName)}),(0,S.jsx)("span",{children:e.label})]})}},e.id)})})})})]})}})}),mp=function(e){(0,r6.Z)(s,e);var t,n=(t=function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}(),function(){var e,n=(0,r8.Z)(s);return e=t?Reflect.construct(n,arguments,(0,r8.Z)(this).constructor):n.apply(this,arguments),(0,r7.Z)(this,e)});function s(e){var t;return(0,r3.Z)(this,s),(t=n.call(this,e)).state={hasError:!1},t}return(0,r5.Z)(s,[{key:"componentDidCatch",value:function(e,t){console.error("render error",e,t)}},{key:"render",value:function(){return this.state.hasError?(0,S.jsx)("div",{className:"text-red-500 font-semibold",children:(0,S.jsx)(A.cC,{id:"lKwla6"})}):this.props.children}}],[{key:"getDerivedStateFromError",value:function(e){return{hasError:!0}}}]),s}(q.Component);function mh(e){var t,n=e.content,s=e.isEditting,r=e.fontSize,a=(0,q.useState)(!1);a[0],a[1];var i=Array.isArray(n)?null===(t=n.find(function(e){return"text"===e.type}))||void 0===t?void 0:t.text:n.trim()||"",o=Array.isArray(n)?n.filter(function(e){return"image_url"===e.type||"tm_text_file"===e.type}):[];return(0,S.jsx)("div",{children:(0,S.jsxs)("div",{"data-element-id":"user-message",className:function(){for(var e=arguments.length,t=Array(e),n=0;n0||k.tool_calls.filter(Boolean).every(function(e){var t,n=$(null===(t=e.function)||void 0===t?void 0:t.name);return null==n?void 0:n.hideUsageInUserConversation}))?null:"clear-context"===k.type?(0,S.jsxs)("div",{"data-element-id":"clear-context-divider",className:mM("relative group response-block text-xs text-gray-400 text-center my-10 border-b border-gray-300 p-2 dark:border-zinc-700 dark:text-zinc-500 hover:bg-gray-50 dark:hover:bg-gray-900 rounded-md",eM?"z-10":""),children:[(0,S.jsx)("div",{className:"font-semibold",children:"Context Cleared"}),(0,S.jsx)(mm,{onMenuOpenStateChanged:eD,showCopy:!1,index:j,text:"",showEdit:!1,showRawButton:!1,showPlayButton:!1,showRaw:!1,showFork:!1,setShowRaw:ex,showDeleteButton:V,onDelete:Z,onEditMessage:function(){},onPlay:function(){},showPinArtifact:!1})]}):(0,S.jsx)(mp,{children:(0,S.jsxs)(U.u,{as:"div","data-element-id":"response-block",className:mM("pl-14 relative response-block scroll-mt-32 rounded-md hover:bg-gray-50 dark:hover:bg-white/5 pb-2 pt-2 pr-2 group min-h-[52px]",k.contextClearedAt?"opacity-50 hover:opacity-100":"",er?"bg-yellow-50 hover:bg-yellow-50 dark:bg-opacity-10 dark:bg-yellow-300 is-pinned my-6":"",eM?"z-40":""),appear:eo,show:eV,enter:"ease-out duration-300",enterFrom:"opacity-0 translate-y-4",enterTo:"opacity-100 translate-y-0",leave:"ease-in duration-200",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 translate-y-4",children:[er&&(0,S.jsx)(Y.N0Z,{"data-element-id":"push-pin-symbol",className:"w-5 h-5 mr-2 text-yellow-500 absolute right-1 -top-3"}),(0,S.jsx)("div",{"data-element-id":"chat-avatar-container",className:"absolute top-2 left-2",children:"user"===k.role?(0,S.jsxs)("button",{onClick:P,className:mM("w-9 h-9 bg-gray-200 rounded-md flex-none flex items-center justify-center text-gray-500 hover:bg-gray-300 transition-all group active:bg-gray-200 overflow-hidden hover:opacity-80 transition-all",P?"":"pointer-events-none"),children:[R?(0,S.jsx)("img",{className:"w-9 h-9 user-avatar object-cover error-fallback-gray",src:R,alt:T.ag._({id:"fVja9T"})}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(C.Xws,{className:mM("w-5 h-5 inline-block",P?"group-hover:hidden":"")}),(0,S.jsx)(C.H3h,{className:mM("w-5 h-5 hidden",P?"group-hover:inline-block":"")})]}),void 0!==_?(0,S.jsx)("div",{className:"absolute -bottom-1 -right-1 w-5 h-5 rounded-md flex items-center justify-center rounded-md overflow-hidden",children:(0,S.jsx)(sB,{size:"small",character:{avatarURL:_}})}):null]}):"system"===k.role?null:"function"===k.role?(0,S.jsx)("div",{className:"w-9 h-9 bg-gray-200 rounded-md flex-none flex items-center justify-center text-gray-500 transition-all group active:bg-gray-200 dark:bg-gray-600 overflow-hidden",children:(0,S.jsx)(s2,{plugin:X})}):"tool"===k.role?(0,S.jsx)("button",{onClick:function(){return null==D?void 0:D(k.name)},className:"flex w-9 h-9 bg-gray-200 rounded-md flex-none flex items-center justify-center text-gray-500 transition-all group active:bg-gray-200 dark:bg-gray-600 overflow-hidden",children:(0,S.jsx)(s2,{size:"regular",plugin:$(k.name)})}):k.inlineCharacterInfo?(0,S.jsx)("button",{onClick:function(){return B(k.inlineCharacterInfo)},className:"w-9 h-9 flex",children:(0,S.jsx)(sB,{size:"medium",character:{avatarURL:G}})}):(0,S.jsx)("button",{onClick:function(){null==L||L(k.model)},className:"relative w-9 h-9 flex",children:G?(0,S.jsx)("img",{src:G,className:"w-9 h-9 rounded-md flex-none object-cover error-fallback-gray"}):(0,S.jsx)(ef,{size:"medium",model:k.model,defaultURL:"/favicon-192x192.png"})})}),!z&&V&&(0,S.jsx)(mm,{index:j,text:eL,showEdit:!k.function_call&&!k.tool_calls&&"attachment"!==k.type&&"tool-response"!==k.type&&k.content,showCopy:"attachment"!==k.type&&"tool-response"!==k.type&&k.content,showRawButton:"assistant"===k.role,showPlayButton:"assistant"===k.role&&J&&eK,showRaw:eg,setShowRaw:ex,showDeleteButton:"system"!==k.role,onDelete:Z,onEditMessage:K,onPlay:function(){var e;eA(!0),eC(!0),null===(e=eB.current)||void 0===e||e.play()},showPin:"system"!==k.role,pinned:er,onPin:es,onForkChat:H,onMenuOpenStateChanged:eD},j),(0,S.jsx)("div",{className:"w-full",children:"user"===k.role?(0,S.jsxs)(S.Fragment,{children:["attachment"===k.type?(0,S.jsx)("div",{children:(0,S.jsxs)("div",{className:"text-sm text-gray-500 flex items-start justify-start gap-2",children:[(0,S.jsx)("div",{className:"w-9 h-9 bg-gray-200 dark:bg-gray-700 rounded-md flex items-center justify-center flex-shrink-0",children:(0,S.jsx)(C.jLr,{className:"w-4 h-4"})}),(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"font-semibold ",children:null!==(b=k.metadata)&&void 0!==b&&b.name?(0,S.jsx)("span",{children:null===(v=k.metadata)||void 0===v?void 0:v.name}):(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"wVeekH"})})}),k.metadata?(0,S.jsxs)("div",{className:"text-xs text-gray-500",children:[(0,S.jsx)(A.cC,{id:"IPXOXm",values:{0:k.metadata.characters}}),", ",(0,S.jsx)(A.cC,{id:"G1lxoh",values:{0:k.metadata.estimatedTokens}})]}):null]})]})}):(0,S.jsx)(mh,{fontSize:en,isEditting:z,generalInstructions:F,content:k.content}),z?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("div",{className:"my-2 text-xs",children:(0,S.jsx)(A.cC,{id:"1w2Cpf"})}),(0,S.jsxs)("button",{onClick:function(){return H(j,!0)},className:"fork-chat-button inline-flex items-center justify-center rounded-md px-3 py-2 text-sm shadow-md text-white bg-orange-500 transition-all active:bg-orange-500 hover:bg-orange-600 group space-x-2",children:[(0,S.jsx)(M.U8C,{className:"w-6 h-6 rotate-180"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"JRJf8U"})})]}),(0,S.jsx)(sL.u,{anchorSelect:".fork-chat-button",place:"top",children:(0,S.jsx)(A.cC,{id:"d9HU83"})})]}):null]}):"system"===k.role?(0,S.jsx)("div",{children:(void 0===I||I)&&e_?(0,S.jsxs)("div",{"data-element-id":"model-setting-info",className:"text-gray-500 text-xs mb-1 whitespace-pre-line",children:[(0,S.jsx)(A.cC,{id:"vawWq6"})," ",(ev?e_:eZ)||(0,S.jsx)("i",{children:(0,S.jsx)(A.cC,{id:"rjoGU7"})}),!ev&&eZ.length2&&void 0!==arguments[2]?arguments[2]:50,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2;if(t.trim().length50?"..."+e.description.substring(l-20,l):e.description.substring(0,l),(0,S.jsx)("span",{className:"bg-yellow-500 text-black",children:e.description.substring(l,l+t.length)}),e.description.substring(l+t.length)),r[e.id].description=o}return n||i}).slice(0,n),highlighted:r}},mY=function(){try{return JSON.parse((0,K.cF)().getItem("TM_useChatList")||"[]").filter(function(e,t,n){return t===n.findIndex(function(t){return t.id===e.id})})}catch(e){return console.error(e),[]}},mU=[{id:"open-ai-characters",title:"Open AI Agents",titleMsg:{id:"v0YINs"},icon:C.q1E},{id:"open-prompt-library",title:"Open Prompt Library",titleMsg:{id:"zx1wgl"},icon:C.Mp$},{id:"switch-chat-model",title:"Open Model Settings",titleMsg:{id:"N5tvE6"},icon:e4.NNQ}];function mH(e){var t=e.canUseCommunityPrompts,n=e.onEscape,s=e.onSelected,r=e.showFooter,a=void 0===r||r,i=e.systemCharacters,o=e.orgPrompts,l=e.systemModels,c=e.modelEnabledMap,d=e.allowChangeModel,u=e.showModel,m=e.showCharacters,p=e.showPromptsLibrary,h=us(),g=(0,q.useState)(""),f=g[0],b=g[1],w=(0,nK.A)([]),k=(0,y.Z)(w,1)[0],N=(0,nG.Q)(null),C=(0,y.Z)(N,1)[0],I=(0,q.useRef)();(0,q.useMemo)(mY,[]);var E=eB(f,500),V=_(),P=V.serverHostConfig.chatFeatures,T=mK([]),M=(0,y.Z)(T,2),D=M[0];M[1];var B=V.serverHostConfig;B.enableClaude,B.enableGPT;var L=V.userDataStoreRef,R=(0,q.useMemo)(function(){return d?[].concat((0,v.Z)(l||[]),(0,v.Z)(O.L),(0,v.Z)(D||[])).filter(function(e){return!!e.system||!c||c[e.id]}).map(function(e){return mZ(mZ({formattedTitle:e.title.toLowerCase()+" "+e.title.split("-").join(" ").toLowerCase()},e),{},{type:"model"})}):[]},[c,l,d]),Z=(0,q.useMemo)(function(){return f.length<2?[]:R.filter(function(e){return e.formattedTitle.includes(f.toLowerCase())})},[R,f]),K=(0,q.useState)({filteredChats:[],highlighted:{}}),G=K[0],F=K[1],Y=(0,A.mV)().i18n,U=(0,q.useMemo)(function(){var e=mF([].concat((0,v.Z)(k),(0,v.Z)((o||[]).map(function(e){return mZ(mZ({},e),{},{isFromOrg:!0})}))),f),t=e.filteredList,n=e.highlighted,s=(0,O.N7)("defaultCharacters",P)?C||[]:(C||[]).filter(function(e){return"system"!==e.type}),r=mF([].concat((0,v.Z)(s),(0,v.Z)((i||[]).map(function(e){return mZ(mZ({},e),{},{isFromOrg:!0})}))),f),a=r.filteredList,l=r.highlighted;return{prompts:t,characters:a,highlighted:mZ(mZ({},n),l)}},[k,C,f,t,i,o,P,Y.locale]),H=(0,q.useMemo)(function(){return mU.filter(function(e){return("open-prompt-library"!==e.id||!!p)&&("open-ai-characters"!==e.id||!!m)&&("switch-chat-model"!==e.id||!!u)&&(!f||e.title.toLowerCase().includes(f.toLowerCase()))})},[f,u,p,m]);function z(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.reset;b(""),n&&n({reset:t})}return(0,q.useEffect)(function(){(0,x.Z)(j().mark(function e(){return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(f.length>=2)){e.next=7;break}return e.next=3,L.current.searchChats(f);case 3:F(e.sent),e.next=8;break;case 7:F({filteredChats:[],highlighted:{}});case 8:case"end":return e.stop()}},e)}))()},[E]),(0,q.useEffect)(function(){var e;null===(e=I.current)||void 0===e||e.focus()},[]),(0,S.jsx)(nI.hQ,{onChange:function(e){e&&(z(),s(e,f),b(""),null!=e&&e.isFromOrg&&["prompt"].includes(e.type)&&h({promptID:e.id}))},children:function(e){var t,n,s,r,i,o,l=e.activeOption;return(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"relative px-4 pt-4",children:(0,S.jsx)(nI.gA,{className:"w-full border border-gray-300 dark:border-gray-700 rounded-lg px-4 py-2 focus:outline-none focus:border-blue-500 dark:focus:border-blue-500 dark:bg-zinc-800",type:"search",onChange:function(e){b(e.target.value)},placeholder:Y._({id:"A1taO8"}),onKeyDownCapture:function(e){"Escape"===e.key&&z(),"Backspace"===e.key&&0===f.length&&z({reset:!0})},ref:I})}),(0,S.jsx)("div",{className:"h-60 mt-4 px-4 overflow-auto",children:(0,S.jsxs)(nI.L5,{as:"div",static:!0,className:"w-full py-1 text-base focus:outline-none sm:text-sm",children:[f.length<2?""===f?(0,S.jsx)("div",{className:"relative text-center text-gray-500",children:(0,S.jsx)(A.cC,{id:"6u87ha"})}):(0,S.jsx)("div",{className:"relative text-center text-gray-500",children:(0,S.jsx)(A.cC,{id:"4elSI1"})}):null!==(t=G.filteredChats)&&void 0!==t&&t.length||null!==(n=U.prompts)&&void 0!==n&&n.length||null!==(s=U.characters)&&void 0!==s&&s.length||Z.length?(0,S.jsxs)("div",{className:"space-y-4",children:[Z.length>0&&(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"text-sm font-medium",children:(0,S.jsx)(A.cC,{id:"//nm2/"})},"prompts"),(0,S.jsx)("div",{className:"mt-2 pl-2 space-y-2",children:Z.map(function(e){return(0,S.jsx)("div",{children:(0,S.jsx)(nI.O2,{as:"div",className:function(e){return mG("cursor-default select-none p-2 border border-gray-200 dark:border-gray-600 rounded-lg",e.focus&&"!bg-blue-600")},value:e,children:function(t){var n=t.focus;return(0,S.jsx)(dy,{title:Y._({id:"1+P9RR",values:{0:e.title}}),active:n})}})},e.id)})})]}),(null===(r=U.prompts)||void 0===r?void 0:r.length)>0&&(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"text-sm font-medium",children:(0,S.jsx)(A.cC,{id:"Qmr3jO"})},"prompts"),(0,S.jsx)("div",{className:"mt-2 pl-2 space-y-2",children:U.prompts.map(function(e){return(0,S.jsx)("div",{children:(0,S.jsx)(nI.O2,{as:"div",className:function(e){return mG("cursor-default select-none p-2 border border-gray-200 dark:border-gray-600 rounded-lg",e.focus&&"!bg-blue-600")},value:mZ(mZ({},e),{},{type:"prompt"}),children:function(t){var n,s,r,a=t.focus;return(0,S.jsx)(dy,{title:(null===(n=U.highlighted[e.id])||void 0===n?void 0:n.title)||e.title,description:(null===(s=U.highlighted[e.id])||void 0===s?void 0:s.description)||(null===(r=e.description)||void 0===r?void 0:r.substring(0,50)),active:a})}})},e.id)})})]}),(null===(i=U.characters)||void 0===i?void 0:i.length)>0&&(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"text-sm font-medium",children:(0,S.jsx)(A.cC,{id:"wQoVcC"})}),(0,S.jsx)("div",{className:"mt-2 pl-2 space-y-2",children:U.characters.map(function(e){return(0,S.jsx)("div",{children:(0,S.jsx)(nI.O2,{as:"div",className:function(e){return mG("cursor-default select-none p-2 border border-gray-200 dark:border-gray-600 rounded-lg",e.focus&&"!bg-blue-600")},value:mZ(mZ({},e),{},{type:"character"}),children:function(t){var n,s,r,a=t.focus;return(0,S.jsx)(dy,{title:(null===(n=U.highlighted[e.id])||void 0===n?void 0:n.title)||e.title,description:(null===(s=U.highlighted[e.id])||void 0===s?void 0:s.description)||(null===(r=e.description)||void 0===r?void 0:r.substring(0,50)),active:a})}})},e.id)})})]}),(null===(o=G.filteredChats)||void 0===o?void 0:o.length)>0&&(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"text-sm font-medium",children:(0,S.jsx)(A.cC,{id:"8Q+lLG"})},"chats"),(0,S.jsx)("div",{className:"mt-2 pl-2 space-y-2",children:G.filteredChats.map(function(e){return(0,S.jsx)("div",{children:(0,S.jsx)(nI.O2,{as:"div",className:function(e){return mG("cursor-default select-none p-2 border border-gray-200 dark:border-gray-600 rounded-lg",e.focus&&"!bg-blue-600")},value:e,children:function(t){var n,s,r,a=t.focus;return(0,S.jsx)(dy,{title:(null===(n=G.highlighted[e.id])||void 0===n?void 0:n.title)||e.title||Y._({id:"q2+WzE"}),description:(null===(s=G.highlighted[e.id])||void 0===s?void 0:s.preview)||(null===(r=e.preview)||void 0===r?void 0:r.substring(0,50)),active:a})}})},e.id)})})]})]}):(0,S.jsx)("div",{className:"relative text-center",children:"Nothing found"}),(0,S.jsx)("div",{className:"mt-4 space-y-2",children:H.map(function(e){return(0,S.jsx)(nI.O2,{as:"div",className:function(e){return mG("cursor-default select-none p-2 border border-gray-200 dark:border-gray-600 rounded-lg",e.focus&&"!bg-blue-600")},value:{action:e.id},children:function(t){var n=t.focus;return(0,S.jsxs)("div",{className:mG("text-black dark:text-white font-medium truncate w-full",n&&"!text-white"),children:[(0,S.jsx)(e.icon,{className:"inline-block mr-2"}),(0,S.jsx)("span",{children:Y._(e.titleMsg)})]})}},e.id)})})]})}),a&&(0,S.jsxs)("div",{className:"hidden md:flex mt-4 text-xs items-center p-4 space-x-4 border-t border-gray-300 dark:border-gray-700",children:[(0,S.jsxs)("div",{className:"space-x-1",children:[(0,S.jsx)("kbd",{className:"text-white rounded-md bg-gray-700 py-0.5 px-2",children:"Esc"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"UbVgIu"})})]}),(0,S.jsxs)("div",{className:"space-x-1",children:[(0,S.jsx)("kbd",{className:"text-white rounded-md bg-gray-700 py-0.5 px-2",children:"⬆"}),(0,S.jsx)("kbd",{className:"text-white rounded-md bg-gray-700 py-0.5 px-2",children:"⬇"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"S0fQBK"})})]}),(0,S.jsxs)("div",{className:"space-x-1",children:[(0,S.jsx)("kbd",{className:"text-white rounded-md bg-gray-700 py-0.5 px-2",children:"Enter"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"3fpIq1",values:{0:null!=l&&l.prompt?Y._({id:"1Il5lG"}):null!=l&&l.instruction?Y._({id:"jDO+4L"}):null!=l&&l.preview?Y._({id:"DzE6FV"}):"select"}})})]})]})]})}})}var mz=(0,K.eK)("useKeyboardShortcuts");function mW(e){var t=e.children,n=e.className,s=e.canUseCommunityPrompts,r=e.open,a=e.setOpen,i=e.controlled,o=e.onSelected,l=e.systemCharacters,c=e.orgPrompts,d=e.modelEnabledMap,u=e.systemModels,m=e.setModel,p=e.allowChangeModel,h=e.showPromptsLibrary,g=e.showCharacters,f=e.showModel,x=(0,q.useState)(!1),b=x[0],v=x[1],w=mz({search:"K"}),j=(0,y.Z)(w,1)[0];function A(){i?a(!1):v(!1)}function k(){i?a(!0):v(!0)}return(0,di.y1)("mod+".concat(j.search),function(){k()},{enabled:!!j.search,enableOnFormTags:!0,preventDefault:!0}),(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("button",{"data-element-id":"search-shortcut-button",className:n,onClick:k,children:t}),(0,S.jsx)(U.u,{show:i?r:b,as:q.Fragment,children:(0,S.jsxs)(H.Vq,{unmount:!0,as:"div",className:"relative z-[70]",onClose:A,children:[(0,S.jsx)(U.x,{as:q.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,S.jsx)("div",{className:"fixed inset-0 bg-gray-800 bg-opacity-75"})}),(0,S.jsx)("div",{className:"fixed z-20 inset-0 overflow-y-auto",children:(0,S.jsx)("div",{className:"flex min-h-full items-center justify-center p-4 text-center",children:(0,S.jsx)(U.x,{as:q.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 scale-95",enterTo:"opacity-100 scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 scale-100",leaveTo:"opacity-0 scale-95",children:(0,S.jsx)(H.EM,{className:"w-full max-w-lg transform overflow-hidden rounded-lg bg-white dark:bg-zinc-900 text-left align-middle shadow-xl transition-all",children:(0,S.jsx)(mH,{canUseCommunityPrompts:s,onEscape:A,onSelected:function(e){o(e),A()},systemCharacters:l,orgPrompts:c,modelEnabledMap:d,systemModels:u,setModel:m,allowChangeModel:p,showPromptsLibrary:h,showCharacters:g,showModel:f})})})})})]})})]})}var mQ=(0,K.eK)("useGeminiAPIKey"),mJ=(0,q.memo)(function(e){var t,n,s,r=e.onCompleted,a=e.showChangeAPIKey,i=e.isAPIKeyOptional,o=mQ(""),l=(0,y.Z)(o,2),c=l[0],d=l[1],u=(0,q.useState)(""),m=u[0],p=u[1],h=(0,q.useState)(!1),g=h[0],f=h[1],b=(0,q.useState)(!1),v=b[0],w=b[1],k=(0,q.useState)(!1),N=k[0],C=k[1],I=(0,q.useState)(c),O=I[0],V=I[1],P=(0,q.useState)(!1);P[0],P[1];var M=(0,q.useState)(!i),D=M[0],B=M[1];(0,q.useEffect)(function(){N&&B(!i)},[N]),(0,q.useEffect)(function(){c&&V(c)},[c]);var L=(t=(0,x.Z)(j().mark(function e(){return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:C(!0);case 1:case"end":return e.stop()}},e)})),function(){return t.apply(this,arguments)}),R=(n=(0,x.Z)(j().mark(function e(){var t;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(p(""),!(null!==(t=O))){e.next=16;break}if(""!==t){e.next=8;break}return d(""),C(!1),r&&r(),e.abrupt("return");case 8:return e.next=10,_(t);case 10:if(!e.sent){e.next=16;break}d(t),w(!0),C(!1),r&&r(),setTimeout(function(){w(!1)},5e3);case 16:case"end":return e.stop()}},e)})),function(){return n.apply(this,arguments)}),_=(s=(0,x.Z)(j().mark(function e(t){var n,s,r,a,i,o,l;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return f(!0),e.prev=1,e.next=4,fetch("https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=".concat(O),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({contents:[{role:"user",parts:[{text:"hello"}]}]})});case 4:if((n=e.sent).ok){e.next=21;break}return e.prev=6,e.next=9,n.json();case 9:if(o=e.sent,!(400===n.status&&((null===(s=o.error)||void 0===s?void 0:s.status)==="INVALID_ARGUMENT"||(null===(r=o[0])||void 0===r?void 0:r.error.status)==="INVALID_ARGUMENT"))){e.next=13;break}return p(T.ag._({id:"EPw/o1"})),e.abrupt("return",null);case 13:return p(T.ag._({id:"Ukcq58"})+(null===(a=o.error)||void 0===a?void 0:a.message)||(null===(i=o[0])||void 0===i?void 0:i.error.message)),e.abrupt("return",null);case 17:return e.prev=17,e.t0=e.catch(6),p(T.ag._({id:"NIkO92"})+n.status),e.abrupt("return",null);case 21:return e.next=23,n.json();case 23:return l=e.sent,e.abrupt("return",l);case 27:e.prev=27,e.t1=e.catch(1),p(T.ag._({id:"qoF6OQ"})),console.error(e.t1);case 31:f(!1);case 32:case"end":return e.stop()}},e,null,[[1,27],[6,17]])})),function(e){return s.apply(this,arguments)});return(0,S.jsxs)("div",{className:"",children:[v&&(0,S.jsxs)("div",{className:"flex items-center justify-center ",children:[(0,S.jsx)("div",{className:"text-green-500 text-sm font-semibold my-2",children:(0,S.jsx)(A.cC,{id:"f0rbKh"})}),(0,S.jsx)(lL.Z,{})]}),c?void 0!==a&&a?(0,S.jsx)("div",{className:"text-center mb-2 ",children:(0,S.jsxs)("button",{id:"enter-api-key-btn",disabled:g,className:"inline-flex items-center justify-center rounded-full px-4 py-3 text-sm shadow-md bg-blue-600 text-white hover:bg-blue-500 transition-all active:bg-blue-600 group font-semibold text-sm disabled:bg-gray-400 space-x-2",onClick:L,children:[g?(0,S.jsx)(E,{}):(0,S.jsx)(e2.itj,{className:"w-5 h-5"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"h3vADk"})})]})}):null:(0,S.jsx)("button",{id:"enter-api-key-btn",className:"text-gray-500 hover:underline",onClick:L}),(0,S.jsxs)(X,{open:N,setOpen:C,showCloseButton:!1,children:[i&&!D?(0,S.jsxs)("div",{children:[(0,S.jsxs)("h2",{className:"text-center text-xl font-bold flex items-center justify-center gap-2",children:[(0,S.jsx)(ef,{model:"claude-v1"})," ",(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"U2SXTH"})})]}),(0,S.jsx)(uM,{onUseOwnAPIKey:function(){return B(!0)},onGotIt:function(){return C(!1)}})]}):null,D?(0,S.jsxs)("div",{children:[(0,S.jsxs)("h2",{className:"text-center text-xl font-bold flex items-center justify-center gap-2",children:[(0,S.jsx)(ef,{model:"gemini"})," ",(0,S.jsxs)("span",{children:[(0,S.jsx)(A.cC,{id:"4s7UWR"}),":"]})]}),(0,S.jsx)("div",{className:"my-4",children:(0,S.jsx)(A.cC,{id:"K3giZ9"})}),(0,S.jsx)("div",{className:"text-xs",children:(0,S.jsx)(A.cC,{id:"yX4ZJX"})}),(0,S.jsx)("div",{className:"my-4",children:(0,S.jsx)("input",{type:"text",placeholder:"AIxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm dark:bg-zinc-700",value:O,autoComplete:"off",onChange:function(e){return V(e.target.value)},onKeyDown:function(e){"Enter"===e.key&&(e.preventDefault(),R())},disabled:g})}),(0,S.jsx)("div",{className:"my-4 text-center",children:(0,S.jsxs)("a",{className:"text-blue-500 text-xs hover:underline",target:"_blank",rel:"noopener noreferrer",href:"https://makersuite.google.com/app/apikey",children:["→"," ",(0,S.jsx)(A.cC,{id:"SitPcJ"})]})}),m?(0,S.jsx)("div",{className:"text-sm text-center text-red-500",children:m}):null,(0,S.jsxs)("div",{className:"my-2 text-center space-x-2 flex items-center justify-center",children:[(0,S.jsxs)("button",{disabled:g,onClick:function(){return R()},className:"inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 space-x-1 disabled:bg-gray-400",children:[g?(0,S.jsx)(E,{}):(0,S.jsx)(Y.bzc,{className:"w-4 h-4"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"tfDRzk"})})]}),(0,S.jsx)("button",{disabled:g,onClick:function(){return C(!1)},className:"inline-flex items-center px-4 py-2 text-sm font-medium rounded-md text-gray-500 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 space-x-1",children:(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"dEgA5A"})})})]})]}):null]})]})});function mX(e){var t=e.className;return(0,S.jsxs)("svg",{width:"512",height:"512",viewBox:"0 0 512 512",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[(0,S.jsx)("path",{d:"M410.121 0H101.879C45.6125 0 0 45.6125 0 101.879V410.121C0 466.388 45.6125 512 101.879 512H410.121C466.388 512 512 466.388 512 410.121V101.879C512 45.6125 466.388 0 410.121 0Z",fill:"#FFB319"}),(0,S.jsx)("path",{d:"M297.731 375.79H211.319C187.568 375.79 183.953 350.318 188.38 340.093C190.491 335.241 195.271 328.218 199.795 322.48C216.994 331.976 236.322 336.947 255.968 336.927C286.917 336.891 316.588 324.58 338.47 302.695C360.354 280.81 372.661 251.138 372.694 220.189C372.701 203.83 369.261 187.652 362.598 172.711C355.935 157.769 346.199 144.4 334.023 133.473L336.704 130.756C339.84 127.566 343.656 125.126 347.868 123.618C352.079 122.11 356.576 121.573 361.025 122.047L375.071 123.539V66.3224H350.52C337.213 66.3293 324.213 70.3151 313.189 77.7681C302.166 85.2211 293.623 95.7999 288.658 108.146C278.02 105.031 266.992 103.45 255.908 103.452C224.958 103.487 195.286 115.798 173.4 137.682C151.516 159.568 139.205 189.239 139.17 220.189C139.139 245.073 147.099 269.309 161.877 289.329L154.963 294.654C153.931 295.443 152.755 296.437 151.543 297.578C127.89 319.629 117.045 348.523 123.243 380.654C126.64 398.255 141.584 416.535 156.795 426.227C167.619 433.032 180.132 436.671 192.917 436.731L289.798 432.801C295.179 432.788 300.475 434.138 305.194 436.723C309.913 439.308 313.901 443.046 316.787 447.587L329.45 470.44L389.505 450.365L379.232 427.998C372.064 412.411 360.575 399.208 346.13 389.955C331.684 380.701 314.887 375.786 297.731 375.79ZM255.968 164.355C270.758 164.381 284.936 170.268 295.394 180.727C305.853 191.185 311.739 205.363 311.765 220.153C311.739 234.943 305.853 249.12 295.394 259.579C284.936 270.038 270.758 275.924 255.968 275.95C241.178 275.924 227.001 270.038 216.542 259.579C206.083 249.12 200.196 234.943 200.17 220.153C200.196 205.363 206.083 191.185 216.542 180.727C227.001 170.268 241.178 164.381 255.968 164.355Z",fill:"#191919"})]})}var m$=(0,K.eK)("useShowNextMessageContentTokens"),m0=function(e){var t=e.content,n=e.className,s=e.model,r=e.showEstimatedCost,a=m$(!1),i=(0,y.Z)(a,2),o=i[0];i[1];var l=eB(t,300),c=(0,q.useMemo)(function(){return o?(0,O.fI)(l):0},[l,o]),d=(0,q.useMemo)(function(){return c&&s&&r?(0,O.Mq)(c,s):0},[c,s,r]);return o?(0,S.jsxs)("p",{className:(0,O.AK)("text-xs text-gray-500",n),children:[(0,S.jsx)(A.cC,{id:"lo2Y4Y",values:{estimatedTokens:c}})," ",d?(0,S.jsxs)("span",{children:["($",d,")"]}):null]}):null};function m1(e){var t=e.open,n=e.setOpen,s=e.modelID,r=e.characterID,a=(0,q.useState)(!1),i=a[0],o=a[1],l=(0,q.useState)(!1),c=l[0],d=l[1],u=(0,q.useState)([]),m=u[0],p=u[1],h=(0,q.useCallback)((0,x.Z)(j().mark(function e(){var t;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,o(!0),d(""),e.next=5,fetch("/api/hosted/applicable-limits?".concat(new URLSearchParams({characterID:r,modelID:s}).toString())).then(function(e){return e.json()});case 5:p((null==(t=e.sent)?void 0:t.applicableLimits)||[]),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(0),d(T.ag._({id:"fWsBTs"}));case 12:return e.prev=12,o(!1),e.finish(12);case 15:case"end":return e.stop()}},e,null,[[0,9,12,15]])})),[s,r]);return(0,q.useEffect)(function(){t&&h()},[t,h]),(0,S.jsxs)(X,{open:t,setOpen:n,showCloseButton:!0,children:[(0,S.jsx)("h2",{className:"text-center text-xl font-bold",children:(0,S.jsx)(A.cC,{id:"6BDqha"})}),(0,S.jsx)("div",{className:"space-y-8 mt-4",children:i?(0,S.jsx)("div",{className:"flex justify-center",children:(0,S.jsx)(E,{})}):c?(0,S.jsx)("p",{className:"text-center text-red-500",children:c}):0===m.length?(0,S.jsx)("p",{className:"text-center",children:"There are no limits for this chat!"}):(0,S.jsx)("div",{children:(0,S.jsx)("ul",{className:"list-disc space-y-2 px-4 mt-4",children:m.map(function(e,t){return e.limitBy===al.MESSAGES_BY_TIME?(0,S.jsxs)("li",{children:[(0,S.jsx)(A.cC,{id:"Cwe7mf",values:{0:e.quantity}})," ","hour"===e.timeUnit?(0,S.jsx)(A.cC,{id:"6UqxzA",values:{0:e.timeValue}}):"day"===e.timeUnit?(0,S.jsx)(A.cC,{id:"Betvyb",values:{0:e.timeValue}}):(0,S.jsx)(A.cC,{id:"BRJBtW",values:{0:e.timeValue}}),","," ",(0,S.jsx)("b",{children:(0,S.jsx)(A.cC,{id:"2OP12J",values:{0:e.usage,1:e.quantity}})})]},t):e.limitBy===al.CHARACTERS_BY_MESSAGE_AND_TIME?(0,S.jsxs)("li",{children:[(0,S.jsx)(A.cC,{id:"IPXOXm",values:{0:e.quantity}})," ","hour"===e.timeUnit?(0,S.jsx)(A.cC,{id:"6UqxzA",values:{0:e.timeValue}}):"day"===e.timeUnit?(0,S.jsx)(A.cC,{id:"Betvyb",values:{0:e.timeValue}}):(0,S.jsx)(A.cC,{id:"BRJBtW",values:{0:e.timeValue}}),","," ",(0,S.jsx)("b",{children:(0,S.jsx)(A.cC,{id:"2OP12J",values:{0:e.usage||0,1:e.quantity}})})]},t):e.limitBy===al.CHARACTERS_BY_MESSAGE?(0,S.jsx)("li",{children:(0,S.jsx)(A.cC,{id:"myhHcE",values:{0:e.quantity}})}):null})})})})]})}var m2=function(e){var t=e.messages,n=e.sidebarOpen,s=e.onCloseDesktopSidebar,r=e.enabled,a=(0,q.useState)(!1),i=a[0],o=a[1],l=(0,q.useState)(null),c=l[0],d=l[1],u=(0,q.useState)(!1),m=u[0],p=u[1],h=(0,q.useRef)(!1),g=(0,q.useRef)([]);(0,q.useEffect)(function(){var e=function(){p(window.innerWidth>=2e3)};return e(),window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}},[]);var f=(0,q.useMemo)(function(){return t.filter(function(e){return(0,O.uD)(e)})},[t]),x=(0,q.useMemo)(function(){for(var e=new Map,t=f.length-1;t>=0;t--){var n=f[t],s=e.get(n.name);s?(s.unshift(n),e.set(n.name,s)):e.set(n.name,[n])}return e},[f]),b=(0,q.useCallback)(function(e){var t=g.current.find(function(t){return t.uuid===e});t&&(d(t),o(!0),window.innerWidth<2e3&&s())},[]);return(0,q.useEffect)(function(){if(i&&c&&!f.find(function(e){return e.uuid===c.uuid})){var e=f[f.length-1];d(e||null),e||o(!1)}},[f,i]),(0,q.useEffect)(function(){g.current=f},[f]),(0,q.useEffect)(function(){f.length&&h.current&&r&&(d(f[f.length-1]),o(!0),window.innerWidth<2e3&&s()),h.current=!1},[f,r]),(0,q.useEffect)(function(){n&&!m&&o(!1)},[n,m]),{artifacts:f,showArtifacts:i,setShowArtifacts:o,showNextLatestArtifact:function(){h.current=!0},selectedArtifact:c,artifactsGroupsMap:x,selectArtifact:b}};function m4(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,s)}return n}function m5(e){for(var t=1;t1&&(r+=" - "+T.ag._({id:"YYdC3A",values:{0:t+1}})),m5(m5({},e),{},{label:r})}).reverse()})},[m]);if(-1===v)return null;var w=(0,S.jsxs)(eU.v2,{as:"div",className:"sm:relative z-30 min-w-0",children:[(0,S.jsxs)(eU.j2,{className:"flex w-full items-center justify-center gap-2 p-2 rounded-md hover:bg-black/5 active:bg-black/10 transition-colors",children:[(0,S.jsx)("span",{className:"block font-semibold text-base truncate min-w-0",children:null===(t=y.find(function(e){return e.uuid===u.uuid}))||void 0===t?void 0:t.label}),(0,S.jsx)(C.iUH,{className:"w-4 h-4 text-gray-500"})]}),(0,S.jsx)(U.u,{as:q.Fragment,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:(0,S.jsx)(eU.sd,{modal:!1,style:{maxHeight:f},className:"absolute overflow-auto left-4 right-4 sm:right-auto sm:left-0 z-10 mt-2 origin-top-right divide-y divide-gray-100 dark:divide-gray-700 rounded-md bg-white dark:bg-zinc-900 shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none p-2",children:y.map(function(e){return(0,S.jsx)(eU.sN,{children:function(t){var n=t.focus;return(0,S.jsx)("button",{className:(0,O.AK)("w-full flex items-center justify-between px-3 py-2.5 sm:py-2 sm:text-sm sm:font-normal text-base font-medium cursor-pointer",n?"bg-gray-100 dark:bg-gray-700":""),onClick:function(){p(e.uuid)},children:(0,S.jsx)("span",{className:"block whitespace-nowrap",children:e.label})})}},e.uuid)})})})]});return(0,S.jsxs)("div",{className:"hidden lg:flex flex-col w-[--artifacts-width] fixed z-30 top-0 bottom-0 right-0 p-4 pb-0 overflow-auto shadow-lg",children:[(0,S.jsx)("div",{className:"isolate",children:"html"===u.format||(null===(n=u.pluginResponse)||void 0===n?void 0:n.type)==="render_html"||(null===(s=u.pluginResponse)||void 0===s?void 0:s.type)==="html"?(0,S.jsx)("div",{className:"-mt-4",children:(0,S.jsx)(mu,{pluginName:u.name,data:{source:null===(r=u.pluginResponse)||void 0===r?void 0:r.data,options:null===(a=u.pluginResponse)||void 0===a?void 0:a.options,inputParams:null===(i=u.pluginResponse)||void 0===i?void 0:i.inputParams},shouldShowInteractive:!0,contentHeight:f,navbarItem:w,onUnpinArtifacts:h},u.uuid+f)}):"markdown"===u.format||(null===(o=u.pluginResponse)||void 0===o?void 0:o.type)==="render_markdown"||(null===(l=u.pluginResponse)||void 0===l?void 0:l.type)==="markdown"?(0,S.jsx)(ot,{children:((null===(c=u.pluginResponse)||void 0===c?void 0:c.data)||u.content||"").replace(/\{\{FORMAT_NOTE\}\}[\s\S]*\{\{\/FORMAT_NOTE\}\}$/,""),remarkPlugins:mP,rehypePlugins:mT,components:mV,contentHeight:f,showNavbar:!0,navbarItem:w,onUnpinArtifacts:h},u.uuid+f):null}),b.length>1&&(0,S.jsxs)("div",{className:"mt-auto -mx-4 sticky z-10 bottom-0 left-0 bg-white dark:bg-[#09101b] shadow-lg px-4 py-2 flex justify-center gap-2",children:[(0,S.jsx)("button",{type:"button",className:"rounded-md border-0 py-1 px-2 text-gray-900 dark:text-white dark:bg-zinc-700 ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-blue-600 sm:text-sm sm:leading-6 disabled:opacity-30",disabled:0===v,onClick:function(){p(b[v-1].uuid)},children:(0,S.jsx)(e4.DEl,{size:20})}),(0,S.jsx)("select",{className:"rounded-md border-0 py-1 px-2 pr-10 text-gray-900 dark:text-white dark:bg-zinc-700 ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-blue-600 sm:text-sm sm:leading-6",value:u.uuid,onChange:function(e){return p(e.target.value)},children:b.map(function(e,t){return(0,S.jsxs)("option",{value:e.uuid,children:["Version ",t+1]},t)})}),(0,S.jsx)("button",{type:"button",className:"rounded-md border-0 py-1 px-2 text-gray-900 dark:text-white dark:bg-zinc-700 ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-blue-600 sm:text-sm sm:leading-6 disabled:opacity-30",disabled:v===b.length-1,onClick:function(){p(b[v+1].uuid)},children:(0,S.jsx)(e4.MOd,{size:20})})]})]})}function m6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,s)}return n}function m7(e){for(var t=1;t0&&void 0!==u[0]?u[0]:O.cl,r=(s=u.length>1&&void 0!==u[1]?u[1]:{}).character,a=s.currentProfile,i=s.lastUserMessage,o=s.chatID,l=s.memoryEntries,c=s.cacheEnabled,d="",d=null!=r&&r.overrideSystemInstruction?"":n,null!=r&&r.instruction&&(d+=["","",''),"",r.instruction,"","",""].join("\n")),!(null!=r&&null!==(t=r.dynamicContextEndpoints)&&void 0!==t&&t.length)){e.next=10;break}return e.t0=d,e.next=9,s7({endpoints:r.dynamicContextEndpoints,variables:{chatID:o,lastUserMessage:i,characterID:r.id},withCache:dx});case 9:d=e.t0+=e.sent;case 10:return(null!=a&&a.information||null!=a&&a.customInstruction)&&(d+=["","",(0,O.HW)(a),""].join("\n")),null!=l&&l.length&&(d+=["","","","These are the note entries from your long-term memory with the users. Under normal circumstances, you don't need to mention or talk about these memory entries. However, you will use your knowledge from these memory entries to make your answer more relevant to the user when needed. Memory entries are recorded at a specific time in the past; some may be outdated.","","",l.map(function(e){return"- ".concat(e.createdAt?"".concat(new Date(e.createdAt).toISOString(),": "):"").concat(e.text)}).join("\n"),"","",""].join("\n")),d=c?(d||"").replaceAll("{local_date}",new Date().toDateString()).replaceAll("{local_time}",""):(d||"").replaceAll("{local_date}",new Date().toDateString()).replaceAll("{local_time}",new Date().toTimeString()),e.abrupt("return",{role:"system",content:d});case 14:case"end":return e.stop()}},e)})),function(){return p.apply(this,arguments)}),pL=function(e){var t,n="string"==typeof e?e:Array.isArray(e)?null===(t=e.find(function(e){return"text"===e.type}))||void 0===t?void 0:t.text:"";if(!n)return!1;var s=n.match(/{{(.*?)}}/g);return!!s&&s.length>1};rr.yZ.OK;var pR=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];arguments.length>2&&arguments[2];var n=e;n||(n=document.body.scrollHeight),window.scrollTo({top:n,behavior:function(){try{return window.self!==window.top}catch(e){return!0}}()||!t?void 0:"smooth"})},p_=function(e,t){pR(e,!1,t)},pZ=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end",t=arguments.length>1?arguments[1]:void 0,n=document.querySelectorAll(".response-block"),s=n[n.length-1];pR(Math.max((null==s?void 0:s.offsetTop)-100+("end"===e?null==s?void 0:s.offsetHeight:0),0),!0,t)},pK=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end",t=arguments.length>1?arguments[1]:void 0,n=document.querySelectorAll(".response-block")[0];pR(Math.max((null==n?void 0:n.offsetTop)-100+("end"===e?null==n?void 0:n.offsetHeight:0),0),!0,t)},pG=tY().throttle(function(){return p_(void 0,"throttle_scroll")},100);function pF(e){var t,n,s,r,a,i,o,l,c,d,u,m,p,h,g,f,w,k,N,E,V,P,T,M,D,B,L,R,Z,K,G,F,H,z,W,Q,J,$,ee,et,en,es,er,ea,ei,eo,el,ec,ed,eu,em,ep,eh,eg,ex,eb,ev,ey,ew,ej,eA,ek=e.apiKey,eN=e.anthropicAPIKey,eI=e.geminiAPIKey,eE=e.licenseKey,eO=e.chatID,eV=e.chatTitle,eP=e.overrideBotAvatarURL,eT=e.setOpenBuy,eM=e.onMessagesCountChanged,eB=e.onNewChatPersisted,e_=e.onNewChatRequested,eZ=e.onChatTitleUpdated,eK=e.onNotification,eG=e.onUnauthorized,eF=e.sidebarOpen,eY=void 0===eF||eF,eH=e.showVoice,ez=(e.showWelcomeHand,e.customBrandSection),eW=e.showEnterAPIKey,eQ=e.showLibrary,eJ=e.includeChatID,eX=void 0!==eJ&&eJ,e$=e.preloadChatData,e0=e.preloadUserData,e1=e.defaultEdittingIndex,e5=void 0===e1?-1:e1,e3=e.currentAnthropicEndpoint,e6=e.currentCompletetionEndpoint,e7=e.currentGeminiEndpoint,e8=(e.overrideSystemMessage,e.onChatSelected),e9=e.useOrgDefaultModelSettings,te=e.orgDefaultModel,tt=e.welcomeMessage,tn=e.chatFeatures,ts=e.orgPrompts,tr=e.globalLoading,ta=e.setGlobalLoading,ti=e.abortMapRef,to=e.deltaStreamRef,tl=e.footerMessage,tc=e.onSpeechSettingClick,td=e.allowCustomModel,tu=e.showBuyButton,tm=e.showCostEstimationConfig,tp=e.onSidebarMenuClick,th=e.onCloseDesktopSidebar,tg=e.orgModelSettings,tf=e.systemCharacters,tx=e.systemModels,tb=e.suggestedModels,tv=e.highlightedMessageIndex,ty=e.authenticated,tw=e.chatPlugins,tj=void 0===tw?[]:tw,tA=e.onModelUsageChanged,tk=e.onUserProfileClick,tN=e.defaultSelectedCharacter,tC=e.allowResetCharacter,tq=e.requireSelectCharacterBeforeChat,tI=e.setOpenGlobalModelSettings,tS=e.onOpenPluginsSetings,tE=e.allowSaveChat,tO=e.saveChatData,tV=e.onForkChat,tP=e.getLatestMessages,tT=e.onOpenManageSharedLinks,tM=e.shouldScrollToMessage,tD=e.allowPromptCaching,tB=e.setOpenCharacterList,tL=(0,q.useState)(""),tR=tL[0],t_=tL[1],tZ=pc({}),tK=(0,y.Z)(tZ,2),tG=tK[0],tF=tK[1],tU=(0,q.useState)((null==e$?void 0:e$.messages)||[]),tH=tU[0],tz=tU[1];(0,q.useEffect)(function(){var e,t=(e=(0,x.Z)(j().mark(function e(t){var n;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(t.detail!==eO)){e.next=3;break}return e.abrupt("return");case 3:return e.next=5,tP();case 5:if(null!=(n=e.sent)&&n.length){e.next=8;break}return e.abrupt("return");case 8:tz(n);case 9:case"end":return e.stop()}},e)})),function(t){return e.apply(this,arguments)});return window.addEventListener("chat-messages-updated",t),function(){window.removeEventListener("chat-messages-updated",t)}},[eO]);var tW=(0,q.useState)(tG&&tG[eO]||e5>-1&&(0,O.FB)(null===(E=tH[e5])||void 0===E?void 0:E.content)||""),tQ=tW[0],tX=tW[1],t$=(0,q.useState)(""),t0=t$[0],t1=t$[1],t2=pe(!1),t4=(0,y.Z)(t2,2);t4[0],t4[1];var t5=pt(),t3=(0,y.Z)(t5,2),t6=t3[0],t7=t3[1],t8=pn(O.cl),t9=(0,y.Z)(t8,2),nt=t9[0];t9[1];var nn=(0,q.useState)(e9?te:(null==e$?void 0:e$.model)||t6||te||O.Q6),ns=nn[0],nr=nn[1],na=pp(null),ni=(0,y.Z)(na,2),no=ni[0];ni[1];var nl=ph(null),nc=(0,y.Z)(nl,2),nd=nc[0];nc[1];var nu=pg(null),nm=(0,y.Z)(nu,2),np=nm[0];nm[1];var nh=pf(null),ng=(0,y.Z)(nh,2),nf=ng[0];ng[1];var nb=px(null),nv=(0,y.Z)(nb,2),ny=nv[0];nv[1];var nw=pb(null),nj=(0,y.Z)(nw,2),nA=nj[0];nj[1];var nk=pv(null),nN=(0,y.Z)(nk,2),nC=nN[0];nN[1];var nq=py(!1),nI=(0,y.Z)(nq,2),nS=nI[0];nI[1];var nE=pw(0),nO=(0,y.Z)(nE,2),nV=nO[0];nO[1];var nP=(0,q.useState)((null==e$||null===(V=e$.chatParams)||void 0===V?void 0:V.systemMessage)!=void 0?null==e$||null===(P=e$.chatParams)||void 0===P?void 0:P.systemMessage:nt),nT=nP[0],nM=nP[1],nD=(0,q.useState)((null==e$||null===(T=e$.chatParams)||void 0===T?void 0:T.temperature)!=void 0?null==e$||null===(M=e$.chatParams)||void 0===M?void 0:M.temperature:no),nB=nD[0],nL=nD[1],nR=(0,q.useState)((null==e$||null===(D=e$.chatParams)||void 0===D?void 0:D.presencePenalty)!=void 0?null==e$||null===(B=e$.chatParams)||void 0===B?void 0:B.presencePenalty:nd),n_=nR[0],nZ=nR[1],nG=(0,q.useState)((null==e$||null===(L=e$.chatParams)||void 0===L?void 0:L.frequencyPenalty)!=void 0?null==e$||null===(R=e$.chatParams)||void 0===R?void 0:R.frequencyPenalty:np),nF=nG[0],nY=nG[1],nU=(0,q.useState)((null==e$||null===(Z=e$.chatParams)||void 0===Z?void 0:Z.topP)!=void 0?null==e$||null===(K=e$.chatParams)||void 0===K?void 0:K.topP:nf),nH=nU[0],nz=nU[1],nW=(0,q.useState)((null==e$||null===(G=e$.chatParams)||void 0===G?void 0:G.topK)!=void 0?null==e$||null===(F=e$.chatParams)||void 0===F?void 0:F.topK:ny),nQ=nW[0],nJ=nW[1],nX=(0,q.useState)((null==e$||null===(H=e$.chatParams)||void 0===H?void 0:H.maxTokens)!=void 0?null==e$||null===(z=e$.chatParams)||void 0===z?void 0:z.maxTokens:nA),n$=nX[0],n0=nX[1],n1=(0,q.useState)((null==e$||null===(W=e$.chatParams)||void 0===W?void 0:W.safetySettings)!=void 0?null==e$||null===(Q=e$.chatParams)||void 0===Q?void 0:Q.safetySettings:nC),n2=n1[0],n4=n1[1],n5=(0,q.useState)((null==e$||null===(J=e$.chatParams)||void 0===J?void 0:J.promptCachingEnabled)!=void 0?null==e$||null===($=e$.chatParams)||void 0===$?void 0:$.promptCachingEnabled:nS),n3=n5[0],n6=n5[1],n7=(0,q.useState)((null==e$||null===(ee=e$.chatParams)||void 0===ee?void 0:ee.contextLimit)!=void 0?null==e$||null===(et=e$.chatParams)||void 0===et?void 0:et.contextLimit:nV),n8=n7[0],n9=n7[1],se=e$?e$.character:tN,st=(0,q.useState)((null==e$?void 0:e$.tokenUsage)||{totalCostUSD:0,totalTokens:0,enhancedTokens:0,enhancedCostUSD:0,messageTokens:0,messageCostUSD:0}),sn=st[0],ss=st[1],sr=(0,q.useState)(null),sa=sr[0],si=sr[1],so=(0,q.useState)(!!e$),sl=so[0],sc=so[1],sd=(0,q.useState)(0),su=sd[0];sd[1];var sm=(0,q.useState)({}),sp=sm[0],sh=sm[1],sg=ps(!0),sf=(0,y.Z)(sg,2),sx=sf[0];sf[1];var sb=(0,q.useState)((null==e$||null===(en=e$.chatParams)||void 0===en?void 0:en.streaming)===void 0?sx:null==e$||null===(es=e$.chatParams)||void 0===es?void 0:es.streaming),sv=sb[0],sy=sb[1],sw=pr([]),sj=((0,y.Z)(sw,1)[0]||[]).find(function(e){return e.isCurrent}),sA=(0,q.useState)(0),sk=sA[0],sN=sA[1],sC=(0,q.useState)(!1),sq=(sC[0],sC[1]),sI=pa(!0),sS=(0,y.Z)(sI,2),sE=sS[0],sO=sS[1],sV=pi(!0),sP=(0,y.Z)(sV,2),sT=sP[0];sP[1];var sM=po(0),sD=(0,y.Z)(sM,2),sR=sD[0],s_=sD[1],sZ=(0,q.useState)((null==e$||null===(er=e$.chatParams)||void 0===er?void 0:er.showOutputSettings)||""),sK=sZ[0],sG=sZ[1],sF=(0,q.useState)((null==e$||null===(ea=e$.chatParams)||void 0===ea?void 0:ea.outputTone)||""),sY=sF[0],sU=sF[1],sH=(0,q.useState)((null==e$||null===(ei=e$.chatParams)||void 0===ei?void 0:ei.outputLanguage)||""),sz=sH[0],sW=sH[1],sQ=(0,q.useState)((null==e$||null===(eo=e$.chatParams)||void 0===eo?void 0:eo.outputStyle)||""),sJ=sQ[0],sX=sQ[1],s$=(0,q.useState)((null==e$||null===(el=e$.chatParams)||void 0===el?void 0:el.outputFormat)||""),s0=s$[0],s1=s$[1],s4=pl(!1),s5=(0,y.Z)(s4,2),s3=s5[0];s5[1];var s6=(0,q.useState)(200),s7=s6[0],s8=s6[1],s9=(0,q.useState)(0),re=(s9[0],s9[1]),rt=(0,q.useState)(!1),rn=rt[0],ra=rt[1],ri=pd(!0),ro=(0,y.Z)(ri,2),rl=ro[0];ro[1];var rc=(0,q.useState)(e5),rd=rc[0],ru=rc[1],rm=pu(!0),rp=(0,y.Z)(rm,2),rh=rp[0];rp[1];var rg=pm("google"),rf=(0,y.Z)(rg,2),rx=rf[0];rf[1];var rb=pA(""),rv=(0,y.Z)(rb,2);rv[0],rv[1];var ry=pk(""),rw=(0,y.Z)(ry,2);rw[0],rw[1];var rj=(0,eD.n)(),rA=(rj.syncStatus,rj.syncStats),rk=rj.tmcEnabed,rN=rj.lastVerifiedToken,rC=rj.scheduleSync,rq=(0,rr.NZ)().setOpenAIStatus,rI=pj({search:"K"}),rS=(0,y.Z)(rI,1)[0],rE=(0,q.useState)(0),rO=rE[0],rV=rE[1],rP=(0,q.useState)(null),rT=rP[0],rM=rP[1],rD=pN(!0),rB=(0,y.Z)(rD,2),rL=rB[0];rB[1];var rR=pC(!1),r_=(0,y.Z)(rR,2),rZ=r_[0];r_[1];var rK=(0,q.useState)(),rG=rK[0],rF=rK[1],rY=(0,q.useState)(!1),rU=rY[0],rH=rY[1],rW=(0,q.useState)(!1),rQ=rW[0],rJ=rW[1],rX=(0,q.useState)(!1),r$=rX[0],r0=rX[1],r1=pq([]),r2=(0,y.Z)(r1,2),r4=r2[0];r2[1];var ae=pI(""),at=(0,y.Z)(ae,2),an=at[0];at[1];var as=pS({}),ar=(0,y.Z)(as,1)[0],ai=pE(!0),ao=(0,y.Z)(ai,2),al=ao[0],ac=ao[1],ad=(0,q.useState)(null),au=ad[0],am=ad[1],ap=pO({}),ah=(0,y.Z)(ap,2),ag=ah[0];ah[1];var af=_(),ax=af.serverHostConfig||{},ab=ax.systemPluginsMap,av=ax.fileUploadMaxTokens,ay=ax.firstAssistantMessage,aw=ax.assistantTitle,aj=ax.requireLicenseKey,aA=ax.isAPIKeyOptional,ak=ax.modelLimits,aN=void 0===ak?{}:ak,aC=ax.exampleChats,aq=ax.charactersByMessageLimits,aI=void 0===aq?[]:aq,aS=ax.hasUsageLimits,aE=(0,q.useState)(!1),aO=aE[0],aV=aE[1],aP=(0,q.useState)(!0),aT=aP[0],aM=aP[1],aD=(0,q.useState)(!1),aB=aD[0],aL=aD[1],aR=(0,q.useState)(!1),a_=aR[0],aZ=aR[1],aK=(0,q.useState)(!1),aG=aK[0],aF=aK[1],aY=pV("small"),aU=(0,y.Z)(aY,2),aH=aU[0];aU[1];var az=(0,q.useState)(!1),aW=az[0],aQ=az[1],aJ=(0,nK.A)([]),aX=(0,y.Z)(aJ,1)[0],a$=(0,q.useState)(e5>-1&&Array.isArray(null===(ec=tH[e5])||void 0===ec?void 0:ec.content)&&(null===(ed=tH[e5])||void 0===ed||null===(ed=ed.content)||void 0===ed||null===(eu=ed.filter)||void 0===eu?void 0:eu.call(ed,function(e){return"text"!==e.type}))||[]),a0=a$[0],a1=a$[1],a2=(0,q.useState)(!1),a4=a2[0],a5=a2[1],a3=(0,q.useState)(!1);a3[0],a3[1];var a6=(0,q.useState)(0),a7=a6[0],a8=a6[1],a9=(0,q.useState)(new Set),ie=a9[0],it=a9[1],is=(0,q.useState)(!1),ir=is[0],ia=is[1],ii=(0,q.useState)(!1),io=ii[0],il=ii[1],ic=(0,q.useState)(!1),id=ic[0],iu=ic[1],im=(0,q.useState)(!1),ip=im[0],ih=im[1],ig=(0,q.useState)(!1),ix=ig[0],ib=ig[1],iv=(0,q.useState)(!1),iy=iv[0],iw=iv[1],ij=(0,lN.$)({}),iA=(0,y.Z)(ij,2),ik=iA[0],iN=iA[1],iC=pP(!1),iq=(0,y.Z)(iC,2),iI=iq[0];iq[1];var iS=pT({}),iE=(0,y.Z)(iS,2),iO=iE[0];iE[1];var iV=(0,q.useState)([]),iP=iV[0],iT=iV[1],iD=pM(!1),iB=(0,y.Z)(iD,2),iL=iB[0];iB[1];var iR=(0,q.useState)(!0),i_=iR[0],iZ=iR[1],iK=(0,q.useState)(!1),iG=iK[0],iF=iK[1],iY=pD(!0),iU=(0,y.Z)(iY,2),iH=iU[0],iz=iU[1],iW=(0,q.useState)(!1),iQ=iW[0],iX=iW[1],i$=m2({messages:tH,sidebarOpen:eY,onCloseDesktopSidebar:th,enabled:iH&&iQ}),i0=i$.showArtifacts,i1=i$.selectedArtifact,i2=i$.showNextLatestArtifact,i4=i$.artifactsGroupsMap,i5=i$.selectArtifact;(0,q.useLayoutEffect)(function(){var e=function(){iX(window.innerWidth>=1024)};return e(),window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}},[]);var i3=(0,q.useRef)(),i6=(0,q.useRef)(),i7=0===tH.length,i8={defaultTemperature:no,defaultPresencePenalty:nd,defaultFrequencyPenalty:np,defaultTopP:nf,defaultTopK:ny,defaultMaxTokens:nA,defaultSafetySettings:nC,defaultPromptCachingEnabled:nS,defaultContextLimit:nV,defaultStreaming:sx,defaultSystemMessage:nt},i9=null==e0?void 0:e0.userCharacters,oe=null==e0?void 0:e0.installedPlugins;eR(i3,function(){return rJ(!1)}),eR(i6,function(){return r0(!1)}),(0,q.useEffect)(function(){i7&&(nL(i8.defaultTemperature),nZ(i8.defaultPresencePenalty),nY(i8.defaultFrequencyPenalty),nz(i8.defaultTopP),nJ(i8.defaultTopK),n0(i8.defaultMaxTokens),n4(i8.defaultSafetySettings),n6(i8.defaultPromptCachingEnabled),n9(i8.defaultContextLimit),sy(i8.defaultStreaming),nM(i8.defaultSystemMessage))},[i7,i8]);var on=m7(m7({},O.c8),rS),os=(0,q.useCallback)((t=(0,x.Z)(j().mark(function e(t){var n,s,r,a;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,dH(t);case 3:if((s=(n=e.sent).filter(function(e){return e instanceof Error}).map(function(e){return e.message})).length&&eC.Am.error("Unsupported files: "+s.join(", ")),r=[].concat((0,v.Z)(a0),(0,v.Z)(n)).filter(Boolean),!av){e.next=13;break}if(a=r.reduce(function(e,t){var n;return e+(null===(n=t.metadata)||void 0===n?void 0:n.estimatedTokens)||0},0),!(r.length>100)){e.next=11;break}throw Error(oo._({id:"5u+jhV",values:{fileUploadMaxTokens:av}}));case 11:if(!(a>av)){e.next=13;break}throw Error(oo._({id:"+mOvod",values:{fileUploadMaxTokens:av}}));case 13:a1(r),e.next=20;break;case 16:e.prev=16,e.t0=e.catch(0),console.error("error while parsing dropped files:",e.t0),eC.Am.error("Error: "+e.t0.message);case 20:case"end":return e.stop()}},e,null,[[0,16]])})),function(e){return t.apply(this,arguments)}),[a0]),or=(0,du.uI)({onDrop:os,noClick:!0,multiple:!0}),oa=or.getRootProps,oi=or.isDragActive,oo=(0,A.mV)().i18n,ol=(0,q.useRef)(null),oc=(0,q.useRef)(null),od=(0,q.useRef)(null);(0,q.useRef)(null);var ou=(0,q.useRef)(null),om=eL(),op=(0,q.useRef)(!1),oh=(0,iM.useRouter)(),og=oh.query,of=(0,O.N7)("communityPrompts",tn);(0,q.useMemo)(function(){return((null==aX?void 0:aX.length)||0)+((null==ts?void 0:ts.length)||0)+(of?d3(oo.locale).length:0)},[ts,of,oo.locale,aX]);var ox=function(e){if(e||(0,O.nI)()){var t;null===(t=ol.current)||void 0===t||t.focus()}},ob=tH.filter(function(e){return"assistant"===e.role}).slice(-1)[0],ov=((null==ob||null===(em=ob.usage)||void 0===em?void 0:em.total_tokens)||0)>5e4;(0,q.useEffect)(function(){(null!=og&&og.import_character||null!=og&&og.character)&&il(!0)},[]),(0,q.useEffect)(function(){t6&&tg&&!tg[t6]&&!(null!=r4&&r4.find(function(e){return e.id===t6}))&&t7(te)},[]);var oy=null!==(ep=iO.attachments)&&void 0!==ep?ep:O.B0.attachments;(0,q.useEffect)(function(){if(!(!(null!=rA&&null!==(e=rA.apis)&&void 0!==e&&e.blob)||!rk||ns.startsWith("gemini")||ns.startsWith("claude"))&&oy){var e,t=I.Z.get("typingmindcloud_token");if(t){var n=a0.filter(function(e){var t;return"image_url"===e.type&&(null===(t=e.image_url)||void 0===t||null===(t=t.url)||void 0===t?void 0:t.startsWith("data:image"))});0!==n.length&&(0,x.Z)(j().mark(function e(){var t;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return it(new Set(n.map(function(e){return e.image_url.url}))),e.next=3,Promise.all(a0.map(function(){var e=(0,x.Z)(j().mark(function e(t){var n,r;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!("image_url"===t.type&&null!==(n=t.image_url)&&void 0!==n&&null!==(n=n.url)&&void 0!==n&&n.startsWith("data:image"))){e.next=13;break}return e.prev=1,e.next=4,function(e){return s.apply(this,arguments)}(t);case 4:return r=e.sent,e.abrupt("return",m7(m7({},t),{},{image_url:m7(m7({},t.image_url),{},{url:r})}));case 8:return e.prev=8,e.t0=e.catch(1),console.error("error while uploading attachment:",e.t0),eC.Am.error("Error while uploading attachment: "+e.t0.message),e.abrupt("return",null);case 13:return e.abrupt("return",t);case 14:case"end":return e.stop()}},e,null,[[1,8]])}));return function(t){return e.apply(this,arguments)}}()));case 3:t=e.sent.filter(Boolean),it(new Set),a1(t);case 6:case"end":return e.stop()}},e)}))()}}function s(){return(s=(0,x.Z)(j().mark(function e(n){var s,r,a,i;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return s=n.image_url.url,r=(0,O.g8)(s),e.next=4,fetch((0,O.wV)()+"/api/blob?filename=".concat(r.name),{method:"POST",body:r,headers:{Authorization:"Bearer "+t,"x-license-token":rN||"","x-blob-size":r.size}});case 4:if((a=e.sent).ok){e.next=16;break}return e.prev=6,e.next=9,a.text();case 9:throw Error("Failed to upload file: "+e.sent);case 13:throw e.prev=13,e.t0=e.catch(6),Error("Failed to upload file. "+e.t0.message);case 16:return rC(),e.next=19,a.json();case 19:return i=e.sent,e.abrupt("return",i.url);case 21:case"end":return e.stop()}},e,null,[[6,13]])}))).apply(this,arguments)}},[a0,ns,oy]),(0,q.useEffect)(function(){e$&&-1!==tv&&setTimeout(function(){var e;null===(e=document.getElementById("highlighted-message"))||void 0===e||e.scrollIntoView(ov?{}:{behavior:"smooth"})},100)},[e$,tv,tM]),(0,q.useEffect)(function(){!e9&&null!=se&&se.defaultModel?nr(se.defaultModel):0!==tH.length||e$||e9||!t6||nr(t6)},[t6,se]),(0,q.useEffect)(function(){og.message&&eO&&(tX(og.message),oh.replace({pathname:"/"},void 0,{shallow:!0}))},[oh,eO]),(0,q.useEffect)(function(){var e=function(){oT(!1),la()};return window.addEventListener("beforeunload",e),function(){window.removeEventListener("beforeunload",e)}},[]),(0,q.useEffect)(function(){return op.current=!0,function(){op.current=!1}},[]);var ow=(0,q.useMemo)(function(){return r4.find(function(e){return e.id===ns})},[r4,ns]),oj=(0,q.useCallback)(function(e){return e?Object.fromEntries((null==tx?void 0:tx.map(function(e){return[e.id,e]}))||[])[e]||(null==r4?void 0:r4.find(function(t){return t.id===e}))||O.a4[e]:null},[tx,r4]),oA=(0,q.useMemo)(function(){return ow||oj(ns)||m7(m7({},O.a4[O.Q6]),{},{isUsingFallbackModel:!0})},[ns,oj]),ok=(null==se?void 0:se.avatarURL)||oA.iconUrl||eP||void 0,oN=(0,q.useMemo)(function(){var e,t=(null===(e=aN[oA.id])||void 0===e?void 0:e.characters)||1/0,n=aI.filter(function(e){return e.entity===aa.MODEL&&e.entityID===oA.id}).map(function(e){return e.rule.quantity}),s=aI.filter(function(e){return e.entity===aa.CHARACTER&&e.entityID===(null==se?void 0:se.id)}).map(function(e){return e.rule.quantity}),r=aI.filter(function(e){return e.entity===aa.USER}).map(function(e){return e.rule.quantity}),a=aI.filter(function(e){return e.entity===aa.ORG}).map(function(e){return e.rule.quantity}),i=Math.min.apply(Math,[t].concat((0,v.Z)(n),(0,v.Z)(s),(0,v.Z)(a),(0,v.Z)(r)));return i===1/0?0:i},[se,ns,aI,oA,aN]),oC=(0,q.useMemo)(function(){return[].concat((0,v.Z)(tj),(0,v.Z)(oe),(0,v.Z)((null==se?void 0:se.attachedPlugins)||[])).filter(function(e){var t;return!(null!=ab&&null!==(t=ab[e.uuid])&&void 0!==t&&t.disabled)}).filter(function(e,t,n){return n.findIndex(function(t){return t.id===e.id})===t})},[oe,ab,se]),oq=(0,q.useMemo)(function(){return new Set(tj.filter(function(e){return!e.system}).map(function(e){return e.id}))},[tj]),oI=(0,q.useMemo)(function(){return Object.keys(ar).filter(function(e){var t;return null===(t=ar[e])||void 0===t?void 0:t.enabled}).filter(Boolean).map(function(e){return oC.find(function(t){return t.id===e})}).filter(Boolean)},[ar,oC]),oS=(0,q.useCallback)(function(e,t){return t.pluginSupported?oC.filter(function(t){return!!e.assignedPlugins[t.id]}):[]},[oC]),oE=(0,q.useMemo)(function(){return se&&se.isEnforceAssignedPlugins?oS(se,oA):[]},[oS,se,oA]),oO=(0,q.useMemo)(function(){return oA.pluginSupported&&al?oI:[]},[oA,al,oI]),oV=(0,q.useMemo)(function(){return oO.map(function(e){return tY().pick(e,["id","title","emoji","iconURL"])})},[oO]),oP=(0,q.useMemo)(function(){return se&&se.isEnforceAssignedPlugins?oE.map(function(e){return e.openaiSpec}).filter(Boolean):oO.map(function(e){return e.openaiSpec}).filter(Boolean)},[se,oE,oO]);(0,q.useEffect)(function(){to.current=to.current||{},to.current[eO]=function(e){sh(m7({},e))}},[]);var oT=function(e){ta(function(t){return e?m7(m7({},t),{},(0,b.Z)({},eO,!0)):tY().omit(t,[eO])})},oM=tr[eO]||!1,oD=(0,q.useMemo)(function(){return{temperature:nB,presencePenalty:n_,frequencyPenalty:nF,topP:nH,topK:nQ,maxTokens:n$,safetySettings:n2,promptCachingEnabled:n3,contextLimit:n8,streaming:sv,outputTone:sY,outputLanguage:sz,outputStyle:sJ,outputFormat:s0,showOutputSettings:sK,systemMessage:nT}},[nB,n_,nF,nH,nQ,n$,n2,n3,n8,sv,sY,sz,sJ,s0,sK,nT]),oB=(0,q.useMemo)(function(){return{apiKey:ek,anthropicAPIKey:eN,geminiAPIKey:eI,edittingIndex:rd,model:ns,modelInfo:oA,character:se,enabledPluginFunctions:oO,chatParams:oD}},[ek,eN,eI,rd,ns,oA,se,oO,oD]);(0,q.useEffect)(function(){var e=!0,t=function(){var e,t,n=(null===(e=oc.current)||void 0===e?void 0:e.offsetHeight)||200,s=(null===(t=od.current)||void 0===t?void 0:t.offsetHeight)||0;s8(n),re(s),a8(Math.max(0,window.innerHeight-n-s-200))},n=function(n){if(n&&n.length){if(e){e=!1;return}t()}},s=null,r=function(e,t){var n;return function(){clearTimeout(n);var s=Array.prototype.slice.call(arguments);s.unshift(this),n=setTimeout(t.bind.apply(t,s),e)}},a=setTimeout(function(){(s=new ResizeObserver(r(500,n))).observe(oc.current),s.observe(od.current)},1e3);return t(),function(){var e;null===(e=s)||void 0===e||e.disconnect(),clearTimeout(a)}},[]),(0,q.useEffect)(function(){tQ?-1===rd&&tF(function(e){return m7(m7({},e),{},(0,b.Z)({},eO,tQ))}):tF(function(e){return tY().omit(e,[eO])})},[tQ]),(0,q.useEffect)(function(){if(null!=tQ&&tQ.length){var e;null===(e=ol.current)||void 0===e||e.setSelectionRange(tQ.length,tQ.length,"forward")}},[]),(0,q.useEffect)(function(){setTimeout(function(){ox()},300),(0,O.b1)()&&sq(!0)},[]),(0,di.y1)("/",function(){ox()},{enableOnFormTags:!1,preventDefault:!0}),(0,di.y1)("mod+alt+".concat(on.togglePlugins),function(){ac(function(e){return!e})},{enabled:!!on.togglePlugins,enableOnFormTags:!0,preventDefault:!0}),(0,di.y1)("mod+alt+".concat(on.copyLastMessage),function(){var e=tH[tH.length-1],t=(0,O.FB)(null==e?void 0:e.content);t&&navigator.clipboard.writeText(t)},{enabled:!!on.copyLastMessage,enableOnFormTags:!0,preventDefault:!0}),(0,q.useEffect)(function(){e$&&!lg()&&p_(null,"preload_chat_data")},[]),(0,q.useEffect)(function(){ol.current&&(ol.current.scrollTop=ol.current.scrollHeight)},[rG]);var oL=(n=(0,x.Z)(j().mark(function e(t){return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(tE){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,tO(eO,function(e){return{messages:[].concat((0,v.Z)(e.messages||[]),[t]),updatedAt:new Date,syncedAt:null}});case 4:window.dispatchEvent(new CustomEvent("chat-messages-updated",{detail:eO}));case 5:case"end":return e.stop()}},e)})),function(e){return n.apply(this,arguments)});(0,q.useEffect)(function(){!om&&tE&&eO&&tH.length&&!tH[tH.length-1].remote&&tO(eO,function(e){return{createdAt:e.createdAt||new Date,messages:tH,model:ns,modelInfo:tY().pick(oA,["title","id","iconUrl"]),character:se,chatID:eO,linkedPlugins:oV,chatParams:oD,updatedAt:new Date,syncedAt:null,tokenUsage:sn}})},[tH,oD,sn]),(0,q.useEffect)(function(){var e;if(!om){if(tH.length>0&&!sl){var t,n=(tH||[]).filter(function(e){return"user"===e.role||"assistant"===e.role});sc(!0),eB({id:eO,model:ns,modelInfo:tY().pick(oA,["title","id","iconUrl"]),character:se,preview:(0,O.FB)(null===(t=n[n.length-1])||void 0===t?void 0:t.content),linkedPlugins:oV,chatParams:oD,createdAt:new Date,updatedAt:new Date,syncedAt:null})}tH.length>1&&!eV&&"assistant"===tH[tH.length-1].role&&"tool-response"!==tH[tH.length-1].type&&rl&&oG(),tH.length>1&&"assistant"===tH[tH.length-1].role&&"tool-response"!==tH[tH.length-1].type&&(null===(e=(0,O.FB)(tH[tH.length-1].content))||void 0===e?void 0:e.length)>500&&!tH[tH.length-1].keywords&&rh&&(0,O.N7)("useAutoSuggestKeywords",tn)&&oY()}},[tH,se]);var oR=(0,q.useCallback)(function(){tz(function(e){if(0===e.length)return e;var t=e[e.length-1].role;return"user"!==t&&sv||pZ("user"===t?"end":"beginning","after_non_streaming_message_"+t),ox(),e})},[tH,sv]),oZ=(0,q.useCallback)(function(){setTimeout(function(){oR()},200)},[oR]),oK=(0,q.useMemo)(function(){var e="",t=oD.outputTone,n=oD.outputLanguage,s=oD.outputStyle,r=oD.outputFormat;return((t||n||s)&&(e+="Please respond in ".concat([n,t?t+" tone":"",s?s+" style":""].filter(Boolean).join(", "),".")),r&&(e+=" ".concat(r,".")),e=e.trim())?"\n\n"+e:""},[oD]),oG=(0,q.useCallback)((0,x.Z)(j().mark(function e(){var t,n,s,r,a,i,o;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=I.Z.get("locale")||"en",n=li.find(function(e){return e.locale===t}),s=[].concat((0,v.Z)(tH.filter(function(e){return"system"!==e.role&&"training-message"!==e.type})),[{role:"user",content:"What would be a short and relevant title for this chat? You must strictly answer with only the title, no other text is allowed."+(n?"\n\nAnswer in ".concat(n.name,"."):"")}]),r=oA.fastCheapFallback&&tg&&tg[oA.fastCheapFallback]?oA.fastCheapFallback:oA.modelID,e.next=6,rz({model:r,messages:(0,O.vt)(s),modelInfo:oA,apiKeys:{apiKey:ek,anthropicAPIKey:eN,openAIOrgID:an,geminiAPIKey:eI},userOverrides:{currentAnthropicEndpoint:e3,currentCompletetionEndpoint:e6,currentGeminiEndpoint:e7},options:{onModelUsageChanged:tA}});case 6:if((a=e.sent).response){e.next=9;break}return e.abrupt("return",null);case 9:if(a){e.next=11;break}return e.abrupt("return",null);case 11:if(!a.error){e.next=14;break}return console.error(a.error),e.abrupt("return",null);case 14:if(i=a.response){e.next=17;break}return e.abrupt("return",null);case 17:o=((o=(0,O.FB)(i.content))||"").trim().replace(/^Title: /,"").replace(/^"(.*)"$/,"$1").replace(/[,.;:!?]$/,""),oA.system||oA.skipAPIKey||ss(function(e){return(0,O._F)(e,{chatID:eO,model:ns,usage:i.usage,type:"get_title",recordedAt:new Date})}),eZ(eO,o);case 21:case"end":return e.stop()}},e)})),[ek,eN,eI,tH,e6,e7,ow]),oF=(0,q.useCallback)((s=(0,x.Z)(j().mark(function e(t){var n,s,r,a,i,o,l,c;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.messages,s=t.responseMessage,r=t.currentProfile,a=t.previousMemoryEntries,e.prev=1,i=[{role:"system",content:'\nYou are a Persistent Memory system. Your mission is to help create persistent memory entries from a chat conversation between a user and an AI assistant. The memory entries will be included in the AI assistant long term memory to help the AI assists the user better in the future.\n\nRules:\n- A memory entry format is a one line of text. Keep it concise but with enough context for future reference.\n- Only capture notable information that is relevant to the user\'s request and may become helpful in future conversation.\n- If nothing notable is found, you can skip creating a memory entry by responding with "SKIP".\n- You will be provided with snippets of conversations, note that the snippets are from different conversations and are not related with each other. Each conversation is marked with a number "Conversation 1", "Conversation 2", etc.\n- The AI has access to user profile at all time, don\'t create duplicate memory entries related to the user profile.\n\n'.concat(null!=r&&r.information||null!=r&&r.customInstruction?(0,O.HW)(r):"","\n\n").concat(a?["","",a.map(function(e){return"- ".concat(e.createdAt?"".concat(new Date(e.createdAt).toISOString(),": "):"").concat(e.text)}).join("\n"),"",""].join("\n"):null,"\n\nHere are the conversations:\n\n")},{role:"user",content:'\nConversation 1:\n\n\nHello there\n\n\n\nHi, how can I help you today?\n\n\nPlease return the memory entry or "SKIP" if no memory entry is needed.'},{role:"assistant",content:"SKIP"},{role:"user",content:'\nConversation 2:\n\n\nI\'m building a chatbot and I need help with the training data.\n\n\n\nI can help with that. What specific help do you need?\n\n\nPlease return the memory entry or "SKIP" if no memory entry is needed.'},{role:"assistant",content:"The user is building a chatbot."},{role:"user",content:"\nConversation 3:\n\n".concat(n.filter(function(e){return"user"===e.role||"assistant"===e.role}).slice(-4).map(function(e){return"user"===e.role?"\n".concat((0,O.FB)(e.content),"\n"):"\n".concat(e.content,"\n")}).filter(Boolean).join("\n\n"),"\n\n").concat((0,O.FB)(null==s?void 0:s.content),'\n\n\nPlease return the memory entry or "SKIP" if no memory entry is needed.')}],o=oA.fastCheapFallback&&tg&&tg[oA.fastCheapFallback]?oA.fastCheapFallback:oA.modelID,e.next=6,rz({model:o,messages:i,modelInfo:oA,apiKeys:{apiKey:ek,anthropicAPIKey:eN,geminiAPIKey:eI,openAIOrgID:an},userOverrides:{currentAnthropicEndpoint:e3,currentCompletetionEndpoint:e6,currentGeminiEndpoint:e7},options:{onModelUsageChanged:tA}});case 6:if(l=e.sent){e.next=9;break}return e.abrupt("return",null);case 9:if(!l.error){e.next=12;break}return console.error(l.error),e.abrupt("return",null);case 12:if(l.response){e.next=14;break}return e.abrupt("return",null);case 14:if(c=l.response,oA.system||oA.skipAPIKey||ss(function(e){return(0,O._F)(e,{chatID:eO,model:ns,usage:c.usage,type:"create_memory",recordedAt:new Date})}),e.prev=16,console.log("memory entry",c.content),"SKIP"!==(0,O.FB)(c.content)){e.next=20;break}return e.abrupt("return");case 20:iN(function(e){return m7(m7({},e),{},(0,b.Z)({},"GLOBAL",[].concat((0,v.Z)(e.GLOBAL||[]),[{text:c.content,createdAt:new Date}])))}),e.next=25;break;case 23:e.prev=23,e.t0=e.catch(16);case 25:e.next=30;break;case 27:e.prev=27,e.t1=e.catch(1),console.error("failed to get memory entry",e.t1);case 30:case"end":return e.stop()}},e,null,[[1,27],[16,23]])})),function(e){return s.apply(this,arguments)}),[]),oY=(0,q.useCallback)((0,x.Z)(j().mark(function e(){var t,n,s,r,a,i;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,t=[{role:"user",content:'Rules:\n- You will read a message and return some keywords to search on google to learn more about the concepts mentioned in the message\n- Only gives the keywords that are necessary to explore more on the context of the message, don\'t list the obvious keywords\n- You must only output in a strict valid JSON string, the json must be an array of strings, for example ["keyword 1", "keyword 2"]\n- It\'s very important that you must only output JSON, do not include any other text\n- If you don\'t have any worthy keywords to suggest, return []\n- You only returns maximum 5 keywords.\n\nHere is the message:\n\n'.concat((0,O.FB)(tH[tH.length-1].content),"\n\nNow you respond with a JSON string.")}],n=oA.fastCheapFallback&&tg&&tg[oA.fastCheapFallback]?oA.fastCheapFallback:oA.modelID,e.next=5,rz({model:n,messages:(0,O.vt)(t),modelInfo:oA,apiKeys:{apiKey:ek,anthropicAPIKey:eN,geminiAPIKey:eI,openAIOrgID:an},userOverrides:{currentAnthropicEndpoint:e3,currentCompletetionEndpoint:e6,currentGeminiEndpoint:e7},options:{onModelUsageChanged:tA}});case 5:if(s=e.sent){e.next=8;break}throw Error("get suggesstions failed with model: "+n);case 8:if(!s.error){e.next=11;break}throw console.error(s.error),Error("get suggesstions failed with message: "+s.error);case 11:if(s.response){e.next=13;break}throw Error("get suggesstions failed with empty response");case 13:r=s.response,oA.system||oA.skipAPIKey||ss(function(e){return(0,O._F)(e,{chatID:eO,model:ns,usage:r.usage,type:"get_suggestions",recordedAt:new Date})}),e.prev=15,a=JSON.parse((null===(i=r.content)||void 0===i||null===(i=i[0])||void 0===i?void 0:i.text)||r.content),e.next=22;break;case 19:throw e.prev=19,e.t0=e.catch(15),Error("get suggesstions failed when parsing message content, model: "+n);case 22:if(Array.isArray(a)){e.next=24;break}throw Error("get suggesstions failed with none array response");case 24:a.length&&tz(function(e){var t=e[e.length-1];return t.titleUsage=r.usage,t.keywords=a.slice(0,5),[].concat((0,v.Z)(e.slice(0,e.length-1)),[t])}),e.next=30;break;case 27:e.prev=27,e.t1=e.catch(0),console.error("failed to get suggestions",e.t1);case 30:case"end":return e.stop()}},e,null,[[0,27],[15,19]])})),[ek,eN,eI,tH,e6,ow,e7]),oU=(0,q.useCallback)(function(){var e=se&&se.trainingExamples&&se.trainingExamples.length?tY().flatten(se.trainingExamples.map(function(e){return[{role:"user",content:e.userText,type:"training-message"},{role:"assistant",type:"training-message",content:e.assistantText}]})):[],t=se&&se.welcomeMessage?[{role:"assistant",type:"character-welcome-message",content:se.welcomeMessage,model:ns}]:[],n=ay&&0===t.length?[{role:"assistant",type:"org-first-assistant-message",content:ay,model:ns}]:[];return[].concat(t,(0,v.Z)(e),n)},[se,ay,oA]),oH=(0,q.useCallback)((r=(0,x.Z)(j().mark(function e(t){var n,s,r,a;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.callID,t.name,s=t.params,r=function(e){return m7(m7({},n?{tool_call_id:n}:{}),{},{content:e||"Unable to search for training data. Please try again or contact support.",role:"tool",type:"tool-response",name:"search_training_data",format:"error"})},e.prev=2,a=JSON.parse(s).query,e.abrupt("return",m7(m7({},n?{tool_call_id:n}:{}),{},{content:a,role:"tool",type:"tool-response",name:"search_training_data"}));case 7:return e.prev=7,e.t0=e.catch(2),e.abrupt("return",r());case 11:case"end":return e.stop()}},e,null,[[2,7]])})),function(e){return r.apply(this,arguments)}),[]),oz=(0,q.useCallback)((a=(0,x.Z)(j().mark(function e(t){var n,s,r,a,i,o,l,c,d,u;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.serverPlugin,s=t.callID,r=t.name,a=t.params,i=t.call,o=function(e){return{tool_call_id:s,content:e||"Unable to use server plugin. Please try again or contact support.",role:"tool",type:"tool-response",name:r,format:"error"}},e.prev=2,l=n.outputType,c="",d="",e.next=8,fetch("/api/hosted/run-plugins",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({callDetail:i,chatID:eO})});case 8:return u=e.sent,e.next=11,u.text();case 11:return d=e.sent,"render_markdown"===l?c="The output has been rendered to the user in markdown format.":"render_html"===l?c="The output has been rendered to the user in HTML format.":"respond_to_ai"===l&&(c=d),e.abrupt("return",m7(m7({},s?{tool_call_id:s}:{}),{},{content:c,role:"tool",type:"tool-response",pluginResponse:{data:d,options:null,type:l,params:a},name:r}));case 16:return e.prev=16,e.t0=e.catch(2),e.abrupt("return",o());case 20:case"end":return e.stop()}},e,null,[[2,16]])})),function(e){return a.apply(this,arguments)}),[]),oW=(0,q.useCallback)((i=(0,x.Z)(j().mark(function e(t){var n,s,r,a,i,o,l,c,d,u,m;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.callID,s=t.name,r=t.params,e.prev=1,i=oC.find(function(e){return e.id===s})){e.next=5;break}throw Error(oo._({id:"+26uAM",values:{name:s}}));case 5:if(o=(0,O.oH)((null==ab||null===(a=ab[i.uuid])||void 0===a?void 0:a.settings)||ag[s]||{},i.userSettings||[]),"http"!==i.implementationType){e.next=23;break}if(e.prev=7,(0,O.X0)(i,{userPluginSettings:ag})){e.next=11;break}throw Error("Missing required settings for plugin ".concat(i.title,". Please set up the missing settings and try again."));case 11:return e.next=13,iJ(i.httpAction,m7(m7({},JSON.parse(r)),o));case 13:l={response:e.sent},e.next=21;break;case 17:e.prev=17,e.t0=e.catch(7),console.error("plugin run error:",e.t0),l={error:"Plugin Error: "+e.t0.message};case 21:e.next=26;break;case 23:return e.next=25,function(e){return up.apply(this,arguments)}({id:n,name:s,code:i.code,params:r,userSettings:o});case 25:l=e.sent;case 26:if(!l.error){e.next=28;break}throw Error(l.error);case 28:if(d=(c=(0,O.TS)({pluginFunction:i,pluginResponse:l.response})).outputType,u=c.response,d){e.next=31;break}throw Error("Plugin output type can't be determined. Please check the plugin configuration or contact the plugin's developer.");case 31:return m="string"==typeof u?u:JSON.stringify(u),"render_markdown"===d?m="The output has been rendered to the user in markdown format.":"render_html"===d&&(m="The output has been rendered to the user in HTML format."),e.abrupt("return",m7(m7({},n?{tool_call_id:n}:{}),{},{content:m,role:"tool",type:"tool-response",pluginResponse:{data:u,options:null,type:d,inputParams:(0,O.dC)(r)},name:s}));case 36:return e.prev=36,e.t1=e.catch(1),console.error("plugin run error:",e.t1),e.abrupt("return",m7(m7({},n?{tool_call_id:n}:{}),{},{content:"Error: ".concat(e.t1.message),role:"tool",type:"tool-response",format:"error",name:s}));case 40:case"end":return e.stop()}},e,null,[[1,36],[7,17]])})),function(e){return i.apply(this,arguments)}),[oB,ag]),oQ=(0,q.useCallback)((o=(0,x.Z)(j().mark(function e(t){var n,s,r,a;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=function(){return(a=(0,x.Z)(j().mark(function e(){var n,s,r,a,i,o;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.function_call||t.tool_calls,s=Array.isArray(t.content)&&t.content.find(function(e){return"tool_use"===e.type}),!(!n&&!s)){e.next=4;break}return e.abrupt("return",!1);case 4:return r=[],n?r=t.function_call?[{id:"",type:"function",function:t.function_call}]:t.tool_calls:s&&(r=[t.content.find(function(e){return"tool_use"===e.type})].map(function(e){return{id:e.id,index:0,type:"function",function:{name:e.name,arguments:JSON.stringify(e.input)}}})),oT(!0),am(r),a=function(e){(0,r6.Z)(n,e);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var n,s=(0,r8.Z)(e);return n=t?Reflect.construct(s,arguments,(0,r8.Z)(this).constructor):s.apply(this,arguments),(0,r7.Z)(this,n)}}(n);function n(){return(0,r3.Z)(this,n),t.apply(this,arguments)}return(0,r5.Z)(n)}((0,r9.Z)(Error)),i=new Promise(function(e,t){ou.current={abort:function(){console.debug("Plugin run aborted"),t(new a)}}}),e.prev=10,e.next=13,Promise.race([i,Promise.all(r.map(function(){var e=(0,x.Z)(j().mark(function e(t){var n,s,r,a;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.function.arguments,s=t.function.name,!(r=(tj||[]).find(function(e){return e.isServerPlugin&&e.id===s}))){e.next=7;break}return e.next=6,oz({serverPlugin:r,callID:t.id,name:s,params:n,call:t});case 6:case 10:return e.abrupt("return",e.sent);case 7:return a=({search_training_data:oH})[s]||oW,e.next=10,a({callID:t.id,name:s,params:n});case 11:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()))]);case 13:return o=e.sent,am(null),oT(!1),o$(o),o.some(function(e){return(0,O.uD)(e)})&&i2(),e.abrupt("return",!0);case 21:if(e.prev=21,e.t0=e.catch(10),!(e.t0 instanceof a)){e.next=27;break}return e.abrupt("return");case 27:throw e.t0;case 28:case"end":return e.stop()}},e,null,[[10,21]])}))).apply(this,arguments)},r=function(){return a.apply(this,arguments)},s=function(){return(s=(0,x.Z)(j().mark(function e(){return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:iT(function(e){if(null!=e&&e.length){var t=e[0],n=e.slice(1);return setTimeout(function(){o$(t.content,{role:"user"},{resetInput:!1})},100),n}return e});case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)},n=function(){return s.apply(this,arguments)},e.next=6,r();case 6:if(!e.sent){e.next=8;break}return e.abrupt("return");case 8:return e.next=10,n();case 10:if(!e.sent){e.next=12;break}return e.abrupt("return");case 12:case"end":return e.stop()}},e)})),function(e){return o.apply(this,arguments)}),[oO,oW,iP]),oJ=(0,q.useCallback)(function(e){return[].concat((0,v.Z)(i9||[]),(0,v.Z)(tf||[])).find(function(t){return t.id===e})},[i9,tf]),oX=(0,q.useCallback)((l=(0,x.Z)(j().mark(function e(t){var n,s,r,a,i,o,l,c,d,u,m,p,h,g,f,x,b,y;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,oT(!0),t_(""),ti.current=ti.current||{},ti.current[eO]=new AbortController,s=t.filter(function(e){return"user"===e.role}).slice(-1)[0],r=(0,O.AC)((0,O.FB)(null==s?void 0:s.content)),o=(null==(i=(a=null==s?void 0:s.inlineCharacterInfo)?oJ(a.id):se)?void 0:i.isEnforceDefaultModel)&&oj(null==i?void 0:i.defaultModel)||oA,l=null!=i&&i.isEnforceAssignedPlugins?oS(i,o).map(function(e){return e.openaiSpec}).filter(Boolean):o.pluginSupported?oP:[],c=o.modelID||o.id,d=iI?ik.GLOBAL:{},u=n3&&tD&&(c.startsWith("claude-3-5-sonnet")||c.startsWith("claude-3-haiku")),e.next=16,pB((0,O.N7)("systemMessage",tn)?nT:"",{character:i,currentProfile:sj,chatID:eO,lastUserMessage:r,memoryEntries:d,cacheEnabled:u});case 16:if(m=e.sent,p=t.some(function(e){return e.function_call||e.tool_calls||"tool"===e.role}),!(i&&!o.pluginSupported&&p)){e.next=23;break}return t_(oo._({id:"mLHm5q",values:{0:i.title}})),oT(!1),pG(),e.abrupt("return");case 23:var w;return h=[m].concat((0,v.Z)(t.filter(function(e){return!e.contextClearedAt||"training-message"===e.type}).map(O.jN).map(function(e){return function(e){var t=e.message,n=e.modelID,s=e.effectiveCharacter,r=e.defaultCharacter;try{var a=function(e){var n=[].concat((0,v.Z)(Array.isArray(t.content)?t.content.filter(function(e){return"text"!==e.type}):[]),[{type:"text",text:e}]),s=0===n.filter(function(e){return"text"!==e.type}).length;return mL(mL({},t),{},{content:s?n[0].text:n})},i=function(e,t){var s=(null==t?void 0:t.title)||n;return a(["(".concat(e," ").concat(s,")"),o].join("\n"))},o="string"==typeof t.content?t.content:Array.isArray(t.content)?t.content.find(function(e){return"text"===e.type}):"",l=null==t?void 0:t.inlineCharacterInfo;if((null==s?void 0:s.id)===(null==r?void 0:r.id)&&!l)return t;if("assistant"===t.role){if(!l&&!s)return t;if(s){if((null==l?void 0:l.id)===s.id)return t;if(null!=l&&l.id)return i("Received from",l);return i("Received from",r)}if(null!=l&&l.id)return i("Received from",l);return i("Received from",r)}if("user"!==t.role)return t;if(s){if((null==l?void 0:l.id)===s.id)return t;if(null!=l&&l.id)return i("Send to",l);return i("Send to",r)}if(null!=l&&l.id)return i("Send to",l);return t}catch(e){return console.error("context conversion error",e),ne.Tb(e),t}}({message:e,effectiveCharacter:i,defaultCharacter:se,modelID:oA.modelID})}))),e.prev=24,e.next=27,rz({model:c,modelInfo:o,messages:h,apiKeys:{apiKey:ek,anthropicAPIKey:eN,openAIOrgID:an,geminiAPIKey:eI},userOverrides:{currentAnthropicEndpoint:e3,currentCompletetionEndpoint:e6,currentGeminiEndpoint:e7},options:m7(m7({temperature:nB,presencePenalty:n_,frequencyPenalty:nF,topP:nH,topK:nQ,maxTokens:n$,safetySettings:n2,contextLimit:n8},null!=(w=i)&&w.isEnforceModelParameters?null==w?void 0:w.modelParameters:{}),{},{contextLengthOverride:o.contextLength,functions:l,signal:null===(f=ti.current[eO])||void 0===f?void 0:f.signal,stream:sv,extras:eX&&!ow?{chatID:eO,activatedCharacterID:null==se?void 0:se.id,inlineCharacterID:null==a?void 0:a.id}:{},onStreamStarted:function(){},onContextSkipped:function(e){rV(e)},onStreamTextChunk:function(e){o7(e)},onStreamFinished:function(){},onAPIStatusChanged:function(e){rq(e)},onModelUnavailable:function(){},onAborted:function(){oT(!1)},onFreeMessagesCountChanged:function(e){rM(e)},onModelUsageChanged:tA,onStreamError:function(e){console.error("stream error",e),t_(oo._(m9)+oo._({id:"AGHoaB"})+e.message)},promptCachingEnabled:u})});case 27:g=e.sent,e.next=37;break;case 30:if(e.prev=30,e.t0=e.catch(24),"AbortError"!==e.t0.name){e.next=36;break}console.log("Request aborted"),e.next=37;break;case 36:throw e.t0;case 37:if(g){e.next=40;break}return oT(!1),e.abrupt("return");case 40:if(!g.error){e.next=46;break}return console.error("Completion error:",g),t_(g.error),oT(!1),pG(),e.abrupt("return");case 46:return b=(x=g.response).usage,x.finish,o.system||o.skipAPIKey||ss(function(e){return(0,O._F)(e,{chatID:eO,model:c,usage:b,type:"message",recordedAt:new Date})}),y=m7(m7({},x),{},{model:o.modelID,inlineCharacterInfo:a,createdAt:new Date,uuid:(0,tJ.Z)()}),op.current?(tz([].concat((0,v.Z)(t),[y])),oZ()):oL(y),oT(!1),oQ(y),eM&&eM(tH.length),iI&&oF({messages:h,responseMessage:y,currentProfile:sj,previousMemoryEntries:d}),(null!=i&&i.isEnforceSpeechSettings?null===(n=i.speechSettings)||void 0===n?void 0:n.autoSpeech:rZ)&&o6(),o7(""),window.document.hidden&&(sT&&mR(),null==eK||eK(!0)),e.abrupt("return",!0);case 63:e.prev=63,e.t1=e.catch(0),"The user aborted a request."===e.t1.message||(window.navigator.onLine?(console.error(e.t1),t_(oo._(m9)+oo._({id:"AGHoaB"})+e.t1.message)):t_(oo._({id:"+Obvhr"})),setTimeout(function(){pR(void 0,!0,"last_message_failed")},300)),oT(!1);case 67:case"end":return e.stop()}},e,null,[[0,63],[24,30]])})),function(e){return l.apply(this,arguments)}),[oB,oD,tH,oQ,e6,ow,e7,se,sa,sj,iI,ik,oL,n3,tD]),o$=(0,q.useCallback)((c=(0,x.Z)(j().mark(function e(t){var n,s,r,a=arguments;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=a.length>1&&void 0!==a[1]?a[1]:{role:"user"},r=void 0===(s=(a.length>2&&void 0!==a[2]?a[2]:{}).resetInput)||s,tz(function(e){var s=new Date,r=Array.isArray(t)?t:[t];r.filter(function(e){return"string"==typeof e||"object"==typeof e}).length!==r.length&&(console.warn("Some replies are not string or object",r),ne.Tb(Error("Some replies are not string or object"),{extra:{replies:r}}));var a=r.map(function(e){var t="string"==typeof e?e:null==e?void 0:e.content,r="object"==typeof e?e:n,a=Array.isArray(t)?t.filter(function(e){return e.text}).map(function(e){return e.text}).join("\n"):t,i=m7(m7(m7({},r),{},{content:a0.length?[{type:"text",text:a+oK}].concat((0,v.Z)(a0)):a+oK,createdAt:s},sa?{inlineCharacterInfo:{id:sa.id,title:sa.title}}:{}),{},{uuid:(0,tJ.Z)()});return("function"===i.role||Array.isArray(t))&&(i.content=t),i}),i=[].concat((0,v.Z)(e.length?e:(0,v.Z)(oU()).map(function(e){return m7(m7({},e),{},{createdAt:s,uuid:(0,tJ.Z)()})})),(0,v.Z)(a));return setTimeout(function(){oX(i)},0),i}),oZ(),r&&(tX(""),a1([]));case 5:case"end":return e.stop()}},e)})),function(e){return c.apply(this,arguments)}),[oB,oD,tn,tH,oU,oX,a0,sa]),o0="setapp"===oA.apiType||!!ek&&"openai"===oA.apiType||!!eN&&"claude"===oA.apiType||!!eI&&"gemini"===oA.apiType||!!ow,o1=function(){if(!ie.size){if(!ty&&eG){eG();return}if(!o0){if(!ty&&eG)eG();else{var e;null===(e=window.document.getElementById("enter-api-key-btn"))||void 0===e||e.click(),t_(oo._({id:"rvyFY9"})),pR(void 0,!0,"after_enter_apikey")}return}return!0}},o2=function(e){iT(function(t){return[].concat((0,v.Z)(t),(0,v.Z)(e))}),tX(""),a1([])},o4=function(e){if(!e||-1===e.indexOf("\n----\n"))return{content:e,queueItems:[]};var t=e.split("\n----\n"),n=t.slice(1).filter(function(e){return e.trim()}).map(function(e){return{content:e.trim(),attachmentFiles:[]}});return{content:t[0].trim(),queueItems:n}},o5=(0,q.useCallback)((0,x.Z)(j().mark(function e(){var t,n;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(!tQ&&!a0.length)){e.next=2;break}return e.abrupt("return");case 2:if(!oM){e.next=6;break}return t=o4(tQ),o2([{content:tQ,attachmentFiles:a0}].concat((0,v.Z)(t.queueItems))),e.abrupt("return");case 6:if(!(!o1()||!((t_(""),a5(!1),se&&se.premium&&!af.userCanUse("premiumCharacters"))?(t_(oo._({id:"QJz/m1"})),a5(!0),setTimeout(function(){pR(void 0,!0,"after_premium_character_error")},300),!1):a0.some(function(e){return"image_url"===e.type})&&!af.userCanUse("vision")?(t_(oo._({id:"tb6hYw"})),a5(!0),setTimeout(function(){pR(void 0,!0,"after_vision_error")},300),!1):!(a0.length>0)||!!af.userCanUse("uploadDocuments")||(t_(oo._({id:"k39Ghd"})),a5(!0),setTimeout(function(){pR(void 0,!0,"after_upload_documents_error")},300),!1)))){e.next=8;break}return e.abrupt("return");case 8:rd>-1?o3({edittingIndex:rd,content:tQ,attachmentFiles:a0,regenerate:!0}):(n=o4(tQ),i_&&n.queueItems.length?(o2(n.queueItems),o$(n.content)):o$(tQ),(0,dm.j)("send-message"));case 9:case"end":return e.stop()}},e)})),[ow,oB,oM,ie,tQ,a0,o$,o0,i_]),o3=(0,q.useCallback)((d=(0,x.Z)(j().mark(function e(t){var n,s,r,a,i;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=t.edittingIndex,s=t.content,r=t.attachmentFiles,i=void 0!==(a=t.regenerate)&&a,tz(function(e){var t=(0,v.Z)(e),a=t[n],o=r.length?[{type:"text",text:s}].concat((0,v.Z)(r)):s;return t[n].content=o,t[n].updatedAt=new Date,t[n],i&&"user"===a.role&&(t=e.slice(0,n+1),setTimeout(function(){oX(t)},0)),t}),ru(-1),tX(""),a1([]);case 5:case"end":return e.stop()}},e)})),function(e){return d.apply(this,arguments)}),[tH,oX]),o6=function(){setTimeout(function(){var e=document.querySelectorAll(".tts-play-button");if(e.length){var t=e[e.length-1];t&&t.click()}},200)},o7=function(e){to.current&&"function"==typeof to.current[eO]&&to.current[eO](e)},o8=(u=(0,x.Z)(j().mark(function e(){var t;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(o1()){e.next=2;break}return e.abrupt("return");case 2:if(0!==tH.length){e.next=4;break}return e.abrupt("return");case 4:for(t=(0,v.Z)(tH);t.length>0&&("tool-response"===t[t.length-1].type||"assistant"===t[t.length-1].role||"function"===t[t.length-1].role||""===t[t.length-1].content);)t.pop();if(0!==t.length){e.next=9;break}return oX(tH),e.abrupt("return");case 9:tz(t),oX(t);case 11:case"end":return e.stop()}},e)})),function(){return u.apply(this,arguments)}),o9=function(){lm(tH.findLastIndex(function(e){return"user"===e.role}))},le=(0,q.useMemo)(function(){return tH.filter(function(e){return"training-message"===e.type}).length},[tH]),ln=(0,q.useCallback)(function(){aF(!0)},[]),ls=function(){tX(""),a1([]),ru(-1)},lr=(m=(0,x.Z)(j().mark(function e(){var t;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,null===(t=ti.current[eO])||void 0===t?void 0:t.abort();case 3:e.next=7;break;case 5:e.prev=5,e.t0=e.catch(0);case 7:la(),oT(!1);case 9:case"end":return e.stop()}},e,null,[[0,5]])})),function(){return m.apply(this,arguments)}),la=function(){if(au){var e,t;null===(e=ou.current)||void 0===e||null===(t=e.abort)||void 0===t||t.call(e),am(null)}},lo=(0,q.useCallback)(function(){lm(tH.findIndex(function(e){return"user"===e.role})),pK()},[tH]),ll=(0,q.useCallback)(function(){tz(function(e){if(0===e.length||"clear-context"===e[e.length-1].type)return e;var t=e.map(function(e){return"system"===e.role||"training-message"===e.type?e:m7(m7({},e),{},{contextClearedAt:e.contextClearedAt||new Date})});return[].concat((0,v.Z)(t),[{type:"clear-context"}])}),rV(0),pG(),setTimeout(function(){ox()},200)},[tH]),lc=function(e){tX(e.prompt),setTimeout(function(){ox(!0),ld({fromCursor:!1})},600)},ld=function(){var e,t,n,s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=s.fromCursor,a=(void 0===r||r)&&(null===(e=ol.current)||void 0===e?void 0:e.selectionStart)||0,i=(null===(t=ol.current)||void 0===t||null===(t=t.value)||void 0===t?void 0:t.indexOf("{{",a+1))||0,o=(null===(n=ol.current)||void 0===n||null===(n=n.value)||void 0===n?void 0:n.indexOf("}}",i))||0;return -1!==i&&-1!==o&&(ol.current.setSelectionRange(i,o+2,"forward"),!0)},lu=(0,q.useCallback)(function(e){tz(function(t){var n=(0,v.Z)(t);if("clear-context"===n[e].type)for(var s=e-1;s>=0&&"clear-context"!==n[s].type;s--)n[s]=m7({},n[s]),delete n[s].contextClearedAt;return n.splice(e,1),n})},[]),lm=(0,q.useCallback)(function(e){tz(function(t){var n=t[e];return n&&setTimeout(function(){var t,s,r,a,i,o,l;(ru(e),"system"===n.role&&n.originalContent)?tX(n.originalContent):"string"==typeof n.content?(tX(n.content),a1([])):(tX(null===(a=n.content)||void 0===a||null===(i=a.find)||void 0===i||null===(i=i.call(a,function(e){return"text"===e.type}))||void 0===i?void 0:i.text),a1(null===(o=n.content)||void 0===o||null===(l=o.filter)||void 0===l?void 0:l.call(o,function(e){return"text"!==e.type}))),ox(!0),null===(t=ol.current)||void 0===t||t.setSelectionRange((null===(s=ol.current)||void 0===s||null===(s=s.value)||void 0===s?void 0:s.length)||0,(null===(r=ol.current)||void 0===r||null===(r=r.value)||void 0===r?void 0:r.length)||0)},200),t})},[]),lp=(0,q.useCallback)(function(e){tz(function(t){var n=(0,v.Z)(t);if(t[e].isPinned){var s=m7({},n[e]);delete s.isPinned,n[e]=s}else n[e]=m7(m7({},t[e]),{},{isPinned:!0});return n.filter(function(e){return e.isPinned}).length||aQ(!1),n})},[]),lh=function(e){a1([].concat((0,v.Z)(a0),(0,v.Z)(e))),ox()},lg=function(){return(null!=aC&&aC.length?aC:cF.f).map(function(e){return e.chatID}).includes(eO)},lf=(0,q.useCallback)(function(){t_(""),ox()},[]),lx=(0,q.useMemo)(function(){var e;return(0,O.N7)("textToSpeech",tn)&&(null==se||null===(e=se.speechSettings)||void 0===e?void 0:e.speechSource)!=="disabled"},[tn,se]),lb=(p=(0,x.Z)(j().mark(function e(t,n){return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if((null==t?void 0:t.type)!=="model"){e.next=4;break}return nr(t.id),setTimeout(function(){ox()},400),e.abrupt("return");case 4:if(!(null!=t&&t.action)){e.next=8;break}return tX(""),"open-prompt-library"===t.action?aL(!0):"open-ai-characters"===t.action?tB(!0):"switch-chat-model"===t.action&&ra(!0),e.abrupt("return");case 8:if(tX(""),"prompt"!==t.type){e.next=12;break}return lc(t),e.abrupt("return");case 12:if("character"!==t.type){e.next=15;break}return e_({character:t}),e.abrupt("return");case 15:setTimeout(function(){e8(t,{search:n})},100);case 16:case"end":return e.stop()}},e)})),function(e,t){return p.apply(this,arguments)}),lv=function(e){var t;null===(t=document.querySelector(".message-index-".concat(e)))||void 0===t||t.scrollIntoView(ov?{}:{behavior:"smooth"})},ly=(0,O.N7)("yourProfile",tn)||(0,O.N7)("modelSettings",tn)||(0,O.N7)("usePlugins",tn),lw=(null==sp?void 0:sp.content)||(null==sp?void 0:sp.function_call)||(null==sp?void 0:sp.tool_calls),lj=function(){return(0,S.jsx)(dT,{loading:oM,pluginRunning:au,isAssistantTyping:lw,assistantTitle:aw})},lA=(0,q.useCallback)(function(e){return oC.find(function(t){return t.id===e})},[oC]),lk=(0,q.useMemo)(function(){var e={},t=[];return tH.forEach(function(n,s){if("clear-context"===(n=m7(m7({},n),{},{index:s})).type){e[t[t.length-1]||"none"].push(n);return}var r=n.createdAt?(0,O.o0)(new Date(n.createdAt),"dd MMM yyyy"):"none";e[r]?e[r].push(n):(e[r]=[n],"none"!==r&&t.push(r))}),[e,t]},[tH]),lC=lk[0],lq=lk[1],lI=(0,O.N7)("pickCharacters",tn),lS=!!(tQ.length||a0.length),lE=function(e){var t,n=e.index,s=n===tH.length-1,r=e.inlineCharacterInfo?oJ(null===(t=e.inlineCharacterInfo)||void 0===t?void 0:t.id):null,a=r||se,i=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{shouldDisplay:!0},i=t.ref,o=t.shouldDisplay;return(0,S.jsx)("div",{ref:i,className:m8("px-4 rounded-lg mb-2",rd>-1&&n>rd?"opacity-50":"","message-index-".concat(n)),id:n===tv?"highlighted-message":void 0,style:m7({},!lw&&s&&a7?{minHeight:a7}:o?{}:{minHeight:200}),children:o?(0,S.jsxs)(q.Fragment,{children:[(0,S.jsx)(mD,{appearTransition:s&&"user"===e.role,index:n,hideTrainingMessages:aT,isEditting:n===rd,botAvatar:a?a.avatarURL:ok,modelLabel:"".concat(oA.title," (").concat(oA.modelID,")"),toolInfoLookup:lA,functionInfo:e.function_call||"function"===e.role?oC.find(function(t){var n;return t.id===(null===(n=e.function_call)||void 0===n?void 0:n.name)||t.id===e.name}):null,message:e,onUserProfileClick:tk,userProfilePicURL:null==sj?void 0:sj.picURL,secondaryUserCharacterAvatar:r?r.avatarURL||"":void 0,onDeleteMessage:lu,onEditMessage:lm,onSystemClick:ln,onForkChat:tV,defaultShowAudio:rL,onSpeechSettingClick:null!=a&&a.isEnforceSpeechSettings?null:tc,speechSettings:null==a?void 0:a.speechSettings,audioEnabled:lx,fontSize:aH,onPinMessage:lp,isPinned:e.isPinned,onCharacterAvatarClick:ih,onBotAvatarClick:ib,onToolAvatarClick:iw,shouldShowInteractiveHTML:!!oq.has(e.name),artifactsPinned:iH&&(0,O.uD)(e),onPinArtifact:lO,onArtifactSelect:i5,showPinArtifact:iQ}),s&&!lw?lj():null]}):null})};return ov?(0,S.jsx)(cK.df,{rootMargin:"200px 0px 200px 0px",triggerOnce:!0,children:function(t){return i({ref:t.ref,shouldDisplay:t.inView||n===tv||e.isPinned})}},n):i()},lO=(0,q.useCallback)(function(e){iz(!0),i5(e)},[]);return(0,S.jsxs)("div",{className:"resize-container relative [--artifacts-width:0] lg:[--artifacts-width:--artifacts-width-lg] xl:[--artifacts-width:--artifacts-width-xl] pr-[--artifacts-width]",style:iQ&&i0&&iH?{"--artifacts-width-lg":"500px","--artifacts-width-xl":"600px"}:{"--artifacts-width-lg":0,"--artifacts-width-xl":0},"data-element-id":"chat-space-background",children:[(0,S.jsxs)("div",{className:"hide-when-print sticky top-0 z-50 bg-white/30 dark:bg-gray-950/30 backdrop-blur",children:[(0,S.jsx)("div",{className:"flex absolute left-1 top-0 bottom-0 items-center justify-center",children:(0,O.N7)("navBar",tn)?(0,S.jsxs)("button",{type:"button",className:"inline-flex h-12 w-12 items-center justify-center rounded-md text-gray-500 hover:text-gray-900 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-blue-500 dark:hover:text-gray-100 z-40",onClick:tp,onTouchEnd:tp,children:[(0,S.jsx)("span",{className:"sr-only",children:(0,S.jsx)(A.cC,{id:"OdnLE4"})}),(0,S.jsx)(nx.vrO,{className:"h-6 w-6","aria-hidden":"true"})]}):null}),tu?(0,S.jsx)("div",{className:"absolute right-2 top-0 bottom-0 flex items-center justify-center z-40",children:(0,S.jsxs)("button",{type:"button",id:"nav-buy-button",className:eE?"cursor-default inline-flex items-center justify-center rounded-md text-gray-700 hover:text-gray-900 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-red-500 py-1 px-2 space-x-2 text-sm relative hover:bg-red-50":"cursor-default inline-flex items-center justify-center rounded-md text-red-700 hover:text-red-900 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-red-500 py-1 px-2 space-x-2 text-sm relative font-semibold border border-red-500 shadow bg-gray-50 hover:bg-red-50 transition-colors hover:bg-red-50 dark:bg-red-800/50 dark:border-white dark:text-white dark:hover:bg-red-700",onClick:function(){eT(!0),aV(!0)},children:[(0,S.jsx)(Y.WYw,{className:"h-6 w-6 text-red-500","aria-hidden":"true"}),eE?null:(0,S.jsxs)("div",{className:"text-left",children:[(0,S.jsx)("div",{className:"hidden sm:block",children:"Buy A License"}),(0,S.jsx)("div",{className:"sm:hidden",children:"Buy Now"}),(0,S.jsx)("div",{className:"hidden sm:block text-xs font-normal",children:"Limited-time offer!"}),(0,S.jsx)("div",{className:"sm:hidden text-xs font-normal",children:"Limited LTD"})]}),eE||aO?null:(0,S.jsx)("div",{className:"top-2 left-0 absolute animate-ping h-6 w-6 rounded-full bg-red-500","aria-hidden":"true"})]})}):(0,S.jsx)("button",{type:"button",id:"nav-buy-button",className:"hidden",onClick:function(){eT(!0)},children:"Buy A License"}),(0,S.jsx)(uT,{showBuyButton:tu,chatID:eO,showCostEstimation:tm,messages:tH,plugins:oO,pinnedMessages:tH.filter(function(e){return e.isPinned}),onOpenPinnedMessages:function(){return aQ(!0)},modelInfo:oA,fallbackModelIcon:null==oA?void 0:oA.iconUrl,showModel:(0,O.N7)("modelSettings",tn),allowChangeModel:!e9&&!(null!=se&&se.isEnforceDefaultModel),onModelSettingsClick:function(){return ra(!0)},onGlobalModelSettingsClick:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.showAddCustomModel,tI(!0)},onModelClick:function(e){nr(e.id),tH.length||t7(e.id),setTimeout(function(){ox()},400)},showPlugins:(0,O.N7)("usePlugins",tn),allowModifyPlugins:!(null!=se&&se.isEnforceAssignedPlugins),onPluginsClick:function(e){tS(e)},modelEnabledMap:tg,systemModels:tx,suggestedModels:tb,isNewChat:i7,estimatedCost:sn,allowCustomModel:td})]}),(0,S.jsx)("div",{onClick:function(){return s_((sR+1)%3)},"data-element-id":"width-adjust-bar",className:"fixed top-0 bottom-0 right-[--artifacts-width] z-10 items-center justify-between w-12 bg-gray-50 dark:bg-zinc-700/20 hover:bg-gray-200 dark:hover:bg-zinc-700 cursor-pointer transition-colors grid grid-cols-1 grid-rows-5 text-center group active:bg-gray-300 dark:active:bg-zinc-600 hidden xl:flex flex-col",children:[1,2,3,4,5].map(function(e){return(0,S.jsx)("div",{className:"hidden items-center justify-center text-gray-500 group-hover:flex",children:(0,S.jsx)(e4.ilJ,{})},e)})}),(0,S.jsxs)("div",{"data-element-id":"chat-space-middle-part",style:{paddingBottom:s7+50},className:m8("transition-all relative",0===sR?"max-w-3xl mx-auto ":1===sR?"max-w-5xl mx-auto sm:px-12":"max-w-full sm:mx-12"),children:[(0,S.jsxs)("div",{className:"pt-4 pb-4 relative",children:[se||!i7?null:(0,S.jsxs)(S.Fragment,{children:[ez?ez():(0,S.jsx)(uv,{showBenefits:!eE,onViewAllFeaturesClick:function(){return eT(!0)}}),tt&&i7&&(!(0,O.N7)("hideWelcomeMessageForLoggedInUsers",tn)||(aj?!rN:!ty))&&(0,S.jsx)("div",{className:"prose prose-sm max-w-full dark:prose-invert text-center px-10 mb-10 org-welcome-message",children:(0,S.jsx)(ot,{children:tt})})]}),i7&&!se?(0,S.jsx)(d_,{systemCharacters:tf,onCharacterSelected:function(e){return e_({character:e})},onOpen:function(){return tB(!0)},showDefaultCharacters:(0,O.N7)("defaultCharacters",tn),allowOpen:(0,O.N7)("pickCharacters",tn)}):null,se?(0,S.jsx)(dN,{showResetButtons:0===tH.length&&(void 0===tC||tC),onReset:function(){return e_()},onChange:function(){tB(!0),t_("")},allowChange:(0,O.N7)("pickCharacters",tn),character:se,characterPlugins:oE,showPlugins:(0,O.N7)("usePlugins",tn)}):null,le>0&&aT?(0,S.jsxs)("div",{className:"px-2 flex items-center justify-center mt-8 mb-2 text-gray-500 font-semibold text-sm gap-2",children:[(0,S.jsx)(A.cC,{id:"fmLRjM",values:{trainingMessagesCount:le}}),(0,S.jsxs)("button",{className:"text-blue-500 hover:underline font-semibold",onClick:function(){return aM(!1)},children:["(",(0,S.jsx)(A.cC,{id:"8vETh9"}),")"]})]}):null,0===tH.length&&oU().length?oU().map(function(e,t){return(0,S.jsx)("div",{className:m8("px-4 rounded-lg mb-2"),children:(0,S.jsx)(mD,{defaultShowAudio:!1,botAvatar:ok,modelLabel:"".concat(oA.title," (").concat(oA.modelID,")"),showActions:!1,message:{role:"assistant",model:ns,content:e.content,type:e.type},animateCharacters:!0,audioEnabled:lx,fontSize:aH})},"prefillMessage-"+e.type+"-"+t)}):null,["none"].concat((0,v.Z)(lq)).map(function(e){return(0,S.jsxs)(q.Fragment,{children:["none"!==e&&(0,S.jsxs)("div",{"data-element-id":"chat-date-info",className:" flex justify-center my-6 mx-4 first:mt-0 items-center",children:[(0,S.jsx)("div",{className:"border-t flex-grow border-gray-200 dark:border-zinc-700"}),(0,S.jsx)("span",{className:"px-3 text-xs text-gray-500 dark:text-zinc-600",children:e}),(0,S.jsx)("div",{className:"border-t flex-grow border-gray-200 dark:border-zinc-700"})]}),(lC[e]||[]).map(lE)]},e)}),lw?(0,S.jsxs)("div",{className:m8("px-4 rounded-lg mb-2"),style:m7({},a7?{minHeight:a7}:{}),children:[(0,S.jsx)(mD,{appearTransition:!0,defaultShowAudio:!1,botAvatar:null!==(eh=tH[tH.length-1])&&void 0!==eh&&eh.inlineCharacterInfo?null===(eg=oJ(null===(ex=tH[tH.length-1])||void 0===ex||null===(ex=ex.inlineCharacterInfo)||void 0===ex?void 0:ex.id))||void 0===eg?void 0:eg.avatarURL:ok,modelLabel:"".concat(oA.title," (").concat(oA.modelID,")"),showActions:!1,message:{role:"assistant",model:ns,content:sp.content,function_call:sp.function_call,tool_calls:sp.tool_calls,inlineCharacterInfo:null===(eb=tH[tH.length-1])||void 0===eb?void 0:eb.inlineCharacterInfo},audioEnabled:lx,toolInfoLookup:lA,functionInfo:sp.function_call?oC.find(function(e){var t;return e.id===(null===(t=sp.function_call)||void 0===t?void 0:t.name)||e.id===sp.name}):null,fontSize:aH,onCharacterAvatarClick:ih,onBotAvatarClick:ib,onToolAvatarClick:iw}),lj()]},tH.length+1):null]}),(0,S.jsxs)("div",{ref:od,className:"post-message-content relative",children:[rO>0?(0,S.jsx)(uZ,{skippedMessagesCount:rO,model:ns}):null,oM||null===rT?null:(0,S.jsx)("div",{className:"text-xs text-orange-500 text-right italic pt-4 pr-4",children:(0,S.jsx)("div",{children:(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"MtlhoE",values:{freeMessagesCount:rT}})})})}),!oM&&oA.isUsingFallbackModel?(0,S.jsx)("div",{className:"text-xs text-orange-500 text-right italic pt-4 pr-4",children:(0,S.jsx)("div",{children:(0,S.jsx)(A.cC,{id:"CH5FaG",values:{0:oA.modelID},components:{0:(0,S.jsx)("b",{})}})})}):null,!oM&&null!==(ev=tH[tH.length-1])&&void 0!==ev&&null!==(ev=ev.keywords)&&void 0!==ev&&ev.length?(0,S.jsxs)("div",{className:"text-center my-4",children:[(0,S.jsx)("div",{className:"text-xs font-semibold my-2",children:(0,S.jsx)(A.cC,{id:"50DcYA"})}),(0,S.jsx)("div",{className:"flex items-start justify-center flex-wrap gap-2 px-4",children:null===(ey=tH[tH.length-1])||void 0===ey||null===(ey=ey.keywords)||void 0===ey?void 0:ey.map(function(e,t){return(0,S.jsxs)("button",{onClick:function(t){var n=new URL("ddg"===rx?"https://duckduckgo.com":"bing"===rx?"https://www.bing.com/search":"brave"===rx?"https://search.brave.com/search":"google"===rx?"https://www.google.com/search":rx);n.searchParams.append("q",e);var s=t.screenX,r=t.screenY;window.open(n,"_blank","width=800,height=600,left=".concat(s,",top=").concat(r))},className:"rounded-full px-3 py-2 text-xs border border-gray-300 hover:bg-gray-50 flex items-center justify-center gap-2 dark:border-gray-500 dark:hover:bg-zinc-700",children:["google"===rx?(0,S.jsx)(uU,{className:"w-4 h-4"}):"ddg"===rx?(0,S.jsx)(uY,{className:"w-4 h-4"}):"bing"===rx?(0,S.jsx)(uG,{className:"w-4 h-4"}):"brave"===rx?(0,S.jsx)(uK,{className:"w-4 h-4"}):(0,S.jsx)(mX,{className:"w-4 h-4"}),(0,S.jsx)("span",{children:e})]},t)})})]}):null,lg()?(0,S.jsxs)("div",{className:"text-center my-8",children:[(0,S.jsx)("hr",{className:"my-10"}),(0,S.jsx)("div",{className:"text-sm text-gray-500",children:(0,S.jsx)(A.cC,{id:"vBSaD3"})}),(0,S.jsx)("div",{className:"text-center my-4",children:(0,S.jsxs)("button",{onClick:function(){return e_()},type:"submit",className:"inline-flex items-center px-4 py-2 border border-transparent text-base font-medium rounded-full shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 gap-2",children:[(0,S.jsx)("span",{children:"→"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"vPF04k"})})]})})]}):null,!(void 0===eW||eW)||lg()||ow?null:"openai"===oA.apiType?(0,S.jsx)(ma,{isAPIKeyOptional:aA,model:ns,onCompleted:lf}):"claude"===oA.apiType?(0,S.jsx)(u_,{isAPIKeyOptional:aA,onCompleted:lf}):"gemini"===oA.apiType&&O.PI?(0,S.jsx)(mJ,{isAPIKeyOptional:aA,onCompleted:lf}):null,tR?(0,S.jsxs)("div",{className:"mt-4",children:[(0,S.jsx)("div",{className:"text-red-500 text-center text-sm px-4 font-medium",children:tR||"Unknown Error"}),tH.length&&o0&&!a4?(0,S.jsx)("div",{className:"text-center my-4",children:(0,S.jsxs)("button",{onClick:o8,type:"submit",className:"inline-flex items-center px-4 py-2 border border-transparent text-base font-semibold rounded-full shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 gap-2",disabled:oM,children:[(0,S.jsx)(e4.lgS,{className:"w-4 h-4"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"6exX+8"})})]})}):null,a4?(0,S.jsx)("div",{className:"text-center my-4",children:(0,S.jsxs)("button",{onClick:function(){return eT(!0)},type:"submit",className:"inline-flex items-center px-5 py-2 border border-transparent text-base font-semibold rounded-full shadow-sm text-white bg-green-600 hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 disabled:bg-gray-400 gap-2",children:[(0,S.jsx)(Y.WYw,{className:"w-4 h-4"}),(0,S.jsx)("span",{children:"Buy / Upgrade License"})]})}):null]}):null]})]}),tq&&!se?(0,S.jsx)("div",{className:m8("fixed z-30 bottom-0 left-0 right-0 transition-all duration-300 pr-[--artifacts-width]",eY?"md:pl-[--current-sidebar-width] ":""),children:(0,S.jsx)("div",{className:"p-4 text-center text-gray-500 bg-white dark:bg-gray-950",children:(0,S.jsx)(A.cC,{id:"rSHV7E"})})}):null,(0,S.jsx)("div",{ref:oc,className:m8("fixed z-30 bottom-0 left-0 right-0 transition-all duration-300 pr-[--artifacts-width]",eY?"md:pl-[--current-sidebar-width] ":"",lg()||tq&&!se?"hidden":""),children:(0,S.jsxs)("div",{className:m8("mx-auto w-full hide-when-print transition-all",0===sR?"max-w-3xl":1===sR?"max-w-5xl sm:px-12":"max-w-full sm:px-12"),children:[(0,S.jsx)(U.u,{as:"div",show:!lS&&oM&&-1===rd,enter:"ease-out duration-300",enterFrom:"opacity-0 -translate-y-4",enterTo:"opacity-100 translate-y-0",leave:"ease-in duration-200",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 -translate-y-4",children:(0,S.jsx)("div",{className:"my-2 text-center w-full flex items-center justify-center flex-wrap gap-2 px-4",children:(0,S.jsxs)("button",{onClick:lr,className:"inline-flex items-center justify-center rounded-full px-3 py-2 text-sm shadow-md bg-red-600 text-white hover:bg-red-500 transition-all active:bg-red-600 group font-semibold text-xs min-w-[100px]",children:[(0,S.jsx)(C.JuG,{className:"w-4 h-4 mr-2 group-hover:scale-125 transition-all"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"ygCKqB"})})]})})}),(0,S.jsx)(U.u,{as:"div",show:!lS&&!oM&&-1===rd,enter:"ease-out duration-300",enterFrom:"opacity-0 -translate-y-4",enterTo:"opacity-100 translate-y-0",leave:"ease-in duration-200",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 -translate-y-4",children:(0,S.jsx)(mt,{canChangeChatSettings:ly,showLibrary:(void 0===eQ||eQ)&&(0,O.N7)("promptLibrary",tn),enableShare:!0,chatID:eO,messages:tH,onRegenerate:o8,onNewChatRequested:e_,appendReplyAndSubmit:o$,onResetChat:lo,onClearContext:ll,onOpenPromptLibrary:function(){return aL(!0)},onShareChat:function(){return aZ(!0)},onChangeSettings:function(){return aF(!0)}})}),(0,S.jsx)("div",{"data-element-id":"chat-space-end-part",className:"px-4 pb-4 pt-0 bg-white dark:bg-gray-950 px-4 transition-colors",children:(0,S.jsxs)("div",m7(m7({className:"pb-safe"},oa()),{},{children:[oi?(0,S.jsxs)("div",{className:"border-dashed border-2 border-gray-500 rounded-lg p-4 text-center text-gray-500 font-medium flex items-center justify-center gap-2",children:[(0,S.jsx)(Y.w4J,{className:"w-6 h-6 animate-bounce"}),(0,S.jsx)("span",{children:"Drop files here..."})]}):null,i7&&se&&null!==(ew=se.conversationStarters)&&void 0!==ew&&ew.length&&!lS?(0,S.jsxs)("div",{className:m8("grid grid-cols-1 sm:grid-cols-2 gap-2 mb-2",se.conversationStarters.length>4||se.conversationStarters.length>2&&window.innerWidth<768?"max-h-[124px] overflow-auto":""),children:[se.conversationStarters.map(function(e,t){return(0,S.jsx)(dE,{style:{transitionDelay:"".concat(t/10,"s")},className:"flex",enter:"ease-out duration-300",enterFrom:"opacity-0 translate-y-4",enterTo:"opacity-100 translate-y-0",leave:"ease-in duration-200",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 translate-y-4 h-0",children:(0,S.jsxs)("div",{onClick:function(){o1()&&o$(e.text||"")},className:"w-full border border-1 border-gray-200 dark:border-zinc-700 rounded-md bg-gray-100 hover:bg-gray-200 active:bg-gray-300 dark:bg-zinc-700 dark:hover:bg-zinc-600 dark:active:bg-zinc-500 transition-colors line-clamp-2 py-2 px-3 text-sm text-left text-gray-800 dark:text-zinc-100 flex items-center justify-between gap-2 cursor-pointer group",children:[(0,S.jsxs)("div",{className:" flex items-center justify-center gap-2",children:[(0,S.jsx)(e4.wIw,{className:"w-4 h-4 flex-shrink-0"}),(0,S.jsx)("span",{className:"line-clamp-2",children:e.text})]}),(0,S.jsx)("button",{onClick:function(t){t.stopPropagation(),t.preventDefault(),tX(e.text),ox(!0)},"data-tooltip-id":"starter-tooltip",className:"group-hover:opacity-100 opacity-0 border border-gray-300 dark:border-zinc-500 dark:hover:bg-zinc-500 dark:bg-zinc-600 dark:active:bg-zinc-700 rounded p-2 hover:bg-gray-300 active:bg-gray-400 transition-all",children:(0,S.jsx)(C.KHI,{className:"w-4 h-4"})})]})},e.id)}),(0,S.jsx)(sL.u,{id:"starter-tooltip",place:"top",children:(0,S.jsx)(A.cC,{id:"MMcsI2"})})]}):null,(0,S.jsx)("div",{"data-element-id":"message-input",className:"flex items-end justify-center space-x-2 mb-2",children:(0,S.jsxs)("div",{className:"w-full space-y-2 pt-2",children:[(0,S.jsxs)("div",{className:m8("flex items-center justify-center flex-col sm:flex-row space-x-0 gap-2 sm:gap-0",sK?"":"hidden"),children:[(0,S.jsxs)("div",{"data-element-id":"output-setting-options-container",className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:[(0,S.jsx)(uH,{outputFormat:s0,setOutputFormat:s1}),(0,S.jsx)(uJ,{outputTone:sY,setOutputTone:sU}),(0,S.jsx)(uQ,{outputStyle:sJ,setOutputStyle:sX}),(0,S.jsx)(uX,{outputLanguage:sz,setOutputLanguage:sW})]}),(0,S.jsx)(uz,{setOutputTone:sU,setOutputLanguage:sW,setOutputStyle:sX,setOutputFormat:s1,setShowOutputSettings:sG})]}),(0,S.jsx)("div",{children:(0,S.jsx)("div",{className:m8("flex items-center justify-start gap-2 flex-wrap"),children:a0.map(function(e,t){var n,s;return(0,S.jsx)(dZ,{attachmentFile:e,loading:(null==e||null===(n=e.image_url)||void 0===n?void 0:n.url)&&ie.has(null==e||null===(s=e.image_url)||void 0===s?void 0:s.url),onRemove:function(){return a1(a0.filter(function(e,n){return n!==t}))},onPasteAsText:function(){tX(e.text),a1(a0.filter(function(e,n){return n!==t})),ol.current&&setTimeout(function(){var e,t,n;ox(!0),null===(e=ol.current)||void 0===e||e.setSelectionRange(ol.current.value.length,ol.current.value.length),null===(t=ol.current)||void 0===t||null===(n=t.scrollTo)||void 0===n||n.call(t,0,ol.current.scrollHeight)},300)},model:ns,showEstimatedCost:(0,O.N7)("showChatInfo",tn)&&tm&&iL},t)})})}),(0,S.jsxs)("div",{"data-element-id":"input-row",className:m8("w-full flex items-center justify-center gap-x-0 gap-y-2",rd>-1||lS?rd>-1?"flex-wrap":"flex-wrap sm:flex-nowrap":""),children:[(0,S.jsx)(U.u,{as:"div",className:lS?"hidden sm:flex":"",show:!(rd>-1||lS),enter:"ease-out duration-300",enterFrom:"opacity-0 -translate-x-4 max-w-0",enterTo:"opacity-100 translate-x-0 max-w-[70px]",leave:"ease-in duration-200",leaveFrom:"opacity-100 translate-x-0 max-w-[70px]",leaveTo:"opacity-0 -translate-x-4 max-w-0",children:(0,S.jsxs)("div",{className:m8(" flex items-center justify-center gap-0 pr-1",rd>-1?"hidden":""),children:[(0,O.N7)("promptLibrary",tn)?(0,S.jsx)("button",{onClick:function(e){e.preventDefault(),e.stopPropagation(),aL(!0)},onTouchEnd:function(e){e.preventDefault(),e.stopPropagation(),aL(!0)},"data-element-id":"prompt-library-small-button",className:m8("shrink-0 transition-colors rounded-md relative flex items-center justify-center py-1 px-1"," text-gray-500 hover:text-orange-400"),children:(0,S.jsx)(C.Mp$,{className:"w-6 h-6"})}):null,(0,O.N7)("outputSettings",tn)?(0,S.jsxs)("button",{onClick:function(e){e.preventDefault(),e.stopPropagation(),sG(!sK)},onTouchEnd:function(e){e.preventDefault(),e.stopPropagation(),sG(!sK)},"data-element-id":"output-settings-button".concat(sK?"-clicked":""),className:m8("shrink-0 transition-colors py-1 px-1 rounded-md relative",sK?"bg-gray-500 dark:bg-gray-700 text-white text-gray-500 dark:text-white":" text-gray-500 hover:text-gray-900 dark:hover:text-zinc-200"),children:[(0,S.jsx)(eq.Pg6,{className:"w-6 h-6"}),(0,S.jsx)(uW,{outputTone:sY,outputLanguage:sz,outputStyle:sJ,outputFormat:s0})]}):null]})}),(0,S.jsxs)("div",{className:"w-full",children:[sa?(0,S.jsxs)("div",{"data-element-id":"inline-character-label",className:"text-sm text-gray-500 pb-0.5 rounded-tl-lg rounded-tr-lg flex space-x-1 w-full truncate -mb-1 bg-gray-100 dark:bg-zinc-800",children:[(0,S.jsxs)("div",{className:"flex items-center justify-start gap-2 w-full p-2",children:[(0,S.jsx)(sB,{character:sa,size:"small"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"9SpTGy",values:{0:sa.title},components:{0:(0,S.jsx)("b",{})}})})]}),(0,S.jsx)("button",{className:"py-2 px-3",children:(0,S.jsx)(C.aHS,{onClick:function(){return si(null)}})})]}):null,(0,S.jsxs)("div",{children:[-1===rd&&tQ.length&&0===a0.length?(0,S.jsxs)(dE,{enter:"ease-out duration-300",enterFrom:"opacity-0 translate-y-4 max-h-0",enterTo:"opacity-100 translate-y-0 max-h-[50px]",leave:"ease-in duration-200",leaveFrom:"opacity-100 translate-y-0 max-h-[50px]",leaveTo:"opacity-0 translate-y-4 h-0 max-h-0",className:"enter-to-send flex items-center justify-between gap-1 flex-wrap my-2",children:[(0,S.jsxs)("label",{className:"flex items-center justify-start gap-2 text-sm",children:[(0,S.jsx)("input",{type:"checkbox",checked:sE,onChange:function(){return sO(!sE)}}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"KgBK/c"})})]}),(0,S.jsx)(m0,{content:tQ,model:ns,showEstimatedCost:(0,O.N7)("showChatInfo",tn)&&tm&&iL})]}):null,(0,S.jsxs)("div",{"data-element-id":"chat-input-textbox-container",className:m8(rd>-1?"editing":"","relative w-full"),children:[(0,S.jsxs)("div",{className:"flex items-center justify-between gap-1",children:[rd>-1?(0,S.jsxs)("div",{"data-element-id":"edit-message-label",className:"bg-blue-600 text-xs text-white ml-2 px-2 py-1 rounded-tl-lg rounded-tr-lg flex space-x-1 w-fit truncate -mb-1",children:[(0,S.jsx)(Y.QML,{className:"w-4 h-4"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"QjH+ZX"})})]}):null,(0,S.jsx)("div",{className:"[.enter-to-send~*_&]:hidden ml-auto",children:!!tQ.length&&(0,S.jsx)(m0,{content:tQ,model:ns,showEstimatedCost:(0,O.N7)("showChatInfo",tn)&&tm&&iL})})]}),-1===rd&&rQ&&(0,S.jsx)("div",{ref:i3,className:"w-[300px] h-[330px] bg-white dark:bg-zinc-900 border overflow-hidden border-gray-300 dark:border-gray-500 rounded-lg shadow-lg absolute bottom-full left-0 -translate-y-4",children:(0,S.jsx)(mH,{canUseCommunityPrompts:(0,O.N7)("communityPrompts",tn),onSelected:lb,showFooter:!1,onEscape:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.reset;rJ(!1),t&&tX(""),ox()},systemCharacters:tf,orgPrompts:ts,modelEnabledMap:tg,systemModels:tx,setModel:nr,showPromptsLibrary:(0,O.N7)("promptLibrary",tn),showCharacters:(0,O.N7)("pickCharacters",tn),showModel:(0,O.N7)("modelSettings",tn),allowChangeModel:!e9&&!(null!=se&&se.isEnforceDefaultModel)})}),-1===rd&&r$&&(0,S.jsx)("div",{ref:i6,className:"w-full bg-white dark:bg-zinc-900 border overflow-hidden border-gray-300 dark:border-gray-500 rounded-lg shadow-lg absolute bottom-full left-0 -translate-y-4",children:(0,S.jsx)(dk,{systemCharacters:tf,onEscape:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.reset,r0(!1),ox()},onSelected:function(e){tX(function(e){return"@"===e[e.length-1]?e.slice(0,-1):e}),i7?e_({character:e}):e.id===(null==se?void 0:se.id)?(si(null),eC.Am.success(oo._({id:"4cp8tX",values:{0:se.title}}))):(si(e),ox())}})}),(0,S.jsx)(rs.Z,{style:{"--max-height":"120px"},ref:ol,onFocus:function(){null==eK||eK(!1),iu(!0)},onBlur:function(){iu(!1)},onPaste:(h=(0,x.Z)(j().mark(function e(t){var n;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!Array.from(t.clipboardData.items).find(function(e){return"text/plain"===e.type})){e.next=6;break}(n=t.clipboardData.getData("text/plain")).length>32768&&(t.preventDefault(),t.stopPropagation(),lh([{type:"tm_text_file",text:tQ?tQ+"\n\n"+n:n,metadata:{name:"clipboard.txt",source:"clipboard",characters:n.length,estimatedTokens:(0,O.fI)(n)}}])),e.next=27;break;case 6:if(!(t.clipboardData.files.length>0)){e.next=27;break}return t.preventDefault(),t.stopPropagation(),e.prev=9,e.t0=a1,e.t1=[],e.t2=(0,v.Z)(a0),e.t3=v.Z,e.next=16,Promise.all(Array.from(t.clipboardData.files).map(dU));case 16:e.t4=e.sent,e.t5=(0,e.t3)(e.t4),e.t6=e.t1.concat.call(e.t1,e.t2,e.t5).filter(Boolean),(0,e.t0)(e.t6),e.next=26;break;case 22:e.prev=22,e.t7=e.catch(9),console.error("error while parsing files from clipboard:",e.t7),eC.Am.error("Error: "+e.t7.message);case 26:return e.abrupt("return");case 27:case"end":return e.stop()}},e,null,[[9,22]])})),function(e){return h.apply(this,arguments)}),onCompositionStart:function(){window.innerWidth<768||ia(!0)},onCompositionEnd:function(){window.innerWidth<768||ia(!1)},onKeyDown:function(e){if(!event.isComposing&&229!==event.keyCode){if("Enter"===e.key&&(e.metaKey||e.ctrlKey)&&!e.shiftKey){e.preventDefault(),o5();return}if("Enter"===e.key&&e.altKey&&rd>-1){o3({edittingIndex:rd,content:tQ,attachmentFiles:a0,regenerate:!1});return}if("Enter"===e.key&&sE&&!e.shiftKey&&!ir){e.preventDefault(),o5();return}if("ArrowUp"===e.key&&!lS){e.preventDefault(),o9();return}if("Escape"===e.key&&rd>-1){e.preventDefault(),ls();return}if("Escape"===e.key&&sa){e.preventDefault(),si(null);return}if("Escape"===e.key&&se&&i7){e.preventDefault(),e_();return}if("Escape"===e.key&&r$){e.preventDefault(),r0(!1);return}if("Escape"===e.key&&rQ){e.preventDefault(),rJ(!1);return}if("Tab"===e.key&&tQ){ld()&&e.preventDefault();return}}},id:"chat-input-textbox",autoFocus:!eY&&(0,O.nI)(),value:tQ,onChange:function(e){var t=e.target.value||"";"/"===t&&(window.innerWidth>=768?rJ(!0):rH(!0));var n=t[t.length-1];lI&&"@"===n&&-1===rd&&r0(!0),tX(t)},placeholder:t0||(id?sa?"Send message to ".concat(sa.title,"..."):(0,O.N7)("commandK",tn)?lI?oo._({id:"0wNwVE"}):oo._({id:"Kfz6IH"}):oo._({id:"CVVC+5"}):oo._({id:"gBJdgA"})),"data-element-id":"chat-input-textbox",className:m8("relative block w-full rounded-md border-0 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 dark:ring-gray-700 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-blue-600 sm:py-1.5 min-h-[36px] resize-none dark:bg-gray-900 dark:text-white dark:ring-gray-500 dark:focus:ring-blue-900 main-chat-input",!lS&&-1===rd&&(0,O.N7)("commandK",tn)?"pl-12 md:pl-[60px] ":"",sk>=120&&"pr-12",rG?"max-h-[var(--max-height)]":tQ.length?"max-h-[500px]":"max-h-[40px]",{small:"sm:text-sm sm:leading-6",medium:"text-base",large:"text-lg",extra:"text-xl","2extra":"text-2xl"}[aH]||""),onHeightChange:function(e){sN(e)},maxLength:oN||void 0}),(0,O.N7)("commandK",tn)&&-1===rd?(0,S.jsxs)(mW,{className:m8("absolute min-h-[30px] md:min-h-0 min-w-[30px] bottom-1/2 left-1.5 translate-y-1/2 flex items-center space-x-1 space-x-reverse text-xs py-1 rounded border border-gray-300 dark:border-gray-700 dark:text-white text-black px-2 hover:border-blue-600 hover:dark:border-blue-500",lS?"hidden":""),canUseCommunityPrompts:of,onSelected:lb,controlled:!0,open:rU,setOpen:rH,systemCharacters:tf,orgPrompts:ts,modelEnabledMap:tg,systemModels:tx,setModel:nr,showPromptsLibrary:(0,O.N7)("promptLibrary",tn),showCharacters:(0,O.N7)("pickCharacters",tn),showModel:(0,O.N7)("modelSettings",tn),allowChangeModel:!e9&&!(null!=se&&se.isEnforceDefaultModel),children:[(0,S.jsx)(o_.Goc,{className:"md:hidden"}),(0,S.jsx)("span",{className:"hidden md:block",children:(0,S.jsx)(uh,{children:"⌘"+rS.search})})]}):null,sk>=120&&(0,S.jsx)("button",{className:m8("absolute min-h-[30px] md:min-h-0 min-w-[30px] bottom-6 right-2 translate-y-1/2 flex items-center space-x-1 space-x-reverse text-xs py-1 rounded border border-gray-300 dark:border-gray-400 dark:text-white text-black px-2 hover:border-blue-600 hover:dark:border-blue-500 bg-white dark:bg-zinc-800"),onClick:function(){rF(function(e){return e?void 0:120}),ox(!0),ol.current.setSelectionRange(tQ.length,tQ.length,"forward")},children:rG?(0,S.jsx)(o_.d0b,{className:"w-4 h-4"}):(0,S.jsx)(o_.ith,{className:"w-4 h-4"})})]})]})]}),(0,S.jsxs)("div",{className:m8("relative flex items-center justify-center gap-2 pl-1",rd>-1||lS?rd>-1?"flex-wrap px-16 w-full":"flex-wrap sm:flex-nowrap w-full sm:w-auto":"",tQ.length&&"self-end"),children:[(0,S.jsxs)("div",{className:m8("flex items-center justify-center gap-0 ",-1!==rd||lS?"absolute right-0 top-0":"",rd>-1?"":"sm:static"),children:[(-1===rd||(null===(ej=tH[rd])||void 0===ej?void 0:ej.role)==="user")&&(0,O.N7)("uploadDocument",tn)?(0,S.jsx)(uF,{size:Math.max(36,Math.min(40,sk)),onAttachmentsParsed:lh}):null,(void 0===eH||eH)&&(0,O.N7)("voiceInput",tn)&&(0,S.jsx)("div",{className:m8(),children:(0,S.jsx)(mn,{onCompleted:function(e,t){if(e=(tQ||"")+e){if(!s3||oM||null!=t&&t.preventAutoSend)tX(e),setTimeout(function(){ol.current&&(ox(!0),ol.current.setSelectionRange(e.length,e.length,"forward"))},300);else{if(!o1())return;o$(e)}}},onInterimTranscript:t1,size:Math.max(36,Math.min(40,sk)),openAIAPIKey:ek})})]}),oM?lS?(0,S.jsxs)("button",{type:"button",onClick:o5,disabled:!lS||ie.size,"data-element-id":"queue-button",className:"inline-flex items-center px-4 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 disabled:cursor-default transition-colors whitespace-nowrap space-x-1",style:{height:Math.min(40,sk)},children:[(0,S.jsx)(lt.qVV,{className:"w-4 h-4"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"b24kPi"})})]}):null:(0,S.jsx)(U.u,{as:"div",className:lS?"":"hidden sm:flex",show:rd>-1||lS,enter:"ease-linear duration-300",enterFrom:"opacity-0 -translate-x-4 max-w-0 max-h-0 sm:max-h-none",enterTo:"opacity-100 translate-x-0 max-w-[300px] max-h-[70px] sm:max-h-none",leave:"ease-in duration-200",leaveFrom:"opacity-100 translate-x-0 max-w-[300px] max-h-[70px] sm:max-h-none",leaveTo:"opacity-0 -translate-x-4 max-w-0 max-h-0 sm:max-h-none",children:(0,S.jsxs)("div",{className:"inline-flex rounded-md items-stretch",children:[(0,S.jsx)("button",{type:"button",onClick:o5,disabled:!lS||ie.size,"data-element-id":"send-button",className:"inline-flex items-center px-4 border border-transparent text-sm font-medium rounded-l-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 disabled:cursor-default transition-colors whitespace-nowrap space-x-1",style:{height:Math.min(40,sk)},children:rd>-1?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(Y.QML,{className:"w-4 h-4"}),"user"===tH[rd].role?(0,S.jsxs)("span",{children:[(0,S.jsx)(A.cC,{id:"mlNp7q"})," ",(0,S.jsx)(uh,{children:"↵"})]}):(0,S.jsxs)("span",{children:[(0,S.jsx)(A.cC,{id:"EkH9pt"})," ",(0,S.jsx)(uh,{children:"↵"})]})]}):oo._({id:"Y9TUSP"})}),(0,S.jsxs)(eU.v2,{as:"div",className:"relative flex",children:[(0,S.jsxs)(eU.j2,{disabled:!lS||ie.size,className:"relative inline-flex items-center rounded-r-md px-1 bg-blue-600 text-white ring-0 ring-inset hover:bg-blue-700 focus:z-50 w-full border-1 border-l border-blue-700 disabled:bg-gray-400 disabled:cursor-default",children:[(0,S.jsx)("span",{className:"sr-only",children:"Open options"}),(0,S.jsx)(e2.fY0,{"aria-hidden":"true",className:"h-4 w-4"})]}),(0,S.jsx)(eU.sd,{transition:!0,anchor:"top end",className:"absolute z-50 -mr-1 mb-4 w-56 origin-bottom-right rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 transition focus:outline-none data-[closed]:scale-95 data-[closed]:transform data-[closed]:opacity-0 data-[enter]:duration-100 data-[leave]:duration-75 data-[enter]:ease-out data-[leave]:ease-in",children:(0,S.jsx)("div",{className:"py-1",children:(0,S.jsx)(eU.sN,{children:(0,S.jsxs)("button",{onClick:function(){tX(function(e){var t=e+"\n----\n";return setTimeout(function(){var e,n;ox(),null===(e=ol.current)||void 0===e||null===(n=e.setSelectionRange)||void 0===n||n.call(e,t.length,t.length,"forward")},200),t})},className:"px-4 py-2 text-sm text-gray-700 data-[focus]:bg-gray-100 data-[focus]:text-gray-900 w-full flex items-center justify-start gap-2",children:[(0,S.jsx)(lt.qVV,{className:"w-5 h-5"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"RQWuCs"})})]})})})})]})]})}),rd>-1?(0,S.jsxs)(S.Fragment,{children:["user"===tH[rd].role?(0,S.jsxs)("button",{type:"button","data-element-id":"replace-only-button",onClick:function(){return o3({edittingIndex:rd,content:tQ,attachmentFiles:a0,regenerate:!1})},disabled:oM||!lS,className:"update-regenerate-button inline-flex items-center px-4 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-green-600 hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 disabled:bg-gray-400 disabled:cursor-default transition-colors whitespace-nowrap space-x-1",style:{height:Math.min(40,sk)},children:[(0,S.jsx)(e4.lgS,{className:"w-4 h-4"}),(0,S.jsxs)("span",{children:[(0,S.jsx)(A.cC,{id:"B81CYu"})," ",(0,S.jsx)(uh,{children:"⌥↵"})]})]}):null,(0,S.jsx)(sL.u,{anchorSelect:".update-regenerate-button",place:"top",children:(0,S.jsx)(A.cC,{id:"alTZor"})}),(0,S.jsxs)("button",{type:"button",onClick:ls,disabled:oM,style:{height:Math.min(40,sk)},"data-element-id":"cancel-edit-message-button",className:"inline-flex items-center px-4 border border-transparent text-sm font-medium rounded-md shadow-sm text-gray-800 bg-gray-200 hover:bg-gray-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-white-500 disabled:bg-gray-400 disabled:cursor-default transition-colors whitespace-nowrap space-x-1",children:[(0,S.jsx)(A.cC,{id:"dEgA5A"})," ",(0,S.jsx)(uh,{children:"⎋"})]})]}):null]})]})]})}),lS&&pL(tQ)?(0,S.jsxs)("div",{className:"text-xs mb-2",children:["\uD83D\uDCA1"," ",(0,S.jsx)(A.cC,{id:"PeRQRx"})]}):null,oN||tl||(0,O.N7)("showUsageLimitsMessage",tn)?(0,S.jsxs)("div",{className:"flex items-center justify-center flex-wrap text-gray-500 gap-2",children:[lS&&oN?(0,S.jsxs)("div",{className:"text-xs text-center",children:["(",(null==tQ?void 0:tQ.length)||0,"/",oN,")"]}):null,tl?(0,S.jsx)("div",{className:"text-xs text-center",children:tl}):(0,O.N7)("showUsageLimitsMessage",tn)&&aS?(0,S.jsx)("span",{className:"text-xs text-center",children:(0,S.jsx)(A.cC,{id:"4JRmPz",components:{0:(0,S.jsx)("button",{onClick:function(){iF(!0)},className:"underline font-bold"})}})}):null]}):null,i_&&(tQ||"").indexOf("\n---")>-1?(0,S.jsxs)("div",{children:[(0,S.jsxs)("div",{className:"text-xs font-semibold text-blue-500 mb-1",children:[(0,S.jsx)(A.cC,{id:"A8sVYP",values:{0:(null===(eA=o4(tQ).queueItems)||void 0===eA?void 0:eA.length)||0}})," ⋅ ",(0,S.jsxs)("button",{onClick:function(){return iZ(!1)},className:"text-red-500 font-semibold hover:underline",children:["(",(0,S.jsx)(A.cC,{id:"cO9+2L"}),")"]})]}),(0,S.jsxs)("div",{className:"text-xs text-gray-500",children:[(0,S.jsx)(C.UZO,{className:"w-4 h-4 inline"})," ",(0,S.jsx)(A.cC,{id:"7fH3I5"})]})]}):null,su>10?(0,S.jsxs)("div",{className:"text-gray-400 text-xs text-center",children:[eO," |"," ",(0,S.jsx)(A.cC,{id:"Lj9mvp",values:{0:sl?oo._({id:"yPA2s0"}):oo._({id:"sV1jTA"})}})]}):null]}))})]})}),(0,O.N7)("modelSettings",tn)&&(0,S.jsx)(lT,{showSystemMessage:(0,O.N7)("systemMessage",tn),systemMessage:nT,setSystemMessage:nM,open:rn,setOpen:ra,model:ns,setModel:function(e){nr(e),setTimeout(function(){ox()},400)},temperature:nB,setTemperature:nL,presencePenalty:n_,setPresencePenalty:nZ,frequencyPenalty:nF,setFrequencyPenalty:nY,topP:nH,topK:nQ,maxTokens:n$,safetySettings:n2,promptCachingEnabled:n3,setTopP:nz,setTopK:nJ,setMaxTokens:n0,setSafetySettings:n4,setPromptCachingEnabled:n6,contextLimit:n8,setContextLimit:n9,streaming:sv,setStreaming:sy,useOrgDefaultModelSettings:e9||(null==se?void 0:se.isEnforceDefaultModel),allowCustomModel:td,modelEnabledMap:tg,systemModels:tx,suggestedModels:tb,allowSaveValuesForFutureChat:!sl&&!se,allowPromptCaching:tD}),(0,S.jsx)(X,{max:!!ts,wide:!ts,open:aB,setOpen:aL,children:(0,S.jsx)(um,{usePrompt:function(e){lc(e),aL(!1)},orgPrompts:ts,canUseCommunityPrompts:of})}),(0,S.jsxs)(X,{open:a_,setOpen:aZ,showCloseButton:!1,wide:!0,children:[(0,S.jsx)(d4,{onPrint:function(){aZ(!1),setTimeout(function(){window.print()},1e3)},chatID:eO,onOpenManageSharedLinks:function(){aZ(!1),tT()},showManageSharedLinks:!!tT}),(0,S.jsx)("div",{className:"my-2 text-center",children:(0,S.jsx)("button",{onClick:function(){return aZ(!1)},className:"text-blue-500 hover:underline disabled:text-gray-500",children:(0,S.jsx)(A.cC,{id:"yz7wBu"})})})]}),(0,S.jsx)(X,{open:aG,setOpen:aF,showCloseButton:!1,max:!0}),(0,S.jsxs)(X,{open:aW,setOpen:aQ,wide:!0,children:[(0,S.jsx)("h3",{className:"text-lg font-semibold text-center",children:(0,S.jsx)(A.cC,{id:"AURbCJ"})}),(0,S.jsx)("div",{className:"mt-6 mb-8 ",children:tH.map(function(e,t){return m7(m7({},e),{},{index:t})}).filter(function(e){return e.isPinned}).map(function(e){return(0,S.jsxs)("div",{className:"my-4 relative hover:first:[&>div]:bg-[unset] bg-gray-50 hover:bg-gray-100 rounded-md cursor-pointer dark:bg-zinc-800 dark:hover:bg-zinc-600 ",onClick:function(){aQ(!1),lv(e.index)},children:[(0,S.jsx)(mD,{showActions:!1,message:e,toolInfoLookup:lA,functionInfo:e.function_call||"function"===e.role?oC.find(function(t){var n;return t.id===(null===(n=e.function_call)||void 0===n?void 0:n.name)||t.id===e.name}):null,userProfilePicURL:null==sj?void 0:sj.picURL,fontSize:aH,showTimestamp:!1,shouldShowInteractiveHTML:!!oq.has(e.name)}),(0,S.jsx)(eS,{onConfirmed:function(){return lp(e.index)},className:"absolute -top-2 -right-2 z-10",children:(0,S.jsx)(Y.LHV,{className:"w-5 h-5 text-gray-400 hover:text-gray-600 dark:text-zinc-100 dark:hover:text-zinc-400 "})})]},e.index)})})]}),(0,S.jsx)(X,{open:!!ip,setOpen:ih,children:ip?(f=(null==(g=oJ(ip.id))?void 0:g.isEnforceDefaultModel)&&oj(null==g?void 0:g.defaultModel)||oA,w=g.isEnforceAssignedPlugins?oS(g,f):oE,(0,S.jsx)(dN,{character:g,characterPlugins:w,allowChange:!1})):null}),(0,S.jsx)(X,{open:!!ix,setOpen:ib,children:ix?(k=oj(ix),se?(0,S.jsx)(dN,{character:se,characterPlugins:oE,allowChange:!1}):(0,S.jsx)("div",{children:k&&(0,O.N7)("modelSettings",tn)?(0,S.jsxs)("div",{children:[(0,S.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,S.jsx)("div",{children:(0,S.jsx)(ef,{size:"medium",model:ix,defaultURL:ok})}),(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"text-base font-semibold",children:k.title}),(0,S.jsx)("div",{className:"text-gray-500 text-xs",children:k.modelID})]})]}),(0,S.jsx)("div",{className:"mt-4",children:null==k?void 0:k.details})]}):(0,S.jsx)("div",{children:ez?ez():(0,S.jsx)("div",{className:"text-center",children:(0,S.jsx)(A.cC,{id:"INI7x0"})})})})):null}),(0,S.jsx)(X,{open:!!iy,setOpen:iw,children:iy?(N=oC.find(function(e){var t;return(null===(t=e.openaiSpec)||void 0===t?void 0:t.name)===iy}),(0,S.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,S.jsx)("div",{className:"w-9 h-9 flex items-center justify-center text-3xl",children:(0,S.jsx)(s2,{size:"medium",plugin:N})}),(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"text-base font-semibold",children:null==N?void 0:N.title}),(0,S.jsx)("div",{className:"text-gray-500 text-xs",children:(0,S.jsx)(A.cC,{id:"fOuPPd"})})]})]})):null}),(0,S.jsx)(dS,{open:io,setOpen:il,selectCharacter:function(e){return e_({character:e})}}),(0,O.N7)("showUsageLimitsMessage",tn)&&(0,S.jsx)(m1,{open:iG,setOpen:iF,modelID:ns,characterID:null==se?void 0:se.id}),null!=iP&&iP.length?(0,S.jsx)("div",{className:"fixed z-50 bottom-40 sm:right-20 max-w-full sm:max-w-[300px] px-10",children:(0,S.jsxs)("div",{className:"bg-gray-100 dark:bg-gray-700 dark:text-gray-200 text-gray-900 p-4 shadow-md rounded-md space-y-2",children:[(0,S.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,S.jsxs)("div",{className:"font-semibold flex items-center justify-start gap-2 text-gray-500",children:[(0,S.jsx)(lt.qVV,{className:"w-5 h-5"}),(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"b24kPi"})})]}),(0,S.jsx)("button",{onClick:function(){return iT([])},className:"text-blue-500 hover:underline font-semibold text-sm ml-1",children:(0,S.jsx)(A.cC,{id:"xCJdfg"})})]}),iP.map(function(e,t){return(0,S.jsxs)("div",{className:"my-1 py-1 px-2 rounded border border-gray-200 truncate text-sm bg-white dark:bg-gray-900 dark:border-gray-700",children:[0===t?(0,S.jsx)(lt.NOE,{className:"w-4 h-4 inline"}):(0,S.jsx)(lt.PT3,{className:"w-4 h-4 inline"})," ",e.content]},t)})]})}):null,iQ&&i0&&i1&&iH?(0,S.jsx)(m3,{toolInfoLookup:lA,selectedArtifact:i1,artifactsGroupsMap:i4,selectArtifact:i5,onUnpinArtifacts:function(){return iz(!1)}}):null]},eO)}function pY(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,s)}return n}function pU(e){for(var t=1;t0&&void 0!==ef[0]?ef[0]:"replace",e.prev=1,!hc(M=(T=null==i?void 0:i.success).data||{chats:T.chats})){e.next=6;break}return e.abrupt("return");case 6:if("clone"===t&&((M.installedPlugins||[]).forEach(function(e){if(e.syncedAt){var t,n=e.id;e.id=(0,tJ.Z)(),e.uuid=(0,tJ.Z)(),null!==(t=e.openaiSpec)&&void 0!==t&&t.name&&(e.openaiSpec.name=e.openaiSpec.name.replace(n,e.id)),e.code&&(e.code=e.code.replace(n,e.id)),M.userPluginSettings&&(M.userPluginSettings[e.id]=M.userPluginSettings[n],delete M.userPluginSettings[n])}}),null===(B=M.userPrompts)||void 0===B||B.forEach(function(e){if(e.syncedAt){var t=e.id;e.id=(0,tJ.Z)(),M.promptSettings&&(M.promptSettings[e.id]=M.promptSettings[t],delete M.promptSettings[t])}}),(M.userCharacters||[]).forEach(function(e){if(e.syncedAt){var t=e.id;e.id=(0,tJ.Z)(),M.characterSettings&&(M.characterSettings[e.id]=M.characterSettings[t],delete M.characterSettings[t])}}),null===(L=M.folders)||void 0===L||L.forEach(function(e){if(e.syncedAt){var t,n=e.id,s=(0,tJ.Z)();e.id=s,null===(t=M.chats)||void 0===t||t.forEach(function(e){e.folderID===n&&(e.folderID=s)})}}),null===(_=M.chats)||void 0===_||_.forEach(function(e){if(e.syncedAt){var t=(0,tJ.Z)();e.id=t,e.chatID=t}})),null===(n=M.userPrompts)||void 0===n||n.forEach(function(e){e.syncedAt=null}),(M.userCharacters||[]).forEach(function(e){e.syncedAt=null}),null===(s=M.folders)||void 0===s||s.forEach(function(e){e.syncedAt=null}),null===(r=M.chats)||void 0===r||r.forEach(function(e){e.syncedAt=null}),!((null===(a=M.chats)||void 0===a?void 0:a.length)>0)){e.next=14;break}return e.next=14,(0,K.CQ)().setMany(M.chats.map(function(e){return["CHAT_"+e.chatID,e]}));case 14:Z=(0,O.FW)(M.chats||[]),l(F=[].concat((0,v.Z)(Z),(0,v.Z)(o)).filter(function(e,t,n){return t===n.findIndex(function(t){return t.chatID===e.chatID})})),Y=[],null!==(d=M.folders)&&void 0!==d&&d.length&&(U={},N.forEach(function(e){U[e.id]=e}),M.folders.forEach(function(e){U[e.id]=e}),C(Y=Object.values(U))),z=[],null!==(u=M.userPrompts)&&void 0!==u&&u.length&&(W={},m.forEach(function(e){W[e.id]=e}),M.userPrompts.forEach(function(e){W[e.id]=e}),p(z=Object.values(W))),J=[],null!==(h=M.userCharacters)&&void 0!==h&&h.length&&(X={},f.forEach(function(e){X[e.id]=e}),M.userCharacters.forEach(function(e){X[e.id]=e}),b(J=Object.values(X))),$=[],null!==(g=M.installedPlugins)&&void 0!==g&&g.length&&(et={},V.forEach(function(e){et[e.id]=e}),M.installedPlugins.forEach(function(e){et[e.id]=e}),P($=Object.values(et))),en=[],null!==(x=M.customModels)&&void 0!==x&&x.length&&(er={},eB.forEach(function(e){er[e.id]=e}),M.customModels.forEach(function(e){er[e.id]=e}),eL(en=Object.values(er))),ea=[],null!==(y=M.userProfiles)&&void 0!==y&&y.length&&(eo={},eP.forEach(function(e){eo[e.id]=e,e.isCurrent&&(el=e)}),M.userProfiles.forEach(function(e){eo[e.id]=e}),el&&(eo[el.id].isCurrent=!0),eT(ea=Object.values(eo))),ed={customSearchEngineID:eH,customSearchAPIKey:eQ,userPluginSettings:function(e){e$(function(t){return pU(pU({},t),e)})},hiddenButtons:eZ,actionButtonsLabel:eF,streaming:ew,automaticTitle:ek,suggestKeywords:eq,searchEngine:eE,defaultModel:R,defaultSystemMessage:G,defaultTemperature:H,defaultPresencePenalty:Q,defaultFrequencyPenalty:ee,defaultTopP:es,defaultTopK:ei,defaultMaxTokens:ec,defaultSafetySettings:em,defaultPromptCachingEnabled:eg,defaultContextLimit:eb,keyboardShortcuts:D,characterSettings:function(e){e2(function(t){return pU(pU({},t),e)})},promptSettings:function(e){e3(function(t){return pU(pU({},t),e)})}},Object.keys(M).forEach(function(e){ed[e]&&ed[e](M[e])}),eu=[],ep=[],null!==(w=M.userPrompts)&&void 0!==w&&w.length&&(eu.push(c._({id:"83la/n",values:{0:M.userPrompts.length}})),ep.push(c._({id:"83la/n",values:{0:z.length}}))),null!==(A=M.userCharacters)&&void 0!==A&&A.length&&(eu.push(c._({id:"IPXOXm",values:{0:M.userCharacters.length}})),ep.push(c._({id:"IPXOXm",values:{0:J.length}}))),null!==(k=M.installedPlugins)&&void 0!==k&&k.length&&(eu.push(c._({id:"yxF19Y",values:{0:M.installedPlugins.length}})),ep.push(c._({id:"yxF19Y",values:{0:$.length}}))),null!==(q=M.customModels)&&void 0!==q&&q.length&&(eu.push(c._({id:"ao4ihU",values:{0:M.customModels.length}})),ep.push(c._({id:"ao4ihU",values:{0:en.length}}))),null!==(I=M.folders)&&void 0!==I&&I.length&&(eu.push(c._({id:"Ftz/t9",values:{0:M.folders.length}})),ep.push(c._({id:"Ftz/t9",values:{0:Y.length}}))),null!==(S=M.chats)&&void 0!==S&&S.length&&(eu.push(c._({id:"iwKytO",values:{0:M.chats.length}})),ep.push(c._({id:"iwKytO",values:{0:F.length}}))),null!==(E=M.userProfiles)&&void 0!==E&&E.length&&(eu.push(c._({id:"WngjJs",values:{0:M.userProfiles.length}})),ep.push(c._({id:"WngjJs",values:{0:ea.length}}))),eh=null==i?void 0:i.fail,e8([c._({id:"Bbn1qh",values:{0:eu.join(", ")}}),(null==eh?void 0:eh.length)&&c._({id:"CoiZM+",values:{0:eh.length}}),c._({id:"zFLIIJ",values:{0:ep.join(", ")}}),c._({id:"gqbLFw"})].filter(Boolean).join(". ")),tt(1),tr(!0),to(!!(null==eh?void 0:eh.length)),e.next=52;break;case 48:e.prev=48,e.t0=e.catch(1),console.error(e.t0),alert(c._("Something went wrong. Please try again."));case 52:case"end":return e.stop()}},e,null,[[1,48]])})),function(){return t.apply(this,arguments)});return(0,q.useEffect)(function(){r||(tt(0),e8(""),to(!1))},[r]),(0,q.useEffect)(function(){if(r){var e=null==i?void 0:i.success;if(!e||!(e.data||e.chats)){e8(c._({id:"UFFTVk"})),tt(1);return}var t=e.data||{chats:e.chats};if(hc(t)){e8(c._({id:"e50+si"})),tt(1);return}var n=[];if((null===(s=t.userPrompts)||void 0===s?void 0:s.length)>0&&n.push(c._({id:"83la/n",values:{0:t.userPrompts.length}})),(null===(a=t.userCharacters)||void 0===a?void 0:a.length)>0&&n.push(c._({id:"IPXOXm",values:{0:null===(d=t.userCharacters)||void 0===d?void 0:d.length}})),(null===(o=t.folders)||void 0===o?void 0:o.length)>0&&n.push(c._({id:"Ftz/t9",values:{0:t.folders.length}})),(null===(l=t.chats)||void 0===l?void 0:l.length)>0&&n.push(c._({id:"iwKytO",values:{0:t.chats.length}})),n.length>0){var s,a,o,l,d,u,m,p,h,g=[];null!==(u=t.userPrompts)&&void 0!==u&&u.some(function(e){return e.syncedAt})&&g.push(c._({id:"Ad1kG/"})),null!==(m=t.userCharacters)&&void 0!==m&&m.some(function(e){return e.syncedAt})&&g.push(c._({id:"87RRXI"})),null!==(p=t.folders)&&void 0!==p&&p.some(function(e){return e.syncedAt})&&g.push(c._({id:"5TAuaz"})),null!==(h=t.chats)&&void 0!==h&&h.some(function(e){return e.syncedAt})&&g.push(c._({id:"5j4DOc"})),(t.installedPlugins||[]).some(function(e){return e.syncedAt})&&g.push(c._({id:"eTB1Zi"})),g.length>0?(e8((0,S.jsx)("div",{className:"text-left",children:(0,S.jsx)(A.cC,{id:"GdBrLi",values:{0:n.join(", "),1:g.join(", ")},components:{0:(0,S.jsx)("span",{className:"block mt-2 text-orange-500 text-sm"}),1:(0,S.jsx)("b",{}),2:(0,S.jsx)("br",{}),3:(0,S.jsx)("br",{})}})})),tt(3)):(e8(n.length?c._({id:"n1w4iu",values:{0:n.join(", ")}}):c._({id:"bN4bod"})),tt(2));return}tl()}},[i,r]),(0,S.jsxs)(X,{wide:!0,open:r,setOpen:a,showCloseButton:!1,delayMount:!0,children:[(0,S.jsx)("h2",{className:"text-center text-xl font-bold",children:(0,S.jsx)(A.cC,{id:"FhMhTR"})}),(0,S.jsx)("hr",{className:"my-4"}),(0,S.jsxs)("div",{className:"space-y-8",children:[(0,S.jsx)("div",{className:"text-base text-center",children:e7}),(null==i||null===(n=i.fail)||void 0===n?void 0:n.length)>0&&ti&&(0,S.jsxs)("details",{className:"!mt-4",children:[(0,S.jsx)("summary",{className:"text-center hover:underline cursor-pointer",children:(0,S.jsx)(A.cC,{id:"Ada8m+",values:{0:null==i||null===(s=i.fail)||void 0===s?void 0:s.length}})}),(0,S.jsx)("div",{className:"mt-4 space-y-4 w-full",children:null==i?void 0:i.fail.map(function(e,t){return(0,S.jsxs)("details",{className:"",children:[(0,S.jsx)("summary",{className:"max-w-[300px] mx-auto hover:underline cursor-pointer",children:e.title||e.id||"(Untitled)"}),(0,S.jsx)(cG,{minHeight:200,className:"mt-1",children:(0,S.jsx)("div",{children:(0,S.jsx)(iS,{language:"json",className:"h-[200px] overflow-auto",children:JSON.stringify(e,null,2)})})})]})})})]}),1===te&&(0,S.jsx)("div",{className:"flex justify-center",children:(0,S.jsx)("button",{onClick:function(){ts&&window.location.reload(),a(!1)},className:"inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 disabled:cursor-default transition-colors whitespace-nowrap space-x-1",children:(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"zga9sT"})})})}),2===te&&(0,S.jsxs)("div",{className:"flex space-x-2 items-center justify-center",children:[(0,S.jsx)("button",{onClick:function(){return a(!1)},className:" text-black dark:text-white transition font-bold py-2 px-4 rounded inline-flex space-x-1 justify-center items-center",children:(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"dEgA5A"})})}),(0,S.jsx)("button",{onClick:function(){return tl()},className:"flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 disabled:cursor-default transition-colors whitespace-nowrap space-x-1",children:(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"zga9sT"})})})]}),3===te&&(0,S.jsxs)("div",{className:"flex flex-col space-y-2 items-center",children:[(0,S.jsxs)("div",{className:"flex relative items-center",children:[(0,S.jsx)("button",{onClick:function(){return tl()},className:"min-w-[150px] flex items-center justify-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-orange-600 hover:bg-orange-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-orange-500 disabled:bg-gray-400 disabled:cursor-default transition-colors whitespace-nowrap space-x-1",children:(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"2iY5s/"})})}),(0,S.jsx)("span",{className:"replace absolute left-full ml-2 text-black dark:text-white",children:(0,S.jsx)(Y.znh,{size:20})}),(0,S.jsx)(sL.u,{anchorSelect:".replace",place:"top",children:(0,S.jsx)(A.cC,{id:"z46NBz"})})]}),(0,S.jsxs)("div",{className:"flex relative items-center",children:[(0,S.jsx)("button",{onClick:function(){return tl("clone")},className:"min-w-[150px] flex items-center justify-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 disabled:cursor-default transition-colors whitespace-nowrap space-x-1",children:(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"EILfvI"})})}),(0,S.jsx)("span",{className:"clone absolute left-full ml-2 text-black dark:text-white",children:(0,S.jsx)(Y.znh,{size:20})}),(0,S.jsx)(sL.u,{anchorSelect:".clone",place:"top",children:(0,S.jsx)(A.cC,{id:"PVi43z"})})]}),(0,S.jsx)("button",{onClick:function(){return a(!1)},className:" text-black dark:text-white transition font-bold py-2 px-4 rounded inline-flex space-x-1 justify-center items-center",children:(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"dEgA5A"})})})]})]})]})}function hu(){var e=(0,q.useState)(!1),t=e[0],n=e[1];return(0,q.useEffect)(function(){window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB||n(!0)},[]),(0,S.jsxs)(X,{open:t,setOpen:n,showCloseButton:!1,children:[(0,S.jsx)("h2",{className:"text-center text-xl font-bold flex items-center justify-center space-x-2",children:(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"/lmbYn"})})}),(0,S.jsx)("div",{className:"my-2 text-center text-sm",children:(0,S.jsx)(A.cC,{id:"BTNnlL"})}),(0,S.jsx)("div",{className:"mt-6 text-center gap-2 flex items-center justify-center",children:(0,S.jsx)("button",{onClick:function(){return n(!1)},className:"inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 space-x-1 disabled:bg-gray-500",children:(0,S.jsx)("span",{children:(0,S.jsx)(A.cC,{id:"FPsvA8"})})})})]})}var hm=n(77208),hp=n(96026),hh=n.n(hp);function hg(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,s)}return n}function hf(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{};return ev({page:null!==(e=s.page)&&void 0!==e?e:ed,sort:null!==(t=s.sort)&&void 0!==t?t:J,selectedType:null!==(n=s.selectedType)&&void 0!==n?n:et})}var ew=function(){var e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];W(R.reduce(function(t,n){return hf(hf({},t),{},(0,b.Z)({},n.id,e))},{}))},ej=function(e){W(hf(hf({},z),{},(0,b.Z)({},e,!z[e])))},eA=(n=(0,x.Z)(j().mark(function e(t,n){var s;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return P(!0),B(null),n&&U(!0),e.prev=3,e.next=6,fetch("/api/cloud/storage/delete",{headers:{"Content-Type":"application/json"},method:"POST",body:JSON.stringify(n?{isDeleteAll:n}:{ids:t.map(function(e){return e.id}),type:et})});case 6:if(e.sent.ok){e.next=10;break}return B(u._(hx)),e.abrupt("return");case 10:return h(),e.next=13,ey();case 13:if(!(!(null!==(s=e.sent.items)&&void 0!==s&&s.length)&&ed>0)){e.next=18;break}return eu(ed-1),e.next=18,ey({page:ed-1});case 18:eC.ZP.success(u._({id:"uNTuV6"})),e.next=25;break;case 21:e.prev=21,e.t0=e.catch(3),B(u._(hx)),console.error(e.t0);case 25:return e.prev=25,P(!1),W({}),U(!1),el(!1),e.finish(25);case 31:case"end":return e.stop()}},e,null,[[3,21,25,31]])})),function(e,t){return n.apply(this,arguments)}),ek=(s=(0,x.Z)(j().mark(function e(t){var n;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return P(!0),$(n=(null==J?void 0:J.sortBy)===t?{sortBy:t,order:"asc"===J.order?"desc":J.order?null:"asc"}:{sortBy:t,order:"asc"}),eu(0),e.next=6,ey({sort:n,page:0});case 6:P(!1);case 7:case"end":return e.stop()}},e)})),function(e){return s.apply(this,arguments)}),eN=(r=(0,x.Z)(j().mark(function e(t){return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t!==et){e.next=2;break}return e.abrupt("return");case 2:return N(!0),en(t),W({}),eu(0),_([]),eh(0),ex(0),e.next=11,ey({selectedType:t,page:0});case 11:N(!1);case 12:case"end":return e.stop()}},e)})),function(e){return r.apply(this,arguments)}),eq=(a=(0,x.Z)(j().mark(function e(t){return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return P(!0),eu(t),W({}),e.next=5,ey({page:t});case 5:P(!1);case 6:case"end":return e.stop()}},e)})),function(e){return a.apply(this,arguments)}),eI=Object.values(z).filter(Boolean).length,eE=Math.ceil(ep/50)-1;return(0,S.jsxs)(X,{max:!0,open:l,setOpen:c,title:u._({id:"s4xjn0"}),position:"top",closeButtonClassName:V?"opacity-50":"",children:[V&&(0,S.jsx)("div",{className:"absolute top-0 left-0 w-full h-full bg-opacity-5 bg-black flex items-center justify-center z-10"}),(0,S.jsxs)("div",{className:"flex items-center justify-between space-x-2 mt-8 mb-3",children:[(0,S.jsxs)("div",{children:[(0,S.jsx)(A.cC,{id:"AeXO77"}),":"," ",(0,S.jsx)("span",{className:"font-semibold",children:(null==v||null===(i=v.user)||void 0===i?void 0:i.email)||(null==v||null===(o=v.user)||void 0===o?void 0:o.externalUserID)})]}),(0,S.jsx)("button",{onClick:function(){return el(!0)},className:"text-blue-500 font-semibold disabled:pointer-events-none disabled:text-gray-400",disabled:V,children:(0,S.jsx)(A.cC,{id:"zljzWo"})})]}),p?(0,S.jsxs)("div",{className:"w-full",children:[(0,S.jsx)("div",{className:"my-2 h-4 w-full bg-green-500 rounded-lg overflow-hidden relative",children:(0,S.jsx)("div",{style:{width:"".concat(p.totalUsageBytes/p.limitUsageBytes*100,"%")},className:"h-4 w-full bg-red-500 absolute top-0 left-0 bottom-0"})}),(0,S.jsxs)("div",{className:"flex items-center justify-between text-xs",children:[(0,S.jsxs)("div",{className:"flex space-x-1",children:[(0,S.jsxs)("p",{children:[(0,S.jsx)(A.cC,{id:"7FaY4u"}),":"," ",(0,S.jsx)("b",{children:(0,O.td)(p.totalUsageBytes)})," (",(p.totalUsageBytes/p.limitUsageBytes*100).toFixed(2),"%)"]}),g&&(0,S.jsx)("div",{className:"scale-[0.64] h-0 mt-0.5",children:(0,S.jsx)(E,{})})]}),(0,S.jsxs)("div",{children:[(0,S.jsx)(A.cC,{id:"yRkqG9"}),":"," ",(0,S.jsx)("b",{children:p.limitUsageBytes===Number.MAX_SAFE_INTEGER?u._({id:"NIuIk1"}):(0,O.td)(p.limitUsageBytes)})," ",p.isPaid?"":u._({id:"3ixyNq"})]})]})]}):null,eo&&(0,S.jsx)("div",{className:(0,O.AK)(V?"opacity-70":"","mt-6 border-l-4 border-yellow-400 bg-yellow-50 p-4"),children:(0,S.jsxs)("div",{className:"flex",children:[(0,S.jsx)("div",{className:"flex-shrink-0",children:(0,S.jsx)(hm.Z,{className:"h-5 w-5 text-yellow-400","aria-hidden":"true"})}),(0,S.jsxs)("div",{className:"ml-3",children:[(0,S.jsx)("div",{className:"text-sm text-yellow-700",children:(0,S.jsx)(A.cC,{id:"aS8e0y"})}),(0,S.jsx)("div",{className:"mt-4",children:(0,S.jsxs)("div",{className:"flex",children:[(0,S.jsxs)("button",{type:"button",className:(0,O.AK)("disabled:pointer-events-none relative rounded-md bg-red-500 text-white px-3 py-2 text-sm font-medium hover:bg-red-600 focus:outline-none focus:ring-2 focus:ring-red-600 focus:ring-offset-2 focus:ring-offset-red-50"),onClick:function(){return eA(null,!0)},disabled:V||Y,children:[(0,S.jsx)("span",{className:(0,O.AK)(Y?"opacity-0":""),children:(0,S.jsx)(A.cC,{id:"doZNDE"})}),Y&&(0,S.jsx)("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",children:(0,S.jsx)(E,{})})]}),(0,S.jsx)("button",{type:"button",className:"ml-3 rounded-md bg-yellow-50 px-3 py-2 text-sm font-medium text-yellow-800 hover:bg-yellow-100 focus:outline-none focus:ring-2 focus:ring-yellow-600 focus:ring-offset-2 focus:ring-offset-yellow-50",onClick:function(){return el(!1)},children:(0,S.jsx)(A.cC,{id:"dEgA5A"})})]})})]})]})}),(0,S.jsx)("div",{className:(0,O.AK)("mt-6 border-l-4 border-yellow-400 bg-yellow-50 p-4",V?"opacity-70":""),children:(0,S.jsxs)("div",{className:"flex",children:[(0,S.jsx)("div",{className:"flex-shrink-0",children:(0,S.jsx)(hm.Z,{className:"h-5 w-5 text-yellow-400","aria-hidden":"true"})}),(0,S.jsx)("div",{className:"ml-3",children:(0,S.jsx)("p",{className:"text-sm text-yellow-700",children:(0,S.jsx)(A.cC,{id:"L5HMiK",components:{0:(0,S.jsx)("p",{className:"mb-1"})}})})})]})}),(0,S.jsx)("div",{className:(0,O.AK)("w-full mt-6 mb-4 flex",V?"opacity-70":""),children:(0,S.jsx)("div",{className:"mx-auto overflow-hidden",children:(0,S.jsx)("div",{className:"flex items-start justify-start gap-2 overflow-auto whitespace-nowrap pt-1 pb-3",children:[{label:(0,S.jsx)(A.cC,{id:"an5hVd"}),value:O.Ae.BLOB},{label:(0,S.jsx)(A.cC,{id:"8Q+lLG"}),value:O.Ae.CHAT},{label:(0,S.jsx)(A.cC,{id:"Qmr3jO"}),value:O.Ae.PROMPT},{label:(0,S.jsx)(A.cC,{id:"uHkL3b"}),value:O.Ae.CHARACTER},{label:(0,S.jsx)(A.cC,{id:"ohUJJM"}),value:O.Ae.PLUGIN}].map(function(e){return(0,S.jsx)("button",{onClick:function(){return eN(e.value)},className:(0,O.AK)("w-fit inline-flex items-center px-3 py-2 border text-sm rounded-md focus:outline-none gap-2 transition-colors justify-between","disabled:pointer-events-none",et===e.value?"bg-blue-100 hover:bg-blue-200 text-black border-blue-500 dark:bg-gray-700 dark:text-white":"bg-gray-100 hover:bg-gray-200 border-transparent dark:bg-gray-800 dark:text-gray-300 text-gray-700"),disabled:k,children:(0,S.jsx)("span",{className:"flex items-center justify-center gap-2",children:e.label})},e.value)})})})}),D&&(0,S.jsx)("div",{className:"text-sm text-red-500 my-4",children:D}),ep>0&&!k?(0,S.jsxs)("div",{className:(0,O.AK)(V?"opacity-70":""),children:[(0,S.jsxs)("div",{className:"flex relative items-center",children:[(0,S.jsx)("div",{className:(0,O.AK)("absolute top-0 left-0 h-full flex items-center",eI>0?"opacity-0 -z-10":""),children:(0,S.jsxs)("div",{children:[(0,S.jsx)("span",{className:"font-semibold",children:(0,S.jsx)(A.cC,{id:"4Lzyp6"})})," ",(0,S.jsx)("span",{children:(0,O.td)(ef)})," ",null!=p&&p.totalUsageBytes?(0,S.jsx)(A.cC,{id:"4ZWIlk",values:{0:(ef/p.totalUsageBytes*100).toFixed(2)}}):null]})}),(0,S.jsxs)("div",{className:(0,O.AK)(eI>0?"opacity-1":"opacity-0 pointer-events-none","flex items-center text-sm bg-gray-100 dark:bg-zinc-700 px-2 py-1.5 rounded-full"),children:[(0,S.jsx)("div",{className:"hover:bg-gray-200 dark:hover:bg-zinc-600 rounded-full mr-1 cursor-pointer",onClick:function(){return ew(!1)},children:(0,S.jsx)(ln.j7p,{className:"text-gray-500 dark:text-zinc-100 w-6 h-6"})}),(0,S.jsxs)("p",{className:"text-gray-500 dark:text-zinc-100",children:[(0,S.jsx)(A.cC,{id:"7HsnfO",values:{totalSelected:eI},components:{0:(0,S.jsx)("b",{})}}),":"]}),V&&!K?(0,S.jsx)("div",{className:"mx-4 text-gray-500 font-semibold",children:(0,S.jsx)(E,{})}):(0,S.jsx)(eS,{className:"text-red-500 mx-2 font-semibold hover:underline disabled:pointer-events-none disabled:text-gray-400",onConfirmed:function(){eA(R.filter(function(e){return z[e.id]}))},children:(0,S.jsx)(A.cC,{id:"cnGeoo"})})]})]}),(0,S.jsx)("div",{className:"overflow-auto mt-3",children:(0,S.jsxs)("table",{className:"w-full min-w-[540px] divide-y divide-gray-300 dark:divide-gray-600",children:[(0,S.jsx)("thead",{children:(0,S.jsxs)("tr",{children:[(0,S.jsx)("th",{scope:"col",className:"relative px-7",children:(0,S.jsx)("input",{type:"checkbox",className:"absolute left-4 top-1/2 -mt-2 h-4 w-4 rounded border-gray-300 text-blue-500 focus:ring-blue-500",checked:eI===R.length,onChange:function(e){ew(e.target.checked)}})}),(0,S.jsx)("th",{scope:"col",className:"px-3 py-3.5 text-left text-sm font-semibold text-gray-900 dark:text-white",children:et===O.Ae.BLOB?(0,S.jsx)(A.cC,{id:"hG89Ed"}):(0,S.jsx)(A.cC,{id:"MHrjPM"})}),(0,S.jsx)("th",{scope:"col",className:"px-3 py-3.5 text-left text-sm font-semibold text-gray-900 dark:text-white",children:(0,S.jsxs)("a",{href:"#",className:"group inline-flex",onClick:function(){return ek("size")},children:[(0,S.jsx)(A.cC,{id:"Cj2Gtd"}),(0,S.jsx)("span",{className:(0,O.AK)("ml-2 flex-none rounded","size"===J.sortBy&&J.order?"text-gray-700 bg-gray-100 dark:bg-zinc-800 dark:text-white group-hover:bg-gray-200 dark:group-hover:bg-zinc-700":"invisible text-gray-500 group-hover:visible","asc"===J.order?"-scale-y-100":""),children:(0,S.jsx)(r1.Z,{className:"h-5 w-5","aria-hidden":"true"})})]})}),(0,S.jsx)("th",{scope:"col",className:"px-3 py-3.5 text-left text-sm font-semibold text-gray-900 dark:text-white",children:(0,S.jsxs)("a",{href:"#",className:"group inline-flex",onClick:function(){return ek("syncedAt")},children:[et===O.Ae.BLOB?(0,S.jsx)(A.cC,{id:"9Vfh5E"}):(0,S.jsx)(A.cC,{id:"sP8i1e"}),(0,S.jsx)("span",{className:(0,O.AK)("ml-2 flex-none rounded","syncedAt"===J.sortBy&&J.order?"text-gray-700 bg-gray-100 dark:bg-zinc-800 dark:text-white group-hover:bg-gray-200 dark:group-hover:bg-zinc-700":"invisible text-gray-500 group-hover:visible","asc"===J.order?"-scale-y-100":""),children:(0,S.jsx)(r1.Z,{className:"h-5 w-5","aria-hidden":"true"})})]})}),(0,S.jsx)("th",{scope:"col",className:"relative py-3.5 pl-3 pr-0"})]})}),(0,S.jsx)("tbody",{className:"divide-y divide-gray-200 dark:divide-gray-800",children:R.map(function(e){var t;return(0,S.jsxs)("tr",{className:(0,O.AK)("cursor-pointer",z[e.id]?"bg-blue-50 dark:bg-gray-900":"hover:bg-gray-50 dark:hover:bg-zinc-900"),onClick:function(){return ej(e.id)},children:[(0,S.jsx)("td",{className:"relative px-7",children:(0,S.jsx)("input",{type:"checkbox",className:"absolute left-4 top-1/2 -mt-2 h-4 w-4 rounded border-gray-300 text-blue-500 focus:ring-blue-500",checked:z[e.id],onChange:function(t){t.stopPropagation(),ej(e.id)}})}),(0,S.jsx)("td",{className:(0,O.AK)("px-3 py-4 text-sm text-gray-500"),children:et!==O.Ae.BLOB?(0,S.jsx)("p",{className:"font-medium text-gray-900 dark:text-white",children:e.chatTitle||(null===(t=e.data)||void 0===t?void 0:t.title)||"-"}):(0,S.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,S.jsx)("div",{children:(0,S.jsx)("img",{src:e.url,className:"h-[100px] object-contain"})}),(0,S.jsx)("button",{onClick:function(t){t.stopPropagation(),window.open(e.url)},className:"rounded-full hover:bg-gray-200 dark:hover:bg-gray-800 p-0.5",children:(0,S.jsx)(M.uKn,{className:"w-5 h-5 text-gray-500"})})]})}),(0,S.jsx)("td",{className:"whitespace-nowrap px-3 py-4 text-sm text-gray-500",children:(0,S.jsx)("span",{children:(0,O.td)(e.size)})}),(0,S.jsx)("td",{className:"whitespace-nowrap px-3 py-4 text-sm text-gray-500",children:new Date(e.syncedAt).toLocaleString()}),(0,S.jsx)("td",{className:"whitespace-nowrap px-3 py-4 text-sm text-gray-500 min-w-[80px]",children:(0,S.jsx)("div",{className:"flex justify-end items-center",children:(0,S.jsxs)("div",{className:"relative",children:[K===e.id&&(0,S.jsx)("div",{className:(0,O.AK)("absolute left-0 top-0 w-full h-full flex items-center justify-center"),children:(0,S.jsx)(E,{})}),(0,S.jsx)(eS,{className:(0,O.AK)("text-red-500 font-semibold hover:underline disabled:pointer-events-none disabled:text-gray-400",K===e.id?"opacity-0":""),onConfirmed:(0,x.Z)(j().mark(function t(){return j().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return G(e.id),t.next=3,eA([e]);case 3:G(null);case 4:case"end":return t.stop()}},t)})),children:(0,S.jsx)(A.cC,{id:"cnGeoo"})})]})})})]},e.id)})})]})}),(0,S.jsxs)("div",{className:"flex flex-wrap items-center justify-between px-4 py-3 border-t border-gray-200 dark:border-gray-600",children:[(0,S.jsx)("p",{className:"my-1 text-sm text-gray-700 dark:text-white",children:(0,S.jsx)(A.cC,{id:"pRcxFW",values:{0:Math.min(50*ed+1,ep),1:Math.min((ed+1)*50,ep),totalResult:ep},components:{0:(0,S.jsx)("span",{className:"font-medium"}),1:(0,S.jsx)("span",{className:"font-medium"}),2:(0,S.jsx)("span",{className:"font-medium"})}})}),(0,S.jsxs)("div",{className:"my-1 ml-auto flex space-x-5 text-gray-700 dark:text-white",children:[(0,S.jsx)("button",{className:"hover:underline font-semibold text-sm disabled:pointer-events-none disabled:text-gray-400",onClick:function(){return eq(0)},disabled:ed<1,children:(0,S.jsx)(e4.ldB,{className:"-m-1"})}),(0,S.jsx)("button",{className:"hover:underline font-semibold text-sm disabled:pointer-events-none disabled:text-gray-400",onClick:function(){return eq(ed-1)},disabled:ed<1,children:(0,S.jsx)(e4.DEl,{className:"-m-1"})}),hh()(Math.max(0,Math.min(eE-4,ed-2)),Math.min(eE,Math.max(4,ed+2))+1).map(function(e){return(0,S.jsx)("button",{className:(0,O.AK)("hover:underline text-gray-600 text-sm dark:text-white",ed===e?"font-bold":""),onClick:function(){return eq(e)},children:e+1},e)}),(0,S.jsx)("button",{className:"hover:underline font-semibold text-sm disabled:pointer-events-none disabled:text-gray-400",onClick:function(){return eq(ed+1)},disabled:ed>eE-1,children:(0,S.jsx)(e4.MOd,{className:"-m-1"})}),(0,S.jsx)("button",{className:"hover:underline font-semibold text-sm disabled:pointer-events-none disabled:text-gray-400",onClick:function(){return eq(eE)},disabled:ed>eE-1,children:(0,S.jsx)(e4.ilJ,{className:"-m-1"})})]})]})]}):k||D?D?null:(0,S.jsx)("div",{className:"pt-8 pb-8 flex items-center justify-center",children:(0,S.jsx)(E,{})}):(0,S.jsx)("div",{className:"pb-8 pt-8 text-center",children:(0,S.jsx)(A.cC,{id:"1dhpFr"})})]})}var hv=[{name:"Products",children:[{name:"TypingMind",href:"/"},{name:"TypingMind for Teams",href:"https://custom.typingmind.com/"}]},{name:"Resources",children:[{name:"Changelog",href:"https://docs.typingmind.com/changelog"},{name:"Documents",href:"https://docs.typingmind.com/"},{name:"Blog",href:"https://blog.typingmind.com/"}]},{name:"Company",children:[{name:"Pricing"},{name:"FAQs",href:"https://www.typingmind.com/faqs"},{name:"Contact",href:"https://www.typingmind.com/contact"}]}];function hy(e){var t=e.handleBuyLicenseKey,n=e.handleTryForFree;return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("div",{className:"my-32 ",children:(0,S.jsx)(sq,{})}),(0,S.jsxs)("div",{className:"mx-8 rounded-3xl overflow-hidden relative bg-blue-50 py-10 sm:py-16 mt-10",children:[(0,S.jsx)("img",{className:"absolute lg:-top-5 opacity-50 sm:opacity-40",src:"/assets/landing-page/bubbles-cta.svg"}),(0,S.jsxs)("div",{className:"mx-auto grid max-w-7xl grid-cols-1 px-6 lg:grid-cols-12 gap-12 lg:px-8",children:[(0,S.jsxs)("div",{className:"z-10 max-w-xl lg:col-span-7 mx-auto",children:[(0,S.jsx)("h2",{className:"text-xl font-bold tracking-tight sm:text-3xl inline sm:block lg:inline xl:block",children:"Get started with TypingMind for free"}),(0,S.jsxs)("div",{className:"flex sm:flex-row flex-col items-center justify-center mt-5 gap-2",children:[(0,S.jsx)("button",{onClick:function(){return t()},className:"w-full max-w-xs sm:w-fit flex items-center justify-center gap-1 px-6 py-3 rounded-full bg-gradient-to-b from-blue-500 to-blue-700 text-white font-semibold hover:via-blue-700 hover:to-blue-900 transition-all focus-visible:outline outline-2 outline-offset-2 outline-blue-500",children:"Buy license key"}),(0,S.jsx)("button",{onClick:function(){return n()},className:"w-full bg-white max-w-xs sm:w-fit flex items-center justify-center gap-2 px-6 py-3 rounded-full border border-gray-400 text-black font-semibold hover:bg-gray-100 transition-all focus-visible:outline outline-2 outline-offset-2 outline-gray-700",children:"Try now for free"})]})]}),(0,S.jsxs)("div",{className:"flex flex-col w-full gap-2 lg:gap-4 justify-end max-w-md lg:col-span-5 mx-auto z-10",children:[(0,S.jsx)("p",{className:"text-left text-sm",children:"Get notified about new features and future giveaways by subscribing to our newsletter \uD83D\uDC47"}),(0,S.jsxs)("form",{action:"https://store.typingmind.com/email-subscribe/external",method:"post",className:"flex sm:flex-row flex-col gap-2 items-center w-full",children:[(0,S.jsx)("input",{className:"w-full placeholder:text-sm block rounded-md bg-white px-3.5 py-2 shadow-sm border border-gray-300 placeholder:text-gray-700 focus:outline-blue-500 focus:outline-offset-0 focus:border-transparent focus:ring-0 sm:leading-6",placeholder:"Enter your email",type:"email",name:"email",id:"email",required:!0}),(0,S.jsx)("button",{className:"whitespace-nowrap sm:w-fit w-full rounded-md bg-gray-900 text-white border border-transparent px-3.5 py-2.5 text-sm font-semibold shadow-sm hover:bg-gray-700 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white",type:"submit",children:"Notify Me"})]})]})]})]}),(0,S.jsx)("footer",{className:"pt-12 mt-10 sm:mt-20",children:(0,S.jsxs)("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:[(0,S.jsxs)("div",{className:"flex md:flex-row flex-col justify-between gap-8 items-start",children:[(0,S.jsxs)("div",{className:"flex mx-auto sm:mx-0 flex-col mb-6 lg:mb-0",children:[(0,S.jsxs)("div",{className:"flex items-center mb-2 gap-2",children:[(0,S.jsx)("img",{src:"/logo.png",alt:"TypingMind",className:"rounded-lg w-9 h-9"}),(0,S.jsxs)("span",{className:"text-3xl font-bold",children:["Typing",(0,S.jsx)("span",{className:"text-blue-500",children:"Mind"})]})]}),(0,S.jsx)("span",{className:"text-gray-800 text-base",children:"The best frontend UI for AI chats."}),(0,S.jsxs)("div",{className:"flex items-center justify-center mt-2 gap-2",children:[(0,S.jsx)("a",{target:"_blank",href:"https://twitter.com/TypingMindApp",className:"bg-gray-700 p-1.5 rounded text-white hover:bg-gray-500 focus-visible:outline outline-2 outline-blue-500 outline-offset-2",children:(0,S.jsx)("svg",{stroke:"currentColor",fill:"currentColor",strokeWidth:"0",viewBox:"0 0 512 512",height:"1em",width:"1em",xmlns:"http://www.w3.org/2000/svg",children:(0,S.jsx)("path",{d:"M389.2 48h70.6L305.6 224.2 487 464H345L233.7 318.6 106.5 464H35.8L200.7 275.5 26.8 48H172.4L272.9 180.9 389.2 48zM364.4 421.8h39.1L151.1 88h-42L364.4 421.8z"})})}),(0,S.jsx)("a",{target:"_blank",href:"https://www.typingmind.com/discord",className:"bg-gray-700 p-1.5 rounded text-white hover:bg-gray-500 focus-visible:outline outline-2 outline-blue-500 outline-offset-2",children:(0,S.jsx)("svg",{stroke:"currentColor",fill:"currentColor",strokeWidth:"0",viewBox:"0 0 24 24",height:"1em",width:"1em",xmlns:"http://www.w3.org/2000/svg",children:(0,S.jsx)("path",{d:"M8.52062 13.8456C7.48059 13.8456 6.63159 12.9011 6.63159 11.7444 6.63159 10.5876 7.45936 9.64307 8.52062 9.64307 9.57123 9.64307 10.4308 10.5876 10.4096 11.7444 10.4096 12.9011 9.57123 13.8456 8.52062 13.8456ZM15.4941 13.8456C14.454 13.8456 13.604 12.9011 13.604 11.7444 13.604 10.5876 14.4328 9.64307 15.4941 9.64307 16.5447 9.64307 17.4043 10.5876 17.3831 11.7444 17.3831 12.9011 16.5553 13.8456 15.4941 13.8456ZM10.1253 4.32272 9.81655 3.75977 9.18323 3.86532C7.71915 4.10934 6.32658 4.54652 5.02544 5.1458L4.79651 5.25124 4.65507 5.45985C2.0418 9.31417 1.3258 13.1084 1.68032 16.836L1.71897 17.2423 2.04912 17.4822C3.78851 18.7463 5.47417 19.5186 7.12727 20.0254L7.91657 20.2674 9.03013 17.5504C10.9397 18.0224 13.0592 18.0225 14.969 17.5508L16.0757 20.2681 16.8668 20.0254C18.5173 19.5191 20.2137 18.7469 21.9466 17.4809L22.2726 17.2428 22.3131 16.8412C22.7491 12.521 21.616 8.75749 19.3547 5.45628L19.2128 5.2492 18.9846 5.1448C17.6767 4.5466 16.2852 4.10957 14.8309 3.86549L14.2132 3.76182 13.8987 4.30344C13.8112 4.4542 13.7215 4.6244 13.6364 4.79662 12.5441 4.68445 11.456 4.68421 10.3726 4.79627 10.2882 4.62711 10.2025 4.46356 10.1253 4.32272ZM6.71436 16.61C6.91235 16.724 7.11973 16.8356 7.32557 16.9378L6.8764 18.0338C5.75585 17.6256 4.61837 17.0635 3.4476 16.2555 3.22313 13.1175 3.86092 9.95075 6.01196 6.68602 6.90962 6.29099 7.8535 5.98255 8.83606 5.77271 8.89631 5.89807 8.95235 6.02042 8.99839 6.12892L9.27128 6.77213 9.96259 6.67074C11.3152 6.47235 12.6772 6.47209 14.0523 6.671L14.7424 6.77082 15.0147 6.12892C15.0621 6.01719 15.1167 5.89523 15.1743 5.77298 16.1525 5.98301 17.098 6.29188 18.0029 6.68787 19.8781 9.50833 20.8241 12.6541 20.5486 16.255 19.3837 17.0623 18.2422 17.6246 17.1193 18.0333L16.6735 16.9387C16.8799 16.8362 17.0879 16.7243 17.2865 16.61 17.7763 16.3277 18.3039 15.9757 18.6402 15.6395L17.3606 14.36C17.1969 14.5237 16.837 14.7805 16.3831 15.0421 15.9388 15.2981 15.498 15.5049 15.2164 15.598 13.2126 16.2606 10.7883 16.2606 8.78443 15.598 8.50285 15.5049 8.06205 15.2981 7.61772 15.0421 7.16383 14.7805 6.80392 14.5237 6.64017 14.36L5.36065 15.6395C5.6969 15.9757 6.2245 16.3277 6.71436 16.61Z"})})}),(0,S.jsx)("a",{target:"_blank",href:"https://www.linkedin.com/company/typingmind/",className:"bg-gray-700 p-1.5 rounded text-white hover:bg-gray-500 focus-visible:outline outline-2 outline-blue-500 outline-offset-2",children:(0,S.jsx)(eq.C4w,{})}),(0,S.jsx)("a",{target:"_blank",href:"https://www.youtube.com/@TypingMind/",className:"bg-gray-700 p-1.5 rounded text-white hover:bg-gray-500 focus-visible:outline outline-2 outline-blue-500 outline-offset-2",children:(0,S.jsx)(eq.o2X,{})})]})]}),(0,S.jsx)("ul",{className:"grid grid-cols-3 gap-8",children:hv.map(function(e){return(0,S.jsxs)("li",{className:"flex flex-col mb-6 lg:mb-0 text-sm text-gray-900 text-left",children:[(0,S.jsx)("span",{className:"mb-2 font-semibold uppercase tracking-wide",children:e.name}),(0,S.jsx)("ul",{className:"space-y-1",children:e.children.map(function(e){return(0,S.jsx)("li",{className:"text-left",children:"Pricing"===e.name?(0,S.jsxs)("button",{onClick:function(){return t()},className:"cursor-pointer hover:text-gray-700 group inline-flex gap-1 items-center focus-visible:outline outline-2 outline-blue-500 outline-offset-2",href:e.href,children:[e.name,(0,S.jsx)(M.HV3,{className:"h-4 shrink-0 group-hover:opacity-100 opacity-0 transition-all text-gray-900"})]}):(0,S.jsxs)("a",{target:"_blank",className:"hover:text-gray-700 group inline-flex gap-1 items-center focus-visible:outline outline-2 outline-blue-500 outline-offset-2",href:e.href,children:[e.name,(0,S.jsx)(M.HV3,{className:"h-4 shrink-0 group-hover:opacity-100 opacity-0 transition-all text-gray-900"})]})},e.name)})})]},e.name)})})]}),(0,S.jsxs)("div",{className:"w-full mt-8 border-t py-8 text-sm flex sm:flex-row flex-col justify-between items-center",children:[(0,S.jsx)("span",{children:"\xa9 2024 Devuap LLC. All rights reserved."}),(0,S.jsxs)("div",{className:"flex mt-2 gap-x-4",children:[(0,S.jsx)("a",{target:"_blank",href:"https://www.typingmind.com/privacy",className:"text-gray-800 hover:text-black focus-visible:outline outline-2 outline-blue-500 outline-offset-2",children:"Privacy Policy"}),(0,S.jsx)("a",{target:"_blank",href:"https://www.typingmind.com/terms",className:"text-gray-800 hover:text-black focus-visible:outline outline-2 outline-blue-500 outline-offset-2",children:"Terms & Conditions"})]})]})]})})]})}var hw=n(89844),hj=n(65440),hA=n(5985),hk=n(46066);n(12637),n(42175);var hN=["rating"],hC=["children","title","description","isNew"];function hq(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,s)}return n}function hI(e){for(var t=1;t=hS.length&&(t=hS.length-c),Math.min(t,hS.length-c)})},x=function(){o(function(e){return Math.max(0,e-c)})},b=function(){n(!1),s(!0)};return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(oU(),{children:[(0,S.jsx)("link",{rel:"preconnect",href:"https://fonts.googleapis.com"}),(0,S.jsx)("link",{rel:"preconnect",href:"https://fonts.gstatic.com",crossOrigin:"anonymous"}),(0,S.jsx)("link",{href:"https://fonts.googleapis.com/css2?family=Caveat:wght@400..700&display=swap",rel:"stylesheet"})]}),(0,S.jsx)(U.u,{show:t,as:q.Fragment,children:(0,S.jsxs)(H.Vq,{as:"div",className:"relative z-[100] text-gray-950",onClose:function(){return n(!1)},children:[(0,S.jsx)(U.x,{as:q.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,S.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-60 transition-opacity"})}),(0,S.jsx)("div",{className:"fixed inset-0",children:(0,S.jsx)("div",{className:"flex items-end justify-center text-center sm:items-center sm:p-0",children:(0,S.jsx)(U.x,{as:q.Fragment,enter:"ease-out duration-700",enterFrom:"opacity-0 translate-y-40",enterTo:"opacity-100 translate-y-0",leave:"ease-in duration-300",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 translate-y-40",children:(0,S.jsxs)(cv.fC,{type:"none",className:"w-screen h-screen",children:[(0,S.jsxs)(cv.l_,{className:"w-full h-full relative z-50",children:[(0,S.jsxs)(H.EM,{className:"relative transform rounded-t-2xl sm:rounded-t-3xl h-full bg-white transition-all max-w-6xl 0 mt-16 sm:mt-8 sm:mx-6 lg:mx-16 xl:mx-auto",children:[(0,S.jsxs)("div",{className:"relative sm:mx-auto rounded-t-2xl sm:rounded-t-3xl",children:[(0,S.jsx)("div",{className:"absolute top-0 left-0 w-2/3 sm:w-1/3 -z-10 opacity-40",children:(0,S.jsx)("img",{src:"/assets/landing-page/bubbles-hero.svg"})}),(0,S.jsx)("div",{className:"absolute h-[600px] w-full top-0 -z-10 opacity-60 rounded-t-2xl sm:rounded-t-3xl bg-gradient-to-b from-[#d7eaff9b] via-[#e3effb] to-white"}),(0,S.jsxs)("div",{className:"px-6 pt-10",children:[(0,S.jsxs)("div",{className:"flex items-center justify-center gap-2 p-2 rounded-full bg-gray-200 w-fit mx-auto",children:[(0,S.jsxs)("div",{className:"flex text-sm items-center justify-end ml-auto gap-x-2 py-2 px-3 sm:px-4 shadow-md bg-white w-fit rounded-full",children:[(0,S.jsx)("img",{src:"/logo.png",alt:"TypingMind",className:"rounded-md sm:rounded-lg w-7 h-7"}),(0,S.jsxs)("span",{className:"font-medium text-black ",children:["Typing",(0,S.jsx)("span",{className:"text-blue-500",children:"Mind"})]})]}),(0,S.jsxs)("a",{href:"https://custom.typingmind.com/?ref=typingmind",target:"_blank",className:"group relative flex text-sm items-center justify-start gap-0.5 py-3 pl-3 sm:pl-4 pr-4 sm:pr-5 w-fit rounded-full hover:bg-gray-50 transition-colors focus:outline-none",children:[(0,S.jsxs)("span",{className:"font-medium text-black truncate",children:["Typing",(0,S.jsx)("span",{className:"text-blue-500",children:"Mind"}),(0,S.jsx)("span",{children:"\xa0for Teams"})]}),(0,S.jsx)(M.HV3,{className:"text-gray-600 opacity-100 sm:opacity-0 group-hover:sm:opacity-100 transition-all -mr-2"})]})]}),(0,S.jsxs)("div",{className:"max-w-lg mx-auto mt-10 sm:mt-16 flex flex-col gap-y-10 sm:gap-y-14",children:[(0,S.jsxs)("div",{className:"max-w-sm mx-auto sm:max-w-none",children:[(0,S.jsxs)("h1",{className:"inline-flex items-center justify-center flex-wrap text-4xl sm:text-5xl lg:text-6xl font-bold gap-y-1",children:[(0,S.jsx)("span",{className:"animate-bg bg-no-repeat bg-left-center bg-gradient-to-r from-lime-300 to-lime-300",children:"Amazing"}),(0,S.jsx)("span",{className:"sm:whitespace-nowrap",children:"AI Chat Experience"})]}),(0,S.jsx)("p",{className:"mt-3 text-gray-800 text-lg sm:text-xl md:whitespace-nowrap",children:"The best chat UI for AI models (ChatGPT, Gemini, Claude, and more)"})]}),(0,S.jsxs)("div",{children:[(0,S.jsxs)("div",{className:"relative flex sm:flex-row flex-col w-full mx-auto sm:w-fit items-center gap-2 justify-center",children:[(0,S.jsxs)("div",{className:"absolute hidden sm:-top-7 sm:-left-20 md:-left-24 sm:flex flex-col items-start w-56 -z-10",children:[(0,S.jsxs)("p",{style:{fontFamily:"Caveat, sans-serif"},className:"flex flex-col self-start tracking-tight leading-none text-[19px] flex-nowrap text-red-600 -rotate-[20deg] -ml-5",children:[(0,S.jsx)("span",{children:"Limited time"}),(0,S.jsx)("span",{className:"whitespace-nowrap",children:"lifetime license!"})]}),(0,S.jsx)("img",{src:"/assets/arrow.svg",className:"ml-5 w-12 -rotate-[140deg] "})]}),(0,S.jsx)("button",{onClick:function(){return b()},className:"w-full max-w-xs sm:w-fit flex items-center justify-center gap-1 px-6 py-3 rounded-full bg-gradient-to-b from-blue-500 to-blue-700 text-white font-semibold hover:via-blue-700 hover:to-blue-900 transition-all focus-visible:outline outline-2 outline-offset-2 outline-blue-500",children:"Buy license key"}),(0,S.jsx)("button",{onClick:r,className:"w-full max-w-xs sm:w-fit flex items-center justify-center gap-2 px-6 py-3 rounded-full border border-gray-400 text-black font-semibold hover:bg-gray-100 transition-all focus-visible:outline outline-2 outline-offset-2 outline-gray-700",children:"Try now for free"})]}),(0,S.jsxs)("div",{className:"mt-6 flex items-center justify-center mx-auto gap-2",children:[(0,S.jsx)("div",{className:"isolate flex -space-x-1 overflow-hidden shrink-0",children:["ShavinPeiris","Thomasfrank","karlacongson","biz84","tonydinh","yampolsky"].map(function(e,t){return(0,S.jsx)("span",{className:"h-7 w-7 shrink-0",children:(0,S.jsx)("img",{className:"relative z-30 inline-block h-7 w-7 rounded-full ring-2 ring-white",src:"/assets/testimonials/".concat(e,".png"),alt:e})},t)})}),(0,S.jsxs)("p",{className:"text-sm text-gray-600 text-left",children:["Loved by ",(0,S.jsx)("b",{children:"18,203+"})," paying customers"]})]})]})]}),(0,S.jsxs)("div",{className:"w-full mx-auto my-16 sm:my-20 flex-col items-center justify-center gap-5",children:[(0,S.jsx)("div",{className:"w-fit mx-auto hidden md:grid grid-cols-2 lg:grid-cols-4 items-center justify-center gap-y-7 gap-x-10",children:hE.map(function(e,t){return(0,S.jsxs)("div",{className:"flex items-center justify-center flex-col",children:[(0,S.jsxs)("div",{className:"w-[160px] flex justify-between items-center",children:[(0,S.jsx)("span",{className:"w-7 h-14 shrink-0",children:(0,S.jsx)("img",{src:"/assets/award-leaf.png",className:"w-7 opacity-70 shrink-0"})}),(0,S.jsxs)("div",{children:[(0,S.jsx)("p",{className:"text-xs text-gray-700 whitespace-nowrap",children:e.point1}),(0,S.jsx)("p",{className:"font-semibold text-base inline-flex items-center justify-center gap-1 text-gray-900",children:e.point2})]}),(0,S.jsx)("span",{className:"w-7 h-14 shrink-0",children:(0,S.jsx)("img",{src:"/assets/award-leaf.png",className:"w-7 scale-x-[-1] opacity-70 shrink-0"})})]}),(0,S.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2",children:[(0,S.jsx)(hD,{rating:e.stars,className:"text-yellow-400"}),(0,S.jsx)("span",{className:"w-8 sm:w-9 h-8 sm:h-9 shrink-0",children:(0,S.jsx)("img",{className:"rounded-lg w-8 sm:w-9 h-8 sm:h-9 shrink-0",src:e.logo})})]})]},t)})}),(0,S.jsx)("div",{className:"mx-auto md:hidden grid grid-cols-2 items-center justify-center w-fit gap-5 sm:gap-10",children:hE.map(function(e,t){return(0,S.jsxs)("div",{className:"flex items-center text-left gap-1 sm:gap-2",children:[(0,S.jsx)("span",{className:"w-8 h-8 sm:h-10 sm:w-10 shrink-0",children:(0,S.jsx)("img",{className:"rounded-lg w-8 h-8 sm:h-10 sm:w-10 shrink-0",src:e.logo})}),(0,S.jsxs)("div",{className:"flex flex-col gap-0.5 sm:gap-1 space-y-1",children:[(0,S.jsx)(hD,{rating:e.stars,className:"text-yellow-400"}),(0,S.jsxs)("p",{className:"flex items-center justify-center divide-x text-center border rounded-full w-fit overflow-hidden text-sm sm:text-base whitespace-nowrap font-medium text-gray-800",children:[(0,S.jsx)("span",{className:"px-2 py-0.5 flex items-center justify-center",children:"Setapp"===e.name?e.point2:e.stars.toFixed(1)}),(0,S.jsx)("span",{className:"flex items-center justify-center bg-gray-200 px-2 py-0.5",children:"Setapp"===e.name?"100%":"5.0"})]})]})]},t)})})]}),(0,S.jsx)("div",{className:"mx-auto w-fit max-w-2xl py-10",children:(0,S.jsxs)("div",{className:"relative p-8 bg-gradient-to-br from-gray-100 to-gray-200 rounded-3xl w-full",children:[(0,S.jsx)(nx.EUr,{className:"animate-shake h-7 w-7 absolute -rotate-12 -left-2 -top-2 fill-pink-500"}),(0,S.jsx)("span",{className:"animate-shake absolute -right-3 top-1/3 p-1.5 text-white bg-blue-500 flex items-center justify-center w-fit rounded-full",children:(0,S.jsx)(C.spm,{className:"h-4 w-4 shrink-0 rotate-6"})}),(0,S.jsx)("h2",{className:"text-base sm:text-2xl text-gray-900",children:(0,S.jsxs)("span",{className:"relative block",children:[(0,S.jsx)("span",{className:"text-3xl text-black absolute -translate-x-7 -translate-y-2 ",children:"❝"})," ","This is the best ChatGPT client and I tested so many! So much better than the OpenAI user interface.",(0,S.jsx)("span",{className:"text-3xl text-gray-700 absolute xl:-bottom-2 -bottom-4 mt-20 ml-1",children:"❞"})]})}),(0,S.jsxs)("div",{className:"mt-5 flex flex-col items-center justify-center mx-auto gap-2",children:[(0,S.jsx)("span",{className:"w-12 h-12",children:(0,S.jsx)("img",{src:"/assets/testimonials/mirelspace.png",className:"w-12 rounded-full",alt:"Mirel Vasile"})}),(0,S.jsxs)("span",{className:"flex flex-col",children:[(0,S.jsx)("span",{className:"font-medium",children:"Mirel Vasile"}),(0,S.jsx)("span",{className:"text-gray-600 text-sm",children:"Co-founder @Nextasee and @Anticipa"})]})]})]})}),(0,S.jsx)("div",{className:"space-y-36",children:(0,S.jsxs)("div",{className:"space-y-12",children:[(0,S.jsxs)("div",{className:"space-y-3",children:[(0,S.jsxs)("h3",{className:"text-3xl sm:text-4xl font-semibold text-center",children:["Use"," ",(0,S.jsxs)("span",{className:"text-purple-500 inline-flex items-baseline justify-center gap-2",children:[(0,S.jsx)("img",{src:"/assets/models/gpt-4.webp",className:"inline-block sm:w-8 sm:h-8 w-5 h-5"})," ","GPT-4"]}),","," ",(0,S.jsxs)("span",{className:"text-blue-500 inline-flex items-baseline justify-center gap-2",children:[(0,S.jsx)("img",{src:"/assets/models/gemini.png",className:"inline-block sm:w-8 sm:h-8 w-5 h-5"})," ","Gemini"]}),", and"," ",(0,S.jsxs)("span",{className:"text-orange-500 inline-flex items-baseline justify-center gap-2",children:[(0,S.jsx)("img",{src:"/assets/models/claude.webp",className:"inline-block sm:w-8 sm:h-8 w-5 h-5"})," ","Claude"]})," ","all in one amazing"," ",(0,S.jsx)("span",{className:"inline-block",children:"chat interface"})," ","using your API Key!"]}),(0,S.jsx)("p",{className:"text-lg text-gray-600 text-center",children:"Pay only for what you use. Fully featured chat features UI/UX for AI enthusiasts. Support open-source LLM models."})]}),(0,S.jsxs)("div",{className:"w-full relative mx-auto",children:[(0,S.jsxs)("div",{className:"flex items-center justify-center relative w-fit mx-auto py-5",children:[(0,S.jsx)("span",{className:"w-16 absolute -left-12 -z-10 rounded-xl overflow-hidden opacity-60",children:(0,S.jsx)("img",{src:"/assets/models/claude.webp",className:"w-16"})}),(0,S.jsx)("span",{className:"w-24 z-0 rounded-xl overflow-hidden",children:(0,S.jsx)("img",{src:"/assets/models/gpt-4.webp",className:"w-24"})}),(0,S.jsx)("span",{className:"w-16 absolute -right-12 -z-10 rounded-xl overflow-hidden opacity-60",children:(0,S.jsx)("img",{src:"/assets/models/gemini.png",className:"w-16"})})]}),(0,S.jsx)("span",{className:"w-7 absolute left-[10%] sm:left-[20%] md:left-[30%] -top-2 rounded-full overflow-hidden",children:(0,S.jsx)("img",{src:"/assets/models/vicuna.png",className:"w-7"})}),(0,S.jsx)("span",{className:"w-5 absolute left-0 sm:left-[10%] md:left-[20%] top-1/2 rounded-full overflow-hidden",children:(0,S.jsx)("img",{src:"/assets/models/perplexityai.png",className:"w-5"})}),(0,S.jsx)("span",{className:"w-4 absolute left-[13%] sm:left-[23%] md:left-[33%] bottom-0 rounded-full overflow-hidden",children:(0,S.jsx)("img",{src:"/assets/models/llama.png",className:"w-4"})}),(0,S.jsx)("span",{className:"w-5 absolute right-[10%] sm:right-[25%] md:right-[35%] -top-2 rounded-full overflow-hidden",children:(0,S.jsx)("img",{src:"/assets/models/alpaca.png",className:"w-5"})}),(0,S.jsx)("span",{className:"w-6 absolute right-0 sm:right-[10%] md:right-[20%] top-1/2 rounded-full overflow-hidden",children:(0,S.jsx)("img",{src:"/assets/models/gpt4all.png",className:"w-6"})}),(0,S.jsx)("span",{className:"w-4 absolute right-[10%] sm:right-[20%] md:right-[30%] bottom-0 rounded-full overflow-hidden",children:(0,S.jsx)("img",{src:"/assets/models/openrouterai.png",className:"w-4"})}),(0,S.jsx)("span",{className:"w-8 absolute -right-5 sm:right-[18%] md:right-[28%] top-1/4 rounded-full overflow-hidden",children:(0,S.jsx)("img",{src:"/assets/models/mistralai.png",className:"w-8"})})]}),(0,S.jsxs)("div",{className:"z-10 relative flex sm:flex-row flex-col items-center justify-center gap-2",children:[(0,S.jsx)("button",{onClick:function(){return b()},className:"w-full max-w-xs sm:w-fit flex items-center justify-center gap-1 px-6 py-3 rounded-full bg-gradient-to-b from-blue-500 to-blue-700 text-white font-semibold hover:via-blue-700 hover:to-blue-900 transition-all focus-visible:outline outline-2 outline-offset-2 outline-blue-500",children:"Buy license key"}),(0,S.jsx)("button",{onClick:r,className:"w-full bg-white max-w-xs sm:w-fit flex items-center justify-center gap-2 px-6 py-3 rounded-full border border-gray-400 text-black font-semibold hover:bg-gray-100 transition-all focus-visible:outline outline-2 outline-offset-2 outline-gray-700",children:"Try now for free"})]})]})})]})]}),(0,S.jsx)("div",{className:"my-16 w-screen sm:w-full",children:(0,S.jsxs)(cv.fC,{type:"always",className:"w-full h-full flex items-center justify-center",children:[(0,S.jsx)(cv.l_,{className:"w-full h-full rounded pt-6 pb-10 sm:pb-6",children:(0,S.jsxs)("div",{className:"w-[1760px] sm:w-full grid grid-cols-6 gap-5 sm:grid-cols-2 xl:grid-cols-3 px-6",children:[(0,S.jsx)(hL,{}),(0,S.jsx)(hR,{}),(0,S.jsx)(h_,{}),(0,S.jsx)(hZ,{}),(0,S.jsx)(hK,{}),(0,S.jsx)(hG,{})]})}),(0,S.jsx)(cv.LW,{className:"mx-6 flex sm:hidden select-none touch-none p-0.5 rounded-full bg-gray-100 transition-colors duration-150 ease-out hover:bg-gray-200 data-[orientation=vertical]:w-2.5 data-[orientation=horizontal]:flex-col data-[orientation=horizontal]:h-2.5 dark:bg-transparent",orientation:"horizontal",children:(0,S.jsx)(cv.bU,{className:"flex-1 bg-gray-400 rounded-full relative dark:bg-zinc-700"})})]})}),(0,S.jsxs)("div",{className:"w-full mx-auto px-6 my-24 md:my-32 flex-col items-center justify-center max-w-5xl",children:[(0,S.jsx)("p",{className:"text-gray-500",children:"Trusted by members of many leading companies, universities and colleges"}),(0,S.jsx)("div",{className:"mt-7 flex flex-wrap gap-6 sm:gap-8 items-center justify-center mx-auto",children:hV.map(function(e){return(0,S.jsx)("div",{className:(0,O.AK)(null==e?void 0:e.style,"w-28 sm:w-32"),children:(0,S.jsx)("img",{alt:e.name,src:e.logo,className:(0,O.AK)(null==e?void 0:e.style,"w-28 sm:w-32 grayscale opacity-80")})},e.name)})})]}),(0,S.jsxs)("div",{children:[(0,S.jsxs)("div",{className:"max-w-2xl mx-auto space-y-5 px-6",children:[(0,S.jsxs)("h3",{className:"text-4xl font-semibold text-center",children:["Bring more value to"," ",(0,S.jsx)("span",{className:"text-transparent bg-clip-text bg-gradient-to-r from-blue-600 to-purple-500",children:"every token"})]}),(0,S.jsx)("p",{className:"mt-3 text-gray-800 text-lg sm:text-xl md:whitespace-nowrap text-center",children:"Advanced features to give you more control and power"}),(0,S.jsxs)("div",{className:"relative flex w-full mx-auto sm:w-fit items-center gap-1 sm:gap-2 justify-center",children:[(0,S.jsx)("button",{onClick:function(){return b()},className:"w-full max-w-xs sm:w-fit flex items-center justify-center px-3 text-sm sm:text-base sm:px-6 py-3 rounded-full bg-gradient-to-b from-blue-500 to-blue-700 text-white font-semibold hover:via-blue-700 hover:to-blue-900 transition-all focus-visible:outline outline-2 outline-offset-2 outline-blue-500",children:"Buy license key"}),(0,S.jsx)("button",{onClick:r,className:"w-full max-w-xs sm:w-fit flex items-center justify-center px-3 text-sm sm:text-base sm:px-6 py-3 rounded-full border border-gray-400 text-black font-semibold hover:bg-gray-100 transition-all focus-visible:outline outline-2 outline-offset-2 outline-gray-700",children:"Try now for free"})]})]}),(0,S.jsx)("div",{className:"w-screen sm:w-full overflow-hidden mt-10",children:(0,S.jsxs)(cv.fC,{type:"always",className:"w-full h-full flex items-center justify-center",children:[(0,S.jsx)(cv.l_,{className:"w-full h-full rounded pt-6 pb-10",children:(0,S.jsxs)("div",{className:"w-[2250px] sm:w-full grid-cols-8 grid sm:grid-cols-2 lg:grid-cols-4 gap-5 text-left px-6",children:[(0,S.jsx)(hF,{title:"Control parameters",description:"Adjust chat settings like temperature, streaming, etc.",children:(0,S.jsxs)("div",{className:"flex flex-col justify-center gap-2 w-full",children:[(0,S.jsx)("div",{className:"h-2 bg-gray-400 w-full rounded-full",children:(0,S.jsx)("div",{className:"flex items-center justify-end w-1/2 h-full rounded-full bg-gradient-to-tr from-purple-500 to-blue-600",children:(0,S.jsx)("span",{className:"h-4 w-4 rounded-full bg-white ring-1 ring-inset block"})})}),(0,S.jsxs)("div",{className:"text-xs w-full items-center justify-between grid grid-cols-3",children:[(0,S.jsx)("p",{children:"Precise"}),(0,S.jsx)("p",{className:"text-center",children:"Neutral"}),(0,S.jsx)("p",{className:"text-right",children:"Creative"})]})]})}),(0,S.jsx)(hF,{title:"Use unlimited plugins",description:"Explore available plugins or build your own plugins.",children:(0,S.jsx)("div",{className:"flex flex-col gap-2",children:["HTML render","Image search"].map(function(e){return(0,S.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,S.jsx)("p",{className:"text-xs",children:e}),(0,S.jsx)(eW.rs,{checked:!0,className:"bg-gradient-to-r from-purple-500 to-blue-600 relative inline-flex h-5 w-10 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200",children:(0,S.jsx)("span",{className:"translate-x-5 pointer-events-none relative inline-block h-4 w-4 transform rounded-full bg-white shadow ring-0 transition duration-200",children:(0,S.jsx)("span",{className:"opacity-100 duration-200 ease-in absolute inset-0 flex h-full w-full items-center justify-center transition-opacity","aria-hidden":"true",children:(0,S.jsx)("svg",{className:"h-3 w-3 text-blue-600",fill:"currentColor",viewBox:"0 0 12 12",children:(0,S.jsx)("path",{d:"M3.707 5.293a1 1 0 00-1.414 1.414l1.414-1.414zM5 8l-.707.707a1 1 0 001.414 0L5 8zm4.707-3.293a1 1 0 00-1.414-1.414l1.414 1.414zm-7.414 2l2 2 1.414-1.414-2-2-1.414 1.414zm3.414 2l4-4-1.414-1.414-4 4 1.414 1.414z"})})})})})]},e)})})}),(0,S.jsx)(hF,{title:"Upload documents",description:"Load any file and begin questioning on its content.",children:(0,S.jsx)("span",{className:"w-full mx-auto flex items-center justify-center",children:(0,S.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"w-8 h-8",children:[(0,S.jsx)("defs",{children:(0,S.jsxs)("linearGradient",{id:"gradientFill",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[(0,S.jsx)("stop",{offset:"0%",style:{stopColor:"#a855f7"}}),(0,S.jsx)("stop",{offset:"100%",style:{stopColor:"#3B82F6"}})]})}),(0,S.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5m-13.5-9L12 3m0 0 4.5 4.5M12 3v13.5",fill:"none",stroke:"url(#gradientFill)"})]})})}),(0,S.jsx)(hF,{title:"Control context limit",description:"Stay in context by making AI remember only recent messages.",children:(0,S.jsxs)("p",{className:"text-sm gap-2 flex items-center justify-center px-3 py-0.5",children:[(0,S.jsx)("span",{className:"p-0.5 bg-gradient-to-l from-purple-500 to-blue-500 text-white rounded-full",children:(0,S.jsx)(e2.jI1,{className:"h-4 w-4 shrink-0"})}),"Last 2 messages"]})}),(0,S.jsx)(hF,{isNew:!0,title:"Dynamic context via API",description:"Get live info for the AI via API or RAG from your own data.",children:(0,S.jsx)("span",{className:"flex items-center justify-center",children:(0,S.jsxs)("svg",{viewBox:"0 0 24 24",height:"50px",width:"50px",xmlns:"http://www.w3.org/2000/svg",children:[(0,S.jsx)("defs",{children:(0,S.jsxs)("linearGradient",{id:"fillGradient",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[(0,S.jsx)("stop",{offset:"0%",stopColor:"#8B5CF6"}),(0,S.jsx)("stop",{offset:"100%",stopColor:"#3B82F6"})]})}),(0,S.jsx)("path",{fill:"none",d:"M0 0h24v24H0z"}),(0,S.jsx)("path",{fill:"url(#fillGradient)",d:"M13 11H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2h9v7zM4 9h7V6H4v3zm11 11H4c-1.1 0-2-.9-2-2v-3c0-1.1.9-2 2-2h11v7zM4 18h9v-3H4v3zm18-9h-2l2-5h-7v7h2v9l5-11zM4.75 17.25h1.5v-1.5h-1.5v1.5zm0-9h1.5v-1.5h-1.5v1.5z"})]})})}),(0,S.jsx)(hF,{title:"Chats sync and backup",description:"Sync and backup your chat data across multiple devices.",children:(0,S.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2",children:[(0,S.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"w-7 h-7",children:[(0,S.jsx)("defs",{children:(0,S.jsxs)("linearGradient",{id:"iconGradient5",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[(0,S.jsx)("stop",{offset:"0%",style:{stopColor:"#8B5CF6"}})," ",(0,S.jsx)("stop",{offset:"100%",style:{stopColor:"#3B82F6"}})," "]})}),(0,S.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 16.5V9.75m0 0 3 3m-3-3-3 3M6.75 19.5a4.5 4.5 0 0 1-1.41-8.775 5.25 5.25 0 0 1 10.233-2.33 3 3 0 0 1 3.758 3.848A3.752 3.752 0 0 1 18 19.5H6.75Z",fill:"none",stroke:"url(#iconGradient5)"})]}),(0,S.jsx)("p",{className:"text-sm",children:"TypingMind Cloud"})]})}),(0,S.jsx)(hF,{title:"Hotkey & Shortcuts",description:"⌘K to search chats... Change hotkeys to your preference.",children:(0,S.jsx)("div",{className:"flex flex-col items-center justify-center gap-4 px-4 py-6",children:(0,S.jsxs)("p",{className:"overflow-hidden text-xs flex items-center w-full px-2 py-1 gap-2 rounded-md border border-gray-300",children:[(0,S.jsx)("span",{className:"bg-gradient-to-bl from-purple-500 to-blue-500 text-white px-2 py-1 rounded",children:"⌘K"}),(0,S.jsx)("span",{children:'Press "/" to focus input'})]})})}),(0,S.jsx)(hF,{title:"Beautiful Light/Dark Mode",description:"Never burn your eyes in the dark again!",children:(0,S.jsxs)("div",{className:"flex items-center justify-center gap-3 px-4 py-6",children:[(0,S.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"w-9 h-9",children:[(0,S.jsx)("defs",{children:(0,S.jsxs)("linearGradient",{id:"iconGradient3",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[(0,S.jsx)("stop",{offset:"0%",style:{stopColor:"#8B5CF6"}}),(0,S.jsx)("stop",{offset:"100%",style:{stopColor:"#3B82F6"}})]})}),(0,S.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3v2.25m6.364.386-1.591 1.591M21 12h-2.25m-.386 6.364-1.591-1.591M12 18.75V21m-4.773-4.227-1.591 1.591M5.25 12H3m4.227-4.773L5.636 5.636M15.75 12a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0Z",fill:"none",stroke:"url(#iconGradient3)"})]}),(0,S.jsx)(C.qau,{}),(0,S.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"w-8 h-8",children:[(0,S.jsx)("defs",{children:(0,S.jsxs)("linearGradient",{id:"iconGradient4",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[(0,S.jsx)("stop",{offset:"0%",style:{stopColor:"#8B5CF6"}})," ",(0,S.jsx)("stop",{offset:"100%",style:{stopColor:"#3B82F6"}})," "]})}),(0,S.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21.752 15.002A9.72 9.72 0 0 1 18 15.75c-5.385 0-9.75-4.365-9.75-9.75 0-1.33.266-2.597.748-3.752A9.753 9.753 0 0 0 3 11.25C3 16.635 7.365 21 12.75 21a9.753 9.753 0 0 0 9.002-5.998Z",fill:"none",stroke:"url(#iconGradient4)"})]})]})})]})}),(0,S.jsx)(cv.LW,{className:"mx-6 flex sm:hidden select-none touch-none p-0.5 rounded-full bg-gray-100 transition-colors duration-150 ease-out hover:bg-gray-200 data-[orientation=vertical]:w-2.5 data-[orientation=horizontal]:flex-col data-[orientation=horizontal]:h-2.5 dark:bg-transparent",orientation:"horizontal",children:(0,S.jsx)(cv.bU,{className:"flex-1 bg-gray-400 rounded-full relative dark:bg-zinc-700"})})]})}),(0,S.jsxs)("a",{target:"_blank",href:"https://docs.typingmind.com/feature-list",className:"mt-3 sm:-mt-5 max-w-xs w-fit mx-auto flex items-center justify-center gap-1 px-4 py-2 text-sm font-medium text-gray-600 hover:text-gray-900 transition-all focus-visible:outline outline-2 outline-offset-2 outline-blue-500",children:["Explore all features ",(0,S.jsx)(e4.Hi9,{})]})]}),(0,S.jsxs)("div",{ref:u,className:"py-16 sm:py-20 relative overflow-hidden",children:[(0,S.jsx)("div",{className:"w-full scale-[1.4] sm:scale-100 h-2/5 sm:h-full absolute -z-10 top-1/2 sm:top-[15%] opacity-40",children:(0,S.jsx)("img",{src:"/assets/landing-page/bubbles-2.svg",className:"opacity-40"})}),(0,S.jsxs)("div",{className:"mx-6",children:[(0,S.jsxs)("div",{className:"space-y-3 z-10 text-center",children:[(0,S.jsxs)("h2",{className:"inline-flex items-center justify-center flex-wrap text-4xl sm:text-5xl font-medium",children:[(0,S.jsx)("span",{className:"flex items-center flex-nowrap",children:"Hear from\xa0"}),(0,S.jsx)("span",{className:"text-transparent bg-clip-text bg-gradient-to-r from-blue-600 to-violet-500",children:"our customers"})]}),(0,S.jsx)("p",{className:"text-lg text-gray-600 text-center",children:"TypingMind is used daily by hundreds of thousands of productive users. See for yourself..."})]}),(0,S.jsxs)("div",{className:"z-10 flex items-center gap-3 justify-center mt-10 sm:mt-14 mb-8",children:[(0,S.jsx)("button",{disabled:0===i,onClick:function(){return x()},className:"bg-gray-200 p-2 rounded-full disabled:opacity-50 flex items-center justify-center border",children:(0,S.jsx)(nx.And,{className:"h-5 w-5 shrink-0"})}),(0,S.jsx)("button",{disabled:i===hS.length-c,onClick:function(){return f()},className:"bg-gray-200 p-2 rounded-full disabled:opacity-50 flex items-center justify-center border",children:(0,S.jsx)(nx.lzl,{className:"h-5 w-5 shrink-0"})})]})]}),(0,S.jsx)("div",{className:"relative mx-auto flow-root max-w-2xl lg:mx-0 lg:max-w-none px-6 sm:px-8",children:(0,S.jsx)("div",{className:"-mt-8 sm:-mx-4 sm:columns-2 sm:text-[0] lg:columns-3 h-[400px] sm:h-auto",children:hS.slice(i,i+c).map(function(e){var t;return(0,S.jsxs)("div",{className:"pt-4 sm:inline-block sm:w-full sm:px-2 relative",children:[(0,S.jsxs)("figure",{className:"fade-in shadow rounded-3xl bg-white p-7 text-sm leading-6 text-left border border-gray-200",children:[(0,S.jsxs)("figcaption",{className:"mb-5 flex items-center gap-x-4",children:[null!==(t=e.author)&&void 0!==t&&t.color?(0,S.jsx)("span",{style:{background:e.author.color},className:"h-12 w-12 rounded-full text-white font-semibold flex items-center justify-center",children:e.author.name.slice(0,2)}):(0,S.jsx)("span",{className:"h-12 w-12 rounded-full block shrink-0",children:(0,S.jsx)("img",{className:"h-12 w-12 rounded-full bg-gray-50",src:"/assets/testimonials/".concat(e.author.handle,".png"),alt:e.author.name})}),(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"font-semibold text-gray-900",children:e.author.name}),(0,S.jsx)("div",{className:"text-gray-600",children:"@".concat(e.author.handle)})]})]}),(0,S.jsx)("blockquote",{className:"text-gray-800 flex flex-col gap-1.5",children:e.body})]}),(0,S.jsx)("a",{className:"fade-in",target:"_blank",href:null==e?void 0:e.sourceLink,children:(0,S.jsx)("span",{className:(0,O.AK)(["setapp","capterra","trustpilot","twitter"].includes(e.source)?"bg-blue-950 rounded-full overflow-hidden":"","flex items-center justify-center h-7 w-7 absolute right-0 sm:right-1 top-3 fade-in"),children:(0,S.jsx)("img",{src:"producthunt"===e.source?"/assets/landing-page/product-hunt-small-logo.png":"setapp"===e.source?"/assets/landing-page/setapp-small-logo.svg":"capterra"===e.source?"/assets/landing-page/capterra-small-logo.png":"trustpilot"===e.source?"/assets/landing-page/trustpilot-logo.svg":"g2"===e.source?"/assets/landing-page/g2-logo.svg":"twitter"===e.source?"/assets/landing-page/twitter-logo.webp":"",className:(0,O.AK)(["setapp","capterra","trustpilot","twitter"].includes(e.source)?"h-5 w-5":"h-7 w-7"),alt:e.source})})})]},e.author.handle)})})})]}),(0,S.jsxs)("div",{className:"px-6 py-10 space-y-36",children:[(0,S.jsxs)("div",{className:"space-y-12",children:[(0,S.jsxs)("div",{className:"space-y-3",children:[(0,S.jsx)("h3",{className:"text-3xl sm:text-4xl font-semibold text-center",children:"Build smart AI agents"}),(0,S.jsx)("p",{className:"text-lg text-gray-600 text-center",children:"Train your own AI agents that can fetch live data, speak, and do much more."})]}),(0,S.jsxs)("div",{className:"w-full relative mx-auto",children:[(0,S.jsxs)("div",{className:"flex items-center justify-center relative w-fit mx-auto py-5",children:[(0,S.jsx)("span",{className:"w-16 absolute -left-12 -z-10 rounded-xl overflow-hidden opacity-60",children:(0,S.jsx)("img",{src:"/assets/landing-page/goddesszenea.png",className:"w-16"})}),(0,S.jsx)("span",{className:"w-24 z-0 rounded-xl overflow-hidden",children:(0,S.jsx)("img",{src:"/assets/landing-page/pro-coder.png",className:"w-24"})}),(0,S.jsx)("span",{className:"w-16 absolute -right-12 -z-10 rounded-xl overflow-hidden opacity-60",children:(0,S.jsx)("img",{src:"/assets/landing-page/zoro.png",className:"w-16"})})]}),(0,S.jsx)("span",{className:"w-7 absolute left-[10%] sm:left-[20%] md:left-[30%] -top-2 rounded-full overflow-hidden",children:(0,S.jsx)("img",{src:"/assets/landing-page/gamer-boy.png",className:"w-7"})}),(0,S.jsx)("span",{className:"w-5 absolute left-0 sm:left-[10%] md:left-[20%] top-1/2 rounded-full overflow-hidden",children:(0,S.jsx)("img",{src:"/assets/landing-page/one-punch-man.png",className:"w-5"})}),(0,S.jsx)("span",{className:"w-4 absolute left-[13%] sm:left-[23%] md:left-[33%] bottom-0 rounded-full overflow-hidden",children:(0,S.jsx)("img",{src:"/assets/landing-page/programmer.png",className:"w-4"})}),(0,S.jsx)(nx.rD$,{className:"absolute left-[6%] sm:left-[16%] md:left-[26%] top-1/4 h-5 w-5"}),(0,S.jsx)("span",{className:"w-5 absolute right-[10%] sm:right-[25%] md:right-[35%] -top-2 rounded-full overflow-hidden",children:(0,S.jsx)("img",{src:"/assets/landing-page/real-estate-agent.png",className:"w-5"})}),(0,S.jsx)("span",{className:"w-6 absolute right-0 sm:right-[10%] md:right-[20%] top-1/2 rounded-full overflow-hidden",children:(0,S.jsx)("img",{src:"/assets/landing-page/film-editor.png",className:"w-6"})}),(0,S.jsx)("span",{className:"w-4 absolute right-[10%] sm:right-[20%] md:right-[30%] bottom-0 rounded-full overflow-hidden",children:(0,S.jsx)("img",{src:"/assets/landing-page/peter-griffin.png",className:"w-4"})}),(0,S.jsx)("span",{className:"w-8 absolute -right-5 sm:right-[18%] md:right-[28%] top-1/4 rounded-full overflow-hidden",children:(0,S.jsx)("img",{src:"/assets/landing-page/shinto-priestess.png",className:"w-8"})})]}),(0,S.jsxs)("div",{className:"relative grid md:grid-cols-2 gap-16 md:gap-5 w-full pt-10",children:[(0,S.jsx)("div",{className:"grid grid-cols-1 gap-5 h-fit pl-0 lg:pl-10 mx-auto",children:[{title:"Personalized AI agents",description:"Train the AI on your own instructions, prompts, and training examples."},{title:"Fetch live data",description:"Let AI fetch content from APIs or implement RAG to get information from your own data sources."},{title:"Speak with its own voice",description:"Assign a voice to each AI agent with multi-language support."},{title:"Use multiple plugins",description:"Enable any plugins for the AI such as Web Search, DALL-E 3, and more."},{title:"Mention other AI agents in the chat",description:"Call other AI agents for help in the same conversation."}].map(function(e,t){return(0,S.jsxs)("div",{className:"flex flex-col gap-1 text-left",children:[(0,S.jsxs)("div",{className:"flex items-center gap-2",children:[(0,S.jsx)(nx.nRB,{className:"text-blue-600 h-4 w-4 shrink-0"}),(0,S.jsx)("p",{className:"text-base text-gray-900 font-semibold",children:e.title})]}),(0,S.jsx)("p",{className:"ml-6 text-gray-600 text-base",children:e.description})]},t)})}),(0,S.jsx)("div",{className:"flex items-center justify-center relative w-full mx-auto",children:(0,S.jsx)("div",{className:"w-[320px] sm:w-[420px] aspect-[1460/1452] overflow-hidden relative",children:(0,S.jsx)("video",{src:"/assets/landing-page/smart-ai-agents.mp4",autoPlay:!0,muted:!0,loop:!0,playsInline:!0,preload:"metadata",controls:!0,className:"w-full aspect-[1460/1452]"})})})]}),(0,S.jsxs)("div",{className:"z-10 relative flex sm:flex-row flex-col items-center justify-center gap-2",children:[(0,S.jsx)("button",{onClick:function(){return b()},className:"w-full max-w-xs sm:w-fit flex items-center justify-center gap-1 px-6 py-3 rounded-full bg-gradient-to-b from-blue-500 to-blue-700 text-white font-semibold hover:via-blue-700 hover:to-blue-900 transition-all focus-visible:outline outline-2 outline-offset-2 outline-blue-500",children:"Buy license key"}),(0,S.jsx)("button",{onClick:r,className:"w-full bg-white max-w-xs sm:w-fit flex items-center justify-center gap-2 px-6 py-3 rounded-full border border-gray-400 text-black font-semibold hover:bg-gray-100 transition-all focus-visible:outline outline-2 outline-offset-2 outline-gray-700",children:"Try now for free"})]}),(0,S.jsxs)("div",{className:"pt-4 sm:pt-10",children:[(0,S.jsxs)("h4",{className:"max-w-2xl mx-auto text-2xl sm:text-3xl font-medium text-gray-900",children:["A complete collection of"," ",(0,S.jsxs)("span",{className:"inline-block",children:["AI agents designed to"," "]}),(0,S.jsx)("span",{className:"inline-block",children:"solve real-life problems"})]}),(0,S.jsxs)("div",{className:"container py-8 space-y-8 mx-auto w-full",children:[(0,S.jsxs)("div",{className:"w-full relative overflow-hidden max-w-sm mx-auto sm:max-w-2xl lg:max-w-3xl",children:[(0,S.jsx)("div",{style:{background:"radial-gradient(circle at 0%, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0.8) 50%, rgba(255, 255, 255, 0.5) 75%, rgba(255, 255, 255, 0.4) 75%, rgba(255, 255, 255, 0.2) 95%, rgba(255, 255, 255, 0.05) 100%)"},className:"absolute inset-y-0 -left-10 w-20 sm:w-36 z-10"}),(0,S.jsx)("div",{style:{background:"radial-gradient(circle at 100%, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0.8) 50%, rgba(255, 255, 255, 0.5) 75%, rgba(255, 255, 255, 0.4) 75%, rgba(255, 255, 255, 0.2) 95%, rgba(255, 255, 255, 0.05) 100%)"},className:"absolute inset-y-0 -right-10 w-20 sm:w-36 z-10"}),(0,S.jsx)("div",{className:"flex items-center justify-between mx-auto w-[330px] sm:w-[850px]",children:(0,S.jsx)("div",{className:"overflow-hidden w-[500px] sm:w-[1000px] mx-auto",children:(0,S.jsx)(hk.Z,hI(hI({},{centerMode:!0,centerPadding:"0",slidesToShow:5,infinite:!0,focusOnSelect:!0,beforeChange:function(e,t){return h(t)},responsive:[{breakpoint:700,settings:{slidesToShow:3}},{breakpoint:550,settings:{slidesToShow:2}}]}),{},{ref:g,children:hT.map(function(e,t){return(0,S.jsx)("div",{className:(0,O.AK)(p===t?"text-blue-600 font-medium":"text-gray-500 hover:text-blue-600","transition-all whitespace-nowrap cursor-pointer capitalize text-center"),children:e.name},t)})}))})})]}),(0,S.jsxs)("div",{className:"space-y-3 relative max-w-2xl mx-auto",children:[(0,S.jsx)("div",{className:"absolute inset-y-0 -left-3 sm:left-0 flex items-center justify-center",children:(0,S.jsx)("button",{onClick:function(){return g.current.slickPrev()},className:"z-10 bg-gray-100/70 rounded-full p-1 h-fit w-fit aspect-square shrink-0 block text-gray-400 hover:text-gray-700",children:(0,S.jsx)(e2.gYP,{className:"h-4 w-4"})})}),(0,S.jsx)("div",{className:"absolute inset-y-0 -right-3 sm:right-0 flex items-center justify-center",children:(0,S.jsx)("button",{onClick:function(){return g.current.slickNext()},className:"z-10 bg-gray-100/70 rounded-full p-1 h-fit w-fit aspect-square shrink-0 block text-gray-400 hover:text-gray-700",children:(0,S.jsx)(e2.gYP,{className:"h-4 w-4 -rotate-180"})})}),(0,S.jsx)("div",{className:"relative h-[250px] sm:h-[420px] aspect-[600/432] mx-auto",children:hT.map(function(e,t){return(0,S.jsx)("img",{src:e.demoImage,alt:e.imageDescription,className:(0,O.AK)(p===t?"opacity-100":"opacity-0","h-[250px] sm:h-[420px] aspect-[600/432] absolute inset-0 transition-opacity")},t)})}),(0,S.jsx)("p",{className:"text-center text-sm text-gray-500",children:hT[p].imageDescription})]})]}),(0,S.jsxs)("div",{className:"z-10 relative flex sm:flex-row flex-col items-center justify-center gap-2",children:[(0,S.jsx)("button",{onClick:function(){return b()},className:"w-full max-w-xs sm:w-fit flex items-center justify-center gap-1 px-6 py-3 rounded-full bg-gradient-to-b from-blue-500 to-blue-700 text-white font-semibold hover:via-blue-700 hover:to-blue-900 transition-all focus-visible:outline outline-2 outline-offset-2 outline-blue-500",children:"Buy license key"}),(0,S.jsx)("button",{onClick:r,className:"w-full bg-white max-w-xs sm:w-fit flex items-center justify-center gap-2 px-6 py-3 rounded-full border border-gray-400 text-black font-semibold hover:bg-gray-100 transition-all focus-visible:outline outline-2 outline-offset-2 outline-gray-700",children:"Try now for free"})]})]})]}),(0,S.jsxs)("div",{className:"space-y-12",children:[(0,S.jsxs)("div",{className:"space-y-3",children:[(0,S.jsx)("h3",{className:"text-3xl sm:text-4xl font-semibold text-center",children:"Private and secure chats"}),(0,S.jsx)("p",{className:"text-lg text-gray-600 text-center",children:"All data stored locally on your device. No training on your conversations."})]}),(0,S.jsxs)("div",{className:"relative grid md:grid-cols-2 gap-5 w-full",children:[(0,S.jsxs)("div",{className:"group text-left p-6 rounded-2xl border relative overflow-hidden flex flex-col items-center justify-center gap-10",children:[(0,S.jsx)("div",{className:"-z-10 absolute top-20 sm:top-12 scale-[1.4] w-full left-0 sm:left-7 h-full opacity-50 group-hover:opacity-50 transition-all",children:(0,S.jsx)("img",{src:"/assets/landing-page/bubbles-3.svg",className:"opacity-50 group-hover:opacity-50 transition-all"})}),(0,S.jsxs)("div",{className:"space-y-2",children:[(0,S.jsxs)("p",{className:"z-10 flex items-center gap-2 text-lg text-gray-900 font-semibold",children:[(0,S.jsx)("span",{className:"scale-[1.5]",children:(0,S.jsxs)("svg",{stroke:"currentColor",fill:"currentColor",strokeWidth:0,viewBox:"0 0 24 24",height:"1em",width:"1em",xmlns:"http://www.w3.org/2000/svg",children:[(0,S.jsx)("defs",{children:(0,S.jsxs)("linearGradient",{id:"iconGradientBlackToGray",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[(0,S.jsx)("stop",{offset:"0%",style:{stopColor:"rgb(59 130 246)"}}),(0,S.jsx)("stop",{offset:"100%",style:{stopColor:"rgb(103 232 249)"}})]})}),(0,S.jsx)("path",{d:"M11.488 21.754c.294.157.663.156.957-.001 8.012-4.304 8.581-12.713 8.574-15.104a.988.988 0 0 0-.596-.903l-8.05-3.566a1.005 1.005 0 0 0-.813.001L3.566 5.747a.99.99 0 0 0-.592.892c-.034 2.379.445 10.806 8.514 15.115zM8.674 10.293l2.293 2.293 4.293-4.293 1.414 1.414-5.707 5.707-3.707-3.707 1.414-1.414z",fill:"url(#iconGradientBlackToGray)"})]})}),"Data stored locally by default"]}),(0,S.jsx)("p",{className:"z-10 text-gray-600 text-base",children:"Your data remains securely stored on your device. There's no training conducted on your chats."})]}),(0,S.jsx)("div",{className:"z-10 mx-auto p-6 custom-shadow bg-white rounded-full w-fit flex items-center justify-center",children:(0,S.jsx)("span",{className:"w-32 sm:w-40 min-h-20",children:(0,S.jsx)("img",{src:"/assets/landing-page/data-stored-locally.png",className:"w-32 sm:w-40"})})})]}),(0,S.jsxs)("div",{className:"group text-left p-6 rounded-2xl border relative overflow-hidden flex flex-col justify-between gap-10",children:[(0,S.jsx)("div",{className:"-z-10 absolute top-20 sm:top-12 scale-[1.4] w-full left-0 sm:left-7 h-full opacity-50 group-hover:opacity-60 transition-all",children:(0,S.jsx)("img",{src:"/assets/landing-page/bubbles-3.svg",className:"opacity-50 group-hover:opacity-60 transition-all"})}),(0,S.jsxs)("div",{className:"space-y-2",children:[(0,S.jsxs)("p",{className:"z-10 flex items-center gap-2 text-lg text-gray-900 font-semibold",children:[(0,S.jsx)("span",{className:"scale-[1.5]",children:(0,S.jsxs)("svg",{stroke:"currentColor",fill:"currentColor",strokeWidth:0,viewBox:"0 0 640 512",height:"1em",width:"1em",xmlns:"http://www.w3.org/2000/svg",children:[(0,S.jsx)("defs",{children:(0,S.jsxs)("linearGradient",{id:"gradientPurpleToGray",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[(0,S.jsx)("stop",{offset:"0%",style:{stopColor:"rgb(74 222 128)"}}),(0,S.jsx)("stop",{offset:"100%",style:{stopColor:"rgb(22 163 74)"}})]})}),(0,S.jsx)("path",{d:"M537.6 226.6c4.1-10.7 6.4-22.4 6.4-34.6 0-53-43-96-96-96-19.7 0-38.1 6-53.3 16.2C367 64.2 315.3 32 256 32c-88.4 0-160 71.6-160 160 0 2.7.1 5.4.2 8.1C40.2 219.8 0 273.2 0 336c0 79.5 64.5 144 144 144h368c70.7 0 128-57.3 128-128 0-61.9-44-113.6-102.4-125.4zM393.4 288H328v112c0 8.8-7.2 16-16 16h-48c-8.8 0-16-7.2-16-16V288h-65.4c-14.3 0-21.4-17.2-11.3-27.3l105.4-105.4c6.2-6.2 16.4-6.2 22.6 0l105.4 105.4c10.1 10.1 2.9 27.3-11.3 27.3z",fill:"url(#gradientPurpleToGray)"})]})}),"Optional Cloud Sync & Backup"]}),(0,S.jsx)("p",{className:"z-10 text-gray-600 text-base",children:"Allow your data sync across multiple devices and prevent unexpected data loss. Activation is fully optional."})]}),(0,S.jsxs)("div",{className:"z-10 w-full gap-4 mx-auto p-6 custom-shadow bg-white rounded-xl max-w-xs flex flex-col items-center justify-center border",children:[(0,S.jsxs)("div",{className:"flex items-center gap-2 w-full justify-between",children:[(0,S.jsx)("p",{className:"text-left text-sm font-medium text-gray-600",children:"Cloud Sync & Backup"}),(0,S.jsx)(eW.rs,{checked:!0,className:"bg-gradient-to-r bg-blue-600 relative inline-flex h-5 w-10 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200",children:(0,S.jsx)("span",{className:"translate-x-5 pointer-events-none relative inline-block h-4 w-4 transform rounded-full bg-white shadow ring-0 transition duration-200",children:(0,S.jsx)("span",{className:"opacity-100 duration-200 ease-in absolute inset-0 flex h-full w-full items-center justify-center transition-opacity","aria-hidden":"true",children:(0,S.jsx)("svg",{className:"h-3 w-3 text-blue-600",fill:"currentColor",viewBox:"0 0 12 12",children:(0,S.jsx)("path",{d:"M3.707 5.293a1 1 0 00-1.414 1.414l1.414-1.414zM5 8l-.707.707a1 1 0 001.414 0L5 8zm4.707-3.293a1 1 0 00-1.414-1.414l1.414 1.414zm-7.414 2l2 2 1.414-1.414-2-2-1.414 1.414zm3.414 2l4-4-1.414-1.414-4 4 1.414 1.414z"})})})})})]}),(0,S.jsx)("div",{className:"w-[240px] sm:w-[270px] h-16",children:(0,S.jsx)("img",{src:"/assets/landing-page/cloud-storage.png",className:"rounded-md",alt:"Cloud Storage"})}),(0,S.jsxs)("div",{className:"flex items-center gap-2",children:[(0,S.jsxs)("span",{className:"flex items-center gap-1 justify-center text-xs sm:text-sm text-white bg-gradient-to-b from-blue-500 to-blue-600 px-2 sm:px-3 py-1 rounded-lg",children:[(0,S.jsx)(Y.r2j,{})," Export"]}),(0,S.jsxs)("span",{className:"flex items-center gap-1 justify-center text-xs sm:text-sm text-white bg-gradient-to-b from-blue-500 to-blue-600 px-2 sm:px-3 py-1 rounded-lg",children:[(0,S.jsx)(Y.cX4,{})," Import"]}),(0,S.jsxs)("span",{className:"flex items-center gap-1 justify-center text-xs sm:text-sm text-white bg-gradient-to-b from-orange-500 to-orange-600 px-2 sm:px-3 py-1 rounded-lg",children:[(0,S.jsx)(Y.wg8,{className:"shrink-0"})," ","Recover"]})]})]})]})]}),(0,S.jsxs)("div",{className:"flex sm:flex-row flex-col items-center justify-center gap-2",children:[(0,S.jsx)("button",{onClick:function(){return b()},className:"w-full max-w-xs sm:w-fit flex items-center justify-center gap-1 px-6 py-3 rounded-full bg-gradient-to-b from-blue-500 to-blue-700 text-white font-semibold hover:via-blue-700 hover:to-blue-900 transition-all focus-visible:outline outline-2 outline-offset-2 outline-blue-500",children:"Buy license key"}),(0,S.jsx)("button",{onClick:r,className:"w-full bg-white max-w-xs sm:w-fit flex items-center justify-center gap-2 px-6 py-3 rounded-full border border-gray-400 text-black font-semibold hover:bg-gray-100 transition-all focus-visible:outline outline-2 outline-offset-2 outline-gray-700",children:"Try now for free"})]})]}),(0,S.jsxs)("div",{className:"space-y-12",children:[(0,S.jsxs)("div",{className:"space-y-3",children:[(0,S.jsxs)("h3",{className:"text-3xl sm:text-4xl font-semibold text-center",children:[(0,S.jsx)("span",{className:"inline-block",children:"Use plugins or\xa0"}),(0,S.jsx)("span",{className:"inline-block",children:"build your own"})]}),(0,S.jsx)("p",{className:"text-lg text-gray-600 text-center",children:"Explore our wide range of existing plugins, or adding any plugins you want."})]}),(0,S.jsxs)("div",{className:"relative grid md:grid-cols-2 gap-16 lg:gap-5 w-full",children:[(0,S.jsx)("div",{className:"order-2 md:order-1 flex items-center justify-center relative w-full mx-auto",children:(0,S.jsx)("div",{className:"mx-0 max-w-sm lg:mx-auto overflow-hidden relative w-[320px] sm:w-[500px] aspect-[1426 / 1452]",children:(0,S.jsx)("video",{src:"/assets/landing-page/using-plugin-demo.mp4",autoPlay:!0,muted:!0,loop:!0,playsInline:!0,preload:"metadata",controls:!0,className:"w-full"})})}),(0,S.jsx)("div",{className:"order-1 md:order-2 grid grid-cols-1 gap-5 h-fit pl-0 lg:pl-10 mx-auto",children:[{title:"Multiple plugins available",description:"Dive into our plugin collection including Interactive Canvas, Web Search, DALL-E 3, Perplexity AI and beyond."},{title:"Effortlessly create any plugins",description:"Just 3 steps, you can integrate any plugins into your AI chats."},{title:"Fully customizable outputs",description:"Guide the AI on the output formats you desire, such as markdown, HTML, JSON, and similar formats."},{title:"One-click plugin imports via URLs",description:"Instant plugin integration with our easy URL import feature."}].map(function(e,t){return(0,S.jsxs)("div",{className:"flex flex-col gap-1 text-left",children:[(0,S.jsxs)("div",{className:"flex items-center gap-2",children:[(0,S.jsx)(nx.nRB,{className:"text-blue-600 h-4 w-4 shrink-0"}),(0,S.jsx)("p",{className:"text-base text-gray-900 font-semibold",children:e.title})]}),(0,S.jsx)("p",{className:"ml-6 text-gray-600 text-base",children:e.description})]},t)})})]}),(0,S.jsxs)("div",{className:"z-10 relative flex sm:flex-row flex-col items-center justify-center gap-2",children:[(0,S.jsx)("button",{onClick:function(){return b()},className:"w-full max-w-xs sm:w-fit flex items-center justify-center gap-1 px-6 py-3 rounded-full bg-gradient-to-b from-blue-500 to-blue-700 text-white font-semibold hover:via-blue-700 hover:to-blue-900 transition-all focus-visible:outline outline-2 outline-offset-2 outline-blue-500",children:"Buy license key"}),(0,S.jsx)("button",{onClick:r,className:"w-full bg-white max-w-xs sm:w-fit flex items-center justify-center gap-2 px-6 py-3 rounded-full border border-gray-400 text-black font-semibold hover:bg-gray-100 transition-all focus-visible:outline outline-2 outline-offset-2 outline-gray-700",children:"Try now for free"})]}),(0,S.jsx)("div",{className:"pt-2 grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:hP.map(function(e,t){return(0,S.jsxs)("div",{className:"rounded-md shadow-md p-4 border border-gray-200 text-left space-y-3 hover:shadow-lg transition-all cursor-default",children:[(0,S.jsx)("div",{className:"w-9 h-9",children:(0,S.jsx)("img",{src:e.iconURL,className:(0,O.AK)(null!=e&&e.isNotRounded?"":"rounded-md","w-9 h-9")})}),(0,S.jsxs)("div",{className:"space-y-1",children:[(0,S.jsx)("p",{className:"text-gray-900 font-semibold",children:e.name}),(0,S.jsx)("p",{className:"text-gray-600 sm:text-base text-sm",children:e.description})]})]},t)})}),(0,S.jsxs)("div",{className:"z-10 relative flex sm:hidden sm:flex-row flex-col items-center justify-center gap-2",children:[(0,S.jsx)("button",{onClick:function(){return b()},className:"w-full max-w-xs sm:w-fit flex items-center justify-center gap-1 px-6 py-3 rounded-full bg-gradient-to-b from-blue-500 to-blue-700 text-white font-semibold hover:via-blue-700 hover:to-blue-900 transition-all focus-visible:outline outline-2 outline-offset-2 outline-blue-500",children:"Buy license key"}),(0,S.jsx)("button",{onClick:r,className:"w-full bg-white max-w-xs sm:w-fit flex items-center justify-center gap-2 px-6 py-3 rounded-full border border-gray-400 text-black font-semibold hover:bg-gray-100 transition-all focus-visible:outline outline-2 outline-offset-2 outline-gray-700",children:"Try now for free"})]})]})]}),(0,S.jsxs)("div",{className:"my-16",children:[(0,S.jsx)("h4",{className:"text-3xl text-gray-800 font-semibold px-6",children:"We love the little details"}),(0,S.jsx)("div",{className:"mt-10 w-screen sm:w-full",children:(0,S.jsxs)(cv.fC,{type:"always",className:"w-full h-full flex items-center justify-center",children:[(0,S.jsx)(cv.l_,{className:"w-full h-full rounded pb-6",children:(0,S.jsx)("div",{className:"w-[1500px] sm:w-auto sm:max-w-4xl sm:mx-auto px-6",children:(0,S.jsx)("ul",{className:"flex sm:grid sm:grid-cols-3 lg:grid-cols-3 gap-7 w-full",children:hO.map(function(e){return(0,S.jsxs)("li",{className:"text-left text-gray-800 space-y-3",children:[(0,S.jsx)("p",{className:"text-sm font-semibold",children:e.title}),(0,S.jsx)("ul",{className:"space-y-2 text-left",children:e.children.map(function(e){return(0,S.jsx)("li",{className:"text-sm text-gray-700 capitalize",children:e},e)})})]},e.title)})})})}),(0,S.jsx)(cv.LW,{className:"mx-6 flex sm:hidden select-none touch-none p-0.5 rounded-full bg-gray-100 transition-colors duration-150 ease-out hover:bg-gray-200 data-[orientation=vertical]:w-2.5 data-[orientation=horizontal]:flex-col data-[orientation=horizontal]:h-2.5 dark:bg-transparent",orientation:"horizontal",children:(0,S.jsx)(cv.bU,{className:"flex-1 bg-gray-400 rounded-full relative dark:bg-zinc-700"})})]})})]}),(0,S.jsx)(hy,{handleBuyLicenseKey:b,handleTryForFree:function(){return n(!1)}})]}),(0,S.jsx)("button",{className:"fixed right-0 lg:right-8 xl:right-20 top-6 p-1 sm:p-0.5 sm:top-8 text-gray-50 z-10 text-sm bg-gray-900 rounded-l-lg sm:rounded-lg",onClick:function(){return n(!1)},children:(0,S.jsx)(ln.j7p,{className:"w-6 h-6 shrink-0"})})]}),(0,S.jsx)(cv.LW,{className:"flex touch-none p-0.5 rounded-full bg-gray-100 transition-colors duration-150 ease-out hover:bg-gray-200 data-[orientation=vertical]:w-2.5 data-[orientation=horizontal]:flex-col data-[orientation=horizontal]:h-2.5 dark:bg-transparent",orientation:"vertical",children:(0,S.jsx)(cv.bU,{className:"flex-1 bg-gray-400 rounded-full relative dark:bg-zinc-700"})})]})})})})]})})]})}var hD=function(e){var t=e.rating,n=(0,ik.Z)(e,hN);t=Math.round(2*t)/2;for(var s=[],r=0;r<5;r++)r0)||void 0===arguments[0]||arguments[0];T(w[R].reduce(function(t,n){return hX(hX({},t),{},(0,b.Z)({},n.id,e))},{}))},G=function(e){T(hX(hX({},P),{},(0,b.Z)({},e,!P[e])))},F=(n=(0,x.Z)(j().mark(function e(t){var n,s,r,a;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.ids,s=t.isDeleteAll,p(!0),f(null),e.prev=3,e.next=6,fetch("/api/shared-links",{headers:{"Content-Type":"application/json"},method:"POST",body:JSON.stringify({ids:n,type:R,isDeleteAll:s})});case 6:if((r=e.sent).ok){e.next=10;break}return f(o._(h$)),e.abrupt("return");case 10:return e.next=12,r.json();case 12:a=e.sent,k(function(e){return hX(hX({},e),{},(0,b.Z)({},R,a))}),eC.ZP.success(o._({id:"uNTuV6"})),e.next=21;break;case 17:e.prev=17,e.t0=e.catch(3),f(o._(h$)),console.error(e.t0);case 21:return e.prev=21,p(!1),T({}),e.finish(21);case 25:case"end":return e.stop()}},e,null,[[3,17,21,25]])})),function(e){return n.apply(this,arguments)}),Y=(s=(0,x.Z)(j().mark(function e(t){return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:p(!0),B((null==D?void 0:D.sortBy)===t?{sortBy:t,order:"asc"===D.order?"desc":D.order?null:"asc"}:{sortBy:t,order:"asc"}),p(!1);case 4:case"end":return e.stop()}},e)})),function(e){return s.apply(this,arguments)}),U=Object.values(P).filter(Boolean).length,H=(0,q.useMemo)(function(){return(0,v.Z)(w[R]).sort(function(e,t){return"createdAt"===D.sortBy?"asc"===D.order?new Date(e.createdAt)-new Date(t.createdAt):new Date(t.createdAt)-new Date(e.createdAt):"asc"===D.order?(t.title||"").localeCompare(e.title||""):(e.title||"").localeCompare(t.title||"")})},[D,w,R]);return(0,S.jsxs)(X,{max:!0,open:a,setOpen:i,title:o._({id:"4+XAJf"}),position:"top",closeButtonClassName:m?"opacity-50":"",children:[m&&(0,S.jsx)("div",{className:"absolute top-0 left-0 w-full h-full bg-opacity-5 bg-black flex items-center justify-center z-10"}),(0,S.jsx)("div",{className:(0,O.AK)("w-full mt-6 mb-4 flex",m?"opacity-70":""),children:(0,S.jsx)("div",{className:"mx-auto overflow-hidden",children:(0,S.jsx)("div",{className:"flex items-start justify-start gap-2 overflow-auto whitespace-nowrap pt-1 pb-3",children:[{label:(0,S.jsx)(A.cC,{id:"8Q+lLG"}),value:O.$n.CHAT},{label:(0,S.jsx)(A.cC,{id:"uHkL3b"}),value:O.$n.CHARACTER},{label:(0,S.jsx)(A.cC,{id:"ohUJJM"}),value:O.$n.PLUGIN}].map(function(e){return(0,S.jsx)("button",{onClick:function(){return _(e.value)},className:(0,O.AK)("w-fit inline-flex items-center px-3 py-2 border text-sm rounded-md focus:outline-none gap-2 transition-colors justify-between","disabled:pointer-events-none",R===e.value?"bg-blue-100 hover:bg-blue-200 text-black border-blue-500 dark:bg-gray-700 dark:text-white":"bg-gray-100 hover:bg-gray-200 border-transparent dark:bg-gray-800 dark:text-gray-300 text-gray-700"),disabled:c,children:(0,S.jsx)("span",{className:"flex items-center justify-center gap-2",children:e.label})},e.value)})})})}),g&&(0,S.jsx)("div",{className:"text-sm text-center text-red-500 my-4",children:g}),H.length>0?(0,S.jsxs)("div",{className:(0,O.AK)(m?"opacity-70":""),children:[(0,S.jsxs)("div",{className:"flex items-center justify-between",children:[(0,S.jsxs)("div",{className:"flex relative items-center",children:[(0,S.jsx)("div",{className:(0,O.AK)("absolute top-0 left-0 h-full flex items-center",U>0?"opacity-0 -z-10":""),children:(0,S.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,S.jsx)("span",{className:"font-semibold",children:(0,S.jsx)(A.cC,{id:"Dil/yn"})})," ",c?(0,S.jsx)(E,{}):(0,S.jsx)("span",{children:H.length})]})}),(0,S.jsxs)("div",{className:(0,O.AK)(U>0?"opacity-1":"opacity-0 pointer-events-none","flex items-center text-sm bg-gray-100 dark:bg-zinc-700 px-2 py-1.5 rounded-full"),children:[(0,S.jsx)("div",{className:"hover:bg-gray-200 dark:hover:bg-zinc-600 rounded-full mr-1 cursor-pointer",onClick:function(){return K(!1)},children:(0,S.jsx)(ln.j7p,{className:"text-gray-500 dark:text-zinc-100 w-6 h-6"})}),(0,S.jsxs)("p",{className:"text-gray-500 dark:text-zinc-100",children:[(0,S.jsx)(A.cC,{id:"7HsnfO",values:{totalSelected:U},components:{0:(0,S.jsx)("b",{})}}),":"]}),m&&!C?(0,S.jsx)("div",{className:"mx-4 text-gray-500 font-semibold",children:(0,S.jsx)(E,{})}):(0,S.jsx)(eS,{className:"text-red-500 mx-2 font-semibold hover:underline disabled:pointer-events-none disabled:text-gray-400",onConfirmed:function(){F({ids:Object.keys(P).filter(function(e){return P[e]})})},children:(0,S.jsx)(A.cC,{id:"cnGeoo"})})]})]}),(0,S.jsx)("div",{className:"flex items-center justify-between",children:(0,S.jsx)(eS,{className:"text-red-500 mx-2 font-semibold hover:underline disabled:pointer-events-none disabled:text-gray-400",onConfirmed:function(){F({isDeleteAll:!0})},children:(0,S.jsx)(A.cC,{id:"KZN4Lc"})})})]}),(0,S.jsx)("div",{className:"overflow-auto mt-3",children:(0,S.jsxs)("table",{className:"w-full min-w-[540px] divide-y divide-gray-300 dark:divide-gray-600",children:[(0,S.jsx)("thead",{children:(0,S.jsxs)("tr",{children:[(0,S.jsx)("th",{scope:"col",className:"relative px-7",children:(0,S.jsx)("input",{type:"checkbox",className:"absolute left-4 top-1/2 -mt-2 h-4 w-4 rounded border-gray-300 text-blue-500 focus:ring-blue-500",checked:U===H.length,onChange:function(e){K(e.target.checked)}})}),(0,S.jsx)("th",{scope:"col",className:"px-3 py-3.5 text-left text-sm font-semibold text-gray-900 dark:text-white",children:(0,S.jsxs)("button",{type:"button",className:"group inline-flex",onClick:function(){return Y("title")},children:[(0,S.jsx)(A.cC,{id:"MHrjPM"}),(0,S.jsx)("span",{className:(0,O.AK)("ml-2 flex-none rounded","title"===D.sortBy&&D.order?"text-gray-700 bg-gray-100 dark:bg-zinc-800 dark:text-white group-hover:bg-gray-200 dark:group-hover:bg-zinc-700":"invisible text-gray-500 group-hover:visible","asc"===D.order?"-scale-y-100":""),children:(0,S.jsx)(r1.Z,{className:"h-5 w-5","aria-hidden":"true"})})]})}),(0,S.jsx)("th",{scope:"col",className:"px-3 py-3.5 text-left text-sm font-semibold text-gray-900 dark:text-white w-[182px]",children:(0,S.jsxs)("button",{type:"button",className:"group inline-flex",onClick:function(){return Y("createdAt")},children:[(0,S.jsx)(A.cC,{id:"4DIWvs"}),(0,S.jsx)("span",{className:(0,O.AK)("ml-2 flex-none rounded","createdAt"===D.sortBy&&D.order?"text-gray-700 bg-gray-100 dark:bg-zinc-800 dark:text-white group-hover:bg-gray-200 dark:group-hover:bg-zinc-700":"invisible text-gray-500 group-hover:visible","asc"===D.order?"-scale-y-100":""),children:(0,S.jsx)(r1.Z,{className:"h-5 w-5","aria-hidden":"true"})})]})}),(0,S.jsx)("th",{scope:"col",className:"relative py-3.5 pl-3 pr-0"})]})}),(0,S.jsx)("tbody",{className:"divide-y divide-gray-200 dark:divide-gray-800",children:H.map(function(e){return(0,S.jsxs)("tr",{className:(0,O.AK)("cursor-pointer",P[e.id]?"bg-blue-50 dark:bg-gray-900":"hover:bg-gray-50 dark:hover:bg-zinc-900"),onClick:function(){return G(e.id)},children:[(0,S.jsx)("td",{className:"relative px-7",children:(0,S.jsx)("input",{type:"checkbox",className:"absolute left-4 top-1/2 -mt-2 h-4 w-4 rounded border-gray-300 text-blue-500 focus:ring-blue-500",checked:P[e.id],onChange:function(t){t.stopPropagation(),G(e.id)}})}),(0,S.jsx)("td",{className:(0,O.AK)("px-3 py-4 text-sm text-gray-500"),children:(0,S.jsx)("p",{className:"font-medium text-gray-900 dark:text-white",children:e.title})}),(0,S.jsx)("td",{className:"whitespace-nowrap px-3 py-4 text-sm text-gray-500",children:new Date(e.createdAt).toLocaleString()}),(0,S.jsx)("td",{className:"whitespace-nowrap px-3 py-4 text-sm text-gray-500 w-[80px]",children:(0,S.jsxs)("div",{className:"flex justify-end items-center space-x-4",children:[(0,S.jsx)("div",{children:(0,S.jsx)("a",{href:R===O.$n.CHAT?"/share/".concat(e.id):R===O.$n.CHARACTER?"/characters/".concat(e.id):"/plugins/".concat(e.id),className:"font-semibold text-blue-500 hover:underline flex items-center justify-center gap-1",target:"_blank",onClick:function(e){return e.stopPropagation()},children:(0,S.jsx)(A.cC,{id:"LuXP9q"})})}),(0,S.jsxs)("div",{className:"relative",children:[C===e.id&&(0,S.jsx)("div",{className:(0,O.AK)("absolute left-0 top-0 w-full h-full flex items-center justify-center"),children:(0,S.jsx)(E,{})}),(0,S.jsx)(eS,{className:(0,O.AK)("text-red-500 font-semibold hover:underline disabled:pointer-events-none disabled:text-gray-400 min-w-[44px]",C===e.id?"opacity-0":""),onConfirmed:(0,x.Z)(j().mark(function t(){return j().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return I(e.id),t.next=3,F({ids:[e.id]});case 3:I(null);case 4:case"end":return t.stop()}},t)})),children:(0,S.jsx)(A.cC,{id:"cnGeoo"})})]})]})})]},e.id)})})]})})]}):c||g?g?null:(0,S.jsx)("div",{className:"pt-8 pb-8 flex items-center justify-center",children:(0,S.jsx)(E,{})}):(0,S.jsx)("div",{className:"pb-8 pt-8 text-center",children:(0,S.jsx)(A.cC,{id:"1dhpFr"})})]})}var h1=n(70046);function h2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,s)}return n}function h4(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{};return h4(h4({},e),Object.fromEntries(eo.plugins.filter(function(e){return e.turnedOnByDefault}).map(function(e){return[e.id,{enabled:!0}]})))}))},[]),(0,q.useEffect)(function(){nC?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")},[nC]),(0,q.useEffect)(function(){sG||"started"!==nt?sD(!1):sD(!0)},[nt]),(0,q.useEffect)(function(){null!==e6&&(e6||null!=tx&&tx.managed?nk():nA({id:"openModal",handler:function(){window.document.getElementById("headlessui-portal-root")||(e6||null!=tx&&tx.managed?nk():["https://www.typingmind.com","http://localhost:8151"].includes(window.location.origin))}}))},[e6,tx]);var rC=(0,q.useCallback)(function(){var e=ek||eS||eV;e6&&e&&!sP&&!ns&&rq()},[ns,e6,sP,ek,eS,eV]),rq=function(){["https://setapp.typingcloud.com","https://www.typingmind.com","http://localhost:8151","https://host5.typingcloud.local:18151"].includes(window.location.origin)&&sC(!0)};(0,q.useEffect)(function(){if(!tx.managed&&!tx.hosted){if(null===e6||!0===e6){(0,dm.j)("user-type",{type:"licensed"});return}setTimeout(function(){var e=new URLSearchParams(window.location.search);e.get("thankyou")||e.get("checkout_success")||"#thankyou"===window.location.hash||window.__STOP_LANDING_PAGE||(sc(!0),(0,dm.j)("user-type",{type:"unlicensed"}))},500)}},[tx,e6]),(0,q.useEffect)(function(){null!=nh&&nh.import_plugin&&nm(!0)},[np]),(0,q.useEffect)(function(){try{if(new URLSearchParams(window.location.search).get("aff")){window.lemonSqueezyAffiliateConfig={store:"tdinh"};var e=document.createElement("script");e.src="https://lmsqueezy.com/affiliate.js",e.defer=!0,document.body.appendChild(e)}}catch(e){console.error("aff script failed",e)}},[]),(0,q.useEffect)(function(){null!=eo&&eo.managed&&null!=eo&&eo.licenseToken&&setTimeout(function(){rI(null==eo?void 0:eo.licenseToken)},100)},[]),(0,q.useEffect)(function(){nz&&(sy&&rG(e$.filter(function(e){var t;return!!e.createdAt&&!e.archivedAt&&!e.favoritedAt&&!e.folderID&&!(null!==(t=e.tags)&&void 0!==t&&t.length)&&new Date().getTime()-new Date(e.updatedAt).getTime()>36e5*Number(sy)}).map(function(e){return e.id})),sA&&r$(e$.filter(function(e){return!!e.archivedAt&&new Date().getTime()-new Date(e.archivedAt).getTime()>36e5*Number(sA)}).map(function(e){return e.id})))},[nz]);var rI=(r=(0,x.Z)(j().mark(function e(t){return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return tG(t),e.next=3,(0,O.uM)(t);case 3:tk(e.sent);case 5:case"end":return e.stop()}},e)})),function(e){return r.apply(this,arguments)});(0,q.useEffect)(function(){"#pricing"===window.location.hash&&(te(!0),window.location.hash="")},[]),(0,q.useEffect)(function(){var e,t,n,s=(null==ej||null===(e=ej.assignedAPIKey)||void 0===e?void 0:e.openAIAPIKey)||ep;s.startsWith("encrypted-")||eC(s);var r=(null==ej||null===(t=ej.assignedAPIKey)||void 0===t?void 0:t.anthropicAPIKey)||ef;r.startsWith("encrypted-")||eE(r);var a=(null==ej||null===(n=ej.assignedAPIKey)||void 0===n?void 0:n.geminiAPIKey)||ev;a.startsWith("encrypted-")||eP(a)},[ep,ef,ev,null==ej?void 0:ej.assignedAPIKey]),(0,q.useEffect)(function(){var e;window.__TURNSTILE_CALLBACK=function(e){window.turnstile.remove(),nX(e),eB(!0)},eB(!!nJ||null===(e=tx.cloudflareTurnstileConfigs)||void 0===e||!e.enabled),rO(),(null==eo?void 0:eo.managed)!==!0||null!=eo&&eo.requireLicenseKey?rU(e4):rH(),rS(),nr({skipCheck:null==tx?void 0:tx.autoSyncUserData})},[]),(0,q.useEffect)(function(){nI||tK||!e4||rU(e4)},[tK,e4]),(0,q.useEffect)(function(){var e,t=I.Z.get("typingmindcloud_token");if(t){try{var n=t.split(".")[1];e=JSON.parse(atob(n)).orgID}catch(e){console.error(e)}if(e)return;window.__STOP_LANDING_PAGE=!0,nr({skipCheck:!0})}},[]),(0,q.useEffect)(function(){nI||rH()},[tK]),(0,q.useEffect)(function(){var e=function(){"visible"===document.visibilityState&&(ty&&tw(!1),nr())};return window.document.addEventListener("visibilitychange",e),function(){window.document.removeEventListener("visibilitychange",e)}},[]),(0,q.useEffect)(function(){rA();var e=function(e){"TM_crossTabLastSynced"===e.key&&rA()};return window.addEventListener("storage",e),function(){window.removeEventListener("storage",e)}},[ns]);var rS=function(){if(!("serviceWorker"in navigator)){console.log("Service worker not supported");return}window.navigator.serviceWorker.register("/sw.js",{scope:"."}).then(function(e){console.log("Service Worker registration successful with scope: ",e.scope)},function(e){console.log("Service Worker registration failed: ",e)})};(0,q.useEffect)(function(){if(e$.length&&!nl&&(nc(!0),window.location.hash.startsWith("#chat="))){var e=window.location.hash.split("=")[1],t=e$.find(function(t){return t.id===e});t&&rM(t,void 0,{replaceURL:!1})}},[e$,nl]),(0,q.useEffect)(function(){!window.location.hash.startsWith("#chat=")&&ez&&eF&&(eJ(eF),window.location.hash="#chat="+eF)},[]),(0,q.useEffect)(function(){eY(eQ)},[eQ]),(0,q.useEffect)(function(){nI||nW(!0)},[e$]),(0,q.useEffect)(function(){nE&&"anonymous"!==nE.externalUserID&&!(null!=nE&&nE.profile)&&new Date(nE.createdAt).getTime()>new Date("2024-05-18").getTime()&&sg(!0)},[nE]);var rE=(0,q.useCallback)(function(){nF(!0)},[]),rO=(a=(0,x.Z)(j().mark(function e(){var t,n;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(tx.hosted||tx.firstParty)){e.next=2;break}return e.abrupt("return");case 2:return e.prev=2,e.next=5,fetch("/config.json");case 5:return t=e.sent,e.next=8,t.json();case 8:tb({hosted:(n=e.sent).hosted,brand:n.brand,tagline:n.tagline,logoURL:n.logoURL}),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(2),console.error(e.t0);case 15:case"end":return e.stop()}},e,null,[[2,12]])})),function(){return a.apply(this,arguments)}),rV=(0,q.useMemo)(function(){return null===e6||!1!==e6},[e6,nE]),rP=(i=(0,x.Z)(j().mark(function e(t){return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(ec.current=(0,O.sv)(),rx(!0),rV){e.next=4;break}return e.abrupt("return");case 4:return e.next=6,ed.current.addChats([t]);case 6:return e.next=8,rA();case 8:t.title&&eZ(t.title),window.location.hash.startsWith("#chat=")||(window.location.hash="#chat="+t.id),rC();case 11:case"end":return e.stop()}},e)})),function(e){return i.apply(this,arguments)}),rT=(o=(0,x.Z)(j().mark(function e(){var t,n,s,r,a,i=arguments;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=(t=i.length>0&&void 0!==i[0]?i[0]:{}).clonedChat,s=t.defaultEditting,r=t.character,a=ec.current,!n){e.next=10;break}return n.newID?(a=n.newID,delete n.newID):a=(0,O.sv)(),s?tR(n.messages.length-1):tR(-1),eZ(n.chatTitle),e.next=8,rP(h4(h4({},n),{},{id:a,createdAt:new Date}));case 8:e.next=12;break;case 10:eZ(""),tR(-1);case 12:rn("chat"),eJ(a),rw(r),window.history.replaceState(void 0,void 0,"#chat="+a);case 16:case"end":return e.stop()}},e)})),function(){return o.apply(this,arguments)}),rM=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=n.replaceURL;(void 0===s||s)&&window.history.replaceState(t,void 0,"#chat="+e.id),eJ(e.id),eZ(e.title),tR(-1),null!=t&&t.search&&s_(Date.now())},rD=(l=(0,x.Z)(j().mark(function e(t,n){var s;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ed.current.getChatData(t);case 2:if((null==(s=e.sent)?void 0:s.chatTitle)!==n){e.next=5;break}return e.abrupt("return");case 5:if(!rV){e.next=10;break}return e.next=8,ed.current.bulkUpdateChatFields((0,b.Z)({},t,{chatTitle:n,syncedAt:null,createdAt:s?s.createdAt:new Date}));case 8:rj(e.sent);case 10:case"end":return e.stop()}},e)})),function(e,t){return l.apply(this,arguments)}),rB=(c=(0,x.Z)(j().mark(function e(t,n){return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:rD(t,n),t===eQ&&eZ(n),nr();case 3:case"end":return e.stop()}},e)})),function(e,t){return c.apply(this,arguments)}),rL=(d=(0,x.Z)(j().mark(function e(t,n){var s;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ed.current.bulkUpdateChatFields((0,b.Z)({},t,{tags:n,syncedAt:null}));case 2:return s=e.sent,e.next=5,rj(s);case 5:nr();case 6:case"end":return e.stop()}},e)})),function(e,t){return d.apply(this,arguments)}),rR=(u=(0,x.Z)(j().mark(function e(t){var n,s;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.id,e.next=3,ed.current.bulkUpdateChatFields((0,b.Z)({},n,{favoritedAt:t.favoritedAt?null:new Date,syncedAt:null}));case 3:return s=e.sent,e.next=6,rj(s);case 6:nr();case 7:case"end":return e.stop()}},e)})),function(e){return u.apply(this,arguments)}),r_=(m=(0,x.Z)(j().mark(function e(t){return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:rF([t],!1);case 1:case"end":return e.stop()}},e)})),function(e){return m.apply(this,arguments)}),rZ=(p=(0,x.Z)(j().mark(function e(t){return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:rF(t,!1);case 1:case"end":return e.stop()}},e)})),function(e){return p.apply(this,arguments)}),rK=(h=(0,x.Z)(j().mark(function e(t){return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:rF([t],!0);case 1:case"end":return e.stop()}},e)})),function(e){return h.apply(this,arguments)}),rG=(g=(0,x.Z)(j().mark(function e(t){return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:rF(t,!0);case 1:case"end":return e.stop()}},e)})),function(e){return g.apply(this,arguments)}),rF=(f=(0,x.Z)(j().mark(function e(t){var n,s,r=arguments;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=!(r.length>1)||void 0===r[1]||r[1],e.next=3,ed.current.bulkUpdateChatFields(t.reduce(function(e,t){return e[t]={archivedAt:n?new Date:null,syncedAt:null},e},{}));case 3:return s=e.sent,e.next=6,rj(s);case 6:nr();case 7:case"end":return e.stop()}},e)})),function(e){return f.apply(this,arguments)}),rY=function(e,t){rD(e,t),e===eQ&&eZ(t)},rU=(w=(0,x.Z)(j().mark(function e(t){var n,s,r,a;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=3;break}return e7(!1),e.abrupt("return");case 3:return e.prev=3,e.next=6,(0,O.lU)({key:t});case 6:if(!((n=e.sent).status>=500||429===n.status)){e.next=11;break}return e.next=10,rH();case 10:case 29:case 34:return e.abrupt("return");case 11:if(!(n.status>=400)){e.next=30;break}return e.next=14,n.json();case 14:if(tq(s=e.sent),!s.limitReached){e.next=21;break}e7(!1),setTimeout(function(){ts(!0)},1e3),e.next=29;break;case 21:if(!s.deviceUnlinked){e.next=26;break}e7(!1),setTimeout(function(){ts(!0),e5(""),(0,K.CQ)().del("INSTANCE_ID")},1e3),e.next=29;break;case 26:return console.error(s),e.next=29,rH();case 30:if(n.ok){e.next=35;break}return console.error(n),e.next=34,rH();case 35:return e.next=37,n.json();case 37:return r=e.sent,e.prev=38,e.next=41,(0,O.uM)(r.token);case 41:if(a=e.sent,!r.instanceID){e.next=45;break}return e.next=45,(0,K.CQ)().set("INSTANCE_ID",r.instanceID);case 45:tG(r.token),tk(a),e.next=54;break;case 49:return e.prev=49,e.t0=e.catch(38),console.error(e.t0),e7(!1),e.abrupt("return");case 54:return e5(t),e7(!0),e.abrupt("return",!0);case 59:return e.prev=59,e.t1=e.catch(3),console.error(e.t1),e.next=64,rH();case 64:case"end":return e.stop()}},e,null,[[3,59],[38,49]])})),function(e){return w.apply(this,arguments)}),rH=(k=(0,x.Z)(j().mark(function e(){var t,n,s;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(tK){e.next=3;break}return e7(!1),e.abrupt("return");case 3:return e.prev=3,e.next=6,(0,O.uM)(tK);case 6:tk(t=e.sent),e7(!0),(null==eo?void 0:eo.managed)===!0&&!(null!=eo&&eo.requireLicenseKey)&&nE&&!eo.licenseToken&&(eC(tK),eE(tK),eP(tK),(s=null==t||null===(n=t.payload)||void 0===n?void 0:n.exp)&&3>Math.floor((s-Date.now()/1e3)/86400)&&nw(!0)),e.next=17;break;case 12:e.prev=12,e.t0=e.catch(3),console.error("verifyLastSavedToken failed:",e.t0),e7(!1),(null==eo?void 0:eo.managed)!==!0||null!=eo&&eo.requireLicenseKey||!nE||eo.licenseToken||nw(!0);case 17:case"end":return e.stop()}},e,null,[[3,12]])})),function(){return k.apply(this,arguments)}),rz=function(e){e>3&&rW()},rW=function(){var e=Math.floor((Date.now()-th)/1e3);!1===e6&&e>120&&(tm(!0),tg(Date.now()))},rQ=function(){if(tx.allowSubscriptions){var e;null===(e=window.document.getElementById("org-login-button"))||void 0===e||e.click()}else tU(!0)},rJ=function(){ti(!0)},rX=function(){tc(!0)},r$=(V=(0,x.Z)(j().mark(function e(t){return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ed.current.deleteChatsByIDs(t);case 2:return tD(function(e){return[].concat((0,v.Z)(e),(0,v.Z)(t))}),e.next=5,rA();case 5:t.includes(eQ)&&rT(),nr();case 7:case"end":return e.stop()}},e)})),function(e){return V.apply(this,arguments)}),r0=(T=(0,x.Z)(j().mark(function e(t){var n,s,r,a,i,o,l;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ed.current.getChatsByIDs(t);case 2:n={data:{chats:e.sent}},s=new Date,r=(null==eo?void 0:eo.displayBrand)==="TypingMind"||(null==eo?void 0:eo.displayBrand)==="Typing Mind"?"_typingmind":null!=eo&&eo.subdomain?"_"+(null==eo?void 0:eo.subdomain):"",a="".concat((0,nY.Z)(s,"yyyyMMdd_HHmmss")).concat(r,"_chats.json"),i=new Blob([JSON.stringify(n)],{type:"application/json"}),o=URL.createObjectURL(i),(l=document.createElement("a")).setAttribute("href",o),l.setAttribute("download",a),document.body.appendChild(l),l.click(),l.remove(),URL.revokeObjectURL(o);case 17:case"end":return e.stop()}},e)})),function(e){return T.apply(this,arguments)}),r1=(M=(0,x.Z)(j().mark(function e(t){return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ed.current.searchChats(t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},e)})),function(e){return M.apply(this,arguments)}),r2=(0,q.useCallback)(function(){t4(!0)},[]),r4=function(e){e?(ss(!0),si(e)):rn("plugins")},r5=(D=(0,x.Z)(j().mark(function e(t,n){var s;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ed.current.bulkUpdateChatFields(t.reduce(function(e,t){return e[t]={folderID:n,updatedAt:new Date,syncedAt:null},e},{}));case 2:return s=e.sent,e.next=5,rj(s);case 5:case"end":return e.stop()}},e)})),function(e,t){return D.apply(this,arguments)}),r3=(0,q.useCallback)(function(e){return!!tx.managed||(0,O.eT)(e,tA)},[tA,tx]);(0,q.useMemo)(function(){return!!eo.modelLimits&&Object.values(eo.modelLimits).some(function(e){var t,n;return(null===(t=e.messages)||void 0===t?void 0:t.length)>0||e.characters>0||(null===(n=e.charactersByPeriod)||void 0===n?void 0:n.length)>0})},[eo]);var r6=eo.managed?eo.plugins:sV.filter(function(e){return!e.isServerPlugin}),r7=tx.defaultCharacterID?s9.find(function(e){return e.id===tx.defaultCharacterID}):void 0,r8=(0,O.N7)("showWorkspaceBar",tx.chatFeatures);return void 0!==el&&el?(0,S.jsx)(lZ,{}):tx.externalAuthError?(0,S.jsxs)("div",{className:"flex items-center justify-center p-4 min-h-screen bg-[#f2edeb] flex-col gap-2",children:[(null===(z=tx.externalAuthConfig)||void 0===z?void 0:z.type)==="setapp"?(0,S.jsx)("div",{className:"flex items-center justify-center gap-2",children:(0,S.jsx)("img",{src:"/assets/setapp-logo-vector.svg",className:"h-48"})}):null,(0,S.jsxs)("div",{className:"font-semibold text-gray-500 text-center tracking-wide",children:[(0,S.jsxs)("span",{children:["There was a problem when trying to authenticate you session (",(null===(W=tx.externalAuthConfig)||void 0===W?void 0:W.type)||"unknown",")."]}),(0,S.jsx)("br",{}),(0,S.jsx)("br",{}),(0,S.jsx)("span",{className:"inline-flex items-center justify-center gap-2",children:(0,S.jsx)(A.cC,{id:"cQKduU"})}),(0,S.jsx)("br",{}),(0,S.jsx)("br",{}),(0,S.jsx)(A.cC,{id:"xZ40r1"}),(0,S.jsx)("br",{}),(0,S.jsx)("br",{})]}),(0,S.jsxs)("details",{className:"max-w-lg mx-auto space-y-2",children:[(0,S.jsx)("summary",{className:"text-gray-500",children:(0,S.jsx)("span",{className:"hover:underline cursor-pointer font-semibold",children:(0,S.jsx)(A.cC,{id:"dxFcof"})})}),(0,S.jsxs)("div",{className:"w-full space-y-2 text-black",children:[(0,S.jsx)("div",{className:"font-semibold text-sm",children:null===(Q=tx.externalAuthError)||void 0===Q?void 0:Q.message}),null!==(J=tx.externalAuthError)&&void 0!==J&&J.endpoint?(0,S.jsxs)("div",{className:"text-xs font-semibold tracking-wide flex items-center justify-start gap-2",children:[(0,S.jsx)("div",{className:"w-2 h-2 bg-red-500 rounded-full",children:(0,S.jsx)("div",{className:"w-2 h-2 bg-red-500 rounded-full animate-ping"})}),(0,S.jsxs)("div",{children:[null===($=tx.externalAuthError)||void 0===$?void 0:$.endpoint," (",null===(ee=tx.externalAuthError)||void 0===ee?void 0:ee.status,")"]})]}):null,(0,S.jsx)("pre",{className:"bg-gray-200 font-mono overflow-auto max-h-[200px] text-xs p-2",children:null===(en=tx.externalAuthError)||void 0===en?void 0:en.reason}),null!==(es=tx.externalAuthError)&&void 0!==es&&es.authCode?(0,S.jsxs)("div",{className:"text-xs font-semibold tracking-wide flex items-center justify-start gap-2",children:[(0,S.jsx)("span",{className:"flex-shrink-0",children:"Your Auth Code: "}),(0,S.jsx)("code",{className:"overflow-auto p-1 bg-gray-200",children:null===(er=tx.externalAuthError)||void 0===er?void 0:er.authCode})]}):null]})]}),(null===(ea=tx.externalAuthConfig)||void 0===ea?void 0:ea.type)==="setapp"?(0,S.jsxs)("div",{className:"p-4 text-center max-w-lg mx-auto space-y-2",children:[(0,S.jsx)("div",{className:"text-xs text-gray-500 my-4",children:"This is a temporary error with Setapp authentication. If it takes too long, you can still use TypingMind without the free models from Setapp."}),(0,S.jsxs)("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:[(0,S.jsx)("button",{onClick:function(e){e.currentTarget.disabled=!0,setTimeout(function(){var e;null===(e=window.webkit)||void 0===e||null===(e=e.messageHandlers)||void 0===e||null===(e=e.TypingMindMacApp)||void 0===e||e.postMessage("SETAPP_FORCE_RELOAD"),setTimeout(function(){var e;null===(e=window.webkit)||void 0===e||null===(e=e.messageHandlers)||void 0===e||null===(e=e.TypingMindMacApp)||void 0===e||e.postMessage("SETAPP_REFRESH_TOKEN_FAILED")},3e3)},100)},type:"submit",className:"inline-flex items-center px-4 py-2 border border-transparent text-base font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 gap-2",children:(0,S.jsx)("span",{children:"Try Reload App"})}),(0,S.jsx)("button",{onClick:function(e){e.currentTarget.disabled=!0,setTimeout(function(){var e=new URL(window.location.href);e.searchParams.set("fallbackAnonymous","1"),window.location.href=e.toString()},100)},type:"submit",className:"inline-flex items-center px-4 py-2 border border-transparent text-base font-medium rounded-md shadow-sm text-gray-800 bg-gray-50 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-300 disabled:text-gray-500 gap-2",children:(0,S.jsx)("span",{children:" → Use TypingMind without free Setapp models"})})]})]}):null]}):tx.externalAuthConfig&&(null===(F=tx.externalAuthConfig)||void 0===F?void 0:F.type)==="setapp"&&!e6?(0,S.jsx)("div",{className:"flex items-center justify-center p-4 min-h-screen",children:(0,S.jsxs)("div",{className:"font-semibold text-center",children:[(0,S.jsx)(A.cC,{id:"DDRhQm"}),(0,S.jsx)("br",{}),(0,S.jsx)("br",{}),(0,S.jsx)(A.cC,{id:"4dbClF"}),(0,S.jsx)("br",{}),(0,S.jsx)("br",{}),(0,S.jsx)(A.cC,{id:"FU00DH"})]})}):n4?(0,S.jsxs)("div",{className:"flex items-center justify-center p-6 min-h-screen bg-gray-100 flex-col gap-4",children:[(0,S.jsx)("div",{className:"font-medium text-center text-gray-700",children:"Sorry, your browser does not support embeded content. (Third-party cookies are disabled)"}),(0,S.jsx)("button",{onClick:function(){window.open(window.location.href,"TypingMind","width=".concat(window.innerWidth,",height=").concat(window.innerHeight))},className:"font-medium text-center text-blue-500 hover:underline text-sm",children:"Open in new Popup"}),(0,S.jsx)("button",{onClick:function(){window.open(window.location.href,"_blank")},className:"font-medium text-center text-blue-500 hover:underline text-sm",children:"Open in new Tab"})]}):n6?(0,S.jsxs)("div",{className:"flex items-center justify-center p-6 min-h-screen bg-gray-100 flex-col gap-4",children:[(0,S.jsx)("div",{className:"font-medium text-center text-gray-700 max-w-md mx-auto",children:'The app must be deployed on an server with HTTPS protocol or on a "localhost" hostname. Please update your server settings and reload the app.'}),(0,S.jsxs)("div",{className:"font-medium text-center text-gray-700 max-w-md mx-auto",children:[(0,S.jsxs)("div",{children:['Current protocol: "',window.location.protocol,'"']}),(0,S.jsxs)("div",{children:['Current hostname: "',window.location.hostname,'"']})]})]}):tx.loginRequired?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(oz,{hostConfig:tx}),(0,S.jsx)(hQ,{hostConfig:tx})]}):(0,S.jsxs)(Z,{value:{serverHostConfig:eo,licensePayload:tA,userCanUse:r3,lastVerifiedToken:tK,decryptedApiKey:ek,userDataStoreRef:ed},children:[tx.themeSettings?(0,S.jsx)(oU(),{children:(0,S.jsx)("style",{children:"custom"!==tx.themeSettings.selected?function(e){if(!e||"default"===e)return"";if(["green","blue","purple"].includes(e)){var t="#211b2f",n="#373244",s="#8c63f7",r="#9067f812",a="rgb(126, 34, 206)",i="#2f2e33",o="#84838d",l="#2E2055FF",c="#9570f8",d="#795bc7",u="#f8f6fb",m="#e59dfe",p="#5b02cd",h="rgba(117, 89, 197, 0.6)",g="rgb(80, 35, 217)",f="rgb(217, 35, 189)";return"green"===e?(t="#212b19",n="#37402f",s="#7fba02",r="#9dfb5514",a="#66950A",i="#2f2e33",o="#84838d",l="#293C0B",c="#7dc845",d="#6EAF41",u="#f8f6fb",m="#FBD46B",p="#43672D",h="rgba(125, 200, 69, 0.35)",g="#16a085",f="#f4d03f"):"blue"===e&&(t="#1d2526",n="#343b3c",s="#16b3d7",r="rgba(22, 179, 215, 0.0881)",a="#128EAB",i="#2f2e33",o="#84838d",l="#0F4B59",c="#19b4d7",d="#1694B3",u="#f8f6fb",m="rgb(219, 115, 249)",p="#188FB5",h="#19b4d745",g="#199DC7",f="#CC6DEA"),":root {\n --dark-bg: ".concat(t,";\n --dark-hover: ").concat(n,";\n --user-msg-bg: ").concat(s,";\n --hover-overlay: ").concat(r,";\n --border-outline: ").concat(a,";\n --text-dark: ").concat(i,";\n --text-light: ").concat(o,";\n --side-bar-bg: ").concat(l,";\n --side-bar-btn: ").concat(c,";\n --side-bar-hover: ").concat(d,";\n --placeholder-text: ").concat(u,";\n --gradient-stop-1: ").concat(m,";\n --gradient-stop-2: ").concat(p,";\n --chat-item-bg: ").concat(h,";\n --brand-name-gradient-stop-1: ").concat(g,";\n --brand-name-gradient-stop-2: ").concat(f,";\n --dark-btn-bg: ").concat("rgb(24 24 27)",";\n --light-bg: ").concat(s+"40","\n }\n .dark body {\n background: var(--dark-bg) !important;\n }\n .dark .custom-theme [data-element-id='chat-space-background'] {\n background: var(--dark-bg);\n }\n .dark .custom-theme [data-element-id='chat-space-end-part'] {\n background: var(--dark-bg);\n }\n .dark .custom-theme [data-element-id='chat-space-beginning-part'] {\n background: var(--dark-bg);\n }\n .dark .custom-theme [data-element-id='width-adjust-bar'] {\n background: var(--dark-bg);\n }\n .dark .custom-theme [data-element-id='width-adjust-bar']:hover {\n background: var(--dark-hover);\n color: white;\n }\n .custom-theme [data-element-id='user-message'] {\n background: var(--user-msg-bg);\n color: white;\n }\n .custom-theme [data-element-id='user-message']::selection {\n background: var(--dark-bg);\n }\n .custom-theme [data-element-id='ai-response'] {\n background: var(--dark-hover);\n padding: 0.5rem 1rem;\n color: white;\n border-radius: 12px;\n }\n .custom-theme [data-element-id='response-block']:hover {\n background: var(--hover-overlay);\n }\n .dark .custom-theme [data-element-id='response-block']:hover {\n background: var(--hover-overlay);\n }\n .custom-theme [data-element-id='model-setting-button'] {\n background: radial-gradient(\n circle at 10% 20%,\n var(--gradient-stop-1) 0%,\n var(--gradient-stop-2) 72.4%\n );\n color: white;\n transition: background 0.2s ease;\n }\n .custom-theme [data-element-id='model-setting-button']:focus {\n outline: none;\n box-shadow: 0 0 0 1.6px var(--border-outline);\n }\n .custom-theme [data-element-id='model-setting-button']:hover {\n background: radial-gradient(\n circle at 10% 20%,\n var(--gradient-stop-2) 0%,\n var(--gradient-stop-1) 72.4%\n );\n }\n .dark .custom-theme [data-element-id='model-setting-button'] {\n color: white;\n }\n .custom-theme data-element-id='model-setting-info' {\n }\n .custom-theme [data-element-id='chat-input-textbox']:focus {\n outline: none;\n box-shadow: 0 0 0 1.6px var(--border-outline);\n }\n .dark .custom-theme [data-element-id='chat-input-textbox'] {\n background: var(--dark-hover);\n }\n .dark .custom-theme [data-element-id='chat-input-textbox']:focus {\n outline: none;\n box-shadow: 0 0 0 1.6px var(--border-outline);\n }\n .custom-theme [data-element-id='current-chat-title'] {\n color: var(--text-dark);\n }\n .custom-theme [data-element-id='current-chat-info'] {\n color: var(--text-light);\n }\n .custom-theme [data-element-id='brand-icon'] {\n border-radius: 50%;\n width: 40px;\n height: 40px;\n }\n .custom-theme [data-element-id='brand-name'] {\n background: linear-gradient(\n 109.6deg,\n var(--brand-name-gradient-stop-1) 11.2%,\n var(--brand-name-gradient-stop-2) 91.1%\n );\n -webkit-background-clip: text;\n -webkit-text-fill-color: transparent;\n font-weight: 700;\n }\n .custom-theme [data-element-id='brand-tagline'] {\n color: var(--text-light);\n }\n .dark .custom-theme [data-element-id='brand-tagline'] {\n color: var(--text-light);\n }\n .custom-theme [data-element-id='current-character'] {\n color: var(--border-outline);\n }\n .dark .custom-theme [data-element-id='current-character'] {\n background: var(--hover-overlay);\n color: var(--user-msg-bg);\n }\n .custom-theme [data-element-id='current-character-description'] {\n }\n .custom-theme [data-element-id='regenerate-button']:hover {\n background: white;\n color: var(--dark-hover);\n border: solid 1px var(--dark-hover);\n }\n .custom-theme [data-element-id='regenerate-button'] {\n background: white;\n color: var(--user-msg-bg);\n border: solid 1px var(--user-msg-bg);\n }\n .dark .custom-theme [data-element-id='regenerate-button'] {\n background: var(--dark-btn-bg);\n color: var(--user-msg-bg);\n border: solid 1px var(--user-msg-bg);\n }\n .dark .custom-theme [data-element-id='regenerate-button']:hover {\n background: var(--user-msg-bg);\n color: white;\n border: solid 1px var(--user-msg-bg);\n }\n .custom-theme [data-element-id='share-button']:hover {\n background: white;\n color: var(--dark-hover);\n border: solid 1px var(--dark-hover);\n }\n .custom-theme [data-element-id='share-button'] {\n background: white;\n color: var(--user-msg-bg);\n border: solid 1px var(--user-msg-bg);\n }\n .dark .custom-theme [data-element-id='share-button'] {\n background: var(--dark-btn-bg);\n color: var(--user-msg-bg);\n border: solid 1px var(--user-msg-bg);\n }\n .dark .custom-theme [data-element-id='share-button']:hover {\n background: var(--user-msg-bg);\n color: white;\n border: solid 1px var(--user-msg-bg);\n }\n .custom-theme #elements-in-action-buttons [data-element-id='prompt-library-button']:hover {\n background: white;\n color: var(--dark-hover);\n border: solid 1px var(--dark-hover);\n }\n .custom-theme #elements-in-action-buttons [data-element-id='prompt-library-button'] {\n background: white;\n color: var(--user-msg-bg);\n border: solid 1px var(--user-msg-bg);\n }\n .dark .custom-theme #elements-in-action-buttons [data-element-id='prompt-library-button'] {\n background: var(--dark-btn-bg);\n color: var(--user-msg-bg);\n border: solid 1px var(--user-msg-bg);\n }\n .dark .custom-theme #elements-in-action-buttons [data-element-id='prompt-library-button']:hover {\n background: var(--user-msg-bg);\n color: white;\n border: solid 1px var(--user-msg-bg);\n }\n .custom-theme [data-element-id='prompt-library-button']:hover {\n background: white;\n color: var(--dark-hover);\n border: solid 1px var(--dark-hover);\n }\n .custom-theme [data-element-id='prompt-library-button'] {\n background: white;\n color: var(--user-msg-bg);\n border: solid 1px var(--user-msg-bg);\n }\n .dark .custom-theme [data-element-id='prompt-library-button'] {\n background: var(--dark-btn-bg);\n color: var(--user-msg-bg);\n border: solid 1px var(--user-msg-bg);\n }\n .dark .custom-theme [data-element-id='prompt-library-button']:hover {\n background: var(--user-msg-bg);\n color: white;\n border: solid 1px var(--user-msg-bg);\n }\n .custom-theme [data-element-id='available-prompts-count'] {\n color: var(--text-light);\n }\n .dark .custom-theme [data-element-id='available-prompts-count'] {\n color: rgb(226 232 240);\n }\n .custom-theme [data-element-id='new-chat-button']:hover {\n background: white;\n color: var(--dark-hover);\n border: solid 1px var(--dark-hover);\n }\n .custom-theme [data-element-id='new-chat-button'] {\n background: white;\n color: var(--user-msg-bg);\n border: solid 1px var(--user-msg-bg);\n }\n .dark .custom-theme [data-element-id='new-chat-button'] {\n background: var(--dark-btn-bg);\n color: var(--user-msg-bg);\n border: solid 1px var(--user-msg-bg);\n }\n .dark .custom-theme [data-element-id='new-chat-button']:hover {\n background: var(--user-msg-bg);\n color: white;\n border: solid 1px var(--user-msg-bg);\n }\n .custom-theme [data-element-id='reset-chat-button']:hover {\n background: white;\n color: var(--dark-hover);\n border: solid 1px var(--dark-hover);\n }\n .custom-theme [data-element-id='reset-chat-button'] {\n background: white;\n color: var(--user-msg-bg);\n border: solid 1px var(--user-msg-bg);\n }\n .dark .custom-theme [data-element-id='reset-chat-button'] {\n background: var(--dark-btn-bg);\n color: var(--user-msg-bg);\n border: solid 1px var(--user-msg-bg);\n }\n .dark .custom-theme [data-element-id='reset-chat-button']:hover {\n background: var(--user-msg-bg);\n color: white;\n border: solid 1px var(--user-msg-bg);\n }\n .custom-theme [data-element-id='list-more-button']:hover {\n background: white;\n color: var(--dark-hover);\n border: solid 1px var(--dark-hover);\n }\n .custom-theme [data-element-id='list-more-button'] {\n background: white;\n color: var(--user-msg-bg);\n border: solid 1px var(--user-msg-bg);\n }\n .dark .custom-theme [data-element-id='list-more-button'] {\n background: var(--dark-btn-bg);\n color: var(--user-msg-bg);\n border: solid 1px var(--user-msg-bg);\n }\n .dark .custom-theme [data-element-id='list-more-button']:hover {\n background: var(--user-msg-bg);\n color: white;\n border: solid 1px var(--user-msg-bg);\n }\n .custom-theme [data-element-id='voice-input-button'] {\n background: radial-gradient(\n circle at 10% 20%,\n var(--gradient-stop-1) 0%,\n var(--gradient-stop-2) 72.4%\n );\n color: white !important;\n transition: background 1s ease;\n margin-left: 4px;\n }\n .custom-theme [data-element-id='voice-input-button']:focus {\n outline: none;\n box-shadow: 0 0 0 1.6px rgb(var(--border-outline));\n }\n .custom-theme [data-element-id='voice-input-button']:hover {\n background: radial-gradient(\n circle at 10% 20%,\n var(--gradient-stop-2) 0%,\n var(--gradient-stop-1) 72.4%\n );\n }\n .dark .custom-theme [data-element-id='voice-input-button'] {\n color: white;\n }\n .custom-theme [data-element-id='send-button'] {\n background: var(--user-msg-bg);\n }\n .custom-theme [data-element-id='send-button']:hover {\n background: var(--border-outline);\n }\n .custom-theme [data-element-id='select-character-button']:hover {\n background: white;\n color: var(--dark-hover);\n border: solid 1px var(--dark-hover);\n }\n .custom-theme [data-element-id='select-character-button'] {\n background: white;\n color: var(--user-msg-bg);\n border: solid 1px var(--user-msg-bg);\n }\n .dark .custom-theme [data-element-id='select-character-button']:hover {\n background: var(--user-msg-bg);\n color: white;\n }\n .dark .custom-theme [data-element-id='select-character-button'] {\n background: var(--dark-btn-bg);\n color: var(--user-msg-bg);\n border: solid 1px var(--user-msg-bg);\n transition: background 0.5s ease;\n }\n .custom-theme [data-element-id='available-characters-count'] {\n color: var(--text-light);\n }\n .dark .custom-theme [data-element-id='available-characters-count'] {\n color: rgb(226 232 240);\n }\n .custom-theme [data-element-id='upload-document-button']:hover {\n background: transparent;\n color: var(--dark-hover);\n border: solid 1px var(--dark-hover);\n }\n .custom-theme [data-element-id='upload-document-button'] {\n background: transparent;\n color: var(--user-msg-bg);\n border: solid 1px var(--user-msg-bg);\n transition: background 0.2s ease;\n }\n .dark .custom-theme [data-element-id='upload-document-button']:hover {\n background: var(--user-msg-bg);\n color: white;\n }\n .dark .custom-theme [data-element-id='upload-document-button'] {\n background: transparent;\n color: var(--user-msg-bg);\n border: solid 1px var(--user-msg-bg);\n transition: background 0.2s ease;\n }\n .custom-theme [data-element-id='document-type'] {\n color: var(--text-light);\n }\n .custom-theme [data-element-id='user-profile-button'] {\n }\n .custom-theme [data-element-id='user-profile-image'] {\n }\n .custom-theme [data-element-id='model-setting-button-main'] {\n }\n .custom-theme [data-element-id='temperature-info'] {\n }\n .custom-theme [data-element-id='plugins-button'] {\n }\n .custom-theme [data-element-id='plugins-info-button'] {\n }\n .custom-theme [data-element-id='plugins-switch-enabled'] {\n background: var(--user-msg-bg);\n }\n .custom-theme [data-element-id='plugins-switch-enabled']:focus {\n outline: none;\n box-shadow: 0 0 0 2px white, 0 0 0 4px var(--user-msg-bg);\n }\n .custom-theme [data-element-id='plugins-switch-disabled']:focus {\n box-shadow: 0 0 0 2px white, 0 0 0 4px var(--user-msg-bg);\n }\n .custom-theme [data-element-id='side-bar-background'] {\n background: var(--side-bar-bg);\n }\n .custom-theme [data-element-id='sidebar-beginning-part'] {\n background: var(--side-bar-bg);\n }\n .custom-theme [data-element-id='new-chat-button-in-side-bar'] {\n background: var(--side-bar-btn);\n transition: background 0.2s ease;\n }\n .custom-theme [data-element-id='new-chat-button-in-side-bar']:hover {\n background: var(--side-bar-hover);\n }\n .custom-theme [data-element-id='new-chat-button-in-side-bar'] * {\n color: white;\n }\n .custom-theme [data-element-id='settings-button'],\n .custom-theme [data-element-id='nav-user-profile-button'] {\n background: transparent;\n transition: background 0.2s ease;\n }\n .custom-theme [data-element-id='settings-button']:hover,\n .custom-theme [data-element-id='nav-user-profile-button']:hover {\n background: var(--side-bar-hover);\n }\n .custom-theme [data-element-id='settings-button'] *,\n .custom-theme [data-element-id='nav-user-profile-button'] * {\n color: white;\n }\n .custom-theme [data-element-id='selected-chat-item'] {\n background: var(--chat-item-bg);\n }\n .custom-theme [data-element-id='custom-chat-item']:hover {\n background: var(--chat-item-bg);\n }\n .custom-theme [data-element-id='side-bar-footer'] {\n background: var(--chat-item-bg);\n }\n .custom-theme [data-element-id='search-chats-bar'] {\n background: var(--side-bar-bg);\n border: solid 0.5px gray;\n }\n .custom-theme [data-element-id='search-chats-bar']::placeholder {\n color: var(--placeholder-text);\n font-size: 14px;\n }\n .custom-theme [data-element-id='search-chats-bar']:focus {\n outline: none;\n border: solid 0.5px var(--placeholder-text);\n box-shadow: 0 0 0 1px var(--placeholder-text);\n }\n .custom-theme [data-element-id='select-chats-symbol'],\n .custom-theme [data-element-id='create-new-folder'],\n .custom-theme [data-element-id='tag-search-button'] {\n color: var(--placeholder-text);\n }\n .dark .custom-theme [data-element-id='select-chats-symbol'],\n .dark .custom-theme [data-element-id='create-new-folder'],\n .dark .custom-theme [data-element-id='tag-search-button'] {\n color: var(--placeholder-text);\n }\n .custom-theme [data-element-id='select-chats-button'] {\n background: var(--side-bar-btn);\n transition: background 0.2s ease;\n }\n .custom-theme [data-element-id='select-chats-button']:hover {\n background: var(--side-bar-hover);\n }\n .custom-theme [data-element-id='select-chats-button'] * {\n color: white;\n }\n .custom-theme [data-element-id='language-button'] {\n background: var(--side-bar-bg);\n }\n .custom-theme [data-element-id='language-button']:hover {\n background: var(--side-bar-hover);\n }\n .custom-theme [data-element-id='dark-mode-button'] {\n background: var(--side-bar-bg);\n }\n .custom-theme [data-element-id='dark-mode-button']:hover {\n background: var(--side-bar-hover);\n }\n .custom-theme [data-element-id='sound-mode-button'] {\n background: var(--side-bar-bg);\n }\n .custom-theme [data-element-id='sound-mode-button']:hover {\n background: var(--side-bar-hover);\n }\n .custom-theme [data-element-id='cloud-button'] {\n background: var(--side-bar-bg);\n }\n .custom-theme [data-element-id='cloud-button']:hover {\n background: var(--side-bar-hover);\n }\n .custom-theme [data-element-id='login-button'] {\n background: var(--side-bar-btn);\n transition: background 0.2s ease;\n }\n .custom-theme [data-element-id='login-button']:hover {\n background: var(--side-bar-hover);\n }\n .custom-theme [data-element-id='login-button'] * {\n color: white;\n }\n .custom-theme [data-element-id='replace-only-button'] {\n }\n .custom-theme [data-element-id='cancel-edit-message-button'] {\n }\n .custom-theme [data-element-id='clear-context-button']:hover {\n background: white;\n color: var(--dark-hover);\n border: solid 1px var(--dark-hover);\n }\n .custom-theme [data-element-id='clear-context-button'] {\n background: white;\n color: var(--user-msg-bg);\n border: solid 1px var(--user-msg-bg);\n }\n .dark .custom-theme [data-element-id='clear-context-button'] {\n background: var(--dark-btn-bg);\n color: var(--user-msg-bg);\n border: solid 1px var(--user-msg-bg);\n }\n .dark .custom-theme [data-element-id='clear-context-button']:hover {\n background: var(--user-msg-bg);\n color: white;\n border: solid 1px var(--user-msg-bg);\n }\n .custom-theme [data-element-id='pop-up-modal'] {\n }\n .custom-theme [data-element-id='prompt-library-modal-title'] {\n color: var(--side-bar-bg);\n }\n .dark .custom-theme [data-element-id='prompt-library-modal-title'] {\n color: var(--user-msg-bg);\n }\n .custom-theme [data-element-id='prompt-library-modal-description'] {\n }\n .custom-theme [data-element-id='prompt-library-tabs'] {\n }\n .custom-theme [data-element-id='prompt-library-tabs'].selected {\n color: var(--user-msg-bg);\n border-bottom: 2px solid var(--user-msg-bg);\n }\n .dark .custom-theme [data-element-id='prompt-library-tabs'].selected {\n color: var(--user-msg-bg);\n border-bottom: solid var(--user-msg-bg);\n }\n .custom-theme [data-element-id='prompt-library-num-prompts'].selected {\n background: var(--light-bg);\n color: var(--user-msg-bg);\n }\n .custom-theme [data-element-id='search-your-prompts'] {\n }\n .custom-theme [data-element-id='search-your-prompts']:focus {\n border-color: var(--border-outline);\n box-shadow: 0 0 0 1.6px var(--border-outline);\n }\n .dark .custom-theme [data-element-id='search-your-prompts']:focus {\n border-color: var(--border-outline);\n box-shadow: 0 0 0 1.6px var(--border-outline);\n }\n .custom-theme [data-element-id='add-prompt-button'] {\n color: var(--user-msg-bg);\n }\n .custom-theme [data-element-id='add-new-prompt-title'] {\n }\n .custom-theme [data-element-id='add-new-prompt-input']:focus {\n border-color: var(--border-outline);\n box-shadow: 0 0 0 1.6px var(--border-outline);\n }\n .dark .custom-theme [data-element-id='add-new-prompt-input']:focus {\n border-color: var(--border-outline);\n box-shadow: 0 0 0 1.6px var(--border-outline);\n }\n .custom-theme [data-element-id='add-new-prompt-description-input']:focus {\n border-color: var(--border-outline);\n box-shadow: 0 0 0 1.6px var(--border-outline);\n }\n .dark .custom-theme [data-element-id='add-new-prompt-description-input']:focus {\n border-color: var(--border-outline);\n box-shadow: 0 0 0 1.6px var(--border-outline);\n }\n .custom-theme [data-element-id='add-new-prompt-tags-input'] input:focus {\n border-color: var(--border-outline) !important;\n box-shadow: 0 0 0 1.6px var(--border-outline);\n }\n .dark .custom-theme [data-element-id='add-new-prompt-tags-input'] input:focus {\n border-color: var(--border-outline) !important;\n box-shadow: 0 0 0 1.6px var(--border-outline);\n }\n .custom-theme [data-element-id='add-new-prompt-title-input']:focus {\n border-color: var(--border-outline);\n box-shadow: 0 0 0 1.6px var(--border-outline);\n }\n .dark .custom-theme [data-element-id='add-new-prompt-title-input']:focus {\n border-color: var(--border-outline);\n box-shadow: 0 0 0 1.6px var(--border-outline);\n }\n .custom-theme [data-element-id='add-new-prompt-button'] {\n background: var(--user-msg-bg);\n }\n .custom-theme [data-element-id='add-new-prompt-button']:hover {\n background: var(--side-bar-bg);\n }\n .custom-theme [data-element-id='prompt-library-one-prompt-block'] {\n }\n .custom-theme [data-element-id='prompt-library-use-button'] {\n background: var(--user-msg-bg);\n transition: background 0.2s ease;\n }\n .custom-theme [data-element-id='prompt-library-use-button']:hover {\n background: var(--side-bar-bg);\n }\n .custom-theme [data-element-id='close-modal-button'] {\n background: var(--user-msg-bg);\n transition: background 0.2s ease;\n }\n .custom-theme [data-element-id='close-modal-button']:hover {\n background: var(--side-bar-bg);\n }\n .custom-theme [data-element-id='update-prompt-button'] {\n background: var(--user-msg-bg);\n }\n .custom-theme [data-element-id='update-prompt-button']:hover {\n background: var(--side-bar-bg);\n }\n .custom-theme [data-element-id='select-characters-modal-title'] {\n color: var(--side-bar-bg);\n }\n .dark .custom-theme [data-element-id='select-characters-modal-title'] {\n color: var(--user-msg-bg);\n }\n .custom-theme [data-element-id='ai-characters'].selected {\n background: var(--light-bg);\n border: solid var(--side-bar-bg);\n color: var(--side-bar-bg);\n }\n .custom-theme [data-element-id='ai-characters'].selected:hover {\n background: var(--light-bg);\n }\n .dark .custom-theme [data-element-id='ai-characters'].selected {\n background: var(--light-bg);\n border: solid var(--user-msg-bg);\n color: white;\n }\n .dark .custom-theme [data-element-id='ai-characters'].selected:hover {\n background: var(--light-bg);\n }\n .custom-theme [data-element-id='search-characters']:focus {\n border-color: var(--border-outline);\n box-shadow: 0 0 0 1.6px var(--border-outline);\n }\n .dark .custom-theme [data-element-id='search-characters']:focus {\n border-color: var(--border-outline);\n box-shadow: 0 0 0 1.6px var(--border-outline);\n }\n .custom-theme [data-element-id='create-chatacter'] {\n background: var(--user-msg-bg);\n transition: background 0.2s ease;\n }\n .custom-theme [data-element-id='create-chatacter']:hover {\n background: var(--side-bar-bg);\n }\n .custom-theme [data-element-id='one-ai-character-block'] {\n transition: all 0.2s ease-in-out;\n }\n .custom-theme [data-element-id='one-ai-character-block']:hover {\n box-shadow: 0 0 0 3px var(--light-bg);\n }\n .custom-theme [data-element-id='add-ai-character'] {\n color: var(--user-msg-bg);\n transition: all 0.2s ease-in-out;\n }\n .custom-theme [data-element-id='add-ai-character']:hover {\n color: var(--side-bar-bg);\n }\n .custom-theme [data-element-id='profile-setting-save-button'] {\n background: var(--user-msg-bg);\n transition: all 0.2s ease-in-out;\n }\n .custom-theme [data-element-id='profile-setting-save-button']:hover {\n background: var(--side-bar-bg);\n }\n .custom-theme [data-element-id='ai-characters-title-input']:focus {\n border-color: var(--border-outline);\n box-shadow: 0 0 0 1.6px var(--border-outline);\n }\n .dark .custom-theme [data-element-id='ai-characters-title-input']:focus {\n border-color: var(--border-outline);\n box-shadow: 0 0 0 1.6px var(--border-outline);\n }\n .custom-theme [data-element-id='ai-characters-description-input']:focus {\n border-color: var(--border-outline);\n box-shadow: 0 0 0 1.6px var(--border-outline);\n }\n .dark .custom-theme [data-element-id='ai-characters-description-input']:focus {\n border-color: var(--border-outline);\n box-shadow: 0 0 0 1.6px var(--border-outline);\n }\n .custom-theme [data-element-id='ai-characters-pictureurl-input']:focus {\n border-color: var(--border-outline);\n box-shadow: 0 0 0 1.6px var(--border-outline);\n }\n .dark .custom-theme [data-element-id='ai-characters-pictureurl-input']:focus {\n border-color: var(--border-outline);\n box-shadow: 0 0 0 1.6px var(--border-outline);\n }\n .custom-theme [data-element-id='ai-characters-system-instruction-input']:focus {\n border-color: var(--border-outline);\n box-shadow: 0 0 0 1.6px var(--border-outline);\n }\n .dark .custom-theme [data-element-id='ai-characters-system-instruction-input']:focus {\n border-color: var(--border-outline);\n box-shadow: 0 0 0 1.6px var(--border-outline);\n }\n .custom-theme [data-element-id='ai-characters-welcome-message-input']:focus {\n border-color: var(--border-outline);\n box-shadow: 0 0 0 1.6px var(--border-outline);\n }\n .dark .custom-theme [data-element-id='ai-characters-welcome-message-input']:focus {\n border-color: var(--border-outline);\n box-shadow: 0 0 0 1.6px var(--border-outline);\n }\n .custom-theme [data-element-id='ai-characters-add-training-examples'] {\n color: var(--user-msg-bg);\n }\n .custom-theme [data-element-id='one-training-example-block'] textarea:focus {\n border-color: var(--border-outline);\n box-shadow: 0 0 0 1.6px var(--border-outline);\n }\n .custom-theme [data-element-id='save-ai-character-button'] {\n background: var(--user-msg-bg);\n transition: all 0.2s ease-in-out;\n }\n .custom-theme [data-element-id='save-ai-character-button']:hover {\n background: var(--side-bar-bg);\n }\n .custom-theme [data-element-id='profile-setting-image-url']:focus {\n border-color: var(--border-outline);\n box-shadow: 0 0 0 1.6px var(--border-outline);\n }\n .custom-theme [data-element-id='profile-setting-information-input']:focus {\n border-color: var(--border-outline);\n box-shadow: 0 0 0 1.6px var(--border-outline);\n }\n .custom-theme [data-element-id='profile-setting-save-button'] {\n background: var(--user-msg-bg);\n transition: all 0.2s ease-in-out;\n }\n .custom-theme [data-element-id='profile-setting-save-button']:hover {\n background: var(--side-bar-bg);\n }\n .custom-theme [data-element-id='new-system-instruction']:focus {\n border-color: var(--border-outline);\n box-shadow: 0 0 0 1.6px var(--border-outline);\n }\n .custom-theme [data-element-id='save-model-settings-button'] {\n background: var(--user-msg-bg);\n transition: all 0.2s ease-in-out;\n }\n .custom-theme [data-element-id='save-model-settings-button']:hover {\n background: var(--side-bar-bg);\n }\n .custom-theme [data-element-id='create-new-plugin-button'] {\n color: var(--user-msg-bg);\n transition: all 0.2s ease-in-out;\n }\n .custom-theme [data-element-id='create-new-plugin-button']:hover {\n color: var(--side-bar-bg);\n }\n .custom-theme [data-element-id='import-plugin-button'] {\n color: var(--user-msg-bg);\n transition: all 0.2s ease-in-out;\n }\n .custom-theme [data-element-id='import-plugin-button']:hover {\n color: var(--side-bar-bg);\n }\n .dark .custom-theme [data-element-id='create-new-plugin-button']:hover {\n color: var(--chat-item-bg);\n }\n .dark .custom-theme [data-element-id='import-plugin-button']:hover {\n color: var(--chat-item-bg);\n }\n .custom-theme [data-element-id='plugin-item-setting-tab'].selected {\n color: var(--user-msg-bg);\n transition: all 0.2s ease-in-out;\n }\n .custom-theme [data-element-id='plugin-item-setting-tab'].selected:hover {\n color: var(--side-bar-bg);\n }\n .dark .custom-theme [data-element-id='plugin-item-setting-tab'].selected {\n color: var(--user-msg-bg);\n transition: all 0.2s ease-in-out;\n }\n .dark .custom-theme [data-element-id='plugin-item-setting-tab'].selected:hover {\n color: var(--side-bar-bg);\n }\n .custom-theme [data-element-id='plugin-url-input']:focus {\n border-color: var(--border-outline) !important;\n box-shadow: 0 0 0 1.6px var(--border-outline);\n }\n .custom-theme [data-element-id='continue-import-plugin-button'] {\n background: var(--user-msg-bg);\n transition: all 0.2s ease-in-out;\n }\n .custom-theme [data-element-id='continue-import-plugin-button']:hover {\n background: var(--side-bar-bg);\n }\n .custom-theme [data-element-id='chat-folder']:hover {\n background: var(--light-bg);\n }\n .custom-theme [data-element-id='chat-folder']:focus-within {\n background: var(--light-bg);\n }\n .custom-theme [data-element-id='chat-folder'] textarea {\n border-color: var(--border-outline);\n box-shadow: 0 0 0 1.6px var(--border-outline);\n }\n \n .custom-theme [data-element-id='prompt-library-small-button']:hover,\n .custom-theme [data-element-id='output-settings-button']:hover {\n background: transparent;\n color: var(--dark-hover);\n }\n .custom-theme [data-element-id='prompt-library-small-button'],\n .custom-theme [data-element-id='output-settings-button'] {\n background: transparent;\n color: var(--user-msg-bg);\n transition: background 0.5s ease;\n }\n .dark .custom-theme [data-element-id='prompt-library-small-button']:hover,\n .dark .custom-theme [data-element-id='output-settings-button']:hover {\n background: var(--user-msg-bg);\n color: white;\n }\n .dark .custom-theme [data-element-id='prompt-library-small-button'],\n .dark .custom-theme [data-element-id='output-settings-button'] {\n background: transparent;\n color: var(--user-msg-bg);\n transition: background 0.2s ease;\n }\n \n .custom-theme [data-element-id='search-shortcut-button']:hover {\n border: 1px solid var(--user-msg-bg);\n }\n .dark .custom-theme [data-element-id='search-shortcut-button']:hover {\n border: 1px solid var(--user-msg-bg);\n }\n ")}if("citrus-sunset"===e)return":root {\n --light-bg: #f2f2fc;\n --border-color: #d1d5db;\n --main-accent-color: #ed6126;\n --main-accent-hover-color: #c95323;\n --light-accent-color: #ff9750;\n --positive-color: #d9f99d;\n --strong-text-color: #1a2e05;\n --highlight-color: #84cc16;\n --background-darker: #2d2d3c;\n --secondary-bg-color: #f5f7fd;\n --tertiary-bg-color: #3e3e53;\n --dark-hover-color: #14142c;\n --contrast-high-color: #ffad68;\n --contrast-med-color: #945632;\n --contrast-light-color: #a36d56;\n --light-text-color: #a1999d;\n --active-element-color: #5e6774;\n --active-element-hover-color: #fcd9bc;\n --message-background-color: #fc9243;\n --ai-response-color: #d9d9f5;\n --highlight-responsive-color: #293341;\n --bright-highlight-bg-color: #fee7db;\n --pale-highlight-color: #d1d1f4;\n --dark-accent-color: #51516d;\n --positive-accent-color: #a3e635;\n --deep-neutral-color: #3b4451;\n --mid-tone-neutral-color: #484f5c;\n --dark-tone-neutral-color: #2c333f;\n --warm-accent-color: #ee8e50;\n --deep-subdued-color: #323b49;\n --vibrant-accent-color: #bef264;\n --soft-focus-color: #3c3c51;\n --deep-accent-color: #5b21b6;\n --extra-dark-accent-color: #18183d;\n --soft-accent-color: #c4b5fd;\n --vibrant-accent-1-color: #7c3aed;\n --vibrant-accent-2-color: #65a30d;\n --light-neutral-color: #f5f3ff;\n --subdued-accent-color: #333c49;\n }\n body {\n background: var(--light-bg) !important;\n }\n .custom-theme [data-element-id='chat-space-end-part'] {\n background: var(--light-bg);\n }\n .custom-theme [data-element-id='user-profile-button'] {\n background: white;\n border-radius: 20px;\n border: none;\n }\n .dark body {\n background: var(--background-darker) !important;\n }\n .custom-theme [data-element-id='chat-space-beginning-part'] {\n background: var(--secondary-bg-color);\n box-shadow: var(--pale-highlight-color) 0px 1px 2px 0px;\n }\n .dark .custom-theme [data-element-id='chat-space-beginning-part'] {\n box-shadow: var(--dark-accent-color) 0px 1px 2px 0px;\n }\n \n .dark .custom-theme [data-element-id='chat-space-beginning-part'] {\n background: var(--tertiary-bg-color);\n }\n .dark .custom-theme [data-element-id='chat-space-end-part'] {\n background: var(--background-darker);\n }\n .custom-theme [data-element-id='user-profile-image-container'] {\n background: transparent;\n }\n .custom-theme [data-element-id='user-profile-symbol'] {\n fill: var(--light-accent-color);\n }\n .custom-theme [data-element-id='model-setting-button-main'] {\n background: white;\n border-radius: 20px;\n border: none;\n }\n .custom-theme [data-element-id='plugins-button'] {\n background: white;\n border-radius: 20px;\n border: none;\n }\n .dark .custom-theme [data-element-id='user-profile-button'] {\n background: var(--dark-hover-color);\n }\n .dark .custom-theme [data-element-id='user-profile-button']:hover {\n background: var(--dark-hover-color);\n }\n .dark .custom-theme [data-element-id='model-setting-button-main'] {\n background: var(--dark-hover-color);\n }\n .dark .custom-theme [data-element-id='model-setting-button-main']:hover {\n background: var(--dark-hover-color);\n }\n .dark .custom-theme [data-element-id='plugins-button'] {\n background: var(--dark-hover-color);\n }\n .dark .custom-theme [data-element-id='plugins-button']:hover {\n background: var(--dark-hover-color);\n }\n .dark .custom-theme [data-element-id='plugins-button-checkbox-container'] {\n background: var(--dark-hover-color);\n }\n .dark .custom-theme [data-element-id='plugins-info-button'] {\n background: var(--dark-hover-color);\n }\n .dark .custom-theme [data-element-id='plugins-button-checkbox-container']:hover {\n background: var(--dark-hover-color);\n }\n .dark .custom-theme [data-element-id='plugins-info-button']:hover {\n background: var(--dark-hover-color);\n }\n .dark .custom-theme [data-element-id='output-setting-options-container'] select {\n background: var(--background-darker);\n }\n \n .dark .custom-theme [data-element-id='output-setting-options-container'] label {\n background: var(--contrast-high-color) !important;\n color: var(--contrast-med-color) !important;\n }\n \n .custom-theme [data-element-id='plugins-button-checkbox-container'] {\n background: white;\n border-radius: 20px 0 0 20px;\n border: none;\n }\n .custom-theme [data-element-id='plugins-info-button'] {\n background: white;\n border-radius: 0 20px 20px 0;\n border: none;\n }\n .custom-theme [data-element-id='plugins-switch-enabled'] {\n background: var(--main-accent-color);\n }\n .custom-theme [data-element-id='select-character-button'] {\n background: var(--positive-color);\n border-radius: 20px;\n }\n .custom-theme [data-element-id='select-character-button']:hover {\n background: var(--positive-accent-color);\n }\n .custom-theme [data-element-id='select-character-button'] * {\n color: var(--strong-text-color) !important;\n }\n .custom-theme [data-element-id='prompt-library-button'] {\n background: var(--main-accent-color);\n border-radius: 20px;\n }\n .custom-theme [data-element-id='prompt-library-button']:hover {\n background: var(--main-accent-hover-color);\n }\n .custom-theme [data-element-id='prompt-library-button'] * {\n color: white !important;\n }\n .custom-theme [data-element-id='user-profile-title'] {\n color: var(--contrast-light-color);\n }\n .custom-theme [data-element-id='user-profile-description'] {\n color: var(--light-text-color);\n }\n .custom-theme [data-element-id='model-name'] {\n color: var(--contrast-light-color);\n }\n .custom-theme [data-element-id='temperature-info'] {\n color: var(--light-text-color);\n }\n .custom-theme [data-element-id='plugins-title'] {\n color: var(--contrast-light-color);\n }\n .custom-theme [data-element-id='plugins-description'] {\n color: var(--light-text-color);\n }\n .custom-theme [data-element-id='plugins-button']:hover [data-element-id='plugins-sandbox-symbol'] {\n color: var(--highlight-color) !important;\n }\n .custom-theme [data-element-id='brand-name'] {\n color: black;\n font-weight: 800;\n font-size: 20px;\n }\n .custom-theme [data-element-id='brand-icon'] {\n display: none;\n }\n .custom-theme [data-element-id='brand-tagline'] {\n font-size: 15px;\n }\n \n .custom-theme [data-element-id='chat-input-textbox-container'] {\n border-radius: 30px;\n background: white;\n overflow: hidden;\n }\n .custom-theme [data-element-id='search-shortcut-button'] {\n border: none;\n border-right: solid 1px var(--border-color);\n border-radius: 0;\n color: var(--strong-text-color);\n }\n \n .dark .custom-theme [data-element-id='search-shortcut-button'] * {\n color: var(--border-color) !important;\n }\n \n .custom-theme [data-element-id='search-shortcut-button'] * {\n color: var(--strong-text-color) !important;\n }\n .custom-theme [data-element-id='search-shortcut-button']:hover {\n border-right: solid 1px var(--highlight-color);\n }\n .dark .custom-theme [data-element-id='search-shortcut-button']:hover {\n border-right: solid 1px var(--highlight-color);\n }\n .custom-theme [data-element-id='search-shortcut-button']:hover * {\n color: var(--highlight-color) !important;\n }\n .custom-theme [data-element-id='chat-input-textbox'] {\n border-radius: 30px;\n background: white;\n border: solid 2px var(--light-bg);\n }\n \n .dark .custom-theme [data-element-id='chat-input-textbox'] {\n border: solid 2px var(--background-darker);\n }\n .dark .custom-theme [data-element-id='chat-input-textbox']:focus {\n border: solid 2px var(--light-accent-color);\n outline: none;\n box-shadow: none;\n }\n .custom-theme [data-element-id='chat-input-textbox']:focus {\n border: solid 2px var(--light-accent-color);\n outline: none;\n box-shadow: none;\n }\n \n .custom-theme [data-element-id='output-settings-button'],\n .custom-theme [data-element-id='prompt-library-small-button'] * {\n color: var(--main-accent-color) !important;\n }\n .custom-theme [data-element-id='output-settings-button-clicked'] {\n background: var(--main-accent-color);\n }\n .custom-theme [data-element-id='output-language-setting-title'] {\n background: var(--bright-highlight-bg-color);\n color: var(--contrast-light-color);\n border-radius: 20px;\n }\n .custom-theme [data-element-id='output-language-setting-options']:focus {\n box-shadow: 0 0 0 2px var(--contrast-light-color);\n }\n .custom-theme [data-element-id='output-tone-setting-title'] {\n background: var(--bright-highlight-bg-color);\n color: var(--contrast-light-color);\n border-radius: 20px;\n }\n .custom-theme [data-element-id='output-tone-setting-options']:focus {\n box-shadow: 0 0 0 2px var(--contrast-light-color);\n }\n .custom-theme [data-element-id='output-writing-setting-title'] {\n background: var(--bright-highlight-bg-color);\n color: var(--contrast-light-color);\n border-radius: 20px;\n }\n .custom-theme [data-element-id='output-writing-setting-options']:focus {\n box-shadow: 0 0 0 2px var(--contrast-light-color);\n }\n .custom-theme [data-element-id='output-format-setting-title'] {\n background: var(--bright-highlight-bg-color);\n color: var(--contrast-light-color);\n border-radius: 20px;\n }\n .custom-theme [data-element-id='output-format-setting-options']:focus {\n box-shadow: 0 0 0 2px var(--contrast-light-color);\n }\n \n .custom-theme [data-element-id='voice-input-button'] {\n margin-left: 4px;\n }\n \n .custom-theme [data-element-id='voice-input-button'],\n .custom-theme [data-element-id='upload-document-button'] {\n background: var(--contrast-high-color);\n color: var(--contrast-med-color);\n box-shadow: rgba(99, 99, 99, 0.2) 0px 2px 8px 0px;\n }\n .custom-theme [data-element-id='voice-input-button']:hover,\n .custom-theme [data-element-id='upload-document-button']:hover {\n background: var(--active-element-hover-color);\n }\n .dark .custom-theme [data-element-id='voice-input-button'],\n .dark .custom-theme [data-element-id='upload-document-button'] {\n background: var(--contrast-high-color);\n color: var(--contrast-med-color);\n box-shadow: rgba(99, 99, 99, 0.2) 0px 2px 8px 0px;\n }\n .dark .custom-theme [data-element-id='voice-input-button']:hover,\n .dark .custom-theme [data-element-id='upload-document-button']:hover {\n background: var(--active-element-hover-color);\n }\n \n .custom-theme [data-element-id='send-button'] {\n background: var(--main-accent-color);\n }\n .custom-theme [data-element-id='send-button']:hover {\n background: var(--main-accent-hover-color);\n }\n \n .custom-theme [data-element-id='sidebar-beginning-part'] {\n background: var(--active-element-color);\n }\n .custom-theme [data-element-id='new-chat-button-in-side-bar'] {\n background: var(--light-accent-color);\n border-radius: 20px;\n }\n .custom-theme [data-element-id='new-chat-button-in-side-bar'] * {\n color: white !important;\n }\n .custom-theme [data-element-id='new-chat-button-in-side-bar']:hover {\n background: var(--main-accent-color);\n }\n .custom-theme [data-element-id='side-bar-background'] {\n background: var(--active-element-color);\n }\n .custom-theme [data-element-id='sidebar-middle-part'] {\n border-top-left-radius: 20px;\n border-top-right-radius: 23px;\n padding-top: 18px;\n background: linear-gradient(\n to top,\n var(--deep-neutral-color) 0%,\n var(--mid-tone-neutral-color) 100%\n );\n }\n .custom-theme [data-element-id='sidebar-middle-part'] > div {\n margin-left: 10px;\n margin-right: 10px;\n }\n .custom-theme [data-element-id='side-bar-footer'] {\n background: var(--dark-tone-neutral-color);\n }\n .custom-theme [data-element-id='settings-button'] {\n border-radius: 100%;\n aspect-ratio: 1/1;\n width: 2.6rem;\n }\n .custom-theme [data-element-id='settings-button']:hover * {\n color: var(--main-accent-color) !important;\n }\n .custom-theme [data-element-id='settings-button'] * {\n color: var(--warm-accent-color) !important;\n }\n .custom-theme [data-element-id='search-chats-bar'] {\n background: var(--deep-subdued-color);\n border-radius: 20px;\n padding-left: 15px;\n padding-right: 15px;\n }\n .custom-theme [data-element-id='search-chats-bar']:focus {\n box-shadow: 0 0 0 1px var(--contrast-light-color);\n outline: none;\n border-color: var(--contrast-light-color);\n }\n .custom-theme [data-element-id='create-new-folder'],\n .custom-theme [data-element-id='select-chats-symbol'],\n .custom-theme [data-element-id='tag-search-button'] {\n color: var(--vibrant-accent-color);\n }\n .custom-theme [data-element-id='create-new-folder']:hover,\n .custom-theme [data-element-id='select-chats-symbol']:hover,\n .custom-theme [data-element-id='tag-search-button']:hover {\n color: var(--positive-accent-color);\n }\n .dark .custom-theme [data-element-id='create-new-folder'],\n .dark .custom-theme [data-element-id='select-chats-symbol'],\n .dark .custom-theme [data-element-id='tag-search-button'] {\n color: var(--vibrant-accent-color);\n }\n .dark .custom-theme [data-element-id='create-new-folder']:hover,\n .dark .custom-theme [data-element-id='select-chats-symbol'],\n .dark .custom-theme [data-element-id='tag-search-button'] {\n color: var(--positive-accent-color);\n }\n \n .custom-theme [data-element-id='select-chats-button'] {\n background: var(--vibrant-accent-color);\n color: var(--strong-text-color) !important;\n }\n .custom-theme [data-element-id='select-chats-button']:hover {\n background: var(--positive-accent-color);\n }\n .custom-theme [data-element-id='select-chats-button'] * {\n color: var(--strong-text-color) !important;\n }\n \n .custom-theme [data-element-id='chat-folder']:hover * {\n color: var(--light-accent-color) !important;\n }\n .custom-theme [data-element-id='chat-folder']:hover {\n background: transparent;\n }\n .custom-theme [data-element-id='chat-folder']:focus-within {\n background: transparent;\n }\n .custom-theme [data-element-id='chat-folder']:focus-within * {\n color: var(--light-accent-color) !important;\n }\n .custom-theme [data-element-id='chat-folder'] textarea {\n color: var(--light-accent-color);\n box-shadow: 0 0 0 1.6px var(--border-outline);\n }\n \n .custom-theme [data-element-id='selected-chat-item'] {\n border-radius: 15px;\n background: var(--highlight-responsive-color);\n }\n .custom-theme [data-element-id='custom-chat-item']:hover {\n border-radius: 15px;\n background: var(--subdued-accent-color);\n }\n .custom-theme [data-element-id='user-message'] {\n background: var(--message-background-color);\n border-top-left-radius: 0;\n padding: 0.5rem 1rem;\n }\n .custom-theme [data-element-id='ai-response'] {\n background: var(--ai-response-color);\n border-radius: 1rem;\n border-top-left-radius: 0;\n padding: 0.5rem 1rem;\n }\n .custom-theme [data-element-id='ai-response'] * {\n color: var(--extra-dark-accent-color) !important;\n }\n .dark .custom-theme [data-element-id='in-message-play-button'] {\n background: var(--extra-dark-accent-color);\n }\n .dark .custom-theme [data-element-id='in-message-play-button'] * {\n color: var(--light-neutral-color) !important;\n }\n .custom-theme [data-element-id='chat-avatar-container'] {\n border-radius: 100%;\n overflow: hidden;\n }\n .custom-theme [data-element-id='response-block']:hover {\n background: var(--secondary-bg-color);\n }\n .dark .custom-theme [data-element-id='response-block']:hover {\n background: var(--soft-focus-color);\n }\n .dark .custom-theme [data-element-id='response-block'].is-pinned:hover {\n background: var(--soft-focus-color);\n }\n .custom-theme [data-element-id='chat-input-textbox-container'].editing {\n padding: 20px;\n border-radius: 10px;\n }\n .dark .custom-theme [data-element-id='chat-input-textbox-container'].editing {\n background: var(--soft-focus-color);\n }\n .custom-theme [data-element-id='edit-message-label'] {\n background: var(--vibrant-accent-1-color);\n }\n .custom-theme [data-element-id='replace-only-button'] {\n background: var(--vibrant-accent-2-color);\n }\n .custom-theme [data-element-id='replace-only-button']:hover {\n background: var(--highlight-color);\n }\n .custom-theme [data-element-id='response-block'].is-pinned {\n background: transparent;\n }\n .custom-theme [data-element-id='response-block'].is-pinned:hover {\n background: var(--secondary-bg-color);\n }\n .custom-theme [data-element-id='push-pin-symbol'] {\n left: 56px;\n top: 7px;\n width: 15px;\n transform: scaleX(-1);\n color: var(--extra-dark-accent-color);\n }\n .dark .custom-theme [data-element-id='push-pin-symbol'] {\n color: var(--extra-dark-accent-color);\n }\n .custom-theme [data-element-id='pin-message-button'] {\n transform: scaleX(-1);\n }\n .custom-theme [data-element-id='pin-message-button']:hover {\n color: var(--message-background-color);\n }\n .custom-theme [data-element-id='edit-message-button']:hover {\n color: var(--message-background-color);\n }\n .custom-theme [data-element-id='play-message-button']:hover {\n color: var(--message-background-color);\n }\n \n .custom-theme #elements-in-action-buttons > button {\n border-radius: 20px !important;\n background: var(--soft-accent-color) !important;\n box-shadow: rgba(99, 99, 99, 0.2) 0px 2px 8px 0px !important;\n }\n .custom-theme #elements-in-action-buttons > button * {\n color: var(--deep-accent-color) !important;\n }\n .dark [data-element-id='clear-context-divider']:hover {\n background: var(--soft-focus-color) !important;\n }\n \n .custom-theme [data-element-id='input-row'] {\n align-items: center;\n }\n \n .custom-theme [data-element-id='width-adjust-bar'] {\n background: var(--light-bg);\n }\n .custom-theme [data-element-id='width-adjust-bar']:hover {\n background: var(--pale-highlight-color);\n }\n "}(tx.themeSettings.selected):tx.themeSettings.css})}):null,(0,S.jsxs)("div",{className:function(){for(var e=arguments.length,t=Array(e),n=0;n