From cde9f02b7cd3fd1eb74e85f0cc0af0c78f5f5604 Mon Sep 17 00:00:00 2001 From: morgan9e Date: Sun, 15 Jun 2025 06:55:06 +0000 Subject: [PATCH] deploy: 07fd74d1df459e84a0ee5a0a78e6253168a0fa5f --- assets/{index-37beb510.js => index-3880ded0.js} | 2 +- index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename assets/{index-37beb510.js => index-3880ded0.js} (99%) diff --git a/assets/index-37beb510.js b/assets/index-3880ded0.js similarity index 99% rename from assets/index-37beb510.js rename to assets/index-3880ded0.js index 3498fdd..b59f2ac 100644 --- a/assets/index-37beb510.js +++ b/assets/index-3880ded0.js @@ -129,7 +129,7 @@ Initial scene: `;n.forEach(s=>{const o=s.role,I=s.content,m=`## ${o} ${I} -`;a+=m});const r=new Blob([a],{type:"text/markdown"}),c=URL.createObjectURL(r),i=document.createElement("a");i.download=`${t.name}.md`,i.href=c,document.body.appendChild(i),i.click(),document.body.removeChild(i)},nh=async l=>{const e=JSON.parse(JSON.stringify(Kn(l)));for(let c=0;c{const t=Lt(il).find(s=>s.id===l),n=JSON.parse(JSON.stringify(t.settings));Object.keys(a0()).forEach(s=>{delete n[s]});const a=JSON.stringify(n),r=new Blob([a],{type:"text/json"}),c=URL.createObjectURL(r),i=document.createElement("a");i.download=`${n.profileName}.json`,i.href=c,document.body.appendChild(i),i.click(),document.body.removeChild(i)};var Hs={};Object.defineProperty(Hs,"__esModule",{value:!0});var z1=Hs.clickOutside=void 0;function rh(l,e){var t=function(n){return l&&!l.contains(n.target)&&!n.defaultPrevented&&e()};return document.addEventListener("click",t,!0),{destroy:function(){document.removeEventListener("click",t,!0)}}}z1=Hs.clickOutside=rh;function b9(l){let e,t,n,a,r,c,i,s,o,I,m,u,p,R,E,W,X,f,Q,F,A,Y,C,U,ce,P,K,z,re,ge;function _e(M,de){return M[3]?ih:ch}let Xe=_e(l),x=Xe(l);return{c(){e=_("div"),t=_("div"),n=he(),a=_("div"),r=_("article"),c=_("div"),i=_("p"),s=bt(l[1]),o=he(),I=_("button"),m=he(),u=_("div"),x.c(),p=he(),R=_("div"),E=_("div"),W=_("div"),X=he(),f=_("div"),Q=_("div"),F=_("button"),A=bt(l[4]),C=he(),U=_("div"),ce=_("button"),P=bt(l[6]),h(t,"class","modal-background"),h(I,"class","delete"),h(I,"aria-label","close"),h(I,"type","button"),h(c,"class","message-header"),h(u,"class","message-body"),h(W,"class","level-right"),h(F,"class",Y="button "+l[5]),h(F,"type","button"),h(Q,"class","level-item"),h(ce,"class",K="button "+l[7]),h(ce,"type","button"),h(U,"class","level-item"),h(f,"class","level-right"),h(E,"class","level is-mobile"),h(R,"class","message-footer"),h(r,"class",z="message "+l[8]),h(a,"class","modal-content nomax"),h(e,"class","modal is-active")},m(M,de){D(M,e,de),V(e,t),V(e,n),V(e,a),V(a,r),V(r,c),V(c,i),V(i,s),V(c,o),V(c,I),V(r,m),V(r,u),x.m(u,null),V(r,p),V(r,R),V(R,E),V(E,W),V(E,X),V(E,f),V(f,Q),V(Q,F),V(F,A),V(f,C),V(f,U),V(U,ce),V(ce,P),re||(ge=[Qe(t,"click",l[9]),Qe(I,"click",l[9]),Qe(F,"click",l[10]),Qe(ce,"click",l[9]),Qe(e,"modal-esc",l[9])],re=!0)},p(M,de){de&2&&bl(s,M[1]),Xe===(Xe=_e(M))&&x?x.p(M,de):(x.d(1),x=Xe(M),x&&(x.c(),x.m(u,null))),de&16&&bl(A,M[4]),de&32&&Y!==(Y="button "+M[5])&&h(F,"class",Y),de&64&&bl(P,M[6]),de&128&&K!==(K="button "+M[7])&&h(ce,"class",K),de&256&&z!==(z="message "+M[8])&&h(r,"class",z)},d(M){M&&O(e),x.d(),re=!1,Hl(ge)}}}function ch(l){let e;return{c(){e=bt(l[2])},m(t,n){D(t,e,n)},p(t,n){n&4&&bl(e,t[2])},d(t){t&&O(e)}}}function ih(l){let e,t;return{c(){e=new c2(!1),t=Et(),e.a=t},m(n,a){e.m(l[2],n,a),D(n,t,a)},p(n,a){a&4&&e.p(n[2])},d(n){n&&O(t),n&&e.d()}}}function sh(l){let e,t=l[0]&&b9(l);return{c(){t&&t.c(),e=Et()},m(n,a){t&&t.m(n,a),D(n,e,a)},p(n,[a]){n[0]?t?t.p(n,a):(t=b9(n),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},i:lt,o:lt,d(n){t&&t.d(n),n&&O(e)}}}function oh(l,e,t){let{isOpen:n}=e,{title:a}=e,{message:r}=e,{asHtml:c=!1}=e,{onConfirm:i}=e,{onCancel:s=null}=e,{confirmButton:o="Yes"}=e,{confirmButtonClass:I="is-info"}=e,{cancelButton:m="No"}=e,{cancelButtonClass:u=""}=e,{class:p=""}=e;const R=()=>{K2(),s&&s()},E=()=>{K2(),i()};return l.$$set=W=>{"isOpen"in W&&t(0,n=W.isOpen),"title"in W&&t(1,a=W.title),"message"in W&&t(2,r=W.message),"asHtml"in W&&t(3,c=W.asHtml),"onConfirm"in W&&t(11,i=W.onConfirm),"onCancel"in W&&t(12,s=W.onCancel),"confirmButton"in W&&t(4,o=W.confirmButton),"confirmButtonClass"in W&&t(5,I=W.confirmButtonClass),"cancelButton"in W&&t(6,m=W.cancelButton),"cancelButtonClass"in W&&t(7,u=W.cancelButtonClass),"class"in W&&t(8,p=W.class)},[n,a,r,c,o,I,m,u,p,R,E,i,s]}class Ka extends Qt{constructor(e){super(),St(this,e,oh,sh,Vt,{isOpen:0,title:1,message:2,asHtml:3,onConfirm:11,onCancel:12,confirmButton:4,confirmButtonClass:5,cancelButton:6,cancelButtonClass:7,class:8})}}function Ih(l){let e,t,n,a;return t=new ht({props:{icon:S7}}),{c(){e=_("span"),we(t.$$.fragment),n=bt(" Hide Summarized Messages"),h(e,"class","menu-icon")},m(r,c){D(r,e,c),Fe(t,e,null),D(r,n,c),a=!0},p:lt,i(r){a||(H(t.$$.fragment,r),a=!0)},o(r){T(t.$$.fragment,r),a=!1},d(r){r&&O(e),Ye(t),r&&O(n)}}}function dh(l){let e,t,n,a;return t=new ht({props:{icon:H7}}),{c(){e=_("span"),we(t.$$.fragment),n=bt(" Show Summarized Messages"),h(e,"class","menu-icon")},m(r,c){D(r,e,c),Fe(t,e,null),D(r,n,c),a=!0},p:lt,i(r){a||(H(t.$$.fragment,r),a=!0)},o(r){T(t.$$.fragment,r),a=!1},d(r){r&&O(e),Ye(t),r&&O(n)}}}function mh(l){let e,t,n,a,r,c,i,s,o,I,m,u,p,R,E,W,X,f,Q,F,A,Y,C,U,ce,P,K,z,re,ge,_e,Xe,x,M,de,ve,Ge,Ne,oe,Ie,ae,He,Ce,ke,pe,mt,Le,Ue,Nt,Gt,ye,tt,Ae,Rt,fe,Ct,wt,et,vt,kt,zt,Dt,ze,xe,gt,yt,Jt,ol,gl,Il,ct,Dl,Ml,Tt,De,Wl,cn,rl,Ll,sn,Tl,Cl,jl,ql,$l,xt,ll,at,Pt,nl,kl,Yn,Ln,on,Bl,ln,xn,wn,_l,en,ut,te,Oe,Ke,Bt,al,Fl,El,Jl,Nn,Zl,In,dn,fl,ka,qt;r=new ht({props:{icon:Fs}}),m=new ht({props:{icon:L7}}),f=new ht({props:{icon:Xs}}),C=new ht({props:{icon:th}}),z=new ht({props:{icon:C7}}),de=new ht({props:{icon:sG}}),Ie=new ht({props:{icon:oG}}),pe=new ht({props:{icon:$G}}),tt=new ht({props:{icon:w0}}),wt=new ht({props:{icon:V0}}),Dt=new ht({props:{icon:mG}}),gl=new ht({props:{icon:V0}}),Wl=new ht({props:{icon:V0}}),Tl=new ht({props:{icon:w0}}),at=new ht({props:{icon:sr}}),Ln=new ht({props:{icon:Dp}});const s2=[dh,Ih],Tn=[];function o2(Me,Rl){return Me[6].hideSummarized?0:1}return _l=o2(l),en=Tn[_l]=s2[_l](l),al=new ht({props:{icon:Q7}}),{c(){e=_("div"),t=_("div"),n=_("button"),a=_("span"),we(r.$$.fragment),c=he(),i=_("div"),s=_("div"),o=_("a"),I=_("span"),we(m.$$.fragment),u=bt(" Chat Profile Settings"),p=he(),R=_("hr"),E=he(),W=_("a"),X=_("span"),we(f.$$.fragment),Q=bt(" New Chat from Default"),F=he(),A=_("a"),Y=_("span"),we(C.$$.fragment),U=bt(" New Chat from Current"),ce=he(),P=_("a"),K=_("span"),we(z.$$.fragment),re=bt(" Clone Chat"),ge=he(),_e=_("hr"),Xe=he(),x=_("a"),M=_("span"),we(de.$$.fragment),ve=bt(" Restart Chat Session"),Ge=he(),Ne=_("a"),oe=_("span"),we(Ie.$$.fragment),ae=bt(" Clear Chat Messages"),He=he(),Ce=_("a"),ke=_("span"),we(pe.$$.fragment),mt=bt(" Clear Chat Usage"),Le=he(),Ue=_("hr"),Nt=he(),Gt=_("a"),ye=_("span"),we(tt.$$.fragment),Ae=bt(" Backup Chat JSON"),Rt=he(),fe=_("a"),Ct=_("span"),we(wt.$$.fragment),et=bt(" Restore Chat JSON"),vt=he(),kt=_("a"),zt=_("span"),we(Dt.$$.fragment),ze=bt(" Export Chat Markdown"),xe=he(),gt=_("hr"),yt=he(),Jt=_("a"),ol=_("span"),we(gl.$$.fragment),Il=bt(" Restore Profile JSON"),ct=he(),Dl=_("hr"),Ml=he(),Tt=_("a"),De=_("span"),we(Wl.$$.fragment),cn=bt(" Dump All Data"),rl=he(),Ll=_("a"),sn=_("span"),we(Tl.$$.fragment),Cl=bt(" Load All Data"),jl=he(),ql=_("hr"),$l=he(),xt=_("a"),ll=_("span"),we(at.$$.fragment),Pt=bt(" Delete Chat"),nl=he(),kl=_("a"),Yn=_("span"),we(Ln.$$.fragment),on=bt(" Delete ALL Chats"),Bl=he(),ln=_("hr"),xn=he(),wn=_("a"),en.c(),ut=he(),te=_("hr"),Oe=he(),Ke=_("a"),Bt=_("span"),we(al.$$.fragment),Fl=bt(" API Setting"),Nn=he(),Zl=_("input"),In=he(),dn=_("input"),h(a,"class","icon "),h(n,"class","button is-ghost default-text"),h(n,"aria-haspopup","true"),h(n,"aria-controls","dropdown-menu3"),h(t,"class","dropdown-trigger"),h(I,"class","menu-icon"),h(o,"href","#"),h(o,"class","dropdown-item"),Ve(o,"is-disabled",!l[0]),h(R,"class","dropdown-divider"),h(X,"class","menu-icon"),h(W,"href","#"),h(W,"class","dropdown-item"),Ve(W,"is-disabled",!fn()),h(Y,"class","menu-icon"),h(A,"href","#"),h(A,"class","dropdown-item"),Ve(A,"is-disabled",!l[0]),h(K,"class","menu-icon"),h(P,"href","#"),h(P,"class","dropdown-item"),Ve(P,"is-disabled",!l[0]),h(_e,"class","dropdown-divider"),h(M,"class","menu-icon"),h(x,"href","#"),h(x,"class","dropdown-item"),Ve(x,"is-disabled",!l[0]),h(oe,"class","menu-icon"),h(Ne,"href","#"),h(Ne,"class","dropdown-item"),Ve(Ne,"is-disabled",!l[0]),h(ke,"class","menu-icon"),h(Ce,"href","#"),h(Ce,"class","dropdown-item"),Ve(Ce,"is-disabled",!l[0]),h(Ue,"class","dropdown-divider"),h(ye,"class","menu-icon"),h(Gt,"href","#"),h(Gt,"class","dropdown-item"),Ve(Gt,"is-disabled",!l[0]),h(Ct,"class","menu-icon"),h(fe,"href","#"),h(fe,"class","dropdown-item"),Ve(fe,"is-disabled",!fn()),h(zt,"class","menu-icon"),h(kt,"href","#"),h(kt,"class","dropdown-item"),Ve(kt,"is-disabled",!l[0]),h(gt,"class","dropdown-divider"),h(ol,"class","menu-icon"),h(Jt,"href","#"),h(Jt,"class","dropdown-item"),Ve(Jt,"is-disabled",!fn()),h(Dl,"class","dropdown-divider"),h(De,"class","menu-icon"),h(Tt,"href","#"),h(Tt,"class","dropdown-item"),h(sn,"class","menu-icon"),h(Ll,"href","#"),h(Ll,"class","dropdown-item"),h(ql,"class","dropdown-divider"),h(ll,"class","menu-icon"),h(xt,"href","#"),h(xt,"class","dropdown-item"),Ve(xt,"is-disabled",!l[0]),h(Yn,"class","menu-icon"),h(kl,"href","#"),h(kl,"class","dropdown-item"),Ve(kl,"is-disabled",l[2]&&!l[2][0]),h(ln,"class","dropdown-divider"),h(wn,"href","#"),h(wn,"class","dropdown-item"),h(te,"class","dropdown-divider"),h(Bt,"class","menu-icon"),h(Ke,"href","#/"),h(Ke,"class","dropdown-item"),h(s,"class","dropdown-content"),h(i,"class","dropdown-menu"),h(i,"id","dropdown-menu3"),h(i,"role","menu"),h(e,"class",El="dropdown "+l[1]),Ve(e,"is-active",l[3]),On(Zl,"display","none"),h(Zl,"type","file"),h(Zl,"accept",".json"),On(dn,"display","none"),h(dn,"type","file"),h(dn,"accept",".json")},m(Me,Rl){D(Me,e,Rl),V(e,t),V(t,n),V(n,a),Fe(r,a,null),V(e,c),V(e,i),V(i,s),V(s,o),V(o,I),Fe(m,I,null),V(o,u),V(s,p),V(s,R),V(s,E),V(s,W),V(W,X),Fe(f,X,null),V(W,Q),V(s,F),V(s,A),V(A,Y),Fe(C,Y,null),V(A,U),V(s,ce),V(s,P),V(P,K),Fe(z,K,null),V(P,re),V(s,ge),V(s,_e),V(s,Xe),V(s,x),V(x,M),Fe(de,M,null),V(x,ve),V(s,Ge),V(s,Ne),V(Ne,oe),Fe(Ie,oe,null),V(Ne,ae),V(s,He),V(s,Ce),V(Ce,ke),Fe(pe,ke,null),V(Ce,mt),V(s,Le),V(s,Ue),V(s,Nt),V(s,Gt),V(Gt,ye),Fe(tt,ye,null),V(Gt,Ae),V(s,Rt),V(s,fe),V(fe,Ct),Fe(wt,Ct,null),V(fe,et),V(s,vt),V(s,kt),V(kt,zt),Fe(Dt,zt,null),V(kt,ze),V(s,xe),V(s,gt),V(s,yt),V(s,Jt),V(Jt,ol),Fe(gl,ol,null),V(Jt,Il),V(s,ct),V(s,Dl),V(s,Ml),V(s,Tt),V(Tt,De),Fe(Wl,De,null),V(Tt,cn),V(s,rl),V(s,Ll),V(Ll,sn),Fe(Tl,sn,null),V(Ll,Cl),V(s,jl),V(s,ql),V(s,$l),V(s,xt),V(xt,ll),Fe(at,ll,null),V(xt,Pt),V(s,nl),V(s,kl),V(kl,Yn),Fe(Ln,Yn,null),V(kl,on),V(s,Bl),V(s,ln),V(s,xn),V(s,wn),Tn[_l].m(wn,null),V(s,ut),V(s,te),V(s,Oe),V(s,Ke),V(Ke,Bt),Fe(al,Bt,null),V(Ke,Fl),D(Me,Nn,Rl),D(Me,Zl,Rl),l[36](Zl),D(Me,In,Rl),D(Me,dn,Rl),l[38](dn),fl=!0,ka||(qt=[Qe(n,"click",g2(Wt(l[17]))),Qe(o,"click",Wt(l[18])),Qe(W,"click",Wt(l[19])),Qe(A,"click",Wt(l[20])),Qe(P,"click",Wt(l[21])),Qe(x,"click",Wt(l[22])),Qe(Ne,"click",Wt(l[23])),Qe(Ce,"click",Wt(l[24])),Qe(Gt,"click",Wt(l[25])),Qe(fe,"click",Wt(l[26])),Qe(kt,"click",Wt(l[27])),Qe(Jt,"click",Wt(l[28])),Qe(Tt,"click",Wt(l[29])),Qe(Ll,"click",Wt(l[30])),Qe(xt,"click",Wt(l[31])),Qe(kl,"click",Wt(l[32])),Qe(wn,"click",Wt(l[33])),Qe(Ke,"click",l[11]),Oi(Jl=z1.call(null,e,l[34])),Qe(Zl,"change",l[35]),Qe(dn,"change",l[37])],ka=!0)},p(Me,Rl){(!fl||Rl[0]&1)&&Ve(o,"is-disabled",!Me[0]),(!fl||Rl[0]&1)&&Ve(A,"is-disabled",!Me[0]),(!fl||Rl[0]&1)&&Ve(P,"is-disabled",!Me[0]),(!fl||Rl[0]&1)&&Ve(x,"is-disabled",!Me[0]),(!fl||Rl[0]&1)&&Ve(Ne,"is-disabled",!Me[0]),(!fl||Rl[0]&1)&&Ve(Ce,"is-disabled",!Me[0]),(!fl||Rl[0]&1)&&Ve(Gt,"is-disabled",!Me[0]),(!fl||Rl[0]&1)&&Ve(kt,"is-disabled",!Me[0]),(!fl||Rl[0]&1)&&Ve(xt,"is-disabled",!Me[0]),(!fl||Rl[0]&4)&&Ve(kl,"is-disabled",Me[2]&&!Me[2][0]);let ta=_l;_l=o2(Me),_l===ta?Tn[_l].p(Me,Rl):(st(),T(Tn[ta],1,1,()=>{Tn[ta]=null}),ot(),en=Tn[_l],en?en.p(Me,Rl):(en=Tn[_l]=s2[_l](Me),en.c()),H(en,1),en.m(wn,null)),(!fl||Rl[0]&2&&El!==(El="dropdown "+Me[1]))&&h(e,"class",El),Jl&&$a(Jl.update)&&Rl[0]&8&&Jl.update.call(null,Me[34]),(!fl||Rl[0]&10)&&Ve(e,"is-active",Me[3])},i(Me){fl||(H(r.$$.fragment,Me),H(m.$$.fragment,Me),H(f.$$.fragment,Me),H(C.$$.fragment,Me),H(z.$$.fragment,Me),H(de.$$.fragment,Me),H(Ie.$$.fragment,Me),H(pe.$$.fragment,Me),H(tt.$$.fragment,Me),H(wt.$$.fragment,Me),H(Dt.$$.fragment,Me),H(gl.$$.fragment,Me),H(Wl.$$.fragment,Me),H(Tl.$$.fragment,Me),H(at.$$.fragment,Me),H(Ln.$$.fragment,Me),H(en),H(al.$$.fragment,Me),fl=!0)},o(Me){T(r.$$.fragment,Me),T(m.$$.fragment,Me),T(f.$$.fragment,Me),T(C.$$.fragment,Me),T(z.$$.fragment,Me),T(de.$$.fragment,Me),T(Ie.$$.fragment,Me),T(pe.$$.fragment,Me),T(tt.$$.fragment,Me),T(wt.$$.fragment,Me),T(Dt.$$.fragment,Me),T(gl.$$.fragment,Me),T(Wl.$$.fragment,Me),T(Tl.$$.fragment,Me),T(at.$$.fragment,Me),T(Ln.$$.fragment,Me),T(en),T(al.$$.fragment,Me),fl=!1},d(Me){Me&&O(e),Ye(r),Ye(m),Ye(f),Ye(C),Ye(z),Ye(de),Ye(Ie),Ye(pe),Ye(tt),Ye(wt),Ye(Dt),Ye(gl),Ye(Wl),Ye(Tl),Ye(at),Ye(Ln),Tn[_l].d(),Ye(al),Me&&O(Nn),Me&&O(Zl),l[36](null),Me&&O(In),Me&&O(dn),l[38](null),ka=!1,Hl(qt)}}}function bh(){try{let l={};for(let i=0;it(6,a=pe)),tl(l,Dn,pe=>t(40,r=pe)),tl(l,pa,pe=>t(41,c=pe)),tl(l,il,pe=>t(2,i=pe)),tl(l,M1,pe=>t(7,s=pe));let{chatId:o}=e;const I=(pe=!0)=>{t(3,u=pe)};let{style:m="is-right"}=e,u=!1,p,R;const E=pe=>{f();const mt=pe.target.files[0];pe.target.value=null;const Le=new FileReader;Le.readAsText(mt),Le.onload=Ue=>{const Nt=(Ue.target||{}).result;AG(Nt)}},W=()=>{f(),ma(Ka,{title:"Delete Chat",message:"Are you sure you want to delete this chat?",class:"is-warning",confirmButtonClass:"is-warning",confirmButton:"Delete Chat",onConfirm:()=>{const pe=Kn(o),mt=n.indexOf(pe),Le=n[mt-1],Nt=n[mt+1]||Le;Nt?ia(`/chat/${Nt.id}`).then(()=>{z2(o)}):ia("/").then(()=>{z2(o)})}})},X=()=>{n.length&&(f(),ma(Ka,{title:"Delete ALL Chat",message:"Are you sure you want to delete ALL of your chats?",class:"is-danger",confirmButtonClass:"is-danger",confirmButton:"Delete ALL",onConfirm:()=>{ia("/").then(()=>{z2(o)}),fG()}}))},f=()=>{wl(pa,c=!1,c),t(3,u=!1)},Q=()=>{f(),q2(o),wl(Dn,r++,r)},F=()=>{f(),wa("hideSummarized",!a.hideSummarized)},A=()=>{ma(Ka,{title:"Clear Chat Usage",message:"Are you sure you want to clear your token usage stats for the current chat?",class:"is-warning",confirmButtonClass:"is-warning",confirmButton:"Clear Usage",onConfirm:()=>{const pe=Kn(o);pe.usage={},vn()}})},Y=pe=>{const mt=pe.target.files[0];pe.target.value=null;const Le=new FileReader;Le.onload=Ue=>{const Nt=(Ue.target||{}).result;try{const Gt=JSON.parse(Nt);Gt.profileName=U1(Gt.profileName||""),Gt.profile=null,w1(Gt),ma(Ka,{title:"Profile Restored",class:"is-info",message:"Profile restored as:
"+Pu(Gt.profileName)+"

