@deephaven/code-studio 0.22.3-beta.7 → 0.22.3-beta.8
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.
|
@@ -39,5 +39,5 @@ ${l} does not exist yet.`}if(i){const{widgetName:r}=this.props;return`${r} is un
|
|
|
39
39
|
${qa.makeCirclePath(s,i,qh)}`,w=`link-select-clip-${o}`,T=Math.atan2(i-f,s-g),y=T-Kh+Math.PI,E=T+Kh+Math.PI,I=s+Math.cos(T)*Gh,D=i+Math.sin(T)*Gh,F=I+Math.cos(y)*Fr,x=D+Math.sin(y)*Fr,U=I+Math.cos(E)*Fr,$=D+Math.sin(E)*Fr,_=`${I},${D} ${F},${x} ${U},${$}`;return v("svg",{className:t,children:[h("clipPath",{id:w,children:h("path",{d:b,clipRule:"evenodd"})}),h("path",{className:"link-select",d:C,onClick:this.handleClick,clipPath:`url(#${w})`}),h("path",{className:"link-background",d:C}),h("path",{className:"link-foreground",d:C}),h("circle",{className:"link-dot",cx:e,cy:n,r:"5"}),h("polygon",{className:"link-triangle",points:_})]})}};let Vp=qa;Vp.defaultProps={className:"",onClick(){}};const ba=X.module("LinkerOverlayContent");class Up extends S.exports.Component{constructor(e){super(e),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleEscapePressed=this.handleEscapePressed.bind(this),this.state={mouseX:void 0,mouseY:void 0}}componentDidMount(){window.addEventListener("mousemove",this.handleMouseMove,!0)}componentDidCatch(e,n){ba.error("componentDidCatch",e,n)}componentWillUnmount(){window.removeEventListener("mousemove",this.handleMouseMove,!0)}getPointFromLinkPoint(e){const{panelManager:n}=this.props,{panelId:s,columnName:i}=e,o=n.getOpenedPanelById(s);if(o!=null){if(!Lp(o))throw new Error(`Panel does not have getCoordinateForColumn method: ${s}`);try{const l=o.getCoordinateForColumn(i);if(l!=null)return l}catch{ba.error("Could not get coordinate for column",i,o)}}const r=n.getContainerByPanelId(s);if(r==null)throw new Error(`Unable to find panel container for id: ${s}`);return te.getTabPoint(r)}handleMouseMove(e){this.setState({mouseX:e.clientX,mouseY:e.clientY})}handleEscapePressed(){const{onCancel:e}=this.props;e()}render(){const{disabled:e,links:n,messageText:s,onLinkDeleted:i,onAllLinksDeleted:o,onDone:r}=this.props,{mouseX:l,mouseY:a}=this.state,d=n.map(c=>{try{const{id:u,type:m,isReversed:p,start:g,end:f}=c;let[C,b]=this.getPointFromLinkPoint(g),w=l!=null?l:C,T=a!=null?a:b;if(f!=null&&([w,T]=this.getPointFromLinkPoint(f)),p!=null&&p){const[E,I]=[C,b];[C,b]=[w,T],[w,T]=[E,I]}const y=W("linker-link",{disabled:e},{"link-filter-source":m==="filterSource"},{"link-invalid":m==="invalid"},{interactive:c.end==null});return{x1:C,y1:b,x2:w,y2:T,id:u,className:y}}catch(u){return ba.error("Unable to get point for link",c,u),null}}).filter(c=>c!=null);return v("div",{className:"linker-overlay",children:[h("svg",{children:d.map(({x1:c,y1:u,x2:m,y2:p,id:g,className:f})=>h(Vp,{className:f,id:g,x1:c,y1:u,x2:m,y2:p,onClick:i},g))}),v("div",{className:"linker-toast-dialog",children:[h("div",{className:"toast-body",children:s}),v("div",{className:"toast-footer",children:[h(z,{kind:"secondary",onClick:o,children:"Clear All"}),h(z,{kind:"primary",onClick:r,children:"Done"})]})]}),h(oe,{actions:[{action:this.handleEscapePressed,shortcut:ms.LINKER_CLOSE,isGlobal:!0}]})]})}}Up.defaultProps={disabled:"false"};const zt=X.module("Linker"),t1=(t,e)=>({activeTool:Rl(t),isolatedLinkerPanelId:Qd(t,e.localDashboardId),links:io(t,e.localDashboardId),timeZone:Il(t)}),n1=Mt(t1,{setActiveTool:Dl,setDashboardLinks:Jd,addDashboardLinks:cE,deleteDashboardLinks:hE,setDashboardIsolatedLinkerPanelId:Rp,setDashboardColumnSelectionValidator:uE});class s1 extends S.exports.Component{constructor(e){super(e),this.getCachedLinks=me((n,s,i)=>{const o=[...n];return s!=null&&s.start!=null&&o.push(s),i!==void 0?o.filter(r=>{var l,a;return((l=r==null?void 0:r.start)==null?void 0:l.panelId)===i||((a=r==null?void 0:r.end)==null?void 0:a.panelId)===i||(r==null?void 0:r.end)==null}):o}),this.handleCancel=this.handleCancel.bind(this),this.handleDone=this.handleDone.bind(this),this.handlePanelCloned=this.handlePanelCloned.bind(this),this.handleFilterColumnSelect=this.handleFilterColumnSelect.bind(this),this.handleColumnsChanged=this.handleColumnsChanged.bind(this),this.handlePanelClosed=this.handlePanelClosed.bind(this),this.handleLayoutStateChanged=this.handleLayoutStateChanged.bind(this),this.handleAllLinksDeleted=this.handleAllLinksDeleted.bind(this),this.handleLinkDeleted=this.handleLinkDeleted.bind(this),this.handleChartColumnSelect=this.handleChartColumnSelect.bind(this),this.handleGridColumnSelect=this.handleGridColumnSelect.bind(this),this.handleUpdateValues=this.handleUpdateValues.bind(this),this.handleStateChange=this.handleStateChange.bind(this),this.handleExited=this.handleExited.bind(this),this.isColumnSelectionValid=this.isColumnSelectionValid.bind(this),this.state={linkInProgress:void 0}}componentDidMount(){const{layout:e}=this.props;this.startListening(e),this.updateSelectionValidators()}componentDidUpdate(e){const{activeTool:n,layout:s}=this.props;s!==e.layout&&(this.stopListening(e.layout),this.startListening(s)),n!==e.activeTool&&this.updateSelectionValidators()}componentDidCatch(e,n){zt.error("componentDidCatch",e,n)}componentWillUnmount(){const{layout:e}=this.props;this.stopListening(e)}startListening(e){e.on("stateChanged",this.handleLayoutStateChanged);const{eventHub:n}=e;n.on(vt.COLUMN_SELECTED,this.handleGridColumnSelect),n.on(vt.DATA_SELECTED,this.handleUpdateValues),n.on(vt.STATE_CHANGED,this.handleStateChange),n.on(Ki.COLUMN_SELECTED,this.handleChartColumnSelect),n.on(Me.CLONED,this.handlePanelCloned),n.on(He.COLUMN_SELECTED,this.handleFilterColumnSelect),n.on(He.COLUMNS_CHANGED,this.handleColumnsChanged),n.on(Me.CLOSED,this.handlePanelClosed)}stopListening(e){e.off("stateChanged",this.handleLayoutStateChanged);const{eventHub:n}=e;n.off(vt.COLUMN_SELECTED,this.handleGridColumnSelect),n.off(vt.DATA_SELECTED,this.handleUpdateValues),n.off(vt.STATE_CHANGED,this.handleStateChange),n.off(Ki.COLUMN_SELECTED,this.handleChartColumnSelect),n.off(Me.CLONED,this.handlePanelCloned),n.off(He.COLUMN_SELECTED,this.handleFilterColumnSelect),n.off(He.COLUMNS_CHANGED,this.handleColumnsChanged),n.off(Me.CLOSED,this.handlePanelClosed)}handleCancel(){const{linkInProgress:e}=this.state;if(e==null){const{setActiveTool:n}=this.props;n(hn.DEFAULT)}this.setState({linkInProgress:void 0})}handleDone(){const{setActiveTool:e}=this.props;e(hn.DEFAULT),this.setState({linkInProgress:void 0})}handleChartColumnSelect(e,n){this.columnSelected(e,n,!0)}handleFilterColumnSelect(e,n){zt.debug("handleFilterColumnSelect",this.isOverlayShown());const{links:s,localDashboardId:i,setActiveTool:o,setDashboardIsolatedLinkerPanelId:r}=this.props,l=te.getIdFromPanel(e),a=s.filter(d=>{var c,u;return((c=d.start)==null?void 0:c.panelId)===l||((u=d.end)==null?void 0:u.panelId)===l});if(!this.isOverlayShown()&&l!=null){o(hn.LINKER),r(i,l),a.length===0&&this.columnSelected(e,n,!0,l);return}this.columnSelected(e,n,!0)}handleColumnsChanged(e,n){zt.debug("handleColumnsChanged",e,n);const{links:s}=this.props,i=te.getIdFromPanel(e);if(i==null){zt.error("Invalid panelId",e);return}const o=s.filter(({start:r,end:l})=>r.panelId===i&&ni.findColumn(n,r)==null||l!=null&&l.panelId===i&&ni.findColumn(n,l)==null);this.deleteLinks(o)}handleGridColumnSelect(e,n){this.columnSelected(e,n)}columnSelected(e,n,s=!1,i){if(i===void 0&&!this.isOverlayShown())return;const{isolatedLinkerPanelId:o}=this.props,{linkInProgress:r}=this.state,l=te.getIdFromPanel(e);if(l==null)return;const a=te.getComponentNameFromPanel(e),{name:d,type:c}=n;if(r==null||r.start==null){const u={id:ze.generate(),start:{panelId:l,panelComponent:a,columnName:d,columnType:c},type:"invalid",isReversed:s};zt.debug("starting link",u),this.setState({linkInProgress:u})}else{const{start:u,id:m,isReversed:p}=r,g={panelId:l,panelComponent:a,columnName:d,columnType:c},f=ni.getLinkType(p!==void 0&&p?g:u,p!==void 0&&p?u:g,i!=null?i:o);switch(f){case"invalid":zt.debug("Ignore invalid link connection",r,g);return;case"filterSource":{const{links:b}=this.props,w=p!==void 0&&p?u.panelId:g.panelId,T=b.filter(({end:y})=>(y==null?void 0:y.panelId)===w);this.deleteLinks(T);break}}const C={start:p!==void 0&&p?g:u,end:p!==void 0&&p?u:g,id:m,type:f};zt.info("creating link",C),this.setState({linkInProgress:void 0},()=>{this.addLinks([C])})}}unsetFilterValueForLink(e){const{panelManager:n}=this.props;if(e.end){const{end:s}=e,{panelId:i,columnName:o,columnType:r}=s,l=n.getOpenedPanelById(i);l?$h(l)?l.unsetFilterValue(o,r):zt.debug("endPanel.unsetFilterValue not implemented",l):zt.debug("endPanel no longer exists, ignoring unsetFilterValue",i)}}setPanelFilterMap(e,n){zt.debug("Set filter data for panel:",e,n);const{panelManager:s}=this.props,i=s.getOpenedPanelById(e);i?$h(i)?i.setFilterMap(n):zt.debug("panel.setFilterMap not implemented",e,i):zt.debug("panel no longer exists, ignoring setFilterMap",e)}addLinks(e){const{addDashboardLinks:n,localDashboardId:s}=this.props;n(s,e)}deleteLinks(e,n=!1){const{localDashboardId:s}=this.props;if(e.forEach(i=>this.unsetFilterValueForLink(i)),n){const{setDashboardLinks:i}=this.props;i(s,[])}else if(e.length>0){const{deleteDashboardLinks:i}=this.props;i(s,e.map(({id:o})=>o))}}handleAllLinksDeleted(){const{links:e,isolatedLinkerPanelId:n}=this.props;if(n===void 0)this.deleteLinks(e,!0);else{const s=e.filter(i=>{var o,r;return((o=i==null?void 0:i.start)==null?void 0:o.panelId)===n||((r=i==null?void 0:i.end)==null?void 0:r.panelId)===n});this.deleteLinks(s)}this.setState({linkInProgress:void 0})}handleLinkDeleted(e){const{links:n}=this.props,s=n.find(i=>i.id===e);s?this.deleteLinks([s]):zt.error("Unable to find link to delete",e)}handleUpdateValues(e,n){const s=te.getIdFromPanel(e),{links:i,timeZone:o}=this.props,r=new Map;for(let l=0;l<i.length;l+=1){const{start:a,end:d}=i[l];if(a.panelId===s&&d!=null){const{panelId:c,columnName:u,columnType:m}=d,p=r.has(c)?r.get(c):new Map,{isExpandable:g,isGrouped:f}=n[a.columnName];let{value:C}=n[a.columnName],b=`${C}`;C===null&&g&&f&&(C=void 0),m!=null&&P.isDateType(m)&&(b=new dt({timeZone:o,showTimeZone:!1,showTSeparator:!0,defaultDateTimeFormatString:ps.FULL_DATE_FORMAT}).format(C)),p.set(u,{columnType:m,text:b,value:C}),r.set(c,p)}}r.forEach((l,a)=>{this.setPanelFilterMap(a,l)})}handlePanelCloned(e,n){const{links:s}=this.props,i=te.getIdFromPanel(e),o=n.id;if(i!=null){const r=ni.cloneLinksForPanel(s,i,o);this.addLinks(r)}}handlePanelClosed(e){zt.debug(`Panel ${e} closed, deleting links.`),this.deleteLinksForPanelId(e)}handleLayoutStateChanged(){this.forceUpdate()}handleStateChange(){this.forceUpdate()}handleExited(){const{localDashboardId:e,setDashboardIsolatedLinkerPanelId:n}=this.props;n(e,void 0)}deleteLinksForPanelId(e){const{links:n}=this.props;for(let s=0;s<n.length;s+=1){const i=n[s],{start:o,end:r,id:l}=i;(o.panelId===e||(r==null?void 0:r.panelId)===e)&&this.handleLinkDeleted(l)}}isOverlayShown(){const{activeTool:e}=this.props;return e===hn.LINKER}updateSelectionValidators(){const{activeTool:e,setDashboardColumnSelectionValidator:n,localDashboardId:s}=this.props;switch(e){case hn.LINKER:n(s,this.isColumnSelectionValid);break;default:n(s,void 0);break}}updateLinkInProgressType(e,n="invalid"){this.setState({linkInProgress:{...e,type:n}})}isColumnSelectionValid(e,n){const{linkInProgress:s}=this.state,{isolatedLinkerPanelId:i}=this.props;if((s==null?void 0:s.start)==null)return!0;if(n==null)return this.updateLinkInProgressType(s),!1;const{isReversed:o,start:r}=s,l=te.getIdFromPanel(e);if(l==null)return!1;const a={panelId:l,panelComponent:te.getComponentNameFromPanel(e),columnName:n.name,columnType:n.type},d=o!==void 0&&o?ni.getLinkType(a,r,i):ni.getLinkType(r,a,i);return this.updateLinkInProgressType(s,d),d!=="invalid"}render(){const{links:e,isolatedLinkerPanelId:n,panelManager:s}=this.props,{linkInProgress:i}=this.state,o=this.isOverlayShown(),r=i!=null&&i.start!=null,l=n===void 0?"Click a column source, then click a column target to create a filter link. Remove a filter link by clicking again to erase. Click done when finished.":"Create a link between the source column button and a table column by clicking on one, then the other. Remove the link by clicking it directly. Click done when finished.";return h(pe,{children:h(ut,{in:o,timeout:Et.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,onExited:this.handleExited,children:h(Up,{disabled:r,panelManager:s,links:this.getCachedLinks(e,i,n),messageText:l,onLinkDeleted:this.handleLinkDeleted,onAllLinksDeleted:this.handleAllLinksDeleted,onDone:this.handleDone,onCancel:this.handleCancel})})})}}const i1=n1(s1),o1=t=>{Hs(t);const{id:e,layout:n,panelManager:s}=t;return h(i1,{layout:n,localDashboardId:e,panelManager:s})},Ya=class{static getNewMarkdownTitle(t){let e=`${Ya.DEFAULT_TITLE}`,n=0;for(;t.indexOf(e)>=0;)n+=1,e=`${Ya.DEFAULT_TITLE}-${n}`;return e}};let ko=Ya;ko.DEFAULT_TITLE="Note";ko.DEFAULT_CONTENT=`# Markdown Note
|
|
40
40
|
|
|
41
41
|
This note can be edited using **markdown** for styling.`;const r1=t=>{Hs(t);const{id:e,layout:n,panelManager:s,registerComponent:i}=t,o=S.exports.useCallback(l=>{const{title:a,componentState:d,props:c}=l;let{panelState:u=null}=c;return d!=null&&({panelState:u=null}=d),a==null||u==null||u.content==null||u.content.length===0||u.content===ko.DEFAULT_CONTENT?null:xd(l)},[]),r=S.exports.useCallback(({title:l="",metadata:a={},id:d=ze.generate(),focusElement:c=te.DEFAULT_FOCUS_SELECTOR,createNewStack:u=!1,dragEvent:m=null}={})=>{const p=s.getOpenedPanelConfigsOfType(bo.COMPONENT),g=s.getClosedPanelConfigsOfType(bo.COMPONENT),f=p.map(y=>{var E;return(E=y.title)!=null?E:""}),C=l!=null&&l!==""?l:ko.getNewMarkdownTitle(f),b=g.length>0?null:ko.DEFAULT_CONTENT,w={type:"react-component",component:bo.COMPONENT,props:{id:d,metadata:a,panelState:{content:b},localDashboardId:e},title:C,id:d},{root:T}=n;te.openComponent({root:T,config:w,focusElement:c,createNewStack:u,dragEvent:m})},[e,n,s]);return S.exports.useEffect(function(){const a=[i(bo.COMPONENT,bo,_d,o)];return()=>{a.forEach(d=>d())}},[o,i]),Ke(n.eventHub,Tp.OPEN,r),h(pe,{})},l1=t=>{Hs(t);const{hydrate:e,id:n,layout:s,registerComponent:i}=t,o=S.exports.useCallback(({dragEvent:r,fetch:l,panelId:a=ze.generate(),widget:d})=>{const{name:c,type:u}=d;if(u!==dh.VariableType.PANDAS)return;const m={name:c,table:c},p=()=>l().then(C=>qd.makeModel(C)),g={type:"react-component",component:_o.COMPONENT,props:{localDashboardId:n,id:a,metadata:m,makeModel:p},title:c,id:a},{root:f}=s;te.openComponent({root:f,config:g,dragEvent:r})},[n,s]);return S.exports.useEffect(function(){const l=[i(_o.COMPONENT,_o,e)];return()=>{l.forEach(a=>a())}},[e,i]),Ke(s.eventHub,Me.OPEN,o),h(pe,{})};class Cn{}Cn.DROPDOWN_FILTER="ControlType.DROPDOWN_FILTER";Cn.INPUT_FILTER="ControlType.INPUT_FILTER";Cn.MARKDOWN="ControlType.MARKDOWN";Cn.FILTER_SET_MANAGER="ControlType.FILTER_SET_MANAGER";const a1=R.exports.shape({state:R.exports.shape({panelState:R.exports.shape({})})}),d1=R.exports.shape({panelId:R.exports.string.isRequired,columnName:R.exports.string.isRequired,columnType:R.exports.string.isRequired}),Yh=R.exports.shape({panelId:R.exports.string.isRequired,columnName:R.exports.string.isRequired}),Bp=R.exports.shape({start:Yh,end:Yh,id:R.exports.string,isReversed:R.exports.bool}),c1=R.exports.arrayOf(Bp),h1=R.exports.shape({name:R.exports.string.isRequired,operateAs:R.exports.string.isRequired,groups:R.exports.arrayOf(R.exports.string).isRequired,permissions:R.exports.shape({isSuperUser:R.exports.bool.isRequired,isQueryViewOnly:R.exports.bool.isRequired,isNonInteractive:R.exports.bool.isRequired,canUsePanels:R.exports.bool.isRequired,canCreateDashboard:R.exports.bool.isRequired,canCreateCodeStudio:R.exports.bool.isRequired,canCreateQueryMonitor:R.exports.bool.isRequired,canCopy:R.exports.bool.isRequired,canDownloadCsv:R.exports.bool.isRequired}).isRequired});Object.freeze({LinkPoint:d1,Link:Bp,Links:c1,Panel:a1,User:h1});const u1=(t,e)=>t[e]===null?null:R.exports.bool,m1=(t,e)=>t[e]===null?null:R.exports.string;Object.freeze({nullableBoolean:u1,nullableString:m1});X.module("StorageTableViewportUpdater");class Xh{static makeSortConfig(e,n){return{column:e,direction:n}}static makeFilterConfig(e){const n=[],s=[];return e.forEach((i,o)=>{n.push(i),o>0&&s.push(Yt.and)}),{filterItems:n,filterOperators:s}}static combineFilterConfigs(e,n,s=Yt.and){return{filterItems:[...e.filterItems,...n.filterItems],filterOperators:[...e.filterOperators,s,...n.filterOperators]}}static makeFilterItem(e,n,s){return{columnName:e,type:n,value:s}}}const Sa=X.module("PouchStorageTable"),p1="Deephaven.";ou.plugin(ug);function g1(t,e){switch(t){case q.in:case q.contains:return{$regex:new RegExp(`${e}`)};case q.inIgnoreCase:return{$regex:new RegExp(`${e}`,"i")};case q.eq:return{$eq:e};case q.notEq:return{$neq:e};case q.greaterThan:return{$gt:e};case q.greaterThanOrEqualTo:return{$gte:e};case q.lessThan:return{$lt:e};case q.lessThanOrEqualTo:return{$lte:e};case q.startsWith:return{$regex:new RegExp(`^(?${e}).*`)};default:throw new Error(`Unsupported type: ${t}`)}}function f1(t){const{filterItems:e,filterOperators:n}=t;let s=null;for(let i=0;i<e.length;i+=1){const o=e[i],{columnName:r,type:l,value:a}=o,d={[r]:g1(l,a)};if(i===0)s=d;else if(s!==null&&i-1<n.length){const c=n[i-1];if(c===Yt.and)s={$and:[s,d]};else if(c===Yt.or)s={$or:[s,d]};else throw new Error(`Unexpected filter operator ${c}, ${d}`)}}if(s==null)throw new Error(`Invalid filter config ${t}`);return s}function wa(t=[]){return{$and:[...t.map(e=>f1(e)),{name:{$gt:null}},{id:{$gt:null}}]}}function C1(t,e=!1){var n;return[{id:e?"desc":"asc"},...(n=t==null?void 0:t.map(s=>({[s.column]:s.direction})))!=null?n:[]]}class b1{constructor(e){this.listeners=[],this.itemListeners=new Map,this.currentSize=0,this.currentReverse=!1,this.currentFilter=null,this.currentSort=null,this.db=new ou(`${p1}${e}`),this.db._remote=!1,this.db.changes({live:!0,since:"now",include_docs:!0}).on("change",this.dbUpdate.bind(this)),this.db.createIndex({index:{fields:["id","name"]}}),this.refreshInfo()}onUpdate(e){return this.listeners=[...this.listeners,e],()=>{this.listeners=this.listeners.filter(n=>n!==e)}}onItemUpdate(e,n){return this.itemListeners.has(e)||this.itemListeners.set(e,[]),this.itemListeners.set(e,[...this.itemListeners.get(e),n]),this.refreshItem(e),()=>{this.itemListeners.set(e,this.itemListeners.get(e).filter(s=>s!==n))}}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}async getViewportData(){var e;return this.viewportUpdatePromise||this.refreshData(),(e=this.viewportUpdatePromise)!=null?e:Promise.resolve({items:[],offset:0})}async put(e){const n={...e,_id:e.id};return await this.db.put(n),n}sendUpdate(){var s;const{listeners:e}=this,n=(s=this.currentViewportData)!=null?s:{items:[],offset:0};for(let i=0;i<e.length;i+=1)e[i](n)}sendItemUpdate(e){const n=this.itemListeners.get(e.id);if(n!==void 0)for(let s=0;s<n.length;s+=1)n[s](e)}dbUpdate(e){Sa.debug("Update received",e),this.refreshInfo(),e.doc!==void 0&&this.sendItemUpdate(e.doc),this.refreshData()}async refreshInfo(){var e,n;try{(e=this.infoUpdatePromise)==null||e.cancel(),this.infoUpdatePromise=Ee.makeCancelable(this.db.find({selector:wa((n=this.currentFilter)!=null?n:[]),fields:[]}));const s=await this.infoUpdatePromise;this.currentSize=s.docs.length,this.sendUpdate()}catch(s){if(!Ee.isCanceled(s))throw Sa.error("Unable to refreshInfo",s),s}}async refreshData(){var e,n;if(!!this.currentViewport)try{const{currentViewport:s}=this,i=C1(this.currentSort,this.currentReverse);(e=this.viewportUpdatePromise)==null||e.cancel(),this.viewportUpdatePromise=Ee.makeCancelable(this.db.find({selector:wa((n=this.currentFilter)!=null?n:[]),skip:s.top,limit:s.bottom-s.top+1,sort:i,fields:["id","name"]}).then(r=>({items:r.docs,offset:s.top})));const o=await this.viewportUpdatePromise;return this.currentViewportData=o,this.sendUpdate(),o}catch(s){if(!Ee.isCanceled(s))throw Sa.error("Unable to refreshData",s),s}}async refreshItem(e){const s=(await this.db.find({selector:{id:e},limit:1})).docs[0];return s!==void 0&&this.sendItemUpdate(s),s}async getSnapshot(e){const n=new Map,s=[{id:this.currentReverse?"desc":"asc"}];return await Promise.all(e.map(async([i,o])=>{var l;const r=o-i+1;return this.db.find({selector:wa((l=this.currentFilter)!=null?l:[]),skip:i,limit:r,sort:s,fields:["id","name"]}).then(a=>{for(let d=0;d<r;d+=1){const c=i+d;n.set(c,a.docs[d])}})})),n}}class jh extends b1{constructor(e){super(`CommandHistoryStorage.${e}`)}setSearch(e){this.setFilters(e?[Xh.makeFilterConfig([Xh.makeFilterItem("name",q.contains,e)])]:[])}}const Qh=X.module("PouchCommandHistoryStorage");class S1{constructor(){this.updateTableMap=new Map}getUpdateTable(e){return this.updateTableMap.has(e)||this.updateTableMap.set(e,new jh(e)),this.updateTableMap.get(e)}async getTable(e){return new jh(e)}async addItem(e,n,s,i){return this.updateItem(e,{id:`${new Date().getTime()}`,name:s,data:i})}async updateItem(e,n){const s=this.getUpdateTable(e),i=await s.refreshItem(n.id),o={...i!=null?i:{},...n};return Qh.debug("Updating item",o),await s.put(o),Qh.debug("Update saved"),n}listenItem(e,n,s){return this.getUpdateTable(e).onItemUpdate(n,s)}}const $p="SET_LAYOUT_STORAGE",w1=t=>({type:$p,payload:t}),Wp="/ide/assets/community-wordmark-app.d2c5c1eb.svg";const xs=X.module("FormattingSectionContent");function v1(t){return t.formatString!=null}const at=class extends S.exports.PureComponent{constructor(t){super(t),this.getCachedColumnTypeOptions=Te(()=>at.renderColumnTypeOptions()),this.getCachedDateTimeFormatOptions=Te((c,u,m,p=!1,g=null)=>{const{timestampAtMenuOpen:f}=this.state;return at.renderDateTimeOptions(f,c,u,m,p,g)}),this.debouncedCommitChanges=je(this.commitChanges.bind(this),at.inputDebounceTime),this.handleDefaultDateTimeFormatChange=this.handleDefaultDateTimeFormatChange.bind(this),this.handleDefaultDecimalFormatChange=this.handleDefaultDecimalFormatChange.bind(this),this.handleDefaultIntegerFormatChange=this.handleDefaultIntegerFormatChange.bind(this),this.handleFormatRuleEntered=this.handleFormatRuleEntered.bind(this),this.handleFormatRuleChange=this.handleFormatRuleChange.bind(this),this.handleFormatRuleCreate=this.handleFormatRuleCreate.bind(this),this.handleFormatRuleDelete=this.handleFormatRuleDelete.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{formatter:e,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,showTimeZone:o,showTSeparator:r,timeZone:l,truncateNumbersWithPound:a}=t,d=e.map((c,u)=>({...c,id:u}));this.containerRef=Y.createRef(),this.addFormatRuleButtonRef=Y.createRef(),this.lastFormatRuleIndex=d.length,this.state={formatSettings:d,formatRulesChanged:!1,showTimeZone:o,showTSeparator:r,timeZone:l,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,truncateNumbersWithPound:a,timestampAtMenuOpen:new Date}}static focusFirstInputInContainer(t){const e=t==null?void 0:t.querySelector("input, select, textarea");e&&e.focus()}static isSameOptions(t,e){return t.defaultFormatString===e.defaultFormatString}static isSameDecimalOptions(t,e){return at.isSameOptions(t,e)}static isSameIntegerOptions(t,e){return at.isSameOptions(t,e)}static isValidColumnName(t){return t!==""&&gs.isValidColumnName(t)}static isValidFormat(t,e){if(!t||e.formatString==null||!v1(e))return!1;switch(t){case"datetime":return dt.isValid(e);case"decimal":return Ae.isValid(e);case"int":return it.isValid(e);default:return xs.warn("Trying to validate format of unknown type"),!0}}static removeFormatRuleExtraProps(t){const{id:e,isNewRule:n,...s}=t;return s}static isFormatRuleValidForSave(t){return at.isValidColumnName(t.columnName)&&at.isValidFormat(t.columnType,t.format)}static renderTimeZoneOptions(){return Rn.TIME_ZONES.map(e=>{const{label:n,value:s}=e;return h("option",{value:s,children:n},s)})}static renderColumnTypeOptions(){const e=[{value:P.dataType.DATETIME,label:"DateTime"},{value:P.dataType.DECIMAL,label:"Decimal"},{value:P.dataType.INT,label:"Integer"}].map(n=>h("option",{value:n.value,children:n.label},`key-columnType-${n.value}`));return v(pe,{children:[h("option",{disabled:!0,value:"",children:"Select Type"},"key-columnType-placeholder"),e]})}static renderDateTimeOptions(t,e,n,s,i,o){const r=new un([],{timeZone:e,showTimeZone:n,showTSeparator:s}),l=i?dt.getGlobalFormats(n,s):dt.getFormats(n,s);return o&&!l.includes(o)&&l.unshift(o),l.map(a=>{const d=dt.makeFormat("",a,dt.TYPE_GLOBAL);return h("option",{value:a,children:r.getFormattedString(t,P.dataType.DATETIME,"",d)},a)})}componentDidMount(){at.focusFirstInputInContainer(this.containerRef.current)}componentWillUnmount(){this.debouncedCommitChanges.flush()}isDuplicateRule(t){var n;const{formatSettings:e}=this.state;return(n=e.some(s=>s.id!==t.id&&s.columnName===t.columnName&&s.columnType===t.columnType))!=null?n:!1}getAutoIncrementFormatRuleIndex(){const{lastFormatRuleIndex:t}=this;return this.lastFormatRuleIndex+=1,t}handleDefaultDateTimeFormatChange(t){xs.debug("handleDefaultDateTimeFormatChange",t.target.value),this.setState({defaultDateTimeFormat:t.target.value},()=>{this.debouncedCommitChanges()})}handleDefaultDecimalFormatChange(t){xs.debug("handleDefaultDecimalFormatChange",t.target.value),this.setState({defaultDecimalFormatOptions:{defaultFormatString:t.target.value}},()=>{this.debouncedCommitChanges()})}handleDefaultIntegerFormatChange(t){xs.debug("handleDefaultIntegerFormatChange",t.target.value),this.setState({defaultIntegerFormatOptions:{defaultFormatString:t.target.value}},()=>{this.debouncedCommitChanges()})}handleFormatRuleChange(t,e,n){this.setState(s=>{const{formatSettings:i}=s;A(i);const o=[...i];let r={};e==="columnType"&&(r={format:""});const l={...o[t],...r,[e]:n};return o[t]=l,{formatSettings:o}},()=>{this.debouncedCommitChanges()})}handleFormatRuleCreate(){this.setState(t=>{const{formatSettings:e}=t,n={columnType:P.dataType.DATETIME,columnName:"",format:{},id:this.getAutoIncrementFormatRuleIndex(),isNewRule:!0};return{formatSettings:e!=null?[...e,n]:[n],formatRulesChanged:!0}})}handleFormatRuleDelete(t){this.setState(e=>{const{formatSettings:n}=e;return{formatSettings:n.filter((i,o)=>o!==t),formatRulesChanged:!0}},()=>{this.debouncedCommitChanges()})}handleShowTimeZoneChange(){this.setState(t=>({showTimeZone:!t.showTimeZone}),()=>{this.debouncedCommitChanges()})}handleShowTSeparatorChange(){this.setState(t=>({showTSeparator:!t.showTSeparator}),()=>{this.debouncedCommitChanges()})}handleTimeZoneChange(t){this.setState({timeZone:t.target.value},()=>{this.debouncedCommitChanges()})}handleResetDateTimeFormat(){const{defaults:t}=this.props,{defaultDateTimeFormat:e,showTimeZone:n,showTSeparator:s}=t;xs.debug("handleResetDateTimeFormat"),this.setState({defaultDateTimeFormat:e,showTimeZone:n,showTSeparator:s},()=>{this.debouncedCommitChanges()})}handleResetTimeZone(){const{defaults:t}=this.props,{timeZone:e}=t;xs.debug("handleResetTimeZone"),this.setState({timeZone:e},()=>{this.debouncedCommitChanges()})}handleResetDecimalFormat(){const{defaults:t}=this.props,{defaultDecimalFormatOptions:e}=t;xs.debug("handleResetDecimalFormat"),this.setState({defaultDecimalFormatOptions:e},()=>{this.debouncedCommitChanges()})}handleResetIntegerFormat(){const{defaults:t}=this.props,{defaultIntegerFormatOptions:e}=t;xs.debug("handleResetIntegerFormat"),this.setState({defaultIntegerFormatOptions:e},()=>{this.debouncedCommitChanges()})}handleTruncateNumbersWithPoundChange(){this.setState(t=>({truncateNumbersWithPound:!t.truncateNumbersWithPound}),()=>{this.debouncedCommitChanges()})}handleFormatRuleEntered(t){this.scrollToFormatBlockBottom(),at.focusFirstInputInContainer(t)}commitChanges(){var m;const{formatSettings:t,defaultDateTimeFormat:e,showTimeZone:n,showTSeparator:s,timeZone:i,defaultDecimalFormatOptions:o,defaultIntegerFormatOptions:r,truncateNumbersWithPound:l}=this.state,a=(m=t.filter(at.isFormatRuleValidForSave).map(at.removeFormatRuleExtraProps))!=null?m:[],{settings:d,saveSettings:c}=this.props,u={...d,formatter:a,defaultDateTimeFormat:e,showTimeZone:n,showTSeparator:s,timeZone:i,truncateNumbersWithPound:l};at.isValidFormat(P.dataType.DECIMAL,Ae.makeCustomFormat(o.defaultFormatString))&&(u.defaultDecimalFormatOptions=o),at.isValidFormat(P.dataType.INT,it.makeCustomFormat(r.defaultFormatString))&&(u.defaultIntegerFormatOptions=r),c(u)}scrollToFormatBlockBottom(){var e,n,s,i;const{scrollTo:t}=this.props;t(0,((n=(e=this.addFormatRuleButtonRef.current)==null?void 0:e.offsetHeight)!=null?n:0)+((i=(s=this.addFormatRuleButtonRef.current)==null?void 0:s.offsetTop)!=null?i:0))}getRuleError(t){const e={hasColumnNameError:!1,hasFormatError:!1,message:""},n=[];return t.isNewRule!==void 0&&t.isNewRule||(this.isDuplicateRule(t)&&(e.hasColumnNameError=!0,n.push("Duplicate column name/type combo.")),at.isValidColumnName(t.columnName)||(e.hasColumnNameError=!0,n.push("Column names must start with a letter or underscore and contain only alphanumeric characters or underscores.")),t.format.formatString!==void 0&&t.format.formatString.length===0?(e.hasFormatError=!0,n.push("Empty formatting rule.")):at.isValidFormat(t.columnType,t.format)||(e.hasFormatError=!0,n.push("Invalid formatting rule.")),e.message=n.join(`
|
|
42
|
-
`)),e}renderFormatRule(t,e){const n=`input-${t}-columnName`,s=`input-${t}-columnType`,i=`input-${t}-format`,o=this.getCachedColumnTypeOptions(),r=c=>this.handleFormatRuleChange(t,"columnName",c.target.value),l=()=>this.handleFormatRuleChange(t,"isNewRule",!1),a=c=>this.handleFormatRuleChange(t,"columnType",c.target.value),d=this.getRuleError(e);return v("fieldset",{className:"container-fluid format-rule-container",children:[v("div",{className:"form-row",children:[v("div",{className:"form-group col-7 mb-2",children:[h("label",{htmlFor:n,children:"Column Name"}),h("input",{id:n,className:W("form-control",{"is-invalid":d.hasColumnNameError}),"data-lpignore":!0,type:"text",value:e.columnName,onChange:r,onBlur:l})]}),v("div",{className:"form-group col mb-2",children:[h(z,{kind:"ghost",className:"btn-delete-format-rule float-right",tabIndex:-1,onClick:()=>this.handleFormatRuleDelete(t),icon:_n,tooltip:"Delete"}),h("label",{htmlFor:s,children:"Column Type"}),h("select",{id:s,className:"custom-select",value:e.columnType,onChange:a,children:o})]})]}),h("div",{className:"form-row",children:v("div",{className:"form-group col-12 d-flex mb-2",children:[h("label",{className:"flex-shrink-0 col-form-label mr-3",htmlFor:i,children:"Formatting Rule"}),this.renderFormatRuleInput(t,e.columnType,i,e.format,d.hasFormatError)]})}),h("div",{className:"form-row",children:h("div",{className:"form-group col-12 d-flex mb-2",children:d.message&&h("p",{className:"text-danger",children:d.message})})})]},t)}renderFormatRuleInput(t,e,n,s,i){switch(P.getNormalizedType(e)){case P.dataType.DATETIME:return this.renderDateTimeFormatRuleInput(t,n,s,i);case P.dataType.DECIMAL:return this.renderDecimalFormatRuleInput(t,n,s,i);case P.dataType.INT:return this.renderIntegerFormatRuleInput(t,n,s,i);default:return null}}renderDateTimeFormatRuleInput(t,e,n,s){const{showTimeZone:i,showTSeparator:o,timeZone:r}=this.state,l=n!=null&&n.formatString||"";return v("select",{className:W("custom-select",{"is-invalid":s}),value:l,id:e,onChange:a=>{const d=dt.makeFormat("",a.target.value,dt.TYPE_GLOBAL);this.handleFormatRuleChange(t,"format",d)},children:[h("option",{value:"",disabled:!0,children:"Select format"},"default"),this.getCachedDateTimeFormatOptions(r,i,o)]})}renderIntegerFormatRuleInput(t,e,n,s){const i=n!=null&&n.formatString||"";return h("input",{className:W("form-control","flex-grow-1",{"is-invalid":s}),"data-lpignore":!0,id:e,placeholder:it.DEFAULT_FORMAT_STRING,type:"text",value:i,onChange:o=>{const r=it.makeFormat("",o.target.value,it.TYPE_GLOBAL,void 0);this.handleFormatRuleChange(t,"format",r)}})}renderDecimalFormatRuleInput(t,e,n,s){const i=n!=null&&n.formatString||"";return h("input",{className:W("form-control","flex-grow-1",{"is-invalid":s}),"data-lpignore":!0,id:e,placeholder:Ae.DEFAULT_FORMAT_STRING,type:"text",value:i,onChange:o=>{const r=Ae.makeFormat("",o.target.value,Ae.TYPE_GLOBAL,void 0);this.handleFormatRuleChange(t,"format",r)}})}render(){const{defaults:t}=this.props,{formatRulesChanged:e,formatSettings:n,defaultDateTimeFormat:s,defaultDecimalFormatOptions:i,defaultIntegerFormatOptions:o,timeZone:r,showTimeZone:l,showTSeparator:a,truncateNumbersWithPound:d}=this.state,{defaultFormatString:c=Ae.DEFAULT_FORMAT_STRING}=i!=null?i:{},{defaultFormatString:u=it.DEFAULT_FORMAT_STRING}=o!=null?o:{},m=n.map((w,T)=>h(ut,{classNames:"fade",timeout:Et.transitionMs,onEnter:this.handleFormatRuleEntered,children:this.renderFormatRule(T,w)},w.id)),p=h(z,{kind:"ghost",className:"mb-3",onClick:this.handleFormatRuleCreate,ref:this.addFormatRuleButtonRef,icon:As,children:"Add New Rule"}),g=r===t.timeZone,f=a===t.showTSeparator&&l===t.showTimeZone&&s===t.defaultDateTimeFormat,C=at.isSameDecimalOptions(i,t.defaultDecimalFormatOptions),b=at.isSameIntegerOptions(o,t.defaultIntegerFormatOptions);return v("div",{className:"app-settings-formatting-section",ref:this.containerRef,children:[v("div",{className:"container-fluid p-0",children:[h("div",{children:"Default formatting for column types"}),h("div",{className:"app-settings-menu-description mb-3",children:"Applies a formatting rule to all columns of a set type."}),v("div",{className:"form-row mb-2",children:[h("label",{className:"col-form-label col-3",htmlFor:"select-reset-timezone",children:"Time zone"}),h("div",{className:"col pr-0",children:h("select",{className:"custom-select",value:r,onChange:this.handleTimeZoneChange,id:"select-reset-timezone",children:at.renderTimeZoneOptions()})}),h("div",{className:"col-1 btn-col",children:h(z,{kind:"ghost",icon:_i,onClick:this.handleResetTimeZone,tooltip:"Reset Time Zone",className:W("btn-reset","btn-reset-time-zone",{hidden:g})})})]}),v("div",{className:"form-row mb-2",children:[h("label",{className:"col-form-label col-3",htmlFor:"select-default-time-format",children:"DateTime"}),h("div",{className:"col pr-0",children:h("select",{className:"custom-select",value:s,onChange:this.handleDefaultDateTimeFormatChange,id:"select-default-time-format",children:this.getCachedDateTimeFormatOptions(r,l,a,!0,s)})}),h("div",{className:"col-1 btn-col",children:h(z,{kind:"ghost",icon:_i,onClick:this.handleResetDateTimeFormat,tooltip:"Reset DateTime Options",className:W("btn-reset","btn-reset-date-time",{hidden:f})})})]}),h("div",{className:"form-row",children:h("div",{className:"offset-3 col-9",children:h(Bt,{checked:l!=null?l:null,onChange:this.handleShowTimeZoneChange,children:"Show time zone in dates"})})}),h("div",{className:"form-row mb-3",children:h("div",{className:"offset-3 col-9",children:h(Bt,{checked:a!=null?a:null,onChange:this.handleShowTSeparatorChange,children:"Show 'T' separator"})})}),v("div",{className:"form-row mb-2",children:[h("label",{className:"col-form-label col-3",htmlFor:"default-decimal-format-input",children:"Decimal"}),h("div",{className:"col pr-0",children:h("input",{className:W("form-control","flex-grow-1","default-decimal-format-input",{"is-invalid":!at.isValidFormat(P.dataType.DECIMAL,Ae.makeCustomFormat(c))}),"data-lpignore":!0,placeholder:Ae.DEFAULT_FORMAT_STRING,type:"text",id:"default-decimal-format-input",value:c,onChange:this.handleDefaultDecimalFormatChange})}),h("div",{className:"col-1 btn-col",children:h(z,{kind:"ghost",icon:_i,onClick:this.handleResetDecimalFormat,tooltip:"Reset Decimal Formatting",className:W("btn-reset","btn-reset-decimal",{hidden:C}),"data-testid":"btn-reset-decimal"})})]}),v("div",{className:"form-row mb-2",children:[h("label",{className:"col-form-label col-3",htmlFor:"default-integer-format-input",children:"Integer"}),h("div",{className:"col pr-0",children:h("input",{className:W("form-control","flex-grow-1","default-integer-format-input",{"is-invalid":!at.isValidFormat(P.dataType.INT,it.makeCustomFormat(u))}),"data-lpignore":!0,placeholder:it.DEFAULT_FORMAT_STRING,type:"text",id:"default-integer-format-input",value:u,onChange:this.handleDefaultIntegerFormatChange})}),h("div",{className:"col-1 btn-col",children:h(z,{kind:"ghost",icon:_i,onClick:this.handleResetIntegerFormat,tooltip:"Reset Integer Formatting",className:W("btn-reset","btn-reset-integer",{hidden:b}),"data-testid":"btn-reset-integer"})})]}),h("div",{className:"form-row mb-3",children:h("div",{className:"offset-3 col-9",children:h(Bt,{checked:d!=null?d:null,onChange:this.handleTruncateNumbersWithPoundChange,children:"Truncate numbers with #"})})})]}),h("div",{children:"Default formatting for matched column names"}),h("div",{className:"app-settings-menu-description mb-3",children:"Applies a formatting rule to all columns that match a specified name and type."}),h(mg,{appear:e,enter:e,exit:e,children:m}),p]})}};let cc=at;cc.defaultProps={scrollTo:()=>{},defaults:{defaultDateTimeFormat:dt.DEFAULT_DATETIME_FORMAT_STRING,defaultDecimalFormatOptions:{defaultFormatString:Ae.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:it.DEFAULT_FORMAT_STRING},showTimeZone:!1,showTSeparator:!0,timeZone:dt.DEFAULT_TIME_ZONE_ID}};cc.inputDebounceTime=250;const T1=t=>({formatter:fS(t),defaultDateTimeFormat:mS(t),defaultDecimalFormatOptions:pS(t),defaultIntegerFormatOptions:gS(t),showTimeZone:CS(t),showTSeparator:bS(t),truncateNumbersWithPound:SS(t),timeZone:Il(t),settings:Nt(t)}),E1=Mt(T1,{saveSettings:Td})(cc),y1=()=>{const[t,e]=S.exports.useState(!1),n=()=>{e(!t)};return v(z,{kind:"ghost",onClick:n,icon:If,children:["Legal Notices",v(Uo,{isOpen:t,toggle:n,className:"theme-bg-light",children:[h($o,{toggle:n,children:"Legal Notice"}),v(Bo,{children:[h("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,495; 9,836,494; 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,353,893; 10,346,394; 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; and 10,783,191. Other patents pending."}),v("p",{children:["\xA9 2016-",new Date().getFullYear()," Deephaven Data Labs LLC. Patent Pending."]})]})]})]})},rl=t=>{const{children:e,isExpanded:n,sectionKey:s,title:i,onToggle:o}=t;return v(pe,{children:[h("div",{children:v(z,{kind:"ghost",className:"btn-collapse-trigger",onClick:()=>o(s),children:[h("div",{className:"flex-grow-1",children:i}),h("div",{className:"flex-shrink-0",children:h(j,{transform:n?"flip-v":"",icon:ls})})]})}),h(gd,{in:n,autoFocusOnShow:!0,children:e})]})};rl.propTypes={children:R.exports.node,isExpanded:R.exports.bool.isRequired,sectionKey:R.exports.string.isRequired,title:R.exports.node.isRequired,onToggle:R.exports.func};rl.defaultProps={children:null,onToggle:()=>{}};function I1({shortcut:t,displayText:e,categoryName:n,onChange:s}){const[i,o]=S.exports.useState(e),[r,l]=S.exports.useState(t.getKeyState()),[a,d]=S.exports.useState(!1),[c,u]=S.exports.useState("");S.exports.useEffect(function(){o(e),l(t.getKeyState())},[e,t]),S.exports.useEffect(function(){o(Kt.getDisplayText(r)),t.matchesKeyState(r)&&d(!1)},[r,t]),S.exports.useEffect(function(){if(a){if(!Kt.isValidKeyState(r)){Kt.isAllowedKey(r.keyValue)?u("Must contain a modifier key"):u("Must contain an allowed action key");return}const y=Pe.getConflictingShortcuts(r).filter(E=>E.id.startsWith(n)&&E!==t).map(E=>E.name);if(y.length){u(`Conflicts with ${y.join(", ")}`);return}u("")}else u("")},[a,r,n,t]);function m(T){if(T.stopPropagation(),T.preventDefault(),t.isEditable&&!T.repeat){const y=Kt.getKeyStateFromEvent(T),E=Kt.createKeyState([he.BACKSPACE]);Kt.doKeyStatesMatch(y,E)?l(Kt.NULL_KEY_STATE):l(y)}}function p(T){T.stopPropagation(),T.preventDefault(),t.matchesKeyState(r)||d(!0)}function g(){Ne.disableAllActions()}function f(){Ne.enableAllActions()}function C(){t.setKeyState(r),d(!1),s(t)}function b(){const T=t.getKeyState();l(T),d(!1)}function w(){d(!0),l(t.getDefaultKeyState())}return v(pe,{children:[v("div",{className:"shortcut-item-container",children:[v("label",{className:"shortcut-item-name",children:[t.name,t.tooltip!==void 0&&h(Be,{children:t.tooltip})]}),v("div",{className:"shortcut-item-input-container",children:[h("input",{className:W("form-control",{"is-invalid":c}),onKeyDown:m,onKeyUp:p,onFocus:g,onBlur:f,disabled:!t.isEditable,value:i,readOnly:!0}),!Kt.doKeyStatesMatch(r,t.getDefaultKeyState())&&!c&&h(z,{className:"reset-to-default-button",kind:"ghost",icon:h(j,{icon:_i,transform:{rotate:90,flipX:!0}}),tooltip:"Reset to default",onClick:w})]})]}),a&&v("div",{className:W("shortcut-item-message-container",{"is-invalid":c}),children:[h("div",{className:"shortcut-item-message",children:c}),v("div",{className:"shortcut-item-message-buttons",children:[Kt.isValidKeyState(r)&&h(z,{kind:"ghost",onClick:C,children:"Confirm"}),h(z,{kind:"ghost",onClick:b,children:"Undo"})]})]})]})}function R1({shortcutOverrides:t={},settings:e,saveSettings:n}){const s=S.exports.useCallback(l=>{const a=Kt.isMacPlatform,d={mac:{...t.mac},windows:{...t.windows}},c=a?d.mac:d.windows;l.forEach(u=>{u.isDefault()?delete c[u.id]:c[u.id]=u.getKeyState()}),n({...e,shortcutOverrides:d})},[e,n,t]);let i=Array.from(Pe.shortcutsByCategory.entries()).map(([l,a])=>({name:l,shortcuts:a}));const o=i.findIndex(l=>l.name.toUpperCase()==="GLOBAL"),r=i.splice(o,1);return i=i.concat(r),v(pe,{children:[h("div",{className:"app-settings-menu-description",children:"Customize shortcuts below. Assigning shortcuts that conflict with the browser or IDE shortcuts may cause unintended behavior"}),i.map(l=>h(D1,{name:l.name,shortcuts:l.shortcuts,saveShortcutOverrides:s},l.name))]})}function D1({name:t,shortcuts:e,saveShortcutOverrides:n}){function s(a){return a.split("_").map(d=>`${d[0].toUpperCase()}${d.slice(1).toLowerCase()}`).join(" ")}const[i,o]=S.exports.useState(e);function r(a){const d=i.filter(u=>u!==a&&!u.isNull()&&u.matchesKeyState(a.getKeyState()));d.forEach(u=>u.setToNull());const c=[a,...d];n(c),o(u=>[...u])}const l=S.exports.useMemo(()=>i.map(a=>a.getDisplayText()),[i]);return v("div",{className:"mt-3",children:[h("div",{className:"font-weight-bold",children:s(t)}),i.map((a,d)=>h(I1,{shortcut:a,displayText:l[d],categoryName:t,onChange:r},a.id))]})}const M1=t=>({settings:Nt(t),shortcutOverrides:wS(t)}),N1={saveSettings:Td},F1=Mt(M1,N1)(R1),Xa=new Jg,ja=new Wr(Xa);function x1(){X.setLogLevel(parseInt("2",10)),Xa.enable(),ja.enable(),window!=null&&(window.DHLog=X,window.DHLogProxy=Xa,window.DHLogHistory=ja)}const _1="yyyy-MM-dd-HHmmss";function zp(t,e="root",n=new Map([[t,""]])){const s={};return Object.entries(t).forEach(([i,o])=>{try{JSON.stringify(o),s[i]=o}catch{const l=o;if(typeof o=="bigint")s[i]=o.toString();else if(n.has(l))s[i]=`Circular ref to ${n.get(l)}`;else{const a=`${e}.${i}`;n.set(l,a),s[i]=zp(o,a,n)}}}),s}function k1(){const t=Ml.getState();return JSON.stringify(zp(t),null,2)}function O1(t){const e={uiVersion:"0.22.2",userAgent:navigator.userAgent,...t};return JSON.stringify(e,null,2)}async function L1(t=`${M.i18n.DateTimeFormat.format(_1,new Date)}_support_logs`,e){const n=new ru,s=n.folder(t);s.file("console.txt",ja.getFormattedHistory()),s.file("redux.json",k1()),s.file("metadata.json",O1(e));const i=await n.generateAsync({type:"blob"}),o=document.createElement("a");o.href=URL.createObjectURL(i),o.download=`${t}.zip`,o.click()}const si=class extends S.exports.Component{constructor(t){super(t),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.menuContentRef=Y.createRef(),this.state={expandedSectionKey:si.FORMATTING_SECTION_KEY}}static focusFirstInputInContainer(t){const e=t==null?void 0:t.querySelector("input, select, textarea");e&&e.focus()}componentDidMount(){si.focusFirstInputInContainer(this.menuContentRef.current)}isSectionExpanded(t){const{expandedSectionKey:e}=this.state;return e===t}handleScrollTo(t,e){var n;(n=this.menuContentRef.current)==null||n.scrollTo(t,e)}handleSectionToggle(t){this.setState(e=>({expandedSectionKey:e.expandedSectionKey===t?void 0:t}))}handleClose(){const{onDone:t}=this.props;t()}handleExportSupportLogs(){const{serverConfigValues:t}=this.props;L1(void 0,Object.fromEntries(t))}render(){const t="0.22.2",e="https://github.com/deephaven/web-client-ui/",n="https://deephaven.io/core/docs/",{serverConfigValues:s}=this.props,i=s.get("barrage.version"),o=s.get("java.version"),r=s.get("deephaven.version"),l=(a,d)=>v(pe,{children:[h("div",{children:a}),h("div",{children:d})]});return v("div",{className:"app-settings-menu",children:[v("header",{className:"app-settings-menu-header",children:[h("div",{className:"flex-spacer"}),h(z,{kind:"ghost",className:"btn-close-settings-menu",onClick:this.handleClose,icon:h(j,{icon:Xi,transform:"grow-4"}),tooltip:"Close"})]}),v("div",{className:"app-settings-menu-content",ref:this.menuContentRef,children:[h("h5",{children:"Settings"}),h("hr",{className:"my-0"}),h(rl,{sectionKey:si.FORMATTING_SECTION_KEY,isExpanded:this.isSectionExpanded(si.FORMATTING_SECTION_KEY),title:v(pe,{children:[h(j,{icon:Hf,transform:"grow-4",className:"mr-2"}),"Formatting & Time zone"]}),onToggle:this.handleSectionToggle,children:h(E1,{scrollTo:this.handleScrollTo})}),h(rl,{sectionKey:si.SHORTCUT_SECTION_KEY,isExpanded:this.isSectionExpanded(si.SHORTCUT_SECTION_KEY),title:v(pe,{children:[h(j,{icon:_f,transform:"grow-2"})," ","Keyboard Shortcuts"]}),onToggle:this.handleSectionToggle,children:h(F1,{})}),v("div",{className:"app-settings-footer",children:[v("div",{className:"app-settings-footer-section",children:[v("div",{className:"app-settings-footer-item",children:[h("div",{className:"font-weight-bold",children:"Support"}),v("div",{children:["GitHub:\xA0",h("a",{href:e,className:"custom-link",target:"_blank",rel:"noopener noreferrer",children:e})]}),h(z,{kind:"tertiary",className:"mt-2 py-2",onClick:this.handleExportSupportLogs,children:"Export Logs"})]}),v("div",{className:"app-settings-footer-item",children:[h("div",{className:"font-weight-bold",children:"Documentation"}),h("a",{target:"_blank",rel:"noreferrer noopener",href:n,className:"custom-link",children:n})]}),v("div",{className:"app-settings-footer-item",children:[h("div",{className:"font-weight-bold",children:"Version"}),v("span",{className:"d-inline-block text-muted",children:[r," ",h(j,{icon:Ef}),h(Be,{interactive:!0,children:v("div",{className:"detailed-server-config",children:[l("Engine Version",r),l("Web UI Version",t),l("Java Version",o),l("Barrage Version",i)]})})]})]}),h("div",{className:"app-settings-footer-item",children:h(y1,{})})]}),h("div",{className:"app-settings-footer-section",children:h("div",{className:"logo",children:h("a",{target:"_blank",rel:"noreferrer noopener",href:"https://deephaven.io",className:"d-inline-block custom-link p-1",children:h("img",{src:Wp,alt:"Deephaven Data Labs",width:"230px"})})})})]})]})]})}};let Qo=si;Qo.defaultProps={onDone:()=>{}};Qo.FORMATTING_SECTION_KEY="SettingsMenu.formatting";Qo.APPLICATION_SECTION_KEY="ApplicationMenu.settings";Qo.SHORTCUT_SECTION_KEY="SettingsMenu.shortcuts";const Zh=10,Li=t=>{const{forwardedProps:{menuItem:{action:e,title:n,disabled:s},iconElement:i,displayShortcut:o,isMouseSelected:r,isKeyboardSelected:l,closeMenu:a}}=t,d=S.exports.useRef(),c=S.exports.useRef(),u=S.exports.useRef(null),[m,p]=S.exports.useState(!1),g=S.exports.useCallback(b=>{d.current!=null&&c.current!=null&&u.current&&(Math.abs(d.current-b.clientX)>=Zh||Math.abs(c.current-b.clientY)>=Zh)&&(p(!0),window.removeEventListener("mousemove",g),a(),e(b),u.current=null)},[e,a]);function f(b){d.current=b.clientX,c.current=b.clientY,u.current=b.target,window.addEventListener("mousemove",g)}function C(b){u.current===b.target&&(p(!0),a(),e(),window.removeEventListener("mousemove",g)),u.current=null}return S.exports.useEffect(function(){return function(){return window.removeEventListener("mousemove",g)}},[g]),v("button",{type:"button",className:W("btn-context-menu",{disabled:s},{active:r&&!s},{"keyboard-active":l&&!s}),onMouseDown:f,onMouseUp:C,disabled:m,children:[h("span",{className:W("icon"),children:i}),h("span",{className:"title",children:n}),h("span",{className:"shortcut",children:o})]})},hc=t=>{const{handleControlSelect:e,handleToolSelect:n,onClearFilter:s}=t,i=S.exports.useMemo(()=>[{title:"Input Filter",icon:Qf,menuElement:h(Li,{}),action:o=>{e(Cn.INPUT_FILTER,o)},order:10},{title:"Dropdown Filter",icon:wu,menuElement:h(Li,{}),action:o=>{e(Cn.DROPDOWN_FILTER,o)},order:15},{title:"Markdown Widget",icon:Nf,menuElement:h(Li,{}),action:o=>{e(Cn.MARKDOWN,o)},order:20},{title:"Filter Sets",icon:ya,menuElement:h(Li,{}),action:o=>{e(Cn.FILTER_SET_MANAGER,o)},order:25},{disabled:!0,menuElement:h("div",{className:"context-menu-group-header",children:"Tools"}),order:30},{title:"Linker",icon:rd,action:()=>{n(hn.LINKER)},order:40,shortcut:ms.LINKER},{disabled:!0,menuElement:h("div",{className:"context-menu-group-header",children:"Actions"}),order:50},{title:"Clear All Filters",icon:qf,action:()=>{s()},order:60,shortcut:dn.TABLE.CLEAR_ALL_FILTERS}],[e,n,s]);return h(Gn,{popperClassName:"controls-menu-popper",actions:i})};hc.propTypes={handleControlSelect:R.exports.func,handleToolSelect:R.exports.func,onClearFilter:R.exports.func};hc.defaultProps={handleControlSelect:()=>{},handleToolSelect:()=>{},onClearFilter:()=>{}};Li.propTypes={forwardedProps:R.exports.shape({iconElement:R.exports.node,displayShortcut:R.exports.string,isMouseSelected:R.exports.bool.isRequired,isKeyboardSelected:R.exports.bool.isRequired,closeMenu:R.exports.func.isRequired,menuItem:R.exports.shape({action:R.exports.func,title:R.exports.string,disabled:R.exports.bool}).isRequired})};Li.defaultProps={forwardedProps:null};const A1=Ps($p,null),P1={layoutStorage:A1},H1=t=>t.layoutStorage,V1=t=>t.serverConfigValues;Object.entries(P1).map(([t,e])=>Ji.register(t,e));const Jh=10,U1=t=>{const{onExportLayout:e,onImportLayout:n,onResetLayout:s,onSelect:i,widgets:o=[]}=t,[r,l]=S.exports.useState(!1),[a,d]=S.exports.useState(""),c=S.exports.useRef(null),u=S.exports.useRef(),m=S.exports.useCallback((y,E)=>{y!=null&&i(y,E)},[i]),p=S.exports.useCallback(y=>{d(y.target.value)},[]),g=S.exports.useCallback(y=>{u.current!=null&&(Math.abs(u.current.x-y.clientX)>=Jh||Math.abs(u.current.y-y.clientY)>=Jh)&&(l(!0),window.removeEventListener("mousemove",g),m(u.current.widget,y),u.current=void 0)},[u,m]),f=S.exports.useCallback((y,E)=>{u.current={x:y.clientX,y:y.clientY,widget:E},window.addEventListener("mousemove",g)},[g]),C=S.exports.useCallback((y,E)=>{var I;window.removeEventListener("mousemove",g),((I=u.current)==null?void 0:I.widget)===E&&(l(!0),m(E)),u.current=void 0},[g,u,m]),b=S.exports.useMemo(()=>o.filter(y=>{var E;return a?(E=y.name)==null?void 0:E.toLowerCase().includes(a.toLowerCase()):!0}),[a,o]).sort((y,E)=>{var I,D,F;return(F=(D=y.name)==null?void 0:D.localeCompare((I=E.name)!=null?I:""))!=null?F:0}),w=S.exports.useMemo(()=>b.map(y=>{var E,I;return h("li",{children:v(z,{kind:"ghost","data-testid":`panel-list-item-${(E=y.name)!=null?E:""}-button`,onMouseDown:D=>{f(D,y)},onMouseUp:D=>{C(D,y)},onKeyDown:D=>{(D.key==="Enter"||D.key===" ")&&m(y)},disabled:r,onClick:()=>{},children:[h(zu,{type:y.type})," ",(I=y.name)!=null?I:""]})},y.name)}),[b,r,f,C,m]),T=S.exports.useMemo(()=>w.length===0?h("span",{children:"No bound variables found."}):null,[w]);return v("div",{className:"widget-list-container d-flex flex-column",children:[h("div",{className:"widget-list-header",children:h(Cs,{value:a,placeholder:"Find Table, Plot or Widget",onChange:p,ref:c})}),v("ul",{className:"widget-list flex-grow-1",children:[T&&h("li",{className:"widget-list-message",children:T}),!T&&w]}),h("div",{children:h("hr",{})}),v("div",{className:"widget-list-footer",children:[v(z,{kind:"ghost",onClick:e,children:[v("div",{className:"fa-md fa-layers",children:[h(j,{mask:Ia,icon:Dc,transform:"right-5 down-5"}),h(j,{icon:Dc,transform:"right-8 down-6"})]}),"Export Layout"]}),v(z,{kind:"ghost",onClick:n,children:[v("div",{className:"fa-md fa-layers",children:[h(j,{mask:Ia,icon:Ea,transform:"right-5 down-5"}),h(j,{icon:Ea,transform:"right-8 down-6"})]}),"Import Layout"]}),h(z,{kind:"ghost",icon:_i,onClick:s,tooltip:"Reset Layout"})]})]})},B1=async(t,e,n)=>{let s,i,o,r;if(Pr(e)?(s=e.settings,i=e.table,o=void 0,r=e.tableSettings):(s={},i="",o=e.figure,r={}),n!==void 0&&(n.tableSettings!=null&&(r=n.tableSettings),n.table!=null&&(i=n.table),n.figure!=null&&(o=n.figure),n.settings!=null&&(s={...s,...n.settings})),o!==void 0){const d={title:o,name:o,type:M.VariableType.FIGURE},c=await t.getObject(d);return zi.makeModel(s,c)}const l={title:o,name:i,type:M.VariableType.TABLE},a=await t.getObject(l);return se.applyTableSettings(a,r,Il(Ml.getState())),zi.makeModelFromSettings(s,a)},$1=async(t,e,n=M.VariableType.TABLE)=>{const{table:s}=e,i={title:s,name:s,type:n},o=await t.getObject(i);return qd.makeModel(o)};const W1=({onAutoFillClick:t=()=>{}})=>v("div",{className:"empty-dashboard-container",children:[v("div",{className:"hint-container",children:[h(j,{icon:cf})," ",h("br",{}),"Use the panel list to add objects from a query."]}),v("div",{className:"empty-dashboard",children:[h("div",{className:"add-panels-hint",children:"Drag Panels Here"}),h(z,{kind:"tertiary",onClick:t,children:"Auto fill objects"})]})]});function z1(t){return t.version===2}function G1(t){return Array.isArray(t)}const xr=X.module("UserLayoutUtils"),K1={layoutConfig:[{type:"column",content:[{type:"row",content:[{type:"stack",content:[{type:"react-component",component:Oi.COMPONENT,title:Oi.TITLE,isClosable:!1},{type:"react-component",component:ol.COMPONENT,title:ol.TITLE,isClosable:!1}]},{type:"stack",width:25,content:[{type:"react-component",component:nl.COMPONENT,title:nl.TITLE,isClosable:!1},{type:"react-component",component:sl.COMPONENT,title:sl.TITLE,isClosable:!1}]}]},{type:"row",content:[{type:"stack",title:"Notebooks",content:[]}]}]}],links:[],filterSets:[],version:2},q1={layoutConfig:[],links:[],filterSets:[],version:2};function Gp(t){if(z1(t))return t;if(G1(t))return{layoutConfig:t,links:[],filterSets:[],version:2};throw new Error(`Unexpected layout import format: ${t}`)}async function Y1(t,e=!0){try{const n=await t.getLayouts();if(n.length>0)try{const s=await t.getLayout(n[0]);return Gp(s)}catch(s){xr.error("Unable to load layout",n[0],":",s),xr.warn("No valid layouts found, falling back to default layout")}}catch(n){xr.error("Unable to fetch layout list",n),xr.warn("Falling back to default layout")}return e?K1:q1}function X1(t){const{filterSets:e,layoutConfig:n,links:s}=t;return{filterSets:e,layoutConfig:n,links:s,version:2}}const Br={exportLayout:X1,getDefaultLayout:Y1,normalizeLayout:Gp},_r=X.module("DownloadServiceWorkerUtils"),Kp=class{static registerOnLoaded(){new URL("/ide/",window.location.href).origin===window.location.origin&&("serviceWorker"in navigator?window.addEventListener("load",()=>{const e=new URL("/ide/download/serviceWorker.js",window.location.href);navigator.serviceWorker.register(e).then(n=>{n.update(),_r.info("Registering service worker on ",e,n)}).catch(n=>{_r.error("Failed to register service worker",n)})}):_r.info("Service worker is not supported."))}static async getServiceWorker(){if("serviceWorker"in navigator){const e=(await navigator.serviceWorker.getRegistrations()).find(n=>n.scope.endsWith(Kp.DOWNLOAD_PATH));if(e&&e.active)return _r.info("Download service worker is active."),e.active;throw new Error("Can not find download service worker.")}throw new Error("Download service worker is not available.")}static unregisterSW(){}};let ll=Kp;ll.DOWNLOAD_PATH="/download/";const qp={react:Y},j1=pg(qp),Q1=gg({requires:j1}),Z1=fg.createRequires(qp),J1=Cg({requires:Z1}),e2=X.module("PluginUtils");class Qa{static loadComponentPlugin(e){if("".split(",").includes(e)){const o=Y.lazy(()=>Tg(()=>import(`./internal/${e}`),[])),r=Y.forwardRef((l,a)=>h(S.exports.Suspense,{fallback:h("div",{children:"Loading Plugin..."}),children:h(o,{ref:a,...l})}));return r.pluginName=e,r.displayName="Local Plugin",r}const n=new URL("/ide/plugins/",`${window.location}`),s=new URL(`${e}.js`,n),i=Y.forwardRef((o,r)=>h(Q1,{url:s,render:({err:l,Component:a})=>{if(l!=null&&l!==""){const d=`Error loading plugin ${e} from ${s} due to ${l}`;return e2.error(d),h("div",{className:"error-message",children:`${d}`})}return h(a,{ref:r,...o})}}));return i.pluginName=e,i.displayName="Plugin",i}static async loadModulePlugin(e){return await J1(e)}static async loadJson(e){return new Promise((n,s)=>{const i=new XMLHttpRequest;i.addEventListener("load",()=>{try{const o=JSON.parse(i.responseText);n(o)}catch(o){s(o)}}),i.addEventListener("error",o=>{s(o)}),i.open("GET",e),i.send()})}}const Lt=X.module("AppMainContainer");class Oo extends S.exports.Component{constructor(e){super(e),this.getDashboardPlugins=me(n=>[...n.entries()].filter(([,{DashboardPlugin:s}])=>s).map(([s,{DashboardPlugin:i}])=>h(i,{},s))),this.handleSettingsMenuHide=this.handleSettingsMenuHide.bind(this),this.handleSettingsMenuShow=this.handleSettingsMenuShow.bind(this),this.handleError=this.handleError.bind(this),this.handleControlSelect=this.handleControlSelect.bind(this),this.handleToolSelect=this.handleToolSelect.bind(this),this.handleClearFilter=this.handleClearFilter.bind(this),this.handleDataChange=this.handleDataChange.bind(this),this.handleAutoFillClick=this.handleAutoFillClick.bind(this),this.handleGoldenLayoutChange=this.handleGoldenLayoutChange.bind(this),this.handleLayoutConfigChange=this.handleLayoutConfigChange.bind(this),this.handleExportLayoutClick=this.handleExportLayoutClick.bind(this),this.handleImportLayoutClick=this.handleImportLayoutClick.bind(this),this.handleImportLayoutFiles=this.handleImportLayoutFiles.bind(this),this.handleLoadTablePlugin=this.handleLoadTablePlugin.bind(this),this.handleResetLayoutClick=this.handleResetLayoutClick.bind(this),this.handleWidgetMenuClick=this.handleWidgetMenuClick.bind(this),this.handleWidgetsMenuClose=this.handleWidgetsMenuClose.bind(this),this.handleWidgetSelect=this.handleWidgetSelect.bind(this),this.handlePaste=this.handlePaste.bind(this),this.hydrateChart=this.hydrateChart.bind(this),this.hydrateGrid=this.hydrateGrid.bind(this),this.hydratePandas=this.hydratePandas.bind(this),this.hydrateDefault=this.hydrateDefault.bind(this),this.openNotebookFromURL=this.openNotebookFromURL.bind(this),this.importElement=Y.createRef(),this.state={contextActions:[{action:()=>{this.handleToolSelect(hn.LINKER)},shortcut:ms.LINKER,isGlobal:!0},{action:()=>{this.sendClearFilter()},shortcut:dn.TABLE.CLEAR_ALL_FILTERS,isGlobal:!0},{action:()=>{Lt.debug("Consume unhandled save shortcut")},shortcut:ms.SAVE,isGlobal:!0}],isPanelsMenuShown:!1,isSettingsMenuShown:!1,widgets:[]}}static handleWindowBeforeUnload(e){e.preventDefault(),e.returnValue=""}static hydrateConsole(e,n){return Pa.hydrate({...e,unzip:s=>ru.loadAsync(s).then(i=>Object.values(i.files))},n)}componentDidMount(){this.initWidgets(),window.addEventListener("beforeunload",Oo.handleWindowBeforeUnload)}componentDidUpdate(e){const{dashboardData:n}=this.props;e.dashboardData!==n&&this.handleDataChange(n)}componentWillUnmount(){this.deinitWidgets(),window.removeEventListener("beforeunload",Oo.handleWindowBeforeUnload)}initWidgets(){const{connection:e}=this.props;if(e.subscribeToFieldUpdates==null){Lt.warn("subscribeToFieldUpdates not supported, not initializing widgets");return}this.widgetListenerRemover=e.subscribeToFieldUpdates(n=>{Lt.debug("Got updates",n),this.setState(({widgets:s})=>{const{updated:i,created:o,removed:r}=n,l=[...i,...r],a=s.filter(c=>!l.some(u=>u.name===c.name));return[...i,...o].forEach(c=>{c.name!=null&&c.name!==""&&a.push(c)}),{widgets:a}})})}deinitWidgets(){var e;(e=this.widgetListenerRemover)==null||e.call(this)}openNotebookFromURL(){const{match:e}=this.props,{notebookPath:n}=e.params;if(n){const{session:s,sessionConfig:i}=this.props;if(s==null||i==null){Lt.error("No session available to open notebook URL",n);return}const o={id:`/${n}`,itemName:`/${n}`},r=i.type,l={value:null,language:r};this.emitLayoutEvent(Ve.SELECT_NOTEBOOK,s,r,l,o,!0)}}sendClearFilter(){this.emitLayoutEvent(He.CLEAR_ALL_FILTERS)}emitLayoutEvent(e,...n){var s;(s=this.goldenLayout)==null||s.eventHub.emit(e,...n)}handleError(e){Ee.isCanceled(e)||Lt.error(e)}handleSettingsMenuHide(){this.setState({isSettingsMenuShown:!1})}handleSettingsMenuShow(){this.setState({isSettingsMenuShown:!0})}handleControlSelect(e,n=null){switch(Lt.debug("handleControlSelect",e),e){case Cn.DROPDOWN_FILTER:this.emitLayoutEvent(He.OPEN_DROPDOWN,{title:"DropdownFilter",type:e,createNewStack:!0,dragEvent:n});break;case Cn.INPUT_FILTER:this.emitLayoutEvent(He.OPEN_INPUT,{title:"InputFilter",type:e,createNewStack:!0,dragEvent:n});break;case Cn.MARKDOWN:this.emitLayoutEvent(Tp.OPEN,{title:"Markdown",type:e,dragEvent:n});break;case Cn.FILTER_SET_MANAGER:this.emitLayoutEvent(He.OPEN_FILTER_SET_MANAGER,{title:"FilterSets",type:e,dragEvent:n});break;default:throw new Error(`Unrecognized control type ${e}`)}}handleToolSelect(e){Lt.debug("handleToolSelect",e);const{activeTool:n,setActiveTool:s}=this.props;s(n===e?hn.DEFAULT:e)}handleClearFilter(){this.sendClearFilter()}handleDataChange(e){const{updateWorkspaceData:n}=this.props,{closed:s,filterSets:i,links:o}=e;n({closed:s,filterSets:i,links:o})}handleGoldenLayoutChange(e){this.goldenLayout=e}handleLayoutConfigChange(e){const{updateWorkspaceData:n}=this.props;n({layoutConfig:e})}handleWidgetMenuClick(){this.setState(({isPanelsMenuShown:e})=>({isPanelsMenuShown:!e}))}handleWidgetSelect(e,n){this.setState({isPanelsMenuShown:!1}),Lt.debug("handleWidgetSelect",e,n),this.openWidget(e,n)}handleWidgetsMenuClose(){this.setState({isPanelsMenuShown:!1})}handleAutoFillClick(){const{widgets:e}=this.state;Lt.debug("handleAutoFillClick",e);const n=e.sort((s,i)=>s.title!=null&&i.title!=null?s.title.localeCompare(i.title):0);for(let s=0;s<n.length;s+=1)this.openWidget(n[s])}handleExportLayoutClick(){Lt.info("handleExportLayoutClick"),this.setState({isPanelsMenuShown:!1});try{const{workspace:e}=this.props,{data:n}=e,s=Br.exportLayout(n);Lt.info("handleExportLayoutClick exportedConfig",s);const i=new Blob([JSON.stringify(s)],{type:"application/json"}),o=M.i18n.DateTimeFormat.format("yyyy-MM-dd-HHmmss",new Date),r=document.createElement("a");r.href=URL.createObjectURL(i),r.download=`deephaven-app-layout-${o}.json`,r.click()}catch(e){Lt.error("Unable to export layout",e)}}handleImportLayoutClick(){Lt.info("handleImportLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.importElement.current!=null&&(this.importElement.current.value="",this.importElement.current.click())}handleResetLayoutClick(){Lt.info("handleResetLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.resetLayout()}handleImportLayoutFiles(e){var n;e.stopPropagation(),e.preventDefault(),e.target.files!=null&&this.importLayoutFile((n=e.target.files)==null?void 0:n[0])}async importLayoutFile(e){try{const{updateDashboardData:n,updateWorkspaceData:s}=this.props,i=await e.text(),o=JSON.parse(i),{filterSets:r,layoutConfig:l,links:a}=Br.normalizeLayout(o);s({layoutConfig:l}),n(Dn,{filterSets:r,links:a})}catch(n){Lt.error("Unable to import layout",n)}}async resetLayout(){const{layoutStorage:e,session:n}=this.props,{filterSets:s,layoutConfig:i,links:o}=await Br.getDefaultLayout(e,n!==void 0),{updateDashboardData:r,updateWorkspaceData:l}=this.props;l({layoutConfig:i}),r(Dn,{filterSets:s,links:o})}handlePaste(e){let n=e.currentTarget.parentElement;for(;n!=null;){if(n.classList.contains("monaco-editor"))return;n=n.parentElement}const{clipboardData:s}=e,i=s.getData("Text"),o=/“|”/g;o.test(i)&&(e.preventDefault(),e.stopPropagation(),document.execCommand("insertText",!1,i.replace(o,'"')))}handleLoadTablePlugin(e){const{plugins:n}=this.props,s=n.get(e);return s!=null&&s.TablePlugin!=null?s.TablePlugin:Qa.loadComponentPlugin(e)}hydrateDefault(e,n){const{connection:s}=this.props,{metadata:i}=e;if((i==null?void 0:i.type)!=null&&((i==null?void 0:i.id)!=null||(i==null?void 0:i.name)!=null)){const o=i.id!=null?{type:i.type,id:i.id}:{type:i.type,name:i.name,title:i.name};return{fetch:()=>s.getObject(o),localDashboardId:n,...e}}return Pa.hydrate(e,n)}hydrateGrid(e,n){return this.hydrateTable(e,n,M.VariableType.TABLE)}hydratePandas(e,n){return this.hydrateTable(e,n,M.VariableType.PANDAS)}hydrateTable(e,n,s=M.VariableType.TABLE){const{connection:i}=this.props;return{...e,getDownloadWorker:ll.getServiceWorker,loadPlugin:this.handleLoadTablePlugin,localDashboardId:n,makeModel:()=>$1(i,e.metadata,s)}}hydrateChart(e,n){const{connection:s}=this.props;return{...e,localDashboardId:n,makeModel:()=>{const{metadata:i,panelState:o}=e;return B1(s,i,o)}}}openWidget(e,n){const{connection:s}=this.props;this.emitLayoutEvent(Me.OPEN,{dragEvent:n,fetch:()=>s.getObject(e),widget:e})}render(){const{activeTool:e,plugins:n,user:s,workspace:i,serverConfigValues:o}=this.props,{data:r}=i,{layoutConfig:l}=r,{permissions:a}=s,{canUsePanels:d}=a,{contextActions:c,isPanelsMenuShown:u,isSettingsMenuShown:m,widgets:p}=this.state,g=this.getDashboardPlugins(n);return v("div",{className:W("app-main-tabs","w-100","h-100","d-flex","flex-column",e?`active-tool-${e.toLowerCase()}`:""),onPaste:this.handlePaste,tabIndex:-1,children:[h("nav",{className:"nav-container",children:v("div",{className:"app-main-top-nav-menus",children:[h("img",{src:Wp,alt:"Deephaven Data Labs",width:"115px",className:"ml-1"}),v("div",{children:[v(z,{kind:"ghost",className:"btn-panels-menu",icon:sC,onClick:()=>{},children:["Controls",h(hc,{handleControlSelect:this.handleControlSelect,handleToolSelect:this.handleToolSelect,onClearFilter:this.handleClearFilter})]}),d&&v(z,{kind:"ghost",className:"btn-panels-menu btn-show-panels","data-testid":"app-main-panels-button",onClick:this.handleWidgetMenuClick,icon:Jf,children:["Panels",h(xn,{isShown:u,className:"panels-menu-popper",onExited:this.handleWidgetsMenuClose,closeOnBlur:!0,interactive:!0,children:h(U1,{widgets:p,onExportLayout:this.handleExportLayoutClick,onImportLayout:this.handleImportLayoutClick,onResetLayout:this.handleResetLayoutClick,onSelect:this.handleWidgetSelect})})]}),h(z,{kind:"ghost",className:W("btn-settings-menu",{"text-warning":s.operateAs!==s.name}),onClick:this.handleSettingsMenuShow,icon:h(j,{icon:Wo,transform:"grow-3 right-1 down-1"}),tooltip:"User Settings"})]})]})}),v(S0,{emptyDashboard:h(W1,{onAutoFillClick:this.handleAutoFillClick}),id:Dn,layoutConfig:l,onGoldenLayoutChange:this.handleGoldenLayoutChange,onLayoutConfigChange:this.handleLayoutConfigChange,onLayoutInitialized:this.openNotebookFromURL,hydrate:this.hydrateDefault,children:[h(e1,{hydrate:this.hydrateGrid,getDownloadWorker:ll.getServiceWorker,loadPlugin:this.handleLoadTablePlugin}),h(YE,{hydrate:this.hydrateChart}),h(XE,{}),h(QE,{hydrateConsole:Oo.hydrateConsole,notebooksUrl:new URL("/notebooks/",`${window.location}`).href}),h(ZE,{}),h(l1,{hydrate:this.hydratePandas}),h(r1,{}),h(o1,{}),g]}),h(ut,{in:m,timeout:Et.transitionMidMs,classNames:"slide-left",mountOnEnter:!0,unmountOnExit:!0,children:h(Qo,{serverConfigValues:o,onDone:this.handleSettingsMenuHide})}),h(oe,{actions:c}),h("input",{ref:this.importElement,type:"file",accept:".json",style:{display:"none"},onChange:this.handleImportLayoutFiles})]})}}const t2=t=>{var e,n;return{activeTool:Rl(t),dashboardData:jt(t,Dn),layoutStorage:H1(t),plugins:TS(t),connection:lE(t,Dn),session:(e=gi(t,Dn))==null?void 0:e.session,sessionConfig:(n=gi(t,Dn))==null?void 0:n.config,user:hm(t),workspace:yl(t),serverConfigValues:V1(t)}},n2=Mt(t2,{setActiveTool:Dl,updateDashboardData:Yn,updateWorkspaceData:Em})(bg(Oo)),s2=()=>v("div",{className:"app",children:[h(n2,{}),h(Ru,{})]}),i2=X.module("LocalWorkspaceStorage"),No=class{static async makeDefaultWorkspaceData(t,e){const{filterSets:n,links:s,layoutConfig:i}=await Br.getDefaultLayout(t,e==null?void 0:e.isConsoleAvailable);return{settings:{defaultDateTimeFormat:dt.DEFAULT_DATETIME_FORMAT_STRING,formatter:[],timeZone:dt.DEFAULT_TIME_ZONE_ID,showTimeZone:!1,showTSeparator:!0,disableMoveConfirmation:!1,defaultDecimalFormatOptions:{defaultFormatString:Ae.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:it.DEFAULT_FORMAT_STRING},truncateNumbersWithPound:!1},layoutConfig:i,closed:[{}],links:s,filterSets:n}}static async makeDefaultWorkspace(t,e){return{data:await No.makeDefaultWorkspaceData(t,e)}}constructor(t){this.layoutStorage=t}async load(t){var e;try{return JSON.parse((e=localStorage.getItem(No.STORAGE_KEY))!=null?e:"")}catch{return i2.info("Unable to load workspace data, initializing to default data"),No.makeDefaultWorkspace(this.layoutStorage,t)}}async save(t){return localStorage.setItem(No.STORAGE_KEY,JSON.stringify(t)),t}};let Yp=No;Yp.STORAGE_KEY="deephaven.WorkspaceStorage";class o2 extends Error{constructor(){super(...arguments),this.isNoConsolesError=!0}}function r2(t){return t.isNoConsolesError}const Ai=X.module("SessionUtils");function l2(){return new URL("/jsapi",`${window.location}`)}function Xp(){const t=l2();return`${t.protocol}//${t.host}`}function a2(){const t=Xp();return Ai.info(`Starting connection to '${t}'...`),new M.IdeConnection(t)}async function d2(t){Ai.info("Getting console types...");const e=await t.getConsoleTypes();if(Ai.info("Available types:",e),e.length===0)throw new o2("No console types available");const n=e[0];Ai.info("Starting session with type",n);const s=await t.startSession(n),i={type:n,id:ze.generate()};return Ai.info("Console session established",i),{session:s,config:i,connection:t}}function c2(){const t=Xp();return Ai.info("createCoreClient",t),new M.CoreClient(t)}class h2{constructor(e,n=""){this.storageService=e,this.root=n}async getLayouts(){return(await this.storageService.listItems(this.root,"*.json")).map(n=>n.basename)}async getLayout(e){const s=await(await this.storageService.loadFile(`${this.root}/${e}`)).text();return JSON.parse(s)}}const vo=X.module("GrpcFileStorageTable"),Za=class{constructor(t,e="",n=e){this.currentSize=0,this.listeners=[],this.childTables=new Map,this.storageService=t,this.baseRoot=e,this.root=n,n===e&&(this.doRefresh=je(this.doRefresh.bind(this),Za.REFRESH_DEBOUNCE))}removeBaseRoot(t){return ce.removeRoot(this.baseRoot,t)}getViewportData(){var t;return this.viewportUpdatePromise||this.refreshInternal(),(t=this.viewportUpdatePromise)!=null?t:Promise.resolve({items:[],offset:0})}getSnapshot(t){throw new Error("Method not implemented.")}get size(){return this.currentSize}setExpanded(t,e){const n=t.split("/");let s=n.shift();if((s===void 0||s==="")&&(s=n.shift()),s===void 0||s==="")throw new Error(`Invalid path: ${t}`);const i=n.join("/");if(e){if(!this.childTables.has(s)){const o=new Za(this.storageService,this.baseRoot,`${this.root}/${s}`);this.childTables.set(s,o)}if(i){const o=this.childTables.get(s);o==null||o.setExpanded(i,e)}}else if(this.childTables.has(s))if(i){const o=this.childTables.get(s);o==null||o.setExpanded(i,e)}else this.childTables.delete(s);this.currentViewport&&this.refreshInternal()}collapseAll(){this.childTables.clear(),this.currentViewport&&this.refreshInternal()}setSearch(t){throw new Error("Method not implemented.")}setViewport(t){this.currentViewport=t,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(t){return this.listeners=[...this.listeners,t],()=>{this.listeners=this.listeners.filter(e=>e!==t)}}doRefresh(t){vo.debug2("doRefresh",this.root),t(this.fetchData())}refresh(){var n;vo.debug2("refresh",this.root),(n=this.viewportUpdatePromise)==null||n.cancel();const t=new Promise(s=>{this.doRefresh(s)}),e=Ee.makeCancelable(t.then(s=>{if(this.viewportUpdatePromise!==e)throw new di;return this.currentViewportData=s,this.sendUpdate(),s}));e.catch(s=>{Ee.isCanceled(s)||vo.error("Error updating viewport",s)}),this.viewportUpdatePromise=e}refreshInternal(){try{this.refresh()}catch(t){Ee.isCanceled(t)||vo.error("Unable to refresh data",t)}}async fetchData(){const{currentViewport:t}=this;if(!t)throw new Error("No viewport set");let n=(await this.storageService.listItems(this.root)).map(s=>({type:s.type,filename:this.removeBaseRoot(s.filename),basename:s.basename,id:this.removeBaseRoot(s.filename),isExpanded:s.type==="directory"?this.childTables.has(s.basename):void 0})).sort((s,i)=>s.type!==i.type?s.type==="directory"?-1:1:s.basename.localeCompare(i.basename));for(let s=0;s<n.length;s+=1){const i=n[s],{basename:o,filename:r}=i;if(r===this.removeBaseRoot(`${this.root}/${o}`)&&i.type==="directory"){const l=this.childTables.get(o);if(l!=null){l.setViewport({top:0,bottom:t.bottom-s});const a=await l.getViewportData();n.splice(s+1,0,...a.items)}}}return this.currentSize=n.length,vo.debug2(this.root,"items",n,t),n=n.slice(t.top,t.bottom),{items:n,offset:t.top}}sendUpdate(){var n;const{listeners:t}=this,e=(n=this.currentViewportData)!=null?n:{items:[],offset:0};for(let s=0;s<t.length;s+=1)t[s](e)}};let jp=Za;jp.REFRESH_DEBOUNCE=50;const u2=X.module("GrpcFileStorage"),Qp=class{constructor(t,e=""){this.tables=[],this.refreshTables=us(()=>{this.tables.forEach(n=>n.refresh())},Qp.REFRESH_THROTTLE),this.storageService=t,this.root=e}removeRoot(t){return ce.removeRoot(this.root,t)}addRoot(t){return ce.addRoot(this.root,t)}async createDirectory(t){return await this.storageService.createDirectory(this.addRoot(t)),this.refreshTables(),{type:"directory",id:t,filename:t,basename:ce.getBaseName(t)}}async getTable(){const t=new jp(this.storageService,this.root);return this.tables.push(t),t}async saveFile(t){const e=dh.storage.FileContents.text(t.content);return await this.storageService.saveFile(this.addRoot(t.filename),e,!0),this.refreshTables(),t}async loadFile(t){const n=await(await this.storageService.loadFile(this.addRoot(t))).text();return{filename:t,basename:ce.getBaseName(t),content:n}}async deleteFile(t){await this.storageService.deleteItem(this.addRoot(t)),this.refreshTables()}async moveFile(t,e){await this.storageService.moveItem(this.addRoot(t),this.addRoot(e)),this.refreshTables()}async info(t){const e=await this.storageService.listItems(this.addRoot(ce.getPath(t)),ce.getBaseName(t));if(e.length===0)throw new sc;if(e.length>1)throw u2.error("More than one matching file found, should never happen.",e),new Error("More than one matching file found");const n=e[0];return{filename:this.removeRoot(n.filename),basename:this.removeRoot(n.basename),id:this.removeRoot(n.filename),type:n.type}}};let Zp=Qp;Zp.REFRESH_THROTTLE=150;const ai=X.module("AppInit");async function m2(){ai.debug("Loading plugins...");try{const t=await Qa.loadJson("/js-plugins/manifest.json");ai.debug("Plugin manifest loaded:",t);const e=[];for(let i=0;i<t.plugins.length;i+=1){const{name:o,main:r}=t.plugins[i],l=`/js-plugins/${o}/${r}`;e.push(Qa.loadModulePlugin(l))}const n=await Promise.all(e),s=new Map;for(let i=0;i<n.length;i+=1){const{name:o}=t.plugins[i];s.set(o,n[i])}return ai.info("Plugins loaded:",s),s}catch(t){return ai.error("Unable to load plugins:",t),new Map}}async function p2(t){let e;try{e=await d2(t)}catch(n){if(!r2(n))throw n}return e}const uc=t=>{const{workspace:e,setActiveTool:n,setCommandHistoryStorage:s,setDashboardData:i,setFileStorage:o,setLayoutStorage:r,setDashboardConnection:l,setDashboardSessionWrapper:a,setPlugins:d,setUser:c,setWorkspace:u,setWorkspaceStorage:m,setServerConfigValues:p}=t,[g,f]=S.exports.useState(),[C,b]=S.exports.useState(!0),w=S.exports.useCallback(async()=>{var D,F;try{ai.info("Initializing Web UI","0.22.2",navigator.userAgent);const x=await m2(),U=a2(),$=await p2(U);U.addEventListener(M.IdeConnection.HACK_CONNECTION_FAILURE,Re=>{var Oe;const{detail:qe}=Re;ai.error("Connection failure",`${JSON.stringify(qe)}`),f(`Unable to connect: ${(Oe=qe.details)!=null?Oe:"Unknown Error"}`)});const _="user",H=c2();await H.login({type:M.CoreClient.LOGIN_TYPE_ANONYMOUS});const L=H.getStorageService(),N=new h2(L,"/layouts"),k=new Zp(L,"/notebooks"),O=new Yp(N),V=new S1,G=await O.load({isConsoleAvailable:$!==void 0}),{data:Q}=G,{settings:J}=Q;J.defaultDecimalFormatOptions===void 0&&(J.defaultDecimalFormatOptions={defaultFormatString:Ae.DEFAULT_FORMAT_STRING}),J.defaultIntegerFormatOptions===void 0&&(J.defaultIntegerFormatOptions={defaultFormatString:it.DEFAULT_FORMAT_STRING}),J.truncateNumbersWithPound===void 0&&(J.truncateNumbersWithPound=!1);const{shortcutOverrides:ve={}}=J,be=Kt.isMacPlatform?(D=ve.mac)!=null?D:{}:(F=ve.windows)!=null?F:{};Object.entries(be).forEach(([Re,qe])=>{var Oe;(Oe=Pe.get(Re))==null||Oe.setKeyState(qe)});const ke={filterSets:Q.filterSets,links:Q.links},ee=await H.getServerConfigValues(),ge=new Map(ee),Se={name:_,operateAs:_,groups:[],permissions:{isSuperUser:!1,isQueryViewOnly:!1,isNonInteractive:!1,canUsePanels:!0,canCreateDashboard:!0,canCreateCodeStudio:!0,canCreateQueryMonitor:!0,canCopy:ge.get("internal.webClient.appInit.canCopy")!=="false",canDownloadCsv:ge.get("internal.webClient.appInit.canDownloadCsv")!=="false"}};n(hn.DEFAULT),p(ge),s(V),i(Dn,ke),o(k),r(N),l(Dn,U),$!==void 0&&a(Dn,$),d(x),c(Se),m(O),u(G)}catch(x){ai.error(x),f(x)}},[n,s,i,o,r,l,a,d,c,u,m,p]),T=S.exports.useCallback(()=>{document.fonts!=null?document.fonts.ready.then(()=>{b(!1)}):b(!1)},[]);S.exports.useEffect(function(){w(),T()},[w,T]);const y=e==null&&g==null||C,E=!y&&g==null,I=g!=null?`${g}`:null;return v(pe,{children:[E&&h(s2,{}),h(Cl,{isLoading:y,isLoaded:E,errorMessage:I}),v("div",{id:"preload-fonts",style:{visibility:"hidden",position:"absolute",top:-1e4},children:[h("p",{className:"fira-sans-regular",children:"preload"}),h("p",{className:"fira-sans-semibold",children:"preload"}),h("p",{className:"fira-mono",children:"preload"})]})]})};uc.propTypes={workspace:R.exports.shape({}),workspaceStorage:R.exports.shape({close:R.exports.func}),setActiveTool:R.exports.func.isRequired,setCommandHistoryStorage:R.exports.func.isRequired,setDashboardData:R.exports.func.isRequired,setFileStorage:R.exports.func.isRequired,setLayoutStorage:R.exports.func.isRequired,setDashboardConnection:R.exports.func.isRequired,setDashboardSessionWrapper:R.exports.func.isRequired,setPlugins:R.exports.func.isRequired,setUser:R.exports.func.isRequired,setWorkspace:R.exports.func.isRequired,setWorkspaceStorage:R.exports.func.isRequired};uc.defaultProps={workspace:null,workspaceStorage:null};const g2=t=>({workspace:yl(t),workspaceStorage:uS(t)}),eu=Mt(g2,{setActiveTool:Dl,setCommandHistoryStorage:IS,setDashboardData:Km,setFileStorage:RS,setLayoutStorage:w1,setDashboardConnection:aE,setDashboardSessionWrapper:dE,setPlugins:MS,setUser:ES,setWorkspace:Tm,setWorkspaceStorage:yS,setServerConfigValues:NS})(uc),f2=()=>h(Sg,{basename:"/ide/",children:v(wg,{children:[h(Ec,{exact:!0,path:"/",component:eu}),h(Ec,{path:"/notebook/:notebookPath+",component:eu}),h(vg,{from:"*",to:"/"})]})});Boolean(window.location.hostname==="localhost"||window.location.hostname==="[::1]"||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));function C2(){"serviceWorker"in navigator&&navigator.serviceWorker.getRegistrations().then(t=>{t.forEach(e=>{e.scope.endsWith("/download/")||e.unregister()})})}x1();ui.render(h(su,{store:Ml,children:h(f2,{})}),document.getElementById("root"));C2();ll.registerOnLoaded();st.init({getWorker:()=>new Eg});window["__react-beautiful-dnd-disable-dev-warnings"]=!0;
|
|
43
|
-
//# sourceMappingURL=index.
|
|
42
|
+
`)),e}renderFormatRule(t,e){const n=`input-${t}-columnName`,s=`input-${t}-columnType`,i=`input-${t}-format`,o=this.getCachedColumnTypeOptions(),r=c=>this.handleFormatRuleChange(t,"columnName",c.target.value),l=()=>this.handleFormatRuleChange(t,"isNewRule",!1),a=c=>this.handleFormatRuleChange(t,"columnType",c.target.value),d=this.getRuleError(e);return v("fieldset",{className:"container-fluid format-rule-container",children:[v("div",{className:"form-row",children:[v("div",{className:"form-group col-7 mb-2",children:[h("label",{htmlFor:n,children:"Column Name"}),h("input",{id:n,className:W("form-control",{"is-invalid":d.hasColumnNameError}),"data-lpignore":!0,type:"text",value:e.columnName,onChange:r,onBlur:l})]}),v("div",{className:"form-group col mb-2",children:[h(z,{kind:"ghost",className:"btn-delete-format-rule float-right",tabIndex:-1,onClick:()=>this.handleFormatRuleDelete(t),icon:_n,tooltip:"Delete"}),h("label",{htmlFor:s,children:"Column Type"}),h("select",{id:s,className:"custom-select",value:e.columnType,onChange:a,children:o})]})]}),h("div",{className:"form-row",children:v("div",{className:"form-group col-12 d-flex mb-2",children:[h("label",{className:"flex-shrink-0 col-form-label mr-3",htmlFor:i,children:"Formatting Rule"}),this.renderFormatRuleInput(t,e.columnType,i,e.format,d.hasFormatError)]})}),h("div",{className:"form-row",children:h("div",{className:"form-group col-12 d-flex mb-2",children:d.message&&h("p",{className:"text-danger",children:d.message})})})]},t)}renderFormatRuleInput(t,e,n,s,i){switch(P.getNormalizedType(e)){case P.dataType.DATETIME:return this.renderDateTimeFormatRuleInput(t,n,s,i);case P.dataType.DECIMAL:return this.renderDecimalFormatRuleInput(t,n,s,i);case P.dataType.INT:return this.renderIntegerFormatRuleInput(t,n,s,i);default:return null}}renderDateTimeFormatRuleInput(t,e,n,s){const{showTimeZone:i,showTSeparator:o,timeZone:r}=this.state,l=n!=null&&n.formatString||"";return v("select",{className:W("custom-select",{"is-invalid":s}),value:l,id:e,onChange:a=>{const d=dt.makeFormat("",a.target.value,dt.TYPE_GLOBAL);this.handleFormatRuleChange(t,"format",d)},children:[h("option",{value:"",disabled:!0,children:"Select format"},"default"),this.getCachedDateTimeFormatOptions(r,i,o)]})}renderIntegerFormatRuleInput(t,e,n,s){const i=n!=null&&n.formatString||"";return h("input",{className:W("form-control","flex-grow-1",{"is-invalid":s}),"data-lpignore":!0,id:e,placeholder:it.DEFAULT_FORMAT_STRING,type:"text",value:i,onChange:o=>{const r=it.makeFormat("",o.target.value,it.TYPE_GLOBAL,void 0);this.handleFormatRuleChange(t,"format",r)}})}renderDecimalFormatRuleInput(t,e,n,s){const i=n!=null&&n.formatString||"";return h("input",{className:W("form-control","flex-grow-1",{"is-invalid":s}),"data-lpignore":!0,id:e,placeholder:Ae.DEFAULT_FORMAT_STRING,type:"text",value:i,onChange:o=>{const r=Ae.makeFormat("",o.target.value,Ae.TYPE_GLOBAL,void 0);this.handleFormatRuleChange(t,"format",r)}})}render(){const{defaults:t}=this.props,{formatRulesChanged:e,formatSettings:n,defaultDateTimeFormat:s,defaultDecimalFormatOptions:i,defaultIntegerFormatOptions:o,timeZone:r,showTimeZone:l,showTSeparator:a,truncateNumbersWithPound:d}=this.state,{defaultFormatString:c=Ae.DEFAULT_FORMAT_STRING}=i!=null?i:{},{defaultFormatString:u=it.DEFAULT_FORMAT_STRING}=o!=null?o:{},m=n.map((w,T)=>h(ut,{classNames:"fade",timeout:Et.transitionMs,onEnter:this.handleFormatRuleEntered,children:this.renderFormatRule(T,w)},w.id)),p=h(z,{kind:"ghost",className:"mb-3",onClick:this.handleFormatRuleCreate,ref:this.addFormatRuleButtonRef,icon:As,children:"Add New Rule"}),g=r===t.timeZone,f=a===t.showTSeparator&&l===t.showTimeZone&&s===t.defaultDateTimeFormat,C=at.isSameDecimalOptions(i,t.defaultDecimalFormatOptions),b=at.isSameIntegerOptions(o,t.defaultIntegerFormatOptions);return v("div",{className:"app-settings-formatting-section",ref:this.containerRef,children:[v("div",{className:"container-fluid p-0",children:[h("div",{children:"Default formatting for column types"}),h("div",{className:"app-settings-menu-description mb-3",children:"Applies a formatting rule to all columns of a set type."}),v("div",{className:"form-row mb-2",children:[h("label",{className:"col-form-label col-3",htmlFor:"select-reset-timezone",children:"Time zone"}),h("div",{className:"col pr-0",children:h("select",{className:"custom-select",value:r,onChange:this.handleTimeZoneChange,id:"select-reset-timezone",children:at.renderTimeZoneOptions()})}),h("div",{className:"col-1 btn-col",children:h(z,{kind:"ghost",icon:_i,onClick:this.handleResetTimeZone,tooltip:"Reset Time Zone",className:W("btn-reset","btn-reset-time-zone",{hidden:g})})})]}),v("div",{className:"form-row mb-2",children:[h("label",{className:"col-form-label col-3",htmlFor:"select-default-time-format",children:"DateTime"}),h("div",{className:"col pr-0",children:h("select",{className:"custom-select",value:s,onChange:this.handleDefaultDateTimeFormatChange,id:"select-default-time-format",children:this.getCachedDateTimeFormatOptions(r,l,a,!0,s)})}),h("div",{className:"col-1 btn-col",children:h(z,{kind:"ghost",icon:_i,onClick:this.handleResetDateTimeFormat,tooltip:"Reset DateTime Options",className:W("btn-reset","btn-reset-date-time",{hidden:f})})})]}),h("div",{className:"form-row",children:h("div",{className:"offset-3 col-9",children:h(Bt,{checked:l!=null?l:null,onChange:this.handleShowTimeZoneChange,children:"Show time zone in dates"})})}),h("div",{className:"form-row mb-3",children:h("div",{className:"offset-3 col-9",children:h(Bt,{checked:a!=null?a:null,onChange:this.handleShowTSeparatorChange,children:"Show 'T' separator"})})}),v("div",{className:"form-row mb-2",children:[h("label",{className:"col-form-label col-3",htmlFor:"default-decimal-format-input",children:"Decimal"}),h("div",{className:"col pr-0",children:h("input",{className:W("form-control","flex-grow-1","default-decimal-format-input",{"is-invalid":!at.isValidFormat(P.dataType.DECIMAL,Ae.makeCustomFormat(c))}),"data-lpignore":!0,placeholder:Ae.DEFAULT_FORMAT_STRING,type:"text",id:"default-decimal-format-input",value:c,onChange:this.handleDefaultDecimalFormatChange})}),h("div",{className:"col-1 btn-col",children:h(z,{kind:"ghost",icon:_i,onClick:this.handleResetDecimalFormat,tooltip:"Reset Decimal Formatting",className:W("btn-reset","btn-reset-decimal",{hidden:C}),"data-testid":"btn-reset-decimal"})})]}),v("div",{className:"form-row mb-2",children:[h("label",{className:"col-form-label col-3",htmlFor:"default-integer-format-input",children:"Integer"}),h("div",{className:"col pr-0",children:h("input",{className:W("form-control","flex-grow-1","default-integer-format-input",{"is-invalid":!at.isValidFormat(P.dataType.INT,it.makeCustomFormat(u))}),"data-lpignore":!0,placeholder:it.DEFAULT_FORMAT_STRING,type:"text",id:"default-integer-format-input",value:u,onChange:this.handleDefaultIntegerFormatChange})}),h("div",{className:"col-1 btn-col",children:h(z,{kind:"ghost",icon:_i,onClick:this.handleResetIntegerFormat,tooltip:"Reset Integer Formatting",className:W("btn-reset","btn-reset-integer",{hidden:b}),"data-testid":"btn-reset-integer"})})]}),h("div",{className:"form-row mb-3",children:h("div",{className:"offset-3 col-9",children:h(Bt,{checked:d!=null?d:null,onChange:this.handleTruncateNumbersWithPoundChange,children:"Truncate numbers with #"})})})]}),h("div",{children:"Default formatting for matched column names"}),h("div",{className:"app-settings-menu-description mb-3",children:"Applies a formatting rule to all columns that match a specified name and type."}),h(mg,{appear:e,enter:e,exit:e,children:m}),p]})}};let cc=at;cc.defaultProps={scrollTo:()=>{},defaults:{defaultDateTimeFormat:dt.DEFAULT_DATETIME_FORMAT_STRING,defaultDecimalFormatOptions:{defaultFormatString:Ae.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:it.DEFAULT_FORMAT_STRING},showTimeZone:!1,showTSeparator:!0,timeZone:dt.DEFAULT_TIME_ZONE_ID}};cc.inputDebounceTime=250;const T1=t=>({formatter:fS(t),defaultDateTimeFormat:mS(t),defaultDecimalFormatOptions:pS(t),defaultIntegerFormatOptions:gS(t),showTimeZone:CS(t),showTSeparator:bS(t),truncateNumbersWithPound:SS(t),timeZone:Il(t),settings:Nt(t)}),E1=Mt(T1,{saveSettings:Td})(cc),y1=()=>{const[t,e]=S.exports.useState(!1),n=()=>{e(!t)};return v(z,{kind:"ghost",onClick:n,icon:If,children:["Legal Notices",v(Uo,{isOpen:t,toggle:n,className:"theme-bg-light",children:[h($o,{toggle:n,children:"Legal Notice"}),v(Bo,{children:[h("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,495; 9,836,494; 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,353,893; 10,346,394; 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; and 10,783,191. Other patents pending."}),v("p",{children:["\xA9 2016-",new Date().getFullYear()," Deephaven Data Labs LLC. Patent Pending."]})]})]})]})},rl=t=>{const{children:e,isExpanded:n,sectionKey:s,title:i,onToggle:o}=t;return v(pe,{children:[h("div",{children:v(z,{kind:"ghost",className:"btn-collapse-trigger",onClick:()=>o(s),children:[h("div",{className:"flex-grow-1",children:i}),h("div",{className:"flex-shrink-0",children:h(j,{transform:n?"flip-v":"",icon:ls})})]})}),h(gd,{in:n,autoFocusOnShow:!0,children:e})]})};rl.propTypes={children:R.exports.node,isExpanded:R.exports.bool.isRequired,sectionKey:R.exports.string.isRequired,title:R.exports.node.isRequired,onToggle:R.exports.func};rl.defaultProps={children:null,onToggle:()=>{}};function I1({shortcut:t,displayText:e,categoryName:n,onChange:s}){const[i,o]=S.exports.useState(e),[r,l]=S.exports.useState(t.getKeyState()),[a,d]=S.exports.useState(!1),[c,u]=S.exports.useState("");S.exports.useEffect(function(){o(e),l(t.getKeyState())},[e,t]),S.exports.useEffect(function(){o(Kt.getDisplayText(r)),t.matchesKeyState(r)&&d(!1)},[r,t]),S.exports.useEffect(function(){if(a){if(!Kt.isValidKeyState(r)){Kt.isAllowedKey(r.keyValue)?u("Must contain a modifier key"):u("Must contain an allowed action key");return}const y=Pe.getConflictingShortcuts(r).filter(E=>E.id.startsWith(n)&&E!==t).map(E=>E.name);if(y.length){u(`Conflicts with ${y.join(", ")}`);return}u("")}else u("")},[a,r,n,t]);function m(T){if(T.stopPropagation(),T.preventDefault(),t.isEditable&&!T.repeat){const y=Kt.getKeyStateFromEvent(T),E=Kt.createKeyState([he.BACKSPACE]);Kt.doKeyStatesMatch(y,E)?l(Kt.NULL_KEY_STATE):l(y)}}function p(T){T.stopPropagation(),T.preventDefault(),t.matchesKeyState(r)||d(!0)}function g(){Ne.disableAllActions()}function f(){Ne.enableAllActions()}function C(){t.setKeyState(r),d(!1),s(t)}function b(){const T=t.getKeyState();l(T),d(!1)}function w(){d(!0),l(t.getDefaultKeyState())}return v(pe,{children:[v("div",{className:"shortcut-item-container",children:[v("label",{className:"shortcut-item-name",children:[t.name,t.tooltip!==void 0&&h(Be,{children:t.tooltip})]}),v("div",{className:"shortcut-item-input-container",children:[h("input",{className:W("form-control",{"is-invalid":c}),onKeyDown:m,onKeyUp:p,onFocus:g,onBlur:f,disabled:!t.isEditable,value:i,readOnly:!0}),!Kt.doKeyStatesMatch(r,t.getDefaultKeyState())&&!c&&h(z,{className:"reset-to-default-button",kind:"ghost",icon:h(j,{icon:_i,transform:{rotate:90,flipX:!0}}),tooltip:"Reset to default",onClick:w})]})]}),a&&v("div",{className:W("shortcut-item-message-container",{"is-invalid":c}),children:[h("div",{className:"shortcut-item-message",children:c}),v("div",{className:"shortcut-item-message-buttons",children:[Kt.isValidKeyState(r)&&h(z,{kind:"ghost",onClick:C,children:"Confirm"}),h(z,{kind:"ghost",onClick:b,children:"Undo"})]})]})]})}function R1({shortcutOverrides:t={},settings:e,saveSettings:n}){const s=S.exports.useCallback(l=>{const a=Kt.isMacPlatform,d={mac:{...t.mac},windows:{...t.windows}},c=a?d.mac:d.windows;l.forEach(u=>{u.isDefault()?delete c[u.id]:c[u.id]=u.getKeyState()}),n({...e,shortcutOverrides:d})},[e,n,t]);let i=Array.from(Pe.shortcutsByCategory.entries()).map(([l,a])=>({name:l,shortcuts:a}));const o=i.findIndex(l=>l.name.toUpperCase()==="GLOBAL"),r=i.splice(o,1);return i=i.concat(r),v(pe,{children:[h("div",{className:"app-settings-menu-description",children:"Customize shortcuts below. Assigning shortcuts that conflict with the browser or IDE shortcuts may cause unintended behavior"}),i.map(l=>h(D1,{name:l.name,shortcuts:l.shortcuts,saveShortcutOverrides:s},l.name))]})}function D1({name:t,shortcuts:e,saveShortcutOverrides:n}){function s(a){return a.split("_").map(d=>`${d[0].toUpperCase()}${d.slice(1).toLowerCase()}`).join(" ")}const[i,o]=S.exports.useState(e);function r(a){const d=i.filter(u=>u!==a&&!u.isNull()&&u.matchesKeyState(a.getKeyState()));d.forEach(u=>u.setToNull());const c=[a,...d];n(c),o(u=>[...u])}const l=S.exports.useMemo(()=>i.map(a=>a.getDisplayText()),[i]);return v("div",{className:"mt-3",children:[h("div",{className:"font-weight-bold",children:s(t)}),i.map((a,d)=>h(I1,{shortcut:a,displayText:l[d],categoryName:t,onChange:r},a.id))]})}const M1=t=>({settings:Nt(t),shortcutOverrides:wS(t)}),N1={saveSettings:Td},F1=Mt(M1,N1)(R1),Xa=new Jg,ja=new Wr(Xa);function x1(){X.setLogLevel(parseInt("2",10)),Xa.enable(),ja.enable(),window!=null&&(window.DHLog=X,window.DHLogProxy=Xa,window.DHLogHistory=ja)}const _1="yyyy-MM-dd-HHmmss";function zp(t,e="root",n=new Map([[t,""]])){const s={};return Object.entries(t).forEach(([i,o])=>{try{JSON.stringify(o),s[i]=o}catch{const l=o;if(typeof o=="bigint")s[i]=o.toString();else if(n.has(l))s[i]=`Circular ref to ${n.get(l)}`;else{const a=`${e}.${i}`;n.set(l,a),s[i]=zp(o,a,n)}}}),s}function k1(){const t=Ml.getState();return JSON.stringify(zp(t),null,2)}function O1(t){const e={uiVersion:"0.22.2",userAgent:navigator.userAgent,...t};return JSON.stringify(e,null,2)}async function L1(t=`${M.i18n.DateTimeFormat.format(_1,new Date)}_support_logs`,e){const n=new ru,s=n.folder(t);s.file("console.txt",ja.getFormattedHistory()),s.file("redux.json",k1()),s.file("metadata.json",O1(e));const i=await n.generateAsync({type:"blob"}),o=document.createElement("a");o.href=URL.createObjectURL(i),o.download=`${t}.zip`,o.click()}const si=class extends S.exports.Component{constructor(t){super(t),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.menuContentRef=Y.createRef(),this.state={expandedSectionKey:si.FORMATTING_SECTION_KEY}}static focusFirstInputInContainer(t){const e=t==null?void 0:t.querySelector("input, select, textarea");e&&e.focus()}componentDidMount(){si.focusFirstInputInContainer(this.menuContentRef.current)}isSectionExpanded(t){const{expandedSectionKey:e}=this.state;return e===t}handleScrollTo(t,e){var n;(n=this.menuContentRef.current)==null||n.scrollTo(t,e)}handleSectionToggle(t){this.setState(e=>({expandedSectionKey:e.expandedSectionKey===t?void 0:t}))}handleClose(){const{onDone:t}=this.props;t()}handleExportSupportLogs(){const{serverConfigValues:t}=this.props;L1(void 0,Object.fromEntries(t))}render(){const t="0.22.2",e="https://github.com/deephaven/web-client-ui/",n="https://deephaven.io/core/docs/",{serverConfigValues:s}=this.props,i=s.get("barrage.version"),o=s.get("java.version"),r=s.get("deephaven.version"),l=(a,d)=>v(pe,{children:[h("div",{children:a}),h("div",{children:d})]});return v("div",{className:"app-settings-menu",children:[v("header",{className:"app-settings-menu-header",children:[h("div",{className:"flex-spacer"}),h(z,{kind:"ghost",className:"btn-close-settings-menu",onClick:this.handleClose,icon:h(j,{icon:Xi,transform:"grow-4"}),tooltip:"Close"})]}),v("div",{className:"app-settings-menu-content",ref:this.menuContentRef,children:[h("h5",{children:"Settings"}),h("hr",{className:"my-0"}),h(rl,{sectionKey:si.FORMATTING_SECTION_KEY,isExpanded:this.isSectionExpanded(si.FORMATTING_SECTION_KEY),title:v(pe,{children:[h(j,{icon:Hf,transform:"grow-4",className:"mr-2"}),"Formatting & Time zone"]}),onToggle:this.handleSectionToggle,children:h(E1,{scrollTo:this.handleScrollTo})}),h(rl,{sectionKey:si.SHORTCUT_SECTION_KEY,isExpanded:this.isSectionExpanded(si.SHORTCUT_SECTION_KEY),title:v(pe,{children:[h(j,{icon:_f,transform:"grow-2"})," ","Keyboard Shortcuts"]}),onToggle:this.handleSectionToggle,children:h(F1,{})}),v("div",{className:"app-settings-footer",children:[v("div",{className:"app-settings-footer-section",children:[v("div",{className:"app-settings-footer-item",children:[h("div",{className:"font-weight-bold",children:"Support"}),v("div",{children:["GitHub:\xA0",h("a",{href:e,className:"custom-link",target:"_blank",rel:"noopener noreferrer",children:e})]}),h(z,{kind:"tertiary",className:"mt-2 py-2",onClick:this.handleExportSupportLogs,children:"Export Logs"})]}),v("div",{className:"app-settings-footer-item",children:[h("div",{className:"font-weight-bold",children:"Documentation"}),h("a",{target:"_blank",rel:"noreferrer noopener",href:n,className:"custom-link",children:n})]}),v("div",{className:"app-settings-footer-item",children:[h("div",{className:"font-weight-bold",children:"Version"}),v("span",{className:"d-inline-block text-muted",children:[r," ",h(j,{icon:Ef}),h(Be,{interactive:!0,children:v("div",{className:"detailed-server-config",children:[l("Engine Version",r),l("Web UI Version",t),l("Java Version",o),l("Barrage Version",i)]})})]})]}),h("div",{className:"app-settings-footer-item",children:h(y1,{})})]}),h("div",{className:"app-settings-footer-section",children:h("div",{className:"logo",children:h("a",{target:"_blank",rel:"noreferrer noopener",href:"https://deephaven.io",className:"d-inline-block custom-link p-1",children:h("img",{src:Wp,alt:"Deephaven Data Labs",width:"230px"})})})})]})]})]})}};let Qo=si;Qo.defaultProps={onDone:()=>{}};Qo.FORMATTING_SECTION_KEY="SettingsMenu.formatting";Qo.APPLICATION_SECTION_KEY="ApplicationMenu.settings";Qo.SHORTCUT_SECTION_KEY="SettingsMenu.shortcuts";const Zh=10,Li=t=>{const{forwardedProps:{menuItem:{action:e,title:n,disabled:s},iconElement:i,displayShortcut:o,isMouseSelected:r,isKeyboardSelected:l,closeMenu:a}}=t,d=S.exports.useRef(),c=S.exports.useRef(),u=S.exports.useRef(null),[m,p]=S.exports.useState(!1),g=S.exports.useCallback(b=>{d.current!=null&&c.current!=null&&u.current&&(Math.abs(d.current-b.clientX)>=Zh||Math.abs(c.current-b.clientY)>=Zh)&&(p(!0),window.removeEventListener("mousemove",g),a(),e(b),u.current=null)},[e,a]);function f(b){d.current=b.clientX,c.current=b.clientY,u.current=b.target,window.addEventListener("mousemove",g)}function C(b){u.current===b.target&&(p(!0),a(),e(),window.removeEventListener("mousemove",g)),u.current=null}return S.exports.useEffect(function(){return function(){return window.removeEventListener("mousemove",g)}},[g]),v("button",{type:"button",className:W("btn-context-menu",{disabled:s},{active:r&&!s},{"keyboard-active":l&&!s}),onMouseDown:f,onMouseUp:C,disabled:m,children:[h("span",{className:W("icon"),children:i}),h("span",{className:"title",children:n}),h("span",{className:"shortcut",children:o})]})},hc=t=>{const{handleControlSelect:e,handleToolSelect:n,onClearFilter:s}=t,i=S.exports.useMemo(()=>[{title:"Input Filter",icon:Qf,menuElement:h(Li,{}),action:o=>{e(Cn.INPUT_FILTER,o)},order:10},{title:"Dropdown Filter",icon:wu,menuElement:h(Li,{}),action:o=>{e(Cn.DROPDOWN_FILTER,o)},order:15},{title:"Markdown Widget",icon:Nf,menuElement:h(Li,{}),action:o=>{e(Cn.MARKDOWN,o)},order:20},{title:"Filter Sets",icon:ya,menuElement:h(Li,{}),action:o=>{e(Cn.FILTER_SET_MANAGER,o)},order:25},{disabled:!0,menuElement:h("div",{className:"context-menu-group-header",children:"Tools"}),order:30},{title:"Linker",icon:rd,action:()=>{n(hn.LINKER)},order:40,shortcut:ms.LINKER},{disabled:!0,menuElement:h("div",{className:"context-menu-group-header",children:"Actions"}),order:50},{title:"Clear All Filters",icon:qf,action:()=>{s()},order:60,shortcut:dn.TABLE.CLEAR_ALL_FILTERS}],[e,n,s]);return h(Gn,{popperClassName:"controls-menu-popper",actions:i})};hc.propTypes={handleControlSelect:R.exports.func,handleToolSelect:R.exports.func,onClearFilter:R.exports.func};hc.defaultProps={handleControlSelect:()=>{},handleToolSelect:()=>{},onClearFilter:()=>{}};Li.propTypes={forwardedProps:R.exports.shape({iconElement:R.exports.node,displayShortcut:R.exports.string,isMouseSelected:R.exports.bool.isRequired,isKeyboardSelected:R.exports.bool.isRequired,closeMenu:R.exports.func.isRequired,menuItem:R.exports.shape({action:R.exports.func,title:R.exports.string,disabled:R.exports.bool}).isRequired})};Li.defaultProps={forwardedProps:null};const A1=Ps($p,null),P1={layoutStorage:A1},H1=t=>t.layoutStorage,V1=t=>t.serverConfigValues;Object.entries(P1).map(([t,e])=>Ji.register(t,e));const Jh=10,U1=t=>{const{onExportLayout:e,onImportLayout:n,onResetLayout:s,onSelect:i,widgets:o=[]}=t,[r,l]=S.exports.useState(!1),[a,d]=S.exports.useState(""),c=S.exports.useRef(null),u=S.exports.useRef(),m=S.exports.useCallback((y,E)=>{y!=null&&i(y,E)},[i]),p=S.exports.useCallback(y=>{d(y.target.value)},[]),g=S.exports.useCallback(y=>{u.current!=null&&(Math.abs(u.current.x-y.clientX)>=Jh||Math.abs(u.current.y-y.clientY)>=Jh)&&(l(!0),window.removeEventListener("mousemove",g),m(u.current.widget,y),u.current=void 0)},[u,m]),f=S.exports.useCallback((y,E)=>{u.current={x:y.clientX,y:y.clientY,widget:E},window.addEventListener("mousemove",g)},[g]),C=S.exports.useCallback((y,E)=>{var I;window.removeEventListener("mousemove",g),((I=u.current)==null?void 0:I.widget)===E&&(l(!0),m(E)),u.current=void 0},[g,u,m]),b=S.exports.useMemo(()=>o.filter(y=>{var E;return a?(E=y.name)==null?void 0:E.toLowerCase().includes(a.toLowerCase()):!0}),[a,o]).sort((y,E)=>{var I,D,F;return(F=(D=y.name)==null?void 0:D.localeCompare((I=E.name)!=null?I:""))!=null?F:0}),w=S.exports.useMemo(()=>b.map(y=>{var E,I;return h("li",{children:v(z,{kind:"ghost","data-testid":`panel-list-item-${(E=y.name)!=null?E:""}-button`,onMouseDown:D=>{f(D,y)},onMouseUp:D=>{C(D,y)},onKeyDown:D=>{(D.key==="Enter"||D.key===" ")&&m(y)},disabled:r,onClick:()=>{},children:[h(zu,{type:y.type})," ",(I=y.name)!=null?I:""]})},y.name)}),[b,r,f,C,m]),T=S.exports.useMemo(()=>w.length===0?h("span",{children:"No bound variables found."}):null,[w]);return v("div",{className:"widget-list-container d-flex flex-column",children:[h("div",{className:"widget-list-header",children:h(Cs,{value:a,placeholder:"Find Table, Plot or Widget",onChange:p,ref:c})}),v("ul",{className:"widget-list flex-grow-1",children:[T&&h("li",{className:"widget-list-message",children:T}),!T&&w]}),h("div",{children:h("hr",{})}),v("div",{className:"widget-list-footer",children:[v(z,{kind:"ghost",onClick:e,children:[v("div",{className:"fa-md fa-layers",children:[h(j,{mask:Ia,icon:Dc,transform:"right-5 down-5"}),h(j,{icon:Dc,transform:"right-8 down-6"})]}),"Export Layout"]}),v(z,{kind:"ghost",onClick:n,children:[v("div",{className:"fa-md fa-layers",children:[h(j,{mask:Ia,icon:Ea,transform:"right-5 down-5"}),h(j,{icon:Ea,transform:"right-8 down-6"})]}),"Import Layout"]}),h(z,{kind:"ghost",icon:_i,onClick:s,tooltip:"Reset Layout"})]})]})},B1=async(t,e,n)=>{let s,i,o,r;if(Pr(e)?(s=e.settings,i=e.table,o=void 0,r=e.tableSettings):(s={},i="",o=e.figure,r={}),n!==void 0&&(n.tableSettings!=null&&(r=n.tableSettings),n.table!=null&&(i=n.table),n.figure!=null&&(o=n.figure),n.settings!=null&&(s={...s,...n.settings})),o!==void 0){const d={title:o,name:o,type:M.VariableType.FIGURE},c=await t.getObject(d);return zi.makeModel(s,c)}const l={title:o,name:i,type:M.VariableType.TABLE},a=await t.getObject(l);return se.applyTableSettings(a,r,Il(Ml.getState())),zi.makeModelFromSettings(s,a)},$1=async(t,e,n=M.VariableType.TABLE)=>{const{table:s}=e,i={title:s,name:s,type:n},o=await t.getObject(i);return qd.makeModel(o)};const W1=({onAutoFillClick:t=()=>{}})=>v("div",{className:"empty-dashboard-container",children:[v("div",{className:"hint-container",children:[h(j,{icon:cf})," ",h("br",{}),"Use the panel list to add objects from a query."]}),v("div",{className:"empty-dashboard",children:[h("div",{className:"add-panels-hint",children:"Drag Panels Here"}),h(z,{kind:"tertiary",onClick:t,children:"Auto fill objects"})]})]});function z1(t){return t.version===2}function G1(t){return Array.isArray(t)}const xr=X.module("UserLayoutUtils"),K1={layoutConfig:[{type:"column",content:[{type:"row",height:40,content:[{type:"stack",content:[{type:"react-component",component:Oi.COMPONENT,title:Oi.TITLE,isClosable:!1},{type:"react-component",component:ol.COMPONENT,title:ol.TITLE,isClosable:!1}]},{type:"stack",width:25,content:[{type:"react-component",component:nl.COMPONENT,title:nl.TITLE,isClosable:!1},{type:"react-component",component:sl.COMPONENT,title:sl.TITLE,isClosable:!1}]}]},{type:"row",content:[{type:"stack",title:"Notebooks",content:[]}]}]}],links:[],filterSets:[],version:2},q1={layoutConfig:[],links:[],filterSets:[],version:2};function Gp(t){if(z1(t))return t;if(G1(t))return{layoutConfig:t,links:[],filterSets:[],version:2};throw new Error(`Unexpected layout import format: ${t}`)}async function Y1(t,e=!0){try{const n=await t.getLayouts();if(n.length>0)try{const s=await t.getLayout(n[0]);return Gp(s)}catch(s){xr.error("Unable to load layout",n[0],":",s),xr.warn("No valid layouts found, falling back to default layout")}}catch(n){xr.error("Unable to fetch layout list",n),xr.warn("Falling back to default layout")}return e?K1:q1}function X1(t){const{filterSets:e,layoutConfig:n,links:s}=t;return{filterSets:e,layoutConfig:n,links:s,version:2}}const Br={exportLayout:X1,getDefaultLayout:Y1,normalizeLayout:Gp},_r=X.module("DownloadServiceWorkerUtils"),Kp=class{static registerOnLoaded(){new URL("/ide/",window.location.href).origin===window.location.origin&&("serviceWorker"in navigator?window.addEventListener("load",()=>{const e=new URL("/ide/download/serviceWorker.js",window.location.href);navigator.serviceWorker.register(e).then(n=>{n.update(),_r.info("Registering service worker on ",e,n)}).catch(n=>{_r.error("Failed to register service worker",n)})}):_r.info("Service worker is not supported."))}static async getServiceWorker(){if("serviceWorker"in navigator){const e=(await navigator.serviceWorker.getRegistrations()).find(n=>n.scope.endsWith(Kp.DOWNLOAD_PATH));if(e&&e.active)return _r.info("Download service worker is active."),e.active;throw new Error("Can not find download service worker.")}throw new Error("Download service worker is not available.")}static unregisterSW(){}};let ll=Kp;ll.DOWNLOAD_PATH="/download/";const qp={react:Y},j1=pg(qp),Q1=gg({requires:j1}),Z1=fg.createRequires(qp),J1=Cg({requires:Z1}),e2=X.module("PluginUtils");class Qa{static loadComponentPlugin(e){if("".split(",").includes(e)){const o=Y.lazy(()=>Tg(()=>import(`./internal/${e}`),[])),r=Y.forwardRef((l,a)=>h(S.exports.Suspense,{fallback:h("div",{children:"Loading Plugin..."}),children:h(o,{ref:a,...l})}));return r.pluginName=e,r.displayName="Local Plugin",r}const n=new URL("/ide/plugins/",`${window.location}`),s=new URL(`${e}.js`,n),i=Y.forwardRef((o,r)=>h(Q1,{url:s,render:({err:l,Component:a})=>{if(l!=null&&l!==""){const d=`Error loading plugin ${e} from ${s} due to ${l}`;return e2.error(d),h("div",{className:"error-message",children:`${d}`})}return h(a,{ref:r,...o})}}));return i.pluginName=e,i.displayName="Plugin",i}static async loadModulePlugin(e){return await J1(e)}static async loadJson(e){return new Promise((n,s)=>{const i=new XMLHttpRequest;i.addEventListener("load",()=>{try{const o=JSON.parse(i.responseText);n(o)}catch(o){s(o)}}),i.addEventListener("error",o=>{s(o)}),i.open("GET",e),i.send()})}}const Lt=X.module("AppMainContainer");class Oo extends S.exports.Component{constructor(e){super(e),this.getDashboardPlugins=me(n=>[...n.entries()].filter(([,{DashboardPlugin:s}])=>s).map(([s,{DashboardPlugin:i}])=>h(i,{},s))),this.handleSettingsMenuHide=this.handleSettingsMenuHide.bind(this),this.handleSettingsMenuShow=this.handleSettingsMenuShow.bind(this),this.handleError=this.handleError.bind(this),this.handleControlSelect=this.handleControlSelect.bind(this),this.handleToolSelect=this.handleToolSelect.bind(this),this.handleClearFilter=this.handleClearFilter.bind(this),this.handleDataChange=this.handleDataChange.bind(this),this.handleAutoFillClick=this.handleAutoFillClick.bind(this),this.handleGoldenLayoutChange=this.handleGoldenLayoutChange.bind(this),this.handleLayoutConfigChange=this.handleLayoutConfigChange.bind(this),this.handleExportLayoutClick=this.handleExportLayoutClick.bind(this),this.handleImportLayoutClick=this.handleImportLayoutClick.bind(this),this.handleImportLayoutFiles=this.handleImportLayoutFiles.bind(this),this.handleLoadTablePlugin=this.handleLoadTablePlugin.bind(this),this.handleResetLayoutClick=this.handleResetLayoutClick.bind(this),this.handleWidgetMenuClick=this.handleWidgetMenuClick.bind(this),this.handleWidgetsMenuClose=this.handleWidgetsMenuClose.bind(this),this.handleWidgetSelect=this.handleWidgetSelect.bind(this),this.handlePaste=this.handlePaste.bind(this),this.hydrateChart=this.hydrateChart.bind(this),this.hydrateGrid=this.hydrateGrid.bind(this),this.hydratePandas=this.hydratePandas.bind(this),this.hydrateDefault=this.hydrateDefault.bind(this),this.openNotebookFromURL=this.openNotebookFromURL.bind(this),this.importElement=Y.createRef(),this.state={contextActions:[{action:()=>{this.handleToolSelect(hn.LINKER)},shortcut:ms.LINKER,isGlobal:!0},{action:()=>{this.sendClearFilter()},shortcut:dn.TABLE.CLEAR_ALL_FILTERS,isGlobal:!0},{action:()=>{Lt.debug("Consume unhandled save shortcut")},shortcut:ms.SAVE,isGlobal:!0}],isPanelsMenuShown:!1,isSettingsMenuShown:!1,widgets:[]}}static handleWindowBeforeUnload(e){e.preventDefault(),e.returnValue=""}static hydrateConsole(e,n){return Pa.hydrate({...e,unzip:s=>ru.loadAsync(s).then(i=>Object.values(i.files))},n)}componentDidMount(){this.initWidgets(),window.addEventListener("beforeunload",Oo.handleWindowBeforeUnload)}componentDidUpdate(e){const{dashboardData:n}=this.props;e.dashboardData!==n&&this.handleDataChange(n)}componentWillUnmount(){this.deinitWidgets(),window.removeEventListener("beforeunload",Oo.handleWindowBeforeUnload)}initWidgets(){const{connection:e}=this.props;if(e.subscribeToFieldUpdates==null){Lt.warn("subscribeToFieldUpdates not supported, not initializing widgets");return}this.widgetListenerRemover=e.subscribeToFieldUpdates(n=>{Lt.debug("Got updates",n),this.setState(({widgets:s})=>{const{updated:i,created:o,removed:r}=n,l=[...i,...r],a=s.filter(c=>!l.some(u=>u.name===c.name));return[...i,...o].forEach(c=>{c.name!=null&&c.name!==""&&a.push(c)}),{widgets:a}})})}deinitWidgets(){var e;(e=this.widgetListenerRemover)==null||e.call(this)}openNotebookFromURL(){const{match:e}=this.props,{notebookPath:n}=e.params;if(n){const{session:s,sessionConfig:i}=this.props;if(s==null||i==null){Lt.error("No session available to open notebook URL",n);return}const o={id:`/${n}`,itemName:`/${n}`},r=i.type,l={value:null,language:r};this.emitLayoutEvent(Ve.SELECT_NOTEBOOK,s,r,l,o,!0)}}sendClearFilter(){this.emitLayoutEvent(He.CLEAR_ALL_FILTERS)}emitLayoutEvent(e,...n){var s;(s=this.goldenLayout)==null||s.eventHub.emit(e,...n)}handleError(e){Ee.isCanceled(e)||Lt.error(e)}handleSettingsMenuHide(){this.setState({isSettingsMenuShown:!1})}handleSettingsMenuShow(){this.setState({isSettingsMenuShown:!0})}handleControlSelect(e,n=null){switch(Lt.debug("handleControlSelect",e),e){case Cn.DROPDOWN_FILTER:this.emitLayoutEvent(He.OPEN_DROPDOWN,{title:"DropdownFilter",type:e,createNewStack:!0,dragEvent:n});break;case Cn.INPUT_FILTER:this.emitLayoutEvent(He.OPEN_INPUT,{title:"InputFilter",type:e,createNewStack:!0,dragEvent:n});break;case Cn.MARKDOWN:this.emitLayoutEvent(Tp.OPEN,{title:"Markdown",type:e,dragEvent:n});break;case Cn.FILTER_SET_MANAGER:this.emitLayoutEvent(He.OPEN_FILTER_SET_MANAGER,{title:"FilterSets",type:e,dragEvent:n});break;default:throw new Error(`Unrecognized control type ${e}`)}}handleToolSelect(e){Lt.debug("handleToolSelect",e);const{activeTool:n,setActiveTool:s}=this.props;s(n===e?hn.DEFAULT:e)}handleClearFilter(){this.sendClearFilter()}handleDataChange(e){const{updateWorkspaceData:n}=this.props,{closed:s,filterSets:i,links:o}=e;n({closed:s,filterSets:i,links:o})}handleGoldenLayoutChange(e){this.goldenLayout=e}handleLayoutConfigChange(e){const{updateWorkspaceData:n}=this.props;n({layoutConfig:e})}handleWidgetMenuClick(){this.setState(({isPanelsMenuShown:e})=>({isPanelsMenuShown:!e}))}handleWidgetSelect(e,n){this.setState({isPanelsMenuShown:!1}),Lt.debug("handleWidgetSelect",e,n),this.openWidget(e,n)}handleWidgetsMenuClose(){this.setState({isPanelsMenuShown:!1})}handleAutoFillClick(){const{widgets:e}=this.state;Lt.debug("handleAutoFillClick",e);const n=e.sort((s,i)=>s.title!=null&&i.title!=null?s.title.localeCompare(i.title):0);for(let s=0;s<n.length;s+=1)this.openWidget(n[s])}handleExportLayoutClick(){Lt.info("handleExportLayoutClick"),this.setState({isPanelsMenuShown:!1});try{const{workspace:e}=this.props,{data:n}=e,s=Br.exportLayout(n);Lt.info("handleExportLayoutClick exportedConfig",s);const i=new Blob([JSON.stringify(s)],{type:"application/json"}),o=M.i18n.DateTimeFormat.format("yyyy-MM-dd-HHmmss",new Date),r=document.createElement("a");r.href=URL.createObjectURL(i),r.download=`deephaven-app-layout-${o}.json`,r.click()}catch(e){Lt.error("Unable to export layout",e)}}handleImportLayoutClick(){Lt.info("handleImportLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.importElement.current!=null&&(this.importElement.current.value="",this.importElement.current.click())}handleResetLayoutClick(){Lt.info("handleResetLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.resetLayout()}handleImportLayoutFiles(e){var n;e.stopPropagation(),e.preventDefault(),e.target.files!=null&&this.importLayoutFile((n=e.target.files)==null?void 0:n[0])}async importLayoutFile(e){try{const{updateDashboardData:n,updateWorkspaceData:s}=this.props,i=await e.text(),o=JSON.parse(i),{filterSets:r,layoutConfig:l,links:a}=Br.normalizeLayout(o);s({layoutConfig:l}),n(Dn,{filterSets:r,links:a})}catch(n){Lt.error("Unable to import layout",n)}}async resetLayout(){const{layoutStorage:e,session:n}=this.props,{filterSets:s,layoutConfig:i,links:o}=await Br.getDefaultLayout(e,n!==void 0),{updateDashboardData:r,updateWorkspaceData:l}=this.props;l({layoutConfig:i}),r(Dn,{filterSets:s,links:o})}handlePaste(e){let n=e.currentTarget.parentElement;for(;n!=null;){if(n.classList.contains("monaco-editor"))return;n=n.parentElement}const{clipboardData:s}=e,i=s.getData("Text"),o=/“|”/g;o.test(i)&&(e.preventDefault(),e.stopPropagation(),document.execCommand("insertText",!1,i.replace(o,'"')))}handleLoadTablePlugin(e){const{plugins:n}=this.props,s=n.get(e);return s!=null&&s.TablePlugin!=null?s.TablePlugin:Qa.loadComponentPlugin(e)}hydrateDefault(e,n){const{connection:s}=this.props,{metadata:i}=e;if((i==null?void 0:i.type)!=null&&((i==null?void 0:i.id)!=null||(i==null?void 0:i.name)!=null)){const o=i.id!=null?{type:i.type,id:i.id}:{type:i.type,name:i.name,title:i.name};return{fetch:()=>s.getObject(o),localDashboardId:n,...e}}return Pa.hydrate(e,n)}hydrateGrid(e,n){return this.hydrateTable(e,n,M.VariableType.TABLE)}hydratePandas(e,n){return this.hydrateTable(e,n,M.VariableType.PANDAS)}hydrateTable(e,n,s=M.VariableType.TABLE){const{connection:i}=this.props;return{...e,getDownloadWorker:ll.getServiceWorker,loadPlugin:this.handleLoadTablePlugin,localDashboardId:n,makeModel:()=>$1(i,e.metadata,s)}}hydrateChart(e,n){const{connection:s}=this.props;return{...e,localDashboardId:n,makeModel:()=>{const{metadata:i,panelState:o}=e;return B1(s,i,o)}}}openWidget(e,n){const{connection:s}=this.props;this.emitLayoutEvent(Me.OPEN,{dragEvent:n,fetch:()=>s.getObject(e),widget:e})}render(){const{activeTool:e,plugins:n,user:s,workspace:i,serverConfigValues:o}=this.props,{data:r}=i,{layoutConfig:l}=r,{permissions:a}=s,{canUsePanels:d}=a,{contextActions:c,isPanelsMenuShown:u,isSettingsMenuShown:m,widgets:p}=this.state,g=this.getDashboardPlugins(n);return v("div",{className:W("app-main-tabs","w-100","h-100","d-flex","flex-column",e?`active-tool-${e.toLowerCase()}`:""),onPaste:this.handlePaste,tabIndex:-1,children:[h("nav",{className:"nav-container",children:v("div",{className:"app-main-top-nav-menus",children:[h("img",{src:Wp,alt:"Deephaven Data Labs",width:"115px",className:"ml-1"}),v("div",{children:[v(z,{kind:"ghost",className:"btn-panels-menu",icon:sC,onClick:()=>{},children:["Controls",h(hc,{handleControlSelect:this.handleControlSelect,handleToolSelect:this.handleToolSelect,onClearFilter:this.handleClearFilter})]}),d&&v(z,{kind:"ghost",className:"btn-panels-menu btn-show-panels","data-testid":"app-main-panels-button",onClick:this.handleWidgetMenuClick,icon:Jf,children:["Panels",h(xn,{isShown:u,className:"panels-menu-popper",onExited:this.handleWidgetsMenuClose,closeOnBlur:!0,interactive:!0,children:h(U1,{widgets:p,onExportLayout:this.handleExportLayoutClick,onImportLayout:this.handleImportLayoutClick,onResetLayout:this.handleResetLayoutClick,onSelect:this.handleWidgetSelect})})]}),h(z,{kind:"ghost",className:W("btn-settings-menu",{"text-warning":s.operateAs!==s.name}),onClick:this.handleSettingsMenuShow,icon:h(j,{icon:Wo,transform:"grow-3 right-1 down-1"}),tooltip:"User Settings"})]})]})}),v(S0,{emptyDashboard:h(W1,{onAutoFillClick:this.handleAutoFillClick}),id:Dn,layoutConfig:l,onGoldenLayoutChange:this.handleGoldenLayoutChange,onLayoutConfigChange:this.handleLayoutConfigChange,onLayoutInitialized:this.openNotebookFromURL,hydrate:this.hydrateDefault,children:[h(e1,{hydrate:this.hydrateGrid,getDownloadWorker:ll.getServiceWorker,loadPlugin:this.handleLoadTablePlugin}),h(YE,{hydrate:this.hydrateChart}),h(XE,{}),h(QE,{hydrateConsole:Oo.hydrateConsole,notebooksUrl:new URL("/notebooks/",`${window.location}`).href}),h(ZE,{}),h(l1,{hydrate:this.hydratePandas}),h(r1,{}),h(o1,{}),g]}),h(ut,{in:m,timeout:Et.transitionMidMs,classNames:"slide-left",mountOnEnter:!0,unmountOnExit:!0,children:h(Qo,{serverConfigValues:o,onDone:this.handleSettingsMenuHide})}),h(oe,{actions:c}),h("input",{ref:this.importElement,type:"file",accept:".json",style:{display:"none"},onChange:this.handleImportLayoutFiles})]})}}const t2=t=>{var e,n;return{activeTool:Rl(t),dashboardData:jt(t,Dn),layoutStorage:H1(t),plugins:TS(t),connection:lE(t,Dn),session:(e=gi(t,Dn))==null?void 0:e.session,sessionConfig:(n=gi(t,Dn))==null?void 0:n.config,user:hm(t),workspace:yl(t),serverConfigValues:V1(t)}},n2=Mt(t2,{setActiveTool:Dl,updateDashboardData:Yn,updateWorkspaceData:Em})(bg(Oo)),s2=()=>v("div",{className:"app",children:[h(n2,{}),h(Ru,{})]}),i2=X.module("LocalWorkspaceStorage"),No=class{static async makeDefaultWorkspaceData(t,e){const{filterSets:n,links:s,layoutConfig:i}=await Br.getDefaultLayout(t,e==null?void 0:e.isConsoleAvailable);return{settings:{defaultDateTimeFormat:dt.DEFAULT_DATETIME_FORMAT_STRING,formatter:[],timeZone:dt.DEFAULT_TIME_ZONE_ID,showTimeZone:!1,showTSeparator:!0,disableMoveConfirmation:!1,defaultDecimalFormatOptions:{defaultFormatString:Ae.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:it.DEFAULT_FORMAT_STRING},truncateNumbersWithPound:!1},layoutConfig:i,closed:[{}],links:s,filterSets:n}}static async makeDefaultWorkspace(t,e){return{data:await No.makeDefaultWorkspaceData(t,e)}}constructor(t){this.layoutStorage=t}async load(t){var e;try{return JSON.parse((e=localStorage.getItem(No.STORAGE_KEY))!=null?e:"")}catch{return i2.info("Unable to load workspace data, initializing to default data"),No.makeDefaultWorkspace(this.layoutStorage,t)}}async save(t){return localStorage.setItem(No.STORAGE_KEY,JSON.stringify(t)),t}};let Yp=No;Yp.STORAGE_KEY="deephaven.WorkspaceStorage";class o2 extends Error{constructor(){super(...arguments),this.isNoConsolesError=!0}}function r2(t){return t.isNoConsolesError}const Ai=X.module("SessionUtils");function l2(){return new URL("/jsapi",`${window.location}`)}function Xp(){const t=l2();return`${t.protocol}//${t.host}`}function a2(){const t=Xp();return Ai.info(`Starting connection to '${t}'...`),new M.IdeConnection(t)}async function d2(t){Ai.info("Getting console types...");const e=await t.getConsoleTypes();if(Ai.info("Available types:",e),e.length===0)throw new o2("No console types available");const n=e[0];Ai.info("Starting session with type",n);const s=await t.startSession(n),i={type:n,id:ze.generate()};return Ai.info("Console session established",i),{session:s,config:i,connection:t}}function c2(){const t=Xp();return Ai.info("createCoreClient",t),new M.CoreClient(t)}class h2{constructor(e,n=""){this.storageService=e,this.root=n}async getLayouts(){return(await this.storageService.listItems(this.root,"*.json")).map(n=>n.basename)}async getLayout(e){const s=await(await this.storageService.loadFile(`${this.root}/${e}`)).text();return JSON.parse(s)}}const vo=X.module("GrpcFileStorageTable"),Za=class{constructor(t,e="",n=e){this.currentSize=0,this.listeners=[],this.childTables=new Map,this.storageService=t,this.baseRoot=e,this.root=n,n===e&&(this.doRefresh=je(this.doRefresh.bind(this),Za.REFRESH_DEBOUNCE))}removeBaseRoot(t){return ce.removeRoot(this.baseRoot,t)}getViewportData(){var t;return this.viewportUpdatePromise||this.refreshInternal(),(t=this.viewportUpdatePromise)!=null?t:Promise.resolve({items:[],offset:0})}getSnapshot(t){throw new Error("Method not implemented.")}get size(){return this.currentSize}setExpanded(t,e){const n=t.split("/");let s=n.shift();if((s===void 0||s==="")&&(s=n.shift()),s===void 0||s==="")throw new Error(`Invalid path: ${t}`);const i=n.join("/");if(e){if(!this.childTables.has(s)){const o=new Za(this.storageService,this.baseRoot,`${this.root}/${s}`);this.childTables.set(s,o)}if(i){const o=this.childTables.get(s);o==null||o.setExpanded(i,e)}}else if(this.childTables.has(s))if(i){const o=this.childTables.get(s);o==null||o.setExpanded(i,e)}else this.childTables.delete(s);this.currentViewport&&this.refreshInternal()}collapseAll(){this.childTables.clear(),this.currentViewport&&this.refreshInternal()}setSearch(t){throw new Error("Method not implemented.")}setViewport(t){this.currentViewport=t,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(t){return this.listeners=[...this.listeners,t],()=>{this.listeners=this.listeners.filter(e=>e!==t)}}doRefresh(t){vo.debug2("doRefresh",this.root),t(this.fetchData())}refresh(){var n;vo.debug2("refresh",this.root),(n=this.viewportUpdatePromise)==null||n.cancel();const t=new Promise(s=>{this.doRefresh(s)}),e=Ee.makeCancelable(t.then(s=>{if(this.viewportUpdatePromise!==e)throw new di;return this.currentViewportData=s,this.sendUpdate(),s}));e.catch(s=>{Ee.isCanceled(s)||vo.error("Error updating viewport",s)}),this.viewportUpdatePromise=e}refreshInternal(){try{this.refresh()}catch(t){Ee.isCanceled(t)||vo.error("Unable to refresh data",t)}}async fetchData(){const{currentViewport:t}=this;if(!t)throw new Error("No viewport set");let n=(await this.storageService.listItems(this.root)).map(s=>({type:s.type,filename:this.removeBaseRoot(s.filename),basename:s.basename,id:this.removeBaseRoot(s.filename),isExpanded:s.type==="directory"?this.childTables.has(s.basename):void 0})).sort((s,i)=>s.type!==i.type?s.type==="directory"?-1:1:s.basename.localeCompare(i.basename));for(let s=0;s<n.length;s+=1){const i=n[s],{basename:o,filename:r}=i;if(r===this.removeBaseRoot(`${this.root}/${o}`)&&i.type==="directory"){const l=this.childTables.get(o);if(l!=null){l.setViewport({top:0,bottom:t.bottom-s});const a=await l.getViewportData();n.splice(s+1,0,...a.items)}}}return this.currentSize=n.length,vo.debug2(this.root,"items",n,t),n=n.slice(t.top,t.bottom),{items:n,offset:t.top}}sendUpdate(){var n;const{listeners:t}=this,e=(n=this.currentViewportData)!=null?n:{items:[],offset:0};for(let s=0;s<t.length;s+=1)t[s](e)}};let jp=Za;jp.REFRESH_DEBOUNCE=50;const u2=X.module("GrpcFileStorage"),Qp=class{constructor(t,e=""){this.tables=[],this.refreshTables=us(()=>{this.tables.forEach(n=>n.refresh())},Qp.REFRESH_THROTTLE),this.storageService=t,this.root=e}removeRoot(t){return ce.removeRoot(this.root,t)}addRoot(t){return ce.addRoot(this.root,t)}async createDirectory(t){return await this.storageService.createDirectory(this.addRoot(t)),this.refreshTables(),{type:"directory",id:t,filename:t,basename:ce.getBaseName(t)}}async getTable(){const t=new jp(this.storageService,this.root);return this.tables.push(t),t}async saveFile(t){const e=dh.storage.FileContents.text(t.content);return await this.storageService.saveFile(this.addRoot(t.filename),e,!0),this.refreshTables(),t}async loadFile(t){const n=await(await this.storageService.loadFile(this.addRoot(t))).text();return{filename:t,basename:ce.getBaseName(t),content:n}}async deleteFile(t){await this.storageService.deleteItem(this.addRoot(t)),this.refreshTables()}async moveFile(t,e){await this.storageService.moveItem(this.addRoot(t),this.addRoot(e)),this.refreshTables()}async info(t){const e=await this.storageService.listItems(this.addRoot(ce.getPath(t)),ce.getBaseName(t));if(e.length===0)throw new sc;if(e.length>1)throw u2.error("More than one matching file found, should never happen.",e),new Error("More than one matching file found");const n=e[0];return{filename:this.removeRoot(n.filename),basename:this.removeRoot(n.basename),id:this.removeRoot(n.filename),type:n.type}}};let Zp=Qp;Zp.REFRESH_THROTTLE=150;const ai=X.module("AppInit");async function m2(){ai.debug("Loading plugins...");try{const t=await Qa.loadJson("/js-plugins/manifest.json");ai.debug("Plugin manifest loaded:",t);const e=[];for(let i=0;i<t.plugins.length;i+=1){const{name:o,main:r}=t.plugins[i],l=`/js-plugins/${o}/${r}`;e.push(Qa.loadModulePlugin(l))}const n=await Promise.all(e),s=new Map;for(let i=0;i<n.length;i+=1){const{name:o}=t.plugins[i];s.set(o,n[i])}return ai.info("Plugins loaded:",s),s}catch(t){return ai.error("Unable to load plugins:",t),new Map}}async function p2(t){let e;try{e=await d2(t)}catch(n){if(!r2(n))throw n}return e}const uc=t=>{const{workspace:e,setActiveTool:n,setCommandHistoryStorage:s,setDashboardData:i,setFileStorage:o,setLayoutStorage:r,setDashboardConnection:l,setDashboardSessionWrapper:a,setPlugins:d,setUser:c,setWorkspace:u,setWorkspaceStorage:m,setServerConfigValues:p}=t,[g,f]=S.exports.useState(),[C,b]=S.exports.useState(!0),w=S.exports.useCallback(async()=>{var D,F;try{ai.info("Initializing Web UI","0.22.2",navigator.userAgent);const x=await m2(),U=a2(),$=await p2(U);U.addEventListener(M.IdeConnection.HACK_CONNECTION_FAILURE,Re=>{var Oe;const{detail:qe}=Re;ai.error("Connection failure",`${JSON.stringify(qe)}`),f(`Unable to connect: ${(Oe=qe.details)!=null?Oe:"Unknown Error"}`)});const _="user",H=c2();await H.login({type:M.CoreClient.LOGIN_TYPE_ANONYMOUS});const L=H.getStorageService(),N=new h2(L,"/layouts"),k=new Zp(L,"/notebooks"),O=new Yp(N),V=new S1,G=await O.load({isConsoleAvailable:$!==void 0}),{data:Q}=G,{settings:J}=Q;J.defaultDecimalFormatOptions===void 0&&(J.defaultDecimalFormatOptions={defaultFormatString:Ae.DEFAULT_FORMAT_STRING}),J.defaultIntegerFormatOptions===void 0&&(J.defaultIntegerFormatOptions={defaultFormatString:it.DEFAULT_FORMAT_STRING}),J.truncateNumbersWithPound===void 0&&(J.truncateNumbersWithPound=!1);const{shortcutOverrides:ve={}}=J,be=Kt.isMacPlatform?(D=ve.mac)!=null?D:{}:(F=ve.windows)!=null?F:{};Object.entries(be).forEach(([Re,qe])=>{var Oe;(Oe=Pe.get(Re))==null||Oe.setKeyState(qe)});const ke={filterSets:Q.filterSets,links:Q.links},ee=await H.getServerConfigValues(),ge=new Map(ee),Se={name:_,operateAs:_,groups:[],permissions:{isSuperUser:!1,isQueryViewOnly:!1,isNonInteractive:!1,canUsePanels:!0,canCreateDashboard:!0,canCreateCodeStudio:!0,canCreateQueryMonitor:!0,canCopy:ge.get("internal.webClient.appInit.canCopy")!=="false",canDownloadCsv:ge.get("internal.webClient.appInit.canDownloadCsv")!=="false"}};n(hn.DEFAULT),p(ge),s(V),i(Dn,ke),o(k),r(N),l(Dn,U),$!==void 0&&a(Dn,$),d(x),c(Se),m(O),u(G)}catch(x){ai.error(x),f(x)}},[n,s,i,o,r,l,a,d,c,u,m,p]),T=S.exports.useCallback(()=>{document.fonts!=null?document.fonts.ready.then(()=>{b(!1)}):b(!1)},[]);S.exports.useEffect(function(){w(),T()},[w,T]);const y=e==null&&g==null||C,E=!y&&g==null,I=g!=null?`${g}`:null;return v(pe,{children:[E&&h(s2,{}),h(Cl,{isLoading:y,isLoaded:E,errorMessage:I}),v("div",{id:"preload-fonts",style:{visibility:"hidden",position:"absolute",top:-1e4},children:[h("p",{className:"fira-sans-regular",children:"preload"}),h("p",{className:"fira-sans-semibold",children:"preload"}),h("p",{className:"fira-mono",children:"preload"})]})]})};uc.propTypes={workspace:R.exports.shape({}),workspaceStorage:R.exports.shape({close:R.exports.func}),setActiveTool:R.exports.func.isRequired,setCommandHistoryStorage:R.exports.func.isRequired,setDashboardData:R.exports.func.isRequired,setFileStorage:R.exports.func.isRequired,setLayoutStorage:R.exports.func.isRequired,setDashboardConnection:R.exports.func.isRequired,setDashboardSessionWrapper:R.exports.func.isRequired,setPlugins:R.exports.func.isRequired,setUser:R.exports.func.isRequired,setWorkspace:R.exports.func.isRequired,setWorkspaceStorage:R.exports.func.isRequired};uc.defaultProps={workspace:null,workspaceStorage:null};const g2=t=>({workspace:yl(t),workspaceStorage:uS(t)}),eu=Mt(g2,{setActiveTool:Dl,setCommandHistoryStorage:IS,setDashboardData:Km,setFileStorage:RS,setLayoutStorage:w1,setDashboardConnection:aE,setDashboardSessionWrapper:dE,setPlugins:MS,setUser:ES,setWorkspace:Tm,setWorkspaceStorage:yS,setServerConfigValues:NS})(uc),f2=()=>h(Sg,{basename:"/ide/",children:v(wg,{children:[h(Ec,{exact:!0,path:"/",component:eu}),h(Ec,{path:"/notebook/:notebookPath+",component:eu}),h(vg,{from:"*",to:"/"})]})});Boolean(window.location.hostname==="localhost"||window.location.hostname==="[::1]"||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));function C2(){"serviceWorker"in navigator&&navigator.serviceWorker.getRegistrations().then(t=>{t.forEach(e=>{e.scope.endsWith("/download/")||e.unregister()})})}x1();ui.render(h(su,{store:Ml,children:h(f2,{})}),document.getElementById("root"));C2();ll.registerOnLoaded();st.init({getWorker:()=>new Eg});window["__react-beautiful-dnd-disable-dev-warnings"]=!0;
|
|
43
|
+
//# sourceMappingURL=index.27abeb6b.js.map
|