@deephaven/code-studio 0.55.1-beta.0 → 0.55.1-beta.10

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 (47) hide show
  1. package/build/assets/{AppRoot-5eebed52.js → AppRoot-ba1658fc.js} +3 -3
  2. package/build/assets/{AppRoot-5eebed52.js.map → AppRoot-ba1658fc.js.map} +1 -1
  3. package/build/assets/ControlType-4c9520d6.js +21 -0
  4. package/build/assets/ControlType-4c9520d6.js.map +1 -0
  5. package/build/assets/FontBootstrap-5dc042b0.css +1 -0
  6. package/build/assets/{FontBootstrap-ee11a333.js → FontBootstrap-daffc2e1.js} +3 -3
  7. package/build/assets/FontBootstrap-daffc2e1.js.map +1 -0
  8. package/build/assets/IrisGrid-68ffe9cf.css +1 -0
  9. package/build/assets/IrisGrid-bce61d13.js +14 -0
  10. package/build/assets/IrisGrid-bce61d13.js.map +1 -0
  11. package/build/assets/IrisGridModelFactory-493c6b97.js +3 -0
  12. package/build/assets/IrisGridModelFactory-493c6b97.js.map +1 -0
  13. package/build/assets/{StyleGuideRoot-78546d97.css → StyleGuideRoot-104ae414.css} +1 -1
  14. package/build/assets/StyleGuideRoot-852ef6d9.js +225 -0
  15. package/build/assets/StyleGuideRoot-852ef6d9.js.map +1 -0
  16. package/build/assets/{index-824ffbc8.css → index-399935a8.css} +1 -1
  17. package/build/assets/{index-4c9e284e.js → index-8458b486.js} +5 -5
  18. package/build/assets/{index-4c9e284e.js.map → index-8458b486.js.map} +1 -1
  19. package/build/assets/index-a865154c.js +2 -0
  20. package/build/assets/{index-33d63452.js.map → index-a865154c.js.map} +1 -1
  21. package/build/assets/{index-7ee3961d.js → index-bf3c2e00.js} +14 -14
  22. package/build/assets/index-bf3c2e00.js.map +1 -0
  23. package/build/assets/usePlugins-1cbb179a.css +1 -0
  24. package/build/assets/usePlugins-525a1a1b.js +3 -0
  25. package/build/assets/usePlugins-525a1a1b.js.map +1 -0
  26. package/build/assets/useUser-6f056f9e.js +2 -0
  27. package/build/assets/useUser-6f056f9e.js.map +1 -0
  28. package/build/index.html +2 -2
  29. package/package.json +31 -31
  30. package/build/assets/ControlType-58330610.js +0 -21
  31. package/build/assets/ControlType-58330610.js.map +0 -1
  32. package/build/assets/FontBootstrap-47bc3788.css +0 -1
  33. package/build/assets/FontBootstrap-ee11a333.js.map +0 -1
  34. package/build/assets/IrisGrid-454c0412.css +0 -1
  35. package/build/assets/IrisGrid-c3f117a4.js +0 -14
  36. package/build/assets/IrisGrid-c3f117a4.js.map +0 -1
  37. package/build/assets/IrisGridModelFactory-9dfadcff.js +0 -3
  38. package/build/assets/IrisGridModelFactory-9dfadcff.js.map +0 -1
  39. package/build/assets/StyleGuideRoot-c8e71114.js +0 -225
  40. package/build/assets/StyleGuideRoot-c8e71114.js.map +0 -1
  41. package/build/assets/index-33d63452.js +0 -2
  42. package/build/assets/index-7ee3961d.js.map +0 -1
  43. package/build/assets/usePlugins-2f8c5bde.js +0 -3
  44. package/build/assets/usePlugins-2f8c5bde.js.map +0 -1
  45. package/build/assets/usePlugins-c14e8ab1.css +0 -1
  46. package/build/assets/useUser-8bec1305.js +0 -2
  47. package/build/assets/useUser-8bec1305.js.map +0 -1