Start new chat with this profile?",asHtml:!0,onConfirm:()=>{$i(o,Gt)},onCancel:()=>{}})}catch(Gt){hn("Unable to import profile:",Gt)}},Le.onerror=Ue=>{hn("Unable to import profile:",new Error("Unknown error"))},Le.readAsText(mt)},C=()=>{t(3,u=!u)},U=()=>{o&&f(),wl(M1,s=!0,s)},ce=()=>{fn()&&f(),fn()&&$i()},P=()=>{o&&f(),o&&Ku(o)},K=()=>{o&&f(),HG(o)},z=()=>{o&&Q()},re=()=>{o&&f(),em(o)},ge=()=>{o&&f(),A()},_e=()=>{f(),nh(o)},Xe=()=>{o&&f(),p.click()},x=()=>{o&&f(),lh(o)},M=()=>{o&&f(),R.click()},de=()=>{f(),bh()},ve=()=>{o&&f(),ph(),uh()},Ge=()=>{o&&f(),W()},Ne=()=>{X()},oe=()=>{o&&F()},Ie=()=>{t(3,u=!1)},ae=pe=>E(pe);function He(pe){_n[pe?"unshift":"push"](()=>{p=pe,t(4,p)})}const Ce=pe=>Y(pe);function ke(pe){_n[pe?"unshift":"push"](()=>{R=pe,t(5,R)})}return l.$$set=pe=>{"chatId"in pe&&t(0,o=pe.chatId),"style"in pe&&t(1,m=pe.style)},l.$$.update=()=>{l.$$.dirty[0]&4&&(n=i.sort((pe,mt)=>mt.id-pe.id))},[o,m,i,u,p,R,a,s,E,W,X,f,Q,F,A,Y,I,C,U,ce,P,K,z,re,ge,_e,Xe,x,M,de,ve,Ge,Ne,oe,Ie,ae,He,Ce,ke]}class nm extends Qt{constructor(e){super(),St(this,e,Gh,mh,Vt,{chatId:0,show:16,style:1},null,[-1,-1])}get show(){return this.$$.ctx[16]}}function hh(l){let e,t,n,a,r,c;return n=new ht({props:{icon:jp}}),{c(){e=_("button"),t=_("span"),we(n.$$.fragment),h(t,"class","icon"),h(e,"class","button")},m(i,s){D(i,e,s),V(e,t),Fe(n,t,null),a=!0,r||(c=Qe(e,"click",g2(l[4])),r=!0)},p:lt,i(i){a||(H(n.$$.fragment,i),a=!0)},o(i){T(n.$$.fragment,i),a=!1},d(i){i&&O(e),Ye(n),r=!1,c()}}}function Zh(l){let e,t,n,a,r,c;return n=new ht({props:{icon:IG}}),{c(){e=_("button"),t=_("span"),we(n.$$.fragment),h(t,"class","icon"),h(e,"class","button")},m(i,s){D(i,e,s),V(e,t),Fe(n,t,null),a=!0,r||(c=Qe(e,"click",g2(l[3])),r=!0)},p:lt,i(i){a||(H(n.$$.fragment,i),a=!0)},o(i){T(n.$$.fragment,i),a=!1},d(i){i&&O(e),Ye(n),r=!1,c()}}}function Rh(l){let e,t,n,a,r,c,i,s,o,I,m,u,p,R,E,W;const X=[Zh,hh],f=[];function Q(Y,C){return Y[1]?0:1}a=Q(l),r=f[a]=X[a](l);function F(Y){l[5](Y)}let A={};return l[0]!==void 0&&(A.chatId=l[0]),R=new nm({props:A}),_n.push(()=>_2(R,"chatId",F)),{c(){e=_("nav"),t=_("div"),n=_("div"),r.c(),c=he(),i=_("a"),s=_("img"),I=he(),m=_("p"),m.textContent="ChatGPT-web",u=he(),p=_("div"),we(R.$$.fragment),h(n,"class","navbar-item"),e2(s.src,o=lm)||h(s,"src",o),h(s,"alt","ChatGPT-web"),h(s,"width","24"),h(s,"height","24"),h(m,"class","ml-2 is-size-6 has-text-weight-bold"),h(i,"class","navbar-item"),h(i,"href","#/"),h(p,"class","chat-option-menu navbar-item is-pulled-right"),h(t,"class","navbar-brand"),h(e,"class","navbar is-fixed-top"),h(e,"aria-label","main navigation")},m(Y,C){D(Y,e,C),V(e,t),V(t,n),f[a].m(n,null),V(t,c),V(t,i),V(i,s),V(i,I),V(i,m),V(t,u),V(t,p),Fe(R,p,null),W=!0},p(Y,[C]){let U=a;a=Q(Y),a===U?f[a].p(Y,C):(st(),T(f[U],1,1,()=>{f[U]=null}),ot(),r=f[a],r?r.p(Y,C):(r=f[a]=X[a](Y),r.c()),H(r,1),r.m(n,null));const ce={};!E&&C&1&&(E=!0,ce.chatId=Y[0],y2(()=>E=!1)),R.$set(ce)},i(Y){W||(H(r),H(R.$$.fragment,Y),W=!0)},o(Y){T(r),T(R.$$.fragment,Y),W=!1},d(Y){Y&&O(e),f[a].d(),Ye(R)}}}function Nh(l,e,t){let n,a,r;tl(l,T1,o=>t(2,a=o)),tl(l,pa,o=>t(1,r=o));const c=()=>{wl(pa,r=!1,r)},i=()=>{wl(pa,r=!0,r)};function s(o){n=o,t(0,n),t(2,a)}return l.$$.update=()=>{l.$$.dirty&4&&t(0,n=a&&a.chatId?parseInt(a.chatId):void 0)},[n,r,a,c,i,s]}class gh extends Qt{constructor(e){super(),St(this,e,Nh,Rh,Vt,{})}}function Wh(l){let e,t,n,a,r,c,i=(l[0].name||`Chat ${l[0].id}`)+"",s,o,I,m,u;const p=[vh,Vh],R=[];function E(W,X){return W[3]?0:1}return t=E(l),n=R[t]=p[t](l),c=new ht({props:{class:"mr-2 chat-icon",size:"xs",icon:qG}}),{c(){e=_("a"),n.c(),a=he(),r=_("span"),we(c.$$.fragment),s=bt(i),h(r,"class","chat-item-name"),h(e,"href",o=`#/chat/${l[0].id}`),h(e,"class","chat-menu-item"),Ve(e,"is-waiting",l[3]),Ve(e,"is-disabled",!fn()),Ve(e,"is-active",l[1]===l[0].id)},m(W,X){D(W,e,X),R[t].m(e,null),V(e,a),V(e,r),Fe(c,r,null),V(r,s),I=!0,m||(u=Qe(e,"click",l[15]),m=!0)},p(W,X){let f=t;t=E(W),t===f?R[t].p(W,X):(st(),T(R[f],1,1,()=>{R[f]=null}),ot(),n=R[t],n?n.p(W,X):(n=R[t]=p[t](W),n.c()),H(n,1),n.m(e,a)),(!I||X&1)&&i!==(i=(W[0].name||`Chat ${W[0].id}`)+"")&&bl(s,i),(!I||X&1&&o!==(o=`#/chat/${W[0].id}`))&&h(e,"href",o),(!I||X&8)&&Ve(e,"is-waiting",W[3]),(!I||X&3)&&Ve(e,"is-active",W[1]===W[0].id)},i(W){I||(H(n),H(c.$$.fragment,W),I=!0)},o(W){T(n),T(c.$$.fragment,W),I=!1},d(W){W&&O(e),R[t].d(),Ye(c),m=!1,u()}}}function Eh(l){let e,t,n,a;return{c(){e=_("div"),h(e,"id",t="chat-menu-item-"+l[0].id),h(e,"class","chat-name-editor"),h(e,"contenteditable",""),l[0].name===void 0&&Y0(()=>l[11].call(e))},m(r,c){D(r,e,c),l[0].name!==void 0&&(e.innerText=l[0].name),n||(a=[Qe(e,"keydown",l[5]),Qe(e,"input",l[11]),Qe(e,"blur",l[6])],n=!0)},p(r,c){c&1&&t!==(t="chat-menu-item-"+r[0].id)&&h(e,"id",t),c&1&&r[0].name!==e.innerText&&(e.innerText=r[0].name)},i:lt,o:lt,d(r){r&&O(e),n=!1,Hl(a)}}}function Vh(l){let e,t,n,a,r,c,i,s;return t=new ht({props:{icon:Kp}}),r=new ht({props:{icon:sr}}),{c(){e=_("a"),we(t.$$.fragment),n=he(),a=_("a"),we(r.$$.fragment),h(e,"class","is-pulled-right is-hidden px-1 py-0 has-text-weight-bold edit-button"),h(e,"href","$"),h(a,"class","is-pulled-right is-hidden px-1 py-0 has-text-weight-bold delete-button"),h(a,"href","$")},m(o,I){D(o,e,I),Fe(t,e,null),D(o,n,I),D(o,a,I),Fe(r,a,null),c=!0,i||(s=[Qe(e,"click",Wt(l[13])),Qe(a,"click",Wt(l[14]))],i=!0)},p:lt,i(o){c||(H(t.$$.fragment,o),H(r.$$.fragment,o),c=!0)},o(o){T(t.$$.fragment,o),T(r.$$.fragment,o),c=!1},d(o){o&&O(e),Ye(t),o&&O(n),o&&O(a),Ye(r),i=!1,Hl(s)}}}function vh(l){let e,t,n,a,r;return t=new ht({props:{icon:ir}}),{c(){e=_("a"),we(t.$$.fragment),h(e,"class","is-pulled-right is-hidden px-1 py-0 has-text-weight-bold delete-button"),h(e,"href","$")},m(c,i){D(c,e,i),Fe(t,e,null),n=!0,a||(r=Qe(e,"click",Wt(l[12])),a=!0)},p:lt,i(c){n||(H(t.$$.fragment,c),n=!0)},o(c){T(t.$$.fragment,c),n=!1},d(c){c&&O(e),Ye(t),a=!1,r()}}}function yh(l){let e,t,n,a;const r=[Eh,Wh],c=[];function i(s,o){return s[2]?0:1}return t=i(l),n=c[t]=r[t](l),{c(){e=_("li"),n.c()},m(s,o){D(s,e,o),c[t].m(e,null),a=!0},p(s,[o]){let I=t;t=i(s),t===I?c[t].p(s,o):(st(),T(c[I],1,1,()=>{c[I]=null}),ot(),n=c[t],n?n.p(s,o):(n=c[t]=r[t](s),n.c()),H(n,1),n.m(e,null))},i(s){a||(H(n),a=!0)},o(s){T(n),a=!1},d(s){s&&O(e),c[t].d()}}}function _h(l,e,t){let n;tl(l,pa,F=>t(4,n=F));let{chat:a}=e,{activeChatId:r}=e,{prevChat:c}=e,{nextChat:i}=e,s=!1,o,I=0;sa(async()=>{a.name||t(0,a.name=`Chat ${a.id}`,a)});const m=F=>{F.key==="Escape"&&(F.stopPropagation(),F.preventDefault(),t(0,a.name=o,a),t(2,s=!1)),(F.key==="Tab"||F.key==="Enter")&&(F.stopPropagation(),F.preventDefault(),u())},u=()=>{if(t(2,s=!1),!a.name){t(0,a.name=o,a);return}vn()},p=()=>{if(!I){t(3,I=setTimeout(()=>{t(3,I=0)},1e3));return}if(clearTimeout(I),t(3,I=0),r===a.id){const F=i||c;F?ia(`/chat/${F.id}`).then(()=>{z2(a.id)}):ia("/").then(()=>{z2(a.id)})}else z2(a.id)},R=()=>{o=a.name,t(2,s=!0),setTimeout(()=>{const F=document.getElementById(`chat-menu-item-${a.id}`);F&&F.focus()},0)};function E(){a.name=this.innerText,t(0,a)}const W=()=>p(),X=()=>R(),f=()=>p(),Q=()=>{wl(pa,n=!1,n)};return l.$$set=F=>{"chat"in F&&t(0,a=F.chat),"activeChatId"in F&&t(1,r=F.activeChatId),"prevChat"in F&&t(9,c=F.prevChat),"nextChat"in F&&t(10,i=F.nextChat)},[a,r,s,I,n,m,u,p,R,c,i,E,W,X,f,Q]}class Xh extends Qt{constructor(e){super(),St(this,e,_h,yh,Vt,{chat:0,activeChatId:1,prevChat:9,nextChat:10})}}function u9(l,e,t){const n=l.slice();return n[18]=e[t],n}function p9(l,e,t){const n=l.slice();return n[21]=e[t],n[23]=t,n}function Fh(l){let e=l[0],t,n,a=Z9(l);return{c(){a.c(),t=Et()},m(r,c){a.m(r,c),D(r,t,c),n=!0},p(r,c){c&1&&Vt(e,e=r[0])?(st(),T(a,1,1,lt),ot(),a=Z9(r),a.c(),H(a,1),a.m(t.parentNode,t)):a.p(r,c)},i(r){n||(H(a),n=!0)},o(r){T(a),n=!1},d(r){r&&O(t),a.d(r)}}}function Yh(l){let e;return{c(){e=_("li"),e.innerHTML='No chats yet...'},m(t,n){D(t,e,n)},p:lt,i:lt,o:lt,d(t){t&&O(e)}}}function G9(l){let e,t;return e=new Xh({props:{activeChatId:l[5],chat:l[21],prevChat:l[4][l[23]-1],nextChat:l[4][l[23]+1]}}),{c(){we(e.$$.fragment)},m(n,a){Fe(e,n,a),t=!0},p(n,a){const r={};a&32&&(r.activeChatId=n[5]),a&16&&(r.chat=n[21]),a&16&&(r.prevChat=n[4][n[23]-1]),a&16&&(r.nextChat=n[4][n[23]+1]),e.$set(r)},i(n){t||(H(e.$$.fragment,n),t=!0)},o(n){T(e.$$.fragment,n),t=!1},d(n){Ye(e,n)}}}function h9(l){let e=l[21].id,t,n,a=G9(l);return{c(){a.c(),t=Et()},m(r,c){a.m(r,c),D(r,t,c),n=!0},p(r,c){c&16&&Vt(e,e=r[21].id)?(st(),T(a,1,1,lt),ot(),a=G9(r),a.c(),H(a,1),a.m(t.parentNode,t)):a.p(r,c)},i(r){n||(H(a),n=!0)},o(r){T(a),n=!1},d(r){r&&O(t),a.d(r)}}}function Z9(l){let e,t,n=l[4],a=[];for(let c=0;cT(a[c],1,1,()=>{a[c]=null});return{c(){for(let c=0;c_2(m,"chatId",Le));const Nt=[Yh,Fh],Gt=[];function ye(et,vt){return et[4].length===0?0:1}E=ye(l),W=Gt[E]=Nt[E](l),U=new ht({props:{icon:l[1].icon}});let tt=Object.values(j2),Ae=[];for(let et=0;etT(Ae[et],1,1,()=>{Ae[et]=null});x=new ht({props:{icon:V0}}),Ne=new ht({props:{icon:w0}});const fe=[Ah,wh],Ct=[];function wt(et,vt){return et[2]?1:0}return ae=wt(l),He=Ct[ae]=fe[ae](l),{c(){e=_("aside"),t=_("div"),t.textContent="V&&&BUILDVER&&&",n=he(),a=_("div"),r=_("div"),c=_("a"),i=_("img"),o=he(),I=_("div"),we(m.$$.fragment),p=he(),R=_("ul"),W.c(),X=he(),f=_("div"),Q=_("div"),F=_("div"),A=_("div"),Y=_("button"),C=_("span"),we(U.$$.fragment),ce=he(),P=_("div"),K=_("div");for(let et=0;etu=!1)),m.$set(kt);let zt=E;E=ye(et),E===zt?Gt[E].p(et,vt):(st(),T(Gt[zt],1,1,()=>{Gt[zt]=null}),ot(),W=Gt[E],W?W.p(et,vt):(W=Gt[E]=Nt[E](et),W.c()),H(W,1),W.m(R,null));const Dt={};if(vt&2&&(Dt.icon=et[1].icon),U.$set(Dt),vt&10){tt=Object.values(j2);let xe;for(xe=0;xe{Ct[ze]=null}),ot(),He=Ct[ae],He?He.p(et,vt):(He=Ct[ae]=fe[ae](et),He.c()),H(He,1),He.m(Ie,null)),Ce&&$a(Ce.update)&&vt&64&&Ce.update.call(null,et[16]),(!ke||vt&64)&&Ve(e,"pinned",et[6])},i(et){if(!ke){H(m.$$.fragment,et),H(W),H(U.$$.fragment,et);for(let vt=0;vtt(0,r=A)),tl(l,il,A=>t(7,c=A)),tl(l,T1,A=>t(8,i=A)),tl(l,pa,A=>t(6,s=A));let o=Pr(),I=fn();const m=(...A)=>{t(1,o=Pr()),t(4,n=c.sort(o.sortFn)),t(2,I=fn())};let u=!1;sa(()=>{});function p(A){a=A,t(5,a),t(8,i)}const R=()=>{t(3,u=!u)},E=A=>{t(3,u=!1),UG(A.value)},W=()=>{t(3,u=!1)},X=()=>{Qh()},f=()=>{Sh()},Q=()=>{wl(pa,s=!1,s),$i()},F=()=>{wl(pa,s=!1,s)};return l.$$.update=()=>{l.$$.dirty&128&&t(4,n=c.sort(Pr().sortFn)),l.$$.dirty&256&&t(5,a=i&&i.chatId?parseInt(i.chatId):void 0),l.$$.dirty&1&&m(r)},[r,o,I,u,n,a,s,c,i,p,R,E,W,X,f,Q,F]}class Lh extends Qt{constructor(e){super(),St(this,e,Hh,fh,Vt,{})}}function Th(l){let e,t,n,a,r,c,i;const s=l[4].default,o=ul(s,l,l[3],null);return{c(){e=_("div"),t=he(),n=_("div"),a=he(),r=_("div"),o&&o.c(),h(e,"class","lower-mask section-footer-mask"),Ve(e,"pin-footer",l[1]),h(n,"class","lower-mask2"),Ve(n,"strong-mask",l[2]),h(r,"class",c="section-footer "+l[0]),Ve(r,"pin-footer",l[1])},m(I,m){D(I,e,m),D(I,t,m),D(I,n,m),D(I,a,m),D(I,r,m),o&&o.m(r,null),i=!0},p(I,[m]){(!i||m&2)&&Ve(e,"pin-footer",I[1]),(!i||m&4)&&Ve(n,"strong-mask",I[2]),o&&o.p&&(!i||m&8)&&Gl(o,s,I,I[3],i?pl(s,I[3],m,null):hl(I[3]),null),(!i||m&1&&c!==(c="section-footer "+I[0]))&&h(r,"class",c),(!i||m&3)&&Ve(r,"pin-footer",I[1])},i(I){i||(H(o,I),i=!0)},o(I){T(o,I),i=!1},d(I){I&&O(e),I&&O(t),I&&O(n),I&&O(a),I&&O(r),o&&o.d(I)}}}function Ch(l,e,t){let{$$slots:n={},$$scope:a}=e,{class:r=""}=e,{pin:c=!1}=e,{strongMask:i=!1}=e;return l.$$set=s=>{"class"in s&&t(0,r=s.class),"pin"in s&&t(1,c=s.pin),"strongMask"in s&&t(2,i=s.strongMask),"$$scope"in s&&t(3,a=s.$$scope)},[r,c,i,a,n]}class am extends Qt{constructor(e){super(),St(this,e,Ch,Th,Vt,{class:0,pin:1,strongMask:2})}}function N9(l){let e;return{c(){e=_("p"),e.innerHTML=`Please enter your OpenAI API key above to use Open AI's ChatGPT API. +`;a+=m});const r=new Blob([a],{type:"text/markdown"}),c=URL.createObjectURL(r),i=document.createElement("a");i.download=`${t.name}.md`,i.href=c,document.body.appendChild(i),i.click(),document.body.removeChild(i)},nh=async l=>{const e=JSON.parse(JSON.stringify(Kn(l)));for(let c=0;c{const t=Lt(il).find(s=>s.id===l),n=JSON.parse(JSON.stringify(t.settings));Object.keys(a0()).forEach(s=>{delete n[s]});const a=JSON.stringify(n),r=new Blob([a],{type:"text/json"}),c=URL.createObjectURL(r),i=document.createElement("a");i.download=`${n.profileName}.json`,i.href=c,document.body.appendChild(i),i.click(),document.body.removeChild(i)};var Hs={};Object.defineProperty(Hs,"__esModule",{value:!0});var z1=Hs.clickOutside=void 0;function rh(l,e){var t=function(n){return l&&!l.contains(n.target)&&!n.defaultPrevented&&e()};return document.addEventListener("click",t,!0),{destroy:function(){document.removeEventListener("click",t,!0)}}}z1=Hs.clickOutside=rh;function b9(l){let e,t,n,a,r,c,i,s,o,I,m,u,p,R,E,W,X,f,Q,F,A,Y,C,U,ce,P,K,z,re,ge;function _e(M,de){return M[3]?ih:ch}let Xe=_e(l),x=Xe(l);return{c(){e=_("div"),t=_("div"),n=he(),a=_("div"),r=_("article"),c=_("div"),i=_("p"),s=bt(l[1]),o=he(),I=_("button"),m=he(),u=_("div"),x.c(),p=he(),R=_("div"),E=_("div"),W=_("div"),X=he(),f=_("div"),Q=_("div"),F=_("button"),A=bt(l[4]),C=he(),U=_("div"),ce=_("button"),P=bt(l[6]),h(t,"class","modal-background"),h(I,"class","delete"),h(I,"aria-label","close"),h(I,"type","button"),h(c,"class","message-header"),h(u,"class","message-body"),h(W,"class","level-right"),h(F,"class",Y="button "+l[5]),h(F,"type","button"),h(Q,"class","level-item"),h(ce,"class",K="button "+l[7]),h(ce,"type","button"),h(U,"class","level-item"),h(f,"class","level-right"),h(E,"class","level is-mobile"),h(R,"class","message-footer"),h(r,"class",z="message "+l[8]),h(a,"class","modal-content nomax"),h(e,"class","modal is-active")},m(M,de){D(M,e,de),V(e,t),V(e,n),V(e,a),V(a,r),V(r,c),V(c,i),V(i,s),V(c,o),V(c,I),V(r,m),V(r,u),x.m(u,null),V(r,p),V(r,R),V(R,E),V(E,W),V(E,X),V(E,f),V(f,Q),V(Q,F),V(F,A),V(f,C),V(f,U),V(U,ce),V(ce,P),re||(ge=[Qe(t,"click",l[9]),Qe(I,"click",l[9]),Qe(F,"click",l[10]),Qe(ce,"click",l[9]),Qe(e,"modal-esc",l[9])],re=!0)},p(M,de){de&2&&bl(s,M[1]),Xe===(Xe=_e(M))&&x?x.p(M,de):(x.d(1),x=Xe(M),x&&(x.c(),x.m(u,null))),de&16&&bl(A,M[4]),de&32&&Y!==(Y="button "+M[5])&&h(F,"class",Y),de&64&&bl(P,M[6]),de&128&&K!==(K="button "+M[7])&&h(ce,"class",K),de&256&&z!==(z="message "+M[8])&&h(r,"class",z)},d(M){M&&O(e),x.d(),re=!1,Hl(ge)}}}function ch(l){let e;return{c(){e=bt(l[2])},m(t,n){D(t,e,n)},p(t,n){n&4&&bl(e,t[2])},d(t){t&&O(e)}}}function ih(l){let e,t;return{c(){e=new c2(!1),t=Et(),e.a=t},m(n,a){e.m(l[2],n,a),D(n,t,a)},p(n,a){a&4&&e.p(n[2])},d(n){n&&O(t),n&&e.d()}}}function sh(l){let e,t=l[0]&&b9(l);return{c(){t&&t.c(),e=Et()},m(n,a){t&&t.m(n,a),D(n,e,a)},p(n,[a]){n[0]?t?t.p(n,a):(t=b9(n),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},i:lt,o:lt,d(n){t&&t.d(n),n&&O(e)}}}function oh(l,e,t){let{isOpen:n}=e,{title:a}=e,{message:r}=e,{asHtml:c=!1}=e,{onConfirm:i}=e,{onCancel:s=null}=e,{confirmButton:o="Yes"}=e,{confirmButtonClass:I="is-info"}=e,{cancelButton:m="No"}=e,{cancelButtonClass:u=""}=e,{class:p=""}=e;const R=()=>{K2(),s&&s()},E=()=>{K2(),i()};return l.$$set=W=>{"isOpen"in W&&t(0,n=W.isOpen),"title"in W&&t(1,a=W.title),"message"in W&&t(2,r=W.message),"asHtml"in W&&t(3,c=W.asHtml),"onConfirm"in W&&t(11,i=W.onConfirm),"onCancel"in W&&t(12,s=W.onCancel),"confirmButton"in W&&t(4,o=W.confirmButton),"confirmButtonClass"in W&&t(5,I=W.confirmButtonClass),"cancelButton"in W&&t(6,m=W.cancelButton),"cancelButtonClass"in W&&t(7,u=W.cancelButtonClass),"class"in W&&t(8,p=W.class)},[n,a,r,c,o,I,m,u,p,R,E,i,s]}class Ka extends Qt{constructor(e){super(),St(this,e,oh,sh,Vt,{isOpen:0,title:1,message:2,asHtml:3,onConfirm:11,onCancel:12,confirmButton:4,confirmButtonClass:5,cancelButton:6,cancelButtonClass:7,class:8})}}function Ih(l){let e,t,n,a;return t=new ht({props:{icon:S7}}),{c(){e=_("span"),we(t.$$.fragment),n=bt(" Hide Summarized Messages"),h(e,"class","menu-icon")},m(r,c){D(r,e,c),Fe(t,e,null),D(r,n,c),a=!0},p:lt,i(r){a||(H(t.$$.fragment,r),a=!0)},o(r){T(t.$$.fragment,r),a=!1},d(r){r&&O(e),Ye(t),r&&O(n)}}}function dh(l){let e,t,n,a;return t=new ht({props:{icon:H7}}),{c(){e=_("span"),we(t.$$.fragment),n=bt(" Show Summarized Messages"),h(e,"class","menu-icon")},m(r,c){D(r,e,c),Fe(t,e,null),D(r,n,c),a=!0},p:lt,i(r){a||(H(t.$$.fragment,r),a=!0)},o(r){T(t.$$.fragment,r),a=!1},d(r){r&&O(e),Ye(t),r&&O(n)}}}function mh(l){let e,t,n,a,r,c,i,s,o,I,m,u,p,R,E,W,X,f,Q,F,A,Y,C,U,ce,P,K,z,re,ge,_e,Xe,x,M,de,ve,Ge,Ne,oe,Ie,ae,He,Ce,ke,pe,mt,Le,Ue,Nt,Gt,ye,tt,Ae,Rt,fe,Ct,wt,et,vt,kt,zt,Dt,ze,xe,gt,yt,Jt,ol,gl,Il,ct,Dl,Ml,Tt,De,Wl,cn,rl,Ll,sn,Tl,Cl,jl,ql,$l,xt,ll,at,Pt,nl,kl,Yn,Ln,on,Bl,ln,xn,wn,_l,en,ut,te,Oe,Ke,Bt,al,Fl,El,Jl,Nn,Zl,In,dn,fl,ka,qt;r=new ht({props:{icon:Fs}}),m=new ht({props:{icon:L7}}),f=new ht({props:{icon:Xs}}),C=new ht({props:{icon:th}}),z=new ht({props:{icon:C7}}),de=new ht({props:{icon:sG}}),Ie=new ht({props:{icon:oG}}),pe=new ht({props:{icon:$G}}),tt=new ht({props:{icon:w0}}),wt=new ht({props:{icon:V0}}),Dt=new ht({props:{icon:mG}}),gl=new ht({props:{icon:V0}}),Wl=new ht({props:{icon:V0}}),Tl=new ht({props:{icon:w0}}),at=new ht({props:{icon:sr}}),Ln=new ht({props:{icon:Dp}});const s2=[dh,Ih],Tn=[];function o2(Me,Rl){return Me[6].hideSummarized?0:1}return _l=o2(l),en=Tn[_l]=s2[_l](l),al=new ht({props:{icon:Q7}}),{c(){e=_("div"),t=_("div"),n=_("button"),a=_("span"),we(r.$$.fragment),c=he(),i=_("div"),s=_("div"),o=_("a"),I=_("span"),we(m.$$.fragment),u=bt(" Chat Profile Settings"),p=he(),R=_("hr"),E=he(),W=_("a"),X=_("span"),we(f.$$.fragment),Q=bt(" New Chat from Default"),F=he(),A=_("a"),Y=_("span"),we(C.$$.fragment),U=bt(" New Chat from Current"),ce=he(),P=_("a"),K=_("span"),we(z.$$.fragment),re=bt(" Clone Chat"),ge=he(),_e=_("hr"),Xe=he(),x=_("a"),M=_("span"),we(de.$$.fragment),ve=bt(" Restart Chat Session"),Ge=he(),Ne=_("a"),oe=_("span"),we(Ie.$$.fragment),ae=bt(" Clear Chat Messages"),He=he(),Ce=_("a"),ke=_("span"),we(pe.$$.fragment),mt=bt(" Clear Chat Usage"),Le=he(),Ue=_("hr"),Nt=he(),Gt=_("a"),ye=_("span"),we(tt.$$.fragment),Ae=bt(" Backup Chat JSON"),Rt=he(),fe=_("a"),Ct=_("span"),we(wt.$$.fragment),et=bt(" Restore Chat JSON"),vt=he(),kt=_("a"),zt=_("span"),we(Dt.$$.fragment),ze=bt(" Export Chat Markdown"),xe=he(),gt=_("hr"),yt=he(),Jt=_("a"),ol=_("span"),we(gl.$$.fragment),Il=bt(" Restore Profile JSON"),ct=he(),Dl=_("hr"),Ml=he(),Tt=_("a"),De=_("span"),we(Wl.$$.fragment),cn=bt(" Dump All Data"),rl=he(),Ll=_("a"),sn=_("span"),we(Tl.$$.fragment),Cl=bt(" Load All Data"),jl=he(),ql=_("hr"),$l=he(),xt=_("a"),ll=_("span"),we(at.$$.fragment),Pt=bt(" Delete Chat"),nl=he(),kl=_("a"),Yn=_("span"),we(Ln.$$.fragment),on=bt(" Delete ALL Chats"),Bl=he(),ln=_("hr"),xn=he(),wn=_("a"),en.c(),ut=he(),te=_("hr"),Oe=he(),Ke=_("a"),Bt=_("span"),we(al.$$.fragment),Fl=bt(" API Setting"),Nn=he(),Zl=_("input"),In=he(),dn=_("input"),h(a,"class","icon "),h(n,"class","button is-ghost default-text"),h(n,"aria-haspopup","true"),h(n,"aria-controls","dropdown-menu3"),h(t,"class","dropdown-trigger"),h(I,"class","menu-icon"),h(o,"href","#"),h(o,"class","dropdown-item"),Ve(o,"is-disabled",!l[0]),h(R,"class","dropdown-divider"),h(X,"class","menu-icon"),h(W,"href","#"),h(W,"class","dropdown-item"),Ve(W,"is-disabled",!fn()),h(Y,"class","menu-icon"),h(A,"href","#"),h(A,"class","dropdown-item"),Ve(A,"is-disabled",!l[0]),h(K,"class","menu-icon"),h(P,"href","#"),h(P,"class","dropdown-item"),Ve(P,"is-disabled",!l[0]),h(_e,"class","dropdown-divider"),h(M,"class","menu-icon"),h(x,"href","#"),h(x,"class","dropdown-item"),Ve(x,"is-disabled",!l[0]),h(oe,"class","menu-icon"),h(Ne,"href","#"),h(Ne,"class","dropdown-item"),Ve(Ne,"is-disabled",!l[0]),h(ke,"class","menu-icon"),h(Ce,"href","#"),h(Ce,"class","dropdown-item"),Ve(Ce,"is-disabled",!l[0]),h(Ue,"class","dropdown-divider"),h(ye,"class","menu-icon"),h(Gt,"href","#"),h(Gt,"class","dropdown-item"),Ve(Gt,"is-disabled",!l[0]),h(Ct,"class","menu-icon"),h(fe,"href","#"),h(fe,"class","dropdown-item"),Ve(fe,"is-disabled",!fn()),h(zt,"class","menu-icon"),h(kt,"href","#"),h(kt,"class","dropdown-item"),Ve(kt,"is-disabled",!l[0]),h(gt,"class","dropdown-divider"),h(ol,"class","menu-icon"),h(Jt,"href","#"),h(Jt,"class","dropdown-item"),Ve(Jt,"is-disabled",!fn()),h(Dl,"class","dropdown-divider"),h(De,"class","menu-icon"),h(Tt,"href","#"),h(Tt,"class","dropdown-item"),h(sn,"class","menu-icon"),h(Ll,"href","#"),h(Ll,"class","dropdown-item"),h(ql,"class","dropdown-divider"),h(ll,"class","menu-icon"),h(xt,"href","#"),h(xt,"class","dropdown-item"),Ve(xt,"is-disabled",!l[0]),h(Yn,"class","menu-icon"),h(kl,"href","#"),h(kl,"class","dropdown-item"),Ve(kl,"is-disabled",l[2]&&!l[2][0]),h(ln,"class","dropdown-divider"),h(wn,"href","#"),h(wn,"class","dropdown-item"),h(te,"class","dropdown-divider"),h(Bt,"class","menu-icon"),h(Ke,"href","#/"),h(Ke,"class","dropdown-item"),h(s,"class","dropdown-content"),h(i,"class","dropdown-menu"),h(i,"id","dropdown-menu3"),h(i,"role","menu"),h(e,"class",El="dropdown "+l[1]),Ve(e,"is-active",l[3]),On(Zl,"display","none"),h(Zl,"type","file"),h(Zl,"accept",".json"),On(dn,"display","none"),h(dn,"type","file"),h(dn,"accept",".json")},m(Me,Rl){D(Me,e,Rl),V(e,t),V(t,n),V(n,a),Fe(r,a,null),V(e,c),V(e,i),V(i,s),V(s,o),V(o,I),Fe(m,I,null),V(o,u),V(s,p),V(s,R),V(s,E),V(s,W),V(W,X),Fe(f,X,null),V(W,Q),V(s,F),V(s,A),V(A,Y),Fe(C,Y,null),V(A,U),V(s,ce),V(s,P),V(P,K),Fe(z,K,null),V(P,re),V(s,ge),V(s,_e),V(s,Xe),V(s,x),V(x,M),Fe(de,M,null),V(x,ve),V(s,Ge),V(s,Ne),V(Ne,oe),Fe(Ie,oe,null),V(Ne,ae),V(s,He),V(s,Ce),V(Ce,ke),Fe(pe,ke,null),V(Ce,mt),V(s,Le),V(s,Ue),V(s,Nt),V(s,Gt),V(Gt,ye),Fe(tt,ye,null),V(Gt,Ae),V(s,Rt),V(s,fe),V(fe,Ct),Fe(wt,Ct,null),V(fe,et),V(s,vt),V(s,kt),V(kt,zt),Fe(Dt,zt,null),V(kt,ze),V(s,xe),V(s,gt),V(s,yt),V(s,Jt),V(Jt,ol),Fe(gl,ol,null),V(Jt,Il),V(s,ct),V(s,Dl),V(s,Ml),V(s,Tt),V(Tt,De),Fe(Wl,De,null),V(Tt,cn),V(s,rl),V(s,Ll),V(Ll,sn),Fe(Tl,sn,null),V(Ll,Cl),V(s,jl),V(s,ql),V(s,$l),V(s,xt),V(xt,ll),Fe(at,ll,null),V(xt,Pt),V(s,nl),V(s,kl),V(kl,Yn),Fe(Ln,Yn,null),V(kl,on),V(s,Bl),V(s,ln),V(s,xn),V(s,wn),Tn[_l].m(wn,null),V(s,ut),V(s,te),V(s,Oe),V(s,Ke),V(Ke,Bt),Fe(al,Bt,null),V(Ke,Fl),D(Me,Nn,Rl),D(Me,Zl,Rl),l[36](Zl),D(Me,In,Rl),D(Me,dn,Rl),l[38](dn),fl=!0,ka||(qt=[Qe(n,"click",g2(Wt(l[17]))),Qe(o,"click",Wt(l[18])),Qe(W,"click",Wt(l[19])),Qe(A,"click",Wt(l[20])),Qe(P,"click",Wt(l[21])),Qe(x,"click",Wt(l[22])),Qe(Ne,"click",Wt(l[23])),Qe(Ce,"click",Wt(l[24])),Qe(Gt,"click",Wt(l[25])),Qe(fe,"click",Wt(l[26])),Qe(kt,"click",Wt(l[27])),Qe(Jt,"click",Wt(l[28])),Qe(Tt,"click",Wt(l[29])),Qe(Ll,"click",Wt(l[30])),Qe(xt,"click",Wt(l[31])),Qe(kl,"click",Wt(l[32])),Qe(wn,"click",Wt(l[33])),Qe(Ke,"click",l[11]),Oi(Jl=z1.call(null,e,l[34])),Qe(Zl,"change",l[35]),Qe(dn,"change",l[37])],ka=!0)},p(Me,Rl){(!fl||Rl[0]&1)&&Ve(o,"is-disabled",!Me[0]),(!fl||Rl[0]&1)&&Ve(A,"is-disabled",!Me[0]),(!fl||Rl[0]&1)&&Ve(P,"is-disabled",!Me[0]),(!fl||Rl[0]&1)&&Ve(x,"is-disabled",!Me[0]),(!fl||Rl[0]&1)&&Ve(Ne,"is-disabled",!Me[0]),(!fl||Rl[0]&1)&&Ve(Ce,"is-disabled",!Me[0]),(!fl||Rl[0]&1)&&Ve(Gt,"is-disabled",!Me[0]),(!fl||Rl[0]&1)&&Ve(kt,"is-disabled",!Me[0]),(!fl||Rl[0]&1)&&Ve(xt,"is-disabled",!Me[0]),(!fl||Rl[0]&4)&&Ve(kl,"is-disabled",Me[2]&&!Me[2][0]);let ta=_l;_l=o2(Me),_l===ta?Tn[_l].p(Me,Rl):(st(),T(Tn[ta],1,1,()=>{Tn[ta]=null}),ot(),en=Tn[_l],en?en.p(Me,Rl):(en=Tn[_l]=s2[_l](Me),en.c()),H(en,1),en.m(wn,null)),(!fl||Rl[0]&2&&El!==(El="dropdown "+Me[1]))&&h(e,"class",El),Jl&&$a(Jl.update)&&Rl[0]&8&&Jl.update.call(null,Me[34]),(!fl||Rl[0]&10)&&Ve(e,"is-active",Me[3])},i(Me){fl||(H(r.$$.fragment,Me),H(m.$$.fragment,Me),H(f.$$.fragment,Me),H(C.$$.fragment,Me),H(z.$$.fragment,Me),H(de.$$.fragment,Me),H(Ie.$$.fragment,Me),H(pe.$$.fragment,Me),H(tt.$$.fragment,Me),H(wt.$$.fragment,Me),H(Dt.$$.fragment,Me),H(gl.$$.fragment,Me),H(Wl.$$.fragment,Me),H(Tl.$$.fragment,Me),H(at.$$.fragment,Me),H(Ln.$$.fragment,Me),H(en),H(al.$$.fragment,Me),fl=!0)},o(Me){T(r.$$.fragment,Me),T(m.$$.fragment,Me),T(f.$$.fragment,Me),T(C.$$.fragment,Me),T(z.$$.fragment,Me),T(de.$$.fragment,Me),T(Ie.$$.fragment,Me),T(pe.$$.fragment,Me),T(tt.$$.fragment,Me),T(wt.$$.fragment,Me),T(Dt.$$.fragment,Me),T(gl.$$.fragment,Me),T(Wl.$$.fragment,Me),T(Tl.$$.fragment,Me),T(at.$$.fragment,Me),T(Ln.$$.fragment,Me),T(en),T(al.$$.fragment,Me),fl=!1},d(Me){Me&&O(e),Ye(r),Ye(m),Ye(f),Ye(C),Ye(z),Ye(de),Ye(Ie),Ye(pe),Ye(tt),Ye(wt),Ye(Dt),Ye(gl),Ye(Wl),Ye(Tl),Ye(at),Ye(Ln),Tn[_l].d(),Ye(al),Me&&O(Nn),Me&&O(Zl),l[36](null),Me&&O(In),Me&&O(dn),l[38](null),ka=!1,Hl(qt)}}}function bh(){try{let l={};for(let i=0;it(6,a=pe)),tl(l,Dn,pe=>t(40,r=pe)),tl(l,pa,pe=>t(41,c=pe)),tl(l,il,pe=>t(2,i=pe)),tl(l,M1,pe=>t(7,s=pe));let{chatId:o}=e;const I=(pe=!0)=>{t(3,u=pe)};let{style:m="is-right"}=e,u=!1,p,R;const E=pe=>{f();const mt=pe.target.files[0];pe.target.value=null;const Le=new FileReader;Le.readAsText(mt),Le.onload=Ue=>{const Nt=(Ue.target||{}).result;AG(Nt)}},W=()=>{f(),ma(Ka,{title:"Delete Chat",message:"Are you sure you want to delete this chat?",class:"is-warning",confirmButtonClass:"is-warning",confirmButton:"Delete Chat",onConfirm:()=>{const pe=Kn(o),mt=n.indexOf(pe),Le=n[mt-1],Nt=n[mt+1]||Le;Nt?ia(`/chat/${Nt.id}`).then(()=>{z2(o)}):ia("/").then(()=>{z2(o)})}})},X=()=>{n.length&&(f(),ma(Ka,{title:"Delete ALL Chat",message:"Are you sure you want to delete ALL of your chats?",class:"is-danger",confirmButtonClass:"is-danger",confirmButton:"Delete ALL",onConfirm:()=>{ia("/").then(()=>{z2(o)}),fG()}}))},f=()=>{wl(pa,c=!1,c),t(3,u=!1)},Q=()=>{f(),q2(o),wl(Dn,r++,r)},F=()=>{f(),wa("hideSummarized",!a.hideSummarized)},A=()=>{ma(Ka,{title:"Clear Chat Usage",message:"Are you sure you want to clear your token usage stats for the current chat?",class:"is-warning",confirmButtonClass:"is-warning",confirmButton:"Clear Usage",onConfirm:()=>{const pe=Kn(o);pe.usage={},vn()}})},Y=pe=>{const mt=pe.target.files[0];pe.target.value=null;const Le=new FileReader;Le.onload=Ue=>{const Nt=(Ue.target||{}).result;try{const Gt=JSON.parse(Nt);Gt.profileName=U1(Gt.profileName||""),Gt.profile=null,w1(Gt),ma(Ka,{title:"Profile Restored",class:"is-info",message:"Profile restored as:
"+Pu(Gt.profileName)+"

