import{B as ae}from"./BaseLayout.80914213.js";import{d as z,e as f,f as w,g as H,X as se,ah as oe,r as F,o,Y as m,b as t,w as a,u as e,dh as d,bL as re,e8 as P,aS as S,e9 as E,a as q,dc as c,aG as n,ea as b,c as _,S as y,db as ne,by as le,bT as K,eb as ie,K as U,a0 as ue,ec as ce}from"./index.97914b50.js";import{S as de,L as pe,N as fe}from"./log.248affe4.js";import{A as j}from"./index.0b2fdcf7.js";import{A as me}from"./Avatar.cdeaa917.js";import{L as ye}from"./LoadingOutlined.8561fed3.js";import"./AbstraLogo.vue_vue_type_script_setup_true_lang.95adbf15.js";import"./Logo.6a7a7f34.js";import"./AbstraButton.vue_vue_type_script_setup_true_lang.0da4bf97.js";import"./PhArrowCounterClockwise.vue.257d4655.js";import"./PhRocket.vue.86060d85.js";import"./PhChats.vue.37272b62.js";import"./linters.188b2aea.js";import"./asyncComputed.d84da1aa.js";import"./workspaces.a92903a0.js";import"./workspaceStore.6144f2aa.js";import"./url.9121ac6e.js";import"./colorHelpers.7fae6e3b.js";import"./record.a76b6b89.js";import"./polling.fe90557c.js";import"./PhArrowSquareOut.vue.b58f5f7f.js";import"./PhSignOut.vue.270e1c2a.js";import"./editor.e84f7036.js";import"./index.40a20e0a.js";import"./CloseCircleOutlined.fc1860d9.js";import"./CheckCircleFilled.bab98a0c.js";import"./index.19726194.js";import"./popupNotifcation.f5d6fec9.js";import"./ai.12870894.js";import"./uuid.b673ebc8.js";import"./PhCheckCircle.vue.f4aa7f73.js";import"./PhCopySimple.vue.e5146dd4.js";import"./scripts.1d59675c.js";import"./controller.c81f704b.js";import"./vue-flow-core.86a9be3c.js";import"./validations.eaae2ef3.js";import"./string.8b027234.js";import"./metadata.626e405f.js";import"./PhRobot.vue.9e5bcd4c.js";import"./PhWebhooksLogo.vue.c83b69f4.js";import"./controller.de82b471.js";import"./gateway.f03e4b27.js";import"./fetch.223a1647.js";import"./PhPencil.vue.19daefd9.js";(function(){try{var v=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},u=new Error().stack;u&&(v._sentryDebugIds=v._sentryDebugIds||{},v._sentryDebugIds[u]="0e3388df-b2e6-4dfd-a7f8-0f6d243f3f6e",v._sentryDebugIdIdentifier="sentry-dbid-0e3388df-b2e6-4dfd-a7f8-0f6d243f3f6e")}catch{}})();const _e=["onKeydown"],ve={key:0,class:"entry"},ge={class:"entry-owner"},we={key:1,class:"entry"},be={class:"entry-owner"},ke="Smart Chat",Y="You",he=.98,Ce=z({__name:"OmniChat",setup(v){const u=pe.create(),l=new de(u,null),p=f(!1),k=f(null),C=f(""),$=w(()=>l.getVisibleActions()),M=w(()=>l.isLoadingActions()),B=w(()=>l.isAnswering()),D=w(()=>l.isProcessing()),G=w(()=>!D.value&&!B.value);H(()=>M.value,()=>{setTimeout(()=>{W()},100)});const i=f(null),L=f(!0),I=f(!1),A=f(!1),W=()=>{L.value=!0,i.value&&(i.value.scrollTop=i.value.scrollHeight)},N=()=>{if(!i.value)return;const{scrollTop:s,scrollHeight:g,clientHeight:T}=i.value;s+T>=g*he?(L.value=!0,I.value=!1):(L.value=!1,I.value=!0)},X=w(()=>B.value?"Answering...":D.value?"Processing...":"Type your question and press Enter"),J=()=>{p.value=!0,U(()=>O())},h=()=>{p.value=!1},O=()=>{k.value&&k.value.focus()},Q=s=>{s.target===s.currentTarget&&h()},R=s=>{if((s.metaKey||s.ctrlKey)&&s.key==="k"){s.preventDefault(),A.value=!0;return}A.value&&s.key==="i"&&(s.preventDefault(),p.value?h():J(),A.value=!1),s.metaKey||s.ctrlKey||(A.value=!1),s.key==="Escape"&&p.value&&h()};H(p,s=>{s&&U(()=>{O()})});const Z=async()=>{await l.setupThread(),l.clearActions(),u.clear()},ee=async()=>{l.setInput(C.value),C.value="",await l.send(null)};return se(()=>{l.setupThread(),window.addEventListener("keydown",R),i.value&&i.value.addEventListener("scroll",N)}),oe(()=>{window.removeEventListener("keydown",R),i.value&&i.value.removeEventListener("scroll",N)}),(s,g)=>{const T=F("Markdown");return p.value?(o(),m("div",{key:0,class:"container",justify:"center",align:"center",onKeydown:P(h,["esc"]),onClick:Q},[t(e(d),{class:"modal",vertical:"",onClick:g[1]||(g[1]=ie(()=>{},["stop"]))},{default:a(()=>[t(e(d),{class:"upper"},{default:a(()=>[t(e(re),{ref_key:"inputRef",ref:k,value:C.value,"onUpdate:value":g[0]||(g[0]=r=>C.value=r),bordered:!1,placeholder:"Ask a question",size:"large",onKeydown:P(ee,["enter"])},null,8,["value","onKeydown"])]),_:1}),t(e(d),{ref_key:"entriesContainer",ref:i,class:"content"},{default:a(()=>[(o(!0),m(S,null,E(e(u).logs,(r,V)=>(o(),m("div",{key:V},[r.type==="ai-output"?(o(),m("div",ve,[q("div",ge,[t(e(c),{strong:""},{default:a(()=>[n(b(ke))]),_:1})]),r.type==="ai-output"?(o(),_(T,{key:0,source:r.log,class:"entry-text"},null,8,["source"])):y("",!0)])):y("",!0),r.type==="ai-input"?(o(),m("div",we,[q("div",be,[t(e(me),{size:24,shape:"square"},{default:a(()=>{var x;return[n(b((x=Y[0])!=null?x:"Y"),1)]}),_:1}),t(e(c),{strong:""},{default:a(()=>[n(b(Y))]),_:1})]),(o(!0),m(S,null,E(r.log.split(`
`),(x,te)=>(o(),_(e(ne),{key:te},{default:a(()=>[n(b(x),1)]),_:2},1024))),128))])):y("",!0)]))),128)),e(u).hasAiLogs()?y("",!0):(o(),_(e(d),{key:0,vertical:"",justify:"center",align:"center",class:"empty-container"},{default:a(()=>[t(e(c),null,{default:a(()=>[n("Ask anything!")]),_:1}),t(e(c),{type:"secondary"},{default:a(()=>[n("No messages yet")]),_:1})]),_:1})),t(e(d),{gap:"small",style:{"margin-bottom":"20px"},wrap:"wrap"},{default:a(()=>[M.value?(o(),_(e(le),{key:0,style:{"margin-bottom":"20px"}})):y("",!0),(o(!0),m(S,null,E($.value,r=>(o(),_(e(K),{key:r.label,type:"primary",disabled:r.disabled,loading:r.loading,onClick:V=>r.execute()},{default:a(()=>[n(b(r.label),1)]),_:2},1032,["disabled","loading","onClick"]))),128))]),_:1})]),_:1},512),t(e(d),{class:"lower",align:"center",justify:"space-between"},{default:a(()=>[t(e(d),{align:"center",gap:"small"},{default:a(()=>[t(e(c),{type:"secondary"},{default:a(()=>[n("Omni Chat")]),_:1}),t(e(j),{type:"vertical"}),t(e(c),{type:"secondary"},{default:a(()=>[n(b(X.value),1)]),_:1}),G.value?y("",!0):(o(),_(e(ye),{key:0,style:{"margin-left":"6px",color:"rgba(0, 0, 0, 0.45)"}}))]),_:1}),t(e(d),{align:"center",gap:"small"},{default:a(()=>[t(e(K),{class:"close-button",type:"text",onClick:Z},{default:a(()=>[t(e(c),{type:"secondary"},{default:a(()=>[n("Clear messages")]),_:1})]),_:1}),t(e(j),{type:"vertical"}),t(e(K),{class:"close-button",type:"text",onClick:h},{default:a(()=>[t(e(c),{type:"secondary"},{default:a(()=>[n("Close")]),_:1}),t(e(c),{keyboard:""},{default:a(()=>[n("Esc")]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})],40,_e)):y("",!0)}}});const Ae=ue(Ce,[["__scopeId","data-v-e4dbb5dc"]]),yt=z({__name:"Workspace",setup(v){const u=ce();return(l,p)=>{const k=F("RouterView");return o(),_(ae,null,{navbar:a(()=>[t(fe,{"page-title":e(u).meta.title},null,8,["page-title"])]),content:a(()=>[t(Ae),n(),t(k)]),_:1})}}});export{yt as default};
//# sourceMappingURL=Workspace.fd0d413e.js.map