@@ -1,6 +1,6 @@
1
- import{P as bt,I as Yt,r as m,C as n,J as te,K as De,H as J,L as Te,F,M as f,G as x,N as vt,D as St,T as Jt,O as Xt,Q as Qt,S as es,U as ts,V as ss,W as fe,X as ns,Y as os}from"./vendor-fd5d5838.js";import{_ as as,W as rs}from"./monaco-1410cbed.js";import{O as ce,P as K,T as A,D as is,I as L,a as P,b as W,u as yt,F as ls,c as D,d as cs,S as de,B as S,C as ge,e as M,f as Fe,g as Tt,K as ds,h as Ke,i as us,G as Ce,j as Ct,k as hs,r as ms,l as ps,m as fs,n as gs,o as We,p as bs,q as _,s as vs,t as Ss,v as ys,w as Be,x as Ts,y as Ge,z as Cs,A as ws,E as xs,H as Ds,J as Fs,L as Rs,M as Es}from"./usePlugins-2f8c5bde.js";import{L as k,v as H,a as Ns,M as js,b as Os,c as Is,d as Ls,l as Ps,e as Ve,f as ks,T as ie,g as As,h as Ms,i as Us,j as _s,k as $s,m as Ks,n as Ws,o as Bs,p as Gs,q as Vs,r as Zs,s as Hs,t as qs,u as zs,w as Ze,x as He,y as qe,z as Ys,A as Js,B as Xs,C as Qs,D as en,E as ze,F as tn,G as sn}from"./index-7ee3961d.js";import{C as nn,B as on,m as an,a as rn,D as ln,b as cn,I as dn,u as un,c as hn,d as mn,g as pn,l as fn}from"./useUser-8bec1305.js";import{u as Re,g as gn,a as wt,b as xt,c as Dt,d as Ft,e as Rt,f as bn,h as Et,i as vn,j as Sn,s as Nt,k as yn,C as G,T as ue,r as Tn,O as Cn,l as Ye,L as Je,m as Xe,F as Qe,n as jt,o as wn,p as xn,q as Dn,t as Fn,v as et,w as Rn,x as Ot,N as En,I as oe,M as Nn,y as jn,z as On,A as Z,B as In,D as Ln,E as Pn,G as kn,H as An,J as Mn,K as Un,P as _n,Q as $n,R as Kn,S as Wn,U as Bn,V as Gn}from"./ControlType-58330610.js";class tt{static makeSortConfig(e,t){return{column:e,direction:t}}static makeFilterConfig(e){var t=[],s=[];return e.forEach((a,r)=>{t.push(a),r>0&&s.push(ce.and)}),{filterItems:t,filterOperators:s}}static combineFilterConfigs(e,t){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ce.and;return{filterItems:[...e.filterItems,...t.filterItems],filterOperators:[...e.filterOperators,s,...t.filterOperators]}}static makeFilterItem(e,t,s){return{columnName:e,type:t,value:s}}}function Vn(o,e,t){if(o.length>e){var s=o.length-t;return{toKeep:o.slice(s),toPrune:o.slice(0,s)}}return{toKeep:o,toPrune:[]}}function st(o,e){var t=Object.keys(o);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(o);e&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(o,a).enumerable})),t.push.apply(t,s)}return t}function nt(o){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?st(Object(t),!0).forEach(function(s){N(o,s,t[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(t)):st(Object(t)).forEach(function(s){Object.defineProperty(o,s,Object.getOwnPropertyDescriptor(t,s))})}return o}function ot(o,e,t,s,a,r,i){try{var c=o[r](i),l=c.value}catch(d){t(d);return}c.done?e(l):Promise.resolve(l).then(s,a)}function $(o){return function(){var e=this,t=arguments;return new Promise(function(s,a){var r=o.apply(e,t);function i(l){ot(r,s,a,i,c,"next",l)}function c(l){ot(r,s,a,i,c,"throw",l)}i(void 0)})}}function N(o,e,t){return e=Zn(e),e in o?Object.defineProperty(o,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):o[e]=t,o}function Zn(o){var e=Hn(o,"string");return typeof e=="symbol"?e:String(e)}function Hn(o,e){if(typeof o!="object"||o===null)return o;var t=o[Symbol.toPrimitive];if(t!==void 0){var s=t.call(o,e||"default");if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(o)}var be=k.module("PouchStorageTable"),qn="Deephaven.";bt.plugin(Yt);function zn(o,e){switch(o){case A.in:case A.contains:return{$regex:new RegExp("".concat(e))};case A.inIgnoreCase:return{$regex:new RegExp("".concat(e),"i")};case A.eq:return{$eq:e};case A.notEq:return{$neq:e};case A.greaterThan:return{$gt:e};case A.greaterThanOrEqualTo:return{$gte:e};case A.lessThan:return{$lt:e};case A.lessThanOrEqualTo:return{$lte:e};case A.startsWith:return{$regex:new RegExp("^(?".concat(e,").*"))};default:throw new Error("Unsupported type: ".concat(o))}}function Yn(o){for(var{filterItems:e,filterOperators:t}=o,s=null,a=0;a<e.length;a+=1){var r=e[a],{columnName:i,type:c,value:l}=r,d={[i]:zn(c,l)};if(a===0)s=d;else if(s!==null&&a-1<t.length){var h=t[a-1];if(h===ce.and)s={$and:[s,d]};else if(h===ce.or)s={$or:[s,d]};else throw new Error("Unexpected filter operator ".concat(h,", ").concat(d))}}if(s==null)throw new Error("Invalid filter config ".concat(o));return s}function ve(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return{$and:[...o.map(e=>Yn(e)),{name:{$gt:null}},{id:{$gt:null}}]}}function Jn(o){var e,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return[{id:t?"desc":"asc"},...(e=o?.map(s=>({[s.column]:s.direction})))!==null&&e!==void 0?e:[]]}class Xn{constructor(e,t){N(this,"db",void 0),N(this,"changes",void 0),N(this,"listeners",[]),N(this,"itemListeners",new Map),N(this,"currentSize",0),N(this,"currentViewport",void 0),N(this,"currentReverse",!1),N(this,"currentFilter",null),N(this,"currentSort",null),N(this,"infoUpdatePromise",void 0),N(this,"viewportUpdatePromise",void 0),N(this,"currentViewportData",void 0),this.db=new bt("".concat(qn).concat(e),t),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(e){return this.listeners=[...this.listeners,e],()=>{this.listeners=this.listeners.filter(t=>t!==e)}}onItemUpdate(e,t){return this.itemListeners.has(e)||this.itemListeners.set(e,[]),this.itemListeners.set(e,[...this.itemListeners.get(e),t]),this.refreshItem(e),()=>{this.itemListeners.set(e,this.itemListeners.get(e).filter(s=>s!==t))}}close(){this.listeners=[]}get size(){return this.currentSize}get viewport(){return this.currentViewport}setReversed(e){this.currentReverse=e,this.currentViewportData=void 0,this.refreshData()}setViewport(e){this.currentViewport=e,this.refreshInfo(),this.refreshData()}setSorts(e){this.currentSort=e,this.currentViewportData=void 0,this.refreshData()}setFilters(e){this.currentFilter=e,this.currentViewportData=void 0,this.refreshInfo(),this.refreshData()}get data(){return this.currentViewportData}getViewportData(){var e=this;return $(function*(){var t;return e.viewportUpdatePromise||e.refreshData(),(t=e.viewportUpdatePromise)!==null&&t!==void 0?t:Promise.resolve({items:[],offset:0})})()}put(e){var t=this;return $(function*(){var s=nt(nt({},e),{},{_id:e.id});return yield t.db.put(s),s})()}sendUpdate(){for(var e,{listeners:t}=this,s=(e=this.currentViewportData)!==null&&e!==void 0?e:{items:[],offset:0},a=0;a<t.length;a+=1)t[a](s)}sendItemUpdate(e){var t=this.itemListeners.get(e.id);if(t!==void 0)for(var s=0;s<t.length;s+=1)t[s](e)}dbUpdate(e){be.debug("Update received",e),this.refreshInfo(),e.doc!==void 0&&this.sendItemUpdate(e.doc),this.refreshData()}fetchInfo(e){var t=this;return $(function*(){return t.db.find({selector:e,fields:[]})})()}refreshInfo(){var e=this;return $(function*(){try{var t,s;(t=e.infoUpdatePromise)===null||t===void 0||t.cancel(),e.infoUpdatePromise=K.makeCancelable(e.fetchInfo(ve((s=e.currentFilter)!==null&&s!==void 0?s:[])));var a=yield e.infoUpdatePromise;e.currentSize=a.docs.length,e.sendUpdate()}catch(r){if(!K.isCanceled(r))throw be.error("Unable to refreshInfo",r),r}})()}fetchViewportData(e,t,s){var a=this;return $(function*(){return a.db.find({selector:t,skip:e.top,limit:e.bottom-e.top+1,sort:s,fields:["id","name"]}).then(r=>({items:r.docs,offset:e.top}))})()}refreshData(){var e=this;return $(function*(){if(e.currentViewport)try{var t,s,a=ve((t=e.currentFilter)!==null&&t!==void 0?t:[]),r=Jn(e.currentSort,e.currentReverse);(s=e.viewportUpdatePromise)===null||s===void 0||s.cancel(),e.viewportUpdatePromise=K.makeCancelable(e.fetchViewportData(e.currentViewport,a,r));var i=yield e.viewportUpdatePromise;return e.currentViewportData=i,e.sendUpdate(),i}catch(c){if(!K.isCanceled(c))throw be.error("Unable to refreshData",c),c}})()}refreshItem(e){var t=this;return $(function*(){var s=yield t.db.find({selector:{id:e},limit:1}),a=s.docs[0];return a!==void 0&&t.sendItemUpdate(a),a})()}getSnapshot(e){var t=this;return $(function*(){var s=new Map,a=[{id:t.currentReverse?"desc":"asc"}];return yield Promise.all(e.map(function(){var r=$(function*(i){var c,[l,d]=i,h=d-l+1;return t.db.find({selector:ve((c=t.currentFilter)!==null&&c!==void 0?c:[]),skip:l,limit:h,sort:a,fields:["id","name"]}).then(u=>{for(var g=0;g<h;g+=1){var w=l+g;s.set(w,u.docs[g])}})});return function(i){return r.apply(this,arguments)}}())),s})()}}const Qn=Xn;function at(o,e){var t=Object.keys(o);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(o);e&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(o,a).enumerable})),t.push.apply(t,s)}return t}function ae(o){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?at(Object(t),!0).forEach(function(s){It(o,s,t[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(t)):at(Object(t)).forEach(function(s){Object.defineProperty(o,s,Object.getOwnPropertyDescriptor(t,s))})}return o}function rt(o,e,t,s,a,r,i){try{var c=o[r](i),l=c.value}catch(d){t(d);return}c.done?e(l):Promise.resolve(l).then(s,a)}function X(o){return function(){var e=this,t=arguments;return new Promise(function(s,a){var r=o.apply(e,t);function i(l){rt(r,s,a,i,c,"next",l)}function c(l){rt(r,s,a,i,c,"throw",l)}i(void 0)})}}function It(o,e,t){return e=eo(e),e in o?Object.defineProperty(o,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):o[e]=t,o}function eo(o){var e=to(o,"string");return typeof e=="symbol"?e:String(e)}function to(o,e){if(typeof o!="object"||o===null)return o;var t=o[Symbol.toPrimitive];if(t!==void 0){var s=t.call(o,e||"default");if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(o)}var so=2500,no=2e3,O=k.module("PouchCommandHistoryTable");class oo extends Qn{constructor(e,t){var s;super("CommandHistoryStorage.".concat(e),{auto_compaction:!0,revs_limit:1}),It(this,"searchText",void 0),this.cache=t,this.cache.tableRegistry.has(this.cacheKey)||this.cache.tableRegistry.set(this.cacheKey,new Set),O.debug("Adding table to registry",this.cacheKey),(s=this.cache.tableRegistry.get(this.cacheKey))===null||s===void 0||s.add(this)}get cacheKey(){return this.db.name}setSearch(e){O.debug("Setting search filters",e),this.searchText=e.trim().toLowerCase(),this.setFilters(e?[tt.makeFilterConfig([tt.makeFilterItem("name",A.contains,e)])]:[])}dbUpdate(e){O.debug("Clearing cache and refreshing data",e),this.cache.response.delete(this.cacheKey),super.dbUpdate(e)}fetchData(e){var t=this;return X(function*(){return K.withTimeout(0,X(function*(){t.cache.response.has(t.cacheKey)?O.debug("Fetching from cache",t.searchText,t.viewport):(O.debug("Fetching from PouchDB",t.searchText,t.viewport),t.cache.response.set(t.cacheKey,t.db.allDocs({include_docs:!0}).then(a=>{var r=a.rows.map(l=>l.doc).filter(l=>{var{name:d}=l;return d});O.debug("Fetched ".concat(r.length," command history items"));var{toKeep:i,toPrune:c}=Vn(r,so,no);return c.length&&t.pruneItems(c),{docs:i}})));var s=t.cache.response.get(t.cacheKey);return t.searchText==null||t.searchText===""?s:ae(ae({},s),{},{docs:(yield s).docs.filter(a=>{var{name:r}=a;return r.toLowerCase().includes(t.searchText)})})}))})()}fetchInfo(e){var t=this;return X(function*(){return t.fetchData(e)})()}fetchViewportData(e,t,s){var a=this;return X(function*(){var r=yield a.fetchData(t);O.debug("Fetching viewport data",e.top,e.bottom+1,s,r);var i=typeof s[0]=="object"&&s[0].id==="desc",c=i?r.docs.slice(0).reverse():r.docs,l=c.slice(e.top,e.bottom+1);return{items:l,offset:e.top}})()}pruneItems(e){var t=this;return X(function*(){if(t.cache.isPruning.get(t.cacheKey)===!0){O.debug("Pruning already in progress. Skipping.");return}try{O.debug("Pruning ".concat(e.length," command history items"));var s=t.cache.pauseChangeListeners(t.cacheKey);t.cache.isPruning.set(t.cacheKey,!0),yield t.db.bulkDocs(e.map(a=>ae(ae({},a),{},{_deleted:!0}))),t.cache.isPruning.set(t.cacheKey,!1),s(),O.debug("Finished pruning command history items")}catch(a){O.error("An error occurred while pruning db",a)}})()}close(){var e,t,s;O.debug("Closing table",this,(e=this.cache.tableRegistry.get(this.cacheKey))===null||e===void 0?void 0:e.size),(t=this.cache.tableRegistry.get(this.cacheKey))===null||t===void 0||t.delete(this),(s=this.changes)===null||s===void 0||s.cancel(),super.close()}}const it=oo;function Se(o,e,t){return e=ao(e),e in o?Object.defineProperty(o,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):o[e]=t,o}function ao(o){var e=ro(o,"string");return typeof e=="symbol"?e:String(e)}function ro(o,e){if(typeof o!="object"||o===null)return o;var t=o[Symbol.toPrimitive];if(t!==void 0){var s=t.call(o,e||"default");if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(o)}var lt=k.module("PouchCommandHistoryCache");class io{constructor(){Se(this,"isPruning",void 0),Se(this,"response",void 0),Se(this,"tableRegistry",void 0),this.isPruning=new Map,this.response=new Map,this.tableRegistry=new Map}pauseChangeListeners(e){var t,s=[];return(t=this.tableRegistry.get(e))===null||t===void 0||t.forEach(a=>{a.changes&&(lt.debug("Pausing event listeners on '".concat(e,"' table"),a),a.changes.cancel(),s.push(a))}),()=>{s.forEach(a=>{var r,i;(r=(i=this.tableRegistry.get(e))===null||i===void 0?void 0:i.has(a))!==null&&r!==void 0&&r&&(lt.debug("Resuming event listeners on '".concat(e,"' table"),a),a.listenForChanges())})}}}const lo=io;function ct(o,e){var t=Object.keys(o);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(o);e&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(o,a).enumerable})),t.push.apply(t,s)}return t}function dt(o){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ct(Object(t),!0).forEach(function(s){we(o,s,t[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(t)):ct(Object(t)).forEach(function(s){Object.defineProperty(o,s,Object.getOwnPropertyDescriptor(t,s))})}return o}function ut(o,e,t,s,a,r,i){try{var c=o[r](i),l=c.value}catch(d){t(d);return}c.done?e(l):Promise.resolve(l).then(s,a)}function ye(o){return function(){var e=this,t=arguments;return new Promise(function(s,a){var r=o.apply(e,t);function i(l){ut(r,s,a,i,c,"next",l)}function c(l){ut(r,s,a,i,c,"throw",l)}i(void 0)})}}function we(o,e,t){return e=co(e),e in o?Object.defineProperty(o,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):o[e]=t,o}function co(o){var e=uo(o,"string");return typeof e=="symbol"?e:String(e)}function uo(o,e){if(typeof o!="object"||o===null)return o;var t=o[Symbol.toPrimitive];if(t!==void 0){var s=t.call(o,e||"default");if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(o)}var ht=k.module("PouchCommandHistoryStorage");class ho{constructor(){we(this,"cache",new lo),we(this,"updateTableMap",new Map)}getUpdateTable(e){return this.updateTableMap.has(e)||this.updateTableMap.set(e,new it(e,this.cache)),this.updateTableMap.get(e)}getTable(e){var t=this;return ye(function*(){return new it(e,t.cache)})()}addItem(e,t,s,a){var r=this;return ye(function*(){return r.updateItem(e,{id:"".concat(new Date().getTime()),name:s,data:a})})()}updateItem(e,t){var s=this;return ye(function*(){var a=s.getUpdateTable(e),r=yield a.refreshItem(t.id),i=dt(dt({},r??{}),t);return ht.debug("Updating item",i),yield a.put(i),ht.debug("Update saved"),t})()}listenItem(e,t,s){var a=this.getUpdateTable(e);return a.onItemUpdate(t,s)}}const Lt="SET_LAYOUT_STORAGE",mo=o=>({type:Lt,payload:o});var{dh:po}=globalThis;const B=po,Pt=""+new URL("community-wordmark-app-d2c5c1eb.svg",import.meta.url).href;const fo=k.module("SettingsUtils");function go(o){return o.formatString!=null}function xe(o){const e=o?.querySelector("input, select, textarea");e&&e.focus()}function kt(o,e){return o.defaultFormatString===e.defaultFormatString}function bo(o,e){return kt(o,e)}function vo(o,e){return kt(o,e)}function At(o){return o!==""&&is.isValidColumnName(o)}function q(o,e,t){if(!e||t.formatString==null||!go(t))return!1;switch(e){case"datetime":return W.isValid(o,t);case"decimal":return P.isValid(o,t);case"int":return L.isValid(o,t);default:return fo.warn("Trying to validate format of unknown type"),!0}}function So(o){const{id:e,isNewRule:t,...s}=o;return s}function yo(o,e){return At(e.columnName)&&q(o,e.columnType,e.format)}function Mt(o){const{timestamp:e,timeZone:t,showTimeZone:s,showTSeparator:a,isGlobalOptions:r,legacyGlobalFormat:i}=o,c=yt(),l=m.useMemo(()=>new ls(c,[],{timeZone:t,showTimeZone:s,showTSeparator:a}),[c,s,a,t]),d=r?W.getGlobalFormats(s,a):W.getFormats(s,a);return i!=null&&!d.includes(i)&&d.unshift(i),n.jsx(n.Fragment,{children:d.map(h=>{const u=W.makeFormat("",h,W.TYPE_GLOBAL);return n.jsx("option",{value:h,"data-testid":"time-format",children:l.getFormattedString(e,D.dataType.DATETIME,"",u)},h)})})}function To(){return n.jsx(n.Fragment,{children:cs.TIME_ZONES.map(o=>{const{label:e,value:t}=o;return n.jsx("option",{value:t,children:e},t)})})}const V=k.module("FormattingSectionContent");class Ee extends m.PureComponent{static defaultProps={scrollTo:()=>{}};static inputDebounceTime=250;constructor(e){super(e),this.debouncedCommitChanges=De(this.commitChanges.bind(this),Ee.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);const{defaultDateTimeFormat:t,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:a,showTimeZone:r,showTSeparator:i,timeZone:c,truncateNumbersWithPound:l}=e;this.containerRef=J.createRef(),this.pendingUpdates=[],this.state={showTimeZone:r,showTSeparator:i,timeZone:c,defaultDateTimeFormat:t,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:a,truncateNumbersWithPound:l,timestampAtMenuOpen:new Date}}componentDidMount(){xe(this.containerRef.current)}componentWillUnmount(){this.debouncedCommitChanges.flush()}debouncedCommitChanges;pendingUpdates;containerRef;getCachedDateTimeFormatOptions=Te((e,t,s,a=!1,r)=>{const{timestampAtMenuOpen:i}=this.state;return n.jsx(Mt,{timestamp:i,timeZone:e,showTimeZone:t,showTSeparator:s,isGlobalOptions:a,legacyGlobalFormat:r})});queueUpdate(e){this.pendingUpdates.push(e),this.debouncedCommitChanges()}handleDefaultDateTimeFormatChange(e){V.debug("handleDefaultDateTimeFormatChange",e);const t={defaultDateTimeFormat:e};this.setState(t),this.queueUpdate(t)}handleDefaultDecimalFormatChange(e){V.debug("handleDefaultDecimalFormatChange",e.target.value);const t={defaultDecimalFormatOptions:{defaultFormatString:e.target.value}};this.setState(t),q(dh,D.dataType.DECIMAL,P.makeCustomFormat(e.target.value))&&this.queueUpdate(t)}handleDefaultIntegerFormatChange(e){V.debug("handleDefaultIntegerFormatChange",e.target.value);const t={defaultIntegerFormatOptions:{defaultFormatString:e.target.value}};this.setState(t),q(dh,D.dataType.INT,L.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:s,showTSeparator:a}=e;V.debug("handleResetDateTimeFormat"),this.setState({defaultDateTimeFormat:t,showTimeZone:s,showTSeparator:a}),this.queueUpdate({defaultDateTimeFormat:void 0,showTimeZone:void 0,showTSeparator:void 0})}handleResetTimeZone(){const{defaults:e}=this.props,{timeZone:t}=e;V.debug("handleResetTimeZone"),this.setState({timeZone:t}),this.queueUpdate({timeZone:void 0})}handleResetDecimalFormat(){const{defaults:e}=this.props,{defaultDecimalFormatOptions:t}=e;V.debug("handleResetDecimalFormat"),this.setState({defaultDecimalFormatOptions:t}),this.queueUpdate({defaultDecimalFormatOptions:void 0})}handleResetIntegerFormat(){const{defaults:e}=this.props,{defaultIntegerFormatOptions:t}=e;V.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)}commitChanges(){const{updateSettings:e}=this.props,t=this.pendingUpdates.reduce((s,a)=>({...s,...a}),{});this.pendingUpdates=[],e(t)}render(){const{defaults:e,dh:t}=this.props,{defaultDateTimeFormat:s,defaultDecimalFormatOptions:a,defaultIntegerFormatOptions:r,timeZone:i,showTimeZone:c,showTSeparator:l,truncateNumbersWithPound:d}=this.state,{defaultFormatString:h=P.DEFAULT_FORMAT_STRING}=a??{},{defaultFormatString:u=L.DEFAULT_FORMAT_STRING}=r??{},g=i===e.timeZone,w=l===e.showTSeparator&&c===e.showTimeZone&&s===e.defaultDateTimeFormat,v=bo(a,e.defaultDecimalFormatOptions),R=vo(r,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(de,{className:"custom-select",value:i,onChange:this.handleTimeZoneChange,id:"select-reset-timezone",children:n.jsx(To,{})})}),n.jsx("div",{className:"col-1 btn-col",children:n.jsx(S,{kind:"ghost",icon:H,onClick:this.handleResetTimeZone,tooltip:"Reset Time Zone",className:F("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(de,{className:"custom-select",value:s,onChange:this.handleDefaultDateTimeFormatChange,id:"select-default-time-format",children:this.getCachedDateTimeFormatOptions(i,c,l,!0,s)})}),n.jsx("div",{className:"col-1 btn-col",children:n.jsx(S,{kind:"ghost",icon:H,onClick:this.handleResetDateTimeFormat,tooltip:"Reset DateTime Options",className:F("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(ge,{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(ge,{checked:l??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:F("form-control","flex-grow-1","default-decimal-format-input",{"is-invalid":!q(t,D.dataType.DECIMAL,P.makeCustomFormat(h))}),"data-lpignore":!0,placeholder:P.DEFAULT_FORMAT_STRING,type:"text",id:"default-decimal-format-input",value:h,onChange:this.handleDefaultDecimalFormatChange})}),n.jsx("div",{className:"col-1 btn-col",children:n.jsx(S,{kind:"ghost",icon:H,onClick:this.handleResetDecimalFormat,tooltip:"Reset Decimal Formatting",className:F("btn-reset","btn-reset-decimal",{hidden:v}),"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:F("form-control","flex-grow-1","default-integer-format-input",{"is-invalid":!q(t,D.dataType.INT,L.makeCustomFormat(u))}),"data-lpignore":!0,placeholder:L.DEFAULT_FORMAT_STRING,type:"text",id:"default-integer-format-input",value:u,onChange:this.handleDefaultIntegerFormatChange})}),n.jsx("div",{className:"col-1 btn-col",children:n.jsx(S,{kind:"ghost",icon:H,onClick:this.handleResetIntegerFormat,tooltip:"Reset Integer Formatting",className:F("btn-reset","btn-reset-integer",{hidden:R}),"data-testid":"btn-reset-integer"})})]}),n.jsx("div",{className:"form-row mb-3",children:n.jsx("div",{className:"offset-3 col-9",children:n.jsx(ge,{checked:d??null,onChange:this.handleTruncateNumbersWithPoundChange,children:"Show truncated numbers as ###"})})})]})})}}const Co=o=>({defaultDateTimeFormat:gn(o),defaultDecimalFormatOptions:wt(o),defaultIntegerFormatOptions:xt(o),dh:Dt(o),showTimeZone:Ft(o),showTSeparator:Rt(o),truncateNumbersWithPound:bn(o),timeZone:Et(o),defaults:vn(o)}),wo=te(Co,{updateSettings:Re})(Ee);function xo(){const[o,e]=m.useState(!1),t=()=>{e(!o)};return n.jsxs(n.Fragment,{children:[n.jsx(S,{kind:"ghost",onClick:t,icon:Ns,children:"Legal Notices"}),n.jsxs(js,{isOpen:o,toggle:t,className:"theme-bg-light",children:[n.jsx(Os,{toggle:t,children:"Legal Notice"}),n.jsxs(Is,{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 ee(o){const{children:e,isExpanded:t,sectionKey:s,title:a,onToggle:r}=o;return n.jsxs(n.Fragment,{children:[n.jsx("div",{children:n.jsxs(S,{kind:"ghost",className:"btn-collapse-trigger",onClick:()=>r(s),children:[n.jsx("div",{className:"flex-grow-1",children:a}),n.jsx("div",{className:"flex-shrink-0",children:n.jsx(x,{transform:t?"flip-v":"",icon:Ls})})]})}),n.jsx(nn,{in:t,autoFocusOnShow:!0,children:e})]})}ee.propTypes={children:f.node,isExpanded:f.bool.isRequired,sectionKey:f.string.isRequired,title:f.node.isRequired,onToggle:f.func};ee.defaultProps={children:null,onToggle:()=>{}};function Do({shortcut:o,displayText:e,categoryName:t,onChange:s}){const[a,r]=m.useState(e),[i,c]=m.useState(o.getKeyState()),[l,d]=m.useState(!1),[h,u]=m.useState("");m.useEffect(function(){r(e),c(o.getKeyState())},[e,o]),m.useEffect(function(){r(M.getDisplayText(i)),o.matchesKeyState(i)&&d(!1)},[i,o]),m.useEffect(function(){if(l){if(!M.isValidKeyState(i)){M.isAllowedKey(i.keyValue)?u("Must contain a modifier key"):u("Must contain an allowed action key");return}const p=Fe.getConflictingShortcuts(i).filter(b=>b.id.startsWith(t)&&b!==o).map(b=>b.name);if(p.length){u(`Conflicts with ${p.join(", ")}`);return}u("")}else u("")},[l,i,t,o]);function g(T){if(T.stopPropagation(),T.preventDefault(),o.isEditable&&!T.repeat){const p=M.getKeyStateFromEvent(T),b=M.createKeyState([ds.BACKSPACE]);M.doKeyStatesMatch(p,b)?c(M.NULL_KEY_STATE):c(p)}}function w(T){T.stopPropagation(),T.preventDefault(),o.matchesKeyState(i)||d(!0)}function v(){Ke.disableAllActions()}function R(){Ke.enableAllActions()}function E(){o.setKeyState(i),d(!1),s(o)}function y(){const T=o.getKeyState();c(T),d(!1)}function j(){d(!0),c(o.getDefaultKeyState())}return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"shortcut-item-container",children:[n.jsxs("label",{className:"shortcut-item-name",children:[o.name,o.tooltip!==void 0&&n.jsx(Tt,{children:o.tooltip})]}),n.jsxs("div",{className:"shortcut-item-input-container",children:[n.jsx("input",{className:F("form-control",{"is-invalid":h}),onKeyDown:g,onKeyUp:w,onFocus:v,onBlur:R,disabled:!o.isEditable,value:a,readOnly:!0}),!M.doKeyStatesMatch(i,o.getDefaultKeyState())&&!h&&n.jsx(S,{className:"reset-to-default-button",kind:"ghost",icon:n.jsx(x,{icon:H,transform:{rotate:90,flipX:!0}}),tooltip:"Reset to default",onClick:j})]})]}),l&&n.jsxs("div",{className:F("shortcut-item-message-container",{"is-invalid":h}),children:[n.jsx("div",{className:"shortcut-item-message",children:h}),n.jsxs("div",{className:"shortcut-item-message-buttons",children:[M.isValidKeyState(i)&&n.jsx(S,{kind:"ghost",onClick:E,children:"Confirm"}),n.jsx(S,{kind:"ghost",onClick:y,children:"Undo"})]})]})]})}function Fo({shortcutOverrides:o={},updateSettings:e}){const t=m.useCallback(i=>{const c=M.isMacPlatform,l={mac:{...o.mac},windows:{...o.windows}},d=c?l.mac:l.windows;i.forEach(h=>{h.isDefault()?delete d[h.id]:d[h.id]=h.getKeyState()}),e({shortcutOverrides:l})},[e,o]);let s=Array.from(Fe.shortcutsByCategory.entries()).map(([i,c])=>({name:i,shortcuts:c}));const a=s.findIndex(i=>i.name.toUpperCase()==="GLOBAL"),r=s.splice(a,1);return s=s.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."}),s.map(i=>n.jsx(Ro,{name:i.name,shortcuts:i.shortcuts,saveShortcutOverrides:t},i.name))]})}function Ro({name:o,shortcuts:e,saveShortcutOverrides:t}){function s(l){return l.split("_").map(d=>`${d[0].toUpperCase()}${d.slice(1).toLowerCase()}`).join(" ")}const[a,r]=m.useState(e);function i(l){const d=a.filter(u=>u!==l&&!u.isNull()&&u.matchesKeyState(l.getKeyState()));d.forEach(u=>u.setToNull());const h=[l,...d];t(h),r(u=>[...u])}const c=m.useMemo(()=>a.map(l=>l.getDisplayText()),[a]);return n.jsxs("div",{className:"mt-3",children:[n.jsx("div",{className:"font-weight-bold",children:s(o)}),a.map((l,d)=>n.jsx(Do,{shortcut:l,displayText:c[d],categoryName:o,onChange:i},l.id))]})}const Eo=o=>({shortcutOverrides:Sn(o)}),No={updateSettings:Re},jo=te(Eo,No)(Fo),Oo="yyyy-MM-dd-HHmmss";function Ut(o,e="root",t=new Map([[o,""]])){const s={};return Object.entries(o).forEach(([a,r])=>{try{JSON.stringify(r),s[a]=r}catch{const c=r;if(typeof r=="bigint")s[a]=r.toString();else if(t.has(c))s[a]=`Circular ref to ${t.get(c)}`;else{const l=`${e}.${a}`;t.set(c,l),s[a]=Ut(r,l,t)}}}),s}function Io(){const o=Nt.getState();return JSON.stringify(Ut(o),null,2)}function Lo(o){const e={uiVersion:"0.55.0",userAgent:navigator.userAgent,...o};return JSON.stringify(e,null,2)}async function Po(o=`${B.i18n.DateTimeFormat.format(Oo,new Date)}_support_logs`,e){const t=new vt,s=t.folder(o);s.file("console.txt",Ps.getFormattedHistory()),s.file("redux.json",Io()),s.file("metadata.json",Lo(e));const a=await t.generateAsync({type:"blob"}),r=document.createElement("a");r.href=URL.createObjectURL(a),r.download=`${o}.zip`,r.click()}const ko=[{value:D.dataType.DATETIME,label:"DateTime"},{value:D.dataType.DECIMAL,label:"Decimal"},{value:D.dataType.INT,label:"Integer"}];function Ao(){const o=ko.map(e=>n.jsx("option",{value:e.value,children:e.label},`key-columnType-${e.value}`));return n.jsxs(n.Fragment,{children:[n.jsx("option",{disabled:!0,value:"",children:"Select Type"},"key-columnType-placeholder"),o]})}class Ne extends m.PureComponent{static defaultProps={scrollTo:()=>{}};static inputDebounceTime=250;constructor(e){super(e),this.debouncedCommitChanges=De(this.commitChanges.bind(this),Ne.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:s,showTSeparator:a,timeZone:r}=e,i=t.map((c,l)=>({...c,id:l}));this.containerRef=J.createRef(),this.addFormatRuleButtonRef=J.createRef(),this.lastFormatRuleIndex=i.length,this.state={formatSettings:i,formatRulesChanged:!1,showTimeZone:s,showTSeparator:a,timeZone:r,timestampAtMenuOpen:new Date}}componentDidMount(){xe(this.containerRef.current)}componentWillUnmount(){this.debouncedCommitChanges.flush()}debouncedCommitChanges;containerRef;addFormatRuleButtonRef;lastFormatRuleIndex;isDuplicateRule(e){const{formatSettings:t}=this.state;return t.some(s=>s.id!==e.id&&s.columnName===e.columnName&&s.columnType===e.columnType)??!1}getAutoIncrementFormatRuleIndex(){const{lastFormatRuleIndex:e}=this;return this.lastFormatRuleIndex+=1,e}getCachedColumnTypeOptions=Te(()=>n.jsx(Ao,{}));getCachedDateTimeFormatOptions=Te((e,t,s,a=!1,r)=>{const{timestampAtMenuOpen:i}=this.state;return n.jsx(Mt,{timestamp:i,timeZone:e,showTimeZone:t,showTSeparator:s,isGlobalOptions:a,legacyGlobalFormat:r})});handleFormatRuleChange(e,t,s){this.setState(a=>{const{formatSettings:r}=a;Ve(r);const i=[...r];let c={};t==="columnType"&&(c={format:this.makeDefaultFormatterItemByType(s)});const l={...i[e],...c,[t]:s};return i[e]=l,{formatSettings:i}},()=>{this.debouncedCommitChanges()})}handleFormatRuleCreate(){this.setState(e=>{const{formatSettings:t}=e,s={columnType:D.dataType.DATETIME,columnName:"",format:{},id:this.getAutoIncrementFormatRuleIndex(),isNewRule:!0};return{formatSettings:[...t,s],formatRulesChanged:!0}})}handleFormatRuleDelete(e){this.setState(t=>{const{formatSettings:s}=t;return{formatSettings:s.filter((r,i)=>i!==e),formatRulesChanged:!0}},()=>{this.debouncedCommitChanges()})}handleFormatRuleEntered(e){this.scrollToFormatBlockBottom(),xe(e)}commitChanges(){const{formatSettings:e}=this.state,{dh:t}=this.props,s=e.filter(i=>yo(t,i)).map(So)??[],{updateSettings:a}=this.props;a({formatter:s})}scrollToFormatBlockBottom(){const{scrollTo:e}=this.props;e(0,(this.addFormatRuleButtonRef.current?.offsetHeight??0)+(this.addFormatRuleButtonRef.current?.offsetTop??0))}getRuleError(e){const{dh:t}=this.props,s={hasColumnNameError:!1,hasFormatError:!1,message:""},a=[];return e.isNewRule!==void 0&&e.isNewRule||(this.isDuplicateRule(e)&&(s.hasColumnNameError=!0,a.push("Duplicate column name/type combo.")),At(e.columnName)||(s.hasColumnNameError=!0,a.push("Column names must start with a letter or underscore and contain only alphanumeric characters or underscores.")),e.format.formatString!==void 0&&e.format.formatString.length===0?(s.hasFormatError=!0,a.push("Empty formatting rule.")):q(t,e.columnType,e.format)||(s.hasFormatError=!0,a.push("Invalid formatting rule.")),s.message=a.join(`
1
+ import{P as bt,I as Yt,r as m,C as n,J as te,K as De,H as J,L as Te,F,M as f,G as x,N as vt,D as St,T as Jt,O as Xt,Q as Qt,S as es,U as ts,V as ss,W as fe,X as ns,Y as os}from"./vendor-fd5d5838.js";import{_ as as,W as rs}from"./monaco-1410cbed.js";import{O as ce,P as K,T as A,D as is,I as L,a as P,b as W,u as yt,F as ls,c as D,d as cs,S as de,B as S,C as ge,e as M,f as Fe,g as Tt,K as ds,h as Ke,i as us,G as Ce,j as Ct,k as hs,r as ms,l as ps,m as fs,n as gs,o as We,p as bs,q as _,s as vs,t as Ss,v as ys,w as Be,x as Ts,y as Ge,z as Cs,A as ws,E as xs,H as Ds,J as Fs,L as Rs,M as Es}from"./usePlugins-525a1a1b.js";import{L as k,v as H,a as Ns,M as js,b as Os,c as Is,d as Ls,l as Ps,e as Ve,f as ks,T as ie,g as As,h as Ms,i as Us,j as _s,k as $s,m as Ks,n as Ws,o as Bs,p as Gs,q as Vs,r as Zs,s as Hs,t as qs,u as zs,w as Ze,x as He,y as qe,z as Ys,A as Js,B as Xs,C as Qs,D as en,E as ze,F as tn,G as sn}from"./index-bf3c2e00.js";import{C as nn,B as on,m as an,a as rn,D as ln,b as cn,I as dn,u as un,c as hn,d as mn,g as pn,l as fn}from"./useUser-6f056f9e.js";import{u as Re,g as gn,a as wt,b as xt,c as Dt,d as Ft,e as Rt,f as bn,h as Et,i as vn,j as Sn,s as Nt,k as yn,C as G,T as ue,r as Tn,O as Cn,l as Ye,L as Je,m as Xe,F as Qe,n as jt,o as wn,p as xn,q as Dn,t as Fn,v as et,w as Rn,x as Ot,N as En,I as oe,M as Nn,y as jn,z as On,A as Z,B as In,D as Ln,E as Pn,G as kn,H as An,J as Mn,K as Un,P as _n,Q as $n,R as Kn,S as Wn,U as Bn,V as Gn}from"./ControlType-4c9520d6.js";class tt{static makeSortConfig(e,t){return{column:e,direction:t}}static makeFilterConfig(e){var t=[],s=[];return e.forEach((a,r)=>{t.push(a),r>0&&s.push(ce.and)}),{filterItems:t,filterOperators:s}}static combineFilterConfigs(e,t){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ce.and;return{filterItems:[...e.filterItems,...t.filterItems],filterOperators:[...e.filterOperators,s,...t.filterOperators]}}static makeFilterItem(e,t,s){return{columnName:e,type:t,value:s}}}function Vn(o,e,t){if(o.length>e){var s=o.length-t;return{toKeep:o.slice(s),toPrune:o.slice(0,s)}}return{toKeep:o,toPrune:[]}}function st(o,e){var t=Object.keys(o);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(o);e&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(o,a).enumerable})),t.push.apply(t,s)}return t}function nt(o){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?st(Object(t),!0).forEach(function(s){N(o,s,t[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(t)):st(Object(t)).forEach(function(s){Object.defineProperty(o,s,Object.getOwnPropertyDescriptor(t,s))})}return o}function ot(o,e,t,s,a,r,i){try{var c=o[r](i),l=c.value}catch(d){t(d);return}c.done?e(l):Promise.resolve(l).then(s,a)}function $(o){return function(){var e=this,t=arguments;return new Promise(function(s,a){var r=o.apply(e,t);function i(l){ot(r,s,a,i,c,"next",l)}function c(l){ot(r,s,a,i,c,"throw",l)}i(void 0)})}}function N(o,e,t){return e=Zn(e),e in o?Object.defineProperty(o,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):o[e]=t,o}function Zn(o){var e=Hn(o,"string");return typeof e=="symbol"?e:String(e)}function Hn(o,e){if(typeof o!="object"||o===null)return o;var t=o[Symbol.toPrimitive];if(t!==void 0){var s=t.call(o,e||"default");if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(o)}var be=k.module("PouchStorageTable"),qn="Deephaven.";bt.plugin(Yt);function zn(o,e){switch(o){case A.in:case A.contains:return{$regex:new RegExp("".concat(e))};case A.inIgnoreCase:return{$regex:new RegExp("".concat(e),"i")};case A.eq:return{$eq:e};case A.notEq:return{$neq:e};case A.greaterThan:return{$gt:e};case A.greaterThanOrEqualTo:return{$gte:e};case A.lessThan:return{$lt:e};case A.lessThanOrEqualTo:return{$lte:e};case A.startsWith:return{$regex:new RegExp("^(?".concat(e,").*"))};default:throw new Error("Unsupported type: ".concat(o))}}function Yn(o){for(var{filterItems:e,filterOperators:t}=o,s=null,a=0;a<e.length;a+=1){var r=e[a],{columnName:i,type:c,value:l}=r,d={[i]:zn(c,l)};if(a===0)s=d;else if(s!==null&&a-1<t.length){var h=t[a-1];if(h===ce.and)s={$and:[s,d]};else if(h===ce.or)s={$or:[s,d]};else throw new Error("Unexpected filter operator ".concat(h,", ").concat(d))}}if(s==null)throw new Error("Invalid filter config ".concat(o));return s}function ve(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return{$and:[...o.map(e=>Yn(e)),{name:{$gt:null}},{id:{$gt:null}}]}}function Jn(o){var e,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return[{id:t?"desc":"asc"},...(e=o?.map(s=>({[s.column]:s.direction})))!==null&&e!==void 0?e:[]]}class Xn{constructor(e,t){N(this,"db",void 0),N(this,"changes",void 0),N(this,"listeners",[]),N(this,"itemListeners",new Map),N(this,"currentSize",0),N(this,"currentViewport",void 0),N(this,"currentReverse",!1),N(this,"currentFilter",null),N(this,"currentSort",null),N(this,"infoUpdatePromise",void 0),N(this,"viewportUpdatePromise",void 0),N(this,"currentViewportData",void 0),this.db=new bt("".concat(qn).concat(e),t),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(e){return this.listeners=[...this.listeners,e],()=>{this.listeners=this.listeners.filter(t=>t!==e)}}onItemUpdate(e,t){return this.itemListeners.has(e)||this.itemListeners.set(e,[]),this.itemListeners.set(e,[...this.itemListeners.get(e),t]),this.refreshItem(e),()=>{this.itemListeners.set(e,this.itemListeners.get(e).filter(s=>s!==t))}}close(){this.listeners=[]}get size(){return this.currentSize}get viewport(){return this.currentViewport}setReversed(e){this.currentReverse=e,this.currentViewportData=void 0,this.refreshData()}setViewport(e){this.currentViewport=e,this.refreshInfo(),this.refreshData()}setSorts(e){this.currentSort=e,this.currentViewportData=void 0,this.refreshData()}setFilters(e){this.currentFilter=e,this.currentViewportData=void 0,this.refreshInfo(),this.refreshData()}get data(){return this.currentViewportData}getViewportData(){var e=this;return $(function*(){var t;return e.viewportUpdatePromise||e.refreshData(),(t=e.viewportUpdatePromise)!==null&&t!==void 0?t:Promise.resolve({items:[],offset:0})})()}put(e){var t=this;return $(function*(){var s=nt(nt({},e),{},{_id:e.id});return yield t.db.put(s),s})()}sendUpdate(){for(var e,{listeners:t}=this,s=(e=this.currentViewportData)!==null&&e!==void 0?e:{items:[],offset:0},a=0;a<t.length;a+=1)t[a](s)}sendItemUpdate(e){var t=this.itemListeners.get(e.id);if(t!==void 0)for(var s=0;s<t.length;s+=1)t[s](e)}dbUpdate(e){be.debug("Update received",e),this.refreshInfo(),e.doc!==void 0&&this.sendItemUpdate(e.doc),this.refreshData()}fetchInfo(e){var t=this;return $(function*(){return t.db.find({selector:e,fields:[]})})()}refreshInfo(){var e=this;return $(function*(){try{var t,s;(t=e.infoUpdatePromise)===null||t===void 0||t.cancel(),e.infoUpdatePromise=K.makeCancelable(e.fetchInfo(ve((s=e.currentFilter)!==null&&s!==void 0?s:[])));var a=yield e.infoUpdatePromise;e.currentSize=a.docs.length,e.sendUpdate()}catch(r){if(!K.isCanceled(r))throw be.error("Unable to refreshInfo",r),r}})()}fetchViewportData(e,t,s){var a=this;return $(function*(){return a.db.find({selector:t,skip:e.top,limit:e.bottom-e.top+1,sort:s,fields:["id","name"]}).then(r=>({items:r.docs,offset:e.top}))})()}refreshData(){var e=this;return $(function*(){if(e.currentViewport)try{var t,s,a=ve((t=e.currentFilter)!==null&&t!==void 0?t:[]),r=Jn(e.currentSort,e.currentReverse);(s=e.viewportUpdatePromise)===null||s===void 0||s.cancel(),e.viewportUpdatePromise=K.makeCancelable(e.fetchViewportData(e.currentViewport,a,r));var i=yield e.viewportUpdatePromise;return e.currentViewportData=i,e.sendUpdate(),i}catch(c){if(!K.isCanceled(c))throw be.error("Unable to refreshData",c),c}})()}refreshItem(e){var t=this;return $(function*(){var s=yield t.db.find({selector:{id:e},limit:1}),a=s.docs[0];return a!==void 0&&t.sendItemUpdate(a),a})()}getSnapshot(e){var t=this;return $(function*(){var s=new Map,a=[{id:t.currentReverse?"desc":"asc"}];return yield Promise.all(e.map(function(){var r=$(function*(i){var c,[l,d]=i,h=d-l+1;return t.db.find({selector:ve((c=t.currentFilter)!==null&&c!==void 0?c:[]),skip:l,limit:h,sort:a,fields:["id","name"]}).then(u=>{for(var g=0;g<h;g+=1){var w=l+g;s.set(w,u.docs[g])}})});return function(i){return r.apply(this,arguments)}}())),s})()}}const Qn=Xn;function at(o,e){var t=Object.keys(o);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(o);e&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(o,a).enumerable})),t.push.apply(t,s)}return t}function ae(o){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?at(Object(t),!0).forEach(function(s){It(o,s,t[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(t)):at(Object(t)).forEach(function(s){Object.defineProperty(o,s,Object.getOwnPropertyDescriptor(t,s))})}return o}function rt(o,e,t,s,a,r,i){try{var c=o[r](i),l=c.value}catch(d){t(d);return}c.done?e(l):Promise.resolve(l).then(s,a)}function X(o){return function(){var e=this,t=arguments;return new Promise(function(s,a){var r=o.apply(e,t);function i(l){rt(r,s,a,i,c,"next",l)}function c(l){rt(r,s,a,i,c,"throw",l)}i(void 0)})}}function It(o,e,t){return e=eo(e),e in o?Object.defineProperty(o,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):o[e]=t,o}function eo(o){var e=to(o,"string");return typeof e=="symbol"?e:String(e)}function to(o,e){if(typeof o!="object"||o===null)return o;var t=o[Symbol.toPrimitive];if(t!==void 0){var s=t.call(o,e||"default");if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(o)}var so=2500,no=2e3,O=k.module("PouchCommandHistoryTable");class oo extends Qn{constructor(e,t){var s;super("CommandHistoryStorage.".concat(e),{auto_compaction:!0,revs_limit:1}),It(this,"searchText",void 0),this.cache=t,this.cache.tableRegistry.has(this.cacheKey)||this.cache.tableRegistry.set(this.cacheKey,new Set),O.debug("Adding table to registry",this.cacheKey),(s=this.cache.tableRegistry.get(this.cacheKey))===null||s===void 0||s.add(this)}get cacheKey(){return this.db.name}setSearch(e){O.debug("Setting search filters",e),this.searchText=e.trim().toLowerCase(),this.setFilters(e?[tt.makeFilterConfig([tt.makeFilterItem("name",A.contains,e)])]:[])}dbUpdate(e){O.debug("Clearing cache and refreshing data",e),this.cache.response.delete(this.cacheKey),super.dbUpdate(e)}fetchData(e){var t=this;return X(function*(){return K.withTimeout(0,X(function*(){t.cache.response.has(t.cacheKey)?O.debug("Fetching from cache",t.searchText,t.viewport):(O.debug("Fetching from PouchDB",t.searchText,t.viewport),t.cache.response.set(t.cacheKey,t.db.allDocs({include_docs:!0}).then(a=>{var r=a.rows.map(l=>l.doc).filter(l=>{var{name:d}=l;return d});O.debug("Fetched ".concat(r.length," command history items"));var{toKeep:i,toPrune:c}=Vn(r,so,no);return c.length&&t.pruneItems(c),{docs:i}})));var s=t.cache.response.get(t.cacheKey);return t.searchText==null||t.searchText===""?s:ae(ae({},s),{},{docs:(yield s).docs.filter(a=>{var{name:r}=a;return r.toLowerCase().includes(t.searchText)})})}))})()}fetchInfo(e){var t=this;return X(function*(){return t.fetchData(e)})()}fetchViewportData(e,t,s){var a=this;return X(function*(){var r=yield a.fetchData(t);O.debug("Fetching viewport data",e.top,e.bottom+1,s,r);var i=typeof s[0]=="object"&&s[0].id==="desc",c=i?r.docs.slice(0).reverse():r.docs,l=c.slice(e.top,e.bottom+1);return{items:l,offset:e.top}})()}pruneItems(e){var t=this;return X(function*(){if(t.cache.isPruning.get(t.cacheKey)===!0){O.debug("Pruning already in progress. Skipping.");return}try{O.debug("Pruning ".concat(e.length," command history items"));var s=t.cache.pauseChangeListeners(t.cacheKey);t.cache.isPruning.set(t.cacheKey,!0),yield t.db.bulkDocs(e.map(a=>ae(ae({},a),{},{_deleted:!0}))),t.cache.isPruning.set(t.cacheKey,!1),s(),O.debug("Finished pruning command history items")}catch(a){O.error("An error occurred while pruning db",a)}})()}close(){var e,t,s;O.debug("Closing table",this,(e=this.cache.tableRegistry.get(this.cacheKey))===null||e===void 0?void 0:e.size),(t=this.cache.tableRegistry.get(this.cacheKey))===null||t===void 0||t.delete(this),(s=this.changes)===null||s===void 0||s.cancel(),super.close()}}const it=oo;function Se(o,e,t){return e=ao(e),e in o?Object.defineProperty(o,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):o[e]=t,o}function ao(o){var e=ro(o,"string");return typeof e=="symbol"?e:String(e)}function ro(o,e){if(typeof o!="object"||o===null)return o;var t=o[Symbol.toPrimitive];if(t!==void 0){var s=t.call(o,e||"default");if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(o)}var lt=k.module("PouchCommandHistoryCache");class io{constructor(){Se(this,"isPruning",void 0),Se(this,"response",void 0),Se(this,"tableRegistry",void 0),this.isPruning=new Map,this.response=new Map,this.tableRegistry=new Map}pauseChangeListeners(e){var t,s=[];return(t=this.tableRegistry.get(e))===null||t===void 0||t.forEach(a=>{a.changes&&(lt.debug("Pausing event listeners on '".concat(e,"' table"),a),a.changes.cancel(),s.push(a))}),()=>{s.forEach(a=>{var r,i;(r=(i=this.tableRegistry.get(e))===null||i===void 0?void 0:i.has(a))!==null&&r!==void 0&&r&&(lt.debug("Resuming event listeners on '".concat(e,"' table"),a),a.listenForChanges())})}}}const lo=io;function ct(o,e){var t=Object.keys(o);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(o);e&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(o,a).enumerable})),t.push.apply(t,s)}return t}function dt(o){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ct(Object(t),!0).forEach(function(s){we(o,s,t[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(t)):ct(Object(t)).forEach(function(s){Object.defineProperty(o,s,Object.getOwnPropertyDescriptor(t,s))})}return o}function ut(o,e,t,s,a,r,i){try{var c=o[r](i),l=c.value}catch(d){t(d);return}c.done?e(l):Promise.resolve(l).then(s,a)}function ye(o){return function(){var e=this,t=arguments;return new Promise(function(s,a){var r=o.apply(e,t);function i(l){ut(r,s,a,i,c,"next",l)}function c(l){ut(r,s,a,i,c,"throw",l)}i(void 0)})}}function we(o,e,t){return e=co(e),e in o?Object.defineProperty(o,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):o[e]=t,o}function co(o){var e=uo(o,"string");return typeof e=="symbol"?e:String(e)}function uo(o,e){if(typeof o!="object"||o===null)return o;var t=o[Symbol.toPrimitive];if(t!==void 0){var s=t.call(o,e||"default");if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(o)}var ht=k.module("PouchCommandHistoryStorage");class ho{constructor(){we(this,"cache",new lo),we(this,"updateTableMap",new Map)}getUpdateTable(e){return this.updateTableMap.has(e)||this.updateTableMap.set(e,new it(e,this.cache)),this.updateTableMap.get(e)}getTable(e){var t=this;return ye(function*(){return new it(e,t.cache)})()}addItem(e,t,s,a){var r=this;return ye(function*(){return r.updateItem(e,{id:"".concat(new Date().getTime()),name:s,data:a})})()}updateItem(e,t){var s=this;return ye(function*(){var a=s.getUpdateTable(e),r=yield a.refreshItem(t.id),i=dt(dt({},r??{}),t);return ht.debug("Updating item",i),yield a.put(i),ht.debug("Update saved"),t})()}listenItem(e,t,s){var a=this.getUpdateTable(e);return a.onItemUpdate(t,s)}}const Lt="SET_LAYOUT_STORAGE",mo=o=>({type:Lt,payload:o});var{dh:po}=globalThis;const B=po,Pt=""+new URL("community-wordmark-app-d2c5c1eb.svg",import.meta.url).href;const fo=k.module("SettingsUtils");function go(o){return o.formatString!=null}function xe(o){const e=o?.querySelector("input, select, textarea");e&&e.focus()}function kt(o,e){return o.defaultFormatString===e.defaultFormatString}function bo(o,e){return kt(o,e)}function vo(o,e){return kt(o,e)}function At(o){return o!==""&&is.isValidColumnName(o)}function q(o,e,t){if(!e||t.formatString==null||!go(t))return!1;switch(e){case"datetime":return W.isValid(o,t);case"decimal":return P.isValid(o,t);case"int":return L.isValid(o,t);default:return fo.warn("Trying to validate format of unknown type"),!0}}function So(o){const{id:e,isNewRule:t,...s}=o;return s}function yo(o,e){return At(e.columnName)&&q(o,e.columnType,e.format)}function Mt(o){const{timestamp:e,timeZone:t,showTimeZone:s,showTSeparator:a,isGlobalOptions:r,legacyGlobalFormat:i}=o,c=yt(),l=m.useMemo(()=>new ls(c,[],{timeZone:t,showTimeZone:s,showTSeparator:a}),[c,s,a,t]),d=r?W.getGlobalFormats(s,a):W.getFormats(s,a);return i!=null&&!d.includes(i)&&d.unshift(i),n.jsx(n.Fragment,{children:d.map(h=>{const u=W.makeFormat("",h,W.TYPE_GLOBAL);return n.jsx("option",{value:h,"data-testid":"time-format",children:l.getFormattedString(e,D.dataType.DATETIME,"",u)},h)})})}function To(){return n.jsx(n.Fragment,{children:cs.TIME_ZONES.map(o=>{const{label:e,value:t}=o;return n.jsx("option",{value:t,children:e},t)})})}const V=k.module("FormattingSectionContent");class Ee extends m.PureComponent{static defaultProps={scrollTo:()=>{}};static inputDebounceTime=250;constructor(e){super(e),this.debouncedCommitChanges=De(this.commitChanges.bind(this),Ee.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);const{defaultDateTimeFormat:t,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:a,showTimeZone:r,showTSeparator:i,timeZone:c,truncateNumbersWithPound:l}=e;this.containerRef=J.createRef(),this.pendingUpdates=[],this.state={showTimeZone:r,showTSeparator:i,timeZone:c,defaultDateTimeFormat:t,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:a,truncateNumbersWithPound:l,timestampAtMenuOpen:new Date}}componentDidMount(){xe(this.containerRef.current)}componentWillUnmount(){this.debouncedCommitChanges.flush()}debouncedCommitChanges;pendingUpdates;containerRef;getCachedDateTimeFormatOptions=Te((e,t,s,a=!1,r)=>{const{timestampAtMenuOpen:i}=this.state;return n.jsx(Mt,{timestamp:i,timeZone:e,showTimeZone:t,showTSeparator:s,isGlobalOptions:a,legacyGlobalFormat:r})});queueUpdate(e){this.pendingUpdates.push(e),this.debouncedCommitChanges()}handleDefaultDateTimeFormatChange(e){V.debug("handleDefaultDateTimeFormatChange",e);const t={defaultDateTimeFormat:e};this.setState(t),this.queueUpdate(t)}handleDefaultDecimalFormatChange(e){V.debug("handleDefaultDecimalFormatChange",e.target.value);const t={defaultDecimalFormatOptions:{defaultFormatString:e.target.value}};this.setState(t),q(dh,D.dataType.DECIMAL,P.makeCustomFormat(e.target.value))&&this.queueUpdate(t)}handleDefaultIntegerFormatChange(e){V.debug("handleDefaultIntegerFormatChange",e.target.value);const t={defaultIntegerFormatOptions:{defaultFormatString:e.target.value}};this.setState(t),q(dh,D.dataType.INT,L.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:s,showTSeparator:a}=e;V.debug("handleResetDateTimeFormat"),this.setState({defaultDateTimeFormat:t,showTimeZone:s,showTSeparator:a}),this.queueUpdate({defaultDateTimeFormat:void 0,showTimeZone:void 0,showTSeparator:void 0})}handleResetTimeZone(){const{defaults:e}=this.props,{timeZone:t}=e;V.debug("handleResetTimeZone"),this.setState({timeZone:t}),this.queueUpdate({timeZone:void 0})}handleResetDecimalFormat(){const{defaults:e}=this.props,{defaultDecimalFormatOptions:t}=e;V.debug("handleResetDecimalFormat"),this.setState({defaultDecimalFormatOptions:t}),this.queueUpdate({defaultDecimalFormatOptions:void 0})}handleResetIntegerFormat(){const{defaults:e}=this.props,{defaultIntegerFormatOptions:t}=e;V.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)}commitChanges(){const{updateSettings:e}=this.props,t=this.pendingUpdates.reduce((s,a)=>({...s,...a}),{});this.pendingUpdates=[],e(t)}render(){const{defaults:e,dh:t}=this.props,{defaultDateTimeFormat:s,defaultDecimalFormatOptions:a,defaultIntegerFormatOptions:r,timeZone:i,showTimeZone:c,showTSeparator:l,truncateNumbersWithPound:d}=this.state,{defaultFormatString:h=P.DEFAULT_FORMAT_STRING}=a??{},{defaultFormatString:u=L.DEFAULT_FORMAT_STRING}=r??{},g=i===e.timeZone,w=l===e.showTSeparator&&c===e.showTimeZone&&s===e.defaultDateTimeFormat,v=bo(a,e.defaultDecimalFormatOptions),R=vo(r,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(de,{className:"custom-select",value:i,onChange:this.handleTimeZoneChange,id:"select-reset-timezone",children:n.jsx(To,{})})}),n.jsx("div",{className:"col-1 btn-col",children:n.jsx(S,{kind:"ghost",icon:H,onClick:this.handleResetTimeZone,tooltip:"Reset Time Zone",className:F("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(de,{className:"custom-select",value:s,onChange:this.handleDefaultDateTimeFormatChange,id:"select-default-time-format",children:this.getCachedDateTimeFormatOptions(i,c,l,!0,s)})}),n.jsx("div",{className:"col-1 btn-col",children:n.jsx(S,{kind:"ghost",icon:H,onClick:this.handleResetDateTimeFormat,tooltip:"Reset DateTime Options",className:F("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(ge,{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(ge,{checked:l??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:F("form-control","flex-grow-1","default-decimal-format-input",{"is-invalid":!q(t,D.dataType.DECIMAL,P.makeCustomFormat(h))}),"data-lpignore":!0,placeholder:P.DEFAULT_FORMAT_STRING,type:"text",id:"default-decimal-format-input",value:h,onChange:this.handleDefaultDecimalFormatChange})}),n.jsx("div",{className:"col-1 btn-col",children:n.jsx(S,{kind:"ghost",icon:H,onClick:this.handleResetDecimalFormat,tooltip:"Reset Decimal Formatting",className:F("btn-reset","btn-reset-decimal",{hidden:v}),"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:F("form-control","flex-grow-1","default-integer-format-input",{"is-invalid":!q(t,D.dataType.INT,L.makeCustomFormat(u))}),"data-lpignore":!0,placeholder:L.DEFAULT_FORMAT_STRING,type:"text",id:"default-integer-format-input",value:u,onChange:this.handleDefaultIntegerFormatChange})}),n.jsx("div",{className:"col-1 btn-col",children:n.jsx(S,{kind:"ghost",icon:H,onClick:this.handleResetIntegerFormat,tooltip:"Reset Integer Formatting",className:F("btn-reset","btn-reset-integer",{hidden:R}),"data-testid":"btn-reset-integer"})})]}),n.jsx("div",{className:"form-row mb-3",children:n.jsx("div",{className:"offset-3 col-9",children:n.jsx(ge,{checked:d??null,onChange:this.handleTruncateNumbersWithPoundChange,children:"Show truncated numbers as ###"})})})]})})}}const Co=o=>({defaultDateTimeFormat:gn(o),defaultDecimalFormatOptions:wt(o),defaultIntegerFormatOptions:xt(o),dh:Dt(o),showTimeZone:Ft(o),showTSeparator:Rt(o),truncateNumbersWithPound:bn(o),timeZone:Et(o),defaults:vn(o)}),wo=te(Co,{updateSettings:Re})(Ee);function xo(){const[o,e]=m.useState(!1),t=()=>{e(!o)};return n.jsxs(n.Fragment,{children:[n.jsx(S,{kind:"ghost",onClick:t,icon:Ns,children:"Legal Notices"}),n.jsxs(js,{isOpen:o,toggle:t,className:"theme-bg-light",children:[n.jsx(Os,{toggle:t,children:"Legal Notice"}),n.jsxs(Is,{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 ee(o){const{children:e,isExpanded:t,sectionKey:s,title:a,onToggle:r}=o;return n.jsxs(n.Fragment,{children:[n.jsx("div",{children:n.jsxs(S,{kind:"ghost",className:"btn-collapse-trigger",onClick:()=>r(s),children:[n.jsx("div",{className:"flex-grow-1",children:a}),n.jsx("div",{className:"flex-shrink-0",children:n.jsx(x,{transform:t?"flip-v":"",icon:Ls})})]})}),n.jsx(nn,{in:t,autoFocusOnShow:!0,children:e})]})}ee.propTypes={children:f.node,isExpanded:f.bool.isRequired,sectionKey:f.string.isRequired,title:f.node.isRequired,onToggle:f.func};ee.defaultProps={children:null,onToggle:()=>{}};function Do({shortcut:o,displayText:e,categoryName:t,onChange:s}){const[a,r]=m.useState(e),[i,c]=m.useState(o.getKeyState()),[l,d]=m.useState(!1),[h,u]=m.useState("");m.useEffect(function(){r(e),c(o.getKeyState())},[e,o]),m.useEffect(function(){r(M.getDisplayText(i)),o.matchesKeyState(i)&&d(!1)},[i,o]),m.useEffect(function(){if(l){if(!M.isValidKeyState(i)){M.isAllowedKey(i.keyValue)?u("Must contain a modifier key"):u("Must contain an allowed action key");return}const p=Fe.getConflictingShortcuts(i).filter(b=>b.id.startsWith(t)&&b!==o).map(b=>b.name);if(p.length){u(`Conflicts with ${p.join(", ")}`);return}u("")}else u("")},[l,i,t,o]);function g(T){if(T.stopPropagation(),T.preventDefault(),o.isEditable&&!T.repeat){const p=M.getKeyStateFromEvent(T),b=M.createKeyState([ds.BACKSPACE]);M.doKeyStatesMatch(p,b)?c(M.NULL_KEY_STATE):c(p)}}function w(T){T.stopPropagation(),T.preventDefault(),o.matchesKeyState(i)||d(!0)}function v(){Ke.disableAllActions()}function R(){Ke.enableAllActions()}function E(){o.setKeyState(i),d(!1),s(o)}function y(){const T=o.getKeyState();c(T),d(!1)}function j(){d(!0),c(o.getDefaultKeyState())}return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"shortcut-item-container",children:[n.jsxs("label",{className:"shortcut-item-name",children:[o.name,o.tooltip!==void 0&&n.jsx(Tt,{children:o.tooltip})]}),n.jsxs("div",{className:"shortcut-item-input-container",children:[n.jsx("input",{className:F("form-control",{"is-invalid":h}),onKeyDown:g,onKeyUp:w,onFocus:v,onBlur:R,disabled:!o.isEditable,value:a,readOnly:!0}),!M.doKeyStatesMatch(i,o.getDefaultKeyState())&&!h&&n.jsx(S,{className:"reset-to-default-button",kind:"ghost",icon:n.jsx(x,{icon:H,transform:{rotate:90,flipX:!0}}),tooltip:"Reset to default",onClick:j})]})]}),l&&n.jsxs("div",{className:F("shortcut-item-message-container",{"is-invalid":h}),children:[n.jsx("div",{className:"shortcut-item-message",children:h}),n.jsxs("div",{className:"shortcut-item-message-buttons",children:[M.isValidKeyState(i)&&n.jsx(S,{kind:"ghost",onClick:E,children:"Confirm"}),n.jsx(S,{kind:"ghost",onClick:y,children:"Undo"})]})]})]})}function Fo({shortcutOverrides:o={},updateSettings:e}){const t=m.useCallback(i=>{const c=M.isMacPlatform,l={mac:{...o.mac},windows:{...o.windows}},d=c?l.mac:l.windows;i.forEach(h=>{h.isDefault()?delete d[h.id]:d[h.id]=h.getKeyState()}),e({shortcutOverrides:l})},[e,o]);let s=Array.from(Fe.shortcutsByCategory.entries()).map(([i,c])=>({name:i,shortcuts:c}));const a=s.findIndex(i=>i.name.toUpperCase()==="GLOBAL"),r=s.splice(a,1);return s=s.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."}),s.map(i=>n.jsx(Ro,{name:i.name,shortcuts:i.shortcuts,saveShortcutOverrides:t},i.name))]})}function Ro({name:o,shortcuts:e,saveShortcutOverrides:t}){function s(l){return l.split("_").map(d=>`${d[0].toUpperCase()}${d.slice(1).toLowerCase()}`).join(" ")}const[a,r]=m.useState(e);function i(l){const d=a.filter(u=>u!==l&&!u.isNull()&&u.matchesKeyState(l.getKeyState()));d.forEach(u=>u.setToNull());const h=[l,...d];t(h),r(u=>[...u])}const c=m.useMemo(()=>a.map(l=>l.getDisplayText()),[a]);return n.jsxs("div",{className:"mt-3",children:[n.jsx("div",{className:"font-weight-bold",children:s(o)}),a.map((l,d)=>n.jsx(Do,{shortcut:l,displayText:c[d],categoryName:o,onChange:i},l.id))]})}const Eo=o=>({shortcutOverrides:Sn(o)}),No={updateSettings:Re},jo=te(Eo,No)(Fo),Oo="yyyy-MM-dd-HHmmss";function Ut(o,e="root",t=new Map([[o,""]])){const s={};return Object.entries(o).forEach(([a,r])=>{try{JSON.stringify(r),s[a]=r}catch{const c=r;if(typeof r=="bigint")s[a]=r.toString();else if(t.has(c))s[a]=`Circular ref to ${t.get(c)}`;else{const l=`${e}.${a}`;t.set(c,l),s[a]=Ut(r,l,t)}}}),s}function Io(){const o=Nt.getState();return JSON.stringify(Ut(o),null,2)}function Lo(o){const e={uiVersion:"0.55.0",userAgent:navigator.userAgent,...o};return JSON.stringify(e,null,2)}async function Po(o=`${B.i18n.DateTimeFormat.format(Oo,new Date)}_support_logs`,e){const t=new vt,s=t.folder(o);s.file("console.txt",Ps.getFormattedHistory()),s.file("redux.json",Io()),s.file("metadata.json",Lo(e));const a=await t.generateAsync({type:"blob"}),r=document.createElement("a");r.href=URL.createObjectURL(a),r.download=`${o}.zip`,r.click()}const ko=[{value:D.dataType.DATETIME,label:"DateTime"},{value:D.dataType.DECIMAL,label:"Decimal"},{value:D.dataType.INT,label:"Integer"}];function Ao(){const o=ko.map(e=>n.jsx("option",{value:e.value,children:e.label},`key-columnType-${e.value}`));return n.jsxs(n.Fragment,{children:[n.jsx("option",{disabled:!0,value:"",children:"Select Type"},"key-columnType-placeholder"),o]})}class Ne extends m.PureComponent{static defaultProps={scrollTo:()=>{}};static inputDebounceTime=250;constructor(e){super(e),this.debouncedCommitChanges=De(this.commitChanges.bind(this),Ne.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:s,showTSeparator:a,timeZone:r}=e,i=t.map((c,l)=>({...c,id:l}));this.containerRef=J.createRef(),this.addFormatRuleButtonRef=J.createRef(),this.lastFormatRuleIndex=i.length,this.state={formatSettings:i,formatRulesChanged:!1,showTimeZone:s,showTSeparator:a,timeZone:r,timestampAtMenuOpen:new Date}}componentDidMount(){xe(this.containerRef.current)}componentWillUnmount(){this.debouncedCommitChanges.flush()}debouncedCommitChanges;containerRef;addFormatRuleButtonRef;lastFormatRuleIndex;isDuplicateRule(e){const{formatSettings:t}=this.state;return t.some(s=>s.id!==e.id&&s.columnName===e.columnName&&s.columnType===e.columnType)??!1}getAutoIncrementFormatRuleIndex(){const{lastFormatRuleIndex:e}=this;return this.lastFormatRuleIndex+=1,e}getCachedColumnTypeOptions=Te(()=>n.jsx(Ao,{}));getCachedDateTimeFormatOptions=Te((e,t,s,a=!1,r)=>{const{timestampAtMenuOpen:i}=this.state;return n.jsx(Mt,{timestamp:i,timeZone:e,showTimeZone:t,showTSeparator:s,isGlobalOptions:a,legacyGlobalFormat:r})});handleFormatRuleChange(e,t,s){this.setState(a=>{const{formatSettings:r}=a;Ve(r);const i=[...r];let c={};t==="columnType"&&(c={format:this.makeDefaultFormatterItemByType(s)});const l={...i[e],...c,[t]:s};return i[e]=l,{formatSettings:i}},()=>{this.debouncedCommitChanges()})}handleFormatRuleCreate(){this.setState(e=>{const{formatSettings:t}=e,s={columnType:D.dataType.DATETIME,columnName:"",format:{},id:this.getAutoIncrementFormatRuleIndex(),isNewRule:!0};return{formatSettings:[...t,s],formatRulesChanged:!0}})}handleFormatRuleDelete(e){this.setState(t=>{const{formatSettings:s}=t;return{formatSettings:s.filter((r,i)=>i!==e),formatRulesChanged:!0}},()=>{this.debouncedCommitChanges()})}handleFormatRuleEntered(e){this.scrollToFormatBlockBottom(),xe(e)}commitChanges(){const{formatSettings:e}=this.state,{dh:t}=this.props,s=e.filter(i=>yo(t,i)).map(So)??[],{updateSettings:a}=this.props;a({formatter:s})}scrollToFormatBlockBottom(){const{scrollTo:e}=this.props;e(0,(this.addFormatRuleButtonRef.current?.offsetHeight??0)+(this.addFormatRuleButtonRef.current?.offsetTop??0))}getRuleError(e){const{dh:t}=this.props,s={hasColumnNameError:!1,hasFormatError:!1,message:""},a=[];return e.isNewRule!==void 0&&e.isNewRule||(this.isDuplicateRule(e)&&(s.hasColumnNameError=!0,a.push("Duplicate column name/type combo.")),At(e.columnName)||(s.hasColumnNameError=!0,a.push("Column names must start with a letter or underscore and contain only alphanumeric characters or underscores.")),e.format.formatString!==void 0&&e.format.formatString.length===0?(s.hasFormatError=!0,a.push("Empty formatting rule.")):q(t,e.columnType,e.format)||(s.hasFormatError=!0,a.push("Invalid formatting rule.")),s.message=a.join(`
2
2
  `)),s}makeDefaultFormatterItemByType(e){switch(D.getNormalizedType(e)){case D.dataType.INT:{const{defaultIntegerFormatOptions:t}=this.props,{defaultFormatString:s}=t;return L.makeFormat("",s??L.DEFAULT_FORMAT_STRING,L.TYPE_GLOBAL,void 0)}case D.dataType.DECIMAL:{const{defaultDecimalFormatOptions:t}=this.props,{defaultFormatString:s}=t;return P.makeFormat("",s??P.DEFAULT_FORMAT_STRING,P.TYPE_GLOBAL,void 0)}default:return""}}renderFormatRule(e,t){const s=`input-${e}-columnName`,a=`input-${e}-columnType`,r=`input-${e}-format`,i=this.getCachedColumnTypeOptions(),c=u=>this.handleFormatRuleChange(e,"columnName",u.target.value),l=()=>this.handleFormatRuleChange(e,"isNewRule",!1),d=u=>this.handleFormatRuleChange(e,"columnType",u),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:s,children:"Column Name"}),n.jsx("input",{id:s,className:F("form-control",{"is-invalid":h.hasColumnNameError}),"data-lpignore":!0,type:"text",value:t.columnName,onChange:c,onBlur:l})]}),n.jsxs("div",{className:"form-group col mb-2",children:[n.jsx(S,{kind:"ghost",className:"btn-delete-format-rule float-right",tabIndex:-1,onClick:()=>this.handleFormatRuleDelete(e),icon:ks,tooltip:"Delete","aria-label":"Delete Format Rule"}),n.jsx("label",{htmlFor:a,children:"Column Type"}),n.jsx(de,{id:a,className:"custom-select",value:t.columnType,onChange:d,children:i})]})]}),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:r,children:"Formatting Rule"}),this.renderFormatRuleInput(e,t.columnType,r,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,s,a,r){switch(D.getNormalizedType(t)){case D.dataType.DATETIME:return this.renderDateTimeFormatRuleInput(e,s,a,r);case D.dataType.DECIMAL:return this.renderDecimalFormatRuleInput(e,s,a,r);case D.dataType.INT:return this.renderIntegerFormatRuleInput(e,s,a,r);default:throw new Error(`Unrecognized column type: ${t}`)}}renderDateTimeFormatRuleInput(e,t,s,a){const{showTimeZone:r,showTSeparator:i,timeZone:c}=this.state,l=s.formatString??"";return n.jsxs(de,{className:F("custom-select",{"is-invalid":a}),value:l,id:t,onChange:d=>{const h=W.makeFormat("",d,W.TYPE_GLOBAL);this.handleFormatRuleChange(e,"format",h)},children:[n.jsx("option",{value:"",disabled:!0,children:"Select format"},"default"),this.getCachedDateTimeFormatOptions(c,r,i)]})}renderIntegerFormatRuleInput(e,t,s,a){const{defaultIntegerFormatOptions:r}=this.props;Ve(r);const{defaultFormatString:i}=r,c=s.formatString??"";return n.jsx("input",{className:F("form-control","flex-grow-1",{"is-invalid":a}),"data-lpignore":!0,id:t,placeholder:i??L.DEFAULT_FORMAT_STRING,type:"text",value:c,onChange:l=>{const d=L.makeFormat("",l.target.value,L.TYPE_GLOBAL,void 0);this.handleFormatRuleChange(e,"format",d)}})}renderDecimalFormatRuleInput(e,t,s,a){const{defaultDecimalFormatOptions:r}=this.props,{defaultFormatString:i}=r,c=s.formatString??"";return n.jsx("input",{className:F("form-control","flex-grow-1",{"is-invalid":a}),"data-lpignore":!0,id:t,placeholder:i??P.DEFAULT_FORMAT_STRING,type:"text",value:c,onChange:l=>{const d=P.makeFormat("",l.target.value,P.TYPE_GLOBAL,void 0);this.handleFormatRuleChange(e,"format",d)}})}render(){const{formatRulesChanged:e,formatSettings:t}=this.state,s=t.map((r,i)=>n.jsx(St,{classNames:"fade",timeout:ie.transitionMs,onEnter:this.handleFormatRuleEntered,children:this.renderFormatRule(i,r)},r.id)),a=n.jsx(S,{kind:"ghost",className:"mb-3",onClick:this.handleFormatRuleCreate,ref:this.addFormatRuleButtonRef,icon:As,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(Jt,{appear:e,enter:e,exit:e,children:s}),a]})}}const Mo=o=>({formatter:yn(o),defaultDecimalFormatOptions:wt(o),defaultIntegerFormatOptions:xt(o),dh:Dt(o),showTimeZone:Ft(o),showTSeparator:Rt(o),timeZone:Et(o)}),Uo=te(Mo,{updateSettings:Re})(Ne);class U extends m.Component{static defaultProps={onDone:()=>{}};static FORMATTING_SECTION_KEY="SettingsMenu.formatting";static COLUMN_SPECIFIC_SECTION_KEY="SettingsMenu.columnFormatting";static APPLICATION_SECTION_KEY="ApplicationMenu.settings";static SHORTCUT_SECTION_KEY="SettingsMenu.shortcuts";static focusFirstInputInContainer(e){const t=e?.querySelector("input, select, textarea");t&&t.focus()}constructor(e){super(e),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=J.createRef(),this.broadcastChannel=new BroadcastChannel(on),this.state={expandedSectionKey:U.FORMATTING_SECTION_KEY}}componentDidMount(){U.focusFirstInputInContainer(this.menuContentRef.current)}componentWillUnmount(){this.broadcastChannel.close()}menuContentRef;broadcastChannel;isSectionExpanded(e){const{expandedSectionKey:t}=this.state;return t===e}handleLogout(){this.broadcastChannel.postMessage(an(rn))}handleScrollTo(e,t){this.menuContentRef.current?.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}=this.props;Po(void 0,Object.fromEntries(e))}render(){const e="0.55.0",t="https://github.com/deephaven/web-client-ui/",s="https://deephaven.io/core/docs/",{serverConfigValues:a,user:r}=this.props,i=a.get("barrage.version"),c=a.get("java.version"),l=a.get("deephaven.version"),d=(w,v)=>n.jsxs(n.Fragment,{children:[n.jsx("div",{children:w}),n.jsx("div",{children:v})]}),h=r.displayName??r.name,u=r.image!=null&&r.image!=="",g=h!=="";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:[!u&&n.jsx(x,{icon:Ms,transform:"grow-8"}),u&&n.jsx("img",{src:r.image,alt:h})]}),n.jsxs("div",{className:"user-details",children:[g&&n.jsxs("div",{className:"user-name",children:[h,r.operateAs!=null&&r.name!==r.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(x,{icon:Us,className:"mr-1"}),r.operateAs]})]})]}),r.permissions.canLogout&&n.jsx("button",{type:"button",className:"btn btn-link",onClick:this.handleLogout,children:"logout"})]})]}),n.jsx(S,{kind:"ghost",className:"btn-close-settings-menu",onClick:this.handleClose,icon:n.jsx(x,{icon:_s,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(ee,{sectionKey:U.FORMATTING_SECTION_KEY,isExpanded:this.isSectionExpanded(U.FORMATTING_SECTION_KEY),title:n.jsxs(n.Fragment,{children:[n.jsx(x,{icon:$s,transform:"grow-4",className:"mr-2"}),"Default Format & Time zone"]}),onToggle:this.handleSectionToggle,children:n.jsx(wo,{})}),n.jsx(ee,{sectionKey:U.COLUMN_SPECIFIC_SECTION_KEY,isExpanded:this.isSectionExpanded(U.COLUMN_SPECIFIC_SECTION_KEY),title:n.jsxs(n.Fragment,{children:[n.jsx(x,{icon:Ks,transform:"grow-4",className:"mr-2"}),"Format by Column Name & Type"]}),onToggle:this.handleSectionToggle,children:n.jsx(Uo,{scrollTo:this.handleScrollTo})}),n.jsx(ee,{sectionKey:U.SHORTCUT_SECTION_KEY,isExpanded:this.isSectionExpanded(U.SHORTCUT_SECTION_KEY),title:n.jsxs(n.Fragment,{children:[n.jsx(x,{icon:Ws,transform:"grow-2"})," ","Keyboard Shortcuts"]}),onToggle:this.handleSectionToggle,children:n.jsx(jo,{})}),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:t,className:"custom-link",target:"_blank",rel:"noopener noreferrer",children:t})]}),n.jsx(S,{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:s,className:"custom-link",children:s})]}),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:[l," ",n.jsx(x,{icon:Bs}),n.jsxs(Tt,{interactive:!0,children:[n.jsxs("div",{className:"detailed-server-config",children:[d("Engine Version",l),d("Web UI Version",e),d("Java Version",c),d("Barrage Version",i)]}),n.jsx(us,{tooltip:"Copy version numbers",copy:`Engine Version: ${l}
3
3
  Web UI Version: ${e}
4
4
  Java Version: ${c}
5
- Barrage Version: ${i}`,children:"Copy Versions"})]})]})]}),n.jsx("div",{className:"app-settings-footer-item",children:n.jsx(xo,{})})]}),n.jsx("div",{className:"app-settings-footer-section",children:n.jsx("div",{className:"logo",children:n.jsx("a",{target:"_blank",rel:"noreferrer noopener",href:"https://deephaven.io",className:"d-inline-block custom-link p-1",children:n.jsx("img",{src:Pt,alt:"Deephaven Data Labs",width:"230px"})})})})]})]})]})}}const mt=10;function z(o){const{forwardedProps:{menuItem:{action:e,title:t,disabled:s},iconElement:a,displayShortcut:r,isMouseSelected:i,isKeyboardSelected:c,closeMenu:l}}=o,d=m.useRef(),h=m.useRef(),u=m.useRef(null),[g,w]=m.useState(!1),v=m.useCallback(y=>{d.current!=null&&h.current!=null&&u.current&&(Math.abs(d.current-y.clientX)>=mt||Math.abs(h.current-y.clientY)>=mt)&&(w(!0),window.removeEventListener("mousemove",v),l(),e(y),u.current=null)},[e,l]);function R(y){d.current=y.clientX,h.current=y.clientY,u.current=y.target,window.addEventListener("mousemove",v)}function E(y){u.current===y.target&&(w(!0),l(),e(),window.removeEventListener("mousemove",v)),u.current=null}return m.useEffect(function(){return function(){return window.removeEventListener("mousemove",v)}},[v]),n.jsxs("button",{type:"button",className:F("btn-context-menu",{disabled:s},{active:i&&!s},{"keyboard-active":c&&!s}),onMouseDown:R,onMouseUp:E,disabled:g,children:[n.jsx("span",{className:F("icon"),children:a}),n.jsx("span",{className:"title",children:t}),n.jsx("span",{className:"shortcut",children:r})]})}function je(o){const{handleControlSelect:e,handleToolSelect:t,onClearFilter:s}=o,a=m.useMemo(()=>[{title:"Input Filter",icon:Gs,menuElement:n.jsx(z,{}),action:r=>{e(G.INPUT_FILTER,r)},order:10},{title:"Dropdown Filter",icon:Vs,menuElement:n.jsx(z,{}),action:r=>{e(G.DROPDOWN_FILTER,r)},order:15},{title:"Markdown Widget",icon:Zs,menuElement:n.jsx(z,{}),action:r=>{e(G.MARKDOWN,r)},order:20},{title:"Filter Sets",icon:Hs,menuElement:n.jsx(z,{}),action:r=>{e(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:qs,action:()=>{t(ue.LINKER)},order:40,shortcut:Ce.LINKER},{disabled:!0,menuElement:n.jsx("div",{className:"context-menu-group-header",children:"Actions"}),order:50},{title:"Clear All Filters",icon:zs,action:()=>{s()},order:60,shortcut:Ct.TABLE.CLEAR_ALL_FILTERS}],[e,t,s]);return n.jsx(hs,{popperClassName:"controls-menu-popper",actions:a})}je.propTypes={handleControlSelect:f.func,handleToolSelect:f.func,onClearFilter:f.func};je.defaultProps={handleControlSelect:()=>{},handleToolSelect:()=>{},onClearFilter:()=>{}};z.propTypes={forwardedProps:f.shape({iconElement:f.node,displayShortcut:f.string,isMouseSelected:f.bool.isRequired,isKeyboardSelected:f.bool.isRequired,closeMenu:f.func.isRequired,menuItem:f.shape({action:f.func,title:f.string,disabled:f.bool}).isRequired})};z.defaultProps={forwardedProps:null};const _o=Tn(Lt,null),$o={layoutStorage:_o},Ko=o=>o.layoutStorage,Wo=o=>o.serverConfigValues;Object.entries($o).map(([o,e])=>ms.register(o,e));const pt=10;function Bo(o){const{onExportLayout:e,onImportLayout:t,onResetLayout:s,onSelect:a,widgets:r=[]}=o,[i,c]=m.useState(!1),[l,d]=m.useState(""),h=m.useRef(null),u=m.useRef(),g=m.useCallback((p,b)=>{p!=null&&a(p,b)},[a]),w=m.useCallback(p=>{d(p.target.value)},[]),v=m.useCallback(p=>{u.current!=null&&(Math.abs(u.current.x-p.clientX)>=pt||Math.abs(u.current.y-p.clientY)>=pt)&&(c(!0),window.removeEventListener("mousemove",v),g(u.current.widget,p),u.current=void 0)},[u,g]),R=m.useCallback((p,b)=>{u.current={x:p.clientX,y:p.clientY,widget:b},window.addEventListener("mousemove",v)},[v]),E=m.useCallback((p,b)=>{window.removeEventListener("mousemove",v),u.current?.widget===b&&(c(!0),g(b)),u.current=void 0},[v,u,g]),y=m.useMemo(()=>r.filter(p=>l?p.name?.toLowerCase().includes(l.toLowerCase()):!0),[l,r]).sort((p,b)=>p.name?.localeCompare(b.name??"")??0),j=m.useMemo(()=>y.map(p=>n.jsx("li",{children:n.jsxs(S,{kind:"ghost","data-testid":`panel-list-item-${p.name??""}-button`,onMouseDown:b=>{R(b,p)},onMouseUp:b=>{E(b,p)},onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&g(p)},disabled:i,onClick:()=>{},children:[n.jsx(Cn,{type:p.type})," ",p.name??""]})},p.name)),[y,i,R,E,g]),T=m.useMemo(()=>j.length===0?n.jsx("span",{children:"No bound variables found."}):null,[j]);return n.jsxs("div",{className:"widget-list-container d-flex flex-column",children:[n.jsx("div",{className:"widget-list-header",children:n.jsx(ps,{value:l,placeholder:"Find Table, Plot or Widget",onChange:w,ref:h})}),n.jsxs("ul",{className:"widget-list flex-grow-1",children:[T&&n.jsx("li",{className:"widget-list-message",children:T}),!T&&j]}),n.jsx("div",{children:n.jsx("hr",{})}),n.jsxs("div",{className:"widget-list-footer",children:[n.jsxs(S,{kind:"ghost",onClick:e,children:[n.jsxs("div",{className:"fa-md fa-layers",children:[n.jsx(x,{mask:Ze,icon:He,transform:"right-5 down-5"}),n.jsx(x,{icon:He,transform:"right-8 down-6"})]}),"Export Layout"]}),n.jsxs(S,{kind:"ghost",onClick:t,children:[n.jsxs("div",{className:"fa-md fa-layers",children:[n.jsx(x,{mask:Ze,icon:qe,transform:"right-5 down-5"}),n.jsx(x,{icon:qe,transform:"right-8 down-6"})]}),"Import Layout"]}),n.jsx(S,{kind:"ghost",icon:H,onClick:s,tooltip:"Reset Layout"})]})]})}function Go({onAutoFillClick:o=()=>{}}){return n.jsxs("div",{className:"empty-dashboard-container",children:[n.jsxs("div",{className:"hint-container",children:[n.jsx(x,{icon:Ys})," ",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(S,{kind:"tertiary",onClick:o,children:"Auto fill objects"})]})]})}function Vo(o){return o.version===2}function Zo(o){return Array.isArray(o)}const re=k.module("UserLayoutUtils"),Ho={layoutConfig:[{type:"column",content:[{type:"row",height:40,content:[{type:"stack",content:[{type:"react-component",component:Ye.COMPONENT,title:Ye.TITLE,isClosable:!1},{type:"react-component",component:Je.COMPONENT,title:Je.TITLE,isClosable:!1}]},{type:"stack",width:25,content:[{type:"react-component",component:Xe.COMPONENT,title:Xe.TITLE,isClosable:!1},{type:"react-component",component:Qe.COMPONENT,title:Qe.TITLE,isClosable:!1}]}]},{type:"row",content:[{type:"stack",title:"Notebooks",content:[]}]}]}],links:[],filterSets:[],version:2},qo={layoutConfig:[],links:[],filterSets:[],version:2};function _t(o){if(Vo(o))return o;if(Zo(o))return{layoutConfig:o,links:[],filterSets:[],version:2};throw new Error(`Unexpected layout import format: ${o}`)}async function zo(o,e=!0){try{const t=await o.getLayouts();if(t.length>0)try{const s=await o.getLayout(t[0]);return _t(s)}catch(s){re.error("Unable to load layout",t[0],":",s),re.warn("No valid layouts found, falling back to default layout")}}catch(t){re.error("Unable to fetch layout list",t),re.warn("Falling back to default layout")}return e?Ho:qo}function Yo(o){const{filterSets:e,layoutConfig:t,links:s}=o;return{filterSets:e,layoutConfig:t,links:s,version:2}}const le={exportLayout:Yo,getDefaultLayout:zo,normalizeLayout:_t},C=k.module("AppMainContainer");class Y extends m.Component{static handleWindowBeforeUnload(e){e.preventDefault(),e.returnValue=""}static hydrateConsole(e,t){return We.hydrate({...e,unzip:s=>vt.loadAsync(s).then(a=>Object.values(a.files))},t)}static handleRefresh(){C.info("Refreshing application"),window.location.reload()}constructor(e){super(e),bs(this),this.importElement=J.createRef(),this.state={contextActions:[{action:()=>{this.handleToolSelect(ue.LINKER)},shortcut:Ce.LINKER,isGlobal:!0},{action:()=>{this.sendClearFilter()},shortcut:Ct.TABLE.CLEAR_ALL_FILTERS,isGlobal:!0},{action:()=>{C.debug("Consume unhandled save shortcut")},shortcut:Ce.SAVE,isGlobal:!0}],isAuthFailed:!1,isDisconnected:!1,isPanelsMenuShown:!1,isResetLayoutPromptShown:!1,isSettingsMenuShown:!1,unsavedNotebookCount:0,widgets:[]}}componentDidMount(){this.initWidgets(),this.startListeningForDisconnect(),window.addEventListener("beforeunload",Y.handleWindowBeforeUnload)}componentDidUpdate(e){const{dashboardData:t}=this.props;e.dashboardData!==t&&this.handleDataChange(t)}componentWillUnmount(){this.deinitWidgets(),this.stopListeningForDisconnect(),window.removeEventListener("beforeunload",Y.handleWindowBeforeUnload)}goldenLayout;importElement;widgetListenerRemover;initWidgets(){const{connection:e}=this.props;if(e.subscribeToFieldUpdates==null){C.warn("subscribeToFieldUpdates not supported, not initializing widgets");return}this.widgetListenerRemover=e.subscribeToFieldUpdates(t=>{C.debug("Got updates",t),this.setState(({widgets:s})=>{const{updated:a,created:r,removed:i}=t,c=[...a,...i],l=s.filter(h=>!c.some(u=>u.name===h.name));return[...a,...r].forEach(h=>{h.name!=null&&h.name!==""&&l.push(h)}),{widgets:l}})})}deinitWidgets(){this.widgetListenerRemover?.()}openNotebookFromURL(){const{match:e}=this.props,{notebookPath:t}=e.params;if(t){const{session:s,sessionConfig:a}=this.props;if(s==null||a==null){C.error("No session available to open notebook URL",t);return}const r={id:`/${t}`,itemName:`/${t}`},i=a.type,c={value:null,language:i};this.emitLayoutEvent(En.SELECT_NOTEBOOK,s,i,c,r,!0)}}sendClearFilter(){this.emitLayoutEvent(oe.CLEAR_ALL_FILTERS)}emitLayoutEvent(e,...t){this.goldenLayout?.eventHub.emit(e,...t)}handleCancelResetLayoutPrompt(){this.setState({isResetLayoutPromptShown:!1})}handleConfirmResetLayoutPrompt(){this.setState({isResetLayoutPromptShown:!1}),this.resetLayout()}handleError(e){K.isCanceled(e)||C.error(e)}handleSettingsMenuHide(){this.setState({isSettingsMenuShown:!1})}handleSettingsMenuShow(){this.setState({isSettingsMenuShown:!0})}handleControlSelect(e,t){switch(C.debug("handleControlSelect",e),e){case G.DROPDOWN_FILTER:this.emitLayoutEvent(oe.OPEN_DROPDOWN,{title:"DropdownFilter",type:e,createNewStack:!0,dragEvent:t});break;case G.INPUT_FILTER:this.emitLayoutEvent(oe.OPEN_INPUT,{title:"InputFilter",type:e,createNewStack:!0,dragEvent:t});break;case G.MARKDOWN:this.emitLayoutEvent(Nn.OPEN,{title:"Markdown",type:e,dragEvent:t});break;case G.FILTER_SET_MANAGER:this.emitLayoutEvent(oe.OPEN_FILTER_SET_MANAGER,{title:"FilterSets",type:e,dragEvent:t});break;default:throw new Error(`Unrecognized control type ${e}`)}}handleToolSelect(e){C.debug("handleToolSelect",e);const{activeTool:t,setActiveTool:s}=this.props;s(t===e?ue.DEFAULT:e)}handleClearFilter(){this.sendClearFilter()}handleDataChange(e){const{updateWorkspaceData:t}=this.props,{closed:s,filterSets:a,links:r}=e;t({closed:s,filterSets:a,links:r})}handleGoldenLayoutChange(e){this.goldenLayout=e}handleLayoutConfigChange(e){const{updateWorkspaceData:t}=this.props;t({layoutConfig:e})}handleWidgetMenuClick(){this.setState(({isPanelsMenuShown:e})=>({isPanelsMenuShown:!e}))}handleWidgetSelect(e,t){this.setState({isPanelsMenuShown:!1}),C.debug("handleWidgetSelect",e,t),this.openWidget(e,t)}handleWidgetsMenuClose(){this.setState({isPanelsMenuShown:!1})}handleAutoFillClick(){const{widgets:e}=this.state;C.debug("handleAutoFillClick",e);const t=e.sort((s,a)=>s.title!=null&&a.title!=null?s.title.localeCompare(a.title):0);for(let s=0;s<t.length;s+=1)this.openWidget(t[s])}handleExportLayoutClick(){C.info("handleExportLayoutClick"),this.setState({isPanelsMenuShown:!1});try{const{workspace:e}=this.props,{data:t}=e,s=le.exportLayout(t);C.info("handleExportLayoutClick exportedConfig",s);const a=new Blob([JSON.stringify(s)],{type:"application/json"}),r=B.i18n.DateTimeFormat.format("yyyy-MM-dd-HHmmss",new Date),i=document.createElement("a");i.href=URL.createObjectURL(a),i.download=`deephaven-app-layout-${r}.json`,i.click()}catch(e){C.error("Unable to export layout",e)}}handleImportLayoutClick(){C.info("handleImportLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.importElement.current!=null&&(this.importElement.current.value="",this.importElement.current.click())}handleResetLayoutClick(){C.info("handleResetLayoutClick"),this.setState({isPanelsMenuShown:!1,isResetLayoutPromptShown:!0,unsavedNotebookCount:jn.unsavedNotebookCount()})}handleImportLayoutFiles(e){e.stopPropagation(),e.preventDefault(),e.target.files!=null&&this.importLayoutFile(e.target.files?.[0])}handleDisconnect(){C.info("Disconnected from server"),this.setState({isDisconnected:!0})}handleReconnect(){C.info("Reconnected to server"),this.setState({isDisconnected:!1})}handleReconnectAuthFailed(){C.warn("Reconnect authentication failed"),this.setState({isAuthFailed:!0})}async importLayoutFile(e){try{const{updateDashboardData:t,updateWorkspaceData:s}=this.props,a=await e.text(),r=JSON.parse(a),{filterSets:i,layoutConfig:c,links:l}=le.normalizeLayout(r);s({layoutConfig:c}),t(_,{filterSets:i,links:l})}catch(t){C.error("Unable to import layout",t)}}async resetLayout(){const{layoutStorage:e,session:t}=this.props,{filterSets:s,layoutConfig:a,links:r}=await le.getDefaultLayout(e,t!==void 0),{updateDashboardData:i,updateWorkspaceData:c}=this.props;c({layoutConfig:a}),i(_,{filterSets:s,links:r})}handlePaste(e){if(e.target instanceof HTMLElement&&e.target.closest(".monaco-editor"))return;const{clipboardData:t}=e,s=t.getData("Text"),a=/“|”/g;a.test(s)&&(e.preventDefault(),e.stopPropagation(),document.execCommand("insertText",!1,s.replace(a,'"')))}startListeningForDisconnect(){const{connection:e}=this.props;e.addEventListener(B.IdeConnection.EVENT_DISCONNECT,this.handleDisconnect),e.addEventListener(B.IdeConnection.EVENT_RECONNECT,this.handleReconnect),e.addEventListener(B.CoreClient.EVENT_RECONNECT_AUTH_FAILED,this.handleReconnectAuthFailed)}stopListeningForDisconnect(){const{connection:e}=this.props;e.removeEventListener(B.IdeConnection.EVENT_DISCONNECT,this.handleDisconnect),e.removeEventListener(B.IdeConnection.EVENT_RECONNECT,this.handleReconnect),e.removeEventListener(B.CoreClient.EVENT_RECONNECT_AUTH_FAILED,this.handleReconnectAuthFailed)}hydrateDefault(e,t){const{connection:s}=this.props,{metadata:a}=e;if(a?.type!=null&&(a?.id!=null||a?.name!=null)){const r=a.id!=null?{type:a.type,id:a.id}:{type:a.type,name:a.name,title:a.name};return{fetch:()=>s.getObject(r),...e,localDashboardId:t}}return We.hydrate(e,t)}openWidget(e,t){const{connection:s}=this.props;this.emitLayoutEvent(vs.OPEN,{dragEvent:t,fetch:()=>s.getObject(e),widget:e})}getDashboardPlugins=Qt(e=>[...e.entries()].filter(([,s])=>Ts(s)||Ge(s)).map(([s,a])=>{if(Ge(a)){const{DashboardPlugin:i}=a;return n.jsx(i,{},s)}const{component:r}=a;return n.jsx(r,{},s)}));render(){const{activeTool:e,plugins:t,user:s,workspace:a,serverConfigValues:r}=this.props,{data:i}=a,{layoutConfig:c}=i,{permissions:l}=s,{canUsePanels:d}=l,{contextActions:h,isAuthFailed:u,isDisconnected:g,isPanelsMenuShown:w,isResetLayoutPromptShown:v,isSettingsMenuShown:R,unsavedNotebookCount:E,widgets:y}=this.state,j=this.getDashboardPlugins(t);return n.jsxs("div",{className:F("app-main-tabs","w-100","h-100","d-flex","flex-column",e?`active-tool-${e.toLowerCase()}`:""),onPaste:this.handlePaste,tabIndex:-1,children:[n.jsx("nav",{className:"nav-container",children:n.jsxs("div",{className:"app-main-top-nav-menus",children:[n.jsx("img",{src:Pt,alt:"Deephaven Data Labs",width:"115px",className:"ml-1"}),n.jsxs("div",{children:[n.jsxs(S,{kind:"ghost",className:"btn-panels-menu",icon:Js,onClick:()=>{},children:["Controls",n.jsx(je,{handleControlSelect:this.handleControlSelect,handleToolSelect:this.handleToolSelect,onClearFilter:this.handleClearFilter})]}),d&&n.jsxs(S,{kind:"ghost",className:"btn-panels-menu btn-show-panels","data-testid":"app-main-panels-button",onClick:this.handleWidgetMenuClick,icon:Xs,children:["Panels",n.jsx(Ss,{isShown:w,className:"panels-menu-popper",onExited:this.handleWidgetsMenuClose,options:{placement:"bottom"},closeOnBlur:!0,interactive:!0,children:n.jsx(Bo,{widgets:y,onExportLayout:this.handleExportLayoutClick,onImportLayout:this.handleImportLayoutClick,onResetLayout:this.handleResetLayoutClick,onSelect:this.handleWidgetSelect})})]}),n.jsx(S,{kind:"ghost",className:F("btn-settings-menu",{"text-warning":s.operateAs!=null&&s.operateAs!==s.name}),onClick:this.handleSettingsMenuShow,icon:n.jsxs("span",{className:"fa-layers",children:[n.jsx(x,{icon:Qs,transform:"grow-3 right-1 down-1"}),g&&!u&&n.jsxs(n.Fragment,{children:[n.jsx(x,{icon:en,color:ie.background,transform:"grow-2 right-8 down-8.5 rotate-45"}),n.jsx(x,{icon:ze,color:ie.danger,transform:"shrink-5 right-6 down-6"})]})]}),tooltip:g&&!u?"Server disconnected":"User Settings"})]})]})}),n.jsxs(ln,{emptyDashboard:n.jsx(Go,{onAutoFillClick:this.handleAutoFillClick}),id:_,layoutConfig:c,onGoldenLayoutChange:this.handleGoldenLayoutChange,onLayoutConfigChange:this.handleLayoutConfigChange,onLayoutInitialized:this.openNotebookFromURL,hydrate:this.hydrateDefault,children:[n.jsx(On,{hydrateConsole:Y.hydrateConsole,notebooksUrl:new URL("notebooks/",document.baseURI).href}),j]}),n.jsx(St,{in:R,timeout:ie.transitionMidMs,classNames:"slide-left",mountOnEnter:!0,unmountOnExit:!0,children:n.jsx(U,{serverConfigValues:r,onDone:this.handleSettingsMenuHide,user:s})}),n.jsx(ys,{actions:h}),n.jsx("input",{ref:this.importElement,type:"file",accept:".json",style:{display:"none"},onChange:this.handleImportLayoutFiles}),n.jsx(cn,{isOpen:g&&!u,debounceMs:1e3,children:n.jsx(dn,{icon:ze,title:n.jsxs(n.Fragment,{children:[n.jsx(tn,{})," Attempting to reconnect..."]}),subtitle:"Please check your network connection."})}),n.jsx(Be,{confirmButtonText:"Reset",onConfirm:this.handleConfirmResetLayoutPrompt,onCancel:this.handleCancelResetLayoutPrompt,isConfirmDanger:!0,isOpen:v,headerText:E===0?"Reset Layout":"Reset layout and discard unsaved changes",bodyText:E===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."}),n.jsx(Be,{confirmButtonText:"Refresh",onConfirm:Y.handleRefresh,isOpen:u,headerText:"Authentication failed",bodyText:"Credentials are invalid. Please refresh your browser to try and reconnect."})]})}}const Jo=o=>({activeTool:xn(o),dashboardData:gs(o,_),layoutStorage:Ko(o),plugins:Dn(o),connection:Fn(o,_),session:et(o,_)?.session,sessionConfig:et(o,_)?.config,user:Rn(o),workspace:Ot(o),serverConfigValues:Wo(o)}),Xo=te(Jo,{setActiveTool:jt,updateDashboardData:fs,updateWorkspaceData:wn})(Xt(Y));function Qo(){return n.jsxs("div",{className:"app",children:[n.jsx(Xo,{}),n.jsx(Cs,{})]})}const ea=k.module("LocalWorkspaceStorage");class I{static STORAGE_KEY="deephaven.WorkspaceStorage";static getBooleanServerConfig(e,t){if(e?.get(t)?.toLowerCase()==="true")return!0;if(e?.get(t)?.toLowerCase()==="false")return!1}static makeDefaultWorkspaceSettings(e){const t={defaultDateTimeFormat:W.DEFAULT_DATETIME_FORMAT_STRING,formatter:[],timeZone:W.DEFAULT_TIME_ZONE_ID,showTimeZone:!1,showTSeparator:!0,disableMoveConfirmation:!1,defaultDecimalFormatOptions:{defaultFormatString:P.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:L.DEFAULT_FORMAT_STRING},truncateNumbersWithPound:!1,defaultNotebookSettings:{isMinimapEnabled:!1}},s={defaultDateTimeFormat:e?.get("dateTimeFormat"),formatter:[],timeZone:e?.get("timeZone"),showTimeZone:I.getBooleanServerConfig(e,"showTimeZone"),showTSeparator:I.getBooleanServerConfig(e,"showTSeparator"),disableMoveConfirmation:I.getBooleanServerConfig(e,"disableMoveConfirmation"),defaultDecimalFormatOptions:e?.get("decimalFormat")!==void 0?{defaultFormatString:e?.get("decimalFormat")}:void 0,defaultIntegerFormatOptions:e?.get("integerFormat")!==void 0?{defaultFormatString:e?.get("integerFormat")}:void 0,truncateNumbersWithPound:I.getBooleanServerConfig(e,"truncateNumbersWithPound"),defaultNotebookSettings:e?.get("isMinimapEnabled")!==void 0?{isMinimapEnabled:I.getBooleanServerConfig(e,"isMinimapEnabled")}:void 0},a=Object.keys(s);for(let r=0;r<a.length;r+=1){const i=a[r];s[i]!==void 0&&(t[i]=s[i])}return t}static async makeWorkspaceData(e,t){const{filterSets:s,links:a,layoutConfig:r}=await le.getDefaultLayout(e,t?.isConsoleAvailable);return{settings:{},layoutConfig:r,closed:[{}],links:a,filterSets:s}}static async makeDefaultWorkspace(e,t){return{data:await I.makeWorkspaceData(e,t)}}layoutStorage;constructor(e){this.layoutStorage=e}async load(e){try{return JSON.parse(localStorage.getItem(I.STORAGE_KEY)??"")}catch{return ea.info("Unable to load workspace data, initializing to default data"),I.makeDefaultWorkspace(this.layoutStorage,e)}}async save(e){return localStorage.setItem(I.STORAGE_KEY,JSON.stringify(e)),e}}class ta{storageService;root;constructor(e,t=""){this.storageService=e,this.root=t}async getLayouts(){return(await this.storageService.listItems(this.root,"*.json")).map(t=>t.basename)}async getLayout(e){const s=await(await this.storageService.loadFile(`${this.root}/${e}`)).text();return JSON.parse(s)}}const Q=k.module("GrpcFileStorageTable");class he{static REFRESH_DEBOUNCE=50;storageService;baseRoot;root;currentSize=0;currentViewport;listeners=[];viewportUpdatePromise;currentViewportData;childTables=new Map;constructor(e,t="",s=t){this.storageService=e,this.baseRoot=t,this.root=s,s===t&&(this.doRefresh=De(this.doRefresh.bind(this),he.REFRESH_DEBOUNCE))}removeBaseRoot(e){return Z.removeRoot(this.baseRoot,e)}getViewportData(){return this.viewportUpdatePromise||this.refreshInternal(),this.viewportUpdatePromise??Promise.resolve({items:[],offset:0})}getSnapshot(e){throw new Error("Method not implemented.")}get size(){return this.currentSize}setExpanded(e,t){const s=e.split("/");let a=s.shift();if((a===void 0||a==="")&&(a=s.shift()),a===void 0||a==="")throw new Error(`Invalid path: ${e}`);const r=s.join("/");if(t){if(!this.childTables.has(a)){const i=new he(this.storageService,this.baseRoot,`${this.root}/${a}`);this.childTables.set(a,i)}r&&this.childTables.get(a)?.setExpanded(r,t)}else this.childTables.has(a)&&(r?this.childTables.get(a)?.setExpanded(r,t):this.childTables.delete(a));this.currentViewport&&this.refreshInternal()}collapseAll(){this.childTables.clear(),this.currentViewport&&this.refreshInternal()}setSearch(e){throw new Error("Method not implemented.")}setViewport(e){this.currentViewport=e,this.refreshInternal()}setFilters(){throw new Error("Method not implemented.")}setSorts(){throw new Error("Method not implemented.")}setReversed(){throw new Error("Method not implemented.")}close(){this.listeners=[]}onUpdate(e){return this.listeners=[...this.listeners,e],()=>{this.listeners=this.listeners.filter(t=>t!==e)}}doRefresh(e){Q.debug2("doRefresh",this.root),e(this.fetchData())}refresh(){Q.debug2("refresh",this.root),this.viewportUpdatePromise?.cancel();const e=new Promise(s=>{this.doRefresh(s)}),t=K.makeCancelable(e.then(s=>{if(this.viewportUpdatePromise!==t)throw new ws;return this.currentViewportData=s,this.sendUpdate(),s}));t.catch(s=>{K.isCanceled(s)||Q.error("Error updating viewport",s)}),this.viewportUpdatePromise=t}refreshInternal(){try{this.refresh()}catch(e){K.isCanceled(e)||Q.error("Unable to refresh data",e)}}async fetchData(){const{currentViewport:e}=this;if(!e)throw new Error("No viewport set");let s=(await this.storageService.listItems(this.root)).map(a=>({type:a.type,filename:this.removeBaseRoot(a.filename),basename:a.basename,id:this.removeBaseRoot(a.filename),isExpanded:a.type==="directory"?this.childTables.has(a.basename):void 0})).sort((a,r)=>a.type!==r.type?a.type==="directory"?-1:1:a.basename.localeCompare(r.basename));for(let a=0;a<s.length;a+=1){const r=s[a],{basename:i,filename:c}=r;if(c===this.removeBaseRoot(`${this.root}/${i}`)&&r.type==="directory"){const l=this.childTables.get(i);if(l!=null){l.setViewport({top:0,bottom:e.bottom-a});const d=await l.getViewportData();s.splice(a+1,0,...d.items)}}}return this.currentSize=s.length,Q.debug2(this.root,"items",s,e),s=s.slice(e.top,e.bottom),{items:s,offset:e.top}}sendUpdate(){const{listeners:e}=this,t=this.currentViewportData??{items:[],offset:0};for(let s=0;s<e.length;s+=1)e[s](t)}}const sa=k.module("GrpcFileStorage");class Oe{static REFRESH_THROTTLE=150;storageService;tables=[];root;constructor(e,t=""){this.storageService=e,this.root=t}removeRoot(e){return Z.removeRoot(this.root,e)}addRoot(e){return Z.addRoot(this.root,e)}async createDirectory(e){return await this.storageService.createDirectory(this.addRoot(e)),this.refreshTables(),{type:"directory",id:e,filename:e,basename:Z.getBaseName(e)}}async getTable(){const e=new he(this.storageService,this.root);return this.tables.push(e),e}async saveFile(e){const t=dh.storage.FileContents.text(e.content);return await this.storageService.saveFile(this.addRoot(e.filename),t,!0),this.refreshTables(),e}async loadFile(e){const s=await(await this.storageService.loadFile(this.addRoot(e))).text();return{filename:e,basename:Z.getBaseName(e),content:s}}async copyFile(e,t){const s=await this.storageService.loadFile(this.addRoot(e));await this.storageService.saveFile(this.addRoot(t),s,!1),this.refreshTables()}async deleteFile(e){await this.storageService.deleteItem(this.addRoot(e)),this.refreshTables()}async moveFile(e,t){await this.storageService.moveItem(this.addRoot(e),this.addRoot(t)),this.refreshTables()}async info(e){const t=await this.storageService.listItems(this.addRoot(Z.getPath(e)),Z.getBaseName(e));if(t.length===0)throw new In;if(t.length>1)throw sa.error("More than one matching file found, should never happen.",t),new Error("More than one matching file found");const s=t[0];return{filename:this.removeRoot(s.filename),basename:s.basename,id:this.removeRoot(s.filename),type:s.type}}refreshTables=es(()=>{this.tables.forEach(e=>e.refresh())},Oe.REFRESH_THROTTLE)}const na=k.module("AppInit");function Ie(o){const{workspace:e,setActiveTool:t,setApi:s,setCommandHistoryStorage:a,setDashboardData:r,setFileStorage:i,setLayoutStorage:c,setDashboardConnection:l,setDashboardSessionWrapper:d,setPlugins:h,setUser:u,setWorkspace:g,setWorkspaceStorage:w,setDefaultWorkspaceSettings:v,setServerConfigValues:R}=o,E=yt(),y=un(),j=Ds(),T=Fs(),p=hn(),b=mn(),[se,$t]=m.useState();m.useEffect(function(){h(T)},[T,h]),m.useEffect(function(){async function Wt(){try{const ne=await pn(),me=await fn(E,j,ne),Ae=y.getStorageService(),Me=new ta(Ae,"/layouts"),Bt=new Oe(Ae,"/notebooks"),Ue=new I(Me),Gt=new ho,_e=await Ue.load({isConsoleAvailable:me!==void 0}),{data:pe}=_e,{settings:Vt}=pe,{shortcutOverrides:$e={}}=Vt,Zt=M.isMacPlatform?$e.mac??{}:$e.windows??{};Object.entries(Zt).forEach(([qt,zt])=>{Fe.get(qt)?.setKeyState(zt)});const Ht={filterSets:pe.filterSets,links:pe.links};s(E),t(ue.DEFAULT),R(p),a(Gt),r(_,Ht),i(Bt),c(Me),l(_,j),me!==void 0&&d(_,me),u(b),w(Ue),g(_e),v(I.makeDefaultWorkspaceSettings(p))}catch(ne){na.error(ne),$t(ne)}}Wt()},[E,y,j,p,t,s,a,r,i,c,l,d,u,g,v,w,R,b]);const Le=e==null&&se==null,Pe=!Le&&se==null,ke=se!=null?`${se}`:null;return n.jsxs(n.Fragment,{children:[Pe&&n.jsx(Qo,{}),n.jsx(sn,{isLoading:Le&&ke==null,isLoaded:Pe,errorMessage:ke})]})}Ie.propTypes={workspace:f.shape({}),workspaceStorage:f.shape({close:f.func}),setActiveTool:f.func.isRequired,setApi:f.func.isRequired,setCommandHistoryStorage:f.func.isRequired,setDashboardData:f.func.isRequired,setFileStorage:f.func.isRequired,setLayoutStorage:f.func.isRequired,setDashboardConnection:f.func.isRequired,setDashboardSessionWrapper:f.func.isRequired,setPlugins:f.func.isRequired,setUser:f.func.isRequired,setWorkspace:f.func.isRequired,setWorkspaceStorage:f.func.isRequired};Ie.defaultProps={workspace:null,workspaceStorage:null};const oa=o=>({workspace:Ot(o),workspaceStorage:Gn(o)}),ft=te(oa,{setActiveTool:jt,setApi:Ln,setCommandHistoryStorage:Pn,setDashboardData:xs,setFileStorage:kn,setLayoutStorage:mo,setDashboardConnection:An,setDashboardSessionWrapper:Mn,setPlugins:Un,setUser:_n,setWorkspace:$n,setDefaultWorkspaceSettings:Kn,setWorkspaceStorage:Wn,setServerConfigValues:Bn})(Ie),aa=J.lazy(()=>as(()=>import("./StyleGuideRoot-c8e71114.js"),["./StyleGuideRoot-c8e71114.js","./vendor-fd5d5838.js","./helpers-042e6b4d.js","./vendor-fac43f8b.css","./index-7ee3961d.js","./monaco-1410cbed.js","./monaco-f18fde03.css","./index-824ffbc8.css","./IrisGrid-c3f117a4.js","./usePlugins-2f8c5bde.js","./plotly-1c1a0e42.js","./usePlugins-c14e8ab1.css","./IrisGrid-454c0412.css","./FontBootstrap-ee11a333.js","./FontBootstrap-47bc3788.css","./ControlType-58330610.js","./ControlType-62f56221.css","./useUser-8bec1305.js","./useUser-c9d433e2.css","./StyleGuideRoot-78546d97.css"],import.meta.url)),ra=new URL(document.baseURI).pathname.replace(/\/$/,"");function ia(){return n.jsx(ts,{basename:ra,children:n.jsxs(ss,{children:[n.jsx(fe,{exact:!0,path:"/",component:ft}),n.jsx(fe,{path:"/notebooks/:notebookPath+",component:ft}),n.jsx(fe,{path:"/styleguide",component:aa}),n.jsx(ns,{from:"*",to:"/"})]})})}function gt(){return Rs.register(new URL("./download/serviceWorker.js",window.location.href)),Es.init({getWorker:()=>new rs}),window["__react-beautiful-dnd-disable-dev-warnings"]=!0,n.jsx(os,{store:Nt,children:n.jsx(ia,{})})}const fa=Object.freeze(Object.defineProperty({__proto__:null,AppRoot:gt,default:gt},Symbol.toStringTag,{value:"Module"}));export{fa as A,I as L};
6
- //# sourceMappingURL=AppRoot-5eebed52.js.map
5
+ Barrage Version: ${i}`,children:"Copy Versions"})]})]})]}),n.jsx("div",{className:"app-settings-footer-item",children:n.jsx(xo,{})})]}),n.jsx("div",{className:"app-settings-footer-section",children:n.jsx("div",{className:"logo",children:n.jsx("a",{target:"_blank",rel:"noreferrer noopener",href:"https://deephaven.io",className:"d-inline-block custom-link p-1",children:n.jsx("img",{src:Pt,alt:"Deephaven Data Labs",width:"230px"})})})})]})]})]})}}const mt=10;function z(o){const{forwardedProps:{menuItem:{action:e,title:t,disabled:s},iconElement:a,displayShortcut:r,isMouseSelected:i,isKeyboardSelected:c,closeMenu:l}}=o,d=m.useRef(),h=m.useRef(),u=m.useRef(null),[g,w]=m.useState(!1),v=m.useCallback(y=>{d.current!=null&&h.current!=null&&u.current&&(Math.abs(d.current-y.clientX)>=mt||Math.abs(h.current-y.clientY)>=mt)&&(w(!0),window.removeEventListener("mousemove",v),l(),e(y),u.current=null)},[e,l]);function R(y){d.current=y.clientX,h.current=y.clientY,u.current=y.target,window.addEventListener("mousemove",v)}function E(y){u.current===y.target&&(w(!0),l(),e(),window.removeEventListener("mousemove",v)),u.current=null}return m.useEffect(function(){return function(){return window.removeEventListener("mousemove",v)}},[v]),n.jsxs("button",{type:"button",className:F("btn-context-menu",{disabled:s},{active:i&&!s},{"keyboard-active":c&&!s}),onMouseDown:R,onMouseUp:E,disabled:g,children:[n.jsx("span",{className:F("icon"),children:a}),n.jsx("span",{className:"title",children:t}),n.jsx("span",{className:"shortcut",children:r})]})}function je(o){const{handleControlSelect:e,handleToolSelect:t,onClearFilter:s}=o,a=m.useMemo(()=>[{title:"Input Filter",icon:Gs,menuElement:n.jsx(z,{}),action:r=>{e(G.INPUT_FILTER,r)},order:10},{title:"Dropdown Filter",icon:Vs,menuElement:n.jsx(z,{}),action:r=>{e(G.DROPDOWN_FILTER,r)},order:15},{title:"Markdown Widget",icon:Zs,menuElement:n.jsx(z,{}),action:r=>{e(G.MARKDOWN,r)},order:20},{title:"Filter Sets",icon:Hs,menuElement:n.jsx(z,{}),action:r=>{e(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:qs,action:()=>{t(ue.LINKER)},order:40,shortcut:Ce.LINKER},{disabled:!0,menuElement:n.jsx("div",{className:"context-menu-group-header",children:"Actions"}),order:50},{title:"Clear All Filters",icon:zs,action:()=>{s()},order:60,shortcut:Ct.TABLE.CLEAR_ALL_FILTERS}],[e,t,s]);return n.jsx(hs,{popperClassName:"controls-menu-popper",actions:a})}je.propTypes={handleControlSelect:f.func,handleToolSelect:f.func,onClearFilter:f.func};je.defaultProps={handleControlSelect:()=>{},handleToolSelect:()=>{},onClearFilter:()=>{}};z.propTypes={forwardedProps:f.shape({iconElement:f.node,displayShortcut:f.string,isMouseSelected:f.bool.isRequired,isKeyboardSelected:f.bool.isRequired,closeMenu:f.func.isRequired,menuItem:f.shape({action:f.func,title:f.string,disabled:f.bool}).isRequired})};z.defaultProps={forwardedProps:null};const _o=Tn(Lt,null),$o={layoutStorage:_o},Ko=o=>o.layoutStorage,Wo=o=>o.serverConfigValues;Object.entries($o).map(([o,e])=>ms.register(o,e));const pt=10;function Bo(o){const{onExportLayout:e,onImportLayout:t,onResetLayout:s,onSelect:a,widgets:r=[]}=o,[i,c]=m.useState(!1),[l,d]=m.useState(""),h=m.useRef(null),u=m.useRef(),g=m.useCallback((p,b)=>{p!=null&&a(p,b)},[a]),w=m.useCallback(p=>{d(p.target.value)},[]),v=m.useCallback(p=>{u.current!=null&&(Math.abs(u.current.x-p.clientX)>=pt||Math.abs(u.current.y-p.clientY)>=pt)&&(c(!0),window.removeEventListener("mousemove",v),g(u.current.widget,p),u.current=void 0)},[u,g]),R=m.useCallback((p,b)=>{u.current={x:p.clientX,y:p.clientY,widget:b},window.addEventListener("mousemove",v)},[v]),E=m.useCallback((p,b)=>{window.removeEventListener("mousemove",v),u.current?.widget===b&&(c(!0),g(b)),u.current=void 0},[v,u,g]),y=m.useMemo(()=>r.filter(p=>l?p.name?.toLowerCase().includes(l.toLowerCase()):!0),[l,r]).sort((p,b)=>p.name?.localeCompare(b.name??"")??0),j=m.useMemo(()=>y.map(p=>n.jsx("li",{children:n.jsxs(S,{kind:"ghost","data-testid":`panel-list-item-${p.name??""}-button`,onMouseDown:b=>{R(b,p)},onMouseUp:b=>{E(b,p)},onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&g(p)},disabled:i,onClick:()=>{},children:[n.jsx(Cn,{type:p.type})," ",p.name??""]})},p.name)),[y,i,R,E,g]),T=m.useMemo(()=>j.length===0?n.jsx("span",{children:"No bound variables found."}):null,[j]);return n.jsxs("div",{className:"widget-list-container d-flex flex-column",children:[n.jsx("div",{className:"widget-list-header",children:n.jsx(ps,{value:l,placeholder:"Find Table, Plot or Widget",onChange:w,ref:h})}),n.jsxs("ul",{className:"widget-list flex-grow-1",children:[T&&n.jsx("li",{className:"widget-list-message",children:T}),!T&&j]}),n.jsx("div",{children:n.jsx("hr",{})}),n.jsxs("div",{className:"widget-list-footer",children:[n.jsxs(S,{kind:"ghost",onClick:e,children:[n.jsxs("div",{className:"fa-md fa-layers",children:[n.jsx(x,{mask:Ze,icon:He,transform:"right-5 down-5"}),n.jsx(x,{icon:He,transform:"right-8 down-6"})]}),"Export Layout"]}),n.jsxs(S,{kind:"ghost",onClick:t,children:[n.jsxs("div",{className:"fa-md fa-layers",children:[n.jsx(x,{mask:Ze,icon:qe,transform:"right-5 down-5"}),n.jsx(x,{icon:qe,transform:"right-8 down-6"})]}),"Import Layout"]}),n.jsx(S,{kind:"ghost",icon:H,onClick:s,tooltip:"Reset Layout"})]})]})}function Go({onAutoFillClick:o=()=>{}}){return n.jsxs("div",{className:"empty-dashboard-container",children:[n.jsxs("div",{className:"hint-container",children:[n.jsx(x,{icon:Ys})," ",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(S,{kind:"tertiary",onClick:o,children:"Auto fill objects"})]})]})}function Vo(o){return o.version===2}function Zo(o){return Array.isArray(o)}const re=k.module("UserLayoutUtils"),Ho={layoutConfig:[{type:"column",content:[{type:"row",height:40,content:[{type:"stack",content:[{type:"react-component",component:Ye.COMPONENT,title:Ye.TITLE,isClosable:!1},{type:"react-component",component:Je.COMPONENT,title:Je.TITLE,isClosable:!1}]},{type:"stack",width:25,content:[{type:"react-component",component:Xe.COMPONENT,title:Xe.TITLE,isClosable:!1},{type:"react-component",component:Qe.COMPONENT,title:Qe.TITLE,isClosable:!1}]}]},{type:"row",content:[{type:"stack",title:"Notebooks",content:[]}]}]}],links:[],filterSets:[],version:2},qo={layoutConfig:[],links:[],filterSets:[],version:2};function _t(o){if(Vo(o))return o;if(Zo(o))return{layoutConfig:o,links:[],filterSets:[],version:2};throw new Error(`Unexpected layout import format: ${o}`)}async function zo(o,e=!0){try{const t=await o.getLayouts();if(t.length>0)try{const s=await o.getLayout(t[0]);return _t(s)}catch(s){re.error("Unable to load layout",t[0],":",s),re.warn("No valid layouts found, falling back to default layout")}}catch(t){re.error("Unable to fetch layout list",t),re.warn("Falling back to default layout")}return e?Ho:qo}function Yo(o){const{filterSets:e,layoutConfig:t,links:s}=o;return{filterSets:e,layoutConfig:t,links:s,version:2}}const le={exportLayout:Yo,getDefaultLayout:zo,normalizeLayout:_t},C=k.module("AppMainContainer");class Y extends m.Component{static handleWindowBeforeUnload(e){e.preventDefault(),e.returnValue=""}static hydrateConsole(e,t){return We.hydrate({...e,unzip:s=>vt.loadAsync(s).then(a=>Object.values(a.files))},t)}static handleRefresh(){C.info("Refreshing application"),window.location.reload()}constructor(e){super(e),bs(this),this.importElement=J.createRef(),this.state={contextActions:[{action:()=>{this.handleToolSelect(ue.LINKER)},shortcut:Ce.LINKER,isGlobal:!0},{action:()=>{this.sendClearFilter()},shortcut:Ct.TABLE.CLEAR_ALL_FILTERS,isGlobal:!0},{action:()=>{C.debug("Consume unhandled save shortcut")},shortcut:Ce.SAVE,isGlobal:!0}],isAuthFailed:!1,isDisconnected:!1,isPanelsMenuShown:!1,isResetLayoutPromptShown:!1,isSettingsMenuShown:!1,unsavedNotebookCount:0,widgets:[]}}componentDidMount(){this.initWidgets(),this.startListeningForDisconnect(),window.addEventListener("beforeunload",Y.handleWindowBeforeUnload)}componentDidUpdate(e){const{dashboardData:t}=this.props;e.dashboardData!==t&&this.handleDataChange(t)}componentWillUnmount(){this.deinitWidgets(),this.stopListeningForDisconnect(),window.removeEventListener("beforeunload",Y.handleWindowBeforeUnload)}goldenLayout;importElement;widgetListenerRemover;initWidgets(){const{connection:e}=this.props;if(e.subscribeToFieldUpdates==null){C.warn("subscribeToFieldUpdates not supported, not initializing widgets");return}this.widgetListenerRemover=e.subscribeToFieldUpdates(t=>{C.debug("Got updates",t),this.setState(({widgets:s})=>{const{updated:a,created:r,removed:i}=t,c=[...a,...i],l=s.filter(h=>!c.some(u=>u.name===h.name));return[...a,...r].forEach(h=>{h.name!=null&&h.name!==""&&l.push(h)}),{widgets:l}})})}deinitWidgets(){this.widgetListenerRemover?.()}openNotebookFromURL(){const{match:e}=this.props,{notebookPath:t}=e.params;if(t){const{session:s,sessionConfig:a}=this.props;if(s==null||a==null){C.error("No session available to open notebook URL",t);return}const r={id:`/${t}`,itemName:`/${t}`},i=a.type,c={value:null,language:i};this.emitLayoutEvent(En.SELECT_NOTEBOOK,s,i,c,r,!0)}}sendClearFilter(){this.emitLayoutEvent(oe.CLEAR_ALL_FILTERS)}emitLayoutEvent(e,...t){this.goldenLayout?.eventHub.emit(e,...t)}handleCancelResetLayoutPrompt(){this.setState({isResetLayoutPromptShown:!1})}handleConfirmResetLayoutPrompt(){this.setState({isResetLayoutPromptShown:!1}),this.resetLayout()}handleError(e){K.isCanceled(e)||C.error(e)}handleSettingsMenuHide(){this.setState({isSettingsMenuShown:!1})}handleSettingsMenuShow(){this.setState({isSettingsMenuShown:!0})}handleControlSelect(e,t){switch(C.debug("handleControlSelect",e),e){case G.DROPDOWN_FILTER:this.emitLayoutEvent(oe.OPEN_DROPDOWN,{title:"DropdownFilter",type:e,createNewStack:!0,dragEvent:t});break;case G.INPUT_FILTER:this.emitLayoutEvent(oe.OPEN_INPUT,{title:"InputFilter",type:e,createNewStack:!0,dragEvent:t});break;case G.MARKDOWN:this.emitLayoutEvent(Nn.OPEN,{title:"Markdown",type:e,dragEvent:t});break;case G.FILTER_SET_MANAGER:this.emitLayoutEvent(oe.OPEN_FILTER_SET_MANAGER,{title:"FilterSets",type:e,dragEvent:t});break;default:throw new Error(`Unrecognized control type ${e}`)}}handleToolSelect(e){C.debug("handleToolSelect",e);const{activeTool:t,setActiveTool:s}=this.props;s(t===e?ue.DEFAULT:e)}handleClearFilter(){this.sendClearFilter()}handleDataChange(e){const{updateWorkspaceData:t}=this.props,{closed:s,filterSets:a,links:r}=e;t({closed:s,filterSets:a,links:r})}handleGoldenLayoutChange(e){this.goldenLayout=e}handleLayoutConfigChange(e){const{updateWorkspaceData:t}=this.props;t({layoutConfig:e})}handleWidgetMenuClick(){this.setState(({isPanelsMenuShown:e})=>({isPanelsMenuShown:!e}))}handleWidgetSelect(e,t){this.setState({isPanelsMenuShown:!1}),C.debug("handleWidgetSelect",e,t),this.openWidget(e,t)}handleWidgetsMenuClose(){this.setState({isPanelsMenuShown:!1})}handleAutoFillClick(){const{widgets:e}=this.state;C.debug("handleAutoFillClick",e);const t=e.sort((s,a)=>s.title!=null&&a.title!=null?s.title.localeCompare(a.title):0);for(let s=0;s<t.length;s+=1)this.openWidget(t[s])}handleExportLayoutClick(){C.info("handleExportLayoutClick"),this.setState({isPanelsMenuShown:!1});try{const{workspace:e}=this.props,{data:t}=e,s=le.exportLayout(t);C.info("handleExportLayoutClick exportedConfig",s);const a=new Blob([JSON.stringify(s)],{type:"application/json"}),r=B.i18n.DateTimeFormat.format("yyyy-MM-dd-HHmmss",new Date),i=document.createElement("a");i.href=URL.createObjectURL(a),i.download=`deephaven-app-layout-${r}.json`,i.click()}catch(e){C.error("Unable to export layout",e)}}handleImportLayoutClick(){C.info("handleImportLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.importElement.current!=null&&(this.importElement.current.value="",this.importElement.current.click())}handleResetLayoutClick(){C.info("handleResetLayoutClick"),this.setState({isPanelsMenuShown:!1,isResetLayoutPromptShown:!0,unsavedNotebookCount:jn.unsavedNotebookCount()})}handleImportLayoutFiles(e){e.stopPropagation(),e.preventDefault(),e.target.files!=null&&this.importLayoutFile(e.target.files?.[0])}handleDisconnect(){C.info("Disconnected from server"),this.setState({isDisconnected:!0})}handleReconnect(){C.info("Reconnected to server"),this.setState({isDisconnected:!1})}handleReconnectAuthFailed(){C.warn("Reconnect authentication failed"),this.setState({isAuthFailed:!0})}async importLayoutFile(e){try{const{updateDashboardData:t,updateWorkspaceData:s}=this.props,a=await e.text(),r=JSON.parse(a),{filterSets:i,layoutConfig:c,links:l}=le.normalizeLayout(r);s({layoutConfig:c}),t(_,{filterSets:i,links:l})}catch(t){C.error("Unable to import layout",t)}}async resetLayout(){const{layoutStorage:e,session:t}=this.props,{filterSets:s,layoutConfig:a,links:r}=await le.getDefaultLayout(e,t!==void 0),{updateDashboardData:i,updateWorkspaceData:c}=this.props;c({layoutConfig:a}),i(_,{filterSets:s,links:r})}handlePaste(e){if(e.target instanceof HTMLElement&&e.target.closest(".monaco-editor"))return;const{clipboardData:t}=e,s=t.getData("Text"),a=/“|”/g;a.test(s)&&(e.preventDefault(),e.stopPropagation(),document.execCommand("insertText",!1,s.replace(a,'"')))}startListeningForDisconnect(){const{connection:e}=this.props;e.addEventListener(B.IdeConnection.EVENT_DISCONNECT,this.handleDisconnect),e.addEventListener(B.IdeConnection.EVENT_RECONNECT,this.handleReconnect),e.addEventListener(B.CoreClient.EVENT_RECONNECT_AUTH_FAILED,this.handleReconnectAuthFailed)}stopListeningForDisconnect(){const{connection:e}=this.props;e.removeEventListener(B.IdeConnection.EVENT_DISCONNECT,this.handleDisconnect),e.removeEventListener(B.IdeConnection.EVENT_RECONNECT,this.handleReconnect),e.removeEventListener(B.CoreClient.EVENT_RECONNECT_AUTH_FAILED,this.handleReconnectAuthFailed)}hydrateDefault(e,t){const{connection:s}=this.props,{metadata:a}=e;if(a?.type!=null&&(a?.id!=null||a?.name!=null)){const r=a.id!=null?{type:a.type,id:a.id}:{type:a.type,name:a.name,title:a.name};return{fetch:()=>s.getObject(r),...e,localDashboardId:t}}return We.hydrate(e,t)}openWidget(e,t){const{connection:s}=this.props;this.emitLayoutEvent(vs.OPEN,{dragEvent:t,fetch:()=>s.getObject(e),widget:e})}getDashboardPlugins=Qt(e=>[...e.entries()].filter(([,s])=>Ts(s)||Ge(s)).map(([s,a])=>{if(Ge(a)){const{DashboardPlugin:i}=a;return n.jsx(i,{},s)}const{component:r}=a;return n.jsx(r,{},s)}));render(){const{activeTool:e,plugins:t,user:s,workspace:a,serverConfigValues:r}=this.props,{data:i}=a,{layoutConfig:c}=i,{permissions:l}=s,{canUsePanels:d}=l,{contextActions:h,isAuthFailed:u,isDisconnected:g,isPanelsMenuShown:w,isResetLayoutPromptShown:v,isSettingsMenuShown:R,unsavedNotebookCount:E,widgets:y}=this.state,j=this.getDashboardPlugins(t);return n.jsxs("div",{className:F("app-main-tabs","w-100","h-100","d-flex","flex-column",e?`active-tool-${e.toLowerCase()}`:""),onPaste:this.handlePaste,tabIndex:-1,children:[n.jsx("nav",{className:"nav-container",children:n.jsxs("div",{className:"app-main-top-nav-menus",children:[n.jsx("img",{src:Pt,alt:"Deephaven Data Labs",width:"115px",className:"ml-1"}),n.jsxs("div",{children:[n.jsxs(S,{kind:"ghost",className:"btn-panels-menu",icon:Js,onClick:()=>{},children:["Controls",n.jsx(je,{handleControlSelect:this.handleControlSelect,handleToolSelect:this.handleToolSelect,onClearFilter:this.handleClearFilter})]}),d&&n.jsxs(S,{kind:"ghost",className:"btn-panels-menu btn-show-panels","data-testid":"app-main-panels-button",onClick:this.handleWidgetMenuClick,icon:Xs,children:["Panels",n.jsx(Ss,{isShown:w,className:"panels-menu-popper",onExited:this.handleWidgetsMenuClose,options:{placement:"bottom"},closeOnBlur:!0,interactive:!0,children:n.jsx(Bo,{widgets:y,onExportLayout:this.handleExportLayoutClick,onImportLayout:this.handleImportLayoutClick,onResetLayout:this.handleResetLayoutClick,onSelect:this.handleWidgetSelect})})]}),n.jsx(S,{kind:"ghost",className:F("btn-settings-menu",{"text-warning":s.operateAs!=null&&s.operateAs!==s.name}),onClick:this.handleSettingsMenuShow,icon:n.jsxs("span",{className:"fa-layers",children:[n.jsx(x,{icon:Qs,transform:"grow-3 right-1 down-1"}),g&&!u&&n.jsxs(n.Fragment,{children:[n.jsx(x,{icon:en,color:ie.background,transform:"grow-2 right-8 down-8.5 rotate-45"}),n.jsx(x,{icon:ze,color:ie.danger,transform:"shrink-5 right-6 down-6"})]})]}),tooltip:g&&!u?"Server disconnected":"User Settings"})]})]})}),n.jsxs(ln,{emptyDashboard:n.jsx(Go,{onAutoFillClick:this.handleAutoFillClick}),id:_,layoutConfig:c,onGoldenLayoutChange:this.handleGoldenLayoutChange,onLayoutConfigChange:this.handleLayoutConfigChange,onLayoutInitialized:this.openNotebookFromURL,hydrate:this.hydrateDefault,children:[n.jsx(On,{hydrateConsole:Y.hydrateConsole,notebooksUrl:new URL("notebooks/",document.baseURI).href}),j]}),n.jsx(St,{in:R,timeout:ie.transitionMidMs,classNames:"slide-left",mountOnEnter:!0,unmountOnExit:!0,children:n.jsx(U,{serverConfigValues:r,onDone:this.handleSettingsMenuHide,user:s})}),n.jsx(ys,{actions:h}),n.jsx("input",{ref:this.importElement,type:"file",accept:".json",style:{display:"none"},onChange:this.handleImportLayoutFiles}),n.jsx(cn,{isOpen:g&&!u,debounceMs:1e3,children:n.jsx(dn,{icon:ze,title:n.jsxs(n.Fragment,{children:[n.jsx(tn,{})," Attempting to reconnect..."]}),subtitle:"Please check your network connection."})}),n.jsx(Be,{confirmButtonText:"Reset",onConfirm:this.handleConfirmResetLayoutPrompt,onCancel:this.handleCancelResetLayoutPrompt,isConfirmDanger:!0,isOpen:v,headerText:E===0?"Reset Layout":"Reset layout and discard unsaved changes",bodyText:E===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."}),n.jsx(Be,{confirmButtonText:"Refresh",onConfirm:Y.handleRefresh,isOpen:u,headerText:"Authentication failed",bodyText:"Credentials are invalid. Please refresh your browser to try and reconnect."})]})}}const Jo=o=>({activeTool:xn(o),dashboardData:gs(o,_),layoutStorage:Ko(o),plugins:Dn(o),connection:Fn(o,_),session:et(o,_)?.session,sessionConfig:et(o,_)?.config,user:Rn(o),workspace:Ot(o),serverConfigValues:Wo(o)}),Xo=te(Jo,{setActiveTool:jt,updateDashboardData:fs,updateWorkspaceData:wn})(Xt(Y));function Qo(){return n.jsxs("div",{className:"app",children:[n.jsx(Xo,{}),n.jsx(Cs,{})]})}const ea=k.module("LocalWorkspaceStorage");class I{static STORAGE_KEY="deephaven.WorkspaceStorage";static getBooleanServerConfig(e,t){if(e?.get(t)?.toLowerCase()==="true")return!0;if(e?.get(t)?.toLowerCase()==="false")return!1}static makeDefaultWorkspaceSettings(e){const t={defaultDateTimeFormat:W.DEFAULT_DATETIME_FORMAT_STRING,formatter:[],timeZone:W.DEFAULT_TIME_ZONE_ID,showTimeZone:!1,showTSeparator:!0,disableMoveConfirmation:!1,defaultDecimalFormatOptions:{defaultFormatString:P.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:L.DEFAULT_FORMAT_STRING},truncateNumbersWithPound:!1,defaultNotebookSettings:{isMinimapEnabled:!1}},s={defaultDateTimeFormat:e?.get("dateTimeFormat"),formatter:[],timeZone:e?.get("timeZone"),showTimeZone:I.getBooleanServerConfig(e,"showTimeZone"),showTSeparator:I.getBooleanServerConfig(e,"showTSeparator"),disableMoveConfirmation:I.getBooleanServerConfig(e,"disableMoveConfirmation"),defaultDecimalFormatOptions:e?.get("decimalFormat")!==void 0?{defaultFormatString:e?.get("decimalFormat")}:void 0,defaultIntegerFormatOptions:e?.get("integerFormat")!==void 0?{defaultFormatString:e?.get("integerFormat")}:void 0,truncateNumbersWithPound:I.getBooleanServerConfig(e,"truncateNumbersWithPound"),defaultNotebookSettings:e?.get("isMinimapEnabled")!==void 0?{isMinimapEnabled:I.getBooleanServerConfig(e,"isMinimapEnabled")}:void 0},a=Object.keys(s);for(let r=0;r<a.length;r+=1){const i=a[r];s[i]!==void 0&&(t[i]=s[i])}return t}static async makeWorkspaceData(e,t){const{filterSets:s,links:a,layoutConfig:r}=await le.getDefaultLayout(e,t?.isConsoleAvailable);return{settings:{},layoutConfig:r,closed:[{}],links:a,filterSets:s}}static async makeDefaultWorkspace(e,t){return{data:await I.makeWorkspaceData(e,t)}}layoutStorage;constructor(e){this.layoutStorage=e}async load(e){try{return JSON.parse(localStorage.getItem(I.STORAGE_KEY)??"")}catch{return ea.info("Unable to load workspace data, initializing to default data"),I.makeDefaultWorkspace(this.layoutStorage,e)}}async save(e){return localStorage.setItem(I.STORAGE_KEY,JSON.stringify(e)),e}}class ta{storageService;root;constructor(e,t=""){this.storageService=e,this.root=t}async getLayouts(){return(await this.storageService.listItems(this.root,"*.json")).map(t=>t.basename)}async getLayout(e){const s=await(await this.storageService.loadFile(`${this.root}/${e}`)).text();return JSON.parse(s)}}const Q=k.module("GrpcFileStorageTable");class he{static REFRESH_DEBOUNCE=50;storageService;baseRoot;root;currentSize=0;currentViewport;listeners=[];viewportUpdatePromise;currentViewportData;childTables=new Map;constructor(e,t="",s=t){this.storageService=e,this.baseRoot=t,this.root=s,s===t&&(this.doRefresh=De(this.doRefresh.bind(this),he.REFRESH_DEBOUNCE))}removeBaseRoot(e){return Z.removeRoot(this.baseRoot,e)}getViewportData(){return this.viewportUpdatePromise||this.refreshInternal(),this.viewportUpdatePromise??Promise.resolve({items:[],offset:0})}getSnapshot(e){throw new Error("Method not implemented.")}get size(){return this.currentSize}setExpanded(e,t){const s=e.split("/");let a=s.shift();if((a===void 0||a==="")&&(a=s.shift()),a===void 0||a==="")throw new Error(`Invalid path: ${e}`);const r=s.join("/");if(t){if(!this.childTables.has(a)){const i=new he(this.storageService,this.baseRoot,`${this.root}/${a}`);this.childTables.set(a,i)}r&&this.childTables.get(a)?.setExpanded(r,t)}else this.childTables.has(a)&&(r?this.childTables.get(a)?.setExpanded(r,t):this.childTables.delete(a));this.currentViewport&&this.refreshInternal()}collapseAll(){this.childTables.clear(),this.currentViewport&&this.refreshInternal()}setSearch(e){throw new Error("Method not implemented.")}setViewport(e){this.currentViewport=e,this.refreshInternal()}setFilters(){throw new Error("Method not implemented.")}setSorts(){throw new Error("Method not implemented.")}setReversed(){throw new Error("Method not implemented.")}close(){this.listeners=[]}onUpdate(e){return this.listeners=[...this.listeners,e],()=>{this.listeners=this.listeners.filter(t=>t!==e)}}doRefresh(e){Q.debug2("doRefresh",this.root),e(this.fetchData())}refresh(){Q.debug2("refresh",this.root),this.viewportUpdatePromise?.cancel();const e=new Promise(s=>{this.doRefresh(s)}),t=K.makeCancelable(e.then(s=>{if(this.viewportUpdatePromise!==t)throw new ws;return this.currentViewportData=s,this.sendUpdate(),s}));t.catch(s=>{K.isCanceled(s)||Q.error("Error updating viewport",s)}),this.viewportUpdatePromise=t}refreshInternal(){try{this.refresh()}catch(e){K.isCanceled(e)||Q.error("Unable to refresh data",e)}}async fetchData(){const{currentViewport:e}=this;if(!e)throw new Error("No viewport set");let s=(await this.storageService.listItems(this.root)).map(a=>({type:a.type,filename:this.removeBaseRoot(a.filename),basename:a.basename,id:this.removeBaseRoot(a.filename),isExpanded:a.type==="directory"?this.childTables.has(a.basename):void 0})).sort((a,r)=>a.type!==r.type?a.type==="directory"?-1:1:a.basename.localeCompare(r.basename));for(let a=0;a<s.length;a+=1){const r=s[a],{basename:i,filename:c}=r;if(c===this.removeBaseRoot(`${this.root}/${i}`)&&r.type==="directory"){const l=this.childTables.get(i);if(l!=null){l.setViewport({top:0,bottom:e.bottom-a});const d=await l.getViewportData();s.splice(a+1,0,...d.items)}}}return this.currentSize=s.length,Q.debug2(this.root,"items",s,e),s=s.slice(e.top,e.bottom),{items:s,offset:e.top}}sendUpdate(){const{listeners:e}=this,t=this.currentViewportData??{items:[],offset:0};for(let s=0;s<e.length;s+=1)e[s](t)}}const sa=k.module("GrpcFileStorage");class Oe{static REFRESH_THROTTLE=150;storageService;tables=[];root;constructor(e,t=""){this.storageService=e,this.root=t}removeRoot(e){return Z.removeRoot(this.root,e)}addRoot(e){return Z.addRoot(this.root,e)}async createDirectory(e){return await this.storageService.createDirectory(this.addRoot(e)),this.refreshTables(),{type:"directory",id:e,filename:e,basename:Z.getBaseName(e)}}async getTable(){const e=new he(this.storageService,this.root);return this.tables.push(e),e}async saveFile(e){const t=dh.storage.FileContents.text(e.content);return await this.storageService.saveFile(this.addRoot(e.filename),t,!0),this.refreshTables(),e}async loadFile(e){const s=await(await this.storageService.loadFile(this.addRoot(e))).text();return{filename:e,basename:Z.getBaseName(e),content:s}}async copyFile(e,t){const s=await this.storageService.loadFile(this.addRoot(e));await this.storageService.saveFile(this.addRoot(t),s,!1),this.refreshTables()}async deleteFile(e){await this.storageService.deleteItem(this.addRoot(e)),this.refreshTables()}async moveFile(e,t){await this.storageService.moveItem(this.addRoot(e),this.addRoot(t)),this.refreshTables()}async info(e){const t=await this.storageService.listItems(this.addRoot(Z.getPath(e)),Z.getBaseName(e));if(t.length===0)throw new In;if(t.length>1)throw sa.error("More than one matching file found, should never happen.",t),new Error("More than one matching file found");const s=t[0];return{filename:this.removeRoot(s.filename),basename:s.basename,id:this.removeRoot(s.filename),type:s.type}}refreshTables=es(()=>{this.tables.forEach(e=>e.refresh())},Oe.REFRESH_THROTTLE)}const na=k.module("AppInit");function Ie(o){const{workspace:e,setActiveTool:t,setApi:s,setCommandHistoryStorage:a,setDashboardData:r,setFileStorage:i,setLayoutStorage:c,setDashboardConnection:l,setDashboardSessionWrapper:d,setPlugins:h,setUser:u,setWorkspace:g,setWorkspaceStorage:w,setDefaultWorkspaceSettings:v,setServerConfigValues:R}=o,E=yt(),y=un(),j=Ds(),T=Fs(),p=hn(),b=mn(),[se,$t]=m.useState();m.useEffect(function(){h(T)},[T,h]),m.useEffect(function(){async function Wt(){try{const ne=await pn(),me=await fn(E,j,ne),Ae=y.getStorageService(),Me=new ta(Ae,"/layouts"),Bt=new Oe(Ae,"/notebooks"),Ue=new I(Me),Gt=new ho,_e=await Ue.load({isConsoleAvailable:me!==void 0}),{data:pe}=_e,{settings:Vt}=pe,{shortcutOverrides:$e={}}=Vt,Zt=M.isMacPlatform?$e.mac??{}:$e.windows??{};Object.entries(Zt).forEach(([qt,zt])=>{Fe.get(qt)?.setKeyState(zt)});const Ht={filterSets:pe.filterSets,links:pe.links};s(E),t(ue.DEFAULT),R(p),a(Gt),r(_,Ht),i(Bt),c(Me),l(_,j),me!==void 0&&d(_,me),u(b),w(Ue),g(_e),v(I.makeDefaultWorkspaceSettings(p))}catch(ne){na.error(ne),$t(ne)}}Wt()},[E,y,j,p,t,s,a,r,i,c,l,d,u,g,v,w,R,b]);const Le=e==null&&se==null,Pe=!Le&&se==null,ke=se!=null?`${se}`:null;return n.jsxs(n.Fragment,{children:[Pe&&n.jsx(Qo,{}),n.jsx(sn,{isLoading:Le&&ke==null,isLoaded:Pe,errorMessage:ke})]})}Ie.propTypes={workspace:f.shape({}),workspaceStorage:f.shape({close:f.func}),setActiveTool:f.func.isRequired,setApi:f.func.isRequired,setCommandHistoryStorage:f.func.isRequired,setDashboardData:f.func.isRequired,setFileStorage:f.func.isRequired,setLayoutStorage:f.func.isRequired,setDashboardConnection:f.func.isRequired,setDashboardSessionWrapper:f.func.isRequired,setPlugins:f.func.isRequired,setUser:f.func.isRequired,setWorkspace:f.func.isRequired,setWorkspaceStorage:f.func.isRequired};Ie.defaultProps={workspace:null,workspaceStorage:null};const oa=o=>({workspace:Ot(o),workspaceStorage:Gn(o)}),ft=te(oa,{setActiveTool:jt,setApi:Ln,setCommandHistoryStorage:Pn,setDashboardData:xs,setFileStorage:kn,setLayoutStorage:mo,setDashboardConnection:An,setDashboardSessionWrapper:Mn,setPlugins:Un,setUser:_n,setWorkspace:$n,setDefaultWorkspaceSettings:Kn,setWorkspaceStorage:Wn,setServerConfigValues:Bn})(Ie),aa=J.lazy(()=>as(()=>import("./StyleGuideRoot-852ef6d9.js"),["./StyleGuideRoot-852ef6d9.js","./vendor-fd5d5838.js","./helpers-042e6b4d.js","./vendor-fac43f8b.css","./index-bf3c2e00.js","./monaco-1410cbed.js","./monaco-f18fde03.css","./index-399935a8.css","./IrisGrid-bce61d13.js","./usePlugins-525a1a1b.js","./plotly-1c1a0e42.js","./usePlugins-1cbb179a.css","./IrisGrid-68ffe9cf.css","./FontBootstrap-daffc2e1.js","./FontBootstrap-5dc042b0.css","./ControlType-4c9520d6.js","./ControlType-62f56221.css","./useUser-6f056f9e.js","./useUser-c9d433e2.css","./StyleGuideRoot-104ae414.css"],import.meta.url)),ra=new URL(document.baseURI).pathname.replace(/\/$/,"");function ia(){return n.jsx(ts,{basename:ra,children:n.jsxs(ss,{children:[n.jsx(fe,{exact:!0,path:"/",component:ft}),n.jsx(fe,{path:"/notebooks/:notebookPath+",component:ft}),n.jsx(fe,{path:"/styleguide",component:aa}),n.jsx(ns,{from:"*",to:"/"})]})})}function gt(){return Rs.register(new URL("./download/serviceWorker.js",window.location.href)),Es.init({getWorker:()=>new rs}),window["__react-beautiful-dnd-disable-dev-warnings"]=!0,n.jsx(os,{store:Nt,children:n.jsx(ia,{})})}const fa=Object.freeze(Object.defineProperty({__proto__:null,AppRoot:gt,default:gt},Symbol.toStringTag,{value:"Module"}));export{fa as A,I as L};
6
+ //# sourceMappingURL=AppRoot-ba1658fc.js.map