@deephaven/embed-widget 0.82.1-beta.2 → 0.82.1-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/assets/{App-df10306c.js → App-fb8b8f87.js} +2 -2
- package/build/assets/{App-df10306c.js.map → App-fb8b8f87.js.map} +1 -1
- package/build/assets/{Chart-cbbfe188.js → Chart-1a48acf0.js} +2 -2
- package/build/assets/{Chart-cbbfe188.js.map → Chart-1a48acf0.js.map} +1 -1
- package/build/assets/{IrisGrid-18f476d1.js → IrisGrid-1bbebca6.js} +2 -2
- package/build/assets/{IrisGrid-18f476d1.js.map → IrisGrid-1bbebca6.js.map} +1 -1
- package/build/assets/{IrisGridThemeProvider-8549ca07.js → IrisGridThemeProvider-b1fbf7a3.js} +2 -2
- package/build/assets/{IrisGridThemeProvider-8549ca07.js.map → IrisGridThemeProvider-b1fbf7a3.js.map} +1 -1
- package/build/assets/{LocalWorkspaceStorage-2da38282.js → LocalWorkspaceStorage-232e3da0.js} +2 -2
- package/build/assets/{LocalWorkspaceStorage-2da38282.js.map → LocalWorkspaceStorage-232e3da0.js.map} +1 -1
- package/build/assets/{LogPanel-b6c950d6.js → LogPanel-7df173a5.js} +2 -2
- package/build/assets/{LogPanel-b6c950d6.js.map → LogPanel-7df173a5.js.map} +1 -1
- package/build/assets/{MarkdownEditor-21ef43f8.js → MarkdownEditor-241dbfd2.js} +2 -2
- package/build/assets/{MarkdownEditor-21ef43f8.js.map → MarkdownEditor-241dbfd2.js.map} +1 -1
- package/build/assets/{MarkdownNotebook-96b9e75e.js → MarkdownNotebook-b2612025.js} +2 -2
- package/build/assets/{MarkdownNotebook-96b9e75e.js.map → MarkdownNotebook-b2612025.js.map} +1 -1
- package/build/assets/{index-2b6a154b.js → index-9a9c830b.js} +2 -2
- package/build/assets/{index-2b6a154b.js.map → index-9a9c830b.js.map} +1 -1
- package/build/assets/{index-94cd9dc8.js → index-a309847c.js} +2 -2
- package/build/assets/{index-94cd9dc8.js.map → index-a309847c.js.map} +1 -1
- package/build/assets/{index-5ab26c17.js → index-ae9d1506.js} +5 -5
- package/build/assets/index-ae9d1506.js.map +1 -0
- package/build/index.html +1 -1
- package/package.json +17 -17
- package/build/assets/index-5ab26c17.js.map +0 -1
package/build/assets/{LocalWorkspaceStorage-2da38282.js → LocalWorkspaceStorage-232e3da0.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as d,M as I,I as c,K as z,Q as k,b3 as Oe,N as Ce}from"./vendor-24151293.js";import{L as x,q as xe,a as L}from"./index-2b6a154b.js";import{y as P,a4 as Y,z as Ee,u as De,k as A,aU as ye,a6 as _e,ad as Te,af as Z,as as Ie,aV as Le,au as Ae,ax as je,aW as Ne,aw as Fe,aX as Re,aP as $e,$ as Ue,_ as Ke,ay as Be,aY as J,aZ as X,a_ as Q,a$ as V,a0 as ee,a1 as Ge,a2 as We}from"./LogPanel-b6c950d6.js";function ze(t){var e=t;t instanceof CustomEvent&&(e=t.detail);var n="";if(e instanceof Error?n=e.message:e!=null&&(n="".concat(e)),n=n.trim(),n.length>0)return n}function ke(t,e){d.useEffect(()=>{if(t!=null){var n=new window.ResizeObserver(e);return n.observe(t),()=>{t!=null&&n.unobserve(t)}}},[t,e])}function te(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function He(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?te(Object(n),!0).forEach(function(r){w(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):te(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function w(t,e,n){return e=qe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function qe(t){var e=Ye(t,"string");return typeof e=="symbol"?e:String(e)}function Ye(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var ne=x.module("ContextMenu");class E extends d.PureComponent{static handleContextMenu(e){e.metaKey||(e.stopPropagation(),e.preventDefault())}constructor(e){super(e),w(this,"container",void 0),w(this,"oldFocus",void 0),w(this,"activeSubMenuRef",void 0),w(this,"subMenuTimer",void 0),w(this,"rAF",void 0),w(this,"initialPosition",void 0),this.handleBlur=this.handleBlur.bind(this),this.handleCloseSubMenu=this.handleCloseSubMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMenuItemClick=this.handleMenuItemClick.bind(this),this.handleMenuItemContextMenu=this.handleMenuItemContextMenu.bind(this),this.handleMenuItemMouseMove=this.handleMenuItemMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleWindowResize=this.handleWindowResize.bind(this),this.container=I.createRef(),this.oldFocus=document.activeElement,this.activeSubMenuRef=I.createRef(),this.subMenuTimer=0,this.rAF=0,this.initialPosition={top:e.top,left:e.left},this.state={menuItems:[],pendingItems:[],activeSubMenu:null,hasOverflow:!1,subMenuTop:null,subMenuLeft:null,subMenuParentWidth:0,subMenuParentHeight:0,keyboardIndex:-1,mouseIndex:-1}}componentDidMount(){this.initMenu(),this.verifyPosition(),window.addEventListener("resize",this.handleWindowResize),this.rAF=window.requestAnimationFrame(()=>{var e;(e=this.container.current)===null||e===void 0||e.focus();var{onMenuOpened:n}=this.props;n(this)})}componentDidUpdate(e,n){var{actions:r}=this.props,{activeSubMenu:i}=this.state;if(i!==n.activeSubMenu)if(i==null){var a;(a=this.container.current)===null||a===void 0||a.focus()}else this.setActiveSubMenuPosition();if(e.actions!==r&&(this.initMenu(),this.container.current==null||!this.container.current.contains(document.activeElement))){var o;(o=this.container.current)===null||o===void 0||o.focus()}this.verifyPosition()}componentWillUnmount(){this.cancelPromises(),window.removeEventListener("resize",this.handleWindowResize),cancelAnimationFrame(this.rAF)}getKeyboardIndex(){var{options:e}=this.props;if(e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse){var{keyboardIndex:n}=this.state;return n}return this.getMouseIndex()}setKeyboardIndex(e){var{options:n}=this.props;n.separateKeyboardMouse!==void 0&&n.separateKeyboardMouse?this.setState({keyboardIndex:e}):this.setMouseIndex(e)}getMouseIndex(){var{mouseIndex:e}=this.state;return e}setMouseIndex(e){this.setState({mouseIndex:e})}initMenu(){this.cancelPromises(),cancelAnimationFrame(this.rAF);var{options:e}=this.props,n=e.initialKeyboardIndex;n===void 0&&(n=-1);for(var{actions:r}=this.props,i=P.getMenuItems(r),a=[],o=i.length-1;o>=0;o-=1){var s=i[o];s instanceof Promise?this.initMenuPromise(s):a.push(s)}this.setState({mouseIndex:-1,keyboardIndex:n,activeSubMenu:null,menuItems:P.sortActions(a)})}initMenuPromise(e){var n=Y.makeCancelable(e);this.setState(r=>({pendingItems:r.pendingItems.concat(n)})),n.then(r=>{this.setState(i=>{var a=i.pendingItems.indexOf(n);if(a>=0){var o=i.pendingItems.slice();return o.splice(a,1),{menuItems:P.sortActions(i.menuItems.concat(r)),pendingItems:o}}return null})},r=>{Y.isCanceled(r)||(this.setState(i=>{var a=i.pendingItems.indexOf(n);if(a>=0){var o=i.pendingItems.slice();return o.splice(a,1),{pendingItems:o}}return null}),ne.error(r))})}cancelPromises(){var{pendingItems:e}=this.state;e.map(n=>n.cancel())}setActiveSubMenuPosition(){if(this.activeSubMenuRef.current!==null){var e=this.activeSubMenuRef.current.getBoundingClientRect();this.setState({subMenuTop:e.top,subMenuLeft:e.right,subMenuParentHeight:e.height,subMenuParentWidth:e.width})}}verifyPosition(){var e,n,r,i,{options:a,updatePosition:o,subMenuParentWidth:s,subMenuParentHeight:u,top:l,left:v}=this.props;if(!(!this.container.current||a.doNotVerifyPosition!=null&&a.doNotVerifyPosition)){var{top:f,left:m}=this.initialPosition,{width:p,height:h}=(e=(n=this.container.current)===null||n===void 0?void 0:n.getBoundingClientRect())!==null&&e!==void 0?e:{width:0,height:0},S=((r=(i=this.container.current)===null||i===void 0?void 0:i.scrollHeight)!==null&&r!==void 0?r:0)>window.innerHeight;h===0||p===0||(f+h>window.innerHeight&&(f-h-u>0?f-=h-u:f=window.innerHeight-h),m+p>window.innerWidth&&(m=m-p-s),(v!==m||l!==f)&&(this.setState({hasOverflow:S}),o(f,m)))}}handleWindowResize(){this.container.current&&this.closeMenu(!0)}handleBlur(e){if(!this.container.current){ne.warn("Container is null!");return}if(!this.container.current.contains(e.relatedTarget)){for(var n=e.relatedTarget,r=!1;n&&!r;)r=n.hasAttribute("data-dh-context-menu"),n=n.parentElement;r||this.closeMenu(!0)}}isEscapeKey(e){var{left:n}=this.props;return e==="Escape"||n<0&&e==="ArrowRight"||e==="ArrowLeft"}handleKeyDown(e){var{menuItems:n}=this.state,r=this.getKeyboardIndex(),i=r,a=!1;if(e.key==="Enter"||e.key===" "){r>=0&&r<n.length&&this.handleMenuItemClick(n[r],e);return}if(e.key==="ArrowRight"?r>=0&&r<=n.length?a=!0:i=0:this.isEscapeKey(e.key)?i=null:e.key==="ArrowUp"||e.shiftKey&&e.key==="Tab"?i=P.getNextMenuItem(i,-1,n):(e.key==="ArrowDown"||e.key==="Tab")&&(i=P.getNextMenuItem(i,1,n)),a){this.openSubMenu(r),e.preventDefault(),e.stopPropagation();return}r!==i&&(i!==null?this.setKeyboardIndex(i):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}openSubMenu(e){var{menuItems:n,activeSubMenu:r}=this.state,i=n[e].actions?e:null;r!==i&&this.setState({activeSubMenu:i,subMenuTop:null,subMenuLeft:null})}closeMenu(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,{closeMenu:n,onMenuClosed:r}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{n(e),r(this)})}closeSubMenu(){this.setState({activeSubMenu:null})}handleCloseSubMenu(e){e?this.closeMenu(!0):this.closeSubMenu()}handleMenuItemClick(e,n){n.preventDefault(),n.stopPropagation();var{menuItems:r}=this.state;e!=null&&(e.disabled===void 0||!e.disabled)&&(e.actions!=null?this.openSubMenu(r.indexOf(e)):e.action!=null&&(e.action(n.nativeEvent),this.closeMenu(!0)))}handleMenuItemContextMenu(e,n){n.metaKey||this.handleMenuItemClick(e,n)}handleMenuItemMouseMove(e){var{menuItems:n}=this.state,r=n.indexOf(e);this.setMouseIndex(r),r>=0&&r<n.length&&(e.disabled===void 0||!e.disabled)&&this.openSubMenu(r)}handleMouseLeave(){this.setMouseIndex(-1)}render(){for(var e=[],{top:n,left:r}=this.props,{activeSubMenu:i,hasOverflow:a,keyboardIndex:o,menuItems:s,mouseIndex:u,pendingItems:l,subMenuTop:v,subMenuLeft:f,subMenuParentWidth:m,subMenuParentHeight:p}=this.state,h=0;h<s.length;h+=1){var S=s[h];h>0&&S.group!==s[h-1].group&&e.push(c.jsx("hr",{},"".concat(h,".separator")));var y=c.jsx(Ee,{ref:i===h?this.activeSubMenuRef:null,isKeyboardSelected:o===h,isMouseSelected:u===h,menuItem:S,closeMenu:this.handleCloseSubMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:this.handleMenuItemContextMenu},h);e.push(y)}var O=null;l.length>0&&(O=c.jsx("div",{className:"loading",children:c.jsx(xe,{className:"loading-spinner-vertical-align"})}));var{menuStyle:N,"data-testid":q}=this.props,M=i!==null&&v!==null&&f!==null;return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:z({"has-overflow":a},"context-menu-container"),style:He({top:n,left:r},N),ref:this.container,"data-dh-context-menu":!0,onBlur:this.handleBlur,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,onContextMenu:E.handleContextMenu,role:"menuitem",tabIndex:0,"data-testid":q,children:[e,O]}),M&&i!==null&&v!==null&&f!==null&&c.jsx(E,{actions:s[i].actions||[],closeMenu:this.handleCloseSubMenu,top:v,left:f,updatePosition:(b,D)=>{this.setState({subMenuTop:b,subMenuLeft:D})},subMenuParentWidth:m,subMenuParentHeight:p},"sub-".concat(i))]})}}w(E,"defaultProps",{subMenuParentWidth:0,subMenuParentHeight:0,closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0});const Ze=E;function re(t,e,n){return e=Je(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Je(t){var e=Xe(t,"string");return typeof e=="symbol"?e:String(e)}function Xe(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class Qe extends d.Component{constructor(e){super(e),re(this,"container",void 0),re(this,"openMenu",void 0),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.container=I.createRef(),this.openMenu=I.createRef(),this.state={actions:null,left:0,top:0}}componentDidMount(){var e;(e=this.container.current)!==null&&e!==void 0&&e.parentElement&&this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu)}componentWillUnmount(){var e;(e=this.container.current)!==null&&e!==void 0&&e.parentElement&&this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu)}handleContextMenu(e){if(this.container.current){var n=this.container.current.getBoundingClientRect(),r=e.clientY-n.top,i=e.clientX-n.left,{actions:a}=this.state;if(a!=null&&e.target===this.container.current){e.preventDefault(),this.setState({actions:null},()=>{var s=document.elementFromPoint(i,r),u=new MouseEvent("contextmenu",{clientX:e.clientX,clientY:e.clientY,bubbles:!0,cancelable:!0});s==null||s.dispatchEvent(u)});return}if(P.isContextActionEvent(e)&&!(e.metaKey||e.ctrlKey)){var o=P.getMenuItems(e.contextActions);o.length!==0&&(e.preventDefault(),this.setState({actions:o,top:r,left:i}))}}}handleMenuClose(e){e===this.openMenu.current&&this.setState({actions:null})}render(){var e=null,{"data-testid":n}=this.props,{actions:r,top:i,left:a}=this.state;return r&&(e=c.jsx(Ze,{ref:this.openMenu,actions:r,onMenuClosed:this.handleMenuClose,top:i,left:a,updatePosition:(o,s)=>{this.setState({top:o,left:s})},"data-testid":n})),c.jsx("div",{className:z("context-menu-root",{active:r}),ref:this.container,children:e})}}const an=Qe;var Ve=x.module("ErrorBoundary");class on extends d.Component{static getDerivedStateFromError(e){return{error:e}}constructor(e){super(e),this.state={error:void 0}}componentDidCatch(e,n){var{onError:r}=this.props;Ve.error("Error caught by ErrorBoundary",e,n),r==null||r(e,n)}render(){var{children:e,className:n,fallback:r}=this.props,{error:i}=this.state;return i!=null?r??c.jsx("div",{className:n,children:c.jsx(L,{errorMessage:"".concat(i),isLoading:!1,isLoaded:!1})}):e}}function et(t,e){var n=De(),r=d.useMemo(()=>new n.CoreClient(t,e),[n,t,e]);return d.useEffect(()=>()=>{r.disconnect()},[r]),r}var be=d.createContext(null);function sn(t){var{serverUrl:e,options:n,children:r}=t,i=et(e,n);return c.jsx(be.Provider,{value:i,children:r})}function tt(){return A(be,"No Client available in useClient. Was code wrapped in ClientBootstrap or ClientContext.Provider?")}var nt=1e4;function un(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:nt;return new Promise((r,i)=>{var a,o=setTimeout(()=>{var u;(u=a)===null||u===void 0||u(),i(new ye("Timeout looking for variable ".concat(e)))},n);function s(u){var l,v=u.created.find(f=>f.title===e);clearTimeout(o),(l=a)===null||l===void 0||l(),v!=null?r(v):i(new Error("Variable ".concat(e," not found")))}a=t.subscribeToFieldUpdates(s)})}function ie(t,e,n,r,i,a,o){try{var s=t[a](o),u=s.value}catch(l){n(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function rt(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var a=t.apply(e,n);function o(u){ie(a,r,i,o,s,"next",u)}function s(u){ie(a,r,i,o,s,"throw",u)}o(void 0)})}}var F=x.module("MessageUtils"),ln="io.deephaven.message.LoginOptions.request",it="io.deephaven.message.SessionDetails.request",cn="io.deephaven.broadcast",at="io.deephaven.broadcast.Login",ot="io.deephaven.broadcast.Logout";function we(t){var e=t;return e!=null&&typeof e.id=="string"&&typeof e.message=="string"}function dn(t){return we(t)&&t.message===at}function fn(t){return we(t)&&t.message===ot}function st(t){var e=t;return e!=null&&typeof e.id=="string"}function ut(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:k(),n=arguments.length>2?arguments[2]:void 0;return{message:t,id:e,payload:n}}function hn(t,e){return{id:t,payload:e}}function lt(){return window.opener!=null?window.opener:window.parent!=null&&window.parent!==window?window.parent:null}function ct(t){return $.apply(this,arguments)}function $(){return $=rt(function*(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:3e4,n=lt();if(n==null)throw new Error("window parent is null, unable to send request.");return new Promise((r,i)=>{var a,o=k(),s=u=>{var{data:l}=u;if(!st(l)){F.debug("Ignoring non-deephaven response",l);return}if(F.debug("Received message",l),(l==null?void 0:l.id)!==o){F.debug("Ignore message, id doesn't match",l);return}window.clearTimeout(a),window.removeEventListener("message",s),r(l.payload)};window.addEventListener("message",s),a=window.setTimeout(()=>{window.removeEventListener("message",s),i(new ye("Request timed out"))},e),n.postMessage(ut(t,o),"*")})}),$.apply(this,arguments)}function dt(t,e,n){return e=ft(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ft(t){var e=ht(t,"string");return typeof e=="symbol"?e:String(e)}function ht(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class vt extends Error{constructor(){super(...arguments),dt(this,"isNoConsolesError",!0)}}function pt(t){return t.isNoConsolesError}function ae(t,e,n,r,i,a,o){try{var s=t[a](o),u=s.value}catch(l){n(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function j(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var a=t.apply(e,n);function o(u){ae(a,r,i,o,s,"next",u)}function s(u){ae(a,r,i,o,s,"throw",u)}o(void 0)})}}var C=x.module("SessionUtils");function vn(t,e){return C.info("Starting connection to '".concat(e,"'...")),new t.IdeConnection(e)}function mt(t,e,n){return U.apply(this,arguments)}function U(){return U=j(function*(t,e,n){C.info("Getting console types...");var r=yield e.getConsoleTypes();if(r.length===0)throw new vt("No console types available");C.info("Available types:",r);var i=r[0];C.info("Starting session with type",i);var a=yield e.startSession(i),o={type:i,id:k()};return C.info("Console session established",o),{session:a,config:o,connection:e,details:n,dh:t}}),U.apply(this,arguments)}function pn(t,e,n){return C.info("createCoreClient",e),new t.CoreClient(e,n)}function gt(t){return t!=null&&typeof t=="object"}function yt(){return K.apply(this,arguments)}function K(){return K=j(function*(){var t=yield ct(it);if(!gt(t))throw new Error("Unexpected session details response: ".concat(t));return t}),K.apply(this,arguments)}function mn(){return B.apply(this,arguments)}function B(){return B=j(function*(){var t=new URLSearchParams(window.location.search);switch(t.get("authProvider")){case"parent":return yt()}return{}}),B.apply(this,arguments)}function gn(t,e,n){return G.apply(this,arguments)}function G(){return G=j(function*(t,e,n){var r;try{r=yield mt(t,e,n)}catch(i){if(!pt(i))throw i}return r}),G.apply(this,arguments)}function bt(t){var e=[...t.entries()].filter(n=>{var[,r]=n;return Te(r)||Z(r)});return e.map(n=>{var[r,i]=n;if(Z(i)){var{DashboardPlugin:a}=i;return c.jsx(a,{},r)}var{component:o}=i;return c.jsx(o,{},r)})}function yn(){var t=_e(),e=d.useMemo(()=>bt(t),[t]);return e}var bn=d.createContext({}),wn=d.createContext({}),wt=d.createContext(null);function oe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function St(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?oe(Object(n),!0).forEach(function(r){Mt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):oe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Mt(t,e,n){return e=Pt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Pt(t){var e=Ot(t,"string");return typeof e=="symbol"?e:String(e)}function Ot(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Ct=100,R=()=>{},xt=Object.freeze({});function Et(t){var{id:e="default",children:n,emptyDashboard:r,layoutConfig:i,layoutSettings:a=xt,onLayoutConfigChange:o=R,onGoldenLayoutChange:s=R,onLayoutInitialized:u=R,fallbackComponent:l=Ne,hydrate:v,dehydrate:f,panelWrapper:m}=t,p=d.useRef(null),[h,S]=d.useState(!1),[y,O]=d.useState();d.useEffect(function(){if(!p.current){O(void 0);return}var M=St({},Ie.makeDefaultLayout());M.settings===void 0&&(M.settings={}),Object.assign(M.settings,a),M.content=[];var b=new Le(M,p.current),D=()=>{b.off("initialised",D),S(!0)};return b.on("initialised",D),l!=null&&b.setFallbackComponent(l),b.init(),O(b),s(b),()=>{b.destroy()}},[a,l,s,S,O]);var N=d.useMemo(()=>Oe(()=>{y!=null&&y.isInitialised&&(y==null||y.updateSize())},Ct),[y]);return ke(p.current,N),c.jsxs("div",{className:"dashboard-container w-100 h-100",children:[c.jsx("div",{className:"w-100 h-100",ref:p}),h&&y&&c.jsx(Ae.Provider,{value:y,children:c.jsx(je,{emptyDashboard:r,id:e,layout:y,layoutConfig:i,onLayoutChange:o,onLayoutInitialized:u,hydrate:v,dehydrate:f,panelWrapper:m,children:n})})]})}var H="CREATE_DASHBOARD";function Dt(t,e){try{t.off(H,e)}catch{}}function Sn(t,e){return t.on(H,e),()=>Dt(t,e)}function Mn(t,e){t.emit(H,e)}var _t=["id","isActive","plugins"];function se(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ue(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?se(Object(n),!0).forEach(function(r){Tt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):se(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Tt(t,e,n){return e=It(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function It(t){var e=Lt(t,"string");return typeof e=="symbol"?e:String(e)}function Lt(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function At(t,e){if(t==null)return{};var n=jt(t,e),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)r=a[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function jt(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,a;for(a=0;a<r.length;a++)i=r[a],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}function Nt(t){var{id:e,isActive:n,plugins:r}=t,i=At(t,_t),[a,o]=d.useState(n),s=Ce(),u=d.useCallback(l=>{s(e===Fe?Re({layoutConfig:l}):$e(e,{layoutConfig:l}))},[e,s]);return!a&&n&&o(!0),a?c.jsx(Et,ue(ue({id:e,onLayoutConfigChange:u},i),{},{children:r})):c.jsx(L,{})}var Ft=d.createContext(null);function le(t,e,n,r,i,a,o){try{var s=t[a](o),u=s.value}catch(l){n(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function Rt(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var a=t.apply(e,n);function o(u){le(a,r,i,o,s,"next",u)}function s(u){le(a,r,i,o,s,"throw",u)}o(void 0)})}}var Se=d.createContext(null);function Pn(t){var{children:e}=t,n=tt(),[r,i]=d.useState(),[a,o]=d.useState();d.useEffect(function(){var l=!1;function v(){return f.apply(this,arguments)}function f(){return f=Rt(function*(){try{var m=yield n.getServerConfigValues();l||i(new Map(m))}catch(p){l||o(p)}}),f.apply(this,arguments)}return v(),()=>{l=!0}},[n]);var s=r==null;return s||a!=null?c.jsx(L,{isLoading:s&&a==null,errorMessage:ze(a)}):c.jsx(Se.Provider,{value:r,children:e})}function On(){return A(Se,"No server config available in useServerConfig. Was code wrapped in ServerConfigBootstrap or ServerConfigContext.Provider?")}function ce(t,e,n,r,i,a,o){try{var s=t[a](o),u=s.value}catch(l){n(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function $t(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var a=t.apply(e,n);function o(u){ce(a,r,i,o,s,"next",u)}function s(u){ce(a,r,i,o,s,"throw",u)}o(void 0)})}}function de(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function fe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?de(Object(n),!0).forEach(function(r){Ut(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):de(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Ut(t,e,n){return e=Kt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Kt(t){var e=Bt(t,"string");return typeof e=="symbol"?e:String(e)}function Bt(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Cn(t){var{dashboards:e,activeDashboard:n,onLayoutInitialized:r,onGoldenLayoutChange:i,plugins:a,emptyDashboard:o=c.jsx(L,{})}=t,s=Ue(),u=d.useCallback((l,v)=>{var{metadata:f}=l;try{if(f!=null){var m=Ke(f);return fe(fe({fetch:function(){var p=$t(function*(){return s(m)});function h(){return p.apply(this,arguments)}return h}()},l),{},{localDashboardId:v})}}catch{}return Be.hydrate(l,v)},[s]);return c.jsx("div",{className:"tab-content",children:e.map(l=>c.jsx("div",{className:z("tab-pane",{active:l.id===n}),children:c.jsx(Nt,{id:l.id,isActive:l.id===n,emptyDashboard:o,layoutConfig:l.layoutConfig,layoutSettings:l.layoutSettings,onLayoutInitialized:r,onGoldenLayoutChange:i,hydrate:u,plugins:a},l.key)},l.id))})}function xn(){return A(Ft,"No IdeConnection available in useConnection. Was code wrapped in ConnectionContext.Provider?")}function En(){return A(wt,"No user available in useUser. Was code wrapped in UserBootstrap or UserContext.Provider?")}function he(t,e,n,r,i,a,o){try{var s=t[a](o),u=s.value}catch(l){n(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function ve(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var a=t.apply(e,n);function o(u){he(a,r,i,o,s,"next",u)}function s(u){he(a,r,i,o,s,"throw",u)}o(void 0)})}}function pe(t,e,n){return e=Gt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Gt(t){var e=Wt(t,"string");return typeof e=="symbol"?e:String(e)}function Wt(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class Dn{constructor(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";pe(this,"storageService",void 0),pe(this,"root",void 0),this.storageService=e,this.root=n}getLayouts(){var e=this;return ve(function*(){var n=yield e.storageService.listItems(e.root,"*.json");return n.map(r=>r.basename)})()}getLayout(e){var n=this;return ve(function*(){var r=yield n.storageService.loadFile("".concat(n.root,"/").concat(e)),i=yield r.text();return JSON.parse(i)})()}}function zt(t){return t.version===2}function kt(t){return Array.isArray(t)}function me(t,e,n,r,i,a,o){try{var s=t[a](o),u=s.value}catch(l){n(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function Ht(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var a=t.apply(e,n);function o(u){me(a,r,i,o,s,"next",u)}function s(u){me(a,r,i,o,s,"throw",u)}o(void 0)})}}var _=x.module("UserLayoutUtils"),qt={layoutConfig:[{type:"column",content:[{type:"row",height:40,content:[{type:"stack",content:[{type:"react-component",component:J.COMPONENT,title:J.TITLE,isClosable:!1},{type:"react-component",component:X.COMPONENT,title:X.TITLE,isClosable:!1}]},{type:"stack",width:25,content:[{type:"react-component",component:Q.COMPONENT,title:Q.TITLE,isClosable:!1},{type:"react-component",component:V.COMPONENT,title:V.TITLE,isClosable:!1}]}]},{type:"row",content:[{type:"stack",title:"Notebooks",content:[]}]}]}],links:[],filterSets:[],version:2},Yt={layoutConfig:[],links:[],filterSets:[],version:2};function Me(t){if(zt(t))return t;if(kt(t)){var e=t;return{layoutConfig:e,links:[],filterSets:[],version:2}}throw new Error("Unexpected layout import format: ".concat(t))}function Zt(t){return W.apply(this,arguments)}function W(){return W=Ht(function*(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;try{var n=yield t.getLayouts();if(n.length>0)try{var r=yield t.getLayout(n[0]);return Me(r)}catch(i){_.error("Unable to load layout",n[0],":",i),_.warn("No valid layouts found, falling back to default layout")}}catch(i){_.error("Unable to fetch layout list",i),_.warn("Falling back to default layout")}return e?qt:Yt}),W.apply(this,arguments)}function Jt(t){var{filterSets:e,layoutConfig:n,links:r,pluginDataMap:i}=t,a={filterSets:e,layoutConfig:n,links:r,pluginDataMap:i,version:2};return a}const Xt={exportLayout:Jt,getDefaultLayout:Zt,normalizeLayout:Me};function ge(t,e,n,r,i,a,o){try{var s=t[a](o),u=s.value}catch(l){n(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function T(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var a=t.apply(e,n);function o(u){ge(a,r,i,o,s,"next",u)}function s(u){ge(a,r,i,o,s,"throw",u)}o(void 0)})}}function Pe(t,e,n){return e=Qt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Qt(t){var e=Vt(t,"string");return typeof e=="symbol"?e:String(e)}function Vt(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var en=x.module("LocalWorkspaceStorage");class g{static getBooleanServerConfig(e,n){var r,i;if((e==null||(r=e.get(n))===null||r===void 0?void 0:r.toLowerCase())==="true")return!0;if((e==null||(i=e.get(n))===null||i===void 0?void 0:i.toLowerCase())==="false")return!1}static makeDefaultWorkspaceSettings(e){for(var n={defaultDateTimeFormat:ee.DEFAULT_DATETIME_FORMAT_STRING,formatter:[],timeZone:ee.DEFAULT_TIME_ZONE_ID,showTimeZone:!1,showTSeparator:!0,disableMoveConfirmation:!1,defaultDecimalFormatOptions:{defaultFormatString:Ge.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:We.DEFAULT_FORMAT_STRING},truncateNumbersWithPound:!1,showEmptyStrings:!0,showNullStrings:!0,defaultNotebookSettings:{isMinimapEnabled:!1}},r={defaultDateTimeFormat:e==null?void 0:e.get("dateTimeFormat"),formatter:[],timeZone:e==null?void 0:e.get("timeZone"),showTimeZone:g.getBooleanServerConfig(e,"showTimeZone"),showTSeparator:g.getBooleanServerConfig(e,"showTSeparator"),disableMoveConfirmation:g.getBooleanServerConfig(e,"disableMoveConfirmation"),defaultDecimalFormatOptions:(e==null?void 0:e.get("decimalFormat"))!==void 0?{defaultFormatString:e==null?void 0:e.get("decimalFormat")}:void 0,defaultIntegerFormatOptions:(e==null?void 0:e.get("integerFormat"))!==void 0?{defaultFormatString:e==null?void 0:e.get("integerFormat")}:void 0,truncateNumbersWithPound:g.getBooleanServerConfig(e,"truncateNumbersWithPound"),showEmptyStrings:g.getBooleanServerConfig(e,"showEmptyStrings"),showNullStrings:g.getBooleanServerConfig(e,"showNullStrings"),defaultNotebookSettings:(e==null?void 0:e.get("isMinimapEnabled"))!==void 0?{isMinimapEnabled:g.getBooleanServerConfig(e,"isMinimapEnabled")}:void 0},i=Object.keys(r),a=0;a<i.length;a+=1){var o=i[a];r[o]!==void 0&&(n[o]=r[o])}return n}static makeWorkspaceData(e,n){return T(function*(){var{filterSets:r,links:i,layoutConfig:a,pluginDataMap:o={}}=yield Xt.getDefaultLayout(e,n==null?void 0:n.isConsoleAvailable);return{settings:{},layoutConfig:a,closed:[{}],links:i,filterSets:r,pluginDataMap:o}})()}static makeDefaultWorkspace(e,n){return T(function*(){return{data:yield g.makeWorkspaceData(e,n)}})()}constructor(e){Pe(this,"layoutStorage",void 0),this.layoutStorage=e}load(e){var n=this;return T(function*(){try{var r,i=JSON.parse((r=localStorage.getItem(g.STORAGE_KEY))!==null&&r!==void 0?r:"");return i}catch{return en.info("Unable to load workspace data, initializing to default data"),g.makeDefaultWorkspace(n.layoutStorage,e)}})()}save(e){return T(function*(){return localStorage.setItem(g.STORAGE_KEY,JSON.stringify(e)),e})()}}Pe(g,"STORAGE_KEY","deephaven.WorkspaceStorage");export{Me as $,Cn as A,cn as B,an as C,hn as D,on as E,nt as F,Dn as G,ct as H,bt as I,ze as J,wt as K,g as L,bn as M,vt as N,Et as O,H as P,Nt as Q,Mn as R,it as S,Ft as T,wn as U,Pn as V,Xt as W,zt as X,kt as Y,qt as Z,Yt as _,tt as a,Zt as a0,Jt as a1,En as b,On as c,yn as d,gn as e,un as f,mn as g,ke as h,sn as i,be as j,at as k,Sn as l,ot as m,ln as n,vn as o,pn as p,mt as q,lt as r,Dt as s,dn as t,xn as u,fn as v,we as w,pt as x,st as y,ut as z};
|
|
2
|
-
//# sourceMappingURL=LocalWorkspaceStorage-
|
|
1
|
+
import{r as d,M as I,I as c,K as z,Q as k,b3 as Oe,N as Ce}from"./vendor-24151293.js";import{L as x,q as xe,a as L}from"./index-9a9c830b.js";import{y as P,a4 as Y,z as Ee,u as De,k as A,aU as ye,a6 as _e,ad as Te,af as Z,as as Ie,aV as Le,au as Ae,ax as je,aW as Ne,aw as Fe,aX as Re,aP as $e,$ as Ue,_ as Ke,ay as Be,aY as J,aZ as X,a_ as Q,a$ as V,a0 as ee,a1 as Ge,a2 as We}from"./LogPanel-7df173a5.js";function ze(t){var e=t;t instanceof CustomEvent&&(e=t.detail);var n="";if(e instanceof Error?n=e.message:e!=null&&(n="".concat(e)),n=n.trim(),n.length>0)return n}function ke(t,e){d.useEffect(()=>{if(t!=null){var n=new window.ResizeObserver(e);return n.observe(t),()=>{t!=null&&n.unobserve(t)}}},[t,e])}function te(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function He(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?te(Object(n),!0).forEach(function(r){w(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):te(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function w(t,e,n){return e=qe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function qe(t){var e=Ye(t,"string");return typeof e=="symbol"?e:String(e)}function Ye(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var ne=x.module("ContextMenu");class E extends d.PureComponent{static handleContextMenu(e){e.metaKey||(e.stopPropagation(),e.preventDefault())}constructor(e){super(e),w(this,"container",void 0),w(this,"oldFocus",void 0),w(this,"activeSubMenuRef",void 0),w(this,"subMenuTimer",void 0),w(this,"rAF",void 0),w(this,"initialPosition",void 0),this.handleBlur=this.handleBlur.bind(this),this.handleCloseSubMenu=this.handleCloseSubMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMenuItemClick=this.handleMenuItemClick.bind(this),this.handleMenuItemContextMenu=this.handleMenuItemContextMenu.bind(this),this.handleMenuItemMouseMove=this.handleMenuItemMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleWindowResize=this.handleWindowResize.bind(this),this.container=I.createRef(),this.oldFocus=document.activeElement,this.activeSubMenuRef=I.createRef(),this.subMenuTimer=0,this.rAF=0,this.initialPosition={top:e.top,left:e.left},this.state={menuItems:[],pendingItems:[],activeSubMenu:null,hasOverflow:!1,subMenuTop:null,subMenuLeft:null,subMenuParentWidth:0,subMenuParentHeight:0,keyboardIndex:-1,mouseIndex:-1}}componentDidMount(){this.initMenu(),this.verifyPosition(),window.addEventListener("resize",this.handleWindowResize),this.rAF=window.requestAnimationFrame(()=>{var e;(e=this.container.current)===null||e===void 0||e.focus();var{onMenuOpened:n}=this.props;n(this)})}componentDidUpdate(e,n){var{actions:r}=this.props,{activeSubMenu:i}=this.state;if(i!==n.activeSubMenu)if(i==null){var a;(a=this.container.current)===null||a===void 0||a.focus()}else this.setActiveSubMenuPosition();if(e.actions!==r&&(this.initMenu(),this.container.current==null||!this.container.current.contains(document.activeElement))){var o;(o=this.container.current)===null||o===void 0||o.focus()}this.verifyPosition()}componentWillUnmount(){this.cancelPromises(),window.removeEventListener("resize",this.handleWindowResize),cancelAnimationFrame(this.rAF)}getKeyboardIndex(){var{options:e}=this.props;if(e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse){var{keyboardIndex:n}=this.state;return n}return this.getMouseIndex()}setKeyboardIndex(e){var{options:n}=this.props;n.separateKeyboardMouse!==void 0&&n.separateKeyboardMouse?this.setState({keyboardIndex:e}):this.setMouseIndex(e)}getMouseIndex(){var{mouseIndex:e}=this.state;return e}setMouseIndex(e){this.setState({mouseIndex:e})}initMenu(){this.cancelPromises(),cancelAnimationFrame(this.rAF);var{options:e}=this.props,n=e.initialKeyboardIndex;n===void 0&&(n=-1);for(var{actions:r}=this.props,i=P.getMenuItems(r),a=[],o=i.length-1;o>=0;o-=1){var s=i[o];s instanceof Promise?this.initMenuPromise(s):a.push(s)}this.setState({mouseIndex:-1,keyboardIndex:n,activeSubMenu:null,menuItems:P.sortActions(a)})}initMenuPromise(e){var n=Y.makeCancelable(e);this.setState(r=>({pendingItems:r.pendingItems.concat(n)})),n.then(r=>{this.setState(i=>{var a=i.pendingItems.indexOf(n);if(a>=0){var o=i.pendingItems.slice();return o.splice(a,1),{menuItems:P.sortActions(i.menuItems.concat(r)),pendingItems:o}}return null})},r=>{Y.isCanceled(r)||(this.setState(i=>{var a=i.pendingItems.indexOf(n);if(a>=0){var o=i.pendingItems.slice();return o.splice(a,1),{pendingItems:o}}return null}),ne.error(r))})}cancelPromises(){var{pendingItems:e}=this.state;e.map(n=>n.cancel())}setActiveSubMenuPosition(){if(this.activeSubMenuRef.current!==null){var e=this.activeSubMenuRef.current.getBoundingClientRect();this.setState({subMenuTop:e.top,subMenuLeft:e.right,subMenuParentHeight:e.height,subMenuParentWidth:e.width})}}verifyPosition(){var e,n,r,i,{options:a,updatePosition:o,subMenuParentWidth:s,subMenuParentHeight:u,top:l,left:v}=this.props;if(!(!this.container.current||a.doNotVerifyPosition!=null&&a.doNotVerifyPosition)){var{top:f,left:m}=this.initialPosition,{width:p,height:h}=(e=(n=this.container.current)===null||n===void 0?void 0:n.getBoundingClientRect())!==null&&e!==void 0?e:{width:0,height:0},S=((r=(i=this.container.current)===null||i===void 0?void 0:i.scrollHeight)!==null&&r!==void 0?r:0)>window.innerHeight;h===0||p===0||(f+h>window.innerHeight&&(f-h-u>0?f-=h-u:f=window.innerHeight-h),m+p>window.innerWidth&&(m=m-p-s),(v!==m||l!==f)&&(this.setState({hasOverflow:S}),o(f,m)))}}handleWindowResize(){this.container.current&&this.closeMenu(!0)}handleBlur(e){if(!this.container.current){ne.warn("Container is null!");return}if(!this.container.current.contains(e.relatedTarget)){for(var n=e.relatedTarget,r=!1;n&&!r;)r=n.hasAttribute("data-dh-context-menu"),n=n.parentElement;r||this.closeMenu(!0)}}isEscapeKey(e){var{left:n}=this.props;return e==="Escape"||n<0&&e==="ArrowRight"||e==="ArrowLeft"}handleKeyDown(e){var{menuItems:n}=this.state,r=this.getKeyboardIndex(),i=r,a=!1;if(e.key==="Enter"||e.key===" "){r>=0&&r<n.length&&this.handleMenuItemClick(n[r],e);return}if(e.key==="ArrowRight"?r>=0&&r<=n.length?a=!0:i=0:this.isEscapeKey(e.key)?i=null:e.key==="ArrowUp"||e.shiftKey&&e.key==="Tab"?i=P.getNextMenuItem(i,-1,n):(e.key==="ArrowDown"||e.key==="Tab")&&(i=P.getNextMenuItem(i,1,n)),a){this.openSubMenu(r),e.preventDefault(),e.stopPropagation();return}r!==i&&(i!==null?this.setKeyboardIndex(i):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}openSubMenu(e){var{menuItems:n,activeSubMenu:r}=this.state,i=n[e].actions?e:null;r!==i&&this.setState({activeSubMenu:i,subMenuTop:null,subMenuLeft:null})}closeMenu(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,{closeMenu:n,onMenuClosed:r}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{n(e),r(this)})}closeSubMenu(){this.setState({activeSubMenu:null})}handleCloseSubMenu(e){e?this.closeMenu(!0):this.closeSubMenu()}handleMenuItemClick(e,n){n.preventDefault(),n.stopPropagation();var{menuItems:r}=this.state;e!=null&&(e.disabled===void 0||!e.disabled)&&(e.actions!=null?this.openSubMenu(r.indexOf(e)):e.action!=null&&(e.action(n.nativeEvent),this.closeMenu(!0)))}handleMenuItemContextMenu(e,n){n.metaKey||this.handleMenuItemClick(e,n)}handleMenuItemMouseMove(e){var{menuItems:n}=this.state,r=n.indexOf(e);this.setMouseIndex(r),r>=0&&r<n.length&&(e.disabled===void 0||!e.disabled)&&this.openSubMenu(r)}handleMouseLeave(){this.setMouseIndex(-1)}render(){for(var e=[],{top:n,left:r}=this.props,{activeSubMenu:i,hasOverflow:a,keyboardIndex:o,menuItems:s,mouseIndex:u,pendingItems:l,subMenuTop:v,subMenuLeft:f,subMenuParentWidth:m,subMenuParentHeight:p}=this.state,h=0;h<s.length;h+=1){var S=s[h];h>0&&S.group!==s[h-1].group&&e.push(c.jsx("hr",{},"".concat(h,".separator")));var y=c.jsx(Ee,{ref:i===h?this.activeSubMenuRef:null,isKeyboardSelected:o===h,isMouseSelected:u===h,menuItem:S,closeMenu:this.handleCloseSubMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:this.handleMenuItemContextMenu},h);e.push(y)}var O=null;l.length>0&&(O=c.jsx("div",{className:"loading",children:c.jsx(xe,{className:"loading-spinner-vertical-align"})}));var{menuStyle:N,"data-testid":q}=this.props,M=i!==null&&v!==null&&f!==null;return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:z({"has-overflow":a},"context-menu-container"),style:He({top:n,left:r},N),ref:this.container,"data-dh-context-menu":!0,onBlur:this.handleBlur,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,onContextMenu:E.handleContextMenu,role:"menuitem",tabIndex:0,"data-testid":q,children:[e,O]}),M&&i!==null&&v!==null&&f!==null&&c.jsx(E,{actions:s[i].actions||[],closeMenu:this.handleCloseSubMenu,top:v,left:f,updatePosition:(b,D)=>{this.setState({subMenuTop:b,subMenuLeft:D})},subMenuParentWidth:m,subMenuParentHeight:p},"sub-".concat(i))]})}}w(E,"defaultProps",{subMenuParentWidth:0,subMenuParentHeight:0,closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0});const Ze=E;function re(t,e,n){return e=Je(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Je(t){var e=Xe(t,"string");return typeof e=="symbol"?e:String(e)}function Xe(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class Qe extends d.Component{constructor(e){super(e),re(this,"container",void 0),re(this,"openMenu",void 0),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.container=I.createRef(),this.openMenu=I.createRef(),this.state={actions:null,left:0,top:0}}componentDidMount(){var e;(e=this.container.current)!==null&&e!==void 0&&e.parentElement&&this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu)}componentWillUnmount(){var e;(e=this.container.current)!==null&&e!==void 0&&e.parentElement&&this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu)}handleContextMenu(e){if(this.container.current){var n=this.container.current.getBoundingClientRect(),r=e.clientY-n.top,i=e.clientX-n.left,{actions:a}=this.state;if(a!=null&&e.target===this.container.current){e.preventDefault(),this.setState({actions:null},()=>{var s=document.elementFromPoint(i,r),u=new MouseEvent("contextmenu",{clientX:e.clientX,clientY:e.clientY,bubbles:!0,cancelable:!0});s==null||s.dispatchEvent(u)});return}if(P.isContextActionEvent(e)&&!(e.metaKey||e.ctrlKey)){var o=P.getMenuItems(e.contextActions);o.length!==0&&(e.preventDefault(),this.setState({actions:o,top:r,left:i}))}}}handleMenuClose(e){e===this.openMenu.current&&this.setState({actions:null})}render(){var e=null,{"data-testid":n}=this.props,{actions:r,top:i,left:a}=this.state;return r&&(e=c.jsx(Ze,{ref:this.openMenu,actions:r,onMenuClosed:this.handleMenuClose,top:i,left:a,updatePosition:(o,s)=>{this.setState({top:o,left:s})},"data-testid":n})),c.jsx("div",{className:z("context-menu-root",{active:r}),ref:this.container,children:e})}}const an=Qe;var Ve=x.module("ErrorBoundary");class on extends d.Component{static getDerivedStateFromError(e){return{error:e}}constructor(e){super(e),this.state={error:void 0}}componentDidCatch(e,n){var{onError:r}=this.props;Ve.error("Error caught by ErrorBoundary",e,n),r==null||r(e,n)}render(){var{children:e,className:n,fallback:r}=this.props,{error:i}=this.state;return i!=null?r??c.jsx("div",{className:n,children:c.jsx(L,{errorMessage:"".concat(i),isLoading:!1,isLoaded:!1})}):e}}function et(t,e){var n=De(),r=d.useMemo(()=>new n.CoreClient(t,e),[n,t,e]);return d.useEffect(()=>()=>{r.disconnect()},[r]),r}var be=d.createContext(null);function sn(t){var{serverUrl:e,options:n,children:r}=t,i=et(e,n);return c.jsx(be.Provider,{value:i,children:r})}function tt(){return A(be,"No Client available in useClient. Was code wrapped in ClientBootstrap or ClientContext.Provider?")}var nt=1e4;function un(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:nt;return new Promise((r,i)=>{var a,o=setTimeout(()=>{var u;(u=a)===null||u===void 0||u(),i(new ye("Timeout looking for variable ".concat(e)))},n);function s(u){var l,v=u.created.find(f=>f.title===e);clearTimeout(o),(l=a)===null||l===void 0||l(),v!=null?r(v):i(new Error("Variable ".concat(e," not found")))}a=t.subscribeToFieldUpdates(s)})}function ie(t,e,n,r,i,a,o){try{var s=t[a](o),u=s.value}catch(l){n(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function rt(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var a=t.apply(e,n);function o(u){ie(a,r,i,o,s,"next",u)}function s(u){ie(a,r,i,o,s,"throw",u)}o(void 0)})}}var F=x.module("MessageUtils"),ln="io.deephaven.message.LoginOptions.request",it="io.deephaven.message.SessionDetails.request",cn="io.deephaven.broadcast",at="io.deephaven.broadcast.Login",ot="io.deephaven.broadcast.Logout";function we(t){var e=t;return e!=null&&typeof e.id=="string"&&typeof e.message=="string"}function dn(t){return we(t)&&t.message===at}function fn(t){return we(t)&&t.message===ot}function st(t){var e=t;return e!=null&&typeof e.id=="string"}function ut(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:k(),n=arguments.length>2?arguments[2]:void 0;return{message:t,id:e,payload:n}}function hn(t,e){return{id:t,payload:e}}function lt(){return window.opener!=null?window.opener:window.parent!=null&&window.parent!==window?window.parent:null}function ct(t){return $.apply(this,arguments)}function $(){return $=rt(function*(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:3e4,n=lt();if(n==null)throw new Error("window parent is null, unable to send request.");return new Promise((r,i)=>{var a,o=k(),s=u=>{var{data:l}=u;if(!st(l)){F.debug("Ignoring non-deephaven response",l);return}if(F.debug("Received message",l),(l==null?void 0:l.id)!==o){F.debug("Ignore message, id doesn't match",l);return}window.clearTimeout(a),window.removeEventListener("message",s),r(l.payload)};window.addEventListener("message",s),a=window.setTimeout(()=>{window.removeEventListener("message",s),i(new ye("Request timed out"))},e),n.postMessage(ut(t,o),"*")})}),$.apply(this,arguments)}function dt(t,e,n){return e=ft(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ft(t){var e=ht(t,"string");return typeof e=="symbol"?e:String(e)}function ht(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class vt extends Error{constructor(){super(...arguments),dt(this,"isNoConsolesError",!0)}}function pt(t){return t.isNoConsolesError}function ae(t,e,n,r,i,a,o){try{var s=t[a](o),u=s.value}catch(l){n(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function j(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var a=t.apply(e,n);function o(u){ae(a,r,i,o,s,"next",u)}function s(u){ae(a,r,i,o,s,"throw",u)}o(void 0)})}}var C=x.module("SessionUtils");function vn(t,e){return C.info("Starting connection to '".concat(e,"'...")),new t.IdeConnection(e)}function mt(t,e,n){return U.apply(this,arguments)}function U(){return U=j(function*(t,e,n){C.info("Getting console types...");var r=yield e.getConsoleTypes();if(r.length===0)throw new vt("No console types available");C.info("Available types:",r);var i=r[0];C.info("Starting session with type",i);var a=yield e.startSession(i),o={type:i,id:k()};return C.info("Console session established",o),{session:a,config:o,connection:e,details:n,dh:t}}),U.apply(this,arguments)}function pn(t,e,n){return C.info("createCoreClient",e),new t.CoreClient(e,n)}function gt(t){return t!=null&&typeof t=="object"}function yt(){return K.apply(this,arguments)}function K(){return K=j(function*(){var t=yield ct(it);if(!gt(t))throw new Error("Unexpected session details response: ".concat(t));return t}),K.apply(this,arguments)}function mn(){return B.apply(this,arguments)}function B(){return B=j(function*(){var t=new URLSearchParams(window.location.search);switch(t.get("authProvider")){case"parent":return yt()}return{}}),B.apply(this,arguments)}function gn(t,e,n){return G.apply(this,arguments)}function G(){return G=j(function*(t,e,n){var r;try{r=yield mt(t,e,n)}catch(i){if(!pt(i))throw i}return r}),G.apply(this,arguments)}function bt(t){var e=[...t.entries()].filter(n=>{var[,r]=n;return Te(r)||Z(r)});return e.map(n=>{var[r,i]=n;if(Z(i)){var{DashboardPlugin:a}=i;return c.jsx(a,{},r)}var{component:o}=i;return c.jsx(o,{},r)})}function yn(){var t=_e(),e=d.useMemo(()=>bt(t),[t]);return e}var bn=d.createContext({}),wn=d.createContext({}),wt=d.createContext(null);function oe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function St(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?oe(Object(n),!0).forEach(function(r){Mt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):oe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Mt(t,e,n){return e=Pt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Pt(t){var e=Ot(t,"string");return typeof e=="symbol"?e:String(e)}function Ot(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Ct=100,R=()=>{},xt=Object.freeze({});function Et(t){var{id:e="default",children:n,emptyDashboard:r,layoutConfig:i,layoutSettings:a=xt,onLayoutConfigChange:o=R,onGoldenLayoutChange:s=R,onLayoutInitialized:u=R,fallbackComponent:l=Ne,hydrate:v,dehydrate:f,panelWrapper:m}=t,p=d.useRef(null),[h,S]=d.useState(!1),[y,O]=d.useState();d.useEffect(function(){if(!p.current){O(void 0);return}var M=St({},Ie.makeDefaultLayout());M.settings===void 0&&(M.settings={}),Object.assign(M.settings,a),M.content=[];var b=new Le(M,p.current),D=()=>{b.off("initialised",D),S(!0)};return b.on("initialised",D),l!=null&&b.setFallbackComponent(l),b.init(),O(b),s(b),()=>{b.destroy()}},[a,l,s,S,O]);var N=d.useMemo(()=>Oe(()=>{y!=null&&y.isInitialised&&(y==null||y.updateSize())},Ct),[y]);return ke(p.current,N),c.jsxs("div",{className:"dashboard-container w-100 h-100",children:[c.jsx("div",{className:"w-100 h-100",ref:p}),h&&y&&c.jsx(Ae.Provider,{value:y,children:c.jsx(je,{emptyDashboard:r,id:e,layout:y,layoutConfig:i,onLayoutChange:o,onLayoutInitialized:u,hydrate:v,dehydrate:f,panelWrapper:m,children:n})})]})}var H="CREATE_DASHBOARD";function Dt(t,e){try{t.off(H,e)}catch{}}function Sn(t,e){return t.on(H,e),()=>Dt(t,e)}function Mn(t,e){t.emit(H,e)}var _t=["id","isActive","plugins"];function se(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ue(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?se(Object(n),!0).forEach(function(r){Tt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):se(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Tt(t,e,n){return e=It(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function It(t){var e=Lt(t,"string");return typeof e=="symbol"?e:String(e)}function Lt(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function At(t,e){if(t==null)return{};var n=jt(t,e),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)r=a[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function jt(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,a;for(a=0;a<r.length;a++)i=r[a],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}function Nt(t){var{id:e,isActive:n,plugins:r}=t,i=At(t,_t),[a,o]=d.useState(n),s=Ce(),u=d.useCallback(l=>{s(e===Fe?Re({layoutConfig:l}):$e(e,{layoutConfig:l}))},[e,s]);return!a&&n&&o(!0),a?c.jsx(Et,ue(ue({id:e,onLayoutConfigChange:u},i),{},{children:r})):c.jsx(L,{})}var Ft=d.createContext(null);function le(t,e,n,r,i,a,o){try{var s=t[a](o),u=s.value}catch(l){n(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function Rt(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var a=t.apply(e,n);function o(u){le(a,r,i,o,s,"next",u)}function s(u){le(a,r,i,o,s,"throw",u)}o(void 0)})}}var Se=d.createContext(null);function Pn(t){var{children:e}=t,n=tt(),[r,i]=d.useState(),[a,o]=d.useState();d.useEffect(function(){var l=!1;function v(){return f.apply(this,arguments)}function f(){return f=Rt(function*(){try{var m=yield n.getServerConfigValues();l||i(new Map(m))}catch(p){l||o(p)}}),f.apply(this,arguments)}return v(),()=>{l=!0}},[n]);var s=r==null;return s||a!=null?c.jsx(L,{isLoading:s&&a==null,errorMessage:ze(a)}):c.jsx(Se.Provider,{value:r,children:e})}function On(){return A(Se,"No server config available in useServerConfig. Was code wrapped in ServerConfigBootstrap or ServerConfigContext.Provider?")}function ce(t,e,n,r,i,a,o){try{var s=t[a](o),u=s.value}catch(l){n(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function $t(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var a=t.apply(e,n);function o(u){ce(a,r,i,o,s,"next",u)}function s(u){ce(a,r,i,o,s,"throw",u)}o(void 0)})}}function de(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function fe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?de(Object(n),!0).forEach(function(r){Ut(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):de(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Ut(t,e,n){return e=Kt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Kt(t){var e=Bt(t,"string");return typeof e=="symbol"?e:String(e)}function Bt(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Cn(t){var{dashboards:e,activeDashboard:n,onLayoutInitialized:r,onGoldenLayoutChange:i,plugins:a,emptyDashboard:o=c.jsx(L,{})}=t,s=Ue(),u=d.useCallback((l,v)=>{var{metadata:f}=l;try{if(f!=null){var m=Ke(f);return fe(fe({fetch:function(){var p=$t(function*(){return s(m)});function h(){return p.apply(this,arguments)}return h}()},l),{},{localDashboardId:v})}}catch{}return Be.hydrate(l,v)},[s]);return c.jsx("div",{className:"tab-content",children:e.map(l=>c.jsx("div",{className:z("tab-pane",{active:l.id===n}),children:c.jsx(Nt,{id:l.id,isActive:l.id===n,emptyDashboard:o,layoutConfig:l.layoutConfig,layoutSettings:l.layoutSettings,onLayoutInitialized:r,onGoldenLayoutChange:i,hydrate:u,plugins:a},l.key)},l.id))})}function xn(){return A(Ft,"No IdeConnection available in useConnection. Was code wrapped in ConnectionContext.Provider?")}function En(){return A(wt,"No user available in useUser. Was code wrapped in UserBootstrap or UserContext.Provider?")}function he(t,e,n,r,i,a,o){try{var s=t[a](o),u=s.value}catch(l){n(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function ve(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var a=t.apply(e,n);function o(u){he(a,r,i,o,s,"next",u)}function s(u){he(a,r,i,o,s,"throw",u)}o(void 0)})}}function pe(t,e,n){return e=Gt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Gt(t){var e=Wt(t,"string");return typeof e=="symbol"?e:String(e)}function Wt(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class Dn{constructor(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";pe(this,"storageService",void 0),pe(this,"root",void 0),this.storageService=e,this.root=n}getLayouts(){var e=this;return ve(function*(){var n=yield e.storageService.listItems(e.root,"*.json");return n.map(r=>r.basename)})()}getLayout(e){var n=this;return ve(function*(){var r=yield n.storageService.loadFile("".concat(n.root,"/").concat(e)),i=yield r.text();return JSON.parse(i)})()}}function zt(t){return t.version===2}function kt(t){return Array.isArray(t)}function me(t,e,n,r,i,a,o){try{var s=t[a](o),u=s.value}catch(l){n(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function Ht(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var a=t.apply(e,n);function o(u){me(a,r,i,o,s,"next",u)}function s(u){me(a,r,i,o,s,"throw",u)}o(void 0)})}}var _=x.module("UserLayoutUtils"),qt={layoutConfig:[{type:"column",content:[{type:"row",height:40,content:[{type:"stack",content:[{type:"react-component",component:J.COMPONENT,title:J.TITLE,isClosable:!1},{type:"react-component",component:X.COMPONENT,title:X.TITLE,isClosable:!1}]},{type:"stack",width:25,content:[{type:"react-component",component:Q.COMPONENT,title:Q.TITLE,isClosable:!1},{type:"react-component",component:V.COMPONENT,title:V.TITLE,isClosable:!1}]}]},{type:"row",content:[{type:"stack",title:"Notebooks",content:[]}]}]}],links:[],filterSets:[],version:2},Yt={layoutConfig:[],links:[],filterSets:[],version:2};function Me(t){if(zt(t))return t;if(kt(t)){var e=t;return{layoutConfig:e,links:[],filterSets:[],version:2}}throw new Error("Unexpected layout import format: ".concat(t))}function Zt(t){return W.apply(this,arguments)}function W(){return W=Ht(function*(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;try{var n=yield t.getLayouts();if(n.length>0)try{var r=yield t.getLayout(n[0]);return Me(r)}catch(i){_.error("Unable to load layout",n[0],":",i),_.warn("No valid layouts found, falling back to default layout")}}catch(i){_.error("Unable to fetch layout list",i),_.warn("Falling back to default layout")}return e?qt:Yt}),W.apply(this,arguments)}function Jt(t){var{filterSets:e,layoutConfig:n,links:r,pluginDataMap:i}=t,a={filterSets:e,layoutConfig:n,links:r,pluginDataMap:i,version:2};return a}const Xt={exportLayout:Jt,getDefaultLayout:Zt,normalizeLayout:Me};function ge(t,e,n,r,i,a,o){try{var s=t[a](o),u=s.value}catch(l){n(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function T(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var a=t.apply(e,n);function o(u){ge(a,r,i,o,s,"next",u)}function s(u){ge(a,r,i,o,s,"throw",u)}o(void 0)})}}function Pe(t,e,n){return e=Qt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Qt(t){var e=Vt(t,"string");return typeof e=="symbol"?e:String(e)}function Vt(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var en=x.module("LocalWorkspaceStorage");class g{static getBooleanServerConfig(e,n){var r,i;if((e==null||(r=e.get(n))===null||r===void 0?void 0:r.toLowerCase())==="true")return!0;if((e==null||(i=e.get(n))===null||i===void 0?void 0:i.toLowerCase())==="false")return!1}static makeDefaultWorkspaceSettings(e){for(var n={defaultDateTimeFormat:ee.DEFAULT_DATETIME_FORMAT_STRING,formatter:[],timeZone:ee.DEFAULT_TIME_ZONE_ID,showTimeZone:!1,showTSeparator:!0,disableMoveConfirmation:!1,defaultDecimalFormatOptions:{defaultFormatString:Ge.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:We.DEFAULT_FORMAT_STRING},truncateNumbersWithPound:!1,showEmptyStrings:!0,showNullStrings:!0,defaultNotebookSettings:{isMinimapEnabled:!1}},r={defaultDateTimeFormat:e==null?void 0:e.get("dateTimeFormat"),formatter:[],timeZone:e==null?void 0:e.get("timeZone"),showTimeZone:g.getBooleanServerConfig(e,"showTimeZone"),showTSeparator:g.getBooleanServerConfig(e,"showTSeparator"),disableMoveConfirmation:g.getBooleanServerConfig(e,"disableMoveConfirmation"),defaultDecimalFormatOptions:(e==null?void 0:e.get("decimalFormat"))!==void 0?{defaultFormatString:e==null?void 0:e.get("decimalFormat")}:void 0,defaultIntegerFormatOptions:(e==null?void 0:e.get("integerFormat"))!==void 0?{defaultFormatString:e==null?void 0:e.get("integerFormat")}:void 0,truncateNumbersWithPound:g.getBooleanServerConfig(e,"truncateNumbersWithPound"),showEmptyStrings:g.getBooleanServerConfig(e,"showEmptyStrings"),showNullStrings:g.getBooleanServerConfig(e,"showNullStrings"),defaultNotebookSettings:(e==null?void 0:e.get("isMinimapEnabled"))!==void 0?{isMinimapEnabled:g.getBooleanServerConfig(e,"isMinimapEnabled")}:void 0},i=Object.keys(r),a=0;a<i.length;a+=1){var o=i[a];r[o]!==void 0&&(n[o]=r[o])}return n}static makeWorkspaceData(e,n){return T(function*(){var{filterSets:r,links:i,layoutConfig:a,pluginDataMap:o={}}=yield Xt.getDefaultLayout(e,n==null?void 0:n.isConsoleAvailable);return{settings:{},layoutConfig:a,closed:[{}],links:i,filterSets:r,pluginDataMap:o}})()}static makeDefaultWorkspace(e,n){return T(function*(){return{data:yield g.makeWorkspaceData(e,n)}})()}constructor(e){Pe(this,"layoutStorage",void 0),this.layoutStorage=e}load(e){var n=this;return T(function*(){try{var r,i=JSON.parse((r=localStorage.getItem(g.STORAGE_KEY))!==null&&r!==void 0?r:"");return i}catch{return en.info("Unable to load workspace data, initializing to default data"),g.makeDefaultWorkspace(n.layoutStorage,e)}})()}save(e){return T(function*(){return localStorage.setItem(g.STORAGE_KEY,JSON.stringify(e)),e})()}}Pe(g,"STORAGE_KEY","deephaven.WorkspaceStorage");export{Me as $,Cn as A,cn as B,an as C,hn as D,on as E,nt as F,Dn as G,ct as H,bt as I,ze as J,wt as K,g as L,bn as M,vt as N,Et as O,H as P,Nt as Q,Mn as R,it as S,Ft as T,wn as U,Pn as V,Xt as W,zt as X,kt as Y,qt as Z,Yt as _,tt as a,Zt as a0,Jt as a1,En as b,On as c,yn as d,gn as e,un as f,mn as g,ke as h,sn as i,be as j,at as k,Sn as l,ot as m,ln as n,vn as o,pn as p,mt as q,lt as r,Dt as s,dn as t,xn as u,fn as v,we as w,pt as x,st as y,ut as z};
|
|
2
|
+
//# sourceMappingURL=LocalWorkspaceStorage-232e3da0.js.map
|