@deephaven/code-studio 1.14.0 → 1.15.0

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.
Files changed (40) hide show
  1. package/build/assets/{AppRoot-BBYNazf8.js → AppRoot-DE9mL1iQ.js} +6 -6
  2. package/build/assets/{AppRoot-BBYNazf8.js.map → AppRoot-DE9mL1iQ.js.map} +1 -1
  3. package/build/assets/{Chart-BkHpd-bt.js → Chart-Zx7VXoQ6.js} +2 -2
  4. package/build/assets/{Chart-BkHpd-bt.js.map → Chart-Zx7VXoQ6.js.map} +1 -1
  5. package/build/assets/{ControlType-gEY746PA.js → ControlType-ER5vRkTe.js} +4 -4
  6. package/build/assets/{ControlType-gEY746PA.js.map → ControlType-ER5vRkTe.js.map} +1 -1
  7. package/build/assets/{FormatterUtils-CcoN6XuX.js → FormatterUtils-xdeHWykf.js} +2 -2
  8. package/build/assets/{FormatterUtils-CcoN6XuX.js.map → FormatterUtils-xdeHWykf.js.map} +1 -1
  9. package/build/assets/{Grid-c_h7cge1.js → Grid-DVWKN6X6.js} +2 -2
  10. package/build/assets/{Grid-c_h7cge1.js.map → Grid-DVWKN6X6.js.map} +1 -1
  11. package/build/assets/{GridTokenMouseHandler-Bn-YbzXR.js → GridTokenMouseHandler-Bm8zeGiS.js} +2 -2
  12. package/build/assets/{GridTokenMouseHandler-Bn-YbzXR.js.map → GridTokenMouseHandler-Bm8zeGiS.js.map} +1 -1
  13. package/build/assets/{IrisGrid-BnpNxCJL.js → IrisGrid-GUewkavR.js} +2 -2
  14. package/build/assets/{IrisGrid-BnpNxCJL.js.map → IrisGrid-GUewkavR.js.map} +1 -1
  15. package/build/assets/{IrisGridModel-rXy2uf5L.js → IrisGridModel-CkvJzGrf.js} +3 -3
  16. package/build/assets/{IrisGridModel-rXy2uf5L.js.map → IrisGridModel-CkvJzGrf.js.map} +1 -1
  17. package/build/assets/{IrisGridShortcuts-1LuTuXgm.js → IrisGridShortcuts-1GBHnhRv.js} +2 -2
  18. package/build/assets/{IrisGridShortcuts-1LuTuXgm.js.map → IrisGridShortcuts-1GBHnhRv.js.map} +1 -1
  19. package/build/assets/{IrisGridThemeProvider-MK3ns1sp.js → IrisGridThemeProvider-B6qtZfTs.js} +5 -5
  20. package/build/assets/{IrisGridThemeProvider-MK3ns1sp.js.map → IrisGridThemeProvider-B6qtZfTs.js.map} +1 -1
  21. package/build/assets/{LocalWorkspaceStorage-DV42Rl3p.js → LocalWorkspaceStorage-cqkOt1tP.js} +2 -2
  22. package/build/assets/{LocalWorkspaceStorage-DV42Rl3p.js.map → LocalWorkspaceStorage-cqkOt1tP.js.map} +1 -1
  23. package/build/assets/{MarkdownEditor-sWfe2-zt.js → MarkdownEditor-Cxqkba2w.js} +2 -2
  24. package/build/assets/{MarkdownEditor-sWfe2-zt.js.map → MarkdownEditor-Cxqkba2w.js.map} +1 -1
  25. package/build/assets/{MarkdownNotebook-DknNKzBQ.js → MarkdownNotebook-BqGtaNap.js} +2 -2
  26. package/build/assets/{MarkdownNotebook-DknNKzBQ.js.map → MarkdownNotebook-BqGtaNap.js.map} +1 -1
  27. package/build/assets/{MissingPartitionError-CDmleHqN.js → MissingPartitionError-BXSpqiMY.js} +2 -2
  28. package/build/assets/{MissingPartitionError-CDmleHqN.js.map → MissingPartitionError-BXSpqiMY.js.map} +1 -1
  29. package/build/assets/{MockChartModel-BJSRU1UT.js → MockChartModel-CEf8IaJN.js} +2 -2
  30. package/build/assets/{MockChartModel-BJSRU1UT.js.map → MockChartModel-CEf8IaJN.js.map} +1 -1
  31. package/build/assets/{StyleGuideRoot-DC2Vl5OL.js → StyleGuideRoot-DwIVk99V.js} +2 -2
  32. package/build/assets/{StyleGuideRoot-DC2Vl5OL.js.map → StyleGuideRoot-DwIVk99V.js.map} +1 -1
  33. package/build/assets/{index-CBd9EV56.js → index-CLQFKcTg.js} +2 -2
  34. package/build/assets/{index-CBd9EV56.js.map → index-CLQFKcTg.js.map} +1 -1
  35. package/build/assets/{index-D41BRrfd.js → index-D3Hxj4WA.js} +3 -3
  36. package/build/assets/{index-D41BRrfd.js.map → index-D3Hxj4WA.js.map} +1 -1
  37. package/build/assets/{index-Cp-Uv4by.js → index-DkYb-V39.js} +4 -4
  38. package/build/assets/{index-Cp-Uv4by.js.map → index-DkYb-V39.js.map} +1 -1
  39. package/build/index.html +2 -2
  40. package/package.json +8 -8