Start new chat with this profile?",asHtml:!0,onConfirm:()=>{$i(o,Gt)},onCancel:()=>{}})}catch(Gt){hn("Unable to import profile:",Gt)}},Le.onerror=Ue=>{hn("Unable to import profile:",new Error("Unknown error"))},Le.readAsText(mt)},C=()=>{t(3,u=!u)},U=()=>{o&&f(),wl(M1,s=!0,s)},ce=()=>{fn()&&f(),fn()&&$i()},P=()=>{o&&f(),o&&Ku(o)},K=()=>{o&&f(),HG(o)},z=()=>{o&&Q()},re=()=>{o&&f(),em(o)},ge=()=>{o&&f(),A()},_e=()=>{f(),nh(o)},Xe=()=>{o&&f(),p.click()},x=()=>{o&&f(),lh(o)},M=()=>{o&&f(),R.click()},de=()=>{f(),bh()},ve=()=>{o&&f(),ph(),uh()},Ge=()=>{o&&f(),W()},Ne=()=>{X()},oe=()=>{o&&F()},Ie=()=>{t(3,u=!1)},ae=pe=>E(pe);function He(pe){_n[pe?"unshift":"push"](()=>{p=pe,t(4,p)})}const Ce=pe=>Y(pe);function ke(pe){_n[pe?"unshift":"push"](()=>{R=pe,t(5,R)})}return l.$$set=pe=>{"chatId"in pe&&t(0,o=pe.chatId),"style"in pe&&t(1,m=pe.style)},l.$$.update=()=>{l.$$.dirty[0]&4&&(n=i.sort((pe,mt)=>mt.id-pe.id))},[o,m,i,u,p,R,a,s,E,W,X,f,Q,F,A,Y,I,C,U,ce,P,K,z,re,ge,_e,Xe,x,M,de,ve,Ge,Ne,oe,Ie,ae,He,Ce,ke]}class nm extends Qt{constructor(e){super(),St(this,e,Gh,mh,Vt,{chatId:0,show:16,style:1},null,[-1,-1])}get show(){return this.$$.ctx[16]}}function hh(l){let e,t,n,a,r,c;return n=new ht({props:{icon:jp}}),{c(){e=_("button"),t=_("span"),we(n.$$.fragment),h(t,"class","icon"),h(e,"class","button")},m(i,s){D(i,e,s),V(e,t),Fe(n,t,null),a=!0,r||(c=Qe(e,"click",g2(l[4])),r=!0)},p:lt,i(i){a||(H(n.$$.fragment,i),a=!0)},o(i){T(n.$$.fragment,i),a=!1},d(i){i&&O(e),Ye(n),r=!1,c()}}}function Zh(l){let e,t,n,a,r,c;return n=new ht({props:{icon:IG}}),{c(){e=_("button"),t=_("span"),we(n.$$.fragment),h(t,"class","icon"),h(e,"class","button")},m(i,s){D(i,e,s),V(e,t),Fe(n,t,null),a=!0,r||(c=Qe(e,"click",g2(l[3])),r=!0)},p:lt,i(i){a||(H(n.$$.fragment,i),a=!0)},o(i){T(n.$$.fragment,i),a=!1},d(i){i&&O(e),Ye(n),r=!1,c()}}}function Rh(l){let e,t,n,a,r,c,i,s,o,I,m,u,p,R,E,W;const X=[Zh,hh],f=[];function Q(Y,C){return Y[1]?0:1}a=Q(l),r=f[a]=X[a](l);function F(Y){l[5](Y)}let A={};return l[0]!==void 0&&(A.chatId=l[0]),R=new nm({props:A}),_n.push(()=>_2(R,"chatId",F)),{c(){e=_("nav"),t=_("div"),n=_("div"),r.c(),c=he(),i=_("a"),s=_("img"),I=he(),m=_("p"),m.textContent="ChatGPT-web",u=he(),p=_("div"),we(R.$$.fragment),h(n,"class","navbar-item"),e2(s.src,o=lm)||h(s,"src",o),h(s,"alt","ChatGPT-web"),h(s,"width","24"),h(s,"height","24"),h(m,"class","ml-2 is-size-6 has-text-weight-bold"),h(i,"class","navbar-item"),h(i,"href","#/"),h(p,"class","chat-option-menu navbar-item is-pulled-right"),h(t,"class","navbar-brand"),h(e,"class","navbar is-fixed-top"),h(e,"aria-label","main navigation")},m(Y,C){D(Y,e,C),V(e,t),V(t,n),f[a].m(n,null),V(t,c),V(t,i),V(i,s),V(i,I),V(i,m),V(t,u),V(t,p),Fe(R,p,null),W=!0},p(Y,[C]){let U=a;a=Q(Y),a===U?f[a].p(Y,C):(st(),T(f[U],1,1,()=>{f[U]=null}),ot(),r=f[a],r?r.p(Y,C):(r=f[a]=X[a](Y),r.c()),H(r,1),r.m(n,null));const ce={};!E&&C&1&&(E=!0,ce.chatId=Y[0],y2(()=>E=!1)),R.$set(ce)},i(Y){W||(H(r),H(R.$$.fragment,Y),W=!0)},o(Y){T(r),T(R.$$.fragment,Y),W=!1},d(Y){Y&&O(e),f[a].d(),Ye(R)}}}function Nh(l,e,t){let n,a,r;tl(l,T1,o=>t(2,a=o)),tl(l,pa,o=>t(1,r=o));const c=()=>{wl(pa,r=!1,r)},i=()=>{wl(pa,r=!0,r)};function s(o){n=o,t(0,n),t(2,a)}return l.$$.update=()=>{l.$$.dirty&4&&t(0,n=a&&a.chatId?parseInt(a.chatId):void 0)},[n,r,a,c,i,s]}class gh extends Qt{constructor(e){super(),St(this,e,Nh,Rh,Vt,{})}}function Wh(l){let e,t,n,a,r,c,i=(l[0].name||`Chat ${l[0].id}`)+"",s,o,I,m,u;const p=[vh,Vh],R=[];function E(W,X){return W[3]?0:1}return t=E(l),n=R[t]=p[t](l),c=new ht({props:{class:"mr-2 chat-icon",size:"xs",icon:qG}}),{c(){e=_("a"),n.c(),a=he(),r=_("span"),we(c.$$.fragment),s=bt(i),h(r,"class","chat-item-name"),h(e,"href",o=`#/chat/${l[0].id}`),h(e,"class","chat-menu-item"),Ve(e,"is-waiting",l[3]),Ve(e,"is-disabled",!fn()),Ve(e,"is-active",l[1]===l[0].id)},m(W,X){D(W,e,X),R[t].m(e,null),V(e,a),V(e,r),Fe(c,r,null),V(r,s),I=!0,m||(u=Qe(e,"click",l[15]),m=!0)},p(W,X){let f=t;t=E(W),t===f?R[t].p(W,X):(st(),T(R[f],1,1,()=>{R[f]=null}),ot(),n=R[t],n?n.p(W,X):(n=R[t]=p[t](W),n.c()),H(n,1),n.m(e,a)),(!I||X&1)&&i!==(i=(W[0].name||`Chat ${W[0].id}`)+"")&&bl(s,i),(!I||X&1&&o!==(o=`#/chat/${W[0].id}`))&&h(e,"href",o),(!I||X&8)&&Ve(e,"is-waiting",W[3]),(!I||X&3)&&Ve(e,"is-active",W[1]===W[0].id)},i(W){I||(H(n),H(c.$$.fragment,W),I=!0)},o(W){T(n),T(c.$$.fragment,W),I=!1},d(W){W&&O(e),R[t].d(),Ye(c),m=!1,u()}}}function Eh(l){let e,t,n,a;return{c(){e=_("div"),h(e,"id",t="chat-menu-item-"+l[0].id),h(e,"class","chat-name-editor"),h(e,"contenteditable",""),l[0].name===void 0&&Y0(()=>l[11].call(e))},m(r,c){D(r,e,c),l[0].name!==void 0&&(e.innerText=l[0].name),n||(a=[Qe(e,"keydown",l[5]),Qe(e,"input",l[11]),Qe(e,"blur",l[6])],n=!0)},p(r,c){c&1&&t!==(t="chat-menu-item-"+r[0].id)&&h(e,"id",t),c&1&&r[0].name!==e.innerText&&(e.innerText=r[0].name)},i:lt,o:lt,d(r){r&&O(e),n=!1,Hl(a)}}}function Vh(l){let e,t,n,a,r,c,i,s;return t=new ht({props:{icon:Kp}}),r=new ht({props:{icon:sr}}),{c(){e=_("a"),we(t.$$.fragment),n=he(),a=_("a"),we(r.$$.fragment),h(e,"class","is-pulled-right is-hidden px-1 py-0 has-text-weight-bold edit-button"),h(e,"href","$"),h(a,"class","is-pulled-right is-hidden px-1 py-0 has-text-weight-bold delete-button"),h(a,"href","$")},m(o,I){D(o,e,I),Fe(t,e,null),D(o,n,I),D(o,a,I),Fe(r,a,null),c=!0,i||(s=[Qe(e,"click",Wt(l[13])),Qe(a,"click",Wt(l[14]))],i=!0)},p:lt,i(o){c||(H(t.$$.fragment,o),H(r.$$.fragment,o),c=!0)},o(o){T(t.$$.fragment,o),T(r.$$.fragment,o),c=!1},d(o){o&&O(e),Ye(t),o&&O(n),o&&O(a),Ye(r),i=!1,Hl(s)}}}function vh(l){let e,t,n,a,r;return t=new ht({props:{icon:ir}}),{c(){e=_("a"),we(t.$$.fragment),h(e,"class","is-pulled-right is-hidden px-1 py-0 has-text-weight-bold delete-button"),h(e,"href","$")},m(c,i){D(c,e,i),Fe(t,e,null),n=!0,a||(r=Qe(e,"click",Wt(l[12])),a=!0)},p:lt,i(c){n||(H(t.$$.fragment,c),n=!0)},o(c){T(t.$$.fragment,c),n=!1},d(c){c&&O(e),Ye(t),a=!1,r()}}}function yh(l){let e,t,n,a;const r=[Eh,Wh],c=[];function i(s,o){return s[2]?0:1}return t=i(l),n=c[t]=r[t](l),{c(){e=_("li"),n.c()},m(s,o){D(s,e,o),c[t].m(e,null),a=!0},p(s,[o]){let I=t;t=i(s),t===I?c[t].p(s,o):(st(),T(c[I],1,1,()=>{c[I]=null}),ot(),n=c[t],n?n.p(s,o):(n=c[t]=r[t](s),n.c()),H(n,1),n.m(e,null))},i(s){a||(H(n),a=!0)},o(s){T(n),a=!1},d(s){s&&O(e),c[t].d()}}}function _h(l,e,t){let n;tl(l,pa,F=>t(4,n=F));let{chat:a}=e,{activeChatId:r}=e,{prevChat:c}=e,{nextChat:i}=e,s=!1,o,I=0;sa(async()=>{a.name||t(0,a.name=`Chat ${a.id}`,a)});const m=F=>{F.key==="Escape"&&(F.stopPropagation(),F.preventDefault(),t(0,a.name=o,a),t(2,s=!1)),(F.key==="Tab"||F.key==="Enter")&&(F.stopPropagation(),F.preventDefault(),u())},u=()=>{if(t(2,s=!1),!a.name){t(0,a.name=o,a);return}vn()},p=()=>{if(!I){t(3,I=setTimeout(()=>{t(3,I=0)},1e3));return}if(clearTimeout(I),t(3,I=0),r===a.id){const F=i||c;F?ia(`/chat/${F.id}`).then(()=>{z2(a.id)}):ia("/").then(()=>{z2(a.id)})}else z2(a.id)},R=()=>{o=a.name,t(2,s=!0),setTimeout(()=>{const F=document.getElementById(`chat-menu-item-${a.id}`);F&&F.focus()},0)};function E(){a.name=this.innerText,t(0,a)}const W=()=>p(),X=()=>R(),f=()=>p(),Q=()=>{wl(pa,n=!1,n)};return l.$$set=F=>{"chat"in F&&t(0,a=F.chat),"activeChatId"in F&&t(1,r=F.activeChatId),"prevChat"in F&&t(9,c=F.prevChat),"nextChat"in F&&t(10,i=F.nextChat)},[a,r,s,I,n,m,u,p,R,c,i,E,W,X,f,Q]}class Xh extends Qt{constructor(e){super(),St(this,e,_h,yh,Vt,{chat:0,activeChatId:1,prevChat:9,nextChat:10})}}function u9(l,e,t){const n=l.slice();return n[18]=e[t],n}function p9(l,e,t){const n=l.slice();return n[21]=e[t],n[23]=t,n}function Fh(l){let e=l[0],t,n,a=Z9(l);return{c(){a.c(),t=Et()},m(r,c){a.m(r,c),D(r,t,c),n=!0},p(r,c){c&1&&Vt(e,e=r[0])?(st(),T(a,1,1,lt),ot(),a=Z9(r),a.c(),H(a,1),a.m(t.parentNode,t)):a.p(r,c)},i(r){n||(H(a),n=!0)},o(r){T(a),n=!1},d(r){r&&O(t),a.d(r)}}}function Yh(l){let e;return{c(){e=_("li"),e.innerHTML='No chats yet...'},m(t,n){D(t,e,n)},p:lt,i:lt,o:lt,d(t){t&&O(e)}}}function G9(l){let e,t;return e=new Xh({props:{activeChatId:l[5],chat:l[21],prevChat:l[4][l[23]-1],nextChat:l[4][l[23]+1]}}),{c(){we(e.$$.fragment)},m(n,a){Fe(e,n,a),t=!0},p(n,a){const r={};a&32&&(r.activeChatId=n[5]),a&16&&(r.chat=n[21]),a&16&&(r.prevChat=n[4][n[23]-1]),a&16&&(r.nextChat=n[4][n[23]+1]),e.$set(r)},i(n){t||(H(e.$$.fragment,n),t=!0)},o(n){T(e.$$.fragment,n),t=!1},d(n){Ye(e,n)}}}function h9(l){let e=l[21].id,t,n,a=G9(l);return{c(){a.c(),t=Et()},m(r,c){a.m(r,c),D(r,t,c),n=!0},p(r,c){c&16&&Vt(e,e=r[21].id)?(st(),T(a,1,1,lt),ot(),a=G9(r),a.c(),H(a,1),a.m(t.parentNode,t)):a.p(r,c)},i(r){n||(H(a),n=!0)},o(r){T(a),n=!1},d(r){r&&O(t),a.d(r)}}}function Z9(l){let e,t,n=l[4],a=[];for(let c=0;cT(a[c],1,1,()=>{a[c]=null});return{c(){for(let c=0;c_2(m,"chatId",Le));const Nt=[Yh,Fh],Gt=[];function ye(et,vt){return et[4].length===0?0:1}E=ye(l),W=Gt[E]=Nt[E](l),U=new ht({props:{icon:l[1].icon}});let tt=Object.values(j2),Ae=[];for(let et=0;etT(Ae[et],1,1,()=>{Ae[et]=null});x=new ht({props:{icon:V0}}),Ne=new ht({props:{icon:w0}});const fe=[Ah,wh],Ct=[];function wt(et,vt){return et[2]?1:0}return ae=wt(l),He=Ct[ae]=fe[ae](l),{c(){e=_("aside"),t=_("div"),t.textContent="V25-06-15 15:54:47",n=he(),a=_("div"),r=_("div"),c=_("a"),i=_("img"),o=he(),I=_("div"),we(m.$$.fragment),p=he(),R=_("ul"),W.c(),X=he(),f=_("div"),Q=_("div"),F=_("div"),A=_("div"),Y=_("button"),C=_("span"),we(U.$$.fragment),ce=he(),P=_("div"),K=_("div");for(let et=0;etu=!1)),m.$set(kt);let zt=E;E=ye(et),E===zt?Gt[E].p(et,vt):(st(),T(Gt[zt],1,1,()=>{Gt[zt]=null}),ot(),W=Gt[E],W?W.p(et,vt):(W=Gt[E]=Nt[E](et),W.c()),H(W,1),W.m(R,null));const Dt={};if(vt&2&&(Dt.icon=et[1].icon),U.$set(Dt),vt&10){tt=Object.values(j2);let xe;for(xe=0;xe{Ct[ze]=null}),ot(),He=Ct[ae],He?He.p(et,vt):(He=Ct[ae]=fe[ae](et),He.c()),H(He,1),He.m(Ie,null)),Ce&&$a(Ce.update)&&vt&64&&Ce.update.call(null,et[16]),(!ke||vt&64)&&Ve(e,"pinned",et[6])},i(et){if(!ke){H(m.$$.fragment,et),H(W),H(U.$$.fragment,et);for(let vt=0;vtt(0,r=A)),tl(l,il,A=>t(7,c=A)),tl(l,T1,A=>t(8,i=A)),tl(l,pa,A=>t(6,s=A));let o=Pr(),I=fn();const m=(...A)=>{t(1,o=Pr()),t(4,n=c.sort(o.sortFn)),t(2,I=fn())};let u=!1;sa(()=>{});function p(A){a=A,t(5,a),t(8,i)}const R=()=>{t(3,u=!u)},E=A=>{t(3,u=!1),UG(A.value)},W=()=>{t(3,u=!1)},X=()=>{Qh()},f=()=>{Sh()},Q=()=>{wl(pa,s=!1,s),$i()},F=()=>{wl(pa,s=!1,s)};return l.$$.update=()=>{l.$$.dirty&128&&t(4,n=c.sort(Pr().sortFn)),l.$$.dirty&256&&t(5,a=i&&i.chatId?parseInt(i.chatId):void 0),l.$$.dirty&1&&m(r)},[r,o,I,u,n,a,s,c,i,p,R,E,W,X,f,Q,F]}class Lh extends Qt{constructor(e){super(),St(this,e,Hh,fh,Vt,{})}}function Th(l){let e,t,n,a,r,c,i;const s=l[4].default,o=ul(s,l,l[3],null);return{c(){e=_("div"),t=he(),n=_("div"),a=he(),r=_("div"),o&&o.c(),h(e,"class","lower-mask section-footer-mask"),Ve(e,"pin-footer",l[1]),h(n,"class","lower-mask2"),Ve(n,"strong-mask",l[2]),h(r,"class",c="section-footer "+l[0]),Ve(r,"pin-footer",l[1])},m(I,m){D(I,e,m),D(I,t,m),D(I,n,m),D(I,a,m),D(I,r,m),o&&o.m(r,null),i=!0},p(I,[m]){(!i||m&2)&&Ve(e,"pin-footer",I[1]),(!i||m&4)&&Ve(n,"strong-mask",I[2]),o&&o.p&&(!i||m&8)&&Gl(o,s,I,I[3],i?pl(s,I[3],m,null):hl(I[3]),null),(!i||m&1&&c!==(c="section-footer "+I[0]))&&h(r,"class",c),(!i||m&3)&&Ve(r,"pin-footer",I[1])},i(I){i||(H(o,I),i=!0)},o(I){T(o,I),i=!1},d(I){I&&O(e),I&&O(t),I&&O(n),I&&O(a),I&&O(r),o&&o.d(I)}}}function Ch(l,e,t){let{$$slots:n={},$$scope:a}=e,{class:r=""}=e,{pin:c=!1}=e,{strongMask:i=!1}=e;return l.$$set=s=>{"class"in s&&t(0,r=s.class),"pin"in s&&t(1,c=s.pin),"strongMask"in s&&t(2,i=s.strongMask),"$$scope"in s&&t(3,a=s.$$scope)},[r,c,i,a,n]}class am extends Qt{constructor(e){super(),St(this,e,Ch,Th,Vt,{class:0,pin:1,strongMask:2})}}function N9(l){let e;return{c(){e=_("p"),e.innerHTML=`Please enter your OpenAI API key above to use Open AI's ChatGPT API. At least one API must be enabled to use ChatGPT-web.`,Ve(e,"is-danger",!l[2]),Ve(e,"is-warning",!l[3])},m(t,n){D(t,e,n)},p(t,n){n&4&&Ve(e,"is-danger",!t[2]),n&8&&Ve(e,"is-warning",!t[3])},d(t){t&&O(e)}}}function g9(l){let e,t,n,a,r,c,i,s,o,I,m,u,p,R,E,W,X,f,Q,F=!l[1]&&W9();return{c(){e=_("p"),e.textContent="Set Petals API Endpoint:",t=he(),n=_("form"),a=_("p"),r=_("input"),i=he(),s=_("p"),s.innerHTML='',o=he(),F&&F.c(),I=he(),m=_("p"),m.innerHTML='Petals lets you run large language models at home by connecting to a public swarm, BitTorrent-style, without hefty GPU requirements.',u=he(),p=_("p"),p.innerHTML='You are encouraged to set up a Petals server to share your GPU resources with the public swarm. Minimum requirements to contribute Llama 2 completions are a GTX 1080 8GB, but the larger/faster the better.',R=he(),E=_("p"),E.innerHTML='If you're receiving errors while using Petals, check swarm health and consider adding your GPU to the swarm to help.',W=he(),X=_("p"),X.innerHTML="Because Petals uses a public swarm, do not send sensitive information when using Petals.",h(r,"aria-label","PetalsAPI Endpoint"),h(r,"type","text"),h(r,"class","input"),h(r,"placeholder",Fp()+y7()),r.value=c=l[4].pedalsEndpoint||"",h(a,"class","control is-expanded"),h(s,"class","control"),h(n,"class","field has-addons has-addons-right"),h(m,"class","my-4"),h(p,"class","mb-4"),h(E,"class","mb-4"),h(X,"class","help is-warning")},m(A,Y){D(A,e,Y),D(A,t,Y),D(A,n,Y),V(n,a),V(a,r),V(n,i),V(n,s),D(A,o,Y),F&&F.m(A,Y),D(A,I,Y),D(A,m,Y),D(A,u,Y),D(A,p,Y),D(A,R,Y),D(A,E,Y),D(A,W,Y),D(A,X,Y),f||(Q=Qe(n,"submit",Wt(l[9])),f=!0)},p(A,Y){Y&16&&c!==(c=A[4].pedalsEndpoint||"")&&r.value!==c&&(r.value=c),A[1]?F&&(F.d(1),F=null):F||(F=W9(),F.c(),F.m(I.parentNode,I))},d(A){A&&O(e),A&&O(t),A&&O(n),A&&O(o),F&&F.d(A),A&&O(I),A&&O(m),A&&O(u),A&&O(p),A&&O(R),A&&O(E),A&&O(W),A&&O(X),f=!1,Q()}}}function W9(l){let e;return{c(){e=_("p"),e.innerHTML='Please only use the default public API for testing. It's best to configure a private endpoint and enter it above for connection to the Petals swarm.',h(e,"class","help is-warning")},m(t,n){D(t,e,n)},d(t){t&&O(e)}}}function E9(l){let e;return{c(){e=_("article"),e.innerHTML=`
Select an existing chat on the sidebar, or create a new chat
`,h(e,"class","message is-info")},m(t,n){D(t,e,n)},d(t){t&&O(e)}}}function kh(l){let e,t,n,a,r,c,i,s,o,I,m,u,p,R,E,W,X,f,Q,F,A,Y,C,U,ce,P,K,z,re,ge,_e,Xe,x,M,de,ve,Ge=!l[3]&&N9(l),Ne=l[0]&&g9(l),oe=l[3]&&E9();return x=new am({props:{pin:!0}}),{c(){e=_("section"),t=_("article"),t.innerHTML=`

ChatGPT-web is a simple one-page web interface to the OpenAI ChatGPT API. To use it, you need to register for diff --git a/index.html b/index.html index a31ece8..2e03e2a 100644 --- a/index.html +++ b/index.html @@ -8,7 +8,7 @@ ChatGPT-web - +