@deephaven/code-studio 0.36.1-beta.0 → 0.36.1-beta.1
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-7bb2a9ba.js → AppRoot-6d457ba5.js} +3 -3
- package/build/assets/{AppRoot-7bb2a9ba.js.map → AppRoot-6d457ba5.js.map} +1 -1
- package/build/assets/{index-eb4c2d65.js → index-0488437e.js} +2 -2
- package/build/assets/{index-eb4c2d65.js.map → index-0488437e.js.map} +1 -1
- package/build/index.html +1 -1
- package/package.json +28 -28
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{A as b,B as M,H as J,P as Jm,C as l,D as bt,F as U,R as $i,G as Q,I as Ae,J as me,K as Xe,L as eg,M as tg,N as Il,O as ir,Q as ng,E as Dl,S as sg,T as ol,U as pe,V as al,W as Os,X as kh,Y as ot,Z as Fl,_ as ig,$ as og,a0 as ag,a1 as rg,a2 as ue,a3 as Bc,a4 as Nl,a5 as lg,a6 as cg,a7 as Oh,a8 as $e,a9 as rl,aa as or,ab as dg,ac as Ln,ad as hg,ae as ug,af as mg,ag as gg,ah as ll,ai as pg,aj as fg,ak as Cg,al as Uc,am as Sg,an as Wc,ao as bg,ap as wg,aq as vg,ar as Tg,as as Eg,at as yg,au as wt,av as Ah,aw as xg,ax as Lh,ay as Rg,az as Ph,aA as Ig,aB as Dg,aC as Fg,aD as Ng,aE as Mg,aF as kg,aG as Og,aH as Ag,aI as Lg,aJ as Pg,aK as Gc,aL as _g}from"./vendor-10e12355.js";import{e as Jn,l as An,K as hn,a as zc,R as jg,b as Ds,W as Hg}from"./monaco-a26f85af.js";import{T as qe,L as Z,M as Wi,a as Gi,b as No,v as _h,c as yn,d as jh,e as Pn,f as $g,g as Vg,h as Mo,i as Bg,j as zi,k as Ml,l as Ug,m as cl,n as Wg,o as Hh,p as kl,q as $h,r as Kc,s as Gg,t as zg,u as Kg,w as qg,x as tn,y as ks,z as Vh,A as es,B as ar,C as Vi,D as Yg,E as Xg,F as qc,G as Da,H as Yc,I as Bh,J as Zg,K as ko,N as Uh,O as Qg,P as Jg,Q as Ol,R as Al,S as Fa,U as Bn,V as ep,W as tp,X as np,Y as sp,Z as ip,_ as Ll,$ as As,a0 as Xc,a1 as Oo,a2 as Pl,a3 as _l,a4 as op,a5 as ap,a6 as Na,a7 as rp,a8 as jl,a9 as Wh,aa as ni,ab as lp,ac as cp,ad as dp,ae as hp,af as up,ag as mp,ah as Zc,ai as Pr,aj as gp,ak as pp,al as fp,am as Cp,an as Sp,ao as Gh,ap as bp,aq as wp,ar as vp,as as zh,at as Tp,au as Ep,av as yp,aw as xp,ax as Rp,ay as Ip,az as Dp,aA as Fp,aB as Np,aC as Mp,aD as kp,aE as Op,aF as Kh,aG as Ap,aH as dl,aI as hl,aJ as Lp,aK as Pp,aL as _p,aM as jp,aN as Hp,aO as $p,aP as Vp,aQ as Bp,aR as Up,aS as Wp,aT as Gp,aU as Qc,aV as zp,aW as Kp,aX as qp}from"./index-eb4c2d65.js";import{P as Ma,b as Yp,h as Xp,p as Zp,o as Qp,s as Jp,t as ef,c as _r}from"./plotly-7777e464.js";import"./helpers-042e6b4d.js";class tf extends b.Component{static propTypes={children:M.node.isRequired,options:M.shape({}),className:M.string,timeout:M.number,onEntered:M.func,onExited:M.func,isShown:M.bool,closeOnBlur:M.bool,interactive:M.bool,referenceObject:M.shape({}),"data-testid":M.string};static defaultProps={options:{},className:"",timeout:qe.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=J.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 Jm(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(bt,{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:U("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&&$i.createPortal(this.renderContent(),this.element)})}}const di=tf,nf=Z.module("Tooltip");class jt 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:jt.defaultReshowTimeout,timeout:jt.defaultTimeout,onEntered:()=>{},onExited:()=>{},"data-testid":void 0};static handleHidden(){jt.shownTooltipCount-=1,jt.shownTooltipCount===0&&(jt.lastHiddenTime=Date.now())}static handleShown(){jt.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=J.createRef(),this.popper=J.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?jt.handleShown():jt.handleHidden())}componentWillUnmount(){this.stopListening(),this.stopListeningWindow(),this.stopTimer();const{isShown:e}=this.state;e&&jt.handleHidden()}container;popper;parent;timer;startListening(){if(!this.container.current||!this.container.current.parentElement){nf.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;(jt.shownTooltipCount>0||Date.now()-jt.lastHiddenTime<jt.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(di,{className:U(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=jt;function rr(d){const{children:e,className:t,style:n,"data-testid":s}=d;return l.jsx("div",{className:U("btn-group",t),style:n,role:"group","data-testid":s,children:e})}rr.displayName="ButtonGroup";rr.propTypes={children:M.node.isRequired,className:M.string,style:M.object,"data-testid":M.string};rr.defaultProps={className:null,style:{},"data-testid":void 0};const sf=["primary","secondary","tertiary","success","danger","inline","ghost"],of=["group-end"];function af(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 U("btn-link",{"btn-link-icon":e,"btn-link-icon-only":e})}}function rf(d){switch(d){case"group-end":return U("pl-2","pr-3")}}const lr=J.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:g,onMouseLeave:p,onKeyDown:C,className:f,style:S,children:v,tabIndex:w,"data-testid":T,"aria-label":y}=d,E=Boolean(o&&v==null),I=af(t,E);let D;n&&(D=rf(n));let F;o&&(F=J.isValidElement(o)?o:l.jsx(Q,{icon:o}));let _;i!==void 0&&(_=typeof i=="string"?l.jsx(tt,{children:i}):i);let L=y;y===void 0&&E&&i!=null&&typeof i=="string"&&(L=i);const B=l.jsxs("button",{"data-testid":T,ref:e,type:s,className:U("btn",I,D,{active:r},f),onClick:c,onContextMenu:h,onMouseUp:m,onMouseDown:u,onMouseEnter:g,onMouseLeave:p,onKeyDown:C,style:S,disabled:a,tabIndex:w,"aria-label":L,children:[o&&F,v,i!=null&&!a&&_]});return a?l.jsxs("span",{className:"btn-disabled-wrapper",children:[B,i!==void 0&&_]}):B});lr.displayName="Button";lr.propTypes={kind:M.oneOf(sf).isRequired,variant:M.oneOf(of),type:M.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&&!J.isValidElement(t)&&(t==null||t.iconName===""||t.iconName==null)?new Error("Icon must be react element or fontawesome IconDefinition"):null},disabled:M.bool,active:M.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:M.func,onMouseUp:M.func,onMouseDown:M.func,onMouseEnter:M.func,onMouseLeave:M.func,onKeyDown:M.func,tabIndex:M.number,children:M.node,className:M.string,style:M.object,"data-testid":M.string};lr.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=lr;function lf({className:d,icon:e,isOpen:t,subtitle:n,title:s}){return l.jsx(Wi,{isOpen:t,className:d,children:l.jsx(Gi,{children:l.jsxs("div",{className:"info-modal",children:[e!=null&&l.jsx("div",{className:"message-icon",children:l.jsx(Q,{icon:e})}),l.jsx("div",{className:"message-header",children:s}),n!=null&&l.jsx("div",{className:"message-content",children:n})]})})})}function Hl({className:d="modal-footer",children:e,"data-testid":t}){return l.jsx("div",{className:d,"data-testid":t,children:e})}function li(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":g}=d,p=b.useRef(null),C=b.useRef(null),f=b.useCallback(()=>{C.current!==null&&C.current.checked&&a&&a(),i()},[i,a]),S=b.useCallback(()=>{p.current?.focus()},[]);let v="";return e&&(v=typeof n=="function"?n():n),l.jsxs(Wi,{isOpen:e,className:"theme-bg-light",onOpened:S,children:[l.jsx(No,{closeButton:!1,children:t}),l.jsx(Gi,{children:v}),l.jsxs(Hl,{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":g!==void 0?`${g}-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":g!==void 0?`${g}-btn-discard`:void 0,children:h}),s&&l.jsx(V,{kind:"secondary","data-dismiss":"modal",onClick:s,"data-testid":g!==void 0?`${g}-btn-cancel`:void 0,children:r}),l.jsxs(rr,{children:[l.jsx(V,{kind:u?"danger":"primary",onClick:f,ref:p,"data-testid":g!==void 0?`${g}-btn-confirm`:void 0,children:c}),m]})]})]})}li.propTypes={isOpen:M.bool.isRequired,headerText:M.string.isRequired,bodyText:M.oneOfType([M.string,M.func]).isRequired,onCancel:M.func,onConfirm:M.func.isRequired,onDiscard:M.func,onModalDisable:M.func,cancelButtonText:M.string,confirmButtonText:M.string,discardButtonText:M.string,children:M.node,"data-testid":M.string};li.defaultProps={children:void 0,cancelButtonText:"Cancel",confirmButtonText:"Okay",discardButtonText:"Discard",onCancel:void 0,onDiscard:void 0,onModalDisable:void 0,"data-testid":void 0};const cr=J.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:U("btn",n),onClick:i,style:o,disabled:s,id:a,children:t})});cr.displayName="Button";cr.propTypes={children:M.node,className:M.string,disabled:M.bool,onClick:M.func,style:M.shape({}),id:M.string};cr.defaultProps={children:null,className:"",disabled:!1,onClick:()=>null,style:{},id:""};const Jc=cr;function $l({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:U(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 jr(d){return d.then!==void 0}class Ys{static actionsDisabled=!1;static disableAllActions(){Ys.actionsDisabled=!0}static enableAllActions(){Ys.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(Ys.compareActions),t}static isMacPlatform(){const{platform:e}=window.navigator;return e.startsWith("Mac")}static getModifierKey(){return Ys.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(e){const t=Ys.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 Ve=Ys,ed=Z.module("GlobalContextAction");class cf 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),ed.debug("Received context menu event at global action! Menu items are now: ",t.contextActions))}handleKeyDown(e){const{action:t}=this.props;!Ve.actionsDisabled&&t.shortcut!==void 0&&t.shortcut.matchesEvent(e)&&(ed.debug("Global hotkey matched!",e),t.action?.(e),e.preventDefault(),e.stopPropagation())}render(){return null}}const df=cf;class hf 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(df,{action:i,"data-testid":t},`${i.title}.${o?.id}`);n.push(a)}}return n}}const uf=hf;const na=Z.module("ContextActions");class mf 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=J.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=>!jr(s)&&typeof s!="function"&&s.isGlobal),n=e.actions.filter(s=>!jr(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){na.debug2(`Contextmenu event ignored based on the target className "${o}"`);return}s=s.parentElement}}if(Ve.isContextActionEvent(e)||(e.contextActions=[]),!Ve.isContextActionEvent(e))return;const{actions:n}=this.props;if(n!=null){let s=n;Array.isArray(s)&&(s=s.filter(i=>jr(i)||typeof i=="function"||i.isGlobal===void 0||!i.isGlobal)),e.contextActions=e.contextActions.concat(s)}na.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];!Ve.actionsDisabled&&s.shortcut!=null&&s.shortcut.matchesEvent(e)&&(na.debug("Context hotkey matched!",e),s.action?.(e),e.stopPropagation(),e.preventDefault(),na.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(uf,{actions:t})})}}const oe=mf,Vl=J.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,D={menuItem:T,closeMenu:w,isKeyboardSelected:y,isMouseSelected:E,iconElement:S,displayShortcut:v,"data-testid":I};return J.cloneElement(f,{forwardedProps:D})}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(J.isValidElement(f))m=f;else{let S;a.iconColor!=null&&(a.disabled===void 0||!a.disabled)&&(S={color:a.iconColor}),m=l.jsx(Q,{icon:f,style:S})}}let g=null;const p=Boolean(o);a.actions&&(g=l.jsx(Q,{icon:_h}));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:U("btn-context-menu",{disabled:f},{active:(p||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:U("icon",{outline:S}),children:m}),l.jsx("span",{className:"title",children:a.title}),u!==void 0&&l.jsx("span",{className:"shortcut",children:u}),g&&l.jsx("span",{className:U("submenu-indicator",{disabled:f}),children:g})]})})}return l.jsxs("div",{className:"context-menu-item",ref:e,"data-testid":h,children:[o,C]})});Vl.displayName="ContextMenuItem";Vl.defaultProps={children:null,isKeyboardSelected:!1,isMouseSelected:!1,"data-testid":void 0};const qh=Vl,Ne=Object.freeze([]),qn=new Map;class gf extends Error{isCanceled=!0}const Bi=gf;class Bl{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),Bl.getBrightness(i)<125}static getBrightness(e){return Math.round((e[0]*299+e[1]*587+e[2]*114)/1e3)}}const Yh=Bl;async function Ki(d){const{clipboard:e}=navigator;if(e!==void 0)try{return navigator.clipboard.writeText(d)}catch{return td(d)}td(d)}function td(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 pf="table_",nd="column_",ff=new Set(["in","not","i","ii","k"]),Cf=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"]),Sf=/[^a-zA-Z0-9_$+@-]/g,bf=/[^A-Za-z0-9_$]/g;class Xs{static legalize=(e,t,n,s,i)=>{let o=e.trim().replace(/[- ]/g,"_");return s&&(ff.has(o)||Cf.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=>Xs.legalize(e,pf,Sf,!1,0);static legalizeColumnNames=e=>{const t=[];return e.forEach((n,s)=>{let i=Xs.legalizeColumnName(n,s);t.includes(i)&&(i=nd+s),t.push(i)}),t};static legalizeColumnName=(e,t=0)=>Xs.legalize(e,nd,bf,!0,t);static isValidTableName=e=>Xs.legalizeTableName(e)===e;static isValidColumnName=e=>Xs.legalizeColumnName(e)===e}const qi=Xs;function wf(d,e){return d?d.closest(`.${e}`):null}const vf={getClosestByClassName:wf};class Ue extends CustomEvent{constructor(e,t){super(e,t)}}class Tf extends Error{isTimeout=!0}const Ul=Tf;class we{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 Bi),s!=null&&t&&t(s)},o}static isCanceled(e){return e instanceof Bi}static isTimedOut(e){return e instanceof Ul}static withTimeout(e,t){return new Promise((n,s)=>{setTimeout(()=>{try{n(t())}catch(i){s(i)}},e)})}}class Ef{pending=[];resolved=[];add(e,t){const n=we.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 os=Ef;function N(d){if(d==null)throw new Error("Value is null or undefined")}function P(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 Wl{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(!Wl.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},[])}}const On=Wl;class yf{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 qt=yf;class Gl{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(Gl.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])}}const dr=Gl;class xf extends Error{isInvalid=!0}const _i=xf,sd=Z.module("ContextMenu");class ka 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=J.createRef(),this.oldFocus=document.activeElement,this.activeSubMenuRef=J.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=Ve.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:Ve.sortActions(i)})}initMenuPromise(e){const t=we.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:Ve.sortActions(s.menuItems.concat(n)),pendingItems:o}}return null})},n=>{we.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}),sd.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){sd.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=Ve.getNextMenuItem(s,-1,t):(e.key==="ArrowDown"||e.key==="Tab")&&(s=Ve.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:g}=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(qh,{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 p=null;c.length>0&&(p=l.jsx("div",{className:"loading",children:l.jsx(yn,{})}));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:U({"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:ka.handleContextMenu,role:"menuitem",tabIndex:0,"data-testid":f,children:[e,p]}),S&&s!==null&&h!==null&&u!==null&&l.jsx(ka,{actions:a[s].actions||[],closeMenu:this.handleCloseSubMenu,top:h,left:u,updatePosition:(v,w)=>{this.setState({subMenuTop:v,subMenuLeft:w})},subMenuParentWidth:m,subMenuParentHeight:g},`sub-${s}`)]})}}const Rf=ka;class If extends b.Component{constructor(e){super(e),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.container=J.createRef(),this.openMenu=J.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(!Ve.isContextActionEvent(e)||!this.container.current||e.metaKey||e.ctrlKey)return;const t=Ve.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(Rf,{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:U("context-menu-root",{active:n}),ref:this.container,children:e})}}const Xh=If;class Ts extends b.Component{static propTypes={className:M.string,in:M.bool.isRequired,children:M.node.isRequired,autoFocusOnShow:M.bool,"data-testid":M.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=`${Ts.getHeight(t)}px`}static handleExiting(e){const t=e;t.style.height="0"}static handleExit(e){const t=e;t.style.height=`${Ts.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(bt,{in:n,classNames:{enterActive:"collapsing",enterDone:"collapse show",exitActive:"collapsing",exitDone:"collapse"},onEnter:Ts.handleEnter,onEntering:Ts.handleEntering,onEntered:this.handleEntered,onExit:Ts.handleExit,onExiting:Ts.handleExiting,timeout:350,children:i=>l.jsx("div",{className:U({collapse:i==="exited"},t),"data-testid":s,children:e})})}}const Df=Ts;function hr(d){const e=b.useRef();return b.useEffect(function(){e.current=d}),e.current}function Zh(d){const e=b.useRef(null);return b.useEffect(function(){d&&(typeof d=="function"?d(e.current):d.current=e.current)}),e}const Ff=3500,Nf=Z.module("useCopyToClipboard");function Mf(){const[d,e]=b.useState(!1),t=b.useRef(null),n=b.useCallback(s=>{Ki(s).then(()=>{e(!0)}).catch(i=>Nf.error(`Unable to copy ${s}`,`
|
|
1
|
+
import{A as b,B as M,H as J,P as Jm,C as l,D as bt,F as U,R as $i,G as Q,I as Ae,J as me,K as Xe,L as eg,M as tg,N as Il,O as ir,Q as ng,E as Dl,S as sg,T as ol,U as pe,V as al,W as Os,X as kh,Y as ot,Z as Fl,_ as ig,$ as og,a0 as ag,a1 as rg,a2 as ue,a3 as Bc,a4 as Nl,a5 as lg,a6 as cg,a7 as Oh,a8 as $e,a9 as rl,aa as or,ab as dg,ac as Ln,ad as hg,ae as ug,af as mg,ag as gg,ah as ll,ai as pg,aj as fg,ak as Cg,al as Uc,am as Sg,an as Wc,ao as bg,ap as wg,aq as vg,ar as Tg,as as Eg,at as yg,au as wt,av as Ah,aw as xg,ax as Lh,ay as Rg,az as Ph,aA as Ig,aB as Dg,aC as Fg,aD as Ng,aE as Mg,aF as kg,aG as Og,aH as Ag,aI as Lg,aJ as Pg,aK as Gc,aL as _g}from"./vendor-10e12355.js";import{e as Jn,l as An,K as hn,a as zc,R as jg,b as Ds,W as Hg}from"./monaco-a26f85af.js";import{T as qe,L as Z,M as Wi,a as Gi,b as No,v as _h,c as yn,d as jh,e as Pn,f as $g,g as Vg,h as Mo,i as Bg,j as zi,k as Ml,l as Ug,m as cl,n as Wg,o as Hh,p as kl,q as $h,r as Kc,s as Gg,t as zg,u as Kg,w as qg,x as tn,y as ks,z as Vh,A as es,B as ar,C as Vi,D as Yg,E as Xg,F as qc,G as Da,H as Yc,I as Bh,J as Zg,K as ko,N as Uh,O as Qg,P as Jg,Q as Ol,R as Al,S as Fa,U as Bn,V as ep,W as tp,X as np,Y as sp,Z as ip,_ as Ll,$ as As,a0 as Xc,a1 as Oo,a2 as Pl,a3 as _l,a4 as op,a5 as ap,a6 as Na,a7 as rp,a8 as jl,a9 as Wh,aa as ni,ab as lp,ac as cp,ad as dp,ae as hp,af as up,ag as mp,ah as Zc,ai as Pr,aj as gp,ak as pp,al as fp,am as Cp,an as Sp,ao as Gh,ap as bp,aq as wp,ar as vp,as as zh,at as Tp,au as Ep,av as yp,aw as xp,ax as Rp,ay as Ip,az as Dp,aA as Fp,aB as Np,aC as Mp,aD as kp,aE as Op,aF as Kh,aG as Ap,aH as dl,aI as hl,aJ as Lp,aK as Pp,aL as _p,aM as jp,aN as Hp,aO as $p,aP as Vp,aQ as Bp,aR as Up,aS as Wp,aT as Gp,aU as Qc,aV as zp,aW as Kp,aX as qp}from"./index-0488437e.js";import{P as Ma,b as Yp,h as Xp,p as Zp,o as Qp,s as Jp,t as ef,c as _r}from"./plotly-7777e464.js";import"./helpers-042e6b4d.js";class tf extends b.Component{static propTypes={children:M.node.isRequired,options:M.shape({}),className:M.string,timeout:M.number,onEntered:M.func,onExited:M.func,isShown:M.bool,closeOnBlur:M.bool,interactive:M.bool,referenceObject:M.shape({}),"data-testid":M.string};static defaultProps={options:{},className:"",timeout:qe.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=J.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 Jm(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(bt,{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:U("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&&$i.createPortal(this.renderContent(),this.element)})}}const di=tf,nf=Z.module("Tooltip");class jt 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:jt.defaultReshowTimeout,timeout:jt.defaultTimeout,onEntered:()=>{},onExited:()=>{},"data-testid":void 0};static handleHidden(){jt.shownTooltipCount-=1,jt.shownTooltipCount===0&&(jt.lastHiddenTime=Date.now())}static handleShown(){jt.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=J.createRef(),this.popper=J.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?jt.handleShown():jt.handleHidden())}componentWillUnmount(){this.stopListening(),this.stopListeningWindow(),this.stopTimer();const{isShown:e}=this.state;e&&jt.handleHidden()}container;popper;parent;timer;startListening(){if(!this.container.current||!this.container.current.parentElement){nf.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;(jt.shownTooltipCount>0||Date.now()-jt.lastHiddenTime<jt.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(di,{className:U(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=jt;function rr(d){const{children:e,className:t,style:n,"data-testid":s}=d;return l.jsx("div",{className:U("btn-group",t),style:n,role:"group","data-testid":s,children:e})}rr.displayName="ButtonGroup";rr.propTypes={children:M.node.isRequired,className:M.string,style:M.object,"data-testid":M.string};rr.defaultProps={className:null,style:{},"data-testid":void 0};const sf=["primary","secondary","tertiary","success","danger","inline","ghost"],of=["group-end"];function af(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 U("btn-link",{"btn-link-icon":e,"btn-link-icon-only":e})}}function rf(d){switch(d){case"group-end":return U("pl-2","pr-3")}}const lr=J.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:g,onMouseLeave:p,onKeyDown:C,className:f,style:S,children:v,tabIndex:w,"data-testid":T,"aria-label":y}=d,E=Boolean(o&&v==null),I=af(t,E);let D;n&&(D=rf(n));let F;o&&(F=J.isValidElement(o)?o:l.jsx(Q,{icon:o}));let _;i!==void 0&&(_=typeof i=="string"?l.jsx(tt,{children:i}):i);let L=y;y===void 0&&E&&i!=null&&typeof i=="string"&&(L=i);const B=l.jsxs("button",{"data-testid":T,ref:e,type:s,className:U("btn",I,D,{active:r},f),onClick:c,onContextMenu:h,onMouseUp:m,onMouseDown:u,onMouseEnter:g,onMouseLeave:p,onKeyDown:C,style:S,disabled:a,tabIndex:w,"aria-label":L,children:[o&&F,v,i!=null&&!a&&_]});return a?l.jsxs("span",{className:"btn-disabled-wrapper",children:[B,i!==void 0&&_]}):B});lr.displayName="Button";lr.propTypes={kind:M.oneOf(sf).isRequired,variant:M.oneOf(of),type:M.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&&!J.isValidElement(t)&&(t==null||t.iconName===""||t.iconName==null)?new Error("Icon must be react element or fontawesome IconDefinition"):null},disabled:M.bool,active:M.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:M.func,onMouseUp:M.func,onMouseDown:M.func,onMouseEnter:M.func,onMouseLeave:M.func,onKeyDown:M.func,tabIndex:M.number,children:M.node,className:M.string,style:M.object,"data-testid":M.string};lr.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=lr;function lf({className:d,icon:e,isOpen:t,subtitle:n,title:s}){return l.jsx(Wi,{isOpen:t,className:d,children:l.jsx(Gi,{children:l.jsxs("div",{className:"info-modal",children:[e!=null&&l.jsx("div",{className:"message-icon",children:l.jsx(Q,{icon:e})}),l.jsx("div",{className:"message-header",children:s}),n!=null&&l.jsx("div",{className:"message-content",children:n})]})})})}function Hl({className:d="modal-footer",children:e,"data-testid":t}){return l.jsx("div",{className:d,"data-testid":t,children:e})}function li(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":g}=d,p=b.useRef(null),C=b.useRef(null),f=b.useCallback(()=>{C.current!==null&&C.current.checked&&a&&a(),i()},[i,a]),S=b.useCallback(()=>{p.current?.focus()},[]);let v="";return e&&(v=typeof n=="function"?n():n),l.jsxs(Wi,{isOpen:e,className:"theme-bg-light",onOpened:S,children:[l.jsx(No,{closeButton:!1,children:t}),l.jsx(Gi,{children:v}),l.jsxs(Hl,{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":g!==void 0?`${g}-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":g!==void 0?`${g}-btn-discard`:void 0,children:h}),s&&l.jsx(V,{kind:"secondary","data-dismiss":"modal",onClick:s,"data-testid":g!==void 0?`${g}-btn-cancel`:void 0,children:r}),l.jsxs(rr,{children:[l.jsx(V,{kind:u?"danger":"primary",onClick:f,ref:p,"data-testid":g!==void 0?`${g}-btn-confirm`:void 0,children:c}),m]})]})]})}li.propTypes={isOpen:M.bool.isRequired,headerText:M.string.isRequired,bodyText:M.oneOfType([M.string,M.func]).isRequired,onCancel:M.func,onConfirm:M.func.isRequired,onDiscard:M.func,onModalDisable:M.func,cancelButtonText:M.string,confirmButtonText:M.string,discardButtonText:M.string,children:M.node,"data-testid":M.string};li.defaultProps={children:void 0,cancelButtonText:"Cancel",confirmButtonText:"Okay",discardButtonText:"Discard",onCancel:void 0,onDiscard:void 0,onModalDisable:void 0,"data-testid":void 0};const cr=J.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:U("btn",n),onClick:i,style:o,disabled:s,id:a,children:t})});cr.displayName="Button";cr.propTypes={children:M.node,className:M.string,disabled:M.bool,onClick:M.func,style:M.shape({}),id:M.string};cr.defaultProps={children:null,className:"",disabled:!1,onClick:()=>null,style:{},id:""};const Jc=cr;function $l({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:U(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 jr(d){return d.then!==void 0}class Ys{static actionsDisabled=!1;static disableAllActions(){Ys.actionsDisabled=!0}static enableAllActions(){Ys.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(Ys.compareActions),t}static isMacPlatform(){const{platform:e}=window.navigator;return e.startsWith("Mac")}static getModifierKey(){return Ys.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(e){const t=Ys.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 Ve=Ys,ed=Z.module("GlobalContextAction");class cf 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),ed.debug("Received context menu event at global action! Menu items are now: ",t.contextActions))}handleKeyDown(e){const{action:t}=this.props;!Ve.actionsDisabled&&t.shortcut!==void 0&&t.shortcut.matchesEvent(e)&&(ed.debug("Global hotkey matched!",e),t.action?.(e),e.preventDefault(),e.stopPropagation())}render(){return null}}const df=cf;class hf 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(df,{action:i,"data-testid":t},`${i.title}.${o?.id}`);n.push(a)}}return n}}const uf=hf;const na=Z.module("ContextActions");class mf 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=J.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=>!jr(s)&&typeof s!="function"&&s.isGlobal),n=e.actions.filter(s=>!jr(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){na.debug2(`Contextmenu event ignored based on the target className "${o}"`);return}s=s.parentElement}}if(Ve.isContextActionEvent(e)||(e.contextActions=[]),!Ve.isContextActionEvent(e))return;const{actions:n}=this.props;if(n!=null){let s=n;Array.isArray(s)&&(s=s.filter(i=>jr(i)||typeof i=="function"||i.isGlobal===void 0||!i.isGlobal)),e.contextActions=e.contextActions.concat(s)}na.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];!Ve.actionsDisabled&&s.shortcut!=null&&s.shortcut.matchesEvent(e)&&(na.debug("Context hotkey matched!",e),s.action?.(e),e.stopPropagation(),e.preventDefault(),na.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(uf,{actions:t})})}}const oe=mf,Vl=J.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,D={menuItem:T,closeMenu:w,isKeyboardSelected:y,isMouseSelected:E,iconElement:S,displayShortcut:v,"data-testid":I};return J.cloneElement(f,{forwardedProps:D})}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(J.isValidElement(f))m=f;else{let S;a.iconColor!=null&&(a.disabled===void 0||!a.disabled)&&(S={color:a.iconColor}),m=l.jsx(Q,{icon:f,style:S})}}let g=null;const p=Boolean(o);a.actions&&(g=l.jsx(Q,{icon:_h}));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:U("btn-context-menu",{disabled:f},{active:(p||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:U("icon",{outline:S}),children:m}),l.jsx("span",{className:"title",children:a.title}),u!==void 0&&l.jsx("span",{className:"shortcut",children:u}),g&&l.jsx("span",{className:U("submenu-indicator",{disabled:f}),children:g})]})})}return l.jsxs("div",{className:"context-menu-item",ref:e,"data-testid":h,children:[o,C]})});Vl.displayName="ContextMenuItem";Vl.defaultProps={children:null,isKeyboardSelected:!1,isMouseSelected:!1,"data-testid":void 0};const qh=Vl,Ne=Object.freeze([]),qn=new Map;class gf extends Error{isCanceled=!0}const Bi=gf;class Bl{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),Bl.getBrightness(i)<125}static getBrightness(e){return Math.round((e[0]*299+e[1]*587+e[2]*114)/1e3)}}const Yh=Bl;async function Ki(d){const{clipboard:e}=navigator;if(e!==void 0)try{return navigator.clipboard.writeText(d)}catch{return td(d)}td(d)}function td(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 pf="table_",nd="column_",ff=new Set(["in","not","i","ii","k"]),Cf=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"]),Sf=/[^a-zA-Z0-9_$+@-]/g,bf=/[^A-Za-z0-9_$]/g;class Xs{static legalize=(e,t,n,s,i)=>{let o=e.trim().replace(/[- ]/g,"_");return s&&(ff.has(o)||Cf.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=>Xs.legalize(e,pf,Sf,!1,0);static legalizeColumnNames=e=>{const t=[];return e.forEach((n,s)=>{let i=Xs.legalizeColumnName(n,s);t.includes(i)&&(i=nd+s),t.push(i)}),t};static legalizeColumnName=(e,t=0)=>Xs.legalize(e,nd,bf,!0,t);static isValidTableName=e=>Xs.legalizeTableName(e)===e;static isValidColumnName=e=>Xs.legalizeColumnName(e)===e}const qi=Xs;function wf(d,e){return d?d.closest(`.${e}`):null}const vf={getClosestByClassName:wf};class Ue extends CustomEvent{constructor(e,t){super(e,t)}}class Tf extends Error{isTimeout=!0}const Ul=Tf;class we{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 Bi),s!=null&&t&&t(s)},o}static isCanceled(e){return e instanceof Bi}static isTimedOut(e){return e instanceof Ul}static withTimeout(e,t){return new Promise((n,s)=>{setTimeout(()=>{try{n(t())}catch(i){s(i)}},e)})}}class Ef{pending=[];resolved=[];add(e,t){const n=we.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 os=Ef;function N(d){if(d==null)throw new Error("Value is null or undefined")}function P(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 Wl{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(!Wl.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},[])}}const On=Wl;class yf{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 qt=yf;class Gl{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(Gl.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])}}const dr=Gl;class xf extends Error{isInvalid=!0}const _i=xf,sd=Z.module("ContextMenu");class ka 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=J.createRef(),this.oldFocus=document.activeElement,this.activeSubMenuRef=J.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=Ve.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:Ve.sortActions(i)})}initMenuPromise(e){const t=we.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:Ve.sortActions(s.menuItems.concat(n)),pendingItems:o}}return null})},n=>{we.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}),sd.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){sd.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=Ve.getNextMenuItem(s,-1,t):(e.key==="ArrowDown"||e.key==="Tab")&&(s=Ve.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:g}=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(qh,{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 p=null;c.length>0&&(p=l.jsx("div",{className:"loading",children:l.jsx(yn,{})}));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:U({"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:ka.handleContextMenu,role:"menuitem",tabIndex:0,"data-testid":f,children:[e,p]}),S&&s!==null&&h!==null&&u!==null&&l.jsx(ka,{actions:a[s].actions||[],closeMenu:this.handleCloseSubMenu,top:h,left:u,updatePosition:(v,w)=>{this.setState({subMenuTop:v,subMenuLeft:w})},subMenuParentWidth:m,subMenuParentHeight:g},`sub-${s}`)]})}}const Rf=ka;class If extends b.Component{constructor(e){super(e),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.container=J.createRef(),this.openMenu=J.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(!Ve.isContextActionEvent(e)||!this.container.current||e.metaKey||e.ctrlKey)return;const t=Ve.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(Rf,{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:U("context-menu-root",{active:n}),ref:this.container,children:e})}}const Xh=If;class Ts extends b.Component{static propTypes={className:M.string,in:M.bool.isRequired,children:M.node.isRequired,autoFocusOnShow:M.bool,"data-testid":M.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=`${Ts.getHeight(t)}px`}static handleExiting(e){const t=e;t.style.height="0"}static handleExit(e){const t=e;t.style.height=`${Ts.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(bt,{in:n,classNames:{enterActive:"collapsing",enterDone:"collapse show",exitActive:"collapsing",exitDone:"collapse"},onEnter:Ts.handleEnter,onEntering:Ts.handleEntering,onEntered:this.handleEntered,onExit:Ts.handleExit,onExiting:Ts.handleExiting,timeout:350,children:i=>l.jsx("div",{className:U({collapse:i==="exited"},t),"data-testid":s,children:e})})}}const Df=Ts;function hr(d){const e=b.useRef();return b.useEffect(function(){e.current=d}),e.current}function Zh(d){const e=b.useRef(null);return b.useEffect(function(){d&&(typeof d=="function"?d(e.current):d.current=e.current)}),e}const Ff=3500,Nf=Z.module("useCopyToClipboard");function Mf(){const[d,e]=b.useState(!1),t=b.useRef(null),n=b.useCallback(s=>{Ki(s).then(()=>{e(!0)}).catch(i=>Nf.error(`Unable to copy ${s}`,`
|
|
2
2
|
`,i))},[]);return b.useEffect(()=>(t.current&&clearTimeout(t.current),d&&(t.current=setTimeout(()=>{e(!1)},Ff)),()=>{t.current&&clearTimeout(t.current)}),[d]),[d,n]}const ur=J.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(Ae()),g=Zh(e);b.useEffect(function(){g.current&&(g.current.indeterminate=t===null)},[g,t]);const p=b.useCallback(C=>{g.current&&(g.current.indeterminate=t===null),h&&h(C)},[g,t,h]);return l.jsxs("div",{className:U("custom-control custom-checkbox",s),children:[l.jsx("input",{type:"checkbox",ref:g,checked:t??!1,className:U("custom-control-input",o,{"is-invalid":a}),disabled:i,id:m,name:c,onChange:p,"data-testid":u}),l.jsx("label",{className:U("custom-control-label",r),htmlFor:m,children:n})]})});ur.displayName="Checkbox";ur.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:M.node.isRequired,className:M.string,disabled:M.bool,inputClassName:M.string,isInvalid:M.bool,labelClassName:M.string,name:M.string,onChange:M.func,"data-testid":M.string};ur.defaultProps={checked:!1,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};const Jt=ur;class kf extends b.PureComponent{static defaultProps={placeholder:"Search",className:"",matchCount:null,onKeyDown(){},id:"","data-testid":void 0};constructor(e){super(e),this.inputField=J.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:U("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(Q,{icon:jh})})]})}}const Ls=kf;var Qh=(d=>(d.UP="UP",d.DOWN="DOWN",d))(Qh||{});class Ii extends b.Component{static MENU_NAVIGATION_DIRECTION=Qh;static DROP_DOWN_MENU_HEIGHT=200;static propTypes={options:M.arrayOf(M.shape({title:M.string.isRequired,value:M.string.isRequired})).isRequired,popperOptions:M.shape({title:M.string.isRequired,value:M.string.isRequired}),onChange:M.func,inputPlaceholder:M.string,searchPlaceholder:M.string,disabled:M.bool,className:M.string,defaultValue:M.string,spellCheck:M.bool,onEnter:M.func,"data-testid":M.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=J.createRef(),this.cbContainer=J.createRef(),this.toggleButton=J.createRef(),this.menuContainer=J.createRef(),this.input=J.createRef(),this.searchInput=J.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=me((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(Ii.MENU_NAVIGATION_DIRECTION.UP),e.stopPropagation(),e.preventDefault();break;case"ArrowDown":this.handleMenuNavigation(Ii.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 Ii.MENU_NAVIGATION_DIRECTION.UP:r=-1;break;case Ii.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(Ls,{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:U("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:U("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(Q,{icon:Pn}),l.jsx(di,{ref:this.popper,options:c,className:U("combobox interactive"),onEntered:this.handleMenuOpened,onExited:this.handleMenuExited,children:this.renderMenuElement()})]})})]})}}const Jh=Ii;function mr({copy:d,kind:e="ghost",tooltip:t="Copy",className:n,"data-testid":s,children:i}){const[o,a]=Mf();return l.jsx(V,{kind:e,className:n,"data-testid":s,icon:o?$g:Vg,tooltip:o?"Copied":t,onClick:()=>{a(typeof d=="function"?d():d)},children:i})}function eu(d,e,t){return d.substring(0,e)+t+d.substring(e+1)}function Of(d,e,t){return d.length<t?`${d}${e.substring(d.length,t)}`:d}function id(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 un=Z.module("MaskedInput"),vi={FORWARD:"forward",BACKWARD:"backward",NONE:"none"},sa=" ",tu=J.forwardRef((d,e)=>{const{className:t,example:n,getNextSegmentValue:s=(O,j,k)=>k,getPreferredReplacementString:i=eu,onChange:o=()=>!1,onSelect:a=()=>!1,onSubmit:r,pattern:c,placeholder:h,selection:u,value:m,onFocus:g=()=>!1,onBlur:p=()=>!1,"data-testid":C}=d,f=Zh(e),S=b.useMemo(()=>Array.isArray(n)?n:[n],[n]),v=b.useMemo(()=>S[0].replace(/[a-zA-Z0-9]/g,sa),[S]);b.useEffect(function(){if(u!=null){un.debug("setting selection...",u);const{selectionStart:j,selectionEnd:k,selectionDirection:A}=u;f.current?.setSelectionRange(j,k,A),un.debug("selection set!")}},[u,f]);const w=b.useCallback(O=>{let j=O,k=O;const A=S.length>0?S[0]:m;for(let z=j-1;z>=0&&/[a-zA-Z0-9]/g.test(A.charAt(z));z-=1)j=z;for(let z=k;z<A.length&&/[a-zA-Z0-9]/g.test(A.charAt(z));z+=1)k=z+1;const H=j===k?vi.NONE:vi.BACKWARD;return{selectionStart:j,selectionEnd:k,selectionDirection:H}},[S,m]);function T(O,j,k=O.length){let A="";for(let H=0;H<k;H+=1)O.charAt(H)!==sa?A=A.concat(O[H]):A=A.concat(j[H]);return A=A.concat(j.substring(k)),A}function y(O,j=O.length){const k=new RegExp(`^${c}$`);if(k.test(O))return!0;for(let A=0;A<S.length;A+=1){const H=T(O,S[A],j);if(k.test(H))return!0}return!1}function E(O){const j=w(O),k=j.selectionEnd+1;return k>=m.length?j:w(k)}function I(O){const j=w(O),k=j.selectionStart-1;return k<=0?j:w(k)}function D(O,j){const k=w(O),A=m.substring(k.selectionStart,k.selectionEnd),H=s(k,j,A,m),z=m.substring(0,k.selectionStart)+H+m.substring(k.selectionEnd);y(z,k.selectionEnd)&&(o(z),a(k))}const F=b.useCallback(O=>{const{selectionStart:j=0,selectionEnd:k=0,selectionDirection:A="none"}=O.target;if(j===null||k===null||A===null){un.error("Selection attempted on non-text input element",O.target);return}if(un.debug2("handleSelect",j,k,A),!(u!=null&&j===u.selectionStart&&k===u.selectionEnd)){if(u!=null&&j===m.length&&k===m.length&&O.nativeEvent.type!=="mouseup"){a({...u});return}if(j===k){const H=w(j);un.debug("Selection segment from ",j,k,"=>",H),a(H)}else a({selectionStart:j,selectionEnd:k,selectionDirection:A})}},[w,a,u,m]),_=b.useCallback(O=>{if(!f.current)return;un.debug("handleSelectCapture",O);const j=f.current.selectionStart??0;j===m.length&&u!=null&&j!==u.selectionStart&&(O.preventDefault(),O.stopPropagation())},[f,u,m]);function L(O){if(O.preventDefault(),O.stopPropagation(),!f.current)return;const{key:j}=O,{selectionStart:k=0,selectionEnd:A=0}=f.current;if(k===null||A===null){un.error("Selection arrow nvaigation attempted on non-text input element",O.target);return}j==="ArrowLeft"?a(I(k)):j==="ArrowRight"?a(E(A)):j==="ArrowUp"?D(k,-1):j==="ArrowDown"&&D(k,1)}function B(O){if(!f.current)return;un.debug("handleKeyDown",O);const{key:j}=O,{selectionStart:k=0,selectionEnd:A=0}=f.current;if(k===null||A===null){un.error("Selection key event on non-text input element",O.target);return}if(j==="Enter"){r?.(O);return}if(j.startsWith("Arrow")){L(O);return}if(j==="Delete"||j==="Backspace"){if(O.preventDefault(),O.stopPropagation(),A>=id(m,v).length){const z=m.substring(0,k===A?k-1:k),K=id(z,v);K!==m&&(o(K),a({selectionStart:K.length,selectionEnd:K.length,selectionDirection:vi.NONE}));return}if(k!==A){const z=m.substring(0,k)+m.substring(k,A).replace(/[a-zA-Z0-9]/g,sa)+m.substring(A);un.debug("Range ",k,A,"deleted, setting value",z),o(z),a({selectionStart:k,selectionEnd:k,selectionDirection:vi.NONE})}else if(k>0)for(let z=k-1;z>=0;z-=1){const K=m.substring(0,z)+m.substring(z,k).replace(/[a-zA-Z0-9]/g,sa)+m.substring(k);if(K!==m){o(K),a({selectionStart:z,selectionEnd:z,selectionDirection:vi.NONE});return}}return}if(O.altKey||O.metaKey||O.ctrlKey||j.length>1)return;O.preventDefault(),O.stopPropagation();const H=Array.from(new Set([j,j.toUpperCase(),j.toLowerCase()]));for(let z=0;z<H.length;z+=1){const K=H[z],ae=/[a-zA-Z0-9]/g.test(K)?S[0].length-1:k;for(let W=k;W<=ae;W+=1){const G=Of(m,S[0],W+1),te=i(G,W,K,k,A);if(y(te,W+1)){const ie=w(W),ce=W+1;let X={selectionStart:ce,selectionEnd:ce,selectionDirection:vi.NONE};if(ce>=ie.selectionEnd){const re=E(W);re.selectionStart!==ie.selectionStart&&(X=re)}un.debug("handleKeyDown",j,"=>",te,X),o(te),a(X);return}}}}return l.jsx("input",{ref:f,className:U("form-control masked-input",t),type:"text",pattern:c,placeholder:h,value:m,onChange:()=>{},onKeyDown:B,onSelect:F,onSelectCapture:_,onFocus:g,onBlur:p,"data-testid":C})});tu.defaultProps={className:"",placeholder:void 0,onChange(){},onSelect(){},getNextSegmentValue:(d,e,t)=>t,getPreferredReplacementString:eu,selection:void 0,onFocus(){},onBlur(){},"data-testid":void 0};const Af=tu;let Lf=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=J.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=Ve.getMenuItems(e,!1);t.length>0&&this.setState(n=>({menuItems:Ve.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=Ve.getNextMenuItem(s??0,-1,t):(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1)&&(s=Ve.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(qh,{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 Pf=Lf;class _f 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=J.createRef(),this.parent=null,this.popper=J.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(di,{ref:this.popper,options:a,className:U("menu-popper",n),onExited:this.handleExited,closeOnBlur:!0,interactive:!0,children:l.jsx(Pf,{actions:e,closeMenu:this.handleCloseMenu,onMenuOpened:t,options:o,menuStyle:i})})})}}const ts=_f;function Ti(d,e,t,n,s){const i=n-t+1;return`${((parseInt(e,10)-d-t)%i+i)%i+t}`.padStart(s,"0")}function jf(d,e,t){const{selectionStart:n}=d;return n===0?Ti(e,t,1900,2099,4):n===5?Ti(e,t,1,12,2):n===8?Ti(e,t,1,31,2):n===11?Ti(e,t,0,23,2):n===17||n===14?Ti(e,t,0,59,2):n===20||n===24||n===28?Ti(e,t,0,999,3):t}function ul(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 Hf=Z.module("DateTimeInput"),$f="[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}",Bf=`${$f} ${Vf}`,Ea="2022-01-01",nu=`${Ea} 00:00:00.000000000`,Uf="YYYY-MM-DD HH:MM:SS.SSSSSSSSS";function od(d){return d!=null&&d.length>=Ea.length?`${d.substring(0,Ea.length)}${d.substring(Ea.length).replace(/\u2007/g,"0")}${nu.substring(d.length)}`:d}function ad(d){return d.replace(/\u200B/g,"")}const Wf=[ul(nu)],zl=J.forwardRef((d,e)=>{const{className:t="",onChange:n=()=>{},defaultValue:s="",onFocus:i=()=>{},onBlur:o=()=>{},onSubmit:a,"data-testid":r}=d,[c,h]=b.useState(s.length>0?ul(s):""),[u,m]=b.useState(),g=b.useCallback(C=>{Hf.debug("handleChange",C),h(C),n(od(ad(C)))},[n]),p=b.useCallback(()=>{const C=ad(c),f=od(C);f!==C&&h(ul(f)),o()},[c,o]);return l.jsx("div",{className:"d-flex flex-row align-items-center",children:l.jsx(Af,{ref:e,className:U(t),example:Wf,getNextSegmentValue:jf,onChange:g,onSelect:m,onSubmit:a,pattern:Bf,placeholder:Uf,selection:u,value:c,onFocus:i,onBlur:p,"data-testid":r})})});zl.displayName="DateTimeInput";zl.defaultProps={className:"",onChange:()=>{},defaultValue:"",onFocus:()=>{},onBlur:()=>{},"data-testid":void 0};const Gf=zl;class zf extends b.PureComponent{static defaultProps={placeholder:"Search",className:"",matchCount:null,debounceMs:250,id:"","data-testid":void 0};constructor(e){super(e),this.searchInput=J.createRef(),this.handleChange=this.handleChange.bind(this),this.sendUpdate=Xe(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(Ls,{value:o,placeholder:e,onChange:this.handleChange,className:t,matchCount:n,ref:this.searchInput,id:s,"data-testid":i})}}const Kf=zf;const qf=Z.module("ItemListItem");class Kl 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 qf.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=J.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:U("item-list-item",{active:n},{"is-focused":t},{"is-draggable":e}),onKeyDown:Kl.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 Yf=Kl;const rd=Z.module("ItemList"),ld=5;class Wt extends b.PureComponent{static CACHE_SIZE=1e3;static DEFAULT_ROW_HEIGHT=20;static DEFAULT_OVERSCAN=10;static defaultProps={offset:0,items:[],rowHeight:Wt.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!1,isDragSelect:!0,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},overscanCount:Wt.DEFAULT_OVERSCAN,renderItem:Wt.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=J.createRef(),this.listContainer=J.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=me((e,t)=>On.isSelected(t,e),{max:Wt.CACHE_SIZE});getCachedItem=me((e,t,n,s,i,o,a,r)=>{const c=o({item:n,itemIndex:e,isFocused:s,isSelected:i,style:a});return l.jsx(Yf,{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:Wt.CACHE_SIZE});getOuterElement=me(e=>{const t=J.forwardRef((n,s)=>l.jsx("div",{ref:s,tabIndex:-1,onKeyDown:e,role:"presentation",...n}));return t.displayName="ItemListOuterElement",t});getInnerElement=me(()=>{const e=J.forwardRef((t,n)=>l.jsx("div",{className:"item-list-inner-element",ref:n,...t}));return e.displayName="ItemListInnerElement",e});getItemData=me((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=On.isSelected(n,e)||Ve.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:On.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){rd.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){rd.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>ld&&u>ld&&this.setState({isDragging:!0}),(n||o===e)&&(this.focusItem(e),s?(!n&&!this.getItemSelected(e,a)&&!Ve.isModifierKeyDown(t)&&this.deselectAll(),this.selectRange([Math.min(o,e),Math.max(o,e)])):this.toggleSelect(e,t.shiftKey,Ve.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=Ve.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){On.validateRange(e),this.setState(({selectedRanges:t})=>({selectedRanges:On.deselectRange(t,e)}))}selectItem(e){const{disableSelect:t}=this.props;t||this.selectRange([e,e])}selectRange(e){On.validateRange(e),this.setState(({selectedRanges:t})=>({selectedRanges:On.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(eg,{className:"item-list-auto-sizer",onResize:this.handleResize,children:({width:c,height:h})=>l.jsx(tg,{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 Es extends b.PureComponent{static DEFAULT_ROW_HEIGHT=30;static defaultProps={className:"",draggingItemClassName:"",offset:0,items:[],rowHeight:Es.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!0,isDropDisabled:!1,isDragDisabled:!1,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,style:null,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},renderItem:Es.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(Q,{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:U("item-list-item-content","draggable-item-list-item-content",n),children:[l.jsx("span",{className:"title",children:e}),Es.renderBadge({text:t}),Es.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 Es.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=J.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=me((e,t,n,s,i,o,a,r)=>l.jsx(Il,{draggableId:Es.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:Wt.CACHE_SIZE});handleSelectionChange(e){this.setState({selectedCount:On.count(e)});const{onSelectionChange:t}=this.props;t(e)}getCachedRenderDraggableItem=me((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=me((e,t,n,s)=>(i,o,a)=>{const{selectedCount:r}=this.state,{draggableProps:c,dragHandleProps:h,innerRef:u}=i,{index:m}=a.source,g=t[m-n];return l.jsx("div",{className:U("draggable-item-list-dragging-item-container",e),...c,...h,ref:u,children:l.jsx("div",{className:U("draggable-item-list-dragging-item",{"two-dragged":r===2},{"multiple-dragged":r>2}),children:s({item:g,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:g,onSelect:p,onViewportChange:C,renderItem:f,rowHeight:S,selectedRanges:v,style:w,"data-testid":T}=this.props;return l.jsx(ir,{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:U("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(Wt,{focusSelector:".draggable-item-list-item",isDoubleClickSelect:i,isDragSelect:!1,isMultiSelect:r,isStickyBottom:c,itemCount:h,items:u,onFocusChange:g,onSelect:p,onSelectionChange:this.handleSelectionChange,onViewportChange:C,offset:m,ref:this.itemList,renderItem:this.getCachedRenderDraggableItem(t,o,f),rowHeight:S,selectedRanges:v})})})}}const fn=Es;class Oa{static reorder(e,t,n,s){const i=e===n?Oa.adjustDestinationIndex(s,t):s,o=Oa.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 ng(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 wn=Oa;function su({on:d,id:e,className:t,isInvalid:n,disabled:s=!1,onClick:i,"data-testid":o}){return l.jsx("button",{type:"button",className:U("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 cd(d){return d.isOn!==void 0}function Xf({item:d,onSelect:e=()=>{},"data-testid":t}){const{icon:n,subtitle:s,title:i}=d,o=b.useMemo(()=>cd(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(Q,{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:cd(d)?l.jsx(su,{on:d.isOn,onClick:a=>{a.stopPropagation(),o()}}):l.jsx(Q,{icon:_h})})]})}function iu({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(Xf,{item:n,onSelect:()=>{e(s)}})},n.title))})})}function dd({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:Bg,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:zi,tooltip:"Close"})})]}),l.jsx("div",{className:"navigation-content",children:d})]})}function Zf({children:d,"data-testid":e}){const t=b.useMemo(()=>J.Children.toArray(d),[d]),n=hr(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 g=t[t.length-1];t.length===n.length||n.length===0||o!==null||r!==null?o!==null&&g!==o?a(g):g!==r&&g!==s&&i(g):t.length>n.length?a(g):t.length<n.length&&(i(g),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(bt,{in:r!=null,timeout:qe.transitionMidMs,classNames:"slide-right",onEntered:u,children:l.jsx(l.Fragment,{children:r!=null&&l.jsx("div",{className:"popping-view",children:r})})}),l.jsx(bt,{in:o!=null,timeout:qe.transitionMidMs,classNames:"slide-left",onEntered:h,children:l.jsx(l.Fragment,{children:o!=null&&l.jsx("div",{className:"pushing-view",children:o})})})]})}function Qf({children:d,disabled:e,value:t,"data-testid":n}){return l.jsx("option",{value:t,disabled:e,"data-testid":n,children:d})}function gr(d){const{children:e,disabled:t=!1,name:n,onChange:s,value:i="","data-testid":o}=d,[a]=b.useState(n??Ae());return l.jsx(l.Fragment,{children:J.Children.map(e,r=>r?J.cloneElement(r,{name:a,onChange:r.props.onChange??s,checked:i===r.props.value,disabled:r.props.disabled??t,"data-testid":o}):null)})}const ql=J.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,[g]=b.useState(Ae());return l.jsxs("div",{className:U("custom-control custom-radio",s),children:[l.jsx("input",{type:"radio",id:g,"data-testid":m,name:c,ref:e,className:U("custom-control-input",o,{"is-invalid":a}),checked:t,disabled:i,value:u,onChange:h}),l.jsx("label",{className:U("custom-control-label",r),htmlFor:g,children:n})]})});ql.displayName="RadioItem";ql.defaultProps={checked:void 0,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};const ns=ql;function Jf({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:U("custom-select",n),onBlur:e,onChange:c,defaultValue:s,value:o,name:i,disabled:a,"data-testid":r,children:d})}class eC 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=J.createRef(),this.topRow=null,this.bottomRow=null}componentDidMount(){this.sendViewportUpdate()}componentDidUpdate(){this.sendViewportUpdate()}list;topRow;bottomRow;getCachedItem=me((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(Jt,{checked:o,disabled:a,onChange:()=>this.handleSelect(e),children:c})},t)},{max:1e3});getCachedItems=me((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,g=this.getCachedItem(u,m,r,c,t,h,s);i.push(g)}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:U("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 tC=eC,hd=Z.module("Shortcut");var de=(d=>(d.CTRL="MODIFIER_CTRL",d.CMD="MODIFIER_CMD",d.ALT="MODIFIER_ALT",d.OPTION="MODIFIER_OPTION",d.SHIFT="MODIFIER_SHIFT",d))(de||{}),he=(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))(he||{});const nC=new Set(["Enter","Delete","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]);class Pe extends Dl{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(he).includes(e)}static isValidKeyState(e){const{keyValue:t}=e;return t===null?!0:!Pe.isMacPlatform&&e.metaKey||!Pe.isAllowedKey(t)?!1:!(!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey)||nC.has(t)}static isMacPlatform=Ve.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="":!Pe.isAllowedKey(t)&&Pe.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?"":Pe.isMacPlatform?Pe.getMacDisplayText(e):Pe.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=Pe.isMacPlatform?n:t;this.defaultKeyState=Pe.createKeyState(r),this.keyState=this.defaultKeyState}getDisplayText(){return Pe.getDisplayText(this.keyState)}getKeyState(){return this.keyState}setKeyState(e){Pe.isValidKeyState(e)?(hd.debug2(`Shortcut ${this.id} updated to ${JSON.stringify(e)}`),this.keyState=e,this.dispatchEvent(new Ue("onUpdate",{detail:this}))):hd.debug2(`Shortcut ${this.id} tried to update to invalid keyState ${JSON.stringify(e)}`)}getDefaultKeyState(){return this.defaultKeyState}isDefault(){return Pe.doKeyStatesMatch(this.getDefaultKeyState(),this.getKeyState())}setToNull(){this.setKeyState(Pe.NULL_KEY_STATE)}isNull(){return Pe.doKeyStatesMatch(this.keyState,Pe.NULL_KEY_STATE)}setToDefault(){this.setKeyState(this.defaultKeyState)}matchesKeyState(e){return Pe.doKeyStatesMatch(e,this.keyState)}matchesEvent(e){return this.matchesKeyState(Pe.getKeyStateFromEvent(e))}}const ud=Z.module("ShortcutRegistry");class sC extends Dl{shortcutMap=new Map;shortcutsByCategory=new Map;createAndAdd(e){const t=new Pe(e);return this.add(t)}add(e){const t=this.shortcutMap.get(e.id);if(t)return ud.warn(`Skipping attempt to add duplicate shortcut ID to registry: ${e.id}`),t;ud.debug2(`Adding shortcut to registry: ${e.id}`),e.addEventListener("onUpdate",({detail:s})=>this.dispatchEvent(new Ue("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 iC=Object.freeze(new sC),Me=iC,oC={COPY:Me.createAndAdd({id:"GLOBAL.COPY",name:"Copy",shortcut:[de.CTRL,he.C],macShortcut:[de.CMD,he.C],isEditable:!1}),PASTE:Me.createAndAdd({id:"GLOBAL.PASTE",name:"Paste",shortcut:[de.CTRL,he.V],macShortcut:[de.CMD,he.V],isEditable:!1}),SAVE:Me.createAndAdd({id:"GLOBAL.SAVE",name:"Save",shortcut:[de.CTRL,he.S],macShortcut:[de.CMD,he.S],isEditable:!1}),SELECT_ALL:Me.createAndAdd({id:"GLOBAL.SELECT_ALL",name:"Select All",shortcut:[de.CTRL,he.A],macShortcut:[de.CMD,he.A],isEditable:!1}),LINKER:Me.createAndAdd({id:"GLOBAL.LINKER",name:"Linker",shortcut:[de.CTRL,he.L],macShortcut:[de.CMD,he.L]}),LINKER_CLOSE:Me.createAndAdd({id:"GLOBAL.LINKER_CLOSE",name:"Close Linker Overlay",shortcut:[he.ESCAPE],macShortcut:[he.ESCAPE],isEditable:!1})},is=oC;const Yl=J.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":g}=d;return l.jsxs("button",{ref:e,type:"button",className:U("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":g,children:[t,l.jsx(Q,{icon:Ml,className:"linked btn-socketed-icon",transform:"down-1"}),l.jsx(Q,{icon:Ug,className:"is-invalid btn-socketed-icon"})]})});Yl.displayName="SocketedButton";Yl.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 ou=Yl,{dh:aC}=globalThis,x=aC;function au({type:d}){switch(d){case x.VariableType.TABLE:case x.VariableType.TABLEMAP:case x.VariableType.TREETABLE:case x.VariableType.HIERARCHICALTABLE:return l.jsx(Q,{icon:kl});case x.VariableType.FIGURE:return l.jsx(Q,{icon:Hh});case x.VariableType.PANDAS:return l.jsx(Q,{icon:Wg});default:return l.jsx(Q,{icon:cl})}}class rC extends b.Component{constructor(e){super(e),this.container=null}componentDidMount(){this.colorize()}container;colorize(){const{children:e}=this.props;this.container&&e!=null&&Jn.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 pr=rC;class lC{static get LANGUAGE_MAP(){return new Map([["python","Python"],["groovy","Groovy"],["scala","Scala"]])}}const ru=lC;class Aa{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)?[]:sg.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 Aa.isTableType(e)||Aa.isWidgetType(e)}static isFigureType(e){return e===x.VariableType.FIGURE}static isPandas(e){return e===x.VariableType.PANDAS}}const ml=Aa;function lu({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})]})}lu.propTypes={children:M.node.isRequired};class cC 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:U("console-history-result-in-progress",{disabled:e}),children:l.jsxs("span",{className:"badge",children:[l.jsx(yn,{})," Running... ",dr.formatElapsedTime(n)," ",l.jsx(V,{className:"console-history-result-in-progress-cancel",kind:"ghost",icon:zi,tooltip:"Cancel",onClick:t,disabled:e})]})})}}const dC=cC;class La 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)>=La.mouseDragThreshold||Math.abs(e.clientY-this.mouseY)>=La.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;N(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:U("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(Q,{icon:e?Pn:$h,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 hC=La;const md=Z.module("ConsoleHistoryItem");class uC 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){md.debug("handleObjectClick",e);const{openObject:t}=this.props;t(e)}handleCancelClick(){const{item:e}=this.props;e!=null&&e.cancelResult&&(md.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(pr,{language:n,children:t.command})})]}));const a=[];let r=!1;if(i){const{error:h,message:u,changes:m}=i;if(m){const{created:g,updated:p}=m;[...g,...p].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(au,{type:C.type}),children:f},S);a.push(w)})}if(h!=null&&t.command==null){let g=`${h.message??h}`;g||(g=h);const p=l.jsx(hC,{message:g},"result-error");a.push(p)}if(u!==void 0&&u!==""){const g=l.jsx("div",{className:"log-message",children:u},"log-message");a.push(g)}}else{r=!0;const h=l.jsx(dC,{onCancelClick:this.handleCancelClick,disabled:e},"in_progress");a.push(h)}let c=null;return a.length>0&&(c=l.jsx(lu,{children:a})),l.jsxs("div",{className:U("console-command-result",{"console-result-buttons":r}),children:[o,c]})}}const mC=uC;class Xl 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(mC,{disabled:e,item:a,openObject:s,language:n},Xl.itemKey(o,a));i.push(r)}return l.jsx("div",{className:"container-fluid console-history",children:i})}}const gC=Xl,pC={name:"Console",CLEAR:Me.createAndAdd({id:"CONSOLE.CLEAR",name:"Clear",shortcut:[de.CTRL,he.L],macShortcut:[de.CTRL,he.C]}),FOCUS_HISTORY:Me.createAndAdd({id:"CONSOLE.FOCUS_HISTORY",name:"Focus History",shortcut:[de.CTRL,he.H],macShortcut:[de.CTRL,de.OPTION,he.H]})},fC={name:"Command History",FOCUS_HISTORY:Me.createAndAdd({id:"COMMAND_HISTORY.FOCUS_HISTORY",name:"Focus History Search",shortcut:[de.CTRL,he.H],macShortcut:[de.CTRL,de.OPTION,he.H]}),SEND_TO_CONSOLE:Me.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_CONSOLE",name:"Send to Console",shortcut:[he.ENTER],macShortcut:[he.ENTER]}),SEND_TO_NOTEBOOK:Me.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_NOTEBOOK",name:"Send to Notebook",shortcut:[de.CTRL,he.ENTER],macShortcut:[de.CMD,he.ENTER]}),RUN:Me.createAndAdd({id:"COMMAND_HISTORY.RUN",name:"Run",shortcut:[de.ALT,he.R],macShortcut:[de.OPTION,he.R]})},CC={name:"Notebook",RUN:Me.createAndAdd({id:"NOTEBOOK.RUN",name:"Run",shortcut:[de.ALT,he.R],macShortcut:[de.OPTION,he.R]}),RUN_SELECTED:Me.createAndAdd({id:"NOTEBOOK.RUN_SELECTED",name:"Run Selected",shortcut:[de.ALT,de.SHIFT,he.R],macShortcut:[de.OPTION,de.SHIFT,he.R]}),FIND:Me.createAndAdd({id:"NOTEBOOK.FIND",name:"Find",shortcut:[de.CTRL,he.F],macShortcut:[de.CMD,he.F],isEditable:!1}),MINIMAP:Me.createAndAdd({id:"NOTEBOOK.MINIMAP",name:"Show Minimap",shortcut:[de.ALT,he.M],macShortcut:[de.OPTION,he.M]}),WORDWRAP:Me.createAndAdd({id:"NOTEBOOK.WORDWRAP",name:"Word Wrap",shortcut:[de.ALT,he.Z],macShortcut:[de.OPTION,he.Z]})},SC={CONSOLE:pC,COMMAND_HISTORY:fC,NOTEBOOK:CC},Ot=SC,Ct=Object.freeze({FATAL:"FATAL",STDERR:"STDERR",ERROR:"ERROR",WARN:"WARN",STDOUT:"STDOUT",INFO:"INFO",DEBUG:"DEBUG",TRACE:"TRACE"}),bC="#2d2a2e",wC="#fcfcfa",vC="#fcd65b",TC="#b2b1b2",EC="#9edc6f",yC="#76d9e4",xC="#f95d84",RC="#aa9af4",IC="#f95d84",DC="#fcfcfa",FC="#7c7b7c",fe={"error-foreground":"#f95d84",background:bC,foreground:wC,"line-height":"19px",string:vC,"string-delim":"#929192",delimiter:TC,predefined:EC,keyword:yC,storage:xC,number:RC,operator:IC,identifier:DC,"namespace-identifier":"#f95d84","identifier-js":"#fcd65b",comment:FC,"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","text-link-foreground":"#929192","text-link-active-foreground":"#f0f0ee","editor-link-active-foreground":"#f0f0ee"},NC="python",MC={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/}}},kC={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"]]}},OC={id:NC,conf:MC,language:kC},AC=OC,LC="groovy",PC={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/}}},_C={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"]]}},jC={id:LC,conf:PC,language:_C},HC=jC,$C="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>))/}}},BC={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"]]}},UC={id:$C,conf:VC,language:BC},WC=UC,GC="deephavenDb",zC={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/}}},KC={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"]]}},qC={id:GC,conf:zC,language:KC},YC=qC,XC="log",ZC={},QC={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"}]]}},JC={id:XC,conf:ZC,language:QC},eS=JC,Rn=Z.module("MonacoUtils");class Fn{static init({getWorker:e}={}){Rn.debug("Initializing Monaco..."),e!==void 0&&Fn.registerGetWorker(e);const{registerLanguages:t,removeHashtag:n}=Fn,s=[{token:"",foreground:n(fe.foreground)},{token:"string",foreground:n(fe.string)},{token:"string.delim",foreground:n(fe["string-delim"])},{token:"keyword",foreground:n(fe.keyword)},{token:"identifier.js",foreground:n(fe["identifier-js"])},{token:"delimiter",foreground:n(fe.delimiter)},{token:"comment",foreground:n(fe.comment)},{token:"number",foreground:n(fe.number)},{token:"storage",foreground:n(fe.storage)},{token:"identifier",foreground:n(fe.identifier)},{token:"namespace.identifier",foreground:n(fe["namespace-identifier"])},{token:"operator",foreground:n(fe.operator)},{token:"predefined",foreground:n(fe.predefined)},{token:"error.log",foreground:fe["log-error"].substring(1)},{token:"warn.log",foreground:n(fe["log-warn"])},{token:"info.log",foreground:n(fe["log-info"])},{token:"stdout.log",foreground:n(fe["log-stdout"])},{token:"trace.log",foreground:n(fe["log-trace"])},{token:"debug.log",foreground:n(fe["log-debug"])},{token:"date.log",foreground:n(fe["log-date"])}],i={errorForeground:fe["error-foreground"],"inputOption.activeBorder":fe["input-option-active-border"],"editor.background":fe.background,"editor.foreground":fe.foreground,"editor.lineHighlightBackground":fe["editor-line-highlight-bg"],"editorLineNumber.foreground":fe["editor-line-number-foreground"],"editor.selectionBackground":fe["editor-selection-background"],"editor.findMatchBackground":fe["editor-find-match-background"],"editor.findMatchHighlightBackground":fe["editor-find-match-highlight-background"],"editorSuggestWidget.background":fe["editor-suggest-widget-background"],"editorSuggestWidget.border":fe["editor-suggest-widget-border"],"editorSuggestWidget.foreground":fe["editor-suggest-widget-foreground"],"editorSuggestWidget.selectedBackground":fe["editor-suggest-widget-selected-background"],"editorSuggestWidget.highlightForeground":fe["editor-suggest-widget-highlightForeground"],"list.hoverBackground":fe["list-hover-background"],"dropdown.background":fe["context-menu-background"],"dropdown.foreground":fe["context-menu-foreground"],"menu.selectionBackground":fe["menu-selection-background"],"list.focusBackground":fe["menu-selection-background"],"editorWidget.background":fe["editor-widget-background"],"inputOption.activeBackground":fe["input-option-active-background"],"inputOption.activeForeground":fe["input-option-active-foreground"],focusBorder:fe["focus-border"],"input.background":fe["input-background"],"input.foreground":fe["input-foreground"],"input.border":fe["input-border"],"textLink.foreground":fe["text-link-foreground"],"textLink.activeForeground":fe["text-link-active-foreground"],"editorLink.activeForeground":fe["editor-link-active-foreground"]};Jn.defineTheme("dh-dark",{base:"vs-dark",inherit:!0,rules:s,colors:i}),Rn.debug2("monaco theme: ",fe),Jn.setTheme("dh-dark"),t([YC,AC,HC,eS,WC]),Rn.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);An.getLanguages().filter(({id:n})=>t.includes(n)).forEach(n=>{const s=n;Rn.debug2("Overriding default language loader:",s.id)}),e.forEach(n=>{Fn.registerLanguage(n)})}static registerLanguage(e){Rn.debug2("Registering language: ",e.id),An.register(e),An.onLanguage(e.id,()=>{An.setLanguageConfiguration(e.id,e.conf),An.setMonarchTokensProvider(e.id,e.language)})}static setEOL(e,t=Jn.EndOfLineSequence.LF){e.getModel()?.setEOL(t)}static openDocument(e,t){const n=e.getModel();N(n);const s={textDocument:{uri:`${n.uri}`,languageId:n.getLanguageId(),version:n.getVersionId(),text:n.getValue()}};return Rn.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:g,text:p}=u,C={range:{start:{line:m.startLineNumber-1,character:m.startColumn-1},end:{line:m.endLineNumber-1,character:m.endColumn-1}},rangeLength:g,text:p};c.push(C)}if(c.length>0){const h={textDocument:{version:r,uri:`${n.uri}`},contentChanges:c};Rn.debug2("didChangeDocumentParams",h),t.changeDocument(h)}})}static closeDocument(e,t){const n=e.getModel();N(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();N(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=>{Fn.isMacPlatform()&&n.mac===""||!Fn.isMacPlatform()&&n.windows===""||Fn.removeKeybinding(e,Fn.isMacPlatform()?n.mac:n.windows)})}catch(n){Rn.error(n)}}static removeKeybinding(e,t){if(t===void 0)return;const n=e._standaloneKeybindingService._getResolver()._map.get(t);n!=null?n.forEach(s=>{Rn.debug2(`Removing Monaco keybinding ${t} for ${s.command}`),e._standaloneKeybindingService.addDynamicKeybinding(`-${s.command}`,null,()=>{})}):Rn.warn(`Did not find any keybindings to remove for ${t}`)}static getMonacoKeyCodeFromShortcut(e){const{keyState:t}=e,{keyValue:n}=t;return n===null?0:Fn.isMacPlatform()?(t.metaKey?hn.CtrlCmd:0)|(t.shiftKey?hn.Shift:0)|(t.altKey?hn.Alt:0)|(t.ctrlKey?hn.WinCtrl:0)|zc.fromString(n):(t.ctrlKey?hn.CtrlCmd:0)|(t.shiftKey?hn.Shift:0)|(t.altKey?hn.Alt:0)|(t.metaKey?hn.WinCtrl:0)|zc.fromString(n)}static provideLinks(e){const t=[];for(let n=1;n<=e.getLineCount();n+=1){const s=e.getLineContent(n);ol(s).forEach(o=>{t.push({url:o.href,range:new jg(n,o.start+1,n,o.end+1)})})}return{links:t}}}const Bt=Fn,Un=Z.module("MonacoCompletionProvider");class Zs extends b.PureComponent{static lspToMonacoKind(e){const t=An.CompletionItemKind;switch(e){case 1:return t.Text;case 2:return t.Method;case 3:return t.Function;case 4:return t.Constructor;case 5:return t.Field;case 6:return t.Variable;case 7:return t.Class;case 8:return t.Interface;case 9:return t.Module;case 10:return t.Property;case 11:return t.Unit;case 12:return t.Value;case 13:return t.Enum;case 14:return t.Keyword;case 15:return t.Snippet;case 16:return t.Color;case 17:return t.File;case 18:return t.Reference;case 19:return t.Folder;case 20:return t.EnumMember;case 21:return t.Constant;case 22:return t.Struct;case 23:return t.Event;case 24:return t.Operator;case 25:return t.TypeParameter;default:return t.Variable}}static lspToMonacoRange(e){const{start:t,end:n}=e;return{startLineNumber:t.line+1,startColumn:t.character+1,endLineNumber:n.line+1,endColumn:n.character+1}}static monacoToLspPosition(e){return{line:e.lineNumber-1,character:e.column-1}}constructor(e){super(e),this.handleCompletionRequest=this.handleCompletionRequest.bind(this),this.handleSignatureRequest=this.handleSignatureRequest.bind(this),this.handleHoverRequest=this.handleHoverRequest.bind(this)}componentDidMount(){const{language:e,session:t}=this.props;this.registeredCompletionProvider=An.registerCompletionItemProvider(e,{provideCompletionItems:this.handleCompletionRequest,triggerCharacters:[".",'"',"'"]}),t.getSignatureHelp&&(this.registeredSignatureProvider=An.registerSignatureHelpProvider(e,{provideSignatureHelp:this.handleSignatureRequest,signatureHelpTriggerCharacters:["(",","]})),t.getHover&&(this.registeredHoverProvider=An.registerHoverProvider(e,{provideHover:this.handleHoverRequest}))}componentWillUnmount(){this.registeredCompletionProvider?.dispose(),this.registeredSignatureProvider?.dispose(),this.registeredHoverProvider?.dispose()}registeredCompletionProvider;registeredSignatureProvider;registeredHoverProvider;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:Zs.monacoToLspPosition(t),context:n},a=i.getCompletionItems(o);return Un.debug("Requested completion items",o),a.then(c=>(Un.debug("Completion items received: ",o,c),{incomplete:!0,suggestions:c.map(u=>{const{label:m,kind:g,detail:p,documentation:C,sortText:f,filterText:S,textEdit:v,insertTextFormat:w}=u;return{label:m,kind:Zs.lspToMonacoKind(g),detail:p,documentation:C?.kind==="markdown"?C:C?.value,sortText:f,filterText:S,insertText:v.text,insertTextRules:w===2?4:w,range:Zs.lspToMonacoRange(v.range)}})})).catch(c=>(Un.error("There was an error retrieving completion items",c),{suggestions:[]}))}handleSignatureRequest(e,t,n,s){const i={value:{signatures:[],activeSignature:0,activeParameter:0},dispose:()=>{}},{model:o,session:a}=this.props;if(e!==o||!a.getSignatureHelp)return null;const r={textDocument:{uri:`${e.uri}`,version:e.getVersionId()},position:Zs.monacoToLspPosition(t),context:s},c=a.getSignatureHelp(r);return Un.debug("Requested signature help",r),c.then(u=>{Un.debug("Signatures received: ",r,c);const m=u.map(p=>{const{label:C,documentation:f,parameters:S}=p;return{documentation:f?.kind==="markdown"?f:f?.value,label:C,parameters:S??[]}});if(m.length===0)return i;const g=0;return{value:{signatures:m,activeSignature:g,activeParameter:u[g].activeParameter},dispose:()=>{}}}).catch(u=>(Un.error("There was an error retrieving completion items",u),i))}handleHoverRequest(e,t){const{model:n,session:s}=this.props;if(e!==n||!s.getHover)return null;const i={textDocument:{uri:`${e.uri}`,version:e.getVersionId()},position:Zs.monacoToLspPosition(t)},o=s.getHover(i);return Un.debug("Requested hover",i),o.then(r=>{Un.debug("Hover received: ",i,r);const{contents:c}=r;return{contents:c?[c]:[]}}).catch(r=>(Un.error("There was an error retrieving hover",r),{contents:[]}))}render(){return null}}const cu=Zs;const Hr=Z.module("ConsoleInput"),ya=parseInt(fe["line-height"],10),du=6,hu=6,tS=ya+du+hu,$r=100;class Zl extends b.PureComponent{static defaultProps={maxHeight:ya*10,scope:null,disabled:!1};static INPUT_CLASS_NAME="console-input";constructor(e){super(e),this.handleWindowResize=this.handleWindowResize.bind(this),this.commandContainer=J.createRef(),this.commandHistoryIndex=null,this.timestamp=Date.now(),this.bufferIndex=0,this.history=[],this.modifiedCommands=new Map,this.state={commandEditorHeight:ya,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&&(Hr.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:ya,lineDecorationsWidth:3,lineNumbers:"off",minimap:{enabled:!1},renderLineHighlight:"none",scrollBeyondLastLine:!1,scrollbar:{arrowSize:0,horizontal:"hidden",horizontalScrollbarSize:0},padding:{top:du,bottom:hu},tabCompletion:"on",value:"",wordWrap:"on"},s=this.commandContainer.current;N(s),this.commandEditor=Jn.create(s,n),Bt.setEOL(this.commandEditor),Bt.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();N(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===Ds.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===Ds.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(hn.CtrlCmd|Ds.KeyF,()=>{}),Bt.removeConflictingKeybindings(this.commandEditor),Bt.registerPasteHandler(this.commandEditor),this.commandEditor.focus(),this.updateDimensions(),this.setState({model:this.commandEditor.getModel()})}destroyCommandEditor(){const{session:e}=this.props;this.commandEditor&&(Bt.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();N(e);const t=e.getLineLength(1)+1,n=this.commandEditor?.getTopForPosition(1,t);N(n),this.commandEditor?.setPosition({lineNumber:1,column:t}),this.commandEditor?.setScrollTop(n),this.commandEditor?.focus()}focusEnd(){const e=this.commandEditor?.getModel();N(e);const t=e.getLineCount(),n=e.getLineLength(t)+1,s=this.commandEditor?.getTopForPosition(t,n);N(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-$r&&this.loadMoreHistory()}async loadMoreHistory(){try{if(this.loadingPromise!=null||this.bufferIndex==null)return;const{commandHistoryStorage:e,language:t,scope:n}=this.props;this.loadingPromise=we.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+$r-1}),this.loadingPromise=we.makeCancelable(s.getViewportData(),()=>s.close());const i=await this.loadingPromise;this.bufferIndex+=$r,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,we.isCanceled(e)){Hr.debug2("Promise canceled, not loading history");return}Hr.error("Error fetching history",e)}}processCommand(e){this.commandHistoryIndex=null,this.modifiedCommands.clear(),N(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;N(e);const t=this.commandEditor.getContentHeight(),n=Math.max(Math.min(t,e),tS),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:U("console-input-wrapper",{disabled:e}),children:l.jsxs("div",{className:U("console-input-inner-wrapper",{focus:i}),children:[l.jsx("div",{className:Zl.INPUT_CLASS_NAME,ref:this.commandContainer,style:{height:s}}),o&&l.jsx(cu,{model:o,language:t,session:n})]})})}}const gd=Zl;const pd="pasted values",nS=[/^audio.*/,/^font.*/,/^image.*/,/^video.*/],Vr=[".csv",".tsv",".tab",".psv",".dsv",".txt"],fd=[".zip"];class Qs 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"&&!nS.find(t=>t.test(e.type))}static isValidExtension(e,t=!1){return Vr.some(n=>e.endsWith(n))||t&&fd.some(n=>e.endsWith(n))}static handleDragOver(e){e.preventDefault(),e.stopPropagation()}static getIcon(e){return e===pd?Kc:e.endsWith(".csv")?Gg:e.endsWith(".zip")?zg:Kg}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=J.createRef(),this.divElem=J.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();N(i),Qs.isValidExtension(i.name,t)?this.handleFile(i):this.setState({dropError:Qs.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:pd,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:Kc,action:this.handleMenuPaste,shortcut:is.PASTE,disabled:e}]}getValidExtensions=pe(e=>e?[...Vr,...fd]:[...Vr]);getAcceptString=pe(e=>this.getValidExtensions(e).join(", "));getFileTypeErrorString=pe(e=>qt.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:Qs.handleDragOver,onDrop:this.handleDrop,tabIndex:-1,children:[l.jsx(oe,{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(Q,{icon:qg})}),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(Q,{icon:Qs.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:tn,tooltip:"Remove"})]})]})]}),Boolean(o)&&l.jsxs("div",{className:"message-content",children:[l.jsx("div",{className:"message-icon",children:l.jsx(Q,{icon:ks})}),l.jsx("label",{children:o}),o===Qs.FILE_TYPE_ERROR&&l.jsx("div",{className:"message-small",children:l.jsx("label",{children:this.getFileTypeErrorString(e)})})]})]})}}const Ri=Qs;class sS{static INTEGER="int";static LONG="long";static DOUBLE="double";static BOOLEAN="bool";static STRING="string";static DATE_TIME="datetime";static LOCAL_TIME="localtime"}const _e=sS,Cd="unknown",iS=2147483647,oS=-2147483648,Sd=/^[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]+)?$/,bd=/^([0-9]+T)?([0-9]+):([0-9]+)(:[0-9]+)?(?:\.[0-9]{1,9})?$/;class It{static determineType(e,t,n){if(!e||e===n)return t;switch(t){case _e.STRING:return _e.STRING;case _e.INTEGER:return It.checkInteger(e);case _e.LONG:return It.checkLong(e);case _e.DOUBLE:return It.checkDouble(e);case _e.BOOLEAN:return It.checkBoolean(e);case _e.DATE_TIME:return It.checkDateTime(e);case _e.LOCAL_TIME:return It.checkLocalTime(e);default:return It.getTypeFromUnknown(e)}}static isNotParsableNumber(e){return isNaN(e)||e==="Infinity"||e==="-Infinity"}static checkInteger(e){const t=e.replace(/,/g,"");return It.isNotParsableNumber(t)?_e.STRING:It.getNumberType(t)}static checkLong(e){const t=e.replace(/,/g,"");return It.isNotParsableNumber(t)?_e.STRING:t.includes(".")?_e.DOUBLE:_e.LONG}static checkDouble(e){const t=e.replace(/,/g,"");return It.isNotParsableNumber(t)?_e.STRING:_e.DOUBLE}static checkBoolean(e){const t=e.toLowerCase();return t==="true"||t==="false"?_e.BOOLEAN:_e.STRING}static checkDateTime(e){return Sd.test(e)?_e.DATE_TIME:_e.STRING}static checkLocalTime(e){return bd.test(e)?_e.LOCAL_TIME:_e.STRING}static getTypeFromUnknown(e){const t=e.replace(/,/g,"");if(It.isNotParsableNumber(t)){const n=e.toLowerCase();return n==="true"||n==="false"?_e.BOOLEAN:Sd.test(e)&&e.includes(":")?_e.DATE_TIME:bd.test(e)?_e.LOCAL_TIME:_e.STRING}return It.getNumberType(t)}static getNumberType(e){if(e.includes("."))return _e.DOUBLE;const t=e.startsWith("-")?11:10;if(e.length>t)return _e.LONG;const n=parseInt(e,10);return n>iS||n<oS?_e.LONG:_e.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;al.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(Cd),this.readHeaders&&(n=n.slice(1))}N(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]=It.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}.
|
|
@@ -33,11 +33,11 @@ ${e}`):n.setValue(`${e}`);const i=n.getLineCount(),o=n.getLineLength(i)+1;this.e
|
|
|
33
33
|
Check your internet connection.`;if(t&&n)return"Disconnected from server.";if(n){const{widgetName:o,widgetType:a}=this.props;return`Variable "${o}" not set.
|
|
34
34
|
${a} does not exist yet.`}if(s){const{widgetName:o}=this.props;return`${o} is unavailable.`}}getCachedRenderTabTooltip=pe((e,t,n,s,i)=>e?()=>l.jsx(xr,{glContainer:t,widgetType:n,widgetName:s,description:i}):null);handleSessionClosed(...e){const{onSessionClose:t}=this.props;this.setState({isPanelDisconnected:!0,isWaitingForReconnect:!1}),t(...e)}handleSessionOpened(...e){const{onSessionOpen:t}=this.props;t(...e)}render(){const{children:e,className:t,componentPanel:n,isLoaded:s,isLoading:i,glContainer:o,glEventHub:a,isDisconnected:r,isClonable:c,isRenamable:h,showTabTooltip:u,renderTabTooltip:m,widgetType:g,widgetName:p,description:C,onClearAllFilters:f,onHide:S,onFocus:v,onBlur:w,onResize:T,onShow:y,onTabBlur:E,onTabFocus:I,onTabClicked:D}=this.props,{isPanelDisconnected:F,isWidgetDisconnected:_,isPanelInactive:L}=this.state,B=this.getErrorMessage(),O=m??this.getCachedRenderTabTooltip(u,o,g,p,C),j=[{title:`Copy ${g} Name`,group:oe.groups.medium,order:20,action:this.handleCopyName}];return l.jsxs(as,{className:U(t,{disconnected:F||_||r,inactive:L}),componentPanel:n,glContainer:o,glEventHub:a,onClearAllFilters:f,onHide:S,onFocus:v,onBlur:w,onResize:T,onShow:y,onSessionClose:this.handleSessionClosed,onSessionOpen:this.handleSessionOpened,onTabBlur:E,onTabFocus:I,onTabClicked:D,renderTabTooltip:O,errorMessage:B,isLoaded:s,isLoading:i,isClonable:c,isRenamable:h,additionalActions:j,children:[e,L&&l.jsx("div",{className:"fill-parent-absolute"})]})}}const xc=aR,Ut=Object.freeze({DEFAULT:"DEFAULT",LINKER:"LINKER"}),rR=new Map,Rr=Object.freeze([]),Mm=(d,e)=>Gt(d,e).columns??Rr,lR=(d,e)=>Gt(d,e).filterSets??Rr,Rc=(d,e)=>Gt(d,e).filters??Rr,Ic=(d,e)=>Gt(d,e).tableMap??rR,Dc=(d,e)=>Gt(d,e).isolatedLinkerPanelId,Xi=(d,e)=>Gt(d,e).links??Rr,Fc=(d,e)=>Gt(d,e).columnSelectionValidator,cR=(d,e)=>Gt(d,e).connection,ci=(d,e)=>Gt(d,e).sessionWrapper,dR=(d,e)=>t=>t(Hn(d,{connection:e})),hR=(d,e)=>t=>t(Hn(d,{sessionWrapper:e})),Nc=(d,e)=>t=>t(Hn(d,{links:e})),uR=(d,e)=>(t,n)=>{const s=Xi(n(),d),i=e.filter(o=>s.findIndex(a=>ot(a.start,o.start)&&ot(a.end,o.end))<0);return t(Nc(d,s.concat(i)))},mR=(d,e)=>(t,n)=>{const i=Xi(n(),d).filter(o=>!e.includes(o.id));return t(Nc(d,i))},km=(d,e)=>t=>t(Hn(d,{isolatedLinkerPanelId:e})),gR=(d,e)=>t=>t(Hn(d,{columnSelectionValidator:e})),pR=(d,e)=>t=>t(Hn(d,{consoleSettings:e})),fR=(d,e)=>t=>t(Hn(d,{filterSets:e}));function Om({columnMap:d,inputFilterMap:e,linkedColumnMap:t,onAdd:n,onOpenLinker:s,waitingFilterMap:i,waitingInputMap:o}){const a=b.useMemo(()=>{const g=Array.from(o.keys()),p=g.find(S=>e.get(S)!=null),C=g.find(S=>t.get(S)!=null),f=qt.join(g.map(S=>`"${S}"`));return p!=null&&p&&C!=null&&C?`Use a filter control or linked table to set a value for ${f}`:p!=null&&p?`Set a filter control value for ${f}`:`Double click a row in a linked table to set a value for ${f}`},[e,t,o]),r=b.useMemo(()=>Array.from(d.values()),[d]),c=b.useCallback(g=>{g.stopPropagation(),g.preventDefault(),n(Array.from(i.values()))},[n,i]),h=b.useCallback(g=>{g.stopPropagation(),g.preventDefault(),s()},[s]),u=i.size>0,m=!u&&o.size>0;return l.jsx("div",{className:"chart-panel-overlay chart-filter-overlay",children:l.jsxs("div",{className:U("chart-panel-overlay-content chart-filter-overlay-content",{"chart-filter-waiting-filter":u},{"chart-filter-waiting-input":m}),children:[u&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"info-message",children:"This plot requires a filter control to be added to the layout or a table link to be created on the following columns:"}),l.jsx("div",{className:"waiting-filter-list",children:r.map(g=>{const p=i.has(g.name),C=p?ks:Ol;return l.jsxs("div",{className:U("waiting-filter-item",{"is-invalid":p}),children:[l.jsx(Q,{icon:C}),g.name]},g.name)})}),l.jsxs("div",{children:[l.jsx(Jc,{onClick:c,className:"btn-primary",children:"Add Input Filters"}),l.jsx(Jc,{onClick:h,className:"btn-primary",children:"Open Linker Tool"})]})]}),m&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"info-message",children:"Waiting for User Input"}),l.jsx("div",{className:"",children:a})]})]})})}Om.propTypes={columnMap:M.instanceOf(Map).isRequired,inputFilterMap:M.instanceOf(Map).isRequired,linkedColumnMap:M.instanceOf(Map).isRequired,onAdd:M.func.isRequired,onOpenLinker:M.func.isRequired,waitingFilterMap:M.instanceOf(Map).isRequired,waitingInputMap:M.instanceOf(Map).isRequired};function Do({columns:d,onColumnSelected:e,onMouseEnter:t,onMouseLeave:n}){return l.jsx("div",{className:"chart-panel-overlay chart-column-selector-overlay",children:l.jsxs("div",{className:U("chart-panel-overlay-content"),children:[l.jsx("div",{className:"info-message",children:"This plot requires a filter control to be added to the layout or a table link to be created on the following columns:"}),l.jsx("div",{className:"waiting-column-select-list",children:d.map(s=>l.jsx(ou,{className:U("btn-chart-column-selector",Do.makeButtonClassName(s.name)),onClick:()=>e(s.name),onMouseEnter:()=>{t&&t(s)},onMouseLeave:n,disabled:!s.isValid,isLinked:s.isActive,children:s.name},s.name))})]})})}Do.makeButtonClassName=d=>`btn-chart-column-selector-${d}`;Do.defaultProps={onMouseEnter:()=>{},onMouseLeave:()=>{}};function xa(d){return d.settings!==void 0}const Kt=Z.module("ChartPanel"),CR=150;function SR(d){return d.inputFilters!=null}function bR(d){return d.panelState!=null}class wR extends b.Component{static defaultProps={columnSelectionValidator:null,isLinkerActive:!1,source:null,sourcePanel:null,panelState:null,settings:{}};static displayName="ChartPanel";static COMPONENT="ChartPanel";constructor(e){super(e),this.handleColumnSelected=this.handleColumnSelected.bind(this),this.handleColumnMouseEnter=this.handleColumnMouseEnter.bind(this),this.handleColumnMouseLeave=this.handleColumnMouseLeave.bind(this),this.handleDisconnect=this.handleDisconnect.bind(this),this.handleReconnect=this.handleReconnect.bind(this),this.handleFilterAdd=this.handleFilterAdd.bind(this),this.handleHide=this.handleHide.bind(this),this.handleError=this.handleError.bind(this),this.handleLoadError=this.handleLoadError.bind(this),this.handleLoadSuccess=this.handleLoadSuccess.bind(this),this.handleResize=this.handleResize.bind(this),this.handleSettingsChanged=this.handleSettingsChanged.bind(this),this.handleOpenLinker=this.handleOpenLinker.bind(this),this.handleShow=this.handleShow.bind(this),this.handleSourceColumnChange=this.handleSourceColumnChange.bind(this),this.handleSourceFilterChange=this.handleSourceFilterChange.bind(this),this.handleSourceSortChange=this.handleSourceSortChange.bind(this),this.handleTabBlur=this.handleTabBlur.bind(this),this.handleTabFocus=this.handleTabFocus.bind(this),this.handleUpdate=this.handleUpdate.bind(this),this.updateModelFromSource=Xe(this.updateModelFromSource.bind(this),CR),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.panelContainer=J.createRef(),this.chart=J.createRef(),this.pending=new os;const{metadata:t,panelState:n}=e,{filterValueMap:s=[],settings:i={}}=n??{};this.state={settings:i,error:void 0,isActive:!1,isDisconnected:!1,isLoading:!1,isLoaded:!1,isLinked:t!=null&&xa(t)&&t.settings.isLinked,filterMap:new Map(s),filterValueMap:new Map(s),model:void 0,columnMap:new Map,panelState:n}}componentDidMount(){this.isHidden()||(this.setState({isActive:!0}),this.initModel())}componentDidUpdate(e,t){const{inputFilters:n,source:s}=this.props,{columnMap:i,model:o,filterMap:a,filterValueMap:r,isLinked:c,settings:h}=this.state;o&&(i!==t.columnMap&&this.pruneFilterMaps(),n!==e.inputFilters&&this.updateChangedInputFilters(n,e.inputFilters),a!==t.filterMap?this.updateFilters():r!==t.filterValueMap&&this.updatePanelState(),h!==t.settings&&kd(o)&&(o.updateSettings(h),this.updatePanelState()),c!==t.isLinked?s&&(c?(this.startListeningToSource(s),this.updateModelFromSource()):this.stopListeningToSource(s)):c&&s!==e.source&&(e.source&&this.stopListeningToSource(e.source),s&&(this.startListeningToSource(s),this.updateModelFromSource())))}componentWillUnmount(){this.pending.cancel();const{source:e}=this.props;e&&this.stopListeningToSource(e)}panelContainer;chart;pending;initModel(){this.setState({isLoading:!0,isLoaded:!1,error:void 0});const{makeModel:e}=this.props;this.pending.add(e(),t=>{t.close()}).then(this.handleLoadSuccess,this.handleLoadError)}getWaitingInputMap=pe((e,t,n)=>{if(!e)return new Map;const s=new Map(t);return n.forEach((i,o)=>{s.delete(o)}),s});getWaitingFilterMap=pe((e,t,n,s,i)=>{if(!e)return new Map;const o=new Map(t);return n.forEach((a,r)=>{o.delete(r)}),i.forEach((a,r)=>{o.delete(r)}),s.forEach((a,r)=>{o.delete(r)}),o});getInputFilterColumnMap=pe((e,t)=>{const n=new Map;for(let s=0;s<t.length;s+=1){const i=t[s],{name:o,type:a}=i,r=e.get(o);r!=null&&r.type===a&&n.set(o,i)}return n});getLinkedColumnMap=pe((e,t)=>{const n=new Map,s=q.getIdFromPanel(this);for(let i=0;i<t.length;i+=1){const o=t[i];let a=null;if(o.start!=null&&o.start.panelId===s&&e.has(o.start.columnName)?a=o.start.columnName:o.end&&o.end.panelId===s&&e.has(o.end.columnName)&&(a=o.end.columnName),a!=null&&e.has(a)){const r=e.get(a);N(r),n.set(a,r)}}return n});getSelectorColumns=pe((e,t,n)=>Array.from(e.values()).map(s=>({name:s.name,type:s.type,isValid:n?n(this,s):!1,isActive:t.has(s.name)})));startListeningToSource(e){Kt.debug("startListeningToSource",e),e.addEventListener(x.Table.EVENT_CUSTOMCOLUMNSCHANGED,this.handleSourceColumnChange),e.addEventListener(x.Table.EVENT_FILTERCHANGED,this.handleSourceFilterChange),e.addEventListener(x.Table.EVENT_SORTCHANGED,this.handleSourceSortChange)}stopListeningToSource(e){Kt.debug("stopListeningToSource",e),e.removeEventListener(x.Table.EVENT_CUSTOMCOLUMNSCHANGED,this.handleSourceColumnChange),e.removeEventListener(x.Table.EVENT_FILTERCHANGED,this.handleSourceFilterChange),e.removeEventListener(x.Table.EVENT_SORTCHANGED,this.handleSourceSortChange)}loadModelIfNecessary(){const{isActive:e,isLoaded:t,isLoading:n}=this.state;e&&!t&&!n&&this.initModel()}isHidden(){const{glContainer:e}=this.props,{isHidden:t}=e;return t}handleColumnSelected(e){const{glEventHub:t}=this.props,{columnMap:n}=this.state;t.emit(vl.COLUMN_SELECTED,this,n.get(e))}handleColumnMouseEnter({type:e,name:t}){const{columnSelectionValidator:n}=this.props;Kt.debug("handleColumnMouseEnter",n,e,t),n&&n(this,{type:e,name:t})}handleColumnMouseLeave(){const{columnSelectionValidator:e}=this.props;Kt.debug("handleColumnMouseLeave",e),e&&e(this,void 0)}handleDisconnect(){this.setState({error:new Error("Figure disconnected"),isDisconnected:!0})}handleFilterAdd(e){for(let t=0;t<e.length;t+=1)this.openInputFilter(e[t])}handleOpenLinker(){const{localDashboardId:e,setActiveTool:t,setDashboardIsolatedLinkerPanelId:n}=this.props;n(e,void 0),t(Ut.LINKER)}handleReconnect(){this.setState({isDisconnected:!1,error:void 0}),this.sendColumnChange(),this.updateColumnFilters()}handleLoadSuccess(e){Kt.debug("handleLoadSuccess");const{model:t}=this.state;this.setState({model:e,isLoaded:!0},()=>{const{inputFilters:n,source:s}=this.props,{filterMap:i,isLinked:o}=this.state;e!==t&&(this.sendColumnChange(),this.updateColumnFilters(),this.updateInputFilters(n,i.size>0||e.isFilterRequired()),s&&o&&(this.startListeningToSource(s),this.updateModelFromSource()))})}handleLoadError(e){we.isCanceled(e)||(Kt.error("handleLoadError",e),this.setState({error:e,isLoading:!1}))}handleSourceColumnChange(){this.updateModelFromSource()}handleSourceFilterChange(){this.updateModelFromSource()}handleSourceSortChange(){this.updateModelFromSource()}updateModelFromSource(){const{metadata:e,source:t}=this.props,{isLinked:n,model:s}=this.state;if(!n||!s||!t){Kt.debug2("updateModelFromSource ignoring",n,s,t);return}if(this.pending.cancel(),xa(e)){const{settings:i}=e;this.pending.add(x.plot.Figure.create(et.makeFigureSettings(i,t))).then(o=>{kd(s)&&s.setFigure(o)}).catch(this.handleLoadError)}this.updatePanelState()}updatePanelState(){const{sourcePanel:e}=this.props,{panelState:t,filterValueMap:n,settings:s}=this.state;let{tableSettings:i}=t??{};if(e&&SR(e.props)&&bR(e.state)){const{inputFilters:o}=e.props,{panelState:a}=e.state;a!=null&&(i=be.extractTableSettings(a,o))}this.setState({panelState:{settings:s,tableSettings:i,filterValueMap:Array.from(n)}})}handleError(){this.setState({isLoading:!1})}handleResize(){this.updateChart()}handleSettingsChanged(e){this.setState(({settings:t})=>{const n={...t,...e};return Kt.debug("Updated settings",n),{settings:n}})}handleHide(){this.setActive(!1)}handleShow(){this.setActive(!0)}handleTabBlur(){this.setActive(!1)}handleTabFocus(){const e=this.isHidden();this.setActive(!e)}handleUpdate(){this.setState({isLoading:!1})}handleClearAllFilters(){this.setState({filterValueMap:new Map,filterMap:new Map}),this.updatePanelState()}openInputFilter(e){const{glEventHub:t}=this.props,{name:n,type:s}=e;t.emit(Je.OPEN_INPUT,{title:`${n} Filter`,panelState:{name:n,type:s,isValueShown:!0},createNewStack:!0,focusElement:"input"})}setActive(e){this.setState({isActive:e},()=>{e&&(this.loadModelIfNecessary(),this.updateChart())})}sendColumnChange(){const{model:e}=this.state;if(!e)return;const{glEventHub:t}=this.props;t.emit(Je.COLUMNS_CHANGED,this,Array.from(e.getFilterColumnMap().values()))}getCoordinateForColumn(e){const t=Do.makeButtonClassName(e);if(!this.panelContainer.current)return null;const s=this.panelContainer.current.querySelector(`.${t}`)?.getBoundingClientRect()??null;if(s==null||s.width<=0||s.height<=0)return null;const i=s.left+s.width/2,o=s.bottom;return[i,o]}setFilterMap(e){Kt.debug("setFilterMap",e),this.setState(t=>{const{columnMap:n,filterMap:s}=t;let i=null;const o=new Map(t.filterValueMap);return e.forEach(({columnType:a,value:r},c)=>{const h=n.get(c);h==null||h.type!==a||(o.set(c,r),s.get(c)!==r&&(i===null&&(i=new Map(s)),i.set(c,r)))}),{filterValueMap:o,filterMap:i??s}})}unsetFilterValue(e){this.setState(t=>{const{inputFilters:n}=this.props,{columnMap:s}=t;let{filterMap:i,filterValueMap:o}=t;if(!o.has(e))return null;o=new Map(t.filterValueMap),o.delete(e);const a=this.getInputFilterColumnMap(s,n);if(a.has(e)){const r=i.get(e),c=a.get(e)?.value;c!=null&&r!==c&&(i=new Map(t.filterMap),c.length>0?i.set(e,c):i.delete(e))}else i=new Map(t.filterMap),i.delete(e);return{filterMap:i,filterValueMap:o}})}updateChangedInputFilters(e,t){const n=t.filter(i=>e.find(o=>o.name===i.name&&o.type===i.type)===void 0);n.length>0&&this.deleteInputFilters(n);const s=e.filter(i=>!t.includes(i));s.length>0&&this.updateInputFilters(s)}updateInputFilters(e,t=!1){this.setState(n=>{const{columnMap:s}=n,i=new Map(n.filterValueMap),o=new Map(n.filterMap),a=t?{filterMap:o,filterValueMap:i}:{};for(let r=0;r<e.length;r+=1){const{name:c,type:h,value:u}=e[r],m=s.get(c);m!=null&&m.type===h&&(u!=null&&o.get(c)!==u&&(u===""?o.delete(c):o.set(c,u),a.filterMap=o),i.has(c)&&(i.delete(c),a.filterValueMap=i))}return Kt.debug("updateInputFilters",a),a})}deleteInputFilters(e,t=!1){this.setState(n=>{const{columnMap:s,filterValueMap:i}=n,o=new Map(n.filterMap);let a=t;for(let r=0;r<e.length;r+=1){const{name:c,type:h}=e[r],u=s.get(c);if(u!=null&&u.type===h&&o.has(c)){const m=o.get(c);if(i.has(c)){const g=i.get(c);g!==m&&g!=null&&(a=!0,o.set(c,g))}else a=!0,o.delete(c)}}return Kt.debug("deleteInputFilters",a),a?{filterMap:o}:null})}updateColumnFilters(){this.setState(({model:e})=>e?{columnMap:e.getFilterColumnMap()}:null)}updateFilters(){const{columnMap:e,filterMap:t,model:n}=this.state;N(n);const s=this.getWaitingInputMap(n.isFilterRequired(),e,t);if(n.setFilter(t),t.size>0&&s.size===0){const i=n.getDefaultTitle(),o=qt.join(Array.from(t.entries()).map(([a,r])=>`${a}: ${r}`));i?n.setTitle(`${i}<br><span style="font-size: smaller">${o}</span>`):n.setTitle(o),Kt.debug2("updateFilters filters set",t),this.setState({isLoading:!0})}else Kt.debug2("updateFilters waiting on inputs",s),n.setTitle(n.getDefaultTitle()),this.setState({isLoading:!1});this.updatePanelState()}pruneFilterMaps(){this.setState(e=>{const{columnMap:t}=e,n=new Map(e.filterMap),s=new Map(e.filterValueMap),i={};return e.filterValueMap.forEach((o,a)=>{t.has(a)||(s.delete(a),i.filterValueMap=s)}),e.filterMap.forEach((o,a)=>{t.has(a)||(n.delete(a),i.filterMap=n)}),i})}updateChart(){this.chart.current&&this.chart.current.updateDimensions()}render(){const{columnSelectionValidator:e,glContainer:t,glEventHub:n,inputFilters:s,isLinkerActive:i,links:o,metadata:a,settings:r}=this.props,{columnMap:c,filterMap:h,error:u,model:m,isActive:g,isDisconnected:p,isLoaded:C,isLoading:f}=this.state;let S;xa(a)?S=a.table:S=a.figure;const v=this.getInputFilterColumnMap(c,s),w=this.getLinkedColumnMap(c,o),T=m!=null?this.getWaitingInputMap(m.isFilterRequired(),c,h):new Map,y=m!=null?this.getWaitingFilterMap(m.isFilterRequired(),c,h,w,v):new Map,E=u!=null?`Unable to open chart. ${u}`:void 0,I=T.size>0,D=c.size>0&&i;return l.jsx(xc,{className:U("iris-chart-panel",{"input-required":I}),componentPanel:this,glContainer:t,glEventHub:n,onHide:this.handleHide,onClearAllFilters:this.handleClearAllFilters,onResize:this.handleResize,onShow:this.handleShow,onTabBlur:this.handleTabBlur,onTabFocus:this.handleTabFocus,errorMessage:E,isDisconnected:p,isLoading:f,isLoaded:C,widgetName:S,widgetType:"Chart",children:l.jsxs("div",{ref:this.panelContainer,className:"chart-panel-container h-100 w-100",children:[l.jsx("div",{className:"chart-container h-100 w-100",children:C&&m&&l.jsx(cb,{isActive:g,model:m,settings:r,ref:this.chart,onDisconnect:this.handleDisconnect,onReconnect:this.handleReconnect,onUpdate:this.handleUpdate,onError:this.handleError,onSettingsChanged:this.handleSettingsChanged})}),l.jsx(bt,{in:I&&!D&&!f,timeout:qe.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:l.jsx(Om,{inputFilterMap:v,linkedColumnMap:w,onAdd:this.handleFilterAdd,onOpenLinker:this.handleOpenLinker,columnMap:c,waitingFilterMap:y,waitingInputMap:T})}),l.jsx(bt,{in:D,timeout:qe.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:l.jsx(Do,{columns:this.getSelectorColumns(c,w,e),onColumnSelected:this.handleColumnSelected,onMouseEnter:this.handleColumnMouseEnter,onMouseLeave:this.handleColumnMouseLeave})})]})})}}const vR=(d,e)=>{const{localDashboardId:t,metadata:n}=e;let s;n!=null&&(s=n.sourcePanelId);const i=Ic(d,t),o=am(d,t),a=Cr(d),r=Dc(d,t),c=a===Ut.LINKER&&r===void 0;return{columnSelectionValidator:Fc(d,t),isLinkerActive:c,inputFilters:Rc(d,t),links:Xi(d,t),source:s!=null?i.get(s):void 0,sourcePanel:s!=null?o.get(s):void 0,settings:vt(d)}},TR=wt(vR,{setActiveTool:br,setDashboardIsolatedLinkerPanelId:km},null,{forwardRef:!0})(wR),Hi=TR;const fa=Z.module("CommandHistoryPanel");class Mc extends b.Component{static COMPONENT="CommandHistoryPanel";static TITLE="Command History";static handleError(e){fa.error(e)}constructor(e){super(e),this.handleFocusHistory=this.handleFocusHistory.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleShow=this.handleShow.bind(this),this.handleSendToConsole=this.handleSendToConsole.bind(this),this.handleSendToNotebook=this.handleSendToNotebook.bind(this),this.container=J.createRef(),this.pending=new os;const{session:t,sessionId:n,language:s}=e;this.state={panelState:{},session:t,sessionId:n,language:s,contextActions:[{action:this.handleFocusHistory,shortcut:Ot.COMMAND_HISTORY.FOCUS_HISTORY}]}}componentDidMount(){const{glEventHub:e,session:t}=this.props;e.on(Qt.FOCUS_HISTORY,this.handleFocusHistory),t!=null&&this.loadTable()}componentWillUnmount(){const{glEventHub:e}=this.props;e.off(Qt.FOCUS_HISTORY,this.handleFocusHistory),this.pending.cancel()}container;pending;handleFocusHistory(){this.container.current&&this.container.current.focus()}handleShow(){this.container.current?.restoreScrollPosition()}handleSessionOpened(e,{language:t,sessionId:n}){this.setState({session:e,sessionId:n,language:t},()=>{this.loadTable()})}handleSessionClosed(){this.pending.cancel(),this.setState({session:void 0,language:void 0,table:void 0})}handleSendToNotebook(e,t=!1){const{session:n,language:s}=this.state;if(fa.debug("handleSendToNotebook",n,e),!n){fa.error("Session is not connected.");return}const{glEventHub:i}=this.props;i.emit(t?We.CREATE_NOTEBOOK:We.SEND_TO_NOTEBOOK,n,s,e)}handleSendToConsole(e,t=!0,n=!1){fa.debug("handleSendToConsole",e);const{glEventHub:s}=this.props;s.emit(Qt.SEND_COMMAND,e,t,n)}loadTable(){const{commandHistoryStorage:e}=this.props,{language:t,sessionId:n}=this.state;N(t),N(n),this.pending.add(e.getTable(t,n,Date.now()),s=>s.close()).then(s=>{this.setState({table:s})}).catch(Mc.handleError)}render(){const{glContainer:e,glEventHub:t,commandHistoryStorage:n}=this.props,{language:s,contextActions:i,table:o}=this.state;return l.jsxs(as,{className:"command-history-pane",componentPanel:this,glContainer:e,glEventHub:t,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[!o&&l.jsx("div",{className:"command-history-disconnected-message",children:"Waiting for console connection"}),o&&s!=null&&l.jsxs(l.Fragment,{children:[l.jsx(NS,{ref:this.container,language:s,sendToNotebook:this.handleSendToNotebook,sendToConsole:this.handleSendToConsole,table:o,commandHistoryStorage:n}),l.jsx(oe,{actions:i})]})]})}}const ER=(d,e)=>{const t=bu(d),n=ci(d,e.localDashboardId),{session:s,config:i}=n??{},{type:o,id:a}=i??{};return{commandHistoryStorage:t,language:o,session:s,sessionId:a}},yR=wt(ER,null,null,{forwardRef:!0})(Mc),Ya=yR;const Ca=Z.module("ConsolePanel"),xR=500,RR=Object.freeze({consoleSettings:{},itemIds:[]});class IR extends b.PureComponent{static COMPONENT="ConsolePanel";static TITLE="Console";constructor(e){super(e),this.handleFocusCommandHistory=this.handleFocusCommandHistory.bind(this),this.handleOpenObject=this.handleOpenObject.bind(this),this.handleCloseObject=this.handleCloseObject.bind(this),this.handleResize=this.handleResize.bind(this),this.handleSettingsChange=this.handleSettingsChange.bind(this),this.handleShow=this.handleShow.bind(this),this.handlePanelMount=this.handlePanelMount.bind(this),this.consoleRef=J.createRef();const{panelState:t}=e,n={...RR,...t||{}},{consoleSettings:s,itemIds:i}=n;this.state={consoleSettings:s,itemIds:new Map(i),objectMap:new Map,error:void 0,panelState:n}}componentDidMount(){const{glEventHub:e}=this.props;this.closeDisconnectedPanels(),e.on(Ee.MOUNT,this.handlePanelMount),this.subscribeToFieldUpdates()}componentDidUpdate(e,t){const{consoleSettings:n,itemIds:s}=this.state;(t.consoleSettings!==n||t.itemIds!==s)&&this.savePanelState()}componentWillUnmount(){const{glEventHub:e}=this.props;this.savePanelState.flush(),e.off(Ee.MOUNT,this.handlePanelMount),this.objectSubscriptionCleanup?.()}consoleRef;objectSubscriptionCleanup;subscribeToFieldUpdates(){const{sessionWrapper:e}=this.props,{session:t}=e;this.objectSubscriptionCleanup=t.subscribeToFieldUpdates(n=>{Ca.debug("Got updates",n),this.setState(({objectMap:s})=>{const{updated:i,created:o,removed:a}=n,r=[...i,...a],c=new Map(s);return r.forEach(u=>{const{title:m}=u;m!==void 0&&c.delete(m)}),[...i,...o].forEach(u=>{u.title!==void 0&&c.set(u.title,u)}),{objectMap:c}})})}setItemId(e,t){this.setState(({itemIds:n})=>{const s=new Map(n);return s.set(e,t),{itemIds:s}})}getItemId(e,t=!0){const{itemIds:n}=this.state;let s=n.get(e);return s==null&&t&&(s=Ae.generate(),this.setItemId(e,s)),s}handleTabFocus(){this.consoleRef.current?.focus()}handlePanelMount(e){const{itemIds:t}=this.state,n=e?.props?.id,s=e?.props?.metadata?.sourcePanelId;n&&s&&new Set(t.values()).has(s)&&this.setItemId(n,n)}handleFocusCommandHistory(){const{glEventHub:e}=this.props;e.emit(Qt.FOCUS_HISTORY)}handleResize(){this.updateDimensions()}handleShow(){this.updateDimensions()}handleOpenObject(e){const{sessionWrapper:t}=this.props,{session:n}=t;this.openWidget(e,n)}handleCloseObject(e){const{title:t}=e;if(t!==void 0){const n=this.getItemId(t,!1),{glEventHub:s}=this.props;s.emit(Ee.CLOSE,n)}}handleSettingsChange(e){const{glEventHub:t}=this.props;Ca.debug("handleSettingsChange",e),this.setState({consoleSettings:e}),t.emit(Qt.SETTINGS_CHANGED,e)}openWidget(e,t){const{glEventHub:n}=this.props,{title:s}=e;N(s);const i=this.getItemId(s),o={fetch:()=>t.getObject(e),panelId:i,widget:e};Ca.debug("openWidget",o),n.emit(Ee.OPEN,o)}addCommand(e,t=!0,n=!1){this.consoleRef.current?.addCommand(e,t,n)}closeDisconnectedPanels(e=!1){const{consoleSettings:t,itemIds:n}=this.state,{isClosePanelsOnDisconnectEnabled:s=!0}=t;if(!s&&!e)return;const i=[...n.values()],{glEventHub:o}=this.props;i.forEach(a=>{o.emit(Ee.CLOSE,a)}),this.setState({itemIds:new Map})}savePanelState=Xe(()=>{const{consoleSettings:e,itemIds:t}=this.state,n={consoleSettings:e,itemIds:[...t]};Ca.debug("Saving panel state",n),this.setState({panelState:n})},xR);updateDimensions(){this.consoleRef.current?.updateDimensions()}render(){const{commandHistoryStorage:e,glContainer:t,glEventHub:n,sessionWrapper:s,timeZone:i,unzip:o}=this.props,{consoleSettings:a,error:r,objectMap:c}=this.state,{config:h,session:u,connection:m,details:g={}}=s,{workerName:p,processInfoId:C}=g,{id:f,type:S}=h;return l.jsx(as,{className:"iris-panel-console",componentPanel:this,glContainer:t,glEventHub:n,onResize:this.handleResize,onShow:this.handleShow,onTabFocus:this.handleTabFocus,errorMessage:r!=null?`${r}`:void 0,children:u!=null&&l.jsx(fS,{ref:this.consoleRef,settings:a,session:u,focusCommandHistory:this.handleFocusCommandHistory,openObject:this.handleOpenObject,closeObject:this.handleCloseObject,commandHistoryStorage:e,onSettingsChange:this.handleSettingsChange,language:S,statusBarChildren:l.jsxs(l.Fragment,{children:[l.jsx("div",{children:" "}),l.jsx("div",{children:ru.LANGUAGE_MAP.get(S)}),p!=null&&l.jsxs(l.Fragment,{children:[l.jsx("div",{children:" • "}),p]}),C!=null&&l.jsxs(l.Fragment,{children:[l.jsx("div",{children:" • "}),C,l.jsx("div",{children:" •"})]}),l.jsx("div",{children:" "}),l.jsx("div",{children:l.jsx(hb,{connection:m,defaultUpdateInterval:10*1e3,hoverUpdateInterval:3*1e3,monitorDuration:10*60*1e3})}),l.jsx("div",{children:" "})]}),scope:f,timeZone:i,objectMap:c,unzip:o})})}}const DR=(d,e)=>({commandHistoryStorage:bu(d),sessionWrapper:ci(d,e.localDashboardId),timeZone:Ao(d)}),FR=wt(DR,null,null,{forwardRef:!0})(IR),ki=FR;const Sa=Z.module("DropdownFilter"),NR=150;class vo extends b.Component{static defaultProps={column:null,disableLinking:!1,isLinkerActive:!1,isLoaded:!1,isValueShown:!1,settingsError:null,source:null,value:"",values:[],onColumnSelected:()=>{},onSourceMouseEnter:()=>{},onSourceMouseLeave:()=>{}};static PLACEHOLDER="Select a value...";static SOURCE_BUTTON_CLASS_NAME="btn-dropdown-filter-selector";static SOURCE_BUTTON_PLACEHOLDER="Select a column";constructor(e){super(e),this.handleColumnChange=this.handleColumnChange.bind(this),this.handleSettingsCancel=this.handleSettingsCancel.bind(this),this.handleSettingsClick=this.handleSettingsClick.bind(this),this.handleSettingsSave=this.handleSettingsSave.bind(this),this.handleBackgroundClick=this.handleBackgroundClick.bind(this),this.handleDropdownKeyPress=this.handleDropdownKeyPress.bind(this),this.handleValueChange=this.handleValueChange.bind(this),this.dropdownRef=J.createRef();const{column:t,isValueShown:n,value:s}=e;this.state={column:t,id:Ae(),selectedColumn:t,disableCancel:!n,isValueShown:n,value:s}}componentDidUpdate(e,t){const{source:n,values:s,isLoaded:i}=this.props,{column:o,value:a,isValueShown:r}=this.state;i&&(n!==e.source&&this.sourceUpdated(),s!==e.values&&a!==""&&!s.includes(a)&&this.resetValue(),r!==t.isValueShown&&r&&this.focusInput(),(o!==t.column||a!==t.value||r!==t.isValueShown)&&this.sendUpdate())}componentWillUnmount(){this.sendUpdate.flush()}dropdownRef;getCompatibleColumns=pe((e,t)=>e!=null?t.filter(({type:n})=>n!==void 0&&R.isCompatibleType(n,e.columnType)):[]);getColumnOptions=pe((e,t)=>{let n=-1;const s=[];return s.push(l.jsx("option",{value:"-1",children:"Select a column"},"placeholder")),e.forEach((i,o)=>{s.push(l.jsx("option",{value:o,children:this.getItemLabel(e,o)},`${i.name}/${i.type}`)),t!==null&&i.name===t.name&&i.type===t.type&&(n=o)}),[s,n]});getSelectedOptionIndex=pe((e,t)=>e.indexOf(t));getValueOptions=pe(e=>[l.jsx("option",{value:"-1",children:vo.PLACEHOLDER},"-1"),...e.map((t,n)=>l.jsx("option",{value:n,children:t??"(null)"},`${n}/${t}`))]);getItemLabel=me((e,t)=>{const{name:n,type:s}=e[t];if(t>0&&e[t-1].name===n||t<e.length-1&&e[t+1].name===n){const i=s.substring(s.lastIndexOf(".")+1);return`${n} (${i})`}return n});handleColumnChange(e){const{value:t}=e.target;if(Sa.debug2("handleColumnChange",t),t!=null&&parseInt(t,10)<0){this.setState({selectedColumn:null});return}const{columns:n,source:s}=this.props,i=this.getCompatibleColumns(s,n);this.setState({selectedColumn:i[parseInt(t,10)]})}handleDropdownKeyPress(e){e.key==="Enter"&&(e.preventDefault(),e.stopPropagation(),Sa.debug2("handleDropdownKeyPress"),this.sendUpdate(),this.sendUpdate.flush())}handleValueChange(e){const{value:t}=e.target,n=parseInt(t,10);let s="";const{values:i}=this.props;n>=0&&n<i.length?s=i[n]:Sa.debug2("Selected default item"),Sa.debug2("handleValueChange",s),this.setState({value:s})}handleSettingsCancel(){this.setState(({column:e})=>({selectedColumn:e,isValueShown:!0}))}handleSettingsSave(){this.setState(({column:e,selectedColumn:t,value:n})=>({column:t,value:e===t?n:"",isValueShown:!0,disableCancel:!1}))}handleSettingsClick(e){e.stopPropagation(),this.showSettings()}handleBackgroundClick(e){e.target!==this.dropdownRef.current&&this.focusInput()}sourceUpdated(){this.setState({column:null,selectedColumn:null,isValueShown:!1,disableCancel:!0,value:""})}showSettings(){const{column:e}=this.state;this.setState({selectedColumn:e,isValueShown:!1})}focusInput(){this.dropdownRef.current?.focus()}resetValue(){this.setState({value:""})}clearFilter(){this.resetValue()}setFilterState({name:e,type:t,value:n,isValueShown:s}){const i=e!=null&&t!=null?{name:e,type:t}:null;this.setState(({value:o,isValueShown:a})=>({column:i,value:n??o,isValueShown:s??a}))}sendUpdate=Xe(()=>{const{onChange:e}=this.props,{column:t,value:n,isValueShown:s}=this.state;e({column:t,isValueShown:s,value:n??void 0})},NR);render(){const{columns:e,disableLinking:t,isLinkerActive:n,isLoaded:s,source:i,onColumnSelected:o,onSourceMouseEnter:a,onSourceMouseLeave:r,values:c,settingsError:h}=this.props,{column:u,disableCancel:m,id:g,isValueShown:p,selectedColumn:C,value:f}=this.state,S=i===null,v=this.getCompatibleColumns(i,e),w=i!=null,T=i?.columnName??vo.SOURCE_BUTTON_PLACEHOLDER,y=u!=null?`${u.name} Filter`:null,[E,I]=this.getColumnOptions(v,C),D=this.getValueOptions(c),F=this.getSelectedOptionIndex(c,f),_=!w||C==null,L=p&&!n,B=`source-column-btn-${g}`,O=`filter-column-select-${g}`;return l.jsxs($l,{className:"dropdown-filter fill-parent-absolute",isFlipped:L,children:[l.jsx("div",{className:"dropdown-filter-settings-card",children:l.jsxs("div",{className:"dropdown-filter-card-content",children:[l.jsxs("div",{className:"dropdown-filter-settings-grid",children:[l.jsx("label",{htmlFor:B,children:"Source Column"}),l.jsx(ou,{id:B,isLinked:w,onClick:o,onMouseEnter:a,onMouseLeave:r,className:vo.SOURCE_BUTTON_CLASS_NAME,disabled:t,children:T}),l.jsx("div",{className:"text-muted small",children:"Select a source column for the list by linking to a table."}),l.jsx("label",{htmlFor:O,children:"Filter Column"}),l.jsx("select",{id:O,value:I,className:"custom-select",onChange:this.handleColumnChange,disabled:S,children:E}),l.jsx("div",{className:"text-muted small",children:"Dropdown filter control will apply its filter to all columns matching this name in this dashboard."})]}),h&&l.jsx("div",{className:"error-message text-center",children:h}),w&&l.jsxs("div",{className:"dropdown-filter-settings-buttons",children:[l.jsx(V,{kind:"secondary",type:"button",onClick:this.handleSettingsCancel,disabled:m||p||n,tooltip:n?"Cancel disabled while linker open":void 0,children:"Cancel"}),l.jsx(V,{kind:"primary",type:"button",className:"ml-2",onClick:this.handleSettingsSave,disabled:_||p||n,tooltip:n?"Save disabled while linker open":void 0,children:"Save"})]})]})}),l.jsx("div",{className:"dropdown-filter-value-card",onClick:this.handleBackgroundClick,"data-testid":"dropdown-filter-value-background",children:s&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"dropdown-filter-column",children:l.jsx("div",{className:"dropdown-filter-column-title",children:y})}),l.jsxs("div",{className:"dropdown-filter-card-content",children:[l.jsx("div",{className:"dropdown-filter-value-input d-flex flex-column justify-content-center",children:l.jsx("select",{className:"custom-select",value:F,ref:this.dropdownRef,onChange:this.handleValueChange,onKeyPress:this.handleDropdownKeyPress,title:"Select Value",children:D})}),h&&l.jsx("div",{className:"error-message mt-3 text-center",children:h})]}),l.jsx("div",{className:"dropdown-filter-menu",children:l.jsx(V,{kind:"ghost",className:"m-2 px-2",onClick:this.handleSettingsClick,icon:l.jsx(Q,{icon:ko,transform:"grow-4"}),tooltip:"Dropdown Filter Settings"})})]})})]})}}const ah=vo;const st=Z.module("DropdownFilterPanel"),MR=250,kR=(d,e)=>{const{localDashboardId:t}=e,n=q.getIdFromPanel({props:e}),s=Ic(d,t),i=Xi(d,t),o=Cr(d),a=Dc(d,t),r=o===Ut.LINKER&&(a===void 0||a===n),c=o===Ut.LINKER&&a!==void 0&&a!==n;return{columns:Mm(d,t),columnSelectionValidator:Fc(d,t),isLinkerActive:r,disableLinking:c,settings:vt(d),panelTableMap:s,dashboardLinks:i}},OR=wt(kR,null,null,{forwardRef:!0});class Is extends b.Component{static displayName="DropdownFilterPanel";static COMPONENT="DropdownFilterPanel";static MAX_TABLE_SIZE=256;static DATETIME_FORMATTER=new He({showTimeZone:!1,showTSeparator:!0,defaultDateTimeFormatString:"yyyy-MM-dd HH:mm:ss.SSSSSSSSS"});static SOURCE_COLUMN=Object.freeze({name:"FilterSource",type:null});constructor(e){super(e),this.handleChange=Xe(this.handleChange.bind(this),MR),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.handleDisconnect=this.handleDisconnect.bind(this),this.handleReconnect=this.handleReconnect.bind(this),this.handleColumnSelected=this.handleColumnSelected.bind(this),this.handleSourceFilterChange=this.handleSourceFilterChange.bind(this),this.handleSourceSortChange=this.handleSourceSortChange.bind(this),this.handleSourceSizeChange=this.handleSourceSizeChange.bind(this),this.handleSourceMouseEnter=this.handleSourceMouseEnter.bind(this),this.handleSourceMouseLeave=this.handleSourceMouseLeave.bind(this),this.handleValuesTableUpdate=this.handleValuesTableUpdate.bind(this),this.dropdownFilterRef=J.createRef(),this.panelContainer=J.createRef(),this.pending=new os;const{panelState:t,settings:n}=e;this.columnFormats=ss.getColumnFormats(n);const{value:s="",isValueShown:i=!1,name:o,type:a,timestamp:r}=t??{},c=o!=null&&a!=null?{name:o,type:a}:void 0;this.state={column:c,formatter:new en(this.columnFormats),valuesTable:void 0,valuesColumn:void 0,sourceSize:0,value:s,timestamp:r,values:[],isValueShown:i,wasFlipped:!1,skipUpdate:!1,panelState:t,isDisconnected:!1,isLoading:!1,isLoaded:!1,error:null}}componentDidMount(){this.updateValuesTable();const{dashboardLinks:e,panelTableMap:t}=this.props,{column:n,value:s,timestamp:i}=this.state,o=this.getSourceTable(t,e);if(o!==null&&this.startListeningToSource(o),n!=null){const{name:a,type:r}=n;this.sendUpdate(a,r,s,i)}}componentDidUpdate(e,t){const{dashboardLinks:n,panelTableMap:s,settings:i}=this.props,{valuesTable:o}=this.state,a=this.getSource(n),r=this.getSourceTable(s,n),c=this.getSource(e.dashboardLinks),h=this.getSourceTable(e.panelTableMap,e.dashboardLinks);i!==e.settings&&i!==void 0&&this.updateFormatterSettings(i),o!==t.valuesTable&&t.valuesTable!=null&&(st.debug("Table in state modified, closing the old table."),t.valuesTable.close()),(r!==h||a!==c)&&this.updateValuesTable(),r!==h&&(h!==null&&this.stopListeningToSource(h),r!==null&&this.startListeningToSource(r))}componentWillUnmount(){const{dashboardLinks:e,panelTableMap:t}=this.props,{valuesTable:n}=this.state,s=this.getSourceTable(t,e);this.pending.cancel(),s!==null&&this.stopListeningToSource(s),this.cleanup&&this.cleanup(),n?.close()}dropdownFilterRef;panelContainer;pending;cleanup;columnFormats;getCachedValues=me((e,{type:t,name:n},s)=>t!==void 0&&R.isDateType(t)?e.map(i=>Is.DATETIME_FORMATTER.format(i)):e.map(i=>i!=null&&t!=null?s.getFormattedString(i,t,n):null));getCoordinateForColumn(){if(this.panelContainer.current==null)return null;const t=this.panelContainer.current.querySelector(`.${ah.SOURCE_BUTTON_CLASS_NAME}`)?.getBoundingClientRect()??null;if(t==null||t.width<=0||t.height<=0)return null;const n=t.left+t.width/2,s=t.bottom;return[n,s]}getSettingsErrorMessage(){const{sourceSize:e}=this.state;if(e>Is.MAX_TABLE_SIZE)return`Table too large, must have fewer than ${Is.MAX_TABLE_SIZE} options.`}getPanelErrorMessage(){const{error:e}=this.state;return e!=null?`${e}`:void 0}getCachedPanelLinks=me((e,t)=>{const n=q.getIdFromPanel(t);return st.debug("getCachedPanelLinks",e,n),e.filter(s=>s.end?.panelId===n)});getCachedSource=me(e=>{st.debug("getCachedSource",e);let t;if(e.length>0){const[n]=e;t=n.start,e.length>1&&st.error("Filter has more that one link",e)}return t});getCachedSourceTable=me((e,t)=>{if(st.debug("getCachedSourceTable",e,t),t==null)return null;const{panelId:n}=t;return e.get(n)??null});getCachedSourceColumn=me((e,t)=>(st.debug("getCachedSourceColumn",e,t),e==null||t==null?null:e.columns.find(({name:n,type:s})=>n===t.columnName&&s===t.columnType)??null));getSource(e){const t=this.getCachedPanelLinks(e,this);return this.getCachedSource(t)}getSourceTable(e,t){const n=this.getSource(t);return this.getCachedSourceTable(e,n)}getValuesColumn(e,t){const n=this.getSource(t);return this.getCachedSourceColumn(e,n)}startListeningToSource(e){st.debug("startListeningToSource"),e.addEventListener(x.Table.EVENT_FILTERCHANGED,this.handleSourceFilterChange),e.addEventListener(x.Table.EVENT_SORTCHANGED,this.handleSourceSortChange),e.addEventListener(x.Table.EVENT_SIZECHANGED,this.handleSourceSizeChange),e.addEventListener(x.Table.EVENT_DISCONNECT,this.handleDisconnect),e.addEventListener(x.Table.EVENT_RECONNECT,this.handleReconnect)}stopListeningToSource(e){st.debug("stopListeningToSource"),e.removeEventListener(x.Table.EVENT_FILTERCHANGED,this.handleSourceFilterChange),e.removeEventListener(x.Table.EVENT_SORTCHANGED,this.handleSourceSortChange),e.removeEventListener(x.Table.EVENT_SIZECHANGED,this.handleSourceSizeChange),e.removeEventListener(x.Table.EVENT_DISCONNECT,this.handleDisconnect),e.removeEventListener(x.Table.EVENT_RECONNECT,this.handleReconnect)}handleChange({column:e,isValueShown:t=!1,value:n}){const{name:s=void 0,type:i=void 0}=e??{};let o=!0,a=Date.now();this.setState(({panelState:r,timestamp:c,wasFlipped:h,skipUpdate:u})=>{const m=r!=null&&t!==r.isValueShown&&s===r.name&&i===r.type&&n===r.value;return o=(!u&&t&&(!m||!h))??!1,o||(a=c),{panelState:{isValueShown:t,name:s,type:i,value:n,timestamp:a??void 0},timestamp:a,wasFlipped:m,skipUpdate:!1}},()=>{o&&this.sendUpdate(s??null,i,n,a)})}handleDisconnect(){this.setState({error:new Error("Table disconnected"),isDisconnected:!0,isLoading:!1})}handleReconnect(){this.setState({isDisconnected:!1,error:null})}handleSourceFilterChange(){this.applySourceFilters()}handleSourceSortChange(){this.applySourceSorts()}handleSourceSizeChange({detail:e}){this.setState({sourceSize:e})}handleColumnSelected(){st.debug("handleColumnSelected");const{glEventHub:e}=this.props;e.emit(Je.COLUMN_SELECTED,this,Is.SOURCE_COLUMN)}handleClearAllFilters(){this.dropdownFilterRef?.current?.clearFilter()}setPanelState(e,t=!1){const{dashboardLinks:n}=this.props;if(this.getSource(n)==null){st.debug("Ignore state update for unlinked filter",e);return}this.setState({skipUpdate:!t}),this.dropdownFilterRef?.current?.setFilterState(e)}sendUpdate(e,t,n,s){const{dashboardLinks:i,glEventHub:o}=this.props,a=this.getSource(i)?.panelId,r=a===null?[]:[a];st.debug("sendUpdate",{name:e,type:t,value:n,timestamp:s,excludePanelIds:r}),o.emit(Je.FILTERS_CHANGED,this,{name:e,type:t,value:n??"=null",timestamp:s,excludePanelIds:r})}updateValuesTable(){const{dashboardLinks:e,panelTableMap:t}=this.props,n=this.getSource(e),s=this.getSourceTable(t,e);if(st.debug("updateValuesTable",n,s),this.setState({values:[],valuesTable:void 0,error:null}),n==null){st.debug("Filter unlinked."),this.setState({isLoading:!1,isLoaded:!0,isValueShown:!1,sourceSize:0});return}this.setState({isLoading:!0}),s!=null&&(this.setState({isLoaded:!1,sourceSize:s.size}),this.pending.add(s.copy(),i=>i.close()).then(i=>{this.updateViewportListener(i),this.setState({valuesTable:i})}).catch(i=>{we.isCanceled(i)||(st.error(i),this.setState({isLoading:!1,error:i}))}))}applySourceSorts(){const{dashboardLinks:e,panelTableMap:t}=this.props,{valuesTable:n}=this.state,s=this.getSourceTable(t,e);if(st.debug("applySourceSorts",s?.sort),n==null||s==null){st.debug("Table not initialized");return}const i=[...s.sort];n.applySort(i),this.setViewport(n)}applySourceFilters(){const{dashboardLinks:e,panelTableMap:t}=this.props,{valuesTable:n}=this.state,s=this.getSourceTable(t,e);if(st.debug("applySourceFilters",s?.filter),n==null||s==null){st.debug("Table not initialized");return}const i=[...s.filter];n.applyFilter(i),this.setViewport(n)}updateViewportListener(e){if(st.debug("updateViewportListener",e?.size),this.cleanup&&this.cleanup(),e==null){this.cleanup=void 0;return}this.cleanup=e.addEventListener(x.Table.EVENT_UPDATED,this.handleValuesTableUpdate),this.setViewport(e)}setViewport(e){const{dashboardLinks:t}=this.props,n=this.getValuesColumn(e,t);if(!n){st.error("values column is null");return}e.setViewport(0,Is.MAX_TABLE_SIZE-1,[n])}updateFormatterSettings(e){const t=ss.getColumnFormats(e);ot(this.columnFormats,t)||(this.columnFormats=t,this.setState({formatter:new en(t)}))}handleValuesTableUpdate({detail:e}){const{rows:t}=e,{dashboardLinks:n}=this.props,{valuesTable:s}=this.state;if(!s){st.error("valuesTable is null");return}const i=this.getValuesColumn(s,n);if(!i){st.error("Values column not found");return}const o=t.map(a=>a.get(i));this.setState({values:o,isLoading:!1,isLoaded:!0,valuesColumn:i})}handleSourceMouseEnter(){const{columnSelectionValidator:e}=this.props;e&&e(this,Is.SOURCE_COLUMN)}handleSourceMouseLeave(){const{columnSelectionValidator:e}=this.props;e&&e(this,void 0)}render(){const{columns:e,dashboardLinks:t,disableLinking:n,glContainer:s,glEventHub:i,isLinkerActive:o}=this.props,{column:a,formatter:r,isDisconnected:c,isValueShown:h,value:u,values:m,valuesColumn:g,isLoading:p,isLoaded:C}=this.state,f=this.getSource(t),S=this.getSettingsErrorMessage(),v=this.getPanelErrorMessage(),w=C&&g!=null?this.getCachedValues(m,g,r):[];return l.jsx(xc,{errorMessage:v,isLoading:p,isLoaded:C,isDisconnected:c,className:"iris-dropdown-filter-panel",componentPanel:this,glContainer:s,glEventHub:i,onClearAllFilters:this.handleClearAllFilters,widgetName:"Dropdown Filter",widgetType:"DropdownFilter",children:l.jsx("div",{ref:this.panelContainer,className:"dropdown-filter-container h-100 w-100 container",children:l.jsx(ah,{ref:this.dropdownFilterRef,column:a,columns:e,isValueShown:h,isLinkerActive:o,disableLinking:n,isLoaded:C,settingsError:S,source:f,value:u,values:w,onChange:this.handleChange,onColumnSelected:this.handleColumnSelected,onSourceMouseEnter:this.handleSourceMouseEnter,onSourceMouseLeave:this.handleSourceMouseLeave})})})}}const AR=OR(Is),ai=AR;function _n(d){return d.type==="directory"}var Am=(d=>(d.GROOVY="text/x-groovy",d.PLAIN_TEXT="text/plain",d.PYTHON="text/x-python",d.PYTHON_COMPILED="application/x-python-code",d.SCALA="text/x-scala",d.UNKNOWN="",d))(Am||{});class ei{static fileExtensionToString(e=""){return e.length===0?"":`.${e}`}static getDepth(e){if(!ei.hasPath(e))throw new Error(`Invalid path provided: ${e}`);return(e.match(/\//g)??[]).length-1}static getExtension(e){const t=this.getBaseName(e).split(".");return t.length>1?t.pop()??"":""}static getBaseName(e){return e.split("/").pop()??""}static getCopyFileName(e){const t=e.lastIndexOf(".");let n=null,s=null;t<0?s=e:(s=e.substring(0,t),n=e.substring(t+1));const i=s?`${s}-copy`:"Copy";return n!==null?`${i}.${n}`:i}static getMimeType(e){switch(this.getExtension(e).toLowerCase()){case"groovy":return"text/x-groovy";case"py":return"text/x-python";case"pyc":return"application/x-python-code";case"scala":return"text/x-scala";case"txt":return"text/plain";default:return""}}static getParent(e){if(!ei.hasPath(e))throw new Error(`Invalid name provided: ${e}`);const t=e.split("/");for(;t.pop()==="";);if(t.length===0)throw new Error(`No parent for path provided: ${e}`);return`${t.join("/")}/`}static getPath(e){if(!ei.hasPath(e))throw new Error(`Invalid filename provided: ${e}`);const t=e.split("/");return t.pop(),`${t.join("/")}/`}static hasPath(e){return e.startsWith("/")}static isPath(e){return e.startsWith("/")&&e.endsWith("/")}static makePath(e){return e.endsWith("/")?e:`${e}/`}static replaceExtension(e,t=""){const n=e.lastIndexOf("."),s=n>-1?e.substring(0,n):e,i=ei.fileExtensionToString(t);return`${s}${i}`}static validateName(e){const t=[".",".."],n=/[\\/\0]/g,s=new Map([["\0","null"]]);if(!e)throw new _i("Name cannot be empty");if(t.includes(e))throw new _i(`"${e}" is a reserved name`);if(n.test(e))throw new _i(`Invalid characters in name: "${e.match(n)?.reduce((i,o)=>i.includes(o)?i:[...i,o],[]).map(i=>s.has(i)?s.get(i):i).join('", "')??""}"`)}static reducePaths(e){const t=e.filter(n=>ei.isPath(n));return e.filter(n=>!t.some(s=>n!==s&&n.startsWith(s)))}static removeRoot(e,t){if(e.length===0)return t;if(!t.startsWith(e))throw new Error(`Filename ${t} does not start with expected root ${e}`);return t.substring(e.length)}static addRoot(e,t){return`${e}${t}`}}const Ce=ei,kc=26;function Tl(d){return _n(d)?Ce.makePath(d.filename):Ce.getPath(d.filename)}function rh(d,e){if(d.length===0||e==null)throw new Error("No items to move");const t=Tl(e);if(d.some(({filename:n})=>Ce.getPath(n)===t))throw new Error("File already in the destination folder");if(d.some(n=>_n(n)&&t.startsWith(Ce.makePath(n.filename))))throw new Error("Destination folder cannot be a child of a dragged folder");return{files:d,targetPath:t}}function LR(d){if(_n(d))return d.isExpanded?Dp:Fp;switch(Ce.getMimeType(d.basename)){case Am.PYTHON:return Mp;default:return Np}}function El(d){const{children:e,draggedItems:t,isDragInProgress:n,isDropTargetValid:s,isSelected:i,item:o,itemIndex:a,dropTargetItem:r,onDragStart:c,onDragOver:h,onDragEnd:u,onDrop:m}=d,g=t?.some(E=>E.id===o.id)??!1,p=Tl(o),C=n&&r?Tl(r):null,f=n&&s&&_n(o)&&C===p,S=n&&s&&C===p,v=n&&!s&&C===p,w=LR(o),T=Ce.getDepth(o.filename),y=Array(T).fill(null).map((E,I)=>l.jsx("span",{className:"file-list-depth-line"},I));return l.jsxs("div",{className:U("d-flex w-100 align-items-center","file-list-item",{"is-dragged":g,"is-exact-drop-target":f,"is-in-drop-target":S,"is-invalid-drop-target":v,"is-selected":i}),onDragStart:E=>c(a,E),onDragOver:E=>h(a,E),onDragEnd:E=>u(a,E),onDrop:E=>m(a,E),draggable:!0,role:"presentation","aria-label":o.basename,children:[y," ",l.jsx(Q,{icon:w,className:"item-icon",fixedWidth:!0})," ",l.jsxs("span",{className:"truncation-wrapper",children:[e??o.basename,l.jsx(tt,{options:{placement:"left"},children:e??o.basename})]})]})}const Mt=Z.module("FileList"),PR=500,lh="item-list-scroll-pane";function _R(d){const{isMultiSelect:e=!1,table:t,onFocusChange:n=()=>{},onMove:s,onSelect:i,onSelectionChange:o=()=>{},renderItem:a=El,rowHeight:r=kc,overscanCount:c=Wt.DEFAULT_OVERSCAN}=d,[h,u]=b.useState(()=>({items:[],offset:0,itemCount:0})),[m,g]=b.useState({top:0,bottom:0}),[p,C]=b.useState(),[f,S]=b.useState(),[v,w]=b.useState(),[T,y]=b.useState([]),E=b.useRef(null),I=b.useRef(null),D=b.useCallback(X=>{if(X.length===0||h==null)return[];const re=[];for(let ve=0;ve<X.length;ve+=1){const De=X[ve];for(let Re=De[0];Re<=De[1];Re+=1)Re>=h.offset&&Re<h.offset+h.items.length&&re.push(h.items[Re-h.offset])}return re},[h]),F=b.useCallback(X=>{const re=D([[X,X]]);if(re.length>0)return re[0]},[D]),_=b.useCallback(()=>{const X=On.count(T);if(X===0)return null;if(X===1){const re=T[0][0],ve=F(re);if(ve!=null)return ve.filename}return`${X} items`},[F,T]),L=b.useCallback(X=>{if(!(!f||!p)){Mt.debug("dropItems",f,"to",X);try{const{files:re,targetPath:ve}=rh(f,p);s?.(re,ve),X!=null&&(y([[X,X]]),E.current?.focusItem(X))}catch(re){Mt.error("Unable to complete move",re)}}},[f,p,s]),B=b.useCallback((X,re)=>{const ve=h.items[X-h.offset];ve!==void 0&&(Mt.debug("handleItemClick",ve),i(ve,re),_n(ve)&&t?.setExpanded(ve.filename,!ve.isExpanded))},[h,i,t]),O=b.useCallback((X,re)=>{Mt.debug2("handleItemDragStart",X,T);let ve=T;On.isSelected(T,X)||(ve=[[X,X]],y(ve)),S(D(ve)),E.current?.resetMouseState();const De=document.createElement("div");De.innerHTML=`<div class="dnd-placeholder-content">${_()}</div>`,De.className="file-list-dnd-placeholder",document.body.appendChild(De),re.dataTransfer.setDragImage(De,0,0),re.dataTransfer.effectAllowed="move",w(De)},[_,D,T]),j=b.useCallback((X,re)=>{re.preventDefault(),Mt.debug2("handleItemDragOver",re),C(F(X))},[F]),k=b.useCallback((X,re)=>{Mt.debug("handleItemDragEnd",X),v?.remove(),S(void 0),C(void 0),w(void 0)},[v]),A=b.useCallback((X,re)=>{L(X)},[L]),H=b.useCallback(()=>{Mt.debug2("handleItemDragExit"),C(void 0)},[]),z=b.useCallback(X=>{X.target instanceof Element&&X.target.classList.contains(lh)&&(X.preventDefault(),Mt.debug2("handleListDragOver",X),C({type:"directory",filename:"/",basename:"/",id:"/"}))},[]),K=b.useCallback(X=>{X.target instanceof Element&&X.target.classList.contains(lh)&&(Mt.debug("handleListDrop"),L())},[L]),ae=b.useCallback(X=>{if(Mt.debug2("handleSelectionChange",X),X!==T){y(X);const re=D(X);o(re)}},[D,o,T]),W=b.useCallback(X=>{if(Mt.debug2("handleFocusChange",X),X!=null){const[re]=D([[X,X]]);n(re)}else n()},[D,n]),G=b.useCallback((X,re)=>{Mt.debug("handleViewportChange",X,re),(X!==m.top||re!==m.bottom)&&g({top:X,bottom:re})},[m]),te=b.useMemo(()=>{if(!f||!p)return!1;try{return rh(f,p),Mt.debug("handleValidateDropTarget true"),!0}catch{return Mt.debug("handleValidateDropTarget false"),!1}},[f,p]),{focusedPath:ie}=d;b.useEffect(()=>{ie!==void 0&&(ie==="/"?t.collapseAll():(t.setExpanded(ie,!1),t.setExpanded(ie,!0)))},[t,ie]),b.useEffect(function(){Mt.debug("updating table viewport",m),t?.setViewport({top:Math.max(0,m.top-c),bottom:m.bottom+c})},[c,t,m]),b.useEffect(function(){const re=t.onUpdate(ve=>{u({items:ve.items.map(De=>({...De,itemName:De.basename})),offset:ve.offset,itemCount:t.size})});return()=>{re()}},[t]),b.useEffect(function(){if(p!=null&&_n(p)&&p.filename!=="/"){const re=setTimeout(()=>{p.isExpanded||t?.setExpanded(p.filename,!0)},PR);return()=>clearTimeout(re)}},[p,t]);const ce=b.useCallback(X=>a({...X,isDragInProgress:f!=null,dropTargetItem:p,draggedItems:f,isDropTargetValid:te,onDragStart:O,onDragEnd:k,onDragOver:j,onDragExit:H,onDrop:A}),[k,H,j,O,A,f,p,te,a]);return l.jsx("div",{ref:I,className:U("file-list",{"is-dragging":f!=null}),onDragOver:z,onDrop:K,children:l.jsx(Wt,{ref:E,items:h.items,itemCount:h.itemCount,offset:h.offset,onFocusChange:W,onSelect:B,onSelectionChange:ae,onViewportChange:G,selectedRanges:T,renderItem:ce,rowHeight:r,isMultiSelect:e,isDragSelect:!1,isDeselectOnClick:!1})})}const jR={name:"File Explorer",DELETE:Me.createAndAdd({id:"FILE_EXPLORER.DELETE",name:"Delete",shortcut:[he.DELETE],macShortcut:[de.CMD,he.BACKSPACE]}),RENAME:Me.createAndAdd({id:"FILE_EXPLORER.RENAME",name:"Rename",shortcut:[he.ENTER],macShortcut:[he.ENTER]})},ch={FILE_EXPLORER:jR};const hh=Z.module("FileListItemEditor"),HR=()=>Promise.resolve();function $R({item:d,onCancel:e,onSubmit:t,validate:n=HR}){const s=b.useRef(null),[i,o]=b.useState(d.basename),[a,r]=b.useState(),[c,h]=b.useState(Promise.resolve()),u=b.useCallback(()=>{s.current?.focus()},[s]),m=b.useCallback(S=>S.stopPropagation(),[]),g=b.useCallback(()=>{c.then(()=>{t(i)}).catch(S=>hh.info("Unable to validate name",S))},[t,i,c]);b.useEffect(function(){const v=we.makeCancelable(n(i));return v.then(()=>r(void 0)).catch(w=>{we.isCanceled(w)||r(w)}),h(v),()=>v.cancel()},[n,i]),b.useEffect(function(){u()},[u]);const p=b.useCallback(()=>{hh.debug2("handleBlur"),g()},[g]),C=b.useCallback(S=>{const{value:v}=S.target;o(v)},[]),f=b.useCallback(S=>{S.stopPropagation();const{key:v}=S;switch(v){case"Enter":{g();break}case"Escape":{e();break}}},[e,g]);return l.jsxs("div",{className:"file-list-item-editor",children:[l.jsx("input",{type:"text",className:U("form-control file-list-item-editor-input",{"is-invalid":a}),value:i,ref:s,onBlur:p,onKeyDown:f,onChange:C,onClick:m,onDoubleClick:m,onMouseDown:m}),a&&l.jsx("div",{className:"invalid-feedback",children:`${a}`})]})}function Lm(d){const{isMultiSelect:e=!1,focusedPath:t,showContextMenu:n=!1,onCreateFile:s,onCreateFolder:i,onCopy:o,onDelete:a,onMove:r,onRename:c,onSelect:h,onSelectionChange:u,table:m,rowHeight:g=kc,validateRename:p=()=>Promise.resolve()}=d,[C,f]=b.useState(),[S,v]=b.useState([]),[w,T]=b.useState(),y=b.useCallback(H=>{v(H),u?.(H)},[u]),E=b.useCallback(H=>{T(H)},[]),I=b.useCallback(()=>{w&&o?.(w)},[w,o]),D=b.useCallback(()=>{S.length>0&&a?.(S)},[a,S]),F=b.useCallback(()=>{s?.()},[s]),_=b.useCallback(()=>{w&&i?.(Ce.getPath(w.filename))},[w,i]),L=b.useCallback(()=>{w&&f(w)},[w]),B=b.useCallback(()=>{f(void 0)},[]),O=b.useCallback(H=>{C&&(c?.(C,H),f(void 0))},[c,C]),j=b.useMemo(()=>{if(C)return[];const H=[];return s&&H.push({title:"New File",description:"Create new file",action:F,group:oe.groups.medium}),i&&H.push({title:"New Folder",description:"Create new folder",action:_,group:oe.groups.medium}),o&&H.push({title:"Copy",description:"Copy",action:I,group:oe.groups.low,disabled:w==null||_n(w)}),a&&S.length>0&&H.push({title:"Delete",description:"Delete",shortcut:ch.FILE_EXPLORER.DELETE,action:D,group:oe.groups.low}),c&&H.push({title:"Rename",description:"Rename",shortcut:ch.FILE_EXPLORER.RENAME,action:L,group:oe.groups.low,disabled:w==null}),H},[I,D,F,_,L,w,o,s,i,a,c,S,C]),k=b.useCallback(H=>(N(C),p(C,H)),[C,p]),A=b.useCallback(H=>{const{item:z}=H;return C&&C.filename===z.filename?l.jsx(El,{...H,children:l.jsx($R,{item:z,validate:k,onSubmit:O,onCancel:B})}):l.jsx(El,{...H})},[B,O,C,k]);return l.jsxs("div",{className:"file-list-container",children:[m!=null&&l.jsx(_R,{onMove:r,onSelect:h,onSelectionChange:y,onFocusChange:E,renderItem:A,rowHeight:g,table:m,isMultiSelect:e,focusedPath:t}),n&&l.jsx(oe,{actions:j})]})}Lm.displayName="FileListContainer";class VR extends _i{isExistingFile=!0;info;constructor(e){super("Name already exists"),this.info=e}}const Ra=VR;class BR extends Error{constructor(){super("No file exists at the path specified")}isFileNotFound=!0}const Oc=BR,zs=Z.module("FileExplorer");function Ac(d){const{storage:e,isMultiSelect:t=!1,focusedPath:n,onDelete:s=()=>{},onRename:i=()=>{},onSelect:o,onSelectionChange:a,rowHeight:r=kc}=d,[c,h]=b.useState([]),[u,m]=b.useState();b.useEffect(function(){let I;async function D(){zs.debug("initTable"),I=we.makeCancelable(e.getTable(),F=>F.close());try{m(await I)}catch(F){we.isCanceled(F)||zs.error("Unable to initialize table",F)}}return D(),()=>{I.cancel()}},[e]);const g=b.useCallback(E=>{we.isCanceled(E)||zs.error(E)},[]),p=b.useCallback(E=>{zs.debug("handleDelete, pending confirmation",E),h(E)},[]),C=b.useCallback(()=>{zs.debug("handleDeleteConfirm",c),c.forEach(E=>e.deleteFile(_n(E)?Ce.makePath(E.filename):E.filename)),s(c),h([])},[c,s,e]),f=b.useCallback(()=>{zs.debug("handleDeleteCancel"),h([])},[]),S=b.useCallback((E,I)=>{Ce.reducePaths(E.map(F=>_n(F)?Ce.makePath(F.filename):F.filename)).forEach(F=>{const _=Ce.isPath(F)?`${I}${Ce.getBaseName(F.substring(0,F.length-1))}/`:`${I}${Ce.getBaseName(F)}`;e.moveFile(F,_).then(()=>{i(F,_)}).catch(g)})},[g,i,e]),v=b.useCallback((E,I)=>{let D=E.filename;const F=_n(E);F&&!D.endsWith("/")&&(D=`${D}/`);let _=`${Ce.getParent(D)}${I}`;F&&!_.endsWith("/")&&(_=`${_}/`),zs.debug2("handleRename",D,_),e.moveFile(D,_).catch(g),i(D,_)},[g,i,e]),w=b.useCallback(async(E,I)=>{if(I===E.basename)return;Ce.validateName(I);const D=`${Ce.getPath(E.filename)}${I}`;try{const F=await e.info(D);throw new Ra(F)}catch(F){if(!(F instanceof Oc))throw F}},[e]),T=c.length>0,y=b.useMemo(()=>c.length===1?`Are you sure you want to delete "${c[0].filename}"?`:"Are you sure you want to delete the selected files?",[c]);return l.jsxs("div",{className:"file-explorer",children:[u&&l.jsx(Lm,{isMultiSelect:t,focusedPath:n,showContextMenu:!0,onMove:S,onDelete:p,onRename:v,onSelect:o,onSelectionChange:a,rowHeight:r,table:u,validateRename:w}),l.jsx(li,{isOpen:T,headerText:y,bodyText:"You cannot undo this action.",onCancel:f,onConfirm:C,confirmButtonText:"Delete"})]})}Ac.displayName="FileExplorer";const Ks=Z.module("NewItemModal");class To extends b.PureComponent{static propTypes={isOpen:M.bool,title:M.string.isRequired,defaultValue:M.string,type:M.oneOf(["file","directory"]).isRequired,onSubmit:M.func,onCancel:M.func,placeholder:M.string,storage:M.shape({}).isRequired,notifyOnExtensionChange:M.bool};static defaultProps={isOpen:!1,defaultValue:"/",notifyOnExtensionChange:!1,placeholder:"",onSubmit:(e,t)=>{},onCancel:()=>{}};static getValidationMessage(e){return e instanceof Ra&&e.info.type==="directory"?"Error: Cannot overwrite existing directory":`${e}`}static handleError(e){we.isCanceled(e)||Ks.error(e)}constructor(e){super(e),this.handleModalSubmit=this.handleModalSubmit.bind(this),this.handleModalOpened=this.handleModalOpened.bind(this),this.handleSelect=this.handleSelect.bind(this),this.handleChange=this.handleChange.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleValidationError=this.handleValidationError.bind(this),this.handleOverwriteCancel=this.handleOverwriteCancel.bind(this),this.handleOverwriteConfirm=this.handleOverwriteConfirm.bind(this),this.handleExtensionChangeCancel=this.handleExtensionChangeCancel.bind(this),this.handleExtensionChangeConfirm=this.handleExtensionChangeConfirm.bind(this),this.handleBreadcrumbSelect=this.handleBreadcrumbSelect.bind(this);const{defaultValue:t}=e,n=Ce.hasPath(t)?Ce.getPath(t):"/";this.state={isSubmitting:!1,path:n,prevExtension:Ce.getExtension(t),showExtensionChangeModal:!1,showOverwriteModal:!1,value:Ce.getBaseName(t)}}componentDidUpdate(e,t){const{isOpen:n}=this.props,{isOpen:s}=e,{value:i,path:o}=this.state;!s&&n&&(this.resetValue(),this.isInitialLoad=!0),s&&n&&(!this.isInitialLoad&&(o!==t.path||i!==t.value)&&this.updateValidationStatus(o,i),this.isInitialLoad=!1)}componentWillUnmount(){this.pending.cancel(),this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableExistingItemPromise&&this.cancelableExistingItemPromise.cancel()}inputRef=J.createRef();cancelableValidatePromise;cancelableExistingItemPromise;pending=new os;pathMap=new Map;isInitialLoad=!0;resetValue(){const{defaultValue:e}=this.props,t=Ce.hasPath(e)?Ce.getPath(e):"/";this.setState({path:t,value:Ce.getBaseName(e),validationError:void 0,prevExtension:Ce.getExtension(e),isSubmitting:!1})}getValidationPromise(e,t,n=!1){return this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableValidatePromise=we.makeCancelable(this.validateName(e,t,n)),this.cancelableValidatePromise}async validateName(e,t,n){Ce.validateName(t);const{defaultValue:s,storage:i}=this.props;if(n){const o=`${e}${t}`;if(o!==s)try{const a=await i.info(o);throw new Ra(a)}catch(a){if(!(a instanceof Oc))throw a}}return t}updateValidationStatus(e,t){this.getValidationPromise(e,t).then(()=>{this.setState({validationError:void 0})}).catch(this.handleValidationError).catch(To.handleError)}handleModalOpened(){this.focusRenameInput()}handleModalSubmit(){this.submitModal()}handleChange(e){const{value:t}=e.target;this.setState({value:t})}handleSelect(e){if(Ks.debug("handleSelect",e),e.type==="directory")this.setState({path:Ce.makePath(e.filename)});else{const t=e.basename,n=Ce.getPath(e.filename);this.setState({value:t,path:n},()=>{this.focusRenameInput()})}}handleKeyDown(e){const{key:t}=e;switch(e.stopPropagation(),t){case"Enter":{e.preventDefault(),this.submitModal();break}case"Escape":{e.preventDefault();const{onCancel:n}=this.props;n();break}}}handleValidationError(e){if(!(e instanceof _i))throw e;Ks.debug("Validation error",e),this.setState({validationError:e})}handleOverwriteCancel(){this.setState({showOverwriteModal:!1,isSubmitting:!1})}handleOverwriteConfirm(){this.setState({showOverwriteModal:!1});const{onSubmit:e}=this.props,{path:t,value:n}=this.state;Ks.debug("handleOverwriteConfirm",t,n),e(`${t}${n}`,!0)}handleExtensionChangeCancel(){Ks.debug("handleExtensionChangeCancel"),this.setState(({value:e,prevExtension:t})=>({showExtensionChangeModal:!1,value:Ce.replaceExtension(e,t)})),this.submitModal(!0)}handleExtensionChangeConfirm(){Ks.debug("handleExtensionChangeConfirm"),this.setState({showExtensionChangeModal:!1}),this.submitModal(!0)}focusRenameInput(){const e=this.inputRef.current;if(e){const{type:t}=this.props,{value:n}=e,s=t==="directory"?n.length:n.lastIndexOf(".");e.focus(),e.setSelectionRange(0,s>0?s:n.length)}}submitModal(e=!1){this.setState(({prevExtension:t,value:n,path:s})=>{const{notifyOnExtensionChange:i,type:o}=this.props;Ks.debug("submitModal",t,n);const a=Ce.getExtension(n);return i&&!e&&t!==null&&t!==a?{isSubmitting:!1,showExtensionChangeModal:!0,newExtension:a}:(this.getValidationPromise(s,n,!0).then(r=>{const{onSubmit:c}=this.props;c(`${s}${n}`)}).catch(r=>{if(r instanceof Ra&&o!=="directory"&&r.info.type!=="directory"){this.setState({showOverwriteModal:!0});return}throw r}).catch(r=>{throw we.isCanceled(r)&&this.setState({isSubmitting:!1}),r}).catch(this.handleValidationError).catch(To.handleError),{isSubmitting:!0,showExtensionChangeModal:!1,newExtension:void 0})})}handleBreadcrumbSelect(e){this.setState({path:e})}renderPathButtons(e){const t=e.split("/");return t.pop(),t.map((n,s)=>{let i="";for(let o=0;o<s;o+=1)i+=`${t[o]}/`;return i+=`${n}/`,l.jsxs(J.Fragment,{children:[l.jsx(V,{kind:"ghost",className:"directory-breadcrumbs",onClick:()=>this.handleBreadcrumbSelect(i),"aria-label":s===0?"Home":void 0,icon:s===0?l.jsx(Q,{icon:kp,transform:"right-1.6"}):void 0,tooltip:s===0?"Home":void 0,children:n}),"/"]},i)})}render(){const{storage:e,isOpen:t,onCancel:n,placeholder:s,title:i,type:o}=this.props,{isSubmitting:a,path:r,showExtensionChangeModal:c,showOverwriteModal:h,validationError:u,value:m,prevExtension:g,newExtension:p}=this.state,C=o==="directory",f=Ce.fileExtensionToString(g),S=Ce.fileExtensionToString(p),v=C?"Create":"Save",w=C?"New folder name":"Save file as";return l.jsxs(l.Fragment,{children:[l.jsxs(Wi,{isOpen:t,toggle:n,onOpened:this.handleModalOpened,className:"modal-dialog-centered new-file-modal theme-bg-dark",children:[l.jsx(No,{toggle:n,children:i}),l.jsx(Gi,{children:l.jsx("form",{children:l.jsxs("div",{className:"d-flex flex-column new-file-modal-content",children:[l.jsxs("div",{className:"flex-grow-0 mb-4",children:[l.jsx("label",{htmlFor:"file-name-input",children:w}),l.jsx("input",{id:"file-name-input",type:"text",autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:"false",className:U("form-control",{"is-invalid":u}),value:m,placeholder:s,ref:this.inputRef,onKeyDown:this.handleKeyDown,onChange:this.handleChange}),u&&l.jsx("div",{className:"invalid-feedback",children:To.getValidationMessage(u)})]}),l.jsxs("div",{className:"flex-grow-0",children:[l.jsx("label",{children:"Directory: /"}),this.renderPathButtons(r)]}),l.jsx("div",{className:"flex-grow-1 file-explorer-container",children:l.jsx(Ac,{onSelect:this.handleSelect,storage:e,focusedPath:r})})]})})}),l.jsxs(Hl,{children:[l.jsx(V,{kind:"secondary",onClick:n,children:"Cancel"}),l.jsx(V,{kind:"primary",disabled:a,onClick:this.handleModalSubmit,children:v})]})]}),l.jsx(li,{isOpen:h,headerText:"Confirm overwrite",bodyText:"File with this name already exists, are you sure you want to overwrite it?",onCancel:this.handleOverwriteCancel,onConfirm:this.handleOverwriteConfirm,cancelButtonText:"Cancel",confirmButtonText:"Overwrite"}),l.jsx(li,{isOpen:c,headerText:"Confirm extension change",bodyText:`Are you sure you want to change extension from "${f}" to "${S}"?`,onCancel:this.handleExtensionChangeCancel,onConfirm:this.handleExtensionChangeConfirm,cancelButtonText:`Keep "${f}"`,confirmButtonText:`Use "${S}"`})]})}}const Pm=To;function UR({createFile:d,createFolder:e,onSearchChange:t,defaultSearchText:n=""}){return l.jsxs("div",{className:"file-explorer-toolbar",children:[l.jsxs("div",{className:"file-explorer-toolbar-buttons",children:[l.jsx(V,{kind:"ghost",icon:Bh,tooltip:"New notebook",onClick:d,"aria-label":"New notebook"}),l.jsx(V,{kind:"ghost",icon:Op,tooltip:"New folder",onClick:e,"aria-label":"New folder"})]}),t&&l.jsx("div",{className:"file-explorer-toolbar-search",children:l.jsx(Kf,{value:n,onChange:t,placeholder:"Search by name"})})]})}const yi=Z.module("FileExplorerPanel"),WR=(d,e)=>{const t=wu(d),n=ci(d,e.localDashboardId),{session:s,config:i}=n??{},o=i?.type;return{fileStorage:t,language:o,session:s}},GR=wt(WR,null,null,{forwardRef:!0});function zR(d){const e=d;return e!=null&&typeof e.button=="number"}class Xa extends J.Component{static COMPONENT="FileExplorerPanel";static TITLE="File Explorer";static handleError(e){yi.error(e)}static isFocusEvent(e){return zR(e)?e.detail>=2:!0}constructor(e){super(e),this.handleFileSelect=this.handleFileSelect.bind(this),this.handleCreateFile=this.handleCreateFile.bind(this),this.handleCreateDirectory=this.handleCreateDirectory.bind(this),this.handleCreateDirectoryCancel=this.handleCreateDirectoryCancel.bind(this),this.handleCreateDirectorySubmit=this.handleCreateDirectorySubmit.bind(this),this.handleDelete=this.handleDelete.bind(this),this.handleRename=this.handleRename.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleShow=this.handleShow.bind(this),this.handleSelectionChange=this.handleSelectionChange.bind(this);const{session:t,language:n}=e;this.state={isShown:!1,language:n,session:t,showCreateFolder:!1,focusedFilePath:"/"}}componentDidMount(){this.isHidden()||this.setState({isShown:!0})}handleCreateFile(){const{glEventHub:e}=this.props,{session:t,language:n}=this.state,s={language:n,value:""};yi.debug("handleCreateFile",t,n,s),e.emit(We.CREATE_NOTEBOOK,t,n,s)}handleCreateDirectory(e){this.setState({showCreateFolder:!0})}handleCreateDirectoryCancel(){yi.debug("handleCreateDirectoryCancel"),this.setState({showCreateFolder:!1})}handleCreateDirectorySubmit(e){yi.debug("handleCreateDirectorySubmit",e),this.setState({showCreateFolder:!1});const{fileStorage:t}=this.props;t.createDirectory(e).catch(Xa.handleError)}handleDelete(e){const{glEventHub:t}=this.props;e.forEach(n=>{t.emit(We.CLOSE_FILE,{id:n.filename,itemName:n.filename})})}handleSelectionChange(e){let t="/";e.length===1&&(e[0].type==="directory"?t=Ce.makePath(e[0].filename):t=Ce.getPath(e[0].filename)),this.setState({focusedFilePath:t})}handleFileSelect(e,t){if(yi.debug("fileSelect",e),e.type==="directory")return;const n=Xa.isFocusEvent(t),s={id:e.filename,itemName:e.filename},{glEventHub:i}=this.props,{session:o,language:a}=this.state,r={value:null,language:a};i.emit(We.SELECT_NOTEBOOK,o,a,r,s,n)}handleRename(e,t){const{glEventHub:n}=this.props;yi.debug("handleRename",e,t),n.emit(We.RENAME_FILE,e,t)}handleSessionOpened(e,{language:t}){this.setState({session:e,language:t})}handleSessionClosed(){this.setState({session:void 0,language:void 0})}handleShow(){this.setState({isShown:!0})}isHidden(){const{glContainer:e}=this.props,{isHidden:t}=e;return t}render(){const{fileStorage:e,glContainer:t,glEventHub:n}=this.props,{isShown:s,showCreateFolder:i,focusedFilePath:o}=this.state;return l.jsxs(as,{className:"file-explorer-panel",componentPanel:this,glContainer:t,glEventHub:n,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[l.jsx(UR,{createFile:this.handleCreateFile,createFolder:this.handleCreateDirectory}),s&&l.jsx(Ac,{isMultiSelect:!0,storage:e,onDelete:this.handleDelete,onRename:this.handleRename,onSelect:this.handleFileSelect,onSelectionChange:this.handleSelectionChange}),l.jsx(Pm,{isOpen:i,type:"directory",title:"Create New Folder",storage:e,onSubmit:this.handleCreateDirectorySubmit,onCancel:this.handleCreateDirectoryCancel,defaultValue:o})]})}}const KR=GR(Xa),Za=KR;const at=Z.module("FilterSetManager"),qR="Enter name...",uh="No Available Filter Sets";class Qa extends b.Component{static animateScreenFlash(){const e=document.createElement("div");e.classList.add("screen-flash-overlay"),e.addEventListener("animationend",()=>{e.remove()}),document.querySelector("body")?.appendChild(e)}constructor(e){super(e),this.handleSettingsCancel=this.handleSettingsCancel.bind(this),this.handleSettingsClick=this.handleSettingsClick.bind(this),this.handleSettingsSave=this.handleSettingsSave.bind(this),this.handleBackgroundClick=this.handleBackgroundClick.bind(this),this.handleEditDropdownChange=this.handleEditDropdownChange.bind(this),this.handleFilterChange=this.handleFilterChange.bind(this),this.handleFilterApply=this.handleFilterApply.bind(this),this.handleCaptureNewSet=this.handleCaptureNewSet.bind(this),this.handleNameInputChange=this.handleNameInputChange.bind(this),this.handleNameInputKeyPress=this.handleNameInputKeyPress.bind(this),this.handleRenameConfirm=this.handleRenameConfirm.bind(this),this.handleRenameCancel=this.handleRenameCancel.bind(this),this.handleRestoreFullStateChange=this.handleRestoreFullStateChange.bind(this),this.handleSetDelete=this.handleSetDelete.bind(this),this.handleSetEdit=this.handleSetEdit.bind(this),this.handleSetUpdate=this.handleSetUpdate.bind(this),this.state={editId:void 0,renameSet:void 0,nameInputValue:"",nameInputError:void 0,modifiedFilterSets:[],restoreFullState:!1}}componentDidMount(){const{isValueShown:e}=this.props;e?this.updateSelectedId():this.initSettingsScreen()}componentDidUpdate(e,t){const{isValueShown:n,filterSets:s}=this.props,{modifiedFilterSets:i}=this.state;if(e.isValueShown&&!n&&this.initSettingsScreen(),this.isNameInputScreen()&&!this.isNameInputScreen(t)&&this.focusRenameInput(),s!==e.filterSets)if(!n&&s.length>0&&e.filterSets.length===0&&i.length===0){const{onChange:o}=this.props;o({isValueShown:!0,selectedId:s[0].id})}else this.updateSelectedId()}renameInputRef=J.createRef();dropdownRef=J.createRef();editDropdownRef=J.createRef();initSettingsScreen(){const{filterSets:e,selectedId:t}=this.props;at.debug("initSettingsScreen",e,t),this.setState({modifiedFilterSets:[...e],editId:t})}updateSelectedId(){const{isValueShown:e,filterSets:t,selectedId:n,onChange:s}=this.props;if(at.debug("updateSelectedId",t,n),!!e&&!t.some(({id:i})=>i===n)){const i=t.length===0;s({isValueShown:!i,selectedId:i?void 0:t[0].id})}}handleEditDropdownChange(e){const{value:t}=e.target;this.setState({editId:t})}handleFilterChange(e){const{value:t}=e.target,{isValueShown:n,onChange:s}=this.props;this.applyFilterSet(t),s({isValueShown:n,selectedId:t})}handleFilterApply(){const{selectedId:e}=this.props;this.applyFilterSet(e)}handleSettingsCancel(){const{onChange:e,selectedId:t,filterSets:n}=this.props;this.setState({modifiedFilterSets:[]}),n.length>0&&e({isValueShown:!0,selectedId:t})}handleSettingsSave(){const{onChange:e,onUpdateSets:t}=this.props,{modifiedFilterSets:n,editId:s}=this.state;this.setState({modifiedFilterSets:[]}),at.debug("Update sets",n,s),t(n),n.length>0&&e({isValueShown:!0,selectedId:s})}handleCaptureNewSet(){const{getFilterState:e}=this.props;Qa.animateScreenFlash();const t=Ae(),n=e(),s={id:t,title:"",panels:n};at.debug("handleSetCreate",s),this.setState({nameInputValue:"",nameInputError:void 0,renameSet:s})}handleRenameCancel(){this.setState({renameSet:void 0})}handleRestoreFullStateChange(e){this.setState({restoreFullState:e.target.value==="true"})}getNameError(e){const{renameSet:t,modifiedFilterSets:n}=this.state,s=e?.trim()??"";if(s.length===0)return at.debug("Name cannot be empty",s),"Name cannot be empty";if(t!==void 0&&n.some(({title:i,id:o})=>i===s&&o!==t.id))return at.debug("Set with this name already exists",s),"Set with this name already exists"}handleRenameConfirm(){const{nameInputValue:e,renameSet:t,modifiedFilterSets:n,restoreFullState:s}=this.state;if(t===void 0){at.error("Renamed set undefined.");return}const i=this.getNameError(e);if(at.debug("handleRenameConfirm",e,i),i!==void 0){this.setState({nameInputError:i});return}const o=e?.trim()??"",a={...t,title:o,restoreFullState:s},r=n.findIndex(({id:h})=>h===t.id),c=[...n];r>=0?(c[r]=a,at.debug("Renamed existing set",c)):(c.push(a),at.debug("Added new set to modified sets",c)),this.setState({editId:a.id,modifiedFilterSets:c,renameSet:void 0})}handleSetDelete(){this.setState(e=>{const{editId:t,modifiedFilterSets:n}=e,s=n.findIndex(({id:r})=>r===t);if(s<0)return at.error("Unable to find selected filterSet index",n,t),null;const i=n.filter(({id:r})=>r!==t),o=Math.max(0,Math.min(i.length-1,s-1)),a=i.length>0?i[o].id:void 0;return at.debug("Deleted selected set",t,n,i),at.debug("New selection",o,a),{modifiedFilterSets:i,editId:a}})}handleSetUpdate(){const{getFilterState:e}=this.props;Qa.animateScreenFlash();const t=e();this.setState(({modifiedFilterSets:n,editId:s})=>{if(s===void 0)return at.error("Filter for update not selected."),null;const i=[...n],o=i.findIndex(({id:a})=>a===s);return o<0?(at.error("Selected set for update not found."),null):(i[o]={...i[o],panels:t},at.debug("Update set",i,t),{modifiedFilterSets:i})})}handleSetEdit(){this.setState(({editId:e,modifiedFilterSets:t})=>{const n=t.find(({id:o})=>o===e);if(n===void 0)return at.error("Could not find selected set",e,t),null;const{title:s,restoreFullState:i=!1}=n;return{nameInputValue:s,nameInputError:void 0,renameSet:n,restoreFullState:i}})}handleSettingsClick(e){e.stopPropagation();const{onChange:t,selectedId:n}=this.props;t({isValueShown:!1,selectedId:n})}handleBackgroundClick(e){at.debug("handleBackgroundClick"),e.target!==this.dropdownRef.current&&this.focusInput()}handleNameInputChange(e){const{value:t}=e.target,n=this.getNameError(t);this.setState({nameInputValue:t,nameInputError:n})}handleNameInputKeyPress(e){const{key:t}=e;t==="Enter"&&(e.preventDefault(),this.handleRenameConfirm())}isNameInputScreen(e=this.state){const{renameSet:t}=e;return t!==void 0}isRenamingExistingSet=pe((e,t)=>t!==void 0&&e.some(({id:n})=>n===t.id));applyFilterSet(e){const{onApply:t,filterSets:n}=this.props;if(e===void 0){at.debug("No filter selected");return}const s=n.find(({id:i})=>i===e);if(s===void 0){at.debug("Selected id not found in filterSets",e,n);return}at.debug("Apply filterSet",s),t(s)}focusInput(){this.dropdownRef.current?.focus()}focusRenameInput(){this.renameInputRef.current?.focus()}render(){const{nameInputValue:e,nameInputError:t,editId:n,renameSet:s,modifiedFilterSets:i,restoreFullState:o}=this.state,{isValueShown:a,filterSets:r,selectedId:c}=this.props,h=this.isNameInputScreen(),u=this.isRenamingExistingSet(i,s),m=i.length===0,g=!h&&m&&r.length===0,p=!h&&!g,C=l.jsxs("div",{className:"fa-layers mr-3",children:[l.jsx(Q,{icon:Vi,mask:dl,transform:"shrink-1 down-5 right-7"}),l.jsx(Q,{icon:As,className:"text-primary",transform:"shrink-6 down-5 right-7"})]}),f=l.jsxs("div",{className:"fa-layers",children:[l.jsx(Q,{icon:Vi,mask:dl,transform:"shrink-1 down-5 right-7"}),l.jsx(Q,{icon:hl,transform:"shrink-1 down-5 right-7"})]});return l.jsx("div",{className:"filter-set-manager fill-parent-absolute",children:l.jsxs($l,{className:"w-100 h-100",isFlipped:a,children:[l.jsx("div",{className:"filter-set-manager-settings-card fill-parent-absolute",children:l.jsxs("div",{className:"filter-set-manager-card-content",children:[g&&l.jsxs("div",{children:[l.jsx(V,{kind:"ghost",className:"btn btn-link no-underline",onClick:this.handleCaptureNewSet,icon:C,children:"Capture filter set"}),l.jsx("div",{className:"py-3 text-muted small",children:"Takes a snapshot of the currently applied filters on all panels, allowing you to restore saved filter sets later."})]}),h&&l.jsxs("div",{className:"d-flex flex-column justify-content-center","data-testid":"edit-filter-set-container",children:[l.jsxs("div",{className:"form-group",children:[l.jsx("label",{children:u?"Edit set":"Name captured set"}),l.jsxs("div",{className:"name-input-container",children:[l.jsx("input",{type:"text",className:"input-set-name form-control",placeholder:qR,value:e,ref:this.renameInputRef,onChange:this.handleNameInputChange,onKeyPress:this.handleNameInputKeyPress,spellCheck:"false"}),l.jsx(V,{"data-testid":"rename-confirm-button",kind:"ghost",className:"btn btn-link no-underline pt-2 pb-2",onClick:this.handleRenameConfirm,tooltip:"Save","test-id":"button-save",icon:Kh}),l.jsx(V,{"data-testid":"rename-cancel-button",kind:"ghost",className:"btn btn-link no-underline pt-2 pb-2",onClick:this.handleRenameCancel,tooltip:"Cancel",icon:Ap})]}),t!==void 0&&l.jsx("div",{className:"error-message",children:t})]}),l.jsx("div",{className:"form-group",children:l.jsxs(gr,{onChange:this.handleRestoreFullStateChange,value:`${o}`,children:[l.jsx(ns,{value:"false",children:"Restore only filters"}),l.jsx(ns,{value:"true",children:"Restore full table state"})]})})]}),p&&l.jsxs("div",{className:"filter-set-manager-settings-grid-1",children:[l.jsxs("div",{className:"form-group",children:[l.jsx("label",{children:"Edit filter sets"}),l.jsxs("div",{className:"filter-select-container",children:[l.jsxs("select",{"data-testid":"settings-card-filter-select",ref:this.editDropdownRef,value:n??"-1",className:"custom-select filter-value-select",onChange:this.handleEditDropdownChange,disabled:m,children:[m&&l.jsx("option",{value:"-1",disabled:!0,children:uh}),i.map(({id:S,title:v})=>l.jsx("option",{value:S,children:v},S))]}),l.jsx(V,{kind:"ghost",onClick:this.handleSetUpdate,disabled:m,icon:f,tooltip:"Update"}),l.jsx(V,{kind:"ghost",onClick:this.handleSetEdit,disabled:m,icon:Oo,tooltip:"Edit"}),l.jsx(V,{kind:"ghost",onClick:this.handleSetDelete,disabled:m,icon:tn,tooltip:"Delete"})]})]}),l.jsx("div",{children:l.jsx(V,{kind:"ghost",className:"btn btn-link no-underline",onClick:this.handleCaptureNewSet,icon:C,children:"Capture new filter set"})}),l.jsxs("div",{className:"py-3 text-right",children:[l.jsx(V,{kind:"secondary",onClick:this.handleSettingsCancel,children:"Cancel"})," ",l.jsx(V,{kind:"primary",onClick:this.handleSettingsSave,children:"Save"})]})]})]})},"front"),l.jsxs("div",{className:"filter-set-manager-value-card fill-parent-absolute",onClick:this.handleBackgroundClick,children:[l.jsx("div",{className:"filter-set-manager-column",children:l.jsx("div",{className:"filter-set-manager-column-title",children:"Filter sets"})}),l.jsx("div",{className:"filter-set-manager-card-content",children:l.jsx("div",{className:"filter-set-manager-value-input",children:l.jsxs("div",{className:"filter-select-container",children:[l.jsxs("select",{"data-testid":"value-card-filter-select",ref:this.dropdownRef,value:c,className:"custom-select filter-value-select",onChange:this.handleFilterChange,children:[r.length===0&&l.jsx("option",{value:"-1",disabled:!0,children:uh}),r.map(({id:S,title:v})=>l.jsx("option",{value:S,children:v},S))]}),l.jsx(V,{"data-testid":"filter-apply-button",kind:"ghost",onClick:this.handleFilterApply,icon:Ll,tooltip:"Apply Filter Set"})]})})}),l.jsx("div",{className:"filter-set-manager-menu",children:l.jsx(V,{kind:"ghost",className:"btn btn-link btn-link-icon m-2 px-2",onClick:this.handleSettingsClick,tooltip:"Settings",icon:l.jsx(Q,{icon:ko,transform:"grow-4"})})})]},"back")]})})}}const YR=Qa;function Lc(d){const{model:e,widgetName:t,glContainer:n,description:s}=d,i=(e?.rowCount??0)-(e?.pendingRowCount??0),o=e?.displayString(i,"long");return l.jsx(xr,{widgetType:"Table",widgetName:t,glContainer:n,description:s,children:l.jsxs("div",{className:"column-statistics-grid",children:[l.jsx("span",{className:"column-statistic-operation",children:"Number of Rows"}),l.jsx("span",{className:"column-statistic-value",children:o})]})})}Lc.propTypes={glContainer:hc.Container.isRequired,widgetName:M.string.isRequired,description:M.string};Lc.defaultProps={description:null};const Dn=Z.module("IrisGridPanel"),XR=500,ZR={IrisGrid:Dm,IrisGridTableModel:Fm,ContextMenuRoot:Xh};class yl extends b.PureComponent{static defaultProps={onStateChange:()=>{},onPanelStateUpdate:()=>{}};static displayName="IrisGridPanel";static COMPONENT="IrisGridPanel";constructor(e){super(e),this.handleAdvancedSettingsChange=this.handleAdvancedSettingsChange.bind(this),this.handleColumnsChanged=this.handleColumnsChanged.bind(this),this.handleTableChanged=this.handleTableChanged.bind(this),this.handleColumnSelected=this.handleColumnSelected.bind(this),this.handleDataSelected=this.handleDataSelected.bind(this),this.handleError=this.handleError.bind(this),this.handleGridStateChange=this.handleGridStateChange.bind(this),this.handlePluginStateChange=this.handlePluginStateChange.bind(this),this.handlePartitionAppend=this.handlePartitionAppend.bind(this),this.handleCreateChart=this.handleCreateChart.bind(this),this.handleResize=this.handleResize.bind(this),this.handleShow=this.handleShow.bind(this),this.handleTabClicked=this.handleTabClicked.bind(this),this.handleDisconnect=this.handleDisconnect.bind(this),this.handleReconnect=this.handleReconnect.bind(this),this.handleLoadSuccess=this.handleLoadSuccess.bind(this),this.handleLoadError=this.handleLoadError.bind(this),this.isColumnSelectionValid=this.isColumnSelectionValid.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.handlePluginFilter=this.handlePluginFilter.bind(this),this.handlePluginFetchColumns=this.handlePluginFetchColumns.bind(this),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.irisGrid=J.createRef(),this.pluginRef=J.createRef();const{panelState:t}=e;this.pluginState=null,this.state={error:null,isDisconnected:!1,isLoaded:!1,isLoading:!0,isModelReady:!1,model:void 0,advancedFilters:new Map,aggregationSettings:{aggregations:[],showOnTop:!1},advancedSettings:new Map(Sm.DEFAULTS),customColumns:[],customColumnFormatMap:new Map,isFilterBarShown:!1,quickFilters:new Map,sorts:[],userColumnWidths:new Map,userRowHeights:new Map,reverseType:R.REVERSE_TYPE.NONE,movedColumns:[],movedRows:[],isSelectingPartition:!1,partition:void 0,partitionColumn:void 0,rollupConfig:void 0,showSearchBar:!1,searchValue:"",selectedSearchColumns:void 0,invertSearchColumns:!0,Plugin:void 0,pluginFilters:[],pluginFetchColumns:[],modelQueue:[],pendingDataMap:new Map,frozenColumns:void 0,panelState:t,irisGridStateOverrides:{},gridStateOverrides:{},isStuckToBottom:!1,isStuckToRight:!1,conditionalFormats:[],selectDistinctColumns:[]}}componentDidMount(){this.initModel()}componentDidUpdate(e,t){const{model:n}=this.state;n!==t.model&&(t.model!=null&&(this.stopModelListening(t.model),t.model.close()),n!=null&&this.startModelListening(n))}componentWillUnmount(){this.savePanelState.cancel(),this.modelPromise!=null&&(this.modelPromise.cancel(),this.modelPromise=void 0);const{model:e}=this.state;e&&(this.stopModelListening(e),e.close())}irisGrid;pluginRef;modelPromise;irisGridState;gridState;pluginState;getTableName(){const{metadata:e}=this.props;return e.table}getGridInputFilters=pe((e,t)=>be.getInputFiltersForColumns(e,t.filter(({value:n,excludePanelIds:s})=>{const i=q.getIdFromPanel(this);return n!=null&&(s==null||i!=null&&!s.includes(i))})));getAlwaysFetchColumns=pe((e,t)=>{const n=q.getIdFromPanel(this),s=new Set(t);for(let i=0;i<e.length;i+=1){const{start:o}=e[i];o!=null&&o.panelId===n&&s.add(o.columnName)}return[...s]});getPluginContent=pe((e,t,n,s,i)=>!t||!oi(t)||e==null||t.table==null?null:l.jsx("div",{className:"iris-grid-plugin",children:l.jsx(e,{ref:this.pluginRef,filter:this.handlePluginFilter,onFilter:this.handlePluginFilter,fetchColumns:this.handlePluginFetchColumns,onFetchColumns:this.handlePluginFetchColumns,table:t.table,user:n,panel:this,workspace:s,components:ZR,onStateChange:this.handlePluginStateChange,pluginState:i})}));getDehydratedIrisGridPanelState=pe((e,t,n,s,i)=>be.dehydrateIrisGridPanelState(e,{isSelectingPartition:t,partition:n,partitionColumn:s,advancedSettings:i}));getDehydratedIrisGridState=pe((e,t,n,s,i,o,a,r,c,h,u,m,g,p,C,f,S,v,w,T,y)=>be.dehydrateIrisGridState(e,{advancedFilters:n,aggregationSettings:S,customColumnFormatMap:s,isFilterBarShown:i,metrics:{userColumnWidths:C,userRowHeights:f},quickFilters:o,customColumns:a,reverseType:r,rollupConfig:c,showSearchBar:h,searchValue:u,selectDistinctColumns:m,selectedSearchColumns:g,sorts:t,invertSearchColumns:p,pendingDataMap:v,frozenColumns:w,conditionalFormats:T,columnHeaderGroups:y}));getDehydratedGridState=pe((e,t,n,s,i)=>be.dehydrateGridState(e,{isStuckToBottom:s,isStuckToRight:i,movedColumns:t,movedRows:n}));getCachedPanelState=pe((e,t,n,s)=>({irisGridPanelState:e,irisGridState:t,gridState:n,pluginState:s}));initModel(){this.setState({isModelReady:!1,isLoading:!0,error:null});const{makeModel:e}=this.props;this.modelPromise!=null&&this.modelPromise.cancel(),this.modelPromise=we.makeCancelable(e(),t=>t.close()),this.modelPromise.then(this.handleLoadSuccess).catch(this.handleLoadError)}handleLoadSuccess(e){const t=e,{panelState:n,irisGridStateOverrides:s}=this.state,i=[];if(n!=null){const{irisGridState:o}=n,{aggregationSettings:a,customColumns:r,selectDistinctColumns:c=[],rollupConfig:h}={...o,...s};r.length>0&&i.push(u=>{u.customColumns=r}),h!=null&&h.columns.length>0&&i.push(u=>{u.rollupConfig=be.getModelRollupConfig(u.originalColumns,h,a)}),c.length>0&&i.push(u=>{u.selectDistinctColumns=c})}this.setState({model:t,modelQueue:i}),this.initModelQueue(t,i)}initModelQueue(e,t){const n=e;if(t.length===0){this.modelInitialized(n);return}const s=t.shift();Dn.debug("initModelQueue",s),s&&s(n),this.setState({modelQueue:t})}handleAdvancedSettingsChange(e,t){Dn.debug("handleAdvancedSettingsChange",e,t),this.setState(({advancedSettings:n})=>n.get(e)===t?null:{advancedSettings:new Map(n).set(e,t)})}handlePluginFilter(e){const{model:t}=this.state;N(t);const{columns:n,formatter:s}=t,i=be.getFiltersFromInputFilters(n,e,s.timeZone);this.setState({pluginFilters:i})}handlePluginFetchColumns(e){this.setState({pluginFetchColumns:e})}handleContextMenu(e){return this.pluginRef.current?.getMenu?.(e)??[]}isColumnSelectionValid(e){const{columnSelectionValidator:t}=this.props;return t&&e?t(this,e):!1}handleGridStateChange(e,t){this.irisGridState=e,this.gridState=t,this.setState({isLoaded:!0,isLoading:!1}),this.savePanelState();const{glEventHub:n,onStateChange:s}=this.props;n.emit(Sn.STATE_CHANGED,this),s?.(e,t)}handlePluginStateChange(e){const{irisGridState:t,gridState:n}=this;this.pluginState=e,t!==null&&n!==null&&this.savePanelState()}handleColumnsChanged(e){const{isModelReady:t,model:n,modelQueue:s}=this.state;t?this.sendColumnsChange(e.detail):(N(n),this.initModelQueue(n,s))}handleTableChanged(e){Dn.debug("handleTableChanged",e);const{glEventHub:t}=this.props,{detail:n}=e;t.emit(Je.TABLE_CHANGED,this,n)}handlePartitionAppend(e,t){const{glEventHub:n}=this.props,{name:s}=e,i=this.getTableName(),o=`${i} = ${i}.where("${s}=\`${t}\`")`;n.emit(Qt.SEND_COMMAND,o,!1,!0)}handleCreateChart(e,t){this.savePanelState.flush(),this.setState(()=>null,()=>{const{glEventHub:n,inputFilters:s,metadata:i}=this.props,{table:o}=i,{panelState:a}=this.state,r=q.getIdFromPanel(this);let c;a&&(c=be.extractTableSettings(a,s)),n.emit(Sn.CREATE_CHART,{metadata:{settings:e,sourcePanelId:r,table:o,tableSettings:c},table:oi(t)?t.table:void 0})})}handleColumnSelected(e){const{glEventHub:t}=this.props;t.emit(Sn.COLUMN_SELECTED,this,e)}handleDataSelected(e,t){const{glEventHub:n}=this.props;n.emit(Sn.DATA_SELECTED,this,t)}handleResize(){this.updateGrid()}handleShow(){this.updateGrid()}handleTabClicked(){this.irisGrid.current&&this.irisGrid.current.focus()}handleError(e){Dn.error(e),this.setState({error:e,isLoading:!1})}handleDisconnect(){this.setState({error:new Error("Table disconnected"),isDisconnected:!0,isLoading:!1})}handleReconnect(){this.setState({isDisconnected:!1,error:null})}handleLoadError(e){we.isCanceled(e)||this.handleError(e)}modelInitialized(e){const{glEventHub:t,loadPlugin:n}=this.props;if(this.modelPromise=void 0,this.loadPanelState(e),this.setState({isModelReady:!0}),oi(e)){const{table:s}=e,{pluginName:i}=s;if(i!==""&&n!=null&&i!=null){const o=n(i);this.setState({Plugin:o})}t.emit(Je.TABLE_CHANGED,this,s)}this.sendColumnsChange(e.columns)}handleClearAllFilters(){const e=this.irisGrid.current,{isDisconnected:t}=this.state;e!=null&&!t&&e.clearAllFilters()}sendColumnsChange(e){Dn.debug2("sendColumnsChange",e);const{glEventHub:t}=this.props;t.emit(Je.COLUMNS_CHANGED,this,e)}startModelListening(e){e.addEventListener(Se.EVENT.DISCONNECT,this.handleDisconnect),e.addEventListener(Se.EVENT.RECONNECT,this.handleReconnect),e.addEventListener(Se.EVENT.COLUMNS_CHANGED,this.handleColumnsChanged),e.addEventListener(Se.EVENT.TABLE_CHANGED,this.handleTableChanged)}stopModelListening(e){e.removeEventListener(Se.EVENT.DISCONNECT,this.handleDisconnect),e.removeEventListener(Se.EVENT.RECONNECT,this.handleReconnect),e.removeEventListener(Se.EVENT.COLUMNS_CHANGED,this.handleColumnsChanged),e.removeEventListener(Se.EVENT.TABLE_CHANGED,this.handleTableChanged)}getCoordinateForColumn(e){const{model:t}=this.state;if(!t)return null;const n=this.irisGrid.current,{gridWrapper:s}=n||{},i=s?.getBoundingClientRect()??null;if(i==null||i.width<=0||i.height<=0)return null;N(n);const{metrics:o}=n.state;N(o);const{columnHeaderHeight:a,allColumnXs:r,allColumnWidths:c,right:h,columnHeaderMaxDepth:u}=o,m=t.getColumnIndexByName(e);N(m);const g=n.getVisibleColumn(m),p=r.get(g)??0,C=c.get(g)??0,f=Math.max(i.left,Math.min(g>h?i.right:i.left+p+C*.5,i.right)),S=i.top+a*u;return[f,S]}setFilterMap(e){const t=this.irisGrid.current;t?.setFilterMap(e)}setAdvancedFilterMap(e){const t=this.irisGrid.current;t?.setAdvancedFilterMap(e)}setFilters({quickFilters:e,advancedFilters:t}){Dn.debug("setFilters",e,t);const{model:n,isDisconnected:s}=this.state,i=this.irisGrid.current;if(i==null||s){Dn.debug("Ignore setFilters, model disconnected");return}N(n);const{columns:o,formatter:a}=n,r=be.changeFilterColumnNamesToIndexes(n.columns,e).filter(([h])=>n.isFilterable(h)),c=be.changeFilterColumnNamesToIndexes(n.columns,t).filter(([h])=>n.isFilterable(h));i.clearAllFilters(),i.setFilters({quickFilters:be.hydrateQuickFilters(o,r,a.timeZone),advancedFilters:be.hydrateAdvancedFilters(o,c,a.timeZone)})}setStateOverrides(e){Dn.debug("setStateOverrides",e);const{irisGridState:t,gridState:n}=e;this.setState({irisGridStateOverrides:t,gridStateOverrides:n},()=>{this.initModel()})}unsetFilterValue(){}loadPanelState(e){const{panelState:t,irisGridStateOverrides:n,gridStateOverrides:s}=this.state;if(t!=null)try{const{gridState:i,irisGridState:o,irisGridPanelState:a}=t,r={...n},{quickFilters:c,advancedFilters:h}=r;c&&(r.quickFilters=be.changeFilterColumnNamesToIndexes(e.columns,c)),h&&(r.advancedFilters=be.changeFilterColumnNamesToIndexes(e.columns,h));const{isSelectingPartition:u,partition:m,partitionColumn:g,advancedSettings:p}=be.hydrateIrisGridPanelState(e,a),{advancedFilters:C,customColumns:f,customColumnFormatMap:S,isFilterBarShown:v,quickFilters:w,reverseType:T,rollupConfig:y,aggregationSettings:E,sorts:I,userColumnWidths:D,userRowHeights:F,showSearchBar:_,searchValue:L,selectDistinctColumns:B,selectedSearchColumns:O,invertSearchColumns:j,pendingDataMap:k,frozenColumns:A,conditionalFormats:H,columnHeaderGroups:z}=be.hydrateIrisGridState(e,{...o,...r}),{isStuckToBottom:K,isStuckToRight:ae,movedColumns:W,movedRows:G}=be.hydrateGridState(e,{...i,...s},o.customColumns);this.setState({advancedFilters:C,advancedSettings:p,conditionalFormats:H,customColumns:f,customColumnFormatMap:S,isFilterBarShown:v,isSelectingPartition:u,movedColumns:W,movedRows:G,partition:m,partitionColumn:g,quickFilters:w,reverseType:T,rollupConfig:y,aggregationSettings:E,sorts:I,userColumnWidths:D,userRowHeights:F,showSearchBar:_,searchValue:L,selectDistinctColumns:B,selectedSearchColumns:O,invertSearchColumns:j,pendingDataMap:k,frozenColumns:A,isStuckToBottom:K,isStuckToRight:ae,columnHeaderGroups:z})}catch(i){Dn.error("loadPanelState failed to load panelState",t,i)}}savePanelState=Xe(()=>{const{irisGridState:e,gridState:t,pluginState:n}=this;N(e);const{onPanelStateUpdate:s}=this.props,{model:i,panelState:o,isSelectingPartition:a,partition:r,partitionColumn:c,advancedSettings:h}=this.state,{advancedFilters:u,aggregationSettings:m,customColumnFormatMap:g,isFilterBarShown:p,quickFilters:C,customColumns:f,reverseType:S,rollupConfig:v,showSearchBar:w,searchValue:T,selectDistinctColumns:y,selectedSearchColumns:E,sorts:I,invertSearchColumns:D,metrics:F,pendingDataMap:_,frozenColumns:L,conditionalFormats:B,columnHeaderGroups:O}=e;N(i),N(F);const{userColumnWidths:j,userRowHeights:k}=F;N(t);const{isStuckToBottom:A,isStuckToRight:H,movedColumns:z,movedRows:K}=t,ae=this.getCachedPanelState(this.getDehydratedIrisGridPanelState(i,a,r,c,h),this.getDehydratedIrisGridState(i,I,u,g,p,C,f,S,v,w,T,y,E,D,j,k,m,_,L,B,O),this.getDehydratedGridState(i,z,K,A,H),n);ae!==o&&(Dn.debug("Saving panel state",this,ae),this.setState({panelState:ae}),s?.(ae))},XR);updateGrid(){const e=this.irisGrid.current?.grid??null;e&&e.handleResize()}render(){const{children:e,glContainer:t,glEventHub:n,columnSelectionValidator:s,getDownloadWorker:i,inputFilters:o,links:a,metadata:r,panelState:c,user:h,workspace:u,settings:m,theme:g}=this.props,{advancedFilters:p,aggregationSettings:C,advancedSettings:f,conditionalFormats:S,customColumns:v,customColumnFormatMap:w,error:T,isDisconnected:y,isFilterBarShown:E,isSelectingPartition:I,isStuckToBottom:D,isStuckToRight:F,isLoaded:_,isLoading:L,isModelReady:B,model:O,movedColumns:j,movedRows:k,partition:A,partitionColumn:H,quickFilters:z,reverseType:K,rollupConfig:ae,sorts:W,userColumnWidths:G,userRowHeights:te,showSearchBar:ie,searchValue:ce,selectDistinctColumns:X,selectedSearchColumns:re,invertSearchColumns:ve,Plugin:De,pluginFilters:Re,pluginFetchColumns:ft,pendingDataMap:ht,frozenColumns:At,columnHeaderGroups:Lt}=this.state,ut=T!=null?`Unable to open table. ${T}`:void 0,{table:ye}=r,gt=O?.description??void 0,rt=c?.pluginState??null,Tt=e??this.getPluginContent(De,O,h,u,rt),{permissions:Pt}=h,{canCopy:xn,canDownloadCsv:nn}=Pt;return l.jsx(xc,{errorMessage:ut,isDisconnected:y,isLoading:L,isLoaded:_,className:"iris-grid-panel",glContainer:t,glEventHub:n,onClearAllFilters:this.handleClearAllFilters,onResize:this.handleResize,onShow:this.handleShow,onTabFocus:this.handleShow,onTabClicked:this.handleTabClicked,widgetName:ye,widgetType:"Table",description:gt,componentPanel:this,renderTabTooltip:()=>l.jsx(Lc,{model:O,widgetName:ye,glContainer:t,description:gt}),children:B&&O&&l.jsx(Dm,{advancedFilters:p,aggregationSettings:C,advancedSettings:f,alwaysFetchColumns:this.getAlwaysFetchColumns(a,ft),columnAllowedCursor:"linker",columnNotAllowedCursor:"linker-not-allowed",customColumns:v,customColumnFormatMap:w,columnSelectionValidator:this.isColumnSelectionValid,conditionalFormats:S,inputFilters:this.getGridInputFilters(O.columns,o),applyInputFiltersOnInit:c==null,isFilterBarShown:E,isSelectingColumn:s!=null,isSelectingPartition:I,isStuckToBottom:D,isStuckToRight:F,movedColumns:j,movedRows:k,partition:A,partitionColumn:H,quickFilters:z,reverseType:K,rollupConfig:ae,settings:m,sorts:W,userColumnWidths:G,userRowHeights:te,model:O,showSearchBar:ie,searchValue:ce,selectedSearchColumns:re,selectDistinctColumns:X,invertSearchColumns:ve,onColumnSelected:this.handleColumnSelected,onCreateChart:this.handleCreateChart,onDataSelected:this.handleDataSelected,onError:this.handleError,onPartitionAppend:this.handlePartitionAppend,onStateChange:this.handleGridStateChange,onContextMenu:this.handleContextMenu,onAdvancedSettingsChange:this.handleAdvancedSettingsChange,customFilters:Re,pendingDataMap:ht,canCopy:xn,canDownloadCsv:nn,ref:this.irisGrid,getDownloadWorker:i,frozenColumns:At,theme:g,columnHeaderGroups:Lt,children:Tt})})}}const QR=(d,{localDashboardId:e=vn})=>({inputFilters:Rc(d,e),links:Xi(d,e),columnSelectionValidator:Fc(d,e),user:Su(d),workspace:fr(d),settings:vt(d)}),JR=wt(QR,null,null,{forwardRef:!0})(yl),ri=JR;const mh=Z.module("InputFilter"),eI=150;class Ja extends b.Component{static PLACEHOLDER="Enter value...";static defaultProps={column:null,isValueShown:!1,value:null};constructor(e){super(e),this.handleColumnChange=this.handleColumnChange.bind(this),this.handleInputKeyPress=this.handleInputKeyPress.bind(this),this.handleValueChange=this.handleValueChange.bind(this),this.handleSettingsCancel=this.handleSettingsCancel.bind(this),this.handleSettingsClick=this.handleSettingsClick.bind(this),this.handleSettingsSave=this.handleSettingsSave.bind(this),this.handleBackgroundClick=this.handleBackgroundClick.bind(this),this.inputRef=J.createRef();const{column:t,isValueShown:n,value:s}=e;this.state={column:t,selectedColumn:t,value:s,isValueShown:n}}componentDidUpdate(e,t){const{column:n}=this.props,{column:s,value:i,isValueShown:o}=this.state;n!==e.column&&this.setState({column:n,selectedColumn:n}),o!==void 0&&o&&o!==t.isValueShown&&this.focusInput(),(s!==t.column||i!==t.value||o!==t.isValueShown)&&this.sendUpdate()}componentWillUnmount(){this.sendUpdate.flush()}inputRef;getItemLabel=me((e,t)=>{const{name:n,type:s}=e[t];if(t>0&&e[t-1].name===n||t<e.length-1&&e[t+1].name===n){const i=s.substring(s.lastIndexOf(".")+1);return`${n} (${i})`}return n});handleColumnChange(e){const{columns:t}=this.props,{value:n}=e.target,s=t[parseInt(n,10)];mh.debug2("handleColumnChange",s),this.setState({selectedColumn:s,value:void 0})}handleInputKeyPress(e){e.key==="Enter"&&(e.preventDefault(),e.stopPropagation(),this.setState(({value:t})=>t==null?{value:""}:null,()=>{this.sendUpdate(),this.sendUpdate.flush()}))}handleValueChange(e){const{value:t}=e.target;mh.debug2("handleValueChange",t),this.setState({value:t})}handleSettingsCancel(){const{column:e}=this.state;this.setState({selectedColumn:e,isValueShown:!0})}handleSettingsSave(){const{selectedColumn:e}=this.state;this.setState({column:e,isValueShown:!0})}handleSettingsClick(e){const{column:t}=this.state;this.setState({selectedColumn:t,isValueShown:!1}),e.stopPropagation()}handleBackgroundClick(e){e.target!==this.inputRef.current&&this.focusInput()}focusInput(){this.inputRef.current!==null&&(this.inputRef.current.select(),this.inputRef.current.focus())}clearFilter(){this.setState({value:""})}setFilterState({name:e,type:t,value:n,isValueShown:s}){const i=e!=null&&t!=null?{name:e,type:t}:void 0,o=s===void 0?{column:i,value:n}:{column:i,value:n,isValueShown:s};this.setState(o)}sendUpdate=Xe(()=>{const{onChange:e}=this.props,{column:t,value:n,isValueShown:s}=this.state;e({column:t,isValueShown:s,value:n})},eI);render(){const{columns:e}=this.props,{column:t,isValueShown:n,selectedColumn:s,value:i}=this.state,o=i==null||i.length===0?Ja.PLACEHOLDER.length:i.length;let a=null;if(t!=null){const r=e.findIndex(c=>c.name===t.name&&c.type===t.type);a=r>=0?this.getItemLabel(e,r):t.name}return l.jsxs($l,{className:"input-filter fill-parent-absolute",isFlipped:n??!1,children:[l.jsx("div",{className:"input-filter-settings-card",children:l.jsxs("div",{className:"input-filter-settings-content",children:[l.jsxs("div",{className:"input-filter-settings-grid",children:[l.jsx("label",{children:"Filter Column"}),l.jsxs("select",{value:e.findIndex(r=>r.name===s?.name&&r.type===s?.type),className:"custom-select",onChange:this.handleColumnChange,children:[e.map((r,c)=>l.jsx("option",{value:c,children:this.getItemLabel(e,c)},`${r.name}/${r.type}`)),e.length===0&&l.jsx("option",{value:"-1",disabled:!0,children:"No Available Columns"})]}),l.jsx("div",{className:"text-muted small",children:"Input filter control will apply its filter to all columns matching this name in this dashboard."})]}),l.jsxs("div",{className:"input-filter-settings-buttons",children:[l.jsx(V,{kind:"secondary",onClick:this.handleSettingsCancel,disabled:t==null,children:"Cancel"}),l.jsx(V,{kind:"primary",className:"ml-2",onClick:this.handleSettingsSave,disabled:s==null,children:"Save"})]})]})}),l.jsxs("div",{className:"input-filter-value-card",onClick:this.handleBackgroundClick,children:[l.jsx("div",{className:"input-filter-column",children:l.jsxs("div",{className:"input-filter-column-title",children:[a," Filter"]})}),l.jsx("div",{className:"d-flex justify-content-center align-items-center h-100 w-100",children:l.jsx("div",{className:"input-filter-value-input d-flex flex-column justify-content-center",children:l.jsx("input",{type:"text",ref:this.inputRef,placeholder:Ja.PLACEHOLDER,value:i??"",onChange:this.handleValueChange,onKeyPress:this.handleInputKeyPress,style:{width:`${o+3}ch`},spellCheck:"false"})})}),l.jsx("div",{className:"input-filter-menu",children:l.jsx(V,{kind:"ghost",className:"m-2 px-2",onClick:this.handleSettingsClick,icon:l.jsx(Q,{icon:ko,transform:"grow-4"}),tooltip:"Input Filter Settings"})})]})]})}}const tI=Ja,nI=250;class sI extends b.Component{static defaultProps={panelState:null};static COMPONENT="InputFilterPanel";static displayName="InputFilterPanel";constructor(e){super(e),this.handleChange=Xe(this.handleChange.bind(this),nI),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.inputFilterRef=J.createRef();const{panelState:t}=e,{value:n,isValueShown:s=!1,name:i,type:o,timestamp:a}=t??{};this.state={columns:[],column:i!=null&&o!=null?{name:i,type:o}:void 0,value:n,timestamp:a,isValueShown:s,wasFlipped:!1,skipUpdate:!1,panelState:t}}componentDidMount(){this.updateColumns();const{column:e,value:t,timestamp:n}=this.state;if(e!=null){const{name:s,type:i}=e;this.sendUpdate(s,i,t,n)}}componentDidUpdate(e){const{columns:t}=this.props;t!==e.columns&&this.updateColumns()}inputFilterRef;handleChange({column:e,isValueShown:t=!1,value:n}){let s,i;e!=null&&({name:s,type:i}=e);let o=!0,a=Date.now();this.setState(({panelState:r,timestamp:c,wasFlipped:h,skipUpdate:u})=>{const m=r!=null&&t!==r.isValueShown&&s===r.name&&i===r.type&&n===r.value;return o=(!u&&t&&(!m||!h))??!1,o||(a=c),{panelState:{isValueShown:t,name:s,type:i,value:n,timestamp:a},timestamp:a,wasFlipped:m,skipUpdate:!1}},()=>{o&&this.sendUpdate(s,i,n,a)})}handleClearAllFilters(){this.inputFilterRef.current?.clearFilter()}sendUpdate(e,t,n,s){const{glEventHub:i}=this.props;i.emit(Je.FILTERS_CHANGED,this,{name:e,type:t,value:n,timestamp:s})}setPanelState(e,t=!1){this.setState({skipUpdate:!t}),this.inputFilterRef.current?.setFilterState(e)}updateColumns(){const{columns:e}=this.props;e!=null&&this.setState(t=>{const{column:n}=t;return n==null&&e.length>0?{columns:[...e],column:e[0]}:n!=null&&!e.find(({name:s,type:i})=>n.name===s&&n.type===i)?{columns:[...e,n]}:{columns:[...e]}})}render(){const{glContainer:e,glEventHub:t}=this.props,{column:n,columns:s,isValueShown:i,value:o}=this.state;return l.jsx(as,{className:"iris-input-filter-panel",componentPanel:this,glContainer:e,glEventHub:t,onClearAllFilters:this.handleClearAllFilters,isClonable:!0,isRenamable:!0,children:l.jsx(tI,{ref:this.inputFilterRef,column:n,columns:s,onChange:this.handleChange,isValueShown:i,value:o})})}}const iI=(d,e)=>{const{localDashboardId:t}=e;return{columns:Mm(d,t)}},oI=wt(iI,null,null,{forwardRef:!0})(sI),Eo=oI;const yt=Z.module("FilterSetManagerPanel");function aI(d){return d.setPanelState!=null}class er extends b.Component{static defaultProps={panelState:null};static COMPONENT="FilterSetManagerPanel";static changeFilterIndexesToColumnNames(e,t){return t.map(([n,s])=>{if(n>=e.columns.length)return null;const{name:i}=e.columns[n];return{name:i,filter:s}}).filter(n=>n!=null)}constructor(e){super(e),this.handleChange=this.handleChange.bind(this),this.handleFilterApply=this.handleFilterApply.bind(this),this.handleSetsUpdate=this.handleSetsUpdate.bind(this),this.handleGetFilterState=this.handleGetFilterState.bind(this);const{panelState:t,filterSets:n}=e,{selectedId:s=n.length>0?n[0].id:void 0,isValueShown:i=!1}=t??{};this.state={selectedId:s,isValueShown:i,panelState:t}}getFilterState(){const{dashboardOpenedPanelMap:e}=this.props,t=[];return[...e.keys()].forEach(n=>{const s=e.get(n);if(s===void 0){yt.error("Could not get panel",s);return}const i=q.getComponentNameFromPanel(s),o=q.getIdFromPanel(s);yt.debug("Panel:",s,i);const{glContainer:a=null}=s.props;if(a==null){yt.error("Could not get panel container",s);return}const r=q.getComponentConfigFromContainer(a);if(r==null){yt.error("Could not get component config from container",a);return}const c=q.getPanelComponentState(r);if(c==null){yt.debug(`Panel state is null ${o}`);return}switch(i){case q.getComponentName(yl):{let h;o!=null&&(h=this.getIrisGridPanelFilters(o,c)),h!=null&&t.push({panelId:o,type:i,state:h});break}case q.getComponentName(Eo):case q.getComponentName(ai):{const{isValueShown:h,name:u,type:m,value:g}=c;t.push({panelId:o,type:i,state:{isValueShown:h,name:u,type:m,value:g}});break}}}),t}getIrisGridPanelFilters(e,t){const{panelTableMap:n}=this.props,s=n.get(e);if(s==null)return yt.error(`Unable to get table for panel ${e}.`),null;const{irisGridState:i={advancedFilters:void 0,quickFilters:void 0},gridState:o={}}=t,{advancedFilters:a,quickFilters:r}=i;let c;a&&(c=er.changeFilterIndexesToColumnNames(s,a));let h;return r&&(h=er.changeFilterIndexesToColumnNames(s,r)),{irisGridState:{...i,advancedFilters:c,quickFilters:h},gridState:{...o}}}handleGetFilterState(){return this.getFilterState()}handleChange({isValueShown:e,selectedId:t}){yt.debug("handleChange",e,t),this.setState({isValueShown:e,selectedId:t}),this.updatePanelState()}handleFilterApply(e){const{dashboardOpenedPanelMap:t}=this.props,{panels:n,restoreFullState:s=!1}=e;yt.debug("Apply filters from filter set",e),n.forEach(({panelId:i,type:o,state:a})=>{if(i==null){yt.debug("panel is null",i);return}if(!t.has(i)){yt.debug("Ignore closed panel",i);return}yt.debug("Apply panel filters",i,o,a);const r=t.get(i);switch(o){case q.getComponentName(yl):this.restoreIrisGridFilters(r,a,s);break;case q.getComponentName(Eo):case q.getComponentName(ai):this.restoreInputFilterState(r,a);break}})}handleSetsUpdate(e){const{setDashboardFilterSets:t,localDashboardId:n}=this.props;yt.debug("Saving updated sets",e),t(n,[...e])}updatePanelState(){this.setState(({selectedId:e,isValueShown:t})=>({panelState:{selectedId:e,isValueShown:t}}))}restoreIrisGridFilters(e,t,n){const{irisGridState:s={},advancedFilters:i=[],quickFilters:o=[]}=t,{advancedFilters:a=i,quickFilters:r=o}=s,{panelTableMap:c}=this.props,h=q.getIdFromPanel(e);if(h==null){yt.error("Panel Id is null.");return}if(c.get(h)==null){yt.error(`Unable to get table for panel ${h}.`);return}yt.debug("restoreIrisGridFilters",h,t,n),n?e.setStateOverrides(t):e.setFilters({quickFilters:r,advancedFilters:a})}restoreInputFilterState(e,t){const n={...t};delete n.isValueShown,yt.debug("restoreInputFilterState",e,n),e&&aI(e)&&e.setPanelState(n)}render(){const{glContainer:e,glEventHub:t,filterSets:n}=this.props,{isValueShown:s,selectedId:i}=this.state;return l.jsx(as,{className:"filter-set-manager-panel",componentPanel:this,glContainer:e,glEventHub:t,isClonable:!0,isRenamable:!0,children:l.jsx("div",{className:"input-filter-container h-100 w-100 container",children:l.jsx(YR,{onChange:this.handleChange,onApply:this.handleFilterApply,onUpdateSets:this.handleSetsUpdate,isValueShown:s,filterSets:n,selectedId:i,getFilterState:this.handleGetFilterState})})})}}const rI=(d,e)=>{const{localDashboardId:t}=e;return{filterSets:lR(d,t),dashboardOpenedPanelMap:am(d,t),dashboardInputFilters:Rc(d,t),panelTableMap:Ic(d,t)}},lI=wt(rI,{setDashboardFilterSets:fR},null,{forwardRef:!0})(er),Jr=lI;const gh=Z.module("LogPanel");class cI extends b.PureComponent{static defaultProps={session:null};static COMPONENT="LogPanel";static TITLE="Log";constructor(e){super(e),this.handleResize=this.handleResize.bind(this),this.handleShow=this.handleShow.bind(this),this.handleHide=this.handleHide.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.isBottomVisible=!0,this.logView=null;const{session:t}=this.props;this.state={session:t}}isBottomVisible;logView;handleResize(){this.updateDimensions()}handleShow(){this.updateDimensions(),this.logView&&(this.logView.triggerFindWidget(),this.isBottomVisible&&this.logView.scrollToBottom())}handleHide(){this.logView&&(this.isBottomVisible=this.logView.isBottomVisible())}handleSessionOpened(e){gh.debug("Session opened",[e]),this.setState({session:e})}handleSessionClosed(e){gh.debug("Session closed",e)}updateDimensions(){this.logView&&this.logView.updateDimensions()}render(){const{glContainer:e,glEventHub:t}=this.props,{session:n}=this.state;return l.jsxs(as,{componentPanel:this,glContainer:e,glEventHub:t,onResize:this.handleResize,onHide:this.handleHide,onShow:this.handleShow,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,children:[n==null&&l.jsx("div",{className:"log-panel-disconnected-message",children:"Waiting for session connection"}),n!=null&&l.jsx(OS,{session:n,ref:s=>{this.logView=s}})]})}}const dI=(d,e)=>({session:ci(d,e.localDashboardId)?.session}),hI=wt(dI,null,null,{forwardRef:!0})(cI),tr=hI;class uI extends b.PureComponent{static defaultProps={isEditing:!1};render(){const{isEditing:e,children:t,onDoubleClick:n}=this.props;return l.jsxs("div",{className:"markdown-editor-container h-100 w-100",onDoubleClick:n,children:[l.jsx("div",{className:U("text-muted","edit-hint",{viewing:e===void 0||!e}),children:l.jsxs("span",{children:["double-click to edit ",l.jsx(Q,{icon:Oo})]})}),t]})}}const mI=Z.module("MarkdownStartPage");class gI extends b.PureComponent{static defaultProps={closedMarkdowns:[],onOpen:()=>{},onCreate:()=>{},onDelete:()=>{}};constructor(e){super(e),this.handleDeleteButtonClick=this.handleDeleteButtonClick.bind(this),this.handleDeleteModalClose=this.handleDeleteModalClose.bind(this),this.state={isDeleteModalShown:!1}}handleDeleteButtonClick(e){this.setState({isDeleteModalShown:!0,toBeDeleted:e})}handleDeleteModalClose(){this.setState({isDeleteModalShown:!1,toBeDeleted:void 0})}handleDeleteMarkdown(e){if(mI.debug("delete markdown: ",e),e!==void 0){const{onDelete:t}=this.props;t(e)}this.setState({isDeleteModalShown:!1,toBeDeleted:void 0})}render(){const{closedMarkdowns:e,onOpen:t,onCreate:n}=this.props,{isDeleteModalShown:s,toBeDeleted:i}=this.state;return l.jsx("div",{className:"markdown-panel-start-page h-100 w-100",children:l.jsxs("div",{className:"markdown-panel-start-page-container",children:[l.jsxs("div",{className:"markdown-panel-start-list",children:[l.jsx("h3",{className:"list-title",children:"Start"}),l.jsx("div",{className:"list-item",children:l.jsx(V,{kind:"ghost",className:"title",onClick:n,children:"New Markdown Note"})})]}),l.jsxs("div",{className:"markdown-panel-start-list",children:[l.jsx("h3",{className:"list-title",children:"Recently Closed from Dashboard"}),e.map(o=>l.jsxs("div",{className:"list-item",children:[l.jsx(V,{kind:"ghost",className:"title",onClick:()=>t(o),children:o.title}),l.jsx("button",{className:"btn-link icon",type:"button",onClick:()=>{this.handleDeleteButtonClick(o)},children:l.jsx(Q,{icon:tn})})]},o.id)),l.jsxs(Wi,{isOpen:s,toggle:this.handleDeleteModalClose,className:"modal-dialog-centered markdown-delete-modal theme-bg-light",children:[l.jsx(No,{children:"Are you sure you want to permanently delete this note?"}),l.jsx(Gi,{children:"You can't undo this action."}),l.jsxs(Hl,{children:[l.jsx(V,{kind:"secondary",onClick:this.handleDeleteModalClose,children:"Cancel"}),l.jsx(V,{kind:"danger",onClick:()=>{this.handleDeleteMarkdown(i)},children:"Delete"})]})]})]})]})})}}const pI=gI,fI=d=>{const{children:e,className:t}=d,n=t!==void 0&&t?.startsWith("language-")?t.substring(9):"plaintext";return l.jsx("pre",{children:l.jsx("code",{children:l.jsx(pr,{language:n,children:J.Children.map(e,s=>typeof s=="string"?s.trim():s)})})})};class CI extends b.PureComponent{static defaultProps={isEditing:!1,content:""};constructor(e){super(e),this.container=null}container;render(){const{isEditing:e,content:t,onEditorInitialized:n}=this.props;return l.jsx("div",{className:"markdown-editor-container",ref:s=>{this.container=s},children:e?l.jsx(Ql,{settings:{language:"markdown",value:t,lineNumbers:"off"},onEditorInitialized:n}):l.jsx(Ah,{components:{code:fI},children:t})})}}const ba=Z.module("MarkdownPanel");class SI extends b.Component{static defaultProps={panelState:null};static COMPONENT="MarkdownPanel";constructor(e){super(e),this.handleContainerDoubleClick=this.handleContainerDoubleClick.bind(this),this.handleCreateMarkdown=this.handleCreateMarkdown.bind(this),this.handleDeleteMarkdown=this.handleDeleteMarkdown.bind(this),this.handleOpenMarkdown=this.handleOpenMarkdown.bind(this),this.handleEditorInitialized=this.handleEditorInitialized.bind(this),this.handleEditorBlur=this.handleEditorBlur.bind(this),this.handleEditorResize=this.handleEditorResize.bind(this);const{panelState:t}=e;let n=null;t!=null&&t.content!=null&&({content:n}=t),this.state={isStartPageShown:n==null,isEditing:!1,content:n,panelState:t},this.markdownEditor=null}markdownEditor;editor;setEditorPosition(e){N(this.markdownEditor);const{container:t}=this.markdownEditor;if(this.editor&&t){const n=t.getBoundingClientRect().top,s=t.scrollTop,i=t.scrollHeight,o=this.editor.getModel()?.getLineCount()??0;let a=Math.round((s+e-n)/i*o);a>o&&(a=o),this.editor.revealLine(a),this.editor.setPosition({lineNumber:a,column:1}),this.editor.focus()}}getClosedMarkdowns=pe(e=>e.filter(t=>t.component==="MarkdownPanel").reverse());handleContainerDoubleClick(e){const{isEditing:t}=this.state,n=e.clientY;t||this.setState({isEditing:!0},()=>{this.setEditorPosition(n)})}handleEditorInitialized(e){ba.debug("Markdown Editor Initialized..."),this.editor=e}handleCreateMarkdown(){ba.debug("create markdown..."),this.setState({isStartPageShown:!1,content:"",isEditing:!0,panelState:{content:""}},()=>{this.editor!=null&&this.editor.focus!=null&&this.editor.focus()})}handleOpenMarkdown(e){ba.debug("open markdown...",e);const{glContainer:t,glEventHub:n}=this.props,s=q.getComponentConfigFromContainer(t);n.emit(Ee.REOPEN,e,s)}handleDeleteMarkdown(e){const{glEventHub:t}=this.props;t.emit(Ee.DELETE,e)}handleEditorBlur(e){ba.debug("markdown content changed, saving...");const{isEditing:t}=this.state;if(!t||this.markdownEditor!=null&&this.markdownEditor.container!=null&&this.markdownEditor.container.contains(e.relatedTarget))return;const n=this.editor?.getValue();this.setState({content:n,isEditing:!1,panelState:{content:n}})}handleEditorResize(){const{isEditing:e}=this.state;e&&this.editor&&this.editor.layout()}render(){const{glContainer:e,glEventHub:t,closedPanels:n}=this.props,{isEditing:s,isStartPageShown:i,content:o}=this.state,a=this.getClosedMarkdowns(n);return l.jsx(as,{glContainer:e,glEventHub:t,className:"markdown-panel",componentPanel:this,onResize:this.handleEditorResize,onBlur:this.handleEditorBlur,isClonable:!0,isRenamable:!0,children:i?l.jsx(pI,{closedMarkdowns:a,onCreate:this.handleCreateMarkdown,onOpen:this.handleOpenMarkdown,onDelete:this.handleDeleteMarkdown}):l.jsx(uI,{isEditing:s,onDoubleClick:this.handleContainerDoubleClick,children:l.jsx(CI,{ref:r=>{this.markdownEditor=r},isEditing:s,content:o??void 0,onEditorInitialized:this.handleEditorInitialized})})})}}const bI=(d,e)=>{const{localDashboardId:t}=e;return{closedPanels:pv(d,t)}},wI=wt(bI,null,null,{forwardRef:!0})(SI),ho=wI;class vI extends b.PureComponent{static defaultProps={onRunCode:()=>{}};constructor(e){super(e),this.handleRunSelected=this.handleRunSelected.bind(this),this.renderCodeBlock=this.renderCodeBlock.bind(this),this.renderLink=this.renderLink.bind(this),this.commands=new Map,this.codeElements=new Map,this.editorScrollView=J.createRef(),this.state={hasCode:!1,hasRunCode:!1,nextStartLine:null}}componentDidMount(){this.updateHasCode()}componentDidUpdate(){this.updateHasCode()}commands;codeElements;editorScrollView;updateHasCode(){const{hasCode:e}=this.state;this.commands.size===0&&e?this.setState({hasCode:!1}):this.commands.size>0&&!e&&this.setState({hasCode:!0})}getNextStartLine(e){const t=[...this.commands.keys()],n=t.findIndex(s=>s===e)+1;return n>=t.length?null:t[n]}handleRunSelected(e){e.preventDefault(),e.stopPropagation();const{nextStartLine:t}=this.state,n=[...this.commands.keys()],s=n.findIndex(h=>h===t||t==null);if(s<0)return;const i=n[s],o=this.commands.get(i),a=this.getNextStartLine(i),c=this.codeElements.get(i)?.current?.parentElement?.nextElementSibling;if(c!=null){const{offsetTop:h}=c,u=h;this.editorScrollView.current?.scroll({top:u,left:0})}this.runCode(o),this.setState({nextStartLine:a})}runCode(e){const{onRunCode:t}=this.props;t(e),this.setState({hasRunCode:!0})}renderCodeBlock(e){const{children:t,className:n,inline:s,node:i}=e,{hasRunCode:o,nextStartLine:a}=this.state,{children:r,position:c}=i;N(c);const{start:h}=c,{line:u}=h,m=r[0].value,g=J.createRef(),p=this.commands.size===0,C=a===u||p&&a==null&&!o,f=n!==void 0&&n.startsWith("language-")?n.substring(9):"plaintext";return s!=null&&s?l.jsx("code",{className:n,children:t}):(this.commands.set(u,m),this.codeElements.set(u,g),l.jsxs("div",{className:U("markdown-notebook-code-block",{"is-selected":C}),ref:g,onClick:()=>{this.setState({nextStartLine:u})},role:"presentation",children:[l.jsx(V,{kind:"ghost",icon:Da,className:"btn-play-block",onClick:S=>{S.stopPropagation(),S.preventDefault(),this.runCode(m),this.setState({nextStartLine:u})},tooltip:"Run code"}),l.jsx("code",{children:l.jsx(pr,{language:f,children:J.Children.map(t,S=>typeof S=="string"?S.trim():S)})})]}))}renderLink(e){const{onLinkClick:t}=this.props,{href:n,children:s,target:i}=e;return l.jsx("a",{href:n,onClick:t,target:i,children:s})}render(){const{content:e,transformImageUri:t,transformLinkUri:n}=this.props,{hasCode:s,hasRunCode:i,nextStartLine:o}=this.state;return l.jsxs("div",{className:"markdown-notebook",children:[l.jsx("div",{className:"markdown-notebook-toolbar",children:l.jsx(V,{className:U("btn-play-selected-cell",{flashing:s&&!i}),kind:"ghost",icon:Da,onClick:this.handleRunSelected,tooltip:"Run code and select next",disabled:i&&o==null||!s,children:"Run Selected Code"})}),l.jsx("div",{className:"markdown-notebook-content",ref:this.editorScrollView,children:l.jsx(Ah,{components:{code:this.renderCodeBlock,a:this.renderLink},linkTarget:"_blank",remarkPlugins:[xg],transformLinkUri:n,transformImageUri:t,includeElementIndex:!0,children:e})})]})}}const TI=vI;const je=Z.module("NotebookPanel"),ph=400;class ti extends b.Component{static COMPONENT="NotebookPanel";static POPPER_OPTIONS={placement:"bottom-end"};static DEFAULT_NAME="Untitled";static handleError(e){we.isCanceled(e)||je.error(e)}static defaultProps={isDashboardActive:!0,isPreview:!1,session:null,sessionLanguage:null,defaultNotebookSettings:null};static languageFromFileName(e){switch(Ce.getExtension(e).toLowerCase()){case"py":case"python":return"python";case"groovy":return"groovy";case"scala":return"scala";default:return null}}constructor(e){super(e),this.handleBlur=this.handleBlur.bind(this),this.handleCloseCancel=this.handleCloseCancel.bind(this),this.handleCloseDiscard=this.handleCloseDiscard.bind(this),this.handleCloseSave=this.handleCloseSave.bind(this),this.handleCopy=this.handleCopy.bind(this),this.handleEditorInitialized=this.handleEditorInitialized.bind(this),this.handleEditorWillDestroy=this.handleEditorWillDestroy.bind(this),this.handleEditorChange=this.handleEditorChange.bind(this),this.handleFind=this.handleFind.bind(this),this.handleMinimapChange=this.handleMinimapChange.bind(this),this.handleWordWrapChange=this.handleWordWrapChange.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleLinkClick=this.handleLinkClick.bind(this),this.handleLoadSuccess=this.handleLoadSuccess.bind(this),this.handleLoadError=this.handleLoadError.bind(this),this.handleTabClick=this.handleTabClick.bind(this),this.handleRenameFile=this.handleRenameFile.bind(this),this.handleResize=this.handleResize.bind(this),this.handleRunCommand=this.handleRunCommand.bind(this),this.handleRunAll=this.handleRunAll.bind(this),this.handleRunSelected=this.handleRunSelected.bind(this),this.handleSave=this.handleSave.bind(this),this.handleSaveAsCancel=this.handleSaveAsCancel.bind(this),this.handleSaveAsSubmit=this.handleSaveAsSubmit.bind(this),this.handleSaveError=this.handleSaveError.bind(this),this.handleSaveSuccess=this.handleSaveSuccess.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleShow=this.handleShow.bind(this),this.handleShowRename=this.handleShowRename.bind(this),this.handleTab=this.handleTab.bind(this),this.handleTabFocus=this.handleTabFocus.bind(this),this.handleTabBlur=this.handleTabBlur.bind(this),this.handleTransformLinkUri=this.handleTransformLinkUri.bind(this),this.handleOverwrite=this.handleOverwrite.bind(this),this.handlePreviewPromotion=this.handlePreviewPromotion.bind(this),this.getDropdownOverflowActions=this.getDropdownOverflowActions.bind(this),this.pending=new os,this.debouncedSavePanelState=Xe(this.savePanelState.bind(this),ph),this.debouncedLoad=Xe(this.load.bind(this),ph),this.notebook=null,this.tabTitleElement=null,this.tabInitOnce=!1;const{isDashboardActive:t,session:n,sessionLanguage:s,panelState:i}=e;let o={value:"",language:"",wordWrap:"off"},a=null,{isPreview:r}=e;i!=null&&({fileMetadata:a=a,isPreview:r=r,settings:o=o}=i);const c=a!=null&&Ce.hasPath(a.itemName),u=c===!0&&o.value!=null||!c&&o.value!=null&&o.value.length>0?1:0;this.state={error:void 0,isDashboardActive:t,isFocused:!1,isLoading:!0,isLoaded:!1,isPreview:r,savedChangeCount:0,changeCount:u,fileMetadata:a,settings:o,session:n,sessionLanguage:s,panelState:{fileMetadata:a,settings:o},showCloseModal:!1,showSaveAsModal:!1,scriptCode:""},je.debug("constructor",e,this.state)}componentDidMount(){const{glContainer:e,glEventHub:t}=this.props,{tab:n}=e;n!=null&&this.initTab(n),this.initNotebookContent(),t.on(We.RENAME_FILE,this.handleRenameFile),e.on(We.PROMOTE_FROM_PREVIEW,this.handlePreviewPromotion)}componentDidUpdate(e,t){const{isPreview:n,settings:s}=this.state,{wordWrap:i}=s,{defaultNotebookSettings:o}=this.props;n!==t.isPreview&&this.setPreviewStatus(),i!==t.settings.wordWrap&&(this.updateEditorWordWrap(),this.debouncedSavePanelState()),o.isMinimapEnabled!==e.defaultNotebookSettings.isMinimapEnabled&&this.updateEditorMinimap()}componentWillUnmount(){this.debouncedSavePanelState.flush(),this.pending.cancel();const{glEventHub:e,glContainer:t}=this.props,{fileMetadata:n,isPreview:s}=this.state;e.off(We.RENAME_FILE,this.handleRenameFile),t.off(We.PROMOTE_FROM_PREVIEW,this.handlePreviewPromotion),e.emit(We.UNREGISTER_FILE,n,s)}pending;debouncedSavePanelState;debouncedLoad;notebook;tabTitleElement;tabInitOnce;editor;initTab(e){this.tabInitOnce||(this.tabInitOnce=!0,this.initTabCloseOverride()),this.initTabClasses(e)}initTabCloseOverride(){const{glContainer:e}=this.props;e.beforeClose(t=>{if(t?.force===!0)return!0;const{changeCount:n,savedChangeCount:s}=this.state;return n!==s?(this.setState({showCloseModal:!0}),!1):!0})}initTabClasses(e){const t=e.element.get(0);N(t);const n=t.querySelector(".lm_title");this.tabTitleElement=n,n?.classList.add("notebook-title"),this.setPreviewStatus()}getNotebookValue(){const{changeCount:e,savedChangeCount:t,settings:n}=this.state,{value:s}=n;if(e!==t&&this.notebook){const i=this.notebook.getValue();return i??s}return s}initNotebookContent(){const{fileMetadata:e,settings:t,isPreview:n}=this.state;if(e&&e.id){je.debug("Init content from file"),this.registerFileMetadata(e,n),this.load();return}if(t.value!=null){je.debug("Use content passed in the settings prop"),this.handleLoadSuccess();return}this.handleLoadError(new Error("Missing file metadata"))}closeFileTabById(e){const{glEventHub:t}=this.props;t.emit(We.CLOSE_FILE,{id:e})}registerFileMetadata(e,t){const{glEventHub:n,metadata:s}=this.props,{id:i}=s;n.emit(We.REGISTER_FILE,i,e,t)}renameTab(e,t){const{glEventHub:n}=this.props;n.emit(We.RENAME,e,t)}load(){const{fileMetadata:e,settings:t}=this.state;N(e);const{id:n}=e,{fileStorage:s}=this.props;this.pending.add(s.loadFile(n)).then(i=>{je.debug("Loaded file",i);const{filename:o}=i,{itemName:a}=this.state;if(o!==a){const{metadata:c}=this.props,{id:h}=c;this.renameTab(h,Ce.getBaseName(o))}const r={...t,language:ti.languageFromFileName(o)??""};t.value==null&&(r.value=i.content),t.wordWrap===void 0&&(t.wordWrap="off"),this.setState({fileMetadata:{id:o,itemName:o},settings:r}),this.debouncedSavePanelState()}).then(this.handleLoadSuccess).catch(this.handleLoadError)}save(){const{fileMetadata:e}=this.state;if(e&&Ce.hasPath(e.itemName)){const t=this.getNotebookValue();return t!==void 0?(this.saveContent(e.itemName,t),!0):!1}return this.setState({showSaveAsModal:!0}),!1}saveContent(e,t){je.debug("saveContent",e,t),this.updateSavedChangeCount();const{fileStorage:n}=this.props;this.pending.add(n.saveFile({filename:e,content:t,basename:e})).then(this.handleSaveSuccess).catch(this.handleSaveError)}updateSavedChangeCount(){this.setState(({changeCount:e})=>({savedChangeCount:e}))}setPreviewStatus(){if(!this.tabTitleElement)return;const{isPreview:e}=this.state;je.debug("setPreviewStatus",this.tabTitleElement,e),e?this.tabTitleElement.classList.add("is-preview"):this.tabTitleElement.classList.remove("is-preview")}handlePreviewPromotion(){this.removePreviewStatus()}getSettings=pe((e,t)=>({...e,minimap:{enabled:t}}));getOverflowActions=pe((e,t)=>[{title:"Find",icon:Lp,action:this.handleFind,group:oe.groups.high,shortcut:Ot.NOTEBOOK.FIND,order:10},{title:"Show Minimap",icon:e?es:void 0,action:this.handleMinimapChange,group:oe.groups.medium,shortcut:Ot.NOTEBOOK.MINIMAP,order:20},{title:"Word Wrap",icon:t?es:void 0,action:this.handleWordWrapChange,group:oe.groups.medium,shortcut:Ot.NOTEBOOK.WORDWRAP,order:30}]);savePanelState(){this.setState(e=>{const{changeCount:t,savedChangeCount:n,fileMetadata:s,isPreview:i,settings:o}=e,a=this.getNotebookValue(),r=t!==n?a:void 0,c={...o,value:a},u={settings:{...o,value:r},fileMetadata:s,isPreview:i};return je.debug("Saving panel state",u),{settings:c,panelState:u}})}handleCloseDiscard(){this.setState({showCloseModal:!1});const{glContainer:e}=this.props;e.close({force:!0})}handleCloseSave(){if(this.setState({showCloseModal:!1}),this.save()){const{glContainer:e}=this.props;e.close({force:!0})}}handleCloseCancel(){this.setState({showCloseModal:!1})}handleOverwrite(e){const{glEventHub:t}=this.props;t.emit(We.CLOSE_FILE,{id:e,itemName:e},{force:!0}),this.focus()}handleCopy(){const{fileMetadata:e,settings:t}=this.state;N(e);const n=this.getNotebookValue(),{language:s}=t,{itemName:i}=e,o=Ce.getCopyFileName(i);je.debug("handleCopy",e,i,o),this.createNotebook(o,s,n)}handleEditorInitialized(e){this.editor=e}handleEditorWillDestroy(){this.editor=void 0}handleEditorChange(e){je.debug2("handleEditorChanged",e),this.removePreviewStatus(),this.setState(t=>{const{changeCount:n,savedChangeCount:s}=t,{isUndoing:i,isRedoing:o}=e;return i?{changeCount:n-1,savedChangeCount:s}:!o&&n<s?{changeCount:n+1,savedChangeCount:0}:{changeCount:n+1,savedChangeCount:s}}),this.debouncedSavePanelState()}handleFind(){this.notebook&&this.notebook.toggleFind()}updateEditorMinimap(){if(this.editor){const{defaultNotebookSettings:e}=this.props;this.editor.updateOptions({minimap:{enabled:e.isMinimapEnabled}})}}handleMinimapChange(){const{settings:e,defaultNotebookSettings:t,saveSettings:n}=this.props,s={...e,defaultNotebookSettings:{isMinimapEnabled:!t.isMinimapEnabled}};n(s)}updateEditorWordWrap(){if(this.editor){const{settings:e}=this.state,{wordWrap:t}=e;this.editor.updateOptions({wordWrap:t})}}handleWordWrapChange(){this.editor&&this.setState(e=>{const{settings:t}=e,n=t.wordWrap==="on"?"off":"on";return{settings:{...t,wordWrap:n}}})}handleBlur(){je.debug("handleBlur"),this.setState({isFocused:!1})}handleFocus(){je.debug("handleFocus"),this.setState({isFocused:!0})}handleLinkClick(e){const{notebooksUrl:t,session:n,sessionLanguage:s}=this.props,{href:i}=e.currentTarget;if(!i||!i.startsWith(t))return;e.stopPropagation(),e.preventDefault();const o=`/${i.substring(t.length)}`.replace(/%20/g," ");if(o==="/"){je.debug("Ignoring invalid notebook link",o);return}je.debug("Notebook link clicked, opening",o);const{glEventHub:a}=this.props,r={value:null,language:s},c={id:o,itemName:o};a.emit(We.SELECT_NOTEBOOK,n,s,r,c)}handleLoadSuccess(){this.setState({error:void 0,isLoaded:!0,isLoading:!1})}handleLoadError(e){let t=e;we.isCanceled(t)||(we.isTimedOut(t)&&(t=new Error("File not found.")),je.error(t),this.setState({error:t,isLoading:!1}))}handleSave(){je.debug("handleSave"),this.save()}handleSaveSuccess(e){const{fileStorage:t}=this.props,n={id:e.filename,itemName:e.filename},s=ti.languageFromFileName(e.filename)??"";this.setState(i=>{const{fileMetadata:o}=i,a={...i.settings,language:s};return je.debug("handleSaveSuccess",n,o,a),o&&Ce.hasPath(o.itemName)&&o.itemName!==n.itemName&&(je.debug("handleSaveSuccess deleting old file",o.itemName),t.deleteFile(o.itemName).catch(ti.handleError)),{fileMetadata:n,settings:a,isPreview:!1}}),this.debouncedSavePanelState(),this.registerFileMetadata(n,!1)}handleSaveError(e){we.isCanceled(e)||(this.setState({savedChangeCount:0}),je.error(e))}handleSaveAsCancel(){this.setState({showSaveAsModal:!1})}handleSaveAsSubmit(e,t=!1){t&&this.handleOverwrite(e),je.debug("handleSaveAsSubmit",e);const{fileMetadata:n}=this.state;if(!n)return;const{itemName:s}=n,i=this.getNotebookValue()??"";if(this.setState({showSaveAsModal:!1}),Ce.getBaseName(s)!==Ce.getBaseName(e)){const{metadata:o}=this.props,{id:a}=o;this.renameTab(a,Ce.getBaseName(e))}this.saveContent(e,i)}handleRenameFile(e,t,n){const{fileMetadata:s,panelState:i}=this.state,{glContainer:o}=this.props;if(s?.itemName===`/${t}`&&n&&JSON.stringify(i)!==JSON.stringify(n)){o.close();return}s&&s.id===e&&(this.setState({fileMetadata:{id:t,itemName:t}}),this.debouncedSavePanelState())}handleResize(){this.notebook?.updateDimensions()}handleRunCommand(e){this.runCommand(e)}handleRunAll(){if(!this.notebook){je.error("Editor is not initialized.");return}this.runCommand(this.notebook.getValue()??void 0)}handleRunSelected(){if(!this.notebook){je.error("Editor is not initialized.");return}this.runCommand(this.notebook.getSelectedCommand())}handleSessionOpened(e,{language:t}){this.setState({session:e,sessionLanguage:t})}handleSessionClosed(){this.setState({session:void 0,sessionLanguage:void 0})}handleShow(){je.debug("handleShow"),this.notebook?.updateDimensions()}handleShowRename(){this.setState({showSaveAsModal:!0})}handleTab(e){je.debug("NotebookPanel tab event",e),this.initTab(e)}handleTabFocus(...e){je.debug("handleTabFocus",...e);const{glContainer:t}=this.props;this.setState({isDashboardActive:!0}),this.notebook&&!t.isHidden&&this.notebook.updateDimensions()}handleTabBlur(){je.debug("handleTabBlur"),this.setState({isDashboardActive:!1})}handleTabClick(e){je.debug("handle NotebookPanel tab click"),this.focus(),e.detail===2&&this.removePreviewStatus()}handleTransformLinkUri(e){const{notebooksUrl:t}=this.props,{fileMetadata:n}=this.state;if(e.endsWith("/"))return e;if(e.startsWith("/"))return`${t}${e.substring(1)}`;let s=n?.itemName;if(s===void 0)return e;s.charAt(0)==="/"&&(s=s.substring(1));const i=new URL(s,t);return new URL(e,i).href}focus(){requestAnimationFrame(()=>{this.notebook&&this.notebook.focus()})}createNotebook(e,t,n=""){const{glEventHub:s}=this.props,{session:i,sessionLanguage:o,settings:a}=this.state,r={...a,language:t,value:n},c={id:null,itemName:e};je.debug("handleCreateNotebook",i,o,r,c),s.emit(We.CREATE_NOTEBOOK,i,o,r,c)}runCommand(e){if(e===void 0||e===""){je.debug("Ignoring empty command.");return}this.removePreviewStatus();const{glEventHub:t}=this.props;t.emit(Qt.SEND_COMMAND,e,!1,!0)}removePreviewStatus(){this.setState(({isPreview:e})=>{if(e){const{fileMetadata:t}=this.state;return t&&this.registerFileMetadata(t,!1),{isPreview:!1}}return null})}getDropdownOverflowActions(){const{defaultNotebookSettings:e}=this.props,{settings:t}=this.state;return this.getOverflowActions(e.isMinimapEnabled,this.getSettings(t,e.isMinimapEnabled).wordWrap==="on")}render(){const{fileStorage:e,glContainer:t,glContainer:{tab:n},glEventHub:s,defaultNotebookSettings:i}=this.props,{changeCount:o,savedChangeCount:a,error:r,isDashboardActive:c,isLoaded:h,isLoading:u,isPreview:m,fileMetadata:g,session:p,sessionLanguage:C,settings:f,showCloseModal:S,showSaveAsModal:v}=this.state,w=c&&!t.isHidden&&!m,T=g?.itemName??ti.DEFAULT_NAME,y=T.endsWith(".md"),E=g?.id!=null,I=this.getSettings(f,i.isMinimapEnabled),D=p!=null,F=C===I.language,_=!h||!D||!F,L=!h,B=[{action:this.handleSave,shortcut:is.SAVE},{action:this.handleMinimapChange,shortcut:Ot.NOTEBOOK.MINIMAP},{action:this.handleWordWrapChange,shortcut:Ot.NOTEBOOK.WORDWRAP}],O=Ed.getDisabledRunTooltip(D,F,"Notebook extension","Run"),j=Ed.getDisabledRunTooltip(D,F,"Notebook extension","Run Selected"),k=[{title:E?"Rename":"Save As…",order:10,group:oe.groups.high,action:this.handleShowRename},{title:"Copy File",action:this.handleCopy,group:oe.groups.high,order:20}],A=n?.element.find(".lm_title_before").get(0);return l.jsxs(l.Fragment,{children:[A&&$i.createPortal(l.jsx("span",{className:U("editor-unsaved-indicator",{"is-unsaved":o!==a})}),A),l.jsxs(as,{className:"notebook-container",componentPanel:this,glContainer:t,glEventHub:s,onTab:this.handleTab,onResize:this.handleResize,onShow:this.handleShow,onTabClicked:this.handleTabClick,onTabFocus:this.handleTabFocus,onTabBlur:this.handleTabBlur,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onFocus:this.handleFocus,onBlur:this.handleBlur,additionalActions:k,renderTabTooltip:()=>T,children:[!y&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"notebook-toolbar",children:[l.jsxs("span",{children:[l.jsx(V,{kind:"ghost",className:"btn-play",onClick:this.handleRunAll,disabled:_,icon:l.jsx(Q,{icon:Da,transform:"grow-4"}),tooltip:`Run ${Ot.NOTEBOOK.RUN.getDisplayText()}`,"aria-label":"Run"}),O!=null&&l.jsx(tt,{children:O})]}),l.jsxs("span",{children:[l.jsx(V,{kind:"ghost",className:"btn-play",onClick:this.handleRunSelected,disabled:_,icon:l.jsx(Q,{icon:Pp,transform:"grow-4"}),tooltip:`Run Selected ${Ot.NOTEBOOK.RUN_SELECTED.getDisplayText()}`,"aria-label":"Run Selected"}),j!=null&&l.jsx(tt,{children:j})]}),l.jsx(V,{kind:"ghost",className:"mr-auto",disabled:L,onClick:this.handleSave,icon:Kh,tooltip:`Save ${is.SAVE.getDisplayText()}`,"aria-label":"Save"}),l.jsx(V,{kind:"ghost",className:"btn-overflow btn-link-icon",disabled:L,icon:Vh,tooltip:"More Actions...",onClick:()=>{},children:l.jsx(ts,{actions:this.getDropdownOverflowActions,popperOptions:ti.POPPER_OPTIONS})})]}),l.jsx(bS,{isLoaded:h,isLoading:u,error:r,onChange:this.handleEditorChange,onRunCommand:this.handleRunCommand,session:p,sessionLanguage:C,onEditorInitialized:this.handleEditorInitialized,onEditorWillDestroy:this.handleEditorWillDestroy,settings:I,focusOnMount:w,ref:H=>{this.notebook=H}})]}),y&&l.jsx(TI,{content:I.value??"",onLinkClick:this.handleLinkClick,onRunCode:this.handleRunCommand,transformImageUri:this.handleTransformLinkUri,transformLinkUri:this.handleTransformLinkUri}),l.jsx(Pm,{isOpen:v,type:"file",defaultValue:T,title:E?"Rename":"Save file as",onSubmit:this.handleSaveAsSubmit,onCancel:this.handleSaveAsCancel,notifyOnExtensionChange:!0,storage:e}),l.jsx(li,{isOpen:S,headerText:`Do you want to save the changes you made to ${T}?`,bodyText:"Your changes will be lost if you don't save them.",onCancel:this.handleCloseCancel,onDiscard:this.handleCloseDiscard,onConfirm:this.handleCloseSave,discardButtonText:"Discard Changes",confirmButtonText:"Save"}),l.jsx(oe,{actions:B})]})]})}}const EI=(d,e)=>{const t=wu(d),n=vt(d),s=pb(d),i=ci(d,e.localDashboardId),{session:o,config:a}=i??{},{type:r}=a??{};return{fileStorage:t,settings:n,defaultNotebookSettings:s,session:o,sessionLanguage:r}},yI=wt(EI,{saveSettings:Sr},null,{forwardRef:!0})(ti),ws=yI;class xI extends b.Component{static defaultProps={panelState:null};static COMPONENT="PandasPanel";constructor(e){super(e),this.irisGridRef=J.createRef(),this.buttonRef=J.createRef(),this.handleReload=this.handleReload.bind(this),this.handleGridStateChange=this.handleGridStateChange.bind(this),this.handlePanelStateUpdate=this.handlePanelStateUpdate.bind(this);const{panelState:t}=e;this.state={shouldFocusGrid:!1,panelState:t}}buttonRef;irisGridRef;handleReload(){this.irisGridRef.current?.initModel(),this.buttonRef.current?.blur(),this.setState({shouldFocusGrid:!0})}handleGridStateChange(){const{shouldFocusGrid:e}=this.state;e&&this.irisGridRef.current?.irisGrid?.current?.grid&&(this.irisGridRef.current.irisGrid.current.grid.focus(),this.setState({shouldFocusGrid:!1}))}handlePanelStateUpdate(e){this.setState({panelState:e})}render(){const{...e}=this.props;return l.jsx(ri,{ref:this.irisGridRef,onStateChange:this.handleGridStateChange,onPanelStateUpdate:this.handlePanelStateUpdate,...e,children:l.jsxs(V,{ref:this.buttonRef,kind:"primary",className:"btn-pandas",onClick:this.handleReload,tooltip:"Click to refresh pandas dataframe, updates do not occur automatically.",children:["pandas dataframe",l.jsxs("span",{children:[l.jsx(Q,{icon:Ll,transform:"shrink-1",className:"mr-1"}),"Reload"]})]})})}}const el=xI;function RI(d){Ps(d);const{id:e,layout:t,registerComponent:n,hydrate:s}=d,i=b.useCallback(({dragEvent:o,fetch:a,panelId:r=Ae.generate(),widget:c})=>{const{name:h,type:u}=c;if(u!==dh.VariableType.FIGURE)return;const m={name:h,figure:h},g=()=>a().then(f=>ja.makeModel(void 0,f)),p={type:"react-component",component:Hi.COMPONENT,props:{localDashboardId:e,id:r,metadata:m,makeModel:g},title:h,id:r},{root:C}=t;q.openComponent({root:C,config:p,dragEvent:o})},[e,t]);return b.useEffect(function(){const a=[n(Hi.COMPONENT,Hi,s)];return()=>{a.forEach(r=>r())}},[s,n]),Ge(t.eventHub,Ee.OPEN,i),null}function II(d){Ps(d);const{id:e,layout:t}=d,n=b.useCallback(({metadata:s,panelId:i=Ae.generate(),table:o})=>{const{settings:a}=s,r=()=>ja.makeModelFromSettings(a,o),c=et.titleFromSettings(a),h={type:"react-component",component:Hi.COMPONENT,props:{localDashboardId:e,id:i,metadata:s,makeModel:r},title:c,id:i},{root:u}=t;q.openComponent({root:u,config:h})},[e,t]);return Ge(t.eventHub,Sn.CREATE_CHART,n),null}const lt=Z.module("ConsolePlugin");function fh(d){return d.notebook!==void 0}function DI(d){Ps(d)}function FI(d){DI(d);const{id:e,hydrateConsole:t,layout:n,panelManager:s,registerComponent:i,notebooksUrl:o}=d,a=b.useRef(0),[r,c]=b.useState(new Map),[h,u]=b.useState(new Map),m=Nl(),g=b.useCallback(()=>s.getLastUsedPanelOfType(ki),[s]),p=b.useCallback((W,G)=>{c(te=>new Map(te.set(W,G)))},[c]),C=b.useCallback(W=>{c(G=>(G.delete(W),new Map(G)))},[c]),f=b.useCallback((W,G)=>{u(te=>new Map(te.set(W,G)))},[u]),S=b.useCallback(W=>{u(G=>(G.delete(W),new Map(G)))},[u]),v=b.useCallback((W,G=!0,te=!0)=>{if(!(W&&W.trim()))lt.info("Ignoring empty code");else{const ce=g();if(!ce||!(ce instanceof ki.WrappedComponent)){lt.error("Console panel not found");return}lt.debug("Send command: ",W,G,te),ce.addCommand(W,G,te)}},[g]),w=b.useCallback(W=>{m(pR(e,W))},[m,e]),T=b.useCallback(({language:W})=>{const G=W==="python"?"py":W;let te=null;return G==null?(lt.debug("No extension for language",W),te=`Untitled-${a.current}`):te=`Untitled-${a.current}.${G}`,a.current+=1,te},[]),y=b.useCallback((W,G=!0)=>{const{id:te}=W;if(te!=null&&r.has(te))return r.get(te);if(te!=null&&h.has(te))return h.get(te);if(G)return Ae.generate()},[r,h]),E=b.useCallback((W,G)=>{q.renameComponent(n.root,{id:W},G)},[n.root]),I=b.useCallback((W,G)=>{lt.debug("Rename file panel",W,G);let te;if(r.has(W)&&(te=r.get(W),C(W),te!=null&&p(G,te)),h.has(W)&&(te=h.get(W),S(W),te!=null&&f(G,te)),te===void 0){lt.debug2(`File ${W} isn't open, no need to rename the tab`);return}E(te,Ce.getBaseName(G))},[r,h,E,p,f,C,S]),D=b.useCallback(W=>{const G=y(W,!1);if(G==null){lt.error("Could not find panel id for file metadata",W);return}q.activateTab(n.root,{id:G})},[y,n.root]),F=b.useCallback((W,G,te)=>{if(lt.debug("registerFilePanel",W,G,te),G==null||G.id==null){lt.debug("Ignore empty file id",G);return}const{id:ie}=G;if(te){f(ie,W);return}if(r.has(ie)){const ce=r.get(ie);if(W===ce){lt.debug(`Update tab title for file ${ie}`);const{itemName:X}=G;I(ie,X)}else lt.error(`File ${ie} already associated with a different tab ${ce}`);return}p(ie,W),h.has(ie)&&S(ie)},[r,h,I,p,f,S]),_=b.useCallback((W,G)=>{if(lt.debug("unregisterFileTab",W,G),W==null||W.id==null){lt.debug("Ignore empty file id",W);return}const{id:te}=W;if(G){S(te);return}C(te)},[C,S]),L=b.useCallback((W,G)=>{lt.debug("closeFilePanel",W);const{id:te}=W;let ie=null,ce=!1;if(r.has(te))ie=r.get(te);else if(h.has(te))ie=h.get(te),ce=!0;else{lt.debug(`File ${te} isn't open, ignore close event`);return}_(W,ce),q.closeComponent(n.root,{id:ie},G)},[n.root,r,h,_]),B=b.useCallback(W=>{const{itemName:G}=W;return Ce.getBaseName(G)},[]),O=b.useCallback(W=>{const{id:G}=W;return lt.debug("fileIsOpen",W,G,r),G!=null&&r.has(G)},[r]),j=b.useCallback(W=>{const{id:G}=W;return lt.debug("fileIsOpenAsPreview",W,G,h),G!=null&&h.has(G)},[h]),k=b.useCallback(W=>{if(W==null)return;const G=s.getOpenedPanelById(W);G&&fh(G)&&G.focus()},[s]),A=b.useCallback(({id:W,settings:G,fileMetadata:te,session:ie,sessionLanguage:ce,isPreview:X=!1})=>{const re={settings:G,fileMetadata:te},ve=B(te);return{type:"react-component",component:ws.COMPONENT,isFocusOnShow:!1,props:{localDashboardId:e,metadata:{id:W},session:ie,sessionLanguage:ce,panelState:re,isPreview:X,notebooksUrl:o},title:ve,id:W}},[B,e,o]),H=b.useCallback((W,G,te,ie={id:null,itemName:T(te)})=>{const ce=y(ie);if(O(ie)&&ce!=null){lt.debug("File is already open, focus panel"),D(ie),k(ce);return}const X=q.getStackForComponentTypes(n.root,[ws.COMPONENT]),re=A({id:ce,settings:te,fileMetadata:ie,session:W,sessionLanguage:G});lt.debug("createNotebook",re,r),q.openComponentInStack(X,re)},[O,k,T,y,n.root,A,r,D]),z=b.useCallback((W,G,te,ie,ce=!1)=>{lt.debug("selectNotebook",ie,ce);const X=O(ie),re=j(ie),[ve]=[...h.values()],De=!ce,Re=De&&ve?ve:y(ie);if(Re==null||Re==="")throw new Error("Unable to retrieve or create panelId for metadata",ie);if(X||re)D(ie);else{const ft=q.getStackForComponentTypes(n.root,[ws.COMPONENT]),ht=A({id:Re,settings:te,fileMetadata:ie,session:W,sessionLanguage:G,isPreview:De});q.openComponentInStack(ft,ht)}if(re&&ce){const ft=ie.id,ht=q.getStackForConfig(n.root,{component:ws.COMPONENT,id:Re}),At=q.getContentItemInStack(ht,{component:ws.COMPONENT,id:Re});At&&$t(At)&&(At.container.emit(We.PROMOTE_FROM_PREVIEW),S(ft),p(ft,Re))}ce&&k(Re)},[D,O,j,k,y,n.root,A,h,S,p]),K=b.useCallback((W,G,te={},ie=!0)=>{const ce=s.getLastUsedPanelOfType(ws);ce&&fh(ce)?te!=null&&te.value!=null&&ce.notebook!=null&&ce.notebook.append(te.value):ie&&H(W,G,te)},[H,s]),ae=b.useCallback((W,G)=>bl.hydrate({...W,notebooksUrl:o},G),[o]);return b.useEffect(function(){const G=[i(ki.COMPONENT,ki,t),i(Ya.COMPONENT,Ya),i(Za.COMPONENT,Za),i(tr.COMPONENT,tr),i(ws.COMPONENT,ws,ae)];return()=>{G.forEach(te=>te())}},[i,t,ae]),Ge(n.eventHub,Qt.SEND_COMMAND,v),Ge(n.eventHub,Qt.SETTINGS_CHANGED,w),Ge(n.eventHub,We.CLOSE_FILE,L),Ge(n.eventHub,We.CREATE_NOTEBOOK,H),Ge(n.eventHub,We.SELECT_NOTEBOOK,z),Ge(n.eventHub,We.RENAME,E),Ge(n.eventHub,We.RENAME_FILE,I),Ge(n.eventHub,We.SEND_TO_NOTEBOOK,K),Ge(n.eventHub,We.REGISTER_FILE,F),Ge(n.eventHub,We.UNREGISTER_FILE,_),null}const uo=Z.module("FilterPlugin");function Ch(d,e){return d.concat(e)}function NI(d){Ps(d);const{id:e,layout:t,registerComponent:n}=d,s=Nl(),[i]=b.useState(()=>new Map),[o]=b.useState(()=>new Map),[a]=b.useState(()=>new Map),r=b.useCallback(()=>{const f=Array.from(i.values()).reduce(Ch,[]).sort((w,T)=>{const y=qt.toLower(w.name),E=qt.toLower(T.name);if(y!==E)return y>E?1:-1;const I=qt.toLower(w.type),D=qt.toLower(T.type);return I!==D?I>D?1:-1:0}).reduce((w,T)=>((w.length===0||qt.toLower(w[w.length-1].name)!==qt.toLower(T.name)||qt.toLower(w[w.length-1].type)!==qt.toLower(T.type))&&w.push(T),w),[]),S=Array.from(o.values()).reduce(Ch,[]).sort((w,T)=>w.timestamp-T.timestamp),v=new Map(a);uo.debug("sendUpdate",{columns:f,filters:S,tableMap:v}),s(Hn(e,{columns:f,filters:S,tableMap:v}))},[s,e,i,o,a]),c=b.useCallback((f,S)=>{uo.debug2("handleColumnsChanged",f,S),i.set(f,[].concat(S)),r()},[i,r]),h=b.useCallback((f,S)=>{uo.debug2("handleFiltersChanged",f,S),o.set(f,[].concat(S)),r()},[o,r]),u=b.useCallback((f,S)=>{uo.debug2("handleTableChanged",f,S),a.set(q.getIdFromPanel(f),S),r()},[a,r]),m=b.useCallback(f=>{uo.debug2("handlePanelUnmount",f),i.delete(f),o.delete(f),a.delete(q.getIdFromPanel(f)),r()},[i,o,a,r]),g=b.useCallback(({title:f="DropdownFilter",metadata:S={},panelState:v=null,id:w=Ae.generate(),focusElement:T=q.DEFAULT_FOCUS_SELECTOR,createNewStack:y=!1,dragEvent:E=null})=>{const I={type:"react-component",component:ai.COMPONENT,props:{id:w,metadata:S,panelState:v,localDashboardId:e},title:f,id:w},{root:D}=t;q.openComponent({root:D,config:I,focusElement:T,createNewStack:y,dragEvent:E})},[t,e]),p=b.useCallback(({title:f="InputFilter",metadata:S={},panelState:v=null,id:w=Ae.generate(),focusElement:T=q.DEFAULT_FOCUS_SELECTOR,createNewStack:y=!1,dragEvent:E=null})=>{const I={type:"react-component",component:Eo.COMPONENT,props:{id:w,metadata:S,panelState:v,localDashboardId:e},title:f,id:w},{root:D}=t;q.openComponent({root:D,config:I,focusElement:T,createNewStack:y,dragEvent:E})},[t,e]),C=b.useCallback(({title:f="FilterSets",metadata:S={},panelState:v=null,id:w=Ae.generate(),focusElement:T=q.DEFAULT_FOCUS_SELECTOR,createNewStack:y=!1,dragEvent:E=null})=>{const I={type:"react-component",component:Jr.COMPONENT,props:{id:w,metadata:S,panelState:v,localDashboardId:e},title:f,id:w},{root:D}=t;q.openComponent({root:D,config:I,focusElement:T,createNewStack:y,dragEvent:E})},[t,e]);return b.useEffect(function(){const S=[n(ai.COMPONENT,ai),n(Eo.COMPONENT,Eo),n(Jr.COMPONENT,Jr)];return()=>{S.forEach(v=>v())}},[n]),Ge(t.eventHub,Je.COLUMNS_CHANGED,c),Ge(t.eventHub,Je.FILTERS_CHANGED,h),Ge(t.eventHub,Je.TABLE_CHANGED,u),Ge(t.eventHub,Je.OPEN_DROPDOWN,g),Ge(t.eventHub,Je.OPEN_INPUT,p),Ge(t.eventHub,Je.OPEN_FILTER_SET_MANAGER,C),Ge(t.eventHub,Ee.UNMOUNT,m),null}const MI=[dh.VariableType.TABLE,dh.VariableType.TREETABLE,dh.VariableType.HIERARCHICALTABLE];function kI(d){Ps(d);const{getDownloadWorker:e,loadPlugin:t,id:n,layout:s,registerComponent:i,hydrate:o,theme:a}=d,r=b.useCallback(({dragEvent:c,fetch:h,panelId:u=Ae.generate(),widget:m})=>{const{name:g,type:p}=m;if(!MI.includes(p))return;const C={name:g,table:g,type:m.type},f=()=>h().then(w=>yc.makeModel(w)),S={type:"react-component",component:ri.COMPONENT,props:{getDownloadWorker:e,loadPlugin:t,localDashboardId:n,id:u,metadata:C,makeModel:f,theme:a},title:g,id:u},{root:v}=s;q.openComponent({root:v,config:S,dragEvent:c})},[e,n,s,t,a]);return b.useEffect(function(){const h=[i(ri.COMPONENT,ri,o)];return()=>{h.forEach(u=>u())}},[o,i]),Ge(s.eventHub,Ee.OPEN,r),null}function _m(d){return typeof d.getCoordinateForColumn=="function"}function Sh(d){const e=d;return _m(d)&&typeof e.setFilterMap=="function"&&typeof e.unsetFilterValue=="function"}function bh(d){return d.description===void 0||!d.description?.startsWith("Preview of type: ")}const mo=Z.module("LinkerUtils");class Pc{static ALLOWED_LINKS=new Map([[q.getComponentName(ri),[q.getComponentName(ri),q.getComponentName(Hi),q.getComponentName(ai)]]]);static getLinkType(e,t,n){if(e?.panelId==null||t?.panelId==null||e.panelId===t.panelId||n!=null&&n!==e.panelId&&n!==t.panelId)return mo.debug2("Incompatible panel ids",e,t,n),"invalid";if(e.panelComponent==null||t.panelComponent==null)return mo.error("PanelComponent should not be null",e,t),"invalid";const s=Pc.ALLOWED_LINKS.get(e.panelComponent)?.includes(t.panelComponent);if(s===void 0||!s)return mo.debug2("Incompatible panel components",e,t),"invalid";const{columnType:i}=e,{columnType:o}=t;if(!(o===null||R.isCompatibleType(i,o)))return mo.debug2("Incompatible type",i,o),"invalid";switch(t.panelComponent){case q.getComponentName(Hi):case q.getComponentName(ri):return"tableLink";case q.getComponentName(ai):return"filterSource"}return mo.debug2("Incompatible target panel component",t.panelComponent),"invalid"}static findColumn(e,{columnName:t,columnType:n}){return e.find(({name:s,type:i})=>s===t&&i===n)}static cloneLinksForPanel(e,t,n){const s=[];return e.forEach(i=>{i.start.panelId===t&&i.type!=="filterSource"?s.push({...i,id:Ae.generate(),start:{...i.start,panelId:n}}):i.end?.panelId===t&&s.push({...i,id:Ae.generate(),end:{...i.end,panelId:n}})}),s}}const xi=Pc;const OI=Z.module("LinkerLink"),wh=.015,vh=1.5,jm=12,Hm=12,Th=2,wa=Math.sqrt((Hm*.5)**2+jm**2),Eh=Math.asin(Hm*.5/jm),yh=15,vs=Math.PI*.5;class yo extends b.Component{static defaultProps={className:"",isSelected:!1,onClick(){},onDelete(){}};static makeCirclePath(e,t,n){return`M ${e} ${t} m -${n},0 a ${n},${n} 0 1,0 ${n*2},0 a ${n},${n} 0 1,0 -${n*2},0 z`}static getLabelForLinkFilter(e,t){try{if(R.isNumberType(e)||R.isCharType(e))return gu(t);if(R.isTextType(e))return mu(t);if(R.isDateType(e))return pu(t);if(R.isBooleanType(e)){if(t===Y.eq)return"is equal to";if(t===Y.notEq)return"is not equal to"}throw new Error(`Unrecognized column type: ${e}`)}catch(n){return OI.warn(n),""}}constructor(e){super(e),this.handleClick=this.handleClick.bind(this),this.handleMouseEnter=this.handleMouseEnter.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleDelete=this.handleDelete.bind(this),this.getDropdownActions=this.getDropdownActions.bind(this),this.state={isHovering:void 0}}getOperators=pe((e,t)=>{const{onOperatorChanged:n}=this.props;let s=R.getFilterTypes(t);return R.isBooleanType(t)&&(s=[Y.eq,Y.notEq]),s.flatMap((i,o)=>{if(i==="eqIgnoreCase"||i==="notEqIgnoreCase")return[];let a="";return i==="startsWith"?a="a*":i==="endsWith"?a="*z":a=R.getFilterOperatorString(i),[{title:yo.getLabelForLinkFilter(t,i),icon:l.jsx("b",{children:a}),action:()=>n(e,i),order:o}]})});handleClick(e){e.stopPropagation(),e.preventDefault();const{id:t,onClick:n,onDelete:s}=this.props;e.altKey?s(t):n(t)}handleMouseEnter(){this.setState({isHovering:!0})}handleMouseLeave(){this.setState({isHovering:!1})}handleDelete(){const{id:e,onDelete:t}=this.props;t(e)}getDropdownActions(){const{id:e,startColumnType:t}=this.props;return t!=null?this.getOperators(e,t):[]}render(){const{className:e,operator:t,isSelected:n,x1:s,y1:i,x2:o,y2:a,id:r,startColumnType:c}=this.props,{isHovering:h}=this.state,u=Math.sqrt((s-o)**2+(i-a)**2),m=Math.atan2(a-i,o-s),g=Math.sin(m),p=Math.cos(m)+2,C=window.innerWidth,f=window.innerHeight,S=0,v=0,w=Math.max(S,Math.min(s+(o-s)/2+g*(u*wh)**vh,C)),T=Math.max(v,Math.min(i+(a-i)/2+p*(u*wh)**vh,f)),y=`M ${s} ${i} Q ${w} ${T} ${o} ${a}`,E=`M ${S} ${v} L ${S} ${f} L ${C} ${f} L ${C} ${v} z
|
|
35
35
|
${yo.makeCirclePath(s,i,yh)}
|
|
36
|
-
${yo.makeCirclePath(o,a,yh)}`,I=`link-select-clip-${r}`,D=Math.atan2(a-T,o-w),F=D-Eh+Math.PI,_=D+Eh+Math.PI,L=o+Math.cos(D)*Th,B=a+Math.sin(D)*Th,O=L+Math.cos(F)*wa,j=B+Math.sin(F)*wa,k=L+Math.cos(_)*wa,A=B+Math.sin(_)*wa,H=`${L},${B} ${O},${j} ${k},${A}`,z=.25*s+.5*w+.25*o,K=.25*i+.5*T+.25*a,ae=w-s+(o-w),G=(T-i+(a-T))/ae;let ie=20/Math.sqrt(1+G**2),ce=ie*G,X=ie*-1,re=ce*-1;Number.isFinite(G)?G>0?(ie*=-1,ce*=-1,X*=-1,re*=-1,X-=50-10*(Math.abs(m)%vs),re+=10*(Math.abs(m)%vs),ie-=50-10*(Math.abs(m)%vs),ce+=10*(Math.abs(m)%vs)):G<0?(X+=10*(Math.abs(m)%vs),re+=10*(Math.abs(m)%vs),ie+=10*(Math.abs(m)%vs),ce+=10*(Math.abs(m)%vs)):(X=15,re=10,ie=-25,ce=10):(X=10,re=5,ie=10,ce=-35);let ve="";return t!==void 0&&(t==="startsWith"?ve="a*":t==="endsWith"?ve="*z":ve=R.getFilterOperatorString(t)),l.jsxs(l.Fragment,{children:[l.jsxs("svg",{className:U(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:H})]}),c!=null&&n&&l.jsxs(l.Fragment,{children:[l.jsx(V,{kind:"primary",className:"btn-fab btn-operator",style:{top:K+(G>=0?ce:re),left:z+(G>=0?ie:X)},onClick:()=>{},icon:l.jsxs("div",{className:"fa-md fa-layers",children:[l.jsx("b",{children:ve}),l.jsx(Q,{icon:Pn,transform:"right-8 down-9 shrink-5"})]}),tooltip:"Change comparison operator",children:l.jsx(ts,{actions:this.getDropdownActions,popperOptions:{placement:"bottom-start"}})}),l.jsx(V,{kind:"primary",className:"btn-fab btn-delete",style:{top:K+(G<0?ce:re),left:z+(G<0?ie:X)},onClick:this.handleDelete,icon:tn,tooltip:"Delete"})]})]})}}const AI=yo;const tl=Z.module("LinkerOverlayContent");class LI 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=J.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){tl.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(!_m(i))throw new Error(`Panel does not have getCoordinateForColumn method: ${n}`);try{const a=i.getCoordinateForColumn(s);if(a!=null)return a}catch{tl.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=$e(e.x,0,window.innerWidth-t.width),s=$e(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=$e(window.innerWidth-(e.clientX+s.width+t.x),0,window.innerWidth-s.width),o=$e(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,g=t.map(p=>{try{const{id:C,type:f,isReversed:S,start:v,end:w,operator:T}=p,y=v.columnType;let[E,I]=this.getPointFromLinkPoint(v),D=c?.x??E,F=c?.y??I;if(w!=null&&([D,F]=this.getPointFromLinkPoint(w)),S!=null&&S){const[L,B]=[E,I];[E,I]=[D,F],[D,F]=[L,B]}const _=U("linker-link",{disabled:e},{"link-filter-source":f==="filterSource"},{"link-invalid":f==="invalid"},{interactive:p.end==null},{"link-is-selected":n.has(C)},{"danger-delete":m==="delete"});return{x1:E,y1:I,x2:D,y2:F,id:C,className:_,operator:T,startColumnType:y}}catch(C){return tl.warn("Unable to get point for link",p,C),null}}).filter(p=>p!=null);return l.jsxs("div",{className:U("linker-overlay",{"danger-delete":m==="delete"}),children:[g.map(({x1:p,y1:C,x2:f,y2:S,id:v,className:w,operator:T,startColumnType:y})=>l.jsx(AI,{className:w,id:v,x1:p,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:U("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(oe,{actions:[{action:this.handleEscapePressed,shortcut:is.LINKER_CLOSE,isGlobal:!0}]})]})}}const PI=LI,xt=Z.module("Linker"),_I=(d,e)=>({activeTool:Cr(d),isolatedLinkerPanelId:Dc(d,e.localDashboardId),links:Xi(d,e.localDashboardId),timeZone:Ao(d)}),jI=wt(_I,{setActiveTool:br,setDashboardLinks:Nc,addDashboardLinks:uR,deleteDashboardLinks:mR,setDashboardIsolatedLinkerPanelId:km,setDashboardColumnSelectionValidator:gR});class HI 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===Ut.DEFAULT&&this.reset())}componentDidCatch(e,t){xt.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(Sn.COLUMN_SELECTED,this.handleGridColumnSelect),t.on(Sn.DATA_SELECTED,this.handleUpdateValues),t.on(Sn.STATE_CHANGED,this.handleStateChange),t.on(vl.COLUMN_SELECTED,this.handleChartColumnSelect),t.on(Ee.CLONED,this.handlePanelCloned),t.on(Je.COLUMN_SELECTED,this.handleFilterColumnSelect),t.on(Je.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(Sn.COLUMN_SELECTED,this.handleGridColumnSelect),t.off(Sn.DATA_SELECTED,this.handleUpdateValues),t.off(Sn.STATE_CHANGED,this.handleStateChange),t.off(vl.COLUMN_SELECTED,this.handleChartColumnSelect),t.off(Ee.CLONED,this.handlePanelCloned),t.off(Je.COLUMN_SELECTED,this.handleFilterColumnSelect),t.off(Je.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(Ut.DEFAULT)}this.setState({linkInProgress:void 0})}handleDone(){const{setActiveTool:e}=this.props;e(Ut.DEFAULT)}handleChartColumnSelect(e,t){this.columnSelected(e,t,!0)}handleFilterColumnSelect(e,t){xt.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(Ut.LINKER),o(s,a),r.length===0&&this.columnSelected(e,t,!0,a);return}this.columnSelected(e,t,!0)}handleColumnsChanged(e,t){xt.debug("handleColumnsChanged",e,t);const{links:n}=this.props,s=q.getIdFromPanel(e);if(s==null){xt.error("Invalid panelId",e);return}const i=n.filter(({start:o,end:a})=>o.panelId===s&&xi.findColumn(t,o)==null||a!=null&&a.panelId===s&&xi.findColumn(t,a)==null);this.deleteLinks(i)}handleGridColumnSelect(e,t){if(!bh(t)){xt.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:Ae.generate(),start:{panelId:a,panelComponent:r,columnName:c,columnType:h},type:"invalid",isReversed:n};xt.debug("starting link",u),this.setState({linkInProgress:u})}else{const{links:u}=this.props,{start:m,id:g,isReversed:p}=o,C={panelId:a,panelComponent:r,columnName:c,columnType:h},f=xi.getLinkType(p!==void 0&&p?C:m,p!==void 0&&p?m:C,s??i);switch(f){case"invalid":xt.debug("Ignore invalid link connection",o,C);return;case"filterSource":{const v=p!==void 0&&p?m.panelId:C.panelId,w=u.filter(({end:T})=>T?.panelId===v);this.deleteLinks(w);break}}const S={start:p!==void 0&&p?C:m,end:p!==void 0&&p?m:C,id:g,type:f,operator:Y.eq};xt.info("creating link",S),this.setState({linkInProgress:void 0,selectedIds:new Set([g])},()=>{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?Sh(a)?a.unsetFilterValue(i,o):xt.debug("endPanel.unsetFilterValue not implemented",a):xt.debug("endPanel no longer exists, ignoring unsetFilterValue",s)}}setPanelFilterMap(e,t){xt.debug("Set filter data for panel:",e,t);const{panelManager:n}=this.props,s=n.getOpenedPanelById(e);s?Sh(s)?s.setFilterMap(t):xt.debug("panel.setFilterMap not implemented",e,s):xt.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]):xt.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:g}=c,p=o.has(u)?o.get(u):new Map,C=p.has(m)===!0?p.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),g!=null&&R.isDateType(g)&&(T=new He({timeZone:i,showTimeZone:!1,showTSeparator:!0,defaultDateTimeFormatString:it.FULL_DATE_FORMAT}).format(w));const y={operator:h,text:T,value:w,startColumnIndex:f};C.push(y),p.set(m,{columnType:g,filterList:C}),o.set(u,p)}}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=xi.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){xt.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=pe((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===Ut.LINKER}updateSelectionValidators(){const{activeTool:e,setDashboardColumnSelectionValidator:t,localDashboardId:n}=this.props;switch(e){case Ut.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(!bh(t))return xt.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?xi.getLinkType(r,o,s):xi.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(bt,{in:a,timeout:qe.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,onExited:this.handleExited,children:l.jsx(PI,{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 $I=jI(HI),VI=$I;function BI(d){Ps(d);const{id:e,layout:t,panelManager:n}=d;return l.jsx(VI,{layout:t,localDashboardId:e,panelManager:n})}class nr{static DEFAULT_TITLE="Note";static DEFAULT_CONTENT=`# Markdown Note
|
|
36
|
+
${yo.makeCirclePath(o,a,yh)}`,I=`link-select-clip-${r}`,D=Math.atan2(a-T,o-w),F=D-Eh+Math.PI,_=D+Eh+Math.PI,L=o+Math.cos(D)*Th,B=a+Math.sin(D)*Th,O=L+Math.cos(F)*wa,j=B+Math.sin(F)*wa,k=L+Math.cos(_)*wa,A=B+Math.sin(_)*wa,H=`${L},${B} ${O},${j} ${k},${A}`,z=.25*s+.5*w+.25*o,K=.25*i+.5*T+.25*a,ae=w-s+(o-w),G=(T-i+(a-T))/ae;let ie=20/Math.sqrt(1+G**2),ce=ie*G,X=ie*-1,re=ce*-1;Number.isFinite(G)?G>0?(ie*=-1,ce*=-1,X*=-1,re*=-1,X-=50-10*(Math.abs(m)%vs),re+=10*(Math.abs(m)%vs),ie-=50-10*(Math.abs(m)%vs),ce+=10*(Math.abs(m)%vs)):G<0?(X+=10*(Math.abs(m)%vs),re+=10*(Math.abs(m)%vs),ie+=10*(Math.abs(m)%vs),ce+=10*(Math.abs(m)%vs)):(X=15,re=10,ie=-25,ce=10):(X=10,re=5,ie=10,ce=-35);let ve="";return t!==void 0&&(t==="startsWith"?ve="a*":t==="endsWith"?ve="*z":ve=R.getFilterOperatorString(t)),l.jsxs(l.Fragment,{children:[l.jsxs("svg",{className:U(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})`,"data-testid":"link-select"}),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:H})]}),c!=null&&n&&l.jsxs(l.Fragment,{children:[l.jsx(V,{kind:"primary",className:"btn-fab btn-operator",style:{top:K+(G>=0?ce:re),left:z+(G>=0?ie:X)},onClick:()=>{},icon:l.jsxs("div",{className:"fa-md fa-layers",children:[l.jsx("b",{children:ve}),l.jsx(Q,{icon:Pn,transform:"right-8 down-9 shrink-5"})]}),tooltip:"Change comparison operator",children:l.jsx(ts,{actions:this.getDropdownActions,popperOptions:{placement:"bottom-start"}})}),l.jsx(V,{kind:"primary",className:"btn-fab btn-delete",style:{top:K+(G<0?ce:re),left:z+(G<0?ie:X)},onClick:this.handleDelete,icon:tn,tooltip:"Delete"})]})]})}}const AI=yo;const tl=Z.module("LinkerOverlayContent");class LI 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=J.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){tl.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(!_m(i))throw new Error(`Panel does not have getCoordinateForColumn method: ${n}`);try{const a=i.getCoordinateForColumn(s);if(a!=null)return a}catch{tl.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=$e(e.x,0,window.innerWidth-t.width),s=$e(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=$e(window.innerWidth-(e.clientX+s.width+t.x),0,window.innerWidth-s.width),o=$e(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,g=t.map(p=>{try{const{id:C,type:f,isReversed:S,start:v,end:w,operator:T}=p,y=v.columnType;let[E,I]=this.getPointFromLinkPoint(v),D=c?.x??E,F=c?.y??I;if(w!=null&&([D,F]=this.getPointFromLinkPoint(w)),S!=null&&S){const[L,B]=[E,I];[E,I]=[D,F],[D,F]=[L,B]}const _=U("linker-link",{disabled:e},{"link-filter-source":f==="filterSource"},{"link-invalid":f==="invalid"},{interactive:p.end==null},{"link-is-selected":n.has(C)},{"danger-delete":m==="delete"});return{x1:E,y1:I,x2:D,y2:F,id:C,className:_,operator:T,startColumnType:y}}catch(C){return tl.warn("Unable to get point for link",p,C),null}}).filter(p=>p!=null);return l.jsxs("div",{className:U("linker-overlay",{"danger-delete":m==="delete"}),children:[g.map(({x1:p,y1:C,x2:f,y2:S,id:v,className:w,operator:T,startColumnType:y})=>l.jsx(AI,{className:w,id:v,x1:p,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:U("linker-toast-dialog",{dragging:u}),ref:this.dialogRef,style:{bottom:h?.y,right:h?.x},"data-testid":"linker-toast-dialog",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(oe,{actions:[{action:this.handleEscapePressed,shortcut:is.LINKER_CLOSE,isGlobal:!0}]})]})}}const PI=LI,xt=Z.module("Linker"),_I=(d,e)=>({activeTool:Cr(d),isolatedLinkerPanelId:Dc(d,e.localDashboardId),links:Xi(d,e.localDashboardId),timeZone:Ao(d)}),jI=wt(_I,{setActiveTool:br,setDashboardLinks:Nc,addDashboardLinks:uR,deleteDashboardLinks:mR,setDashboardIsolatedLinkerPanelId:km,setDashboardColumnSelectionValidator:gR});class HI 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===Ut.DEFAULT&&this.reset())}componentDidCatch(e,t){xt.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(Sn.COLUMN_SELECTED,this.handleGridColumnSelect),t.on(Sn.DATA_SELECTED,this.handleUpdateValues),t.on(Sn.STATE_CHANGED,this.handleStateChange),t.on(vl.COLUMN_SELECTED,this.handleChartColumnSelect),t.on(Ee.CLONED,this.handlePanelCloned),t.on(Je.COLUMN_SELECTED,this.handleFilterColumnSelect),t.on(Je.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(Sn.COLUMN_SELECTED,this.handleGridColumnSelect),t.off(Sn.DATA_SELECTED,this.handleUpdateValues),t.off(Sn.STATE_CHANGED,this.handleStateChange),t.off(vl.COLUMN_SELECTED,this.handleChartColumnSelect),t.off(Ee.CLONED,this.handlePanelCloned),t.off(Je.COLUMN_SELECTED,this.handleFilterColumnSelect),t.off(Je.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(Ut.DEFAULT)}this.setState({linkInProgress:void 0})}handleDone(){const{setActiveTool:e}=this.props;e(Ut.DEFAULT)}handleChartColumnSelect(e,t){this.columnSelected(e,t,!0)}handleFilterColumnSelect(e,t){xt.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(Ut.LINKER),o(s,a),r.length===0&&this.columnSelected(e,t,!0,a);return}this.columnSelected(e,t,!0)}handleColumnsChanged(e,t){xt.debug("handleColumnsChanged",e,t);const{links:n}=this.props,s=q.getIdFromPanel(e);if(s==null){xt.error("Invalid panelId",e);return}const i=n.filter(({start:o,end:a})=>o.panelId===s&&xi.findColumn(t,o)==null||a!=null&&a.panelId===s&&xi.findColumn(t,a)==null);this.deleteLinks(i)}handleGridColumnSelect(e,t){if(!bh(t)){xt.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:Ae.generate(),start:{panelId:a,panelComponent:r,columnName:c,columnType:h},type:"invalid",isReversed:n};xt.debug("starting link",u),this.setState({linkInProgress:u})}else{const{links:u}=this.props,{start:m,id:g,isReversed:p}=o,C={panelId:a,panelComponent:r,columnName:c,columnType:h},f=xi.getLinkType(p!==void 0&&p?C:m,p!==void 0&&p?m:C,s??i);switch(f){case"invalid":xt.debug("Ignore invalid link connection",o,C);return;case"filterSource":{const v=p!==void 0&&p?m.panelId:C.panelId,w=u.filter(({end:T})=>T?.panelId===v);this.deleteLinks(w);break}}const S={start:p!==void 0&&p?C:m,end:p!==void 0&&p?m:C,id:g,type:f,operator:Y.eq};xt.info("creating link",S),this.setState({linkInProgress:void 0,selectedIds:new Set([g])},()=>{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?Sh(a)?a.unsetFilterValue(i,o):xt.debug("endPanel.unsetFilterValue not implemented",a):xt.debug("endPanel no longer exists, ignoring unsetFilterValue",s)}}setPanelFilterMap(e,t){xt.debug("Set filter data for panel:",e,t);const{panelManager:n}=this.props,s=n.getOpenedPanelById(e);s?Sh(s)?s.setFilterMap(t):xt.debug("panel.setFilterMap not implemented",e,s):xt.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]):xt.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:g}=c,p=o.has(u)?o.get(u):new Map,C=p.has(m)===!0?p.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),g!=null&&R.isDateType(g)&&(T=new He({timeZone:i,showTimeZone:!1,showTSeparator:!0,defaultDateTimeFormatString:it.FULL_DATE_FORMAT}).format(w));const y={operator:h,text:T,value:w,startColumnIndex:f};C.push(y),p.set(m,{columnType:g,filterList:C}),o.set(u,p)}}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=xi.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){xt.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=pe((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===Ut.LINKER}updateSelectionValidators(){const{activeTool:e,setDashboardColumnSelectionValidator:t,localDashboardId:n}=this.props;switch(e){case Ut.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(!bh(t))return xt.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?xi.getLinkType(r,o,s):xi.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(bt,{in:a,timeout:qe.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,onExited:this.handleExited,children:l.jsx(PI,{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 $I=jI(HI),VI=$I;function BI(d){Ps(d);const{id:e,layout:t,panelManager:n}=d;return l.jsx(VI,{layout:t,localDashboardId:e,panelManager:n})}class nr{static DEFAULT_TITLE="Note";static DEFAULT_CONTENT=`# Markdown Note
|
|
37
37
|
|
|
38
38
|
This note can be edited using **markdown** for styling.`;static getNewMarkdownTitle(e){let t=`${nr.DEFAULT_TITLE}`,n=0;for(;e.indexOf(t)>=0;)n+=1,t=`${nr.DEFAULT_TITLE}-${n}`;return t}}const nl=nr;function UI(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===nl.DEFAULT_CONTENT?null:cc(a)},[]),o=b.useCallback(({title:a="",metadata:r={},id:c=Ae.generate(),focusElement:h=q.DEFAULT_FOCUS_SELECTOR,createNewStack:u=!1,dragEvent:m=null}={})=>{const g=n.getOpenedPanelConfigsOfType(ho.COMPONENT),p=n.getClosedPanelConfigsOfType(ho.COMPONENT),C=g.map(T=>T.title??""),f=a!=null&&a!==""?a:nl.getNewMarkdownTitle(C),S=p.length>0?null:nl.DEFAULT_CONTENT,v={type:"react-component",component:ho.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(ho.COMPONENT,ho,dc,i)];return()=>{r.forEach(c=>c())}},[i,s]),Ge(t.eventHub,Nm.OPEN,o),null}function WI(d){Ps(d);const{hydrate:e,id:t,layout:n,registerComponent:s}=d,i=b.useCallback(({dragEvent:o,fetch:a,panelId:r=Ae.generate(),widget:c})=>{const{name:h,type:u}=c;if(u!==dh.VariableType.PANDAS)return;const m={name:h,table:h},g=()=>a().then(f=>yc.makeModel(f)),p={type:"react-component",component:el.COMPONENT,props:{localDashboardId:t,id:r,metadata:m,makeModel:g},title:h,id:r},{root:C}=n;q.openComponent({root:C,config:p,dragEvent:o})},[t,n]);return b.useEffect(function(){const a=[s(el.COMPONENT,el,e)];return()=>{a.forEach(r=>r())}},[e,s]),Ge(n.eventHub,Ee.OPEN,i),null}class GI{static DROPDOWN_FILTER="ControlType.DROPDOWN_FILTER";static INPUT_FILTER="ControlType.INPUT_FILTER";static MARKDOWN="ControlType.MARKDOWN";static FILTER_SET_MANAGER="ControlType.FILTER_SET_MANAGER"}const Ns=GI;class xh{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(bn.and)}),{filterItems:t,filterOperators:n}}static combineFilterConfigs(e,t,n=bn.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}}}function zI(d,e,t){if(d.length>e){const n=d.length-t;return{toKeep:d.slice(n),toPrune:d.slice(0,n)}}return{toKeep:d,toPrune:[]}}const sl=Z.module("PouchStorageTable"),KI="Deephaven.";Lh.plugin(Rg);function qI(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 YI(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]:qI(a,r)};if(s===0)n=c;else if(n!==null&&s-1<t.length){const h=t[s-1];if(h===bn.and)n={$and:[n,c]};else if(h===bn.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 il(d=[]){return{$and:[...d.map(e=>YI(e)),{name:{$gt:null}},{id:{$gt:null}}]}}function XI(d,e=!1){return[{id:e?"desc":"asc"},...d?.map(t=>({[t.column]:t.direction}))??[]]}class ZI{db;changes;listeners=[];itemListeners=new Map;currentSize=0;currentViewport;currentReverse=!1;currentFilter=null;currentSort=null;infoUpdatePromise;viewportUpdatePromise;currentViewportData;constructor(e,t){this.db=new Lh(`${KI}${e}`,t),this.db._remote=!1,this.listenForChanges(),this.db.createIndex({index:{fields:["id","name"]}}),this.refreshInfo()}listenForChanges(){this.changes=this.db.changes({live:!0,since:"now",include_docs:!0}).on("change",this.dbUpdate.bind(this))}onUpdate(e){return this.listeners=[...this.listeners,e],()=>{this.listeners=this.listeners.filter(t=>t!==e)}}onItemUpdate(e,t){return this.itemListeners.has(e)||this.itemListeners.set(e,[]),this.itemListeners.set(e,[...this.itemListeners.get(e),t]),this.refreshItem(e),()=>{this.itemListeners.set(e,this.itemListeners.get(e).filter(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){sl.debug("Update received",e),this.refreshInfo(),e.doc!==void 0&&this.sendItemUpdate(e.doc),this.refreshData()}async fetchInfo(e){return this.db.find({selector:e,fields:[]})}async refreshInfo(){try{this.infoUpdatePromise?.cancel(),this.infoUpdatePromise=we.makeCancelable(this.fetchInfo(il(this.currentFilter??[])));const e=await this.infoUpdatePromise;this.currentSize=e.docs.length,this.sendUpdate()}catch(e){if(!we.isCanceled(e))throw sl.error("Unable to refreshInfo",e),e}}async fetchViewportData(e,t,n){return this.db.find({selector:t,skip:e.top,limit:e.bottom-e.top+1,sort:n,fields:["id","name"]}).then(s=>({items:s.docs,offset:e.top}))}async refreshData(){if(this.currentViewport)try{const e=il(this.currentFilter??[]),t=XI(this.currentSort,this.currentReverse);this.viewportUpdatePromise?.cancel(),this.viewportUpdatePromise=we.makeCancelable(this.fetchViewportData(this.currentViewport,e,t));const n=await this.viewportUpdatePromise;return this.currentViewportData=n,this.sendUpdate(),n}catch(e){if(!we.isCanceled(e))throw sl.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:il(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}}const QI=ZI,JI=2500,eD=2e3,ln=Z.module("PouchCommandHistoryTable");class tD extends QI{constructor(e,t){super(`CommandHistoryStorage.${e}`,{auto_compaction:!0,revs_limit:1}),this.cache=t,this.cache.tableRegistry.has(this.cacheKey)||this.cache.tableRegistry.set(this.cacheKey,new Set),ln.debug("Adding table to registry",this.cacheKey),this.cache.tableRegistry.get(this.cacheKey)?.add(this)}searchText;get cacheKey(){return this.db.name}setSearch(e){ln.debug("Setting search filters",e),this.searchText=e.trim().toLowerCase(),this.setFilters(e?[xh.makeFilterConfig([xh.makeFilterItem("name",Y.contains,e)])]:[])}dbUpdate(e){ln.debug("Clearing cache and refreshing data",e),this.cache.response.delete(this.cacheKey),super.dbUpdate(e)}async fetchData(e){return we.withTimeout(0,async()=>{this.cache.response.has(this.cacheKey)?ln.debug("Fetching from cache",this.searchText,this.viewport):(ln.debug("Fetching from PouchDB",this.searchText,this.viewport),this.cache.response.set(this.cacheKey,this.db.allDocs({include_docs:!0}).then(n=>{const s=n.rows.map(a=>a.doc).filter(({name:a})=>a);ln.debug(`Fetched ${s.length} command history items`);const{toKeep:i,toPrune:o}=zI(s,JI,eD);return o.length&&this.pruneItems(o),{docs:i}})));const t=this.cache.response.get(this.cacheKey);return this.searchText==null||this.searchText===""?t:{...t,docs:(await t).docs.filter(({name:n})=>n.toLowerCase().includes(this.searchText))}})}async fetchInfo(e){return this.fetchData(e)}async fetchViewportData(e,t,n){const s=await this.fetchData(t);return ln.debug("Fetching viewport data",e.top,e.bottom+1,n,s),{items:(typeof n[0]=="object"&&n[0].id==="desc"?s.docs.slice(0).reverse():s.docs).slice(e.top,e.bottom+1),offset:e.top}}async pruneItems(e){if(this.cache.isPruning.get(this.cacheKey)===!0){ln.debug("Pruning already in progress. Skipping.");return}try{ln.debug(`Pruning ${e.length} command history items`);const t=this.cache.pauseChangeListeners(this.cacheKey);this.cache.isPruning.set(this.cacheKey,!0),await this.db.bulkDocs(e.map(n=>({...n,_deleted:!0}))),this.cache.isPruning.set(this.cacheKey,!1),t(),ln.debug("Finished pruning command history items")}catch(t){ln.error("An error occurred while pruning db",t)}}close(){ln.debug("Closing table",this,this.cache.tableRegistry.get(this.cacheKey)?.size),this.cache.tableRegistry.get(this.cacheKey)?.delete(this),this.changes?.cancel(),super.close()}}const Rh=tD,Ih=Z.module("PouchCommandHistoryCache");class nD{constructor(){this.isPruning=new Map,this.response=new Map,this.tableRegistry=new Map}isPruning;response;tableRegistry;pauseChangeListeners(e){const t=[];return this.tableRegistry.get(e)?.forEach(n=>{n.changes&&(Ih.debug(`Pausing event listeners on '${e}' table`,n),n.changes.cancel(),t.push(n))}),()=>{t.forEach(n=>{(this.tableRegistry.get(e)?.has(n)??!1)&&(Ih.debug(`Resuming event listeners on '${e}' table`,n),n.listenForChanges())})}}}const sD=nD,Dh=Z.module("PouchCommandHistoryStorage");class iD{cache=new sD;updateTableMap=new Map;getUpdateTable(e){return this.updateTableMap.has(e)||this.updateTableMap.set(e,new Rh(e,this.cache)),this.updateTableMap.get(e)}async getTable(e){return new Rh(e,this.cache)}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 Dh.debug("Updating item",i),await n.put(i),Dh.debug("Update saved"),t}listenItem(e,t,n){return this.getUpdateTable(e).onItemUpdate(t,n)}}const $m="SET_LAYOUT_STORAGE",oD=d=>({type:$m,payload:d}),Vm="/ide/assets/community-wordmark-app-d2c5c1eb.svg";const aD=Z.module("FormattingSectionContent");function rD(d){return d.formatString!=null}function xl(d){const e=d?.querySelector("input, select, textarea");e&&e.focus()}function Bm(d,e){return d.defaultFormatString===e.defaultFormatString}function lD(d,e){return Bm(d,e)}function cD(d,e){return Bm(d,e)}function Um(d){return d!==""&&qi.isValidColumnName(d)}function Ms(d,e){if(!d||e.formatString==null||!rD(e))return!1;switch(d){case"datetime":return He.isValid(e);case"decimal":return xe.isValid(e);case"int":return Ke.isValid(e);default:return aD.warn("Trying to validate format of unknown type"),!0}}function Wm(d){const{id:e,isNewRule:t,...n}=d;return n}function Gm(d){return Um(d.columnName)&&Ms(d.columnType,d.format)}function zm(d){const{timestamp:e,timeZone:t,showTimeZone:n,showTSeparator:s,isGlobalOptions:i,legacyGlobalFormat:o}=d,a=new en([],{timeZone:t,showTimeZone:n,showTSeparator:s}),r=i?He.getGlobalFormats(n,s):He.getFormats(n,s);return o!=null&&!r.includes(o)&&r.unshift(o),l.jsx(l.Fragment,{children:r.map(c=>{const h=He.makeFormat("",c,He.TYPE_GLOBAL);return l.jsx("option",{value:c,"data-testid":"time-format",children:a.getFormattedString(e,R.dataType.DATETIME,"",h)},c)})})}function dD(){return l.jsx(l.Fragment,{children:dr.TIME_ZONES.map(d=>{const{label:e,value:t}=d;return l.jsx("option",{value:t,children:e},t)})})}const qs=Z.module("FormattingSectionContent");class _c extends b.PureComponent{static defaultProps={scrollTo:()=>{},defaults:{defaultDateTimeFormat:He.DEFAULT_DATETIME_FORMAT_STRING,defaultDecimalFormatOptions:{defaultFormatString:xe.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:Ke.DEFAULT_FORMAT_STRING},showTimeZone:!1,showTSeparator:!0,timeZone:He.DEFAULT_TIME_ZONE_ID}};static inputDebounceTime=250;constructor(e){super(e),this.debouncedCommitChanges=Xe(this.commitChanges.bind(this),_c.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=J.createRef(),this.state={formatSettings:h,showTimeZone:o,showTSeparator:a,timeZone:r,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,truncateNumbersWithPound:c,timestampAtMenuOpen:new Date}}componentDidMount(){xl(this.containerRef.current)}componentWillUnmount(){this.debouncedCommitChanges.flush()}debouncedCommitChanges;containerRef;getCachedDateTimeFormatOptions=me((e,t,n,s=!1,i)=>{const{timestampAtMenuOpen:o}=this.state;return l.jsx(zm,{timestamp:o,timeZone:e,showTimeZone:t,showTSeparator:n,isGlobalOptions:s,legacyGlobalFormat:i})});handleDefaultDateTimeFormatChange(e){qs.debug("handleDefaultDateTimeFormatChange",e.target.value),this.setState({defaultDateTimeFormat:e.target.value},()=>{this.debouncedCommitChanges()})}handleDefaultDecimalFormatChange(e){qs.debug("handleDefaultDecimalFormatChange",e.target.value),this.setState({defaultDecimalFormatOptions:{defaultFormatString:e.target.value}},()=>{this.debouncedCommitChanges()})}handleDefaultIntegerFormatChange(e){qs.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;qs.debug("handleResetDateTimeFormat"),this.setState({defaultDateTimeFormat:t,showTimeZone:n,showTSeparator:s},()=>{this.debouncedCommitChanges()})}handleResetTimeZone(){const{defaults:e}=this.props,{timeZone:t}=e;qs.debug("handleResetTimeZone"),this.setState({timeZone:t},()=>{this.debouncedCommitChanges()})}handleResetDecimalFormat(){const{defaults:e}=this.props,{defaultDecimalFormatOptions:t}=e;qs.debug("handleResetDecimalFormat"),this.setState({defaultDecimalFormatOptions:t},()=>{this.debouncedCommitChanges()})}handleResetIntegerFormat(){const{defaults:e}=this.props,{defaultIntegerFormatOptions:t}=e;qs.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(Gm).map(Wm)??[],{settings:h,saveSettings:u}=this.props,m={...h,formatter:c,defaultDateTimeFormat:t,showTimeZone:n,showTSeparator:s,timeZone:i,truncateNumbersWithPound:r};Ms(R.dataType.DECIMAL,xe.makeCustomFormat(o.defaultFormatString))&&(m.defaultDecimalFormatOptions=o),Ms(R.dataType.INT,Ke.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=xe.DEFAULT_FORMAT_STRING}=n??{},{defaultFormatString:h=Ke.DEFAULT_FORMAT_STRING}=s??{},u=i===e.timeZone,m=a===e.showTSeparator&&o===e.showTimeZone&&t===e.defaultDateTimeFormat,g=lD(n,e.defaultDecimalFormatOptions),p=cD(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(dD,{})})}),l.jsx("div",{className:"col-1 btn-col",children:l.jsx(V,{kind:"ghost",icon:ni,onClick:this.handleResetTimeZone,tooltip:"Reset Time Zone",className:U("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:ni,onClick:this.handleResetDateTimeFormat,tooltip:"Reset DateTime Options",className:U("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(Jt,{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(Jt,{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:U("form-control","flex-grow-1","default-decimal-format-input",{"is-invalid":!Ms(R.dataType.DECIMAL,xe.makeCustomFormat(c))}),"data-lpignore":!0,placeholder:xe.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:ni,onClick:this.handleResetDecimalFormat,tooltip:"Reset Decimal Formatting",className:U("btn-reset","btn-reset-decimal",{hidden:g}),"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:U("form-control","flex-grow-1","default-integer-format-input",{"is-invalid":!Ms(R.dataType.INT,Ke.makeCustomFormat(h))}),"data-lpignore":!0,placeholder:Ke.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:ni,onClick:this.handleResetIntegerFormat,tooltip:"Reset Integer Formatting",className:U("btn-reset","btn-reset-integer",{hidden:p}),"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(Jt,{checked:r??null,onChange:this.handleTruncateNumbersWithPoundChange,children:"Truncate numbers with #"})})})]})})}}const hD=d=>({formatter:yu(d),defaultDateTimeFormat:vu(d),defaultDecimalFormatOptions:Tu(d),defaultIntegerFormatOptions:Eu(d),showTimeZone:xu(d),showTSeparator:Ru(d),truncateNumbersWithPound:Iu(d),timeZone:Ao(d),settings:vt(d)}),uD=wt(hD,{saveSettings:Sr})(_c);function mD(){const[d,e]=b.useState(!1),t=()=>{e(!d)};return l.jsxs(V,{kind:"ghost",onClick:t,icon:_p,children:["Legal Notices",l.jsxs(Wi,{isOpen:d,toggle:t,className:"theme-bg-light",children:[l.jsx(No,{toggle:t,children:"Legal Notice"}),l.jsxs(Gi,{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 xo(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(Q,{transform:t?"flip-v":"",icon:Pn})})]})}),l.jsx(Df,{in:t,autoFocusOnShow:!0,children:e})]})}xo.propTypes={children:M.node,isExpanded:M.bool.isRequired,sectionKey:M.string.isRequired,title:M.node.isRequired,onToggle:M.func};xo.defaultProps={children:null,onToggle:()=>{}};function gD({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(Pe.getDisplayText(o)),d.matchesKeyState(o)&&c(!1)},[o,d]),b.useEffect(function(){if(r){if(!Pe.isValidKeyState(o)){Pe.isAllowedKey(o.keyValue)?u("Must contain a modifier key"):u("Must contain an allowed action key");return}const T=Me.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=Pe.getKeyStateFromEvent(w),y=Pe.createKeyState([he.BACKSPACE]);Pe.doKeyStatesMatch(T,y)?a(Pe.NULL_KEY_STATE):a(T)}}function g(w){w.stopPropagation(),w.preventDefault(),d.matchesKeyState(o)||c(!0)}function p(){Ve.disableAllActions()}function C(){Ve.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:U("form-control",{"is-invalid":h}),onKeyDown:m,onKeyUp:g,onFocus:p,onBlur:C,disabled:!d.isEditable,value:s,readOnly:!0}),!Pe.doKeyStatesMatch(o,d.getDefaultKeyState())&&!h&&l.jsx(V,{className:"reset-to-default-button",kind:"ghost",icon:l.jsx(Q,{icon:ni,transform:{rotate:90,flipX:!0}}),tooltip:"Reset to default",onClick:v})]})]}),r&&l.jsxs("div",{className:U("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:[Pe.isValidKeyState(o)&&l.jsx(V,{kind:"ghost",onClick:f,children:"Confirm"}),l.jsx(V,{kind:"ghost",onClick:S,children:"Undo"})]})]})]})}function pD({shortcutOverrides:d={},settings:e,saveSettings:t}){const n=b.useCallback(a=>{const r=Pe.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(Me.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(fD,{name:a.name,shortcuts:a.shortcuts,saveShortcutOverrides:n},a.name))]})}function fD({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(gD,{shortcut:r,displayText:a[c],categoryName:d,onChange:o},r.id))]})}const CD=d=>({settings:vt(d),shortcutOverrides:gb(d)}),SD={saveSettings:Sr},bD=wt(CD,SD)(pD),wD="yyyy-MM-dd-HHmmss";function Km(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]=Km(i,r,t)}}}),n}function vD(){const d=ic.getState();return JSON.stringify(Km(d),null,2)}function TD(d){const e={uiVersion:"0.36.0",userAgent:navigator.userAgent,...d};return JSON.stringify(e,null,2)}async function ED(d=`${x.i18n.DateTimeFormat.format(wD,new Date)}_support_logs`,e){const t=new Ph,n=t.folder(d);n.file("console.txt",jp.getFormattedHistory()),n.file("redux.json",vD()),n.file("metadata.json",TD(e));const s=await t.generateAsync({type:"blob"}),i=document.createElement("a");i.href=URL.createObjectURL(s),i.download=`${d}.zip`,i.click()}const yD=[{value:R.dataType.DATETIME,label:"DateTime"},{value:R.dataType.DECIMAL,label:"Decimal"},{value:R.dataType.INT,label:"Integer"}];function xD(){const d=yD.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 jc extends b.PureComponent{static defaultProps={scrollTo:()=>{},defaults:{defaultDateTimeFormat:He.DEFAULT_DATETIME_FORMAT_STRING,defaultDecimalFormatOptions:{defaultFormatString:xe.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:Ke.DEFAULT_FORMAT_STRING},showTimeZone:!1,showTSeparator:!0,timeZone:He.DEFAULT_TIME_ZONE_ID}};static inputDebounceTime=250;constructor(e){super(e),this.debouncedCommitChanges=Xe(this.commitChanges.bind(this),jc.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=J.createRef(),this.addFormatRuleButtonRef=J.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(){xl(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=me(()=>l.jsx(xD,{}));getCachedDateTimeFormatOptions=me((e,t,n,s=!1,i)=>{const{timestampAtMenuOpen:o}=this.state;return l.jsx(zm,{timestamp:o,timeZone:e,showTimeZone:t,showTSeparator:n,isGlobalOptions:s,legacyGlobalFormat:i})});handleFormatRuleChange(e,t,n){this.setState(s=>{const{formatSettings:i}=s;N(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,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(),xl(e)}commitChanges(){const{formatSettings:e,defaultDateTimeFormat:t,showTimeZone:n,showTSeparator:s,timeZone:i,defaultDecimalFormatOptions:o,defaultIntegerFormatOptions:a,truncateNumbersWithPound:r}=this.state,c=e.filter(Gm).map(Wm)??[],{settings:h,saveSettings:u}=this.props,m={...h,formatter:c,defaultDateTimeFormat:t,showTimeZone:n,showTSeparator:s,timeZone:i,truncateNumbersWithPound:r};Ms(R.dataType.DECIMAL,xe.makeCustomFormat(o.defaultFormatString))&&(m.defaultDecimalFormatOptions=o),Ms(R.dataType.INT,Ke.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.")),Um(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.")):Ms(e.columnType,e.format)||(t.hasFormatError=!0,n.push("Invalid formatting rule.")),t.message=n.join(`
|
|
39
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:U("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:tn,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:U("custom-select",{"is-invalid":s}),value:r,id:t,onChange:c=>{const h=He.makeFormat("",c.target.value,He.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:U("form-control","flex-grow-1",{"is-invalid":s}),"data-lpignore":!0,id:t,placeholder:Ke.DEFAULT_FORMAT_STRING,type:"text",value:i,onChange:o=>{const a=Ke.makeFormat("",o.target.value,Ke.TYPE_GLOBAL,void 0);this.handleFormatRuleChange(e,"format",a)}})}renderDecimalFormatRuleInput(e,t,n,s){const i=n.formatString??"";return l.jsx("input",{className:U("form-control","flex-grow-1",{"is-invalid":s}),"data-lpignore":!0,id:t,placeholder:xe.DEFAULT_FORMAT_STRING,type:"text",value:i,onChange:o=>{const a=xe.makeFormat("",o.target.value,xe.TYPE_GLOBAL,void 0);this.handleFormatRuleChange(e,"format",a)}})}render(){const{formatRulesChanged:e,formatSettings:t}=this.state,n=t.map((i,o)=>l.jsx(bt,{classNames:"fade",timeout:qe.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:As,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(Ig,{appear:e,enter:e,exit:e,children:n}),s]})}}const RD=d=>({formatter:yu(d),defaultDateTimeFormat:vu(d),defaultDecimalFormatOptions:Tu(d),defaultIntegerFormatOptions:Eu(d),showTimeZone:xu(d),showTSeparator:Ru(d),truncateNumbersWithPound:Iu(d),timeZone:Ao(d),settings:vt(d)}),ID=wt(RD,{saveSettings:Sr})(jc);class kn 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=J.createRef(),this.state={expandedSectionKey:kn.FORMATTING_SECTION_KEY}}componentDidMount(){kn.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;ED(void 0,Object.fromEntries(e))}render(){const e="0.36.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(Q,{icon:zi,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(xo,{sectionKey:kn.FORMATTING_SECTION_KEY,isExpanded:this.isSectionExpanded(kn.FORMATTING_SECTION_KEY),title:l.jsxs(l.Fragment,{children:[l.jsx(Q,{icon:Hp,transform:"grow-4",className:"mr-2"}),"Default Format & Time zone"]}),onToggle:this.handleSectionToggle,children:l.jsx(uD,{})}),l.jsx(xo,{sectionKey:kn.COLUMN_SPECIFIC_SECTION_KEY,isExpanded:this.isSectionExpanded(kn.COLUMN_SPECIFIC_SECTION_KEY),title:l.jsxs(l.Fragment,{children:[l.jsx(Q,{icon:$p,transform:"grow-4",className:"mr-2"}),"Format by Column Name & Type"]}),onToggle:this.handleSectionToggle,children:l.jsx(ID,{scrollTo:this.handleScrollTo})}),l.jsx(xo,{sectionKey:kn.SHORTCUT_SECTION_KEY,isExpanded:this.isSectionExpanded(kn.SHORTCUT_SECTION_KEY),title:l.jsxs(l.Fragment,{children:[l.jsx(Q,{icon:Vp,transform:"grow-2"})," ","Keyboard Shortcuts"]}),onToggle:this.handleSectionToggle,children:l.jsx(bD,{})}),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(Q,{icon:Bp}),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(mr,{tooltip:"Copy version numbers",copy:`Engine Version: ${a}
|
|
40
40
|
Web UI Version: ${e}
|
|
41
41
|
Java Version: ${o}
|
|
42
42
|
Barrage Version: ${i}`,children:"Copy Versions"})]})]})]}),l.jsx("div",{className:"app-settings-footer-item",children:l.jsx(mD,{})})]}),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:Vm,alt:"Deephaven Data Labs",width:"230px"})})})})]})]})]})}}const Fh=10;function Oi(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,g]=b.useState(!1),p=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)&&(g(!0),window.removeEventListener("mousemove",p),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",p)}function f(S){u.current===S.target&&(g(!0),r(),e(),window.removeEventListener("mousemove",p)),u.current=null}return b.useEffect(function(){return function(){return window.removeEventListener("mousemove",p)}},[p]),l.jsxs("button",{type:"button",className:U("btn-context-menu",{disabled:n},{active:o&&!n},{"keyboard-active":a&&!n}),onMouseDown:C,onMouseUp:f,disabled:m,children:[l.jsx("span",{className:U("icon"),children:s}),l.jsx("span",{className:"title",children:t}),l.jsx("span",{className:"shortcut",children:i})]})}function Hc(d){const{handleControlSelect:e,handleToolSelect:t,onClearFilter:n}=d,s=b.useMemo(()=>[{title:"Input Filter",icon:Up,menuElement:l.jsx(Oi,{}),action:i=>{e(Ns.INPUT_FILTER,i)},order:10},{title:"Dropdown Filter",icon:zh,menuElement:l.jsx(Oi,{}),action:i=>{e(Ns.DROPDOWN_FILTER,i)},order:15},{title:"Markdown Widget",icon:Wp,menuElement:l.jsx(Oi,{}),action:i=>{e(Ns.MARKDOWN,i)},order:20},{title:"Filter Sets",icon:dl,menuElement:l.jsx(Oi,{}),action:i=>{e(Ns.FILTER_SET_MANAGER,i)},order:25},{disabled:!0,menuElement:l.jsx("div",{className:"context-menu-group-header",children:"Tools"}),order:30},{title:"Linker",icon:Ml,action:()=>{t(Ut.LINKER)},order:40,shortcut:is.LINKER},{disabled:!0,menuElement:l.jsx("div",{className:"context-menu-group-header",children:"Actions"}),order:50},{title:"Clear All Filters",icon:Gp,action:()=>{n()},order:60,shortcut:Xt.TABLE.CLEAR_ALL_FILTERS}],[e,t,n]);return l.jsx(ts,{popperClassName:"controls-menu-popper",actions:s})}Hc.propTypes={handleControlSelect:M.func,handleToolSelect:M.func,onClearFilter:M.func};Hc.defaultProps={handleControlSelect:()=>{},handleToolSelect:()=>{},onClearFilter:()=>{}};Oi.propTypes={forwardedProps:M.shape({iconElement:M.node,displayShortcut:M.string,isMouseSelected:M.bool.isRequired,isKeyboardSelected:M.bool.isRequired,closeMenu:M.func.isRequired,menuItem:M.shape({action:M.func,title:M.string,disabled:M.bool}).isRequired})};Oi.defaultProps={forwardedProps:null};const DD=hi($m,null),FD={layoutStorage:DD},ND=d=>d.layoutStorage,MD=d=>d.serverConfigValues;Object.entries(FD).map(([d,e])=>Lo.register(d,e));const Nh=10;function kD(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]),g=b.useCallback(T=>{c(T.target.value)},[]),p=b.useCallback(T=>{u.current!=null&&(Math.abs(u.current.x-T.clientX)>=Nh||Math.abs(u.current.y-T.clientY)>=Nh)&&(a(!0),window.removeEventListener("mousemove",p),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",p)},[p]),f=b.useCallback((T,y)=>{window.removeEventListener("mousemove",p),u.current?.widget===y&&(a(!0),m(y)),u.current=void 0},[p,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(au,{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(Ls,{value:r,placeholder:"Find Table, Plot or Widget",onChange:g,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(Q,{mask:cl,icon:Qc,transform:"right-5 down-5"}),l.jsx(Q,{icon:Qc,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(Q,{mask:cl,icon:hl,transform:"right-5 down-5"}),l.jsx(Q,{icon:hl,transform:"right-8 down-6"})]}),"Import Layout"]}),l.jsx(V,{kind:"ghost",icon:ni,onClick:n,tooltip:"Reset Layout"})]})]})}const OD=async(d,e,t)=>{let n,s,i,o;if(xa(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 ja.makeModel(n,h)}const a={title:i,name:s,type:x.VariableType.TABLE},r=await d.getObject(a);return be.applyTableSettings(r,o,Ao(ic.getState())),ja.makeModelFromSettings(n,r)},AD=async(d,e,t=x.VariableType.TABLE)=>{const{table:n}=e,s={title:n,name:n,type:t},i=await d.getObject(s);return yc.makeModel(i)};function LD({onAutoFillClick:d=()=>{}}){return l.jsxs("div",{className:"empty-dashboard-container",children:[l.jsxs("div",{className:"hint-container",children:[l.jsx(Q,{icon:Gh})," ",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 PD(d){return d.version===2}function _D(d){return Array.isArray(d)}const va=Z.module("UserLayoutUtils"),jD={layoutConfig:[{type:"column",content:[{type:"row",height:40,content:[{type:"stack",content:[{type:"react-component",component:ki.COMPONENT,title:ki.TITLE,isClosable:!1},{type:"react-component",component:tr.COMPONENT,title:tr.TITLE,isClosable:!1}]},{type:"stack",width:25,content:[{type:"react-component",component:Ya.COMPONENT,title:Ya.TITLE,isClosable:!1},{type:"react-component",component:Za.COMPONENT,title:Za.TITLE,isClosable:!1}]}]},{type:"row",content:[{type:"stack",title:"Notebooks",content:[]}]}]}],links:[],filterSets:[],version:2},HD={layoutConfig:[],links:[],filterSets:[],version:2};function qm(d){if(PD(d))return d;if(_D(d))return{layoutConfig:d,links:[],filterSets:[],version:2};throw new Error(`Unexpected layout import format: ${d}`)}async function $D(d,e=!0){try{const t=await d.getLayouts();if(t.length>0)try{const n=await d.getLayout(t[0]);return qm(n)}catch(n){va.error("Unable to load layout",t[0],":",n),va.warn("No valid layouts found, falling back to default layout")}}catch(t){va.error("Unable to fetch layout list",t),va.warn("Falling back to default layout")}return e?jD:HD}function VD(d){const{filterSets:e,layoutConfig:t,links:n}=d;return{filterSets:e,layoutConfig:t,links:n,version:2}}const Ia={exportLayout:VD,getDefaultLayout:$D,normalizeLayout:qm},Ta=Z.module("DownloadServiceWorkerUtils");class Fo{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(),Ta.info("Registering service worker on ",t,n)}).catch(n=>{Ta.error("Failed to register service worker",n)})}):Ta.info("Service worker is not supported."))}static async getServiceWorker(){if("serviceWorker"in navigator){const t=(await navigator.serviceWorker.getRegistrations()).find(n=>n.scope.endsWith(Fo.DOWNLOAD_PATH));if(t&&t.active)return Ta.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 Ym={react:J,"react-dom":$i,redux:Dg,"react-redux":Fg},BD=Ng(Ym),UD=Mg({requires:BD}),WD=kg.createRequires(Ym),GD=Og({requires:WD}),zD=Z.module("PluginUtils");class Rl{static loadComponentPlugin(e){const t=new URL("/ide/plugins/",`${window.location}`),n=new URL(`${e}.js`,t),s=J.forwardRef((i,o)=>l.jsx(UD,{url:n,render:({err:a,Component:r})=>{if(a!=null&&a!==""){const c=`Error loading plugin ${e} from ${n} due to ${a}`;return zD.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 GD(e)}static async loadJson(e){const t=await fetch(e);if(!t.ok)throw new Error(t.statusText);try{return await t.json()}catch{throw new Error("Could not be parsed as JSON")}}}const Rt=Z.module("AppMainContainer");class Ai extends b.Component{static handleWindowBeforeUnload(e){e.preventDefault(),e.returnValue=""}static hydrateConsole(e,t){return bl.hydrate({...e,unzip:n=>Ph.loadAsync(n).then(s=>Object.values(s.files))},t)}static handleRefresh(){Rt.info("Refreshing application"),window.location.reload()}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.handleDisconnect=this.handleDisconnect.bind(this),this.handleReconnect=this.handleReconnect.bind(this),this.handleReconnectAuthFailed=this.handleReconnectAuthFailed.bind(this),this.importElement=J.createRef(),this.state={contextActions:[{action:()=>{this.handleToolSelect(Ut.LINKER)},shortcut:is.LINKER,isGlobal:!0},{action:()=>{this.sendClearFilter()},shortcut:Xt.TABLE.CLEAR_ALL_FILTERS,isGlobal:!0},{action:()=>{Rt.debug("Consume unhandled save shortcut")},shortcut:is.SAVE,isGlobal:!0}],isAuthFailed:!1,isDisconnected:!1,isPanelsMenuShown:!1,isSettingsMenuShown:!1,widgets:[]}}componentDidMount(){this.initWidgets(),this.startListeningForDisconnect(),window.addEventListener("beforeunload",Ai.handleWindowBeforeUnload)}componentDidUpdate(e){const{dashboardData:t}=this.props;e.dashboardData!==t&&this.handleDataChange(t)}componentWillUnmount(){this.deinitWidgets(),this.stopListeningForDisconnect(),window.removeEventListener("beforeunload",Ai.handleWindowBeforeUnload)}goldenLayout;importElement;widgetListenerRemover;initWidgets(){const{connection:e}=this.props;if(e.subscribeToFieldUpdates==null){Rt.warn("subscribeToFieldUpdates not supported, not initializing widgets");return}this.widgetListenerRemover=e.subscribeToFieldUpdates(t=>{Rt.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){Rt.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(We.SELECT_NOTEBOOK,n,o,a,i,!0)}}sendClearFilter(){this.emitLayoutEvent(Je.CLEAR_ALL_FILTERS)}emitLayoutEvent(e,...t){this.goldenLayout?.eventHub.emit(e,...t)}handleError(e){we.isCanceled(e)||Rt.error(e)}handleSettingsMenuHide(){this.setState({isSettingsMenuShown:!1})}handleSettingsMenuShow(){this.setState({isSettingsMenuShown:!0})}handleControlSelect(e,t=null){switch(Rt.debug("handleControlSelect",e),e){case Ns.DROPDOWN_FILTER:this.emitLayoutEvent(Je.OPEN_DROPDOWN,{title:"DropdownFilter",type:e,createNewStack:!0,dragEvent:t});break;case Ns.INPUT_FILTER:this.emitLayoutEvent(Je.OPEN_INPUT,{title:"InputFilter",type:e,createNewStack:!0,dragEvent:t});break;case Ns.MARKDOWN:this.emitLayoutEvent(Nm.OPEN,{title:"Markdown",type:e,dragEvent:t});break;case Ns.FILTER_SET_MANAGER:this.emitLayoutEvent(Je.OPEN_FILTER_SET_MANAGER,{title:"FilterSets",type:e,dragEvent:t});break;default:throw new Error(`Unrecognized control type ${e}`)}}handleToolSelect(e){Rt.debug("handleToolSelect",e);const{activeTool:t,setActiveTool:n}=this.props;n(t===e?Ut.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}),Rt.debug("handleWidgetSelect",e,t),this.openWidget(e,t)}handleWidgetsMenuClose(){this.setState({isPanelsMenuShown:!1})}handleAutoFillClick(){const{widgets:e}=this.state;Rt.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(){Rt.info("handleExportLayoutClick"),this.setState({isPanelsMenuShown:!1});try{const{workspace:e}=this.props,{data:t}=e,n=Ia.exportLayout(t);Rt.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){Rt.error("Unable to export layout",e)}}handleImportLayoutClick(){Rt.info("handleImportLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.importElement.current!=null&&(this.importElement.current.value="",this.importElement.current.click())}handleResetLayoutClick(){Rt.info("handleResetLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.resetLayout()}handleImportLayoutFiles(e){e.stopPropagation(),e.preventDefault(),e.target.files!=null&&this.importLayoutFile(e.target.files?.[0])}handleDisconnect(){this.setState({isDisconnected:!0})}handleReconnect(){this.setState({isDisconnected:!1})}handleReconnectAuthFailed(){this.setState({isAuthFailed:!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}=Ia.normalizeLayout(i);n({layoutConfig:a}),t(vn,{filterSets:o,links:r})}catch(t){Rt.error("Unable to import layout",t)}}async resetLayout(){const{layoutStorage:e,session:t}=this.props,{filterSets:n,layoutConfig:s,links:i}=await Ia.getDefaultLayout(e,t!==void 0),{updateDashboardData:o,updateWorkspaceData:a}=this.props;a({layoutConfig:s}),o(vn,{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:Rl.loadComponentPlugin(e)}startListeningForDisconnect(){const{connection:e}=this.props;e.addEventListener(x.IdeConnection.EVENT_DISCONNECT,this.handleDisconnect),e.addEventListener(x.IdeConnection.EVENT_RECONNECT,this.handleReconnect),e.addEventListener(x.CoreClient.EVENT_RECONNECT_AUTH_FAILED,this.handleReconnectAuthFailed)}stopListeningForDisconnect(){const{connection:e}=this.props;e.removeEventListener(x.IdeConnection.EVENT_DISCONNECT,this.handleDisconnect),e.removeEventListener(x.IdeConnection.EVENT_RECONNECT,this.handleReconnect),e.removeEventListener(x.CoreClient.EVENT_RECONNECT_AUTH_FAILED,this.handleReconnectAuthFailed)}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 bl.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:Fo.getServiceWorker,loadPlugin:this.handleLoadTablePlugin,localDashboardId:t,makeModel:()=>AD(s,e.metadata,n)}}hydrateChart(e,t){const{connection:n}=this.props;return{...e,localDashboardId:t,makeModel:()=>{const{metadata:s,panelState:i}=e;return OD(n,s,i)}}}openWidget(e,t){const{connection:n}=this.props;this.emitLayoutEvent(Ee.OPEN,{dragEvent:t,fetch:()=>n.getObject(e),widget:e})}getDashboardPlugins=pe(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,isAuthFailed:u,isDisconnected:m,isPanelsMenuShown:g,isSettingsMenuShown:p,widgets:C}=this.state,f=this.getDashboardPlugins(t);return l.jsxs("div",{className:U("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:Vm,alt:"Deephaven Data Labs",width:"115px",className:"ml-1"}),l.jsxs("div",{children:[l.jsxs(V,{kind:"ghost",className:"btn-panels-menu",icon:zp,onClick:()=>{},children:["Controls",l.jsx(Hc,{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:Kp,children:["Panels",l.jsx(di,{isShown:g,className:"panels-menu-popper",onExited:this.handleWidgetsMenuClose,closeOnBlur:!0,interactive:!0,children:l.jsx(kD,{widgets:C,onExportLayout:this.handleExportLayoutClick,onImportLayout:this.handleImportLayoutClick,onResetLayout:this.handleResetLayoutClick,onSelect:this.handleWidgetSelect})})]}),l.jsx(V,{kind:"ghost",className:U("btn-settings-menu",{"text-warning":n.operateAs!==n.name}),onClick:this.handleSettingsMenuShow,icon:l.jsx(Q,{icon:ko,transform:"grow-3 right-1 down-1"}),tooltip:"User Settings"})]})]})}),l.jsxs(wv,{emptyDashboard:l.jsx(LD,{onAutoFillClick:this.handleAutoFillClick}),id:vn,layoutConfig:a,onGoldenLayoutChange:this.handleGoldenLayoutChange,onLayoutConfigChange:this.handleLayoutConfigChange,onLayoutInitialized:this.openNotebookFromURL,hydrate:this.hydrateDefault,children:[l.jsx(kI,{hydrate:this.hydrateGrid,getDownloadWorker:Fo.getServiceWorker,loadPlugin:this.handleLoadTablePlugin}),l.jsx(RI,{hydrate:this.hydrateChart}),l.jsx(II,{}),l.jsx(FI,{hydrateConsole:Ai.hydrateConsole,notebooksUrl:new URL("/notebooks/",`${window.location}`).href}),l.jsx(NI,{}),l.jsx(WI,{hydrate:this.hydratePandas}),l.jsx(UI,{}),l.jsx(BI,{}),f]}),l.jsx(bt,{in:p,timeout:qe.transitionMidMs,classNames:"slide-left",mountOnEnter:!0,unmountOnExit:!0,children:l.jsx(kn,{serverConfigValues:i,onDone:this.handleSettingsMenuHide})}),l.jsx(oe,{actions:h}),l.jsx("input",{ref:this.importElement,type:"file",accept:".json",style:{display:"none"},onChange:this.handleImportLayoutFiles}),l.jsx(lf,{isOpen:m&&!u,icon:qp,title:l.jsxs(l.Fragment,{children:[l.jsx(yn,{})," Attempting to reconnect..."]}),subtitle:"Please check your network connection."}),l.jsx(li,{confirmButtonText:"Refresh",onConfirm:Ai.handleRefresh,isOpen:u,headerText:"Authentication failed",bodyText:"Credentials are invalid. Please refresh your browser to try and reconnect."})]})}}const KD=d=>({activeTool:Cr(d),dashboardData:Gt(d,vn),layoutStorage:ND(d),plugins:fb(d),connection:cR(d,vn),session:ci(d,vn)?.session,sessionConfig:ci(d,vn)?.config,user:Su(d),workspace:fr(d),serverConfigValues:MD(d)}),qD=wt(KD,{setActiveTool:br,updateDashboardData:Hn,updateWorkspaceData:_u})(Ag(Ai));function YD(){return l.jsxs("div",{className:"app",children:[l.jsx(qD,{}),l.jsx(Xh,{})]})}const XD=Z.module("LocalWorkspaceStorage");class Li{static STORAGE_KEY="deephaven.WorkspaceStorage";static async makeDefaultWorkspaceData(e,t){const{filterSets:n,links:s,layoutConfig:i}=await Ia.getDefaultLayout(e,t?.isConsoleAvailable);return{settings:{defaultDateTimeFormat:He.DEFAULT_DATETIME_FORMAT_STRING,formatter:[],timeZone:He.DEFAULT_TIME_ZONE_ID,showTimeZone:!1,showTSeparator:!0,disableMoveConfirmation:!1,defaultDecimalFormatOptions:{defaultFormatString:xe.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:Ke.DEFAULT_FORMAT_STRING},truncateNumbersWithPound:!1,defaultNotebookSettings:{isMinimapEnabled:!1}},layoutConfig:i,closed:[{}],links:s,filterSets:n}}static async makeDefaultWorkspace(e,t){return{data:await Li.makeDefaultWorkspaceData(e,t)}}layoutStorage;constructor(e){this.layoutStorage=e}async load(e){try{return JSON.parse(localStorage.getItem(Li.STORAGE_KEY)??"")}catch{return XD.info("Unable to load workspace data, initializing to default data"),Li.makeDefaultWorkspace(this.layoutStorage,e)}}async save(e){return localStorage.setItem(Li.STORAGE_KEY,JSON.stringify(e)),e}}class ZD extends Error{isNoConsolesError=!0}function QD(d){return d.isNoConsolesError}const Pi=Z.module("SessionUtils");var Xm=(d=>(d.ANONYMOUS="anonymous",d.PARENT="parent",d))(Xm||{});function JD(){return new URL("/jsapi",`${window.location}`)}function Zm(){const d=JD();return`${d.protocol}//${d.host}`}function e0(){switch(new URLSearchParams(window.location.search).get("authProvider")){case"parent":return"parent";default:return"anonymous"}}function t0(){return new URLSearchParams(window.location.search).get("envoyPrefix")}function n0(){const d=Zm();return Pi.info(`Starting connection to '${d}'...`),new x.IdeConnection(d)}async function s0(d,e){Pi.info("Getting console types...");const t=await d.getConsoleTypes();if(Pi.info("Available types:",t),t.length===0)throw new ZD("No console types available");const n=t[0];Pi.info("Starting session with type",n);const s=await d.startSession(n),i={type:n,id:Ae.generate()};return Pi.info("Console session established",i),{session:s,config:i,connection:d,details:e}}function i0(d){const e=Zm();return Pi.info("createCoreClient",e),new x.CoreClient(e,d)}async function o0(){return fu(YS)}async function a0(){return fu(XS)}async function r0(d){switch(d){case"parent":return o0();case"anonymous":return{type:x.CoreClient.LOGIN_TYPE_ANONYMOUS};default:throw new Error(`Unknown auth type: ${d}`)}}async function l0(d){switch(d){case"parent":return a0();case"anonymous":return{};default:throw new Error(`Unknown auth type: ${d}`)}}class c0{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 go=Z.module("GrpcFileStorageTable");class sr{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=Xe(this.doRefresh.bind(this),sr.REFRESH_DEBOUNCE))}removeBaseRoot(e){return Ce.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 sr(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){go.debug2("doRefresh",this.root),e(this.fetchData())}refresh(){go.debug2("refresh",this.root),this.viewportUpdatePromise?.cancel();const e=new Promise(n=>{this.doRefresh(n)}),t=we.makeCancelable(e.then(n=>{if(this.viewportUpdatePromise!==t)throw new Bi;return this.currentViewportData=n,this.sendUpdate(),n}));t.catch(n=>{we.isCanceled(n)||go.error("Error updating viewport",n)}),this.viewportUpdatePromise=t}refreshInternal(){try{this.refresh()}catch(e){we.isCanceled(e)||go.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,go.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 d0=Z.module("GrpcFileStorage");class $c{static REFRESH_THROTTLE=150;storageService;tables=[];root;constructor(e,t=""){this.storageService=e,this.root=t}removeRoot(e){return Ce.removeRoot(this.root,e)}addRoot(e){return Ce.addRoot(this.root,e)}async createDirectory(e){return await this.storageService.createDirectory(this.addRoot(e)),this.refreshTables(),{type:"directory",id:e,filename:e,basename:Ce.getBaseName(e)}}async getTable(){const e=new sr(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:Ce.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(Ce.getPath(e)),Ce.getBaseName(e));if(t.length===0)throw new Oc;if(t.length>1)throw d0.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=Os(()=>{this.tables.forEach(e=>e.refresh())},$c.REFRESH_THROTTLE)}const Qn=Z.module("AppInit");async function h0(){Qn.debug("Loading plugins...");try{const d=await Rl.loadJson("/js-plugins/manifest.json");if(!Array.isArray(d.plugins))throw new Error("Plugin manifest JSON does not contain plugins array");Qn.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(Rl.loadModulePlugin(a))}const t=await Promise.allSettled(e),n=new Map;for(let s=0;s<t.length;s+=1){const i=t[s],{name:o}=d.plugins[s];i.status==="fulfilled"?n.set(o,i.value):Qn.error(`Unable to load plugin ${o}`,i.reason)}return Qn.info("Plugins loaded:",n),n}catch(d){return Qn.error("Unable to load plugins:",d),new Map}}async function u0(d,e){let t;try{t=await s0(d,e)}catch(n){if(!QD(n))throw n}return t}function Vc(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:g}=d,[p,C]=b.useState(),[f,S]=b.useState(),[v,w]=b.useState(!0),T=b.useCallback(async()=>{try{Qn.info("Initializing Web UI","0.36.0",navigator.userAgent);const F=t0(),_=F!=null?{headers:{"envoy-prefix":F}}:void 0,L=i0(_),B=e0();Qn.info(`Login using auth type ${B}...`);const[O,j]=await Promise.all([r0(B),l0(B)]);await L.login(O);const k=await h0(),A=await(B===Xm.ANONYMOUS&&L.getAsIdeConnection==null?n0():L.getAsIdeConnection());A.addEventListener(x.IdeConnection.EVENT_SHUTDOWN,Lt=>{const{detail:ut}=Lt;Qn.info("Shutdown",`${JSON.stringify(ut)}`),C(`Server shutdown: ${ut??"Unknown reason"}`),S(null)});const H=await u0(A,j),z="user",K=L.getStorageService(),ae=new c0(K,"/layouts"),W=new $c(K,"/notebooks"),G=new Li(ae),te=new iD,ie=await G.load({isConsoleAvailable:H!==void 0}),{data:ce}=ie,{settings:X}=ce;X.defaultDecimalFormatOptions===void 0&&(X.defaultDecimalFormatOptions={defaultFormatString:xe.DEFAULT_FORMAT_STRING}),X.defaultIntegerFormatOptions===void 0&&(X.defaultIntegerFormatOptions={defaultFormatString:Ke.DEFAULT_FORMAT_STRING}),X.truncateNumbersWithPound===void 0&&(X.truncateNumbersWithPound=!1);const{shortcutOverrides:re={}}=X,De=Pe.isMacPlatform?re.mac??{}:re.windows??{};Object.entries(De).forEach(([Lt,ut])=>{Me.get(Lt)?.setKeyState(ut)});const Re={filterSets:ce.filterSets,links:ce.links},ft=await L.getServerConfigValues(),ht=new Map(ft),At={name:z,operateAs:z,groups:[],permissions:{isACLEditor:!1,isSuperUser:!1,isQueryViewOnly:!1,isNonInteractive:!1,canUsePanels:!0,canCreateDashboard:!0,canCreateCodeStudio:!0,canCreateQueryMonitor:!0,canCopy:ht.get("internal.webClient.appInit.canCopy")!=="false",canDownloadCsv:ht.get("internal.webClient.appInit.canDownloadCsv")!=="false"}};t(Ut.DEFAULT),g(ht),n(te),s(vn,Re),i(W),o(ae),a(vn,A),H!==void 0&&r(vn,H),c(k),h(At),m(G),u(ie)}catch(F){Qn.error(F),C(F)}},[t,n,s,i,o,a,r,c,h,u,m,g]),y=b.useCallback(()=>{document.fonts!=null?document.fonts.ready.then(()=>{w(!1)}):w(!1)},[]);b.useEffect(function(){T(),y()},[T,y]);const E=e==null&&p==null||v,I=!E&&p==null,D=p!=null||f!=null?`${p??f}`:null;return l.jsxs(l.Fragment,{children:[I&&l.jsx(YD,{}),l.jsx(ar,{isLoading:E,isLoaded:I,errorMessage:D}),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"})]})]})}Vc.propTypes={workspace:M.shape({}),workspaceStorage:M.shape({close:M.func}),setActiveTool:M.func.isRequired,setCommandHistoryStorage:M.func.isRequired,setDashboardData:M.func.isRequired,setFileStorage:M.func.isRequired,setLayoutStorage:M.func.isRequired,setDashboardConnection:M.func.isRequired,setDashboardSessionWrapper:M.func.isRequired,setPlugins:M.func.isRequired,setUser:M.func.isRequired,setWorkspace:M.func.isRequired,setWorkspaceStorage:M.func.isRequired};Vc.defaultProps={workspace:null,workspaceStorage:null};const m0=d=>({workspace:fr(d),workspaceStorage:mb(d)}),Mh=wt(m0,{setActiveTool:br,setCommandHistoryStorage:bb,setDashboardData:rm,setFileStorage:wb,setLayoutStorage:oD,setDashboardConnection:dR,setDashboardSessionWrapper:hR,setPlugins:Tb,setUser:Cb,setWorkspace:Pu,setWorkspaceStorage:Sb,setServerConfigValues:Eb})(Vc);function g0(){return l.jsx(Lg,{basename:"/ide/",children:l.jsxs(Pg,{children:[l.jsx(Gc,{exact:!0,path:"/",component:Mh}),l.jsx(Gc,{path:"/notebook/:notebookPath+",component:Mh}),l.jsx(_g,{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 p0(){"serviceWorker"in navigator&&navigator.serviceWorker.getRegistrations().then(d=>{d.forEach(e=>{e.scope.endsWith("/download/")||e.unregister()})})}function E0(){return p0(),Fo.registerOnLoaded(),Bt.init({getWorker:()=>new Hg}),window["__react-beautiful-dnd-disable-dev-warnings"]=!0,l.jsx(Oh,{store:ic,children:l.jsx(g0,{})})}export{E0 as AppRoot,E0 as default};
|
|
43
|
-
//# sourceMappingURL=AppRoot-
|
|
43
|
+
//# sourceMappingURL=AppRoot-6d457ba5.js.map
|