@deephaven/code-studio 0.31.2-beta.8 → 0.32.1-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/assets/{AppRoot-fbf1ea0e.js → AppRoot-c431861b.js} +5 -5
- package/build/assets/{AppRoot-fbf1ea0e.js.map → AppRoot-c431861b.js.map} +1 -1
- package/build/assets/{index-8973554a.js → index-3517d713.js} +2 -2
- package/build/assets/{index-8973554a.js.map → index-3517d713.js.map} +1 -1
- package/build/index.html +2 -2
- package/package.json +28 -28
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{A as b,B as D,H as X,P as Pm,C as l,D as gt,F as $,R as Pi,G as J,I as Pe,J as pe,K as Ye,L as _m,M as jm,N as wl,O as Za,Q as Hm,E as vl,S as Bm,T as fe,U as el,V as ks,W as bh,X as it,Y as Tl,Z as Vm,_ as Um,$ as $m,a0 as Wm,a1 as me,a2 as Fd,a3 as El,a4 as Gm,a5 as zm,a6 as wh,a7 as je,a8 as tl,a9 as Nd,aa as Qa,ab as Md,ac as Km,ad as Mn,ae as qm,af as Ym,ag as Xm,ah as Zm,ai as nl,aj as Qm,ak as Jm,al as ep,am as kd,an as tp,ao as Od,ap as np,aq as sp,ar as ip,as as op,at as ap,au as rp,av as ft,aw as vh,ax as lp,ay as Th,az as dp,aA as Eh,aB as cp,aC as hp,aD as up,aE as mp,aF as pp,aG as gp,aH as fp,aI as Cp,aJ as Sp,aK as bp,aL as Ad,aM as wp}from"./vendor-0d2b9258.js";import{e as Yn,l as wi,K as rn,a as Ld,b as xs,W as vp}from"./monaco-1ecfd680.js";import{T as We,L as Z,M as Do,a as Fo,b as No,v as yh,c as Ln,d as xh,e as kn,f as Tp,g as Ep,h as Mo,i as yp,j as Ui,k as yl,l as xp,m as sl,n as Rp,o as Rh,p as xl,q as Ih,r as Pd,s as Ip,t as Dp,u as Fp,w as Np,x as Qt,y as Ms,z as Dh,A as Xn,B as Ja,C as _i,D as Mp,E as kp,F as _d,G as ya,H as jd,I as Fh,J as Op,K as ko,N as Nh,O as Ap,P as Lp,Q as Rl,R as Il,S as xa,U as Bn,V as Pp,W as _p,X as jp,Y as Hp,Z as Bp,_ as Dl,$ as Os,a0 as Hd,a1 as Oo,a2 as Fl,a3 as Nl,a4 as Vp,a5 as Up,a6 as Ra,a7 as $p,a8 as Ml,a9 as Mh,aa as ei,ab as Wp,ac as Gp,ad as zp,ae as Kp,af as qp,ag as Yp,ah as Bd,ai as Mr,aj as Xp,ak as Zp,al as Qp,am as Jp,an as eg,ao as kh,ap as tg,aq as ng,ar as sg,as as Oh,at as ig,au as og,av as ag,aw as rg,ax as lg,ay as dg,az as cg,aA as hg,aB as ug,aC as mg,aD as pg,aE as gg,aF as Ah,aG as fg,aH as il,aI as ol,aJ as Cg,aK as Sg,aL as bg,aM as wg,aN as vg,aO as Tg,aP as Eg,aQ as yg,aR as xg,aS as Rg,aT as Ig,aU as Vd,aV as Dg,aW as Fg}from"./index-8973554a.js";import{P as Ia,b as Ng,h as Mg,p as kg,o as Og,s as Ag,t as Lg,c as kr}from"./plotly-08ea603d.js";import"./helpers-042e6b4d.js";class Pg extends b.Component{static propTypes={children:D.node.isRequired,options:D.shape({}),className:D.string,timeout:D.number,onEntered:D.func,onExited:D.func,isShown:D.bool,closeOnBlur:D.bool,interactive:D.bool,referenceObject:D.shape({}),"data-testid":D.string};static defaultProps={options:{},className:"",timeout:We.transitionMs,onEntered(){},onExited(){},isShown:!1,interactive:!1,closeOnBlur:!1,referenceObject:null,"data-testid":void 0};constructor(e){super(e),this.handleEnter=this.handleEnter.bind(this),this.handleExit=this.handleExit.bind(this),this.handleBlur=this.handleBlur.bind(this),this.element=document.createElement("div"),this.element.className="popper-container",this.container=X.createRef(),this.rAF=0;const{isShown:t}=this.props;this.state={show:t,popper:null}}componentDidUpdate(e){const{isShown:t}=this.props;e.isShown!==t&&(t?(cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{this.show()})):this.hide())}componentWillUnmount(){this.destroyPopper(!1)}element;container;rAF;getVisibleElement(e){return e==null||e.clientHeight>0||e.clientWidth>0?e:this.getVisibleElement(e.parentElement)}initPopper(){let{popper:e}=this.state;const{closeOnBlur:t,referenceObject:n}=this.props;if(e||this.container.current===null)return;let{options:s}=this.props;s={placement:"auto",modifiers:{preventOverflow:{boundariesElement:"viewport"}},...s},document.body.appendChild(this.element);let i=this.getVisibleElement(this.container.current);i==null&&(i=this.container.current),e=new Pm(n||i,this.element,s),e.scheduleUpdate(),cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{if(t&&!this.element.contains(document.activeElement)){const o=this.element.firstElementChild;o instanceof HTMLElement&&o.focus()}}),this.setState({popper:e})}destroyPopper(e=!0){cancelAnimationFrame(this.rAF);const{popper:t}=this.state;t&&(t.destroy(),document.body.contains(this.element)&&document.body.removeChild(this.element),e&&this.setState({popper:null}))}show(){this.initPopper(),this.setState({show:!0})}hide(){this.setState({show:!1})}scheduleUpdate(){const{popper:e}=this.state;e&&e.scheduleUpdate()}handleBlur(e){e.relatedTarget instanceof HTMLElement&&(this.element.contains(e.relatedTarget)||this.hide())}handleEnter(){const{onEntered:e}=this.props;e()}handleExit(){const{onExited:e}=this.props,{show:t}=this.state;t||this.destroyPopper(),e()}renderContent(){const{className:e,children:t,timeout:n,interactive:s,closeOnBlur:i}=this.props,{show:o}=this.state;return l.jsx(gt,{in:o,timeout:n,classNames:"popper-transition",onEntered:this.handleEnter,onExited:this.handleExit,children:l.jsx("div",{onClick:a=>{a.stopPropagation()},onKeyDown:a=>{a.key==="Escape"&&this.hide()},className:$("popper",{interactive:s},e),onBlur:i?this.handleBlur:void 0,tabIndex:i?-1:void 0,role:"presentation",children:l.jsxs("div",{className:"popper-content",children:[t,l.jsx("div",{className:"popper-arrow","x-arrow":""})]})})})}render(){const{popper:e}=this.state,{"data-testid":t}=this.props;return l.jsx("div",{className:"popper-parent-container",ref:this.container,style:{display:"none"},"data-testid":t,children:e&&Pi.createPortal(this.renderContent(),this.element)})}}const ri=Pg,_g=Z.module("Tooltip");class Lt extends b.Component{static defaultTimeout=500;static defaultReshowTimeout=100;static triggerReshowThreshold=300;static shownTooltipCount=0;static lastHiddenTime=Date.now();static defaultProps={interactive:!1,options:{},popperClassName:"",reshowTimeout:Lt.defaultReshowTimeout,timeout:Lt.defaultTimeout,onEntered:()=>{},onExited:()=>{},"data-testid":void 0};static handleHidden(){Lt.shownTooltipCount-=1,Lt.shownTooltipCount===0&&(Lt.lastHiddenTime=Date.now())}static handleShown(){Lt.shownTooltipCount+=1}constructor(e){super(e),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleWindowMouseMove=this.handleWindowMouseMove.bind(this),this.handleWheel=this.handleWheel.bind(this),this.handleTimeout=this.handleTimeout.bind(this),this.handleExited=this.handleExited.bind(this),this.stopShowingTooltip=this.stopShowingTooltip.bind(this),this.container=X.createRef(),this.popper=X.createRef(),this.parent=null,this.timer=null,this.state={isShown:!1}}componentDidMount(){this.startListening();const{timeout:e}=this.props;e===0&&this.show()}componentDidUpdate(e,t){const{isShown:n}=t,{isShown:s}=this.state;s!==n&&(s?Lt.handleShown():Lt.handleHidden())}componentWillUnmount(){this.stopListening(),this.stopListeningWindow(),this.stopTimer();const{isShown:e}=this.state;e&&Lt.handleHidden()}container;popper;parent;timer;startListening(){if(!this.container.current||!this.container.current.parentElement){_g.error("Tooltip doesn't have a container or a parent set!");return}this.parent=this.container.current.parentElement,this.parent.addEventListener("mousemove",this.handleMouseMove),this.parent.addEventListener("mouseleave",this.handleMouseLeave),this.parent.addEventListener("mousedown",this.stopShowingTooltip)}stopListening(){this.parent&&(this.parent.removeEventListener("mousemove",this.handleMouseMove),this.parent.removeEventListener("mouseleave",this.handleMouseLeave),this.parent.removeEventListener("mousedown",this.stopShowingTooltip))}startListeningWindow(){window.addEventListener("mousemove",this.handleWindowMouseMove,!0),window.addEventListener("contextmenu",this.stopShowingTooltip,!0),window.addEventListener("wheel",this.handleWheel)}stopListeningWindow(){window.removeEventListener("mousemove",this.handleWindowMouseMove,!0),window.removeEventListener("contextmenu",this.stopShowingTooltip,!0),window.removeEventListener("wheel",this.handleWheel)}handleMouseMove(){this.startTimer()}handleWheel(){const{isShown:e}=this.state;this.popper.current&&this.parent&&e&&!this.popper.current.element.matches(":hover")&&!this.parent.matches(":hover")&&(this.stopTimer(),this.hide())}handleMouseLeave(){const{isShown:e}=this.state;this.stopTimer();const{interactive:t}=this.props;!t&&e&&this.hide()}handleTimeout(){this.show()}handleWindowMouseMove(e){const t=e.clientX,n=e.clientY,{isShown:s}=this.state;if(!this.popper.current||!this.parent)return;const i=this.popper.current.element.getBoundingClientRect(),o=this.parent.getBoundingClientRect();t>=i.left&&t<=i.left+i.width&&n>=i.top&&n<=i.top+i.height?this.handleMouseMove():t>=o.left&&t<=o.left+o.width&&n>=o.top&&n<=o.top+o.height?this.handleMouseMove():s&&(this.stopTimer(),this.hide())}startTimer(){this.stopTimer();const{timeout:e,reshowTimeout:t}=this.props;let n=e;(Lt.shownTooltipCount>0||Date.now()-Lt.lastHiddenTime<Lt.triggerReshowThreshold)&&(n=t),this.timer=window.setTimeout(this.handleTimeout,n)}stopTimer(){this.timer!=null&&(clearTimeout(this.timer),this.timer=null)}show(){const{isShown:e}=this.state;if(this.stopTimer(),!e){this.popper.current?.show(),this.setState({isShown:!0});const{interactive:t}=this.props;t&&this.startListeningWindow()}}hide(){this.popper.current?.hide(),this.stopListeningWindow()}update(){this.popper.current?.scheduleUpdate()}handleExited(){this.setState({isShown:!1});const{onExited:e}=this.props;e()}stopShowingTooltip(){const{isShown:e}=this.state;this.stopTimer(),e&&this.hide()}render(){const{interactive:e,children:t,referenceObject:n,popperClassName:s,"data-testid":i,onEntered:o}=this.props,{isShown:a}=this.state;let{options:r}=this.props;return r={placement:"bottom",...r},l.jsx("div",{ref:this.container,style:{display:"none"},"data-testid":i,children:l.jsx(ri,{className:$(s),options:r,ref:this.popper,onEntered:o,onExited:this.handleExited,interactive:e,referenceObject:n,children:l.jsxs("div",{className:"tooltip-content",children:[" ",a&&t]})})})}}const tt=Lt;function er(d){const{children:e,className:t,style:n,"data-testid":s}=d;return l.jsx("div",{className:$("btn-group",t),style:n,role:"group","data-testid":s,children:e})}er.displayName="ButtonGroup";er.propTypes={children:D.node.isRequired,className:D.string,style:D.object,"data-testid":D.string};er.defaultProps={className:null,style:{},"data-testid":void 0};const jg=["primary","secondary","tertiary","success","danger","inline","ghost"],Hg=["group-end"];function Bg(d,e){switch(d){case"primary":return"btn-primary";case"secondary":return"btn-outline-primary";case"tertiary":return"btn-secondary";case"success":return"btn-success";case"danger":return"btn-danger";case"inline":return"btn-inline";case"ghost":return $("btn-link",{"btn-link-icon":e,"btn-link-icon-only":e})}}function Vg(d){switch(d){case"group-end":return $("pl-2","pr-3")}}const tr=X.forwardRef((d,e)=>{const{kind:t,variant:n,type:s,tooltip:i,icon:o,disabled:a=!1,active:r,onClick:c,onContextMenu:h,onMouseDown:u,onMouseUp:m,onMouseEnter:p,onMouseLeave:g,onKeyDown:C,className:f,style:S,children:v,tabIndex:w,"data-testid":T,"aria-label":y}=d,E=Boolean(o&&v==null),I=Bg(t,E);let F;n&&(F=Vg(n));let N;o&&(N=X.isValidElement(o)?o:l.jsx(J,{icon:o}));let H;i!==void 0&&(H=typeof i=="string"?l.jsx(tt,{children:i}):i);let P=y;y===void 0&&E&&i!=null&&typeof i=="string"&&(P=i);const O=l.jsxs("button",{"data-testid":T,ref:e,type:s,className:$("btn",I,F,{active:r},f),onClick:c,onContextMenu:h,onMouseUp:m,onMouseDown:u,onMouseEnter:p,onMouseLeave:g,onKeyDown:C,style:S,disabled:a,tabIndex:w,"aria-label":P,children:[o&&N,v,i!=null&&!a&&H]});return a?l.jsxs("span",{className:"btn-disabled-wrapper",children:[O,i!==void 0&&H]}):O});tr.displayName="Button";tr.propTypes={kind:D.oneOf(jg).isRequired,variant:D.oneOf(Hg),type:D.oneOf(["submit","reset","button"]),tooltip(d){const{tooltip:e,icon:t,children:n}=d;return e===void 0&&t!=null&&n==null?new Error("Tooltip is required for icon only buttons"):null},icon(d){const{children:e,icon:t}=d;return t==null&&e==null?new Error("Icon is required if no children are provided"):e==null&&!X.isValidElement(t)&&(t==null||t.iconName===""||t.iconName==null)?new Error("Icon must be react element or fontawesome IconDefinition"):null},disabled:D.bool,active:D.bool,onClick(d){const{onClick:e,type:t}=d;return t==="button"&&typeof e!="function"?new Error("type button requires an onClick function"):e!==void 0&&typeof e!="function"?new Error("onClick must be a function"):null},onContextMenu:D.func,onMouseUp:D.func,onMouseDown:D.func,onMouseEnter:D.func,onMouseLeave:D.func,onKeyDown:D.func,tabIndex:D.number,children:D.node,className:D.string,style:D.object,"data-testid":D.string};tr.defaultProps={type:"button",onClick:void 0,onContextMenu:void 0,onMouseUp:void 0,onMouseDown:void 0,onMouseEnter:void 0,onMouseLeave:void 0,onKeyDown:void 0,variant:void 0,tooltip:void 0,icon:void 0,disabled:!1,active:void 0,tabIndex:void 0,children:void 0,className:void 0,style:{},"data-testid":void 0};const V=tr;function kl({className:d="modal-footer",children:e,"data-testid":t}){return l.jsx("div",{className:d,"data-testid":t,children:e})}function ji(d){const{isOpen:e,headerText:t,bodyText:n,onCancel:s,onConfirm:i,onDiscard:o,onModalDisable:a,cancelButtonText:r="Cancel",confirmButtonText:c="Okay",discardButtonText:h="Discard",isConfirmDanger:u=!1,children:m,"data-testid":p}=d,g=b.useRef(null),C=b.useRef(null),f=b.useCallback(()=>{C.current!==null&&C.current.checked&&a&&a(),i()},[i,a]),S=b.useCallback(()=>{g.current?.focus()},[]);let v="";return e&&(v=typeof n=="function"?n():n),l.jsxs(Do,{isOpen:e,className:"theme-bg-light",onOpened:S,children:[l.jsx(Fo,{closeButton:!1,children:t}),l.jsx(No,{children:v}),l.jsxs(kl,{children:[a&&l.jsxs("div",{className:"custom-control custom-checkbox form-group mr-auto",children:[l.jsx("input",{type:"checkbox",className:"custom-control-input",id:"move-confirmation-checkbox",defaultChecked:!1,ref:C,"data-testid":p!==void 0?`${p}-checkbox-confirm`:void 0}),l.jsx("label",{className:"custom-control-label",htmlFor:"move-confirmation-checkbox",children:"Don't ask me again"})]}),o&&l.jsx(V,{kind:"secondary",className:"mr-auto","data-dismiss":"modal",onClick:o,"data-testid":p!==void 0?`${p}-btn-discard`:void 0,children:h}),s&&l.jsx(V,{kind:"secondary","data-dismiss":"modal",onClick:s,"data-testid":p!==void 0?`${p}-btn-cancel`:void 0,children:r}),l.jsxs(er,{children:[l.jsx(V,{kind:u?"danger":"primary",onClick:f,ref:g,"data-testid":p!==void 0?`${p}-btn-confirm`:void 0,children:c}),m]})]})]})}ji.propTypes={isOpen:D.bool.isRequired,headerText:D.string.isRequired,bodyText:D.oneOfType([D.string,D.func]).isRequired,onCancel:D.func,onConfirm:D.func.isRequired,onDiscard:D.func,onModalDisable:D.func,cancelButtonText:D.string,confirmButtonText:D.string,discardButtonText:D.string,children:D.node,"data-testid":D.string};ji.defaultProps={children:void 0,cancelButtonText:"Cancel",confirmButtonText:"Okay",discardButtonText:"Discard",onCancel:void 0,onDiscard:void 0,onModalDisable:void 0,"data-testid":void 0};const nr=X.forwardRef((d,e)=>{const{children:t,className:n,disabled:s,onClick:i,style:o,id:a}=d;return l.jsx("button",{ref:e,type:"button",className:$("btn",n),onClick:i,style:o,disabled:s,id:a,children:t})});nr.displayName="Button";nr.propTypes={children:D.node,className:D.string,disabled:D.bool,onClick:D.func,style:D.shape({}),id:D.string};nr.defaultProps={children:null,className:"",disabled:!1,onClick:()=>null,style:{},id:""};const Ud=nr;function Ol({className:d,isFlipped:e,children:t,"data-testid":n}){const s=r=>{if(t.length!==2)throw new Error("CardFlip requires 2 children to function");return t[r]},i=b.useRef(null),o=b.useCallback(r=>{r.target===r.currentTarget&&document.body.classList.add("card-flip--is-flipping")},[]),a=b.useCallback(r=>{r.target===r.currentTarget&&document.body.classList.remove("card-flip--is-flipping")},[]);return b.useEffect(function(){if(!i.current)throw Error("ref undefined");i.current.addEventListener("transitionstart",o);const c=i.current;return function(){if(c!=null)return c.removeEventListener("transitionstart",o)}},[o]),l.jsxs("div",{className:$(d,{"card-flip--show-front":e,"card-flip--show-back":!e}),"data-testid":n,children:[l.jsx("div",{className:"card-flip--back",children:s(0)}),l.jsx("div",{ref:i,className:"card-flip--front",onTransitionEnd:a,children:s(1)})]})}function Or(d){return d.then!==void 0}class Xs{static actionsDisabled=!1;static disableAllActions(){Xs.actionsDisabled=!0}static enableAllActions(){Xs.actionsDisabled=!1}static isContextActionEvent(e){return Array.isArray(e.contextActions)}static compareActions(e,t){return e.group!==t.group?(e.group??0)>(t.group??0)?1:-1:e.order!==t.order?(e.order??0)>(t.order??0)?1:-1:e.title!==t.title?(e.title??"")>(t.title??"")?1:-1:e!==t?e>t?1:-1:0}static sortActions(e){if(e==null||!Array.isArray(e))return[];const t=e.slice();return t.sort(Xs.compareActions),t}static isMacPlatform(){const{platform:e}=window.navigator;return e.startsWith("Mac")}static getModifierKey(){return Xs.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(e){const t=Xs.getModifierKey();return e[t]}static getMenuItems(e,t=!0){let n=[],s=e;Array.isArray(s)||(s=[s]);for(let i=0;i<s.length;i+=1){const o=s[i];let a;typeof o=="function"?a=o():a=o,a!=null&&(a instanceof Promise?t&&n.push(a):Array.isArray(a)?n=n.concat(a):n.push(a))}return n=n.filter(i=>i.title!==void 0||i.then!=null||i.menuElement),n}static getNextMenuItem(e,t,n){let s=e;s<0&&t<0&&(s=n.length);for(let i=1;i<n.length+1;i+=1){const o=(s+t*i+n.length)%n.length,a=n[o];if(!(a instanceof Promise)&&a.disabled!==!0)return o}return e}}const He=Xs,$d=Z.module("GlobalContextAction");class Ug extends b.Component{constructor(e){super(e),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}componentDidMount(){document.body.addEventListener("contextmenu",this.handleContextMenu),document.body.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.body.removeEventListener("contextmenu",this.handleContextMenu),document.body.removeEventListener("keydown",this.handleKeyDown)}handleContextMenu(e){const t=e;t.contextActions==null&&(t.contextActions=[]);const{action:n}=this.props;n.title==null&&!n.menuElement||(t.contextActions==null&&(t.contextActions=[]),t.contextActions.push(n),$d.debug("Received context menu event at global action! Menu items are now: ",t.contextActions))}handleKeyDown(e){const{action:t}=this.props;!He.actionsDisabled&&t.shortcut!==void 0&&t.shortcut.matchesEvent(e)&&($d.debug("Global hotkey matched!",e),t.action?.(e),e.preventDefault(),e.stopPropagation())}render(){return null}}const $g=Ug;class Wg extends b.Component{render(){const{actions:e,"data-testid":t}=this.props,n=[];for(let s=0;s<e.length;s+=1){const i=e[s],{shortcut:o}=i;if(i.title!=null||i.menuElement||o){const a=l.jsx($g,{action:i,"data-testid":t},`${i.title}.${o?.id}`);n.push(a)}}return n}}const Gg=Wg;const Qo=Z.module("ContextActions");class zg extends b.Component{static groups={default:null,high:100,medium:5e3,low:1e4,global:1e5,edit:100};static triggerMenu(e,t,n,s){if(s.length===0)return;const i=new MouseEvent("contextmenu",{clientX:t,clientY:n,bubbles:!0,cancelable:!0});i.contextActions=s,e.dispatchEvent(i)}constructor(e){super(e),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.container=X.createRef(),this.state={globalActions:[],keyboardActions:[]}}static getDerivedStateFromProps(e){if(e.actions==null||!Array.isArray(e.actions))return{globalActions:[],keyboardActions:[]};const t=e.actions.filter(s=>!Or(s)&&typeof s!="function"&&s.isGlobal),n=e.actions.filter(s=>!Or(s)&&typeof s!="function"&&(s.isGlobal===void 0||!s.isGlobal)&&s.shortcut!=null);return{globalActions:t,keyboardActions:n}}componentDidMount(){this.container.current?.parentElement&&(this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.addEventListener("keydown",this.handleKeyDown))}componentWillUnmount(){this.container.current?.parentElement&&(this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.removeEventListener("keydown",this.handleKeyDown))}container;handleContextMenu(e){const{ignoreClassNames:t=[]}=this.props;if(t.length>0){let s=e.target;for(;s!=null;){const{classList:i}=s,o=t.find(a=>i.contains(a));if(o!==void 0){Qo.debug2(`Contextmenu event ignored based on the target className "${o}"`);return}s=s.parentElement}}if(He.isContextActionEvent(e)||(e.contextActions=[]),!He.isContextActionEvent(e))return;const{actions:n}=this.props;if(n!=null){let s=n;Array.isArray(s)&&(s=s.filter(i=>Or(i)||typeof i=="function"||i.isGlobal===void 0||!i.isGlobal)),e.contextActions=e.contextActions.concat(s)}Qo.debug("Received context menu event! Menu items are now: ",e.contextActions)}handleKeyDown(e){const{keyboardActions:t}=this.state;for(let n=0;n<t.length;n+=1){const s=t[n];!He.actionsDisabled&&s.shortcut!=null&&s.shortcut.matchesEvent(e)&&(Qo.debug("Context hotkey matched!",e),s.action?.(e),e.stopPropagation(),e.preventDefault(),Qo.debug2("Matched hotkey returned false, key event not consumed"))}}render(){const{"data-testid":e}=this.props,{globalActions:t}=this.state;return l.jsx("div",{className:"context-actions-listener",ref:this.container,"data-testid":e,children:l.jsx(Gg,{actions:t})})}}const ae=zg,Al=X.forwardRef((d,e)=>{function t(f){const{menuItem:S,onMenuItemClick:v}=d;v(S,f)}function n(f){const{menuItem:S,onMenuItemMouseMove:v}=d;v(S,f)}function s(f){const{menuItem:S,onMenuItemContextMenu:v}=d;v(S,f)}function i(f,S,v){if(typeof f.type=="string")return f;const{closeMenu:w,menuItem:T,isKeyboardSelected:y,isMouseSelected:E,"data-testid":I}=d,F={menuItem:T,closeMenu:w,isKeyboardSelected:y,isMouseSelected:E,iconElement:S,displayShortcut:v,"data-testid":I};return X.cloneElement(f,{forwardedProps:F})}const{children:o,menuItem:a,isKeyboardSelected:r=!1,isMouseSelected:c=!1,"data-testid":h}=d,u=a.shortcut?.getDisplayText();let m=null;if(a.icon){const f=a.icon;if(X.isValidElement(f))m=f;else{let S;a.iconColor!=null&&(a.disabled===void 0||!a.disabled)&&(S={color:a.iconColor}),m=l.jsx(J,{icon:f,style:S})}}let p=null;const g=Boolean(o);a.actions&&(p=l.jsx(J,{icon:yh}));let C=null;if(a.menuElement)C=l.jsx("div",{className:"custom-menu-item",onMouseMove:n,children:i(a.menuElement,m,u)});else{const f=a.disabled,S=a.iconOutline;C=l.jsx("button",{type:"button",className:$("btn-context-menu",{disabled:f},{active:(g||c)&&(f===void 0||!f)},{"keyboard-active":r&&(f===void 0||!f)}),onClick:t,onMouseMove:n,onContextMenu:s,title:a.description??"",children:l.jsxs("div",{className:"btn-context-menu-wrapper",children:[l.jsx("span",{className:$("icon",{outline:S}),children:m}),l.jsx("span",{className:"title",children:a.title}),u!==void 0&&l.jsx("span",{className:"shortcut",children:u}),p&&l.jsx("span",{className:$("submenu-indicator",{disabled:f}),children:p})]})})}return l.jsxs("div",{className:"context-menu-item",ref:e,"data-testid":h,children:[o,C]})});Al.displayName="ContextMenuItem";Al.defaultProps={children:null,isKeyboardSelected:!1,isMouseSelected:!1,"data-testid":void 0};const Lh=Al,De=Object.freeze([]),Gn=new Map;class Kg extends Error{isCanceled=!0}const Hi=Kg;class sr{static isDark(e){const t=document.createElement("div");t.style.display="none",t.style.color=e;const n=getComputedStyle(document.body.appendChild(t)).color,s=n.match(/\d+/g);let i=[];if(s)i=s.map(a=>parseInt(a,10));else throw new Error(`Invalid color received. Got ${n}`);return document.body.removeChild(t),sr.getBrightness(i)<125}static getBrightness(e){return Math.round((e[0]*299+e[1]*587+e[2]*114)/1e3)}}async function $i(d){const{clipboard:e}=navigator;if(e!==void 0)try{return navigator.clipboard.writeText(d)}catch{return Wd(d)}Wd(d)}function Wd(d){const e=document.activeElement,t=document.createElement("textarea");t.value=d,document.body.appendChild(t),t.focus(),t.select();const n=document.execCommand("copy");if(document.body.removeChild(t),e instanceof HTMLElement&&e.focus(),!n)throw new Error("Unable to execute copy command")}const qg="table_",Gd="column_",Yg=new Set(["in","not","i","ii","k"]),Xg=new Set(["abstract","continue","for","new","switch","assert","default","if","package","synchronized","boolean","do","goto","private","this","break","double","implements","protected","throw","byte","else","import","public","throws","case","enum","instanceof","return","transient","catch","extends","int","short","try","char","final","interface","static","void","class","finally","long","strictfp","volatile","const","float","native","super","while","null","true","false"]),Zg=/[^a-zA-Z0-9_$+@-]/g,Qg=/[^A-Za-z0-9_$]/g;class cn{static legalize=(e,t,n,s,i)=>{let o=e.trim().replace(/[- ]/g,"_");return s&&(Yg.has(o)||Xg.has(o))&&(o=t+o),o=o.replace(n,""),o||(o=t+i),Number.isNaN(Number(o.charAt(0)))||(o=t+o),o};static legalizeTableName=e=>cn.legalize(e,qg,Zg,!1,0);static legalizeColumnNames=e=>{const t=[];return e.forEach((n,s)=>{let i=cn.legalizeColumnName(n,s);t.includes(i)&&(i=Gd+s),t.push(i)}),t};static legalizeColumnName=(e,t=0)=>cn.legalize(e,Gd,Qg,!0,t);static isValidTableName=e=>cn.legalizeTableName(e)===e;static isValidColumnName=e=>cn.legalizeColumnName(e)===e}function Jg(d,e){return d?d.closest(`.${e}`):null}const ef={getClosestByClassName:Jg};class Ve extends CustomEvent{constructor(e,t){super(e,t)}}class tf extends Error{isTimeout=!0}const Ph=tf;class ve{static makeCancelable(e,t){let n=!1,s,i;const o=new Promise((a,r)=>{i=r,Promise.resolve(e).then(c=>{n?t&&t(c):(s=c,a(c))}).catch(c=>r(c))});return o.cancel=()=>{n=!0,i(new Hi),s!=null&&t&&t(s)},o}static isCanceled(e){return e instanceof Hi}static isTimedOut(e){return e instanceof Ph}}class nf{pending=[];resolved=[];add(e,t){const n=ve.makeCancelable(e,t);return this.pending.push(n),n.then(()=>{this.resolve(n)},()=>{this.resolve(n)}),n}remove(e){for(let t=0;t<this.pending.length;t+=1)if(this.pending[t]===e){this.pending.splice(t,1);return}}resolve(e){this.remove(e),this.resolved.push(e)}cancel(){const e=[...this.pending,...this.resolved];for(let t=0;t<e.length;t+=1)e[t].cancel();this.pending=[],this.resolved=[]}}const ts=nf;function M(d){if(d==null)throw new Error("Value is null or undefined")}function _(d,e,t=void 0){const n=d.get(e)??t;if(n!==void 0)return n;throw new Error(`Missing value for key ${e}`)}class ln{static isValidRange(e){return e!=null&&e.length===2&&Number.isInteger(e[0])&&Number.isInteger(e[1])&&e[0]<=e[1]}static validateRange(e){if(!ln.isValidRange(e))throw new Error(`Invalid range! ${e}`)}static isSelected(e,t){for(let n=0;n<e.length;n+=1){const s=e[n],i=s[0],o=s[1];if(i<=t&&t<=o)return!0}return!1}static selectRange(e,t){let[n,s]=t;const i=[...e];for(let o=i.length-1;o>=0;o-=1){const a=i[o],r=a[0],c=a[1];if(r<=n&&s<=c)return i;n<=c&&r<=s&&(n=Math.min(n,r),s=Math.max(s,c),i.splice(o,1))}return i.push([n,s]),i}static deselectRange(e,t){const[n,s]=t,i=[...e];for(let o=i.length-1;o>=0;o-=1){const a=i[o],r=a[0],c=a[1];if(!(s<r||c<n))if(r<n&&s<c){i[o]=[r,n-1],i.splice(o+1,0,[s+1,c]);break}else n<=r&&c<=s?i.splice(o,1):r<n?i[o]=[r,n-1]:i[o]=[s+1,c]}return i}static count(e){return e.reduce((t,n)=>t+(n[1]-n[0]+1),0)}static getItemsInRanges(e,t){return t.reduce((n,s)=>{const i=[...n];for(let o=s[0];o<=s[1];o+=1)i.push(e[o]);return i},[])}}class sf{static join(e,t="and"){if(e==null||e.length===0)return"";if(e.length===1)return e[0];if(e.length===2)return`${e[0]} ${t} ${e[1]}`;const n=e.slice(0,e.length-1).join(", "),s=e[e.length-1];return`${n}, ${t} ${s}`}static toLower(e,t=!0){if(e==null){if(t)return"";throw new Error("Null string passed in to TextUtils.toLower")}return e.toLowerCase()}static sort(e,t,n=!0){return e<t?n?-1:1:e>t?n?1:-1:0}}const Wt=sf;class Wi{static TIME_PATTERN="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]";static TIME_ZONES=Object.freeze([{label:"Tokyo UTC+9 No DST",value:"Asia/Tokyo"},{label:"Seoul UTC+9 No DST",value:"Asia/Seoul"},{label:"Hong Kong UTC+8 No DST",value:"Asia/Hong_Kong"},{label:"Singapore UTC+8 No DST",value:"Asia/Singapore"},{label:"Kolkata UTC+5:30 No DST",value:"Asia/Kolkata"},{label:"Berlin UTC+1",value:"Europe/Berlin"},{label:"UTC UTC±0 No DST",value:"UTC"},{label:"London UTC±0",value:"Europe/London"},{label:"Sao Paulo UTC-2",value:"America/Sao_Paulo"},{label:"Newfoundland UTC-3:30",value:"America/St_Johns"},{label:"Halifax UTC-4",value:"America/Halifax"},{label:"New York UTC−5",value:"America/New_York"},{label:"Chicago UTC-6",value:"America/Chicago"},{label:"Denver UTC-7",value:"America/Denver"},{label:"Los Angeles UTC-8",value:"America/Los_Angeles"},{label:"Anchorage UTC-9",value:"America/Anchorage"},{label:"Honolulu UTC-10 No DST",value:"Pacific/Honolulu"},{label:"Zurich UTC+1",value:"Europe/Zurich"},{label:"Amsterdam UTC+1",value:"Europe/Amsterdam"},{label:"Taipei UTC+8 No DST",value:"Asia/Taipei"},{label:"Sydney UTC+10",value:"Australia/Sydney"}]);static formatElapsedTime(e){if(typeof e!="number"||!Number.isInteger(e))throw new Error(`${e} is not a number that can be expressed as a formatted time`);const t=Math.floor(e/3600),n=Math.floor(e%3600/60),s=e%60;return`${t>0?`${t}h `:""}${n>0||t>0?`${n}m `:""}${e>=60?`${s}s`.padStart(3,"0"):`${s}s`}`}static formatTime(e){if(typeof e!="number"||!Number.isInteger(e)||e<0)throw new Error(`${e} is not a number that can be expressed as a formatted time`);const t=String(Math.floor(e/(60*60))).padStart(2,"0"),n=e%(60*60),s=String(Math.floor(n/60)).padStart(2,"0"),i=n%60,o=String(Math.ceil(i)).padStart(2,"0");return`${t}:${s}:${o}`}static isTimeString(e){return new RegExp(Wi.TIME_PATTERN).test(e)}static parseTime(e){if(e==null||typeof e!="string")throw new Error(`${e} is not a valid string`);const t=e.split(":");if(t.length!==3)throw new Error(`${e} is not a time string that can be parsed`);return Number(t[0])*60*60+Number(t[1])*60+Number(t[2])}}class of extends Error{isInvalid=!0}const Ni=of,zd=Z.module("ContextMenu");class Da extends b.PureComponent{static defaultProps={subMenuParentWidth:0,subMenuParentHeight:0,closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0};static handleContextMenu(e){e.metaKey||(e.stopPropagation(),e.preventDefault())}constructor(e){super(e),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=X.createRef(),this.oldFocus=document.activeElement,this.activeSubMenuRef=X.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(()=>{this.container.current?.focus();const{onMenuOpened:e}=this.props;e(this)})}componentDidUpdate(e,t){const{actions:n}=this.props,{activeSubMenu:s}=this.state;s!==t.activeSubMenu&&(s==null?this.container.current?.focus():this.setActiveSubMenuPosition()),e.actions!==n&&(this.initMenu(),(this.container.current==null||!this.container.current.contains(document.activeElement))&&this.container.current?.focus()),this.verifyPosition()}componentWillUnmount(){this.cancelPromises(),window.removeEventListener("resize",this.handleWindowResize),cancelAnimationFrame(this.rAF)}container;oldFocus;activeSubMenuRef;subMenuTimer;rAF;initialPosition;getKeyboardIndex(){const{options:e}=this.props;if(e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse){const{keyboardIndex:t}=this.state;return t}return this.getMouseIndex()}setKeyboardIndex(e){const{options:t}=this.props;t.separateKeyboardMouse!==void 0&&t.separateKeyboardMouse?this.setState({keyboardIndex:e}):this.setMouseIndex(e)}getMouseIndex(){const{mouseIndex:e}=this.state;return e}setMouseIndex(e){this.setState({mouseIndex:e})}initMenu(){this.cancelPromises(),cancelAnimationFrame(this.rAF);const{options:e}=this.props;let t=e.initialKeyboardIndex;t===void 0&&(t=-1);const{actions:n}=this.props,s=He.getMenuItems(n),i=[];for(let o=s.length-1;o>=0;o-=1){const a=s[o];a instanceof Promise?this.initMenuPromise(a):i.push(a)}this.setState({mouseIndex:-1,keyboardIndex:t,activeSubMenu:null,menuItems:He.sortActions(i)})}initMenuPromise(e){const t=ve.makeCancelable(e);this.setState(n=>({pendingItems:n.pendingItems.concat(t)})),t.then(n=>{this.setState(s=>{const i=s.pendingItems.indexOf(t);if(i>=0){const o=s.pendingItems.slice();return o.splice(i,1),{menuItems:He.sortActions(s.menuItems.concat(n)),pendingItems:o}}return null})},n=>{ve.isCanceled(n)||(this.setState(s=>{const i=s.pendingItems.indexOf(t);if(i>=0){const o=s.pendingItems.slice();return o.splice(i,1),{pendingItems:o}}return null}),zd.error(n))})}cancelPromises(){const{pendingItems:e}=this.state;e.map(t=>t.cancel())}setActiveSubMenuPosition(){if(this.activeSubMenuRef.current===null)return;const e=this.activeSubMenuRef.current.getBoundingClientRect();this.setState({subMenuTop:e.top,subMenuLeft:e.right,subMenuParentHeight:e.height,subMenuParentWidth:e.width})}verifyPosition(){const{options:e,updatePosition:t,subMenuParentWidth:n,subMenuParentHeight:s,top:i,left:o}=this.props;if(!this.container.current||e.doNotVerifyPosition!=null&&e.doNotVerifyPosition)return;let{top:a,left:r}=this.initialPosition;const{width:c,height:h}=this.container.current?.getBoundingClientRect()??{width:0,height:0},u=(this.container.current?.scrollHeight??0)>window.innerHeight;h===0||c===0||(a+h>window.innerHeight&&(a-h-s>0?a-=h-s:a=window.innerHeight-h),r+c>window.innerWidth&&(r=r-c-n),(o!==r||i!==a)&&(this.setState({hasOverflow:u}),t(a,r)))}handleWindowResize(){this.container.current&&this.closeMenu(!0)}handleBlur(e){if(!this.container.current){zd.warn("Container is null!");return}if(!this.container.current.contains(e.relatedTarget)){let t=e.relatedTarget,n=!1;for(;t&&!n;)n=t.hasAttribute("data-dh-context-menu"),t=t.parentElement;n||this.closeMenu(!0)}}isEscapeKey(e){const{left:t}=this.props;return e==="Escape"||t<0&&e==="ArrowRight"||e==="ArrowLeft"}handleKeyDown(e){const{menuItems:t}=this.state,n=this.getKeyboardIndex();let s=n,i=!1;if(e.key==="Enter"||e.key===" "){n>=0&&n<t.length&&this.handleMenuItemClick(t[n],e);return}if(e.key==="ArrowRight"?n>=0&&n<=t.length?i=!0:s=0:this.isEscapeKey(e.key)?s=null:e.key==="ArrowUp"||e.shiftKey&&e.key==="Tab"?s=He.getNextMenuItem(s,-1,t):(e.key==="ArrowDown"||e.key==="Tab")&&(s=He.getNextMenuItem(s,1,t)),i){this.openSubMenu(n),e.preventDefault(),e.stopPropagation();return}n!==s&&(s!==null?this.setKeyboardIndex(s):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}openSubMenu(e){const{menuItems:t,activeSubMenu:n}=this.state,s=t[e].actions?e:null;n!==s&&this.setState({activeSubMenu:s,subMenuTop:null,subMenuLeft:null})}closeMenu(e=!1){const{closeMenu:t,onMenuClosed:n}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t(e),n(this)})}closeSubMenu(){this.setState({activeSubMenu:null})}handleCloseSubMenu(e){e?this.closeMenu(!0):this.closeSubMenu()}handleMenuItemClick(e,t){t.preventDefault(),t.stopPropagation();const{menuItems:n}=this.state;e!=null&&(e.disabled===void 0||!e.disabled)&&(e.actions!=null?this.openSubMenu(n.indexOf(e)):e.action!=null&&(e.action(),this.closeMenu(!0)))}handleMenuItemContextMenu(e,t){t.metaKey||this.handleMenuItemClick(e,t)}handleMenuItemMouseMove(e){const{menuItems:t}=this.state,n=t.indexOf(e);this.setMouseIndex(n),n>=0&&n<t.length&&(e.disabled===void 0||!e.disabled)&&this.openSubMenu(n)}handleMouseLeave(){this.setMouseIndex(-1)}render(){const e=[],{top:t,left:n}=this.props,{activeSubMenu:s,hasOverflow:i,keyboardIndex:o,menuItems:a,mouseIndex:r,pendingItems:c,subMenuTop:h,subMenuLeft:u,subMenuParentWidth:m,subMenuParentHeight:p}=this.state;for(let v=0;v<a.length;v+=1){const w=a[v];v>0&&w.group!==a[v-1].group&&e.push(l.jsx("hr",{},`${v}.separator`));const T=l.jsx(Lh,{ref:s===v?this.activeSubMenuRef:null,isKeyboardSelected:o===v,isMouseSelected:r===v,menuItem:w,closeMenu:this.handleCloseSubMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:this.handleMenuItemContextMenu},v);e.push(T)}let g=null;c.length>0&&(g=l.jsx("div",{className:"loading",children:l.jsx(Ln,{})}));const{menuStyle:C,"data-testid":f}=this.props,S=s!==null&&h!==null&&u!==null;return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:$({"has-overflow":i},"context-menu-container"),style:{top:t,left:n,...C},ref:this.container,"data-dh-context-menu":!0,onBlur:this.handleBlur,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,onContextMenu:Da.handleContextMenu,role:"menuitem",tabIndex:0,"data-testid":f,children:[e,g]}),S&&s!==null&&h!==null&&u!==null&&l.jsx(Da,{actions:a[s].actions||[],closeMenu:this.handleCloseSubMenu,top:h,left:u,updatePosition:(v,w)=>{this.setState({subMenuTop:v,subMenuLeft:w})},subMenuParentWidth:m,subMenuParentHeight:p},`sub-${s}`)]})}}const af=Da;class rf extends b.Component{constructor(e){super(e),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.container=X.createRef(),this.openMenu=X.createRef(),this.state={actions:null,left:0,top:0}}componentDidMount(){this.container.current?.parentElement&&this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu)}componentWillUnmount(){this.container.current?.parentElement&&this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu)}container;openMenu;handleContextMenu(e){if(!He.isContextActionEvent(e)||!this.container.current||e.metaKey||e.ctrlKey)return;const t=He.getMenuItems(e.contextActions),n=this.container.current.getBoundingClientRect(),s=e.clientY-n.top,i=e.clientX-n.left;if(t.length===0){if(e.target===this.container.current){e.preventDefault(),this.setState({actions:null},()=>{const o=document.elementFromPoint(i,s),a=new MouseEvent("contextmenu",{clientX:e.clientX,clientY:e.clientY,bubbles:!0,cancelable:!0});o?.dispatchEvent(a)});return}return}e.preventDefault(),this.setState({actions:t,top:s,left:i})}handleMenuClose(e){e===this.openMenu.current&&this.setState({actions:null})}render(){let e=null;const{"data-testid":t}=this.props,{actions:n,top:s,left:i}=this.state;return n&&(e=l.jsx(af,{ref:this.openMenu,actions:n,onMenuClosed:this.handleMenuClose,top:s,left:i,updatePosition:(o,a)=>{this.setState({top:o,left:a})},"data-testid":t})),l.jsx("div",{className:$("context-menu-root",{active:n}),ref:this.container,children:e})}}const _h=rf;class Ss extends b.Component{static propTypes={className:D.string,in:D.bool.isRequired,children:D.node.isRequired,autoFocusOnShow:D.bool,"data-testid":D.string};static defaultProps={className:"",autoFocusOnShow:!1,"data-testid":void 0};static handleEnter(e){const t=e;t.style.height="0"}static handleEntering(e){const t=e;t.style.height=`${Ss.getHeight(t)}px`}static handleExiting(e){const t=e;t.style.height="0"}static handleExit(e){const t=e;t.style.height=`${Ss.getHeight(t)}px`}static getHeight(e){const t=e.scrollWidth-e.clientWidth;return e.scrollHeight-t}constructor(e){super(e),this.handleEntered=this.handleEntered.bind(this)}handleEntered(e){const t=e;t.style.height="";const{autoFocusOnShow:n}=this.props;if(n!==void 0&&n){const s=t.querySelector("input, select, textarea");s?.focus()}}render(){const{children:e,className:t,in:n,"data-testid":s}=this.props;return l.jsx(gt,{in:n,classNames:{enterActive:"collapsing",enterDone:"collapse show",exitActive:"collapsing",exitDone:"collapse"},onEnter:Ss.handleEnter,onEntering:Ss.handleEntering,onEntered:this.handleEntered,onExit:Ss.handleExit,onExiting:Ss.handleExiting,timeout:350,children:i=>l.jsx("div",{className:$({collapse:i==="exited"},t),"data-testid":s,children:e})})}}const lf=Ss;function ir(d){const e=b.useRef();return b.useEffect(function(){e.current=d}),e.current}function jh(d){const e=b.useRef(null);return b.useEffect(function(){d&&(typeof d=="function"?d(e.current):d.current=e.current)}),e}const df=3500,cf=Z.module("useCopyToClipboard");function hf(){const[d,e]=b.useState(!1),t=b.useRef(null),n=b.useCallback(s=>{$i(s).then(()=>{e(!0)}).catch(i=>cf.error(`Unable to copy ${s}`,`
|
|
1
|
+
import{A as b,B as D,H as X,P as Pm,C as l,D as gt,F as $,R as Pi,G as J,I as Pe,J as pe,K as Ye,L as _m,M as jm,N as wl,O as Za,Q as Hm,E as vl,S as Bm,T as fe,U as el,V as ks,W as bh,X as it,Y as Tl,Z as Vm,_ as Um,$ as $m,a0 as Wm,a1 as me,a2 as Fd,a3 as El,a4 as Gm,a5 as zm,a6 as wh,a7 as je,a8 as tl,a9 as Nd,aa as Qa,ab as Md,ac as Km,ad as Mn,ae as qm,af as Ym,ag as Xm,ah as Zm,ai as nl,aj as Qm,ak as Jm,al as ep,am as kd,an as tp,ao as Od,ap as np,aq as sp,ar as ip,as as op,at as ap,au as rp,av as ft,aw as vh,ax as lp,ay as Th,az as dp,aA as Eh,aB as cp,aC as hp,aD as up,aE as mp,aF as pp,aG as gp,aH as fp,aI as Cp,aJ as Sp,aK as bp,aL as Ad,aM as wp}from"./vendor-0d2b9258.js";import{e as Yn,l as wi,K as rn,a as Ld,b as xs,W as vp}from"./monaco-1ecfd680.js";import{T as We,L as Z,M as Do,a as Fo,b as No,v as yh,c as Ln,d as xh,e as kn,f as Tp,g as Ep,h as Mo,i as yp,j as Ui,k as yl,l as xp,m as sl,n as Rp,o as Rh,p as xl,q as Ih,r as Pd,s as Ip,t as Dp,u as Fp,w as Np,x as Qt,y as Ms,z as Dh,A as Xn,B as Ja,C as _i,D as Mp,E as kp,F as _d,G as ya,H as jd,I as Fh,J as Op,K as ko,N as Nh,O as Ap,P as Lp,Q as Rl,R as Il,S as xa,U as Bn,V as Pp,W as _p,X as jp,Y as Hp,Z as Bp,_ as Dl,$ as Os,a0 as Hd,a1 as Oo,a2 as Fl,a3 as Nl,a4 as Vp,a5 as Up,a6 as Ra,a7 as $p,a8 as Ml,a9 as Mh,aa as ei,ab as Wp,ac as Gp,ad as zp,ae as Kp,af as qp,ag as Yp,ah as Bd,ai as Mr,aj as Xp,ak as Zp,al as Qp,am as Jp,an as eg,ao as kh,ap as tg,aq as ng,ar as sg,as as Oh,at as ig,au as og,av as ag,aw as rg,ax as lg,ay as dg,az as cg,aA as hg,aB as ug,aC as mg,aD as pg,aE as gg,aF as Ah,aG as fg,aH as il,aI as ol,aJ as Cg,aK as Sg,aL as bg,aM as wg,aN as vg,aO as Tg,aP as Eg,aQ as yg,aR as xg,aS as Rg,aT as Ig,aU as Vd,aV as Dg,aW as Fg}from"./index-3517d713.js";import{P as Ia,b as Ng,h as Mg,p as kg,o as Og,s as Ag,t as Lg,c as kr}from"./plotly-08ea603d.js";import"./helpers-042e6b4d.js";class Pg extends b.Component{static propTypes={children:D.node.isRequired,options:D.shape({}),className:D.string,timeout:D.number,onEntered:D.func,onExited:D.func,isShown:D.bool,closeOnBlur:D.bool,interactive:D.bool,referenceObject:D.shape({}),"data-testid":D.string};static defaultProps={options:{},className:"",timeout:We.transitionMs,onEntered(){},onExited(){},isShown:!1,interactive:!1,closeOnBlur:!1,referenceObject:null,"data-testid":void 0};constructor(e){super(e),this.handleEnter=this.handleEnter.bind(this),this.handleExit=this.handleExit.bind(this),this.handleBlur=this.handleBlur.bind(this),this.element=document.createElement("div"),this.element.className="popper-container",this.container=X.createRef(),this.rAF=0;const{isShown:t}=this.props;this.state={show:t,popper:null}}componentDidUpdate(e){const{isShown:t}=this.props;e.isShown!==t&&(t?(cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{this.show()})):this.hide())}componentWillUnmount(){this.destroyPopper(!1)}element;container;rAF;getVisibleElement(e){return e==null||e.clientHeight>0||e.clientWidth>0?e:this.getVisibleElement(e.parentElement)}initPopper(){let{popper:e}=this.state;const{closeOnBlur:t,referenceObject:n}=this.props;if(e||this.container.current===null)return;let{options:s}=this.props;s={placement:"auto",modifiers:{preventOverflow:{boundariesElement:"viewport"}},...s},document.body.appendChild(this.element);let i=this.getVisibleElement(this.container.current);i==null&&(i=this.container.current),e=new Pm(n||i,this.element,s),e.scheduleUpdate(),cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{if(t&&!this.element.contains(document.activeElement)){const o=this.element.firstElementChild;o instanceof HTMLElement&&o.focus()}}),this.setState({popper:e})}destroyPopper(e=!0){cancelAnimationFrame(this.rAF);const{popper:t}=this.state;t&&(t.destroy(),document.body.contains(this.element)&&document.body.removeChild(this.element),e&&this.setState({popper:null}))}show(){this.initPopper(),this.setState({show:!0})}hide(){this.setState({show:!1})}scheduleUpdate(){const{popper:e}=this.state;e&&e.scheduleUpdate()}handleBlur(e){e.relatedTarget instanceof HTMLElement&&(this.element.contains(e.relatedTarget)||this.hide())}handleEnter(){const{onEntered:e}=this.props;e()}handleExit(){const{onExited:e}=this.props,{show:t}=this.state;t||this.destroyPopper(),e()}renderContent(){const{className:e,children:t,timeout:n,interactive:s,closeOnBlur:i}=this.props,{show:o}=this.state;return l.jsx(gt,{in:o,timeout:n,classNames:"popper-transition",onEntered:this.handleEnter,onExited:this.handleExit,children:l.jsx("div",{onClick:a=>{a.stopPropagation()},onKeyDown:a=>{a.key==="Escape"&&this.hide()},className:$("popper",{interactive:s},e),onBlur:i?this.handleBlur:void 0,tabIndex:i?-1:void 0,role:"presentation",children:l.jsxs("div",{className:"popper-content",children:[t,l.jsx("div",{className:"popper-arrow","x-arrow":""})]})})})}render(){const{popper:e}=this.state,{"data-testid":t}=this.props;return l.jsx("div",{className:"popper-parent-container",ref:this.container,style:{display:"none"},"data-testid":t,children:e&&Pi.createPortal(this.renderContent(),this.element)})}}const ri=Pg,_g=Z.module("Tooltip");class Lt extends b.Component{static defaultTimeout=500;static defaultReshowTimeout=100;static triggerReshowThreshold=300;static shownTooltipCount=0;static lastHiddenTime=Date.now();static defaultProps={interactive:!1,options:{},popperClassName:"",reshowTimeout:Lt.defaultReshowTimeout,timeout:Lt.defaultTimeout,onEntered:()=>{},onExited:()=>{},"data-testid":void 0};static handleHidden(){Lt.shownTooltipCount-=1,Lt.shownTooltipCount===0&&(Lt.lastHiddenTime=Date.now())}static handleShown(){Lt.shownTooltipCount+=1}constructor(e){super(e),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleWindowMouseMove=this.handleWindowMouseMove.bind(this),this.handleWheel=this.handleWheel.bind(this),this.handleTimeout=this.handleTimeout.bind(this),this.handleExited=this.handleExited.bind(this),this.stopShowingTooltip=this.stopShowingTooltip.bind(this),this.container=X.createRef(),this.popper=X.createRef(),this.parent=null,this.timer=null,this.state={isShown:!1}}componentDidMount(){this.startListening();const{timeout:e}=this.props;e===0&&this.show()}componentDidUpdate(e,t){const{isShown:n}=t,{isShown:s}=this.state;s!==n&&(s?Lt.handleShown():Lt.handleHidden())}componentWillUnmount(){this.stopListening(),this.stopListeningWindow(),this.stopTimer();const{isShown:e}=this.state;e&&Lt.handleHidden()}container;popper;parent;timer;startListening(){if(!this.container.current||!this.container.current.parentElement){_g.error("Tooltip doesn't have a container or a parent set!");return}this.parent=this.container.current.parentElement,this.parent.addEventListener("mousemove",this.handleMouseMove),this.parent.addEventListener("mouseleave",this.handleMouseLeave),this.parent.addEventListener("mousedown",this.stopShowingTooltip)}stopListening(){this.parent&&(this.parent.removeEventListener("mousemove",this.handleMouseMove),this.parent.removeEventListener("mouseleave",this.handleMouseLeave),this.parent.removeEventListener("mousedown",this.stopShowingTooltip))}startListeningWindow(){window.addEventListener("mousemove",this.handleWindowMouseMove,!0),window.addEventListener("contextmenu",this.stopShowingTooltip,!0),window.addEventListener("wheel",this.handleWheel)}stopListeningWindow(){window.removeEventListener("mousemove",this.handleWindowMouseMove,!0),window.removeEventListener("contextmenu",this.stopShowingTooltip,!0),window.removeEventListener("wheel",this.handleWheel)}handleMouseMove(){this.startTimer()}handleWheel(){const{isShown:e}=this.state;this.popper.current&&this.parent&&e&&!this.popper.current.element.matches(":hover")&&!this.parent.matches(":hover")&&(this.stopTimer(),this.hide())}handleMouseLeave(){const{isShown:e}=this.state;this.stopTimer();const{interactive:t}=this.props;!t&&e&&this.hide()}handleTimeout(){this.show()}handleWindowMouseMove(e){const t=e.clientX,n=e.clientY,{isShown:s}=this.state;if(!this.popper.current||!this.parent)return;const i=this.popper.current.element.getBoundingClientRect(),o=this.parent.getBoundingClientRect();t>=i.left&&t<=i.left+i.width&&n>=i.top&&n<=i.top+i.height?this.handleMouseMove():t>=o.left&&t<=o.left+o.width&&n>=o.top&&n<=o.top+o.height?this.handleMouseMove():s&&(this.stopTimer(),this.hide())}startTimer(){this.stopTimer();const{timeout:e,reshowTimeout:t}=this.props;let n=e;(Lt.shownTooltipCount>0||Date.now()-Lt.lastHiddenTime<Lt.triggerReshowThreshold)&&(n=t),this.timer=window.setTimeout(this.handleTimeout,n)}stopTimer(){this.timer!=null&&(clearTimeout(this.timer),this.timer=null)}show(){const{isShown:e}=this.state;if(this.stopTimer(),!e){this.popper.current?.show(),this.setState({isShown:!0});const{interactive:t}=this.props;t&&this.startListeningWindow()}}hide(){this.popper.current?.hide(),this.stopListeningWindow()}update(){this.popper.current?.scheduleUpdate()}handleExited(){this.setState({isShown:!1});const{onExited:e}=this.props;e()}stopShowingTooltip(){const{isShown:e}=this.state;this.stopTimer(),e&&this.hide()}render(){const{interactive:e,children:t,referenceObject:n,popperClassName:s,"data-testid":i,onEntered:o}=this.props,{isShown:a}=this.state;let{options:r}=this.props;return r={placement:"bottom",...r},l.jsx("div",{ref:this.container,style:{display:"none"},"data-testid":i,children:l.jsx(ri,{className:$(s),options:r,ref:this.popper,onEntered:o,onExited:this.handleExited,interactive:e,referenceObject:n,children:l.jsxs("div",{className:"tooltip-content",children:[" ",a&&t]})})})}}const tt=Lt;function er(d){const{children:e,className:t,style:n,"data-testid":s}=d;return l.jsx("div",{className:$("btn-group",t),style:n,role:"group","data-testid":s,children:e})}er.displayName="ButtonGroup";er.propTypes={children:D.node.isRequired,className:D.string,style:D.object,"data-testid":D.string};er.defaultProps={className:null,style:{},"data-testid":void 0};const jg=["primary","secondary","tertiary","success","danger","inline","ghost"],Hg=["group-end"];function Bg(d,e){switch(d){case"primary":return"btn-primary";case"secondary":return"btn-outline-primary";case"tertiary":return"btn-secondary";case"success":return"btn-success";case"danger":return"btn-danger";case"inline":return"btn-inline";case"ghost":return $("btn-link",{"btn-link-icon":e,"btn-link-icon-only":e})}}function Vg(d){switch(d){case"group-end":return $("pl-2","pr-3")}}const tr=X.forwardRef((d,e)=>{const{kind:t,variant:n,type:s,tooltip:i,icon:o,disabled:a=!1,active:r,onClick:c,onContextMenu:h,onMouseDown:u,onMouseUp:m,onMouseEnter:p,onMouseLeave:g,onKeyDown:C,className:f,style:S,children:v,tabIndex:w,"data-testid":T,"aria-label":y}=d,E=Boolean(o&&v==null),I=Bg(t,E);let F;n&&(F=Vg(n));let N;o&&(N=X.isValidElement(o)?o:l.jsx(J,{icon:o}));let H;i!==void 0&&(H=typeof i=="string"?l.jsx(tt,{children:i}):i);let P=y;y===void 0&&E&&i!=null&&typeof i=="string"&&(P=i);const O=l.jsxs("button",{"data-testid":T,ref:e,type:s,className:$("btn",I,F,{active:r},f),onClick:c,onContextMenu:h,onMouseUp:m,onMouseDown:u,onMouseEnter:p,onMouseLeave:g,onKeyDown:C,style:S,disabled:a,tabIndex:w,"aria-label":P,children:[o&&N,v,i!=null&&!a&&H]});return a?l.jsxs("span",{className:"btn-disabled-wrapper",children:[O,i!==void 0&&H]}):O});tr.displayName="Button";tr.propTypes={kind:D.oneOf(jg).isRequired,variant:D.oneOf(Hg),type:D.oneOf(["submit","reset","button"]),tooltip(d){const{tooltip:e,icon:t,children:n}=d;return e===void 0&&t!=null&&n==null?new Error("Tooltip is required for icon only buttons"):null},icon(d){const{children:e,icon:t}=d;return t==null&&e==null?new Error("Icon is required if no children are provided"):e==null&&!X.isValidElement(t)&&(t==null||t.iconName===""||t.iconName==null)?new Error("Icon must be react element or fontawesome IconDefinition"):null},disabled:D.bool,active:D.bool,onClick(d){const{onClick:e,type:t}=d;return t==="button"&&typeof e!="function"?new Error("type button requires an onClick function"):e!==void 0&&typeof e!="function"?new Error("onClick must be a function"):null},onContextMenu:D.func,onMouseUp:D.func,onMouseDown:D.func,onMouseEnter:D.func,onMouseLeave:D.func,onKeyDown:D.func,tabIndex:D.number,children:D.node,className:D.string,style:D.object,"data-testid":D.string};tr.defaultProps={type:"button",onClick:void 0,onContextMenu:void 0,onMouseUp:void 0,onMouseDown:void 0,onMouseEnter:void 0,onMouseLeave:void 0,onKeyDown:void 0,variant:void 0,tooltip:void 0,icon:void 0,disabled:!1,active:void 0,tabIndex:void 0,children:void 0,className:void 0,style:{},"data-testid":void 0};const V=tr;function kl({className:d="modal-footer",children:e,"data-testid":t}){return l.jsx("div",{className:d,"data-testid":t,children:e})}function ji(d){const{isOpen:e,headerText:t,bodyText:n,onCancel:s,onConfirm:i,onDiscard:o,onModalDisable:a,cancelButtonText:r="Cancel",confirmButtonText:c="Okay",discardButtonText:h="Discard",isConfirmDanger:u=!1,children:m,"data-testid":p}=d,g=b.useRef(null),C=b.useRef(null),f=b.useCallback(()=>{C.current!==null&&C.current.checked&&a&&a(),i()},[i,a]),S=b.useCallback(()=>{g.current?.focus()},[]);let v="";return e&&(v=typeof n=="function"?n():n),l.jsxs(Do,{isOpen:e,className:"theme-bg-light",onOpened:S,children:[l.jsx(Fo,{closeButton:!1,children:t}),l.jsx(No,{children:v}),l.jsxs(kl,{children:[a&&l.jsxs("div",{className:"custom-control custom-checkbox form-group mr-auto",children:[l.jsx("input",{type:"checkbox",className:"custom-control-input",id:"move-confirmation-checkbox",defaultChecked:!1,ref:C,"data-testid":p!==void 0?`${p}-checkbox-confirm`:void 0}),l.jsx("label",{className:"custom-control-label",htmlFor:"move-confirmation-checkbox",children:"Don't ask me again"})]}),o&&l.jsx(V,{kind:"secondary",className:"mr-auto","data-dismiss":"modal",onClick:o,"data-testid":p!==void 0?`${p}-btn-discard`:void 0,children:h}),s&&l.jsx(V,{kind:"secondary","data-dismiss":"modal",onClick:s,"data-testid":p!==void 0?`${p}-btn-cancel`:void 0,children:r}),l.jsxs(er,{children:[l.jsx(V,{kind:u?"danger":"primary",onClick:f,ref:g,"data-testid":p!==void 0?`${p}-btn-confirm`:void 0,children:c}),m]})]})]})}ji.propTypes={isOpen:D.bool.isRequired,headerText:D.string.isRequired,bodyText:D.oneOfType([D.string,D.func]).isRequired,onCancel:D.func,onConfirm:D.func.isRequired,onDiscard:D.func,onModalDisable:D.func,cancelButtonText:D.string,confirmButtonText:D.string,discardButtonText:D.string,children:D.node,"data-testid":D.string};ji.defaultProps={children:void 0,cancelButtonText:"Cancel",confirmButtonText:"Okay",discardButtonText:"Discard",onCancel:void 0,onDiscard:void 0,onModalDisable:void 0,"data-testid":void 0};const nr=X.forwardRef((d,e)=>{const{children:t,className:n,disabled:s,onClick:i,style:o,id:a}=d;return l.jsx("button",{ref:e,type:"button",className:$("btn",n),onClick:i,style:o,disabled:s,id:a,children:t})});nr.displayName="Button";nr.propTypes={children:D.node,className:D.string,disabled:D.bool,onClick:D.func,style:D.shape({}),id:D.string};nr.defaultProps={children:null,className:"",disabled:!1,onClick:()=>null,style:{},id:""};const Ud=nr;function Ol({className:d,isFlipped:e,children:t,"data-testid":n}){const s=r=>{if(t.length!==2)throw new Error("CardFlip requires 2 children to function");return t[r]},i=b.useRef(null),o=b.useCallback(r=>{r.target===r.currentTarget&&document.body.classList.add("card-flip--is-flipping")},[]),a=b.useCallback(r=>{r.target===r.currentTarget&&document.body.classList.remove("card-flip--is-flipping")},[]);return b.useEffect(function(){if(!i.current)throw Error("ref undefined");i.current.addEventListener("transitionstart",o);const c=i.current;return function(){if(c!=null)return c.removeEventListener("transitionstart",o)}},[o]),l.jsxs("div",{className:$(d,{"card-flip--show-front":e,"card-flip--show-back":!e}),"data-testid":n,children:[l.jsx("div",{className:"card-flip--back",children:s(0)}),l.jsx("div",{ref:i,className:"card-flip--front",onTransitionEnd:a,children:s(1)})]})}function Or(d){return d.then!==void 0}class Xs{static actionsDisabled=!1;static disableAllActions(){Xs.actionsDisabled=!0}static enableAllActions(){Xs.actionsDisabled=!1}static isContextActionEvent(e){return Array.isArray(e.contextActions)}static compareActions(e,t){return e.group!==t.group?(e.group??0)>(t.group??0)?1:-1:e.order!==t.order?(e.order??0)>(t.order??0)?1:-1:e.title!==t.title?(e.title??"")>(t.title??"")?1:-1:e!==t?e>t?1:-1:0}static sortActions(e){if(e==null||!Array.isArray(e))return[];const t=e.slice();return t.sort(Xs.compareActions),t}static isMacPlatform(){const{platform:e}=window.navigator;return e.startsWith("Mac")}static getModifierKey(){return Xs.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(e){const t=Xs.getModifierKey();return e[t]}static getMenuItems(e,t=!0){let n=[],s=e;Array.isArray(s)||(s=[s]);for(let i=0;i<s.length;i+=1){const o=s[i];let a;typeof o=="function"?a=o():a=o,a!=null&&(a instanceof Promise?t&&n.push(a):Array.isArray(a)?n=n.concat(a):n.push(a))}return n=n.filter(i=>i.title!==void 0||i.then!=null||i.menuElement),n}static getNextMenuItem(e,t,n){let s=e;s<0&&t<0&&(s=n.length);for(let i=1;i<n.length+1;i+=1){const o=(s+t*i+n.length)%n.length,a=n[o];if(!(a instanceof Promise)&&a.disabled!==!0)return o}return e}}const He=Xs,$d=Z.module("GlobalContextAction");class Ug extends b.Component{constructor(e){super(e),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}componentDidMount(){document.body.addEventListener("contextmenu",this.handleContextMenu),document.body.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.body.removeEventListener("contextmenu",this.handleContextMenu),document.body.removeEventListener("keydown",this.handleKeyDown)}handleContextMenu(e){const t=e;t.contextActions==null&&(t.contextActions=[]);const{action:n}=this.props;n.title==null&&!n.menuElement||(t.contextActions==null&&(t.contextActions=[]),t.contextActions.push(n),$d.debug("Received context menu event at global action! Menu items are now: ",t.contextActions))}handleKeyDown(e){const{action:t}=this.props;!He.actionsDisabled&&t.shortcut!==void 0&&t.shortcut.matchesEvent(e)&&($d.debug("Global hotkey matched!",e),t.action?.(e),e.preventDefault(),e.stopPropagation())}render(){return null}}const $g=Ug;class Wg extends b.Component{render(){const{actions:e,"data-testid":t}=this.props,n=[];for(let s=0;s<e.length;s+=1){const i=e[s],{shortcut:o}=i;if(i.title!=null||i.menuElement||o){const a=l.jsx($g,{action:i,"data-testid":t},`${i.title}.${o?.id}`);n.push(a)}}return n}}const Gg=Wg;const Qo=Z.module("ContextActions");class zg extends b.Component{static groups={default:null,high:100,medium:5e3,low:1e4,global:1e5,edit:100};static triggerMenu(e,t,n,s){if(s.length===0)return;const i=new MouseEvent("contextmenu",{clientX:t,clientY:n,bubbles:!0,cancelable:!0});i.contextActions=s,e.dispatchEvent(i)}constructor(e){super(e),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.container=X.createRef(),this.state={globalActions:[],keyboardActions:[]}}static getDerivedStateFromProps(e){if(e.actions==null||!Array.isArray(e.actions))return{globalActions:[],keyboardActions:[]};const t=e.actions.filter(s=>!Or(s)&&typeof s!="function"&&s.isGlobal),n=e.actions.filter(s=>!Or(s)&&typeof s!="function"&&(s.isGlobal===void 0||!s.isGlobal)&&s.shortcut!=null);return{globalActions:t,keyboardActions:n}}componentDidMount(){this.container.current?.parentElement&&(this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.addEventListener("keydown",this.handleKeyDown))}componentWillUnmount(){this.container.current?.parentElement&&(this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.removeEventListener("keydown",this.handleKeyDown))}container;handleContextMenu(e){const{ignoreClassNames:t=[]}=this.props;if(t.length>0){let s=e.target;for(;s!=null;){const{classList:i}=s,o=t.find(a=>i.contains(a));if(o!==void 0){Qo.debug2(`Contextmenu event ignored based on the target className "${o}"`);return}s=s.parentElement}}if(He.isContextActionEvent(e)||(e.contextActions=[]),!He.isContextActionEvent(e))return;const{actions:n}=this.props;if(n!=null){let s=n;Array.isArray(s)&&(s=s.filter(i=>Or(i)||typeof i=="function"||i.isGlobal===void 0||!i.isGlobal)),e.contextActions=e.contextActions.concat(s)}Qo.debug("Received context menu event! Menu items are now: ",e.contextActions)}handleKeyDown(e){const{keyboardActions:t}=this.state;for(let n=0;n<t.length;n+=1){const s=t[n];!He.actionsDisabled&&s.shortcut!=null&&s.shortcut.matchesEvent(e)&&(Qo.debug("Context hotkey matched!",e),s.action?.(e),e.stopPropagation(),e.preventDefault(),Qo.debug2("Matched hotkey returned false, key event not consumed"))}}render(){const{"data-testid":e}=this.props,{globalActions:t}=this.state;return l.jsx("div",{className:"context-actions-listener",ref:this.container,"data-testid":e,children:l.jsx(Gg,{actions:t})})}}const ae=zg,Al=X.forwardRef((d,e)=>{function t(f){const{menuItem:S,onMenuItemClick:v}=d;v(S,f)}function n(f){const{menuItem:S,onMenuItemMouseMove:v}=d;v(S,f)}function s(f){const{menuItem:S,onMenuItemContextMenu:v}=d;v(S,f)}function i(f,S,v){if(typeof f.type=="string")return f;const{closeMenu:w,menuItem:T,isKeyboardSelected:y,isMouseSelected:E,"data-testid":I}=d,F={menuItem:T,closeMenu:w,isKeyboardSelected:y,isMouseSelected:E,iconElement:S,displayShortcut:v,"data-testid":I};return X.cloneElement(f,{forwardedProps:F})}const{children:o,menuItem:a,isKeyboardSelected:r=!1,isMouseSelected:c=!1,"data-testid":h}=d,u=a.shortcut?.getDisplayText();let m=null;if(a.icon){const f=a.icon;if(X.isValidElement(f))m=f;else{let S;a.iconColor!=null&&(a.disabled===void 0||!a.disabled)&&(S={color:a.iconColor}),m=l.jsx(J,{icon:f,style:S})}}let p=null;const g=Boolean(o);a.actions&&(p=l.jsx(J,{icon:yh}));let C=null;if(a.menuElement)C=l.jsx("div",{className:"custom-menu-item",onMouseMove:n,children:i(a.menuElement,m,u)});else{const f=a.disabled,S=a.iconOutline;C=l.jsx("button",{type:"button",className:$("btn-context-menu",{disabled:f},{active:(g||c)&&(f===void 0||!f)},{"keyboard-active":r&&(f===void 0||!f)}),onClick:t,onMouseMove:n,onContextMenu:s,title:a.description??"",children:l.jsxs("div",{className:"btn-context-menu-wrapper",children:[l.jsx("span",{className:$("icon",{outline:S}),children:m}),l.jsx("span",{className:"title",children:a.title}),u!==void 0&&l.jsx("span",{className:"shortcut",children:u}),p&&l.jsx("span",{className:$("submenu-indicator",{disabled:f}),children:p})]})})}return l.jsxs("div",{className:"context-menu-item",ref:e,"data-testid":h,children:[o,C]})});Al.displayName="ContextMenuItem";Al.defaultProps={children:null,isKeyboardSelected:!1,isMouseSelected:!1,"data-testid":void 0};const Lh=Al,De=Object.freeze([]),Gn=new Map;class Kg extends Error{isCanceled=!0}const Hi=Kg;class sr{static isDark(e){const t=document.createElement("div");t.style.display="none",t.style.color=e;const n=getComputedStyle(document.body.appendChild(t)).color,s=n.match(/\d+/g);let i=[];if(s)i=s.map(a=>parseInt(a,10));else throw new Error(`Invalid color received. Got ${n}`);return document.body.removeChild(t),sr.getBrightness(i)<125}static getBrightness(e){return Math.round((e[0]*299+e[1]*587+e[2]*114)/1e3)}}async function $i(d){const{clipboard:e}=navigator;if(e!==void 0)try{return navigator.clipboard.writeText(d)}catch{return Wd(d)}Wd(d)}function Wd(d){const e=document.activeElement,t=document.createElement("textarea");t.value=d,document.body.appendChild(t),t.focus(),t.select();const n=document.execCommand("copy");if(document.body.removeChild(t),e instanceof HTMLElement&&e.focus(),!n)throw new Error("Unable to execute copy command")}const qg="table_",Gd="column_",Yg=new Set(["in","not","i","ii","k"]),Xg=new Set(["abstract","continue","for","new","switch","assert","default","if","package","synchronized","boolean","do","goto","private","this","break","double","implements","protected","throw","byte","else","import","public","throws","case","enum","instanceof","return","transient","catch","extends","int","short","try","char","final","interface","static","void","class","finally","long","strictfp","volatile","const","float","native","super","while","null","true","false"]),Zg=/[^a-zA-Z0-9_$+@-]/g,Qg=/[^A-Za-z0-9_$]/g;class cn{static legalize=(e,t,n,s,i)=>{let o=e.trim().replace(/[- ]/g,"_");return s&&(Yg.has(o)||Xg.has(o))&&(o=t+o),o=o.replace(n,""),o||(o=t+i),Number.isNaN(Number(o.charAt(0)))||(o=t+o),o};static legalizeTableName=e=>cn.legalize(e,qg,Zg,!1,0);static legalizeColumnNames=e=>{const t=[];return e.forEach((n,s)=>{let i=cn.legalizeColumnName(n,s);t.includes(i)&&(i=Gd+s),t.push(i)}),t};static legalizeColumnName=(e,t=0)=>cn.legalize(e,Gd,Qg,!0,t);static isValidTableName=e=>cn.legalizeTableName(e)===e;static isValidColumnName=e=>cn.legalizeColumnName(e)===e}function Jg(d,e){return d?d.closest(`.${e}`):null}const ef={getClosestByClassName:Jg};class Ve extends CustomEvent{constructor(e,t){super(e,t)}}class tf extends Error{isTimeout=!0}const Ph=tf;class ve{static makeCancelable(e,t){let n=!1,s,i;const o=new Promise((a,r)=>{i=r,Promise.resolve(e).then(c=>{n?t&&t(c):(s=c,a(c))}).catch(c=>r(c))});return o.cancel=()=>{n=!0,i(new Hi),s!=null&&t&&t(s)},o}static isCanceled(e){return e instanceof Hi}static isTimedOut(e){return e instanceof Ph}}class nf{pending=[];resolved=[];add(e,t){const n=ve.makeCancelable(e,t);return this.pending.push(n),n.then(()=>{this.resolve(n)},()=>{this.resolve(n)}),n}remove(e){for(let t=0;t<this.pending.length;t+=1)if(this.pending[t]===e){this.pending.splice(t,1);return}}resolve(e){this.remove(e),this.resolved.push(e)}cancel(){const e=[...this.pending,...this.resolved];for(let t=0;t<e.length;t+=1)e[t].cancel();this.pending=[],this.resolved=[]}}const ts=nf;function M(d){if(d==null)throw new Error("Value is null or undefined")}function _(d,e,t=void 0){const n=d.get(e)??t;if(n!==void 0)return n;throw new Error(`Missing value for key ${e}`)}class ln{static isValidRange(e){return e!=null&&e.length===2&&Number.isInteger(e[0])&&Number.isInteger(e[1])&&e[0]<=e[1]}static validateRange(e){if(!ln.isValidRange(e))throw new Error(`Invalid range! ${e}`)}static isSelected(e,t){for(let n=0;n<e.length;n+=1){const s=e[n],i=s[0],o=s[1];if(i<=t&&t<=o)return!0}return!1}static selectRange(e,t){let[n,s]=t;const i=[...e];for(let o=i.length-1;o>=0;o-=1){const a=i[o],r=a[0],c=a[1];if(r<=n&&s<=c)return i;n<=c&&r<=s&&(n=Math.min(n,r),s=Math.max(s,c),i.splice(o,1))}return i.push([n,s]),i}static deselectRange(e,t){const[n,s]=t,i=[...e];for(let o=i.length-1;o>=0;o-=1){const a=i[o],r=a[0],c=a[1];if(!(s<r||c<n))if(r<n&&s<c){i[o]=[r,n-1],i.splice(o+1,0,[s+1,c]);break}else n<=r&&c<=s?i.splice(o,1):r<n?i[o]=[r,n-1]:i[o]=[s+1,c]}return i}static count(e){return e.reduce((t,n)=>t+(n[1]-n[0]+1),0)}static getItemsInRanges(e,t){return t.reduce((n,s)=>{const i=[...n];for(let o=s[0];o<=s[1];o+=1)i.push(e[o]);return i},[])}}class sf{static join(e,t="and"){if(e==null||e.length===0)return"";if(e.length===1)return e[0];if(e.length===2)return`${e[0]} ${t} ${e[1]}`;const n=e.slice(0,e.length-1).join(", "),s=e[e.length-1];return`${n}, ${t} ${s}`}static toLower(e,t=!0){if(e==null){if(t)return"";throw new Error("Null string passed in to TextUtils.toLower")}return e.toLowerCase()}static sort(e,t,n=!0){return e<t?n?-1:1:e>t?n?1:-1:0}}const Wt=sf;class Wi{static TIME_PATTERN="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]";static TIME_ZONES=Object.freeze([{label:"Tokyo UTC+9 No DST",value:"Asia/Tokyo"},{label:"Seoul UTC+9 No DST",value:"Asia/Seoul"},{label:"Hong Kong UTC+8 No DST",value:"Asia/Hong_Kong"},{label:"Singapore UTC+8 No DST",value:"Asia/Singapore"},{label:"Kolkata UTC+5:30 No DST",value:"Asia/Kolkata"},{label:"Berlin UTC+1",value:"Europe/Berlin"},{label:"UTC UTC±0 No DST",value:"UTC"},{label:"London UTC±0",value:"Europe/London"},{label:"Sao Paulo UTC-2",value:"America/Sao_Paulo"},{label:"Newfoundland UTC-3:30",value:"America/St_Johns"},{label:"Halifax UTC-4",value:"America/Halifax"},{label:"New York UTC−5",value:"America/New_York"},{label:"Chicago UTC-6",value:"America/Chicago"},{label:"Denver UTC-7",value:"America/Denver"},{label:"Los Angeles UTC-8",value:"America/Los_Angeles"},{label:"Anchorage UTC-9",value:"America/Anchorage"},{label:"Honolulu UTC-10 No DST",value:"Pacific/Honolulu"},{label:"Zurich UTC+1",value:"Europe/Zurich"},{label:"Amsterdam UTC+1",value:"Europe/Amsterdam"},{label:"Taipei UTC+8 No DST",value:"Asia/Taipei"},{label:"Sydney UTC+10",value:"Australia/Sydney"}]);static formatElapsedTime(e){if(typeof e!="number"||!Number.isInteger(e))throw new Error(`${e} is not a number that can be expressed as a formatted time`);const t=Math.floor(e/3600),n=Math.floor(e%3600/60),s=e%60;return`${t>0?`${t}h `:""}${n>0||t>0?`${n}m `:""}${e>=60?`${s}s`.padStart(3,"0"):`${s}s`}`}static formatTime(e){if(typeof e!="number"||!Number.isInteger(e)||e<0)throw new Error(`${e} is not a number that can be expressed as a formatted time`);const t=String(Math.floor(e/(60*60))).padStart(2,"0"),n=e%(60*60),s=String(Math.floor(n/60)).padStart(2,"0"),i=n%60,o=String(Math.ceil(i)).padStart(2,"0");return`${t}:${s}:${o}`}static isTimeString(e){return new RegExp(Wi.TIME_PATTERN).test(e)}static parseTime(e){if(e==null||typeof e!="string")throw new Error(`${e} is not a valid string`);const t=e.split(":");if(t.length!==3)throw new Error(`${e} is not a time string that can be parsed`);return Number(t[0])*60*60+Number(t[1])*60+Number(t[2])}}class of extends Error{isInvalid=!0}const Ni=of,zd=Z.module("ContextMenu");class Da extends b.PureComponent{static defaultProps={subMenuParentWidth:0,subMenuParentHeight:0,closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0};static handleContextMenu(e){e.metaKey||(e.stopPropagation(),e.preventDefault())}constructor(e){super(e),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=X.createRef(),this.oldFocus=document.activeElement,this.activeSubMenuRef=X.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(()=>{this.container.current?.focus();const{onMenuOpened:e}=this.props;e(this)})}componentDidUpdate(e,t){const{actions:n}=this.props,{activeSubMenu:s}=this.state;s!==t.activeSubMenu&&(s==null?this.container.current?.focus():this.setActiveSubMenuPosition()),e.actions!==n&&(this.initMenu(),(this.container.current==null||!this.container.current.contains(document.activeElement))&&this.container.current?.focus()),this.verifyPosition()}componentWillUnmount(){this.cancelPromises(),window.removeEventListener("resize",this.handleWindowResize),cancelAnimationFrame(this.rAF)}container;oldFocus;activeSubMenuRef;subMenuTimer;rAF;initialPosition;getKeyboardIndex(){const{options:e}=this.props;if(e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse){const{keyboardIndex:t}=this.state;return t}return this.getMouseIndex()}setKeyboardIndex(e){const{options:t}=this.props;t.separateKeyboardMouse!==void 0&&t.separateKeyboardMouse?this.setState({keyboardIndex:e}):this.setMouseIndex(e)}getMouseIndex(){const{mouseIndex:e}=this.state;return e}setMouseIndex(e){this.setState({mouseIndex:e})}initMenu(){this.cancelPromises(),cancelAnimationFrame(this.rAF);const{options:e}=this.props;let t=e.initialKeyboardIndex;t===void 0&&(t=-1);const{actions:n}=this.props,s=He.getMenuItems(n),i=[];for(let o=s.length-1;o>=0;o-=1){const a=s[o];a instanceof Promise?this.initMenuPromise(a):i.push(a)}this.setState({mouseIndex:-1,keyboardIndex:t,activeSubMenu:null,menuItems:He.sortActions(i)})}initMenuPromise(e){const t=ve.makeCancelable(e);this.setState(n=>({pendingItems:n.pendingItems.concat(t)})),t.then(n=>{this.setState(s=>{const i=s.pendingItems.indexOf(t);if(i>=0){const o=s.pendingItems.slice();return o.splice(i,1),{menuItems:He.sortActions(s.menuItems.concat(n)),pendingItems:o}}return null})},n=>{ve.isCanceled(n)||(this.setState(s=>{const i=s.pendingItems.indexOf(t);if(i>=0){const o=s.pendingItems.slice();return o.splice(i,1),{pendingItems:o}}return null}),zd.error(n))})}cancelPromises(){const{pendingItems:e}=this.state;e.map(t=>t.cancel())}setActiveSubMenuPosition(){if(this.activeSubMenuRef.current===null)return;const e=this.activeSubMenuRef.current.getBoundingClientRect();this.setState({subMenuTop:e.top,subMenuLeft:e.right,subMenuParentHeight:e.height,subMenuParentWidth:e.width})}verifyPosition(){const{options:e,updatePosition:t,subMenuParentWidth:n,subMenuParentHeight:s,top:i,left:o}=this.props;if(!this.container.current||e.doNotVerifyPosition!=null&&e.doNotVerifyPosition)return;let{top:a,left:r}=this.initialPosition;const{width:c,height:h}=this.container.current?.getBoundingClientRect()??{width:0,height:0},u=(this.container.current?.scrollHeight??0)>window.innerHeight;h===0||c===0||(a+h>window.innerHeight&&(a-h-s>0?a-=h-s:a=window.innerHeight-h),r+c>window.innerWidth&&(r=r-c-n),(o!==r||i!==a)&&(this.setState({hasOverflow:u}),t(a,r)))}handleWindowResize(){this.container.current&&this.closeMenu(!0)}handleBlur(e){if(!this.container.current){zd.warn("Container is null!");return}if(!this.container.current.contains(e.relatedTarget)){let t=e.relatedTarget,n=!1;for(;t&&!n;)n=t.hasAttribute("data-dh-context-menu"),t=t.parentElement;n||this.closeMenu(!0)}}isEscapeKey(e){const{left:t}=this.props;return e==="Escape"||t<0&&e==="ArrowRight"||e==="ArrowLeft"}handleKeyDown(e){const{menuItems:t}=this.state,n=this.getKeyboardIndex();let s=n,i=!1;if(e.key==="Enter"||e.key===" "){n>=0&&n<t.length&&this.handleMenuItemClick(t[n],e);return}if(e.key==="ArrowRight"?n>=0&&n<=t.length?i=!0:s=0:this.isEscapeKey(e.key)?s=null:e.key==="ArrowUp"||e.shiftKey&&e.key==="Tab"?s=He.getNextMenuItem(s,-1,t):(e.key==="ArrowDown"||e.key==="Tab")&&(s=He.getNextMenuItem(s,1,t)),i){this.openSubMenu(n),e.preventDefault(),e.stopPropagation();return}n!==s&&(s!==null?this.setKeyboardIndex(s):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}openSubMenu(e){const{menuItems:t,activeSubMenu:n}=this.state,s=t[e].actions?e:null;n!==s&&this.setState({activeSubMenu:s,subMenuTop:null,subMenuLeft:null})}closeMenu(e=!1){const{closeMenu:t,onMenuClosed:n}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t(e),n(this)})}closeSubMenu(){this.setState({activeSubMenu:null})}handleCloseSubMenu(e){e?this.closeMenu(!0):this.closeSubMenu()}handleMenuItemClick(e,t){t.preventDefault(),t.stopPropagation();const{menuItems:n}=this.state;e!=null&&(e.disabled===void 0||!e.disabled)&&(e.actions!=null?this.openSubMenu(n.indexOf(e)):e.action!=null&&(e.action(),this.closeMenu(!0)))}handleMenuItemContextMenu(e,t){t.metaKey||this.handleMenuItemClick(e,t)}handleMenuItemMouseMove(e){const{menuItems:t}=this.state,n=t.indexOf(e);this.setMouseIndex(n),n>=0&&n<t.length&&(e.disabled===void 0||!e.disabled)&&this.openSubMenu(n)}handleMouseLeave(){this.setMouseIndex(-1)}render(){const e=[],{top:t,left:n}=this.props,{activeSubMenu:s,hasOverflow:i,keyboardIndex:o,menuItems:a,mouseIndex:r,pendingItems:c,subMenuTop:h,subMenuLeft:u,subMenuParentWidth:m,subMenuParentHeight:p}=this.state;for(let v=0;v<a.length;v+=1){const w=a[v];v>0&&w.group!==a[v-1].group&&e.push(l.jsx("hr",{},`${v}.separator`));const T=l.jsx(Lh,{ref:s===v?this.activeSubMenuRef:null,isKeyboardSelected:o===v,isMouseSelected:r===v,menuItem:w,closeMenu:this.handleCloseSubMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:this.handleMenuItemContextMenu},v);e.push(T)}let g=null;c.length>0&&(g=l.jsx("div",{className:"loading",children:l.jsx(Ln,{})}));const{menuStyle:C,"data-testid":f}=this.props,S=s!==null&&h!==null&&u!==null;return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:$({"has-overflow":i},"context-menu-container"),style:{top:t,left:n,...C},ref:this.container,"data-dh-context-menu":!0,onBlur:this.handleBlur,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,onContextMenu:Da.handleContextMenu,role:"menuitem",tabIndex:0,"data-testid":f,children:[e,g]}),S&&s!==null&&h!==null&&u!==null&&l.jsx(Da,{actions:a[s].actions||[],closeMenu:this.handleCloseSubMenu,top:h,left:u,updatePosition:(v,w)=>{this.setState({subMenuTop:v,subMenuLeft:w})},subMenuParentWidth:m,subMenuParentHeight:p},`sub-${s}`)]})}}const af=Da;class rf extends b.Component{constructor(e){super(e),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.container=X.createRef(),this.openMenu=X.createRef(),this.state={actions:null,left:0,top:0}}componentDidMount(){this.container.current?.parentElement&&this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu)}componentWillUnmount(){this.container.current?.parentElement&&this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu)}container;openMenu;handleContextMenu(e){if(!He.isContextActionEvent(e)||!this.container.current||e.metaKey||e.ctrlKey)return;const t=He.getMenuItems(e.contextActions),n=this.container.current.getBoundingClientRect(),s=e.clientY-n.top,i=e.clientX-n.left;if(t.length===0){if(e.target===this.container.current){e.preventDefault(),this.setState({actions:null},()=>{const o=document.elementFromPoint(i,s),a=new MouseEvent("contextmenu",{clientX:e.clientX,clientY:e.clientY,bubbles:!0,cancelable:!0});o?.dispatchEvent(a)});return}return}e.preventDefault(),this.setState({actions:t,top:s,left:i})}handleMenuClose(e){e===this.openMenu.current&&this.setState({actions:null})}render(){let e=null;const{"data-testid":t}=this.props,{actions:n,top:s,left:i}=this.state;return n&&(e=l.jsx(af,{ref:this.openMenu,actions:n,onMenuClosed:this.handleMenuClose,top:s,left:i,updatePosition:(o,a)=>{this.setState({top:o,left:a})},"data-testid":t})),l.jsx("div",{className:$("context-menu-root",{active:n}),ref:this.container,children:e})}}const _h=rf;class Ss extends b.Component{static propTypes={className:D.string,in:D.bool.isRequired,children:D.node.isRequired,autoFocusOnShow:D.bool,"data-testid":D.string};static defaultProps={className:"",autoFocusOnShow:!1,"data-testid":void 0};static handleEnter(e){const t=e;t.style.height="0"}static handleEntering(e){const t=e;t.style.height=`${Ss.getHeight(t)}px`}static handleExiting(e){const t=e;t.style.height="0"}static handleExit(e){const t=e;t.style.height=`${Ss.getHeight(t)}px`}static getHeight(e){const t=e.scrollWidth-e.clientWidth;return e.scrollHeight-t}constructor(e){super(e),this.handleEntered=this.handleEntered.bind(this)}handleEntered(e){const t=e;t.style.height="";const{autoFocusOnShow:n}=this.props;if(n!==void 0&&n){const s=t.querySelector("input, select, textarea");s?.focus()}}render(){const{children:e,className:t,in:n,"data-testid":s}=this.props;return l.jsx(gt,{in:n,classNames:{enterActive:"collapsing",enterDone:"collapse show",exitActive:"collapsing",exitDone:"collapse"},onEnter:Ss.handleEnter,onEntering:Ss.handleEntering,onEntered:this.handleEntered,onExit:Ss.handleExit,onExiting:Ss.handleExiting,timeout:350,children:i=>l.jsx("div",{className:$({collapse:i==="exited"},t),"data-testid":s,children:e})})}}const lf=Ss;function ir(d){const e=b.useRef();return b.useEffect(function(){e.current=d}),e.current}function jh(d){const e=b.useRef(null);return b.useEffect(function(){d&&(typeof d=="function"?d(e.current):d.current=e.current)}),e}const df=3500,cf=Z.module("useCopyToClipboard");function hf(){const[d,e]=b.useState(!1),t=b.useRef(null),n=b.useCallback(s=>{$i(s).then(()=>{e(!0)}).catch(i=>cf.error(`Unable to copy ${s}`,`
|
|
2
2
|
`,i))},[]);return b.useEffect(()=>(t.current&&clearTimeout(t.current),d&&(t.current=setTimeout(()=>{e(!1)},df)),()=>{t.current&&clearTimeout(t.current)}),[d]),[d,n]}const or=X.forwardRef((d,e)=>{const{checked:t=!1,children:n,className:s,disabled:i,inputClassName:o,isInvalid:a,labelClassName:r,name:c,onChange:h,"data-testid":u}=d,[m]=b.useState(Pe()),p=jh(e);b.useEffect(function(){p.current&&(p.current.indeterminate=t===null)},[p,t]);const g=b.useCallback(C=>{p.current&&(p.current.indeterminate=t===null),h&&h(C)},[p,t,h]);return l.jsxs("div",{className:$("custom-control custom-checkbox",s),children:[l.jsx("input",{type:"checkbox",ref:p,checked:t??!1,className:$("custom-control-input",o,{"is-invalid":a}),disabled:i,id:m,name:c,onChange:g,"data-testid":u}),l.jsx("label",{className:$("custom-control-label",r),htmlFor:m,children:n})]})});or.displayName="Checkbox";or.propTypes={checked:(d,e)=>{const{[e]:t}=d;return t!==null&&typeof t!="boolean"?new Error("Checked must be a boolean or null for indeterminate"):null},children:D.node.isRequired,className:D.string,disabled:D.bool,inputClassName:D.string,isInvalid:D.bool,labelClassName:D.string,name:D.string,onChange:D.func,"data-testid":D.string};or.defaultProps={checked:!1,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};const Xt=or;class uf extends b.PureComponent{static defaultProps={placeholder:"Search",className:"",matchCount:null,onKeyDown(){},id:"","data-testid":void 0};constructor(e){super(e),this.inputField=X.createRef()}inputField;focus(){this.inputField.current?.focus()}render(){const{value:e,placeholder:t,onBlur:n,onChange:s,className:i,disabled:o,matchCount:a,id:r,onKeyDown:c,"data-testid":h}=this.props;return l.jsxs("div",{className:$("search-group",i),children:[l.jsx("input",{type:"search",value:e,onBlur:n,onChange:s,onKeyDown:c,className:"form-control",disabled:o,placeholder:t,ref:this.inputField,id:r,"data-testid":h}),a!=null&&l.jsx("span",{className:"search-match",children:a}),l.jsx("span",{className:"search-icon",children:l.jsx(J,{icon:xh})})]})}}const As=uf;var Hh=(d=>(d.UP="UP",d.DOWN="DOWN",d))(Hh||{});class Ti extends b.Component{static MENU_NAVIGATION_DIRECTION=Hh;static DROP_DOWN_MENU_HEIGHT=200;static propTypes={options:D.arrayOf(D.shape({title:D.string.isRequired,value:D.string.isRequired})).isRequired,popperOptions:D.shape({title:D.string.isRequired,value:D.string.isRequired}),onChange:D.func,inputPlaceholder:D.string,searchPlaceholder:D.string,disabled:D.bool,className:D.string,defaultValue:D.string,spellCheck:D.bool,onEnter:D.func,"data-testid":D.string};static defaultProps={onChange(){},inputPlaceholder:"",searchPlaceholder:"Search",disabled:!1,className:"",defaultValue:"",popperOptions:null,spellCheck:!0,onEnter(){},"data-testid":void 0};constructor(e){super(e),this.state={value:"",filter:"",filteredOptions:e.options,keyboardOptionIndex:-1,menuIsOpen:!1,inputWidth:100},this.toggleMenu=this.toggleMenu.bind(this),this.handleMenuKeyDown=this.handleMenuKeyDown.bind(this),this.handleMenuBlur=this.handleMenuBlur.bind(this),this.closeMenu=this.closeMenu.bind(this),this.handleInputChange=this.handleInputChange.bind(this),this.handleInputKeyDown=this.handleInputKeyDown.bind(this),this.handleInputBlur=this.handleInputBlur.bind(this),this.handleFilterChange=this.handleFilterChange.bind(this),this.handleOptionClick=this.handleOptionClick.bind(this),this.handleOptionFocus=this.handleOptionFocus.bind(this),this.handleMenuOpened=this.handleMenuOpened.bind(this),this.handleMenuExited=this.handleMenuExited.bind(this),this.popper=X.createRef(),this.cbContainer=X.createRef(),this.toggleButton=X.createRef(),this.menuContainer=X.createRef(),this.input=X.createRef(),this.searchInput=X.createRef()}componentDidUpdate(){const{menuIsOpen:e,keyboardOptionIndex:t}=this.state;e&&t>=0&&this.scrollOptionIntoView()}popper;cbContainer;toggleButton;menuContainer;input;searchInput;setInputWidth(){this.cbContainer.current&&this.setState({inputWidth:this.cbContainer.current.getBoundingClientRect().width})}getCachedFilteredOptions=pe((e,t)=>e.filter(n=>n.title.toLowerCase().indexOf(t.toLowerCase())>=0||n.value.toLowerCase().indexOf(t.toLowerCase())>=0));focus(){this.input.current?.focus()}resetValue(){this.setState({value:""})}updateInputValue(e){const{onChange:t}=this.props;this.setState({value:e}),t(e)}handleResize(){this.setInputWidth()}handleMenuKeyDown(e){const{filter:t,filteredOptions:n,keyboardOptionIndex:s}=this.state,{options:i}=this.props,o=t?n:i;switch(e.key){case"Enter":o[s]?.value!=null&&this.updateInputValue(o[s].value),this.closeMenu(),this.input.current?.focus(),e.stopPropagation(),e.preventDefault();break;case"ArrowUp":this.handleMenuNavigation(Ti.MENU_NAVIGATION_DIRECTION.UP),e.stopPropagation(),e.preventDefault();break;case"ArrowDown":this.handleMenuNavigation(Ti.MENU_NAVIGATION_DIRECTION.DOWN),e.stopPropagation(),e.preventDefault();break;case"Escape":t!==""?(this.setState({filter:""}),e.stopPropagation()):this.closeMenu();break;case"Tab":!e.shiftKey&&s===o.length-1&&this.closeMenu();break}}handleMenuNavigation(e){const{filter:t,filteredOptions:n,keyboardOptionIndex:s}=this.state,{options:i}=this.props,a=(t?n:i).length;let r=0;switch(e){case Ti.MENU_NAVIGATION_DIRECTION.UP:r=-1;break;case Ti.MENU_NAVIGATION_DIRECTION.DOWN:r=1;break}r!==0&&this.setState({keyboardOptionIndex:(s+r+a)%a})}handleInputKeyDown(e){const{onEnter:t}=this.props,{menuIsOpen:n}=this.state;e.key==="ArrowDown"||e.key==="ArrowUp"?n||this.openMenu():e.key==="Enter"&&t()}handleInputChange(e){this.updateInputValue(e.target.value)}handleOptionClick(e){const t=Number(e.currentTarget.value),{filter:n,filteredOptions:s}=this.state,{options:i}=this.props,o=n?s:i;this.updateInputValue(o[t].value),this.closeMenu(),this.input.current?.focus()}handleOptionFocus(e){this.setState({keyboardOptionIndex:Number(e.target.value)})}handleFilterChange(e){const{options:t}=this.props,n=e.target.value,s=this.getCachedFilteredOptions(t,n);this.setState({filter:n,filteredOptions:s,keyboardOptionIndex:0}),this.popper.current?.scheduleUpdate()}handleMenuBlur(e){e.relatedTarget instanceof Element&&this.popper.current!=null&&this.popper.current.element.contains(e.relatedTarget)||e.relatedTarget===this.toggleButton.current||this.closeMenu(!1)}handleInputBlur(e){const{menuIsOpen:t}=this.state;t&&e.relatedTarget instanceof Element&&this.popper.current!=null&&this.popper.current.element.contains(e.relatedTarget)||this.closeMenu(!1)}handleMenuOpened(){this.scrollOptionIntoView(),this.searchInput.current?.focus()}handleMenuExited(){const{menuIsOpen:e}=this.state;e&&(this.setState({menuIsOpen:!1}),this.popper.current?.hide()),this.setState({filter:""})}toggleMenu(e){const{menuIsOpen:t}=this.state;t?this.closeMenu():this.openMenu(),e.stopPropagation()}openMenu(){this.updateKeyboardIndex(),this.setInputWidth(),this.setState({menuIsOpen:!0}),window.requestAnimationFrame(()=>{this.popper.current?.show()})}closeMenu(e=!0){this.setState({menuIsOpen:!1}),e&&this.input.current?.focus(),this.popper.current?.hide()}updateKeyboardIndex(){const{value:e,filter:t,filteredOptions:n}=this.state,{options:s}=this.props,o=(t?n:s).findIndex(a=>a.value===e);this.setState({keyboardOptionIndex:o})}scrollOptionIntoView(){const e=this.menuContainer.current?.querySelector(".cb-option-btn.keyboard-active");e instanceof HTMLElement&&e.scrollIntoView({block:"nearest",inline:"nearest"})}renderMenuElement(){const{searchPlaceholder:e}=this.props,{filter:t,inputWidth:n}=this.state;return l.jsxs("div",{className:"cb-menu-container",ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,onClick:s=>{s.stopPropagation()},style:{width:n},onBlur:this.handleMenuBlur,children:[l.jsx("div",{className:"cb-search-input-container",children:l.jsx(As,{value:t,ref:this.searchInput,onChange:this.handleFilterChange,className:"cb-search-input",placeholder:e})}),l.jsx("div",{className:"cb-options-container",children:l.jsx("div",{className:"cb-options",children:this.renderOptions()})})]})}renderOptions(){const{options:e}=this.props,{keyboardOptionIndex:t,filter:n,filteredOptions:s}=this.state;return(n?s:e).map((o,a)=>{const r=`option-${a}-${o.value}`;return l.jsx("button",{type:"button",value:a,className:$("cb-option-btn",{"keyboard-active":t===a}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:o.title},r)})}render(){const{options:e,inputPlaceholder:t,disabled:n,className:s,defaultValue:i,spellCheck:o,"data-testid":a}=this.props,{value:r}=this.state;let{popperOptions:c}=this.props;return c={placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}},...c},l.jsxs("div",{className:"input-group cb-container",ref:this.cbContainer,children:[l.jsx("input",{value:r||i,className:$("form-control",s,"cb-input"),ref:this.input,onChange:this.handleInputChange,placeholder:t||(e[0]!=null?e[0].title:void 0),disabled:n,onBlur:this.handleInputBlur,onKeyDown:this.handleInputKeyDown,spellCheck:o,"data-testid":a!==void 0?`${a}-input`:void 0}),l.jsx("div",{className:"input-group-append cb-dropdown",children:l.jsxs("button",{type:"button",className:"btn cb-btn form-control",ref:this.toggleButton,onClick:this.toggleMenu,onKeyDown:this.handleInputKeyDown,disabled:n,"data-testid":a!==void 0?`${a}-btn`:void 0,children:[l.jsx(J,{icon:kn}),l.jsx(ri,{ref:this.popper,options:c,className:$("combobox interactive"),onEntered:this.handleMenuOpened,onExited:this.handleMenuExited,children:this.renderMenuElement()})]})})]})}}const Bh=Ti;function ar({copy:d,kind:e="ghost",tooltip:t="Copy",className:n,"data-testid":s,children:i}){const[o,a]=hf();return l.jsx(V,{kind:e,className:n,"data-testid":s,icon:o?Tp:Ep,tooltip:o?"Copied":t,onClick:()=>{a(typeof d=="function"?d():d)},children:i})}const hn=Z.module("MaskedInput"),fi={FORWARD:"forward",BACKWARD:"backward",NONE:"none"},Jo=" ";function Vh(d,e,t){return d.substring(0,e)+t+d.substring(e+1)}function mf(d,e,t){return d.length<t?`${d}${e.substring(d.length,t)}`:d}function Kd(d,e){let{length:t}=d;for(let n=d.length-1;n>=0&&e[n]===d[n];n-=1)t=n;return d.substring(0,t)}const Uh=X.forwardRef((d,e)=>{const{className:t,example:n,getNextSegmentValue:s=(O,k,L)=>L,getPreferredReplacementString:i=Vh,onChange:o=()=>!1,onSelect:a=()=>!1,pattern:r,placeholder:c,selection:h,value:u,onFocus:m=()=>!1,onBlur:p=()=>!1,"data-testid":g}=d,C=jh(e),f=b.useMemo(()=>Array.isArray(n)?n:[n],[n]),S=b.useMemo(()=>f[0].replace(/[a-zA-Z0-9]/g,Jo),[f]);b.useEffect(function(){if(h!=null){hn.debug("setting selection...",h);const{selectionStart:k,selectionEnd:L,selectionDirection:A}=h;C.current?.setSelectionRange(k,L,A),hn.debug("selection set!")}},[h,C]);const v=b.useCallback(O=>{let k=O,L=O;const A=f.length>0?f[0]:u;for(let j=k-1;j>=0&&/[a-zA-Z0-9]/g.test(A.charAt(j));j-=1)k=j;for(let j=L;j<A.length&&/[a-zA-Z0-9]/g.test(A.charAt(j));j+=1)L=j+1;const U=k===L?fi.NONE:fi.BACKWARD;return{selectionStart:k,selectionEnd:L,selectionDirection:U}},[f,u]);function w(O,k,L=O.length){let A="";for(let U=0;U<L;U+=1)O.charAt(U)!==Jo?A=A.concat(O[U]):A=A.concat(k[U]);return A=A.concat(k.substring(L)),A}function T(O,k=O.length){const L=new RegExp(`^${r}$`);if(L.test(O))return!0;for(let A=0;A<f.length;A+=1){const U=w(O,f[A],k);if(L.test(U))return!0}return!1}function y(O){const k=v(O),L=k.selectionEnd+1;return L>=u.length?k:v(L)}function E(O){const k=v(O),L=k.selectionStart-1;return L<=0?k:v(L)}function I(O,k){const L=v(O),A=u.substring(L.selectionStart,L.selectionEnd),U=s(L,k,A,u),j=u.substring(0,L.selectionStart)+U+u.substring(L.selectionEnd);T(j,L.selectionEnd)&&(o(j),a(L))}const F=b.useCallback(O=>{const{selectionStart:k=0,selectionEnd:L=0,selectionDirection:A="none"}=O.target;if(k===null||L===null||A===null){hn.error("Selection attempted on non-text input element",O.target);return}if(hn.debug2("handleSelect",k,L,A),!(h!=null&&k===h.selectionStart&&L===h.selectionEnd)){if(h!=null&&k===u.length&&L===u.length&&O.nativeEvent.type!=="mouseup"){a({...h});return}if(k===L){const U=v(k);hn.debug("Selection segment from ",k,L,"=>",U),a(U)}else a({selectionStart:k,selectionEnd:L,selectionDirection:A})}},[v,a,h,u]),N=b.useCallback(O=>{if(!C.current)return;hn.debug("handleSelectCapture",O);const k=C.current.selectionStart??0;k===u.length&&h!=null&&k!==h.selectionStart&&(O.preventDefault(),O.stopPropagation())},[C,h,u]);function H(O){if(O.preventDefault(),O.stopPropagation(),!C.current)return;const{key:k}=O,{selectionStart:L=0,selectionEnd:A=0}=C.current;if(L===null||A===null){hn.error("Selection arrow nvaigation attempted on non-text input element",O.target);return}k==="ArrowLeft"?a(E(L)):k==="ArrowRight"?a(y(A)):k==="ArrowUp"?I(L,-1):k==="ArrowDown"&&I(L,1)}function P(O){if(!C.current)return;hn.debug("handleKeyDown",O);const{key:k}=O,{selectionStart:L=0,selectionEnd:A=0}=C.current;if(L===null||A===null){hn.error("Selection key event on non-text input element",O.target);return}if(k.startsWith("Arrow")){H(O);return}if(k==="Delete"||k==="Backspace"){if(O.preventDefault(),O.stopPropagation(),A>=Kd(u,S).length){const j=u.substring(0,L===A?L-1:L),W=Kd(j,S);W!==u&&(o(W),a({selectionStart:W.length,selectionEnd:W.length,selectionDirection:fi.NONE}));return}if(L!==A){const j=u.substring(0,L)+u.substring(L,A).replace(/[a-zA-Z0-9]/g,Jo)+u.substring(A);hn.debug("Range ",L,A,"deleted, setting value",j),o(j),a({selectionStart:L,selectionEnd:L,selectionDirection:fi.NONE})}else if(L>0)for(let j=L-1;j>=0;j-=1){const W=u.substring(0,j)+u.substring(j,L).replace(/[a-zA-Z0-9]/g,Jo)+u.substring(L);if(W!==u){o(W),a({selectionStart:j,selectionEnd:j,selectionDirection:fi.NONE});return}}return}if(O.altKey||O.metaKey||O.ctrlKey||k.length>1)return;O.preventDefault(),O.stopPropagation();const U=Array.from(new Set([k,k.toUpperCase(),k.toLowerCase()]));for(let j=0;j<U.length;j+=1){const W=U[j],ie=/[a-zA-Z0-9]/g.test(W)?f[0].length-1:L;for(let se=L;se<=ie;se+=1){const G=mf(u,f[0],se+1),K=i(G,se,W,L,A);if(T(K,se+1)){const te=v(se),oe=se+1;let de={selectionStart:oe,selectionEnd:oe,selectionDirection:fi.NONE};if(oe>=te.selectionEnd){const ee=y(se);ee.selectionStart!==te.selectionStart&&(de=ee)}hn.debug("handleKeyDown",k,"=>",K,de),o(K),a(de);return}}}}return l.jsx("input",{ref:C,className:$("form-control masked-input",t),type:"text",pattern:r,placeholder:c,value:u,onChange:()=>{},onKeyDown:P,onSelect:F,onSelectCapture:N,onFocus:m,onBlur:p,"data-testid":g})});Uh.defaultProps={className:"",placeholder:void 0,onChange(){},onSelect(){},getNextSegmentValue:(d,e,t)=>t,getPreferredReplacementString:Vh,selection:void 0,onFocus(){},onBlur(){},"data-testid":void 0};const pf=Uh;let gf=class extends b.PureComponent{static defaultProps={closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0};constructor(e){super(e),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMenuItemClick=this.handleMenuItemClick.bind(this),this.handleMenuItemMouseMove=this.handleMenuItemMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.container=X.createRef(),this.oldFocus=document.activeElement,this.rAF=0;const{options:t}=e,n=t.initialKeyboardIndex??-1;this.state={menuItems:[],keyboardIndex:n,mouseIndex:-1}}componentDidMount(){this.initMenu(),this.rAF=window.requestAnimationFrame(()=>{this.container.current?.focus();const{onMenuOpened:e}=this.props;e(this)})}componentDidUpdate(e){const{actions:t}=this.props;e.actions!==t&&this.initMenu()}componentWillUnmount(){cancelAnimationFrame(this.rAF)}container;oldFocus;rAF;getKeyboardIndex(){const{options:e}=this.props;if(e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse){const{keyboardIndex:t}=this.state;return t}return this.getMouseIndex()}setKeyboardIndex(e){const{options:t}=this.props;t.separateKeyboardMouse!==void 0&&t.separateKeyboardMouse?this.setState({keyboardIndex:e}):this.setMouseIndex(e)}getMouseIndex(){const{mouseIndex:e}=this.state;return e}setMouseIndex(e){this.setState({mouseIndex:e})}initMenu(){cancelAnimationFrame(this.rAF),this.setState({menuItems:[]});const{actions:e}=this.props,t=He.getMenuItems(e,!1);t.length>0&&this.setState(n=>({menuItems:He.sortActions(n.menuItems.concat(t))}))}handleKeyDown(e){const{menuItems:t}=this.state,n=this.getKeyboardIndex();let s=n;if(e.key==="Enter"||e.key===" "){n!=null&&n>=0&&n<t.length&&this.handleMenuItemClick(t[n],e);return}e.key==="Escape"?s=null:e.key==="ArrowUp"||e.key==="Tab"&&e.shiftKey===!0?s=He.getNextMenuItem(s??0,-1,t):(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1)&&(s=He.getNextMenuItem(s??0,1,t)),n!==s&&(s!==null?this.setKeyboardIndex(s):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}closeMenu(e=!1){const{closeMenu:t,onMenuClosed:n}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t(e),n(this)})}handleCloseMenu(){this.closeMenu()}handleMenuItemClick(e,t){t.preventDefault(),t.stopPropagation(),e!=null&&(e.disabled===void 0||!e.disabled)&&e.action!=null&&(e.action(),this.closeMenu(!0))}handleMenuItemMouseMove(e){const{menuItems:t}=this.state,n=t.indexOf(e);this.setMouseIndex(n)}handleMouseLeave(){this.setMouseIndex(-1)}render(){const e=[],{"data-testid":t}=this.props,{keyboardIndex:n,menuItems:s,mouseIndex:i}=this.state;for(let a=0;a<s.length;a+=1){const r=s[a];a>0&&r.group!==s[a-1].group&&e.push(l.jsx("hr",{},`${a}.separator`));const c=l.jsx(Lh,{isKeyboardSelected:n===a,isMouseSelected:i===a,menuItem:r,closeMenu:this.handleCloseMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:()=>!1},a);e.push(c)}const{menuStyle:o}=this.props;return l.jsx("div",{className:"context-menu-container",style:{...o},ref:this.container,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,role:"menuitem",tabIndex:0,"data-testid":t,children:e})}};const ff=gf;class Cf extends b.PureComponent{static defaultProps={isShown:null,onMenuClosed(){},onMenuOpened(){},options:{},popperOptions:{},popperClassName:"",menuStyle:{},"data-testid":void 0};constructor(e){super(e),this.handleClick=this.handleClick.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.handleExited=this.handleExited.bind(this),this.container=X.createRef(),this.parent=null,this.popper=X.createRef(),this.isOpen=!1}componentDidMount(){const{isShown:e}=this.props;e===null?this.container.current?.parentElement&&(this.parent=this.container.current.parentElement,this.parent.addEventListener("click",this.handleClick)):e&&this.openMenu()}componentDidUpdate(e){const{isShown:t}=this.props;e.isShown!==t&&(t!==null&&t?window.requestAnimationFrame(()=>{this.openMenu()}):this.closeMenu())}componentWillUnmount(){this.parent&&this.parent.removeEventListener("click",this.handleClick)}container;parent;popper;isOpen;closeMenu(){this.popper.current?.hide()}openMenu(){this.popper.current&&!this.isOpen&&(this.popper.current.show(),this.isOpen=!0)}scheduleUpdate(){this.popper.current?.scheduleUpdate()}handleClick(e){e.preventDefault(),e.stopPropagation(),this.openMenu()}handleCloseMenu(){this.closeMenu()}handleExited(){this.isOpen=!1;const{onMenuClosed:e}=this.props;e()}render(){const{actions:e,onMenuOpened:t,popperClassName:n,"data-testid":s}=this.props,{menuStyle:i}=this.props;let{options:o,popperOptions:a}=this.props;return a={placement:"bottom",...a},o={separateKeyboardMouse:!0,...o},l.jsx("div",{className:"menu-actions-listener",ref:this.container,"data-testid":s,children:l.jsx(ri,{ref:this.popper,options:a,className:$("menu-popper",n),onExited:this.handleExited,closeOnBlur:!0,interactive:!0,children:l.jsx(ff,{actions:e,closeMenu:this.handleCloseMenu,onMenuOpened:t,options:o,menuStyle:i})})})}}const Zn=Cf;function Ci(d,e,t,n,s){const i=n-t+1;return`${((parseInt(e,10)-d-t)%i+i)%i+t}`.padStart(s,"0")}function Sf(d,e,t){const{selectionStart:n}=d;return n===0?Ci(e,t,1900,2099,4):n===5?Ci(e,t,1,12,2):n===8?Ci(e,t,1,31,2):n===11?Ci(e,t,0,23,2):n===17||n===14?Ci(e,t,0,59,2):n===20||n===24||n===28?Ci(e,t,0,999,3):t}const bf=Z.module("DateTimeInput"),wf="[12][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])",vf="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]\\.[0-9]{3}[0-9]{3}[0-9]{3}",Tf=`${wf} ${vf}`,ba="2022-01-01",$h=`${ba} 00:00:00.000000000`,Ef="YYYY-MM-DD HH:MM:SS.SSSSSSSSS";function qd(d){return d!=null&&d.length>=ba.length?`${d.substring(0,ba.length)}${d.substring(ba.length).replace(/\u2007/g,"0")}${$h.substring(d.length)}`:d}function al(d){const e=d.substring(0,23),t=d.substring(23,26),n=d.substring(26);return[e,t,n].filter(s=>s!=="").join("")}const Yd=d=>d.replace(/\u200B/g,""),yf=[al($h)],Ll=X.forwardRef((d,e)=>{const{className:t="",onChange:n=()=>{},defaultValue:s="",onFocus:i=()=>{},onBlur:o=()=>{},"data-testid":a}=d,[r,c]=b.useState(s.length>0?al(s):""),[h,u]=b.useState(),m=b.useCallback(g=>{bf.debug("handleChange",g),c(g),n(qd(Yd(g)))},[n]),p=b.useCallback(()=>{const g=Yd(r),C=qd(g);C!==g&&c(al(C)),o()},[r,o]);return l.jsx("div",{className:"d-flex flex-row align-items-center",children:l.jsx(pf,{ref:e,className:$(t),example:yf,getNextSegmentValue:Sf,onChange:m,onSelect:u,pattern:Tf,placeholder:Ef,selection:h,value:r,onFocus:i,onBlur:p,"data-testid":a})})});Ll.displayName="DateTimeInput";Ll.defaultProps={className:"",onChange:()=>{},defaultValue:"",onFocus:()=>{},onBlur:()=>{},"data-testid":void 0};const xf=Ll;class Rf extends b.PureComponent{static defaultProps={placeholder:"Search",className:"",matchCount:null,debounceMs:250,id:"","data-testid":void 0};constructor(e){super(e),this.searchInput=X.createRef(),this.handleChange=this.handleChange.bind(this),this.sendUpdate=Ye(this.sendUpdate.bind(this),e.debounceMs),this.state={value:e.value}}componentDidUpdate(e){const{value:t}=this.props;e.value!==t&&this.setState({value:t})}searchInput;focus(){this.searchInput.current?.focus()}handleChange(e){this.setState({value:e.target.value},this.sendUpdate)}sendUpdate(){const{onChange:e}=this.props,{value:t}=this.state;e(t)}render(){const{placeholder:e,className:t,matchCount:n,id:s,"data-testid":i}=this.props,{value:o}=this.state;return l.jsx(As,{value:o,placeholder:e,onChange:this.handleChange,className:t,matchCount:n,ref:this.searchInput,id:s,"data-testid":i})}}const If=Rf;const Df=Z.module("ItemListItem");class Pl extends b.Component{static defaultProps={children:null,isDraggable:!1,isFocused:!1,isSelected:!1,itemIndex:0,"data-testid":void 0,onBlur(){},onClick(){},onContextMenu(){},onDragStart(){},onDrag(){},onDragOver(){},onDragEnd(){},onDrop(){},onDoubleClick(){},onFocus(){},onMouseDown(){},onMouseMove(){},onMouseUp(){},style:{}};static handleKeyDown(){return Df.log("ItemListItem.handleKeyDown false"),!1}constructor(e){super(e),this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleClick=this.handleClick.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleDragStart=this.handleDragStart.bind(this),this.handleDrag=this.handleDrag.bind(this),this.handleDragOver=this.handleDragOver.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleDrop=this.handleDrop.bind(this),this.handleDoubleClick=this.handleDoubleClick.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.itemRef=X.createRef()}itemRef;handleBlur(e){const{itemIndex:t,onBlur:n}=this.props;n(t,e)}handleFocus(e){const{itemIndex:t,onFocus:n}=this.props;n(t,e)}handleClick(e){const{itemIndex:t,onClick:n}=this.props;n(t,e)}handleContextMenu(e){const{itemIndex:t,onContextMenu:n}=this.props;n(t,e)}handleDragStart(e){const{itemIndex:t,onDragStart:n}=this.props;n(t,e)}handleDrag(e){const{itemIndex:t,onDrag:n}=this.props;n(t,e)}handleDragOver(e){e.preventDefault();const{itemIndex:t,onDragOver:n}=this.props;n(t,e)}handleDragEnd(e){const{itemIndex:t,onDragEnd:n}=this.props;n(t,e)}handleDrop(e){const{itemIndex:t,onDrop:n}=this.props;n(t,e)}handleDoubleClick(e){const{itemIndex:t,onDoubleClick:n}=this.props;n(t,e)}handleMouseMove(e){const{itemIndex:t,onMouseMove:n}=this.props;n(t,e)}handleMouseDown(e){const{itemIndex:t,onMouseDown:n}=this.props;n(t,e)}handleMouseUp(e){const{itemIndex:t,onMouseUp:n}=this.props;n(t,e)}render(){const{isDraggable:e,isFocused:t,isSelected:n,style:s,children:i,"data-testid":o}=this.props;return l.jsx("div",{className:$("item-list-item",{active:n},{"is-focused":t},{"is-draggable":e}),onKeyDown:Pl.handleKeyDown,onContextMenuCapture:this.handleContextMenu,onClick:this.handleClick,onDrag:this.handleDrag,onDragStart:this.handleDragStart,onDragOver:this.handleDragOver,onDragEnd:this.handleDragEnd,onDrop:this.handleDrop,onDoubleClick:this.handleDoubleClick,onMouseDown:this.handleMouseDown,onMouseMove:this.handleMouseMove,onMouseUp:this.handleMouseUp,tabIndex:-1,ref:this.itemRef,role:"listitem",style:s,onFocus:this.handleFocus,onBlur:this.handleBlur,draggable:e,"data-testid":o,children:i})}}const Ff=Pl;const Xd=Z.module("ItemList"),Zd=5;class Ht extends b.PureComponent{static CACHE_SIZE=1e3;static DEFAULT_ROW_HEIGHT=20;static DEFAULT_OVERSCAN=10;static defaultProps={offset:0,items:[],rowHeight:Ht.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!1,isDragSelect:!0,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},overscanCount:Ht.DEFAULT_OVERSCAN,renderItem:Ht.renderItem,selectedRanges:[],focusSelector:".item-list-item","data-testid":void 0};static renderItem({item:e}){return l.jsx("div",{className:"item-list-item-content",children:e!=null&&(e.displayValue??e.value??`${e}`)})}constructor(e){super(e),this.handleItemBlur=this.handleItemBlur.bind(this),this.handleItemContextMenu=this.handleItemContextMenu.bind(this),this.handleItemFocus=this.handleItemFocus.bind(this),this.handleItemDoubleClick=this.handleItemDoubleClick.bind(this),this.handleItemMouseDown=this.handleItemMouseDown.bind(this),this.handleItemMouseMove=this.handleItemMouseMove.bind(this),this.handleItemMouseUp=this.handleItemMouseUp.bind(this),this.handleItemsRendered=this.handleItemsRendered.bind(this),this.handleWindowMouseUp=this.handleWindowMouseUp.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleScroll=this.handleScroll.bind(this),this.handleResize=this.handleResize.bind(this),this.renderInnerElement=this.renderInnerElement.bind(this),this.list=X.createRef(),this.listContainer=X.createRef();const{isStickyBottom:t,selectedRanges:n}=e;this.state={focusIndex:null,mouseDownIndex:null,selectedRanges:n,overscanStartIndex:0,height:null,isDragging:!1,isStuckToBottom:t,scrollOffset:null,mouseX:null,mouseY:null}}componentDidUpdate(e,t){const{selectedRanges:n,itemCount:s}=this.props,{focusIndex:i,isStuckToBottom:o,scrollOffset:a,height:r,selectedRanges:c}=this.state;if(o&&!this.isListAtBottom()&&s>0&&this.scrollToBottom(),(a!==t.scrollOffset||r!==t.height)&&this.sendViewportUpdate(),n!==e.selectedRanges&&n!==c)this.setSelectedRanges(n);else if(c!==t.selectedRanges){const{onSelectionChange:h}=this.props;h(c)}if(i!==t.focusIndex){const{onFocusChange:h}=this.props;h(i)}}componentWillUnmount(){window.removeEventListener("mouseup",this.handleWindowMouseUp)}list;listContainer;getItemSelected=pe((e,t)=>ln.isSelected(t,e),{max:Ht.CACHE_SIZE});getCachedItem=pe((e,t,n,s,i,o,a,r)=>{const c=o({item:n,itemIndex:e,isFocused:s,isSelected:i,style:a});return l.jsx(Ff,{onContextMenu:this.handleItemContextMenu,onDoubleClick:this.handleItemDoubleClick,onMouseDown:this.handleItemMouseDown,onFocus:this.handleItemFocus,onBlur:this.handleItemBlur,disableSelect:r,onMouseMove:this.handleItemMouseMove,onMouseUp:this.handleItemMouseUp,isFocused:s,isSelected:i,itemIndex:e,style:a,children:c},t)},{max:Ht.CACHE_SIZE});getOuterElement=pe(e=>{const t=X.forwardRef((n,s)=>l.jsx("div",{ref:s,tabIndex:-1,onKeyDown:e,role:"presentation",...n}));return t.displayName="ItemListOuterElement",t});getInnerElement=pe(()=>{const e=X.forwardRef((t,n)=>l.jsx("div",{className:"item-list-inner-element",ref:n,...t}));return e.displayName="ItemListInnerElement",e});getItemData=pe((e,t,n)=>({items:e,selectedRanges:t,renderItem:n}));focus(){this.listContainer.current?.focus()}restoreScrollPosition(){const{scrollOffset:e}=this.state;e!=null&&this.listContainer.current?.scrollTo(0,e)}getElement(e){if(this.listContainer.current==null)return null;const{focusSelector:t}=this.props,{overscanStartIndex:n}=this.state,s=this.listContainer.current.querySelectorAll(t),i=e-n;return s[i]}focusItem(e){const{disableSelect:t}=this.props;if(t)return;this.setState({focusIndex:e});const n=this.getElement(e);n instanceof HTMLElement&&n.focus()}scrollToItem(e){const t=this.getElement(e);t?.scrollIntoView({block:"center"})}handleItemContextMenu(e,t){const{selectedRanges:n}=this.state,i=ln.isSelected(n,e)||He.isModifierKeyDown(t);this.toggleSelect(e,t.shiftKey,i,!1)}handleItemDoubleClick(e,t){const{isDoubleClickSelect:n,onSelect:s}=this.props;n&&this.setState(({selectedRanges:i})=>({selectedRanges:ln.selectRange(i,[e,e])}),()=>{s(e,t)})}handleItemMouseDown(e,t){const{selectedRanges:n}=this.state;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(t.button===2&&n.length===0){this.focusItem(e),this.selectItem(e);return}t.button!=null&&t.button!==0||(this.setState({mouseDownIndex:e,mouseX:t.clientX,mouseY:t.clientY}),window.addEventListener("mouseup",this.handleWindowMouseUp))}}handleItemBlur(e,t){Xd.debug2("item blur",e,t.currentTarget,t.relatedTarget),(!t.relatedTarget||this.listContainer.current&&t.relatedTarget instanceof HTMLElement&&!this.listContainer.current.contains(t.relatedTarget))&&this.setState({focusIndex:null})}handleItemFocus(e,t){Xd.debug2("item focus",e,t.target),this.setState(n=>{const{focusIndex:s}=n;return s!==e?{focusIndex:e}:null})}handleItemMouseMove(e,t){const{isDragSelect:n,isMultiSelect:s,disableSelect:i}=this.props,{mouseDownIndex:o,selectedRanges:a,mouseX:r,mouseY:c}=this.state;if(o==null||i)return;const h=Math.abs(t.clientX-(r??0)),u=Math.abs(t.clientY-(c??0));h>Zd&&u>Zd&&this.setState({isDragging:!0}),(n||o===e)&&(this.focusItem(e),s?(!n&&!this.getItemSelected(e,a)&&!He.isModifierKeyDown(t)&&this.deselectAll(),this.selectRange([Math.min(o,e),Math.max(o,e)])):this.toggleSelect(e,t.shiftKey,He.isModifierKeyDown(t),!1))}handleItemMouseUp(e,t){const{isDeselectOnClick:n,isDoubleClickSelect:s,onSelect:i}=this.props,{mouseDownIndex:o,isDragging:a}=this.state;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(o===e&&!a){const r=t.shiftKey,c=He.isModifierKeyDown(t);this.focusItem(e),this.toggleSelect(e,r,c,n),!s&&!r&&!c&&i(e,t)}this.resetMouseState()}}handleItemsRendered({overscanStartIndex:e}){this.setState({overscanStartIndex:e})}handleResize({height:e}){this.setState({height:e})}handleMouseLeave(){this.setState({mouseDownIndex:null})}handleWindowMouseUp(){this.resetMouseState(),window.removeEventListener("mouseup",this.handleWindowMouseUp)}handleKeyDown(e){const{isMultiSelect:t,itemCount:n,onSelect:s}=this.props,{focusIndex:i}=this.state;let o=i;if(e.key==="Enter"||e.key===" "){!t&&o!=null&&this.setState({selectedRanges:[[o,o]]},()=>{o!=null&&s(o,e)});return}if(e.key==="ArrowUp")o!=null&&o>=0?o=Math.max(0,o-1):o=n-1;else if(e.key==="ArrowDown")o!=null&&o>=0?o=Math.min(o+1,n-1):o=0;else return;if(i!==o){e.stopPropagation(),e.preventDefault(),this.focusItem(o);const{selectedRanges:a}=this.state;if(e.shiftKey&&a.length>0){const r=a[a.length-1];this.selectRange([Math.min(o,r[0]),Math.max(o,r[1])])}else this.deselectAll(),o!==null?this.selectItem(o):this.listContainer.current?.focus();this.scrollIntoView(o)}}handleScroll({scrollUpdateWasRequested:e,scrollOffset:t}){this.setState(n=>{if(e)return{scrollOffset:t};const{isStickyBottom:s}=this.props,{height:i}=n;return{isStuckToBottom:s&&this.isListAtBottom({scrollOffset:t,height:i}),scrollOffset:t}})}resetMouseState(){this.setState({mouseDownIndex:null,isDragging:!1})}scrollToBottom(){const{itemCount:e}=this.props;this.list.current&&this.list.current.scrollToItem(e)}scrollIntoView(e){this.list.current&&this.list.current.scrollToItem(e)}toggleSelect(e,t,n,s=!0){const{isMultiSelect:i}=this.props,{selectedRanges:o}=this.state;if(i&&t&&o.length>0){const a=o[o.length-1];this.selectRange([Math.min(a[0],e),Math.max(e,a[1])])}else i&&o.length===1&&o[0][0]===e&&o[0][1]===e?s&&this.deselectItem(e):i&&n?this.getItemSelected(e,o)?s&&this.deselectItem(e):this.selectItem(e):(this.deselectAll(),this.selectItem(e))}deselectAll(){const{itemCount:e}=this.props;this.deselectRange([0,e])}deselectItem(e){this.deselectRange([e,e])}deselectRange(e){ln.validateRange(e),this.setState(({selectedRanges:t})=>({selectedRanges:ln.deselectRange(t,e)}))}selectItem(e){const{disableSelect:t}=this.props;t||this.selectRange([e,e])}selectRange(e){ln.validateRange(e),this.setState(({selectedRanges:t})=>({selectedRanges:ln.selectRange(t,e)}))}setSelectedRanges(e){this.setState({selectedRanges:e})}sendViewportUpdate(){const{scrollOffset:e,height:t}=this.state;if(e!=null&&t!=null){const{onViewportChange:n,rowHeight:s}=this.props,i=Math.floor(e/s),o=i+Math.ceil(t/s);n(i,o)}}isListAtBottom({scrollOffset:e,height:t}=this.state){if(t==null||e==null)return!1;const{itemCount:n,rowHeight:s}=this.props;return e+t>=n*s}renderInnerElement({index:e,style:t}){const{items:n,offset:s,renderItem:i,disableSelect:o}=this.props,{focusIndex:a,selectedRanges:r}=this.state;if(e<s||e>=s+n.length)return null;const c=n[e-s];return this.getCachedItem(e,e,c,e===a&&!o,this.getItemSelected(e,r),i,t,o)}render(){const{items:e,itemCount:t,overscanCount:n,renderItem:s,rowHeight:i,"data-testid":o}=this.props,{selectedRanges:a,isStuckToBottom:r}=this.state;return l.jsx(_m,{className:"item-list-auto-sizer",onResize:this.handleResize,children:({width:c,height:h})=>l.jsx(jm,{className:"item-list-scroll-pane",height:h,width:c,initialScrollOffset:r?t*i:0,itemCount:t,itemSize:i,itemData:this.getItemData(e,a,s),onScroll:this.handleScroll,onItemsRendered:this.handleItemsRendered,ref:this.list,outerElementType:this.getOuterElement(this.handleKeyDown),outerRef:this.listContainer,innerElementType:this.getInnerElement(),overscanCount:n,"data-testid":o,children:this.renderInnerElement})})}}class bs extends b.PureComponent{static DEFAULT_ROW_HEIGHT=30;static defaultProps={className:"",draggingItemClassName:"",offset:0,items:[],rowHeight:bs.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!0,isDropDisabled:!1,isDragDisabled:!1,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,style:null,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},renderItem:bs.renderItem,selectedRanges:[],draggablePrefix:"draggable-item",droppableId:"droppable-item-list","data-testid":void 0};static renderHandle(){return l.jsxs("div",{children:[l.jsx(tt,{children:"Drag to re-order"}),l.jsx(J,{icon:Mo})]})}static renderBadge({text:e}){return e!=null&&e.length>0?l.jsx("span",{className:"number-badge",children:e}):null}static renderTextItem({text:e,badgeText:t="",className:n=""}){return l.jsxs("div",{className:$("item-list-item-content","draggable-item-list-item-content",n),children:[l.jsx("span",{className:"title",children:e}),bs.renderBadge({text:t}),bs.renderHandle()]})}static renderItem({item:e,isClone:t,selectedCount:n}){const s=e!=null?e.displayValue??e.value??`${e}`:"",i=t!==void 0&&t?`${n}`:"",o=t!==void 0&&t?"item-list-item-clone":"";return bs.renderTextItem({text:s,badgeText:i,className:o})}static getDraggableId(e,t){return`${e}/${t}`}static getDraggableIndex(e){const t=e.split("/").pop();return parseInt(t!==void 0?t:"",10)}constructor(e){super(e),this.handleSelectionChange=this.handleSelectionChange.bind(this),this.itemList=X.createRef(),this.state={selectedCount:0}}itemList;selectItem(e){this.itemList.current?.selectItem(e)}focusItem(e){this.itemList.current?.focusItem(e)}scrollToItem(e){this.itemList.current?.scrollToItem(e)}getCachedDraggableItem=pe((e,t,n,s,i,o,a,r)=>l.jsx(wl,{draggableId:bs.getDraggableId(e,s),index:s,isDragDisabled:a,children:c=>l.jsx("div",{role:"menuitem",className:"draggable-item-list-item",ref:c.innerRef,tabIndex:-1,...c.draggableProps,...c.dragHandleProps,children:t({item:n,itemIndex:s,isFocused:i,isSelected:o,style:r,isClone:!1})})},s),{max:Ht.CACHE_SIZE});handleSelectionChange(e){this.setState({selectedCount:ln.count(e)});const{onSelectionChange:t}=this.props;t(e)}getCachedRenderDraggableItem=pe((e,t,n)=>({item:s,itemIndex:i,isFocused:o,isSelected:a,style:r})=>this.getCachedDraggableItem(e,n,s,i,o,a,t,r),{max:1});getCachedRenderClone=pe((e,t,n,s)=>(i,o,a)=>{const{selectedCount:r}=this.state,{draggableProps:c,dragHandleProps:h,innerRef:u}=i,{index:m}=a.source,p=t[m-n];return l.jsx("div",{className:$("draggable-item-list-dragging-item-container",e),...c,...h,ref:u,children:l.jsx("div",{className:$("draggable-item-list-dragging-item",{"two-dragged":r===2},{"multiple-dragged":r>2}),children:s({item:p,itemIndex:m,isFocused:!1,isSelected:!0,style:{},isClone:!0,selectedCount:r})})})},{max:1});render(){const{className:e,draggablePrefix:t,draggingItemClassName:n,droppableId:s,isDoubleClickSelect:i,isDragDisabled:o,isDropDisabled:a,isMultiSelect:r,isStickyBottom:c,itemCount:h,items:u,offset:m,onFocusChange:p,onSelect:g,onViewportChange:C,renderItem:f,rowHeight:S,selectedRanges:v,style:w,"data-testid":T}=this.props;return l.jsx(Za,{isDropDisabled:a,droppableId:s,mode:"virtual",renderClone:this.getCachedRenderClone(n,u,m,f),"data-testid":T,children:(y,E)=>l.jsx("div",{role:"menu",className:$("draggable-item-list",e,{"is-drop-disabled":a,"is-drag-disabled":o,"is-dragging-from-this":E.draggingFromThisWith,"is-dragging-over":E.isDraggingOver,"is-dropping":E.draggingOverWith}),style:w,ref:y.innerRef,...y.droppableProps,children:l.jsx(Ht,{focusSelector:".draggable-item-list-item",isDoubleClickSelect:i,isDragSelect:!1,isMultiSelect:r,isStickyBottom:c,itemCount:h,items:u,onFocusChange:p,onSelect:g,onSelectionChange:this.handleSelectionChange,onViewportChange:C,offset:m,ref:this.itemList,renderItem:this.getCachedRenderDraggableItem(t,o,f),rowHeight:S,selectedRanges:v})})})}}const gn=bs;class Fa{static reorder(e,t,n,s){const i=e===n?Fa.adjustDestinationIndex(s,t):s,o=Fa.removeItems(e,t);return n.splice(i,0,...o),o}static removeItems(e,t){const n=[],s=t.map((i,o)=>({range:i,index:o})).sort((i,o)=>o.range[0]-i.range[0]);for(let i=0;i<s.length;i+=1){const{range:o,index:a}=s[i],[r,c]=o;n[a]=e.splice(r,c-r+1)}return Hm(n)}static adjustDestinationIndex(e,t){let n=e;for(let s=0;s<t.length;s+=1){const[i,o]=t[s];if(i>e)break;n-=Math.min(o,e-1)-i+1}return n}static startDragging(){document.documentElement.classList.add("drag-pointer-events-none")}static stopDragging(){document.documentElement.classList.remove("drag-pointer-events-none")}}const bn=Fa;function Wh({on:d,id:e,className:t,isInvalid:n,disabled:s=!1,onClick:i,"data-testid":o}){return l.jsx("button",{type:"button",className:$("btn","btn-switch",t,{active:d},{"is-invalid":n}),id:e,onClick:i,disabled:s,"data-testid":o,children:l.jsx("div",{className:"handle"})})}function Qd(d){return d.isOn!==void 0}function Nf({item:d,onSelect:e=()=>{},"data-testid":t}){const{icon:n,subtitle:s,title:i}=d,o=b.useMemo(()=>Qd(d)?()=>{d.onChange(!d.isOn)}:e,[d,e]);return l.jsxs("div",{className:"btn btn-navigation-menu-item","data-testid":`menu-item-${i}`,onClick:o,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&o()},tabIndex:0,role:"menuitem",children:[n!==void 0&&l.jsx("div",{className:"icon",children:l.jsx(J,{icon:n})}),l.jsx("div",{className:"title",children:i}),s!==void 0&&l.jsx("div",{className:"shortcut",children:s}),l.jsx("div",{className:"accessory","data-testid":t,children:Qd(d)?l.jsx(Wh,{on:d.isOn,onClick:a=>{a.stopPropagation(),o()}}):l.jsx(J,{icon:yh})})]})}function Gh({items:d,onSelect:e=()=>{},"data-testid":t}){return l.jsx("div",{className:"navigation-menu-view","data-testid":t,children:l.jsx("ul",{className:"navigation-menu-list",children:d.map((n,s)=>l.jsx("li",{children:l.jsx(Nf,{item:n,onSelect:()=>{e(s)}})},n.title))})})}function Jd({children:d,onBack:e,onClose:t,title:n,"data-testid":s}){return l.jsxs("div",{className:"navigation-page","data-testid":s,children:[l.jsxs("div",{className:"navigation-title-bar",children:[l.jsx("div",{className:"navigation-left-buttons",children:e!==void 0&&l.jsx(V,{kind:"ghost",className:"btn-back","data-testid":"btn-page-back",onClick:e,icon:yp,children:"Back"})}),l.jsx("div",{className:"navigation-title",children:n}),l.jsx("div",{className:"navigation-right-buttons",children:t!==void 0&&l.jsx(V,{kind:"ghost",className:"btn-close px-2 m-1","data-testid":"btn-page-close",onClick:t,icon:Ui,tooltip:"Close"})})]}),l.jsx("div",{className:"navigation-content",children:d})]})}function Mf({children:d,"data-testid":e}){const t=b.useMemo(()=>X.Children.toArray(d),[d]),n=ir(t),[s,i]=b.useState(t[t.length-1]),[o,a]=b.useState(null),[r,c]=b.useState(null);b.useEffect(function(){if(n===void 0||t===n)return;const p=t[t.length-1];t.length===n.length||n.length===0||o!==null||r!==null?o!==null&&p!==o?a(p):p!==r&&p!==s&&i(p):t.length>n.length?a(p):t.length<n.length&&(i(p),c(n[n.length-1]))},[t,n,o,r,s]);const h=b.useCallback(()=>{i(o),a(null)},[o]),u=b.useCallback(()=>{c(null)},[]);return l.jsxs("div",{className:"navigation-stack",children:[l.jsx("div",{className:"main-view","data-testid":e,children:s}),l.jsx(gt,{in:r!=null,timeout:We.transitionMidMs,classNames:"slide-right",onEntered:u,children:l.jsx(l.Fragment,{children:r!=null&&l.jsx("div",{className:"popping-view",children:r})})}),l.jsx(gt,{in:o!=null,timeout:We.transitionMidMs,classNames:"slide-left",onEntered:h,children:l.jsx(l.Fragment,{children:o!=null&&l.jsx("div",{className:"pushing-view",children:o})})})]})}function kf({children:d,disabled:e,value:t,"data-testid":n}){return l.jsx("option",{value:t,disabled:e,"data-testid":n,children:d})}function rr(d){const{children:e,disabled:t=!1,name:n,onChange:s,value:i="","data-testid":o}=d,[a]=b.useState(n??Pe());return l.jsx(l.Fragment,{children:X.Children.map(e,r=>r?X.cloneElement(r,{name:a,onChange:r.props.onChange??s,checked:i===r.props.value,disabled:r.props.disabled??t,"data-testid":o}):null)})}const _l=X.forwardRef((d,e)=>{const{checked:t,children:n,className:s="",disabled:i=!1,inputClassName:o="",isInvalid:a=!1,labelClassName:r="",name:c,onChange:h,value:u,"data-testid":m}=d,[p]=b.useState(Pe());return l.jsxs("div",{className:$("custom-control custom-radio",s),children:[l.jsx("input",{type:"radio",id:p,"data-testid":m,name:c,ref:e,className:$("custom-control-input",o,{"is-invalid":a}),checked:t,disabled:i,value:u,onChange:h}),l.jsx("label",{className:$("custom-control-label",r),htmlFor:p,children:n})]})});_l.displayName="RadioItem";_l.defaultProps={checked:void 0,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};const Qn=_l;function Of({children:d,onBlur:e,onChange:t,className:n,defaultValue:s,name:i,value:o,disabled:a,"data-testid":r}){const c=b.useCallback(h=>{t(h.target.value)},[t]);return l.jsx("select",{className:$("custom-select",n),onBlur:e,onChange:c,defaultValue:s,value:o,name:i,disabled:a,"data-testid":r,children:d})}class Af extends b.PureComponent{static defaultProps={disabled:!1,rowHeight:21,onBlur:()=>{},"data-testid":void 0};constructor(e){super(e),this.handleBlur=this.handleBlur.bind(this),this.handleScroll=this.handleScroll.bind(this),this.handleSelect=this.handleSelect.bind(this),this.list=X.createRef(),this.topRow=null,this.bottomRow=null}componentDidMount(){this.sendViewportUpdate()}componentDidUpdate(){this.sendViewportUpdate()}list;topRow;bottomRow;getCachedItem=pe((e,t,n,s,i,o,a)=>{const r={height:i},c=s??n;return l.jsx("li",{className:"value-list-item",style:r,tabIndex:-1,children:l.jsx(Xt,{checked:o,disabled:a,onChange:()=>this.handleSelect(e),children:c})},t)},{max:1e3});getCachedItems=pe((e,t,n,s)=>{const i=[];for(let o=0;o<e.length;o+=1){const a=e[o],{value:r,displayValue:c,isSelected:h}=a,u=n+o,m=u,p=this.getCachedItem(u,m,r,c,t,h,s);i.push(p)}return i},{max:1});handleBlur(e){if(!e.relatedTarget||this.list.current&&e.relatedTarget instanceof HTMLElement&&!this.list.current.contains(e.relatedTarget)){const{onBlur:t}=this.props;t?.(e)}}handleScroll(){this.sendViewportUpdate()}handleSelect(e){const{items:t,offset:n,onSelect:s}=this.props,i=e-n;if(i>=0&&i<t.length){const o=t[i],{value:a}=o;s(e,a)}else s(e,null)}sendViewportUpdate(){if(!this.list.current||this.list.current.clientHeight===0)return;const{onViewportChange:e,rowHeight:t}=this.props,n=this.list.current.scrollTop,s=n+this.list.current.clientHeight,i=Math.floor(n/t),o=Math.ceil(s/t);(this.topRow!==i||this.bottomRow!==o)&&(this.topRow=i,this.bottomRow=o,e(i,o))}getElement(e){return this.list.current==null?null:this.list.current.querySelectorAll(".value-list-item")[e]}scrollIntoView(e){this.getElement(e)?.scrollIntoView({block:"center"})}render(){const{className:e,disabled:t,isInvalid:n,items:s,itemCount:i,offset:o,rowHeight:a,"data-testid":r}=this.props,c=this.getCachedItems(s,a,o,t);return l.jsx("div",{className:$("select-value-list-scroll-pane h-100 w-100",{"is-invalid":n},e),onBlur:this.handleBlur,onScroll:this.handleScroll,ref:this.list,"data-testid":r,children:l.jsx("div",{className:"select-value-list",style:{height:i*a},children:l.jsx("ol",{className:"select-value-list-content",style:{position:"absolute",height:s.length*a,top:o*a,left:0},children:c})})})}}const Lf=Af,ec=Z.module("Shortcut");var ce=(d=>(d.CTRL="MODIFIER_CTRL",d.CMD="MODIFIER_CMD",d.ALT="MODIFIER_ALT",d.OPTION="MODIFIER_OPTION",d.SHIFT="MODIFIER_SHIFT",d))(ce||{}),ue=(d=>(d.A="A",d.B="B",d.C="C",d.D="D",d.E="E",d.F="F",d.G="G",d.H="H",d.I="I",d.J="J",d.K="K",d.L="L",d.M="M",d.N="N",d.O="O",d.P="P",d.Q="Q",d.R="R",d.S="S",d.T="T",d.U="U",d.V="V",d.W="W",d.X="X",d.Y="Y",d.Z="Z",d.ZERO="0",d.ONE="1",d.TWO="2",d.THREE="3",d.FOUR="4",d.FIVE="5",d.SIX="6",d.SEVEN="7",d.EIGHT="8",d.NINE="9",d.BACKSPACE="Backspace",d.ESCAPE="Escape",d.ENTER="Enter",d.DELETE="Delete",d.SLASH="/",d.QUESTION_MARK="?",d.BACKSLASH="\\",d.PIPE="|",d.MINUS="-",d.UNDERSCORE="_",d.EQUALS="=",d.PLUS="+",d.BACKTICK="`",d.TILDE="~",d.COMMA=",",d.LEFT_CHEVRON="<",d.PERIOD=".",d.RIGHT_CHEVRON=">",d.SEMICOLON=";",d.COLON=":",d.SINGLE_QUOTE="'",d.DOUBLE_QUOTE='"',d.LEFT_BRACKET="[",d.RIGHT_BRACKET="]",d.LEFT_CURLY="{",d.RIGHT_CURLY="}",d.F1="F1",d.F2="F2",d.F3="F3",d.F4="F4",d.F5="F5",d.F6="F6",d.F7="F7",d.F8="F8",d.F9="F9",d.F10="F10",d.F11="F11",d.F12="F12",d))(ue||{});const Pf=new Set(["Enter","Delete","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]);class ke extends vl{id;name;tooltip;isEditable;defaultKeyState;keyState;static NULL_KEY_STATE={metaKey:!1,shiftKey:!1,altKey:!1,ctrlKey:!1,keyValue:null};static isAllowedKey(e){return Object.values(ue).includes(e)}static isValidKeyState(e){const{keyValue:t}=e;return t===null?!0:!ke.isMacPlatform&&e.metaKey||!ke.isAllowedKey(t)?!1:!(!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey)||Pf.has(t)}static isMacPlatform=He.isMacPlatform();static createKeyState(e){const t={altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1,keyValue:e[e.length-1]};return e.forEach(n=>{switch(n){case"MODIFIER_CTRL":t.ctrlKey=!0;break;case"MODIFIER_ALT":case"MODIFIER_OPTION":t.altKey=!0;break;case"MODIFIER_CMD":t.metaKey=!0;break;case"MODIFIER_SHIFT":t.shiftKey=!0;break}}),t}static getKeyStateFromEvent(e){const{key:t,keyCode:n}=e;let s="";return t==="Shift"||t==="Meta"||t==="Control"||t==="Alt"?s="":!ke.isAllowedKey(t)&&ke.isAllowedKey(String.fromCharCode(n))?s=String.fromCharCode(n):s=t,{keyValue:s,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey}}static getWindowsDisplayText(e){let t="";return e.ctrlKey&&(t+="Ctrl+"),e.altKey&&(t+="Alt+"),e.shiftKey&&(t+="Shift+"),e.keyValue==="Escape"?t+="Esc":e.keyValue!==null&&(t+=e.keyValue),t}static getMacDisplayText(e){let t="";switch(e.ctrlKey&&(t+="⌃"),e.altKey&&(t+="⌥"),e.shiftKey&&(t+="⇧"),e.metaKey&&(t+="⌘"),e.keyValue){case"Enter":t+="⏎";break;case"Escape":t+="⎋";break;case"Backspace":t+="⌫";break;case"Delete":t+="⌦";break;case null:break;default:t+=e.keyValue}return t}static doKeyStatesMatch(e,t){return e.keyValue?.toUpperCase()===t.keyValue?.toUpperCase()&&e.altKey===t.altKey&&e.ctrlKey===t.ctrlKey&&e.metaKey===t.metaKey&&e.shiftKey===t.shiftKey}static getDisplayText(e){return e.keyValue===null?"":ke.isMacPlatform?ke.getMacDisplayText(e):ke.getWindowsDisplayText(e)}constructor({id:e,shortcut:t,macShortcut:n,isEditable:s=!0,name:i,tooltip:o}){super(),this.id=e,this.name=i,this.tooltip=o,this.isEditable=s;const r=ke.isMacPlatform?n:t;this.defaultKeyState=ke.createKeyState(r),this.keyState=this.defaultKeyState}getDisplayText(){return ke.getDisplayText(this.keyState)}getKeyState(){return this.keyState}setKeyState(e){ke.isValidKeyState(e)?(ec.debug2(`Shortcut ${this.id} updated to ${JSON.stringify(e)}`),this.keyState=e,this.dispatchEvent(new Ve("onUpdate",{detail:this}))):ec.debug2(`Shortcut ${this.id} tried to update to invalid keyState ${JSON.stringify(e)}`)}getDefaultKeyState(){return this.defaultKeyState}isDefault(){return ke.doKeyStatesMatch(this.getDefaultKeyState(),this.getKeyState())}setToNull(){this.setKeyState(ke.NULL_KEY_STATE)}isNull(){return ke.doKeyStatesMatch(this.keyState,ke.NULL_KEY_STATE)}setToDefault(){this.setKeyState(this.defaultKeyState)}matchesKeyState(e){return ke.doKeyStatesMatch(e,this.keyState)}matchesEvent(e){return this.matchesKeyState(ke.getKeyStateFromEvent(e))}}const tc=Z.module("ShortcutRegistry");class _f extends vl{shortcutMap=new Map;shortcutsByCategory=new Map;createAndAdd(e){const t=new ke(e);return this.add(t)}add(e){const t=this.shortcutMap.get(e.id);if(t)return tc.warn(`Skipping attempt to add duplicate shortcut ID to registry: ${e.id}`),t;tc.debug2(`Adding shortcut to registry: ${e.id}`),e.addEventListener("onUpdate",({detail:s})=>this.dispatchEvent(new Ve("onUpdate",{detail:s})));const n=e.id.split(".")[0];return this.shortcutMap.set(e.id,e),this.shortcutsByCategory.has(n)?this.shortcutsByCategory.get(n)?.push(e):this.shortcutsByCategory.set(n,[e]),e}get(e){return this.shortcutMap.get(e)}getConflictingShortcuts(e){return Array.from(this.shortcutMap.values()).filter(t=>!t.isNull()&&t.matchesKeyState(e))}}const jf=Object.freeze(new _f),Fe=jf,Hf={COPY:Fe.createAndAdd({id:"GLOBAL.COPY",name:"Copy",shortcut:[ce.CTRL,ue.C],macShortcut:[ce.CMD,ue.C],isEditable:!1}),PASTE:Fe.createAndAdd({id:"GLOBAL.PASTE",name:"Paste",shortcut:[ce.CTRL,ue.V],macShortcut:[ce.CMD,ue.V],isEditable:!1}),SAVE:Fe.createAndAdd({id:"GLOBAL.SAVE",name:"Save",shortcut:[ce.CTRL,ue.S],macShortcut:[ce.CMD,ue.S],isEditable:!1}),SELECT_ALL:Fe.createAndAdd({id:"GLOBAL.SELECT_ALL",name:"Select All",shortcut:[ce.CTRL,ue.A],macShortcut:[ce.CMD,ue.A],isEditable:!1}),LINKER:Fe.createAndAdd({id:"GLOBAL.LINKER",name:"Linker",shortcut:[ce.CTRL,ue.L],macShortcut:[ce.CMD,ue.L]}),LINKER_CLOSE:Fe.createAndAdd({id:"GLOBAL.LINKER_CLOSE",name:"Close Linker Overlay",shortcut:[ue.ESCAPE],macShortcut:[ue.ESCAPE],isEditable:!1})},es=Hf;const jl=X.forwardRef((d,e)=>{const{children:t,className:n,disabled:s,id:i,isLinked:o,isLinkedSource:a,isInvalid:r,onClick:c,onMouseEnter:h,onMouseLeave:u,style:m,"data-testid":p}=d;return l.jsxs("button",{ref:e,type:"button",className:$("btn-socketed",{"btn-socketed-linked":o!==void 0&&o||a},{"btn-socketed-linked-source":a},{"is-invalid":r},n),id:i,onClick:c,onMouseEnter:h,onMouseLeave:u,style:m,disabled:s,"data-testid":p,children:[t,l.jsx(J,{icon:yl,className:"linked btn-socketed-icon",transform:"down-1"}),l.jsx(J,{icon:xp,className:"is-invalid btn-socketed-icon"})]})});jl.displayName="SocketedButton";jl.defaultProps={children:void 0,className:"",disabled:!1,id:void 0,isLinked:!1,isLinkedSource:!1,isInvalid:!1,onClick:void 0,onMouseEnter:void 0,onMouseLeave:void 0,style:void 0,"data-testid":void 0};const zh=jl,{dh:x}=globalThis,Hl=D.shape({name:D.string.isRequired,type:D.string.isRequired,description:D.string,constituentType:D.string}),Bf=D.shape({not:D.func.isRequired,and:D.func.isRequired,or:D.func.isRequired});D.shape({asc:D.func.isRequired,desc:D.func.isRequired,abs:D.func.isRequired,column:Hl.isRequired,direction:D.string.isRequired,isAbs:D.bool.isRequired});D.shape({columns:D.arrayOf(Hl).isRequired,customColumns:D.arrayOf(D.string).isRequired,filter:D.arrayOf(Bf),addEventListener:D.func.isRequired,removeEventListener:D.func.isRequired,size:D.number.isRequired,sort:D.arrayOf(D.any),copy:D.func.isRequired,applyFilter:D.func.isRequired,applySort:D.func.isRequired,applyCustomColumns:D.func.isRequired,description:D.string});D.shape({columns:D.arrayOf(Hl),filter:D.arrayOf(D.any),isExpanded:D.func.isRequired,saveExpandedState:D.func.isRequired,addEventListener:D.func.isRequired,removeEventListener:D.func.isRequired,size:D.number.isRequired,sort:D.arrayOf(D.any),applyFilter:D.func.isRequired,applySort:D.func.isRequired});const Ar=D.shape({name:D.string.isRequired,type:D.string.isRequired});D.shape({created:D.arrayOf(Ar).isRequired,updated:D.arrayOf(Ar).isRequired,removed:D.arrayOf(Ar).isRequired});D.shape({groupingColumns:D.arrayOf(D.string),aggregations:D.shape({}),includeConstituents:D.bool,includeOriginalColumns:D.bool,includeDescriptions:D.bool});D.shape({addEventListener:D.func.isRequired,removeEventListener:D.func.isRequired,onLogMessage:D.func,getTable:D.func.isRequired,runCode:D.func.isRequired});function Kh({type:d}){switch(d){case x.VariableType.TABLE:case x.VariableType.TABLEMAP:case x.VariableType.TREETABLE:case x.VariableType.HIERARCHICALTABLE:return l.jsx(J,{icon:xl});case x.VariableType.FIGURE:return l.jsx(J,{icon:Rh});case x.VariableType.PANDAS:return l.jsx(J,{icon:Rp});default:return l.jsx(J,{icon:sl})}}class Vf extends b.Component{constructor(e){super(e),this.container=null}componentDidMount(){this.colorize()}container;colorize(){const{children:e}=this.props;this.container&&e!=null&&Yn.colorizeElement(this.container,{theme:"dh-dark"})}render(){const{children:e,language:t}=this.props;return l.jsx("div",{children:l.jsx("div",{"data-lang":t,ref:n=>{this.container=n},style:{pointerEvents:"none"},children:e})})}}const lr=Vf;class Uf{static get LANGUAGE_MAP(){return new Map([["python","Python"],["groovy","Groovy"],["scala","Scala"]])}}const qh=Uf;class Na{static hasComment(e){return e.comment!==void 0}static hasPattern(e){return e.pattern!==void 0}static hasOp(e){return e.op!==void 0}static parseArguments(e){return e==null||!(typeof e=="string"||e instanceof String)?[]:Bm.parse(e).filter(t=>!this.hasComment(t)).map(t=>this.hasPattern(t)?t.pattern:this.hasOp(t)?t.op:`${t}`)}static formatTimestamp(e){if(e==null||!(e instanceof Date))return null;const t=`${e.getHours()}`.padStart(2,"0"),n=`${e.getMinutes()}`.padStart(2,"0"),s=`${e.getSeconds()}`.padStart(2,"0"),i=`${e.getMilliseconds()}`.padStart(3,"0");return`${t}:${n}:${s}.${i}`}static isTableType(e){return e===x.VariableType.TABLE||e===x.VariableType.TREETABLE||e===x.VariableType.HIERARCHICALTABLE}static isWidgetType(e){return e===x.VariableType.FIGURE||e===x.VariableType.OTHERWIDGET||e===x.VariableType.PANDAS}static isOpenableType(e){return Na.isTableType(e)||Na.isWidgetType(e)}static isFigureType(e){return e===x.VariableType.FIGURE}static isPandas(e){return e===x.VariableType.PANDAS}}const rl=Na;function Yh({children:d}){return l.jsxs("div",{className:"console-history-item-result",children:[l.jsx("div",{className:"console-history-gutter",children:"-"}),l.jsx("div",{className:"console-history-content",children:d})]})}Yh.propTypes={children:D.node.isRequired};class $f extends b.Component{static defaultProps={disabled:!1};constructor(e){super(e),this.updateElapsed=this.updateElapsed.bind(this),this.startTime=Date.now(),this.state={elapsed:0}}componentDidMount(){this.timer=setInterval(this.updateElapsed,1e3)}componentWillUnmount(){this.timer&&clearInterval(this.timer),this.timer=void 0}timer;startTime;updateElapsed(){this.setState({elapsed:Math.round((Date.now()-this.startTime)/1e3)})}render(){const{disabled:e,onCancelClick:t}=this.props,{elapsed:n}=this.state;return l.jsx("div",{className:$("console-history-result-in-progress",{disabled:e}),children:l.jsxs("span",{className:"badge",children:[l.jsx(Ln,{})," Running... ",Wi.formatElapsedTime(n)," ",l.jsx(V,{className:"console-history-result-in-progress-cancel",kind:"ghost",icon:Ui,tooltip:"Cancel",onClick:t,disabled:e})]})})}}const Wf=$f;class Ma extends b.PureComponent{static defaultProps={message:""};static mouseDragThreshold=5;constructor(e){super(e),this.handleKeyPress=this.handleKeyPress.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.handleToggleError=this.handleToggleError.bind(this),this.handleMouseEnter=this.handleMouseEnter.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.mouseX=null,this.mouseY=null,this.isClicking=!1,this.state={isExpanded:!1,isTriggerHovered:!1}}mouseX;mouseY;isClicking;handleKeyPress(e){switch(e.key){case"Enter":case" ":this.handleToggleError(),e.stopPropagation(),e.preventDefault();break}}handleMouseDown(e){this.mouseX=e.clientX,this.mouseY=e.clientY,this.isClicking=!0}handleMouseMove(e){this.mouseX!=null&&this.mouseY!=null?(Math.abs(e.clientX-this.mouseX)>=Ma.mouseDragThreshold||Math.abs(e.clientY-this.mouseY)>=Ma.mouseDragThreshold)&&(this.isClicking=!1):this.isClicking&&(this.isClicking=!1)}handleMouseUp(e){this.isClicking&&!e.shiftKey&&!e.metaKey&&!e.altKey&&this.handleToggleError(),this.mouseX=null,this.mouseY=null,this.isClicking=!1}handleToggleError(){this.setState(e=>({isExpanded:!e.isExpanded}))}handleMouseEnter(){this.setState({isTriggerHovered:!0})}handleMouseLeave(){this.setState({isTriggerHovered:!1})}render(){const{isExpanded:e,isTriggerHovered:t}=this.state,{message:n}=this.props;M(n);const s=n.indexOf(`
|
|
3
3
|
`),i=s>-1;let o=n;i&&(o=n.slice(0,s));const a=n.slice(s),r=t?"error-btn-link error-btn-link--active":"error-btn-link";return l.jsxs("div",{className:$("error-message",{expanded:e}),children:[i&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"error-gutter",children:l.jsx("button",{type:"button",onClick:this.handleToggleError,className:r,tabIndex:-1,children:l.jsx(J,{icon:e?kn:Ih,transform:"left-3"})})}),l.jsxs("div",{className:"error-content",children:[l.jsx("div",{className:"console-error-text-trigger",role:"button",tabIndex:0,onKeyPress:this.handleKeyPress,onMouseDown:this.handleMouseDown,onMouseMove:this.handleMouseMove,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,onMouseUp:this.handleMouseUp,children:o}),e?a:""]})]}),!i&&l.jsx("div",{className:"error-content",children:l.jsx("div",{className:"console-error-text",children:o})})]},"error")}}const Gf=Ma;const nc=Z.module("ConsoleHistoryItem");class zf extends b.PureComponent{static defaultProps={disabled:!1};constructor(e){super(e),this.handleCancelClick=this.handleCancelClick.bind(this),this.handleObjectClick=this.handleObjectClick.bind(this)}handleObjectClick(e){nc.debug("handleObjectClick",e);const{openObject:t}=this.props;t(e)}handleCancelClick(){const{item:e}=this.props;e!=null&&e.cancelResult&&(nc.debug(`Cancelling command: ${e.command}`),e.cancelResult())}render(){const{disabled:e,item:t,language:n}=this.props,{disabledObjects:s,result:i}=t;let o=null;t.command!=null&&t.command!==""&&(o=l.jsxs("div",{className:"console-history-item-command",children:[l.jsx("div",{className:"console-history-gutter",children:">"}),l.jsx("div",{className:"console-history-content",children:l.jsx(lr,{language:n,children:t.command})})]}));const a=[];let r=!1;if(i){const{error:h,message:u,changes:m}=i;if(m){const{created:p,updated:g}=m;[...p,...g].forEach(C=>{r=!0;const{title:f}=C,S=`${f}`,v=e===void 0||e||(s??[]).indexOf(S)>=0,w=l.jsx(V,{kind:"primary",onClick:()=>this.handleObjectClick(C),className:"btn-console-object",disabled:v,icon:l.jsx(Kh,{type:C.type}),children:f},S);a.push(w)})}if(h!=null&&t.command==null){let p=`${h.message??h}`;p||(p=h);const g=l.jsx(Gf,{message:p},"result-error");a.push(g)}if(u!==void 0&&u!==""){const p=l.jsx("div",{className:"log-message",children:u},"log-message");a.push(p)}}else{r=!0;const h=l.jsx(Wf,{onCancelClick:this.handleCancelClick,disabled:e},"in_progress");a.push(h)}let c=null;return a.length>0&&(c=l.jsx(Yh,{children:a})),l.jsxs("div",{className:$("console-command-result",{"console-result-buttons":r}),children:[o,c]})}}const Kf=zf;class Bl extends b.Component{static defaultProps={disabled:!1};static itemKey(e,t){return`${e}.${t.command}.${t.result&&t.result.message}.${t.result&&t.result.error}`}render(){const{disabled:e,items:t,language:n,openObject:s}=this.props,i=[];for(let o=0;o<t.length;o+=1){const a=t[o],r=l.jsx(Kf,{disabled:e,item:a,openObject:s,language:n},Bl.itemKey(o,a));i.push(r)}return l.jsx("div",{className:"container-fluid console-history",children:i})}}const qf=Bl,Yf={name:"Console",CLEAR:Fe.createAndAdd({id:"CONSOLE.CLEAR",name:"Clear",shortcut:[ce.CTRL,ue.L],macShortcut:[ce.CTRL,ue.C]}),FOCUS_HISTORY:Fe.createAndAdd({id:"CONSOLE.FOCUS_HISTORY",name:"Focus History",shortcut:[ce.CTRL,ue.H],macShortcut:[ce.CTRL,ce.OPTION,ue.H]})},Xf={name:"Command History",FOCUS_HISTORY:Fe.createAndAdd({id:"COMMAND_HISTORY.FOCUS_HISTORY",name:"Focus History Search",shortcut:[ce.CTRL,ue.H],macShortcut:[ce.CTRL,ce.OPTION,ue.H]}),SEND_TO_CONSOLE:Fe.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_CONSOLE",name:"Send to Console",shortcut:[ue.ENTER],macShortcut:[ue.ENTER]}),SEND_TO_NOTEBOOK:Fe.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_NOTEBOOK",name:"Send to Notebook",shortcut:[ce.CTRL,ue.ENTER],macShortcut:[ce.CMD,ue.ENTER]}),RUN:Fe.createAndAdd({id:"COMMAND_HISTORY.RUN",name:"Run",shortcut:[ce.ALT,ue.R],macShortcut:[ce.OPTION,ue.R]})},Zf={name:"Notebook",RUN:Fe.createAndAdd({id:"NOTEBOOK.RUN",name:"Run",shortcut:[ce.ALT,ue.R],macShortcut:[ce.OPTION,ue.R]}),RUN_SELECTED:Fe.createAndAdd({id:"NOTEBOOK.RUN_SELECTED",name:"Run Selected",shortcut:[ce.ALT,ce.SHIFT,ue.R],macShortcut:[ce.OPTION,ce.SHIFT,ue.R]}),FIND:Fe.createAndAdd({id:"NOTEBOOK.FIND",name:"Find",shortcut:[ce.CTRL,ue.F],macShortcut:[ce.CMD,ue.F],isEditable:!1}),MINIMAP:Fe.createAndAdd({id:"NOTEBOOK.MINIMAP",name:"Show Minimap",shortcut:[ce.ALT,ue.M],macShortcut:[ce.OPTION,ue.M]}),WORDWRAP:Fe.createAndAdd({id:"NOTEBOOK.WORDWRAP",name:"Word Wrap",shortcut:[ce.ALT,ue.Z],macShortcut:[ce.OPTION,ue.Z]})},Qf={CONSOLE:Yf,COMMAND_HISTORY:Xf,NOTEBOOK:Zf},Nt=Qf,mt=Object.freeze({FATAL:"FATAL",STDERR:"STDERR",ERROR:"ERROR",WARN:"WARN",STDOUT:"STDOUT",INFO:"INFO",DEBUG:"DEBUG",TRACE:"TRACE"}),Jf="#2d2a2e",eC="#fcfcfa",tC="#fcd65b",nC="#b2b1b2",sC="#9edc6f",iC="#76d9e4",oC="#f95d84",aC="#aa9af4",rC="#f95d84",lC="#fcfcfa",dC="#7c7b7c",Se={"error-foreground":"#f95d84",background:Jf,foreground:eC,"line-height":"19px",string:tC,"string-delim":"#929192",delimiter:nC,predefined:sC,keyword:iC,storage:oC,number:aC,operator:rC,identifier:lC,"namespace-identifier":"#f95d84","identifier-js":"#fcd65b",comment:dC,"input-option-active-border":"#929192","focus-border":"rgba(72, 120, 234, 0.85)","input-background":"#555356","input-foreground":"#f0f0ee","input-border":"#929192","editor-line-number-foreground":"#929192","editor-selection-background":"#676368","editor-line-highlight-bg":"#373438","context-menu-background":"#555356","context-menu-foreground":"#f0f0ee","menu-selection-background":"#4878ea","log-date":"#929192","log-error":"#f95d84","log-info":"#76d9e4","log-stdout":"#f0f0ee","log-warn":"#fcd65b","log-debug":"#aa9af4","log-trace":"#9edc6f","editor-find-match-background":"#3c5595","editor-find-match-highlight-background":"#343e5d","editor-widget-background":"#403e41","input-option-active-background":"#4878ea","input-option-active-foreground":"#f0f0ee","editor-suggest-widget-background":"#403e41","editor-suggest-widget-border":"#5b5a5c","editor-suggest-widget-foreground":"#f0f0ee","editor-suggest-widget-selected-background":"#41475a","editor-suggest-widget-highlightForeground":"#4878ea","list-hover-background":"#555356"},cC="python",hC={comments:{lineComment:"#",blockComment:["'''","'''"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:/^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/,action:{indentAction:1}}],folding:{offSide:!0,markers:{start:/^\s*#region\b/,end:/^\s*#endregion\b/}}},uC={keywords:["and","del","from","not","while","as","elif","global","or","with","assert","else","if","pass","yield","break","except","import","print","exec","in","raise","continue","finally","is","return","for","try",":","=","isinstance","__debug__"],storage:["class","def","async","lambda"],operators:["+","-","*","**","/","//","%","<<",">>","&","|","^","~","<",">","<=",">=","==","!=","<>","+=","-=","*=","/","//=","%=","&=","|=","^=",">>=","<<=","**="],brackets:[{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.square"},{open:"(",close:")",token:"delimiter.parenthesis"}],symbols:/[=><!~&|+\-*/^%]+/,delimiters:/[;=.@:,`]/,escapes:/\\(?:[abfnrtv\\"'\n\r]|x[0-9A-Fa-f]{2}|[0-7]{3}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8}|N\{\w+\})/,rawpre:/(?:[rR]|ur|Ur|uR|UR|br|Br|bR|BR)/,strpre:/(?:[buBU])/,tokenizer:{root:[[/@strpre?("""|''')/,{token:"string.delim",bracket:"@open",next:"@mstring.$1"}],[/@strpre?"([^"\\]|\\.)*$/,"string.invalid"],[/@strpre?'([^'\\]|\\.)*$/,"string.invalid"],[/@strpre?(["])/,{token:"string.delim",bracket:"@open",next:"@sstring.$1",nextEmbedded:"deephavenDb"}],[/@strpre?(["'])/,{token:"string.delim",bracket:"@open",next:"@string.$1"}],[/@rawpre("""|''')/,{token:"string.delim",bracket:"@open",next:"@mrawstring.$1"}],[/@rawpre"([^"\\]|\\.)*$/,"string.invalid"],[/@rawpre'([^'\\]|\\.)*$/,"string.invalid"],[/@rawpre(["'])/,{token:"string.delim",bracket:"@open",next:"@rawstring.$1"}],[/__[\w$]*/,"predefined"],[/[a-z_$][\w$]*/,{cases:{"@keywords":"keyword","@storage":"storage","@default":"identifier"}}],[/[A-Z][\w]*/,{cases:{"~[A-Z0-9_]+":"constructor.identifier","@default":"namespace.identifier"}}],{include:"@whitespace"},[/[{}()[\]]/,"@brackets"],[/@symbols/,{cases:{"@keywords":"keyword","@operators":"operator","@default":""}}],[/\d*\.\d+([eE][-+]?\d+)?/,"number.float"],[/0[xX][0-9a-fA-F]+[lL]?/,"number.hex"],[/0[bB][0-1]+[lL]?/,"number.binary"],[/(0[oO][0-7]+|0[0-7]+)[lL]?/,"number.octal"],[/(0|[1-9]\d*)[lL]?/,"number"],[":",{token:"keyword",bracket:"@open"}],[/@delimiters/,{cases:{"@keywords":"keyword","@default":"delimiter"}}]],comment:[[/[^/*]+/,"comment"],[/\/\*/,"comment","@push"],["\\*/","comment","@pop"],[/[/*]/,"comment"]],mstring:[{include:"@strcontent"},[/"""|'''/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/["']/,"string"],[/./,"string.invalid"]],sstring:[{include:"@strcontent"},[/["]/,{token:"string.delim",bracket:"@close",next:"@pop",nextEmbedded:"@pop"}],[/./,"string.invalid"]],string:[{include:"@strcontent"},[/[']/,{token:"string.delim",bracket:"@close",next:"@pop"}],[/./,"string.invalid"]],strcontent:[[/[^\\"']+/,"string"],[/\\$/,"string.escape"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"]],mrawstring:[{include:"@rawstrcontent"},[/"""|'''/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/["']/,"string"],[/./,"string.invalid"]],rawstring:[{include:"@rawstrcontent"},[/["']/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/./,"string.invalid"]],rawstrcontent:[[/[^\\"']+/,"string"],[/\\["']/,"string"],[/\\u[0-9A-Fa-f]{4}/,"string.escape"],[/\\/,"string"]],whitespace:[[/\s+/,"white"],[/(^#.*$)/,"comment"],[/'''/,"string","@endDocString"],[/"""/,"string","@endDblDocString"]],endDocString:[[/[^']+/,"string"],[/\\'/,"string"],[/'''/,"string","@popall"],[/'/,"string"]],endDblDocString:[[/[^"]+/,"string"],[/\\"/,"string"],[/"""/,"string","@popall"],[/"/,"string"]]}},mC={id:cC,conf:hC,language:uC},pC=mC,gC="groovy",fC={comments:{lineComment:"//",blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:/^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/,action:{indentAction:1}}],folding:{offSide:!0,markers:{start:/^\s*#region\b/,end:/^\s*#endregion\b/}}},CC={keywords:["and","del","from","not","while","as","elif","global","or","with","assert","else","if","pass","yield","break","except","import","print","println","class","exec","in","raise","continue","finally","is","return","def","for","lambda","try",":","=","isinstance","__debug__"],operators:["+","-","*","**","/","//","%","<<",">>","&","|","^","~","<",">","<=",">=","==","!=","<>","+=","-=","*=","/","//=","%=","&=","|=","^=",">>=","<<=","**="],brackets:[{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.square"},{open:"(",close:")",token:"delimiter.parenthesis"}],symbols:/[=><!~&|+\-*/^%]+/,delimiters:/[;=.@:,`]/,escapes:/\\(?:[abfnrtv\\"'\n\r]|x[0-9A-Fa-f]{2}|[0-7]{3}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8}|N\{\w+\})/,rawpre:/(?:[rR]|ur|Ur|uR|UR|br|Br|bR|BR)/,strpre:/(?:[buBU])/,tokenizer:{root:[[/@strpre?("""|''')/,{token:"string.delim",bracket:"@open",next:"@mstring.$1"}],[/@strpre?"([^"\\]|\\.)*$/,"string.invalid"],[/@strpre?'([^'\\]|\\.)*$/,"string.invalid"],[/@strpre?(["])/,{token:"string.delim",bracket:"@open",next:"@sstring.$1",nextEmbedded:"deephavenDb"}],[/@strpre?(["'])/,{token:"string.delim",bracket:"@open",next:"@string.$1"}],[/@rawpre("""|''')/,{token:"string.delim",bracket:"@open",next:"@mrawstring.$1"}],[/@rawpre"([^"\\]|\\.)*$/,"string.invalid"],[/@rawpre'([^'\\]|\\.)*$/,"string.invalid"],[/@rawpre(["'])/,{token:"string.delim",bracket:"@open",next:"@rawstring.$1"}],[/__[\w$]*/,"predefined"],[/[a-z_$][\w$]*/,{cases:{"@keywords":"keyword","@default":"identifier"}}],[/[A-Z][\w]*/,{cases:{"~[A-Z0-9_]+":"constructor.identifier","@default":"namespace.identifier"}}],{include:"@whitespace"},[/[{}()[\]]/,"@brackets"],[/@symbols/,{cases:{"@keywords":"keyword","@operators":"operator","@default":""}}],[/\d*\.\d+([eE][-+]?\d+)?/,"number.float"],[/0[xX][0-9a-fA-F]+[lL]?/,"number.hex"],[/0[bB][0-1]+[lL]?/,"number.binary"],[/(0[oO][0-7]+|0[0-7]+)[lL]?/,"number.octal"],[/(0|[1-9]\d*)[lL]?/,"number"],[":",{token:"keyword",bracket:"@open"}],[/@delimiters/,{cases:{"@keywords":"keyword","@default":"delimiter"}}]],mstring:[{include:"@strcontent"},[/"""|'''/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/["']/,"string"],[/./,"string.invalid"]],sstring:[{include:"@strcontent"},[/["]/,{token:"string.delim",bracket:"@close",next:"@pop",nextEmbedded:"@pop"}],[/./,"string.invalid"]],string:[{include:"@strcontent"},[/[']/,{token:"string.delim",bracket:"@close",next:"@pop"}],[/./,"string.invalid"]],strcontent:[[/[^\\"']+/,"string"],[/\\$/,"string.escape"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"]],mrawstring:[{include:"@rawstrcontent"},[/"""|'''/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/["']/,"string"],[/./,"string.invalid"]],rawstring:[{include:"@rawstrcontent"},[/["']/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/./,"string.invalid"]],rawstrcontent:[[/[^\\"']+/,"string"],[/\\["']/,"string"],[/\\u[0-9A-Fa-f]{4}/,"string.escape"],[/\\/,"string"]],whitespace:[[/[ \t\r\n]+/,""],[/\/\*\*(?!\/)/,"comment.doc","@doccomment"],[/\/\*/,"comment","@comment"],[/\/\/.*$/,"comment"]],comment:[[/[^/*]+/,"comment"],[/\*\//,"comment","@pop"],[/[/*]/,"comment"]],doccomment:[[/[^/*]+/,"comment.doc"],[/\*\//,"comment.doc","@pop"],[/[/*]/,"comment.doc"]]}},SC={id:gC,conf:fC,language:CC},bC=SC,wC="scala",vC={wordPattern:/(unary_[@~!#%^&*()\-=+\\|:<>/?]+)|([a-zA-Z_$][\w$]*?_=)|(`[^`]+`)|([a-zA-Z_$][\w$]*)/g,comments:{lineComment:"//",blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],folding:{markers:{start:/^\s*\/\/\s*(?:(?:#?region\b)|(?:<editor-fold\b))/,end:/^\s*\/\/\s*(?:(?:#?endregion\b)|(?:<\/editor-fold>))/}}},TC={keywords:["asInstanceOf","catch","class","classOf","def","do","else","extends","finally","for","foreach","forSome","if","import","isInstanceOf","macro","match","new","object","package","return","throw","trait","try","type","until","val","var","while","with","yield","given","enum","then"],softKeywords:["as","export","extension","end","derives","on"],constants:["true","false","null","this","super"],modifiers:["abstract","final","implicit","lazy","override","private","protected","sealed"],softModifiers:["inline","opaque","open","transparent","using"],name:/(?:[a-z_$][\w$]*|`[^`]+`)/,type:/(?:[A-Z][\w$]*)/,symbols:/[=><!~?:&|+\-*/^\\%@#]+/,digits:/\d+(_+\d+)*/,hexdigits:/[[0-9a-fA-F]+(_+[0-9a-fA-F]+)*/,escapes:/\\(?:[btnfr\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,fstring_conv:/[bBhHsScCdoxXeEfgGaAt]|[Tn](?:[HIklMSLNpzZsQ]|[BbhAaCYyjmde]|[RTrDFC])/,tokenizer:{root:[[/\braw"""/,{token:"string.quote",bracket:"@open",next:"@rawstringt"}],[/\braw"/,{token:"string.quote",bracket:"@open",next:"@rawstring"}],[/\bs"""/,{token:"string.quote",bracket:"@open",next:"@sstringt"}],[/\bs"/,{token:"string.quote",bracket:"@open",next:"@sstring"}],[/\bf""""/,{token:"string.quote",bracket:"@open",next:"@fstringt"}],[/\bf"/,{token:"string.quote",bracket:"@open",next:"@fstring"}],[/"""/,{token:"string.quote",bracket:"@open",next:"@stringt"}],[/"/,{token:"string.quote",bracket:"@open",next:"@string"}],[/(@digits)[eE]([-+]?(@digits))?[fFdD]?/,"number.float","@allowMethod"],[/(@digits)\.(@digits)([eE][-+]?(@digits))?[fFdD]?/,"number.float","@allowMethod"],[/0[xX](@hexdigits)[Ll]?/,"number.hex","@allowMethod"],[/(@digits)[fFdD]/,"number.float","@allowMethod"],[/(@digits)[lL]?/,"number","@allowMethod"],[/\b_\*/,"key"],[/\b(_)\b/,"keyword","@allowMethod"],[/\bimport\b/,"keyword","@import"],[/\b(case)([ \t]+)(class)\b/,["keyword.modifier","white","keyword"]],[/\bcase\b/,"keyword","@case"],[/\bva[lr]\b/,"keyword","@vardef"],[/\b(def)([ \t]+)((?:unary_)?@symbols|@name(?:_=)|@name)/,["keyword","white","identifier"]],[/@name(?=[ \t]*:(?!:))/,"variable"],[/(\.)(@name|@symbols)/,[{token:"operator"},{token:"@rematch",next:"@allowMethod"}]],[/([{(])(\s*)(@name(?=\s*=>))/,["@brackets","white","variable"]],[/@name/,{cases:{"@keywords":"keyword","@softKeywords":"keyword","@modifiers":"keyword.modifier","@softModifiers":"keyword.modifier","@constants":{token:"constant",next:"@allowMethod"},"@default":{token:"identifier",next:"@allowMethod"}}}],[/@type/,"type","@allowMethod"],{include:"@whitespace"},[/@[a-zA-Z_$][\w$]*(?:\.[a-zA-Z_$][\w$]*)*/,"annotation"],[/[{(]/,"@brackets"],[/[})]/,"@brackets","@allowMethod"],[/\[/,"operator.square"],[/](?!\s*(?:va[rl]|def|type)\b)/,"operator.square","@allowMethod"],[/]/,"operator.square"],[/([=-]>|<-|>:|<:|:>|<%)(?=[\s\w()[\]{},."'`])/,"keyword"],[/@symbols/,"operator"],[/[;,.]/,"delimiter"],[/'[a-zA-Z$][\w$]*(?!')/,"attribute.name"],[/'[^\\']'/,"string","@allowMethod"],[/(')(@escapes)(')/,[{token:"string"},{token:"string.escape"},{token:"string",next:"@allowMethod"}]],[/'/,"string.invalid"]],import:[[/;/,"delimiter","@pop"],[/^|$/,"","@pop"],[/[ \t]+/,"white"],[/[\n\r]+/,"white","@pop"],[/\/\*/,"comment","@comment"],[/@name|@type/,"type"],[/[(){}]/,"@brackets"],[/[[\]]/,"operator.square"],[/[.,]/,"delimiter"]],allowMethod:[[/^|$/,"","@pop"],[/[ \t]+/,"white"],[/[\n\r]+/,"white","@pop"],[/\/\*/,"comment","@comment"],[/(?==>[\s\w([{])/,"keyword","@pop"],[/(@name|@symbols)(?=[ \t]*[[({"'`]|[ \t]+(?:[+-]?\.?\d|\w))/,{cases:{"@keywords":{token:"keyword",next:"@pop"},"->|<-|>:|<:|<%":{token:"keyword",next:"@pop"},"@default":{token:"@rematch",next:"@pop"}}}],["","","@pop"]],comment:[[/[^/*]+/,"comment"],[/\/\*/,"comment","@push"],[/\*\//,"comment","@pop"],[/[/*]/,"comment"]],case:[[/\b_\*/,"key"],[/\b(_|true|false|null|this|super)\b/,"keyword","@allowMethod"],[/\bif\b|=>/,"keyword","@pop"],[/`[^`]+`/,"identifier","@allowMethod"],[/@name/,"variable","@allowMethod"],[/:::?|\||@(?![a-z_$])/,"keyword"],{include:"@root"}],vardef:[[/\b_\*/,"key"],[/\b(_|true|false|null|this|super)\b/,"keyword"],[/@name/,"variable"],[/:::?|\||@(?![a-z_$])/,"keyword"],[/=|:(?!:)/,"operator","@pop"],[/$/,"white","@pop"],{include:"@root"}],string:[[/[^\\"\n\r]+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/"/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}]],stringt:[[/[^\\"\n\r]+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/"(?=""")/,"string"],[/"""/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/"/,"string"]],fstring:[[/@escapes/,"string.escape"],[/"/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/\$\$/,"string"],[/(\$)([a-z_]\w*)/,["operator","identifier"]],[/\$\{/,"operator","@interp"],[/%%/,"string"],[/(%)([-#+ 0,(])(\d+|\.\d+|\d+\.\d+)(@fstring_conv)/,["metatag","keyword.modifier","number","metatag"]],[/(%)(\d+|\.\d+|\d+\.\d+)(@fstring_conv)/,["metatag","number","metatag"]],[/(%)([-#+ 0,(])(@fstring_conv)/,["metatag","keyword.modifier","metatag"]],[/(%)(@fstring_conv)/,["metatag","metatag"]],[/./,"string"]],fstringt:[[/@escapes/,"string.escape"],[/"(?=""")/,"string"],[/"""/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/\$\$/,"string"],[/(\$)([a-z_]\w*)/,["operator","identifier"]],[/\$\{/,"operator","@interp"],[/%%/,"string"],[/(%)([-#+ 0,(])(\d+|\.\d+|\d+\.\d+)(@fstring_conv)/,["metatag","keyword.modifier","number","metatag"]],[/(%)(\d+|\.\d+|\d+\.\d+)(@fstring_conv)/,["metatag","number","metatag"]],[/(%)([-#+ 0,(])(@fstring_conv)/,["metatag","keyword.modifier","metatag"]],[/(%)(@fstring_conv)/,["metatag","metatag"]],[/./,"string"]],sstring:[[/@escapes/,"string.escape"],[/"/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/\$\$/,"string"],[/(\$)([a-z_]\w*)/,["operator","identifier"]],[/\$\{/,"operator","@interp"],[/./,"string"]],sstringt:[[/@escapes/,"string.escape"],[/"(?=""")/,"string"],[/"""/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/\$\$/,"string"],[/(\$)([a-z_]\w*)/,["operator","identifier"]],[/\$\{/,"operator","@interp"],[/./,"string"]],interp:[[/{/,"operator","@push"],[/}/,"operator","@pop"],{include:"@root"}],rawstring:[[/[^"]/,"string"],[/"/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}]],rawstringt:[[/[^"]/,"string"],[/"(?=""")/,"string"],[/"""/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/"/,"string"]],whitespace:[[/[ \t\r\n]+/,"white"],[/\/\*/,"comment","@comment"],[/\/\/.*$/,"comment"]]}},EC={id:wC,conf:vC,language:TC},yC=EC,xC="deephavenDb",RC={comments:{lineComment:"#",blockComment:["'''","'''"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:/^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/,action:{indentAction:1}}],folding:{offSide:!0,markers:{start:/^\s*#region\b/,end:/^\s*#endregion\b/}}},IC={tokenPostfix:".js",keywords:["boolean","break","byte","case","catch","char","class","const","continue","debugger","default","delete","do","double","else","enum","export","extends","false","final","finally","float","for","function","goto","if","implements","import","in","instanceof","int","interface","long","native","new","null","package","private","protected","public","return","short","static","super","switch","synchronized","this","throw","throws","transient","true","try","typeof","var","void","volatile","while","with"],builtins:["define","require","window","document","undefined"],operators:["=",">","<","!","~","?",":","==","<=",">=","!=","&&","||","++","--","+","-","*","/","&","|","^","%","<<",">>",">>>","+=","-=","*=","/=","&=","|=","^=","%=","<<=",">>=",">>>="],brackets:[{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.bracket"},{open:"(",close:")",token:"delimiter.parenthesis"}],symbols:/[~!@#%\^&*-+=|\\:`<>.?\/]+/,escapes:/\\(?:[btnfr\\"']|[0-7][0-7]?|[0-3][0-7]{2})/,exponent:/[eE][\-+]?[0-9]+/,regexpctl:/[(){}\[\]\$\^|\-*+?\.]/,regexpesc:/\\(?:[bBdDfnrstvwWn0\\\/]|@regexpctl|c[A-Z]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})/,tokenizer:{root:[[/([a-zA-Z_\$][\w\$]*)(\s*)(:?)/,{cases:{"$1@keywords":["keyword","white","delimiter"],$3:["key.identifier","white","delimiter"],"$1@builtins":["predefined.identifier","white","delimiter"],"@default":["identifier","white","delimiter"]}}],{include:"@whitespace"},[/\/(?=([^\\\/]|\\.)+\/)/,{token:"regexp.slash",bracket:"@open",next:"@regexp"}],[/[{}()\[\]]/,"@brackets"],[/[;,.]/,"delimiter"],[/@symbols/,{cases:{"@operators":"operator","@default":""}}],[/\d+\.\d*(@exponent)?/,"number.float"],[/\.\d+(@exponent)?/,"number.float"],[/\d+@exponent/,"number.float"],[/0[xX][\da-fA-F]+/,"number.hex"],[/0[0-7]+/,"number.octal"],[/\d+/,"number"],[/"([^"\\]|\\.)*$/,"string.invalid"],[/'([^'\\]|\\.)*$/,"string.invalid"],[/"/,"string",'@string."'],[/'/,"string","@string.'"]],whitespace:[[/[ \t\r\n]+/,"white"],[/\/\*/,"comment","@comment"],[/\/\/.*$/,"comment"]],comment:[[/[^\/*]+/,"comment"],[/\/\*/,"comment.invalid"],["\\*/","comment","@pop"],[/[\/*]/,"comment"]],string:[[/[^\\"']+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/["']/,{cases:{"$#==$S2":{token:"string",next:"@pop"},"@default":"string"}}]],regexp:[[/(\{)(\d+(?:,\d*)?)(\})/,["@brackets.regexp.escape.control","regexp.escape.control","@brackets.regexp.escape.control"]],[/(\[)(\^?)(?=(?:[^\]\\\/]|\\.)+)/,[{token:"@brackets.regexp.escape.control"},{token:"regexp.escape.control",next:"@regexrange"}]],[/(\()(\?:|\?=|\?!)/,["@brackets.regexp.escape.control","regexp.escape.control"]],[/[()]/,"@brackets.regexp.escape.control"],[/@regexpctl/,"regexp.escape.control"],[/[^\\\/]/,"regexp"],[/@regexpesc/,"regexp.escape"],[/\\\./,"regexp.invalid"],["/",{token:"regexp.slash",bracket:"@close"},"@pop"]],regexrange:[[/-/,"regexp.escape.control"],[/\^/,"regexp.invalid"],[/@regexpesc/,"regexp.escape"],[/[^\]]/,"regexp"],[/\]/,"@brackets.regexp.escape.control","@pop"]]}},DC={id:xC,conf:RC,language:IC},FC=DC,NC="log",MC={},kC={tokenizer:{root:[[/ FATAL[\s\S]*/,{token:"error",next:"@error"}],[/ ERROR[\s\S]*/,{token:"error",next:"@error"}],[/ STDERR[\s\S]*/,{token:"error",next:"@error"}],[/ STDOUT.*/,{token:"stdout",next:"@stdout"}],[/ INFO[\s\S]*/,{token:"info",next:"@info"}],[/ WARN.*/,{token:"warn",next:"@warn"}],[/ TRACE[\s\S]*/,{token:"trace",next:"@trace"}],[/ DEBUG[.\s\S]*/,{token:"debug",next:"@debug"}],[/^\d{2}:\d{2}:\d{2}.\d{3}/,"date"]],error:[{include:"@body"}],info:[{include:"@body"}],warn:[{include:"@body"}],stdout:[{include:"@body"}],trace:[{include:"@body"}],debug:[{include:"@body"}],body:[[/^\d{2}:\d{2}:\d{2}.\d{3}/,{token:"date",next:"@pop"}],[/[\s\S]*/,{token:"$S0"}]]}},OC={id:NC,conf:MC,language:kC},AC=OC,yn=Z.module("MonacoUtils");class In{static init({getWorker:e}={}){yn.debug("Initializing Monaco..."),e!==void 0&&In.registerGetWorker(e);const{registerLanguages:t,removeHashtag:n}=In,s=[{token:"",foreground:n(Se.foreground)},{token:"string",foreground:n(Se.string)},{token:"string.delim",foreground:n(Se["string-delim"])},{token:"keyword",foreground:n(Se.keyword)},{token:"identifier.js",foreground:n(Se["identifier-js"])},{token:"delimiter",foreground:n(Se.delimiter)},{token:"comment",foreground:n(Se.comment)},{token:"number",foreground:n(Se.number)},{token:"storage",foreground:n(Se.storage)},{token:"identifier",foreground:n(Se.identifier)},{token:"namespace.identifier",foreground:n(Se["namespace-identifier"])},{token:"operator",foreground:n(Se.operator)},{token:"predefined",foreground:n(Se.predefined)},{token:"error.log",foreground:Se["log-error"].substring(1)},{token:"warn.log",foreground:n(Se["log-warn"])},{token:"info.log",foreground:n(Se["log-info"])},{token:"stdout.log",foreground:n(Se["log-stdout"])},{token:"trace.log",foreground:n(Se["log-trace"])},{token:"debug.log",foreground:n(Se["log-debug"])},{token:"date.log",foreground:n(Se["log-date"])}],i={errorForeground:Se["error-foreground"],"inputOption.activeBorder":Se["input-option-active-border"],"editor.background":Se.background,"editor.foreground":Se.foreground,"editor.lineHighlightBackground":Se["editor-line-highlight-bg"],"editorLineNumber.foreground":Se["editor-line-number-foreground"],"editor.selectionBackground":Se["editor-selection-background"],"editor.findMatchBackground":Se["editor-find-match-background"],"editor.findMatchHighlightBackground":Se["editor-find-match-highlight-background"],"editorSuggestWidget.background":Se["editor-suggest-widget-background"],"editorSuggestWidget.border":Se["editor-suggest-widget-border"],"editorSuggestWidget.foreground":Se["editor-suggest-widget-foreground"],"editorSuggestWidget.selectedBackground":Se["editor-suggest-widget-selected-background"],"editorSuggestWidget.highlightForeground":Se["editor-suggest-widget-highlightForeground"],"list.hoverBackground":Se["list-hover-background"],"dropdown.background":Se["context-menu-background"],"dropdown.foreground":Se["context-menu-foreground"],"menu.selectionBackground":Se["menu-selection-background"],"list.focusBackground":Se["menu-selection-background"],"editorWidget.background":Se["editor-widget-background"],"inputOption.activeBackground":Se["input-option-active-background"],"inputOption.activeForeground":Se["input-option-active-foreground"],focusBorder:Se["focus-border"],"input.background":Se["input-background"],"input.foreground":Se["input-foreground"],"input.border":Se["input-border"]};Yn.defineTheme("dh-dark",{base:"vs-dark",inherit:!0,rules:s,colors:i}),yn.debug2("monaco theme: ",Se),Yn.setTheme("dh-dark"),t([FC,pC,bC,AC,yC]),yn.debug("Monaco initialized.")}static registerGetWorker(e){window.MonacoEnvironment={...window.MonacoEnvironment,getWorker:e}}static removeHashtag(e){return e.substring(1)}static registerLanguages(e){const t=e.map(({id:n})=>n);wi.getLanguages().filter(({id:n})=>t.includes(n)).forEach(n=>{const s=n;yn.debug2("Overriding default language loader:",s.id)}),e.forEach(n=>{In.registerLanguage(n)})}static registerLanguage(e){yn.debug2("Registering language: ",e.id),wi.register(e),wi.onLanguage(e.id,()=>{wi.setLanguageConfiguration(e.id,e.conf),wi.setMonarchTokensProvider(e.id,e.language)})}static setEOL(e,t=Yn.EndOfLineSequence.LF){e.getModel()?.setEOL(t)}static openDocument(e,t){const n=e.getModel();M(n);const s={textDocument:{uri:`${n.uri}`,languageId:n.getLanguageId(),version:n.getVersionId(),text:n.getValue()}};return yn.debug2("didOpenDocumentParams: ",s),t.openDocument(s),e.onDidChangeModelContent(o=>{const{changes:a,versionId:r}=o,c=[];for(let h=0;h<a.length;h+=1){const u=a[h],{range:m,rangeLength:p,text:g}=u,C={range:{start:{line:m.startLineNumber-1,character:m.startColumn-1},end:{line:m.endLineNumber-1,character:m.endColumn-1}},rangeLength:p,text:g};c.push(C)}if(c.length>0){const h={textDocument:{version:r,uri:`${n.uri}`},contentChanges:c};yn.debug2("didChangeDocumentParams",h),t.changeDocument(h)}})}static closeDocument(e,t){const n=e.getModel();M(n);const s={textDocument:{uri:`${n.uri}`}};t.closeDocument(s)}static registerPasteHandler(e){e.onDidPaste(t=>{const n=/“|”/g,s=/\u200b/g,i=/\u00A0/g,o=e.getModel();M(o);const a=o.getValueInRange(t.range);(n.test(a)||s.test(a)||i.test(a))&&o.applyEdits([{range:t.range,text:a.replace(n,'"').replace(s,"").replace(i," ")}])})}static isMacPlatform(){const{platform:e}=window.navigator;return e.startsWith("Mac")}static removeConflictingKeybindings(e){const t=[{windows:"ctrl+D",mac:"meta+D"},{windows:"ctrl+H"}];try{t.forEach(n=>{In.isMacPlatform()&&n.mac===""||!In.isMacPlatform()&&n.windows===""||In.removeKeybinding(e,In.isMacPlatform()?n.mac:n.windows)})}catch(n){yn.error(n)}}static removeKeybinding(e,t){if(t===void 0)return;const n=e._standaloneKeybindingService._getResolver()._map.get(t);n!=null?n.forEach(s=>{yn.debug2(`Removing Monaco keybinding ${t} for ${s.command}`),e._standaloneKeybindingService.addDynamicKeybinding(`-${s.command}`,null,()=>{})}):yn.warn(`Did not find any keybindings to remove for ${t}`)}static getMonacoKeyCodeFromShortcut(e){const{keyState:t}=e,{keyValue:n}=t;return n===null?0:In.isMacPlatform()?(t.metaKey?rn.CtrlCmd:0)|(t.shiftKey?rn.Shift:0)|(t.altKey?rn.Alt:0)|(t.ctrlKey?rn.WinCtrl:0)|Ld.fromString(n):(t.ctrlKey?rn.CtrlCmd:0)|(t.shiftKey?rn.Shift:0)|(t.altKey?rn.Alt:0)|(t.metaKey?rn.WinCtrl:0)|Ld.fromString(n)}}const zt=In,sc=Z.module("MonacoCompletionProvider");class LC extends b.PureComponent{constructor(e){super(e),this.handleCompletionRequest=this.handleCompletionRequest.bind(this)}componentDidMount(){const{language:e}=this.props;this.registeredCompletionProvider=wi.registerCompletionItemProvider(e??"",{provideCompletionItems:this.handleCompletionRequest,triggerCharacters:['"',".","'","(","[","{",","]})}componentWillUnmount(){this.registeredCompletionProvider?.dispose()}registeredCompletionProvider;handleCompletionRequest(e,t,n){const{model:s,session:i}=this.props;if(e!==s)return null;const o={textDocument:{uri:`${e.uri}`,version:e.getVersionId()},position:{line:t.lineNumber-1,character:t.column-1},context:n},a=i.getCompletionItems(o);return sc.debug("Completion items received: ",o,a),a.then(c=>({incomplete:!0,suggestions:c.map(u=>{const{label:m,kind:p,detail:g,documentation:C,sortText:f,filterText:S,textEdit:v,insertTextFormat:w}=u,{start:T,end:y}=v.range,E={startLineNumber:T.line+1,startColumn:T.character+1,endLineNumber:y.line+1,endColumn:y.character+1};return{label:m,kind:p,detail:g,documentation:C,sortText:f,filterText:S,insertText:v.text,insertTextRules:w===2?4:w,range:E}})})).catch(c=>(sc.error("There was an error retrieving completion items",c),{suggestions:[]}))}render(){return null}}const Xh=LC;const Lr=Z.module("ConsoleInput"),wa=parseInt(Se["line-height"],10),Zh=6,Qh=6,PC=wa+Zh+Qh,Pr=100;class Vl extends b.PureComponent{static defaultProps={maxHeight:wa*10,scope:null,disabled:!1};static INPUT_CLASS_NAME="console-input";constructor(e){super(e),this.handleWindowResize=this.handleWindowResize.bind(this),this.commandContainer=X.createRef(),this.commandHistoryIndex=null,this.timestamp=Date.now(),this.bufferIndex=0,this.history=[],this.modifiedCommands=new Map,this.state={commandEditorHeight:wa,isFocused:!1,model:null}}componentDidMount(){this.initCommandEditor(),window.addEventListener("resize",this.handleWindowResize),this.loadMoreHistory()}componentDidUpdate(){this.layoutEditor()}componentWillUnmount(){window.removeEventListener("resize",this.handleWindowResize),this.loadingPromise!=null&&this.loadingPromise.cancel(),this.destroyCommandEditor()}cancelListener;commandContainer;commandEditor;commandHistoryIndex;commandSuggestionContainer;loadingPromise;timestamp;bufferIndex;history;modifiedCommands;setConsoleText(e,t=!0,n=!1){e&&(Lr.debug("Command received: ",e),n||(this.commandHistoryIndex=null,this.commandEditor?.setValue(e)),t&&this.focusEnd(),this.updateDimensions(),n&&this.processCommand(e))}initCommandEditor(){const{language:e,session:t}=this.props,n={copyWithSyntaxHighlighting:!1,cursorStyle:"block",fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:e,lineHeight:wa,lineDecorationsWidth:3,lineNumbers:"off",minimap:{enabled:!1},renderLineHighlight:"none",scrollBeyondLastLine:!1,scrollbar:{arrowSize:0,horizontal:"hidden",horizontalScrollbarSize:0},padding:{top:Zh,bottom:Qh},tabCompletion:"on",value:"",wordWrap:"on"},s=this.commandContainer.current;M(s),this.commandEditor=Yn.create(s,n),zt.setEOL(this.commandEditor),zt.openDocument(this.commandEditor,t),this.commandEditor.onDidChangeModelContent(()=>{const i=this.commandEditor?.getValue();this.modifiedCommands.set(this.commandHistoryIndex,i??null),this.updateDimensions()}),this.commandEditor.onDidFocusEditorText(()=>{this.setState({isFocused:!0})}),this.commandEditor.onDidBlurEditorText(()=>{this.setState({isFocused:!1})}),this.commandEditor.onKeyDown(i=>{const{commandEditor:o,commandHistoryIndex:a}=this,r=o?.getPosition();M(r);const{lineNumber:c}=r,h=o?.getModel();if(i.code==="ArrowUp"&&!this.isSuggestionMenuPopulated()&&c===1){a!=null?this.loadCommand(a+1):this.loadCommand(0),this.focusStart(),i.stopPropagation(),i.preventDefault();return}if(i.code==="ArrowDown"&&!this.isSuggestionMenuPopulated()&&c===h?.getLineCount()){a!=null&&a>0?this.loadCommand(a-1):this.loadCommand(null),this.focusEnd(),i.stopPropagation(),i.preventDefault();return}if(!i.altKey&&!i.shiftKey&&!i.metaKey)if(i.keyCode===xs.Enter){if(!this.isSuggestionMenuPopulated()){i.stopPropagation(),i.preventDefault();const u=this.commandEditor?.getValue().trim();u!==void 0&&(this.processCommand(u),this.commandEditor?.setValue(""))}}else i.keyCode===xs.Tab&&(this.isSuggestionMenuActive()?this.isSuggestionMenuPopulated()||(i.stopPropagation(),i.preventDefault()):(i.stopPropagation(),i.preventDefault(),this.commandEditor?.trigger("Tab key trigger suggestions","editor.action.triggerSuggest",{})))}),this.commandEditor.addCommand(rn.CtrlCmd|xs.KeyF,()=>{}),zt.removeConflictingKeybindings(this.commandEditor),zt.registerPasteHandler(this.commandEditor),this.commandEditor.focus(),this.updateDimensions(),this.setState({model:this.commandEditor.getModel()})}destroyCommandEditor(){const{session:e}=this.props;this.commandEditor&&(zt.closeDocument(this.commandEditor,e),this.commandEditor.dispose(),this.commandEditor=void 0)}handleWindowResize(){this.updateDimensions()}isSuggestionMenuActive(){return this.commandSuggestionContainer||(this.commandSuggestionContainer=this.commandEditor?.getDomNode()?.querySelector(".suggest-widget")),(this.commandSuggestionContainer&&this.commandSuggestionContainer.classList.contains("visible"))??!1}isSuggestionMenuPopulated(){return this.isSuggestionMenuActive()&&(this.commandSuggestionContainer?.querySelector(".monaco-list-rows")?.childElementCount??0)>0}focus(){this.commandEditor?.focus()}focusStart(){const e=this.commandEditor?.getModel();M(e);const t=e.getLineLength(1)+1,n=this.commandEditor?.getTopForPosition(1,t);M(n),this.commandEditor?.setPosition({lineNumber:1,column:t}),this.commandEditor?.setScrollTop(n),this.commandEditor?.focus()}focusEnd(){const e=this.commandEditor?.getModel();M(e);const t=e.getLineCount(),n=e.getLineLength(t)+1,s=this.commandEditor?.getTopForPosition(t,n);M(s),this.commandEditor?.setPosition({lineNumber:t,column:n}),this.commandEditor?.setScrollTop(s),this.commandEditor?.focus()}clear(){this.commandEditor?.focus(),this.commandEditor?.getModel()?.setValue(""),this.commandHistoryIndex=null}layoutEditor(){this.commandEditor&&this.commandEditor.layout()}loadCommand(e){if(e!==null&&e>=this.history.length)return;const t=this.modifiedCommands.get(e),n=e===null?"":this.history[this.history.length-e-1];this.commandHistoryIndex=e,this.commandEditor?.getModel()?.setValue(t??n),e!==null&&e>this.history.length-Pr&&this.loadMoreHistory()}async loadMoreHistory(){try{if(this.loadingPromise!=null||this.bufferIndex==null)return;const{commandHistoryStorage:e,language:t,scope:n}=this.props;this.loadingPromise=ve.makeCancelable(e.getTable(t,n??"",this.timestamp),o=>o.close());const s=await this.loadingPromise;s.setReversed(!0),s.setViewport({top:this.bufferIndex,bottom:this.bufferIndex+Pr-1}),this.loadingPromise=ve.makeCancelable(s.getViewportData(),()=>s.close());const i=await this.loadingPromise;this.bufferIndex+=Pr,this.bufferIndex>=s.size&&(this.bufferIndex=null),this.history=[...i.items.filter(({name:o},a,r)=>a===0||o!==r[a-1].name).map(({name:o})=>o).reverse(),...this.history],this.loadingPromise=void 0,s.close()}catch(e){if(this.loadingPromise=void 0,ve.isCanceled(e)){Lr.debug2("Promise canceled, not loading history");return}Lr.error("Error fetching history",e)}}processCommand(e){this.commandHistoryIndex=null,this.modifiedCommands.clear(),M(e),e!==""&&(this.history.length===0||e!==this.history[this.history.length-1])&&this.history.push(e),this.updateDimensions();const{onSubmit:t}=this.props;t(e)}updateDimensions(){if(!this.commandEditor)return;const{maxHeight:e}=this.props;M(e);const t=this.commandEditor.getContentHeight(),n=Math.max(Math.min(t,e),PC),i={overviewRulerLanes:t>n?void 0:0};this.setState({commandEditorHeight:n},()=>{this.commandEditor?.updateOptions(i),this.commandEditor?.layout()})}render(){const{disabled:e,language:t,session:n}=this.props,{commandEditorHeight:s,isFocused:i,model:o}=this.state;return l.jsx("div",{className:$("console-input-wrapper",{disabled:e}),children:l.jsxs("div",{className:$("console-input-inner-wrapper",{focus:i}),children:[l.jsx("div",{className:Vl.INPUT_CLASS_NAME,ref:this.commandContainer,style:{height:s}}),o&&l.jsx(Xh,{model:o,language:t,session:n})]})})}}const ic=Vl;const oc="pasted values",_C=[/^audio.*/,/^font.*/,/^image.*/,/^video.*/],_r=[".csv",".tsv",".tab",".psv",".dsv",".txt"],ac=[".zip"];class Zs extends b.Component{static defaultProps={allowZip:!1,dragError:null};static MULTIPLE_FILE_ERROR="Please select only one file";static FILE_TYPE_ERROR="Filetype not supported.";static isValidDropItem(e){return e!=null&&e.kind==="file"&&!_C.find(t=>t.test(e.type))}static isValidExtension(e,t=!1){return _r.some(n=>e.endsWith(n))||t&&ac.some(n=>e.endsWith(n))}static handleDragOver(e){e.preventDefault(),e.stopPropagation()}static getIcon(e){return e===oc?Pd:e.endsWith(".csv")?Ip:e.endsWith(".zip")?Dp:Fp}constructor(e){super(e),this.handleSelectFile=this.handleSelectFile.bind(this),this.handleFiles=this.handleFiles.bind(this),this.handleDrop=this.handleDrop.bind(this),this.unstageFile=this.unstageFile.bind(this),this.handleMenuPaste=this.handleMenuPaste.bind(this),this.handlePasteEvent=this.handlePasteEvent.bind(this),this.fileElem=X.createRef(),this.divElem=X.createRef(),this.state={selectedFileName:""}}componentDidMount(){this.divElem.current?.addEventListener("paste",this.handlePasteEvent),this.divElem.current?.focus()}componentWillUnmount(){this.divElem.current?.removeEventListener("paste",this.handlePasteEvent)}fileElem;divElem;handleSelectFile(){this.fileElem.current&&(this.fileElem.current.value="",this.fileElem.current?.click())}handleFiles(e){e.stopPropagation(),e.preventDefault();const{files:t}=e.target;t!=null&&this.handleFile(t[0])}handleDrop(e){const{allowZip:t,clearDragError:n,dragError:s}=this.props;if(e.preventDefault(),e.stopPropagation(),s!=null){n();return}if(e.dataTransfer==null||e.dataTransfer.items==null||e.dataTransfer.items.length===0)return;const i=e.dataTransfer.items[0].getAsFile();M(i),Zs.isValidExtension(i.name,t)?this.handleFile(i):this.setState({dropError:Zs.FILE_TYPE_ERROR})}unstageFile(e){const{onCancel:t}=this.props;e.stopPropagation(),e.preventDefault(),t(),this.setState({selectedFileName:"",dropError:void 0})}handleFile(e){const{onFileOpened:t}=this.props;t(e),this.setState({selectedFileName:e.name,dropError:void 0})}handleMenuPaste(){const{onPaste:e,onError:t,uploadInProgress:n}=this.props;n||navigator.clipboard.readText().then(s=>{e(s),this.setState({selectedFileName:oc,dropError:void 0})}).catch(s=>t(s))}handlePasteEvent(e){e.stopPropagation(),e.preventDefault(),this.handleMenuPaste()}makeContextMenuItems(){const{uploadInProgress:e}=this.props;return[{title:"Paste",icon:Pd,action:this.handleMenuPaste,shortcut:es.PASTE,disabled:e}]}getValidExtensions=fe(e=>e?[..._r,...ac]:[..._r]);getAcceptString=fe(e=>this.getValidExtensions(e).join(", "));getFileTypeErrorString=fe(e=>Wt.join(this.getValidExtensions(e),"or"));render(){const{allowZip:e,dragError:t,uploadInProgress:n}=this.props,{selectedFileName:s,dropError:i}=this.state,o=t??i,a=this.makeContextMenuItems();return l.jsxs("div",{ref:this.divElem,className:"csv-overlay fill-parent-absolute",onDragOver:Zs.handleDragOver,onDrop:this.handleDrop,tabIndex:-1,children:[l.jsx(ae,{actions:a}),l.jsx("input",{ref:this.fileElem,type:"file",id:"fileElem",accept:this.getAcceptString(e),style:{display:"none"},onChange:this.handleFiles,"data-testid":"fileElem"}),!s&&(o===void 0||o==="")&&l.jsxs("div",{className:"message-content",children:[l.jsx("div",{className:"message-icon",children:l.jsx(J,{icon:Np})}),l.jsx("label",{children:"Drop file (or paste values) here to import"}),l.jsx("div",{className:"message-small",children:l.jsx("label",{children:"or"})}),l.jsx(V,{kind:"primary",onClick:this.handleSelectFile,children:"Select File..."})]}),s&&(o===void 0||o==="")&&l.jsxs("div",{className:"selected-content",children:[l.jsx("div",{className:"selected-icon",children:l.jsx(J,{icon:Zs.getIcon(s)})}),l.jsxs("div",{className:"selected-text",children:[l.jsx("label",{children:"Selected File"}),l.jsxs("label",{className:"selected-name",children:[s,!n&&l.jsx(V,{kind:"ghost",className:"ml-2",onClick:this.unstageFile,icon:Qt,tooltip:"Remove"})]})]})]}),Boolean(o)&&l.jsxs("div",{className:"message-content",children:[l.jsx("div",{className:"message-icon",children:l.jsx(J,{icon:Ms})}),l.jsx("label",{children:o}),o===Zs.FILE_TYPE_ERROR&&l.jsx("div",{className:"message-small",children:l.jsx("label",{children:this.getFileTypeErrorString(e)})})]})]})}}const vi=Zs;class jC{static INTEGER="int";static LONG="long";static DOUBLE="double";static BOOLEAN="bool";static STRING="string";static DATE_TIME="datetime";static LOCAL_TIME="localtime"}const Ae=jC,rc="unknown",HC=2147483647,BC=-2147483648,lc=/^[0-9]{4}-[0-1][0-9]-[0-3][0-9][ T][0-2][0-9]:[0-5][0-9]:[0-6][0-9](?:\.[0-9]{1,9})?(?: [a-zA-Z]+)?$/,dc=/^([0-9]+T)?([0-9]+):([0-9]+)(:[0-9]+)?(?:\.[0-9]{1,9})?$/;class Tt{static determineType(e,t,n){if(!e||e===n)return t;switch(t){case Ae.STRING:return Ae.STRING;case Ae.INTEGER:return Tt.checkInteger(e);case Ae.LONG:return Tt.checkLong(e);case Ae.DOUBLE:return Tt.checkDouble(e);case Ae.BOOLEAN:return Tt.checkBoolean(e);case Ae.DATE_TIME:return Tt.checkDateTime(e);case Ae.LOCAL_TIME:return Tt.checkLocalTime(e);default:return Tt.getTypeFromUnknown(e)}}static isNotParsableNumber(e){return isNaN(e)||e==="Infinity"||e==="-Infinity"}static checkInteger(e){const t=e.replace(/,/g,"");return Tt.isNotParsableNumber(t)?Ae.STRING:Tt.getNumberType(t)}static checkLong(e){const t=e.replace(/,/g,"");return Tt.isNotParsableNumber(t)?Ae.STRING:t.includes(".")?Ae.DOUBLE:Ae.LONG}static checkDouble(e){const t=e.replace(/,/g,"");return Tt.isNotParsableNumber(t)?Ae.STRING:Ae.DOUBLE}static checkBoolean(e){const t=e.toLowerCase();return t==="true"||t==="false"?Ae.BOOLEAN:Ae.STRING}static checkDateTime(e){return lc.test(e)?Ae.DATE_TIME:Ae.STRING}static checkLocalTime(e){return dc.test(e)?Ae.LOCAL_TIME:Ae.STRING}static getTypeFromUnknown(e){const t=e.replace(/,/g,"");if(Tt.isNotParsableNumber(t)){const n=e.toLowerCase();return n==="true"||n==="false"?Ae.BOOLEAN:lc.test(e)&&e.includes(":")?Ae.DATE_TIME:dc.test(e)?Ae.LOCAL_TIME:Ae.STRING}return Tt.getNumberType(t)}static getNumberType(e){if(e.includes("."))return Ae.DOUBLE;const t=e.startsWith("-")?11:10;if(e.length>t)return Ae.LONG;const n=parseInt(e,10);return n>HC||n<BC?Ae.LONG:Ae.INTEGER}constructor(e,t,n,s,i,o,a,r,c,h){this.onFileCompleted=e,this.file=t,this.readHeaders=n,this.nullString=i,this.onProgress=o,this.onError=a,this.chunks=0,this.totalChunks=r,this.isZip=c,this.shouldTrim=h,this.zipProgress=0,this.handleChunk=this.handleChunk.bind(this),this.handleComplete=this.handleComplete.bind(this),this.handleError=this.handleError.bind(this),this.handleNodeUpdate=this.handleNodeUpdate.bind(this),this.config={...s,error:this.handleError,chunk:this.handleChunk,complete:this.handleComplete}}onFileCompleted;file;readHeaders;nullString;onProgress;onError;types;chunks;totalChunks;isZip;shouldTrim;zipProgress;config;parse(){const e=this.isZip?this.file.nodeStream("nodebuffer",this.handleNodeUpdate):this.file;el.parse(e,this.config)}handleChunk(e,t){let{data:n}=e;if(!this.types){if(n==null||n.length===0){t.abort(),this.onError("Error parsing CSV: no data in file.");return}this.types=new Array(n[0].length).fill(rc),this.readHeaders&&(n=n.slice(1))}M(this.types);const s=[...this.types];n.forEach(a=>{if(a.length>=s.length){for(let r=0;r<s.length;r+=1)s[r]=Tt.determineType(this.shouldTrim?a[r].trim():a[r],s[r],this.nullString);this.types=s}else t.abort(),this.onError(`Error parsing CSV: Insufficient data in row.
|
|
4
4
|
Expected length ${s.length} but found ${a.length}.
|
|
@@ -35,9 +35,9 @@ ${a} does not exist yet.`}if(s){const{widgetName:o}=this.props;return`${o} is un
|
|
|
35
35
|
${vo.makeCirclePath(s,i,hh)}
|
|
36
36
|
${vo.makeCirclePath(o,a,hh)}`,I=`link-select-clip-${r}`,F=Math.atan2(a-T,o-w),N=F-ch+Math.PI,H=F+ch+Math.PI,P=o+Math.cos(F)*lh,O=a+Math.sin(F)*lh,k=P+Math.cos(N)*fa,L=O+Math.sin(N)*fa,A=P+Math.cos(H)*fa,U=O+Math.sin(H)*fa,j=`${P},${O} ${k},${L} ${A},${U}`,W=.25*s+.5*w+.25*o,ie=.25*i+.5*T+.25*a,se=w-s+(o-w),K=(T-i+(a-T))/se;let oe=20/Math.sqrt(1+K**2),de=oe*K,ee=oe*-1,re=de*-1;Number.isFinite(K)?K>0?(oe*=-1,de*=-1,ee*=-1,re*=-1,ee-=50-10*(Math.abs(m)%Cs),re+=10*(Math.abs(m)%Cs),oe-=50-10*(Math.abs(m)%Cs),de+=10*(Math.abs(m)%Cs)):K<0?(ee+=10*(Math.abs(m)%Cs),re+=10*(Math.abs(m)%Cs),oe+=10*(Math.abs(m)%Cs),de+=10*(Math.abs(m)%Cs)):(ee=15,re=10,oe=-25,de=10):(ee=10,re=5,oe=10,de=-35);let we="";return t!==void 0&&(t==="startsWith"?we="a*":t==="endsWith"?we="*z":we=R.getFilterOperatorString(t)),l.jsxs(l.Fragment,{children:[l.jsxs("svg",{className:$(e,{hovering:h}),children:[l.jsx("clipPath",{id:I,children:l.jsx("path",{d:E,clipRule:"evenodd"})}),l.jsx("path",{className:"link-select",d:y,onClick:this.handleClick,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,clipPath:`url(#${I})`}),l.jsx("path",{className:"link-background",d:y}),l.jsx("path",{className:"link-foreground",d:y}),l.jsx("circle",{className:"link-dot",cx:s,cy:i,r:"5"}),l.jsx("polygon",{className:"link-triangle",points:j})]}),c!=null&&n&&l.jsxs(l.Fragment,{children:[l.jsx(V,{kind:"primary",className:"btn-fab btn-operator",style:{top:ie+(K>=0?de:re),left:W+(K>=0?oe:ee)},onClick:()=>{},icon:l.jsxs("div",{className:"fa-md fa-layers",children:[l.jsx("b",{children:we}),l.jsx(J,{icon:kn,transform:"right-8 down-9 shrink-5"})]}),tooltip:"Change comparison operator",children:l.jsx(Zn,{actions:this.getDropdownActions,popperOptions:{placement:"bottom-start"}})}),l.jsx(V,{kind:"primary",className:"btn-fab btn-delete",style:{top:ie+(K<0?de:re),left:W+(K<0?oe:ee)},onClick:this.handleDelete,icon:Qt,tooltip:"Delete"})]})]})}}const Zr=Z.module("LinkerOverlayContent");class iR extends b.Component{static defaultProps={disabled:"false"};constructor(e){super(e),this.handleBlur=this.handleBlur.bind(this),this.handleResize=this.handleResize.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleKeyUp=this.handleKeyUp.bind(this),this.handleEscapePressed=this.handleEscapePressed.bind(this),this.handleOperatorChanged=this.handleOperatorChanged.bind(this),this.dialogRef=X.createRef(),this.state={mouse:void 0,dialog:void 0,offset:{x:0,y:0},isDragging:!1,mode:"select"}}componentDidMount(){window.addEventListener("blur",this.handleBlur,!0),window.addEventListener("mousemove",this.handleMouseMove,!0),window.addEventListener("mouseup",this.handleMouseUp,!0),window.addEventListener("keydown",this.handleKeyDown,!0),window.addEventListener("keyup",this.handleKeyUp,!0),window.addEventListener("resize",this.handleResize,!0)}componentDidCatch(e,t){Zr.error("componentDidCatch",e,t)}componentWillUnmount(){window.removeEventListener("blur",this.handleBlur,!0),window.removeEventListener("mousemove",this.handleMouseMove,!0),window.removeEventListener("mouseup",this.handleMouseUp,!0),window.removeEventListener("keydown",this.handleKeyDown,!0),window.removeEventListener("keyup",this.handleKeyUp,!0),window.removeEventListener("resize",this.handleResize,!0)}dialogRef;getPointFromLinkPoint(e){const{panelManager:t}=this.props,{panelId:n,columnName:s}=e,i=t.getOpenedPanelById(n);if(i!=null){if(!wm(i))throw new Error(`Panel does not have getCoordinateForColumn method: ${n}`);try{const a=i.getCoordinateForColumn(s);if(a!=null)return a}catch{Zr.error("Could not get coordinate for column",s,i)}}const o=t.getContainerByPanelId(n);if(o==null)throw new Error(`Unable to find panel container for id: ${n}`);return q.getTabPoint(o)}handleOperatorChanged(e,t){const{links:n,onLinksUpdated:s}=this.props,i=n.map(o=>o.id===e?{...o,operator:t}:o);s(i)}handleBlur(){this.setState({mode:"select"})}handleResize(){const{dialog:e}=this.state;if(e&&this.dialogRef.current){const t=this.dialogRef.current.getBoundingClientRect(),n=je(e.x,0,window.innerWidth-t.width),s=je(e.y,0,window.innerHeight-t.height);this.setState({dialog:{x:n,y:s}})}}handleMouseMove(e){const{offset:t,isDragging:n}=this.state;if(this.setState({mouse:{x:e.clientX,y:e.clientY}}),n&&this.dialogRef.current){const s=this.dialogRef.current.getBoundingClientRect(),i=je(window.innerWidth-(e.clientX+s.width+t.x),0,window.innerWidth-s.width),o=je(window.innerHeight-(e.clientY+s.height+t.y),0,window.innerHeight-s.height);this.setState({dialog:{x:i,y:o}})}}handleMouseDown(e){const t={x:0,y:0};if(this.dialogRef.current){const n=this.dialogRef.current.getBoundingClientRect();t.x=n.right-(n.width+e.clientX),t.y=n.bottom-(n.height+e.clientY)}this.setState({isDragging:!0,offset:t})}handleMouseUp(){this.setState({isDragging:!1})}handleKeyDown(e){if(e.key==="Alt")e.preventDefault(),this.setState({mode:"delete"});else if(e.key==="Delete"||e.key==="Backspace"){const{selectedIds:t,onLinkDeleted:n}=this.props;e.preventDefault(),t.forEach(s=>n(s))}}handleKeyUp(e){e.key==="Alt"&&(e.preventDefault(),this.setState({mode:"select"}))}handleEscapePressed(){const{onCancel:e}=this.props;e()}render(){const{disabled:e,links:t,selectedIds:n,messageText:s,onLinkSelected:i,onLinkDeleted:o,onAllLinksDeleted:a,onDone:r}=this.props,{mouse:c,dialog:h,isDragging:u,mode:m}=this.state,p=t.map(g=>{try{const{id:C,type:f,isReversed:S,start:v,end:w,operator:T}=g,y=v.columnType;let[E,I]=this.getPointFromLinkPoint(v),F=c?.x??E,N=c?.y??I;if(w!=null&&([F,N]=this.getPointFromLinkPoint(w)),S!=null&&S){const[P,O]=[E,I];[E,I]=[F,N],[F,N]=[P,O]}const H=$("linker-link",{disabled:e},{"link-filter-source":f==="filterSource"},{"link-invalid":f==="invalid"},{interactive:g.end==null},{"link-is-selected":n.has(C)},{"danger-delete":m==="delete"});return{x1:E,y1:I,x2:F,y2:N,id:C,className:H,operator:T,startColumnType:y}}catch(C){return Zr.warn("Unable to get point for link",g,C),null}}).filter(g=>g!=null);return l.jsxs("div",{className:$("linker-overlay",{"danger-delete":m==="delete"}),children:[p.map(({x1:g,y1:C,x2:f,y2:S,id:v,className:w,operator:T,startColumnType:y})=>l.jsx(vo,{className:w,id:v,x1:g,y1:C,x2:f,y2:S,onClick:i,onDelete:o,isSelected:n.has(v),operator:T,startColumnType:y,onOperatorChanged:this.handleOperatorChanged},v)),l.jsxs("div",{className:$("linker-toast-dialog",{dragging:u}),ref:this.dialogRef,style:{bottom:h?.y,right:h?.x},children:[l.jsx(V,{draggable:!0,kind:"inline",className:"btn-drag-handle",icon:Mo,onClick:()=>{},onMouseDown:this.handleMouseDown,children:!u&&l.jsx(tt,{children:"Drag to reposition"})}),l.jsx("div",{className:"toast-body",children:s}),l.jsxs("div",{className:"toast-footer",children:[l.jsx(V,{kind:"secondary",onClick:a,children:"Clear All"}),l.jsx(V,{kind:"primary",onClick:r,children:"Done"})]})]}),l.jsx(ae,{actions:[{action:this.handleEscapePressed,shortcut:es.LINKER_CLOSE,isGlobal:!0}]})]})}}const vt=Z.module("Linker"),oR=(d,e)=>({activeTool:cr(d),isolatedLinkerPanelId:fd(d,e.localDashboardId),links:Ki(d,e.localDashboardId),timeZone:Ao(d)}),aR=ft(oR,{setActiveTool:ur,setDashboardLinks:Sd,addDashboardLinks:ex,deleteDashboardLinks:tx,setDashboardIsolatedLinkerPanelId:fm,setDashboardColumnSelectionValidator:nx});class rR extends b.Component{constructor(e){super(e),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.handleLinksUpdated=this.handleLinksUpdated.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.handleLinkSelected=this.handleLinkSelected.bind(this),this.handlePanelDragging=this.handlePanelDragging.bind(this),this.handlePanelDropped=this.handlePanelDropped.bind(this),this.isColumnSelectionValid=this.isColumnSelectionValid.bind(this),this.state={linkInProgress:void 0,selectedIds:new Set,isDraggingPanel:!1}}componentDidMount(){const{layout:e}=this.props;this.startListening(e),this.updateSelectionValidators()}componentDidUpdate(e){const{activeTool:t,layout:n}=this.props;n!==e.layout&&(this.stopListening(e.layout),this.startListening(n)),t!==e.activeTool&&(this.updateSelectionValidators(),t===jt.DEFAULT&&this.reset())}componentDidCatch(e,t){vt.error("componentDidCatch",e,t)}componentWillUnmount(){const{layout:e}=this.props;this.stopListening(e)}startListening(e){e.on("stateChanged",this.handleLayoutStateChanged);const{eventHub:t}=e;t.on(Cn.COLUMN_SELECTED,this.handleGridColumnSelect),t.on(Cn.DATA_SELECTED,this.handleUpdateValues),t.on(Cn.STATE_CHANGED,this.handleStateChange),t.on(pl.COLUMN_SELECTED,this.handleChartColumnSelect),t.on(Ee.CLONED,this.handlePanelCloned),t.on(Qe.COLUMN_SELECTED,this.handleFilterColumnSelect),t.on(Qe.COLUMNS_CHANGED,this.handleColumnsChanged),t.on(Ee.CLOSE,this.handlePanelClosed),t.on(Ee.CLOSED,this.handlePanelClosed),t.on(Ee.DRAGGING,this.handlePanelDragging),t.on(Ee.DROPPED,this.handlePanelDropped)}stopListening(e){e.off("stateChanged",this.handleLayoutStateChanged);const{eventHub:t}=e;t.off(Cn.COLUMN_SELECTED,this.handleGridColumnSelect),t.off(Cn.DATA_SELECTED,this.handleUpdateValues),t.off(Cn.STATE_CHANGED,this.handleStateChange),t.off(pl.COLUMN_SELECTED,this.handleChartColumnSelect),t.off(Ee.CLONED,this.handlePanelCloned),t.off(Qe.COLUMN_SELECTED,this.handleFilterColumnSelect),t.off(Qe.COLUMNS_CHANGED,this.handleColumnsChanged),t.off(Ee.CLOSE,this.handlePanelClosed),t.off(Ee.CLOSED,this.handlePanelClosed),t.off(Ee.DRAGGING,this.handlePanelDragging),t.off(Ee.DROPPED,this.handlePanelDropped)}reset(){this.setState({linkInProgress:void 0,selectedIds:new Set})}handleCancel(){const{linkInProgress:e}=this.state;if(e==null){const{setActiveTool:t}=this.props;t(jt.DEFAULT)}this.setState({linkInProgress:void 0})}handleDone(){const{setActiveTool:e}=this.props;e(jt.DEFAULT)}handleChartColumnSelect(e,t){this.columnSelected(e,t,!0)}handleFilterColumnSelect(e,t){vt.debug("handleFilterColumnSelect",this.isOverlayShown());const{links:n,localDashboardId:s,setActiveTool:i,setDashboardIsolatedLinkerPanelId:o}=this.props,a=q.getIdFromPanel(e),r=n.filter(c=>c.start?.panelId===a||c.end?.panelId===a);if(!this.isOverlayShown()&&a!=null){i(jt.LINKER),o(s,a),r.length===0&&this.columnSelected(e,t,!0,a);return}this.columnSelected(e,t,!0)}handleColumnsChanged(e,t){vt.debug("handleColumnsChanged",e,t);const{links:n}=this.props,s=q.getIdFromPanel(e);if(s==null){vt.error("Invalid panelId",e);return}const i=n.filter(({start:o,end:a})=>o.panelId===s&&ys.findColumn(t,o)==null||a!=null&&a.panelId===s&&ys.findColumn(t,a)==null);this.deleteLinks(i)}handleGridColumnSelect(e,t){if(!oh(t)){vt.debug2("Column is not filterable");return}this.columnSelected(e,t)}columnSelected(e,t,n=!1,s){if(s===void 0&&!this.isOverlayShown())return;const{isolatedLinkerPanelId:i}=this.props,{linkInProgress:o}=this.state,a=q.getIdFromPanel(e);if(a==null)return;const r=q.getComponentNameFromPanel(e),{name:c,type:h}=t;if(o==null||o.start==null){const u={id:Pe.generate(),start:{panelId:a,panelComponent:r,columnName:c,columnType:h},type:"invalid",isReversed:n};vt.debug("starting link",u),this.setState({linkInProgress:u})}else{const{links:u}=this.props,{start:m,id:p,isReversed:g}=o,C={panelId:a,panelComponent:r,columnName:c,columnType:h},f=ys.getLinkType(g!==void 0&&g?C:m,g!==void 0&&g?m:C,s??i);switch(f){case"invalid":vt.debug("Ignore invalid link connection",o,C);return;case"filterSource":{const v=g!==void 0&&g?m.panelId:C.panelId,w=u.filter(({end:T})=>T?.panelId===v);this.deleteLinks(w);break}}const S={start:g!==void 0&&g?C:m,end:g!==void 0&&g?m:C,id:p,type:f,operator:Y.eq};vt.info("creating link",S),this.setState({linkInProgress:void 0,selectedIds:new Set([p])},()=>{this.addLinks([S])})}}unsetFilterValueForLink(e){const{panelManager:t}=this.props;if(e.end){const{end:n}=e,{panelId:s,columnName:i,columnType:o}=n,a=t.getOpenedPanelById(s);a?ih(a)?a.unsetFilterValue(i,o):vt.debug("endPanel.unsetFilterValue not implemented",a):vt.debug("endPanel no longer exists, ignoring unsetFilterValue",s)}}setPanelFilterMap(e,t){vt.debug("Set filter data for panel:",e,t);const{panelManager:n}=this.props,s=n.getOpenedPanelById(e);s?ih(s)?s.setFilterMap(t):vt.debug("panel.setFilterMap not implemented",e,s):vt.debug("panel no longer exists, ignoring setFilterMap",e)}addLinks(e){const{addDashboardLinks:t,localDashboardId:n}=this.props;t(n,e)}deleteLinks(e,t=!1){const{localDashboardId:n}=this.props;if(e.forEach(s=>this.unsetFilterValueForLink(s)),t){const{setDashboardLinks:s}=this.props;s(n,[])}else if(e.length>0){const{deleteDashboardLinks:s}=this.props;s(n,e.map(({id:i})=>i))}}handleAllLinksDeleted(){const{links:e,isolatedLinkerPanelId:t}=this.props;if(t===void 0)this.deleteLinks(e,!0);else{const n=e.filter(s=>s?.start?.panelId===t||s?.end?.panelId===t);this.deleteLinks(n)}this.reset()}handleLinkDeleted(e){const{links:t}=this.props,n=t.find(s=>s.id===e);n?this.deleteLinks([n]):vt.error("Unable to find link to delete",e)}handleUpdateValues(e,t){const n=q.getIdFromPanel(e),{links:s,timeZone:i}=this.props,o=new Map;for(let a=0;a<s.length;a+=1){const{start:r,end:c,operator:h}=s[a];if(r.panelId===n&&c!=null){const{panelId:u,columnName:m,columnType:p}=c,g=o.has(u)?o.get(u):new Map,C=g.has(m)===!0?g.get(m).filterList:[],{visibleIndex:f,isExpandable:S,isGrouped:v}=t[r.columnName];let{value:w}=t[r.columnName],T=`${w}`;w===null&&S&&v&&(w=void 0),p!=null&&R.isDateType(p)&&(T=new _e({timeZone:i,showTimeZone:!1,showTSeparator:!0,defaultDateTimeFormatString:et.FULL_DATE_FORMAT}).format(w));const y={operator:h,text:T,value:w,startColumnIndex:f};C.push(y),g.set(m,{columnType:p,filterList:C}),o.set(u,g)}}o.forEach((a,r)=>{this.setPanelFilterMap(r,a)})}handlePanelCloned(e,t){const{links:n}=this.props,s=q.getIdFromPanel(e),i=t.id;if(s!=null){const o=ys.cloneLinksForPanel(n,s,i);this.addLinks(o)}}handlePanelDragging(e){const{links:t}=this.props;for(let n=0;n<t.length;n+=1){const s=t[n],{start:i,end:o}=s;if(i.panelId===e||o?.panelId===e){this.setState({isDraggingPanel:!0});return}}}handlePanelDropped(){this.setState({isDraggingPanel:!1})}handlePanelClosed(e){vt.debug(`Panel ${e} closed, deleting links.`),this.deleteLinksForPanelId(e)}handleLinkSelected(e){this.setState({selectedIds:new Set([e])})}handleLinksUpdated(e){const{localDashboardId:t,setDashboardLinks:n}=this.props;n(t,e)}handleLayoutStateChanged(){this.forceUpdate()}handleStateChange(){this.forceUpdate()}handleExited(){const{localDashboardId:e,setDashboardIsolatedLinkerPanelId:t}=this.props;t(e,void 0)}deleteLinksForPanelId(e){const{links:t}=this.props;for(let n=0;n<t.length;n+=1){const s=t[n],{start:i,end:o,id:a}=s;(i.panelId===e||o?.panelId===e)&&this.handleLinkDeleted(a)}}getCachedLinks=fe((e,t,n)=>{const s=[...e];return t!=null&&t.start!=null&&s.push(t),n!==void 0?s.filter(i=>i?.start?.panelId===n||i?.end?.panelId===n||i?.end==null):s});isOverlayShown(){const{activeTool:e}=this.props;return e===jt.LINKER}updateSelectionValidators(){const{activeTool:e,setDashboardColumnSelectionValidator:t,localDashboardId:n}=this.props;switch(e){case jt.LINKER:t(n,this.isColumnSelectionValid);break;default:t(n,void 0);break}}updateLinkInProgressType(e,t="invalid"){this.setState({linkInProgress:{...e,type:t}})}isColumnSelectionValid(e,t){const{linkInProgress:n}=this.state,{isolatedLinkerPanelId:s}=this.props;if(t==null)return n?.start!=null&&this.updateLinkInProgressType(n),!1;if(!oh(t))return vt.debug2("Column is not filterable",t.description),n?.start!=null&&this.updateLinkInProgressType(n,"invalid"),!1;if(n?.start==null)return!0;const{isReversed:i,start:o}=n,a=q.getIdFromPanel(e);if(a==null)return!1;const r={panelId:a,panelComponent:q.getComponentNameFromPanel(e),columnName:t.name,columnType:t.type},c=i!==void 0&&i?ys.getLinkType(r,o,s):ys.getLinkType(o,r,s);return this.updateLinkInProgressType(n,c),c!=="invalid"}render(){const{links:e,isolatedLinkerPanelId:t,panelManager:n}=this.props,{linkInProgress:s,selectedIds:i,isDraggingPanel:o}=this.state,a=this.isOverlayShown(),r=s!=null&&s.start!=null,c=t===void 0?"Click a column source, then click a column target to create a filter link. The filter comparison operator used by a selected link can be changed. Delete a filter link by clicking the delete button or with alt+click. Click done when finished.":"Create a link between the source column button and a table column by clicking on one, then the other. Delete a filter link by clicking the delete button or with alt+click. Click done when finished.";return o?null:l.jsx(gt,{in:a,timeout:We.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,onExited:this.handleExited,children:l.jsx(iR,{disabled:r,panelManager:n,links:this.getCachedLinks(e,s,t),selectedIds:i,messageText:c,onLinkSelected:this.handleLinkSelected,onLinkDeleted:this.handleLinkDeleted,onAllLinksDeleted:this.handleAllLinksDeleted,onLinksUpdated:this.handleLinksUpdated,onDone:this.handleDone,onCancel:this.handleCancel})})}}const lR=aR(rR);function dR(d){Ps(d);const{id:e,layout:t,panelManager:n}=d;return l.jsx(lR,{layout:t,localDashboardId:e,panelManager:n})}class Li{static DEFAULT_TITLE="Note";static DEFAULT_CONTENT=`# Markdown Note
|
|
37
37
|
|
|
38
|
-
This note can be edited using **markdown** for styling.`;static getNewMarkdownTitle(e){let t=`${Li.DEFAULT_TITLE}`,n=0;for(;e.indexOf(t)>=0;)n+=1,t=`${Li.DEFAULT_TITLE}-${n}`;return t}}function cR(d){Ps(d);const{id:e,layout:t,panelManager:n,registerComponent:s}=d,i=b.useCallback(a=>{const{title:r,componentState:c,props:h}=a;let{panelState:u=null}=h;return c!=null&&({panelState:u=null}=c),r==null||u==null||u.content==null||u.content.length===0||u.content===Li.DEFAULT_CONTENT?null:Ql(a)},[]),o=b.useCallback(({title:a="",metadata:r={},id:c=Pe.generate(),focusElement:h=q.DEFAULT_FOCUS_SELECTOR,createNewStack:u=!1,dragEvent:m=null}={})=>{const p=n.getOpenedPanelConfigsOfType(co.COMPONENT),g=n.getClosedPanelConfigsOfType(co.COMPONENT),C=p.map(T=>T.title??""),f=a!=null&&a!==""?a:Li.getNewMarkdownTitle(C),S=g.length>0?null:Li.DEFAULT_CONTENT,v={type:"react-component",component:co.COMPONENT,props:{id:c,metadata:r,panelState:{content:S},localDashboardId:e},title:f,id:c},{root:w}=t;q.openComponent({root:w,config:v,focusElement:h,createNewStack:u,dragEvent:m})},[e,t,n]);return b.useEffect(function(){const r=[s(co.COMPONENT,co,Jl,i)];return()=>{r.forEach(c=>c())}},[i,s]),Ue(t.eventHub,pm.OPEN,o),null}function hR(d){Ps(d);const{hydrate:e,id:t,layout:n,registerComponent:s}=d,i=b.useCallback(({dragEvent:o,fetch:a,panelId:r=Pe.generate(),widget:c})=>{const{name:h,type:u}=c;if(u!==dh.VariableType.PANDAS)return;const m={name:h,table:h},p=()=>a().then(f=>ud.makeModel(f)),g={type:"react-component",component:Xr.COMPONENT,props:{localDashboardId:t,id:r,metadata:m,makeModel:p},title:h,id:r},{root:C}=n;q.openComponent({root:C,config:g,dragEvent:o})},[t,n]);return b.useEffect(function(){const a=[s(Xr.COMPONENT,Xr,e)];return()=>{a.forEach(r=>r())}},[e,s]),Ue(n.eventHub,Ee.OPEN,i),null}class Is{static DROPDOWN_FILTER="ControlType.DROPDOWN_FILTER";static INPUT_FILTER="ControlType.INPUT_FILTER";static MARKDOWN="ControlType.MARKDOWN";static FILTER_SET_MANAGER="ControlType.FILTER_SET_MANAGER"}D.shape({state:D.shape({panelState:D.shape({})})});D.shape({panelId:D.string.isRequired,columnName:D.string.isRequired,columnType:D.string.isRequired});const uh=D.shape({panelId:D.string.isRequired,columnName:D.string.isRequired}),uR=D.shape({start:uh,end:uh,id:D.string,isReversed:D.bool});D.arrayOf(uR);D.shape({name:D.string.isRequired,operateAs:D.string.isRequired,groups:D.arrayOf(D.string).isRequired,permissions:D.shape({isSuperUser:D.bool.isRequired,isQueryViewOnly:D.bool.isRequired,isNonInteractive:D.bool.isRequired,canUsePanels:D.bool.isRequired,canCreateDashboard:D.bool.isRequired,canCreateCodeStudio:D.bool.isRequired,canCreateQueryMonitor:D.bool.isRequired,canCopy:D.bool.isRequired,canDownloadCsv:D.bool.isRequired}).isRequired});Z.module("StorageTableViewportUpdater");class mh{static makeSortConfig(e,t){return{column:e,direction:t}}static makeFilterConfig(e){const t=[],n=[];return e.forEach((s,i)=>{t.push(s),i>0&&n.push(Sn.and)}),{filterItems:t,filterOperators:n}}static combineFilterConfigs(e,t,n=Sn.and){return{filterItems:[...e.filterItems,...t.filterItems],filterOperators:[...e.filterOperators,n,...t.filterOperators]}}static makeFilterItem(e,t,n){return{columnName:e,type:t,value:n}}}const Qr=Z.module("PouchStorageTable"),mR="Deephaven.";Th.plugin(dp);function pR(d,e){switch(d){case Y.in:case Y.contains:return{$regex:new RegExp(`${e}`)};case Y.inIgnoreCase:return{$regex:new RegExp(`${e}`,"i")};case Y.eq:return{$eq:e};case Y.notEq:return{$neq:e};case Y.greaterThan:return{$gt:e};case Y.greaterThanOrEqualTo:return{$gte:e};case Y.lessThan:return{$lt:e};case Y.lessThanOrEqualTo:return{$lte:e};case Y.startsWith:return{$regex:new RegExp(`^(?${e}).*`)};default:throw new Error(`Unsupported type: ${d}`)}}function gR(d){const{filterItems:e,filterOperators:t}=d;let n=null;for(let s=0;s<e.length;s+=1){const i=e[s],{columnName:o,type:a,value:r}=i,c={[o]:pR(a,r)};if(s===0)n=c;else if(n!==null&&s-1<t.length){const h=t[s-1];if(h===Sn.and)n={$and:[n,c]};else if(h===Sn.or)n={$or:[n,c]};else throw new Error(`Unexpected filter operator ${h}, ${c}`)}}if(n==null)throw new Error(`Invalid filter config ${d}`);return n}function Jr(d=[]){return{$and:[...d.map(e=>gR(e)),{name:{$gt:null}},{id:{$gt:null}}]}}function fR(d,e=!1){return[{id:e?"desc":"asc"},...d?.map(t=>({[t.column]:t.direction}))??[]]}class CR{db;listeners=[];itemListeners=new Map;currentSize=0;currentViewport;currentReverse=!1;currentFilter=null;currentSort=null;infoUpdatePromise;viewportUpdatePromise;currentViewportData;constructor(e){this.db=new Th(`${mR}${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(t=>t!==e)}}onItemUpdate(e,t){return this.itemListeners.has(e)||this.itemListeners.set(e,[]),this.itemListeners.set(e,[...this.itemListeners.get(e),t]),this.refreshItem(e),()=>{this.itemListeners.set(e,this.itemListeners.get(e).filter(n=>n!==t))}}close(){this.listeners=[]}get size(){return this.currentSize}get viewport(){return this.currentViewport}setReversed(e){this.currentReverse=e,this.currentViewportData=void 0,this.refreshData()}setViewport(e){this.currentViewport=e,this.refreshInfo(),this.refreshData()}setSorts(e){this.currentSort=e,this.currentViewportData=void 0,this.refreshData()}setFilters(e){this.currentFilter=e,this.currentViewportData=void 0,this.refreshInfo(),this.refreshData()}get data(){return this.currentViewportData}async getViewportData(){return this.viewportUpdatePromise||this.refreshData(),this.viewportUpdatePromise??Promise.resolve({items:[],offset:0})}async put(e){const t={...e,_id:e.id};return await this.db.put(t),t}sendUpdate(){const{listeners:e}=this,t=this.currentViewportData??{items:[],offset:0};for(let n=0;n<e.length;n+=1)e[n](t)}sendItemUpdate(e){const t=this.itemListeners.get(e.id);if(t!==void 0)for(let n=0;n<t.length;n+=1)t[n](e)}dbUpdate(e){Qr.debug("Update received",e),this.refreshInfo(),e.doc!==void 0&&this.sendItemUpdate(e.doc),this.refreshData()}async refreshInfo(){try{this.infoUpdatePromise?.cancel(),this.infoUpdatePromise=ve.makeCancelable(this.db.find({selector:Jr(this.currentFilter??[]),fields:[]}));const e=await this.infoUpdatePromise;this.currentSize=e.docs.length,this.sendUpdate()}catch(e){if(!ve.isCanceled(e))throw Qr.error("Unable to refreshInfo",e),e}}async refreshData(){if(this.currentViewport)try{const{currentViewport:e}=this,t=fR(this.currentSort,this.currentReverse);this.viewportUpdatePromise?.cancel(),this.viewportUpdatePromise=ve.makeCancelable(this.db.find({selector:Jr(this.currentFilter??[]),skip:e.top,limit:e.bottom-e.top+1,sort:t,fields:["id","name"]}).then(s=>({items:s.docs,offset:e.top})));const n=await this.viewportUpdatePromise;return this.currentViewportData=n,this.sendUpdate(),n}catch(e){if(!ve.isCanceled(e))throw Qr.error("Unable to refreshData",e),e}}async refreshItem(e){const n=(await this.db.find({selector:{id:e},limit:1})).docs[0];return n!==void 0&&this.sendItemUpdate(n),n}async getSnapshot(e){const t=new Map,n=[{id:this.currentReverse?"desc":"asc"}];return await Promise.all(e.map(async([s,i])=>{const o=i-s+1;return this.db.find({selector:Jr(this.currentFilter??[]),skip:s,limit:o,sort:n,fields:["id","name"]}).then(a=>{for(let r=0;r<o;r+=1){const c=s+r;t.set(c,a.docs[r])}})})),t}}class ph extends CR{constructor(e){super(`CommandHistoryStorage.${e}`)}setSearch(e){this.setFilters(e?[mh.makeFilterConfig([mh.makeFilterItem("name",Y.contains,e)])]:[])}}const gh=Z.module("PouchCommandHistoryStorage");class SR{updateTableMap=new Map;getUpdateTable(e){return this.updateTableMap.has(e)||this.updateTableMap.set(e,new ph(e)),this.updateTableMap.get(e)}async getTable(e){return new ph(e)}async addItem(e,t,n,s){return this.updateItem(e,{id:`${new Date().getTime()}`,name:n,data:s})}async updateItem(e,t){const n=this.getUpdateTable(e),i={...await n.refreshItem(t.id)??{},...t};return gh.debug("Updating item",i),await n.put(i),gh.debug("Update saved"),t}listenItem(e,t,n){return this.getUpdateTable(e).onItemUpdate(t,n)}}const Em="SET_LAYOUT_STORAGE",bR=d=>({type:Em,payload:d}),ym="/ide/assets/community-wordmark-app-d2c5c1eb.svg";const wR=Z.module("FormattingSectionContent");function vR(d){return d.formatString!=null}function Sl(d){const e=d?.querySelector("input, select, textarea");e&&e.focus()}function xm(d,e){return d.defaultFormatString===e.defaultFormatString}function TR(d,e){return xm(d,e)}function ER(d,e){return xm(d,e)}function Rm(d){return d!==""&&cn.isValidColumnName(d)}function Ds(d,e){if(!d||e.formatString==null||!vR(e))return!1;switch(d){case"datetime":return _e.isValid(e);case"decimal":return Re.isValid(e);case"int":return $e.isValid(e);default:return wR.warn("Trying to validate format of unknown type"),!0}}function Im(d){const{id:e,isNewRule:t,...n}=d;return n}function Dm(d){return Rm(d.columnName)&&Ds(d.columnType,d.format)}function Fm(d){const{timestamp:e,timeZone:t,showTimeZone:n,showTSeparator:s,isGlobalOptions:i,legacyGlobalFormat:o}=d,a=new Zt([],{timeZone:t,showTimeZone:n,showTSeparator:s}),r=i?_e.getGlobalFormats(n,s):_e.getFormats(n,s);return o!=null&&!r.includes(o)&&r.unshift(o),l.jsx(l.Fragment,{children:r.map(c=>{const h=_e.makeFormat("",c,_e.TYPE_GLOBAL);return l.jsx("option",{value:c,"data-testid":"time-format",children:a.getFormattedString(e,R.dataType.DATETIME,"",h)},c)})})}function yR(){return l.jsx(l.Fragment,{children:Wi.TIME_ZONES.map(d=>{const{label:e,value:t}=d;return l.jsx("option",{value:t,children:e},t)})})}const Ys=Z.module("FormattingSectionContent");class yd extends b.PureComponent{static defaultProps={scrollTo:()=>{},defaults:{defaultDateTimeFormat:_e.DEFAULT_DATETIME_FORMAT_STRING,defaultDecimalFormatOptions:{defaultFormatString:Re.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:$e.DEFAULT_FORMAT_STRING},showTimeZone:!1,showTSeparator:!0,timeZone:_e.DEFAULT_TIME_ZONE_ID}};static inputDebounceTime=250;constructor(e){super(e),this.debouncedCommitChanges=Ye(this.commitChanges.bind(this),yd.inputDebounceTime),this.handleDefaultDateTimeFormatChange=this.handleDefaultDateTimeFormatChange.bind(this),this.handleDefaultDecimalFormatChange=this.handleDefaultDecimalFormatChange.bind(this),this.handleDefaultIntegerFormatChange=this.handleDefaultIntegerFormatChange.bind(this),this.handleShowTimeZoneChange=this.handleShowTimeZoneChange.bind(this),this.handleShowTSeparatorChange=this.handleShowTSeparatorChange.bind(this),this.handleTimeZoneChange=this.handleTimeZoneChange.bind(this),this.handleResetDateTimeFormat=this.handleResetDateTimeFormat.bind(this),this.handleResetDecimalFormat=this.handleResetDecimalFormat.bind(this),this.handleResetIntegerFormat=this.handleResetIntegerFormat.bind(this),this.handleResetTimeZone=this.handleResetTimeZone.bind(this),this.handleTruncateNumbersWithPoundChange=this.handleTruncateNumbersWithPoundChange.bind(this);const{formatter:t,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,showTimeZone:o,showTSeparator:a,timeZone:r,truncateNumbersWithPound:c}=e,h=t.map((u,m)=>({...u,id:m}));this.containerRef=X.createRef(),this.state={formatSettings:h,showTimeZone:o,showTSeparator:a,timeZone:r,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,truncateNumbersWithPound:c,timestampAtMenuOpen:new Date}}componentDidMount(){Sl(this.containerRef.current)}componentWillUnmount(){this.debouncedCommitChanges.flush()}debouncedCommitChanges;containerRef;getCachedDateTimeFormatOptions=pe((e,t,n,s=!1,i)=>{const{timestampAtMenuOpen:o}=this.state;return l.jsx(Fm,{timestamp:o,timeZone:e,showTimeZone:t,showTSeparator:n,isGlobalOptions:s,legacyGlobalFormat:i})});handleDefaultDateTimeFormatChange(e){Ys.debug("handleDefaultDateTimeFormatChange",e.target.value),this.setState({defaultDateTimeFormat:e.target.value},()=>{this.debouncedCommitChanges()})}handleDefaultDecimalFormatChange(e){Ys.debug("handleDefaultDecimalFormatChange",e.target.value),this.setState({defaultDecimalFormatOptions:{defaultFormatString:e.target.value}},()=>{this.debouncedCommitChanges()})}handleDefaultIntegerFormatChange(e){Ys.debug("handleDefaultIntegerFormatChange",e.target.value),this.setState({defaultIntegerFormatOptions:{defaultFormatString:e.target.value}},()=>{this.debouncedCommitChanges()})}handleShowTimeZoneChange(){this.setState(e=>({showTimeZone:!e.showTimeZone}),()=>{this.debouncedCommitChanges()})}handleShowTSeparatorChange(){this.setState(e=>({showTSeparator:!e.showTSeparator}),()=>{this.debouncedCommitChanges()})}handleTimeZoneChange(e){this.setState({timeZone:e.target.value},()=>{this.debouncedCommitChanges()})}handleResetDateTimeFormat(){const{defaults:e}=this.props,{defaultDateTimeFormat:t,showTimeZone:n,showTSeparator:s}=e;Ys.debug("handleResetDateTimeFormat"),this.setState({defaultDateTimeFormat:t,showTimeZone:n,showTSeparator:s},()=>{this.debouncedCommitChanges()})}handleResetTimeZone(){const{defaults:e}=this.props,{timeZone:t}=e;Ys.debug("handleResetTimeZone"),this.setState({timeZone:t},()=>{this.debouncedCommitChanges()})}handleResetDecimalFormat(){const{defaults:e}=this.props,{defaultDecimalFormatOptions:t}=e;Ys.debug("handleResetDecimalFormat"),this.setState({defaultDecimalFormatOptions:t},()=>{this.debouncedCommitChanges()})}handleResetIntegerFormat(){const{defaults:e}=this.props,{defaultIntegerFormatOptions:t}=e;Ys.debug("handleResetIntegerFormat"),this.setState({defaultIntegerFormatOptions:t},()=>{this.debouncedCommitChanges()})}handleTruncateNumbersWithPoundChange(){this.setState(e=>({truncateNumbersWithPound:!e.truncateNumbersWithPound}),()=>{this.debouncedCommitChanges()})}commitChanges(){const{formatSettings:e,defaultDateTimeFormat:t,showTimeZone:n,showTSeparator:s,timeZone:i,defaultDecimalFormatOptions:o,defaultIntegerFormatOptions:a,truncateNumbersWithPound:r}=this.state,c=e.filter(Dm).map(Im)??[],{settings:h,saveSettings:u}=this.props,m={...h,formatter:c,defaultDateTimeFormat:t,showTimeZone:n,showTSeparator:s,timeZone:i,truncateNumbersWithPound:r};Ds(R.dataType.DECIMAL,Re.makeCustomFormat(o.defaultFormatString))&&(m.defaultDecimalFormatOptions=o),Ds(R.dataType.INT,$e.makeCustomFormat(a.defaultFormatString))&&(m.defaultIntegerFormatOptions=a),u(m)}render(){const{defaults:e}=this.props,{defaultDateTimeFormat:t,defaultDecimalFormatOptions:n,defaultIntegerFormatOptions:s,timeZone:i,showTimeZone:o,showTSeparator:a,truncateNumbersWithPound:r}=this.state,{defaultFormatString:c=Re.DEFAULT_FORMAT_STRING}=n??{},{defaultFormatString:h=$e.DEFAULT_FORMAT_STRING}=s??{},u=i===e.timeZone,m=a===e.showTSeparator&&o===e.showTimeZone&&t===e.defaultDateTimeFormat,p=TR(n,e.defaultDecimalFormatOptions),g=ER(s,e.defaultIntegerFormatOptions);return l.jsx("div",{className:"app-settings-formatting-section",ref:this.containerRef,children:l.jsxs("div",{className:"container-fluid p-0",children:[l.jsx("div",{className:"app-settings-menu-description mb-3",children:"Choose the default formatting rule to apply to all table columns based on their type."}),l.jsxs("div",{className:"form-row mb-2",children:[l.jsx("label",{className:"col-form-label col-3",htmlFor:"select-reset-timezone",children:"Time zone"}),l.jsx("div",{className:"col pr-0",children:l.jsx("select",{className:"custom-select",value:i,onChange:this.handleTimeZoneChange,id:"select-reset-timezone",children:l.jsx(yR,{})})}),l.jsx("div",{className:"col-1 btn-col",children:l.jsx(V,{kind:"ghost",icon:ei,onClick:this.handleResetTimeZone,tooltip:"Reset Time Zone",className:$("btn-reset","btn-reset-time-zone",{hidden:u})})})]}),l.jsxs("div",{className:"form-row mb-2",children:[l.jsx("label",{className:"col-form-label col-3",htmlFor:"select-default-time-format",children:"DateTime"}),l.jsx("div",{className:"col pr-0",children:l.jsx("select",{className:"custom-select",value:t,onChange:this.handleDefaultDateTimeFormatChange,id:"select-default-time-format",children:this.getCachedDateTimeFormatOptions(i,o,a,!0,t)})}),l.jsx("div",{className:"col-1 btn-col",children:l.jsx(V,{kind:"ghost",icon:ei,onClick:this.handleResetDateTimeFormat,tooltip:"Reset DateTime Options",className:$("btn-reset","btn-reset-date-time",{hidden:m})})})]}),l.jsx("div",{className:"form-row",children:l.jsx("div",{className:"offset-3 col-9",children:l.jsx(Xt,{checked:o??null,onChange:this.handleShowTimeZoneChange,children:"Show time zone in dates"})})}),l.jsx("div",{className:"form-row mb-3",children:l.jsx("div",{className:"offset-3 col-9",children:l.jsx(Xt,{checked:a??null,onChange:this.handleShowTSeparatorChange,children:"Show 'T' separator"})})}),l.jsxs("div",{className:"form-row mb-2",children:[l.jsx("label",{className:"col-form-label col-3",htmlFor:"default-decimal-format-input",children:"Decimal"}),l.jsx("div",{className:"col pr-0",children:l.jsx("input",{className:$("form-control","flex-grow-1","default-decimal-format-input",{"is-invalid":!Ds(R.dataType.DECIMAL,Re.makeCustomFormat(c))}),"data-lpignore":!0,placeholder:Re.DEFAULT_FORMAT_STRING,type:"text",id:"default-decimal-format-input",value:c,onChange:this.handleDefaultDecimalFormatChange})}),l.jsx("div",{className:"col-1 btn-col",children:l.jsx(V,{kind:"ghost",icon:ei,onClick:this.handleResetDecimalFormat,tooltip:"Reset Decimal Formatting",className:$("btn-reset","btn-reset-decimal",{hidden:p}),"data-testid":"btn-reset-decimal"})})]}),l.jsxs("div",{className:"form-row mb-2",children:[l.jsx("label",{className:"col-form-label col-3",htmlFor:"default-integer-format-input",children:"Integer"}),l.jsx("div",{className:"col pr-0",children:l.jsx("input",{className:$("form-control","flex-grow-1","default-integer-format-input",{"is-invalid":!Ds(R.dataType.INT,$e.makeCustomFormat(h))}),"data-lpignore":!0,placeholder:$e.DEFAULT_FORMAT_STRING,type:"text",id:"default-integer-format-input",value:h,onChange:this.handleDefaultIntegerFormatChange})}),l.jsx("div",{className:"col-1 btn-col",children:l.jsx(V,{kind:"ghost",icon:ei,onClick:this.handleResetIntegerFormat,tooltip:"Reset Integer Formatting",className:$("btn-reset","btn-reset-integer",{hidden:g}),"data-testid":"btn-reset-integer"})})]}),l.jsx("div",{className:"form-row mb-3",children:l.jsx("div",{className:"offset-3 col-9",children:l.jsx(Xt,{checked:r??null,onChange:this.handleTruncateNumbersWithPoundChange,children:"Truncate numbers with #"})})})]})})}}const xR=d=>({formatter:cu(d),defaultDateTimeFormat:ru(d),defaultDecimalFormatOptions:lu(d),defaultIntegerFormatOptions:du(d),showTimeZone:hu(d),showTSeparator:uu(d),truncateNumbersWithPound:mu(d),timeZone:Ao(d),settings:Ct(d)}),RR=ft(xR,{saveSettings:hr})(yd);function IR(){const[d,e]=b.useState(!1),t=()=>{e(!d)};return l.jsxs(V,{kind:"ghost",onClick:t,icon:bg,children:["Legal Notices",l.jsxs(Do,{isOpen:d,toggle:t,className:"theme-bg-light",children:[l.jsx(Fo,{toggle:t,children:"Legal Notice"}),l.jsxs(No,{children:[l.jsx("p",{children:"Deephaven software is protected by U.S. Patent Nos. 9,612,959; 9,613,018; 9,613,109; 9,619,210; 9,633,060; 9,639,570; 9,672,238; 9,679,006; 9,690,821; 9,710,511; 9,760,591; 9,805,084; 9,836,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."}),l.jsxs("p",{children:["© 2016-",new Date().getFullYear()," Deephaven Data Labs LLC. Patent Pending."]})]})]})]})}function To(d){const{children:e,isExpanded:t,sectionKey:n,title:s,onToggle:i}=d;return l.jsxs(l.Fragment,{children:[l.jsx("div",{children:l.jsxs(V,{kind:"ghost",className:"btn-collapse-trigger",onClick:()=>i(n),children:[l.jsx("div",{className:"flex-grow-1",children:s}),l.jsx("div",{className:"flex-shrink-0",children:l.jsx(J,{transform:t?"flip-v":"",icon:kn})})]})}),l.jsx(lf,{in:t,autoFocusOnShow:!0,children:e})]})}To.propTypes={children:D.node,isExpanded:D.bool.isRequired,sectionKey:D.string.isRequired,title:D.node.isRequired,onToggle:D.func};To.defaultProps={children:null,onToggle:()=>{}};function DR({shortcut:d,displayText:e,categoryName:t,onChange:n}){const[s,i]=b.useState(e),[o,a]=b.useState(d.getKeyState()),[r,c]=b.useState(!1),[h,u]=b.useState("");b.useEffect(function(){i(e),a(d.getKeyState())},[e,d]),b.useEffect(function(){i(ke.getDisplayText(o)),d.matchesKeyState(o)&&c(!1)},[o,d]),b.useEffect(function(){if(r){if(!ke.isValidKeyState(o)){ke.isAllowedKey(o.keyValue)?u("Must contain a modifier key"):u("Must contain an allowed action key");return}const T=Fe.getConflictingShortcuts(o).filter(y=>y.id.startsWith(t)&&y!==d).map(y=>y.name);if(T.length){u(`Conflicts with ${T.join(", ")}`);return}u("")}else u("")},[r,o,t,d]);function m(w){if(w.stopPropagation(),w.preventDefault(),d.isEditable&&!w.repeat){const T=ke.getKeyStateFromEvent(w),y=ke.createKeyState([ue.BACKSPACE]);ke.doKeyStatesMatch(T,y)?a(ke.NULL_KEY_STATE):a(T)}}function p(w){w.stopPropagation(),w.preventDefault(),d.matchesKeyState(o)||c(!0)}function g(){He.disableAllActions()}function C(){He.enableAllActions()}function f(){d.setKeyState(o),c(!1),n(d)}function S(){const w=d.getKeyState();a(w),c(!1)}function v(){c(!0),a(d.getDefaultKeyState())}return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"shortcut-item-container",children:[l.jsxs("label",{className:"shortcut-item-name",children:[d.name,d.tooltip!==void 0&&l.jsx(tt,{children:d.tooltip})]}),l.jsxs("div",{className:"shortcut-item-input-container",children:[l.jsx("input",{className:$("form-control",{"is-invalid":h}),onKeyDown:m,onKeyUp:p,onFocus:g,onBlur:C,disabled:!d.isEditable,value:s,readOnly:!0}),!ke.doKeyStatesMatch(o,d.getDefaultKeyState())&&!h&&l.jsx(V,{className:"reset-to-default-button",kind:"ghost",icon:l.jsx(J,{icon:ei,transform:{rotate:90,flipX:!0}}),tooltip:"Reset to default",onClick:v})]})]}),r&&l.jsxs("div",{className:$("shortcut-item-message-container",{"is-invalid":h}),children:[l.jsx("div",{className:"shortcut-item-message",children:h}),l.jsxs("div",{className:"shortcut-item-message-buttons",children:[ke.isValidKeyState(o)&&l.jsx(V,{kind:"ghost",onClick:f,children:"Confirm"}),l.jsx(V,{kind:"ghost",onClick:S,children:"Undo"})]})]})]})}function FR({shortcutOverrides:d={},settings:e,saveSettings:t}){const n=b.useCallback(a=>{const r=ke.isMacPlatform,c={mac:{...d.mac},windows:{...d.windows}},h=r?c.mac:c.windows;a.forEach(u=>{u.isDefault()?delete h[u.id]:h[u.id]=u.getKeyState()}),t({...e,shortcutOverrides:c})},[e,t,d]);let s=Array.from(Fe.shortcutsByCategory.entries()).map(([a,r])=>({name:a,shortcuts:r}));const i=s.findIndex(a=>a.name.toUpperCase()==="GLOBAL"),o=s.splice(i,1);return s=s.concat(o),l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"app-settings-menu-description",children:"Customize shortcuts below. To prevent unexpected results, avoid conflicting shortcuts with the browser or IDE editor."}),s.map(a=>l.jsx(NR,{name:a.name,shortcuts:a.shortcuts,saveShortcutOverrides:n},a.name))]})}function NR({name:d,shortcuts:e,saveShortcutOverrides:t}){function n(r){return r.split("_").map(c=>`${c[0].toUpperCase()}${c.slice(1).toLowerCase()}`).join(" ")}const[s,i]=b.useState(e);function o(r){const c=s.filter(u=>u!==r&&!u.isNull()&&u.matchesKeyState(r.getKeyState()));c.forEach(u=>u.setToNull());const h=[r,...c];t(h),i(u=>[...u])}const a=b.useMemo(()=>s.map(r=>r.getDisplayText()),[s]);return l.jsxs("div",{className:"mt-3",children:[l.jsx("div",{className:"font-weight-bold",children:n(d)}),s.map((r,c)=>l.jsx(DR,{shortcut:r,displayText:a[c],categoryName:d,onChange:o},r.id))]})}const MR=d=>({settings:Ct(d),shortcutOverrides:BS(d)}),kR={saveSettings:hr},OR=ft(MR,kR)(FR),AR="yyyy-MM-dd-HHmmss";function Nm(d,e="root",t=new Map([[d,""]])){const n={};return Object.entries(d).forEach(([s,i])=>{try{JSON.stringify(i),n[s]=i}catch{const a=i;if(typeof i=="bigint")n[s]=i.toString();else if(t.has(a))n[s]=`Circular ref to ${t.get(a)}`;else{const r=`${e}.${s}`;t.set(a,r),n[s]=Nm(i,r,t)}}}),n}function LR(){const d=mr.getState();return JSON.stringify(Nm(d),null,2)}function PR(d){const e={uiVersion:"0.31.1",userAgent:navigator.userAgent,...d};return JSON.stringify(e,null,2)}async function _R(d=`${x.i18n.DateTimeFormat.format(AR,new Date)}_support_logs`,e){const t=new Eh,n=t.folder(d);n.file("console.txt",wg.getFormattedHistory()),n.file("redux.json",LR()),n.file("metadata.json",PR(e));const s=await t.generateAsync({type:"blob"}),i=document.createElement("a");i.href=URL.createObjectURL(s),i.download=`${d}.zip`,i.click()}const jR=[{value:R.dataType.DATETIME,label:"DateTime"},{value:R.dataType.DECIMAL,label:"Decimal"},{value:R.dataType.INT,label:"Integer"}];function HR(){const d=jR.map(e=>l.jsx("option",{value:e.value,children:e.label},`key-columnType-${e.value}`));return l.jsxs(l.Fragment,{children:[l.jsx("option",{disabled:!0,value:"",children:"Select Type"},"key-columnType-placeholder"),d]})}class xd extends b.PureComponent{static defaultProps={scrollTo:()=>{},defaults:{defaultDateTimeFormat:_e.DEFAULT_DATETIME_FORMAT_STRING,defaultDecimalFormatOptions:{defaultFormatString:Re.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:$e.DEFAULT_FORMAT_STRING},showTimeZone:!1,showTSeparator:!0,timeZone:_e.DEFAULT_TIME_ZONE_ID}};static inputDebounceTime=250;constructor(e){super(e),this.debouncedCommitChanges=Ye(this.commitChanges.bind(this),xd.inputDebounceTime),this.handleFormatRuleEntered=this.handleFormatRuleEntered.bind(this),this.handleFormatRuleChange=this.handleFormatRuleChange.bind(this),this.handleFormatRuleCreate=this.handleFormatRuleCreate.bind(this),this.handleFormatRuleDelete=this.handleFormatRuleDelete.bind(this);const{formatter:t,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,showTimeZone:o,showTSeparator:a,timeZone:r,truncateNumbersWithPound:c}=e,h=t.map((u,m)=>({...u,id:m}));this.containerRef=X.createRef(),this.addFormatRuleButtonRef=X.createRef(),this.lastFormatRuleIndex=h.length,this.state={formatSettings:h,formatRulesChanged:!1,showTimeZone:o,showTSeparator:a,timeZone:r,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,truncateNumbersWithPound:c,timestampAtMenuOpen:new Date}}componentDidMount(){Sl(this.containerRef.current)}componentWillUnmount(){this.debouncedCommitChanges.flush()}debouncedCommitChanges;containerRef;addFormatRuleButtonRef;lastFormatRuleIndex;isDuplicateRule(e){const{formatSettings:t}=this.state;return t.some(n=>n.id!==e.id&&n.columnName===e.columnName&&n.columnType===e.columnType)??!1}getAutoIncrementFormatRuleIndex(){const{lastFormatRuleIndex:e}=this;return this.lastFormatRuleIndex+=1,e}getCachedColumnTypeOptions=pe(()=>l.jsx(HR,{}));getCachedDateTimeFormatOptions=pe((e,t,n,s=!1,i)=>{const{timestampAtMenuOpen:o}=this.state;return l.jsx(Fm,{timestamp:o,timeZone:e,showTimeZone:t,showTSeparator:n,isGlobalOptions:s,legacyGlobalFormat:i})});handleFormatRuleChange(e,t,n){this.setState(s=>{const{formatSettings:i}=s;M(i);const o=[...i];let a={};t==="columnType"&&(a={format:""});const r={...o[e],...a,[t]:n};return o[e]=r,{formatSettings:o}},()=>{this.debouncedCommitChanges()})}handleFormatRuleCreate(){this.setState(e=>{const{formatSettings:t}=e,n={columnType:R.dataType.DATETIME,columnName:"",format:{},id:this.getAutoIncrementFormatRuleIndex(),isNewRule:!0};return{formatSettings:t!=null?[...t,n]:[n],formatRulesChanged:!0}})}handleFormatRuleDelete(e){this.setState(t=>{const{formatSettings:n}=t;return{formatSettings:n.filter((i,o)=>o!==e),formatRulesChanged:!0}},()=>{this.debouncedCommitChanges()})}handleFormatRuleEntered(e){this.scrollToFormatBlockBottom(),Sl(e)}commitChanges(){const{formatSettings:e,defaultDateTimeFormat:t,showTimeZone:n,showTSeparator:s,timeZone:i,defaultDecimalFormatOptions:o,defaultIntegerFormatOptions:a,truncateNumbersWithPound:r}=this.state,c=e.filter(Dm).map(Im)??[],{settings:h,saveSettings:u}=this.props,m={...h,formatter:c,defaultDateTimeFormat:t,showTimeZone:n,showTSeparator:s,timeZone:i,truncateNumbersWithPound:r};Ds(R.dataType.DECIMAL,Re.makeCustomFormat(o.defaultFormatString))&&(m.defaultDecimalFormatOptions=o),Ds(R.dataType.INT,$e.makeCustomFormat(a.defaultFormatString))&&(m.defaultIntegerFormatOptions=a),u(m)}scrollToFormatBlockBottom(){const{scrollTo:e}=this.props;e(0,(this.addFormatRuleButtonRef.current?.offsetHeight??0)+(this.addFormatRuleButtonRef.current?.offsetTop??0))}getRuleError(e){const t={hasColumnNameError:!1,hasFormatError:!1,message:""},n=[];return e.isNewRule!==void 0&&e.isNewRule||(this.isDuplicateRule(e)&&(t.hasColumnNameError=!0,n.push("Duplicate column name/type combo.")),Rm(e.columnName)||(t.hasColumnNameError=!0,n.push("Column names must start with a letter or underscore and contain only alphanumeric characters or underscores.")),e.format.formatString!==void 0&&e.format.formatString.length===0?(t.hasFormatError=!0,n.push("Empty formatting rule.")):Ds(e.columnType,e.format)||(t.hasFormatError=!0,n.push("Invalid formatting rule.")),t.message=n.join(`
|
|
39
|
-
`)),t}renderFormatRule(e,t){const n=`input-${e}-columnName`,s=`input-${e}-columnType`,i=`input-${e}-format`,o=this.getCachedColumnTypeOptions(),a=u=>this.handleFormatRuleChange(e,"columnName",u.target.value),r=()=>this.handleFormatRuleChange(e,"isNewRule",!1),c=u=>this.handleFormatRuleChange(e,"columnType",u.target.value),h=this.getRuleError(t);return l.jsxs("fieldset",{className:"container-fluid format-rule-container",children:[l.jsxs("div",{className:"form-row",children:[l.jsxs("div",{className:"form-group col-7 mb-2",children:[l.jsx("label",{htmlFor:n,children:"Column Name"}),l.jsx("input",{id:n,className:$("form-control",{"is-invalid":h.hasColumnNameError}),"data-lpignore":!0,type:"text",value:t.columnName,onChange:a,onBlur:r})]}),l.jsxs("div",{className:"form-group col mb-2",children:[l.jsx(V,{kind:"ghost",className:"btn-delete-format-rule float-right",tabIndex:-1,onClick:()=>this.handleFormatRuleDelete(e),icon:Qt,tooltip:"Delete","aria-label":"Delete Format Rule"}),l.jsx("label",{htmlFor:s,children:"Column Type"}),l.jsx("select",{id:s,className:"custom-select",value:t.columnType,onChange:c,children:o})]})]}),l.jsx("div",{className:"form-row",children:l.jsxs("div",{className:"form-group col-12 d-flex mb-2",children:[l.jsx("label",{className:"flex-shrink-0 col-form-label mr-3",htmlFor:i,children:"Formatting Rule"}),this.renderFormatRuleInput(e,t.columnType,i,t.format,h.hasFormatError)]})}),l.jsx("div",{className:"form-row",children:l.jsx("div",{className:"form-group col-12 d-flex mb-2",children:h.message&&l.jsx("p",{className:"text-danger",children:h.message})})})]},e)}renderFormatRuleInput(e,t,n,s,i){switch(R.getNormalizedType(t)){case R.dataType.DATETIME:return this.renderDateTimeFormatRuleInput(e,n,s,i);case R.dataType.DECIMAL:return this.renderDecimalFormatRuleInput(e,n,s,i);case R.dataType.INT:return this.renderIntegerFormatRuleInput(e,n,s,i);default:throw new Error(`Unrecognized column type: ${t}`)}}renderDateTimeFormatRuleInput(e,t,n,s){const{showTimeZone:i,showTSeparator:o,timeZone:a}=this.state,r=n.formatString??"";return l.jsxs("select",{className:$("custom-select",{"is-invalid":s}),value:r,id:t,onChange:c=>{const h=_e.makeFormat("",c.target.value,_e.TYPE_GLOBAL);this.handleFormatRuleChange(e,"format",h)},children:[l.jsx("option",{value:"",disabled:!0,children:"Select format"},"default"),this.getCachedDateTimeFormatOptions(a,i,o)]})}renderIntegerFormatRuleInput(e,t,n,s){const i=n.formatString??"";return l.jsx("input",{className:$("form-control","flex-grow-1",{"is-invalid":s}),"data-lpignore":!0,id:t,placeholder:$e.DEFAULT_FORMAT_STRING,type:"text",value:i,onChange:o=>{const a=$e.makeFormat("",o.target.value,$e.TYPE_GLOBAL,void 0);this.handleFormatRuleChange(e,"format",a)}})}renderDecimalFormatRuleInput(e,t,n,s){const i=n.formatString??"";return l.jsx("input",{className:$("form-control","flex-grow-1",{"is-invalid":s}),"data-lpignore":!0,id:t,placeholder:Re.DEFAULT_FORMAT_STRING,type:"text",value:i,onChange:o=>{const a=Re.makeFormat("",o.target.value,Re.TYPE_GLOBAL,void 0);this.handleFormatRuleChange(e,"format",a)}})}render(){const{formatRulesChanged:e,formatSettings:t}=this.state,n=t.map((i,o)=>l.jsx(gt,{classNames:"fade",timeout:We.transitionMs,onEnter:this.handleFormatRuleEntered,children:this.renderFormatRule(o,i)},i.id)),s=l.jsx(V,{kind:"ghost",className:"mb-3",onClick:this.handleFormatRuleCreate,ref:this.addFormatRuleButtonRef,icon:Os,children:"Add New Rule"});return l.jsxs("div",{className:"app-settings-formatting-section",ref:this.containerRef,children:[l.jsx("div",{className:"app-settings-menu-description mb-3",children:"Customize the formatting of table columns by applying rules based on matching both a column name and column type."}),l.jsx(cp,{appear:e,enter:e,exit:e,children:n}),s]})}}const BR=d=>({formatter:cu(d),defaultDateTimeFormat:ru(d),defaultDecimalFormatOptions:lu(d),defaultIntegerFormatOptions:du(d),showTimeZone:hu(d),showTSeparator:uu(d),truncateNumbersWithPound:mu(d),timeZone:Ao(d),settings:Ct(d)}),VR=ft(BR,{saveSettings:hr})(xd);class Nn extends b.Component{static defaultProps={onDone:()=>{}};static FORMATTING_SECTION_KEY="SettingsMenu.formatting";static COLUMN_SPECIFIC_SECTION_KEY="SettingsMenu.columnFormatting";static APPLICATION_SECTION_KEY="ApplicationMenu.settings";static SHORTCUT_SECTION_KEY="SettingsMenu.shortcuts";static focusFirstInputInContainer(e){const t=e?.querySelector("input, select, textarea");t&&t.focus()}constructor(e){super(e),this.handleClose=this.handleClose.bind(this),this.handleScrollTo=this.handleScrollTo.bind(this),this.handleSectionToggle=this.handleSectionToggle.bind(this),this.handleExportSupportLogs=this.handleExportSupportLogs.bind(this),this.menuContentRef=X.createRef(),this.state={expandedSectionKey:Nn.FORMATTING_SECTION_KEY}}componentDidMount(){Nn.focusFirstInputInContainer(this.menuContentRef.current)}menuContentRef;isSectionExpanded(e){const{expandedSectionKey:t}=this.state;return t===e}handleScrollTo(e,t){this.menuContentRef.current?.scrollTo(e,t)}handleSectionToggle(e){this.setState(t=>({expandedSectionKey:t.expandedSectionKey===e?void 0:e}))}handleClose(){const{onDone:e}=this.props;e()}handleExportSupportLogs(){const{serverConfigValues:e}=this.props;_R(void 0,Object.fromEntries(e))}render(){const e="0.
|
|
38
|
+
This note can be edited using **markdown** for styling.`;static getNewMarkdownTitle(e){let t=`${Li.DEFAULT_TITLE}`,n=0;for(;e.indexOf(t)>=0;)n+=1,t=`${Li.DEFAULT_TITLE}-${n}`;return t}}function cR(d){Ps(d);const{id:e,layout:t,panelManager:n,registerComponent:s}=d,i=b.useCallback(a=>{const{title:r,componentState:c,props:h}=a;let{panelState:u=null}=h;return c!=null&&({panelState:u=null}=c),r==null||u==null||u.content==null||u.content.length===0||u.content===Li.DEFAULT_CONTENT?null:Ql(a)},[]),o=b.useCallback(({title:a="",metadata:r={},id:c=Pe.generate(),focusElement:h=q.DEFAULT_FOCUS_SELECTOR,createNewStack:u=!1,dragEvent:m=null}={})=>{const p=n.getOpenedPanelConfigsOfType(co.COMPONENT),g=n.getClosedPanelConfigsOfType(co.COMPONENT),C=p.map(T=>T.title??""),f=a!=null&&a!==""?a:Li.getNewMarkdownTitle(C),S=g.length>0?null:Li.DEFAULT_CONTENT,v={type:"react-component",component:co.COMPONENT,props:{id:c,metadata:r,panelState:{content:S},localDashboardId:e},title:f,id:c},{root:w}=t;q.openComponent({root:w,config:v,focusElement:h,createNewStack:u,dragEvent:m})},[e,t,n]);return b.useEffect(function(){const r=[s(co.COMPONENT,co,Jl,i)];return()=>{r.forEach(c=>c())}},[i,s]),Ue(t.eventHub,pm.OPEN,o),null}function hR(d){Ps(d);const{hydrate:e,id:t,layout:n,registerComponent:s}=d,i=b.useCallback(({dragEvent:o,fetch:a,panelId:r=Pe.generate(),widget:c})=>{const{name:h,type:u}=c;if(u!==dh.VariableType.PANDAS)return;const m={name:h,table:h},p=()=>a().then(f=>ud.makeModel(f)),g={type:"react-component",component:Xr.COMPONENT,props:{localDashboardId:t,id:r,metadata:m,makeModel:p},title:h,id:r},{root:C}=n;q.openComponent({root:C,config:g,dragEvent:o})},[t,n]);return b.useEffect(function(){const a=[s(Xr.COMPONENT,Xr,e)];return()=>{a.forEach(r=>r())}},[e,s]),Ue(n.eventHub,Ee.OPEN,i),null}class Is{static DROPDOWN_FILTER="ControlType.DROPDOWN_FILTER";static INPUT_FILTER="ControlType.INPUT_FILTER";static MARKDOWN="ControlType.MARKDOWN";static FILTER_SET_MANAGER="ControlType.FILTER_SET_MANAGER"}D.shape({state:D.shape({panelState:D.shape({})})});D.shape({panelId:D.string.isRequired,columnName:D.string.isRequired,columnType:D.string.isRequired});const uh=D.shape({panelId:D.string.isRequired,columnName:D.string.isRequired}),uR=D.shape({start:uh,end:uh,id:D.string,isReversed:D.bool});D.arrayOf(uR);D.shape({name:D.string.isRequired,operateAs:D.string.isRequired,groups:D.arrayOf(D.string).isRequired,permissions:D.shape({isSuperUser:D.bool.isRequired,isQueryViewOnly:D.bool.isRequired,isNonInteractive:D.bool.isRequired,canUsePanels:D.bool.isRequired,canCreateDashboard:D.bool.isRequired,canCreateCodeStudio:D.bool.isRequired,canCreateQueryMonitor:D.bool.isRequired,canCopy:D.bool.isRequired,canDownloadCsv:D.bool.isRequired}).isRequired});Z.module("StorageTableViewportUpdater");class mh{static makeSortConfig(e,t){return{column:e,direction:t}}static makeFilterConfig(e){const t=[],n=[];return e.forEach((s,i)=>{t.push(s),i>0&&n.push(Sn.and)}),{filterItems:t,filterOperators:n}}static combineFilterConfigs(e,t,n=Sn.and){return{filterItems:[...e.filterItems,...t.filterItems],filterOperators:[...e.filterOperators,n,...t.filterOperators]}}static makeFilterItem(e,t,n){return{columnName:e,type:t,value:n}}}const Qr=Z.module("PouchStorageTable"),mR="Deephaven.";Th.plugin(dp);function pR(d,e){switch(d){case Y.in:case Y.contains:return{$regex:new RegExp(`${e}`)};case Y.inIgnoreCase:return{$regex:new RegExp(`${e}`,"i")};case Y.eq:return{$eq:e};case Y.notEq:return{$neq:e};case Y.greaterThan:return{$gt:e};case Y.greaterThanOrEqualTo:return{$gte:e};case Y.lessThan:return{$lt:e};case Y.lessThanOrEqualTo:return{$lte:e};case Y.startsWith:return{$regex:new RegExp(`^(?${e}).*`)};default:throw new Error(`Unsupported type: ${d}`)}}function gR(d){const{filterItems:e,filterOperators:t}=d;let n=null;for(let s=0;s<e.length;s+=1){const i=e[s],{columnName:o,type:a,value:r}=i,c={[o]:pR(a,r)};if(s===0)n=c;else if(n!==null&&s-1<t.length){const h=t[s-1];if(h===Sn.and)n={$and:[n,c]};else if(h===Sn.or)n={$or:[n,c]};else throw new Error(`Unexpected filter operator ${h}, ${c}`)}}if(n==null)throw new Error(`Invalid filter config ${d}`);return n}function Jr(d=[]){return{$and:[...d.map(e=>gR(e)),{name:{$gt:null}},{id:{$gt:null}}]}}function fR(d,e=!1){return[{id:e?"desc":"asc"},...d?.map(t=>({[t.column]:t.direction}))??[]]}class CR{db;listeners=[];itemListeners=new Map;currentSize=0;currentViewport;currentReverse=!1;currentFilter=null;currentSort=null;infoUpdatePromise;viewportUpdatePromise;currentViewportData;constructor(e){this.db=new Th(`${mR}${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(t=>t!==e)}}onItemUpdate(e,t){return this.itemListeners.has(e)||this.itemListeners.set(e,[]),this.itemListeners.set(e,[...this.itemListeners.get(e),t]),this.refreshItem(e),()=>{this.itemListeners.set(e,this.itemListeners.get(e).filter(n=>n!==t))}}close(){this.listeners=[]}get size(){return this.currentSize}get viewport(){return this.currentViewport}setReversed(e){this.currentReverse=e,this.currentViewportData=void 0,this.refreshData()}setViewport(e){this.currentViewport=e,this.refreshInfo(),this.refreshData()}setSorts(e){this.currentSort=e,this.currentViewportData=void 0,this.refreshData()}setFilters(e){this.currentFilter=e,this.currentViewportData=void 0,this.refreshInfo(),this.refreshData()}get data(){return this.currentViewportData}async getViewportData(){return this.viewportUpdatePromise||this.refreshData(),this.viewportUpdatePromise??Promise.resolve({items:[],offset:0})}async put(e){const t={...e,_id:e.id};return await this.db.put(t),t}sendUpdate(){const{listeners:e}=this,t=this.currentViewportData??{items:[],offset:0};for(let n=0;n<e.length;n+=1)e[n](t)}sendItemUpdate(e){const t=this.itemListeners.get(e.id);if(t!==void 0)for(let n=0;n<t.length;n+=1)t[n](e)}dbUpdate(e){Qr.debug("Update received",e),this.refreshInfo(),e.doc!==void 0&&this.sendItemUpdate(e.doc),this.refreshData()}async refreshInfo(){try{this.infoUpdatePromise?.cancel(),this.infoUpdatePromise=ve.makeCancelable(this.db.find({selector:Jr(this.currentFilter??[]),fields:[]}));const e=await this.infoUpdatePromise;this.currentSize=e.docs.length,this.sendUpdate()}catch(e){if(!ve.isCanceled(e))throw Qr.error("Unable to refreshInfo",e),e}}async refreshData(){if(this.currentViewport)try{const{currentViewport:e}=this,t=fR(this.currentSort,this.currentReverse);this.viewportUpdatePromise?.cancel(),this.viewportUpdatePromise=ve.makeCancelable(this.db.find({selector:Jr(this.currentFilter??[]),skip:e.top,limit:e.bottom-e.top+1,sort:t,fields:["id","name"]}).then(s=>({items:s.docs,offset:e.top})));const n=await this.viewportUpdatePromise;return this.currentViewportData=n,this.sendUpdate(),n}catch(e){if(!ve.isCanceled(e))throw Qr.error("Unable to refreshData",e),e}}async refreshItem(e){const n=(await this.db.find({selector:{id:e},limit:1})).docs[0];return n!==void 0&&this.sendItemUpdate(n),n}async getSnapshot(e){const t=new Map,n=[{id:this.currentReverse?"desc":"asc"}];return await Promise.all(e.map(async([s,i])=>{const o=i-s+1;return this.db.find({selector:Jr(this.currentFilter??[]),skip:s,limit:o,sort:n,fields:["id","name"]}).then(a=>{for(let r=0;r<o;r+=1){const c=s+r;t.set(c,a.docs[r])}})})),t}}class ph extends CR{constructor(e){super(`CommandHistoryStorage.${e}`)}setSearch(e){this.setFilters(e?[mh.makeFilterConfig([mh.makeFilterItem("name",Y.contains,e)])]:[])}}const gh=Z.module("PouchCommandHistoryStorage");class SR{updateTableMap=new Map;getUpdateTable(e){return this.updateTableMap.has(e)||this.updateTableMap.set(e,new ph(e)),this.updateTableMap.get(e)}async getTable(e){return new ph(e)}async addItem(e,t,n,s){return this.updateItem(e,{id:`${new Date().getTime()}`,name:n,data:s})}async updateItem(e,t){const n=this.getUpdateTable(e),i={...await n.refreshItem(t.id)??{},...t};return gh.debug("Updating item",i),await n.put(i),gh.debug("Update saved"),t}listenItem(e,t,n){return this.getUpdateTable(e).onItemUpdate(t,n)}}const Em="SET_LAYOUT_STORAGE",bR=d=>({type:Em,payload:d}),ym="/ide/assets/community-wordmark-app-d2c5c1eb.svg";const wR=Z.module("FormattingSectionContent");function vR(d){return d.formatString!=null}function Sl(d){const e=d?.querySelector("input, select, textarea");e&&e.focus()}function xm(d,e){return d.defaultFormatString===e.defaultFormatString}function TR(d,e){return xm(d,e)}function ER(d,e){return xm(d,e)}function Rm(d){return d!==""&&cn.isValidColumnName(d)}function Ds(d,e){if(!d||e.formatString==null||!vR(e))return!1;switch(d){case"datetime":return _e.isValid(e);case"decimal":return Re.isValid(e);case"int":return $e.isValid(e);default:return wR.warn("Trying to validate format of unknown type"),!0}}function Im(d){const{id:e,isNewRule:t,...n}=d;return n}function Dm(d){return Rm(d.columnName)&&Ds(d.columnType,d.format)}function Fm(d){const{timestamp:e,timeZone:t,showTimeZone:n,showTSeparator:s,isGlobalOptions:i,legacyGlobalFormat:o}=d,a=new Zt([],{timeZone:t,showTimeZone:n,showTSeparator:s}),r=i?_e.getGlobalFormats(n,s):_e.getFormats(n,s);return o!=null&&!r.includes(o)&&r.unshift(o),l.jsx(l.Fragment,{children:r.map(c=>{const h=_e.makeFormat("",c,_e.TYPE_GLOBAL);return l.jsx("option",{value:c,"data-testid":"time-format",children:a.getFormattedString(e,R.dataType.DATETIME,"",h)},c)})})}function yR(){return l.jsx(l.Fragment,{children:Wi.TIME_ZONES.map(d=>{const{label:e,value:t}=d;return l.jsx("option",{value:t,children:e},t)})})}const Ys=Z.module("FormattingSectionContent");class yd extends b.PureComponent{static defaultProps={scrollTo:()=>{},defaults:{defaultDateTimeFormat:_e.DEFAULT_DATETIME_FORMAT_STRING,defaultDecimalFormatOptions:{defaultFormatString:Re.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:$e.DEFAULT_FORMAT_STRING},showTimeZone:!1,showTSeparator:!0,timeZone:_e.DEFAULT_TIME_ZONE_ID}};static inputDebounceTime=250;constructor(e){super(e),this.debouncedCommitChanges=Ye(this.commitChanges.bind(this),yd.inputDebounceTime),this.handleDefaultDateTimeFormatChange=this.handleDefaultDateTimeFormatChange.bind(this),this.handleDefaultDecimalFormatChange=this.handleDefaultDecimalFormatChange.bind(this),this.handleDefaultIntegerFormatChange=this.handleDefaultIntegerFormatChange.bind(this),this.handleShowTimeZoneChange=this.handleShowTimeZoneChange.bind(this),this.handleShowTSeparatorChange=this.handleShowTSeparatorChange.bind(this),this.handleTimeZoneChange=this.handleTimeZoneChange.bind(this),this.handleResetDateTimeFormat=this.handleResetDateTimeFormat.bind(this),this.handleResetDecimalFormat=this.handleResetDecimalFormat.bind(this),this.handleResetIntegerFormat=this.handleResetIntegerFormat.bind(this),this.handleResetTimeZone=this.handleResetTimeZone.bind(this),this.handleTruncateNumbersWithPoundChange=this.handleTruncateNumbersWithPoundChange.bind(this);const{formatter:t,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,showTimeZone:o,showTSeparator:a,timeZone:r,truncateNumbersWithPound:c}=e,h=t.map((u,m)=>({...u,id:m}));this.containerRef=X.createRef(),this.state={formatSettings:h,showTimeZone:o,showTSeparator:a,timeZone:r,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,truncateNumbersWithPound:c,timestampAtMenuOpen:new Date}}componentDidMount(){Sl(this.containerRef.current)}componentWillUnmount(){this.debouncedCommitChanges.flush()}debouncedCommitChanges;containerRef;getCachedDateTimeFormatOptions=pe((e,t,n,s=!1,i)=>{const{timestampAtMenuOpen:o}=this.state;return l.jsx(Fm,{timestamp:o,timeZone:e,showTimeZone:t,showTSeparator:n,isGlobalOptions:s,legacyGlobalFormat:i})});handleDefaultDateTimeFormatChange(e){Ys.debug("handleDefaultDateTimeFormatChange",e.target.value),this.setState({defaultDateTimeFormat:e.target.value},()=>{this.debouncedCommitChanges()})}handleDefaultDecimalFormatChange(e){Ys.debug("handleDefaultDecimalFormatChange",e.target.value),this.setState({defaultDecimalFormatOptions:{defaultFormatString:e.target.value}},()=>{this.debouncedCommitChanges()})}handleDefaultIntegerFormatChange(e){Ys.debug("handleDefaultIntegerFormatChange",e.target.value),this.setState({defaultIntegerFormatOptions:{defaultFormatString:e.target.value}},()=>{this.debouncedCommitChanges()})}handleShowTimeZoneChange(){this.setState(e=>({showTimeZone:!e.showTimeZone}),()=>{this.debouncedCommitChanges()})}handleShowTSeparatorChange(){this.setState(e=>({showTSeparator:!e.showTSeparator}),()=>{this.debouncedCommitChanges()})}handleTimeZoneChange(e){this.setState({timeZone:e.target.value},()=>{this.debouncedCommitChanges()})}handleResetDateTimeFormat(){const{defaults:e}=this.props,{defaultDateTimeFormat:t,showTimeZone:n,showTSeparator:s}=e;Ys.debug("handleResetDateTimeFormat"),this.setState({defaultDateTimeFormat:t,showTimeZone:n,showTSeparator:s},()=>{this.debouncedCommitChanges()})}handleResetTimeZone(){const{defaults:e}=this.props,{timeZone:t}=e;Ys.debug("handleResetTimeZone"),this.setState({timeZone:t},()=>{this.debouncedCommitChanges()})}handleResetDecimalFormat(){const{defaults:e}=this.props,{defaultDecimalFormatOptions:t}=e;Ys.debug("handleResetDecimalFormat"),this.setState({defaultDecimalFormatOptions:t},()=>{this.debouncedCommitChanges()})}handleResetIntegerFormat(){const{defaults:e}=this.props,{defaultIntegerFormatOptions:t}=e;Ys.debug("handleResetIntegerFormat"),this.setState({defaultIntegerFormatOptions:t},()=>{this.debouncedCommitChanges()})}handleTruncateNumbersWithPoundChange(){this.setState(e=>({truncateNumbersWithPound:!e.truncateNumbersWithPound}),()=>{this.debouncedCommitChanges()})}commitChanges(){const{formatSettings:e,defaultDateTimeFormat:t,showTimeZone:n,showTSeparator:s,timeZone:i,defaultDecimalFormatOptions:o,defaultIntegerFormatOptions:a,truncateNumbersWithPound:r}=this.state,c=e.filter(Dm).map(Im)??[],{settings:h,saveSettings:u}=this.props,m={...h,formatter:c,defaultDateTimeFormat:t,showTimeZone:n,showTSeparator:s,timeZone:i,truncateNumbersWithPound:r};Ds(R.dataType.DECIMAL,Re.makeCustomFormat(o.defaultFormatString))&&(m.defaultDecimalFormatOptions=o),Ds(R.dataType.INT,$e.makeCustomFormat(a.defaultFormatString))&&(m.defaultIntegerFormatOptions=a),u(m)}render(){const{defaults:e}=this.props,{defaultDateTimeFormat:t,defaultDecimalFormatOptions:n,defaultIntegerFormatOptions:s,timeZone:i,showTimeZone:o,showTSeparator:a,truncateNumbersWithPound:r}=this.state,{defaultFormatString:c=Re.DEFAULT_FORMAT_STRING}=n??{},{defaultFormatString:h=$e.DEFAULT_FORMAT_STRING}=s??{},u=i===e.timeZone,m=a===e.showTSeparator&&o===e.showTimeZone&&t===e.defaultDateTimeFormat,p=TR(n,e.defaultDecimalFormatOptions),g=ER(s,e.defaultIntegerFormatOptions);return l.jsx("div",{className:"app-settings-formatting-section",ref:this.containerRef,children:l.jsxs("div",{className:"container-fluid p-0",children:[l.jsx("div",{className:"app-settings-menu-description mb-3",children:"Choose the default formatting rule to apply to all table columns based on their type."}),l.jsxs("div",{className:"form-row mb-2",children:[l.jsx("label",{className:"col-form-label col-3",htmlFor:"select-reset-timezone",children:"Time zone"}),l.jsx("div",{className:"col pr-0",children:l.jsx("select",{className:"custom-select",value:i,onChange:this.handleTimeZoneChange,id:"select-reset-timezone",children:l.jsx(yR,{})})}),l.jsx("div",{className:"col-1 btn-col",children:l.jsx(V,{kind:"ghost",icon:ei,onClick:this.handleResetTimeZone,tooltip:"Reset Time Zone",className:$("btn-reset","btn-reset-time-zone",{hidden:u})})})]}),l.jsxs("div",{className:"form-row mb-2",children:[l.jsx("label",{className:"col-form-label col-3",htmlFor:"select-default-time-format",children:"DateTime"}),l.jsx("div",{className:"col pr-0",children:l.jsx("select",{className:"custom-select",value:t,onChange:this.handleDefaultDateTimeFormatChange,id:"select-default-time-format",children:this.getCachedDateTimeFormatOptions(i,o,a,!0,t)})}),l.jsx("div",{className:"col-1 btn-col",children:l.jsx(V,{kind:"ghost",icon:ei,onClick:this.handleResetDateTimeFormat,tooltip:"Reset DateTime Options",className:$("btn-reset","btn-reset-date-time",{hidden:m})})})]}),l.jsx("div",{className:"form-row",children:l.jsx("div",{className:"offset-3 col-9",children:l.jsx(Xt,{checked:o??null,onChange:this.handleShowTimeZoneChange,children:"Show time zone in dates"})})}),l.jsx("div",{className:"form-row mb-3",children:l.jsx("div",{className:"offset-3 col-9",children:l.jsx(Xt,{checked:a??null,onChange:this.handleShowTSeparatorChange,children:"Show 'T' separator"})})}),l.jsxs("div",{className:"form-row mb-2",children:[l.jsx("label",{className:"col-form-label col-3",htmlFor:"default-decimal-format-input",children:"Decimal"}),l.jsx("div",{className:"col pr-0",children:l.jsx("input",{className:$("form-control","flex-grow-1","default-decimal-format-input",{"is-invalid":!Ds(R.dataType.DECIMAL,Re.makeCustomFormat(c))}),"data-lpignore":!0,placeholder:Re.DEFAULT_FORMAT_STRING,type:"text",id:"default-decimal-format-input",value:c,onChange:this.handleDefaultDecimalFormatChange})}),l.jsx("div",{className:"col-1 btn-col",children:l.jsx(V,{kind:"ghost",icon:ei,onClick:this.handleResetDecimalFormat,tooltip:"Reset Decimal Formatting",className:$("btn-reset","btn-reset-decimal",{hidden:p}),"data-testid":"btn-reset-decimal"})})]}),l.jsxs("div",{className:"form-row mb-2",children:[l.jsx("label",{className:"col-form-label col-3",htmlFor:"default-integer-format-input",children:"Integer"}),l.jsx("div",{className:"col pr-0",children:l.jsx("input",{className:$("form-control","flex-grow-1","default-integer-format-input",{"is-invalid":!Ds(R.dataType.INT,$e.makeCustomFormat(h))}),"data-lpignore":!0,placeholder:$e.DEFAULT_FORMAT_STRING,type:"text",id:"default-integer-format-input",value:h,onChange:this.handleDefaultIntegerFormatChange})}),l.jsx("div",{className:"col-1 btn-col",children:l.jsx(V,{kind:"ghost",icon:ei,onClick:this.handleResetIntegerFormat,tooltip:"Reset Integer Formatting",className:$("btn-reset","btn-reset-integer",{hidden:g}),"data-testid":"btn-reset-integer"})})]}),l.jsx("div",{className:"form-row mb-3",children:l.jsx("div",{className:"offset-3 col-9",children:l.jsx(Xt,{checked:r??null,onChange:this.handleTruncateNumbersWithPoundChange,children:"Truncate numbers with #"})})})]})})}}const xR=d=>({formatter:cu(d),defaultDateTimeFormat:ru(d),defaultDecimalFormatOptions:lu(d),defaultIntegerFormatOptions:du(d),showTimeZone:hu(d),showTSeparator:uu(d),truncateNumbersWithPound:mu(d),timeZone:Ao(d),settings:Ct(d)}),RR=ft(xR,{saveSettings:hr})(yd);function IR(){const[d,e]=b.useState(!1),t=()=>{e(!d)};return l.jsxs(V,{kind:"ghost",onClick:t,icon:bg,children:["Legal Notices",l.jsxs(Do,{isOpen:d,toggle:t,className:"theme-bg-light",children:[l.jsx(Fo,{toggle:t,children:"Legal Notice"}),l.jsxs(No,{children:[l.jsx("p",{children:"Deephaven software is protected by U.S. Patent Nos. 9,612,959; 9,613,018; 9,613,109; 9,619,210; 9,633,060; 9,639,570; 9,672,238; 9,679,006; 9,690,821; 9,710,511; 9,760,591; 9,805,084; 9,836,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."}),l.jsxs("p",{children:["© 2016-",new Date().getFullYear()," Deephaven Data Labs LLC. Patent Pending."]})]})]})]})}function To(d){const{children:e,isExpanded:t,sectionKey:n,title:s,onToggle:i}=d;return l.jsxs(l.Fragment,{children:[l.jsx("div",{children:l.jsxs(V,{kind:"ghost",className:"btn-collapse-trigger",onClick:()=>i(n),children:[l.jsx("div",{className:"flex-grow-1",children:s}),l.jsx("div",{className:"flex-shrink-0",children:l.jsx(J,{transform:t?"flip-v":"",icon:kn})})]})}),l.jsx(lf,{in:t,autoFocusOnShow:!0,children:e})]})}To.propTypes={children:D.node,isExpanded:D.bool.isRequired,sectionKey:D.string.isRequired,title:D.node.isRequired,onToggle:D.func};To.defaultProps={children:null,onToggle:()=>{}};function DR({shortcut:d,displayText:e,categoryName:t,onChange:n}){const[s,i]=b.useState(e),[o,a]=b.useState(d.getKeyState()),[r,c]=b.useState(!1),[h,u]=b.useState("");b.useEffect(function(){i(e),a(d.getKeyState())},[e,d]),b.useEffect(function(){i(ke.getDisplayText(o)),d.matchesKeyState(o)&&c(!1)},[o,d]),b.useEffect(function(){if(r){if(!ke.isValidKeyState(o)){ke.isAllowedKey(o.keyValue)?u("Must contain a modifier key"):u("Must contain an allowed action key");return}const T=Fe.getConflictingShortcuts(o).filter(y=>y.id.startsWith(t)&&y!==d).map(y=>y.name);if(T.length){u(`Conflicts with ${T.join(", ")}`);return}u("")}else u("")},[r,o,t,d]);function m(w){if(w.stopPropagation(),w.preventDefault(),d.isEditable&&!w.repeat){const T=ke.getKeyStateFromEvent(w),y=ke.createKeyState([ue.BACKSPACE]);ke.doKeyStatesMatch(T,y)?a(ke.NULL_KEY_STATE):a(T)}}function p(w){w.stopPropagation(),w.preventDefault(),d.matchesKeyState(o)||c(!0)}function g(){He.disableAllActions()}function C(){He.enableAllActions()}function f(){d.setKeyState(o),c(!1),n(d)}function S(){const w=d.getKeyState();a(w),c(!1)}function v(){c(!0),a(d.getDefaultKeyState())}return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"shortcut-item-container",children:[l.jsxs("label",{className:"shortcut-item-name",children:[d.name,d.tooltip!==void 0&&l.jsx(tt,{children:d.tooltip})]}),l.jsxs("div",{className:"shortcut-item-input-container",children:[l.jsx("input",{className:$("form-control",{"is-invalid":h}),onKeyDown:m,onKeyUp:p,onFocus:g,onBlur:C,disabled:!d.isEditable,value:s,readOnly:!0}),!ke.doKeyStatesMatch(o,d.getDefaultKeyState())&&!h&&l.jsx(V,{className:"reset-to-default-button",kind:"ghost",icon:l.jsx(J,{icon:ei,transform:{rotate:90,flipX:!0}}),tooltip:"Reset to default",onClick:v})]})]}),r&&l.jsxs("div",{className:$("shortcut-item-message-container",{"is-invalid":h}),children:[l.jsx("div",{className:"shortcut-item-message",children:h}),l.jsxs("div",{className:"shortcut-item-message-buttons",children:[ke.isValidKeyState(o)&&l.jsx(V,{kind:"ghost",onClick:f,children:"Confirm"}),l.jsx(V,{kind:"ghost",onClick:S,children:"Undo"})]})]})]})}function FR({shortcutOverrides:d={},settings:e,saveSettings:t}){const n=b.useCallback(a=>{const r=ke.isMacPlatform,c={mac:{...d.mac},windows:{...d.windows}},h=r?c.mac:c.windows;a.forEach(u=>{u.isDefault()?delete h[u.id]:h[u.id]=u.getKeyState()}),t({...e,shortcutOverrides:c})},[e,t,d]);let s=Array.from(Fe.shortcutsByCategory.entries()).map(([a,r])=>({name:a,shortcuts:r}));const i=s.findIndex(a=>a.name.toUpperCase()==="GLOBAL"),o=s.splice(i,1);return s=s.concat(o),l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"app-settings-menu-description",children:"Customize shortcuts below. To prevent unexpected results, avoid conflicting shortcuts with the browser or IDE editor."}),s.map(a=>l.jsx(NR,{name:a.name,shortcuts:a.shortcuts,saveShortcutOverrides:n},a.name))]})}function NR({name:d,shortcuts:e,saveShortcutOverrides:t}){function n(r){return r.split("_").map(c=>`${c[0].toUpperCase()}${c.slice(1).toLowerCase()}`).join(" ")}const[s,i]=b.useState(e);function o(r){const c=s.filter(u=>u!==r&&!u.isNull()&&u.matchesKeyState(r.getKeyState()));c.forEach(u=>u.setToNull());const h=[r,...c];t(h),i(u=>[...u])}const a=b.useMemo(()=>s.map(r=>r.getDisplayText()),[s]);return l.jsxs("div",{className:"mt-3",children:[l.jsx("div",{className:"font-weight-bold",children:n(d)}),s.map((r,c)=>l.jsx(DR,{shortcut:r,displayText:a[c],categoryName:d,onChange:o},r.id))]})}const MR=d=>({settings:Ct(d),shortcutOverrides:BS(d)}),kR={saveSettings:hr},OR=ft(MR,kR)(FR),AR="yyyy-MM-dd-HHmmss";function Nm(d,e="root",t=new Map([[d,""]])){const n={};return Object.entries(d).forEach(([s,i])=>{try{JSON.stringify(i),n[s]=i}catch{const a=i;if(typeof i=="bigint")n[s]=i.toString();else if(t.has(a))n[s]=`Circular ref to ${t.get(a)}`;else{const r=`${e}.${s}`;t.set(a,r),n[s]=Nm(i,r,t)}}}),n}function LR(){const d=mr.getState();return JSON.stringify(Nm(d),null,2)}function PR(d){const e={uiVersion:"0.32.0",userAgent:navigator.userAgent,...d};return JSON.stringify(e,null,2)}async function _R(d=`${x.i18n.DateTimeFormat.format(AR,new Date)}_support_logs`,e){const t=new Eh,n=t.folder(d);n.file("console.txt",wg.getFormattedHistory()),n.file("redux.json",LR()),n.file("metadata.json",PR(e));const s=await t.generateAsync({type:"blob"}),i=document.createElement("a");i.href=URL.createObjectURL(s),i.download=`${d}.zip`,i.click()}const jR=[{value:R.dataType.DATETIME,label:"DateTime"},{value:R.dataType.DECIMAL,label:"Decimal"},{value:R.dataType.INT,label:"Integer"}];function HR(){const d=jR.map(e=>l.jsx("option",{value:e.value,children:e.label},`key-columnType-${e.value}`));return l.jsxs(l.Fragment,{children:[l.jsx("option",{disabled:!0,value:"",children:"Select Type"},"key-columnType-placeholder"),d]})}class xd extends b.PureComponent{static defaultProps={scrollTo:()=>{},defaults:{defaultDateTimeFormat:_e.DEFAULT_DATETIME_FORMAT_STRING,defaultDecimalFormatOptions:{defaultFormatString:Re.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:$e.DEFAULT_FORMAT_STRING},showTimeZone:!1,showTSeparator:!0,timeZone:_e.DEFAULT_TIME_ZONE_ID}};static inputDebounceTime=250;constructor(e){super(e),this.debouncedCommitChanges=Ye(this.commitChanges.bind(this),xd.inputDebounceTime),this.handleFormatRuleEntered=this.handleFormatRuleEntered.bind(this),this.handleFormatRuleChange=this.handleFormatRuleChange.bind(this),this.handleFormatRuleCreate=this.handleFormatRuleCreate.bind(this),this.handleFormatRuleDelete=this.handleFormatRuleDelete.bind(this);const{formatter:t,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,showTimeZone:o,showTSeparator:a,timeZone:r,truncateNumbersWithPound:c}=e,h=t.map((u,m)=>({...u,id:m}));this.containerRef=X.createRef(),this.addFormatRuleButtonRef=X.createRef(),this.lastFormatRuleIndex=h.length,this.state={formatSettings:h,formatRulesChanged:!1,showTimeZone:o,showTSeparator:a,timeZone:r,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,truncateNumbersWithPound:c,timestampAtMenuOpen:new Date}}componentDidMount(){Sl(this.containerRef.current)}componentWillUnmount(){this.debouncedCommitChanges.flush()}debouncedCommitChanges;containerRef;addFormatRuleButtonRef;lastFormatRuleIndex;isDuplicateRule(e){const{formatSettings:t}=this.state;return t.some(n=>n.id!==e.id&&n.columnName===e.columnName&&n.columnType===e.columnType)??!1}getAutoIncrementFormatRuleIndex(){const{lastFormatRuleIndex:e}=this;return this.lastFormatRuleIndex+=1,e}getCachedColumnTypeOptions=pe(()=>l.jsx(HR,{}));getCachedDateTimeFormatOptions=pe((e,t,n,s=!1,i)=>{const{timestampAtMenuOpen:o}=this.state;return l.jsx(Fm,{timestamp:o,timeZone:e,showTimeZone:t,showTSeparator:n,isGlobalOptions:s,legacyGlobalFormat:i})});handleFormatRuleChange(e,t,n){this.setState(s=>{const{formatSettings:i}=s;M(i);const o=[...i];let a={};t==="columnType"&&(a={format:""});const r={...o[e],...a,[t]:n};return o[e]=r,{formatSettings:o}},()=>{this.debouncedCommitChanges()})}handleFormatRuleCreate(){this.setState(e=>{const{formatSettings:t}=e,n={columnType:R.dataType.DATETIME,columnName:"",format:{},id:this.getAutoIncrementFormatRuleIndex(),isNewRule:!0};return{formatSettings:t!=null?[...t,n]:[n],formatRulesChanged:!0}})}handleFormatRuleDelete(e){this.setState(t=>{const{formatSettings:n}=t;return{formatSettings:n.filter((i,o)=>o!==e),formatRulesChanged:!0}},()=>{this.debouncedCommitChanges()})}handleFormatRuleEntered(e){this.scrollToFormatBlockBottom(),Sl(e)}commitChanges(){const{formatSettings:e,defaultDateTimeFormat:t,showTimeZone:n,showTSeparator:s,timeZone:i,defaultDecimalFormatOptions:o,defaultIntegerFormatOptions:a,truncateNumbersWithPound:r}=this.state,c=e.filter(Dm).map(Im)??[],{settings:h,saveSettings:u}=this.props,m={...h,formatter:c,defaultDateTimeFormat:t,showTimeZone:n,showTSeparator:s,timeZone:i,truncateNumbersWithPound:r};Ds(R.dataType.DECIMAL,Re.makeCustomFormat(o.defaultFormatString))&&(m.defaultDecimalFormatOptions=o),Ds(R.dataType.INT,$e.makeCustomFormat(a.defaultFormatString))&&(m.defaultIntegerFormatOptions=a),u(m)}scrollToFormatBlockBottom(){const{scrollTo:e}=this.props;e(0,(this.addFormatRuleButtonRef.current?.offsetHeight??0)+(this.addFormatRuleButtonRef.current?.offsetTop??0))}getRuleError(e){const t={hasColumnNameError:!1,hasFormatError:!1,message:""},n=[];return e.isNewRule!==void 0&&e.isNewRule||(this.isDuplicateRule(e)&&(t.hasColumnNameError=!0,n.push("Duplicate column name/type combo.")),Rm(e.columnName)||(t.hasColumnNameError=!0,n.push("Column names must start with a letter or underscore and contain only alphanumeric characters or underscores.")),e.format.formatString!==void 0&&e.format.formatString.length===0?(t.hasFormatError=!0,n.push("Empty formatting rule.")):Ds(e.columnType,e.format)||(t.hasFormatError=!0,n.push("Invalid formatting rule.")),t.message=n.join(`
|
|
39
|
+
`)),t}renderFormatRule(e,t){const n=`input-${e}-columnName`,s=`input-${e}-columnType`,i=`input-${e}-format`,o=this.getCachedColumnTypeOptions(),a=u=>this.handleFormatRuleChange(e,"columnName",u.target.value),r=()=>this.handleFormatRuleChange(e,"isNewRule",!1),c=u=>this.handleFormatRuleChange(e,"columnType",u.target.value),h=this.getRuleError(t);return l.jsxs("fieldset",{className:"container-fluid format-rule-container",children:[l.jsxs("div",{className:"form-row",children:[l.jsxs("div",{className:"form-group col-7 mb-2",children:[l.jsx("label",{htmlFor:n,children:"Column Name"}),l.jsx("input",{id:n,className:$("form-control",{"is-invalid":h.hasColumnNameError}),"data-lpignore":!0,type:"text",value:t.columnName,onChange:a,onBlur:r})]}),l.jsxs("div",{className:"form-group col mb-2",children:[l.jsx(V,{kind:"ghost",className:"btn-delete-format-rule float-right",tabIndex:-1,onClick:()=>this.handleFormatRuleDelete(e),icon:Qt,tooltip:"Delete","aria-label":"Delete Format Rule"}),l.jsx("label",{htmlFor:s,children:"Column Type"}),l.jsx("select",{id:s,className:"custom-select",value:t.columnType,onChange:c,children:o})]})]}),l.jsx("div",{className:"form-row",children:l.jsxs("div",{className:"form-group col-12 d-flex mb-2",children:[l.jsx("label",{className:"flex-shrink-0 col-form-label mr-3",htmlFor:i,children:"Formatting Rule"}),this.renderFormatRuleInput(e,t.columnType,i,t.format,h.hasFormatError)]})}),l.jsx("div",{className:"form-row",children:l.jsx("div",{className:"form-group col-12 d-flex mb-2",children:h.message&&l.jsx("p",{className:"text-danger",children:h.message})})})]},e)}renderFormatRuleInput(e,t,n,s,i){switch(R.getNormalizedType(t)){case R.dataType.DATETIME:return this.renderDateTimeFormatRuleInput(e,n,s,i);case R.dataType.DECIMAL:return this.renderDecimalFormatRuleInput(e,n,s,i);case R.dataType.INT:return this.renderIntegerFormatRuleInput(e,n,s,i);default:throw new Error(`Unrecognized column type: ${t}`)}}renderDateTimeFormatRuleInput(e,t,n,s){const{showTimeZone:i,showTSeparator:o,timeZone:a}=this.state,r=n.formatString??"";return l.jsxs("select",{className:$("custom-select",{"is-invalid":s}),value:r,id:t,onChange:c=>{const h=_e.makeFormat("",c.target.value,_e.TYPE_GLOBAL);this.handleFormatRuleChange(e,"format",h)},children:[l.jsx("option",{value:"",disabled:!0,children:"Select format"},"default"),this.getCachedDateTimeFormatOptions(a,i,o)]})}renderIntegerFormatRuleInput(e,t,n,s){const i=n.formatString??"";return l.jsx("input",{className:$("form-control","flex-grow-1",{"is-invalid":s}),"data-lpignore":!0,id:t,placeholder:$e.DEFAULT_FORMAT_STRING,type:"text",value:i,onChange:o=>{const a=$e.makeFormat("",o.target.value,$e.TYPE_GLOBAL,void 0);this.handleFormatRuleChange(e,"format",a)}})}renderDecimalFormatRuleInput(e,t,n,s){const i=n.formatString??"";return l.jsx("input",{className:$("form-control","flex-grow-1",{"is-invalid":s}),"data-lpignore":!0,id:t,placeholder:Re.DEFAULT_FORMAT_STRING,type:"text",value:i,onChange:o=>{const a=Re.makeFormat("",o.target.value,Re.TYPE_GLOBAL,void 0);this.handleFormatRuleChange(e,"format",a)}})}render(){const{formatRulesChanged:e,formatSettings:t}=this.state,n=t.map((i,o)=>l.jsx(gt,{classNames:"fade",timeout:We.transitionMs,onEnter:this.handleFormatRuleEntered,children:this.renderFormatRule(o,i)},i.id)),s=l.jsx(V,{kind:"ghost",className:"mb-3",onClick:this.handleFormatRuleCreate,ref:this.addFormatRuleButtonRef,icon:Os,children:"Add New Rule"});return l.jsxs("div",{className:"app-settings-formatting-section",ref:this.containerRef,children:[l.jsx("div",{className:"app-settings-menu-description mb-3",children:"Customize the formatting of table columns by applying rules based on matching both a column name and column type."}),l.jsx(cp,{appear:e,enter:e,exit:e,children:n}),s]})}}const BR=d=>({formatter:cu(d),defaultDateTimeFormat:ru(d),defaultDecimalFormatOptions:lu(d),defaultIntegerFormatOptions:du(d),showTimeZone:hu(d),showTSeparator:uu(d),truncateNumbersWithPound:mu(d),timeZone:Ao(d),settings:Ct(d)}),VR=ft(BR,{saveSettings:hr})(xd);class Nn extends b.Component{static defaultProps={onDone:()=>{}};static FORMATTING_SECTION_KEY="SettingsMenu.formatting";static COLUMN_SPECIFIC_SECTION_KEY="SettingsMenu.columnFormatting";static APPLICATION_SECTION_KEY="ApplicationMenu.settings";static SHORTCUT_SECTION_KEY="SettingsMenu.shortcuts";static focusFirstInputInContainer(e){const t=e?.querySelector("input, select, textarea");t&&t.focus()}constructor(e){super(e),this.handleClose=this.handleClose.bind(this),this.handleScrollTo=this.handleScrollTo.bind(this),this.handleSectionToggle=this.handleSectionToggle.bind(this),this.handleExportSupportLogs=this.handleExportSupportLogs.bind(this),this.menuContentRef=X.createRef(),this.state={expandedSectionKey:Nn.FORMATTING_SECTION_KEY}}componentDidMount(){Nn.focusFirstInputInContainer(this.menuContentRef.current)}menuContentRef;isSectionExpanded(e){const{expandedSectionKey:t}=this.state;return t===e}handleScrollTo(e,t){this.menuContentRef.current?.scrollTo(e,t)}handleSectionToggle(e){this.setState(t=>({expandedSectionKey:t.expandedSectionKey===e?void 0:e}))}handleClose(){const{onDone:e}=this.props;e()}handleExportSupportLogs(){const{serverConfigValues:e}=this.props;_R(void 0,Object.fromEntries(e))}render(){const e="0.32.0",t="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"),a=s.get("deephaven.version"),r=(c,h)=>l.jsxs(l.Fragment,{children:[l.jsx("div",{children:c}),l.jsx("div",{children:h})]});return l.jsxs("div",{className:"app-settings-menu",children:[l.jsxs("header",{className:"app-settings-menu-header",children:[l.jsx("div",{className:"flex-spacer"}),l.jsx(V,{kind:"ghost",className:"btn-close-settings-menu",onClick:this.handleClose,icon:l.jsx(J,{icon:Ui,transform:"grow-4"}),tooltip:"Close"})]}),l.jsxs("div",{className:"app-settings-menu-content",ref:this.menuContentRef,children:[l.jsx("h5",{children:"Settings"}),l.jsx("hr",{className:"my-0"}),l.jsx(To,{sectionKey:Nn.FORMATTING_SECTION_KEY,isExpanded:this.isSectionExpanded(Nn.FORMATTING_SECTION_KEY),title:l.jsxs(l.Fragment,{children:[l.jsx(J,{icon:vg,transform:"grow-4",className:"mr-2"}),"Default Format & Time zone"]}),onToggle:this.handleSectionToggle,children:l.jsx(RR,{})}),l.jsx(To,{sectionKey:Nn.COLUMN_SPECIFIC_SECTION_KEY,isExpanded:this.isSectionExpanded(Nn.COLUMN_SPECIFIC_SECTION_KEY),title:l.jsxs(l.Fragment,{children:[l.jsx(J,{icon:Tg,transform:"grow-4",className:"mr-2"}),"Format by Column Name & Type"]}),onToggle:this.handleSectionToggle,children:l.jsx(VR,{scrollTo:this.handleScrollTo})}),l.jsx(To,{sectionKey:Nn.SHORTCUT_SECTION_KEY,isExpanded:this.isSectionExpanded(Nn.SHORTCUT_SECTION_KEY),title:l.jsxs(l.Fragment,{children:[l.jsx(J,{icon:Eg,transform:"grow-2"})," ","Keyboard Shortcuts"]}),onToggle:this.handleSectionToggle,children:l.jsx(OR,{})}),l.jsxs("div",{className:"app-settings-footer",children:[l.jsxs("div",{className:"app-settings-footer-section",children:[l.jsxs("div",{className:"app-settings-footer-item",children:[l.jsx("div",{className:"font-weight-bold",children:"Support"}),l.jsxs("div",{children:["GitHub: ",l.jsx("a",{href:t,className:"custom-link",target:"_blank",rel:"noopener noreferrer",children:t})]}),l.jsx(V,{kind:"tertiary",className:"mt-2 py-2",onClick:this.handleExportSupportLogs,children:"Export Logs"})]}),l.jsxs("div",{className:"app-settings-footer-item",children:[l.jsx("div",{className:"font-weight-bold",children:"Documentation"}),l.jsx("a",{target:"_blank",rel:"noreferrer noopener",href:n,className:"custom-link",children:n})]}),l.jsxs("div",{className:"app-settings-footer-item",children:[l.jsx("div",{className:"font-weight-bold",children:"Version"}),l.jsxs("span",{className:"d-inline-block text-muted",children:[a," ",l.jsx(J,{icon:yg}),l.jsxs(tt,{interactive:!0,children:[l.jsxs("div",{className:"detailed-server-config",children:[r("Engine Version",a),r("Web UI Version",e),r("Java Version",o),r("Barrage Version",i)]}),l.jsx(ar,{tooltip:"Copy version numbers",copy:`Engine Version: ${a}
|
|
40
40
|
Web UI Version: ${e}
|
|
41
41
|
Java Version: ${o}
|
|
42
|
-
Barrage Version: ${i}`,children:"Copy Versions"})]})]})]}),l.jsx("div",{className:"app-settings-footer-item",children:l.jsx(IR,{})})]}),l.jsx("div",{className:"app-settings-footer-section",children:l.jsx("div",{className:"logo",children:l.jsx("a",{target:"_blank",rel:"noreferrer noopener",href:"https://deephaven.io",className:"d-inline-block custom-link p-1",children:l.jsx("img",{src:ym,alt:"Deephaven Data Labs",width:"230px"})})})})]})]})]})}}const fh=10;function Di(d){const{forwardedProps:{menuItem:{action:e,title:t,disabled:n},iconElement:s,displayShortcut:i,isMouseSelected:o,isKeyboardSelected:a,closeMenu:r}}=d,c=b.useRef(),h=b.useRef(),u=b.useRef(null),[m,p]=b.useState(!1),g=b.useCallback(S=>{c.current!=null&&h.current!=null&&u.current&&(Math.abs(c.current-S.clientX)>=fh||Math.abs(h.current-S.clientY)>=fh)&&(p(!0),window.removeEventListener("mousemove",g),r(),e(S),u.current=null)},[e,r]);function C(S){c.current=S.clientX,h.current=S.clientY,u.current=S.target,window.addEventListener("mousemove",g)}function f(S){u.current===S.target&&(p(!0),r(),e(),window.removeEventListener("mousemove",g)),u.current=null}return b.useEffect(function(){return function(){return window.removeEventListener("mousemove",g)}},[g]),l.jsxs("button",{type:"button",className:$("btn-context-menu",{disabled:n},{active:o&&!n},{"keyboard-active":a&&!n}),onMouseDown:C,onMouseUp:f,disabled:m,children:[l.jsx("span",{className:$("icon"),children:s}),l.jsx("span",{className:"title",children:t}),l.jsx("span",{className:"shortcut",children:i})]})}function Rd(d){const{handleControlSelect:e,handleToolSelect:t,onClearFilter:n}=d,s=b.useMemo(()=>[{title:"Input Filter",icon:xg,menuElement:l.jsx(Di,{}),action:i=>{e(Is.INPUT_FILTER,i)},order:10},{title:"Dropdown Filter",icon:Oh,menuElement:l.jsx(Di,{}),action:i=>{e(Is.DROPDOWN_FILTER,i)},order:15},{title:"Markdown Widget",icon:Rg,menuElement:l.jsx(Di,{}),action:i=>{e(Is.MARKDOWN,i)},order:20},{title:"Filter Sets",icon:il,menuElement:l.jsx(Di,{}),action:i=>{e(Is.FILTER_SET_MANAGER,i)},order:25},{disabled:!0,menuElement:l.jsx("div",{className:"context-menu-group-header",children:"Tools"}),order:30},{title:"Linker",icon:yl,action:()=>{t(jt.LINKER)},order:40,shortcut:es.LINKER},{disabled:!0,menuElement:l.jsx("div",{className:"context-menu-group-header",children:"Actions"}),order:50},{title:"Clear All Filters",icon:Ig,action:()=>{n()},order:60,shortcut:Kt.TABLE.CLEAR_ALL_FILTERS}],[e,t,n]);return l.jsx(Zn,{popperClassName:"controls-menu-popper",actions:s})}Rd.propTypes={handleControlSelect:D.func,handleToolSelect:D.func,onClearFilter:D.func};Rd.defaultProps={handleControlSelect:()=>{},handleToolSelect:()=>{},onClearFilter:()=>{}};Di.propTypes={forwardedProps:D.shape({iconElement:D.node,displayShortcut:D.string,isMouseSelected:D.bool.isRequired,isKeyboardSelected:D.bool.isRequired,closeMenu:D.func.isRequired,menuItem:D.shape({action:D.func,title:D.string,disabled:D.bool}).isRequired})};Di.defaultProps={forwardedProps:null};const UR=Ls(Em,null),$R={layoutStorage:UR},WR=d=>d.layoutStorage,GR=d=>d.serverConfigValues;Object.entries($R).map(([d,e])=>Gi.register(d,e));const Ch=10;function zR(d){const{onExportLayout:e,onImportLayout:t,onResetLayout:n,onSelect:s,widgets:i=[]}=d,[o,a]=b.useState(!1),[r,c]=b.useState(""),h=b.useRef(null),u=b.useRef(),m=b.useCallback((T,y)=>{T!=null&&s(T,y)},[s]),p=b.useCallback(T=>{c(T.target.value)},[]),g=b.useCallback(T=>{u.current!=null&&(Math.abs(u.current.x-T.clientX)>=Ch||Math.abs(u.current.y-T.clientY)>=Ch)&&(a(!0),window.removeEventListener("mousemove",g),m(u.current.widget,T),u.current=void 0)},[u,m]),C=b.useCallback((T,y)=>{u.current={x:T.clientX,y:T.clientY,widget:y},window.addEventListener("mousemove",g)},[g]),f=b.useCallback((T,y)=>{window.removeEventListener("mousemove",g),u.current?.widget===y&&(a(!0),m(y)),u.current=void 0},[g,u,m]),S=b.useMemo(()=>i.filter(T=>r?T.name?.toLowerCase().includes(r.toLowerCase()):!0),[r,i]).sort((T,y)=>T.name?.localeCompare(y.name??"")??0),v=b.useMemo(()=>S.map(T=>l.jsx("li",{children:l.jsxs(V,{kind:"ghost","data-testid":`panel-list-item-${T.name??""}-button`,onMouseDown:y=>{C(y,T)},onMouseUp:y=>{f(y,T)},onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&m(T)},disabled:o,onClick:()=>{},children:[l.jsx(Kh,{type:T.type})," ",T.name??""]})},T.name)),[S,o,C,f,m]),w=b.useMemo(()=>v.length===0?l.jsx("span",{children:"No bound variables found."}):null,[v]);return l.jsxs("div",{className:"widget-list-container d-flex flex-column",children:[l.jsx("div",{className:"widget-list-header",children:l.jsx(As,{value:r,placeholder:"Find Table, Plot or Widget",onChange:p,ref:h})}),l.jsxs("ul",{className:"widget-list flex-grow-1",children:[w&&l.jsx("li",{className:"widget-list-message",children:w}),!w&&v]}),l.jsx("div",{children:l.jsx("hr",{})}),l.jsxs("div",{className:"widget-list-footer",children:[l.jsxs(V,{kind:"ghost",onClick:e,children:[l.jsxs("div",{className:"fa-md fa-layers",children:[l.jsx(J,{mask:sl,icon:Vd,transform:"right-5 down-5"}),l.jsx(J,{icon:Vd,transform:"right-8 down-6"})]}),"Export Layout"]}),l.jsxs(V,{kind:"ghost",onClick:t,children:[l.jsxs("div",{className:"fa-md fa-layers",children:[l.jsx(J,{mask:sl,icon:ol,transform:"right-5 down-5"}),l.jsx(J,{icon:ol,transform:"right-8 down-6"})]}),"Import Layout"]}),l.jsx(V,{kind:"ghost",icon:ei,onClick:n,tooltip:"Reset Layout"})]})]})}const KR=async(d,e,t)=>{let n,s,i,o;if(va(e)?(n=e.settings,s=e.table,i=void 0,o=e.tableSettings):(n={},s="",i=e.figure,o={}),t!==void 0&&(t.tableSettings!=null&&(o=t.tableSettings),t.table!=null&&(s=t.table),t.figure!=null&&(i=t.figure),t.settings!=null&&(n={...n,...t.settings})),i!==void 0){const c={title:i,name:i,type:x.VariableType.FIGURE},h=await d.getObject(c);return Aa.makeModel(n,h)}const a={title:i,name:s,type:x.VariableType.TABLE},r=await d.getObject(a);return be.applyTableSettings(r,o,Ao(mr.getState())),Aa.makeModelFromSettings(n,r)},qR=async(d,e,t=x.VariableType.TABLE)=>{const{table:n}=e,s={title:n,name:n,type:t},i=await d.getObject(s);return ud.makeModel(i)};function YR({onAutoFillClick:d=()=>{}}){return l.jsxs("div",{className:"empty-dashboard-container",children:[l.jsxs("div",{className:"hint-container",children:[l.jsx(J,{icon:kh})," ",l.jsx("br",{}),"Use the panel list to add objects from a query."]}),l.jsxs("div",{className:"empty-dashboard",children:[l.jsx("div",{className:"add-panels-hint",children:"Drag Panels Here"}),l.jsx(V,{kind:"tertiary",onClick:d,children:"Auto fill objects"})]})]})}function XR(d){return d.version===2}function ZR(d){return Array.isArray(d)}const Ca=Z.module("UserLayoutUtils"),QR={layoutConfig:[{type:"column",content:[{type:"row",height:40,content:[{type:"stack",content:[{type:"react-component",component:Ii.COMPONENT,title:Ii.TITLE,isClosable:!1},{type:"react-component",component:Ya.COMPONENT,title:Ya.TITLE,isClosable:!1}]},{type:"stack",width:25,content:[{type:"react-component",component:$a.COMPONENT,title:$a.TITLE,isClosable:!1},{type:"react-component",component:Ga.COMPONENT,title:Ga.TITLE,isClosable:!1}]}]},{type:"row",content:[{type:"stack",title:"Notebooks",content:[]}]}]}],links:[],filterSets:[],version:2},JR={layoutConfig:[],links:[],filterSets:[],version:2};function Mm(d){if(XR(d))return d;if(ZR(d))return{layoutConfig:d,links:[],filterSets:[],version:2};throw new Error(`Unexpected layout import format: ${d}`)}async function eI(d,e=!0){try{const t=await d.getLayouts();if(t.length>0)try{const n=await d.getLayout(t[0]);return Mm(n)}catch(n){Ca.error("Unable to load layout",t[0],":",n),Ca.warn("No valid layouts found, falling back to default layout")}}catch(t){Ca.error("Unable to fetch layout list",t),Ca.warn("Falling back to default layout")}return e?QR:JR}function tI(d){const{filterSets:e,layoutConfig:t,links:n}=d;return{filterSets:e,layoutConfig:t,links:n,version:2}}const Ea={exportLayout:tI,getDefaultLayout:eI,normalizeLayout:Mm},Sa=Z.module("DownloadServiceWorkerUtils");class Io{static DOWNLOAD_PATH="/download/";static registerOnLoaded(){new URL("/ide/",window.location.href).origin===window.location.origin&&("serviceWorker"in navigator?window.addEventListener("load",()=>{const t=new URL("/ide/download/serviceWorker.js",window.location.href);navigator.serviceWorker.register(t).then(n=>{n.update(),Sa.info("Registering service worker on ",t,n)}).catch(n=>{Sa.error("Failed to register service worker",n)})}):Sa.info("Service worker is not supported."))}static async getServiceWorker(){if("serviceWorker"in navigator){const t=(await navigator.serviceWorker.getRegistrations()).find(n=>n.scope.endsWith(Io.DOWNLOAD_PATH));if(t&&t.active)return Sa.info("Download service worker is active."),t.active;throw new Error("Can not find download service worker.")}throw new Error("Download service worker is not available.")}static unregisterSW(){}}const km={react:X,"react-dom":Pi,redux:hp,"react-redux":up},nI=mp(km),sI=pp({requires:nI}),iI=gp.createRequires(km),oI=fp({requires:iI}),aI=Z.module("PluginUtils");class bl{static loadComponentPlugin(e){const t=new URL("/ide/plugins/",`${window.location}`),n=new URL(`${e}.js`,t),s=X.forwardRef((i,o)=>l.jsx(sI,{url:n,render:({err:a,Component:r})=>{if(a!=null&&a!==""){const c=`Error loading plugin ${e} from ${n} due to ${a}`;return aI.error(c),l.jsx("div",{className:"error-message",children:`${c}`})}return l.jsx(r,{ref:o,...i})}}));return s.pluginName=e,s.displayName="Plugin",s}static async loadModulePlugin(e){return await oI(e)}static async loadJson(e){return new Promise((t,n)=>{const s=new XMLHttpRequest;s.addEventListener("load",()=>{try{const i=JSON.parse(s.responseText);t(i)}catch(i){n(i)}}),s.addEventListener("error",i=>{n(i)}),s.open("GET",e),s.send()})}}const Dt=Z.module("AppMainContainer");class Eo extends b.Component{static handleWindowBeforeUnload(e){e.preventDefault(),e.returnValue=""}static hydrateConsole(e,t){return ml.hydrate({...e,unzip:n=>Eh.loadAsync(n).then(s=>Object.values(s.files))},t)}constructor(e){super(e),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=X.createRef(),this.state={contextActions:[{action:()=>{this.handleToolSelect(jt.LINKER)},shortcut:es.LINKER,isGlobal:!0},{action:()=>{this.sendClearFilter()},shortcut:Kt.TABLE.CLEAR_ALL_FILTERS,isGlobal:!0},{action:()=>{Dt.debug("Consume unhandled save shortcut")},shortcut:es.SAVE,isGlobal:!0}],isPanelsMenuShown:!1,isSettingsMenuShown:!1,widgets:[]}}componentDidMount(){this.initWidgets(),window.addEventListener("beforeunload",Eo.handleWindowBeforeUnload)}componentDidUpdate(e){const{dashboardData:t}=this.props;e.dashboardData!==t&&this.handleDataChange(t)}componentWillUnmount(){this.deinitWidgets(),window.removeEventListener("beforeunload",Eo.handleWindowBeforeUnload)}goldenLayout;importElement;widgetListenerRemover;initWidgets(){const{connection:e}=this.props;if(e.subscribeToFieldUpdates==null){Dt.warn("subscribeToFieldUpdates not supported, not initializing widgets");return}this.widgetListenerRemover=e.subscribeToFieldUpdates(t=>{Dt.debug("Got updates",t),this.setState(({widgets:n})=>{const{updated:s,created:i,removed:o}=t,a=[...s,...o],r=n.filter(h=>!a.some(u=>u.name===h.name));return[...s,...i].forEach(h=>{h.name!=null&&h.name!==""&&r.push(h)}),{widgets:r}})})}deinitWidgets(){this.widgetListenerRemover?.()}openNotebookFromURL(){const{match:e}=this.props,{notebookPath:t}=e.params;if(t){const{session:n,sessionConfig:s}=this.props;if(n==null||s==null){Dt.error("No session available to open notebook URL",t);return}const i={id:`/${t}`,itemName:`/${t}`},o=s.type,a={value:null,language:o};this.emitLayoutEvent(Xe.SELECT_NOTEBOOK,n,o,a,i,!0)}}sendClearFilter(){this.emitLayoutEvent(Qe.CLEAR_ALL_FILTERS)}emitLayoutEvent(e,...t){this.goldenLayout?.eventHub.emit(e,...t)}handleError(e){ve.isCanceled(e)||Dt.error(e)}handleSettingsMenuHide(){this.setState({isSettingsMenuShown:!1})}handleSettingsMenuShow(){this.setState({isSettingsMenuShown:!0})}handleControlSelect(e,t=null){switch(Dt.debug("handleControlSelect",e),e){case Is.DROPDOWN_FILTER:this.emitLayoutEvent(Qe.OPEN_DROPDOWN,{title:"DropdownFilter",type:e,createNewStack:!0,dragEvent:t});break;case Is.INPUT_FILTER:this.emitLayoutEvent(Qe.OPEN_INPUT,{title:"InputFilter",type:e,createNewStack:!0,dragEvent:t});break;case Is.MARKDOWN:this.emitLayoutEvent(pm.OPEN,{title:"Markdown",type:e,dragEvent:t});break;case Is.FILTER_SET_MANAGER:this.emitLayoutEvent(Qe.OPEN_FILTER_SET_MANAGER,{title:"FilterSets",type:e,dragEvent:t});break;default:throw new Error(`Unrecognized control type ${e}`)}}handleToolSelect(e){Dt.debug("handleToolSelect",e);const{activeTool:t,setActiveTool:n}=this.props;n(t===e?jt.DEFAULT:e)}handleClearFilter(){this.sendClearFilter()}handleDataChange(e){const{updateWorkspaceData:t}=this.props,{closed:n,filterSets:s,links:i}=e;t({closed:n,filterSets:s,links:i})}handleGoldenLayoutChange(e){this.goldenLayout=e}handleLayoutConfigChange(e){const{updateWorkspaceData:t}=this.props;t({layoutConfig:e})}handleWidgetMenuClick(){this.setState(({isPanelsMenuShown:e})=>({isPanelsMenuShown:!e}))}handleWidgetSelect(e,t){this.setState({isPanelsMenuShown:!1}),Dt.debug("handleWidgetSelect",e,t),this.openWidget(e,t)}handleWidgetsMenuClose(){this.setState({isPanelsMenuShown:!1})}handleAutoFillClick(){const{widgets:e}=this.state;Dt.debug("handleAutoFillClick",e);const t=e.sort((n,s)=>n.title!=null&&s.title!=null?n.title.localeCompare(s.title):0);for(let n=0;n<t.length;n+=1)this.openWidget(t[n])}handleExportLayoutClick(){Dt.info("handleExportLayoutClick"),this.setState({isPanelsMenuShown:!1});try{const{workspace:e}=this.props,{data:t}=e,n=Ea.exportLayout(t);Dt.info("handleExportLayoutClick exportedConfig",n);const s=new Blob([JSON.stringify(n)],{type:"application/json"}),i=x.i18n.DateTimeFormat.format("yyyy-MM-dd-HHmmss",new Date),o=document.createElement("a");o.href=URL.createObjectURL(s),o.download=`deephaven-app-layout-${i}.json`,o.click()}catch(e){Dt.error("Unable to export layout",e)}}handleImportLayoutClick(){Dt.info("handleImportLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.importElement.current!=null&&(this.importElement.current.value="",this.importElement.current.click())}handleResetLayoutClick(){Dt.info("handleResetLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.resetLayout()}handleImportLayoutFiles(e){e.stopPropagation(),e.preventDefault(),e.target.files!=null&&this.importLayoutFile(e.target.files?.[0])}async importLayoutFile(e){try{const{updateDashboardData:t,updateWorkspaceData:n}=this.props,s=await e.text(),i=JSON.parse(s),{filterSets:o,layoutConfig:a,links:r}=Ea.normalizeLayout(i);n({layoutConfig:a}),t(wn,{filterSets:o,links:r})}catch(t){Dt.error("Unable to import layout",t)}}async resetLayout(){const{layoutStorage:e,session:t}=this.props,{filterSets:n,layoutConfig:s,links:i}=await Ea.getDefaultLayout(e,t!==void 0),{updateDashboardData:o,updateWorkspaceData:a}=this.props;a({layoutConfig:s}),o(wn,{filterSets:n,links:i})}handlePaste(e){if(e.target instanceof HTMLElement&&e.target.closest(".monaco-editor"))return;const{clipboardData:t}=e,n=t.getData("Text"),s=/“|”/g;s.test(n)&&(e.preventDefault(),e.stopPropagation(),document.execCommand("insertText",!1,n.replace(s,'"')))}handleLoadTablePlugin(e){const{plugins:t}=this.props,n=t.get(e);return n!=null&&n.TablePlugin!=null?n.TablePlugin:bl.loadComponentPlugin(e)}hydrateDefault(e,t){const{connection:n}=this.props,{metadata:s}=e;if(s?.type!=null&&(s?.id!=null||s?.name!=null)){const i=s.id!=null?{type:s.type,id:s.id}:{type:s.type,name:s.name,title:s.name};return{fetch:()=>n.getObject(i),localDashboardId:t,...e}}return ml.hydrate(e,t)}hydrateGrid(e,t){return this.hydrateTable(e,t,e.metadata.type??x.VariableType.TABLE)}hydratePandas(e,t){return this.hydrateTable(e,t,x.VariableType.PANDAS)}hydrateTable(e,t,n=x.VariableType.TABLE){const{connection:s}=this.props;return{...e,getDownloadWorker:Io.getServiceWorker,loadPlugin:this.handleLoadTablePlugin,localDashboardId:t,makeModel:()=>qR(s,e.metadata,n)}}hydrateChart(e,t){const{connection:n}=this.props;return{...e,localDashboardId:t,makeModel:()=>{const{metadata:s,panelState:i}=e;return KR(n,s,i)}}}openWidget(e,t){const{connection:n}=this.props;this.emitLayoutEvent(Ee.OPEN,{dragEvent:t,fetch:()=>n.getObject(e),widget:e})}getDashboardPlugins=fe(e=>[...e.entries()].filter(([,t])=>t.DashboardPlugin!=null).map(([t,{DashboardPlugin:n}])=>l.jsx(n,{},t)));render(){const{activeTool:e,plugins:t,user:n,workspace:s,serverConfigValues:i}=this.props,{data:o}=s,{layoutConfig:a}=o,{permissions:r}=n,{canUsePanels:c}=r,{contextActions:h,isPanelsMenuShown:u,isSettingsMenuShown:m,widgets:p}=this.state,g=this.getDashboardPlugins(t);return l.jsxs("div",{className:$("app-main-tabs","w-100","h-100","d-flex","flex-column",e?`active-tool-${e.toLowerCase()}`:""),onPaste:this.handlePaste,tabIndex:-1,children:[l.jsx("nav",{className:"nav-container",children:l.jsxs("div",{className:"app-main-top-nav-menus",children:[l.jsx("img",{src:ym,alt:"Deephaven Data Labs",width:"115px",className:"ml-1"}),l.jsxs("div",{children:[l.jsxs(V,{kind:"ghost",className:"btn-panels-menu",icon:Dg,onClick:()=>{},children:["Controls",l.jsx(Rd,{handleControlSelect:this.handleControlSelect,handleToolSelect:this.handleToolSelect,onClearFilter:this.handleClearFilter})]}),c&&l.jsxs(V,{kind:"ghost",className:"btn-panels-menu btn-show-panels","data-testid":"app-main-panels-button",onClick:this.handleWidgetMenuClick,icon:Fg,children:["Panels",l.jsx(ri,{isShown:u,className:"panels-menu-popper",onExited:this.handleWidgetsMenuClose,closeOnBlur:!0,interactive:!0,children:l.jsx(zR,{widgets:p,onExportLayout:this.handleExportLayoutClick,onImportLayout:this.handleImportLayoutClick,onResetLayout:this.handleResetLayoutClick,onSelect:this.handleWidgetSelect})})]}),l.jsx(V,{kind:"ghost",className:$("btn-settings-menu",{"text-warning":n.operateAs!==n.name}),onClick:this.handleSettingsMenuShow,icon:l.jsx(J,{icon:ko,transform:"grow-3 right-1 down-1"}),tooltip:"User Settings"})]})]})}),l.jsxs(jw,{emptyDashboard:l.jsx(YR,{onAutoFillClick:this.handleAutoFillClick}),id:wn,layoutConfig:a,onGoldenLayoutChange:this.handleGoldenLayoutChange,onLayoutConfigChange:this.handleLayoutConfigChange,onLayoutInitialized:this.openNotebookFromURL,hydrate:this.hydrateDefault,children:[l.jsx(nR,{hydrate:this.hydrateGrid,getDownloadWorker:Io.getServiceWorker,loadPlugin:this.handleLoadTablePlugin}),l.jsx(Xx,{hydrate:this.hydrateChart}),l.jsx(Zx,{}),l.jsx(Jx,{hydrateConsole:Eo.hydrateConsole,notebooksUrl:new URL("/notebooks/",`${window.location}`).href}),l.jsx(eR,{}),l.jsx(hR,{hydrate:this.hydratePandas}),l.jsx(cR,{}),l.jsx(dR,{}),g]}),l.jsx(gt,{in:m,timeout:We.transitionMidMs,classNames:"slide-left",mountOnEnter:!0,unmountOnExit:!0,children:l.jsx(Nn,{serverConfigValues:i,onDone:this.handleSettingsMenuHide})}),l.jsx(ae,{actions:h}),l.jsx("input",{ref:this.importElement,type:"file",accept:".json",style:{display:"none"},onChange:this.handleImportLayoutFiles})]})}}const rI=d=>({activeTool:cr(d),dashboardData:Vt(d,wn),layoutStorage:WR(d),plugins:US(d),connection:Zy(d,wn),session:ai(d,wn)?.session,sessionConfig:ai(d,wn)?.config,user:iu(d),workspace:dr(d),serverConfigValues:GR(d)}),lI=ft(rI,{setActiveTool:ur,updateDashboardData:Pn,updateWorkspaceData:Eu})(Cp(Eo));function dI(){return l.jsxs("div",{className:"app",children:[l.jsx(lI,{}),l.jsx(_h,{})]})}const cI=Z.module("LocalWorkspaceStorage");class Fi{static STORAGE_KEY="deephaven.WorkspaceStorage";static async makeDefaultWorkspaceData(e,t){const{filterSets:n,links:s,layoutConfig:i}=await Ea.getDefaultLayout(e,t?.isConsoleAvailable);return{settings:{defaultDateTimeFormat:_e.DEFAULT_DATETIME_FORMAT_STRING,formatter:[],timeZone:_e.DEFAULT_TIME_ZONE_ID,showTimeZone:!1,showTSeparator:!0,disableMoveConfirmation:!1,defaultDecimalFormatOptions:{defaultFormatString:Re.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:$e.DEFAULT_FORMAT_STRING},truncateNumbersWithPound:!1,defaultNotebookSettings:{isMinimapEnabled:!1}},layoutConfig:i,closed:[{}],links:s,filterSets:n}}static async makeDefaultWorkspace(e,t){return{data:await Fi.makeDefaultWorkspaceData(e,t)}}layoutStorage;constructor(e){this.layoutStorage=e}async load(e){try{return JSON.parse(localStorage.getItem(Fi.STORAGE_KEY)??"")}catch{return cI.info("Unable to load workspace data, initializing to default data"),Fi.makeDefaultWorkspace(this.layoutStorage,e)}}async save(e){return localStorage.setItem(Fi.STORAGE_KEY,JSON.stringify(e)),e}}class hI extends Error{isNoConsolesError=!0}function uI(d){return d.isNoConsolesError}const Fs=Z.module("SessionUtils");var Om=(d=>(d.ANONYMOUS="anonymous",d.PARENT="parent",d))(Om||{});function mI(){return new URL("/jsapi",`${window.location}`)}function Am(){const d=mI();return`${d.protocol}//${d.host}`}function pI(){switch(new URLSearchParams(window.location.search).get("authProvider")){case"parent":return"parent";default:return"anonymous"}}function gI(){const d=Am();return Fs.info(`Starting connection to '${d}'...`),new x.IdeConnection(d)}async function fI(d){Fs.info("Getting console types...");const e=await d.getConsoleTypes();if(Fs.info("Available types:",e),e.length===0)throw new hI("No console types available");const t=e[0];Fs.info("Starting session with type",t);const n=await d.startSession(t),s={type:t,id:Pe.generate()};return Fs.info("Console session established",s),{session:n,config:s,connection:d}}function CI(){const d=Am();return Fs.info("createCoreClient",d),new x.CoreClient(d)}async function SI(){if(window.opener==null)throw new Error("window.opener is null, unable to send auth request.");return new Promise(d=>{const e=t=>{const{data:n}=t;if(Fs.debug("Received message",n),n?.message!=="loginOptions"){Fs.debug("Ignore received message",n);return}window.removeEventListener("message",e),d(n.payload)};window.addEventListener("message",e),window.opener.postMessage("requestLoginOptionsFromParent","*")})}async function bI(d){switch(d){case"parent":return SI();case"anonymous":return{type:x.CoreClient.LOGIN_TYPE_ANONYMOUS};default:throw new Error(`Unknown auth type: ${d}`)}}class wI{storageService;root;constructor(e,t=""){this.storageService=e,this.root=t}async getLayouts(){return(await this.storageService.listItems(this.root,"*.json")).map(t=>t.basename)}async getLayout(e){const n=await(await this.storageService.loadFile(`${this.root}/${e}`)).text();return JSON.parse(n)}}const mo=Z.module("GrpcFileStorageTable");class Xa{static REFRESH_DEBOUNCE=50;storageService;baseRoot;root;currentSize=0;currentViewport;listeners=[];viewportUpdatePromise;currentViewportData;childTables=new Map;constructor(e,t="",n=t){this.storageService=e,this.baseRoot=t,this.root=n,n===t&&(this.doRefresh=Ye(this.doRefresh.bind(this),Xa.REFRESH_DEBOUNCE))}removeBaseRoot(e){return he.removeRoot(this.baseRoot,e)}getViewportData(){return this.viewportUpdatePromise||this.refreshInternal(),this.viewportUpdatePromise??Promise.resolve({items:[],offset:0})}getSnapshot(e){throw new Error("Method not implemented.")}get size(){return this.currentSize}setExpanded(e,t){const n=e.split("/");let s=n.shift();if((s===void 0||s==="")&&(s=n.shift()),s===void 0||s==="")throw new Error(`Invalid path: ${e}`);const i=n.join("/");if(t){if(!this.childTables.has(s)){const o=new Xa(this.storageService,this.baseRoot,`${this.root}/${s}`);this.childTables.set(s,o)}i&&this.childTables.get(s)?.setExpanded(i,t)}else this.childTables.has(s)&&(i?this.childTables.get(s)?.setExpanded(i,t):this.childTables.delete(s));this.currentViewport&&this.refreshInternal()}collapseAll(){this.childTables.clear(),this.currentViewport&&this.refreshInternal()}setSearch(e){throw new Error("Method not implemented.")}setViewport(e){this.currentViewport=e,this.refreshInternal()}setFilters(){throw new Error("Method not implemented.")}setSorts(){throw new Error("Method not implemented.")}setReversed(){throw new Error("Method not implemented.")}close(){this.listeners=[]}onUpdate(e){return this.listeners=[...this.listeners,e],()=>{this.listeners=this.listeners.filter(t=>t!==e)}}doRefresh(e){mo.debug2("doRefresh",this.root),e(this.fetchData())}refresh(){mo.debug2("refresh",this.root),this.viewportUpdatePromise?.cancel();const e=new Promise(n=>{this.doRefresh(n)}),t=ve.makeCancelable(e.then(n=>{if(this.viewportUpdatePromise!==t)throw new Hi;return this.currentViewportData=n,this.sendUpdate(),n}));t.catch(n=>{ve.isCanceled(n)||mo.error("Error updating viewport",n)}),this.viewportUpdatePromise=t}refreshInternal(){try{this.refresh()}catch(e){ve.isCanceled(e)||mo.error("Unable to refresh data",e)}}async fetchData(){const{currentViewport:e}=this;if(!e)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:a}=i;if(a===this.removeBaseRoot(`${this.root}/${o}`)&&i.type==="directory"){const r=this.childTables.get(o);if(r!=null){r.setViewport({top:0,bottom:e.bottom-s});const c=await r.getViewportData();n.splice(s+1,0,...c.items)}}}return this.currentSize=n.length,mo.debug2(this.root,"items",n,e),n=n.slice(e.top,e.bottom),{items:n,offset:e.top}}sendUpdate(){const{listeners:e}=this,t=this.currentViewportData??{items:[],offset:0};for(let n=0;n<e.length;n+=1)e[n](t)}}const vI=Z.module("GrpcFileStorage");class Id{static REFRESH_THROTTLE=150;storageService;tables=[];root;constructor(e,t=""){this.storageService=e,this.root=t}removeRoot(e){return he.removeRoot(this.root,e)}addRoot(e){return he.addRoot(this.root,e)}async createDirectory(e){return await this.storageService.createDirectory(this.addRoot(e)),this.refreshTables(),{type:"directory",id:e,filename:e,basename:he.getBaseName(e)}}async getTable(){const e=new Xa(this.storageService,this.root);return this.tables.push(e),e}async saveFile(e){const t=dh.storage.FileContents.text(e.content);return await this.storageService.saveFile(this.addRoot(e.filename),t,!0),this.refreshTables(),e}async loadFile(e){const n=await(await this.storageService.loadFile(this.addRoot(e))).text();return{filename:e,basename:he.getBaseName(e),content:n}}async deleteFile(e){await this.storageService.deleteItem(this.addRoot(e)),this.refreshTables()}async moveFile(e,t){await this.storageService.moveItem(this.addRoot(e),this.addRoot(t)),this.refreshTables()}async info(e){const t=await this.storageService.listItems(this.addRoot(he.getPath(e)),he.getBaseName(e));if(t.length===0)throw new vd;if(t.length>1)throw vI.error("More than one matching file found, should never happen.",t),new Error("More than one matching file found");const n=t[0];return{filename:this.removeRoot(n.filename),basename:n.basename,id:this.removeRoot(n.filename),type:n.type}}refreshTables=ks(()=>{this.tables.forEach(e=>e.refresh())},Id.REFRESH_THROTTLE)}const Ns=Z.module("AppInit");async function TI(){Ns.debug("Loading plugins...");try{const d=await bl.loadJson("/js-plugins/manifest.json");Ns.debug("Plugin manifest loaded:",d);const e=[];for(let s=0;s<d.plugins.length;s+=1){const{name:i,main:o}=d.plugins[s],a=`/js-plugins/${i}/${o}`;e.push(bl.loadModulePlugin(a))}const t=await Promise.all(e),n=new Map;for(let s=0;s<t.length;s+=1){const{name:i}=d.plugins[s];n.set(i,t[s])}return Ns.info("Plugins loaded:",n),n}catch(d){return Ns.error("Unable to load plugins:",d),new Map}}async function EI(d){let e;try{e=await fI(d)}catch(t){if(!uI(t))throw t}return e}function Dd(d){const{workspace:e,setActiveTool:t,setCommandHistoryStorage:n,setDashboardData:s,setFileStorage:i,setLayoutStorage:o,setDashboardConnection:a,setDashboardSessionWrapper:r,setPlugins:c,setUser:h,setWorkspace:u,setWorkspaceStorage:m,setServerConfigValues:p}=d,[g,C]=b.useState(),[f,S]=b.useState(!0),v=b.useCallback(async()=>{try{Ns.info("Initializing Web UI","0.31.1",navigator.userAgent);const I=CI(),F=pI();Ns.info(`Login using auth type ${F}...`),await I.login(await bI(F));const N=await TI(),H=await(F===Om.ANONYMOUS&&I.getAsIdeConnection==null?gI():I.getAsIdeConnection());H.addEventListener(x.IdeConnection.HACK_CONNECTION_FAILURE,we=>{const{detail:xe}=we;Ns.error("Connection failure",`${JSON.stringify(xe)}`),C(`Unable to connect: ${xe.details??"Unknown Error"}`)});const P=await EI(H),O="user",k=I.getStorageService(),L=new wI(k,"/layouts"),A=new Id(k,"/notebooks"),U=new Fi(L),j=new SR,W=await U.load({isConsoleAvailable:P!==void 0}),{data:ie}=W,{settings:se}=ie;se.defaultDecimalFormatOptions===void 0&&(se.defaultDecimalFormatOptions={defaultFormatString:Re.DEFAULT_FORMAT_STRING}),se.defaultIntegerFormatOptions===void 0&&(se.defaultIntegerFormatOptions={defaultFormatString:$e.DEFAULT_FORMAT_STRING}),se.truncateNumbersWithPound===void 0&&(se.truncateNumbersWithPound=!1);const{shortcutOverrides:G={}}=se,te=ke.isMacPlatform?G.mac??{}:G.windows??{};Object.entries(te).forEach(([we,xe])=>{Fe.get(we)?.setKeyState(xe)});const oe={filterSets:ie.filterSets,links:ie.links},de=await I.getServerConfigValues(),ee=new Map(de),re={name:O,operateAs:O,groups:[],permissions:{isSuperUser:!1,isQueryViewOnly:!1,isNonInteractive:!1,canUsePanels:!0,canCreateDashboard:!0,canCreateCodeStudio:!0,canCreateQueryMonitor:!0,canCopy:ee.get("internal.webClient.appInit.canCopy")!=="false",canDownloadCsv:ee.get("internal.webClient.appInit.canDownloadCsv")!=="false"}};t(jt.DEFAULT),p(ee),n(j),s(wn,oe),i(A),o(L),a(wn,H),P!==void 0&&r(wn,P),c(N),h(re),m(U),u(W)}catch(I){Ns.error(I),C(I)}},[t,n,s,i,o,a,r,c,h,u,m,p]),w=b.useCallback(()=>{document.fonts!=null?document.fonts.ready.then(()=>{S(!1)}):S(!1)},[]);b.useEffect(function(){v(),w()},[v,w]);const T=e==null&&g==null||f,y=!T&&g==null,E=g!=null?`${g}`:null;return l.jsxs(l.Fragment,{children:[y&&l.jsx(dI,{}),l.jsx(Ja,{isLoading:T,isLoaded:y,errorMessage:E}),l.jsxs("div",{id:"preload-fonts",style:{visibility:"hidden",position:"absolute",top:-1e4},children:[l.jsx("p",{className:"fira-sans-regular",children:"preload"}),l.jsx("p",{className:"fira-sans-semibold",children:"preload"}),l.jsx("p",{className:"fira-mono",children:"preload"})]})]})}Dd.propTypes={workspace:D.shape({}),workspaceStorage:D.shape({close:D.func}),setActiveTool:D.func.isRequired,setCommandHistoryStorage:D.func.isRequired,setDashboardData:D.func.isRequired,setFileStorage:D.func.isRequired,setLayoutStorage:D.func.isRequired,setDashboardConnection:D.func.isRequired,setDashboardSessionWrapper:D.func.isRequired,setPlugins:D.func.isRequired,setUser:D.func.isRequired,setWorkspace:D.func.isRequired,setWorkspaceStorage:D.func.isRequired};Dd.defaultProps={workspace:null,workspaceStorage:null};const yI=d=>({workspace:dr(d),workspaceStorage:HS(d)}),Sh=ft(yI,{setActiveTool:ur,setCommandHistoryStorage:GS,setDashboardData:zu,setFileStorage:zS,setLayoutStorage:bR,setDashboardConnection:Qy,setDashboardSessionWrapper:Jy,setPlugins:qS,setUser:$S,setWorkspace:Tu,setWorkspaceStorage:WS,setServerConfigValues:YS})(Dd);function xI(){return l.jsx(Sp,{basename:"/ide/",children:l.jsxs(bp,{children:[l.jsx(Ad,{exact:!0,path:"/",component:Sh}),l.jsx(Ad,{path:"/notebook/:notebookPath+",component:Sh}),l.jsx(wp,{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 RI(){"serviceWorker"in navigator&&navigator.serviceWorker.getRegistrations().then(d=>{d.forEach(e=>{e.scope.endsWith("/download/")||e.unregister()})})}function AI(){return RI(),Io.registerOnLoaded(),zt.init({getWorker:()=>new vp}),window["__react-beautiful-dnd-disable-dev-warnings"]=!0,l.jsx(wh,{store:mr,children:l.jsx(xI,{})})}export{AI as AppRoot,AI as default};
|
|
43
|
-
//# sourceMappingURL=AppRoot-
|
|
42
|
+
Barrage Version: ${i}`,children:"Copy Versions"})]})]})]}),l.jsx("div",{className:"app-settings-footer-item",children:l.jsx(IR,{})})]}),l.jsx("div",{className:"app-settings-footer-section",children:l.jsx("div",{className:"logo",children:l.jsx("a",{target:"_blank",rel:"noreferrer noopener",href:"https://deephaven.io",className:"d-inline-block custom-link p-1",children:l.jsx("img",{src:ym,alt:"Deephaven Data Labs",width:"230px"})})})})]})]})]})}}const fh=10;function Di(d){const{forwardedProps:{menuItem:{action:e,title:t,disabled:n},iconElement:s,displayShortcut:i,isMouseSelected:o,isKeyboardSelected:a,closeMenu:r}}=d,c=b.useRef(),h=b.useRef(),u=b.useRef(null),[m,p]=b.useState(!1),g=b.useCallback(S=>{c.current!=null&&h.current!=null&&u.current&&(Math.abs(c.current-S.clientX)>=fh||Math.abs(h.current-S.clientY)>=fh)&&(p(!0),window.removeEventListener("mousemove",g),r(),e(S),u.current=null)},[e,r]);function C(S){c.current=S.clientX,h.current=S.clientY,u.current=S.target,window.addEventListener("mousemove",g)}function f(S){u.current===S.target&&(p(!0),r(),e(),window.removeEventListener("mousemove",g)),u.current=null}return b.useEffect(function(){return function(){return window.removeEventListener("mousemove",g)}},[g]),l.jsxs("button",{type:"button",className:$("btn-context-menu",{disabled:n},{active:o&&!n},{"keyboard-active":a&&!n}),onMouseDown:C,onMouseUp:f,disabled:m,children:[l.jsx("span",{className:$("icon"),children:s}),l.jsx("span",{className:"title",children:t}),l.jsx("span",{className:"shortcut",children:i})]})}function Rd(d){const{handleControlSelect:e,handleToolSelect:t,onClearFilter:n}=d,s=b.useMemo(()=>[{title:"Input Filter",icon:xg,menuElement:l.jsx(Di,{}),action:i=>{e(Is.INPUT_FILTER,i)},order:10},{title:"Dropdown Filter",icon:Oh,menuElement:l.jsx(Di,{}),action:i=>{e(Is.DROPDOWN_FILTER,i)},order:15},{title:"Markdown Widget",icon:Rg,menuElement:l.jsx(Di,{}),action:i=>{e(Is.MARKDOWN,i)},order:20},{title:"Filter Sets",icon:il,menuElement:l.jsx(Di,{}),action:i=>{e(Is.FILTER_SET_MANAGER,i)},order:25},{disabled:!0,menuElement:l.jsx("div",{className:"context-menu-group-header",children:"Tools"}),order:30},{title:"Linker",icon:yl,action:()=>{t(jt.LINKER)},order:40,shortcut:es.LINKER},{disabled:!0,menuElement:l.jsx("div",{className:"context-menu-group-header",children:"Actions"}),order:50},{title:"Clear All Filters",icon:Ig,action:()=>{n()},order:60,shortcut:Kt.TABLE.CLEAR_ALL_FILTERS}],[e,t,n]);return l.jsx(Zn,{popperClassName:"controls-menu-popper",actions:s})}Rd.propTypes={handleControlSelect:D.func,handleToolSelect:D.func,onClearFilter:D.func};Rd.defaultProps={handleControlSelect:()=>{},handleToolSelect:()=>{},onClearFilter:()=>{}};Di.propTypes={forwardedProps:D.shape({iconElement:D.node,displayShortcut:D.string,isMouseSelected:D.bool.isRequired,isKeyboardSelected:D.bool.isRequired,closeMenu:D.func.isRequired,menuItem:D.shape({action:D.func,title:D.string,disabled:D.bool}).isRequired})};Di.defaultProps={forwardedProps:null};const UR=Ls(Em,null),$R={layoutStorage:UR},WR=d=>d.layoutStorage,GR=d=>d.serverConfigValues;Object.entries($R).map(([d,e])=>Gi.register(d,e));const Ch=10;function zR(d){const{onExportLayout:e,onImportLayout:t,onResetLayout:n,onSelect:s,widgets:i=[]}=d,[o,a]=b.useState(!1),[r,c]=b.useState(""),h=b.useRef(null),u=b.useRef(),m=b.useCallback((T,y)=>{T!=null&&s(T,y)},[s]),p=b.useCallback(T=>{c(T.target.value)},[]),g=b.useCallback(T=>{u.current!=null&&(Math.abs(u.current.x-T.clientX)>=Ch||Math.abs(u.current.y-T.clientY)>=Ch)&&(a(!0),window.removeEventListener("mousemove",g),m(u.current.widget,T),u.current=void 0)},[u,m]),C=b.useCallback((T,y)=>{u.current={x:T.clientX,y:T.clientY,widget:y},window.addEventListener("mousemove",g)},[g]),f=b.useCallback((T,y)=>{window.removeEventListener("mousemove",g),u.current?.widget===y&&(a(!0),m(y)),u.current=void 0},[g,u,m]),S=b.useMemo(()=>i.filter(T=>r?T.name?.toLowerCase().includes(r.toLowerCase()):!0),[r,i]).sort((T,y)=>T.name?.localeCompare(y.name??"")??0),v=b.useMemo(()=>S.map(T=>l.jsx("li",{children:l.jsxs(V,{kind:"ghost","data-testid":`panel-list-item-${T.name??""}-button`,onMouseDown:y=>{C(y,T)},onMouseUp:y=>{f(y,T)},onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&m(T)},disabled:o,onClick:()=>{},children:[l.jsx(Kh,{type:T.type})," ",T.name??""]})},T.name)),[S,o,C,f,m]),w=b.useMemo(()=>v.length===0?l.jsx("span",{children:"No bound variables found."}):null,[v]);return l.jsxs("div",{className:"widget-list-container d-flex flex-column",children:[l.jsx("div",{className:"widget-list-header",children:l.jsx(As,{value:r,placeholder:"Find Table, Plot or Widget",onChange:p,ref:h})}),l.jsxs("ul",{className:"widget-list flex-grow-1",children:[w&&l.jsx("li",{className:"widget-list-message",children:w}),!w&&v]}),l.jsx("div",{children:l.jsx("hr",{})}),l.jsxs("div",{className:"widget-list-footer",children:[l.jsxs(V,{kind:"ghost",onClick:e,children:[l.jsxs("div",{className:"fa-md fa-layers",children:[l.jsx(J,{mask:sl,icon:Vd,transform:"right-5 down-5"}),l.jsx(J,{icon:Vd,transform:"right-8 down-6"})]}),"Export Layout"]}),l.jsxs(V,{kind:"ghost",onClick:t,children:[l.jsxs("div",{className:"fa-md fa-layers",children:[l.jsx(J,{mask:sl,icon:ol,transform:"right-5 down-5"}),l.jsx(J,{icon:ol,transform:"right-8 down-6"})]}),"Import Layout"]}),l.jsx(V,{kind:"ghost",icon:ei,onClick:n,tooltip:"Reset Layout"})]})]})}const KR=async(d,e,t)=>{let n,s,i,o;if(va(e)?(n=e.settings,s=e.table,i=void 0,o=e.tableSettings):(n={},s="",i=e.figure,o={}),t!==void 0&&(t.tableSettings!=null&&(o=t.tableSettings),t.table!=null&&(s=t.table),t.figure!=null&&(i=t.figure),t.settings!=null&&(n={...n,...t.settings})),i!==void 0){const c={title:i,name:i,type:x.VariableType.FIGURE},h=await d.getObject(c);return Aa.makeModel(n,h)}const a={title:i,name:s,type:x.VariableType.TABLE},r=await d.getObject(a);return be.applyTableSettings(r,o,Ao(mr.getState())),Aa.makeModelFromSettings(n,r)},qR=async(d,e,t=x.VariableType.TABLE)=>{const{table:n}=e,s={title:n,name:n,type:t},i=await d.getObject(s);return ud.makeModel(i)};function YR({onAutoFillClick:d=()=>{}}){return l.jsxs("div",{className:"empty-dashboard-container",children:[l.jsxs("div",{className:"hint-container",children:[l.jsx(J,{icon:kh})," ",l.jsx("br",{}),"Use the panel list to add objects from a query."]}),l.jsxs("div",{className:"empty-dashboard",children:[l.jsx("div",{className:"add-panels-hint",children:"Drag Panels Here"}),l.jsx(V,{kind:"tertiary",onClick:d,children:"Auto fill objects"})]})]})}function XR(d){return d.version===2}function ZR(d){return Array.isArray(d)}const Ca=Z.module("UserLayoutUtils"),QR={layoutConfig:[{type:"column",content:[{type:"row",height:40,content:[{type:"stack",content:[{type:"react-component",component:Ii.COMPONENT,title:Ii.TITLE,isClosable:!1},{type:"react-component",component:Ya.COMPONENT,title:Ya.TITLE,isClosable:!1}]},{type:"stack",width:25,content:[{type:"react-component",component:$a.COMPONENT,title:$a.TITLE,isClosable:!1},{type:"react-component",component:Ga.COMPONENT,title:Ga.TITLE,isClosable:!1}]}]},{type:"row",content:[{type:"stack",title:"Notebooks",content:[]}]}]}],links:[],filterSets:[],version:2},JR={layoutConfig:[],links:[],filterSets:[],version:2};function Mm(d){if(XR(d))return d;if(ZR(d))return{layoutConfig:d,links:[],filterSets:[],version:2};throw new Error(`Unexpected layout import format: ${d}`)}async function eI(d,e=!0){try{const t=await d.getLayouts();if(t.length>0)try{const n=await d.getLayout(t[0]);return Mm(n)}catch(n){Ca.error("Unable to load layout",t[0],":",n),Ca.warn("No valid layouts found, falling back to default layout")}}catch(t){Ca.error("Unable to fetch layout list",t),Ca.warn("Falling back to default layout")}return e?QR:JR}function tI(d){const{filterSets:e,layoutConfig:t,links:n}=d;return{filterSets:e,layoutConfig:t,links:n,version:2}}const Ea={exportLayout:tI,getDefaultLayout:eI,normalizeLayout:Mm},Sa=Z.module("DownloadServiceWorkerUtils");class Io{static DOWNLOAD_PATH="/download/";static registerOnLoaded(){new URL("/ide/",window.location.href).origin===window.location.origin&&("serviceWorker"in navigator?window.addEventListener("load",()=>{const t=new URL("/ide/download/serviceWorker.js",window.location.href);navigator.serviceWorker.register(t).then(n=>{n.update(),Sa.info("Registering service worker on ",t,n)}).catch(n=>{Sa.error("Failed to register service worker",n)})}):Sa.info("Service worker is not supported."))}static async getServiceWorker(){if("serviceWorker"in navigator){const t=(await navigator.serviceWorker.getRegistrations()).find(n=>n.scope.endsWith(Io.DOWNLOAD_PATH));if(t&&t.active)return Sa.info("Download service worker is active."),t.active;throw new Error("Can not find download service worker.")}throw new Error("Download service worker is not available.")}static unregisterSW(){}}const km={react:X,"react-dom":Pi,redux:hp,"react-redux":up},nI=mp(km),sI=pp({requires:nI}),iI=gp.createRequires(km),oI=fp({requires:iI}),aI=Z.module("PluginUtils");class bl{static loadComponentPlugin(e){const t=new URL("/ide/plugins/",`${window.location}`),n=new URL(`${e}.js`,t),s=X.forwardRef((i,o)=>l.jsx(sI,{url:n,render:({err:a,Component:r})=>{if(a!=null&&a!==""){const c=`Error loading plugin ${e} from ${n} due to ${a}`;return aI.error(c),l.jsx("div",{className:"error-message",children:`${c}`})}return l.jsx(r,{ref:o,...i})}}));return s.pluginName=e,s.displayName="Plugin",s}static async loadModulePlugin(e){return await oI(e)}static async loadJson(e){return new Promise((t,n)=>{const s=new XMLHttpRequest;s.addEventListener("load",()=>{try{const i=JSON.parse(s.responseText);t(i)}catch(i){n(i)}}),s.addEventListener("error",i=>{n(i)}),s.open("GET",e),s.send()})}}const Dt=Z.module("AppMainContainer");class Eo extends b.Component{static handleWindowBeforeUnload(e){e.preventDefault(),e.returnValue=""}static hydrateConsole(e,t){return ml.hydrate({...e,unzip:n=>Eh.loadAsync(n).then(s=>Object.values(s.files))},t)}constructor(e){super(e),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=X.createRef(),this.state={contextActions:[{action:()=>{this.handleToolSelect(jt.LINKER)},shortcut:es.LINKER,isGlobal:!0},{action:()=>{this.sendClearFilter()},shortcut:Kt.TABLE.CLEAR_ALL_FILTERS,isGlobal:!0},{action:()=>{Dt.debug("Consume unhandled save shortcut")},shortcut:es.SAVE,isGlobal:!0}],isPanelsMenuShown:!1,isSettingsMenuShown:!1,widgets:[]}}componentDidMount(){this.initWidgets(),window.addEventListener("beforeunload",Eo.handleWindowBeforeUnload)}componentDidUpdate(e){const{dashboardData:t}=this.props;e.dashboardData!==t&&this.handleDataChange(t)}componentWillUnmount(){this.deinitWidgets(),window.removeEventListener("beforeunload",Eo.handleWindowBeforeUnload)}goldenLayout;importElement;widgetListenerRemover;initWidgets(){const{connection:e}=this.props;if(e.subscribeToFieldUpdates==null){Dt.warn("subscribeToFieldUpdates not supported, not initializing widgets");return}this.widgetListenerRemover=e.subscribeToFieldUpdates(t=>{Dt.debug("Got updates",t),this.setState(({widgets:n})=>{const{updated:s,created:i,removed:o}=t,a=[...s,...o],r=n.filter(h=>!a.some(u=>u.name===h.name));return[...s,...i].forEach(h=>{h.name!=null&&h.name!==""&&r.push(h)}),{widgets:r}})})}deinitWidgets(){this.widgetListenerRemover?.()}openNotebookFromURL(){const{match:e}=this.props,{notebookPath:t}=e.params;if(t){const{session:n,sessionConfig:s}=this.props;if(n==null||s==null){Dt.error("No session available to open notebook URL",t);return}const i={id:`/${t}`,itemName:`/${t}`},o=s.type,a={value:null,language:o};this.emitLayoutEvent(Xe.SELECT_NOTEBOOK,n,o,a,i,!0)}}sendClearFilter(){this.emitLayoutEvent(Qe.CLEAR_ALL_FILTERS)}emitLayoutEvent(e,...t){this.goldenLayout?.eventHub.emit(e,...t)}handleError(e){ve.isCanceled(e)||Dt.error(e)}handleSettingsMenuHide(){this.setState({isSettingsMenuShown:!1})}handleSettingsMenuShow(){this.setState({isSettingsMenuShown:!0})}handleControlSelect(e,t=null){switch(Dt.debug("handleControlSelect",e),e){case Is.DROPDOWN_FILTER:this.emitLayoutEvent(Qe.OPEN_DROPDOWN,{title:"DropdownFilter",type:e,createNewStack:!0,dragEvent:t});break;case Is.INPUT_FILTER:this.emitLayoutEvent(Qe.OPEN_INPUT,{title:"InputFilter",type:e,createNewStack:!0,dragEvent:t});break;case Is.MARKDOWN:this.emitLayoutEvent(pm.OPEN,{title:"Markdown",type:e,dragEvent:t});break;case Is.FILTER_SET_MANAGER:this.emitLayoutEvent(Qe.OPEN_FILTER_SET_MANAGER,{title:"FilterSets",type:e,dragEvent:t});break;default:throw new Error(`Unrecognized control type ${e}`)}}handleToolSelect(e){Dt.debug("handleToolSelect",e);const{activeTool:t,setActiveTool:n}=this.props;n(t===e?jt.DEFAULT:e)}handleClearFilter(){this.sendClearFilter()}handleDataChange(e){const{updateWorkspaceData:t}=this.props,{closed:n,filterSets:s,links:i}=e;t({closed:n,filterSets:s,links:i})}handleGoldenLayoutChange(e){this.goldenLayout=e}handleLayoutConfigChange(e){const{updateWorkspaceData:t}=this.props;t({layoutConfig:e})}handleWidgetMenuClick(){this.setState(({isPanelsMenuShown:e})=>({isPanelsMenuShown:!e}))}handleWidgetSelect(e,t){this.setState({isPanelsMenuShown:!1}),Dt.debug("handleWidgetSelect",e,t),this.openWidget(e,t)}handleWidgetsMenuClose(){this.setState({isPanelsMenuShown:!1})}handleAutoFillClick(){const{widgets:e}=this.state;Dt.debug("handleAutoFillClick",e);const t=e.sort((n,s)=>n.title!=null&&s.title!=null?n.title.localeCompare(s.title):0);for(let n=0;n<t.length;n+=1)this.openWidget(t[n])}handleExportLayoutClick(){Dt.info("handleExportLayoutClick"),this.setState({isPanelsMenuShown:!1});try{const{workspace:e}=this.props,{data:t}=e,n=Ea.exportLayout(t);Dt.info("handleExportLayoutClick exportedConfig",n);const s=new Blob([JSON.stringify(n)],{type:"application/json"}),i=x.i18n.DateTimeFormat.format("yyyy-MM-dd-HHmmss",new Date),o=document.createElement("a");o.href=URL.createObjectURL(s),o.download=`deephaven-app-layout-${i}.json`,o.click()}catch(e){Dt.error("Unable to export layout",e)}}handleImportLayoutClick(){Dt.info("handleImportLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.importElement.current!=null&&(this.importElement.current.value="",this.importElement.current.click())}handleResetLayoutClick(){Dt.info("handleResetLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.resetLayout()}handleImportLayoutFiles(e){e.stopPropagation(),e.preventDefault(),e.target.files!=null&&this.importLayoutFile(e.target.files?.[0])}async importLayoutFile(e){try{const{updateDashboardData:t,updateWorkspaceData:n}=this.props,s=await e.text(),i=JSON.parse(s),{filterSets:o,layoutConfig:a,links:r}=Ea.normalizeLayout(i);n({layoutConfig:a}),t(wn,{filterSets:o,links:r})}catch(t){Dt.error("Unable to import layout",t)}}async resetLayout(){const{layoutStorage:e,session:t}=this.props,{filterSets:n,layoutConfig:s,links:i}=await Ea.getDefaultLayout(e,t!==void 0),{updateDashboardData:o,updateWorkspaceData:a}=this.props;a({layoutConfig:s}),o(wn,{filterSets:n,links:i})}handlePaste(e){if(e.target instanceof HTMLElement&&e.target.closest(".monaco-editor"))return;const{clipboardData:t}=e,n=t.getData("Text"),s=/“|”/g;s.test(n)&&(e.preventDefault(),e.stopPropagation(),document.execCommand("insertText",!1,n.replace(s,'"')))}handleLoadTablePlugin(e){const{plugins:t}=this.props,n=t.get(e);return n!=null&&n.TablePlugin!=null?n.TablePlugin:bl.loadComponentPlugin(e)}hydrateDefault(e,t){const{connection:n}=this.props,{metadata:s}=e;if(s?.type!=null&&(s?.id!=null||s?.name!=null)){const i=s.id!=null?{type:s.type,id:s.id}:{type:s.type,name:s.name,title:s.name};return{fetch:()=>n.getObject(i),localDashboardId:t,...e}}return ml.hydrate(e,t)}hydrateGrid(e,t){return this.hydrateTable(e,t,e.metadata.type??x.VariableType.TABLE)}hydratePandas(e,t){return this.hydrateTable(e,t,x.VariableType.PANDAS)}hydrateTable(e,t,n=x.VariableType.TABLE){const{connection:s}=this.props;return{...e,getDownloadWorker:Io.getServiceWorker,loadPlugin:this.handleLoadTablePlugin,localDashboardId:t,makeModel:()=>qR(s,e.metadata,n)}}hydrateChart(e,t){const{connection:n}=this.props;return{...e,localDashboardId:t,makeModel:()=>{const{metadata:s,panelState:i}=e;return KR(n,s,i)}}}openWidget(e,t){const{connection:n}=this.props;this.emitLayoutEvent(Ee.OPEN,{dragEvent:t,fetch:()=>n.getObject(e),widget:e})}getDashboardPlugins=fe(e=>[...e.entries()].filter(([,t])=>t.DashboardPlugin!=null).map(([t,{DashboardPlugin:n}])=>l.jsx(n,{},t)));render(){const{activeTool:e,plugins:t,user:n,workspace:s,serverConfigValues:i}=this.props,{data:o}=s,{layoutConfig:a}=o,{permissions:r}=n,{canUsePanels:c}=r,{contextActions:h,isPanelsMenuShown:u,isSettingsMenuShown:m,widgets:p}=this.state,g=this.getDashboardPlugins(t);return l.jsxs("div",{className:$("app-main-tabs","w-100","h-100","d-flex","flex-column",e?`active-tool-${e.toLowerCase()}`:""),onPaste:this.handlePaste,tabIndex:-1,children:[l.jsx("nav",{className:"nav-container",children:l.jsxs("div",{className:"app-main-top-nav-menus",children:[l.jsx("img",{src:ym,alt:"Deephaven Data Labs",width:"115px",className:"ml-1"}),l.jsxs("div",{children:[l.jsxs(V,{kind:"ghost",className:"btn-panels-menu",icon:Dg,onClick:()=>{},children:["Controls",l.jsx(Rd,{handleControlSelect:this.handleControlSelect,handleToolSelect:this.handleToolSelect,onClearFilter:this.handleClearFilter})]}),c&&l.jsxs(V,{kind:"ghost",className:"btn-panels-menu btn-show-panels","data-testid":"app-main-panels-button",onClick:this.handleWidgetMenuClick,icon:Fg,children:["Panels",l.jsx(ri,{isShown:u,className:"panels-menu-popper",onExited:this.handleWidgetsMenuClose,closeOnBlur:!0,interactive:!0,children:l.jsx(zR,{widgets:p,onExportLayout:this.handleExportLayoutClick,onImportLayout:this.handleImportLayoutClick,onResetLayout:this.handleResetLayoutClick,onSelect:this.handleWidgetSelect})})]}),l.jsx(V,{kind:"ghost",className:$("btn-settings-menu",{"text-warning":n.operateAs!==n.name}),onClick:this.handleSettingsMenuShow,icon:l.jsx(J,{icon:ko,transform:"grow-3 right-1 down-1"}),tooltip:"User Settings"})]})]})}),l.jsxs(jw,{emptyDashboard:l.jsx(YR,{onAutoFillClick:this.handleAutoFillClick}),id:wn,layoutConfig:a,onGoldenLayoutChange:this.handleGoldenLayoutChange,onLayoutConfigChange:this.handleLayoutConfigChange,onLayoutInitialized:this.openNotebookFromURL,hydrate:this.hydrateDefault,children:[l.jsx(nR,{hydrate:this.hydrateGrid,getDownloadWorker:Io.getServiceWorker,loadPlugin:this.handleLoadTablePlugin}),l.jsx(Xx,{hydrate:this.hydrateChart}),l.jsx(Zx,{}),l.jsx(Jx,{hydrateConsole:Eo.hydrateConsole,notebooksUrl:new URL("/notebooks/",`${window.location}`).href}),l.jsx(eR,{}),l.jsx(hR,{hydrate:this.hydratePandas}),l.jsx(cR,{}),l.jsx(dR,{}),g]}),l.jsx(gt,{in:m,timeout:We.transitionMidMs,classNames:"slide-left",mountOnEnter:!0,unmountOnExit:!0,children:l.jsx(Nn,{serverConfigValues:i,onDone:this.handleSettingsMenuHide})}),l.jsx(ae,{actions:h}),l.jsx("input",{ref:this.importElement,type:"file",accept:".json",style:{display:"none"},onChange:this.handleImportLayoutFiles})]})}}const rI=d=>({activeTool:cr(d),dashboardData:Vt(d,wn),layoutStorage:WR(d),plugins:US(d),connection:Zy(d,wn),session:ai(d,wn)?.session,sessionConfig:ai(d,wn)?.config,user:iu(d),workspace:dr(d),serverConfigValues:GR(d)}),lI=ft(rI,{setActiveTool:ur,updateDashboardData:Pn,updateWorkspaceData:Eu})(Cp(Eo));function dI(){return l.jsxs("div",{className:"app",children:[l.jsx(lI,{}),l.jsx(_h,{})]})}const cI=Z.module("LocalWorkspaceStorage");class Fi{static STORAGE_KEY="deephaven.WorkspaceStorage";static async makeDefaultWorkspaceData(e,t){const{filterSets:n,links:s,layoutConfig:i}=await Ea.getDefaultLayout(e,t?.isConsoleAvailable);return{settings:{defaultDateTimeFormat:_e.DEFAULT_DATETIME_FORMAT_STRING,formatter:[],timeZone:_e.DEFAULT_TIME_ZONE_ID,showTimeZone:!1,showTSeparator:!0,disableMoveConfirmation:!1,defaultDecimalFormatOptions:{defaultFormatString:Re.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:$e.DEFAULT_FORMAT_STRING},truncateNumbersWithPound:!1,defaultNotebookSettings:{isMinimapEnabled:!1}},layoutConfig:i,closed:[{}],links:s,filterSets:n}}static async makeDefaultWorkspace(e,t){return{data:await Fi.makeDefaultWorkspaceData(e,t)}}layoutStorage;constructor(e){this.layoutStorage=e}async load(e){try{return JSON.parse(localStorage.getItem(Fi.STORAGE_KEY)??"")}catch{return cI.info("Unable to load workspace data, initializing to default data"),Fi.makeDefaultWorkspace(this.layoutStorage,e)}}async save(e){return localStorage.setItem(Fi.STORAGE_KEY,JSON.stringify(e)),e}}class hI extends Error{isNoConsolesError=!0}function uI(d){return d.isNoConsolesError}const Fs=Z.module("SessionUtils");var Om=(d=>(d.ANONYMOUS="anonymous",d.PARENT="parent",d))(Om||{});function mI(){return new URL("/jsapi",`${window.location}`)}function Am(){const d=mI();return`${d.protocol}//${d.host}`}function pI(){switch(new URLSearchParams(window.location.search).get("authProvider")){case"parent":return"parent";default:return"anonymous"}}function gI(){const d=Am();return Fs.info(`Starting connection to '${d}'...`),new x.IdeConnection(d)}async function fI(d){Fs.info("Getting console types...");const e=await d.getConsoleTypes();if(Fs.info("Available types:",e),e.length===0)throw new hI("No console types available");const t=e[0];Fs.info("Starting session with type",t);const n=await d.startSession(t),s={type:t,id:Pe.generate()};return Fs.info("Console session established",s),{session:n,config:s,connection:d}}function CI(){const d=Am();return Fs.info("createCoreClient",d),new x.CoreClient(d)}async function SI(){if(window.opener==null)throw new Error("window.opener is null, unable to send auth request.");return new Promise(d=>{const e=t=>{const{data:n}=t;if(Fs.debug("Received message",n),n?.message!=="loginOptions"){Fs.debug("Ignore received message",n);return}window.removeEventListener("message",e),d(n.payload)};window.addEventListener("message",e),window.opener.postMessage("requestLoginOptionsFromParent","*")})}async function bI(d){switch(d){case"parent":return SI();case"anonymous":return{type:x.CoreClient.LOGIN_TYPE_ANONYMOUS};default:throw new Error(`Unknown auth type: ${d}`)}}class wI{storageService;root;constructor(e,t=""){this.storageService=e,this.root=t}async getLayouts(){return(await this.storageService.listItems(this.root,"*.json")).map(t=>t.basename)}async getLayout(e){const n=await(await this.storageService.loadFile(`${this.root}/${e}`)).text();return JSON.parse(n)}}const mo=Z.module("GrpcFileStorageTable");class Xa{static REFRESH_DEBOUNCE=50;storageService;baseRoot;root;currentSize=0;currentViewport;listeners=[];viewportUpdatePromise;currentViewportData;childTables=new Map;constructor(e,t="",n=t){this.storageService=e,this.baseRoot=t,this.root=n,n===t&&(this.doRefresh=Ye(this.doRefresh.bind(this),Xa.REFRESH_DEBOUNCE))}removeBaseRoot(e){return he.removeRoot(this.baseRoot,e)}getViewportData(){return this.viewportUpdatePromise||this.refreshInternal(),this.viewportUpdatePromise??Promise.resolve({items:[],offset:0})}getSnapshot(e){throw new Error("Method not implemented.")}get size(){return this.currentSize}setExpanded(e,t){const n=e.split("/");let s=n.shift();if((s===void 0||s==="")&&(s=n.shift()),s===void 0||s==="")throw new Error(`Invalid path: ${e}`);const i=n.join("/");if(t){if(!this.childTables.has(s)){const o=new Xa(this.storageService,this.baseRoot,`${this.root}/${s}`);this.childTables.set(s,o)}i&&this.childTables.get(s)?.setExpanded(i,t)}else this.childTables.has(s)&&(i?this.childTables.get(s)?.setExpanded(i,t):this.childTables.delete(s));this.currentViewport&&this.refreshInternal()}collapseAll(){this.childTables.clear(),this.currentViewport&&this.refreshInternal()}setSearch(e){throw new Error("Method not implemented.")}setViewport(e){this.currentViewport=e,this.refreshInternal()}setFilters(){throw new Error("Method not implemented.")}setSorts(){throw new Error("Method not implemented.")}setReversed(){throw new Error("Method not implemented.")}close(){this.listeners=[]}onUpdate(e){return this.listeners=[...this.listeners,e],()=>{this.listeners=this.listeners.filter(t=>t!==e)}}doRefresh(e){mo.debug2("doRefresh",this.root),e(this.fetchData())}refresh(){mo.debug2("refresh",this.root),this.viewportUpdatePromise?.cancel();const e=new Promise(n=>{this.doRefresh(n)}),t=ve.makeCancelable(e.then(n=>{if(this.viewportUpdatePromise!==t)throw new Hi;return this.currentViewportData=n,this.sendUpdate(),n}));t.catch(n=>{ve.isCanceled(n)||mo.error("Error updating viewport",n)}),this.viewportUpdatePromise=t}refreshInternal(){try{this.refresh()}catch(e){ve.isCanceled(e)||mo.error("Unable to refresh data",e)}}async fetchData(){const{currentViewport:e}=this;if(!e)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:a}=i;if(a===this.removeBaseRoot(`${this.root}/${o}`)&&i.type==="directory"){const r=this.childTables.get(o);if(r!=null){r.setViewport({top:0,bottom:e.bottom-s});const c=await r.getViewportData();n.splice(s+1,0,...c.items)}}}return this.currentSize=n.length,mo.debug2(this.root,"items",n,e),n=n.slice(e.top,e.bottom),{items:n,offset:e.top}}sendUpdate(){const{listeners:e}=this,t=this.currentViewportData??{items:[],offset:0};for(let n=0;n<e.length;n+=1)e[n](t)}}const vI=Z.module("GrpcFileStorage");class Id{static REFRESH_THROTTLE=150;storageService;tables=[];root;constructor(e,t=""){this.storageService=e,this.root=t}removeRoot(e){return he.removeRoot(this.root,e)}addRoot(e){return he.addRoot(this.root,e)}async createDirectory(e){return await this.storageService.createDirectory(this.addRoot(e)),this.refreshTables(),{type:"directory",id:e,filename:e,basename:he.getBaseName(e)}}async getTable(){const e=new Xa(this.storageService,this.root);return this.tables.push(e),e}async saveFile(e){const t=dh.storage.FileContents.text(e.content);return await this.storageService.saveFile(this.addRoot(e.filename),t,!0),this.refreshTables(),e}async loadFile(e){const n=await(await this.storageService.loadFile(this.addRoot(e))).text();return{filename:e,basename:he.getBaseName(e),content:n}}async deleteFile(e){await this.storageService.deleteItem(this.addRoot(e)),this.refreshTables()}async moveFile(e,t){await this.storageService.moveItem(this.addRoot(e),this.addRoot(t)),this.refreshTables()}async info(e){const t=await this.storageService.listItems(this.addRoot(he.getPath(e)),he.getBaseName(e));if(t.length===0)throw new vd;if(t.length>1)throw vI.error("More than one matching file found, should never happen.",t),new Error("More than one matching file found");const n=t[0];return{filename:this.removeRoot(n.filename),basename:n.basename,id:this.removeRoot(n.filename),type:n.type}}refreshTables=ks(()=>{this.tables.forEach(e=>e.refresh())},Id.REFRESH_THROTTLE)}const Ns=Z.module("AppInit");async function TI(){Ns.debug("Loading plugins...");try{const d=await bl.loadJson("/js-plugins/manifest.json");Ns.debug("Plugin manifest loaded:",d);const e=[];for(let s=0;s<d.plugins.length;s+=1){const{name:i,main:o}=d.plugins[s],a=`/js-plugins/${i}/${o}`;e.push(bl.loadModulePlugin(a))}const t=await Promise.all(e),n=new Map;for(let s=0;s<t.length;s+=1){const{name:i}=d.plugins[s];n.set(i,t[s])}return Ns.info("Plugins loaded:",n),n}catch(d){return Ns.error("Unable to load plugins:",d),new Map}}async function EI(d){let e;try{e=await fI(d)}catch(t){if(!uI(t))throw t}return e}function Dd(d){const{workspace:e,setActiveTool:t,setCommandHistoryStorage:n,setDashboardData:s,setFileStorage:i,setLayoutStorage:o,setDashboardConnection:a,setDashboardSessionWrapper:r,setPlugins:c,setUser:h,setWorkspace:u,setWorkspaceStorage:m,setServerConfigValues:p}=d,[g,C]=b.useState(),[f,S]=b.useState(!0),v=b.useCallback(async()=>{try{Ns.info("Initializing Web UI","0.32.0",navigator.userAgent);const I=CI(),F=pI();Ns.info(`Login using auth type ${F}...`),await I.login(await bI(F));const N=await TI(),H=await(F===Om.ANONYMOUS&&I.getAsIdeConnection==null?gI():I.getAsIdeConnection());H.addEventListener(x.IdeConnection.HACK_CONNECTION_FAILURE,we=>{const{detail:xe}=we;Ns.error("Connection failure",`${JSON.stringify(xe)}`),C(`Unable to connect: ${xe.details??"Unknown Error"}`)});const P=await EI(H),O="user",k=I.getStorageService(),L=new wI(k,"/layouts"),A=new Id(k,"/notebooks"),U=new Fi(L),j=new SR,W=await U.load({isConsoleAvailable:P!==void 0}),{data:ie}=W,{settings:se}=ie;se.defaultDecimalFormatOptions===void 0&&(se.defaultDecimalFormatOptions={defaultFormatString:Re.DEFAULT_FORMAT_STRING}),se.defaultIntegerFormatOptions===void 0&&(se.defaultIntegerFormatOptions={defaultFormatString:$e.DEFAULT_FORMAT_STRING}),se.truncateNumbersWithPound===void 0&&(se.truncateNumbersWithPound=!1);const{shortcutOverrides:G={}}=se,te=ke.isMacPlatform?G.mac??{}:G.windows??{};Object.entries(te).forEach(([we,xe])=>{Fe.get(we)?.setKeyState(xe)});const oe={filterSets:ie.filterSets,links:ie.links},de=await I.getServerConfigValues(),ee=new Map(de),re={name:O,operateAs:O,groups:[],permissions:{isSuperUser:!1,isQueryViewOnly:!1,isNonInteractive:!1,canUsePanels:!0,canCreateDashboard:!0,canCreateCodeStudio:!0,canCreateQueryMonitor:!0,canCopy:ee.get("internal.webClient.appInit.canCopy")!=="false",canDownloadCsv:ee.get("internal.webClient.appInit.canDownloadCsv")!=="false"}};t(jt.DEFAULT),p(ee),n(j),s(wn,oe),i(A),o(L),a(wn,H),P!==void 0&&r(wn,P),c(N),h(re),m(U),u(W)}catch(I){Ns.error(I),C(I)}},[t,n,s,i,o,a,r,c,h,u,m,p]),w=b.useCallback(()=>{document.fonts!=null?document.fonts.ready.then(()=>{S(!1)}):S(!1)},[]);b.useEffect(function(){v(),w()},[v,w]);const T=e==null&&g==null||f,y=!T&&g==null,E=g!=null?`${g}`:null;return l.jsxs(l.Fragment,{children:[y&&l.jsx(dI,{}),l.jsx(Ja,{isLoading:T,isLoaded:y,errorMessage:E}),l.jsxs("div",{id:"preload-fonts",style:{visibility:"hidden",position:"absolute",top:-1e4},children:[l.jsx("p",{className:"fira-sans-regular",children:"preload"}),l.jsx("p",{className:"fira-sans-semibold",children:"preload"}),l.jsx("p",{className:"fira-mono",children:"preload"})]})]})}Dd.propTypes={workspace:D.shape({}),workspaceStorage:D.shape({close:D.func}),setActiveTool:D.func.isRequired,setCommandHistoryStorage:D.func.isRequired,setDashboardData:D.func.isRequired,setFileStorage:D.func.isRequired,setLayoutStorage:D.func.isRequired,setDashboardConnection:D.func.isRequired,setDashboardSessionWrapper:D.func.isRequired,setPlugins:D.func.isRequired,setUser:D.func.isRequired,setWorkspace:D.func.isRequired,setWorkspaceStorage:D.func.isRequired};Dd.defaultProps={workspace:null,workspaceStorage:null};const yI=d=>({workspace:dr(d),workspaceStorage:HS(d)}),Sh=ft(yI,{setActiveTool:ur,setCommandHistoryStorage:GS,setDashboardData:zu,setFileStorage:zS,setLayoutStorage:bR,setDashboardConnection:Qy,setDashboardSessionWrapper:Jy,setPlugins:qS,setUser:$S,setWorkspace:Tu,setWorkspaceStorage:WS,setServerConfigValues:YS})(Dd);function xI(){return l.jsx(Sp,{basename:"/ide/",children:l.jsxs(bp,{children:[l.jsx(Ad,{exact:!0,path:"/",component:Sh}),l.jsx(Ad,{path:"/notebook/:notebookPath+",component:Sh}),l.jsx(wp,{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 RI(){"serviceWorker"in navigator&&navigator.serviceWorker.getRegistrations().then(d=>{d.forEach(e=>{e.scope.endsWith("/download/")||e.unregister()})})}function AI(){return RI(),Io.registerOnLoaded(),zt.init({getWorker:()=>new vp}),window["__react-beautiful-dnd-disable-dev-warnings"]=!0,l.jsx(wh,{store:mr,children:l.jsx(xI,{})})}export{AI as AppRoot,AI as default};
|
|
43
|
+
//# sourceMappingURL=AppRoot-c431861b.js.map
|