@questdb/web-console 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,1048 +0,0 @@
1
- import{p as le,Q as yt,s as je,u as Te,a as Fa,j as t,A as it,K as Lt,c as r,B as ue,b as st,t as _e,C as He,e as Ze,d as Dt,f as S,g as Ra,h as xt,i as Ct,k as Tt,l as za,m as $a,n as Ft,o as Ba,q as be,r as wt,v as Rt,w as Qa,T as Wa,x as zt,y as $t,z as Oa,D as Bt,S as Ka,L as Pe,E as Pa,F as de,G as Qt,H as bt,I as Ua,J as Ga,M as Ae,N as At,O as Ya,P as Xa,R as vt,U as Fe,V as Ja,W as Wt,X as en,Y as tn,Z as an,_ as nn,$ as rn,a0 as sn,a1 as on,a2 as ln,a3 as dn,a4 as Ot,a5 as cn,a6 as hn,a7 as mn,a8 as ge,a9 as un,aa as gn,ab as pn,ac as fn,ad as Kt,ae as Re,af as yn,ag as xn,ah as Cn,ai as Ue,aj as Ge,ak as Ye,al as Xe,am as Je,an as wn,ao as bn,ap as An,aq as vn,ar as kn,as as Mn,at as jn,au as _n,av as ot,aw as Pt,ax as Hn,ay as En,az as In,aA as Nn,aB as Vn}from"./index-B5vTdGhx.js";import{b as e,E as Ee,H as i,Z as kt,R as lt,C as re,U as Zn,D as Ut}from"./vendor-B9_ld41D.js";const Sn=new Map([["bold",e.createElement(e.Fragment,null,e.createElement("path",{d:"M228,128a100,100,0,0,1-98.66,100H128a99.39,99.39,0,0,1-68.62-27.29,12,12,0,0,1,16.48-17.45,76,76,0,1,0-1.57-109c-.13.13-.25.25-.39.37L54.89,92H72a12,12,0,0,1,0,24H24a12,12,0,0,1-12-12V56a12,12,0,0,1,24,0V76.72L57.48,57.06A100,100,0,0,1,228,128Z"}))],["duotone",e.createElement(e.Fragment,null,e.createElement("path",{d:"M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z",opacity:"0.2"}),e.createElement("path",{d:"M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z"}))],["fill",e.createElement(e.Fragment,null,e.createElement("path",{d:"M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L60.63,81.29l17,17A8,8,0,0,1,72,112H24a8,8,0,0,1-8-8V56A8,8,0,0,1,29.66,50.3L49.31,70,60.25,60A96,96,0,0,1,224,128Z"}))],["light",e.createElement(e.Fragment,null,e.createElement("path",{d:"M222,128a94,94,0,0,1-92.74,94H128a93.43,93.43,0,0,1-64.5-25.65,6,6,0,1,1,8.24-8.72A82,82,0,1,0,70,70l-.19.19L39.44,98H72a6,6,0,0,1,0,12H24a6,6,0,0,1-6-6V56a6,6,0,0,1,12,0V90.34L61.63,61.4A94,94,0,0,1,222,128Z"}))],["regular",e.createElement(e.Fragment,null,e.createElement("path",{d:"M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z"}))],["thin",e.createElement(e.Fragment,null,e.createElement("path",{d:"M220,128a92,92,0,0,1-90.77,92H128a91.47,91.47,0,0,1-63.13-25.1,4,4,0,1,1,5.5-5.82A84,84,0,1,0,68.6,68.57l-.13.12L34.3,100H72a4,4,0,0,1,0,8H24a4,4,0,0,1-4-4V56a4,4,0,0,1,8,0V94.89l35-32A92,92,0,0,1,220,128Z"}))]]),qn=new Map([["bold",e.createElement(e.Fragment,null,e.createElement("path",{d:"M208.49,120.49a12,12,0,0,1-17,0L140,69V216a12,12,0,0,1-24,0V69L64.49,120.49a12,12,0,0,1-17-17l72-72a12,12,0,0,1,17,0l72,72A12,12,0,0,1,208.49,120.49Z"}))],["duotone",e.createElement(e.Fragment,null,e.createElement("path",{d:"M200,112H56l72-72Z",opacity:"0.2"}),e.createElement("path",{d:"M205.66,106.34l-72-72a8,8,0,0,0-11.32,0l-72,72A8,8,0,0,0,56,120h64v96a8,8,0,0,0,16,0V120h64a8,8,0,0,0,5.66-13.66ZM75.31,104,128,51.31,180.69,104Z"}))],["fill",e.createElement(e.Fragment,null,e.createElement("path",{d:"M207.39,115.06A8,8,0,0,1,200,120H136v96a8,8,0,0,1-16,0V120H56a8,8,0,0,1-5.66-13.66l72-72a8,8,0,0,1,11.32,0l72,72A8,8,0,0,1,207.39,115.06Z"}))],["light",e.createElement(e.Fragment,null,e.createElement("path",{d:"M204.24,116.24a6,6,0,0,1-8.48,0L134,54.49V216a6,6,0,0,1-12,0V54.49L60.24,116.24a6,6,0,0,1-8.48-8.48l72-72a6,6,0,0,1,8.48,0l72,72A6,6,0,0,1,204.24,116.24Z"}))],["regular",e.createElement(e.Fragment,null,e.createElement("path",{d:"M205.66,117.66a8,8,0,0,1-11.32,0L136,59.31V216a8,8,0,0,1-16,0V59.31L61.66,117.66a8,8,0,0,1-11.32-11.32l72-72a8,8,0,0,1,11.32,0l72,72A8,8,0,0,1,205.66,117.66Z"}))],["thin",e.createElement(e.Fragment,null,e.createElement("path",{d:"M202.83,114.83a4,4,0,0,1-5.66,0L132,49.66V216a4,4,0,0,1-8,0V49.66L58.83,114.83a4,4,0,0,1-5.66-5.66l72-72a4,4,0,0,1,5.66,0l72,72A4,4,0,0,1,202.83,114.83Z"}))]]),Ln=new Map([["bold",e.createElement(e.Fragment,null,e.createElement("path",{d:"M88,128a16,16,0,1,1,16,16A16,16,0,0,1,88,128Zm64,16a16,16,0,1,0-16-16A16,16,0,0,0,152,144Zm84-80V192a20,20,0,0,1-20,20H84.47L53,239.17l-.12.11A19.91,19.91,0,0,1,40.05,244a20.14,20.14,0,0,1-8.49-1.9A19.82,19.82,0,0,1,20,224V64A20,20,0,0,1,40,44H216A20,20,0,0,1,236,64Zm-24,4H44V215.23l28.16-24.32A11.93,11.93,0,0,1,80,188H212Z"}))],["duotone",e.createElement(e.Fragment,null,e.createElement("path",{d:"M224,64V192a8,8,0,0,1-8,8H80L45.15,230.11A8,8,0,0,1,32,224V64a8,8,0,0,1,8-8H216A8,8,0,0,1,224,64Z",opacity:"0.2"}),e.createElement("path",{d:"M116,128a12,12,0,1,1,12,12A12,12,0,0,1,116,128ZM84,140a12,12,0,1,0-12-12A12,12,0,0,0,84,140Zm88,0a12,12,0,1,0-12-12A12,12,0,0,0,172,140Zm60-76V192a16,16,0,0,1-16,16H83l-32.6,28.16-.09.07A15.89,15.89,0,0,1,40,240a16.13,16.13,0,0,1-6.8-1.52A15.85,15.85,0,0,1,24,224V64A16,16,0,0,1,40,48H216A16,16,0,0,1,232,64ZM40,224h0ZM216,64H40V224l34.77-30A8,8,0,0,1,80,192H216Z"}))],["fill",e.createElement(e.Fragment,null,e.createElement("path",{d:"M216,48H40A16,16,0,0,0,24,64V224a15.84,15.84,0,0,0,9.25,14.5A16.05,16.05,0,0,0,40,240a15.89,15.89,0,0,0,10.25-3.78l.09-.07L83,208H216a16,16,0,0,0,16-16V64A16,16,0,0,0,216,48ZM84,140a12,12,0,1,1,12-12A12,12,0,0,1,84,140Zm44,0a12,12,0,1,1,12-12A12,12,0,0,1,128,140Zm44,0a12,12,0,1,1,12-12A12,12,0,0,1,172,140Z"}))],["light",e.createElement(e.Fragment,null,e.createElement("path",{d:"M138,128a10,10,0,1,1-10-10A10,10,0,0,1,138,128ZM84,118a10,10,0,1,0,10,10A10,10,0,0,0,84,118Zm88,0a10,10,0,1,0,10,10A10,10,0,0,0,172,118Zm58-54V192a14,14,0,0,1-14,14H82.23L49.07,234.64l-.06.05A13.87,13.87,0,0,1,40,238a14.11,14.11,0,0,1-5.95-1.33A13.88,13.88,0,0,1,26,224V64A14,14,0,0,1,40,50H216A14,14,0,0,1,230,64Zm-12,0a2,2,0,0,0-2-2H40a2,2,0,0,0-2,2V224a2,2,0,0,0,3.26,1.55l34.82-30.08A6,6,0,0,1,80,194H216a2,2,0,0,0,2-2Z"}))],["regular",e.createElement(e.Fragment,null,e.createElement("path",{d:"M116,128a12,12,0,1,1,12,12A12,12,0,0,1,116,128ZM84,140a12,12,0,1,0-12-12A12,12,0,0,0,84,140Zm88,0a12,12,0,1,0-12-12A12,12,0,0,0,172,140Zm60-76V192a16,16,0,0,1-16,16H83l-32.6,28.16-.09.07A15.89,15.89,0,0,1,40,240a16.13,16.13,0,0,1-6.8-1.52A15.85,15.85,0,0,1,24,224V64A16,16,0,0,1,40,48H216A16,16,0,0,1,232,64ZM40,224h0ZM216,64H40V224l34.77-30A8,8,0,0,1,80,192H216Z"}))],["thin",e.createElement(e.Fragment,null,e.createElement("path",{d:"M136,128a8,8,0,1,1-8-8A8,8,0,0,1,136,128Zm-52-8a8,8,0,1,0,8,8A8,8,0,0,0,84,120Zm88,0a8,8,0,1,0,8,8A8,8,0,0,0,172,120Zm56-56V192a12,12,0,0,1-12,12H81.49L47.76,233.13l0,0A11.89,11.89,0,0,1,40,236a12.17,12.17,0,0,1-5.1-1.14A11.89,11.89,0,0,1,28,224V64A12,12,0,0,1,40,52H216A12,12,0,0,1,228,64Zm-8,0a4,4,0,0,0-4-4H40a4,4,0,0,0-4,4V224a4,4,0,0,0,6.56,3.08L77.38,197A4,4,0,0,1,80,196H216a4,4,0,0,0,4-4Z"}))]]),Dn=new Map([["bold",e.createElement(e.Fragment,null,e.createElement("path",{d:"M216,44H40A20,20,0,0,0,20,64V224A19.82,19.82,0,0,0,31.56,242.1a20.14,20.14,0,0,0,8.49,1.9,19.91,19.91,0,0,0,12.82-4.72l.12-.11L84.47,212H216a20,20,0,0,0,20-20V64A20,20,0,0,0,216,44Zm-4,144H80a11.93,11.93,0,0,0-7.84,2.92L44,215.23V68H212ZM84,108A12,12,0,0,1,96,96h64a12,12,0,1,1,0,24H96A12,12,0,0,1,84,108Zm0,40a12,12,0,0,1,12-12h64a12,12,0,0,1,0,24H96A12,12,0,0,1,84,148Z"}))],["duotone",e.createElement(e.Fragment,null,e.createElement("path",{d:"M224,64V192a8,8,0,0,1-8,8H80L45.15,230.11A8,8,0,0,1,32,224V64a8,8,0,0,1,8-8H216A8,8,0,0,1,224,64Z",opacity:"0.2"}),e.createElement("path",{d:"M216,48H40A16,16,0,0,0,24,64V224a15.85,15.85,0,0,0,9.24,14.5A16.13,16.13,0,0,0,40,240a15.89,15.89,0,0,0,10.25-3.78l.09-.07L83,208H216a16,16,0,0,0,16-16V64A16,16,0,0,0,216,48ZM40,224h0ZM216,192H80a8,8,0,0,0-5.23,1.95L40,224V64H216ZM88,112a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H96A8,8,0,0,1,88,112Zm0,32a8,8,0,0,1,8-8h64a8,8,0,1,1,0,16H96A8,8,0,0,1,88,144Z"}))],["fill",e.createElement(e.Fragment,null,e.createElement("path",{d:"M216,48H40A16,16,0,0,0,24,64V224a15.84,15.84,0,0,0,9.25,14.5A16.05,16.05,0,0,0,40,240a15.89,15.89,0,0,0,10.25-3.78l.09-.07L83,208H216a16,16,0,0,0,16-16V64A16,16,0,0,0,216,48ZM160,152H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Zm0-32H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Z"}))],["light",e.createElement(e.Fragment,null,e.createElement("path",{d:"M216,50H40A14,14,0,0,0,26,64V224a13.88,13.88,0,0,0,8.09,12.69A14.11,14.11,0,0,0,40,238a13.87,13.87,0,0,0,9-3.31l.06-.05L82.23,206H216a14,14,0,0,0,14-14V64A14,14,0,0,0,216,50Zm2,142a2,2,0,0,1-2,2H80a6,6,0,0,0-3.92,1.46L41.26,225.53A2,2,0,0,1,38,224V64a2,2,0,0,1,2-2H216a2,2,0,0,1,2,2Zm-52-80a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,112Zm0,32a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,144Z"}))],["regular",e.createElement(e.Fragment,null,e.createElement("path",{d:"M216,48H40A16,16,0,0,0,24,64V224a15.85,15.85,0,0,0,9.24,14.5A16.13,16.13,0,0,0,40,240a15.89,15.89,0,0,0,10.25-3.78l.09-.07L83,208H216a16,16,0,0,0,16-16V64A16,16,0,0,0,216,48ZM40,224h0ZM216,192H80a8,8,0,0,0-5.23,1.95L40,224V64H216ZM88,112a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H96A8,8,0,0,1,88,112Zm0,32a8,8,0,0,1,8-8h64a8,8,0,1,1,0,16H96A8,8,0,0,1,88,144Z"}))],["thin",e.createElement(e.Fragment,null,e.createElement("path",{d:"M216,52H40A12,12,0,0,0,28,64V224a11.89,11.89,0,0,0,6.93,10.88A12.17,12.17,0,0,0,40,236a11.89,11.89,0,0,0,7.69-2.83l0,0L81.49,204H216a12,12,0,0,0,12-12V64A12,12,0,0,0,216,52Zm4,140a4,4,0,0,1-4,4H80a4,4,0,0,0-2.62,1L42.56,227.06A4,4,0,0,1,36,224V64a4,4,0,0,1,4-4H216a4,4,0,0,1,4,4Zm-56-80a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,112Zm0,32a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,144Z"}))]]),Tn=new Map([["bold",e.createElement(e.Fragment,null,e.createElement("path",{d:"M236,137A108.13,108.13,0,1,1,119,20,12,12,0,0,1,121,44,84.12,84.12,0,1,0,212,135,12,12,0,1,1,236,137ZM116,76v52a12,12,0,0,0,12,12h52a12,12,0,0,0,0-24H140V76a12,12,0,0,0-24,0Zm92,20a16,16,0,1,0-16-16A16,16,0,0,0,208,96ZM176,64a16,16,0,1,0-16-16A16,16,0,0,0,176,64Z"}))],["duotone",e.createElement(e.Fragment,null,e.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),e.createElement("path",{d:"M232,136.66A104.12,104.12,0,1,1,119.34,24,8,8,0,0,1,120.66,40,88.12,88.12,0,1,0,216,135.34,8,8,0,0,1,232,136.66ZM120,72v56a8,8,0,0,0,8,8h56a8,8,0,0,0,0-16H136V72a8,8,0,0,0-16,0Zm40-24a12,12,0,1,0-12-12A12,12,0,0,0,160,48Zm36,24a12,12,0,1,0-12-12A12,12,0,0,0,196,72Zm24,36a12,12,0,1,0-12-12A12,12,0,0,0,220,108Z"}))],["fill",e.createElement(e.Fragment,null,e.createElement("path",{d:"M208,96a12,12,0,1,1,12,12A12,12,0,0,1,208,96ZM196,72a12,12,0,1,0-12-12A12,12,0,0,0,196,72Zm28.66,56a8,8,0,0,0-8.63,7.31A88.12,88.12,0,1,1,120.66,40,8,8,0,0,0,119.34,24,104.12,104.12,0,1,0,232,136.66,8,8,0,0,0,224.66,128ZM128,56a72,72,0,1,1-72,72A72.08,72.08,0,0,1,128,56Zm-8,72a8,8,0,0,0,8,8h48a8,8,0,0,0,0-16H136V80a8,8,0,0,0-16,0Zm40-80a12,12,0,1,0-12-12A12,12,0,0,0,160,48Z"}))],["light",e.createElement(e.Fragment,null,e.createElement("path",{d:"M230,136.49A102.12,102.12,0,1,1,119.51,26a6,6,0,0,1,1,12A90.13,90.13,0,1,0,218,135.51a6,6,0,1,1,12,1ZM122,72v56a6,6,0,0,0,6,6h56a6,6,0,0,0,0-12H134V72a6,6,0,0,0-12,0Zm38-26a10,10,0,1,0-10-10A10,10,0,0,0,160,46Zm36,24a10,10,0,1,0-10-10A10,10,0,0,0,196,70Zm24,36a10,10,0,1,0-10-10A10,10,0,0,0,220,106Z"}))],["regular",e.createElement(e.Fragment,null,e.createElement("path",{d:"M232,136.66A104.12,104.12,0,1,1,119.34,24,8,8,0,0,1,120.66,40,88.12,88.12,0,1,0,216,135.34,8,8,0,0,1,232,136.66ZM120,72v56a8,8,0,0,0,8,8h56a8,8,0,0,0,0-16H136V72a8,8,0,0,0-16,0Zm40-24a12,12,0,1,0-12-12A12,12,0,0,0,160,48Zm36,24a12,12,0,1,0-12-12A12,12,0,0,0,196,72Zm24,36a12,12,0,1,0-12-12A12,12,0,0,0,220,108Z"}))],["thin",e.createElement(e.Fragment,null,e.createElement("path",{d:"M228,136.33A100.13,100.13,0,1,1,119.67,28a4,4,0,1,1,.66,8A92.13,92.13,0,1,0,220,135.67a4,4,0,1,1,8,.66ZM128,132h56a4,4,0,0,0,0-8H132V72a4,4,0,0,0-8,0v56A4,4,0,0,0,128,132Zm32-88a8,8,0,1,0-8-8A8,8,0,0,0,160,44Zm36,24a8,8,0,1,0-8-8A8,8,0,0,0,196,68Zm24,36a8,8,0,1,0-8-8A8,8,0,0,0,220,104Z"}))]]),Fn=new Map([["bold",e.createElement(e.Fragment,null,e.createElement("path",{d:"M140,80v41.21l34.17,20.5a12,12,0,1,1-12.34,20.58l-40-24A12,12,0,0,1,116,128V80a12,12,0,0,1,24,0ZM128,28A99.38,99.38,0,0,0,57.24,57.34c-4.69,4.74-9,9.37-13.24,14V64a12,12,0,0,0-24,0v40a12,12,0,0,0,12,12H72a12,12,0,0,0,0-24H57.77C63,86,68.37,80.22,74.26,74.26a76,76,0,1,1,1.58,109,12,12,0,0,0-16.48,17.46A100,100,0,1,0,128,28Z"}))],["duotone",e.createElement(e.Fragment,null,e.createElement("path",{d:"M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z",opacity:"0.2"}),e.createElement("path",{d:"M136,80v43.47l36.12,21.67a8,8,0,0,1-8.24,13.72l-40-24A8,8,0,0,1,120,128V80a8,8,0,0,1,16,0Zm-8-48A95.44,95.44,0,0,0,60.08,60.15C52.81,67.51,46.35,74.59,40,82V64a8,8,0,0,0-16,0v40a8,8,0,0,0,8,8H72a8,8,0,0,0,0-16H49c7.15-8.42,14.27-16.35,22.39-24.57a80,80,0,1,1,1.66,114.75,8,8,0,1,0-11,11.64A96,96,0,1,0,128,32Z"}))],["fill",e.createElement(e.Fragment,null,e.createElement("path",{d:"M224,128A96,96,0,0,1,62.11,197.82a8,8,0,1,1,11-11.64A80,80,0,1,0,71.43,71.43C67.9,75,64.58,78.51,61.35,82L77.66,98.34A8,8,0,0,1,72,112H32a8,8,0,0,1-8-8V64a8,8,0,0,1,13.66-5.66L50,70.7c3.22-3.49,6.54-7,10.06-10.55A96,96,0,0,1,224,128ZM128,72a8,8,0,0,0-8,8v48a8,8,0,0,0,3.88,6.86l40,24a8,8,0,1,0,8.24-13.72L136,123.47V80A8,8,0,0,0,128,72Z"}))],["light",e.createElement(e.Fragment,null,e.createElement("path",{d:"M134,80v44.6l37.09,22.25a6,6,0,0,1-6.18,10.3l-40-24A6,6,0,0,1,122,128V80a6,6,0,0,1,12,0Zm-6-46A93.4,93.4,0,0,0,61.51,61.56c-8.58,8.68-16,17-23.51,25.8V64a6,6,0,0,0-12,0v40a6,6,0,0,0,6,6H72a6,6,0,0,0,0-12H44.73C52.86,88.29,60.79,79.35,70,70a82,82,0,1,1,1.7,117.62,6,6,0,1,0-8.24,8.72A94,94,0,1,0,128,34Z"}))],["regular",e.createElement(e.Fragment,null,e.createElement("path",{d:"M136,80v43.47l36.12,21.67a8,8,0,0,1-8.24,13.72l-40-24A8,8,0,0,1,120,128V80a8,8,0,0,1,16,0Zm-8-48A95.44,95.44,0,0,0,60.08,60.15C52.81,67.51,46.35,74.59,40,82V64a8,8,0,0,0-16,0v40a8,8,0,0,0,8,8H72a8,8,0,0,0,0-16H49c7.15-8.42,14.27-16.35,22.39-24.57a80,80,0,1,1,1.66,114.75,8,8,0,1,0-11,11.64A96,96,0,1,0,128,32Z"}))],["thin",e.createElement(e.Fragment,null,e.createElement("path",{d:"M132,80v45.74l38.06,22.83a4,4,0,0,1-4.12,6.86l-40-24A4,4,0,0,1,124,128V80a4,4,0,0,1,8,0Zm-4-44A91.42,91.42,0,0,0,62.93,63C53.05,73,44.66,82.47,36,92.86V64a4,4,0,0,0-8,0v40a4,4,0,0,0,4,4H72a4,4,0,0,0,0-8H40.47C49.61,89,58.3,79,68.6,68.6a84,84,0,1,1,1.75,120.49,4,4,0,1,0-5.5,5.82A92,92,0,1,0,128,36Z"}))]]),Rn=new Map([["bold",e.createElement(e.Fragment,null,e.createElement("path",{d:"M51.51,104.49l-32-32a12,12,0,0,1,0-17l32-32a12,12,0,1,1,17,17L45,64,68.49,87.51a12,12,0,0,1-17,17Zm48,0a12,12,0,0,0,17,0l32-32a12,12,0,0,0,0-17l-32-32a12,12,0,1,0-17,17L123,64,99.51,87.51A12,12,0,0,0,99.51,104.49ZM200,36H180a12,12,0,0,0,0,24h16V196H60V140a12,12,0,0,0-24,0v60a20,20,0,0,0,20,20H200a20,20,0,0,0,20-20V56A20,20,0,0,0,200,36Z"}))],["duotone",e.createElement(e.Fragment,null,e.createElement("path",{d:"M152,32V96a16,16,0,0,1-16,16H32A16,16,0,0,1,16,96V32A16,16,0,0,1,32,16H136A16,16,0,0,1,152,32Z",opacity:"0.2"}),e.createElement("path",{d:"M58.34,101.66l-32-32a8,8,0,0,1,0-11.32l32-32A8,8,0,0,1,69.66,37.66L43.31,64,69.66,90.34a8,8,0,0,1-11.32,11.32Zm40,0a8,8,0,0,0,11.32,0l32-32a8,8,0,0,0,0-11.32l-32-32A8,8,0,0,0,98.34,37.66L124.69,64,98.34,90.34A8,8,0,0,0,98.34,101.66ZM200,40H176a8,8,0,0,0,0,16h24V200H56V136a8,8,0,0,0-16,0v64a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Z"}))],["fill",e.createElement(e.Fragment,null,e.createElement("path",{d:"M200,40H168a16,16,0,0,0-16-16H32A16,16,0,0,0,16,40v80a16,16,0,0,0,16,16h8v64a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40ZM106.34,61.66a8,8,0,0,1,11.32-11.32l24,24a8,8,0,0,1,0,11.32l-24,24a8,8,0,0,1-11.32-11.32L124.69,80Zm-64,24a8,8,0,0,1,0-11.32l24-24A8,8,0,0,1,77.66,61.66L59.31,80,77.66,98.34a8,8,0,0,1-11.32,11.32ZM200,200H56V136h96a16,16,0,0,0,16-16V56h32Z"}))],["light",e.createElement(e.Fragment,null,e.createElement("path",{d:"M59.76,100.24l-32-32a6,6,0,0,1,0-8.48l32-32a6,6,0,1,1,8.48,8.48L40.49,64,68.24,91.76a6,6,0,1,1-8.48,8.48Zm40,0a6,6,0,0,0,8.48,0l32-32a6,6,0,0,0,0-8.48l-32-32a6,6,0,1,0-8.48,8.48L127.51,64,99.76,91.76A6,6,0,0,0,99.76,100.24ZM200,42H176a6,6,0,0,0,0,12h24a2,2,0,0,1,2,2V200a2,2,0,0,1-2,2H56a2,2,0,0,1-2-2V136a6,6,0,0,0-12,0v64a14,14,0,0,0,14,14H200a14,14,0,0,0,14-14V56A14,14,0,0,0,200,42Z"}))],["regular",e.createElement(e.Fragment,null,e.createElement("path",{d:"M58.34,101.66l-32-32a8,8,0,0,1,0-11.32l32-32A8,8,0,0,1,69.66,37.66L43.31,64,69.66,90.34a8,8,0,0,1-11.32,11.32Zm40,0a8,8,0,0,0,11.32,0l32-32a8,8,0,0,0,0-11.32l-32-32A8,8,0,0,0,98.34,37.66L124.69,64,98.34,90.34A8,8,0,0,0,98.34,101.66ZM200,40H176a8,8,0,0,0,0,16h24V200H56V136a8,8,0,0,0-16,0v64a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Z"}))],["thin",e.createElement(e.Fragment,null,e.createElement("path",{d:"M61.17,98.83l-32-32a4,4,0,0,1,0-5.66l32-32a4,4,0,0,1,5.66,5.66L37.66,64,66.83,93.17a4,4,0,0,1-5.66,5.66Zm40,0a4,4,0,0,0,5.66,0l32-32a4,4,0,0,0,0-5.66l-32-32a4,4,0,0,0-5.66,5.66L130.34,64,101.17,93.17A4,4,0,0,0,101.17,98.83ZM200,44H176a4,4,0,0,0,0,8h24a4,4,0,0,1,4,4V200a4,4,0,0,1-4,4H56a4,4,0,0,1-4-4V136a4,4,0,0,0-8,0v64a12,12,0,0,0,12,12H200a12,12,0,0,0,12-12V56A12,12,0,0,0,200,44Z"}))]]),zn=new Map([["bold",e.createElement(e.Fragment,null,e.createElement("path",{d:"M209.88,69.83A115.19,115.19,0,0,0,128,36h-.41C63.85,36.22,12,88.76,12,153.13V176a20,20,0,0,0,20,20H224a20,20,0,0,0,20-20V152A115.25,115.25,0,0,0,209.88,69.83ZM220,172H127.32l46.44-65A12,12,0,1,0,154.24,93L97.82,172H36V153.13c0-1.72,0-3.43.14-5.13H56a12,12,0,0,0,0-24H40.62c10.91-33.39,40-58.52,75.38-63.21V80a12,12,0,0,0,24,0V60.8A92,92,0,0,1,215.66,124H200a12,12,0,0,0,0,24h19.9c.06,1.33.1,2.66.1,4Z"}))],["duotone",e.createElement(e.Fragment,null,e.createElement("path",{d:"M232,152v24a8,8,0,0,1-8,8H32a8,8,0,0,1-8-8V153.13C24,95.65,70.15,48.2,127.63,48A104,104,0,0,1,232,152Z",opacity:"0.2"}),e.createElement("path",{d:"M207.06,72.67A111.24,111.24,0,0,0,128,40h-.4C66.07,40.21,16,91,16,153.13V176a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V152A111.25,111.25,0,0,0,207.06,72.67ZM224,176H119.71l54.76-75.3a8,8,0,0,0-12.94-9.42L99.92,176H32V153.13c0-3.08.15-6.12.43-9.13H56a8,8,0,0,0,0-16H35.27c10.32-38.86,44-68.24,84.73-71.66V80a8,8,0,0,0,16,0V56.33A96.14,96.14,0,0,1,221,128H200a8,8,0,0,0,0,16h23.67c.21,2.65.33,5.31.33,8Z"}))],["fill",e.createElement(e.Fragment,null,e.createElement("path",{d:"M240,152v24a16,16,0,0,1-16,16H115.93a4,4,0,0,1-3.24-6.35L174.27,101a8.21,8.21,0,0,0-1.37-11.3,8,8,0,0,0-11.37,1.61l-72,99.06A4,4,0,0,1,86.25,192H32a16,16,0,0,1-16-16V153.13c0-1.79,0-3.57.13-5.33a4,4,0,0,1,4-3.8H48a8,8,0,0,0,8-8.53A8.17,8.17,0,0,0,47.73,128H23.92a4,4,0,0,1-3.87-5c12-43.84,49.66-77.13,95.52-82.28a4,4,0,0,1,4.43,4V72a8,8,0,0,0,8.53,8A8.17,8.17,0,0,0,136,71.73V44.67a4,4,0,0,1,4.43-4A112.18,112.18,0,0,1,236.23,123a4,4,0,0,1-3.88,5H208.27a8.17,8.17,0,0,0-8.25,7.47,8,8,0,0,0,8,8.53h27.92a4,4,0,0,1,4,3.86C240,149.23,240,150.61,240,152Z"}))],["light",e.createElement(e.Fragment,null,e.createElement("path",{d:"M205.65,74.08A109.26,109.26,0,0,0,128,42h-.39C67.17,42.21,18,92.06,18,153.13V176a14,14,0,0,0,14,14H224a14,14,0,0,0,14-14V152A109.3,109.3,0,0,0,205.65,74.08ZM226,176a2,2,0,0,1-2,2H115.78l57.07-78.47a6,6,0,0,0-9.7-7.06L100.94,178H32a2,2,0,0,1-2-2V153.13A102.36,102.36,0,0,1,30.62,142H56a6,6,0,0,0,0-12H32.71C42.6,88.4,78.53,56.86,122,54.19V80a6,6,0,0,0,12,0V54.19A98.05,98.05,0,0,1,223.53,130H200a6,6,0,0,0,0,12h25.5c.33,3.3.5,6.64.5,10Z"}))],["regular",e.createElement(e.Fragment,null,e.createElement("path",{d:"M207.06,72.67A111.24,111.24,0,0,0,128,40h-.4C66.07,40.21,16,91,16,153.13V176a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V152A111.25,111.25,0,0,0,207.06,72.67ZM224,176H119.71l54.76-75.3a8,8,0,0,0-12.94-9.42L99.92,176H32V153.13c0-3.08.15-6.12.43-9.13H56a8,8,0,0,0,0-16H35.27c10.32-38.86,44-68.24,84.73-71.66V80a8,8,0,0,0,16,0V56.33A96.14,96.14,0,0,1,221,128H200a8,8,0,0,0,0,16h23.67c.21,2.65.33,5.31.33,8Z"}))],["thin",e.createElement(e.Fragment,null,e.createElement("path",{d:"M204.23,75.5A107.37,107.37,0,0,0,127.62,44C68.28,44.21,20,93.16,20,153.13V176a12,12,0,0,0,12,12H224a12,12,0,0,0,12-12V152A107.25,107.25,0,0,0,204.23,75.5ZM228,176a4,4,0,0,1-4,4H111.85l59.38-81.65a4,4,0,1,0-6.46-4.7L102,180H32a4,4,0,0,1-4-4V153.13A103.42,103.42,0,0,1,28.84,140H56a4,4,0,0,0,0-8H30.21C39.59,87.66,77.84,53.93,124,52.09V80a4,4,0,0,0,8,0V52.08A100.08,100.08,0,0,1,226,132H200a4,4,0,0,0,0,8h27.29a101.6,101.6,0,0,1,.71,12Z"}))]]),$n=new Map([["bold",e.createElement(e.Fragment,null,e.createElement("path",{d:"M71.51,144.49a12,12,0,0,1,0-17l24-24a12,12,0,0,1,17,17L109,124h55V104a12,12,0,0,1,24,0v32a12,12,0,0,1-12,12H109l3.52,3.51a12,12,0,0,1-17,17ZM236,56V200a20,20,0,0,1-20,20H40a20,20,0,0,1-20-20V56A20,20,0,0,1,40,36H216A20,20,0,0,1,236,56Zm-24,4H44V196H212Z"}))],["duotone",e.createElement(e.Fragment,null,e.createElement("path",{d:"M224,56V200a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8H216A8,8,0,0,1,224,56Z",opacity:"0.2"}),e.createElement("path",{d:"M184,104v32a8,8,0,0,1-8,8H99.31l10.35,10.34a8,8,0,0,1-11.32,11.32l-24-24a8,8,0,0,1,0-11.32l24-24a8,8,0,0,1,11.32,11.32L99.31,128H168V104a8,8,0,0,1,16,0Zm48-48V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56ZM216,200V56H40V200H216Z"}))],["fill",e.createElement(e.Fragment,null,e.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40Zm-32,96a8,8,0,0,1-8,8H99.31l10.35,10.34a8,8,0,0,1-11.32,11.32l-24-24a8,8,0,0,1,0-11.32l24-24a8,8,0,0,1,11.32,11.32L99.31,128H168V104a8,8,0,0,1,16,0Z"}))],["light",e.createElement(e.Fragment,null,e.createElement("path",{d:"M182,104v32a6,6,0,0,1-6,6H94.48l13.76,13.76a6,6,0,1,1-8.48,8.48l-24-24a6,6,0,0,1,0-8.48l24-24a6,6,0,0,1,8.48,8.48L94.48,130H170V104a6,6,0,0,1,12,0Zm48-48V200a14,14,0,0,1-14,14H40a14,14,0,0,1-14-14V56A14,14,0,0,1,40,42H216A14,14,0,0,1,230,56Zm-12,0a2,2,0,0,0-2-2H40a2,2,0,0,0-2,2V200a2,2,0,0,0,2,2H216a2,2,0,0,0,2-2Z"}))],["regular",e.createElement(e.Fragment,null,e.createElement("path",{d:"M184,104v32a8,8,0,0,1-8,8H99.31l10.35,10.34a8,8,0,0,1-11.32,11.32l-24-24a8,8,0,0,1,0-11.32l24-24a8,8,0,0,1,11.32,11.32L99.31,128H168V104a8,8,0,0,1,16,0Zm48-48V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56ZM216,200V56H40V200H216Z"}))],["thin",e.createElement(e.Fragment,null,e.createElement("path",{d:"M180,104v32a4,4,0,0,1-4,4H89.66l17.17,17.17a4,4,0,0,1-5.66,5.66l-24-24a4,4,0,0,1,0-5.66l24-24a4,4,0,0,1,5.66,5.66L89.66,132H172V104a4,4,0,0,1,8,0Zm48-48V200a12,12,0,0,1-12,12H40a12,12,0,0,1-12-12V56A12,12,0,0,1,40,44H216A12,12,0,0,1,228,56Zm-8,0a4,4,0,0,0-4-4H40a4,4,0,0,0-4,4V200a4,4,0,0,0,4,4H216a4,4,0,0,0,4-4Z"}))]]),Bn=new Map([["bold",e.createElement(e.Fragment,null,e.createElement("path",{d:"M232.49,215.51,185,168a92.12,92.12,0,1,0-17,17l47.53,47.54a12,12,0,0,0,17-17ZM44,112a68,68,0,1,1,68,68A68.07,68.07,0,0,1,44,112Z"}))],["duotone",e.createElement(e.Fragment,null,e.createElement("path",{d:"M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z",opacity:"0.2"}),e.createElement("path",{d:"M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z"}))],["fill",e.createElement(e.Fragment,null,e.createElement("path",{d:"M168,112a56,56,0,1,1-56-56A56,56,0,0,1,168,112Zm61.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88,88,0,1,1,11.32-11.31l50.06,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z"}))],["light",e.createElement(e.Fragment,null,e.createElement("path",{d:"M228.24,219.76l-51.38-51.38a86.15,86.15,0,1,0-8.48,8.48l51.38,51.38a6,6,0,0,0,8.48-8.48ZM38,112a74,74,0,1,1,74,74A74.09,74.09,0,0,1,38,112Z"}))],["regular",e.createElement(e.Fragment,null,e.createElement("path",{d:"M229.66,218.34l-50.07-50.06a88.11,88.11,0,1,0-11.31,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z"}))],["thin",e.createElement(e.Fragment,null,e.createElement("path",{d:"M226.83,221.17l-52.7-52.7a84.1,84.1,0,1,0-5.66,5.66l52.7,52.7a4,4,0,0,0,5.66-5.66ZM36,112a76,76,0,1,1,76,76A76.08,76.08,0,0,1,36,112Z"}))]]),Qn=new Map([["bold",e.createElement(e.Fragment,null,e.createElement("path",{d:"M216,48H40a12,12,0,0,0,0,24h4V208a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V72h4a12,12,0,0,0,0-24ZM188,204H68V72H188ZM76,20A12,12,0,0,1,88,8h80a12,12,0,0,1,0,24H88A12,12,0,0,1,76,20Z"}))],["duotone",e.createElement(e.Fragment,null,e.createElement("path",{d:"M200,56V208a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V56Z",opacity:"0.2"}),e.createElement("path",{d:"M216,48H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM192,208H64V64H192ZM80,24a8,8,0,0,1,8-8h80a8,8,0,0,1,0,16H88A8,8,0,0,1,80,24Z"}))],["fill",e.createElement(e.Fragment,null,e.createElement("path",{d:"M224,56a8,8,0,0,1-8,8h-8V208a16,16,0,0,1-16,16H64a16,16,0,0,1-16-16V64H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,56ZM88,32h80a8,8,0,0,0,0-16H88a8,8,0,0,0,0,16Z"}))],["light",e.createElement(e.Fragment,null,e.createElement("path",{d:"M216,50H40a6,6,0,0,0,0,12H50V208a14,14,0,0,0,14,14H192a14,14,0,0,0,14-14V62h10a6,6,0,0,0,0-12ZM194,208a2,2,0,0,1-2,2H64a2,2,0,0,1-2-2V62H194ZM82,24a6,6,0,0,1,6-6h80a6,6,0,0,1,0,12H88A6,6,0,0,1,82,24Z"}))],["regular",e.createElement(e.Fragment,null,e.createElement("path",{d:"M216,48H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM192,208H64V64H192ZM80,24a8,8,0,0,1,8-8h80a8,8,0,0,1,0,16H88A8,8,0,0,1,80,24Z"}))],["thin",e.createElement(e.Fragment,null,e.createElement("path",{d:"M216,52H40a4,4,0,0,0,0,8H52V208a12,12,0,0,0,12,12H192a12,12,0,0,0,12-12V60h12a4,4,0,0,0,0-8ZM196,208a4,4,0,0,1-4,4H64a4,4,0,0,1-4-4V60H196ZM84,24a4,4,0,0,1,4-4h80a4,4,0,0,1,0,8H88A4,4,0,0,1,84,24Z"}))]]),Gt=e.forwardRef((a,n)=>e.createElement(le,{ref:n,...a,weights:Sn}));Gt.displayName="ArrowCounterClockwiseIcon";const Yt=e.forwardRef((a,n)=>e.createElement(le,{ref:n,...a,weights:qn}));Yt.displayName="ArrowUpIcon";const Xt=e.forwardRef((a,n)=>e.createElement(le,{ref:n,...a,weights:Ln}));Xt.displayName="ChatDotsIcon";const Jt=e.forwardRef((a,n)=>e.createElement(le,{ref:n,...a,weights:Dn}));Jt.displayName="ChatTextIcon";const ea=e.forwardRef((a,n)=>e.createElement(le,{ref:n,...a,weights:Tn}));ea.displayName="ClockCountdownIcon";const ta=e.forwardRef((a,n)=>e.createElement(le,{ref:n,...a,weights:Fn}));ta.displayName="ClockCounterClockwiseIcon";const aa=e.forwardRef((a,n)=>e.createElement(le,{ref:n,...a,weights:Rn}));aa.displayName="CodeBlockIcon";const na=e.forwardRef((a,n)=>e.createElement(le,{ref:n,...a,weights:zn}));na.displayName="GaugeIcon";const ra=e.forwardRef((a,n)=>e.createElement(le,{ref:n,...a,weights:$n}));ra.displayName="KeyReturnIcon";const ia=e.forwardRef((a,n)=>e.createElement(le,{ref:n,...a,weights:Bn}));ia.displayName="MagnifyingGlassIcon";const sa=e.forwardRef((a,n)=>e.createElement(le,{ref:n,...a,weights:Qn}));sa.displayName="TrashSimpleIcon";const Wn=i(S).attrs({alignItems:"center",gap:"0"}).withConfig({displayName:"ExplainQueryButton__KeyBinding"})([`
2
- color: `,`;
3
- `],({theme:a})=>a.color.pinkPrimary),On=st.isMacintosh||st.isIOS?"\u2318":"Ctrl",Kn=st.isMacintosh||st.isIOS?"Cmd+E":"Ctrl+E",Pn=i(ue).withConfig({displayName:"ExplainQueryButton__ExplainButton"})([`
4
- gap: 1rem;
5
- `]),Un=({conversationId:a,queryText:n})=>{const{quest:o}=e.useContext(yt),c=Ee(je.query.getTables),{setStatus:u,abortController:g,hasSchemaAccess:y,currentModel:H,apiKey:A,aiAssistantSettings:_}=Te(),{addMessage:w,updateMessage:k,updateConversationName:b,persistMessages:p,setIsStreaming:N}=Fa(),l=()=>{_e(He.AI_EXPLAIN_QUERY),Ze(Dt({conversationId:a,queryText:n,settings:{model:H,apiKey:A},aiAssistantSettings:_,questClient:o,tables:c,hasSchemaAccess:y,abortSignal:g==null?void 0:g.signal}),{addMessage:w,updateMessage:k,setStatus:u,setIsStreaming:N,persistMessages:p,updateConversationName:b})};return t.jsxs(Pn,{skin:"gradient",gradientWeight:"thin",onClick:l,title:`Explain query with AI Assistant (${Kn})`,"data-hook":"button-explain-query",children:[t.jsx(it,{size:12,variant:"hollow"}),"Explain query",t.jsxs(Wn,{children:[t.jsx(Lt,{keyString:On,color:r("pinkPrimary"),hoverColor:r("pinkPrimary")}),t.jsx(Lt,{keyString:"E",color:r("pinkPrimary"),hoverColor:r("pinkPrimary")})]})]})},oa=(a,n,o,c)=>{if(!(o!=null&&o.current)||!c.current)return null;const u=c.current.getModel();if(!u)return null;const g=o.current[n.toString()];if(!g)return null;const y=g[a];if(!y||!y.error)return null;const H=y.selection?y.selection.startOffset:y.startOffset,A=y.selection?y.selection.endOffset:y.endOffset,_=u.getPositionAt(H),w=u.getPositionAt(H+y.error.position),k=u.getWordAtPosition(w),b=u.getPositionAt(A),p=y.selection?u.getValueInRange({startLineNumber:_.lineNumber,startColumn:_.column,endLineNumber:b.lineNumber,endColumn:b.column}):Ra(a).queryText;return{errorMessage:y.error.error||"Query execution failed",word:k?k.word:null,fixStart:H,fixEnd:A,queryText:p}},Gn=i(ue).withConfig({displayName:"FixQueryButton__FixButton"})([`
6
- gap: 1rem;
7
- `]),Yn=()=>{const{quest:a}=e.useContext(yt),{editorRef:n,executionRefs:o}=xt(),c=Ee(je.query.getTables),{setStatus:u,abortController:g,hasSchemaAccess:y,currentModel:H,apiKey:A,aiAssistantSettings:_}=Te(),{chatWindowState:w,getConversationMeta:k,addMessage:b,updateMessage:p,updateConversationName:N,persistMessages:l,setIsStreaming:v}=Ct(),R=()=>{_e(He.AI_FIX_QUERY);const d=w.activeConversationId,x=k(d),h=oa(x.queryKey,x.bufferId,o,n),{errorMessage:T,queryText:Y,word:F}=h;Ze(Tt({conversationId:d,queryText:Y,errorMessage:T,errorWord:F??void 0,settings:{model:H,apiKey:A},aiAssistantSettings:_,questClient:a,tables:c,hasSchemaAccess:y,abortSignal:g==null?void 0:g.signal}),{addMessage:b,updateMessage:p,setStatus:u,setIsStreaming:v,persistMessages:l,updateConversationName:N})};return t.jsxs(Gn,{skin:"gradient",gradientWeight:"thin",onClick:R,title:"Fix query with AI Assistant","data-hook":"button-fix-query",children:[t.jsx(it,{size:12,variant:"hollow"}),"Fix query"]})},Mt=a=>{if(!a||typeof a!="string")return`
8
- `;let n=a.trim();return n.endsWith(";")&&(n=n.slice(0,-1).trim()),n+`
9
- `},la=i.div.withConfig({displayName:"AssistantModesCompact__Container"})([`
10
- display: flex;
11
- flex-direction: column;
12
- gap: 0.4rem;
13
- align-items: flex-start;
14
- width: 100%;
15
- overflow-y: auto;
16
- overflow-x: hidden;
17
- min-height: 0;
18
- `]),da=i.div.withConfig({displayName:"AssistantModesCompact__ModeHeader"})([`
19
- display: flex;
20
- flex-shrink: 0;
21
- width: 100%;
22
-
23
- `,`
24
- `,`
25
- gap: 0.8rem;
26
- `],({$expanded:a})=>a?re([`
27
- flex-direction: column;
28
- align-items: flex-start;
29
- `]):re([`
30
- align-items: center;
31
- justify-content: space-between;
32
- padding: 0.4rem;
33
- `]),({$abort:a})=>a&&re([`
34
- opacity: 0.7;
35
- `])),jt=i.div.withConfig({displayName:"AssistantModesCompact__ModeChevron"})([`
36
- width: 1.4rem;
37
- height: 1.4rem;
38
- flex-shrink: 0;
39
- display: flex;
40
- align-items: center;
41
- justify-content: center;
42
- color: `,`;
43
- cursor: pointer;
44
- transition:
45
- color 0.2s,
46
- transform 0.2s;
47
- transform: rotate(`,`);
48
- `],r("gray2"),({$expanded:a})=>a?"90deg":"0deg"),_t=i.div.withConfig({displayName:"AssistantModesCompact__ModeTitle"})([`
49
- font-weight: 500;
50
- font-size: 1.4rem;
51
- color: `,`;
52
- text-align: center;
53
- margin-right: auto;
54
- transition: color 0.2s;
55
- flex-shrink: 0;
56
-
57
- `,`
58
- `,`
59
- `],r("gray2"),({$isActive:a})=>a&&Bt,({$isTopLevel:a})=>a&&re([`
60
- color: `,`;
61
- `],r("foreground"))),ca=i.div.withConfig({displayName:"AssistantModesCompact__ModeHeaderTop"})([`
62
- display: flex;
63
- gap: 0.8rem;
64
- align-items: center;
65
- flex-shrink: 0;
66
- `,`
67
- `,`
68
- `,`
69
- `],({$expanded:a})=>a&&re([`
70
- padding: 0.4rem;
71
- `]),({$expanded:a})=>!a&&re([`
72
- min-height: 0;
73
- min-width: 0;
74
- `]),({$isExpandable:a})=>a&&re([`
75
- cursor: pointer;
76
- user-select: none;
77
- &:hover `,", &:hover ",` {
78
- color: `,`;
79
- }
80
- `],_t,jt,r("foreground"))),Ht=i.div.withConfig({displayName:"AssistantModesCompact__ExpandableWrapper"})([`
81
- display: grid;
82
- grid-template-rows: `,`;
83
- transition:
84
- grid-template-rows 0.1s ease-out,
85
- opacity 0.3s ease-out;
86
- width: 100%;
87
-
88
- `,`
89
- `],({$expanded:a})=>a?"1fr":"0fr",({$expanded:a})=>!a&&re([`
90
- height: 0;
91
- opacity: 0;
92
- `])),Et=i.div.withConfig({displayName:"AssistantModesCompact__ExpandableContent"})([`
93
- min-height: 0;
94
- overflow: hidden;
95
- `]),Xn=i.div.withConfig({displayName:"AssistantModesCompact__ReasoningThread"})([`
96
- display: flex;
97
- flex-direction: column;
98
- gap: 0.8rem;
99
- align-items: flex-start;
100
- padding: 0 2.8rem;
101
- `]),dt=i.div.withConfig({displayName:"AssistantModesCompact__ReasoningItem"})([`
102
- display: flex;
103
- gap: 0.5rem;
104
- align-items: center;
105
- padding: 0.4rem;
106
- padding-left: 0;
107
- `]),et=i.div.withConfig({displayName:"AssistantModesCompact__ReasoningIcon"})([`
108
- width: 1.4rem;
109
- height: 1.4rem;
110
- flex-shrink: 0;
111
- display: flex;
112
- align-items: center;
113
- justify-content: center;
114
- color: `,`;
115
- `],r("foreground")),ct=i.div.withConfig({displayName:"AssistantModesCompact__ReasoningText"})([`
116
- display: flex;
117
- flex-wrap: wrap;
118
- gap: 0.4rem;
119
- align-items: center;
120
- min-height: 0;
121
- min-width: 0;
122
- `]),ie=i.span.withConfig({displayName:"AssistantModesCompact__ReasoningTextPart"})([`
123
- font-weight: 400;
124
- font-size: 1.4rem;
125
- color: `,`;
126
- `],r("gray2")),Se=i.div.withConfig({displayName:"AssistantModesCompact__CodeBadge"})([`
127
- background: `,`;
128
- border: 1px solid `,`;
129
- border-radius: 0.4rem;
130
- padding: 0 0.4rem;
131
- display: flex;
132
- align-items: center;
133
- justify-content: center;
134
- transform: translateY(1px);
135
- `],r("background"),r("selection")),qe=i.span.withConfig({displayName:"AssistantModesCompact__CodeBadgeText"})([`
136
- font-family: `,`;
137
- font-size: 1.2rem;
138
- color: `,`;
139
- `],({theme:a})=>a.fontMonospace,r("purple")),ha=i(Oa).withConfig({displayName:"AssistantModesCompact__CheckIcon"})([`
140
- width: 1.6rem;
141
- height: 1.6rem;
142
- color: `,`;
143
- flex-shrink: 0;
144
- `],r("pink")),Jn=i($t).withConfig({displayName:"AssistantModesCompact__CloseCircleIcon"})([`
145
- color: `,`;
146
- flex-shrink: 0;
147
- `],r("red")),er=i.div.withConfig({displayName:"AssistantModesCompact__CollapsedSectionsWrapper"})([`
148
- display: flex;
149
- flex-direction: column;
150
- gap: 0.8rem;
151
- padding-left: 2.8rem;
152
- `]),tr=i.span.withConfig({displayName:"AssistantModesCompact__DurationText"})([`
153
- font-size: 1.2rem;
154
- color: `,`;
155
- font-family: `,`;
156
- font-weight: 400;
157
- flex-shrink: 0;
158
- transform: translateY(1px);
159
- `],r("graphLegend"),({theme:a})=>a.fontMonospace),ar=(a,n)=>{if(a===be.Processing&&n&&"type"in n)switch(n.type){case"fix":return"Processing fix request";case"explain":return"Processing explain request";default:return a}return a},nr=i.div.withConfig({displayName:"AssistantModesCompact__ThinkingContent"})([`
160
- font-size: 1.3rem;
161
- color: `,`;
162
- padding: 0 2.8rem;
163
- white-space: pre-wrap;
164
- word-break: break-word;
165
- opacity: 0.7;
166
- `],r("gray2")),ma=({operationHistory:a,status:n,isLive:o=!1,onScrollNeeded:c,collapsed:u=!1,endTimestamp:g})=>{const y=kt(),[H,A]=e.useState({}),[_,w]=e.useState(!1),k=e.useRef(0),b=e.useRef(null),p=e.useMemo(()=>za(a,n,o),[a,n,o]),N=e.useRef(o);e.useEffect(()=>{if(N.current&&!o){const d={};p.forEach(x=>{d[x.id]=!0}),A(d)}else if(o&&p.length>k.current){const d={};p.forEach((x,h)=>{h<p.length-1&&(d[x.id]=!0)}),A(d),c==null||c()}k.current=p.length,N.current=o},[p,o,c]);const l=d=>{A(x=>{const h=p.find(I=>I.id===d),T=h?Ft(h):!1,Y=p.findIndex(I=>I.id===d)===p.length-1,F=u?!1:o?Y:!0;return x[d]===void 0?{...x,[d]:F&&T}:{...x,[d]:!x[d]}})},v=e.useMemo(()=>{var h,T;if(a.length===0)return null;const d=(h=a[0])==null?void 0:h.timestamp,x=g??((T=a[a.length-1])==null?void 0:T.timestamp);return!d||!x||d===x?null:$a(x-d)},[a,g]);if(a.length===0)return null;const R=p.map((d,x)=>{var q;const h=Ft(d),T=x===p.length-1,Y=u?!1:o?T:!0,F=H[d.id]===void 0?Y&&h:!H[d.id]&&h,I=p[x+1],V=Ba(d,I,I?void 0:g),z=d.type===be.Thinking||d.type===be.RunningQuery,Z=z?((q=d.operations[0])==null?void 0:q.content)??"":"";return t.jsxs(da,{$expanded:F,$abort:d.abort,children:[t.jsxs(ca,{$expanded:F,$isExpandable:h,"data-hook":`assistant-mode-${d.type.toLowerCase().replace(/\s+/g,"-")}`,role:h?"button":"presentation",tabIndex:h?0:void 0,"aria-expanded":h?F:void 0,onClick:h?()=>l(d.id):void 0,onKeyDown:h?j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),l(d.id))}:void 0,children:[t.jsx(et,{children:d.active?t.jsx(wt,{size:14}):d.abort?t.jsx(Jn,{size:14}):t.jsx(ha,{})}),t.jsxs(S,{gap:"0.3rem",children:[t.jsx(_t,{$isActive:d.active,children:d.type}),V&&t.jsxs(tr,{children:["(",V,")"]}),h&&t.jsx(jt,{$expanded:F,children:t.jsx(Rt,{size:14})})]})]}),h&&z&&t.jsx(Ht,{$expanded:F,children:t.jsx(Et,{children:Z?t.jsx(nr,{children:Z}):null})}),h&&!z&&t.jsx(Ht,{$expanded:F,children:t.jsx(Et,{children:t.jsx(Xn,{children:d.operations.map((j,Ie)=>{const ee=`${d.id}-${Ie}-${JSON.stringify(j.args)}`;if(j.type===be.Processing){const K=ar(j.type,j.args);return t.jsxs(dt,{children:[t.jsx(et,{children:t.jsx(Qa,{style:{width:"14px",height:"14px"}})}),t.jsx(ct,{children:t.jsx(ie,{children:K})})]},ee)}if(j.type===be.InvestigatingTable){const K=j.args&&"name"in j.args?j.args.name:"table",X=j.args&&"tableOpType"in j.args?j.args.tableOpType:"details";return t.jsxs(dt,{children:[t.jsx(et,{children:t.jsx(Wa,{size:14,color:y.color.gray2})}),t.jsxs(ct,{children:[t.jsx(ie,{children:"Investigating"}),t.jsx(Se,{children:t.jsx(qe,{children:K})}),t.jsx(ie,{children:X})]})]},ee)}if(j.type===be.InvestigatingDocs){const K=j.args&&"items"in j.args&&Array.isArray(j.args.items)?j.args.items:null;if(K&&K.length>0)return t.jsx(lt.Fragment,{children:K.map((pe,ke)=>{const J=`${ee}-item-${ke}`;return t.jsxs(dt,{children:[t.jsx(et,{children:t.jsx(zt,{size:14,color:y.color.gray2})}),t.jsx(ct,{children:pe.section?t.jsxs(t.Fragment,{children:[t.jsx(ie,{children:"Investigating"}),t.jsx(Se,{children:t.jsx(qe,{children:pe.section})}),t.jsx(ie,{children:"in"}),t.jsx(Se,{children:t.jsx(qe,{children:pe.name})})]}):t.jsxs(t.Fragment,{children:[t.jsx(ie,{children:"Investigating"}),t.jsx(Se,{children:t.jsx(qe,{children:pe.name})})]})})]},J)})},ee);const X=j.args&&"name"in j.args?j.args.name:null,ve=j.args&&"section"in j.args?j.args.section:null;return t.jsxs(dt,{children:[t.jsx(et,{children:t.jsx(zt,{size:14})}),t.jsx(ct,{children:X&&ve?t.jsxs(t.Fragment,{children:[t.jsx(ie,{children:"Investigating"}),t.jsx(Se,{children:t.jsx(qe,{children:ve})}),t.jsx(ie,{children:"in"}),t.jsx(Se,{children:t.jsx(qe,{children:X})}),t.jsx(ie,{children:"documentation"})]}):X?t.jsxs(t.Fragment,{children:[t.jsx(ie,{children:"Investigating"}),t.jsx(Se,{children:t.jsx(qe,{children:X})}),t.jsx(ie,{children:"documentation"})]}):t.jsx(ie,{children:"Investigating documentation"})})]},ee)}return null})})})})]},d.id)});return u?t.jsx(la,{ref:b,"data-hook":"assistant-modes-container",children:t.jsxs(da,{$expanded:_,$abort:!1,children:[t.jsxs(ca,{$expanded:_,$isExpandable:!0,onClick:()=>w(d=>!d),onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),w(x=>!x))},"data-hook":"assistant-mode-processing-collapsed",role:"button",tabIndex:0,"aria-expanded":_,children:[t.jsx(ha,{}),t.jsx(_t,{$isActive:!1,children:v?`Thought for ${v}`:"Thought"}),t.jsx(jt,{$expanded:_,children:t.jsx(Rt,{size:14})})]}),t.jsx(Ht,{$expanded:_,children:t.jsx(Et,{children:t.jsx(er,{children:R})})})]})}):t.jsx(la,{ref:b,"data-hook":"assistant-modes-container",children:R})},rr=i.div.withConfig({displayName:"AssistantMarkdown__CodeBlockWrapper"})([`
167
- margin: 1rem 0;
168
- width: 100%;
169
- `]),ir=i.div.withConfig({displayName:"AssistantMarkdown__MarkdownContent"})([`
170
- margin: 0;
171
- width: 100%;
172
- font-family: `,`;
173
- font-size: 1.4rem;
174
- line-height: 2.1rem;
175
- color: `,`;
176
- word-break: break-word;
177
-
178
- p {
179
- margin: 0 0 1rem 0;
180
- &:last-child {
181
- margin-bottom: 0;
182
- }
183
- }
184
-
185
- code {
186
- background: `,`;
187
- border: 1px solid `,`;
188
- border-radius: 0.4rem;
189
- padding: 0.1rem 0.4rem;
190
- font-family: `,`;
191
- font-size: 1.3rem;
192
- color: `,`;
193
- white-space: pre-wrap;
194
- }
195
-
196
- strong {
197
- font-weight: 600;
198
- color: `,`;
199
- }
200
-
201
- em {
202
- font-style: italic;
203
- }
204
-
205
- ul,
206
- ol {
207
- margin: 0.5rem 0;
208
- padding-left: 2rem;
209
- }
210
-
211
- li {
212
- margin-bottom: 0.3rem;
213
- }
214
-
215
- a {
216
- color: `,`;
217
- text-decoration: none;
218
- &:hover {
219
- text-decoration: underline;
220
- }
221
- }
222
-
223
- h1,
224
- h2,
225
- h3,
226
- h4 {
227
- margin: 1rem 0 0.5rem 0;
228
- font-weight: 600;
229
- }
230
-
231
- h1 {
232
- font-size: 1.8rem;
233
- }
234
- h2 {
235
- font-size: 1.6rem;
236
- }
237
- h3 {
238
- font-size: 1.5rem;
239
- }
240
- h4 {
241
- font-size: 1.4rem;
242
- }
243
-
244
- blockquote {
245
- border-left: 3px solid `,`;
246
- margin: 1rem 0;
247
- padding-left: 1rem;
248
- color: `,`;
249
- }
250
-
251
- .table-wrapper {
252
- overflow-x: auto;
253
- margin: 1rem 0;
254
- }
255
-
256
- table {
257
- border-collapse: collapse;
258
- min-width: max-content;
259
- border-radius: 0.8rem;
260
- }
261
-
262
- th,
263
- td {
264
- padding: 0.6rem 0.8rem;
265
- border: 1px solid `,`;
266
- text-align: left;
267
- white-space: nowrap;
268
- }
269
-
270
- th {
271
- background: `,`;
272
- font-weight: 600;
273
- }
274
-
275
- td:last-child {
276
- white-space: normal;
277
- min-width: 200px;
278
- }
279
- `],({theme:a})=>a.font,r("foreground"),r("background"),r("selection"),({theme:a})=>a.fontMonospace,r("purple"),r("foreground"),({theme:a})=>a.color.cyan,r("selection"),r("gray2"),r("selection"),r("backgroundDarker")),sr=a=>({table:({children:n,...o})=>t.jsx("div",{className:"table-wrapper",children:t.jsx("table",{...o,children:n})}),pre:({children:n})=>t.jsx(t.Fragment,{children:n}),code:e.memo(({children:n,className:o})=>{if(typeof o=="string"&&o.includes("language-")){const c=(Array.isArray(n)?n.join(""):typeof n=="string"?n:"").replace(/\n$/,"");return t.jsx(rr,{"data-hook":"chat-message-code-block",children:t.jsx(Pe,{value:c,maxHeight:216,onOpenInEditor:()=>{var u;(u=a.current)==null||u.call(a,{type:"code",value:c})}})})}return t.jsx("code",{children:n})},(n,o)=>n.children===o.children&&n.className===o.className)}),ua=e.memo(({content:a,messageId:n,onOpenInEditor:o})=>{const c=e.useRef(o);e.useEffect(()=>{c.current=o},[o]);const u=e.useMemo(()=>sr(c),[]);return t.jsx(ir,{children:t.jsx(Ka,{allowImages:!0,components:u,children:a})},n)},(a,n)=>a.content===n.content);function ga(a){return a>=1e3?`${(a/1e3).toFixed(1)}K`:a.toString()}const pa=i.div.withConfig({displayName:"AssistantMessageContent__Divider"})([`
280
- width: 100%;
281
- height: 1px;
282
- background: linear-gradient(
283
- 90deg,
284
- `,` 0%,
285
- rgba(54, 14, 26, 0) 100%
286
- );
287
- margin-bottom: 1rem;
288
- `],r("dividerAccent")),fa=i.div.withConfig({displayName:"AssistantMessageContent__OperationHistoryContainer"})([`
289
- width: 100%;
290
- `]),or=i(S).attrs({alignItems:"center",gap:"1rem"}).withConfig({displayName:"AssistantMessageContent__AssistantHeader"})([`
291
- width: 100%;
292
- padding: 1.2rem 0.4rem;
293
- flex: 1 0 auto;
294
- `]),lr=i(de).attrs({className:"assistant-label"}).withConfig({displayName:"AssistantMessageContent__AssistantLabel"})([`
295
- font-size: 1.4rem;
296
- color: `,`;
297
- `],r("foreground")),dr=i(S).attrs({className:"token-display"}).withConfig({displayName:"AssistantMessageContent__TokenDisplay"})([`
298
- align-items: center;
299
- gap: 0.9rem;
300
- margin: 0 0 0 auto;
301
- `]),ya=i(S).withConfig({displayName:"AssistantMessageContent__ExplanationContent"})([`
302
- display: flex;
303
- flex-direction: column;
304
- border-radius: 0.6rem;
305
- padding: 0 0.8rem;
306
- flex-shrink: 0;
307
- width: 100%;
308
- `]),cr=Zn([`
309
- 0%, 50% { opacity: 1; }
310
- 51%, 100% { opacity: 0; }
311
- `]),xa=i.span.withConfig({displayName:"AssistantMessageContent__StreamingCursor"})([`
312
- display: inline-block;
313
- width: 2px;
314
- height: 1.4em;
315
- background: `,`;
316
- margin-left: 2px;
317
- margin-right: auto;
318
- vertical-align: text-bottom;
319
- animation: `,` 1s infinite;
320
- `],r("foreground"),cr),hr=e.memo(({turnMessages:a,anchorMessage:n,status:o,isLiveOperation:c,isMessageStreaming:u,onScrollNeeded:g,onOpenInEditor:y})=>{const H=kt(),{operationHistory:A,endTimestamp:_,timeline:w}=e.useMemo(()=>{const l=n.operationHistory??[],v=l.filter(x=>x.type!==be.Aborted),R=l.length>0?Math.max(...l.map(x=>x.timestamp)):void 0,d=v.some(x=>{var h;return x.type===be.GeneratingResponse&&!!((h=x.content)!=null&&h.trim())});return{operationHistory:v.filter(x=>x.type!==be.GeneratingResponse),endTimestamp:R,timeline:d?Pa(v):null}},[n.operationHistory]),k=e.useMemo(()=>a.filter(l=>l.role==="assistant"&&typeof l.content=="string"&&!!l.content).map(l=>l.content).join(`
321
-
322
- `),[a]),b=!!k,p=e.useMemo(()=>{const l=n.tokenUsage;return!l||typeof l.inputTokens!="number"||typeof l.outputTokens!="number"?null:t.jsxs(t.Fragment,{children:[t.jsx("span",{style:{fontWeight:600},children:ga(l.inputTokens)})," ","input /"," ",t.jsx("span",{style:{fontWeight:600},children:ga(l.outputTokens)})," ","output tokens"]})},[n.tokenUsage]),N=t.jsxs(or,{"data-hook":"assistant-header",children:[t.jsx(it,{size:20,variant:"filled"}),t.jsx(lr,{children:n.model||"Assistant"}),p&&t.jsxs(dr,{className:"token-display",children:[t.jsx(na,{size:"16px",color:H.color.gray2}),t.jsx(de,{size:"sm",color:"gray2",children:p})]})]});if(w&&w.length>0){let l=!1;return t.jsxs(t.Fragment,{children:[w.map((v,R)=>{const d=R===w.length-1;if(v.type==="operations")return t.jsxs(lt.Fragment,{children:[R===0&&t.jsx(pa,{}),t.jsx(fa,{children:t.jsx(ma,{operationHistory:v.operations,status:o,isLive:c&&d,onScrollNeeded:g,collapsed:!d,endTimestamp:v.endTimestamp})})]},`ops-${v.timestamp}`);const x=!l;return l=!0,t.jsxs(lt.Fragment,{children:[x&&N,t.jsx(ya,{children:t.jsx(ua,{content:v.content,messageId:n.id,onOpenInEditor:y})})]},`content-${v.timestamp}`)}),u&&t.jsx(xa,{"data-hook":"streaming-cursor"})]})}return t.jsxs(t.Fragment,{children:[A.length>0&&t.jsxs(t.Fragment,{children:[t.jsx(pa,{}),t.jsx(fa,{children:t.jsx(ma,{operationHistory:A,status:o,isLive:c,onScrollNeeded:g,collapsed:b||!!n.error,endTimestamp:_})})]}),b&&t.jsxs(t.Fragment,{children:[N,t.jsxs(ya,{children:[t.jsx(ua,{content:k,messageId:n.id,onOpenInEditor:y}),u&&t.jsx(xa,{"data-hook":"streaming-cursor"})]})]})]})},(a,n)=>{const o=a.turnMessages[a.turnMessages.length-1],c=n.turnMessages[n.turnMessages.length-1];return o===c&&a.anchorMessage===n.anchorMessage&&a.status===n.status&&a.isLiveOperation===n.isLiveOperation&&a.isMessageStreaming===n.isMessageStreaming}),mr=i(S).withConfig({displayName:"ChatMessages__MessagesContainer"})([`
323
- display: flex;
324
- flex-direction: column;
325
- gap: 1.5rem;
326
- padding: 2rem 1rem;
327
- overflow-y: auto;
328
- flex: 1 1 auto;
329
- min-height: 0;
330
- width: 100%;
331
- `,`
332
- `],({$scrolled:a})=>!a&&re([`
333
- opacity: 0;
334
- `])),ur=i(S).attrs({align:"flex-start"}).withConfig({displayName:"ChatMessages__MessageBubble"})([`
335
- display: flex;
336
- flex-direction: column;
337
- gap: 0.5rem;
338
- padding: 0.8rem;
339
- border-radius: 0.8rem;
340
- width: 100%;
341
- align-self: flex-end;
342
- background: `,`;
343
- border: 1px solid `,`;
344
- flex-shrink: 0;
345
- `],r("loginBackground"),r("black32")),Ca=i(S).withConfig({displayName:"ChatMessages__UserRequestBox"})([`
346
- display: flex;
347
- flex-direction: column;
348
- gap: 0.5rem;
349
- padding: 0.8rem;
350
- width: 100%;
351
- align-self: flex-end;
352
- background: `,`;
353
- border: 1px solid `,`;
354
- border-radius: 0.6rem;
355
- flex-shrink: 0;
356
- `],r("loginBackground"),r("black32")),gr=i(S).attrs({alignItems:"center",gap:"0.8rem"}).withConfig({displayName:"ChatMessages__UserRequestHeader"})([`
357
- width: 100%;
358
- padding: 0.4rem;
359
- flex: 1 0 auto;
360
- `]),ht=i(S).withConfig({displayName:"ChatMessages__UserRequestContent"})([`
361
- display: flex;
362
- flex-direction: column;
363
- border-radius: 0.6rem;
364
- overflow: hidden;
365
- flex-shrink: 0;
366
- width: 100%;
367
- align-items: flex-start;
368
- `]),wa=i.div.withConfig({displayName:"ChatMessages__InlineSQLEditor"})([`
369
- width: 100%;
370
- `]),pr=i(S).attrs({gap:"1rem",alignItems:"center"}).withConfig({displayName:"ChatMessages__OperationBadge"})([`
371
- width: 100%;
372
- padding: 0 0.4rem;
373
- `]),fr=i(S).attrs({align:"center",justifyContent:"center"}).withConfig({displayName:"ChatMessages__BadgeIconContainer"})([`
374
- background: `,`;
375
- border: 1px solid `,`;
376
- border-radius: 0.4rem;
377
- padding: 0.8rem;
378
- width: 4.8rem;
379
- height: 4rem;
380
- flex-shrink: 0;
381
- `],r("aiBadgeIconBg"),r("aiBadgeIconBorder")),yr=i.div.withConfig({displayName:"ChatMessages__BadgeIconWrapper"})([`
382
- width: 2.4rem;
383
- height: 2.4rem;
384
- display: flex;
385
- align-items: center;
386
- justify-content: center;
387
- color: `,`;
388
-
389
- svg {
390
- width: 100%;
391
- height: 100%;
392
- }
393
- `],({theme:a})=>a.color.pink),xr=i(de).withConfig({displayName:"ChatMessages__BadgeTitle"})([`
394
- font-weight: 500;
395
- font-size: 1.6rem;
396
- line-height: 1.6rem;
397
- color: `,`;
398
- `],r("foreground")),Cr=i(S).withConfig({displayName:"ChatMessages__BadgeDescriptionContainer"})([`
399
- align-items: flex-start;
400
- flex-direction: column;
401
- padding: 0.8rem;
402
- width: 100%;
403
- `]),wr=i(de).withConfig({displayName:"ChatMessages__BadgeDescriptionText"})([`
404
- font-size: 1.4rem;
405
- line-height: 2.1rem;
406
- color: `,`;
407
- `],r("foreground")),br=i(de).withConfig({displayName:"ChatMessages__BadgeDescriptionIssueText"})([`
408
- font-size: 1.4rem;
409
- line-height: 2.1rem;
410
- font-weight: 600;
411
- `]),Ar=i(S).withConfig({displayName:"ChatMessages__IssueMessageRow"})([`
412
- display: flex;
413
- align-items: center;
414
- gap: 0.5rem;
415
- `]),ba=i(ue).withConfig({displayName:"ChatMessages__SchemaNameDisplay"})([`
416
- margin-left: 0.4rem;
417
- padding: 0.5rem 1rem;
418
- align-items: center;
419
- gap: 1rem;
420
- border-radius: 0.6rem;
421
- border: 1px solid `,`;
422
- background: `,`;
423
-
424
- &:hover,
425
- &:active {
426
- background: `,` !important;
427
- border-color: `,` !important;
428
- }
429
- `],r("selection"),r("backgroundDarker"),r("backgroundLighter"),r("cyan")),Aa=i(de).withConfig({displayName:"ChatMessages__SchemaName"})([`
430
- font-size: 1.4rem;
431
- color: `,`;
432
- `],r("foreground")),va=i(de).withConfig({displayName:"ChatMessages__MessageContent"})([`
433
- font-size: 1.4rem;
434
- line-height: 1.8rem;
435
- color: `,`;
436
- white-space: pre-wrap;
437
- word-wrap: break-word;
438
- `],r("foreground")),vr=i(S).withConfig({displayName:"ChatMessages__ExplanationBox"})([`
439
- display: flex;
440
- flex-direction: column;
441
- gap: 0.8rem;
442
- width: 100%;
443
- align-self: flex-start;
444
- text-align: left;
445
- background: transparent;
446
- padding: 0.4rem;
447
- border-radius: 0.6rem;
448
- flex-shrink: 0;
449
-
450
- `,`
451
-
452
- .assistant-label,
453
- .token-display {
454
- transition: opacity 0.2s;
455
- opacity: 0;
456
- }
457
-
458
- &:hover,
459
- &:focus-within {
460
- .assistant-label,
461
- .token-display {
462
- opacity: 1;
463
- }
464
- }
465
- `],({$hasOperationHistory:a})=>a&&re([`
466
- padding-top: 0;
467
- `])),kr=i.div.withConfig({displayName:"ChatMessages__ErrorContainer"})([`
468
- display: flex;
469
- align-items: center;
470
- flex-shrink: 0;
471
- gap: 0.5rem;
472
- padding: 0.4rem 0.4rem 0.4rem 0.8rem;
473
- border: 1px solid `,`;
474
- border-radius: 0.6rem;
475
- color: `,`;
476
- font-size: 1.4rem;
477
- line-height: 2rem;
478
- width: 100%;
479
- `],r("red"),r("foreground")),Mr=i(ue).withConfig({displayName:"ChatMessages__RetryButton"})([`
480
- margin-left: auto;
481
- flex-shrink: 0;
482
- padding: 0.5rem 0.8rem;
483
- height: auto;
484
- `]),jr=i.div.withConfig({displayName:"ChatMessages__MessagesEnd"})([`
485
- min-height: 1px;
486
- width: 100%;
487
- background: transparent;
488
- `]),_r=i(S).withConfig({displayName:"ChatMessages__DiffContainer"})([`
489
- display: flex;
490
- flex-direction: column;
491
- gap: 1rem;
492
- margin-top: 1rem;
493
- padding: 0.8rem 1.2rem;
494
- border: 1px solid `,`;
495
- border-radius: 0.8rem;
496
- background: `,`;
497
- width: 100%;
498
- `],r("selection"),r("backgroundDarker")),Hr=i(S).withConfig({displayName:"ChatMessages__DiffHeader"})([`
499
- display: flex;
500
- align-items: center;
501
- justify-content: space-between;
502
- padding-bottom: 0.8rem;
503
- border-bottom: 1px solid `,`;
504
- width: 100%;
505
- `,`
506
- `],r("selectionDarker"),({$isExpanded:a})=>!a&&re([`
507
- border-bottom: 0;
508
- padding-bottom: 0;
509
- `])),Er=i(S).withConfig({displayName:"ChatMessages__DiffHeaderLeft"})([`
510
- display: flex;
511
- align-items: center;
512
- gap: 1rem;
513
- padding: 0.4rem 0;
514
- `]),Ir=i.span.withConfig({displayName:"ChatMessages__DiffHeaderLabel"})([`
515
- font-size: 1.4rem;
516
- color: `,`;
517
- `],r("offWhite")),Nr=i(S).withConfig({displayName:"ChatMessages__DiffHeaderRight"})([`
518
- display: flex;
519
- align-items: center;
520
- gap: 1.8rem;
521
- margin-left: auto;
522
- `]),ka=i(S).withConfig({displayName:"ChatMessages__DiffHeaderStatus"})([`
523
- display: flex;
524
- align-items: center;
525
- gap: 0.8rem;
526
- color: `,`;
527
- font-size: 1.3rem;
528
- `],({$isAccepted:a,$isRejected:n,$isRejectedWithFollowUp:o})=>n?r("red"):o?r("cyan"):a?r("greenDarker"):r("gray2")),Ma=i.span.withConfig({displayName:"ChatMessages__StatusIcon"})([`
529
- display: flex;
530
- align-items: center;
531
- color: `,`;
532
- `],({$isAccepted:a,$isRejected:n,$isRejectedWithFollowUp:o})=>n?r("red"):o?r("cyan"):a?r("greenDarker"):r("gray2")),It=i.button.withConfig({displayName:"ChatMessages__IconButton"})([`
533
- display: flex;
534
- align-items: center;
535
- justify-content: center;
536
- padding: 0;
537
- background: transparent;
538
- border: none;
539
- cursor: pointer;
540
- height: 2.2rem;
541
- width: 2.2rem;
542
- color: `,`;
543
-
544
- &:hover:not(:disabled) {
545
- svg {
546
- filter: brightness(1.3);
547
- }
548
- }
549
-
550
- &:disabled {
551
- opacity: 0.4;
552
- cursor: not-allowed;
553
- }
554
- `],r("gray2")),Vr=i(It).withConfig({displayName:"ChatMessages__ExpandButton"})([`
555
- width: 1.6rem;
556
- height: 1.6rem;
557
- `]),Zr=i.div.withConfig({displayName:"ChatMessages__DiffEditorWrapper"})([`
558
- position: relative;
559
- width: 100%;
560
- `]),Sr=i(S).withConfig({displayName:"ChatMessages__ButtonBar"})([`
561
- padding: 0.5rem;
562
- gap: 1rem;
563
- justify-content: center;
564
- flex-shrink: 0;
565
- width: fit-content;
566
- margin: 0 auto;
567
- background: `,`;
568
- border: 1px solid `,`;
569
- border-radius: 0.4rem;
570
- `],r("backgroundDarker"),r("selection")),qr=i(ue).withConfig({displayName:"ChatMessages__AcceptButton"})([`
571
- background: `,`;
572
- color: `,`;
573
- border: 0.1rem solid `,`;
574
- width: 10rem;
575
-
576
- &:hover:not(:disabled) {
577
- background: `,`;
578
- border-color: `,`;
579
- filter: brightness(1.2);
580
- }
581
- `],({theme:a})=>a.color.pinkDarker,r("foreground"),({theme:a})=>a.color.pinkDarker,({theme:a})=>a.color.pinkDarker,({theme:a})=>a.color.pinkDarker),Lr=i(ue).withConfig({displayName:"ChatMessages__RejectButton"})([`
582
- background: `,`;
583
- color: `,`;
584
- border: 1px solid transparent;
585
- width: 10rem;
586
-
587
- &:hover:not(:disabled) {
588
- background: `,`;
589
- border-color: transparent;
590
- }
591
- `],r("background"),r("foreground"),r("selection")),Dr=a=>{switch(a){case"fix_request":return{icon:t.jsx(sn,{size:24}),title:"Fix Query",description:"Help me debug and fix the error with the attached SQL query"};case"explain_request":return{icon:t.jsx(rn,{size:24}),title:"Explain Query",description:"Explain this query in detail"};case"schema_explain_request":return{icon:t.jsx(nn,{size:24}),title:"Explain Schema",description:"Provide an overview, detailed column descriptions and storage details."};case"health_issue_request":return{icon:t.jsx(an,{size:24}),title:"Health Issue Analysis",description:"Analyze table health issue and provide steps for resolution:"};default:return null}},Tr=(a,n)=>{switch(a){case"loading":return t.jsx(Ot,{size:24,color:n.color.red});case"success":return t.jsx(dn,{});case"error":return t.jsx(ln,{});default:return t.jsx(on,{})}},Fr=({messages:a,onAcceptChange:n,onRejectChange:o,onRunQuery:c,onOpenInEditor:u,onApplyToEditor:g,onRetry:y,onCancelQuery:H,runningQueryKey:A,queryNotifications:_,isOperationInProgress:w,editorSQL:k,isStreaming:b,isLoadingMessages:p,scrollToMessageId:N,onScrollToMessageComplete:l})=>{const v=kt(),R=Ut(),d=Ee(je.query.getTables),x=e.useRef(null),h=e.useRef(null),T=e.useRef(new Map),{status:Y}=Te(),[F,I]=e.useState(!1),V=e.useRef(!1),z=e.useCallback(()=>{if(F&&V.current||N)return;const E=F?"smooth":"instant";setTimeout(()=>{var m;(m=x.current)==null||m.scrollIntoView({behavior:E}),I(!0)})},[F,N]),Z=e.useCallback(E=>{const m=d.find(W=>W.table_name===E.tableName&&Qt(W)===E.kind);m&&R(bt.console.pushSidebarHistory({type:"tableDetails",payload:{tableName:m.table_name,isMatView:m.table_type==="M",isView:m.table_type==="V"}}))},[d]);e.useEffect(()=>{const E=h.current;if(!E)return;const m=()=>{V.current=!0};return E.addEventListener("wheel",m),()=>E.removeEventListener("wheel",m)},[]),e.useEffect(()=>{V.current=!1},[a.length]);const q=e.useMemo(()=>{for(let E=a.length-1;E>=0;E--){const m=a[E];if(m.role==="assistant"&&m.sql)return E}return-1},[a]),j=e.useRef(q>=0?q:-1),[Ie,ee]=e.useState(q>=0?new Set([q]):new Set);e.useEffect(()=>{q>=0&&q!==j.current&&(ee(E=>new Set([...E,q])),j.current=q)},[q]);const{visibleEntries:K,lastAssistantAnchorIndex:X,lastVisibleUserIndex:ve}=e.useMemo(()=>Ua(a),[a]),pe=e.useMemo(()=>Ga(b,a),[b,a]);e.useEffect(()=>{z()},[pe,z]),e.useLayoutEffect(()=>{if(!N||p)return;const E=T.current.get(N);if(E){const m=setTimeout(()=>{E.scrollIntoView({behavior:"smooth",block:"start"}),I(!0),l()},100);return()=>clearTimeout(m)}},[N,p,l]),e.useEffect(()=>()=>{l()},[]);const ke=K[K.length-1],J=K.length>0?ke.type==="user"?ke.index:ke.anchorIndex:-1,ze=X;return t.jsxs(mr,{ref:h,$scrolled:F,role:"log","data-hook":"chat-messages-container",children:[K.map(E=>{var tt,Ke,P;if(E.type==="user"){const{message:M}=E,U=`${M.id}`,fe=(tt=M.displayHealthIssueData)==null?void 0:tt.severity,at=Ae(M.sql||"")===Ae(k||""),ye=M.displayType,me=M.sql;if(ye&&ye!=="ask_request"){const Q=Dr(ye);let xe=null;if(ye==="schema_explain_request"&&M.displaySchemaData){const ae=M.displaySchemaData;xe=t.jsx(ht,{children:t.jsxs(ba,{onClick:()=>Z(ae),children:[t.jsx(At,{kind:ae.kind,partitionBy:ae.partitionBy,walEnabled:ae.walEnabled,designatedTimestamp:ae.designatedTimestamp}),t.jsx(Aa,{children:ae.tableName})]})})}else if(ye==="health_issue_request"&&M.displayHealthIssueData){const ae=M.displayHealthIssueData;xe=t.jsx(ht,{children:t.jsxs(ba,{children:[t.jsx(At,{kind:"table"}),t.jsx(Aa,{children:ae.tableName})]})})}else me&&(xe=t.jsx(ht,{children:t.jsx(wa,{"data-hook":"user-request-sql-editor",children:t.jsx(Pe,{value:me,maxHeight:216,onOpenInEditor:()=>u({type:"code",value:me},at)})})}));return t.jsxs(Ca,{"data-hook":"chat-message-user",ref:ae=>{ae&&T.current.set(M.id,ae)},children:[t.jsxs(pr,{children:[t.jsx(fr,{children:t.jsx(yr,{children:Q==null?void 0:Q.icon})}),t.jsx(xr,{children:Q==null?void 0:Q.title})]}),(Q==null?void 0:Q.description)&&t.jsxs(Cr,{children:[t.jsx(wr,{children:Q.description}),ye==="health_issue_request"&&((Ke=M.displayHealthIssueData)==null?void 0:Ke.issueMessage)&&t.jsxs(Ar,{children:[fe==="critical"?t.jsx(Ya,{size:14,weight:"fill",color:v.color.red}):t.jsx(Xa,{size:14,weight:"fill",color:v.color.orange}),t.jsx(br,{color:fe==="critical"?"red":"orange",children:M.displayHealthIssueData.issueMessage})]})]}),xe]},U)}if(ye==="ask_request"&&me){const Q=M.displayUserMessage||M.content||"";return t.jsxs(Ca,{"data-hook":"chat-message-user",ref:xe=>{xe&&T.current.set(M.id,xe)},children:[t.jsx(gr,{children:t.jsx(va,{children:Q})}),t.jsx(ht,{children:t.jsx(wa,{"data-hook":"user-request-sql-editor",children:t.jsx(Pe,{value:me,maxHeight:216,onOpenInEditor:()=>u({type:"code",value:me},at)})})})]},U)}return t.jsx(ur,{"data-hook":"chat-message-user",ref:Q=>{Q&&T.current.set(M.id,Q)},children:t.jsx(va,{children:M.displayUserMessage||M.content})},U)}const{anchorMessage:m,anchorIndex:W,turnMessages:$e}=E,Be=`${m.id}`,Qe=Ae(m.sql||"")===Ae(k||""),ce=!!m.sql,Ne=ce&&m.previousSQL!==void 0&&Ae(m.sql||"")===Ae(m.previousSQL||""),Le=Ie.has(W),he=m.isAccepted===!0,s=m.isRejected===!0,te=ce&&!he&&!s&&W<ve,We=W===J,Me=b&&We,De=ce&&!Ne&&!he&&!s&&!te&&We;let $="neutral";if(m.sql){const M=Ae(m.sql),U=vt(M);if(A&&U===A)$="loading";else if(_){const fe=(P=_[U])==null?void 0:P.latest;fe&&(fe.type===Fe.ERROR?$="error":(fe.type===Fe.SUCCESS||fe.type===Fe.INFO)&&($="success"))}}const B=Mt(m.previousSQL),Oe=Mt(m.sql),O=!!m.error,mt=O&&!b&&!w&&We,ut=W===ze&&w===!0,se=!!m.operationHistory&&m.operationHistory.length>0;return t.jsxs(vr,{$hasOperationHistory:se,"data-hook":"chat-message-assistant",ref:M=>{M&&T.current.set(m.id,M)},children:[t.jsx(hr,{turnMessages:$e,anchorMessage:m,status:Y,isLiveOperation:ut,isMessageStreaming:Me,onScrollNeeded:z,onOpenInEditor:u}),ce&&!Me&&t.jsxs(_r,{"data-hook":"inline-diff-container",children:[t.jsxs(Hr,{$isExpanded:Le,children:[t.jsxs(Er,{children:[t.jsx(Ja,{size:22,color:v.color.offWhite}),t.jsx(Ir,{children:"Suggested change"})]}),Ne&&t.jsxs(ka,{"data-hook":"diff-status-unchanged",children:[t.jsx(Ma,{children:t.jsx(Wt,{size:"14px"})}),"Already accepted"]}),!Ne&&(he||s||te)&&t.jsxs(ka,{$isAccepted:he,$isRejected:s,$isRejectedWithFollowUp:te,"data-hook":s?"diff-status-rejected":te?"diff-status-followed-up":"diff-status-accepted",children:[t.jsx(Ma,{$isAccepted:he,$isRejected:s,$isRejectedWithFollowUp:te,children:s?t.jsx(en,{size:"14px"}):te?t.jsx(Xt,{size:"14px"}):t.jsx(Wt,{size:"14px"})}),s?"Rejected":te?"Followed up":"Accepted"]}),t.jsxs(Nr,{children:[t.jsx(It,{onClick:M=>{M.stopPropagation(),$==="loading"&&m.sql?H==null||H(vt(Ae(m.sql))):m.sql&&c&&c(m.sql)},title:$==="loading"?"Cancel query":"Run this query","aria-label":$==="loading"?"Cancel query":"Run this query","data-hook":"message-action-run-sql",children:Tr($,v)}),!De&&g&&!(W===q&&he)&&!Qe&&t.jsx(It,{onClick:M=>{M.stopPropagation(),m.id&&m.sql&&!w&&(_e(He.AI_EDITOR_SUGGESTION_APPLY),g(m.id,m.sql))},title:"Apply to editor","aria-label":"Apply to editor",disabled:w,"data-hook":"message-action-apply",children:t.jsx(ra,{size:22,color:v.color.offWhite})}),t.jsx(Vr,{title:"Expand diff view","aria-label":Le?"Collapse diff view":"Expand diff view","aria-expanded":Le,"data-hook":"diff-expand-button",onClick:()=>{ee(M=>{const U=new Set(M);return U.has(W)?U.delete(W):U.add(W),U})},children:t.jsx(tn,{})})]})]}),Le&&t.jsxs(t.Fragment,{children:[t.jsx(Zr,{children:t.jsx(Pe,{diffEditor:!0,original:B,modified:Oe,maxHeight:300,onOpenInEditor:()=>u({type:"diff",original:B??"",modified:Oe??""}),handleScrollNeeded:z})}),De&&t.jsxs(Sr,{align:"center",justifyContent:"center",children:[o&&m.id&&t.jsx(Lr,{onClick:()=>o(m.id),"data-hook":"message-action-reject",children:"Reject"}),n&&m.id&&t.jsx(qr,{onClick:()=>n(m.id),"data-hook":"message-action-accept",children:"Accept"})]})]})]}),O&&t.jsxs(kr,{role:"alert","data-hook":"chat-message-error",children:[t.jsx($t,{size:16,color:v.color.red,style:{flexShrink:0}}),m.error,mt&&y&&t.jsx(Mr,{size:"sm",skin:"secondary",prefixIcon:t.jsx(Gt,{size:12}),onClick:()=>{const M=a.slice(0,W).findLastIndex(U=>U.role==="user");M>=0&&y(a[M].id)},"data-hook":"retry-button",children:"Retry"})]})]},Be)}),t.jsx(jr,{ref:x,"data-hook":"messages-end"})]})},Rr=i(S).withConfig({displayName:"ChatInput__InputContainer"})([`
592
- display: flex;
593
- flex-direction: column;
594
- align-items: stretch;
595
- gap: 0.8rem;
596
- padding: 1rem 1.2rem;
597
- flex-shrink: 0;
598
- width: 100%;
599
- margin-top: auto;
600
- border-top: 1px solid `,`;
601
- `],r("selection")),zr=i(S).withConfig({displayName:"ChatInput__InputWrapper"})([`
602
- display: flex;
603
- position: relative;
604
- width: 100%;
605
- overflow: hidden;
606
- `]),$r=i.textarea.withConfig({displayName:"ChatInput__StyledTextArea"})([`
607
- flex: 1;
608
- min-height: 8rem;
609
- max-height: 30rem;
610
- line-height: 1.3;
611
- padding: `,`;
612
- background: `,`;
613
- border: 1px solid `,`;
614
- border-radius: 0.6rem;
615
- color: `,`;
616
- font-size: 1.4rem;
617
- font-family: `,`;
618
- resize: none;
619
- outline: none;
620
-
621
- &:focus {
622
- border-color: `,`;
623
- }
624
-
625
- &::placeholder {
626
- color: `,`;
627
- }
628
-
629
- &:disabled {
630
- opacity: 0.5;
631
- }
632
- `],({$hasContext:a})=>a?"4.4rem 4.5rem 1.2rem 1.2rem":"1.2rem 4.5rem 1.2rem 1.2rem",r("backgroundDarker"),r("selection"),r("foreground"),({theme:a})=>a.font,r("pinkDarker"),r("gray2")),Br=i.button.withConfig({displayName:"ChatInput__ActionButton"})([`
633
- position: absolute;
634
- right: 0.8rem;
635
- bottom: 0.8rem;
636
- padding: 0.6rem;
637
- border: none;
638
- display: flex;
639
- align-items: center;
640
- justify-content: center;
641
- border-radius: 0.4rem;
642
- cursor: pointer;
643
- `]),Qr=i.div.withConfig({displayName:"ChatInput__ContextBadgeContainer"})([`
644
- position: absolute;
645
- padding: 0.8rem;
646
- top: 2px;
647
- border-radius: 0.6rem;
648
- left: 1px;
649
- width: calc(100% - 0.2rem);
650
- display: inline-flex;
651
- background: `,`;
652
- `],r("backgroundDarker")),Wr=i.button.withConfig({displayName:"ChatInput__ContextBadge"})([`
653
- display: flex;
654
- padding: 0.3rem 0.6rem;
655
- align-items: center;
656
- gap: 0.4rem;
657
- line-height: 1.4;
658
- border-radius: 0.6rem;
659
- border: 1px solid
660
- `,`;
661
- background: `,`;
662
- color: `,`;
663
- font-size: 1.3rem;
664
- user-select: none;
665
- cursor: `,`;
666
- font-family: inherit;
667
-
668
- &:hover {
669
- border: 1px solid
670
- `,`;
671
- color: `,`;
672
- }
673
- `],({$warn:a,theme:n})=>a?n.color.red:n.color.selection,r("chatBackground"),({theme:a})=>a.color.gray2,({$warn:a})=>a?"default":"pointer",({$warn:a,theme:n})=>a?n.color.red:n.color.offWhite,({theme:a})=>a.color.offWhite),Or=i.div.withConfig({displayName:"ChatInput__ContextBadgeIcon"})([`
674
- display: flex;
675
- align-items: center;
676
- color: `,`;
677
- flex-shrink: 0;
678
-
679
- svg {
680
- color: `,`;
681
- }
682
- `],r("gray2"),({$warn:a,theme:n})=>a?n.color.red:r("gray2")),Kr=i(Br).withConfig({displayName:"ChatInput__SendButton"})([`
683
- background: `,`;
684
- color: `,`;
685
-
686
- &:hover:not(:disabled) {
687
- background: `,`;
688
- }
689
-
690
- &:disabled {
691
- opacity: 0.5;
692
- cursor: not-allowed;
693
- }
694
- `],r("pinkDarker"),r("foreground"),r("pink")),Pr=i.div.withConfig({displayName:"ChatInput__ThoughtStream"})([`
695
- display: flex;
696
- position: relative;
697
- width: 100%;
698
- background: `,`;
699
- border: 1px solid transparent;
700
- background:
701
- linear-gradient(`,", ",`)
702
- padding-box,
703
- `,` border-box;
704
- border-radius: 0.6rem;
705
- height: 4rem;
706
- `],r("backgroundDarker"),r("backgroundDarker"),r("backgroundDarker"),mn),Ur=i.div.withConfig({displayName:"ChatInput__ThoughtStreamContent"})([`
707
- display: flex;
708
- align-items: center;
709
- background: `,`;
710
- gap: 0.8rem;
711
- width: 100%;
712
- height: 100%;
713
- border-radius: 0.6rem;
714
- padding: 0 1.2rem;
715
- padding-right: 4.5rem;
716
- `],r("backgroundDarker")),Gr=i.div.withConfig({displayName:"ChatInput__ThoughtText"})([`
717
- font-weight: 500;
718
- font-size: 1.4rem;
719
- color: `,`;
720
- `,`
721
- `],r("gray2"),Bt),Yr=i.div.withConfig({displayName:"ChatInput__StopButtonWrapper"})([`
722
- position: absolute;
723
- right: 0.8rem;
724
- top: 50%;
725
- transform: translateY(-50%);
726
- `]),Nt=(a,n=30)=>{if(!a)return"";const o=a.trim().replace(/\s+/g," ");return o.length<=n?o:o.slice(0,n)+"..."},Xr=e.forwardRef(({onSend:a,disabled:n=!1,placeholder:o="Ask a question or request a refinement...",contextSQL:c,contextTableId:u,contextNotebook:g,onContextClick:y},H)=>{const[A,_]=e.useState(""),w=e.useRef(null),k=Ee(je.query.getTables),b=e.useMemo(()=>u==null?null:k.find(I=>I.id===u)??null,[u,k]),p=g?Nt(g.label):b!=null&&b.table_name?Nt(b.table_name):c?Nt(c):null,N=!!p,l=g==null?void 0:g.warn,v=g?l==="archived"?"Notebook archived":l==="deleted"?"Notebook deleted":`Attached: ${g.label} \u2014 click to switch`:void 0;e.useImperativeHandle(H,()=>({focus:()=>{var I;(I=w.current)==null||I.focus()}}));const{status:R,abortOperation:d}=Te(),x=ge(R);e.useEffect(()=>{w.current&&(w.current.style.height="auto",w.current.style.height=`${w.current.scrollHeight}px`)},[A]);const h=()=>{const I=A.trim();I&&!n&&!x&&(a(I),_(""),w.current&&(w.current.style.height="auto"))},T=I=>{I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),h())},Y=()=>{d()},F=x;return t.jsxs(Rr,{children:[F?t.jsxs(Pr,{"data-hook":"chat-assistant-modes",children:[t.jsxs(Ur,{children:[t.jsx(wt,{size:20}),t.jsx(Gr,{role:"status","aria-live":"polite",children:R})]}),t.jsx(Yr,{children:t.jsx(cn,{size:"md",onClick:Y,title:"Stop generation",ariaLabel:"Stop AI generation",dataHook:"chat-stop-button"})})]}):t.jsxs(zr,{children:[N&&t.jsx(Qr,{children:t.jsxs(Wr,{type:"button",$warn:!!l,onClick:g?()=>void g.onClick():y,title:v,"aria-label":`Chat context: ${p}`,"data-hook":"chat-context-badge",children:[t.jsx(Or,{$warn:!!l,children:g?t.jsx(hn,{size:14,weight:"regular"}):b?t.jsx(At,{kind:Qt(b),partitionBy:b.partitionBy,walEnabled:b.walEnabled,designatedTimestamp:b.designatedTimestamp}):t.jsx(aa,{size:14,weight:"regular"})}),l==="archived"?`Archived: ${p}`:l==="deleted"?`Deleted: ${p}`:p]})}),t.jsx($r,{ref:w,value:A,onChange:I=>_(I.target.value),onKeyDown:T,placeholder:o,"aria-label":"Chat with AI assistant","aria-keyshortcuts":"Enter",disabled:n,rows:1,$hasContext:N,"data-hook":"chat-input-textarea"}),t.jsx(Kr,{onClick:h,disabled:!A.trim()||n,title:"Send (Enter) \u2022 New line (Shift+Enter)","aria-label":"Send message","data-hook":"chat-send-button",children:t.jsx(Yt,{size:20,weight:"bold"})})]}),t.jsx(de,{color:"gray2",size:"sm",align:"center",children:"Chats are connected to a single query to improve responses."})]})}),Vt=i.div.withConfig({displayName:"ChatHistoryItem__Container"})([`
727
- display: flex;
728
- align-items: center;
729
- gap: 0.6rem;
730
- padding: 0.4rem 0.8rem;
731
- border-radius: 4px;
732
- cursor: `,`;
733
- background: `,`;
734
- opacity: `,`;
735
- border: 0;
736
- width: 100%;
737
- text-align: left;
738
-
739
- &:hover,
740
- &:focus-visible {
741
- background: `,`;
742
-
743
- .chat-title {
744
- color: `,`;
745
- }
746
- }
747
-
748
- &:focus-visible {
749
- outline: 2px solid `,`;
750
- outline-offset: -2px;
751
- }
752
- `],({$disabled:a})=>a?"not-allowed":"pointer",r("transparent"),({$disabled:a})=>a?.5:1,({$disabled:a})=>a?"transparent":r("selection"),({$disabled:a})=>a?r("offWhite"):r("foreground"),r("pink")),Jr=i.div.withConfig({displayName:"ChatHistoryItem__IconWrapper"})([`
753
- display: flex;
754
- align-items: center;
755
- justify-content: center;
756
- flex-shrink: 0;
757
- color: `,`;
758
- `],r("gray2")),e0=i.div.withConfig({displayName:"ChatHistoryItem__Content"})([`
759
- display: flex;
760
- flex-direction: column;
761
- flex: 1;
762
- min-width: 0;
763
- padding-left: 0.4rem;
764
- `]),t0=i.div.attrs({className:"chat-title"}).withConfig({displayName:"ChatHistoryItem__Title"})([`
765
- padding: 0.2rem 0.4rem;
766
- border: 1px solid transparent;
767
- color: `,`;
768
- white-space: nowrap;
769
- overflow: hidden;
770
- text-overflow: ellipsis;
771
- transform: translateX(-0.4rem);
772
- `],r("offWhite")),a0=i.input.withConfig({displayName:"ChatHistoryItem__TitleInput"})([`
773
- color: `,`;
774
- background: transparent;
775
- border: 1px solid `,`;
776
- border-radius: 6px;
777
- outline: none;
778
- padding: 0.2rem 0.4rem;
779
- font-family: inherit;
780
- transform: translateX(-0.4rem);
781
-
782
- &:focus {
783
- outline: none;
784
- }
785
-
786
- &::selection {
787
- background: `,`;
788
- }
789
- &::-moz-selection {
790
- background: `,`;
791
- }
792
- &::-webkit-selection {
793
- background: `,`;
794
- }
795
- `],r("foreground"),r("pinkDarker"),r("pinkPrimary"),r("pinkPrimary"),r("pinkPrimary")),n0=i.div.withConfig({displayName:"ChatHistoryItem__Subtitle"})([`
796
- font-size: 1.2rem;
797
- line-height: 1.5;
798
- color: `,`;
799
- white-space: nowrap;
800
- overflow: hidden;
801
- text-overflow: ellipsis;
802
- `],r("gray2")),r0=i.div.withConfig({displayName:"ChatHistoryItem__ActionsContainer"})([`
803
- display: flex;
804
- align-items: center;
805
- gap: 0.4rem;
806
- flex-shrink: 0;
807
- `]),ja=i.button.withConfig({displayName:"ChatHistoryItem__ActionButton"})([`
808
- display: flex;
809
- align-items: center;
810
- justify-content: center;
811
- padding: 0.4rem;
812
- background: transparent;
813
- border: none;
814
- border-radius: 4px;
815
- cursor: pointer;
816
- color: `,`;
817
- opacity: 0;
818
-
819
- `,`:hover &,
820
- `,`:focus-within & {
821
- opacity: 1;
822
- }
823
-
824
- &:focus-visible {
825
- opacity: 1;
826
- outline: 2px solid `,`;
827
- outline-offset: -2px;
828
- }
829
-
830
- &:hover {
831
- background: `,`;
832
- }
833
- `],r("foreground"),Vt,Vt,r("pink"),r("backgroundDarker")),i0=i.span.withConfig({displayName:"ChatHistoryItem__CurrentIndicator"})([`
834
- font-size: 1.2rem;
835
- line-height: 1.5rem;
836
- color: `,`;
837
- white-space: nowrap;
838
- `],r("mutedLabel")),s0=({conversation:a,subtitle:n,isCurrent:o,hasOngoingProcess:c,disabled:u,onSelect:g,onRename:y,onDelete:H})=>{const[A,_]=e.useState(!1),[w,k]=e.useState(a.conversationName),b=e.useRef(null);e.useEffect(()=>{A&&b.current&&(b.current.focus(),b.current.select())},[A]);const p=h=>{h.stopPropagation(),k(a.conversationName),_(!0)},N=h=>{h.stopPropagation(),H(a.id)},l=async()=>{const h=w.trim();h&&h!==a.conversationName&&(_e(He.AI_CHAT_RENAME),await y(a.id,h)),_(!1)},v=async h=>{h.key==="Enter"?await l():h.key==="Escape"&&(k(a.conversationName),_(!1))},R=async()=>{await l()},d=async()=>{!A&&!u&&await g(a.id)},x=async h=>{A||u||h.target===h.currentTarget&&(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),await g(a.id))};return t.jsxs(Vt,{role:"button",tabIndex:u?-1:0,"aria-disabled":u||void 0,onClick:d,onKeyDown:x,$disabled:u,"data-hook":"chat-history-item",children:[t.jsx(Jr,{children:t.jsx(Jt,{size:18})}),t.jsxs(e0,{children:[A?t.jsx(a0,{ref:b,value:w,onChange:h=>k(h.target.value),onKeyDown:v,onBlur:R,onClick:h=>h.stopPropagation(),"data-hook":"chat-history-rename"}):t.jsx(t0,{"data-hook":"chat-history-title",children:a.conversationName}),n&&t.jsx(n0,{children:n})]}),t.jsxs(r0,{children:[!A&&t.jsxs(t.Fragment,{children:[t.jsx(ja,{onClick:p,title:"Edit title","data-hook":"chat-history-edit",children:t.jsx(un,{size:18})}),!c&&t.jsx(ja,{onClick:N,title:"Delete","data-hook":"chat-history-delete",children:t.jsx(sa,{size:18})})]}),o&&t.jsx(i0,{children:"Current"})]})]})},o0=i.div.withConfig({displayName:"DateSeparator__Container"})([`
839
- display: flex;
840
- align-items: center;
841
- gap: 1rem;
842
- padding: 0.4rem 0;
843
- width: 100%;
844
- `]),_a=i.div.withConfig({displayName:"DateSeparator__Line"})([`
845
- flex: 1;
846
- height: 1px;
847
- background: `,`;
848
- `],r("selection")),l0=i.div.withConfig({displayName:"DateSeparator__LabelContainer"})([`
849
- display: flex;
850
- align-items: center;
851
- gap: 0.8rem;
852
- color: `,`;
853
- `],r("gray2")),d0=i.span.withConfig({displayName:"DateSeparator__Label"})([`
854
- font-size: 1.3rem;
855
- letter-spacing: 0.016rem;
856
- white-space: nowrap;
857
- `]),c0=({label:a})=>t.jsxs(o0,{children:[t.jsx(_a,{}),t.jsxs(l0,{children:[t.jsx(ea,{size:16}),t.jsx(d0,{children:a})]}),t.jsx(_a,{})]}),h0=6e4;function Ha(a){const n=gn(),o=fn(n);return pn(a,new Date().getTime(),{locale:o})+" ago"}function m0(a){const n=[...a].sort((g,y)=>y.updatedAt-g.updatedAt),o=new Map;for(const g of n){const y=Ha(g.updatedAt),H=o.get(y)||[];o.set(y,[...H,g])}const c=[],u=new Set;for(const g of n){const y=Ha(g.updatedAt);u.has(y)||(u.add(y),c.push({label:y,conversations:o.get(y)||[]}))}return c}function u0(a){const[n,o]=e.useState(0);return e.useEffect(()=>{const c=setInterval(()=>{o(u=>u+1)},h0);return()=>clearInterval(c)},[]),e.useMemo(()=>m0(a),[a,n])}function g0(a,n){if(!n.trim())return a;const o=n.toLowerCase().trim();return a.filter(c=>c.conversationName.toLowerCase().includes(o))}const Ea=i.div.withConfig({displayName:"ChatHistoryView__Container"})([`
858
- display: flex;
859
- flex-direction: column;
860
- height: 100%;
861
- width: 100%;
862
- padding: 2rem 1rem 4rem 1rem;
863
- background: `,`;
864
- overflow: hidden;
865
- `],r("chatBackground")),p0=i.div.withConfig({displayName:"ChatHistoryView__SearchContainer"})([`
866
- position: relative;
867
- display: flex;
868
- align-items: center;
869
- flex-shrink: 0;
870
- `]),f0=i.div.withConfig({displayName:"ChatHistoryView__SearchIcon"})([`
871
- position: absolute;
872
- left: 1.2rem;
873
- display: flex;
874
- align-items: center;
875
- color: `,`;
876
- pointer-events: none;
877
- z-index: 1;
878
- `],r("gray2")),y0=i.button.withConfig({displayName:"ChatHistoryView__ClearButton"})([`
879
- position: absolute;
880
- right: 0.8rem;
881
- display: flex;
882
- align-items: center;
883
- justify-content: center;
884
- padding: 0.2rem;
885
- background: transparent;
886
- border: none;
887
- border-radius: 4px;
888
- cursor: pointer;
889
- color: `,`;
890
-
891
- &:hover {
892
- color: `,`;
893
- }
894
- `],r("gray2"),r("foreground")),x0=i(Cn).withConfig({displayName:"ChatHistoryView__SearchInput"})([`
895
- width: 100%;
896
- background: transparent;
897
- color: `,`;
898
- padding: 0.8rem 3.6rem 0.8rem 3.6rem;
899
- border: 1px solid `,`4d;
900
- height: 3rem;
901
- border-radius: 0.6rem;
902
-
903
- &:focus {
904
- background: transparent;
905
- border-color: `,`;
906
- }
907
- `],r("foreground"),r("gray2"),r("pinkDarker")),C0=i.div.withConfig({displayName:"ChatHistoryView__ListContainer"})([`
908
- display: flex;
909
- flex-direction: column;
910
- gap: 0.6rem;
911
- padding: 2rem 0.4rem;
912
- overflow-y: auto;
913
- flex: 1;
914
- min-height: 0;
915
- `]),Ia=i.div.withConfig({displayName:"ChatHistoryView__EmptyState"})([`
916
- display: flex;
917
- flex-direction: column;
918
- align-items: center;
919
- justify-content: center;
920
- flex: 1;
921
- color: `,`;
922
- font-size: 1.3rem;
923
- text-align: center;
924
- padding: 2rem;
925
- `],r("gray2")),w0=i(Re.Content).withConfig({displayName:"ChatHistoryView__AlertDialogContent"})([`
926
- background: `,`;
927
- `],r("chatBackground")),b0=i.div.withConfig({displayName:"ChatHistoryView__DialogHeader"})([`
928
- display: flex;
929
- align-items: center;
930
- justify-content: space-between;
931
- padding: 1.5rem 2rem;
932
- border-bottom: 1px solid `,`;
933
- `],r("selection")),A0=i.h3.withConfig({displayName:"ChatHistoryView__DialogTitle"})([`
934
- margin: 0;
935
- font-weight: 500;
936
- color: `,`;
937
- `],r("foreground")),v0=i.p.withConfig({displayName:"ChatHistoryView__DialogDescription"})([`
938
- margin: 2rem;
939
- font-size: 1.4rem;
940
- line-height: 1.5;
941
- `]),k0=i.div.withConfig({displayName:"ChatHistoryView__DialogButtons"})([`
942
- display: flex;
943
- justify-content: flex-end;
944
- gap: 1rem;
945
- padding: 0 2rem 0 2rem;
946
- `]),M0=i(ue).attrs({skin:"secondary"}).withConfig({displayName:"ChatHistoryView__CancelButton"})([""]),j0=i(ue).withConfig({displayName:"ChatHistoryView__DeleteButton"})([`
947
- background: `,`;
948
- border-color: `,`;
949
-
950
- &:hover:not(:disabled) {
951
- background: `,`;
952
- filter: brightness(1.1);
953
- }
954
- `],r("red"),r("red"),r("red")),_0=({currentConversationId:a})=>{const[n,o]=e.useState(""),[c,u]=e.useState(!1),[g,y]=e.useState(null),H=e.useRef(null),{conversationMetas:A,chatWindowState:_,openChatWindow:w,updateConversationName:k,deleteConversation:b}=Ct(),{status:p}=Te(),{buffers:N}=xt(),l=Ee(je.query.getTables),v=e.useMemo(()=>Array.from(A.values()),[A]),R=e.useMemo(()=>g0(v,n),[v,n]),d=u0(R),x=(V,z)=>{if(V){if(z==="buffer"){const Z=N.find(q=>q.id===V);if(Z)return Z.label}else if(z==="table"){const Z=l.find(q=>q.id===V);if(Z)return Z.table_name}}},h=async V=>{await w(V)},T=async(V,z)=>{await k(V,z)},Y=V=>{y(V),u(!0)},F=async()=>{g&&await b(g),u(!1),y(null)},I=()=>{u(!1),y(null)};return e.useEffect(()=>{H.current&&H.current.scrollIntoView({block:"center"})},[]),v.length===0?t.jsx(Ea,{children:t.jsx(Ia,{"data-hook":"chat-history-empty",children:"No conversations yet"})}):t.jsxs(Ea,{children:[t.jsxs(p0,{children:[t.jsx(f0,{children:t.jsx(ia,{size:18})}),t.jsx(x0,{type:"text",placeholder:"Search chats",value:n,onChange:V=>o(V.target.value),"data-hook":"chat-history-search"}),n&&t.jsx(y0,{onClick:()=>o(""),title:"Clear search","data-hook":"chat-history-search-clear",children:t.jsx(Kt,{size:16})})]}),t.jsxs(C0,{"data-hook":"chat-history-list",children:[d.map((V,z)=>t.jsxs(lt.Fragment,{children:[z>0&&t.jsx(c0,{label:V.label}),V.conversations.map(Z=>{const q=Z.id===a;return t.jsx("div",{ref:q?H:void 0,children:t.jsx(s0,{conversation:Z,subtitle:Z.bufferId??Z.tableId?x(Z.bufferId??Z.tableId,Z.bufferId?"buffer":"table"):void 0,isCurrent:q,hasOngoingProcess:Z.id===_.activeConversationId&&ge(p),disabled:ge(p)&&Z.id!==_.activeConversationId,onSelect:h,onRename:T,onDelete:Y})},Z.id)})]},V.label)),R.length===0&&n&&t.jsx(Ia,{children:"No chats match your search"})]}),t.jsx(Re.Root,{open:c,onOpenChange:u,children:t.jsxs(Re.Portal,{children:[t.jsx(yn,{children:t.jsx(xn,{primitive:Re.Overlay})}),t.jsxs(w0,{maxwidth:"40rem",children:[t.jsx(b0,{children:t.jsx(A0,{children:"Delete conversation"})}),t.jsx(v0,{children:"Are you sure you want to delete this conversation? This action cannot be undone."}),t.jsxs(k0,{children:[t.jsx(Re.Cancel,{asChild:!0,children:t.jsx(M0,{onClick:I,children:"Cancel"})}),t.jsx(Re.Action,{asChild:!0,children:t.jsx(j0,{onClick:F,children:"Delete"})})]})]})]})})]})};async function H0(a){var w,k,b;const{normalizedSQL:n,queryKey:o,namespaceKey:c,quest:u,dispatch:g,executionRefs:y,releaseExecution:H}=a,{promise:A,queryId:_}=u.queryRaw(n,{limit:"0,1000",explain:!0,cancellable:!0});(w=a.onQueryStarted)==null||w.call(a,_);try{const p=await A;if(y.current[c]||(y.current[c]={}),y.current[c][o]={success:!0,queryText:n,startOffset:-1,endOffset:-1},g(Ue.setResult(p)),p.type===Ge.DDL||p.type===Ge.DML){g(Ue.addNotification({query:o,content:t.jsx(Ye,{query:n})},c)),Xe.publish(Je.MSG_QUERY_SCHEMA);return}if(p.type===Ge.NOTICE){g(Ue.addNotification({query:o,content:t.jsxs(de,{color:"foreground",ellipsis:!0,title:n,children:[p.notice,n!==""?`: ${n}`:""]}),type:Fe.NOTICE,sideContent:t.jsx(Ye,{query:n})},c)),Xe.publish(Je.MSG_QUERY_SCHEMA);return}p.type===Ge.DQL&&(g(Ue.addNotification({query:o,jitCompiled:((k=p.explain)==null?void 0:k.jitCompiled)??!1,content:t.jsx(wn,{...p.timings,rowCount:p.count}),sideContent:t.jsx(Ye,{query:n})},c)),Xe.publish(Je.MSG_QUERY_DATASET,p))}catch(p){const N=p;y.current[c]||(y.current[c]={}),y.current[c][o]={success:!1,queryText:n,startOffset:-1,endOffset:-1},g(Ue.addNotification({query:o,content:t.jsx(de,{color:"red",children:N.error||N.message||"Query execution failed"}),type:Fe.ERROR,sideContent:t.jsx(Ye,{query:n})},c))}finally{(b=a.onSettled)==null||b.call(a),H(o)}}const E0=i(ue).withConfig({displayName:"AIChatWindow__CancelButton"})([`
955
- padding: 1.2rem 0.6rem;
956
- `]),I0=i.div.withConfig({displayName:"AIChatWindow__HeaderLeft"})([`
957
- display: flex;
958
- align-items: center;
959
- gap: 1rem;
960
- flex: 1;
961
- min-width: 0;
962
- overflow: hidden;
963
- `]),N0=i.span.withConfig({displayName:"AIChatWindow__HeaderTitle"})([`
964
- white-space: nowrap;
965
- overflow: hidden;
966
- text-overflow: ellipsis;
967
- font-size: 1.6rem;
968
- `]),Zt=i(ue).attrs(({$active:a})=>({skin:"transparent",$active:a})).withConfig({displayName:"AIChatWindow__HeaderButton"})([`
969
- color: `,`;
970
- padding: 0.6rem;
971
-
972
- `,`
973
- `],r("foreground"),({$active:a})=>a&&re([`
974
- background: `,`;
975
- `],r("selection"))),V0=i.div.withConfig({displayName:"AIChatWindow__HeaderRight"})([`
976
- display: flex;
977
- align-items: center;
978
- gap: 0.5rem;
979
- flex-shrink: 0;
980
- `]),Z0=i.div.withConfig({displayName:"AIChatWindow__ChatWindowContent"})([`
981
- display: flex;
982
- height: 100%;
983
- width: 100%;
984
- overflow: hidden;
985
- `]),S0=i.div.withConfig({displayName:"AIChatWindow__InitialQueryContainer"})([`
986
- display: flex;
987
- flex-direction: column;
988
- gap: 1rem;
989
- padding: 1.5rem;
990
- overflow-y: auto;
991
- flex: 1 1 auto;
992
- min-height: 0;
993
- width: 100%;
994
- `]),q0=i.div.withConfig({displayName:"AIChatWindow__InitialQueryBox"})([`
995
- display: flex;
996
- flex-direction: column;
997
- align-self: flex-end;
998
- flex-shrink: 0;
999
- overflow: hidden;
1000
- width: 100%;
1001
- `]),L0=i.div.withConfig({displayName:"AIChatWindow__InitialQueryEditor"})([`
1002
- width: 100%;
1003
- overflow: hidden;
1004
- `]),D0=i.div.withConfig({displayName:"AIChatWindow__ButtonContainer"})([`
1005
- display: flex;
1006
- justify-content: flex-start;
1007
- align-items: center;
1008
- gap: 1rem;
1009
- width: 100%;
1010
- margin-top: 0.5rem;
1011
- `]),T0=i.div.withConfig({displayName:"AIChatWindow__BlankChatContainer"})([`
1012
- display: flex;
1013
- flex-direction: column;
1014
- align-items: flex-start;
1015
- justify-content: center;
1016
- gap: 1.2rem;
1017
- padding: 1.8rem;
1018
- flex: 1 1 auto;
1019
- min-height: 0;
1020
- max-width: 40rem;
1021
- text-align: center;
1022
- margin: 0 auto;
1023
- `]),F0=i.h2.withConfig({displayName:"AIChatWindow__BlankChatHeading"})([`
1024
- font-size: 2rem;
1025
- font-weight: 600;
1026
- text-align: left;
1027
- color: `,`;
1028
- margin: 0;
1029
- `],r("foreground")),R0=i.p.withConfig({displayName:"AIChatWindow__BlankChatSubheading"})([`
1030
- font-size: 1.4rem;
1031
- font-weight: 400;
1032
- color: `,`;
1033
- text-align: left;
1034
- margin: 0;
1035
- line-height: 1.5;
1036
- `],r("gray2")),Na=i(S).withConfig({displayName:"AIChatWindow__ChatPanel"})([`
1037
- display: flex;
1038
- flex-direction: column;
1039
- align-items: stretch;
1040
- height: 100%;
1041
- width: 100%;
1042
- gap: 0;
1043
- `]),z0=()=>{const a=Ut(),n=Ee(je.console.getActiveSidebar),{quest:o,questExecution:c}=e.useContext(yt),{editorRef:u,showPreviewBuffer:g,closePreviewBuffer:y,addBuffer:H,executionRefs:A,highlightQuery:_,buffers:w,activeBuffer:k,setActiveBuffer:b}=xt(),p=bn(),{conversationMetas:N,chatWindowState:l,isLoadingMessages:v,isStreaming:R,setIsStreaming:d,scrollToMessageId:x,setScrollToMessageId:h,closeChatWindow:T,openBlankChatWindow:Y,openHistoryView:F,closeHistoryView:I,getConversationMeta:V,addMessage:z,removeMessages:Z,updateMessage:q,updateMessagesWithCompaction:j,updateConversationName:Ie,acceptSuggestion:ee,rejectSuggestion:K,persistMessages:X,bindConversationToNotebook:ve,readUserActionDigest:pe,rotateUserActionDigest:ke}=Ct(),{status:J,setStatus:ze,abortController:E,canUse:m,hasSchemaAccess:W,currentModel:$e,apiKey:Be,aiAssistantSettings:Qe}=Te(),ce=Ee(je.query.getTables),{active:Ne}=An(),Le=(Ne==null?void 0:Ne.queryKey)??null,he=l.activeConversationId?V(l.activeConversationId):null,s=e.useMemo(()=>he?{...he,messages:p}:null,[he,p]),te=e.useMemo(()=>s?s.bufferId!==void 0?s.bufferId:s.id:-1,[s==null?void 0:s.bufferId,s==null?void 0:s.id]),We=Ee(je.query.getQueryNotificationsForBuffer(te)),Me=e.useRef(null),De=e.useRef(!1),$=e.useRef(null),B=e.useMemo(()=>Mt(s==null?void 0:s.currentSQL),[s==null?void 0:s.currentSQL]),Oe=e.useMemo(()=>vn(s==null?void 0:s.queryKey),[s==null?void 0:s.queryKey]),O=p,mt=e.useMemo(()=>kn(O)!==null,[O]),ut=e.useMemo(()=>O.length>0&&!v,[O,v]),se=e.useMemo(()=>O.length===0&&B&&B.trim()!==`
1044
- `&&m&&!ge(J),[O.length,B,m,J]),tt=e.useMemo(()=>!se||!s||!s.queryKey||!s.bufferId||!u.current?!1:oa(s.queryKey,s.bufferId,A,u)!==null,[se,s,u,A]),Ke=se&&tt&&m&&!ge(J),P=l.isHistoryOpen??!1,M=N.size>0,U=e.useMemo(()=>ge(J)?!0:s?s.messages.length===0&&!s.queryKey&&!s.tableId:!1,[s,J]),fe=e.useMemo(()=>{if(P)return"Chat history";if(!s)return"";if(s.conversationName)return s.conversationName;const f=s.messages[0];if(f!=null&&f.displayType)switch(f.displayType){case"fix_request":return"Fix query";case"explain_request":return"Explain query";case"ask_request":return"Ask AI";case"health_issue_request":return"Health issue analysis";default:return"AI Assistant"}return"AI Assistant"},[s,P]),at=e.useCallback(()=>{P?I():F()},[P,I,F]),ye=()=>O.length>0?"Ask a follow up question or request refinement...":(s==null?void 0:s.tableId)!=null||B!=null&&B.trim()?"Ask a question or request an edit...":"Ask AI about your tables, or generate a query...",me=e.useCallback(f=>{var Ve;const C=(Ve=V(f))==null?void 0:Ve.notebookBufferId,L=jn(),G=C?Mn(Vn(),C):null,ne=pe(f),Ce=w.filter(D=>!!D.notebookViewState&&typeof D.id=="number"),we=Ce.length>0||typeof k.id=="number"?{notebooks:Ce.map(D=>({buffer_id:D.id,label:D.label,archived:!!D.archived,...D.id===C?{bound_to_this_chat:!0}:{}})),active:typeof k.id=="number"?{buffer_id:k.id,label:k.label,kind:k.notebookViewState?"notebook":k.metricsViewState?"metrics":k.editorViewState?"sql":"other"}:void 0}:void 0;if(!(!G&&!ne&&!we))return{snapshot:G,digest:ne,workspace:we,readSeq:L}},[V,pe,w,k]),Q=(f,C=!1)=>{if(!m||!l.activeConversationId||!s)return;_e(He.AI_CHAT_SEND);const L=l.activeConversationId;C&&y();const G=s.messages.some(ne=>ne.role==="assistant");Ze(Pt({conversationId:L,userMessage:f,currentSQL:B,conversationHistory:s.messages,isFirstMessage:!G,settings:{model:$e,apiKey:Be},aiAssistantSettings:Qe,questClient:o,tables:ce,hasSchemaAccess:W,abortSignal:E==null?void 0:E.signal,notebookContext:me(L)}),{addMessage:z,removeMessages:Z,updateMessage:q,setStatus:ze,setIsStreaming:d,persistMessages:X,updateConversationName:Ie,bindConversationToNotebook:ve,rotateUserActionDigest:ke,updateMessagesWithCompaction:j})},xe=e.useCallback(async f=>{l.activeConversationId&&(_e(He.AI_CHAT_ACCEPT),await ee({conversationId:l.activeConversationId,messageId:f}))},[l.activeConversationId,ee]),ae=e.useCallback(async f=>{l.activeConversationId&&(_e(He.AI_CHAT_REJECT),await K(l.activeConversationId,f),setTimeout(()=>{var C;(C=Me.current)==null||C.focus()},100))},[l.activeConversationId,K]),Va=e.useCallback(f=>{if(!s)return;const C=Ae(f),L=vt(C);let G=null;c.requestExecution({abort:()=>{G!==null&&o.abort(G)},bufferId:te,queryKey:L,execute:()=>{const ne=window.setTimeout(()=>{a(bt.query.addNotification({query:L,type:Fe.LOADING,content:t.jsxs(S,{gap:"1rem",align:"center",children:[t.jsx(de,{color:"foreground",children:"Running..."}),t.jsx(E0,{skin:"error",onClick:()=>{c.cancelActive()},children:t.jsx(Ot,{size:"18px"})})]}),sideContent:t.jsx(Ye,{query:C})},te)),$.current=null},1e3);$.current=ne,H0({normalizedSQL:C,queryKey:L,namespaceKey:te,quest:o,dispatch:a,executionRefs:A,releaseExecution:c.releaseExecution,onQueryStarted:Ce=>{G=Ce},onSettled:()=>{$.current===ne&&(window.clearTimeout(ne),$.current=null)}})}})},[s,A,te,o,c]),Za=e.useCallback(f=>{var C;((C=c.getActive())==null?void 0:C.queryKey)===f&&($.current!==null&&(window.clearTimeout($.current),$.current=null),c.cancelActive())},[c]),gt=e.useCallback(async()=>{if(_e(He.AI_CONTEXT_BADGE_CLICK,{type:s!=null&&s.tableId?"table":"query"}),(s==null?void 0:s.queryKey)&&(s==null?void 0:s.bufferId))return await _(s.queryKey,s.bufferId);if(s!=null&&s.tableId){const f=ce.find(C=>C.id===s.tableId);if(f)return a(bt.console.pushSidebarHistory({type:"tableDetails",payload:{tableName:f.table_name,isMatView:f.table_type==="M",isView:f.table_type==="V"}})),!0}return!1},[s==null?void 0:s.queryKey,s==null?void 0:s.bufferId,s==null?void 0:s.tableId,_,ce]),Sa=e.useCallback(()=>{h(null)},[h]),St=e.useCallback(async(f,C=!1)=>{if(!(C&&await gt()))if(f.type==="diff"){if(!l.activeConversationId)return;g({type:"diff",original:f.original,modified:f.modified,conversationId:l.activeConversationId})}else H({value:f.value})},[g,H,l.activeConversationId,gt]),qa=e.useCallback(async(f,C)=>{if(!l.activeConversationId)return;const L=_n(C,!1);try{await ee({conversationId:l.activeConversationId,messageId:f,skipDefaultMessage:!0}),z({role:"user",content:`User replaced query with one of your previous suggestions. Now the query is:
1045
-
1046
- \`\`\`sql
1047
- ${L.replaceAll(/\s+/g," ").trim()}
1048
- \`\`\``,timestamp:Date.now(),hideFromUI:!0}),await X(l.activeConversationId)}catch(G){console.error("Error applying SQL to editor:",G),ot.error("Failed to apply changes to editor")}},[l.activeConversationId,ee,z,X]),La=e.useCallback(async f=>{if(!l.activeConversationId||!m||ge(J))return;const C=l.activeConversationId,L=O.find(D=>D.id===f);if(!L)return;const G=O.findIndex(D=>D.id===f);if(G<0)return;const ne=O.slice(G).map(D=>D.id),Ce=new Set(ne);Z(ne);const we={settings:{model:$e,apiKey:Be},aiAssistantSettings:Qe,questClient:o,tables:ce,hasSchemaAccess:W,abortSignal:E==null?void 0:E.signal,notebookContext:me(C)},Ve={addMessage:z,updateMessage:q,removeMessages:Z,setStatus:ze,setIsStreaming:d,persistMessages:X,updateConversationName:Ie,updateMessagesWithCompaction:j,bindConversationToNotebook:ve,rotateUserActionDigest:ke};switch(L.displayType){case"explain_request":{if(!L.sql)return;Ze(Dt({conversationId:C,queryText:L.sql,...we}),Ve);break}case"fix_request":{if(!L.sql)return;Ze(Tt({conversationId:C,queryText:L.sql,...we}),Ve);break}case"schema_explain_request":{if(!L.displaySchemaData)return;const D=L.displaySchemaData;try{const oe=D.kind==="matview"?await o.showMatViewDDL(D.tableName):D.kind==="view"?await o.showViewDDL(D.tableName):await o.showTableDDL(D.tableName);if((oe==null?void 0:oe.type)!==Ge.DQL||!oe.data||oe.data.length===0){ot.error("Failed to fetch table schema for retry");return}const rt=oe.data[0];if(!rt.ddl){ot.error("Failed to fetch table schema for retry");return}Ze(Hn({conversationId:C,tableName:D.tableName,schema:rt.ddl,kindLabel:En(D.kind),schemaDisplayData:D,...we}),Ve)}catch(oe){console.error("Error fetching DDL for retry:",oe),ot.error("Failed to fetch table schema for retry")}break}case"ask_request":default:{const D=L.displayUserMessage||L.content||"",oe=O.filter(ft=>!Ce.has(ft.id)),rt=oe.some(ft=>ft.role==="assistant");Ze(Pt({conversationId:C,userMessage:D,currentSQL:L.sql||B,conversationHistory:oe,isFirstMessage:!rt,...we}),Ve);break}}},[l.activeConversationId,m,J,O,Z,$e,Be,Qe,o,ce,W,E,z,q,ze,d,X,Ie,j,ve,me,B]),qt=e.useRef(null),nt=e.useCallback(()=>{var f,C;(C=(f=qt.current)==null?void 0:f.querySelector('button[data-hook="button-explain-query"]'))==null||C.click()},[]),pt=e.useCallback(f=>{se&&(f.metaKey||f.ctrlKey)&&(f.key==="e"||f.key==="E")&&(f.preventDefault(),nt())},[se]);e.useEffect(()=>{if(se)return Xe.subscribe(Je.EXPLAIN_QUERY_EXEC,nt),document.addEventListener("keydown",pt),()=>{document.removeEventListener("keydown",pt),Xe.unsubscribe(Je.EXPLAIN_QUERY_EXEC,nt)}},[se,pt,nt]),e.useEffect(()=>()=>{$.current!==null&&(window.clearTimeout($.current),$.current=null)},[]),e.useEffect(()=>{De.current||P||v||Me.current&&(Me.current.focus(),De.current=!0)},[P,v]);const Da=e.useCallback(async()=>{var f;De.current=!1,await Y(),(f=Me.current)==null||f.focus()},[Y]);if((n==null?void 0:n.type)!=="aiChat"||!s&&!P)return null;const Ta=(()=>{const f=s==null?void 0:s.notebookBufferId;if(typeof f!="number")return;const C=w.find(we=>we.id===f),L=!C,G=!!(C!=null&&C.archived),ne=(C==null?void 0:C.label)??`#${f}`,Ce=L?"deleted":G?"archived":null;return{label:ne,warn:Ce,onClick:async()=>{Ce||C&&await b(C)}}})();return t.jsx(t.Fragment,{children:t.jsx(In,{mode:"side","data-hook":"ai-chat-window",open:(n==null?void 0:n.type)==="aiChat",onOpenChange:f=>{f||T()},onDismiss:T,trigger:t.jsx("span",{}),title:t.jsxs(I0,{children:[t.jsx(it,{size:20,variant:"filled"}),t.jsx(N0,{"data-hook":"chat-window-title",children:fe})]}),afterTitle:t.jsxs(V0,{children:[t.jsx(Zt,{onClick:Da,title:"New chat","aria-label":"New chat",disabled:U,"data-hook":"chat-window-new",children:t.jsx(Nn,{size:16,weight:"bold"})}),t.jsx(Zt,{$active:P,onClick:at,title:P?"Back to chat":"Chat history","aria-label":P?"Back to chat":"Chat history","aria-pressed":P,disabled:!M||ge(J),"data-hook":"chat-window-history",children:t.jsx(ta,{size:16,weight:"bold"})}),t.jsx(Zt,{onClick:T,title:"Close","aria-label":"Close AI chat","data-hook":"chat-window-close",children:t.jsx(Kt,{size:16,weight:"bold"})})]}),children:t.jsx(Z0,{children:v?t.jsx(Na,{children:t.jsx(wt,{size:20,style:{margin:"auto"}})}):P?t.jsx(_0,{currentConversationId:l.previousConversationId??null}):t.jsxs(Na,{children:[ut?t.jsx(Fr,{messages:O,onAcceptChange:xe,onRejectChange:ae,onRunQuery:Va,onOpenInEditor:St,onApplyToEditor:qa,onRetry:La,onCancelQuery:Za,runningQueryKey:Le,queryNotifications:We,isOperationInProgress:ge(J),editorSQL:Oe.queryText,isStreaming:R,isLoadingMessages:v,scrollToMessageId:x,onScrollToMessageComplete:Sa}):B&&B.trim()?t.jsxs(S0,{children:[t.jsx(q0,{"data-hook":"chat-initial-query-box",children:t.jsx(L0,{"data-hook":"chat-lite-editor",children:t.jsx(Pe,{value:B.trim(),maxHeight:216,onOpenInEditor:()=>St({type:"code",value:B.trim()},!0)})})}),(se||Ke)&&t.jsxs(D0,{ref:qt,children:[se&&t.jsx(Un,{conversationId:s.id,queryText:B.trim()}),Ke&&t.jsx(Yn,{})]})]}):t.jsxs(T0,{"data-hook":"chat-blank-state",children:[t.jsx(F0,{children:"Leverage AI directly in your database"}),t.jsx(R0,{children:"Our AI Assistant is a specialized programming and support agent that makes you more effective and helps you solve problems as you interface with your QuestDB database. Start a conversation."})]}),t.jsx(Xr,{ref:Me,onSend:f=>Q(f,mt),disabled:!m||ge(J),placeholder:ye(),contextSQL:Oe.queryText,contextTableId:s==null?void 0:s.tableId,contextNotebook:Ta,onContextClick:gt})]})})})})};export{z0 as default};