@questdb/web-console 2.0.1 → 2.0.3
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.
- package/dist/THIRD_PARTY_LICENSES.txt +15 -475
- package/dist/assets/index-BaWSEz5L.js +914 -0
- package/dist/assets/index-CCL-Kdjj.css +67 -0
- package/dist/assets/index-UsSozCbz.js +9938 -0
- package/dist/assets/open-sans-v13-latin-300-B_X3Vt75.woff2 +0 -0
- package/dist/assets/open-sans-v13-latin-600-B28gdpJr.woff2 +0 -0
- package/dist/assets/open-sans-v13-latin-700-Cwq0ONIo.woff2 +0 -0
- package/dist/assets/open-sans-v13-latin-regular-JUuAzidG.woff2 +0 -0
- package/dist/assets/{tiktoken-DEbVmu7c.js → tiktoken-Di-zekKS.js} +1 -1
- package/dist/assets/{vendor-BhHVTKlu.js → vendor-BpMkWAQ4.js} +1 -1
- package/dist/index.html +48 -17
- package/package.json +4 -17
- package/dist/assets/index-1ZLwKI91.js +0 -1047
- package/dist/assets/index-BqRJij9Z.css +0 -45
- package/dist/assets/index-zPfXTse8.js +0 -9788
- package/dist/assets/upload.svg +0 -18
|
@@ -0,0 +1,914 @@
|
|
|
1
|
+
import{p as Me,Q as yt,s as _e,u as Re,a as Ta,j as e,c as Lt,A as st,K as Tt,b as r,B as oe,t as He,C as ke,e as Ze,d as Rt,f as q,g as Ra,h as xt,i as wt,k as Dt,l as Da,m as Fa,n as Ft,o as za,q as Ce,r as Ct,v as zt,w as $a,x as Ba,y as $t,z as Bt,D as Pa,E as Pt,S as Oa,L as Ke,F as Qa,T as le,G as Ot,H as bt,I as Wa,J as Ka,M as be,N as vt,O as Ua,P as Ga,R as At,U as De,V as Xa,W as Qt,X as Ya,Y as Ja,Z as en,_ as tn,$ as an,a0 as nn,a1 as sn,a2 as rt,a3 as rn,a4 as on,a5 as ln,a6 as Wt,a7 as dn,a8 as cn,a9 as hn,aa as mn,ab as ue,ac as un,ad as pn,ae as gn,af as fn,ag as yn,ah as Kt,ai as Fe,aj as xn,ak as wn,al as Cn,am as Ue,an as Ge,ao as Xe,ap as Ye,aq as Je,ar as bn,as as vn,at as An,au as jn,av as Mn,aw as _n,ax as Hn,ay as kn,az as ot,aA as Ut,aB as En,aC as In,aD as Nn,aE as Sn,aF as Vn}from"./index-UsSozCbz.js";import{b as t,B as Ee,H as i,Z as jt,R as lt,C as de,U as Zn,A as Gt}from"./vendor-BpMkWAQ4.js";const qn=new Map([["bold",t.createElement(t.Fragment,null,t.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",t.createElement(t.Fragment,null,t.createElement("path",{d:"M200,112H56l72-72Z",opacity:"0.2"}),t.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",t.createElement(t.Fragment,null,t.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",t.createElement(t.Fragment,null,t.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",t.createElement(t.Fragment,null,t.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",t.createElement(t.Fragment,null,t.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",t.createElement(t.Fragment,null,t.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",t.createElement(t.Fragment,null,t.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"}),t.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",t.createElement(t.Fragment,null,t.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",t.createElement(t.Fragment,null,t.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",t.createElement(t.Fragment,null,t.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",t.createElement(t.Fragment,null,t.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"}))]]),Tn=new Map([["bold",t.createElement(t.Fragment,null,t.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",t.createElement(t.Fragment,null,t.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"}),t.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",t.createElement(t.Fragment,null,t.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",t.createElement(t.Fragment,null,t.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",t.createElement(t.Fragment,null,t.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",t.createElement(t.Fragment,null,t.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"}))]]),Rn=new Map([["bold",t.createElement(t.Fragment,null,t.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",t.createElement(t.Fragment,null,t.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),t.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",t.createElement(t.Fragment,null,t.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",t.createElement(t.Fragment,null,t.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",t.createElement(t.Fragment,null,t.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",t.createElement(t.Fragment,null,t.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"}))]]),Dn=new Map([["bold",t.createElement(t.Fragment,null,t.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",t.createElement(t.Fragment,null,t.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"}),t.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",t.createElement(t.Fragment,null,t.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",t.createElement(t.Fragment,null,t.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",t.createElement(t.Fragment,null,t.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",t.createElement(t.Fragment,null,t.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"}))]]),Fn=new Map([["bold",t.createElement(t.Fragment,null,t.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",t.createElement(t.Fragment,null,t.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"}),t.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",t.createElement(t.Fragment,null,t.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",t.createElement(t.Fragment,null,t.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",t.createElement(t.Fragment,null,t.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",t.createElement(t.Fragment,null,t.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"}))]]),zn=new Map([["bold",t.createElement(t.Fragment,null,t.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",t.createElement(t.Fragment,null,t.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"}),t.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",t.createElement(t.Fragment,null,t.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",t.createElement(t.Fragment,null,t.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",t.createElement(t.Fragment,null,t.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",t.createElement(t.Fragment,null,t.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"}))]]),$n=new Map([["bold",t.createElement(t.Fragment,null,t.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",t.createElement(t.Fragment,null,t.createElement("path",{d:"M200,56V208a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V56Z",opacity:"0.2"}),t.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",t.createElement(t.Fragment,null,t.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",t.createElement(t.Fragment,null,t.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",t.createElement(t.Fragment,null,t.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",t.createElement(t.Fragment,null,t.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"}))]]),Xt=t.forwardRef((a,n)=>t.createElement(Me,{ref:n,...a,weights:qn}));Xt.displayName="ArrowUpIcon";const Yt=t.forwardRef((a,n)=>t.createElement(Me,{ref:n,...a,weights:Ln}));Yt.displayName="ChatDotsIcon";const Jt=t.forwardRef((a,n)=>t.createElement(Me,{ref:n,...a,weights:Tn}));Jt.displayName="ChatTextIcon";const ea=t.forwardRef((a,n)=>t.createElement(Me,{ref:n,...a,weights:Rn}));ea.displayName="ClockCountdownIcon";const ta=t.forwardRef((a,n)=>t.createElement(Me,{ref:n,...a,weights:Dn}));ta.displayName="CodeBlockIcon";const aa=t.forwardRef((a,n)=>t.createElement(Me,{ref:n,...a,weights:Fn}));aa.displayName="GaugeIcon";const na=t.forwardRef((a,n)=>t.createElement(Me,{ref:n,...a,weights:zn}));na.displayName="KeyReturnIcon";const ia=t.forwardRef((a,n)=>t.createElement(Me,{ref:n,...a,weights:$n}));ia.displayName="TrashSimpleIcon";const Bn=i(q).attrs({alignItems:"center",gap:"0"}).withConfig({displayName:"ExplainQueryButton__KeyBinding"})([`
|
|
2
|
+
color: `,`;
|
|
3
|
+
`],({theme:a})=>a.color.contentAccentStrong),Pn=`${Lt}+E`,On=i(oe).withConfig({displayName:"ExplainQueryButton__ExplainButton"})([`
|
|
4
|
+
gap: 1rem;
|
|
5
|
+
`]),Qn=({conversationId:a,queryText:n})=>{const{quest:o}=t.useContext(yt),c=Ee(_e.query.getTables),{setStatus:u,abortController:p,hasSchemaAccess:y,currentModel:k,apiKey:v,aiAssistantSettings:H}=Re(),{addMessage:C,updateMessage:j,updateConversationName:b,persistMessages:g,setIsStreaming:N}=Ta(),l=()=>{He(ke.AI_EXPLAIN_QUERY),Ze(Rt({conversationId:a,queryText:n,settings:{model:k,apiKey:v},aiAssistantSettings:H,questClient:o,tables:c,hasSchemaAccess:y,abortSignal:p==null?void 0:p.signal}),{addMessage:C,updateMessage:j,setStatus:u,setIsStreaming:N,persistMessages:g,updateConversationName:b})};return e.jsxs(On,{variant:"gradient",gradientWeight:"thin",onClick:l,title:`Explain query with AI Assistant (${Pn})`,"data-hook":"button-explain-query",children:[e.jsx(st,{size:12,variant:"hollow"}),"Explain query",e.jsxs(Bn,{children:[e.jsx(Tt,{keyString:Lt,color:r("contentAccentStrong")}),e.jsx(Tt,{keyString:"E",color:r("contentAccentStrong")})]})]})},sa=(a,n,o,c)=>{if(!(o!=null&&o.current)||!c.current)return null;const u=c.current.getModel();if(!u)return null;const p=o.current[n.toString()];if(!p)return null;const y=p[a];if(!y||!y.error)return null;const k=y.selection?y.selection.startOffset:y.startOffset,v=y.selection?y.selection.endOffset:y.endOffset,H=u.getPositionAt(k),C=u.getPositionAt(k+y.error.position),j=u.getWordAtPosition(C),b=u.getPositionAt(v),g=y.selection?u.getValueInRange({startLineNumber:H.lineNumber,startColumn:H.column,endLineNumber:b.lineNumber,endColumn:b.column}):Ra(a).queryText;return{errorMessage:y.error.error||"Query execution failed",word:j?j.word:null,fixStart:k,fixEnd:v,queryText:g}},Wn=i(oe).withConfig({displayName:"FixQueryButton__FixButton"})([`
|
|
6
|
+
gap: 1rem;
|
|
7
|
+
`]),Kn=()=>{const{quest:a}=t.useContext(yt),{editorRef:n,executionRefs:o}=xt(),c=Ee(_e.query.getTables),{setStatus:u,abortController:p,hasSchemaAccess:y,currentModel:k,apiKey:v,aiAssistantSettings:H}=Re(),{chatWindowState:C,getConversationMeta:j,addMessage:b,updateMessage:g,updateConversationName:N,persistMessages:l,setIsStreaming:A}=wt(),F=()=>{const d=C.activeConversationId;if(!d)return;const x=j(d);if(!(x!=null&&x.queryKey)||x.bufferId==null)return;const h=sa(x.queryKey,x.bufferId,o,n);if(!h)return;He(ke.AI_FIX_QUERY);const{errorMessage:R,queryText:G,word:D}=h;Ze(Dt({conversationId:d,queryText:G,errorMessage:R,errorWord:D??void 0,settings:{model:k,apiKey:v},aiAssistantSettings:H,questClient:a,tables:c,hasSchemaAccess:y,abortSignal:p==null?void 0:p.signal}),{addMessage:b,updateMessage:g,setStatus:u,setIsStreaming:A,persistMessages:l,updateConversationName:N})};return e.jsxs(Wn,{variant:"gradient",gradientWeight:"thin",onClick:F,title:"Fix query with AI Assistant","data-hook":"button-fix-query",children:[e.jsx(st,{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
|
+
`},ra=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
|
+
`]),oa=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?de([`
|
|
27
|
+
flex-direction: column;
|
|
28
|
+
align-items: flex-start;
|
|
29
|
+
`]):de([`
|
|
30
|
+
align-items: center;
|
|
31
|
+
justify-content: space-between;
|
|
32
|
+
padding: 0.4rem;
|
|
33
|
+
`]),({$abort:a})=>a&&de([`
|
|
34
|
+
opacity: 0.7;
|
|
35
|
+
`])),_t=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("contentSecondary"),({$expanded:a})=>a?"90deg":"0deg"),Ht=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("contentSecondary"),({$isActive:a})=>a&&Pt,({$isTopLevel:a})=>a&&de([`
|
|
60
|
+
color: `,`;
|
|
61
|
+
`],r("contentPrimary"))),la=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&&de([`
|
|
70
|
+
padding: 0.4rem;
|
|
71
|
+
`]),({$expanded:a})=>!a&&de([`
|
|
72
|
+
min-height: 0;
|
|
73
|
+
min-width: 0;
|
|
74
|
+
`]),({$isExpandable:a})=>a&&de([`
|
|
75
|
+
cursor: pointer;
|
|
76
|
+
user-select: none;
|
|
77
|
+
border-radius: 0.4rem;
|
|
78
|
+
transition: background-color 120ms ease;
|
|
79
|
+
|
|
80
|
+
&:hover {
|
|
81
|
+
background: `,`;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
&:focus-visible {
|
|
85
|
+
outline: 1px solid `,`;
|
|
86
|
+
outline-offset: 2px;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
&:hover `,", &:hover ",` {
|
|
90
|
+
color: `,`;
|
|
91
|
+
}
|
|
92
|
+
`],r("surfaceRaised"),r("contentAccent"),Ht,_t,r("contentPrimary"))),kt=i.div.withConfig({displayName:"AssistantModesCompact__ExpandableWrapper"})([`
|
|
93
|
+
display: grid;
|
|
94
|
+
grid-template-rows: `,`;
|
|
95
|
+
transition:
|
|
96
|
+
grid-template-rows 0.1s ease-out,
|
|
97
|
+
opacity 0.3s ease-out;
|
|
98
|
+
width: 100%;
|
|
99
|
+
|
|
100
|
+
`,`
|
|
101
|
+
`],({$expanded:a})=>a?"1fr":"0fr",({$expanded:a})=>!a&&de([`
|
|
102
|
+
height: 0;
|
|
103
|
+
opacity: 0;
|
|
104
|
+
`])),Et=i.div.withConfig({displayName:"AssistantModesCompact__ExpandableContent"})([`
|
|
105
|
+
min-height: 0;
|
|
106
|
+
overflow: hidden;
|
|
107
|
+
`]),Un=i.div.withConfig({displayName:"AssistantModesCompact__ReasoningThread"})([`
|
|
108
|
+
display: flex;
|
|
109
|
+
flex-direction: column;
|
|
110
|
+
gap: 0.8rem;
|
|
111
|
+
align-items: flex-start;
|
|
112
|
+
padding: 0 2.8rem;
|
|
113
|
+
`]),dt=i.div.withConfig({displayName:"AssistantModesCompact__ReasoningItem"})([`
|
|
114
|
+
display: flex;
|
|
115
|
+
gap: 0.5rem;
|
|
116
|
+
align-items: center;
|
|
117
|
+
padding: 0.4rem;
|
|
118
|
+
padding-left: 0;
|
|
119
|
+
`]),et=i.div.withConfig({displayName:"AssistantModesCompact__ReasoningIcon"})([`
|
|
120
|
+
width: 1.4rem;
|
|
121
|
+
height: 1.4rem;
|
|
122
|
+
flex-shrink: 0;
|
|
123
|
+
display: flex;
|
|
124
|
+
align-items: center;
|
|
125
|
+
justify-content: center;
|
|
126
|
+
color: `,`;
|
|
127
|
+
`],r("contentPrimary")),ct=i.div.withConfig({displayName:"AssistantModesCompact__ReasoningText"})([`
|
|
128
|
+
display: flex;
|
|
129
|
+
flex-wrap: wrap;
|
|
130
|
+
gap: 0.4rem;
|
|
131
|
+
align-items: center;
|
|
132
|
+
min-height: 0;
|
|
133
|
+
min-width: 0;
|
|
134
|
+
`]),ie=i.span.withConfig({displayName:"AssistantModesCompact__ReasoningTextPart"})([`
|
|
135
|
+
font-weight: 400;
|
|
136
|
+
font-size: 1.4rem;
|
|
137
|
+
color: `,`;
|
|
138
|
+
`],r("contentSecondary")),qe=i.div.withConfig({displayName:"AssistantModesCompact__CodeBadge"})([`
|
|
139
|
+
background: `,`;
|
|
140
|
+
border: 1px solid `,`;
|
|
141
|
+
border-radius: 0.4rem;
|
|
142
|
+
padding: 0 0.4rem;
|
|
143
|
+
display: flex;
|
|
144
|
+
align-items: center;
|
|
145
|
+
justify-content: center;
|
|
146
|
+
transform: translateY(1px);
|
|
147
|
+
`],r("surfaceRaised"),r("interactionNeutral")),Le=i.span.withConfig({displayName:"AssistantModesCompact__CodeBadgeText"})([`
|
|
148
|
+
font-family: `,`;
|
|
149
|
+
font-size: 1.2rem;
|
|
150
|
+
color: `,`;
|
|
151
|
+
`],({theme:a})=>a.fontMonospace,r("statusFeature")),da=i(Pa).withConfig({displayName:"AssistantModesCompact__CheckIcon"})([`
|
|
152
|
+
width: 1.6rem;
|
|
153
|
+
height: 1.6rem;
|
|
154
|
+
color: `,`;
|
|
155
|
+
flex-shrink: 0;
|
|
156
|
+
`],r("statusAssistant")),Gn=i(Bt).withConfig({displayName:"AssistantModesCompact__CloseCircleIcon"})([`
|
|
157
|
+
color: `,`;
|
|
158
|
+
flex-shrink: 0;
|
|
159
|
+
`],r("statusDanger")),Xn=i.div.withConfig({displayName:"AssistantModesCompact__CollapsedSectionsWrapper"})([`
|
|
160
|
+
display: flex;
|
|
161
|
+
flex-direction: column;
|
|
162
|
+
gap: 0.8rem;
|
|
163
|
+
padding-left: 2.8rem;
|
|
164
|
+
`]),Yn=i.span.withConfig({displayName:"AssistantModesCompact__DurationText"})([`
|
|
165
|
+
font-size: 1.2rem;
|
|
166
|
+
color: `,`;
|
|
167
|
+
font-family: `,`;
|
|
168
|
+
font-weight: 400;
|
|
169
|
+
flex-shrink: 0;
|
|
170
|
+
transform: translateY(1px);
|
|
171
|
+
`],r("contentMuted"),({theme:a})=>a.fontMonospace),Jn=(a,n)=>{if(a===Ce.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},ei=i.div.withConfig({displayName:"AssistantModesCompact__ThinkingContent"})([`
|
|
172
|
+
font-size: 1.3rem;
|
|
173
|
+
color: `,`;
|
|
174
|
+
padding: 0 2.8rem;
|
|
175
|
+
white-space: pre-wrap;
|
|
176
|
+
word-break: break-word;
|
|
177
|
+
opacity: 0.7;
|
|
178
|
+
`],r("contentSecondary")),ca=({operationHistory:a,status:n,isLive:o=!1,onScrollNeeded:c,collapsed:u=!1,endTimestamp:p})=>{const y=jt(),[k,v]=t.useState({}),[H,C]=t.useState(!1),j=t.useRef(0),b=t.useRef(null),g=t.useMemo(()=>Da(a,n,o),[a,n,o]),N=t.useRef(o);t.useEffect(()=>{if(N.current&&!o){const d={};g.forEach(x=>{d[x.id]=!0}),v(d)}else if(o&&g.length>j.current){const d={};g.forEach((x,h)=>{h<g.length-1&&(d[x.id]=!0)}),v(d),c==null||c()}j.current=g.length,N.current=o},[g,o,c]);const l=d=>{v(x=>{const h=g.find(I=>I.id===d),R=h?Ft(h):!1,G=g.findIndex(I=>I.id===d)===g.length-1,D=u?!1:o?G:!0;return x[d]===void 0?{...x,[d]:D&&R}:{...x,[d]:!x[d]}})},A=t.useMemo(()=>{var h,R;if(a.length===0)return null;const d=(h=a[0])==null?void 0:h.timestamp,x=p??((R=a[a.length-1])==null?void 0:R.timestamp);return!d||!x||d===x?null:Fa(x-d)},[a,p]);if(a.length===0)return null;const F=g.map((d,x)=>{var L;const h=Ft(d),R=x===g.length-1,G=u?!1:o?R:!0,D=k[d.id]===void 0?G&&h:!k[d.id]&&h,I=g[x+1],S=za(d,I,I?void 0:p),z=d.type===Ce.Thinking||d.type===Ce.RunningQuery,V=z?((L=d.operations[0])==null?void 0:L.content)??"":"";return e.jsxs(oa,{$expanded:D,$abort:d.abort,children:[e.jsxs(la,{$expanded:D,$isExpandable:h,"data-hook":`assistant-mode-${d.type.toLowerCase().replace(/\s+/g,"-")}`,role:h?"button":"presentation",tabIndex:h?0:void 0,"aria-expanded":h?D:void 0,onClick:h?()=>l(d.id):void 0,onKeyDown:h?_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),l(d.id))}:void 0,children:[e.jsx(et,{children:d.active?e.jsx(Ct,{size:14}):d.abort?e.jsx(Gn,{size:14}):e.jsx(da,{})}),e.jsxs(q,{gap:"0.3rem",children:[e.jsx(Ht,{$isActive:d.active,children:d.type}),S&&e.jsxs(Yn,{children:["(",S,")"]}),h&&e.jsx(_t,{$expanded:D,children:e.jsx(zt,{size:14})})]})]}),h&&z&&e.jsx(kt,{$expanded:D,children:e.jsx(Et,{children:V?e.jsx(ei,{children:V}):null})}),h&&!z&&e.jsx(kt,{$expanded:D,children:e.jsx(Et,{children:e.jsx(Un,{children:d.operations.map((_,Ie)=>{const ee=`${d.id}-${Ie}-${JSON.stringify(_.args)}`;if(_.type===Ce.Processing){const W=Jn(_.type,_.args);return e.jsxs(dt,{children:[e.jsx(et,{children:e.jsx($a,{style:{width:"14px",height:"14px"}})}),e.jsx(ct,{children:e.jsx(ie,{children:W})})]},ee)}if(_.type===Ce.InvestigatingTable){const W=_.args&&"name"in _.args?_.args.name:"table",X=_.args&&"tableOpType"in _.args?_.args.tableOpType:"details";return e.jsxs(dt,{children:[e.jsx(et,{children:e.jsx(Ba,{size:14,color:y.color.contentSecondary})}),e.jsxs(ct,{children:[e.jsx(ie,{children:"Investigating"}),e.jsx(qe,{children:e.jsx(Le,{children:W})}),e.jsx(ie,{children:X})]})]},ee)}if(_.type===Ce.InvestigatingDocs){const W=_.args&&"items"in _.args&&Array.isArray(_.args.items)?_.args.items:null;if(W&&W.length>0)return e.jsx(lt.Fragment,{children:W.map((pe,Ae)=>{const Y=`${ee}-item-${Ae}`;return e.jsxs(dt,{children:[e.jsx(et,{children:e.jsx($t,{size:14,color:y.color.contentSecondary})}),e.jsx(ct,{children:pe.section?e.jsxs(e.Fragment,{children:[e.jsx(ie,{children:"Investigating"}),e.jsx(qe,{children:e.jsx(Le,{children:pe.section})}),e.jsx(ie,{children:"in"}),e.jsx(qe,{children:e.jsx(Le,{children:pe.name})})]}):e.jsxs(e.Fragment,{children:[e.jsx(ie,{children:"Investigating"}),e.jsx(qe,{children:e.jsx(Le,{children:pe.name})})]})})]},Y)})},ee);const X=_.args&&"name"in _.args?_.args.name:null,ve=_.args&&"section"in _.args?_.args.section:null;return e.jsxs(dt,{children:[e.jsx(et,{children:e.jsx($t,{size:14})}),e.jsx(ct,{children:X&&ve?e.jsxs(e.Fragment,{children:[e.jsx(ie,{children:"Investigating"}),e.jsx(qe,{children:e.jsx(Le,{children:ve})}),e.jsx(ie,{children:"in"}),e.jsx(qe,{children:e.jsx(Le,{children:X})}),e.jsx(ie,{children:"documentation"})]}):X?e.jsxs(e.Fragment,{children:[e.jsx(ie,{children:"Investigating"}),e.jsx(qe,{children:e.jsx(Le,{children:X})}),e.jsx(ie,{children:"documentation"})]}):e.jsx(ie,{children:"Investigating documentation"})})]},ee)}return null})})})})]},d.id)});return u?e.jsx(ra,{ref:b,"data-hook":"assistant-modes-container",children:e.jsxs(oa,{$expanded:H,$abort:!1,children:[e.jsxs(la,{$expanded:H,$isExpandable:!0,onClick:()=>C(d=>!d),onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),C(x=>!x))},"data-hook":"assistant-mode-processing-collapsed",role:"button",tabIndex:0,"aria-expanded":H,children:[e.jsx(da,{}),e.jsx(Ht,{$isActive:!1,children:A?`Thought for ${A}`:"Thought"}),e.jsx(_t,{$expanded:H,children:e.jsx(zt,{size:14})})]}),e.jsx(kt,{$expanded:H,children:e.jsx(Et,{children:e.jsx(Xn,{children:F})})})]})}):e.jsx(ra,{ref:b,"data-hook":"assistant-modes-container",children:F})},ti=i.div.withConfig({displayName:"AssistantMarkdown__CodeBlockWrapper"})([`
|
|
179
|
+
margin: 1rem 0;
|
|
180
|
+
width: 100%;
|
|
181
|
+
`]),ai=i.div.withConfig({displayName:"AssistantMarkdown__MarkdownContent"})([`
|
|
182
|
+
margin: 0;
|
|
183
|
+
width: 100%;
|
|
184
|
+
font-family: `,`;
|
|
185
|
+
font-size: 1.4rem;
|
|
186
|
+
line-height: 2.1rem;
|
|
187
|
+
color: `,`;
|
|
188
|
+
word-break: break-word;
|
|
189
|
+
|
|
190
|
+
p {
|
|
191
|
+
margin: 0 0 1rem 0;
|
|
192
|
+
&:last-child {
|
|
193
|
+
margin-bottom: 0;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
code {
|
|
198
|
+
background: `,`;
|
|
199
|
+
border: 1px solid `,`;
|
|
200
|
+
border-radius: 0.4rem;
|
|
201
|
+
padding: 0.1rem 0.4rem;
|
|
202
|
+
font-family: `,`;
|
|
203
|
+
font-size: 1.3rem;
|
|
204
|
+
color: `,`;
|
|
205
|
+
white-space: pre-wrap;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
strong {
|
|
209
|
+
font-weight: 600;
|
|
210
|
+
color: `,`;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
em {
|
|
214
|
+
font-style: italic;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
ul,
|
|
218
|
+
ol {
|
|
219
|
+
margin: 0.5rem 0;
|
|
220
|
+
padding-left: 2rem;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
li {
|
|
224
|
+
margin-bottom: 0.3rem;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
a {
|
|
228
|
+
color: `,`;
|
|
229
|
+
text-decoration: none;
|
|
230
|
+
&:hover {
|
|
231
|
+
text-decoration: underline;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
h1,
|
|
236
|
+
h2,
|
|
237
|
+
h3,
|
|
238
|
+
h4 {
|
|
239
|
+
margin: 1rem 0 0.5rem 0;
|
|
240
|
+
font-weight: 600;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
h1 {
|
|
244
|
+
font-size: 1.8rem;
|
|
245
|
+
}
|
|
246
|
+
h2 {
|
|
247
|
+
font-size: 1.6rem;
|
|
248
|
+
}
|
|
249
|
+
h3 {
|
|
250
|
+
font-size: 1.5rem;
|
|
251
|
+
}
|
|
252
|
+
h4 {
|
|
253
|
+
font-size: 1.4rem;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
blockquote {
|
|
257
|
+
border-left: 3px solid `,`;
|
|
258
|
+
margin: 1rem 0;
|
|
259
|
+
padding-left: 1rem;
|
|
260
|
+
color: `,`;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.table-wrapper {
|
|
264
|
+
overflow-x: auto;
|
|
265
|
+
margin: 1rem 0;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
table {
|
|
269
|
+
border-collapse: collapse;
|
|
270
|
+
min-width: max-content;
|
|
271
|
+
border-radius: 0.8rem;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
th,
|
|
275
|
+
td {
|
|
276
|
+
padding: 0.6rem 0.8rem;
|
|
277
|
+
border: 1px solid `,`;
|
|
278
|
+
text-align: left;
|
|
279
|
+
white-space: nowrap;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
th {
|
|
283
|
+
background: `,`;
|
|
284
|
+
font-weight: 600;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
td:last-child {
|
|
288
|
+
white-space: normal;
|
|
289
|
+
min-width: 200px;
|
|
290
|
+
}
|
|
291
|
+
`],({theme:a})=>a.font,r("contentPrimary"),r("surfaceInset"),r("interactionNeutral"),({theme:a})=>a.fontMonospace,r("statusFeature"),r("contentPrimary"),({theme:a})=>a.color.statusInfo,r("interactionNeutral"),r("contentSecondary"),r("interactionNeutral"),r("surfaceInset")),ni=a=>({table:({children:n,...o})=>e.jsx("div",{className:"table-wrapper",children:e.jsx("table",{...o,children:n})}),pre:({children:n})=>e.jsx(e.Fragment,{children:n}),code:t.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 e.jsx(ti,{"data-hook":"chat-message-code-block",children:e.jsx(Ke,{value:c,maxHeight:216,onOpenInEditor:()=>{var u;(u=a.current)==null||u.call(a,{type:"code",value:c})}})})}return e.jsx("code",{children:n})},(n,o)=>n.children===o.children&&n.className===o.className)}),ha=t.memo(({content:a,messageId:n,onOpenInEditor:o})=>{const c=t.useRef(o);t.useEffect(()=>{c.current=o},[o]);const u=t.useMemo(()=>ni(c),[]);return e.jsx(ai,{children:e.jsx(Oa,{allowImages:!0,components:u,children:a})},n)},(a,n)=>a.content===n.content);function ma(a){return a>=1e3?`${(a/1e3).toFixed(1)}K`:a.toString()}const ua=i.div.withConfig({displayName:"AssistantMessageContent__Divider"})([`
|
|
292
|
+
width: 100%;
|
|
293
|
+
height: 1px;
|
|
294
|
+
background: linear-gradient(
|
|
295
|
+
90deg,
|
|
296
|
+
`,` 0%,
|
|
297
|
+
`,` 100%
|
|
298
|
+
);
|
|
299
|
+
margin-bottom: 1rem;
|
|
300
|
+
`],r("borderAccent"),({theme:a})=>a.color.transparent),pa=i.div.withConfig({displayName:"AssistantMessageContent__OperationHistoryContainer"})([`
|
|
301
|
+
width: 100%;
|
|
302
|
+
`]),ii=i(q).attrs({alignItems:"center",gap:"1rem"}).withConfig({displayName:"AssistantMessageContent__AssistantHeader"})([`
|
|
303
|
+
width: 100%;
|
|
304
|
+
padding: 1.2rem 0.4rem;
|
|
305
|
+
flex: 1 0 auto;
|
|
306
|
+
`]),si=i(le).attrs({className:"assistant-label"}).withConfig({displayName:"AssistantMessageContent__AssistantLabel"})([`
|
|
307
|
+
font-size: 1.4rem;
|
|
308
|
+
color: `,`;
|
|
309
|
+
`],r("contentPrimary")),ri=i(q).attrs({className:"token-display"}).withConfig({displayName:"AssistantMessageContent__TokenDisplay"})([`
|
|
310
|
+
align-items: center;
|
|
311
|
+
gap: 0.9rem;
|
|
312
|
+
margin: 0 0 0 auto;
|
|
313
|
+
`]),ga=i(q).withConfig({displayName:"AssistantMessageContent__ExplanationContent"})([`
|
|
314
|
+
display: flex;
|
|
315
|
+
flex-direction: column;
|
|
316
|
+
border-radius: 0.6rem;
|
|
317
|
+
padding: 0 0.8rem;
|
|
318
|
+
flex-shrink: 0;
|
|
319
|
+
width: 100%;
|
|
320
|
+
`]),oi=Zn([`
|
|
321
|
+
0%, 50% { opacity: 1; }
|
|
322
|
+
51%, 100% { opacity: 0; }
|
|
323
|
+
`]),fa=i.span.withConfig({displayName:"AssistantMessageContent__StreamingCursor"})([`
|
|
324
|
+
display: inline-block;
|
|
325
|
+
width: 2px;
|
|
326
|
+
height: 1.4em;
|
|
327
|
+
background: `,`;
|
|
328
|
+
margin-left: 2px;
|
|
329
|
+
margin-right: auto;
|
|
330
|
+
vertical-align: text-bottom;
|
|
331
|
+
animation: `,` 1s infinite;
|
|
332
|
+
`],r("contentPrimary"),oi),li=t.memo(({turnMessages:a,anchorMessage:n,status:o,isLiveOperation:c,isMessageStreaming:u,onScrollNeeded:p,onOpenInEditor:y})=>{const k=jt(),{operationHistory:v,endTimestamp:H,timeline:C}=t.useMemo(()=>{const l=n.operationHistory??[],A=l.filter(x=>x.type!==Ce.Aborted),F=l.length>0?Math.max(...l.map(x=>x.timestamp)):void 0,d=A.some(x=>{var h;return x.type===Ce.GeneratingResponse&&!!((h=x.content)!=null&&h.trim())});return{operationHistory:A.filter(x=>x.type!==Ce.GeneratingResponse),endTimestamp:F,timeline:d?Qa(A):null}},[n.operationHistory]),j=t.useMemo(()=>a.filter(l=>l.role==="assistant"&&typeof l.content=="string"&&!!l.content).map(l=>l.content).join(`
|
|
333
|
+
|
|
334
|
+
`),[a]),b=!!j,g=t.useMemo(()=>{const l=n.tokenUsage;return!l||typeof l.inputTokens!="number"||typeof l.outputTokens!="number"?null:e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{fontWeight:600},children:ma(l.inputTokens)})," ","input /"," ",e.jsx("span",{style:{fontWeight:600},children:ma(l.outputTokens)})," ","output tokens"]})},[n.tokenUsage]),N=e.jsxs(ii,{"data-hook":"assistant-header",children:[e.jsx(st,{size:20,variant:"filled"}),e.jsx(si,{children:n.model||"Assistant"}),g&&e.jsxs(ri,{className:"token-display",children:[e.jsx(aa,{size:"16px",color:k.color.contentSecondary}),e.jsx(le,{size:"sm",color:"contentSecondary",children:g})]})]});if(C&&C.length>0){let l=!1;return e.jsxs(e.Fragment,{children:[C.map((A,F)=>{const d=F===C.length-1;if(A.type==="operations")return e.jsxs(lt.Fragment,{children:[F===0&&e.jsx(ua,{}),e.jsx(pa,{children:e.jsx(ca,{operationHistory:A.operations,status:o,isLive:c&&d,onScrollNeeded:p,collapsed:!d,endTimestamp:A.endTimestamp})})]},`ops-${A.timestamp}`);const x=!l;return l=!0,e.jsxs(lt.Fragment,{children:[x&&N,e.jsx(ga,{children:e.jsx(ha,{content:A.content,messageId:n.id,onOpenInEditor:y})})]},`content-${A.timestamp}`)}),u&&e.jsx(fa,{"data-hook":"streaming-cursor"})]})}return e.jsxs(e.Fragment,{children:[v.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(ua,{}),e.jsx(pa,{children:e.jsx(ca,{operationHistory:v,status:o,isLive:c,onScrollNeeded:p,collapsed:b||!!n.error,endTimestamp:H})})]}),b&&e.jsxs(e.Fragment,{children:[N,e.jsxs(ga,{children:[e.jsx(ha,{content:j,messageId:n.id,onOpenInEditor:y}),u&&e.jsx(fa,{"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}),di=i(q).withConfig({displayName:"ChatMessages__MessagesContainer"})([`
|
|
335
|
+
display: flex;
|
|
336
|
+
flex-direction: column;
|
|
337
|
+
gap: 1.5rem;
|
|
338
|
+
padding: 2rem 1rem;
|
|
339
|
+
overflow-y: auto;
|
|
340
|
+
flex: 1 1 auto;
|
|
341
|
+
min-height: 0;
|
|
342
|
+
width: 100%;
|
|
343
|
+
`,`
|
|
344
|
+
`],({$scrolled:a})=>!a&&de([`
|
|
345
|
+
opacity: 0;
|
|
346
|
+
`])),ci=i(q).attrs({align:"flex-start"}).withConfig({displayName:"ChatMessages__MessageBubble"})([`
|
|
347
|
+
display: flex;
|
|
348
|
+
flex-direction: column;
|
|
349
|
+
gap: 0.5rem;
|
|
350
|
+
padding: 0.8rem;
|
|
351
|
+
border-radius: 0.8rem;
|
|
352
|
+
width: 100%;
|
|
353
|
+
align-self: flex-end;
|
|
354
|
+
background: `,`;
|
|
355
|
+
border: 1px solid `,`;
|
|
356
|
+
flex-shrink: 0;
|
|
357
|
+
`],r("authBackdrop"),r("borderDefault")),ya=i(q).withConfig({displayName:"ChatMessages__UserRequestBox"})([`
|
|
358
|
+
display: flex;
|
|
359
|
+
flex-direction: column;
|
|
360
|
+
gap: 0.5rem;
|
|
361
|
+
padding: 0.8rem;
|
|
362
|
+
width: 100%;
|
|
363
|
+
align-self: flex-end;
|
|
364
|
+
background: `,`;
|
|
365
|
+
border: 1px solid `,`;
|
|
366
|
+
border-radius: 0.6rem;
|
|
367
|
+
flex-shrink: 0;
|
|
368
|
+
`],r("authBackdrop"),r("borderDefault")),hi=i(q).attrs({alignItems:"center",gap:"0.8rem"}).withConfig({displayName:"ChatMessages__UserRequestHeader"})([`
|
|
369
|
+
width: 100%;
|
|
370
|
+
padding: 0.4rem;
|
|
371
|
+
flex: 1 0 auto;
|
|
372
|
+
`]),ht=i(q).withConfig({displayName:"ChatMessages__UserRequestContent"})([`
|
|
373
|
+
display: flex;
|
|
374
|
+
flex-direction: column;
|
|
375
|
+
border-radius: 0.6rem;
|
|
376
|
+
overflow: hidden;
|
|
377
|
+
flex-shrink: 0;
|
|
378
|
+
width: 100%;
|
|
379
|
+
align-items: flex-start;
|
|
380
|
+
`]),xa=i.div.withConfig({displayName:"ChatMessages__InlineSQLEditor"})([`
|
|
381
|
+
width: 100%;
|
|
382
|
+
`]),mi=i(q).attrs({gap:"1rem",alignItems:"center"}).withConfig({displayName:"ChatMessages__OperationBadge"})([`
|
|
383
|
+
width: 100%;
|
|
384
|
+
padding: 0 0.4rem;
|
|
385
|
+
`]),ui=i(q).attrs({align:"center",justifyContent:"center"}).withConfig({displayName:"ChatMessages__BadgeIconContainer"})([`
|
|
386
|
+
background: `,`;
|
|
387
|
+
border: 1px solid `,`;
|
|
388
|
+
border-radius: 0.4rem;
|
|
389
|
+
padding: 0.8rem;
|
|
390
|
+
width: 4.8rem;
|
|
391
|
+
height: 4rem;
|
|
392
|
+
flex-shrink: 0;
|
|
393
|
+
`],r("interactionAccentActive"),r("borderAccent")),pi=i.div.withConfig({displayName:"ChatMessages__BadgeIconWrapper"})([`
|
|
394
|
+
width: 2.4rem;
|
|
395
|
+
height: 2.4rem;
|
|
396
|
+
display: flex;
|
|
397
|
+
align-items: center;
|
|
398
|
+
justify-content: center;
|
|
399
|
+
color: `,`;
|
|
400
|
+
|
|
401
|
+
svg {
|
|
402
|
+
width: 100%;
|
|
403
|
+
height: 100%;
|
|
404
|
+
}
|
|
405
|
+
`],({theme:a})=>a.color.contentAccent),gi=i(le).withConfig({displayName:"ChatMessages__BadgeTitle"})([`
|
|
406
|
+
font-weight: 500;
|
|
407
|
+
font-size: 1.6rem;
|
|
408
|
+
line-height: 1.6rem;
|
|
409
|
+
color: `,`;
|
|
410
|
+
`],r("contentPrimary")),fi=i(q).withConfig({displayName:"ChatMessages__BadgeDescriptionContainer"})([`
|
|
411
|
+
align-items: flex-start;
|
|
412
|
+
flex-direction: column;
|
|
413
|
+
padding: 0.8rem;
|
|
414
|
+
width: 100%;
|
|
415
|
+
`]),yi=i(le).withConfig({displayName:"ChatMessages__BadgeDescriptionText"})([`
|
|
416
|
+
font-size: 1.4rem;
|
|
417
|
+
line-height: 2.1rem;
|
|
418
|
+
color: `,`;
|
|
419
|
+
`],r("contentPrimary")),xi=i(le).withConfig({displayName:"ChatMessages__BadgeDescriptionIssueText"})([`
|
|
420
|
+
font-size: 1.4rem;
|
|
421
|
+
line-height: 2.1rem;
|
|
422
|
+
font-weight: 600;
|
|
423
|
+
`]),wi=i(q).withConfig({displayName:"ChatMessages__IssueMessageRow"})([`
|
|
424
|
+
display: flex;
|
|
425
|
+
align-items: center;
|
|
426
|
+
gap: 0.5rem;
|
|
427
|
+
`]),wa=i(oe).attrs({variant:"tertiary"}).withConfig({displayName:"ChatMessages__SchemaNameDisplay"})([`
|
|
428
|
+
margin-left: 0.4rem;
|
|
429
|
+
padding: 0.5rem 1rem;
|
|
430
|
+
align-items: center;
|
|
431
|
+
gap: 1rem;
|
|
432
|
+
border-radius: 0.6rem;
|
|
433
|
+
`]),Ca=i(le).withConfig({displayName:"ChatMessages__SchemaName"})([`
|
|
434
|
+
font-size: 1.4rem;
|
|
435
|
+
color: `,`;
|
|
436
|
+
`],r("contentPrimary")),ba=i(le).withConfig({displayName:"ChatMessages__MessageContent"})([`
|
|
437
|
+
font-size: 1.4rem;
|
|
438
|
+
line-height: 1.8rem;
|
|
439
|
+
color: `,`;
|
|
440
|
+
white-space: pre-wrap;
|
|
441
|
+
word-wrap: break-word;
|
|
442
|
+
`],r("contentPrimary")),Ci=i(q).withConfig({displayName:"ChatMessages__ExplanationBox"})([`
|
|
443
|
+
display: flex;
|
|
444
|
+
flex-direction: column;
|
|
445
|
+
gap: 0.8rem;
|
|
446
|
+
width: 100%;
|
|
447
|
+
align-self: flex-start;
|
|
448
|
+
text-align: left;
|
|
449
|
+
background: transparent;
|
|
450
|
+
padding: 0.4rem;
|
|
451
|
+
border-radius: 0.6rem;
|
|
452
|
+
flex-shrink: 0;
|
|
453
|
+
|
|
454
|
+
`,`
|
|
455
|
+
|
|
456
|
+
.assistant-label,
|
|
457
|
+
.token-display {
|
|
458
|
+
transition: opacity 0.2s;
|
|
459
|
+
opacity: 0;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
&:hover,
|
|
463
|
+
&:focus-within {
|
|
464
|
+
.assistant-label,
|
|
465
|
+
.token-display {
|
|
466
|
+
opacity: 1;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
`],({$hasOperationHistory:a})=>a&&de([`
|
|
470
|
+
padding-top: 0;
|
|
471
|
+
`])),bi=i.div.withConfig({displayName:"ChatMessages__ErrorContainer"})([`
|
|
472
|
+
display: flex;
|
|
473
|
+
align-items: center;
|
|
474
|
+
flex-shrink: 0;
|
|
475
|
+
gap: 0.5rem;
|
|
476
|
+
padding: 0.4rem 0.4rem 0.4rem 0.8rem;
|
|
477
|
+
border: 1px solid `,`;
|
|
478
|
+
border-radius: 0.6rem;
|
|
479
|
+
color: `,`;
|
|
480
|
+
font-size: 1.4rem;
|
|
481
|
+
line-height: 2rem;
|
|
482
|
+
width: 100%;
|
|
483
|
+
`],r("statusDanger"),r("contentPrimary")),vi=i(oe).withConfig({displayName:"ChatMessages__RetryButton"})([`
|
|
484
|
+
margin-left: auto;
|
|
485
|
+
flex-shrink: 0;
|
|
486
|
+
padding: 0.5rem 0.8rem;
|
|
487
|
+
height: auto;
|
|
488
|
+
`]),Ai=i.div.withConfig({displayName:"ChatMessages__MessagesEnd"})([`
|
|
489
|
+
min-height: 1px;
|
|
490
|
+
width: 100%;
|
|
491
|
+
background: transparent;
|
|
492
|
+
`]),ji=i(q).withConfig({displayName:"ChatMessages__DiffContainer"})([`
|
|
493
|
+
display: flex;
|
|
494
|
+
flex-direction: column;
|
|
495
|
+
gap: 1rem;
|
|
496
|
+
margin-top: 1rem;
|
|
497
|
+
padding: 0.8rem 1.2rem;
|
|
498
|
+
border: 1px solid `,`;
|
|
499
|
+
border-radius: 0.8rem;
|
|
500
|
+
background: `,`;
|
|
501
|
+
width: 100%;
|
|
502
|
+
`],r("interactionNeutral"),r("surfaceInset")),Mi=i(q).withConfig({displayName:"ChatMessages__DiffHeader"})([`
|
|
503
|
+
display: flex;
|
|
504
|
+
align-items: center;
|
|
505
|
+
justify-content: space-between;
|
|
506
|
+
padding-bottom: 0.8rem;
|
|
507
|
+
border-bottom: 1px solid `,`;
|
|
508
|
+
width: 100%;
|
|
509
|
+
`,`
|
|
510
|
+
`],r("interactionNeutralHover"),({$isExpanded:a})=>!a&&de([`
|
|
511
|
+
border-bottom: 0;
|
|
512
|
+
padding-bottom: 0;
|
|
513
|
+
`])),_i=i(q).withConfig({displayName:"ChatMessages__DiffHeaderLeft"})([`
|
|
514
|
+
display: flex;
|
|
515
|
+
align-items: center;
|
|
516
|
+
gap: 1rem;
|
|
517
|
+
padding: 0.4rem 0;
|
|
518
|
+
`]),Hi=i.span.withConfig({displayName:"ChatMessages__DiffHeaderLabel"})([`
|
|
519
|
+
font-size: 1.4rem;
|
|
520
|
+
color: `,`;
|
|
521
|
+
`],r("contentSecondary")),ki=i(q).withConfig({displayName:"ChatMessages__DiffHeaderRight"})([`
|
|
522
|
+
display: flex;
|
|
523
|
+
align-items: center;
|
|
524
|
+
gap: 1.8rem;
|
|
525
|
+
margin-left: auto;
|
|
526
|
+
`]),va=i(q).withConfig({displayName:"ChatMessages__DiffHeaderStatus"})([`
|
|
527
|
+
display: flex;
|
|
528
|
+
align-items: center;
|
|
529
|
+
gap: 0.8rem;
|
|
530
|
+
color: `,`;
|
|
531
|
+
font-size: 1.3rem;
|
|
532
|
+
`],({$isAccepted:a,$isRejected:n,$isRejectedWithFollowUp:o})=>n?r("statusDanger"):o?r("statusInfo"):a?r("statusSuccessStrong"):r("contentSecondary")),Aa=i.span.withConfig({displayName:"ChatMessages__StatusIcon"})([`
|
|
533
|
+
display: flex;
|
|
534
|
+
align-items: center;
|
|
535
|
+
color: `,`;
|
|
536
|
+
`],({$isAccepted:a,$isRejected:n,$isRejectedWithFollowUp:o})=>n?r("statusDanger"):o?r("statusInfo"):a?r("statusSuccessStrong"):r("contentSecondary")),It=i(rt).withConfig({displayName:"ChatMessages__IconButton"})([`
|
|
537
|
+
color: `,`;
|
|
538
|
+
|
|
539
|
+
&:hover:not(:disabled) {
|
|
540
|
+
svg {
|
|
541
|
+
filter: brightness(1.3);
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
&:disabled {
|
|
546
|
+
opacity: 0.4;
|
|
547
|
+
cursor: not-allowed;
|
|
548
|
+
}
|
|
549
|
+
`],r("contentSecondary")),Ei=i(It).withConfig({displayName:"ChatMessages__ExpandButton"})([`
|
|
550
|
+
width: 1.6rem;
|
|
551
|
+
height: 1.6rem;
|
|
552
|
+
`]),Ii=i.div.withConfig({displayName:"ChatMessages__DiffEditorWrapper"})([`
|
|
553
|
+
position: relative;
|
|
554
|
+
width: 100%;
|
|
555
|
+
`]),Ni=i(q).withConfig({displayName:"ChatMessages__ButtonBar"})([`
|
|
556
|
+
padding: 0.5rem;
|
|
557
|
+
gap: 1rem;
|
|
558
|
+
justify-content: center;
|
|
559
|
+
flex-shrink: 0;
|
|
560
|
+
width: fit-content;
|
|
561
|
+
margin: 0 auto;
|
|
562
|
+
background: `,`;
|
|
563
|
+
border: 1px solid `,`;
|
|
564
|
+
border-radius: 0.4rem;
|
|
565
|
+
`],r("surfaceInset"),r("interactionNeutral")),Si=i(oe).attrs({variant:"primary"}).withConfig({displayName:"ChatMessages__AcceptButton"})([`
|
|
566
|
+
width: 10rem;
|
|
567
|
+
`]),Vi=i(oe).attrs({variant:"secondary"}).withConfig({displayName:"ChatMessages__RejectButton"})([`
|
|
568
|
+
width: 10rem;
|
|
569
|
+
`]),Zi=a=>{switch(a){case"fix_request":return{icon:e.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:e.jsx(nn,{size:24}),title:"Explain Query",description:"Explain this query in detail"};case"schema_explain_request":return{icon:e.jsx(an,{size:24}),title:"Explain Schema",description:"Provide an overview, detailed column descriptions and storage details."};case"health_issue_request":return{icon:e.jsx(tn,{size:24}),title:"Health Issue Analysis",description:"Analyze table health issue and provide steps for resolution:"};default:return null}},qi=(a,n)=>{switch(a){case"loading":return e.jsx(Wt,{size:24,color:n.color.statusDanger});case"success":return e.jsx(ln,{});case"error":return e.jsx(on,{});default:return e.jsx(rn,{})}},Li=({messages:a,onAcceptChange:n,onRejectChange:o,onRunQuery:c,onOpenInEditor:u,onApplyToEditor:p,onRetry:y,onCancelQuery:k,runningQueryKey:v,queryNotifications:H,isOperationInProgress:C,editorSQL:j,isStreaming:b,isLoadingMessages:g,scrollToMessageId:N,onScrollToMessageComplete:l})=>{const A=jt(),F=Gt(),d=Ee(_e.query.getTables),x=t.useRef(null),h=t.useRef(null),R=t.useRef(new Map),{status:G}=Re(),[D,I]=t.useState(!1),S=t.useRef(!1),z=t.useCallback(()=>{if(D&&S.current||N)return;const E=D?"smooth":"instant";setTimeout(()=>{var m;(m=x.current)==null||m.scrollIntoView({behavior:E}),I(!0)})},[D,N]),V=t.useCallback(E=>{const m=d.find(O=>O.table_name===E.tableName&&Ot(O)===E.kind);m&&F(bt.console.pushSidebarHistory({type:"tableDetails",payload:{tableName:m.table_name,isMatView:m.table_type==="M",isView:m.table_type==="V"}}))},[d]);t.useEffect(()=>{const E=h.current;if(!E)return;const m=()=>{S.current=!0};return E.addEventListener("wheel",m),()=>E.removeEventListener("wheel",m)},[]),t.useEffect(()=>{S.current=!1},[a.length]);const L=t.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]),_=t.useRef(L>=0?L:-1),[Ie,ee]=t.useState(L>=0?new Set([L]):new Set);t.useEffect(()=>{L>=0&&L!==_.current&&(ee(E=>new Set([...E,L])),_.current=L)},[L]);const{visibleEntries:W,lastAssistantAnchorIndex:X,lastVisibleUserIndex:ve}=t.useMemo(()=>Wa(a),[a]),pe=t.useMemo(()=>Ka(b,a),[b,a]);t.useEffect(()=>{z()},[pe,z]),t.useLayoutEffect(()=>{if(!N||g)return;const E=R.current.get(N);if(E){const m=setTimeout(()=>{E.scrollIntoView({behavior:"smooth",block:"start"}),I(!0),l()},100);return()=>clearTimeout(m)}},[N,g,l]),t.useEffect(()=>()=>{l()},[]);const Ae=W[W.length-1],Y=W.length>0?Ae.type==="user"?Ae.index:Ae.anchorIndex:-1,ze=X;return e.jsxs(di,{ref:h,$scrolled:D,role:"log","data-hook":"chat-messages-container",children:[W.map(E=>{var tt,We,J;if(E.type==="user"){const{message:M}=E,K=`${M.id}`,ge=(tt=M.displayHealthIssueData)==null?void 0:tt.severity,at=be(M.sql||"")===be(j||""),fe=M.displayType,me=M.sql;if(fe&&fe!=="ask_request"){const P=Zi(fe);let ye=null;if(fe==="schema_explain_request"&&M.displaySchemaData){const ae=M.displaySchemaData;ye=e.jsx(ht,{children:e.jsxs(wa,{onClick:()=>V(ae),children:[e.jsx(vt,{kind:ae.kind,partitionBy:ae.partitionBy,walEnabled:ae.walEnabled,designatedTimestamp:ae.designatedTimestamp}),e.jsx(Ca,{children:ae.tableName})]})})}else if(fe==="health_issue_request"&&M.displayHealthIssueData){const ae=M.displayHealthIssueData;ye=e.jsx(ht,{children:e.jsxs(wa,{children:[e.jsx(vt,{kind:"table"}),e.jsx(Ca,{children:ae.tableName})]})})}else me&&(ye=e.jsx(ht,{children:e.jsx(xa,{"data-hook":"user-request-sql-editor",children:e.jsx(Ke,{value:me,maxHeight:216,onOpenInEditor:()=>u({type:"code",value:me},at)})})}));return e.jsxs(ya,{"data-hook":"chat-message-user",ref:ae=>{ae&&R.current.set(M.id,ae)},children:[e.jsxs(mi,{children:[e.jsx(ui,{children:e.jsx(pi,{children:P==null?void 0:P.icon})}),e.jsx(gi,{children:P==null?void 0:P.title})]}),(P==null?void 0:P.description)&&e.jsxs(fi,{children:[e.jsx(yi,{children:P.description}),fe==="health_issue_request"&&((We=M.displayHealthIssueData)==null?void 0:We.issueMessage)&&e.jsxs(wi,{children:[ge==="critical"?e.jsx(Ua,{size:14,weight:"fill",color:A.color.statusDanger}):e.jsx(Ga,{size:14,weight:"fill",color:A.color.statusWarning}),e.jsx(xi,{color:ge==="critical"?"statusDanger":"statusWarning",children:M.displayHealthIssueData.issueMessage})]})]}),ye]},K)}if(fe==="ask_request"&&me){const P=M.displayUserMessage||M.content||"";return e.jsxs(ya,{"data-hook":"chat-message-user",ref:ye=>{ye&&R.current.set(M.id,ye)},children:[e.jsx(hi,{children:e.jsx(ba,{children:P})}),e.jsx(ht,{children:e.jsx(xa,{"data-hook":"user-request-sql-editor",children:e.jsx(Ke,{value:me,maxHeight:216,onOpenInEditor:()=>u({type:"code",value:me},at)})})})]},K)}return e.jsx(ci,{"data-hook":"chat-message-user",ref:P=>{P&&R.current.set(M.id,P)},children:e.jsx(ba,{children:M.displayUserMessage||M.content})},K)}const{anchorMessage:m,anchorIndex:O,turnMessages:$e}=E,Be=`${m.id}`,Pe=be(m.sql||"")===be(j||""),ce=!!m.sql,Ne=ce&&m.previousSQL!==void 0&&be(m.sql||"")===be(m.previousSQL||""),Se=Ie.has(O),he=m.isAccepted===!0,s=m.isRejected===!0,te=ce&&!he&&!s&&O<ve,Oe=O===Y,je=b&&Oe,Te=ce&&!Ne&&!he&&!s&&!te&&Oe;let $="neutral";if(m.sql){const M=be(m.sql),K=At(M);if(v&&K===v)$="loading";else if(H){const ge=(J=H[K])==null?void 0:J.latest;ge&&(ge.type===De.ERROR?$="error":(ge.type===De.SUCCESS||ge.type===De.INFO)&&($="success"))}}const B=Mt(m.previousSQL),Qe=Mt(m.sql),Q=!!m.error,mt=Q&&!b&&!C&&Oe,ut=O===ze&&C===!0,se=!!m.operationHistory&&m.operationHistory.length>0;return e.jsxs(Ci,{$hasOperationHistory:se,"data-hook":"chat-message-assistant",ref:M=>{M&&R.current.set(m.id,M)},children:[e.jsx(li,{turnMessages:$e,anchorMessage:m,status:G,isLiveOperation:ut,isMessageStreaming:je,onScrollNeeded:z,onOpenInEditor:u}),ce&&!je&&e.jsxs(ji,{"data-hook":"inline-diff-container",children:[e.jsxs(Mi,{$isExpanded:Se,children:[e.jsxs(_i,{children:[e.jsx(Xa,{size:22,color:A.color.contentSecondary}),e.jsx(Hi,{children:"Suggested change"})]}),Ne&&e.jsxs(va,{"data-hook":"diff-status-unchanged",children:[e.jsx(Aa,{children:e.jsx(Qt,{size:"14px"})}),"Already accepted"]}),!Ne&&(he||s||te)&&e.jsxs(va,{$isAccepted:he,$isRejected:s,$isRejectedWithFollowUp:te,"data-hook":s?"diff-status-rejected":te?"diff-status-followed-up":"diff-status-accepted",children:[e.jsx(Aa,{$isAccepted:he,$isRejected:s,$isRejectedWithFollowUp:te,children:s?e.jsx(Ya,{size:"14px"}):te?e.jsx(Yt,{size:"14px"}):e.jsx(Qt,{size:"14px"})}),s?"Rejected":te?"Followed up":"Accepted"]}),e.jsxs(ki,{children:[e.jsx(It,{label:$==="loading"?"Cancel query":"Run this query",size:"sm",onClick:M=>{M.stopPropagation(),$==="loading"&&m.sql?k==null||k(At(be(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:qi($,A)}),!Te&&p&&!(O===L&&he)&&!Pe&&e.jsx(It,{label:"Apply to editor",size:"sm",onClick:M=>{M.stopPropagation(),m.id&&m.sql&&!C&&(He(ke.AI_EDITOR_SUGGESTION_APPLY),p(m.id,m.sql))},title:"Apply to editor","aria-label":"Apply to editor",disabled:C,"data-hook":"message-action-apply",children:e.jsx(na,{size:22,color:A.color.contentSecondary})}),e.jsx(Ei,{label:Se?"Collapse diff view":"Expand diff view",size:"sm",title:"Expand diff view","aria-label":Se?"Collapse diff view":"Expand diff view","aria-expanded":Se,"data-hook":"diff-expand-button",onClick:()=>{ee(M=>{const K=new Set(M);return K.has(O)?K.delete(O):K.add(O),K})},children:e.jsx(Ja,{})})]})]}),Se&&e.jsxs(e.Fragment,{children:[e.jsx(Ii,{children:e.jsx(Ke,{diffEditor:!0,original:B,modified:Qe,maxHeight:300,onOpenInEditor:()=>u({type:"diff",original:B??"",modified:Qe??""}),handleScrollNeeded:z})}),Te&&e.jsxs(Ni,{align:"center",justifyContent:"center",children:[o&&m.id&&e.jsx(Vi,{onClick:()=>o(m.id),"data-hook":"message-action-reject",children:"Reject"}),n&&m.id&&e.jsx(Si,{onClick:()=>n(m.id),"data-hook":"message-action-accept",children:"Accept"})]})]})]}),Q&&e.jsxs(bi,{role:"alert","data-hook":"chat-message-error",children:[e.jsx(Bt,{size:16,color:A.color.statusDanger,style:{flexShrink:0}}),m.error,mt&&y&&e.jsx(vi,{size:"sm",variant:"secondary",prefixIcon:e.jsx(en,{size:12}),onClick:()=>{const M=a.slice(0,O).findLastIndex(K=>K.role==="user");M>=0&&y(a[M].id)},"data-hook":"retry-button",children:"Retry"})]})]},Be)}),e.jsx(Ai,{ref:x,"data-hook":"messages-end"})]})},Ti=i(q).withConfig({displayName:"ChatInput__InputContainer"})([`
|
|
570
|
+
display: flex;
|
|
571
|
+
flex-direction: column;
|
|
572
|
+
align-items: stretch;
|
|
573
|
+
gap: 0.8rem;
|
|
574
|
+
padding: 1rem 1.2rem;
|
|
575
|
+
flex-shrink: 0;
|
|
576
|
+
width: 100%;
|
|
577
|
+
margin-top: auto;
|
|
578
|
+
border-top: 1px solid `,`;
|
|
579
|
+
`],r("interactionNeutral")),Ri=i(q).withConfig({displayName:"ChatInput__InputWrapper"})([`
|
|
580
|
+
display: flex;
|
|
581
|
+
position: relative;
|
|
582
|
+
width: 100%;
|
|
583
|
+
overflow: hidden;
|
|
584
|
+
`]),Di=i(mn).withConfig({displayName:"ChatInput__StyledTextArea"})([`
|
|
585
|
+
flex: 1;
|
|
586
|
+
min-height: 8rem;
|
|
587
|
+
max-height: 30rem;
|
|
588
|
+
line-height: 1.3;
|
|
589
|
+
padding: `,`;
|
|
590
|
+
resize: none;
|
|
591
|
+
`],({$hasContext:a})=>a?"4.4rem 4.5rem 1.2rem 1.2rem":"1.2rem 4.5rem 1.2rem 1.2rem"),Fi=i(rt).withConfig({displayName:"ChatInput__SendButton"})([`
|
|
592
|
+
position: absolute;
|
|
593
|
+
right: 0.8rem;
|
|
594
|
+
bottom: 0.8rem;
|
|
595
|
+
`]),zi=i.div.withConfig({displayName:"ChatInput__ContextBadgeContainer"})([`
|
|
596
|
+
position: absolute;
|
|
597
|
+
padding: 0.8rem;
|
|
598
|
+
top: 2px;
|
|
599
|
+
border-radius: 0.6rem;
|
|
600
|
+
left: 1px;
|
|
601
|
+
width: calc(100% - 0.2rem);
|
|
602
|
+
display: inline-flex;
|
|
603
|
+
`]),$i=i(oe).attrs(a=>({variant:a.$warn?"dangerGhost":"tertiary"})).withConfig({displayName:"ChatInput__ContextBadge"})([`
|
|
604
|
+
display: flex;
|
|
605
|
+
padding: 0.3rem 0.6rem;
|
|
606
|
+
align-items: center;
|
|
607
|
+
gap: 0.4rem;
|
|
608
|
+
line-height: 1.4;
|
|
609
|
+
border-radius: 0.6rem;
|
|
610
|
+
font-size: 1.3rem;
|
|
611
|
+
user-select: none;
|
|
612
|
+
height: unset;
|
|
613
|
+
`]),Bi=i.div.withConfig({displayName:"ChatInput__ContextBadgeIcon"})([`
|
|
614
|
+
display: flex;
|
|
615
|
+
align-items: center;
|
|
616
|
+
color: `,`;
|
|
617
|
+
flex-shrink: 0;
|
|
618
|
+
|
|
619
|
+
svg {
|
|
620
|
+
color: `,`;
|
|
621
|
+
}
|
|
622
|
+
`],r("contentSecondary"),({$warn:a,theme:n})=>a?n.color.statusDanger:r("contentSecondary")),Pi=i.div.withConfig({displayName:"ChatInput__ThoughtStream"})([`
|
|
623
|
+
display: flex;
|
|
624
|
+
position: relative;
|
|
625
|
+
width: 100%;
|
|
626
|
+
background: `,`;
|
|
627
|
+
border: 1px solid transparent;
|
|
628
|
+
background:
|
|
629
|
+
linear-gradient(`,", ",`)
|
|
630
|
+
padding-box,
|
|
631
|
+
`,` border-box;
|
|
632
|
+
border-radius: 0.6rem;
|
|
633
|
+
height: 4rem;
|
|
634
|
+
`],r("surfaceInset"),r("surfaceInset"),r("surfaceInset"),({theme:a})=>hn(a.color)),Oi=i.div.withConfig({displayName:"ChatInput__ThoughtStreamContent"})([`
|
|
635
|
+
display: flex;
|
|
636
|
+
align-items: center;
|
|
637
|
+
background: `,`;
|
|
638
|
+
gap: 0.8rem;
|
|
639
|
+
width: 100%;
|
|
640
|
+
height: 100%;
|
|
641
|
+
border-radius: 0.6rem;
|
|
642
|
+
padding: 0 1.2rem;
|
|
643
|
+
padding-right: 4.5rem;
|
|
644
|
+
`],r("surfaceInset")),Qi=i.div.withConfig({displayName:"ChatInput__ThoughtText"})([`
|
|
645
|
+
font-weight: 500;
|
|
646
|
+
font-size: 1.4rem;
|
|
647
|
+
color: `,`;
|
|
648
|
+
`,`
|
|
649
|
+
`],r("contentSecondary"),Pt),Wi=i.div.withConfig({displayName:"ChatInput__StopButtonWrapper"})([`
|
|
650
|
+
position: absolute;
|
|
651
|
+
right: 0.8rem;
|
|
652
|
+
top: 50%;
|
|
653
|
+
transform: translateY(-50%);
|
|
654
|
+
`]),Nt=(a,n=30)=>{if(!a)return"";const o=a.trim().replace(/\s+/g," ");return o.length<=n?o:o.slice(0,n)+"..."},Ki=t.forwardRef(({onSend:a,disabled:n=!1,placeholder:o="Ask a question or request a refinement...",contextSQL:c,contextTableId:u,contextNotebook:p,onContextClick:y},k)=>{const[v,H]=t.useState(""),C=t.useRef(null),j=Ee(_e.query.getTables),b=t.useMemo(()=>u==null?null:j.find(I=>I.id===u)??null,[u,j]),g=p?Nt(p.label):b!=null&&b.table_name?Nt(b.table_name):c?Nt(c):null,N=!!g,l=p==null?void 0:p.warn,A=p?l==="archived"?"Notebook archived":l==="deleted"?"Notebook deleted":`Attached: ${p.label} \u2014 click to switch`:void 0;t.useImperativeHandle(k,()=>({focus:()=>{var I;(I=C.current)==null||I.focus()}}));const{status:F,abortOperation:d}=Re(),x=ue(F);t.useEffect(()=>{C.current&&(C.current.style.height="auto",C.current.style.height=`${C.current.scrollHeight}px`)},[v]);const h=()=>{const I=v.trim();I&&!n&&!x&&(a(I),H(""),C.current&&(C.current.style.height="auto"))},R=I=>{I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),h())},G=()=>{d()},D=x;return e.jsxs(Ti,{children:[D?e.jsxs(Pi,{"data-hook":"chat-assistant-modes",children:[e.jsxs(Oi,{children:[e.jsx(Ct,{size:20}),e.jsx(Qi,{role:"status","aria-live":"polite",children:F})]}),e.jsx(Wi,{children:e.jsx(dn,{size:"md",onClick:G,title:"Stop generation",ariaLabel:"Stop AI generation",dataHook:"chat-stop-button"})})]}):e.jsxs(Ri,{children:[N&&e.jsx(zi,{children:e.jsxs($i,{type:"button",$warn:!!l,onClick:p?()=>void p.onClick():y,title:A,"aria-label":`Chat context: ${g}`,"data-hook":"chat-context-badge",children:[e.jsx(Bi,{$warn:!!l,children:p?e.jsx(cn,{size:14,weight:"regular"}):b?e.jsx(vt,{kind:Ot(b),partitionBy:b.partitionBy,walEnabled:b.walEnabled,designatedTimestamp:b.designatedTimestamp}):e.jsx(ta,{size:14,weight:"regular"})}),l==="archived"?`Archived: ${g}`:l==="deleted"?`Deleted: ${g}`:g]})}),e.jsx(Di,{ref:C,value:v,onChange:I=>H(I.target.value),onKeyDown:R,placeholder:o,"aria-label":"Chat with AI assistant","aria-keyshortcuts":"Enter",disabled:n,rows:1,$hasContext:N,"data-hook":"chat-input-textarea"}),e.jsx(Fi,{label:"Send message",variant:"primary",onClick:h,disabled:!v.trim()||n,title:"Send (Enter) \u2022 New line (Shift+Enter)","data-hook":"chat-send-button",children:e.jsx(Xt,{size:20,weight:"bold"})})]}),e.jsx(le,{color:"contentSecondary",size:"sm",align:"center",children:"Chats are connected to a single query to improve responses."})]})}),St=i.div.withConfig({displayName:"ChatHistoryItem__Container"})([`
|
|
655
|
+
display: flex;
|
|
656
|
+
align-items: center;
|
|
657
|
+
gap: 0.6rem;
|
|
658
|
+
padding: 0.4rem 0.8rem;
|
|
659
|
+
border-radius: 4px;
|
|
660
|
+
cursor: `,`;
|
|
661
|
+
background: `,`;
|
|
662
|
+
opacity: `,`;
|
|
663
|
+
border: 0;
|
|
664
|
+
width: 100%;
|
|
665
|
+
text-align: left;
|
|
666
|
+
|
|
667
|
+
&:hover {
|
|
668
|
+
background: `,`;
|
|
669
|
+
|
|
670
|
+
.chat-title {
|
|
671
|
+
color: `,`;
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
&:focus-visible {
|
|
676
|
+
outline: 1px solid `,`;
|
|
677
|
+
outline-offset: 2px;
|
|
678
|
+
}
|
|
679
|
+
`],({$disabled:a})=>a?"not-allowed":"pointer",r("transparent"),({$disabled:a})=>a?.5:1,({$disabled:a})=>a?"transparent":r("surfaceRaised"),({$disabled:a})=>a?r("contentSecondary"):r("contentPrimary"),r("contentAccent")),Ui=i.div.withConfig({displayName:"ChatHistoryItem__IconWrapper"})([`
|
|
680
|
+
display: flex;
|
|
681
|
+
align-items: center;
|
|
682
|
+
justify-content: center;
|
|
683
|
+
flex-shrink: 0;
|
|
684
|
+
color: `,`;
|
|
685
|
+
`],r("contentSecondary")),Gi=i.div.withConfig({displayName:"ChatHistoryItem__Content"})([`
|
|
686
|
+
display: flex;
|
|
687
|
+
flex-direction: column;
|
|
688
|
+
flex: 1;
|
|
689
|
+
min-width: 0;
|
|
690
|
+
padding-left: 0.4rem;
|
|
691
|
+
`]),Xi=i.div.attrs({className:"chat-title"}).withConfig({displayName:"ChatHistoryItem__Title"})([`
|
|
692
|
+
padding: 0.2rem 0.4rem;
|
|
693
|
+
border: 1px solid transparent;
|
|
694
|
+
color: `,`;
|
|
695
|
+
white-space: nowrap;
|
|
696
|
+
overflow: hidden;
|
|
697
|
+
text-overflow: ellipsis;
|
|
698
|
+
transform: translateX(-0.4rem);
|
|
699
|
+
`],r("contentSecondary")),Yi=i.input.withConfig({displayName:"ChatHistoryItem__TitleInput"})([`
|
|
700
|
+
color: `,`;
|
|
701
|
+
background: transparent;
|
|
702
|
+
border: 1px solid `,`;
|
|
703
|
+
border-radius: 6px;
|
|
704
|
+
outline: none;
|
|
705
|
+
padding: 0.2rem 0.4rem;
|
|
706
|
+
font-family: inherit;
|
|
707
|
+
transform: translateX(-0.4rem);
|
|
708
|
+
|
|
709
|
+
&:focus {
|
|
710
|
+
outline: none;
|
|
711
|
+
}
|
|
712
|
+
`],r("contentPrimary"),r("actionPrimary")),Ji=i.div.withConfig({displayName:"ChatHistoryItem__Subtitle"})([`
|
|
713
|
+
font-size: 1.2rem;
|
|
714
|
+
line-height: 1.5;
|
|
715
|
+
color: `,`;
|
|
716
|
+
white-space: nowrap;
|
|
717
|
+
overflow: hidden;
|
|
718
|
+
text-overflow: ellipsis;
|
|
719
|
+
`],r("contentSecondary")),es=i.div.withConfig({displayName:"ChatHistoryItem__ActionsContainer"})([`
|
|
720
|
+
display: flex;
|
|
721
|
+
align-items: center;
|
|
722
|
+
gap: 0.4rem;
|
|
723
|
+
flex-shrink: 0;
|
|
724
|
+
`]),ja=i(rt).withConfig({displayName:"ChatHistoryItem__ActionButton"})([`
|
|
725
|
+
opacity: 0;
|
|
726
|
+
|
|
727
|
+
`,`:hover &,
|
|
728
|
+
`,`:focus-within & {
|
|
729
|
+
opacity: 1;
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
&:focus-visible {
|
|
733
|
+
opacity: 1;
|
|
734
|
+
}
|
|
735
|
+
`],St,St),ts=i.span.withConfig({displayName:"ChatHistoryItem__CurrentIndicator"})([`
|
|
736
|
+
font-size: 1.2rem;
|
|
737
|
+
line-height: 1.5rem;
|
|
738
|
+
color: `,`;
|
|
739
|
+
white-space: nowrap;
|
|
740
|
+
`],r("contentMuted")),as=({conversation:a,subtitle:n,isCurrent:o,hasOngoingProcess:c,disabled:u,onSelect:p,onRename:y,onDelete:k})=>{const[v,H]=t.useState(!1),[C,j]=t.useState(a.conversationName),b=t.useRef(null);t.useEffect(()=>{v&&b.current&&(b.current.focus(),b.current.select())},[v]);const g=h=>{h.stopPropagation(),j(a.conversationName),H(!0)},N=h=>{h.stopPropagation(),k(a.id)},l=async()=>{const h=C.trim();h&&h!==a.conversationName&&(He(ke.AI_CHAT_RENAME),await y(a.id,h)),H(!1)},A=async h=>{h.key==="Enter"?await l():h.key==="Escape"&&(j(a.conversationName),H(!1))},F=async()=>{await l()},d=async()=>{!v&&!u&&await p(a.id)},x=async h=>{v||u||h.target===h.currentTarget&&(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),await p(a.id))};return e.jsxs(St,{role:"button",tabIndex:u?-1:0,"aria-disabled":u||void 0,onClick:d,onKeyDown:x,$disabled:u,"data-hook":"chat-history-item",children:[e.jsx(Ui,{children:e.jsx(Jt,{size:18})}),e.jsxs(Gi,{children:[v?e.jsx(Yi,{ref:b,value:C,onChange:h=>j(h.target.value),onKeyDown:A,onBlur:F,onClick:h=>h.stopPropagation(),"data-hook":"chat-history-rename"}):e.jsx(Xi,{"data-hook":"chat-history-title",children:a.conversationName}),n&&e.jsx(Ji,{children:n})]}),e.jsxs(es,{children:[!v&&e.jsxs(e.Fragment,{children:[e.jsx(ja,{label:"Edit title",size:"sm",onClick:g,title:"Edit title","data-hook":"chat-history-edit",children:e.jsx(un,{size:18})}),!c&&e.jsx(ja,{label:"Delete conversation",size:"sm",variant:"dangerGhost",onClick:N,title:"Delete","data-hook":"chat-history-delete",children:e.jsx(ia,{size:18})})]}),o&&e.jsx(ts,{children:"Current"})]})]})},ns=i.div.withConfig({displayName:"DateSeparator__Container"})([`
|
|
741
|
+
display: flex;
|
|
742
|
+
align-items: center;
|
|
743
|
+
gap: 1rem;
|
|
744
|
+
padding: 0.4rem 0;
|
|
745
|
+
width: 100%;
|
|
746
|
+
`]),Ma=i.div.withConfig({displayName:"DateSeparator__Line"})([`
|
|
747
|
+
flex: 1;
|
|
748
|
+
height: 1px;
|
|
749
|
+
background: `,`;
|
|
750
|
+
`],r("interactionNeutral")),is=i.div.withConfig({displayName:"DateSeparator__LabelContainer"})([`
|
|
751
|
+
display: flex;
|
|
752
|
+
align-items: center;
|
|
753
|
+
gap: 0.8rem;
|
|
754
|
+
color: `,`;
|
|
755
|
+
`],r("contentSecondary")),ss=i.span.withConfig({displayName:"DateSeparator__Label"})([`
|
|
756
|
+
font-size: 1.3rem;
|
|
757
|
+
white-space: nowrap;
|
|
758
|
+
`]),rs=({label:a})=>e.jsxs(ns,{children:[e.jsx(Ma,{}),e.jsxs(is,{children:[e.jsx(ea,{size:16}),e.jsx(ss,{children:a})]}),e.jsx(Ma,{})]}),os=6e4;function _a(a){const n=pn(),o=fn(n);return gn(a,new Date().getTime(),{locale:o})+" ago"}function ls(a){const n=[...a].sort((p,y)=>y.updatedAt-p.updatedAt),o=new Map;for(const p of n){const y=_a(p.updatedAt),k=o.get(y)||[];o.set(y,[...k,p])}const c=[],u=new Set;for(const p of n){const y=_a(p.updatedAt);u.has(y)||(u.add(y),c.push({label:y,conversations:o.get(y)||[]}))}return c}function ds(a){const[n,o]=t.useState(0);return t.useEffect(()=>{const c=setInterval(()=>{o(u=>u+1)},os);return()=>clearInterval(c)},[]),t.useMemo(()=>ls(a),[a,n])}function cs(a,n){if(!n.trim())return a;const o=n.toLowerCase().trim();return a.filter(c=>c.conversationName.toLowerCase().includes(o))}const Ha=i.div.withConfig({displayName:"ChatHistoryView__Container"})([`
|
|
759
|
+
display: flex;
|
|
760
|
+
flex-direction: column;
|
|
761
|
+
height: 100%;
|
|
762
|
+
width: 100%;
|
|
763
|
+
padding: 2rem 1rem 4rem 1rem;
|
|
764
|
+
background: `,`;
|
|
765
|
+
overflow: hidden;
|
|
766
|
+
`],({theme:a})=>a.color.surfaceBase),hs=i.div.withConfig({displayName:"ChatHistoryView__SearchContainer"})([`
|
|
767
|
+
position: relative;
|
|
768
|
+
display: flex;
|
|
769
|
+
align-items: center;
|
|
770
|
+
flex-shrink: 0;
|
|
771
|
+
`]),ms=i.div.withConfig({displayName:"ChatHistoryView__SearchIcon"})([`
|
|
772
|
+
position: absolute;
|
|
773
|
+
left: 1.2rem;
|
|
774
|
+
display: flex;
|
|
775
|
+
align-items: center;
|
|
776
|
+
color: `,`;
|
|
777
|
+
pointer-events: none;
|
|
778
|
+
z-index: 1;
|
|
779
|
+
`],r("contentSecondary")),us=i(rt).attrs({label:"Clear search",variant:"ghost",size:"sm"}).withConfig({displayName:"ChatHistoryView__ClearButton"})([`
|
|
780
|
+
position: absolute;
|
|
781
|
+
right: 0.8rem;
|
|
782
|
+
padding: 0.2rem;
|
|
783
|
+
`]),ps=i(Cn).withConfig({displayName:"ChatHistoryView__SearchInput"})([`
|
|
784
|
+
width: 100%;
|
|
785
|
+
padding: 0.8rem 3.6rem 0.8rem 3.6rem;
|
|
786
|
+
`]),gs=i.div.withConfig({displayName:"ChatHistoryView__ListContainer"})([`
|
|
787
|
+
display: flex;
|
|
788
|
+
flex-direction: column;
|
|
789
|
+
gap: 0.6rem;
|
|
790
|
+
padding: 2rem 0.4rem;
|
|
791
|
+
overflow-y: auto;
|
|
792
|
+
flex: 1;
|
|
793
|
+
min-height: 0;
|
|
794
|
+
`]),ka=i.div.withConfig({displayName:"ChatHistoryView__EmptyState"})([`
|
|
795
|
+
display: flex;
|
|
796
|
+
flex-direction: column;
|
|
797
|
+
align-items: center;
|
|
798
|
+
justify-content: center;
|
|
799
|
+
flex: 1;
|
|
800
|
+
color: `,`;
|
|
801
|
+
font-size: 1.3rem;
|
|
802
|
+
text-align: center;
|
|
803
|
+
padding: 2rem;
|
|
804
|
+
`],r("contentSecondary")),fs=i.div.withConfig({displayName:"ChatHistoryView__DialogHeader"})([`
|
|
805
|
+
display: flex;
|
|
806
|
+
align-items: center;
|
|
807
|
+
justify-content: space-between;
|
|
808
|
+
padding: 1.5rem 2rem;
|
|
809
|
+
border-bottom: 1px solid `,`;
|
|
810
|
+
`],r("interactionNeutral")),ys=i.h3.withConfig({displayName:"ChatHistoryView__DialogTitle"})([`
|
|
811
|
+
margin: 0;
|
|
812
|
+
font-weight: 500;
|
|
813
|
+
color: `,`;
|
|
814
|
+
`],r("contentPrimary")),xs=i.p.withConfig({displayName:"ChatHistoryView__DialogDescription"})([`
|
|
815
|
+
margin: 2rem;
|
|
816
|
+
font-size: 1.4rem;
|
|
817
|
+
line-height: 1.5;
|
|
818
|
+
`]),ws=i.div.withConfig({displayName:"ChatHistoryView__DialogButtons"})([`
|
|
819
|
+
display: flex;
|
|
820
|
+
justify-content: flex-end;
|
|
821
|
+
gap: 1rem;
|
|
822
|
+
padding: 0 2rem 0 2rem;
|
|
823
|
+
`]),Cs=i(oe).attrs({variant:"secondary"}).withConfig({displayName:"ChatHistoryView__CancelButton"})([""]),bs=i(oe).attrs({variant:"danger"}).withConfig({displayName:"ChatHistoryView__DeleteButton"})([""]),vs=({currentConversationId:a})=>{const[n,o]=t.useState(""),[c,u]=t.useState(!1),[p,y]=t.useState(null),k=t.useRef(null),{conversationMetas:v,chatWindowState:H,openChatWindow:C,updateConversationName:j,deleteConversation:b}=wt(),{status:g}=Re(),{buffers:N}=xt(),l=Ee(_e.query.getTables),A=t.useMemo(()=>Array.from(v.values()),[v]),F=t.useMemo(()=>cs(A,n),[A,n]),d=ds(F),x=(S,z)=>{if(S){if(z==="buffer"){const V=N.find(L=>L.id===S);if(V)return V.label}else if(z==="table"){const V=l.find(L=>L.id===S);if(V)return V.table_name}}},h=async S=>{await C(S)},R=async(S,z)=>{await j(S,z)},G=S=>{y(S),u(!0)},D=async()=>{p&&await b(p),u(!1),y(null)},I=()=>{u(!1),y(null)};return t.useEffect(()=>{k.current&&k.current.scrollIntoView({block:"center"})},[]),A.length===0?e.jsx(Ha,{children:e.jsx(ka,{"data-hook":"chat-history-empty",children:"No conversations yet"})}):e.jsxs(Ha,{children:[e.jsxs(hs,{children:[e.jsx(ms,{children:e.jsx(yn,{size:18})}),e.jsx(ps,{type:"text",placeholder:"Search chats",value:n,onChange:S=>o(S.target.value),"data-hook":"chat-history-search"}),n&&e.jsx(us,{onClick:()=>o(""),title:"Clear search","data-hook":"chat-history-search-clear",children:e.jsx(Kt,{size:16})})]}),e.jsxs(gs,{"data-hook":"chat-history-list",children:[d.map((S,z)=>e.jsxs(lt.Fragment,{children:[z>0&&e.jsx(rs,{label:S.label}),S.conversations.map(V=>{const L=V.id===a;return e.jsx("div",{ref:L?k:void 0,children:e.jsx(as,{conversation:V,subtitle:V.bufferId??V.tableId?x(V.bufferId??V.tableId,V.bufferId?"buffer":"table"):void 0,isCurrent:L,hasOngoingProcess:V.id===H.activeConversationId&&ue(g),disabled:ue(g)&&V.id!==H.activeConversationId,onSelect:h,onRename:R,onDelete:G})},V.id)})]},S.label)),F.length===0&&n&&e.jsx(ka,{children:"No chats match your search"})]}),e.jsx(Fe.Root,{open:c,onOpenChange:u,children:e.jsxs(Fe.Portal,{children:[e.jsx(xn,{children:e.jsx(wn,{primitive:Fe.Overlay})}),e.jsxs(Fe.Content,{maxwidth:"40rem",children:[e.jsx(fs,{children:e.jsx(ys,{children:"Delete conversation"})}),e.jsx(xs,{children:"Are you sure you want to delete this conversation? This action cannot be undone."}),e.jsxs(ws,{children:[e.jsx(Fe.Cancel,{asChild:!0,children:e.jsx(Cs,{onClick:I,children:"Cancel"})}),e.jsx(Fe.Action,{asChild:!0,children:e.jsx(bs,{onClick:D,children:"Delete"})})]})]})]})})]})};async function As(a){var C,j,b;const{normalizedSQL:n,queryKey:o,namespaceKey:c,quest:u,dispatch:p,executionRefs:y,releaseExecution:k}=a,{promise:v,queryId:H}=u.queryRaw(n,{limit:"0,1000",explain:!0,cancellable:!0});(C=a.onQueryStarted)==null||C.call(a,H);try{const g=await v;if(y.current[c]||(y.current[c]={}),y.current[c][o]={success:!0,queryText:n,startOffset:-1,endOffset:-1},p(Ue.setResult(g)),g.type===Ge.DDL||g.type===Ge.DML){p(Ue.addNotification({query:o,content:e.jsx(Xe,{query:n})},c)),Ye.publish(Je.MSG_QUERY_SCHEMA);return}if(g.type===Ge.NOTICE){p(Ue.addNotification({query:o,content:e.jsxs(le,{color:"contentPrimary",ellipsis:!0,title:n,children:[g.notice,n!==""?`: ${n}`:""]}),type:De.NOTICE,sideContent:e.jsx(Xe,{query:n})},c)),Ye.publish(Je.MSG_QUERY_SCHEMA);return}g.type===Ge.DQL&&(p(Ue.addNotification({query:o,jitCompiled:((j=g.explain)==null?void 0:j.jitCompiled)??!1,content:e.jsx(bn,{...g.timings,rowCount:g.count}),sideContent:e.jsx(Xe,{query:n})},c)),Ye.publish(Je.MSG_QUERY_DATASET,g))}catch(g){const N=g;y.current[c]||(y.current[c]={}),y.current[c][o]={success:!1,queryText:n,startOffset:-1,endOffset:-1},p(Ue.addNotification({query:o,content:e.jsx(le,{color:"statusDanger",children:N.error||N.message||"Query execution failed"}),type:De.ERROR,sideContent:e.jsx(Xe,{query:n})},c))}finally{(b=a.onSettled)==null||b.call(a),k(o)}}const js=i(oe).withConfig({displayName:"AIChatWindow__CancelButton"})([`
|
|
824
|
+
padding: 1.2rem 0.6rem;
|
|
825
|
+
`]),Ms=i.div.withConfig({displayName:"AIChatWindow__HeaderLeft"})([`
|
|
826
|
+
display: flex;
|
|
827
|
+
align-items: center;
|
|
828
|
+
gap: 1rem;
|
|
829
|
+
flex: 1;
|
|
830
|
+
min-width: 0;
|
|
831
|
+
overflow: hidden;
|
|
832
|
+
`]),_s=i.span.withConfig({displayName:"AIChatWindow__HeaderTitle"})([`
|
|
833
|
+
white-space: nowrap;
|
|
834
|
+
overflow: hidden;
|
|
835
|
+
text-overflow: ellipsis;
|
|
836
|
+
font-size: 1.6rem;
|
|
837
|
+
`]),Vt=i(oe).attrs({variant:"ghost"}).withConfig({displayName:"AIChatWindow__HeaderButton"})([`
|
|
838
|
+
padding: 0.6rem;
|
|
839
|
+
`]),Hs=i.div.withConfig({displayName:"AIChatWindow__HeaderRight"})([`
|
|
840
|
+
display: flex;
|
|
841
|
+
align-items: center;
|
|
842
|
+
gap: 0.5rem;
|
|
843
|
+
flex-shrink: 0;
|
|
844
|
+
`]),ks=i.div.withConfig({displayName:"AIChatWindow__ChatWindowContent"})([`
|
|
845
|
+
display: flex;
|
|
846
|
+
height: 100%;
|
|
847
|
+
width: 100%;
|
|
848
|
+
overflow: hidden;
|
|
849
|
+
background: `,`;
|
|
850
|
+
`],({theme:a})=>a.color.surfaceBase),Es=i.div.withConfig({displayName:"AIChatWindow__InitialQueryContainer"})([`
|
|
851
|
+
display: flex;
|
|
852
|
+
flex-direction: column;
|
|
853
|
+
gap: 1rem;
|
|
854
|
+
padding: 1.5rem;
|
|
855
|
+
overflow-y: auto;
|
|
856
|
+
flex: 1 1 auto;
|
|
857
|
+
min-height: 0;
|
|
858
|
+
width: 100%;
|
|
859
|
+
`]),Is=i.div.withConfig({displayName:"AIChatWindow__InitialQueryBox"})([`
|
|
860
|
+
display: flex;
|
|
861
|
+
flex-direction: column;
|
|
862
|
+
align-self: flex-end;
|
|
863
|
+
flex-shrink: 0;
|
|
864
|
+
overflow: hidden;
|
|
865
|
+
width: 100%;
|
|
866
|
+
`]),Ns=i.div.withConfig({displayName:"AIChatWindow__InitialQueryEditor"})([`
|
|
867
|
+
width: 100%;
|
|
868
|
+
overflow: hidden;
|
|
869
|
+
`]),Ss=i.div.withConfig({displayName:"AIChatWindow__ButtonContainer"})([`
|
|
870
|
+
display: flex;
|
|
871
|
+
justify-content: flex-start;
|
|
872
|
+
align-items: center;
|
|
873
|
+
gap: 1rem;
|
|
874
|
+
width: 100%;
|
|
875
|
+
margin-top: 0.5rem;
|
|
876
|
+
`]),Vs=i.div.withConfig({displayName:"AIChatWindow__BlankChatContainer"})([`
|
|
877
|
+
display: flex;
|
|
878
|
+
flex-direction: column;
|
|
879
|
+
align-items: flex-start;
|
|
880
|
+
justify-content: center;
|
|
881
|
+
gap: 1.2rem;
|
|
882
|
+
padding: 1.8rem;
|
|
883
|
+
flex: 1 1 auto;
|
|
884
|
+
min-height: 0;
|
|
885
|
+
max-width: 40rem;
|
|
886
|
+
text-align: center;
|
|
887
|
+
margin: 0 auto;
|
|
888
|
+
`]),Zs=i.h2.withConfig({displayName:"AIChatWindow__BlankChatHeading"})([`
|
|
889
|
+
font-size: 2rem;
|
|
890
|
+
font-weight: 600;
|
|
891
|
+
text-align: left;
|
|
892
|
+
color: `,`;
|
|
893
|
+
margin: 0;
|
|
894
|
+
`],r("contentPrimary")),qs=i.p.withConfig({displayName:"AIChatWindow__BlankChatSubheading"})([`
|
|
895
|
+
font-size: 1.4rem;
|
|
896
|
+
font-weight: 400;
|
|
897
|
+
color: `,`;
|
|
898
|
+
text-align: left;
|
|
899
|
+
margin: 0;
|
|
900
|
+
line-height: 1.5;
|
|
901
|
+
`],r("contentSecondary")),Ea=i(q).withConfig({displayName:"AIChatWindow__ChatPanel"})([`
|
|
902
|
+
display: flex;
|
|
903
|
+
flex-direction: column;
|
|
904
|
+
align-items: stretch;
|
|
905
|
+
height: 100%;
|
|
906
|
+
width: 100%;
|
|
907
|
+
gap: 0;
|
|
908
|
+
background: `,`;
|
|
909
|
+
`],({theme:a})=>a.color.surfaceBase),Ls=()=>{const a=Gt(),n=Ee(_e.console.getActiveSidebar),{quest:o,questExecution:c}=t.useContext(yt),{editorRef:u,showPreviewBuffer:p,closePreviewBuffer:y,addBuffer:k,executionRefs:v,highlightQuery:H,buffers:C,activeBuffer:j,setActiveBuffer:b}=xt(),g=vn(),{conversationMetas:N,chatWindowState:l,isLoadingMessages:A,isStreaming:F,setIsStreaming:d,scrollToMessageId:x,setScrollToMessageId:h,closeChatWindow:R,openBlankChatWindow:G,openHistoryView:D,closeHistoryView:I,getConversationMeta:S,addMessage:z,removeMessages:V,updateMessage:L,updateMessagesWithCompaction:_,updateConversationName:Ie,acceptSuggestion:ee,rejectSuggestion:W,persistMessages:X,bindConversationToNotebook:ve,readUserActionDigest:pe,rotateUserActionDigest:Ae}=wt(),{status:Y,setStatus:ze,abortController:E,canUse:m,hasSchemaAccess:O,currentModel:$e,apiKey:Be,aiAssistantSettings:Pe}=Re(),ce=Ee(_e.query.getTables),{active:Ne}=An(),Se=(Ne==null?void 0:Ne.queryKey)??null,he=l.activeConversationId?S(l.activeConversationId):null,s=t.useMemo(()=>he?{...he,messages:g}:null,[he,g]),te=t.useMemo(()=>s?s.bufferId!==void 0?s.bufferId:s.id:-1,[s==null?void 0:s.bufferId,s==null?void 0:s.id]),Oe=Ee(_e.query.getQueryNotificationsForBuffer(te)),je=t.useRef(null),Te=t.useRef(!1),$=t.useRef(null),B=t.useMemo(()=>Mt(s==null?void 0:s.currentSQL),[s==null?void 0:s.currentSQL]),Qe=t.useMemo(()=>jn(s==null?void 0:s.queryKey),[s==null?void 0:s.queryKey]),Q=g,mt=t.useMemo(()=>Mn(Q)!==null,[Q]),ut=t.useMemo(()=>Q.length>0&&!A,[Q,A]),se=t.useMemo(()=>Q.length===0&&B&&B.trim()!==`
|
|
910
|
+
`&&m&&!ue(Y),[Q.length,B,m,Y]),tt=t.useMemo(()=>!se||!s||!s.queryKey||!s.bufferId||!u.current?!1:sa(s.queryKey,s.bufferId,v,u)!==null,[se,s,u,v]),We=se&&tt&&m&&!ue(Y),J=l.isHistoryOpen??!1,M=N.size>0,K=t.useMemo(()=>ue(Y)?!0:s?s.messages.length===0&&!s.queryKey&&!s.tableId:!1,[s,Y]),ge=t.useMemo(()=>{if(J)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,J]),at=t.useCallback(()=>{J?I():D()},[J,I,D]),fe=()=>Q.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=t.useCallback(async f=>{var Ve;const w=(Ve=S(f))==null?void 0:Ve.notebookBufferId,T=typeof w=="number"?_n(w):void 0,U=w?await Hn(w).catch(Z=>(console.warn("Notebook snapshot unavailable, sending without it",Z),null)):null,ne=pe(f),xe=C.filter(Z=>!!Z.notebookViewState&&typeof Z.id=="number"),we=xe.length>0||typeof j.id=="number"?{notebooks:xe.map(Z=>({buffer_id:Z.id,label:Z.label,archived:!!Z.archived,...Z.id===w?{bound_to_this_chat:!0}:{}})),active:typeof j.id=="number"?{buffer_id:j.id,label:j.label,kind:j.notebookViewState?"notebook":j.metricsViewState?"metrics":j.editorViewState?"sql":"other"}:void 0}:void 0;if(!(!U&&!ne&&!we))return{snapshot:U,digest:ne,workspace:we,readSeq:T}},[S,pe,C,j]),P=async(f,w=!1)=>{if(!m||!l.activeConversationId||!s)return;He(ke.AI_CHAT_SEND);const T=l.activeConversationId;w&&y();const U=s.messages.some(ne=>ne.role==="assistant");Ze(Ut({conversationId:T,userMessage:f,currentSQL:B,conversationHistory:s.messages,isFirstMessage:!U,settings:{model:$e,apiKey:Be},aiAssistantSettings:Pe,questClient:o,tables:ce,hasSchemaAccess:O,abortSignal:E==null?void 0:E.signal,notebookContext:await me(T)}),{addMessage:z,removeMessages:V,updateMessage:L,setStatus:ze,setIsStreaming:d,persistMessages:X,updateConversationName:Ie,bindConversationToNotebook:ve,rotateUserActionDigest:Ae,updateMessagesWithCompaction:_})},ye=t.useCallback(async f=>{l.activeConversationId&&(He(ke.AI_CHAT_ACCEPT),await ee({conversationId:l.activeConversationId,messageId:f}))},[l.activeConversationId,ee]),ae=t.useCallback(async f=>{l.activeConversationId&&(He(ke.AI_CHAT_REJECT),await W(l.activeConversationId,f),setTimeout(()=>{var w;(w=je.current)==null||w.focus()},100))},[l.activeConversationId,W]),Ia=t.useCallback(f=>{if(!s)return;const w=be(f),T=At(w);let U=null;c.requestExecution({abort:()=>{U!==null&&o.abort(U)},bufferId:te,queryKey:T,execute:()=>{const ne=window.setTimeout(()=>{a(bt.query.addNotification({query:T,type:De.LOADING,content:e.jsxs(q,{gap:"1rem",align:"center",children:[e.jsx(le,{color:"contentPrimary",children:"Running..."}),e.jsx(js,{variant:"dangerGhost",onClick:()=>{c.cancelActive()},children:e.jsx(Wt,{size:"18px"})})]}),sideContent:e.jsx(Xe,{query:w})},te)),$.current=null},1e3);$.current=ne,As({normalizedSQL:w,queryKey:T,namespaceKey:te,quest:o,dispatch:a,executionRefs:v,releaseExecution:c.releaseExecution,onQueryStarted:xe=>{U=xe},onSettled:()=>{$.current===ne&&(window.clearTimeout(ne),$.current=null)}})}})},[s,v,te,o,c]),Na=t.useCallback(f=>{var w;((w=c.getActive())==null?void 0:w.queryKey)===f&&($.current!==null&&(window.clearTimeout($.current),$.current=null),c.cancelActive())},[c]),pt=t.useCallback(async()=>{if(He(ke.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 H(s.queryKey,s.bufferId);if(s!=null&&s.tableId){const f=ce.find(w=>w.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,H,ce]),Sa=t.useCallback(()=>{h(null)},[h]),Zt=t.useCallback(async(f,w=!1)=>{if(!(w&&await pt()))if(f.type==="diff"){if(!l.activeConversationId)return;p({type:"diff",original:f.original,modified:f.modified,conversationId:l.activeConversationId})}else k({value:f.value})},[p,k,l.activeConversationId,pt]),Va=t.useCallback(async(f,w)=>{if(!l.activeConversationId)return;const T=kn(w,!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:
|
|
911
|
+
|
|
912
|
+
\`\`\`sql
|
|
913
|
+
${T.replaceAll(/\s+/g," ").trim()}
|
|
914
|
+
\`\`\``,timestamp:Date.now(),hideFromUI:!0}),await X(l.activeConversationId)}catch(U){console.error("Error applying SQL to editor:",U),ot.error("Failed to apply changes to editor")}},[l.activeConversationId,ee,z,X]),Za=t.useCallback(async f=>{if(!l.activeConversationId||!m||ue(Y))return;const w=l.activeConversationId,T=Q.find(Z=>Z.id===f);if(!T)return;const U=Q.findIndex(Z=>Z.id===f);if(U<0)return;const ne=Q.slice(U).map(Z=>Z.id),xe=new Set(ne);V(ne);const we={settings:{model:$e,apiKey:Be},aiAssistantSettings:Pe,questClient:o,tables:ce,hasSchemaAccess:O,abortSignal:E==null?void 0:E.signal,notebookContext:await me(w)},Ve={addMessage:z,updateMessage:L,removeMessages:V,setStatus:ze,setIsStreaming:d,persistMessages:X,updateConversationName:Ie,updateMessagesWithCompaction:_,bindConversationToNotebook:ve,rotateUserActionDigest:Ae};switch(T.displayType){case"explain_request":{if(!T.sql)return;Ze(Rt({conversationId:w,queryText:T.sql,...we}),Ve);break}case"fix_request":{if(!T.sql)return;Ze(Dt({conversationId:w,queryText:T.sql,...we}),Ve);break}case"schema_explain_request":{if(!T.displaySchemaData)return;const Z=T.displaySchemaData;try{const re=Z.kind==="matview"?await o.showMatViewDDL(Z.tableName):Z.kind==="view"?await o.showViewDDL(Z.tableName):await o.showTableDDL(Z.tableName);if((re==null?void 0:re.type)!==Ge.DQL||!re.data||re.data.length===0){ot.error("Failed to fetch table schema for retry");return}const it=re.data[0];if(!it.ddl){ot.error("Failed to fetch table schema for retry");return}Ze(En({conversationId:w,tableName:Z.tableName,schema:it.ddl,kindLabel:In(Z.kind),schemaDisplayData:Z,...we}),Ve)}catch(re){console.error("Error fetching DDL for retry:",re),ot.error("Failed to fetch table schema for retry")}break}case"ask_request":default:{const Z=T.displayUserMessage||T.content||"",re=Q.filter(ft=>!xe.has(ft.id)),it=re.some(ft=>ft.role==="assistant");Ze(Ut({conversationId:w,userMessage:Z,currentSQL:T.sql||B,conversationHistory:re,isFirstMessage:!it,...we}),Ve);break}}},[l.activeConversationId,m,Y,Q,V,$e,Be,Pe,o,ce,O,E,z,L,ze,d,X,Ie,_,ve,me,B]),qt=t.useRef(null),nt=t.useCallback(()=>{var f,w;(w=(f=qt.current)==null?void 0:f.querySelector('button[data-hook="button-explain-query"]'))==null||w.click()},[]),gt=t.useCallback(f=>{se&&(f.metaKey||f.ctrlKey)&&(f.key==="e"||f.key==="E")&&(f.preventDefault(),nt())},[se]);t.useEffect(()=>{if(se)return Ye.subscribe(Je.EXPLAIN_QUERY_EXEC,nt),document.addEventListener("keydown",gt),()=>{document.removeEventListener("keydown",gt),Ye.unsubscribe(Je.EXPLAIN_QUERY_EXEC,nt)}},[se,gt,nt]),t.useEffect(()=>()=>{$.current!==null&&(window.clearTimeout($.current),$.current=null)},[]),t.useEffect(()=>{Te.current||J||A||je.current&&(je.current.focus(),Te.current=!0)},[J,A]);const qa=t.useCallback(async()=>{var f;Te.current=!1,await G(),(f=je.current)==null||f.focus()},[G]);if((n==null?void 0:n.type)!=="aiChat"||!s&&!J)return null;const La=(()=>{const f=s==null?void 0:s.notebookBufferId;if(typeof f!="number")return;const w=C.find(we=>we.id===f),T=!w,U=!!(w!=null&&w.archived),ne=(w==null?void 0:w.label)??`#${f}`,xe=T?"deleted":U?"archived":null;return{label:ne,warn:xe,onClick:async()=>{xe||w&&await b(w)}}})();return e.jsx(e.Fragment,{children:e.jsx(Nn,{mode:"side","data-hook":"ai-chat-window",open:(n==null?void 0:n.type)==="aiChat",onOpenChange:f=>{f||R()},onDismiss:R,trigger:e.jsx("span",{}),title:e.jsxs(Ms,{children:[e.jsx(st,{size:20,variant:"filled"}),e.jsx(_s,{"data-hook":"chat-window-title",children:ge})]}),afterTitle:e.jsxs(Hs,{children:[e.jsx(Vt,{onClick:qa,title:"New chat","aria-label":"New chat",disabled:K,"data-hook":"chat-window-new",children:e.jsx(Sn,{size:16,weight:"bold"})}),e.jsx(Vt,{onClick:at,title:J?"Back to chat":"Chat history","aria-label":J?"Back to chat":"Chat history","aria-pressed":J,disabled:!M||ue(Y),"data-hook":"chat-window-history",children:e.jsx(Vn,{size:16,weight:"bold"})}),e.jsx(Vt,{onClick:R,title:"Close","aria-label":"Close AI chat","data-hook":"chat-window-close",children:e.jsx(Kt,{size:16,weight:"bold"})})]}),children:e.jsx(ks,{children:A?e.jsx(Ea,{children:e.jsx(Ct,{size:20,style:{margin:"auto"}})}):J?e.jsx(vs,{currentConversationId:l.previousConversationId??null}):e.jsxs(Ea,{children:[ut?e.jsx(Li,{messages:Q,onAcceptChange:ye,onRejectChange:ae,onRunQuery:Ia,onOpenInEditor:Zt,onApplyToEditor:Va,onRetry:Za,onCancelQuery:Na,runningQueryKey:Se,queryNotifications:Oe,isOperationInProgress:ue(Y),editorSQL:Qe.queryText,isStreaming:F,isLoadingMessages:A,scrollToMessageId:x,onScrollToMessageComplete:Sa}):B&&B.trim()?e.jsxs(Es,{children:[e.jsx(Is,{"data-hook":"chat-initial-query-box",children:e.jsx(Ns,{"data-hook":"chat-lite-editor",children:e.jsx(Ke,{value:B.trim(),maxHeight:216,onOpenInEditor:()=>Zt({type:"code",value:B.trim()},!0)})})}),(se||We)&&e.jsxs(Ss,{ref:qt,children:[se&&e.jsx(Qn,{conversationId:s.id,queryText:B.trim()}),We&&e.jsx(Kn,{})]})]}):e.jsxs(Vs,{"data-hook":"chat-blank-state",children:[e.jsx(Zs,{children:"Leverage AI directly in your database"}),e.jsx(qs,{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."})]}),e.jsx(Ki,{ref:je,onSend:f=>P(f,mt),disabled:!m||ue(Y),placeholder:fe(),contextSQL:Qe.queryText,contextTableId:s==null?void 0:s.tableId,contextNotebook:La,onContextClick:pt})]})})})})};export{Ls as default};
|