@deephaven/code-studio 1.5.2-beta.1 → 1.5.3-beta.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-B08JVIQj.js → AppRoot-DnN_zkOP.js} +6 -6
  2. package/build/assets/{AppRoot-B08JVIQj.js.map → AppRoot-DnN_zkOP.js.map} +1 -1
  3. package/build/assets/{Chart-CGbEbOJy.js → Chart-jUTtSgHR.js} +2 -2
  4. package/build/assets/{Chart-CGbEbOJy.js.map → Chart-jUTtSgHR.js.map} +1 -1
  5. package/build/assets/{ControlType-DJOtq8vz.js → ControlType-BjxAIldT.js} +4 -4
  6. package/build/assets/{ControlType-DJOtq8vz.js.map → ControlType-BjxAIldT.js.map} +1 -1
  7. package/build/assets/{FontBootstrap-DOFQMrNb.js → FontBootstrap-Chn0Co64.js} +2 -2
  8. package/build/assets/{FontBootstrap-DOFQMrNb.js.map → FontBootstrap-Chn0Co64.js.map} +1 -1
  9. package/build/assets/{FormatterUtils-DizByZGG.js → FormatterUtils-CB8U65Fw.js} +2 -2
  10. package/build/assets/{FormatterUtils-DizByZGG.js.map → FormatterUtils-CB8U65Fw.js.map} +1 -1
  11. package/build/assets/{Grid-l9D4ghJL.js → Grid-e4StjlLs.js} +2 -2
  12. package/build/assets/{Grid-l9D4ghJL.js.map → Grid-e4StjlLs.js.map} +1 -1
  13. package/build/assets/{GridTokenMouseHandler-CVLlE8WT.js → GridTokenMouseHandler-D0Pqy2Vo.js} +2 -2
  14. package/build/assets/{GridTokenMouseHandler-CVLlE8WT.js.map → GridTokenMouseHandler-D0Pqy2Vo.js.map} +1 -1
  15. package/build/assets/{IrisGrid-BIvYhzJQ.js → IrisGrid-DmsHkaci.js} +2 -2
  16. package/build/assets/{IrisGrid-BIvYhzJQ.js.map → IrisGrid-DmsHkaci.js.map} +1 -1
  17. package/build/assets/{IrisGridModel-BlhUV7bG.js → IrisGridModel-Bzvq9WcQ.js} +3 -3
  18. package/build/assets/{IrisGridModel-BlhUV7bG.js.map → IrisGridModel-Bzvq9WcQ.js.map} +1 -1
  19. package/build/assets/{IrisGridShortcuts-BNBGT-FV.js → IrisGridShortcuts-C5MgzGK1.js} +2 -2
  20. package/build/assets/{IrisGridShortcuts-BNBGT-FV.js.map → IrisGridShortcuts-C5MgzGK1.js.map} +1 -1
  21. package/build/assets/{IrisGridThemeProvider-Cf_aCT8X.js → IrisGridThemeProvider-vaa6FhP7.js} +2 -2
  22. package/build/assets/{IrisGridThemeProvider-Cf_aCT8X.js.map → IrisGridThemeProvider-vaa6FhP7.js.map} +1 -1
  23. package/build/assets/{LocalWorkspaceStorage-CGJoIjbX.js → LocalWorkspaceStorage-CGH1Yjce.js} +2 -2
  24. package/build/assets/{LocalWorkspaceStorage-CGJoIjbX.js.map → LocalWorkspaceStorage-CGH1Yjce.js.map} +1 -1
  25. package/build/assets/{MarkdownEditor-DvIGzKlZ.js → MarkdownEditor-DfCediWn.js} +2 -2
  26. package/build/assets/{MarkdownEditor-DvIGzKlZ.js.map → MarkdownEditor-DfCediWn.js.map} +1 -1
  27. package/build/assets/{MarkdownNotebook-CAbg9E1X.js → MarkdownNotebook-eDIke6mp.js} +2 -2
  28. package/build/assets/{MarkdownNotebook-CAbg9E1X.js.map → MarkdownNotebook-eDIke6mp.js.map} +1 -1
  29. package/build/assets/{MissingPartitionError-DEh8fUT1.js → MissingPartitionError-oMrSgve_.js} +2 -2
  30. package/build/assets/{MissingPartitionError-DEh8fUT1.js.map → MissingPartitionError-oMrSgve_.js.map} +1 -1
  31. package/build/assets/{StyleGuideRoot-yJYmcGh-.js → StyleGuideRoot-DhvCRjxL.js} +2 -2
  32. package/build/assets/{StyleGuideRoot-yJYmcGh-.js.map → StyleGuideRoot-DhvCRjxL.js.map} +1 -1
  33. package/build/assets/{index-q9scxjIl.js → index-B7tTNjnG.js} +4 -4
  34. package/build/assets/{index-q9scxjIl.js.map → index-B7tTNjnG.js.map} +1 -1
  35. package/build/assets/{index-DVJ_ffyU.js → index-C0nHnUAm.js} +2 -2
  36. package/build/assets/{index-DVJ_ffyU.js.map → index-C0nHnUAm.js.map} +1 -1
  37. package/build/assets/{index-CQSiWoCx.js → index-D7WLNVvn.js} +3 -3
  38. package/build/assets/{index-CQSiWoCx.js.map → index-D7WLNVvn.js.map} +1 -1
  39. package/build/index.html +2 -2
  40. package/package.json +31 -31