@@ -1,6 +1,6 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./StyleGuideRoot-DC2Vl5OL.js","./vendor-DiRxarnk.js","./helpers-BosuxZz1.js","./vendor-CawHrWiI.css","./index-D41BRrfd.js","./monaco-DaE0jI-i.js","./monaco-CgHo24-M.css","./index-WCsQ0aAg.css","./IrisGridModel-rXy2uf5L.js","./ControlType-gEY746PA.js","./ControlType-CFrcYBSr.css","./IrisGridModel-CSTdZTzd.css","./MockChartModel-BJSRU1UT.js","./GridTokenMouseHandler-Bn-YbzXR.js","./IrisGridShortcuts-1LuTuXgm.js","./useMergeRef-Cu3dXTMp.js","./IrisGridShortcuts-CJtrNKDP.css","./GridTokenMouseHandler-DTMTgCrk.css","./MockChartModel-pqHtFcsG.css","./Grid-c_h7cge1.js","./Grid-DPUNpG8i.css","./LocalWorkspaceStorage-DV42Rl3p.js","./LocalWorkspaceStorage-Czsna8UP.css","./StyleGuideRoot-BXf6u3u6.css"])))=>i.map(i=>d[i]);
2
- var Ot=Object.defineProperty;var kt=(n,s,e)=>s in n?Ot(n,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[s]=e;var v=(n,s,e)=>kt(n,typeof s!="symbol"?s+"":s,e);import{X as rt,Y as Lt,Z as Pt,r as m,I as a,_ as pe,a0 as it,U as X,a1 as je,K as R,M as E,a2 as At,a3 as ge,a4 as ce,a5 as Oe,a6 as ke,a7 as be,a8 as _t,a9 as Mt,aa as Ut,ab as Kt,H as $t,ac as Gt,ad as Wt,ae as Bt,af as Vt,ag as Ht,ah as Yt,ai as ve,aj as Zt}from"./vendor-DiRxarnk.js";import{_ as zt,W as qt,a as Xt}from"./monaco-DaE0jI-i.js";import{O as de,P as Y,T as L,I as A,D as _,a as W,b as Jt,u as lt,F as Qt,c as F,d as es,g as ts,e as ct,f as ss,h as as,i as ns,j as os,k as dt,l as ht,m as ut,n as mt,o as pt,p as rs,q as ne,S as he,B as w,C as B,r as P,s as Le,t as is,K as ls,v as Me,w as cs,x as ds,y as hs,z as ue,A as us,E as ms,H as Pe,G as Q,J as ps,L as gs,M as fs,R as Ue,N as oe,Q as Se,U as Z,V as bs,W as K,X as me,Y as vs,Z as Ss,_ as ys,$ as gt,a0 as xs,a1 as Ke,a2 as Cs,a3 as Ts,a4 as ws,a5 as js,a6 as Ds,a7 as Es,a8 as Ns,a9 as Fs,aa as ft,ab as bt,ac as j,ad as Rs,ae as Is,af as Os,ag as ks,ah as re,ai as Ls,aj as Ps,ak as As,al as _s,am as Ms,an as Us,ao as Ks,ap as $s,aq as Gs,ar as Ws,as as Bs,at as Vs,au as Hs,av as Ys,aw as Zs,ax as zs,ay as qs,az as Xs,aA as Js,aB as Qs,aC as ea,aD as ta,aE as sa,aF as aa,aG as na,aH as oa,aI as ra,aJ as ia,aK as la}from"./ControlType-gEY746PA.js";import{L as $,v as z,a as ca,M as da,b as ha,c as ua,d as ma,e as ae,f as pa,g as ga,h as fa,m as ba,s as va,l as Sa,i as ya,j as xa,k as Ca,n as Ta,o as wa,p as ja,q as Da,r as Ea,t as Na,u as Fa,w as Ra,x as Ia,y as Oa,z as ka,A as La,B as Pa,C as Aa,D as $e,E as Ge,F as We,G as _a,H as Ma,I as Ua,J as Ka,K as $a,N as vt}from"./index-D41BRrfd.js";import{C as Ga,T as Wa,R as Ba,B as Va,a as Ha,e as Ya,L as St,c as Za,N as V,U as ye,g as za,b as qa,A as Xa,u as Ja,d as Qa,f as en,h as tn,i as sn,l as an,G as nn,j as on,k as Be}from"./LocalWorkspaceStorage-DV42Rl3p.js";import{P as rn,I as yt,S as ln,D as cn}from"./IrisGridShortcuts-1LuTuXgm.js";import"./helpers-BosuxZz1.js";import"./useMergeRef-Cu3dXTMp.js";class Ve{static makeSortConfig(s,e){return{column:s,direction:e}}static makeFilterConfig(s){var e=[],t=[];return s.forEach((o,r)=>{e.push(o),r>0&&t.push(de.and)}),{filterItems:e,filterOperators:t}}static combineFilterConfigs(s,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:de.and;return{filterItems:[...s.filterItems,...e.filterItems],filterOperators:[...s.filterOperators,t,...e.filterOperators]}}static makeFilterItem(s,e,t){return{columnName:s,type:e,value:t}}}function dn(n,s,e){if(n.length>s){var t=n.length-e;return{toKeep:n.slice(t),toPrune:n.slice(0,t)}}return{toKeep:n,toPrune:[]}}function He(n,s){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(n);s&&(t=t.filter(function(o){return Object.getOwnPropertyDescriptor(n,o).enumerable})),e.push.apply(e,t)}return e}function Ye(n){for(var s=1;s<arguments.length;s++){var e=arguments[s]!=null?arguments[s]:{};s%2?He(Object(e),!0).forEach(function(t){I(n,t,e[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):He(Object(e)).forEach(function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(e,t))})}return n}function Ze(n,s,e,t,o,r,i){try{var l=n[r](i),c=l.value}catch(d){return void e(d)}l.done?s(c):Promise.resolve(c).then(t,o)}function M(n){return function(){var s=this,e=arguments;return new Promise(function(t,o){var r=n.apply(s,e);function i(c){Ze(r,t,o,i,l,"next",c)}function l(c){Ze(r,t,o,i,l,"throw",c)}i(void 0)})}}function I(n,s,e){return(s=hn(s))in n?Object.defineProperty(n,s,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[s]=e,n}function hn(n){var s=un(n,"string");return typeof s=="symbol"?s:s+""}function un(n,s){if(typeof n!="object"||!n)return n;var e=n[Symbol.toPrimitive];if(e!==void 0){var t=e.call(n,s);if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(n)}var xe=$.module("PouchStorageTable"),mn="Deephaven.";rt.plugin(Lt);function pn(n,s){switch(n){case L.in:case L.contains:return{$regex:new RegExp("".concat(s)).toString()};case L.inIgnoreCase:return{$regex:new RegExp("".concat(s),"i").toString()};case L.eq:return{$eq:s};case L.notEq:return{$ne:s};case L.greaterThan:return{$gt:s};case L.greaterThanOrEqualTo:return{$gte:s};case L.lessThan:return{$lt:s};case L.lessThanOrEqualTo:return{$lte:s};case L.startsWith:return{$regex:new RegExp("^".concat(s,".*")).toString()};default:throw new Error("Unsupported type: ".concat(n))}}function gn(n){for(var{filterItems:s,filterOperators:e}=n,t=null,o=0;o<s.length;o+=1){var r=s[o],{columnName:i,type:l,value:c}=r,d={[i]:pn(l,c)};if(o===0)t=d;else if(t!==null&&o-1<e.length){var u=e[o-1];if(u===de.and)t={$and:[t,d]};else if(u===de.or)t={$or:[t,d]};else throw new Error("Unexpected filter operator ".concat(u,", ").concat(d))}}if(t==null)throw new Error("Invalid filter config ".concat(n));return t}function Ce(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return{$and:[...n.map(s=>gn(s)),{name:{$gt:null}},{id:{$gt:null}}]}}function fn(n){var s,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return[{id:e?"desc":"asc"},...(s=n==null?void 0:n.map(t=>({[t.column]:t.direction})))!==null&&s!==void 0?s:[]]}class bn{constructor(s,e){I(this,"db",void 0),I(this,"changes",void 0),I(this,"listeners",[]),I(this,"itemListeners",new Map),I(this,"currentSize",0),I(this,"currentViewport",void 0),I(this,"currentReverse",!1),I(this,"currentFilter",null),I(this,"currentSort",null),I(this,"infoUpdatePromise",void 0),I(this,"viewportUpdatePromise",void 0),I(this,"currentViewportData",void 0),this.db=new rt("".concat(mn).concat(s),e),this.db._remote=!1,this.listenForChanges(),this.db.createIndex({index:{fields:["id","name"]}}),this.refreshInfo()}listenForChanges(){this.changes=this.db.changes({live:!0,since:"now",include_docs:!0}).on("change",this.dbUpdate.bind(this))}onUpdate(s){return this.listeners=[...this.listeners,s],()=>{this.listeners=this.listeners.filter(e=>e!==s)}}onItemUpdate(s,e){return this.itemListeners.has(s)||this.itemListeners.set(s,[]),this.itemListeners.set(s,[...this.itemListeners.get(s),e]),this.refreshItem(s),()=>{this.itemListeners.set(s,this.itemListeners.get(s).filter(t=>t!==e))}}close(){this.listeners=[]}get size(){return this.currentSize}get viewport(){return this.currentViewport}setReversed(s){this.currentReverse=s,this.currentViewportData=void 0,this.refreshData()}setViewport(s){this.currentViewport=s,this.refreshInfo(),this.refreshData()}setSorts(s){this.currentSort=s,this.currentViewportData=void 0,this.refreshData()}setFilters(s){this.currentFilter=s,this.currentViewportData=void 0,this.refreshInfo(),this.refreshData()}get data(){return this.currentViewportData}getViewportData(){var s=this;return M(function*(){var e;return s.viewportUpdatePromise||s.refreshData(),(e=s.viewportUpdatePromise)!==null&&e!==void 0?e:Promise.resolve({items:[],offset:0})})()}put(s){var e=this;return M(function*(){var t=Ye(Ye({},s),{},{_id:s.id});return yield e.db.put(t),t})()}sendUpdate(){for(var s,{listeners:e}=this,t=(s=this.currentViewportData)!==null&&s!==void 0?s:{items:[],offset:0},o=0;o<e.length;o+=1)e[o](t)}sendItemUpdate(s){var e=this.itemListeners.get(s.id);if(e!==void 0)for(var t=0;t<e.length;t+=1)e[t](s)}dbUpdate(s){xe.debug("Update received",s),this.refreshInfo(),s.doc!==void 0&&this.sendItemUpdate(s.doc),this.refreshData()}fetchInfo(s){var e=this;return M(function*(){return e.db.find({selector:s,fields:[]})})()}refreshInfo(){var s=this;return M(function*(){try{var e,t;(e=s.infoUpdatePromise)===null||e===void 0||e.cancel(),s.infoUpdatePromise=Y.makeCancelable(s.fetchInfo(Ce((t=s.currentFilter)!==null&&t!==void 0?t:[])));var o=yield s.infoUpdatePromise;s.currentSize=o.docs.length,s.sendUpdate()}catch(r){if(!Y.isCanceled(r))throw xe.error("Unable to refreshInfo",r),r}})()}fetchViewportData(s,e,t){var o=this;return M(function*(){return o.db.find({selector:e,skip:s.top,limit:s.bottom-s.top+1,sort:t,fields:["id","name"]}).then(r=>({items:r.docs,offset:s.top}))})()}refreshData(){var s=this;return M(function*(){if(s.currentViewport)try{var e,t,o=Ce((e=s.currentFilter)!==null&&e!==void 0?e:[]),r=fn(s.currentSort,s.currentReverse);(t=s.viewportUpdatePromise)===null||t===void 0||t.cancel(),s.viewportUpdatePromise=Y.makeCancelable(s.fetchViewportData(s.currentViewport,o,r));var i=yield s.viewportUpdatePromise;return s.currentViewportData=i,s.sendUpdate(),i}catch(l){if(!Y.isCanceled(l))throw xe.error("Unable to refreshData",l),l}})()}refreshItem(s){var e=this;return M(function*(){var t=yield e.db.find({selector:{id:s},limit:1}),o=t.docs[0];return o!==void 0&&e.sendItemUpdate(o),o})()}getSnapshot(s){var e=this;return M(function*(){var t=new Map,o=[{id:e.currentReverse?"desc":"asc"}];return yield Promise.all(s.map(function(){var r=M(function*(i){var l,[c,d]=i,u=d-c+1;return e.db.find({selector:Ce((l=e.currentFilter)!==null&&l!==void 0?l:[]),skip:c,limit:u,sort:o,fields:["id","name"]}).then(h=>{for(var p=0;p<u;p+=1){var D=c+p;t.set(D,h.docs[p])}})});return function(i){return r.apply(this,arguments)}}())),t})()}}function ze(n,s){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(n);s&&(t=t.filter(function(o){return Object.getOwnPropertyDescriptor(n,o).enumerable})),e.push.apply(e,t)}return e}function ie(n){for(var s=1;s<arguments.length;s++){var e=arguments[s]!=null?arguments[s]:{};s%2?ze(Object(e),!0).forEach(function(t){xt(n,t,e[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):ze(Object(e)).forEach(function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(e,t))})}return n}function qe(n,s,e,t,o,r,i){try{var l=n[r](i),c=l.value}catch(d){return void e(d)}l.done?s(c):Promise.resolve(c).then(t,o)}function J(n){return function(){var s=this,e=arguments;return new Promise(function(t,o){var r=n.apply(s,e);function i(c){qe(r,t,o,i,l,"next",c)}function l(c){qe(r,t,o,i,l,"throw",c)}i(void 0)})}}function xt(n,s,e){return(s=vn(s))in n?Object.defineProperty(n,s,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[s]=e,n}function vn(n){var s=Sn(n,"string");return typeof s=="symbol"?s:s+""}function Sn(n,s){if(typeof n!="object"||!n)return n;var e=n[Symbol.toPrimitive];if(e!==void 0){var t=e.call(n,s);if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(n)}var yn=2500,xn=2e3,O=$.module("PouchCommandHistoryTable");class Xe extends bn{constructor(s,e){var t;super("CommandHistoryStorage.".concat(s),{auto_compaction:!0,revs_limit:1}),xt(this,"searchText",void 0),this.cache=e,this.cache.tableRegistry.has(this.cacheKey)||this.cache.tableRegistry.set(this.cacheKey,new Set),O.debug("Adding table to registry",this.cacheKey),(t=this.cache.tableRegistry.get(this.cacheKey))===null||t===void 0||t.add(this)}get cacheKey(){return this.db.name}setSearch(s){O.debug("Setting search filters",s),this.searchText=s.trim().toLowerCase(),this.setFilters(s?[Ve.makeFilterConfig([Ve.makeFilterItem("name",L.contains,s)])]:[])}dbUpdate(s){O.debug("Clearing cache and refreshing data",s),this.cache.response.delete(this.cacheKey),super.dbUpdate(s)}fetchData(s){var e=this;return J(function*(){return Y.withTimeout(0,J(function*(){e.cache.response.has(e.cacheKey)?O.debug("Fetching from cache",e.searchText,e.viewport):(O.debug("Fetching from PouchDB",e.searchText,e.viewport),e.cache.response.set(e.cacheKey,e.db.allDocs({include_docs:!0}).then(o=>{var r=o.rows.map(c=>c.doc).filter(c=>{var{name:d}=c;return d});O.debug("Fetched ".concat(r.length," command history items"));var{toKeep:i,toPrune:l}=dn(r,yn,xn);return l.length&&e.pruneItems(l),{docs:i}})));var t=e.cache.response.get(e.cacheKey);return e.searchText==null||e.searchText===""?t:ie(ie({},t),{},{docs:(yield t).docs.filter(o=>{var{name:r}=o;return r.toLowerCase().includes(e.searchText)})})}))})()}fetchInfo(s){var e=this;return J(function*(){return e.fetchData(s)})()}fetchViewportData(s,e,t){var o=this;return J(function*(){var r=yield o.fetchData(e);O.debug("Fetching viewport data",s.top,s.bottom+1,t,r);var i=typeof t[0]=="object"&&t[0].id==="desc",l=i?r.docs.slice(0).reverse():r.docs,c=l.slice(s.top,s.bottom+1);return{items:c,offset:s.top}})()}pruneItems(s){var e=this;return J(function*(){if(e.cache.isPruning.get(e.cacheKey)===!0){O.debug("Pruning already in progress. Skipping.");return}try{O.debug("Pruning ".concat(s.length," command history items"));var t=e.cache.pauseChangeListeners(e.cacheKey);e.cache.isPruning.set(e.cacheKey,!0),yield e.db.bulkDocs(s.map(o=>ie(ie({},o),{},{_deleted:!0}))),e.cache.isPruning.set(e.cacheKey,!1),t(),O.debug("Finished pruning command history items")}catch(o){O.error("An error occurred while pruning db",o)}})()}close(){var s,e,t;O.debug("Closing table",this,(s=this.cache.tableRegistry.get(this.cacheKey))===null||s===void 0?void 0:s.size),(e=this.cache.tableRegistry.get(this.cacheKey))===null||e===void 0||e.delete(this),(t=this.changes)===null||t===void 0||t.cancel(),super.close()}}function Te(n,s,e){return(s=Cn(s))in n?Object.defineProperty(n,s,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[s]=e,n}function Cn(n){var s=Tn(n,"string");return typeof s=="symbol"?s:s+""}function Tn(n,s){if(typeof n!="object"||!n)return n;var e=n[Symbol.toPrimitive];if(e!==void 0){var t=e.call(n,s);if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(n)}var Je=$.module("PouchCommandHistoryCache");class wn{constructor(){Te(this,"isPruning",void 0),Te(this,"response",void 0),Te(this,"tableRegistry",void 0),this.isPruning=new Map,this.response=new Map,this.tableRegistry=new Map}pauseChangeListeners(s){var e,t=[];return(e=this.tableRegistry.get(s))===null||e===void 0||e.forEach(o=>{o.changes&&(Je.debug("Pausing event listeners on '".concat(s,"' table"),o),o.changes.cancel(),t.push(o))}),()=>{t.forEach(o=>{var r,i;(r=(i=this.tableRegistry.get(s))===null||i===void 0?void 0:i.has(o))!==null&&r!==void 0&&r&&(Je.debug("Resuming event listeners on '".concat(s,"' table"),o),o.listenForChanges())})}}}function Qe(n,s){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(n);s&&(t=t.filter(function(o){return Object.getOwnPropertyDescriptor(n,o).enumerable})),e.push.apply(e,t)}return e}function et(n){for(var s=1;s<arguments.length;s++){var e=arguments[s]!=null?arguments[s]:{};s%2?Qe(Object(e),!0).forEach(function(t){De(n,t,e[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):Qe(Object(e)).forEach(function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(e,t))})}return n}function tt(n,s,e,t,o,r,i){try{var l=n[r](i),c=l.value}catch(d){return void e(d)}l.done?s(c):Promise.resolve(c).then(t,o)}function we(n){return function(){var s=this,e=arguments;return new Promise(function(t,o){var r=n.apply(s,e);function i(c){tt(r,t,o,i,l,"next",c)}function l(c){tt(r,t,o,i,l,"throw",c)}i(void 0)})}}function De(n,s,e){return(s=jn(s))in n?Object.defineProperty(n,s,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[s]=e,n}function jn(n){var s=Dn(n,"string");return typeof s=="symbol"?s:s+""}function Dn(n,s){if(typeof n!="object"||!n)return n;var e=n[Symbol.toPrimitive];if(e!==void 0){var t=e.call(n,s);if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(n)}var st=$.module("PouchCommandHistoryStorage");class En{constructor(){De(this,"cache",new wn),De(this,"updateTableMap",new Map)}getUpdateTable(s){return this.updateTableMap.has(s)||this.updateTableMap.set(s,new Xe(s,this.cache)),this.updateTableMap.get(s)}getTable(s){var e=this;return we(function*(){return new Xe(s,e.cache)})()}addItem(s,e,t,o){var r=this;return we(function*(){return r.updateItem(s,{id:"".concat(new Date().getTime()),name:t,data:o})})()}updateItem(s,e){var t=this;return we(function*(){var o=t.getUpdateTable(s),r=yield o.refreshItem(e.id),i=et(et({},r??{}),e);return st.debug("Updating item",i),yield o.put(i),st.debug("Update saved"),e})()}listenItem(s,e,t){var o=this.getUpdateTable(s);return o.onItemUpdate(e,t)}}const Ct="SET_LAYOUT_STORAGE",Nn=n=>({type:Ct,payload:n});var{dh:Fn}=globalThis;const Rn=$.module("SettingsUtils");function In(n){return n.formatString!=null}function Tt(n){const s=Pt.parse(window.navigator.userAgent),e=`${s.browser.name??""} ${Number(parseFloat(s.browser.version??""))||""}`,t=`${s.os.name??""} ${s.os.version??""}`,o=n.get("python.version")??"";return{"Engine Version":n.get("deephaven.version")??"Unknown","Web UI Version":"1.14.0",...o!==""?{"Python Version":o}:{},"Java Version":n.get("java.version")??"Unknown","Groovy Version":n.get("groovy.version")??"Unknown","Barrage Version":n.get("barrage.version")??"Unknown","Browser Name":e.trim()||"Unknown","User Agent OS":t.trim()||"Unknown"}}function Ee(n){return Array.from(n.entries()).filter(s=>s[1].version!==void 0).reduce((s,[e,t])=>({...s,[e]:t.version}),{})}function Ne(n){const s=n==null?void 0:n.querySelector("input, select, textarea");s&&s.focus()}function wt(n,s){return n.defaultFormatString===s.defaultFormatString}function On(n,s){return wt(n,s)}function kn(n,s){return wt(n,s)}function jt(n){return n!==""&&Jt.isValidColumnName(n)}function q(n,s,e){if(!s||e.formatString==null||!In(e))return!1;switch(s){case"datetime":return W.isValid(n,e);case"decimal":return _.isValid(n,e);case"int":return A.isValid(n,e);default:return Rn.warn("Trying to validate format of unknown type"),!0}}function Ln(n){const{id:s,isNewRule:e,...t}=n;return t}function Pn(n,s){return jt(s.columnName)&&q(n,s.columnType,s.format)}function Dt(n){const{timestamp:s,timeZone:e,showTimeZone:t,showTSeparator:o,isGlobalOptions:r,legacyGlobalFormat:i}=n,l=lt(),c=m.useMemo(()=>new Qt(l,[],{timeZone:e,showTimeZone:t,showTSeparator:o}),[l,t,o,e]),d=r?W.getGlobalFormats(t,o):W.getFormats(t,o);return i!=null&&!d.includes(i)&&d.unshift(i),a.jsx(a.Fragment,{children:d.map(u=>{const h=W.makeFormat("",u,W.TYPE_GLOBAL);return a.jsx("option",{value:u,"data-testid":"time-format",children:c.getFormattedString(s,F.dataType.DATETIME,"",h)},u)})})}function An(){return a.jsx(a.Fragment,{children:es.TIME_ZONES.map(n=>{const{label:s,value:e}=n;return a.jsx("option",{value:e,children:s},e)})})}const G=$.module("FormattingSectionContent"),te=class te extends m.PureComponent{constructor(e){super(e);v(this,"debouncedCommitChanges");v(this,"pendingUpdates");v(this,"containerRef");v(this,"getCachedDateTimeFormatOptions",je((e,t,o,r=!1,i)=>{const{timestampAtMenuOpen:l}=this.state;return a.jsx(Dt,{timestamp:l,timeZone:e,showTimeZone:t,showTSeparator:o,isGlobalOptions:r,legacyGlobalFormat:i})},{max:100}));this.debouncedCommitChanges=it(this.commitChanges.bind(this),te.inputDebounceTime),this.queueUpdate=this.queueUpdate.bind(this),this.handleDefaultDateTimeFormatChange=this.handleDefaultDateTimeFormatChange.bind(this),this.handleDefaultDecimalFormatChange=this.handleDefaultDecimalFormatChange.bind(this),this.handleDefaultIntegerFormatChange=this.handleDefaultIntegerFormatChange.bind(this),this.handleShowTimeZoneChange=this.handleShowTimeZoneChange.bind(this),this.handleShowTSeparatorChange=this.handleShowTSeparatorChange.bind(this),this.handleTimeZoneChange=this.handleTimeZoneChange.bind(this),this.handleResetDateTimeFormat=this.handleResetDateTimeFormat.bind(this),this.handleResetDecimalFormat=this.handleResetDecimalFormat.bind(this),this.handleResetIntegerFormat=this.handleResetIntegerFormat.bind(this),this.handleResetTimeZone=this.handleResetTimeZone.bind(this),this.handleTruncateNumbersWithPoundChange=this.handleTruncateNumbersWithPoundChange.bind(this),this.handleShowEmptyStringsChange=this.handleShowEmptyStringsChange.bind(this),this.handleShowNullStringsChange=this.handleShowNullStringsChange.bind(this),this.handleShowExtraGroupColumnChange=this.handleShowExtraGroupColumnChange.bind(this);const{defaultDateTimeFormat:t,defaultDecimalFormatOptions:o,defaultIntegerFormatOptions:r,showTimeZone:i,showTSeparator:l,timeZone:c,truncateNumbersWithPound:d,showEmptyStrings:u,showNullStrings:h,showExtraGroupColumn:p}=e;this.containerRef=X.createRef(),this.pendingUpdates=[],this.state={showTimeZone:i,showTSeparator:l,timeZone:c,defaultDateTimeFormat:t,defaultDecimalFormatOptions:o,defaultIntegerFormatOptions:r,truncateNumbersWithPound:d,showEmptyStrings:u,showNullStrings:h,showExtraGroupColumn:p,timestampAtMenuOpen:new Date}}componentDidMount(){Ne(this.containerRef.current)}componentWillUnmount(){this.debouncedCommitChanges.flush()}queueUpdate(e){this.pendingUpdates.push(e),this.debouncedCommitChanges()}handleDefaultDateTimeFormatChange(e){G.debug("handleDefaultDateTimeFormatChange",e);const t={defaultDateTimeFormat:e};this.setState(t),this.queueUpdate(t)}handleDefaultDecimalFormatChange(e){G.debug("handleDefaultDecimalFormatChange",e.target.value);const t={defaultDecimalFormatOptions:{defaultFormatString:e.target.value}};this.setState(t),q(dh,F.dataType.DECIMAL,_.makeCustomFormat(e.target.value))&&this.queueUpdate(t)}handleDefaultIntegerFormatChange(e){G.debug("handleDefaultIntegerFormatChange",e.target.value);const t={defaultIntegerFormatOptions:{defaultFormatString:e.target.value}};this.setState(t),q(dh,F.dataType.INT,A.makeCustomFormat(e.target.value))&&this.queueUpdate(t)}handleShowTimeZoneChange(){const{showTimeZone:e}=this.state,t={showTimeZone:!e};this.setState(t),this.queueUpdate(t)}handleShowTSeparatorChange(){const{showTSeparator:e}=this.state,t={showTSeparator:!e};this.setState(t),this.queueUpdate(t)}handleTimeZoneChange(e){const t={timeZone:e};this.setState(t),this.queueUpdate(t)}handleResetDateTimeFormat(){const{defaults:e}=this.props,{defaultDateTimeFormat:t,showTimeZone:o,showTSeparator:r}=e;G.debug("handleResetDateTimeFormat"),this.setState({defaultDateTimeFormat:t,showTimeZone:o,showTSeparator:r}),this.queueUpdate({defaultDateTimeFormat:void 0,showTimeZone:void 0,showTSeparator:void 0})}handleResetTimeZone(){const{defaults:e}=this.props,{timeZone:t}=e;G.debug("handleResetTimeZone"),this.setState({timeZone:t}),this.queueUpdate({timeZone:void 0})}handleResetDecimalFormat(){const{defaults:e}=this.props,{defaultDecimalFormatOptions:t}=e;G.debug("handleResetDecimalFormat"),this.setState({defaultDecimalFormatOptions:t}),this.queueUpdate({defaultDecimalFormatOptions:void 0})}handleResetIntegerFormat(){const{defaults:e}=this.props,{defaultIntegerFormatOptions:t}=e;G.debug("handleResetIntegerFormat"),this.setState({defaultIntegerFormatOptions:t}),this.queueUpdate({defaultIntegerFormatOptions:void 0})}handleTruncateNumbersWithPoundChange(){const{truncateNumbersWithPound:e}=this.state,t={truncateNumbersWithPound:e!==!0};this.setState(t),this.queueUpdate(t)}handleShowEmptyStringsChange(){const{showEmptyStrings:e}=this.state,t={showEmptyStrings:!e};this.setState(t),this.queueUpdate(t)}handleShowNullStringsChange(){const{showNullStrings:e}=this.state,t={showNullStrings:!e};this.setState(t),this.queueUpdate(t)}handleShowExtraGroupColumnChange(){const{showExtraGroupColumn:e}=this.state,t={showExtraGroupColumn:!e};this.setState(t),this.queueUpdate(t)}commitChanges(){const{updateSettings:e}=this.props,t=this.pendingUpdates.reduce((o,r)=>({...o,...r}),{});this.pendingUpdates=[],e(t)}render(){const{defaults:e,dh:t}=this.props,{defaultDateTimeFormat:o,defaultDecimalFormatOptions:r,defaultIntegerFormatOptions:i,timeZone:l,showTimeZone:c,showTSeparator:d,truncateNumbersWithPound:u,showEmptyStrings:h,showNullStrings:p,showExtraGroupColumn:D}=this.state,{defaultFormatString:y=_.DEFAULT_FORMAT_STRING}=r??{},{defaultFormatString:f=A.DEFAULT_FORMAT_STRING}=i??{},g=l===e.timeZone,k=d===e.showTSeparator&&c===e.showTimeZone&&o===e.defaultDateTimeFormat,C=On(r,e.defaultDecimalFormatOptions),T=kn(i,e.defaultIntegerFormatOptions);return a.jsx("div",{className:"app-settings-formatting-section",ref:this.containerRef,children:a.jsxs("div",{className:"container-fluid p-0",children:[a.jsx("div",{className:"app-settings-menu-description mb-3",children:"Choose the default formatting rule to apply to all table columns based on their type."}),a.jsxs("div",{className:"form-row mb-2",children:[a.jsx("label",{className:"col-form-label col-3",htmlFor:"select-reset-timezone",children:"Time zone"}),a.jsx("div",{className:"col pr-0",children:a.jsx(he,{className:"custom-select",value:l,onChange:this.handleTimeZoneChange,id:"select-reset-timezone",children:a.jsx(An,{})})}),a.jsx("div",{className:"col-1 btn-col",children:a.jsx(w,{kind:"ghost",icon:z,onClick:this.handleResetTimeZone,tooltip:"Reset Time Zone",className:R("btn-reset","btn-reset-time-zone",{hidden:g})})})]}),a.jsxs("div",{className:"form-row mb-2",children:[a.jsx("label",{className:"col-form-label col-3",htmlFor:"select-default-time-format",children:"DateTime"}),a.jsx("div",{className:"col pr-0",children:a.jsx(he,{className:"custom-select",value:o,onChange:this.handleDefaultDateTimeFormatChange,id:"select-default-time-format",children:this.getCachedDateTimeFormatOptions(l,c,d,!0,o)})}),a.jsx("div",{className:"col-1 btn-col",children:a.jsx(w,{kind:"ghost",icon:z,onClick:this.handleResetDateTimeFormat,tooltip:"Reset DateTime Options",className:R("btn-reset","btn-reset-date-time",{hidden:k})})})]}),a.jsx("div",{className:"form-row",children:a.jsx("div",{className:"offset-3 col-9",children:a.jsx(B,{checked:c??null,onChange:this.handleShowTimeZoneChange,children:"Show time zone in dates"})})}),a.jsx("div",{className:"form-row mb-3",children:a.jsx("div",{className:"offset-3 col-9",children:a.jsx(B,{checked:d??null,onChange:this.handleShowTSeparatorChange,children:"Show 'T' separator"})})}),a.jsxs("div",{className:"form-row mb-2",children:[a.jsx("label",{className:"col-form-label col-3",htmlFor:"default-decimal-format-input",children:"Decimal"}),a.jsx("div",{className:"col pr-0",children:a.jsx("input",{className:R("form-control","flex-grow-1","default-decimal-format-input",{"is-invalid":!q(t,F.dataType.DECIMAL,_.makeCustomFormat(y))}),"data-lpignore":!0,placeholder:_.DEFAULT_FORMAT_STRING,type:"text",id:"default-decimal-format-input",value:y,onChange:this.handleDefaultDecimalFormatChange})}),a.jsx("div",{className:"col-1 btn-col",children:a.jsx(w,{kind:"ghost",icon:z,onClick:this.handleResetDecimalFormat,tooltip:"Reset Decimal Formatting",className:R("btn-reset","btn-reset-decimal",{hidden:C}),"data-testid":"btn-reset-decimal"})})]}),a.jsxs("div",{className:"form-row mb-2",children:[a.jsx("label",{className:"col-form-label col-3",htmlFor:"default-integer-format-input",children:"Integer"}),a.jsx("div",{className:"col pr-0",children:a.jsx("input",{className:R("form-control","flex-grow-1","default-integer-format-input",{"is-invalid":!q(t,F.dataType.INT,A.makeCustomFormat(f))}),"data-lpignore":!0,placeholder:A.DEFAULT_FORMAT_STRING,type:"text",id:"default-integer-format-input",value:f,onChange:this.handleDefaultIntegerFormatChange})}),a.jsx("div",{className:"col-1 btn-col",children:a.jsx(w,{kind:"ghost",icon:z,onClick:this.handleResetIntegerFormat,tooltip:"Reset Integer Formatting",className:R("btn-reset","btn-reset-integer",{hidden:T}),"data-testid":"btn-reset-integer"})})]}),a.jsx("div",{className:"form-row mb-2",children:a.jsx("div",{className:"offset-3 col-9",children:a.jsx(B,{checked:u??null,onChange:this.handleTruncateNumbersWithPoundChange,children:"Show truncated numbers as ###"})})}),a.jsxs("div",{className:"form-row mb-3",children:[a.jsx("label",{className:"col-form-label col-3",htmlFor:"default-integer-format-input",children:"String"}),a.jsxs("div",{className:"col pr-0 pt-2",children:[a.jsxs(B,{checked:h??null,onChange:this.handleShowEmptyStringsChange,children:["Show empty strings as"," ",a.jsx("span",{className:"font-italic text-muted",children:"empty"})]}),a.jsxs(B,{checked:p??null,onChange:this.handleShowNullStringsChange,children:["Show null strings as"," ",a.jsx("span",{className:"font-italic text-muted",children:"null"})]})]})]}),a.jsxs("div",{className:"form-row mb-3",id:"show_extra_group_column_div",children:[a.jsx("label",{className:"col-form-label col-3",htmlFor:"default-show-extra-group-column",children:"Rollup"}),a.jsx("div",{className:"col pr-0 pt-2",id:"default-show-extra-group-column",children:a.jsx(B,{checked:D,onChange:this.handleShowExtraGroupColumnChange,children:'Show extra "group" column'})})]})]})})}};v(te,"defaultProps",{scrollTo:()=>{}}),v(te,"inputDebounceTime",250);let Fe=te;const _n=n=>({defaultDateTimeFormat:rs(n),defaultDecimalFormatOptions:pt(n),defaultIntegerFormatOptions:mt(n),dh:ut(n),showTimeZone:ht(n),showTSeparator:dt(n),truncateNumbersWithPound:os(n),showEmptyStrings:ns(n),showNullStrings:as(n),showExtraGroupColumn:ss(n),timeZone:ct(n),defaults:ts(n)}),Mn=pe(_n,{updateSettings:ne})(Fe);function Un(){const[n,s]=m.useState(!1),e=()=>{s(!n)};return a.jsxs(a.Fragment,{children:[a.jsx(w,{kind:"ghost",onClick:e,icon:ca,children:"Legal Notices"}),a.jsxs(da,{isOpen:n,toggle:e,children:[a.jsx(ha,{toggle:e,children:"Legal Notice"}),a.jsxs(ua,{children:[a.jsx("p",{children:"Deephaven software is protected by U.S. Patent Nos. 9,612,959; 9,613,018; 9,613,109; 9,619,210; 9,633,060; 9,639,570; 9,672,238; 9,679,006; 9,690,821; 9,710,511; 9,760,591; 9,805,084; 9,836,494; 9,836,495; 9,886,469; 9,898,496; 9,934,266; 10,002,153; 10,002,154; 10,002,155; 10,003,673; 10,019,138; 10,069,943; 10,176,211; 10,198,465; 10,198,466; 10,198,469; 10,212,257; 10,241,960; 10,241,965; 10,242,040; 10,242,041; 10,346,394; 10,353,893; 10,452,649; 10,496,639; 10,540,351; 10,552,412; 10,565,194; 10,565,206; 10,572,474; 10,621,168; 10,642,829; 10,657,184; 10,678,787; 10,691,686; 10,783,191; 10,866,943; 10,909,183; 10,915,526; 10,922,311; 10,929,394; 11,023,462; 11,126,662; 11,151,133; 11,238,036; 11,249,994; 11,263,211; 11,449,557; 11,514,037; 11,556,528; and 11,574,018. Other patents pending."}),a.jsxs("p",{children:["© 2016-",new Date().getFullYear()," Deephaven Data Labs LLC. Patent Pending."]})]})]})]})}function H(n){const{children:s,isExpanded:e,sectionKey:t,title:o,onToggle:r}=n;return a.jsxs(a.Fragment,{children:[a.jsx("div",{children:a.jsxs(w,{kind:"ghost",className:"btn-collapse-trigger",onClick:()=>r(t),children:[a.jsx("div",{className:"d-flex align-items-center flex-grow-1",children:o}),a.jsx("div",{className:"flex-shrink-0",children:a.jsx(E,{transform:e?"flip-v":"",icon:ma})})]})}),a.jsx(Ga,{in:e,autoFocusOnShow:!0,children:s})]})}function Kn({shortcut:n,displayText:s,categoryName:e,onChange:t}){const[o,r]=m.useState(s),[i,l]=m.useState(n.getKeyState()),[c,d]=m.useState(!1),[u,h]=m.useState("");m.useEffect(function(){r(s),l(n.getKeyState())},[s,n]),m.useEffect(function(){r(P.getDisplayText(i)),n.matchesKeyState(i)&&d(!1)},[i,n]),m.useEffect(function(){if(c){if(!P.isValidKeyState(i)){P.isAllowedKey(i.keyValue)?h("Must contain a modifier key"):h("Must contain an allowed action key");return}const b=Le.getConflictingShortcuts(i).filter(S=>S.id.startsWith(e)&&S!==n).map(S=>S.name);if(b.length){h(`Conflicts with ${b.join(", ")}`);return}h("")}else h("")},[c,i,e,n]);function p(T){if(T.stopPropagation(),T.preventDefault(),n.isEditable&&!T.repeat){const b=P.getKeyStateFromEvent(T),S=P.createKeyState([ls.BACKSPACE]);P.doKeyStatesMatch(b,S)?l(P.NULL_KEY_STATE):l(b)}}function D(T){T.stopPropagation(),T.preventDefault(),n.matchesKeyState(i)||d(!0)}function y(){Me.disableAllActions()}function f(){Me.enableAllActions()}function g(){n.setKeyState(i),d(!1),t(n)}function k(){const T=n.getKeyState();l(T),d(!1)}function C(){d(!0),l(n.getDefaultKeyState())}return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"shortcut-item-container",children:[a.jsxs("label",{className:"shortcut-item-name",children:[n.name,n.tooltip!==void 0&&a.jsx(is,{children:n.tooltip})]}),a.jsxs("div",{className:"shortcut-item-input-container",children:[a.jsx("input",{className:R("form-control",{"is-invalid":u}),onKeyDown:p,onKeyUp:D,onFocus:y,onBlur:f,disabled:!n.isEditable,value:o,readOnly:!0}),!P.doKeyStatesMatch(i,n.getDefaultKeyState())&&!u&&a.jsx(w,{className:"reset-to-default-button",kind:"ghost",icon:a.jsx(E,{icon:z,transform:{rotate:90,flipX:!0}}),tooltip:"Reset to default",onClick:C})]})]}),c&&a.jsxs("div",{className:R("shortcut-item-message-container",{"is-invalid":u}),children:[a.jsx("div",{className:"shortcut-item-message",children:u}),a.jsxs("div",{className:"shortcut-item-message-buttons",children:[P.isValidKeyState(i)&&a.jsx(w,{kind:"ghost",onClick:g,children:"Confirm"}),a.jsx(w,{kind:"ghost",onClick:k,children:"Undo"})]})]})]})}function $n({shortcutOverrides:n={},updateSettings:s}){const e=m.useCallback(i=>{const l=P.isMacPlatform,c={mac:{...n.mac},windows:{...n.windows}},d=l?c.mac:c.windows;i.forEach(u=>{u.isDefault()?delete d[u.id]:d[u.id]=u.getKeyState()}),s({shortcutOverrides:c})},[s,n]);let t=Array.from(Le.shortcutsByCategory.entries()).map(([i,l])=>({name:i,shortcuts:l}));const o=t.findIndex(i=>i.name.toUpperCase()==="GLOBAL"),r=t.splice(o,1);return t=t.concat(r),a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"app-settings-menu-description",children:"Customize shortcuts below. To prevent unexpected results, avoid conflicting shortcuts with the browser or IDE editor."}),t.map(i=>a.jsx(Gn,{name:i.name,shortcuts:i.shortcuts,saveShortcutOverrides:e},i.name))]})}function Gn({name:n,shortcuts:s,saveShortcutOverrides:e}){function t(c){return c.split("_").map(d=>`${d[0].toUpperCase()}${d.slice(1).toLowerCase()}`).join(" ")}const[o,r]=m.useState(s);function i(c){const d=o.filter(h=>h!==c&&!h.isNull()&&h.matchesKeyState(c.getKeyState()));d.forEach(h=>h.setToNull());const u=[c,...d];e(u),r(h=>[...h])}const l=m.useMemo(()=>o.map(c=>c.getDisplayText()),[o]);return a.jsxs("div",{className:"mt-3",children:[a.jsx("div",{className:"font-weight-bold",children:t(n)}),o.map((c,d)=>a.jsx(Kn,{shortcut:c,displayText:l[d],categoryName:n,onChange:i},c.id))]})}const Wn=n=>({shortcutOverrides:cs(n)}),Bn={updateSettings:ne},Vn=pe(Wn,Bn)($n),Hn=[{value:F.dataType.DATETIME,label:"DateTime"},{value:F.dataType.DECIMAL,label:"Decimal"},{value:F.dataType.INT,label:"Integer"}];function Yn(){const n=Hn.map(s=>a.jsx("option",{value:s.value,children:s.label},`key-columnType-${s.value}`));return a.jsxs(a.Fragment,{children:[a.jsx("option",{disabled:!0,value:"",children:"Select Type"},"key-columnType-placeholder"),n]})}const se=class se extends m.PureComponent{constructor(e){super(e);v(this,"debouncedCommitChanges");v(this,"containerRef");v(this,"addFormatRuleButtonRef");v(this,"lastFormatRuleIndex");v(this,"getCachedColumnTypeOptions",je(()=>a.jsx(Yn,{}),{max:100}));v(this,"getCachedDateTimeFormatOptions",je((e,t,o,r=!1,i)=>{const{timestampAtMenuOpen:l}=this.state;return a.jsx(Dt,{timestamp:l,timeZone:e,showTimeZone:t,showTSeparator:o,isGlobalOptions:r,legacyGlobalFormat:i})},{max:100}));this.debouncedCommitChanges=it(this.commitChanges.bind(this),se.inputDebounceTime),this.handleFormatRuleEntered=this.handleFormatRuleEntered.bind(this),this.handleFormatRuleChange=this.handleFormatRuleChange.bind(this),this.handleFormatRuleCreate=this.handleFormatRuleCreate.bind(this),this.handleFormatRuleDelete=this.handleFormatRuleDelete.bind(this);const{formatter:t,showTimeZone:o,showTSeparator:r,timeZone:i}=e,l=t.map((c,d)=>({...c,id:d}));this.containerRef=X.createRef(),this.addFormatRuleButtonRef=X.createRef(),this.lastFormatRuleIndex=l.length,this.state={formatSettings:l,formatRulesChanged:!1,showTimeZone:o,showTSeparator:r,timeZone:i,timestampAtMenuOpen:new Date}}componentDidMount(){Ne(this.containerRef.current)}componentWillUnmount(){this.debouncedCommitChanges.flush()}isDuplicateRule(e){const{formatSettings:t}=this.state;return t.some(o=>o.id!==e.id&&o.columnName===e.columnName&&o.columnType===e.columnType)??!1}getAutoIncrementFormatRuleIndex(){const{lastFormatRuleIndex:e}=this;return this.lastFormatRuleIndex+=1,e}handleFormatRuleChange(e,t,o){this.setState(r=>{const{formatSettings:i}=r;ae(i);const l=[...i];let c={};t==="columnType"&&(c={format:this.makeDefaultFormatterItemByType(o)});const d={...l[e],...c,[t]:o};return l[e]=d,{formatSettings:l}},()=>{this.debouncedCommitChanges()})}handleFormatRuleCreate(){this.setState(e=>{const{formatSettings:t}=e,o={columnType:F.dataType.DATETIME,columnName:"",format:{},id:this.getAutoIncrementFormatRuleIndex(),isNewRule:!0};return{formatSettings:[...t,o],formatRulesChanged:!0}})}handleFormatRuleDelete(e){this.setState(t=>{const{formatSettings:o}=t;return{formatSettings:o.filter((i,l)=>l!==e),formatRulesChanged:!0}},()=>{this.debouncedCommitChanges()})}handleFormatRuleEntered(e){this.scrollToFormatBlockBottom(),Ne(e)}commitChanges(){const{formatSettings:e}=this.state,{dh:t}=this.props,o=e.filter(l=>Pn(t,l)).map(Ln)??[],{updateSettings:r}=this.props;r({formatter:o})}scrollToFormatBlockBottom(){var t,o;const{scrollTo:e}=this.props;e(0,(((t=this.addFormatRuleButtonRef.current)==null?void 0:t.offsetHeight)??0)+(((o=this.addFormatRuleButtonRef.current)==null?void 0:o.offsetTop)??0))}getRuleError(e){const{dh:t}=this.props,o={hasColumnNameError:!1,hasFormatError:!1,message:""},r=[];return e.isNewRule!==void 0&&e.isNewRule||(this.isDuplicateRule(e)&&(o.hasColumnNameError=!0,r.push("Duplicate column name/type combo.")),jt(e.columnName)||(o.hasColumnNameError=!0,r.push("Column names must start with a letter or underscore and contain only alphanumeric characters or underscores.")),e.format.formatString!=null&&e.format.formatString.length===0?(o.hasFormatError=!0,r.push("Empty formatting rule.")):q(t,e.columnType,e.format)||(o.hasFormatError=!0,r.push("Invalid formatting rule.")),o.message=r.join(`
3
- `)),o}makeDefaultFormatterItemByType(e){switch(F.getNormalizedType(e)){case F.dataType.INT:{const{defaultIntegerFormatOptions:t}=this.props,{defaultFormatString:o}=t;return A.makeFormat("",o??A.DEFAULT_FORMAT_STRING,A.TYPE_GLOBAL,void 0)}case F.dataType.DECIMAL:{const{defaultDecimalFormatOptions:t}=this.props,{defaultFormatString:o}=t;return _.makeFormat("",o??_.DEFAULT_FORMAT_STRING,_.TYPE_GLOBAL,void 0)}default:return""}}renderFormatRule(e,t){const o=`input-${e}-columnName`,r=`input-${e}-columnType`,i=`input-${e}-format`,l=this.getCachedColumnTypeOptions(),c=p=>this.handleFormatRuleChange(e,"columnName",p.target.value),d=()=>this.handleFormatRuleChange(e,"isNewRule",!1),u=p=>this.handleFormatRuleChange(e,"columnType",p),h=this.getRuleError(t);return a.jsxs("fieldset",{className:"container-fluid format-rule-container",children:[a.jsxs("div",{className:"form-row",children:[a.jsxs("div",{className:"form-group col-7 mb-2",children:[a.jsx("label",{htmlFor:o,children:"Column Name"}),a.jsx("input",{id:o,className:R("form-control",{"is-invalid":h.hasColumnNameError}),"data-lpignore":!0,type:"text",value:t.columnName,onChange:c,onBlur:d})]}),a.jsxs("div",{className:"form-group col mb-2",children:[a.jsx(w,{kind:"ghost",className:"btn-delete-format-rule float-right",tabIndex:-1,onClick:()=>this.handleFormatRuleDelete(e),icon:pa,tooltip:"Delete","aria-label":"Delete Format Rule"}),a.jsx("label",{htmlFor:r,children:"Column Type"}),a.jsx(he,{id:r,className:"custom-select",value:t.columnType,onChange:u,children:l})]})]}),a.jsx("div",{className:"form-row",children:a.jsxs("div",{className:"form-group col-12 d-flex mb-2",children:[a.jsx("label",{className:"flex-shrink-0 col-form-label mr-3",htmlFor:i,children:"Formatting Rule"}),this.renderFormatRuleInput(e,t.columnType,i,t.format,h.hasFormatError)]})}),a.jsx("div",{className:"form-row",children:a.jsx("div",{className:"form-group col-12 d-flex mb-2",children:h.message&&a.jsx("p",{className:"text-danger",children:h.message})})})]},e)}renderFormatRuleInput(e,t,o,r,i){switch(F.getNormalizedType(t)){case F.dataType.DATETIME:return this.renderDateTimeFormatRuleInput(e,o,r,i);case F.dataType.DECIMAL:return this.renderDecimalFormatRuleInput(e,o,r,i);case F.dataType.INT:return this.renderIntegerFormatRuleInput(e,o,r,i);default:throw new Error(`Unrecognized column type: ${t}`)}}renderDateTimeFormatRuleInput(e,t,o,r){const{showTimeZone:i,showTSeparator:l,timeZone:c}=this.state,d=o.formatString??"";return a.jsxs(he,{className:R("custom-select",{"is-invalid":r}),value:d,id:t,onChange:u=>{const h=W.makeFormat("",u,W.TYPE_GLOBAL);this.handleFormatRuleChange(e,"format",h)},children:[a.jsx("option",{value:"",disabled:!0,children:"Select format"},"default"),this.getCachedDateTimeFormatOptions(c,i,l)]})}renderIntegerFormatRuleInput(e,t,o,r){const{defaultIntegerFormatOptions:i}=this.props;ae(i);const{defaultFormatString:l}=i,c=o.formatString??"";return a.jsx("input",{className:R("form-control","flex-grow-1",{"is-invalid":r}),"data-lpignore":!0,id:t,placeholder:l??A.DEFAULT_FORMAT_STRING,type:"text",value:c,onChange:d=>{const u=A.makeFormat("",d.target.value,A.TYPE_GLOBAL,void 0);this.handleFormatRuleChange(e,"format",u)}})}renderDecimalFormatRuleInput(e,t,o,r){const{defaultDecimalFormatOptions:i}=this.props,{defaultFormatString:l}=i,c=o.formatString??"";return a.jsx("input",{className:R("form-control","flex-grow-1",{"is-invalid":r}),"data-lpignore":!0,id:t,placeholder:l??_.DEFAULT_FORMAT_STRING,type:"text",value:c,onChange:d=>{const u=_.makeFormat("",d.target.value,_.TYPE_GLOBAL,void 0);this.handleFormatRuleChange(e,"format",u)}})}render(){const{formatRulesChanged:e,formatSettings:t}=this.state,o=t.map((i,l)=>a.jsx(hs,{onEnter:this.handleFormatRuleEntered,children:this.renderFormatRule(l,i)},i.id)),r=a.jsx(w,{kind:"ghost",className:"mb-3",onClick:this.handleFormatRuleCreate,ref:this.addFormatRuleButtonRef,icon:ga,children:"Add New Rule"});return a.jsxs("div",{className:"app-settings-formatting-section",ref:this.containerRef,children:[a.jsx("div",{className:"app-settings-menu-description mb-3",children:"Customize the formatting of table columns by applying rules based on matching both a column name and column type."}),a.jsx(At,{appear:e,enter:e,exit:e,children:o}),r]})}};v(se,"defaultProps",{scrollTo:()=>{}}),v(se,"inputDebounceTime",250);let Re=se;const Zn=n=>({formatter:ds(n),defaultDecimalFormatOptions:pt(n),defaultIntegerFormatOptions:mt(n),dh:ut(n),showTimeZone:ht(n),showTSeparator:dt(n),timeZone:ct(n)}),zn=pe(Zn,{updateSettings:ne})(Re);function qn(){const n=ge(),s=ue(us),e=ue(ms),t=m.useCallback(r=>{n(ne({webgl:r}))},[n]),o=e?a.jsx(Q,{children:"WebGL in most cases has significant performance improvements, particularly when plotting large datasets. However, in some environments (such as remote desktop environments), WebGL may not use hardware acceleration and have degraded performance. If you are experiencing issues with WebGL, you can disable it here."}):a.jsx(Q,{children:"WebGL is disabled by your system administrator. Contact your system administrator to enable."});return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"app-settings-menu-description",children:"Advanced settings here. Be careful!"}),a.jsxs("div",{className:"form-row mb-3 pl-1",children:[a.jsx(ce,{isSelected:s,isDisabled:!e,onChange:t,marginEnd:"size-0",children:"Enable WebGL"}),a.jsxs(Oe,{variant:"info",marginTop:"size-50",children:[a.jsx(Pe,{children:"Enable WebGL"}),a.jsx(ke,{children:a.jsx(Q,{children:o})})]})]})]})}function Xn(){const n=ps(),s=ue(gs),e=ge(),t=m.useCallback(r=>{if(r!=="regular"&&r!=="compact"&&r!=="spacious")throw new Error(`Invalid grid density value: ${r}`);e(ne({gridDensity:r}))},[e]),o=s.gridDensity;return ae(n,"ThemeContext value is null"),a.jsxs(a.Fragment,{children:[a.jsx(Wa,{}),a.jsxs(rn,{label:"Default table density",selectedKey:o,onChange:t,children:[a.jsx(be,{children:"Regular"},"regular"),a.jsx(be,{children:"Compact"},"compact"),a.jsx(be,{children:"Spacious"},"spacious")]})]})}function Jn(){const n=ue(fs),s=ge(),{isMinimapEnabled:e,formatOnSave:t,python:{linter:o={}}={}}=n,{isEnabled:r,config:i=Ue}=o,l=m.useCallback(g=>s(oe({isMinimapEnabled:g})),[s]),c=m.useCallback(g=>s(oe({formatOnSave:g})),[s]),d=m.useCallback(g=>{s(oe({python:{linter:{...o,isEnabled:g}}})),Se.isRuffEnabled=g,Se.setRuffSettings(i)},[s,o,i]),u=m.useCallback(g=>{s(oe({python:{linter:{...o,config:JSON.stringify(g)===JSON.stringify(Ue)?void 0:g}}})),Se.setRuffSettings(g)},[s,o]),h=JSON.stringify(i,null,2),[p,D]=m.useState(!1),y=m.useCallback(()=>{D(!1)},[]),f=m.useCallback(g=>{u(g),y()},[u,y]);return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"app-settings-menu-description",children:"Customize the notebook editor."}),a.jsx("div",{className:"form-row pl-1",children:a.jsx(ce,{isSelected:e,onChange:l,children:"Enable Minimap"})}),a.jsxs("div",{className:"form-row align-items-center pl-1",children:[a.jsx(ce,{isSelected:t,onChange:c,margin:0,children:"Format on Save"}),a.jsxs(Oe,{variant:"info",children:[a.jsx(Pe,{children:"Format on Save"}),a.jsx(ke,{children:a.jsx(Q,{children:"The Ruff settings control formatting options. Notebooks can be formatted manually using the right-click context menu."})})]})]}),a.jsx("div",{className:"form-row pl-1",children:a.jsx(ce,{isSelected:r,onChange:d,marginEnd:0,children:"Enable Ruff Python Linter"})}),a.jsx("div",{className:"form-row pl-1",children:a.jsxs(_t,{onPress:()=>D(!0),children:[a.jsx(Mt,{children:a.jsx(E,{icon:fa})}),a.jsx(Q,{children:"Customize Ruff Settings"})]})}),p&&a.jsx(Ba,{text:h,isOpen:p,onClose:y,onSave:f})]})}const x=class x extends m.Component{constructor(e){super(e);v(this,"menuContentRef");v(this,"broadcastChannel");this.handleClose=this.handleClose.bind(this),this.handleScrollTo=this.handleScrollTo.bind(this),this.handleSectionToggle=this.handleSectionToggle.bind(this),this.handleExportSupportLogs=this.handleExportSupportLogs.bind(this),this.handleLogout=this.handleLogout.bind(this),this.menuContentRef=X.createRef(),this.broadcastChannel=new BroadcastChannel(Va),this.state={expandedSectionKey:x.FORMATTING_SECTION_KEY}}static focusFirstInputInContainer(e){const t=e==null?void 0:e.querySelector("input, select, textarea");t&&t.focus()}componentDidMount(){x.focusFirstInputInContainer(this.menuContentRef.current)}componentWillUnmount(){this.broadcastChannel.close()}isSectionExpanded(e){const{expandedSectionKey:t}=this.state;return t===e}handleLogout(){this.broadcastChannel.postMessage(ba(Ha))}handleScrollTo(e,t){var o;(o=this.menuContentRef.current)==null||o.scrollTo(e,t)}handleSectionToggle(e){this.setState(t=>({expandedSectionKey:t.expandedSectionKey===e?void 0:e}))}handleClose(){const{onDone:e}=this.props;e()}handleExportSupportLogs(){const{serverConfigValues:e,pluginData:t}=this.props,o=Ee(t);Ya(Sa,{uiVersion:"1.14.0",userAgent:navigator.userAgent,...Object.fromEntries(e),pluginInfo:o},va.getState())}render(){const e="https://github.com/deephaven/web-client-ui/",t="https://deephaven.io/core/docs/",{serverConfigValues:o,pluginData:r,user:i}=this.props,l=Tt(o),c=Ee(r),d=o.get("deephaven.version"),u=Z.COPY_VERSION_INFO.getDisplayText(),h=(f,g)=>a.jsxs(m.Fragment,{children:[a.jsx("div",{children:f}),a.jsx("div",{children:g})]},f),p=i.displayName??i.name,D=i.image!=null&&i.image!=="",y=p!=="";return a.jsxs("div",{className:"app-settings-menu",children:[a.jsxs("header",{className:"app-settings-menu-header",children:[a.jsxs("div",{className:"user-info",children:[a.jsxs("div",{className:"user-image",children:[!D&&a.jsx(E,{icon:ya,transform:"grow-8"}),D&&a.jsx("img",{src:i.image,alt:p})]}),a.jsxs("div",{className:"user-details",children:[y&&a.jsxs("div",{className:"user-name",children:[p,i.operateAs!=null&&i.name!==i.operateAs&&a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"font-weight-light font-italic",children:[" ","as"," "]}),a.jsxs("span",{className:"operating-as-user",children:[a.jsx(E,{icon:xa,className:"mr-1"}),i.operateAs]})]})]}),i.permissions.canLogout&&a.jsx("button",{type:"button",className:"btn btn-link",onClick:this.handleLogout,children:"logout"})]})]}),a.jsx(w,{kind:"ghost",className:"btn-close-settings-menu",onClick:this.handleClose,icon:a.jsx(E,{icon:Ca,transform:"grow-4"}),tooltip:"Close"})]}),a.jsxs("div",{className:"app-settings-menu-content",ref:this.menuContentRef,children:[a.jsx("h5",{children:"Settings"}),a.jsx("hr",{className:"my-0"}),a.jsx(H,{sectionKey:x.FORMATTING_SECTION_KEY,isExpanded:this.isSectionExpanded(x.FORMATTING_SECTION_KEY),title:a.jsxs(a.Fragment,{children:[a.jsx(E,{icon:Ta,transform:"grow-4",className:"mr-2"}),"Default Format & Time zone"]}),onToggle:this.handleSectionToggle,children:a.jsx(Mn,{})}),a.jsx(H,{sectionKey:x.COLUMN_SPECIFIC_SECTION_KEY,isExpanded:this.isSectionExpanded(x.COLUMN_SPECIFIC_SECTION_KEY),title:a.jsxs(a.Fragment,{children:[a.jsx(E,{icon:wa,transform:"grow-4",className:"mr-2"}),"Format by Column Name & Type"]}),onToggle:this.handleSectionToggle,children:a.jsx(zn,{scrollTo:this.handleScrollTo})}),a.jsx(H,{sectionKey:x.THEME_SECTION_KEY,isExpanded:this.isSectionExpanded(x.THEME_SECTION_KEY),onToggle:this.handleSectionToggle,title:a.jsxs(a.Fragment,{children:[a.jsx(E,{icon:ja,transform:"grow-4",className:"mr-2"}),"Theme"]}),children:a.jsx(Xn,{})}),a.jsx(H,{sectionKey:x.EDITOR_SECTION_KEY,isExpanded:this.isSectionExpanded(x.EDITOR_SECTION_KEY),onToggle:this.handleSectionToggle,title:a.jsxs(a.Fragment,{children:[a.jsx(E,{icon:Da,transform:"grow-4",className:"mr-2"}),"Editor"]}),children:a.jsx(Jn,{})}),a.jsx(H,{sectionKey:x.SHORTCUT_SECTION_KEY,isExpanded:this.isSectionExpanded(x.SHORTCUT_SECTION_KEY),title:a.jsxs(a.Fragment,{children:[a.jsx(E,{icon:Ea,transform:"grow-4",className:"mr-2"}),"Keyboard Shortcuts"]}),onToggle:this.handleSectionToggle,children:a.jsx(Vn,{})}),a.jsx(H,{sectionKey:x.ADVANCED_SECTION_KEY,isExpanded:this.isSectionExpanded(x.ADVANCED_SECTION_KEY),title:a.jsxs(a.Fragment,{children:[a.jsx(E,{icon:Na,transform:"grow-4",className:"mr-2"}),"Advanced"]}),onToggle:this.handleSectionToggle,children:a.jsx(qn,{})}),a.jsxs("div",{className:"app-settings-footer",children:[a.jsxs("div",{className:"app-settings-footer-section",children:[a.jsxs("div",{className:"app-settings-footer-item",children:[a.jsx("div",{className:"font-weight-bold",children:"Support"}),a.jsxs("div",{children:["GitHub: ",a.jsx("a",{href:e,className:"custom-link",target:"_blank",rel:"noopener noreferrer",children:e})]}),a.jsx(w,{kind:"tertiary",className:"mt-2 py-2",onClick:this.handleExportSupportLogs,children:"Export Logs"})]}),a.jsxs("div",{className:"app-settings-footer-item",children:[a.jsx("div",{className:"font-weight-bold",children:"Documentation"}),a.jsx("a",{target:"_blank",rel:"noreferrer noopener",href:t,className:"custom-link",children:t})]}),a.jsxs("div",{className:"app-settings-footer-item",children:[a.jsx("div",{className:"font-weight-bold",children:"Version"}),a.jsxs("span",{className:"d-inline-block text-muted",children:[d,a.jsxs(Oe,{variant:"info",children:[a.jsx(Pe,{children:"Version Info"}),a.jsxs(ke,{children:[a.jsx("div",{className:"detailed-server-config",children:Object.entries(l).map(([f,g])=>h(f,g))}),a.jsxs(bs,{copy:Object.entries({...l,...c}).map(([f,g])=>`${f}: ${g}`).join(`
4
- `),children:["Copy Versions"," ",a.jsxs("small",{className:"text-muted",children:["(",u,")"]})]})]})]})]})]}),a.jsxs("div",{className:"app-settings-footer-item",children:[a.jsx("div",{className:"font-weight-bold",children:"Plugins"}),a.jsx("div",{className:"container",children:Array.from(r.entries()).filter(f=>f[1].version!==void 0).map(([f,g])=>a.jsxs("div",{className:"row justify-content-start align-items-center",children:[a.jsx("div",{className:"col pl-0",children:a.jsx("span",{className:"my-0 text-truncate",children:f})}),a.jsx("div",{className:"col-auto",children:a.jsx("span",{children:g==null?void 0:g.version})})]},f))})]}),a.jsx("div",{className:"app-settings-footer-item",children:a.jsx(Un,{})})]}),a.jsx("div",{className:"app-settings-footer-section",children:a.jsx("a",{target:"_blank",rel:"noreferrer noopener",href:"https://deephaven.io",style:{display:"block",width:"61.8%"},children:a.jsx(St,{})})})]})]})]})}};v(x,"defaultProps",{onDone:()=>{}}),v(x,"FORMATTING_SECTION_KEY","SettingsMenu.formatting"),v(x,"COLUMN_SPECIFIC_SECTION_KEY","SettingsMenu.columnFormatting"),v(x,"APPLICATION_SECTION_KEY","ApplicationMenu.settings"),v(x,"SHORTCUT_SECTION_KEY","SettingsMenu.shortcuts"),v(x,"THEME_SECTION_KEY","SettingsMenu.theme"),v(x,"ADVANCED_SECTION_KEY","SettingsMenu.advanced"),v(x,"EDITOR_SECTION_KEY","SettingsMenu.editor");let Ie=x;const at=10;function le(n){const{forwardedProps:s}=n;ae(s,"DragSourceMenuItem forwardedProps");const{menuItem:{action:e,title:t,disabled:o},iconElement:r,displayShortcut:i,isMouseSelected:l,isKeyboardSelected:c,closeMenu:d}=s,u=m.useRef(),h=m.useRef(),p=m.useRef(null),[D,y]=m.useState(!1),f=m.useCallback(C=>{u.current!=null&&h.current!=null&&p.current&&(Math.abs(u.current-C.clientX)>=at||Math.abs(h.current-C.clientY)>=at)&&(y(!0),window.removeEventListener("mousemove",f),d(),e(C),p.current=null)},[e,d]);function g(C){u.current=C.clientX,h.current=C.clientY,p.current=C.target,window.addEventListener("mousemove",f)}function k(C){p.current===C.target&&(y(!0),d(),e(),window.removeEventListener("mousemove",f)),p.current=null}return m.useEffect(function(){return function(){return window.removeEventListener("mousemove",f)}},[f]),a.jsxs("button",{type:"button",className:R("btn-context-menu",{disabled:o},{active:l&&!o},{"keyboard-active":c&&!o}),onMouseDown:g,onMouseUp:k,disabled:D,children:[a.jsx("span",{className:R("icon"),children:r}),a.jsx("span",{className:"title",children:t}),a.jsx("span",{className:"shortcut",children:i})]})}function Qn(n){const{handleControlSelect:s,handleToolSelect:e,onClearFilter:t}=n,o=m.useMemo(()=>[{title:"Input Filter",icon:Fa,menuElement:a.jsx(le,{}),action:r=>{s(K.INPUT_FILTER,r)},order:10},{title:"Dropdown Filter",icon:Ra,menuElement:a.jsx(le,{}),action:r=>{s(K.DROPDOWN_FILTER,r)},order:15},{title:"Markdown Widget",icon:Ia,menuElement:a.jsx(le,{}),action:r=>{s(K.MARKDOWN,r)},order:20},{title:"Filter Sets",icon:Oa,menuElement:a.jsx(le,{}),action:r=>{s(K.FILTER_SET_MANAGER,r)},order:25},{disabled:!0,menuElement:a.jsx("div",{className:"context-menu-group-header",children:"Tools"}),order:30},{title:"Linker",icon:ka,action:()=>{e(me.LINKER)},order:40,shortcut:Z.LINKER},{disabled:!0,menuElement:a.jsx("div",{className:"context-menu-group-header",children:"Actions"}),order:50},{title:"Clear All Filters",icon:La,action:()=>{t()},order:60,shortcut:yt.TABLE.CLEAR_ALL_FILTERS}],[s,e,t]);return a.jsx(vs,{popperClassName:"controls-menu-popper",actions:o})}const eo=Pa(Ct,null),to={layoutStorage:eo},so=n=>n.layoutStorage,ao=n=>n.serverConfigValues;Object.entries(to).map(([n,s])=>Aa.register(n,s));const nt=10;function no(n){const{onExportLayout:s,onImportLayout:e,onResetLayout:t,onSelect:o,widgets:r=[]}=n,[i,l]=m.useState(!1),[c,d]=m.useState(""),u=m.useRef(null),h=m.useRef(),p=m.useCallback((b,S)=>{b!=null&&o(b,S)},[o]),D=m.useCallback(b=>{d(b.target.value)},[]),y=m.useCallback(b=>{h.current!=null&&(Math.abs(h.current.x-b.clientX)>=nt||Math.abs(h.current.y-b.clientY)>=nt)&&(l(!0),window.removeEventListener("mousemove",y),p(h.current.widget,b),h.current=void 0)},[h,p]),f=m.useCallback((b,S)=>{h.current={x:b.clientX,y:b.clientY,widget:S},window.addEventListener("mousemove",y)},[y]),g=m.useCallback((b,S)=>{var U;window.removeEventListener("mousemove",y),((U=h.current)==null?void 0:U.widget)===S&&(l(!0),p(S)),h.current=void 0},[y,h,p]),k=m.useMemo(()=>r.filter(b=>{var S;return c?(S=b.name)==null?void 0:S.toLowerCase().includes(c.toLowerCase()):!0}),[c,r]).sort((b,S)=>{var U;return((U=b.name)==null?void 0:U.localeCompare(S.name??""))??0}),C=m.useMemo(()=>k.map(b=>a.jsx("li",{children:a.jsxs(w,{kind:"ghost","data-testid":`panel-list-item-${b.name??""}-button`,onMouseDown:S=>{f(S,b)},onMouseUp:S=>{g(S,b)},onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&p(b)},disabled:i,onClick:()=>{},children:[a.jsx(Ss,{type:b.type})," ",b.name??""]})},b.name)),[k,i,f,g,p]),T=m.useMemo(()=>C.length===0?a.jsx("span",{children:"No bound variables found."}):null,[C]);return a.jsxs("div",{className:"widget-list-container d-flex flex-column",children:[a.jsx("div",{className:"widget-list-header",children:a.jsx(ys,{value:c,placeholder:"Find Table, Plot or Widget",onChange:D,ref:u})}),a.jsxs("ul",{className:"widget-list flex-grow-1",children:[T&&a.jsx("li",{className:"widget-list-message",children:T}),!T&&C]}),a.jsx("div",{children:a.jsx("hr",{})}),a.jsxs("div",{className:"widget-list-footer",children:[a.jsxs(w,{kind:"ghost",onClick:s,children:[a.jsxs("div",{className:"fa-md fa-layers mr-1",children:[a.jsx(E,{mask:Ge,icon:$e,transform:"right-5 down-5"}),a.jsx(E,{icon:$e,transform:"right-8 down-6"})]}),"Export Layout"]}),a.jsxs(w,{kind:"ghost",onClick:e,children:[a.jsxs("div",{className:"fa-md fa-layers mr-1",children:[a.jsx(E,{mask:Ge,icon:We,transform:"right-5 down-5"}),a.jsx(E,{icon:We,transform:"right-8 down-6"})]}),"Import Layout"]}),a.jsx(w,{kind:"ghost",icon:z,onClick:t,tooltip:"Reset Layout"})]})]})}function oo({onAutoFillClick:n=()=>{}}){return a.jsxs("div",{className:"empty-dashboard-container",children:[a.jsxs("div",{className:"hint-container",children:[a.jsx(E,{icon:_a})," ",a.jsx("br",{}),"Use the panel list to add objects from a query."]}),a.jsxs("div",{className:"empty-dashboard",children:[a.jsx("div",{className:"add-panels-hint",children:"Drag Panels Here"}),a.jsx(w,{kind:"tertiary",onClick:n,children:"Auto fill objects"})]})]})}const N=$.module("AppMainContainer");class ee extends m.Component{constructor(e){super(e);v(this,"dashboardLayouts");v(this,"createDashboardListenerRemovers");v(this,"closeDashboardListenerRemovers");v(this,"importElement");v(this,"widgetListenerRemover");v(this,"getDashboardPlugins",Wt(e=>za(e)));Is(this),this.importElement=X.createRef();const{allDashboardData:t,serverConfigValues:o,plugins:r}=this.props;this.dashboardLayouts=new Map,this.createDashboardListenerRemovers=new Map,this.closeDashboardListenerRemovers=new Map,this.state={contextActions:[Za({uiVersion:"1.14.0",userAgent:navigator.userAgent,...Object.fromEntries(o),pluginInfo:Ee(r)},!1),{action:()=>{const i=Tt(o),l=Object.entries(i).map(([c,d])=>`${c}: ${d}`).join(`
5
- `);Os(l)},shortcut:Z.COPY_VERSION_INFO,isGlobal:!0},{action:()=>{this.handleToolSelect(me.LINKER)},shortcut:Z.LINKER,isGlobal:!0},{action:()=>{this.sendClearFilter()},shortcut:yt.TABLE.CLEAR_ALL_FILTERS,isGlobal:!0},{action:()=>{this.sendCycleStackForward()},shortcut:V.CYCLE_TO_NEXT_STACK,isGlobal:!0},{action:()=>{this.sendCycleStackBackward()},shortcut:V.CYCLE_TO_PREVIOUS_STACK,isGlobal:!0},{action:()=>{this.sendCycleTabForward()},shortcut:V.CYCLE_TO_NEXT_TAB,isGlobal:!0},{action:()=>{this.sendCycleTabBackward()},shortcut:V.CYCLE_TO_PREVIOUS_TAB,isGlobal:!0},{action:()=>{this.handleCycleDashboardForward()},shortcut:V.CYCLE_TO_NEXT_DASHBOARD,isGlobal:!0},{action:()=>{this.handleCycleDashboardBackward()},shortcut:V.CYCLE_TO_PREVIOUS_DASHBOARD,isGlobal:!0},{action:()=>{this.sendReopenLast()},shortcut:Z.REOPEN_CLOSED_PANEL,isGlobal:!0},{action:()=>{N.debug("Consume unhandled save shortcut")},shortcut:Z.SAVE,isGlobal:!0}],isPanelsMenuShown:!1,isResetLayoutPromptShown:!1,isSettingsMenuShown:!1,unsavedNotebookCount:0,widgets:[],tabs:Object.entries(t).map(([i,l])=>({key:i,title:l.title??"Untitled",isClosable:i!==j,icon:i===j?Ma:void 0})),activeTabKey:j,layoutIteration:0}}static handleWindowBeforeUnload(e){e.preventDefault(),e.returnValue=""}static hydrateConsole(e,t){return Rs.hydrate({...e,unzip:o=>Kt.loadAsync(o).then(r=>Object.values(r.files))},t)}static handleRefresh(){N.info("Refreshing application"),window.location.reload()}componentDidMount(){this.initWidgets(),this.initDashboardData(),window.addEventListener("beforeunload",ee.handleWindowBeforeUnload)}componentDidUpdate(e,t){const{dashboardData:o}=this.props;e.dashboardData!==o&&this.handleDataChange(o)}componentWillUnmount(){this.deinitWidgets(),this.createDashboardListenerRemovers.forEach(e=>e()),this.closeDashboardListenerRemovers.forEach(e=>e()),window.removeEventListener("beforeunload",ee.handleWindowBeforeUnload)}initWidgets(){const{connection:e}=this.props;if(e!=null){if(e.subscribeToFieldUpdates==null){N.warn("subscribeToFieldUpdates not supported, not initializing widgets");return}this.widgetListenerRemover=e.subscribeToFieldUpdates(t=>{N.debug("Got updates",t),this.setState(({widgets:o})=>{const{updated:r,created:i,removed:l}=t,c=[...r,...l],d=o.filter(h=>!c.some(p=>p.name===h.name));return[...r,...i].forEach(h=>{h.name!=null&&h.name!==""&&d.push(h)}),{widgets:d}})})}}deinitWidgets(){var e;(e=this.widgetListenerRemover)==null||e.call(this)}initDashboardData(){const{setDashboardPluginData:e,updateDashboardData:t,workspace:o}=this.props,{data:r}=o,{filterSets:i,links:l,pluginDataMap:c}=r;if(t(j,{filterSets:i,links:l}),c!=null){const d=Object.keys(c);for(let u=0;u<d.length;u+=1){const h=d[u],p=c[h];N.debug("initDashboardData plugin data",h,p),e(j,h,p)}}}openNotebookFromURL(){const{match:e}=this.props,{notebookPath:t}=e.params;if(t){const{session:o,sessionConfig:r}=this.props;if(o==null||r==null){N.error("No session available to open notebook URL",t);return}const i={id:`/${t}`,itemName:`/${t}`},l=r.type,c={value:null,language:l};this.emitLayoutEvent(ks.SELECT_NOTEBOOK,o,l,c,i,!0)}}sendClearFilter(){this.emitLayoutEvent(re.CLEAR_ALL_FILTERS)}sendCycleStackForward(){Ls(this.getActiveEventHub())}sendCycleStackBackward(){Ps(this.getActiveEventHub())}sendCycleTabForward(){As(this.getActiveEventHub())}sendCycleTabBackward(){_s(this.getActiveEventHub())}sendReopenLast(){this.emitLayoutEvent(Ms.REOPEN_LAST)}cycleDashboard(e){const{tabs:t,activeTabKey:o}=this.state;if(t.length<=1)return;const r=t.findIndex(c=>c.key===o);if(r===-1)return;const i=e===0?(r+1)%t.length:(r-1+t.length)%t.length,l=t[i];this.handleTabSelect(l.key)}handleCycleDashboardForward(){this.cycleDashboard(0)}handleCycleDashboardBackward(){this.cycleDashboard(1)}getActiveEventHub(){const{activeTabKey:e}=this.state,t=this.dashboardLayouts.get(e);return ae(t,"No active layout found"),t.eventHub}emitLayoutEvent(e,...t){this.getActiveEventHub().emit(e,...t)}handleCancelResetLayoutPrompt(){this.setState({isResetLayoutPromptShown:!1})}handleConfirmResetLayoutPrompt(){this.setState({isResetLayoutPromptShown:!1}),this.resetLayout()}handleError(e){Y.isCanceled(e)||N.error(e)}handleSettingsMenuHide(){this.setState({isSettingsMenuShown:!1})}handleSettingsMenuShow(){this.setState({isSettingsMenuShown:!0})}handleControlSelect(e,t){switch(N.debug("handleControlSelect",e),e){case K.DROPDOWN_FILTER:this.emitLayoutEvent(re.OPEN_DROPDOWN,{title:"DropdownFilter",type:e,createNewStack:!0,dragEvent:t});break;case K.INPUT_FILTER:this.emitLayoutEvent(re.OPEN_INPUT,{title:"InputFilter",type:e,createNewStack:!0,dragEvent:t});break;case K.MARKDOWN:this.emitLayoutEvent(Us.OPEN,{title:"Markdown",type:e,dragEvent:t});break;case K.FILTER_SET_MANAGER:this.emitLayoutEvent(re.OPEN_FILTER_SET_MANAGER,{title:"FilterSets",type:e,dragEvent:t});break;default:throw new Error(`Unrecognized control type ${e}`)}}handleToolSelect(e){N.debug("handleToolSelect",e);const{activeTool:t,setActiveTool:o}=this.props;o(t===e?me.DEFAULT:e)}handleClearFilter(){this.sendClearFilter()}handleDataChange(e){const{updateWorkspaceData:t}=this.props,{closed:o,filterSets:r,links:i,pluginDataMap:l}=e;t({closed:o,filterSets:r,links:i,pluginDataMap:l})}handleGoldenLayoutChange(e){var r,i;const{activeTabKey:t}=this.state,o=this.dashboardLayouts.get(t);o!==e&&(this.dashboardLayouts.set(t,e),o!=null&&((r=this.createDashboardListenerRemovers.get(t))==null||r(),(i=this.closeDashboardListenerRemovers.get(t))==null||i()),this.createDashboardListenerRemovers.set(t,Ks(e.eventHub,this.handleCreateDashboard)),this.closeDashboardListenerRemovers.set(t,$s(e.eventHub,this.handleCloseDashboard)))}handleCreateDashboard({pluginId:e,title:t,data:o}){const r=$t(),{setDashboardPluginData:i}=this.props;i(r,e,o),this.setState(({tabs:l})=>{const c=l.findIndex(({title:d})=>d===t);return c!==-1?{tabs:l.map((d,u)=>u===c?{key:r,title:t}:d),activeTabKey:r}:{tabs:[...l,{key:r,title:t}],activeTabKey:r}})}handleCloseDashboard(e){const{tabs:t}=this.state,o=t.find(r=>r.title===e);o!=null&&this.handleTabClose(o.key)}handleWidgetMenuClick(){this.setState(({isPanelsMenuShown:e})=>({isPanelsMenuShown:!e}))}handleWidgetSelect(e,t){this.setState({isPanelsMenuShown:!1}),N.debug("handleWidgetSelect",e,t),this.openWidget(e,t)}handleWidgetsMenuClose(){this.setState({isPanelsMenuShown:!1})}handleAutoFillClick(){const{widgets:e}=this.state;N.debug("handleAutoFillClick",e);const t=e.sort((o,r)=>o.title!=null&&r.title!=null?o.title.localeCompare(r.title):0);for(let o=0;o<t.length;o+=1)this.openWidget(t[o])}handleExportLayoutClick(){N.debug("handleExportLayoutClick"),this.setState({isPanelsMenuShown:!1});try{const{workspace:e}=this.props,{data:t}=e,o=ye.exportLayout(t);N.debug("handleExportLayoutClick exportedConfig",o);const r=new Blob([JSON.stringify(o)],{type:"application/json"}),i=Fn.i18n.DateTimeFormat.format("yyyy-MM-dd-HHmmss",new Date),l=document.createElement("a");l.href=URL.createObjectURL(r),l.download=`deephaven-app-layout-${i}.json`,l.click()}catch(e){N.error("Unable to export layout",e)}}handleImportLayoutClick(){N.debug("handleImportLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.importElement.current!=null&&(this.importElement.current.value="",this.importElement.current.click())}handleResetLayoutClick(){N.debug("handleResetLayoutClick"),this.setState({isPanelsMenuShown:!1,isResetLayoutPromptShown:!0,unsavedNotebookCount:Gs.unsavedNotebookCount()})}handleImportLayoutFiles(e){var t;e.stopPropagation(),e.preventDefault(),e.target.files!=null&&this.importLayoutFile((t=e.target.files)==null?void 0:t[0])}async importLayoutFile(e){try{const{updateDashboardData:t,updateWorkspaceData:o}=this.props,r=await e.text(),i=JSON.parse(r),{filterSets:l,layoutConfig:c,links:d,pluginDataMap:u}=ye.normalizeLayout(i);Gt.flushSync(()=>{o({layoutConfig:c}),t(j,{filterSets:l,links:d,pluginDataMap:u})}),this.setState(({layoutIteration:h})=>({layoutIteration:h+1}))}catch(t){N.error("Unable to import layout",t)}}async resetLayout(){const{layoutStorage:e,session:t}=this.props,{filterSets:o,layoutConfig:r,links:i}=await ye.getDefaultLayout(e,t!==void 0),{updateDashboardData:l,updateWorkspaceData:c}=this.props;c({layoutConfig:r}),l(j,{filterSets:o,links:i})}handlePaste(e){if(e.target instanceof HTMLElement&&e.target.closest(".monaco-editor"))return;const{clipboardData:t}=e,o=t.getData("Text"),r=/“|”/g;r.test(o)&&(e.preventDefault(),e.stopPropagation(),document.execCommand("insertText",!1,o.replace(r,'"')))}openWidget(e,t){const{connection:o}=this.props;Ws(this.getActiveEventHub(),{widget:Bs(e),dragEvent:t,fetch:async()=>o==null?void 0:o.getObject(e)})}handleHomeClick(){this.handleTabSelect(j)}handleTabSelect(e){this.setState({activeTabKey:e})}handleTabReorder(e,t){this.setState(({tabs:o})=>{const r=[...o],[i]=r.splice(e,1);return r.splice(t,0,i),{tabs:r}})}handleTabClose(e){this.setState(({tabs:t,activeTabKey:o})=>{const r=t.filter(l=>l.key!==e);let i=o;if(o===e&&r.length>0){const l=t.findIndex(c=>c.key===e);i=l<t.length-1?t[l+1].key:t[l-1].key}return r.length===0&&(i=j),{tabs:r,activeTabKey:i}})}getDashboards(){const{layoutIteration:e,tabs:t}=this.state,{allDashboardData:o,workspace:r}=this.props,{data:i}=r,{layoutConfig:l}=i;return[{id:j,layoutConfig:l,key:`${j}-${e}`},...t.filter(c=>c.key!==j).map(c=>{var d;return{id:c.key,layoutConfig:((d=o[c.key])==null?void 0:d.layoutConfig)??Vs,key:`${c.key}-${e}`}})]}render(){const{activeTool:e,plugins:t,user:o,serverConfigValues:r}=this.props,{permissions:i}=o,{canUsePanels:l}=i,{contextActions:c,isPanelsMenuShown:d,isResetLayoutPromptShown:u,isSettingsMenuShown:h,unsavedNotebookCount:p,widgets:D,tabs:y,activeTabKey:f}=this.state,g=this.getDashboardPlugins(t);return a.jsxs("div",{className:R("app-main-tabs","w-100","h-100","d-flex","flex-column",e?`active-tool-${e.toLowerCase()}`:""),onPaste:this.handlePaste,tabIndex:-1,children:[a.jsxs("div",{className:"app-main-top-nav-menus",children:[a.jsx(St,{className:"ml-1",style:{maxHeight:"20px"}}),y.length>1&&a.jsx("div",{style:{flexShrink:0,flexGrow:1,flexBasis:0,minWidth:0},children:a.jsx(qa,{tabs:y,activeKey:f,onSelect:this.handleTabSelect,onReorder:this.handleTabReorder,onClose:this.handleTabClose})}),a.jsxs("div",{className:"app-main-right-menu-buttons",children:[a.jsxs(w,{kind:"ghost",className:"btn-panels-menu",icon:Ua,onClick:()=>{},children:["Controls",a.jsx(Qn,{handleControlSelect:this.handleControlSelect,handleToolSelect:this.handleToolSelect,onClearFilter:this.handleClearFilter})]}),l&&a.jsxs(w,{kind:"ghost",className:"btn-panels-menu btn-show-panels","data-testid":"app-main-panels-button",onClick:this.handleWidgetMenuClick,icon:Ka,children:["Panels",a.jsx(Hs,{isShown:d,className:"panels-menu-popper",onExited:this.handleWidgetsMenuClose,options:{placement:"bottom"},closeOnBlur:!0,interactive:!0,children:a.jsx(no,{widgets:D,onExportLayout:this.handleExportLayoutClick,onImportLayout:this.handleImportLayoutClick,onResetLayout:this.handleResetLayoutClick,onSelect:this.handleWidgetSelect})})]}),a.jsx(w,{kind:"ghost",className:R("btn-settings-menu",{"text-warning":o.operateAs!=null&&o.operateAs!==o.name}),onClick:this.handleSettingsMenuShow,icon:a.jsx("span",{className:"fa-layers",children:a.jsx(E,{icon:$a,transform:"grow-3"})}),tooltip:"User Settings"})]})]}),a.jsx(Xa,{dashboards:this.getDashboards(),activeDashboard:f,onGoldenLayoutChange:this.handleGoldenLayoutChange,emptyDashboard:f===j?a.jsx(oo,{onAutoFillClick:this.handleAutoFillClick}):a.jsx(vt,{"data-testid":"app-main-container-loading"}),plugins:[a.jsx(Ys,{hydrateConsole:ee.hydrateConsole,notebooksUrl:new URL("notebooks/",document.baseURI).href},"ConsolePlugin"),...g]}),a.jsx(ln,{in:h,mountOnEnter:!0,unmountOnExit:!0,children:a.jsx(Ie,{serverConfigValues:r,pluginData:t,onDone:this.handleSettingsMenuHide,user:o})}),a.jsx(Zs,{actions:c}),a.jsx("input",{ref:this.importElement,type:"file",accept:".json",style:{display:"none"},onChange:this.handleImportLayoutFiles,"data-testid":"input-import-layout"}),a.jsx(zs,{confirmButtonText:"Reset",onConfirm:this.handleConfirmResetLayoutPrompt,onCancel:this.handleCancelResetLayoutPrompt,isConfirmDanger:!0,isOpen:u,headerText:p===0?"Reset Layout":"Reset layout and discard unsaved changes",bodyText:p===0?"Do you want to reset your layout? Your existing layout will be lost.":"Do you want to reset your layout? Any unsaved notebooks will be lost."})]})}}const ro=n=>{var s,e;return{activeTool:Ds(n),allDashboardData:js(n),dashboardData:ws(n,j),layoutStorage:so(n),plugins:Ts(n),connection:Cs(n,j),session:(s=Ke(n,j))==null?void 0:s.session,sessionConfig:(e=Ke(n,j))==null?void 0:e.config,user:xs(n),workspace:gt(n),serverConfigValues:ao(n)}},io=pe(ro,{setActiveTool:bt,setDashboardData:ft,setDashboardPluginData:Fs,updateDashboardData:Ns,updateWorkspaceData:Es})(Ut(ee));function lo(){return a.jsxs("div",{className:"app","data-testid":"app-loaded",children:[a.jsx(io,{}),a.jsx(Bt,{})]})}const co=$.module("AppInit");function ot(){const n=lt(),s=Ja(),e=Qa(),t=qs(),o=en(),r=tn(),i=Vt(gt),l=ge(),[c,d]=m.useState();m.useEffect(function(){l(Xs(t))},[t,l]),m.useEffect(function(){async function y(){try{const f=await sn(),g=await an(n,e,f),k=s.getStorageService(),C=new nn(k,"/layouts"),T=new on(n,k,"/notebooks"),b=new Be(C),S=new En,U=await b.load({isConsoleAvailable:g!==void 0}),{data:fe}=U,{settings:Et}=fe,{shortcutOverrides:Ae={}}=Et,Nt=P.isMacPlatform?Ae.mac??{}:Ae.windows??{};Object.entries(Nt).forEach(([Rt,It])=>{var _e;(_e=Le.get(Rt))==null||_e.setKeyState(It)});const Ft={title:"Code Studio",filterSets:fe.filterSets,links:fe.links};l(Js(n)),l(bt(me.DEFAULT)),l(Qs(o)),l(ea(S)),l(ft(j,Ft)),l(ta(T)),l(Nn(C)),l(sa(j,e)),g!==void 0&&l(aa(j,g)),l(na(r)),l(oa(b)),l(ra(U)),l(ia(Be.makeDefaultWorkspaceSettings(o)))}catch(f){co.error(f),d(f)}}y()},[n,s,e,o,l,r]);const u=i==null&&c==null,h=!u&&c==null,p=c!=null?`${c}`:null;return a.jsxs(a.Fragment,{children:[h&&a.jsx(lo,{}),a.jsx(vt,{"data-testid":"app-init-loading",isLoading:u&&p==null,isLoaded:h,errorMessage:p})]})}const ho=X.lazy(()=>zt(()=>import("./StyleGuideRoot-DC2Vl5OL.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]),import.meta.url)),uo=new URL(document.baseURI).pathname.replace(/\/$/,"");function mo(){return a.jsx(Ht,{basename:uo,children:a.jsxs(Yt,{children:[a.jsx(ve,{exact:!0,path:"/",component:ot}),a.jsx(ve,{path:"/notebooks/:notebookPath+",component:ot}),a.jsx(ve,{path:"/styleguide",component:ho}),a.jsx(Zt,{from:"*",to:"/"})]})})}function wo(){return m.useEffect(function(){cn.register(new URL("./download/serviceWorker.js",window.location.href)),la.init({getWorker:(s,e)=>e==="json"?new qt:new Xt}),window["__@hello-pangea/dnd-disable-dev-warnings"]=!0},[]),a.jsx(mo,{})}export{wo as AppRoot,wo as default};
6
- //# sourceMappingURL=AppRoot-BBYNazf8.js.map
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./StyleGuideRoot-DwIVk99V.js","./vendor-DiRxarnk.js","./helpers-BosuxZz1.js","./vendor-CawHrWiI.css","./index-D3Hxj4WA.js","./monaco-DaE0jI-i.js","./monaco-CgHo24-M.css","./index-WCsQ0aAg.css","./IrisGridModel-CkvJzGrf.js","./ControlType-ER5vRkTe.js","./ControlType-CFrcYBSr.css","./IrisGridModel-CSTdZTzd.css","./MockChartModel-CEf8IaJN.js","./GridTokenMouseHandler-Bm8zeGiS.js","./IrisGridShortcuts-1GBHnhRv.js","./useMergeRef-Cu3dXTMp.js","./IrisGridShortcuts-CJtrNKDP.css","./GridTokenMouseHandler-DTMTgCrk.css","./MockChartModel-pqHtFcsG.css","./Grid-DVWKN6X6.js","./Grid-DPUNpG8i.css","./LocalWorkspaceStorage-cqkOt1tP.js","./LocalWorkspaceStorage-Czsna8UP.css","./StyleGuideRoot-BXf6u3u6.css"])))=>i.map(i=>d[i]);
2
+ var Ot=Object.defineProperty;var kt=(n,s,e)=>s in n?Ot(n,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[s]=e;var v=(n,s,e)=>kt(n,typeof s!="symbol"?s+"":s,e);import{X as rt,Y as Lt,Z as Pt,r as m,I as a,_ as pe,a0 as it,U as X,a1 as je,K as R,M as E,a2 as At,a3 as ge,a4 as ce,a5 as Oe,a6 as ke,a7 as be,a8 as _t,a9 as Mt,aa as Ut,ab as Kt,H as $t,ac as Gt,ad as Wt,ae as Bt,af as Vt,ag as Ht,ah as Yt,ai as ve,aj as Zt}from"./vendor-DiRxarnk.js";import{_ as zt,W as qt,a as Xt}from"./monaco-DaE0jI-i.js";import{O as de,P as Y,T as L,I as A,D as _,a as W,b as Jt,u as lt,F as Qt,c as F,d as es,g as ts,e as ct,f as ss,h as as,i as ns,j as os,k as dt,l as ht,m as ut,n as mt,o as pt,p as rs,q as ne,S as he,B as w,C as B,r as P,s as Le,t as is,K as ls,v as Me,w as cs,x as ds,y as hs,z as ue,A as us,E as ms,H as Pe,G as Q,J as ps,L as gs,M as fs,R as Ue,N as oe,Q as Se,U as Z,V as bs,W as K,X as me,Y as vs,Z as Ss,_ as ys,$ as gt,a0 as xs,a1 as Ke,a2 as Cs,a3 as Ts,a4 as ws,a5 as js,a6 as Ds,a7 as Es,a8 as Ns,a9 as Fs,aa as ft,ab as bt,ac as j,ad as Rs,ae as Is,af as Os,ag as ks,ah as re,ai as Ls,aj as Ps,ak as As,al as _s,am as Ms,an as Us,ao as Ks,ap as $s,aq as Gs,ar as Ws,as as Bs,at as Vs,au as Hs,av as Ys,aw as Zs,ax as zs,ay as qs,az as Xs,aA as Js,aB as Qs,aC as ea,aD as ta,aE as sa,aF as aa,aG as na,aH as oa,aI as ra,aJ as ia,aK as la}from"./ControlType-ER5vRkTe.js";import{L as $,v as z,a as ca,M as da,b as ha,c as ua,d as ma,e as ae,f as pa,g as ga,h as fa,m as ba,s as va,l as Sa,i as ya,j as xa,k as Ca,n as Ta,o as wa,p as ja,q as Da,r as Ea,t as Na,u as Fa,w as Ra,x as Ia,y as Oa,z as ka,A as La,B as Pa,C as Aa,D as $e,E as Ge,F as We,G as _a,H as Ma,I as Ua,J as Ka,K as $a,N as vt}from"./index-D3Hxj4WA.js";import{C as Ga,T as Wa,R as Ba,B as Va,a as Ha,e as Ya,L as St,c as Za,N as V,U as ye,g as za,b as qa,A as Xa,u as Ja,d as Qa,f as en,h as tn,i as sn,l as an,G as nn,j as on,k as Be}from"./LocalWorkspaceStorage-cqkOt1tP.js";import{P as rn,I as yt,S as ln,D as cn}from"./IrisGridShortcuts-1GBHnhRv.js";import"./helpers-BosuxZz1.js";import"./useMergeRef-Cu3dXTMp.js";class Ve{static makeSortConfig(s,e){return{column:s,direction:e}}static makeFilterConfig(s){var e=[],t=[];return s.forEach((o,r)=>{e.push(o),r>0&&t.push(de.and)}),{filterItems:e,filterOperators:t}}static combineFilterConfigs(s,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:de.and;return{filterItems:[...s.filterItems,...e.filterItems],filterOperators:[...s.filterOperators,t,...e.filterOperators]}}static makeFilterItem(s,e,t){return{columnName:s,type:e,value:t}}}function dn(n,s,e){if(n.length>s){var t=n.length-e;return{toKeep:n.slice(t),toPrune:n.slice(0,t)}}return{toKeep:n,toPrune:[]}}function He(n,s){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(n);s&&(t=t.filter(function(o){return Object.getOwnPropertyDescriptor(n,o).enumerable})),e.push.apply(e,t)}return e}function Ye(n){for(var s=1;s<arguments.length;s++){var e=arguments[s]!=null?arguments[s]:{};s%2?He(Object(e),!0).forEach(function(t){I(n,t,e[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):He(Object(e)).forEach(function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(e,t))})}return n}function Ze(n,s,e,t,o,r,i){try{var l=n[r](i),c=l.value}catch(d){return void e(d)}l.done?s(c):Promise.resolve(c).then(t,o)}function M(n){return function(){var s=this,e=arguments;return new Promise(function(t,o){var r=n.apply(s,e);function i(c){Ze(r,t,o,i,l,"next",c)}function l(c){Ze(r,t,o,i,l,"throw",c)}i(void 0)})}}function I(n,s,e){return(s=hn(s))in n?Object.defineProperty(n,s,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[s]=e,n}function hn(n){var s=un(n,"string");return typeof s=="symbol"?s:s+""}function un(n,s){if(typeof n!="object"||!n)return n;var e=n[Symbol.toPrimitive];if(e!==void 0){var t=e.call(n,s);if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(n)}var xe=$.module("PouchStorageTable"),mn="Deephaven.";rt.plugin(Lt);function pn(n,s){switch(n){case L.in:case L.contains:return{$regex:new RegExp("".concat(s)).toString()};case L.inIgnoreCase:return{$regex:new RegExp("".concat(s),"i").toString()};case L.eq:return{$eq:s};case L.notEq:return{$ne:s};case L.greaterThan:return{$gt:s};case L.greaterThanOrEqualTo:return{$gte:s};case L.lessThan:return{$lt:s};case L.lessThanOrEqualTo:return{$lte:s};case L.startsWith:return{$regex:new RegExp("^".concat(s,".*")).toString()};default:throw new Error("Unsupported type: ".concat(n))}}function gn(n){for(var{filterItems:s,filterOperators:e}=n,t=null,o=0;o<s.length;o+=1){var r=s[o],{columnName:i,type:l,value:c}=r,d={[i]:pn(l,c)};if(o===0)t=d;else if(t!==null&&o-1<e.length){var u=e[o-1];if(u===de.and)t={$and:[t,d]};else if(u===de.or)t={$or:[t,d]};else throw new Error("Unexpected filter operator ".concat(u,", ").concat(d))}}if(t==null)throw new Error("Invalid filter config ".concat(n));return t}function Ce(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return{$and:[...n.map(s=>gn(s)),{name:{$gt:null}},{id:{$gt:null}}]}}function fn(n){var s,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return[{id:e?"desc":"asc"},...(s=n==null?void 0:n.map(t=>({[t.column]:t.direction})))!==null&&s!==void 0?s:[]]}class bn{constructor(s,e){I(this,"db",void 0),I(this,"changes",void 0),I(this,"listeners",[]),I(this,"itemListeners",new Map),I(this,"currentSize",0),I(this,"currentViewport",void 0),I(this,"currentReverse",!1),I(this,"currentFilter",null),I(this,"currentSort",null),I(this,"infoUpdatePromise",void 0),I(this,"viewportUpdatePromise",void 0),I(this,"currentViewportData",void 0),this.db=new rt("".concat(mn).concat(s),e),this.db._remote=!1,this.listenForChanges(),this.db.createIndex({index:{fields:["id","name"]}}),this.refreshInfo()}listenForChanges(){this.changes=this.db.changes({live:!0,since:"now",include_docs:!0}).on("change",this.dbUpdate.bind(this))}onUpdate(s){return this.listeners=[...this.listeners,s],()=>{this.listeners=this.listeners.filter(e=>e!==s)}}onItemUpdate(s,e){return this.itemListeners.has(s)||this.itemListeners.set(s,[]),this.itemListeners.set(s,[...this.itemListeners.get(s),e]),this.refreshItem(s),()=>{this.itemListeners.set(s,this.itemListeners.get(s).filter(t=>t!==e))}}close(){this.listeners=[]}get size(){return this.currentSize}get viewport(){return this.currentViewport}setReversed(s){this.currentReverse=s,this.currentViewportData=void 0,this.refreshData()}setViewport(s){this.currentViewport=s,this.refreshInfo(),this.refreshData()}setSorts(s){this.currentSort=s,this.currentViewportData=void 0,this.refreshData()}setFilters(s){this.currentFilter=s,this.currentViewportData=void 0,this.refreshInfo(),this.refreshData()}get data(){return this.currentViewportData}getViewportData(){var s=this;return M(function*(){var e;return s.viewportUpdatePromise||s.refreshData(),(e=s.viewportUpdatePromise)!==null&&e!==void 0?e:Promise.resolve({items:[],offset:0})})()}put(s){var e=this;return M(function*(){var t=Ye(Ye({},s),{},{_id:s.id});return yield e.db.put(t),t})()}sendUpdate(){for(var s,{listeners:e}=this,t=(s=this.currentViewportData)!==null&&s!==void 0?s:{items:[],offset:0},o=0;o<e.length;o+=1)e[o](t)}sendItemUpdate(s){var e=this.itemListeners.get(s.id);if(e!==void 0)for(var t=0;t<e.length;t+=1)e[t](s)}dbUpdate(s){xe.debug("Update received",s),this.refreshInfo(),s.doc!==void 0&&this.sendItemUpdate(s.doc),this.refreshData()}fetchInfo(s){var e=this;return M(function*(){return e.db.find({selector:s,fields:[]})})()}refreshInfo(){var s=this;return M(function*(){try{var e,t;(e=s.infoUpdatePromise)===null||e===void 0||e.cancel(),s.infoUpdatePromise=Y.makeCancelable(s.fetchInfo(Ce((t=s.currentFilter)!==null&&t!==void 0?t:[])));var o=yield s.infoUpdatePromise;s.currentSize=o.docs.length,s.sendUpdate()}catch(r){if(!Y.isCanceled(r))throw xe.error("Unable to refreshInfo",r),r}})()}fetchViewportData(s,e,t){var o=this;return M(function*(){return o.db.find({selector:e,skip:s.top,limit:s.bottom-s.top+1,sort:t,fields:["id","name"]}).then(r=>({items:r.docs,offset:s.top}))})()}refreshData(){var s=this;return M(function*(){if(s.currentViewport)try{var e,t,o=Ce((e=s.currentFilter)!==null&&e!==void 0?e:[]),r=fn(s.currentSort,s.currentReverse);(t=s.viewportUpdatePromise)===null||t===void 0||t.cancel(),s.viewportUpdatePromise=Y.makeCancelable(s.fetchViewportData(s.currentViewport,o,r));var i=yield s.viewportUpdatePromise;return s.currentViewportData=i,s.sendUpdate(),i}catch(l){if(!Y.isCanceled(l))throw xe.error("Unable to refreshData",l),l}})()}refreshItem(s){var e=this;return M(function*(){var t=yield e.db.find({selector:{id:s},limit:1}),o=t.docs[0];return o!==void 0&&e.sendItemUpdate(o),o})()}getSnapshot(s){var e=this;return M(function*(){var t=new Map,o=[{id:e.currentReverse?"desc":"asc"}];return yield Promise.all(s.map(function(){var r=M(function*(i){var l,[c,d]=i,u=d-c+1;return e.db.find({selector:Ce((l=e.currentFilter)!==null&&l!==void 0?l:[]),skip:c,limit:u,sort:o,fields:["id","name"]}).then(h=>{for(var p=0;p<u;p+=1){var D=c+p;t.set(D,h.docs[p])}})});return function(i){return r.apply(this,arguments)}}())),t})()}}function ze(n,s){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(n);s&&(t=t.filter(function(o){return Object.getOwnPropertyDescriptor(n,o).enumerable})),e.push.apply(e,t)}return e}function ie(n){for(var s=1;s<arguments.length;s++){var e=arguments[s]!=null?arguments[s]:{};s%2?ze(Object(e),!0).forEach(function(t){xt(n,t,e[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):ze(Object(e)).forEach(function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(e,t))})}return n}function qe(n,s,e,t,o,r,i){try{var l=n[r](i),c=l.value}catch(d){return void e(d)}l.done?s(c):Promise.resolve(c).then(t,o)}function J(n){return function(){var s=this,e=arguments;return new Promise(function(t,o){var r=n.apply(s,e);function i(c){qe(r,t,o,i,l,"next",c)}function l(c){qe(r,t,o,i,l,"throw",c)}i(void 0)})}}function xt(n,s,e){return(s=vn(s))in n?Object.defineProperty(n,s,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[s]=e,n}function vn(n){var s=Sn(n,"string");return typeof s=="symbol"?s:s+""}function Sn(n,s){if(typeof n!="object"||!n)return n;var e=n[Symbol.toPrimitive];if(e!==void 0){var t=e.call(n,s);if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(n)}var yn=2500,xn=2e3,O=$.module("PouchCommandHistoryTable");class Xe extends bn{constructor(s,e){var t;super("CommandHistoryStorage.".concat(s),{auto_compaction:!0,revs_limit:1}),xt(this,"searchText",void 0),this.cache=e,this.cache.tableRegistry.has(this.cacheKey)||this.cache.tableRegistry.set(this.cacheKey,new Set),O.debug("Adding table to registry",this.cacheKey),(t=this.cache.tableRegistry.get(this.cacheKey))===null||t===void 0||t.add(this)}get cacheKey(){return this.db.name}setSearch(s){O.debug("Setting search filters",s),this.searchText=s.trim().toLowerCase(),this.setFilters(s?[Ve.makeFilterConfig([Ve.makeFilterItem("name",L.contains,s)])]:[])}dbUpdate(s){O.debug("Clearing cache and refreshing data",s),this.cache.response.delete(this.cacheKey),super.dbUpdate(s)}fetchData(s){var e=this;return J(function*(){return Y.withTimeout(0,J(function*(){e.cache.response.has(e.cacheKey)?O.debug("Fetching from cache",e.searchText,e.viewport):(O.debug("Fetching from PouchDB",e.searchText,e.viewport),e.cache.response.set(e.cacheKey,e.db.allDocs({include_docs:!0}).then(o=>{var r=o.rows.map(c=>c.doc).filter(c=>{var{name:d}=c;return d});O.debug("Fetched ".concat(r.length," command history items"));var{toKeep:i,toPrune:l}=dn(r,yn,xn);return l.length&&e.pruneItems(l),{docs:i}})));var t=e.cache.response.get(e.cacheKey);return e.searchText==null||e.searchText===""?t:ie(ie({},t),{},{docs:(yield t).docs.filter(o=>{var{name:r}=o;return r.toLowerCase().includes(e.searchText)})})}))})()}fetchInfo(s){var e=this;return J(function*(){return e.fetchData(s)})()}fetchViewportData(s,e,t){var o=this;return J(function*(){var r=yield o.fetchData(e);O.debug("Fetching viewport data",s.top,s.bottom+1,t,r);var i=typeof t[0]=="object"&&t[0].id==="desc",l=i?r.docs.slice(0).reverse():r.docs,c=l.slice(s.top,s.bottom+1);return{items:c,offset:s.top}})()}pruneItems(s){var e=this;return J(function*(){if(e.cache.isPruning.get(e.cacheKey)===!0){O.debug("Pruning already in progress. Skipping.");return}try{O.debug("Pruning ".concat(s.length," command history items"));var t=e.cache.pauseChangeListeners(e.cacheKey);e.cache.isPruning.set(e.cacheKey,!0),yield e.db.bulkDocs(s.map(o=>ie(ie({},o),{},{_deleted:!0}))),e.cache.isPruning.set(e.cacheKey,!1),t(),O.debug("Finished pruning command history items")}catch(o){O.error("An error occurred while pruning db",o)}})()}close(){var s,e,t;O.debug("Closing table",this,(s=this.cache.tableRegistry.get(this.cacheKey))===null||s===void 0?void 0:s.size),(e=this.cache.tableRegistry.get(this.cacheKey))===null||e===void 0||e.delete(this),(t=this.changes)===null||t===void 0||t.cancel(),super.close()}}function Te(n,s,e){return(s=Cn(s))in n?Object.defineProperty(n,s,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[s]=e,n}function Cn(n){var s=Tn(n,"string");return typeof s=="symbol"?s:s+""}function Tn(n,s){if(typeof n!="object"||!n)return n;var e=n[Symbol.toPrimitive];if(e!==void 0){var t=e.call(n,s);if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(n)}var Je=$.module("PouchCommandHistoryCache");class wn{constructor(){Te(this,"isPruning",void 0),Te(this,"response",void 0),Te(this,"tableRegistry",void 0),this.isPruning=new Map,this.response=new Map,this.tableRegistry=new Map}pauseChangeListeners(s){var e,t=[];return(e=this.tableRegistry.get(s))===null||e===void 0||e.forEach(o=>{o.changes&&(Je.debug("Pausing event listeners on '".concat(s,"' table"),o),o.changes.cancel(),t.push(o))}),()=>{t.forEach(o=>{var r,i;(r=(i=this.tableRegistry.get(s))===null||i===void 0?void 0:i.has(o))!==null&&r!==void 0&&r&&(Je.debug("Resuming event listeners on '".concat(s,"' table"),o),o.listenForChanges())})}}}function Qe(n,s){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(n);s&&(t=t.filter(function(o){return Object.getOwnPropertyDescriptor(n,o).enumerable})),e.push.apply(e,t)}return e}function et(n){for(var s=1;s<arguments.length;s++){var e=arguments[s]!=null?arguments[s]:{};s%2?Qe(Object(e),!0).forEach(function(t){De(n,t,e[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):Qe(Object(e)).forEach(function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(e,t))})}return n}function tt(n,s,e,t,o,r,i){try{var l=n[r](i),c=l.value}catch(d){return void e(d)}l.done?s(c):Promise.resolve(c).then(t,o)}function we(n){return function(){var s=this,e=arguments;return new Promise(function(t,o){var r=n.apply(s,e);function i(c){tt(r,t,o,i,l,"next",c)}function l(c){tt(r,t,o,i,l,"throw",c)}i(void 0)})}}function De(n,s,e){return(s=jn(s))in n?Object.defineProperty(n,s,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[s]=e,n}function jn(n){var s=Dn(n,"string");return typeof s=="symbol"?s:s+""}function Dn(n,s){if(typeof n!="object"||!n)return n;var e=n[Symbol.toPrimitive];if(e!==void 0){var t=e.call(n,s);if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(n)}var st=$.module("PouchCommandHistoryStorage");class En{constructor(){De(this,"cache",new wn),De(this,"updateTableMap",new Map)}getUpdateTable(s){return this.updateTableMap.has(s)||this.updateTableMap.set(s,new Xe(s,this.cache)),this.updateTableMap.get(s)}getTable(s){var e=this;return we(function*(){return new Xe(s,e.cache)})()}addItem(s,e,t,o){var r=this;return we(function*(){return r.updateItem(s,{id:"".concat(new Date().getTime()),name:t,data:o})})()}updateItem(s,e){var t=this;return we(function*(){var o=t.getUpdateTable(s),r=yield o.refreshItem(e.id),i=et(et({},r??{}),e);return st.debug("Updating item",i),yield o.put(i),st.debug("Update saved"),e})()}listenItem(s,e,t){var o=this.getUpdateTable(s);return o.onItemUpdate(e,t)}}const Ct="SET_LAYOUT_STORAGE",Nn=n=>({type:Ct,payload:n});var{dh:Fn}=globalThis;const Rn=$.module("SettingsUtils");function In(n){return n.formatString!=null}function Tt(n){const s=Pt.parse(window.navigator.userAgent),e=`${s.browser.name??""} ${Number(parseFloat(s.browser.version??""))||""}`,t=`${s.os.name??""} ${s.os.version??""}`,o=n.get("python.version")??"";return{"Engine Version":n.get("deephaven.version")??"Unknown","Web UI Version":"1.15.0",...o!==""?{"Python Version":o}:{},"Java Version":n.get("java.version")??"Unknown","Groovy Version":n.get("groovy.version")??"Unknown","Barrage Version":n.get("barrage.version")??"Unknown","Browser Name":e.trim()||"Unknown","User Agent OS":t.trim()||"Unknown"}}function Ee(n){return Array.from(n.entries()).filter(s=>s[1].version!==void 0).reduce((s,[e,t])=>({...s,[e]:t.version}),{})}function Ne(n){const s=n==null?void 0:n.querySelector("input, select, textarea");s&&s.focus()}function wt(n,s){return n.defaultFormatString===s.defaultFormatString}function On(n,s){return wt(n,s)}function kn(n,s){return wt(n,s)}function jt(n){return n!==""&&Jt.isValidColumnName(n)}function q(n,s,e){if(!s||e.formatString==null||!In(e))return!1;switch(s){case"datetime":return W.isValid(n,e);case"decimal":return _.isValid(n,e);case"int":return A.isValid(n,e);default:return Rn.warn("Trying to validate format of unknown type"),!0}}function Ln(n){const{id:s,isNewRule:e,...t}=n;return t}function Pn(n,s){return jt(s.columnName)&&q(n,s.columnType,s.format)}function Dt(n){const{timestamp:s,timeZone:e,showTimeZone:t,showTSeparator:o,isGlobalOptions:r,legacyGlobalFormat:i}=n,l=lt(),c=m.useMemo(()=>new Qt(l,[],{timeZone:e,showTimeZone:t,showTSeparator:o}),[l,t,o,e]),d=r?W.getGlobalFormats(t,o):W.getFormats(t,o);return i!=null&&!d.includes(i)&&d.unshift(i),a.jsx(a.Fragment,{children:d.map(u=>{const h=W.makeFormat("",u,W.TYPE_GLOBAL);return a.jsx("option",{value:u,"data-testid":"time-format",children:c.getFormattedString(s,F.dataType.DATETIME,"",h)},u)})})}function An(){return a.jsx(a.Fragment,{children:es.TIME_ZONES.map(n=>{const{label:s,value:e}=n;return a.jsx("option",{value:e,children:s},e)})})}const G=$.module("FormattingSectionContent"),te=class te extends m.PureComponent{constructor(e){super(e);v(this,"debouncedCommitChanges");v(this,"pendingUpdates");v(this,"containerRef");v(this,"getCachedDateTimeFormatOptions",je((e,t,o,r=!1,i)=>{const{timestampAtMenuOpen:l}=this.state;return a.jsx(Dt,{timestamp:l,timeZone:e,showTimeZone:t,showTSeparator:o,isGlobalOptions:r,legacyGlobalFormat:i})},{max:100}));this.debouncedCommitChanges=it(this.commitChanges.bind(this),te.inputDebounceTime),this.queueUpdate=this.queueUpdate.bind(this),this.handleDefaultDateTimeFormatChange=this.handleDefaultDateTimeFormatChange.bind(this),this.handleDefaultDecimalFormatChange=this.handleDefaultDecimalFormatChange.bind(this),this.handleDefaultIntegerFormatChange=this.handleDefaultIntegerFormatChange.bind(this),this.handleShowTimeZoneChange=this.handleShowTimeZoneChange.bind(this),this.handleShowTSeparatorChange=this.handleShowTSeparatorChange.bind(this),this.handleTimeZoneChange=this.handleTimeZoneChange.bind(this),this.handleResetDateTimeFormat=this.handleResetDateTimeFormat.bind(this),this.handleResetDecimalFormat=this.handleResetDecimalFormat.bind(this),this.handleResetIntegerFormat=this.handleResetIntegerFormat.bind(this),this.handleResetTimeZone=this.handleResetTimeZone.bind(this),this.handleTruncateNumbersWithPoundChange=this.handleTruncateNumbersWithPoundChange.bind(this),this.handleShowEmptyStringsChange=this.handleShowEmptyStringsChange.bind(this),this.handleShowNullStringsChange=this.handleShowNullStringsChange.bind(this),this.handleShowExtraGroupColumnChange=this.handleShowExtraGroupColumnChange.bind(this);const{defaultDateTimeFormat:t,defaultDecimalFormatOptions:o,defaultIntegerFormatOptions:r,showTimeZone:i,showTSeparator:l,timeZone:c,truncateNumbersWithPound:d,showEmptyStrings:u,showNullStrings:h,showExtraGroupColumn:p}=e;this.containerRef=X.createRef(),this.pendingUpdates=[],this.state={showTimeZone:i,showTSeparator:l,timeZone:c,defaultDateTimeFormat:t,defaultDecimalFormatOptions:o,defaultIntegerFormatOptions:r,truncateNumbersWithPound:d,showEmptyStrings:u,showNullStrings:h,showExtraGroupColumn:p,timestampAtMenuOpen:new Date}}componentDidMount(){Ne(this.containerRef.current)}componentWillUnmount(){this.debouncedCommitChanges.flush()}queueUpdate(e){this.pendingUpdates.push(e),this.debouncedCommitChanges()}handleDefaultDateTimeFormatChange(e){G.debug("handleDefaultDateTimeFormatChange",e);const t={defaultDateTimeFormat:e};this.setState(t),this.queueUpdate(t)}handleDefaultDecimalFormatChange(e){G.debug("handleDefaultDecimalFormatChange",e.target.value);const t={defaultDecimalFormatOptions:{defaultFormatString:e.target.value}};this.setState(t),q(dh,F.dataType.DECIMAL,_.makeCustomFormat(e.target.value))&&this.queueUpdate(t)}handleDefaultIntegerFormatChange(e){G.debug("handleDefaultIntegerFormatChange",e.target.value);const t={defaultIntegerFormatOptions:{defaultFormatString:e.target.value}};this.setState(t),q(dh,F.dataType.INT,A.makeCustomFormat(e.target.value))&&this.queueUpdate(t)}handleShowTimeZoneChange(){const{showTimeZone:e}=this.state,t={showTimeZone:!e};this.setState(t),this.queueUpdate(t)}handleShowTSeparatorChange(){const{showTSeparator:e}=this.state,t={showTSeparator:!e};this.setState(t),this.queueUpdate(t)}handleTimeZoneChange(e){const t={timeZone:e};this.setState(t),this.queueUpdate(t)}handleResetDateTimeFormat(){const{defaults:e}=this.props,{defaultDateTimeFormat:t,showTimeZone:o,showTSeparator:r}=e;G.debug("handleResetDateTimeFormat"),this.setState({defaultDateTimeFormat:t,showTimeZone:o,showTSeparator:r}),this.queueUpdate({defaultDateTimeFormat:void 0,showTimeZone:void 0,showTSeparator:void 0})}handleResetTimeZone(){const{defaults:e}=this.props,{timeZone:t}=e;G.debug("handleResetTimeZone"),this.setState({timeZone:t}),this.queueUpdate({timeZone:void 0})}handleResetDecimalFormat(){const{defaults:e}=this.props,{defaultDecimalFormatOptions:t}=e;G.debug("handleResetDecimalFormat"),this.setState({defaultDecimalFormatOptions:t}),this.queueUpdate({defaultDecimalFormatOptions:void 0})}handleResetIntegerFormat(){const{defaults:e}=this.props,{defaultIntegerFormatOptions:t}=e;G.debug("handleResetIntegerFormat"),this.setState({defaultIntegerFormatOptions:t}),this.queueUpdate({defaultIntegerFormatOptions:void 0})}handleTruncateNumbersWithPoundChange(){const{truncateNumbersWithPound:e}=this.state,t={truncateNumbersWithPound:e!==!0};this.setState(t),this.queueUpdate(t)}handleShowEmptyStringsChange(){const{showEmptyStrings:e}=this.state,t={showEmptyStrings:!e};this.setState(t),this.queueUpdate(t)}handleShowNullStringsChange(){const{showNullStrings:e}=this.state,t={showNullStrings:!e};this.setState(t),this.queueUpdate(t)}handleShowExtraGroupColumnChange(){const{showExtraGroupColumn:e}=this.state,t={showExtraGroupColumn:!e};this.setState(t),this.queueUpdate(t)}commitChanges(){const{updateSettings:e}=this.props,t=this.pendingUpdates.reduce((o,r)=>({...o,...r}),{});this.pendingUpdates=[],e(t)}render(){const{defaults:e,dh:t}=this.props,{defaultDateTimeFormat:o,defaultDecimalFormatOptions:r,defaultIntegerFormatOptions:i,timeZone:l,showTimeZone:c,showTSeparator:d,truncateNumbersWithPound:u,showEmptyStrings:h,showNullStrings:p,showExtraGroupColumn:D}=this.state,{defaultFormatString:y=_.DEFAULT_FORMAT_STRING}=r??{},{defaultFormatString:f=A.DEFAULT_FORMAT_STRING}=i??{},g=l===e.timeZone,k=d===e.showTSeparator&&c===e.showTimeZone&&o===e.defaultDateTimeFormat,C=On(r,e.defaultDecimalFormatOptions),T=kn(i,e.defaultIntegerFormatOptions);return a.jsx("div",{className:"app-settings-formatting-section",ref:this.containerRef,children:a.jsxs("div",{className:"container-fluid p-0",children:[a.jsx("div",{className:"app-settings-menu-description mb-3",children:"Choose the default formatting rule to apply to all table columns based on their type."}),a.jsxs("div",{className:"form-row mb-2",children:[a.jsx("label",{className:"col-form-label col-3",htmlFor:"select-reset-timezone",children:"Time zone"}),a.jsx("div",{className:"col pr-0",children:a.jsx(he,{className:"custom-select",value:l,onChange:this.handleTimeZoneChange,id:"select-reset-timezone",children:a.jsx(An,{})})}),a.jsx("div",{className:"col-1 btn-col",children:a.jsx(w,{kind:"ghost",icon:z,onClick:this.handleResetTimeZone,tooltip:"Reset Time Zone",className:R("btn-reset","btn-reset-time-zone",{hidden:g})})})]}),a.jsxs("div",{className:"form-row mb-2",children:[a.jsx("label",{className:"col-form-label col-3",htmlFor:"select-default-time-format",children:"DateTime"}),a.jsx("div",{className:"col pr-0",children:a.jsx(he,{className:"custom-select",value:o,onChange:this.handleDefaultDateTimeFormatChange,id:"select-default-time-format",children:this.getCachedDateTimeFormatOptions(l,c,d,!0,o)})}),a.jsx("div",{className:"col-1 btn-col",children:a.jsx(w,{kind:"ghost",icon:z,onClick:this.handleResetDateTimeFormat,tooltip:"Reset DateTime Options",className:R("btn-reset","btn-reset-date-time",{hidden:k})})})]}),a.jsx("div",{className:"form-row",children:a.jsx("div",{className:"offset-3 col-9",children:a.jsx(B,{checked:c??null,onChange:this.handleShowTimeZoneChange,children:"Show time zone in dates"})})}),a.jsx("div",{className:"form-row mb-3",children:a.jsx("div",{className:"offset-3 col-9",children:a.jsx(B,{checked:d??null,onChange:this.handleShowTSeparatorChange,children:"Show 'T' separator"})})}),a.jsxs("div",{className:"form-row mb-2",children:[a.jsx("label",{className:"col-form-label col-3",htmlFor:"default-decimal-format-input",children:"Decimal"}),a.jsx("div",{className:"col pr-0",children:a.jsx("input",{className:R("form-control","flex-grow-1","default-decimal-format-input",{"is-invalid":!q(t,F.dataType.DECIMAL,_.makeCustomFormat(y))}),"data-lpignore":!0,placeholder:_.DEFAULT_FORMAT_STRING,type:"text",id:"default-decimal-format-input",value:y,onChange:this.handleDefaultDecimalFormatChange})}),a.jsx("div",{className:"col-1 btn-col",children:a.jsx(w,{kind:"ghost",icon:z,onClick:this.handleResetDecimalFormat,tooltip:"Reset Decimal Formatting",className:R("btn-reset","btn-reset-decimal",{hidden:C}),"data-testid":"btn-reset-decimal"})})]}),a.jsxs("div",{className:"form-row mb-2",children:[a.jsx("label",{className:"col-form-label col-3",htmlFor:"default-integer-format-input",children:"Integer"}),a.jsx("div",{className:"col pr-0",children:a.jsx("input",{className:R("form-control","flex-grow-1","default-integer-format-input",{"is-invalid":!q(t,F.dataType.INT,A.makeCustomFormat(f))}),"data-lpignore":!0,placeholder:A.DEFAULT_FORMAT_STRING,type:"text",id:"default-integer-format-input",value:f,onChange:this.handleDefaultIntegerFormatChange})}),a.jsx("div",{className:"col-1 btn-col",children:a.jsx(w,{kind:"ghost",icon:z,onClick:this.handleResetIntegerFormat,tooltip:"Reset Integer Formatting",className:R("btn-reset","btn-reset-integer",{hidden:T}),"data-testid":"btn-reset-integer"})})]}),a.jsx("div",{className:"form-row mb-2",children:a.jsx("div",{className:"offset-3 col-9",children:a.jsx(B,{checked:u??null,onChange:this.handleTruncateNumbersWithPoundChange,children:"Show truncated numbers as ###"})})}),a.jsxs("div",{className:"form-row mb-3",children:[a.jsx("label",{className:"col-form-label col-3",htmlFor:"default-integer-format-input",children:"String"}),a.jsxs("div",{className:"col pr-0 pt-2",children:[a.jsxs(B,{checked:h??null,onChange:this.handleShowEmptyStringsChange,children:["Show empty strings as"," ",a.jsx("span",{className:"font-italic text-muted",children:"empty"})]}),a.jsxs(B,{checked:p??null,onChange:this.handleShowNullStringsChange,children:["Show null strings as"," ",a.jsx("span",{className:"font-italic text-muted",children:"null"})]})]})]}),a.jsxs("div",{className:"form-row mb-3",id:"show_extra_group_column_div",children:[a.jsx("label",{className:"col-form-label col-3",htmlFor:"default-show-extra-group-column",children:"Rollup"}),a.jsx("div",{className:"col pr-0 pt-2",id:"default-show-extra-group-column",children:a.jsx(B,{checked:D,onChange:this.handleShowExtraGroupColumnChange,children:'Show extra "group" column'})})]})]})})}};v(te,"defaultProps",{scrollTo:()=>{}}),v(te,"inputDebounceTime",250);let Fe=te;const _n=n=>({defaultDateTimeFormat:rs(n),defaultDecimalFormatOptions:pt(n),defaultIntegerFormatOptions:mt(n),dh:ut(n),showTimeZone:ht(n),showTSeparator:dt(n),truncateNumbersWithPound:os(n),showEmptyStrings:ns(n),showNullStrings:as(n),showExtraGroupColumn:ss(n),timeZone:ct(n),defaults:ts(n)}),Mn=pe(_n,{updateSettings:ne})(Fe);function Un(){const[n,s]=m.useState(!1),e=()=>{s(!n)};return a.jsxs(a.Fragment,{children:[a.jsx(w,{kind:"ghost",onClick:e,icon:ca,children:"Legal Notices"}),a.jsxs(da,{isOpen:n,toggle:e,children:[a.jsx(ha,{toggle:e,children:"Legal Notice"}),a.jsxs(ua,{children:[a.jsx("p",{children:"Deephaven software is protected by U.S. Patent Nos. 9,612,959; 9,613,018; 9,613,109; 9,619,210; 9,633,060; 9,639,570; 9,672,238; 9,679,006; 9,690,821; 9,710,511; 9,760,591; 9,805,084; 9,836,494; 9,836,495; 9,886,469; 9,898,496; 9,934,266; 10,002,153; 10,002,154; 10,002,155; 10,003,673; 10,019,138; 10,069,943; 10,176,211; 10,198,465; 10,198,466; 10,198,469; 10,212,257; 10,241,960; 10,241,965; 10,242,040; 10,242,041; 10,346,394; 10,353,893; 10,452,649; 10,496,639; 10,540,351; 10,552,412; 10,565,194; 10,565,206; 10,572,474; 10,621,168; 10,642,829; 10,657,184; 10,678,787; 10,691,686; 10,783,191; 10,866,943; 10,909,183; 10,915,526; 10,922,311; 10,929,394; 11,023,462; 11,126,662; 11,151,133; 11,238,036; 11,249,994; 11,263,211; 11,449,557; 11,514,037; 11,556,528; and 11,574,018. Other patents pending."}),a.jsxs("p",{children:["© 2016-",new Date().getFullYear()," Deephaven Data Labs LLC. Patent Pending."]})]})]})]})}function H(n){const{children:s,isExpanded:e,sectionKey:t,title:o,onToggle:r}=n;return a.jsxs(a.Fragment,{children:[a.jsx("div",{children:a.jsxs(w,{kind:"ghost",className:"btn-collapse-trigger",onClick:()=>r(t),children:[a.jsx("div",{className:"d-flex align-items-center flex-grow-1",children:o}),a.jsx("div",{className:"flex-shrink-0",children:a.jsx(E,{transform:e?"flip-v":"",icon:ma})})]})}),a.jsx(Ga,{in:e,autoFocusOnShow:!0,children:s})]})}function Kn({shortcut:n,displayText:s,categoryName:e,onChange:t}){const[o,r]=m.useState(s),[i,l]=m.useState(n.getKeyState()),[c,d]=m.useState(!1),[u,h]=m.useState("");m.useEffect(function(){r(s),l(n.getKeyState())},[s,n]),m.useEffect(function(){r(P.getDisplayText(i)),n.matchesKeyState(i)&&d(!1)},[i,n]),m.useEffect(function(){if(c){if(!P.isValidKeyState(i)){P.isAllowedKey(i.keyValue)?h("Must contain a modifier key"):h("Must contain an allowed action key");return}const b=Le.getConflictingShortcuts(i).filter(S=>S.id.startsWith(e)&&S!==n).map(S=>S.name);if(b.length){h(`Conflicts with ${b.join(", ")}`);return}h("")}else h("")},[c,i,e,n]);function p(T){if(T.stopPropagation(),T.preventDefault(),n.isEditable&&!T.repeat){const b=P.getKeyStateFromEvent(T),S=P.createKeyState([ls.BACKSPACE]);P.doKeyStatesMatch(b,S)?l(P.NULL_KEY_STATE):l(b)}}function D(T){T.stopPropagation(),T.preventDefault(),n.matchesKeyState(i)||d(!0)}function y(){Me.disableAllActions()}function f(){Me.enableAllActions()}function g(){n.setKeyState(i),d(!1),t(n)}function k(){const T=n.getKeyState();l(T),d(!1)}function C(){d(!0),l(n.getDefaultKeyState())}return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"shortcut-item-container",children:[a.jsxs("label",{className:"shortcut-item-name",children:[n.name,n.tooltip!==void 0&&a.jsx(is,{children:n.tooltip})]}),a.jsxs("div",{className:"shortcut-item-input-container",children:[a.jsx("input",{className:R("form-control",{"is-invalid":u}),onKeyDown:p,onKeyUp:D,onFocus:y,onBlur:f,disabled:!n.isEditable,value:o,readOnly:!0}),!P.doKeyStatesMatch(i,n.getDefaultKeyState())&&!u&&a.jsx(w,{className:"reset-to-default-button",kind:"ghost",icon:a.jsx(E,{icon:z,transform:{rotate:90,flipX:!0}}),tooltip:"Reset to default",onClick:C})]})]}),c&&a.jsxs("div",{className:R("shortcut-item-message-container",{"is-invalid":u}),children:[a.jsx("div",{className:"shortcut-item-message",children:u}),a.jsxs("div",{className:"shortcut-item-message-buttons",children:[P.isValidKeyState(i)&&a.jsx(w,{kind:"ghost",onClick:g,children:"Confirm"}),a.jsx(w,{kind:"ghost",onClick:k,children:"Undo"})]})]})]})}function $n({shortcutOverrides:n={},updateSettings:s}){const e=m.useCallback(i=>{const l=P.isMacPlatform,c={mac:{...n.mac},windows:{...n.windows}},d=l?c.mac:c.windows;i.forEach(u=>{u.isDefault()?delete d[u.id]:d[u.id]=u.getKeyState()}),s({shortcutOverrides:c})},[s,n]);let t=Array.from(Le.shortcutsByCategory.entries()).map(([i,l])=>({name:i,shortcuts:l}));const o=t.findIndex(i=>i.name.toUpperCase()==="GLOBAL"),r=t.splice(o,1);return t=t.concat(r),a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"app-settings-menu-description",children:"Customize shortcuts below. To prevent unexpected results, avoid conflicting shortcuts with the browser or IDE editor."}),t.map(i=>a.jsx(Gn,{name:i.name,shortcuts:i.shortcuts,saveShortcutOverrides:e},i.name))]})}function Gn({name:n,shortcuts:s,saveShortcutOverrides:e}){function t(c){return c.split("_").map(d=>`${d[0].toUpperCase()}${d.slice(1).toLowerCase()}`).join(" ")}const[o,r]=m.useState(s);function i(c){const d=o.filter(h=>h!==c&&!h.isNull()&&h.matchesKeyState(c.getKeyState()));d.forEach(h=>h.setToNull());const u=[c,...d];e(u),r(h=>[...h])}const l=m.useMemo(()=>o.map(c=>c.getDisplayText()),[o]);return a.jsxs("div",{className:"mt-3",children:[a.jsx("div",{className:"font-weight-bold",children:t(n)}),o.map((c,d)=>a.jsx(Kn,{shortcut:c,displayText:l[d],categoryName:n,onChange:i},c.id))]})}const Wn=n=>({shortcutOverrides:cs(n)}),Bn={updateSettings:ne},Vn=pe(Wn,Bn)($n),Hn=[{value:F.dataType.DATETIME,label:"DateTime"},{value:F.dataType.DECIMAL,label:"Decimal"},{value:F.dataType.INT,label:"Integer"}];function Yn(){const n=Hn.map(s=>a.jsx("option",{value:s.value,children:s.label},`key-columnType-${s.value}`));return a.jsxs(a.Fragment,{children:[a.jsx("option",{disabled:!0,value:"",children:"Select Type"},"key-columnType-placeholder"),n]})}const se=class se extends m.PureComponent{constructor(e){super(e);v(this,"debouncedCommitChanges");v(this,"containerRef");v(this,"addFormatRuleButtonRef");v(this,"lastFormatRuleIndex");v(this,"getCachedColumnTypeOptions",je(()=>a.jsx(Yn,{}),{max:100}));v(this,"getCachedDateTimeFormatOptions",je((e,t,o,r=!1,i)=>{const{timestampAtMenuOpen:l}=this.state;return a.jsx(Dt,{timestamp:l,timeZone:e,showTimeZone:t,showTSeparator:o,isGlobalOptions:r,legacyGlobalFormat:i})},{max:100}));this.debouncedCommitChanges=it(this.commitChanges.bind(this),se.inputDebounceTime),this.handleFormatRuleEntered=this.handleFormatRuleEntered.bind(this),this.handleFormatRuleChange=this.handleFormatRuleChange.bind(this),this.handleFormatRuleCreate=this.handleFormatRuleCreate.bind(this),this.handleFormatRuleDelete=this.handleFormatRuleDelete.bind(this);const{formatter:t,showTimeZone:o,showTSeparator:r,timeZone:i}=e,l=t.map((c,d)=>({...c,id:d}));this.containerRef=X.createRef(),this.addFormatRuleButtonRef=X.createRef(),this.lastFormatRuleIndex=l.length,this.state={formatSettings:l,formatRulesChanged:!1,showTimeZone:o,showTSeparator:r,timeZone:i,timestampAtMenuOpen:new Date}}componentDidMount(){Ne(this.containerRef.current)}componentWillUnmount(){this.debouncedCommitChanges.flush()}isDuplicateRule(e){const{formatSettings:t}=this.state;return t.some(o=>o.id!==e.id&&o.columnName===e.columnName&&o.columnType===e.columnType)??!1}getAutoIncrementFormatRuleIndex(){const{lastFormatRuleIndex:e}=this;return this.lastFormatRuleIndex+=1,e}handleFormatRuleChange(e,t,o){this.setState(r=>{const{formatSettings:i}=r;ae(i);const l=[...i];let c={};t==="columnType"&&(c={format:this.makeDefaultFormatterItemByType(o)});const d={...l[e],...c,[t]:o};return l[e]=d,{formatSettings:l}},()=>{this.debouncedCommitChanges()})}handleFormatRuleCreate(){this.setState(e=>{const{formatSettings:t}=e,o={columnType:F.dataType.DATETIME,columnName:"",format:{},id:this.getAutoIncrementFormatRuleIndex(),isNewRule:!0};return{formatSettings:[...t,o],formatRulesChanged:!0}})}handleFormatRuleDelete(e){this.setState(t=>{const{formatSettings:o}=t;return{formatSettings:o.filter((i,l)=>l!==e),formatRulesChanged:!0}},()=>{this.debouncedCommitChanges()})}handleFormatRuleEntered(e){this.scrollToFormatBlockBottom(),Ne(e)}commitChanges(){const{formatSettings:e}=this.state,{dh:t}=this.props,o=e.filter(l=>Pn(t,l)).map(Ln)??[],{updateSettings:r}=this.props;r({formatter:o})}scrollToFormatBlockBottom(){var t,o;const{scrollTo:e}=this.props;e(0,(((t=this.addFormatRuleButtonRef.current)==null?void 0:t.offsetHeight)??0)+(((o=this.addFormatRuleButtonRef.current)==null?void 0:o.offsetTop)??0))}getRuleError(e){const{dh:t}=this.props,o={hasColumnNameError:!1,hasFormatError:!1,message:""},r=[];return e.isNewRule!==void 0&&e.isNewRule||(this.isDuplicateRule(e)&&(o.hasColumnNameError=!0,r.push("Duplicate column name/type combo.")),jt(e.columnName)||(o.hasColumnNameError=!0,r.push("Column names must start with a letter or underscore and contain only alphanumeric characters or underscores.")),e.format.formatString!=null&&e.format.formatString.length===0?(o.hasFormatError=!0,r.push("Empty formatting rule.")):q(t,e.columnType,e.format)||(o.hasFormatError=!0,r.push("Invalid formatting rule.")),o.message=r.join(`
3
+ `)),o}makeDefaultFormatterItemByType(e){switch(F.getNormalizedType(e)){case F.dataType.INT:{const{defaultIntegerFormatOptions:t}=this.props,{defaultFormatString:o}=t;return A.makeFormat("",o??A.DEFAULT_FORMAT_STRING,A.TYPE_GLOBAL,void 0)}case F.dataType.DECIMAL:{const{defaultDecimalFormatOptions:t}=this.props,{defaultFormatString:o}=t;return _.makeFormat("",o??_.DEFAULT_FORMAT_STRING,_.TYPE_GLOBAL,void 0)}default:return""}}renderFormatRule(e,t){const o=`input-${e}-columnName`,r=`input-${e}-columnType`,i=`input-${e}-format`,l=this.getCachedColumnTypeOptions(),c=p=>this.handleFormatRuleChange(e,"columnName",p.target.value),d=()=>this.handleFormatRuleChange(e,"isNewRule",!1),u=p=>this.handleFormatRuleChange(e,"columnType",p),h=this.getRuleError(t);return a.jsxs("fieldset",{className:"container-fluid format-rule-container",children:[a.jsxs("div",{className:"form-row",children:[a.jsxs("div",{className:"form-group col-7 mb-2",children:[a.jsx("label",{htmlFor:o,children:"Column Name"}),a.jsx("input",{id:o,className:R("form-control",{"is-invalid":h.hasColumnNameError}),"data-lpignore":!0,type:"text",value:t.columnName,onChange:c,onBlur:d})]}),a.jsxs("div",{className:"form-group col mb-2",children:[a.jsx(w,{kind:"ghost",className:"btn-delete-format-rule float-right",tabIndex:-1,onClick:()=>this.handleFormatRuleDelete(e),icon:pa,tooltip:"Delete","aria-label":"Delete Format Rule"}),a.jsx("label",{htmlFor:r,children:"Column Type"}),a.jsx(he,{id:r,className:"custom-select",value:t.columnType,onChange:u,children:l})]})]}),a.jsx("div",{className:"form-row",children:a.jsxs("div",{className:"form-group col-12 d-flex mb-2",children:[a.jsx("label",{className:"flex-shrink-0 col-form-label mr-3",htmlFor:i,children:"Formatting Rule"}),this.renderFormatRuleInput(e,t.columnType,i,t.format,h.hasFormatError)]})}),a.jsx("div",{className:"form-row",children:a.jsx("div",{className:"form-group col-12 d-flex mb-2",children:h.message&&a.jsx("p",{className:"text-danger",children:h.message})})})]},e)}renderFormatRuleInput(e,t,o,r,i){switch(F.getNormalizedType(t)){case F.dataType.DATETIME:return this.renderDateTimeFormatRuleInput(e,o,r,i);case F.dataType.DECIMAL:return this.renderDecimalFormatRuleInput(e,o,r,i);case F.dataType.INT:return this.renderIntegerFormatRuleInput(e,o,r,i);default:throw new Error(`Unrecognized column type: ${t}`)}}renderDateTimeFormatRuleInput(e,t,o,r){const{showTimeZone:i,showTSeparator:l,timeZone:c}=this.state,d=o.formatString??"";return a.jsxs(he,{className:R("custom-select",{"is-invalid":r}),value:d,id:t,onChange:u=>{const h=W.makeFormat("",u,W.TYPE_GLOBAL);this.handleFormatRuleChange(e,"format",h)},children:[a.jsx("option",{value:"",disabled:!0,children:"Select format"},"default"),this.getCachedDateTimeFormatOptions(c,i,l)]})}renderIntegerFormatRuleInput(e,t,o,r){const{defaultIntegerFormatOptions:i}=this.props;ae(i);const{defaultFormatString:l}=i,c=o.formatString??"";return a.jsx("input",{className:R("form-control","flex-grow-1",{"is-invalid":r}),"data-lpignore":!0,id:t,placeholder:l??A.DEFAULT_FORMAT_STRING,type:"text",value:c,onChange:d=>{const u=A.makeFormat("",d.target.value,A.TYPE_GLOBAL,void 0);this.handleFormatRuleChange(e,"format",u)}})}renderDecimalFormatRuleInput(e,t,o,r){const{defaultDecimalFormatOptions:i}=this.props,{defaultFormatString:l}=i,c=o.formatString??"";return a.jsx("input",{className:R("form-control","flex-grow-1",{"is-invalid":r}),"data-lpignore":!0,id:t,placeholder:l??_.DEFAULT_FORMAT_STRING,type:"text",value:c,onChange:d=>{const u=_.makeFormat("",d.target.value,_.TYPE_GLOBAL,void 0);this.handleFormatRuleChange(e,"format",u)}})}render(){const{formatRulesChanged:e,formatSettings:t}=this.state,o=t.map((i,l)=>a.jsx(hs,{onEnter:this.handleFormatRuleEntered,children:this.renderFormatRule(l,i)},i.id)),r=a.jsx(w,{kind:"ghost",className:"mb-3",onClick:this.handleFormatRuleCreate,ref:this.addFormatRuleButtonRef,icon:ga,children:"Add New Rule"});return a.jsxs("div",{className:"app-settings-formatting-section",ref:this.containerRef,children:[a.jsx("div",{className:"app-settings-menu-description mb-3",children:"Customize the formatting of table columns by applying rules based on matching both a column name and column type."}),a.jsx(At,{appear:e,enter:e,exit:e,children:o}),r]})}};v(se,"defaultProps",{scrollTo:()=>{}}),v(se,"inputDebounceTime",250);let Re=se;const Zn=n=>({formatter:ds(n),defaultDecimalFormatOptions:pt(n),defaultIntegerFormatOptions:mt(n),dh:ut(n),showTimeZone:ht(n),showTSeparator:dt(n),timeZone:ct(n)}),zn=pe(Zn,{updateSettings:ne})(Re);function qn(){const n=ge(),s=ue(us),e=ue(ms),t=m.useCallback(r=>{n(ne({webgl:r}))},[n]),o=e?a.jsx(Q,{children:"WebGL in most cases has significant performance improvements, particularly when plotting large datasets. However, in some environments (such as remote desktop environments), WebGL may not use hardware acceleration and have degraded performance. If you are experiencing issues with WebGL, you can disable it here."}):a.jsx(Q,{children:"WebGL is disabled by your system administrator. Contact your system administrator to enable."});return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"app-settings-menu-description",children:"Advanced settings here. Be careful!"}),a.jsxs("div",{className:"form-row mb-3 pl-1",children:[a.jsx(ce,{isSelected:s,isDisabled:!e,onChange:t,marginEnd:"size-0",children:"Enable WebGL"}),a.jsxs(Oe,{variant:"info",marginTop:"size-50",children:[a.jsx(Pe,{children:"Enable WebGL"}),a.jsx(ke,{children:a.jsx(Q,{children:o})})]})]})]})}function Xn(){const n=ps(),s=ue(gs),e=ge(),t=m.useCallback(r=>{if(r!=="regular"&&r!=="compact"&&r!=="spacious")throw new Error(`Invalid grid density value: ${r}`);e(ne({gridDensity:r}))},[e]),o=s.gridDensity;return ae(n,"ThemeContext value is null"),a.jsxs(a.Fragment,{children:[a.jsx(Wa,{}),a.jsxs(rn,{label:"Default table density",selectedKey:o,onChange:t,children:[a.jsx(be,{children:"Regular"},"regular"),a.jsx(be,{children:"Compact"},"compact"),a.jsx(be,{children:"Spacious"},"spacious")]})]})}function Jn(){const n=ue(fs),s=ge(),{isMinimapEnabled:e,formatOnSave:t,python:{linter:o={}}={}}=n,{isEnabled:r,config:i=Ue}=o,l=m.useCallback(g=>s(oe({isMinimapEnabled:g})),[s]),c=m.useCallback(g=>s(oe({formatOnSave:g})),[s]),d=m.useCallback(g=>{s(oe({python:{linter:{...o,isEnabled:g}}})),Se.isRuffEnabled=g,Se.setRuffSettings(i)},[s,o,i]),u=m.useCallback(g=>{s(oe({python:{linter:{...o,config:JSON.stringify(g)===JSON.stringify(Ue)?void 0:g}}})),Se.setRuffSettings(g)},[s,o]),h=JSON.stringify(i,null,2),[p,D]=m.useState(!1),y=m.useCallback(()=>{D(!1)},[]),f=m.useCallback(g=>{u(g),y()},[u,y]);return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"app-settings-menu-description",children:"Customize the notebook editor."}),a.jsx("div",{className:"form-row pl-1",children:a.jsx(ce,{isSelected:e,onChange:l,children:"Enable Minimap"})}),a.jsxs("div",{className:"form-row align-items-center pl-1",children:[a.jsx(ce,{isSelected:t,onChange:c,margin:0,children:"Format on Save"}),a.jsxs(Oe,{variant:"info",children:[a.jsx(Pe,{children:"Format on Save"}),a.jsx(ke,{children:a.jsx(Q,{children:"The Ruff settings control formatting options. Notebooks can be formatted manually using the right-click context menu."})})]})]}),a.jsx("div",{className:"form-row pl-1",children:a.jsx(ce,{isSelected:r,onChange:d,marginEnd:0,children:"Enable Ruff Python Linter"})}),a.jsx("div",{className:"form-row pl-1",children:a.jsxs(_t,{onPress:()=>D(!0),children:[a.jsx(Mt,{children:a.jsx(E,{icon:fa})}),a.jsx(Q,{children:"Customize Ruff Settings"})]})}),p&&a.jsx(Ba,{text:h,isOpen:p,onClose:y,onSave:f})]})}const x=class x extends m.Component{constructor(e){super(e);v(this,"menuContentRef");v(this,"broadcastChannel");this.handleClose=this.handleClose.bind(this),this.handleScrollTo=this.handleScrollTo.bind(this),this.handleSectionToggle=this.handleSectionToggle.bind(this),this.handleExportSupportLogs=this.handleExportSupportLogs.bind(this),this.handleLogout=this.handleLogout.bind(this),this.menuContentRef=X.createRef(),this.broadcastChannel=new BroadcastChannel(Va),this.state={expandedSectionKey:x.FORMATTING_SECTION_KEY}}static focusFirstInputInContainer(e){const t=e==null?void 0:e.querySelector("input, select, textarea");t&&t.focus()}componentDidMount(){x.focusFirstInputInContainer(this.menuContentRef.current)}componentWillUnmount(){this.broadcastChannel.close()}isSectionExpanded(e){const{expandedSectionKey:t}=this.state;return t===e}handleLogout(){this.broadcastChannel.postMessage(ba(Ha))}handleScrollTo(e,t){var o;(o=this.menuContentRef.current)==null||o.scrollTo(e,t)}handleSectionToggle(e){this.setState(t=>({expandedSectionKey:t.expandedSectionKey===e?void 0:e}))}handleClose(){const{onDone:e}=this.props;e()}handleExportSupportLogs(){const{serverConfigValues:e,pluginData:t}=this.props,o=Ee(t);Ya(Sa,{uiVersion:"1.15.0",userAgent:navigator.userAgent,...Object.fromEntries(e),pluginInfo:o},va.getState())}render(){const e="https://github.com/deephaven/web-client-ui/",t="https://deephaven.io/core/docs/",{serverConfigValues:o,pluginData:r,user:i}=this.props,l=Tt(o),c=Ee(r),d=o.get("deephaven.version"),u=Z.COPY_VERSION_INFO.getDisplayText(),h=(f,g)=>a.jsxs(m.Fragment,{children:[a.jsx("div",{children:f}),a.jsx("div",{children:g})]},f),p=i.displayName??i.name,D=i.image!=null&&i.image!=="",y=p!=="";return a.jsxs("div",{className:"app-settings-menu",children:[a.jsxs("header",{className:"app-settings-menu-header",children:[a.jsxs("div",{className:"user-info",children:[a.jsxs("div",{className:"user-image",children:[!D&&a.jsx(E,{icon:ya,transform:"grow-8"}),D&&a.jsx("img",{src:i.image,alt:p})]}),a.jsxs("div",{className:"user-details",children:[y&&a.jsxs("div",{className:"user-name",children:[p,i.operateAs!=null&&i.name!==i.operateAs&&a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"font-weight-light font-italic",children:[" ","as"," "]}),a.jsxs("span",{className:"operating-as-user",children:[a.jsx(E,{icon:xa,className:"mr-1"}),i.operateAs]})]})]}),i.permissions.canLogout&&a.jsx("button",{type:"button",className:"btn btn-link",onClick:this.handleLogout,children:"logout"})]})]}),a.jsx(w,{kind:"ghost",className:"btn-close-settings-menu",onClick:this.handleClose,icon:a.jsx(E,{icon:Ca,transform:"grow-4"}),tooltip:"Close"})]}),a.jsxs("div",{className:"app-settings-menu-content",ref:this.menuContentRef,children:[a.jsx("h5",{children:"Settings"}),a.jsx("hr",{className:"my-0"}),a.jsx(H,{sectionKey:x.FORMATTING_SECTION_KEY,isExpanded:this.isSectionExpanded(x.FORMATTING_SECTION_KEY),title:a.jsxs(a.Fragment,{children:[a.jsx(E,{icon:Ta,transform:"grow-4",className:"mr-2"}),"Default Format & Time zone"]}),onToggle:this.handleSectionToggle,children:a.jsx(Mn,{})}),a.jsx(H,{sectionKey:x.COLUMN_SPECIFIC_SECTION_KEY,isExpanded:this.isSectionExpanded(x.COLUMN_SPECIFIC_SECTION_KEY),title:a.jsxs(a.Fragment,{children:[a.jsx(E,{icon:wa,transform:"grow-4",className:"mr-2"}),"Format by Column Name & Type"]}),onToggle:this.handleSectionToggle,children:a.jsx(zn,{scrollTo:this.handleScrollTo})}),a.jsx(H,{sectionKey:x.THEME_SECTION_KEY,isExpanded:this.isSectionExpanded(x.THEME_SECTION_KEY),onToggle:this.handleSectionToggle,title:a.jsxs(a.Fragment,{children:[a.jsx(E,{icon:ja,transform:"grow-4",className:"mr-2"}),"Theme"]}),children:a.jsx(Xn,{})}),a.jsx(H,{sectionKey:x.EDITOR_SECTION_KEY,isExpanded:this.isSectionExpanded(x.EDITOR_SECTION_KEY),onToggle:this.handleSectionToggle,title:a.jsxs(a.Fragment,{children:[a.jsx(E,{icon:Da,transform:"grow-4",className:"mr-2"}),"Editor"]}),children:a.jsx(Jn,{})}),a.jsx(H,{sectionKey:x.SHORTCUT_SECTION_KEY,isExpanded:this.isSectionExpanded(x.SHORTCUT_SECTION_KEY),title:a.jsxs(a.Fragment,{children:[a.jsx(E,{icon:Ea,transform:"grow-4",className:"mr-2"}),"Keyboard Shortcuts"]}),onToggle:this.handleSectionToggle,children:a.jsx(Vn,{})}),a.jsx(H,{sectionKey:x.ADVANCED_SECTION_KEY,isExpanded:this.isSectionExpanded(x.ADVANCED_SECTION_KEY),title:a.jsxs(a.Fragment,{children:[a.jsx(E,{icon:Na,transform:"grow-4",className:"mr-2"}),"Advanced"]}),onToggle:this.handleSectionToggle,children:a.jsx(qn,{})}),a.jsxs("div",{className:"app-settings-footer",children:[a.jsxs("div",{className:"app-settings-footer-section",children:[a.jsxs("div",{className:"app-settings-footer-item",children:[a.jsx("div",{className:"font-weight-bold",children:"Support"}),a.jsxs("div",{children:["GitHub: ",a.jsx("a",{href:e,className:"custom-link",target:"_blank",rel:"noopener noreferrer",children:e})]}),a.jsx(w,{kind:"tertiary",className:"mt-2 py-2",onClick:this.handleExportSupportLogs,children:"Export Logs"})]}),a.jsxs("div",{className:"app-settings-footer-item",children:[a.jsx("div",{className:"font-weight-bold",children:"Documentation"}),a.jsx("a",{target:"_blank",rel:"noreferrer noopener",href:t,className:"custom-link",children:t})]}),a.jsxs("div",{className:"app-settings-footer-item",children:[a.jsx("div",{className:"font-weight-bold",children:"Version"}),a.jsxs("span",{className:"d-inline-block text-muted",children:[d,a.jsxs(Oe,{variant:"info",children:[a.jsx(Pe,{children:"Version Info"}),a.jsxs(ke,{children:[a.jsx("div",{className:"detailed-server-config",children:Object.entries(l).map(([f,g])=>h(f,g))}),a.jsxs(bs,{copy:Object.entries({...l,...c}).map(([f,g])=>`${f}: ${g}`).join(`
4
+ `),children:["Copy Versions"," ",a.jsxs("small",{className:"text-muted",children:["(",u,")"]})]})]})]})]})]}),a.jsxs("div",{className:"app-settings-footer-item",children:[a.jsx("div",{className:"font-weight-bold",children:"Plugins"}),a.jsx("div",{className:"container",children:Array.from(r.entries()).filter(f=>f[1].version!==void 0).map(([f,g])=>a.jsxs("div",{className:"row justify-content-start align-items-center",children:[a.jsx("div",{className:"col pl-0",children:a.jsx("span",{className:"my-0 text-truncate",children:f})}),a.jsx("div",{className:"col-auto",children:a.jsx("span",{children:g==null?void 0:g.version})})]},f))})]}),a.jsx("div",{className:"app-settings-footer-item",children:a.jsx(Un,{})})]}),a.jsx("div",{className:"app-settings-footer-section",children:a.jsx("a",{target:"_blank",rel:"noreferrer noopener",href:"https://deephaven.io",style:{display:"block",width:"61.8%"},children:a.jsx(St,{})})})]})]})]})}};v(x,"defaultProps",{onDone:()=>{}}),v(x,"FORMATTING_SECTION_KEY","SettingsMenu.formatting"),v(x,"COLUMN_SPECIFIC_SECTION_KEY","SettingsMenu.columnFormatting"),v(x,"APPLICATION_SECTION_KEY","ApplicationMenu.settings"),v(x,"SHORTCUT_SECTION_KEY","SettingsMenu.shortcuts"),v(x,"THEME_SECTION_KEY","SettingsMenu.theme"),v(x,"ADVANCED_SECTION_KEY","SettingsMenu.advanced"),v(x,"EDITOR_SECTION_KEY","SettingsMenu.editor");let Ie=x;const at=10;function le(n){const{forwardedProps:s}=n;ae(s,"DragSourceMenuItem forwardedProps");const{menuItem:{action:e,title:t,disabled:o},iconElement:r,displayShortcut:i,isMouseSelected:l,isKeyboardSelected:c,closeMenu:d}=s,u=m.useRef(),h=m.useRef(),p=m.useRef(null),[D,y]=m.useState(!1),f=m.useCallback(C=>{u.current!=null&&h.current!=null&&p.current&&(Math.abs(u.current-C.clientX)>=at||Math.abs(h.current-C.clientY)>=at)&&(y(!0),window.removeEventListener("mousemove",f),d(),e(C),p.current=null)},[e,d]);function g(C){u.current=C.clientX,h.current=C.clientY,p.current=C.target,window.addEventListener("mousemove",f)}function k(C){p.current===C.target&&(y(!0),d(),e(),window.removeEventListener("mousemove",f)),p.current=null}return m.useEffect(function(){return function(){return window.removeEventListener("mousemove",f)}},[f]),a.jsxs("button",{type:"button",className:R("btn-context-menu",{disabled:o},{active:l&&!o},{"keyboard-active":c&&!o}),onMouseDown:g,onMouseUp:k,disabled:D,children:[a.jsx("span",{className:R("icon"),children:r}),a.jsx("span",{className:"title",children:t}),a.jsx("span",{className:"shortcut",children:i})]})}function Qn(n){const{handleControlSelect:s,handleToolSelect:e,onClearFilter:t}=n,o=m.useMemo(()=>[{title:"Input Filter",icon:Fa,menuElement:a.jsx(le,{}),action:r=>{s(K.INPUT_FILTER,r)},order:10},{title:"Dropdown Filter",icon:Ra,menuElement:a.jsx(le,{}),action:r=>{s(K.DROPDOWN_FILTER,r)},order:15},{title:"Markdown Widget",icon:Ia,menuElement:a.jsx(le,{}),action:r=>{s(K.MARKDOWN,r)},order:20},{title:"Filter Sets",icon:Oa,menuElement:a.jsx(le,{}),action:r=>{s(K.FILTER_SET_MANAGER,r)},order:25},{disabled:!0,menuElement:a.jsx("div",{className:"context-menu-group-header",children:"Tools"}),order:30},{title:"Linker",icon:ka,action:()=>{e(me.LINKER)},order:40,shortcut:Z.LINKER},{disabled:!0,menuElement:a.jsx("div",{className:"context-menu-group-header",children:"Actions"}),order:50},{title:"Clear All Filters",icon:La,action:()=>{t()},order:60,shortcut:yt.TABLE.CLEAR_ALL_FILTERS}],[s,e,t]);return a.jsx(vs,{popperClassName:"controls-menu-popper",actions:o})}const eo=Pa(Ct,null),to={layoutStorage:eo},so=n=>n.layoutStorage,ao=n=>n.serverConfigValues;Object.entries(to).map(([n,s])=>Aa.register(n,s));const nt=10;function no(n){const{onExportLayout:s,onImportLayout:e,onResetLayout:t,onSelect:o,widgets:r=[]}=n,[i,l]=m.useState(!1),[c,d]=m.useState(""),u=m.useRef(null),h=m.useRef(),p=m.useCallback((b,S)=>{b!=null&&o(b,S)},[o]),D=m.useCallback(b=>{d(b.target.value)},[]),y=m.useCallback(b=>{h.current!=null&&(Math.abs(h.current.x-b.clientX)>=nt||Math.abs(h.current.y-b.clientY)>=nt)&&(l(!0),window.removeEventListener("mousemove",y),p(h.current.widget,b),h.current=void 0)},[h,p]),f=m.useCallback((b,S)=>{h.current={x:b.clientX,y:b.clientY,widget:S},window.addEventListener("mousemove",y)},[y]),g=m.useCallback((b,S)=>{var U;window.removeEventListener("mousemove",y),((U=h.current)==null?void 0:U.widget)===S&&(l(!0),p(S)),h.current=void 0},[y,h,p]),k=m.useMemo(()=>r.filter(b=>{var S;return c?(S=b.name)==null?void 0:S.toLowerCase().includes(c.toLowerCase()):!0}),[c,r]).sort((b,S)=>{var U;return((U=b.name)==null?void 0:U.localeCompare(S.name??""))??0}),C=m.useMemo(()=>k.map(b=>a.jsx("li",{children:a.jsxs(w,{kind:"ghost","data-testid":`panel-list-item-${b.name??""}-button`,onMouseDown:S=>{f(S,b)},onMouseUp:S=>{g(S,b)},onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&p(b)},disabled:i,onClick:()=>{},children:[a.jsx(Ss,{type:b.type})," ",b.name??""]})},b.name)),[k,i,f,g,p]),T=m.useMemo(()=>C.length===0?a.jsx("span",{children:"No bound variables found."}):null,[C]);return a.jsxs("div",{className:"widget-list-container d-flex flex-column",children:[a.jsx("div",{className:"widget-list-header",children:a.jsx(ys,{value:c,placeholder:"Find Table, Plot or Widget",onChange:D,ref:u})}),a.jsxs("ul",{className:"widget-list flex-grow-1",children:[T&&a.jsx("li",{className:"widget-list-message",children:T}),!T&&C]}),a.jsx("div",{children:a.jsx("hr",{})}),a.jsxs("div",{className:"widget-list-footer",children:[a.jsxs(w,{kind:"ghost",onClick:s,children:[a.jsxs("div",{className:"fa-md fa-layers mr-1",children:[a.jsx(E,{mask:Ge,icon:$e,transform:"right-5 down-5"}),a.jsx(E,{icon:$e,transform:"right-8 down-6"})]}),"Export Layout"]}),a.jsxs(w,{kind:"ghost",onClick:e,children:[a.jsxs("div",{className:"fa-md fa-layers mr-1",children:[a.jsx(E,{mask:Ge,icon:We,transform:"right-5 down-5"}),a.jsx(E,{icon:We,transform:"right-8 down-6"})]}),"Import Layout"]}),a.jsx(w,{kind:"ghost",icon:z,onClick:t,tooltip:"Reset Layout"})]})]})}function oo({onAutoFillClick:n=()=>{}}){return a.jsxs("div",{className:"empty-dashboard-container",children:[a.jsxs("div",{className:"hint-container",children:[a.jsx(E,{icon:_a})," ",a.jsx("br",{}),"Use the panel list to add objects from a query."]}),a.jsxs("div",{className:"empty-dashboard",children:[a.jsx("div",{className:"add-panels-hint",children:"Drag Panels Here"}),a.jsx(w,{kind:"tertiary",onClick:n,children:"Auto fill objects"})]})]})}const N=$.module("AppMainContainer");class ee extends m.Component{constructor(e){super(e);v(this,"dashboardLayouts");v(this,"createDashboardListenerRemovers");v(this,"closeDashboardListenerRemovers");v(this,"importElement");v(this,"widgetListenerRemover");v(this,"getDashboardPlugins",Wt(e=>za(e)));Is(this),this.importElement=X.createRef();const{allDashboardData:t,serverConfigValues:o,plugins:r}=this.props;this.dashboardLayouts=new Map,this.createDashboardListenerRemovers=new Map,this.closeDashboardListenerRemovers=new Map,this.state={contextActions:[Za({uiVersion:"1.15.0",userAgent:navigator.userAgent,...Object.fromEntries(o),pluginInfo:Ee(r)},!1),{action:()=>{const i=Tt(o),l=Object.entries(i).map(([c,d])=>`${c}: ${d}`).join(`
5
+ `);Os(l)},shortcut:Z.COPY_VERSION_INFO,isGlobal:!0},{action:()=>{this.handleToolSelect(me.LINKER)},shortcut:Z.LINKER,isGlobal:!0},{action:()=>{this.sendClearFilter()},shortcut:yt.TABLE.CLEAR_ALL_FILTERS,isGlobal:!0},{action:()=>{this.sendCycleStackForward()},shortcut:V.CYCLE_TO_NEXT_STACK,isGlobal:!0},{action:()=>{this.sendCycleStackBackward()},shortcut:V.CYCLE_TO_PREVIOUS_STACK,isGlobal:!0},{action:()=>{this.sendCycleTabForward()},shortcut:V.CYCLE_TO_NEXT_TAB,isGlobal:!0},{action:()=>{this.sendCycleTabBackward()},shortcut:V.CYCLE_TO_PREVIOUS_TAB,isGlobal:!0},{action:()=>{this.handleCycleDashboardForward()},shortcut:V.CYCLE_TO_NEXT_DASHBOARD,isGlobal:!0},{action:()=>{this.handleCycleDashboardBackward()},shortcut:V.CYCLE_TO_PREVIOUS_DASHBOARD,isGlobal:!0},{action:()=>{this.sendReopenLast()},shortcut:Z.REOPEN_CLOSED_PANEL,isGlobal:!0},{action:()=>{N.debug("Consume unhandled save shortcut")},shortcut:Z.SAVE,isGlobal:!0}],isPanelsMenuShown:!1,isResetLayoutPromptShown:!1,isSettingsMenuShown:!1,unsavedNotebookCount:0,widgets:[],tabs:Object.entries(t).map(([i,l])=>({key:i,title:l.title??"Untitled",isClosable:i!==j,icon:i===j?Ma:void 0})),activeTabKey:j,layoutIteration:0}}static handleWindowBeforeUnload(e){e.preventDefault(),e.returnValue=""}static hydrateConsole(e,t){return Rs.hydrate({...e,unzip:o=>Kt.loadAsync(o).then(r=>Object.values(r.files))},t)}static handleRefresh(){N.info("Refreshing application"),window.location.reload()}componentDidMount(){this.initWidgets(),this.initDashboardData(),window.addEventListener("beforeunload",ee.handleWindowBeforeUnload)}componentDidUpdate(e,t){const{dashboardData:o}=this.props;e.dashboardData!==o&&this.handleDataChange(o)}componentWillUnmount(){this.deinitWidgets(),this.createDashboardListenerRemovers.forEach(e=>e()),this.closeDashboardListenerRemovers.forEach(e=>e()),window.removeEventListener("beforeunload",ee.handleWindowBeforeUnload)}initWidgets(){const{connection:e}=this.props;if(e!=null){if(e.subscribeToFieldUpdates==null){N.warn("subscribeToFieldUpdates not supported, not initializing widgets");return}this.widgetListenerRemover=e.subscribeToFieldUpdates(t=>{N.debug("Got updates",t),this.setState(({widgets:o})=>{const{updated:r,created:i,removed:l}=t,c=[...r,...l],d=o.filter(h=>!c.some(p=>p.name===h.name));return[...r,...i].forEach(h=>{h.name!=null&&h.name!==""&&d.push(h)}),{widgets:d}})})}}deinitWidgets(){var e;(e=this.widgetListenerRemover)==null||e.call(this)}initDashboardData(){const{setDashboardPluginData:e,updateDashboardData:t,workspace:o}=this.props,{data:r}=o,{filterSets:i,links:l,pluginDataMap:c}=r;if(t(j,{filterSets:i,links:l}),c!=null){const d=Object.keys(c);for(let u=0;u<d.length;u+=1){const h=d[u],p=c[h];N.debug("initDashboardData plugin data",h,p),e(j,h,p)}}}openNotebookFromURL(){const{match:e}=this.props,{notebookPath:t}=e.params;if(t){const{session:o,sessionConfig:r}=this.props;if(o==null||r==null){N.error("No session available to open notebook URL",t);return}const i={id:`/${t}`,itemName:`/${t}`},l=r.type,c={value:null,language:l};this.emitLayoutEvent(ks.SELECT_NOTEBOOK,o,l,c,i,!0)}}sendClearFilter(){this.emitLayoutEvent(re.CLEAR_ALL_FILTERS)}sendCycleStackForward(){Ls(this.getActiveEventHub())}sendCycleStackBackward(){Ps(this.getActiveEventHub())}sendCycleTabForward(){As(this.getActiveEventHub())}sendCycleTabBackward(){_s(this.getActiveEventHub())}sendReopenLast(){this.emitLayoutEvent(Ms.REOPEN_LAST)}cycleDashboard(e){const{tabs:t,activeTabKey:o}=this.state;if(t.length<=1)return;const r=t.findIndex(c=>c.key===o);if(r===-1)return;const i=e===0?(r+1)%t.length:(r-1+t.length)%t.length,l=t[i];this.handleTabSelect(l.key)}handleCycleDashboardForward(){this.cycleDashboard(0)}handleCycleDashboardBackward(){this.cycleDashboard(1)}getActiveEventHub(){const{activeTabKey:e}=this.state,t=this.dashboardLayouts.get(e);return ae(t,"No active layout found"),t.eventHub}emitLayoutEvent(e,...t){this.getActiveEventHub().emit(e,...t)}handleCancelResetLayoutPrompt(){this.setState({isResetLayoutPromptShown:!1})}handleConfirmResetLayoutPrompt(){this.setState({isResetLayoutPromptShown:!1}),this.resetLayout()}handleError(e){Y.isCanceled(e)||N.error(e)}handleSettingsMenuHide(){this.setState({isSettingsMenuShown:!1})}handleSettingsMenuShow(){this.setState({isSettingsMenuShown:!0})}handleControlSelect(e,t){switch(N.debug("handleControlSelect",e),e){case K.DROPDOWN_FILTER:this.emitLayoutEvent(re.OPEN_DROPDOWN,{title:"DropdownFilter",type:e,createNewStack:!0,dragEvent:t});break;case K.INPUT_FILTER:this.emitLayoutEvent(re.OPEN_INPUT,{title:"InputFilter",type:e,createNewStack:!0,dragEvent:t});break;case K.MARKDOWN:this.emitLayoutEvent(Us.OPEN,{title:"Markdown",type:e,dragEvent:t});break;case K.FILTER_SET_MANAGER:this.emitLayoutEvent(re.OPEN_FILTER_SET_MANAGER,{title:"FilterSets",type:e,dragEvent:t});break;default:throw new Error(`Unrecognized control type ${e}`)}}handleToolSelect(e){N.debug("handleToolSelect",e);const{activeTool:t,setActiveTool:o}=this.props;o(t===e?me.DEFAULT:e)}handleClearFilter(){this.sendClearFilter()}handleDataChange(e){const{updateWorkspaceData:t}=this.props,{closed:o,filterSets:r,links:i,pluginDataMap:l}=e;t({closed:o,filterSets:r,links:i,pluginDataMap:l})}handleGoldenLayoutChange(e){var r,i;const{activeTabKey:t}=this.state,o=this.dashboardLayouts.get(t);o!==e&&(this.dashboardLayouts.set(t,e),o!=null&&((r=this.createDashboardListenerRemovers.get(t))==null||r(),(i=this.closeDashboardListenerRemovers.get(t))==null||i()),this.createDashboardListenerRemovers.set(t,Ks(e.eventHub,this.handleCreateDashboard)),this.closeDashboardListenerRemovers.set(t,$s(e.eventHub,this.handleCloseDashboard)))}handleCreateDashboard({pluginId:e,title:t,data:o}){const r=$t(),{setDashboardPluginData:i}=this.props;i(r,e,o),this.setState(({tabs:l})=>{const c=l.findIndex(({title:d})=>d===t);return c!==-1?{tabs:l.map((d,u)=>u===c?{key:r,title:t}:d),activeTabKey:r}:{tabs:[...l,{key:r,title:t}],activeTabKey:r}})}handleCloseDashboard(e){const{tabs:t}=this.state,o=t.find(r=>r.title===e);o!=null&&this.handleTabClose(o.key)}handleWidgetMenuClick(){this.setState(({isPanelsMenuShown:e})=>({isPanelsMenuShown:!e}))}handleWidgetSelect(e,t){this.setState({isPanelsMenuShown:!1}),N.debug("handleWidgetSelect",e,t),this.openWidget(e,t)}handleWidgetsMenuClose(){this.setState({isPanelsMenuShown:!1})}handleAutoFillClick(){const{widgets:e}=this.state;N.debug("handleAutoFillClick",e);const t=e.sort((o,r)=>o.title!=null&&r.title!=null?o.title.localeCompare(r.title):0);for(let o=0;o<t.length;o+=1)this.openWidget(t[o])}handleExportLayoutClick(){N.debug("handleExportLayoutClick"),this.setState({isPanelsMenuShown:!1});try{const{workspace:e}=this.props,{data:t}=e,o=ye.exportLayout(t);N.debug("handleExportLayoutClick exportedConfig",o);const r=new Blob([JSON.stringify(o)],{type:"application/json"}),i=Fn.i18n.DateTimeFormat.format("yyyy-MM-dd-HHmmss",new Date),l=document.createElement("a");l.href=URL.createObjectURL(r),l.download=`deephaven-app-layout-${i}.json`,l.click()}catch(e){N.error("Unable to export layout",e)}}handleImportLayoutClick(){N.debug("handleImportLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.importElement.current!=null&&(this.importElement.current.value="",this.importElement.current.click())}handleResetLayoutClick(){N.debug("handleResetLayoutClick"),this.setState({isPanelsMenuShown:!1,isResetLayoutPromptShown:!0,unsavedNotebookCount:Gs.unsavedNotebookCount()})}handleImportLayoutFiles(e){var t;e.stopPropagation(),e.preventDefault(),e.target.files!=null&&this.importLayoutFile((t=e.target.files)==null?void 0:t[0])}async importLayoutFile(e){try{const{updateDashboardData:t,updateWorkspaceData:o}=this.props,r=await e.text(),i=JSON.parse(r),{filterSets:l,layoutConfig:c,links:d,pluginDataMap:u}=ye.normalizeLayout(i);Gt.flushSync(()=>{o({layoutConfig:c}),t(j,{filterSets:l,links:d,pluginDataMap:u})}),this.setState(({layoutIteration:h})=>({layoutIteration:h+1}))}catch(t){N.error("Unable to import layout",t)}}async resetLayout(){const{layoutStorage:e,session:t}=this.props,{filterSets:o,layoutConfig:r,links:i}=await ye.getDefaultLayout(e,t!==void 0),{updateDashboardData:l,updateWorkspaceData:c}=this.props;c({layoutConfig:r}),l(j,{filterSets:o,links:i})}handlePaste(e){if(e.target instanceof HTMLElement&&e.target.closest(".monaco-editor"))return;const{clipboardData:t}=e,o=t.getData("Text"),r=/“|”/g;r.test(o)&&(e.preventDefault(),e.stopPropagation(),document.execCommand("insertText",!1,o.replace(r,'"')))}openWidget(e,t){const{connection:o}=this.props;Ws(this.getActiveEventHub(),{widget:Bs(e),dragEvent:t,fetch:async()=>o==null?void 0:o.getObject(e)})}handleHomeClick(){this.handleTabSelect(j)}handleTabSelect(e){this.setState({activeTabKey:e})}handleTabReorder(e,t){this.setState(({tabs:o})=>{const r=[...o],[i]=r.splice(e,1);return r.splice(t,0,i),{tabs:r}})}handleTabClose(e){this.setState(({tabs:t,activeTabKey:o})=>{const r=t.filter(l=>l.key!==e);let i=o;if(o===e&&r.length>0){const l=t.findIndex(c=>c.key===e);i=l<t.length-1?t[l+1].key:t[l-1].key}return r.length===0&&(i=j),{tabs:r,activeTabKey:i}})}getDashboards(){const{layoutIteration:e,tabs:t}=this.state,{allDashboardData:o,workspace:r}=this.props,{data:i}=r,{layoutConfig:l}=i;return[{id:j,layoutConfig:l,key:`${j}-${e}`},...t.filter(c=>c.key!==j).map(c=>{var d;return{id:c.key,layoutConfig:((d=o[c.key])==null?void 0:d.layoutConfig)??Vs,key:`${c.key}-${e}`}})]}render(){const{activeTool:e,plugins:t,user:o,serverConfigValues:r}=this.props,{permissions:i}=o,{canUsePanels:l}=i,{contextActions:c,isPanelsMenuShown:d,isResetLayoutPromptShown:u,isSettingsMenuShown:h,unsavedNotebookCount:p,widgets:D,tabs:y,activeTabKey:f}=this.state,g=this.getDashboardPlugins(t);return a.jsxs("div",{className:R("app-main-tabs","w-100","h-100","d-flex","flex-column",e?`active-tool-${e.toLowerCase()}`:""),onPaste:this.handlePaste,tabIndex:-1,children:[a.jsxs("div",{className:"app-main-top-nav-menus",children:[a.jsx(St,{className:"ml-1",style:{maxHeight:"20px"}}),y.length>1&&a.jsx("div",{style:{flexShrink:0,flexGrow:1,flexBasis:0,minWidth:0},children:a.jsx(qa,{tabs:y,activeKey:f,onSelect:this.handleTabSelect,onReorder:this.handleTabReorder,onClose:this.handleTabClose})}),a.jsxs("div",{className:"app-main-right-menu-buttons",children:[a.jsxs(w,{kind:"ghost",className:"btn-panels-menu",icon:Ua,onClick:()=>{},children:["Controls",a.jsx(Qn,{handleControlSelect:this.handleControlSelect,handleToolSelect:this.handleToolSelect,onClearFilter:this.handleClearFilter})]}),l&&a.jsxs(w,{kind:"ghost",className:"btn-panels-menu btn-show-panels","data-testid":"app-main-panels-button",onClick:this.handleWidgetMenuClick,icon:Ka,children:["Panels",a.jsx(Hs,{isShown:d,className:"panels-menu-popper",onExited:this.handleWidgetsMenuClose,options:{placement:"bottom"},closeOnBlur:!0,interactive:!0,children:a.jsx(no,{widgets:D,onExportLayout:this.handleExportLayoutClick,onImportLayout:this.handleImportLayoutClick,onResetLayout:this.handleResetLayoutClick,onSelect:this.handleWidgetSelect})})]}),a.jsx(w,{kind:"ghost",className:R("btn-settings-menu",{"text-warning":o.operateAs!=null&&o.operateAs!==o.name}),onClick:this.handleSettingsMenuShow,icon:a.jsx("span",{className:"fa-layers",children:a.jsx(E,{icon:$a,transform:"grow-3"})}),tooltip:"User Settings"})]})]}),a.jsx(Xa,{dashboards:this.getDashboards(),activeDashboard:f,onGoldenLayoutChange:this.handleGoldenLayoutChange,emptyDashboard:f===j?a.jsx(oo,{onAutoFillClick:this.handleAutoFillClick}):a.jsx(vt,{"data-testid":"app-main-container-loading"}),plugins:[a.jsx(Ys,{hydrateConsole:ee.hydrateConsole,notebooksUrl:new URL("notebooks/",document.baseURI).href},"ConsolePlugin"),...g]}),a.jsx(ln,{in:h,mountOnEnter:!0,unmountOnExit:!0,children:a.jsx(Ie,{serverConfigValues:r,pluginData:t,onDone:this.handleSettingsMenuHide,user:o})}),a.jsx(Zs,{actions:c}),a.jsx("input",{ref:this.importElement,type:"file",accept:".json",style:{display:"none"},onChange:this.handleImportLayoutFiles,"data-testid":"input-import-layout"}),a.jsx(zs,{confirmButtonText:"Reset",onConfirm:this.handleConfirmResetLayoutPrompt,onCancel:this.handleCancelResetLayoutPrompt,isConfirmDanger:!0,isOpen:u,headerText:p===0?"Reset Layout":"Reset layout and discard unsaved changes",bodyText:p===0?"Do you want to reset your layout? Your existing layout will be lost.":"Do you want to reset your layout? Any unsaved notebooks will be lost."})]})}}const ro=n=>{var s,e;return{activeTool:Ds(n),allDashboardData:js(n),dashboardData:ws(n,j),layoutStorage:so(n),plugins:Ts(n),connection:Cs(n,j),session:(s=Ke(n,j))==null?void 0:s.session,sessionConfig:(e=Ke(n,j))==null?void 0:e.config,user:xs(n),workspace:gt(n),serverConfigValues:ao(n)}},io=pe(ro,{setActiveTool:bt,setDashboardData:ft,setDashboardPluginData:Fs,updateDashboardData:Ns,updateWorkspaceData:Es})(Ut(ee));function lo(){return a.jsxs("div",{className:"app","data-testid":"app-loaded",children:[a.jsx(io,{}),a.jsx(Bt,{})]})}const co=$.module("AppInit");function ot(){const n=lt(),s=Ja(),e=Qa(),t=qs(),o=en(),r=tn(),i=Vt(gt),l=ge(),[c,d]=m.useState();m.useEffect(function(){l(Xs(t))},[t,l]),m.useEffect(function(){async function y(){try{const f=await sn(),g=await an(n,e,f),k=s.getStorageService(),C=new nn(k,"/layouts"),T=new on(n,k,"/notebooks"),b=new Be(C),S=new En,U=await b.load({isConsoleAvailable:g!==void 0}),{data:fe}=U,{settings:Et}=fe,{shortcutOverrides:Ae={}}=Et,Nt=P.isMacPlatform?Ae.mac??{}:Ae.windows??{};Object.entries(Nt).forEach(([Rt,It])=>{var _e;(_e=Le.get(Rt))==null||_e.setKeyState(It)});const Ft={title:"Code Studio",filterSets:fe.filterSets,links:fe.links};l(Js(n)),l(bt(me.DEFAULT)),l(Qs(o)),l(ea(S)),l(ft(j,Ft)),l(ta(T)),l(Nn(C)),l(sa(j,e)),g!==void 0&&l(aa(j,g)),l(na(r)),l(oa(b)),l(ra(U)),l(ia(Be.makeDefaultWorkspaceSettings(o)))}catch(f){co.error(f),d(f)}}y()},[n,s,e,o,l,r]);const u=i==null&&c==null,h=!u&&c==null,p=c!=null?`${c}`:null;return a.jsxs(a.Fragment,{children:[h&&a.jsx(lo,{}),a.jsx(vt,{"data-testid":"app-init-loading",isLoading:u&&p==null,isLoaded:h,errorMessage:p})]})}const ho=X.lazy(()=>zt(()=>import("./StyleGuideRoot-DwIVk99V.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]),import.meta.url)),uo=new URL(document.baseURI).pathname.replace(/\/$/,"");function mo(){return a.jsx(Ht,{basename:uo,children:a.jsxs(Yt,{children:[a.jsx(ve,{exact:!0,path:"/",component:ot}),a.jsx(ve,{path:"/notebooks/:notebookPath+",component:ot}),a.jsx(ve,{path:"/styleguide",component:ho}),a.jsx(Zt,{from:"*",to:"/"})]})})}function wo(){return m.useEffect(function(){cn.register(new URL("./download/serviceWorker.js",window.location.href)),la.init({getWorker:(s,e)=>e==="json"?new qt:new Xt}),window["__@hello-pangea/dnd-disable-dev-warnings"]=!0},[]),a.jsx(mo,{})}export{wo as AppRoot,wo as default};
6
+ //# sourceMappingURL=AppRoot-DE9mL1iQ.js.map