@@ -1,6 +1,6 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./StyleGuideRoot-yJYmcGh-.js","./vendor-BFFhZ99Y.js","./helpers-BosuxZz1.js","./vendor-vyKkiikc.css","./index-CQSiWoCx.js","./monaco-CsU3t3B1.js","./monaco-CgHo24-M.css","./index-CDBsexMR.css","./IrisGridModel-BlhUV7bG.js","./ControlType-DJOtq8vz.js","./ControlType-CMNdrk88.css","./IrisGridModel-CSTdZTzd.css","./FontBootstrap-DOFQMrNb.js","./GridTokenMouseHandler-CVLlE8WT.js","./IrisGridShortcuts-BNBGT-FV.js","./useMergeRef-CjjDys44.js","./IrisGridShortcuts-CJtrNKDP.css","./GridTokenMouseHandler-DTMTgCrk.css","./LocalWorkspaceStorage-CGJoIjbX.js","./LocalWorkspaceStorage-C_d9_CEf.css","./FontBootstrap-Bv630utO.css","./Grid-l9D4ghJL.js","./Grid-DPUNpG8i.css","./StyleGuideRoot-BXf6u3u6.css"])))=>i.map(i=>d[i]);
2
- var Lt=Object.defineProperty;var Pt=(a,s,e)=>s in a?Lt(a,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[s]=e;var v=(a,s,e)=>Pt(a,typeof s!="symbol"?s+"":s,e);import{W as lt,X as At,Y as _t,r as m,I as n,Z as ge,_ as ct,U as Q,a0 as De,L as I,a1 as E,M as N,a2 as Mt,a3 as fe,a4 as ce,a5 as ke,a6 as Le,a7 as ve,a8 as Ut,a9 as Kt,aa as $t,ab as Gt,H as Wt,ac as Bt,ad as Vt,ae as Ht,af as Yt,ag as Zt,ah as Se,ai as qt}from"./vendor-BFFhZ99Y.js";import{_ as zt,W as Xt,a as Jt}from"./monaco-CsU3t3B1.js";import{O as de,P as Z,T as P,D as Qt,I as _,a as M,b as V,u as dt,F as es,c as R,d as ts,e as oe,S as he,B as C,C as H,g as ss,f as ht,h as ut,i as mt,j as pt,k as gt,l as ns,m as as,n as os,o as rs,p as ft,q as is,r as A,s as Pe,t as ls,K as cs,v as Ke,w as ds,x as hs,y as us,z as ue,A as ms,E as ps,G as gs,H as fs,J as bs,L as re,M as ye,R as $e,N as q,Q as vs,U as G,V as me,W as Ss,X as ys,Y as xs,Z as bt,_ as vt,$ as Cs,a0 as Ts,a1 as ws,a2 as js,a3 as Ds,a4 as Es,a5 as Ns,a6 as Fs,a7 as Ge,a8 as Rs,a9 as St,aa as Is,ab as Os,ac as ks,ad as D,ae as Ls,af as ie,ag as Ps,ah as As,ai as _s,aj as Ms,ak as Us,al as Ks,am as $s,an as Gs,ao as Ws,ap as Bs,aq as Vs,ar as Hs,as as Ys,at as Zs,au as qs,av as zs,aw as Xs,ax as Js,ay as Qs,az as en,aA as tn,aB as sn,aC as nn,aD as an,aE as on,aF as rn,aG as ln,aH as cn,aI as dn}from"./ControlType-DJOtq8vz.js";import{L as W,v as z,a as hn,M as un,b as mn,c as pn,d as gn,e as pe,f as fn,g as bn,h as vn,m as Sn,s as yn,l as xn,i as Cn,j as Tn,k as wn,n as jn,o as Dn,p as En,q as Nn,r as Fn,t as Rn,u as In,w as On,x as kn,y as Ln,z as Pn,A as An,B as _n,C as Mn,D as We,E as Be,F as Ve,G as Un,H as Kn,I as $n,J as Gn,K as Wn,N as yt}from"./index-CQSiWoCx.js";import{C as Bn,H as Ae,T as Vn,R as Hn,B as Yn,a as Zn,e as qn,L as xt,c as zn,N as Y,U as xe,b as Xn,A as Jn,g as Qn,u as ea,d as ta,f as sa,h as na,i as aa,l as oa,G as ra,j as ia,k as He}from"./LocalWorkspaceStorage-CGJoIjbX.js";import{T as te,P as la,I as Ct,S as ca,D as da}from"./IrisGridShortcuts-BNBGT-FV.js";import"./helpers-BosuxZz1.js";import"./useMergeRef-CjjDys44.js";class Ye{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 ha(a,s,e){if(a.length>s){var t=a.length-e;return{toKeep:a.slice(t),toPrune:a.slice(0,t)}}return{toKeep:a,toPrune:[]}}function Ze(a,s){var e=Object.keys(a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(a);s&&(t=t.filter(function(o){return Object.getOwnPropertyDescriptor(a,o).enumerable})),e.push.apply(e,t)}return e}function qe(a){for(var s=1;s<arguments.length;s++){var e=arguments[s]!=null?arguments[s]:{};s%2?Ze(Object(e),!0).forEach(function(t){O(a,t,e[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(e)):Ze(Object(e)).forEach(function(t){Object.defineProperty(a,t,Object.getOwnPropertyDescriptor(e,t))})}return a}function ze(a,s,e,t,o,r,i){try{var l=a[r](i),c=l.value}catch(d){return void e(d)}l.done?s(c):Promise.resolve(c).then(t,o)}function U(a){return function(){var s=this,e=arguments;return new Promise(function(t,o){var r=a.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 O(a,s,e){return(s=ua(s))in a?Object.defineProperty(a,s,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[s]=e,a}function ua(a){var s=ma(a,"string");return typeof s=="symbol"?s:s+""}function ma(a,s){if(typeof a!="object"||!a)return a;var e=a[Symbol.toPrimitive];if(e!==void 0){var t=e.call(a,s||"default");if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(a)}var Ce=W.module("PouchStorageTable"),pa="Deephaven.";lt.plugin(At);function ga(a,s){switch(a){case P.in:case P.contains:return{$regex:new RegExp("".concat(s)).toString()};case P.inIgnoreCase:return{$regex:new RegExp("".concat(s),"i").toString()};case P.eq:return{$eq:s};case P.notEq:return{$ne:s};case P.greaterThan:return{$gt:s};case P.greaterThanOrEqualTo:return{$gte:s};case P.lessThan:return{$lt:s};case P.lessThanOrEqualTo:return{$lte:s};case P.startsWith:return{$regex:new RegExp("^".concat(s,".*")).toString()};default:throw new Error("Unsupported type: ".concat(a))}}function fa(a){for(var{filterItems:s,filterOperators:e}=a,t=null,o=0;o<s.length;o+=1){var r=s[o],{columnName:i,type:l,value:c}=r,d={[i]:ga(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(a));return t}function Te(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return{$and:[...a.map(s=>fa(s)),{name:{$gt:null}},{id:{$gt:null}}]}}function ba(a){var s,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return[{id:e?"desc":"asc"},...(s=a==null?void 0:a.map(t=>({[t.column]:t.direction})))!==null&&s!==void 0?s:[]]}class va{constructor(s,e){O(this,"db",void 0),O(this,"changes",void 0),O(this,"listeners",[]),O(this,"itemListeners",new Map),O(this,"currentSize",0),O(this,"currentViewport",void 0),O(this,"currentReverse",!1),O(this,"currentFilter",null),O(this,"currentSort",null),O(this,"infoUpdatePromise",void 0),O(this,"viewportUpdatePromise",void 0),O(this,"currentViewportData",void 0),this.db=new lt("".concat(pa).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 U(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 U(function*(){var t=qe(qe({},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){Ce.debug("Update received",s),this.refreshInfo(),s.doc!==void 0&&this.sendItemUpdate(s.doc),this.refreshData()}fetchInfo(s){var e=this;return U(function*(){return e.db.find({selector:s,fields:[]})})()}refreshInfo(){var s=this;return U(function*(){try{var e,t;(e=s.infoUpdatePromise)===null||e===void 0||e.cancel(),s.infoUpdatePromise=Z.makeCancelable(s.fetchInfo(Te((t=s.currentFilter)!==null&&t!==void 0?t:[])));var o=yield s.infoUpdatePromise;s.currentSize=o.docs.length,s.sendUpdate()}catch(r){if(!Z.isCanceled(r))throw Ce.error("Unable to refreshInfo",r),r}})()}fetchViewportData(s,e,t){var o=this;return U(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 U(function*(){if(s.currentViewport)try{var e,t,o=Te((e=s.currentFilter)!==null&&e!==void 0?e:[]),r=ba(s.currentSort,s.currentReverse);(t=s.viewportUpdatePromise)===null||t===void 0||t.cancel(),s.viewportUpdatePromise=Z.makeCancelable(s.fetchViewportData(s.currentViewport,o,r));var i=yield s.viewportUpdatePromise;return s.currentViewportData=i,s.sendUpdate(),i}catch(l){if(!Z.isCanceled(l))throw Ce.error("Unable to refreshData",l),l}})()}refreshItem(s){var e=this;return U(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 U(function*(){var t=new Map,o=[{id:e.currentReverse?"desc":"asc"}];return yield Promise.all(s.map(function(){var r=U(function*(i){var l,[c,d]=i,u=d-c+1;return e.db.find({selector:Te((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 T=c+p;t.set(T,h.docs[p])}})});return function(i){return r.apply(this,arguments)}}())),t})()}}function Xe(a,s){var e=Object.keys(a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(a);s&&(t=t.filter(function(o){return Object.getOwnPropertyDescriptor(a,o).enumerable})),e.push.apply(e,t)}return e}function le(a){for(var s=1;s<arguments.length;s++){var e=arguments[s]!=null?arguments[s]:{};s%2?Xe(Object(e),!0).forEach(function(t){Tt(a,t,e[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(e)):Xe(Object(e)).forEach(function(t){Object.defineProperty(a,t,Object.getOwnPropertyDescriptor(e,t))})}return a}function Je(a,s,e,t,o,r,i){try{var l=a[r](i),c=l.value}catch(d){return void e(d)}l.done?s(c):Promise.resolve(c).then(t,o)}function ee(a){return function(){var s=this,e=arguments;return new Promise(function(t,o){var r=a.apply(s,e);function i(c){Je(r,t,o,i,l,"next",c)}function l(c){Je(r,t,o,i,l,"throw",c)}i(void 0)})}}function Tt(a,s,e){return(s=Sa(s))in a?Object.defineProperty(a,s,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[s]=e,a}function Sa(a){var s=ya(a,"string");return typeof s=="symbol"?s:s+""}function ya(a,s){if(typeof a!="object"||!a)return a;var e=a[Symbol.toPrimitive];if(e!==void 0){var t=e.call(a,s||"default");if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(a)}var xa=2500,Ca=2e3,k=W.module("PouchCommandHistoryTable");class Qe extends va{constructor(s,e){var t;super("CommandHistoryStorage.".concat(s),{auto_compaction:!0,revs_limit:1}),Tt(this,"searchText",void 0),this.cache=e,this.cache.tableRegistry.has(this.cacheKey)||this.cache.tableRegistry.set(this.cacheKey,new Set),k.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){k.debug("Setting search filters",s),this.searchText=s.trim().toLowerCase(),this.setFilters(s?[Ye.makeFilterConfig([Ye.makeFilterItem("name",P.contains,s)])]:[])}dbUpdate(s){k.debug("Clearing cache and refreshing data",s),this.cache.response.delete(this.cacheKey),super.dbUpdate(s)}fetchData(s){var e=this;return ee(function*(){return Z.withTimeout(0,ee(function*(){e.cache.response.has(e.cacheKey)?k.debug("Fetching from cache",e.searchText,e.viewport):(k.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});k.debug("Fetched ".concat(r.length," command history items"));var{toKeep:i,toPrune:l}=ha(r,xa,Ca);return l.length&&e.pruneItems(l),{docs:i}})));var t=e.cache.response.get(e.cacheKey);return e.searchText==null||e.searchText===""?t:le(le({},t),{},{docs:(yield t).docs.filter(o=>{var{name:r}=o;return r.toLowerCase().includes(e.searchText)})})}))})()}fetchInfo(s){var e=this;return ee(function*(){return e.fetchData(s)})()}fetchViewportData(s,e,t){var o=this;return ee(function*(){var r=yield o.fetchData(e);k.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 ee(function*(){if(e.cache.isPruning.get(e.cacheKey)===!0){k.debug("Pruning already in progress. Skipping.");return}try{k.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=>le(le({},o),{},{_deleted:!0}))),e.cache.isPruning.set(e.cacheKey,!1),t(),k.debug("Finished pruning command history items")}catch(o){k.error("An error occurred while pruning db",o)}})()}close(){var s,e,t;k.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 we(a,s,e){return(s=Ta(s))in a?Object.defineProperty(a,s,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[s]=e,a}function Ta(a){var s=wa(a,"string");return typeof s=="symbol"?s:s+""}function wa(a,s){if(typeof a!="object"||!a)return a;var e=a[Symbol.toPrimitive];if(e!==void 0){var t=e.call(a,s||"default");if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(a)}var et=W.module("PouchCommandHistoryCache");class ja{constructor(){we(this,"isPruning",void 0),we(this,"response",void 0),we(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&&(et.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&&(et.debug("Resuming event listeners on '".concat(s,"' table"),o),o.listenForChanges())})}}}function tt(a,s){var e=Object.keys(a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(a);s&&(t=t.filter(function(o){return Object.getOwnPropertyDescriptor(a,o).enumerable})),e.push.apply(e,t)}return e}function st(a){for(var s=1;s<arguments.length;s++){var e=arguments[s]!=null?arguments[s]:{};s%2?tt(Object(e),!0).forEach(function(t){Ee(a,t,e[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(e)):tt(Object(e)).forEach(function(t){Object.defineProperty(a,t,Object.getOwnPropertyDescriptor(e,t))})}return a}function nt(a,s,e,t,o,r,i){try{var l=a[r](i),c=l.value}catch(d){return void e(d)}l.done?s(c):Promise.resolve(c).then(t,o)}function je(a){return function(){var s=this,e=arguments;return new Promise(function(t,o){var r=a.apply(s,e);function i(c){nt(r,t,o,i,l,"next",c)}function l(c){nt(r,t,o,i,l,"throw",c)}i(void 0)})}}function Ee(a,s,e){return(s=Da(s))in a?Object.defineProperty(a,s,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[s]=e,a}function Da(a){var s=Ea(a,"string");return typeof s=="symbol"?s:s+""}function Ea(a,s){if(typeof a!="object"||!a)return a;var e=a[Symbol.toPrimitive];if(e!==void 0){var t=e.call(a,s||"default");if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(a)}var at=W.module("PouchCommandHistoryStorage");class Na{constructor(){Ee(this,"cache",new ja),Ee(this,"updateTableMap",new Map)}getUpdateTable(s){return this.updateTableMap.has(s)||this.updateTableMap.set(s,new Qe(s,this.cache)),this.updateTableMap.get(s)}getTable(s){var e=this;return je(function*(){return new Qe(s,e.cache)})()}addItem(s,e,t,o){var r=this;return je(function*(){return r.updateItem(s,{id:"".concat(new Date().getTime()),name:t,data:o})})()}updateItem(s,e){var t=this;return je(function*(){var o=t.getUpdateTable(s),r=yield o.refreshItem(e.id),i=st(st({},r??{}),e);return at.debug("Updating item",i),yield o.put(i),at.debug("Update saved"),e})()}listenItem(s,e,t){var o=this.getUpdateTable(s);return o.onItemUpdate(e,t)}}const wt="SET_LAYOUT_STORAGE",Fa=a=>({type:wt,payload:a});var{dh:Ra}=globalThis;const Ia=W.module("SettingsUtils");function Oa(a){return a.formatString!=null}function jt(a){const s=_t.parse(window.navigator.userAgent),e=`${s.browser.name??""} ${Number(parseFloat(s.browser.version??""))||""}`,t=`${s.os.name??""} ${s.os.version??""}`,o=a.get("python.version")??"";return{"Engine Version":a.get("deephaven.version")??"Unknown","Web UI Version":"1.5.1",...o!==""?{"Python Version":o}:{},"Java Version":a.get("java.version")??"Unknown","Groovy Version":a.get("groovy.version")??"Unknown","Barrage Version":a.get("barrage.version")??"Unknown","Browser Name":e.trim()||"Unknown","User Agent OS":t.trim()||"Unknown"}}function Ne(a){return Array.from(a.entries()).filter(s=>s[1].version!==void 0).reduce((s,[e,t])=>({...s,[e]:t.version}),{})}function Fe(a){const s=a==null?void 0:a.querySelector("input, select, textarea");s&&s.focus()}function Dt(a,s){return a.defaultFormatString===s.defaultFormatString}function ka(a,s){return Dt(a,s)}function La(a,s){return Dt(a,s)}function Et(a){return a!==""&&Qt.isValidColumnName(a)}function X(a,s,e){if(!s||e.formatString==null||!Oa(e))return!1;switch(s){case"datetime":return V.isValid(a,e);case"decimal":return M.isValid(a,e);case"int":return _.isValid(a,e);default:return Ia.warn("Trying to validate format of unknown type"),!0}}function Pa(a){const{id:s,isNewRule:e,...t}=a;return t}function Aa(a,s){return Et(s.columnName)&&X(a,s.columnType,s.format)}function Nt(a){const{timestamp:s,timeZone:e,showTimeZone:t,showTSeparator:o,isGlobalOptions:r,legacyGlobalFormat:i}=a,l=dt(),c=m.useMemo(()=>new es(l,[],{timeZone:e,showTimeZone:t,showTSeparator:o}),[l,t,o,e]),d=r?V.getGlobalFormats(t,o):V.getFormats(t,o);return i!=null&&!d.includes(i)&&d.unshift(i),n.jsx(n.Fragment,{children:d.map(u=>{const h=V.makeFormat("",u,V.TYPE_GLOBAL);return n.jsx("option",{value:u,"data-testid":"time-format",children:c.getFormattedString(s,R.dataType.DATETIME,"",h)},u)})})}function _a(){return n.jsx(n.Fragment,{children:ts.TIME_ZONES.map(a=>{const{label:s,value:e}=a;return n.jsx("option",{value:e,children:s},e)})})}const B=W.module("FormattingSectionContent"),ne=class ne extends m.PureComponent{constructor(e){super(e);v(this,"debouncedCommitChanges");v(this,"pendingUpdates");v(this,"containerRef");v(this,"getCachedDateTimeFormatOptions",De((e,t,o,r=!1,i)=>{const{timestampAtMenuOpen:l}=this.state;return n.jsx(Nt,{timestamp:l,timeZone:e,showTimeZone:t,showTSeparator:o,isGlobalOptions:r,legacyGlobalFormat:i})},{max:100}));this.debouncedCommitChanges=ct(this.commitChanges.bind(this),ne.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=Q.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(){Fe(this.containerRef.current)}componentWillUnmount(){this.debouncedCommitChanges.flush()}queueUpdate(e){this.pendingUpdates.push(e),this.debouncedCommitChanges()}handleDefaultDateTimeFormatChange(e){B.debug("handleDefaultDateTimeFormatChange",e);const t={defaultDateTimeFormat:e};this.setState(t),this.queueUpdate(t)}handleDefaultDecimalFormatChange(e){B.debug("handleDefaultDecimalFormatChange",e.target.value);const t={defaultDecimalFormatOptions:{defaultFormatString:e.target.value}};this.setState(t),X(dh,R.dataType.DECIMAL,M.makeCustomFormat(e.target.value))&&this.queueUpdate(t)}handleDefaultIntegerFormatChange(e){B.debug("handleDefaultIntegerFormatChange",e.target.value);const t={defaultIntegerFormatOptions:{defaultFormatString:e.target.value}};this.setState(t),X(dh,R.dataType.INT,_.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;B.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;B.debug("handleResetTimeZone"),this.setState({timeZone:t}),this.queueUpdate({timeZone:void 0})}handleResetDecimalFormat(){const{defaults:e}=this.props,{defaultDecimalFormatOptions:t}=e;B.debug("handleResetDecimalFormat"),this.setState({defaultDecimalFormatOptions:t}),this.queueUpdate({defaultDecimalFormatOptions:void 0})}handleResetIntegerFormat(){const{defaults:e}=this.props,{defaultIntegerFormatOptions:t}=e;B.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:T}=this.state,{defaultFormatString:S=M.DEFAULT_FORMAT_STRING}=r??{},{defaultFormatString:b=_.DEFAULT_FORMAT_STRING}=i??{},g=l===e.timeZone,w=d===e.showTSeparator&&c===e.showTimeZone&&o===e.defaultDateTimeFormat,L=ka(r,e.defaultDecimalFormatOptions),j=La(i,e.defaultIntegerFormatOptions);return n.jsx("div",{className:"app-settings-formatting-section",ref:this.containerRef,children:n.jsxs("div",{className:"container-fluid p-0",children:[n.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."}),n.jsxs("div",{className:"form-row mb-2",children:[n.jsx("label",{className:"col-form-label col-3",htmlFor:"select-reset-timezone",children:"Time zone"}),n.jsx("div",{className:"col pr-0",children:n.jsx(he,{className:"custom-select",value:l,onChange:this.handleTimeZoneChange,id:"select-reset-timezone",children:n.jsx(_a,{})})}),n.jsx("div",{className:"col-1 btn-col",children:n.jsx(C,{kind:"ghost",icon:z,onClick:this.handleResetTimeZone,tooltip:"Reset Time Zone",className:I("btn-reset","btn-reset-time-zone",{hidden:g})})})]}),n.jsxs("div",{className:"form-row mb-2",children:[n.jsx("label",{className:"col-form-label col-3",htmlFor:"select-default-time-format",children:"DateTime"}),n.jsx("div",{className:"col pr-0",children:n.jsx(he,{className:"custom-select",value:o,onChange:this.handleDefaultDateTimeFormatChange,id:"select-default-time-format",children:this.getCachedDateTimeFormatOptions(l,c,d,!0,o)})}),n.jsx("div",{className:"col-1 btn-col",children:n.jsx(C,{kind:"ghost",icon:z,onClick:this.handleResetDateTimeFormat,tooltip:"Reset DateTime Options",className:I("btn-reset","btn-reset-date-time",{hidden:w})})})]}),n.jsx("div",{className:"form-row",children:n.jsx("div",{className:"offset-3 col-9",children:n.jsx(H,{checked:c??null,onChange:this.handleShowTimeZoneChange,children:"Show time zone in dates"})})}),n.jsx("div",{className:"form-row mb-3",children:n.jsx("div",{className:"offset-3 col-9",children:n.jsx(H,{checked:d??null,onChange:this.handleShowTSeparatorChange,children:"Show 'T' separator"})})}),n.jsxs("div",{className:"form-row mb-2",children:[n.jsx("label",{className:"col-form-label col-3",htmlFor:"default-decimal-format-input",children:"Decimal"}),n.jsx("div",{className:"col pr-0",children:n.jsx("input",{className:I("form-control","flex-grow-1","default-decimal-format-input",{"is-invalid":!X(t,R.dataType.DECIMAL,M.makeCustomFormat(S))}),"data-lpignore":!0,placeholder:M.DEFAULT_FORMAT_STRING,type:"text",id:"default-decimal-format-input",value:S,onChange:this.handleDefaultDecimalFormatChange})}),n.jsx("div",{className:"col-1 btn-col",children:n.jsx(C,{kind:"ghost",icon:z,onClick:this.handleResetDecimalFormat,tooltip:"Reset Decimal Formatting",className:I("btn-reset","btn-reset-decimal",{hidden:L}),"data-testid":"btn-reset-decimal"})})]}),n.jsxs("div",{className:"form-row mb-2",children:[n.jsx("label",{className:"col-form-label col-3",htmlFor:"default-integer-format-input",children:"Integer"}),n.jsx("div",{className:"col pr-0",children:n.jsx("input",{className:I("form-control","flex-grow-1","default-integer-format-input",{"is-invalid":!X(t,R.dataType.INT,_.makeCustomFormat(b))}),"data-lpignore":!0,placeholder:_.DEFAULT_FORMAT_STRING,type:"text",id:"default-integer-format-input",value:b,onChange:this.handleDefaultIntegerFormatChange})}),n.jsx("div",{className:"col-1 btn-col",children:n.jsx(C,{kind:"ghost",icon:z,onClick:this.handleResetIntegerFormat,tooltip:"Reset Integer Formatting",className:I("btn-reset","btn-reset-integer",{hidden:j}),"data-testid":"btn-reset-integer"})})]}),n.jsx("div",{className:"form-row mb-2",children:n.jsx("div",{className:"offset-3 col-9",children:n.jsx(H,{checked:u??null,onChange:this.handleTruncateNumbersWithPoundChange,children:"Show truncated numbers as ###"})})}),n.jsxs("div",{className:"form-row mb-3",children:[n.jsx("label",{className:"col-form-label col-3",htmlFor:"default-integer-format-input",children:"String"}),n.jsxs("div",{className:"col pr-0 pt-2",children:[n.jsxs(H,{checked:h??null,onChange:this.handleShowEmptyStringsChange,children:["Show empty strings as"," ",n.jsx("span",{className:"font-italic text-muted",children:"empty"})]}),n.jsxs(H,{checked:p??null,onChange:this.handleShowNullStringsChange,children:["Show null strings as"," ",n.jsx("span",{className:"font-italic text-muted",children:"null"})]})]})]}),n.jsxs("div",{className:"form-row mb-3",id:"show_extra_group_column_div",children:[n.jsx("label",{className:"col-form-label col-3",htmlFor:"default-show-extra-group-column",children:"Rollup"}),n.jsx("div",{className:"col pr-0 pt-2",id:"default-show-extra-group-column",children:n.jsx(H,{checked:T,onChange:this.handleShowExtraGroupColumnChange,children:'Show extra "group" column'})})]})]})})}};v(ne,"defaultProps",{scrollTo:()=>{}}),v(ne,"inputDebounceTime",250);let Re=ne;const Ma=a=>({defaultDateTimeFormat:ss(a),defaultDecimalFormatOptions:ht(a),defaultIntegerFormatOptions:ut(a),dh:mt(a),showTimeZone:pt(a),showTSeparator:gt(a),truncateNumbersWithPound:ns(a),showEmptyStrings:as(a),showNullStrings:os(a),showExtraGroupColumn:rs(a),timeZone:ft(a),defaults:is(a)}),Ua=ge(Ma,{updateSettings:oe})(Re);function Ka(){const[a,s]=m.useState(!1),e=()=>{s(!a)};return n.jsxs(n.Fragment,{children:[n.jsx(C,{kind:"ghost",onClick:e,icon:hn,children:"Legal Notices"}),n.jsxs(un,{isOpen:a,toggle:e,children:[n.jsx(mn,{toggle:e,children:"Legal Notice"}),n.jsxs(pn,{children:[n.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."}),n.jsxs("p",{children:["© 2016-",new Date().getFullYear()," Deephaven Data Labs LLC. Patent Pending."]})]})]})]})}function $(a){const{children:s,isExpanded:e,sectionKey:t,title:o,onToggle:r}=a;return n.jsxs(n.Fragment,{children:[n.jsx("div",{children:n.jsxs(C,{kind:"ghost",className:"btn-collapse-trigger",onClick:()=>r(t),children:[n.jsx("div",{className:"d-flex align-items-center flex-grow-1",children:o}),n.jsx("div",{className:"flex-shrink-0",children:n.jsx(N,{transform:e?"flip-v":"",icon:gn})})]})}),n.jsx(Bn,{in:e,autoFocusOnShow:!0,children:s})]})}$.propTypes={children:E.node,isExpanded:E.bool.isRequired,sectionKey:E.string.isRequired,title:E.node.isRequired,onToggle:E.func};$.defaultProps={children:null,onToggle:()=>{}};function $a({shortcut:a,displayText:s,categoryName:e,onChange:t}){const[o,r]=m.useState(s),[i,l]=m.useState(a.getKeyState()),[c,d]=m.useState(!1),[u,h]=m.useState("");m.useEffect(function(){r(s),l(a.getKeyState())},[s,a]),m.useEffect(function(){r(A.getDisplayText(i)),a.matchesKeyState(i)&&d(!1)},[i,a]),m.useEffect(function(){if(c){if(!A.isValidKeyState(i)){A.isAllowedKey(i.keyValue)?h("Must contain a modifier key"):h("Must contain an allowed action key");return}const f=Pe.getConflictingShortcuts(i).filter(y=>y.id.startsWith(e)&&y!==a).map(y=>y.name);if(f.length){h(`Conflicts with ${f.join(", ")}`);return}h("")}else h("")},[c,i,e,a]);function p(j){if(j.stopPropagation(),j.preventDefault(),a.isEditable&&!j.repeat){const f=A.getKeyStateFromEvent(j),y=A.createKeyState([cs.BACKSPACE]);A.doKeyStatesMatch(f,y)?l(A.NULL_KEY_STATE):l(f)}}function T(j){j.stopPropagation(),j.preventDefault(),a.matchesKeyState(i)||d(!0)}function S(){Ke.disableAllActions()}function b(){Ke.enableAllActions()}function g(){a.setKeyState(i),d(!1),t(a)}function w(){const j=a.getKeyState();l(j),d(!1)}function L(){d(!0),l(a.getDefaultKeyState())}return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"shortcut-item-container",children:[n.jsxs("label",{className:"shortcut-item-name",children:[a.name,a.tooltip!==void 0&&n.jsx(ls,{children:a.tooltip})]}),n.jsxs("div",{className:"shortcut-item-input-container",children:[n.jsx("input",{className:I("form-control",{"is-invalid":u}),onKeyDown:p,onKeyUp:T,onFocus:S,onBlur:b,disabled:!a.isEditable,value:o,readOnly:!0}),!A.doKeyStatesMatch(i,a.getDefaultKeyState())&&!u&&n.jsx(C,{className:"reset-to-default-button",kind:"ghost",icon:n.jsx(N,{icon:z,transform:{rotate:90,flipX:!0}}),tooltip:"Reset to default",onClick:L})]})]}),c&&n.jsxs("div",{className:I("shortcut-item-message-container",{"is-invalid":u}),children:[n.jsx("div",{className:"shortcut-item-message",children:u}),n.jsxs("div",{className:"shortcut-item-message-buttons",children:[A.isValidKeyState(i)&&n.jsx(C,{kind:"ghost",onClick:g,children:"Confirm"}),n.jsx(C,{kind:"ghost",onClick:w,children:"Undo"})]})]})]})}function Ga({shortcutOverrides:a={},updateSettings:s}){const e=m.useCallback(i=>{const l=A.isMacPlatform,c={mac:{...a.mac},windows:{...a.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,a]);let t=Array.from(Pe.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),n.jsxs(n.Fragment,{children:[n.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=>n.jsx(Wa,{name:i.name,shortcuts:i.shortcuts,saveShortcutOverrides:e},i.name))]})}function Wa({name:a,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 n.jsxs("div",{className:"mt-3",children:[n.jsx("div",{className:"font-weight-bold",children:t(a)}),o.map((c,d)=>n.jsx($a,{shortcut:c,displayText:l[d],categoryName:a,onChange:i},c.id))]})}const Ba=a=>({shortcutOverrides:ds(a)}),Va={updateSettings:oe},Ha=ge(Ba,Va)(Ga),Ya=[{value:R.dataType.DATETIME,label:"DateTime"},{value:R.dataType.DECIMAL,label:"Decimal"},{value:R.dataType.INT,label:"Integer"}];function Za(){const a=Ya.map(s=>n.jsx("option",{value:s.value,children:s.label},`key-columnType-${s.value}`));return n.jsxs(n.Fragment,{children:[n.jsx("option",{disabled:!0,value:"",children:"Select Type"},"key-columnType-placeholder"),a]})}const ae=class ae extends m.PureComponent{constructor(e){super(e);v(this,"debouncedCommitChanges");v(this,"containerRef");v(this,"addFormatRuleButtonRef");v(this,"lastFormatRuleIndex");v(this,"getCachedColumnTypeOptions",De(()=>n.jsx(Za,{}),{max:100}));v(this,"getCachedDateTimeFormatOptions",De((e,t,o,r=!1,i)=>{const{timestampAtMenuOpen:l}=this.state;return n.jsx(Nt,{timestamp:l,timeZone:e,showTimeZone:t,showTSeparator:o,isGlobalOptions:r,legacyGlobalFormat:i})},{max:100}));this.debouncedCommitChanges=ct(this.commitChanges.bind(this),ae.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=Q.createRef(),this.addFormatRuleButtonRef=Q.createRef(),this.lastFormatRuleIndex=l.length,this.state={formatSettings:l,formatRulesChanged:!1,showTimeZone:o,showTSeparator:r,timeZone:i,timestampAtMenuOpen:new Date}}componentDidMount(){Fe(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;pe(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:R.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(),Fe(e)}commitChanges(){const{formatSettings:e}=this.state,{dh:t}=this.props,o=e.filter(l=>Aa(t,l)).map(Pa)??[],{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.")),Et(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.")):X(t,e.columnType,e.format)||(o.hasFormatError=!0,r.push("Invalid formatting rule.")),o.message=r.join(`
3
- `)),o}makeDefaultFormatterItemByType(e){switch(R.getNormalizedType(e)){case R.dataType.INT:{const{defaultIntegerFormatOptions:t}=this.props,{defaultFormatString:o}=t;return _.makeFormat("",o??_.DEFAULT_FORMAT_STRING,_.TYPE_GLOBAL,void 0)}case R.dataType.DECIMAL:{const{defaultDecimalFormatOptions:t}=this.props,{defaultFormatString:o}=t;return M.makeFormat("",o??M.DEFAULT_FORMAT_STRING,M.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 n.jsxs("fieldset",{className:"container-fluid format-rule-container",children:[n.jsxs("div",{className:"form-row",children:[n.jsxs("div",{className:"form-group col-7 mb-2",children:[n.jsx("label",{htmlFor:o,children:"Column Name"}),n.jsx("input",{id:o,className:I("form-control",{"is-invalid":h.hasColumnNameError}),"data-lpignore":!0,type:"text",value:t.columnName,onChange:c,onBlur:d})]}),n.jsxs("div",{className:"form-group col mb-2",children:[n.jsx(C,{kind:"ghost",className:"btn-delete-format-rule float-right",tabIndex:-1,onClick:()=>this.handleFormatRuleDelete(e),icon:fn,tooltip:"Delete","aria-label":"Delete Format Rule"}),n.jsx("label",{htmlFor:r,children:"Column Type"}),n.jsx(he,{id:r,className:"custom-select",value:t.columnType,onChange:u,children:l})]})]}),n.jsx("div",{className:"form-row",children:n.jsxs("div",{className:"form-group col-12 d-flex mb-2",children:[n.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)]})}),n.jsx("div",{className:"form-row",children:n.jsx("div",{className:"form-group col-12 d-flex mb-2",children:h.message&&n.jsx("p",{className:"text-danger",children:h.message})})})]},e)}renderFormatRuleInput(e,t,o,r,i){switch(R.getNormalizedType(t)){case R.dataType.DATETIME:return this.renderDateTimeFormatRuleInput(e,o,r,i);case R.dataType.DECIMAL:return this.renderDecimalFormatRuleInput(e,o,r,i);case R.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 n.jsxs(he,{className:I("custom-select",{"is-invalid":r}),value:d,id:t,onChange:u=>{const h=V.makeFormat("",u,V.TYPE_GLOBAL);this.handleFormatRuleChange(e,"format",h)},children:[n.jsx("option",{value:"",disabled:!0,children:"Select format"},"default"),this.getCachedDateTimeFormatOptions(c,i,l)]})}renderIntegerFormatRuleInput(e,t,o,r){const{defaultIntegerFormatOptions:i}=this.props;pe(i);const{defaultFormatString:l}=i,c=o.formatString??"";return n.jsx("input",{className:I("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)}})}renderDecimalFormatRuleInput(e,t,o,r){const{defaultDecimalFormatOptions:i}=this.props,{defaultFormatString:l}=i,c=o.formatString??"";return n.jsx("input",{className:I("form-control","flex-grow-1",{"is-invalid":r}),"data-lpignore":!0,id:t,placeholder:l??M.DEFAULT_FORMAT_STRING,type:"text",value:c,onChange:d=>{const u=M.makeFormat("",d.target.value,M.TYPE_GLOBAL,void 0);this.handleFormatRuleChange(e,"format",u)}})}render(){const{formatRulesChanged:e,formatSettings:t}=this.state,o=t.map((i,l)=>n.jsx(hs,{onEnter:this.handleFormatRuleEntered,children:this.renderFormatRule(l,i)},i.id)),r=n.jsx(C,{kind:"ghost",className:"mb-3",onClick:this.handleFormatRuleCreate,ref:this.addFormatRuleButtonRef,icon:bn,children:"Add New Rule"});return n.jsxs("div",{className:"app-settings-formatting-section",ref:this.containerRef,children:[n.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."}),n.jsx(Mt,{appear:e,enter:e,exit:e,children:o}),r]})}};v(ae,"defaultProps",{scrollTo:()=>{}}),v(ae,"inputDebounceTime",250);let Ie=ae;const qa=a=>({formatter:us(a),defaultDecimalFormatOptions:ht(a),defaultIntegerFormatOptions:ut(a),dh:mt(a),showTimeZone:pt(a),showTSeparator:gt(a),timeZone:ft(a)}),za=ge(qa,{updateSettings:oe})(Ie);function Xa(){const a=fe(),s=ue(ms),e=ue(ps),t=m.useCallback(r=>{a(oe({webgl:r}))},[a]),o=e?n.jsx(te,{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."}):n.jsx(te,{children:"WebGL is disabled by your system administrator. Contact your system administrator to enable."});return n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"app-settings-menu-description",children:"Advanced settings here. Be careful!"}),n.jsxs("div",{className:"form-row mb-3 pl-1",children:[n.jsx(ce,{isSelected:s,isDisabled:!e,onChange:t,marginEnd:"size-0",children:"Enable WebGL"}),n.jsxs(ke,{variant:"info",marginTop:"size-50",children:[n.jsx(Ae,{children:"Enable WebGL"}),n.jsx(Le,{children:n.jsx(te,{children:o})})]})]})]})}function Ja(){const a=gs(),s=ue(fs),e=fe(),t=m.useCallback(r=>{if(r!=="regular"&&r!=="compact"&&r!=="spacious")throw new Error(`Invalid grid density value: ${r}`);e(oe({gridDensity:r}))},[e]),o=s.gridDensity;return pe(a,"ThemeContext value is null"),n.jsxs(n.Fragment,{children:[n.jsx(Vn,{}),n.jsxs(la,{label:"Default table density",selectedKey:o,onChange:t,children:[n.jsx(ve,{children:"Regular"},"regular"),n.jsx(ve,{children:"Compact"},"compact"),n.jsx(ve,{children:"Spacious"},"spacious")]})]})}function Qa(){const a=ue(bs),s=fe(),{isMinimapEnabled:e,formatOnSave:t,python:{linter:o={}}={}}=a,{isEnabled:r,config:i=$e}=o,l=m.useCallback(g=>s(re({isMinimapEnabled:g})),[s]),c=m.useCallback(g=>s(re({formatOnSave:g})),[s]),d=m.useCallback(g=>{s(re({python:{linter:{...o,isEnabled:g}}})),ye.isRuffEnabled=g,ye.setRuffSettings(i)},[s,o,i]),u=m.useCallback(g=>{s(re({python:{linter:{...o,config:JSON.stringify(g)===JSON.stringify($e)?void 0:g}}})),ye.setRuffSettings(g)},[s,o]),h=JSON.stringify(i,null,2),[p,T]=m.useState(!1),S=m.useCallback(()=>{T(!1)},[]),b=m.useCallback(g=>{u(g),S()},[u,S]);return n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"app-settings-menu-description",children:"Customize the notebook editor."}),n.jsx("div",{className:"form-row pl-1",children:n.jsx(ce,{isSelected:e,onChange:l,children:"Enable Minimap"})}),n.jsxs("div",{className:"form-row align-items-center pl-1",children:[n.jsx(ce,{isSelected:t,onChange:c,margin:0,children:"Format on Save"}),n.jsxs(ke,{variant:"info",children:[n.jsx(Ae,{children:"Format on Save"}),n.jsx(Le,{children:n.jsx(te,{children:"The Ruff settings control formatting options. Notebooks can be formatted manually using the right-click context menu."})})]})]}),n.jsx("div",{className:"form-row pl-1",children:n.jsx(ce,{isSelected:r,onChange:d,marginEnd:0,children:"Enable Ruff Python Linter"})}),n.jsx("div",{className:"form-row pl-1",children:n.jsxs(Ut,{onPress:()=>T(!0),children:[n.jsx(Kt,{children:n.jsx(N,{icon:vn})}),n.jsx(te,{children:"Customize Ruff Settings"})]})}),p&&n.jsx(Hn,{text:h,isOpen:p,onClose:S,onSave:b})]})}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=Q.createRef(),this.broadcastChannel=new BroadcastChannel(Yn),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(Sn(Zn))}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=Ne(t);qn(xn,{uiVersion:"1.5.1",userAgent:navigator.userAgent,...Object.fromEntries(e),pluginInfo:o},yn.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=jt(o),c=Ne(r),d=o.get("deephaven.version"),u=q.COPY_VERSION_INFO.getDisplayText(),h=(b,g)=>n.jsxs(m.Fragment,{children:[n.jsx("div",{children:b}),n.jsx("div",{children:g})]},b),p=i.displayName??i.name,T=i.image!=null&&i.image!=="",S=p!=="";return n.jsxs("div",{className:"app-settings-menu",children:[n.jsxs("header",{className:"app-settings-menu-header",children:[n.jsxs("div",{className:"user-info",children:[n.jsxs("div",{className:"user-image",children:[!T&&n.jsx(N,{icon:Cn,transform:"grow-8"}),T&&n.jsx("img",{src:i.image,alt:p})]}),n.jsxs("div",{className:"user-details",children:[S&&n.jsxs("div",{className:"user-name",children:[p,i.operateAs!=null&&i.name!==i.operateAs&&n.jsxs(n.Fragment,{children:[n.jsxs("span",{className:"font-weight-light font-italic",children:[" ","as"," "]}),n.jsxs("span",{className:"operating-as-user",children:[n.jsx(N,{icon:Tn,className:"mr-1"}),i.operateAs]})]})]}),i.permissions.canLogout&&n.jsx("button",{type:"button",className:"btn btn-link",onClick:this.handleLogout,children:"logout"})]})]}),n.jsx(C,{kind:"ghost",className:"btn-close-settings-menu",onClick:this.handleClose,icon:n.jsx(N,{icon:wn,transform:"grow-4"}),tooltip:"Close"})]}),n.jsxs("div",{className:"app-settings-menu-content",ref:this.menuContentRef,children:[n.jsx("h5",{children:"Settings"}),n.jsx("hr",{className:"my-0"}),n.jsx($,{sectionKey:x.FORMATTING_SECTION_KEY,isExpanded:this.isSectionExpanded(x.FORMATTING_SECTION_KEY),title:n.jsxs(n.Fragment,{children:[n.jsx(N,{icon:jn,transform:"grow-4",className:"mr-2"}),"Default Format & Time zone"]}),onToggle:this.handleSectionToggle,children:n.jsx(Ua,{})}),n.jsx($,{sectionKey:x.COLUMN_SPECIFIC_SECTION_KEY,isExpanded:this.isSectionExpanded(x.COLUMN_SPECIFIC_SECTION_KEY),title:n.jsxs(n.Fragment,{children:[n.jsx(N,{icon:Dn,transform:"grow-4",className:"mr-2"}),"Format by Column Name & Type"]}),onToggle:this.handleSectionToggle,children:n.jsx(za,{scrollTo:this.handleScrollTo})}),n.jsx($,{sectionKey:x.THEME_SECTION_KEY,isExpanded:this.isSectionExpanded(x.THEME_SECTION_KEY),onToggle:this.handleSectionToggle,title:n.jsxs(n.Fragment,{children:[n.jsx(N,{icon:En,transform:"grow-4",className:"mr-2"}),"Theme"]}),children:n.jsx(Ja,{})}),n.jsx($,{sectionKey:x.EDITOR_SECTION_KEY,isExpanded:this.isSectionExpanded(x.EDITOR_SECTION_KEY),onToggle:this.handleSectionToggle,title:n.jsxs(n.Fragment,{children:[n.jsx(N,{icon:Nn,transform:"grow-4",className:"mr-2"}),"Editor"]}),children:n.jsx(Qa,{})}),n.jsx($,{sectionKey:x.SHORTCUT_SECTION_KEY,isExpanded:this.isSectionExpanded(x.SHORTCUT_SECTION_KEY),title:n.jsxs(n.Fragment,{children:[n.jsx(N,{icon:Fn,transform:"grow-4",className:"mr-2"}),"Keyboard Shortcuts"]}),onToggle:this.handleSectionToggle,children:n.jsx(Ha,{})}),n.jsx($,{sectionKey:x.ADVANCED_SECTION_KEY,isExpanded:this.isSectionExpanded(x.ADVANCED_SECTION_KEY),title:n.jsxs(n.Fragment,{children:[n.jsx(N,{icon:Rn,transform:"grow-4",className:"mr-2"}),"Advanced"]}),onToggle:this.handleSectionToggle,children:n.jsx(Xa,{})}),n.jsxs("div",{className:"app-settings-footer",children:[n.jsxs("div",{className:"app-settings-footer-section",children:[n.jsxs("div",{className:"app-settings-footer-item",children:[n.jsx("div",{className:"font-weight-bold",children:"Support"}),n.jsxs("div",{children:["GitHub: ",n.jsx("a",{href:e,className:"custom-link",target:"_blank",rel:"noopener noreferrer",children:e})]}),n.jsx(C,{kind:"tertiary",className:"mt-2 py-2",onClick:this.handleExportSupportLogs,children:"Export Logs"})]}),n.jsxs("div",{className:"app-settings-footer-item",children:[n.jsx("div",{className:"font-weight-bold",children:"Documentation"}),n.jsx("a",{target:"_blank",rel:"noreferrer noopener",href:t,className:"custom-link",children:t})]}),n.jsxs("div",{className:"app-settings-footer-item",children:[n.jsx("div",{className:"font-weight-bold",children:"Version"}),n.jsxs("span",{className:"d-inline-block text-muted",children:[d,n.jsxs(ke,{variant:"info",children:[n.jsx(Ae,{children:"Version Info"}),n.jsxs(Le,{children:[n.jsx("div",{className:"detailed-server-config",children:Object.entries(l).map(([b,g])=>h(b,g))}),n.jsxs(vs,{kind:"inline",tooltip:"Copy version numbers",copy:Object.entries({...l,...c}).map(([b,g])=>`${b}: ${g}`).join(`
4
- `),children:["Copy Versions",n.jsxs("small",{className:"text-muted",children:["(",u,")"]})]})]})]})]})]}),n.jsxs("div",{className:"app-settings-footer-item",children:[n.jsx("div",{className:"font-weight-bold",children:"Plugins"}),n.jsx("div",{className:"container",children:Array.from(r.entries()).filter(b=>b[1].version!==void 0).map(([b,g])=>n.jsxs("div",{className:"row justify-content-start align-items-center",children:[n.jsx("div",{className:"col pl-0",children:n.jsx("span",{className:"my-0 text-truncate",children:b})}),n.jsx("div",{className:"col-auto",children:n.jsx("span",{children:g==null?void 0:g.version})})]},b))})]}),n.jsx("div",{className:"app-settings-footer-item",children:n.jsx(Ka,{})})]}),n.jsx("div",{className:"app-settings-footer-section",children:n.jsx("a",{target:"_blank",rel:"noreferrer noopener",href:"https://deephaven.io",style:{display:"block",width:"61.8%"},children:n.jsx(xt,{})})})]})]})]})}};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 Oe=x;const ot=10;function J(a){const{forwardedProps:{menuItem:{action:s,title:e,disabled:t},iconElement:o,displayShortcut:r,isMouseSelected:i,isKeyboardSelected:l,closeMenu:c}}=a,d=m.useRef(),u=m.useRef(),h=m.useRef(null),[p,T]=m.useState(!1),S=m.useCallback(w=>{d.current!=null&&u.current!=null&&h.current&&(Math.abs(d.current-w.clientX)>=ot||Math.abs(u.current-w.clientY)>=ot)&&(T(!0),window.removeEventListener("mousemove",S),c(),s(w),h.current=null)},[s,c]);function b(w){d.current=w.clientX,u.current=w.clientY,h.current=w.target,window.addEventListener("mousemove",S)}function g(w){h.current===w.target&&(T(!0),c(),s(),window.removeEventListener("mousemove",S)),h.current=null}return m.useEffect(function(){return function(){return window.removeEventListener("mousemove",S)}},[S]),n.jsxs("button",{type:"button",className:I("btn-context-menu",{disabled:t},{active:i&&!t},{"keyboard-active":l&&!t}),onMouseDown:b,onMouseUp:g,disabled:p,children:[n.jsx("span",{className:I("icon"),children:o}),n.jsx("span",{className:"title",children:e}),n.jsx("span",{className:"shortcut",children:r})]})}function _e(a){const{handleControlSelect:s,handleToolSelect:e,onClearFilter:t}=a,o=m.useMemo(()=>[{title:"Input Filter",icon:In,menuElement:n.jsx(J,{}),action:r=>{s(G.INPUT_FILTER,r)},order:10},{title:"Dropdown Filter",icon:On,menuElement:n.jsx(J,{}),action:r=>{s(G.DROPDOWN_FILTER,r)},order:15},{title:"Markdown Widget",icon:kn,menuElement:n.jsx(J,{}),action:r=>{s(G.MARKDOWN,r)},order:20},{title:"Filter Sets",icon:Ln,menuElement:n.jsx(J,{}),action:r=>{s(G.FILTER_SET_MANAGER,r)},order:25},{disabled:!0,menuElement:n.jsx("div",{className:"context-menu-group-header",children:"Tools"}),order:30},{title:"Linker",icon:Pn,action:()=>{e(me.LINKER)},order:40,shortcut:q.LINKER},{disabled:!0,menuElement:n.jsx("div",{className:"context-menu-group-header",children:"Actions"}),order:50},{title:"Clear All Filters",icon:An,action:()=>{t()},order:60,shortcut:Ct.TABLE.CLEAR_ALL_FILTERS}],[s,e,t]);return n.jsx(Ss,{popperClassName:"controls-menu-popper",actions:o})}_e.propTypes={handleControlSelect:E.func,handleToolSelect:E.func,onClearFilter:E.func};_e.defaultProps={handleControlSelect:()=>{},handleToolSelect:()=>{},onClearFilter:()=>{}};J.propTypes={forwardedProps:E.shape({iconElement:E.node,displayShortcut:E.string,isMouseSelected:E.bool.isRequired,isKeyboardSelected:E.bool.isRequired,closeMenu:E.func.isRequired,menuItem:E.shape({action:E.func,title:E.string,disabled:E.bool}).isRequired})};J.defaultProps={forwardedProps:null};const eo=_n(wt,null),to={layoutStorage:eo},so=a=>a.layoutStorage,no=a=>a.serverConfigValues;Object.entries(to).map(([a,s])=>Mn.register(a,s));const rt=10;function ao(a){const{onExportLayout:s,onImportLayout:e,onResetLayout:t,onSelect:o,widgets:r=[]}=a,[i,l]=m.useState(!1),[c,d]=m.useState(""),u=m.useRef(null),h=m.useRef(),p=m.useCallback((f,y)=>{f!=null&&o(f,y)},[o]),T=m.useCallback(f=>{d(f.target.value)},[]),S=m.useCallback(f=>{h.current!=null&&(Math.abs(h.current.x-f.clientX)>=rt||Math.abs(h.current.y-f.clientY)>=rt)&&(l(!0),window.removeEventListener("mousemove",S),p(h.current.widget,f),h.current=void 0)},[h,p]),b=m.useCallback((f,y)=>{h.current={x:f.clientX,y:f.clientY,widget:y},window.addEventListener("mousemove",S)},[S]),g=m.useCallback((f,y)=>{var K;window.removeEventListener("mousemove",S),((K=h.current)==null?void 0:K.widget)===y&&(l(!0),p(y)),h.current=void 0},[S,h,p]),w=m.useMemo(()=>r.filter(f=>{var y;return c?(y=f.name)==null?void 0:y.toLowerCase().includes(c.toLowerCase()):!0}),[c,r]).sort((f,y)=>{var K;return((K=f.name)==null?void 0:K.localeCompare(y.name??""))??0}),L=m.useMemo(()=>w.map(f=>n.jsx("li",{children:n.jsxs(C,{kind:"ghost","data-testid":`panel-list-item-${f.name??""}-button`,onMouseDown:y=>{b(y,f)},onMouseUp:y=>{g(y,f)},onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&p(f)},disabled:i,onClick:()=>{},children:[n.jsx(ys,{type:f.type})," ",f.name??""]})},f.name)),[w,i,b,g,p]),j=m.useMemo(()=>L.length===0?n.jsx("span",{children:"No bound variables found."}):null,[L]);return n.jsxs("div",{className:"widget-list-container d-flex flex-column",children:[n.jsx("div",{className:"widget-list-header",children:n.jsx(xs,{value:c,placeholder:"Find Table, Plot or Widget",onChange:T,ref:u})}),n.jsxs("ul",{className:"widget-list flex-grow-1",children:[j&&n.jsx("li",{className:"widget-list-message",children:j}),!j&&L]}),n.jsx("div",{children:n.jsx("hr",{})}),n.jsxs("div",{className:"widget-list-footer",children:[n.jsxs(C,{kind:"ghost",onClick:s,children:[n.jsxs("div",{className:"fa-md fa-layers",children:[n.jsx(N,{mask:We,icon:Be,transform:"right-5 down-5"}),n.jsx(N,{icon:Be,transform:"right-8 down-6"})]}),"Export Layout"]}),n.jsxs(C,{kind:"ghost",onClick:e,children:[n.jsxs("div",{className:"fa-md fa-layers",children:[n.jsx(N,{mask:We,icon:Ve,transform:"right-5 down-5"}),n.jsx(N,{icon:Ve,transform:"right-8 down-6"})]}),"Import Layout"]}),n.jsx(C,{kind:"ghost",icon:z,onClick:t,tooltip:"Reset Layout"})]})]})}function oo({onAutoFillClick:a=()=>{}}){return n.jsxs("div",{className:"empty-dashboard-container",children:[n.jsxs("div",{className:"hint-container",children:[n.jsx(N,{icon:Un})," ",n.jsx("br",{}),"Use the panel list to add objects from a query."]}),n.jsxs("div",{className:"empty-dashboard",children:[n.jsx("div",{className:"add-panels-hint",children:"Drag Panels Here"}),n.jsx(C,{kind:"tertiary",onClick:a,children:"Auto fill objects"})]})]})}const F=W.module("AppMainContainer");class se 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",Bt(e=>Qn(e)));Os(this),this.importElement=Q.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:[zn({uiVersion:"1.5.1",userAgent:navigator.userAgent,...Object.fromEntries(o),pluginInfo:Ne(r)},!1),{action:()=>{const i=jt(o),l=Object.entries(i).map(([c,d])=>`${c}: ${d}`).join(`
5
- `);ks(l)},shortcut:q.COPY_VERSION_INFO,isGlobal:!0},{action:()=>{this.handleToolSelect(me.LINKER)},shortcut:q.LINKER,isGlobal:!0},{action:()=>{this.sendClearFilter()},shortcut:Ct.TABLE.CLEAR_ALL_FILTERS,isGlobal:!0},{action:()=>{this.sendCycleStackForward()},shortcut:Y.CYCLE_TO_NEXT_STACK,isGlobal:!0},{action:()=>{this.sendCycleStackBackward()},shortcut:Y.CYCLE_TO_PREVIOUS_STACK,isGlobal:!0},{action:()=>{this.sendCycleTabForward()},shortcut:Y.CYCLE_TO_NEXT_TAB,isGlobal:!0},{action:()=>{this.sendCycleTabBackward()},shortcut:Y.CYCLE_TO_PREVIOUS_TAB,isGlobal:!0},{action:()=>{this.handleCycleDashboardForward()},shortcut:Y.CYCLE_TO_NEXT_DASHBOARD,isGlobal:!0},{action:()=>{this.handleCycleDashboardBackward()},shortcut:Y.CYCLE_TO_PREVIOUS_DASHBOARD,isGlobal:!0},{action:()=>{this.sendReopenLast()},shortcut:q.REOPEN_CLOSED_PANEL,isGlobal:!0},{action:()=>{F.debug("Consume unhandled save shortcut")},shortcut:q.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!==D,icon:i===D?Kn:void 0})),activeTabKey:D,layoutIteration:0}}static handleWindowBeforeUnload(e){e.preventDefault(),e.returnValue=""}static hydrateConsole(e,t){return Is.hydrate({...e,unzip:o=>Gt.loadAsync(o).then(r=>Object.values(r.files))},t)}static handleRefresh(){F.info("Refreshing application"),window.location.reload()}componentDidMount(){this.initWidgets(),this.initDashboardData(),window.addEventListener("beforeunload",se.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",se.handleWindowBeforeUnload)}initWidgets(){const{connection:e}=this.props;if(e!=null){if(e.subscribeToFieldUpdates==null){F.warn("subscribeToFieldUpdates not supported, not initializing widgets");return}this.widgetListenerRemover=e.subscribeToFieldUpdates(t=>{F.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(D,{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];F.debug("initDashboardData plugin data",h,p),e(D,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){F.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(Ls.SELECT_NOTEBOOK,o,l,c,i,!0)}}sendClearFilter(){this.emitLayoutEvent(ie.CLEAR_ALL_FILTERS)}sendCycleStackForward(){Ps(this.getActiveEventHub())}sendCycleStackBackward(){As(this.getActiveEventHub())}sendCycleTabForward(){_s(this.getActiveEventHub())}sendCycleTabBackward(){Ms(this.getActiveEventHub())}sendReopenLast(){this.emitLayoutEvent(Us.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 pe(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){Z.isCanceled(e)||F.error(e)}handleSettingsMenuHide(){this.setState({isSettingsMenuShown:!1})}handleSettingsMenuShow(){this.setState({isSettingsMenuShown:!0})}handleControlSelect(e,t){switch(F.debug("handleControlSelect",e),e){case G.DROPDOWN_FILTER:this.emitLayoutEvent(ie.OPEN_DROPDOWN,{title:"DropdownFilter",type:e,createNewStack:!0,dragEvent:t});break;case G.INPUT_FILTER:this.emitLayoutEvent(ie.OPEN_INPUT,{title:"InputFilter",type:e,createNewStack:!0,dragEvent:t});break;case G.MARKDOWN:this.emitLayoutEvent(Ks.OPEN,{title:"Markdown",type:e,dragEvent:t});break;case G.FILTER_SET_MANAGER:this.emitLayoutEvent(ie.OPEN_FILTER_SET_MANAGER,{title:"FilterSets",type:e,dragEvent:t});break;default:throw new Error(`Unrecognized control type ${e}`)}}handleToolSelect(e){F.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,$s(e.eventHub,this.handleCreateDashboard)),this.closeDashboardListenerRemovers.set(t,Gs(e.eventHub,this.handleCloseDashboard)))}handleCreateDashboard({pluginId:e,title:t,data:o}){const r=Wt(),{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}),F.debug("handleWidgetSelect",e,t),this.openWidget(e,t)}handleWidgetsMenuClose(){this.setState({isPanelsMenuShown:!1})}handleAutoFillClick(){const{widgets:e}=this.state;F.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(){F.info("handleExportLayoutClick"),this.setState({isPanelsMenuShown:!1});try{const{workspace:e}=this.props,{data:t}=e,o=xe.exportLayout(t);F.info("handleExportLayoutClick exportedConfig",o);const r=new Blob([JSON.stringify(o)],{type:"application/json"}),i=Ra.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){F.error("Unable to export layout",e)}}handleImportLayoutClick(){F.info("handleImportLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.importElement.current!=null&&(this.importElement.current.value="",this.importElement.current.click())}handleResetLayoutClick(){F.info("handleResetLayoutClick"),this.setState({isPanelsMenuShown:!1,isResetLayoutPromptShown:!0,unsavedNotebookCount:Ws.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}=xe.normalizeLayout(i);o({layoutConfig:c}),t(D,{filterSets:l,links:d,pluginDataMap:u}),this.setState(({layoutIteration:h})=>({layoutIteration:h+1}))}catch(t){F.error("Unable to import layout",t)}}async resetLayout(){const{layoutStorage:e,session:t}=this.props,{filterSets:o,layoutConfig:r,links:i}=await xe.getDefaultLayout(e,t!==void 0),{updateDashboardData:l,updateWorkspaceData:c}=this.props;c({layoutConfig:r}),l(D,{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;Bs(this.getActiveEventHub(),{widget:Vs(e),dragEvent:t,fetch:async()=>o==null?void 0:o.getObject(e)})}handleHomeClick(){this.handleTabSelect(D)}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=D),{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:D,layoutConfig:l,key:`${D}-${e}`},...t.filter(c=>c.key!==D).map(c=>{var d;return{id:c.key,layoutConfig:((d=o[c.key])==null?void 0:d.layoutConfig)??Hs,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:T,tabs:S,activeTabKey:b}=this.state,g=this.getDashboardPlugins(t);return n.jsxs("div",{className:I("app-main-tabs","w-100","h-100","d-flex","flex-column",e?`active-tool-${e.toLowerCase()}`:""),onPaste:this.handlePaste,tabIndex:-1,children:[n.jsxs("div",{className:"app-main-top-nav-menus",children:[n.jsx(xt,{className:"ml-1",style:{maxHeight:"20px"}}),S.length>1&&n.jsx("div",{style:{flexShrink:0,flexGrow:1,flexBasis:0,minWidth:0},children:n.jsx(Xn,{tabs:S,activeKey:b,onSelect:this.handleTabSelect,onReorder:this.handleTabReorder,onClose:this.handleTabClose})}),n.jsxs("div",{className:"app-main-right-menu-buttons",children:[n.jsxs(C,{kind:"ghost",className:"btn-panels-menu",icon:$n,onClick:()=>{},children:["Controls",n.jsx(_e,{handleControlSelect:this.handleControlSelect,handleToolSelect:this.handleToolSelect,onClearFilter:this.handleClearFilter})]}),l&&n.jsxs(C,{kind:"ghost",className:"btn-panels-menu btn-show-panels","data-testid":"app-main-panels-button",onClick:this.handleWidgetMenuClick,icon:Gn,children:["Panels",n.jsx(Ys,{isShown:d,className:"panels-menu-popper",onExited:this.handleWidgetsMenuClose,options:{placement:"bottom"},closeOnBlur:!0,interactive:!0,children:n.jsx(ao,{widgets:T,onExportLayout:this.handleExportLayoutClick,onImportLayout:this.handleImportLayoutClick,onResetLayout:this.handleResetLayoutClick,onSelect:this.handleWidgetSelect})})]}),n.jsx(C,{kind:"ghost",className:I("btn-settings-menu",{"text-warning":o.operateAs!=null&&o.operateAs!==o.name}),onClick:this.handleSettingsMenuShow,icon:n.jsx("span",{className:"fa-layers",children:n.jsx(N,{icon:Wn,transform:"grow-3"})}),tooltip:"User Settings"})]})]}),n.jsx(Jn,{dashboards:this.getDashboards(),activeDashboard:b,onGoldenLayoutChange:this.handleGoldenLayoutChange,emptyDashboard:b===D?n.jsx(oo,{onAutoFillClick:this.handleAutoFillClick}):n.jsx(yt,{"data-testid":"app-main-container-loading"}),plugins:[n.jsx(Zs,{hydrateConsole:se.hydrateConsole,notebooksUrl:new URL("notebooks/",document.baseURI).href},"ConsolePlugin"),...g]}),n.jsx(ca,{in:h,mountOnEnter:!0,unmountOnExit:!0,children:n.jsx(Oe,{serverConfigValues:r,pluginData:t,onDone:this.handleSettingsMenuHide,user:o})}),n.jsx(qs,{actions:c}),n.jsx("input",{ref:this.importElement,type:"file",accept:".json",style:{display:"none"},onChange:this.handleImportLayoutFiles,"data-testid":"input-import-layout"}),n.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=a=>{var s,e;return{activeTool:js(a),allDashboardData:Ds(a),dashboardData:Es(a,D),layoutStorage:so(a),plugins:Ns(a),connection:Fs(a,D),session:(s=Ge(a,D))==null?void 0:s.session,sessionConfig:(e=Ge(a,D))==null?void 0:e.config,user:Rs(a),workspace:St(a),serverConfigValues:no(a)}},io=ge(ro,{setActiveTool:bt,setDashboardData:vt,setDashboardPluginData:Cs,updateDashboardData:Ts,updateWorkspaceData:ws})($t(se));function lo(){return n.jsxs("div",{className:"app",children:[n.jsx(io,{}),n.jsx(Vt,{})]})}const co=W.module("AppInit");function it(){const a=dt(),s=ea(),e=ta(),t=Xs(),o=sa(),r=na(),i=Ht(St),l=fe(),[c,d]=m.useState();m.useEffect(function(){l(Js(t))},[t,l]),m.useEffect(function(){async function S(){try{const b=await aa(),g=await oa(a,e,b),w=s.getStorageService(),L=new ra(w,"/layouts"),j=new ia(a,w,"/notebooks"),f=new He(L),y=new Na,K=await f.load({isConsoleAvailable:g!==void 0}),{data:be}=K,{settings:Ft}=be,{shortcutOverrides:Me={}}=Ft,Rt=A.isMacPlatform?Me.mac??{}:Me.windows??{};Object.entries(Rt).forEach(([Ot,kt])=>{var Ue;(Ue=Pe.get(Ot))==null||Ue.setKeyState(kt)});const It={title:"Code Studio",filterSets:be.filterSets,links:be.links};l(Qs(a)),l(bt(me.DEFAULT)),l(en(o)),l(tn(y)),l(vt(D,It)),l(sn(j)),l(Fa(L)),l(nn(D,e)),g!==void 0&&l(an(D,g)),l(on(r)),l(rn(f)),l(ln(K)),l(cn(He.makeDefaultWorkspaceSettings(o)))}catch(b){co.error(b),d(b)}}S()},[a,s,e,o,l,r]);const u=i==null&&c==null,h=!u&&c==null,p=c!=null?`${c}`:null;return n.jsxs(n.Fragment,{children:[h&&n.jsx(lo,{}),n.jsx(yt,{"data-testid":"app-init-loading",isLoading:u&&p==null,isLoaded:h,errorMessage:p})]})}const ho=Q.lazy(()=>zt(()=>import("./StyleGuideRoot-yJYmcGh-.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 n.jsx(Yt,{basename:uo,children:n.jsxs(Zt,{children:[n.jsx(Se,{exact:!0,path:"/",component:it}),n.jsx(Se,{path:"/notebooks/:notebookPath+",component:it}),n.jsx(Se,{path:"/styleguide",component:ho}),n.jsx(qt,{from:"*",to:"/"})]})})}function wo(){return m.useEffect(function(){da.register(new URL("./download/serviceWorker.js",window.location.href)),dn.init({getWorker:(s,e)=>e==="json"?new Xt:new Jt}),window["__react-beautiful-dnd-disable-dev-warnings"]=!0},[]),n.jsx(mo,{})}export{wo as AppRoot,wo as default};
6
- //# sourceMappingURL=AppRoot-B08JVIQj.js.map
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./StyleGuideRoot-DhvCRjxL.js","./vendor-BFFhZ99Y.js","./helpers-BosuxZz1.js","./vendor-vyKkiikc.css","./index-D7WLNVvn.js","./monaco-CsU3t3B1.js","./monaco-CgHo24-M.css","./index-CDBsexMR.css","./IrisGridModel-Bzvq9WcQ.js","./ControlType-BjxAIldT.js","./ControlType-CMNdrk88.css","./IrisGridModel-CSTdZTzd.css","./FontBootstrap-Chn0Co64.js","./GridTokenMouseHandler-D0Pqy2Vo.js","./IrisGridShortcuts-C5MgzGK1.js","./useMergeRef-CjjDys44.js","./IrisGridShortcuts-CJtrNKDP.css","./GridTokenMouseHandler-DTMTgCrk.css","./LocalWorkspaceStorage-CGH1Yjce.js","./LocalWorkspaceStorage-C_d9_CEf.css","./FontBootstrap-Bv630utO.css","./Grid-e4StjlLs.js","./Grid-DPUNpG8i.css","./StyleGuideRoot-BXf6u3u6.css"])))=>i.map(i=>d[i]);
2
+ var Lt=Object.defineProperty;var Pt=(a,s,e)=>s in a?Lt(a,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[s]=e;var v=(a,s,e)=>Pt(a,typeof s!="symbol"?s+"":s,e);import{W as lt,X as At,Y as _t,r as m,I as n,Z as ge,_ as ct,U as Q,a0 as De,L as I,a1 as E,M as N,a2 as Mt,a3 as fe,a4 as ce,a5 as ke,a6 as Le,a7 as ve,a8 as Ut,a9 as Kt,aa as $t,ab as Gt,H as Wt,ac as Bt,ad as Vt,ae as Ht,af as Yt,ag as Zt,ah as Se,ai as qt}from"./vendor-BFFhZ99Y.js";import{_ as zt,W as Xt,a as Jt}from"./monaco-CsU3t3B1.js";import{O as de,P as Z,T as P,D as Qt,I as _,a as M,b as V,u as dt,F as es,c as R,d as ts,e as oe,S as he,B as C,C as H,g as ss,f as ht,h as ut,i as mt,j as pt,k as gt,l as ns,m as as,n as os,o as rs,p as ft,q as is,r as A,s as Pe,t as ls,K as cs,v as Ke,w as ds,x as hs,y as us,z as ue,A as ms,E as ps,G as gs,H as fs,J as bs,L as re,M as ye,R as $e,N as q,Q as vs,U as G,V as me,W as Ss,X as ys,Y as xs,Z as bt,_ as vt,$ as Cs,a0 as Ts,a1 as ws,a2 as js,a3 as Ds,a4 as Es,a5 as Ns,a6 as Fs,a7 as Ge,a8 as Rs,a9 as St,aa as Is,ab as Os,ac as ks,ad as D,ae as Ls,af as ie,ag as Ps,ah as As,ai as _s,aj as Ms,ak as Us,al as Ks,am as $s,an as Gs,ao as Ws,ap as Bs,aq as Vs,ar as Hs,as as Ys,at as Zs,au as qs,av as zs,aw as Xs,ax as Js,ay as Qs,az as en,aA as tn,aB as sn,aC as nn,aD as an,aE as on,aF as rn,aG as ln,aH as cn,aI as dn}from"./ControlType-BjxAIldT.js";import{L as W,v as z,a as hn,M as un,b as mn,c as pn,d as gn,e as pe,f as fn,g as bn,h as vn,m as Sn,s as yn,l as xn,i as Cn,j as Tn,k as wn,n as jn,o as Dn,p as En,q as Nn,r as Fn,t as Rn,u as In,w as On,x as kn,y as Ln,z as Pn,A as An,B as _n,C as Mn,D as We,E as Be,F as Ve,G as Un,H as Kn,I as $n,J as Gn,K as Wn,N as yt}from"./index-D7WLNVvn.js";import{C as Bn,H as Ae,T as Vn,R as Hn,B as Yn,a as Zn,e as qn,L as xt,c as zn,N as Y,U as xe,b as Xn,A as Jn,g as Qn,u as ea,d as ta,f as sa,h as na,i as aa,l as oa,G as ra,j as ia,k as He}from"./LocalWorkspaceStorage-CGH1Yjce.js";import{T as te,P as la,I as Ct,S as ca,D as da}from"./IrisGridShortcuts-C5MgzGK1.js";import"./helpers-BosuxZz1.js";import"./useMergeRef-CjjDys44.js";class Ye{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 ha(a,s,e){if(a.length>s){var t=a.length-e;return{toKeep:a.slice(t),toPrune:a.slice(0,t)}}return{toKeep:a,toPrune:[]}}function Ze(a,s){var e=Object.keys(a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(a);s&&(t=t.filter(function(o){return Object.getOwnPropertyDescriptor(a,o).enumerable})),e.push.apply(e,t)}return e}function qe(a){for(var s=1;s<arguments.length;s++){var e=arguments[s]!=null?arguments[s]:{};s%2?Ze(Object(e),!0).forEach(function(t){O(a,t,e[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(e)):Ze(Object(e)).forEach(function(t){Object.defineProperty(a,t,Object.getOwnPropertyDescriptor(e,t))})}return a}function ze(a,s,e,t,o,r,i){try{var l=a[r](i),c=l.value}catch(d){return void e(d)}l.done?s(c):Promise.resolve(c).then(t,o)}function U(a){return function(){var s=this,e=arguments;return new Promise(function(t,o){var r=a.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 O(a,s,e){return(s=ua(s))in a?Object.defineProperty(a,s,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[s]=e,a}function ua(a){var s=ma(a,"string");return typeof s=="symbol"?s:s+""}function ma(a,s){if(typeof a!="object"||!a)return a;var e=a[Symbol.toPrimitive];if(e!==void 0){var t=e.call(a,s||"default");if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(a)}var Ce=W.module("PouchStorageTable"),pa="Deephaven.";lt.plugin(At);function ga(a,s){switch(a){case P.in:case P.contains:return{$regex:new RegExp("".concat(s)).toString()};case P.inIgnoreCase:return{$regex:new RegExp("".concat(s),"i").toString()};case P.eq:return{$eq:s};case P.notEq:return{$ne:s};case P.greaterThan:return{$gt:s};case P.greaterThanOrEqualTo:return{$gte:s};case P.lessThan:return{$lt:s};case P.lessThanOrEqualTo:return{$lte:s};case P.startsWith:return{$regex:new RegExp("^".concat(s,".*")).toString()};default:throw new Error("Unsupported type: ".concat(a))}}function fa(a){for(var{filterItems:s,filterOperators:e}=a,t=null,o=0;o<s.length;o+=1){var r=s[o],{columnName:i,type:l,value:c}=r,d={[i]:ga(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(a));return t}function Te(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return{$and:[...a.map(s=>fa(s)),{name:{$gt:null}},{id:{$gt:null}}]}}function ba(a){var s,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return[{id:e?"desc":"asc"},...(s=a==null?void 0:a.map(t=>({[t.column]:t.direction})))!==null&&s!==void 0?s:[]]}class va{constructor(s,e){O(this,"db",void 0),O(this,"changes",void 0),O(this,"listeners",[]),O(this,"itemListeners",new Map),O(this,"currentSize",0),O(this,"currentViewport",void 0),O(this,"currentReverse",!1),O(this,"currentFilter",null),O(this,"currentSort",null),O(this,"infoUpdatePromise",void 0),O(this,"viewportUpdatePromise",void 0),O(this,"currentViewportData",void 0),this.db=new lt("".concat(pa).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 U(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 U(function*(){var t=qe(qe({},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){Ce.debug("Update received",s),this.refreshInfo(),s.doc!==void 0&&this.sendItemUpdate(s.doc),this.refreshData()}fetchInfo(s){var e=this;return U(function*(){return e.db.find({selector:s,fields:[]})})()}refreshInfo(){var s=this;return U(function*(){try{var e,t;(e=s.infoUpdatePromise)===null||e===void 0||e.cancel(),s.infoUpdatePromise=Z.makeCancelable(s.fetchInfo(Te((t=s.currentFilter)!==null&&t!==void 0?t:[])));var o=yield s.infoUpdatePromise;s.currentSize=o.docs.length,s.sendUpdate()}catch(r){if(!Z.isCanceled(r))throw Ce.error("Unable to refreshInfo",r),r}})()}fetchViewportData(s,e,t){var o=this;return U(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 U(function*(){if(s.currentViewport)try{var e,t,o=Te((e=s.currentFilter)!==null&&e!==void 0?e:[]),r=ba(s.currentSort,s.currentReverse);(t=s.viewportUpdatePromise)===null||t===void 0||t.cancel(),s.viewportUpdatePromise=Z.makeCancelable(s.fetchViewportData(s.currentViewport,o,r));var i=yield s.viewportUpdatePromise;return s.currentViewportData=i,s.sendUpdate(),i}catch(l){if(!Z.isCanceled(l))throw Ce.error("Unable to refreshData",l),l}})()}refreshItem(s){var e=this;return U(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 U(function*(){var t=new Map,o=[{id:e.currentReverse?"desc":"asc"}];return yield Promise.all(s.map(function(){var r=U(function*(i){var l,[c,d]=i,u=d-c+1;return e.db.find({selector:Te((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 T=c+p;t.set(T,h.docs[p])}})});return function(i){return r.apply(this,arguments)}}())),t})()}}function Xe(a,s){var e=Object.keys(a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(a);s&&(t=t.filter(function(o){return Object.getOwnPropertyDescriptor(a,o).enumerable})),e.push.apply(e,t)}return e}function le(a){for(var s=1;s<arguments.length;s++){var e=arguments[s]!=null?arguments[s]:{};s%2?Xe(Object(e),!0).forEach(function(t){Tt(a,t,e[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(e)):Xe(Object(e)).forEach(function(t){Object.defineProperty(a,t,Object.getOwnPropertyDescriptor(e,t))})}return a}function Je(a,s,e,t,o,r,i){try{var l=a[r](i),c=l.value}catch(d){return void e(d)}l.done?s(c):Promise.resolve(c).then(t,o)}function ee(a){return function(){var s=this,e=arguments;return new Promise(function(t,o){var r=a.apply(s,e);function i(c){Je(r,t,o,i,l,"next",c)}function l(c){Je(r,t,o,i,l,"throw",c)}i(void 0)})}}function Tt(a,s,e){return(s=Sa(s))in a?Object.defineProperty(a,s,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[s]=e,a}function Sa(a){var s=ya(a,"string");return typeof s=="symbol"?s:s+""}function ya(a,s){if(typeof a!="object"||!a)return a;var e=a[Symbol.toPrimitive];if(e!==void 0){var t=e.call(a,s||"default");if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(a)}var xa=2500,Ca=2e3,k=W.module("PouchCommandHistoryTable");class Qe extends va{constructor(s,e){var t;super("CommandHistoryStorage.".concat(s),{auto_compaction:!0,revs_limit:1}),Tt(this,"searchText",void 0),this.cache=e,this.cache.tableRegistry.has(this.cacheKey)||this.cache.tableRegistry.set(this.cacheKey,new Set),k.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){k.debug("Setting search filters",s),this.searchText=s.trim().toLowerCase(),this.setFilters(s?[Ye.makeFilterConfig([Ye.makeFilterItem("name",P.contains,s)])]:[])}dbUpdate(s){k.debug("Clearing cache and refreshing data",s),this.cache.response.delete(this.cacheKey),super.dbUpdate(s)}fetchData(s){var e=this;return ee(function*(){return Z.withTimeout(0,ee(function*(){e.cache.response.has(e.cacheKey)?k.debug("Fetching from cache",e.searchText,e.viewport):(k.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});k.debug("Fetched ".concat(r.length," command history items"));var{toKeep:i,toPrune:l}=ha(r,xa,Ca);return l.length&&e.pruneItems(l),{docs:i}})));var t=e.cache.response.get(e.cacheKey);return e.searchText==null||e.searchText===""?t:le(le({},t),{},{docs:(yield t).docs.filter(o=>{var{name:r}=o;return r.toLowerCase().includes(e.searchText)})})}))})()}fetchInfo(s){var e=this;return ee(function*(){return e.fetchData(s)})()}fetchViewportData(s,e,t){var o=this;return ee(function*(){var r=yield o.fetchData(e);k.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 ee(function*(){if(e.cache.isPruning.get(e.cacheKey)===!0){k.debug("Pruning already in progress. Skipping.");return}try{k.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=>le(le({},o),{},{_deleted:!0}))),e.cache.isPruning.set(e.cacheKey,!1),t(),k.debug("Finished pruning command history items")}catch(o){k.error("An error occurred while pruning db",o)}})()}close(){var s,e,t;k.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 we(a,s,e){return(s=Ta(s))in a?Object.defineProperty(a,s,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[s]=e,a}function Ta(a){var s=wa(a,"string");return typeof s=="symbol"?s:s+""}function wa(a,s){if(typeof a!="object"||!a)return a;var e=a[Symbol.toPrimitive];if(e!==void 0){var t=e.call(a,s||"default");if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(a)}var et=W.module("PouchCommandHistoryCache");class ja{constructor(){we(this,"isPruning",void 0),we(this,"response",void 0),we(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&&(et.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&&(et.debug("Resuming event listeners on '".concat(s,"' table"),o),o.listenForChanges())})}}}function tt(a,s){var e=Object.keys(a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(a);s&&(t=t.filter(function(o){return Object.getOwnPropertyDescriptor(a,o).enumerable})),e.push.apply(e,t)}return e}function st(a){for(var s=1;s<arguments.length;s++){var e=arguments[s]!=null?arguments[s]:{};s%2?tt(Object(e),!0).forEach(function(t){Ee(a,t,e[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(e)):tt(Object(e)).forEach(function(t){Object.defineProperty(a,t,Object.getOwnPropertyDescriptor(e,t))})}return a}function nt(a,s,e,t,o,r,i){try{var l=a[r](i),c=l.value}catch(d){return void e(d)}l.done?s(c):Promise.resolve(c).then(t,o)}function je(a){return function(){var s=this,e=arguments;return new Promise(function(t,o){var r=a.apply(s,e);function i(c){nt(r,t,o,i,l,"next",c)}function l(c){nt(r,t,o,i,l,"throw",c)}i(void 0)})}}function Ee(a,s,e){return(s=Da(s))in a?Object.defineProperty(a,s,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[s]=e,a}function Da(a){var s=Ea(a,"string");return typeof s=="symbol"?s:s+""}function Ea(a,s){if(typeof a!="object"||!a)return a;var e=a[Symbol.toPrimitive];if(e!==void 0){var t=e.call(a,s||"default");if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(a)}var at=W.module("PouchCommandHistoryStorage");class Na{constructor(){Ee(this,"cache",new ja),Ee(this,"updateTableMap",new Map)}getUpdateTable(s){return this.updateTableMap.has(s)||this.updateTableMap.set(s,new Qe(s,this.cache)),this.updateTableMap.get(s)}getTable(s){var e=this;return je(function*(){return new Qe(s,e.cache)})()}addItem(s,e,t,o){var r=this;return je(function*(){return r.updateItem(s,{id:"".concat(new Date().getTime()),name:t,data:o})})()}updateItem(s,e){var t=this;return je(function*(){var o=t.getUpdateTable(s),r=yield o.refreshItem(e.id),i=st(st({},r??{}),e);return at.debug("Updating item",i),yield o.put(i),at.debug("Update saved"),e})()}listenItem(s,e,t){var o=this.getUpdateTable(s);return o.onItemUpdate(e,t)}}const wt="SET_LAYOUT_STORAGE",Fa=a=>({type:wt,payload:a});var{dh:Ra}=globalThis;const Ia=W.module("SettingsUtils");function Oa(a){return a.formatString!=null}function jt(a){const s=_t.parse(window.navigator.userAgent),e=`${s.browser.name??""} ${Number(parseFloat(s.browser.version??""))||""}`,t=`${s.os.name??""} ${s.os.version??""}`,o=a.get("python.version")??"";return{"Engine Version":a.get("deephaven.version")??"Unknown","Web UI Version":"1.5.2",...o!==""?{"Python Version":o}:{},"Java Version":a.get("java.version")??"Unknown","Groovy Version":a.get("groovy.version")??"Unknown","Barrage Version":a.get("barrage.version")??"Unknown","Browser Name":e.trim()||"Unknown","User Agent OS":t.trim()||"Unknown"}}function Ne(a){return Array.from(a.entries()).filter(s=>s[1].version!==void 0).reduce((s,[e,t])=>({...s,[e]:t.version}),{})}function Fe(a){const s=a==null?void 0:a.querySelector("input, select, textarea");s&&s.focus()}function Dt(a,s){return a.defaultFormatString===s.defaultFormatString}function ka(a,s){return Dt(a,s)}function La(a,s){return Dt(a,s)}function Et(a){return a!==""&&Qt.isValidColumnName(a)}function X(a,s,e){if(!s||e.formatString==null||!Oa(e))return!1;switch(s){case"datetime":return V.isValid(a,e);case"decimal":return M.isValid(a,e);case"int":return _.isValid(a,e);default:return Ia.warn("Trying to validate format of unknown type"),!0}}function Pa(a){const{id:s,isNewRule:e,...t}=a;return t}function Aa(a,s){return Et(s.columnName)&&X(a,s.columnType,s.format)}function Nt(a){const{timestamp:s,timeZone:e,showTimeZone:t,showTSeparator:o,isGlobalOptions:r,legacyGlobalFormat:i}=a,l=dt(),c=m.useMemo(()=>new es(l,[],{timeZone:e,showTimeZone:t,showTSeparator:o}),[l,t,o,e]),d=r?V.getGlobalFormats(t,o):V.getFormats(t,o);return i!=null&&!d.includes(i)&&d.unshift(i),n.jsx(n.Fragment,{children:d.map(u=>{const h=V.makeFormat("",u,V.TYPE_GLOBAL);return n.jsx("option",{value:u,"data-testid":"time-format",children:c.getFormattedString(s,R.dataType.DATETIME,"",h)},u)})})}function _a(){return n.jsx(n.Fragment,{children:ts.TIME_ZONES.map(a=>{const{label:s,value:e}=a;return n.jsx("option",{value:e,children:s},e)})})}const B=W.module("FormattingSectionContent"),ne=class ne extends m.PureComponent{constructor(e){super(e);v(this,"debouncedCommitChanges");v(this,"pendingUpdates");v(this,"containerRef");v(this,"getCachedDateTimeFormatOptions",De((e,t,o,r=!1,i)=>{const{timestampAtMenuOpen:l}=this.state;return n.jsx(Nt,{timestamp:l,timeZone:e,showTimeZone:t,showTSeparator:o,isGlobalOptions:r,legacyGlobalFormat:i})},{max:100}));this.debouncedCommitChanges=ct(this.commitChanges.bind(this),ne.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=Q.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(){Fe(this.containerRef.current)}componentWillUnmount(){this.debouncedCommitChanges.flush()}queueUpdate(e){this.pendingUpdates.push(e),this.debouncedCommitChanges()}handleDefaultDateTimeFormatChange(e){B.debug("handleDefaultDateTimeFormatChange",e);const t={defaultDateTimeFormat:e};this.setState(t),this.queueUpdate(t)}handleDefaultDecimalFormatChange(e){B.debug("handleDefaultDecimalFormatChange",e.target.value);const t={defaultDecimalFormatOptions:{defaultFormatString:e.target.value}};this.setState(t),X(dh,R.dataType.DECIMAL,M.makeCustomFormat(e.target.value))&&this.queueUpdate(t)}handleDefaultIntegerFormatChange(e){B.debug("handleDefaultIntegerFormatChange",e.target.value);const t={defaultIntegerFormatOptions:{defaultFormatString:e.target.value}};this.setState(t),X(dh,R.dataType.INT,_.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;B.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;B.debug("handleResetTimeZone"),this.setState({timeZone:t}),this.queueUpdate({timeZone:void 0})}handleResetDecimalFormat(){const{defaults:e}=this.props,{defaultDecimalFormatOptions:t}=e;B.debug("handleResetDecimalFormat"),this.setState({defaultDecimalFormatOptions:t}),this.queueUpdate({defaultDecimalFormatOptions:void 0})}handleResetIntegerFormat(){const{defaults:e}=this.props,{defaultIntegerFormatOptions:t}=e;B.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:T}=this.state,{defaultFormatString:S=M.DEFAULT_FORMAT_STRING}=r??{},{defaultFormatString:b=_.DEFAULT_FORMAT_STRING}=i??{},g=l===e.timeZone,w=d===e.showTSeparator&&c===e.showTimeZone&&o===e.defaultDateTimeFormat,L=ka(r,e.defaultDecimalFormatOptions),j=La(i,e.defaultIntegerFormatOptions);return n.jsx("div",{className:"app-settings-formatting-section",ref:this.containerRef,children:n.jsxs("div",{className:"container-fluid p-0",children:[n.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."}),n.jsxs("div",{className:"form-row mb-2",children:[n.jsx("label",{className:"col-form-label col-3",htmlFor:"select-reset-timezone",children:"Time zone"}),n.jsx("div",{className:"col pr-0",children:n.jsx(he,{className:"custom-select",value:l,onChange:this.handleTimeZoneChange,id:"select-reset-timezone",children:n.jsx(_a,{})})}),n.jsx("div",{className:"col-1 btn-col",children:n.jsx(C,{kind:"ghost",icon:z,onClick:this.handleResetTimeZone,tooltip:"Reset Time Zone",className:I("btn-reset","btn-reset-time-zone",{hidden:g})})})]}),n.jsxs("div",{className:"form-row mb-2",children:[n.jsx("label",{className:"col-form-label col-3",htmlFor:"select-default-time-format",children:"DateTime"}),n.jsx("div",{className:"col pr-0",children:n.jsx(he,{className:"custom-select",value:o,onChange:this.handleDefaultDateTimeFormatChange,id:"select-default-time-format",children:this.getCachedDateTimeFormatOptions(l,c,d,!0,o)})}),n.jsx("div",{className:"col-1 btn-col",children:n.jsx(C,{kind:"ghost",icon:z,onClick:this.handleResetDateTimeFormat,tooltip:"Reset DateTime Options",className:I("btn-reset","btn-reset-date-time",{hidden:w})})})]}),n.jsx("div",{className:"form-row",children:n.jsx("div",{className:"offset-3 col-9",children:n.jsx(H,{checked:c??null,onChange:this.handleShowTimeZoneChange,children:"Show time zone in dates"})})}),n.jsx("div",{className:"form-row mb-3",children:n.jsx("div",{className:"offset-3 col-9",children:n.jsx(H,{checked:d??null,onChange:this.handleShowTSeparatorChange,children:"Show 'T' separator"})})}),n.jsxs("div",{className:"form-row mb-2",children:[n.jsx("label",{className:"col-form-label col-3",htmlFor:"default-decimal-format-input",children:"Decimal"}),n.jsx("div",{className:"col pr-0",children:n.jsx("input",{className:I("form-control","flex-grow-1","default-decimal-format-input",{"is-invalid":!X(t,R.dataType.DECIMAL,M.makeCustomFormat(S))}),"data-lpignore":!0,placeholder:M.DEFAULT_FORMAT_STRING,type:"text",id:"default-decimal-format-input",value:S,onChange:this.handleDefaultDecimalFormatChange})}),n.jsx("div",{className:"col-1 btn-col",children:n.jsx(C,{kind:"ghost",icon:z,onClick:this.handleResetDecimalFormat,tooltip:"Reset Decimal Formatting",className:I("btn-reset","btn-reset-decimal",{hidden:L}),"data-testid":"btn-reset-decimal"})})]}),n.jsxs("div",{className:"form-row mb-2",children:[n.jsx("label",{className:"col-form-label col-3",htmlFor:"default-integer-format-input",children:"Integer"}),n.jsx("div",{className:"col pr-0",children:n.jsx("input",{className:I("form-control","flex-grow-1","default-integer-format-input",{"is-invalid":!X(t,R.dataType.INT,_.makeCustomFormat(b))}),"data-lpignore":!0,placeholder:_.DEFAULT_FORMAT_STRING,type:"text",id:"default-integer-format-input",value:b,onChange:this.handleDefaultIntegerFormatChange})}),n.jsx("div",{className:"col-1 btn-col",children:n.jsx(C,{kind:"ghost",icon:z,onClick:this.handleResetIntegerFormat,tooltip:"Reset Integer Formatting",className:I("btn-reset","btn-reset-integer",{hidden:j}),"data-testid":"btn-reset-integer"})})]}),n.jsx("div",{className:"form-row mb-2",children:n.jsx("div",{className:"offset-3 col-9",children:n.jsx(H,{checked:u??null,onChange:this.handleTruncateNumbersWithPoundChange,children:"Show truncated numbers as ###"})})}),n.jsxs("div",{className:"form-row mb-3",children:[n.jsx("label",{className:"col-form-label col-3",htmlFor:"default-integer-format-input",children:"String"}),n.jsxs("div",{className:"col pr-0 pt-2",children:[n.jsxs(H,{checked:h??null,onChange:this.handleShowEmptyStringsChange,children:["Show empty strings as"," ",n.jsx("span",{className:"font-italic text-muted",children:"empty"})]}),n.jsxs(H,{checked:p??null,onChange:this.handleShowNullStringsChange,children:["Show null strings as"," ",n.jsx("span",{className:"font-italic text-muted",children:"null"})]})]})]}),n.jsxs("div",{className:"form-row mb-3",id:"show_extra_group_column_div",children:[n.jsx("label",{className:"col-form-label col-3",htmlFor:"default-show-extra-group-column",children:"Rollup"}),n.jsx("div",{className:"col pr-0 pt-2",id:"default-show-extra-group-column",children:n.jsx(H,{checked:T,onChange:this.handleShowExtraGroupColumnChange,children:'Show extra "group" column'})})]})]})})}};v(ne,"defaultProps",{scrollTo:()=>{}}),v(ne,"inputDebounceTime",250);let Re=ne;const Ma=a=>({defaultDateTimeFormat:ss(a),defaultDecimalFormatOptions:ht(a),defaultIntegerFormatOptions:ut(a),dh:mt(a),showTimeZone:pt(a),showTSeparator:gt(a),truncateNumbersWithPound:ns(a),showEmptyStrings:as(a),showNullStrings:os(a),showExtraGroupColumn:rs(a),timeZone:ft(a),defaults:is(a)}),Ua=ge(Ma,{updateSettings:oe})(Re);function Ka(){const[a,s]=m.useState(!1),e=()=>{s(!a)};return n.jsxs(n.Fragment,{children:[n.jsx(C,{kind:"ghost",onClick:e,icon:hn,children:"Legal Notices"}),n.jsxs(un,{isOpen:a,toggle:e,children:[n.jsx(mn,{toggle:e,children:"Legal Notice"}),n.jsxs(pn,{children:[n.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."}),n.jsxs("p",{children:["© 2016-",new Date().getFullYear()," Deephaven Data Labs LLC. Patent Pending."]})]})]})]})}function $(a){const{children:s,isExpanded:e,sectionKey:t,title:o,onToggle:r}=a;return n.jsxs(n.Fragment,{children:[n.jsx("div",{children:n.jsxs(C,{kind:"ghost",className:"btn-collapse-trigger",onClick:()=>r(t),children:[n.jsx("div",{className:"d-flex align-items-center flex-grow-1",children:o}),n.jsx("div",{className:"flex-shrink-0",children:n.jsx(N,{transform:e?"flip-v":"",icon:gn})})]})}),n.jsx(Bn,{in:e,autoFocusOnShow:!0,children:s})]})}$.propTypes={children:E.node,isExpanded:E.bool.isRequired,sectionKey:E.string.isRequired,title:E.node.isRequired,onToggle:E.func};$.defaultProps={children:null,onToggle:()=>{}};function $a({shortcut:a,displayText:s,categoryName:e,onChange:t}){const[o,r]=m.useState(s),[i,l]=m.useState(a.getKeyState()),[c,d]=m.useState(!1),[u,h]=m.useState("");m.useEffect(function(){r(s),l(a.getKeyState())},[s,a]),m.useEffect(function(){r(A.getDisplayText(i)),a.matchesKeyState(i)&&d(!1)},[i,a]),m.useEffect(function(){if(c){if(!A.isValidKeyState(i)){A.isAllowedKey(i.keyValue)?h("Must contain a modifier key"):h("Must contain an allowed action key");return}const f=Pe.getConflictingShortcuts(i).filter(y=>y.id.startsWith(e)&&y!==a).map(y=>y.name);if(f.length){h(`Conflicts with ${f.join(", ")}`);return}h("")}else h("")},[c,i,e,a]);function p(j){if(j.stopPropagation(),j.preventDefault(),a.isEditable&&!j.repeat){const f=A.getKeyStateFromEvent(j),y=A.createKeyState([cs.BACKSPACE]);A.doKeyStatesMatch(f,y)?l(A.NULL_KEY_STATE):l(f)}}function T(j){j.stopPropagation(),j.preventDefault(),a.matchesKeyState(i)||d(!0)}function S(){Ke.disableAllActions()}function b(){Ke.enableAllActions()}function g(){a.setKeyState(i),d(!1),t(a)}function w(){const j=a.getKeyState();l(j),d(!1)}function L(){d(!0),l(a.getDefaultKeyState())}return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"shortcut-item-container",children:[n.jsxs("label",{className:"shortcut-item-name",children:[a.name,a.tooltip!==void 0&&n.jsx(ls,{children:a.tooltip})]}),n.jsxs("div",{className:"shortcut-item-input-container",children:[n.jsx("input",{className:I("form-control",{"is-invalid":u}),onKeyDown:p,onKeyUp:T,onFocus:S,onBlur:b,disabled:!a.isEditable,value:o,readOnly:!0}),!A.doKeyStatesMatch(i,a.getDefaultKeyState())&&!u&&n.jsx(C,{className:"reset-to-default-button",kind:"ghost",icon:n.jsx(N,{icon:z,transform:{rotate:90,flipX:!0}}),tooltip:"Reset to default",onClick:L})]})]}),c&&n.jsxs("div",{className:I("shortcut-item-message-container",{"is-invalid":u}),children:[n.jsx("div",{className:"shortcut-item-message",children:u}),n.jsxs("div",{className:"shortcut-item-message-buttons",children:[A.isValidKeyState(i)&&n.jsx(C,{kind:"ghost",onClick:g,children:"Confirm"}),n.jsx(C,{kind:"ghost",onClick:w,children:"Undo"})]})]})]})}function Ga({shortcutOverrides:a={},updateSettings:s}){const e=m.useCallback(i=>{const l=A.isMacPlatform,c={mac:{...a.mac},windows:{...a.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,a]);let t=Array.from(Pe.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),n.jsxs(n.Fragment,{children:[n.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=>n.jsx(Wa,{name:i.name,shortcuts:i.shortcuts,saveShortcutOverrides:e},i.name))]})}function Wa({name:a,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 n.jsxs("div",{className:"mt-3",children:[n.jsx("div",{className:"font-weight-bold",children:t(a)}),o.map((c,d)=>n.jsx($a,{shortcut:c,displayText:l[d],categoryName:a,onChange:i},c.id))]})}const Ba=a=>({shortcutOverrides:ds(a)}),Va={updateSettings:oe},Ha=ge(Ba,Va)(Ga),Ya=[{value:R.dataType.DATETIME,label:"DateTime"},{value:R.dataType.DECIMAL,label:"Decimal"},{value:R.dataType.INT,label:"Integer"}];function Za(){const a=Ya.map(s=>n.jsx("option",{value:s.value,children:s.label},`key-columnType-${s.value}`));return n.jsxs(n.Fragment,{children:[n.jsx("option",{disabled:!0,value:"",children:"Select Type"},"key-columnType-placeholder"),a]})}const ae=class ae extends m.PureComponent{constructor(e){super(e);v(this,"debouncedCommitChanges");v(this,"containerRef");v(this,"addFormatRuleButtonRef");v(this,"lastFormatRuleIndex");v(this,"getCachedColumnTypeOptions",De(()=>n.jsx(Za,{}),{max:100}));v(this,"getCachedDateTimeFormatOptions",De((e,t,o,r=!1,i)=>{const{timestampAtMenuOpen:l}=this.state;return n.jsx(Nt,{timestamp:l,timeZone:e,showTimeZone:t,showTSeparator:o,isGlobalOptions:r,legacyGlobalFormat:i})},{max:100}));this.debouncedCommitChanges=ct(this.commitChanges.bind(this),ae.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=Q.createRef(),this.addFormatRuleButtonRef=Q.createRef(),this.lastFormatRuleIndex=l.length,this.state={formatSettings:l,formatRulesChanged:!1,showTimeZone:o,showTSeparator:r,timeZone:i,timestampAtMenuOpen:new Date}}componentDidMount(){Fe(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;pe(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:R.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(),Fe(e)}commitChanges(){const{formatSettings:e}=this.state,{dh:t}=this.props,o=e.filter(l=>Aa(t,l)).map(Pa)??[],{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.")),Et(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.")):X(t,e.columnType,e.format)||(o.hasFormatError=!0,r.push("Invalid formatting rule.")),o.message=r.join(`
3
+ `)),o}makeDefaultFormatterItemByType(e){switch(R.getNormalizedType(e)){case R.dataType.INT:{const{defaultIntegerFormatOptions:t}=this.props,{defaultFormatString:o}=t;return _.makeFormat("",o??_.DEFAULT_FORMAT_STRING,_.TYPE_GLOBAL,void 0)}case R.dataType.DECIMAL:{const{defaultDecimalFormatOptions:t}=this.props,{defaultFormatString:o}=t;return M.makeFormat("",o??M.DEFAULT_FORMAT_STRING,M.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 n.jsxs("fieldset",{className:"container-fluid format-rule-container",children:[n.jsxs("div",{className:"form-row",children:[n.jsxs("div",{className:"form-group col-7 mb-2",children:[n.jsx("label",{htmlFor:o,children:"Column Name"}),n.jsx("input",{id:o,className:I("form-control",{"is-invalid":h.hasColumnNameError}),"data-lpignore":!0,type:"text",value:t.columnName,onChange:c,onBlur:d})]}),n.jsxs("div",{className:"form-group col mb-2",children:[n.jsx(C,{kind:"ghost",className:"btn-delete-format-rule float-right",tabIndex:-1,onClick:()=>this.handleFormatRuleDelete(e),icon:fn,tooltip:"Delete","aria-label":"Delete Format Rule"}),n.jsx("label",{htmlFor:r,children:"Column Type"}),n.jsx(he,{id:r,className:"custom-select",value:t.columnType,onChange:u,children:l})]})]}),n.jsx("div",{className:"form-row",children:n.jsxs("div",{className:"form-group col-12 d-flex mb-2",children:[n.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)]})}),n.jsx("div",{className:"form-row",children:n.jsx("div",{className:"form-group col-12 d-flex mb-2",children:h.message&&n.jsx("p",{className:"text-danger",children:h.message})})})]},e)}renderFormatRuleInput(e,t,o,r,i){switch(R.getNormalizedType(t)){case R.dataType.DATETIME:return this.renderDateTimeFormatRuleInput(e,o,r,i);case R.dataType.DECIMAL:return this.renderDecimalFormatRuleInput(e,o,r,i);case R.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 n.jsxs(he,{className:I("custom-select",{"is-invalid":r}),value:d,id:t,onChange:u=>{const h=V.makeFormat("",u,V.TYPE_GLOBAL);this.handleFormatRuleChange(e,"format",h)},children:[n.jsx("option",{value:"",disabled:!0,children:"Select format"},"default"),this.getCachedDateTimeFormatOptions(c,i,l)]})}renderIntegerFormatRuleInput(e,t,o,r){const{defaultIntegerFormatOptions:i}=this.props;pe(i);const{defaultFormatString:l}=i,c=o.formatString??"";return n.jsx("input",{className:I("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)}})}renderDecimalFormatRuleInput(e,t,o,r){const{defaultDecimalFormatOptions:i}=this.props,{defaultFormatString:l}=i,c=o.formatString??"";return n.jsx("input",{className:I("form-control","flex-grow-1",{"is-invalid":r}),"data-lpignore":!0,id:t,placeholder:l??M.DEFAULT_FORMAT_STRING,type:"text",value:c,onChange:d=>{const u=M.makeFormat("",d.target.value,M.TYPE_GLOBAL,void 0);this.handleFormatRuleChange(e,"format",u)}})}render(){const{formatRulesChanged:e,formatSettings:t}=this.state,o=t.map((i,l)=>n.jsx(hs,{onEnter:this.handleFormatRuleEntered,children:this.renderFormatRule(l,i)},i.id)),r=n.jsx(C,{kind:"ghost",className:"mb-3",onClick:this.handleFormatRuleCreate,ref:this.addFormatRuleButtonRef,icon:bn,children:"Add New Rule"});return n.jsxs("div",{className:"app-settings-formatting-section",ref:this.containerRef,children:[n.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."}),n.jsx(Mt,{appear:e,enter:e,exit:e,children:o}),r]})}};v(ae,"defaultProps",{scrollTo:()=>{}}),v(ae,"inputDebounceTime",250);let Ie=ae;const qa=a=>({formatter:us(a),defaultDecimalFormatOptions:ht(a),defaultIntegerFormatOptions:ut(a),dh:mt(a),showTimeZone:pt(a),showTSeparator:gt(a),timeZone:ft(a)}),za=ge(qa,{updateSettings:oe})(Ie);function Xa(){const a=fe(),s=ue(ms),e=ue(ps),t=m.useCallback(r=>{a(oe({webgl:r}))},[a]),o=e?n.jsx(te,{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."}):n.jsx(te,{children:"WebGL is disabled by your system administrator. Contact your system administrator to enable."});return n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"app-settings-menu-description",children:"Advanced settings here. Be careful!"}),n.jsxs("div",{className:"form-row mb-3 pl-1",children:[n.jsx(ce,{isSelected:s,isDisabled:!e,onChange:t,marginEnd:"size-0",children:"Enable WebGL"}),n.jsxs(ke,{variant:"info",marginTop:"size-50",children:[n.jsx(Ae,{children:"Enable WebGL"}),n.jsx(Le,{children:n.jsx(te,{children:o})})]})]})]})}function Ja(){const a=gs(),s=ue(fs),e=fe(),t=m.useCallback(r=>{if(r!=="regular"&&r!=="compact"&&r!=="spacious")throw new Error(`Invalid grid density value: ${r}`);e(oe({gridDensity:r}))},[e]),o=s.gridDensity;return pe(a,"ThemeContext value is null"),n.jsxs(n.Fragment,{children:[n.jsx(Vn,{}),n.jsxs(la,{label:"Default table density",selectedKey:o,onChange:t,children:[n.jsx(ve,{children:"Regular"},"regular"),n.jsx(ve,{children:"Compact"},"compact"),n.jsx(ve,{children:"Spacious"},"spacious")]})]})}function Qa(){const a=ue(bs),s=fe(),{isMinimapEnabled:e,formatOnSave:t,python:{linter:o={}}={}}=a,{isEnabled:r,config:i=$e}=o,l=m.useCallback(g=>s(re({isMinimapEnabled:g})),[s]),c=m.useCallback(g=>s(re({formatOnSave:g})),[s]),d=m.useCallback(g=>{s(re({python:{linter:{...o,isEnabled:g}}})),ye.isRuffEnabled=g,ye.setRuffSettings(i)},[s,o,i]),u=m.useCallback(g=>{s(re({python:{linter:{...o,config:JSON.stringify(g)===JSON.stringify($e)?void 0:g}}})),ye.setRuffSettings(g)},[s,o]),h=JSON.stringify(i,null,2),[p,T]=m.useState(!1),S=m.useCallback(()=>{T(!1)},[]),b=m.useCallback(g=>{u(g),S()},[u,S]);return n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"app-settings-menu-description",children:"Customize the notebook editor."}),n.jsx("div",{className:"form-row pl-1",children:n.jsx(ce,{isSelected:e,onChange:l,children:"Enable Minimap"})}),n.jsxs("div",{className:"form-row align-items-center pl-1",children:[n.jsx(ce,{isSelected:t,onChange:c,margin:0,children:"Format on Save"}),n.jsxs(ke,{variant:"info",children:[n.jsx(Ae,{children:"Format on Save"}),n.jsx(Le,{children:n.jsx(te,{children:"The Ruff settings control formatting options. Notebooks can be formatted manually using the right-click context menu."})})]})]}),n.jsx("div",{className:"form-row pl-1",children:n.jsx(ce,{isSelected:r,onChange:d,marginEnd:0,children:"Enable Ruff Python Linter"})}),n.jsx("div",{className:"form-row pl-1",children:n.jsxs(Ut,{onPress:()=>T(!0),children:[n.jsx(Kt,{children:n.jsx(N,{icon:vn})}),n.jsx(te,{children:"Customize Ruff Settings"})]})}),p&&n.jsx(Hn,{text:h,isOpen:p,onClose:S,onSave:b})]})}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=Q.createRef(),this.broadcastChannel=new BroadcastChannel(Yn),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(Sn(Zn))}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=Ne(t);qn(xn,{uiVersion:"1.5.2",userAgent:navigator.userAgent,...Object.fromEntries(e),pluginInfo:o},yn.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=jt(o),c=Ne(r),d=o.get("deephaven.version"),u=q.COPY_VERSION_INFO.getDisplayText(),h=(b,g)=>n.jsxs(m.Fragment,{children:[n.jsx("div",{children:b}),n.jsx("div",{children:g})]},b),p=i.displayName??i.name,T=i.image!=null&&i.image!=="",S=p!=="";return n.jsxs("div",{className:"app-settings-menu",children:[n.jsxs("header",{className:"app-settings-menu-header",children:[n.jsxs("div",{className:"user-info",children:[n.jsxs("div",{className:"user-image",children:[!T&&n.jsx(N,{icon:Cn,transform:"grow-8"}),T&&n.jsx("img",{src:i.image,alt:p})]}),n.jsxs("div",{className:"user-details",children:[S&&n.jsxs("div",{className:"user-name",children:[p,i.operateAs!=null&&i.name!==i.operateAs&&n.jsxs(n.Fragment,{children:[n.jsxs("span",{className:"font-weight-light font-italic",children:[" ","as"," "]}),n.jsxs("span",{className:"operating-as-user",children:[n.jsx(N,{icon:Tn,className:"mr-1"}),i.operateAs]})]})]}),i.permissions.canLogout&&n.jsx("button",{type:"button",className:"btn btn-link",onClick:this.handleLogout,children:"logout"})]})]}),n.jsx(C,{kind:"ghost",className:"btn-close-settings-menu",onClick:this.handleClose,icon:n.jsx(N,{icon:wn,transform:"grow-4"}),tooltip:"Close"})]}),n.jsxs("div",{className:"app-settings-menu-content",ref:this.menuContentRef,children:[n.jsx("h5",{children:"Settings"}),n.jsx("hr",{className:"my-0"}),n.jsx($,{sectionKey:x.FORMATTING_SECTION_KEY,isExpanded:this.isSectionExpanded(x.FORMATTING_SECTION_KEY),title:n.jsxs(n.Fragment,{children:[n.jsx(N,{icon:jn,transform:"grow-4",className:"mr-2"}),"Default Format & Time zone"]}),onToggle:this.handleSectionToggle,children:n.jsx(Ua,{})}),n.jsx($,{sectionKey:x.COLUMN_SPECIFIC_SECTION_KEY,isExpanded:this.isSectionExpanded(x.COLUMN_SPECIFIC_SECTION_KEY),title:n.jsxs(n.Fragment,{children:[n.jsx(N,{icon:Dn,transform:"grow-4",className:"mr-2"}),"Format by Column Name & Type"]}),onToggle:this.handleSectionToggle,children:n.jsx(za,{scrollTo:this.handleScrollTo})}),n.jsx($,{sectionKey:x.THEME_SECTION_KEY,isExpanded:this.isSectionExpanded(x.THEME_SECTION_KEY),onToggle:this.handleSectionToggle,title:n.jsxs(n.Fragment,{children:[n.jsx(N,{icon:En,transform:"grow-4",className:"mr-2"}),"Theme"]}),children:n.jsx(Ja,{})}),n.jsx($,{sectionKey:x.EDITOR_SECTION_KEY,isExpanded:this.isSectionExpanded(x.EDITOR_SECTION_KEY),onToggle:this.handleSectionToggle,title:n.jsxs(n.Fragment,{children:[n.jsx(N,{icon:Nn,transform:"grow-4",className:"mr-2"}),"Editor"]}),children:n.jsx(Qa,{})}),n.jsx($,{sectionKey:x.SHORTCUT_SECTION_KEY,isExpanded:this.isSectionExpanded(x.SHORTCUT_SECTION_KEY),title:n.jsxs(n.Fragment,{children:[n.jsx(N,{icon:Fn,transform:"grow-4",className:"mr-2"}),"Keyboard Shortcuts"]}),onToggle:this.handleSectionToggle,children:n.jsx(Ha,{})}),n.jsx($,{sectionKey:x.ADVANCED_SECTION_KEY,isExpanded:this.isSectionExpanded(x.ADVANCED_SECTION_KEY),title:n.jsxs(n.Fragment,{children:[n.jsx(N,{icon:Rn,transform:"grow-4",className:"mr-2"}),"Advanced"]}),onToggle:this.handleSectionToggle,children:n.jsx(Xa,{})}),n.jsxs("div",{className:"app-settings-footer",children:[n.jsxs("div",{className:"app-settings-footer-section",children:[n.jsxs("div",{className:"app-settings-footer-item",children:[n.jsx("div",{className:"font-weight-bold",children:"Support"}),n.jsxs("div",{children:["GitHub: ",n.jsx("a",{href:e,className:"custom-link",target:"_blank",rel:"noopener noreferrer",children:e})]}),n.jsx(C,{kind:"tertiary",className:"mt-2 py-2",onClick:this.handleExportSupportLogs,children:"Export Logs"})]}),n.jsxs("div",{className:"app-settings-footer-item",children:[n.jsx("div",{className:"font-weight-bold",children:"Documentation"}),n.jsx("a",{target:"_blank",rel:"noreferrer noopener",href:t,className:"custom-link",children:t})]}),n.jsxs("div",{className:"app-settings-footer-item",children:[n.jsx("div",{className:"font-weight-bold",children:"Version"}),n.jsxs("span",{className:"d-inline-block text-muted",children:[d,n.jsxs(ke,{variant:"info",children:[n.jsx(Ae,{children:"Version Info"}),n.jsxs(Le,{children:[n.jsx("div",{className:"detailed-server-config",children:Object.entries(l).map(([b,g])=>h(b,g))}),n.jsxs(vs,{kind:"inline",tooltip:"Copy version numbers",copy:Object.entries({...l,...c}).map(([b,g])=>`${b}: ${g}`).join(`
4
+ `),children:["Copy Versions",n.jsxs("small",{className:"text-muted",children:["(",u,")"]})]})]})]})]})]}),n.jsxs("div",{className:"app-settings-footer-item",children:[n.jsx("div",{className:"font-weight-bold",children:"Plugins"}),n.jsx("div",{className:"container",children:Array.from(r.entries()).filter(b=>b[1].version!==void 0).map(([b,g])=>n.jsxs("div",{className:"row justify-content-start align-items-center",children:[n.jsx("div",{className:"col pl-0",children:n.jsx("span",{className:"my-0 text-truncate",children:b})}),n.jsx("div",{className:"col-auto",children:n.jsx("span",{children:g==null?void 0:g.version})})]},b))})]}),n.jsx("div",{className:"app-settings-footer-item",children:n.jsx(Ka,{})})]}),n.jsx("div",{className:"app-settings-footer-section",children:n.jsx("a",{target:"_blank",rel:"noreferrer noopener",href:"https://deephaven.io",style:{display:"block",width:"61.8%"},children:n.jsx(xt,{})})})]})]})]})}};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 Oe=x;const ot=10;function J(a){const{forwardedProps:{menuItem:{action:s,title:e,disabled:t},iconElement:o,displayShortcut:r,isMouseSelected:i,isKeyboardSelected:l,closeMenu:c}}=a,d=m.useRef(),u=m.useRef(),h=m.useRef(null),[p,T]=m.useState(!1),S=m.useCallback(w=>{d.current!=null&&u.current!=null&&h.current&&(Math.abs(d.current-w.clientX)>=ot||Math.abs(u.current-w.clientY)>=ot)&&(T(!0),window.removeEventListener("mousemove",S),c(),s(w),h.current=null)},[s,c]);function b(w){d.current=w.clientX,u.current=w.clientY,h.current=w.target,window.addEventListener("mousemove",S)}function g(w){h.current===w.target&&(T(!0),c(),s(),window.removeEventListener("mousemove",S)),h.current=null}return m.useEffect(function(){return function(){return window.removeEventListener("mousemove",S)}},[S]),n.jsxs("button",{type:"button",className:I("btn-context-menu",{disabled:t},{active:i&&!t},{"keyboard-active":l&&!t}),onMouseDown:b,onMouseUp:g,disabled:p,children:[n.jsx("span",{className:I("icon"),children:o}),n.jsx("span",{className:"title",children:e}),n.jsx("span",{className:"shortcut",children:r})]})}function _e(a){const{handleControlSelect:s,handleToolSelect:e,onClearFilter:t}=a,o=m.useMemo(()=>[{title:"Input Filter",icon:In,menuElement:n.jsx(J,{}),action:r=>{s(G.INPUT_FILTER,r)},order:10},{title:"Dropdown Filter",icon:On,menuElement:n.jsx(J,{}),action:r=>{s(G.DROPDOWN_FILTER,r)},order:15},{title:"Markdown Widget",icon:kn,menuElement:n.jsx(J,{}),action:r=>{s(G.MARKDOWN,r)},order:20},{title:"Filter Sets",icon:Ln,menuElement:n.jsx(J,{}),action:r=>{s(G.FILTER_SET_MANAGER,r)},order:25},{disabled:!0,menuElement:n.jsx("div",{className:"context-menu-group-header",children:"Tools"}),order:30},{title:"Linker",icon:Pn,action:()=>{e(me.LINKER)},order:40,shortcut:q.LINKER},{disabled:!0,menuElement:n.jsx("div",{className:"context-menu-group-header",children:"Actions"}),order:50},{title:"Clear All Filters",icon:An,action:()=>{t()},order:60,shortcut:Ct.TABLE.CLEAR_ALL_FILTERS}],[s,e,t]);return n.jsx(Ss,{popperClassName:"controls-menu-popper",actions:o})}_e.propTypes={handleControlSelect:E.func,handleToolSelect:E.func,onClearFilter:E.func};_e.defaultProps={handleControlSelect:()=>{},handleToolSelect:()=>{},onClearFilter:()=>{}};J.propTypes={forwardedProps:E.shape({iconElement:E.node,displayShortcut:E.string,isMouseSelected:E.bool.isRequired,isKeyboardSelected:E.bool.isRequired,closeMenu:E.func.isRequired,menuItem:E.shape({action:E.func,title:E.string,disabled:E.bool}).isRequired})};J.defaultProps={forwardedProps:null};const eo=_n(wt,null),to={layoutStorage:eo},so=a=>a.layoutStorage,no=a=>a.serverConfigValues;Object.entries(to).map(([a,s])=>Mn.register(a,s));const rt=10;function ao(a){const{onExportLayout:s,onImportLayout:e,onResetLayout:t,onSelect:o,widgets:r=[]}=a,[i,l]=m.useState(!1),[c,d]=m.useState(""),u=m.useRef(null),h=m.useRef(),p=m.useCallback((f,y)=>{f!=null&&o(f,y)},[o]),T=m.useCallback(f=>{d(f.target.value)},[]),S=m.useCallback(f=>{h.current!=null&&(Math.abs(h.current.x-f.clientX)>=rt||Math.abs(h.current.y-f.clientY)>=rt)&&(l(!0),window.removeEventListener("mousemove",S),p(h.current.widget,f),h.current=void 0)},[h,p]),b=m.useCallback((f,y)=>{h.current={x:f.clientX,y:f.clientY,widget:y},window.addEventListener("mousemove",S)},[S]),g=m.useCallback((f,y)=>{var K;window.removeEventListener("mousemove",S),((K=h.current)==null?void 0:K.widget)===y&&(l(!0),p(y)),h.current=void 0},[S,h,p]),w=m.useMemo(()=>r.filter(f=>{var y;return c?(y=f.name)==null?void 0:y.toLowerCase().includes(c.toLowerCase()):!0}),[c,r]).sort((f,y)=>{var K;return((K=f.name)==null?void 0:K.localeCompare(y.name??""))??0}),L=m.useMemo(()=>w.map(f=>n.jsx("li",{children:n.jsxs(C,{kind:"ghost","data-testid":`panel-list-item-${f.name??""}-button`,onMouseDown:y=>{b(y,f)},onMouseUp:y=>{g(y,f)},onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&p(f)},disabled:i,onClick:()=>{},children:[n.jsx(ys,{type:f.type})," ",f.name??""]})},f.name)),[w,i,b,g,p]),j=m.useMemo(()=>L.length===0?n.jsx("span",{children:"No bound variables found."}):null,[L]);return n.jsxs("div",{className:"widget-list-container d-flex flex-column",children:[n.jsx("div",{className:"widget-list-header",children:n.jsx(xs,{value:c,placeholder:"Find Table, Plot or Widget",onChange:T,ref:u})}),n.jsxs("ul",{className:"widget-list flex-grow-1",children:[j&&n.jsx("li",{className:"widget-list-message",children:j}),!j&&L]}),n.jsx("div",{children:n.jsx("hr",{})}),n.jsxs("div",{className:"widget-list-footer",children:[n.jsxs(C,{kind:"ghost",onClick:s,children:[n.jsxs("div",{className:"fa-md fa-layers",children:[n.jsx(N,{mask:We,icon:Be,transform:"right-5 down-5"}),n.jsx(N,{icon:Be,transform:"right-8 down-6"})]}),"Export Layout"]}),n.jsxs(C,{kind:"ghost",onClick:e,children:[n.jsxs("div",{className:"fa-md fa-layers",children:[n.jsx(N,{mask:We,icon:Ve,transform:"right-5 down-5"}),n.jsx(N,{icon:Ve,transform:"right-8 down-6"})]}),"Import Layout"]}),n.jsx(C,{kind:"ghost",icon:z,onClick:t,tooltip:"Reset Layout"})]})]})}function oo({onAutoFillClick:a=()=>{}}){return n.jsxs("div",{className:"empty-dashboard-container",children:[n.jsxs("div",{className:"hint-container",children:[n.jsx(N,{icon:Un})," ",n.jsx("br",{}),"Use the panel list to add objects from a query."]}),n.jsxs("div",{className:"empty-dashboard",children:[n.jsx("div",{className:"add-panels-hint",children:"Drag Panels Here"}),n.jsx(C,{kind:"tertiary",onClick:a,children:"Auto fill objects"})]})]})}const F=W.module("AppMainContainer");class se 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",Bt(e=>Qn(e)));Os(this),this.importElement=Q.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:[zn({uiVersion:"1.5.2",userAgent:navigator.userAgent,...Object.fromEntries(o),pluginInfo:Ne(r)},!1),{action:()=>{const i=jt(o),l=Object.entries(i).map(([c,d])=>`${c}: ${d}`).join(`
5
+ `);ks(l)},shortcut:q.COPY_VERSION_INFO,isGlobal:!0},{action:()=>{this.handleToolSelect(me.LINKER)},shortcut:q.LINKER,isGlobal:!0},{action:()=>{this.sendClearFilter()},shortcut:Ct.TABLE.CLEAR_ALL_FILTERS,isGlobal:!0},{action:()=>{this.sendCycleStackForward()},shortcut:Y.CYCLE_TO_NEXT_STACK,isGlobal:!0},{action:()=>{this.sendCycleStackBackward()},shortcut:Y.CYCLE_TO_PREVIOUS_STACK,isGlobal:!0},{action:()=>{this.sendCycleTabForward()},shortcut:Y.CYCLE_TO_NEXT_TAB,isGlobal:!0},{action:()=>{this.sendCycleTabBackward()},shortcut:Y.CYCLE_TO_PREVIOUS_TAB,isGlobal:!0},{action:()=>{this.handleCycleDashboardForward()},shortcut:Y.CYCLE_TO_NEXT_DASHBOARD,isGlobal:!0},{action:()=>{this.handleCycleDashboardBackward()},shortcut:Y.CYCLE_TO_PREVIOUS_DASHBOARD,isGlobal:!0},{action:()=>{this.sendReopenLast()},shortcut:q.REOPEN_CLOSED_PANEL,isGlobal:!0},{action:()=>{F.debug("Consume unhandled save shortcut")},shortcut:q.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!==D,icon:i===D?Kn:void 0})),activeTabKey:D,layoutIteration:0}}static handleWindowBeforeUnload(e){e.preventDefault(),e.returnValue=""}static hydrateConsole(e,t){return Is.hydrate({...e,unzip:o=>Gt.loadAsync(o).then(r=>Object.values(r.files))},t)}static handleRefresh(){F.info("Refreshing application"),window.location.reload()}componentDidMount(){this.initWidgets(),this.initDashboardData(),window.addEventListener("beforeunload",se.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",se.handleWindowBeforeUnload)}initWidgets(){const{connection:e}=this.props;if(e!=null){if(e.subscribeToFieldUpdates==null){F.warn("subscribeToFieldUpdates not supported, not initializing widgets");return}this.widgetListenerRemover=e.subscribeToFieldUpdates(t=>{F.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(D,{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];F.debug("initDashboardData plugin data",h,p),e(D,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){F.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(Ls.SELECT_NOTEBOOK,o,l,c,i,!0)}}sendClearFilter(){this.emitLayoutEvent(ie.CLEAR_ALL_FILTERS)}sendCycleStackForward(){Ps(this.getActiveEventHub())}sendCycleStackBackward(){As(this.getActiveEventHub())}sendCycleTabForward(){_s(this.getActiveEventHub())}sendCycleTabBackward(){Ms(this.getActiveEventHub())}sendReopenLast(){this.emitLayoutEvent(Us.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 pe(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){Z.isCanceled(e)||F.error(e)}handleSettingsMenuHide(){this.setState({isSettingsMenuShown:!1})}handleSettingsMenuShow(){this.setState({isSettingsMenuShown:!0})}handleControlSelect(e,t){switch(F.debug("handleControlSelect",e),e){case G.DROPDOWN_FILTER:this.emitLayoutEvent(ie.OPEN_DROPDOWN,{title:"DropdownFilter",type:e,createNewStack:!0,dragEvent:t});break;case G.INPUT_FILTER:this.emitLayoutEvent(ie.OPEN_INPUT,{title:"InputFilter",type:e,createNewStack:!0,dragEvent:t});break;case G.MARKDOWN:this.emitLayoutEvent(Ks.OPEN,{title:"Markdown",type:e,dragEvent:t});break;case G.FILTER_SET_MANAGER:this.emitLayoutEvent(ie.OPEN_FILTER_SET_MANAGER,{title:"FilterSets",type:e,dragEvent:t});break;default:throw new Error(`Unrecognized control type ${e}`)}}handleToolSelect(e){F.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,$s(e.eventHub,this.handleCreateDashboard)),this.closeDashboardListenerRemovers.set(t,Gs(e.eventHub,this.handleCloseDashboard)))}handleCreateDashboard({pluginId:e,title:t,data:o}){const r=Wt(),{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}),F.debug("handleWidgetSelect",e,t),this.openWidget(e,t)}handleWidgetsMenuClose(){this.setState({isPanelsMenuShown:!1})}handleAutoFillClick(){const{widgets:e}=this.state;F.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(){F.info("handleExportLayoutClick"),this.setState({isPanelsMenuShown:!1});try{const{workspace:e}=this.props,{data:t}=e,o=xe.exportLayout(t);F.info("handleExportLayoutClick exportedConfig",o);const r=new Blob([JSON.stringify(o)],{type:"application/json"}),i=Ra.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){F.error("Unable to export layout",e)}}handleImportLayoutClick(){F.info("handleImportLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.importElement.current!=null&&(this.importElement.current.value="",this.importElement.current.click())}handleResetLayoutClick(){F.info("handleResetLayoutClick"),this.setState({isPanelsMenuShown:!1,isResetLayoutPromptShown:!0,unsavedNotebookCount:Ws.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}=xe.normalizeLayout(i);o({layoutConfig:c}),t(D,{filterSets:l,links:d,pluginDataMap:u}),this.setState(({layoutIteration:h})=>({layoutIteration:h+1}))}catch(t){F.error("Unable to import layout",t)}}async resetLayout(){const{layoutStorage:e,session:t}=this.props,{filterSets:o,layoutConfig:r,links:i}=await xe.getDefaultLayout(e,t!==void 0),{updateDashboardData:l,updateWorkspaceData:c}=this.props;c({layoutConfig:r}),l(D,{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;Bs(this.getActiveEventHub(),{widget:Vs(e),dragEvent:t,fetch:async()=>o==null?void 0:o.getObject(e)})}handleHomeClick(){this.handleTabSelect(D)}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=D),{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:D,layoutConfig:l,key:`${D}-${e}`},...t.filter(c=>c.key!==D).map(c=>{var d;return{id:c.key,layoutConfig:((d=o[c.key])==null?void 0:d.layoutConfig)??Hs,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:T,tabs:S,activeTabKey:b}=this.state,g=this.getDashboardPlugins(t);return n.jsxs("div",{className:I("app-main-tabs","w-100","h-100","d-flex","flex-column",e?`active-tool-${e.toLowerCase()}`:""),onPaste:this.handlePaste,tabIndex:-1,children:[n.jsxs("div",{className:"app-main-top-nav-menus",children:[n.jsx(xt,{className:"ml-1",style:{maxHeight:"20px"}}),S.length>1&&n.jsx("div",{style:{flexShrink:0,flexGrow:1,flexBasis:0,minWidth:0},children:n.jsx(Xn,{tabs:S,activeKey:b,onSelect:this.handleTabSelect,onReorder:this.handleTabReorder,onClose:this.handleTabClose})}),n.jsxs("div",{className:"app-main-right-menu-buttons",children:[n.jsxs(C,{kind:"ghost",className:"btn-panels-menu",icon:$n,onClick:()=>{},children:["Controls",n.jsx(_e,{handleControlSelect:this.handleControlSelect,handleToolSelect:this.handleToolSelect,onClearFilter:this.handleClearFilter})]}),l&&n.jsxs(C,{kind:"ghost",className:"btn-panels-menu btn-show-panels","data-testid":"app-main-panels-button",onClick:this.handleWidgetMenuClick,icon:Gn,children:["Panels",n.jsx(Ys,{isShown:d,className:"panels-menu-popper",onExited:this.handleWidgetsMenuClose,options:{placement:"bottom"},closeOnBlur:!0,interactive:!0,children:n.jsx(ao,{widgets:T,onExportLayout:this.handleExportLayoutClick,onImportLayout:this.handleImportLayoutClick,onResetLayout:this.handleResetLayoutClick,onSelect:this.handleWidgetSelect})})]}),n.jsx(C,{kind:"ghost",className:I("btn-settings-menu",{"text-warning":o.operateAs!=null&&o.operateAs!==o.name}),onClick:this.handleSettingsMenuShow,icon:n.jsx("span",{className:"fa-layers",children:n.jsx(N,{icon:Wn,transform:"grow-3"})}),tooltip:"User Settings"})]})]}),n.jsx(Jn,{dashboards:this.getDashboards(),activeDashboard:b,onGoldenLayoutChange:this.handleGoldenLayoutChange,emptyDashboard:b===D?n.jsx(oo,{onAutoFillClick:this.handleAutoFillClick}):n.jsx(yt,{"data-testid":"app-main-container-loading"}),plugins:[n.jsx(Zs,{hydrateConsole:se.hydrateConsole,notebooksUrl:new URL("notebooks/",document.baseURI).href},"ConsolePlugin"),...g]}),n.jsx(ca,{in:h,mountOnEnter:!0,unmountOnExit:!0,children:n.jsx(Oe,{serverConfigValues:r,pluginData:t,onDone:this.handleSettingsMenuHide,user:o})}),n.jsx(qs,{actions:c}),n.jsx("input",{ref:this.importElement,type:"file",accept:".json",style:{display:"none"},onChange:this.handleImportLayoutFiles,"data-testid":"input-import-layout"}),n.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=a=>{var s,e;return{activeTool:js(a),allDashboardData:Ds(a),dashboardData:Es(a,D),layoutStorage:so(a),plugins:Ns(a),connection:Fs(a,D),session:(s=Ge(a,D))==null?void 0:s.session,sessionConfig:(e=Ge(a,D))==null?void 0:e.config,user:Rs(a),workspace:St(a),serverConfigValues:no(a)}},io=ge(ro,{setActiveTool:bt,setDashboardData:vt,setDashboardPluginData:Cs,updateDashboardData:Ts,updateWorkspaceData:ws})($t(se));function lo(){return n.jsxs("div",{className:"app",children:[n.jsx(io,{}),n.jsx(Vt,{})]})}const co=W.module("AppInit");function it(){const a=dt(),s=ea(),e=ta(),t=Xs(),o=sa(),r=na(),i=Ht(St),l=fe(),[c,d]=m.useState();m.useEffect(function(){l(Js(t))},[t,l]),m.useEffect(function(){async function S(){try{const b=await aa(),g=await oa(a,e,b),w=s.getStorageService(),L=new ra(w,"/layouts"),j=new ia(a,w,"/notebooks"),f=new He(L),y=new Na,K=await f.load({isConsoleAvailable:g!==void 0}),{data:be}=K,{settings:Ft}=be,{shortcutOverrides:Me={}}=Ft,Rt=A.isMacPlatform?Me.mac??{}:Me.windows??{};Object.entries(Rt).forEach(([Ot,kt])=>{var Ue;(Ue=Pe.get(Ot))==null||Ue.setKeyState(kt)});const It={title:"Code Studio",filterSets:be.filterSets,links:be.links};l(Qs(a)),l(bt(me.DEFAULT)),l(en(o)),l(tn(y)),l(vt(D,It)),l(sn(j)),l(Fa(L)),l(nn(D,e)),g!==void 0&&l(an(D,g)),l(on(r)),l(rn(f)),l(ln(K)),l(cn(He.makeDefaultWorkspaceSettings(o)))}catch(b){co.error(b),d(b)}}S()},[a,s,e,o,l,r]);const u=i==null&&c==null,h=!u&&c==null,p=c!=null?`${c}`:null;return n.jsxs(n.Fragment,{children:[h&&n.jsx(lo,{}),n.jsx(yt,{"data-testid":"app-init-loading",isLoading:u&&p==null,isLoaded:h,errorMessage:p})]})}const ho=Q.lazy(()=>zt(()=>import("./StyleGuideRoot-DhvCRjxL.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 n.jsx(Yt,{basename:uo,children:n.jsxs(Zt,{children:[n.jsx(Se,{exact:!0,path:"/",component:it}),n.jsx(Se,{path:"/notebooks/:notebookPath+",component:it}),n.jsx(Se,{path:"/styleguide",component:ho}),n.jsx(qt,{from:"*",to:"/"})]})})}function wo(){return m.useEffect(function(){da.register(new URL("./download/serviceWorker.js",window.location.href)),dn.init({getWorker:(s,e)=>e==="json"?new Xt:new Jt}),window["__react-beautiful-dnd-disable-dev-warnings"]=!0},[]),n.jsx(mo,{})}export{wo as AppRoot,wo as default};
6
+ //# sourceMappingURL=AppRoot-DnN_zkOP.js.map