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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,43 @@
1
+ import{A as R,z as S,R as Y,P as Mp,B as d,C as gt,D as W,E as w,F as ui,G as sl,H as Ie,I as Je,J as z,K as ue,L as qe,M as Fp,N as xp,O as il,Q as Po,S as _p,T as Lp,U as Ce,V as Ca,W as mi,X as Ph,Y as pt,Z as $a,_ as kp,$ as Op,a0 as Ap,a1 as Pp,a2 as de,a3 as id,a4 as Wa,a5 as Hp,a6 as Vp,a7 as Hh,a8 as Ho,a9 as Vt,aa as ba,ab as od,ac as xt,ad as Vh,ae as Up,af as Bp,ag as Uh,ah as $p,ai as Wp,aj as zp,ak as Gp,al as Kp,am as Bh,an as qp,ao as Yp,ap as Xp,aq as rd,ar as jp}from"./vendor.222459d5.js";import{e as ds,W as Qp,l as Fi,K as bn,a as ld,b as $n,_ as Zp}from"./monaco.1292e04e.js";import{P as Vr,b as Jp,h as eg,p as tg,o as ng,s as sg,t as ig,c as Ql}from"./plotly.14964292.js";import"./helpers.162e09a8.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const r of o.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&s(r)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerpolicy&&(o.referrerPolicy=i.referrerpolicy),i.crossorigin==="use-credentials"?o.credentials="include":i.crossorigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();const og="#1a171a",rg="#f0f0ee",lg="#fcd65b",ag="#9edc6f",cg="#76d9e4",dg="#aa9af4",hg="#f37e3f",ug="#f95d84",mg="#4878ea",pg="#5b5a5c",gg="#9edc6f",fg="#fcd65b",Cg="#f37e3f",bg="#f95d84",Sg="#fcfcfa",wg="#929192",vg="#373438",Tg="#f0f0ee",Eg="#1a171a",yg="#2d2a2e",Ig="#1a171a",Rg="#f0f0ee",Dg="0.15s",Ng={"gray-100":"#fcfcfa","gray-200":"#f0f0ee","gray-300":"#c0bfbf","gray-400":"#929192","gray-500":"#5b5a5c","gray-600":"#555356","gray-700":"#403e41","gray-800":"#373438","gray-850":"#322f33","gray-900":"#211f22",black:og,white:rg,yellow:lg,green:ag,blue:cg,purple:dg,orange:hg,red:ug,primary:mg,"primary-hover":"#235de6","primary-dark":"#343e5d",secondary:pg,success:gg,info:fg,warning:Cg,danger:bg,light:Sg,mid:wg,dark:vg,"text-muted":"#929192",interfacewhite:Tg,interfaceblack:Eg,interfacegray:yg,"content-bg":"#2d2a2e",background:Ig,foreground:Rg,transition:Dg},It=Object.freeze({transitionMs:150,transitionMidMs:200,transitionLongMs:300,transitionSlowMs:1e3,...Ng});class xn extends S.exports.Component{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=Y.createRef(),this.rAF=0;const{isShown:n}=this.props;this.state={show:n,popper:null}}componentDidUpdate(e){const{isShown:n}=this.props;e.isShown!==n&&(n?(cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{this.show()})):this.hide())}componentWillUnmount(){this.destroyPopper(!1)}getVisibleElement(e){return e==null||e.clientHeight>0||e.clientWidth>0?e:this.getVisibleElement(e.parentElement)}initPopper(){let{popper:e}=this.state;const{closeOnBlur:n,referenceObject:s}=this.props;if(e||this.container.current===null)return;let{options:i}=this.props;i={placement:"auto",...i},document.body.appendChild(this.element);let o=this.getVisibleElement(this.container.current);o==null&&(o=this.container.current),e=new Mp(s||o,this.element,i),e.scheduleUpdate(),cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{if(n&&!this.element.contains(document.activeElement)){const r=this.element.firstElementChild;r instanceof HTMLElement&&r.focus()}}),this.setState({popper:e})}destroyPopper(e=!0){cancelAnimationFrame(this.rAF);const{popper:n}=this.state;!n||(n.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:n}=this.state;n||this.destroyPopper(),e()}renderContent(){const{className:e,children:n,timeout:s,interactive:i,closeOnBlur:o}=this.props,{show:r}=this.state;return d(gt,{in:r,timeout:s,classNames:"popper-transition",onEntered:this.handleEnter,onExited:this.handleExit,children:d("div",{onClick:l=>{l.stopPropagation()},onKeyDown:l=>{l.key==="Escape"&&this.hide()},className:W("popper",{interactive:i},e),onBlur:o?this.handleBlur:void 0,tabIndex:o?-1:void 0,role:"presentation",children:w("div",{className:"popper-content",children:[n,d("div",{className:"popper-arrow","x-arrow":""})]})})})}render(){const{popper:e}=this.state,{"data-testid":n}=this.props;return d("div",{className:"popper-parent-container",ref:this.container,style:{display:"none"},"data-testid":n,children:e&&ui.createPortal(this.renderContent(),this.element)})}}xn.propTypes={children:R.exports.node.isRequired,options:R.exports.shape({}),className:R.exports.string,timeout:R.exports.number,onEntered:R.exports.func,onExited:R.exports.func,isShown:R.exports.bool,closeOnBlur:R.exports.bool,interactive:R.exports.bool,referenceObject:R.exports.shape({}),"data-testid":R.exports.string};xn.defaultProps={options:{},className:"",timeout:It.transitionMs,onEntered(){},onExited(){},isShown:!1,interactive:!1,closeOnBlur:!1,referenceObject:null,"data-testid":void 0};const Mg=-1,$h=0,Wh=1,za=2,zh=3,Gh=4;Object.freeze({SILENT:Mg,ERROR:$h,WARN:Wh,INFO:za,DEBUG:zh,DEBUG2:Gh});const En=()=>{};class ad{constructor(e,n){this.name=e,this.prefix=e!=null?`[${e}]`:"",this.error=En,this.warn=En,this.log=En,this.info=En,this.debug=En,this.debug2=En,this.level=n,this.setLogLevel(n)}setLogLevel(e){if(!Number.isFinite(e)){console.warn(`Expected a number for log level. Received: ${e}. Ignoring`);return}this.level=e,this.error=e>=$h?console.error.bind(console,this.prefix):En,this.warn=e>=Wh?console.warn.bind(console,this.prefix):En,this.log=e>=za?console.log.bind(console,this.prefix):En,this.info=this.log,this.debug=e>=zh?console.debug.bind(console,this.prefix):En,this.debug2=e>=Gh?console.debug.bind(console,this.prefix):En}}class Fg extends ad{constructor(e=za){super(null,e),this.modules={}}module(e){return this.modules[e]==null&&(this.modules[e]=new ad(e,this.level)),this.modules[e]}setLogLevel(e){if(super.setLogLevel(e),this.modules==null)return;const n=Object.keys(this.modules);for(let s=0;s<n.length;s+=1)this.modules[n[s]].setLogLevel(e)}}const X=new Fg;var At=(t=>(t.DEBUG="D",t.LOG="L",t.WARN="W",t.ERROR="E",t.UNCAUGHT_ERROR="U",t))(At||{});function mo(t,e){return new CustomEvent(t,{detail:e})}class xg{constructor(){this.isEnabled=!1,this.handleUncaughtError=e=>{const n=[];e.error!=null&&n.push(e.error),e.message&&n.push(e.message),this.eventTarget.dispatchEvent(mo("U",n))},this.debug=console.debug,this.log=console.log,this.warn=console.warn,this.error=console.error,this.eventTarget=new sl}enable(){this.isEnabled||(console.debug=(...e)=>{this.eventTarget.dispatchEvent(mo("D",e)),this.debug.apply(console,e)},console.log=(...e)=>{this.eventTarget.dispatchEvent(mo("L",e)),this.log.apply(console,e)},console.warn=(...e)=>{this.eventTarget.dispatchEvent(mo("W",e)),this.warn.apply(console,e)},console.error=(...e)=>{this.eventTarget.dispatchEvent(mo("E",e)),this.error.apply(console,e)},window.addEventListener("error",this.handleUncaughtError),X.setLogLevel(X.level),this.isEnabled=!0)}disable(){!this.isEnabled||(console.debug=this.debug,console.log=this.log,console.warn=this.warn,console.error=this.error,window.removeEventListener("error",this.handleUncaughtError),X.setLogLevel(X.level),this.isEnabled=!1)}addEventListener(e,n){this.eventTarget.addEventListener(e,n)}removeEventListener(e,n){this.eventTarget.removeEventListener(e,n)}}class Ur{static formatMessages(e){return e.map(s=>{if(typeof s=="string")return s;let i="";try{i=JSON.stringify(s)}catch{i=s.toString()}return i==="{}"?s.toString():i}).join(" ")}static formatStack(e="",n){if(e==="")return"";let s=e.split(`
2
+ `).map(i=>i.trim());switch(n){case At.ERROR:s=s.splice(e[0]==="Error"?4:3);break;case At.UNCAUGHT_ERROR:s=s.splice(e[0]==="Error"?3:2);break}return s!=null?` ${s.join(`
3
+ `)}`:""}constructor(e){this.history=[],this.offset=0,this.limit=1e4,this.isEnabled=!1,this.proxy=e,this.addHistory=this.addHistory.bind(this)}enable(){this.isEnabled||(this.proxy.addEventListener(At.DEBUG,this.addHistory),this.proxy.addEventListener(At.LOG,this.addHistory),this.proxy.addEventListener(At.WARN,this.addHistory),this.proxy.addEventListener(At.ERROR,this.addHistory),this.proxy.addEventListener(At.UNCAUGHT_ERROR,this.addHistory),this.isEnabled=!0)}disable(){!this.isEnabled||(this.proxy.removeEventListener(At.DEBUG,this.addHistory),this.proxy.removeEventListener(At.LOG,this.addHistory),this.proxy.removeEventListener(At.WARN,this.addHistory),this.proxy.removeEventListener(At.ERROR,this.addHistory),this.proxy.removeEventListener(At.UNCAUGHT_ERROR,this.addHistory),this.isEnabled=!1)}addHistory({type:e,detail:n}){const s={type:e,messages:n,time:new Date};switch(e){case At.ERROR:case At.UNCAUGHT_ERROR:s.stack=Error().stack;break}this.history[this.offset%this.limit]=s,this.offset+=1}getHistory(){if(this.offset>this.limit){const e=this.offset%this.limit;this.history=this.history.slice(e).concat(this.history.slice(0,e)),this.offset=this.limit}return this.history}getFormattedHistory(){return this.getHistory().map(n=>`${n.time.toISOString()} ${n.type} ${Ur.formatMessages(n.messages)}`+(n.stack!=null?`
4
+ ${Ur.formatStack(n.stack,n.type)}`:"")).join(`
5
+ `)}}const _g=X.module("Tooltip"),sn=class extends S.exports.Component{constructor(t){super(t),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=Y.createRef(),this.popper=Y.createRef(),this.parent=null,this.timer=null,this.state={isShown:!1}}static handleHidden(){sn.shownTooltipCount-=1,sn.shownTooltipCount===0&&(sn.lastHiddenTime=Date.now())}static handleShown(){sn.shownTooltipCount+=1}componentDidMount(){this.startListening();const{timeout:t}=this.props;t===0&&this.show()}componentDidUpdate(t,e){const{isShown:n}=e,{isShown:s}=this.state;s!==n&&(s?sn.handleShown():sn.handleHidden())}componentWillUnmount(){this.stopListening(),this.stopListeningWindow(),this.stopTimer();const{isShown:t}=this.state;t&&sn.handleHidden()}startListening(){if(!this.container.current||!this.container.current.parentElement){_g.error("Tooltip doesn't have a container or a parent set!");return}this.parent=this.container.current.parentElement,this.parent.addEventListener("mousemove",this.handleMouseMove),this.parent.addEventListener("mouseleave",this.handleMouseLeave),this.parent.addEventListener("mousedown",this.stopShowingTooltip)}stopListening(){!this.parent||(this.parent.removeEventListener("mousemove",this.handleMouseMove),this.parent.removeEventListener("mouseleave",this.handleMouseLeave),this.parent.removeEventListener("mousedown",this.stopShowingTooltip))}startListeningWindow(){window.addEventListener("mousemove",this.handleWindowMouseMove,!0),window.addEventListener("contextmenu",this.stopShowingTooltip,!0),window.addEventListener("wheel",this.handleWheel)}stopListeningWindow(){window.removeEventListener("mousemove",this.handleWindowMouseMove,!0),window.removeEventListener("contextmenu",this.stopShowingTooltip,!0),window.removeEventListener("wheel",this.handleWheel)}handleMouseMove(){this.startTimer()}handleWheel(){const{isShown:t}=this.state;this.popper.current&&this.parent&&t&&!this.popper.current.element.matches(":hover")&&!this.parent.matches(":hover")&&(this.stopTimer(),this.hide())}handleMouseLeave(){const{isShown:t}=this.state;this.stopTimer();const{interactive:e}=this.props;!e&&t&&this.hide()}handleTimeout(){this.show()}handleWindowMouseMove(t){const e=t.clientX,n=t.clientY,{isShown:s}=this.state;if(!this.popper.current||!this.parent)return;const i=this.popper.current.element.getBoundingClientRect(),o=this.parent.getBoundingClientRect();e>=i.left&&e<=i.left+i.width&&n>=i.top&&n<=i.top+i.height?this.handleMouseMove():e>=o.left&&e<=o.left+o.width&&n>=o.top&&n<=o.top+o.height?this.handleMouseMove():s&&(this.stopTimer(),this.hide())}startTimer(){this.stopTimer();const{timeout:t,reshowTimeout:e}=this.props;let n=t;(sn.shownTooltipCount>0||Date.now()-sn.lastHiddenTime<sn.triggerReshowThreshold)&&(n=e),this.timer=window.setTimeout(this.handleTimeout,n)}stopTimer(){this.timer!=null&&(clearTimeout(this.timer),this.timer=null)}show(){var e;const{isShown:t}=this.state;if(this.stopTimer(),!t){(e=this.popper.current)==null||e.show(),this.setState({isShown:!0});const{interactive:n}=this.props;n&&this.startListeningWindow()}}hide(){var t;(t=this.popper.current)==null||t.hide(),this.stopListeningWindow()}update(){var t;(t=this.popper.current)==null||t.scheduleUpdate()}handleExited(){this.setState({isShown:!1});const{onExited:t}=this.props;t()}stopShowingTooltip(){const{isShown:t}=this.state;this.stopTimer(),t&&this.hide()}render(){const{interactive:t,children:e,options:n,referenceObject:s,popperClassName:i,"data-testid":o,onEntered:r}=this.props,{isShown:l}=this.state;return d("div",{ref:this.container,style:{display:"none"},"data-testid":o,children:d(xn,{className:W(i),options:n,ref:this.popper,onEntered:r,onExited:this.handleExited,interactive:t,referenceObject:s,children:w("div",{className:"tooltip-content",children:[" ",l&&e]})})})}};let pe=sn;pe.defaultTimeout=500;pe.defaultReshowTimeout=100;pe.triggerReshowThreshold=300;pe.shownTooltipCount=0;pe.lastHiddenTime=Date.now();pe.defaultProps={interactive:!1,options:{},popperClassName:"",reshowTimeout:sn.defaultReshowTimeout,timeout:sn.defaultTimeout,onEntered:()=>{},onExited:()=>{},"data-testid":void 0};const Lg=100;var Kh=(t=>(t.UP="UP",t.DOWN="DOWN",t))(Kh||{});const Xs=class extends S.exports.Component{constructor(t){super(t),this.getCachedFilteredOptions=Ie((n,s)=>n.filter(i=>i.title.toLowerCase().indexOf(s.toLowerCase())>=0));let{popperOptions:e}=this.props;e={placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}},...e},this.state={title:"",filteredOptions:[],keyboardOptionIndex:0,menuIsOpen:!1,inputWidth:100,invalid:!1,popperOptions:e},this.handleMenuKeyDown=this.handleMenuKeyDown.bind(this),this.handleMenuBlur=this.handleMenuBlur.bind(this),this.handleInputChange=this.handleInputChange.bind(this),this.handleInputKeyDown=this.handleInputKeyDown.bind(this),this.handleInputBlur=this.handleInputBlur.bind(this),this.handelInputFocus=this.handelInputFocus.bind(this),this.handleInputClick=this.handleInputClick.bind(this),this.updateInputValue=Je(this.updateInputValue,Lg),this.handleOptionClick=this.handleOptionClick.bind(this),this.handleMenuOpened=this.handleMenuOpened.bind(this),this.handleMenuExited=this.handleMenuExited.bind(this),this.popper=Y.createRef(),this.cbContainer=Y.createRef(),this.menuContainer=Y.createRef(),this.input=Y.createRef()}setInputWidth(){this.cbContainer.current&&this.setState({inputWidth:this.cbContainer.current.getBoundingClientRect().width})}getValueAndValidate(t){if(!t)return this.setState({invalid:!1}),{value:t,isValid:!1};const{options:e}=this.props,n=e.filter(s=>s.title.toLowerCase()===t.toLowerCase());return n.length<1?(this.setState({invalid:!0}),{value:t,isValid:!1}):(this.setState({invalid:!1}),{value:n[0].value,isValid:!0})}updateInputValue(t){const{menuIsOpen:e}=this.state,{value:n,isValid:s}=this.getValueAndValidate(t);e&&this.processFilterChange(t),this.fireOnChange(n,s)}fireOnChange(t,e=!0){const{onChange:n}=this.props;n(t,e)}processFilterChange(t){var o;const{options:e}=this.props,{menuIsOpen:n}=this.state,s=t?this.getCachedFilteredOptions(e,t):e,i=s.length===1&&s[0].title===t;if(this.setState({filteredOptions:s,keyboardOptionIndex:0}),i&&n){this.closeMenu();return}(o=this.popper.current)==null||o.scheduleUpdate()}resetValue(){this.setState({title:""}),this.fireOnChange("")}handleResize(){this.setInputWidth()}handleMenuKeyDown(t){var i;const{filteredOptions:e,keyboardOptionIndex:n}=this.state,s=e[n];switch(t.key){case"Enter":case"ArrowRight":t.stopPropagation(),t.preventDefault(),s!=null&&(this.setState({title:s.title,invalid:!1}),this.fireOnChange(s.value)),this.closeMenu(),(i=this.input.current)==null||i.focus();break;case"ArrowUp":t.stopPropagation(),t.preventDefault(),this.navigateMenu(Xs.MENU_NAVIGATION_DIRECTION.UP);break;case"ArrowDown":t.stopPropagation(),t.preventDefault(),this.navigateMenu(Xs.MENU_NAVIGATION_DIRECTION.DOWN);break;case"Tab":if(t.stopPropagation(),t.preventDefault(),t.shiftKey){this.navigateMenu(Xs.MENU_NAVIGATION_DIRECTION.UP);break}this.navigateMenu(Xs.MENU_NAVIGATION_DIRECTION.DOWN);break;case"Escape":t.preventDefault(),t.stopPropagation(),this.closeMenu();break}}navigateMenu(t){const{filteredOptions:e,keyboardOptionIndex:n}=this.state;let s=n;t===Xs.MENU_NAVIGATION_DIRECTION.UP?n>0?(s=(s-1)%e.length,this.setState({keyboardOptionIndex:s})):n===0&&(s=e.length-1,this.setState({keyboardOptionIndex:s})):t===Xs.MENU_NAVIGATION_DIRECTION.DOWN&&n<e.length&&(s=(s+1)%e.length,this.setState({keyboardOptionIndex:s})),this.scrollOptionIntoView(s)}handleInputKeyDown(t){const{onEnter:e}=this.props,{menuIsOpen:n}=this.state;n?this.handleMenuKeyDown(t):t.key==="Enter"?e():t.key==="Escape"?(this.resetValue(),t.preventDefault(),t.stopPropagation()):t.key==="ArrowRight"||t.key==="ArrowLeft"||t.key==="Tab"||t.key==="Shift"||this.openMenu()}handleInputChange(t){this.setState({title:t.target.value}),this.updateInputValue(t.target.value)}handleOptionClick(t){var e;this.setState({title:t.title,invalid:!1}),this.fireOnChange(t.value),this.closeMenu(),(e=this.input.current)==null||e.focus()}handelInputFocus(){const{menuIsOpen:t}=this.state;t||this.openMenu()}handleInputClick(){const{menuIsOpen:t}=this.state;t||this.openMenu()}handleInputBlur(t){const{menuIsOpen:e}=this.state;e&&t.relatedTarget instanceof Element&&this.popper.current!==null&&this.popper.current.element.contains(t.relatedTarget)||this.closeMenu(!1)}handleMenuBlur(t){t.relatedTarget===this.input.current||t.relatedTarget instanceof Element&&this.popper.current!==null&&this.popper.current.element.contains(t.relatedTarget)||this.closeMenu(!1)}handleMenuOpened(){var t;(t=this.input.current)==null||t.focus()}handleMenuExited(){const{menuIsOpen:t}=this.state;t&&this.setState({menuIsOpen:!1,keyboardOptionIndex:0})}openMenu(){const{title:t}=this.state;this.processFilterChange(t),this.setInputWidth(),this.setState({menuIsOpen:!0}),window.requestAnimationFrame(()=>{var e;(e=this.popper.current)==null||e.show()})}closeMenu(t=!0){var e,n;this.setState({menuIsOpen:!1,keyboardOptionIndex:0}),t&&((e=this.input.current)==null||e.focus()),(n=this.popper.current)==null||n.hide()}scrollOptionIntoView(t){var e;this.menuContainer.current&&((e=this.menuContainer.current.children.item(t))==null||e.scrollIntoView({behavior:"smooth",block:"nearest"}))}renderMenuElement(){const{inputWidth:t}=this.state;return d("div",{className:W("aci-options"),ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,style:{width:t},onBlur:this.handleMenuBlur,children:this.renderOptions()})}renderOptions(){const{noMatchText:t}=this.props,{title:e,filteredOptions:n}=this.state;return e&&n.length===0?d("div",{className:"no-match",children:t}):n.map((s,i)=>this.renderOption(s,i))}renderOption(t,e){const{keyboardOptionIndex:n}=this.state,s=`option-${e}-${t.value}`;return d("button",{type:"button",className:W("aci-option-btn",{"keyboard-active":n===e}),onClick:()=>this.handleOptionClick(t),onFocus:()=>this.setState({keyboardOptionIndex:e}),children:t.title},s)}render(){const{options:t,inputPlaceholder:e,disabled:n,className:s,defaultTitle:i,spellCheck:o,"data-testid":r}=this.props,{title:l,menuIsOpen:a,popperOptions:c,invalid:h}=this.state;return w("div",{className:"aci-container",ref:this.cbContainer,children:[d("input",{value:l||i,className:W("form-control",s,"aci-input",{"is-invalid":h&&!a}),ref:this.input,onChange:this.handleInputChange,placeholder:e||t[0].title,disabled:n,onFocus:this.handelInputFocus,onClick:this.handleInputClick,onBlur:this.handleInputBlur,onKeyDown:this.handleInputKeyDown,spellCheck:o,"data-testid":r}),d(xn,{ref:this.popper,options:c,className:W("aci-options-popper interactive"),onEntered:this.handleMenuOpened,onExited:this.handleMenuExited,children:this.renderMenuElement()})]})}};let Ga=Xs;Ga.propTypes={options:R.exports.arrayOf(R.exports.shape({title:R.exports.string.isRequired,value:R.exports.string.isRequired})).isRequired,popperOptions:R.exports.shape({}),onChange:R.exports.func,inputPlaceholder:R.exports.string,disabled:R.exports.bool,className:R.exports.string,defaultTitle:R.exports.string,spellCheck:R.exports.bool,onEnter:R.exports.func,noMatchText:R.exports.string,"data-testid":R.exports.string};Ga.defaultProps={onChange(){},inputPlaceholder:"",disabled:!1,className:"",defaultTitle:"",popperOptions:null,spellCheck:!0,onEnter(){},noMatchText:"No matching items found","data-testid":void 0};Ga.MENU_NAVIGATION_DIRECTION=Kh;R.exports.string.isRequired,R.exports.func.isRequired,R.exports.string,R.exports.string,R.exports.bool,R.exports.bool,R.exports.string,R.exports.string,R.exports.string;const ol=t=>{const{children:e,className:n,style:s,"data-testid":i}=t;return d("div",{className:W("btn-group",n),style:s,role:"group","data-testid":i,children:e})};ol.displayName="ButtonGroup";ol.propTypes={children:R.exports.node.isRequired,className:R.exports.string,style:R.exports.object,"data-testid":R.exports.string};ol.defaultProps={className:null,style:{},"data-testid":void 0};const kg=["primary","secondary","tertiary","success","danger","inline","ghost"],Og=["group-end"];function Ag(t,e){switch(t){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 W("btn-link",{"btn-link-icon":e,"btn-link-icon-only":e})}}function Pg(t){switch(t){case"group-end":return W("pl-2","pr-3")}}const ce=Y.forwardRef((t,e)=>{const{kind:n,variant:s,type:i,tooltip:o,icon:r,disabled:l,active:a,onClick:c,className:h,style:u,children:m,"data-testid":p,"aria-label":g}=t,f=Boolean(r&&m==null),b=Ag(n,f);let C;s&&(C=Pg(s));let v;r&&(v=Y.isValidElement(r)?r:d(z,{icon:r}));let T;o!==void 0&&(T=typeof o=="string"?d(pe,{children:o}):o);let E=g;g===void 0&&f&&o!=null&&typeof o=="string"&&(E=o);const y=w("button",{"data-testid":p,ref:e,type:i,className:W("btn",b,C,{active:a},h),onClick:c,style:u,disabled:l,"aria-label":E,children:[r&&v,m,o!=null&&(l===void 0||!l)&&T]});return l!==void 0&&l?w("span",{className:"btn-disabled-wrapper",children:[y,o!==void 0&&T]}):y});ce.displayName="Button";ce.propTypes={kind:R.exports.oneOf(kg).isRequired,variant:R.exports.oneOf(Og),type:R.exports.oneOf(["submit","reset","button"]),tooltip(t){const{tooltip:e,icon:n,children:s}=t;return e===void 0&&n!=null&&s==null?new Error("Tooltip is required for icon only buttons"):null},icon(t){const{children:e,icon:n}=t;return n==null&&e==null?new Error("Icon is required if no children are provided"):e==null&&!Y.isValidElement(n)&&(n==null||n.iconName===""||n.iconName==null)?new Error("Icon must be react element or fontawesome IconDefinition"):null},disabled:R.exports.bool,active:R.exports.bool,onClick(t){const{onClick:e,type:n}=t;return n==="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},children:R.exports.node,className:R.exports.string,style:R.exports.object,"data-testid":R.exports.string};ce.defaultProps={type:"button",onClick:void 0,variant:void 0,tooltip:void 0,icon:void 0,disabled:!1,active:void 0,children:void 0,className:void 0,style:{},"data-testid":void 0};const Vo=({className:t="theme-bg-light",children:e,role:n="role",keyboard:s=!0,isOpen:i=!1,centered:o=!1,size:r,onOpened:l,onClosed:a,toggle:c,"data-testid":h})=>{const u=S.exports.useRef(),m=S.exports.useCallback(g=>{switch(g.key){case"Escape":c==null||c();break}},[c]);S.exports.useEffect(function(){if(i&&s)return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[m,i,s]),S.exports.useEffect(function(){i&&l&&l()},[l,i]),S.exports.useEffect(function(){!i&&a&&a()},[a,i]),i&&!u.current&&(u.current=document.createElement("div"),u.current.setAttribute("style","padding-right: 15px; display: block"),u.current.setAttribute("role","presentation"),document.body.appendChild(u.current));const p=()=>{u.current&&(document.body.removeChild(u.current),u.current=void 0)};return u.current?ui.createPortal(w(ue,{children:[d(gt,{appear:!0,mountOnEnter:!0,unmountOnExit:!0,in:i,classNames:{appearActive:"show",appearDone:"show"},timeout:It.transitionMs,onExited:p,children:d("div",{className:W("modal-backdrop fade"),style:{zIndex:1050}})}),d(gt,{appear:!0,mountOnEnter:!0,unmountOnExit:!0,in:i,classNames:{appearDone:"show"},timeout:It.transitionMs,onExited:p,children:d("div",{className:"modal fade",onClick:c,role:"dialog",style:{display:"block"},children:d("div",{className:W(`modal-dialog ${t}`,{"modal-lg":r==="lg","modal-sm":r==="sm","modal-xl":r==="xl","modal-dialog-centered":o}),style:{zIndex:1040},children:d("div",{className:"modal-content",onClick:g=>g.stopPropagation(),role:"presentation","data-testid":h,children:e})})})})]}),u.current):d(ue,{})},Uo=({className:t="modal-body",style:e,children:n,"data-testid":s})=>d("div",{className:t,"data-testid":s,style:e,children:n}),Bo=({className:t,children:e,closeButton:n=!0,style:s,toggle:i,"data-testid":o})=>w("div",{className:`modal-header ${t}`,style:s,children:[d("h5",{className:"modal-title",children:e}),n&&d("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":"Close",onClick:i,children:d("span",{"aria-hidden":"true",children:"\xD7"})})]}),Ka=({className:t="modal-footer",children:e,"data-testid":n})=>d("div",{className:t,"data-testid":n,children:e}),Wi=t=>{const{isOpen:e,headerText:n,bodyText:s,onCancel:i,onConfirm:o,onDiscard:r,onModalDisable:l,cancelButtonText:a="Cancel",confirmButtonText:c="Okay",discardButtonText:h="Discard",children:u,"data-testid":m}=t,p=S.exports.useRef(null),g=S.exports.useRef(null),f=S.exports.useCallback(()=>{g.current!==null&&g.current.checked&&l&&l(),o()},[o,l]);let b="";return e&&(b=typeof s=="function"?s():s),w(Vo,{isOpen:e,className:"theme-bg-light",onOpened:()=>{var C;(C=p.current)==null||C.focus()},children:[d(Bo,{closeButton:!1,children:n}),d(Uo,{children:b}),w(Ka,{children:[l&&w("div",{className:"custom-control custom-checkbox form-group mr-auto",children:[d("input",{type:"checkbox",className:"custom-control-input",id:"move-confirmation-checkbox",defaultChecked:!1,ref:g,"data-testid":m!==void 0?`${m}-checkbox-confirm`:void 0}),d("label",{className:"custom-control-label",htmlFor:"move-confirmation-checkbox",children:"Don't ask me again"})]}),r&&d("button",{type:"button",className:"btn btn-outline-primary mr-auto","data-dismiss":"modal",onClick:r,"data-testid":m!==void 0?`${m}-btn-discard`:void 0,children:h}),i&&d("button",{type:"button",className:"btn btn-outline-primary","data-dismiss":"modal",onClick:i,"data-testid":m!==void 0?`${m}-btn-cancel`:void 0,children:a}),w(ol,{children:[d(ce,{kind:"primary",onClick:f,ref:p,"data-testid":m!==void 0?`${m}-btn-confirm`:void 0,children:c}),u]})]})]})};Wi.propTypes={isOpen:R.exports.bool.isRequired,headerText:R.exports.string.isRequired,bodyText:R.exports.oneOfType([R.exports.string,R.exports.func]).isRequired,onCancel:R.exports.func,onConfirm:R.exports.func.isRequired,onDiscard:R.exports.func,onModalDisable:R.exports.func,cancelButtonText:R.exports.string,confirmButtonText:R.exports.string,discardButtonText:R.exports.string,children:R.exports.node,"data-testid":R.exports.string};Wi.defaultProps={children:void 0,cancelButtonText:"Cancel",confirmButtonText:"Okay",discardButtonText:"Discard",onCancel:void 0,onDiscard:void 0,onModalDisable:void 0,"data-testid":void 0};const zi=Y.forwardRef((t,e)=>{const{children:n,className:s,disabled:i,onClick:o,style:r,id:l}=t;return d("button",{ref:e,type:"button",className:W("btn",s),onClick:o,style:r,disabled:i,id:l,children:n})});zi.displayName="Button";zi.propTypes={children:R.exports.node,className:R.exports.string,disabled:R.exports.bool,onClick:R.exports.func,style:R.exports.shape({}),id:R.exports.string};zi.defaultProps={children:null,className:"",disabled:!1,onClick:()=>null,style:{},id:""};const qa=({className:t,isFlipped:e,children:n,"data-testid":s})=>{const i=a=>{if(n.length!==2)throw new Error("CardFlip requires 2 children to function");return n[a]},o=S.exports.useRef(null),r=S.exports.useCallback(a=>{a.target===a.currentTarget&&document.body.classList.add("card-flip--is-flipping")},[]),l=S.exports.useCallback(a=>{a.target===a.currentTarget&&document.body.classList.remove("card-flip--is-flipping")},[]);return S.exports.useEffect(function(){if(!o.current)throw Error("ref undefined");o.current.addEventListener("transitionstart",r);const c=o.current;return function(){if(c!=null)return c.removeEventListener("transitionstart",r)}},[r]),w("div",{className:W(t,{"card-flip--show-front":e,"card-flip--show-back":!e}),"data-testid":s,children:[d("div",{className:"card-flip--back",children:i(0)}),d("div",{ref:o,className:"card-flip--front",onTransitionEnd:l,children:i(1)})]})};function Zl(t){return t.then!==void 0}const Ms=class{static disableAllActions(){Ms.actionsDisabled=!0}static enableAllActions(){Ms.actionsDisabled=!1}static isContextActionEvent(t){return Array.isArray(t.contextActions)}static compareActions(t,e){var n,s,i,o,r,l;return t.group!==e.group?((n=t.group)!=null?n:0)>((s=e.group)!=null?s:0)?1:-1:t.order!==e.order?((i=t.order)!=null?i:0)>((o=e.order)!=null?o:0)?1:-1:t.title!==e.title?((r=t.title)!=null?r:"")>((l=e.title)!=null?l:"")?1:-1:t!==e?t>e?1:-1:0}static sortActions(t){if(t==null||!Array.isArray(t))return[];const e=t.slice();return e.sort(Ms.compareActions),e}static isMacPlatform(){const{platform:t}=window.navigator;return t.startsWith("Mac")}static getModifierKey(){return Ms.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(t){const e=Ms.getModifierKey();return t[e]}static copyToClipboard(t){const{clipboard:e}=navigator;return e===void 0?(Ms.copyToClipboardExecCommand(t),Promise.resolve()):navigator.clipboard.writeText(t).catch(()=>{Ms.copyToClipboardExecCommand(t)})}static copyToClipboardExecCommand(t){const e=document.activeElement,n=document.createElement("textarea");if(n.value=t,document.body.appendChild(n),n.focus(),n.select(),!document.execCommand("copy"))throw new Error("Unable to execute copy command");document.body.removeChild(n),e instanceof HTMLElement&&e.focus()}static getMenuItems(t,e=!0){let n=[],s=t;Array.isArray(s)||(s=[s]);for(let i=0;i<s.length;i+=1){const o=s[i];let r;typeof o=="function"?r=o():r=o,r!=null&&(r instanceof Promise?e&&n.push(r):Array.isArray(r)?n=n.concat(r):n.push(r))}return n=n.filter(i=>i.title!==void 0||i.then||i.menuElement),n}static getNextMenuItem(t,e,n){let s=t;s<0&&e<0&&(s=n.length);for(let i=1;i<n.length+1;i+=1){const o=(s+e*i+n.length)%n.length,r=n[o];if(!(r instanceof Promise)&&r.disabled!==!0)return o}return t}};let xe=Ms;xe.actionsDisabled=!1;const cd=X.module("GlobalContextAction");class Hg extends S.exports.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 n=e;n.contextActions==null&&(n.contextActions=[]);const{action:s}=this.props;s.title==null&&!s.menuElement||(n.contextActions==null&&(n.contextActions=[]),n.contextActions.push(s),cd.debug("Received context menu event at global action! Menu items are now: ",n.contextActions))}handleKeyDown(e){var s;const{action:n}=this.props;!xe.actionsDisabled&&n.shortcut!==void 0&&n.shortcut.matchesEvent(e)&&(cd.debug("Global hotkey matched!",e),(s=n.action)==null||s.call(n,e),e.preventDefault(),e.stopPropagation())}render(){return null}}class Vg extends S.exports.Component{render(){const{actions:e,"data-testid":n}=this.props,s=[];for(let i=0;i<e.length;i+=1){const o=e[i],{shortcut:r}=o;if(o.title!=null||o.menuElement||r){const l=d(Hg,{action:o,"data-testid":n},`${o.title}.${r==null?void 0:r.id}`);s.push(l)}}return s}}const ur=X.module("ContextActions");class ie extends S.exports.Component{constructor(e){super(e),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.container=Y.createRef(),this.state={globalActions:[],keyboardActions:[]}}static triggerMenu(e,n,s,i){if(i.length===0)return;const o=new MouseEvent("contextmenu",{clientX:n,clientY:s,bubbles:!0,cancelable:!0});o.contextActions=i,e.dispatchEvent(o)}static getDerivedStateFromProps(e){if(e.actions==null||!Array.isArray(e.actions))return{globalActions:[],keyboardActions:[]};const n=e.actions.filter(i=>!Zl(i)&&typeof i!="function"&&i.isGlobal),s=e.actions.filter(i=>!Zl(i)&&typeof i!="function"&&i.isGlobal!==void 0&&!i.isGlobal&&i.shortcut!=null);return{globalActions:n,keyboardActions:s}}componentDidMount(){var e;(e=this.container.current)!=null&&e.parentElement&&(this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.addEventListener("keydown",this.handleKeyDown))}componentWillUnmount(){var e;(e=this.container.current)!=null&&e.parentElement&&(this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.removeEventListener("keydown",this.handleKeyDown))}handleContextMenu(e){const{ignoreClassNames:n=[]}=this.props;if(n.length>0){let i=e.target;for(;i!=null;){const{classList:o}=i,r=n.find(l=>o.contains(l));if(r!==void 0){ur.debug2(`Contextmenu event ignored based on the target className "${r}"`);return}i=i.parentElement}}if(xe.isContextActionEvent(e)||(e.contextActions=[]),!xe.isContextActionEvent(e))return;const{actions:s}=this.props;if(s!=null){let i=s;Array.isArray(i)&&(i=i.filter(o=>Zl(o)||typeof o=="function"||o.isGlobal===void 0||o.isGlobal)),e.contextActions=e.contextActions.concat(i)}ur.debug("Received context menu event! Menu items are now: ",e.contextActions)}handleKeyDown(e){var s;const{keyboardActions:n}=this.state;for(let i=0;i<n.length;i+=1){const o=n[i];!xe.actionsDisabled&&o.shortcut!=null&&o.shortcut.matchesEvent(e)&&(ur.debug("Context hotkey matched!",e),(s=o.action)==null||s.call(o,e),e.stopPropagation(),e.preventDefault(),ur.debug2("Matched hotkey returned false, key event not consumed"))}}render(){const{"data-testid":e}=this.props,{globalActions:n}=this.state;return d("div",{className:"context-actions-listener",ref:this.container,"data-testid":e,children:d(Vg,{actions:n})})}}ie.groups={default:null,high:100,medium:5e3,low:1e4,global:1e5,edit:100};var Ug={prefix:"vs",iconName:"arrow-left",icon:[512,512,[],"f000","m224 98.976 -160 160V281.6l160 160 22.624 -22.624 -132.672 -132.704H448v-32H113.92L246.656 121.6 224 98.976z"]},dd={prefix:"vs",iconName:"arrow-small-down",icon:[512,512,[],"f000","m342.4 276.48 -80 80h-22.4L160 276.48l22.4 -22.72 52.8 52.48V128h32v178.24L320 253.44l22.4 23.04z"]},Sa={prefix:"vs",iconName:"arrow-small-up",icon:[512,512,[],"f000","M160 208 240 128h22.4l80 80 -22.4 22.72 -52.8 -52.48v178.24h-32V178.24L182.4 231.04 160 208z"]},Bg={prefix:"vs",iconName:"arrow-up",icon:[512,512,[],"f000","m443.328 224 -160 -160h-22.624l-160 160 22.624 22.624L256 113.952V448h32V113.92l132.672 132.704 22.656 -22.624z"]},ai={prefix:"vs",iconName:"check",icon:[512,512,[],"f000","m461.792 106.336 -271.04 320 -25.28 -1.152 -107.2 -152.64 26.176 -18.368 95.296 135.68 257.632 -304.192 24.448 20.672z"]},$g={prefix:"vs",iconName:"chevron-down",icon:[512,512,[],"f000","m255.232 322.304 139.424 -139.424 19.84 19.776L265.088 352h-19.776L96 202.656l19.808 -19.776 139.424 139.424z"]},Wg={prefix:"vs",iconName:"chevron-left",icon:[512,512,[],"f000","m189.696 255.232 139.424 139.424 -19.776 19.84L160 265.088v-19.776L309.344 96l19.776 19.808 -139.424 139.424z"]},qh={prefix:"vs",iconName:"chevron-right",icon:[512,512,[],"f000","M322.304 256.768 182.88 117.344l19.776 -19.84L352 246.912v19.776L202.656 416l-19.776 -19.808 139.424 -139.424z"]},zg={prefix:"vs",iconName:"chevron-up",icon:[512,512,[],"f000","m256.768 189.696 -139.424 139.424 -19.84 -19.776L246.912 160h19.776L416 309.344l-19.808 19.776 -139.424 -139.424z"]},Oo={prefix:"vs",iconName:"circle-large-filled",icon:[512,512,[],"f000","M256 32a217.6 217.6 0 0 1 59.52 8.096 220.768 220.768 0 0 1 98.656 57.76 220.896 220.896 0 0 1 57.728 98.656C477.312 215.616 480 235.424 480 256s-2.688 40.384 -8.096 59.52a220.8 220.8 0 0 1 -22.528 53.568 229.024 229.024 0 0 1 -80.512 80.288 222.912 222.912 0 0 1 -53.376 22.72A223.488 223.488 0 0 1 256 480a223.488 223.488 0 0 1 -59.52 -7.872 227.136 227.136 0 0 1 -53.568 -22.752 233.6 233.6 0 0 1 -45.28 -35.008 233.44 233.44 0 0 1 -35.008 -45.28 227.136 227.136 0 0 1 -22.72 -53.6A223.52 223.52 0 0 1 32 256c0 -20.576 2.624 -40.384 7.872 -59.52a222.976 222.976 0 0 1 22.752 -53.344 228.992 228.992 0 0 1 80.288 -80.512 220.64 220.64 0 0 1 53.6 -22.528A217.856 217.856 0 0 1 256 32z"]},Gg={prefix:"vs",iconName:"circle-large-outline",icon:[512,512,[],"f000","M306.816 70.88A185.856 185.856 0 0 0 256 64c-17.728 0 -34.624 2.336 -50.816 6.88l-0.192 0.064c-16.448 4.512 -31.68 10.944 -45.824 19.232A196.992 196.992 0 0 0 90.24 159.36l-0.064 0.128A190.944 190.944 0 0 0 70.72 205.12 191.552 191.552 0 0 0 64 256c0 17.76 2.24 34.72 6.72 50.912a193.6 193.6 0 0 0 49.536 84.832c11.84 11.68 24.768 21.664 38.912 30.08a195.2 195.2 0 0 0 45.92 19.488A192.64 192.64 0 0 0 256 448c17.76 0 34.72 -2.24 50.912 -6.72 16.48 -4.64 31.68 -11.136 45.632 -19.424l0.128 -0.064a197.12 197.12 0 0 0 69.152 -68.96 187.2 187.2 0 0 0 19.2 -45.824l0.096 -0.192A185.824 185.824 0 0 0 448 256c0 -17.728 -2.304 -34.624 -6.88 -50.816l-0.064 -0.192a184.704 184.704 0 0 0 -19.2 -45.536l-0.064 -0.128a188.8 188.8 0 0 0 -30.144 -38.72l-0.256 -0.256a188.864 188.864 0 0 0 -38.72 -30.144l-0.128 -0.064a184.704 184.704 0 0 0 -45.536 -19.2l-0.192 -0.064zm142.56 298.24a229.024 229.024 0 0 1 -80.512 80.256 222.912 222.912 0 0 1 -53.376 22.72A223.488 223.488 0 0 1 256 480a223.488 223.488 0 0 1 -59.52 -7.872 227.136 227.136 0 0 1 -53.568 -22.752 233.6 233.6 0 0 1 -45.28 -35.008 233.44 233.44 0 0 1 -35.008 -45.28 227.136 227.136 0 0 1 -22.72 -53.6A223.52 223.52 0 0 1 32 256c0 -20.576 2.624 -40.384 7.872 -59.52a222.976 222.976 0 0 1 22.752 -53.344 228.992 228.992 0 0 1 80.288 -80.512 220.64 220.64 0 0 1 53.6 -22.528A217.856 217.856 0 0 1 256 32a217.6 217.6 0 0 1 59.52 8.096 220.768 220.768 0 0 1 98.656 57.76 220.896 220.896 0 0 1 57.728 98.656C477.312 215.616 480 235.424 480 256s-2.688 40.384 -8.096 59.52a220.8 220.8 0 0 1 -22.528 53.568z"]},Kg={prefix:"vs",iconName:"circle-slash",icon:[512,512,[],"f000","M256 32a224 224 0 1 1 -224 224 224.256 224.256 0 0 1 224 -224zM64 256c0 45.376 16.128 89.28 45.536 123.84l270.304 -270.304A191.776 191.776 0 0 0 64 256zm384 0c0 -45.376 -16.128 -89.28 -45.536 -123.84L132.16 402.464A191.776 191.776 0 0 0 448 256z"]},hd={prefix:"vs",iconName:"clippy",icon:[512,512,[],"f000","M224 447.744H128v-288h256v64h32v-80l-16 -16H352v-32h-32a64 64 0 0 0 -128 0H158.08v32H112l-16 16v320l16 16H224v-32zm0 -358.4a32 32 0 0 1 25.6 -25.6 32 32 0 0 1 18.56 1.92 30.08 30.08 0 0 1 14.4 11.52 32 32 0 1 1 -56 30.08 32 32 0 0 1 -2.56 -17.92zm226.56 302.72L416 426.944v-171.2h-32v170.88l-34.56 -34.56 -22.72 22.72 62.08 61.76h22.72l61.76 -61.76 -22.72 -22.72zm-189.44 -133.12h22.72l61.76 61.76 -22.72 22.72 -34.56 -34.56v170.88h-32v-171.2l-34.56 34.88 -22.72 -22.72 62.08 -61.76z"]},$o={prefix:"vs",iconName:"close",icon:[512,512,[],"f000","m256 278.624 116.672 116.704 22.656 -22.624L278.624 256l116.704 -116.672 -22.624 -22.656L256 233.376 139.328 116.672l-22.624 22.656L233.376 256l-116.672 116.672 22.624 22.656L256 278.624z"]},qg={prefix:"vs",iconName:"cloud-download",icon:[512,512,[],"f000","M382.624 192h1.6a95.68 95.68 0 0 1 67.712 28.128 96.096 96.096 0 0 1 0 135.744 95.68 95.68 0 0 1 -67.744 28.128v-32a64.064 64.064 0 0 0 0 -128h-29.248l-3.936 -27.424a79.68 79.68 0 0 0 -68.032 -67.904A79.296 79.296 0 0 0 199.392 176l-10.656 24.384 -25.888 -6.048A79.68 79.68 0 0 0 144.736 192c-21.184 0 -41.504 8.416 -56.448 23.424A80.096 80.096 0 0 0 144.736 352h15.936v32h-15.936a111.552 111.552 0 0 1 -84.096 -37.12 112.064 112.064 0 0 1 62.656 -184.96 110.784 110.784 0 0 1 46.976 1.28 111.552 111.552 0 0 1 117.024 -65.92A111.328 111.328 0 0 1 382.624 192zm-168 163.872 42.048 42.048V224h31.808v172.8l40.896 -40.928 22.624 22.624 -68.672 68.704h-22.656L192 378.528l22.624 -22.656z"]},Yg={prefix:"vs",iconName:"code",icon:[512,512,[],"f000","M150.656 178.496 65.952 263.168l84.704 84.672 -22.656 22.656 -96 -96V251.84l96 -96 22.656 22.656zm224 -22.656L352 178.496l84.704 84.672L352 347.84l22.656 22.656 96 -96V251.84l-96 -96zM157.056 416l28.608 14.336 160 -320L317.056 96l-160 320z"]},Ya={prefix:"vs",iconName:"copy",icon:[512,512,[],"f000","m128 128 32 -32h173.248L448 210.752V448l-32 32H160l-32 -32V128zm288 96 -96 -96H160v320h256V224zM96 32 64 64v320l32 32V64h205.248l-32 -32H96z"]},wa={prefix:"vs",iconName:"device-camera",icon:[512,512,[],"f000","M342.624 96H464l16 16v288l-16 16h-416l-16 -16v-288l16 -16h121.376l27.296 -27.328L208 64h96l11.328 4.672 27.296 27.328zM64 384h384V128h-112l-11.328 -4.672L297.376 96H214.624l-27.296 27.328L176 128H64v256zm48 -224a16 16 0 1 0 0 32 16 16 0 0 0 0 -32zM256 192a64 64 0 1 1 0 128 64 64 0 0 1 0 -128zm0 -32a96 96 0 1 0 0 192 96 96 0 0 0 0 -192z"]},rl={prefix:"vs",iconName:"edit",icon:[512,512,[],"f000","M423.36 32h-46.72L112.64 296l-5.12 7.04L32 434.88 77.12 480l131.84 -75.52 7.04 -5.12L480 135.36V88.64L423.36 32zM77.12 434.88l48.32 -96 46.4 46.4 -94.72 49.6zm122.56 -65.92L143.04 312.32l256 -256 56.64 56.64 -256 256z"]},ud={prefix:"vs",iconName:"file-code",icon:[512,512,[],"f000","m338.24 36.48 104.96 105.6 4.8 11.52v310.4l-16 16h-352l-16 -16v-416l16 -16h247.04l11.2 4.48zM320 160h96l-96 -96v96zM96 64v384h320V192H304L288 176V64H96zm65.984 241.056 58.144 -58.496L197.44 224 128 293.728v22.624l69.472 69.568 22.624 -22.624 -58.112 -58.24zM281.6 246.848l22.4 -22.688 70.048 69.6v22.688L304 385.984l-22.56 -22.688 58.592 -58.24L281.6 246.848z"]},Xg={prefix:"vs",iconName:"file-zip",icon:[512,512,[],"f000","M80 32h352l16 16v160l-4.8 11.2 -27.2 27.52v217.28l-16 16h-320l-16 -16v-416l16 -16zM192 64H160v64h32V64zm0 384h128V245.76l-27.2 -27.2L288 207.04V64H224v80l-16 16H192v32H160V160h-16L128 144V64H96v384h64v-32h32v32zm0 -64v32h32v-32H192zm0 -32v32H160v-32h32zm0 -32h32v32H192v-32zm0 -32v32H160V288h32zm0 -32h32v32H192V256zm0 -32v32H160V224h32zm0 0h32V192H192v32zm196.8 4.8 27.2 -27.52V64h-96v136.64l27.2 27.2 4.8 11.2V448h32V240l4.8 -11.2z"]},jg={prefix:"vs",iconName:"files",icon:[512,512,[],"f000","M373.333 0h-192L149.333 32V128H53.333L21.333 160v321.493L53.333 512h257.493L341.333 481.493V384h100.267l27.733 -30.507V96L373.333 0zm0 45.227 50.773 50.773H373.333V45.227zm-64 434.773h-256v-320H149.333v193.493L181.333 384h128v96zm128 -128h-256v-320H341.333V128h96v224z"]},Br={prefix:"vs",iconName:"filter",icon:[512,512,[],"f000","M480 64v53.44l-160 152.288V448H192V269.728l-160 -152.32V64h448zM224 256v160h64V256l160 -152.32V96H64v7.68L224 256z"]},Qg={prefix:"vs",iconName:"folder-opened",icon:[512,512,[],"f000","M48 448h352l15.36 -11.84 84.16 -224 -15.36 -20.16H448V112l-16 -16H246.72l-27.52 -27.2L208 64h-160l-16 16v352l16 16zM64 96h137.28l27.52 27.2 11.2 4.8H416v64H272l-11.2 4.8 -27.52 27.2H112l-15.04 10.88 -32 98.56L64 96zm324.16 320H70.08l53.44 -160H240l11.2 -4.8 27.52 -27.2h185.28l-75.84 192z"]},Zg={prefix:"vs",iconName:"folder",icon:[512,512,[],"f000","M464 96H246.72l-27.2 -27.2L208.32 64h-160l-16 16v352l16 16h416l16 -16v-320L464 96zm-16.32 271.68V416h-384V224h143.68l11.2 -4.8 27.52 -27.52H448v48l-0.32 128zm0 -207.68h-208l-11.2 4.8 -27.52 27.52H64v-96h137.28l27.2 27.2 11.52 4.8H448l-0.32 31.68z"]},Wo={prefix:"vs",iconName:"gear",icon:[512,512,[],"f000","M291.2 140.8 275.2 64H236.8l-16 76.8 -22.4 9.6 -64 -41.6 -28.8 25.6 41.6 64 -6.4 22.4 -76.8 16v38.4l76.8 16 9.6 25.6 -41.6 64 25.6 25.6 64 -41.6 25.6 9.6 12.8 73.6h38.4l16 -76.8 25.6 -9.6 64 41.6 25.6 -25.6 -41.6 -64 9.6 -25.6 73.6 -12.8V236.8l-76.8 -16 -9.6 -25.6 41.6 -64 -25.6 -25.6 -64 41.6 -22.4 -6.4zM300.8 32l16 76.8L384 67.2l64 64 -44.8 67.2 76.8 12.8v89.6l-76.8 16L448 384l-64 64 -67.2 -44.8 -16 76.8H211.2l-16 -76.8L128 444.8l-64 -64 44.8 -67.2L32 300.8V211.2l76.8 -16L67.2 128l64 -64 67.2 44.8 12.8 -76.8h89.6zm19.2 224c0 35.2 -28.8 64 -64 64s-64 -28.8 -64 -64 28.8 -64 64 -64 64 28.8 64 64zM256 288c19.2 0 32 -12.8 32 -32s-12.8 -32 -32 -32 -32 12.8 -32 32 12.8 32 32 32z"]},Yh={prefix:"vs",iconName:"graph",icon:[512,512,[],"f000","M48 448H480v-32H64V0H32v432l16 16zM96 368v-256l16 -16h64l16 16v256l-16 16h-64l-16 -16zm64 -16V128H128v224h32zm192 -304v320l16 16h64l16 -16v-320l-16 -16h-64l-16 16zm64 16v288h-32V64h32zm-192 304v-192l16 -16h64l16 16v192l-16 16h-64l-16 -16zm64 -16V192H256v160h32z"]},ll={prefix:"vs",iconName:"gripper",icon:[512,512,[],"f000","M160 96h64v64H160zm0 128h64v64H160zm0 128h64v64H160zm128 -256h64v64H288zm0 128h64v64H288zm0 128h64v64H288z"]},Jg={prefix:"vs",iconName:"home",icon:[512,512,[],"f000","m267.52 43.84 203.52 185.6 -22.72 22.72L416 222.848v208.832l-16 16h-96l-16 -16v-112H224v112l-16 16h-96l-16 -16V223.104L64 252.16l-22.72 -22.72 203.2 -185.6h23.04zM128 194.016v221.664h64v-112l16 -16h96l16 16v112h64V193.824L256 77.76 128 194.016z"]},ef={prefix:"vs",iconName:"json",icon:[512,512,[],"f000","M192 95.488V64h-2.88c-10.016 0 -19.712 1.984 -29.088 5.92a74.56 74.56 0 0 0 -24.8 16.96 71.36 71.36 0 0 0 -15.776 24.096v0.032a113.344 113.344 0 0 0 -6.336 26.56v0.064a194.56 194.56 0 0 0 -0.768 27.616c0.384 9.28 0.576 18.56 0.576 27.808 0 6.496 -1.28 12.576 -3.744 18.304v0.032a48.128 48.128 0 0 1 -24.48 25.184 44.032 44.032 0 0 1 -17.856 3.68H64v31.488h2.88c6.24 0 12.16 1.28 17.792 3.872l0.032 0.032c5.696 2.496 10.528 5.888 14.56 10.176l0.064 0.064c4.16 4.16 7.456 9.12 9.824 14.88l0.032 0.064c2.496 5.76 3.744 11.776 3.744 18.112 0 9.28 -0.192 18.56 -0.576 27.808 -0.384 9.472 -0.128 18.72 0.768 27.84v0.032c1.056 9.056 3.168 17.856 6.304 26.368v0.032c3.392 8.736 8.672 16.768 15.808 24.096 7.136 7.36 15.424 13.024 24.8 16.96 9.376 3.936 19.072 5.92 29.12 5.92H192v-31.488h-2.88c-6.4 0 -12.384 -1.216 -18.016 -3.68a51.616 51.616 0 0 1 -14.624 -10.24 53.088 53.088 0 0 1 -9.888 -14.944c-2.368 -5.76 -3.52 -11.84 -3.52 -18.336 0 -7.296 0.096 -14.496 0.352 -21.504 0.256 -7.296 0.256 -14.4 0 -21.28a148.448 148.448 0 0 0 -1.76 -20.48 85.824 85.824 0 0 0 -5.376 -19.488A73.088 73.088 0 0 0 112.704 256a73.088 73.088 0 0 0 23.616 -30.56c2.56 -6.144 4.32 -12.576 5.376 -19.264 1.056 -6.72 1.632 -13.536 1.76 -20.48 0.256 -7.04 0.256 -14.144 0 -21.312 -0.256 -7.168 -0.384 -14.4 -0.384 -21.696a47.04 47.04 0 0 1 28.064 -43.328 42.56 42.56 0 0 1 18.016 -3.872H192zm128 321.024V448h2.88c10.016 0 19.712 -1.984 29.088 -5.92 9.376 -3.936 17.664 -9.6 24.8 -16.96 7.136 -7.36 12.416 -15.36 15.776 -24.096v-0.032c3.2 -8.512 5.28 -17.376 6.336 -26.56v-0.064c0.896 -8.96 1.152 -18.144 0.768 -27.616 -0.384 -9.28 -0.576 -18.56 -0.576 -27.808 0 -6.496 1.28 -12.576 3.744 -18.304v-0.032a48.064 48.064 0 0 1 24.48 -25.184 44.16 44.16 0 0 1 17.856 -3.68H448v-31.488h-2.88c-6.272 0 -12.192 -1.28 -17.824 -3.872l-0.032 -0.032a44.032 44.032 0 0 1 -14.56 -10.176l-0.064 -0.064a45.28 45.28 0 0 1 -9.824 -14.88v-0.064a44.96 44.96 0 0 1 -3.776 -18.112c0 -9.28 0.192 -18.56 0.576 -27.808a197.568 197.568 0 0 0 -0.768 -27.84v-0.032a113.184 113.184 0 0 0 -6.304 -26.368v-0.032a71.36 71.36 0 0 0 -15.808 -24.096 74.592 74.592 0 0 0 -24.8 -16.96 74.4 74.4 0 0 0 -29.12 -5.92H320v31.488h2.88c6.4 0 12.384 1.216 17.984 3.68 5.568 2.624 10.432 6.016 14.624 10.24 4.064 4.288 7.36 9.28 9.888 14.944 2.368 5.76 3.52 11.84 3.52 18.336 0 7.296 -0.096 14.464 -0.352 21.504 -0.256 7.296 -0.256 14.4 0 21.28 0.128 7.104 0.704 13.92 1.76 20.48 1.056 6.848 2.848 13.312 5.376 19.488a73.12 73.12 0 0 0 23.616 30.56 73.12 73.12 0 0 0 -23.616 30.56 86.048 86.048 0 0 0 -5.376 19.264c-1.056 6.72 -1.632 13.536 -1.76 20.48a292.8 292.8 0 0 0 0 21.312c0.256 7.168 0.384 14.4 0.384 21.696a47.072 47.072 0 0 1 -28.064 43.328 42.56 42.56 0 0 1 -18.016 3.872H320z"]},Xh={prefix:"vs",iconName:"kebab-vertical",icon:[512,512,[],"f000","M238.208 442.624a32 32 0 1 0 35.552 -53.216 32 32 0 0 0 -35.52 53.184zM256 288a32 32 0 1 1 0 -64 32 32 0 0 1 0 64zm0 -160a32 32 0 1 1 0 -64 32 32 0 0 1 0 64z"]},tf={prefix:"vs",iconName:"law",icon:[512,512,[],"f000","M468.16 224 416 96h32V64H288V32H256v32H96v32h32L76.16 224H64v32h4.8c4.992 15.936 15.136 29.76 28.8 39.36a79.04 79.04 0 0 0 92.8 0A78.08 78.08 0 0 0 219.52 256H224V224h-14.4L156.16 96H256v256H192l-12.48 5.76 -64 80.32 12.48 25.92h288l12.48 -25.92 -64 -80.32L352 352H288V96h100.16l-53.44 128H320v32h4.8a79.36 79.36 0 0 0 150.72 0H480V224h-11.84zM167.04 272.32a48.64 48.64 0 0 1 -23.04 6.08 46.4 46.4 0 0 1 -22.72 -6.08A47.04 47.04 0 0 1 104 256h80a48.64 48.64 0 0 1 -16.96 16.32zM175.04 224h-64l32 -76.8 32 76.8zm169.28 160L384 432H160L199.68 384h144.64zm56.96 -236.16 32 76.8h-64l32 -76.8zm21.76 125.12a45.12 45.12 0 0 1 -23.04 6.08 43.2 43.2 0 0 1 -22.72 -6.08 49.6 49.6 0 0 1 -17.28 -16.96h80a43.84 43.84 0 0 1 -16.96 16.96z"]},nf={prefix:"vs",iconName:"link-external",icon:[512,512,[],"f000","M48 32H192v32H64v384h384v-128h32v144l-16 16h-416l-16 -16v-416l16 -16zm432 16V256h-32V86.624L231.776 302.88l-22.624 -22.656L425.376 64H256V32h208l16 16z"]},Xa={prefix:"vs",iconName:"link",icon:[512,512,[],"f000","M140.8 96h98.72a108.8 108.8 0 0 1 108.8 108.8v6.56A108.8 108.8 0 0 1 239.52 320H224V288h15.52A76.8 76.8 0 0 0 316.16 211.52V204.8A76.8 76.8 0 0 0 239.68 128H140.8A76.8 76.8 0 0 0 64 204.8v6.56A76.608 76.608 0 0 0 128 286.72v32a108.8 108.8 0 0 1 -96 -107.2V204.8A108.96 108.96 0 0 1 140.8 96zM384 225.28v-32a108.8 108.8 0 0 1 96 107.52v6.56A108.96 108.96 0 0 1 371.36 416h-98.88A108.8 108.8 0 0 1 163.84 307.52V300.8A108.8 108.8 0 0 1 272.48 192H288v32h-15.52A76.8 76.8 0 0 0 195.84 300.8v6.56A76.8 76.8 0 0 0 272.48 384h98.88A76.8 76.8 0 0 0 448 307.52V300.8a76.608 76.608 0 0 0 -64 -75.52z"]},sf={prefix:"vs",iconName:"list-ordered",icon:[512,512,[],"f000","M73.184 74.432 86.144 64h21.664v96h-22.656V89.344l-11.968 8.992v-23.904zM160 96h320v32H160V96zm0 128h320v32H160V224zm320 128H160v32h320v-32zM119.744 244.032l0.928 -1.248 2.08 -2.88a26.88 26.88 0 0 0 4.992 -16.224c0 -3.84 -0.64 -7.68 -1.824 -11.328a27.136 27.136 0 0 0 -15.744 -16.928 35.936 35.936 0 0 0 -14.464 -2.624 35.008 35.008 0 0 0 -14.656 2.784 27.744 27.744 0 0 0 -15.328 16.704A33.216 33.216 0 0 0 64 222.624v1.6h25.92v-1.6a9.6 9.6 0 0 1 1.472 -5.024 5.568 5.568 0 0 1 1.824 -1.728 6.08 6.08 0 0 1 5.504 0 6.016 6.016 0 0 1 1.792 1.92 7.68 7.68 0 0 1 0.992 2.592 14.24 14.24 0 0 1 -1.152 9.28 41.888 41.888 0 0 1 -3.84 5.824l-32 36.416 -0.384 0.416v17.28h63.616v-22.4h-28.8l20.8 -23.168zm-1.184 122.144c1.472 1.024 2.752 2.24 3.84 3.648a26.912 26.912 0 0 1 5.344 17.6c0 3.424 -0.544 6.816 -1.6 10.048a25.344 25.344 0 0 1 -15.584 16 41.216 41.216 0 0 1 -15.36 2.528c-3.68 0 -7.36 -0.512 -10.912 -1.568a30.08 30.08 0 0 1 -8.256 -3.936 24.032 24.032 0 0 1 -5.824 -5.664 34.016 34.016 0 0 1 -3.712 -6.4A33.216 33.216 0 0 1 64 386.496v-1.568h26.048v1.568c0 0.864 0.096 1.76 0.288 2.624a6.624 6.624 0 0 0 0.96 2.368 4.48 4.48 0 0 0 1.696 1.664 6.4 6.4 0 0 0 5.024 0.256 5.088 5.088 0 0 0 1.792 -1.248 7.04 7.04 0 0 0 1.344 -2.4 13.344 13.344 0 0 0 0.544 -4.032 15.456 15.456 0 0 0 -0.704 -5.216 6.4 6.4 0 0 0 -1.632 -2.56 4.416 4.416 0 0 0 -1.92 -0.928 17.184 17.184 0 0 0 -2.464 -0.224h-5.152v-20.64h5.376a7.712 7.712 0 0 0 2.208 -0.352 5.248 5.248 0 0 0 2.08 -1.088 5.6 5.6 0 0 0 1.536 -2.144 9.152 9.152 0 0 0 0.672 -3.872 8.96 8.96 0 0 0 -0.512 -3.2 5.312 5.312 0 0 0 -3.104 -3.168 6.4 6.4 0 0 0 -4.992 0.224 5.248 5.248 0 0 0 -1.76 1.696 11.008 11.008 0 0 0 -1.28 4.992v1.568H64v-1.568a31.584 31.584 0 0 1 5.76 -17.408 25.6 25.6 0 0 1 5.728 -5.952 27.84 27.84 0 0 1 8.384 -4.256c3.648 -1.152 7.488 -1.696 11.328 -1.632 3.712 -0.032 7.392 0.32 11.008 1.152 2.944 0.672 5.76 1.76 8.416 3.2a24.224 24.224 0 0 1 10.24 10.176 23.36 23.36 0 0 1 2.88 11.104 25.92 25.92 0 0 1 -5.344 16.896 17.984 17.984 0 0 1 -3.84 3.648z"]},jh={prefix:"vs",iconName:"loading",icon:[512,512,[],"f000","M445.344 224A192.064 192.064 0 0 0 66.656 224H34.272a224.064 224.064 0 0 1 443.456 0h-32.384z"]},of={prefix:"vs",iconName:"lock",icon:[512,512,[],"f000","M416 224h-32V160a128 128 0 1 0 -256 0v64H96L64 256v192l32 32h320l32 -32V256l-32 -32zM160 160a96 96 0 1 1 192 0v64H160V160zm256 288H96V256h320v192z"]},rf={prefix:"vs",iconName:"markdown",icon:[512,512,[],"f000","M203.04 160h67.2v209.056H223.776l1.76 -169.92 -56.768 169.92H130.304l-57.76 -169.92c1.28 20.608 1.92 169.92 1.92 169.92H32V160h68.992s48.896 143.776 50.464 153.824L203.04 160zm214.72 115.744v-112H355.52v112H293.312l93.344 93.312L480 275.744h-62.24z"]},lf={prefix:"vs",iconName:"menu",icon:[512,512,[],"f000","M512 160H0V128h512v32zm0 256H0v-32h512v32zm0 -128.256H0V256h512v31.744z"]},Qh={prefix:"vs",iconName:"new-file",icon:[512,512,[],"f000","m304 35.2 108.8 112 3.2 12.8v64h-32V192H256V64H96v352h128v32H80l-16 -16v-384l16 -16h214.4l9.6 3.2zM288 64v96h92.8L288 64zm128 448h-32v-96H288v-32h96V288h32v96h96v32h-96v96z"]},af={prefix:"vs",iconName:"new-folder",icon:[512,512,[],"f000","M464 64H246.72l-27.2 -27.2L208.32 32h-160l-16 16v352l16 16H224v-32H63.68V192h143.68l11.2 -4.8 27.52 -27.52H448v48l-0.032 16.32h32.352V80L464 64zm-16.32 64h-208l-11.2 4.8 -27.52 27.52H64v-96h137.28l27.2 27.2 11.52 4.8H448l-0.32 31.68zM416 512h-32v-96H288v-32h96V288h32v96h96v32h-96v96z"]},ja={prefix:"vs",iconName:"pass-filled",icon:[512,512,[],"f000","M256 480A224 224 0 1 0 256 32a224 224 0 0 0 0 448zm-32.64 -132.16h-22.72L128 275.2l22.72 -22.72 61.44 61.44 134.4 -134.72 22.72 22.72 -145.92 145.92z"]},Qa={prefix:"vs",iconName:"pass",icon:[512,512,[],"f000","M200.64 347.84h22.72l145.92 -145.92 -22.72 -22.72 -134.4 134.72 -61.44 -61.44L128 275.2l72.64 72.64zM275.2 32c51.2 3.2 99.2 28.8 134.4 64 41.6 44.8 64 99.2 64 163.2 0 51.2 -19.2 99.2 -51.2 140.8 -32 38.4 -76.8 67.2 -128 76.8 -51.2 9.6 -102.4 3.2 -147.2 -22.4 -44.8 -25.6 -80 -64 -99.2 -112C28.8 294.4 25.6 240 41.6 192c16 -51.2 44.8 -92.8 89.6 -121.6C172.8 41.6 224 28.8 275.2 32zm16 412.8c41.6 -9.6 80 -32 108.8 -67.2 25.6 -35.2 41.6 -76.8 38.4 -121.6 0 -51.2 -19.2 -102.4 -54.4 -137.6 -32 -32 -70.4 -51.2 -115.2 -54.4 -41.6 -3.2 -86.4 6.4 -121.6 32 -35.2 25.6 -60.8 60.8 -73.6 105.6 -12.8 41.6 -12.8 86.4 6.4 128 19.2 41.6 48 73.6 86.4 96 38.4 22.4 83.2 28.8 124.8 19.2z"]},$r={prefix:"vs",iconName:"play",icon:[512,512,[],"f000","M120.96 64 96 77.12v384l24.96 13.44 288 -192V256l-288 -192zM128 431.36V107.2l243.2 162.24L128 431.36z"]},va={prefix:"vs",iconName:"preview",icon:[512,512,[],"f000","M64 64h384l32 32v320l-32 32H64l-32 -32V96l32 -32zm0 352h384V96H64v320zm352 -288H96v96h320V128zm-32 64H128V160h256v32zm-96 192h128V256H288v128zm32 -96h64v64h-64V288zM224 256H96v32h128V256zm-128 96h128v32H96v-32z"]},cf={prefix:"vs",iconName:"record-keys",icon:[512,512,[],"f000","M448 96H96a32 32 0 0 0 -32 32v224a32 32 0 0 0 32 32h352a32 32 0 0 0 32 -32V128a32 32 0 0 0 -32 -32zm0 256H96V128h352v224zm-96 -192h-32v32h32V160zm-32 64H288v32h32V224zm64 -64h32v32h-32V160zm32 128h-32v32h32V288zM192 288h160v32H192V288zm224 -64h-64v32h64V224zM256 160h32v32H256V160zm0 64H224v32h32V224zM128 288h32v32H128V288zm0 -128h32v32H128V160zm96 0H192v32h32V160zM128 224h64v32H128V224z"]},ki={prefix:"vs",iconName:"refresh",icon:[512,512,[],"f000","M149.792 96H64V64h112l16 16V192H160V128a160 160 0 1 0 144.96 -24.352l9.664 -30.528A192 192 0 1 1 149.792 96z"]},es={prefix:"vs",iconName:"remove",icon:[512,512,[],"f000","M480 256H32V224h448v32z"]},df={prefix:"vs",iconName:"reply",icon:[512,512,[],"f000","m201.792 68.672 -128.64 128.64v22.656l128.64 128.64 22.656 -22.624L121.824 223.36H182.08c90.016 0 147.36 19.36 182.56 55.328 35.264 36 51.68 92.064 51.68 173.472v11.2h32v-11.2c0 -84.672 -16.864 -151.04 -60.8 -195.872C343.52 211.36 275.744 191.36 182.08 191.36H124.384l100.064 -100.032 -22.656 -22.656z"]},hf={prefix:"vs",iconName:"ruby",icon:[512,512,[],"f000","m32 230.08 212.48 212.48h23.04L480 230.08v-23.04l-106.24 -106.24 -11.52 -4.8H149.76l-11.52 4.8L32 207.04v23.04zm224 177.92L66.56 218.56 156.48 128h199.04l89.92 90.56L256 408zm0 -247.36h86.08l57.92 57.92 -144 140.8V160.64z"]},Zh={prefix:"vs",iconName:"save",icon:[512,512,[],"f000","m427.296 36.672 48 48L480 96v368l-16 16h-416l-16 -16v-416l16 -16H416l11.296 4.672zM64 64v384h384V102.656L409.376 64H352v128H128V64H64zm192 0v96h64V64H256z"]},Jh={prefix:"vs",iconName:"search",icon:[512,512,[],"f000","M325.333 0a176 176 0 0 0 -131.84 292.693L21.333 488.107l23.893 21.333 171.733 -194.56A176.021 176.021 0 1 0 325.333 0.213V0zm0 320a144 144 0 1 1 0 -288 144 144 0 0 1 0 288z"]},uf={prefix:"vs",iconName:"split-horizontal",icon:[512,512,[],"f000","M448 32H96L64 64v352l32 32h352l32 -32V64l-32 -32zM256 416H96V64h160v352zm192 0H288V64h160v352z"]},mf={prefix:"vs",iconName:"symbol-operator",icon:[512,512,[],"f000","M91.936 35.2c10.72 4.352 19.264 12.736 23.84 23.36 2.304 5.44 3.488 11.264 3.424 17.184a42.88 42.88 0 0 1 -19.52 36.32 43.488 43.488 0 0 1 -24.096 7.136A43.36 43.36 0 0 1 32 75.584a43.36 43.36 0 0 1 26.56 -40.192A43.84 43.84 0 0 1 91.936 35.2zm-9.536 56.48a17.632 17.632 0 0 0 10.624 -16 17.536 17.536 0 1 0 -10.624 16zM205.76 35.488 35.52 205.76l21.952 21.984 170.24 -170.24 -21.952 -21.984zM368 288h32v80H480v32h-80V480h-32v-80H288v-32h80V288zm-183.424 16.8 22.624 22.624L150.624 384l56.576 56.576 -22.624 22.624L128 406.624l-56.576 56.576 -22.624 -22.624L105.376 384l-56.576 -56.576 22.624 -22.624L128 361.376l56.576 -56.576zm43.2 -134.24a43.296 43.296 0 0 0 -40.192 -26.56 43.36 43.36 0 0 0 -40.192 26.56 43.584 43.584 0 0 0 40.224 60.64A43.456 43.456 0 0 0 227.776 170.56zm-24.096 23.84a17.696 17.696 0 0 1 -9.248 9.28 17.504 17.504 0 0 1 -19.168 -3.744 16.928 16.928 0 0 1 -3.744 -5.536 17.408 17.408 0 0 1 22.912 -22.88 18.08 18.08 0 0 1 5.536 3.712 17.568 17.568 0 0 1 3.712 19.168zM448 96h-128v32h128V96z"]},md={prefix:"vs",iconName:"terminal",icon:[512,512,[],"f000","M64 32 32 64v384L64 480h384l32 -32V64L448 32H64zM64 448V64h384v384H64zm120.661 -85.547 22.144 22.635 112.213 -111.851v-19.456l-112.213 -112.213 -22.08 22.613 97.92 100.309 -97.984 97.963z"]},pf={prefix:"vs",iconName:"tools",icon:[512,512,[],"f000","m472.736 111.52 -24.96 -5.888 -67.456 67.072 -38.208 -38.912 65.792 -69.024 -5.76 -25.344a141.44 141.44 0 0 0 -43.104 -7.296 116.48 116.48 0 0 0 -46.624 8.96 122.368 122.368 0 0 0 -37.952 26.88 119.552 119.552 0 0 0 -28 40.48 126.016 126.016 0 0 0 0 94.912 10730.912 10730.912 0 0 0 -197.536 199.488c-6.72 8.8 -9.92 19.776 -9.088 30.816a44.896 44.896 0 0 0 14.848 30.944c3.968 4.32 8.704 7.904 13.984 10.496 5.44 2.4 11.296 3.776 17.216 4.064 10.112 -0.192 19.808 -4.032 27.328 -10.784 49.536 -46.624 144.448 -142.4 198.368 -198.528 14.624 6.208 30.336 9.408 46.208 9.376a119.552 119.552 0 0 0 85.664 -36.256 124.32 124.32 0 0 0 35.552 -87.36 134.752 134.752 0 0 0 -6.272 -44.096zM93.856 445.696a9.92 9.92 0 0 1 -4.32 2.24 13.984 13.984 0 0 1 -4.768 0 11.072 11.072 0 0 1 -4.608 -1.824 10.752 10.752 0 0 1 -3.648 -3.52c-4.48 -4.576 -8.672 -13.28 -4.48 -18.176 43.84 -46.624 134.112 -137.76 190.56 -193.472 3.2 4.224 6.72 8.256 10.496 12.032 3.776 3.936 7.84 7.584 12.16 10.912 -54.592 56 -143.616 146.048 -191.36 191.808zm355.776 -290.08c0.064 24.48 -9.472 48 -26.624 65.536a91.552 91.552 0 0 1 -128.224 0 95.744 95.744 0 0 1 -20.32 -100.384A87.936 87.936 0 0 1 324.48 69.76a88.32 88.32 0 0 1 34.304 -6.848h8.128L308.768 122.848v22.272l60.64 60.352h21.12l59.104 -58.112v8.256zM103.68 214.016h48.992l22.56 22.944 21.696 -21.568 -21.28 -21.696V192.32l1.824 -52.768 -7.04 -13.984 -91.52 -60.224 -18.912 2.112 -26.592 27.168 -2.112 19.168 58.816 93.376 13.568 6.88zm-30.24 -116.224L147.488 146.56 146.24 182.496H111.808L64.064 106.912l9.376 -9.12zm227.36 222.72 21.568 -21.536 99.392 101.92a47.328 47.328 0 0 1 0 65.248 44.928 44.928 0 0 1 -49.568 10.08 41.92 41.92 0 0 1 -13.984 -10.08l-100.544 -102.496 21.728 -21.696 100.224 102.208a12.864 12.864 0 0 0 4.896 3.36 15.264 15.264 0 0 0 11.488 0 12.896 12.896 0 0 0 4.896 -3.36 13.952 13.952 0 0 0 3.2 -4.896 16.8 16.8 0 0 0 1.152 -5.888 17.504 17.504 0 0 0 -1.12 -5.888 13.952 13.952 0 0 0 -3.2 -4.896L300.8 320.512z"]},_n={prefix:"vs",iconName:"trash",icon:[512,512,[],"f000","M320 96h96v32h-32v288l-32 32H128l-32 -32V128H64V96h96V64a32 32 0 0 1 32 -32h96a32 32 0 0 1 32 32v32zM288 64H192v32h96V64zM128 416h224V128H128v288zm64 -256H160v224h32V160zm32 0h32v224H224V160zm64 0h32v224H288V160z"]},cs={prefix:"vs",iconName:"triangle-down",icon:[512,512,[],"f000","M64 177.92 77.216 160h358.208l12.576 17.28L267.936 352h-26.464L64 177.92z"]},eu={prefix:"vs",iconName:"triangle-right",icon:[512,512,[],"f000","M177.92 448 160 434.784V76.576L177.28 64 352 244.064v26.464L177.92 448z"]},hs={prefix:"vs",iconName:"warning",icon:[512,512,[],"f000","M241.92 32h28.16l209.28 392.32 -14.08 23.68H46.08L32 424.32 241.92 32zM256 72.96 72.96 416H438.4L256 72.96zM276 384v-32h-40v32h40zm-40 -64V192h40v128h-40z"]},gf={prefix:"vs",iconName:"watch",icon:[512,512,[],"f000","M240 288h64V256H256V176H224v96l16 16zm-64 -170.592A159.936 159.936 0 0 0 96 256a159.936 159.936 0 0 0 80 138.592V464l16 16h128l16 -16v-69.408A159.936 159.936 0 0 0 416 256a159.936 159.936 0 0 0 -80 -138.592V48L320 32H192l-16 16v69.408zM384 256a128 128 0 1 1 -256 0 128 128 0 0 1 256 0z"]},ff={prefix:"dh",iconName:"arrow-to-bottom",icon:[512,512,[],"f000","m99.2 224 160 160h22.4l160 -160 -22.4 -22.4L288 332.8V64H256v268.8L124.8 201.6l-25.6 22.4zM96 416h352v32H96z"]},Cf={prefix:"dh",iconName:"arrow-to-top",icon:[512,512,[],"f000","m444.8 288 -160 -160h-22.4l-160 160 22.4 22.4L256 179.2V448h32V179.2l131.2 131.2 25.6 -22.4zm3.2 -192H96V64h352v32z"]},bf={prefix:"dh",iconName:"check-square",icon:[512,512,[],"f000","M425.6 64H86.4l-22.4 22.4v342.4l22.4 19.2h342.4l22.4 -22.4V86.4l-25.6 -22.4zm-188.8 284.8h-22.4L144 278.4l22.4 -22.4 60.8 60.8 134.4 -134.4 22.4 22.4 -147.2 144z"]},Sf={prefix:"dh",iconName:"exclamation",icon:[512,512,[],"f000","M275.2 384v-32H236.8v32h38.4zm-38.4 -64V128h38.4v192H236.8z"]},pd={prefix:"dh",iconName:"eye-slash",icon:[512,512,[],"f000","M480 256c0 -32 -99.2 -160 -224 -160 -32 0 -64 9.6 -92.8 22.4L70.4 25.6 25.6 70.4 435.2 480l44.8 -44.8 -76.8 -76.8C451.2 320 480 272 480 256zM256 131.2c96 0 176 92.8 188.8 124.8 -6.4 16 -32 48 -67.2 76.8L316.8 272c3.2 -6.4 3.2 -9.6 3.2 -16 0 -35.2 -28.8 -64 -64 -64 -6.4 0 -9.6 0 -16 3.2L192 147.2c19.2 -9.6 41.6 -16 64 -16zm0 249.6C160 380.8 80 288 67.2 256c6.4 -9.6 19.2 -32 41.6 -54.4l-25.6 -25.6C51.2 208 32 243.2 32 256c0 32 99.2 160 224 160 19.2 0 38.4 -3.2 57.6 -9.6l-28.8 -28.8c-9.6 3.2 -19.2 3.2 -28.8 3.2z"]},Ta={prefix:"dh",iconName:"eye",icon:[512,512,[],"f000","M256 96C131.2 96 32 224 32 256s99.2 160 224 160 224 -128 224 -160 -99.2 -160 -224 -160zm0 284.8C160 380.8 80 288 67.2 256 80 227.2 160 131.2 256 131.2S432 224 444.8 256c-12.8 28.8 -92.8 124.8 -188.8 124.8zM256 192c-35.2 0 -64 28.8 -64 64s28.8 64 64 64 64 -28.8 64 -64 -28.8 -64 -64 -64zm0 92.8c-16 0 -28.8 -12.8 -28.8 -28.8s12.8 -28.8 28.8 -28.8 28.8 12.8 28.8 28.8 -12.8 28.8 -28.8 28.8z"]},wf={prefix:"dh",iconName:"file-csv",icon:[512,512,[],"f000","m444.8 140.8 -105.6 -105.6 -12.8 -3.2H80l-16 16V224h32V64h192v112l16 16H416v32h32V153.6l-3.2 -12.8zM320 160V64l96 96h-96zM80 256l-16 16v192l16 16h352l16 -16v-192l-16 -16h-352zM416 416v32H96V288h320v128zm-217.6 -3.2c-6.4 3.2 -16 3.2 -25.6 3.2 -16 0 -25.6 -3.2 -35.2 -12.8 -9.6 -6.4 -12.8 -19.2 -12.8 -32 0 -16 3.2 -28.8 12.8 -38.4 9.6 -9.6 22.4 -12.8 38.4 -12.8 9.6 0 16 0 22.4 3.2v19.2c-6.4 -3.2 -12.8 -6.4 -22.4 -6.4 -9.6 0 -16 3.2 -22.4 9.6 -6.4 6.4 -9.6 12.8 -9.6 22.4 0 9.6 3.2 16 6.4 22.4 6.4 6.4 12.8 9.6 22.4 9.6 9.6 0 16 -3.2 22.4 -6.4v19.2zm19.2 0v-22.4c3.2 3.2 9.6 6.4 12.8 6.4 3.2 3.2 9.6 3.2 12.8 3.2h6.4c3.2 0 3.2 0 6.4 -3.2l3.2 -3.2v-3.2c0 -3.2 0 -3.2 -3.2 -6.4 3.2 0 0 0 0 -3.2 -3.2 0 -3.2 -3.2 -6.4 -3.2s-6.4 -3.2 -9.6 -3.2c-6.4 -3.2 -12.8 -6.4 -16 -12.8 -3.2 -3.2 -6.4 -9.6 -6.4 -16s0 -9.6 3.2 -12.8c3.2 -3.2 3.2 -6.4 9.6 -9.6 3.2 0 6.4 -3.2 12.8 -3.2h25.6c3.2 0 6.4 0 9.6 3.2v19.2s-3.2 -3.2 -6.4 -3.2 -3.2 0 -6.4 -3.2h-19.2c-3.2 0 -3.2 0 -6.4 3.2l-3.2 3.2v6.4l3.2 3.2s3.2 3.2 6.4 3.2 3.2 3.2 6.4 3.2c3.2 3.2 6.4 3.2 9.6 6.4 3.2 3.2 6.4 3.2 6.4 6.4 3.2 3.2 3.2 6.4 6.4 6.4 0 3.2 3.2 6.4 3.2 9.6 0 6.4 0 9.6 -3.2 12.8 -3.2 3.2 -3.2 6.4 -9.6 9.6 3.2 3.2 0 6.4 -3.2 6.4h-32c-3.2 0 -6.4 -3.2 -12.8 -3.2zm169.6 -92.8 -32 96h-25.6l-32 -96h22.4l19.2 67.2c0 3.2 3.2 6.4 3.2 9.6 0 -3.2 0 -6.4 3.2 -9.6l19.2 -67.2h22.4z"]},vf={prefix:"dh",iconName:"file-download",icon:[512,512,[],"f000","m438.4 137.6 -96 -96L320 32H128L96 64v384l32 32h288l32 -32V160l-9.6 -22.4zM416 448H128V64h160v128h128v256zm-96 -288V64l96 96h-96zm-134.4 182.4 76.8 76.8h22.4l76.8 -76.8 -25.6 -22.4L288 368V227.2H256v140.8L208 320l-22.4 22.4z"]},Tf={prefix:"dh",iconName:"file-search",icon:[512,512,[],"f000","M412.8 147.2 304 35.2 294.4 32H80l-16 16v384l16 16H224v-32H96V64h160v128h128v32h32V160l-3.2 -12.8zM288 160V64l92.8 96H288zm224 329.6 -92.8 -92.8c9.6 -16 16 -32 16 -51.2 0 -51.2 -41.6 -89.6 -89.6 -89.6C297.6 256 256 297.6 256 345.6s41.6 89.6 89.6 89.6c19.2 0 38.4 -6.4 51.2 -16l92.8 92.8 22.4 -22.4zm-224 -144c0 -32 25.6 -57.6 57.6 -57.6s57.6 25.6 57.6 57.6 -25.6 57.6 -57.6 57.6S288 377.6 288 345.6z"]},Ef={prefix:"dh",iconName:"file-spreadsheet",icon:[512,512,[],"f000","m438.4 137.6 -96 -96L320 32H128L96 64v384l32 32h288l32 -32V160l-9.6 -22.4zM416 448H128V64h160v128h128v256zm-96 -288V64l96 96h-96zm64 99.2 -19.2 -19.2H179.2l-19.2 19.2v137.6l19.2 19.2h185.6l19.2 -19.2V259.2zm-150.4 134.4H182.4v-48h51.2v48zm0 -115.2v48H182.4V278.4m115.2 115.2H246.4v-48h48v48zm0 -64H246.4V278.4h48v51.2zm64 64H310.4v-48h48v48zm-51.2 -64V278.4h48v48H310.4z"]},Za={prefix:"dh",iconName:"filter-filled",icon:[512,512,[],"f000","M480 64v54.4l-160 153.6V448H192V268.8L32 118.4V64h448z"]},yf={prefix:"dh",iconName:"filter-slash",icon:[512,512,[],"f000","M480 118.4V64H108.8L70.4 25.6 25.6 70.4l406.4 406.4 44.8 -44.8L320 275.2v-6.4l160 -150.4zM288 416H224v-86.4l-32 -32V448h128v-22.4l-32 -32v22.4zM140.8 96H448v6.4L294.4 249.6 140.8 96z"]},If={prefix:"dh",iconName:"freeze",icon:[512,512,[],"f000","m438.4 300.8 -19.2 -28.8 -60.8 35.2L272 256l86.4 -51.2 60.8 35.2 19.2 -28.8 -44.8 -25.6 48 -28.8 -16 -25.6 -48 28.8V108.8h-35.2v67.2L256 227.2V128l60.8 -35.2 -16 -28.8 -44.8 25.6V32H224v57.6L179.2 64l-16 28.8L224 128v99.2L137.6 176V108.8H102.4V160l-48 -28.8 -16 25.6 48 28.8 -44.8 25.6 19.2 28.8 60.8 -35.2L208 256 121.6 307.2 60.8 272l-19.2 28.8 44.8 25.6 -48 28.8 16 25.6 48 -28.8v51.2h35.2v-67.2L224 284.8V384l-60.8 35.2 16 28.8 44.8 -25.6V480h32v-57.6l44.8 25.6 16 -28.8L256 384V284.8l86.4 51.2v67.2h35.2V352l48 28.8 16 -25.6 -48 -28.8z"]},Jl={prefix:"dh",iconName:"gear-filled",icon:[512,512,[],"f000","m480 211.2 -76.8 -12.8L448 131.2l-64 -64 -67.2 41.6L300.8 32H211.2l-12.8 76.8L131.2 64l-64 64 41.6 67.2 -76.8 16v89.6l76.8 12.8L64 380.8l64 64 67.2 -41.6 16 76.8h89.6l16 -76.8L384 448l64 -64 -44.8 -67.2 76.8 -16V211.2zM256 320c-38.4 0 -64 -25.6 -64 -64s25.6 -64 64 -64 64 25.6 64 64 -25.6 64 -64 64z"]},Rf={prefix:"dh",iconName:"graph-line-down",icon:[512,512,[],"f000","M64 416V0H32v432l16 16H480v-32zm67.2 -291.2 -22.4 22.4 108.8 112 70.4 -64 108.8 124.8H320v32h112l16 -16V224h-32v70.4L288 150.4l-70.4 64z"]},Df={prefix:"dh",iconName:"graph-line-up",icon:[512,512,[],"f000","M64 416V0H32v432l16 16H480v-32zm153.6 -150.4 70.4 64 128 -144V256h32V144l-16 -16H320v32h76.8L288 284.8l-70.4 -64 -108.8 112 22.4 22.4z"]},Nf={prefix:"dh",iconName:"input",icon:[512,512,[],"f000","M464 448h-416l-16 -16v-352l16 -16h416l16 16v352l-16 16zM64 416h384V96H64v320zm96 -224h32v128H160zm64 -32v32H128V160l48 16zm0 160v32l-48 -16L128 352v-32z"]},As={prefix:"dh",iconName:"new-circle-large-filled",icon:[512,512,[],"f000","M240 0C108.8 0 0 108.8 0 240S108.8 480 240 480 480 371.2 480 240 371.2 0 240 0zM352 256H256v96H224V256H128V224h96V128h32v96h96v32z"]},Mf={prefix:"dh",iconName:"pandas",icon:[512,512,[],"f000","M185.6 28.8h54.4v115.2H185.6V28.8zm0 240h54.4V384H185.6V268.8zm0 -89.6h54.4v54.4H185.6V179.2zM96 124.8h54.4V512H96V124.8zm176 240h54.4V480H272v-115.2zm0 -240h54.4v115.2H272V124.8zm0 150.4h54.4v54.4H272V275.2zM361.6 0H416v387.2h-54.4V0z"]},Ff={prefix:"dh",iconName:"panels",icon:[512,512,[],"f000","m496 288 16 16v160l-16 16h-192l-16 -16v-160l16 -16h192zm0 -256h-192l-16 16v160l16 16h192l16 -16v-160l-16 -16zM16 32l-16 16v160l16 16h192l16 -16v-160L208 32h-192zm0 256 -16 16v160l16 16h192l16 -16v-160L208 288h-192z"]},xf={prefix:"dh",iconName:"python",icon:[512,512,[],"f000","M198.4 249.6h99.2s57.6 0 57.6 -54.4V102.4s9.6 -54.4 -99.2 -54.4c-105.6 0 -99.2 44.8 -99.2 44.8v48H256v12.8H115.2s-67.2 -6.4 -67.2 99.2c0 105.6 57.6 102.4 57.6 102.4h35.2V307.2s-3.2 -57.6 57.6 -57.6zm3.2 -131.2c-9.6 0 -19.2 -9.6 -19.2 -19.2s6.4 -19.2 19.2 -19.2c9.6 0 19.2 9.6 19.2 19.2s-9.6 19.2 -19.2 19.2zm208 35.2h-35.2v48s3.2 57.6 -57.6 57.6H217.6S160 259.2 160 313.6v92.8s-12.8 54.4 99.2 54.4c105.6 0 99.2 -44.8 99.2 -44.8v-48H259.2v-12.8h140.8s67.2 6.4 67.2 -99.2 -57.6 -102.4 -57.6 -102.4zm-96 236.8c9.6 0 19.2 9.6 19.2 19.2s-9.6 19.2 -19.2 19.2 -19.2 -9.6 -19.2 -19.2 9.6 -19.2 19.2 -19.2z"]},Ja={prefix:"dh",iconName:"refresh",icon:[512,512,[],"f000","m313.6 73.6 -9.6 32c83.2 25.6 131.2 118.4 102.4 201.6 -19.2 64 -80 108.8 -150.4 108.8 -89.6 0 -160 -70.4 -160 -160 0 -51.2 22.4 -96 64 -128v64h32V80L176 64H64v32h86.4c-76.8 51.2 -108.8 150.4 -70.4 236.8C112 403.2 179.2 448 256 448c105.6 0 192 -86.4 192 -192 0 -83.2 -54.4 -156.8 -134.4 -182.4z"]},_f={prefix:"dh",iconName:"remove-square-filled",icon:[512,512,[],"f000","M432 32h-384l-16 16v384l16 16h384l16 -16v-384l-16 -16zM352 256H128V224h224v32z"]},Lf={prefix:"dh",iconName:"run-selection",icon:[704,512,[],"f000","M124.8 64 128 96h-3.2c-6.4 0 -12.8 0 -19.2 3.2 -16 6.4 -25.6 25.6 -25.6 44.8v44.8c0 6.4 0 12.8 -3.2 19.2 0 6.4 -3.2 12.8 -6.4 19.2 -3.2 9.6 -12.8 22.4 -22.4 28.8 9.6 6.4 19.2 19.2 22.4 32 3.2 6.4 3.2 12.8 6.4 19.2 0 6.4 3.2 12.8 3.2 19.2v44.8c0 6.4 0 12.8 3.2 19.2 3.2 6.4 6.4 9.6 9.6 16 3.2 3.2 9.6 6.4 16 9.6H128v32h-3.2c-9.6 0 -19.2 -3.2 -28.8 -6.4 -9.6 -3.2 -19.2 -9.6 -25.6 -16 -6.4 -6.4 -12.8 -16 -16 -25.6 -3.2 -9.6 -6.4 -16 -6.4 -25.6V316.8c0 -6.4 0 -12.8 -3.2 -19.2 -3.2 -3.2 -6.4 -6.4 -9.6 -12.8 -3.2 -3.2 -9.6 -6.4 -16 -9.6 -3.2 -3.2 -9.6 -3.2 -16 -3.2H0v-32h3.2c6.4 0 12.8 0 19.2 -3.2 9.6 -6.4 19.2 -12.8 22.4 -25.6 3.2 -6.4 3.2 -12.8 3.2 -19.2V134.4c0 -9.6 3.2 -19.2 6.4 -25.6 3.2 -6.4 9.6 -16 16 -22.4 6.4 -6.4 16 -12.8 25.6 -16 9.6 -3.2 19.2 -6.4 28.8 -6.4zm576 176c-6.4 0 -12.8 0 -19.2 -3.2 -6.4 -3.2 -9.6 -6.4 -16 -9.6 -3.2 -3.2 -6.4 -9.6 -9.6 -16 -3.2 -6.4 -3.2 -12.8 -3.2 -19.2V134.4c0 -9.6 -3.2 -19.2 -6.4 -25.6 -3.2 -9.6 -9.6 -16 -16 -25.6 -6.4 -6.4 -16 -12.8 -25.6 -16 -6.4 0 -16 -3.2 -25.6 -3.2H576v32h3.2c6.4 0 12.8 0 19.2 3.2 6.4 3.2 9.6 6.4 16 9.6 3.2 3.2 6.4 9.6 9.6 16 3.2 6.4 3.2 12.8 3.2 19.2v44.8c0 6.4 0 12.8 3.2 19.2 0 6.4 3.2 12.8 6.4 19.2 6.4 12.8 12.8 22.4 22.4 32 -9.6 6.4 -19.2 19.2 -22.4 32 -3.2 6.4 -3.2 12.8 -6.4 19.2 0 6.4 -3.2 12.8 -3.2 19.2v44.8c0 19.2 -9.6 35.2 -28.8 44.8 -6.4 -3.2 -12.8 -3.2 -19.2 -3.2H576v32h3.2c9.6 0 19.2 -3.2 28.8 -6.4 9.6 -3.2 19.2 -9.6 25.6 -16 6.4 -6.4 12.8 -16 16 -25.6 3.2 -9.6 6.4 -16 6.4 -25.6V316.8c0 -6.4 0 -12.8 3.2 -19.2 3.2 -9.6 12.8 -16 25.6 -22.4 6.4 -3.2 12.8 -3.2 19.2 -3.2l-3.2 -32zm-192 28.8 -240 160 -25.6 -12.8V96l25.6 -12.8 240 160v25.6zM470.4 256 275.2 124.8V384l195.2 -128z"]},kf={prefix:"dh",iconName:"shapes",icon:[512,512,[],"f000","M195.2 320 160 256 128 313.6 105.6 352 32 480h256l-73.6 -128 -19.2 -32zm112 -76.8c51.2 -35.2 121.6 -22.4 156.8 28.8s22.4 121.6 -28.8 156.8c0 0 -3.2 0 -3.2 3.2 -51.2 32 -121.6 19.2 -153.6 -32 -35.2 -54.4 -22.4 -121.6 28.8 -156.8zM96 32v192h192V32H96z"]},ec={prefix:"dh",iconName:"sort-alpha-down",icon:[512,512,[],"f000","M236.8 368 156.8 448h-22.4l-80 -80 22.4 -22.4L128 396.8V64h32v332.8l51.2 -51.2 25.6 22.4zM371.2 224l-6.4 -28.8H316.8l-9.6 28.8H256l54.4 -160h60.8l51.2 160h-51.2zm-32 -124.8c0 3.2 -3.2 3.2 -3.2 9.6s-3.2 19.2 -12.8 51.2h32l-9.6 -44.8c-3.2 -6.4 -6.4 -9.6 -6.4 -16zm-6.4 310.4h73.6V448H272v-32l73.6 -89.6H275.2V288h128v32l-70.4 89.6z"]},tc={prefix:"dh",iconName:"sort-alpha-up",icon:[512,512,[],"f000","M51.2 144 131.2 64h22.4l80 80 -22.4 22.4L160 115.2V448H128V115.2L76.8 166.4l-25.6 -22.4zm320 304 -6.4 -28.8H316.8l-9.6 28.8H256l54.4 -160h60.8l51.2 160h-51.2zm-32 -124.8c0 3.2 -3.2 3.2 -3.2 9.6 0 6.4 -3.2 19.2 -12.8 51.2h32l-9.6 -44.8c-3.2 -6.4 -6.4 -9.6 -6.4 -16zm-6.4 -137.6h73.6V224H272V192l73.6 -89.6H275.2V64h128v32l-70.4 89.6z"]},gd={prefix:"dh",iconName:"sort-amount-down",icon:[512,512,[],"f000","M204.8 368 124.8 448h-22.4L22.4 368l22.4 -22.4L96 396.8V64h32v332.8l51.2 -51.2 25.6 22.4zM256 64h256v64H256zm0 105.6h192v64H256zm0 108.8h128v64H256zM256 384h64v64H256z"]},Of={prefix:"dh",iconName:"sort-down",icon:[512,512,[],"f000","m128 288 -12.8 25.6 128 118.4h25.6l128 -118.4L384 288H128z"]},Af={prefix:"dh",iconName:"sort-up",icon:[512,512,[],"f000","m128 224 -12.8 -25.6 128 -118.4h25.6l128 118.4 -12.8 25.6H128z"]},nc={prefix:"dh",iconName:"sort",icon:[512,512,[],"f000","m128 224 -12.8 -25.6 128 -118.4h25.6l128 118.4 -12.8 25.6H128zm0 64 -12.8 25.6 128 118.4h25.6l128 -118.4L384 288H128z"]},fd={prefix:"dh",iconName:"square-filled",icon:[512,512,[],"f000","M432 32h-384l-16 16v384l16 16h384l16 -16v-384l-16 -16z"]},sc={prefix:"dh",iconName:"table",icon:[512,512,[],"f000","M432 64h-384l-16 16v352l16 16h384l16 -16v-352l-16 -16zM160 416H64v-64h96v64zm0 -96H64V256h96v64zm0 -96H64V160h96v64zm128 192H192v-64h96v64zm0 -96H192V256h96v64zm0 -96H192V160h96v64zm128 192h-96v-64h96v64zm0 -96h-96V256h96v64zm0 -96h-96V160h96v64z"]},Pf={prefix:"dh",iconName:"trash-undo",icon:[512,512,[],"f000","M320 96h96v32h-32v288l-32 32H128l-32 -32V128H64V96h96V64c0 -19.2 12.8 -32 32 -32h96c19.2 0 32 12.8 32 32v32zM288 64H192v32h96V64zM128 416h224V128H128v288zm112 -64L160 272v-22.4l80 -80 22.4 22.4 -51.2 54.4H320v32H211.2l51.2 51.2 -22.4 22.4z"]},tu={prefix:"dh",iconName:"triangle-down-square",icon:[512,512,[],"f000","M425.6 64H86.4l-22.4 22.4v342.4l22.4 19.2h342.4l22.4 -22.4V86.4l-25.6 -22.4zm-160 288h-22.4L99.2 208l9.6 -16h291.2l9.6 12.8L265.6 352z"]},Hf={prefix:"dh",iconName:"unlink",icon:[512,512,[],"f000","M32 211.2v-6.4C32 144 80 96 140.8 96h99.2c12.8 0 25.6 3.2 38.4 6.4l-25.6 25.6H140.8C99.2 128 64 163.2 64 204.8v6.4c0 28.8 16 54.4 38.4 67.2l-22.4 22.4C51.2 281.6 32 249.6 32 211.2zM403.2 6.4l-38.4 38.4 -67.2 67.2 -22.4 25.6 -150.4 147.2 -25.6 25.6 -54.4 54.4 -38.4 38.4L51.2 448 448 51.2 403.2 6.4zM384 192v32c38.4 6.4 64 38.4 64 76.8v6.4c0 41.6 -35.2 76.8 -76.8 76.8H272c-32 0 -60.8 -22.4 -73.6 -51.2l-25.6 25.6c19.2 35.2 54.4 60.8 96 60.8h99.2c60.8 0 108.8 -48 108.8 -108.8v-9.6C480 246.4 438.4 198.4 384 192zM246.4 288l-22.4 19.2v12.8h16c60.8 0 108.8 -48 108.8 -108.8v-6.4c0 -6.4 0 -12.8 -3.2 -19.2l-32 32c0 38.4 -32 67.2 -67.2 70.4z"]},Cd={prefix:"dh",iconName:"warning-circle-filled",icon:[512,512,[],"f000","M470.4 195.2c-9.6 -38.4 -28.8 -70.4 -57.6 -99.2 -25.6 -25.6 -60.8 -44.8 -96 -54.4C297.6 35.2 275.2 32 256 32c-19.2 0 -41.6 3.2 -60.8 9.6 -16 3.2 -35.2 9.6 -51.2 22.4 -35.2 19.2 -60.8 44.8 -80 80 -12.8 16 -19.2 35.2 -25.6 51.2C35.2 214.4 32 236.8 32 256c0 19.2 3.2 41.6 6.4 60.8 6.4 16 12.8 35.2 25.6 51.2 9.6 16 22.4 32 35.2 44.8 12.8 16 28.8 25.6 44.8 35.2 16 9.6 35.2 16 54.4 22.4 16 6.4 38.4 9.6 57.6 9.6 19.2 0 41.6 -3.2 60.8 -6.4 19.2 -6.4 35.2 -12.8 54.4 -22.4 32 -19.2 60.8 -48 80 -80 9.6 -16 16 -35.2 22.4 -54.4 3.2 -19.2 6.4 -41.6 6.4 -60.8s-3.2 -41.6 -9.6 -60.8zM275.2 352H236.8v-32h38.4v32zm0 -64H236.8V160h38.4v128z"]},nu={prefix:"dh",iconName:"warning-filled",icon:[512,512,[],"f000","M268.8 32h-25.6L32 425.6l12.8 22.4h419.2l12.8 -22.4L268.8 32zm6.4 352H236.8v-32h38.4v32zm0 -64H236.8V192h38.4v128z"]};const al=Y.forwardRef((t,e)=>{var b,C;function n(v){const{menuItem:T,onMenuItemClick:E}=t;E(T,v)}function s(v){const{menuItem:T,onMenuItemMouseMove:E}=t;E(T,v)}function i(v){const{menuItem:T,onMenuItemContextMenu:E}=t;E(T,v)}function o(v,T,E){if(typeof v.type=="string")return v;const{closeMenu:y,menuItem:I,isKeyboardSelected:D,isMouseSelected:M,"data-testid":x}=t,B={menuItem:I,closeMenu:y,isKeyboardSelected:D,isMouseSelected:M,iconElement:T,displayShortcut:E,"data-testid":x};return Y.cloneElement(v,{forwardedProps:B})}const{children:r,menuItem:l,isKeyboardSelected:a,isMouseSelected:c,"data-testid":h}=t,u=(b=l.shortcut)==null?void 0:b.getDisplayText();let m=null;if(l.icon){const v=l.icon;if(Y.isValidElement(v))m=v;else{let T;l.iconColor!=null&&(l.disabled===void 0||!l.disabled)&&(T={color:l.iconColor}),m=d(z,{icon:v,style:T})}}let p=null;const g=Boolean(r);l.actions&&(p=d(z,{icon:qh}));let f=null;if(l.menuElement)f=d("div",{className:"custom-menu-item",onMouseMove:s,children:o(l.menuElement,m,u)});else{const v=l.disabled,T=l.iconOutline;f=d("button",{type:"button",className:W("btn-context-menu",{disabled:v},{active:(g||c)&&(v===void 0||!v)},{"keyboard-active":a!==void 0&&a&&(v===void 0||!v)}),onClick:n,onMouseMove:s,onContextMenu:i,title:(C=l.description)!=null?C:"",children:w("div",{className:"btn-context-menu-wrapper",children:[d("span",{className:W("icon",{outline:T}),children:m}),d("span",{className:"title",children:l.title}),u!==void 0&&d("span",{className:"shortcut",children:u}),p&&d("span",{className:W("submenu-indicator",{disabled:v}),children:p})]})})}return w("div",{className:"context-menu-item",ref:e,"data-testid":h,children:[r,f]})});al.displayName="ContextMenuItem";al.defaultProps={children:null,isKeyboardSelected:!1,isMouseSelected:!1,"data-testid":void 0};class ci extends Error{constructor(){super(...arguments),this.isCanceled=!0}}class cl{static isDark(e){const n=document.createElement("div");n.style.display="none",n.style.color=e;const s=getComputedStyle(document.body.appendChild(n)).color,i=s.match(/\d+/g);let o=[];if(i)o=i.map(l=>parseInt(l,10));else throw new Error(`Invalid color received. Got ${s}`);return document.body.removeChild(n),cl.getBrightness(o)<125}static getBrightness(e){return Math.round((e[0]*299+e[1]*587+e[2]*114)/1e3)}}const Vf="table_",su="column_",Uf=new Set(["in","not","i","ii","k"]),Bf=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"]),$f=/[^a-zA-Z0-9_$+@-]/g,Wf=/[^A-Za-z0-9_$]/g,Qi=class{};let ps=Qi;ps.legalize=(t,e,n,s,i)=>{let o=t.trim().replace(/[- ]/g,"_");return s&&(Uf.has(o)||Bf.has(o))&&(o=e+o),o=o.replace(n,""),o||(o=e+i),Number.isNaN(Number(o.charAt(0)))||(o=e+o),o};ps.legalizeTableName=t=>Qi.legalize(t,Vf,$f,!1,0);ps.legalizeColumnNames=t=>{const e=[];return t.forEach((n,s)=>{let i=Qi.legalizeColumnName(n,s);e.includes(i)&&(i=su+s),e.push(i)}),e};ps.legalizeColumnName=(t,e=0)=>Qi.legalize(t,su,Wf,!0,e);ps.isValidTableName=t=>Qi.legalizeTableName(t)===t;ps.isValidColumnName=t=>Qi.legalizeColumnName(t)===t;function zf(t,e){return t?t.closest(`.${e}`):null}const Gf={getClosestByClassName:zf};class Ye extends CustomEvent{constructor(e,n){super(e,n)}}class iu extends Error{constructor(){super(...arguments),this.isTimeout=!0}}class Re{static makeCancelable(e,n){let s=!1,i;const o=new Promise((r,l)=>{Promise.resolve(e).then(a=>{s?(n&&n(a),l(new ci)):(i=a,r(a))},a=>l(s?new ci:a))});return o.cancel=()=>{s=!0,i!=null&&n&&n(i)},o}static isCanceled(e){return e instanceof ci}static isTimedOut(e){return e instanceof iu}}class gs{constructor(){this.pending=[],this.resolved=[]}add(e,n){const s=Re.makeCancelable(e,n);return this.pending.push(s),s.then(()=>{this.resolve(s)},()=>{this.resolve(s)}),s}remove(e){for(let n=0;n<this.pending.length;n+=1)if(this.pending[n]===e){this.pending.splice(n,1);return}}resolve(e){this.remove(e),this.resolved.push(e)}cancel(){const e=[...this.pending,...this.resolved];for(let n=0;n<e.length;n+=1)e[n].cancel();this.pending=[],this.resolved=[]}}function A(t){if(t==null)throw new Error("Value is null or undefined")}class Sn{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(!Sn.isValidRange(e))throw new Error(`Invalid range! ${e}`)}static isSelected(e,n){for(let s=0;s<e.length;s+=1){const i=e[s],o=i[0],r=i[1];if(o<=n&&n<=r)return!0}return!1}static selectRange(e,n){let[s,i]=n;const o=[...e];for(let r=o.length-1;r>=0;r-=1){const l=o[r],a=l[0],c=l[1];if(a<=s&&i<=c)return o;s<=c&&a<=i&&(s=Math.min(s,a),i=Math.max(i,c),o.splice(r,1))}return o.push([s,i]),o}static deselectRange(e,n){const[s,i]=n,o=[...e];for(let r=o.length-1;r>=0;r-=1){const l=o[r],a=l[0],c=l[1];if(!(i<a||c<s))if(a<s&&i<c){o[r]=[a,s-1],o.splice(r+1,0,[i+1,c]);break}else s<=a&&c<=i?o.splice(r,1):a<s?o[r]=[a,s-1]:o[r]=[i+1,c]}return o}static count(e){return e.reduce((n,s)=>n+(s[1]-s[0]+1),0)}}class on{static join(e,n="and"){if(e==null||e.length===0)return"";if(e.length===1)return e[0];if(e.length===2)return`${e[0]} ${n} ${e[1]}`;const s=e.slice(0,e.length-1).join(", "),i=e[e.length-1];return`${s}, ${n} ${i}`}static toLower(e,n=!0){if(e==null){if(n)return"";throw new Error("Null string passed in to TextUtils.toLower")}return e.toLowerCase()}static sort(e,n,s=!0){return e<n?s?-1:1:e>n?s?1:-1:0}}const ou=class{static formatElapsedTime(t){if(typeof t!="number"||!Number.isInteger(t))throw new Error(`${t} is not a number that can be expressed as a formatted time`);const e=Math.floor(t/3600),n=Math.floor(t%3600/60),s=t%60;return`${e>0?`${e}h `:""}${n>0||e>0?`${n}m `:""}${t>=60?`${s}s`.padStart(3,"0"):`${s}s`}`}static formatTime(t){if(typeof t!="number"||!Number.isInteger(t)||t<0)throw new Error(`${t} is not a number that can be expressed as a formatted time`);const e=String(Math.floor(t/(60*60))).padStart(2,"0"),n=t%(60*60),s=String(Math.floor(n/60)).padStart(2,"0"),i=n%60,o=String(Math.ceil(i)).padStart(2,"0");return`${e}:${s}:${o}`}static isTimeString(t){return new RegExp(ou.TIME_PATTERN).test(t)}static parseTime(t){if(t==null||typeof t!="string")throw new Error(`${t} is not a valid string`);const e=t.split(":");if(e.length!==3)throw new Error(`${t} is not a time string that can be parsed`);return Number(e[0])*60*60+Number(e[1])*60+Number(e[2])}};let Rn=ou;Rn.TIME_PATTERN="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]";Rn.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\xB10 No DST",value:"UTC"},{label:"London UTC\xB10",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\u22125",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"}]);class Ui extends Error{constructor(){super(...arguments),this.isInvalid=!0}}const Ln=({className:t="","data-testid":e})=>w("div",{className:W("loading-spinner fa-layers",t),"data-testid":e,children:[d(z,{icon:Gg,className:"text-white-50"}),d(z,{icon:jh,className:"text-primary",spin:!0})]}),bd=X.module("ContextMenu"),Ea=class extends S.exports.PureComponent{constructor(t){super(t),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=Y.createRef(),this.oldFocus=document.activeElement,this.activeSubMenuRef=Y.createRef(),this.subMenuTimer=0,this.rAF=0,this.initialPosition={top:t.top,left:t.left},this.state={menuItems:[],pendingItems:[],activeSubMenu:null,hasOverflow:!1,subMenuTop:null,subMenuLeft:null,subMenuParentWidth:0,subMenuParentHeight:0,keyboardIndex:-1,mouseIndex:-1}}static handleContextMenu(t){t.metaKey||(t.stopPropagation(),t.preventDefault())}componentDidMount(){this.initMenu(),this.verifyPosition(),window.addEventListener("resize",this.handleWindowResize),this.rAF=window.requestAnimationFrame(()=>{var e;(e=this.container.current)==null||e.focus();const{onMenuOpened:t}=this.props;t(this)})}componentDidUpdate(t,e){var i,o;const{actions:n}=this.props,{activeSubMenu:s}=this.state;s!==e.activeSubMenu&&(s==null?(i=this.container.current)==null||i.focus():this.setActiveSubMenuPosition()),t.actions!==n&&(this.initMenu(),(this.container.current==null||!this.container.current.contains(document.activeElement))&&((o=this.container.current)==null||o.focus())),this.verifyPosition()}componentWillUnmount(){this.cancelPromises(),window.removeEventListener("resize",this.handleWindowResize),cancelAnimationFrame(this.rAF)}getKeyboardIndex(){const{options:t}=this.props;if(t.separateKeyboardMouse!==void 0&&t.separateKeyboardMouse){const{keyboardIndex:e}=this.state;return e}return this.getMouseIndex()}setKeyboardIndex(t){const{options:e}=this.props;e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse?this.setState({keyboardIndex:t}):this.setMouseIndex(t)}getMouseIndex(){const{mouseIndex:t}=this.state;return t}setMouseIndex(t){this.setState({mouseIndex:t})}initMenu(){this.cancelPromises(),cancelAnimationFrame(this.rAF);const{options:t}=this.props;let e=t.initialKeyboardIndex;e===void 0&&(e=-1);const{actions:n}=this.props,s=xe.getMenuItems(n),i=[];for(let o=s.length-1;o>=0;o-=1){const r=s[o];r instanceof Promise?this.initMenuPromise(r):i.push(r)}this.setState({mouseIndex:-1,keyboardIndex:e,activeSubMenu:null,menuItems:xe.sortActions(i)})}initMenuPromise(t){const e=Re.makeCancelable(t);this.setState(n=>({pendingItems:n.pendingItems.concat(e)})),e.then(n=>{this.setState(s=>{const i=s.pendingItems.indexOf(e);if(i>=0){const o=s.pendingItems.slice();return o.splice(i,1),{menuItems:xe.sortActions(s.menuItems.concat(n)),pendingItems:o}}return null})},n=>{Re.isCanceled(n)||(this.setState(s=>{const i=s.pendingItems.indexOf(e);if(i>=0){const o=s.pendingItems.slice();return o.splice(i,1),{pendingItems:o}}return null}),bd.error(n))})}cancelPromises(){const{pendingItems:t}=this.state;t.map(e=>e.cancel())}setActiveSubMenuPosition(){if(this.activeSubMenuRef.current===null)return;const t=this.activeSubMenuRef.current.getBoundingClientRect();this.setState({subMenuTop:t.top,subMenuLeft:t.right,subMenuParentHeight:t.height,subMenuParentWidth:t.width})}verifyPosition(){var u,m,p,g;const{options:t,updatePosition:e,subMenuParentWidth:n,subMenuParentHeight:s,top:i,left:o}=this.props;if(!this.container.current||t.doNotVerifyPosition!=null&&t.doNotVerifyPosition)return;let{top:r,left:l}=this.initialPosition;const{width:a,height:c}=(m=(u=this.container.current)==null?void 0:u.getBoundingClientRect())!=null?m:{width:0,height:0},h=((g=(p=this.container.current)==null?void 0:p.scrollHeight)!=null?g:0)>window.innerHeight;c===0||a===0||(r+c>window.innerHeight&&(r-c-s>0?r-=c-s:r=window.innerHeight-c),l+a>window.innerWidth&&(l=l-a-n),(o!==l||i!==r)&&(this.setState({hasOverflow:h}),e(r,l)))}handleWindowResize(){!this.container.current||this.closeMenu(!0)}handleBlur(t){if(!this.container.current){bd.warn("Container is null!");return}if(!this.container.current.contains(t.relatedTarget)){let e=t.relatedTarget,n=!1;for(;e&&!n;)n=e.hasAttribute("data-dh-context-menu"),e=e.parentElement;n||this.closeMenu(!0)}}isEscapeKey(t){const{left:e}=this.props;return t==="Escape"||e<0&&t==="ArrowRight"||t==="ArrowLeft"}handleKeyDown(t){const{menuItems:e}=this.state,n=this.getKeyboardIndex();let s=n,i=!1;if(t.key==="Enter"||t.key===" "){n>=0&&n<e.length&&this.handleMenuItemClick(e[n],t);return}if(t.key==="ArrowRight"?n>=0&&n<=e.length?i=!0:s=0:this.isEscapeKey(t.key)?s=null:t.key==="ArrowUp"||t.shiftKey&&t.key==="Tab"?s=xe.getNextMenuItem(s,-1,e):(t.key==="ArrowDown"||t.key==="Tab")&&(s=xe.getNextMenuItem(s,1,e)),i){this.openSubMenu(n),t.preventDefault(),t.stopPropagation();return}n!==s&&(s!==null?this.setKeyboardIndex(s):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),t.preventDefault(),t.stopPropagation())}openSubMenu(t){const{menuItems:e,activeSubMenu:n}=this.state,s=e[t].actions?t:null;n!==s&&this.setState({activeSubMenu:s,subMenuTop:null,subMenuLeft:null})}closeMenu(t=!1){const{closeMenu:e,onMenuClosed:n}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{e(t),n(this)})}closeSubMenu(){this.setState({activeSubMenu:null})}handleCloseSubMenu(t){t?this.closeMenu(!0):this.closeSubMenu()}handleMenuItemClick(t,e){e.preventDefault(),e.stopPropagation();const{menuItems:n}=this.state;t!=null&&(t.disabled===void 0||!t.disabled)&&(t.actions!=null?this.openSubMenu(n.indexOf(t)):t.action!=null&&(t.action(),this.closeMenu(!0)))}handleMenuItemContextMenu(t,e){e.metaKey||this.handleMenuItemClick(t,e)}handleMenuItemMouseMove(t){const{menuItems:e}=this.state,n=e.indexOf(t);this.setMouseIndex(n),n>=0&&n<e.length&&(t.disabled===void 0||!t.disabled)&&this.openSubMenu(n)}handleMouseLeave(){this.setMouseIndex(-1)}render(){const t=[],{top:e,left:n}=this.props,{activeSubMenu:s,hasOverflow:i,keyboardIndex:o,menuItems:r,mouseIndex:l,pendingItems:a,subMenuTop:c,subMenuLeft:h,subMenuParentWidth:u,subMenuParentHeight:m}=this.state;for(let C=0;C<r.length;C+=1){const v=r[C];C>0&&v.group!==r[C-1].group&&t.push(d("hr",{},`${C}.separator`));const T=d(al,{ref:s===C?this.activeSubMenuRef:null,isKeyboardSelected:o===C,isMouseSelected:l===C,menuItem:v,closeMenu:this.handleCloseSubMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:this.handleMenuItemContextMenu},C);t.push(T)}let p=null;a.length>0&&(p=d("div",{className:"loading",children:d(Ln,{})}));const{menuStyle:g,"data-testid":f}=this.props,b=s!==null&&c!==null&&h!==null;return w(ue,{children:[w("div",{className:W({"has-overflow":i},"context-menu-container"),style:{top:e,left:n,...g},ref:this.container,"data-dh-context-menu":!0,onBlur:this.handleBlur,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,onContextMenu:Ea.handleContextMenu,role:"menuitem",tabIndex:0,"data-testid":f,children:[t,p]}),b&&s!==null&&c!==null&&h!==null&&d(Ea,{actions:r[s].actions||[],closeMenu:this.handleCloseSubMenu,top:c,left:h,updatePosition:(C,v)=>{this.setState({subMenuTop:C,subMenuLeft:v})},subMenuParentWidth:u,subMenuParentHeight:m},`sub-${s}`)]})}};let ru=Ea;ru.defaultProps={subMenuParentWidth:0,subMenuParentHeight:0,closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0};class lu extends S.exports.Component{constructor(e){super(e),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.container=Y.createRef(),this.openMenu=Y.createRef(),this.state={actions:null,left:0,top:0}}componentDidMount(){var e;(e=this.container.current)!=null&&e.parentElement&&this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu)}componentWillUnmount(){var e;(e=this.container.current)!=null&&e.parentElement&&this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu)}handleContextMenu(e){if(!xe.isContextActionEvent(e)||!this.container.current||e.metaKey||e.ctrlKey)return;const n=xe.getMenuItems(e.contextActions),s=this.container.current.getBoundingClientRect(),i=e.clientY-s.top,o=e.clientX-s.left;if(n.length===0){if(e.target===this.container.current){e.preventDefault(),this.setState({actions:null},()=>{const r=document.elementFromPoint(o,i),l=new MouseEvent("contextmenu",{clientX:e.clientX,clientY:e.clientY,bubbles:!0,cancelable:!0});r==null||r.dispatchEvent(l)});return}return}e.preventDefault(),this.setState({actions:n,top:i,left:o})}handleMenuClose(e){e===this.openMenu.current&&this.setState({actions:null})}render(){let e=null;const{"data-testid":n}=this.props,{actions:s,top:i,left:o}=this.state;return s&&(e=d(ru,{ref:this.openMenu,actions:s,onMenuClosed:this.handleMenuClose,top:i,left:o,updatePosition:(r,l)=>{this.setState({top:r,left:l})},"data-testid":n})),d("div",{className:W("context-menu-root",{active:s}),ref:this.container,children:e})}}const js=class extends S.exports.Component{static handleEnter(t){const e=t;e.style.height="0"}static handleEntering(t){const e=t;e.style.height=`${js.getHeight(e)}px`}static handleExiting(t){const e=t;e.style.height="0"}static handleExit(t){const e=t;e.style.height=`${js.getHeight(e)}px`}static getHeight(t){const e=t.scrollWidth-t.clientWidth;return t.scrollHeight-e}constructor(t){super(t),this.handleEntered=this.handleEntered.bind(this)}handleEntered(t){const e=t;e.style.height="";const{autoFocusOnShow:n}=this.props;if(n!==void 0&&n){const s=e.querySelector("input, select, textarea");s!=null&&s.focus()}}render(){const{children:t,className:e,in:n,"data-testid":s}=this.props;return d(gt,{in:n,classNames:{enterActive:"collapsing",enterDone:"collapse show",exitActive:"collapsing",exitDone:"collapse"},onEnter:js.handleEnter,onEntering:js.handleEntering,onEntered:this.handleEntered,onExit:js.handleExit,onExiting:js.handleExiting,timeout:350,children:i=>d("div",{className:W({collapse:i==="exited"},e),"data-testid":s,children:t})})}};let ic=js;ic.propTypes={className:R.exports.string,in:R.exports.bool.isRequired,children:R.exports.node.isRequired,autoFocusOnShow:R.exports.bool,"data-testid":R.exports.string};ic.defaultProps={className:"",autoFocusOnShow:!1,"data-testid":void 0};function dl(t){const e=S.exports.useRef();return S.exports.useEffect(function(){e.current=t}),e.current}function au(t){const e=S.exports.useRef(null);return S.exports.useEffect(function(){!t||(typeof t=="function"?t(e.current):t.current=e.current)}),e}const Ut=Y.forwardRef((t,e)=>{const{checked:n=!1,children:s,className:i,disabled:o,inputClassName:r,isInvalid:l,labelClassName:a,name:c,onChange:h,"data-testid":u}=t,[m]=S.exports.useState(qe()),p=au(e);S.exports.useEffect(function(){p.current&&(p.current.indeterminate=n===null)},[p,n]);const g=S.exports.useCallback(f=>{p.current&&(p.current.indeterminate=n===null),h&&h(f)},[p,n,h]);return w("div",{className:W("custom-control custom-checkbox",i),children:[d("input",{type:"checkbox",ref:p,checked:n!=null?n:!1,className:W("custom-control-input",r,{"is-invalid":l}),disabled:o,id:m,name:c,onChange:g,"data-testid":u}),d("label",{className:W("custom-control-label",a),htmlFor:m,children:s})]})});Ut.displayName="Checkbox";Ut.propTypes={checked:(t,e)=>{const{[e]:n}=t;return n!==null&&typeof n!="boolean"?new Error("Checked must be a boolean or null for indeterminate"):null},children:R.exports.node.isRequired,className:R.exports.string,disabled:R.exports.bool,inputClassName:R.exports.string,isInvalid:R.exports.bool,labelClassName:R.exports.string,name:R.exports.string,onChange:R.exports.func,"data-testid":R.exports.string};Ut.defaultProps={checked:!1,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};class fs extends S.exports.PureComponent{constructor(e){super(e),this.inputField=Y.createRef()}focus(){var e;(e=this.inputField.current)==null||e.focus()}render(){const{value:e,placeholder:n,onBlur:s,onChange:i,className:o,disabled:r,matchCount:l,id:a,onKeyDown:c,"data-testid":h}=this.props;return w("div",{className:W("search-group",o),children:[d("input",{type:"search",value:e,onBlur:s,onChange:i,onKeyDown:c,className:"form-control",disabled:r,placeholder:n,ref:this.inputField,id:a,"data-testid":h}),l!=null&&d("span",{className:"search-match",children:l}),d("span",{className:"search-icon",children:d(z,{icon:Jh})})]})}}fs.defaultProps={placeholder:"Search",className:"",matchCount:null,onKeyDown(){},id:"","data-testid":void 0};var cu=(t=>(t.UP="UP",t.DOWN="DOWN",t))(cu||{});const yo=class extends S.exports.Component{constructor(t){super(t),this.getCachedFilteredOptions=Ie((e,n)=>e.filter(s=>s.title.toLowerCase().indexOf(n.toLowerCase())>=0||s.value.toLowerCase().indexOf(n.toLowerCase())>=0)),this.state={value:"",filter:"",filteredOptions:t.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=Y.createRef(),this.cbContainer=Y.createRef(),this.toggleButton=Y.createRef(),this.menuContainer=Y.createRef(),this.input=Y.createRef(),this.searchInput=Y.createRef()}componentDidUpdate(){const{menuIsOpen:t,keyboardOptionIndex:e}=this.state;t&&e>=0&&this.scrollOptionIntoView()}setInputWidth(){this.cbContainer.current&&this.setState({inputWidth:this.cbContainer.current.getBoundingClientRect().width})}focus(){var t;(t=this.input.current)==null||t.focus()}resetValue(){this.setState({value:""})}updateInputValue(t){const{onChange:e}=this.props;this.setState({value:t}),e(t)}handleResize(){this.setInputWidth()}handleMenuKeyDown(t){var r,l;const{filter:e,filteredOptions:n,keyboardOptionIndex:s}=this.state,{options:i}=this.props,o=e?n:i;switch(t.key){case"Enter":((r=o[s])==null?void 0:r.value)!=null&&this.updateInputValue(o[s].value),this.closeMenu(),(l=this.input.current)==null||l.focus(),t.stopPropagation(),t.preventDefault();break;case"ArrowUp":this.handleMenuNavigation(yo.MENU_NAVIGATION_DIRECTION.UP),t.stopPropagation(),t.preventDefault();break;case"ArrowDown":this.handleMenuNavigation(yo.MENU_NAVIGATION_DIRECTION.DOWN),t.stopPropagation(),t.preventDefault();break;case"Escape":e!==""?(this.setState({filter:""}),t.stopPropagation()):this.closeMenu();break;case"Tab":!t.shiftKey&&s===o.length-1&&this.closeMenu();break}}handleMenuNavigation(t){const{filter:e,filteredOptions:n,keyboardOptionIndex:s}=this.state,{options:i}=this.props,r=(e?n:i).length;let l=0;switch(t){case yo.MENU_NAVIGATION_DIRECTION.UP:l=-1;break;case yo.MENU_NAVIGATION_DIRECTION.DOWN:l=1;break}l!==0&&this.setState({keyboardOptionIndex:(s+l+r)%r})}handleInputKeyDown(t){const{onEnter:e}=this.props,{menuIsOpen:n}=this.state;t.key==="ArrowDown"||t.key==="ArrowUp"?n||this.openMenu():t.key==="Enter"&&e()}handleInputChange(t){this.updateInputValue(t.target.value)}handleOptionClick(t){var r;const e=Number(t.currentTarget.value),{filter:n,filteredOptions:s}=this.state,{options:i}=this.props,o=n?s:i;this.updateInputValue(o[e].value),this.closeMenu(),(r=this.input.current)==null||r.focus()}handleOptionFocus(t){this.setState({keyboardOptionIndex:Number(t.target.value)})}handleFilterChange(t){var i;const{options:e}=this.props,n=t.target.value,s=this.getCachedFilteredOptions(e,n);this.setState({filter:n,filteredOptions:s,keyboardOptionIndex:0}),(i=this.popper.current)==null||i.scheduleUpdate()}handleMenuBlur(t){t.relatedTarget instanceof Element&&this.popper.current!=null&&this.popper.current.element.contains(t.relatedTarget)||t.relatedTarget===this.toggleButton.current||this.closeMenu(!1)}handleInputBlur(t){const{menuIsOpen:e}=this.state;e&&t.relatedTarget instanceof Element&&this.popper.current!=null&&this.popper.current.element.contains(t.relatedTarget)||this.closeMenu(!1)}handleMenuOpened(){var t;this.scrollOptionIntoView(),(t=this.searchInput.current)==null||t.focus()}handleMenuExited(){var e;const{menuIsOpen:t}=this.state;t&&(this.setState({menuIsOpen:!1}),(e=this.popper.current)==null||e.hide()),this.setState({filter:""})}toggleMenu(t){const{menuIsOpen:e}=this.state;e?this.closeMenu():this.openMenu(),t.stopPropagation()}openMenu(){this.updateKeyboardIndex(),this.setInputWidth(),this.setState({menuIsOpen:!0}),window.requestAnimationFrame(()=>{var t;(t=this.popper.current)==null||t.show()})}closeMenu(t=!0){var e,n;this.setState({menuIsOpen:!1}),t&&((e=this.input.current)==null||e.focus()),(n=this.popper.current)==null||n.hide()}updateKeyboardIndex(){const{value:t,filter:e,filteredOptions:n}=this.state,{options:s}=this.props,o=(e?n:s).findIndex(r=>r.value===t);this.setState({keyboardOptionIndex:o})}scrollOptionIntoView(){var e;const t=(e=this.menuContainer.current)==null?void 0:e.querySelector(".cb-option-btn.keyboard-active");t instanceof HTMLElement&&t.scrollIntoView({block:"nearest",inline:"nearest"})}renderMenuElement(){const{searchPlaceholder:t}=this.props,{filter:e,inputWidth:n}=this.state;return w("div",{className:"cb-menu-container",ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,onClick:s=>{s.stopPropagation()},style:{width:n},onBlur:this.handleMenuBlur,children:[d("div",{className:"cb-search-input-container",children:d(fs,{value:e,ref:this.searchInput,onChange:this.handleFilterChange,className:"cb-search-input",placeholder:t})}),d("div",{className:"cb-options-container",children:d("div",{className:"cb-options",children:this.renderOptions()})})]})}renderOptions(){const{options:t}=this.props,{keyboardOptionIndex:e,filter:n,filteredOptions:s}=this.state;return(n?s:t).map((o,r)=>{const l=`option-${r}-${o.value}`;return d("button",{type:"button",value:r,className:W("cb-option-btn",{"keyboard-active":e===r}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:o.title},l)})}render(){const{options:t,inputPlaceholder:e,disabled:n,className:s,defaultValue:i,spellCheck:o,"data-testid":r}=this.props,{value:l}=this.state;let{popperOptions:a}=this.props;return a={placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}},...a},w("div",{className:"input-group cb-container",ref:this.cbContainer,children:[d("input",{value:l||i,className:W("form-control",s,"cb-input"),ref:this.input,onChange:this.handleInputChange,placeholder:e||(t[0]!=null?t[0].title:void 0),disabled:n,onBlur:this.handleInputBlur,onKeyDown:this.handleInputKeyDown,spellCheck:o,"data-testid":r!==void 0?`${r}-input`:void 0}),d("div",{className:"input-group-append cb-dropdown",children:w("button",{type:"button",className:"btn cb-btn form-control",ref:this.toggleButton,onClick:this.toggleMenu,onKeyDown:this.handleInputKeyDown,disabled:n,"data-testid":r!==void 0?`${r}-btn`:void 0,children:[d(z,{icon:cs}),d(xn,{ref:this.popper,options:a,className:W("combobox interactive"),onEntered:this.handleMenuOpened,onExited:this.handleMenuExited,children:this.renderMenuElement()})]})})]})}};let Zi=yo;Zi.MENU_NAVIGATION_DIRECTION=cu;Zi.DROP_DOWN_MENU_HEIGHT=200;Zi.propTypes={options:R.exports.arrayOf(R.exports.shape({title:R.exports.string.isRequired,value:R.exports.string.isRequired})).isRequired,popperOptions:R.exports.shape({title:R.exports.string.isRequired,value:R.exports.string.isRequired}),onChange:R.exports.func,inputPlaceholder:R.exports.string,searchPlaceholder:R.exports.string,disabled:R.exports.bool,className:R.exports.string,defaultValue:R.exports.string,spellCheck:R.exports.bool,onEnter:R.exports.func,"data-testid":R.exports.string};Zi.defaultProps={onChange(){},inputPlaceholder:"",searchPlaceholder:"Search",disabled:!1,className:"",defaultValue:"",popperOptions:null,spellCheck:!0,onEnter(){},"data-testid":void 0};const yn=X.module("MaskedInput"),Ii={FORWARD:"forward",BACKWARD:"backward",NONE:"none"},mr="\u2007";function oc(t,e,n){return t.substring(0,e)+n+t.substring(e+1)}function Kf(t,e,n){return t.length<n?`${t}${e.substring(t.length,n)}`:t}function Sd(t,e){let{length:n}=t;for(let s=t.length-1;s>=0&&e[s]===t[s];s-=1)n=s;return t.substring(0,n)}const hl=Y.forwardRef((t,e)=>{const{className:n,example:s,getNextSegmentValue:i=(k,H,O)=>O,getPreferredReplacementString:o=oc,onChange:r=()=>!1,onSelect:l=()=>!1,pattern:a,placeholder:c,selection:h,value:u,onFocus:m=()=>!1,onBlur:p=()=>!1,"data-testid":g}=t,f=au(e),b=S.exports.useMemo(()=>Array.isArray(s)?s:[s],[s]),C=S.exports.useMemo(()=>b[0].replace(/[a-zA-Z0-9]/g,mr),[b]);S.exports.useEffect(function(){var H;if(h!=null){yn.debug("setting selection...",h);const{selectionStart:O,selectionEnd:F,selectionDirection:_}=h;(H=f.current)==null||H.setSelectionRange(O,F,_),yn.debug("selection set!")}},[h,f]);const v=S.exports.useCallback(k=>{let H=k,O=k;const F=b.length>0?b[0]:u;for(let L=H-1;L>=0&&/[a-zA-Z0-9]/g.test(F.charAt(L));L-=1)H=L;for(let L=O;L<F.length&&/[a-zA-Z0-9]/g.test(F.charAt(L));L+=1)O=L+1;const _=H===O?Ii.NONE:Ii.BACKWARD;return{selectionStart:H,selectionEnd:O,selectionDirection:_}},[b,u]);function T(k,H,O=k.length){let F="";for(let _=0;_<O;_+=1)k.charAt(_)!==mr?F=F.concat(k[_]):F=F.concat(H[_]);return F=F.concat(H.substring(O)),F}function E(k,H=k.length){const O=new RegExp(`^${a}$`);if(O.test(k))return!0;for(let F=0;F<b.length;F+=1){const _=T(k,b[F],H);if(O.test(_))return!0}return!1}function y(k){const H=v(k),O=H.selectionEnd+1;return O>=u.length?H:v(O)}function I(k){const H=v(k),O=H.selectionStart-1;return O<=0?H:v(O)}function D(k,H){const O=v(k),F=u.substring(O.selectionStart,O.selectionEnd),_=i(O,H,F,u),L=u.substring(0,O.selectionStart)+_+u.substring(O.selectionEnd);E(L,O.selectionEnd)&&(r(L),l(O))}const M=S.exports.useCallback(k=>{const{selectionStart:H=0,selectionEnd:O=0,selectionDirection:F="none"}=k.target;if(H===null||O===null||F===null){yn.error("Selection attempted on non-text input element",k.target);return}if(yn.debug2("handleSelect",H,O,F),!(h!=null&&H===h.selectionStart&&O===h.selectionEnd)){if(h!=null&&H===u.length&&O===u.length&&k.nativeEvent.type!=="mouseup"){l({...h});return}if(H===O){const _=v(H);yn.debug("Selection segment from ",H,O,"=>",_),l(_)}else l({selectionStart:H,selectionEnd:O,selectionDirection:F})}},[v,l,h,u]),x=S.exports.useCallback(k=>{var O;if(!f.current)return;yn.debug("handleSelectCapture",k);const H=(O=f.current.selectionStart)!=null?O:0;H===u.length&&h!=null&&H!==h.selectionStart&&(k.preventDefault(),k.stopPropagation())},[f,h,u]);function B(k){if(k.preventDefault(),k.stopPropagation(),!f.current)return;const{key:H}=k,{selectionStart:O=0,selectionEnd:F=0}=f.current;if(O===null||F===null){yn.error("Selection arrow nvaigation attempted on non-text input element",k.target);return}H==="ArrowLeft"?l(I(O)):H==="ArrowRight"?l(y(F)):H==="ArrowUp"?D(O,-1):H==="ArrowDown"&&D(O,1)}function $(k){if(!f.current)return;yn.debug("handleKeyDown",k);const{key:H}=k,{selectionStart:O=0,selectionEnd:F=0}=f.current;if(O===null||F===null){yn.error("Selection key event on non-text input element",k.target);return}if(H.startsWith("Arrow")){B(k);return}if(H==="Delete"||H==="Backspace"){if(k.preventDefault(),k.stopPropagation(),F>=Sd(u,C).length){const L=u.substring(0,O===F?O-1:O),V=Sd(L,C);V!==u&&(r(V),l({selectionStart:V.length,selectionEnd:V.length,selectionDirection:Ii.NONE}));return}if(O!==F){const L=u.substring(0,O)+u.substring(O,F).replace(/[a-zA-Z0-9]/g,mr)+u.substring(F);yn.debug("Range ",O,F,"deleted, setting value",L),r(L),l({selectionStart:O,selectionEnd:O,selectionDirection:Ii.NONE})}else if(O>0)for(let L=O-1;L>=0;L-=1){const V=u.substring(0,L)+u.substring(L,O).replace(/[a-zA-Z0-9]/g,mr)+u.substring(O);if(V!==u){r(V),l({selectionStart:L,selectionEnd:L,selectionDirection:Ii.NONE});return}}return}if(k.altKey||k.metaKey||k.ctrlKey||H.length>1)return;k.preventDefault(),k.stopPropagation();const _=Array.from(new Set([H,H.toUpperCase(),H.toLowerCase()]));for(let L=0;L<_.length;L+=1){const V=_[L],G=/[a-zA-Z0-9]/g.test(V)?b[0].length-1:O;for(let j=O;j<=G;j+=1){const ne=Kf(u,b[0],j+1),ye=o(ne,j,V,O,F);if(E(ye,j+1)){const le=v(j),Te=j+1;let He={selectionStart:Te,selectionEnd:Te,selectionDirection:Ii.NONE};if(Te>=le.selectionEnd){const Z=y(j);Z.selectionStart!==le.selectionStart&&(He=Z)}yn.debug("handleKeyDown",H,"=>",ye,He),r(ye),l(He);return}}}}return d("input",{ref:f,className:W("form-control masked-input",n),type:"text",pattern:a,placeholder:c,value:u,onChange:()=>{},onKeyDown:$,onSelect:M,onSelectCapture:x,onFocus:m,onBlur:p,"data-testid":g})});hl.defaultProps={className:"",placeholder:void 0,onChange(){},onSelect(){},getNextSegmentValue:(t,e,n)=>n,getPreferredReplacementString:oc,selection:void 0,onFocus(){},onBlur(){},"data-testid":void 0};const qf=X.module("TimeInput"),Yf="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]",Xf=["00:00:00","12:34:56","23:59:59"],du=Y.forwardRef((t,e)=>{const{allowValueWrapping:n=!0,className:s="",onChange:i=()=>!1,value:o=0,onFocus:r=()=>!1,onBlur:l=()=>!1,onSelect:a=()=>!1,"data-testid":c}=t,[h,u]=S.exports.useState(Rn.formatTime(o)),[m,p]=S.exports.useState(),g=S.exports.useRef(null);S.exports.useImperativeHandle(e,()=>({focus:()=>{var T;(T=g.current)==null||T.focus()},setSelection:T=>{var E;(E=g.current)==null||E.focus(),p(T)}}),[]),S.exports.useEffect(function(){u(Rn.formatTime(o))},[o]);function f(T,E,y){const I=T.selectionStart===0?24:60;let D=parseInt(y,10)-E;return Number.isNaN(D)?D=0:n?D=(D%I+I)%I:D=Math.min(Math.max(0,D),I-1),`${D}`.padStart(2,"0")}function b(T,E,y,I,D){return I===0&&D===2&&E===1&&parseInt(y,10)>1?`0${y}${T.substring(2)}`:oc(T,E,y)}function C(T){qf.debug("handleChange",T),u(T),Rn.isTimeString(T)&&i(Rn.parseTime(T))}const v=S.exports.useCallback(T=>{p(T),a(T)},[a]);return d(hl,{ref:g,className:s,example:Xf,getNextSegmentValue:f,getPreferredReplacementString:b,onChange:C,onSelect:v,pattern:Yf,selection:m,value:h,onFocus:r,onBlur:l,"data-testid":c})});du.defaultProps={allowValueWrapping:!0,className:"",onChange:()=>!1,onSelect:()=>!1,value:0,onFocus:()=>!1,onBlur:()=>!1,"data-testid":void 0};class hu extends S.exports.PureComponent{constructor(e){var i;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=Y.createRef(),this.oldFocus=document.activeElement,this.rAF=0;const{options:n}=e,s=(i=n.initialKeyboardIndex)!=null?i:-1;this.state={menuItems:[],keyboardIndex:s,mouseIndex:-1}}componentDidMount(){this.initMenu(),this.rAF=window.requestAnimationFrame(()=>{var n;(n=this.container.current)==null||n.focus();const{onMenuOpened:e}=this.props;e(this)})}componentDidUpdate(e){const{actions:n}=this.props;e.actions!==n&&this.initMenu()}componentWillUnmount(){cancelAnimationFrame(this.rAF)}getKeyboardIndex(){const{options:e}=this.props;if(e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse){const{keyboardIndex:n}=this.state;return n}return this.getMouseIndex()}setKeyboardIndex(e){const{options:n}=this.props;n.separateKeyboardMouse!==void 0&&n.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,n=xe.getMenuItems(e,!1);n.length>0&&this.setState(s=>({menuItems:xe.sortActions(s.menuItems.concat(n))}))}handleKeyDown(e){const{menuItems:n}=this.state,s=this.getKeyboardIndex();let i=s;if(e.key==="Enter"||e.key===" "){s!=null&&s>=0&&s<n.length&&this.handleMenuItemClick(n[s],e);return}e.key==="Escape"?i=null:e.key==="ArrowUp"||e.key==="Tab"&&e.shiftKey===!0?i=xe.getNextMenuItem(i!=null?i:0,-1,n):(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1)&&(i=xe.getNextMenuItem(i!=null?i:0,1,n)),s!==i&&(i!==null?this.setKeyboardIndex(i):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}closeMenu(e=!1){const{closeMenu:n,onMenuClosed:s}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{n(e),s(this)})}handleCloseMenu(){this.closeMenu()}handleMenuItemClick(e,n){n.preventDefault(),n.stopPropagation(),e!=null&&(e.disabled===void 0||!e.disabled)&&e.action!=null&&(e.action(),this.closeMenu(!0))}handleMenuItemMouseMove(e){const{menuItems:n}=this.state,s=n.indexOf(e);this.setMouseIndex(s)}handleMouseLeave(){this.setMouseIndex(-1)}render(){const e=[],{"data-testid":n}=this.props,{keyboardIndex:s,menuItems:i,mouseIndex:o}=this.state;for(let l=0;l<i.length;l+=1){const a=i[l];l>0&&a.group!==i[l-1].group&&e.push(d("hr",{},`${l}.separator`));const c=d(al,{isKeyboardSelected:s===l,isMouseSelected:o===l,menuItem:a,closeMenu:this.handleCloseMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:()=>!1},l);e.push(c)}const{menuStyle:r}=this.props;return d("div",{className:"context-menu-container",style:{...r},ref:this.container,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,role:"menuitem",tabIndex:0,"data-testid":n,children:e})}}hu.defaultProps={closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0};class zn extends S.exports.PureComponent{constructor(e){super(e),this.handleClick=this.handleClick.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.handleExited=this.handleExited.bind(this),this.container=Y.createRef(),this.parent=null,this.popper=Y.createRef(),this.isOpen=!1}componentDidMount(){var n;const{isShown:e}=this.props;e===null?(n=this.container.current)!=null&&n.parentElement&&(this.parent=this.container.current.parentElement,this.parent.addEventListener("click",this.handleClick)):e&&this.openMenu()}componentDidUpdate(e){const{isShown:n}=this.props;e.isShown!==n&&(n!==null&&n?window.requestAnimationFrame(()=>{this.openMenu()}):this.closeMenu())}componentWillUnmount(){this.parent&&this.parent.removeEventListener("click",this.handleClick)}closeMenu(){var e;(e=this.popper.current)==null||e.hide()}openMenu(){this.popper.current&&!this.isOpen&&(this.popper.current.show(),this.isOpen=!0)}scheduleUpdate(){var e;(e=this.popper.current)==null||e.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:n,popperClassName:s,"data-testid":i}=this.props,{menuStyle:o}=this.props;let{options:r,popperOptions:l}=this.props;return l={placement:"bottom",...l},r={separateKeyboardMouse:!0,...r},d("div",{className:"menu-actions-listener",ref:this.container,"data-testid":i,children:d(xn,{ref:this.popper,options:l,className:W("menu-popper",s),onExited:this.handleExited,closeOnBlur:!0,interactive:!0,children:d(hu,{actions:e,closeMenu:this.handleCloseMenu,onMenuOpened:n,options:r,menuStyle:o})})})}}zn.defaultProps={isShown:null,onMenuClosed(){},onMenuOpened(){},options:{},popperOptions:{},popperClassName:"",menuStyle:{},"data-testid":void 0};const wd=-1;var uu=(t=>(t.UP="UP",t.DOWN="DOWN",t))(uu||{});const ss=class extends S.exports.Component{constructor(t){super(t);const{value:e,valueToTime:n}=t;this.toggleMenu=this.toggleMenu.bind(this),this.handleMenuKeyDown=this.handleMenuKeyDown.bind(this),this.closeMenu=this.closeMenu.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.handleCustomInput=this.handleCustomInput.bind(this),this.csContainer=Y.createRef(),this.menuContainer=Y.createRef(),this.button=Y.createRef(),this.input=Y.createRef(),this.state={keyboardOptionIndex:0,menuIsOpen:!1,inputWidth:100,customTime:n(e),inputFocused:!1}}getSelectedText(){const{options:t,value:e,placeholder:n}=this.props,{customTime:s}=this.state;if(e===null)return n;for(let i=0;i<t.length;i+=1){const o=t[i];if(o.value===e)return o.title}return Rn.formatTime(s)}setInputWidth(){this.csContainer.current&&this.setState({inputWidth:this.csContainer.current.getBoundingClientRect().width})}focus(){var t;(t=this.button.current)==null||t.focus()}updateInputValue(t){const{onChange:e}=this.props;e(t)}handleResize(){this.setInputWidth()}handleMenuKeyDown(t){var i;const{keyboardOptionIndex:e,inputFocused:n}=this.state,{options:s}=this.props;switch(t.key){case"Enter":case" ":n?this.updateFromCustom():this.updateInputValue(s[e].value),this.closeMenu(),(i=this.button.current)==null||i.focus(),t.stopPropagation(),t.preventDefault();break;case"Tab":t.shiftKey?this.handleMenuNavigation(ss.MENU_NAVIGATION_DIRECTION.UP):this.handleMenuNavigation(ss.MENU_NAVIGATION_DIRECTION.DOWN),t.stopPropagation(),t.preventDefault();break;case"ArrowUp":this.handleMenuNavigation(ss.MENU_NAVIGATION_DIRECTION.UP),t.stopPropagation(),t.preventDefault();break;case"ArrowDown":this.handleMenuNavigation(ss.MENU_NAVIGATION_DIRECTION.DOWN),t.stopPropagation(),t.preventDefault();break;case"Escape":this.closeMenu();break}}handleMenuNavigation(t){const{keyboardOptionIndex:e,inputFocused:n}=this.state,{options:s}=this.props,i=s.length;let o=e;switch(t){case ss.MENU_NAVIGATION_DIRECTION.UP:if(!n&&e===0){this.focusInput();break}else n&&this.focusOption(e);e>0&&!n?(o=(o-1)%i,this.setState({keyboardOptionIndex:o})):e===0&&(o=i-1,this.setState({keyboardOptionIndex:o})),this.scrollOptionIntoView(o);break;case ss.MENU_NAVIGATION_DIRECTION.DOWN:if(!n&&e===i-1){this.focusInput();break}else n&&this.focusOption(e);e<i&&!(n&&e===0)&&(o=(o+1)%i,this.setState({keyboardOptionIndex:o})),this.scrollOptionIntoView(o);break}}handleOptionClick(t){const e=Number(t.currentTarget.value),{options:n,timeToValue:s}=this.props,{customTime:i}=this.state;if(e===wd){const o=s(i);this.updateAndClose(o)}else this.updateAndClose(n[e].value)}updateAndClose(t){var e;this.updateInputValue(t),this.closeMenu(),(e=this.button.current)==null||e.focus()}handleOptionFocus(t){this.setState({keyboardOptionIndex:Number(t.target.value)})}handleMenuOpened(){var o;const{options:t,value:e}=this.props,{keyboardOptionIndex:n}=this.state;this.scrollOptionIntoView(n);const s=(o=this.menuContainer.current)==null?void 0:o.querySelector(".cs-option-btn.keyboard-active");if(s instanceof HTMLElement&&s.focus(),e===null)return;t.map(r=>r.value).indexOf(e)<0&&this.focusInput()}focusInput(){var t;(t=this.input.current)==null||t.focus()}focusOption(t){var n;const e=(n=this.menuContainer.current)==null?void 0:n.querySelector(".cs-options");if(e&&e.children!=null){const s=e.children.item(t);s instanceof HTMLElement&&s.focus()}}handleMenuExited(){const{menuIsOpen:t}=this.state;t&&this.setState({menuIsOpen:!1,keyboardOptionIndex:0})}handleCustomInput(t){const{timeToValue:e}=this.props,n=e(t);this.updateInputValue(n),this.setState({customTime:t})}updateFromCustom(){const{timeToValue:t}=this.props,{customTime:e}=this.state,n=t(e);this.updateInputValue(n)}toggleMenu(t){const{menuIsOpen:e}=this.state;e?this.closeMenu():this.openMenu(),t.stopPropagation()}openMenu(){this.updateKeyboardIndex(),this.setInputWidth(),this.setState({menuIsOpen:!0})}closeMenu(t=!0){var e;this.setState({menuIsOpen:!1}),t&&((e=this.button.current)==null||e.focus())}updateKeyboardIndex(){const{options:t,value:e}=this.props;if(e===null)return;const n=t.map(s=>s.value).indexOf(e);n>0&&this.setState({keyboardOptionIndex:n})}scrollOptionIntoView(t){var n;const e=(n=this.menuContainer.current)==null?void 0:n.querySelector(".cs-options");if(e&&e.children!=null){const s=e.children.item(t);s instanceof HTMLElement&&s.offsetTop>ss.DROP_DOWN_MENU_HEIGHT?e.scrollTop=s.offsetTop-ss.DROP_DOWN_MENU_HEIGHT:(s instanceof HTMLElement&&s.offsetTop<0||t===0)&&(e.scrollTop=0)}}renderMenuElement(){const{inputWidth:t}=this.state;return d("div",{className:"cs-menu-container",ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,onClick:e=>{e.stopPropagation()},style:{width:t},children:d("div",{className:"cs-options-container",children:d("div",{className:"cs-options",children:this.renderOptions()})})})}renderOptions(){const{options:t,value:e,icon:n,customText:s}=this.props,{keyboardOptionIndex:i,customTime:o,inputFocused:r}=this.state;let l=!1;const a=[];for(let c=0;c<t.length;c+=1){const h=t[c],u=`option-${c}-${h.value}`;l=l||h.value===e,a.push(w("button",{type:"button",value:c,className:W("cs-option-btn",{"keyboard-active":i===c&&!r}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[h.value===e&&d(z,{icon:n,className:"mr-2"}),h.value!==e&&d("span",{className:"mr-4"}),h.title]},u))}return a.push(d("hr",{className:"cs-divider"},"option-divider")),a.push(w("button",{type:"button",value:wd,className:W("cs-option-btn",{"keyboard-active":r}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[!l&&e!==null?d(z,{icon:n,className:"mr-2"}):d("span",{className:"mr-4"}),s]},"option-custom-label")),a.push(w("div",{className:"cs-custom-container",children:[d("span",{className:"mr-2"}),d(du,{ref:this.input,onChange:this.handleCustomInput,value:o,onFocus:()=>this.setState({inputFocused:!0}),onBlur:()=>this.setState({inputFocused:!1})},"option-input"),d("span",{className:"ml-2"})]},"cs-custom-container")),a.push(d("hr",{className:"mb-2"},"option-end")),a}render(){const{disabled:t,invalid:e,value:n,"data-testid":s}=this.props,{menuIsOpen:i}=this.state;let{popperOptions:o}=this.props;return o={placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}},...o},d("div",{className:"input-group cs-container context-menu",ref:this.csContainer,"data-testid":s,children:d("div",{className:W("input-group-append cs-dropdown",{"cs-dropdown-invalid":e}),children:w("button",{type:"button",className:W("btn cs-btn form-control",{"cs-btn-invalid":e}),ref:this.button,onClick:this.toggleMenu,disabled:t,children:[d("span",{className:W({"text-muted":n===null}),children:this.getSelectedText()}),d("span",{children:d(z,{icon:nc,className:"cs-caret"})}),d(zn,{isShown:i,actions:{menuElement:this.renderMenuElement()},popperOptions:o,popperClassName:"CustomTimeSelect",onMenuOpened:this.handleMenuOpened,onMenuClosed:this.handleMenuExited,menuStyle:{maxWidth:"100rem"}})]})})})}};let rc=ss;rc.MENU_NAVIGATION_DIRECTION=uu;rc.DROP_DOWN_MENU_HEIGHT=125;rc.defaultProps={onChange(){},value:null,disabled:!1,popperOptions:{},icon:ai,customText:"Custom",placeholder:"Select a time",valueToTime:t=>t===null?0:Math.round(t/1e3),timeToValue:t=>t*1e3,invalid:!1,"data-testid":void 0};function Ri(t,e,n,s,i){const o=s-n+1;return`${((parseInt(e,10)-t-n)%o+o)%o+n}`.padStart(i,"0")}function mu(t,e,n){const{selectionStart:s}=t;return s===0?Ri(e,n,1900,2099,4):s===5?Ri(e,n,1,12,2):s===8?Ri(e,n,1,31,2):s===11?Ri(e,n,0,23,2):s===17||s===14?Ri(e,n,0,59,2):s===20||s===24||s===28?Ri(e,n,0,999,3):n}const jf=X.module("DateTimeInput"),Qf="[12][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])",Zf="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]\\.[0-9]{3}\u200B[0-9]{3}\u200B[0-9]{3}",Jf=`${Qf} ${Zf}`,eC="2022-01-01 00:00:00.000000000",tC="YYYY-MM-DD HH:MM:SS.SSSSSSSSS";function pu(t){const e=t.substring(0,23),n=t.substring(23,26),s=t.substring(26);return[e,n,s].filter(i=>i!=="").join("\u200B")}const nC=t=>t.replace(/\u200B/g,""),sC=[pu(eC)],gu=Y.forwardRef((t,e)=>{const{className:n="",onChange:s=()=>{},defaultValue:i="",onFocus:o=()=>{},onBlur:r=()=>{},"data-testid":l}=t,[a,c]=S.exports.useState(i.length>0?pu(i):""),[h,u]=S.exports.useState(),m=S.exports.useCallback(p=>{jf.debug("handleChange",p),c(p),s(nC(p))},[s]);return d("div",{className:"d-flex flex-row align-items-center",children:d(hl,{ref:e,className:W(n),example:sC,getNextSegmentValue:mu,onChange:m,onSelect:u,pattern:Jf,placeholder:tC,selection:h,value:a,onFocus:o,onBlur:r,"data-testid":l})})});gu.displayName="DateTimeInput";gu.defaultProps={className:"",onChange:()=>{},defaultValue:"",onFocus:()=>{},onBlur:()=>{},"data-testid":void 0};const iC=X.module("DateInput"),oC="[12][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])",rC=["2000-01-01","2022-12-31"],lC="YYYY-MM-DD",fu=Y.forwardRef((t,e)=>{const{className:n="",onChange:s=()=>{},defaultValue:i="",onFocus:o=()=>{},onBlur:r=()=>{},"data-testid":l}=t,[a,c]=S.exports.useState(i),[h,u]=S.exports.useState(),m=S.exports.useCallback(p=>{iC.debug("handleChange",p),c(p),s(p)},[s]);return d("div",{className:"d-flex flex-row align-items-center",children:d(hl,{ref:e,className:W(n),example:rC,getNextSegmentValue:mu,onChange:m,onSelect:u,pattern:oC,placeholder:lC,selection:h,value:a,onFocus:o,onBlur:r,"data-testid":l})})});fu.displayName="DateInput";fu.defaultProps={className:"",onChange:()=>!1,defaultValue:"",onFocus:()=>!1,onBlur:()=>!1,"data-testid":void 0};class Cu extends S.exports.PureComponent{constructor(e){super(e),this.searchInput=Y.createRef(),this.handleChange=this.handleChange.bind(this),this.sendUpdate=Je(this.sendUpdate.bind(this),e.debounceMs),this.state={value:e.value}}componentDidUpdate(e){const{value:n}=this.props;e.value!==n&&this.setState({value:n})}focus(){var e;(e=this.searchInput.current)==null||e.focus()}handleChange(e){this.setState({value:e.target.value},this.sendUpdate)}sendUpdate(){const{onChange:e}=this.props,{value:n}=this.state;e(n)}render(){const{placeholder:e,className:n,matchCount:s,id:i,"data-testid":o}=this.props,{value:r}=this.state;return d(fs,{value:r,placeholder:e,onChange:this.handleChange,className:n,matchCount:s,ref:this.searchInput,id:i,"data-testid":o})}}Cu.defaultProps={placeholder:"Search",className:"",matchCount:null,debounceMs:250,id:"","data-testid":void 0};const aC=({className:t="",show:e=!0,"data-testid":n})=>w("div",{className:W("dh-loader",t,{show:e}),"data-testid":n,children:[d("svg",{className:"dh-outer-shape",viewBox:"0 0 182 182",children:d("g",{transform:"translate(91,91.0033) translate(-64,-64.0033)",children:d("path",{d:"M82.7429,0L82.7429,41.3714L45.2571,41.3714L45.2571,0L0,0L0,128L45.2571,128L45.2571,86.6286L82.5143,86.6286L82.5143,128L128,128L128,0L82.7429,0ZM41.3714,124.114L4.11429,124.114L4.11429,86.6286L41.3714,86.6286L41.3714,124.114ZM41.3714,82.7429L4.11429,82.7429L4.11429,45.2571L41.3714,45.2571L41.3714,82.7429ZM41.3714,41.3714L4.11429,41.3714L4.11429,4.11429L41.3714,4.11429L41.3714,41.3714ZM45.2571,82.7429L45.2571,45.2571L82.5143,45.2571L82.5143,82.5143L45.2571,82.5143ZM124.114,124.114L86.6286,124.114L86.6286,86.6286L123.886,86.6286L123.886,124.114ZM124.114,82.7429L86.6286,82.7429L86.6286,45.2571L123.886,45.2571L123.886,82.7429ZM86.6286,41.3714L86.6286,4.11429L123.886,4.11429L123.886,41.3714L86.6286,41.3714Z",fill:"#f0f0ee"})})}),d("svg",{className:"dh-loader-tile dh-loader-tile-3",viewBox:"0 0 182 182",children:d("g",{transform:"translate(91,91.0033) translate(-64,-64.0033)",children:d("g",{transform:"translate(63.9589,64.0492) translate(-59.9751,-63.9508)",children:d("rect",{width:"37.3438",height:"37.6389",fill:"#5189e5",transform:"translate(-21.9838,29.7957) translate(21.9838,15.3027)"})})})}),d("svg",{className:"dh-loader-tile dh-loader-tile-2",viewBox:"0 0 182 182",children:d("g",{transform:"translate(91,91.0033) translate(-64,-64.0033)",children:d("g",{transform:"translate(63.9589,64.0492) translate(-59.9751,-63.9508)",children:d("rect",{width:"37.2755",height:"37.4675",fill:"#5189e5",transform:"translate(-21.9838,69.7957) translate(22.0822,16.7783)"})})})}),d("svg",{className:"dh-loader-tile dh-loader-tile-5",viewBox:"0 0 182 182",children:d("g",{transform:"translate(91,91.0033) translate(-64,-64.0033)",children:d("g",{transform:"translate(63.9589,64.0492) translate(-59.9751,-63.9508)",children:d("rect",{width:"37.3512",height:"41.3781",fill:"#35618c",transform:"translate(18.0162,72.7957) translate(23.1643,13.7278)"})})})}),d("svg",{className:"dh-loader-tile dh-loader-tile-6",viewBox:"0 0 182 182",children:d("g",{transform:"translate(91,91.0033) translate(-64,-64.0033)",children:d("g",{transform:"translate(63.9589,64.0492) translate(-59.9751,-63.9508)",children:d("rect",{width:"37.2483",height:"37.5869",fill:"#35618c",transform:"translate(59.0162,29.7957) translate(23.6379,15.3564)"})})})}),d("svg",{className:"dh-loader-tile dh-loader-tile-7",viewBox:"0 0 182 182",children:d("g",{transform:"translate(91,91.0033) translate(-64,-64.0033)",children:d("g",{transform:"translate(63.9589,64.0492) translate(-59.9751,-63.9508)",children:d("rect",{width:"37.5664",height:"41.2747",fill:"#35618c",transform:"translate(17.0162,-13.2043) translate(24.2531,13.2043)"})})})}),d("svg",{className:"dh-loader-tile dh-loader-tile-4",viewBox:"0 0 182 182",children:d("g",{transform:"translate(91,91.0033) translate(-64,-64.0033)",children:d("g",{transform:"translate(63.9589,64.0492) translate(-59.9751,-63.9508)",children:d("rect",{width:"37.2854",height:"37.3014",fill:"#5189e5",transform:"translate(-21.9838,-13.2043) translate(22.0822,17.1792)"})})})})]});const cC=X.module("ItemListItem"),bu=class extends S.exports.Component{constructor(t){super(t),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=Y.createRef()}static handleKeyDown(){return cC.log("ItemListItem.handleKeyDown false"),!1}handleBlur(t){const{itemIndex:e,onBlur:n}=this.props;n(e,t)}handleFocus(t){const{itemIndex:e,onFocus:n}=this.props;n(e,t)}handleClick(t){const{itemIndex:e,onClick:n}=this.props;n(e,t)}handleContextMenu(t){const{itemIndex:e,onContextMenu:n}=this.props;n(e,t)}handleDragStart(t){const{itemIndex:e,onDragStart:n}=this.props;n(e,t)}handleDrag(t){const{itemIndex:e,onDrag:n}=this.props;n(e,t)}handleDragOver(t){t.preventDefault();const{itemIndex:e,onDragOver:n}=this.props;n(e,t)}handleDragEnd(t){const{itemIndex:e,onDragEnd:n}=this.props;n(e,t)}handleDrop(t){const{itemIndex:e,onDrop:n}=this.props;n(e,t)}handleDoubleClick(t){const{itemIndex:e,onDoubleClick:n}=this.props;n(e,t)}handleMouseMove(t){const{itemIndex:e,onMouseMove:n}=this.props;n(e,t)}handleMouseDown(t){const{itemIndex:e,onMouseDown:n}=this.props;n(e,t)}handleMouseUp(t){const{itemIndex:e,onMouseUp:n}=this.props;n(e,t)}render(){const{isDraggable:t,isFocused:e,isSelected:n,style:s,children:i,"data-testid":o}=this.props;return d("div",{className:W("item-list-item",{active:n},{"is-focused":e},{"is-draggable":t}),onKeyDown:bu.handleKeyDown,onContextMenu: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:t,"data-testid":o,children:i})}};let Su=bu;Su.defaultProps={children:null,isDraggable:!1,isFocused:!1,isSelected:!1,itemIndex:0,disableSelect:!1,"data-testid":void 0,onBlur(){},onClick(){},onContextMenu(){},onDragStart(){},onDrag(){},onDragOver(){},onDragEnd(){},onDrop(){},onDoubleClick(){},onFocus(){},onMouseDown(){},onMouseMove(){},onMouseUp(){},style:{}};const vd=X.module("ItemList"),Bi=class extends S.exports.PureComponent{constructor(t){super(t),this.getItemSelected=Ie((s,i)=>Sn.isSelected(i,s),{max:Bi.CACHE_SIZE}),this.getCachedItem=Ie((s,i,o,r,l,a,c,h)=>{const u=a({item:o,itemIndex:s,isFocused:r,isSelected:l,style:c});return d(Su,{onContextMenu:this.handleItemContextMenu,onDoubleClick:this.handleItemDoubleClick,onMouseDown:this.handleItemMouseDown,onFocus:this.handleItemFocus,onBlur:this.handleItemBlur,disableSelect:h,onMouseMove:this.handleItemMouseMove,onMouseUp:this.handleItemMouseUp,isFocused:r,isSelected:l,itemIndex:s,style:c,children:u},i)},{max:Bi.CACHE_SIZE}),this.getOuterElement=Ie(s=>{const i=Y.forwardRef((o,r)=>d("div",{ref:r,tabIndex:-1,onKeyDown:s,role:"presentation",...o}));return i.displayName="ItemListOuterElement",i}),this.getInnerElement=Ie(()=>{const s=Y.forwardRef((i,o)=>d("div",{className:"item-list-inner-element",ref:o,...i}));return s.displayName="ItemListInnerElement",s}),this.getItemData=Ie((s,i,o)=>({items:s,selectedRanges:i,renderItem:o})),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=Y.createRef(),this.listContainer=Y.createRef();const{isStickyBottom:e,selectedRanges:n}=t;this.state={focusIndex:null,mouseDownIndex:null,selectedRanges:n,overscanStartIndex:0,height:null,isDragging:!1,isStuckToBottom:e,scrollOffset:null}}static renderItem({item:t}){var e,n;return d("div",{className:"item-list-item-content",children:t!=null&&((n=(e=t.displayValue)!=null?e:t.value)!=null?n:`${t}`)})}componentDidMount(){const{isStickyBottom:t}=this.props;t&&!this.isListAtBottom()&&this.scrollToBottom()}componentDidUpdate(t,e){const{selectedRanges:n}=this.props,{focusIndex:s,isStuckToBottom:i,scrollOffset:o,height:r,selectedRanges:l}=this.state;if(i&&!this.isListAtBottom()&&this.scrollToBottom(),(o!==e.scrollOffset||r!==e.height)&&this.sendViewportUpdate(),n!==t.selectedRanges&&n!==l)this.setSelectedRanges(n);else if(l!==e.selectedRanges){const{onSelectionChange:a}=this.props;a(l)}if(s!==e.focusIndex){const{onFocusChange:a}=this.props;a(s)}}componentWillUnmount(){window.removeEventListener("mouseup",this.handleWindowMouseUp)}focus(){var t;(t=this.listContainer.current)==null||t.focus()}getElement(t){if(this.listContainer.current==null)return null;const{focusSelector:e}=this.props,{overscanStartIndex:n}=this.state,s=this.listContainer.current.querySelectorAll(e),i=t-n;return s[i]}focusItem(t){const{disableSelect:e}=this.props;if(e)return;this.setState({focusIndex:t});const n=this.getElement(t);n instanceof HTMLElement&&n.focus()}scrollToItem(t){const e=this.getElement(t);e!=null&&e.scrollIntoView({block:"center"})}handleItemContextMenu(t,e){const{selectedRanges:n}=this.state,i=Sn.isSelected(n,t)||xe.isModifierKeyDown(e);this.toggleSelect(t,e.shiftKey,i,!1)}handleItemDoubleClick(t,e){const{isDoubleClickSelect:n,onSelect:s}=this.props;n&&this.setState(({selectedRanges:i})=>({selectedRanges:Sn.selectRange(i,[t,t])}),()=>{s(t,e)})}handleItemMouseDown(t,e){const{selectedRanges:n}=this.state;if(!(e.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(e.target.tagName.toLowerCase())!==-1)){if(e.button===2&&n.length===0){this.focusItem(t),this.selectItem(t);return}e.button!=null&&e.button!==0||(this.setState({mouseDownIndex:t}),window.addEventListener("mouseup",this.handleWindowMouseUp))}}handleItemBlur(t,e){vd.debug2("item blur",t,e.currentTarget,e.relatedTarget),(!e.relatedTarget||this.listContainer.current&&e.relatedTarget instanceof HTMLElement&&!this.listContainer.current.contains(e.relatedTarget))&&this.setState({focusIndex:null})}handleItemFocus(t,e){vd.debug2("item focus",t,e.target),this.setState(n=>{const{focusIndex:s}=n;return s!==t?{focusIndex:t}:null})}handleItemMouseMove(t,e){const{isDragSelect:n,isMultiSelect:s,disableSelect:i}=this.props,{mouseDownIndex:o,selectedRanges:r}=this.state;o==null||i||(this.setState({isDragging:!0}),(n||o===t)&&(this.focusItem(t),s?(!n&&!this.getItemSelected(t,r)&&!xe.isModifierKeyDown(e)&&this.deselectAll(),this.selectRange([Math.min(o,t),Math.max(o,t)])):this.toggleSelect(t,e.shiftKey,xe.isModifierKeyDown(e),!1)))}handleItemMouseUp(t,e){const{isDeselectOnClick:n,isDoubleClickSelect:s,onSelect:i}=this.props,{mouseDownIndex:o,isDragging:r}=this.state;if(!(e.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(e.target.tagName.toLowerCase())!==-1)){if(o===t&&!r){const l=e.shiftKey,a=xe.isModifierKeyDown(e);this.focusItem(t),this.toggleSelect(t,l,a,n),!s&&!l&&!a&&i(t,e)}this.resetMouseState()}}handleItemsRendered({overscanStartIndex:t}){this.setState({overscanStartIndex:t})}handleResize({height:t}){this.setState({height:t})}handleMouseLeave(){this.setState({mouseDownIndex:null})}handleWindowMouseUp(){this.resetMouseState(),window.removeEventListener("mouseup",this.handleWindowMouseUp)}handleKeyDown(t){var r;const{isMultiSelect:e,itemCount:n,onSelect:s}=this.props,{focusIndex:i}=this.state;let o=i;if(t.key==="Enter"||t.key===" "){!e&&o!=null&&this.setState({selectedRanges:[[o,o]]},()=>{o!=null&&s(o,t)});return}if(t.key==="ArrowUp")o!=null&&o>=0?o=Math.max(0,o-1):o=n-1;else if(t.key==="ArrowDown")o!=null&&o>=0?o=Math.min(o+1,n-1):o=0;else return;if(i!==o){t.stopPropagation(),t.preventDefault(),this.focusItem(o);const{selectedRanges:l}=this.state;if(t.shiftKey&&l.length>0){const a=l[l.length-1];this.selectRange([Math.min(o,a[0]),Math.max(o,a[1])])}else this.deselectAll(),o!==null?this.selectItem(o):(r=this.listContainer.current)==null||r.focus();this.scrollIntoView(o)}}handleScroll({scrollUpdateWasRequested:t,scrollOffset:e}){this.setState(n=>{if(t)return{scrollOffset:e};const{isStickyBottom:s}=this.props,{height:i}=n;return{isStuckToBottom:s&&this.isListAtBottom({scrollOffset:e,height:i}),scrollOffset:e}})}resetMouseState(){this.setState({mouseDownIndex:null,isDragging:!1})}scrollToBottom(){const{itemCount:t}=this.props;this.list.current&&this.list.current.scrollToItem(t)}scrollIntoView(t){this.list.current&&this.list.current.scrollToItem(t)}toggleSelect(t,e,n,s=!0){const{isMultiSelect:i}=this.props,{selectedRanges:o}=this.state;if(i&&e&&o.length>0){const r=o[o.length-1];this.selectRange([Math.min(r[0],t),Math.max(t,r[1])])}else i&&o.length===1&&o[0][0]===t&&o[0][1]===t?s&&this.deselectItem(t):i&&n?this.getItemSelected(t,o)?s&&this.deselectItem(t):this.selectItem(t):(this.deselectAll(),this.selectItem(t))}deselectAll(){const{itemCount:t}=this.props;this.deselectRange([0,t])}deselectItem(t){this.deselectRange([t,t])}deselectRange(t){Sn.validateRange(t),this.setState(({selectedRanges:e})=>({selectedRanges:Sn.deselectRange(e,t)}))}selectItem(t){const{disableSelect:e}=this.props;e||this.selectRange([t,t])}selectRange(t){Sn.validateRange(t),this.setState(({selectedRanges:e})=>({selectedRanges:Sn.selectRange(e,t)}))}setSelectedRanges(t){this.setState({selectedRanges:t})}sendViewportUpdate(){const{scrollOffset:t,height:e}=this.state;if(t!=null&&e!=null){const{onViewportChange:n,rowHeight:s}=this.props,i=Math.floor(t/s),o=i+Math.ceil(e/s);n(i,o)}}isListAtBottom({scrollOffset:t,height:e}=this.state){if(e==null||t==null)return!1;const{itemCount:n,rowHeight:s}=this.props;return t+e>=n*s}renderInnerElement({index:t,style:e}){const{items:n,offset:s,renderItem:i,disableSelect:o}=this.props,{focusIndex:r,selectedRanges:l}=this.state;if(t<s||t>=s+n.length)return null;const a=n[t-s];return this.getCachedItem(t,t,a,t===r&&!o,this.getItemSelected(t,l),i,e,o)}render(){const{items:t,itemCount:e,overscanCount:n,renderItem:s,rowHeight:i,"data-testid":o}=this.props,{selectedRanges:r}=this.state;return d(Fp,{className:"item-list-auto-sizer",onResize:this.handleResize,children:({width:l,height:a})=>d(xp,{className:"item-list-scroll-pane",height:a,width:l,itemCount:e,itemSize:i,itemData:this.getItemData(t,r,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})})}};let vn=Bi;vn.CACHE_SIZE=1e3;vn.DEFAULT_ROW_HEIGHT=20;vn.DEFAULT_OVERSCAN=10;vn.defaultProps={offset:0,items:[],rowHeight:Bi.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!1,isDragSelect:!0,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},overscanCount:Bi.DEFAULT_OVERSCAN,renderItem:Bi.renderItem,selectedRanges:[],focusSelector:".item-list-item","data-testid":void 0};const ii=class extends S.exports.PureComponent{constructor(t){super(t),this.getCachedDraggableItem=Ie((e,n,s,i,o,r,l,a)=>d(il,{draggableId:ii.getDraggableId(e,i),index:i,isDragDisabled:l,children:c=>d("div",{role:"menuitem",className:"draggable-item-list-item",ref:c.innerRef,tabIndex:-1,...c.draggableProps,...c.dragHandleProps,children:n({item:s,itemIndex:i,isFocused:o,isSelected:r,style:a,isClone:!1})})},i),{max:vn.CACHE_SIZE}),this.getCachedRenderDraggableItem=Ie((e,n,s)=>({item:i,itemIndex:o,isFocused:r,isSelected:l,style:a})=>this.getCachedDraggableItem(e,s,i,o,r,l,n,a),{max:1}),this.getCachedRenderClone=Ie((e,n,s,i)=>(o,r,l)=>{const{selectedCount:a}=this.state,{index:c}=l.source,h=n[c-s];return d("div",{className:W("draggable-item-list-dragging-item-container",e),...o.draggableProps,...o.dragHandleProps,ref:o.innerRef,children:d("div",{className:W("draggable-item-list-dragging-item",{"two-dragged":a===2},{"multiple-dragged":a>2}),children:i({item:h,itemIndex:c,isFocused:!1,isSelected:!0,style:{},isClone:!0,selectedCount:a})})})},{max:1}),this.handleSelectionChange=this.handleSelectionChange.bind(this),this.itemList=Y.createRef(),this.state={selectedCount:0}}static renderHandle(){return w("div",{children:[d(pe,{children:"Drag to re-order"}),d(z,{icon:ll})]})}static renderBadge({text:t}){return t!=null&&t.length>0?d("span",{className:"number-badge",children:t}):null}static renderTextItem({text:t,badgeText:e="",className:n=""}){return w("div",{className:W("item-list-item-content","draggable-item-list-item-content",n),children:[d("span",{className:"title",children:t}),ii.renderBadge({text:e}),ii.renderHandle()]})}static renderItem({item:t,isClone:e,selectedCount:n}){var r,l;const s=t!=null?(l=(r=t.displayValue)!=null?r:t.value)!=null?l:`${t}`:"",i=e!==void 0&&e?`${n}`:"",o=e!==void 0&&e?"item-list-item-clone":"";return ii.renderTextItem({text:s,badgeText:i,className:o})}static getDraggableId(t,e){return`${t}/${e}`}static getDraggableIndex(t){const e=t.split("/").pop();return parseInt(e!==void 0?e:"",10)}selectItem(t){var e;(e=this.itemList.current)==null||e.selectItem(t)}focusItem(t){var e;(e=this.itemList.current)==null||e.focusItem(t)}scrollToItem(t){var e;(e=this.itemList.current)==null||e.scrollToItem(t)}handleSelectionChange(t){this.setState({selectedCount:Sn.count(t)});const{onSelectionChange:e}=this.props;e(t)}render(){const{className:t,draggablePrefix:e,draggingItemClassName:n,droppableId:s,isDoubleClickSelect:i,isDragDisabled:o,isDropDisabled:r,isMultiSelect:l,isStickyBottom:a,itemCount:c,items:h,offset:u,onFocusChange:m,onSelect:p,onViewportChange:g,renderItem:f,rowHeight:b,selectedRanges:C,style:v,"data-testid":T}=this.props;return d(Po,{isDropDisabled:r,droppableId:s,mode:"virtual",renderClone:this.getCachedRenderClone(n,h,u,f),"data-testid":T,children:(E,y)=>d("div",{role:"menu",className:W("draggable-item-list",t,{"is-drop-disabled":r,"is-drag-disabled":o,"is-dragging-from-this":y.draggingFromThisWith,"is-dragging-over":y.isDraggingOver,"is-dropping":y.draggingOverWith}),style:v,ref:E.innerRef,...E.droppableProps,children:d(vn,{focusSelector:".draggable-item-list-item",isDoubleClickSelect:i,isDragSelect:!1,isMultiSelect:l,isStickyBottom:a,itemCount:c,items:h,onFocusChange:m,onSelect:p,onSelectionChange:this.handleSelectionChange,onViewportChange:g,offset:u,ref:this.itemList,renderItem:this.getCachedRenderDraggableItem(e,o,f),rowHeight:b,selectedRanges:C})})})}};let rn=ii;rn.DEFAULT_ROW_HEIGHT=30;rn.defaultProps={className:"",draggingItemClassName:"",offset:0,items:[],rowHeight:ii.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!0,isDropDisabled:!1,isDragDisabled:!1,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,style:null,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},renderItem:ii.renderItem,selectedRanges:[],draggablePrefix:"draggable-item",droppableId:"droppable-item-list","data-testid":void 0};class Yt{static reorder(e,n,s,i){const o=e===s?Yt.adjustDestinationIndex(i,n):i,r=Yt.removeItems(e,n);return s.splice(o,0,...r),r}static removeItems(e,n){const s=[],i=n.map((o,r)=>({range:o,index:r})).sort((o,r)=>r.range[0]-o.range[0]);for(let o=0;o<i.length;o+=1){const{range:r,index:l}=i[o],[a,c]=r;s[l]=e.splice(a,c-a+1)}return _p(s)}static adjustDestinationIndex(e,n){let s=e;for(let i=0;i<n.length;i+=1){const[o,r]=n[i];if(o>e)break;s-=Math.min(r,e-1)-o+1}return s}static startDragging(){document.documentElement.classList.add("drag-pointer-events-none")}static stopDragging(){document.documentElement.classList.remove("drag-pointer-events-none")}}const xr=class extends S.exports.Component{static isParentSelected(t,e){const n=e.get(t);if(n===void 0)return!1;if(typeof n=="boolean")return n;const s=Array.from(n.values()).includes(!0),i=Array.from(n.values()).includes(!1);return s&&i?null:s}constructor(t){super(t),this.toggleMenu=this.toggleMenu.bind(this),this.toggleValueFor=this.toggleValueFor.bind(this),this.selectAll=this.selectAll.bind(this),this.clear=this.clear.bind(this),this.state={menuIsOpen:!1}}toggleMenu(t){t.stopPropagation(),t.preventDefault(),this.setState(e=>{const{menuIsOpen:n}=e;return{menuIsOpen:!n}})}toggleValueFor(t,e){const{valueMap:n,onUpdateValueMap:s}=this.props,i=new Map(n),o=i.get(t);if(o instanceof Map){const l=new Map(o);if(e!=null)l.set(e,o.get(e)===void 0);else{const a=xr.isParentSelected(t,i),c=a==null||!a;o.forEach((h,u)=>l.set(u,c))}i.set(t,l)}else i.set(t,o==null||!o);const r=i.get(t);if(e===void 0&&r!==void 0&&typeof r!="boolean"){const l=xr.isParentSelected(t,n);l!=null&&l?r.forEach((a,c)=>r.set(c,!1)):r.forEach((a,c)=>r.set(c,!0))}s(i)}setAllValues(t){const{valueMap:e,onUpdateValueMap:n}=this.props,s=new Map;e.forEach((i,o)=>{if(typeof i=="boolean")s.set(o,t);else{const r=new Map;i.forEach((l,a)=>r.set(a,t)),s.set(o,r)}}),n(s)}selectAll(){this.setAllValues(!0)}clear(){this.setAllValues(!1)}renderMenuElement(){const{valueMap:t,"data-testid":e}=this.props;return w("div",{className:"hcm-menu-container",children:[Array.from(t.entries()).map(([n,s])=>w("div",{children:[d(Ut,{className:"hcm-parent",checked:xr.isParentSelected(n,t),onChange:()=>this.toggleValueFor(n),children:n}),s!==void 0&&typeof s!="boolean"&&Array.from(s.entries()).map(([i,o])=>d(Ut,{className:"hcm-child",checked:o,onChange:()=>this.toggleValueFor(n,i),children:i},i))]},n)),d("button",{type:"button",className:"btn btn-link",onClick:this.selectAll,"data-testid":e!==void 0?`${e}-btn-select-all`:void 0,children:"Select All"}),d("button",{type:"button",className:"btn btn-link",onClick:this.clear,"data-testid":e!==void 0?`${e}-btn-clear`:void 0,children:"Clear"})]})}render(){const{menuText:t,className:e,icon:n,id:s,"data-testid":i}=this.props,{menuIsOpen:o}=this.state;return w("button",{type:"button",className:W("btn hcm-btn",e),onClick:this.toggleMenu,id:s,"data-testid":i,children:[w("span",{children:[n&&d(z,{icon:n,className:"hcm-icon mr-1"}),t]}),d(z,{icon:nc,className:"hcm-icon ml-1"}),d(xn,{options:{placement:"bottom"},isShown:o,onExited:()=>{this.setState({menuIsOpen:!1})},closeOnBlur:!0,interactive:!0,children:this.renderMenuElement()})]})}};let dC=xr;dC.defaultProps={className:"",icon:null,id:"","data-testid":void 0};const ul=({isLoaded:t=!1,isLoading:e=!0,errorMessage:n=null,"data-testid":s})=>d(gt,{in:Boolean(n)||!t||e,timeout:It.transitionMs,classNames:t?"fade":"",mountOnEnter:!0,unmountOnExit:!0,children:d("div",{className:"fill-parent-absolute","data-testid":s,children:d("div",{className:W("iris-panel-message-overlay","fill-parent-absolute",{"iris-panel-scrim-background":t}),children:w("div",{className:"message-content",children:[w("div",{className:"message-icon",children:[e&&d(Ln,{}),!e&&n&&d(z,{icon:hs})]}),d("div",{className:"message-text",children:n})]})})})});const wu=({on:t,id:e,className:n,isInvalid:s,disabled:i=!1,onClick:o,"data-testid":r})=>d("button",{type:"button",className:W("btn","btn-switch",n,{active:t},{"is-invalid":s}),id:e,onClick:o,disabled:i,"data-testid":r,children:d("div",{className:"handle"})});function Td(t){return t.isOn!==void 0}const hC=({item:t,onSelect:e=()=>{},"data-testid":n})=>{const{icon:s,subtitle:i,title:o}=t,r=S.exports.useMemo(()=>Td(t)?()=>{t.onChange(!t.isOn)}:e,[t,e]);return w("div",{className:"btn btn-navigation-menu-item","data-testid":`menu-item-${o}`,onClick:r,onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&r()},tabIndex:0,role:"menuitem",children:[s!==void 0&&d("div",{className:"icon",children:d(z,{icon:s})}),d("div",{className:"title",children:o}),i!==void 0&&d("div",{className:"shortcut",children:i}),d("div",{className:"accessory","data-testid":n,children:Td(t)&&d(wu,{on:t.isOn,onClick:l=>{l.stopPropagation(),r()}})||d(z,{icon:qh})})]})};const vu=({items:t,onSelect:e=()=>{},"data-testid":n})=>d("div",{className:"navigation-menu-view","data-testid":n,children:d("ul",{className:"navigation-menu-list",children:t.map((s,i)=>d("li",{children:d(hC,{item:s,onSelect:()=>{e(i)}})},s.title))})});const Ed=({children:t,onBack:e,onClose:n,title:s,"data-testid":i})=>w("div",{className:"navigation-page","data-testid":i,children:[w("div",{className:"navigation-title-bar",children:[d("div",{className:"navigation-left-buttons",children:e!==void 0&&w("button",{className:"btn btn-link btn-back","data-testid":"btn-page-back",type:"button",onClick:e,children:[d(z,{icon:Wg}),"Back"]})}),d("div",{className:"navigation-title",children:s}),d("div",{className:"navigation-right-buttons",children:n!==void 0&&d("button",{className:"btn btn-link btn-link-icon btn-close px-2 m-1","data-testid":"btn-page-close",type:"button",onClick:n,children:d(z,{icon:$o})})})]}),d("div",{className:"navigation-content",children:t})]});const uC=({children:t,"data-testid":e})=>{const n=S.exports.useMemo(()=>Y.Children.toArray(t),[t]),s=dl(n),[i,o]=S.exports.useState(n[n.length-1]),[r,l]=S.exports.useState(null),[a,c]=S.exports.useState(null);S.exports.useEffect(function(){if(s===void 0||n===s)return;const p=n[n.length-1];n.length===s.length||s.length===0||r!==null||a!==null?r!==null&&p!==r?l(p):p!==a&&p!==i&&o(p):n.length>s.length?l(p):n.length<s.length&&(o(p),c(s[s.length-1]))},[n,s,r,a,i]);const h=S.exports.useCallback(()=>{o(r),l(null)},[r]),u=S.exports.useCallback(()=>{c(null)},[]);return w("div",{className:"navigation-stack",children:[d("div",{className:"main-view","data-testid":e,children:i}),d(gt,{in:a!=null,timeout:It.transitionMidMs,classNames:"slide-right",onEntered:u,children:d(ue,{children:a!=null&&d("div",{className:"popping-view",children:a})})}),d(gt,{in:r!=null,timeout:It.transitionMidMs,classNames:"slide-left",onEntered:h,children:d(ue,{children:r!=null&&d("div",{className:"pushing-view",children:r})})})]})},mC=({children:t,disabled:e,value:n,"data-testid":s})=>d("option",{value:n,disabled:e,"data-testid":s,children:t}),ml=t=>{const{children:e,disabled:n=!1,name:s,onChange:i,value:o="","data-testid":r}=t,[l]=S.exports.useState(s!=null?s:qe());return d(ue,{children:Y.Children.map(e,a=>{var c,h;return a?Y.cloneElement(a,{name:l,onChange:(c=a.props.onChange)!=null?c:i,checked:o===a.props.value,disabled:(h=a.props.disabled)!=null?h:n,"data-testid":r}):null})})},Mn=Y.forwardRef((t,e)=>{const{checked:n,children:s,className:i="",disabled:o=!1,inputClassName:r="",isInvalid:l=!1,labelClassName:a="",name:c,onChange:h,value:u,"data-testid":m}=t,[p]=S.exports.useState(qe());return w("div",{className:W("custom-control custom-radio",i),children:[d("input",{type:"radio",id:p,"data-testid":m,name:c,ref:e,className:W("custom-control-input",r,{"is-invalid":l}),checked:n,disabled:o,value:u,onChange:h}),d("label",{className:W("custom-control-label",a),htmlFor:p,children:s})]})});Mn.displayName="RadioItem";Mn.defaultProps={checked:void 0,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};const pC=({children:t,onBlur:e,onChange:n,className:s,defaultValue:i,name:o,value:r,disabled:l,"data-testid":a})=>{const c=S.exports.useCallback(h=>{n(h.target.value)},[n]);return d("select",{className:W("custom-select",s),onBlur:e,onChange:c,defaultValue:i,value:r,name:o,disabled:l,"data-testid":a,children:t})};class Tu extends S.exports.PureComponent{constructor(e){super(e),this.getCachedItem=Ie((n,s,i,o,r,l,a)=>{const c={height:r},h=o!=null?o:i;return d("li",{className:"value-list-item",style:c,tabIndex:-1,children:d(Ut,{checked:l,disabled:a,onChange:()=>this.handleSelect(n),children:h})},s)},{max:1e3}),this.getCachedItems=Ie((n,s,i,o)=>{const r=[];for(let l=0;l<n.length;l+=1){const a=n[l],{value:c,displayValue:h,isSelected:u}=a,m=i+l,p=m,g=this.getCachedItem(m,p,c,h,s,u,o);r.push(g)}return r},{max:1}),this.handleBlur=this.handleBlur.bind(this),this.handleScroll=this.handleScroll.bind(this),this.handleSelect=this.handleSelect.bind(this),this.list=Y.createRef(),this.topRow=null,this.bottomRow=null}componentDidMount(){this.sendViewportUpdate()}componentDidUpdate(){this.sendViewportUpdate()}handleBlur(e){if(!e.relatedTarget||this.list.current&&e.relatedTarget instanceof HTMLElement&&!this.list.current.contains(e.relatedTarget)){const{onBlur:n}=this.props;n==null||n(e)}}handleScroll(){this.sendViewportUpdate()}handleSelect(e){const{items:n,offset:s,onSelect:i}=this.props,o=e-s;if(o>=0&&o<n.length){const r=n[o],{value:l}=r;i(e,l)}else i(e,null)}sendViewportUpdate(){if(!this.list.current||this.list.current.clientHeight===0)return;const{onViewportChange:e,rowHeight:n}=this.props,s=this.list.current.scrollTop,i=s+this.list.current.clientHeight,o=Math.floor(s/n),r=Math.ceil(i/n);(this.topRow!==o||this.bottomRow!==r)&&(this.topRow=o,this.bottomRow=r,e(o,r))}getElement(e){return this.list.current==null?null:this.list.current.querySelectorAll(".value-list-item")[e]}scrollIntoView(e){const n=this.getElement(e);n==null||n.scrollIntoView({block:"center"})}render(){const{className:e,disabled:n,isInvalid:s,items:i,itemCount:o,offset:r,rowHeight:l,"data-testid":a}=this.props,c=this.getCachedItems(i,l,r,n);return d("div",{className:W("select-value-list-scroll-pane h-100 w-100",{"is-invalid":s},e),onBlur:this.handleBlur,onScroll:this.handleScroll,ref:this.list,"data-testid":a,children:d("div",{className:"select-value-list",style:{height:o*l},children:d("ol",{className:"select-value-list-content",style:{position:"absolute",height:i.length*l,top:r*l,left:0},children:c})})})}}Tu.defaultProps={disabled:!1,rowHeight:21,onBlur:()=>{},"data-testid":void 0};const yd=X.module("Shortcut");var me=(t=>(t.CTRL="MODIFIER_CTRL",t.CMD="MODIFIER_CMD",t.ALT="MODIFIER_ALT",t.OPTION="MODIFIER_OPTION",t.SHIFT="MODIFIER_SHIFT",t))(me||{}),fe=(t=>(t.A="A",t.B="B",t.C="C",t.D="D",t.E="E",t.F="F",t.G="G",t.H="H",t.I="I",t.J="J",t.K="K",t.L="L",t.M="M",t.N="N",t.O="O",t.P="P",t.Q="Q",t.R="R",t.S="S",t.T="T",t.U="U",t.V="V",t.W="W",t.X="X",t.Y="Y",t.Z="Z",t.ZERO="0",t.ONE="1",t.TWO="2",t.THREE="3",t.FOUR="4",t.FIVE="5",t.SIX="6",t.SEVEN="7",t.EIGHT="8",t.NINE="9",t.BACKSPACE="Backspace",t.ESCAPE="Escape",t.ENTER="Enter",t.DELETE="Delete",t.SLASH="/",t.QUESTION_MARK="?",t.BACKSLASH="\\",t.PIPE="|",t.MINUS="-",t.UNDERSCORE="_",t.EQUALS="=",t.PLUS="+",t.BACKTICK="`",t.TILDE="~",t.COMMA=",",t.LEFT_CHEVRON="<",t.PERIOD=".",t.RIGHT_CHEVRON=">",t.SEMICOLON=";",t.COLON=":",t.SINGLE_QUOTE="'",t.DOUBLE_QUOTE='"',t.LEFT_BRACKET="[",t.RIGHT_BRACKET="]",t.LEFT_CURLY="{",t.RIGHT_CURLY="}",t.F1="F1",t.F2="F2",t.F3="F3",t.F4="F4",t.F5="F5",t.F6="F6",t.F7="F7",t.F8="F8",t.F9="F9",t.F10="F10",t.F11="F11",t.F12="F12",t))(fe||{});const gC=new Set(["Enter","Delete","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]),Ct=class extends sl{constructor({id:t,shortcut:e,macShortcut:n,isEditable:s=!0,name:i,tooltip:o}){super(),this.id=t,this.name=i,this.tooltip=o,this.isEditable=s;const l=Ct.isMacPlatform?n:e;this.defaultKeyState=Ct.createKeyState(l),this.keyState=this.defaultKeyState}static isAllowedKey(t){return Object.values(fe).includes(t)}static isValidKeyState(t){const{keyValue:e}=t;return e===null?!0:!Ct.isMacPlatform&&t.metaKey||!Ct.isAllowedKey(e)?!1:!(!t.altKey&&!t.ctrlKey&&!t.metaKey&&!t.shiftKey)||gC.has(e)}static createKeyState(t){const e={altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1,keyValue:t[t.length-1]};return t.forEach(n=>{switch(n){case"MODIFIER_CTRL":e.ctrlKey=!0;break;case"MODIFIER_ALT":case"MODIFIER_OPTION":e.altKey=!0;break;case"MODIFIER_CMD":e.metaKey=!0;break;case"MODIFIER_SHIFT":e.shiftKey=!0;break}}),e}static getKeyStateFromEvent(t){const{key:e,keyCode:n}=t;let s="";return e==="Shift"||e==="Meta"||e==="Control"||e==="Alt"?s="":!Ct.isAllowedKey(e)&&Ct.isAllowedKey(String.fromCharCode(n))?s=String.fromCharCode(n):s=e,{keyValue:s,altKey:t.altKey,ctrlKey:t.ctrlKey,metaKey:t.metaKey,shiftKey:t.shiftKey}}static getWindowsDisplayText(t){let e="";return t.ctrlKey&&(e+="Ctrl+"),t.altKey&&(e+="Alt+"),t.shiftKey&&(e+="Shift+"),t.keyValue==="Escape"?e+="Esc":t.keyValue!==null&&(e+=t.keyValue),e}static getMacDisplayText(t){let e="";switch(t.ctrlKey&&(e+="\u2303"),t.altKey&&(e+="\u2325"),t.shiftKey&&(e+="\u21E7"),t.metaKey&&(e+="\u2318"),t.keyValue){case"Enter":e+="\u23CE";break;case"Escape":e+="\u238B";break;case"Backspace":e+="\u232B";break;case"Delete":e+="\u2326";break;case null:break;default:e+=t.keyValue}return e}static doKeyStatesMatch(t,e){var n,s;return((n=t.keyValue)==null?void 0:n.toUpperCase())===((s=e.keyValue)==null?void 0:s.toUpperCase())&&t.altKey===e.altKey&&t.ctrlKey===e.ctrlKey&&t.metaKey===e.metaKey&&t.shiftKey===e.shiftKey}static getDisplayText(t){return t.keyValue===null?"":Ct.isMacPlatform?Ct.getMacDisplayText(t):Ct.getWindowsDisplayText(t)}getDisplayText(){return Ct.getDisplayText(this.keyState)}getKeyState(){return this.keyState}setKeyState(t){Ct.isValidKeyState(t)?(yd.debug2(`Shortcut ${this.id} updated to ${JSON.stringify(t)}`),this.keyState=t,this.dispatchEvent(new Ye("onUpdate",{detail:this}))):yd.debug2(`Shortcut ${this.id} tried to update to invalid keyState ${JSON.stringify(t)}`)}getDefaultKeyState(){return this.defaultKeyState}isDefault(){return Ct.doKeyStatesMatch(this.getDefaultKeyState(),this.getKeyState())}setToNull(){this.setKeyState(Ct.NULL_KEY_STATE)}isNull(){return Ct.doKeyStatesMatch(this.keyState,Ct.NULL_KEY_STATE)}setToDefault(){this.setKeyState(this.defaultKeyState)}matchesKeyState(t){return Ct.doKeyStatesMatch(t,this.keyState)}matchesEvent(t){return this.matchesKeyState(Ct.getKeyStateFromEvent(t))}};let Kt=Ct;Kt.NULL_KEY_STATE={metaKey:!1,shiftKey:!1,altKey:!1,ctrlKey:!1,keyValue:null};Kt.isMacPlatform=xe.isMacPlatform();const Id=X.module("ShortcutRegistry");class fC extends sl{constructor(){super(...arguments),this.shortcutMap=new Map,this.shortcutsByCategory=new Map}createAndAdd(e){const n=new Kt(e);return this.add(n)}add(e){var i;const n=this.shortcutMap.get(e.id);if(n)return Id.warn(`Skipping attempt to add duplicate shortcut ID to registry: ${e.id}`),n;Id.debug2(`Adding shortcut to registry: ${e.id}`),e.addEventListener("onUpdate",({detail:o})=>this.dispatchEvent(new Ye("onUpdate",{detail:o})));const s=e.id.split(".")[0];return this.shortcutMap.set(e.id,e),this.shortcutsByCategory.has(s)?(i=this.shortcutsByCategory.get(s))==null||i.push(e):this.shortcutsByCategory.set(s,[e]),e}get(e){return this.shortcutMap.get(e)}getConflictingShortcuts(e){return Array.from(this.shortcutMap.values()).filter(n=>!n.isNull()&&n.matchesKeyState(e))}}const ze=Object.freeze(new fC),Os={COPY:ze.createAndAdd({id:"GLOBAL.COPY",name:"Copy",shortcut:[me.CTRL,fe.C],macShortcut:[me.CMD,fe.C],isEditable:!1}),PASTE:ze.createAndAdd({id:"GLOBAL.PASTE",name:"Paste",shortcut:[me.CTRL,fe.V],macShortcut:[me.CMD,fe.V],isEditable:!1}),SAVE:ze.createAndAdd({id:"GLOBAL.SAVE",name:"Save",shortcut:[me.CTRL,fe.S],macShortcut:[me.CMD,fe.S],isEditable:!1}),SELECT_ALL:ze.createAndAdd({id:"GLOBAL.SELECT_ALL",name:"Select All",shortcut:[me.CTRL,fe.A],macShortcut:[me.CMD,fe.A],isEditable:!1}),LINKER:ze.createAndAdd({id:"GLOBAL.LINKER",name:"Linker",shortcut:[me.CTRL,fe.L],macShortcut:[me.CMD,fe.L]}),LINKER_CLOSE:ze.createAndAdd({id:"GLOBAL.LINKER_CLOSE",name:"Close Linker Overlay",shortcut:[fe.ESCAPE],macShortcut:[fe.ESCAPE],isEditable:!1})};const pl=Y.forwardRef((t,e)=>{const{children:n,className:s,disabled:i,isLinked:o,isLinkedSource:r,isInvalid:l,onClick:a,onMouseEnter:c,onMouseLeave:h,style:u,"data-testid":m}=t;return w("button",{ref:e,type:"button",className:W("btn-socketed",{"btn-socketed-linked":o!==void 0&&o||r},{"btn-socketed-linked-source":r},{"is-invalid":l},s),onClick:a,onMouseEnter:c,onMouseLeave:h,style:u,disabled:i,"data-testid":m,children:[n,d(z,{icon:Xa,className:"linked btn-socketed-icon",transform:"down-1"}),d(z,{icon:Sf,className:"is-invalid btn-socketed-icon"})]})});pl.displayName="SocketedButton";pl.defaultProps={children:void 0,className:"",disabled:!1,isLinked:!1,isLinkedSource:!1,isInvalid:!1,onClick:void 0,onMouseEnter:void 0,onMouseLeave:void 0,style:void 0,"data-testid":void 0};const CC="_track_xvu02_28",bC="_handle_xvu02_11",SC="_ticks_xvu02_96",Eu={"handle-size":"15px","popover-width":"90px","time-slider":"_time-slider_xvu02_1","time-slider-popovers":"_time-slider-popovers_xvu02_6","handle-popper":"_handle-popper_xvu02_11","flex-spacer":"_flex-spacer_xvu02_24",track:CC,"track-fills":"_track-fills_xvu02_35","track-fill":"_track-fill_xvu02_35","track-fill-start":"_track-fill-start_xvu02_53","track-fill-middle":"_track-fill-middle_xvu02_54","track-fill-end":"_track-fill-end_xvu02_57","handle-track":"_handle-track_xvu02_60",handle:bC,ticks:SC,"tick-labels":"_tick-labels_xvu02_114","tick-label":"_tick-label_xvu02_114","tick-label-wrapper":"_tick-label-wrapper_xvu02_130"};parseInt(Eu["handle-size"],10);parseInt(Eu["popover-width"],10);Object.freeze({ERROR:"error"});const{dh:N}=globalThis,gl=R.exports.shape({name:R.exports.string.isRequired,type:R.exports.string.isRequired,description:R.exports.string,constituentType:R.exports.string}),yu=R.exports.shape({not:R.exports.func.isRequired,and:R.exports.func.isRequired,or:R.exports.func.isRequired}),wC=R.exports.shape({asc:R.exports.func.isRequired,desc:R.exports.func.isRequired,abs:R.exports.func.isRequired,column:gl.isRequired,direction:R.exports.string.isRequired,isAbs:R.exports.bool.isRequired}),vC=R.exports.shape({columns:R.exports.arrayOf(gl).isRequired,customColumns:R.exports.arrayOf(R.exports.string).isRequired,filter:R.exports.arrayOf(yu),addEventListener:R.exports.func.isRequired,removeEventListener:R.exports.func.isRequired,size:R.exports.number.isRequired,sort:R.exports.arrayOf(R.exports.any),copy:R.exports.func.isRequired,applyFilter:R.exports.func.isRequired,applySort:R.exports.func.isRequired,applyCustomColumns:R.exports.func.isRequired,description:R.exports.string}),TC=R.exports.shape({columns:R.exports.arrayOf(gl),filter:R.exports.arrayOf(R.exports.any),isExpanded:R.exports.func.isRequired,saveExpandedState:R.exports.func.isRequired,addEventListener:R.exports.func.isRequired,removeEventListener:R.exports.func.isRequired,size:R.exports.number.isRequired,sort:R.exports.arrayOf(R.exports.any),applyFilter:R.exports.func.isRequired,applySort:R.exports.func.isRequired}),_r=R.exports.shape({name:R.exports.string.isRequired,type:R.exports.string.isRequired}),EC=R.exports.shape({created:R.exports.arrayOf(_r).isRequired,updated:R.exports.arrayOf(_r).isRequired,removed:R.exports.arrayOf(_r).isRequired}),yC=R.exports.shape({groupingColumns:R.exports.arrayOf(R.exports.string),aggregations:R.exports.shape({}),includeConstituents:R.exports.bool,includeOriginalColumns:R.exports.bool,includeDescriptions:R.exports.bool}),IC=R.exports.shape({addEventListener:R.exports.func.isRequired,removeEventListener:R.exports.func.isRequired,onLogMessage:R.exports.func,getTable:R.exports.func.isRequired,runCode:R.exports.func.isRequired});Object.freeze({Column:gl,FilterCondition:yu,IdeSession:IC,RollupConfig:yC,Sort:wC,Table:vC,TreeTable:TC,VariableChanges:EC,VariableDefinition:_r});const Iu=({type:t})=>{switch(t){case N.VariableType.TABLE:case N.VariableType.TABLEMAP:case N.VariableType.TREETABLE:return d(z,{icon:sc});case N.VariableType.FIGURE:return d(z,{icon:Yh});case N.VariableType.PANDAS:return d(z,{icon:Mf});default:return d(z,{icon:va})}};class fl extends S.exports.Component{constructor(e){super(e),this.container=null}componentDidMount(){this.colorize()}colorize(){const{children:e}=this.props;this.container&&e!=null&&ds.colorizeElement(this.container,{theme:"dh-dark"})}render(){const{children:e,language:n}=this.props;return d("div",{children:d("div",{"data-lang":n,ref:s=>{this.container=s},style:{pointerEvents:"none"},children:e})})}}class Ru{static get LANGUAGE_MAP(){return new Map([["python","Python"],["groovy","Groovy"],["scala","Scala"]])}}class Gi{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)?[]:Lp.parse(e).filter(n=>!this.hasComment(n)).map(n=>this.hasPattern(n)?n.pattern:this.hasOp(n)?n.op:`${n}`)}static formatTimestamp(e){if(e==null||!(e instanceof Date))return null;const n=`${e.getHours()}`.padStart(2,"0"),s=`${e.getMinutes()}`.padStart(2,"0"),i=`${e.getSeconds()}`.padStart(2,"0"),o=`${e.getMilliseconds()}`.padStart(3,"0");return`${n}:${s}:${i}.${o}`}static isTableType(e){return e===N.VariableType.TABLE||e===N.VariableType.TREETABLE}static isWidgetType(e){return e===N.VariableType.FIGURE||e===N.VariableType.OTHERWIDGET||e===N.VariableType.PANDAS}static isOpenableType(e){return Gi.isTableType(e)||Gi.isWidgetType(e)}static isFigureType(e){return e===N.VariableType.FIGURE}static isPandas(e){return e===N.VariableType.PANDAS}}const Du=({children:t})=>w("div",{className:"console-history-item-result",children:[d("div",{className:"console-history-gutter",children:"-"}),d("div",{className:"console-history-content",children:t})]});Du.propTypes={children:R.exports.node.isRequired};class Nu extends S.exports.Component{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}updateElapsed(){this.setState({elapsed:Math.round((Date.now()-this.startTime)/1e3)})}render(){const{disabled:e,onCancelClick:n}=this.props,{elapsed:s}=this.state;return d("div",{className:W("console-history-result-in-progress",{disabled:e}),children:w("span",{className:"badge",children:[d(Ln,{}),"\xA0Running... ",Rn.formatElapsedTime(s),"\xA0",w("button",{type:"button",onClick:n,disabled:e,children:[d(z,{icon:$o}),d(pe,{children:"Cancel"})]})]})})}}Nu.defaultProps={disabled:!1};const ya=class extends S.exports.PureComponent{constructor(t){super(t),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}}handleKeyPress(t){switch(t.key){case"Enter":case" ":this.handleToggleError(),t.stopPropagation(),t.preventDefault();break}}handleMouseDown(t){this.mouseX=t.clientX,this.mouseY=t.clientY,this.isClicking=!0}handleMouseMove(t){this.mouseX!=null&&this.mouseY!=null?(Math.abs(t.clientX-this.mouseX)>=ya.mouseDragThreshold||Math.abs(t.clientY-this.mouseY)>=ya.mouseDragThreshold)&&(this.isClicking=!1):this.isClicking&&(this.isClicking=!1)}handleMouseUp(t){this.isClicking&&!t.shiftKey&&!t.metaKey&&!t.altKey&&this.handleToggleError(),this.mouseX=null,this.mouseY=null,this.isClicking=!1}handleToggleError(){this.setState(t=>({isExpanded:!t.isExpanded}))}handleMouseEnter(){this.setState({isTriggerHovered:!0})}handleMouseLeave(){this.setState({isTriggerHovered:!1})}render(){const{isExpanded:t,isTriggerHovered:e}=this.state,{message:n}=this.props;A(n);const s=n.indexOf(`
6
+ `),i=s>-1;let o=n;i&&(o=n.slice(0,s));const r=n.slice(s),l=e?"error-btn-link error-btn-link--active":"error-btn-link";return w("div",{className:W("error-message",{expanded:t}),children:[i&&w(ue,{children:[d("div",{className:"error-gutter",children:d("button",{type:"button",onClick:this.handleToggleError,className:l,tabIndex:-1,children:d(z,{icon:t?cs:eu,transform:"left-3"})})}),w("div",{className:"error-content",children:[d("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}),t?r:""]})]}),!i&&d("div",{className:"error-content",children:d("div",{className:"console-error-text",children:o})})]},"error")}};let lc=ya;lc.defaultProps={message:""};lc.mouseDragThreshold=5;const Rd=X.module("ConsoleHistoryItem");class Mu extends S.exports.PureComponent{constructor(e){super(e),this.handleCancelClick=this.handleCancelClick.bind(this),this.handleObjectClick=this.handleObjectClick.bind(this)}handleObjectClick(e){Rd.debug("handleObjectClick",e);const{openObject:n}=this.props;n(e)}handleCancelClick(){const{item:e}=this.props;e!=null&&e.cancelResult&&(Rd.debug(`Cancelling command: ${e.command}`),e.cancelResult())}render(){var c;const{disabled:e,item:n,language:s}=this.props,{disabledObjects:i,result:o}=n;let r=null;n.command!=null&&n.command!==""&&(r=w("div",{className:"console-history-item-command",children:[d("div",{className:"console-history-gutter",children:">"}),d("div",{className:"console-history-content",children:d(fl,{language:s,children:n.command})})]}));const l=[];if(o){const{error:h,message:u,changes:m}=o;if(m){const{created:p,updated:g}=m;[...p,...g].forEach(f=>{const{title:b}=f,C=`${b}`,v=e===void 0||e||(i!=null?i:[]).indexOf(C)>=0,T=w(zi,{onClick:()=>this.handleObjectClick(f),className:"btn-primary btn-console btn-console-object",disabled:v,children:[d(Iu,{type:f.type})," ",b]},C);l.push(T)})}if(h!=null&&n.command==null){let p=`${(c=h.message)!=null?c:h}`;p||(p=h);const g=d(lc,{message:p},"result-error");l.push(g)}if(u!==void 0&&u!==""){const p=d("div",{className:"log-message",children:u},"log-message");l.push(p)}}else{const h=d(Nu,{onCancelClick:this.handleCancelClick,disabled:e},"in_progress");l.push(h)}let a=null;return l.length>0&&(a=d(Du,{children:l})),w("div",{className:"container-fluid",children:[r,a]})}}Mu.defaultProps={disabled:!1};const Fu=class extends S.exports.Component{static itemKey(t,e){return`${t}.${e.command}.${e.result&&e.result.message}.${e.result&&e.result.error}`}render(){const{disabled:t,items:e,language:n,openObject:s}=this.props,i=[];for(let o=0;o<e.length;o+=1){const r=e[o],l=d(Mu,{disabled:t,item:r,openObject:s,language:n},Fu.itemKey(o,r));i.push(l)}return d("div",{className:"container-fluid console-history",children:i})}};let xu=Fu;xu.defaultProps={disabled:!1};const RC={name:"Console",CLEAR:ze.createAndAdd({id:"CONSOLE.CLEAR",name:"Clear",shortcut:[me.CTRL,fe.L],macShortcut:[me.CTRL,fe.C]}),FOCUS_HISTORY:ze.createAndAdd({id:"CONSOLE.FOCUS_HISTORY",name:"Focus History",shortcut:[me.CTRL,fe.H],macShortcut:[me.CTRL,me.OPTION,fe.H]})},DC={name:"Command History",FOCUS_HISTORY:ze.createAndAdd({id:"COMMAND_HISTORY.FOCUS_HISTORY",name:"Focus History Search",shortcut:[me.CTRL,fe.H],macShortcut:[me.CTRL,me.OPTION,fe.H]}),SEND_TO_CONSOLE:ze.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_CONSOLE",name:"Send to Console",shortcut:[fe.ENTER],macShortcut:[fe.ENTER]}),SEND_TO_NOTEBOOK:ze.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_NOTEBOOK",name:"Send to Notebook",shortcut:[me.CTRL,fe.ENTER],macShortcut:[me.CMD,fe.ENTER]}),RUN:ze.createAndAdd({id:"COMMAND_HISTORY.RUN",name:"Run",shortcut:[me.ALT,fe.R],macShortcut:[me.OPTION,fe.R]})},NC={name:"Notebook",RUN:ze.createAndAdd({id:"NOTEBOOK.RUN",name:"Run",shortcut:[me.ALT,fe.R],macShortcut:[me.OPTION,fe.R]}),RUN_SELECTED:ze.createAndAdd({id:"NOTEBOOK.RUN_SELECTED",name:"Run Selected",shortcut:[me.ALT,me.SHIFT,fe.R],macShortcut:[me.OPTION,me.SHIFT,fe.R]}),FIND:ze.createAndAdd({id:"NOTEBOOK.FIND",name:"Find",shortcut:[me.CTRL,fe.F],macShortcut:[me.CMD,fe.F],isEditable:!1})},Fn={CONSOLE:RC,COMMAND_HISTORY:DC,NOTEBOOK:NC},Tt=Object.freeze({FATAL:"FATAL",STDERR:"STDERR",ERROR:"ERROR",WARN:"WARN",STDOUT:"STDOUT",INFO:"INFO",DEBUG:"DEBUG",TRACE:"TRACE"}),MC="#2d2a2e",FC="#fcfcfa",xC="#fcd65b",_C="#b2b1b2",LC="#9edc6f",kC="#76d9e4",OC="#f95d84",AC="#aa9af4",PC="#f95d84",HC="#fcfcfa",VC="#7c7b7c",Ee={"error-foreground":"#f95d84",background:MC,foreground:FC,"line-height":"19px",string:xC,"string-delim":"#929192",delimiter:_C,predefined:LC,keyword:kC,storage:OC,number:AC,operator:PC,identifier:HC,"namespace-identifier":"#f95d84","identifier-js":"#fcd65b",comment:VC,"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"},UC="python",BC={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:new RegExp("^\\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\\s*$"),action:{indentAction:1}}],folding:{offSide:!0,markers:{start:new RegExp("^\\s*#region\\b"),end:new RegExp("^\\s*#endregion\\b")}}},$C={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"]]}},WC={id:UC,conf:BC,language:$C},zC="groovy",GC={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:new RegExp("^\\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\\s*$"),action:{indentAction:1}}],folding:{offSide:!0,markers:{start:new RegExp("^\\s*#region\\b"),end:new RegExp("^\\s*#endregion\\b")}}},KC={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"]]}},qC={id:zC,conf:GC,language:KC},YC="scala",XC={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:new RegExp("^\\s*//\\s*(?:(?:#?region\\b)|(?:<editor-fold\\b))"),end:new RegExp("^\\s*//\\s*(?:(?:#?endregion\\b)|(?:</editor-fold>))")}}},jC={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"]]}},QC={id:YC,conf:XC,language:jC},ZC="deephavenDb",JC={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:new RegExp("^\\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\\s*$"),action:{indentAction:1}}],folding:{offSide:!0,markers:{start:new RegExp("^\\s*#region\\b"),end:new RegExp("^\\s*#endregion\\b")}}},eb={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"]]}},tb={id:ZC,conf:JC,language:eb},nb="log",sb={},ib={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"}]]}},ob={id:nb,conf:sb,language:ib},Pn=X.module("MonacoUtils");window.MonacoEnvironment={getWorker(){return new Qp}};class dt{static init(){Pn.debug("Initializing Monaco...");const{registerLanguages:e,removeHashtag:n}=dt,s=[{token:"",foreground:n(Ee.foreground)},{token:"string",foreground:n(Ee.string)},{token:"string.delim",foreground:n(Ee["string-delim"])},{token:"keyword",foreground:n(Ee.keyword)},{token:"identifier.js",foreground:n(Ee["identifier-js"])},{token:"delimiter",foreground:n(Ee.delimiter)},{token:"comment",foreground:n(Ee.comment)},{token:"number",foreground:n(Ee.number)},{token:"storage",foreground:n(Ee.storage)},{token:"identifier",foreground:n(Ee.identifier)},{token:"namespace.identifier",foreground:n(Ee["namespace-identifier"])},{token:"operator",foreground:n(Ee.operator)},{token:"predefined",foreground:n(Ee.predefined)},{token:"error.log",foreground:Ee["log-error"].substring(1)},{token:"warn.log",foreground:n(Ee["log-warn"])},{token:"info.log",foreground:n(Ee["log-info"])},{token:"stdout.log",foreground:n(Ee["log-stdout"])},{token:"trace.log",foreground:n(Ee["log-trace"])},{token:"debug.log",foreground:n(Ee["log-debug"])},{token:"date.log",foreground:n(Ee["log-date"])}],i={errorForeground:Ee["error-foreground"],"inputOption.activeBorder":Ee["input-option-active-border"],"editor.background":Ee.background,"editor.foreground":Ee.foreground,"editor.lineHighlightBackground":Ee["editor-line-highlight-bg"],"editorLineNumber.foreground":Ee["editor-line-number-foreground"],"editor.selectionBackground":Ee["editor-selection-background"],"editor.findMatchBackground":Ee["editor-find-match-background"],"editor.findMatchHighlightBackground":Ee["editor-find-match-highlight-background"],"editorSuggestWidget.background":Ee["editor-suggest-widget-background"],"editorSuggestWidget.border":Ee["editor-suggest-widget-border"],"editorSuggestWidget.foreground":Ee["editor-suggest-widget-foreground"],"editorSuggestWidget.selectedBackground":Ee["editor-suggest-widget-selected-background"],"editorSuggestWidget.highlightForeground":Ee["editor-suggest-widget-highlightForeground"],"list.hoverBackground":Ee["list-hover-background"],"dropdown.background":Ee["context-menu-background"],"dropdown.foreground":Ee["context-menu-foreground"],"menu.selectionBackground":Ee["menu-selection-background"],"list.focusBackground":Ee["menu-selection-background"],"editorWidget.background":Ee["editor-widget-background"],"inputOption.activeBackground":Ee["input-option-active-background"],"inputOption.activeForeground":Ee["input-option-active-foreground"],focusBorder:Ee["focus-border"],"input.background":Ee["input-background"],"input.foreground":Ee["input-foreground"],"input.border":Ee["input-border"]};ds.defineTheme("dh-dark",{base:"vs-dark",inherit:!0,rules:s,colors:i}),Pn.debug2("monaco theme: ",Ee),ds.setTheme("dh-dark"),e([tb,WC,qC,ob,QC]),Pn.debug("Monaco initialized.")}static removeHashtag(e){return e.substring(1)}static registerLanguages(e){const n=e.map(({id:s})=>s);Fi.getLanguages().filter(({id:s})=>n.includes(s)).forEach(s=>{const i=s;Pn.debug2("Overriding default language loader:",i.id)}),e.forEach(s=>{dt.registerLanguage(s)})}static registerLanguage(e){Pn.debug2("Registering language: ",e.id),Fi.register(e),Fi.onLanguage(e.id,()=>{Fi.setLanguageConfiguration(e.id,e.conf),Fi.setMonarchTokensProvider(e.id,e.language)})}static setEOL(e,n=ds.EndOfLineSequence.LF){var s;(s=e.getModel())==null||s.setEOL(n)}static openDocument(e,n){const s=e.getModel();A(s);const i={textDocument:{uri:`${s.uri}`,languageId:s.getLanguageId(),version:s.getVersionId(),text:s.getValue()}};return Pn.debug2("didOpenDocumentParams: ",i),n.openDocument(i),e.onDidChangeModelContent(r=>{const{changes:l,versionId:a}=r,c=[];for(let h=0;h<l.length;h+=1){const u=l[h],{range:m,rangeLength:p,text:g}=u,f={range:{start:{line:m.startLineNumber-1,character:m.startColumn-1},end:{line:m.endLineNumber-1,character:m.endColumn-1}},rangeLength:p,text:g};c.push(f)}if(c.length>0){const h={textDocument:{version:a,uri:`${s.uri}`},contentChanges:c};Pn.debug2("didChangeDocumentParams",h),n.changeDocument(h)}})}static closeDocument(e,n){const s=e.getModel();A(s);const i={textDocument:{uri:`${s.uri}`}};n.closeDocument(i)}static registerPasteHandler(e){e.onDidPaste(n=>{const s=/“|”/g,i=/\u200b/g,o=e.getModel();A(o);const r=o.getValueInRange(n.range);(s.test(r)||i.test(r))&&o.applyEdits([{range:n.range,text:r.replace(s,'"').replace(i,"")}])})}static isMacPlatform(){const{platform:e}=window.navigator;return e.startsWith("Mac")}static removeConflictingKeybindings(e){const n=[{windows:"ctrl+D",mac:"meta+D"},{windows:"ctrl+H"}];try{n.forEach(s=>{dt.isMacPlatform()&&s.mac===""||!dt.isMacPlatform()&&s.windows===""||dt.removeKeybinding(e,dt.isMacPlatform()?s.mac:s.windows)})}catch(s){Pn.error(s)}}static removeKeybinding(e,n){if(n===void 0)return;const s=e._standaloneKeybindingService._getResolver()._map.get(n);s!=null?s.forEach(i=>{Pn.debug2(`Removing Monaco keybinding ${n} for ${i.command}`),e._standaloneKeybindingService.addDynamicKeybinding(`-${i.command}`,null,()=>{})}):Pn.warn(`Did not find any keybindings to remove for ${n}`)}static getMonacoKeyCodeFromShortcut(e){const{keyState:n}=e,{keyValue:s}=n;return s===null?0:dt.isMacPlatform()?(n.metaKey?bn.CtrlCmd:0)|(n.shiftKey?bn.Shift:0)|(n.altKey?bn.Alt:0)|(n.ctrlKey?bn.WinCtrl:0)|ld.fromString(s):(n.ctrlKey?bn.CtrlCmd:0)|(n.shiftKey?bn.Shift:0)|(n.altKey?bn.Alt:0)|(n.metaKey?bn.WinCtrl:0)|ld.fromString(s)}}const Dd=X.module("MonacoCompletionProvider");class _u extends S.exports.PureComponent{constructor(e){super(e),this.handleCompletionRequest=this.handleCompletionRequest.bind(this)}componentDidMount(){const{language:e}=this.props;this.registeredCompletionProvider=Fi.registerCompletionItemProvider(e!=null?e:"",{provideCompletionItems:this.handleCompletionRequest,triggerCharacters:['"',".","'","(","[","{",","]})}componentWillUnmount(){var e;(e=this.registeredCompletionProvider)==null||e.dispose()}handleCompletionRequest(e,n,s){const{model:i,session:o}=this.props;if(e!==i)return null;const r={textDocument:{uri:`${e.uri}`},position:{line:n.lineNumber-1,character:n.column-1},context:s},l=o.getCompletionItems(r);return Dd.debug("Completion items received: ",r,l),l.then(c=>{const h=c.map(u=>{const{label:m,kind:p,detail:g,documentation:f,sortText:b,filterText:C,textEdit:v,insertTextFormat:T}=u,{start:E,end:y}=v.range,I={startLineNumber:E.line+1,startColumn:E.character+1,endLineNumber:y.line+1,endColumn:y.character+1};return{label:m,kind:p,detail:g,documentation:f,sortText:b,filterText:C,insertText:v.text,insertTextRules:T===2?4:T,range:I}});return{incomplete:!0,suggestions:h}}).catch(c=>(Dd.error("There was an error retrieving completion items",c),{suggestions:[]}))}render(){return null}}const ea=X.module("ConsoleInput"),Wr=parseInt(Ee["line-height"],10),Lu=6,ku=6,rb=Wr+Lu+ku,ta=100,Ou=class extends S.exports.PureComponent{constructor(t){super(t),this.handleWindowResize=this.handleWindowResize.bind(this),this.commandContainer=Y.createRef(),this.commandHistoryIndex=null,this.timestamp=Date.now(),this.bufferIndex=0,this.history=[],this.modifiedCommands=new Map,this.state={commandEditorHeight:Wr,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()}setConsoleText(t,e=!0,n=!1){var s;!t||(ea.debug("Command received: ",t),this.commandHistoryIndex=null,(s=this.commandEditor)==null||s.setValue(t),e&&this.focusEnd(),this.updateDimensions(),n&&this.processCommand())}initCommandEditor(){const{language:t,session:e}=this.props,n={copyWithSyntaxHighlighting:!1,cursorStyle:"block",fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:t,lineHeight:Wr,lineDecorationsWidth:3,lineNumbers:"off",minimap:{enabled:!1},renderLineHighlight:"none",scrollBeyondLastLine:!1,scrollbar:{arrowSize:0,horizontal:"hidden",horizontalScrollbarSize:0},padding:{top:Lu,bottom:ku},tabCompletion:"on",value:"",wordWrap:"on"},s=this.commandContainer.current;A(s),this.commandEditor=ds.create(s,n),dt.setEOL(this.commandEditor),dt.openDocument(this.commandEditor,e),this.commandEditor.onDidChangeModelContent(()=>{var o;const i=(o=this.commandEditor)==null?void 0:o.getValue();this.modifiedCommands.set(this.commandHistoryIndex,i!=null?i:null),this.updateDimensions()}),this.commandEditor.onDidFocusEditorText(()=>{this.setState({isFocused:!0})}),this.commandEditor.onDidBlurEditorText(()=>{this.setState({isFocused:!1})}),this.commandEditor.onKeyDown(i=>{var h;const{commandEditor:o,commandHistoryIndex:r}=this,l=o==null?void 0:o.getPosition();A(l);const{lineNumber:a}=l,c=o==null?void 0:o.getModel();if(i.keyCode===$n.UpArrow&&!this.isSuggestionMenuPopulated()&&a===1){r!=null?this.loadCommand(r+1):this.loadCommand(0),this.focusStart(),i.stopPropagation(),i.preventDefault();return}if(i.keyCode===$n.DownArrow&&!this.isSuggestionMenuPopulated()&&a===(c==null?void 0:c.getLineCount())){r!=null&&r>0?this.loadCommand(r-1):this.loadCommand(null),this.focusEnd(),i.stopPropagation(),i.preventDefault();return}!i.altKey&&!i.shiftKey&&!i.metaKey&&(i.keyCode===$n.Enter?this.isSuggestionMenuPopulated()||(i.stopPropagation(),i.preventDefault(),this.processCommand()):i.keyCode===$n.Tab&&(this.isSuggestionMenuActive()?this.isSuggestionMenuPopulated()||(i.stopPropagation(),i.preventDefault()):(i.stopPropagation(),i.preventDefault(),(h=this.commandEditor)==null||h.trigger("Tab key trigger suggestions","editor.action.triggerSuggest",{}))))}),this.commandEditor.addCommand(bn.CtrlCmd|$n.KeyF,()=>{}),dt.removeConflictingKeybindings(this.commandEditor),dt.registerPasteHandler(this.commandEditor),this.commandEditor.focus(),this.updateDimensions(),this.setState({model:this.commandEditor.getModel()})}destroyCommandEditor(){const{session:t}=this.props;this.commandEditor&&(dt.closeDocument(this.commandEditor,t),this.commandEditor.dispose(),this.commandEditor=void 0)}handleWindowResize(){this.updateDimensions()}isSuggestionMenuActive(){var t,e,n;return this.commandSuggestionContainer||(this.commandSuggestionContainer=(e=(t=this.commandEditor)==null?void 0:t.getDomNode())==null?void 0:e.querySelector(".suggest-widget")),(n=this.commandSuggestionContainer&&this.commandSuggestionContainer.classList.contains("visible"))!=null?n:!1}isSuggestionMenuPopulated(){var t,e,n;return this.isSuggestionMenuActive()&&((n=(e=(t=this.commandSuggestionContainer)==null?void 0:t.querySelector(".monaco-list-rows"))==null?void 0:e.childElementCount)!=null?n:0)>0}focus(){var t;(t=this.commandEditor)==null||t.focus()}focusStart(){var s,i,o,r,l;const t=(s=this.commandEditor)==null?void 0:s.getModel();A(t);const e=t.getLineLength(1)+1,n=(i=this.commandEditor)==null?void 0:i.getTopForPosition(1,e);A(n),(o=this.commandEditor)==null||o.setPosition({lineNumber:1,column:e}),(r=this.commandEditor)==null||r.setScrollTop(n),(l=this.commandEditor)==null||l.focus()}focusEnd(){var i,o,r,l,a;const t=(i=this.commandEditor)==null?void 0:i.getModel();A(t);const e=t.getLineCount(),n=t.getLineLength(e)+1,s=(o=this.commandEditor)==null?void 0:o.getTopForPosition(e,n);A(s),(r=this.commandEditor)==null||r.setPosition({lineNumber:e,column:n}),(l=this.commandEditor)==null||l.setScrollTop(s),(a=this.commandEditor)==null||a.focus()}clear(){var t,e,n;(t=this.commandEditor)==null||t.focus(),(n=(e=this.commandEditor)==null?void 0:e.getModel())==null||n.setValue(""),this.commandHistoryIndex=null}layoutEditor(){this.commandEditor&&this.commandEditor.layout()}loadCommand(t){var s,i;if(t===null||t>=this.history.length)return;const e=this.modifiedCommands.get(t),n=t===null?"":this.history[this.history.length-t-1];this.commandHistoryIndex=t,(i=(s=this.commandEditor)==null?void 0:s.getModel())==null||i.setValue(e!=null?e:n),t!==null&&t>this.history.length-ta&&this.loadMoreHistory()}async loadMoreHistory(){try{if(this.loadingPromise!=null||this.bufferIndex==null)return;const{commandHistoryStorage:t,language:e,scope:n}=this.props;this.loadingPromise=Re.makeCancelable(t.getTable(e,n!=null?n:"",this.timestamp),o=>o.close());const s=await this.loadingPromise;s.setReversed(!0),s.setViewport({top:this.bufferIndex,bottom:this.bufferIndex+ta-1}),this.loadingPromise=Re.makeCancelable(s.getViewportData(),()=>s.close());const i=await this.loadingPromise;this.bufferIndex+=ta,this.bufferIndex>=s.size&&(this.bufferIndex=null),this.history=[...i==null?void 0:i.items.filter(({name:o},r,l)=>r===0||o!==l[r-1].name).map(({name:o})=>o).reverse(),...this.history],this.loadingPromise=void 0,s.close()}catch(t){if(this.loadingPromise=void 0,Re.isCanceled(t)){ea.debug2("Promise canceled, not loading history");return}ea.error("Error fetching history",t)}}processCommand(){var n,s;this.commandHistoryIndex=null,this.modifiedCommands.clear();const t=(n=this.commandEditor)==null?void 0:n.getValue().trim();A(t),t!==""&&(this.history.length===0||t!==this.history[this.history.length-1])&&this.history.push(t),(s=this.commandEditor)==null||s.setValue(""),this.updateDimensions();const{onSubmit:e}=this.props;e(t)}updateDimensions(){if(!this.commandEditor)return;const{maxHeight:t}=this.props;A(t);const e=this.commandEditor.getContentHeight(),n=Math.max(Math.min(e,t),rb),i={overviewRulerLanes:e>n?void 0:0};this.setState({commandEditorHeight:n},()=>{var o,r;(o=this.commandEditor)==null||o.updateOptions(i),(r=this.commandEditor)==null||r.layout()})}render(){const{disabled:t,language:e,session:n}=this.props,{commandEditorHeight:s,isFocused:i,model:o}=this.state;return d("div",{className:W("console-input-wrapper",{disabled:t}),children:w("div",{className:W("console-input-inner-wrapper",{focus:i}),children:[d("div",{className:Ou.INPUT_CLASS_NAME,ref:this.commandContainer,style:{height:s}}),o&&d(_u,{model:o,language:e,session:n})]})})}};let zr=Ou;zr.defaultProps={maxHeight:Wr*10,scope:null,disabled:!1};zr.INPUT_CLASS_NAME="console-input";const Nd="pasted values",lb=[/^audio.*/,/^font.*/,/^image.*/,/^video.*/],na=[".csv",".tsv",".tab",".psv",".dsv",".txt"],Md=[".zip"],xi=class extends S.exports.Component{constructor(t){super(t),this.getValidExtensions=Ce(e=>e?[...na,...Md]:[...na]),this.getAcceptString=Ce(e=>this.getValidExtensions(e).join(", ")),this.getFileTypeErrorString=Ce(e=>on.join(this.getValidExtensions(e),"or")),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=Y.createRef(),this.divElem=Y.createRef(),this.state={selectedFileName:""}}static isValidDropItem(t){return t!=null&&t.kind==="file"&&!lb.find(e=>e.test(t.type))}static isValidExtension(t,e=!1){return na.some(n=>t.endsWith(n))||e&&Md.some(n=>t.endsWith(n))}static handleDragOver(t){t.preventDefault(),t.stopPropagation()}static getIcon(t){return t===Nd?hd:t.endsWith(".csv")?wf:t.endsWith(".zip")?Xg:Ef}componentDidMount(){var t,e;(t=this.divElem.current)==null||t.addEventListener("paste",this.handlePasteEvent),(e=this.divElem.current)==null||e.focus()}componentWillUnmount(){var t;(t=this.divElem.current)==null||t.removeEventListener("paste",this.handlePasteEvent)}handleSelectFile(){var t;this.fileElem.current&&(this.fileElem.current.value="",(t=this.fileElem.current)==null||t.click())}handleFiles(t){t.stopPropagation(),t.preventDefault();const{files:e}=t.target;e!=null&&this.handleFile(e[0])}handleDrop(t){const{allowZip:e,clearDragError:n,dragError:s}=this.props;if(t.preventDefault(),t.stopPropagation(),s!=null){n();return}if(t.dataTransfer==null||t.dataTransfer.items==null||t.dataTransfer.items.length===0)return;const i=t.dataTransfer.items[0].getAsFile();A(i),xi.isValidExtension(i.name,e)?this.handleFile(i):this.setState({dropError:xi.FILE_TYPE_ERROR})}unstageFile(t){const{onCancel:e}=this.props;t.stopPropagation(),t.preventDefault(),e(),this.setState({selectedFileName:"",dropError:void 0})}handleFile(t){const{onFileOpened:e}=this.props;e(t),this.setState({selectedFileName:t.name,dropError:void 0})}handleMenuPaste(){const{onPaste:t,onError:e,uploadInProgress:n}=this.props;n||navigator.clipboard.readText().then(s=>{t(s),this.setState({selectedFileName:Nd,dropError:void 0})}).catch(s=>e(s))}handlePasteEvent(t){t.stopPropagation(),t.preventDefault(),this.handleMenuPaste()}makeContextMenuItems(){const{uploadInProgress:t}=this.props;return[{title:"Paste",icon:hd,action:this.handleMenuPaste,shortcut:Os.PASTE,disabled:t}]}render(){const{allowZip:t,dragError:e,uploadInProgress:n}=this.props,{selectedFileName:s,dropError:i}=this.state,o=e!=null?e:i,r=this.makeContextMenuItems();return w("div",{ref:this.divElem,className:"csv-overlay fill-parent-absolute",onDragOver:xi.handleDragOver,onDrop:this.handleDrop,tabIndex:-1,children:[d(ie,{actions:r}),d("input",{ref:this.fileElem,type:"file",id:"fileElem",accept:this.getAcceptString(t),style:{display:"none"},onChange:this.handleFiles,"data-testid":"fileElem"}),!s&&(o===void 0||o==="")&&w("div",{className:"message-content",children:[d("div",{className:"message-icon",children:d(z,{icon:vf})}),d("label",{children:"Drop file (or paste values) here to import"}),d("div",{className:"message-small",children:d("label",{children:"or"})}),d("button",{type:"button",className:"btn btn-primary",onClick:this.handleSelectFile,children:"Select File..."})]}),s&&(o===void 0||o==="")&&w("div",{className:"selected-content",children:[d("div",{className:"selected-icon",children:d(z,{icon:xi.getIcon(s)})}),w("div",{className:"selected-text",children:[d("label",{children:"Selected File"}),w("label",{className:"selected-name",children:[s,!n&&d("button",{type:"button",className:"btn btn-link btn-link-icon ml-2",onClick:this.unstageFile,children:d(z,{icon:_n})})]})]})]}),Boolean(o)&&w("div",{className:"message-content",children:[d("div",{className:"message-icon",children:d(z,{icon:hs})}),d("label",{children:o}),o===xi.FILE_TYPE_ERROR&&d("div",{className:"message-small",children:d("label",{children:this.getFileTypeErrorString(t)})})]})]})}};let as=xi;as.defaultProps={allowZip:!1,dragError:null};as.MULTIPLE_FILE_ERROR="Please select only one file";as.FILE_TYPE_ERROR="Filetype not supported.";class Me{}Me.INTEGER="int";Me.LONG="long";Me.DOUBLE="double";Me.BOOLEAN="bool";Me.STRING="string";Me.DATE_TIME="datetime";Me.LOCAL_TIME="localtime";const Fd="unknown",ab=2147483647,cb=-2147483648,xd=/^[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]+)?$/,_d=/^([0-9]+T)?([0-9]+):([0-9]+)(:[0-9]+)?(?:\.[0-9]{1,9})?$/;class Ft{static determineType(e,n,s){if(!e||e===s)return n;switch(n){case Me.STRING:return Me.STRING;case Me.INTEGER:return Ft.checkInteger(e);case Me.LONG:return Ft.checkLong(e);case Me.DOUBLE:return Ft.checkDouble(e);case Me.BOOLEAN:return Ft.checkBoolean(e);case Me.DATE_TIME:return Ft.checkDateTime(e);case Me.LOCAL_TIME:return Ft.checkLocalTime(e);default:return Ft.getTypeFromUnknown(e)}}static isNotParsableNumber(e){return isNaN(e)||e==="Infinity"||e==="-Infinity"}static checkInteger(e){const n=e.replace(/,/g,"");return Ft.isNotParsableNumber(n)?Me.STRING:Ft.getNumberType(n)}static checkLong(e){const n=e.replace(/,/g,"");return Ft.isNotParsableNumber(n)?Me.STRING:n.includes(".")?Me.DOUBLE:Me.LONG}static checkDouble(e){const n=e.replace(/,/g,"");return Ft.isNotParsableNumber(n)?Me.STRING:Me.DOUBLE}static checkBoolean(e){const n=e.toLowerCase();return n==="true"||n==="false"?Me.BOOLEAN:Me.STRING}static checkDateTime(e){return xd.test(e)?Me.DATE_TIME:Me.STRING}static checkLocalTime(e){return _d.test(e)?Me.LOCAL_TIME:Me.STRING}static getTypeFromUnknown(e){const n=e.replace(/,/g,"");if(Ft.isNotParsableNumber(n)){const s=e.toLowerCase();return s==="true"||s==="false"?Me.BOOLEAN:xd.test(e)&&e.includes(":")?Me.DATE_TIME:_d.test(e)?Me.LOCAL_TIME:Me.STRING}return Ft.getNumberType(n)}static getNumberType(e){if(e.includes("."))return Me.DOUBLE;const n=e.startsWith("-")?11:10;if(e.length>n)return Me.LONG;const s=parseInt(e,10);return s>ab||s<cb?Me.LONG:Me.INTEGER}constructor(e,n,s,i,o,r,l,a,c,h){this.onFileCompleted=e,this.file=n,this.readHeaders=s,this.nullString=o,this.onProgress=r,this.onError=l,this.chunks=0,this.totalChunks=a,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={...i,error:this.handleError,chunk:this.handleChunk,complete:this.handleComplete}}parse(){const e=this.isZip?this.file.nodeStream("nodebuffer",this.handleNodeUpdate):this.file;Ca.parse(e,this.config)}handleChunk(e,n){let{data:s}=e;if(!this.types){if(s==null||s.length===0){n.abort(),this.onError("Error parsing CSV: no data in file.");return}this.types=new Array(s[0].length).fill(Fd),this.readHeaders&&(s=s.slice(1))}A(this.types);const i=[...this.types];s.forEach(l=>{if(l.length>=i.length){for(let a=0;a<i.length;a+=1)i[a]=Ft.determineType(this.shouldTrim?l[a].trim():l[a],i[a],this.nullString);this.types=i}else n.abort(),this.onError(`Error parsing CSV: Insufficient data in row.
7
+ Expected length ${i.length} but found ${l.length}.
8
+ Row = ${l}`)}),this.chunks+=1;let o=0;this.totalChunks>0?o=Math.round(this.chunks/this.totalChunks*50):o=Math.round(this.zipProgress/2),this.onProgress(o)&&n.abort()}handleComplete(e){const{types:n,onFileCompleted:s}=this;A(n),(e==null||!e.meta.aborted)&&s(n.map(i=>i===Fd?Me.STRING:i))}handleError(e){const{onError:n}=this;n(e)}handleNodeUpdate(e){this.zipProgress=e.percent}}const pr=X.module("CsvParser"),db=650,Gr=class{static generateHeaderRecursive(t){let e="",n=t;return t>=26&&(e=e.concat(Gr.generateHeaderRecursive(Math.floor(t/26)-1)),n=t%26),e.concat(String.fromCharCode(65+n))}constructor({onFileCompleted:t,session:e,file:n,type:s,readHeaders:i=!0,onProgress:o,onError:r,timeZone:l,isZip:a}){this.onFileCompleted=t,this.session=e,this.file=n,this.isZip=a,this.type=s,this.readHeaders=i,this.timeZone=l,this.onProgress=o,this.onError=r,this.tables=[],this.chunks=0,this.totalChunks=a?0:Math.ceil(n.size/Ca.LocalChunkSize),this.isComplete=!1,this.zipProgress=0,this.numConsolidated=0,this.isCancelled=!1,this.handleChunk=this.handleChunk.bind(this),this.handleError=this.handleError.bind(this),this.handleComplete=this.handleComplete.bind(this),this.handleNodeUpdate=this.handleNodeUpdate.bind(this),this.handleCreateTable=this.handleCreateTable.bind(this),this.config={delimiter:s.delimiter,newline:s.newline,escapeChar:s.escapeChar,dynamicTyping:!1,error:this.handleError,skipEmptyLines:s.skipEmptyLines,chunk:this.handleChunk,complete:this.handleComplete,fastMode:!1}}cancel(){this.isCancelled=!0}transpose(t,e){const n=e.length,s=new Array(t).fill(null).map(()=>new Array(n));for(let i=0;i<n;i+=1){const o=e[i];if(o.length<t)throw new Error(`Insufficient columns. Expected ${t} but found ${o.length}
9
+ ${o}`);for(let r=0;r<t;r+=1){const l=this.type.shouldTrim?e[i][r].trim():e[i][r];s[r][i]=this.nullCheck(l)}}return s}nullCheck(t){return t===this.type.nullString?"":t}parse(){const t=n=>{const s=this.isZip?this.file.nodeStream("nodebuffer",this.handleNodeUpdate):this.file;this.types=n,Ca.parse(s,this.config)};new Ft(t,this.file,this.readHeaders,this.config,this.type.nullString,this.onProgress,this.onError,this.totalChunks,this.isZip,this.type.shouldTrim).parse()}handleChunk(t,e){const{readHeaders:n,onError:s,handleCreateTable:i,isZip:o,tables:r}=this;if(this.isCancelled){pr.debug2("CSV parser cancelled."),e.abort(),r.forEach(c=>c.close());return}let{data:l}=t;this.headers||(n?(this.headers=ps.legalizeColumnNames(l[0]),l=l.slice(1)):this.headers=Gr.generateHeaders(l[0].length));let a=[];try{if(a=this.transpose(this.headers.length,l),o)this.consolidateChunks(a,e);else{const c=this.chunks;this.chunks+=1,i(c,a,e)}}catch(c){s(c)}}consolidateChunks(t,e){if(!this.consolidatedChunks)this.consolidatedChunks=t.slice();else for(let n=0;n<t.length;n+=1)this.consolidatedChunks[n]=this.consolidatedChunks[n].concat(t[n]);this.numConsolidated+=1,(this.numConsolidated>=db||this.isComplete)&&this.uploadConsolidatedChunks(e)}uploadConsolidatedChunks(t){var i;const{handleCreateTable:e}=this,n=this.chunks;this.chunks+=1;const s=(i=this.consolidatedChunks)==null?void 0:i.slice();this.consolidatedChunks=void 0,this.numConsolidated=0,A(s),e(n,s,t)}handleCreateTable(t,e,n){const{session:s,tables:i,onFileCompleted:o,totalChunks:r,types:l,onProgress:a,onError:c}=this;n&&n.pause(),A(this.headers),A(l),s.newTable(this.headers,l,e,this.timeZone).then(h=>{if(this.isCancelled){pr.debug2("CSV parser cancelled."),n&&n.abort(),i.forEach(m=>m.close());return}n&&n.resume(),i[t]=h;let u=0;r>0?u=Math.round(i.length/r*50)+50:u=Math.round(50+this.zipProgress/2),pr.debug2(`CSV parser progress ${u}`),a(u),this.isComplete&&i.length===this.chunks&&(pr.debug2("CSV parser complete."),o(i))}).catch(h=>{!this.isComplete&&n&&n.abort(),c(h)})}handleComplete(t){(t==null||t.meta.aborted==null)&&(this.isComplete=!0,this.consolidatedChunks&&this.uploadConsolidatedChunks(null))}handleError(t){const{onError:e}=this;e(t)}handleNodeUpdate(t){this.zipProgress=t.percent}};let Au=Gr;Au.generateHeaders=t=>{const e=[];for(let n=0;n<t;n+=1)e.push(Gr.generateHeaderRecursive(n));return e};class _s{static fromExtension(e){return e.endsWith(".csv")?"DEFAULT_CSV":e.endsWith(".tsv")||e.endsWith(".tab")?"TSV":e.endsWith(".psv")?"PIPE_SV":"AUTODETECT"}}_s.DEFAULT_TYPE="DEFAULT_CSV";_s.AUTO="AUTODETECT";_s.TYPES=Object.freeze({DEFAULT_CSV:{name:"Default csv (trimmed)",delimiter:",",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},TSV:{name:"Tab seperated (tsv)",delimiter:" ",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},APACHE_COMMON_CSV:{name:"Apache Common csv",delimiter:",",newline:`\r
10
+ `,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:null},EXCEL_CSV:{name:"Excel csv (strict)",delimiter:",",newline:`\r
11
+ `,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!1,nullString:null},MY_SQL_CSV:{name:"MySQL csv",delimiter:" ",newline:`
12
+ `,escapeChar:"\\",shouldTrim:!0,skipEmptyLines:!1,nullString:"\\N"},RFC4180_CSV:{name:"RFC4180 csv",delimiter:",",newline:`\r
13
+ `,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!1,nullString:null},COLON_SV:{name:": colon sv",delimiter:":",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},SEMI_COLON_SV:{name:"; semi-colon sv",delimiter:";",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},PIPE_SV:{name:"| pipe separated (psv)",delimiter:"|",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},SPACE_SV:{name:'" " space sv',delimiter:" ",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},AUTODETECT:{name:"autodetect",delimiter:void 0,newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"}});const Ld=X.module("CsvInputBar"),hb=Object.entries(_s.TYPES).map(([t,e])=>d("option",{value:t,children:e.name},t));class Pu extends S.exports.Component{constructor(e){super(e),this.handleUpload=this.handleUpload.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleError=this.handleError.bind(this),this.handleTableName=this.handleTableName.bind(this),this.toggleFirstRowHeaders=this.toggleFirstRowHeaders.bind(this),this.handleProgress=this.handleProgress.bind(this),this.handleCancelInProgress=this.handleCancelInProgress.bind(this),this.handleQueryTypeChange=this.handleQueryTypeChange.bind(this),this.inputRef=Y.createRef(),this.state={tableName:"",tableNameSet:!1,isFirstRowHeaders:!0,showProgress:!1,progressValue:0,type:_s.DEFAULT_TYPE,parser:null}}componentDidUpdate(e){var r;const{file:n,paste:s}=this.props,{tableName:i,tableNameSet:o}=this.state;if(!o&&n!=null&&!i){const l=n.name.lastIndexOf("."),a=ps.legalizeTableName(n.name.substring(0,l));this.setState({tableName:a,tableNameSet:!0}),(r=this.inputRef.current)==null||r.focus()}else(n==null&&e.file!=null||s==null&&e.paste!=null)&&this.setState({tableName:"",tableNameSet:!1});s!=null&&s!==""&&!i&&this.inputRef.current&&this.inputRef.current.focus(),n!=null&&n!==e.file?this.setState({type:_s.fromExtension(n.name)}):s!=null&&s!==""&&(e.paste===void 0||e.paste==="")&&this.setState({type:_s.AUTO})}componentWillUnmount(){const{parser:e}=this.state;e&&e.cancel()}handleCancel(){const{onClose:e}=this.props;e()}handleError(e){const{onClose:n,onError:s}=this.props;Ld.error(e),s(e),n()}handleTableName(e){this.setState({tableName:e.target.value,tableNameSet:!0})}toggleFirstRowHeaders(){const{isFirstRowHeaders:e}=this.state;this.setState({isFirstRowHeaders:!e})}handleUpload(e){e.stopPropagation(),e.preventDefault();const{file:n,paste:s}=this.props;n!=null?n.name.endsWith(".zip")?this.handleZipFile(n):this.handleFile(n):s!==void 0&&s!==""&&this.handleFile(new Blob([s],{type:"text/plain"}))}handleFile(e,n=!1){Ld.info(`Starting CSV parser for ${e instanceof File?e.name:"pasted values"} ${n?"":e.size} bytes`);const{session:s,timeZone:i,onInProgress:o}=this.props,{tableName:r,isFirstRowHeaders:l,type:a}=this.state,c=u=>{u.length===1?s.bindTableToVariable(u[0],r).then(()=>this.openTable()).catch(m=>this.handleError(m)):s.mergeTables(u).then(m=>{s.bindTableToVariable(m,r).then(()=>this.openTable()).catch(p=>this.handleError(p)),u.forEach(p=>p.close())}).catch(m=>this.handleError(m))},h=new Au({onFileCompleted:c,session:s,file:e,type:_s.TYPES[a],readHeaders:l,onProgress:this.handleProgress,onError:this.handleError,timeZone:i,isZip:n});h.parse(),this.setState({showProgress:!0,parser:h}),o(!0)}handleZipFile(e){const{onUpdate:n,unzip:s}=this.props;if(s==null){this.handleError(new Error("No support for zip files available."));return}s(e).then(i=>{let o=!1;for(let r=0;r<i.length;r+=1){const l=i[r];if(as.isValidExtension(l.name)){n(`Loading ${l.name} as csv from ${e.name}`),o=!0,this.handleFile(l,!0);break}}if(!o)throw new Error(`No csv file found in ${e.name}`)}).catch(i=>this.handleError(i))}handleProgress(e){const{showProgress:n}=this.state;return n&&this.setState({progressValue:e}),!n}handleCancelInProgress(){const{onInProgress:e}=this.props,{parser:n}=this.state;n&&n.cancel(),this.setState({showProgress:!1,progressValue:0}),e(!1)}openTable(){const{onOpenTable:e,onClose:n}=this.props,{tableName:s}=this.state;e(s),n()}handleQueryTypeChange(e){this.setState({type:e.target.value})}render(){const{file:e,paste:n}=this.props,{tableName:s,isFirstRowHeaders:i,showProgress:o,progressValue:r,type:l}=this.state,a=Boolean(n)&&!s;return w("div",{className:"csv-input-bar",children:[!o&&w("form",{onSubmit:this.handleUpload,className:"csv-input-bar-container form-inline",children:[w("div",{className:"form-group",children:[d("label",{htmlFor:"tableNameInput",children:"Table name"}),d("input",{ref:this.inputRef,id:"tableNameInput",type:"text",className:W("form-control",{"is-invalid":a}),value:s,onChange:this.handleTableName})]}),w("div",{className:"form-group",children:[d("label",{htmlFor:"formatSelect",children:"File format"}),d("select",{id:"formatSelect",className:"custom-select",value:l,onChange:this.handleQueryTypeChange,children:hb})]}),d(Ut,{className:"firstRowHeaders",checked:i,onChange:this.toggleFirstRowHeaders,children:"First row is column headers"}),w("div",{className:"csv-input-buttons form-group",children:[d(ce,{kind:"secondary",onClick:this.handleCancel,children:"Cancel"}),d(ce,{kind:"primary",type:"submit",disabled:!(e!==null||n!==void 0&&n!=="")||!s,children:"Upload"})]})]}),o&&w("div",{className:"csv-progress-container",children:[d("label",{children:"Uploading Table"}),d("div",{className:"progress",children:d("div",{className:"progress-bar bg-primary",style:{width:`${r}%`},"aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100})}),w("label",{children:[r,"%"]}),d("button",{type:"button",className:"btn btn-primary",onClick:this.handleCancelInProgress,children:"Cancel"})]})]})}}Pu.defaultProps={file:null,paste:null,unzip:null};const kd=X.module("ConsoleMenu");class Kr extends S.exports.PureComponent{constructor(e){super(e),this.makeTableActions=Ce((n,s,i)=>{const o=n.filter(r=>Gi.isTableType(r.type));return Kr.makeItemActions(o,s,r=>{this.tableSearchField=r},this.handleTableFilterChange,i)}),this.makeWidgetActions=Ce((n,s,i)=>{const o=n.filter(r=>Gi.isWidgetType(r.type));return Kr.makeItemActions(o,s,r=>{this.widgetSearchField=r},this.handleWidgetFilterChange,i)}),this.handleTableFilterChange=this.handleTableFilterChange.bind(this),this.handleTableMenuClosed=this.handleTableMenuClosed.bind(this),this.handleTableMenuOpened=this.handleTableMenuOpened.bind(this),this.handleWidgetFilterChange=this.handleWidgetFilterChange.bind(this),this.handleWidgetMenuClosed=this.handleWidgetMenuClosed.bind(this),this.handleWidgetMenuOpened=this.handleWidgetMenuOpened.bind(this),this.state={tableFilterText:"",widgetFilterText:""}}static makeItemActions(e,n,s,i,o){if(e.length===0)return[];const r={menuElement:d(fs,{value:n,onChange:i,className:"console-menu",ref:s})};let l=e;n&&(l=l.filter(({title:c})=>c!=null&&c.toLowerCase().indexOf(n.toLowerCase())>=0));const a=l.map(c=>({title:c.title,action:()=>{o(c)}}));return[r,...a]}handleTableFilterChange(e){kd.debug("filtering tables..."),this.setState({tableFilterText:e.target.value})}handleTableMenuClosed(){this.setState({tableFilterText:""})}handleTableMenuOpened(){var e;(e=this.tableSearchField)==null||e.focus()}handleWidgetFilterChange(e){kd.debug("filtering widgets..."),this.setState({widgetFilterText:e.target.value})}handleWidgetMenuClosed(){this.setState({widgetFilterText:""})}handleWidgetMenuOpened(){var e;(e=this.widgetSearchField)==null||e.focus()}render(){const{overflowActions:e,objects:n,openObject:s}=this.props,{tableFilterText:i,widgetFilterText:o}=this.state,r=this.makeTableActions(n,i,s),l=this.makeWidgetActions(n,o,s),a={placement:"bottom-end"};return w("div",{className:"console-pane-menu",children:[w("button",{type:"button",className:"btn btn-link btn-link-icon",disabled:r.length===0,children:[w("div",{className:"fa-md fa-layers",children:[d(z,{mask:sc,icon:cs,transform:"right-5 down-5"}),d(z,{icon:cs,transform:"right-8 down-6"})]}),d(pe,{children:"Tables"}),d(zn,{actions:r,onMenuOpened:this.handleTableMenuOpened,onMenuClosed:this.handleTableMenuClosed,options:{initialKeyboardIndex:1},popperOptions:a},"table-actions ")]}),w("button",{type:"button",className:"btn btn-link btn-link-icon",disabled:l.length===0,children:[w("div",{className:"fa-md fa-layers",children:[d(z,{mask:Yh,icon:cs,transform:"right-5 down-5"}),d(z,{icon:cs,transform:"right-8 down-6"})]}),d(pe,{children:"Widgets"}),d(zn,{actions:l,onMenuOpened:this.handleWidgetMenuOpened,onMenuClosed:this.handleWidgetMenuClosed,options:{initialKeyboardIndex:1},popperOptions:a},"table-actions")]}),w("button",{type:"button",className:"btn btn-link btn-overflow btn-link-icon",children:[d(z,{icon:Xh}),d(pe,{children:"More Actions..."}),d(zn,{actions:e,popperOptions:a})]})]})}}class Hu extends S.exports.PureComponent{constructor(e){super(e),this.handleCommandStarted=this.handleCommandStarted.bind(this),this.handleCommandCompleted=this.handleCommandCompleted.bind(this),this.pending=new gs,this.state={isDisconnected:!1,isCommandRunning:!1}}componentDidMount(){this.startListening()}componentWillUnmount(){this.stopListening(),this.cancelPendingPromises()}startListening(){const{session:e}=this.props;e.addEventListener(N.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted)}stopListening(){const{session:e}=this.props;e.removeEventListener(N.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted)}cancelPendingPromises(){this.pending.cancel()}handleCommandStarted(e){const{result:n}=e.detail;this.pending.add(n).then(()=>this.handleCommandCompleted(null)).catch(s=>this.handleCommandCompleted(s)),this.setState({isCommandRunning:!0})}handleCommandCompleted(e){e instanceof ci||this.setState({isCommandRunning:this.pending.pending.length>0})}render(){const{children:e,openObject:n,overflowActions:s,objects:i}=this.props,{isDisconnected:o,isCommandRunning:r}=this.state;let l=null,a=null;return o?(l="console-status-icon-disconnected",a="Worker is disconnected"):r?(l="console-status-icon-pending",a="Worker is busy"):(l="console-status-icon-idle",a="Worker is idle"),w("div",{className:"console-pane-status-bar",children:[w("div",{children:[d("div",{className:W("console-status-icon",l)}),d(pe,{children:a})]}),e,d(Kr,{overflowActions:s,openObject:n,objects:i})]})}}Hu.defaultProps={children:null};const bs=X.module("Console"),Od={isAutoLaunchPanelsEnabled:!0,isPrintStdOutEnabled:!0,isClosePanelsOnDisconnectEnabled:!0},Io=class extends S.exports.PureComponent{constructor(t){super(t),this.processLogMessageQueue=mi(()=>{this.scrollConsoleHistoryToBottom(),this.setState(s=>{bs.debug2("processLogMessageQueue",this.queuedLogMessages.length," items");let{consoleHistory:i}=s;return i=i.concat(this.queuedLogMessages),this.queuedLogMessages=[],{consoleHistory:i}})},Io.LOG_THROTTLE),this.getObjects=Ce(s=>[...s.values()]),this.getContextActions=Ce(s=>[...s,{action:this.handleClearShortcut,shortcut:Fn.CONSOLE.CLEAR},{action:this.handleFocusHistory,shortcut:Fn.CONSOLE.FOCUS_HISTORY}]),this.handleCommandResult=this.handleCommandResult.bind(this),this.handleCommandStarted=this.handleCommandStarted.bind(this),this.handleCommandSubmit=this.handleCommandSubmit.bind(this),this.handleClearShortcut=this.handleClearShortcut.bind(this),this.handleFocusHistory=this.handleFocusHistory.bind(this),this.handleLogMessage=this.handleLogMessage.bind(this),this.handleOverflowActions=this.handleOverflowActions.bind(this),this.handleScrollPaneScroll=this.handleScrollPaneScroll.bind(this),this.handleToggleAutoLaunchPanels=this.handleToggleAutoLaunchPanels.bind(this),this.handleToggleClosePanelsOnDisconnect=this.handleToggleClosePanelsOnDisconnect.bind(this),this.handleTogglePrintStdout=this.handleTogglePrintStdout.bind(this),this.handleUploadCsv=this.handleUploadCsv.bind(this),this.handleHideCsv=this.handleHideCsv.bind(this),this.handleCsvFileCanceled=this.handleCsvFileCanceled.bind(this),this.handleCsvFileOpened=this.handleCsvFileOpened.bind(this),this.handleCsvPaste=this.handleCsvPaste.bind(this),this.handleDragEnter=this.handleDragEnter.bind(this),this.handleDragLeave=this.handleDragLeave.bind(this),this.handleClearDragError=this.handleClearDragError.bind(this),this.handleOpenCsvTable=this.handleOpenCsvTable.bind(this),this.handleCsvUpdate=this.handleCsvUpdate.bind(this),this.handleCsvError=this.handleCsvError.bind(this),this.handleCsvInProgress=this.handleCsvInProgress.bind(this),this.consolePane=Y.createRef(),this.consoleInput=Y.createRef(),this.consoleHistoryScrollPane=Y.createRef(),this.pending=new gs,this.queuedLogMessages=[];const{objectMap:e,settings:n}=this.props;this.state={consoleHistory:[],consoleHeight:0,isScrollDecorationShown:!1,objectHistoryMap:new Map,objectMap:new Map(e),showCsvOverlay:!1,csvFile:null,csvPaste:null,dragError:null,csvUploadInProgress:!1,...Od,...n}}static isErrorLevel(t){return t===Tt.STDERR||t===Tt.ERROR||t===Tt.FATAL}static isOutputLevel(t){return t===Tt.STDOUT||Io.isErrorLevel(t)}componentDidMount(){this.initConsoleLogging();const{session:t}=this.props;t.addEventListener(N.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted),this.updateDimensions()}componentDidUpdate(t,e){const{props:n,state:s}=this;this.sendSettingsChange(e,s),n.objectMap!==t.objectMap&&this.updateObjectMap()}componentWillUnmount(){const{session:t}=this.props;t.removeEventListener(N.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted),this.pending.cancel(),this.processLogMessageQueue.cancel(),this.deinitConsoleLogging()}initConsoleLogging(){const{session:t}=this.props;this.cancelListener=t.onLogMessage(this.handleLogMessage)}deinitConsoleLogging(){this.cancelListener!=null&&(this.cancelListener(),this.cancelListener=void 0)}handleClearShortcut(t){var e;t.preventDefault(),t.stopPropagation(),(e=this.consoleInput.current)==null||e.clear()}handleCommandStarted(t){const{code:e,result:n}=t.detail,s=this.pending.add(n),i={command:e,disabledObjects:[],startTime:Date.now(),cancelResult:()=>{n.cancel()},wrappedResult:s},{commandHistoryStorage:o,language:r,scope:l}=this.props,a=o.addItem(r,l,e,{command:e,startTime:new Date().toJSON()});a.catch(c=>{bs.debug("Error adding workspace item",c)}),this.setState(c=>({consoleHistory:c.consoleHistory.concat(i)}),()=>{this.scrollConsoleHistoryToBottom(!0)}),s.then(c=>{this.handleCommandResult(c,i,a)}).catch(c=>{this.handleCommandError(c,i,a)})}handleCommandResult(t,e,n){const s=e;s.wrappedResult=void 0,s.cancelResult=void 0,t&&(s.result=t,this.updateHistory(t,s),this.updateKnownObjects(s),this.updateWorkspaceHistoryItem({error:t.error},n),this.closeRemovedItems(t.changes),this.openUpdatedItems(t.changes))}handleCommandError(t,e,n){const s=e;if(s.wrappedResult=void 0,s.cancelResult=void 0,Re.isCanceled(t)){bs.debug("Called handleCommandError on a cancelled promise result");return}this.updateWorkspaceHistoryItem({error:`${t}`},n),this.setState(i=>{const o=i.consoleHistory.concat(),r=o.lastIndexOf(s);return s.endTime=Date.now(),s.result={error:t},o[r]={...s},{consoleHistory:o}})}handleFocusHistory(t){t.preventDefault(),t.stopPropagation();const{focusCommandHistory:e}=this.props;e()}handleLogMessage(t){const{isPrintStdOutEnabled:e}=this.state;!e||Io.isOutputLevel(t.logLevel)&&this.queueLogMessage(t.message,t.logLevel)}queueLogMessage(t,e){const n={};Io.isErrorLevel(e)?n.error=t:n.message=t;const s={command:void 0,result:n};this.queuedLogMessages.push(s),this.processLogMessageQueue()}openUpdatedItems(t){const{isAutoLaunchPanelsEnabled:e}=this.state;if(t==null||!e)return;const{openObject:n}=this.props;[...t.created,...t.updated].forEach(s=>n(s))}closeRemovedItems(t){if(t==null||t.removed==null||t.removed.length===0)return;const{closeObject:e}=this.props,{removed:n}=t;n.forEach(s=>e(s))}updateHistory(t,e){const n=e;t==null||t.changes==null||n==null||(n.endTime=Date.now(),this.scrollConsoleHistoryToBottom(),this.setState(s=>({consoleHistory:s.consoleHistory.concat()})))}updateKnownObjects(t){let e;if(t.result&&(e=t.result.changes),!e||(e.created==null||e.created.length===0)&&(e.updated==null||e.updated.length===0)&&(e.removed==null||e.removed.length===0)){bs.debug2("updateKnownObjects no changes");return}this.setState(n=>{const s=n.consoleHistory.concat(),i=s.lastIndexOf(t);if(i<0)return bs.error("historyItem not found in state.consoleHistory"),null;const o=new Map(n.objectHistoryMap),r=new Map(n.objectMap),l=(a,c=!1)=>{var m;const{title:h}=a;A(h);const u=o.get(h);u!=null&&u>=0&&(s[u].disabledObjects=[...(m=s[u].disabledObjects)!=null?m:[],h]),o.set(h,i),c?r.delete(h):r.set(h,a)};return e==null||e.updated.forEach(a=>l(a)),e==null||e.removed.forEach(a=>l(a,!0)),e==null||e.created.forEach(a=>{const{title:c}=a;A(c),o.set(c,i),r.set(c,a)}),{objectHistoryMap:o,objectMap:r,consoleHistory:s}})}updateObjectMap(){const{objectMap:t}=this.props;this.setState({objectMap:t})}updateWorkspaceHistoryItem(t,e){const n=this.pending.add(e),s=new Date().toJSON();n.then(i=>{const o={...i,data:{...i.data,endTime:s,result:t}},{commandHistoryStorage:r,language:l}=this.props;r.updateItem(l,o).catch(a=>{bs.warn("Error updating command history storage",a)})}).catch(i=>{bs.debug("Error updating workspace history item",i)})}scrollConsoleHistoryToBottom(t=!1){const e=this.consoleHistoryScrollPane.current;A(e),!(!t&&e.scrollTop<e.scrollHeight-e.offsetHeight)&&window.requestAnimationFrame(()=>{e.scrollTop=e.scrollHeight})}handleScrollPaneScroll(){const t=this.consoleHistoryScrollPane.current;A(t),t.scrollTop>0&&t.scrollHeight>t.clientHeight?this.setState({isScrollDecorationShown:!0}):this.setState({isScrollDecorationShown:!1})}handleToggleAutoLaunchPanels(){this.setState(t=>({isAutoLaunchPanelsEnabled:!t.isAutoLaunchPanelsEnabled}))}handleToggleClosePanelsOnDisconnect(){this.setState(t=>({isClosePanelsOnDisconnectEnabled:!t.isClosePanelsOnDisconnectEnabled}))}handleTogglePrintStdout(){this.setState(t=>({isPrintStdOutEnabled:!t.isPrintStdOutEnabled}))}handleUploadCsv(){this.setState({showCsvOverlay:!0,dragError:null,csvUploadInProgress:!1})}handleHideCsv(){this.setState({showCsvOverlay:!1,csvFile:null,csvPaste:null,dragError:null,csvUploadInProgress:!1})}handleCsvFileCanceled(){this.setState({csvFile:null,csvPaste:null})}handleCsvFileOpened(t){this.setState({csvFile:t,csvPaste:null})}handleCsvPaste(t){this.setState({csvFile:null,csvPaste:t})}handleDragEnter(t){if(t.dataTransfer==null||t.dataTransfer.items==null||t.dataTransfer.items.length===0||t.dataTransfer.items[0].kind==="string")return;t.preventDefault(),t.stopPropagation(),this.setState({showCsvOverlay:!0});const{items:e}=t.dataTransfer;if(e.length>1){this.setState({dragError:as.MULTIPLE_FILE_ERROR});return}const n=e[0];as.isValidDropItem(n)?this.setState({dragError:null}):this.setState({dragError:as.FILE_TYPE_ERROR})}handleDragLeave(t){t.currentTarget==null||t.currentTarget instanceof Element&&t.relatedTarget instanceof Element&&t.currentTarget.contains(t.relatedTarget)||(t.preventDefault(),t.stopPropagation(),this.setState({showCsvOverlay:!1,dragError:null}))}handleClearDragError(){this.setState({dragError:null})}handleOpenCsvTable(t){const{openObject:e,commandHistoryStorage:n,language:s,scope:i}=this.props,{consoleHistory:o,objectMap:r}=this.state,l={name:t,title:t,type:N.VariableType.TABLE},a=r.has(t),c={startTime:Date.now(),endTime:Date.now(),disabledObjects:[],result:{changes:{created:[],updated:[],removed:[],[a?"updated":"created"]:[l]}}},h=o.concat(c);this.setState({consoleHistory:h}),this.scrollConsoleHistoryToBottom(!0),this.updateKnownObjects(c),e({name:t,title:t,type:N.VariableType.TABLE}),n.addItem(s,i,t,{command:t,startTime:new Date().toJSON(),endTime:new Date().toJSON()})}addConsoleHistoryMessage(t,e){const{consoleHistory:n}=this.state,s={command:"",startTime:Date.now(),endTime:Date.now(),result:{message:t,error:e}},i=n.concat(s);this.setState({consoleHistory:i})}handleCsvUpdate(t){this.addConsoleHistoryMessage(t)}handleCsvError(t){this.addConsoleHistoryMessage(void 0,t!=null?`${t}`:void 0)}handleCsvInProgress(t){this.setState({csvUploadInProgress:t})}handleOverflowActions(){const{isAutoLaunchPanelsEnabled:t,isClosePanelsOnDisconnectEnabled:e,isPrintStdOutEnabled:n}=this.state,{actions:s}=this.props;return[...s,{title:"Print Stdout",action:this.handleTogglePrintStdout,group:ie.groups.high,icon:n?ai:void 0,order:10},{title:"Auto Launch Panels",action:this.handleToggleAutoLaunchPanels,group:ie.groups.high,icon:t?ai:void 0,order:20},{title:"Close Panels on Disconnect",action:this.handleToggleClosePanelsOnDisconnect,group:ie.groups.high,icon:e?ai:void 0,order:30},{title:"Upload Table from File",action:this.handleUploadCsv,group:ie.groups.high+10,order:40}]}handleCommandSubmit(t){if(t==="clear"||t==="cls")this.clearConsoleHistory();else if(t.length>0){const{session:e}=this.props;e.runCode(t).catch(n=>{bs.error("There was an error initiating the command",n)})}else{const e={command:" ",result:{},startTime:Date.now(),endTime:Date.now()};this.scrollConsoleHistoryToBottom(!0),this.setState(n=>({consoleHistory:n.consoleHistory.concat(e)}))}}clearConsoleHistory(){this.pending.cancel(),this.setState(t=>{const e=new Map([...t.objectHistoryMap.keys()].map(n=>[n,-1]));return{consoleHistory:[],objectHistoryMap:e}})}addCommand(t,e=!0,n=!1){!this.consoleInput.current||(this.consoleInput.current.setConsoleText(t,e,n),e&&this.scrollConsoleHistoryToBottom(!0))}focus(){var t;(t=this.consoleInput.current)==null||t.focus()}sendSettingsChange(t,e,n=!0){const s=Object.keys(Od),i={};let o=!1;for(let l=0;l<s.length;l+=1){const a=s[l],{[a]:c}=e,{[a]:h}=t;c!==h&&(o=!0),i[a]=c}if(n&&!o)return;const{onSettingsChange:r}=this.props;r(i)}updateDimensions(){this.consolePane.current&&this.setState({consoleHeight:this.consolePane.current.clientHeight}),this.consoleInput.current&&this.consoleInput.current.updateDimensions()}render(){const{actions:t,historyChildren:e,language:n,statusBarChildren:s,openObject:i,session:o,scope:r,commandHistoryStorage:l,timeZone:a,disabled:c,unzip:h}=this.props,{consoleHeight:u,consoleHistory:m,isScrollDecorationShown:p,objectMap:g,showCsvOverlay:f,csvFile:b,csvPaste:C,dragError:v,csvUploadInProgress:T}=this.state,E=this.getObjects(g),y=Math.round(u*.7),I=this.getContextActions(t);return w("div",{role:"presentation",className:W("iris-console","h-100","w-100",{disabled:c}),children:[w("div",{className:"console-pane",ref:this.consolePane,children:[d(Hu,{session:o,overflowActions:this.handleOverflowActions(),openObject:i,objects:E,children:s}),w("div",{className:"console-csv-container",onDragOver:as.handleDragOver,onDragEnter:this.handleDragEnter,onDragLeave:this.handleDragLeave,children:[f&&d(as,{onCancel:this.handleCsvFileCanceled,onFileOpened:this.handleCsvFileOpened,onPaste:this.handleCsvPaste,clearDragError:this.handleClearDragError,dragError:v,onError:this.handleCsvError,uploadInProgress:T,allowZip:h!=null}),w("div",{role:"presentation",className:W("scroll-pane no-scroll-x",{"scroll-decoration":p}),onScroll:this.handleScrollPaneScroll,ref:this.consoleHistoryScrollPane,children:[d(xu,{items:m,openObject:i,language:n,disabled:c}),e]})]}),!f&&d(zr,{ref:this.consoleInput,session:o,language:n,scope:r,onSubmit:this.handleCommandSubmit,maxHeight:y,commandHistoryStorage:l}),f&&d(Pu,{session:o,onOpenTable:this.handleOpenCsvTable,onClose:this.handleHideCsv,onUpdate:this.handleCsvUpdate,onError:this.handleCsvError,file:b!=null?b:void 0,paste:C!=null?C:void 0,onInProgress:this.handleCsvInProgress,timeZone:a,unzip:h})]}),d(ie,{actions:I,ignoreClassNames:[zr.INPUT_CLASS_NAME]})]})}};let ac=Io;ac.defaultProps={statusBarChildren:null,settings:{},onSettingsChange:()=>{},scope:null,actions:[],historyChildren:null,timeZone:"America/New_York",objectMap:new Map,disabled:!1,unzip:null};ac.LOG_THROTTLE=500;class Cl extends S.exports.Component{constructor(e){super(e),this.handleResize=this.handleResize.bind(this),this.container=null,this.state={}}componentDidMount(){this.initEditor(),window.addEventListener("resize",this.handleResize)}componentWillUnmount(){window.removeEventListener("resize",this.handleResize),this.destroyEditor()}setLanguage(e){if(this.editor){const n=this.editor.getModel();A(n),ds.setModelLanguage(n,e)}}handleResize(){this.updateDimensions()}toggleFind(){this.editor&&(this.editor.focus(),this.editor.trigger("toggleFind","actions.find",void 0))}updateDimensions(){var e;(e=this.editor)==null||e.layout()}initEditor(){const{onEditorInitialized:e}=this.props;let{settings:n}=this.props;n={copyWithSyntaxHighlighting:"false",fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:"python",lineNumbersMinChars:3,minimap:{enabled:!1},scrollBeyondLastLine:!1,tabCompletion:"on",value:"",wordWrap:"off",...n},A(this.container),this.editor=ds.create(this.container,n),this.editor.addAction({id:"find",label:"Find",keybindings:[bn.CtrlCmd|$n.KeyF],precondition:void 0,keybindingContext:void 0,contextMenuGroupId:"navigation",contextMenuOrder:1,run:()=>{this.toggleFind()}}),this.editor.layout(),dt.removeConflictingKeybindings(this.editor),e(this.editor)}destroyEditor(){const{onEditorWillDestroy:e}=this.props;A(this.editor),e(this.editor),this.editor.dispose(),this.editor=void 0}render(){const{className:e}=this.props;return d("div",{className:W("editor-container",e),ref:n=>{this.container=n}})}}Cl.defaultProps={className:"fill-parent-absolute",onEditorInitialized:()=>{},onEditorWillDestroy:()=>{},settings:{}};const fn=X.module("ScriptEditor");class Vu extends S.exports.Component{constructor(e){super(e),this.handleEditorInitialized=this.handleEditorInitialized.bind(this),this.handleEditorWillDestroy=this.handleEditorWillDestroy.bind(this),this.handleRun=this.handleRun.bind(this),this.handleRunSelected=this.handleRunSelected.bind(this),this.updateShortcuts=this.updateShortcuts.bind(this),this.contextActionCleanups=[],this.editorComponent=Y.createRef(),this.state={model:null}}componentDidMount(){ze.addEventListener("onUpdate",this.updateShortcuts)}componentDidUpdate(e){var h,u;const{sessionLanguage:n,settings:s}=this.props,i=s==null?void 0:s.language;i!==((h=e.settings)==null?void 0:h.language)&&(fn.debug("Set language",i),this.setLanguage(i));const r=n==null&&e.sessionLanguage!=null,l=i===n,a=((u=e.settings)==null?void 0:u.language)===e.sessionLanguage;(r||n!==void 0&&a&&!l)&&(fn.debug("De-init completion and context actions"),this.deInitContextActions(),this.deInitCodeCompletion()),(n!=null&&e.sessionLanguage==null&&l||n!==void 0&&!a&&l)&&(fn.debug("Init completion and context actions"),this.initContextActions(),this.initCodeCompletion())}componentWillUnmount(){ze.removeEventListener("onUpdate",this.updateShortcuts)}getValue(){return this.editor?this.editor.getValue():(fn.error("Editor not initialized"),null)}getSelectedCommand(){var c,h;const e=(c=this.editor)==null?void 0:c.getSelection();A(e);const n=(h=this.editor)==null?void 0:h.getModel();A(n);const{startLineNumber:s,endColumn:i}=e;let{endLineNumber:o}=e;i===1&&o>s&&(o-=1);const r=n==null?void 0:n.getLineMinColumn(s),l=n==null?void 0:n.getLineMaxColumn(o),a=e.setStartPosition(s,r).setEndPosition(o,l);return n==null?void 0:n.getValueInRange(a)}handleEditorInitialized(e){const{focusOnMount:n,onChange:s,settings:i,session:o,sessionLanguage:r}=this.props;fn.debug("handleEditorInitialized",r,o,i),this.editor=e,this.setState({model:this.editor.getModel()}),dt.setEOL(e),dt.registerPasteHandler(e),o!=null&&i&&r===i.language&&(this.initContextActions(),this.initCodeCompletion()),e.onDidChangeModelContent(s),n!=null&&n&&e.focus()}handleEditorWillDestroy(){fn.debug("handleEditorWillDestroy"),this.deInitContextActions(),this.deInitCodeCompletion(),this.setState({model:null}),this.editor=void 0}handleRun(){const{onRunCommand:e}=this.props,n=this.getValue();n!=null&&e(n)}handleRunSelected(){const{onRunCommand:e}=this.props,n=this.getSelectedCommand();e(n)}initContextActions(){if(this.contextActionCleanups.length>0){fn.error("Context actions already initialized.");return}if(!this.editor)return;const e=[];e.push(this.editor.addAction({id:"run-code",label:"Run",keybindings:[dt.getMonacoKeyCodeFromShortcut(Fn.NOTEBOOK.RUN)],contextMenuGroupId:"navigation",contextMenuOrder:1.5,run:()=>{this.handleRun()}})),e.push(this.editor.addAction({id:"run-selected-code",label:"Run Selected",keybindings:[dt.getMonacoKeyCodeFromShortcut(Fn.NOTEBOOK.RUN_SELECTED)],contextMenuGroupId:"navigation",contextMenuOrder:1.5,run:()=>{this.handleRunSelected()}})),this.contextActionCleanups=e}deInitContextActions(){this.contextActionCleanups.length>0&&(this.contextActionCleanups.forEach(e=>e.dispose()),this.contextActionCleanups=[])}updateShortcuts(){this.deInitContextActions(),this.initContextActions()}initCodeCompletion(){if(this.completionCleanup!=null){fn.error("Code completion already initialized.");return}const{session:e}=this.props;fn.debug("initCodeCompletion",this.editor,e),this.editor&&e!=null&&(this.completionCleanup=dt.openDocument(this.editor,e))}deInitCodeCompletion(){const{session:e}=this.props;fn.debug("deInitCodeCompletion",this.editor,e),this.completionCleanup&&(this.completionCleanup.dispose(),this.completionCleanup=void 0),this.editor&&e!=null&&dt.closeDocument(this.editor,e)}append(e,n=!0){A(this.editor);const s=this.editor.getModel();A(s);const i=s.getValue();i?s.setValue(`${i}
14
+ ${e}`):s.setValue(`${e}`);const o=s.getLineCount(),r=s.getLineLength(o)+1;this.editor.setPosition({lineNumber:o,column:r}),n&&this.editor.focus()}updateDimensions(){fn.debug("updateDimensions"),this.editor&&this.editor.layout()}focus(){fn.debug("focus"),this.editor&&this.editor.focus()}toggleFind(){this.editorComponent.current&&this.editorComponent.current.toggleFind()}setLanguage(e){this.editorComponent.current&&e!==void 0&&this.editorComponent.current.setLanguage(e)}render(){const{error:e,isLoaded:n,isLoading:s,session:i,sessionLanguage:o,settings:r}=this.props,{model:l}=this.state,a=e?`Unable to open document. ${e}`:null,c=r?r.language:null,h=l&&i&&c===o;return w(ue,{children:[(e||s)&&d("div",{className:"h-100 w-100 position-relative",children:d(ul,{errorMessage:a,isLoading:s,isLoaded:n})}),n&&d("div",{className:"h-100 w-100 script-editor",children:r&&w(ue,{children:[d(Cl,{ref:this.editorComponent,settings:r,onEditorInitialized:this.handleEditorInitialized,onEditorWillDestroy:this.handleEditorWillDestroy}),h!=null&&h&&d(_u,{model:l,language:c,session:i})]})})]})}}Vu.defaultProps={error:null,isLoading:!1,isLoaded:!1,focusOnMount:!0,onChange:()=>{},session:null,sessionLanguage:null,settings:null};const ub={groovy:"Groovy",python:"Python",scala:"Scala"};class Ad{static normalizeScriptLanguage(e){return ub[e]||null}static getDisabledRunTooltip(e,n,s,i){return e?n?null:`${s} doesn't match the session language \u2013 ${i} disabled`:`Console session not connected \u2013 ${i} disabled`}}const mb=250,pb=2500,Uu=class extends S.exports.Component{constructor(t){super(t),this.loadData=Je(()=>{const{commandHistoryStorage:e,item:n,language:s}=this.props,{id:i}=n;this.cleanup=e.listenItem(s,i,this.handleUpdate,this.handleError)},mb),this.getPreviewText=Ie(e=>e.split(`
15
+ `,pb).join(`
16
+ `),{max:1}),this.handleUpdate=this.handleUpdate.bind(this),this.handleError=this.handleError.bind(this),this.handleTimeout=this.handleTimeout.bind(this),this.state={currentTime:Date.now()}}static getTimeString(t,e){if(t==null||e===""||e===0)return null;const n=Math.round((new Date(e).valueOf()-new Date(t).valueOf())/1e3);return n<1?"<1s":Rn.formatElapsedTime(n)}componentDidMount(){this.loadData()}componentDidUpdate(t,e){var s;const{data:n}=this.state;this.timer==null&&!(n!=null&&n.result)&&Boolean(n==null?void 0:n.startTime)&&!(n==null||n.endTime===void 0)?this.startTimer():((n==null?void 0:n.result)&&!((s=e.data)!=null&&s.result)||Boolean(n==null?void 0:n.endTime)&&!(e.data==null||e.data.endTime===void 0))&&this.stopTimer()}componentWillUnmount(){this.loadData.cancel(),this.cleanup!=null&&this.cleanup(),this.stopTimer()}startTimer(){this.stopTimer(),this.timer=setInterval(this.handleTimeout,1e3)}stopTimer(){this.timer&&(clearInterval(this.timer),this.timer=void 0)}updateTime(){this.setState({currentTime:Date.now()})}handleError(t){this.setState({error:`${t}`})}handleUpdate(t){const{data:e}=t!=null?t:{};this.setState({data:e});const{onUpdate:n}=this.props;n==null||n(e)}handleTimeout(){this.updateTime()}render(){var m;const{item:{name:t},language:e}=this.props,{currentTime:n,data:s,error:i}=this.state,{result:o,startTime:r,endTime:l}=s!=null?s:{},a=(m=o==null?void 0:o.error)!=null?m:i,c=Uu.getTimeString(r,l!=null?l:n),h=this.getPreviewText(t),u=Boolean(c);return w("div",{className:"command-history-item-tooltip",children:[w("div",{className:"scroll-container",children:[d(fl,{language:e,children:h}),h.length<t.length&&d("p",{children:"Preview Truncated..."})]}),w("div",{className:"result-info",children:[w("div",{className:"d-flex justify-content-between",children:[Boolean(a)&&w("div",{className:"text-danger mr-1",children:[d(z,{icon:hs})," Executed with errors"]}),w("div",{className:"time-wrapper",children:["Elapsed time:"," ",u?d("span",{className:"time-string",children:c}):d(Ln,{})]})]}),Boolean(a)&&d("div",{className:"error-message",children:a})]})]})}};let Bu=Uu;Bu.defaultProps={onUpdate:()=>{}};const gb=512,$u=t=>{const{item:e,language:n,isSelected:s,commandHistoryStorage:i}=t,o=e.name.substring(0,gb),r=S.exports.useRef(null),l=S.exports.useCallback(()=>{var a;(a=r.current)==null||a.update()},[r]);return w("div",{className:W("command-history-item",{selected:s}),children:[o,d(pe,{ref:r,interactive:!0,options:{placement:"left",modifiers:{preventOverflow:{enabled:!0,boundariesElement:"viewport",order:825}}},popperClassName:"command-history-item-popper",children:d(Bu,{item:e,language:n,onUpdate:l,commandHistoryStorage:i})})]})};$u.defaultProps={isSelected:!1};class qr extends S.exports.Component{static itemKey(e,n){return`${n.title}`}static renderContent(e){return e.selectionRequired!==void 0&&e.selectionRequired?w("div",{className:"fa-md fa-layers",children:[d(z,{icon:Oo,mask:e.icon,transform:"right-5 down-5 shrink-4"}),d(z,{icon:Ug,transform:"shrink-3 right-7 down-6"})]}):d(z,{icon:e.icon})}render(){const{actions:e,hasSelection:n}=this.props;return d("div",{className:"command-history-actions",children:e.map((s,i)=>d(ce,{kind:"inline",className:W(s.className),onClick:s.action,tooltip:s.description,disabled:s.selectionRequired!==void 0&&s.selectionRequired&&!n,icon:qr.renderContent(s)},qr.itemKey(i,s)))})}}const fb=150,Pd=3,Hd=X.module("CommandHistoryViewportUpdater");function Cb({table:t,columns:e,top:n=0,bottom:s=0,search:i,isReversed:o=!1,onUpdate:r}){const l=S.exports.useMemo(()=>mi(a=>{const c=a.bottom-a.top,h=Math.max(0,a.top-c*Pd),u=a.bottom+c*Pd;t.setViewport({top:h,bottom:u,columns:a.columns})},fb),[t]);return S.exports.useEffect(function(){const c=t.onUpdate(h=>{var u,m;r({items:(u=h.items)!=null?u:[],offset:(m=h.offset)!=null?m:0})});return()=>{Hd.debug("onUpdate cleanup"),c()}},[t,r]),S.exports.useEffect(function(){t.setSearch(i!=null?i:"")},[t,i]),S.exports.useEffect(function(){l({top:n,bottom:s,columns:e})},[l,n,s,e,i,o]),S.exports.useEffect(()=>()=>{Hd.debug2("Cancel throttledUpdateViewport"),l.cancel()},[l]),null}const Ss=X.module("CommandHistory"),is=class extends S.exports.Component{constructor(t){super(t),this.copySelectedCommands=this.copySelectedCommands.bind(this),this.createNotebook=this.createNotebook.bind(this),this.sendToConsole=this.sendToConsole.bind(this),this.renderItem=this.renderItem.bind(this),this.runInConsole=this.runInConsole.bind(this),this.sendToNotebook=this.sendToNotebook.bind(this),this.handleSelect=this.handleSelect.bind(this),this.handleSelectionChange=this.handleSelectionChange.bind(this),this.handleSearchChange=this.handleSearchChange.bind(this),this.handleViewportChange=this.handleViewportChange.bind(this),this.handleViewportUpdate=this.handleViewportUpdate.bind(this),this.itemActions=[{title:"Copy Selection",description:"Copy selected commands to clipboard",icon:jg,shortcut:Os.COPY,action:this.copySelectedCommands,group:ie.groups.edit},{title:"Send to Console",description:"Open selected commands in the console",icon:md,shortcut:Fn.COMMAND_HISTORY.SEND_TO_CONSOLE,action:this.sendToConsole,group:is.menuGroups.send,order:10},{title:"Run in Console",description:"Run selected commands in the console",icon:$r,shortcut:Fn.COMMAND_HISTORY.RUN,action:this.runInConsole,group:is.menuGroups.send,order:10},{title:"Send to Active Notebook",description:"Open selected commands in a notebook",icon:ud,shortcut:Fn.COMMAND_HISTORY.SEND_TO_NOTEBOOK,action:this.sendToNotebook,group:is.menuGroups.send,order:20},{title:"Send to New Notebook",description:"Open selected commands in a new notebook",icon:Qh,action:this.createNotebook,group:is.menuGroups.send,order:30}],this.historyActions=[{title:"Send to Console",icon:md,selectionRequired:!0,description:"Open selected commands in the console",action:this.sendToConsole},{title:"Send to Notebook",icon:ud,selectionRequired:!0,description:"Open selected commands in a notebook",action:this.sendToNotebook}],this.pending=new gs,this.searchInputRef=Y.createRef();const{table:e}=t;this.state={actions:[],historyActions:this.historyActions,top:0,bottom:0,itemCount:e.size,items:[],offset:0,selectedRanges:[],searchText:""}}static getCommandsFromViewport(t,e,n){const s=[];for(let i=0;i<n.length;i+=1){const o=n[i];for(let r=o[0];r<=o[1];r+=1)if(r>=e&&r<e+t.length){const{name:l}=t[r-e];s.push(l)}}return s}static async getCommandsFromSnapshot(t,e){return[...(await t.getSnapshot(e)).values()].map(s=>s.name)}componentWillUnmount(){this.pending.cancel()}async getSelectedCommands(){const{items:t,offset:e,selectedRanges:n}=this.state,s=n.slice().sort((o,r)=>o[0]-r[0]);if(s.length===0)return[];if(s[0][0]>=e&&s[s.length-1][1]<e+t.length)return is.getCommandsFromViewport(t,e,s);const{table:i}=this.props;return this.pending.add(is.getCommandsFromSnapshot(i,s))}getSelectedCommandText(){return this.getSelectedCommands().then(t=>t.join(`
17
+ `))}updateActions(){this.setState(t=>{const{selectedRanges:e}=t,n=e.reduce((s,i)=>s+i[1]-i[0]+1,0);return n>0&&n<is.MAX_SELECTION_COUNT?(Ss.debug("Updating actions",this.itemActions),{actions:this.itemActions}):(Ss.debug("Disabling actions",n),{actions:[]})})}copySelectedCommands(){this.getSelectedCommandText().then(xe.copyToClipboard).catch(Ss.error)}createNotebook(){this.getSelectedCommandText().then(t=>{const{language:e,sendToNotebook:n}=this.props;n({value:t,language:e},!0)}).catch(Ss.error)}sendToNotebook(){this.getSelectedCommandText().then(t=>{const{language:e,sendToNotebook:n}=this.props;n({value:t,language:e})}).catch(Ss.error)}sendToConsole(){const{sendToConsole:t}=this.props;this.getSelectedCommandText().then(t).catch(Ss.error)}runInConsole(){this.getSelectedCommandText().then(t=>{const{sendToConsole:e}=this.props;e(t,!0,!0)}).catch(Ss.error)}handleSelect(t){const{sendToConsole:e}=this.props,{items:n,offset:s}=this.state;if(t<s||t>=s+n.length){Ss.error("Invalid index!",t);return}const{name:i}=n[t-s];e(i)}handleSelectionChange(t){this.setState({selectedRanges:t}),this.updateActions()}handleViewportChange(t,e){this.setState({top:t,bottom:e})}handleSearchChange(t){this.setState({searchText:t.target.value,selectedRanges:[]})}handleViewportUpdate({items:t,offset:e}){const{table:n}=this.props,s=n.size;this.setState({items:t,itemCount:s,offset:e})}renderItem({item:t,itemIndex:e,isSelected:n}){const{language:s,commandHistoryStorage:i}=this.props;return d($u,{isSelected:n,item:t,language:s,commandHistoryStorage:i})}focus(){this.searchInputRef.current&&this.searchInputRef.current.focus()}render(){var m;const{language:t,table:e}=this.props,{actions:n,historyActions:s,searchText:i,top:o,bottom:r,items:l,itemCount:a,offset:c,selectedRanges:h}=this.state,u=(m=Ru.LANGUAGE_MAP.get(t))!=null?m:"";return w("div",{className:"command-history",children:[w("div",{className:"command-history-search-bar",children:[d(fs,{ref:this.searchInputRef,value:i,placeholder:`${u} Command History`,onChange:this.handleSearchChange}),d(qr,{actions:s,hasSelection:h.length>0})]}),w("div",{className:"command-history-list",children:[d(vn,{itemCount:a,items:l,offset:c,selectedRanges:h,onSelect:this.handleSelect,onSelectionChange:this.handleSelectionChange,onViewportChange:this.handleViewportChange,renderItem:this.renderItem,rowHeight:is.ITEM_HEIGHT,isDoubleClickSelect:!0,isMultiSelect:!0,isStickyBottom:!0}),d(Cb,{table:e,top:o,bottom:r,search:i,onUpdate:this.handleViewportUpdate}),d(ie,{actions:n})]})]})}};let bl=is;bl.ITEM_HEIGHT=29;bl.MAX_SELECTION_COUNT=1e4;bl.menuGroups={send:ie.groups.medium+100};class bb extends S.exports.PureComponent{constructor(e){super(e),this.handleSwitchClick=this.handleSwitchClick.bind(this)}handleSwitchClick(){const{logLevel:e,onClick:n}=this.props;n(e)}render(){const{logLevel:e,on:n}=this.props;return w("div",{className:W("log-level-menu-item",e),children:[d(wu,{on:n,onClick:this.handleSwitchClick}),e]})}}const Pt=class extends S.exports.PureComponent{constructor(t){super(t),this.handleClearClick=this.handleClearClick.bind(this),this.handleFlushTimeout=this.handleFlushTimeout.bind(this),this.handleLogMessage=this.handleLogMessage.bind(this),this.handleMenuItemClick=this.handleMenuItemClick.bind(this),this.handleResetClick=this.handleResetClick.bind(this),this.handleResize=this.handleResize.bind(this),this.handleToggleAllClick=this.handleToggleAllClick.bind(this),this.logLevelMenuItems={},this.editorContainer=null,this.bufferedMessages=[],this.messages=[],this.state={shownLogLevels:{}}}static getLogText(t){const e=new Date(t.micros/1e3);return`${Gi.formatTimestamp(e)} ${t.logLevel} ${t.message}`}componentDidMount(){this.resetLogLevels(),this.initMonaco(),this.startListening(),window.addEventListener("resize",this.handleResize)}componentDidUpdate(t,e){this.updateDimensions();const{shownLogLevels:n}=this.state;e.shownLogLevels!==n&&this.refreshLogText();const{session:s}=this.props;t.session!==s&&(this.stopListening(),this.startListening(),this.clearLogs())}componentWillUnmount(){this.stopFlushTimer(),this.stopListening(),this.destroyMonaco(),window.removeEventListener("resize",this.handleResize)}getMenuActions(t){const e=[];e.push({menuElement:d("div",{className:"log-level-menu-title",children:"Display Log Levels"}),group:1,order:10});for(let n=0;n<Pt.AllLogLevels.length;n+=1){const s=Pt.AllLogLevels[n],i=t[s]!=null?t[s]:!1;e.push({title:s,group:1,order:n+100,menuElement:d(bb,{logLevel:s,on:i,onClick:this.handleMenuItemClick,ref:o=>{o!=null&&(this.logLevelMenuItems[s]=o)}})})}return e.push({group:1,order:1e3,menuElement:w("div",{className:"log-level-menu-controls",children:[d("button",{type:"button",className:"btn btn-link log-level-toggle-all",onClick:this.handleToggleAllClick,children:"Toggle All"}),d("button",{type:"button",className:"btn btn-link",onClick:this.handleResetClick,children:"Reset"})]})}),e}resetLogLevels(){const t={};for(let e=0;e<Pt.AllLogLevels.length;e+=1){const n=Pt.AllLogLevels[e],s=Pt.DefaultLogLevels.indexOf(n)>=0;t[n]=s}this.setState({shownLogLevels:t})}startListening(){const{session:t}=this.props;this.cancelListener=t.onLogMessage(this.handleLogMessage)}stopListening(){this.cancelListener!=null&&(this.cancelListener(),this.cancelListener=void 0)}initMonaco(){A(this.editorContainer),this.editor=ds.create(this.editorContainer,{copyWithSyntaxHighlighting:!1,fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:"log",lineDecorationsWidth:0,lineNumbersMinChars:0,minimap:{enabled:!1},readOnly:!0,renderLineHighlight:"none",scrollBeyondLastLine:!1,value:"",wordWrap:"on"}),this.editor.addCommand($n.Escape,()=>{}),this.editor.addCommand(bn.Shift|$n.Escape,()=>{}),this.editor.addCommand($n.Escape,()=>{var e,n;const t=(e=this.editor)==null?void 0:e.getPosition();A(t),(n=this.editor)==null||n.setPosition(t)},"findWidgetVisible && editorTextFocus"),this.editor.addCommand(bn.Shift|$n.Escape,()=>{var e,n;const t=(e=this.editor)==null?void 0:e.getPosition();A(t),(n=this.editor)==null||n.setPosition(t)},"findWidgetVisible && editorTextFocus")}destroyMonaco(){this.editor&&(this.editor.dispose(),this.editor=void 0)}triggerFindWidget(){var t,e;(t=this.editor)==null||t.focus(),(e=this.editor)==null||e.trigger("keyboard","actions.find",void 0)}toggleAll(){const{shownLogLevels:t}=this.state;let e=!0;for(let n=0;n<Pt.AllLogLevels.length;n+=1){const s=Pt.AllLogLevels[n];if(!t[s]){e=!1;break}}if(e)this.setState({shownLogLevels:{}});else{const n={};for(let s=0;s<Pt.AllLogLevels.length;s+=1){const i=Pt.AllLogLevels[s];n[i]=!0}this.setState({shownLogLevels:n})}}toggleLogLevel(t){const{shownLogLevels:e}=this.state,n=e[t],s={};s[t]=!n,this.updateLogLevels(s)}updateLogLevels(t){let{shownLogLevels:e}=this.state;e={...e,...t},this.setState({shownLogLevels:e})}appendLogText(t){if(!this.editor)return;const e=this.editor.getModel();let n=e==null?void 0:e.getLineCount();A(n);let s=e==null?void 0:e.getLineLength(n);A(s);const i=this.isBottomVisible(),o=[];if(s>0&&(o.push({range:{startLineNumber:n,startColumn:s+1,endLineNumber:n,endColumn:s+1},text:`
18
+ `,forceMoveMarkers:!0}),n+=1,s=0),o.push({range:{startLineNumber:n,startColumn:s,endLineNumber:n,endColumn:s},text:t,forceMoveMarkers:!0}),e==null||e.applyEdits(o),i){const r=e==null?void 0:e.getLineCount();A(r),this.editor.revealLine(r,1)}}refreshLogText(){var s;if(!this.editor)return;this.truncateLogIfNecessary();const{shownLogLevels:t}=this.state,e=this.isBottomVisible();let n="";for(let i=0;i<this.messages.length;i+=1){const o=this.messages[i];if(t[o.logLevel]){const r=Pt.getLogText(o);r.length>0&&(n+=r,r.charAt(r.length-1)!==`
19
+ `&&(n+=`
20
+ `))}}if(n=n.trimRight(),this.editor.setValue(n),e){const i=(s=this.editor.getModel())==null?void 0:s.getLineCount();A(i),this.editor.revealLine(i,1)}this.stopFlushTimer(),this.bufferedMessages=[]}truncateLogIfNecessary(){this.messages.length>Pt.maxLogSize&&(this.messages=this.messages.splice(this.messages.length-Pt.truncateSize))}scrollToBottom(){var e,n,s;if(!this.editor)return;const t=(s=(n=(e=this.editor)==null?void 0:e.getModel)==null?void 0:n.call(e))==null?void 0:s.getLineCount();A(t),this.editor.revealLine(t,1)}isBottomVisible(){if(!this.editor)return!0;const t=this.editor.getModel(),e=t==null?void 0:t.getLineCount();return A(e),this.isLineVisible(e)}isLineVisible(t){var n;const e=(n=this.editor)==null?void 0:n.getVisibleRanges();if(e==null||e.length===0)return!1;for(let s=0;s<e.length;s+=1){const i=e[s];if(i.startLineNumber<=t&&t<=i.endLineNumber)return!0}return!1}isLogItemVisible(t){const{shownLogLevels:e}=this.state;return e[t.logLevel]}flush(){let t="";for(let e=0;e<this.bufferedMessages.length;e+=1){const n=this.bufferedMessages[e],s=Pt.getLogText(n);t+=s,s.charAt(s.length-1)!==`
21
+ `&&(t+=`
22
+ `)}this.bufferedMessages=[],this.appendLogText(t)}queue(t){this.bufferedMessages.push(t),this.bufferedMessages.length===1&&(this.flushTimer=setTimeout(this.handleFlushTimeout,Pt.bufferTimeout))}stopFlushTimer(){this.flushTimer&&(clearTimeout(this.flushTimer),this.flushTimer=void 0)}updateDimensions(){this.editor&&this.editor.layout()}handleClearClick(){this.clearLogs()}clearLogs(){this.messages=[],this.refreshLogText()}handleFlushTimeout(){this.stopFlushTimer(),this.flush()}handleLogMessage(t){this.messages.push(t),this.editor&&this.isLogItemVisible(t)&&this.queue(t)}handleMenuItemClick(t){this.toggleLogLevel(t)}handleResetClick(){this.resetLogLevels()}handleResize(){this.updateDimensions()}handleToggleAllClick(){this.toggleAll()}render(){const t={placement:"bottom-end"},{shownLogLevels:e}=this.state,n=this.getMenuActions(e);return w("div",{className:"log-pane h-100 w-100",children:[w("div",{className:"log-pane-menu",children:[w("button",{type:"button",className:"btn btn-link btn-link-icon btn-clear-logs",onClick:this.handleClearClick,children:[d(z,{icon:Pf}),d(pe,{children:"Clear log"})]}),w("button",{type:"button",className:"btn btn-link btn-link-icon btn-overflow",children:[d(z,{icon:Wo}),d(pe,{children:"Log Settings"}),d(zn,{actions:n,popperClassName:"log-level-menu-popper",popperOptions:t})]})]}),d("div",{className:"log-pane-editor h-100 w-100",ref:s=>{this.editorContainer=s}})]})}};let Ji=Pt;Ji.DefaultLogLevels=[Tt.STDOUT,Tt.ERROR,Tt.FATAL,Tt.STDERR,Tt.WARN];Ji.AllLogLevels=[Tt.INFO,Tt.STDOUT,Tt.ERROR,Tt.FATAL,Tt.STDERR,Tt.WARN,Tt.DEBUG,Tt.TRACE];Ji.bufferTimeout=16;Ji.maxLogSize=131072;Ji.truncateSize=65536;class st{static isValid(e){return!0}static isSameFormat(e,n){throw new Error("isSameFormat not implemented")}static makeFormat(e,n,s){return{label:e,formatString:n,type:s}}format(e,n){return""}}st.TYPE_GLOBAL="type-global";st.TYPE_CONTEXT_PRESET="type-context-preset";st.TYPE_CONTEXT_CUSTOM="type-context-custom";class Sb extends st{format(e){switch(e){case 1:case!0:return"true";case 0:case!1:return"false";default:return""}}}class wb extends st{format(e){return String.fromCharCode(e)}}const Vd=X.module("DateTimeColumnFormatter"),Qs=class extends st{constructor({timeZone:t="",showTimeZone:e=!0,showTSeparator:n=!1,defaultDateTimeFormatString:s=Qs.DEFAULT_DATETIME_FORMAT_STRING}={}){super();const i=t||Qs.DEFAULT_TIME_ZONE_ID;try{this.dhTimeZone=N.i18n.TimeZone.getTimeZone(i)}catch{Vd.error("Unsupported time zone id",i),this.dhTimeZone=N.i18n.TimeZone.getTimeZone(Qs.DEFAULT_TIME_ZONE_ID)}this.defaultDateTimeFormatString=s,this.showTimeZone=e,this.showTSeparator=n,this.formatStringMap=Qs.makeFormatStringMap(e,n)}static isValid(t){try{return N.i18n.DateTimeFormat.format(t.formatString,new Date),!0}catch{return!1}}static makeFormat(t,e,n=st.TYPE_CONTEXT_PRESET){return{label:t,formatString:e,type:n}}static isSameFormat(t,e){return t===e||t!==null&&e!==null&&t.type===e.type&&t.formatString===e.formatString}static makeGlobalFormatStringMap(t,e){const n=e?"'T'":" ",s=t?" z":"";return new Map([["yyyy-MM-dd HH:mm:ss",`yyyy-MM-dd${n}HH:mm:ss${s}`],["yyyy-MM-dd HH:mm:ss.SSS",`yyyy-MM-dd${n}HH:mm:ss.SSS${s}`],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS",`yyyy-MM-dd${n}HH:mm:ss.SSSSSSSSS${s}`]])}static getGlobalFormats(t,e){return[...Qs.makeGlobalFormatStringMap(t,e).keys()]}static makeFormatStringMap(t,e){const n=e!==void 0&&e?"'T'":" ",s=t!==void 0&&t?" z":"";return new Map([["yyyy-MM-dd",`yyyy-MM-dd${s}`],["MM-dd-yyyy",`MM-dd-yyyy${s}`],["HH:mm:ss",`HH:mm:ss${s}`],["HH:mm:ss.SSS",`HH:mm:ss.SSS${s}`],["HH:mm:ss.SSSSSSSSS",`HH:mm:ss.SSSSSSSSS${s}`],["yyyy-MM-dd HH:mm:ss",`yyyy-MM-dd${n}HH:mm:ss${s}`],["yyyy-MM-dd HH:mm:ss.SSS",`yyyy-MM-dd${n}HH:mm:ss.SSS${s}`],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS",`yyyy-MM-dd${n}HH:mm:ss.SSSSSSSSS${s}`]])}static getFormats(t,e){return[...Qs.makeFormatStringMap(t,e).keys()]}getEffectiveFormatString(t){var e;return(e=this.formatStringMap.get(t))!=null?e:t}format(t,e){const n=e&&e.formatString||this.defaultDateTimeFormatString,s=this.getEffectiveFormatString(n);try{return N.i18n.DateTimeFormat.format(s,t,this.dhTimeZone)}catch{Vd.error("Invalid format arguments")}return""}};let ht=Qs;ht.DEFAULT_DATETIME_FORMAT_STRING="yyyy-MM-dd HH:mm:ss.SSS";ht.DEFAULT_TIME_ZONE_ID="America/New_York";const vb=X.module("DecimalColumnFormatter"),Gn=class extends st{constructor({defaultFormatString:t=Gn.DEFAULT_FORMAT_STRING}={}){super(),this.defaultFormatString=t}static isValid(t){try{return N.i18n.NumberFormat.format(t.formatString,0),!0}catch{return!1}}static makeFormat(t,e,n=st.TYPE_CONTEXT_PRESET,s){return{label:t,type:n,formatString:e,multiplier:s}}static makePresetFormat(t,e="",n){return Gn.makeFormat(t,e,st.TYPE_CONTEXT_PRESET,n)}static makeCustomFormat(t="",e){return Gn.makeFormat("Custom Format",t,st.TYPE_CONTEXT_CUSTOM,e)}static isSameFormat(t,e){return t===e||t!=null&&e!=null&&t.type===e.type&&t.formatString===e.formatString&&t.multiplier===e.multiplier}format(t,e){const n=e&&e.formatString||this.defaultFormatString,s=e&&e.multiplier!==void 0&&e.multiplier!==0?t*e.multiplier:t;try{return N.i18n.NumberFormat.format(n,s)}catch{vb.error("Invalid format arguments")}return""}};let We=Gn;We.DEFAULT_FORMAT_STRING="###,##0.0000";We.FORMAT_PERCENT=Gn.makePresetFormat("Percent","##0.00%");We.FORMAT_BASIS_POINTS=Gn.makePresetFormat("Basis Points","###,##0 bp",1e4);We.FORMAT_MILLIONS=Gn.makePresetFormat("Millions","###,##0.000 mm",1e-6);We.FORMAT_ROUND=Gn.makePresetFormat("Round","###,##0");We.FORMAT_ROUND_TWO_DECIMALS=Gn.makePresetFormat("0.00","###,##0.00");We.FORMAT_ROUND_FOUR_DECIMALS=Gn.makePresetFormat("0.0000","###,##0.0000");class Tb extends st{format(e){return`${e}`}}const Eb=X.module("IntegerColumnFormatter"),Mo=class extends st{constructor({defaultFormatString:t=Mo.DEFAULT_FORMAT_STRING}={}){super(),this.defaultFormatString=t}static isValid(t){try{return N.i18n.NumberFormat.format(t.formatString,0),!0}catch{return!1}}static makeFormat(t,e,n=st.TYPE_CONTEXT_PRESET,s){return{label:t,type:n,formatString:e,multiplier:s}}static makePresetFormat(t,e="",n){return Mo.makeFormat(t,e,st.TYPE_CONTEXT_PRESET,n)}static makeCustomFormat(t="",e){return Mo.makeFormat("Custom Format",t,st.TYPE_CONTEXT_CUSTOM,e)}static isSameFormat(t,e){return t===e||t!=null&&e!=null&&t.type===e.type&&t.formatString===e.formatString&&t.multiplier===e.multiplier}format(t,e){const n=e&&e.formatString||this.defaultFormatString,s=e&&e.multiplier!==void 0&&e.multiplier!==0?t*e.multiplier:t;try{return N.i18n.NumberFormat.format(n,s)}catch{Eb.error("Invalid format arguments")}return""}};let mt=Mo;mt.DEFAULT_FORMAT_STRING="###,##0";mt.FORMAT_MILLIONS=Mo.makePresetFormat("Millions","###,##0.000 mm",1e-6);class yb extends st{format(e){return e}}const Gt=class{static makeDateWrapper(t,e,n=0,s=1,i=0,o=0,r=0,l=0){if(!t)throw new Error("No timezone provided");const a=`${e}`.padStart(4,"0"),c=`${n+1}`.padStart(2,"0"),h=`${s}`.padStart(2,"0"),u=`${i}`.padStart(2,"0"),m=`${o}`.padStart(2,"0"),p=`${r}`.padStart(2,"0"),g=`${l}`.padStart(9,"0"),f=`${a}-${c}-${h} ${u}:${m}:${p}.${g}`;return N.i18n.DateTimeFormat.parse(Gt.FULL_DATE_FORMAT,f,N.i18n.TimeZone.getTimeZone(t))}static getNextNanos(t){const e=parseInt(t,10),n="0".repeat(9-t.length),s=`${e+1}${n}`;return parseInt(s,10)}static getNextDate(t,e,n){let{year:s,month:i,date:o,hours:r,minutes:l,seconds:a,nanos:c}=e;if(t.nanos!=null){if(t.nanos.length===9)return null;c=Gt.getNextNanos(t.nanos),c>999999999&&(a+=1,c=0)}else t.seconds!=null?a+=1:t.minutes!=null?l+=1:t.hours!=null?r+=1:t.date!=null?o+=1:t.month!=null?i+=1:s+=1;const h=new Date(s,i,o,r,l,a);return Gt.makeDateWrapper(n,h.getFullYear(),h.getMonth(),h.getDate(),h.getHours(),h.getMinutes(),h.getSeconds(),c)}static parseMonth(t){const e=parseInt(t,10);if(!Number.isNaN(e))return e>=1&&e<=12?e-1:NaN;const n=t.trim().toLowerCase();if(n.length>=3){for(let s=0;s<Gt.months.length;s+=1)if(Gt.months[s].startsWith(n))return s}return NaN}static parseDateValues(t,e,n,s,i,o,r){const l=parseInt(t,10),a=e!=null?this.parseMonth(e):0,c=n!=null?parseInt(n,10):1,h=s!=null?parseInt(s,10):0,u=i!=null?parseInt(i,10):0,m=o!=null?parseInt(o,10):0,p=r!=null?parseInt(r.padEnd(9,"0"),10):0;return Number.isNaN(l)||Number.isNaN(a)||Number.isNaN(c)||Number.isNaN(h)||Number.isNaN(u)||Number.isNaN(m)||Number.isNaN(p)?null:{year:l,month:a,date:c,hours:h,minutes:u,seconds:m,nanos:p}}static parseDateTimeString(t){const n=/\s*(\d{4})([-./]([\da-z]+))?([-./](\d{1,2}))?([tT\s](\d{2})([:](\d{2}))?([:](\d{2}))?([.](\d{1,9}))?)?(.*)/.exec(t);if(n==null)throw new Error(`Unexpected date string: ${t}`);const[,s,,i,,o,,r,,l,,a,,c,h]=n;if(h!=null&&h.length>0)throw new Error(`Unexpected characters after date string '${t}': ${h}`);return{year:s,month:i,date:o,hours:r,minutes:l,seconds:a,nanos:c}}static parseDateRange(t,e){const n=t.trim().toLowerCase();if(n.length===0)throw new Error("Cannot parse date range from empty string");if(n==="null")return[null,null];if(n==="today"){const l=new Date(Date.now()),a=Gt.makeDateWrapper(e,l.getFullYear(),l.getMonth(),l.getDate()),c=Gt.makeDateWrapper(e,l.getFullYear(),l.getMonth(),l.getDate()+1);return[a,c]}if(n==="yesterday"){const l=new Date(Date.now()),a=Gt.makeDateWrapper(e,l.getFullYear(),l.getMonth(),l.getDate()-1),c=Gt.makeDateWrapper(e,l.getFullYear(),l.getMonth(),l.getDate());return[a,c]}if(n==="now"){const l=new Date(Date.now());return[N.DateWrapper.ofJsDate(l),null]}const s=Gt.parseDateTimeString(n);if(s.year==null&&s.month==null&&s.date==null)throw new Error(`Unable to extract year, month, or day ${n}`);const i=Gt.parseDateValues(s.year,s.month,s.date,s.hours,s.minutes,s.seconds,s.nanos);if(i==null)throw new Error(`Unable to extract date values from ${s}`);const o=Gt.makeDateWrapper(e,i.year,i.month,i.date,i.hours,i.minutes,i.seconds,i.nanos),r=Gt.getNextDate(s,i,e);return[o,r]}static getJsDate(t){return typeof t=="number"?new Date(t):t.asDate()}};let ms=Gt;ms.FULL_DATE_FORMAT="yyyy-MM-dd HH:mm:ss.SSSSSSSSS";ms.months=["january","february","march","april","may","june","july","august","september","october","november","december"];class qt{}qt.not="not";qt.and="and";qt.or="or";function Ib(t){if(!(t==="not"||t==="and"||t==="or"))throw new Error("operator is not a valid FilterOperatorValue")}class q{}q.eq="eq";q.eqIgnoreCase="eqIgnoreCase";q.notEq="notEq";q.notEqIgnoreCase="notEqIgnoreCase";q.greaterThan="greaterThan";q.greaterThanOrEqualTo="greaterThanOrEqualTo";q.lessThan="lessThan";q.lessThanOrEqualTo="lessThanOrEqualTo";q.in="in";q.inIgnoreCase="inIgnoreCase";q.notIn="notIn";q.notInIgnoreCase="notInIgnoreCase";q.isTrue="isTrue";q.isFalse="isFalse";q.isNull="isNull";q.invoke="invoke";q.contains="contains";q.notContains="notContains";q.startsWith="startsWith";q.endsWith="endsWith";q.containsAny="containsAny";function Rb(t){switch(t){case q.eq:return"is exactly";case q.eqIgnoreCase:return"is exactly (ignore case)";case q.notEq:return"is not exactly";case q.notEqIgnoreCase:return"is not exactly (ignore case)";case q.contains:return"contains";case q.notContains:return"does not contain";case q.startsWith:return"starts with";case q.endsWith:return"ends with";default:throw new Error(`Unrecognized text filter type ${t}`)}}function Db(t){switch(t){case q.eq:return"is equal to";case q.notEq:return"is not equal to";case q.greaterThan:return"greater than";case q.greaterThanOrEqualTo:return"greater than or equal to";case q.lessThan:return"less than";case q.lessThanOrEqualTo:return"less than or equal to";default:throw new Error(`Unrecognized number filter type ${t}`)}}function Nb(t){switch(t){case q.eq:return"date is";case q.notEq:return"date is not";case q.notEqIgnoreCase:case q.greaterThan:return"date is after";case q.greaterThanOrEqualTo:return"date is after or equal";case q.lessThan:return"date is before";case q.lessThanOrEqualTo:return"date is before or equal";default:throw new Error(`Unrecognized date filter type ${t}`)}}function Mb(t){switch(t){case q.isTrue:return"Is True";case q.isFalse:return"Is False";case q.isNull:return"Is Null";default:throw new Error(`Unrecognized boolean filter type ${t}`)}}const ts=X.module("TableUtils"),ee=class{static getSortIndex(t,e){var n;for(let s=0;s<t.length;s+=1)if(((n=t[s].column)==null?void 0:n.index)===e)return s;return null}static getSortForColumn(t,e){const n=ee.getSortIndex(t,e);return n!=null?t[n]:null}static getFilterText(t){return t?t.toString():null}static getFilterTypes(t){return ee.isBooleanType(t)?[q.isTrue,q.isFalse,q.isNull]:ee.isCharType(t)||ee.isNumberType(t)||ee.isDateType(t)?[q.eq,q.notEq,q.greaterThan,q.greaterThanOrEqualTo,q.lessThan,q.lessThanOrEqualTo]:ee.isTextType(t)?[q.eq,q.eqIgnoreCase,q.notEq,q.notEqIgnoreCase,q.contains,q.notContains,q.startsWith,q.endsWith]:[]}static getNextSort(t,e,n){if(t==null||n<0||n>=t.length)return null;const s=ee.getSortForColumn(e,n);return s===null?t[n].sort().asc():s.direction===ee.sortDirection.ascending?s.desc():null}static makeColumnSort(t,e,n,s){if(t==null||e<0||e>=t.length||n===ee.sortDirection.none)return null;let i=t[e].sort();switch(n){case ee.sortDirection.ascending:i=i.asc();break;case ee.sortDirection.descending:i=i.desc();break}return s&&(i=i.abs()),i}static toggleSortForColumn(t,e,n,s=!1){if(n<0||n>=e.length)return[];const i=ee.getNextSort(e,t,n);return ee.setSortForColumn(t,n,i,s)}static sortColumn(t,e,n,s,i,o){if(t==null||n<0||n>=e.length)return[];const r=ee.makeColumnSort(e,n,s,i);return ee.setSortForColumn(t,n,r,o)}static setSortForColumn(t,e,n,s=!1){const i=ee.getSortIndex(t,e);let o=[];return s&&(o=o.concat(t.filter(({direction:r})=>r!==ee.sortDirection.reverse)),i!==null&&o.splice(i,1)),n!==null&&o.push(n),o}static getNormalizedType(t){switch(t){case"boolean":case"java.lang.Boolean":case ee.dataType.BOOLEAN:return ee.dataType.BOOLEAN;case"char":case"java.lang.Character":case ee.dataType.CHAR:return ee.dataType.CHAR;case"java.lang.String":case ee.dataType.STRING:return ee.dataType.STRING;case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":case ee.dataType.DATETIME:return ee.dataType.DATETIME;case"double":case"java.lang.Double":case"float":case"java.lang.Float":case"java.math.BigDecimal":case ee.dataType.DECIMAL:return ee.dataType.DECIMAL;case"int":case"java.lang.Integer":case"long":case"java.lang.Long":case"short":case"java.lang.Short":case"byte":case"java.lang.Byte":case"java.math.BigInteger":case ee.dataType.INT:return ee.dataType.INT;default:return ee.dataType.UNKNOWN}}static isLongType(t){switch(t){case"long":case"java.lang.Long":return!0;default:return!1}}static isDateType(t){switch(t){case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":return!0;default:return!1}}static isNumberType(t){return ee.isIntegerType(t)||ee.isDecimalType(t)}static isIntegerType(t){switch(t){case"int":case"java.lang.Integer":case"java.math.BigInteger":case"long":case"java.lang.Long":case"short":case"java.lang.Short":case"byte":case"java.lang.Byte":return!0;default:return!1}}static isDecimalType(t){switch(t){case"double":case"java.lang.Double":case"java.math.BigDecimal":case"float":case"java.lang.Float":return!0;default:return!1}}static isBooleanType(t){switch(t){case"boolean":case"java.lang.Boolean":return!0;default:return!1}}static isCharType(t){switch(t){case"char":case"java.lang.Character":return!0;default:return!1}}static isStringType(t){switch(t){case"java.lang.String":return!0;default:return!1}}static isTextType(t){return this.isStringType(t)||this.isCharType(t)}static getBaseType(t){return t.split("[]")[0]}static isCompatibleType(t,e){return ee.getNormalizedType(t)===ee.getNormalizedType(e)}static makeQuickFilter(t,e,n){const s=e.split("||");let i=null;for(let o=0;o<s.length;o+=1){const l=s[o].split("&&");let a=null;for(let c=0;c<l.length;c+=1){const h=l[c].trim();if(h.length>0){const u=ee.makeQuickFilterFromComponent(t,h,n);if(u)a?a=a.and(u):a=u;else throw new Error(`Unable to parse quick filter from text ${e}`)}}i&&a?i=i.or(a):i=a}return i}static makeQuickFilterFromComponent(t,e,n){const{type:s}=t;return ee.isNumberType(s)?this.makeQuickNumberFilter(t,e):ee.isBooleanType(s)?this.makeQuickBooleanFilter(t,e):n!=null&&ee.isDateType(s)?this.makeQuickDateFilter(t,e,n):ee.isCharType(s)?this.makeQuickCharFilter(t,e):this.makeQuickTextFilter(t,e)}static makeQuickNumberFilter(t,e){if(e==null)return null;const n=t.filter();let s=null;const o=/\s*(>=|<=|=>|=<|>|<|!=|=|!)?(\s*-\s*)?(\s*\d*(?:,\d{3})*(?:\.\d*)?\s*)?(null|nan|infinity|inf|\u221E)?(.*)/i.exec(e);let r=null,l=null,a=null,c=null,h=null;if(o!==null&&o.length>3&&([,r,l,a,c,h]=o),h!=null&&h.trim().length>0)return null;if(r==null&&(r="="),c!=null){if(!(r==="="||r==="!"||r==="!="))return null;switch(c=c.trim().toLowerCase(),c){case"null":s=n.isNull();break;case"nan":s=N.FilterCondition.invoke("isNaN",n);break;case"infinity":case"inf":case"\u221E":l!=null?s=N.FilterCondition.invoke("isInf",n).and(n.lessThan(N.FilterValue.ofNumber(0))):s=N.FilterCondition.invoke("isInf",n).and(n.greaterThan(N.FilterValue.ofNumber(0)));break}return s!==null&&(r==="!"||r==="!=")&&(s=s.not()),s}if(a==null)return null;if(a=ee.removeCommas(a),ee.isLongType(t.type))try{a=N.FilterValue.ofNumber(N.LongWrapper.ofString(`${l!=null?"-":""}${a}`))}catch(u){return ts.warn("Unable to create long filter",u),null}else{if(a=parseFloat(a),a==null||Number.isNaN(a))return null;a=N.FilterValue.ofNumber(l!=null?0-a:a)}return s=t.filter(),ee.makeRangeFilterWithOperation(s,r,a)}static makeQuickTextFilter(t,e){if(e==null)return null;const n=`${e}`.trim(),i=/^(!~|!=|~|=|!)?(.*)/.exec(n);let o=null,r=null;if(i!==null&&i.length>2&&([,o,r]=i,r!=null&&(r=r.trim())),r==null||r.length===0)return null;o==null&&(o="=");const l=t.filter();if(r.toLowerCase()==="null")switch(o){case"=":return l.isNull();case"!=":case"!":return l.isNull().not();default:return null}let a=null,c=null;switch(r.startsWith("*")?(a="*",r=r.substring(1)):r.endsWith("*")&&!r.endsWith("\\*")&&(c="*",r=r.substring(0,r.length-1)),r=r.replace("\\",""),o){case"~":return l.isNull().not().and(l.invoke("matches",N.FilterValue.ofString(`(?s)(?i).*\\Q${r}\\E.*`)));case"!~":return l.isNull().or(l.invoke("matches",N.FilterValue.ofString(`(?s)(?i).*\\Q${r}\\E.*`)).not());case"!=":return a==="*"?l.isNull().or(l.invoke("matches",N.FilterValue.ofString(`(?s)(?i).*\\Q${r}\\E$`)).not()):c==="*"?l.isNull().or(l.invoke("matches",N.FilterValue.ofString(`(?s)(?i)^\\Q${r}\\E.*`)).not()):l.notEqIgnoreCase(N.FilterValue.ofString(r.toLowerCase()));case"=":return a==="*"?l.isNull().not().and(l.invoke("matches",N.FilterValue.ofString(`(?s)(?i).*\\Q${r}\\E$`))):c==="*"?l.isNull().not().and(l.invoke("matches",N.FilterValue.ofString(`(?s)(?i)^\\Q${r}\\E.*`))):l.eqIgnoreCase(N.FilterValue.ofString(r.toLowerCase()))}return null}static makeQuickBooleanFilter(t,e){if(e==null)return null;const s=/^(!=|=|!)?(.*)/.exec(`${e}`.trim());if(s===null)return null;const[,i,o]=s,r=i==="!"||i==="!=",l=o.trim().toLowerCase();let a=t.filter();try{const c=ee.makeBooleanValue(l);return c!=null&&c?a=a.isTrue():c===null?a=a.isNull():a=a.isFalse(),r?a.not():a}catch{return null}}static makeQuickDateFilter(t,e,n){const s=e.trim(),o=/\s*(>=|<=|=>|=<|>|<|!=|!|=)?(.*)/.exec(s);if(o==null||o.length<=2)throw new Error(`Unable to parse date filter: ${e}`);let r=null,l=null;[,r,l]=o;let a=q.eq;switch(r){case"<":a=q.lessThan;break;case"<=":case"=<":a=q.lessThanOrEqualTo;break;case">":a=q.greaterThan;break;case">=":case"=>":a=q.greaterThanOrEqualTo;break;case"!=":case"!":a=q.notEq;break;case"=":case"==":default:a=q.eq;break}return ee.makeQuickDateFilterWithOperation(t,l,a,n)}static makeQuickDateFilterWithOperation(t,e,n=q.eq,s){if(t==null)throw new Error("Column is null");const[i,o]=ms.parseDateRange(e,s),r=i!=null?N.FilterValue.ofNumber(i):null,l=o!=null?N.FilterValue.ofNumber(o):null,a=t.filter();if(r==null)return n===q.notEq?a.isNull().not():a.isNull();switch(n){case q.eq:{if(l!=null){const c=a.greaterThanOrEqualTo(r),h=a.lessThan(l);return c.and(h)}return a.eq(r)}case q.lessThan:return a.lessThan(r);case q.lessThanOrEqualTo:return l!=null?a.lessThan(l):a.lessThanOrEqualTo(r);case q.greaterThan:return l!=null?a.greaterThanOrEqualTo(l):a.greaterThan(r);case q.greaterThanOrEqualTo:return a.greaterThanOrEqualTo(r);case q.notEq:{if(l!=null){const c=a.lessThan(r),h=a.greaterThanOrEqualTo(l);return c.or(h)}return a.notEq(r)}default:throw new Error(`Invalid operator: ${n}`)}}static quoteValue(t){return t.length>=2&&(t.charAt(0)==='"'&&t.charAt(t.length-1)==='"'||t.charAt(0)==="'"&&t.charAt(t.length-1)==="'")?t:`"${t}"`}static isRangeOperation(t){switch(t){case"<":case"<=":case"=<":case">":case">=":case"=>":return!0;default:return!1}}static makeQuickCharFilter(t,e){if(e==null)return null;const n=`${e}`.trim(),i=/^(>=|<=|=>|=<|>|<|!=|=|!)?(null|"."|'.'|.)?(.*)/.exec(n);let o=null,r=null,l=null;if(i!==null&&i.length>3&&([,o,r,l]=i),l!=null&&l.trim().length>0||r==null||r.length===0)return null;o==null&&(o="=");const a=t.filter();if(r.toLowerCase()==="null")switch(o){case"=":return a.isNull();case"!=":case"!":return a.isNull().not();default:return null}const c=N.FilterValue.ofString(ee.isRangeOperation(o)?ee.quoteValue(r):r);return ee.makeRangeFilterWithOperation(a,o,c)}static makeRangeFilterWithOperation(t,e,n){switch(e){case"=":return t.eq(n);case"<":return t.lessThan(n);case"<=":case"=<":return t.lessThanOrEqualTo(n);case">":return t.greaterThan(n);case">=":case"=>":return t.greaterThanOrEqualTo(n);case"!=":case"!":return t.notEq(n);default:return null}}static makeCancelableTablePromise(t){return Re.makeCancelable(t,e=>{e.close()})}static makeCancelableTableEventPromise(t,e,n=0,s=null){let i,o,r=!0;const l=new Promise((a,c)=>{o=setTimeout(()=>{i(),r=!1,c(new iu(`Event "${e}" timed out.`))},n),i=t.addEventListener(e,h=>{if(s!=null&&!s(h)){ts.debug2("Event triggered, but matcher returned false.");return}ts.debug2("Event triggered, resolving."),i(),clearTimeout(o),r=!1,a(h)})});return l.cancel=()=>{if(r){ts.debug2("Pending promise cleanup."),i(),clearTimeout(o),r=!1;return}ts.debug2("Ignoring non-pending promise cancel.")},l}static makeAdvancedFilter(t,e,n){const{filterItems:s,filterOperators:i,invertSelection:o,selectedValues:r}=e;let l=null;for(let c=0;c<s.length;c+=1){const h=s[c],{selectedType:u,value:m}=h;if(u!=null&&u.length>0&&m!=null&&m.length>0)try{const p=ee.makeAdvancedValueFilter(t,u,m,n);if(p!=null){if(c===0)l=p;else if(l!==null&&c-1<i.length){const g=i[c-1];if(g===qt.and)l=l.and(p);else if(g===qt.or)l=l.or(p);else{ts.error("Unexpected filter operator",g,p),l=null;break}}}else ts.debug2("Empty filter ignored for",u,m)}catch(p){ts.error("Unable to create filter",p),l=null;break}}const a=ee.makeSelectValueFilter(t,r,o);return a!=null&&(l!=null?l=l.and(a):l=a),l}static removeCommas(t){return t.replace(/[\s|,]/g,"")}static makeFilterValue(t,e){const n=ee.getBaseType(t);return ee.isTextType(n)?N.FilterValue.ofString(e):ee.isLongType(n)?N.FilterValue.ofNumber(N.LongWrapper.ofString(ee.removeCommas(e))):N.FilterValue.ofNumber(ee.removeCommas(e))}static makeFilterRawValue(t,e){return ee.isTextType(t)?N.FilterValue.ofString(e):ee.isBooleanType(t)?N.FilterValue.ofBoolean(e):N.FilterValue.ofNumber(e)}static makeValue(t,e,n){if(e==null||e==="null")return null;if(ee.isTextType(t))return e;if(ee.isLongType(t))return N.LongWrapper.ofString(ee.removeCommas(e));if(ee.isBooleanType(t))return ee.makeBooleanValue(e,!0);if(ee.isDateType(t)){const[s]=ms.parseDateRange(e,n);return s}return ee.isNumberType(t)?ee.makeNumberValue(e):(ts.error("Unexpected column type",t),null)}static makeBooleanValue(t,e=!1){if(t===""&&e)return null;switch(t==null?void 0:t.toLowerCase()){case"null":return null;case"0":case"f":case"fa":case"fal":case"fals":case"false":case"n":case"no":return!1;case"1":case"t":case"tr":case"tru":case"true":case"y":case"ye":case"yes":return!0;default:throw new Error(`Invalid boolean '${t}'`)}}static makeNumberValue(t){if(t==null||t==="null"||t==="")return null;const e=t.toLowerCase().trim();if(e==="\u221E"||e==="infinity"||e==="inf")return Number.POSITIVE_INFINITY;if(e==="-\u221E"||e==="-infinity"||e==="-inf")return Number.NEGATIVE_INFINITY;const n=ee.removeCommas(e);if(ee.NUMBER_REGEX.test(n))return parseFloat(n);throw new Error(`Invalid number '${t}'`)}static getFilterOperatorString(t){switch(t){case q.eq:return"=";case q.notEq:return"!=";case q.greaterThan:return">";case q.greaterThanOrEqualTo:return">=";case q.lessThan:return"<";case q.lessThanOrEqualTo:return"<=";case q.contains:return"~";case q.notContains:return"!~";default:throw new Error(`Unexpected filter type ${t}`)}}static makeAdvancedValueFilter(t,e,n,s){if(ee.isDateType(t.type))return ee.makeQuickDateFilterWithOperation(t,n,e,s);if(ee.isNumberType(t.type)||ee.isCharType(t.type))return ee.makeQuickFilter(t,`${ee.getFilterOperatorString(e)}${n}`);const i=ee.makeFilterValue(t.type,n),o=t.filter();switch(e){case q.eq:return o.eq(i);case q.eqIgnoreCase:return o.eqIgnoreCase(i);case q.notEq:return o.notEq(i);case q.notEqIgnoreCase:return o.notEqIgnoreCase(i);case q.greaterThan:return o.greaterThan(i);case q.greaterThanOrEqualTo:return o.greaterThanOrEqualTo(i);case q.lessThan:return o.lessThan(i);case q.lessThanOrEqualTo:return o.lessThanOrEqualTo(i);case q.isTrue:return o.isTrue();case q.isFalse:return o.isFalse();case q.isNull:return o.isNull();case q.contains:return o.isNull().not().and(o.invoke("matches",N.FilterValue.ofString(`(?s)(?i).*\\Q${n}\\E.*`)));case q.notContains:return o.isNull().or(o.invoke("matches",N.FilterValue.ofString(`(?s)(?i).*\\Q${n}\\E.*`)).not());case q.startsWith:return o.isNull().not().and(o.invoke("matches",N.FilterValue.ofString(`(?s)(?i)^\\Q${n}\\E.*`)));case q.endsWith:return o.isNull().not().and(o.invoke("matches",N.FilterValue.ofString(`(?s)(?i).*\\Q${n}\\E$`)));case q.in:case q.inIgnoreCase:case q.notIn:case q.notInIgnoreCase:case q.invoke:default:throw new Error(`Unexpected filter operation: ${e}`)}}static makeSelectValueFilter(t,e,n){if(e.length===0){if(n)return null;let o=null;ee.isTextType(t.type)?o=N.FilterValue.ofString("a"):ee.isBooleanType(t.type)?o=N.FilterValue.ofBoolean(!0):ee.isDateType(t.type)?o=N.FilterValue.ofNumber(N.DateWrapper.ofJsDate(new Date)):o=N.FilterValue.ofNumber(0);const r=t.filter().eq(o),l=t.filter().notEq(o);return r.and(l)}const s=[];let i=!1;for(let o=0;o<e.length;o+=1){const r=e[o];r==null?i=!0:ee.isTextType(t.type)?s.push(N.FilterValue.ofString(typeof r=="number"?String.fromCharCode(r):r)):ee.isBooleanType(t.type)?s.push(N.FilterValue.ofBoolean(Boolean(r))):s.push(N.FilterValue.ofNumber(r))}return i?s.length>0?n?t.filter().isNull().not().and(t.filter().notIn(s)):t.filter().isNull().or(t.filter().in(s)):n?t.filter().isNull().not():t.filter().isNull():n?t.filter().notIn(s):t.filter().in(s)}static isTreeTable(t){return t!=null&&t.expand!==void 0&&t.collapse!==void 0}static sortColumns(t,e=!0){return[...t].sort((n,s)=>{const i=n.name.toUpperCase(),o=s.name.toUpperCase();return on.sort(i,o,e)})}};let P=ee;P.dataType={BOOLEAN:"boolean",CHAR:"char",DATETIME:"datetime",DECIMAL:"decimal",INT:"int",STRING:"string",UNKNOWN:"unknown"};P.sortDirection={ascending:"ASC",descending:"DESC",reverse:"REVERSE",none:null};P.REVERSE_TYPE=Object.freeze({NONE:"none",PRE_SORT:"pre-sort",POST_SORT:"post-sort"});P.NUMBER_REGEX=/^-?\d+(\.\d+)?$/;class pn{static makeColumnFormatMap(e){return e==null?new Map:e.reduce((n,s)=>{const i=P.getNormalizedType(s.columnType);if(i===null)return n;n.has(i)||n.set(i,new Map);const o=n.get(i);return o==null||o.set(s.columnName,s.format),n},new Map)}static makeColumnFormattingRule(e,n,s){return{columnType:e,columnName:n,format:s}}constructor(e=[],n,s,i,o=!1){this.defaultColumnFormatter=new Tb,this.typeFormatterMap=new Map([[P.dataType.BOOLEAN,new Sb],[P.dataType.CHAR,new wb],[P.dataType.DATETIME,new ht(n)],[P.dataType.DECIMAL,new We(s)],[P.dataType.INT,new mt(i)],[P.dataType.STRING,new yb]]),this.columnFormatMap=pn.makeColumnFormatMap(e),this.truncateNumbersWithPound=o}getColumnFormatMapForType(e,n=!1){const s=P.getNormalizedType(e);if(s!==null)return n&&!this.columnFormatMap.has(s)&&this.columnFormatMap.set(s,new Map),this.columnFormatMap.get(s)}getColumnFormat(e,n){var i;const s=this.getColumnFormatMapForType(e);return(i=s==null?void 0:s.get(n))!=null?i:null}getColumnTypeFormatter(e){var i;const n=P.getNormalizedType(e);let s=this.defaultColumnFormatter;return n&&(s=(i=this.typeFormatterMap.get(n))!=null?i:s),s}getFormattedString(e,n,s="",i){if(e==null)return"";const o=this.getColumnTypeFormatter(n),r=i||this.getColumnFormat(n,s);return o.format(e,r!=null?r:void 0)}get timeZone(){var n;const e=this.typeFormatterMap.get(P.dataType.DATETIME);return(n=e==null?void 0:e.dhTimeZone)==null?void 0:n.id}}function Fb(t){if(t&&t.formatter){const{formatter:e}=t;return e}}function xb(t){return{timeZone:t==null?void 0:t.timeZone,defaultDateTimeFormatString:t==null?void 0:t.defaultDateTimeFormat,showTimeZone:t==null?void 0:t.showTimeZone,showTSeparator:t==null?void 0:t.showTSeparator}}function _b(t,e,n){const s=t.getColumnFormat(n,e);return s!=null&&(s.type===st.TYPE_CONTEXT_PRESET||s.type===st.TYPE_CONTEXT_CUSTOM)}const us={getColumnFormats:Fb,getDateTimeFormatterOptions:xb,isCustomColumnFormatDefined:_b};Vr.register([Jp,eg,tg,ng,sg,ig]);const Wu=typeof Ql=="function"?Ql(Vr):Ql.default(Vr),os=class{constructor(){this.listeners=[],this.isDownsamplingDisabled=!1}getData(){return[]}getDefaultTitle(){return""}getLayout(){return{}}getFilterColumnMap(){return new Map}isFilterRequired(){return!1}setFilter(t){}close(){}setFormatter(t){this.formatter=t}setDownsamplingDisabled(t){this.isDownsamplingDisabled=t}setDimensions(t){this.rect=t}setTitle(t){this.title=t}subscribe(t){this.listeners.push(t)}unsubscribe(t){this.listeners=this.listeners.filter(e=>e!==t)}fireEvent(t){for(let e=0;e<this.listeners.length;e+=1)this.listeners[e](t)}fireUpdate(t){this.fireEvent(new CustomEvent(os.EVENT_UPDATED,{detail:t}))}fireDisconnect(){this.fireEvent(new CustomEvent(os.EVENT_DISCONNECT))}fireReconnect(){this.fireEvent(new CustomEvent(os.EVENT_RECONNECT))}fireDownsampleStart(t){this.fireEvent(new CustomEvent(os.EVENT_DOWNSAMPLESTARTED,{detail:t}))}fireDownsampleFinish(t){this.fireEvent(new CustomEvent(os.EVENT_DOWNSAMPLEFINISHED,{detail:t}))}fireDownsampleFail(t){this.fireEvent(new CustomEvent(os.EVENT_DOWNSAMPLEFAILED,{detail:t}))}fireDownsampleNeeded(t){this.fireEvent(new CustomEvent(os.EVENT_DOWNSAMPLENEEDED,{detail:t}))}fireLoadFinished(){this.fireEvent(new CustomEvent(os.EVENT_LOADFINISHED))}};let Et=os;Et.EVENT_UPDATED="ChartModel.EVENT_UPDATED";Et.EVENT_DISCONNECT="ChartModel.EVENT_DISCONNECT";Et.EVENT_RECONNECT="ChartModel.EVENT_RECONNECT";Et.EVENT_DOWNSAMPLESTARTED="ChartModel.EVENT_DOWNSAMPLESTARTED";Et.EVENT_DOWNSAMPLEFINISHED="ChartModel.EVENT_DOWNSAMPLEFINISHED";Et.EVENT_DOWNSAMPLEFAILED="ChartModel.EVENT_DOWNSAMPLEFAILED";Et.EVENT_DOWNSAMPLENEEDED="ChartModel.EVENT_DOWNSAMPLENEEDED";Et.EVENT_LOADFINISHED="ChartModel.EVENT_LOADFINISHED";const Lb="#76d9e4 #9edc6f #fcd65b #aa9af4 #f37e3f #f95d84 #f0f0ee",kb="#403e41",Ob="#5b5a5c",Ab="#c0bfbf",Pb="#4878ea",Hb="rgba(91, 90, 92, 0.7)",Dt={"paper-bgcolor":"#2d2a2e","plot-bgcolor":"#322f33","title-color":"#f0f0ee",colorway:Lb,gridcolor:kb,linecolor:Ob,zerolinecolor:Ab,activecolor:Pb,rangebgcolor:Hb,"area-color":"#76d9e4","trend-color":"#d5f0c1","line-color":"#9edc6f","error-band-line-color":"white","error-band-fill-color":"rgba(213, 240, 193, 0.1)","ohlc-increasing":"#9edc6f","ohlc-decreasing":"#f95d84"},cn=Object.freeze({paper_bgcolor:Dt["paper-bgcolor"],plot_bgcolor:Dt["plot-bgcolor"],title_color:Dt["title-color"],colorway:Dt.colorway,gridcolor:Dt.gridcolor,linecolor:Dt.linecolor,zerolinecolor:Dt.zerolinecolor,activecolor:Dt.activecolor,rangebgcolor:Dt.rangebgcolor,area_color:Dt["area-color"],trend_color:Dt["trend-color"],line_color:Dt["line-color"],error_band_line_color:Dt["error-band-line-color"],error_band_fill_color:Dt["error-band-fill-color"],ohlc_increasing:Dt["ohlc-increasing"],ohlc_decreasing:Dt["ohlc-decreasing"]}),gr=X.module("ChartUtils"),ws=Object.freeze(N.calendar.DayOfWeek.values()),Ud="io.deephaven.time.DateTime",Vb=36e5,Ub=1e6;function Bb(t){return t.asDate!==void 0}function $b(t){return t.asNumber!==void 0}function Bd(t){return t.dhTimeZone!==void 0}function Wb(t){return t!=null&&t.range&&(t.autorange===!1||t.autorange===void 0)}const re=class{static getPlotlyChartType(t,e){switch(t){case N.plot.SeriesPlotStyle.SCATTER:return e?"scatter":"scattergl";case N.plot.SeriesPlotStyle.LINE:return"scatter";case N.plot.SeriesPlotStyle.BAR:case N.plot.SeriesPlotStyle.STACKED_BAR:return"bar";case N.plot.SeriesPlotStyle.PIE:return"pie";case N.plot.SeriesPlotStyle.TREEMAP:return"treemap";case N.plot.SeriesPlotStyle.HISTOGRAM:return"histogram";case N.plot.SeriesPlotStyle.OHLC:return"ohlc";default:return}}static getPlotlyChartMode(t){switch(t){case N.plot.SeriesPlotStyle.SCATTER:return"markers";case N.plot.SeriesPlotStyle.LINE:return"lines";default:return}}static getPlotlyProperty(t,e){switch(t){case N.plot.SeriesPlotStyle.PIE:switch(e){case N.plot.SourceType.X:return"labels";case N.plot.SourceType.Y:return"values"}break;case N.plot.SeriesPlotStyle.OHLC:switch(e){case N.plot.SourceType.TIME:return"x"}break;case N.plot.SeriesPlotStyle.TREEMAP:switch(e){case N.plot.SourceType.X:return"ids";case N.plot.SourceType.Y:return"values";case N.plot.SourceType.LABEL:return"labels";case N.plot.SourceType.PARENT:return"parents";case N.plot.SourceType.COLOR:return"marker.colors"}break}switch(e){case N.plot.SourceType.X:return"x";case N.plot.SourceType.Y:return"y";case N.plot.SourceType.Z:return"z";case N.plot.SourceType.X_LOW:return"xLow";case N.plot.SourceType.X_HIGH:return"xHigh";case N.plot.SourceType.Y_LOW:return"yLow";case N.plot.SourceType.Y_HIGH:return"yHigh";case N.plot.SourceType.TIME:return"time";case N.plot.SourceType.OPEN:return"open";case N.plot.SourceType.HIGH:return"high";case N.plot.SourceType.LOW:return"low";case N.plot.SourceType.CLOSE:return"close";case N.plot.SourceType.SHAPE:return"shape";case N.plot.SourceType.SIZE:return"size";case N.plot.SourceType.LABEL:return"label";case N.plot.SourceType.COLOR:return"color";case N.plot.SourceType.PARENT:return"parent";case N.plot.SourceType.HOVER_TEXT:return"hovertext";case N.plot.SourceType.TEXT:return"text";default:throw new Error(`Unrecognized source type: ${e}`)}}static getPlotlySeriesOrientation(t){var n,s;const{sources:e}=t;return e.length===2&&((s=(n=e[0])==null?void 0:n.axis)==null?void 0:s.type)===N.plot.AxisType.Y?re.ORIENTATION.HORIZONTAL:re.ORIENTATION.VERTICAL}static getPlotlyErrorBars(t,e,n){const s=n.map((o,r)=>o-t[r]),i=e.map((o,r)=>t[r]-o);return{type:"data",symmetric:!1,array:s,arrayminus:i}}static getPlotlyDateFormat(t,e,n){const s=n==null?void 0:n.replace("%","%%").replace(/S{9}/g,"%9f").replace(/S{8}/g,"%8f").replace(/S{7}/g,"%7f").replace(/S{6}/g,"%6f").replace(/S{5}/g,"%5f").replace(/S{4}/g,"%4f").replace(/S{3}/g,"%3f").replace(/S{2}/g,"%2f").replace(/S{1}/g,"%1f").replace(/y{4}/g,"%Y").replace(/y{2}/g,"%y").replace(/M{4}/g,"%B").replace(/M{3}/g,"%b").replace(/M{2}/g,"%m").replace(/M{1}/g,"%-m").replace(/E{4,}/g,"%A").replace(/E{1,}/g,"%a").replace(/d{2}/g,"%d").replace(/([^%]|^)d{1}/g,"$1%-d").replace(/H{2}/g,"%H").replace(/h{2}/g,"%I").replace(/h{1}/g,"%-I").replace(/m{2}/g,"%M").replace(/s{2}/g,"%S").replace("'T'","T").replace(" z","");let i;const o=t==null?void 0:t.getColumnTypeFormatter(e);return o!=null&&Bd(o)&&o.dhTimeZone!=null&&o.showTimeZone&&(i=N.i18n.DateTimeFormat.format(" z",new Date,o.dhTimeZone)),{tickformat:s,ticksuffix:i,automargin:!0}}static convertNumberPrefix(t){return t.replace(/\u00A4\u00A4/g,"USD").replace(/\u00A4/g,"$")}static getPlotlyNumberFormat(t,e,n){if(!n)return null;const i=n.split(";")[0].match(/^([^#,0.]*)([#,]*)([0,]*)(\.?)(0*)(#*)(E?0*)(%?)(.*)/);A(i);const[,o,r,l,,a,c,h,u,m]=i,p=l.replace(",","").length,f=r.indexOf(",")>=0||l.indexOf(",")>=0?",":"",b=h!=null&&h!==""?"e":"f",C=u!==""?u:b,v=a.length+c.length,E=`0${p}${f}.${v}${C}`,y=re.convertNumberPrefix(o),I=re.convertNumberPrefix(m);return{tickformat:E,tickprefix:y,ticksuffix:I,automargin:!0}}static getPlotlyAxisFormat(t,e=null){const{axis:n,columnType:s}=t,{formatPattern:i}=n;let o=null;return P.isDateType(s)?(o=re.getPlotlyDateFormat(e,s,i),o=re.addTickSpacing(o,n,!0)):P.isNumberType(s)&&(o=re.getPlotlyNumberFormat(e,s,i),o=re.addTickSpacing(o,n,!1)),n.formatType===N.plot.AxisFormatType.CATEGORY&&(o?o.type="category":o={type:"category",tickformat:void 0,ticksuffix:void 0}),o}static addTickSpacing(t,e,n){const{gapBetweenMajorTicks:s}=e;if(s>0){const i=t||{};let o=s;return n&&(o=s/Ub),e.log&&(o=Math.log(o)),i.tickmode="linear",i.dtick=o,i}return t}static getSourceForAxis(t,e){for(let n=0;n<t.series.length;n+=1){const s=t.series[n];for(let i=0;i<s.sources.length;i+=1){const o=s.sources[i];if(o.axis===e)return o}}return null}static getSeriesVisibility(t,e){return e!=null&&e.hiddenSeries!=null&&e.hiddenSeries.includes(t)?"legendonly":!0}static getHiddenLabels(t){return t!=null&&t.hiddenSeries?[...t.hiddenSeries]:[]}static makeSeriesData(t,e,n,s=re.ORIENTATION.VERTICAL){return{type:t,mode:e,name:n,orientation:s}}static makeSeriesDataFromSeries(t,e,n,s=cn){const{name:i,plotStyle:o,lineColor:r,shapeColor:l,sources:a}=t,c=a.some(g=>{var f;return(f=g.axis)==null?void 0:f.businessCalendar}),h=re.getChartType(o,c),u=re.getPlotlyChartMode(o),m=re.getPlotlySeriesOrientation(t),p=re.makeSeriesData(h,u,i,m);return re.addSourcesToSeriesData(p,o,a,e),re.addStylingToSeriesData(p,o,s,r,l,n),p}static addSourcesToSeriesData(t,e,n,s){const i=t;for(let o=0;o<n.length;o+=1){const r=n[o],{axis:l,type:a}=r,c=re.getPlotlyProperty(e,a);Ph(i,c,[]);const h=l!=null?re.getAxisPropertyName(l.type):null;if(h!=null){const u=s.get(l.type);if(u){const m=u.indexOf(l),p=m>0?`${m+1}`:"";i[`${h}axis`]=`${h}${p}`}}}}static addStylingToSeriesData(t,e,n=cn,s=null,i=null,o=null){const r=t;r.marker={line:{}},r.line={width:1},e===N.plot.SeriesPlotStyle.AREA?r.fill="tozeroy":e===N.plot.SeriesPlotStyle.STACKED_AREA?r.stackgroup="stack":e===N.plot.SeriesPlotStyle.STEP?r.line.shape="hv":e===N.plot.SeriesPlotStyle.HISTOGRAM?(r.width=[],r.marker.line!==void 0&&Object.assign(r.marker.line,{color:n.paper_bgcolor,width:1})):e===N.plot.SeriesPlotStyle.OHLC?(r.increasing={line:{color:n.ohlc_increasing}},r.decreasing={line:{color:n.ohlc_decreasing}}):e===N.plot.SeriesPlotStyle.PIE?(r.textinfo="label+percent",r.outsidetextfont={color:n.title_color}):e===N.plot.SeriesPlotStyle.TREEMAP&&(r.hoverinfo="text",r.textinfo="label+text",r.tiling={packing:"squarify",pad:0},r.textposition="middle center",r.outsidetextfont={color:n.title_color}),s!=null&&(e===N.plot.SeriesPlotStyle.BAR?r.marker.color=s:r.line.color=s),i!=null&&(r.marker.color=i),o!=null&&e!==N.plot.SeriesPlotStyle.PIE&&(r.visible=o)}static getAxisFormats(t,e){const n=new Map,s={tickformat:null,ticksuffix:null},{charts:i}=t;for(let o=0;o<i.length;o+=1){const r=i[o],l=re.groupArray(r.axes,"type");for(let a=0;a<r.series.length;a+=1){const c=r.series[a],{sources:h}=c,u=h.filter(m=>m.axis);for(let m=0;m<u.length;m+=1){const p=u[m],{axis:g}=p,{type:f}=g,b=l.get(f);A(b);const C=b.indexOf(g),v=re.getAxisPropertyName(f);if(v!=null){const T=re.getAxisLayoutProperty(v,C);if(n.has(T))gr.debug(`${T} already added.`);else{gr.debug(`Adding ${T} to axisFormats.`);const E=re.getPlotlyAxisFormat(p,e);if(E===null)n.set(T,s);else{n.set(T,E);const{businessCalendar:y}=g;if(y!=null){const I=[],{businessPeriods:D,businessDays:M,holidays:x,timeZone:B}=y,$=e==null?void 0:e.getColumnTypeFormatter(Ud);let k;Bd($)&&(k=$.dhTimeZone);const H=k?(B.standardOffset-k.standardOffset)/60:0;x.length>0&&I.push(...re.createRangeBreakValuesFromHolidays(x,B,k)),D.forEach(O=>I.push({pattern:"hour",bounds:[re.periodToDecimal(O.close)+H,re.periodToDecimal(O.open)+H]})),M.length<ws.length&&re.createBoundsFromDays(M).forEach(O=>I.push({pattern:"day of week",bounds:O})),E.rangebreaks=I}if(n.size===r.axes.length)return n}}}}}}return n}static getChartType(t,e){switch(t){case N.plot.SeriesPlotStyle.HISTOGRAM:return"bar";default:return re.getPlotlyChartType(t,e)}}static getAxisPropertyName(t){switch(t){case N.plot.AxisType.X:return"x";case N.plot.AxisType.Y:return"y";default:return null}}static getAxisSide(t){switch(t){case N.plot.AxisPosition.BOTTOM:return"bottom";case N.plot.AxisPosition.TOP:return"top";case N.plot.AxisPosition.LEFT:return"left";case N.plot.AxisPosition.RIGHT:return"right";default:return}}static getChartForSeries(t,e){const{charts:n}=t;for(let s=0;s<n.length;s+=1){const i=n[s];for(let o=0;o<i.series.length;o+=1)if(e===i.series[o])return i}return null}static getLayoutRanges(t){const e={},n=Object.keys(t).filter(s=>s.indexOf("axis")>=0);for(let s=0;s<n.length;s+=1){const i=n[s],o=t[i];Wb(o)&&(e[i]=[...o.range])}return e}static updateLayoutAxes(t,e,n=0,s=0,i=null,o=cn){const r=n>0?Math.max(re.MIN_AXIS_SIZE,Math.min(re.AXIS_SIZE_PX/s,re.MAX_AXIS_SIZE)):re.DEFAULT_AXIS_SIZE,l=s>0?Math.max(re.MIN_AXIS_SIZE,Math.min(re.AXIS_SIZE_PX/n,re.MAX_AXIS_SIZE)):re.DEFAULT_AXIS_SIZE,a={left:0,bottom:0,top:1,right:1},c=re.groupArray(e,"position");(c.get(N.plot.AxisPosition.RIGHT)||[]).length>0&&(n>0?a.right=1-Math.max(0,Math.min(re.LEGEND_WIDTH_PX/n,re.MAX_LEGEND_SIZE)):a.right=1-re.DEFAULT_AXIS_SIZE);const u=t,m=re.groupArray(e,"type"),p=[...m.keys()];for(let g=0;g<p.length;g+=1){const f=p[g],b=re.getAxisPropertyName(f);if(b!=null){const C=m.get(f),T=f===N.plot.AxisType.Y?s:n;A(C);let E=0;for(E=0;E<C.length;E+=1){const I=C[E],D=re.getAxisLayoutProperty(b,E);u[D]==null&&(u[D]=re.makeLayoutAxis(f,o));const M=u[D];if(M!=null){re.updateLayoutAxis(M,I,E,c,r,l,a);const{range:x,autorange:B}=M;if(i!=null&&x!==void 0&&(B===void 0||B===!1)){const $=i(I),[k,H]=$(x);gr.debug("Setting downsample range",T,k,H),I.range(T,k,H)}else I.range(T)}}let y=re.getAxisLayoutProperty(b,E);for(;u[y]!=null;)delete u[y],E+=1,y=re.getAxisLayoutProperty(b,E)}}}static getAxisLayoutProperty(t,e){const n=e>0?`${e+1}`:"";return`${t!=null?t:""}axis${n}`}static updateLayoutAxis(t,e,n,s,i,o,r){var u,m,p;const a=e.type===N.plot.AxisType.Y?o:i,c=t,h=(u=e.label)!=null?u:"";if(c.title!==void 0&&typeof c.title!="string"?c.title.text=h:c.title={text:h},e.log&&(c.type="log"),c.side=re.getAxisSide(e.position),n>0){c.overlaying=(m=re.getAxisPropertyName(e.type))!=null?m:void 0;const g=(p=s.get(e.position))!=null?p:[],f=g.indexOf(e);f>0&&(c.anchor="free",e.position===N.plot.AxisPosition.RIGHT?c.position=r.right+(f-g.length+1)*a:e.position===N.plot.AxisPosition.TOP?c.position=r.top+(f-g.length+1)*a:e.position===N.plot.AxisPosition.BOTTOM?c.position=r.bottom+(g.length-f+1)*a:e.position===N.plot.AxisPosition.LEFT&&(c.position=r.left+(g.length-f+1)*a))}else if(e.type===N.plot.AxisType.X){const g=s.get(N.plot.AxisPosition.LEFT)||[],f=s.get(N.plot.AxisPosition.RIGHT)||[],b=Math.max(r.left,r.left+(g.length-1)*o),C=Math.min(r.right-(f.length-1)*o,r.right);c.domain=[b,C]}else if(e.type===N.plot.AxisType.Y){const g=s.get(N.plot.AxisPosition.BOTTOM)||[],f=s.get(N.plot.AxisPosition.TOP)||[],b=Math.max(r.bottom,r.bottom+(g.length-1)*i),C=Math.min(r.top-(f.length-1)*i,r.top);c.domain=[b,C]}}static periodToDecimal(t){const e=t.split(":");return Number(e[0])+Number(e[1])/60}static createBoundsFromDays(t){const e=t.map(o=>ws.indexOf(o)),n=ws.filter(o=>!t.includes(o)).map(o=>ws.indexOf(o)),s=new Set;n.forEach(o=>{for(let r=o+1;r<o+ws.length;r+=1){const l=r%ws.length;if(e.includes(l)){s.add(l);break}}});const i=[];return s.forEach(o=>{for(let r=o-1;r>o-ws.length;r-=1){const l=r<0?r+ws.length:r;if(e.includes(l)){const a=(l+1)%7;i.push([a,o]);break}}}),i}static createRangeBreakValuesFromHolidays(t,e,n){const s=[],i=[];return t.forEach(o=>{o.businessPeriods.length>0?i.push(...re.createPartialHoliday(o,e,n)):s.push(re.createFullHoliday(o,e,n))}),[{values:s},...i]}static createFullHoliday(t,e,n){return re.adjustDateForTimeZone(`${t.date.toString()} 00:00:00.000000`,e,n)}static createPartialHoliday(t,e,n){const s=t.date.toString(),i=["00:00"];t.businessPeriods.forEach(r=>{i.push(r.open),i.push(r.close)}),i.push("24:00");const o=[];for(let r=0;r<i.length;r+=2){const l=i[r],a=i[r+1];if(l!==a){const c=[re.adjustDateForTimeZone(`${s} ${l}:00.000000`,e,n)],h=Vb*(re.periodToDecimal(a)-re.periodToDecimal(l));o.push({values:c,dvalue:h})}}return o}static adjustDateForTimeZone(t,e,n){return n&&n.standardOffset!==e.standardOffset?re.unwrapValue(re.wrapValue(t,Ud,e),n):t}static groupArray(t,e){return t.reduce((n,s)=>{var r;const i=s[e],o=(r=n.get(i))!=null?r:[];return o.push(s),n.set(i,o),n},new Map)}static unwrapValue(t,e){if(t!=null){if(Bb(t))return N.i18n.DateTimeFormat.format(re.DATE_FORMAT,t,e);if($b(t))return t.asNumber()}return t}static wrapValue(t,e,n=null){if(P.isDateType(e)&&typeof t=="string"){const s=t,i=re.DATE_FORMAT.substr(0,t.length),o=N.i18n.DateTimeFormat.parse(i,s);if(!n)return o;const r=`${i} Z`,l=N.i18n.DateTimeFormat.format("Z",o,n),a=N.i18n.DateTimeFormat.parse(r,`${s} ${l}`),c=N.i18n.DateTimeFormat.format("Z",a,n);return N.i18n.DateTimeFormat.parse(r,`${s} ${c}`)}return t}static makeLayoutAxis(t,e=cn){const n={automargin:!0,gridcolor:e.gridcolor,linecolor:e.linecolor,rangeslider:{visible:!1},showline:!0,ticklen:5,tickcolor:e.paper_bgcolor,tickfont:{color:e.zerolinecolor},title:{font:{color:e.title_color}}};return t===N.plot.AxisType.X?Object.assign(n,{showgrid:!0}):t===N.plot.AxisType.Y&&Object.assign(n,{zerolinecolor:e.zerolinecolor,zerolinewidth:2}),n}static getColorwayFromTheme(t=cn){let e=[];return t.colorway&&(Array.isArray(t.colorway)?e=t.colorway:typeof t.colorway=="string"?e=t.colorway.split(" "):gr.warn(`Unable to handle colorway property: ${t.colorway}`)),e}static makeDefaultLayout(t=cn){const e={...t,autosize:!0,colorway:re.getColorwayFromTheme(t),font:{family:"'Fira Sans', sans-serif"},title:{font:{color:t.title_color},yanchor:"top",pad:{...re.DEFAULT_TITLE_PADDING},y:1},legend:{font:{color:t.title_color}},margin:{...re.DEFAULT_MARGIN},xaxis:re.makeLayoutAxis(N.plot.AxisType.X,t),yaxis:re.makeLayoutAxis(N.plot.AxisType.Y,t)};return e.datarevision=0,e}static hydrateSettings(t){return{...t,type:N.plot.SeriesPlotStyle[t.type]}}static titleFromSettings(t){const{series:e,xAxis:n,title:s=`${e.join(", ")} by ${n}`}=t;return s}static makeFigureSettings(t,e){const{series:n,xAxis:s,type:i}=t,o=re.titleFromSettings(t),r={formatType:`${N.plot.AxisFormatType.NUMBER}`,type:`${N.plot.AxisType.X}`,position:`${N.plot.AxisPosition.BOTTOM}`},l={formatType:`${N.plot.AxisFormatType.NUMBER}`,type:`${N.plot.AxisType.Y}`,position:`${N.plot.AxisPosition.LEFT}`};return{charts:[{chartType:`${N.plot.ChartType.XY}`,axes:[r,l],series:n.map(a=>({plotStyle:`${i}`,name:a,dataSources:[{type:`${N.plot.SourceType.X}`,columnName:s,axis:r,table:e},{type:`${N.plot.SourceType.Y}`,columnName:a,axis:l,table:e}]}))}],title:o}}};let Pe=re;Pe.DEFAULT_AXIS_SIZE=.15;Pe.MIN_AXIS_SIZE=.025;Pe.MAX_AXIS_SIZE=.2;Pe.AXIS_SIZE_PX=75;Pe.LEGEND_WIDTH_PX=50;Pe.MAX_LEGEND_SIZE=.25;Pe.ORIENTATION=Object.freeze({HORIZONTAL:"h",VERTICAL:"v"});Pe.DATE_FORMAT="yyyy-MM-dd HH:mm:ss.SSSSSS";Pe.DEFAULT_MARGIN=Object.freeze({l:60,r:50,t:30,b:60,pad:0});Pe.DEFAULT_TITLE_PADDING=Object.freeze({t:8});Pe.SUBTITLE_LINE_HEIGHT=25;const vs=X.module("Chart"),Ro=class extends S.exports.Component{constructor(t){super(t),this.getCachedConfig=Ce((e,n,s,i)=>{const o=[],r=Boolean(e);if(r&&o.push({name:`Downsampling failed: ${e}`,click:()=>{},icon:Ro.convertIcon(nu),attr:"fill-warning"}),n||s||i||r){const l=Ro.downsampleButtonTitle(s,i),a=Ro.downsampleButtonAttr(s,i),c=s?jh:Rf;o.push({name:l,icon:Ro.convertIcon(c),click:this.handleDownsampleClick,attr:a})}return{displaylogo:!1,displayModeBar:s||r?!0:"hover",modeBarButtons:[o,["toImage"],["zoom2d","pan2d"],["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]]}}),this.handleAfterPlot=this.handleAfterPlot.bind(this),this.handleDownsampleClick=this.handleDownsampleClick.bind(this),this.handleModelEvent=this.handleModelEvent.bind(this),this.handlePlotUpdate=this.handlePlotUpdate.bind(this),this.handleRelayout=this.handleRelayout.bind(this),this.handleRestyle=this.handleRestyle.bind(this),this.plot=Y.createRef(),this.plotWrapper=Y.createRef(),this.columnFormats=[],this.dateTimeFormatterOptions={},this.decimalFormatOptions={},this.integerFormatOptions={},this.isSubscribed=!1,this.isLoadedFired=!1,this.currentSeries=0,this.state={data:null,downsamplingError:null,isDownsampleFinished:!1,isDownsampleInProgress:!1,isDownsamplingDisabled:!1,layout:{datarevision:0},revision:0}}static convertIcon(t){const[e,,,,n]=t.icon,s=`${n}`;return{width:e,path:s,ascent:e,descent:0,transform:"matrix(1, 0, 0, 1, 0, 0)"}}static downsampleButtonTitle(t,e){return t?"Downsampling in progress...":e?"Downsampling disabled, click to enable":"Downsampling enabled, click to disable"}static downsampleButtonAttr(t,e){return t?"animation-spin":e?void 0:"fill-active"}componentDidMount(){this.updateDimensions(),this.updateModelDimensions(),this.initData(),this.initFormatter();const{isActive:t}=this.props;t&&this.subscribe()}componentDidUpdate(t){const{isActive:e,settings:n}=this.props;this.updateFormatterSettings(n),e!==t.isActive&&(e?this.subscribe():this.unsubscribe())}componentWillUnmount(){this.unsubscribe()}getPlotRect(){var t,e;return(e=(t=this.plotWrapper.current)==null?void 0:t.getBoundingClientRect())!=null?e:null}initData(){const{model:t}=this.props,{layout:e}=this.state;this.setState({data:t.getData(),layout:{...e,...t.getLayout()}})}subscribe(){if(this.isSubscribed)return;const{model:t}=this.props;if(!this.rect||this.rect.width===0||this.rect.height===0){vs.debug2("Delaying subscription until model dimensions are set");return}t.subscribe(this.handleModelEvent),this.isSubscribed=!0}unsubscribe(){if(!this.isSubscribed)return;const{model:t}=this.props;t.unsubscribe(this.handleModelEvent),this.isSubscribed=!1}handleAfterPlot(){this.plot.current!=null}handleDownsampleClick(){this.setState(({isDownsamplingDisabled:t})=>({downsamplingError:null,isDownsampleInProgress:!1,isDownsampleFinished:!1,isDownsamplingDisabled:!t}),()=>{const{model:t}=this.props,{isDownsamplingDisabled:e}=this.state;t.setDownsamplingDisabled(e)})}handleModelEvent(t){var s;const{type:e,detail:n}=t;switch(vs.debug2("Received data update",e,n),e){case Et.EVENT_UPDATED:{this.currentSeries+=1,this.setState(o=>{const{layout:r,revision:l}=o;return typeof r.datarevision=="number"&&(r.datarevision+=1),{data:n,layout:r,revision:l+1}});const{onUpdate:i}=this.props;i({isLoading:!this.isLoadedFired});break}case Et.EVENT_LOADFINISHED:{const{onUpdate:i}=this.props;this.isLoadedFired=!0,i({isLoading:!1});break}case Et.EVENT_DISCONNECT:{const{onDisconnect:i}=this.props;i();break}case Et.EVENT_RECONNECT:{const{onReconnect:i}=this.props;i();break}case Et.EVENT_DOWNSAMPLESTARTED:{this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!0,downsamplingError:null});break}case Et.EVENT_DOWNSAMPLEFINISHED:{this.setState({isDownsampleFinished:!0,isDownsampleInProgress:!1,downsamplingError:null});break}case Et.EVENT_DOWNSAMPLENEEDED:case Et.EVENT_DOWNSAMPLEFAILED:{const i=(s=n.message)!=null?s:n;this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!1,isDownsamplingDisabled:!1,downsamplingError:i});const{onError:o}=this.props;o(new Error(i));break}default:vs.debug("Unknown event type",e,t)}}handlePlotUpdate(t){const{layout:e}=t,n=Pe.getLayoutRanges(e);!pt(n,this.ranges)&&(this.ranges=n,this.updateModelDimensions(!0))}handleRelayout(t){if(vs.debug("handleRelayout",t),t.hiddenlabels!=null){const{onSettingsChanged:e}=this.props,n=[...t.hiddenlabels];e({hiddenSeries:n})}this.updateModelDimensions()}handleRestyle([t,e]){if(vs.debug("handleRestyle",t,e),Object.keys(t).includes("visible")){const{data:n}=this.state,{onSettingsChanged:s}=this.props;if(n!=null){const i=n.reduce((o,{name:r,visible:l})=>r!=null&&l==="legendonly"?[...o,r]:o,[]);s({hiddenSeries:i})}}}updateModelDimensions(t=!1){const e=this.getPlotRect();if(!e){vs.warn("Unable to get plotting rect");return}if(!this.rect||this.rect.width!==e.width||this.rect.height!==e.height||t){this.rect=e;const{isActive:s,model:i}=this.props;i.setDimensions(e),s&&this.subscribe()}}initFormatter(){const{settings:t}=this.props;this.updateFormatterSettings(t)}updateFormatterSettings(t){const e=us.getColumnFormats(t),n=us.getDateTimeFormatterOptions(t),{decimalFormatOptions:s={},integerFormatOptions:i={}}=t;(!pt(this.columnFormats,e)||!pt(this.dateTimeFormatterOptions,n)||!pt(this.decimalFormatOptions,s)||!pt(this.integerFormatOptions,i))&&(this.columnFormats=us.getColumnFormats(t),this.dateTimeFormatterOptions=n,this.decimalFormatOptions=s,this.integerFormatOptions=i,this.updateFormatter())}updateFormatter(){const t=new pn(this.columnFormats,this.dateTimeFormatterOptions,this.decimalFormatOptions,this.integerFormatOptions),{model:e}=this.props;e.setFormatter(t)}updateDimensions(){const t=this.getPlotRect();this.plot.current!=null&&t!=null&&t.width>0&&t.height>0&&Vr.relayout(this.plot.current.el,{autosize:!0}).catch(e=>{vs.debug("Unable to resize, promise rejected",e)})}render(){const{data:t,downsamplingError:e,isDownsampleFinished:n,isDownsampleInProgress:s,isDownsamplingDisabled:i,layout:o,revision:r}=this.state,l=this.getCachedConfig(e,n,s,i),a=t!=null;return d("div",{className:"h-100 w-100 chart-wrapper",ref:this.plotWrapper,children:a&&d(Wu,{ref:this.plot,data:t,layout:o,revision:r,config:l,onAfterPlot:this.handleAfterPlot,onError:vs.error,onRelayout:this.handleRelayout,onUpdate:this.handlePlotUpdate,onRestyle:this.handleRestyle,useResizeHandler:!0,style:{height:"100%",width:"100%"}})})}};let zu=Ro;zu.defaultProps={isActive:!0,settings:{timeZone:"America/New_York",defaultDateTimeFormat:ms.FULL_DATE_FORMAT,showTimeZone:!1,showTSeparator:!0,formatter:[]},onDisconnect:()=>{},onReconnect:()=>{},onUpdate:()=>{},onError:()=>{},onSettingsChanged:()=>{}};const Nt=X.module("FigureChartModel"),Gu=class extends Et{constructor(t,e={},n=cn){super(),this.addPendingSeries=Je(()=>{const{pendingSeries:s}=this;for(let i=0;i<s.length;i+=1){const o=s[i];this.addSeries(o),o.subscribe()}this.pendingSeries=[]},Gu.ADD_SERIES_DEBOUNCE),this.getTimeZone=Ie((s,i)=>{if(i!=null){const o=i.getColumnTypeFormatter(s);if(o!=null)return o.dhTimeZone}return null}),this.getValueTranslator=Ie((s,i)=>{const o=this.getTimeZone(s,i);return r=>Pe.unwrapValue(r,o)}),this.getValueParser=Ie((s,i)=>{const o=this.getTimeZone(s,i);return r=>Pe.wrapValue(r,s,o)}),this.getRangeParser=Ie((s,i)=>o=>{let[r,l]=o;const a=this.getValueParser(s,i);return r=a(r),l=a(l),[r,l]}),this.getAxisRangeParser=Ie((s,i)=>o=>{const r=Pe.getSourceForAxis(s,o);return r?this.getRangeParser(r.columnType,i):l=>l}),this.handleFigureUpdated=this.handleFigureUpdated.bind(this),this.handleFigureDisconnected=this.handleFigureDisconnected.bind(this),this.handleFigureReconnected=this.handleFigureReconnected.bind(this),this.handleFigureSeriesAdded=this.handleFigureSeriesAdded.bind(this),this.handleDownsampleStart=this.handleDownsampleStart.bind(this),this.handleDownsampleFinish=this.handleDownsampleFinish.bind(this),this.handleDownsampleFail=this.handleDownsampleFail.bind(this),this.handleDownsampleNeeded=this.handleDownsampleNeeded.bind(this),this.handleRequestFailed=this.handleRequestFailed.bind(this),this.figure=t,this.settings=e,this.theme=n,this.data=[],this.layout=Pe.makeDefaultLayout(n),this.seriesDataMap=new Map,this.pendingSeries=[],this.oneClicks=[],this.filterColumnMap=new Map,this.lastFilter=new Map,this.isConnected=!0,this.seriesToProcess=new Set,this.setTitle(this.getDefaultTitle()),this.initAllSeries(),this.updateAxisPositions(),this.startListeningFigure()}close(){this.figure.close(),this.addPendingSeries.cancel(),this.stopListeningFigure()}getDefaultTitle(){return this.figure.charts.length>0?this.figure.charts[0].title:""}initAllSeries(){this.oneClicks=[],this.filterColumnMap.clear();const{charts:t}=this.figure,e=[];for(let i=0;i<t.length;i+=1){const o=t[i];for(let r=0;r<o.series.length;r+=1){const l=o.series[r];e.push(l.name),this.addSeries(l)}}const s=[...this.seriesDataMap.keys()].filter(i=>e.indexOf(i)<0);for(let i=0;i<s.length;i+=1){const o=s[i];this.seriesDataMap.delete(o)}this.seriesToProcess=new Set([...this.seriesDataMap.keys()])}addSeries(t){const e=Pe.getChartForSeries(this.figure,t);if(e==null){Nt.error("Unable to find matching chart for series",t);return}const n=Pe.groupArray(e.axes,"type"),s=Pe.makeSeriesDataFromSeries(t,n,Pe.getSeriesVisibility(t.name,this.settings),this.theme);if(this.seriesDataMap.set(t.name,s),this.data=[...this.seriesDataMap.values()],t.plotStyle===N.plot.SeriesPlotStyle.STACKED_BAR?this.layout.barmode="stack":t.plotStyle===N.plot.SeriesPlotStyle.PIE&&(this.layout.hiddenlabels=Pe.getHiddenLabels(this.settings)),this.layout.showlegend=this.data.length>1||t.plotStyle===N.plot.SeriesPlotStyle.PIE,t.oneClick!=null){const{oneClick:i}=t,{columns:o}=i;for(let r=0;r<o.length;r+=1)this.filterColumnMap.set(o[r].name,o[r]);this.oneClicks.push(i)}this.updateLayoutFormats()}subscribe(t){super.subscribe(t),this.listeners.length===1&&(this.initAllSeries(),this.subscribeFigure())}unsubscribe(t){super.unsubscribe(t),this.listeners.length===0&&this.unsubscribeFigure()}subscribeFigure(){if(!this.isConnected){Nt.debug("Ignoring subscribe when figure in disconnected state");return}this.figure.subscribe(this.isDownsamplingDisabled?N.plot.DownsampleOptions.DISABLE:N.plot.DownsampleOptions.DEFAULT)}unsubscribeFigure(){this.figure.unsubscribe()}startListeningFigure(){this.figure.addEventListener(N.plot.Figure.EVENT_UPDATED,this.handleFigureUpdated),this.figure.addEventListener(N.plot.Figure.EVENT_SERIES_ADDED,this.handleFigureSeriesAdded),this.figure.addEventListener(N.plot.Figure.EVENT_DISCONNECT,this.handleFigureDisconnected),this.figure.addEventListener(N.plot.Figure.EVENT_RECONNECT,this.handleFigureReconnected),this.figure.addEventListener(N.plot.Figure.EVENT_DOWNSAMPLESTARTED,this.handleDownsampleStart),this.figure.addEventListener(N.plot.Figure.EVENT_DOWNSAMPLEFINISHED,this.handleDownsampleFinish),this.figure.addEventListener(N.plot.Figure.EVENT_DOWNSAMPLEFAILED,this.handleDownsampleFail),this.figure.addEventListener(N.plot.Figure.EVENT_DOWNSAMPLENEEDED,this.handleDownsampleNeeded),this.figure.addEventListener(N.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed)}stopListeningFigure(){this.figure.removeEventListener(N.plot.Figure.EVENT_UPDATED,this.handleFigureUpdated),this.figure.removeEventListener(N.plot.Figure.EVENT_SERIES_ADDED,this.handleFigureSeriesAdded),this.figure.removeEventListener(N.plot.Figure.EVENT_DISCONNECT,this.handleFigureDisconnected),this.figure.removeEventListener(N.plot.Figure.EVENT_RECONNECT,this.handleFigureReconnected),this.figure.removeEventListener(N.plot.Figure.EVENT_DOWNSAMPLESTARTED,this.handleDownsampleStart),this.figure.removeEventListener(N.plot.Figure.EVENT_DOWNSAMPLEFINISHED,this.handleDownsampleFinish),this.figure.removeEventListener(N.plot.Figure.EVENT_DOWNSAMPLEFAILED,this.handleDownsampleFail),this.figure.removeEventListener(N.plot.Figure.EVENT_DOWNSAMPLENEEDED,this.handleDownsampleNeeded),this.figure.removeEventListener(N.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed)}handleDownsampleStart(t){Nt.debug("Downsample started",t),this.fireDownsampleStart(t.detail)}handleDownsampleFinish(t){Nt.debug("Downsample finished",t),this.fireDownsampleFinish(t.detail)}handleDownsampleFail(t){Nt.error("Downsample failed",t),this.fireDownsampleFail(t.detail)}handleDownsampleNeeded(t){Nt.info("Downsample needed",t),this.fireDownsampleNeeded(t.detail)}handleFigureUpdated(t){const{detail:e}=t,{series:n}=e;Nt.debug2("handleFigureUpdated",n);for(let i=0;i<n.length;i+=1){const o=n[i];Nt.debug2("handleFigureUpdated updating series",o.name);const{sources:r}=o;for(let l=0;l<r.length;l+=1){const a=r[l],{columnType:c,type:h}=a,u=this.getValueTranslator(c,this.formatter),m=e.getArray(o,h,u);this.setDataArrayForSeries(o,h,m)}this.seriesToProcess.delete(o.name),this.seriesToProcess.size===0&&this.fireLoadFinished(),this.cleanSeries(o)}const{data:s}=this;this.fireUpdate(s)}handleRequestFailed(t){Nt.error("Request failed",t)}resubscribe(){this.listeners.length>0&&(this.unsubscribeFigure(),this.subscribeFigure())}setFormatter(t){super.setFormatter(t),this.updateLayoutFormats(),this.resubscribe()}setDownsamplingDisabled(t){super.setDownsamplingDisabled(t),this.resubscribe()}handleFigureDisconnected(t){Nt.debug("Figure disconnected",t),this.isConnected=!1,this.listeners.length>0&&this.unsubscribeFigure(),this.fireDisconnect()}handleFigureReconnected(t){Nt.debug("Figure reconnected",t),this.isConnected=!0,this.initAllSeries(),this.fireReconnect(),this.listeners.length>0&&this.subscribeFigure()}handleFigureSeriesAdded(t){const{detail:e}=t;Nt.debug("handleFigureSeriesAdded",e),this.pendingSeries.push(e),this.addPendingSeries()}setDimensions(t){super.setDimensions(t),this.updateAxisPositions()}setTitle(t){var s,i;super.setTitle(t);const e=(i=(s=(t!=null?t:"").match(/<br>/g))==null?void 0:s.length)!=null?i:0,n=Pe.DEFAULT_MARGIN.t+e*Pe.SUBTITLE_LINE_HEIGHT;this.layout.margin?this.layout.margin.t=n:this.layout.margin={t:n},typeof this.layout.title=="string"?this.layout.title=t:(this.layout.title={...this.layout.title},this.layout.title.text=t,this.layout.title.pad={...this.layout.title.pad},this.layout.title.pad.t=Pe.DEFAULT_TITLE_PADDING.t+e*Pe.SUBTITLE_LINE_HEIGHT*.5)}getPlotWidth(){var t,e,n,s;return!this.rect||!this.rect.width?0:Math.max(this.rect.width-((e=(t=this.layout.margin)==null?void 0:t.l)!=null?e:0)-((s=(n=this.layout.margin)==null?void 0:n.r)!=null?s:0),0)}getPlotHeight(){var t,e,n,s;return!this.rect||!this.rect.height?0:Math.max(this.rect.height-((e=(t=this.layout.margin)==null?void 0:t.t)!=null?e:0)-((s=(n=this.layout.margin)==null?void 0:n.b)!=null?s:0),0)}updateAxisPositions(){const t=this.getPlotWidth(),e=this.getPlotHeight();for(let n=0;n<this.figure.charts.length;n+=1){const s=this.figure.charts[n],i=this.getAxisRangeParser(s,this.formatter);Pe.updateLayoutAxes(this.layout,s.axes,t,e,i,this.theme)}}updateLayoutFormats(){if(!this.formatter)return;Pe.getAxisFormats(this.figure,this.formatter).forEach((e,n)=>{Nt.debug(`Assigning ${n}`,this.layout[n],e);const s=this.layout[n];s!=null?Object.assign(s,e):Nt.debug(`Ignoring null layout.${n}`)})}setDataArrayForSeries(t,e,n){const{name:s,plotStyle:i}=t,o=this.seriesDataMap.get(s),r=Pe.getPlotlyProperty(i,e);o&&Ph(o,r,n)}cleanSeries(t){const{name:e,plotStyle:n}=t,s=this.seriesDataMap.get(e);if(s!=null){if(n===N.plot.SeriesPlotStyle.HISTOGRAM){const{xLow:i,xHigh:o}=s;if(i&&o&&i.length===o.length){const r=[];for(let l=0;l<i.length;l+=1)r.push(o[l]-i[l]);s.width=r}}else if(n===N.plot.SeriesPlotStyle.LINE){const{x:i,xLow:o,xHigh:r,y:l,yLow:a,yHigh:c}=s;o&&r&&o!==i&&(s.error_x=Pe.getPlotlyErrorBars(i,o,r)),a&&c&&a!==l&&(s.error_y=Pe.getPlotlyErrorBars(l,a,c))}else if(n===N.plot.SeriesPlotStyle.TREEMAP){const{ids:i,labels:o}=s;i!==void 0&&o===void 0&&(s.labels=i)}}}getData(){return this.data}getLayout(){return this.layout}getFilterColumnMap(){return new Map(this.filterColumnMap)}isFilterRequired(){return this.oneClicks.find(t=>t.requireAllFiltersToDisplay)!=null}setFilter(t){if(this.oneClicks.length===0){Nt.warn("Trying to set a filter, but no one click!");return}Nt.debug("setFilter",t);for(let e=0;e<this.oneClicks.length;e+=1){const n=this.oneClicks[e],{columns:s}=n;new Set([...t.keys(),...this.lastFilter.keys()]).forEach(o=>{const r=t.get(o);this.lastFilter.get(o)!==r&&s.find(l=>l.name===o)!=null&&n.setValueForColumn(o,r)})}this.lastFilter=new Map(t)}setFigure(t){this.close(),this.figure=t,this.setTitle(this.getDefaultTitle()),this.initAllSeries(),this.updateAxisPositions(),this.startListeningFigure(),this.listeners.length>0&&this.subscribeFigure()}updateSettings(t){this.settings=t}};let Ia=Gu;Ia.ADD_SERIES_DEBOUNCE=50;class Ki{static async makeModelFromSettings(e,n,s=cn){const i=await Ki.makeFigureFromSettings(e,n);return new Ia(i,e,s)}static async makeFigureFromSettings(e,n){const s=await n.copy();return s.applyCustomColumns(n.customColumns),s.applyFilter(n.filter),s.applySort(n.sort),N.plot.Figure.create(Pe.makeFigureSettings(e,s))}static async makeModel(e,n,s=cn){return new Ia(n,e,s)}}function $d(t){return t.setFigure!==void 0}const zb=({connection:t,defaultUpdateInterval:e,hoverUpdateInterval:n,bgMonitoring:s=!0,monitorDuration:i})=>{var B;const[o,r]=S.exports.useState({freeMemory:0,maximumHeapSize:999,totalHeapSize:0}),[l,a]=S.exports.useState(!1),c=S.exports.useRef({timestamps:[],usages:[]});S.exports.useEffect(function(){const k=async()=>{const O=await t.getWorkerHeapInfo();if(r(O),s||l){const F=(O.totalHeapSize-O.freeMemory)/O.maximumHeapSize,_=Date.now(),{timestamps:L,usages:V}=c.current;for(;L.length!==0&&_-L[0]>i*1.5;)L.shift(),V.shift();L.push(_),V.push(F)}else c.current={timestamps:[],usages:[]}};k();const H=setInterval(k,l?n:e);return()=>{clearInterval(H)}},[l,n,t,e,i,s]);const h=($,k)=>Math.round($*10**k)/10**k,u=2,m=1024**3,{freeMemory:p,totalHeapSize:g,maximumHeapSize:f}=o,b=h(p/m,u),C=h(g/m,u),v=h(f/m,u),T=C-b,E=($,k,H=!1)=>w("div",{className:W("heap-usage-info-row",{"heading-bottom-border":H}),children:[d("div",{className:"font-weight-bold",children:$}),d("div",{children:k})]}),{timestamps:y,usages:I}=c.current,D=(B=y[y.length-1])!=null?B:0,M=g/f,x=(g-p)/f;return w(ue,{children:[w("div",{className:"max-memory",children:[d("div",{className:"total-memory",style:{width:`calc(${M*100}% - ${M*2}px`}}),d("div",{className:W("used-memory",{"heap-overflow":(g-p)/f>.95}),style:{width:`calc(${x*100}% - ${x*2}px`}}),w("div",{className:"memory-text",children:[v.toFixed(1)," GB"]})]}),d(pe,{onEntered:()=>a(!0),onExited:()=>a(!1),interactive:!0,children:w("div",{className:"heap-tooltip",children:[E("In use:",`${T.toFixed(u)} of ${v.toFixed(u)} GB`,!0),E("Free:",`${b.toFixed(u)} GB`),E("Total:",`${C.toFixed(u)} GB`),E("Max:",`${v.toFixed(u)} GB`),d("div",{className:"heap-plot",children:d(Wu,{data:[{x:[...y],y:[...I],type:"scatter",mode:"lines"}],config:{staticPlot:!0,responsive:!0},style:{width:"196px",height:"100px"},layout:{legend:!1,margin:{l:2,t:2,r:2,b:2},plot_bgcolor:"transparent",paper_bgcolor:"transparent",colorway:["#4878ea"],xaxis:{dtick:Math.round(i/6),gridcolor:cn.linecolor,range:[D-i,D],linecolor:cn.linecolor,linewidth:2,mirror:!0},yaxis:{dtick:.2,gridcolor:cn.linecolor,range:[0,1],linecolor:cn.linecolor,linewidth:2,mirror:!0}}})}),w("div",{className:"heap-utilisation-text",children:["% utilization over ",Math.round(i/1e3/60)," min."]})]})})]})},Ku=Object.freeze({}),Gb=new Map,qu=t=>t.user,cc=t=>t.storage,Yu=t=>cc(t).commandHistoryStorage,Xu=t=>cc(t).fileStorage,Kb=t=>cc(t).workspaceStorage,Sl=t=>t.workspace,Xt=t=>Sl(t).data.settings,qb=t=>Xt(t).defaultDateTimeFormat,Yb=t=>{var e;return(e=Xt(t).defaultDecimalFormatOptions)!=null?e:Ku},Xb=t=>{var e;return(e=Xt(t).defaultIntegerFormatOptions)!=null?e:Ku},jb=t=>Xt(t).formatter,wl=t=>Xt(t).timeZone,Qb=t=>Xt(t).showTimeZone,Zb=t=>Xt(t).showTSeparator,Jb=t=>Xt(t).truncateNumbersWithPound,eS=t=>Xt(t).shortcutOverrides,vl=t=>t.activeTool,tS=t=>{var e;return(e=t.plugins)!=null?e:Gb},ju="SET_ACTIVE_TOOL",Qu="SET_COMMAND_HISTORY_STORAGE",Zu="SET_FILE_STORAGE",Ju="SET_PLUGINS",em="SET_USER",tm="SET_WORKSPACE",nm="SET_WORKSPACE_STORAGE",nS=t=>({type:em,payload:t}),sm=t=>({type:tm,payload:t}),sS=t=>({type:nm,payload:t}),iS=t=>({type:Qu,payload:t}),oS=t=>({type:Zu,payload:t}),rS=t=>(e,n)=>{e(sm(t));const{storage:s}=n(),{workspaceStorage:i}=s;return i.save(t)},im=t=>(e,n)=>{const{workspace:s}=n(),{data:i}=s,o={...s,data:{...i,...t}};return e(rS(o))},om=t=>e=>e(im({settings:t})),Tl=t=>({type:ju,payload:t}),lS=t=>({type:Ju,payload:t});function rm(t,e){return(n=e,s)=>{switch(s.type){case t:{const i=s.payload;return i==null?null:n!=null?{...n,...i}:{...i}}default:return n}}}function aS(t,e={},n=!0){return(s=e,i)=>{switch(i.type){case t:{const{id:o,payload:r}=i;return n&&pt({payload:r},{payload:s[o]})?s:{...s,[o]:r}}default:return s}}}function bi(t,e){return(n=e,s)=>{switch(s.type){case t:return s.payload;default:return n}}}const cS=bi(ju,null),dS=bi(Ju,null),hS=bi(Qu,null),uS=bi(Zu,null),mS=bi(nm,null),pS=$a({commandHistoryStorage:hS,fileStorage:uS,workspaceStorage:mS}),gS=rm(em,null),fS=rm(tm,null),CS={activeTool:cS,plugins:dS,storage:pS,user:gS,workspace:fS};class bS{constructor(){this.reducers={},this.listener=null}register(e,n){var s;this.reducers={...this.reducers,[e]:n},(s=this.listener)==null||s.call(this,this.reducers)}setListener(e){this.listener=e}}const eo=new bS,Wd=X.module("redux-logger"),SS=t=>e=>n=>{Wd.debug("dispatching",n);const s=e(n);return Wd.debug("next state",t.getState()),s},wS=X.module("redux-crashReporter"),vS=t=>e=>n=>{try{return e(n)}catch(s){throw wS.error("Error executing",n," with state ",t.getState(),":",s),s}},TS=[SS,vS,kp];Object.entries(CS).map(([t,e])=>eo.register(t,e));var Ah;const ES=(Ah=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__)!=null?Ah:Pp,El=Op($a(eo.reducers),ES(Ap(...TS)));eo.setListener(t=>{El.replaceReducer($a(t))});const yS={openPopouts:[],settings:{hasHeaders:!0,constrainDragToContainer:!0,reorderEnabled:!0,selectionEnabled:!1,popoutWholeStack:!1,blockedPopoutsThrowError:!0,closePopoutsOnUnload:!0,showPopoutIcon:!0,showMaximiseIcon:!0,showCloseIcon:!0,responsiveMode:"onload",tabOverlapAllowance:0,tabControlOffset:10},dimensions:{borderWidth:5,borderGrabWidth:10,minItemHeight:10,minItemWidth:10,headerHeight:20,dragProxyWidth:300,dragProxyHeight:200},labels:{close:"Close",maximise:"Maximize",minimise:"Minimize",popout:"Open in new window",popin:"Pop in",tabDropdown:"Additional tabs",tabNextLabel:"Next",tabPreviousLabel:"Previous"}},IS={isClosable:!0,isFocusOnShow:!0,reorderEnabled:!0,title:""},lm={defaultConfig:yS,itemDefaultConfig:IS},ke={};ke.F=function(){};ke.extend=function(t,e){t.prototype=ke.createObject(e.prototype),t.prototype.contructor=t};ke.createObject=function(t){return typeof Object.create=="function"?Object.create(t):(ke.F.prototype=t,new ke.F)};ke.objectKeys=function(t){var e,n;if(typeof Object.keys=="function")return Object.keys(t);e=[];for(n in t)e.push(n);return e};ke.getHashValue=function(t){var e=location.hash.match(new RegExp(t+"=([^&]*)"));return e?e[1]:null};ke.getQueryStringParam=function(t){if(window.location.hash)return ke.getHashValue(t);if(!window.location.search)return null;var e=window.location.search.substr(1).split("&"),n={},s,i;for(i=0;i<e.length;i++)s=e[i].split("="),n[s[0]]=s[1];return n[t]||null};ke.copy=function(t,e){for(var n in e)t[n]=e[n];return t};ke.animFrame=function(t){return(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(e){window.setTimeout(e,1e3/60)})(function(){t()})};ke.indexOf=function(t,e){if(!(e instanceof Array))throw new Error("Haystack is not an Array");if(e.indexOf)return e.indexOf(t);for(var n=0;n<e.length;n++)if(e[n]===t)return n;return-1};typeof/./!="function"&&typeof Int8Array!="object"?ke.isFunction=function(t){return typeof t=="function"||!1}:ke.isFunction=function(t){return toString.call(t)==="[object Function]"};ke.fnBind=function(t,e,n){if(Function.prototype.bind!==void 0)return Function.prototype.bind.apply(t,[e].concat(n||[]));var s=function(){var i=(n||[]).concat(Array.prototype.slice.call(arguments,0));if(!(this instanceof s))return t.apply(e,i);t.apply(this,i)};return s.prototype=t.prototype,s};ke.removeFromArray=function(t,e){var n=ke.indexOf(t,e);if(n===-1)throw new Error("Can't remove item from array. Item is not in the array");e.splice(n,1)};ke.now=function(){return typeof Date.now=="function"?Date.now():new Date().getTime()};ke.getUniqueId=function(){return(Math.random()*1e15).toString(36).replace(".","")};ke.filterXss=function(t,e){var n=t.replace(/javascript/gi,"j&#97;vascript").replace(/expression/gi,"expr&#101;ssion").replace(/onload/gi,"onlo&#97;d").replace(/script/gi,"&#115;cript").replace(/onerror/gi,"on&#101;rror");return e===!0?n:n.replace(/>/g,"&gt;").replace(/</g,"&lt;")};ke.stripTags=function(t){return de.trim(t.replace(/(<([^>]+)>)/gi,""))};const pi=function(){this._mSubscriptions={},this._mSubscriptions[pi.ALL_EVENT]=[],this.on=function(t,e,n){if(!ke.isFunction(e))throw new Error("Tried to listen to event "+t+" with non-function callback "+e);this._mSubscriptions[t]||(this._mSubscriptions[t]=[]),this._mSubscriptions[t].push({fn:e,ctx:n})},this.emit=function(t){var e,n,s;s=Array.prototype.slice.call(arguments,1);var i=this._mSubscriptions[t];if(i)for(i=i.slice(),e=0;e<i.length;e++)n=i[e].ctx||{},i[e].fn.apply(n,s);s.unshift(t);var o=this._mSubscriptions[pi.ALL_EVENT].slice();for(e=0;e<o.length;e++)n=o[e].ctx||{},o[e].fn.apply(n,s)},this.unbind=function(t,e,n){if(!this._mSubscriptions[t])throw new Error("No subscribtions to unsubscribe for event "+t);var s,i=!1;for(s=0;s<this._mSubscriptions[t].length;s++)(!e||this._mSubscriptions[t][s].fn===e)&&(!n||n===this._mSubscriptions[t][s].ctx)&&(this._mSubscriptions[t].splice(s,1),i=!0);if(i===!1)throw new Error("Nothing to unbind for "+t)},this.off=this.unbind,this.trigger=this.emit};pi.ALL_EVENT="__all";const dc=function(t,e){pi.call(this),this._eElement=de(t),this._oDocument=de(document),this._eBody=de(document.body),this._destroyAfterMouseUp=e||!1,this._nDelay=400,this._timeout=null,this._nDistance=10,this._nX=0,this._nY=0,this._nOriginalX=0,this._nOriginalY=0,this._bDragging=!1,this._fMove=ke.fnBind(this.onMouseMove,this),this._fUp=ke.fnBind(this.onMouseUp,this),this._fDown=ke.fnBind(this.onMouseDown,this),this._eElement.on("mousedown",this._fDown)};dc.timeout=null;ke.copy(dc.prototype,{destroy:function(){this._eElement.unbind("mousedown",this._fDown),this._oDocument.unbind("mouseup",this._fUp),this._eElement=null,this._oDocument=null,this._eBody=null,clearTimeout(this._timeout),this._timeout=null},onMouseDown:function(t){if(t.preventDefault(),t.button===0){var e=this._getCoordinates(t);this._nOriginalX=e.x,this._nOriginalY=e.y,this._oDocument.on("mousemove",this._fMove),this._oDocument.one("mouseup",this._fUp),this._timeout=setTimeout(ke.fnBind(this._startDrag,this),this._nDelay)}},onMouseMove:function(t){if(this._timeout!=null){t.preventDefault();var e=this._getCoordinates(t);this._nX=e.x-this._nOriginalX,this._nY=e.y-this._nOriginalY,this._bDragging===!1&&(Math.abs(this._nX)>this._nDistance||Math.abs(this._nY)>this._nDistance)&&this._startDrag(),this._bDragging&&this.emit("drag",this._nX,this._nY,t)}},onMouseUp:function(t){this._timeout!=null&&(clearTimeout(this._timeout),this._oDocument.unbind("mousemove",this._fMove),this._oDocument.unbind("mouseup",this._fUp),this._oDocument.find("iframe").css("pointer-events",""),this._bDragging===!0&&(this._bDragging=!1,this.emit("dragStop",t,this._nOriginalX+this._nX)),this._eBody&&this._eBody.removeClass("lm_dragging"),this._eElement&&this._eElement.removeClass("lm_dragging"),this._destroyAfterMouseUp&&this.destroy())},_startDrag:function(){clearTimeout(this._timeout),this._bDragging=!0,this._eBody.addClass("lm_dragging"),this._eElement.addClass("lm_dragging"),this._oDocument.find("iframe").css("pointer-events","none"),this.emit("dragStart",this._nOriginalX,this._nOriginalY)},_getCoordinates:function(t){return t=t.originalEvent&&t.originalEvent.touches?t.originalEvent.touches[0]:t,{x:t.pageX,y:t.pageY}}});const am=function(t,e){this._reactComponent=null,this._originalComponentWillUpdate=null,this._container=t,this._initialState=e,this._reactClass=this._getReactClass(),this._container.on("open",this._render,this),this._container.on("destroy",this._destroy,this)};ke.copy(am.prototype,{_render:function(){ui.render(this._getReactComponent(),this._container.getElement()[0])},_gotReactComponent:function(t){!t||(this._reactComponent=t,this._originalComponentWillUpdate=this._reactComponent.componentWillUpdate||function(){},this._reactComponent.componentWillUpdate=this._onUpdate.bind(this),this._container.getState()&&this._reactComponent.setState(this._container.getState()))},_destroy:function(){ui.unmountComponentAtNode(this._container.getElement()[0]),this._container.off("open",this._render,this),this._container.off("destroy",this._destroy,this)},_onUpdate:function(t,e){this._container.setState(e),this._originalComponentWillUpdate.call(this._reactComponent,t,e)},_getReactClass:function(){var t=this._container._config.component,e;if(!t)throw new Error("No react component name. type: react-component needs a field `component`");if(e=this._container.layoutManager.getComponent(t)||this._container.layoutManager.getFallbackComponent(),!e)throw new Error('React component "'+t+'" not found. Please register all components with GoldenLayout using `registerComponent(name, component)`');return e},_getReactComponent:function(){var t={glEventHub:this._container.layoutManager.eventHub,glContainer:this._container,ref:this._gotReactComponent.bind(this)},e=de.extend(t,this._container._config.props);return Y.createElement(this._reactClass,e)}});const cm=function(){if(this._keys=["settings","hasHeaders","constrainDragToContainer","selectionEnabled","dimensions","borderWidth","minItemHeight","minItemWidth","headerHeight","dragProxyWidth","dragProxyHeight","labels","close","maximise","minimise","popout","content","componentName","componentState","id","width","type","height","isClosable","title","popoutWholeStack","openPopouts","parentId","activeItemIndex","reorderEnabled","borderGrabWidth"],this._keys.length>36)throw new Error("Too many keys in config minifier map");this._values=[!0,!1,"row","column","stack","component","close","maximise","minimise","open in new window"]};ke.copy(cm.prototype,{minifyConfig:function(t){var e={};return this._nextLevel(t,e,"_min"),e},unminifyConfig:function(t){var e={};return this._nextLevel(t,e,"_max"),e},_nextLevel:function(t,e,n){var s,i;for(s in t)t instanceof Array&&(s=parseInt(s,10)),t.hasOwnProperty(s)&&(i=this[n](s,this._keys),typeof t[s]=="object"?(e[i]=t[s]instanceof Array?[]:{},this._nextLevel(t[s],e[i],n)):e[i]=this[n](t[s],this._values))},_min:function(t,e){if(typeof t=="string"&&t.length===1)return"___"+t;var n=ke.indexOf(t,e);return n===-1?t:n.toString(36)},_max:function(t,e){return typeof t=="string"&&t.length===1?e[parseInt(t,36)]:typeof t=="string"&&t.substr(0,3)==="___"?t[3]:t}});const dm=function(t,e){this.name=t,this.origin=e,this.isPropagationStopped=!1};dm.prototype.stopPropagation=function(){this.isPropagationStopped=!0};const Si=function(t){pi.call(this),this._layoutManager=t,this._dontPropagateToParent=null,this._childEventSource=null,this.on(pi.ALL_EVENT,ke.fnBind(this._onEventFromThis,this)),this._boundOnEventFromChild=ke.fnBind(this._onEventFromChild,this),de(window).on("gl_child_event",this._boundOnEventFromChild)};Si.prototype._onEventFromThis=function(){var t=Array.prototype.slice.call(arguments);this._layoutManager.isSubWindow&&t[0]!==this._dontPropagateToParent&&this._propagateToParent(t),this._propagateToChildren(t),this._dontPropagateToParent=null,this._childEventSource=null};Si.prototype._$onEventFromParent=function(t){this._dontPropagateToParent=t[0],this.emit.apply(this,t)};Si.prototype._onEventFromChild=function(t){this._childEventSource=t.originalEvent.__gl,this.emit.apply(this,t.originalEvent.__glArgs)};Si.prototype._propagateToParent=function(t){var e,n="gl_child_event";document.createEvent?(e=window.opener.document.createEvent("HTMLEvents"),e.initEvent(n,!0,!0)):(e=window.opener.document.createEventObject(),e.eventType=n),e.eventName=n,e.__glArgs=t,e.__gl=this._layoutManager,document.createEvent?window.opener.dispatchEvent(e):window.opener.fireEvent("on"+e.eventType,e)};Si.prototype._propagateToChildren=function(t){var e,n;for(n=0;n<this._layoutManager.openPopouts.length;n++)e=this._layoutManager.openPopouts[n].getGlInstance(),e&&e!==this._childEventSource&&e.eventHub._$onEventFromParent(t)};Si.prototype.destroy=function(){de(window).off("gl_child_event",this._boundOnEventFromChild)};const se={...ke,EventEmitter:pi,DragListener:dc,ReactComponentHandler:am,ConfigMinifier:cm,BubblingEvent:dm,EventHub:Si},hm=function(t,e,n){se.EventEmitter.call(this),this.width=null,this.height=null,this.title=t.componentName,this.parent=e,this.layoutManager=n,this.isHidden=!1,this._config=t,this._element=de(['<div class="lm_item_container">','<div class="lm_content" tabindex="-1"></div>',"</div>"].join("")),this._contentElement=this._element.find(".lm_content")};se.copy(hm.prototype,{getElement:function(){return this._contentElement},hide:function(){this.emit("hide"),this.isHidden=!0,this._element.hide()},show:function(){this.emit("show"),this.isHidden=!1,this._element.show(),(this.height!=0||this.width!=0)&&this.emit("shown")},setSize:function(t,e){for(var n=this.parent,s=this,i,o,r,l,a,c;!n.isColumn&&!n.isRow;)if(s=n,n=n.parent,n.isRoot)return!1;for(r=n.isColumn?"height":"width",l=r==="height"?e:t,i=this[r]*(1/(s.config[r]/100)),o=l/i*100,a=(s.config[r]-o)/(n.contentItems.length-1),c=0;c<n.contentItems.length;c++)n.contentItems[c]===s?n.contentItems[c].config[r]=o:n.contentItems[c].config[r]+=a;return n.callDownwards("setSize"),!0},close:function(){this._config.isClosable&&(this.emit("close"),this.parent.close())},getState:function(){return this._config.componentState},extendState:function(t){this.setState(de.extend(!0,this.getState(),t))},setState:function(t){this._config.componentState=t,this.parent.emitBubblingEvent("stateChanged")},setTitle:function(t){this.parent.setTitle(t)},_$setSize:function(t,e){if(t!==this.width||e!==this.height){this.width=t,this.height=e;var n=this._contentElement[0],s=n.offsetWidth-n.clientWidth,i=n.offsetHeight-n.clientHeight;this._contentElement.width(this.width-s).height(this.height-i),this.emit("resize")}}});const um={ItemContainer:hm},mm=function(t,e,n,s,i){se.EventEmitter.call(this),this.isInitialised=!1,this._config=t,this._dimensions=e,this._parentId=n,this._indexInParent=s,this._layoutManager=i,this._popoutWindow=null,this._id=null,this._createWindow()};se.copy(mm.prototype,{toConfig:function(){if(this.isInitialised===!1)throw new Error("Can't create config, layout not yet initialised");return{dimensions:{width:this.getGlInstance().width,height:this.getGlInstance().height,left:this._popoutWindow.screenX||this._popoutWindow.screenLeft,top:this._popoutWindow.screenY||this._popoutWindow.screenTop},content:this.getGlInstance().toConfig().content,parentId:this._parentId,indexInParent:this._indexInParent}},getGlInstance:function(){return this._popoutWindow.__glInstance},getWindow:function(){return this._popoutWindow},close:function(){if(this.getGlInstance())this.getGlInstance()._$closeWindow();else try{this.getWindow().close()}catch{}},popIn:function(){var t,e;this._indexInParent,this._parentId&&(t=de.extend(!0,{},this.getGlInstance().toConfig()).content[0],e=this._layoutManager.root.getItemsById(this._parentId)[0],e||(this._layoutManager.root.contentItems.length>0?e=this._layoutManager.root.contentItems[0]:e=this._layoutManager.root)),e.addChild(t,this._indexInParent),this.close()},_createWindow:function(){var t,e=this._createUrl(),n=Math.floor(Math.random()*1e6).toString(36),s=this._serializeWindowOptions({width:this._dimensions.width,height:this._dimensions.height,innerWidth:this._dimensions.width,innerHeight:this._dimensions.height,menubar:"no",toolbar:"no",location:"no",personalbar:"no",resizable:"yes",scrollbars:"no",status:"no"});if(this._popoutWindow=window.open(e,n,s),!this._popoutWindow)if(this._layoutManager.config.settings.blockedPopoutsThrowError===!0){var i=new Error("Popout blocked");throw i.type="popoutBlocked",i}else return;de(this._popoutWindow).on("load",se.fnBind(this._positionWindow,this)).on("unload beforeunload",se.fnBind(this._onClose,this)),t=setInterval(se.fnBind(function(){this._popoutWindow.__glInstance&&this._popoutWindow.__glInstance.isInitialised&&(this._onInitialised(),clearInterval(t))},this),10)},_serializeWindowOptions:function(t){var e=[],n;for(n in t)e.push(n+"="+t[n]);return e.join(",")},_createUrl:function(){var t={content:this._config},e="gl-window-config-"+se.getUniqueId(),n;t=new se.ConfigMinifier().minifyConfig(t);try{localStorage.setItem(e,JSON.stringify(t))}catch(s){throw new Error("Error while writing to localStorage "+s.toString())}return n=document.location.href.split("?"),n.length===1?n[0]+"?gl-window="+e:document.location.href+"&gl-window="+e},_positionWindow:function(){this._popoutWindow.moveTo(this._dimensions.left,this._dimensions.top),this._popoutWindow.focus()},_onInitialised:function(){this.isInitialised=!0,this.getGlInstance().on("popIn",this.popIn,this),this.emit("initialised")},_onClose:function(){setTimeout(se.fnBind(this.emit,this,["closed"]),50)}});const wi=function(t,e,n,s,i,o){se.EventEmitter.call(this),this._dragListener=n,this._layoutManager=s,this._contentItem=i,this._originalParent=o,this._area=null,this._lastValidArea=null,this._dragListener.on("drag",this._onDrag,this),this._dragListener.on("dragStop",this._onDrop,this),this._contentItem.tab&&this._contentItem.tab.element&&(this._layoutManager.tabDropPlaceholder.width(this._contentItem.tab.element.outerWidth(!0)),this._layoutManager.tabDropPlaceholder.height(this._contentItem.tab.element.outerHeight(!0))),this.element=de(wi._template),o&&o._side&&(this._sided=o._sided,this.element.addClass("lm_"+o._side),["right","bottom"].indexOf(o._side)>=0&&this.element.find(".lm_content").after(this.element.find(".lm_header"))),this.element.css({left:t,top:e}),this._proxyTab=this.element.find(".lm_tab"),this._proxyTab.attr("title",se.stripTags(this._contentItem.config.title)),this.element.find(".lm_title").html(this._contentItem.config.title),this.childElementContainer=this.element.find(".lm_content"),this.childElementContainer.append(i.element),this._updateTree(),this._layoutManager._$calculateItemAreas(),this._setDimensions(),de(document.body).append(this.element),!this._contentItem.tab&&this._proxyTab.length&&(this._layoutManager.tabDropPlaceholder.width(this._proxyTab.outerWidth(!0)),this._layoutManager.tabDropPlaceholder.height(this._proxyTab.outerHeight(!0)));var r=this._layoutManager.container.offset();this._minX=r.left,this._minY=r.top,this._maxX=this._layoutManager.container.width()+this._minX,this._maxY=this._layoutManager.container.height()+this._minY,this._width=this.element.width(),this._height=this.element.height(),this._setDropPosition(t,e),this._layoutManager.emit("itemPickedUp",this._contentItem)};wi._template='<div class="lm_dragProxy"><div class="lm_header"><ul class="lm_tabs"><li class="lm_tab lm_active"><i class="lm_left"></i><span class="lm_title"></span><i class="lm_right"></i></li></ul></div><div class="lm_content"></div></div>';se.copy(wi.prototype,{_onDrag:function(t,e,n){n=n.originalEvent&&n.originalEvent.touches?n.originalEvent.touches[0]:n;var s=n.pageX,i=n.pageY,o=s>this._minX&&s<this._maxX&&i>this._minY&&i<this._maxY;!o&&this._layoutManager.config.settings.constrainDragToContainer===!0||this._setDropPosition(s,i)},_setDropPosition:function(t,e){this.element.css({left:t,top:e}),this._area=this._layoutManager._$getArea(t,e),this._area!==null&&(this._lastValidArea=this._area,this._area.contentItem._$highlightDropZone(t,e,this._area))},_onDrop:function(){this._layoutManager.dropTargetIndicator.hide(),this._area!==null?this._area.contentItem._$onDrop(this._contentItem,this._area):this._lastValidArea!==null?this._lastValidArea.contentItem._$onDrop(this._contentItem,this._lastValidArea):this._originalParent?this._originalParent.addChild(this._contentItem):this._contentItem._$destroy(),this._dragListener.off("drag",this._onDrag,this),this._dragListener.off("dragStop",this._onDrop,this),this.element.remove(),this._layoutManager.emit("itemDropped",this._contentItem)},_updateTree:function(){this._contentItem.parent&&this._contentItem.parent.removeChild(this._contentItem,!0),this._contentItem._$setParent(this)},_setDimensions:function(){var t=this._layoutManager.config.dimensions,e=t.dragProxyWidth,n=t.dragProxyHeight;this.element.width(e),this.element.height(n),e-=this._sided?t.headerHeight:0,n-=this._sided?0:t.headerHeight,this.childElementContainer.width(e),this.childElementContainer.height(n),this._contentItem.element.width(e),this._contentItem.element.height(n),this._contentItem.callDownwards("_$show"),this._contentItem.callDownwards("setSize")}});const pm=function(t,e,n){this._element=t,this._itemConfig=e,this._layoutManager=n,this._dragListener=null,this._createDragListener()};se.copy(pm.prototype,{_createDragListener:function(){this._dragListener=new se.DragListener(this._element,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._createDragListener,this)},_onDragStart:function(t,e){var n=this._itemConfig;se.isFunction(n)&&(n=n());var s=this._layoutManager._$normalizeContentItem(de.extend(!0,{},n)),i=new wi(t,e,this._dragListener,this._layoutManager,s,null);this._layoutManager.transitionIndicator.transitionElements(this._element,i.element)}});const gm=function(t,e,n){this._element=de(window),this._itemConfig=t,this._layoutManager=e,this._dragListener=null,this._createDragListener(n)};se.copy(gm.prototype,{_createDragListener:function(t){this._dragListener!==null&&this._dragListener.destroy(),this._dragListener=new se.DragListener(this._element,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._destroy,this),this._dragListener._fDown(t),this._dragListener._startDrag()},_destroy:function(){this._dragListener=null,this._element=null,this._itemConfig=null,this._layoutManager=null},_onDragStart:function(t,e){var n=this._itemConfig;se.isFunction(n)&&(n=n());var s=this._layoutManager._$normalizeContentItem(de.extend(!0,{},n));new wi(t,e,this._dragListener,this._layoutManager,s,null)}});const yl=function(){this.element=de(yl._template),de(document.body).append(this.element)};yl._template='<div class="lm_dropTargetIndicator"><div class="lm_inner"></div></div>';se.copy(yl.prototype,{destroy:function(){this.element.remove()},highlightArea:function(t){this.element.css({left:t.x1,top:t.y1,width:Math.floor(t.x2-t.x1),height:Math.floor(t.y2-t.y1)}).show()},hide:function(){this.element.hide()}});const Oi=function(t,e,n,s){this._header=t,this.element=de('<li class="'+n+'" title="'+e+'"></li>'),this._header.on("destroy",this._$destroy,this),this._action=s,this.element.on("click",this._action),this._header.controlsContainer.append(this.element)};se.copy(Oi.prototype,{_$destroy:function(){this.element.off(),this.element.remove()}});const zo=function(t,e){this.header=t,this.contentItem=e,this.element=de(zo._template),this.titleElement=this.element.find(".lm_title"),this.closeElement=this.element.find(".lm_close_tab"),this.closeElement[e.config.isClosable?"show":"hide"](),this.isActive=!1,this.setTitle(e.config.title),this.contentItem.on("titleChanged",this.setTitle,this),this._layoutManager=this.contentItem.layoutManager,this._layoutManager.config.settings.reorderEnabled===!0&&e.config.reorderEnabled===!0&&(this._dragListener=new se.DragListener(this.element),this._dragListener.on("dragStart",this._onDragStart,this),this.contentItem.on("destroy",this._dragListener.destroy,this._dragListener)),this._onTabClickFn=se.fnBind(this._onTabClick,this),this._onCloseClickFn=se.fnBind(this._onCloseClick,this),this._onTabContentFocusInFn=se.fnBind(this._onTabContentFocusIn,this),this._onTabContentFocusOutFn=se.fnBind(this._onTabContentFocusOut,this),this.element.on("click",this._onTabClickFn),this.element.on("auxclick",this._onTabClickFn),this.contentItem.config.isClosable?(this.closeElement.on("click",this._onCloseClickFn),this.closeElement.on("mousedown",this._onCloseMousedown)):this.closeElement.remove(),this.contentItem.tab=this,this.contentItem.emit("tab",this),this.contentItem.layoutManager.emit("tabCreated",this),this.contentItem.isComponent&&(this.contentItem.container._contentElement.on("focusin click",this._onTabContentFocusInFn).on("focusout",this._onTabContentFocusOutFn),this.contentItem.container.tab=this,this.contentItem.container.emit("tab",this))};zo._template=['<li class="lm_tab">','<span class="lm_title_before"></span>','<span class="lm_title"></span>','<div class="lm_close_tab"></div>',"</li>"].join("");se.copy(zo.prototype,{setTitle:function(t){this.titleElement.html(t)},setActive:function(t){t!==this.isActive&&(this.isActive=t,t?this.element.addClass("lm_active"):this.element.removeClass("lm_active"))},_$destroy:function(){this.element.off("click",this._onTabClickFn),this.element.off("auxclick",this._onTabClickFn),this.closeElement.off("click",this._onCloseClickFn),this.contentItem.isComponent&&this.contentItem.container._contentElement.off(),this._dragListener&&(this.contentItem.off("destroy",this._dragListener.destroy,this._dragListener),this._dragListener.off("dragStart",this._onDragStart),this._dragListener=null),this.element.remove()},_onDragStart:function(t,e){this.contentItem.parent.isMaximised===!0&&this.contentItem.parent.toggleMaximise(),new wi(t,e,this._dragListener,this._layoutManager,this.contentItem,this.header.parent)},_onTabContentFocusIn:function(){this.contentItem.container._contentElement[0].contains(document.activeElement)||this.contentItem.container._contentElement[0].focus(),this.element.addClass("lm_focusin")},_onTabContentFocusOut:function(){this.contentItem.container._contentElement[0].contains(document.activeElement)||this.element.removeClass("lm_focusin")},_onTabClick:function(t){if(!t||t.button===0){var e=this.header.parent.getActiveContentItem();this.contentItem!==e?(this.header.parent.setActiveContentItem(this.contentItem),this.contentItem.container.emit("tabClicked")):this.contentItem.isComponent&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&(this.contentItem.container._contentElement.focus(),this.contentItem.container.emit("tabClicked")),this.header._hideAdditionalTabsDropdown(),this.element.get(0).scrollIntoView({inline:"nearest"})}else t.button===1&&this.contentItem.config.isClosable&&this._onCloseClick(t)},_onCloseClick:function(t){t.stopPropagation(),this.contentItem.isComponent?this.contentItem.container.close():this.header.parent.removeChild(this.contentItem)},_onCloseMousedown:function(t){t.stopPropagation()}});const ks=function(t,e){se.EventEmitter.call(this),this.layoutManager=t,this.element=de(ks._template),this.layoutManager.config.settings.selectionEnabled===!0&&(this.element.addClass("lm_selectable"),this.element.on("click",se.fnBind(this._onHeaderClick,this))),this.tabsContainer=this.element.find(".lm_tabs"),this.tabDropdownContainer=this.element.find(".lm_tabdropdown_list"),this.tabDropdownContainer.hide(),this.tabDropdownSearch=this.element.find(".lm_tabdropdown_search input"),this.tabDropdownList=null,this._handleFilterInput=this._handleFilterInput.bind(this),this._handleFilterKeydown=this._handleFilterKeydown.bind(this),this.tabDropdownSearch.on("input",this._handleFilterInput),this.tabDropdownSearch.on("keydown",this._handleFilterKeydown),this.controlsContainer=this.element.find(".lm_controls"),this.parent=e,this.parent.on("resize",this._updateTabSizes,this),this.tabs=[],this.activeContentItem=null,this.closeButton=null,this.tabDropdownButton=null,this.tabNextButton=de(ks._nextButtonTemplate),this.tabPreviousButton=de(ks._previousButtonTemplate),this._handleItemPickedUp=this._handleItemPickedUp.bind(this),this._handleItemDropped=this._handleItemDropped.bind(this),this._handleNextMouseEnter=this._handleNextMouseEnter.bind(this),this._handleNextMouseLeave=this._handleNextMouseLeave.bind(this),this._handlePreviousMouseEnter=this._handlePreviousMouseEnter.bind(this),this._handlePreviousMouseLeave=this._handlePreviousMouseLeave.bind(this),this._handleScrollRepeat=this._handleScrollRepeat.bind(this),this._handleNextButtonMouseDown=this._handleNextButtonMouseDown.bind(this),this._handlePreviousButtonMouseDown=this._handlePreviousButtonMouseDown.bind(this),this._handleScrollButtonMouseDown=this._handleScrollButtonMouseDown.bind(this),this._handleScrollButtonMouseUp=this._handleScrollButtonMouseUp.bind(this),this._handleScrollEvent=this._handleScrollEvent.bind(this),this.tabNextButton.on("mousedown",this._handleNextButtonMouseDown),this.tabPreviousButton.on("mousedown",this._handlePreviousButtonMouseDown),this.tabsContainer.on("scroll",this._handleScrollEvent),this.holdTimer=null,this.rAF=null,this.CLICK_TIMEOUT=500,this.START_SPEED=.01,this.ACCELERATION=5e-4,this.SCROLL_LEFT="left",this.SCROLL_RIGHT="right",this.layoutManager.on("itemPickedUp",this._handleItemPickedUp),this.layoutManager.on("itemDropped",this._handleItemDropped),this.isDraggingTab=!1,this.isOverflowing=!1,this.isDropdownShown=!1,this.dropdownKeyIndex=0,this.tabsContainer.before(this.tabPreviousButton),this.tabPreviousButton=this.tabPreviousButton.find(">:first-child"),this.tabPreviousButton.hide(),this._showAdditionalTabsDropdown=this._showAdditionalTabsDropdown.bind(this),this._hideAdditionalTabsDropdown=this._hideAdditionalTabsDropdown.bind(this),this._lastVisibleTabIndex=-1,this._tabControlOffset=this.layoutManager.config.settings.tabControlOffset,this._createControls()};ks._template=['<div class="lm_header">','<ul class="lm_tabs"></ul>','<ul class="lm_controls"></ul>','<ul class="lm_tabdropdown_list">','<li class="lm_tabdropdown_search"><input type="text" placeholder="Find tab..."></li>',"</ul>","</div>"].join("");ks._previousButtonTemplate=['<ul class="lm_controls">','<li class="lm_tabpreviousbutton"></li>',"</ul>"].join("");ks._nextButtonTemplate=['<li class="lm_tabnextbutton"></li>'].join("");se.copy(ks.prototype,{createTab:function(t,e){var n,s;for(s=0;s<this.tabs.length;s++)if(this.tabs[s].contentItem===t)return;if(n=new zo(this,t),this.tabs.length===0){this.tabs.push(n),this.tabsContainer.append(n.element);return}e===void 0&&(e=this.tabs.length),e>0?this.tabs[e-1].element.after(n.element):this.tabs[0].element.before(n.element),this.tabs.splice(e,0,n),this._updateTabSizes()},removeTab:function(t){for(var e=0;e<this.tabs.length;e++)if(this.tabs[e].contentItem===t){this.tabs[e]._$destroy(),this.tabs.splice(e,1);return}throw new Error("contentItem is not controlled by this header")},setActiveContentItem:function(t){for(var e,n=0;n<this.tabs.length;n++)e=this.tabs[n].contentItem===t,this.tabs[n].setActive(e),e===!0&&(this.activeContentItem=t,this.parent.config.activeItemIndex=n);this.tabs[this.parent.config.activeItemIndex].element.get(0).scrollIntoView({inline:"nearest"}),this._hideAdditionalTabsDropdown(),this._updateTabSizes(),this.parent.emitBubblingEvent("stateChanged")},position:function(t){var e=this.parent._header.show;return e&&!this.parent._side&&(e="top"),t!==void 0&&this.parent._header.show!==t&&(this.parent._header.show=t,this.parent._setupHeaderPosition()),e},_attachWheelListener:function(){this.tabsContainer.get(0).addEventListener("wheel",this._handleWheelEvent,{passive:!0})},_detachWheelListener:function(){this.tabsContainer.get(0).removeEventListener("wheel",this._handleWheelEvent,{passive:!0})},_handleWheelEvent:function(t){var e=t.currentTarget,n=Math.abs(t.deltaY)>Math.abs(t.deltaX)?t.deltaY:t.deltaX;t.deltaMode===WheelEvent.DOM_DELTA_PAGE?n*=this.tabsContainer.innerWidhth():t.deltaMode===WheelEvent.DOM_DELTA_LINE&&(n*=100/3),e.scrollLeft+=Math.round(n)},_handleScrollEvent:function(){this._checkScrollArrows()},_handleItemPickedUp:function(){this.isDraggingTab=!0,this.controlsContainer.on("mouseenter",this._handleNextMouseEnter),this.tabPreviousButton.on("mouseenter",this._handlePreviousMouseEnter)},_handleItemDropped:function(){this.isDraggingTab=!1,this.rAF=window.cancelAnimationFrame(this.rAF),this.controlsContainer.off("mouseenter",this._handleNextMouseEnter),this.controlsContainer.off("mouseleave",this._handleNextMouseLeave),this.tabPreviousButton.off("mouseenter",this._handlePreviousMouseEnter),this.tabPreviousButton.off("mouseleave",this._handlePreviousMouseLeave)},_handleNextMouseEnter:function(){this.controlsContainer.on("mouseleave",this._handleNextMouseLeave),this._handleScrollRepeat(this.SCROLL_RIGHT,this.tabsContainer.scrollLeft())},_handlePreviousMouseEnter:function(){this.tabPreviousButton.on("mouseleave",this._handlePreviousMouseLeave),this._handleScrollRepeat(this.SCROLL_LEFT,this.tabsContainer.scrollLeft())},_handleNextMouseLeave:function(){this.rAF=window.cancelAnimationFrame(this.rAF),this.controlsContainer.off("mouseleave",this._handleNextMouseLeave)},_handlePreviousMouseLeave:function(){this.rAF=window.cancelAnimationFrame(this.rAF),this.tabPreviousButton.off("mouseleave",this._handlePreviousMouseLeave)},_handleNextButtonMouseDown:function(){for(var t,e=0;e<this.tabs.length;e+=1)if(this.tabs[e].element.get(0).offsetLeft>this.tabsContainer.get(0).offsetWidth+this.tabsContainer.scrollLeft()){t=this.tabs[e].element.get(0);break}t?(t.scrollIntoView({behavior:"smooth",inline:"nearest"}),this._handleScrollButtonMouseDown(this.SCROLL_RIGHT)):this.tabsContainer.get(0).scrollLeft=this.tabsContainer.get(0).scrollWidth},_handlePreviousButtonMouseDown:function(){for(var t,e=this.tabs.length-1;e>=0;e-=1)if(this.tabs[e].element.get(0).offsetLeft<this.tabsContainer.scrollLeft()){t=this.tabs[e].element.get(0);break}t?(t.scrollIntoView({behavior:"smooth",inline:"start"}),this._handleScrollButtonMouseDown(this.SCROLL_LEFT)):this.tabsContainer.get(0).scrollLeft=0},_handleScrollButtonMouseDown:function(t){this.holdTimer=setTimeout(function(){this._handleScrollRepeat(t,this.tabsContainer.scrollLeft(),100)}.bind(this),this.CLICK_TIMEOUT),window.addEventListener("mouseup",this._handleScrollButtonMouseUp)},_handleScrollButtonMouseUp:function(){this.holdTimer=clearTimeout(this.holdTimer),this.rAF=cancelAnimationFrame(this.rAF),window.removeEventListener("mouseup",this._handleScrollButtonMouseUp)},_checkScrollArrows:function(){this.tabsContainer.scrollLeft()===0?this.tabPreviousButton.first().attr("disabled",!0):this.tabsContainer.scrollLeft()+this.tabsContainer.innerWidth()===this.tabsContainer.get(0).scrollWidth?this.tabNextButton.attr("disabled",!0):(this.tabNextButton.attr("disabled",!1),this.tabPreviousButton.first().attr("disabled",!1))},_handleScrollRepeat:function(t,e,n,s){n||(n=0);var i=this.tabsContainer.get(0).getBoundingClientRect();if(t===this.SCROLL_LEFT){if(this.tabsContainer.scrollLeft(e-n),this.isDraggingTab&&this.parent._highlightHeaderDropZone(i.left-1),this.tabsContainer.scrollLeft()===0){this._checkScrollArrows();return}}else if(t===this.SCROLL_RIGHT&&(this.tabsContainer.scrollLeft(e+n),this.isDraggingTab&&this.parent._highlightHeaderDropZone(i.right+1),this.tabsContainer.scrollLeft()+this.tabsContainer.innerWidth()===this.tabsContainer.get(0).scrollWidth)){this._checkScrollArrows();return}window.cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(function(o){var r=s||o,l=o-r,a=this.START_SPEED*l+.5*this.ACCELERATION*(l*l);a=Math.min(a,this.tabsContainer.get(0).scrollWidth),this._handleScrollRepeat(t,e,a,r)}.bind(this))},_$setClosable:function(t){return this.closeButton&&this._isClosable()?(this.closeButton.element[t?"show":"hide"](),!0):!1},_$destroy:function(){this.emit("destroy",this);for(var t=0;t<this.tabs.length;t++)this.tabs[t]._$destroy();this._detachWheelListener(),this._handleItemDropped(),de(document).off("mouseup",this._hideAdditionalTabsDropdown),this.tabDropdownSearch.off("input",this._handleFilterInput),this.tabDropdownSearch.off("keydown",this._handleFilterKeydown),this.element.remove()},_getHeaderSetting:function(t){if(t in this.parent._header)return this.parent._header[t]},_createControls:function(){var t,e,n,s,i,o,r,l;l=this.layoutManager.config.labels.tabDropdown,this.layoutManager.config.labels.tabNextLabel,this.layoutManager.config.labels.tabPreviousLabel,this.tabDropdownButton=new Oi(this,l,"lm_tabdropdown",this._showAdditionalTabsDropdown),this.tabDropdownButton.element.hide(),this.controlsContainer.prepend(this.tabNextButton),this.tabNextButton.hide(),this._getHeaderSetting("popout")&&(e=se.fnBind(this._onPopoutClick,this),n=this._getHeaderSetting("popout"),new Oi(this,n,"lm_popout",e)),this._getHeaderSetting("maximise")&&(o=se.fnBind(this.parent.toggleMaximise,this.parent),s=this._getHeaderSetting("maximise"),i=this._getHeaderSetting("minimise"),r=new Oi(this,s,"lm_maximise",o),this.parent.on("maximised",function(){r.element.attr("title",i)}),this.parent.on("minimised",function(){r.element.attr("title",s)})),this._isClosable()&&(t=se.fnBind(this.parent.remove,this.parent),n=this._getHeaderSetting("close"),this.closeButton=new Oi(this,n,"lm_close",t))},_showAdditionalTabsDropdown:function(){if(this.isDropdownShown){this._hideAdditionalTabsDropdown();return}this.tabDropdownList=this.tabsContainer.clone(!0).appendTo(this.tabDropdownContainer).children().removeClass("lm_active"),this.tabDropdownContainer.show(),this.isDropdownShown=!0,this.element.addClass("lm_dropdown_open"),this.tabDropdownSearch.val("").focus(),this.dropdownKeyIndex=0,this.tabDropdownList.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active"),de(document).on("mousedown",this._hideAdditionalTabsDropdown),this._updateAdditionalTabsDropdown()},_handleFilterKeydown:function(t){if(this.dropdownKeyIndex===-1)return;if(t.key==="Escape"){this._hideAdditionalTabsDropdown();return}if(t.key==="Enter"||t.key===" "){this._hideAdditionalTabsDropdown(),this.tabs[this.dropdownKeyIndex]._onTabClick();return}function e(n,s,i){if(i.length<2)return-1;for(var o=(n+s+i.length)%i.length;o!==n;){if(i.eq(o).css("display")!=="none")return o;o=(o+s+i.length)%i.length}return n}t.key==="ArrowDown"||t.key==="Tab"&&t.shiftKey===!1?(t.preventDefault(),this.tabDropdownList.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=e(this.dropdownKeyIndex,1,this.tabDropdownList),this.tabDropdownList.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")):(t.key==="ArrowUp"||t.key==="Tab")&&(t.preventDefault(),this.tabDropdownList.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=e(this.dropdownKeyIndex,-1,this.tabDropdownList),this.tabDropdownList.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active"))},_handleFilterInput:function(t){this.tabDropdownList.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=-1;for(var e=0;e<this.tabDropdownList.length;e++)this.tabs[e].contentItem.config.title.toLowerCase().indexOf(t.target.value.toLowerCase())!==-1?(this.tabDropdownList.eq(e).css("display",""),this.dropdownKeyIndex===-1&&(this.dropdownKeyIndex=e)):this.tabDropdownList.eq(e).css("display","none");this.dropdownKeyIndex!==-1&&this.tabDropdownList.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")},_hideAdditionalTabsDropdown:function(t){!this.isDropdownShown||t&&this.tabDropdownContainer.get(0).contains(t.target)||t&&this.tabDropdownButton.element.get(0)===t.target||(this.element.removeClass("lm_dropdown_open"),this.tabDropdownContainer.hide(),this.isDropdownShown=!1,this.tabDropdownContainer.find(".lm_tabs").remove(),de(document).off("mousedown",this._hideAdditionalTabsDropdown))},_updateAdditionalTabsDropdown:function(){this.tabDropdownContainer.css("max-height","");var t=this.tabDropdownContainer[0].scrollHeight;if(t!==0){var e=this.tabDropdownContainer.offset().top-de(window).scrollTop();e+t>de(window).height()&&this.tabDropdownContainer.css("max-height",de(window).height()-e-10)}},_isClosable:function(){return this.parent.config.isClosable&&this.layoutManager.config.settings.showCloseIcon},_onPopoutClick:function(){this.layoutManager.config.settings.popoutWholeStack===!0?this.parent.popout():this.activeContentItem.popout()},_onHeaderClick:function(t){t.target===this.element[0]&&this.parent.select()},_updateTabSizes:function(){this.tabs.length!==0&&(!this.isOverflowing&&this.tabsContainer.get(0).scrollWidth>this.tabsContainer.get(0).clientWidth?(this.tabDropdownButton.element.show(),this.tabNextButton.show(),this.tabPreviousButton.show(),this.isOverflowing=!0):this.isOverflowing&&this.tabsContainer.get(0).scrollWidth<=this.tabsContainer.get(0).clientWidth&&(this.tabDropdownButton.element.hide(),this.tabNextButton.hide(),this.tabPreviousButton.hide(),this.isOverflowing=!1),this.isOverflowing&&this._checkScrollArrows())}});const fm=function(t,e,n){this._isVertical=t,this._size=e,this._grabSize=n<e?e:n,this.element=this._createElement(),this._dragListener=new se.DragListener(this.element)};se.copy(fm.prototype,{on:function(t,e,n){this._dragListener.on(t,e,n)},_$destroy:function(){this._dragListener.destroy(),this._dragListener=null,this.element.remove()},_createElement:function(){var t=de('<div class="lm_drag_handle"></div>'),e=de('<div class="lm_splitter"></div>');e.append(t);var n=this._grabSize-this._size,s=n/2;return this._isVertical?(t.css("top",-s),t.css("height",this._size+n),e.addClass("lm_vertical"),e.height(this._size)):(t.css("left",-s),t.css("width",this._size+n),e.addClass("lm_horizontal"),e.width(this._size)),e}});const Cm=function(){this._element=de('<div class="lm_transition_indicator"></div>'),de(document.body).append(this._element),this._toElement=null,this._fromDimensions=null,this._totalAnimationDuration=200,this._animationStartTime=null};se.copy(Cm.prototype,{destroy:function(){this._element.remove()},transitionElements:function(t,e){},_nextAnimationFrame:function(){var t=this._measure(this._toElement),e=(se.now()-this._animationStartTime)/this._totalAnimationDuration,n={},s;if(e>=1){this._element.hide();return}t.opacity=0;for(s in this._fromDimensions)n[s]=this._fromDimensions[s]+(t[s]-this._fromDimensions[s])*e;this._element.css(n),se.animFrame(se.fnBind(this._nextAnimationFrame,this))},_measure:function(t){var e=t.offset();return{left:e.left,top:e.top,width:t.outerWidth(),height:t.outerHeight()}}});const hc={BrowserPopout:mm,DragProxy:wi,DragSource:pm,DragSourceFromEvent:gm,DropTargetIndicator:yl,Header:ks,HeaderButton:Oi,Splitter:fm,Tab:zo,TransitionIndicator:Cm},bm=function(t,e){Error.call(this),this.name="Configuration Error",this.message=t,this.node=e};bm.prototype=new Error;const uc={ConfigurationError:bm},{itemDefaultConfig:zd}=lm,Ze=function(t,e,n){se.EventEmitter.call(this),this.config=this._extendItemNode(e),this.type=e.type,this.contentItems=[],this.parent=n,this.isInitialised=!1,this.isMaximised=!1,this.isRoot=!1,this.isRow=!1,this.isColumn=!1,this.isStack=!1,this.isComponent=!1,this.layoutManager=t,this._pendingEventPropagations={},this._throttledEvents=["stateChanged"],this.on(se.EventEmitter.ALL_EVENT,this._propagateEvent,this),e.content&&this._createContentItems(e)};se.copy(Ze.prototype,{setSize:function(){throw new Error("Abstract Method")},callDownwards:function(t,e,n,s){var i;for(n!==!0&&s!==!0&&this[t].apply(this,e||[]),i=0;i<this.contentItems.length;i++)this.contentItems[i].callDownwards(t,e,n);n===!0&&s!==!0&&this[t].apply(this,e||[])},removeChild:function(t,e){var n=se.indexOf(t,this.contentItems);if(n===-1)throw new Error("Can't remove child item. Unknown content item");e!==!0&&this.contentItems[n]._$destroy(),this.contentItems.splice(n,1),this.config.content.splice(n,1),this.contentItems.length>0?this.callDownwards("setSize"):this.type!=="root"&&this.config.isClosable&&this.parent.removeChild(this)},addChild:function(t,e){e===void 0&&(e=this.contentItems.length),this.contentItems.splice(e,0,t),this.config.content===void 0&&(this.config.content=[]),this.config.content.splice(e,0,t.config),t.parent=this,t.parent.isInitialised===!0&&t.isInitialised===!1&&t._$init()},replaceChild:function(t,e,n){e=this.layoutManager._$normalizeContentItem(e);var s=se.indexOf(t,this.contentItems),i=t.element[0].parentNode;if(s===-1)throw new Error("Can't replace child. oldChild is not child of this");i.replaceChild(e.element[0],t.element[0]),n===!0&&(t.parent=null,t._$destroy()),this.contentItems[s]=e,e.parent=this,this.isStack&&(this.header.tabs[s].contentItem=e),e.parent.isInitialised===!0&&e.isInitialised===!1&&e._$init(),this.callDownwards("setSize")},remove:function(){this.parent.removeChild(this)},popout:function(){var t=this.layoutManager.createPopout(this);return this.emitBubblingEvent("stateChanged"),t},toggleMaximise:function(t){t&&t.preventDefault(),this.isMaximised===!0?this.layoutManager._$minimiseItem(this):this.layoutManager._$maximiseItem(this),this.isMaximised=!this.isMaximised,this.emitBubblingEvent("stateChanged")},select:function(){this.layoutManager.selectedItem!==this&&(this.layoutManager.selectItem(this,!0),this.element.addClass("lm_selected"))},deselect:function(){this.layoutManager.selectedItem===this&&(this.layoutManager.selectedItem=null,this.element.removeClass("lm_selected"))},setTitle:function(t){this.config.title=t,this.emit("titleChanged",t),this.emitBubblingEvent("stateChanged")},hasId:function(t){if(this.config.id){if(typeof this.config.id=="string")return this.config.id===t;if(this.config.id instanceof Array)return se.indexOf(t,this.config.id)!==-1}else return!1},addId:function(t){this.hasId(t)||(this.config.id?typeof this.config.id=="string"?this.config.id=[this.config.id,t]:this.config.id instanceof Array&&this.config.id.push(t):this.config.id=t)},removeId:function(t){if(!this.hasId(t))throw new Error("Id not found");if(typeof this.config.id=="string")delete this.config.id;else if(this.config.id instanceof Array){var e=se.indexOf(t,this.config.id);this.config.id.splice(e,1)}},getItemsByFilter:function(t){var e=[],n=function(s){for(var i=0;i<s.contentItems.length;i++)t(s.contentItems[i])===!0&&e.push(s.contentItems[i]),n(s.contentItems[i])};return n(this),e},getItemsById:function(t){return this.getItemsByFilter(function(e){return e.config.id instanceof Array?se.indexOf(t,e.config.id)!==-1:e.config.id===t})},getItemsByType:function(t){return this._$getItemsByProperty("type",t)},getComponentsByName:function(t){var e=this._$getItemsByProperty("componentName",t),n=[],s;for(s=0;s<e.length;s++)n.push(e[s].instance);return n},_$getItemsByProperty:function(t,e){return this.getItemsByFilter(function(n){return n[t]===e})},_$setParent:function(t){this.parent=t},_$highlightDropZone:function(t,e,n){this.layoutManager.dropTargetIndicator.highlightArea(n)},_$onDrop:function(t){this.addChild(t)},_$hide:function(){this._callOnActiveComponents("hide"),this.element.hide(),this.layoutManager.updateSize()},_$show:function(){this._callOnActiveComponents("show"),this.element.show(),this.layoutManager.updateSize()},_callOnActiveComponents:function(t){var e=this.getItemsByType("stack"),n,s;for(s=0;s<e.length;s++)n=e[s].getActiveContentItem(),n&&n.isComponent&&n.container[t]()},_$destroy:function(){this.emitBubblingEvent("beforeItemDestroyed"),this.callDownwards("_$destroy",[],!0,!0),this.element.remove(),this.emitBubblingEvent("itemDestroyed")},_$getArea:function(t){t=t||this.element;var e=t.offset(),n=t.width(),s=t.height();return{x1:e.left,y1:e.top,x2:e.left+n,y2:e.top+s,surface:n*s,contentItem:this}},_$init:function(){var t;for(this.setSize(),t=0;t<this.contentItems.length;t++)this.childElementContainer.append(this.contentItems[t].element);this.isInitialised=!0,this.emitBubblingEvent("itemCreated"),this.emitBubblingEvent(this.type+"Created")},emitBubblingEvent:function(t){var e=new se.BubblingEvent(t,this);this.emit(t,e)},_createContentItems:function(t){var e,n;if(!(t.content instanceof Array))throw new uc.ConfigurationError("content must be an Array",t);for(n=0;n<t.content.length;n++)e=this.layoutManager.createContentItem(t.content[n],this),this.contentItems.push(e)},_extendItemNode:function(t){for(var e in zd)t[e]===void 0&&(t[e]=zd[e]);return t},_propagateEvent:function(t,e){e instanceof se.BubblingEvent&&e.isPropagationStopped===!1&&this.isInitialised===!0&&(this.isRoot===!1&&this.parent?this.parent.emit.apply(this.parent,Array.prototype.slice.call(arguments,0)):this._scheduleEventPropagationToLayoutManager(t,e))},_scheduleEventPropagationToLayoutManager:function(t,e){se.indexOf(t,this._throttledEvents)===-1?this.layoutManager.emit(t,e.origin):this._pendingEventPropagations[t]!==!0&&(this._pendingEventPropagations[t]=!0,se.animFrame(se.fnBind(this._propagateEventToLayoutManager,this,[t,e])))},_propagateEventToLayoutManager:function(t,e){this._pendingEventPropagations[t]=!1,this.layoutManager.emit(t,e)}});const mc=function(t,e,n){Ze.call(this,t,e,n);var s=t.getComponent(this.config.componentName)||t.getFallbackComponent(),i=de.extend(!0,{},this.config.componentState||{});if(s==null)throw new uc.ConfigurationError('Unknown component "'+this.config.componentName+'"');i.componentName=this.config.componentName,this.componentName=this.config.componentName,this.config.title===""&&(this.config.title=this.config.componentName),this.isComponent=!0,this.container=new um.ItemContainer(this.config,this,t),this.instance=new s(this.container,i),this.element=this.container._element};se.extend(mc,Ze);se.copy(mc.prototype,{close:function(){this.parent.removeChild(this)},setSize:function(){this.element.is(":visible")&&this.container._$setSize(this.element.width(),this.element.height())},_$init:function(){Ze.prototype._$init.call(this),this.container.emit("open")},_$hide:function(){this.container.hide(),Ze.prototype._$hide.call(this)},_$show:function(){this.container.show(),this.container._config.isFocusOnShow&&this.container._contentElement[0].focus({preventScroll:!0}),Ze.prototype._$show.call(this)},_$destroy:function(){this.container.emit("destroy",this),Ze.prototype._$destroy.call(this)},_$getArea:function(){return null}});const Il=function(t,e,n,s){Ze.call(this,e,n,s),this.isRow=!t,this.isColumn=t,this.element=de('<div class="lm_item lm_'+(t?"column":"row")+'"></div>'),this.childElementContainer=this.element,this._splitterSize=e.config.dimensions.borderWidth,this._splitterGrabSize=e.config.dimensions.borderGrabWidth,this._isColumn=t,this._dimension=t?"height":"width",this._splitter=[],this._splitterPosition=null,this._splitterMinPosition=null,this._splitterMaxPosition=null};se.extend(Il,Ze);se.copy(Il.prototype,{addChild:function(t,e,n){var s,i,o,r;if(t=this.layoutManager._$normalizeContentItem(t,this),e===void 0&&(e=this.contentItems.length),this.contentItems.length>0?(r=this._createSplitter(Math.max(0,e-1)).element,e>0?(this.contentItems[e-1].element.after(r),r.after(t.element)):(this.contentItems[0].element.before(r),r.before(t.element))):this.childElementContainer.append(t.element),Ze.prototype.addChild.call(this,t,e),s=1/this.contentItems.length*100,n===!0){this.emitBubblingEvent("stateChanged");return}for(o=0;o<this.contentItems.length;o++)this.contentItems[o]===t?t.config[this._dimension]=s:(i=this.contentItems[o].config[this._dimension]*=(100-s)/100,this.contentItems[o].config[this._dimension]=i);this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")},removeChild:function(t,e){var n=t.config[this._dimension],s=se.indexOf(t,this.contentItems),i=Math.max(s-1,0),o,r;if(s===-1)throw new Error("Can't remove child. ContentItem is not child of this Row or Column");for(this._splitter[i]&&(this._splitter[i]._$destroy(),this._splitter.splice(i,1)),o=0;o<this.contentItems.length;o++)this.contentItems[o]!==t&&(this.contentItems[o].config[this._dimension]+=n/(this.contentItems.length-1));Ze.prototype.removeChild.call(this,t,e),this.contentItems.length===1&&this.config.isClosable===!0?(r=this.contentItems[0],this.contentItems=[],this.parent.replaceChild(this,r,!0)):(this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged"))},replaceChild:function(t,e){var n=t.config[this._dimension];Ze.prototype.replaceChild.call(this,t,e),e.config[this._dimension]=n,this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")},setSize:function(){this.contentItems.length>0&&(this._calculateRelativeSizes(),this._setAbsoluteSizes()),this.emitBubblingEvent("stateChanged"),this.emit("resize")},_$init:function(){if(this.isInitialised!==!0){var t;for(Ze.prototype._$init.call(this),t=0;t<this.contentItems.length-1;t++)this.contentItems[t].element.after(this._createSplitter(t).element)}},_setAbsoluteSizes:function(){var t,e=this._calculateAbsoluteSizes();for(t=0;t<this.contentItems.length;t++)e.additionalPixel-t>0&&e.itemSizes[t]++,this._isColumn?(this.contentItems[t].element.width(e.totalWidth),this.contentItems[t].element.height(e.itemSizes[t])):(this.contentItems[t].element.width(e.itemSizes[t]),this.contentItems[t].element.height(e.totalHeight))},_calculateAbsoluteSizes:function(){var t,e=(this.contentItems.length-1)*this._splitterSize,n=this.element.width(),s=this.element.height(),i=0,o,r,l=[];for(this._isColumn?s-=e:n-=e,t=0;t<this.contentItems.length;t++)this._isColumn?r=Math.floor(s*(this.contentItems[t].config.height/100)):r=Math.floor(n*(this.contentItems[t].config.width/100)),i+=r,l.push(r);return o=Math.floor((this._isColumn?s:n)-i),{itemSizes:l,additionalPixel:o,totalWidth:n,totalHeight:s}},_calculateRelativeSizes:function(){var t,e=0,n=[],s=this._isColumn?"height":"width";for(t=0;t<this.contentItems.length;t++)this.contentItems[t].config[s]!==void 0?e+=this.contentItems[t].config[s]:n.push(this.contentItems[t]);if(Math.round(e)===100){this._respectMinItemWidth();return}if(Math.round(e)<100&&n.length>0){for(t=0;t<n.length;t++)n[t].config[s]=(100-e)/n.length;this._respectMinItemWidth();return}if(Math.round(e)>100)for(t=0;t<n.length;t++)n[t].config[s]=50,e+=50;for(t=0;t<this.contentItems.length;t++)this.contentItems[t].config[s]=this.contentItems[t].config[s]/e*100;this._respectMinItemWidth()},_respectMinItemWidth:function(){var t=this.layoutManager.config.dimensions&&this.layoutManager.config.dimensions.minItemWidth||0,e=null,n=[],s=0,i=0,o=0,r=0,l,a,c=[],h;if(!(this._isColumn||!t||this.contentItems.length<=1)){e=this._calculateAbsoluteSizes();for(var u=0;u<this.contentItems.length;u++)this.contentItems[u],r=e.itemSizes[u],r<t?(i+=t-r,h={width:t}):(s+=r-t,h={width:r},n.push(h)),c.push(h);if(!(i===0||i>s)){for(l=i/s,o=i,u=0;u<n.length;u++)h=n[u],a=Math.round((h.width-t)*l),o-=a,h.width-=a;for(o!==0&&(c[c.length-1].width-=o),u=0;u<this.contentItems.length;u++)this.contentItems[u].config.width=c[u].width/e.totalWidth*100}}},_createSplitter:function(t){var e;return e=new hc.Splitter(this._isColumn,this._splitterSize,this._splitterGrabSize),e.on("drag",se.fnBind(this._onSplitterDrag,this,[e]),this),e.on("dragStop",se.fnBind(this._onSplitterDragStop,this,[e]),this),e.on("dragStart",se.fnBind(this._onSplitterDragStart,this,[e]),this),this._splitter.splice(t,0,e),e},_getItemsForSplitter:function(t){var e=se.indexOf(t,this._splitter);return{before:this.contentItems[e],after:this.contentItems[e+1]}},_getMinimumDimensions:function(t){for(var e=0,n=0,s=0;s<t.length;++s)e=Math.max(t[s].minWidth||0,e),n=Math.max(t[s].minHeight||0,n);return{horizontal:e,vertical:n}},_onSplitterDragStart:function(t){var e=this._getItemsForSplitter(t),n=this.layoutManager.config.dimensions[this._isColumn?"minItemHeight":"minItemWidth"],s=this._getMinimumDimensions(e.before.config.content),i=this._isColumn?s.vertical:s.horizontal,o=this._getMinimumDimensions(e.after.config.content),r=this._isColumn?o.vertical:o.horizontal;this._splitterPosition=0,this._splitterMinPosition=-1*(e.before.element[this._dimension]()-(i||n)),this._splitterMaxPosition=e.after.element[this._dimension]()-(r||n)},_onSplitterDrag:function(t,e,n){var s=this._isColumn?n:e;s>this._splitterMinPosition&&s<this._splitterMaxPosition&&(this._splitterPosition=s,t.element.css(this._isColumn?"top":"left",s))},_onSplitterDragStop:function(t){var e=this._getItemsForSplitter(t),n=e.before.element[this._dimension](),s=e.after.element[this._dimension](),i=(this._splitterPosition+n)/(n+s),o=e.before.config[this._dimension]+e.after.config[this._dimension];e.before.config[this._dimension]=i*o,e.after.config[this._dimension]=(1-i)*o,t.element.css({top:0,left:0}),se.animFrame(se.fnBind(this.callDownwards,this,["setSize"]))}});const pc=function(t,e,n){Ze.call(this,t,e,null),this.isRoot=!0,this.type="root",this.element=de('<div class="lm_goldenlayout lm_item lm_root"></div>'),this.childElementContainer=this.element,this._containerElement=n,this._containerElement.append(this.element)};se.extend(pc,Ze);se.copy(pc.prototype,{addChild:function(t){if(this.contentItems.length>0)throw new Error("Root node can only have a single child");t=this.layoutManager._$normalizeContentItem(t,this),this.childElementContainer.append(t.element),Ze.prototype.addChild.call(this,t),this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")},setSize:function(t,e){t=typeof t>"u"?this._containerElement.width():t,e=typeof e>"u"?this._containerElement.height():e,this.element.width(t),this.element.height(e),this.contentItems[0]&&(this.contentItems[0].element.width(t),this.contentItems[0].element.height(e))},_$highlightDropZone:function(t,e,n){this.layoutManager.tabDropPlaceholder.remove(),Ze.prototype._$highlightDropZone.apply(this,arguments)},_$onDrop:function(t,e){var n;if(t.isComponent&&(n=this.layoutManager.createContentItem({type:"stack",header:t.config.header||{}},this),n._$init(),n.addChild(t),t=n),!this.contentItems.length)this.addChild(t);else{var s=e.side[0]=="x"?"row":"column",i=e.side[0]=="x"?"width":"height",o=e.side[1]=="2",r=this.contentItems[0];if(!r instanceof Il||r.type!=s){var l=this.layoutManager.createContentItem({type:s},this);this.replaceChild(r,l),l.addChild(t,o?0:void 0,!0),l.addChild(r,o?void 0:0,!0),r.config[i]=50,t.config[i]=50,l.callDownwards("setSize")}else{var a=r.contentItems[o?0:r.contentItems.length-1];r.addChild(t,o?0:void 0,!0),a.config[i]*=.5,t.config[i]=a.config[i],r.callDownwards("setSize")}}}});const gc=function(t,e,n){Ze.call(this,t,e,n),this.element=de('<div class="lm_item lm_stack"></div>'),this._activeContentItem=null;var s=t.config;this._header={show:s.settings.hasHeaders===!0&&e.hasHeaders!==!1,popout:s.settings.showPopoutIcon&&s.labels.popout,maximise:s.settings.showMaximiseIcon&&s.labels.maximise,close:s.settings.showCloseIcon&&s.labels.close,minimise:s.labels.minimise},s.header&&se.copy(this._header,s.header),e.header&&se.copy(this._header,e.header),e.content&&e.content[0]&&e.content[0].header&&se.copy(this._header,e.content[0].header),this._dropZones={},this._dropSegment=null,this._contentAreaDimensions=null,this._dropIndex=null,this.isStack=!0,this.childElementContainer=de('<div class="lm_items"></div>'),this.header=new hc.Header(t,this),this.element.append(this.header.element),this.element.append(this.childElementContainer),this._setupHeaderPosition(),this._$validateClosability()};se.extend(gc,Ze);se.copy(gc.prototype,{setSize:function(){var t,e=this._header.show?this.layoutManager.config.dimensions.headerHeight:0,n=this.element.width()-(this._sided?e:0),s=this.element.height()-(this._sided?0:e);for(this.childElementContainer.width(n),this.childElementContainer.height(s),t=0;t<this.contentItems.length;t++)this.contentItems[t].element.width(n).height(s);this.emit("resize"),this.emitBubblingEvent("stateChanged")},_$init:function(){var t,e;if(this.isInitialised!==!0){for(this.header._attachWheelListener(),Ze.prototype._$init.call(this),t=0;t<this.contentItems.length;t++)this.header.createTab(this.contentItems[t]),this.contentItems[t]._$hide();if(this.contentItems.length>0){if(e=this.contentItems[this.config.activeItemIndex||0],!e)throw new Error("Configured activeItemIndex out of bounds");this.setActiveContentItem(e)}}},setActiveContentItem:function(t){if(se.indexOf(t,this.contentItems)===-1)throw new Error("contentItem is not a child of this stack");this._activeContentItem!==null&&this._activeContentItem._$hide(),this._activeContentItem=t,this.header.setActiveContentItem(t),t._$show(),this.emit("activeContentItemChanged",t),this.layoutManager.emit("activeContentItemChanged",t),this.emitBubblingEvent("stateChanged")},getActiveContentItem:function(){return this.header.activeContentItem},addChild:function(t,e){t=this.layoutManager._$normalizeContentItem(t,this),Ze.prototype.addChild.call(this,t,e),this.childElementContainer.append(t.element),this.header.createTab(t,e),this.setActiveContentItem(t),this.callDownwards("setSize"),this._$validateClosability(),this.emitBubblingEvent("stateChanged")},removeChild:function(t,e){var n=se.indexOf(t,this.contentItems);Ze.prototype.removeChild.call(this,t,e),this.header.removeTab(t),this.header.activeContentItem===t&&(this.contentItems.length>0?this.setActiveContentItem(this.contentItems[Math.max(n-1,0)]):this._activeContentItem=null),this._$validateClosability(),this.emitBubblingEvent("stateChanged")},_$validateClosability:function(){var t,e,n;for(t=this.header._isClosable(),n=0,e=this.contentItems.length;n<e&&t;n++)t=this.contentItems[n].config.isClosable;this.header._$setClosable(t)},_$destroy:function(){Ze.prototype._$destroy.call(this),this.header._$destroy()},_$onDrop:function(t){if(this._dropSegment==="header"){this._resetHeaderDropZone(),this.addChild(t,this._dropIndex);return}if(this._dropSegment==="body"){this.addChild(t);return}var e=this._dropSegment==="top"||this._dropSegment==="bottom",n=this._dropSegment==="left"||this._dropSegment==="right",s=this._dropSegment==="top"||this._dropSegment==="left",i=e&&this.parent.isColumn||n&&this.parent.isRow,o=e?"column":"row",r=e?"height":"width",l,a,c;t.isComponent&&(a=this.layoutManager.createContentItem({type:"stack",header:t.config.header||{}},this),a._$init(),a.addChild(t),t=a),i?(l=se.indexOf(this,this.parent.contentItems),this.parent.addChild(t,s?l:l+1,!0),this.config[r]*=.5,t.config[r]=this.config[r],this.parent.callDownwards("setSize")):(o=e?"column":"row",c=this.layoutManager.createContentItem({type:o},this),this.parent.replaceChild(this,c),c.addChild(t,s?0:void 0,!0),c.addChild(this,s?void 0:0,!0),this.config[r]=50,t.config[r]=50,c.callDownwards("setSize"))},_$highlightDropZone:function(t,e){var n,s;for(n in this._contentAreaDimensions)if(s=this._contentAreaDimensions[n].hoverArea,s.x1<t&&s.x2>t&&s.y1<e&&s.y2>e){n==="header"?(this._dropSegment="header",this._highlightHeaderDropZone(t,e)):(this._resetHeaderDropZone(),this._highlightBodyDropZone(n));return}},_$getArea:function(){if(this.element.is(":visible")===!1)return null;var t=Ze.prototype._$getArea,e=t.call(this,this.header.element),n=t.call(this,this.childElementContainer),s=n.x2-n.x1,i=n.y2-n.y1;return this._contentAreaDimensions={header:{hoverArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2},highlightArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2}}},this._activeContentItem&&this._activeContentItem.isComponent===!1?e:this.contentItems.length===0?(this._contentAreaDimensions.body={hoverArea:{x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2},highlightArea:{x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2}},t.call(this,this.element)):(this._contentAreaDimensions.left={hoverArea:{x1:n.x1,y1:n.y1,x2:n.x1+s*.25,y2:n.y2},highlightArea:{x1:n.x1,y1:n.y1,x2:n.x1+s*.5,y2:n.y2}},this._contentAreaDimensions.top={hoverArea:{x1:n.x1+s*.25,y1:n.y1,x2:n.x1+s*.75,y2:n.y1+i*.5},highlightArea:{x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y1+i*.5}},this._contentAreaDimensions.right={hoverArea:{x1:n.x1+s*.75,y1:n.y1,x2:n.x2,y2:n.y2},highlightArea:{x1:n.x1+s*.5,y1:n.y1,x2:n.x2,y2:n.y2}},this._contentAreaDimensions.bottom={hoverArea:{x1:n.x1+s*.25,y1:n.y1+i*.5,x2:n.x1+s*.75,y2:n.y2},highlightArea:{x1:n.x1,y1:n.y1+i*.5,x2:n.x2,y2:n.y2}},t.call(this,this.element))},_highlightHeaderDropZone:function(t){var e=this.header.tabs.length,n=null,s=null;if(e===0){var i=this.header.element.offset();this.layoutManager.dropTargetIndicator.highlightArea({x1:i.left,x2:i.left+100,y1:this.header.element.offset().top,y2:this.header.element.offset().top+this.header.element.innerHeight()});return}var o=this.header.tabsContainer,r=o.get(0).getBoundingClientRect(),l=this.layoutManager.tabDropPlaceholder.get(0).getBoundingClientRect();if(t<r.left?t=r.left+1:t>r.right&&(t=r.right-1),!(l.left<t&&t<l.right)){for(var a=0;a<e;a++)if(n=this.header.tabs[a].element,s=n.get(0).getBoundingClientRect(),s.left<t&&t<s.right){this._dropIndex=a;break}n&&t<s.left+s.width*.5?n.before(this.layoutManager.tabDropPlaceholder):n&&(this._dropIndex=Math.min(this._dropIndex+1,e),n.after(this.layoutManager.tabDropPlaceholder))}var c=this.layoutManager.tabDropPlaceholder.offset().left;c=Math.max(c,this.header.tabsContainer.offset().left);var h=c+this.layoutManager.tabDropPlaceholder.width();h=Math.min(h,this.header.tabsContainer.offset().left+this.header.tabsContainer.innerWidth()),this.layoutManager.dropTargetIndicator.highlightArea({x1:c,x2:h,y1:this.header.element.offset().top,y2:this.header.element.offset().top+this.header.element.innerHeight()})},_resetHeaderDropZone:function(){this.layoutManager.tabDropPlaceholder.remove()},_setupHeaderPosition:function(){var t=["right","left","bottom"].indexOf(this._header.show)>=0&&this._header.show;if(this.header.element.toggle(!!this._header.show),this._side=t,this._sided=["right","left"].indexOf(this._side)>=0,this.element.removeClass("lm_left lm_right lm_bottom"),this._side&&this.element.addClass("lm_"+this._side),this.element.find(".lm_header").length&&this.childElementContainer){var e=["right","bottom"].indexOf(this._side)>=0?"before":"after";this.header.element[e](this.childElementContainer),this.callDownwards("setSize")}},_highlightBodyDropZone:function(t){var e=this._contentAreaDimensions[t].highlightArea;this.layoutManager.dropTargetIndicator.highlightArea(e),this._dropSegment=t}});const RS={AbstractContentItem:Ze,Component:mc,Root:pc,RowOrColumn:Il,Stack:gc},ve={config:lm,container:um,controls:hc,errors:uc,items:RS,utils:se},to=function(t,e){if(!de||typeof de.noConflict!="function"){var n="jQuery is missing as dependency for GoldenLayout. ";throw n+=`Please either expose $ on GoldenLayout's scope (e.g. window) or add "jquery" to `,n+="your paths when using RequireJS/AMD",new Error(n)}ve.utils.EventEmitter.call(this),this.isInitialised=!1,this._isFullPage=!1,this._resizeTimeoutId=null,this._components={"lm-react-component":ve.utils.ReactComponentHandler},this._fallbackComponent=void 0,this._itemAreas=[],this._resizeFunction=ve.utils.fnBind(this._onResize,this),this._unloadFunction=ve.utils.fnBind(this._onUnload,this),this._windowBlur=this._windowBlur.bind(this),this._windowFocus=this._windowFocus.bind(this),this._maximisedItem=null,this._maximisePlaceholder=de('<div class="lm_maximise_place"></div>'),this._creationTimeoutPassed=!1,this._subWindowsCreated=!1,this._dragSources=[],this._updatingColumnsResponsive=!1,this._firstLoad=!0,this.width=null,this.height=null,this.root=null,this.openPopouts=[],this.selectedItem=null,this.isSubWindow=!1,this.eventHub=new ve.utils.EventHub(this),this.config=this._createConfig(t),this.container=e,this.dropTargetIndicator=null,this.transitionIndicator=null,this.tabDropPlaceholder=de('<div class="lm_drop_tab_placeholder"></div>'),this.isSubWindow===!0&&de("body").css("visibility","hidden"),this._typeToItem={column:ve.utils.fnBind(ve.items.RowOrColumn,this,[!0]),row:ve.utils.fnBind(ve.items.RowOrColumn,this,[!1]),stack:ve.items.Stack,component:ve.items.Component}};to.__lm=ve;to.minifyConfig=function(t){return new ve.utils.ConfigMinifier().minifyConfig(t)};to.unminifyConfig=function(t){return new ve.utils.ConfigMinifier().unminifyConfig(t)};ve.utils.copy(to.prototype,{registerComponent:function(t,e){if(typeof e!="function"&&(e==null||e.render==null||typeof e.render!="function"))throw new Error("Please register a constructor function");if(this._components[t]!==void 0)throw new Error("Component "+t+" is already registered");this._components[t]=e;function n(){if(this._components[t]===void 0)throw new Error("Component "+t+" is not registered");delete this._components[t]}return n.bind(this)},setFallbackComponent:function(t){this._fallbackComponent=t},toConfig:function(t){var e,n,s;if(this.isInitialised===!1)throw new Error("Can't create config, layout not yet initialised");if(t&&!(t instanceof ve.items.AbstractContentItem))throw new Error("Root must be a ContentItem");for(e={settings:ve.utils.copy({},this.config.settings),dimensions:ve.utils.copy({},this.config.dimensions),labels:ve.utils.copy({},this.config.labels)},e.content=[],n=function(i,o){var r,l;for(r in o.config)r!=="content"&&(i[r]=o.config[r]);if(i.componentName==="lm-react-component"&&(i.type="react-component"),o.contentItems.length)for(i.content=[],l=0;l<o.contentItems.length;l++)i.content[l]={},n(i.content[l],o.contentItems[l])},t?n(e,{contentItems:[t]}):n(e,this.root),this._$reconcilePopoutWindows(),e.openPopouts=[],s=0;s<this.openPopouts.length;s++)e.openPopouts.push(this.openPopouts[s].toConfig());return e.maximisedItemId=this._maximisedItem?"__glMaximised":null,e},getComponent:function(t){return this._components[t]},getFallbackComponent:function(){return this._fallbackComponent},init:function(){if(this._subWindowsCreated===!1&&(this._createSubWindows(),this._subWindowsCreated=!0),document.readyState==="loading"||document.body===null){de(document).ready(ve.utils.fnBind(this.init,this));return}if(this.isSubWindow===!0&&this._creationTimeoutPassed===!1){setTimeout(ve.utils.fnBind(this.init,this),7),this._creationTimeoutPassed=!0;return}this.isSubWindow===!0&&this._adjustToWindowMode(),this._setContainer(),this.dropTargetIndicator=new ve.controls.DropTargetIndicator(this.container),this.transitionIndicator=new ve.controls.TransitionIndicator,this.updateSize(),this._create(this.config),this._bindEvents(),this.isInitialised=!0,this._adjustColumnsResponsive(),this.emit("initialised")},updateSize:function(t,e){arguments.length===2?(this.width=t,this.height=e):(this.width=this.container.width(),this.height=this.container.height()),this.isInitialised===!0&&(this.root.callDownwards("setSize",[this.width,this.height]),this._maximisedItem&&(this._maximisedItem.element.width(this.container.width()),this._maximisedItem.element.height(this.container.height()),this._maximisedItem.callDownwards("setSize")),this._adjustColumnsResponsive())},destroy:function(){this.isInitialised!==!1&&(this._onUnload(),de(window).off("resize",this._resizeFunction),de(window).off("unload beforeunload",this._unloadFunction),de(window).off("blur.lm").off("focus.lm"),this.root.callDownwards("_$destroy",[],!0),this.root.contentItems=[],this.tabDropPlaceholder.remove(),this.dropTargetIndicator.destroy(),this.transitionIndicator.destroy(),this.eventHub.destroy(),this._dragSources.forEach(function(t){t._dragListener.destroy(),t._element=null,t._itemConfig=null,t._dragListener=null}),this._dragSources=[])},createContentItem:function(t,e){var n,s;if(typeof t.type!="string")throw new ve.errors.ConfigurationError("Missing parameter 'type'",t);if(t.type==="react-component"&&(t.type="component",t.componentName="lm-react-component"),!this._typeToItem[t.type])throw n="Unknown type '"+t.type+"'. Valid types are "+ve.utils.objectKeys(this._typeToItem).join(","),new ve.errors.ConfigurationError(n);return t.type==="component"&&!(e instanceof ve.items.Stack)&&!!e&&!(this.isSubWindow===!0&&e instanceof ve.items.Root)&&(t={type:"stack",width:t.width,height:t.height,content:[t]}),s=new this._typeToItem[t.type](this,t,e),s},createPopout:function(t,e,n,s){var i=t,o=t instanceof ve.items.AbstractContentItem,r=this,l,a,c,h,u,m;if(n=n||null,o){for(i=this.toConfig(t).content,n=ve.utils.getUniqueId(),h=t.parent,u=t;h.contentItems.length===1&&!h.isRoot;)h=h.parent,u=u.parent;h.addId(n),isNaN(s)&&(s=ve.utils.indexOf(u,h.contentItems))}else i instanceof Array||(i=[i]);return!e&&o&&(l=window.screenX||window.screenLeft,a=window.screenY||window.screenTop,c=t.element.offset(),e={left:l+c.left,top:a+c.top,width:t.element.width(),height:t.element.height()}),!e&&!o&&(e={left:window.screenX||window.screenLeft+20,top:window.screenY||window.screenTop+20,width:500,height:309}),o&&t.remove(),m=new ve.controls.BrowserPopout(i,e,n,s,this),m.on("initialised",function(){r.emit("windowOpened",m)}),m.on("closed",function(){r._$reconcilePopoutWindows()}),this.openPopouts.push(m),m},createDragSource:function(t,e){this.config.settings.constrainDragToContainer=!1;var n=new ve.controls.DragSource(de(t),e,this);return this._dragSources.push(n),n},createDragSourceFromEvent:function(t,e){return this.config.settings.constrainDragToContainer=!1,new ve.controls.DragSourceFromEvent(t,this,e)},selectItem:function(t,e){if(this.config.settings.selectionEnabled!==!0)throw new Error("Please set selectionEnabled to true to use this feature");t!==this.selectedItem&&(this.selectedItem!==null&&this.selectedItem.deselect(),t&&e!==!0&&t.select(),this.selectedItem=t,this.emit("selectionChanged",t))},_$maximiseItem:function(t){this._maximisedItem!==null&&this._$minimiseItem(this._maximisedItem),this._maximisedItem=t,this._maximisedItem.addId("__glMaximised"),t.element.addClass("lm_maximised"),t.element.after(this._maximisePlaceholder),this.root.element.prepend(t.element),t.element.width(this.container.width()),t.element.height(this.container.height()),t.callDownwards("setSize"),this._maximisedItem.emit("maximised"),this.emit("stateChanged")},_$minimiseItem:function(t){t.element.removeClass("lm_maximised"),t.removeId("__glMaximised"),this._maximisePlaceholder.after(t.element),this._maximisePlaceholder.remove(),t.parent.callDownwards("setSize"),this._maximisedItem=null,t.emit("minimised"),this.emit("stateChanged")},_$closeWindow:function(){window.setTimeout(function(){window.close()},1)},_$getArea:function(t,e){var n,s,i=1/0,o=null;for(n=0;n<this._itemAreas.length;n++)s=this._itemAreas[n],t>s.x1&&t<s.x2&&e>s.y1&&e<s.y2&&i>s.surface&&(i=s.surface,o=s);return o},_$createRootItemAreas:function(){var t=50,e={y2:"y1",x2:"x1",y1:"y2",x1:"x2"};for(var n in e){var s=this.root._$getArea();s.side=n,e[n][1]=="2"?s[n]=s[e[n]]-t:s[n]=s[e[n]]+t,s.surface=(s.x2-s.x1)*(s.y2-s.y1),this._itemAreas.push(s)}},_$calculateItemAreas:function(){var t,e,n=this._getAllContentItems();if(this._itemAreas=[],n.length===1){this._itemAreas.push(this.root._$getArea());return}for(this._$createRootItemAreas(),t=0;t<n.length;t++)if(!!n[t].isStack&&(e=n[t]._$getArea(),e!==null))if(e instanceof Array)this._itemAreas=this._itemAreas.concat(e);else{this._itemAreas.push(e);var s={};ve.utils.copy(s,e),ve.utils.copy(s,e.contentItem._contentAreaDimensions.header.highlightArea),s.surface=(s.x2-s.x1)*(s.y2-s.y1),this._itemAreas.push(s)}},_$normalizeContentItem:function(t,e){if(!t)throw new Error("No content item defined");if(ve.utils.isFunction(t)&&(t=t()),t instanceof ve.items.AbstractContentItem)return t;if(de.isPlainObject(t)&&t.type){var n=this.createContentItem(t,e);return n.callDownwards("_$init"),n}else throw new Error("Invalid contentItem")},_$reconcilePopoutWindows:function(){var t=[],e;for(e=0;e<this.openPopouts.length;e++)this.openPopouts[e].getWindow().closed===!1?t.push(this.openPopouts[e]):this.emit("windowClosed",this.openPopouts[e]);this.openPopouts.length!==t.length&&(this.emit("stateChanged"),this.openPopouts=t)},_getAllContentItems:function(){var t=[],e=function(n){if(t.push(n),n.contentItems instanceof Array)for(var s=0;s<n.contentItems.length;s++)e(n.contentItems[s])};return e(this.root),t},_bindEvents:function(){this._isFullPage&&de(window).resize(this._resizeFunction),de(window).on("unload beforeunload",this._unloadFunction).on("blur.lm",this._windowBlur).on("focus.lm",this._windowFocus)},_windowBlur:function(){this.root.element.addClass("lm_window_blur")},_windowFocus:function(){this.root.element.removeClass("lm_window_blur")},_onResize:function(){clearTimeout(this._resizeTimeoutId),this._resizeTimeoutId=setTimeout(ve.utils.fnBind(this.updateSize,this),100)},_createConfig:function(t){var e=ve.utils.getQueryStringParam("gl-window");e&&(this.isSubWindow=!0,t=localStorage.getItem(e),t=JSON.parse(t),t=new ve.utils.ConfigMinifier().unminifyConfig(t),localStorage.removeItem(e)),t=de.extend(!0,{},ve.config.defaultConfig,t);var n=function(s){for(var i in s)i!=="props"&&typeof s[i]=="object"?n(s[i]):i==="type"&&s[i]==="react-component"&&(s.type="component",s.componentName="lm-react-component")};return n(t),t.settings.hasHeaders===!1&&(t.dimensions.headerHeight=0),t},_adjustToWindowMode:function(){var t=de('<div class="lm_popin" title="'+this.config.labels.popin+'"><div class="lm_icon"></div><div class="lm_bg"></div></div>');t.click(ve.utils.fnBind(function(){this.emit("popIn")},this)),document.title=ve.utils.stripTags(this.config.content[0].title),de("head").append(de("body link, body style, template, .gl_keep")),this.container=de("body").html("").css("visibility","visible").append(t),document.body.offsetHeight,window.__glInstance=this},_createSubWindows:function(){var t,e;for(t=0;t<this.config.openPopouts.length;t++)e=this.config.openPopouts[t],this.createPopout(e.content,e.dimensions,e.parentId,e.indexInParent)},_setContainer:function(){var t=de(this.container||"body");if(t.length===0)throw new Error("GoldenLayout container not found");if(t.length>1)throw new Error("GoldenLayout more than one container element specified");t[0]===document.body&&(this._isFullPage=!0,de("html, body").css({height:"100%",margin:0,padding:0,overflow:"hidden"})),this.container=t},_create:function(t){var e;if(!(t.content instanceof Array))throw t.content===void 0?e="Missing setting 'content' on top level of configuration":e="Configuration parameter 'content' must be an array",new ve.errors.ConfigurationError(e,t);if(t.content.length>1)throw e="Top level content can't contain more then one element.",new ve.errors.ConfigurationError(e,t);this.root=new ve.items.Root(this,{content:t.content},this.container),this.root.callDownwards("_$init"),t.maximisedItemId==="__glMaximised"&&this.root.getItemsById(t.maximisedItemId)[0].toggleMaximise()},_onUnload:function(){if(this.config.settings.closePopoutsOnUnload===!0)for(var t=0;t<this.openPopouts.length;t++)this.openPopouts[t].close()},_adjustColumnsResponsive:function(){if(!this._useResponsiveLayout()||this._updatingColumnsResponsive||!this.config.dimensions||!this.config.dimensions.minItemWidth||this.root.contentItems.length===0||!this.root.contentItems[0].isRow){this._firstLoad=!1;return}this._firstLoad=!1;var t=this.root.contentItems[0].contentItems.length;if(!(t<=1)){var e=this.config.dimensions.minItemWidth,n=t*e;if(!(n<=this.width)){this._updatingColumnsResponsive=!0;for(var s=Math.max(Math.floor(this.width/e),1),i=t-s,o=this.root.contentItems[0],r=this._findAllStackContainers()[0],l=0;l<i;l++){var a=o.contentItems[o.contentItems.length-1];this._addChildContentItemsToContainer(r,a)}this._updatingColumnsResponsive=!1}}},_useResponsiveLayout:function(){return this.config.settings&&(this.config.settings.responsiveMode=="always"||this.config.settings.responsiveMode=="onload"&&this._firstLoad)},_addChildContentItemsToContainer:function(t,e){e.type==="stack"?e.contentItems.forEach(function(n){t.addChild(n),e.removeChild(n,!0)}):e.contentItems.forEach(ve.utils.fnBind(function(n){this._addChildContentItemsToContainer(t,n)},this))},_findAllStackContainers:function(){var t=[];return this._findAllStackContainersRecursive(t,this.root),t},_findAllStackContainersRecursive:function(t,e){e.contentItems.forEach(ve.utils.fnBind(function(n){n.type=="stack"?t.push(n):n.isComponent||this._findAllStackContainersRecursive(t,n)},this))}});const DS="_lm_root_1mdia_1",NS="_lm_row_1mdia_5",MS="_lm_item_1mdia_5",FS="_lm_content_1mdia_9",xS="_lm_dragging_1mdia_15",_S="_lm_maximised_1mdia_21",LS="_lm_maximise_placeholder_1mdia_28",kS="_lm_splitter_1mdia_32",OS="_lm_vertical_1mdia_39",AS="_lm_drag_handle_1mdia_39",PS="_lm_horizontal_1mdia_44",HS="_lm_header_1mdia_54",VS="_lm_dropdown_open_1mdia_61",US="_lm_controls_1mdia_67",BS="_lm_tabs_1mdia_87",$S="_lm_tab_1mdia_87",WS="_lm_title_1mdia_102",zS="_lm_close_tab_1mdia_109",GS="_lm_stack_1mdia_118",KS="_lm_left_1mdia_118",qS="_lm_right_1mdia_119",YS="_lm_dragProxy_1mdia_123",XS="_lm_items_1mdia_146",jS="_lm_tabdropdown_list_1mdia_163",QS="_lm_bottom_1mdia_190",ZS="_lm_drop_tab_placeholder_1mdia_205",JS="_lm_tabdropdown_1mdia_163",ew="_lm_dropTargetIndicator_1mdia_256",tw="_lm_inner_1mdia_262",nw="_lm_transition_indicator_1mdia_270",sw="_lm_popin_1mdia_280",iw="_lm_bg_1mdia_295",ow="_lm_icon_1mdia_298",rw="_lm_goldenlayout_1mdia_302",lw="_lm_selectable_1mdia_338",aw="_lm_active_1mdia_368",cw="_lm_selected_1mdia_386",dw="_lm_keyboard_active_1mdia_395",hw="_lm_popout_1mdia_414",uw="_lm_maximise_1mdia_21",mw="_lm_close_1mdia_109",pw="_lm_tabnextbutton_1mdia_423",gw="_lm_tabpreviousbutton_1mdia_426",fw="_lm_title_before_1mdia_542",Cw="_lm_focusin_1mdia_566",bw="_lm_window_blur_1mdia_571",Sw="_lm_tabdropdown_search_1mdia_629",ww="_march_1mdia_1",vw="_app_1mdia_710",Tw="_plotly_1mdia_719",Gd={"tab-height":"28px","drag-border-width":"5px",lm_root:DS,lm_row:NS,lm_item:MS,lm_content:FS,lm_dragging:xS,lm_maximised:_S,lm_maximise_placeholder:LS,lm_splitter:kS,lm_vertical:OS,lm_drag_handle:AS,lm_horizontal:PS,lm_header:HS,lm_dropdown_open:VS,lm_controls:US,lm_tabs:BS,lm_tab:$S,lm_title:WS,lm_close_tab:zS,lm_stack:GS,lm_left:KS,lm_right:qS,lm_dragProxy:YS,lm_items:XS,lm_tabdropdown_list:jS,lm_bottom:QS,lm_drop_tab_placeholder:ZS,lm_tabdropdown:JS,lm_dropTargetIndicator:ew,lm_inner:tw,lm_transition_indicator:nw,lm_popin:sw,lm_bg:iw,lm_icon:ow,lm_goldenlayout:rw,lm_selectable:lw,lm_active:aw,lm_selected:cw,lm_keyboard_active:dw,lm_popout:hw,lm_maximise:uw,lm_close:mw,lm_tabnextbutton:pw,lm_tabpreviousbutton:gw,lm_title_before:fw,"editor-unsaved-indicator":"_editor-unsaved-indicator_1mdia_546","is-unsaved":"_is-unsaved_1mdia_554",lm_focusin:Cw,lm_window_blur:bw,lm_tabdropdown_search:Sw,march:ww,app:vw,"js-plotly-plot":"_js-plotly-plot_1mdia_719",plotly:Tw},Kd=Object.freeze({tabHeight:parseInt(Gd["tab-height"],10),dragBorderWidth:parseInt(Gd["drag-border-width"],10)}),Ts=X.module("LayoutUtils");function Sm(t){return t.componentName!==void 0}function Ai(t){const e=t;return(Sm(t)&&t.componentName==="lm-react-component"||t.type==="react-component")&&e.component!==void 0}function fr(t){return t.focus!==void 0}function qd(t){return t.type==="stack"}const Ke=class{static activateTab(t,e){const n=Ke.getStackForRoot(t,e,!1);if(!n){Ts.error("Could not find stack for config",e);return}const s=Ke.getContentItemInStack(n,e);s&&n.setActiveContentItem(s)}static isActiveTab(t,e){const n=Ke.getStackForRoot(t,e,!1);if(!n)return Ts.error("Could not find stack for config",e),!1;const s=Ke.getContentItemInStack(n,e);return n.getActiveContentItem()===s}static addStack(t,e=!0){const n=e?"column":"row";if(t.isRoot){(t.contentItems==null||t.contentItems.length===0)&&t.addChild({type:n});const o=t.contentItems[0];if(!(e?o.isColumn:o.isRow)){t.removeChild(o,!0),t.addChild({type:n});const l=document.activeElement;t.contentItems[0].addChild(o),l&&l.focus!=null&&l.focus()}return this.addStack(t.contentItems[0],e)}if(t.contentItems.length<2)return t.addChild({type:"stack"}),t.contentItems[t.contentItems.length-1];let s=t.contentItems[t.contentItems.length-1];return(e?s.isRow:s.isColumn)||(t.addChild({type:e?"row":"column"}),t.removeChild(s,!0),t.contentItems[t.contentItems.length-1].addChild(s),s=t.contentItems[t.contentItems.length-1]),this.addStack(s,!e)}static getStackForConfig(t,e={},n=!1){if(n&&t.isStack&&t.contentItems.length===0)return t;if(t.contentItems==null)return null;for(let s=0;s<t.contentItems.length;s+=1){const i=t.contentItems[s];if(i.isComponent&&i.config!=null&&id(i.config,e))return t;const o=this.getStackForConfig(i,e,n);if(o)return o}return null}static getStackForRoot(t,e,n=!0,s=!0,i=!0){let o=this.getStackForConfig(t,e);return!o&&s&&(o=this.getStackForConfig(t,{component:e.component},i)),!o&&n&&(o=this.addStack(t)),o}static getStackForComponentTypes(t,e,n=!0,s=!0,i=!0){for(let o=0;o<e.length;o+=1){const r=e[o],l=o===e.length-1,a=Ke.getStackForRoot(t,{component:r},n&&l,s,i);if(a)return a}return null}static getContentItemInStack(t,e){if(!t)return null;for(let n=0;n<t.contentItems.length;n+=1){const s=t.contentItems[n];if(s.isComponent&&s.config!=null&&id(s.config,e))return s}return null}static dehydrateLayoutConfig(t,e){if(t==null||!t.length)return[];const n=[];for(let s=0;s<t.length;s+=1){const i=t[s],{component:o,content:r}=i;if(o){const l=e(o,i);l!=null?n.push(l):Ts.debug2(`dehydrateLayoutConfig: skipping unmapped component "${o}"`)}else if(r){const l={...i,content:Ke.dehydrateLayoutConfig(r,e)};n.push(l)}else n.push(i)}return n}static getTabPoint(t){const{tab:e}=t;if(e==null)throw new Error(`Cannot get tab for panel container ${t}`);const n=e.element[0].getBoundingClientRect();return[n.left+n.width*.5,n.bottom-8]}static dropLayoutMinorChange(t){for(let e=0;e<t.length;e+=1){const n=t[e],{content:s}=n;s!==void 0?(qd(n)&&delete n.activeItemIndex,Ke.dropLayoutMinorChange(s)):Ai(n)&&n.component==="IrisGridPanel"&&n.props.panelState!=null&&(delete n.id,n.props.panelState.irisGridState.sorts=[],n.props.panelState.irisGridState.quickFilters=[])}}static isEqual(t,e,n=!1){if(n){const s=Ke.cloneLayout(t),i=Ke.cloneLayout(e);return Ke.dropLayoutMinorChange(s),Ke.dropLayoutMinorChange(i),pt(s,i)}return pt(t,e)}static cloneLayout(t){return JSON.parse(JSON.stringify(t))}static hydrateLayoutConfig(t,e){var s;if(t==null||!t.length)return[];const n=[];for(let i=0;i<t.length;i+=1){const o=t[i];if(Ai(o)){const{component:r,props:l={}}=o;n.push({...o,id:(s=o==null?void 0:o.id)!=null?s:qe(),props:e(r,l)})}else if(o.content!==void 0){const r=Ke.hydrateLayoutConfig(o.content,e);qd(o)&&o.activeItemIndex!=null&&o.activeItemIndex>=r.length&&(Ts.warn("Fixing bad activeItemIndex!",o.activeItemIndex,o),o.activeItemIndex=0),n.push({...o,content:r})}else n.push(o)}return n}static openComponent({root:t,config:e,replaceExisting:n=!0,replaceConfig:s=void 0,createNewStack:i=!1,focusElement:o=void 0,dragEvent:r=void 0}={}){const l=document.activeElement,a={...e};if(a.id==null&&(a.id=qe.generate()),r){t==null||t.layoutManager.createDragSourceFromEvent(a,r);return}const c=s||{id:a.id,component:a.component};A(t);const h=i?Ke.addStack(t):Ke.getStackForRoot(t,c);A(h);const u=Ke.getContentItemInStack(h,c);if(o!=null){const m=p=>{Ts.debug("Component created, focusing element",o),h.off("componentCreated",m);const{element:g}=p.origin;requestAnimationFrame(()=>{Ke.focusElement(g[0],o)})};h.on("componentCreated",m)}if(n&&u){const m=h.contentItems.indexOf(u);h.addChild(a,m+1),h.removeChild(u),h.setActiveContentItem(h.contentItems[m])}else h.addChild(a);o==null&&l&&fr(l)&&l.focus()}static openComponentInStack(t,e,n=!0){const s=document.activeElement,i={id:e.id},o=Ke.getContentItemInStack(t,i);if(n&&o&&t){const r=t==null?void 0:t.contentItems.indexOf(o);t.addChild(e,r+1),t.removeChild(o),t.setActiveContentItem(t.contentItems[r])}else t==null||t.addChild(e);s&&fr(s)&&s.focus()}static closeComponent(t,e){const n=Ke.getStackForRoot(t,e,!1,!1,!1);if(!n){Ts.warn("Cannot find stack for component, ignoring close",e);return}const s=Ke.getContentItemInStack(n,e),i=document.activeElement;s&&(s.isComponent?s.container.close():n.removeChild(s)),i&&document.contains(i)&&fr(i)&&i.focus()}static renameComponent(t,e,n){const s=Ke.getStackForRoot(t,e,!1);if(!s){Ts.error("Could not find stack for config",e);return}const i=Ke.getContentItemInStack(s,e);i&&i.setTitle(n)}static cloneComponent(t,e){const n=Ke.getStackForRoot(t,e,!1);if(!n)return Ts.error("Could not find stack for config",e),null;const{props:s={}}=e,i=Ke.getPanelComponentState(e),o={type:"react-component",component:e.component,props:{...s,panelState:i},title:`${e.title} Copy`,id:qe.generate()};return Ke.openComponentInStack(n,o),o}static getPanelComponentState(t){var e,n;return Sm(t)?(e=t.componentState)==null?void 0:e.panelState:Ai(t)?(n=t.props)==null?void 0:n.panelState:null}static makeDefaultLayout(){return{dimensions:{headerHeight:Kd.tabHeight,borderWidth:Kd.dragBorderWidth,borderGrabWidth:10},settings:{showPopoutIcon:!1,showCloseIcon:!1,constrainDragToContainer:!1}}}static getRootFromContainer(t){return t.layoutManager.root}static getComponentConfigFromContainer(t){return t?t.tab!=null&&t.tab.contentItem!=null?t.tab.contentItem.config:t._config:null}static getTitleFromContainer(t){return t!=null&&t.tab!=null&&t.tab.contentItem!=null?t.tab.contentItem.config.title:null}static getTitleFromTab(t){return t!=null&&t.contentItem!=null?t.contentItem.config.title:null}static getIdFromContainer(t){const e=Ke.getComponentConfigFromContainer(t);return e?e.id:null}static getIdFromPanel(t){const{glContainer:e}=t.props;return Ke.getIdFromContainer(e)}static getComponentNameFromPanel(t){var s;const{glContainer:e}=t.props,n=Ke.getComponentConfigFromContainer(e);return n&&Ai(n)&&(s=n.component)!=null?s:null}static getComponentName(t){var n,s;const e=(s=(n=t.WrappedComponent)==null?void 0:n.displayName)!=null?s:t.displayName;if(e==null)throw new Error(`Component displayName not defined ${t}`);return e}static focusElement(t,e=Ke.DEFAULT_FOCUS_SELECTOR){if(t==null)return null;const n=t.querySelector(e);return n==null?null:(fr(n)&&n.focus(),n)}static onInitialized(t){return new Promise(e=>{if(t.isInitialised){e();return}const n=()=>{t.off("initialised",n),e()};t.on("initialised",n)})}};let J=Ke;J.DEFAULT_FOCUS_SELECTOR="input, select, textarea, button";const Ew=Y.forwardRef((t,e)=>{const n=J.getComponentNameFromPanel({props:t});return w("div",{ref:e,className:"panel-placeholder",children:['Component "',n,'" is not registered.']})}),Fe=Object.freeze({FOCUS:"PanelEvent.FOCUS",MOUNT:"PanelEvent.MOUNT",UNMOUNT:"PanelEvent.UNMOUNT",TITLE_CHANGED:"PanelEvent.TITLE_CHANGED",REOPEN:"PanelEvent.REOPEN",DELETE:"PanelEvent.DELETE",CLONED:"PanelEvent.CLONED",CLOSED:"PanelEvent.CLOSED",OPEN:"PanelEvent.OPEN",CLOSE:"PanelEvent.CLOSE"});function yw(t){return(t==null?void 0:t.WrappedComponent)!==void 0}function Iw(t){return typeof t.id=="string"&&t.layout instanceof to&&t.panelManager instanceof fc&&typeof t.registerComponent=="function"}function Ps(t){if(!Iw(t))throw new Error(`Expected dashboard plugin props, but instead received ${t}`)}const Cn=X.module("PanelManager");class fc{constructor(e,n=(l,a)=>a,s=(l,a)=>a,i=new Map,o=[],r=()=>{}){this.handleFocus=this.handleFocus.bind(this),this.handleMount=this.handleMount.bind(this),this.handleUnmount=this.handleUnmount.bind(this),this.handleReopen=this.handleReopen.bind(this),this.handleDeleted=this.handleDeleted.bind(this),this.handleClosed=this.handleClosed.bind(this),this.handleControlClose=this.handleControlClose.bind(this),this.layout=e,this.hydrateComponent=n,this.dehydrateComponent=s,this.onPanelsUpdated=r,this.openedMap=new Map(i),this.closed=[...o],this.startListening()}startListening(){const{eventHub:e}=this.layout;e.on(Fe.FOCUS,this.handleFocus),e.on(Fe.MOUNT,this.handleMount),e.on(Fe.UNMOUNT,this.handleUnmount),e.on(Fe.REOPEN,this.handleReopen),e.on(Fe.DELETE,this.handleDeleted),e.on(Fe.CLOSED,this.handleClosed),e.on(Fe.CLOSE,this.handleControlClose)}stopListening(){const{eventHub:e}=this.layout;e.off(Fe.FOCUS,this.handleFocus),e.off(Fe.MOUNT,this.handleMount),e.off(Fe.UNMOUNT,this.handleUnmount),e.off(Fe.REOPEN,this.handleReopen),e.off(Fe.DELETE,this.handleDeleted),e.off(Fe.CLOSED,this.handleClosed),e.off(Fe.CLOSE,this.handleControlClose)}getClosedPanelConfigsOfType(e){return this.closed.filter(n=>n.component===e)}getOpenedPanels(){return Array.from(this.openedMap.values())}getOpenedPanelConfigs(){return this.getOpenedPanels().map(e=>{const{glContainer:n}=e.props;return J.getComponentConfigFromContainer(n)})}getOpenedPanelConfigsOfType(e){return this.getOpenedPanelConfigs().filter(n=>n!=null&&Ai(n)&&n.component===e)}getOpenedPanelById(e){return this.openedMap.get(e)}getContainerByPanelId(e){var s;const n=J.getStackForConfig(this.layout.root,{id:e});return(s=n&&J.getContentItemInStack(n,{id:e}))!=null?s:null}getLastUsedPanel(e){const n=this.getOpenedPanels();for(let s=n.length-1;s>=0;s-=1){const i=n[s];if(e==null||e(i))return i}}getLastUsedPanelOfType(e){return this.getLastUsedPanelOfTypes([e])}getLastUsedPanelOfTypes(e){return this.getLastUsedPanel(n=>e.some(s=>n instanceof s||yw(s)&&s.WrappedComponent&&n instanceof s.WrappedComponent))}updatePanel(e){const n=J.getIdFromPanel(e);if(n==null){Cn.error("updatePanel Panel did not have an ID",e);return}Cn.debug2(`Updating panel ID ${n} in open panels map`),this.openedMap.delete(n),this.openedMap.set(n,e)}removePanel(e){const n=J.getIdFromPanel(e);if(n==null){Cn.error("removePanel Panel did not have an ID",e);return}if(!this.openedMap.has(n)){Cn.error(`Missing panel ID ${n} in open panels map`);return}if(this.openedMap.get(n)!==e){Cn.debug(`Panel argument doesn't match the open panels map entry for ${n}, removePanel ignored`);return}Cn.debug2(`Removing panel ID ${n} from open panels map`),this.openedMap.delete(n)}removeClosedPanelConfig(e){const n=this.closed.findIndex(s=>s===e||s.id!=null&&e.id&&s.id===e.id);n>=0&&this.closed.splice(n,1)}handleFocus(e){Cn.debug2("Focus: ",e),this.updatePanel(e)}handleMount(e){Cn.debug2("Mount: ",e),this.updatePanel(e),this.sendUpdate()}handleUnmount(e){Cn.debug2("Unmount: ",e),this.removePanel(e),this.sendUpdate()}handleReopen(e,n){Cn.debug2("Reopen:",e,n),this.removeClosedPanelConfig(e);const{component:s}=e;let{props:i}=e;i=this.hydrateComponent(s,i);const o={...e,props:i},{root:r}=this.layout;J.openComponent({root:r,config:o,replaceConfig:n})}handleDeleted(e){Cn.debug2("Deleted:",e),this.removeClosedPanelConfig(e),this.sendUpdate()}handleClosed(e,n){Cn.debug2("Closed: ",e),this.addClosedPanel(n),this.sendUpdate()}handleControlClose(e){const n={id:e},{root:s}=this.layout;J.closeComponent(s,n)}addClosedPanel(e){const n=J.getComponentConfigFromContainer(e);if(n&&Ai(n)){const s=this.dehydrateComponent(n.component,n);s!=null&&this.closed.push(s)}}sendUpdate(){const{closed:e,openedMap:n}=this;this.onPanelsUpdated({closed:[...e],openedMap:new Map(n)})}}fc.MAX_CLOSED_PANEL_COUNT=100;const Rw=X.module("PanelErrorBoundary");class Dw extends S.exports.Component{constructor(e){super(e),this.state={error:null}}componentDidCatch(e){this.setState({error:e})}componentWillUnmount(){const{glContainer:e,glEventHub:n}=this.props,s=J.getIdFromContainer(e);Rw.debug("componentWillUnmount",s),n.emit(Fe.CLOSED,s,e)}render(){const{children:e}=this.props,{error:n}=this.state;return n!=null?d("div",{className:"panel-error-boundary",children:d(ul,{errorMessage:`${n}`,isLoading:!1,isLoaded:!1})}):e}}function Cc(t){const{props:e,componentState:n}=t,{metadata:s}=e;let{panelState:i=null}=e;n&&({panelState:i}=n);const o={};return s!=null&&(o.metadata=s),i!=null&&(o.panelState=i),{...t,componentState:null,props:o,type:"react-component"}}function bc(t,e=""){return{metadata:{},...t,localDashboardId:e}}const Ra={dehydrate:Cc,hydrate:bc},Nw=R.exports.shape({on:R.exports.func,off:R.exports.func,isHidden:R.exports.bool,tab:R.exports.shape({header:R.exports.shape({tabs:R.exports.arrayOf(R.exports.shape({contentItem:R.exports.shape({})}))})}),title:R.exports.string,setTitle:R.exports.func,close:R.exports.func}),wm=R.exports.shape({on:R.exports.func,off:R.exports.func,emit:R.exports.func}),Mw=R.exports.shape({registerComponent:R.exports.func,root:R.exports.shape({addChild:R.exports.func}),on:R.exports.func,off:R.exports.func,eventHub:wm}),vm=Object.freeze({Container:Nw,EventHub:wm,Layout:Mw}),Xe=(t,e,n)=>S.exports.useEffect(function(){return t.on(e,n),()=>{t.off(e,n)}},[t,e,n]),Tm="SET_DASHBOARD_DATA",Fw=aS(Tm,{},!1),xw={dashboardData:Fw},_w=new Map,Lw=Object.freeze({}),kw=Object.freeze([]),Ow=t=>t.dashboardData,jt=(t,e)=>{var n;return(n=Ow(t)[e])!=null?n:Lw},Aw=(t,e)=>{var n;return(n=jt(t,e).closed)!=null?n:kw},Em=(t,e)=>{var n;return(n=jt(t,e).openedMap)!=null?n:_w},ym=(t,e)=>({type:Tm,id:t,payload:e}),Yn=(t,e)=>(n,s)=>n(ym(t,{...jt(s(),t),...e}));Object.entries(xw).map(([t,e])=>eo.register(t,e));const Cr=X.module("DashboardLayout"),Pw=Object.freeze({}),Hw=[],Yd=()=>{},Xd=t=>t,Im=({id:t,children:e,emptyDashboard:n=d("div",{children:"Dashboard is empty."}),layout:s,layoutConfig:i=Hw,onLayoutChange:o=Yd,onLayoutInitialized:r=Yd,hydrate:l=bc,dehydrate:a=Cc})=>{var _,L;const c=Wa(),h=(_=Hp(V=>jt(V,t)))!=null?_:Pw,[u,m]=S.exports.useState(!1),[p,g]=S.exports.useState(!1),[f,b]=S.exports.useState(),[C]=S.exports.useState((L=h==null?void 0:h.closed)!=null?L:[]),[v,T]=S.exports.useState(!1),E=S.exports.useMemo(()=>new Map,[]),y=S.exports.useMemo(()=>new Map,[]),I=Vp(),D=S.exports.useCallback((V,G,j=l,ne=a)=>{Cr.debug2("registerComponent",V,G,j,ne);function ye(He,Z){const ge=G,{glContainer:be,glEventHub:Le}=He;return d(Hh,{store:I,children:d(Dw,{glContainer:be,glEventHub:Le,children:d(ge,{...He,ref:Z})})})}const le=Y.forwardRef(ye),Te=s.registerComponent(V,le);return E.set(V,j),y.set(V,ne),Te},[l,a,E,y,s,I]),M=S.exports.useCallback((V,G)=>{var j;return((j=E.get(V))!=null?j:Xd)(G,t)},[E,t]),x=S.exports.useCallback((V,G)=>{var j;return((j=y.get(V))!=null?j:Xd)(G,t)},[y,t]),B=S.exports.useMemo(()=>new fc(s,M,x,new Map,C,({closed:V,openedMap:G})=>{c(Yn(t,{closed:V,openedMap:G}))}),[x,c,M,t,C,s]),$=S.exports.useCallback(()=>{if(p)return;v||(r(),T(!0));const G=s.toConfig().content,j=J.dehydrateLayoutConfig(G,x),ne=f==null||!J.isEqual(f,j);Cr.debug("handleLayoutStateChanged",ne,G,j),ne&&(m(s.root.contentItems.length===0),b(j),o(j))},[x,v,p,f,s,o,r]),k=S.exports.useCallback(()=>{g(!0)},[]),H=S.exports.useCallback(()=>{g(!1)},[]),O=S.exports.useCallback(V=>{if(Cr.debug2("handleComponentCreated",V),V==null||V.config==null||V.config.component==null||V.element==null)return;const j=`${V.config.component.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}-component`;V.element.addClass(j)},[]);Xe(s,"stateChanged",$),Xe(s,"itemPickedUp",k),Xe(s,"itemDropped",H),Xe(s,"componentCreated",O),Xe(s.eventHub,Fe.TITLE_CHANGED,$);const F=dl(i);return S.exports.useEffect(function(){if(F!==i&&i!==f){Cr.debug("Setting new layout content...");const G=J.hydrateLayoutConfig(i,M);for(;s.root.contentItems.length>0;)s.root.contentItems[0].remove();for(let j=0;j<G.length;j+=1)s.root.addChild(G[j]);m(s.root.contentItems.length===0)}},[M,s,i,f,B,F]),w(ue,{children:[u&&n,Y.Children.map(e,V=>V!=null?Y.cloneElement(V,{id:t,layout:s,panelManager:B,registerComponent:D}):null)]})};Im.propTypes={id:R.exports.string.isRequired,children:R.exports.node,data:R.exports.shape({}),emptyDashboard:R.exports.node,layout:vm.Layout.isRequired,layoutConfig:R.exports.arrayOf(R.exports.shape({})),onLayoutChange:R.exports.func,onLayoutInitialized:R.exports.func};const Vw=100,sa=()=>{},Uw=Object.freeze({}),Bw=({id:t="default",children:e,emptyDashboard:n,layoutConfig:s,layoutSettings:i=Uw,onLayoutConfigChange:o=sa,onGoldenLayoutChange:r=sa,onLayoutInitialized:l=sa,fallbackComponent:a=Ew,hydrate:c,dehydrate:h})=>{const u=S.exports.useRef(null),[m,p]=S.exports.useState(!1),[g,f]=S.exports.useState();S.exports.useEffect(function(){if(!u.current){f(void 0);return}const v={...J.makeDefaultLayout()};v.settings===void 0&&(v.settings={}),Object.assign(v.settings,i),v.content=[];const T=new to(v,u.current),E=()=>{T.off("initialised",E),p(!0)};return T.on("initialised",E),a!=null&&T.setFallbackComponent(a),T.init(),f(T),r(T),()=>{T.destroy()}},[i,a,r,p,f]);const b=S.exports.useMemo(()=>mi(()=>{g!=null&&g.isInitialised&&(g==null||g.updateSize())},Vw),[g]);return S.exports.useEffect(function(){return window.addEventListener("resize",b),()=>{window.removeEventListener("resize",b)}},[b]),w("div",{className:"dashboard-container w-100 h-100",children:[d("div",{className:"w-100 h-100",ref:u}),m&&g&&d(Im,{emptyDashboard:n,id:t,layout:g,layoutConfig:s,onLayoutChange:o,onLayoutInitialized:l,hydrate:c,dehydrate:h,children:e})]})},Dn="default";var gi=(t=>(t.FILTER_CONTROL_CHANGE_CLEARS_ALL_FILTERS="filter-control-change-clears-all-filters",t.LINK_CHANGE_CLEARS_ALL_FILTERS="link-change-clears-all-filters",t))(gi||{});const $w=Object.freeze([[gi.FILTER_CONTROL_CHANGE_CLEARS_ALL_FILTERS,!1],[gi.LINK_CHANGE_CLEARS_ALL_FILTERS,!1]]),Ww={DEFAULTS:$w};var Ve=(t=>(t.COUNT="Count",t.MIN="Min",t.MAX="Max",t.SUM="Sum",t.ABS_SUM="AbsSum",t.VAR="Var",t.AVG="Avg",t.STD="Std",t.FIRST="First",t.LAST="Last",t.SKIP="Skip",t.COUNT_DISTINCT="CountDistinct",t.DISTINCT="Distinct",t.UNIQUE="Unique",t))(Ve||{});const zw=t=>{switch(t){default:return!1}},Gw=(t,e)=>{switch(t){case Ve.COUNT:case Ve.FIRST:case Ve.LAST:case Ve.COUNT_DISTINCT:case Ve.DISTINCT:case Ve.UNIQUE:return!0;case Ve.MIN:case Ve.MAX:return P.isNumberType(e)||P.isDateType(e)||P.isTextType(e);case Ve.SUM:case Ve.ABS_SUM:case Ve.VAR:case Ve.AVG:case Ve.STD:return P.isNumberType(e);case Ve.SKIP:return!1}},Sc=(t,e)=>t.filter(n=>Gw(e,n.type)),Kw=(t,e,n,s)=>Sc(t,e).map(({name:i})=>i).filter(i=>n.includes(i)?!s:s),Ls={isRollupOperation:zw,filterValidColumns:Sc,getOperationColumnNames:Kw};const jd=X.module("Aggregations"),qw=[Ve.SUM,Ve.ABS_SUM,Ve.MIN,Ve.MAX,Ve.VAR,Ve.AVG,Ve.STD,Ve.FIRST,Ve.LAST,Ve.COUNT_DISTINCT,Ve.DISTINCT,Ve.COUNT,Ve.UNIQUE],Yw=({isRollup:t,settings:e,onChange:n,onEdit:s})=>{const{aggregations:i,showOnTop:o}=e,r=S.exports.useMemo(()=>qw.filter(x=>!i.some(B=>B.operation===x)),[i]),[l,a]=S.exports.useState(r[0]),[c,h]=S.exports.useState([]),u=S.exports.useCallback(x=>{n({...e,...x})},[n,e]),m=S.exports.useCallback(x=>{u({aggregations:x})},[u]),p=S.exports.useCallback(x=>{u({showOnTop:x})},[u]),g=S.exports.useCallback(()=>{jd.debug("handleDragStart"),Yt.startDragging()},[]),f=S.exports.useCallback(({destination:x,source:B})=>{if(jd.debug("handleDragEnd",x,B),Yt.stopDragging(),x===null)return;let $=x.index;B.index<x.index&&($+=1);const k=[...i],H=Yt.reorder(k,c,k,$),O=Yt.adjustDestinationIndex($,c),F=[[O,O+H.length-1]];m(k),h(F)},[m,i,c,h]),b=S.exports.useCallback(x=>{a(x)},[a]),C=S.exports.useCallback(()=>{m([...i,{operation:l,selected:[],invert:!0}])},[i,l,m]),v=S.exports.useCallback(x=>{m(i.filter((B,$)=>$!==x))},[i,m]),T=S.exports.useCallback(x=>{h(x)},[h]),E=S.exports.useCallback(x=>{const B=i[x];Ls.isRollupOperation(B.operation)||s(B)},[i,s]),y=S.exports.useCallback(x=>{p(x.target.value==="true")},[p]);S.exports.useEffect(function(){r.length>0&&!r.includes(l)&&a(r[0])},[r,l]);const I=S.exports.useCallback(({item:x,itemIndex:B,isClone:$=!1,selectedCount:k})=>{const H=x.operation,O=$?`${k}`:void 0,F=$?"item-list-item-clone":void 0,_=Ls.isRollupOperation(x.operation),L=!$&&!_;return w(ue,{children:[w("div",{className:W("item-list-item-content","draggable-item-list-item-content",F),children:[w("span",{className:"title",children:[H,!t&&_&&w("span",{className:"small text-warning",children:[d(z,{icon:nu})," Requires rollup"]})]}),rn.renderBadge({text:O}),rn.renderHandle()]}),!$&&w(ue,{children:[d(ce,{kind:"ghost",className:"btn-edit",icon:rl,tooltip:"Edit Columns",onClick:()=>s(x),disabled:!L}),d(ce,{kind:"ghost",className:"btn-delete",icon:_n,tooltip:"Delete Aggregation",onClick:()=>v(B)})]})]})},[v,s,t]),D=r.length>0,M=i.length>0;return w("div",{className:"aggregations",children:[D&&w("div",{className:"form-inline",children:[d(pC,{onChange:b,value:l,children:r.map(x=>d(mC,{value:x,children:x},x))}),w("button",{type:"button",className:"btn btn-link btn-add",onClick:C,children:[d(z,{icon:As}),"Add Aggregation"]})]}),D&&M&&d("hr",{}),M&&w(ue,{children:[!t&&w("div",{className:"form-inline",children:[d("label",{children:"Placement:\xA0"}),w(ml,{onChange:y,value:`${o}`,children:[d(Mn,{value:"true",children:"Top"}),d(Mn,{value:"false",children:"Bottom"})]})]}),d(Ho,{onDragStart:g,onDragEnd:f,children:d(rn,{className:"selected-aggregations",itemCount:i.length,items:i,renderItem:I,offset:0,onSelectionChange:T,onSelect:E,selectedRanges:c,isMultiSelect:!0})})]})]})};const Xw=30,jw=({aggregation:t,columns:e,onChange:n})=>{const[s,i]=S.exports.useState(-1),[o,r]=S.exports.useState(-1),[l,a]=S.exports.useState(0),{invert:c,selected:h}=t,u=S.exports.useRef(null),m=S.exports.useCallback(y=>h.includes(y)?!c:c,[c,h]),p=S.exports.useMemo(()=>{let y=Sc(e,t.operation);return l!==0&&(y=P.sortColumns(y,l===1)),y},[e,t.operation,l]),g=S.exports.useMemo(()=>s>=0?p.slice(s,o+1).map(y=>({value:y.name,displayValue:y.name,isSelected:m(y.name)})):[],[p,m,o,s]),f=S.exports.useCallback(y=>{const{name:I}=p[y],D=h.indexOf(I);let M=[...h],x=c;D>=0?M.splice(D,1):(M.push(I),M.length===p.length&&(M=[],x=!c)),n({...t,selected:M,invert:x})},[t,c,p,h,n]),b=S.exports.useCallback(()=>{a(0),n({...t,selected:[],invert:!0})},[t,n]),C=S.exports.useCallback((y,I)=>{i(y),r(I)},[i,r]),v=S.exports.useCallback(()=>{h.length===0?n({...t,invert:!c}):n({...t,selected:[],invert:!0})},[t,c,n,h]),T=h.length===0?c:null,E=h.length!==0||!c||l!==0;return w("div",{role:"menu",className:"aggregation-edit",children:[d("div",{className:"top-menu",children:w("div",{className:"form-inline",children:[d(Ut,{checked:T,onChange:v,children:"Toggle All"}),d("div",{className:"spacer"}),d(gt,{in:E,timeout:It.transitionSlowMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:d(ce,{kind:"ghost",className:"btn-reset",onClick:b,children:"Reset"})}),d(ce,{kind:"ghost",className:W({active:l===1}),icon:ec,tooltip:"Sort ascending",onClick:()=>a(1)}),d(ce,{kind:"ghost",className:W({active:l===2}),icon:tc,tooltip:"Sort descending",onClick:()=>a(2)})]})}),d("div",{className:"aggregation-edit-item-list",children:d(vn,{itemCount:p.length,items:g,offset:s,renderItem:({item:y})=>d(Ut,{checked:m(y.value),children:y.displayValue}),onSelect:f,onViewportChange:C,rowHeight:Xw,focusSelector:"input",ref:u})})]})};function Qw(t){return d("svg",{width:48,height:48,xmlns:"http://www.w3.org/2000/svg",...t,children:w("g",{fill:"none",fillRule:"evenodd",children:[d("path",{fill:"#C1C0C0",d:"M44 43v1H4v-1z"}),d("path",{fill:"#7DA4FF",d:"M8 26h4v15H8zM15 17h4v24h-4zM22 21h4v20h-4zM29 17h4v24h-4zM36 11h4v30h-4z"})]})})}function Zw(t){return d("svg",{width:48,height:48,xmlns:"http://www.w3.org/2000/svg",...t,children:w("g",{fill:"none",fillRule:"evenodd",children:[d("path",{fill:"#C1C0C0",d:"M44 43v1H4v-1z"}),d("path",{fill:"#7DA4FF",d:"M7 34h4v8H7zM12 31h4v11h-4zM17 27h4v15h-4zM22 22h4v20h-4zM27 27h4v15h-4zM32 29h4v13h-4zM37 31h4v11h-4z"})]})})}function Jw(t){return d("svg",{width:48,height:48,xmlns:"http://www.w3.org/2000/svg",...t,children:w("g",{fill:"none",fillRule:"evenodd",children:[d("path",{fill:"#C1C0C0",d:"M4 4h1v40H4zM44 43v1H5v-1z"}),d("path",{stroke:"#7DA4FF",d:"M7.984 32.44l7.982-11.378 5.273 3.739 9.952-10.838 2.826 1.894 7.45-5.802"}),d("path",{stroke:"#BECDEF",d:"M8.244 37.926L17 33.496l5 .87 10.637-10.35 10.615-1.381"})]})})}function e0(t){return d("svg",{width:48,height:48,xmlns:"http://www.w3.org/2000/svg",...t,children:w("g",{fill:"none",fillRule:"evenodd",children:[d("path",{d:"M24 10c7.732 0 14 6.268 14 14s-6.268 14-14 14-14-6.268-14-14h14V10z",fill:"#80A6FF"}),d("path",{d:"M10 24c0-7.732 6.268-14 14-14v14H10z",fill:"#C1C0C0"})]})})}function t0(t){return d("svg",{width:48,height:48,xmlns:"http://www.w3.org/2000/svg",...t,children:w("g",{fill:"none",fillRule:"evenodd",children:[d("path",{fill:"#C1C0C0",d:"M44 43v1H4v-1z"}),d("path",{fill:"#939293",d:"M44 34v1H4v-1zM44 25v1H4v-1zM44 16v1H4v-1z"}),d("circle",{fill:"#7DA4FF",cx:9.5,cy:37.5,r:1.5}),d("circle",{fill:"#7DA4FF",cx:16.5,cy:30.5,r:1.5}),d("circle",{fill:"#7DA4FF",cx:22.5,cy:36.5,r:1.5}),d("circle",{fill:"#7DA4FF",cx:28.5,cy:30.5,r:1.5}),d("circle",{fill:"#7DA4FF",cx:15.5,cy:38.5,r:1.5}),d("circle",{fill:"#7DA4FF",cx:23.5,cy:25.5,r:1.5}),d("circle",{fill:"#7DA4FF",cx:19.5,cy:19.5,r:1.5}),d("circle",{fill:"#7DA4FF",cx:29.5,cy:19.5,r:1.5}),d("circle",{fill:"#7DA4FF",cx:32.5,cy:26.5,r:1.5}),d("circle",{fill:"#7DA4FF",cx:36.5,cy:13.5,r:1.5})]})})}function n0(t){return w("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[d("rect",{width:"48",height:"48",fill:"none"}),d("rect",{x:"26",y:"10",width:"15",height:"4",fill:"#9FDE70"}),d("rect",{x:"26",y:"22",width:"15",height:"4",fill:"#9FDE70"}),d("rect",{x:"26",y:"28",width:"15",height:"4",fill:"#FFD95C"}),d("rect",{x:"26",y:"34",width:"15",height:"4",fill:"#9FDE70"})]})}function s0(t){return w("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[d("rect",{width:"48",height:"48",fill:"none"}),d("rect",{x:"4",y:"16",width:"40",height:"4",fill:"#FFD95C"}),d("rect",{x:"4",y:"10",width:"40",height:"4",fill:"#78DCE8"}),d("rect",{x:"4",y:"34",width:"40",height:"4",fill:"#78DCE8"})]})}const Qd=X.module("ChartBuilder"),bt=class extends S.exports.PureComponent{static getTypeName(t){switch(t){case N.plot.SeriesPlotStyle.LINE:return"Line";case N.plot.SeriesPlotStyle.BAR:return"Bar";case N.plot.SeriesPlotStyle.SCATTER:return"Scatter";case N.plot.SeriesPlotStyle.PIE:return"Pie";case N.plot.SeriesPlotStyle.HISTOGRAM:return"Histogram";default:return t}}static getTypeIcon(t){switch(t){case N.plot.SeriesPlotStyle.LINE:return d(Jw,{});case N.plot.SeriesPlotStyle.BAR:return d(Qw,{});case N.plot.SeriesPlotStyle.SCATTER:return d(t0,{});case N.plot.SeriesPlotStyle.PIE:return d(e0,{});case N.plot.SeriesPlotStyle.HISTOGRAM:return d(Zw,{});default:return null}}static getMaxSeriesCount(t){switch(t){case N.plot.SeriesPlotStyle.PIE:return 1;case N.plot.SeriesPlotStyle.HISTOGRAM:return 0;default:return 100}}static getXAxisLabel(t){switch(t){case N.plot.SeriesPlotStyle.PIE:return"Labels";case N.plot.SeriesPlotStyle.HISTOGRAM:return"Data";default:return"X-Axis"}}static getSeriesLabel(t){switch(t){case N.plot.SeriesPlotStyle.PIE:return"Values";default:return"Series"}}static makeSeriesItem(t){return{id:qe.generate(),value:t}}static makeDefaultSeriesItems(t,e){if(bt.getMaxSeriesCount(t)===0||e==null||e.length===0)return[];const s=e.length>1?e[1].name:e[0].name;return[bt.makeSeriesItem(s)]}static getDefaultXAxis(t,e){return e!=null&&e.length>0?e[0].name:null}constructor(t){super(t),this.handleAddSeries=this.handleAddSeries.bind(this),this.handleLinkStateChange=this.handleLinkStateChange.bind(this),this.handleReset=this.handleReset.bind(this),this.handleSeriesChange=this.handleSeriesChange.bind(this),this.handleSeriesDeleteClick=this.handleSeriesDeleteClick.bind(this),this.handleSubmit=this.handleSubmit.bind(this),this.handleTypeClick=this.handleTypeClick.bind(this),this.handleXAxisChange=this.handleXAxisChange.bind(this),this.sendChange=this.sendChange.bind(this);const{model:e}=t,{columns:n}=e,s=bt.types[0],i=bt.getDefaultXAxis(s,n),o=bt.makeDefaultSeriesItems(s,n);this.state={type:s,seriesItems:o,xAxis:i,isLinked:!0}}handleAddSeries(){this.setState(t=>{let{seriesItems:e}=t;e=[...e];const{model:n}=this.props,{columns:s}=n;return e.push({id:qe.generate(),value:s[0].name}),{seriesItems:e}},this.sendChange)}handleLinkStateChange(t){this.setState({isLinked:t.target.value==="true"},this.sendChange)}handleReset(){const{model:t}=this.props,{columns:e}=t,n=bt.types[0],s=bt.getDefaultXAxis(n,e),i=bt.makeDefaultSeriesItems(n,e),o=!0;this.setState({type:n,seriesItems:i,xAxis:s,isLinked:o},this.sendChange)}handleSeriesChange(t){const{value:e}=t.target,n=t.target.getAttribute("data-index"),s=parseInt(n,10);this.setState(i=>{let{seriesItems:o}=i;return o=[...o],o[s].value=e,{seriesItems:o}},this.sendChange)}handleSeriesDeleteClick(t){const n=t.target.getAttribute("data-index"),s=parseInt(n,10);this.setState(i=>{let{seriesItems:o}=i;return o=[...o],o.splice(s,1),{seriesItems:o}},this.sendChange)}handleSubmit(t){t.preventDefault();const{onSubmit:e}=this.props,{type:n,seriesItems:s,xAxis:i,isLinked:o}=this.state,r=s.map(l=>l.value);e({type:`${n}`,series:r,xAxis:i,isLinked:o})}handleTypeClick(t){const n=t.target.getAttribute("data-index"),s=parseInt(n,10),i=bt.types[s];Qd.debug2("handleTypeSelect",i),this.setState(o=>{const r=bt.getMaxSeriesCount(i);let{seriesItems:l}=o;if(l=l.slice(0,r),l.length===0&&r>0){const{model:a}=this.props,{columns:c}=a;l=bt.makeDefaultSeriesItems(i,c)}return{type:i,seriesItems:l}},this.sendChange)}handleXAxisChange(t){const e=t.target.value;Qd.debug2("x-axis change",e),this.setState({xAxis:e},this.sendChange)}sendChange(){const{onChange:t}=this.props,{isLinked:e,type:n,seriesItems:s,xAxis:i}=this.state,o=s.map(r=>r.value);t({type:n,series:o,xAxis:i,isLinked:e})}render(){const{model:t}=this.props,{columns:e}=t,{seriesItems:n,type:s,xAxis:i,isLinked:o}=this.state,r=bt.getMaxSeriesCount(s),l=bt.getXAxisLabel(s),a=bt.getSeriesLabel(s),c=n.length>0,h=n.length<r;return d("div",{className:"chart-builder",children:w("form",{onSubmit:this.handleSubmit,children:[w("div",{className:"form-row",children:[d("label",{children:"Select Chart Type"}),d("div",{className:"form-row",children:bt.types.map((u,m)=>{const p=u;return d("div",{className:"col col-chart-type",children:w("button",{type:"button",className:W("btn","btn-icon","btn-chart-type",{active:u===s}),"data-index":m,onClick:this.handleTypeClick,children:[bt.getTypeIcon(u),bt.getTypeName(u)]})},p)})})]}),d("hr",{}),w("div",{className:"form-row form-inline",children:[d("label",{className:"col-2 label-left",children:l}),d("select",{className:"form-control custom-select select-x-axis col",value:i,onChange:this.handleXAxisChange,children:e.map(u=>d("option",{value:u.name,children:u.name},u.name))})]}),c&&d("hr",{}),n.map((u,m)=>w("div",{className:"form-row form-inline form-series-item","data-testid":`form-series-item-${m}`,children:[d("label",{className:"col-2 label-left",children:m===0?a:""}),d("select",{className:"form-control custom-select select-series col",value:u.value,onChange:this.handleSeriesChange,"data-testid":`select-series-item-${m}`,"data-index":m,children:e.map(p=>d("option",{value:p.name,"data-index":m,children:p.name},p.name))}),n.length>1&&d("button",{type:"button",className:"btn btn-link btn-link-icon btn-delete-series ml-2 px-2","data-index":m,"data-testid":`delete-series-${m}`,onClick:this.handleSeriesDeleteClick,children:d(z,{icon:_n})})]},u.id)),h&&w("div",{className:"form-row",children:[d("div",{className:"col-2"}),w("button",{type:"button",className:"btn btn-link btn-add-series mt-1",onClick:this.handleAddSeries,children:[d(z,{icon:As}),"Add Series"]})]}),w("div",{className:"form-row chart-builder-link",children:[d("label",{className:"col-2 label-right",children:w("div",{className:"fa-md fa-layers",children:[d(z,{mask:sc,icon:Oo,transform:"right-5 down-5"}),d(z,{icon:o?Xa:Hf,transform:"grow-2 right-8 down-6"})]})}),w(ml,{onChange:this.handleLinkStateChange,value:`${o}`,children:[d(Mn,{value:"true",children:"Sync State"}),d(Mn,{value:"false",children:"Freeze State"})]})]}),w("div",{className:"form-row",children:[d("div",{className:"col-2 label-right"}),d("div",{className:"col chart-builder-link-info",children:o?"Charts with synced state will update to match any filters or user modifications applied to the parent table.":"Freeze State disconnects the chart state from the parent table. New filters or user modifications on the parent table will not be applied."})]}),w("div",{className:W("form-row","justify-content-end","my-3"),children:[d("button",{type:"button",className:"btn btn-outline-primary btn-reset",onClick:this.handleReset,children:"Reset"}),d("button",{type:"submit",className:"btn btn-primary btn-submit",children:"Create"})]})]})})}};let Rm=bt;Rm.types=[N.plot.SeriesPlotStyle.LINE,N.plot.SeriesPlotStyle.BAR,N.plot.SeriesPlotStyle.SCATTER,N.plot.SeriesPlotStyle.PIE];class Dm extends S.exports.Component{constructor(e){super(e),this.handleContentChanged=this.handleContentChanged.bind(this),this.handleEditorFocus=this.handleEditorFocus.bind(this),this.handleEditorBlur=this.handleEditorBlur.bind(this),this.handleContainerClick=this.handleContainerClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.state={isEditorFocused:!1,isEditorEmpty:!0},this.editorContainer=null}componentDidMount(){this.initEditor()}componentWillUnmount(){this.destroyEditor()}initEditor(){var i;const{value:e,editorSettings:n}=this.props,s={copyWithSyntaxHighlighting:"false",fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:"groovyDB",lineDecorationsWidth:8,lineNumbers:"off",minimap:{enabled:!1},renderLineHighlight:"none",scrollbar:{arrowSize:0,horizontal:"hidden",horizontalScrollbarSize:0},scrollBeyondLastLine:!1,padding:{top:6,bottom:6},tabCompletion:"off",useTabStops:!0,value:e,wordWrap:"on",automaticLayout:!0,...n};if(!this.editorContainer)throw new Error("editorContainer is null");this.editor=ds.create(this.editorContainer,s),this.editor.layout(),(i=this.editor.getModel())==null||i.updateOptions({tabSize:0}),this.editor.onDidChangeModelContent(this.handleContentChanged),this.editor.onDidFocusEditorText(this.handleEditorFocus),this.editor.onDidBlurEditorText(this.handleEditorBlur)}destroyEditor(){var e;(e=this.editor)==null||e.dispose(),this.editor=void 0}handleContentChanged(){var s,i;const{onContentChanged:e}=this.props,n=(i=(s=this.editor)==null?void 0:s.getModel())==null?void 0:i.getValue();n!==""&&n!==void 0&&this.setState({isEditorEmpty:n.length===0}),e(n)}handleEditorFocus(){this.setState({isEditorFocused:!0})}handleEditorBlur(){var n,s;const e=(s=(n=this.editor)==null?void 0:n.getModel())==null?void 0:s.getValue();if(e===void 0||e==="")throw new Error("value is undefined");this.setState({isEditorEmpty:e.length===0,isEditorFocused:!1})}handleContainerClick(){var n;const{isEditorFocused:e}=this.state;e||(n=this.editor)==null||n.focus()}handleKeyDown(e){const{onTab:n,editorIndex:s}=this.props;e.key==="Tab"&&n(s,e.shiftKey)}render(){const{value:e,invalid:n}=this.props,{isEditorFocused:s,isEditorEmpty:i}=this.state;return w("div",{className:W("input-editor-wrapper",{focused:s,invalid:n}),onKeyDown:this.handleKeyDown,role:"presentation",onClick:this.handleContainerClick,children:[d("div",{className:"editor-container",ref:o=>{this.editorContainer=o}}),i&&!e&&d("div",{className:"editor-placeholder text-muted",children:"Column Formula"})]})}}Dm.defaultProps={value:"",onContentChanged:()=>{},editorSettings:{},editorIndex:0,onTab:()=>{},invalid:!1};const Da=class extends S.exports.PureComponent{constructor(t){super(t),this.handleFormulaEditorContentChanged=this.handleFormulaEditorContentChanged.bind(this)}handleFormulaEditorContentChanged(t){const{onChange:e,eventKey:n}=this.props;t!==void 0&&t!==""&&(t.replace(/(\r\n|\n|\r)/gm,""),e(n,Da.INPUT_TYPE.FORMULA,t))}render(){const{eventKey:t,name:e,formula:n,onChange:s,onDeleteColumn:i,inputIndex:o,onTabInEditor:r,invalid:l}=this.props;return d(il,{draggableId:t,index:o,disableInteractiveElementBlocking:!0,children:(a,c)=>w("div",{className:W("draggable-container",{dragging:c.isDragging}),ref:a.innerRef,...a.draggableProps,children:[w("div",{className:"custom-column-input-container",children:[w("div",{className:"d-flex flex-row pb-3 custom-column-name",children:[d("input",{className:W("form-control custom-column-input",{"is-invalid":l}),placeholder:"Column Name",value:e,onChange:h=>{s(t,Da.INPUT_TYPE.NAME,h.target.value)}}),w("button",{type:"button",className:"btn btn-link btn-link-icon ml-1 px-2",onClick:()=>{i(t)},children:[d(pe,{children:"Delete custom column"}),d(z,{icon:_n})]}),w("button",{type:"button",className:"btn btn-link btn-link-icon px-2 btn-drag-handle",...a.dragHandleProps,children:[d(pe,{children:"Drag column to re-order"}),d(z,{icon:ll})]})]}),d(Dm,{editorSettings:{language:"deephavenDb"},editorIndex:o,value:n,onContentChanged:this.handleFormulaEditorContentChanged,onTab:r,invalid:l})]}),d("hr",{})]})})}};let wc=Da;wc.INPUT_TYPE={NAME:"name",FORMULA:"formula"};wc.defaultProps={name:"",inputIndex:0,formula:"",onChange:()=>{},onDeleteColumn:()=>{},onTabInEditor:()=>{},invalid:!1};class Nm extends Error{constructor(){super(...arguments),this.isAssertionFailed=!0}}function Zd(t){if(t==null)throw new Nm(`Expected 'val' to be defined, but received ${t}`)}class ia extends Error{constructor(){super(...arguments),this.isPasteError=!0}}function nt(t){return(t==null?void 0:t.isEditable)!==void 0}function Jd(t){if(!nt(t))throw new Nm(`Expected 'model' to be editable, but received ${t}`)}function St(t){return(t==null?void 0:t.hasExpandableRows)!==void 0}var Nn=(t=>(t.DOWN="DOWN",t.UP="UP",t.LEFT="LEFT",t.RIGHT="RIGHT",t))(Nn||{});const De=class{static normalize(t,e,n,s){let i=t,o=e,r=n,l=s;return i!=null&&r!=null&&r<i&&(i=r,r=t),o!=null&&l!=null&&l<o&&(o=l,l=e),[i,o,r,l]}static makeNormalized(t,e,n,s){return new De(...De.normalize(t,e,n,s))}static makeCell(t,e){return new De(t,e,t,e)}static makeColumn(t){return new De(t,null,t,null)}static makeRow(t){return new De(null,t,null,t)}static minOrNull(t,e){return t==null||e==null?null:Math.min(t,e)}static maxOrNull(t,e){return t==null||e==null?null:Math.max(t,e)}static consolidate(t){const e=t.slice();let n=!0;for(;n;){n=!1;for(let s=0;s<e.length&&!n;s+=1){const i=e[s];for(let o=e.length-1;o>s;o-=1){const r=e[o];if(i.contains(r))e.splice(o,1);else if(r.contains(i)){n=!0,e[s]=r,e.splice(o,1);break}else if(i.startRow===r.startRow&&i.endRow===r.endRow){if(i.touches(r)){const{startRow:l,endRow:a}=i,c=De.minOrNull(i.startColumn,r.startColumn),h=De.maxOrNull(i.endColumn,r.endColumn);n=!0,e[s]=new De(c,l,h,a),e.splice(o,1);break}}else if(i.startColumn===r.startColumn&&i.endColumn===r.endColumn&&i.touches(r)){const{startColumn:l,endColumn:a}=i,c=De.minOrNull(i.startRow,r.startRow),h=De.maxOrNull(i.endRow,r.endRow);n=!0,e[s]=new De(l,c,a,h),e.splice(o,1);break}}}}return e}static isAxisRangeTouching(t,e,n,s){return t==null?e==null||n==null?!0:n<=e+1:e==null?s==null?!0:s>=t-1:n==null?s==null?!0:t<=s+1:s==null?e>=n-1:n>=t-1?n<=e+1:s>=t-1}static rangeArraysEqual(t,e){if(t===e)return!0;if(t==null||e==null||t.length!==e.length)return!1;for(let n=0;n<t.length;n+=1)if(!t[n].equals(e[n]))return!1;return!0}static intersection(t,e){if(t.equals(e))return t;let{startColumn:n,startRow:s,endColumn:i,endRow:o}=t;return n=n!=null&&e.startColumn!=null?Math.max(n,e.startColumn):n!=null?n:e.startColumn,i=i!=null&&e.endColumn!=null?Math.min(i,e.endColumn):i!=null?i:e.endColumn,s=s!=null&&e.startRow!=null?Math.max(s,e.startRow):s!=null?s:e.startRow,o=o!=null&&e.endRow!=null?Math.min(o,e.endRow):o!=null?o:e.endRow,n!=null&&n>(i!=null?i:-1)||s!=null&&s>(o!=null?o:-1)?null:new De(n,s,i,o)}static subtractFromRange(t,e){const n=[],s=De.intersection(t,e);return s==null?[t]:(s.startRow!=null&&(t.startRow==null||t.startRow<s.startRow)&&n.push(new De(t.startColumn,t.startRow,t.endColumn,s.startRow-1)),s.startColumn!=null&&(t.startColumn==null||t.startColumn<s.startColumn)&&n.push(new De(t.startColumn,s.startRow,s.startColumn-1,s.endRow)),s.endColumn!=null&&(t.endColumn==null||t.endColumn>s.endColumn)&&n.push(new De(s.endColumn+1,s.startRow,t.endColumn,s.endRow)),s.endRow!=null&&(t.endRow==null||t.endRow>s.endRow)&&n.push(new De(t.startColumn,s.endRow+1,t.endColumn,t.endRow)),n)}static subtractFromRanges(t,e){const n=[];for(let s=0;s<t.length;s+=1)n.push(...De.subtractFromRange(t[s],e));return n}static subtractRangesFromRanges(t,e){if(e==null||e.length===0)return t;let n=[...t];for(let s=0;s<e.length;s+=1)n=De.subtractFromRanges(n,e[s]);return n}static isBounded(t){return t.startRow!=null&&t.startColumn!=null&&t.endRow!=null&&t.endColumn!=null}static boundedRange(t,e,n){var s,i,o,r;return De.isBounded(t)?t:new De((s=t.startColumn)!=null?s:0,(i=t.startRow)!=null?i:0,(o=t.endColumn)!=null?o:e-1,(r=t.endRow)!=null?r:n-1)}static boundedRanges(t,e,n){return t.map(s=>De.boundedRange(s,e,n))}static offset(t,e,n){return new De(t.startColumn!=null?t.startColumn+e:null,t.startRow!=null?t.startRow+n:null,t.endColumn!=null?t.endColumn+e:null,t.endRow!=null?t.endRow+n:null)}static nextCell(t,e=null,n=null,s=De.SELECTION_DIRECTION.DOWN){if(t.length===0)return null;let i=-1;if(e!=null&&n!=null&&(i=t.findIndex(o=>o.containsCell(e,n)),i>=0)){const r=t[i].nextCell(e,n,s);if(r!=null)return r}switch(s){case De.SELECTION_DIRECTION.DOWN:case De.SELECTION_DIRECTION.RIGHT:{const o=i<t.length-1?i+1:0;return t[o].startCell(s)}case De.SELECTION_DIRECTION.LEFT:case De.SELECTION_DIRECTION.UP:{const o=i>0?i-1:t.length-1;return t[o].startCell(s)}default:throw new Error(`Invalid direction: ${s}`)}}static cellCount(t){return t.reduce((e,n)=>{var s,i,o,r;return e+(((s=n.endRow)!=null?s:NaN)-((i=n.startRow)!=null?i:NaN)+1)*(((o=n.endColumn)!=null?o:NaN)-((r=n.startColumn)!=null?r:NaN)+1)},0)}static rowCount(t){return t.reduce((e,n)=>{var s,i;return e+((s=n.endRow)!=null?s:NaN)-((i=n.startRow)!=null?i:NaN)+1},0)}static columnCount(t){return t.reduce((e,n)=>{var s,i;return e+((s=n.endColumn)!=null?s:NaN)-((i=n.startColumn)!=null?i:NaN)+1},0)}static containsCell(t,e,n){for(let s=0;s<t.length;s+=1)if(t[s].containsCell(e,n))return!0;return!1}static forEachCell(t,e,n=De.SELECTION_DIRECTION.RIGHT){for(let s=0;s<t.length;s+=1)t[s].forEach(e,n)}constructor(t,e,n,s){this.startColumn=t,this.startRow=e,this.endColumn=n,this.endRow=s}equals(t){return this.startColumn===t.startColumn&&this.startRow===t.startRow&&this.endColumn===t.endColumn&&this.endRow===t.endRow}contains(t){return(this.startColumn==null||t.startColumn!=null&&this.startColumn<=t.startColumn)&&(this.startRow==null||t.startRow!=null&&this.startRow<=t.startRow)&&(this.endColumn==null||t.endColumn!=null&&this.endColumn>=t.endColumn)&&(this.endRow==null||t.endRow!=null&&this.endRow>=t.endRow)}containsCell(t,e){return t==null||e==null?!1:(this.startColumn==null||this.startColumn<=t)&&(this.endColumn==null||this.endColumn>=t)&&(this.startRow==null||this.startRow<=e)&&(this.endRow==null||this.endRow>=e)}touches(t){return De.isAxisRangeTouching(this.startRow,this.endRow,t.startRow,t.endRow)&&De.isAxisRangeTouching(this.startColumn,this.endColumn,t.startColumn,t.endColumn)}subtract(t){return De.subtractFromRange(this,t)}startCell(t=De.SELECTION_DIRECTION.DOWN){if(!De.isBounded(this))throw new Error("Cannot get the startCell of an unbounded range");switch(t){case De.SELECTION_DIRECTION.DOWN:case De.SELECTION_DIRECTION.RIGHT:return{column:this.startColumn,row:this.startRow};case De.SELECTION_DIRECTION.LEFT:case De.SELECTION_DIRECTION.UP:return{column:this.endColumn,row:this.endRow};default:throw new Error(`Invalid direction: ${t}`)}}nextCell(t,e,n){if(!De.isBounded(this))throw new Error("Bounded range required");if(t==null||e==null)throw new Error("Require a non-null cursor");const{startColumn:s,endColumn:i,startRow:o,endRow:r}=this;switch(n){case De.SELECTION_DIRECTION.DOWN:if(e<r)return{column:t,row:Math.max(e+1,o)};if(t<i)return{column:Math.max(t+1,s),row:o};break;case De.SELECTION_DIRECTION.UP:if(e>o)return{column:t,row:Math.min(e-1,r)};if(t>s)return{column:Math.min(t-1,i),row:r};break;case De.SELECTION_DIRECTION.RIGHT:if(t<i)return{column:Math.max(t+1,s),row:e};if(e<r)return{column:s,row:Math.max(e+1,o)};break;case De.SELECTION_DIRECTION.LEFT:if(t>s)return{column:Math.min(t-1,i),row:e};if(e>o)return{column:i,row:Math.min(e-1,r)};break;default:throw new Error(`Invalid direction: ${n}`)}return null}forEach(t,e=De.SELECTION_DIRECTION.RIGHT){var o;let n=0,{column:s,row:i}=this.startCell(e);for(;s!=null&&i!=null;)t(s,i,n),n+=1,{column:s,row:i}=(o=this.nextCell(s,i,e))!=null?o:{}}};let oe=De;oe.SELECTION_DIRECTION=Nn;function i0(t){return Array.isArray(t)&&t.length===2&&(t[0]===null||typeof t[0]=="number")&&(t[1]===null||typeof t[1]=="number")}function oa(t){return i0(t)&&t[0]!=null&&t[1]!=null}const _e=class{static getGridPointFromXY(t,e,n){const s=_e.getColumnAtX(t,n),i=_e.getRowAtY(e,n),o=_e.getColumnHeaderDepthAtY(e,n);return{x:t,y:e,row:i,column:s,columnHeaderDepth:o}}static getCellInfoFromXY(t,e,n){const{row:s,column:i}=_e.getGridPointFromXY(t,e,n),{visibleColumnWidths:o,visibleRowHeights:r,visibleColumnXs:l,visibleRowYs:a,modelColumns:c,modelRows:h}=n,u=s!==null?h.get(s):null,m=i!==null?c.get(i):null,p=i!==null?l.get(i):null,g=s!==null?a.get(s):null,f=i!==null?o.get(i):null,b=s!==null?r.get(s):null;return{row:s,column:i,modelRow:u!=null?u:null,modelColumn:m!=null?m:null,left:p!=null?p:null,top:g!=null?g:null,columnWidth:f!=null?f:null,rowHeight:b!=null?b:null}}static getColumnHeaderDepthAtY(t,e){const n=_e.getRowAtY(t,e),{columnHeaderHeight:s,columnHeaderMaxDepth:i}=e;if(n===null&&t<=s*i)return Vt(i-Math.ceil(t/s),0,i-1)}static iterateFloatingStart(t,e,n){for(let s=0;s<t&&s<e;s+=1){const i=n(s);if(i!==void 0)return i}}static iterateFloatingEnd(t,e,n){for(let s=0;s<t&&e-(t-s)>=0;s+=1){const i=n(e-(t-s));if(i!==void 0)return i}}static iterateFloating(t,e,n,s){const i=_e.iterateFloatingStart(t,n,s);return i!==void 0?i:_e.iterateFloatingEnd(e,n,s)}static iterateAllItems(t,e,n,s,i,o){const r=Math.max(t,n),l=Math.min(e,i-s-1);let a=_e.iterateFloating(n,s,i,o);if(a!==void 0)return a;for(let c=r;c<=l;c+=1)if(a=o(c),a!==void 0)return a}static isInItem(t,e,n,s){var r,l;const i=(r=e.get(t))!=null?r:0,o=(l=n.get(t))!=null?l:0;return i<=s&&s<=i+o}static getItemAtOffset(t,e,n,s,i,o,r,l=!1){const a=l?void 0:_e.iterateFloating(n,s,e,c=>{if(_e.isInItem(c,o,r,t))return c});if(!l&&a!==void 0)return a;for(let c=0;c<i.length;c+=1){const h=i[c];if(_e.isInItem(h,o,r,t))return h}return null}static getColumnAtX(t,e,n=!1){const{columnCount:s,floatingLeftColumnCount:i,floatingRightColumnCount:o,visibleColumns:r,visibleColumnXs:l,visibleColumnWidths:a,gridX:c}=e;return t<c?null:this.getItemAtOffset(t-c,s,i,o,r,l,a,n)}static getRowAtY(t,e){const{floatingTopRowCount:n,floatingBottomRowCount:s,rowCount:i,visibleRows:o,visibleRowYs:r,visibleRowHeights:l,gridY:a}=e;return t<a?null:this.getItemAtOffset(t-a,i,n,s,o,r,l)}static getNextShownItem(t,e,n,s){let i=n.findIndex(o=>o===t)||0;for(i-=1;i!=null&&i>=0;){const o=n[i],r=e.get(o);if(r!=null&&s.get(r)!==0)return o;i-=1}return null}static getNextShownColumn(t,e){const{modelColumns:n,visibleColumns:s,userColumnWidths:i}=e;return _e.getNextShownItem(t,n,s,i)}static getNextShownRow(t,e){const{modelRows:n,visibleRows:s,userRowHeights:i}=e;return _e.getNextShownItem(t,n,s,i)}static getColumnSeparatorIndex(t,e,n,s){var C,v,T,E;const{rowHeaderWidth:i,columnHeaderHeight:o,floatingColumns:r,floatingLeftWidth:l,visibleColumns:a,visibleColumnXs:c,visibleColumnWidths:h,columnHeaderMaxDepth:u}=n,{allowColumnResize:m,headerSeparatorHandleSize:p}=s;if(u*o<e||!m||p<=0)return null;const g=t-i,f=p*.5;let b=!1;for(let y=r.length-1;y>=0;y-=1){const I=r[y],D=(C=c.get(I))!=null?C:0,M=(v=h.get(I))!=null?v:0,x=M===0;if(!b||!x){let B=D+M;x?B+=f:b&&(B-=f);const $=B-f,k=B+f;if($<=g&&g<=k)return I;b=x}}b=!1;for(let y=a.length-1;y>=0;y-=1){const I=a[y],D=(T=c.get(I))!=null?T:0,M=(E=h.get(I))!=null?E:0,x=M===0;if(D<l-M)return null;if(!b||!x){let B=D+M;x?B+=f:b&&(B-=f);const $=B-f,k=B+f;if($<=g&&g<=k)return I;b=x}}return null}static isItemHidden(t,e){return e.get(t)===0}static isColumnHidden(t,e){const{visibleColumnWidths:n}=e;return _e.isItemHidden(t,n)}static isFloatingRow(t,e){if(t==null)return!1;const{floatingTopRowCount:n,floatingBottomRowCount:s,rowCount:i}=e;return t<n||t>=i-s}static isFloatingColumn(t,e){if(t==null)return!1;const{floatingLeftColumnCount:n,floatingRightColumnCount:s,columnCount:i}=e;return t<n||t>=i-s}static getHiddenItems(t,e,n){if(!_e.isItemHidden(t,e))return[];const s=[t],i=n.findIndex(o=>o===t);for(let o=i-1;o>=0;o-=1){const r=n[o];if(!_e.isItemHidden(r,e))break;s.push(r)}return s}static getHiddenColumns(t,e){const{visibleColumns:n,visibleColumnWidths:s}=e;return _e.getHiddenItems(t,s,n)}static getRowSeparatorIndex(t,e,n,s){var g,f;const{rowHeaderWidth:i,columnHeaderHeight:o,visibleRows:r,visibleRowYs:l,visibleRowHeights:a}=n,{allowRowResize:c,headerSeparatorHandleSize:h}=s;if(i<t||!c||h<=0)return null;const u=e-o,m=h*.5;let p=!1;for(let b=r.length-1;b>=0;b-=1){const C=r[b],v=(g=l.get(C))!=null?g:0,T=(f=a.get(C))!=null?f:0,E=T===0;if(!p||!E){let y=v+T;E?y+=m:p&&(y-=m);const I=y-m,D=y+m;if(I<=u&&u<=D)return C;p=E}}return null}static isRowHidden(t,e){const{visibleRowHeights:n}=e;return _e.isItemHidden(t,n)}static getHiddenRows(t,e){const{visibleRows:n,visibleRowHeights:s}=e;return _e.getHiddenItems(t,s,n)}static moveItem(t,e,n){if(t===e)return n;const s=[...n],i=s[s.length-1];return i!=null&&!oa(i.from)&&i.to===t?i.from===e?s.pop():s[s.length-1]={...i,to:e}:s.push({from:t,to:e}),s}static moveRange(t,e,n){if(t[0]===e)return n;const s=[...n],i=s[s.length-1];return i!=null&&oa(i.from)&&i.from[1]-i.from[0]===t[1]-t[0]&&i.to===t[0]?i.from[0]===e?s.pop():s[s.length-1]={...i,to:e}:s.push({from:t,to:e}),s[s.length-1].from===s[s.length-1].to&&s.pop(),s}static applyItemMoves(t,e,n,s=!1){var o,r;let i=[[t,e]];for(let l=s?n.length-1:0;s?l>=0:l<n.length;s?l-=1:l+=1){const{from:a,to:c}=n[l];let h=1,u;oa(a)?(h=a[1]-a[0]+1,[u]=a):u=a;const m=s?c:u,p=m+h-1,g=s?u:c,f=g-m,b=[];for(let C=0;C<i.length;C+=1){const v=(o=i[C][0])!=null?o:Number.NEGATIVE_INFINITY,T=(r=i[C][1])!=null?r:Number.POSITIVE_INFINITY;let E;const y=[[v,m-1],[m,p],[p+1,T]].map(([I,D])=>[Math.max(I,v),Math.min(D,T)]).filter(([I,D])=>I<=D).map(I=>{const[D,M]=I;return m<=D&&p>=M?(E=[D+f,M+f],E):p<D?[D-h,M-h]:I}).map(I=>{const[D,M]=I;return g>D&&g<=M?[[D,g-1],[g+h,M+h]]:I===E?[I]:g<=D?[[D+h,M+h]]:[I]}).flat();b.push(...y)}i=b.map(([C,v])=>[Number.isFinite(C)?C:null,Number.isFinite(v)?v:null])}return i}static translateRange(t,e,n,s){const i=_e.applyItemMoves(t.startColumn,t.endColumn,e,s),o=_e.applyItemMoves(t.startRow,t.endRow,n,s),r=[];for(let l=0;l<i.length;l+=1){const a=i[l];for(let c=0;c<o.length;c+=1){const h=o[c];r.push(new oe(a[0],h[0],a[1],h[1]))}}return r}static getModelIndex(t,e){return _e.applyItemMoves(t,t,e,!0)[0][0]}static getModelIndexes(t,e){return t.map(n=>_e.getModelIndex(n,e))}static getModelRangeIndexes(t,e,n){return _e.applyItemMoves(t,e,n,!0)}static getModelRange(t,e=[],n=[]){return _e.translateRange(t,e,n,!0)}static getModelRanges(t,e=[],n=[]){const s=[];for(let i=0;i<t.length;i+=1)s.push(..._e.getModelRange(t[i],e,n));return s}static getVisibleRangeIndexes(t,e,n){return _e.applyItemMoves(t,e,n,!1)}static getVisibleRange(t,e=[],n=[]){return this.translateRange(t,e,n,!1)}static getVisibleRanges(t,e=[],n=[]){const s=[];for(let i=0;i<t.length;i+=1)s.push(..._e.getVisibleRange(t[i],e,n));return s}static getVisibleIndex(t,e){return _e.applyItemMoves(t,t,e)[0][0]}static getVisibleIndexes(t,e){return t.map(n=>_e.getVisibleIndex(n,e))}static isMacPlatform(){const{platform:t}=window.navigator;return t.startsWith("Mac")}static getModifierKey(){return _e.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(t){const e=_e.getModifierKey();return t[e]}static checkColumnHidden(t,e){return e.get(t)===0}static checkAllColumnsHidden(t,e){return e.size===0?!1:t.every(n=>e.get(n)===0)}static getScrollDragBounds(t,e,n){const{gridX:s,gridY:i,width:o,height:r,floatingTopRowCount:l,floatingBottomRowCount:a,floatingLeftColumnCount:c,floatingRightColumnCount:h,floatingLeftWidth:u,floatingRightWidth:m,floatingTopHeight:p,floatingBottomHeight:g,columnCount:f,rowCount:b}=t;let C=s,v=i,T=o,E=r;return n!=null&&(n>c&&(C+=u),n<f-h&&(T-=m)),e!=null&&(e>l&&(v+=p),e<b-a&&(E-=g)),{x1:C,y1:v,x2:T,y2:E}}static getScrollDelta(t,e=1024,n=768,s=20,i=20){let{deltaX:o,deltaY:r}=t;return!_e.isMacPlatform()&&t.shiftKey&&t.deltaX===0&&t.deltaY!==0&&(o=t.deltaY,r=t.deltaX),(t==null?void 0:t.deltaMode)===WheelEvent.DOM_DELTA_PAGE?(o*=e,r*=n):(t==null?void 0:t.deltaMode)===WheelEvent.DOM_DELTA_LINE&&(_e.isMacPlatform()?(o=Math.round(o*s),r=Math.round(r*i)):(o=Math.round(o*this.PIXELS_PER_LINE),r=Math.round(r*this.PIXELS_PER_LINE))),{deltaX:o,deltaY:r}}static compareRanges(t,e){return t[0]==null||t[1]==null||e[0]==null||e[1]==null?0:t[0]!==e[0]?t[0]-e[0]:t[1]-e[1]}static mergeSortedRanges(t){const e=[];for(let n=0;n<t.length;n+=1){const s=t[n],i=s[0],o=s[1];n===0?e.push([i,o]):i-1<=e[e.length-1][1]?e[e.length-1][1]=Math.max(e[e.length-1][1],o):e.push([i,o])}return e}};let K=_e;K.PIXELS_PER_LINE=100/3;function U(t,e,n=void 0){var i;const s=(i=t.get(e))!=null?i:n;if(s!==void 0)return s;throw new Error(`Missing value for key ${e}`)}function br(t,e=Go.CACHE_SIZE,n=Math.floor(e/2)){if(t.size>e){const s=t.keys();for(;t.size>n;)t.delete(s.next().value)}}function eh(t,e,n,s,i){const o=new Map;let r=0;for(let l=0;l<t&&l<n;l+=1)o.set(l,r),r+=U(i,l);r=s;for(let l=0;l<e&&n-l-1>=0;l+=1)r-=U(i,n-l-1),o.set(n-l-1,r);return o}const Mm=class{constructor({userColumnWidths:t=new Map,userRowHeights:e=new Map,calculatedColumnWidths:n=new Map,calculatedRowHeights:s=new Map,fontWidths:i=new Map,modelRows:o=new Map,modelColumns:r=new Map,movedRows:l=[],movedColumns:a=[]}={}){this.userColumnWidths=t,this.userRowHeights=e,this.calculatedRowHeights=s,this.calculatedColumnWidths=n,this.fontWidths=i,this.modelRows=o,this.modelColumns=r,this.movedRows=l,this.movedColumns=a}getMetrics(t){const{left:e,top:n,leftOffset:s,topOffset:i,width:o,height:r,theme:l,model:a,movedRows:c,movedColumns:h,draggingColumn:u}=t,{rowHeight:m,rowHeaderWidth:p,rowFooterWidth:g,columnWidth:f,columnHeaderHeight:b,minScrollHandleSize:C,scrollBarSize:v}=l;c!==this.movedRows&&(this.movedRows=c,this.modelRows.clear()),h!==this.movedColumns&&(this.movedColumns=h,this.modelColumns.clear());const{columnCount:T,rowCount:E,floatingTopRowCount:y,floatingBottomRowCount:I,floatingLeftColumnCount:D,floatingRightColumnCount:M,columnHeaderMaxDepth:x}=a,B=this.getFirstRow(t),$=this.getFirstColumn(t),k=this.getGridX(t),H=this.getGridY(t),O=St(a)&&a.hasExpandableRows?this.calculateTreePaddingX(t):0,F=0;let _=this.getVisibleRowHeights(t),L=this.getVisibleColumnWidths(t,$,O);const V=Array.from(_.keys()),G=Array.from(L.keys());_=new Map([..._,...this.getFloatingRowHeights(t)]),L=new Map([...L,...this.getFloatingColumnWidths(t)]);let j=this.getVisibleColumnXs(L,G,s),ne=this.getVisibleRowYs(_,V,i);const ye=V.length>0?V[V.length-1]:n,le=G.length>0?G[G.length-1]:e,Te=this.getBottomViewport(t,V,ne,_),He=this.getRightViewport(t,G,j,L),Z=this.getFloatingTopHeight(t,_),ge=this.getFloatingBottomHeight(t,_),be=this.getFloatingLeftWidth(t,L),Le=this.getFloatingRightWidth(t,L),Oe=Array.from(L.values()),gn=Array.from(_.values()),jn=Oe.reduce((ft,Ei)=>ft+Ei,0)-s,Tn=gn.reduce((ft,Ei)=>ft+Ei,0)-i,vt=this.getLastLeft(t,null,o-k-v-g),Ne=this.getLastTop(t,null,r-H-v-ge),rt=s+jn+g,lt=i+Tn,_t=o-k,Qt=r-H,Zt=vt>0||rt>_t,Lt=Zt?v:0,Qn=Ne>0||lt>Qt-Lt,Bt=Qn?v:0,$t=o-p-Bt,kn=r-b-Lt,Vl=p,Ul=b,Bl=T===1?$t/rt:(T-vt)/T,jo=E===1?kn/lt:(E-Ne)/E,Qo=Zt?Vt($t*Bl,C,$t-1):0,Zo=Qn?Vt(kn*jo,C,kn-1):0,Jo=U(L,e,0),er=U(_,n,0),tr=Jo>0?s/Jo:0,nr=er>0?i/er:0,$l=T===1?s/(rt-_t):(e+tr)/vt,Wl=E===1?i/(lt-Qt):(n+nr)/Ne,Hs=Zt?$l*($t-Qo):0,zl=Qn?Wl*(kn-Zo):0;let Ti=[];(y>0||I>0)&&(Ti=[...Array(y).keys(),...[...Array(I).keys()].map(ft=>E-ft-1)],ne=new Map([...ne,...this.getFloatingRowYs(t,_,Math.floor(r-H-Lt))]));let ao=[];(D>0||M>0)&&(ao=[...Array(D).keys(),...[...Array(M).keys()].map(ft=>T-ft-1)],j=new Map([...j,...this.getFloatingColumnXs(t,L,Math.floor(o-k-Bt))]));const sr=[];if(u)for(let ft=u.range[0];ft<=u.range[1];ft+=1)sr.push(ft),L.has(ft)||L.set(ft,this.getVisibleColumnWidth(ft,t)),j.has(ft)||j.set(ft,0);const ir=V.concat(Ti),co=G.concat(ao).concat(sr),ho=this.getModelRows(ir,t),Gl=this.getModelColumns(co,t),Kl=this.getVisibleRowTreeBoxes(_,ho,t),or=this.getTopVisible(t,ne,_,V),ql=this.getLeftVisible(t,j,L,G),rr=Ne>0?this.getBottomVisible(t,ne,_,V,H):ye,lr=vt>0?this.getRightVisible(t,j,L,G,k):le,{fontWidths:ar,userColumnWidths:cr,userRowHeights:dr,calculatedRowHeights:Yl,calculatedColumnWidths:Xl}=this;return{rowHeight:m,rowHeaderWidth:p,rowFooterWidth:g,rowCount:E,columnWidth:f,columnCount:T,columnHeaderHeight:b,floatingTopRowCount:y,floatingBottomRowCount:I,floatingLeftColumnCount:D,floatingRightColumnCount:M,gridX:k,gridY:H,firstRow:B,firstColumn:$,treePaddingX:O,treePaddingY:F,left:e,top:n,bottom:ye,right:le,topOffset:i,leftOffset:s,topVisible:or,leftVisible:ql,bottomVisible:rr,rightVisible:lr,bottomViewport:Te,rightViewport:He,width:o,height:r,maxX:jn,maxY:Tn,lastLeft:vt,lastTop:Ne,barHeight:kn,barTop:Ul,barWidth:$t,barLeft:Vl,handleHeight:Zo,handleWidth:Qo,hasHorizontalBar:Zt,hasVerticalBar:Qn,verticalBarWidth:Bt,horizontalBarHeight:Lt,scrollX:Hs,scrollY:zl,scrollableContentWidth:rt,scrollableContentHeight:lt,scrollableViewportWidth:_t,scrollableViewportHeight:Qt,visibleRows:V,visibleColumns:G,floatingRows:Ti,floatingColumns:ao,allRows:ir,allColumns:co,visibleRowHeights:_,visibleColumnWidths:L,floatingTopHeight:Z,floatingBottomHeight:ge,floatingLeftWidth:be,floatingRightWidth:Le,visibleRowYs:ne,visibleColumnXs:j,visibleRowTreeBoxes:Kl,modelRows:ho,modelColumns:Gl,movedRows:c,movedColumns:h,fontWidths:ar,userColumnWidths:cr,userRowHeights:dr,calculatedRowHeights:Yl,calculatedColumnWidths:Xl,columnHeaderMaxDepth:x}}getGridX(t){const{theme:e}=t,{rowHeaderWidth:n}=e;return n}getGridY(t){const{theme:e,model:n}=t,{columnHeaderHeight:s}=e,{columnHeaderMaxDepth:i}=n;return i*s}getVisibleHeight(t,e=this.getFloatingRowHeights(t)){const{height:n,theme:s}=t,{scrollBarSize:i}=s,o=this.getGridY(t),r=this.getFloatingBottomHeight(t,e),l=this.getFloatingTopHeight(t,e);return n-r-l-o-i}getVisibleWidth(t,e=this.getFloatingColumnWidths(t)){const{width:n,theme:s}=t,{scrollBarSize:i,rowFooterWidth:o}=s,r=this.getGridX(t),l=this.getFloatingRightWidth(t,e),a=this.getFloatingLeftWidth(t,e);return n-a-l-r-i-o}getFirstIndex(t,e,n){const s=t.size+1;for(let i=0;i<s;i+=1){const o=e(i,n);if(t.get(o)!==0)return i}return 0}getFirstColumn(t){return this.getFirstIndex(this.userColumnWidths,this.getModelColumn.bind(this),t)}getFirstRow(t){return this.getFirstIndex(this.userRowHeights,this.getModelRow.bind(this),t)}getLastLeft(t,e=null,n=this.getVisibleWidth(t)){const{model:s}=t,{columnCount:i}=s;let o=i-1;e!=null&&(o=e);let r=0;for(;o>=0;){if(r+=this.getVisibleColumnWidth(o,t),r>=n)return Math.min(o+1,i-1);o-=1}return 0}getLastTop(t,e=null,n=this.getVisibleHeight(t)){const{model:s}=t,{rowCount:i,floatingBottomRowCount:o}=s;let r=Math.max(0,i-o-1);e!=null&&(r=e);let l=0;for(;r>0;){if(l+=this.getVisibleRowHeight(r,t),l>=n)return Math.min(r+1,i-1);r-=1}return 0}getTopForTopVisible(t,e){const n=this.getFloatingTopHeight(t);let s=e,i=0;for(;s>0&&i<n;)s-=1,i+=this.getVisibleRowHeight(s,t);return s}getTopForBottomVisible(t,e){const{height:n}=t,s=this.getGridY(t),i=this.getFloatingBottomHeight(t),o=n-s-i;return this.getLastTop(t,e,o)}getLeftForLeftVisible(t,e){const n=this.getFloatingLeftWidth(t);let s=e,i=0;for(;s>0&&i<n;)s-=1,i+=this.getVisibleColumnWidth(s,t);return s}getLeftForRightVisible(t,e){const{width:n}=t,s=this.getGridX(t),i=this.getFloatingRightWidth(t),o=n-s-i;return this.getLastLeft(t,e,o)}getFloatingRowHeights(t){const{model:e}=t,{floatingTopRowCount:n,floatingBottomRowCount:s,rowCount:i}=e,o=new Map;for(let r=0;r<n&&r<i;r+=1)o.set(r,this.getVisibleRowHeight(r,t));for(let r=0;r<s&&i-r-1>=0;r+=1){const l=i-r-1;o.set(l,this.getVisibleRowHeight(l,t))}return o}getVisibleRowHeights(t){const{top:e,topOffset:n,height:s,model:i}=t;let o=0,r=e;const l=new Map,{rowCount:a}=i;for(;o<s+n&&r<a;){const c=this.getVisibleRowHeight(r,t);l.set(r,c),o+=c,r+=1}return l}getFloatingColumnWidths(t,e=this.getFirstColumn(t),n=this.calculateTreePaddingX(t)){const{model:s}=t,{columnCount:i,floatingLeftColumnCount:o,floatingRightColumnCount:r}=s,l=new Map;for(let a=0;a<o&&a<i;a+=1)l.set(a,this.getVisibleColumnWidth(a,t,e,n));for(let a=0;a<r&&i-a-1>=0;a+=1){const c=i-a-1;l.set(c,this.getVisibleColumnWidth(c,t,e,n))}return l}getVisibleColumnWidths(t,e=this.getFirstColumn(t),n=this.calculateTreePaddingX(t)){const{left:s,leftOffset:i,width:o,model:r}=t;let l=0,a=s;const c=new Map,{columnCount:h}=r;for(;l<o+i&&a<h;){const u=this.getVisibleColumnWidth(a,t,e,n);c.set(a,u),l+=u,a+=1}return c}getFloatingColumnXs(t,e,n){const{model:s}=t,{columnCount:i,floatingLeftColumnCount:o,floatingRightColumnCount:r}=s;return eh(o,r,i,n,e)}getVisibleColumnXs(t,e,n){const s=new Map;let i=-n;for(let o=0;o<e.length;o+=1){const r=e[o],l=U(t,r);s.set(r,i),i+=l}return s}getFloatingRowYs(t,e,n){const{model:s}=t,{floatingTopRowCount:i,floatingBottomRowCount:o,rowCount:r}=s;return eh(i,o,r,n,e)}getVisibleRowYs(t,e,n){const s=new Map;let i=-n;for(let o=0;o<e.length;o+=1){const r=e[o],l=U(t,r);s.set(r,i),i+=l}return s}getVisibleRowTreeBoxes(t,e,n){const s=new Map,{model:i,theme:o}=n,{treeDepthIndent:r,treeHorizontalPadding:l}=o;return St(i)&&i.hasExpandableRows&&t.forEach((a,c)=>{const h=U(e,c);if(i.isRowExpandable(h)){const u=i.depthForRow(h),m=u*r+l,p=(u+1)*r+l,g=0,f=a;s.set(c,{x1:m,y1:g,x2:p,y2:f})}}),s}getFloatingLeftWidth(t,e=this.getFloatingColumnWidths(t)){const{model:n}=t,{floatingLeftColumnCount:s}=n;let i=0;for(let o=0;o<s;o+=1)i+=U(e,o);return i}getFloatingRightWidth(t,e=this.getFloatingColumnWidths(t)){const{model:n}=t,{floatingRightColumnCount:s,columnCount:i}=n;let o=0;for(let r=0;r<s;r+=1)o+=U(e,i-r-1);return o}getFloatingTopHeight(t,e=this.getFloatingRowHeights(t)){const{model:n}=t,{floatingTopRowCount:s}=n;let i=0;for(let o=0;o<s;o+=1)i+=U(e,o);return i}getFloatingBottomHeight(t,e=this.getFloatingRowHeights(t)){const{model:n}=t,{floatingBottomRowCount:s,rowCount:i}=n;let o=0;for(let r=0;r<s;r+=1)o+=U(e,i-r-1);return o}getTopVisible(t,e,n,s){const i=this.getFloatingTopHeight(t,n);for(let o=0;o<s.length;o+=1){const r=s[o];if(U(e,r)>=i)return r}return 0}getLeftVisible(t,e,n,s){const i=this.getFloatingLeftWidth(t,n);for(let o=0;o<s.length;o+=1){const r=s[o];if(U(e,r)>=i)return r}return 0}getBottomVisible(t,e,n,s,i){const{height:o,theme:r}=t,{scrollBarSize:l}=r,a=this.getFloatingBottomHeight(t,n),c=o-i-l-a;for(let h=s.length-1;h>=0;h-=1){const u=s[h],m=U(e,u),p=U(n,u);if(m+p<=c)return u}return 0}getRightVisible(t,e,n,s,i){const{width:o,theme:r}=t,{scrollBarSize:l}=r,a=this.getFloatingRightWidth(t,n),c=o-i-l-a;for(let h=s.length-1;h>=0;h-=1){const u=s[h],m=U(e,u),p=U(n,u);if(m+p<=c)return u}return 0}getBottomViewport(t,e,n,s){const{height:i,theme:o}=t,{rowHeight:r}=o;return this.getLastIndexViewport(e,n,s,i,r)}getRightViewport(t,e,n,s){const{width:i,theme:o}=t,{columnWidth:r}=o;return this.getLastIndexViewport(e,n,s,i,r)}getLastIndexViewport(t,e,n,s,i){let o=0,r=0;return t.length>0&&(o=t[t.length-1],r=U(e,o)+U(n,o)),r<s&&(o+=Math.ceil((s-r)/i)),o}getVisibleItemSize(t,e,n){var i;const s=n();return(i=e.get(t))!=null?i:s}getVisibleRowHeight(t,e){const n=this.getModelRow(t,e);return this.getVisibleItemSize(n,this.userRowHeights,()=>this.calculateRowHeight(t,n,e))}getVisibleColumnWidth(t,e,n=this.getFirstColumn(e),s=this.calculateTreePaddingX(e)){const i=this.getModelColumn(t,e);return this.getVisibleItemSize(i,this.userColumnWidths,()=>this.calculateColumnWidth(t,i,e,n,s))}getModelRows(t,e){const n=new Map;for(let s=0;s<t.length;s+=1){const i=t[s],o=this.getModelRow(i,e);n.set(i,o)}return n}getModelRow(t,e){if(this.modelRows.has(t))return U(this.modelRows,t);const{movedRows:n}=e,s=K.getModelIndex(t,n);return this.modelRows.set(t,s),s}getModelColumns(t,e){const n=new Map;for(let s=0;s<t.length;s+=1){const i=t[s],o=this.getModelColumn(i,e);n.set(i,o)}return n}getModelColumn(t,e){if(this.modelColumns.has(t))return U(this.modelColumns,t);const{movedColumns:s}=e,i=K.getModelIndex(t,s);return this.modelColumns.set(t,i),i}calculateRowHeight(t,e,n){const{theme:s}=n,{autoSizeRows:i,rowHeight:o}=s;if(!i)return o;const r=this.calculatedRowHeights.get(e);return r!=null?r:(this.calculatedRowHeights.set(e,Math.ceil(o)),br(this.calculatedRowHeights),o)}calculateColumnWidth(t,e,n,s=this.getFirstColumn(n),i=this.calculateTreePaddingX(n)){const{theme:o}=n,{autoSizeColumns:r,minColumnWidth:l}=o;if(!r){const{columnWidth:m}=o;return m}const a=this.calculateColumnHeaderWidth(e,n),c=this.calculateColumnDataWidth(e,n),h=this.calculatedColumnWidths.get(e);let u=Math.ceil(Math.max(a,c));return u=Math.max(l,u),h!=null&&h>u?u=h:(this.calculatedColumnWidths.set(e,u),br(this.calculatedColumnWidths)),t===s&&(u+=i),u}calculateColumnHeaderWidth(t,e){const{model:n,theme:s}=e,{headerFont:i,headerHorizontalPadding:o}=s,r=n.textForColumnHeader(t,0);if(r!==void 0&&r!==""){const l=this.getWidthForFont(i,e);return r.length*l+o*2}return o*2}calculateColumnDataWidth(t,e){const{top:n,height:s,width:i,model:o,theme:r}=e,{floatingTopRowCount:l,floatingBottomRowCount:a,rowCount:c}=o,{font:h,cellHorizontalPadding:u,rowHeight:m,rowHeaderWidth:p,rowFooterWidth:g,scrollBarSize:f}=r;let b=0;const C=this.getWidthForFont(h,e),v=s/m,T=Math.ceil(n+v);return K.iterateAllItems(n,T,l,a,c,E=>{const y=this.getModelRow(E,e),I=o.textForCell(t,y);if(I){const D=u*2;b=Math.max(b,I.length*C+D)}}),b=Math.max(Math.min(b,(i-p-f-g)*Mm.MAX_COLUMN_WIDTH),u*2),b}calculateTreePaddingX(t){const{top:e,height:n,model:s,theme:i}=t,{rowHeight:o,treeDepthIndent:r}=i;if(!St(s)||!s.hasExpandableRows)return 0;let l=0;const a=n/o,c=Math.ceil(e+a);for(let h=e;h<=c;h+=1){const u=this.getModelRow(h,t),m=s.depthForRow(u);l=Math.max(l,r*(m+1))}return l}getWidthForFont(t,e){if(this.fontWidths.has(t))return U(this.fontWidths,t);const{context:n}=e;n.font=t;const s=n.measureText("8"),{width:i}=s;return this.fontWidths.set(t,i),this.fontWidths.set(n.font,i),i}setColumnWidth(t,e){const n=new Map(this.userColumnWidths);n.set(t,Math.ceil(e)),br(n),this.userColumnWidths=n}resetColumnWidth(t){const e=new Map(this.userColumnWidths);e.delete(t),this.userColumnWidths=e}setRowHeight(t,e){const n=new Map(this.userRowHeights);n.set(t,Math.ceil(e)),br(n),this.userRowHeights=n}resetRowHeight(t){const e=new Map(this.userRowHeights);e.delete(t),this.userRowHeights=e,this.calculatedRowHeights.delete(t)}};let Go=Mm;Go.CACHE_SIZE=1e4;Go.MAX_COLUMN_WIDTH=.8;const o0=Object.freeze({allowColumnResize:!0,allowRowResize:!0,autoSelectRow:!1,autoSelectColumn:!1,autoSizeColumns:!0,autoSizeRows:!0,backgroundColor:"#000000",black:"#000000",white:"#ffffff",cellHorizontalPadding:5,headerHorizontalPadding:5,font:"12px Arial, sans serif",gridColumnColor:"#8f8f8f66",gridRowColor:"#8f8f8f66",headerBackgroundColor:"#222222",headerSeparatorColor:"#000000",headerSeparatorHoverColor:"#888888",headerSeparatorHandleSize:5,headerHiddenSeparatorSize:5,headerHiddenSeparatorHoverColor:"#8888FF",headerColor:"#d5d5d5",headerFont:"10px Arial, sans serif",columnHoverBackgroundColor:"#444444",selectedColumnHoverBackgroundColor:"#494949",rowBackgroundColors:"#333333 #222222",rowHoverBackgroundColor:"#444444",selectedRowHoverBackgroundColor:"#494949",minScrollHandleSize:50,scrollBarBackgroundColor:"#111111",scrollBarHoverBackgroundColor:"#333333",scrollBarCasingColor:"#000000",scrollBarCornerColor:"#000000",scrollBarColor:"#555555",scrollBarHoverColor:"#888888",scrollBarActiveColor:"#AAAAAA",scrollBarSize:12,scrollBarHoverSize:16,scrollBarCasingWidth:1,scrollSnapToColumn:!1,scrollSnapToRow:!1,selectionColor:"#4286f433",selectionOutlineColor:"#4286f4",selectionOutlineCasingColor:"#222222",scrollBarSelectionTick:!0,scrollBarSelectionTickColor:"#4286f433",scrollBarActiveSelectionTickColor:"#4286f480",shadowBlur:8,shadowColor:"#000000",textColor:"#ffffff",maxDepth:6,treeDepthIndent:10,treeHorizontalPadding:5,treeLineColor:"#888888",treeMarkerColor:"#cccccc",treeMarkerHoverColor:"#ffffff",rowHeight:20,columnWidth:100,minRowHeight:20,minColumnWidth:55,columnHeaderHeight:20,rowHeaderWidth:30,rowFooterWidth:0,headerResizeSnapThreshold:10,headerResizeHiddenSnapThreshold:8,allowColumnReorder:!0,allowRowReorder:!0,reorderOffset:2,floatingGridColumnColor:"#8f8f8f66",floatingGridRowColor:"#8f8f8f66",floatingRowBackgroundColors:"#393939 #292929",floatingDividerOuterColor:"#000000",floatingDividerInnerColor:"#cccccc"}),dn=(t,e)=>{let n=!1;const s=Ie(t,{...e,dispose:()=>{n||(n=!0,s.clear(),n=!1)}});return s};function r0(t,e,n=6){const s=ba.hex.lab.raw(t);return s[0]=Math.max(s[0]-s[0]/n*e,0),`#${ba.lab.hex(s)}`}function l0(t,e){const[n,s,i]=ba.hex.rgb(t);return`rgba(${n}, ${s}, ${i}, ${e})`}const th={colorWithAlpha:l0,darkenForDepth:r0};class Rt{constructor(e=5e3){this.cursor=null,this.order=e}onDown(e,n,s){return!1}onMove(e,n,s){return!1}onDrag(e,n,s){return!1}onLeave(e,n,s){return!1}onClick(e,n,s){return!1}onContextMenu(e,n,s){return!1}onDoubleClick(e,n,s){return!1}onUp(e,n,s){return!1}onWheel(e,n,s){return!1}}class Fm extends Rt{constructor(){super(...arguments),this.resizingItems=[],this.hiddenItems=[],this.targetSizes=new Map,this.dragOffset=0}onDown(e,n){const{metrics:s}=n,{model:i}=n.props,o=n.getTheme();if(!s)throw new Error("metrics not set");const r=this.getSeparator(e,s,i,o);if(r!=null){const l=r.index;return this.dragOffset=0,this.draggingIndex=l,this.resizingItems=[l],this.hiddenItems=this.getHiddenItems(l,s).reverse(),this.targetSizes.clear(),this.addTargetSize(s,l),this.updateCursor(s,l),this.updateSeparator(n,r),!0}return!1}onMove(e,n){const{metrics:s}=n,{model:i}=n.props,o=n.getTheme();if(!s)throw new Error("metrics not set");const r=this.getSeparator(e,s,i,o);return r!=null?(this.updateCursor(s,r.index),!0):!1}onDrag(e,n){var f;if(this.draggingIndex==null)return!1;const s=e[this.pointProperty],{metricCalculator:i,metrics:o}=n;if(!o)throw new Error("metrics not set");const r=n.getTheme(),l=o[this.visibleOffsetProperty],a=o[this.marginProperty],c=o[this.calculatedSizesProperty],h=o[this.modelIndexesProperty],u=o[this.firstIndexProperty],m=o[this.treePaddingProperty],p=new Map;let g=this.resizingItems[this.resizingItems.length-1];for(;g!=null;){const b=U(l,g),C=s-a-b-this.dragOffset,v=U(h,g),T=this.targetSizes.get(v),E=this.resizingItems.length>1,y=this.hiddenItems.indexOf(g);let I=U(c,v);g===u&&(I+=m);let D=C;Math.abs(C-I)<=r.headerResizeSnapThreshold?D=null:T!==void 0&&C>T&&(E&&y!==0||y>0)?D=T:C<=r.headerResizeHiddenSnapThreshold&&(D=0),D!==I?p.set(v,D):p.set(v,null),C<-r.headerResizeSnapThreshold&&D===0?y>=0&&E?(this.resizingItems.pop(),this.removeTargetSize(o,g),g=this.resizingItems[this.resizingItems.length-1],this.dragOffset-=(f=this.targetSizes.get(U(h,g)))!=null?f:0):(g=this.getNextShownItem(g,o),g!==null&&(this.resizingItems.push(g),this.addTargetSize(o,g))):T!==void 0&&C>T+r.headerResizeSnapThreshold&&D===T?y>0?(this.dragOffset+=D,g=this.hiddenItems[y-1],this.resizingItems.push(g),this.addTargetSize(o,g)):E?(this.resizingItems.pop(),this.removeTargetSize(o,g),g=this.resizingItems[this.resizingItems.length-1]):g=null:g=null}return p.forEach((b,C)=>{b!==null?this.setSize(i,C,b):this.resetSize(i,C)}),this.updateCursor(o,this.draggingIndex),!0}onUp(e,n){return this.draggingIndex!=null&&(this.draggingIndex=void 0,this.resizingItems=[],this.hiddenItems=[],this.targetSizes.clear(),this.updateSeparator(n,null)),!1}onDoubleClick(e,n){const{metrics:s,metricCalculator:i}=n,{model:o}=n.props,r=n.getTheme();if(!s)throw new Error("metrics not set");const l=this.getSeparator(e,s,o,r);if(l!=null){const a=s[this.modelIndexesProperty],c=U(a,l.index);return this.resetSize(i,c),n.forceUpdate(),!0}return!1}updateCursor(e,n){const s=e[this.visibleSizesProperty];U(s,n)===0?this.cursor=this.hiddenCursor:this.cursor=this.defaultCursor}addTargetSize(e,n){const s=e[this.modelIndexesProperty],i=e[this.userSizesProperty],o=e[this.calculatedSizesProperty],r=n===0?e[this.treePaddingProperty]:0,l=U(s,n);let a=i.get(l);(a==null||a===0)&&(a=U(o,l)+r),this.targetSizes.set(l,a)}removeTargetSize(e,n){const s=e[this.modelIndexesProperty],i=U(s,n);this.targetSizes.delete(i)}}class Rl extends Fm{constructor(){super(...arguments),this.hiddenCursor="e-resize",this.defaultCursor="col-resize",this.pointProperty="x",this.userSizesProperty="userColumnWidths",this.visibleOffsetProperty="visibleColumnXs",this.visibleSizesProperty="visibleColumnWidths",this.marginProperty="rowHeaderWidth",this.calculatedSizesProperty="calculatedColumnWidths",this.modelIndexesProperty="modelColumns",this.firstIndexProperty="firstColumn",this.treePaddingProperty="treePaddingX",this.getHiddenItems=K.getHiddenColumns,this.getNextShownItem=K.getNextShownColumn,this.getSeparator=Rl.getColumnSeparator}static getColumnSeparator(e,n,s,i){if(!i.allowColumnResize)return null;const{x:o,y:r,columnHeaderDepth:l}=e,{modelColumns:a}=n,c=K.getColumnSeparatorIndex(o,r,n,i);return c==null||l==null||l>0?null:a.get(c)!=null?{index:c,depth:0}:null}setSize(e,n,s){e.setColumnWidth(n,s)}resetSize(e,n){e.resetColumnWidth(n)}updateSeparator(e,n){e.setState({draggingColumnSeparator:n,isDragging:n!==null})}}const rs=class{constructor(){this.getCachedTruncatedString=dn((t,e,n,s,i)=>rs.truncateToWidth(t,e,n,s,i),{max:1e4}),this.getCachedBackgroundColors=dn((t,e)=>t.split(" ").map(n=>{const s=[];for(let i=0;i<e;i+=1)s.push(th.darkenForDepth(n,i,e));return s}),{max:1e3}),this.getCachedColorWithAlpha=dn((t,e)=>th.colorWithAlpha(t,e),{max:1e3}),this.getCachedColorIsDark=dn(t=>cl.isDark(t),{max:1e3})}static truncate(t,e){return e<t.length?t.substr(0,e)+"\u2026":t}static binaryTruncateToWidth(t,e,n,s=0,i=e.length,o){if(i>=e.length&&t.measureText(e).width<=n)return e;if(o!==void 0){const c=t.measureText(o).width;return o.repeat(Math.max(1,Math.floor(n/c)))}let r=s,l=Math.min(e.length-1,i),a=e;for(;l>=r;){const c=Math.ceil((l+r)/2),h=rs.truncate(e,c);if(t.measureText(h).width<=n){if(a=h,r===c)break;r=c}else if(c===0){a=h;break}else l=c-1}return a}static truncateToWidth(t,e,n,s=rs.DEFAULT_FONT_WIDTH,i){if(n<=0||e.length<=0)return"";const o=Math.min(Math.max(0,Math.floor(n/s/2)-5),e.length),r=Math.min(Math.ceil(n/s*2),e.length);return rs.binaryTruncateToWidth(t,e,n,o,r,i)}drawCanvas(t){const{context:e}=t;e.save(),this.configureContext(e,t),this.drawBackground(e,t),this.drawGrid(e,t),this.drawHeaders(e,t),this.drawFooters(e,t),this.drawDraggingColumn(e,t),this.drawDraggingRow(e,t),this.drawScrollBars(e,t),e.restore()}configureContext(t,e){const{theme:n}=e;t.font=n.font,t.textBaseline="middle",t.lineCap="butt"}drawBackground(t,e){const{theme:n,metrics:s}=e,{width:i,height:o}=s;t.fillStyle=n.backgroundColor,t.fillRect(0,0,i,o)}drawGrid(t,e){const{metrics:n,draggingRow:s,draggingColumn:i}=e,{gridX:o,gridY:r}=n;t.translate(o,r),this.drawGridBackground(t,e,s==null&&i==null),this.drawCellContents(t,e),this.drawFloatingRows(t,e),this.drawFloatingColumns(t,e),t.translate(-o,-r)}drawFloatingRows(t,e){const{draggingRow:n,draggingColumn:s,metrics:i,theme:o}=e,{floatingTopRowCount:r,floatingBottomRowCount:l,floatingRows:a,rowCount:c,visibleColumns:h,visibleRowYs:u,visibleRowHeights:m}=i;if(a.length!==0){o.floatingRowBackgroundColors&&this.drawRowStripesForRows(t,e,a,o.floatingRowBackgroundColors),n==null&&s==null&&this.drawFloatingMouseRowHover(t,e),this.drawGridLinesForItems(t,e,h,a,o.floatingGridColumnColor,o.floatingGridRowColor),this.drawCellBackgroundsForItems(t,e,h,a),this.drawFloatingBorders(t,e),r>0&&this.drawSelectedRanges(t,e,{top:0,bottom:r-1,maxY:U(u,r-1)+U(m,r-1)-.5}),l>0&&this.drawSelectedRanges(t,e,{top:c-l-1,bottom:c-1,minY:U(u,c-l)+.5,maxY:U(u,c-1)+U(m,c-1)-.5});for(let p=0;p<h.length;p+=1){const g=h[p];for(let f=0;f<a.length;f+=1){const b=a[f];this.drawCellContent(t,e,g,b)}}}}drawFloatingColumns(t,e){const{draggingRow:n,draggingColumn:s,metrics:i,theme:o}=e,{floatingLeftColumnCount:r,floatingRightColumnCount:l,floatingLeftWidth:a,floatingRightWidth:c,floatingColumns:h,gridX:u,maxX:m,columnCount:p,visibleRows:g,visibleColumnXs:f,visibleColumnWidths:b,width:C,height:v}=i;if(h.length!==0){o.floatingRowBackgroundColors&&(this.drawRowStripesForRows(t,e,g,o.floatingRowBackgroundColors,0,a),this.drawRowStripesForRows(t,e,g,o.floatingRowBackgroundColors,C-u-c,m)),n==null&&s==null&&this.drawFloatingMouseRowHover(t,e),t.save(),t.beginPath(),t.rect(0,0,a,v),t.clip(),this.drawGridLinesForItems(t,e,h,g,o.floatingGridColumnColor,o.floatingGridRowColor),t.restore(),this.drawCellBackgroundsForItems(t,e,h,g),this.drawFloatingBorders(t,e),r>0&&this.drawSelectedRanges(t,e,{left:0,maxX:U(f,r-1)+U(b,r-1)}),l>0&&this.drawSelectedRanges(t,e,{left:p-l,right:p-1,minX:U(f,p-l)+.5,maxX:U(f,p-1)+U(b,p-1)});for(let T=0;T<h.length;T+=1){const E=h[T];for(let y=0;y<g.length;y+=1){const I=g[y];this.drawCellContent(t,e,E,I)}}}}drawFloatingBorders(t,e){const{metrics:n,theme:s}=e,{floatingTopRowCount:i,floatingBottomRowCount:o,floatingLeftColumnCount:r,floatingRightColumnCount:l,rowCount:a,columnCount:c,visibleRowYs:h,visibleColumnXs:u,visibleRowHeights:m,visibleColumnWidths:p,maxX:g,maxY:f}=n,{floatingDividerOuterColor:b,floatingDividerInnerColor:C}=s;if(t.lineWidth=3,t.beginPath(),t.strokeStyle=b,i>0){const v=U(h,i-1)+U(m,i-1)+.5;t.moveTo(0,v),t.lineTo(g,v)}if(o>0){const v=U(h,a-o)-.5;t.moveTo(0,v),t.lineTo(g,v)}if(r>0){const v=U(u,r-1)+U(p,r-1)+.5;t.moveTo(v,0),t.lineTo(v,f)}if(l>0){const v=U(u,c-l)-.5;t.moveTo(v,0),t.lineTo(v,f)}if(t.stroke(),t.beginPath(),t.lineWidth=1,t.strokeStyle=C,i>0){const v=U(h,i-1)+U(m,i-1)+.5;t.moveTo(0,v),t.lineTo(g,v)}if(o>0){const v=U(h,a-o)-.5;t.moveTo(0,v),t.lineTo(g,v)}if(r>0){const v=U(u,r-1)+U(p,r-1)+.5;t.moveTo(v,0),t.lineTo(v,f)}if(l>0){const v=U(u,c-l)-.5;t.moveTo(v,0),t.lineTo(v,f)}t.stroke()}drawGridBackground(t,e,n=!1){this.drawRowStripes(t,e),n&&(this.drawMouseColumnHover(t,e),this.drawMouseRowHover(t,e)),this.drawGridLines(t,e),this.drawCellBackgrounds(t,e);const{metrics:s}=e,{bottom:i,right:o,floatingBottomRowCount:r,floatingLeftColumnCount:l,floatingRightColumnCount:a,floatingTopRowCount:c,columnCount:h,rowCount:u,visibleRowHeights:m,visibleRowYs:p,visibleColumnXs:g,visibleColumnWidths:f,width:b,height:C}=s;this.drawSelectedRanges(t,e,{bottom:Math.min(i,u-r-1),right:Math.min(o,h-a-1),minX:l>0&&g.has(l+1)?U(g,l+1):-10,minY:c>0&&p.has(c+1)?U(p,c+1):-10,maxX:a>0&&g.has(h-a-1)?U(g,h-a-1)+U(f,h-a-1)-.5:b+10,maxY:r>0&&p.has(u-r-1)?U(p,u-r-1)+U(m,u-r-1)-.5:C+10})}drawRowStripes(t,e){const{metrics:n,theme:s}=e,{visibleRows:i}=n,{rowBackgroundColors:o}=s;!o||this.drawRowStripesForRows(t,e,i,o)}drawRowStripesForRows(t,e,n,s,i=0,o=e.metrics.maxX){const{theme:r,metrics:l,model:a}=e,{maxDepth:c,shadowBlur:h,shadowColor:u}=r,m=this.getCachedBackgroundColors(s,c),{visibleRowYs:p,visibleRowHeights:g}=l,f=new Map,b=[],C=[],v=(T,E)=>{const y=St(a)?a.depthForRow(T):0,I=m[T%m.length],D=I[Math.min(y,I.length-1)];if(f.has(D)||f.set(D,[]),f.get(D).push(T),E!=null){const M=St(a)?a.depthForRow(E):0;M<y?b.push(T):M>y&&C.push(E)}};for(let T=0;T<n.length;T+=1){const E=n[T],y=T>0?n[T-1]:void 0;v(E,y)}if(f.forEach((T,E)=>{t.fillStyle=E,t.beginPath();for(let y=0;y<T.length;y+=1){const I=T[y],D=U(p,I),M=U(g,I);t.rect(i,D,o,M)}t.fill()}),b.length>0){t.save();const T=this.getCachedColorWithAlpha(u,.15),E=this.getCachedColorWithAlpha(u,0),y=t.createLinearGradient(0,0,0,h);y.addColorStop(0,T),y.addColorStop(1,E),t.fillStyle=y;for(let I=0;I<b.length;I+=1){const D=b[I],M=U(p,D);t.translate(0,M),t.fillRect(i,0,o,h),t.translate(0,-M)}t.restore()}if(C.length>0){t.save();const T=this.getCachedColorWithAlpha(u,0),E=this.getCachedColorWithAlpha(u,.15),y=t.createLinearGradient(0,0,0,h);y.addColorStop(0,T),y.addColorStop(1,E),t.fillStyle=y;for(let I=0;I<C.length;I+=1){const D=C[I],M=U(p,D),x=U(g,D),B=M+x-h;t.translate(0,B),t.fillRect(i,0,o,h),t.translate(0,-B)}t.restore()}}drawMouseColumnHover(t,e){const{mouseX:n,mouseY:s,theme:i,metrics:o}=e;if(n==null||s==null)return;const r=K.getColumnAtX(n,o);if(r==null||i.columnHoverBackgroundColor==null)return;const{visibleColumnWidths:l,visibleColumnXs:a,maxY:c}=o;if(s>c)return;const h=U(a,r),u=U(l,r);t.fillStyle=i.columnHoverBackgroundColor,t.fillRect(h,0,u,c)}drawMouseRowHover(t,e){const{mouseX:n,mouseY:s,theme:i,metrics:o}=e;if(n==null||s==null)return;const{maxX:r}=o;if(n>r||i.rowHoverBackgroundColor==null)return;const l=K.getRowAtY(s,o);l!=null&&this.drawMouseRowHoverForRow(t,e,l)}drawFloatingMouseRowHover(t,e){const{mouseX:n,mouseY:s,theme:i,metrics:o}=e,{maxX:r,floatingTopRowCount:l,floatingBottomRowCount:a,rowCount:c,rowFooterWidth:h}=o;if(n==null||s==null||n>r+h||i.rowHoverBackgroundColor==null)return;const u=K.getRowAtY(s,o);u!=null&&(u<l||c-a<=u)&&this.drawMouseRowHoverForRow(t,e,u)}drawMouseRowHoverForRow(t,e,n){const{metrics:s,selectedRanges:i,theme:o}=e,{visibleRowHeights:r,visibleRowYs:l,maxX:a}=s,c=U(l,n),h=U(r,n);o.rowHoverBackgroundColor!=null&&(t.fillStyle=o.rowHoverBackgroundColor);for(let u=0;u<i.length;u+=1){const{startRow:m,endRow:p}=i[u];if(m!=null&&p!=null&&m<=n&&p>=n){o.selectedRowHoverBackgroundColor!=null&&(t.fillStyle=o.selectedRowHoverBackgroundColor);break}}t.fillRect(0,c,a,h)}drawGridLines(t,e){const{metrics:n,theme:s}=e,{visibleColumns:i,visibleRows:o}=n;this.drawGridLinesForItems(t,e,i,o,s.gridColumnColor,s.gridRowColor)}drawGridLinesForItems(t,e,n,s,i,o){i==null&&o==null||(t.lineWidth=1,t.beginPath(),i!=null&&(t.strokeStyle=i,this.drawGridLinesForColumns(t,e,n)),o!=null&&(t.strokeStyle=o,this.drawGridLinesForRows(t,e,s)),t.stroke())}drawGridLinesForColumns(t,e,n){const{metrics:s}=e,{visibleColumnXs:i,maxY:o}=s;for(let r=0;r<n.length;r+=1){const l=n[r],a=U(i,l)+.5;t.moveTo(a,0),t.lineTo(a,o)}}drawGridLinesForRows(t,e,n){const{metrics:s}=e,{visibleRowYs:i,maxX:o}=s,r=o;for(let l=0;l<n.length;l+=1){const a=n[l],c=U(i,a)+.5;t.moveTo(.5,c),t.lineTo(r-.5,c)}}drawCellBackgrounds(t,e){const{metrics:n}=e,{visibleColumns:s,visibleRows:i}=n;this.drawCellBackgroundsForItems(t,e,s,i)}drawCellBackgroundsForItems(t,e,n,s){t.save();for(let i=0;i<n.length;i+=1){const o=n[i];for(let r=0;r<s.length;r+=1){const l=s[r],a=r+1<s.length?s[r+1]:void 0;this.drawCellBackground(t,e,o,l,a)}}t.restore()}drawCellBackground(t,e,n,s,i){const{metrics:o,model:r,theme:l}=e,{firstColumn:a,modelColumns:c,modelRows:h,visibleColumnXs:u,visibleColumnWidths:m,visibleRowYs:p,visibleRowHeights:g}=o,f=U(h,s),b=U(c,n),C=r.backgroundColorForCell(b,f,l),v=n===a,T=St(r)&&r.hasExpandableRows;if(C!=null){const E=U(u,n)+1,y=U(p,s)+1,I=U(m,n)-1,D=U(g,s)-1;t.fillStyle=C,t.fillRect(E,y,I,D)}v&&T&&this.drawCellRowTreeDepthLines(t,e,s,i)}drawCellContents(t,e){const{metrics:n}=e,{visibleColumns:s}=n;for(let i=0;i<s.length;i+=1){const o=s[i];this.drawColumnCellContents(t,e,o)}}drawColumnCellContents(t,e,n){const{metrics:s}=e,{visibleColumnXs:i,visibleColumnWidths:o,visibleRows:r,height:l}=s,a=U(i,n),c=U(o,n);t.save(),t.beginPath(),t.rect(a,0,c,l),t.clip();for(let h=0;h<r.length;h+=1){const u=r[h];this.drawCellContent(t,e,n,u)}t.restore()}getTextRenderMetrics(t,e,n,s){const{textAlign:i}=t,{metrics:o,model:r,theme:l}=e,{firstColumn:a,visibleColumnXs:c,visibleColumnWidths:h,visibleRowYs:u,visibleRowHeights:m}=o,{cellHorizontalPadding:p,treeDepthIndent:g,treeHorizontalPadding:f}=l,b=U(c,n),C=U(u,s),v=U(h,n),T=U(m,s),E=n===a;let y=0;St(r)&&r.hasExpandableRows&&E&&(y=g*(r.depthForRow(s)+1)+f);const I=v-y;let D=b+p;const M=C+T*.5;return i==="right"?D=b+I-p:i==="center"&&(D=b+I*.5),D+=y,{width:I-p*2,x:D,y:M}}drawCellContent(t,e,n,s,i){var E;const{metrics:o,model:r,theme:l}=e,{firstColumn:a,fontWidths:c,modelColumns:h,modelRows:u,visibleRowHeights:m}=o,{textColor:p}=l,g=U(m,s),f=U(u,s),b=U(h,n),C=i!=null?i:r.textForCell(b,f),v=r.truncationCharForCell(b,f),T=n===a;if(C&&g>0){const y=r.textAlignForCell(b,f)||"left";t.textAlign=y;const I=r.colorForCell(b,f,l)||p;t.fillStyle=I;const{width:D,x:M,y:x}=this.getTextRenderMetrics(t,e,n,s),B=(E=c.get(t.font))!=null?E:rs.DEFAULT_FONT_WIDTH,$=this.getCachedTruncatedString(t,C,D,B,v);$&&t.fillText($,M,x)}T&&St(r)&&r.hasExpandableRows&&this.drawCellRowTreeMarker(t,e,s)}drawCellRowTreeMarker(t,e,n){const{metrics:s,model:i,mouseX:o,mouseY:r,theme:l}=e,{firstColumn:a,gridX:c,gridY:h,visibleColumnXs:u,visibleColumnWidths:m,visibleRowYs:p,visibleRowHeights:g,visibleRowTreeBoxes:f}=s,{treeMarkerColor:b,treeMarkerHoverColor:C}=l,v=U(u,a),T=U(m,a),E=U(p,n),y=U(g,n);if(!St(i)||!i.isRowExpandable(n))return;const I=U(f,n),D=o!=null&&r!=null&&o>=c+v&&o<=c+v+T&&r>=h+E&&r<=h+E+y?C:b;this.drawTreeMarker(t,e,v,E,I,D,i.isRowExpanded(n))}drawTreeMarker(t,e,n,s,i,o,r){const{x1:l,y1:a,x2:c,y2:h}=i,u=r?"\u229F":"\u229E",m=n+(l+c)*.5+.5,p=s+(a+h)*.5+.5;t.fillStyle=o,t.textAlign="center",t.fillText(u,m,p)}drawCellRowTreeDepthLines(t,e,n,s){const{metrics:i,model:o,theme:r}=e;if(!St(o))return;const l=o.depthForRow(n);if(l===0)return;const{firstColumn:a,visibleColumnXs:c,visibleRowYs:h,visibleRowHeights:u}=i,{treeDepthIndent:m,treeHorizontalPadding:p,treeLineColor:g}=r,f=U(c,a),b=U(h,n),C=U(u,n),v=s!==void 0?o.depthForRow(s):0,T=l>v?l-v:0;if(t.strokeStyle=g,t.lineWidth=1,l-T>0){t.beginPath();for(let E=0;E<l-T;E+=1){const y=f+E*m+m*.5+p+.5;t.moveTo(y,b),t.lineTo(y,b+C)}t.stroke()}if(T>0){t.beginPath();for(let E=l-T;E<l;E+=1){const y=f+E*m+m*.5+p+.5;t.moveTo(y,b),t.lineTo(y,b+Math.ceil(C/2)),t.moveTo(y-.5,b+Math.ceil(C/2)+.5),t.lineTo(y+m-.5,b+Math.ceil(C/2)+.5)}t.stroke()}}drawHeaders(t,e){const{theme:n}=e;t.font=n.headerFont,this.drawColumnHeaders(t,e),this.drawRowHeaders(t,e)}drawFooters(t,e){const{theme:n}=e;t.font=n.headerFont,this.drawRowFooters(t,e)}drawColumnHeaders(t,e){const{mouseX:n,mouseY:s,theme:i,metrics:o,draggingColumnSeparator:r,isDragging:l,model:a}=e,{columnHeaderHeight:c,floatingColumns:h,gridX:u,width:m,visibleColumns:p,visibleColumnWidths:g,visibleColumnXs:f,floatingLeftColumnCount:b,floatingLeftWidth:C,floatingRightWidth:v,modelColumns:T,columnHeaderMaxDepth:E}=o;if(c<=0)return;const{headerHiddenSeparatorSize:y,headerHiddenSeparatorHoverColor:I,headerSeparatorColor:D,headerSeparatorHoverColor:M}=i,x=c*.5,B=c*(E-1)+c*.5-x*.5,$=b>0;if(t.save(),this.drawColumnHeadersForRange(t,e,[p[0],p[p.length-1]],{minX:u+C,maxX:m-v}),$&&this.drawColumnHeadersForRange(t,e,[h[0],h[h.length-1]],{minX:u,maxX:u+C}),D){t.strokeStyle=D;const k=[...g.entries()].filter(([H,O])=>O===0).map(([H])=>H);t.beginPath(),t.fillStyle=D;for(let H=0;H<k.length;H+=1){const O=k[H],F=U(f,O),_=U(g,O),L=u+F+_+.5-y*.5;t.rect(L,B,y,x)}t.fill()}if(M){let{index:k,depth:H}=r!=null?r:{};if(k==null&&n!=null&&s!=null){const F=Rl.getColumnSeparator(K.getGridPointFromXY(n,s,o),o,a,i);k=F==null?void 0:F.index,H=F==null?void 0:F.depth}let O;if(k==null)O=!1;else{const F=T.get(k),_=T.get(k+1);F==null||_==null?O=!1:O=a.textForColumnHeader(F,H)!==a.textForColumnHeader(_,H)}if(O&&k!=null&&H!=null&&(!l||r!=null)){t.strokeStyle=M;const F=U(f,k),_=U(g,k),L=u+F+_+.5,V=p.indexOf(k),G=V<p.length-1?p[V+1]:null,j=G!=null?g.get(G):null,ne=_===0,ye=j!=null&&j===0;ne?(t.strokeStyle=I,t.fillStyle=I,t.fillRect(L,B,y*.5,x)):ye&&(t.fillStyle=M,t.fillRect(L-y*.5,B,y*.5,x)),t.beginPath(),t.moveTo(L,(E-H-1)*c),t.lineTo(L,(E-H)*c-1),t.stroke()}}t.restore()}drawColumnHeadersForRange(t,e,n,s){const{model:i}=e,{columnHeaderMaxDepth:o}=i;if(o!==0)for(let r=0;r<=o;r+=1)this.drawColumnHeadersAtDepth(t,e,n,s,r)}drawColumnHeadersAtDepth(t,e,n,s,i){var D,M,x,B,$,k;const{metrics:o,model:r,theme:l}=e,{modelColumns:a,visibleColumnXs:c,gridX:h,calculatedColumnWidths:u,userColumnWidths:m,visibleColumnWidths:p,movedColumns:g}=o,{columnHeaderHeight:f,columnWidth:b}=l,{columnHeaderMaxDepth:C}=r,{minX:v,maxX:T}=s,E=T-v;if(C===0)return;const y=n[0],I=n[1];if(t.save(),t.translate(0,(C-i-1)*f),i===0){this.drawColumnHeader(t,e,"",v,T);for(let H=y;H<=I;H+=1)this.drawColumnHeaderAtIndex(t,e,H,s)}if(i>0){let H=y;for(;H<=I;){const{columnCount:O}=o,F=U(a,H),_=r.textForColumnHeader(F,i),L=r.colorForColumnHeader(F,i);let V=U(c,H)+h,G=V+U(p,H);if(_!=null){let j=H-1;for(;j>=0&&(G-V<E||V>v);){const Te=(D=a.get(j))!=null?D:K.getModelIndex(j,g);if(Te==null||r.textForColumnHeader(Te,i)!==_)break;V-=(x=(M=m.get(Te))!=null?M:u.get(Te))!=null?x:b,j-=1}let ne=H+1;for(;ne<O&&(G-V<E||G<T);){const Te=(B=a.get(ne))!=null?B:K.getModelIndex(ne,g);if(r.textForColumnHeader(Te,i)!==_)break;G+=(k=($=m.get(Te))!=null?$:u.get(Te))!=null?k:b,ne+=1}H=ne-1;const ye=G-V>=E;let le=V;ye&&(G<T?le=G-E:V<v&&(le=v)),this.drawColumnHeader(t,e,_,le,Math.min(G-V,E),{backgroundColor:L!=null?L:void 0},s)}H+=1}}t.restore()}drawColumnHeaderAtIndex(t,e,n,s){var g;const{metrics:i,model:o}=e,{modelColumns:r,visibleColumnWidths:l,visibleColumnXs:a,gridX:c}=i,h=U(l,n),u=U(a,n)+c,m=U(r,n),p=o.textForColumnHeader(m);p!=null&&this.drawColumnHeader(t,e,p,u,h,{backgroundColor:(g=o.colorForColumnHeader(m))!=null?g:void 0},s)}drawColumnHeader(t,e,n,s,i,o,r){var ne;if(i<=0)return;const{metrics:l,theme:a}=e,{headerHorizontalPadding:c,columnHeaderHeight:h,headerBackgroundColor:u,headerColor:m,headerSeparatorColor:p,black:g,white:f}=a,{fontWidths:b,width:C}=l,v=(ne=b.get(t.font))!=null?ne:rs.DEFAULT_FONT_WIDTH,E=(i-c*2)/v,{backgroundColor:y=u,separatorColor:I=p}=o!=null?o:{};let{textColor:D=m}=o!=null?o:{};try{const ye=this.getCachedColorIsDark(y),le=this.getCachedColorIsDark(D);ye&&le?D=f:!ye&&!le&&(D=g)}catch{}let{minX:M=0,maxX:x=C}=r!=null?r:{};t.save(),t.rect(M,0,x-M,h),t.clip(),y!=null&&(t.fillStyle=y,t.fillRect(s,0,i,h)),I!=null&&(t.strokeStyle=I,t.beginPath(),s>0&&(t.moveTo(s+.5,0),t.lineTo(s+.5,h)),t.moveTo(s+i+.5,0),t.lineTo(s+i+.5,h),t.moveTo(s,h-.5),t.lineTo(s+i,h-.5),t.stroke()),t.beginPath(),t.rect(s,0,i,h),t.clip(),t.fillStyle=D;let B=n;E<=0?B="":B.length>E&&(B=`${B.substring(0,E-1)}\u2026`);const $=B.length*v;let k=s+i*.5;const H=h*.5;M+=c,x-=c;const O=s+c,F=Vt(O,M,x),_=s+i-c,V=Vt(_,M,x)-F,G=k-$*.5<M,j=k+$*.5>x;G?$<V?k=M+$*.5:k=_-$*.5:j&&($<V?k=x-$*.5:k=O+$*.5),t.textAlign="center",t.fillText(B,k,H),t.restore()}drawRowHeaders(t,e){const{mouseX:n,mouseY:s,metrics:i,theme:o,draggingRowSeparator:r}=e,{gridY:l,rowHeaderWidth:a,height:c,visibleRows:h,visibleRowHeights:u,visibleRowYs:m}=i;if(a<=0)return;const{headerBackgroundColor:p,headerColor:g,headerHiddenSeparatorSize:f,headerHiddenSeparatorHoverColor:b,headerSeparatorColor:C,headerSeparatorHoverColor:v}=o,T=a*.5,E=a*.5-T*.5;if(t.save(),t.beginPath(),t.fillStyle=p,t.fillRect(0,0,a,c),C){t.strokeStyle=C,t.beginPath(),t.moveTo(0,l+.5),t.lineTo(a,l+.5);const y=[];let I=!1;for(let D=0;D<h.length;D+=1){const M=h[D],x=U(m,M),B=U(u,M);if(B>0){const $=l+x+B+.5;t.moveTo(0,$),t.lineTo(a,$),I=!1}else I||(I=!0,y.push(M))}t.moveTo(a-.5,0),t.lineTo(a-.5,c),t.stroke(),t.beginPath(),t.fillStyle=C;for(let D=0;D<y.length;D+=1){const M=y[D],x=U(m,M),B=U(u,M),$=l+x+B+.5-f*.5;t.rect(E,$,T,f)}t.fill()}if(v){let{index:y=null}=r!=null?r:{};if(y==null&&n!=null&&s!=null&&(y=K.getRowSeparatorIndex(n,s,i,o)),y!=null){t.strokeStyle=v;const I=U(m,y),D=U(u,y),M=l+I+D+.5,x=h.indexOf(y),B=x<h.length-1?h[x+1]:null,$=B!=null?u.get(B):null,k=D===0,H=$!=null&&$===0;k?(t.strokeStyle=b,t.fillStyle=b,t.fillRect(E,M,T,f*.5)):H&&(t.fillStyle=v,t.fillRect(E,M-f*.5,T,f*.5)),t.beginPath(),t.moveTo(.5,M),t.lineTo(a+.5,M),t.stroke()}}t.beginPath(),t.rect(0,l,a,c),t.clip(),t.fillStyle=g,t.textAlign="right";for(let y=0;y<h.length;y+=1){const I=h[y],D=U(u,I),M=U(m,I)+l;this.drawRowHeader(t,e,I,M,D)}t.restore()}drawRowHeader(t,e,n,s,i){if(i<=0)return;const{metrics:o,model:r,theme:l}=e,{modelRows:a,rowHeaderWidth:c}=o,h=U(a,n),u=c-l.cellHorizontalPadding,m=s+i*.5;t.fillText(r.textForRowHeader(h),u,m)}drawRowFooters(t,e){const{mouseX:n,mouseY:s,metrics:i,model:o,theme:r,draggingRowSeparator:l}=e,{gridY:a,gridX:c,maxX:h,modelRows:u,rowFooterWidth:m,height:p,verticalBarWidth:g,visibleRows:f,visibleRowHeights:b,visibleRowYs:C,width:v}=i;if(m<=0)return;const{cellHorizontalPadding:T,headerBackgroundColor:E,headerColor:y,headerHiddenSeparatorSize:I,headerHiddenSeparatorHoverColor:D,headerSeparatorColor:M,headerSeparatorHoverColor:x}=r,B=m*.5,$=m*.5-B*.5,k=Math.min(c+h,v-m-g);if(t.save(),t.beginPath(),t.fillStyle=E,t.fillRect(k,a,m,p),M){t.strokeStyle=M,t.beginPath(),t.moveTo(k,a+.5),t.lineTo(m,a+.5);const O=[];let F=!1;for(let _=0;_<f.length;_+=1){const L=f[_],V=U(C,L),G=U(b,L);if(G>0){const j=a+V+G+.5;t.moveTo(k+.5,j),t.lineTo(k+m-.5,j),F=!1}else F||(F=!0,O.push(L))}t.moveTo(k+.5,a),t.lineTo(k+.5,p),t.stroke(),t.beginPath(),t.fillStyle=M;for(let _=0;_<O.length;_+=1){const L=O[_],V=U(C,L),G=U(b,L),j=a+V+G+.5-I*.5;t.rect(k+$,j,B,I)}t.fill()}if(x){let{index:O=null}=l!=null?l:{};if(O==null&&n!=null&&s!=null&&(O=K.getRowSeparatorIndex(n,s,i,r)),O!=null){t.strokeStyle=x;const F=U(C,O),_=U(b,O),L=a+F+_+.5,V=f.indexOf(O),G=V<f.length-1?f[V+1]:null,j=G!=null?b.get(G):null,ne=_===0,ye=j!=null&&j===0;ne?(t.strokeStyle=D,t.fillStyle=D,t.fillRect($,L,B,I*.5)):ye&&(t.fillStyle=x,t.fillRect($,L-I*.5,B,I*.5)),t.beginPath(),t.moveTo(k+.5,L),t.lineTo(k+m+.5,L),t.stroke()}}t.beginPath(),t.rect(k,a,m,p),t.clip(),t.fillStyle=y,t.textAlign="left";const H=k+T;for(let O=0;O<f.length;O+=1){const F=f[O],_=U(b,F);if(_>0){const L=U(C,F)+a,V=U(u,F),G=L+_*.5;t.fillText(o.textForRowFooter(V),H,G)}}t.restore()}drawSelectedRanges(t,e,n={}){const{cursorColumn:s,cursorRow:i,draggingRow:o,draggingColumn:r,editingCell:l,metrics:a,model:c,selectedRanges:h,theme:u}=e,{visibleColumnWidths:m,visibleColumnXs:p,visibleRowHeights:g,visibleRowYs:f,width:b,height:C}=a,{left:v=a.left,top:T=a.top,right:E=a.right,bottom:y=a.bottom,minY:I=-10,maxY:D=C+10,minX:M=-10,maxX:x=b+10}=n;if(h.length===0)return;const B=nt(c)&&c.isEditable&&l==null&&o==null&&r==null&&s!=null&&i!=null&&p.has(s)&&f.has(i);if(B){const $=U(p,s),k=U(f,i),H=U(m,s),O=U(g,i);t.save(),t.beginPath(),t.rect(0,0,b,C),t.rect($,k,H,O),t.clip("evenodd")}t.beginPath();for(let $=0;$<h.length;$+=1){const k=h[$],H=k.startColumn!==null?k.startColumn:v,O=k.startRow!==null?k.startRow:T,F=k.endColumn!==null?k.endColumn:E,_=k.endRow!==null?k.endRow:y;if(_>=T&&y>=O&&F>=v&&E>=H){const L=H>=v&&p.has(H)?Math.round(U(p,H))+.5:M,V=O>=T&&f.has(O)?Math.max(Math.round(U(f,O))+.5,.5):I,G=F<=E&&p.has(F)?Math.round(U(p,F)+U(m,F))-.5:x,j=_<=y&&f.has(_)?Math.round(U(f,_)+U(g,_))-.5:D;t.rect(L,V,G-L,j-V)}t.fillStyle=u.selectionColor,t.fill(),t.save(),t.clip(),t.strokeStyle=u.selectionOutlineCasingColor,t.lineWidth=3,t.stroke(),t.restore(),t.strokeStyle=u.selectionOutlineColor,t.lineWidth=1,t.stroke()}B&&s!=null&&i!=null&&(t.restore(),this.drawActiveCell(t,e,s,i))}drawActiveCell(t,e,n,s,i=rs.ACTIVE_CELL_BORDER_WIDTH){const{metrics:o,theme:r}=e,{visibleColumnWidths:l,visibleColumnXs:a,visibleRowHeights:c,visibleRowYs:h}=o,u=U(a,n),m=U(h,s),p=U(l,n),g=U(c,s);let f=u-i*.5,b=m-i*.5,C=p+i,v=g+i;f<=0&&(C+=f-1,f=1),b<=0&&(v+=b-1,b=1);const{lineWidth:T}=t;t.beginPath(),t.lineWidth=i,t.strokeStyle=r.selectionOutlineColor,this.drawRoundedRect(t,f,b,C,v),t.stroke(),t.lineWidth=T}drawRoundedRect(t,e,n,s,i,o=rs.DEFAULT_EDGE_RADIUS){t.beginPath(),t.moveTo(e+o,n),t.lineTo(e+s-o,n),t.quadraticCurveTo(e+s,n,e+s,n+o),t.lineTo(e+s,n+i-o),t.quadraticCurveTo(e+s,n+i,e+s-o,n+i),t.lineTo(e+o,n+i),t.quadraticCurveTo(e,n+i,e,n+i-o),t.lineTo(e,n+o),t.quadraticCurveTo(e,n,e+o,n),t.closePath()}drawDraggingColumn(t,e){var j;const{draggingColumn:n,metrics:s,mouseX:i,theme:o,model:r}=e;if(n==null||i==null)return;const{range:l,depth:a}=n,{gridX:c,gridY:h,visibleColumnXs:u,visibleColumnWidths:m,height:p,width:g,columnHeaderMaxDepth:f,columnHeaderHeight:b,movedColumns:C,modelColumns:v,floatingLeftWidth:T}=s,E=(j=v.get(l[0]))!=null?j:K.getModelIndex(l[0],C),y=r.getColumnHeaderGroup(E,a);if(a>0&&!y)return;const[I,D]=l,M=U(u,I),B=U(u,D)+U(m,D)-M,$=n.left,{backgroundColor:k,font:H,headerFont:O,reorderOffset:F,shadowBlur:_,shadowColor:L}=o,V=(f-a-1)*b;t.save(),t.translate(c,0),t.save(),t.beginPath(),t.rect(T,0,g,p),t.clip(),t.fillStyle=k,t.fillRect(M,V,B,p),t.restore(),t.translate(0,F),t.save(),t.shadowColor=L,t.shadowBlur=_,t.fillStyle=k,t.fillRect(n.left,V+F,n.width,p),t.restore(),t.beginPath(),t.rect(n.left,V,n.width+1,p),t.clip(),t.translate($-M,0),t.font=O;const G=[];for(let ne=n.range[0];ne<=n.range[1];ne+=1)G.push(ne);this.drawColumnHeaders(t,e),this.drawColumnHeadersForRange(t,e,[G[0],G[G.length-1]],{minX:M,maxX:g}),t.translate(0,h),t.font=H,this.drawGridBackground(t,e);for(let ne=I;ne<=D;ne+=1)this.drawColumnCellContents(t,e,ne);t.restore()}drawDraggingRow(t,e){const{draggingRow:n,draggingRowOffset:s,metrics:i,mouseY:o,theme:r}=e;if(n==null||o==null)return;const{gridX:l,gridY:a,visibleRowYs:c,visibleRowHeights:h,width:u}=i,m=U(c,n),p=U(h,n)+1,{backgroundColor:g,font:f,headerFont:b,reorderOffset:C,shadowBlur:v,shadowColor:T}=r;t.save(),t.translate(0,a),t.fillStyle=g,t.fillRect(0,m,u,p),t.translate(l+C,o-m-a-(s!=null?s:0)),t.save(),t.shadowColor=T,t.shadowBlur=v,t.fillStyle=g,t.fillRect(-l,m,u,p),t.restore(),t.beginPath(),t.rect(-l,m,u,p),t.clip(),t.font=f,this.drawGridBackground(t,e),this.drawCellContents(t,e),t.translate(-l,-a),t.font=b,this.drawRowHeaders(t,e),t.restore()}drawScrollBars(t,e){const{isDraggingHorizontalScrollBar:n,isDraggingVerticalScrollBar:s,isDragging:i,metrics:o,mouseX:r,mouseY:l,theme:a}=e;if(a.scrollBarSize<=0)return;const{rowHeaderWidth:c,columnHeaderHeight:h,width:u,height:m,handleHeight:p,handleWidth:g,scrollX:f,scrollY:b,hasHorizontalBar:C,hasVerticalBar:v,barWidth:T,barHeight:E}=o,{scrollBarBackgroundColor:y,scrollBarHoverBackgroundColor:I,scrollBarCasingColor:D,scrollBarCornerColor:M,scrollBarColor:x,scrollBarHoverColor:B,scrollBarActiveColor:$,scrollBarSize:k,scrollBarHoverSize:H,scrollBarCasingWidth:O,scrollBarSelectionTick:F,scrollBarSelectionTickColor:_,scrollBarActiveSelectionTickColor:L,autoSelectRow:V,autoSelectColumn:G}=a,j=r!=null&&l!=null&&r<=u&&l<=m,ne=s||v&&!n&&!i&&r!=null&&l!=null&&r>=u-H&&l<=E+h&&j,ye=n||C&&!s&&!i&&!ne&&r!=null&&l!=null&&l>=m-H&&r<=T-c&&j,le=ye?H:k,Te=ne?H:k;if(t.translate(c,h),C&&v&&(t.fillStyle=D,t.fillRect(u-c-k,m-h-k,k,k),t.fillStyle=M,t.fillRect(u-c-k+O,m-h-k+O,k-O,k-O)),C){const He=f,Z=m-h-le;if(t.fillStyle=D,t.fillRect(0,Z,T,le-O),t.fillStyle=ye?I:y,t.fillRect(0,Z+O,T,le-O),n?t.fillStyle=$:ye?t.fillStyle=B:t.fillStyle=x,t.fillRect(He,Z+O,g,le-O),!V&&F&&_!=null&&L!=null){t.fillStyle=_;const{selectedRanges:ge,cursorColumn:be}=e,{lastLeft:Le,columnCount:Oe}=o,jn=[...ge].filter(Ne=>Ne.startColumn!=null&&Ne.endColumn!=null).map(Ne=>[Ne.startColumn,Ne.endColumn]).sort(K.compareRanges),Tn=K.mergeSortedRanges(jn),vt=Ne=>Ne<=Le?Ne/Le*(T-g):T-g+(Ne-Le)/(Oe-Le)*g;for(let Ne=0;Ne<Tn.length;Ne+=1){const rt=Tn[Ne],lt=rt[0],_t=rt[1];if(lt!=null&&_t!=null&&(lt!==be||_t!==be)){const Qt=vt(lt),Zt=Math.max(1,Math.round(vt(_t+1)-Qt)),Lt=le-O;t.fillRect(Qt,Z+O+Math.round(Lt/3),Zt,Math.round(Lt/3))}}if(be!=null){const Ne=vt(be),rt=2,lt=le-O;t.fillStyle=L,t.fillRect(Ne,Z+O,rt,lt)}}}if(v){const He=u-c-Te,Z=b;if(t.fillStyle=D,t.fillRect(He,0,Te-O,E),t.fillStyle=ne?I:y,t.fillRect(He+O,0,Te-O,E),s?t.fillStyle=$:ne?t.fillStyle=B:t.fillStyle=x,t.fillRect(He+O,Z,Te-O,p),!G&&F&&_!=null&&L!=null){const{selectedRanges:ge,cursorRow:be}=e,{lastTop:Le,rowCount:Oe}=o,gn=Ne=>Ne<=Le?Ne/Le*(E-p):E-p+(Ne-Le)/(Oe-Le)*p;t.fillStyle=_;const Tn=[...ge].filter(Ne=>Ne.startRow!=null&&Ne.endRow!=null).map(Ne=>[Ne.startRow,Ne.endRow]).sort(K.compareRanges),vt=K.mergeSortedRanges(Tn);for(let Ne=0;Ne<vt.length;Ne+=1){const rt=vt[Ne],lt=rt[0],_t=rt[1];if(lt!=null&&_t!=null&&(lt!==be||_t!==be)){const Qt=gn(lt),Zt=Te-O,Lt=Math.max(1,Math.round(gn(_t+1)-Qt));t.fillRect(He+O+Math.round(Zt/3),Qt,Math.round(Zt/3),Lt)}}if(be!=null){const Ne=Math.round(gn(be)),rt=Te-O,lt=2;t.fillStyle=L,t.fillRect(He+O,Ne,rt,lt)}}}t.translate(-c,-h)}};let qi=rs;qi.DEFAULT_FONT_WIDTH=10;qi.DEFAULT_EDGE_RADIUS=2;qi.ACTIVE_CELL_BORDER_WIDTH=2;const nh=100;class a0 extends Rt{constructor(){super(...arguments),this.hasExtendedFloating=!1}onDown(e,n,s){const{x:i,y:o,column:r,row:l}=e,{metrics:a}=n;if(!a)throw new Error("metrics not set");const{gridX:c,gridY:h,maxX:u,maxY:m}=a,p=i-c,g=o-h;if(p<0||g<0||r==null&&p>u||l==null&&g>m)return!1;const f=K.isModifierKeyDown(s),b=s.shiftKey;f||(b?n.trimSelectedRanges():n.clearSelectedRanges());const C=n.getTheme(),{autoSelectRow:v,autoSelectColumn:T}=C;return(r!==null||!T)&&(l!==null||!v)&&(n.focus(),n.moveCursorToPosition(r,l,b,!1,b&&f)),this.startPoint=e,this.hasExtendedFloating=!1,this.dragBounds=K.getScrollDragBounds(a,l,r),!0}onDrag(e,n){if(this.startPoint===void 0)return!1;this.stopTimer();const{row:s,column:i}=this.startPoint,{x:o,y:r}=e;let{row:l,column:a}=e;const{metrics:c}=n;if(!c)throw new Error("metrics not set");const{left:h,lastLeft:u,top:m,lastTop:p,columnWidth:g,rowHeight:f}=c,b=K.getScrollDragBounds(c,s,i);let C=0,v=0;if(h<u&&(o<b.x1?C=o-b.x1:o>b.x2&&(C=o-b.x2)),m<p&&(r<b.y1?v=r-b.y1:r>b.y2&&(v=r-b.y2)),C!==0||v!==0)this.startTimer(n,e,C>0?Math.ceil(C/g):Math.floor(C/g),v>0?Math.ceil(v/f):Math.floor(v/f));else if(l!=null&&a!=null){const{floatingTopRowCount:T,floatingBottomRowCount:E,floatingLeftColumnCount:y,floatingRightColumnCount:I,columnCount:D,rowCount:M,bottom:x,right:B,topVisible:$,bottomVisible:k,leftVisible:H,rightVisible:O}=c;this.hasExtendedFloating||(s!==null&&s<T&&l>=T?(l=T,this.hasExtendedFloating=!0):s!==null&&s>=M-E&&l<M-E&&(l=M-E-1,this.hasExtendedFloating=!0),i!==null&&i<y&&a>=y?(a=y,this.hasExtendedFloating=!0):i!==null&&i>=D-I&&a<D-I&&(a=D-I-1,this.hasExtendedFloating=!0)),s!==null&&!K.isFloatingRow(s,c)&&K.isFloatingRow(l,c)&&(s>l&&l<m?l=$-1:s<l&&l>x&&(l=k+1)),i!==null&&!K.isFloatingColumn(i,c)&&K.isFloatingColumn(a,c)&&(i>a&&a<h?a=H-1:i<a&&a>B&&(a=O+1)),n.moveCursorToPosition(a,l,!0,!0)}return!0}onUp(e,n){return this.startPoint!==void 0&&(this.startPoint=void 0,this.dragBounds=void 0,this.stopTimer(),n.commitSelection()),!1}moveSelection(e,n,s,i){const{row:o,column:r}=n,{metrics:l}=e;if(!l)throw new Error("metrics not set");const{selectionEndRow:a,selectionEndColumn:c}=e.state;if(a==null||c==null)throw new Error("selection not set");const{rowCount:h,columnCount:u}=l,m=s<0&&r!=null?r:0,p=s>0&&r!=null?r:u-1,g=i<0&&o!=null?o:0,f=i>0&&o!=null?o:h-1;e.moveCursorToPosition(Math.min(Math.max(m,c+s),p),Math.min(Math.max(g,a+i),f),!0),this.lastTriggerTime=Date.now()}startTimer(e,n,s,i){this.stopTimer();const o=this.lastTriggerTime!=null?nh-Math.min(nh,Date.now()-this.lastTriggerTime):0;this.timer=setTimeout(()=>{this.moveSelection(e,n,s,i),this.startTimer(e,n,s,i)},o)}stopTimer(){this.timer!==void 0&&(clearTimeout(this.timer),this.timer=void 0)}}const sh=5,c0=1e3/60,Sr=10;function Es(t,e,n,s){var T,E,y,I,D,M,x;const{modelColumns:i,movedColumns:o,visibleColumnXs:r,columnCount:l,visibleColumnWidths:a,userColumnWidths:c,calculatedColumnWidths:h,floatingLeftWidth:u,maxX:m}=n;if(e==null||t==null||t>l||t<0)return null;const p=(T=i.get(t))!=null?T:K.getModelIndex(t,o),g=s.getColumnHeaderGroup(p,e),f=g!=null;let b,C,v;if(g!=null){const[B,$]=g.getVisibleRange(o);b=(E=r.get(B))!=null?E:u,C=((y=r.get($))!=null?y:m)+((I=a.get($))!=null?I:0),v=[B,$]}else{const B=r.get(t);if(B==null)return null;b=B,C=b+((x=(M=(D=a.get(t))!=null?D:c.get(p))!=null?M:h.get(p))!=null?x:0),v=[t,t]}return{visibleIndex:t,modelIndex:p,left:b,right:C,width:C-b,isColumnGroup:f,range:v,depth:e}}class d0 extends Rt{constructor(){super(...arguments),this.cursor=null,this.draggingColumn=null}setScrollInterval(e,n){this.scrollingInterval!=null&&n===this.scrollingDirection||(this.scrollingDirection=n,this.scrollingInterval=window.setInterval(()=>{var f,b;const{metrics:s}=e;if(!s)return;const{left:i,lastLeft:o,leftOffset:r,userColumnWidths:l,calculatedColumnWidths:a,movedColumns:c,visibleColumnWidths:h}=s;let u=i,m=r;if(n==="left")for(m-=Sr;m<0;){u-=1;const C=K.getModelIndex(i-1,c),v=(f=l.get(C))!=null?f:a.get(C);v===void 0?m=0:m+=v,u<0&&(m=0,u=0)}else{m+=Sr;let C=h.get(i);for(;C!==void 0&&m>C;){u+=1,m-=C;const v=K.getModelIndex(i+1,c);C=(b=l.get(v))!=null?b:a.get(v),u>o&&(m=0,u=o)}}const{mouseX:p,mouseY:g}=e.state;s==null||p==null||g==null||(this.moveDraggingColumn(p,e,n==="left"?-Sr:Sr),e.setState({left:u,leftOffset:m}),(n==="left"&&u===0&&r===0||n==="right"&&u===o)&&this.clearScrollInterval())},c0))}clearScrollInterval(){this.scrollingDirection=void 0,window.clearInterval(this.scrollingInterval),this.scrollingInterval=void 0}onLeave(){return this.clearScrollInterval(),!1}onDown(e,n){const{model:s}=n.props,{x:i,column:o,columnHeaderDepth:r}=e,{metrics:l}=n;if(!l)throw new Error("Metrics not set");const a=Es(o,r,l,s);if(o==null||a==null||r==null||r>0&&!a.isColumnGroup)return!1;const{rowHeaderWidth:c}=l;return this.initialGridPoint=e,this.draggingColumn=null,this.cursor=null,a.modelIndex!=null&&r!=null&&s.isColumnMovable(a.modelIndex,r)&&(this.draggingOffset=i-a.left-c,this.initialOffset=this.draggingOffset),!1}onDrag(e,n,s){if(this.draggingOffset===void 0||this.initialGridPoint===void 0||this.initialOffset===void 0)return!1;const{x:i,y:o}=e,{columnHeaderDepth:r}=this.initialGridPoint,{model:l}=n.props;let{draggingColumn:a}=this;const{metrics:c}=n;if(!c)throw new Error("Metrics not set");if(!a&&Math.abs(this.initialGridPoint.x-i)<sh&&Math.abs(this.initialGridPoint.y-o)<sh)return!1;if(a==null){const h=Es(this.initialGridPoint.column,r,c,l);if(!h||r==null||!l.isColumnMovable(h.modelIndex)||r>0&&!h.isColumnGroup||h.range[0]==null)return!1;a={range:h.range,depth:r,left:h.left,width:h.width};const u=Es(a.range[0],0,c,l),m=Es(a.range[1],0,c,l);if(!u||!m)return!1;this.draggingColumn=a,n.setState({draggingColumn:a,isDragging:!0})}return this.cursor="move",this.moveDraggingColumn(e.x,n,s.movementX),!0}moveDraggingColumn(e,n,s){var D,M,x,B,$;if(this.draggingOffset===void 0||this.initialGridPoint===void 0||this.initialOffset===void 0||this.draggingColumn==null||s===0)return;if(this.initialOffset!==this.draggingOffset){this.draggingOffset<this.initialOffset&&this.initialOffset<this.draggingOffset+s||this.draggingOffset>this.initialOffset&&this.initialOffset>this.draggingOffset+s?this.draggingOffset=this.initialOffset:this.draggingOffset+=s,this.draggingColumn={...this.draggingColumn,left:e-this.draggingOffset},n.setState({draggingColumn:this.draggingColumn});return}const{depth:i}=this.draggingColumn,{model:o}=n.props,{movedColumns:r}=n.state,{metrics:l}=n;if(!l)throw new Error("Metrics not set");const{floatingLeftWidth:a,width:c,columnHeaderMaxDepth:h,visibleColumnXs:u}=l,m=s<0,p=Es(this.draggingColumn.range[0],i,l,o);if(!p)return;const g=e-this.draggingOffset,f=g+p.width;this.draggingColumn={...this.draggingColumn,left:g},n.setState({draggingColumn:this.draggingColumn});const b=Es(K.getColumnAtX(Vt(m?g:f,a,c),l,!0),i,l,o),C=o.getColumnHeaderParentGroup(p.modelIndex,p.depth);if(!b)return;if(C!==void 0){const k=C.getVisibleRange(r);if(b.visibleIndex<k[0]){const H=this.moveColumn(p,k[0],r);this.draggingOffset=e-((D=u.get(k[0]))!=null?D:0),this.draggingColumn={...this.draggingColumn,left:e-this.draggingOffset},this.clearScrollInterval(),n.setState({draggingColumn:this.draggingColumn,movedColumns:H});return}if(b.visibleIndex>k[1]){const H=this.moveColumn(p,k[1]-(p.range[1]-p.range[0]),r),{right:O=0}=(M=Es(k[1],0,l,o))!=null?M:{};this.draggingOffset=e-(O-p.width),this.draggingColumn={...this.draggingColumn,left:e-this.draggingOffset},this.clearScrollInterval(),n.setState({draggingColumn:this.draggingColumn,movedColumns:H});return}}if(!o.isColumnMovable(b.modelIndex)){let k=b.visibleIndex;if(m)for(k+=1;k<p.visibleIndex&&!o.isColumnMovable(K.getModelIndex(k,r));)k+=1;else for(k-=1;k>p.visibleIndex&&!o.isColumnMovable(K.getModelIndex(k,r));)k-=1;if(k!==p.visibleIndex){m||(k-=p.range[1]-p.range[0]);const O=this.moveColumn(p,k,r);n.setState({movedColumns:O,draggingColumn:this.draggingColumn})}const H=Es(k,0,l,o);m?this.draggingOffset=e-((x=H==null?void 0:H.left)!=null?x:0):this.draggingOffset=e-(((B=H==null?void 0:H.right)!=null?B:0)-p.width),this.draggingColumn={...this.draggingColumn,left:e-this.draggingOffset},n.setState({draggingColumn:this.draggingColumn});return}if(g<=a?this.setScrollInterval(n,"left"):f>c?this.setScrollInterval(n,"right"):this.clearScrollInterval(),b.visibleIndex===p.visibleIndex||m&&p.visibleIndex<b.visibleIndex||!m&&p.visibleIndex>b.visibleIndex)return;const v=b.left+b.width*.5,T=o.getColumnHeaderParentGroup(p.modelIndex,p.depth);let E,y=(($=T==null?void 0:T.depth)!=null?$:h)-1;for(;y>=0&&E===void 0;)E=o.getColumnHeaderGroup(b.modelIndex,y),y-=1;let I;m&&g<v&&(!E||b.visibleIndex===E.getVisibleRange(r)[0])&&(I=this.moveColumn(p,b.range[0],r)),!m&&f>v&&(!E||b.visibleIndex===E.getVisibleRange(r)[1])&&(I=this.moveColumn(p,b.range[1]-(p.range[1]-p.range[0]),r)),I&&(this.draggingColumn={...this.draggingColumn,left:g},n.setState({movedColumns:I,draggingColumn:this.draggingColumn}))}moveColumn(e,n,s){const i=e.isColumnGroup?K.moveRange(e.range,n,s):K.moveItem(e.visibleIndex,n,s),o=n-e.range[0],r=[e.range[0]+o,e.range[1]+o];return this.draggingColumn&&(this.draggingColumn={...this.draggingColumn,range:r}),i}onUp(e,n){return this.cursor=null,this.clearScrollInterval(),this.draggingOffset!=null?(this.draggingOffset=void 0,n.setState({draggingColumn:null,isDragging:!1}),!0):!1}}class vc extends Rt{constructor(){super(...arguments),this.cursor="default"}static getLeftWithOffsetFromRawLeft(e,n){const s=e.getTheme(),{metrics:i,metricCalculator:o}=e;if(!i)throw new Error("metrics not set");if(s.scrollSnapToColumn)return{left:Math.round(n),leftOffset:0};const r=Math.floor(n),l=n-r;let a=i.visibleColumnWidths.get(r);if(a==null){const h=e.getMetricState();a=o.getVisibleColumnWidth(r,h)}const c=a*l;return{left:r,leftOffset:c}}isInScrollBar(e,n){const s=n.getTheme(),{scrollBarSize:i,scrollBarHoverSize:o}=s,{metrics:r}=n;if(!r)throw new Error("metrics not set");const{x:l,y:a}=e,{barLeft:c,barWidth:h,height:u,hasHorizontalBar:m}=r;return m&&i>0&&a>=u-o&&a<u&&l>c&&l<c+h}getLeftWithOffset(e,n){var f;const{metrics:s}=n;if(!s)throw new Error("metrics not set");const{x:i}=e,{barWidth:o,handleWidth:r,lastLeft:l,barLeft:a,columnCount:c,scrollableContentWidth:h,scrollableViewportWidth:u}=s,m=i-a,p=Vt((m-((f=this.dragOffset)!=null?f:0))/(o-r),0,1);if(c===1)return{left:0,leftOffset:p*(h-u)};const g=p*l;return vc.getLeftWithOffsetFromRawLeft(n,g)}onDown(e,n){const{metrics:s}=n;if(!s)throw new Error("metrics not set");const{x:i}=e,{handleWidth:o,barLeft:r,scrollX:l}=s;if(!this.isInScrollBar(e,n))return!1;const a=i-r;if(a>=l&&a<=l+o)this.dragOffset=a-l,n.setState({isDraggingHorizontalScrollBar:!0});else{this.dragOffset=0;const{left:c,leftOffset:h}=this.getLeftWithOffset(e,n);n.setViewState({left:c,leftOffset:h,isDraggingHorizontalScrollBar:!0,isDragging:!0})}return!0}onDrag(e,n){if(this.dragOffset!=null){const{left:s,leftOffset:i}=this.getLeftWithOffset(e,n);return n.setViewState({left:s,leftOffset:i,isDraggingHorizontalScrollBar:!0,isDragging:!0}),!0}return!1}onMove(e,n){return this.isInScrollBar(e,n)}onUp(e,n){return this.dragOffset!==void 0&&(this.dragOffset=void 0,n.setState({isDraggingHorizontalScrollBar:!1,isDragging:!1})),this.isInScrollBar(e,n)}onClick(e,n){return this.isInScrollBar(e,n)}}class h0 extends Rt{constructor(){super(...arguments),this.cursor="move"}onDown(e,n){const{model:s}=n.props,{x:i,y:o,row:r}=e,{metrics:l}=n;if(!l)throw new Error("metrics not set");const{columnHeaderHeight:a,rowHeaderWidth:c,visibleRowYs:h}=l;if(i<=c&&r!==null&&s.isRowMovable(r)){const u=U(h,r);this.draggingOffset=o-u-a,n.setState({draggingRowOffset:this.draggingOffset})}return!1}onDrag(e,n){if(this.draggingOffset==null)return!1;const{model:s}=n.props;let{draggingRow:i}=n.state;const{mouseX:o,mouseY:r}=n.state;if(o==null||r==null)return!1;if(i==null){const{row:I}=n.getGridPointFromXY(o,r);if(I!=null&&!s.isRowMovable(I)||(i=I,n.setState({draggingRow:i,isDragging:!0}),i==null))return!1}const{metrics:l}=n;if(!l)throw new Error("metrics not set");const{top:a,lastTop:c,bottom:h,bottomVisible:u,rowCount:m,columnHeaderHeight:p,visibleRowHeights:g,visibleRowYs:f,height:b}=l;let C=p;if(a<i){const I=i-1;C=U(f,I)+U(g,I)*.5+p}let v=b;if(i<h){const I=i+1;v=U(f,I)+U(g,I)*.5+p}let{movedRows:T}=n.state;r<C&&i>0&&s.isRowMovable(i-1)?(T=K.moveItem(i,i-1,T),i-=1):v<r&&i<m-1&&s.isRowMovable(i+1)&&(T=K.moveItem(i,i+1,T),i+=1),n.setState({movedRows:T,draggingRow:i});const E=p+U(g,a)*.5,y=p+U(f,u)+U(g,u)*.5;return r<E&&a>0?n.setState({top:a-1}):r>y&&a<c&&n.setState({top:a+1}),!0}onUp(e,n){return this.draggingOffset!==void 0?(this.draggingOffset=void 0,n.setState({draggingRowOffset:null,draggingRow:null,isDragging:!1}),!0):!1}}class Tc extends Fm{constructor(){super(...arguments),this.hiddenCursor="s-resize",this.defaultCursor="row-resize",this.pointProperty="y",this.userSizesProperty="userRowHeights",this.visibleOffsetProperty="visibleRowYs",this.visibleSizesProperty="visibleRowHeights",this.marginProperty="columnHeaderHeight",this.calculatedSizesProperty="calculatedRowHeights",this.modelIndexesProperty="modelRows",this.firstIndexProperty="firstRow",this.treePaddingProperty="treePaddingY",this.getHiddenItems=K.getHiddenRows,this.getNextShownItem=K.getNextShownRow,this.getSeparator=Tc.getRowSeparator}static getRowSeparator(e,n,s,i){if(!i.allowRowResize)return null;const{x:o,y:r}=e,l=K.getRowSeparatorIndex(o,r,n,i);return l!=null?{index:l,depth:0}:null}setSize(e,n,s){e.setRowHeight(n,s)}resetSize(e,n){e.resetRowHeight(n)}updateSeparator(e,n){e.setState({draggingRowSeparator:n,isDragging:n!==null})}}class Yr extends Rt{static isInTreeBox(e,n){const{column:s,row:i,x:o,y:r}=e,{metrics:l}=n;if(!l)throw new Error("metrics not set");const{gridX:a,gridY:c,firstColumn:h,visibleColumnXs:u,visibleColumnWidths:m,visibleRowHeights:p,visibleRowYs:g,visibleRowTreeBoxes:f}=l;if(s===h&&i!=null&&f.get(i)!=null&&o>a&&r>c){const b=U(u,s),C=U(m,s),v=U(g,i),T=U(p,i);if(o>=a+b&&o<=a+b+C&&r>=c+v&&r<=c+v+T)return!0}return!1}onDown(e,n){return Yr.isInTreeBox(e,n)}onClick(e,n){if(Yr.isInTreeBox(e,n)){const{row:s}=e;if(s!==null)return n.toggleRowExpanded(s),!0}return!1}}class u0 extends Rt{isInCorner(e,n){const s=n.getTheme(),{scrollBarSize:i}=s,{metrics:o}=n;if(!o)throw new Error("metrics not set");const{x:r,y:l}=e,{width:a,height:c,hasVerticalBar:h,hasHorizontalBar:u}=o;return i>0&&h&&u&&r>=a-i&&l>=c-i&&r<=a&&l<=c}onDown(e,n){return this.isInCorner(e,n)}onUp(e,n){return this.isInCorner(e,n)}onClick(e,n){return this.isInCorner(e,n)}}class Ec extends Rt{constructor(){super(...arguments),this.cursor="default"}static getTopWithOffsetFromRawTop(e,n){const s=e.getTheme(),{metrics:i,metricCalculator:o}=e;if(!i)throw new Error("metrics not set");if(s.scrollSnapToRow)return{top:Math.round(n),topOffset:0};const r=Math.floor(n),l=n-r;let a=i.visibleRowHeights.get(r);if(a==null){const h=e.getMetricState();a=o.getVisibleRowHeight(r,h)}const c=a*l;return{top:r,topOffset:c}}isInScrollBar(e,n){const s=n.getTheme(),{scrollBarSize:i,scrollBarHoverSize:o}=s,{metrics:r}=n;if(!r)throw new Error("metrics not set");const{x:l,y:a}=e,{barTop:c,barHeight:h,width:u,hasVerticalBar:m}=r;return m&&i>0&&l>=u-o&&l<u&&a>c&&a<c+h}getTopWithOffset(e,n){var f;const{metrics:s}=n;if(!s)throw new Error("metrics not set");const{y:i}=e,{barHeight:o,handleHeight:r,lastTop:l,barTop:a,rowCount:c,scrollableContentHeight:h,scrollableViewportHeight:u}=s,m=i-a,p=Vt((m-((f=this.dragOffset)!=null?f:0))/(o-r),0,1);if(c===1)return{top:0,topOffset:p*(h-u)};const g=p*l;return Ec.getTopWithOffsetFromRawTop(n,g)}onDown(e,n){const{metrics:s}=n;if(!s)throw new Error("metrics not set");const{y:i}=e,{handleHeight:o,barTop:r,scrollY:l}=s;if(!this.isInScrollBar(e,n))return!1;const a=i-r;if(a>=l&&a<=l+o)this.dragOffset=a-l,n.setState({isDraggingVerticalScrollBar:!0});else{this.dragOffset=0;const{top:c,topOffset:h}=this.getTopWithOffset(e,n);n.setViewState({top:c,topOffset:h,isDraggingVerticalScrollBar:!0,isDragging:!0})}return!0}onMove(e,n){return this.isInScrollBar(e,n)}onDrag(e,n){if(this.dragOffset!=null){const{top:s,topOffset:i}=this.getTopWithOffset(e,n);return n.setViewState({top:s,topOffset:i,isDraggingVerticalScrollBar:!0,isDragging:!0}),!0}return!1}onUp(e,n){return this.dragOffset!==void 0&&(this.dragOffset=void 0,n.setState({isDraggingVerticalScrollBar:!1,isDragging:!1})),this.isInScrollBar(e,n)}onClick(e,n){return this.isInScrollBar(e,n)}}class m0 extends Rt{onDoubleClick({column:e,row:n},s){const{model:i}=s.props;return nt(i)&&e!=null&&n!=null&&i.isEditableRange(oe.makeCell(e,n))?(s.startEditing(e,n),!0):!1}}class vi{constructor(e=5e3){this.order=e}onDown(e,n){return!1}}class p0 extends vi{onDown(e,n){switch(e.key){case"a":if(K.isModifierKeyDown(e))return n.selectAll(),!0;break;case"ArrowUp":return this.handleArrowMove(0,-1,e,n);case"ArrowDown":return this.handleArrowMove(0,1,e,n);case"ArrowRight":return this.handleArrowMove(1,0,e,n);case"ArrowLeft":return this.handleArrowMove(-1,0,e,n);case"k":case"K":return K.isModifierKeyDown(e)?!1:this.handlePageUp(e,n);case"j":case"J":return K.isModifierKeyDown(e)?!1:this.handlePageDown(e,n);case"h":case"H":return K.isModifierKeyDown(e)?!1:(e.shiftKey||n.clearSelectedRanges(),n.moveCursorToPosition(0,n.state.cursorRow,e.shiftKey),!0);case"l":case"L":{if(K.isModifierKeyDown(e))return!1;const{model:s}=n.props,{columnCount:i}=s;return e.shiftKey||n.clearSelectedRanges(),n.moveCursorToPosition(i-1,n.state.cursorRow,e.shiftKey),!0}case"PageDown":return this.handlePageDown(e,n);case"PageUp":return this.handlePageUp(e,n);case"Home":return e.shiftKey||n.clearSelectedRanges(),n.moveCursorToPosition(K.isModifierKeyDown(e)?n.state.cursorColumn:0,K.isModifierKeyDown(e)?0:n.state.cursorRow,e.shiftKey,!0,!0),!0;case"End":{const{model:s}=n.props,{columnCount:i,rowCount:o}=s;return e.shiftKey||n.clearSelectedRanges(),n.moveCursorToPosition(K.isModifierKeyDown(e)?n.state.cursorColumn:i-1,K.isModifierKeyDown(e)?o-1:n.state.cursorRow,e.shiftKey,!0,!0),!0}case"Escape":return n.clearSelectedRanges(),!0;case"Enter":if(n.state.selectedRanges.length>0)return n.moveCursorInDirection(e.shiftKey?oe.SELECTION_DIRECTION.UP:oe.SELECTION_DIRECTION.DOWN),!0;break;case"Tab":if(n.state.selectedRanges.length>0)return n.moveCursorInDirection(e.shiftKey?oe.SELECTION_DIRECTION.LEFT:oe.SELECTION_DIRECTION.RIGHT),!0;break}return!1}handleArrowMove(e,n,s,i){const o=s.shiftKey,r=K.isModifierKeyDown(s);o?i.trimSelectedRanges():i.clearSelectedRanges();const{cursorRow:l,cursorColumn:a,selectionEndColumn:c,selectionEndRow:h}=i.state,u=o?c:a,m=o?h:l;if(r){const{model:p}=i.props,{columnCount:g,rowCount:f}=p,b=r&&o;let C=null,v=null;e<0?(C=0,v=m):e>0?(C=g-1,v=m):n<0?(C=u,v=0):n>0&&(C=u,v=f-1),C!=null&&v!=null&&i.moveCursorToPosition(C,v,o,!0,b)}else{if(!i.metrics)throw new Error("grid.metrics are not set");const{theme:p}=i.props,{autoSelectRow:g=!1,autoSelectColumn:f=!1}=p;if(g&&e!==0){const{lastLeft:b}=i.metrics;let{left:C}=i.state;C=Vt(C+e,0,b),i.moveCursorToPosition(C,l,o,!1),i.setViewState({left:C})}else if(f&&n!==0){const{lastTop:b}=i.metrics;let{top:C}=i.state;C=Vt(C+n,0,b),i.moveCursorToPosition(C,a,o,!1),i.setViewState({top:C})}else i.moveCursor(e,n,o)}return!0}handlePageUp(e,n){const s=e.shiftKey;s?n.trimSelectedRanges():n.clearSelectedRanges();const{cursorColumn:i,selectionEndRow:o}=n.state,r=o,l=i;if(r==null)return!1;const a=n.getMetricState(),{metricCalculator:c}=n,{bottomVisible:h,topVisible:u,hasHorizontalBar:m}=c.getMetrics(a);let p=r-(h-u);p-=m?0:1,p=Math.max(p,0);const g=Math.max(p-(r-u),0);return n.moveCursorToPosition(l,p,s,!1),n.setViewState({top:g}),!0}handlePageDown(e,n){const s=e.shiftKey;s?n.trimSelectedRanges():n.clearSelectedRanges();const{selectionEndRow:i,cursorColumn:o}=n.state,r=i,l=o;if(r===null)return!1;const a=n.getMetricState(),{metricCalculator:c}=n,{bottomVisible:h,topVisible:u,hasHorizontalBar:m,rowCount:p,lastTop:g}=c.getMetrics(a),f=p-1;let b=h-u+r;b+=m?0:1,b=Math.min(b,f);const C=Math.min(g,b-(r-u));return n.moveCursorToPosition(l,b,s,!1),n.setViewState({top:C}),!0}}class g0 extends vi{onDown(e,n){switch(e.key){case"Enter":case" ":return this.handleExpandKey(e,n)}return!1}handleExpandKey(e,n){const{selectedRanges:s}=n.state;if(s.length===1){const i=s[0];if(i.startRow===i.endRow&&i.startColumn===i.endColumn){if(!n.metrics)throw new Error("grid.metrics not set");const{model:o}=n.props,{startRow:r,startColumn:l}=i;if(r!=null){const a=n.getModelRow(r);if((l===0||l==null)&&St(o)&&o.isRowExpandable(a))return n.toggleRowExpanded(r),!0}}}return!1}}class f0 extends vi{onDown(e,n){if(K.isModifierKeyDown(e))return!1;const{model:s}=n.props,{cursorColumn:i,cursorRow:o}=n.state;if(i==null||o==null||!nt(s)||!s.isEditableRange(oe.makeCell(i,o)))return!1;const r=i,l=o;return r==null||l==null?!1:e.key.length===1?(n.startEditing(r,l,!0,[1,1],e.key),!0):e.key==="F2"?(n.startEditing(r,l),!0):e.key==="Backspace"?(n.startEditing(r,l,!0,void 0,""),!0):e.key==="Delete"?(n.setValueForCell(r,l,""),!0):!1}}function C0(t){var s,i;const e=[],n=t.querySelectorAll("tr");for(let o=0;o<n.length;o+=1){const l=n[o].querySelectorAll("td"),a=[];for(let c=0;c<l.length;c+=1){const h=l[c];a.push((i=(s=h.textContent)==null?void 0:s.trim())!=null?i:"")}e.push(a)}return e}function b0(t){const e=[];return t.forEach(n=>{var i;const s=(i=n.textContent)!=null?i:"";s.length>0&&e.push(s.split(/\t|\u00a0\u00a0 \u00a0/))}),e}function S0(t){var s,i;const e=t.querySelector("table");if(e!=null)return C0(e);const n=(i=(s=t.textContent)==null?void 0:s.trim())!=null?i:"";if(n.length>0){const{childNodes:o}=t,r=n.includes(" "),l=n.includes("\xA0\xA0 \xA0");return r&&o.length!==0&&(o.length===1||o.length>1&&(o[0].textContent==null||!o[0].textContent.includes(" ")))?n.split(`
23
+ `).map(a=>a.split(" ")):o.length>1||l?b0(t.childNodes):n}return null}class w0 extends vi{onDown(e,n){switch(e.key){case"v":if(K.isModifierKeyDown(e)){const s=document.createElement("div");document.body.appendChild(s),s.setAttribute("contenteditable","true"),s.setAttribute("style",'clip-path: "inset(50%)"; height: 1px; width: 1px; margin: -1px; overflow: hidden; padding 0; position: absolute;');const i=()=>{s.removeEventListener("input",i),s.remove(),n.focus();const o=S0(s);o!=null&&n.pasteValue(o)};return s.addEventListener("input",i),s.focus(),{preventDefault:!1,stopPropagation:!0}}break}return!1}}const v0=t=>{switch(t){case"ArrowDown":return Nn.DOWN;case"ArrowUp":return Nn.UP;case"ArrowLeft":return Nn.LEFT;case"ArrowRight":return Nn.RIGHT;default:return}},yc=({selectionRange:t=void 0,className:e="",disabled:n=!1,value:s="",isQuickEdit:i=!0,onChange:o=()=>{},onCancel:r=()=>{},onDone:l=()=>{},onContextMenu:a=()=>{},style:c={}})=>{const h=S.exports.useRef(null),u=S.exports.useRef(!1),[m]=S.exports.useState(s),[p,g]=S.exports.useState(!1),[f,b]=S.exports.useState(i),[C,v]=S.exports.useState(s);S.exports.useEffect(function(){const{current:k}=h;k!=null&&(k.focus(),t?k.setSelectionRange(t[0],t[1]):k.setSelectionRange(k.value.length,k.value.length))},[t]);const T=S.exports.useCallback($=>{o($)},[o]),E=S.exports.useCallback($=>{const{value:k}=$.target;v(k),g(!0),T(k)},[T,v,g]),y=S.exports.useCallback(()=>{u.current=!0,p&&T(m),g(!1),r()},[m,p,r,T]),I=S.exports.useCallback(()=>{b(!1)},[b]),D=S.exports.useCallback(($,k=!1)=>{l(C,{direction:$,fillRange:k})},[l,C]),M=S.exports.useCallback(()=>{u.current||D(null)},[u,D]),x=S.exports.useCallback($=>{switch($.stopPropagation(),$.key){case"Escape":$.preventDefault(),y();break;case"Enter":if($.preventDefault(),K.isModifierKeyDown($))D(void 0,!0);else if($.altKey){const k=`${C}
24
+ `;v(k),g(!0),T(k)}else D($.shiftKey?Nn.UP:Nn.DOWN);break;case"Tab":$.preventDefault(),D($.shiftKey?Nn.LEFT:Nn.RIGHT);break;case"ArrowDown":case"ArrowUp":case"ArrowLeft":case"ArrowRight":f&&($.preventDefault(),D(v0($.key)));break}},[y,D,f,v,g,T,C]),B=S.exports.useCallback($=>{a($)},[a]);return d("textarea",{ref:h,className:W("grid-cell-input-field",e),value:C,onBlur:M,onChange:E,onKeyDown:x,onContextMenu:B,onClick:I,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:"false",disabled:n,style:c})};yc.propTypes={selectionRange:R.exports.arrayOf(R.exports.number),className:R.exports.string,disabled:R.exports.bool,isQuickEdit:R.exports.bool,value:R.exports.string,onChange:R.exports.func,onCancel:R.exports.func,onDone:R.exports.func,onContextMenu:R.exports.func,style:R.exports.shape({})};yc.defaultProps={selectionRange:null,className:"",disabled:!1,value:"",isQuickEdit:!0,onChange:()=>{},onCancel:()=>{},onDone:()=>{},onContextMenu:()=>{},style:{}};const T0=Y.createContext({}),Zs=class extends S.exports.PureComponent{constructor(t){super(t),this.getCachedKeyHandlers=Ce(l=>[...l,...this.keyHandlers].sort((a,c)=>a.order-c.order)),this.getCachedMouseHandlers=Ce(l=>[...l,...this.mouseHandlers].sort((a,c)=>a.order-c.order)),this.handleClick=this.handleClick.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleEditCellCancel=this.handleEditCellCancel.bind(this),this.handleEditCellChange=this.handleEditCellChange.bind(this),this.handleEditCellCommit=this.handleEditCellCommit.bind(this),this.handleDoubleClick=this.handleDoubleClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseDrag=this.handleMouseDrag.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.handleResize=this.handleResize.bind(this),this.handleWheel=this.handleWheel.bind(this);const{isStuckToBottom:e,isStuckToRight:n,metricCalculator:s,movedColumns:i,movedRows:o,renderer:r}=t;this.renderer=r||new qi,this.metricCalculator=s||new Go,this.canvas=null,this.canvasContext=null,this.animationFrame=null,this.prevMetrics=null,this.metrics=null,this.documentCursor=null,this.dragTimer=null,this.keyHandlers=[new f0(400),new w0(450),new p0(500),new g0(900)],this.mouseHandlers=[new Tc(100),new Rl(200),new h0(300),new d0(400),new m0(450),new Ec(500),new vc(600),new u0(700),new Yr(800),new a0(900)],this.state={top:0,left:0,topOffset:0,leftOffset:0,draggingColumn:null,draggingRow:null,draggingRowOffset:null,draggingColumnSeparator:null,draggingRowSeparator:null,isDraggingHorizontalScrollBar:!1,isDraggingVerticalScrollBar:!1,isDragging:!1,mouseX:null,mouseY:null,movedColumns:i,movedRows:o,cursorRow:null,cursorColumn:null,selectionStartRow:null,selectionStartColumn:null,selectionEndRow:null,selectionEndColumn:null,selectedRanges:[],lastSelectedRanges:[],cursor:null,editingCell:null,isStuckToBottom:e,isStuckToRight:n}}static getScale(t){const e=window.devicePixelRatio||1,n=t,s=n.webkitBackingStorePixelRatio||n.mozBackingStorePixelRatio||n.msBackingStorePixelRatio||n.oBackingStorePixelRatio||n.backingStorePixelRatio||1;return e/s}static getCursorClassName(t){return t!=null&&t!==""?`grid-cursor-${t}`:null}componentDidMount(){var t;this.initContext(),(t=this.canvas)==null||t.addEventListener("wheel",this.handleWheel,{passive:!1}),window.addEventListener("resize",this.handleResize),this.updateCanvasScale(),this.updateCanvas()}componentDidUpdate(t,e){const{isStickyBottom:n,isStickyRight:s,movedColumns:i,movedRows:o,onMovedColumnsChanged:r,onMoveColumnComplete:l,onMovedRowsChanged:a,onMoveRowComplete:c}=this.props,{isStickyBottom:h,isStickyRight:u,movedColumns:m,movedRows:p}=t,{movedColumns:g,movedRows:f}=e,{draggingColumn:b,draggingRow:C,movedColumns:v,movedRows:T}=this.state;if(m!==i&&this.setState({movedColumns:i}),p!==o&&this.setState({movedRows:o}),g!==v&&r(v),e.draggingColumn!=null&&b==null&&l(v),f!==T&&a(T),e.draggingRow!=null&&C==null&&c(T),n!==h&&this.setState({isStuckToBottom:!1}),s!==u&&this.setState({isStuckToRight:!1}),this.updateMetrics(),this.requestUpdateCanvas(),!this.metrics||!this.prevMetrics)return;const{bottomVisible:E,rightVisible:y,rowCount:I,columnCount:D,top:M,left:x,height:B,width:$}=this.metrics,{rowCount:k,columnCount:H,height:O,width:F}=this.prevMetrics,_=this.getMetricState();if(k!==I||B!==O){const L=this.metricCalculator.getLastTop(_),{isStuckToBottom:V}=this.state;(V&&E<I-1&&E>0||M>L)&&this.setState({top:L})}if(H!==D||$!==F){const L=this.metricCalculator.getLastLeft(_),{isStuckToRight:V}=this.state;(V&&y<D-1&&y>0||x>L)&&this.setState({left:L})}this.validateSelection()&&this.checkSelectionChange(e)}componentWillUnmount(){var t;this.animationFrame!=null&&cancelAnimationFrame(this.animationFrame),(t=this.canvas)==null||t.removeEventListener("wheel",this.handleWheel),window.removeEventListener("mousemove",this.handleMouseDrag,!0),window.removeEventListener("mouseup",this.handleMouseUp,!0),window.removeEventListener("resize",this.handleResize),this.stopDragTimer()}getTheme(){const{theme:t}=this.props;return Zs.getTheme(this.context,t)}getGridPointFromEvent(t){Zd(this.canvas);const e=this.canvas.getBoundingClientRect(),n=t.clientX-e.left,s=t.clientY-e.top;return this.getGridPointFromXY(n,s)}getGridPointFromXY(t,e){if(!this.metrics)throw new Error("metrics must be set");return K.getGridPointFromXY(t,e,this.metrics)}getMetricState(t=this.state){const e=this.getTheme(),{model:n,stateOverride:s}=this.props;if(!this.canvasContext||!this.canvas)throw new Error("Canvas and context must be defined to get metrics");const i=this.canvasContext,o=this.canvas.clientWidth,r=this.canvas.clientHeight,{left:l,top:a,leftOffset:c,topOffset:h,movedColumns:u,movedRows:m,isDraggingHorizontalScrollBar:p,isDraggingVerticalScrollBar:g,draggingColumn:f}=t;return{left:l,top:a,leftOffset:c,topOffset:h,width:o,height:r,context:i,theme:e,model:n,movedColumns:u,movedRows:m,isDraggingHorizontalScrollBar:p,isDraggingVerticalScrollBar:g,draggingColumn:f,...s}}getKeyHandlers(){const{keyHandlers:t}=this.props;return this.getCachedKeyHandlers(t)}getMouseHandlers(){const{mouseHandlers:t}=this.props;return this.getCachedMouseHandlers(t)}getModelColumn(t){var n,s;const e=(s=(n=this.metrics)==null?void 0:n.modelColumns)==null?void 0:s.get(t);if(e===void 0)throw new Error(`Unable to get ModelIndex for column ${t}`);return e}getModelRow(t){var n,s;const e=(s=(n=this.metrics)==null?void 0:n.modelRows)==null?void 0:s.get(t);if(e===void 0)throw new Error(`Unable to get ModelIndex for row ${t}`);return e}toggleRowExpanded(t){const e=this.getModelRow(t),{model:n}=this.props;St(n)&&n.isRowExpandable(e)&&n.setRowExpanded(e,!n.isRowExpanded(e)),this.clearSelectedRanges(),this.commitSelection(),this.moveCursorToPosition(0,t),this.commitSelection(),this.setState({isStuckToBottom:!1})}setSelectedRanges(t){const{model:e}=this.props,{columnCount:n,rowCount:s}=e,{cursorRow:i,cursorColumn:o,selectedRanges:r}=this.state;if(this.setState({selectedRanges:t,lastSelectedRanges:r}),t.length>0){const l=oe.boundedRange(t[0],n,s);let a=i,c=o;l.containsCell(o,i)||({row:a,column:c}=l.startCell()),this.setState({selectionStartColumn:l.startColumn,selectionStartRow:l.startRow,selectionEndColumn:l.endColumn,selectionEndRow:l.endRow,cursorColumn:c,cursorRow:a})}}initContext(){const{canvas:t}=this,{canvasOptions:e}=this.props;if(!t)throw new Error("Canvas not set");this.canvasContext=t.getContext("2d",e)}requestUpdateCanvas(){this.animationFrame==null&&(this.animationFrame=requestAnimationFrame(()=>{if(this.animationFrame=null,!this.metrics)throw new Error("Metrics not set");this.updateCanvas(this.metrics)}))}updateCanvas(t=this.updateMetrics()){this.updateCanvasScale();const{onViewChanged:e}=this.props;e(t),this.drawCanvas(t)}updateCanvasScale(){const{canvas:t,canvasContext:e}=this;if(!t)throw new Error("canvas not set");if(!e)throw new Error("canvasContext not set");if(!t.parentElement)throw new Error("Canvas has no parent element");const n=Zs.getScale(e),s=t.parentElement.getBoundingClientRect(),i=Math.floor(s.width),o=Math.floor(s.height);t.style.width=`${i}px`,t.style.height=`${o}px`,t.width=i*n,t.height=o*n,e.scale(n,n)}updateMetrics(t=this.state){this.prevMetrics=this.metrics;const{metricCalculator:e}=this,n=this.getMetricState(t);return this.metrics=e.getMetrics(n),this.metrics}checkSelectionChange(t){const{selectedRanges:e}=t,{selectedRanges:n}=this.state;if(n!==e){const{onSelectionChanged:s}=this.props;s(n)}}validateSelection(){const{model:t}=this.props,{selectedRanges:e}=this.state,{columnCount:n,rowCount:s}=t;for(let i=0;i<e.length;i+=1){const o=e[i];if(o.endColumn!=null&&o.endColumn>=n||o.endRow!=null&&o.endRow>=s)return this.setState({selectedRanges:[],lastSelectedRanges:[]}),!1}return!0}clearSelectedRanges(){const{selectedRanges:t}=this.state;this.setState({selectedRanges:[],lastSelectedRanges:t})}trimSelectedRanges(){const{selectedRanges:t}=this.state;t.length>0&&this.setState({selectedRanges:t.slice(t.length-1)})}beginSelection(t,e){this.setState({selectionStartColumn:t,selectionStartRow:e,selectionEndColumn:t,selectionEndRow:e,cursorColumn:t,cursorRow:e})}moveSelection(t,e,n=!1,s=!1){this.setState(i=>{var g,f,b,C;const{selectedRanges:o,selectionStartRow:r,selectionStartColumn:l}=i,{theme:a}=this.props,{autoSelectRow:c,autoSelectColumn:h}=a;if(n&&o.length>0){const v=o[o.length-1];let T=null,E=null,y=null,I=null;s?(T=c!==void 0&&c?null:Math.min(t!=null?t:0,(g=v.startColumn)!=null?g:0),E=h!==void 0&&h?null:Math.min(e!=null?e:0,(f=v.startRow)!=null?f:0),y=c!==void 0&&c?null:Math.max(t!=null?t:0,(b=v.endColumn)!=null?b:0),I=h!==void 0&&h?null:Math.max(e!=null?e:0,(C=v.endRow)!=null?C:0)):(T=v.startColumn,E=v.startRow,(l!=null||r!=null)&&((c===void 0||!c)&&(T=l),(h===void 0||!h)&&(E=r)),y=c!==void 0&&c?null:t,I=h!==void 0&&h?null:e);const D=oe.makeNormalized(T,E,y,I);if(v.equals(D))return null;const M=[...o];return M[M.length-1]=D,{selectedRanges:M,selectionEndColumn:t,selectionEndRow:e}}const u=[...o],m=c!==void 0&&c?null:t,p=h!==void 0&&h?null:e;return u.push(oe.makeNormalized(m,p,m,p)),{selectedRanges:u,selectionEndColumn:t,selectionEndRow:e}})}commitSelection(){this.setState(t=>{const{theme:e}=this.props,{autoSelectRow:n}=e,{selectedRanges:s,lastSelectedRanges:i,cursorRow:o,cursorColumn:r}=t;if(s.length===1&&(n!==void 0&&n?oe.rowCount(s)===1:oe.cellCount(s)===1)&&oe.rangeArraysEqual(s,i))return{selectedRanges:[],lastSelectedRanges:[],cursorColumn:r,cursorRow:o};let l=s.slice();if(l.length>1){const h=l[l.length-1];for(let u=0;u<l.length-1;u+=1){const m=l[u];if(m.contains(h)){const p=m.subtract(h);l.pop(),l.splice(u,1),l=l.concat(p);break}}l=oe.consolidate(l)}let a=r,c=o;if(!oe.containsCell(l,r,o)){const{model:h}=this.props,{columnCount:u,rowCount:m}=h,p=oe.nextCell(oe.boundedRanges(s,u,m));p!=null?{column:a,row:c}=p:(a=null,c=null)}return{cursorRow:c,cursorColumn:a,selectedRanges:l,lastSelectedRanges:s}})}setFocusRow(t){var u;if(!this.metrics||!this.prevMetrics)return;const{gridY:e,height:n,lastTop:s,userRowHeights:i,rowHeight:o}=this.metrics,r=n-e,l=Math.round(r/2)+((u=i.get(t))!=null?u:o),a=this.getMetricState(),c=this.metricCalculator.getLastTop(a,t+1,l);this.setState({top:Math.min(s,c),selectedRanges:[new oe(null,t,null,t)]});const{cursorColumn:h}=this.state;this.moveCursorToPosition(h,t,!1,!1)}selectAll(){const{model:t,theme:e}=this.props,{autoSelectRow:n,autoSelectColumn:s}=e,i=s!==void 0&&s?null:0,o=s!==void 0&&s?null:t.rowCount-1,r=n!==void 0&&n?null:0,l=n!==void 0&&n?null:t.columnCount-1;this.setSelectedRanges([new oe(r,i,l,o)])}moveCursor(t,e,n){const{cursorRow:s,cursorColumn:i,selectionEndColumn:o,selectionEndRow:r}=this.state,l=n?o:i,a=n?r:s;if(a===null||l===null){const{left:c,top:h}=this.state;this.moveCursorToPosition(c,h,n)}else{const{model:c}=this.props,{columnCount:h,rowCount:u}=c,m=Vt(l+t,0,h-1),p=Vt(a+e,0,u-1);this.moveCursorToPosition(m,p,n)}}moveCursorInDirection(t=oe.SELECTION_DIRECTION.DOWN){var c;const{model:e}=this.props,{columnCount:n,rowCount:s}=e,{cursorRow:i,cursorColumn:o,selectedRanges:r}=this.state,l=r.length>0?r:[oe.makeCell(o,i)];let a=null;if(l.length===1&&oe.cellCount(l)===1){const h=new oe(0,0,n-1,s-1);a=(c=h.nextCell(o,i,t))!=null?c:h.startCell(t)}else a=oe.nextCell(oe.boundedRanges(l,n,s),o,i,t);if(a!=null){const{column:h,row:u}=a;this.setState({cursorColumn:h,cursorRow:u}),oe.containsCell(r,h,u)||this.setState({selectedRanges:[oe.makeCell(h,u)],selectionStartColumn:h,selectionStartRow:u,selectionEndColumn:h,selectionEndRow:u}),this.moveViewToCell(a.column,a.row)}}moveCursorToPosition(t,e,n=!1,s=!0,i=!1){n||this.beginSelection(t,e),this.moveSelection(t,e,n,i),s&&this.moveViewToCell(t,e)}moveViewToCell(t,e){if(!this.metrics)throw new Error("metrics not set");const{metricCalculator:n}=this,{bottomVisible:s,rightVisible:i,topVisible:o,leftVisible:r}=this.metrics,l=this.getMetricState(this.state);let{top:a,left:c,topOffset:h,leftOffset:u}=this.state;e!=null&&!K.isFloatingRow(e,this.metrics)&&(e<o?(a=n.getTopForTopVisible(l,e),h=0):e>s&&(a=n.getTopForBottomVisible(l,e),h=0)),t!=null&&!K.isFloatingColumn(t,this.metrics)&&(t<r?(c=n.getLeftForLeftVisible(l,t),u=0):t>i&&(c=n.getLeftForRightVisible(l,t),u=0)),this.setViewState({top:a,left:c,topOffset:h,leftOffset:u})}setViewState(t,e=!1){if(!this.metrics)throw new Error("metrics not set");const{isStickyBottom:n,isStickyRight:s}=this.props,{top:i,left:o}=t,{lastTop:r,lastLeft:l}=this.metrics;i!=null&&this.setState({isStuckToBottom:n&&i>=r}),o!=null&&this.setState({isStuckToRight:s&&o>=l}),this.setState(t),e&&this.forceUpdate()}startEditing(t,e,n=!1,s,i){const{model:o}=this.props;if(!nt(o))throw new Error("model is not editable");const r=this.getModelColumn(t),l=this.getModelRow(e),a={column:t,row:e,selectionRange:s,value:i!==void 0?i:o.editValueForCell(r,l),isQuickEdit:n};this.setState({editingCell:a,cursorColumn:t,cursorRow:e}),this.moveViewToCell(t,e)}isValidForCell(t,e,n){const{model:s}=this.props,i=this.getModelColumn(t),o=this.getModelRow(e);return nt(s)&&s.isValidForCell(i,o,n)}async pasteValue(t){const{model:e}=this.props,{movedColumns:n,movedRows:s,selectedRanges:i}=this.state;try{if(Jd(e),!e.isEditable||!i.every(u=>e.isEditableRange(u)))throw new ia("Can't paste in to read-only area.");if(i.length<=0)throw new ia("Select an area to paste to.");if(typeof t=="string"){const u=[],m=K.getModelRanges(i,n,s);oe.forEachCell(m,(p,g)=>{u.push({column:p,row:g,text:t})}),await e.setValues(u);return}const o=t.length,r=t[0].length,{columnCount:l,rowCount:a}=e;let c=i;if(c.every(u=>{var m,p;return oe.cellCount([u])===1&&((m=u.startColumn)!=null?m:0)+r<=l&&((p=u.startRow)!=null?p:0)+o<=a})&&(c=c.map(u=>{var m,p;return new oe(u.startColumn,u.startRow,((m=u.startColumn)!=null?m:0)+r-1,((p=u.startRow)!=null?p:0)+o-1)}),this.setSelectedRanges(c)),!c.every(u=>oe.rowCount([u])===o&&oe.columnCount([u])===r))throw new ia("Copy and paste area are not same size.");const h=[];c.forEach(u=>{var m,p;for(let g=0;g<r;g+=1)for(let f=0;f<o;f+=1)h.push({column:((m=u.startColumn)!=null?m:0)+g,row:((p=u.startRow)!=null?p:0)+f,text:t[f][g]})}),await e.setValues(h)}catch(o){const{onError:r}=this.props;r(o instanceof Error?o:new Error(`${o}`))}}setValueForCell(t,e,n){const{model:s}=this.props;Jd(s);const i=this.getModelColumn(t),o=this.getModelRow(e);return s.isValidForCell(i,o,n)?(s.setValueForCell(i,o,n),!0):!1}setValueForRanges(t,e){const{model:n}=this.props,{movedColumns:s,movedRows:i}=this.state,o=K.getModelRanges(t,s,i);nt(n)&&n.setValueForRanges(o,e)}isSelected(t,e){var s,i;const{selectedRanges:n}=this.state;for(let o=0;o<n.length;o+=1){const r=n[o],l=r.startRow===null||r.startRow<=t&&t<=((s=r.endRow)!=null?s:0),a=r.startColumn===null||r.startColumn<=e&&e<=((i=r.endColumn)!=null?i:0);if(l&&a)return!0}return!1}addDocumentCursor(t=null){this.documentCursor!==Zs.getCursorClassName(t)&&(this.documentCursor!=null&&document.documentElement.classList.remove(this.documentCursor),this.documentCursor=Zs.getCursorClassName(t),this.documentCursor!=null&&document.documentElement.classList.add(this.documentCursor),document.documentElement.classList.add("grid-block-events"))}removeDocumentCursor(){this.documentCursor!=null&&(document.documentElement.classList.remove(this.documentCursor),document.documentElement.classList.remove("grid-block-events"),this.documentCursor=null)}startDragTimer(t){this.stopDragTimer();const e=new MouseEvent("custom",t.nativeEvent);this.dragTimer=setTimeout(()=>{this.handleMouseDrag(e)},Zs.dragTimeout)}stopDragTimer(){this.dragTimer&&(clearTimeout(this.dragTimer),this.dragTimer=null)}drawCanvas(t=this.updateMetrics()){if(!this.canvas)throw new Error("canvas is not set");if(!this.canvasContext)throw new Error("context not set");const{left:e,top:n,cursorColumn:s,cursorRow:i,draggingColumn:o,draggingColumnSeparator:r,draggingRow:l,draggingRowOffset:a,draggingRowSeparator:c,editingCell:h,isDraggingHorizontalScrollBar:u,isDraggingVerticalScrollBar:m,isDragging:p,mouseX:g,mouseY:f,selectedRanges:b}=this.state,{model:C,stateOverride:v}=this.props,{renderer:T}=this,E=this.canvasContext,y=this.getTheme(),I=this.canvas.clientWidth,D=this.canvas.clientHeight,M={left:e,top:n,width:I,height:D,context:E,theme:y,model:C,metrics:t,mouseX:g,mouseY:f,selectedRanges:b,draggingColumn:o,draggingColumnSeparator:r,draggingRow:l,draggingRowOffset:a,draggingRowSeparator:c,editingCell:h,isDraggingHorizontalScrollBar:u,isDraggingVerticalScrollBar:m,isDragging:p,cursorColumn:s,cursorRow:i,...v};E.save(),T.drawCanvas(M),E.restore()}focus(){var t;(t=this.canvas)==null||t.focus()}isFocused(){return document.activeElement===this.canvas}handleClick(t){var s;const e=this.getGridPointFromEvent(t),n=this.getMouseHandlers();for(let i=0;i<n.length;i+=1)if(n[i].onClick(e,this,t)!==!1){t.stopPropagation(),t.preventDefault();break}(s=this.canvas)==null||s.focus()}handleContextMenu(t){const e=this.getGridPointFromEvent(t),n=this.getMouseHandlers();for(let s=0;s<n.length;s+=1)if(n[s].onContextMenu(e,this,t)!=null){t.stopPropagation(),t.preventDefault();break}}handleKeyDown(t){var n,s;const e=this.getKeyHandlers();for(let i=0;i<e.length;i+=1){const r=e[i].onDown(t,this);if(r!==!1){const l=r;((n=l==null?void 0:l.stopPropagation)==null||n)&&t.stopPropagation(),((s=l==null?void 0:l.preventDefault)==null||s)&&t.preventDefault();break}}}notifyMouseHandlers(t,e,n=!0,s=!1){var l,a;const i=this.getGridPointFromEvent(e),o=this.getMouseHandlers();let r=null;for(let c=0;c<o.length;c+=1){const h=o[c],u=h[t]!=null&&h[t](i,this,e);if(u!==!1){h.cursor!=null&&({cursor:r}=h,s&&this.addDocumentCursor(r));const m=u;((l=m==null?void 0:m.stopPropagation)==null||l)&&e.stopPropagation(),((a=m==null?void 0:m.preventDefault)==null||a)&&e.preventDefault();break}}if(this.setState({cursor:r}),n){const{x:c,y:h}=i;this.setState({mouseX:c,mouseY:h})}}handleMouseDown(t){window.addEventListener("mousemove",this.handleMouseDrag,!0),window.addEventListener("mouseup",this.handleMouseUp,!0),!(t.button!=null&&t.button!==0)&&(this.notifyMouseHandlers("onDown",t),this.startDragTimer(t))}handleDoubleClick(t){this.notifyMouseHandlers("onDoubleClick",t)}handleMouseMove(t){this.notifyMouseHandlers("onMove",t)}handleMouseLeave(t){this.notifyMouseHandlers("onLeave",t,!1),this.setState({mouseX:null,mouseY:null})}handleMouseDrag(t){this.setState({isDragging:!0}),this.notifyMouseHandlers("onDrag",t,!0,!0),this.stopDragTimer()}handleMouseUp(t){window.removeEventListener("mousemove",this.handleMouseDrag,!0),window.removeEventListener("mouseup",this.handleMouseUp,!0),!(t.button!=null&&t.button!==0)&&(this.notifyMouseHandlers("onUp",t,!1),this.stopDragTimer(),this.removeDocumentCursor())}handleResize(){if(this.updateCanvasScale(),this.updateCanvas(),!this.metrics)throw new Error("metrics not set");const{left:t,top:e}=this.state,{lastLeft:n,lastTop:s}=this.metrics;t>n&&this.setState({left:n,leftOffset:0}),e>s&&this.setState({top:s,topOffset:0}),this.forceUpdate()}handleWheel(t){var y,I,D,M;if(this.notifyMouseHandlers("onWheel",t),t.defaultPrevented)return;const{metricCalculator:e,metrics:n}=this,s=this.getMetricState();if(!n)throw new Error("metrics not set");const{lastTop:i,lastLeft:o,columnCount:r,rowCount:l,scrollableContentWidth:a,scrollableViewportWidth:c,scrollableContentHeight:h,scrollableViewportHeight:u,hasHorizontalBar:m,hasVerticalBar:p}=n;let{top:g,left:f,topOffset:b,leftOffset:C}=n;const v=this.getTheme();let{deltaX:T,deltaY:E}=K.getScrollDelta(t,n.barWidth,n.barHeight,n.rowHeight,n.rowHeight);for(;m&&T!==0;){if(C+=T,T=0,r>1){if(C>0&&f>=o||C<0&&f<=0){C=0;break}}else{if(C<=0){C=0;break}const x=a-c;if(C>=x){C=x;break}}if(C>0){const x=(y=n.visibleColumnWidths.get(f))!=null?y:e.getVisibleColumnWidth(f,s);C>=x?(T=C-x,C=0,f+=1):v.scrollSnapToColumn&&r>1&&(C=0,f+=1)}else if(C<0){const x=(I=n.visibleColumnWidths.get(f-1))!=null?I:e.getVisibleColumnWidth(f-1,s);Math.abs(C)<=x&&v.scrollSnapToColumn&&r>1?(C=0,f-=1):(T=C+x,C=0,f-=1)}}for(;p&&E!==0;){if(b+=E,E=0,l>1){if(b>0&&g>=i||b<0&&g<=0){b=0;break}}else{if(b<=0){b=0;break}const x=h-u;if(b>=x){b=x;break}}if(b>0){const x=(D=n.visibleRowHeights.get(g))!=null?D:e.getVisibleRowHeight(g,s);b>=x?(E=b-x,b=0,g+=1):v.scrollSnapToRow&&l>1&&(b=0,g+=1)}else if(b<0){const x=(M=n.visibleRowHeights.get(g-1))!=null?M:e.getVisibleRowHeight(g-1,s);Math.abs(b)<=x&&v.scrollSnapToRow&&l>1?(b=0,g-=1):(E=b+x,b=0,g-=1)}}this.setViewState({top:g,left:f,leftOffset:C,topOffset:b}),t.stopPropagation(),t.preventDefault()}handleEditCellCancel(){this.setState({editingCell:null}),this.focus()}handleEditCellChange(t){this.setState(({editingCell:e})=>{try{return Zd(e),{editingCell:{...e,value:t}}}catch(n){const{onError:s}=this.props;return s(n instanceof Error?n:new Error(`${n}`)),null}})}handleEditCellCommit(t,{direction:e=Nn.DOWN,fillRange:n=!1}={}){const{editingCell:s,selectedRanges:i}=this.state;if(!s)throw new Error("editingCell not set");const{column:o,row:r}=s;if(!this.isValidForCell(o,r,t)){e===null&&this.setState({editingCell:null});return}n?this.setValueForRanges(i,t):this.setValueForCell(o,r,t),e!==null&&this.moveCursorInDirection(e),this.setState({editingCell:null}),this.focus()}renderInputField(){const{model:t}=this.props,{editingCell:e}=this.state,{metrics:n}=this;if(e==null||n==null||!nt(t))return null;const{selectionRange:s,value:i,isQuickEdit:o}=e,{column:r,row:l}=e,{gridX:a,gridY:c,visibleColumnXs:h,visibleRowYs:u,visibleColumnWidths:m,visibleRowHeights:p}=n,g=h.get(r),f=u.get(l),b=m.get(r),C=p.get(l),v=g!=null&&f!=null&&b!=null&&C!=null?{position:"absolute",left:a+g,top:c+f,width:b,height:C}:{opacity:0},T=this.getModelColumn(r),E=this.getModelRow(l),y=T!=null&&E!=null?{textAlign:t.textAlignForCell(T,E)}:void 0,I=t.isValidForCell(T,E,i);return d("div",{style:v,children:d(yc,{selectionRange:s,className:W({error:!I}),onCancel:this.handleEditCellCancel,onChange:this.handleEditCellChange,onDone:this.handleEditCellCommit,isQuickEdit:o,style:y,value:i},`${r},${l}`)})}render(){const{cursor:t}=this.state;return w(ue,{children:[d("canvas",{className:W("grid-canvas",Zs.getCursorClassName(t)),ref:e=>{this.canvas=e},onClick:this.handleClick,onContextMenu:this.handleContextMenu,onDoubleClick:this.handleDoubleClick,onKeyDown:this.handleKeyDown,onMouseDown:this.handleMouseDown,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,tabIndex:0,children:"Your browser does not support HTML canvas. Update your browser?"}),this.renderInputField()]})}};let no=Zs;no.contextType=T0;no.defaultProps={canvasOptions:{alpha:!1},isStickyBottom:!1,isStickyRight:!1,isStuckToBottom:!1,isStuckToRight:!1,keyHandlers:[],mouseHandlers:[],movedColumns:[],movedRows:[],onError:()=>{},onSelectionChanged:()=>{},onMovedColumnsChanged:t=>{},onMoveColumnComplete:()=>{},onMovedRowsChanged:()=>{},onMoveRowComplete:()=>{},onViewChanged:()=>{},stateOverride:{},theme:{autoSelectColumn:!1,autoSelectRow:!1}};no.pixelsPerLine=100/3;no.dragTimeout=1e3;no.getTheme=Ce((t,e)=>({...o0,...t,...e}));class xm extends sl{get floatingTopRowCount(){return 0}get floatingBottomRowCount(){return 0}get floatingLeftColumnCount(){return 0}get floatingRightColumnCount(){return 0}get columnHeaderMaxDepth(){return 1}truncationCharForCell(e,n){}textAlignForCell(e,n){return"left"}colorForCell(e,n,s){return s.textColor}backgroundColorForCell(e,n,s){return null}colorForColumnHeader(e,n=0){return null}textForRowHeader(e){return""}textForRowFooter(e){return""}isColumnMovable(e,n=0){return!0}isRowMovable(e){return!0}getColumnHeaderGroup(e,n){}getColumnHeaderParentGroup(e,n){}}class E0 extends xm{constructor({rowCount:e=1e9,columnCount:n=100,floatingTopRowCount:s=0,floatingBottomRowCount:i=0,floatingLeftColumnCount:o=0,floatingRightColumnCount:r=0,isEditable:l=!1,editedData:a=[]}={}){super(),this.numRows=e,this.numColumns=n,this.floatingTop=s,this.floatingBottom=i,this.floatingLeft=o,this.floatingRight=r,this.editable=l,this.editedData=a}get rowCount(){return this.numRows}get columnCount(){return this.numColumns}get floatingTopRowCount(){return this.floatingTop}get floatingBottomRowCount(){return this.floatingBottom}get floatingLeftColumnCount(){return this.floatingLeft}get floatingRightColumnCount(){return this.floatingRight}get isEditable(){return this.editable}textForCell(e,n){var s,i;return(i=(s=this.editedData[e])==null?void 0:s[n])!=null?i:`${e},${n}`}colorForCell(e,n,s){return s.textColor}textForColumnHeader(e,n=0){return`${e}`}textForRowHeader(e){return`${e}`}textForRowFooter(e){return`${e}`}async setValueForCell(e,n,s){this.editedData[e]==null&&(this.editedData[e]=[]),this.editedData[e][n]=`${s}`}async setValueForRanges(e,n){oe.forEachCell(e,(s,i)=>{this.setValueForCell(s,i,n)})}async setValues(e){var n,s;for(let i=0;i<e.length;i+=1){const o=e[i];this.setValueForCell((n=o.column)!=null?n:o.x,(s=o.row)!=null?s:o.y,o.text)}}editValueForCell(e,n){return this.textForCell(e,n)}isValidForCell(e,n,s){return!0}isEditableRange(e){return this.isEditable}delete(e){throw new Error("Method not implemented.")}}const Js=class extends E0{constructor({rowCount:t=Js.DEFAULT_ROW_COUNT,columnCount:e=Js.DEFAULT_COLUMN_COUNT,children:n=new Map,childRowCount:s=Math.ceil(Math.max(Js.MIN_CHILD_ROW_COUNT,t*Js.DEFAULT_CHILD_ROW_COUNT_FACTOR)),maxDepth:i=Js.MAX_DEPTH}={}){super({rowCount:t,columnCount:e}),this.getCachedModelRowOffset=dn((o,r)=>{let l=null,a=r;const c=[...o].sort((h,u)=>h[0]-u[0]);for(let h=0;h<c.length;h+=1){const[u,m]=c[h];if(a<=u)break;const p=m.rowCount;if(a<=u+p){l=u,a=a-u-1;break}a-=p}return{key:l,offsetRow:a}}),this.getCachedTextForRowHeader=dn((o,r)=>{const{key:l,offsetRow:a}=this.getCachedModelRowOffset(o,r);if(l!=null){const c=o.get(l);if(c!==void 0)return`${l}.${c.textForRowHeader(a)}`}return`${a}`}),this.getCachedTextForCell=dn((o,r,l)=>{const{key:a,offsetRow:c}=this.getCachedModelRowOffset(o,l);if(a!=null){const h=o.get(a);if(h!==void 0)return`${a}.${h.textForCell(r,c)}`}return`${r},${c}`}),this.getCachedIsRowExpandable=dn((o,r,l)=>this.getCachedDepthForRow(o,r)<l),this.getCachedIsRowExpanded=dn((o,r)=>{const{key:l,offsetRow:a}=this.getCachedModelRowOffset(o,r);if(l!=null){const c=o.get(l);if(c!==void 0)return c.isRowExpanded(a)}return o.has(a)}),this.getCachedDepthForRow=dn((o,r)=>{const{key:l,offsetRow:a}=this.getCachedModelRowOffset(o,r);if(l!=null){const c=o.get(l);if(c!==void 0)return c.depthForRow(a)+1}return 0}),this.children=n,this.childRowCount=s,this.maxDepth=i}textForCell(t,e){return this.getCachedTextForCell(this.children,t,e)}textForRowHeader(t){return this.getCachedTextForRowHeader(this.children,t)}isRowMovable(t){return!1}get hasExpandableRows(){return!0}get floatingBottomRowCount(){return 0}isRowExpandable(t){return this.getCachedIsRowExpandable(this.children,t,this.maxDepth)}isRowExpanded(t){return this.getCachedIsRowExpanded(this.children,t)}setRowExpanded(t,e){const{key:n,offsetRow:s}=this.getCachedModelRowOffset(this.children,t),i=new Map(this.children);if(n!=null){const o=this.children.get(n);if(o!==void 0){const{rowCount:r}=o;o.setRowExpanded(s,e),this.numRows+=o.rowCount-r}}else if(e){const o=new Js({rowCount:this.childRowCount,columnCount:this.numColumns});i.set(s,o),this.numRows+=o.rowCount}else{const o=i.get(s);o!==void 0&&(this.numRows-=o.rowCount,i.delete(s))}this.children=i}depthForRow(t){return this.getCachedDepthForRow(this.children,t)}};let Ko=Js;Ko.DEFAULT_ROW_COUNT=1e9;Ko.DEFAULT_COLUMN_COUNT=100;Ko.DEFAULT_CHILD_ROW_COUNT_FACTOR=.01;Ko.MIN_CHILD_ROW_COUNT=10;Ko.MAX_DEPTH=10;class we extends xm{constructor(){super(),this.listenerCount=0}addEventListener(e,n,s){super.addEventListener(e,n,s),this.listenerCount+=1,this.listenerCount===1&&this.startListening()}removeEventListener(e,n,s){super.removeEventListener(e,n,s),this.listenerCount-=1,this.listenerCount===0&&this.stopListening()}startListening(){}stopListening(){}get originalColumns(){return this.columns}get movedColumns(){return[]}get movedRows(){return[]}get layoutHints(){return null}get frontColumns(){return[]}get backColumns(){return[]}get frozenColumns(){return[]}isColumnFrozen(e){return!1}get isFilterRequired(){return!1}get isReversible(){return!0}get isColumnStatisticsAvailable(){return!1}get description(){return""}get isCustomColumnsAvailable(){return!1}get isFormatColumnsAvailable(){return!1}get isExportAvailable(){return!1}get isValuesTableAvailable(){return!1}get isChartBuilderAvailable(){return!1}get isRollupAvailable(){return!1}get isSelectDistinctAvailable(){return!1}get isTotalsAvailable(){return!1}isFilterable(e){return!1}close(){}isRowMovable(){return!1}}we.EVENT=Object.freeze({UPDATED:"UPDATED",FORMATTER_UPDATED:"FORMATTER_UPDATED",REQUEST_FAILED:"REQUEST_FAILED",COLUMNS_CHANGED:"COLUMNS_CHANGED",TABLE_CHANGED:"TABLE_CHANGED",FILTERS_CHANGED:"FILTERS_CHANGED",SORTS_CHANGED:"SORTS_CHANGED",DISCONNECT:"DISCONNECT",RECONNECT:"RECONNECT",TOTALS_UPDATED:"TOTALS_UPDATED",PENDING_DATA_UPDATED:"PENDING_DATA_UPDATED"});const _i=class extends S.exports.Component{constructor(t){super(t),this.getInput=Ce((e,n)=>e.find(s=>s.eventKey===n)),this.getInputIndex=Ce((e,n)=>e.findIndex(s=>s.eventKey===n)),this.handleAddColumnClick=this.handleAddColumnClick.bind(this),this.handleSaveClick=this.handleSaveClick.bind(this),this.handleInputChange=this.handleInputChange.bind(this),this.handleDeleteColumn=this.handleDeleteColumn.bind(this),this.handleCustomColumnUpdated=this.handleCustomColumnUpdated.bind(this),this.handleRequestFailed=this.handleRequestFailed.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.resetRequestFailed=this.resetRequestFailed.bind(this),this.handleEditorTabNavigation=this.handleEditorTabNavigation.bind(this),this.state={inputs:[],isCustomColumnApplying:!1,errorMessage:null,hasRequestFailed:!1,isSuccessShowing:!1},this.container=null,this.successButtonTimer=null}static makeCustomColumnInputEventKey(){return qe.generate()}static createCustomColumnInput(){return{eventKey:qe.generate(),name:"",formula:""}}componentDidMount(){const{customColumns:t}=this.props;this.parseCustomColumns(t),this.startListening()}componentWillUnmount(){this.stopListening(),this.successButtonTimer&&clearTimeout(this.successButtonTimer)}resetErrorMessage(){this.setState({errorMessage:null})}startListening(){const{model:t}=this.props;t.addEventListener(we.EVENT.COLUMNS_CHANGED,this.handleCustomColumnUpdated),t.addEventListener(we.EVENT.UPDATED,this.handleCustomColumnUpdated),t.addEventListener(we.EVENT.REQUEST_FAILED,this.handleRequestFailed)}stopListening(){const{model:t}=this.props;t.removeEventListener(we.EVENT.COLUMNS_CHANGED,this.handleCustomColumnUpdated),t.removeEventListener(we.EVENT.UPDATED,this.handleCustomColumnUpdated),t.removeEventListener(we.EVENT.REQUEST_FAILED,this.handleRequestFailed)}parseCustomColumns(t){if(t.length>0){const e=t.map(n=>{const s=n.split(/=(.+)/,2);return{eventKey:_i.makeCustomColumnInputEventKey(),name:s[0],formula:s[1]}});this.setState({inputs:e})}else this.setState({inputs:[_i.createCustomColumnInput()]})}handleAddColumnClick(){const{inputs:t}=this.state,e=[...t];e.push(_i.createCustomColumnInput()),this.setState({inputs:e})}handleDeleteColumn(t){const{inputs:e}=this.state,n=this.getInputIndex(e,t),s=[...e];s.splice(n,1),s.length===0&&s.push(_i.createCustomColumnInput()),this.setState({inputs:s})}handleInputChange(t,e,n){const{inputs:s}=this.state,i=this.getInputIndex(s,t),r={...this.getInput(s,t)};r[e]=n;const l=[...s];l.splice(i,1,r),this.setState({inputs:l})}handleCustomColumnUpdated(){const{isCustomColumnApplying:t}=this.state;!t||this.setState({isCustomColumnApplying:!1,isSuccessShowing:!0},()=>{this.successButtonTimer=setTimeout(()=>this.setState({isSuccessShowing:!1}),_i.SUCCESS_SHOW_DURATION)})}handleRequestFailed(t){const e=t,{isCustomColumnApplying:n}=this.state;!n||this.setState({isCustomColumnApplying:!1,errorMessage:w(ue,{children:[w("p",{children:[d(z,{icon:hs})," Failed to apply custom columns."]}),w("div",{className:"error-box",children:[e.detail.errorMessage,d("br",{}),"Table configuration:"," ",JSON.stringify(e.detail.configuration)]})]}),hasRequestFailed:!0})}handleDragEnd(t){if(Yt.stopDragging(),!t.destination)return;const{inputs:e}=this.state,n=t.source.index,s=t.destination.index,i=[...e],o=e[n];i.splice(n,1),i.splice(s,0,o),this.setState({inputs:i})}handleEditorTabNavigation(t,e){var s,i,o;const{inputs:n}=this.state;if(e){((s=this.container)==null?void 0:s.querySelectorAll(".btn-drag-handle")[t]).focus();return}if(t===n.length-1)((i=this.container)==null?void 0:i.querySelectorAll(".btn-add-column")[t]).focus();else{const r=t+1;((o=this.container)==null?void 0:o.querySelectorAll(".custom-column-input")[r]).focus()}}handleSaveClick(){const{onSave:t}=this.props,{inputs:e,isCustomColumnApplying:n}=this.state;if(n)return;const s=[];e.forEach(i=>{const{name:o,formula:r}=i;o&&r&&s.push(`${o}=${r}`)}),this.resetErrorMessage(),this.setState({isCustomColumnApplying:!0}),t(s)}resetRequestFailed(){this.setState(({hasRequestFailed:t})=>t?{hasRequestFailed:!1}:null)}renderInputs(){const{inputs:t,hasRequestFailed:e}=this.state;return t.map((n,s)=>{const{eventKey:i,name:o,formula:r}=n;return d(wc,{inputIndex:s,eventKey:i,name:o,formula:r,onChange:this.handleInputChange,onDeleteColumn:this.handleDeleteColumn,onTabInEditor:this.handleEditorTabNavigation,invalid:e},i)})}renderSaveButton(){const{inputs:t,isCustomColumnApplying:e,isSuccessShowing:n}=this.state,s=t.length>1?"Save Columns":"Save Column";return w("button",{type:"button",className:W("btn btn-apply",{"btn-spinner":e},n?"btn-success":"btn-primary"),disabled:n||e,onClick:this.handleSaveClick,children:[e&&w("span",{children:[d(Ln,{}),d("span",{className:"btn-normal-content",children:"Applying"}),d("span",{className:"btn-hover-content",children:"Applying"})]}),!n&&!e&&s,n&&w(ue,{children:[d(z,{icon:Qa})," Success"]})]})}render(){const{onCancel:t}=this.props,{errorMessage:e}=this.state;return w("div",{role:"presentation",className:"custom-column-builder-container",ref:n=>{this.container=n},onClick:this.resetRequestFailed,onFocus:this.resetRequestFailed,children:[d("div",{className:"section-title",children:"Custom Column Name and Formula"}),d("hr",{}),d(Ho,{onDragStart:Yt.startDragging,onDragEnd:this.handleDragEnd,children:d(Po,{droppableId:"droppable-custom-columns",children:(n,s)=>w("div",{ref:n.innerRef,...n.droppableProps,className:W("droppable-container",{dragging:s.draggingFromThisWith}),children:[this.renderInputs(),n.placeholder]})})}),d("div",{className:"pt-1 px-3",children:w("button",{type:"button",className:"btn btn-link btn-add-column",onClick:this.handleAddColumnClick,children:[d(z,{icon:As}),"Add Another Column"]})}),w("div",{className:"custom-column-builder-footer",children:[e&&d("div",{className:"error-message",children:e}),w("div",{className:"d-flex justify-content-end",children:[d("button",{type:"button",className:"btn btn-outline-primary mr-2",onClick:t,children:"Cancel"}),this.renderSaveButton()]})]})]})}};let Ic=_i;Ic.SUCCESS_SHOW_DURATION=750;Ic.defaultProps={customColumns:[],onSave:()=>{},onCancel:()=>{}};var Ae=(t=>(t.ADVANCED_SETTINGS="ADVANCED_SETTINGS",t.AGGREGATIONS="AGGREGATIONS",t.AGGREGATION_EDIT="AGGREGATIONS_EDIT",t.CHART_BUILDER="CHART_BUILDER",t.CUSTOM_COLUMN_BUILDER="CUSTOM_COLUMN_BUILDER",t.QUICK_FILTERS="QUICK_FILTERS",t.ROLLUP_ROWS="ROLLUP_ROWS",t.SEARCH_BAR="SEARCH_BAR",t.SELECT_DISTINCT="SELECT_DISTINCT",t.TABLE_EXPORTER="TABLE_EXPORTER",t.VISIBILITY_ORDERING_BUILDER="VISIBILITY_ORDERING_BUILDER",t.CONDITIONAL_FORMATTING="CONDITIONAL_FORMATTING",t.CONDITIONAL_FORMATTING_EDIT="CONDITIONAL_FORMATTING_EDIT",t.GOTO="GOTO",t))(Ae||{});const po=X.module("RollupRows"),y0=150,wr="grouped-rollup-rows",vr="ungrouped-rollup-rows",In=class extends S.exports.Component{constructor(t){super(t),this.search=Je(o=>{const r=this.getSortedUngroupedColumns(),l=[];let a=null;for(let c=0;c<r.length;c+=1)r[c].name.toLowerCase().includes(o.toLowerCase())&&(a==null&&(a=c),l.push([c,c]));A(a),this.setState({ungroupedSelectedRanges:l}),l.length>0&&this.ungroupedList.current&&this.ungroupedList.current.scrollToItem(a)},y0),this.getCachedUngroupedColumns=Ie((o,r)=>o.filter(l=>In.isGroupable(l)&&r.find(a=>a===l.name)!=null)),this.getCachedSortedColumns=Ie((o,r)=>r==null?[...o]:P.sortColumns(o,r===In.SORT.ASCENDING)),this.search=this.search.bind(this),this.handleDeleteClicked=this.handleDeleteClicked.bind(this),this.handleSearchChange=this.handleSearchChange.bind(this),this.handleUngroupedSelect=this.handleUngroupedSelect.bind(this),this.handleUngroupedSelectionChange=this.handleUngroupedSelectionChange.bind(this),this.handleDragStart=this.handleDragStart.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleGroupedSelectionChange=this.handleGroupedSelectionChange.bind(this),this.handleShowConstituentsChange=this.handleShowConstituentsChange.bind(this),this.handleShowNonAggregatedColumnsChange=this.handleShowNonAggregatedColumnsChange.bind(this),this.handleSortAscending=this.handleSortAscending.bind(this),this.handleSortDescending=this.handleSortDescending.bind(this),this.renderGroupedItem=this.renderGroupedItem.bind(this),this.ungroupedList=Y.createRef(),this.groupedList=Y.createRef();const{config:e}=t,{columns:n=[],showConstituents:s=!0,showNonAggregatedColumns:i=!0}=e!=null?e:{};this.state={ungroupedSelectedRanges:[],columns:n,groupedSelectedRanges:[],searchFilter:"",showConstituents:s,showNonAggregatedColumns:i,dragSource:null,sort:null}}static renderColumn({item:t,isClone:e,selectedCount:n}){const s=t==null?void 0:t.name,i=e!==void 0&&e?`${n}`:void 0,o=e!==void 0&&e?"item-list-item-clone":"";return rn.renderTextItem({text:s,badgeText:i,className:o})}static addGroupings(t,e,n=t.length){if(e==null||e.length===0)return t;let s=n;const i=t.filter((o,r)=>e.includes(o)?(r<s&&(s-=1),!1):!0);return i.splice(s,0,...e),i}static isGroupable(t){return!P.isDecimalType(t.type)}componentDidUpdate(t,e){const{config:n}=this.props,{columns:s,showConstituents:i,showNonAggregatedColumns:o}=this.state;n!==t.config?this.updateFromConfig():(s!==e.columns||i!==e.showConstituents||o!==e.showNonAggregatedColumns)&&(n==null||s!==n.columns||i!==n.showConstituents||o!==n.showNonAggregatedColumns)&&this.sendChange()}componentWillUnmount(){this.search.cancel()}handleSearchChange(t){const e=t.target.value;if(this.setState({searchFilter:e}),!e){this.search.cancel(),this.resetSelection();return}this.search(e)}handleSortAscending(){this.setState(({sort:t})=>({sort:t===In.SORT.ASCENDING?null:In.SORT.ASCENDING}))}handleSortDescending(){this.setState(({sort:t})=>({sort:t===In.SORT.DESCENDING?null:In.SORT.DESCENDING}))}resetSelection(){this.setState({ungroupedSelectedRanges:[],groupedSelectedRanges:[]})}handleDragStart(t){po.debug("handleDragStart",t),document.documentElement.classList.add("drag-pointer-events-none"),this.setState({dragSource:t.source})}handleDragEnd(t){po.debug("handleDragEnd",t),document.documentElement.classList.remove("drag-pointer-events-none"),this.setState({dragSource:null});const{destination:e,source:n}=t;if(e==null||n==null)return;if(e.droppableId===vr){this.setState(({groupedSelectedRanges:o,columns:r})=>{const l=[...r];return Yt.reorder(l,o,[],0),{columns:l,ungroupedSelectedRanges:[],groupedSelectedRanges:[]}});return}const s=n.droppableId===wr;let i=e.index;s&&n.index<e.index&&(i+=1),this.setState(({columns:o,ungroupedSelectedRanges:r,groupedSelectedRanges:l})=>{const a=[...o],c=s?a:this.getSortedUngroupedColumns().map(g=>g.name),h=s?l:r,u=Yt.reorder(c,h,a,i),m=s?Yt.adjustDestinationIndex(i,l):i,p=[[m,m+u.length-1]];return{columns:a,ungroupedSelectedRanges:[],groupedSelectedRanges:p}}),this.resetSelection()}handleUngroupedSelect(t){po.debug("handleUngroupedSelect"),this.setState(({columns:e})=>({columns:In.addGroupings(e,[this.getSortedUngroupedColumns()[t].name]),ungroupedSelectedRanges:[],groupedSelectedRanges:[]}))}handleUngroupedSelectionChange(t){po.debug2("handleUngroupedSelectionChange",t),this.setState(({ungroupedSelectedRanges:e})=>t===e?null:{ungroupedSelectedRanges:t,groupedSelectedRanges:[]})}handleGroupedSelectionChange(t){po.debug2("handleGroupedSelectedRanges",t),this.setState(({groupedSelectedRanges:e})=>t===e?null:{groupedSelectedRanges:t,ungroupedSelectedRanges:[]})}handleDeleteClicked(t){this.setState(({columns:e})=>{const n=e.slice();return n.splice(t,1),{columns:n}})}handleShowConstituentsChange(){this.setState(({showConstituents:t})=>({showConstituents:!t}))}handleShowNonAggregatedColumnsChange(){this.setState(({showNonAggregatedColumns:t})=>({showNonAggregatedColumns:!t}))}updateFromConfig(){const{config:t}=this.props,{columns:e=[],showConstituents:n=!0,showNonAggregatedColumns:s=!0}=t!=null?t:{};this.setState({columns:e,showConstituents:n,showNonAggregatedColumns:s})}sendChange(){const{onChange:t}=this.props,{columns:e,showConstituents:n,showNonAggregatedColumns:s}=this.state;t({columns:e,showConstituents:n,showNonAggregatedColumns:s})}getUngroupedColumns(){const{model:t}=this.props,{columns:e}=this.state,{originalColumns:n}=t;return this.getCachedUngroupedColumns(n,e)}getSortedUngroupedColumns(){const{sort:t}=this.state,e=this.getUngroupedColumns();return this.getCachedSortedColumns(e,t)}renderGroupedItem({item:t,itemIndex:e,isClone:n,selectedCount:s}){const o=`${n!==void 0&&n?"":"\xA0\xA0".repeat(e)}${t}`,r=n!==void 0&&n?`${s}`:void 0,l=n!==void 0&&n?"item-list-item-clone":"";return w(ue,{children:[rn.renderTextItem({text:o,badgeText:r,className:l}),(n===void 0||!n)&&d(ce,{kind:"ghost",className:"btn btn-link btn-link-icon btn-delete-grouping float-right",onClick:()=>this.handleDeleteClicked(e),children:d(z,{icon:_n})})]})}render(){const{columns:t,dragSource:e,searchFilter:n,groupedSelectedRanges:s,ungroupedSelectedRanges:i,showConstituents:o,showNonAggregatedColumns:r,sort:l}=this.state,a=this.getSortedUngroupedColumns();let c=t.length*rn.DEFAULT_ROW_HEIGHT;(e==null?void 0:e.droppableId)===vr&&(c+=rn.DEFAULT_ROW_HEIGHT);const h=a.length*rn.DEFAULT_ROW_HEIGHT+10,u=Math.min(3*rn.DEFAULT_ROW_HEIGHT,h);return d("div",{role:"menu",className:W("rollup-rows",{"is-dragging":e!=null}),tabIndex:0,children:w(Ho,{onDragEnd:this.handleDragEnd,onDragStart:this.handleDragStart,children:[w("div",{className:"rollup-rows-group-by",children:[d("div",{className:"section-title",children:"Group By"}),t.length===0&&d(Po,{isDropDisabled:!0,droppableId:"placeholder",children:(m,p)=>d("div",{className:W("placeholder","text-muted",{"is-dragging-from-this":p.draggingFromThisWith,"is-dragging-over":p.isDraggingOver,"is-dropping":p.draggingOverWith}),ref:m.innerRef,...m.droppableProps,children:"Create rollup by dragging columns here, from the available columns list below."})}),t.length>0&&d(rn,{draggingItemClassName:"rollup-rows-dragging-grouped-item",draggablePrefix:wr,droppableId:wr,itemCount:t.length,items:t,offset:0,onSelectionChange:this.handleGroupedSelectionChange,ref:this.groupedList,renderItem:this.renderGroupedItem,selectedRanges:s,style:{height:c},isMultiSelect:!0})]}),w("div",{className:"rollup-rows-available-columns",children:[d("div",{className:"section-title",children:"Available Grouping Columns"}),w("div",{className:"top-menu",children:[d(fs,{className:"w-100",value:n,matchCount:n?i.length:void 0,placeholder:"Find column...",onChange:this.handleSearchChange}),w(ce,{kind:"ghost",className:W("btn-link btn-link-icon",{active:l===In.SORT.ASCENDING}),onClick:this.handleSortAscending,children:[d(z,{icon:ec}),d(pe,{children:"Sort ascending"})]}),w(ce,{kind:"ghost",className:W("btn-link btn-link-icon",{active:l===In.SORT.DESCENDING}),onClick:this.handleSortDescending,children:[d(z,{icon:tc}),d(pe,{children:"Sort descending"})]})]}),d(rn,{className:"rollup-available-grouping-columns",draggablePrefix:vr,droppableId:vr,itemCount:a.length,items:a,renderItem:In.renderColumn,offset:0,onSelect:this.handleUngroupedSelect,onSelectionChange:this.handleUngroupedSelectionChange,ref:this.ungroupedList,selectedRanges:i,style:{maxHeight:h,minHeight:u},isDropDisabled:(e==null?void 0:e.droppableId)!==wr,isMultiSelect:!0}),w("div",{className:"bottom-menu",children:[d("div",{className:"label",children:"Show:"}),d(Ut,{checked:o,onChange:this.handleShowConstituentsChange,children:"Constituents"}),d(Ut,{checked:r,onChange:this.handleShowNonAggregatedColumnsChange,children:"Non-Aggregated Columns"})]})]})]})})}};let Rc=In;Rc.SORT=Object.freeze({ASCENDING:"ASC",DESCENDING:"DESC"});Rc.defaultProps={config:null,onChange:()=>{}};const I0=X.module("TableCsvExporter"),je=class extends S.exports.Component{static getDateString(){return N.i18n.DateTimeFormat.format(je.FILENAME_DATE_FORMAT,new Date)}constructor(t){super(t),this.handleDownloadClick=this.handleDownloadClick.bind(this),this.handleDownloadOptionChanged=this.handleDownloadOptionChanged.bind(this),this.handleCustomizedDownloadOptionChanged=this.handleCustomizedDownloadOptionChanged.bind(this),this.handleCustomizedDownloadRowsChanged=this.handleCustomizedDownloadRowsChanged.bind(this);const{name:e}=t;this.state={fileName:`${e}-${je.getDateString()}.csv`,downloadOption:je.DOWNLOAD_OPTIONS.ALL_ROWS,customizedDownloadOption:je.CUSTOMIZED_ROWS_OPTIONS.FIRST,customizedDownloadRows:je.DEFAULT_DOWNLOAD_ROWS,errorMessage:null,id:qe.generate()}}getSnapshotRanges(){const{model:t,selectedRanges:e}=this.props,{downloadOption:n,customizedDownloadOption:s,customizedDownloadRows:i}=this.state,{rowCount:o}=t;let r=[];switch(n){case je.DOWNLOAD_OPTIONS.ALL_ROWS:r.push(new oe(null,0,null,o-1));break;case je.DOWNLOAD_OPTIONS.SELECTED_ROWS:r=[...e].sort((l,a)=>l.startRow!=null&&a.startRow!=null?l.startRow-a.startRow:0);break;case je.DOWNLOAD_OPTIONS.CUSTOMIZED_ROWS:switch(s){case je.CUSTOMIZED_ROWS_OPTIONS.FIRST:r.push(new oe(null,0,null,Math.min(i-1,o-1)));break;case je.CUSTOMIZED_ROWS_OPTIONS.LAST:r.push(new oe(null,Math.max(0,o-i),null,o-1));break}break}return r}resetDownloadState(){this.setState({errorMessage:null})}async handleDownloadClick(){const{model:t,isDownloading:e,onDownloadStart:n,onDownload:s,onCancel:i}=this.props,{fileName:o}=this.state;if(e){i();return}this.resetDownloadState();const r=this.getSnapshotRanges();if(this.validateOptionInput()){n();try{const l=await t.export(),a=l.setViewport(0,0);await a.getViewportData(),s(o,l,a,r)}catch(l){I0.error("CSV download failed",l),this.setState({errorMessage:w("p",{children:[d(z,{icon:hs})," ",`${l}`]})}),i()}}}handleDownloadOptionChanged(t){this.setState({downloadOption:t.target.value})}handleCustomizedDownloadOptionChanged(t){this.setState({customizedDownloadOption:t.target.value})}handleCustomizedDownloadRowsChanged(t){this.setState({customizedDownloadRows:parseInt(t.target.value,10)})}validateOptionInput(){const{selectedRanges:t}=this.props,{downloadOption:e,customizedDownloadRows:n}=this.state;return e===je.DOWNLOAD_OPTIONS.SELECTED_ROWS&&t.length===0?(this.setState({errorMessage:w("p",{children:[d(z,{icon:hs})," No rows selected. Please select some rows in the table."]})}),!1):e===je.DOWNLOAD_OPTIONS.CUSTOMIZED_ROWS&&n<=0?(this.setState({errorMessage:w("p",{children:[d(z,{icon:hs})," Number of rows to output must be greater than 0"]})}),!1):!0}render(){const{model:t,isDownloading:e,tableDownloadProgress:n,tableDownloadEstimatedTime:s,selectedRanges:i,tableDownloadStatus:o}=this.props,{fileName:r,downloadOption:l,customizedDownloadOption:a,customizedDownloadRows:c,errorMessage:h,id:u}=this.state,{rowCount:m}=t;return w("div",{className:"table-csv-exporter",children:[d("div",{className:"section-title",children:"Download Rows"}),d("div",{className:"form-group",children:w(ml,{onChange:this.handleDownloadOptionChanged,value:l,disabled:e,children:[w(Mn,{value:je.DOWNLOAD_OPTIONS.ALL_ROWS,"data-testid":"radio-csv-exporter-download-all",children:["All Rows",d("span",{className:"text-muted ml-2",children:`(${m.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,")} rows)`})]}),w(Mn,{value:je.DOWNLOAD_OPTIONS.SELECTED_ROWS,"data-testid":"radio-csv-exporter-only-selected",children:["Only Selected Rows",d("span",{className:"text-muted ml-2",children:i.length>0?`(${oe.rowCount(i).toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,")} rows)`:null})]}),d(Mn,{value:je.DOWNLOAD_OPTIONS.CUSTOMIZED_ROWS,"data-testid":"radio-csv-exporter-customized-rows",children:w("div",{className:"radio-input-row",role:"presentation",onClick:()=>{this.setState({downloadOption:je.DOWNLOAD_OPTIONS.CUSTOMIZED_ROWS})},children:[w("select",{value:a,"data-testid":"select-csv-exporter-customized-rows",className:"custom-select",disabled:e,onChange:this.handleCustomizedDownloadOptionChanged,children:[d("option",{value:"FIRST",children:"First"}),d("option",{value:"LAST",children:"Last"})]}),d("input",{type:"number",className:"form-control",id:`customizedRows-${u}`,"data-testid":"input-csv-exporter-customized-rows",name:`customizedRows-${u}`,placeholder:"100",value:c,disabled:e,onChange:this.handleCustomizedDownloadRowsChanged}),d("div",{children:"Rows"})]})})]})}),w("div",{className:"form-group",children:[d("label",{htmlFor:`customizedRows-${u}`,children:"File Name"}),d("input",{type:"text",className:"form-control",id:`filename-${u}`,"data-testid":"input-csv-exporter-file-name",name:`filename-${u}`,value:r,onChange:p=>{this.setState({fileName:p.target.value})},disabled:e})]}),w("div",{className:"section-footer flex-column",children:[h!=null&&d("div",{className:"error-message",children:h}),o&&w("div",{className:"download-status",children:[(o===je.DOWNLOAD_STATUS.DOWNLOADING||o===je.DOWNLOAD_STATUS.INITIATING)&&w(ue,{children:[o===je.DOWNLOAD_STATUS.INITIATING&&d("div",{className:"text-muted",children:"Starting Download..."}),o===je.DOWNLOAD_STATUS.DOWNLOADING&&w("div",{className:"text-muted d-flex justify-content-between",children:[d("span",{children:s||s===0?`Estimated time: ${Rn.formatElapsedTime(s)}`:null}),d("span",{children:`${n}%`})]})]}),o===je.DOWNLOAD_STATUS.FINISHED&&d("div",{className:"text-muted text-right",children:"Download Completed"}),o===je.DOWNLOAD_STATUS.CANCELED&&d("div",{className:"text-muted",children:"Download Canceled"}),(o===je.DOWNLOAD_STATUS.DOWNLOADING||o===je.DOWNLOAD_STATUS.INITIATING)&&d("div",{className:"progress",children:d("div",{className:"progress-bar progress-bar-striped progress-bar-animated",style:{width:`${n}%`}})}),o===je.DOWNLOAD_STATUS.FINISHED&&d("div",{className:"progress",children:d("div",{className:"progress-bar bg-success",style:{width:`${n}%`}})})]}),w("button",{type:"button","data-testid":"btn-csv-exporter-download",className:W("btn btn-primary btn-downloading",{"btn-spinner btn-cancelable":e}),onClick:this.handleDownloadClick,children:[e&&w("span",{children:[d(Ln,{}),d("span",{className:"btn-normal-content",children:"Downloading"}),d("span",{className:"btn-hover-content",children:"Cancel"})]}),!e&&"Download"]})]})]})}};let an=je;an.FILENAME_DATE_FORMAT="yyyy-MM-dd-HHmmss";an.DOWNLOAD_STATUS={INITIATING:"INITIATING",DOWNLOADING:"DOWNLOADING",FINISHED:"FINISHED",CANCELED:"CANCELED"};an.DOWNLOAD_OPTIONS={ALL_ROWS:"ALL_ROWS",SELECTED_ROWS:"SELECTED_ROWS",CUSTOMIZED_ROWS:"CUSTOMIZED_ROWS"};an.CUSTOMIZED_ROWS_OPTIONS={FIRST:"FIRST",LAST:"LAST"};an.DEFAULT_DOWNLOAD_ROWS=100;an.defaultProps={onDownloadStart:()=>{},isDownloading:!1,tableDownloadStatus:"",tableDownloadProgress:0,tableDownloadEstimatedTime:null,selectedRanges:[]};const ns=X.module("TableSaver");function R0(t){return t.added!==void 0}function D0(t){if(!R0(t))throw new Error("event is not UpdateEventData")}const Fs=class extends S.exports.PureComponent{constructor(t){var e,n;super(t),this.WritableStream=(e=window.WritableStream)!=null?e:od,this.getCachedCustomColumnFormatFlag=dn(us.isCustomColumnFormatDefined,{max:1e4}),this.handlePortMessage=this.handlePortMessage.bind(this),this.handleSnapshotResolved=this.handleSnapshotResolved.bind(this),this.handleDownloadTimeout=this.handleDownloadTimeout.bind(this),this.state={},this.gridRanges=[],this.gridRangeCounter=0,this.rangedSnapshotsTotal=[],this.rangedSnapshotCounter=0,this.snapshotsTotal=0,this.snapshotCounter=0,this.snapshotsBuffer=new Map,this.currentSnapshotIndex=0,this.snapshotPending=0,this.cancelableSnapshots=[],this.WritableStream=(n=window.WritableStream)!=null?n:od,this.iframes=[],this.useBlobFallback=!1}static csvEscapeString(t){return`"${t.replace(/"/g,'""')}"`}componentDidMount(){const{getDownloadWorker:t}=this.props;t().then(e=>{ns.info("found active service worker"),this.sw=e,this.sw.postMessage("ping")}).catch(e=>{ns.warn("Download csv is not optimized.",e),this.useBlobFallback=!0})}componentWillUnmount(){this.iframes.length>0&&this.iframes.forEach(t=>{t.remove()}),this.streamTimeout&&clearTimeout(this.streamTimeout),this.snapshotHandlerTimeout&&clearTimeout(this.snapshotHandlerTimeout)}createWriterStream(t){const e=this.useBlobFallback,n=[];let s=null;e&&(s=TextEncoder.prototype.encode.bind(new TextEncoder));const{fileName:i}=this,o={};return e?(o.write=r=>{A(s),r.header!==void 0&&n.push(s(r.header)),r.rows!==void 0&&n.push(s(r.rows))},o.close=()=>{A(i);const r=new Blob(n,{type:"application/octet-stream; charset=utf-8"}),l=document.createElement("a");l.href=URL.createObjectURL(r),l.download=i,l.click()},o.abort=()=>{t.postMessage({cancel:!0}),t.close()}):(o.write=r=>{t.postMessage(r)},o.close=()=>{t.postMessage({end:!0}),t.close()},o.abort=()=>{t.postMessage({cancel:!0}),t.close()}),new this.WritableStream(o)}startDownload(t,e,n,s){const{isDownloading:i}=this.props;if(i)return;this.downloadStartTime=Date.now(),ns.info(`start downloading ${t}`),this.table=e,this.columns=e.columns,this.tableSubscription=n,this.gridRanges=s;const o=encodeURIComponent(t.replace(/\//g,":")).replace(/['()]/g,escape).replace(/\*/g,"%2A"),r=new MessageChannel;if(this.port=r.port1,this.fileName=t,this.fileWriter=this.createWriterStream(this.port).getWriter(),this.useBlobFallback){this.writeCsvTable();return}this.sw&&this.sw.postMessage({encodedFileName:o},[r.port2]),this.port.onmessage=this.handlePortMessage}finishDownload(){this.table&&this.table.close(),this.tableSubscription&&this.tableSubscription.close(),this.fileWriter&&this.fileWriter.close();const{onDownloadCompleted:t}=this.props;t(),this.resetTableSaver(),this.downloadStartTime!==void 0&&ns.info(`download finished, total elapsed time ${(Date.now()-this.downloadStartTime)/1e3} seconds`)}cancelDownload(){this.table&&this.table.close(),this.tableSubscription&&this.tableSubscription.close(),this.fileWriter&&this.fileWriter.abort(),this.cancelableSnapshots.forEach(e=>{e&&(e.catch(()=>null),e.cancel())});const{onDownloadCanceled:t}=this.props;t(),this.resetTableSaver()}resetTableSaver(){this.table=void 0,this.tableSubscription=void 0,this.columns=void 0,this.chunkRows=void 0,this.gridRanges=[],this.gridRangeCounter=0,this.rangedSnapshotsTotal=[],this.rangedSnapshotCounter=0,this.snapshotsTotal=0,this.snapshotCounter=0,this.snapshotsBuffer=new Map,this.currentSnapshotIndex=0,this.snapshotPending=0,this.cancelableSnapshots=[],this.streamTimeout!=null&&clearTimeout(this.streamTimeout),this.snapshotHandlerTimeout!=null&&clearTimeout(this.snapshotHandlerTimeout),this.streamTimeout=void 0,this.snapshotHandlerTimeout=void 0}handleDownloadTimeout(){ns.info("download canceled"),this.cancelDownload()}writeTableHeader(){var e;let t="";if(this.columns)for(let n=0;n<this.columns.length;n+=1)t+=this.columns[n].name,t+=n===this.columns.length-1?`
25
+ `:",";(e=this.fileWriter)==null||e.write({header:t}).then(()=>null)}startWriteTableBody(){this.columns&&this.gridRanges!=null&&(this.chunkRows=Math.floor(Fs.DOWNLOAD_CELL_CHUNK/this.columns.length),this.rangedSnapshotsTotal=this.gridRanges.map(t=>(A(t.endRow),A(t.startRow),A(this.chunkRows),Math.ceil((t.endRow-t.startRow+1)/this.chunkRows))),this.snapshotsTotal=this.rangedSnapshotsTotal.reduce((t,e)=>t+e),ns.info("start writing table, total snapshots: ",this.snapshotsTotal),this.makeSnapshot(Math.min(Fs.SNAPSHOT_BUFFER_SIZE,this.snapshotsTotal)))}writeCsvTable(){this.writeTableHeader(),this.startWriteTableBody()}writeSnapshot(t,e,n){if(this.currentSnapshotIndex===t&&this.fileWriter){for(;this.snapshotsBuffer.has(this.currentSnapshotIndex);){const s=this.snapshotsBuffer.get(this.currentSnapshotIndex);A(s),this.fileWriter.write({rows:this.convertSnapshotIntoCsv(s)}),this.snapshotsBuffer.delete(this.currentSnapshotIndex),this.currentSnapshotIndex+=1,this.updateDownloadProgress(t)}if(this.snapshotsTotal&&this.currentSnapshotIndex>=this.snapshotsTotal){this.finishDownload();return}}this.snapshotCounter&&this.snapshotsTotal&&this.snapshotCounter<this.snapshotsTotal&&(ns.debug2(`
26
+ current range index: ${this.gridRangeCounter},
27
+ snapshotIndexCounter: ${this.snapshotCounter},
28
+ currentRangedSnapshotIndex : ${this.rangedSnapshotCounter},
29
+ snapshotpending: ${this.snapshotPending},
30
+ buffered ${this.snapshotsBuffer.size}
31
+ making ${Math.min(Fs.SNAPSHOT_BUFFER_SIZE-this.snapshotsBuffer.size-this.snapshotPending,this.snapshotsTotal-this.snapshotCounter)} more snapshots
32
+ `),this.makeSnapshot(Math.min(Fs.SNAPSHOT_BUFFER_SIZE-this.snapshotsBuffer.size-this.snapshotPending,this.snapshotsTotal-this.snapshotCounter)))}updateDownloadProgress(t){if(t!=null&&this.snapshotsTotal!=null&&this.downloadStartTime!=null){const{onDownloadProgressUpdate:e}=this.props,n=Math.floor(t*100/this.snapshotsTotal),s=t>1?Math.floor((Date.now()-this.downloadStartTime)*(this.snapshotsTotal-t)/t/1e3):null;e(n,s)}}convertSnapshotIntoCsv(t){var o;let e="";const n=t.added.iterator(),{formatter:s}=this.props,i=[];for(;n.hasNext();)i.push(n.next().value);A(this.columns);for(let r=0;r<i.length;r+=1){const l=i[r];for(let a=0;a<this.columns.length;a+=1){const{type:c,name:h}=this.columns[a],u=this.getCachedCustomColumnFormatFlag(s,h,c);let m=null;if(!u){const g=t.getFormat(l,this.columns[a]);m=(g==null?void 0:g.formatString)!=null?g:null}let p=null;m?p=s.getFormattedString(t.getData(l,this.columns[a]),c,h,m):p=s.getFormattedString(t.getData(l,this.columns[a]),c,h),e+=Fs.csvEscapeString(p),e+=a===((o=this.columns)==null?void 0:o.length)-1?`
33
+ `:","}}return e}makeSnapshot(t){if(t<=0)return;A(this.gridRangeCounter);let e=0,n=this.gridRanges[this.gridRangeCounter];for(A(this.tableSubscription),A(this.columns);e<t;){A(n),A(n.startRow),A(n.endRow),A(this.rangedSnapshotCounter),A(this.chunkRows);const s=n.startRow+this.rangedSnapshotCounter*this.chunkRows,i=Math.min(s+this.chunkRows-1,n.endRow),o=this.snapshotCounter;this.cancelableSnapshots.push(Re.makeCancelable(this.tableSubscription.snapshot(N.RangeSet.ofRange(s,i),this.columns).then(r=>(D0(r),this.handleSnapshotResolved(r,o,s,i),o)).catch(r=>{ns.error(r)}),r=>{ns.info(`snapshot ${r} has been canceled`)})),this.rangedSnapshotCounter+=1,this.snapshotCounter+=1,this.snapshotPending+=1,this.rangedSnapshotCounter>=this.rangedSnapshotsTotal[this.gridRangeCounter]&&(this.gridRangeCounter+=1,this.rangedSnapshotCounter=0,n=this.gridRanges[this.gridRangeCounter]),e+=1}}handlePortMessage({data:t}){const{download:e,readableStreamPulling:n}=t;this.useBlobFallback||(e!=null&&(this.makeIframe(`${e}`),this.writeCsvTable()),n!=null&&(this.useBlobFallback||(this.streamTimeout!=null&&clearTimeout(this.streamTimeout),this.streamTimeout=setTimeout(this.handleDownloadTimeout,Fs.STREAM_TIMEOUT))))}handleSnapshotResolved(t,e,n,s){this.snapshotHandlerTimeout=setTimeout(()=>{this.snapshotsBuffer.set(e,t),this.snapshotPending-=1,this.writeSnapshot(e,n,s),this.cancelableSnapshots[e]=null},Fs.SNAPSHOT_HANDLER_TIMEOUT)}makeIframe(t){const e=document.createElement("iframe");e.hidden=!0,e.src=`download/${t}`,e.name="iframe",document.body.appendChild(e),this.iframes.push(e)}render(){return null}};let so=Fs;so.DOWNLOAD_CELL_CHUNK=6e3;so.SNAPSHOT_BUFFER_SIZE=5;so.STREAM_TIMEOUT=8e3;so.SNAPSHOT_HANDLER_TIMEOUT=5;so.defaultProps={getDownloadWorker:()=>Promise.reject(new Error("Download worker not provided")),isDownloading:!1,onDownloadCompleted:()=>{},onDownloadCanceled:()=>{},onDownloadProgressUpdate:()=>{}};const N0=X.module("VisibilityOrderingBuilder"),M0=150,tt=class extends S.exports.Component{constructor(t){super(t),this.debouncedSearchColumns=Je(this.searchColumns,M0),this.getFirstMovableIndex=Ie((e,n)=>{for(let s=0;s<n.length;s+=1)if(e.isColumnMovable(s))return s;return null}),this.getLastMovableIndex=Ie((e,n)=>{for(let s=n.length-1;s>=0;s-=1)if(e.isColumnMovable(s))return s;return null}),this.renderImmovableItem=Ie(e=>d("div",{className:"visibility-ordering-list-item immovable",children:d("div",{className:"column-item",children:d("span",{className:"column-name",children:e})})},e)),this.renderVisibilityOrderingItem=Ie((e,n,s,i,o,r,l,a)=>d(il,{draggableId:`${n}`,index:s,disableInteractiveElementBlocking:!0,children:c=>w("div",{className:"visibility-ordering-list-item",ref:c.innerRef,...c.draggableProps,children:[d("button",{type:"button",className:"visibility btn btn-link btn-link-icon",onMouseDown:h=>{this.handleVisibilityDraggingStart(n,i?tt.VISIBILITY_OPTIONS.SHOW:tt.VISIBILITY_OPTIONS.HIDE,h)},onMouseEnter:h=>{this.handleMouseEnter(n,h)},onMouseUp:h=>{this.handleVisibilityDraggingEnd(h)},onClick:h=>{this.handleItemClick(n,h,!1)},onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(this.handleVisibilityKeyDown(n,i?tt.VISIBILITY_OPTIONS.SHOW:tt.VISIBILITY_OPTIONS.HIDE),h.stopPropagation(),h.preventDefault())},children:d(z,{icon:i?pd:Ta})}),w("div",{role:"menuitem",tabIndex:0,className:W("ordering column-item",{isSelected:o},{isDragging:r},{isDragged:l},{"two-dragged":a===2},{"multiple-dragged":a!=null&&a>2}),onClick:h=>{this.handleItemClick(n,h)},...c.dragHandleProps,children:[d("span",{className:"column-name",children:e}),w("div",{children:[a!=null&&a!==0&&d("span",{className:"number-badge",children:a}),d(pe,{children:"Drag to re-order"}),d(z,{icon:ll})]})]})]})},e)),this.handleSearchInputChange=this.handleSearchInputChange.bind(this),this.searchColumns=this.searchColumns.bind(this),this.handleOrderDraggingStart=this.handleOrderDraggingStart.bind(this),this.handleOrderDraggingEnd=this.handleOrderDraggingEnd.bind(this),this.state={selectedColumns:[],lastSelectedColumns:[],isDraggingVisibility:!1,visibilityDraggingOption:void 0,visibilityDraggingStartColumn:null,isDraggingOrder:!1,orderDraggingColumn:null,searchFilter:""},this.list=null}componentWillUnmount(){this.debouncedSearchColumns.cancel()}resetVisibilityOrdering(){const{model:t,onColumnVisibilityChanged:e,onMovedColumnsChanged:n}=this.props,{columns:s}=t;e(s.map(i=>{const o=t.getColumnIndexByName(i.name);return A(o),o}),tt.VISIBILITY_OPTIONS.SHOW),this.setState({selectedColumns:[],lastSelectedColumns:[],searchFilter:""}),n([])}resetSelection(){const{isDraggingOrder:t}=this.state;t||this.setState({selectedColumns:[],lastSelectedColumns:[]})}handleSearchInputChange(t){const e=t.target.value;if(this.setState({searchFilter:e}),!e){this.debouncedSearchColumns.cancel(),this.resetSelection();return}this.debouncedSearchColumns(e)}searchColumns(t){var r;const{model:e,movedColumns:n}=this.props,{columns:s}=e,i=[];let o=s.length;if(s.forEach((l,a)=>{const c=l.name.toLowerCase();e.isColumnMovable(a)&&c.includes(t.toLowerCase())&&(i.push(a),o=Math.min(o,K.getVisibleIndex(a,n)))}),this.addColumnToSelected(i,!1),i.length>0){const l=(r=this.list)==null?void 0:r.querySelectorAll(".column-item")[o];l==null||l.scrollIntoView({block:"center"})}}handleVisibilityKeyDown(t,e){const{onColumnVisibilityChanged:n}=this.props;n([t],e)}handleVisibilityDraggingStart(t,e,n){const{onColumnVisibilityChanged:s,movedColumns:i}=this.props,o=K.isModifierKeyDown(n),r=n.shiftKey;if(o||r)return;s([t],e);const l=K.getVisibleIndex(t,i);this.setState({isDraggingVisibility:!0,visibilityDraggingOption:e,visibilityDraggingStartColumn:l}),this.addColumnToSelected([t])}handleVisibilityDraggingEnd(t=null){t&&t.target.focus();const{isDraggingVisibility:e}=this.state;e&&this.setState({isDraggingVisibility:!1,visibilityDraggingOption:void 0,visibilityDraggingStartColumn:null})}handleOrderDraggingStart(t){var o;document.documentElement.classList.add("drag-pointer-events-none");const{selectedColumns:e}=this.state,{draggableId:n,source:{index:s}}=t,i=parseInt(n,10);if(((o=this.list)==null?void 0:o.querySelectorAll(".column-item")[s]).focus(),!e.includes(i)){this.setState({isDraggingOrder:!0,orderDraggingColumn:i,selectedColumns:[i]});return}this.setState({isDraggingOrder:!0,orderDraggingColumn:i})}handleOrderDraggingEnd(t){document.documentElement.classList.remove("drag-pointer-events-none");const{movedColumns:e,onMovedColumnsChanged:n}=this.props,{selectedColumns:s,orderDraggingColumn:i}=this.state;if(this.setState({isDraggingOrder:!1,orderDraggingColumn:null}),!t.destination)return;const{index:o}=t.destination,r=[...s].sort((m,p)=>K.getVisibleIndex(m,e)-K.getVisibleIndex(p,e));let l=[...e];A(i);const a=K.getVisibleIndex(i,l),c=[],h=[];l=K.moveItem(a,o,l),r.forEach(m=>{const p=K.getVisibleIndex(m,l);m!==i&&(p<o?c.push(m):h.push(m))}),c.forEach(m=>{const p=K.getVisibleIndex(m,l);l=K.moveItem(p,o,l)});const u=c.length>0||a>o?o+1:o;h.reverse().forEach(m=>{const p=K.getVisibleIndex(m,l);l=K.moveItem(p,u,l)}),n(l),N0.debug("move column order by drag & drop",l)}handleMouseEnter(t,e){const{onColumnVisibilityChanged:n,movedColumns:s,userColumnWidths:i}=this.props,{isDraggingVisibility:o,visibilityDraggingOption:r,visibilityDraggingStartColumn:l}=this.state,a=K.getVisibleIndex(t,s),c=K.isModifierKeyDown(e),h=e.shiftKey;if(!o||c||h)return;e.target.focus();const u=[t];A(l);const m=a>l;for(let p=l;m?p<a:p>a;m?p+=1:p-=1){const g=K.getModelIndex(p,s),f=K.checkColumnHidden(g,i);(f&&r===tt.VISIBILITY_OPTIONS.SHOW||!f&&r===tt.VISIBILITY_OPTIONS.HIDE)&&u.push(g)}this.addColumnToSelected(u,!0),n(u,r)}handleMoveColumns(t){const{movedColumns:e,onMovedColumnsChanged:n,model:s}=this.props,{columns:i}=s,{selectedColumns:o}=this.state;if(o.length===0)return;const r=this.getFirstMovableIndex(s,i),l=this.getLastMovableIndex(s,i);if(r==null||l==null)return;const a=[...o].sort((u,m)=>t===tt.MOVE_OPTIONS.TOP||t===tt.MOVE_OPTIONS.UP?K.getVisibleIndex(u,e)-K.getVisibleIndex(m,e):K.getVisibleIndex(m,e)-K.getVisibleIndex(u,e));let c=[],h=()=>{};switch(t){case tt.MOVE_OPTIONS.TOP:a.forEach((u,m)=>{const p=K.getVisibleIndex(u,e);c=K.moveItem(p,r+m,c)}),h=()=>{A(this.list),this.list.scrollTop=0};break;case tt.MOVE_OPTIONS.BOTTOM:a.forEach((u,m)=>{const p=K.getVisibleIndex(u,e);c=K.moveItem(p,l-m,c)}),h=()=>{A(this.list),this.list.scrollTop=this.list.scrollHeight};break;case tt.MOVE_OPTIONS.UP:K.getVisibleIndex(a[0],e)!==r&&a.forEach(u=>{const m=K.getVisibleIndex(u,e);c=K.moveItem(m,m-1,c)});break;case tt.MOVE_OPTIONS.DOWN:K.getVisibleIndex(a[0],e)!==l&&a.forEach(u=>{const m=K.getVisibleIndex(u,e);c=K.moveItem(m,m+1,c)});break}c.length>0&&n(e.concat(c),h)}handleSortColumns(t){const{model:e,onMovedColumnsChanged:n}=this.props,{columns:s}=e,i=[],o=[];for(let h=0;h<s.length;h+=1)e.isColumnMovable(h)?i.push(h):o.push(h);const r=i.sort((h,u)=>{const m=t===tt.SORTING_OPTIONS.ASC,p=s[h].name.toUpperCase(),g=s[u].name.toUpperCase();return on.sort(p,g,m)}),l=[];for(let h=0;h<o.length;h+=1){const u=o[h];l[u]=u}let a=0;for(let h=0;h<r.length;h+=1){for(;l[a]!=null;)a+=1;l[a]=r[h]}let c=[];l.forEach((h,u)=>{const m=K.getVisibleIndex(h,c);c=K.moveItem(m,u,c)}),n(c)}handleItemClick(t,e,n=!0){e.stopPropagation(),e.currentTarget.focus();const{selectedColumns:s,lastSelectedColumns:i}=this.state,o=K.isModifierKeyDown(e),r=e.shiftKey,l=s.includes(t),a=[t];if(l&&o){this.removeColumnFromSelected(t);return}if(l&&s.length===1&&n){this.removeColumnFromSelected(t);return}if(r){const{movedColumns:c}=this.props,h=i[i.length-1],u=K.getVisibleIndex(h,c),m=K.getVisibleIndex(t,c),p=m>u,g=[];for(let f=u;p?f<m:f>m;p?f+=1:f-=1)g.push(K.getModelIndex(f,c));g.forEach(f=>{s.includes(f)||a.push(f)})}this.addColumnToSelected(a,o||r)}addColumnToSelected(t,e=!1){const{selectedColumns:n,lastSelectedColumns:s}=this.state,i=e?n.concat(t):t,o=e?s.concat(t):t;this.setState({selectedColumns:i,lastSelectedColumns:o})}removeColumnFromSelected(t){const{selectedColumns:e,lastSelectedColumns:n}=this.state,s=[...e];s.splice(s.findIndex(r=>r===t),1);const i=n[n.length-1],o=[...n];i===t&&o.pop(),this.setState({selectedColumns:s,lastSelectedColumns:o})}makeVisibilityOrderingList(){const{model:t,userColumnWidths:e,movedColumns:n}=this.props,{columns:s}=t,{selectedColumns:i,isDraggingOrder:o,orderDraggingColumn:r}=this.state,l=[];let a=!1;for(let c=0;c<s.length;c+=1){const h=K.getModelIndex(c,n),u=s[h],m=t.isColumnMovable(h);if(c>0&&m!==a&&l.push(d("hr",{})),m){const p=e.get(h)===0,g=i.includes(h),f=r===h,b=o&&f&&i.length>1?i.length:null;l.push(this.renderVisibilityOrderingItem(u.name,h,c,p,g,o,f,b))}else l.push(this.renderImmovableItem(u.name));a=m}return l}render(){const{model:t,userColumnWidths:e,onColumnVisibilityChanged:n}=this.props,{selectedColumns:s,searchFilter:i}=this.state,{columns:o}=t,r=s.length===0,l=r?o.map((u,m)=>m).filter(u=>t.isColumnMovable(u)):[...s],a=K.checkAllColumnsHidden(l,e),c=a?"Show Selected":"Hide Selected",h=this.makeVisibilityOrderingList();return w("div",{role:"menu",className:"visibility-ordering-builder",tabIndex:0,onMouseUp:()=>{this.handleVisibilityDraggingEnd()},onMouseLeave:()=>{this.handleVisibilityDraggingEnd()},children:[w("div",{className:"top-menu",children:[w("button",{type:"button",className:"btn btn-link",onClick:()=>{n(l,a?tt.VISIBILITY_OPTIONS.SHOW:tt.VISIBILITY_OPTIONS.HIDE)},children:[d(z,{icon:a?pd:Ta}),d(pe,{children:"Toggle column visibility"}),r?"Toggle All":c]}),w("div",{children:[w("button",{type:"button",className:"btn btn-link text-muted",onClick:()=>{this.resetVisibilityOrdering()},children:["Reset",d(pe,{children:"Reset to default"})]}),w("button",{type:"button",className:"btn btn-link btn-link-icon",onClick:()=>{this.handleSortColumns(tt.SORTING_OPTIONS.ASC)},children:[d(z,{icon:ec}),d(pe,{children:"Sort ascending"})]}),w("button",{type:"button",className:"btn btn-link btn-link-icon",onClick:()=>{this.handleSortColumns(tt.SORTING_OPTIONS.DSC)},children:[d(z,{icon:tc}),d(pe,{children:"Sort descending"})]}),d("span",{className:"vertical-divider"}),w("button",{type:"button",className:"btn btn-link btn-link-icon",onClick:()=>{this.handleMoveColumns(tt.MOVE_OPTIONS.UP)},disabled:r,children:[d(z,{icon:zg}),d(pe,{children:"Move selection up"})]}),w("button",{type:"button",className:"btn btn-link btn-link-icon",onClick:()=>{this.handleMoveColumns(tt.MOVE_OPTIONS.DOWN)},disabled:r,children:[d(z,{icon:$g}),d(pe,{children:"Move selection down"})]}),w("button",{type:"button",className:"btn btn-link btn-link-icon",onClick:()=>{this.handleMoveColumns(tt.MOVE_OPTIONS.TOP)},disabled:r,children:[d(z,{icon:Cf}),d(pe,{children:"Move selection to top"})]}),w("button",{type:"button",className:"btn btn-link btn-link-icon",onClick:()=>{this.handleMoveColumns(tt.MOVE_OPTIONS.BOTTOM)},disabled:r,children:[d(z,{icon:ff}),d(pe,{children:"Move selection to bottom"})]})]})]}),d("div",{className:"top-menu",children:d(fs,{className:"w-100",value:i,matchCount:i?s.length:void 0,onChange:this.handleSearchInputChange})}),d(Ho,{onDragStart:this.handleOrderDraggingStart,onDragEnd:this.handleOrderDraggingEnd,children:d(Po,{droppableId:"droppable-visibility-order-list",children:(u,m)=>d("div",{role:"menu",className:W("visibility-ordering-list",{isDragging:m.draggingFromThisWith}),ref:u.innerRef,...u.droppableProps,children:w("div",{className:"column-list",ref:p=>{this.list=p},children:[h,u.placeholder]})})})})]})}};let fi=tt;fi.VISIBILITY_OPTIONS={SHOW:"SHOW",HIDE:"HIDE"};fi.SORTING_OPTIONS={DSC:"DSC",ASC:"ASC"};fi.MOVE_OPTIONS={TOP:"TOP",BOTTOM:"BOTTOM",UP:"UP",DOWN:"DOWN"};fi.COLUMN_CHANGE_OPTIONS={ALL:"ALL",SELECTION:"SELECTION"};fi.defaultProps={movedColumns:[],onColumnVisibilityChanged:()=>{},onMovedColumnsChanged:()=>{}};const Tr=X.module("AdvancedFilterCreatorFilterItem");class Dc extends S.exports.PureComponent{constructor(e){super(e),this.getCachedIsValid=Ce((o,r,l,a)=>{try{return!l||P.makeAdvancedValueFilter(o,r,l,a)!=null}catch{return!1}}),this.handleDelete=this.handleDelete.bind(this),this.handleTypeChange=this.handleTypeChange.bind(this),this.handleValueChange=this.handleValueChange.bind(this),this.typeDropdown=null;const{value:n="",filterTypes:s,selectedType:i=s[0]}=e;this.state={selectedType:i,value:n}}static getLabelForFilter(e,n){try{if(P.isNumberType(e)||P.isCharType(e))return Db(n);if(P.isTextType(e))return Rb(n);if(P.isDateType(e))return Nb(n);if(P.isBooleanType(e))return Mb(n);throw new Error(`Unrecognized column type: ${e}`)}catch(s){return Tr.warn(s),""}}componentDidMount(){var e;(e=this.typeDropdown)==null||e.focus()}componentDidUpdate(e){const{value:n,selectedType:s}=this.props;s!==void 0&&e.selectedType!==s&&this.setState({selectedType:s}),n!==void 0&&e.value!==n&&this.setState({value:n})}handleTypeChange(e){const n=e.target.value;Tr.debug2("typeChange",n),this.setState({selectedType:n});const{onChange:s}=this.props,{value:i}=this.state;i!=null&&i.length>0&&s(n,i)}handleValueChange(e){Tr.debug2("valueChange");const{value:n}=e.target;this.setState({value:n});const{onChange:s}=this.props,{selectedType:i}=this.state;i!=null&&s(i,n)}handleDelete(){Tr.debug("delete");const{onDelete:e}=this.props;e()}render(){const{column:e,filterTypes:n,formatter:s}=this.props,{selectedType:i,value:o}=this.state,r=!P.isBooleanType(e.type),l=[],a=this.getCachedIsValid(e,i,o,s.timeZone);for(let c=0;c<n.length;c+=1){const h=n[c],u=Dc.getLabelForFilter(e.type,h),m=d("option",{value:h,children:u},h);l.push(m)}return d("div",{className:"advanced-filter-creator-filter-item",children:w("div",{className:"form-row",children:[d("div",{className:"form-group col",children:d("select",{className:"form-control custom-select",value:i,onChange:this.handleTypeChange,ref:c=>{this.typeDropdown=c},children:l})}),r&&d("div",{className:"form-group col",children:d("div",{className:"input-group",children:d("input",{type:"text",className:W("form-control",{error:!a}),placeholder:"Enter value",value:o,onChange:this.handleValueChange})})}),d("div",{className:"form-group col-1 px-0",children:w("button",{type:"button",className:"btn btn-link btn-link-icon w-100 h-100 p-0 m-0",onClick:this.handleDelete,children:[d(z,{icon:_n}),d(pe,{children:"Remove Filter"})]})})]})})}}const ih=X.module("AdvancedFilterCreatorSelectValueList"),Na=class extends S.exports.PureComponent{constructor(t){super(t),this.handleSelect=this.handleSelect.bind(this),this.handleViewportChange=this.handleViewportChange.bind(this),this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.handleTableUpdate=this.handleTableUpdate.bind(this),this.list=null;const{selectedValues:e}=this.props;this.state={itemCount:0,items:[],offset:0,selectedValues:e,isLoading:!0}}static indexOf(t,e){for(let n=0;n<e.length;n+=1){const s=e[n];if(s===t||s!=null&&s.valueOf!=null&&t!=null&&t.valueOf!=null&&s.valueOf()===t.valueOf())return n}return-1}componentDidMount(){const{table:t}=this.props;t&&this.startListening(t)}componentDidUpdate(t){const{filters:e,invertSelection:n,selectedValues:s,table:i}=this.props;t.table!==i&&(t.table&&this.stopListening(t.table),i&&this.startListening(i),this.resetViewport()),t.invertSelection!==n&&this.setState({selectedValues:[]},this.handleSelectionUpdate),t.selectedValues!==s&&this.setState({selectedValues:s},this.handleSelectionUpdate),t.filters!==e&&(i==null||i.applyFilter(e),this.resetViewport())}componentWillUnmount(){const{table:t}=this.props;t&&this.stopListening(t)}handleSelect(t,e){const{invertSelection:n}=this.props;let{selectedValues:s}=this.state;s=[...s];const i=Na.indexOf(e,s);i>=0?s.splice(i,1):s.push(e);let o=i<0;n&&(o=!o);const{offset:r}=this.state;let{items:l}=this.state;l=[...l];const a=t-r;a>=0&&a<l.length&&(l[a].isSelected=o),this.setState({items:l,selectedValues:s});const{onChange:c}=this.props;c(s,n)}handleViewportChange(t,e){this.updateViewport(t,e)}handleSelectionUpdate(){this.updateItemSelection()}handleTableUpdate(t){const{table:e,formatter:n}=this.props;if(!e)return;const s=t.detail,{offset:i}=s,o=[],r=e.columns[0];for(let a=0;a<s.rows.length;a+=1){const h=s.rows[a].get(r),u=n.getFormattedString(h,r.type,r.name),m=this.isValueSelected(h);o.push({displayValue:u,value:h,isSelected:m})}ih.debug2("Received table update:",i,o.length);const l=e.size;this.setState({itemCount:l,items:o,offset:i,isLoading:!1})}isValueSelected(t){const{invertSelection:e}=this.props,{selectedValues:n}=this.state,s=Na.indexOf(t,n);return e?s<0:s>=0}startListening(t){t.addEventListener(N.Table.EVENT_UPDATED,this.handleTableUpdate)}stopListening(t){t.removeEventListener(N.Table.EVENT_UPDATED,this.handleTableUpdate)}resetViewport(){this.list&&this.list.topRow!=null&&this.list.bottomRow!=null&&this.updateViewport(this.list.topRow,this.list.bottomRow,!0)}updateItemSelection(){let{items:t}=this.state;t=[...t];for(let e=0;e<t.length;e+=1){const n=t[e],{value:s}=n;n.isSelected=this.isValueSelected(s)}this.setState({items:t})}updateViewport(t,e,n=!1){const{table:s}=this.props;if(s==null)return;n&&this.setState({isLoading:!0});const i=e-t+1,o=Math.max(0,t-i*3),r=Math.max(o,e+i*3);ih.debug2("Setting viewport",o,",",r),s.setViewport(o,r)}render(){const{offset:t,isLoading:e,items:n,itemCount:s}=this.state;return w("div",{className:"select-value-list-wrapper",children:[d(Tu,{itemCount:s,items:n,offset:t,onSelect:this.handleSelect,onViewportChange:this.handleViewportChange,ref:i=>{this.list=i}}),d(gt,{in:e,timeout:250,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:d("div",{className:"loading-list",children:d(Ln,{className:"loading-spinner-large"})})})]})}};let _m=Na;_m.defaultProps={invertSelection:!0,selectedValues:[],onChange:()=>{}};const Lm=class extends S.exports.PureComponent{constructor(t){super(t),this.handleSelectAllClick=this.handleSelectAllClick.bind(this),this.handleClearAllClick=this.handleClearAllClick.bind(this),this.handleListChange=this.handleListChange.bind(this),this.handleSearchChange=this.handleSearchChange.bind(this),this.handleUpdateFilterTimeout=this.handleUpdateFilterTimeout.bind(this);const{invertSelection:e,selectedValues:n}=t;this.state={filters:[],invertSelection:e,selectedValues:n,searchText:""}}componentDidMount(){this.initSearchTable()}componentDidUpdate(t,e){const{invertSelection:n,selectedValues:s,table:i}=this.props;t.table!==i&&this.initSearchTable(),t.invertSelection!==n&&this.setState({invertSelection:n}),t.selectedValues!==s&&this.setState({selectedValues:s});const{table:o,searchText:r}=this.state;o!==e.table&&(e.table!=null&&e.table.close(),o!=null&&this.startUpdateFilterTimer()),r!==e.searchText&&this.startUpdateFilterTimer()}componentWillUnmount(){const{table:t}=this.state;t!=null&&t.close(),this.searchTablePromise=void 0,this.stopUpdateFilterTimer()}getColumnName(){const{table:t}=this.props;return t!=null?t.columns[0].name:""}getDisplayedValuesCount(){const{invertSelection:t,selectedValues:e,table:n}=this.state;return n==null?null:t?n.totalSize-e.length:e.length}getDisplayedValueText(){const t=this.getDisplayedValuesCount(),{table:e}=this.state,{formatter:n}=this.props;if(t!=null&&e!=null){const s=n.getFormattedString(t,"long"),i=n.getFormattedString(e.totalSize,"long");let o="";return t<1e6&&(o="Displaying "),`${o}${s} of ${i}`}return null}initSearchTable(){const{table:t}=this.props;if(t==null)return;const e=t.copy();this.searchTablePromise=e,this.searchTablePromise.then(n=>{this.searchTablePromise===e?(this.setState({table:n}),this.searchTablePromise=void 0):n.close()})}handleListChange(t,e){this.setState({selectedValues:t,invertSelection:e});const{onChange:n}=this.props;n(t,e)}handleSearchChange(t){const e=t.target.value;this.setState({searchText:e})}handleSelectAllClick(){this.resetSelection(!0)}handleClearAllClick(){this.resetSelection(!1)}handleUpdateFilterTimeout(){this.updateFilterTimer=void 0,this.updateTableFilter()}resetSelection(t){const e=[];this.setState({invertSelection:t,selectedValues:e});const{onChange:n}=this.props;n(e,t)}startUpdateFilterTimer(){this.stopUpdateFilterTimer(),this.updateFilterTimer=setTimeout(this.handleUpdateFilterTimeout,Lm.searchDebounceTime)}stopUpdateFilterTimer(){this.updateFilterTimer!=null&&(clearTimeout(this.updateFilterTimer),this.updateFilterTimer=void 0)}updateTableFilter(){const{table:t,searchText:e}=this.state,{timeZone:n}=this.props,s=t==null?void 0:t.columns[0],i=[];if(s==null)return;let o;if(e.length>0){let r=null;P.isCharType(s.type)?r=P.makeQuickFilter(s,e):P.isTextType(s.type)?r=P.makeQuickFilter(s,`~${e}`,n):r=P.makeQuickFilter(s,`>=${e}`,n),r!=null?i.push(r):o="Invalid search text"}this.setState({filters:i,error:o})}render(){const{error:t,filters:e,invertSelection:n,selectedValues:s,searchText:i,table:o}=this.state,{formatter:r,showSearch:l}=this.props,a=this.getColumnName(),c=this.getDisplayedValueText(),h=a?`Find ${a}...`:"";return w("div",{className:"advanced-filter-creator-select-value",children:[w("div",{className:l?"form-group":"",children:[d("label",{htmlFor:"advanced-filter-creator-select-value-input",children:"Select Values"}),l&&d("input",{type:"text",className:W("form-control",{"is-invalid":t!=null}),id:"advanced-filter-creator-select-value-input",placeholder:h,value:i,onChange:this.handleSearchChange})]}),d(_m,{table:o,filters:e,invertSelection:n,selectedValues:s,formatter:r,onChange:this.handleListChange}),w("div",{className:"advanced-filter-creator-select-meta-row",children:[w("div",{children:[d("button",{type:"button",className:"btn btn-link",onClick:this.handleSelectAllClick,children:"Select All"}),d("button",{type:"button",className:"btn btn-link",onClick:this.handleClearAllClick,children:"Clear"})]}),d(gt,{in:c!=null,timeout:250,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:d("div",{className:"row-count-info",children:c})})]})]})}};let Nc=Lm;Nc.searchDebounceTime=250;Nc.defaultProps={invertSelection:!0,selectedValues:[],onChange:()=>{},showSearch:!0};const go=X.module("AdvancedFilterCreator"),ei=class extends S.exports.PureComponent{constructor(t){var r,l;super(t),this.getFilterTypes=Ce(a=>P.getFilterTypes(a)),this.handleAddAnd=this.handleAddAnd.bind(this),this.handleAddOr=this.handleAddOr.bind(this),this.handleChangeFilterOperator=this.handleChangeFilterOperator.bind(this),this.handleDone=this.handleDone.bind(this),this.handleFilterChange=this.handleFilterChange.bind(this),this.handleFilterDelete=this.handleFilterDelete.bind(this),this.handleSelectValueChange=this.handleSelectValueChange.bind(this),this.handleReset=this.handleReset.bind(this),this.handleSortDown=this.handleSortDown.bind(this),this.handleSortUp=this.handleSortUp.bind(this),this.handleSubmit=this.handleSubmit.bind(this),this.handleFocusTrapStart=this.handleFocusTrapStart.bind(this),this.handleFocusTrapEnd=this.handleFocusTrapEnd.bind(this),this.handleUpdateTimeout=this.handleUpdateTimeout.bind(this),this.focusTrapContainer=Y.createRef();const{options:e}=t;let{filterOperators:n,invertSelection:s,selectedValues:i}=e;const o=(l=(r=e.filterItems)==null?void 0:r.map(({selectedType:a,value:c})=>({selectedType:a,value:c,key:qe()})))!=null?l:[];o.length===0&&o.push(ei.makeFilterItem()),n==null&&(n=[]),s==null&&(s=!0),i==null&&(i=[]),this.state={filterItems:o,filterOperators:n,invertSelection:s,selectedValues:i,valuesTableError:null,valuesTable:void 0}}static makeFilterItem(){return{key:qe()}}componentDidMount(){this.initValuesTable()}componentWillUnmount(){this.debounceTimeout!=null&&(clearTimeout(this.debounceTimeout),this.sendUpdate()),this.valuesTablePromise!=null&&this.valuesTablePromise.cancel()}getFilterChangeHandler(t){return this.handleFilterChange.bind(this,t)}getFilterDeleteHandler(t){return this.handleFilterDelete.bind(this,t)}initValuesTable(){const{model:t,column:e}=this.props;if(!t.isValuesTableAvailable){go.debug("No values table for this model, just ignore");return}this.valuesTablePromise=P.makeCancelableTablePromise(t.valuesTable(e)),this.valuesTablePromise.then(n=>{const s=n.columns[0].sort().asc();n.applySort([s]),this.setState({valuesTable:n})}).catch(n=>{Re.isCanceled(n)||(go.error("Unable to open values table",n),this.setState({valuesTableError:n}))})}handleFocusTrapEnd(){var t,e;((e=(t=this.focusTrapContainer)==null?void 0:t.current)==null?void 0:e.querySelector("button,select,input,textarea")).focus()}handleFocusTrapStart(){var e,n;const t=(n=(e=this.focusTrapContainer)==null?void 0:e.current)==null?void 0:n.querySelectorAll("button,select,input,textarea");t&&t.length>0&&t[t.length-1].focus()}handleAddAnd(){let{filterItems:t,filterOperators:e}=this.state;t=t.concat(ei.makeFilterItem()),e=e.concat(qt.and),this.setState({filterItems:t,filterOperators:e})}handleAddOr(){let{filterItems:t,filterOperators:e}=this.state;t=t.concat(ei.makeFilterItem()),e=e.concat(qt.or),this.setState({filterItems:t,filterOperators:e})}handleChangeFilterOperator(t){const e=t.currentTarget,{operator:n,index:s}=e.dataset;A(s);const i=parseInt(s,10);let{filterOperators:o}=this.state;o=[...o],Ib(n),o[i]=n,this.setState({filterOperators:o}),this.startUpdateTimer()}handleFilterChange(t,e,n){let{filterItems:s}=this.state;s=[...s];const{key:i}=s[t];s[t]={key:i,selectedType:e,value:n},this.setState({filterItems:s}),this.startUpdateTimer()}handleFilterDelete(t){let{filterItems:e,filterOperators:n}=this.state;e=[...e],n=[...n],t<e.length&&e.splice(t,1),t<n.length?n.splice(t,1):t===n.length&&n.splice(n.length-1,1),e.length===0&&e.push(ei.makeFilterItem()),this.setState({filterItems:e,filterOperators:n}),this.startUpdateTimer()}handleSelectValueChange(t,e){this.setState({selectedValues:t,invertSelection:e}),this.startUpdateTimer()}handleReset(){go.debug("Resetting Advanced Filter"),this.setState({filterItems:[ei.makeFilterItem()],filterOperators:[],selectedValues:[],invertSelection:!0}),this.startUpdateTimer()}handleSortDown(t){const e=xe.isModifierKeyDown(t);this.sortTable(P.sortDirection.descending,e)}handleSortUp(t){const e=xe.isModifierKeyDown(t);this.sortTable(P.sortDirection.ascending,e)}handleSubmit(t){go.debug("Submitting Advanced Filter"),this.stopUpdateTimer(),this.sendUpdate(),t.preventDefault()}handleDone(t){go.debug("Submitting and Closing Advanced Filter"),this.stopUpdateTimer(),this.sendUpdate();const{onDone:e}=this.props;e(),t.preventDefault()}handleUpdateTimeout(){this.debounceTimeout=void 0,this.sendUpdate()}shouldShowAddFilter(){const{filterItems:t}=this.state;if(t.length===0)return!1;const e=t[t.length-1],{selectedType:n,value:s}=e;return n!=null&&n.length>0&&s!=null&&s.length>0}sortTable(t,e=!1){const{column:n,onSortChange:s}=this.props;s(n,t,e)}startUpdateTimer(){this.stopUpdateTimer(),this.debounceTimeout=setTimeout(this.handleUpdateTimeout,ei.debounceFilterUpdate)}stopUpdateTimer(){this.debounceTimeout!==void 0&&(clearTimeout(this.debounceTimeout),this.debounceTimeout=void 0)}sendUpdate(){const{filterItems:t,filterOperators:e,invertSelection:n,selectedValues:s}=this.state,{column:i,onFilterChange:o,model:r}=this.props,{formatter:l}=r,a=t.filter(({selectedType:m,value:p})=>m!=null&&p!=null&&p!==""),c=e.filter((m,p)=>m!=null&&t[p].selectedType!=null&&t[p].value!=null&&t[p].value!=="").slice(0,a.length-1),h={filterItems:a,filterOperators:c,invertSelection:n,selectedValues:s},u=P.makeAdvancedFilter(i,h,l.timeZone);o(i,u,h)}render(){const{column:t,model:e,sortDirection:n,formatter:s}=this.props,{filterItems:i,filterOperators:o,invertSelection:r,selectedValues:l,valuesTable:a,valuesTableError:c}=this.state,{isValuesTableAvailable:h}=e,u=P.isBooleanType(t.type),m=P.isDateType(t.type),p=this.getFilterTypes(t.type),g=t.type.substring(t.type.lastIndexOf(".")+1),f=[];if(!u&&p.length)for(let v=0;v<i.length;v+=1){const T=i[v],{key:E,selectedType:y,value:I}=T,D=d(Dc,{column:t,filterTypes:p,onChange:this.getFilterChangeHandler(v),onDelete:this.getFilterDeleteHandler(v),selectedType:y,value:I,formatter:s},E);if(f.push(D),v<o.length){const x=o[v]===qt.and,B=w("div",{className:"form-row justify-content-end advanced-filter-creator-filter-operator",children:[d("button",{type:"button",className:W("btn btn-link filter-operator",{active:x}),onClick:this.handleChangeFilterOperator,"data-index":v,"data-operator":qt.and,children:"AND"}),d("button",{type:"button",className:W("btn btn-link filter-operator",{active:!x}),onClick:this.handleChangeFilterOperator,"data-index":v,"data-operator":qt.or,children:"OR"})]},`filterOperator${E}`);f.push(B)}}const b=this.shouldShowAddFilter(),C=w("div",{className:W("form-row justify-content-end add-filter-item",{hidden:!b}),children:[d("span",{className:"text-muted",children:d(z,{icon:As})}),w("button",{type:"button",className:"btn btn-link btn-filter-item",onClick:this.handleAddAnd,disabled:!b,children:["AND",d(pe,{children:"Add filter with AND"})]}),w("button",{type:"button",className:"btn btn-link btn-filter-item",onClick:this.handleAddOr,disabled:!b,children:["OR",d(pe,{children:"Add filter with OR"})]})]},"addFilterItem");return f.push(C),w("div",{className:"advanced-filter-creator",role:"presentation",children:[d("div",{tabIndex:0,onFocus:this.handleFocusTrapStart}),w("form",{onSubmit:this.handleSubmit,ref:this.focusTrapContainer,children:[w("div",{className:"title-bar",children:[d("h6",{className:"advanced-filter-title",children:"Advanced Filters"}),w("div",{className:"advanced-filter-menu-buttons",children:[w("button",{type:"button",className:W("btn btn-link btn-link-icon sort-operator",{active:n===P.sortDirection.descending}),onClick:this.handleSortDown,children:[d(z,{icon:gd}),w(pe,{children:["Sort ",t.name," Descending"]})]}),w("button",{type:"button",className:W("btn btn-link btn-link-icon sort-operator",{active:n===P.sortDirection.ascending}),onClick:this.handleSortUp,children:[d(z,{rotation:180,icon:gd}),w(pe,{children:["Sort ",t.name," Ascending"]})]})]})]}),d("hr",{}),w("div",{className:"advanced-filter-column-name",children:[t.name,"\xA0",w("span",{className:"column-type",children:["(",g,")"]})]}),f,h&&c==null&&w(ue,{children:[!u&&d("hr",{}),d("div",{className:"form-group",children:d(Nc,{table:a,onChange:this.handleSelectValueChange,invertSelection:r,selectedValues:l,formatter:s,showSearch:!m,timeZone:s.timeZone})})]}),w("div",{className:"form-row justify-content-end",children:[d("button",{type:"button",className:"btn btn-outline-primary mr-2",onClick:this.handleReset,children:"Reset"}),d("button",{type:"button",className:"btn btn-primary",onClick:this.handleDone,children:"Done"})]})]}),d("div",{tabIndex:0,onFocus:this.handleFocusTrapEnd})]})}};let Mc=ei;Mc.debounceFilterUpdate=250;Mc.defaultProps={options:{filterItems:null,filterOperators:null,invertSelection:!0,selectedValues:[]},sortDirection:null};function F0(t,e){const n=L0(t);return n===void 0?void 0:`${V0(t)} ? ${n} : ${e}`}function x0(t){return dh.Column.formatRowColor(t)}function _0(t,e){return t.formatColor(e)}const ra=X.module("ConditionalFormattingUtils");var qn=(t=>(t.CONDITIONAL="conditional",t.ROWS="rows",t))(qn||{}),Qe=(t=>(t.IS_EQUAL="is-equal",t.IS_NOT_EQUAL="is-not-equal",t.IS_BETWEEN="is-between",t.GREATER_THAN="greater-than",t.GREATER_THAN_OR_EQUAL="greater-than-or-equal",t.LESS_THAN="less-than",t.LESS_THAN_OR_EQUAL="less-than-or-equal",t.IS_NULL="is-null",t.IS_NOT_NULL="is-not-null",t))(Qe||{}),ln=(t=>(t.IS_EXACTLY="is-exactly",t.IS_NOT_EXACTLY="is-not-exactly",t.CONTAINS="contains",t.DOES_NOT_CONTAIN="does-not-contain",t.STARTS_WITH="starts-with",t.ENDS_WITH="ends-with",t.IS_NULL="is-null",t.IS_NOT_NULL="is-not-null",t))(ln||{}),Ht=(t=>(t.IS_EXACTLY="is-exactly",t.IS_NOT_EXACTLY="is-not-exactly",t.IS_BEFORE="is-before",t.IS_BEFORE_OR_EQUAL="is-before-or-equal",t.IS_AFTER="is-after",t.IS_AFTER_OR_EQUAL="is-after-or-equal",t.IS_NULL="is-null",t.IS_NOT_NULL="is-not-null",t))(Ht||{}),Do=(t=>(t.IS_TRUE="is-true",t.IS_FALSE="is-false",t.IS_NULL="is-null",t.IS_NOT_NULL="is-not-null",t))(Do||{}),oi=(t=>(t.IS_EQUAL="is-equal",t.IS_NOT_EQUAL="is-not-equal",t.IS_NULL="is-null",t.IS_NOT_NULL="is-not-null",t))(oi||{}),Un=(t=>(t.NO_FORMATTING="no-formatting",t.POSITIVE="positive",t.NEGATIVE="negative",t.WARN="warn",t.NEUTRAL="neutral",t.ACCENT_1="accent-1",t.ACCENT_2="accent-2",t.CUSTOM="custom",t))(Un||{});function oh(t){switch(t){case"no-formatting":return"No formatting";case"positive":return"Positive";case"negative":return"Negative";case"warn":return"Warn";case"neutral":return"Neutral";case"accent-1":return"Accent 1";case"accent-2":return"Accent 2";case"custom":return"Custom..."}}function Xr(t){const{type:e,customConfig:n}=t;switch(e){case"no-formatting":return;case"positive":return"#9fde6f";case"negative":return"#ff6087";case"warn":return"#f67f40";case"neutral":return"#ffd95c";case"accent-1":return"#78dce8";case"accent-2":return"#ab9bf5";case"custom":return n==null?void 0:n.background;default:return}}function jr(t){const{type:e,customConfig:n}=t;switch(e){case"no-formatting":return;case"positive":return"#526a3f";case"negative":return"#802f44";case"warn":return"#663318";case"neutral":return"#63562b";case"accent-1":return"#3f6469";case"accent-2":return"#554d72";case"custom":return n==null?void 0:n.color;default:return}}function L0(t){const e=jr(t.style),n=Xr(t.style);if(!(e===void 0||n===void 0))return`bgfg(\`${n}\`, \`${e}\`)`}function k0(t){const{column:e,value:n,start:s,end:i}=t;return Q0(e.name,t.condition,n,s,i)}function O0(t){const{column:e,value:n}=t;return Z0(e.name,t.condition,n)}function A0(t){const{column:e,value:n}=t;return J0(e.name,t.condition,n)}function P0(t){const{column:e}=t;return ev(e.name,t.condition)}function H0(t){const{column:e,value:n}=t;return tv(e.name,t.condition,n)}function V0(t){const{column:e}=t;if(P.isNumberType(e.type))return k0(t);if(P.isCharType(e.type))return H0(t);if(P.isStringType(e.type))return O0(t);if(P.isDateType(e.type))return A0(t);if(P.isBooleanType(e.type))return P0(t);throw new Error("Invalid column type")}function U0(t){switch(t){case"is-equal":return"is equal to";case"is-not-equal":return"is not equal to";case"is-between":return"is between";case"greater-than":return"greater than";case"greater-than-or-equal":return"greater than or equal to";case"less-than":return"less than";case"less-than-or-equal":return"less than or equal to";case"is-null":return"is null";case"is-not-null":return"is not null"}}function B0(t){switch(t){case"is-exactly":return"is exactly";case"is-not-exactly":return"is not exactly";case"contains":return"contains";case"does-not-contain":return"does not contain";case"starts-with":return"starts with";case"ends-with":return"ends with";case"is-null":return"is null";case"is-not-null":return"is not null"}}function $0(t){switch(t){case"is-exactly":return"is";case"is-not-exactly":return"is not";case"is-before":return"is before";case"is-before-or-equal":return"is before or equal";case"is-after":return"is after";case"is-after-or-equal":return"is after or equal";case"is-null":return"is null";case"is-not-null":return"is not null"}}function W0(t){switch(t){case"is-true":return"is true";case"is-false":return"is false";case"is-null":return"is null";case"is-not-null":return"is not null"}}function z0(t){switch(t){case"is-equal":return"is";case"is-not-equal":return"is not";case"is-null":return"is null";case"is-not-null":return"is not null"}}function km(t){if(P.isNumberType(t)||P.isCharType(t))return"is-equal";if(P.isStringType(t)||P.isDateType(t))return"is-exactly";if(P.isBooleanType(t))return"is-true";throw new Error("Invalid column type")}function G0(t){if(P.isCharType(t)||P.isStringType(t))return""}function Om(t){const{condition:e,value:n,start:s,end:i}=t;return{condition:e,value:n,start:s,end:i}}function Dl(t){return{condition:km(t),value:G0(t),start:void 0,end:void 0}}function Am(){return{type:"no-formatting"}}function K0(t){switch(t){case"is-exactly":return"==";case"is-not-exactly":return"!=";case"contains":return"contains";case"does-not-contain":return"does not contain";case"starts-with":return"starts with";case"ends-with":return"ends with";case"is-null":return"is null";case"is-not-null":return"is not null"}}function q0(t){switch(t){case"is-exactly":return"==";case"is-not-exactly":return"!=";case"is-before":return"<";case"is-before-or-equal":return"<=";case"is-after":return">";case"is-after-or-equal":return">=";case"is-null":return"is null";case"is-not-null":return"is not null"}}function Y0(t){switch(t){case"is-true":return"is true";case"is-false":return"is false";case"is-null":return"is null";case"is-not-null":return"is not null"}}function X0(t){switch(t){case"is-equal":return"==";case"is-not-equal":return"!=";case"is-null":return"is null";case"is-not-null":return"is not null"}}function j0(t){switch(t){case"is-equal":return"==";case"is-not-equal":return"!=";case"is-between":return"==";case"greater-than":return">";case"greater-than-or-equal":return">=";case"less-than":return"<";case"less-than-or-equal":return"<=";case"is-null":return"is null";case"is-not-null":return"is not null"}}function Q0(t,e,n,s,i){switch(e){case"is-equal":return`${t} == ${n}`;case"is-not-equal":return`${t} != ${n}`;case"is-between":return`${t} > ${s} && ${t} < ${i}`;case"greater-than":return`${t} > ${n}`;case"greater-than-or-equal":return`${t} >= ${n}`;case"less-than":return`${t} < ${n}`;case"less-than-or-equal":return`${t} <= ${n}`;case"is-null":return`${t} == null`;case"is-not-null":return`${t} != null`}}function Z0(t,e,n){switch(e){case"is-exactly":return`${t} == "${n}"`;case"is-not-exactly":return`${t} != "${n}"`;case"contains":return`${t} != null && ${t}.contains("${n}")`;case"does-not-contain":return`${t} != null && !${t}.contains("${n}")`;case"starts-with":return`${t} != null && ${t}.startsWith("${n}")`;case"ends-with":return`${t} != null && ${t}.endsWith("${n}")`;case"is-null":return`${t} == null`;case"is-not-null":return`${t} != null`}}function J0(t,e,n){switch(e){case"is-exactly":return`${t} == convertDateTime("${n}")`;case"is-not-exactly":return`${t} != convertDateTime(\`${n}\`)`;case"is-before":return`${t} < convertDateTime(\`${n}\`)`;case"is-before-or-equal":return`${t} <= convertDateTime("${n}")`;case"is-after":return`${t} > convertDateTime(\`${n}\`)`;case"is-after-or-equal":return`${t} >= convertDateTime(\`${n}\`)`;case"is-null":return`${t} == null`;case"is-not-null":return`${t} != null`}}function ev(t,e){switch(e){case"is-true":return`${t} == true`;case"is-false":return`${t} == false`;case"is-null":return`${t} == null`;case"is-not-null":return`${t} != null`}}function tv(t,e,n){switch(e){case"is-equal":return`${t} == '${n}'`;case"is-not-equal":return`${t} != '${n}'`;case"is-null":return`isNull(${t})`;case"is-not-null":return`!isNull(${t})`}}function nv(t,e){if(P.isNumberType(t))return j0(e);if(P.isCharType(t))return X0(e);if(P.isStringType(t))return K0(e);if(P.isDateType(t))return q0(e);if(P.isBooleanType(t))return Y0(e);throw new Error("Invalid column type")}function sv(t,e){if(e===void 0)return ra.debug("no rules passed."),[];const n=[];let s;const i=new Map;return e.forEach(({config:o,type:r})=>{var g;const{column:l}=o,a=t.find(({name:f,type:b})=>f===l.name&&b===l.type);if(a===void 0){ra.debug(`Column ${l.name}:${l.type} not found. Ignoring format rule.`,o);return}const[c,h]=(g=r==="conditional"?i.get(a.name):s)!=null?g:["null",void 0],u=F0(o,c);if(u===void 0){ra.debug("Ignoring format rule.",o);return}const m=h===void 0?-1:n.indexOf(h);m>-1&&n.splice(m,1);const p=r==="conditional"?_0(a,u):x0(u);n.push(p),r==="conditional"?i.set(a.name,[u,p]):s=[u,p]}),n}function iv({type:t}){return P.isNumberType(t)||P.isCharType(t)||P.isStringType(t)||P.isDateType(t)||P.isBooleanType(t)}const Nl=({animation:t="iris-grid-bottom-bar-slide-up",children:e,className:n,isShown:s,onClick:i,onEntering:o,onEntered:r,onExiting:l,onExited:a})=>d(gt,{in:s,timeout:It.transitionMs,classNames:t,onEntering:o,onEntered:r,onExiting:l,onExited:a,mountOnEnter:!0,unmountOnExit:!0,children:d("div",{className:W("iris-grid-bottom-bar",n),role:"presentation",onClick:i,onKeyPress:i,children:e})});const ov=3e3,rv=5,lv=({isSaving:t=!1,onSave:e,onDiscard:n,discardTooltip:s,saveTooltip:i,error:o,pendingDataErrors:r,pendingDataMap:l,onEntering:a,onEntered:c,onExiting:h,onExited:u})=>{const[m,p]=S.exports.useState(!1),[g,f]=S.exports.useState(!1),b=S.exports.useRef(),C=dl(t),v=S.exports.useMemo(()=>r.size===0?o:r.size<=rv?`Key can't be empty (on pending row${r.size>1?"s":""} ${Array.from(r.keys()).join(", ").trim()})`:`Key can't be empty (on ${r.size} rows)`,[o,r]);S.exports.useEffect(function(){C!=null&&C&&!t&&v==null&&(p(!0),f(!0),b.current=setTimeout(()=>{p(!1)},ov))},[v,t,C]),S.exports.useEffect(function(){b.current&&l.size>0&&(clearTimeout(b.current),p(!1),f(!1))},[l]),S.exports.useEffect(function(){return()=>b.current?clearTimeout(b.current):void 0},[]);const T=l.size;let E;return t?E=d(Ln,{}):g&&(E=Qa),w(Nl,{className:"pending-data-bottom-bar",isShown:T>0||m||v!=null,onEntering:a,onEntered:c,onExiting:h,onExited:()=>{f(!1),u&&u()},children:[v!=null&&v!==""&&w("div",{className:"error-message",children:[d(z,{icon:hs}),d("span",{children:`${v}`})]}),(v==null||v==="")&&d("div",{className:"status-message",children:T>0&&d("span",{children:`${T} row${T>1?"s":""} pending`})}),w("div",{className:"buttons-container",children:[!t&&!g&&d(ce,{kind:"secondary",onClick:n,tooltip:s,children:"Discard"}),w(ce,{kind:g?"success":"primary",onClick:e,icon:E,disabled:t||g||v!=null,tooltip:i,children:[t&&"Committing...",!t&&g&&"Success",!t&&!g&&"Commit"]})]})]})},fo=X.module("IrisGridUtils");function ys(t,e){return t>=0&&t<e.length}class te{static dehydrateGridState(e,n){const{isStuckToBottom:s,isStuckToRight:i,movedColumns:o,movedRows:r}=n,{columns:l}=e;return{isStuckToBottom:s,isStuckToRight:i,movedColumns:[...o].filter(({to:a,from:c})=>ys(a,l)&&(typeof c=="number"&&ys(c,l)||Array.isArray(c)&&ys(c[0],l)&&ys(c[1],l))).map(({to:a,from:c})=>({to:l[a].name,from:Array.isArray(c)?[l[c[0]].name,l[c[1]].name]:l[c].name})),movedRows:[...r]}}static hydrateGridState(e,n,s=[]){const{isStuckToBottom:i,isStuckToRight:o,movedColumns:r,movedRows:l}=n,{columns:a}=e,c=te.parseCustomColumnNames(s),h=a.map(({name:u})=>u).concat(c);return{isStuckToBottom:i,isStuckToRight:o,movedColumns:[...r].map(({to:u,from:m})=>{const p=g=>typeof g=="string"?h.findIndex(f=>f===g):g;return{to:p(u),from:Array.isArray(m)?[p(m[0]),p(m[1])]:p(m)}}).filter(({to:u,from:m})=>ys(u,h)&&(typeof m=="number"&&ys(m,h)||Array.isArray(m)&&ys(m[0],h)&&ys(m[1],h))),movedRows:[...l]}}static dehydrateIrisGridState(e,n){const{aggregationSettings:s={aggregations:[],showOnTop:!1},advancedFilters:i,customColumnFormatMap:o,isFilterBarShown:r,metrics:l,quickFilters:a,customColumns:c,conditionalFormats:h=[],reverseType:u,rollupConfig:m=void 0,showSearchBar:p,searchValue:g,selectDistinctColumns:f=[],selectedSearchColumns:b,sorts:C,invertSearchColumns:v,pendingDataMap:T=new Map,frozenColumns:E}=n;A(l);const{userColumnWidths:y,userRowHeights:I}=l,{columns:D}=e;return{advancedFilters:te.dehydrateAdvancedFilters(D,i),aggregationSettings:s,customColumnFormatMap:[...o],isFilterBarShown:r,quickFilters:te.dehydrateQuickFilters(a),sorts:te.dehydrateSort(C),userColumnWidths:[...y].filter(([M])=>M!=null&&M>=0&&M<D.length).map(([M,x])=>[D[M].name,x]),userRowHeights:[...I],customColumns:[...c],conditionalFormats:[...h],reverseType:u,rollupConfig:m,showSearchBar:p,searchValue:g,selectDistinctColumns:[...f],selectedSearchColumns:b,invertSearchColumns:v,pendingDataMap:te.dehydratePendingDataMap(D,T),frozenColumns:E}}static hydrateIrisGridState(e,n){const{advancedFilters:s,aggregationSettings:i={aggregations:[],showOnTop:!1},customColumnFormatMap:o,isFilterBarShown:r,quickFilters:l,sorts:a,customColumns:c,conditionalFormats:h,userColumnWidths:u,userRowHeights:m,reverseType:p,rollupConfig:g=void 0,showSearchBar:f,searchValue:b,selectDistinctColumns:C,selectedSearchColumns:v,invertSearchColumns:T=!0,pendingDataMap:E=[],frozenColumns:y}=n,{columns:I,formatter:D}=e;return{advancedFilters:te.hydrateAdvancedFilters(I,s,D.timeZone),aggregationSettings:i,customColumnFormatMap:new Map(o),isFilterBarShown:r,quickFilters:te.hydrateQuickFilters(I,l,D.timeZone),sorts:te.hydrateSort(I,a),userColumnWidths:new Map(u.map(([M,x])=>typeof M=="string"||M instanceof String?[I.findIndex(({name:B})=>B===M),x]:[M,x]).filter(([M])=>M!=null&&M>=0&&M<I.length)),customColumns:c,conditionalFormats:h,userRowHeights:new Map(m),reverseType:p,rollupConfig:g,showSearchBar:f,searchValue:b,selectDistinctColumns:C,selectedSearchColumns:v,invertSearchColumns:T,pendingDataMap:te.hydratePendingDataMap(I,E),frozenColumns:y}}static dehydrateIrisGridPanelState(e,n){const{isSelectingPartition:s,partition:i,partitionColumn:o}=n;return{isSelectingPartition:s,partition:i,partitionColumn:o!=null?o.name:null}}static hydrateIrisGridPanelState(e,n){const{isSelectingPartition:s,partition:i,partitionColumn:o}=n,{columns:r}=e;return{isSelectingPartition:s,partition:i,partitionColumn:o!=null?te.getColumnByName(r,o):void 0}}static dehydrateQuickFilters(e){return[...e].map(([n,s])=>{const{text:i}=s;return[n,{text:i}]})}static hydrateQuickFilters(e,n,s){const i=n.map(([o,r])=>{const{text:l}=r;let a=null;try{const c=te.getColumn(e,o);c!=null&&(a=P.makeQuickFilter(c,l,s))}catch(c){fo.error("hydrateQuickFilters error with",l,c)}return[o,{text:l,filter:a}]});return new Map(i)}static dehydrateAdvancedFilters(e,n){return[...n].map(([s,i])=>{const o=te.getColumn(e,s);A(o);const r=te.dehydrateAdvancedFilterOptions(o,i.options);return[s,{options:r}]})}static hydrateAdvancedFilters(e,n,s){const i=n.map(([o,r])=>{const l=te.getColumn(e,o);A(l);const a=te.hydrateAdvancedFilterOptions(l,r.options);let c=null;try{te.getColumn(e,o)!=null&&(c=P.makeAdvancedFilter(l,a,s))}catch(h){fo.error("hydrateAdvancedFilters error with",a,h)}return[o,{options:a,filter:c}]});return new Map(i)}static dehydrateAdvancedFilterOptions(e,n){const{selectedValues:s,...i}=n;return{selectedValues:s==null?void 0:s.map(o=>te.dehydrateValue(o,e==null?void 0:e.type)),...i}}static hydrateAdvancedFilterOptions(e,n){const{selectedValues:s,...i}=n;return{selectedValues:s==null?void 0:s.map(o=>te.hydrateValue(o,e==null?void 0:e.type)),...i}}static dehydratePendingDataMap(e,n){return[...n].map(([s,{data:i}])=>[s,{data:[...i].map(([o,r])=>[e[o].name,te.dehydrateValue(r,e[o].type)])}])}static hydratePendingDataMap(e,n){const s=new Map,i=o=>(s.has(o)||s.set(o,e.findIndex(({name:r})=>r===o)),s.get(o));return new Map(n.map(([o,{data:r}])=>[o,{data:new Map(r.map(([l,a])=>{var h;const c=i(l);return A(c),[(h=i(l))!=null?h:null,te.hydrateValue(a,e[c].type)]}))}]))}static dehydrateValue(e,n){return P.isDateType(n)?te.dehydrateDateTime(e):P.isLongType(n)?te.dehydrateLong(e):e}static hydrateValue(e,n){return P.isDateType(n)?te.hydrateDateTime(e):P.isLongType(n)?te.hydrateLong(e):e}static dehydrateDateTime(e){return e!=null?N.i18n.DateTimeFormat.format(ms.FULL_DATE_FORMAT,e):null}static hydrateDateTime(e){return e!=null?N.i18n.DateTimeFormat.parse(ms.FULL_DATE_FORMAT,e):null}static dehydrateLong(e){return e!=null?`${e}`:null}static hydrateLong(e){return e!=null?N.LongWrapper.ofString(e):null}static dehydrateSort(e){return e.map(n=>{const{column:s,isAbs:i,direction:o}=n;return{column:s.index,isAbs:i,direction:o}})}static hydrateSort(e,n){return n.map(s=>{const{column:i,isAbs:o,direction:r}=s;if(r===P.sortDirection.reverse)return N.Table.reverse();const l=te.getColumn(e,i);if(l!=null){let a=l.sort();return o&&(a=a.abs()),r===P.sortDirection.descending?a=a.desc():a=a.asc(),a}return null}).filter(s=>s!=null&&s.direction!==P.sortDirection.reverse)}static extractTableSettings(e,n=[]){const{irisGridPanelState:s,irisGridState:i}=e,{partitionColumn:o,partition:r}=s,{advancedFilters:l,quickFilters:a,sorts:c}=i;return{advancedFilters:l,inputFilters:n,partition:r,partitionColumn:o,quickFilters:a,sorts:c}}static applyTableSettings(e,n,s){const{columns:i}=e;let o=[];n.quickFilters&&(o=te.getFiltersFromFilterMap(te.hydrateQuickFilters(i,n.quickFilters,s)));let r=[];n.advancedFilters&&(r=te.getFiltersFromFilterMap(te.hydrateAdvancedFilters(i,n.advancedFilters,s)));const l=te.getFiltersFromInputFilters(i,n.inputFilters,s);let a=[];n.sorts&&(a=te.hydrateSort(i,n.sorts));let c=[...o,...r];const{partition:h,partitionColumn:u}=n;if(h!=null&&u!=null){const m=te.getColumnByName(i,u);m&&(c=[m.filter().eq(N.FilterValue.ofString(h)),...c])}c=[...l,...c],e.applyFilter(c),e.applySort(a)}static getInputFiltersForColumns(e,n=[]){return n.filter(({name:s,type:i})=>e.find(({name:o,type:r})=>o===s&&r===i))}static getFiltersFromInputFilters(e,n=[],s){return n.map(({name:i,type:o,value:r})=>{const l=e.find(({name:a,type:c})=>a===i&&c===o);if(l)try{return P.makeQuickFilter(l,r,s)}catch(a){fo.debug("Unable to create input filter",a)}return null}).filter(i=>i!=null)}static getFiltersFromFilterMap(e){const n=[],s=Array.from(e.keys());for(let i=0;i<s.length;i+=1){const o=s[i],r=e.get(o);r&&r.filter!=null&&n.push(r.filter)}return n}static getHiddenColumns(e){return[...e.entries()].filter(([,n])=>n===0).map(([n])=>n)}static parseCustomColumnNames(e){return e.map(n=>n.split("=")[0])}static getRemovedCustomColumnNames(e,n){const s=te.parseCustomColumnNames(e),i=te.parseCustomColumnNames(n);return s.filter(o=>!i.includes(o))}static removeSortsInColumns(e,n){return e.filter(s=>!n.includes(s.column.name))}static removeFiltersInColumns(e,n,s){const i=e.map(({name:r})=>r),o=new Map(n);return s.forEach(r=>o.delete(i.indexOf(r))),o}static removeColumnFromMovedColumns(e,n,s){const i=e.map(({name:r})=>r);let o=[...n];for(let r=0;r<s.length;r+=1){const l=s[r];let a=i.findIndex(h=>h===l);const c=[];for(let h=0;h<o.length;h+=1){const u=o[h],m={...u};let[p,g]=Array.isArray(u.from)?u.from:[u.from,u.from];a<=u.to&&(m.to-=1),a<p&&(p-=1),a<=g&&(g-=1),p<=g&&p!==m.to&&(p===g?c.push({...m,from:p}):c.push({...m,from:[p,g]})),a=K.applyItemMoves(a,a,[u])[0][0]}o=c,i.splice(i.findIndex(h=>h===l),1)}return o}static removeColumnsFromSelectDistinctColumns(e,n){return e.filter(s=>!n.includes(s))}static getVisibleColumnsInRange(e,n,s,i,o){const r=[];for(let l=n;l<=s;l+=1){const a=K.getModelIndex(l,i);a>=0&&a<e.length&&!o.includes(a)&&r.push(e[a])}return r}static getPrevVisibleColumns(e,n,s,i,o){const r=[];let l=n;for(;l>=0&&r.length<s;){const a=K.getModelIndex(l,i);a>=0&&a<e.length&&!o.includes(a)&&r.unshift(e[a]),l-=1}return r}static getNextVisibleColumns(e,n,s,i,o){const r=[];let l=n;for(;l<e.length&&r.length<s;){const a=K.getModelIndex(l,i);a>=0&&a<e.length&&!o.includes(a)&&r.push(e[a]),l+=1}return r}static getColumnsToFetch(e,n,s){const i=[...n];return s.forEach(o=>{const r=e.find(({name:l})=>l===o);r!=null&&!n.includes(r)&&i.push(r)}),i}static getModelViewportColumns(e,n,s,i,o=[],r=[],l=0){if(n==null||s==null)return null;const a=te.getVisibleColumnsInRange(e,n,s,i,o),c=a.length*l,h=te.getPrevVisibleColumns(e,n-1,c,i,o),u=te.getNextVisibleColumns(e,s+1,c,i,o),m=[...h,...a,...u];return te.getColumnsToFetch(e,m,r)}static rangeSetFromRanges(e){const n=e.slice().sort((s,i)=>(A(s.startRow),A(i.startRow),s.startRow-i.startRow)).map(s=>{const{startRow:i,endRow:o}=s;return A(i),A(o),N.RangeSet.ofRange(i,o)});return N.RangeSet.ofRanges(n)}static isValidSnapshotRanges(e){if(e==null||e.length===0)return!1;const n=new Map;for(let o=0;o<e.length;o+=1){const r=e[o],l=`${r.startRow}:${r.endRow}`,a=`${r.startColumn}:${r.endColumn}`;n.has(l)||n.set(l,[]),n.get(l).push(a)}const s=[...n.keys()],i=n.get(s[0]).sort().join(",");for(let o=1;o<s.length;o+=1)if(n.get(s[o]).sort().join(",")!==i)return!1;return!0}static isValidIndex(e){return!Number.isInteger(e)||typeof e!="number"?!1:e>=0}static columnsFromRanges(e,n){var i,o;if(e==null||e.length===0)return[];if(e[0].startColumn===null&&e[0].endColumn===null)return n;const s=new Set;for(let r=0;r<e.length;r+=1){const l=e[r];A(l.startColumn),A(l.endColumn);for(let a=(i=l.startColumn)!=null?i:0;a<=((o=l.endColumn)!=null?o:n.length-1);a+=1)s.add(a)}return[...s].map(r=>n[r])}static snapshotDataToMatrix(e){const{columns:n,rows:s}=e,i=[];for(let o=0;o<s.length;o+=1){const r=s[o],l=[];for(let a=0;a<n.length;a+=1){const c=n[a],h=r.get(c);l.push(h)}i.push(l)}return i}static getModelRollupConfig(e,n,s){var u,m,p;if(((m=(u=n==null?void 0:n.columns)==null?void 0:u.length)!=null?m:0)===0)return null;const{columns:i=[],showConstituents:o=!0,showNonAggregatedColumns:r=!0,includeDescriptions:l=!0}=n!=null?n:{},{aggregations:a=[]}=s!=null?s:{},c=a.map(({operation:g,selected:f,invert:b})=>Ls.isRollupOperation(g)?[]:Ls.getOperationColumnNames(e,g,f,b)),h={};for(let g=0;g<a.length;g+=1)h[a[g].operation]=c[g];if(r){const g=new Set(e.map(f=>f.name).filter(f=>!i.includes(f)));if(c.forEach(f=>{f.forEach(b=>g.delete(b))}),g.size>0){const f=(p=h[Ve.FIRST])!=null?p:[];h[Ve.FIRST]=[...f,...g]}}return{groupingColumns:i,includeConstituents:o,includeDescriptions:l,aggregations:h}}static getPendingErrors(e){e.forEach((n,s)=>{if(!te.isValidIndex(s))throw new Error(`Invalid rowIndex ${s}`);const{data:i}=n;i.forEach((o,r)=>{if(!te.isValidIndex(r))throw new Error(`Invalid columnIndex ${r}`)})})}static getColumn(e,n){return n<e.length?e[n]:(fo.error("Unable to retrieve column",n,">=",e.length),null)}static getColumnByName(e,n){const s=e.find(({name:i})=>i===n);return s==null&&fo.error("Unable to retrieve column by name",n,e.map(({name:i})=>i)),s}static changeFilterColumnNamesToIndexes(e,n){return n.map(({name:s,filter:i})=>{const o=e.findIndex(r=>r.name===s);return o<0?null:[o,i]}).filter(s=>s!=null)}}const tn=X.module("IrisGridCopyHandler"),$e=class extends S.exports.Component{constructor(t){super(t),this.handleBackgroundClick=this.handleBackgroundClick.bind(this),this.handleCancelClick=this.handleCancelClick.bind(this),this.handleCopyClick=this.handleCopyClick.bind(this),this.handleHideTimeout=this.handleHideTimeout.bind(this),this.state={error:void 0,copyState:$e.COPY_STATES.IDLE,buttonState:$e.BUTTON_STATES.COPY,isShown:!1,rowCount:0}}static getStatusMessageText(t,e){switch(t){case $e.COPY_STATES.CONFIRMATION_REQUIRED:return`Are you sure you want to copy ${e.toLocaleString()} rows to your clipboard?`;case $e.COPY_STATES.CLICK_REQUIRED:return`Fetched ${e.toLocaleString()} rows!`;case $e.COPY_STATES.FETCH_ERROR:return"Unable to copy data.";case $e.COPY_STATES.FETCH_IN_PROGRESS:return`Fetching ${e.toLocaleString()} rows for clipboard...`;case $e.COPY_STATES.DONE:return"Copied to Clipboard!";default:return""}}static getCopyButtonText(t){switch(t){case $e.BUTTON_STATES.FETCH_IN_PROGRESS:return"Fetching";case $e.BUTTON_STATES.CLICK_TO_COPY:return"Click to Copy";case $e.BUTTON_STATES.RETRY:return"Retry";default:return"Copy"}}componentDidMount(){const{copyOperation:t}=this.props;t!=null&&this.startCopy()}componentDidUpdate(t){const{copyOperation:e}=this.props;t.copyOperation!==e&&this.startCopy()}componentWillUnmount(){this.stopCopy()}startCopy(){tn.debug2("startCopy"),this.stopCopy();const{copyOperation:t}=this.props;if(t==null){tn.debug2("No copy operation set, cancelling out"),this.setState({isShown:!1});return}const{ranges:e,error:n}=t;if(n!=null){tn.debug("Showing copy error",n),this.setState({isShown:!0,copyState:$e.COPY_STATES.DONE,error:n}),this.startHideTimer();return}const s=oe.rowCount(e);this.setState({rowCount:s,isShown:!0,error:void 0}),s>$e.NO_PROMPT_THRESHOLD?this.setState({buttonState:$e.BUTTON_STATES.COPY,copyState:$e.COPY_STATES.CONFIRMATION_REQUIRED}):this.startFetch()}stopCopy(){this.textData=void 0,this.stopFetch(),this.stopHideTimer()}handleBackgroundClick(){tn.debug2("handleBackgroundClick");const{copyState:t}=this.state;t===$e.COPY_STATES.DONE&&this.setState({isShown:!1})}handleCancelClick(){tn.debug2("handleCancelClick"),this.stopFetch(),this.setState({isShown:!1})}handleCopyClick(){tn.debug2("handleCopyClick"),this.textData!=null?this.copyText(this.textData):this.startFetch()}handleHideTimeout(){tn.debug2("handleHideTimeout"),this.stopHideTimer(),this.setState({isShown:!1})}copyText(t){tn.debug2("copyText",t),this.textData=t,xe.copyToClipboard(t).then(()=>{this.setState({copyState:$e.COPY_STATES.DONE}),this.startHideTimer()},e=>{tn.error("copyText error",e),this.setState({buttonState:$e.BUTTON_STATES.CLICK_TO_COPY,copyState:$e.COPY_STATES.CLICK_REQUIRED})})}startFetch(){this.stopFetch(),this.setState({buttonState:$e.BUTTON_STATES.FETCH_IN_PROGRESS,copyState:$e.COPY_STATES.FETCH_IN_PROGRESS});const{model:t,copyOperation:e}=this.props,{ranges:n,includeHeaders:s,userColumnWidths:i,movedColumns:o,formatValues:r}=e;tn.debug("startFetch",n);const l=te.getHiddenColumns(i);let a=K.getModelRanges(n,o);if(l.length>0){const h=l.map(oe.makeColumn);a=oe.subtractRangesFromRanges(a,h)}const c=r!=null&&r?(h,u)=>t.displayString(h,u.type,u.name):h=>`${h}`;this.fetchPromise=Re.makeCancelable(t.textSnapshot(a,s,c)),this.fetchPromise.then(h=>{this.fetchPromise=void 0,this.copyText(h)}).catch(h=>{h instanceof ci?tn.debug("User cancelled copy."):(tn.error("Error fetching contents",h),this.fetchPromise=void 0,this.setState({buttonState:$e.BUTTON_STATES.RETRY,copyState:$e.COPY_STATES.FETCH_ERROR}))})}stopFetch(){this.fetchPromise&&(tn.debug2("stopFetch"),this.fetchPromise.cancel(),this.fetchPromise=void 0)}startHideTimer(){this.stopHideTimer(),this.hideTimer=setTimeout(this.handleHideTimeout,$e.HIDE_TIMEOUT)}stopHideTimer(){this.hideTimer!=null&&(clearTimeout(this.hideTimer),this.hideTimer=void 0)}render(){const{onEntering:t,onEntered:e,onExiting:n,onExited:s}=this.props,{buttonState:i,copyState:o,isShown:r,rowCount:l,error:a}=this.state,c=o===$e.COPY_STATES.DONE?"fade":"copy-slide-up",h=$e.getCopyButtonText(i),u=a!=null?a:$e.getStatusMessageText(o,l),m=o!==$e.COPY_STATES.DONE,p=i===$e.BUTTON_STATES.FETCH_IN_PROGRESS,g=o===$e.COPY_STATES.DONE;return w(Nl,{animation:c,isShown:r,className:W("iris-grid-copy-handler",{"copy-done":g}),onClick:this.handleBackgroundClick,onEntering:t,onEntered:e,onExiting:n,onExited:s,children:[d("div",{className:"status-message",children:d("span",{children:u})}),d(gt,{in:m,timeout:It.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:w("div",{className:"buttons-container",children:[d("button",{type:"button",className:"btn btn-outline-secondary btn-cancel",onClick:this.handleCancelClick,children:"Cancel"}),w("button",{type:"button",className:W("btn","btn-copy",{"btn-primary":!p,"btn-secondary":p,"btn-spinner":p}),onClick:this.handleCopyClick,disabled:p,children:[p&&d(Ln,{}),h]})]})})]})}};let io=$e;io.NO_PROMPT_THRESHOLD=1e4;io.HIDE_TIMEOUT=3e3;io.COPY_STATES={IDLE:"IDLE",CONFIRMATION_REQUIRED:"CONFIRMATION_REQUIRED",FETCH_IN_PROGRESS:"FETCH_IN_PROGRESS",FETCH_ERROR:"FETCH_ERROR",CLICK_REQUIRED:"CLICK_REQUIRED",DONE:"DONE"};io.BUTTON_STATES={COPY:"COPY",FETCH_IN_PROGRESS:"FETCH_IN_PROGRESS",CLICK_TO_COPY:"CLICK_TO_COPY",RETRY:"RETRY"};io.defaultProps={copyOperation:null,onEntering:()=>{},onEntered:()=>{},onExiting:()=>{},onExited:()=>{}};class Pm extends S.exports.PureComponent{constructor(e){super(e);const{debounceMs:n}=e;this.debouncedSendUpdate=Je(this.sendUpdate.bind(this),n),this.handleCancel=this.handleCancel.bind(this),this.handleChange=this.handleChange.bind(this),this.handleCommit=this.handleCommit.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleBlur=this.handleBlur.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.inputField=null;const{value:s}=e;this.initialValue=s,this.state={isChanged:!1,value:s}}componentDidMount(){var e;(e=this.inputField)==null||e.focus()}componentDidUpdate(e){const{debounceMs:n}=this.props;e.debounceMs!==n&&(this.debouncedSendUpdate.flush(),this.debouncedSendUpdate=Je(this.sendUpdate.bind(this),n))}componentWillUnmount(){this.debouncedSendUpdate.cancel()}setValue(e){this.initialValue=e,this.setState({value:e})}focus(){var e;(e=this.inputField)==null||e.focus()}handleChange(e){const{value:n}=e.target;this.setState({value:n,isChanged:!0}),this.debouncedSendUpdate(n)}handleCancel(){this.debouncedSendUpdate.cancel();const{initialValue:e}=this,{isChanged:n}=this.state;n&&this.sendUpdate(e);const{onDone:s}=this.props;s()}handleCommit(e=!0,n=!0){this.debouncedSendUpdate.flush();const{onDone:s}=this.props;s(e,n)}handleFocus(){var e;(e=this.inputField)==null||e.select()}handleBlur(e){const{relatedTarget:n}=e;n!=null&&n.classList.contains("context-menu-container")?this.handleCommit(!1,!0):n!=null&&n.classList.contains("advanced-filter-button")?this.handleCommit(!1,!1):this.handleCommit(!0,!0)}handleTab(e=!1){this.debouncedSendUpdate.flush();const{onTab:n}=this.props;n(e)}handleKeyDown(e){switch(e.key){case"Escape":e.stopPropagation(),e.preventDefault(),this.handleCancel();break;case"Enter":e.stopPropagation(),e.preventDefault(),this.handleCommit();break;case"Tab":e.stopPropagation(),e.preventDefault(),this.handleTab(e.shiftKey);break}}handleContextMenu(e){const{onContextMenu:n}=this.props;n(e)}sendUpdate(e){const{onChange:n}=this.props;n(e)}render(){const{className:e,style:n,isAdvancedFilterSet:s,onAdvancedFiltersTriggered:i}=this.props,{value:o}=this.state;return w("div",{style:n,className:"iris-grid-input-autosized-wrapper","data-value":o,children:[d("input",{ref:r=>{this.inputField=r},className:W("iris-grid-input-field",e),type:"text",value:o,onBlur:this.handleBlur,onFocus:this.handleFocus,onChange:this.handleChange,onKeyDown:this.handleKeyDown,onContextMenu:this.handleContextMenu,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:"false"}),d("div",{className:"advanced-filter-button-container",children:d("button",{type:"button",className:W("btn btn-link btn-link-icon advanced-filter-button",{"filter-set":s}),onClick:i,onContextMenu:this.handleContextMenu,children:w("div",{className:"fa-layers ",children:[d(z,{icon:Za,className:"filter-solid"}),d(z,{icon:Br,className:"filter-light"})]})})})]})}}Pm.defaultProps={style:{},className:"",value:"",isAdvancedFilterSet:!1,onAdvancedFiltersTriggered:()=>{},onChange:()=>{},onDone:()=>{},onTab:()=>{},onContextMenu:()=>{},debounceMs:150};class av extends vi{constructor(e){super(),this.irisGrid=e}onDown(e){const{selectedRanges:n}=this.irisGrid.state;return e.key==="c"&&xe.isModifierKeyDown(e)?(te.isValidSnapshotRanges(n)?this.irisGrid.copyRanges(n):this.irisGrid.copyRanges(n,!1,!1,"Invalid copy ranges"),!0):!1}}const cv={TOGGLE_QUICK_FILTER:ze.createAndAdd({id:"TABLE.TOGGLE_QUICK_FILTER",name:"Toggle Quick Filter",shortcut:[me.CTRL,fe.F],macShortcut:[me.CMD,fe.F]}),CLEAR_ALL_FILTERS:ze.createAndAdd({id:"TABLE.CLEAR_ALL_FILTERS",name:"Clear All Table Filters",shortcut:[me.CTRL,fe.E],macShortcut:[me.CMD,fe.E]}),CLEAR_FILTERS:ze.createAndAdd({id:"TABLE.CLEAR_FILTERS",name:"Clear Active Table Filters",shortcut:[me.CTRL,me.SHIFT,fe.E],macShortcut:[me.CMD,me.SHIFT,fe.E]}),REVERSE:ze.createAndAdd({id:"TABLE.REVERSE",name:"Reverse",shortcut:[me.CTRL,fe.I],macShortcut:[me.CMD,fe.I]}),TOGGLE_SEARCH:ze.createAndAdd({id:"TABLE.TOGGLE_SEARCH",name:"Toggle Search",shortcut:[me.CTRL,me.SHIFT,fe.F],macShortcut:[me.CMD,me.SHIFT,fe.F]}),GOTO_ROW:ze.createAndAdd({id:"TABLE.GOTO_ROW",name:"GOTO_ROW",shortcut:[me.CTRL,fe.G],macShortcut:[me.CMD,fe.G]})},dv={COMMIT:ze.createAndAdd({id:"INPUT_TABLE.COMMIT",name:"Commit",shortcut:[me.CTRL,fe.S],macShortcut:[me.CMD,fe.S]}),DISCARD:ze.createAndAdd({id:"INPUT_TABLE.DISCARD",name:"Discard",shortcut:[me.CTRL,me.ALT,fe.S],macShortcut:[me.CMD,me.OPTION,fe.S]})},hn={TABLE:cv,INPUT_TABLE:dv};class hv extends vi{constructor(e){super(),this.irisGrid=e}onDown(e){if(hn.TABLE.REVERSE.matchesEvent(e)){if(!this.irisGrid.isReversible())return!1;const{reverseType:n}=this.irisGrid.state;return n===P.REVERSE_TYPE.NONE?this.irisGrid.reverse(P.REVERSE_TYPE.POST_SORT):this.irisGrid.reverse(P.REVERSE_TYPE.NONE),!0}return!1}}class uv extends vi{constructor(e){super(),this.irisGrid=e}onDown(e){return hn.TABLE.CLEAR_FILTERS.matchesEvent(e)?(this.irisGrid.clearAllFilters(),!0):!1}}class mv extends Rt{constructor(e){super(850),this.irisGrid=e}destroyColumnTooltip(){this.irisGrid.setState({overflowButtonTooltipProps:null})}setCursor(e){return this.isHoveringOverflowButton(e)?(this.cursor="pointer",{stopPropagation:!1,preventDefault:!1}):(this.cursor=null,!1)}getButtonPosition({x:e,y:n,column:s,row:i}){if(s==null||i==null)return null;const{renderer:o,grid:r,state:l,props:a}=this.irisGrid;if(!r)return null;const{metrics:c}=l,{model:h}=a,{canvasContext:u}=r,m=r.getTheme(),p={context:u,mouseX:e,mouseY:n,metrics:c,model:h,theme:m},{left:g,top:f,width:b,height:C}=o.getCellOverflowButtonPosition(p);return g==null||b==null||f==null||C==null?null:{left:g,top:f,width:b,height:C}}isHoveringOverflowButton(e){var C;const{x:n,y:s}=e,{left:i,top:o,width:r,height:l}=(C=this.getButtonPosition(e))!=null?C:{};if(i==null||r==null||o==null||l==null)return!1;const{renderer:a,grid:c,state:h,props:u}=this.irisGrid;if(!c)return!1;const{metrics:m}=h,{model:p}=u,{canvasContext:g}=c,f=c.getTheme(),b={context:g,mouseX:n,mouseY:s,metrics:m,model:p,theme:f};return a.shouldRenderOverflowButton(b)&&n>=i&&n<=i+r&&s>=o&&s<=o+l}onMove(e){if(this.isHoveringOverflowButton(e)){const{overflowButtonTooltipProps:n}=this.irisGrid.state,s=this.getButtonPosition(e);pt(n,s)||this.irisGrid.setState({overflowButtonTooltipProps:s})}else this.destroyColumnTooltip();return this.setCursor(e)}onWheel(e){return this.destroyColumnTooltip(),this.onMove(e)}onDown(e){this.destroyColumnTooltip();const{column:n,row:s}=e;return this.isHoveringOverflowButton(e)&&this.irisGrid.setState({showOverflowModal:!0,overflowText:this.irisGrid.getValueForCell(n,s)}),!1}onContextMenu(){return this.destroyColumnTooltip(),!1}onLeave(){return this.destroyColumnTooltip(),!1}}class pv extends Rt{constructor(e){super(),this.irisGrid=e,this.cursor=null}isActive(){const{isSelectingColumn:e}=this.irisGrid.props;return e}isValidColumn(e){if(e==null)return!1;const{columnSelectionValidator:n}=this.irisGrid.props;return n!=null?n(e):!0}updateColumnSelectionStatus(){const{columnSelectionValidator:e}=this.irisGrid.props;e!=null&&e(null)}getTableColumn(e){if(e==null)return null;const{model:n}=this.irisGrid.props,s=this.irisGrid.getModelColumn(e);return s==null?null:n.columns[s]}onMove(e){if(!this.isActive())return!1;const{columnAllowedCursor:n,columnNotAllowedCursor:s}=this.irisGrid.props,{column:i}=e,o=this.getTableColumn(i);return this.isValidColumn(o)?(this.cursor=n,this.irisGrid.setState({hoverSelectColumn:i})):(this.cursor=s,this.irisGrid.setState({hoverSelectColumn:null})),!0}onWheel(e){if(!this.isActive())return!1;const{columnAllowedCursor:n,columnNotAllowedCursor:s}=this.irisGrid.props,{column:i}=e,o=this.getTableColumn(i);return this.isValidColumn(o)?this.cursor=n:this.cursor=s,{preventDefault:!1,stopPropagation:!1}}onLeave(){return this.isActive()&&this.irisGrid.setState({hoverSelectColumn:null}),this.updateColumnSelectionStatus(),!1}onDown(){return this.isActive()}onClick(e){if(!this.isActive())return!1;const{column:n}=e,s=this.getTableColumn(n);return s!=null&&this.isValidColumn(s)&&this.irisGrid.selectColumn(s),!0}}class gv extends Rt{constructor(e){super(),this.irisGrid=e}hideColumnTooltip(){const{tooltip:e}=this.irisGrid;e&&(e.stopTimer(),e.hide())}onDown(){return this.hideColumnTooltip(),!1}onContextMenu(){return this.hideColumnTooltip(),!1}onWheel(){return this.hideColumnTooltip(),!1}onLeave(e,n,s){const{relatedTarget:i}=s instanceof MouseEvent?s:s.nativeEvent,{tooltip:o}=this.irisGrid;if(!o)return!1;const r=o.popper.current;return r&&i instanceof Element&&r.element.contains(i)||this.hideColumnTooltip(),!1}onMove(e){const{column:n,row:s,columnHeaderDepth:i}=e,{shownColumnTooltip:o}=this.irisGrid.state;let r=null;return n!==null&&s===null&&i===0&&(r=n),r!==o&&this.irisGrid.setState({shownColumnTooltip:r}),!1}}const Hm=class extends S.exports.Component{constructor(t=Hm.defaultProps){super(t),this.handleInputChange=this.handleInputChange.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.inputRef=Y.createRef()}handleInputChange(){const{onChange:t}=this.props;this.inputRef.current&&t(this.inputRef.current.value)}closeContextMenu(){const{forwardedProps:t}=this.props,{closeMenu:e}=t;e(!0)}revertToDefault(){const{onChange:t}=this.props;t(null)}returnFocusToContextMenu(){const t=Gf.getClosestByClassName(this.inputRef.current,"context-menu-container");t instanceof HTMLElement&&t.focus()}handleKeyDown(t){switch(t.key){case"Enter":t.stopPropagation(),this.closeContextMenu();break;case"Escape":t.stopPropagation(),this.revertToDefault(),this.closeContextMenu();break;case"ArrowRight":case"ArrowLeft":t.stopPropagation();break;case"ArrowUp":case"ArrowDown":this.returnFocusToContextMenu();break;default:t.stopPropagation()}}render(){const{formatString:t,forwardedProps:e,placeholder:n,title:s}=this.props,{menuItem:{description:i},iconElement:o}=e;return w("div",{className:"form-group flex-grow mb-0",children:[w("div",{className:"custom-format-title",children:[d("span",{className:"icon",children:o}),w("label",{className:"title mb-0",htmlFor:"custom-format-input",children:[s,i!=null&&d(pe,{children:i})]})]}),d("div",{className:"pl-2 pr-2 pb-2",children:d("input",{id:"custom-format-input",className:"form-control text-right mb-0",type:"text",defaultValue:t,ref:this.inputRef,placeholder:n,onKeyDown:this.handleKeyDown,onChange:this.handleInputChange,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:"false"})})]})}};let Vm=Hm;Vm.defaultProps={formatString:"",forwardedProps:{menuItem:{},closeMenu(t){},iconElement:null},placeholder:"",title:"",onChange(t){}};class un{static isDefaultSelected(e){return!e||![st.TYPE_CONTEXT_CUSTOM,st.TYPE_CONTEXT_PRESET].includes(e.type)}static isCustomSelected(e){return e!=null&&e.type===st.TYPE_CONTEXT_CUSTOM}static makeOption(e,n,s,i){return{title:e,description:e,group:s,format:n,isSelected:i}}static makeCustomFormatOption(e,n,s,i,o){return{title:e.label,description:e.label,format:e,group:n,isSelected:i,menuElement:d(Vm,{formatString:e.formatString,title:e.label,placeholder:s,onChange:o})}}}const Bn=class{static getOptions(t,e){const n=new Date,i=[{group:Bn.dateGroup,formatString:"yyyy-MM-dd"},{group:Bn.dateGroup,formatString:"MM-dd-yyyy"},{group:Bn.timeGroup,formatString:"HH:mm:ss"},{group:Bn.timeGroup,formatString:"HH:mm:ss.SSS"},{group:Bn.timeGroup,formatString:"HH:mm:ss.SSSSSSSSS"},{group:Bn.dateTimeGroup,formatString:"yyyy-MM-dd HH:mm:ss"},{group:Bn.dateTimeGroup,formatString:"yyyy-MM-dd HH:mm:ss.SSS"},{group:Bn.dateTimeGroup,formatString:"yyyy-MM-dd HH:mm:ss.SSSSSSSSS"}].map(r=>{const l=ht.makeFormat("",r.formatString,ht.TYPE_CONTEXT_PRESET),a=t.getFormattedString(n,P.dataType.DATETIME,"",l);return un.makeOption(a,l,r.group,ht.isSameFormat(l,e))});return[un.makeOption("Default",null,Bn.dateGroup,un.isDefaultSelected(e)),...i]}};let Ml=Bn;Ml.dateGroup=10;Ml.timeGroup=20;Ml.dateTimeGroup=30;const ls=class{static getOptions(t,e){const n=[{format:We.FORMAT_PERCENT,group:ls.presetGroup},{format:We.FORMAT_BASIS_POINTS,group:ls.presetGroup},{format:We.FORMAT_MILLIONS,group:ls.presetGroup},{format:We.FORMAT_ROUND,group:ls.presetRoundGroup},{format:We.FORMAT_ROUND_TWO_DECIMALS,group:ls.presetRoundGroup},{format:We.FORMAT_ROUND_FOUR_DECIMALS,group:ls.presetRoundGroup}],s=un.makeOption("Default",null,ls.defaultGroup,un.isDefaultSelected(t)),i=n.map(a=>un.makeOption(a.format.label,a.format,a.group,We.isSameFormat(a.format,t))),o=un.isCustomSelected(t),r=o?t:We.makeCustomFormat(),l=un.makeCustomFormatOption(r,ls.customGroup,We.DEFAULT_FORMAT_STRING,o,a=>{if(a!=null){const c=We.makeCustomFormat(a);We.isValid(c)&&e(c)}else e(null)});return[s,...i,l]}};let qo=ls;qo.defaultGroup=10;qo.presetGroup=20;qo.presetRoundGroup=30;qo.customGroup=40;const Lr=class{static getOptions(t,e){const n=[{format:mt.FORMAT_MILLIONS,group:Lr.presetGroup}],s=un.makeOption("Default",null,Lr.defaultGroup,un.isDefaultSelected(t)),i=n.map(a=>un.makeOption(a.format.label,a.format,a.group,mt.isSameFormat(a.format,t))),o=un.isCustomSelected(t),r=o?t:mt.makeCustomFormat(),l=un.makeCustomFormatOption(r,Lr.customGroup,mt.DEFAULT_FORMAT_STRING,o,a=>{if(a!=null){const c=mt.makeCustomFormat(a);mt.isValid(c)&&e(c)}else e(null)});return[s,...i,l]}};let Fl=Lr;Fl.defaultGroup=10;Fl.presetGroup=20;Fl.customGroup=30;const rh=X.module("IrisGridContextMenuHandler"),fv=150,lh="yyyy-MM-dd HH:mm:ss.SSSSSSSSS",Q=class extends Rt{constructor(t){super(),this.debouncedUpdateCustomFormat=Je(t.handleFormatSelection,fv),this.irisGrid=t}static getQuickFilterCondition(t,e,n){return t&&n==="&&"?t.and(e):t&&n==="||"?t.or(e):e}static getQuickFilterText(t,e,n){return n&&t!=null?`${t} ${n} ${e}`:e}static getOperatorAsText(t){return t==="&&"?"And":"Or"}static getNumberValueEqualsFilter(t,e){const n=t.filter();if(e===Number.POSITIVE_INFINITY)return N.FilterCondition.invoke("isInf",n).and(n.greaterThan(N.FilterValue.ofNumber(0)));if(e===Number.NEGATIVE_INFINITY)return N.FilterCondition.invoke("isInf",n).and(n.lessThan(N.FilterValue.ofNumber(0)));if(Number.isNaN(e))return N.FilterCondition.invoke("isNaN",n);const s=Q.getFilterValueForNumberOrChar(t.type,e);return n.eq(s)}static getFilterValueForNumberOrChar(t,e){return P.isCharType(t)?N.FilterValue.ofString(String.fromCharCode(e)):N.FilterValue.ofNumber(e)}componentWillUnmount(){this.debouncedUpdateCustomFormat.flush()}getHeaderActions(t,e){var M;const{irisGrid:n}=this,{column:s}=e;A(s);const{model:i}=n.props,{columns:o}=i,r=o[t],l=[],{metrics:a,reverseType:c,quickFilters:h,advancedFilters:u,searchFilter:m}=n.state,p=n.getTheme();A(a);const{filterIconColor:g,filterBarActiveColor:f,contextMenuSortIconColor:b,contextMenuReverseIconColor:C}=p,v=i.sort,T=P.getSortForColumn(v,t),E=c!==P.REVERSE_TYPE.NONE,{userColumnWidths:y}=a,I=[...y.values()].some(x=>x===0),D=i.isColumnFrozen(s);return l.push({title:"Hide Column",group:Q.GROUP_HIDE_COLUMNS,action:()=>{this.irisGrid.hideColumnByVisibleIndex(s)}}),l.push({title:D?"Unfreeze Column":"Freeze Column",group:Q.GROUP_HIDE_COLUMNS,action:()=>{D?this.irisGrid.unFreezeColumnByColumnName(r.name):this.irisGrid.freezeColumnByColumnName(r.name)},order:10}),l.push({title:"Show All Columns",group:Q.GROUP_HIDE_COLUMNS,action:()=>{this.irisGrid.showAllColumns()},disabled:!I}),l.push({title:"Quick Filters",icon:es,iconColor:f,shortcut:hn.TABLE.TOGGLE_QUICK_FILTER,group:Q.GROUP_FILTER,order:10,action:()=>{this.irisGrid.toggleFilterBar(s)}}),l.push({title:"Advanced Filters",icon:u.get(t)?Za:Br,iconColor:g,group:Q.GROUP_FILTER,order:20,action:()=>{this.irisGrid.handleAdvancedMenuOpened(s)}}),l.push({title:"Clear Table Filters",group:Q.GROUP_FILTER,order:40,shortcut:hn.TABLE.CLEAR_FILTERS,action:()=>{this.irisGrid.clearAllFilters()},disabled:!(h.size>0||u.size>0||m!=null)}),l.push({title:"Sort by",icon:es,iconColor:b,group:Q.GROUP_SORT,order:10,actions:this.sortByActions(r,t,T)}),l.push({title:"Add Additional Sort",disabled:T&&v.length===1||E&&v.length===1||T&&E&&v.length===2||v.length===0,group:Q.GROUP_SORT,order:20,actions:this.additionalSortActions(r,t)}),l.push({title:"Clear Table Sorting",disabled:v.length===0||E&&v.length===1,group:Q.GROUP_SORT,action:()=>{this.irisGrid.sortColumn(s,Q.COLUMN_SORT_DIRECTION.none)},order:30}),l.push({title:c===P.REVERSE_TYPE.NONE?"Reverse Table":"Clear Reverse Table",icon:es,iconColor:C,group:Q.GROUP_SORT,order:40,disabled:!i.isReversible,shortcut:hn.TABLE.REVERSE,action:()=>{c===P.REVERSE_TYPE.NONE?this.irisGrid.reverse(P.REVERSE_TYPE.POST_SORT):this.irisGrid.reverse(P.REVERSE_TYPE.NONE)}}),l.push({title:"Copy Column Name",group:Q.GROUP_COPY,action:()=>{var x;xe.copyToClipboard((x=i.textForColumnHeader(t))!=null?x:"").catch(B=>rh.error("Unable to copy header",B))}}),P.isDateType(r.type)?l.push({title:"Date/Time Format",group:Q.GROUP_FORMAT,actions:this.dateFormatActions(r)}):P.isNumberType(r.type)&&l.push({title:"Number Format",group:Q.GROUP_FORMAT,actions:(M=this.numberFormatActions(r))!=null?M:void 0}),l}getCellActions(t,e,n){A(t);const{irisGrid:s}=this,{column:i,row:o}=n,{model:r,canCopy:l}=s.props,{columns:a}=r,c=s.getModelRow(o);A(c);const h=r.valueForCell(t,c),u=r.textForCell(t,c),m=a[t],p=[],{quickFilters:g}=s.state,f=s.getTheme(),{filterIconColor:b}=f,{settings:C}=s.props,v=new ht({timeZone:C==null?void 0:C.timeZone,showTimeZone:!1,showTSeparator:!0,defaultDateTimeFormatString:lh}),T=new ht({timeZone:C==null?void 0:C.timeZone,showTimeZone:C==null?void 0:C.showTimeZone,showTSeparator:C==null?void 0:C.showTSeparator,defaultDateTimeFormatString:lh});if(m==null||o==null)return p;if(r.isFilterable(t)){const y={title:"Filter By Value",icon:es,iconColor:b,group:Q.GROUP_FILTER,order:10,actions:[]};if(h==null)g.get(t)&&y.actions.push({title:"And",actions:this.nullFilterActions(m,g.get(t),"&&"),order:2,group:ie.groups.high}),y.actions.push(...this.nullFilterActions(m));else if(P.isBooleanType(m.type))g.get(t)&&y.actions.push({title:"Or",actions:this.booleanFilterActions(m,u,g.get(t),"||"),order:2,group:ie.groups.high}),y.actions.push(...this.booleanFilterActions(m,u));else if(P.isNumberType(m.type)||P.isCharType(m.type)){A(t);const I=P.isCharType(m.type)?String.fromCharCode(h):`${h}`;g.get(t)&&y.actions.push({title:"And",actions:this.numberFilterActions(m,I,h,g.get(t),"&&"),order:2,group:ie.groups.high}),y.actions.push(...this.numberFilterActions(m,I,h,g.get(t)))}else if(P.isDateType(m.type)){const I=v.format(h),D=T.format(h);g.get(t)&&y.actions.push({title:"And",actions:this.dateFilterActions(m,I,D,h,g.get(t),"&&"),order:2,group:ie.groups.high}),y.actions.push(...this.dateFilterActions(m,I,D,h,g.get(t)))}else g.get(t)&&y.actions.push({title:"And",actions:this.stringFilterActions(m,u,h,g.get(t),"&&"),order:2,group:ie.groups.high}),y.actions.push(...this.stringFilterActions(m,u,h));y.actions!=null&&y.actions.length>0&&p.push(y)}const E={title:"Go to",iconColor:b,shortcut:hn.TABLE.GOTO_ROW,group:Q.GROUP_GOTO,order:10,action:()=>this.irisGrid.toggleGotoRow(`${o+1}`)};return p.push(E),l&&(p.push({title:"Copy Cell",group:Q.GROUP_COPY,order:10,action:()=>{s.copyCell(i,o)}}),p.push({title:"Copy Cell Unformatted",group:Q.GROUP_COPY,order:20,action:()=>{s.copyCell(i,o,!0)}})),p}onContextMenu(t,e,n){const{irisGrid:s}=this,{y:i,column:o,row:r,columnHeaderDepth:l}=t,a=s.getModelColumn(o),c=s.getModelRow(r),{model:h,canCopy:u}=s.props,{columns:m}=h,{metrics:p,isFilterBarShown:g,quickFilters:f,advancedFilters:b,selectedRanges:C}=s.state;A(p);const{columnHeaderHeight:v,gridY:T,columnHeaderMaxDepth:E}=p,y=[];if(a!=null&&c!=null){const I=h.valueForCell(a,c),D=h.textForCell(a,c),M=m[a],{onContextMenu:x}=s.props;M!=null&&y.push(x({model:h,value:I,valueText:D,column:M,rowIndex:r,columnIndex:o,modelRow:c,modelColumn:a}))}return a!=null&&h.isFilterable(a)&&y.push({title:"Clear Column Filter",group:Q.GROUP_FILTER,order:30,action:()=>{this.irisGrid.removeColumnFilter(a)},disabled:!(f.has(a)||b.has(a))}),(g?i<=T:i<=v*E&&l===0)?a!=null&&y.push(...this.getHeaderActions(a,t)):(a!=null&&c!=null&&y.push(...this.getCellActions(a,e,t)),u&&C.length>0&&(y.push({title:"Copy Selection",shortcut:Os.COPY,group:Q.GROUP_COPY,order:30,action:()=>{s.copyRanges(C)}}),y.push({title:"Copy Selection w/ Headers",group:Q.GROUP_COPY,order:40,action:()=>{s.copyRanges(C,!0)}})),nt(h)&&h.isEditable&&C.length>0&&y.push({title:"Delete Selected Rows",group:Q.GROUP_EDIT,order:50,action:()=>{this.irisGrid.deleteRanges(C)}})),y.length===0?!1:(A(s.gridWrapper),ie.triggerMenu(s.gridWrapper,n.pageX,n.pageY,y),!0)}dateFormatActions(t){const{model:e}=this.irisGrid.props,{formatter:n}=e,s=n.getColumnFormat(t.type,t.name),i=Ml.getOptions(n,s),o=[];for(let r=0;r<i.length;r+=1){const{description:l,format:a,group:c,isSelected:h,title:u}=i[r];o.push({title:u,description:l,icon:h?ai:void 0,group:c,order:r,action:()=>{const m=e.getColumnIndexByName(t.name);A(m),this.irisGrid.handleFormatSelection(m,a)}})}return o}numberFormatActions(t){const{model:e}=this.irisGrid.props,{formatter:n}=e,s=n.getColumnFormat(t.type,t.name);let i;const o=e.getColumnIndexByName(t.name);if(P.isDecimalType(t.type))i=qo.getOptions(s,l=>{A(o),this.debouncedUpdateCustomFormat(o,l)});else if(P.isIntegerType(t.type))i=Fl.getOptions(s,l=>{A(o),this.debouncedUpdateCustomFormat(o,l)});else return rh.error("Invalid column type in numberFormatActions"),null;const r=[];for(let l=0;l<i.length;l+=1){const{format:a,isSelected:c}=i[l];r.push({...i[l],icon:c?ai:void 0,order:l,action:()=>{o===void 0&&a&&a.type===st.TYPE_CONTEXT_CUSTOM||(A(o),this.irisGrid.handleFormatSelection(o,a))}})}return r}stringFilterActions(t,e,n,s,i){const o=N.FilterValue.ofString(n);let r=s;r||(r={filter:null,text:null});const{filter:l,text:a}=r,c=[],{model:h}=this.irisGrid.props,u=h.getColumnIndexByName(t.name);return A(u),c.push({menuElement:w("div",{className:"iris-grid-filter-menu-item-value",children:[i?Q.getOperatorAsText(i):""," ",'"',e,'"']}),order:1,group:ie.groups.high}),c.push({title:"text is exactly",description:`Show only rows where ${t.name} is ${n} (case sensitive)`,action:()=>{this.irisGrid.setQuickFilter(u,Q.getQuickFilterCondition(l,t.filter().eq(o),i),Q.getQuickFilterText(a,`=${e}`,i))},order:10,group:ie.groups.low}),c.push({title:"text is not exactly",description:`Show only rows where ${t.name} is not ${e} (case sensitive)`,action:()=>{this.irisGrid.setQuickFilter(u,Q.getQuickFilterCondition(l,t.filter().notEq(o),i),Q.getQuickFilterText(a,`!=${e}`,i))},order:20,group:ie.groups.low}),c.push({title:"text contains",description:`Show only rows where ${t.name} contains ${e}`,action:()=>{this.irisGrid.setQuickFilter(u,Q.getQuickFilterCondition(l,t.filter().contains(o),i),Q.getQuickFilterText(a,`~${e}`,i))},order:30,group:ie.groups.low}),c.push({title:"text does not contain",description:`Show only rows where ${t.name} does not contain ${n}`,action:()=>{this.irisGrid.setQuickFilter(u,Q.getQuickFilterCondition(l,t.filter().contains(o).not(),i),Q.getQuickFilterText(a,`!~${e}`,i))},order:40,group:ie.groups.low}),c.push({title:"text starts with",description:`Show only rows where ${t.name} starts with ${e}`,action:()=>{this.irisGrid.setQuickFilter(u,Q.getQuickFilterCondition(l,t.filter().invoke("startsWith",o),i),Q.getQuickFilterText(a,`${e}*`,i))},order:50,group:ie.groups.low}),c.push({title:"text ends with",description:`Show only rows where ${t.name} ends with ${e}`,action:()=>{this.irisGrid.setQuickFilter(u,Q.getQuickFilterCondition(l,t.filter().invoke("endsWith",o),i),Q.getQuickFilterText(a,`*${e}`,i))},order:60,group:ie.groups.low}),c}numberFilterActions(t,e,n,s,i){const o=Q.getFilterValueForNumberOrChar(t.type,n);let r=null,l=null;s&&(r=s.filter,l=s.text);const a=[],c=n!==Number.POSITIVE_INFINITY&&n!==Number.NEGATIVE_INFINITY&&!Number.isNaN(n),{model:h}=this.irisGrid.props,u=h.getColumnIndexByName(t.name);return A(u),a.push({menuElement:w("div",{className:"iris-grid-filter-menu-item-value",children:[i?Q.getOperatorAsText(i):""," ",'"',e,'"']}),order:1,group:ie.groups.high}),a.push({title:"is equal to",description:`Show only rows where ${t.name} is ${e}`,action:()=>{const m=Q.getNumberValueEqualsFilter(t,n);this.irisGrid.setQuickFilter(u,Q.getQuickFilterCondition(r,m,i),Q.getQuickFilterText(l,`=${e}`,i))},order:10,group:ie.groups.low}),a.push({title:"is not equal to",description:`Show only rows where ${t.name} is not ${e}`,action:()=>{const m=Q.getNumberValueEqualsFilter(t,n).not();this.irisGrid.setQuickFilter(u,Q.getQuickFilterCondition(r,m,i),Q.getQuickFilterText(l,`!=${e}`,i))},order:20,group:ie.groups.low}),c&&!P.isCharType(t.type)&&(a.push({title:"greater than",description:`Show only rows where ${t.name} is greater than ${e}`,action:()=>{this.irisGrid.setQuickFilter(u,Q.getQuickFilterCondition(r,t.filter().greaterThan(o),i),Q.getQuickFilterText(l,`>${e}`,i))},order:30,group:ie.groups.low}),a.push({title:"greater than or equal to",description:`Show only rows where ${t.name} is greater than or equal to ${e}`,action:()=>{this.irisGrid.setQuickFilter(u,Q.getQuickFilterCondition(r,t.filter().greaterThanOrEqualTo(o),i),Q.getQuickFilterText(l,`>=${e}`,i))},order:40,group:ie.groups.low}),a.push({title:"less than",description:`Show only rows where ${t.name} is less than ${e}`,action:()=>{this.irisGrid.setQuickFilter(u,Q.getQuickFilterCondition(r,t.filter().lessThan(o),i),Q.getQuickFilterText(l,`<${e}`,i))},order:50,group:ie.groups.low}),a.push({title:"less than or equal to",description:`Show only rows where ${t.name} is less than or equal to ${e}`,action:()=>{this.irisGrid.setQuickFilter(u,Q.getQuickFilterCondition(r,t.filter().lessThanOrEqualTo(o),i),Q.getQuickFilterText(l,`<=${e}`,i))},order:60,group:ie.groups.low})),a}booleanFilterActions(t,e,n,s){const i=[],{model:o}=this.irisGrid.props,{filter:r,text:l}=n||{},a=o.getColumnIndexByName(t.name);return A(a),i.push({menuElement:w("div",{className:"iris-grid-filter-menu-item-value",children:[s?Q.getOperatorAsText(s):""," ",'"',e!=null?e:"null",'"']}),order:1,group:ie.groups.high}),i.push({title:"true",description:`Show only rows where ${t.name} is true`,action:()=>{this.irisGrid.setQuickFilter(a,Q.getQuickFilterCondition(r,t.filter().isTrue(),s),Q.getQuickFilterText(l,"true",s))},order:10,group:ie.groups.low}),i.push({title:"false",description:`Show only rows where ${t.name} is false`,action:()=>{this.irisGrid.setQuickFilter(a,Q.getQuickFilterCondition(r,t.filter().isFalse(),s),Q.getQuickFilterText(l,"false",s))},order:20,group:ie.groups.low}),i.push({title:"is null",description:`Show only rows where ${t.name} is null`,action:()=>{this.irisGrid.setQuickFilter(a,Q.getQuickFilterCondition(r,t.filter().isNull(),s),Q.getQuickFilterText(l,"null",s))},order:30,group:ie.groups.low}),i.push({title:"is not null",description:`Show only rows where ${t.name} is not null`,action:()=>{this.irisGrid.setQuickFilter(a,Q.getQuickFilterCondition(r,t.filter().isNull().not(),s),Q.getQuickFilterText(l,"!null",s))},order:40,group:ie.groups.low}),i}dateFilterActions(t,e,n,s,i,o){const r=N.FilterValue.ofNumber(s);let l=null,a=null;i&&(l=i.filter,a=i.text);const{model:c}=this.irisGrid.props,h=c.getColumnIndexByName(t.name);A(h);const u=[];return u.push({menuElement:w("div",{className:"iris-grid-filter-menu-item-value",children:[o?Q.getOperatorAsText(o):""," ",'"',n,'"']}),order:1,group:ie.groups.high}),u.push({title:"date is",description:`Show only rows where ${t.name} is ${n}`,action:()=>{this.irisGrid.setQuickFilter(h,Q.getQuickFilterCondition(l,t.filter().eq(r),o),Q.getQuickFilterText(a,`=${e}`,o))},order:10,group:ie.groups.low}),u.push({title:"date is not",description:`Show only rows where ${t.name} is not ${n}`,action:()=>{this.irisGrid.setQuickFilter(h,Q.getQuickFilterCondition(l,t.filter().notEq(r),o),Q.getQuickFilterText(a,`!=${e}`,o))},order:20,group:ie.groups.low}),u.push({title:"date is before",description:`Show only rows where ${t.name} is before ${n}`,action:()=>{this.irisGrid.setQuickFilter(h,Q.getQuickFilterCondition(l,t.filter().lessThan(r),o),Q.getQuickFilterText(a,`<${e}`,o))},order:30,group:ie.groups.low}),u.push({title:"date is before or equal",description:`Show only rows where ${t.name} is before or equal to ${n}`,action:()=>{this.irisGrid.setQuickFilter(h,Q.getQuickFilterCondition(l,t.filter().lessThanOrEqualTo(r),o),Q.getQuickFilterText(a,`<=${e}`,o))},order:40,group:ie.groups.low}),u.push({title:"date is after",description:`Show only rows where ${t.name} is greater than ${n}`,action:()=>{this.irisGrid.setQuickFilter(h,Q.getQuickFilterCondition(l,t.filter().greaterThan(r),o),Q.getQuickFilterText(a,`>${e}`,o))},order:50,group:ie.groups.low}),u.push({title:"date is after or equal",description:`Show only rows where ${t.name} is after or equal to ${n}`,action:()=>{this.irisGrid.setQuickFilter(h,Q.getQuickFilterCondition(l,t.filter().greaterThanOrEqualTo(r),o),Q.getQuickFilterText(a,`>=${e}`,o))},order:60,group:ie.groups.low}),u}nullFilterActions(t,e,n){let s=null,i=null;e&&(s=e.filter,i=e.text);const o=[],{model:r}=this.irisGrid.props,l=r.getColumnIndexByName(t.name);return A(l),o.push({menuElement:w("div",{className:"iris-grid-filter-menu-item-value",children:[n?Q.getOperatorAsText(n):""," ",'"null"']}),order:1,group:ie.groups.high}),o.push({title:"is null",description:`Show only rows where ${t.name} is null`,action:()=>{this.irisGrid.setQuickFilter(l,Q.getQuickFilterCondition(s,t.filter().isNull(),n),Q.getQuickFilterText(i,"null",n))},order:10,group:ie.groups.low}),o.push({title:"is not null",description:`Show only rows where ${t.name} is not null`,action:()=>{this.irisGrid.setQuickFilter(l,Q.getQuickFilterCondition(s,t.filter().isNull().not(),n),Q.getQuickFilterText(i,"!null",n))},order:20,group:ie.groups.low}),o}sortByActions(t,e,n){const s=this.irisGrid.getTheme(),{contextMenuSortIconColor:i}=s,o=[{title:`${t.name} Ascending`,order:10,action:()=>{this.irisGrid.sortColumn(e,Q.COLUMN_SORT_DIRECTION.ascending)},icon:this.checkColumnSort(n,Q.COLUMN_SORT_DIRECTION.ascending)?es:void 0,iconColor:i},{title:`${t.name} Descending`,order:20,action:()=>{this.irisGrid.sortColumn(e,Q.COLUMN_SORT_DIRECTION.descending)},icon:this.checkColumnSort(n,Q.COLUMN_SORT_DIRECTION.descending)?es:void 0,iconColor:i},{title:"Remove Sort",order:50,action:()=>{this.irisGrid.sortColumn(e,Q.COLUMN_SORT_DIRECTION.none,!1,!0)},disabled:!n}];return P.isNumberType(t.type)&&(o.push({title:`ABS(${t.name}) Ascending`,order:30,action:()=>{this.irisGrid.sortColumn(e,Q.COLUMN_SORT_DIRECTION.ascending,!0)},icon:this.checkColumnSort(n,Q.COLUMN_SORT_DIRECTION.ascending,!0)?es:void 0,iconColor:i}),o.push({title:`ABS(${t.name}) Descending`,order:40,action:()=>{this.irisGrid.sortColumn(e,Q.COLUMN_SORT_DIRECTION.descending,!0)},icon:this.checkColumnSort(n,Q.COLUMN_SORT_DIRECTION.descending,!0)?es:void 0,iconColor:i})),o}additionalSortActions(t,e){const n=this.irisGrid.getTheme(),{contextMenuSortIconColor:s}=n,i=[{title:"Add Sort By",menuElement:w("div",{className:"btn-context-menu menu-title",children:[d("span",{className:"icon",children:d(z,{icon:es,style:{color:s!=null?s:void 0}})}),d("span",{className:"title",children:"Add Additional Sort"}),d("span",{className:"shortcut",children:xe.isMacPlatform()?"\u2318Click":"^Click"})]}),order:1},{title:`${t.name} Ascending`,order:10,action:()=>{this.irisGrid.sortColumn(e,Q.COLUMN_SORT_DIRECTION.ascending,!1,!0)}},{title:`${t.name} Descending`,order:20,action:()=>{this.irisGrid.sortColumn(e,Q.COLUMN_SORT_DIRECTION.descending,!1,!0)}}];return P.isNumberType(t.type)&&(i.push({title:`ABS(${t.name}) Ascending`,order:30,action:()=>{this.irisGrid.sortColumn(e,Q.COLUMN_SORT_DIRECTION.ascending,!0,!0)}}),i.push({title:`ABS(${t.name}) Descending`,order:40,action:()=>{this.irisGrid.sortColumn(e,Q.COLUMN_SORT_DIRECTION.descending,!0,!0)}})),i}checkColumnSort(t,e=null,n=!1){return t?t.direction===e&&t.isAbs===n:!1}};let Cs=Q;Cs.GROUP_EDIT=ie.groups.high+10;Cs.GROUP_HIDE_COLUMNS=ie.groups.high+25;Cs.GROUP_FILTER=ie.groups.high+50;Cs.GROUP_GOTO=ie.groups.high+51;Cs.GROUP_SORT=ie.groups.high+75;Cs.GROUP_COPY=ie.groups.high+100;Cs.GROUP_FORMAT=ie.groups.high+150;Cs.COLUMN_SORT_DIRECTION={ascending:"ASC",descending:"DESC",none:null};class Cv extends Rt{constructor(e){super(),this.irisGrid=e}onDoubleClick(e){const{column:n,row:s}=e;return s==null||n==null?!1:(this.irisGrid.selectData(n,s),!0)}}class bv extends Rt{constructor(e){super(),this.irisGrid=e}onDown(e){const{y:n,column:s,row:i}=e;if(s!==null&&i===null){const{isFilterBarShown:o,metrics:r}=this.irisGrid.state;if(!r)throw new Error("Metrics not set");const{columnHeaderMaxDepth:l}=r,a=this.irisGrid.getTheme();if(o&&a.columnHeaderHeight!=null&&a.filterBarHeight!=null&&n>a.columnHeaderHeight*l&&n<=a.columnHeaderHeight*l+a.filterBarHeight)return this.irisGrid.focusFilterBar(s),!0}return!1}onMove(e){const{y:n,column:s}=e,{isFilterBarShown:i,hoverAdvancedFilter:o,metrics:r}=this.irisGrid.state;if(!r)throw new Error("Metrics not set");const{columnHeaderMaxDepth:l}=r,a=this.irisGrid.getTheme();let c=null;return i&&a.columnHeaderHeight!=null&&a.filterBarHeight!=null&&s!==null&&n>=a.columnHeaderHeight*l&&n<=a.columnHeaderHeight*l+a.filterBarHeight&&(c=s),c!==o&&this.irisGrid.setState({hoverAdvancedFilter:c}),!1}onLeave(e){const{column:n}=e,{hoverAdvancedFilter:s}=this.irisGrid.state;return s!==null&&n!==s&&this.irisGrid.setState({hoverAdvancedFilter:null}),!1}}class Sv extends Rt{constructor(e){super(),this.column=null,this.irisGrid=e}getColumnFromGridPoint(e){const{column:n,row:s,columnHeaderDepth:i}=e;return n!==null&&s===null&&i===0?n:null}onDown(e){return this.column=this.getColumnFromGridPoint(e),!1}onClick(e,n,s){const i=this.getColumnFromGridPoint(e);if(i!=null&&i===this.column){const o=xe.isModifierKeyDown(s);return this.irisGrid.toggleSort(i,o),!0}return!1}}class wv extends Rt{constructor(e){super(),this.irisGrid=e}onWheel(e,n,s){const{irisGrid:i}=this,{model:o}=i.props,{metrics:r,pendingRowCount:l}=i.state;A(r);const{bottom:a,rowCount:c,rowHeight:h}=r,{deltaY:u}=K.getScrollDelta(s);return nt(o)&&o.isEditable&&a>=c-1&&u>0&&i.setState({pendingRowCount:l+Math.ceil(u/h)}),!1}}const vv=3e3,Tv=({children:t=null,onEntering:e,onEntered:n,onExiting:s,onExited:i})=>{const[o,r]=S.exports.useState(!1),l=S.exports.useRef(),a=dl(t),c=S.exports.useCallback(()=>{r(!0),l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{r(!1)},vv)},[r,l]);return S.exports.useEffect(()=>{a!==t&&t!=null&&c()},[t,a,r,c]),S.exports.useEffect(()=>()=>l.current?clearTimeout(l.current):void 0,[]),d(Nl,{className:"toast-bottom-bar",isShown:o,onEntering:e,onEntered:n,onExiting:s,onExited:i,children:t})};class Ev extends Go{getVisibleColumnWidth(e,n,s=this.getFirstColumn(n),i=this.calculateTreePaddingX(n)){var h,u,m;const{model:o}=n,r=(u=(h=o.layoutHints)==null?void 0:h.hiddenColumns)!=null?u:[],l=this.getModelColumn(e,n),a=super.getVisibleColumnWidth(e,n,s,i);return!this.userColumnWidths.has(l)&&r.includes((m=o.columns[l])==null?void 0:m.name)?0:a}getGridY(e){let n=super.getGridY(e);const{isFilterBarShown:s,theme:i,advancedFilters:o,quickFilters:r,sorts:l,reverseType:a}=e;return s?n+=i.filterBarHeight:(r!=null&&r.size>0||o!=null&&o.size>0)&&(n+=i.filterBarCollapsedHeight),a!==P.REVERSE_TYPE.NONE&&l!=null&&l.length>0&&(n+=i.reverseHeaderBarHeight),n}getUserColumnWidths(){return this.userColumnWidths}}const yv=1,Um=Y.memo(({model:t,modelColumns:e,top:n,bottom:s,left:i,right:o,filter:r,formatter:l,reverseType:a=P.REVERSE_TYPE.NONE,sorts:c,customColumns:h,movedColumns:u,hiddenColumns:m,alwaysFetchColumns:p,rollupConfig:g=null,totalsConfig:f=null,selectDistinctColumns:b=[],pendingRowCount:C=0,pendingDataMap:v=new Map,frozenColumns:T,formatColumns:E})=>{const y=S.exports.useMemo(()=>te.getModelViewportColumns(e,i,o,u,m,p,yv),[e,i,o,u,m,p]);return S.exports.useEffect(function(){t.filter=r},[t,r]),S.exports.useEffect(function(){const D=[...c];a!==P.REVERSE_TYPE.NONE&&D.push(N.Table.reverse()),t.sort=D},[t,c,a]),S.exports.useEffect(function(){t.formatter=l},[t,l]),S.exports.useEffect(function(){t.isCustomColumnsAvailable&&(t.customColumns=h)},[t,h]),S.exports.useEffect(function(){t.isFormatColumnsAvailable&&(t.formatColumns=E)},[t,E]),S.exports.useEffect(function(){t.setViewport(n,s,y)},[t,n,s,y]),S.exports.useEffect(function(){t.isRollupAvailable&&(t.rollupConfig=g)},[t,t.isRollupAvailable,g]),S.exports.useEffect(function(){t.isSelectDistinctAvailable&&(t.selectDistinctColumns=b)},[t,b]),S.exports.useEffect(function(){t.isTotalsAvailable&&(t.totalsConfig=f)},[t,t.isTotalsAvailable,f]),S.exports.useEffect(function(){t.pendingRowCount=C},[t,C]),S.exports.useEffect(function(){t.pendingDataMap=v},[t,v]),S.exports.useEffect(function(){T&&t.updateFrozenColumns(T)},[t,T]),null});Um.displayName="IrisGridModelUpdater";const Hn=Object.freeze({SORT_UP:"sortUp",SORT_DOWN:"sortDown",CARET_DOWN:"caretDown",CARET_RIGHT:"caretRight",CELL_OVERFLOW:"cellOverflow"}),la=16;class Fo extends qi{constructor(){super(),this.icons={},this.initIcons()}static isFilterValid(e,n){const s=e==null||e.filter!=null,i=n==null||n.filter!=null;return s&&i}initIcons(){this.setIcon(Hn.SORT_UP,Af),this.setIcon(Hn.SORT_DOWN,Of),this.setIcon(Hn.CARET_DOWN,cs),this.setIcon(Hn.CARET_RIGHT,eu),this.setIcon(Hn.CELL_OVERFLOW,nf)}setIcon(e,n){const s=Array.isArray(n.icon[4])?n.icon[4][0]:n.icon[4],i=new Path2D(s),o=new Path2D,r={a:la/n.icon[0],d:la/n.icon[1]};o.addPath(i,r),this.icons[e]=o}getIcon(e){return this.icons[e]}getSortIcon(e){return e?e.direction===P.sortDirection.ascending?this.getIcon(Hn.SORT_UP):e.direction===P.sortDirection.descending?this.getIcon(Hn.SORT_DOWN):null:null}drawCanvas(e){super.drawCanvas(e),this.drawScrim(e)}drawGrid(e,n){super.drawGrid(e,n),this.drawCellOverflowButton(n)}drawGridLines(e,n){super.drawGridLines(e,n),this.drawGroupedColumnLine(e,n),this.drawPendingRowLine(e,n)}drawCellContent(e,n,s,i){var m;const{metrics:o,model:r}=n,{modelColumns:l,modelRows:a}=o,c=U(a,i),h=l.get(s);if(h===void 0)return;const u=r.valueForCell(h,c);if(P.isTextType((m=r.columns[h])==null?void 0:m.type)&&(u===null||u==="")){const p=e.font;e.font=`italic ${p}`;const g=u===null?"null":"empty";super.drawCellContent(e,n,s,i,g),e.font=p;return}super.drawCellContent(e,n,s,i)}drawGroupedColumnLine(e,n){const{metrics:s,model:i,theme:o}=n,{groupedColumns:r,columns:l}=i,{maxY:a,visibleColumnWidths:c,visibleColumnXs:h}=s;if(r.length===0||o.groupedColumnDividerColor==null)return;const u=r[r.length-1],m=l.findIndex(b=>b.name===u.name),p=h.get(m),g=c.get(m);if(p==null||g==null)return;const f=p+g+.5;e.strokeStyle=o.groupedColumnDividerColor,e.lineWidth=1,e.beginPath(),e.moveTo(f,0),e.lineTo(f,a),e.stroke()}drawPendingRowLine(e,n){const{metrics:s,model:i,theme:o}=n,{visibleRowYs:r,maxX:l}=s,{pendingRowCount:a}=i;if(a<=0)return;const c=i.rowCount-i.pendingRowCount-i.floatingBottomRowCount;let h=r.get(c);h!=null&&(h-=.5,e.save(),e.setLineDash([4,2]),e.strokeStyle=o.pendingTextColor,e.lineWidth=1,e.beginPath(),e.moveTo(0,h),e.lineTo(l,h),e.stroke(),e.restore())}drawMouseColumnHover(e,n){const{theme:s,metrics:i,hoverSelectColumn:o}=n;if(o==null||s.linkerColumnHoverBackgroundColor==null)return;const{visibleColumnWidths:r,visibleColumnXs:l,maxY:a}=i,c=l.get(o),h=r.get(o);A(c),A(h),e.fillStyle=s.linkerColumnHoverBackgroundColor,e.fillRect(c,0,h,a)}drawMouseRowHover(e,n){const{isSelectingColumn:s}=n;s||super.drawMouseRowHover(e,n)}drawScrim(e){const{context:n,loadingScrimProgress:s,metrics:i,theme:o}=e;if(s==null)return;const{width:r,height:l,gridY:a}=i,{scrimBlurSize:c,scrimColor:h}=o;n.save(),n.globalCompositeOperation="color",n.filter=`blur(${c}px)`,h!=null&&(n.fillStyle=h),n.beginPath(),n.rect(0,a,r,l-a),n.clip(),n.fillRect(-c,-c+a,c*2+r,(c*2+(l-a))*s),n.restore()}drawColumnHeaders(e,n){super.drawColumnHeaders(e,n);const{theme:s,metrics:i,model:o,reverseType:r}=n,{columnHeaderHeight:l}=i;if(this.drawFilterHeaders(e,n),l<=0)return;const{sort:a}=o;if(a.length===1){const c=r!==P.REVERSE_TYPE.NONE;let h;c?h=s.headerReverseBarColor:h=s.headerSortBarColor,this.drawHeaderBar(e,n,h,c?s.reverseHeaderBarHeight:s.sortHeaderBarHeight)}else a.length>1&&(r!==P.REVERSE_TYPE.NONE&&this.drawHeaderBar(e,n,s.headerReverseBarColor,s.reverseHeaderBarHeight,!1),this.drawHeaderBar(e,n,s.headerSortBarColor,s.sortHeaderBarHeight))}drawHeaderBar(e,n,s,i,o=!0){const{theme:r,metrics:l,model:a}=n,{columnHeaderHeight:c,width:h}=l;let u=0;o||(u=i),e.fillStyle=r.headerBarCasingColor,e.fillRect(0,a.columnHeaderMaxDepth*c-i-2+u,h,i+2),e.fillStyle=s,e.fillRect(0,a.columnHeaderMaxDepth*c-i-1+u,h,i)}drawColumnHeadersAtDepth(e,n,s,i,o){const{metrics:r,model:l,isMenuShown:a}=n,{columnHeaderMaxDepth:c}=l,{width:h}=r,u={...i,maxX:o===c-1&&i.maxX===h?h-(a?0:30):i.maxX};super.drawColumnHeadersAtDepth(e,n,s,u,o)}drawColumnHeaderAtIndex(e,n,s,i){var H;super.drawColumnHeaderAtIndex(e,n,s,i);const{metrics:o,model:r,theme:l}=n,{modelColumns:a,visibleColumnWidths:c,visibleColumnXs:h,gridX:u,columnHeaderHeight:m,fontWidths:p}=o,{headerHorizontalPadding:g}=l,f=U(c,s,0),b=U(h,s)+u,C=a.get(s);if(C==null)return;const v=P.getSortForColumn(r.sort,C);if(!v)return;const T=this.getSortIcon(v);if(!T)return;const E=r.textForColumnHeader(C);if(E===void 0)return;const y=(H=p.get(e.font))!=null?H:qi.DEFAULT_FONT_WIDTH;A(y);const I=E.length*y,D=u+b+I+g;let{maxX:M}=i;M-=g;const x=u+b+f-g-1,B=D>M?D+1:Math.min(M,x),$=v.direction===P.sortDirection.ascending?-6:-12,k=m*.5+$;e.save(),e.beginPath(),e.rect(b,0,f,m),e.clip(),e.fillStyle=l.headerSortBarColor,e.translate(B,k),e.fill(T),e.restore()}drawFilterHeaders(e,n){const{isFilterBarShown:s,quickFilters:i,advancedFilters:o}=n;s?this.drawExpandedFilterHeaders(e,n):(i!=null&&i.size>0||o!=null&&o.size>0)&&this.drawCollapsedFilterHeaders(e,n)}drawExpandedFilterHeaders(e,n){const{metrics:s,model:i,theme:o,quickFilters:r,advancedFilters:l}=n,{filterBarHeight:a}=o;if(a<=0)return;const{gridX:c,gridY:h,maxX:u,modelColumns:m,visibleColumns:p,visibleColumnWidths:g,visibleColumnXs:f}=s,b=h-a;e.save(),e.font=o.font,e.textAlign="left",r!=null&&r.size>0||l!=null&&l.size>0?e.fillStyle=o.filterBarExpandedActiveBackgroundColor:e.fillStyle=o.filterBarExpandedBackgroundColor,e.fillRect(c,b,u,a-1),e.fillStyle=o.headerBarCasingColor,e.fillRect(c,b+a-1,u,1);const C=b;e.strokeStyle=o.filterBarSeparatorColor,e.beginPath();for(let v=0;v<p.length;v+=1){const T=p[v],E=U(m,T),y=U(f,T),I=U(g,T);if(i.isFilterable(E)&&I>0){const D=c+(y!=null?y:0);e.rect(D+.5,C+.5,I,a-2)}}e.stroke();for(let v=0;v<p.length;v+=1){const T=p[v],E=U(g,T),I=U(f,T)+c;this.drawExpandedFilterHeader(e,n,T,I,E)}e.restore()}drawExpandedFilterHeader(e,n,s,i,o){if(o<=0)return;const{metrics:r,theme:l,quickFilters:a,advancedFilters:c}=n,{modelColumns:h,gridY:u}=r,{filterBarHeight:m,filterBarExpandedActiveCellBackgroundColor:p,filterBarErrorColor:g,filterBarHorizontalPadding:f,headerColor:b}=l,C=u-m,v=h.get(s);if(v===void 0)return;const T=a.get(v),E=c.get(v);if(T==null&&E==null)return;let y=null;if(T!=null){const{text:D}=T;if(y=D,y||(y=P.getFilterText(T.filter)),y!=null){const{fontWidths:M}=r;let x=M.get(e.font);(x==null||x===0)&&(x=e.measureText("8").width,x||(x=10));const B=(o-f*2)/x;B<=0?y="":y.length>B&&(y=`${y.substring(0,B-1)}\u2026`)}}if(e.save(),Fo.isFilterValid(E,T)&&p!=null)e.fillStyle=p,e.fillRect(i+1,C+1,o-1,m-3);else if(g!=null){e.fillStyle=g,e.lineWidth=2,e.strokeStyle=g;const D=i+2,M=C+2,x=o-3,B=m-5;e.strokeRect(D,M,x,B)}if(y!=null&&y!==""){const D=i+f,M=C+m*.5+1;e.fillStyle=b,e.fillText(y,D,M)}e.restore()}drawCollapsedFilterHeaders(e,n){const{metrics:s,theme:i}=n,{headerSeparatorColor:o,filterBarCollapsedHeight:r}=i;if(r<=0)return;const{gridX:l,gridY:a,maxX:c,visibleColumns:h,visibleColumnWidths:u,visibleColumnXs:m}=s,p=a-r;e.save(),e.fillStyle=o,e.fillRect(l,p,c,r);for(let g=0;g<h.length;g+=1){const f=h[g],b=u.get(f),C=m.get(f);if(C!=null&&b!=null){const v=C+l;this.drawCollapsedFilterHeader(e,n,f,v,b)}}e.restore()}drawCollapsedFilterHeader(e,n,s,i,o){if(o<=0)return;const{metrics:r,theme:l,quickFilters:a,advancedFilters:c}=n,{modelColumns:h,gridY:u}=r,m=h.get(s);if(m===void 0)return;const p=a.get(m),g=c.get(m),{filterBarCollapsedHeight:f,filterBarActiveColor:b,filterBarActiveBackgroundColor:C,filterBarErrorColor:v}=l;e.save();const T=Fo.isFilterValid(g,p);C!=null&&p==null&&g==null?e.fillStyle=C:b!=null&&T?e.fillStyle=b:v!=null&&(e.fillStyle=v);const E=i+1,y=u-f,I=o-1,D=f-1;e.fillRect(E,y,I,D),e.restore()}drawTreeMarker(e,n,s,i,o,r,l){e.save();const{x1:a,y1:c}=o,h=l?this.getIcon(Hn.CARET_DOWN):this.getIcon(Hn.CARET_RIGHT),u=s+a-2,m=i+c+2.5;e.fillStyle=r,e.textAlign="center",e.translate(u,m),e.fill(h),e.restore()}drawRowFooters(e,n){const{metrics:s,model:i,mouseX:o,mouseY:r,theme:l}=n,{gridY:a,gridX:c,maxX:h,modelRows:u,floatingTopHeight:m,floatingBottomHeight:p,floatingRows:g,rowFooterWidth:f,height:b,horizontalBarHeight:C,verticalBarWidth:v,visibleRowHeights:T,visibleRowYs:E,width:y}=s;if(f<=0||g.length===0)return;const{cellHorizontalPadding:I,floatingGridRowColor:D,floatingRowBackgroundColors:M,headerColor:x,rowHoverBackgroundColor:B}=l;e.translate(c,a),e.beginPath();const $=Math.min(h,y-f-v-c);e.fillStyle=M,m>0&&e.rect($,0,f,m),p>0&&e.rect($,b-a-C-p,f,p),e.fill();const k=o!=null&&r!=null&&o>=c&&o<=h+f?K.getRowAtY(r,s):null;if(B!=null&&k!==null&&g.includes(k)){e.fillStyle=B;const O=E.get(k),F=T.get(k);A(O),A(F),e.fillRect($,O,f,F)}if(e.beginPath(),D!=null&&(e.strokeStyle=D),m>0&&(e.moveTo($+.5,.5),e.lineTo($+.5,m-.5)),p>0){const O=b-a-C-p;e.moveTo($-.5,O+.5),e.lineTo($-.5,O+p-.5)}e.stroke(),e.fillStyle=x,e.textAlign="left";const H=$+I;for(let O=0;O<g.length;O+=1){const F=g[O],_=T.get(F),L=E.get(F),V=u.get(F);if(L!=null&&_!=null&&V!=null){const G=L+_*.5;e.fillText(i.textForRowFooter(V),H,G)}}e.translate(-c,-a)}getTextRenderMetrics(e,n,s,i){const o=super.getTextRenderMetrics(e,n,s,i),{mouseX:r,mouseY:l,metrics:a}=n;if(r==null||l==null)return o;const{column:c,row:h}=K.getGridPointFromXY(r,l,a);if(s===c&&i===h){const{left:u}=this.getCellOverflowButtonPosition(n);this.shouldRenderOverflowButton(n)&&u!=null&&(o.width=u-a.gridX-o.x)}return o}shouldRenderOverflowButton(e){var b,C;const{context:n,mouseX:s,mouseY:i,metrics:o,model:r,theme:l}=e;if(s==null||i==null)return!1;const{row:a,column:c,modelRow:h,modelColumn:u}=K.getCellInfoFromXY(s,i,o);if(a==null||c==null||h==null||u==null||!P.isStringType(r.columns[u].type))return!1;const m=(b=r.textForCell(u,h))!=null?b:"",{width:p}=super.getTextRenderMetrics(n,e,c,a),g=(C=o.fontWidths.get(l.font))!=null?C:Fo.DEFAULT_FONT_WIDTH;n.save(),n.font=l.font;const f=this.getCachedTruncatedString(n,m,p,g,r.truncationCharForCell(u,h));return n.restore(),m!==""&&f!==m}getCellOverflowButtonPosition({mouseX:e,mouseY:n,metrics:s,theme:i}){const o={left:null,top:null,width:null,height:null};if(e==null||n==null||!s)return o;const{rowHeight:r,columnWidth:l,left:a,top:c}=K.getCellInfoFromXY(e,n,s);A(a),A(l),A(c);const{width:h,verticalBarWidth:u}=s,{cellHorizontalPadding:m}=i,p=la+2*m,g=r,b=Math.min(s.gridX+a+l,h-u)-p,C=s.gridY+c;return{left:b,top:C,width:p,height:g}}drawCellOverflowButton(e){const{context:n,mouseX:s,mouseY:i,theme:o}=e;if(s==null||i==null||!this.shouldRenderOverflowButton(e))return;const{left:r,top:l,width:a,height:c}=this.getCellOverflowButtonPosition(e),{cellHorizontalPadding:h,overflowButtonColor:u,overflowButtonHoverColor:m}=o;n.save(),m!=null&&r!=null&&a!=null&&l!=null&&c!=null&&s>=r&&s<=r+a&&i>=l&&i<=l+c?n.fillStyle=m:u!=null&&(n.fillStyle=u);const p=this.getIcon(Hn.CELL_OVERFLOW);r!=null&&l!=null&&n.translate(r+h,l+2),n.fill(p),n.restore()}}const Iv="12px Fira Sans, sans-serif",Rv="#f0f0ee",Dv="#1a171a",ae={"grid-bg":"#211f22",font:Iv,white:Rv,black:Dv,"header-bg":"#2d2a2e","header-color":"#f0f0ee","header-height":"30px","header-separator-color":"#211f22","header-separator-hover-color":"#929192","header-hidden-separator-hover-color":"#4878ea","header-sort-bar-color":"#aa9af4","header-reverse-bar-color":"#548d29","header-bar-casing-color":"#211f22","header-font":"600 12px Fira Sans, sans-serif","row-height":"19px","row-background-colors":"#373438 #2d2a2e","selection-color":"rgba(118, 217, 228, 0.09)","selection-outline-color":"#76d9e4","selection-outline-casing-color":"#211f22","row-hover-bg":"#4b494c","selected-row-hover-bg":"rgba(118, 217, 228, 0.25)","scroll-bar-active-selection-tick-color":"rgba(118, 217, 228, 0.5)","scroll-bar-bg":"#322f33","scroll-bar-hover-bg":"#373438","scroll-bar-casing-color":"#555356","scroll-bar-corner-color":"#322f33","scroll-bar-color":"#5b5a5c","scroll-bar-hover-color":"#929192","scroll-bar-active-color":"#c0bfbf","text-color":"#f0f0ee","positive-number-color":"#9edc6f","negative-number-color":"#f95d84","zero-number-color":"#fcd65b","date-color":"#fcd65b","pending-text-color":"#fde38d","error-text-color":"#f95d84","null-string-color":"#929192","filter-bar-active-bg":"#425175","filter-bar-active-color":"#4878ea","filter-bar-expanded-bg":"#373438","filter-bar-expanded-active-bg":"#313849","filter-bar-expanded-active-cell-bg":"#374d80","filter-bar-separator-color":"#929192","filter-bar-error-color":"#f95d84","filter-icon-color":"#4878ea","scrim-color":"#5b5a5c","context-menu-sort-icon-color":"#aa9af4","context-menu-reverse-icon-color":"#548d29","linker-column-hover-bg":"rgba(118, 217, 228, 0.09)","tree-line-color":"#5b5a5c","tree-marker-color":"#c0bfbf","tree-marker-hover-color":"#fcfcfa","grouped-column-divider-color":"#1a171a","floating-grid-row-color":"#555356","floating-row-background-colors":"#403e41","floating-divider-inner-color":"#403e41","floating-divider-outer-color":"#211f22","overflow-button-color":"#c0bfbf","overflow-button-hover-color":"#fcfcfa"},Bm=Object.freeze({backgroundColor:ae["grid-bg"],white:ae.white,black:ae.black,font:ae.font,headerBackgroundColor:ae["header-bg"],headerColor:ae["header-color"],headerSeparatorColor:ae["header-separator-color"],headerSeparatorHoverColor:ae["header-separator-hover-color"],headerHiddenSeparatorHoverColor:ae["header-hidden-separator-hover-color"],headerSortBarColor:ae["header-sort-bar-color"],headerReverseBarColor:ae["header-reverse-bar-color"],headerBarCasingColor:ae["header-bar-casing-color"],headerFont:ae["header-font"],rowBackgroundColors:ae["row-background-colors"],rowHoverBackgroundColor:ae["row-hover-bg"],selectionColor:ae["selection-color"],selectionOutlineColor:ae["selection-outline-color"],selectionOutlineCasingColor:ae["selection-outline-casing-color"],selectedRowHoverBackgroundColor:ae["selected-row-hover-bg"],scrollBarBackgroundColor:ae["scroll-bar-bg"],scrollBarHoverBackgroundColor:ae["scroll-bar-hover-bg"],scrollBarCasingColor:ae["scroll-bar-casing-color"],scrollBarCornerColor:ae["scroll-bar-corner-color"],scrollBarColor:ae["scroll-bar-color"],scrollBarHoverColor:ae["scroll-bar-hover-color"],scrollBarActiveColor:ae["scroll-bar-active-color"],scrollBarSelectionTickColor:ae["selected-row-hover-bg"],scrollBarActiveSelectionTickColor:ae["scroll-bar-active-selection-tick-color"],textColor:ae["text-color"],positiveNumberColor:ae["positive-number-color"],negativeNumberColor:ae["negative-number-color"],zeroNumberColor:ae["zero-number-color"],dateColor:ae["date-color"],pendingTextColor:ae["pending-text-color"],errorTextColor:ae["error-text-color"],nullStringColor:ae["null-string-color"],filterBarActiveBackgroundColor:ae["filter-bar-active-bg"],filterBarExpandedBackgroundColor:ae["filter-bar-expanded-bg"],filterBarExpandedActiveBackgroundColor:ae["filter-bar-expanded-active-bg"],filterBarExpandedActiveCellBackgroundColor:ae["filter-bar-expanded-active-cell-bg"],filterBarSeparatorColor:ae["filter-bar-separator-color"],filterBarActiveColor:ae["filter-bar-active-color"],filterBarErrorColor:ae["filter-bar-error-color"],filterIconColor:ae["filter-icon-color"],scrimColor:ae["scrim-color"],contextMenuSortIconColor:ae["context-menu-sort-icon-color"],contextMenuReverseIconColor:ae["context-menu-reverse-icon-color"],allowRowResize:!1,autoSelectRow:!0,gridColumnColor:null,gridRowColor:null,groupedColumnDividerColor:ae["grouped-column-divider-color"],columnHoverBackgroundColor:null,headerHorizontalPadding:12,scrollBarSize:13,scrollBarHoverSize:16,minScrollHandleSize:24,rowHeight:parseInt(ae["row-height"],10)||19,columnWidth:100,rowHeaderWidth:0,rowFooterWidth:60,columnHeaderHeight:parseInt(ae["header-height"],10)||30,filterBarHeight:30,filterBarCollapsedHeight:5,sortHeaderBarHeight:2,reverseHeaderBarHeight:4,filterBarHorizontalPadding:4,scrimBlurSize:25,minScrimTransitionTime:150,maxScrimTransitionTime:350,scrollSnapToRow:!0,linkerColumnHoverBackgroundColor:ae["linker-column-hover-bg"],treeLineColor:ae["tree-line-color"],treeMarkerColor:ae["tree-marker-color"],treeMarkerHoverColor:ae["tree-marker-hover-color"],floatingGridColumnColor:null,floatingGridRowColor:ae["floating-grid-row-color"],floatingRowBackgroundColors:ae["floating-row-background-colors"],floatingDividerInnerColor:ae["floating-divider-inner-color"],floatingDividerOuterColor:ae["floating-divider-outer-color"],overflowButtonColor:ae["overflow-button-color"],overflowButtonHoverColor:ae["overflow-button-hover-color"]});const Er=X.module("ColumnStatistics"),Nv={SIZE:"Number of Rows"},Ma=class extends S.exports.Component{constructor(t){super(t),this.handleError=this.handleError.bind(this),this.handleGenerateStatistics=this.handleGenerateStatistics.bind(this),this.handleStatistics=this.handleStatistics.bind(this),this.handleCopyHeader=this.handleCopyHeader.bind(this),this.cancelablePromise=null,this.state={error:null,loading:!1,statistics:null,numRows:0,copied:!1}}static getStatsLabel(t){var e;return(e=Nv[t])!=null?e:t.split(" ").map(n=>n[0].toUpperCase()+n.substr(1).toLowerCase()).join(" ")}componentDidMount(){this.maybeGenerateStatistics()}componentWillUnmount(){this.cancelablePromise&&this.cancelablePromise.cancel()}handleCopyHeader(){this.setState({copied:!0})}maybeGenerateStatistics(){const{model:t}=this.props,e=t.rowCount;this.setState({numRows:e}),t.isColumnStatisticsAvailable?e<Ma.AUTO_GENERATE_LIMIT&&this.handleGenerateStatistics():this.setState({loading:!1})}handleGenerateStatistics(){this.setState({loading:!0});const{column:t,model:e}=this.props;this.cancelablePromise=Re.makeCancelable(e.columnStatistics(t)),this.cancelablePromise.then(this.handleStatistics).catch(this.handleError)}handleStatistics(t){Er.debug("Received statistics",t);const{model:e,onStatistics:n}=this.props,s=[];t.statisticsMap.forEach((i,o)=>{s.push({operation:Ma.getStatsLabel(o),value:i,type:t.getType(o)})}),t.uniqueValues.forEach((i,o)=>{s.push({operation:o,className:"column-statistics-unique-value",value:i,type:"long"})}),this.setState({loading:!1,statistics:s,numRows:e.rowCount}),n()}handleError(t){if(t!=null&&Re.isCanceled(t)){Er.debug("Called handleError on a cancelled promise result");return}Er.error("Error generating statistics",t),this.setState({error:t,loading:!1,statistics:null})}render(){const{column:t,model:e}=this.props,{error:n,loading:s,statistics:i,numRows:o,copied:r}=this.state,l=!s&&n==null&&i==null&&e.isColumnStatisticsAvailable,a=[],c=t.type.substring(t.type.lastIndexOf(".")+1),h=t.description===null?null:t.description;if(i!=null)for(let g=0;g<i.length;g+=1){const{operation:f,className:b,value:C,type:v}=i[g],T=v?e.displayString(C,v):e.displayString(C,t.type,t.name),E=w(Y.Fragment,{children:[d("div",{className:W("column-statistic-operation",b),children:f}),d("div",{className:"column-statistic-value",children:T})]},f);a.push(E)}const u=St(e)&&e.hasExpandableRows?"Expanded Rows":"Number of Rows",m=e.displayString(o,"long"),p=e.getColumnIndexByName(t.name);return w("div",{className:"column-statistics",children:[w("div",{className:"column-statistics-title",children:[t.name,w("span",{className:"column-statistics-type",children:["\xA0(",c,")"]}),d(ce,{kind:"ghost",className:"column-statistics-copy",icon:r?ja:Ya,onClick:()=>{xe.copyToClipboard(t.name).then(this.handleCopyHeader).catch(g=>Er.error("Unable to column name",g))},tooltip:r?"Copied text":"Copy column name"})]}),h!=null&&d("div",{className:"column-statistics-description",children:h}),p!=null&&!e.isColumnMovable(p)&&w("div",{className:"column-statistics-status",children:[d(z,{icon:e.isColumnFrozen(p)?If:of,className:"mr-1"}),e.isColumnFrozen(p)?"Frozen":"Not movable"]}),w("div",{className:"column-statistics-grid",children:[i==null&&w(ue,{children:[d("div",{className:"column-statistic-operation",children:u}),d("div",{className:"column-statistic-value",children:m})]}),a]}),l&&d("button",{type:"button",className:"btn btn-link px-0",onClick:this.handleGenerateStatistics,children:"Generate Stats"}),n!=null&&d("div",{className:"error-message",children:`${n}`}),i&&!s&&w("button",{type:"button",className:"btn btn-link px-0",onClick:this.handleGenerateStatistics,children:[d(z,{icon:Ja,className:"mr-1"}),"Refresh"]}),s&&w("div",{className:"column-statistics-loading",children:[d(Ln,{className:"mr-2"}),"Calculating Stats..."]})]})}};let $m=Ma;$m.AUTO_GENERATE_LIMIT=1e5;class yr extends S.exports.PureComponent{constructor(e){super(e),this.handleSearchValueChange=this.handleSearchValueChange.bind(this),this.toggleColumn=this.toggleColumn.bind(this),this.selectAll=this.selectAll.bind(this),this.clear=this.clear.bind(this),this.selectNumbers=this.selectNumbers.bind(this),this.searchField=Y.createRef(),this.state={isConfigureColumnsShown:!1}}static createSearchFilter(e,n,s,i){const o=i?s.filter(r=>!n.includes(r.name)).map(r=>r.name):n;if(e&&o.length>0){const r=N.FilterValue.ofString(e);return o.length===s.length?N.FilterCondition.search(r):N.FilterCondition.search(r,s.filter(a=>o.includes(a.name)).map(a=>a.filter()))}}focus(){var e;(e=this.searchField.current)==null||e.focus()}handleSearchValueChange(e){const{onChange:n,selectedColumns:s,invertSelection:i}=this.props;n(e.target.value,s,i)}sendColumnChange(e,n){const{onChange:s,value:i}=this.props;s(i,e,n)}setInvertSelection(e){const{onChange:n,value:s}=this.props;n(s,[],e)}toggleColumn(e){const{selectedColumns:n,invertSelection:s}=this.props;if(n.includes(e))this.sendColumnChange(n.filter(i=>i!==e),s);else{const i=n.slice();i.push(e),this.sendColumnChange(i,s)}}selectAll(){this.setInvertSelection(!0)}clear(){this.setInvertSelection(!1)}selectNumbers(){const{columns:e}=this.props;this.sendColumnChange(e.filter(n=>P.isNumberType(n.type)).map(n=>n.name),!1)}render(){const{value:e,selectedColumns:n,invertSelection:s,columns:i}=this.props,{isConfigureColumnsShown:o}=this.state,r=n.length===0&&s===!0||n.length===i.length&&s===!1,l=n.length===0&&s===!1||n.length===i.length&&s===!0;let a;return r?a=w(ue,{children:[d(z,{icon:fd,mask:Jl,transform:"shrink-2 down-5 right-7"}),d(z,{icon:bf,className:"text-primary",transform:"shrink-4 down-5 right-7"})]}):l?a=w(ue,{children:[d(z,{icon:Oo,mask:Jl,transform:"shrink-1 down-5 right-7"}),d(z,{icon:Cd,className:"text-danger",transform:"shrink-4 down-5 right-7"})]}):a=w(ue,{children:[d(z,{icon:fd,mask:Jl,transform:"shrink-2 down-5 right-7"}),d(z,{icon:_f,className:"text-primary",transform:"shrink-4 down-5 right-7"})]}),w("div",{className:"cross-column-container",children:[d(fs,{className:"cross-column-search",placeholder:"Search Data...",value:e,onChange:this.handleSearchValueChange,ref:this.searchField}),w("button",{type:"button",className:"btn btn-link btn-link-icon px-2",onClick:()=>{o?this.setState({isConfigureColumnsShown:!1}):this.setState({isConfigureColumnsShown:!0})},children:[d("div",{className:"fa-layers",children:a}),d(pe,{children:"Configure Columns"}),d(xn,{isShown:o,className:"cross-column-popper",onExited:()=>{this.setState({isConfigureColumnsShown:!1})},closeOnBlur:!0,interactive:!0,children:w("div",{className:"cross-column-popup",children:["Searched Columns",d("div",{className:"cross-column-scroll",children:i.map(c=>w(Y.Fragment,{children:[d(Ut,{className:"cross-column-checkbox",checked:s?!n.includes(c.name):n.includes(c.name),onChange:()=>this.toggleColumn(c.name),children:c.name}),c.type.substring(c.type.lastIndexOf(".")+1)]},c.name))}),w("div",{className:"cross-column-button-bar",children:[d("button",{type:"button",className:"btn btn-link",onClick:this.selectAll,children:"Select All"}),d("button",{type:"button",className:"btn btn-link",onClick:this.clear,children:"Clear"}),d("button",{type:"button",className:"btn btn-link",onClick:this.selectNumbers,children:"Numbers Only"})]}),l&&w("p",{className:"text-danger",children:[d(z,{icon:Cd})," Select at least one column to search."]})]})})]})]})}}const Is=X.module("PartitionSelectorSearch"),Mv=150,Wm=class extends S.exports.Component{constructor(t){super(t),this.debounceUpdateFilter=Je(()=>{this.updateFilter()},Mv),this.handleFilterChange=this.handleFilterChange.bind(this),this.handleInputFocus=this.handleInputFocus.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleListKeydown=this.handleListKeydown.bind(this),this.handleSelect=this.handleSelect.bind(this),this.handleTableUpdate=this.handleTableUpdate.bind(this),this.handleTextChange=this.handleTextChange.bind(this),this.handleViewportChange=this.handleViewportChange.bind(this),this.itemList=null,this.searchInput=null,this.timer=null,this.state={offset:0,itemCount:0,items:[],text:"",isLoading:!0}}static handleError(t){t instanceof ci||Is.error(t)}componentDidMount(){this.startListening()}componentDidUpdate(t,e){const{isLoading:n,itemCount:s}=this.state,{onListResized:i}=this.props;(s!==e.itemCount||n!==e.isLoading)&&i()}componentWillUnmount(){this.debounceUpdateFilter.cancel(),this.stopListening()}handleKeyDown(t){if(this.itemList==null)return!1;const{items:e,itemCount:n}=this.state;switch(t.key){case"Enter":{let s=null;if(e.length>0)s=e[0].value;else{const{text:i}=this.state;s=i.trim()}if(s.length>0){const{onSelect:i}=this.props;i(s)}return t.stopPropagation(),t.preventDefault(),!0}case"ArrowDown":return n>0&&this.itemList.focusItem(1),t.stopPropagation(),t.preventDefault(),!0;default:return!1}}handleListKeydown(t){switch(t.key){case"Escape":break;default:this.focus();break}}handleFilterChange(){Is.debug2("handleFilterChange");const{table:t}=this.props,e=t.size;this.setState({itemCount:e,isLoading:!0})}handleInputFocus(){this.itemList&&this.itemList.focusItem(0)}handleSelect(t){Is.debug2("handleSelect",t);const{onSelect:e}=this.props,{offset:n,items:s}=this.state,i=t-n;if(i<0||s.length<=i){Is.error("No data for item",t);return}const{value:o}=s[i];e(o)}handleTableUpdate(t){const e=t.detail,{offset:n}=e,s=[],{getFormattedString:i,table:o}=this.props,r=o.columns[0];for(let a=0;a<e.rows.length;a+=1){const h=e.rows[a].get(r),u=i(h,r.type,r.name);s.push({displayValue:u,value:h})}const l=o.size;Is.debug2("handleTableUpdate",l,n,s.length),this.setState({itemCount:l,items:s,offset:n,isLoading:!1})}handleTextChange(t){Is.debug2("handleTextChange");const{value:e}=t.target;this.setState({text:e}),this.debounceUpdateFilter()}handleViewportChange(t,e){Is.debug2("handleViewportChange",t,e);const n=Math.max(1,e-t),s=Math.max(0,t-n),i=e+n,{table:o}=this.props;o.setViewport(s,i)}focus(){this.searchInput&&this.searchInput.focus()}startListening(){const{initialPageSize:t,table:e}=this.props;e.addEventListener(N.Table.EVENT_UPDATED,this.handleTableUpdate),e.addEventListener(N.Table.EVENT_FILTERCHANGED,this.handleFilterChange),e.setViewport(0,t)}stopListening(){const{table:t}=this.props;t.removeEventListener(N.Table.EVENT_UPDATED,this.handleTableUpdate),t.removeEventListener(N.Table.EVENT_FILTERCHANGED,this.handleFilterChange)}updateFilter(){const{initialPageSize:t,table:e}=this.props,{text:n}=this.state,s=n.trim(),i=[];if(s.length>0){const r=e.columns[0].filter().invoke("matches",N.FilterValue.ofString(`(?s)(?i).*\\Q${s}\\E.*`));i.push(r)}Is.debug2("updateFilter",i),e.applyFilter(i),e.setViewport(0,t)}render(){const{isLoading:t,itemCount:e,items:n,offset:s,text:i}=this.state,o=Math.min(e,Wm.MAX_VISIBLE_ITEMS)*vn.DEFAULT_ROW_HEIGHT+11;return w("div",{className:"iris-grid-partition-selector-search",children:[d("div",{className:"search-container",children:d("input",{type:"text",ref:r=>{this.searchInput=r},value:i,placeholder:"Available Partitions",onChange:this.handleTextChange,onFocus:this.handleInputFocus,onKeyDown:this.handleKeyDown,className:"form-control input-partition"})}),!t&&e>0&&d("div",{className:"iris-grid-partition-selector-search-list",onKeyDown:this.handleListKeydown,role:"presentation",style:{height:o},children:d(vn,{ref:r=>{this.itemList=r},itemCount:e,items:n,offset:s,onSelect:this.handleSelect,onViewportChange:this.handleViewportChange})}),!t&&e===0&&d("div",{className:"iris-grid-partition-selector-search-empty",children:"No results"}),t&&w("div",{className:"iris-grid-partition-selector-loading",children:[d(Ln,{}),"\xA0Loading..."]})]})}};let xl=Wm;xl.MAX_VISIBLE_ITEMS=12;xl.defaultProps={initialPageSize:100,onSelect:()=>{},onListResized:()=>{}};xl.propTypes={getFormattedString:R.exports.func.isRequired,table:R.exports.shape({addEventListener:R.exports.func.isRequired,removeEventListener:R.exports.func.isRequired,columns:R.exports.arrayOf(R.exports.shape({name:R.exports.string.isRequired,type:R.exports.string.isRequired,filter:R.exports.func.isRequired})),size:R.exports.number.isRequired,applyFilter:R.exports.func.isRequired,setViewport:R.exports.func.isRequired}).isRequired,initialPageSize:R.exports.number,onSelect:R.exports.func,onListResized:R.exports.func};const Di=X.module("IrisGridPartitionSelector"),Fv=250;class zm extends S.exports.Component{constructor(e){super(e),this.debounceUpdate=Je(()=>{this.sendUpdate()},Fv),this.handleAppendClick=this.handleAppendClick.bind(this),this.handleCloseClick=this.handleCloseClick.bind(this),this.handleIgnoreClick=this.handleIgnoreClick.bind(this),this.handlePartitionChange=this.handlePartitionChange.bind(this),this.handlePartitionSelect=this.handlePartitionSelect.bind(this),this.handlePartitionListResized=this.handlePartitionListResized.bind(this),this.handleSearchOpened=this.handleSearchOpened.bind(this),this.handleSearchClosed=this.handleSearchClosed.bind(this),this.searchMenu=null,this.selectorSearch=null;const{partition:n}=e;this.state={partition:n}}componentWillUnmount(){this.debounceUpdate.cancel()}handleAppendClick(){Di.debug2("handleAppendClick");const{onAppend:e}=this.props,{partition:n}=this.state;e(n)}handleCloseClick(){Di.debug2("handleCloseClick"),this.sendDone()}handleIgnoreClick(){Di.debug2("handleIgnoreClick"),this.sendFetchAll()}handlePartitionChange(e){Di.debug2("handlePartitionChange");const{value:n}=e.target;this.setState({partition:n}),this.debounceUpdate()}handlePartitionSelect(e){this.searchMenu&&this.searchMenu.closeMenu(),this.setState({partition:e},()=>{this.sendUpdate()})}handlePartitionListResized(){this.searchMenu&&this.searchMenu.scheduleUpdate()}handleSearchClosed(){const{table:e}=this.props;e.applyFilter([])}handleSearchOpened(){this.selectorSearch&&this.selectorSearch.focus()}sendDone(){this.debounceUpdate.flush();const{onDone:e}=this.props;e()}sendUpdate(){Di.debug2("sendUpdate");const{onChange:e}=this.props,{partition:n}=this.state;e(n)}sendFetchAll(){Di.debug2("sendFetchAll"),this.debounceUpdate.cancel();const{onFetchAll:e}=this.props;e()}render(){const{columnName:e,getFormattedString:n,onDone:s,table:i}=this.props,{partition:o}=this.state,r=d(xl,{getFormattedString:n,table:i,onSelect:this.handlePartitionSelect,onListResized:this.handlePartitionListResized,ref:l=>{this.selectorSearch=l}},"search");return w("div",{className:"iris-grid-partition-selector",children:[d("div",{className:"status-message",children:w("span",{children:['Filtering "',e,'" partition to']})}),w("div",{className:"input-group",children:[d("input",{type:"text",value:o,onChange:this.handlePartitionChange,className:"form-control input-partition"}),d("div",{className:"input-group-append",children:w("button",{type:"button",className:"btn btn-outline-primary",children:[d(z,{icon:cs}),d(pe,{children:"Partitions"}),d(zn,{ref:l=>{this.searchMenu=l},actions:[{menuElement:r}],onMenuOpened:this.handleSearchOpened,onMenuClosed:this.handleSearchClosed})]})})]}),d("div",{className:"iris-grid-partition-selector-spacer"}),d("button",{type:"button",className:"btn btn-outline-primary btn-ignore",onClick:this.handleIgnoreClick,children:"Ignore & Fetch All"}),d("button",{type:"button",className:"btn btn-outline-primary btn-append",onClick:this.handleAppendClick,children:"Append Command"}),d("button",{type:"button",className:"btn btn-link btn-link-icon btn-close",onClick:s,children:d(z,{icon:$o})})]})}}zm.defaultProps={onAppend:()=>{},onChange:()=>{},onFetchAll:()=>{},onDone:()=>{},partition:""};const xv=X.module("SelectDistinctBuilder");class Gm extends S.exports.Component{constructor(e){super(e),this.handleAddColumnClick=this.handleAddColumnClick.bind(this),this.handleDeleteColumn=this.handleDeleteColumn.bind(this),this.handleDropdownChanged=this.handleDropdownChanged.bind(this);const{model:n,selectDistinctColumns:s}=this.props;this.state={inputs:s.length>0?[...s]:[""],columns:n.originalColumns}}componentDidUpdate(e,n){const{inputs:s}=this.state,{onChange:i}=this.props;if(n.inputs!==s){const o=s.filter(r=>r!=="");pt(n.inputs.filter(r=>r!==""),o)||i(o)}}handleAddColumnClick(){this.setState(({inputs:e})=>({inputs:[...e,""]}))}handleDeleteColumn(e){this.setState(({inputs:n})=>({inputs:n.length===1&&e===0?[""]:n.filter((s,i)=>e!==i)}))}handleDropdownChanged(e,n){xv.debug("handleDropdownChanged",e,n);const{value:s}=n.target;this.setState(({inputs:i})=>{const o=[...i];return o[e]=s,{inputs:o}})}renderInputs(){const{columns:e,inputs:n}=this.state;return n.map((s,i)=>{const o=e.filter(({name:r})=>r===s||!n.includes(r)).map(({name:r})=>d("option",{value:r,children:r},r));return w("div",{className:"form-inline px-3 pb-3",children:[w("select",{className:"form-control custom-select col",value:s,onChange:r=>this.handleDropdownChanged(i,r),children:[d("option",{value:"",children:"Select a column"}),o]}),(n.length>1||s!=="")&&w("button",{type:"button",className:"btn btn-link btn-link-icon ml-1 px-2",onClick:()=>{this.handleDeleteColumn(i)},children:[d(pe,{children:"Delete column"}),d(z,{icon:_n,transform:"grow-3"})]})]},i)})}render(){const{columns:e,inputs:n}=this.state,s=n.length>=e.length;return w("div",{role:"presentation",className:"select-distinct-builder-container h-100",children:[d("div",{className:"select-distinct-title",children:"Display Unique Values From"}),this.renderInputs(),d("hr",{}),d("div",{className:"pt-1 px-3",children:w("button",{type:"button",className:"btn btn-link btn-add-column",onClick:this.handleAddColumnClick,disabled:s,children:[d(z,{icon:As}),"Add Additional Column"]})}),d("div",{className:"select-distinct-builder-footer",children:w("div",{className:"select-distinct-builder-hint",children:["Modifies a table to show unique value from a column, same as"," ",d("span",{className:"inline-code-snippet",children:'selectDistinct("Column")'}),". Filters will be reset and the resulting table will contain only the selected columns above."]})})]})}}Gm.defaultProps={selectDistinctColumns:[],onChange:()=>{}};const Fc=({items:t,onChange:e=()=>{}})=>d(vu,{items:Array.from(t.entries()).map(([n,s])=>({title:Fc.getAdvancedSettingsTitleForKey(n),isOn:s,onChange:i=>e(n,i)}))});Fc.getAdvancedSettingsTitleForKey=t=>{switch(t){case gi.FILTER_CONTROL_CHANGE_CLEARS_ALL_FILTERS:return"Control filters clear existing table filters";case gi.LINK_CHANGE_CLEARS_ALL_FILTERS:return"Inbound links clear existing table filters"}};const ah=X.module("ConditionalFormattingMenu"),aa=()=>{};function _v(t){const{column:{type:e}}=t;if(P.isNumberType(e))return t.condition===Qe.IS_NULL||t.condition===Qe.IS_NOT_NULL?"":`${t.value}`;if(P.isCharType(e))return t.condition===Ht.IS_NULL||t.condition===Ht.IS_NOT_NULL?"":`${t.value}`;if(P.isStringType(e))return t.condition===ln.IS_NULL||t.condition===ln.IS_NOT_NULL?"":`"${t.value}"`;if(P.isDateType(e))return t.condition===Ht.IS_NULL||t.condition===Ht.IS_NOT_NULL?"":`${t.value}`;if(P.isBooleanType(e))return"";throw new Error(`Invalid column type ${e} in getRuleValue`)}function Lv(t){return P.isNumberType(t.column.type)&&t.condition===Qe.IS_BETWEEN?`${t.start} < ${t.column.name} < ${t.end}`:`${t.column.name} ${nv(t.column.type,t.condition)}
34
+ ${_v(t)}`}const kv=t=>{const{rules:e=[],onChange:n=aa,onCreate:s=aa,onSelect:i=aa}=t,o=S.exports.useCallback((c,h,u)=>{c.stopPropagation(),ah.debug("Rule clicked",h,u),i(u)},[i]),r=S.exports.useCallback((c,h,u)=>{c.stopPropagation(),ah.debug("Delete button clicked",h,u);const m=[...e];m.splice(u,1),n(m)},[n,e]),l=S.exports.useCallback(c=>{c.stopPropagation()},[]),a=S.exports.useCallback(c=>{if(Yt.stopDragging(),c.destination==null)return;const h=c.source.index,u=c.destination.index,m=[...e],p=e[h];m.splice(h,1),m.splice(u,0,p),n(m)},[n,e]);return w("div",{className:"conditional-formatting-rules",children:[d(Ho,{onDragStart:Yt.startDragging,onDragEnd:a,children:d(Po,{droppableId:"droppable-custom-columns",children:(c,h)=>w("div",{ref:c.innerRef,...c.droppableProps,className:W("droppable-container",{dragging:h.draggingFromThisWith}),children:[e.length===0&&d("div",{className:"text-muted pl-2",children:"No formats defined"}),e.map((u,m)=>d(il,{draggableId:`${m}-${u.type}`,index:m,disableInteractiveElementBlocking:!0,children:(p,g)=>d("div",{role:"menuitem",tabIndex:0,onClick:f=>o(f,u,m),className:W("draggable-container",{dragging:g.isDragging}),ref:p.innerRef,...p.draggableProps,children:d("div",{className:"conditional-formatting-list-item",children:w("div",{className:"formatting-item",children:[d("div",{className:"rule-icon",children:d("span",{className:"rule-icon-bg",style:{backgroundColor:Xr(u.config.style),color:jr(u.config.style)},children:u.type===qn.ROWS?"row":"col"})}),d("div",{className:"rule-title",children:Lv(u.config)}),w("button",{type:"button",className:"btn btn-link btn-link-icon ml-1 px-2",onClick:f=>r(f,u,m),children:[d(pe,{children:"Delete rule"}),d(z,{icon:_n})]}),w("button",{type:"button",className:"btn btn-link btn-link-icon px-2 btn-drag-handle",onClick:l,...p.dragHandleProps,children:[d(pe,{children:"Drag to re-order"}),d(z,{icon:ll})]})]})})})},`${m}-${u.type}`)),c.placeholder]})})}),d("hr",{}),d(ce,{kind:"ghost",onClick:s,icon:As,children:"Add New Rule"})]})},Ni=X.module("ConditionEditor"),Ov=()=>{},Av=[Qe.IS_EQUAL,Qe.IS_NOT_EQUAL,Qe.IS_BETWEEN,Qe.GREATER_THAN,Qe.GREATER_THAN_OR_EQUAL,Qe.LESS_THAN,Qe.LESS_THAN_OR_EQUAL,Qe.IS_NULL,Qe.IS_NOT_NULL].map(t=>d("option",{value:t,children:U0(t)},t)),Pv=[ln.IS_EXACTLY,ln.IS_NOT_EXACTLY,ln.CONTAINS,ln.DOES_NOT_CONTAIN,ln.STARTS_WITH,ln.ENDS_WITH,ln.IS_NULL,ln.IS_NOT_NULL].map(t=>d("option",{value:t,children:B0(t)},t)),Hv=[Ht.IS_EXACTLY,Ht.IS_NOT_EXACTLY,Ht.IS_BEFORE,Ht.IS_BEFORE_OR_EQUAL,Ht.IS_AFTER,Ht.IS_AFTER_OR_EQUAL,Ht.IS_NULL,Ht.IS_NOT_NULL].map(t=>d("option",{value:t,children:$0(t)},t)),Vv=[Do.IS_TRUE,Do.IS_FALSE,Do.IS_NULL,Do.IS_NOT_NULL].map(t=>d("option",{value:t,children:W0(t)},t)),Uv=[oi.IS_EQUAL,oi.IS_NOT_EQUAL,oi.IS_NULL,oi.IS_NOT_NULL].map(t=>d("option",{value:t,children:z0(t)},t));function Bv(t,e,n,s){return t===Qe.IS_NULL||t===Qe.IS_NOT_NULL||t===Qe.IS_BETWEEN&&n!=null&&n!==""&&!Number.isNaN(Number.parseFloat(n))&&s!=null&&s!==""&&!Number.isNaN(Number.parseFloat(s))||t!==Qe.IS_BETWEEN&&e!==void 0&&e!==""&&!Number.isNaN(Number.parseFloat(e))}function $v(t,e,n,s,i,o,r){switch(t){case Qe.IS_EQUAL:case Qe.IS_NOT_EQUAL:case Qe.GREATER_THAN:case Qe.GREATER_THAN_OR_EQUAL:case Qe.LESS_THAN:case Qe.LESS_THAN_OR_EQUAL:return d("input",{type:"number",className:"form-control",placeholder:"Enter value",value:i!=null?i:"",onChange:e});case Qe.IS_BETWEEN:return w("div",{className:"d-flex flex-row",children:[d("input",{type:"number",className:"form-control d-flex mr-2",placeholder:"Start value",value:o!=null?o:"",onChange:n}),d("input",{type:"number",className:"form-control d-flex",placeholder:"End value",value:r!=null?r:"",onChange:s})]});case Qe.IS_NULL:case Qe.IS_NOT_NULL:return null}}function Wv(t,e,n){switch(t){case ln.IS_NULL:case ln.IS_NOT_NULL:return null;default:return d("input",{type:"text",className:"form-control",placeholder:"Enter value",value:n!=null?n:"",onChange:e})}}function zv(t,e,n){switch(t){case Ht.IS_NULL:case Ht.IS_NOT_NULL:return null;default:return d("input",{type:"text",className:"form-control",placeholder:"Enter value",value:n!=null?n:"",onChange:e})}}function Gv(){return null}function Kv(t,e,n){switch(t){case oi.IS_NULL:case oi.IS_NOT_NULL:return null;default:return d("input",{type:"text",className:"form-control",maxLength:1,placeholder:"Enter value",value:n!=null?n:"",onChange:e})}}const Km=t=>{const{column:e,config:n,onChange:s=Ov}=t,i=e.type,[o,r]=S.exports.useState(i),[l,a]=S.exports.useState(n.condition),[c,h]=S.exports.useState(n.value),[u,m]=S.exports.useState(n.start),[p,g]=S.exports.useState(n.end);i!==o&&(a(km(i)),h(void 0),m(void 0),g(void 0),r(i));const f=S.exports.useMemo(()=>{if(i===void 0)return[];if(P.isNumberType(i))return Av;if(P.isCharType(i))return Uv;if(P.isStringType(i))return Pv;if(P.isDateType(i))return Hv;if(P.isBooleanType(i))return Vv},[i]),b=S.exports.useCallback(y=>{const{value:I}=y.target;Ni.debug("handleConditionChange",I),a(I)},[]),C=S.exports.useCallback(y=>{const{value:I}=y.target;Ni.debug("handleValueChange",I),h(I)},[]),v=S.exports.useCallback(y=>{const{value:I}=y.target;Ni.debug("handleStartValueChange",I),m(I)},[]),T=S.exports.useCallback(y=>{const{value:I}=y.target;Ni.debug("handleEndValueChange",I),g(I)},[]);S.exports.useEffect(function(){let I=!0;l===void 0&&(Ni.debug("Unable to create formatting rule. Condition is not selected."),I=!1),P.isNumberType(e.type)&&!Bv(l,c,u,p)&&(Ni.debug("Unable to create formatting rule. Invalid value",c),I=!1),s({condition:l,value:c,start:u,end:p},I)},[s,e.type,l,c,u,p]);const E=S.exports.useMemo(()=>{if(i===void 0)return null;if(P.isNumberType(i))return $v(l,C,v,T,c,u,p);if(P.isCharType(i))return Kv(l,C,c);if(P.isStringType(i))return Wv(l,C,c);if(P.isDateType(i))return zv(l,C,c);if(P.isBooleanType(i))return Gv()},[i,l,c,u,p,C,v,T]);return w("div",{className:"condition-editor mb-2",children:[d("select",{value:l,id:"condition-select",className:"custom-select mb-2",onChange:b,children:f}),E]})};const qv=X.module("StyleEditor"),Yv="#fcfcfa",Xv="#f0f0ee",jv="#1a171a",Qv=200,Zv=()=>{},qm=t=>{var T,E;const{config:e,onChange:n=Zv}=t,[s,i]=S.exports.useState(e.type),[o,r]=S.exports.useState((E=(T=e.customConfig)==null?void 0:T.background)!=null?E:Yv),[l,a]=S.exports.useState(!1),[c,h]=S.exports.useState(Qv),u=S.exports.useRef(null),m=S.exports.useCallback(y=>{const{value:I}=y.target;qv.debug("handleBackgroundChange",I),r(I)},[]),p=S.exports.useCallback(()=>{l&&a(!1)},[l]),g=S.exports.useCallback(()=>{l||b(),a(!l)},[l]),f=S.exports.useMemo(()=>[Un.NO_FORMATTING,Un.POSITIVE,Un.NEGATIVE,Un.WARN,Un.NEUTRAL,Un.ACCENT_1,Un.ACCENT_2,Un.CUSTOM],[]);function b(){u.current&&h(u.current.getBoundingClientRect().width)}S.exports.useEffect(function(){n({type:s,customConfig:{color:cl.isDark(o)?Xv:jv,background:o}})},[n,s,o]);const C=S.exports.useCallback(()=>{const y=[];for(let I=0;I<f.length;I+=1){const D=f[I],M=`option-${I}-${D}`;y.push(w(ce,{kind:"inline",className:"style-option-btn",onClick:()=>{i(D),a(!1)},style:{color:jr({type:D}),background:Xr({type:D})},children:[D===s&&d(z,{icon:ai,className:"mr-2"}),D!==s&&d("span",{className:"mr-4"}),oh(D)]},M))}return y},[f,s]),v=S.exports.useCallback(()=>d("div",{className:"style-menu-container",role:"presentation",style:{width:c},children:d("div",{className:"style-options",children:C()})}),[c,C]);return w("div",{className:"style-editor",children:[w("div",{className:"mb-2",ref:u,children:[d("label",{className:"mb-0",children:"Style"}),w(ce,{kind:"inline",className:"cs-dropdown",style:{color:jr({type:s}),background:Xr({type:s})},onClick:g,children:[oh(s),d("span",{children:d(z,{icon:nc,className:"cs-caret"})}),d(zn,{isShown:l,actions:{menuElement:v()},popperOptions:{placement:"bottom-start"},popperClassName:"style-dropdown-menu",onMenuClosed:p,menuStyle:{maxWidth:"100rem"}})]})]}),s===Un.CUSTOM&&w("div",{className:"mb-2",children:[d("label",{className:"mb-0",children:"Background"}),d("input",{type:"color",value:o,className:"custom-select color-select",onChange:m})]})]})},Co=X.module("ColumnFormatEditor"),Jv=()=>{};function eT(t){const{type:e,name:n}=t[0];return{column:{type:e,name:n},style:Am(),...Dl(e)}}const tT=t=>{var b;const{columns:e,config:n=eT(e),onChange:s=Jv}=t,[i,o]=S.exports.useState((b=e.find(C=>C.name===n.column.name&&C.type===n.column.type))!=null?b:e[0]),[r,l]=S.exports.useState(Om(n)),[a,c]=S.exports.useState(!1),[h,u]=S.exports.useState(n.style),m=S.exports.useCallback(C=>{const v=e.find(({name:T})=>T===C);v!==void 0?(o(v),i.type!==v.type&&(l(Dl(v.type)),c(!1))):Co.error(`Column ${C} not found.`)},[e,i]),p=S.exports.useCallback((C,v)=>{Co.debug("handleConditionChange",C,v),l(C),c(v)},[]),g=S.exports.useCallback(C=>{Co.debug("handleStyleChange",C),u(C)},[]);S.exports.useEffect(function(){if(i===void 0){Co.debug("Column is not selected, skip update.");return}if(h===void 0){Co.debug("Style is not selected, skip update.");return}const{type:v,name:T}=i;s({column:{type:v,name:T},style:h,...r},a)},[s,i,h,r,a]);const f=e.map(({name:C})=>({title:C,value:C}));return w("div",{className:"conditional-rule-editor form",children:[w("div",{className:"mb-2",children:[d("label",{className:"mb-0",children:"Format Cell If"}),d(Zi,{defaultValue:i==null?void 0:i.name,options:f,inputPlaceholder:"Select a column",spellCheck:!1,onChange:m,searchPlaceholder:"Filter columns"})]}),i!==void 0&&w(ue,{children:[d(Km,{column:i,config:r,onChange:p}),d(qm,{config:h,onChange:g})]})]})},bo=X.module("RowFormatEditor"),nT=()=>{};function sT(t){const{type:e,name:n}=t[0];return{column:{type:e,name:n},style:Am(),...Dl(e)}}const iT=t=>{var b;const{columns:e,config:n=sT(e),onChange:s=nT}=t,[i,o]=S.exports.useState((b=e.find(C=>C.name===n.column.name&&C.type===n.column.type))!=null?b:e[0]),[r,l]=S.exports.useState(Om(n)),[a,c]=S.exports.useState(!1),[h,u]=S.exports.useState(n.style),m=S.exports.useCallback(C=>{const v=e.find(({name:T})=>T===C);v!==void 0?(o(v),i.type!==v.type&&(l(Dl(v.type)),c(!1))):bo.error(`Column ${C} not found.`)},[e,i]),p=S.exports.useCallback((C,v)=>{bo.debug("handleConditionChange",C,v),l(C),c(v)},[]),g=S.exports.useCallback(C=>{bo.debug("handleStyleChange",C),u(C)},[]);S.exports.useEffect(function(){if(i===void 0){bo.debug("Column is not selected, skip update.");return}if(h===void 0){bo.debug("Style is not selected, skip update.");return}const{type:v,name:T}=i;s({column:{type:v,name:T},style:h,...r},a)},[s,i,h,r,a]);const f=e.map(({name:C})=>({title:C,value:C}));return w("div",{className:"conditional-rule-editor form",children:[w("div",{className:"mb-2",children:[d("label",{className:"mb-0",children:"Format Row If"}),d(Zi,{defaultValue:i==null?void 0:i.name,options:f,inputPlaceholder:"Select a column",spellCheck:!1,onChange:m,searchPlaceholder:"Filter columns"})]}),i!==void 0&&w(ue,{children:[d(Km,{column:i,config:r,onChange:p}),d(qm,{config:h,onChange:g})]})]})};const ca=X.module("ConditionalFormatEditor"),da=()=>{};function oT(t){switch(t){case qn.CONDITIONAL:return d(n0,{});case qn.ROWS:return d(s0,{})}}function rT(t){switch(t){case qn.CONDITIONAL:return"Conditional";case qn.ROWS:return"Rows"}}const ch=[qn.CONDITIONAL,qn.ROWS],lT=t=>{var C;const{columns:e,onSave:n=da,onUpdate:s=da,onCancel:i=da,rule:o}=t,r=e.filter(iv),[l,a]=S.exports.useState((C=o==null?void 0:o.type)!=null?C:ch[0]),[c,h]=S.exports.useState(o),[u,m]=S.exports.useState(!1),p=S.exports.useCallback(()=>{i()},[i]),g=S.exports.useCallback(()=>{if(c===void 0){ca.error("Rule is not defined.");return}n(c)},[n,c]),f=S.exports.useCallback(v=>{ca.debug("handleFormatterChange",v),a(v)},[]),b=S.exports.useCallback((v,T)=>{ca.debug("handleRuleChange",v,T,l);const E={type:l,config:v};h(E),m(T),s(T?E:void 0)},[s,l]);return w("div",{className:"conditional-format-editor form",children:[w("div",{className:"mb-2",children:[d("label",{className:"mb-0",htmlFor:"formatter-select",children:"Select Formatter"}),d("div",{className:"formatter-list",children:ch.map((v,T)=>d("div",{className:"formatter-type",children:w("button",{type:"button",className:W("btn","btn-icon","btn-formatter-type",{active:v===l}),"data-index":T,onClick:()=>f(v),children:[oT(v),rT(v)]})},v))})]}),l===qn.CONDITIONAL&&d(tT,{columns:r,config:c==null?void 0:c.config,onChange:b}),l===qn.ROWS&&d(iT,{columns:r,config:c==null?void 0:c.config,onChange:b}),d("hr",{}),w("div",{className:"d-flex justify-content-end my-3",children:[d(ce,{kind:"secondary",onClick:p,className:"mr-2",children:"Cancel"}),d(ce,{kind:"primary",onClick:g,disabled:c===void 0||!u,children:"Done"})]})]})};function aT({text:t,isOpen:e,onClose:n}){const[s,i]=S.exports.useState(!1),[o,r]=S.exports.useState(0),[l,a]=S.exports.useState(!1),[c,h]=S.exports.useState(!1),[u,m]=S.exports.useState(!1),p=S.exports.useRef(),g=S.exports.useRef(null),[f,b]=S.exports.useState(!1);S.exports.useEffect(function(){if(!!e){try{JSON.parse(t),m(!0)}catch{m(!1)}h(!1)}},[e,t]),S.exports.useEffect(function(){p.current&&p.current.layout()},[o]),S.exports.useEffect(function(){p.current&&p.current.updateOptions({lineNumbers:l?"on":"off"})},[l]),S.exports.useEffect(()=>(g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{b(!1)},1e3),()=>{g.current&&clearTimeout(g.current)}),[f]);function C(){var D,M;xe.copyToClipboard((M=(D=p.current)==null?void 0:D.getValue())!=null?M:t).then(()=>{b(!0)})}function v(){a(!l)}function T(){var M;const D=(M=p.current)==null?void 0:M.getModel();!u||!D||(c?(D.setValue(t),h(!1)):(D.setValue(JSON.stringify(JSON.parse(t),void 0,2)),h(!0)),E())}function E(){var M,x;const D=p.current;!D||a(((x=(M=D.getModel())==null?void 0:M.getLineCount())!=null?x:0)>1)}function y(){s&&(p.current=void 0,n())}function I(D){p.current=D,D.onDidContentSizeChange(({contentHeight:M})=>r(M)),E()}return!e&&!s?null:w(Vo,{isOpen:e,centered:!0,keyboard:!0,toggle:y,onOpened:()=>i(!0),onClosed:()=>{i(!1),r(0)},className:"theme-bg-dark cell-overflow-modal",children:[w(Bo,{toggle:n,children:[d("h5",{className:"overflow-modal-title",children:"Cell Contents"}),d(ce,{kind:"inline",icon:f?ja:Ya,tooltip:f?"Copied contents":"Copy contents",onClick:C}),d(ce,{kind:"inline",active:l,icon:sf,tooltip:"Toggle line numbers",onClick:v}),u&&d(ce,{kind:"inline",icon:ef,active:c,tooltip:"Format as JSON",onClick:T})]}),d(Uo,{style:{height:o},children:d(Cl,{onEditorInitialized:I,settings:{value:t,readOnly:!0,wordWrap:"on",language:u?"typescript":"plaintext",folding:u,padding:{bottom:16},lineNumbers:l?"on":"off",overviewRulerLanes:0,renderLineHighlight:"none",find:{seedSearchStringFromSelection:"never"}}})})]})}const cT="###,##0",dT=({gotoRow:t,gotoRowError:e,onSubmit:n,isShown:s,onEntering:i,onEntered:o,onExiting:r,onExited:l,model:a,onGotoRowNumberChanged:c,onClose:h})=>{const u=S.exports.useRef(null),m="Row number",{rowCount:p}=a;return S.exports.useEffect(()=>{var g;document.activeElement!==u.current&&((g=u.current)==null||g.select())},[t]),d(Nl,{isShown:s,className:W("goto-row"),onEntering:i,onEntered:()=>{var g;o(),(g=u.current)==null||g.select()},onExiting:r,onExited:l,children:w(ue,{children:[w("div",{className:"goto-row-wrapper",children:[d("div",{className:"goto-row-text",children:"Go to row"}),d("div",{className:"goto-row-input",children:d("input",{ref:u,type:"number",onKeyDown:g=>{g.key==="Enter"&&(g.stopPropagation(),g.preventDefault(),n())},className:W("form-control",{"is-invalid":e!==""}),placeholder:m,onChange:g=>{c(g)},value:t})}),w("div",{className:"goto-row-text",children:["of ",dh.i18n.NumberFormat.format(cT,p)]}),e&&d("div",{className:"goto-row-error text-danger",children:e})]}),d("div",{className:"goto-row-close",children:d(ce,{kind:"ghost",onClick:h,children:d(z,{icon:$o,style:{marginRight:"0"}})})})]})})},Se=X.module("IrisGrid"),hT=500,uT=250,mT=250,Ym=Object.freeze({aggregations:[],showOnTop:!1});function hh({advancedFilters:t,aggregationSettings:e,customColumns:n,quickFilters:s,reverseType:i,rollupConfig:o,searchFilter:r,selectDistinctColumns:l,sorts:a}){return t.size===0&&e.aggregations.length===0&&n.length===0&&s.size===0&&i===P.REVERSE_TYPE.NONE&&o==null&&r==null&&l.length===0&&a.length===0}const ti=class extends S.exports.Component{constructor(t){super(t),this.getAdvancedMenuOpenedHandler=Ie(F=>this.handleAdvancedMenuOpened.bind(this,F),{max:100}),this.getCachedAdvancedFilterMenuActions=Ie((F,_,L,V,G)=>d(Mc,{model:F,column:_,onFilterChange:this.handleAdvancedFilterChange,onSortChange:this.handleAdvancedFilterSortChange,onDone:this.handleAdvancedFilterDone,options:L,sortDirection:V,formatter:G}),{max:50}),this.getCachedOptionItems=Ie((F,_,L,V,G,j,ne,ye,le,Te,He,Z,ge,be,Le)=>{const Oe=[];return F&&Oe.push({type:Ae.CHART_BUILDER,title:"Chart Builder",icon:Df}),Oe.push({type:Ae.VISIBILITY_ORDERING_BUILDER,title:"Column Visibility & Ordering",icon:Ta}),L&&Oe.push({type:Ae.CONDITIONAL_FORMATTING,title:"Conditional Formatting",icon:rl}),_&&Oe.push({type:Ae.CUSTOM_COLUMN_BUILDER,title:"Manage Custom Columns",icon:uf}),V&&Oe.push({type:Ae.ROLLUP_ROWS,title:"Rollup Rows",icon:tu}),G&&Oe.push({type:Ae.AGGREGATIONS,title:"Aggregate Columns",icon:mf}),j&&Oe.push({type:Ae.SELECT_DISTINCT,title:"Select Distinct Values",icon:hf}),ne&&ge&&Oe.push({type:Ae.TABLE_EXPORTER,title:"Download CSV",icon:qg}),Oe.push({type:Ae.ADVANCED_SETTINGS,title:"Advanced Settings",icon:pf}),Oe.push({type:Ae.QUICK_FILTERS,title:"Quick Filters",subtitle:ye.shortcut.getDisplayText(),icon:Br,isOn:He,onChange:ye.action}),be&&Oe.push({type:Ae.SEARCH_BAR,title:"Search Bar",subtitle:le.shortcut.getDisplayText(),icon:Jh,isOn:Z,onChange:le.action}),Oe.push({type:Ae.GOTO,title:"Go to",subtitle:Te.shortcut.getDisplayText(),icon:df,isOn:Le,onChange:Te.action}),Oe},{max:1}),this.getCachedHiddenColumns=Ie(F=>F,{max:1,normalizer:([F])=>F.join()}),this.getAggregationMap=Ie((F,_)=>{const L={};return _.forEach(({operation:V,selected:G,invert:j})=>{L[V]=Ls.getOperationColumnNames(F,V,G,j)}),L}),this.getOperationMap=Ie((F,_)=>{const L={};return _.filter(V=>!Ls.isRollupOperation(V.operation)).forEach(({operation:V,selected:G,invert:j})=>{Ls.getOperationColumnNames(F,V,G,j).forEach(ne=>{var le;const ye=[...(le=L[ne])!=null?le:[],V];L[ne]=ye})}),L}),this.getOperationOrder=Ie(F=>F.map(_=>_.operation).filter(_=>!Ls.isRollupOperation(_))),this.getCachedFormatColumns=Ie((F,_)=>sv(F,_)),this.getCachedModelColumns=Ie((F,_)=>F.columns),this.getCachedPreviewFormatColumns=Ie((F,_,L,V)=>{if(Se.debug("getCachedPreviewFormatColumns",_,L,V),L!==void 0&&V!==void 0){const G=[..._];return G[V]=L,this.getCachedFormatColumns(F,G)}return this.getCachedFormatColumns(F,_)}),this.getModelRollupConfig=Ie((F,_,L)=>te.getModelRollupConfig(F,_,L)),this.getModelTotalsConfig=Ie((F,_,L)=>{var ye,le,Te;const{aggregations:V,showOnTop:G}=L;if(((le=(ye=_==null?void 0:_.columns)==null?void 0:ye.length)!=null?le:0)>0||((Te=V==null?void 0:V.length)!=null?Te:0)===0)return null;const j=this.getOperationMap(F,V),ne=this.getOperationOrder(V);return{operationMap:j,operationOrder:ne,showOnTop:G}}),this.getCachedStateOverride=Ie((F,_,L,V,G,j,ne,ye,le,Te)=>({hoverSelectColumn:F,isFilterBarShown:_,isSelectingColumn:L,loadingScrimProgress:V,quickFilters:G,advancedFilters:j,sorts:ne,reverseType:ye,rollupConfig:le,isMenuShown:Te}),{max:1}),this.getCachedFilter=Ie((F,_,L,V,G)=>[...F!=null?F:[],...V!=null?V:[],...te.getFiltersFromFilterMap(_),...te.getFiltersFromFilterMap(L),...G!=null?G:[]],{max:1}),this.getCachedTheme=Ie((F,_)=>({...Bm,...F,autoSelectRow:!_}),{max:1}),this.getAlwaysFetchColumns=Ie((F,_,L,V,G,j)=>{const ne=[];for(let le=0;le<V;le+=1)ne.push(_[K.getModelIndex(le,L)].name);for(let le=0;le<G;le+=1)ne.push(_[K.getModelIndex(_.length-1-le,L)].name);if(j)for(let le=j[0];le<=j[1];le+=1)ne.push(_[K.getModelIndex(le,L)].name);return[...new Set([...F,...ne])]}),this.updateSearchFilter=Je((F,_,L,V)=>{const G=yr.createSearchFilter(F,_,L,V);this.setState({searchFilter:G})},uT),this.handleConditionalFormatEditorUpdate=Je(F=>{this.setState({conditionalFormatPreview:F})},mT),this.handleDownloadProgressUpdate=mi((F,_)=>{const{tableDownloadStatus:L}=this.state;L===an.DOWNLOAD_STATUS.DOWNLOADING&&this.setState({tableDownloadProgress:F,tableDownloadEstimatedTime:_})},hT),this.getOverflowButtonTooltip=Ie(F=>{if(F==null)return null;const _={position:"absolute",...F,pointerEvents:"none"};return d("div",{style:_,children:d(pe,{options:{placement:"left",modifiers:{flip:{behavior:["left","right"]}}},ref:this.handleTooltipRef,children:"View full contents"},Date.now())})}),this.handleAdvancedFilterChange=this.handleAdvancedFilterChange.bind(this),this.handleAdvancedFilterSortChange=this.handleAdvancedFilterSortChange.bind(this),this.handleAdvancedFilterDone=this.handleAdvancedFilterDone.bind(this),this.handleAdvancedMenuOpened=this.handleAdvancedMenuOpened.bind(this),this.handleGotoRowOpened=this.handleGotoRowOpened.bind(this),this.handleGotoRowClosed=this.handleGotoRowClosed.bind(this),this.handleAdvancedMenuClosed=this.handleAdvancedMenuClosed.bind(this),this.handleAggregationChange=this.handleAggregationChange.bind(this),this.handleAggregationsChange=this.handleAggregationsChange.bind(this),this.handleAggregationEdit=this.handleAggregationEdit.bind(this),this.handleAnimationLoop=this.handleAnimationLoop.bind(this),this.handleAnimationStart=this.handleAnimationStart.bind(this),this.handleAnimationEnd=this.handleAnimationEnd.bind(this),this.handleChartChange=this.handleChartChange.bind(this),this.handleChartCreate=this.handleChartCreate.bind(this),this.handleGridError=this.handleGridError.bind(this),this.handleFilterBarChange=this.handleFilterBarChange.bind(this),this.handleFilterBarDone=this.handleFilterBarDone.bind(this),this.handleFilterBarTab=this.handleFilterBarTab.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleMenu=this.handleMenu.bind(this),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleMenuSelect=this.handleMenuSelect.bind(this),this.handleMenuBack=this.handleMenuBack.bind(this),this.handleRequestFailed=this.handleRequestFailed.bind(this),this.handleSelectionChanged=this.handleSelectionChanged.bind(this),this.handleMovedColumnsChanged=this.handleMovedColumnsChanged.bind(this),this.handleUpdate=this.handleUpdate.bind(this),this.handleTooltipRef=this.handleTooltipRef.bind(this),this.handleViewChanged=this.handleViewChanged.bind(this),this.handleFormatSelection=this.handleFormatSelection.bind(this),this.handleConditionalFormatCreate=this.handleConditionalFormatCreate.bind(this),this.handleConditionalFormatEdit=this.handleConditionalFormatEdit.bind(this),this.handleConditionalFormatsChange=this.handleConditionalFormatsChange.bind(this),this.handleConditionalFormatEditorSave=this.handleConditionalFormatEditorSave.bind(this),this.handleConditionalFormatEditorCancel=this.handleConditionalFormatEditorCancel.bind(this),this.handleUpdateCustomColumns=this.handleUpdateCustomColumns.bind(this),this.handleCustomColumnsChanged=this.handleCustomColumnsChanged.bind(this),this.handleSelectDistinctChanged=this.handleSelectDistinctChanged.bind(this),this.handlePendingDataUpdated=this.handlePendingDataUpdated.bind(this),this.handlePendingCommitClicked=this.handlePendingCommitClicked.bind(this),this.handlePendingDiscardClicked=this.handlePendingDiscardClicked.bind(this),this.handleGotoRowSelectedRowNumberSubmit=this.handleGotoRowSelectedRowNumberSubmit.bind(this),this.focusRowInGrid=this.focusRowInGrid.bind(this),this.handleDownloadTable=this.handleDownloadTable.bind(this),this.handleDownloadTableStart=this.handleDownloadTableStart.bind(this),this.handleCancelDownloadTable=this.handleCancelDownloadTable.bind(this),this.handleDownloadCanceled=this.handleDownloadCanceled.bind(this),this.handleDownloadCompleted=this.handleDownloadCompleted.bind(this),this.handlePartitionAppend=this.handlePartitionAppend.bind(this),this.handlePartitionChange=this.handlePartitionChange.bind(this),this.handlePartitionFetchAll=this.handlePartitionFetchAll.bind(this),this.handlePartitionDone=this.handlePartitionDone.bind(this),this.handleColumnVisibilityChanged=this.handleColumnVisibilityChanged.bind(this),this.handleCrossColumnSearch=this.handleCrossColumnSearch.bind(this),this.handleRollupChange=this.handleRollupChange.bind(this),this.handleOverflowClose=this.handleOverflowClose.bind(this),this.getColumnBoundingRect=this.getColumnBoundingRect.bind(this),this.handleGotoRowSelectedRowNumberChanged=this.handleGotoRowSelectedRowNumberChanged.bind(this),this.grid=null,this.gridWrapper=null,this.lastLoadedConfig=null,this.pending=new gs,this.globalColumnFormats=[],this.decimalFormatOptions={},this.integerFormatOptions={},this.truncateNumbersWithPound=!1,this.renderer=new Fo,this.tableSaver=null,this.crossColumnRef=Y.createRef(),this.isAnimating=!1,this.filterInputRef=Y.createRef(),this.toggleFilterBarAction={action:()=>this.toggleFilterBar(),shortcut:hn.TABLE.TOGGLE_QUICK_FILTER},this.toggleSearchBarAction={action:()=>this.toggleSearchBar(),shortcut:hn.TABLE.TOGGLE_SEARCH},this.toggleGotoRowAction={action:()=>this.toggleGotoRow(),shortcut:hn.TABLE.GOTO_ROW},this.discardAction={action:()=>{const{model:F}=this.props;nt(F)&&F.isEditable&&F.pendingDataMap.size>0&&this.discardPending().catch(Se.error)},shortcut:hn.INPUT_TABLE.DISCARD},this.commitAction={action:()=>{const{model:F}=this.props;nt(F)&&F.isEditable&&F.pendingDataMap.size>0&&F.pendingDataErrors.size===0&&this.commitPending().catch(Se.error)},shortcut:hn.INPUT_TABLE.COMMIT},this.contextActions=[this.toggleFilterBarAction,this.toggleSearchBarAction,this.toggleGotoRowAction,this.discardAction,this.commitAction];const{aggregationSettings:e,conditionalFormats:n,customColumnFormatMap:s,isFilterBarShown:i,isSelectingPartition:o,model:r,movedColumns:l,movedRows:a,partition:c,partitionColumn:h,rollupConfig:u,userColumnWidths:m,userRowHeights:p,showSearchBar:g,searchValue:f,selectedSearchColumns:b,invertSearchColumns:C,advancedFilters:v,quickFilters:T,selectDistinctColumns:E,pendingDataMap:y,canCopy:I,frozenColumns:D}=t,M=[new hv(this),new uv(this)];I&&M.push(new av(this));const x=[new mv(this),new pv(this),new gv(this),new Sv(this),new bv(this),new Cs(this),new Cv(this),new wv(this)],B=l.length>0?l:r.movedColumns,$=a.length>0?a:r.movedRows,k=new Ev({userColumnWidths:new Map(m),userRowHeights:new Map(p),movedColumns:B}),H=b!=null?b:[],O=yr.createSearchFilter(f,H,r.columns,C);this.state={isFilterBarShown:i,isSelectingPartition:o,focusedFilterBarColumn:null,metricCalculator:k,metrics:void 0,keyHandlers:M,mouseHandlers:x,partition:c,partitionColumn:h,partitionTable:null,partitionFilters:[],quickFilters:T?new Map(T):new Map,advancedFilters:new Map(v),shownAdvancedFilter:null,hoverAdvancedFilter:null,sorts:[],reverseType:P.REVERSE_TYPE.NONE,customColumns:[],selectDistinctColumns:E,selectedRanges:[],copyOperation:null,loadingText:null,loadingScrimProgress:null,loadingSpinnerShown:!1,movedColumns:B,movedRows:$,shownColumnTooltip:null,formatter:new pn,isMenuShown:!1,customColumnFormatMap:new Map(s),conditionalFormats:n,conditionalFormatEditIndex:null,conditionalFormatPreview:void 0,hoverSelectColumn:null,isTableDownloading:!1,isReady:!1,tableDownloadStatus:"",tableDownloadProgress:0,tableDownloadEstimatedTime:0,showSearchBar:g,searchFilter:O,searchValue:f,selectedSearchColumns:H,invertSearchColumns:C,rollupConfig:u,rollupSelectedColumns:[],aggregationSettings:e,selectedAggregation:null,openOptions:[],pendingRowCount:0,pendingDataMap:y!=null?y:new Map,pendingDataErrors:new Map,pendingSavePromise:null,pendingSaveError:null,toastMessage:null,frozenColumns:D,showOverflowModal:!1,overflowText:"",overflowButtonTooltipProps:null,isGotoRowShown:!1,gotoRow:"",gotoRowError:""}}static makeQuickFilter(t,e,n){try{return P.makeQuickFilter(t,e,n)}catch(s){Se.error("Error creating quick filter",s)}return null}componentDidMount(){const{partitionColumn:t,model:e}=this.props,n=t!=null?t:e.columns.find(s=>s.isPartitionColumn);e.isFilterRequired&&e.isValuesTableAvailable&&n!=null?this.loadPartitionsTable(n):this.initState(),this.startListening(e)}componentDidUpdate(t){var h;const{inputFilters:e,isSelectingColumn:n,settings:s,model:i,customFilters:o,sorts:r}=this.props;i!==t.model&&(this.stopListening(t.model),this.startListening(i));const l=e!==t.inputFilters?e.filter(u=>!t.inputFilters.includes(u)):[];if(l.length>0){const{advancedSettings:u}=this.props,m=(h=u.get(gi.FILTER_CONTROL_CHANGE_CLEARS_ALL_FILTERS))!=null?h:!1;m&&(this.clearGridInputField(),this.clearCrossColumSearch()),this.startLoading("Filtering...",!0),this.applyInputFilters(l,m)}n!==t.isSelectingColumn&&this.resetColumnSelection(),s!==t.settings&&this.updateFormatterSettings(s),o!==t.customFilters&&this.startLoading("Filtering...",!0),r!==t.sorts&&this.updateSorts(r);const{loadingScrimStartTime:a,loadingScrimFinishTime:c}=this;a!=null&&c!=null&&window.requestAnimationFrame(()=>{const u=Date.now(),m=u-a,p=c-a,g=Math.min(m/p,1);c<u&&(this.loadingScrimStartTime=void 0,this.loadingScrimFinishTime=void 0),this.setState(f=>f.loadingScrimProgress==null?(Se.debug2("Ignoring scrim update because loading cancelled."),null):{loadingScrimProgress:g})}),this.sendStateChange()}componentWillUnmount(){const{model:t}=this.props;this.stopListening(t),this.pending.cancel(),this.updateSearchFilter.cancel(),this.loadingTimer&&clearTimeout(this.loadingTimer),this.handleDownloadProgressUpdate.cancel(),this.animationFrame!==void 0&&cancelAnimationFrame(this.animationFrame)}getValueForCell(t,e,n=!1){const{model:s}=this.props,i=this.getModelColumn(t),o=this.getModelRow(e);return n&&i!=null&&o!=null?s.valueForCell(i,o):n?null:i!=null&&o!=null?s.textForCell(i,o):""}getModelColumn(t){const{metrics:e}=this.state;A(e);const{modelColumns:n}=e;return n==null?null:t!=null?n.get(t):null}getModelRow(t){const{metrics:e}=this.state;A(e);const{modelRows:n}=e;return n==null?null:t!=null?n.get(t):null}getTheme(){var n;const{model:t,theme:e}=this.props;return this.getCachedTheme(e,(n=nt(t)&&t.isEditable)!=null?n:!1)}getVisibleColumn(t){const{movedColumns:e}=this.state;return K.getVisibleIndex(t,e)}applyInputFilters(t,e=!1){const{model:n}=this.props,{advancedFilters:s,quickFilters:i}=this.state,o=e?new Map:new Map(s),r=e?new Map:new Map(i);let l=e&&s.size>0;t.forEach(({name:a,type:c,value:h})=>{const u=n.columns.findIndex(({name:m,type:p})=>m===a&&p===c);u>=0?(l=o.delete(u)||l,l=this.applyQuickFilter(u,h,r)||l):Se.error("Unable to find column for inputFilter",a,c,h)}),l&&this.setState({quickFilters:r,advancedFilters:o})}applyQuickFilter(t,e,n){const{model:s}=this.props,{formatter:i}=s,o=s.columns[t];if(e!=null&&`${e}`.trim().length>0){const r=n.get(t);if(r!=null){const{text:l}=r;if(l===e)return Se.debug2("Ignoring change to existing filter"),!1}return n.set(t,{text:e,filter:ti.makeQuickFilter(o,e,i.timeZone)}),!0}return n.delete(t)}setAdvancedFilterMap(t){this.setState({advancedFilters:t})}setAdvancedFilter(t,e,n){Se.debug("Setting advanced filter",t,e),this.startLoading("Filtering...",!0),this.setState(({advancedFilters:s})=>{const i=new Map(s);return e==null?i.delete(t):i.set(t,{filter:e,options:n}),{advancedFilters:i}})}setQuickFilter(t,e,n){Se.debug("Setting quick filter",t,e,n),this.startLoading("Filtering...",!0),this.setState(({quickFilters:s})=>{const i=new Map(s);return i.set(t,{filter:e,text:n}),{quickFilters:i}})}setFilterMap(t){var i;Se.debug("setFilterMap",t);const{advancedSettings:e}=this.props;((i=e.get(gi.LINK_CHANGE_CLEARS_ALL_FILTERS))!=null?i:!1)&&this.clearAllFilters();const{model:s}=this.props;t.forEach(({columnType:o,text:r,value:l},a)=>{const c=s.columns.find(u=>u.name===a&&u.type===o);if(c==null)return;const h=s.getColumnIndexByName(c.name);if(A(h),l===null)this.setQuickFilter(h,c.filter().isNull(),"=null");else{const u=P.isTextType(o)?N.FilterValue.ofString(l):N.FilterValue.ofNumber(l);this.setQuickFilter(h,c.filter().eq(u),`${r}`)}})}removeColumnFilter(t){this.startLoading("Filtering...",!0),this.setState(({advancedFilters:e,quickFilters:n})=>{const s=e?new Map(e):new Map,i=n?new Map(n):new Map;return i.delete(t),s.delete(t),{quickFilters:i,advancedFilters:s}})}clearAllFilters(){Se.debug("Clearing all filters");const{advancedFilters:t,quickFilters:e,searchFilter:n}=this.state;e.size===0&&t.size===0&&n===null||(this.clearGridInputField(),this.startLoading("Clearing Filters...",!0),this.setState({quickFilters:new Map,advancedFilters:new Map,searchValue:"",searchFilter:void 0}))}clearCrossColumSearch(){Se.debug("Clearing cross-column search"),this.setState({searchValue:"",searchFilter:void 0})}clearGridInputField(){this.filterInputRef.current!=null&&this.filterInputRef.current.setValue("")}rebuildFilters(){Se.debug("Rebuilding filters");const{model:t}=this.props,{advancedFilters:e,quickFilters:n}=this.state,{columns:s,formatter:i}=t,o=new Map,r=new Map;e.forEach((l,a)=>{const{options:c}=l,h=s[a],u=P.makeAdvancedFilter(h,c,i.timeZone);o.set(a,{options:c,filter:u})}),n.forEach((l,a)=>{const{text:c}=l,h=s[a];r.set(a,{text:c,filter:ti.makeQuickFilter(h,c,i.timeZone)})}),this.startLoading("Rebuilding filters...",!0),this.setState({quickFilters:r,advancedFilters:o})}setFilters({quickFilters:t,advancedFilters:e}){this.setState({quickFilters:t,advancedFilters:e})}updateFormatterSettings(t,e=!0){var m,p,g;const n=us.getColumnFormats(t),s=us.getDateTimeFormatterOptions(t),i=(m=t==null?void 0:t.defaultDecimalFormatOptions)!=null?m:{},o=(p=t==null?void 0:t.defaultIntegerFormatOptions)!=null?p:{},r=(g=t==null?void 0:t.truncateNumbersWithPound)!=null?g:!1,l=!pt(this.globalColumnFormats,n),a=!pt(this.dateTimeFormatterOptions,s),c=!pt(this.decimalFormatOptions,t==null?void 0:t.defaultDecimalFormatOptions),h=!pt(this.integerFormatOptions,o),u=this.truncateNumbersWithPound!==r;(l||a||c||h||u)&&(this.globalColumnFormats=n,this.dateTimeFormatterOptions=s,this.decimalFormatOptions=i,this.integerFormatOptions=o,this.truncateNumbersWithPound=r,this.updateFormatter({},e),a&&e&&this.rebuildFilters())}updateFormatter(t,e=!0){var r;const{customColumnFormatMap:n}=this.state,s={customColumnFormatMap:n,...t},i=[...(r=this.globalColumnFormats)!=null?r:[],...s.customColumnFormatMap.values()],o=new pn(i,this.dateTimeFormatterOptions,this.decimalFormatOptions,this.integerFormatOptions,this.truncateNumbersWithPound);Se.debug("updateFormatter",this.globalColumnFormats,i),this.setState({...s,formatter:o},()=>{e&&this.grid&&this.grid.forceUpdate()})}initFormatter(){const{settings:t}=this.props;this.updateFormatterSettings(t)}initState(){const{applyInputFiltersOnInit:t,inputFilters:e,sorts:n,model:s,reverseType:i,customColumns:o,searchValue:r,selectedSearchColumns:l,invertSearchColumns:a}=this.props,c=l!=null?l:[],h=yr.createSearchFilter(r,c,s.columns,a);if(t){const u=e.filter(m=>m.value!=null);this.applyInputFilters(u)}this.setState({sorts:n,reverseType:i,customColumns:o,isReady:!0,searchFilter:h}),this.initFormatter()}async loadPartitionsTable(t){const{model:e}=this.props;this.setState({isSelectingPartition:!0});try{const n=await this.pending.add(e.valuesTable(t),r=>r.close()),s=n.columns[0],i=s.sort().desc();n.applySort([i]),n.setViewport(0,0,[s]);const o=await this.pending.add(n.getViewportData());if(o.rows.length>0){const l=o.rows[0].get(s);this.updatePartition(l,t),this.setState({isSelectingPartition:!0})}else Se.info("Table does not have any data, just fetching all"),this.setState({isSelectingPartition:!1}),this.handlePartitionFetchAll();this.setState({partitionTable:n,partitionColumn:t},()=>{this.initState()})}catch(n){this.handleTableLoadError(n)}}updatePartition(t,e){const s=[e.filter().eq(N.FilterValue.ofString(t))];this.setState({partition:t,partitionFilters:s})}copyCell(t,e,n=!1){const{canCopy:s}=this.props;if(s){const i=String(this.getValueForCell(t,e,n));xe.copyToClipboard(i).catch(o=>Se.error("Unable to copy cell",o))}else Se.error("Attempted to copyCell for user without copy permission.")}copyRanges(t,e=!1,n=!0,s){const{model:i,canCopy:o}=this.props,{metricCalculator:r,movedColumns:l}=this.state,a=r.getUserColumnWidths();if(o){const c={ranges:oe.boundedRanges(t,i.columnCount,i.rowCount),includeHeaders:e,formatValues:n,movedColumns:l,userColumnWidths:a,error:s};this.setState({copyOperation:c})}else Se.error("Attempted copyRanges for user without copy permission.")}startLoading(t,e=!1){var s,i;this.setState({loadingText:t});const n=this.getTheme();if(e&&this.grid&&(this.grid.clearSelectedRanges(),this.grid.setViewState({top:0},!0)),this.loadingScrimStartTime==null){const{minScrimTransitionTime:o,maxScrimTransitionTime:r}=n;A(o),A(r);const l=(i=(s=this.gridWrapper)==null?void 0:s.getBoundingClientRect().height)!=null?i:0,a=Math.max(o,Math.min(l/2,r));this.loadingScrimStartTime=Date.now(),this.loadingScrimFinishTime=this.loadingScrimStartTime+a,this.setState({loadingScrimProgress:0}),this.loadingTimer=setTimeout(()=>{this.setState({loadingSpinnerShown:!0})},ti.loadingSpinnerDelay)}}stopLoading(){this.loadingScrimStartTime=void 0,this.loadingScrimFinishTime=void 0,this.setState({loadingText:null,loadingScrimProgress:null,loadingSpinnerShown:!1}),this.loadingTimer!=null&&(clearTimeout(this.loadingTimer),this.loadingTimer=void 0)}rollback(){if(this.lastLoadedConfig){Se.debug("loading last loading config",this.lastLoadedConfig);const{advancedFilters:t,aggregationSettings:e,customColumns:n,quickFilters:s,reverseType:i,rollupConfig:o,searchFilter:r,selectDistinctColumns:l,sorts:a}=this.lastLoadedConfig;this.lastLoadedConfig=null,this.setState({advancedFilters:t,aggregationSettings:e,customColumns:n,quickFilters:s,reverseType:i,rollupConfig:o,searchFilter:r,selectDistinctColumns:l,sorts:a})}else Se.debug("remove all sorts, filters, and custom columns"),this.setState({advancedFilters:new Map,aggregationSettings:Ym,customColumns:[],quickFilters:new Map,reverseType:P.REVERSE_TYPE.NONE,rollupConfig:void 0,selectDistinctColumns:[],sorts:[]})}canRollback(){return this.lastLoadedConfig!=null||!hh(this.state)}startListening(t){t.addEventListener(we.EVENT.UPDATED,this.handleUpdate),t.addEventListener(we.EVENT.REQUEST_FAILED,this.handleRequestFailed),t.addEventListener(we.EVENT.COLUMNS_CHANGED,this.handleCustomColumnsChanged),t.addEventListener(we.EVENT.PENDING_DATA_UPDATED,this.handlePendingDataUpdated)}stopListening(t){t.removeEventListener(we.EVENT.UPDATED,this.handleUpdate),t.removeEventListener(we.EVENT.REQUEST_FAILED,this.handleRequestFailed),t.removeEventListener(we.EVENT.COLUMNS_CHANGED,this.handleCustomColumnsChanged),t.removeEventListener(we.EVENT.PENDING_DATA_UPDATED,this.handlePendingDataUpdated)}focus(){var t;(t=this.grid)==null||t.focus()}focusFilterBar(t){var h,u,m;const{model:e}=this.props,{columnCount:n}=e,s=this.getModelColumn(t);if(t==null||s==null||t<0||n<=t||!e.isFilterable(s)){this.setState({focusedFilterBarColumn:null});return}const{metricCalculator:i,metrics:o}=this.state;A(o);const{gridX:r,left:l,rightVisible:a,lastLeft:c}=o;if(t<l)(h=this.grid)==null||h.setViewState({left:t},!0);else if(a<t){const p=(u=this.grid)==null?void 0:u.getMetricState();A(p);const g=i.getLastLeft(p,t,r);(m=this.grid)==null||m.setViewState({left:Math.min(g,c)},!0)}this.lastFocusedFilterBarColumn=t,this.setState({focusedFilterBarColumn:t,isFilterBarShown:!0})}hideColumnByVisibleIndex(t){var s;const{metricCalculator:e,movedColumns:n}=this.state;e.setColumnWidth(K.getModelIndex(t,n),0),(s=this.grid)==null||s.forceUpdate()}freezeColumnByColumnName(t){const{frozenColumns:e,movedColumns:n}=this.state,{model:s}=this.props;Se.debug2("freezing column",t);const i=e==null?new Set(s.frozenColumns):new Set(e);i.add(t);const o=s.getColumnIndexByName(t);A(o);const r=K.getVisibleIndex(o,n),l=K.moveItem(r,i.size-1,n);this.setState({frozenColumns:[...i],movedColumns:l})}unFreezeColumnByColumnName(t){const{frozenColumns:e,movedColumns:n}=this.state,{model:s}=this.props;Se.debug2("unfreezing column",t);const i=e==null?new Set(s.frozenColumns):new Set(e);i.delete(t);const o=s.getColumnIndexByName(t);A(o);const r=K.getVisibleIndex(o,n),l=K.moveItem(r,i.size+s.frontColumns.length,n);this.setState({frozenColumns:[...i],movedColumns:l})}handleColumnVisibilityChanged(t,e){var s;const{metricCalculator:n}=this.state;e===fi.VISIBILITY_OPTIONS.SHOW?t.forEach(i=>{n.resetColumnWidth(i)}):t.forEach(i=>{n.setColumnWidth(i,0)}),(s=this.grid)==null||s.forceUpdate()}handleCrossColumnSearch(t,e,n){const{model:s}=this.props;this.updateSearchFilter(t,e,s.columns,n),this.setState({searchValue:t,selectedSearchColumns:e,invertSearchColumns:n})}handleAnimationLoop(){var t,e;(t=this.grid)==null||t.updateCanvasScale(),(e=this.grid)==null||e.updateCanvas(),this.isAnimating&&(this.animationFrame=requestAnimationFrame(this.handleAnimationLoop))}handleAnimationStart(){Se.debug2("handleAnimationStart"),this.isAnimating=!0,this.animationFrame=requestAnimationFrame(this.handleAnimationLoop)}handleAnimationEnd(){Se.debug2("handleAnimationEnd"),this.isAnimating=!1}handlePartitionAppend(t){const{onPartitionAppend:e}=this.props,{partitionColumn:n}=this.state;e(n,t)}handlePartitionChange(t){const{partitionColumn:e}=this.state;this.updatePartition(t,e)}handlePartitionFetchAll(){this.setState({partitionFilters:[],isSelectingPartition:!1})}handlePartitionDone(){this.setState({isSelectingPartition:!1})}handleTableLoadError(t){if(Re.isCanceled(t))return;Se.error(t);const{onError:e}=this.props;e(t)}showAllColumns(){var s;const{metricCalculator:t}=this.state,n=[...t.getUserColumnWidths().entries()];for(let i=0;i<n.length;i+=1){const[o,r]=n[i];r===0&&t.resetColumnWidth(o)}(s=this.grid)==null||s.forceUpdate()}toggleSort(t,e){Se.info("Toggling sort for column",t);const{model:n}=this.props,{sorts:s}=this.state,i=this.getModelColumn(t);A(i);const o=P.toggleSortForColumn(s,n.columns,i,e);this.updateSorts(o)}updateSorts(t){var e;this.startLoading("Sorting..."),this.setState({sorts:t}),(e=this.grid)==null||e.forceUpdate()}sortColumn(t,e=P.sortDirection.none,n=!1,s=!1){var r;A(t);const{model:i}=this.props,o=P.sortColumn(i.sort,i.columns,t,e,n,s);this.startLoading("Sorting..."),this.setState({sorts:o}),(r=this.grid)==null||r.forceUpdate()}reverse(t){var e;this.startLoading("Reversing..."),this.setState({reverseType:t}),(e=this.grid)==null||e.forceUpdate()}isReversible(){const{model:t}=this.props;return t.isReversible}toggleFilterBar(t=this.lastFocusedFilterBarColumn){var n;let{isFilterBarShown:e}=this.state;if(e=!e,this.setState({isFilterBarShown:e}),e)if(t!=null)this.focusFilterBar(t);else{let s=0;const{model:i}=this.props,{columnCount:o}=i;for(let r=0;r<o;r+=1){const l=this.getModelColumn(r);if(l!=null){const a=i.columns[l];if(a!=null&&P.isTextType(a.type)){s=r;break}}}this.focusFilterBar(s)}else(n=this.grid)==null||n.focus()}isTableSearchAvailable(){var s,i,o;const{model:t,canToggleSearch:e}=this.props,n=(s=t==null?void 0:t.layoutHints)==null?void 0:s.searchDisplayMode;return n===((i=N.SearchDisplayMode)==null?void 0:i.SEARCH_DISPLAY_HIDE)?!1:n===((o=N.SearchDisplayMode)==null?void 0:o.SEARCH_DISPLAY_SHOW)?!0:e}toggleSearchBar(){const{showSearchBar:t}=this.state;if(!this.isTableSearchAvailable())return;const e=!t;this.setState({showSearchBar:e},()=>{var n,s,i;e&&((n=this.crossColumnRef)==null?void 0:n.current)?(s=this.crossColumnRef)==null||s.current.focus():(i=this.grid)==null||i.focus()})}toggleGotoRow(t=""){const{isGotoRowShown:e}=this.state;if(t){this.setState({isGotoRowShown:!0,gotoRow:t,gotoRowError:""});return}this.setState({isGotoRowShown:!e,gotoRow:"",gotoRowError:""})}async commitPending(){var i,o;const{model:t}=this.props;if(!nt(t)||!t.isEditable)throw new Error("Cannot save, table is not editable");const{pendingSavePromise:e}=this.state;if(e!=null)throw new Error("Save already in progress");const n=(i=document==null?void 0:document.activeElement)==null?void 0:i.classList.contains("grid-cell-input-field");if(n!=null&&n){if(document.activeElement!=null&&document.activeElement.classList.contains("error"))throw new Ui("Current input is invalid");(o=this.grid)==null||o.focus()}const s=this.pending.add(t.commitPending()).then(()=>{this.setState({pendingSaveError:null,pendingSavePromise:null})}).catch(r=>{Re.isCanceled(r)||this.setState({pendingSaveError:r,pendingSavePromise:null})});return this.setState({pendingSavePromise:s}),s}async discardPending(){const{pendingSavePromise:t}=this.state;if(t!=null)throw new Error("Cannot cancel a save in progress");this.setState({pendingSavePromise:null,pendingSaveError:null,pendingDataMap:new Map,pendingDataErrors:new Map})}selectColumn(t){const{onColumnSelected:e}=this.props;e(t)}selectData(t,e){const{model:n}=this.props,{columns:s}=n,i={};for(let r=0;r<s.length;r+=1){const l=s[r],{name:a,type:c}=l,h=n.valueForCell(r,e),u=n.textForCell(r,e);i[a]={value:h,text:u,type:c}}const{onDataSelected:o}=this.props;o(e,i)}handleAdvancedFilterChange(t,e,n){const{model:s}=this.props,i=s.getColumnIndexByName(t.name);A(i),this.setAdvancedFilter(i,e,n)}handleAdvancedFilterSortChange(t,e,n=!1){var a;const{model:s}=this.props,i=s.getColumnIndexByName(t.name);A(i);const o=P.getSortForColumn(s.sort,i);let r=null;(o==null||o.direction!==e)&&(e===P.sortDirection.descending?r=t.sort().desc():r=t.sort().asc());const l=P.setSortForColumn(s.sort,i,r,n);Se.info("Setting table sorts",l),this.startLoading("Sorting..."),this.setState({sorts:l}),(a=this.grid)==null||a.forceUpdate()}handleAdvancedFilterDone(){var t;(t=this.grid)==null||t.focus()}handleAdvancedMenuOpened(t){this.setState({shownAdvancedFilter:t})}handleGotoRowOpened(){this.setState({isGotoRowShown:!0})}handleGotoRowClosed(){this.setState({isGotoRowShown:!1})}handleAdvancedMenuClosed(t){var s,i;const{focusedFilterBarColumn:e,isFilterBarShown:n}=this.state;n&&e===t&&((s=this.filterInputRef)==null?void 0:s.current)!==null?((i=this.filterInputRef)==null||i.current.focus(),this.setState({shownAdvancedFilter:null})):this.setState({focusedFilterBarColumn:null,shownAdvancedFilter:null})}handleCancel(){this.rollback()}handleChartChange(){}handleChartCreate(t){const{model:e,onCreateChart:n}=this.props;n(t,e)}handleGridError(t){Se.warn("Grid Error",t),this.setState({toastMessage:d("div",{className:"error-message",children:`${t}`})})}handleFilterBarChange(t){this.startLoading("Filtering...",!0),this.setState(({focusedFilterBarColumn:e,quickFilters:n})=>{const s=new Map(n);if(e!=null){const i=this.getModelColumn(e);A(i),this.applyQuickFilter(i,t,s)}return{quickFilters:s}})}handleFilterBarDone(t=!0,e=!0){var n;t&&((n=this.grid)==null||n.focus()),e&&this.setState({focusedFilterBarColumn:null})}handleFilterBarTab(t){const{focusedFilterBarColumn:e}=this.state;A(e),t?this.focusFilterBar(e-1):this.focusFilterBar(e+1)}handleFormatSelection(t,e){const{model:n}=this.props,s=n.columns[t],{customColumnFormatMap:i}=this.state,o=new Map(i);if(e!=null){const r=P.getNormalizedType(s.type);A(r);const l=pn.makeColumnFormattingRule(r,s.name,e);o.set(s.name,l)}else o.delete(s.name);this.updateFormatter({customColumnFormatMap:o})}handleMenu(t){t.stopPropagation(),this.setState({isMenuShown:!0})}handleMenuClose(){this.setState({isMenuShown:!1,openOptions:[]})}handleMenuBack(){this.setState(({openOptions:t})=>{const e=[...t];return e.pop(),{openOptions:e}})}handleMenuSelect(t){this.setState(({openOptions:e})=>({openOptions:[...e,t]}))}handleRequestFailed(t){const e=t;if(Se.error("request failed:",e.detail),this.stopLoading(),this.canRollback())this.startLoading("Rolling back changes...",!0),this.rollback();else{Se.error("Table failed and unable to rollback");const{onError:n}=this.props;n(new Error(`Error displaying table: ${e.detail}`))}}handleUpdate(){var h;this.stopLoading(),Se.debug2("Received model update");const{advancedFilters:t,aggregationSettings:e,customColumns:n,quickFilters:s,reverseType:i,rollupConfig:o,searchFilter:r,selectDistinctColumns:l,sorts:a}=this.state,c={advancedFilters:t,aggregationSettings:e,customColumns:n,quickFilters:s,reverseType:i,rollupConfig:o,searchFilter:r,selectDistinctColumns:l,sorts:a};hh(c)?this.lastLoadedConfig=null:this.lastLoadedConfig=c,(h=this.grid)==null||h.forceUpdate()}handleViewChanged(t){var i,o;const{model:e}=this.props,{selectionEndRow:n=0}=(o=(i=this.grid)==null?void 0:i.state)!=null?o:{};let s=0;if(nt(e)&&e.isEditable){A(t);const{bottomViewport:r}=t,l=e.rowCount-e.floatingBottomRowCount;n===l-1?s=e.pendingRowCount+1:n===l-2?s=e.pendingRowCount:s=Math.max(0,r-(e.rowCount-e.pendingRowCount)-e.floatingTopRowCount-e.floatingBottomRowCount-1)}this.setState({metrics:t,pendingRowCount:s})}handleSelectionChanged(t){A(t);const{onSelectionChanged:e}=this.props,{copyOperation:n}=this.state;this.setState({selectedRanges:t}),n!=null&&this.setState({copyOperation:null}),e(t)}handleMovedColumnsChanged(t,e=()=>null){this.setState({movedColumns:t},e)}handleTooltipRef(t){t!=null&&t.startTimer(),this.tooltip=t}handleConditionalFormatsChange(t){Se.debug("Updated conditional formats",t),this.setState({conditionalFormats:t})}handleConditionalFormatCreate(){Se.debug("Create new conditional format");const{openOptions:t,conditionalFormats:e}=this.state;this.setState({openOptions:[...t,{type:Ae.CONDITIONAL_FORMATTING_EDIT,title:"Create Formatting Rule"}],conditionalFormatEditIndex:e.length,conditionalFormatPreview:void 0})}handleConditionalFormatEdit(t){Se.debug("Edit conditional format",t);const{openOptions:e,conditionalFormats:n}=this.state;this.setState({openOptions:[...e,{type:Ae.CONDITIONAL_FORMATTING_EDIT,title:"Edit Formatting Rule"}],conditionalFormatEditIndex:t,conditionalFormatPreview:{...n[t]}})}handleConditionalFormatEditorSave(t){Se.debug("Save conditional format changes",t),this.setState(e=>{if(e.conditionalFormatEditIndex===null)return Se.debug("Invalid format index"),null;const n=[...e.conditionalFormats];return n[e.conditionalFormatEditIndex]=t,{conditionalFormats:n}},()=>{this.handleMenuBack()})}handleConditionalFormatEditorCancel(){this.handleMenuBack(),this.setState({conditionalFormatEditIndex:null})}handleUpdateCustomColumns(t){Se.info("handleUpdateCustomColumns:",t);const{model:e}=this.props,{movedColumns:n,sorts:s,quickFilters:i,advancedFilters:o,selectDistinctColumns:r}=this.state,{columns:l}=e,a=e.customColumns.map(h=>`${h}`),c=te.getRemovedCustomColumnNames(a,t);if(c.length>0){const h=te.removeSortsInColumns(s,c),u=te.removeFiltersInColumns(l,i,c),m=te.removeFiltersInColumns(l,o,c),p=te.removeColumnFromMovedColumns(l,n,c),g=te.removeColumnsFromSelectDistinctColumns(r,c);h.length!==s.length&&(Se.debug("removing sorts from removed custom columns..."),this.setState({sorts:h})),(u.size!==i.size||m.size!==o.size)&&(Se.debug("removing filters from removed custom columns..."),this.setState({quickFilters:u,advancedFilters:m})),pt(n,p)||(Se.debug("change moved columns for removed custom columns",p),this.setState({movedColumns:p})),pt(r,g)||(Se.debug("change selectDistinct columns for removed custom columns",p),this.setState({selectDistinctColumns:g}))}this.setState({customColumns:t}),this.startLoading("Applying custom columns...")}handleCustomColumnsChanged(){var e;Se.debug("custom columns changed");const{isReady:t}=this.state;t?(this.stopLoading(),(e=this.grid)==null||e.forceUpdate()):this.initState()}handlePendingCommitClicked(){return this.commitPending()}handlePendingDiscardClicked(){return this.discardPending()}handlePendingDataUpdated(){var s;Se.debug("pending data updated");const{model:t}=this.props,{pendingDataMap:e,pendingDataErrors:n}=t;this.setState({pendingDataMap:e,pendingDataErrors:n,pendingSaveError:null}),(s=this.grid)==null||s.forceUpdate()}handleAggregationsChange(t){Se.debug("handleAggregationsChange",t),this.startLoading(`Aggregating ${t.aggregations.map(e=>e.operation).join(", ")}...`),this.setState({aggregationSettings:t})}handleAggregationChange(t){Se.debug("handleAggregationChange",t),this.startLoading(`Aggregating ${t.operation}...`),this.setState(({aggregationSettings:e})=>({selectedAggregation:t,aggregationSettings:{...e,aggregations:e.aggregations.map(n=>n.operation===t.operation?t:n)}}))}handleAggregationEdit(t){Se.debug("handleAggregationEdit",t);const{openOptions:e}=this.state;this.setState({openOptions:[...e,{type:Ae.AGGREGATION_EDIT,title:`Edit Columns to ${t.operation}`}],selectedAggregation:t})}handleRollupChange(t){var e,n;Se.info("Rollup change",t),this.resetGridViewState(),this.showAllColumns(),this.clearAllFilters(),this.startLoading(`Grouping by columns ${(n=(e=t==null?void 0:t.columns)==null?void 0:e.join(", "))!=null?n:""}...`),this.setState({rollupConfig:t,movedColumns:[],sorts:[],reverseType:P.REVERSE_TYPE.NONE,selectDistinctColumns:[]})}handleSelectDistinctChanged(t){Se.debug("SelectDistinct change",t),this.resetGridViewState(),this.showAllColumns(),this.clearAllFilters(),this.startLoading(`Selecting distinct values in ${t.length>0?t.join(", "):""}...`),this.setState({selectDistinctColumns:t,movedColumns:[],sorts:[],reverseType:P.REVERSE_TYPE.NONE})}handleDownloadTableStart(){const{canDownloadCsv:t}=this.props;t?this.setState({isTableDownloading:!0,tableDownloadProgress:0,tableDownloadEstimatedTime:null,tableDownloadStatus:an.DOWNLOAD_STATUS.INITIATING}):Se.error("Attempted to handleDownloadTableStart for user without download CSV permission.")}handleDownloadTable(t,e,n,s){const{canDownloadCsv:i}=this.props;i?(Se.info("start table downloading",t,e,n,s),this.setState(()=>(this.tableSaver&&this.tableSaver.startDownload(t,e,n,s),{tableDownloadStatus:an.DOWNLOAD_STATUS.DOWNLOADING}))):Se.error("Attempted to handleDownloadTable for user without download CSV permission.")}handleCancelDownloadTable(){var t;(t=this.tableSaver)==null||t.cancelDownload(),this.setState({isTableDownloading:!1})}handleDownloadCompleted(){this.setState({isTableDownloading:!1,tableDownloadProgress:100,tableDownloadStatus:an.DOWNLOAD_STATUS.FINISHED})}handleDownloadCanceled(){this.setState({isTableDownloading:!1,tableDownloadProgress:0,tableDownloadStatus:an.DOWNLOAD_STATUS.CANCELED})}deleteRanges(t){const{model:e}=this.props;this.pending.add(e.delete(t)).catch(n=>{Re.isCanceled(n)||Se.error("Unable to delete ranges",t,n)})}resetColumnSelection(){if(this.grid==null)return;const{isSelectingColumn:t}=this.props;if(t){const{columnAllowedCursor:e}=this.props;this.grid.setState({cursor:e})}else this.grid.setState({cursor:null}),this.setState({hoverSelectColumn:null})}resetGridViewState(t=!0){!this.grid||(this.grid.clearSelectedRanges(),this.grid.setViewState({left:0,top:0,topOffset:0,leftOffset:0},t))}sendStateChange(){if(!this.grid)return;const{state:t}=this,{state:e}=this.grid,{onStateChange:n}=this.props;n(t,e)}handleOverflowClose(){this.setState({showOverflowModal:!1})}getColumnBoundingRect(){var m;const{metrics:t,shownColumnTooltip:e}=this.state;A(t),A(e);const n=(m=this.gridWrapper)==null?void 0:m.getBoundingClientRect(),s=20;A(n);const{columnHeaderHeight:i,visibleColumnXs:o,visibleColumnWidths:r,width:l,columnHeaderMaxDepth:a}=t,c=o.get(e),h=r.get(e);A(c),A(h);const u=n.left+Vt(c+h/2,s,l-s);return{top:n.top+(a-1)*i,left:n.left+Vt(c+h/2,s,l-s),bottom:n.top+a*i,right:n.left+Vt(c+h/2,s,l-s)+1,width:1,height:i,x:u,y:n.top,toJSON:()=>{throw new Error("not implemented")}}}handleGotoRowSelectedRowNumberSubmit(){const{gotoRow:t}=this.state;this.focusRowInGrid(t)}focusRowInGrid(t){var i,o,r;const{model:e}=this.props,{rowCount:n}=e;if(this.setState({gotoRow:t}),t===""){this.setState({gotoRowError:""});return}const s=parseInt(t,10);s>n||s<-n?this.setState({gotoRowError:"Invalid row index"}):s===0?(this.setState({gotoRowError:""}),(i=this.grid)==null||i.setFocusRow(0)):s<0?(this.setState({gotoRowError:""}),(o=this.grid)==null||o.setFocusRow(s+n)):((r=this.grid)==null||r.setFocusRow(s-1),this.setState({gotoRowError:""}))}handleGotoRowSelectedRowNumberChanged(t){const e=t.target.value;this.focusRowInGrid(e)}getColumnTooltip(t,e,n){const{columnHeaderHeight:s,columnHeaderMaxDepth:i,visibleColumnXs:o,visibleColumnWidths:r,width:l}=e,a=o.get(t),c=r.get(t);if(a==null||c==null)return null;const h=Math.max(0,a);let u=c;a+c>l?u=l-a:a<0&&(u=c-Math.abs(a));const m={position:"absolute",top:(i-1)*s,left:h,width:u,height:s,pointerEvents:"none"},p={clientWidth:1,clientHeight:s,getBoundingClientRect:this.getColumnBoundingRect},g={placement:"bottom",modifiers:{flip:{behavior:["bottom","top"]}}},f=this.getModelColumn(t);if(f==null)return null;const b=n.columns[f];return b==null?null:d("div",{style:m,children:d(pe,{timeout:400,interactive:!0,options:g,ref:this.handleTooltipRef,referenceObject:p,onExited:()=>{this.setState({shownColumnTooltip:null})},children:d($m,{model:n,column:b,onStatistics:()=>{var C;(C=this.tooltip)==null||C.update()}})},b.name)})}render(){var ft,Ei,jc,Qc,Zc,Jc,ed,td,nd;const{children:t,customFilters:e,getDownloadWorker:n,isSelectingColumn:s,isStuckToBottom:i,isStuckToRight:o,model:r,name:l,onlyFetchVisibleColumns:a,alwaysFetchColumns:c,advancedSettings:h,onAdvancedSettingsChange:u,canDownloadCsv:m,onCreateChart:p}=this.props,{metricCalculator:g,metrics:f,isFilterBarShown:b,isSelectingPartition:C,isMenuShown:v,isReady:T,copyOperation:E,focusedFilterBarColumn:y,loadingText:I,loadingScrimProgress:D,loadingSpinnerShown:M,keyHandlers:x,mouseHandlers:B,shownColumnTooltip:$,hoverAdvancedFilter:k,shownAdvancedFilter:H,hoverSelectColumn:O,quickFilters:F,advancedFilters:_,partition:L,partitionFilters:V,partitionTable:G,partitionColumn:j,searchFilter:ne,selectDistinctColumns:ye,movedColumns:le,movedRows:Te,formatter:He,conditionalFormats:Z,conditionalFormatPreview:ge,conditionalFormatEditIndex:be,sorts:Le,reverseType:Oe,customColumns:gn,selectedRanges:jn,isTableDownloading:Tn,tableDownloadStatus:vt,tableDownloadProgress:Ne,tableDownloadEstimatedTime:rt,showSearchBar:lt,searchValue:_t,selectedSearchColumns:Qt,invertSearchColumns:Zt,aggregationSettings:Lt,selectedAggregation:Qn,rollupConfig:Bt,openOptions:$t,pendingSavePromise:kn,pendingSaveError:Vl,pendingRowCount:Ul,pendingDataErrors:Bl,pendingDataMap:jo,toastMessage:Qo,frozenColumns:Zo,showOverflowModal:Jo,overflowText:er,overflowButtonTooltipProps:tr,isGotoRowShown:nr,gotoRow:$l,gotoRowError:Wl}=this.state;if(!T)return null;const Hs=this.getTheme(),zl=this.getCachedFilter(e,F,_,V,ne),Ti=g.getUserColumnWidths(),ao=this.getCachedStateOverride(O,b,s,D,F,_,Le,Oe,Bt,v),sr=f?f.top:0,ir=f?f.bottomViewport:0;let co=null,ho=null;a&&(co=f?f.left:0,ho=f?f.right:0);const Gl=f!=null&&f.width>0&&f.height>0,Kl=((Ei=(ft=Bt==null?void 0:Bt.columns)==null?void 0:ft.length)!=null?Ei:0)>0;let or=null;const ql=f?Math.min(Math.max(ti.minDebounce,Math.round(f.rowCount/200)),ti.maxDebounce):ti.maxDebounce;if(b&&y!=null&&f!=null){const{gridX:et,gridY:Jt,visibleColumnXs:On,visibleColumnWidths:Vs}=f,Us=On.get(y),An=Vs.get(y);if(Us!=null&&An!=null){const en=et+Us,Wt=Jt-((jc=Hs.filterBarHeight)!=null?jc:0),Zn=An+1,Bs=((Qc=Hs.filterBarHeight)!=null?Qc:0)-1,$s={top:Wt,left:en,minWidth:Zn,height:Bs};let yi="",Jn=!0;const Ws=this.getModelColumn(y);A(Ws);const zs=F.get(Ws),uo=_.get(Ws);zs!=null&&(yi=zs.text,Jn=zs.filter!=null);const Gs=F.size!==0||_.size!==0;or=d(Pm,{ref:this.filterInputRef,style:$s,className:W({error:!Jn,active:yi!==""||uo!=null,"iris-grid-has-filter":Gs}),isAdvancedFilterSet:uo!=null,onAdvancedFiltersTriggered:()=>{this.setState({shownAdvancedFilter:y})},onChange:this.handleFilterBarChange,onDone:this.handleFilterBarDone,onTab:this.handleFilterBarTab,onContextMenu:(Zc=this.grid)==null?void 0:Zc.handleContextMenu,debounceMs:ql,value:yi},y)}}let rr=null;if(I!=null){const et=d("div",{className:"iris-grid-loading-status",children:I}),Jt=d(aC,{show:M}),On=d("button",{type:"button",onClick:this.handleCancel,className:W("btn btn-secondary btn-cancelable iris-grid-btn-cancel",{show:M}),children:"Cancel"}),Vs=f?f.gridY:0;rr=w("div",{className:"iris-grid-loading",style:{top:Vs},children:[et,Jt,On]})}let lr=null;$!=null&&f&&(lr=this.getColumnTooltip($,f,r),(Jc=this.tooltip)==null||Jc.update());const ar=[];if(f&&b){const{gridX:et,gridY:Jt,visibleColumns:On,visibleColumnXs:Vs,visibleColumnWidths:Us}=f,{filterBarHeight:An}=Hs;for(let en=0;en<On.length;en+=1){const Wt=On[en],Zn=Vs.get(Wt),Bs=Us.get(Wt),$s=this.getModelColumn(Wt);if($s!=null&&r.isFilterable($s)&&Zn!=null&&Bs!=null&&Bs>0){const Jn=et+Zn+Bs-24,Ws=Jt-(An!=null?An:0)+2,zs={position:"absolute",top:Ws,left:Jn},Gs=_.get($s)!=null,hr=Wt===k||Wt===y||Gs,jl=d("div",{className:W("advanced-filter-button-container",{hidden:!hr}),style:zs,children:hr&&d("button",{type:"button",className:W("btn btn-link btn-link-icon advanced-filter-button",{"filter-set":Gs}),onClick:()=>{this.setState({shownAdvancedFilter:Wt})},onContextMenu:Np=>{var sd;(sd=this.grid)==null||sd.handleContextMenu(Np)},onMouseEnter:()=>{this.setState({hoverAdvancedFilter:Wt})},onMouseLeave:()=>{this.setState({hoverAdvancedFilter:null})},children:w("div",{className:"fa-layers",children:[d(z,{icon:Za,className:"filter-solid"}),d(z,{icon:Br,className:"filter-light"})]})})},Wt);ar.push(jl)}}}const cr=[];if(f){const{gridX:et,visibleColumns:Jt,visibleColumnXs:On,visibleColumnWidths:Vs,columnHeaderHeight:Us}=f;for(let An=0;An<Jt.length;An+=1){const en=Jt[An],Wt=On.get(en),Zn=Vs.get(en);if(Wt!=null&&Zn!=null&&Zn>0){const Bs=et+Wt,$s=et+Wt+Zn-20,yi=b?{position:"absolute",top:Us,left:$s,width:20,height:Hs.filterBarHeight}:{position:"absolute",top:0,left:Bs,width:Zn,height:Us},Jn=this.getModelColumn(en);if(Jn!=null){const Ws=r.columns[Jn],zs=_.get(Jn),{options:uo}=zs||{},Gs=P.getSortForColumn(r.sort,Jn),hr=Gs?Gs.direction:null,jl=d("div",{className:"advanced-filter-menu-container",style:yi,children:d(xn,{className:"advanced-filter-menu-popper",onEntered:this.getAdvancedMenuOpenedHandler(en),onExited:()=>{this.handleAdvancedMenuClosed(en)},isShown:H===en,interactive:!0,closeOnBlur:!0,children:this.getCachedAdvancedFilterMenuActions(r,Ws,uo,hr,He)})},en);cr.push(jl)}}}}const dr=this.getCachedOptionItems(p!==void 0&&r.isChartBuilderAvailable,r.isCustomColumnsAvailable,r.isFormatColumnsAvailable,r.isRollupAvailable,r.isTotalsAvailable,r.isSelectDistinctAvailable,r.isExportAvailable,this.toggleFilterBarAction,this.toggleSearchBarAction,this.toggleGotoRowAction,b,lt,m,this.isTableSearchAvailable(),nr),Yl=$t.map(et=>{switch(et.type){case Ae.CHART_BUILDER:return d(Rm,{model:r,onChange:this.handleChartChange,onSubmit:this.handleChartCreate},Ae.CHART_BUILDER);case Ae.VISIBILITY_ORDERING_BUILDER:return d(fi,{model:r,movedColumns:le,userColumnWidths:Ti,onColumnVisibilityChanged:this.handleColumnVisibilityChanged,onMovedColumnsChanged:this.handleMovedColumnsChanged},Ae.VISIBILITY_ORDERING_BUILDER);case Ae.CONDITIONAL_FORMATTING:return d(kv,{rules:Z,onChange:this.handleConditionalFormatsChange,onCreate:this.handleConditionalFormatCreate,onSelect:this.handleConditionalFormatEdit});case Ae.CONDITIONAL_FORMATTING_EDIT:return A(r.columns),A(this.handleConditionalFormatEditorUpdate),d(lT,{columns:r.columns,rule:ge,onUpdate:this.handleConditionalFormatEditorUpdate,onSave:this.handleConditionalFormatEditorSave,onCancel:this.handleConditionalFormatEditorCancel});case Ae.CUSTOM_COLUMN_BUILDER:return d(Ic,{model:r,customColumns:gn,onSave:this.handleUpdateCustomColumns,onCancel:this.handleMenuBack},Ae.CUSTOM_COLUMN_BUILDER);case Ae.ROLLUP_ROWS:return d(Rc,{model:r,onChange:this.handleRollupChange,config:Bt},Ae.ROLLUP_ROWS);case Ae.AGGREGATIONS:return d(Yw,{settings:Lt,isRollup:Kl,onChange:this.handleAggregationsChange,onEdit:this.handleAggregationEdit});case Ae.AGGREGATION_EDIT:return Qn&&d(jw,{aggregation:Qn,columns:r.originalColumns,onChange:this.handleAggregationChange});case Ae.TABLE_EXPORTER:return d(an,{model:r,name:l,isDownloading:Tn,tableDownloadStatus:vt,tableDownloadProgress:Ne,tableDownloadEstimatedTime:rt!=null?rt:void 0,onDownload:this.handleDownloadTable,onDownloadStart:this.handleDownloadTableStart,onCancel:this.handleCancelDownloadTable,selectedRanges:jn},Ae.TABLE_EXPORTER);case Ae.SELECT_DISTINCT:return d(Gm,{model:r,selectDistinctColumns:ye,onChange:this.handleSelectDistinctChanged});case Ae.ADVANCED_SETTINGS:return d(Fc,{items:h,onChange:u});default:throw Error(`Unexpected option type ${et.type}`)}}),Xl=this.getCachedHiddenColumns(te.getHiddenColumns(Ti));return w("div",{className:"iris-grid",role:"presentation",children:[w("div",{className:"iris-grid-column",children:[t!=null&&d("div",{className:"iris-grid-bar",children:t}),d(gt,{in:C,timeout:It.transitionSlowMs,classNames:"iris-grid-bar-horizontal",onEnter:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExit:this.handleAnimationStart,onExited:this.handleAnimationEnd,mountOnEnter:!0,unmountOnExit:!0,children:d("div",{className:"iris-grid-partition-selector-wrapper iris-grid-bar iris-grid-bar-primary",children:G&&j&&d(zm,{table:G,getFormattedString:(et,Jt,On)=>r.displayString(et,Jt,On),columnName:j.name,partition:L,onChange:this.handlePartitionChange,onFetchAll:this.handlePartitionFetchAll,onAppend:this.handlePartitionAppend,onDone:this.handlePartitionDone})})}),d(gt,{in:lt,timeout:It.transitionSlowMs,classNames:"iris-grid-bar-horizontal",onEnter:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExit:this.handleAnimationStart,onExited:this.handleAnimationEnd,mountOnEnter:!0,unmountOnExit:!0,children:d("div",{className:"iris-grid-bar",children:d(yr,{value:_t,selectedColumns:Qt,invertSelection:Zt,onChange:this.handleCrossColumnSearch,columns:r.columns,ref:this.crossColumnRef})})}),w("div",{className:"grid-wrapper",ref:et=>{this.gridWrapper=et},children:[d(no,{ref:et=>{this.grid=et},isStickyBottom:!nt(r)||!r.isEditable,isStuckToBottom:i,isStuckToRight:o,metricCalculator:g,model:r,keyHandlers:x,mouseHandlers:B,movedColumns:le,movedRows:Te,onError:this.handleGridError,onViewChanged:this.handleViewChanged,onSelectionChanged:this.handleSelectionChanged,onMovedColumnsChanged:this.handleMovedColumnsChanged,renderer:this.renderer,stateOverride:ao,theme:Hs}),d(aT,{isOpen:Jo,text:er,onClose:this.handleOverflowClose}),Gl&&d(Um,{model:r,modelColumns:r.columns,top:sr,bottom:ir,left:co,right:ho,filter:zl,formatter:He,sorts:Le,reverseType:Oe,movedColumns:le,customColumns:gn,hiddenColumns:Xl,alwaysFetchColumns:this.getAlwaysFetchColumns(c,r.columns,le,r.floatingLeftColumnCount,r.floatingRightColumnCount,(td=(ed=this.grid)==null?void 0:ed.state.draggingColumn)==null?void 0:td.range),formatColumns:this.getCachedPreviewFormatColumns(this.getCachedModelColumns(r,gn),Z,ge,((nd=$t[$t.length-1])==null?void 0:nd.type)===Ae.CONDITIONAL_FORMATTING_EDIT&&be!=null?be:void 0),rollupConfig:this.getModelRollupConfig(r.originalColumns,Bt,Lt),totalsConfig:this.getModelTotalsConfig(r.columns,Bt,Lt),selectDistinctColumns:ye,pendingRowCount:Ul,pendingDataMap:jo,frozenColumns:Zo}),!v&&d("div",{className:"grid-settings-button",children:d("button",{type:"button","data-testid":`btn-iris-grid-settings-button-${l}`,className:"btn btn-link btn-link-icon",onClick:this.handleMenu,children:d(z,{icon:lf,transform:"up-1"})})}),or,rr,ar,lr,cr,tr&&this.getOverflowButtonTooltip(tr)]}),d(dT,{model:r,isShown:nr,gotoRow:$l,gotoRowError:Wl,onSubmit:this.handleGotoRowSelectedRowNumberSubmit,onGotoRowNumberChanged:this.handleGotoRowSelectedRowNumberChanged,onClose:this.handleGotoRowClosed,onEntering:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExiting:()=>{this.handleAnimationStart(),this.focus()},onExited:this.handleAnimationEnd}),d(lv,{error:Vl,isSaving:kn!=null,saveTooltip:`Commit (${this.commitAction.shortcut.getDisplayText()})`,discardTooltip:`Discard (${this.discardAction.shortcut.getDisplayText()})`,pendingDataErrors:Bl,pendingDataMap:jo,onEntering:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExiting:this.handleAnimationStart,onExited:this.handleAnimationEnd,onSave:this.handlePendingCommitClicked,onDiscard:this.handlePendingDiscardClicked}),d(Tv,{children:Qo}),d(io,{model:r,copyOperation:E!=null?E:void 0,onEntering:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExiting:this.handleAnimationStart,onExited:this.handleAnimationEnd}),d(so,{ref:et=>{this.tableSaver=et},getDownloadWorker:n,onDownloadCompleted:this.handleDownloadCompleted,onDownloadCanceled:this.handleDownloadCanceled,onDownloadProgressUpdate:this.handleDownloadProgressUpdate,isDownloading:vt===an.DOWNLOAD_STATUS.DOWNLOADING,formatter:He})]}),d(gt,{in:v,timeout:It.transitionMidMs,classNames:"slide-left",onEntering:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExiting:this.handleAnimationStart,onExited:this.handleAnimationEnd,mountOnEnter:!0,unmountOnExit:!0,children:d("div",{className:"table-sidebar",children:w(uC,{children:[d(Ed,{title:"Table Options",onClose:this.handleMenuClose,children:d(vu,{onSelect:et=>this.handleMenuSelect(dr[et]),items:dr})}),Yl.map((et,Jt)=>d(Ed,{title:$t[Jt].title,onBack:this.handleMenuBack,onClose:this.handleMenuClose,children:et},$t[Jt].type))]})})}),d(ie,{actions:this.contextActions})]})}};let oo=ti;oo.minDebounce=150;oo.maxDebounce=500;oo.loadingSpinnerDelay=800;oo.defaultProps={children:null,advancedFilters:new Map,advancedSettings:new Map,alwaysFetchColumns:[],conditionalFormats:[],customColumnFormatMap:new Map,isFilterBarShown:!1,applyInputFiltersOnInit:!1,movedColumns:[],movedRows:[],inputFilters:[],customFilters:[],onCreateChart:void 0,onColumnSelected:()=>{},onDataSelected:()=>{},onError:()=>{},onStateChange:()=>{},onPartitionAppend:()=>{},onAdvancedSettingsChange:()=>{},partition:null,partitionColumn:null,quickFilters:new Map,selectDistinctColumns:[],sorts:[],reverseType:P.REVERSE_TYPE.NONE,customColumns:[],aggregationSettings:Ym,rollupConfig:void 0,userColumnWidths:new Map,userRowHeights:new Map,onSelectionChanged:()=>{},isSelectingColumn:!1,isSelectingPartition:!1,isStuckToBottom:!1,isStuckToRight:!1,columnSelectionValidator:null,columnAllowedCursor:null,columnNotAllowedCursor:null,name:"table",onlyFetchVisibleColumns:!0,showSearchBar:!1,searchValue:"",selectedSearchColumns:null,invertSearchColumns:!0,onContextMenu:()=>{},pendingDataMap:new Map,getDownloadWorker:void 0,settings:{timeZone:"America/New_York",defaultDateTimeFormat:ms.FULL_DATE_FORMAT,showTimeZone:!1,showTSeparator:!0,truncateNumbersWithPound:!1,formatter:[],decimalFormatOptions:R.exports.shape({defaultFormatString:R.exports.string}),integerFormatOptions:R.exports.shape({defaultFormatString:R.exports.string})},canCopy:!0,canDownloadCsv:!0,frozenColumns:null,theme:Bm,canToggleSearch:!0};class pT extends Error{constructor(e,n){super(`${n} can't be empty (on pending row ${e+1})`),this.isMissingKey=!0,this.rowIndex=e,this.columnName=n}}const gT=X.module("ColumnHeaderGroup");function uh(t){return t instanceof Xm}class Xm{constructor({name:e,children:n,color:s,depth:i,childIndexes:o}){this.getVisibleRange=Ce(r=>{const l=this.childIndexes.flat(),a=K.getVisibleIndexes(l,r),c=Math.min(...a),h=Math.max(...a);return h-c!==l.length-1&&gT.warn(`Column header group ${this.name} is not contiguous`),[c,h]}),this.name=e,this.children=n,this.color=s,this.depth=i,this.childIndexes=o}}const it=X.module("IrisGridTableModel"),fT=150,CT=0;function ri(t){return t.table!==void 0}const Fa=class extends we{constructor(t,e=new pn,n=null){super(),this.pendingNewRowCount=0,this.columnHeaderGroupMap=new Map,this.columnHeaderParentMap=new Map,this._columnHeaderMaxDepth=null,this._columnHeaderGroups=[],this.getMemoizedColumnMap=Ce(s=>{const i=new Map;return s.forEach(o=>i.set(o.name,o)),i}),this.getColumnIndicesByNameMap=Ce(s=>{const i=new Map;return s.forEach(({name:o},r)=>i.set(o,r)),i}),this.setViewport=mi((s,i,o)=>{if(i<s){it.error("Invalid viewport",s,i);return}const{viewport:r}=this;if(r!=null&&r.top===s&&r.bottom===i&&r.columns===o){it.debug2("Ignoring duplicate viewport",r);return}this.viewport={top:s,bottom:i,columns:o},it.debug2("setViewport",this.viewport),this.applyViewport()},fT),this.applyViewport=mi(()=>{if(!this.viewport)return;it.debug2("applyViewport",this.viewport);const{top:s,bottom:i,columns:o}=this.viewport,[r,l]=this.getCachedViewportRowRange(s,i);this.applyBufferedViewport(r,l,o)},CT,{leading:!1}),this.getCachedFormattedString=dn((s,i,o,r,l)=>s.getFormattedString(i,o,r,l),{max:1e4}),this.getCachedCustomColumnFormatFlag=dn(us.isCustomColumnFormatDefined,{max:1e4}),this.getCachedViewportRowRange=Ce((s,i)=>{const o=i-s,r=Math.max(0,s-o*Fa.ROW_BUFFER_PAGES),l=i+o*Fa.ROW_BUFFER_PAGES;return[r,l]}),this.getCachedPendingErrors=Ce((s,i,o)=>{const r=new Map;return s.forEach((l,a)=>{var h;const{data:c}=l;for(let u=0;u<o;u+=1)c.has(u)||(r.has(a)||r.set(a,[]),(h=r.get(a))==null||h.push(new pT(a,i[u].name)))}),r}),this.handleTableDisconnect=this.handleTableDisconnect.bind(this),this.handleTableReconnect=this.handleTableReconnect.bind(this),this.handleTableUpdate=this.handleTableUpdate.bind(this),this.handleTotalsUpdate=this.handleTotalsUpdate.bind(this),this.handleRequestFailed=this.handleRequestFailed.bind(this),this.handleCustomColumnsChanged=this.handleCustomColumnsChanged.bind(this),this.irisFormatter=e,this.inputTable=n,this.subscription=null,this.table=t,this.viewport=null,this.viewportData=null,this.formattedStringData=[],this.pendingStringData=[],this.isSaveInProgress=!1,this.totalsTable=null,this.totalsTablePromise=null,this.totals=null,this.totalsDataMap=null,this.pendingNewDataMap=new Map,this.pendingNewDataErrors=null,this.pendingNewRowCount=0}export(){throw new Error("Method not implemented.")}columnStatistics(t){throw new Error("Method not implemented.")}get customColumns(){return[]}set customColumns(t){throw new Error("Method not implemented.")}get formatColumns(){return[]}set formatColumns(t){throw new Error("Method not implemented.")}updateFrozenColumns(t){throw new Error("Method not implemented.")}get rollupConfig(){throw new Error("Method not implemented.")}set rollupConfig(t){throw new Error("Method not implemented.")}get selectDistinctColumns(){throw new Error("Method not implemented.")}set selectDistinctColumns(t){throw new Error("Method not implemented.")}get columns(){return this.table.columns}close(){this.table.close(),this.totalsTable!==null&&this.totalsTable.close(),this.totalsTablePromise!==null&&this.totalsTablePromise.cancel()}startListening(){super.startListening(),this.table.addEventListener(N.Table.EVENT_DISCONNECT,this.handleTableDisconnect),this.table.addEventListener(N.Table.EVENT_RECONNECT,this.handleTableReconnect),this.table.addEventListener(N.Table.EVENT_UPDATED,this.handleTableUpdate),this.table.addEventListener(N.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed),this.table.addEventListener(N.Table.EVENT_CUSTOMCOLUMNSCHANGED,this.handleCustomColumnsChanged),this.totalsTable!=null&&this.addTotalsListeners(this.totalsTable),this.applyViewport()}stopListening(){super.stopListening(),this.table.removeEventListener(N.Table.EVENT_DISCONNECT,this.handleTableDisconnect),this.table.removeEventListener(N.Table.EVENT_RECONNECT,this.handleTableReconnect),this.table.removeEventListener(N.Table.EVENT_UPDATED,this.handleTableUpdate),this.table.removeEventListener(N.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed),this.table.removeEventListener(N.Table.EVENT_CUSTOMCOLUMNSCHANGED,this.handleCustomColumnsChanged),this.totalsTable!=null&&this.removeTotalsListeners(this.totalsTable),this.closeSubscription()}addTotalsListeners(t){t.addEventListener(N.Table.EVENT_UPDATED,this.handleTotalsUpdate),t.setViewport(0,0)}removeTotalsListeners(t){t.removeEventListener(N.Table.EVENT_UPDATED,this.handleTotalsUpdate)}handleTableDisconnect(){this.dispatchEvent(new Ye(we.EVENT.DISCONNECT))}handleTableReconnect(){this.dispatchEvent(new Ye(we.EVENT.RECONNECT))}handleTableUpdate(t){this.copyViewportData(t.detail),this.dispatchEvent(new Ye(we.EVENT.UPDATED))}handleTotalsUpdate(t){this.copyTotalsData(t.detail),this.dispatchEvent(new Ye(we.EVENT.UPDATED))}handleRequestFailed(t){this.dispatchEvent(new Ye(we.EVENT.REQUEST_FAILED,t))}handleCustomColumnsChanged(){this.dispatchEvent(new Ye(we.EVENT.COLUMNS_CHANGED,{detail:this.columns}))}get rowCount(){var t,e,n;return this.table.size+this.pendingNewRowCount+((n=(e=(t=this.totals)==null?void 0:t.operationOrder)==null?void 0:e.length)!=null?n:0)}get pendingDataErrors(){var t,e;return this.getCachedPendingErrors(this.pendingNewDataMap,this.columns,(e=(t=this.inputTable)==null?void 0:t.keyColumns.length)!=null?e:0)}get pendingDataMap(){return this.pendingNewDataMap}set pendingDataMap(t){t!==this.pendingNewDataMap&&(t.forEach((e,n)=>{if(!te.isValidIndex(n))throw new Error(`Invalid rowIndex ${n}`);const{data:s}=e;s.forEach((i,o)=>{if(!te.isValidIndex(o))throw new Error(`Invalid columnIndex ${o}`)})}),this.pendingNewDataMap=t,this.pendingNewRowCount=Math.max(this.pendingNewRowCount,this.maxPendingDataRow),this.formattedStringData=[],this.dispatchEvent(new Ye(we.EVENT.PENDING_DATA_UPDATED)))}get pendingRowCount(){return this.pendingNewRowCount}set pendingRowCount(t){t!==this.pendingNewRowCount&&(this.pendingNewRowCount=Math.max(0,t,this.maxPendingDataRow),this.dispatchEvent(new Ye(we.EVENT.UPDATED)))}get maxPendingDataRow(){return this.pendingNewDataMap.size>0?Math.max(...this.pendingNewDataMap.keys())+1:0}get columnCount(){return this.columns.length}get floatingBottomRowCount(){var t,e,n;return this.totals!=null&&this.totals.showOnTop?0:(n=(e=(t=this.totals)==null?void 0:t.operationOrder)==null?void 0:e.length)!=null?n:0}get floatingTopRowCount(){var t,e,n;return this.totals!=null&&this.totals.showOnTop&&(n=(e=(t=this.totals)==null?void 0:t.operationOrder)==null?void 0:e.length)!=null?n:0}get isChartBuilderAvailable(){return!0}get isTotalsAvailable(){return this.table.getTotalsTable!=null}get isEditable(){return!this.isSaveInProgress&&this.inputTable!=null}cacheFormattedValue(t,e,n){this.formattedStringData[t]==null&&(this.formattedStringData[t]=[]),this.formattedStringData[t][e]=n}cachePendingValue(t,e,n){this.pendingStringData[t]==null&&(this.pendingStringData[t]=[]),this.pendingStringData[t][e]=n}clearPendingValue(t,e){const n=this.pendingStringData[t];n!=null&&delete n[e]}textValueForCell(t,e){var n,s,i;if(((n=this.pendingStringData[t])==null?void 0:n[e])!==void 0)return this.pendingStringData[t][e];if(((s=this.formattedStringData[t])==null?void 0:s[e])===void 0){const o=this.valueForCell(t,e);if(o==null)return null;const r=(i=this.totalsColumn(t,e))!=null?i:this.columns[t],l=this.getCachedCustomColumnFormatFlag(this.formatter,r.name,r.type);let a;if(!l){const h=this.formatForCell(t,e);(h==null?void 0:h.formatString)!=null&&(a=h)}const c=this.displayString(o,r.type,r.name,a);this.cacheFormattedValue(t,e,c)}return this.formattedStringData[t][e]}textForCell(t,e){const n=this.textValueForCell(t,e);if(n==null&&this.isKeyColumn(t)){const s=this.pendingRow(e);if(s!=null&&this.pendingDataMap.has(s))return"*"}return n!=null?n:""}truncationCharForCell(t){const e=this.columns[t],{type:n}=e;if(P.isNumberType(n)&&this.formatter.truncateNumbersWithPound)return"#"}colorForCell(t,e,n){var i;const s=this.dataForCell(t,e);if(s){const{format:o,value:r}=s;if(r==null||r==="")return A(n.nullStringColor),n.nullStringColor;if(o&&o.color)return o.color;if(this.isPendingRow(e))return A(n.pendingTextColor),n.pendingTextColor;if(r!=null){const l=(i=this.totalsColumn(t,e))!=null?i:this.columns[t];if(P.isDateType(l.type)||l.name==="Date")return A(n.dateColor),n.dateColor;if(P.isNumberType(l.type))return r>0?(A(n.positiveNumberColor),n.positiveNumberColor):r<0?(A(n.negativeNumberColor),n.negativeNumberColor):(A(n.zeroNumberColor),n.zeroNumberColor)}}else if(this.isPendingRow(e)&&this.isKeyColumn(t))return A(n.errorTextColor),n.errorTextColor;return n.textColor}backgroundColorForCell(t,e){var n,s;return(s=(n=this.formatForCell(t,e))==null?void 0:n.backgroundColor)!=null?s:null}textAlignForCell(t){const e=this.columns[t],{type:n}=e;return P.isNumberType(n)?"right":P.isDateType(n)||e.name==="Date"?"center":"left"}textForColumnHeader(t,e=0){var n,s;return(s=(n=this.columnAtDepth(t,e))==null?void 0:n.name)!=null?s:void 0}colorForColumnHeader(t,e=0){var s;const n=this.columnAtDepth(t,e);return uh(n)&&(s=n.color)!=null?s:null}getColumnHeaderGroup(t,e){const n=this.columnAtDepth(t,e);if(uh(n))return n}getColumnHeaderParentGroup(t,e){var n,s;return this.columnHeaderParentMap.get((s=(n=this.columnAtDepth(t,e))==null?void 0:n.name)!=null?s:"")}columnAtDepth(t,e=0){var o;if(e===0)return this.columns[t];const n=(o=this.columns[t])==null?void 0:o.name;let s=this.columnHeaderParentMap.get(n);if(!s)return;let i=s.depth;for(;i<e;){if(s=this.columnHeaderParentMap.get(s.name),!s)return;i=s.depth}if(s.depth===e)return s}textForRowFooter(t){const e=this.totalsRow(t);return e!=null&&this.totals?this.totals.operationOrder[e]:""}get movedColumns(){var i;let t=[];const e=(o,r)=>{const l=this.getColumnIndexByName(o);if(l==null)throw new Error(`Unknown layout hint column: ${o}`);const a=K.getVisibleIndex(l,t);t=K.moveItem(a,r,t)},n=(o,r)=>{const l=this.columnHeaderGroupMap.get(o);if(!l)throw new Error(`Unknown layout hint group: ${o}`);const a=l.getVisibleRange(t);t=K.moveRange(a,r,t)};if(this.frontColumns.length||this.backColumns.length||this.frozenColumns.length){const o=new Set;let r=0;this.frozenColumns.forEach(a=>{if(o.has(a))throw new Error(`Column specified in multiple layout hints: ${a}`);e(a,r),r+=1}),this.frontColumns.forEach(a=>{if(o.has(a))throw new Error(`Column specified in multiple layout hints: ${a}`);e(a,r),r+=1});let l=this.columnMap.size-1;this.backColumns.forEach(a=>{if(o.has(a))throw new Error(`Column specified in multiple layout hints: ${a}`);e(a,l),l-=1})}const s=(i=this.layoutHints)==null?void 0:i.columnGroups;if(s){this.setColumnHeaderGroups(s);const o=[...this.columnHeaderGroupMap.values()];o.sort((r,l)=>r.depth-l.depth),o.forEach(r=>{const l=r.children[0],a=this.getColumnIndexByName(l);let c;if(a!=null)c=K.getVisibleIndex(a,t);else{const h=this.columnHeaderGroupMap.get(l);if(!h)throw new Error(`Unknown column ${l} in group ${r.name}`);[,c]=h.getVisibleRange(t)}for(let h=1;h<r.children.length;h+=1){const u=r.children[h],m=this.columnHeaderGroupMap.get(u),p=this.getColumnIndexByName(u);if(m){const f=m.getVisibleRange(t)[0]<c?c-m.childIndexes.length+1:c+1;n(u,f),c=f+m.childIndexes.length-1}else if(p!=null){const f=K.getVisibleIndex(p,t)<c?c:c+1;e(u,f),c=f}}})}return t}get columnMap(){return this.getMemoizedColumnMap(this.table.columns)}get columnHeaderMaxDepth(){var t,e;return this._columnHeaderMaxDepth==null&&this.setColumnHeaderGroups((t=this.layoutHints)==null?void 0:t.columnGroups),(e=this._columnHeaderMaxDepth)!=null?e:1}set columnHeaderMaxDepth(t){this._columnHeaderMaxDepth=t}setColumnHeaderGroups(t){if(t===this._columnHeaderGroups||(this._columnHeaderGroups=t!=null?t:[],this.columnHeaderMaxDepth=1,this.columnHeaderParentMap=new Map,this.columnHeaderGroupMap=new Map,!t||t.length===0))return;const e=new Map(t.map(o=>[o.name,o])),n=new Set,s=o=>{const{name:r}=o;if(this.getColumnIndexByName(r)!=null)throw new Error(`Column header group has same name as column: ${r}`);const l=this.columnHeaderGroupMap.get(r);if(l)return l;const a=[];let c=1;o.children.forEach(u=>{if(n.has(u))throw new Error(`Column group child ${u} specified in multiple groups`);n.add(u);const m=e.get(u),p=this.getColumnIndexByName(u);if(m){const g=s(m);a.push(g.childIndexes.flat()),c=Math.max(c,g.depth+1)}else if(p!=null)a.push(p),c=Math.max(c,1);else throw new Error(`Unknown child ${u} in group ${r}`)});const h=new Xm({...o,depth:c,childIndexes:a});return this.columnHeaderGroupMap.set(r,h),o.children.forEach(u=>this.columnHeaderParentMap.set(u,h)),this.columnHeaderMaxDepth=Math.max(this.columnHeaderMaxDepth,h.depth+1),h},i=new Set;t.forEach(o=>{const{name:r}=o;if(i.has(r))throw new Error(`Duplicate column group name: ${r}`);i.add(r),s(o)})}get groupedColumns(){return[]}row(t){var l,a,c,h,u,m,p,g,f,b,C,v,T,E;const e=(c=(a=(l=this.totals)==null?void 0:l.operationOrder)==null?void 0:a.length)!=null?c:0,n=(u=(h=this.totals)==null?void 0:h.showOnTop)!=null?u:!1,s=this.totalsRow(t);if(s!=null){const y=(m=this.totals)==null?void 0:m.operationOrder[s];return A(y),(g=(p=this.totalsDataMap)==null?void 0:p.get(y))!=null?g:null}const i=this.pendingRow(t);if(i!=null)return(f=this.pendingNewDataMap.get(i))!=null?f:null;const o=(C=(b=this.viewportData)==null?void 0:b.offset)!=null?C:0,r=(n?t-e:t)-o;return(E=(T=(v=this.viewportData)==null?void 0:v.rows)==null?void 0:T[r])!=null?E:null}totalsColumn(t,e){var r,l,a,c;const n=this.totalsRow(e);if(n==null)return null;const s=(r=this.totals)==null?void 0:r.operationOrder[n],i=(a=(l=this.totals)==null?void 0:l.defaultOperation)!=null?a:Ve.SUM,o=this.columns[t];return(c=this.totalsTable)==null?void 0:c.columns.find(h=>{var u;return h.name===`${o.name}__${s}`||(s===i||((u=this.totals)==null?void 0:u.operationOrder.length)===1)&&h.name===o.name})}totalsRow(t){var i,o,r,l,a;const e=(r=(o=(i=this.totals)==null?void 0:i.operationOrder)==null?void 0:o.length)!=null?r:0,s=((a=(l=this.totals)==null?void 0:l.showOnTop)!=null?a:!1)?t:t-this.table.size;return s>=0&&s<e?s:null}pendingRow(t){const e=t-this.floatingTopRowCount-this.table.size;return e>=0&&e<this.pendingNewRowCount?e:null}isTotalsRow(t){return this.totalsRow(t)!=null}isPendingRow(t){return this.pendingRow(t)!=null}dataForCell(t,e){var n;return(n=this.row(e))==null?void 0:n.data.get(t)}formatForCell(t,e){var n;return(n=this.dataForCell(t,e))==null?void 0:n.format}valueForCell(t,e){var s;const n=this.dataForCell(t,e);if(n)return(s=n.value)!=null?s:null}copyViewportData(t){if(t==null){it.warn("invalid data!");return}this.viewportData=this.extractViewportData(t),this.formattedStringData=[]}copyTotalsData(t){var l,a,c,h,u;if(t==null){it.warn("invalid data!");return}const{columns:e,rows:n}=t;if(n.length!==1){it.error("Unexpected number of rows received for totals table, ignoring update");return}const s=new Map,i=n[0],o=(a=(l=this.totals)==null?void 0:l.defaultOperation)!=null?a:Ve.SUM,r=(c=this.totals)==null?void 0:c.operationMap;for(let m=0;m<e.length;m+=1){const p=e[m],[g,f=(u=(h=r==null?void 0:r[g])==null?void 0:h[0])!=null?u:o]=p.name.split("__");s.has(f)||s.set(f,{data:new Map});const{data:b}=s.get(f),C=this.columns.findIndex(v=>v.name===g);b.set(C,{value:i.get(p),format:i.getFormat(p)})}it.debug2("copyTotalsData",s),this.totalsDataMap=s,this.formattedStringData=[]}getColumnIndexByName(t){return this.getColumnIndicesByNameMap(this.columns).get(t)}extractViewportData(t){const e={offset:t.offset,rows:[]},{columns:n}=t;for(let s=0;s<t.rows.length;s+=1){const i=t.rows[s],o=this.extractViewportRow(i,n);e.rows.push(o)}return e}extractViewportRow(t,e){const n=new Map;for(let s=0;s<e.length;s+=1){const i=e[s],o=this.getColumnIndexByName(i.name);A(o),n.set(o,{value:t.get(i),format:t.getFormat(i)})}return{data:n}}closeSubscription(){it.debug2("closeSubscription",this.subscription),this.subscription&&(this.subscription.close(),this.subscription=null),this.setViewport.cancel(),this.applyViewport.cancel()}get filter(){return this.table.filter}set filter(t){this.closeSubscription(),this.table.applyFilter(t),this.applyViewport()}get formatter(){return this.irisFormatter}set formatter(t){this.irisFormatter=t,this.formattedStringData=[],this.dispatchEvent(new Ye(we.EVENT.FORMATTER_UPDATED))}displayString(t,e,n="",s){return this.getCachedFormattedString(this.formatter,t,e,n,s)}get sort(){return this.table.sort}set sort(t){this.closeSubscription(),this.table.applySort(t),this.applyViewport()}set totalsConfig(t){if(it.debug("set totalsConfig",t),t!==this.totals){if(this.totals=t,this.formattedStringData=[],this.totalsTablePromise!=null&&this.totalsTablePromise.cancel(),this.setTotalsTable(null),t==null){this.dispatchEvent(new Ye(we.EVENT.UPDATED));return}this.totalsTablePromise=Re.makeCancelable(this.table.getTotalsTable(t),e=>e.close()),this.totalsTablePromise.then(e=>{this.totalsTablePromise=null,this.setTotalsTable(e)}).catch(e=>{Re.isCanceled(e)||(it.error("Unable to set next totalsTable",e),this.totalsTablePromise=null,this.dispatchEvent(new Ye(we.EVENT.REQUEST_FAILED,{detail:e})))})}}setTotalsTable(t){it.debug("setTotalsTable",t),this.totalsTable!==null&&(this.listenerCount>0&&this.removeTotalsListeners(this.totalsTable),this.totalsTable.close()),this.totalsTable=t,this.totalsDataMap=null,this.listenerCount>0&&this.totalsTable!=null&&this.addTotalsListeners(this.totalsTable)}applyBufferedViewport(t,e,n){it.debug2("applyBufferedViewport",t,e,n),this.subscription==null?(it.debug2("applyBufferedViewport creating new subscription"),this.subscription=this.table.setViewport(t,e,n)):(it.debug2("applyBufferedViewport using existing subscription"),this.subscription.setViewport(t,e,n))}async snapshot(t,e=!1,n=s=>s){if(this.subscription==null)throw new Error("No subscription available");const s=oe.consolidate(t);if(!te.isValidSnapshotRanges(s))throw new Error(`Invalid snapshot ranges ${t}`);const i=new Set,o=[],r=new Set;for(let u=0;u<s.length;u+=1){const m=s[u];A(m.endRow),A(m.startRow);for(let p=m.startRow;p<=m.endRow&&p<this.floatingTopRowCount;p+=1)i.add(p);m.endRow>=this.floatingTopRowCount&&m.startRow<=this.floatingTopRowCount+this.table.size&&o.push(new oe(m.startColumn,Math.min(Math.max(0,m.startRow-this.floatingTopRowCount)),m.endColumn,Math.min(Math.max(0,m.endRow-this.floatingTopRowCount),this.table.size-this.floatingTopRowCount)));for(let p=Math.max(m.startRow,this.floatingTopRowCount+this.table.size);p<=m.endRow&&p<this.floatingTopRowCount+this.table.size+this.floatingBottomRowCount;p+=1)r.add(p)}const l=te.columnsFromRanges(s,this.columns),a=[];e&&a.push(l.map(u=>u.name));const c=[...i].sort();for(let u=0;u<c.length;u+=1){const m=c[u],p=l.map(g=>{const f=this.getColumnIndexByName(g.name);return A(f),n(this.valueForCell(f,m),g)});e&&p.push(this.textForRowFooter(m)),a.push(p)}if(o.length>0){const u=te.rangeSetFromRanges(o),m=await this.subscription.snapshot(u,l);a.push(...m.rows.map(p=>l.map(g=>n(p.get(g),g))))}const h=[...r].sort();for(let u=0;u<h.length;u+=1){const m=h[u],p=l.map(g=>{const f=this.getColumnIndexByName(g.name);return A(f),n(this.valueForCell(f,m),g)});e&&p.push(this.textForRowFooter(m)),a.push(p)}return a}async textSnapshot(t,e=!1,n=s=>`${s}`){return it.debug2("textSnapshot",t,e),(await this.snapshot(t,e,n)).map(i=>i.join(" ")).join(`
35
+ `)}async valuesTable(t){let e=null;try{return e=await this.table.copy(),e.applyFilter([]),e.applySort([]),e.selectDistinct([t])}finally{e!=null&&e.close()}}isColumnMovable(t,e){if(t<0||t>=this.columnCount)return!1;if(e>0)return!0;const n=this.columns[t].name;return this.frontColumns.includes(n)||this.backColumns.includes(n)||this.frozenColumns.includes(n)||!n?!1:!this.isKeyColumn(t)}isKeyColumn(t){var e,n;return t<((n=(e=this.inputTable)==null?void 0:e.keyColumns.length)!=null?n:0)}isRowMovable(){return!1}isEditableRange(t){return this.inputTable!=null&&oe.isBounded(t)&&(this.isPendingRow(t.startRow)&&this.isPendingRow(t.endRow)||t.startColumn>=this.inputTable.keyColumns.length&&t.endColumn>=this.inputTable.keyColumns.length)&&t.startRow>=this.floatingTopRowCount&&t.startRow<this.floatingTopRowCount+this.table.size+this.pendingRowCount&&t.endRow<this.floatingTopRowCount+this.table.size+this.pendingRowCount}isDeletableRange(t){return this.inputTable!=null&&t.startRow!=null&&t.endRow!=null&&t.startRow>=this.floatingTopRowCount&&t.startRow<this.floatingTopRowCount+this.table.size+this.pendingRowCount&&t.endRow<this.floatingTopRowCount+this.table.size+this.pendingRowCount}isEditableRanges(t){return t.every(e=>this.isEditableRange(e))}isDeletableRanges(t){return t.every(e=>this.isDeletableRange(e))}getTableAreaRange(){return new oe(null,this.floatingTopRowCount,null,this.floatingTopRowCount+this.table.size-1)}getPendingAreaRange(){return new oe(null,this.floatingTopRowCount+this.table.size,null,this.floatingTopRowCount+this.table.size+this.pendingNewRowCount-1)}async setValueForCell(t,e,n){return this.setValueForRanges([new oe(t,e,t,e)],n)}async setValueForRanges(t,e){var n;if(!this.isEditableRanges(t))throw new Error(`Uneditable ranges ${t}`);try{const s=new Set,i=[];oe.forEachCell(t,(c,h)=>{const u=this.columns[c];if(s.add(u),i[c]===void 0){const m=P.makeValue(u.type,e,this.formatter.timeZone);i[c]=m!=null?this.displayString(m,u.type,u.name):null}this.cachePendingValue(c,h,i[c])});const o=this.getPendingAreaRange(),r=t.map(c=>oe.intersection(o,c)).filter(c=>c!=null).map(c=>(A(c),oe.offset(c,0,-(this.floatingTopRowCount+this.table.size))));if(r.length>0){const c=new Map(this.pendingNewDataMap);oe.forEachCell(r,(h,u)=>{c.has(u)||c.set(u,{data:new Map});const m=this.columns[h],p=c.get(u);A(p);const{data:g}=p,f=new Map(g),b=P.makeValue(m.type,e,this.formatter.timeZone);b!=null?f.set(h,{value:b}):f.delete(h),f.size>0?c.set(u,{...p,data:f}):c.delete(u)}),this.pendingDataMap=c}this.dispatchEvent(new Ye(we.EVENT.UPDATED));const l=this.getTableAreaRange(),a=t.map(c=>oe.intersection(l,c)).filter(c=>c!=null);if(a.length>0){const h=(await this.snapshot(a.map(m=>{var p,g;return new oe(null,(p=m==null?void 0:m.startRow)!=null?p:null,null,(g=m==null?void 0:m.endRow)!=null?g:null)}))).map(m=>{const p={};for(let g=0;g<this.columns.length;g+=1)p[this.columns[g].name]=m[g];return s.forEach(g=>{p[g.name]=P.makeValue(g.type,e,this.formatter.timeZone)}),p}),u=await((n=this.inputTable)==null?void 0:n.addRows(h));it.debug("setValueForRanges(",t,",",e,") set tableRanges",a,"result",u)}oe.forEachCell(t,(c,h)=>{const u=i[c];A(u),this.cacheFormattedValue(c,h,u)})}catch(s){it.error("Unable to set ranges",t,e,s)}finally{oe.forEachCell(t,(s,i)=>{this.clearPendingValue(s,i)})}}async setValues(t=[]){var e;if(it.debug("setValues(",t,")"),!t.every(n=>{var s,i;return this.isEditableRange(oe.makeCell((s=n.column)!=null?s:n.x,(i=n.row)!=null?i:n.y))}))throw new Error(`Uneditable ranges ${t}`);try{const n=new Map(this.pendingNewDataMap);t.forEach(l=>{var f,b;const{text:a}=l,c=(f=l.column)!=null?f:l.x,h=(b=l.row)!=null?b:l.y,u=this.columns[c],m=P.makeValue(u.type,a,this.formatter.timeZone),p=m!=null?this.displayString(m,u.type,u.name):null;this.cachePendingValue(c,h,p);const g=this.pendingRow(h);if(g!=null){n.has(g)||n.set(g,{data:new Map});const C=n.get(g);A(C);const{data:v}=C,T=new Map(v);m!=null?T.set(c,{value:m}):T.delete(c),T.size>0?n.set(g,{...C,data:T}):n.delete(g)}}),this.pendingDataMap=n,this.dispatchEvent(new Ye(we.EVENT.UPDATED));const s=t.reduce((l,a)=>{var h,u;const c=(h=a.row)!=null?h:a.y;return l.has(c)||l.set(c,[]),(u=l.get(c))==null||u.push(a),l},new Map),i=oe.consolidate(t.map(l=>{var a,c;return oe.makeCell((a=l.column)!=null?a:l.x,(c=l.row)!=null?c:l.y)})),o=this.getTableAreaRange(),r=i.map(l=>oe.intersection(o,l)).filter(l=>l!=null);if(r.length>0){const a=(await this.snapshot(r.map(h=>(A(h),new oe(null,h.startRow,null,h.endRow))))).map((h,u)=>{let m=null,p=u;for(let b=0;b<r.length;b+=1){const C=r[b];A(C);const v=oe.rowCount([C]);if(p<v){A(C.startRow),m=C.startRow+p;break}p-=v}const g={};for(let b=0;b<this.columns.length;b+=1)g[this.columns[b].name]=h[b];A(m);const f=s.get(m);return f!=null&&f.forEach(b=>{var v;const C=this.columns[(v=b.column)!=null?v:b.x];g[C.name]=P.makeValue(C.type,b.text,this.formatter.timeZone)}),g});it.info("setValues setting tableRanges",r);const c=await((e=this.inputTable)==null?void 0:e.addRows(a));it.info("setValues set tableRanges",r,"SUCCESS",c)}t.forEach(l=>{var g,f;const{text:a}=l,c=(g=l.column)!=null?g:l.x,h=(f=l.row)!=null?f:l.y,u=this.columns[c],m=P.makeValue(u.type,a,this.formatter.timeZone),p=m!=null?this.displayString(m,u.type,u.name):null;this.cacheFormattedValue(c,h,p)})}finally{t.forEach(n=>{this.clearPendingValue(n.column,n.row)})}}async commitPending(){var t,e,n;if(this.pendingNewDataMap.size<=0)throw new Error("No pending changes to commit");try{this.isSaveInProgress=!0;const s=[];this.pendingNewDataMap.forEach(o=>{const r={};o.data.forEach(({value:l},a)=>{const c=this.columns[a];r[c.name]=l}),s.push(r)});const i=await((t=this.inputTable)==null?void 0:t.addRows(s));it.debug("commitPending()",this.pendingNewDataMap,"result",i),this.pendingNewDataMap=new Map,this.pendingNewDataErrors=new Map,this.pendingNewRowCount=Math.max(0,((n=(e=this.viewport)==null?void 0:e.bottom)!=null?n:0)-this.table.size),this.formattedStringData=[],this.dispatchEvent(new Ye(we.EVENT.PENDING_DATA_UPDATED))}finally{this.isSaveInProgress=!1}}editValueForCell(t,e){return this.textValueForCell(t,e)}async delete(t){if(!this.isDeletableRanges(t))throw new Error(`Undeletable ranges ${t}`);A(this.inputTable);const{keyColumns:e}=this.inputTable;if(e.length===0)throw new Error("No key columns to allow deletion");const n=this.getPendingAreaRange(),s=t.map(h=>oe.intersection(n,h)).filter(h=>h!=null).map(h=>(A(h),oe.offset(h,0,-(this.floatingTopRowCount+this.table.size))));if(s.length>0){const h=new Map(this.pendingNewDataMap);for(let u=0;u<s.length;u+=1){const m=s[u];A(m.startRow),A(m.endRow);for(let p=m.startRow;p<=m.endRow;p+=1)h.delete(p)}this.pendingNewDataMap=h,this.formattedStringData=[],this.dispatchEvent(new Ye(we.EVENT.PENDING_DATA_UPDATED)),this.dispatchEvent(new Ye(we.EVENT.UPDATED))}const i=this.getTableAreaRange(),o=t.map(h=>oe.intersection(i,h)).filter(h=>h!=null);if(o.length<=0)return;const[r,l]=await Promise.all([this.snapshot(o.map(h=>(A(h),new oe(0,h.startRow,e.length-1,h.endRow)))),this.table.copy()]),c=r.map(h=>{const u=[];for(let m=0;m<e.length;m+=1){const p=e[m],g=h[m],f=P.makeFilterRawValue(p.type,g),b=p.filter().eq(f);u.push(b)}return u.reduce((m,p)=>{var g;return(g=m==null?void 0:m.and(p))!=null?g:p})}).reduce((h,u)=>{var m;return(m=h==null?void 0:h.or(u))!=null?m:u});l.applyFilter([c]),l.close()}isValidForCell(t,e,n){try{const s=this.columns[t];return P.makeValue(s.type,n,this.formatter.timeZone),!0}catch{return!1}}};let xc=Fa;xc.ROW_BUFFER_PAGES=1;const Rs=X.module("IrisGridTableModel"),ha=Object.freeze([]);class jm extends xc{constructor(e,n=new pn,s=null){super(e,n,s),this.getMemoizedFrontColumns=Ce(i=>i!=null?i:ha),this.getMemoizedBackColumns=Ce(i=>i!=null?i:ha),this.getMemoizedFrozenColumns=Ce((i,o)=>{var r;return(r=o!=null?o:i)!=null?r:ha}),this.getCachedFilterableColumnSet=Ce(i=>new Set(i.map((o,r)=>r))),this.customColumnList=[],this.formatColumnList=[]}get isExportAvailable(){return this.table.freeze!=null}get isColumnStatisticsAvailable(){return this.table.getColumnStatistics!=null}get isValuesTableAvailable(){return this.table.selectDistinct!=null&&this.table.copy!=null}get isRollupAvailable(){return this.table.rollup!=null}get isSelectDistinctAvailable(){return this.table.selectDistinct!=null}get isCustomColumnsAvailable(){return this.table.applyCustomColumns!=null}get isFormatColumnsAvailable(){return this.table.applyCustomColumns!=null}get frontColumns(){var e;return this.getMemoizedFrontColumns((e=this.layoutHints)==null?void 0:e.frontColumns)}get backColumns(){var e;return this.getMemoizedBackColumns((e=this.layoutHints)==null?void 0:e.backColumns)}get frozenColumns(){var e;return this.getMemoizedFrozenColumns((e=this.layoutHints)==null?void 0:e.frozenColumns,this.userFrozenColumns)}get layoutHints(){return this.table.layoutHints}get floatingLeftColumnCount(){return this.frozenColumns.length}get description(){return this.table.description}get customColumns(){return this.customColumnList}set customColumns(e){if(Rs.debug2("set customColumns",e,this.customColumnList,e===this.customColumnList),this.customColumnList.length===0&&e.length===0){Rs.debug("Ignore empty initial customColumns"),this.customColumnList=e;return}if(this.customColumnList===e){Rs.debug("Ignore same customColumns");return}this.closeSubscription(),this.customColumnList=e,this.table.applyCustomColumns([...e,...this.formatColumns]),this.applyViewport()}get formatColumns(){return this.formatColumnList}set formatColumns(e){if(Rs.debug2("set formatColumns",e,this.formatColumnList,e===this.formatColumnList),this.formatColumnList.length===0&&e.length===0){Rs.debug("Ignore empty initial formatColumns"),this.formatColumnList=e;return}if(this.formatColumnList===e){Rs.debug("Ignore same formatColumns");return}this.closeSubscription(),this.formatColumnList=e,this.table.applyCustomColumns([...this.customColumns,...e]),this.applyViewport()}updateFrozenColumns(e){this.userFrozenColumns=e,this.dispatchEvent(new Ye(we.EVENT.TABLE_CHANGED,{detail:this.table}))}set totalsConfig(e){if(Rs.debug("set totalsConfig",e),e!==this.totals){if(this.totals=e,this.formattedStringData=[],this.totalsTablePromise!=null&&this.totalsTablePromise.cancel(),this.setTotalsTable(null),e==null){this.dispatchEvent(new Ye(we.EVENT.UPDATED));return}this.totalsTablePromise=Re.makeCancelable(this.table.getTotalsTable(e),n=>n.close()),this.totalsTablePromise.then(n=>{this.totalsTablePromise=null,this.setTotalsTable(n)}).catch(n=>{Re.isCanceled(n)||(Rs.error("Unable to set next totalsTable",n),this.totalsTablePromise=null,this.dispatchEvent(new Ye(we.EVENT.REQUEST_FAILED,{detail:n})))})}}get isFilterRequired(){return this.table.isUncoalesced}isFilterable(e){return this.getCachedFilterableColumnSet(this.columns).has(e)}async export(){return this.table.freeze()}columnStatistics(e){return this.table.getColumnStatistics(e)}isColumnMovable(e){const n=this.columns[e].name;return this.frontColumns.includes(n)||this.backColumns.includes(n)||this.frozenColumns.includes(n)?!1:!this.isKeyColumn(e)}isColumnFrozen(e){return this.frozenColumns.includes(this.columns[e].name)}async delete(e){var u;if(!this.isDeletableRanges(e))throw new Error(`Undeletable ranges ${e}`);A(this.inputTable);const{keyColumns:n}=this.inputTable;if(n.length===0)throw new Error("No key columns to allow deletion");const s=this.getPendingAreaRange(),i=e.map(m=>oe.intersection(s,m)).filter(m=>m!=null).map(m=>(A(m),oe.offset(m,0,-(this.floatingTopRowCount+this.table.size))));if(i.length>0){const m=new Map(super.pendingDataMap);for(let p=0;p<i.length;p+=1){const g=i[p];A(g.startRow),A(g.endRow);for(let f=g.startRow;f<=g.endRow;f+=1)m.delete(f)}super.pendingDataMap=m,this.formattedStringData=[],this.dispatchEvent(new Ye(we.EVENT.PENDING_DATA_UPDATED)),this.dispatchEvent(new Ye(we.EVENT.UPDATED))}const o=this.getTableAreaRange(),r=e.map(m=>oe.intersection(o,m)).filter(m=>m!=null);if(r.length<=0)return;const[l,a]=await Promise.all([this.snapshot(r.map(m=>(A(m),new oe(0,m.startRow,n.length-1,m.endRow)))),this.table.copy()]),h=l.map(m=>{const p=[];for(let g=0;g<n.length;g+=1){const f=n[g],b=m[g],C=P.makeFilterRawValue(f.type,b),v=f.filter().eq(C);p.push(v)}return p.reduce((g,f)=>{var b;return(b=g==null?void 0:g.and(f))!=null?b:f})}).reduce((m,p)=>{var g;return(g=m==null?void 0:m.or(p))!=null?g:p});a.applyFilter([h]),await((u=this.inputTable)==null?void 0:u.deleteTable(a)),a.close()}}class bT extends xc{constructor(){super(...arguments),this.getCachedFilterableColumnSet=Ce((e,n)=>new Set(((n==null?void 0:n.length)>0?n:e).map(s=>e.findIndex(i=>s.name===i.name))))}applyBufferedViewport(e,n,s){this.table.setViewport(e,n,s)}textForCell(e,n){const s=this.columns[e],i=this.row(n);if(i!=null&&s!=null&&!i.hasChildren&&s.constituentType!=null){const o=this.valueForCell(e,n);return this.displayString(o,s.constituentType,s.name)}return super.textForCell(e,n)}extractViewportRow(e,n){const{isExpanded:s,hasChildren:i,depth:o}=e;return{...super.extractViewportRow(e,n),isExpanded:s,hasChildren:i,depth:o}}async snapshot(e,n,s){var l,a,c,h;A(this.viewport),A(this.viewportData);const{columns:i}=this.viewport,o=[];n!=null&&n&&o.push(i.map(u=>u.name));const r=new oe(0,(l=this.viewportData)==null?void 0:l.offset,i.length,((a=this.viewportData)==null?void 0:a.offset)+((c=this.viewportData)==null?void 0:c.rows.length));for(let u=0;u<e.length;u+=1){const m=oe.intersection(r,e[u]);A(m),A(m.startRow),A(m.endRow);for(let p=m.startRow;p<=m.endRow;p+=1){const g=[],f=this.viewportData.rows[p-this.viewportData.offset];A(m.startColumn),A(m.endColumn);for(let b=m.startColumn;b<=m.endColumn;b+=1)A(s),g.push(s((h=f.data.get(b))==null?void 0:h.value,this.columns[b]));o.push(g)}}return o}get groupedColumns(){return[]}get hasExpandableRows(){return!0}get isChartBuilderAvailable(){return!1}get isSelectDistinctAvailable(){return!1}get isReversible(){return!1}isFilterable(e){return this.getCachedFilterableColumnSet(this.columns,this.groupedColumns).has(e)}isColumnMovable(e){return e>=this.groupedColumns.length}isRowExpandable(e){var s;const n=this.row(e);return(s=n==null?void 0:n.hasChildren)!=null?s:!1}isRowExpanded(e){var s;const n=this.row(e);return(s=n==null?void 0:n.isExpanded)!=null?s:!1}setRowExpanded(e,n){this.table.setExpanded(e,n)}depthForRow(e){var s;const n=this.row(e);return((s=n==null?void 0:n.depth)!=null?s:1)-1}}const Ds=X.module("IrisGridProxyModel");function ua(t,e,n){return P.isTreeTable(t)?new bT(t,e):new jm(t,e,n)}class ST extends we{constructor(e,n=new pn,s=null){super(),this.textForCell=(...o)=>this.model.textForCell(...o),this.truncationCharForCell=(...o)=>this.model.truncationCharForCell(...o),this.textAlignForCell=(...o)=>this.model.textAlignForCell(...o),this.colorForCell=(...o)=>this.model.colorForCell(...o),this.backgroundColorForCell=(...o)=>this.model.backgroundColorForCell(...o),this.textForColumnHeader=(...o)=>this.model.textForColumnHeader(...o),this.colorForColumnHeader=(...o)=>this.model.colorForColumnHeader(...o),this.textForRowHeader=(...o)=>this.model.textForRowHeader(...o),this.textForRowFooter=(...o)=>this.model.textForRowFooter(...o),this.isRowMovable=(...o)=>this.model.isRowMovable(...o),this.isColumnMovable=(...o)=>this.model.isColumnMovable(...o),this.isRowExpandable=(...o)=>St(this.model)?this.model.isRowExpandable(...o):!1,this.isRowExpanded=(...o)=>St(this.model)?this.model.isRowExpanded(...o):!1,this.setRowExpanded=(...o)=>{if(St(this.model))return this.model.setRowExpanded(...o);throw Error("Function setRowExpanded does not exist on IrisGridTableModel")},this.depthForRow=(...o)=>St(this.model)?this.model.depthForRow(...o):0,this.getColumnHeaderGroup=(...o)=>this.model.getColumnHeaderGroup(...o),this.getColumnHeaderParentGroup=(...o)=>this.model.getColumnHeaderParentGroup(...o),this.formatForCell=(...o)=>this.model.formatForCell(...o),this.valueForCell=(...o)=>this.model.valueForCell(...o),this.displayString=(...o)=>this.model.displayString(...o),this.isEditableRange=(...o)=>nt(this.model)?this.model.isEditableRange(...o):!1,this.isFilterable=(...o)=>this.model.isFilterable(...o),this.setViewport=(o,r,l)=>this.model.setViewport(o,r,l),this.snapshot=(...o)=>this.model.snapshot(...o),this.textSnapshot=(...o)=>this.model.textSnapshot(...o),this.valuesTable=(...o)=>this.model.valuesTable(...o),this.editValueForCell=(...o)=>(nt(this.model)&&this.model.editValueForCell(...o),""),this.setValueForCell=(...o)=>nt(this.model)?this.model.setValueForCell(...o):Promise.reject(new Error("Model is not editable")),this.setValueForRanges=(...o)=>nt(this.model)?this.model.setValueForRanges(...o):Promise.reject(new Error("Model is not editable")),this.setValues=(...o)=>nt(this.model)?this.model.setValues(...o):Promise.resolve(),this.isValidForCell=(...o)=>nt(this.model)?this.model.isValidForCell(...o):!1,this.delete=(...o)=>this.model.delete(...o),this.commitPending=(...o)=>this.model.commitPending(...o),this.handleModelEvent=this.handleModelEvent.bind(this);const i=ua(e,n,s);this.originalModel=i,this.model=i,this.modelPromise=null,this.rollup=null,this.selectDistinct=[]}close(){this.originalModel.close(),this.model!==this.originalModel&&this.model.close(),this.modelPromise!=null&&this.modelPromise.cancel()}handleModelEvent(e){Ds.debug2("handleModelEvent",e);const{detail:n,type:s}=e;this.dispatchEvent(new Ye(s,{detail:n}))}setModel(e){Ds.debug("setModel",e);const n=this.model;n!==this.originalModel&&n.close(),this.model=e,this.listenerCount>0&&this.addListeners(e),this.dispatchEvent(new Ye(we.EVENT.COLUMNS_CHANGED,{detail:e.columns})),ri(e)&&this.dispatchEvent(new Ye(we.EVENT.TABLE_CHANGED,{detail:e.table}))}setNextModel(e){Ds.debug2("setNextModel"),this.modelPromise&&this.modelPromise.cancel(),this.listenerCount>0&&this.removeListeners(this.model),this.modelPromise=Re.makeCancelable(e,n=>n.close()),this.modelPromise.then(n=>{this.modelPromise=null,this.setModel(n)}).catch(n=>{if(Re.isCanceled(n)){Ds.debug2("setNextModel cancelled");return}Ds.error("Unable to set next model",n),this.modelPromise=null,this.dispatchEvent(new Ye(we.EVENT.REQUEST_FAILED,{detail:n}))})}startListening(){super.startListening(),this.addListeners(this.model)}stopListening(){super.stopListening(),this.removeListeners(this.model)}addListeners(e){const n=Object.keys(we.EVENT);for(let s=0;s<n.length;s+=1)e.addEventListener(n[s],this.handleModelEvent)}removeListeners(e){const n=Object.keys(we.EVENT);for(let s=0;s<n.length;s+=1)e.removeEventListener(n[s],this.handleModelEvent)}get rowCount(){return this.model.rowCount}get columnCount(){return this.model.columnCount}get floatingTopRowCount(){return this.model.floatingTopRowCount}get floatingBottomRowCount(){return this.model.floatingBottomRowCount}get floatingLeftColumnCount(){return this.model.floatingLeftColumnCount}get floatingRightColumnCount(){return this.model.floatingRightColumnCount}isColumnFrozen(e){return this.model.isColumnFrozen(e)}get hasExpandableRows(){return St(this.model)?this.model.hasExpandableRows:!1}get isExportAvailable(){return this.model.isExportAvailable}get isColumnStatisticsAvailable(){return this.model.isColumnStatisticsAvailable}get isValuesTableAvailable(){return this.model.isValuesTableAvailable}get isCustomColumnsAvailable(){return this.model.isCustomColumnsAvailable&&!(this.isSelectDistinctAvailable&&this.selectDistinctColumns.length>0)}get isFormatColumnsAvailable(){return this.model.isFormatColumnsAvailable}get isChartBuilderAvailable(){return this.model.isChartBuilderAvailable}get isRollupAvailable(){return(this.originalModel.isRollupAvailable||this.rollup!=null)&&this.selectDistinct.length===0}get isSelectDistinctAvailable(){return(this.originalModel.isSelectDistinctAvailable||this.selectDistinct.length>0)&&this.rollup==null}get isTotalsAvailable(){return this.model.isTotalsAvailable}get isReversible(){return this.model.isReversible}get columns(){return this.model.columns}get movedColumns(){return this.model.movedColumns}get movedRows(){return this.model.movedRows}get layoutHints(){return this.model.layoutHints}get frontColumns(){return this.model.frontColumns}get backColumns(){return this.model.backColumns}get frozenColumns(){return this.model.frozenColumns}get columnHeaderMaxDepth(){return this.model.columnHeaderMaxDepth}updateFrozenColumns(e){return this.model.updateFrozenColumns(e)}get originalColumns(){return this.originalModel.columns}get groupedColumns(){return this.model.groupedColumns}get description(){return this.model.description}get filter(){return this.model.filter}set filter(e){this.model.filter=e}get formatter(){return this.model.formatter}set formatter(e){this.model.formatter=e}get sort(){return this.model.sort}set sort(e){this.model.sort=e}get customColumns(){return this.model.customColumns}set customColumns(e){this.model.customColumns=e}get formatColumns(){return this.model.formatColumns}set formatColumns(e){this.model.formatColumns=e}get rollupConfig(){return this.rollup}set rollupConfig(e){if(Ds.debug("set rollupConfig",e),!this.isRollupAvailable)throw new Error("Rollup Rows are not available");if(pt(e,this.rollup))return;this.rollup=e;let n=Promise.resolve(this.originalModel);ri(this.originalModel)&&e!=null&&(n=this.originalModel.table.rollup(e).then(s=>ua(s,this.formatter))),this.setNextModel(n)}get selectDistinctColumns(){return this.selectDistinct}set selectDistinctColumns(e){if(Ds.debug("set selectDistinctColumns",e),!this.isSelectDistinctAvailable)throw new Error("Select distinct is not available");if(e===this.selectDistinctColumns||e.length===0&&this.selectDistinctColumns.length===0){Ds.debug("Ignore same selectDistinctColumns",e);return}this.selectDistinct=e;const n=e.map(i=>this.originalColumns.find(o=>o.name===i)).filter(i=>i!=null);let s=Promise.resolve(this.originalModel);ri(this.originalModel)&&n.length>0&&(s=this.originalModel.table.selectDistinct(n).then(i=>ua(i,this.formatter))),this.setNextModel(s)}get table(){if(ri(this.model))return this.model.table}get totalsConfig(){return this.model.totalsConfig}set totalsConfig(e){this.model.totalsConfig=e}get isFilterRequired(){return this.model.isFilterRequired}get isEditable(){return nt(this.model)&&this.model.isEditable}export(){if(P.isTreeTable(this.model))throw new Error("TreeTable has no 'export' property");return this.model.export()}columnStatistics(e){if(P.isTreeTable(this.model))throw new Error("TreeTable has no 'columnStatistics' function");return this.model.columnStatistics(e)}get pendingDataMap(){return this.model.pendingDataMap}set pendingDataMap(e){this.model.pendingDataMap=e}get pendingRowCount(){return this.model.pendingRowCount}set pendingRowCount(e){this.model.pendingRowCount=e}get pendingDataErrors(){return this.model.pendingDataErrors}getColumnIndexByName(e){return this.model.getColumnIndexByName(e)}}class _c{static async makeModel(e,n=new pn){let s=null;return!P.isTreeTable(e)&&e.hasInputTable&&(s=await e.inputTable()),new ST(e,n,s)}}class Yi{}Yi.OPEN="ChartEvent.OPEN";Yi.CLOSE="ChartEvent.CLOSE";Yi.COLUMN_SELECTED="ChartEvent.COLUMN_SELECTED";class wt{}wt.SESSION_OPENED="ConsoleEvent.SESSION_OPENED";wt.SESSION_CLOSED="ConsoleEvent.SESSION_CLOSED";wt.FOCUS_HISTORY="ConsoleEvent.FOCUS_HISTORY";wt.SEND_COMMAND="ConsoleEvent.SEND_COMMAND";wt.SETTINGS_CHANGED="ConsoleEvent.SETTINGS_CHANGED";class Ue{}Ue.TABLE_CHANGED="InputFilterEvent.TABLE_CHANGED";Ue.COLUMNS_CHANGED="InputFilterEvent.COLUMNS_CHANGED";Ue.FILTERS_CHANGED="InputFilterEvent.FILTERS_CHANGED";Ue.CLEAR_ALL_FILTERS="InputFilterEvent.CLEAR_ALL_FILTERS";Ue.COLUMN_SELECTED="InputFilterEvent.COLUMN_SELECTED";Ue.OPEN_DROPDOWN="InputFilterEvent.OPEN_DROPDOWN";Ue.OPEN_INPUT="InputFilterEvent.OPEN_INPUT";Ue.OPEN_FILTER_SET_MANAGER="InputFilterEvent.OPEN_FILTER_SET_MANAGER";class yt{}yt.OPEN_GRID="IrisGridEvent.OPEN_GRID";yt.CLOSE_GRID="IrisGridEvent.CLOSE_GRID";yt.DATA_SELECTED="IrisGridEvent.DATA_SELECTED";yt.COLUMN_SELECTED="IrisGridEvent.COLUMN_SELECTED";yt.STATE_CHANGED="IrisGridEvent.STATE_CHANGED";yt.CREATE_CHART="IrisGridevent.CREATE_CHART";const Qm=Object.freeze({OPEN:"MarkdownEvent.OPEN"});class Be{}Be.CREATE_NOTEBOOK="NotebookEvent.createNotebook";Be.SELECT_NOTEBOOK="NotebookEvent.selectNotebook";Be.CLOSE_FILE="NotebookEvent.closeFile";Be.RENAME="NotebookEvent.rename";Be.RENAME_FILE="NotebookEvent.renameFile";Be.REGISTER_FILE="NotebookEvent.registerFile";Be.SEND_TO_NOTEBOOK="NotebookEvent.sendToNotebook";Be.UNREGISTER_FILE="NotebookEvent.unregisterFile";class Wn{}Wn.focus="TabEvent.focus";Wn.blur="TabEvent.blur";Wn.openPQObject="TabEvent.openPQObject";Wn.openControl="TabEvent.openControl";Wn.reload="TabEvent.reload";Wn.clearAllFilters="TabEvent.clearAllFilters";class Zm extends S.exports.PureComponent{constructor(e){super(e),this.handleCloseTab=this.handleCloseTab.bind(this),this.handleCloseTabsRight=this.handleCloseTabsRight.bind(this),this.handleCloseTabsAll=this.handleCloseTabsAll.bind(this)}getAllTabs(){var n,s,i;const{glContainer:e}=this.props;return[...(i=(s=(n=e==null?void 0:e.tab)==null?void 0:n.header)==null?void 0:s.tabs)!=null?i:[]]}handleCloseTab(){const{glContainer:e}=this.props;e.close()}handleCloseTabsAll(){this.getAllTabs().forEach(n=>{var s;return(s=(n==null?void 0:n.contentItem).container)==null?void 0:s.close()})}handleCloseTabsRight(){var s,i,o,r,l,a,c;const{glContainer:e}=this.props,n=this.getAllTabs();for(let h=n.length-1;h>0&&((i=(s=n[h].contentItem)==null?void 0:s.config)==null?void 0:i.id)!==((l=(r=(o=e.tab)==null?void 0:o.contentItem)==null?void 0:r.config)==null?void 0:l.id);h-=1)(c=((a=n[h])==null?void 0:a.contentItem).container)==null||c.close()}canCloseTabsRight(){var i,o,r,l,a,c,h,u;const{glContainer:e}=this.props,n=this.getAllTabs();let s=!0;for(let m=n.length-1;m>0&&((o=(i=n[m].contentItem)==null?void 0:i.config)==null?void 0:o.id)!==((a=(l=(r=e.tab)==null?void 0:r.contentItem)==null?void 0:l.config)==null?void 0:a.id);m-=1)if(Boolean((u=(h=(c=n[m])==null?void 0:c.contentItem)==null?void 0:h.config)==null?void 0:u.isClosable)){s=!1;break}return s}canCloseAny(){var s,i,o;const e=this.getAllTabs();let n=!0;for(let r=e.length-1;r>0;r-=1)if(Boolean((o=(i=(s=e[r])==null?void 0:s.contentItem)==null?void 0:i.config)==null?void 0:o.isClosable)){n=!1;break}return n}render(){var o,r,l;const{additionalActions:e,glContainer:n}=this.props,s=[...e],i=(l=(r=(o=n.tab)==null?void 0:o.contentItem)==null?void 0:r.config)==null?void 0:l.isClosable;return s.push({title:"Close",order:10,group:ie.groups.low,action:this.handleCloseTab,disabled:i===void 0||!i}),s.push(()=>({title:"Close Tabs to Right",order:20,group:ie.groups.low,action:this.handleCloseTabsRight,disabled:this.canCloseTabsRight()})),s.push(()=>({title:"Close All",order:30,group:ie.groups.low,action:this.handleCloseTabsAll,disabled:this.canCloseAny()})),d(ie,{actions:s})}}Zm.defaultProps={additionalActions:[]};class Jm extends S.exports.PureComponent{constructor(e){super(e),this.handleRenameDialogOpened=this.handleRenameDialogOpened.bind(this),this.handleRenameInputChange=this.handleRenameInputChange.bind(this),this.handleRenameCancel=this.handleRenameCancel.bind(this),this.handleRenameSubmit=this.handleRenameSubmit.bind(this),this.renameInputRef=Y.createRef();const{value:n}=e;this.state={value:n,valueWasValidated:!1}}componentDidUpdate(e){const{isShown:n}=e,{isShown:s}=this.props;s&&!n&&this.resetState()}resetState(){const{value:e}=this.props;this.setState({value:e,valueWasValidated:!1})}handleRenameDialogOpened(){var e,n;(n=(e=this.renameInputRef)==null?void 0:e.current)==null||n.focus()}handleRenameInputChange(e){this.setState({value:e.target.value})}handleRenameCancel(){const{onCancel:e}=this.props;e()}handleRenameSubmit(e){e.stopPropagation(),e.preventDefault();const{value:n}=this.state,s=n==null?void 0:n.trim();if(s!==void 0&&s!==""){const{onSubmit:i}=this.props;i(s)}else this.setState({value:s,valueWasValidated:!0})}renderRenameDialog(){const{isShared:e,isOwner:n,itemType:s}=this.props,{value:i,valueWasValidated:o}=this.state;return w("form",{className:W("p-3",{"was-validated":o}),onSubmit:this.handleRenameSubmit,noValidate:!0,role:"presentation",onMouseDown:r=>{r.stopPropagation()},onMouseUp:r=>{r.stopPropagation()},children:[w("div",{className:"form-group",children:[w("label",{htmlFor:`rename-dialog-${s}-input`,children:["Rename ",s]}),d("input",{type:"text",className:"form-control",id:`rename-dialog-${s}-input`,value:i!=null?i:void 0,ref:this.renameInputRef,onChange:this.handleRenameInputChange,required:!0}),w("div",{className:"invalid-feedback",children:[s," name cannot be empty"]}),(e||!n)&&w("div",{className:"pt-2",children:["Renaming this ",s," will rename for all users."]})]}),w("div",{className:"text-right",children:[d("button",{type:"button",className:"btn btn-outline-primary mr-2",onClick:this.handleRenameCancel,children:"Cancel"}),d("button",{type:"submit",className:"btn btn-primary",children:"Rename"})]})]})}render(){const{isShown:e,onCancel:n}=this.props;return d(xn,{isShown:e,onEntered:this.handleRenameDialogOpened,onExited:n,options:{placement:"bottom",modifiers:{preventOverflow:{boundariesElement:"viewport"}}},interactive:!0,closeOnBlur:!0,children:this.renderRenameDialog()})}}Jm.defaultProps={isShared:!1,isOwner:!0,itemType:"Item",value:""};const wT=X.module("Panel");class Xn extends S.exports.PureComponent{constructor(e){super(e),this.getAdditionActions=Ce((s,i,o)=>{const r=[];return i&&r.push(this.getCloneAction()),o&&r.push(this.getRenameAction()),[...r,...s]}),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.handleCopyPanel=this.handleCopyPanel.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleBlur=this.handleBlur.bind(this),this.handleHide=this.handleHide.bind(this),this.handleResize=this.handleResize.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleBeforeShow=this.handleBeforeShow.bind(this),this.handleShow=this.handleShow.bind(this),this.handleTabBlur=this.handleTabBlur.bind(this),this.handleTabFocus=this.handleTabFocus.bind(this),this.handleRenameCancel=this.handleRenameCancel.bind(this),this.handleRenameSubmit=this.handleRenameSubmit.bind(this),this.handleShowRenameDialog=this.handleShowRenameDialog.bind(this),this.handleTabClicked=this.handleTabClicked.bind(this),this.handleTab=this.handleTab.bind(this);const{glContainer:n}=this.props;this.state={title:J.getTitleFromContainer(n),showRenameDialog:!1}}componentDidMount(){const{componentPanel:e,glContainer:n,glEventHub:s}=this.props;n.on("resize",this.handleResize),n.on("show",this.handleBeforeShow),n.on("shown",this.handleShow),n.on("hide",this.handleHide),n.on("tab",this.handleTab),n.on("tabClicked",this.handleTabClicked),s.on(wt.SESSION_CLOSED,this.handleSessionClosed),s.on(wt.SESSION_OPENED,this.handleSessionOpened),s.on(Wn.focus,this.handleTabFocus),s.on(Wn.blur,this.handleTabBlur),s.on(Ue.CLEAR_ALL_FILTERS,this.handleClearAllFilters),s.emit(Fe.MOUNT,e)}componentWillUnmount(){const{componentPanel:e,glContainer:n,glEventHub:s}=this.props;n.off("resize",this.handleResize),n.off("show",this.handleBeforeShow),n.off("shown",this.handleShow),n.off("hide",this.handleHide),n.off("tab",this.handleTab),n.off("tabClicked",this.handleTabClicked),s.off(wt.SESSION_CLOSED,this.handleSessionClosed),s.off(wt.SESSION_OPENED,this.handleSessionOpened),s.off(Wn.focus,this.handleTabFocus),s.off(Wn.blur,this.handleTabBlur),s.off(Ue.CLEAR_ALL_FILTERS,this.handleClearAllFilters),s.emit(Fe.UNMOUNT,e)}handleTab(e){e!=null&&this.setState({title:J.getTitleFromTab(e)}),this.forceUpdate();const{onTab:n}=this.props;n(e)}handleTabClicked(...e){const{onTabClicked:n}=this.props;n(...e)}handleClearAllFilters(...e){const{onClearAllFilters:n}=this.props;n(...e)}handleFocus(e){const{componentPanel:n,glEventHub:s}=this.props;s.emit(Fe.FOCUS,n);const{onFocus:i}=this.props;i(e)}handleBlur(e){const{onBlur:n}=this.props;n(e)}handleHide(...e){const{onHide:n}=this.props;n(...e)}handleResize(...e){const{onResize:n}=this.props;n(...e)}handleSessionClosed(e){const{onSessionClose:n}=this.props;n(e)}handleSessionOpened(e,n){const{onSessionOpen:s}=this.props;s(e,n)}handleBeforeShow(...e){const{onBeforeShow:n}=this.props;n(...e)}handleShow(...e){const{onShow:n}=this.props;n(...e)}handleTabBlur(...e){const{onTabBlur:n}=this.props;n(...e)}handleTabFocus(...e){const{onTabFocus:n}=this.props;n(...e)}handleRenameCancel(){this.setState({showRenameDialog:!1})}handleShowRenameDialog(){this.setState({showRenameDialog:!0})}handleRenameSubmit(e){const{glContainer:n}=this.props;this.setState({showRenameDialog:!1,title:e});const s=J.getRootFromContainer(n),i=J.getComponentConfigFromContainer(n);A(i),J.renameComponent(s,i,e)}handleCopyPanel(){const{glContainer:e,glEventHub:n}=this.props,s=J.getRootFromContainer(e),i=J.getComponentConfigFromContainer(e);if(i==null){wT.error("Could not get component config from container",e);return}const o=J.cloneComponent(s,i);o!==null&&n.emit(Fe.CLONED,this,o)}getCloneAction(){return{title:"Copy Panel",order:10,group:ie.groups.high,action:this.handleCopyPanel}}getRenameAction(){return{title:"Rename",order:10,group:ie.groups.medium,action:this.handleShowRenameDialog}}render(){const{children:e,className:n,renderTabTooltip:s,glContainer:i,additionalActions:o,errorMessage:r,isLoaded:l,isLoading:a,isClonable:c,isRenamable:h}=this.props,{tab:u}=i,{showRenameDialog:m,title:p}=this.state;return w("div",{className:W("h-100 w-100 iris-panel",n),onFocusCapture:this.handleFocus,onBlurCapture:this.handleBlur,children:[e,d(ul,{errorMessage:r,isLoaded:l,isLoading:a}),u!=null&&ui.createPortal(w(ue,{children:[d(Zm,{glContainer:i,additionalActions:this.getAdditionActions(o,c,h)}),h&&d(Jm,{isShown:m,value:p,itemType:"Panel",onCancel:this.handleRenameCancel,onSubmit:this.handleRenameSubmit}),s!=null&&d(pe,{interactive:!0,options:{placement:"bottom"},popperClassName:"panel-tab-popper",children:s()})]}),u.element[0])]})}}Xn.defaultProps={className:"",onTab:()=>{},onTabClicked:()=>{},onClearAllFilters:()=>{},onFocus:()=>{},onBlur:()=>{},onHide:()=>{},onResize:()=>{},onSessionClose:()=>{},onSessionOpen:()=>{},onBeforeShow:()=>{},onShow:()=>{},onTabBlur:()=>{},onTabFocus:()=>{},renderTabTooltip:null,additionalActions:[],errorMessage:null,isLoading:!1,isLoaded:!0,isClonable:!1,isRenamable:!1};const vT=X.module("WidgetPanelTooltip"),_l=t=>{const{widgetType:e,widgetName:n,glContainer:s,description:i,children:o}=t,r=J.getTitleFromContainer(s),[l,a]=S.exports.useState(!1);return w("div",{className:"tab-tooltip-container",children:[w("div",{className:"row flex-nowrap align-items-start",children:[d("span",{className:"tab-tooltip-title",children:w("b",{children:[e," Name "]})}),d("span",{className:"tab-tooltip-name",children:n}),d(ce,{kind:"ghost",className:"tab-tooltip-copy",icon:l?ja:Ya,onClick:()=>{xe.copyToClipboard(n).then(()=>a(!0)).catch(c=>vT.error("Unable to column name",c))},tooltip:l?"Copied text":"Copy name"})]}),n!==r&&w("div",{className:"row",children:[d("span",{className:"tab-tooltip-title",children:d("b",{children:"Display Name"})}),d("span",{className:"tab-tooltip-name",children:r})]}),i&&d("div",{className:"row",children:d("span",{className:"tab-tooltip-description",children:i})}),o]})};_l.propTypes={glContainer:vm.Container.isRequired,widgetType:R.exports.string,widgetName:R.exports.string,description:R.exports.string,children:R.exports.node};_l.defaultProps={widgetType:"",widgetName:"",description:null,children:null};class Ll extends S.exports.PureComponent{constructor(e){super(e),this.getCachedRenderTabTooltip=Ce((n,s,i,o,r)=>n?()=>d(_l,{glContainer:s,widgetType:i,widgetName:o,description:r}):null),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleCopyName=this.handleCopyName.bind(this),this.state={isClientDisconnected:!1,isPanelDisconnected:!1,isWidgetDisconnected:!1,isWaitingForReconnect:!1,isPanelInactive:!1}}handleCopyName(){const{widgetName:e}=this.props;xe.copyToClipboard(e)}getErrorMessage(){const{errorMessage:e}=this.props,{isClientDisconnected:n,isPanelDisconnected:s,isWidgetDisconnected:i,isWaitingForReconnect:o}=this.state;if(e)return`${e}`;if(n&&s&&o)return`Disconnected from server.
36
+ Check your internet connection.`;if(n&&s)return"Disconnected from server.";if(s){const{widgetName:r,widgetType:l}=this.props;return`Variable "${r}" not set.
37
+ ${l} does not exist yet.`}if(i){const{widgetName:r}=this.props;return`${r} is unavailable.`}}handleSessionClosed(...e){const{onSessionClose:n}=this.props;this.setState({isPanelDisconnected:!0,isWaitingForReconnect:!1}),n(...e)}handleSessionOpened(...e){const{onSessionOpen:n}=this.props;n(...e)}render(){const{children:e,className:n,componentPanel:s,isLoaded:i,isLoading:o,glContainer:r,glEventHub:l,isDisconnected:a,isClonable:c,isRenamable:h,showTabTooltip:u,renderTabTooltip:m,widgetType:p,widgetName:g,description:f,onClearAllFilters:b,onHide:C,onFocus:v,onBlur:T,onResize:E,onShow:y,onTabBlur:I,onTabFocus:D,onTabClicked:M}=this.props,{isPanelDisconnected:x,isWidgetDisconnected:B,isPanelInactive:$}=this.state,k=this.getErrorMessage(),H=m!=null?m:this.getCachedRenderTabTooltip(u,r,p,g,f),O=[{title:`Copy ${p} Name`,group:ie.groups.medium,order:20,action:this.handleCopyName}];return w(Xn,{className:W(n,{disconnected:x||B||a,inactive:$}),componentPanel:s,glContainer:r,glEventHub:l,onClearAllFilters:b,onHide:C,onFocus:v,onBlur:T,onResize:E,onShow:y,onSessionClose:this.handleSessionClosed,onSessionOpen:this.handleSessionOpened,onTabBlur:I,onTabFocus:D,onTabClicked:M,renderTabTooltip:H,errorMessage:k,isLoaded:i,isLoading:o,isClonable:c,isRenamable:h,additionalActions:O,children:[e,$&&d("div",{className:"fill-parent-absolute"})]})}}Ll.defaultProps={className:"",errorMessage:null,isClonable:!0,isDisconnected:!1,isLoading:!1,isLoaded:!0,isRenamable:!0,showTabTooltip:!0,widgetName:"Widget",widgetType:"Widget",renderTabTooltip:null,description:"",onFocus:()=>{},onBlur:()=>{},onHide:()=>{},onClearAllFilters:()=>{},onResize:()=>{},onSessionClose:()=>{},onSessionOpen:()=>{},onShow:()=>{},onTabBlur:()=>{},onTabFocus:()=>{},onTabClicked:()=>{}};const mn=Object.freeze({DEFAULT:"DEFAULT",LINKER:"LINKER"}),TT="SET_SESSION_WRAPPER",ET=bi(TT,null),yT={sessionWrapper:ET},IT=new Map,kl=Object.freeze([]),ep=(t,e)=>{var n;return(n=jt(t,e).columns)!=null?n:kl},RT=(t,e)=>{var n;return(n=jt(t,e).filterSets)!=null?n:kl},Lc=(t,e)=>{var n;return(n=jt(t,e).filters)!=null?n:kl},kc=(t,e)=>{var n;return(n=jt(t,e).tableMap)!=null?n:IT},Oc=(t,e)=>jt(t,e).isolatedLinkerPanelId,ro=(t,e)=>{var n;return(n=jt(t,e).links)!=null?n:kl},Ac=(t,e)=>jt(t,e).columnSelectionValidator,DT=(t,e)=>jt(t,e).connection,Ci=(t,e)=>jt(t,e).sessionWrapper,NT=(t,e)=>n=>n(Yn(t,{connection:e})),MT=(t,e)=>n=>n(Yn(t,{sessionWrapper:e})),Pc=(t,e)=>n=>n(Yn(t,{links:e})),FT=(t,e)=>(n,s)=>{const i=ro(s(),t),o=e.filter(r=>i.findIndex(l=>pt(l.start,r.start)&&pt(l.end,r.end))<0);return n(Pc(t,i.concat(o)))},xT=(t,e)=>(n,s)=>{const o=ro(s(),t).filter(r=>!e.includes(r.id));return n(Pc(t,o))},tp=(t,e)=>n=>n(Yn(t,{isolatedLinkerPanelId:e})),_T=(t,e)=>n=>n(Yn(t,{columnSelectionValidator:e})),LT=(t,e)=>n=>n(Yn(t,{consoleSettings:e})),kT=(t,e)=>n=>n(Yn(t,{filterSets:e}));Object.entries(yT).map(([t,e])=>eo.register(t,e));const np=({columnMap:t,inputFilterMap:e,linkedColumnMap:n,onAdd:s,onOpenLinker:i,waitingFilterMap:o,waitingInputMap:r})=>{const l=S.exports.useMemo(()=>{const p=Array.from(r.keys()),g=p.find(C=>e.get(C)!=null),f=p.find(C=>n.get(C)!=null),b=on.join(p.map(C=>`"${C}"`));return g!=null&&g&&f!=null&&f?`Use a filter control or linked table to set a value for ${b}`:g!=null&&g?`Set a filter control value for ${b}`:`Double click a row in a linked table to set a value for ${b}`},[e,n,r]),a=S.exports.useMemo(()=>Array.from(t.values()),[t]),c=S.exports.useCallback(p=>{p.stopPropagation(),p.preventDefault(),s(Array.from(o.values()))},[s,o]),h=S.exports.useCallback(p=>{p.stopPropagation(),p.preventDefault(),i()},[i]),u=o.size>0,m=!u&&r.size>0;return d("div",{className:"chart-panel-overlay chart-filter-overlay",children:w("div",{className:W("chart-panel-overlay-content chart-filter-overlay-content",{"chart-filter-waiting-filter":u},{"chart-filter-waiting-input":m}),children:[u&&w(ue,{children:[d("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:"}),d("div",{className:"waiting-filter-list",children:a.map(p=>{const g=o.has(p.name),f=g?hs:Qa;return w("div",{className:W("waiting-filter-item",{"is-invalid":g}),children:[d(z,{icon:f}),p.name]},p.name)})}),w("div",{children:[d(zi,{onClick:c,className:"btn-primary",children:"Add Input Filters"}),d(zi,{onClick:h,className:"btn-primary",children:"Open Linker Tool"})]})]}),m&&w(ue,{children:[d("div",{className:"info-message",children:"Waiting for User Input"}),d("div",{className:"",children:l})]})]})})};np.propTypes={columnMap:R.exports.instanceOf(Map).isRequired,inputFilterMap:R.exports.instanceOf(Map).isRequired,linkedColumnMap:R.exports.instanceOf(Map).isRequired,onAdd:R.exports.func.isRequired,onOpenLinker:R.exports.func.isRequired,waitingFilterMap:R.exports.instanceOf(Map).isRequired,waitingInputMap:R.exports.instanceOf(Map).isRequired};const Ao=({columns:t,onColumnSelected:e,onMouseEnter:n,onMouseLeave:s})=>d("div",{className:"chart-panel-overlay chart-column-selector-overlay",children:d("div",{className:W("chart-panel-overlay-content"),children:w(ue,{children:[d("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:"}),d("div",{className:"waiting-column-select-list",children:t.map(i=>d(pl,{className:W("btn-chart-column-selector",Ao.makeButtonClassName(i.name)),onClick:()=>e(i.name),onMouseEnter:()=>{n&&n(i)},onMouseLeave:s,disabled:!i.isValid,isLinked:i.isActive,children:i.name},i.name))})]})})});Ao.makeButtonClassName=t=>`btn-chart-column-selector-${t}`;Ao.defaultProps={onMouseEnter:()=>{},onMouseLeave:()=>{}};const nn=X.module("ChartPanel"),OT=150;function kr(t){return t.settings!==void 0}function AT(t){return t.inputFilters!=null}function PT(t){return t.panelState!=null}class Ol extends S.exports.Component{constructor(e){super(e),this.getWaitingInputMap=Ce((r,l,a)=>{if(!r)return new Map;const c=new Map(l);return a.forEach((h,u)=>{c.delete(u)}),c}),this.getWaitingFilterMap=Ce((r,l,a,c,h)=>{if(!r)return new Map;const u=new Map(l);return a.forEach((m,p)=>{u.delete(p)}),h.forEach((m,p)=>{u.delete(p)}),c.forEach((m,p)=>{u.delete(p)}),u}),this.getInputFilterColumnMap=Ce((r,l)=>{const a=new Map;for(let c=0;c<l.length;c+=1){const h=l[c],{name:u,type:m}=h,p=r.get(u);p!=null&&p.type===m&&a.set(u,h)}return a}),this.getLinkedColumnMap=Ce((r,l)=>{const a=new Map,c=J.getIdFromPanel(this);for(let h=0;h<l.length;h+=1){const u=l[h];let m=null;if(u.start!=null&&u.start.panelId===c&&r.has(u.start.columnName)?m=u.start.columnName:u.end&&u.end.panelId===c&&r.has(u.end.columnName)&&(m=u.end.columnName),m!=null&&r.has(m)){const p=r.get(m);A(p),a.set(m,p)}}return a}),this.getSelectorColumns=Ce((r,l,a)=>Array.from(r.values()).map(c=>({name:c.name,type:c.type,isValid:a?a(this,c):!1,isActive:l.has(c.name)}))),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=Je(this.updateModelFromSource.bind(this),OT),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.panelContainer=Y.createRef(),this.chart=Y.createRef(),this.pending=new gs;const{metadata:n,panelState:s}=e,{filterValueMap:i=[],settings:o={}}=s!=null?s:{};this.state={settings:o,error:void 0,isActive:!1,isDisconnected:!1,isLoading:!1,isLoaded:!1,isLinked:n!=null&&kr(n)&&n.settings&&n.settings.isLinked,filterMap:new Map(i),filterValueMap:new Map(i),model:void 0,columnMap:new Map,panelState:s}}componentDidMount(){this.isHidden()||(this.setState({isActive:!0}),this.initModel())}componentDidUpdate(e,n){const{inputFilters:s,source:i}=this.props,{columnMap:o,model:r,filterMap:l,filterValueMap:a,isLinked:c,settings:h}=this.state;!r||(o!==n.columnMap&&this.pruneFilterMaps(),s!==e.inputFilters&&this.updateChangedInputFilters(s,e.inputFilters),l!==n.filterMap?this.updateFilters():a!==n.filterValueMap&&this.updatePanelState(),h!==n.settings&&$d(r)&&(r.updateSettings(h),this.updatePanelState()),c!==n.isLinked?i&&(c?(this.startListeningToSource(i),this.updateModelFromSource()):this.stopListeningToSource(i)):c&&i!==e.source&&(e.source&&this.stopListeningToSource(e.source),i&&(this.startListeningToSource(i),this.updateModelFromSource())))}componentWillUnmount(){this.pending.cancel();const{source:e}=this.props;e&&this.stopListeningToSource(e)}initModel(){this.setState({isLoading:!0,isLoaded:!1,error:void 0});const{makeModel:e}=this.props;this.pending.add(e(),n=>{n.close()}).then(this.handleLoadSuccess,this.handleLoadError)}startListeningToSource(e){nn.debug("startListeningToSource",e),e.addEventListener(N.Table.EVENT_CUSTOMCOLUMNSCHANGED,this.handleSourceColumnChange),e.addEventListener(N.Table.EVENT_FILTERCHANGED,this.handleSourceFilterChange),e.addEventListener(N.Table.EVENT_SORTCHANGED,this.handleSourceSortChange)}stopListeningToSource(e){nn.debug("stopListeningToSource",e),e.removeEventListener(N.Table.EVENT_CUSTOMCOLUMNSCHANGED,this.handleSourceColumnChange),e.removeEventListener(N.Table.EVENT_FILTERCHANGED,this.handleSourceFilterChange),e.removeEventListener(N.Table.EVENT_SORTCHANGED,this.handleSourceSortChange)}loadModelIfNecessary(){const{isActive:e,isLoaded:n,isLoading:s}=this.state;e&&!n&&!s&&this.initModel()}isHidden(){const{glContainer:e}=this.props,{isHidden:n}=e;return n}handleColumnSelected(e){const{glEventHub:n}=this.props,{columnMap:s}=this.state;n.emit(Yi.COLUMN_SELECTED,this,s.get(e))}handleColumnMouseEnter({type:e,name:n}){const{columnSelectionValidator:s}=this.props;nn.debug("handleColumnMouseEnter",s,e,n),s&&s(this,{type:e,name:n})}handleColumnMouseLeave(){const{columnSelectionValidator:e}=this.props;nn.debug("handleColumnMouseLeave",e),e&&e(this,void 0)}handleDisconnect(){this.setState({error:new Error("Figure disconnected"),isDisconnected:!0})}handleFilterAdd(e){for(let n=0;n<e.length;n+=1)this.openInputFilter(e[n])}handleOpenLinker(){const{localDashboardId:e,setActiveTool:n,setDashboardIsolatedLinkerPanelId:s}=this.props;s(e,void 0),n(mn.LINKER)}handleReconnect(){this.setState({isDisconnected:!1,error:void 0}),this.sendColumnChange(),this.updateColumnFilters()}handleLoadSuccess(e){nn.debug("handleLoadSuccess");const{model:n}=this.state;this.setState({model:e,isLoaded:!0},()=>{const{inputFilters:s,source:i}=this.props,{filterMap:o,isLinked:r}=this.state;e!==n&&(this.sendColumnChange(),this.updateColumnFilters(),this.updateInputFilters(s,o.size>0||e.isFilterRequired()),i&&r&&(this.startListeningToSource(i),this.updateModelFromSource()))})}handleLoadError(e){Re.isCanceled(e)||(nn.error("handleLoadError",e),this.setState({error:e,isLoading:!1}))}handleSourceColumnChange(){this.updateModelFromSource()}handleSourceFilterChange(){this.updateModelFromSource()}handleSourceSortChange(){this.updateModelFromSource()}updateModelFromSource(){const{metadata:e,source:n}=this.props,{isLinked:s,model:i}=this.state;if(!s||!i||!n){nn.debug2("updateModelFromSource ignoring",s,i,n);return}if(this.pending.cancel(),kr(e)){const{settings:o}=e;this.pending.add(N.plot.Figure.create(Pe.makeFigureSettings(o,n))).then(r=>{$d(i)&&i.setFigure(r)}).catch(this.handleLoadError)}this.updatePanelState()}updatePanelState(){const{sourcePanel:e}=this.props,{panelState:n,filterValueMap:s,settings:i}=this.state;let{tableSettings:o}=n!=null?n:{};if(e&&AT(e.props)&&PT(e.state)){const{inputFilters:r}=e.props,{panelState:l}=e.state;l!=null&&(o=te.extractTableSettings(l,r))}this.setState({panelState:{settings:i,tableSettings:o,filterValueMap:Array.from(s)}})}handleError(){this.setState({isLoading:!1})}handleResize(){this.updateChart()}handleSettingsChanged(e){this.setState(({settings:n})=>{const s={...n,...e};return nn.debug("Updated settings",s),{settings:s}})}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:n}=this.props,{name:s,type:i}=e;n.emit(Ue.OPEN_INPUT,{title:`${s} Filter`,panelState:{name:s,type:i,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:n}=this.props;n.emit(Ue.COLUMNS_CHANGED,this,Array.from(e.getFilterColumnMap().values()))}getCoordinateForColumn(e){var l;const n=Ao.makeButtonClassName(e);if(!this.panelContainer.current)return null;const s=this.panelContainer.current.querySelector(`.${n}`),i=(l=s==null?void 0:s.getBoundingClientRect())!=null?l:null;if(i==null||i.width<=0||i.height<=0)return null;const o=i.left+i.width/2,r=i.bottom;return[o,r]}setFilterMap(e){nn.debug("setFilterMap",e),this.setState(n=>{const{columnMap:s,filterMap:i}=n;let o=null;const r=new Map(n.filterValueMap);return e.forEach(({columnType:l,value:a},c)=>{const h=s.get(c);h==null||h.type!==l||(r.set(c,a),i.get(c)!==a&&(o===null&&(o=new Map(i)),o.set(c,a)))}),{filterValueMap:r,filterMap:o!=null?o:i}})}unsetFilterValue(e){this.setState(n=>{var a;const{inputFilters:s}=this.props,{columnMap:i}=n;let{filterMap:o,filterValueMap:r}=n;if(!r.has(e))return null;r=new Map(n.filterValueMap),r.delete(e);const l=this.getInputFilterColumnMap(i,s);if(l.has(e)){const c=o.get(e),h=(a=l.get(e))==null?void 0:a.value;h!=null&&c!==h&&(o=new Map(n.filterMap),h.length>0?o.set(e,h):o.delete(e))}else o=new Map(n.filterMap),o.delete(e);return{filterMap:o,filterValueMap:r}})}updateChangedInputFilters(e,n){const s=n.filter(o=>e.find(r=>r.name===o.name&&r.type===o.type)===void 0);s.length>0&&this.deleteInputFilters(s);const i=e.filter(o=>!n.includes(o));i.length>0&&this.updateInputFilters(i)}updateInputFilters(e,n=!1){this.setState(s=>{const{columnMap:i}=s,o=new Map(s.filterValueMap),r=new Map(s.filterMap),l=n?{filterMap:r,filterValueMap:o}:{};for(let a=0;a<e.length;a+=1){const{name:c,type:h,value:u}=e[a],m=i.get(c);m!=null&&m.type===h&&(u!=null&&r.get(c)!==u&&(u===""?r.delete(c):r.set(c,u),l.filterMap=r),o.has(c)&&(o.delete(c),l.filterValueMap=o))}return nn.debug("updateInputFilters",l),l})}deleteInputFilters(e,n=!1){this.setState(s=>{const{columnMap:i,filterValueMap:o}=s,r=new Map(s.filterMap);let l=n;for(let a=0;a<e.length;a+=1){const{name:c,type:h}=e[a],u=i.get(c);if(u!=null&&u.type===h&&r.has(c)){const m=r.get(c);if(o.has(c)){const p=o.get(c);p!==m&&p!=null&&(l=!0,r.set(c,p))}else l=!0,r.delete(c)}}return nn.debug("deleteInputFilters",l),l?{filterMap:r}:null})}updateColumnFilters(){this.setState(({model:e})=>e?{columnMap:e.getFilterColumnMap()}:null)}updateFilters(){const{columnMap:e,filterMap:n,model:s}=this.state;A(s);const i=this.getWaitingInputMap(s.isFilterRequired(),e,n);if(s.setFilter(n),n.size>0&&i.size===0){const o=s.getDefaultTitle(),r=on.join(Array.from(n.entries()).map(([l,a])=>`${l}: ${a}`));o?s.setTitle(`${o}<br><span style="font-size: smaller">${r}</span>`):s.setTitle(r),nn.debug2("updateFilters filters set",n),this.setState({isLoading:!0})}else nn.debug2("updateFilters waiting on inputs",i),s.setTitle(s.getDefaultTitle()),this.setState({isLoading:!1});this.updatePanelState()}pruneFilterMaps(){this.setState(e=>{const{columnMap:n}=e,s=new Map(e.filterMap),i=new Map(e.filterValueMap),o={};return e.filterValueMap.forEach((r,l)=>{n.has(l)||(i.delete(l),o.filterValueMap=i)}),e.filterMap.forEach((r,l)=>{n.has(l)||(s.delete(l),o.filterMap=s)}),o})}updateChart(){this.chart.current&&this.chart.current.updateDimensions()}render(){const{columnSelectionValidator:e,glContainer:n,glEventHub:s,inputFilters:i,isLinkerActive:o,links:r,metadata:l,settings:a}=this.props,{columnMap:c,filterMap:h,error:u,model:m,isActive:p,isDisconnected:g,isLoaded:f,isLoading:b}=this.state;let C;kr(l)?C=l.table:C=l.figure;const v=this.getInputFilterColumnMap(c,i),T=this.getLinkedColumnMap(c,r),E=m!=null?this.getWaitingInputMap(m.isFilterRequired(),c,h):new Map,y=m!=null?this.getWaitingFilterMap(m.isFilterRequired(),c,h,T,v):new Map,I=u!=null?`Unable to open chart. ${u}`:void 0,D=E.size>0,M=c.size>0&&o;return d(Ll,{className:W("iris-chart-panel",{"input-required":D}),componentPanel:this,glContainer:n,glEventHub:s,onHide:this.handleHide,onClearAllFilters:this.handleClearAllFilters,onResize:this.handleResize,onShow:this.handleShow,onTabBlur:this.handleTabBlur,onTabFocus:this.handleTabFocus,errorMessage:I,isDisconnected:g,isLoading:b,isLoaded:f,widgetName:C,widgetType:"Chart",children:w("div",{ref:this.panelContainer,className:"chart-panel-container h-100 w-100",children:[d("div",{className:"chart-container h-100 w-100",children:f&&m&&d(zu,{isActive:p,model:m,settings:a,ref:this.chart,onDisconnect:this.handleDisconnect,onReconnect:this.handleReconnect,onUpdate:this.handleUpdate,onError:this.handleError,onSettingsChanged:this.handleSettingsChanged})}),d(gt,{in:D&&!M&&!b,timeout:It.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:d(np,{inputFilterMap:v,linkedColumnMap:T,onAdd:this.handleFilterAdd,onOpenLinker:this.handleOpenLinker,columnMap:c,waitingFilterMap:y,waitingInputMap:E})}),d(gt,{in:M,timeout:It.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:d(Ao,{columns:this.getSelectorColumns(c,T,e),onColumnSelected:this.handleColumnSelected,onMouseEnter:this.handleColumnMouseEnter,onMouseLeave:this.handleColumnMouseLeave})})]})})}}Ol.defaultProps={columnSelectionValidator:null,isLinkerActive:!1,source:null,sourcePanel:null,panelState:null,settings:{}};Ol.displayName="ChartPanel";Ol.COMPONENT="ChartPanel";const HT=(t,e)=>{const{localDashboardId:n,metadata:s}=e;let i;s!=null&&(i=s.sourcePanelId);const o=kc(t,n),r=Em(t,n),l=vl(t),a=Oc(t,n),c=l===mn.LINKER&&a===void 0;return{columnSelectionValidator:Ac(t,n),isLinkerActive:c,inputFilters:Lc(t,n),links:ro(t,n),source:i!=null?o.get(i):void 0,sourcePanel:i!=null?r.get(i):void 0,settings:Xt(t)}},$i=xt(HT,{setActiveTool:Tl,setDashboardIsolatedLinkerPanelId:tp},null,{forwardRef:!0})(Ol);const Ir=X.module("CommandHistoryPanel"),sp=class extends S.exports.Component{constructor(t){super(t),this.handleFocusHistory=this.handleFocusHistory.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleSendToConsole=this.handleSendToConsole.bind(this),this.handleSendToNotebook=this.handleSendToNotebook.bind(this),this.container=Y.createRef(),this.pending=new gs;const{session:e,sessionId:n,language:s}=t;this.state={panelState:{},session:e,sessionId:n,language:s,contextActions:[{action:this.handleFocusHistory,shortcut:Fn.COMMAND_HISTORY.FOCUS_HISTORY}]}}static handleError(t){Ir.error(t)}componentDidMount(){const{glEventHub:t,session:e}=this.props;t.on(wt.FOCUS_HISTORY,this.handleFocusHistory),e!=null&&this.loadTable()}componentWillUnmount(){const{glEventHub:t}=this.props;t.off(wt.FOCUS_HISTORY,this.handleFocusHistory),this.pending.cancel()}handleFocusHistory(){this.container.current&&this.container.current.focus()}handleSessionOpened(t,{language:e,sessionId:n}){this.setState({session:t,sessionId:n,language:e},()=>{this.loadTable()})}handleSessionClosed(){this.pending.cancel(),this.setState({session:void 0,language:void 0,table:void 0})}handleSendToNotebook(t,e=!1){const{session:n,language:s}=this.state;if(Ir.debug("handleSendToNotebook",n,t),!n){Ir.error("Session is not connected.");return}const{glEventHub:i}=this.props;i.emit(e?Be.CREATE_NOTEBOOK:Be.SEND_TO_NOTEBOOK,n,s,t)}handleSendToConsole(t,e=!0,n=!1){Ir.debug("handleSendToConsole",t);const{glEventHub:s}=this.props;s.emit(wt.SEND_COMMAND,t,e,n)}loadTable(){const{commandHistoryStorage:t}=this.props,{language:e,sessionId:n}=this.state;A(e),A(n),this.pending.add(t.getTable(e,n,Date.now()),s=>s.close()).then(s=>{this.setState({table:s})}).catch(sp.handleError)}render(){const{glContainer:t,glEventHub:e,commandHistoryStorage:n}=this.props,{language:s,contextActions:i,table:o}=this.state;return w(Xn,{className:"command-history-pane",componentPanel:this,glContainer:t,glEventHub:e,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,children:[!o&&d("div",{className:"command-history-disconnected-message",children:"Waiting for console connection"}),o&&s&&w(ue,{children:[d(bl,{ref:this.container,language:s,sendToNotebook:this.handleSendToNotebook,sendToConsole:this.handleSendToConsole,table:o,commandHistoryStorage:n}),d(ie,{actions:i})]})]})}};let Hc=sp;Hc.COMPONENT="CommandHistoryPanel";Hc.TITLE="Command History";const VT=(t,e)=>{const n=Yu(t),s=Ci(t,e.localDashboardId),{session:i,config:o}=s!=null?s:{},{type:r,id:l}=o!=null?o:{};return{commandHistoryStorage:n,language:r,session:i,sessionId:l}},Qr=xt(VT,null,null,{forwardRef:!0})(Hc);const Rr=X.module("ConsolePanel"),UT=500,BT=Object.freeze({consoleSettings:{},itemIds:[]});class Vc extends S.exports.PureComponent{constructor(e){super(e),this.savePanelState=Je(()=>{const{consoleSettings:r,itemIds:l}=this.state,a={consoleSettings:r,itemIds:[...l]};Rr.debug("Saving panel state",a),this.setState({panelState:a})},UT),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=Y.createRef();const{panelState:n}=e,s={...BT,...n||{}},{consoleSettings:i,itemIds:o}=s;this.state={consoleSettings:i,itemIds:new Map(o),objectMap:new Map,error:void 0,panelState:s}}componentDidMount(){const{glEventHub:e}=this.props;this.closeDisconnectedPanels(),e.on(Fe.MOUNT,this.handlePanelMount),this.subscribeToFieldUpdates()}componentDidUpdate(e,n){const{consoleSettings:s,itemIds:i}=this.state;(n.consoleSettings!==s||n.itemIds!==i)&&this.savePanelState()}componentWillUnmount(){var n;const{glEventHub:e}=this.props;this.savePanelState.flush(),e.off(Fe.MOUNT,this.handlePanelMount),(n=this.objectSubscriptionCleanup)==null||n.call(this)}subscribeToFieldUpdates(){const{sessionWrapper:e}=this.props,{session:n}=e;this.objectSubscriptionCleanup=n.subscribeToFieldUpdates(s=>{Rr.debug("Got updates",s),this.setState(({objectMap:i})=>{const{updated:o,created:r,removed:l}=s,a=[...o,...l],c=new Map(i);return a.forEach(u=>{const{title:m}=u;m!==void 0&&c.delete(m)}),[...o,...r].forEach(u=>{u.title!==void 0&&c.set(u.title,u)}),{objectMap:c}})})}setItemId(e,n){this.setState(({itemIds:s})=>{const i=new Map(s);return i.set(e,n),{itemIds:i}})}getItemId(e,n=!0){const{itemIds:s}=this.state;let i=s.get(e);return i==null&&n&&(i=qe.generate(),this.setItemId(e,i)),i}handleTabFocus(){var e;(e=this.consoleRef.current)==null||e.focus()}handlePanelMount(e){var o,r,l;const{itemIds:n}=this.state,s=(o=e==null?void 0:e.props)==null?void 0:o.id,i=(l=(r=e==null?void 0:e.props)==null?void 0:r.metadata)==null?void 0:l.sourcePanelId;s&&i&&new Set(n.values()).has(i)&&this.setItemId(s,s)}handleFocusCommandHistory(){const{glEventHub:e}=this.props;e.emit(wt.FOCUS_HISTORY)}handleResize(){this.updateDimensions()}handleShow(){this.updateDimensions()}handleOpenObject(e){const{sessionWrapper:n}=this.props,{session:s}=n;this.openWidget(e,s)}handleCloseObject(e){const{title:n}=e;if(n!==void 0){const s=this.getItemId(n,!1),{glEventHub:i}=this.props;i.emit(Fe.CLOSE,s)}}handleSettingsChange(e){const{glEventHub:n}=this.props;Rr.debug("handleSettingsChange",e),this.setState({consoleSettings:e}),n.emit(wt.SETTINGS_CHANGED,e)}openWidget(e,n){const{glEventHub:s}=this.props,{title:i}=e;A(i);const o=this.getItemId(i),r={fetch:()=>n.getObject(e),panelId:o,widget:e};Rr.debug("openWidget",r),s.emit(Fe.OPEN,r)}addCommand(e,n=!0,s=!1){var i;(i=this.consoleRef.current)==null||i.addCommand(e,n,s)}closeDisconnectedPanels(e=!1){const{consoleSettings:n,itemIds:s}=this.state,{isClosePanelsOnDisconnectEnabled:i=!0}=n;if(!i&&!e)return;const o=[...s.values()],{glEventHub:r}=this.props;o.forEach(l=>{r.emit(Fe.CLOSE,l)}),this.setState({itemIds:new Map})}updateDimensions(){var e;(e=this.consoleRef.current)==null||e.updateDimensions()}render(){const{commandHistoryStorage:e,glContainer:n,glEventHub:s,sessionWrapper:i,timeZone:o,unzip:r}=this.props,{consoleSettings:l,error:a,objectMap:c}=this.state,{config:h,session:u,connection:m}=i,{id:p,type:g}=h;return d(Xn,{componentPanel:this,glContainer:n,glEventHub:s,onResize:this.handleResize,onShow:this.handleShow,onTabFocus:this.handleTabFocus,errorMessage:a!=null?`${a}`:void 0,children:d(ue,{children:u!=null&&d(ac,{ref:this.consoleRef,settings:l,session:u,focusCommandHistory:this.handleFocusCommandHistory,openObject:this.handleOpenObject,closeObject:this.handleCloseObject,commandHistoryStorage:e,onSettingsChange:this.handleSettingsChange,language:g,statusBarChildren:w(ue,{children:[d("div",{children:"\xA0"}),d("div",{children:Ru.LANGUAGE_MAP.get(g)}),d("div",{children:"\xA0"}),d("div",{children:d(zb,{connection:m,defaultUpdateInterval:10*1e3,hoverUpdateInterval:3*1e3,monitorDuration:10*60*1e3})}),d("div",{children:"\xA0"})]}),scope:p,timeZone:o,objectMap:c,unzip:r})})})}}Vc.COMPONENT="ConsolePanel";Vc.TITLE="Console";const $T=(t,e)=>({commandHistoryStorage:Yu(t),sessionWrapper:Ci(t,e.localDashboardId),timeZone:wl(t)}),Pi=xt($T,null,null,{forwardRef:!0})(Vc);const So=X.module("DropdownFilter"),WT=150,Or=class extends S.exports.Component{constructor(t){super(t),this.getCompatibleColumns=Ce((i,o)=>i!=null?o.filter(({type:r})=>r!==void 0&&P.isCompatibleType(r,i.columnType)):[]),this.getColumnOptions=Ce((i,o)=>{let r=-1;const l=[];return l.push(d("option",{value:"-1",children:"Select a column"},"placeholder")),i.forEach((a,c)=>{l.push(d("option",{value:c,children:this.getItemLabel(i,c)},`${a.name}/${a.type}`)),o!==null&&a.name===o.name&&a.type===o.type&&(r=c)}),[l,r]}),this.getSelectedOptionIndex=Ce((i,o)=>i.indexOf(o)),this.getValueOptions=Ce(i=>[d("option",{value:"-1",children:Or.PLACEHOLDER},"-1"),...i.map((o,r)=>d("option",{value:r,children:o},`${r}/${o}`))]),this.getItemLabel=Ie((i,o)=>{const{name:r,type:l}=i[o];if(o>0&&i[o-1].name===r||o<i.length-1&&i[o+1].name===r){const a=l.substring(l.lastIndexOf(".")+1);return`${r} (${a})`}return r}),this.sendUpdate=Je(()=>{const{onChange:i}=this.props,{column:o,value:r,isValueShown:l}=this.state;i({column:o,isValueShown:l,value:r!=null?r:void 0})},WT),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=Y.createRef();const{column:e,isValueShown:n,value:s}=t;this.state={column:e,selectedColumn:e,disableCancel:!n,isValueShown:n,value:s}}componentDidUpdate(t,e){const{source:n,values:s,isLoaded:i}=this.props,{column:o,value:r,isValueShown:l}=this.state;i&&(n!==t.source&&this.sourceUpdated(),s!==t.values&&r!==""&&!s.includes(r)&&this.resetValue(),l!==e.isValueShown&&l&&this.focusInput(),(o!==e.column||r!==e.value||l!==e.isValueShown)&&this.sendUpdate())}componentWillUnmount(){this.sendUpdate.flush()}handleColumnChange(t){const{value:e}=t.target;if(So.debug2("handleColumnChange",e),e!=null&&parseInt(e,10)<0){this.setState({selectedColumn:null});return}const{columns:n,source:s}=this.props,i=this.getCompatibleColumns(s,n);this.setState({selectedColumn:i[parseInt(e,10)]})}handleDropdownKeyPress(t){t.key==="Enter"&&(t.preventDefault(),t.stopPropagation(),So.debug2("handleDropdownKeyPress"),this.sendUpdate(),this.sendUpdate.flush())}handleValueChange(t){const{value:e}=t.target,n=parseInt(e,10);let s="";const{values:i}=this.props;if(n===-1)So.debug2("Selected default item");else if(n>=0&&n<i.length)s=i[n];else{So.error("Invalid index",n,i);return}So.debug2("handleValueChange",s),this.setState({value:s})}handleSettingsCancel(){this.setState(({column:t})=>({selectedColumn:t,isValueShown:!0}))}handleSettingsSave(){this.setState(({column:t,selectedColumn:e,value:n})=>({column:e,value:t===e?n:"",isValueShown:!0,disableCancel:!1}))}handleSettingsClick(t){t.stopPropagation(),this.showSettings()}handleBackgroundClick(t){t.target!==this.dropdownRef.current&&this.focusInput()}handleMouseEnter(){const{onSourceMouseEnter:t}=this.props;t()}handleMouseLeave(){const{onSourceMouseLeave:t}=this.props;t()}sourceUpdated(){this.setState({column:null,selectedColumn:null,isValueShown:!1,disableCancel:!0,value:""})}showSettings(){const{column:t}=this.state;this.setState({selectedColumn:t,isValueShown:!1})}focusInput(){this.dropdownRef.current!==null&&this.dropdownRef.current.focus()}resetValue(){this.setState({value:""})}clearFilter(){this.resetValue()}setFilterState({name:t,type:e,value:n,isValueShown:s}){const i=t!=null&&e!=null?{name:t,type:e}:null;this.setState({column:i,value:n,isValueShown:s})}render(){var B;const{columns:t,disableLinking:e,isLinkerActive:n,isLoaded:s,source:i,onColumnSelected:o,onSourceMouseEnter:r,onSourceMouseLeave:l,values:a,settingsError:c}=this.props,{column:h,disableCancel:u,isValueShown:m,selectedColumn:p,value:g}=this.state,f=i===null,b=this.getCompatibleColumns(i,t),C=i!=null,v=(B=i==null?void 0:i.columnName)!=null?B:Or.SOURCE_BUTTON_PLACEHOLDER,T=h!=null?`${h.name} Filter`:null,[E,y]=this.getColumnOptions(b,p),I=this.getValueOptions(a),D=this.getSelectedOptionIndex(a,g),M=!C||p==null;return w(qa,{className:"dropdown-filter fill-parent-absolute",isFlipped:m&&!n,children:[d("div",{className:"dropdown-filter-settings-card",children:w("div",{className:"dropdown-filter-card-content",children:[w("div",{className:"dropdown-filter-settings-grid",children:[d("label",{children:"Source Column"}),d(pl,{isLinked:C,onClick:o,onMouseEnter:r,onMouseLeave:l,className:Or.SOURCE_BUTTON_CLASS_NAME,disabled:e,children:v}),d("div",{className:"text-muted small",children:"Select a source column for the list by linking to a table."}),d("label",{children:"Filter Column"}),d("select",{value:y,className:"custom-select",onChange:this.handleColumnChange,disabled:f,children:E}),d("div",{className:"text-muted small",children:"Dropdown filter control will apply its filter to all columns matching this name in this dashboard."})]}),c&&d("div",{className:"error-message text-center",children:c}),C&&w("div",{className:"dropdown-filter-settings-buttons",children:[d(ce,{kind:"secondary",type:"button",onClick:this.handleSettingsCancel,disabled:u||m||n,tooltip:n?"Cancel disabled while linker open":void 0,children:"Cancel"}),d(ce,{kind:"primary",type:"button",className:"ml-2",onClick:this.handleSettingsSave,disabled:M||m||n,tooltip:n?"Save disabled while linker open":void 0,children:"Save"})]})]})}),d("div",{className:"dropdown-filter-value-card",onClick:this.handleBackgroundClick,children:s&&w(ue,{children:[d("div",{className:"dropdown-filter-column",children:d("div",{className:"dropdown-filter-column-title",children:T})}),w("div",{className:"dropdown-filter-card-content",children:[d("div",{className:"dropdown-filter-value-input d-flex flex-column justify-content-center",children:d("select",{className:"custom-select",value:D,ref:this.dropdownRef,onChange:this.handleValueChange,onKeyPress:this.handleDropdownKeyPress,children:I})}),c&&d("div",{className:"error-message mt-3 text-center",children:c})]}),d("div",{className:"dropdown-filter-menu",children:d("button",{type:"button",className:"btn btn-link btn-link-icon m-2 px-2",onClick:this.handleSettingsClick,children:d(z,{icon:Wo,transform:"grow-4"})})})]})})]})}};let Xi=Or;Xi.defaultProps={column:null,disableLinking:!1,isLinkerActive:!1,isLoaded:!1,isValueShown:!1,settingsError:null,source:null,value:"",values:[],onColumnSelected:()=>{},onSourceMouseEnter:()=>{},onSourceMouseLeave:()=>{}};Xi.PLACEHOLDER="Select a value...";Xi.SOURCE_BUTTON_CLASS_NAME="btn-dropdown-filter-selector";Xi.SOURCE_BUTTON_PLACEHOLDER="Select a column";const ot=X.module("DropdownFilterPanel"),zT=250,ni=class extends S.exports.Component{constructor(t){super(t),this.getCachedValues=Ce((c,{type:h,name:u},m)=>h!==void 0&&P.isDateType(h)?c.map(p=>ni.DATETIME_FORMATTER.format(p)):c.map(p=>p!=null&&h!=null?m.getFormattedString(p,h,u):null)),this.getCachedPanelLinks=Ce((c,h)=>{const u=J.getIdFromPanel(h);return ot.debug("getCachedPanelLinks",c,u),c.filter(m=>{var p;return((p=m.end)==null?void 0:p.panelId)===u})}),this.getCachedSource=Ce(c=>{ot.debug("getCachedSource",c);let h=null;if(c.length>0){const[u]=c;h=u.start,c.length>1&&ot.error("Filter has more that one link",c)}return h}),this.getCachedSourceTable=Ce((c,h)=>{var m;if(ot.debug("getCachedSourceTable",c,h),h==null)return null;const{panelId:u}=h;return(m=c.get(u))!=null?m:null}),this.getCachedSourceColumn=Ce((c,h)=>{var u;return ot.debug("getCachedSourceColumn",c,h),c==null||h==null?null:(u=c.columns.find(({name:m,type:p})=>m===h.columnName&&p===h.columnType))!=null?u:null}),this.handleChange=Je(this.handleChange.bind(this),zT),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=Y.createRef(),this.panelContainer=Y.createRef(),this.pending=new gs;const{panelState:e,settings:n}=t;this.columnFormats=us.getColumnFormats(n);const{value:s="",isValueShown:i=!1,name:o,type:r,timestamp:l}=e!=null?e:{},a=o!=null&&r!=null?{name:o,type:r}:void 0;this.state={column:a,formatter:new pn(this.columnFormats),valuesTable:void 0,valuesColumn:void 0,sourceSize:0,value:s,timestamp:l,values:[],isValueShown:i,wasFlipped:!1,skipUpdate:!1,panelState:e,isDisconnected:!1,isLoading:!1,isLoaded:!1,error:null}}componentDidMount(){this.updateValuesTable();const{column:t,value:e,timestamp:n}=this.state,s=this.getSourceTable();if(s!==null&&this.startListeningToSource(s),t!=null){const{name:i,type:o}=t;this.sendUpdate(i,o,e,n)}}componentDidUpdate(t,e){const{valuesTable:n}=this.state,{settings:s}=this.props,i=this.getSource(),o=this.getSourceTable(),r=this.getSource(t),l=this.getSourceTable(t);s!==t.settings&&s!==void 0&&this.updateFormatterSettings(s),n!==e.valuesTable&&e.valuesTable!=null&&(ot.debug("Table in state modified, closing the old table."),e.valuesTable.close()),(o!==l||i!==r)&&this.updateValuesTable(),o!==l&&(l!==null&&this.stopListeningToSource(l),o!==null&&this.startListeningToSource(o))}componentWillUnmount(){const{valuesTable:t}=this.state,e=this.getSourceTable();this.pending.cancel(),e!==null&&this.stopListeningToSource(e),this.cleanup&&this.cleanup(),t!=null&&t.close()}getCoordinateForColumn(){var i;if(this.panelContainer.current==null)return null;const t=this.panelContainer.current.querySelector(`.${Xi.SOURCE_BUTTON_CLASS_NAME}`),e=(i=t==null?void 0:t.getBoundingClientRect())!=null?i:null;if(e==null||e.width<=0||e.height<=0)return null;const n=e.left+e.width/2,s=e.bottom;return[n,s]}getSettingsErrorMessage(){const{sourceSize:t}=this.state;if(t>ni.MAX_TABLE_SIZE)return`Table too large, must have fewer than ${ni.MAX_TABLE_SIZE} options.`}getPanelErrorMessage(){const{error:t}=this.state;return t!=null?`${t}`:void 0}getSource(t=this.props){const{dashboardLinks:e}=t,n=this.getCachedPanelLinks(e,this);return this.getCachedSource(n)}getSourceTable(t=this.props){const{panelTableMap:e}=t,n=this.getSource(t);return this.getCachedSourceTable(e,n)}getValuesColumn(t){const e=this.getSource();return this.getCachedSourceColumn(t,e)}startListeningToSource(t){ot.debug("startListeningToSource"),t.addEventListener(N.Table.EVENT_FILTERCHANGED,this.handleSourceFilterChange),t.addEventListener(N.Table.EVENT_SORTCHANGED,this.handleSourceSortChange),t.addEventListener(N.Table.EVENT_SIZECHANGED,this.handleSourceSizeChange),t.addEventListener(N.Table.EVENT_DISCONNECT,this.handleDisconnect),t.addEventListener(N.Table.EVENT_RECONNECT,this.handleReconnect)}stopListeningToSource(t){ot.debug("stopListeningToSource"),t.removeEventListener(N.Table.EVENT_FILTERCHANGED,this.handleSourceFilterChange),t.removeEventListener(N.Table.EVENT_SORTCHANGED,this.handleSourceSortChange),t.removeEventListener(N.Table.EVENT_SIZECHANGED,this.handleSourceSizeChange),t.removeEventListener(N.Table.EVENT_DISCONNECT,this.handleDisconnect),t.removeEventListener(N.Table.EVENT_RECONNECT,this.handleReconnect)}handleChange({column:t,isValueShown:e,value:n}){const{name:s=void 0,type:i=void 0}=t!=null?t:{};let o=!0,r=Date.now();this.setState(({panelState:l,timestamp:a,wasFlipped:c,skipUpdate:h})=>{var m;const u=l!=null&&e!==l.isValueShown&&s===l.name&&i===l.type&&n===l.value;return o=(m=!h&&e&&(!u||!c))!=null?m:!1,o||(r=a),{panelState:{isValueShown:e,name:s,type:i,value:n,timestamp:r!=null?r:void 0},timestamp:r,wasFlipped:u,skipUpdate:!1}},()=>{o&&this.sendUpdate(s!=null?s:null,i,n,r)})}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:t}){this.setState({sourceSize:t})}handleColumnSelected(){ot.debug("handleColumnSelected");const{glEventHub:t}=this.props;t.emit(Ue.COLUMN_SELECTED,this,ni.SOURCE_COLUMN)}handleClearAllFilters(){var t,e;(e=(t=this.dropdownFilterRef)==null?void 0:t.current)==null||e.clearFilter()}setPanelState(t,e=!1){var n,s;if(this.getSource()==null){ot.debug("Ignore state update for unlinked filter",t);return}this.setState({skipUpdate:!e}),(s=(n=this.dropdownFilterRef)==null?void 0:n.current)==null||s.setFilterState(t)}sendUpdate(t,e,n,s){var l;const{glEventHub:i}=this.props,o=(l=this.getSource())==null?void 0:l.panelId,r=o===null?[]:[o];ot.debug("sendUpdate",{name:t,type:e,value:n,timestamp:s,excludePanelIds:r}),i.emit(Ue.FILTERS_CHANGED,this,{name:t,type:e,value:n!=null?n:"=null",timestamp:s,excludePanelIds:r})}updateValuesTable(){const t=this.getSource(),e=this.getSourceTable();if(ot.debug("updateValuesTable",t,e),this.setState({values:[],valuesTable:void 0,error:null}),t==null){ot.debug("Filter unlinked."),this.setState({isLoading:!1,isLoaded:!0,isValueShown:!1,sourceSize:0});return}this.setState({isLoading:!0}),e!=null&&(this.setState({isLoaded:!1,sourceSize:e.size}),this.pending.add(e.copy(),n=>n.close()).then(n=>{this.updateViewportListener(n),this.setState({valuesTable:n})}).catch(n=>{Re.isCanceled(n)||(ot.error(n),this.setState({isLoading:!1,error:n}))}))}applySourceSorts(){const{valuesTable:t}=this.state,e=this.getSourceTable();if(ot.debug("applySourceSorts",e.sort),t==null){ot.debug("Table not initialized");return}const n=[...e.sort];t.applySort(n),this.setViewport(t)}applySourceFilters(){const{valuesTable:t}=this.state,e=this.getSourceTable();if(ot.debug("applySourceFilters",e.filter),t==null){ot.debug("Table not initialized");return}const n=[...e.filter];t.applyFilter(n),this.setViewport(t)}updateViewportListener(t){if(ot.debug("updateViewportListener",t==null?void 0:t.size),this.cleanup&&this.cleanup(),t==null){this.cleanup=void 0;return}this.cleanup=t.addEventListener(N.Table.EVENT_UPDATED,this.handleValuesTableUpdate),this.setViewport(t)}setViewport(t){const e=this.getValuesColumn(t);if(!e){ot.error("values column is null");return}t.setViewport(0,ni.MAX_TABLE_SIZE-1,[e])}updateFormatterSettings(t){const e=us.getColumnFormats(t);pt(this.columnFormats,e)||(this.columnFormats=e,this.setState({formatter:new pn(e)}))}handleValuesTableUpdate({detail:t}){const{rows:e}=t,{valuesTable:n}=this.state;if(!n){ot.error("valuesTable is null");return}const s=this.getValuesColumn(n);if(!s){ot.error("Values column not found");return}const i=e.map(o=>o.get(s));this.setState({values:i,isLoading:!1,isLoaded:!0,valuesColumn:s})}handleSourceMouseEnter(){const{columnSelectionValidator:t}=this.props;!t||t(this,ni.SOURCE_COLUMN)}handleSourceMouseLeave(){const{columnSelectionValidator:t}=this.props;!t||t(this,void 0)}render(){const{columns:t,disableLinking:e,glContainer:n,glEventHub:s,isLinkerActive:i}=this.props,{column:o,formatter:r,isDisconnected:l,isValueShown:a,value:c,values:h,valuesColumn:u,isLoading:m,isLoaded:p}=this.state,g=this.getSource(),f=this.getSettingsErrorMessage(),b=this.getPanelErrorMessage(),C=p&&u!=null?this.getCachedValues(h,u,r):[];return d(Ll,{errorMessage:b,isLoading:m,isLoaded:p,isDisconnected:l,className:"iris-dropdown-filter-panel",componentPanel:this,glContainer:n,glEventHub:s,onClearAllFilters:this.handleClearAllFilters,widgetName:"Dropdown Filter",widgetType:"DropdownFilter",children:d("div",{ref:this.panelContainer,className:"dropdown-filter-container h-100 w-100 container",children:d(Xi,{ref:this.dropdownFilterRef,column:o,columns:t,isValueShown:a,isLinkerActive:i,disableLinking:e,isLoaded:p,settingsError:f,source:g,value:c,values:C,onChange:this.handleChange,onColumnSelected:this.handleColumnSelected,onSourceMouseEnter:this.handleSourceMouseEnter,onSourceMouseLeave:this.handleSourceMouseLeave})})})}};let lo=ni;lo.displayName="DropdownFilterPanel";lo.COMPONENT="DropdownFilterPanel";lo.MAX_TABLE_SIZE=256;lo.DATETIME_FORMATTER=new ht({showTimeZone:!1,showTSeparator:!0,defaultDateTimeFormatString:"yyyy-MM-dd HH:mm:ss.SSSSSSSSS"});lo.SOURCE_COLUMN=Object.freeze({name:"FilterSource",type:null});const GT=(t,e)=>{const{localDashboardId:n}=e,s=J.getIdFromPanel({props:e}),i=kc(t,n),o=ro(t,n),r=vl(t),l=Oc(t,n),a=r===mn.LINKER&&(l===void 0||l===s),c=r===mn.LINKER&&l!==void 0&&l!==s;return{columns:ep(t,n),columnSelectionValidator:Ac(t,n),isLinkerActive:a,disableLinking:c,settings:Xt(t),panelTableMap:i,dashboardLinks:o}},di=xt(GT,null,null,{forwardRef:!0})(lo);function Kn(t){return t.type==="directory"}var ip=(t=>(t.GROOVY="text/x-groovy",t.PLAIN_TEXT="text/plain",t.PYTHON="text/x-python",t.PYTHON_COMPILED="application/x-python-code",t.SCALA="text/x-scala",t.UNKNOWN="",t))(ip||{});class he{static fileExtensionToString(e=""){return e.length===0?"":`.${e}`}static getDepth(e){var s;if(!he.hasPath(e))throw new Error(`Invalid path provided: ${e}`);return((s=e.match(/\//g))!=null?s:[]).length-1}static getExtension(e){var s;const n=this.getBaseName(e).split(".");return n.length>1&&(s=n.pop())!=null?s:""}static getBaseName(e){var n;return(n=e.split("/").pop())!=null?n:""}static getCopyFileName(e){const n=e.lastIndexOf(".");let s=null,i=null;n<0?i=e:(i=e.substring(0,n),s=e.substring(n+1));const o=i?`${i}-copy`:"Copy";return s!==null?`${o}.${s}`:o}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(!he.hasPath(e))throw new Error(`Invalid name provided: ${e}`);const n=e.split("/");for(;n.pop()==="";);if(n.length===0)throw new Error(`No parent for path provided: ${e}`);return`${n.join("/")}/`}static getPath(e){if(!he.hasPath(e))throw new Error(`Invalid filename provided: ${e}`);const n=e.split("/");return n.pop(),`${n.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,n=""){const s=e.lastIndexOf("."),i=s>-1?e.substring(0,s):e,o=he.fileExtensionToString(n);return`${i}${o}`}static validateName(e){var o;const n=[".",".."],s=/[\\/\0]/g,i=new Map([["\0","null"]]);if(!e)throw new Ui("Name cannot be empty");if(n.includes(e))throw new Ui(`"${e}" is a reserved name`);if(s.test(e))throw new Ui(`Invalid characters in name: "${((o=e.match(s))!=null?o:[]).reduce((r,l)=>r.includes(l)?r:[...r,l],[]).map(r=>i.has(r)?i.get(r):r).join('", "')}"`)}static reducePaths(e){const n=e.filter(s=>he.isPath(s));return e.filter(s=>!n.some(i=>s!==i&&s.startsWith(i)))}static removeRoot(e,n){if(e.length===0)return n;if(!n.startsWith(e))throw new Error(`Filename ${n} does not start with expected root ${e}`);return n.substring(e.length)}static addRoot(e,n){return`${e}${n}`}}const kt=X.module("FileList"),xa=t=>Kn(t)?he.makePath(t.filename):he.getPath(t.filename),Uc=26,KT=500,mh="item-list-scroll-pane",_a=t=>{var I;const{children:e,draggedItems:n,isDragInProgress:s,isDropTargetValid:i,isSelected:o,item:r,itemIndex:l,dropTargetItem:a,onDragStart:c,onDragOver:h,onDragEnd:u,onDrop:m}=t,p=(I=n==null?void 0:n.some(D=>D.id===r.id))!=null?I:!1,g=xa(r),f=s&&a?xa(a):null,b=s&&i&&Kn(r)&&f===g,C=s&&i&&f===g,v=s&&!i&&f===g,T=qT(r),E=he.getDepth(r.filename),y=Array(E).fill(null).map((D,M)=>d("span",{className:"file-list-depth-line"},M));return w("div",{className:W("d-flex w-100 align-items-center","file-list-item",{"is-dragged":p,"is-exact-drop-target":b,"is-in-drop-target":C,"is-invalid-drop-target":v,"is-selected":o}),onDragStart:D=>c(l,D),onDragOver:D=>h(l,D),onDragEnd:D=>u(l,D),onDrop:D=>m(l,D),draggable:!0,role:"presentation","aria-label":r.basename,children:[y," ",d(z,{icon:T,className:"item-icon",fixedWidth:!0})," ",w("span",{className:"truncation-wrapper",children:[e!=null?e:r.basename,d(pe,{options:{modifiers:{preventOverflow:{boundariesElement:"window"}},placement:"left"},children:e!=null?e:r.basename})]})]})};function qT(t){if(Kn(t))return t.isExpanded?Qg:Zg;switch(he.getMimeType(t.basename)){case ip.PYTHON:return xf;default:return Yg}}function ph(t,e){if(t.length===0||e==null)throw new Error("No items to move");const n=xa(e);if(t.some(({filename:s})=>he.getPath(s)===n))throw new Error("File already in the destination folder");if(t.some(s=>Kn(s)&&n.startsWith(he.makePath(s.filename))))throw new Error("Destination folder cannot be a child of a dragged folder");return{files:t,targetPath:n}}const YT=t=>{const{isMultiSelect:e=!1,table:n,onFocusChange:s=()=>{},onMove:i,onSelect:o,onSelectionChange:r=()=>{},renderItem:l=_a,rowHeight:a=Uc,overscanCount:c=vn.DEFAULT_OVERSCAN}=t,[h,u]=S.exports.useState(()=>({items:[],offset:0,itemCount:0})),[m,p]=S.exports.useState({top:0,bottom:0}),[g,f]=S.exports.useState(),[b,C]=S.exports.useState(),[v,T]=S.exports.useState(),[E,y]=S.exports.useState([]),I=S.exports.useRef(null),D=S.exports.useRef(null),M=S.exports.useCallback(Z=>{if(Z.length===0||h==null)return[];const ge=[];for(let be=0;be<Z.length;be+=1){const Le=Z[be];for(let Oe=Le[0];Oe<=Le[1];Oe+=1)Oe>=h.offset&&Oe<h.offset+h.items.length&&ge.push(h.items[Oe-h.offset])}return ge},[h]),x=S.exports.useCallback(Z=>{const ge=M([[Z,Z]]);if(ge.length>0)return ge[0]},[M]),B=S.exports.useCallback(()=>{const Z=Sn.count(E);if(Z===0)return null;if(Z===1){const ge=E[0][0],be=x(ge);if(be!=null)return be.filename}return`${Z} items`},[x,E]),$=S.exports.useCallback(Z=>{var ge;if(!(!b||!g)){kt.debug("dropItems",b,"to",Z);try{const{files:be,targetPath:Le}=ph(b,g);i(be,Le),Z!=null&&(y([[Z,Z]]),(ge=I.current)==null||ge.focusItem(Z))}catch(be){kt.error("Unable to complete move",be)}}},[b,g,i]),k=S.exports.useCallback((Z,ge)=>{const be=h.items[Z-h.offset];be!==void 0&&(kt.debug("handleItemClick",be),o(be,ge),Kn(be)&&(n==null||n.setExpanded(be.filename,!be.isExpanded)))},[h,o,n]),H=S.exports.useCallback((Z,ge)=>{var Oe;kt.debug2("handleItemDragStart",Z,E);let be=E;Sn.isSelected(E,Z)||(be=[[Z,Z]],y(be)),C(M(be)),(Oe=I.current)==null||Oe.resetMouseState();const Le=document.createElement("div");Le.innerHTML=`<div class="dnd-placeholder-content">${B()}</div>`,Le.className="file-list-dnd-placeholder",document.body.appendChild(Le),ge.dataTransfer.setDragImage(Le,0,0),ge.dataTransfer.effectAllowed="move",T(Le)},[B,M,E]),O=S.exports.useCallback((Z,ge)=>{ge.preventDefault(),kt.debug2("handleItemDragOver",ge),f(x(Z))},[x]),F=S.exports.useCallback((Z,ge)=>{kt.debug("handleItemDragEnd",Z),v==null||v.remove(),C(void 0),f(void 0),T(void 0)},[v]),_=S.exports.useCallback((Z,ge)=>{$(Z)},[$]),L=S.exports.useCallback(()=>{kt.debug2("handleItemDragExit"),f(void 0)},[]),V=S.exports.useCallback(Z=>{Z.target instanceof Element&&Z.target.classList.contains(mh)&&(Z.preventDefault(),kt.debug2("handleListDragOver",Z),f({type:"directory",filename:"/",basename:"/",id:"/"}))},[]),G=S.exports.useCallback(Z=>{Z.target instanceof Element&&Z.target.classList.contains(mh)&&(kt.debug("handleListDrop"),$())},[$]),j=S.exports.useCallback(Z=>{if(kt.debug2("handleSelectionChange",Z),Z!==E){y(Z);const ge=M(Z);r(ge)}},[M,r,E]),ne=S.exports.useCallback(Z=>{if(kt.debug2("handleFocusChange",Z),Z!=null){const[ge]=M([[Z,Z]]);s(ge)}else s()},[M,s]),ye=S.exports.useCallback((Z,ge)=>{kt.debug("handleViewportChange",Z,ge),(Z!==m.top||ge!==m.bottom)&&p({top:Z,bottom:ge})},[m]),le=S.exports.useMemo(()=>{if(!b||!g)return!1;try{return ph(b,g),kt.debug("handleValidateDropTarget true"),!0}catch{return kt.debug("handleValidateDropTarget false"),!1}},[b,g]),{focusedPath:Te}=t;S.exports.useEffect(()=>{Te!==void 0&&(Te==="/"?n.collapseAll():(n.setExpanded(Te,!1),n.setExpanded(Te,!0)))},[n,Te]),S.exports.useEffect(function(){kt.debug("updating table viewport",m),n==null||n.setViewport({top:Math.max(0,m.top-c),bottom:m.bottom+c})},[c,n,m]),S.exports.useEffect(function(){const ge=n.onUpdate(be=>{u({items:be.items.map(Le=>({...Le,itemName:Le.basename})),offset:be.offset,itemCount:n.size})});return()=>{ge()}},[n]),S.exports.useEffect(function(){if(g!=null&&Kn(g)&&g.filename!=="/"){const ge=setTimeout(()=>{g.isExpanded||n==null||n.setExpanded(g.filename,!0)},KT);return()=>clearTimeout(ge)}},[g,n]);const He=S.exports.useCallback(Z=>l({...Z,isDragInProgress:b!=null,dropTargetItem:g,draggedItems:b,isDropTargetValid:le,onDragStart:H,onDragEnd:F,onDragOver:O,onDragExit:L,onDrop:_}),[F,L,O,H,_,b,g,le,l]);return d("div",{ref:D,className:W("file-list",{"is-dragging":b!=null}),onDragOver:V,onDrop:G,children:d(vn,{ref:I,items:h.items,itemCount:h.itemCount,offset:h.offset,onFocusChange:ne,onSelect:k,onSelectionChange:j,onViewportChange:ye,selectedRanges:E,renderItem:He,rowHeight:a,isMultiSelect:e,isDragSelect:!1,isDeselectOnClick:!1})})};const XT={name:"File Explorer",DELETE:ze.createAndAdd({id:"FILE_EXPLORER.DELETE",name:"Delete",shortcut:[fe.DELETE],macShortcut:[me.CMD,fe.BACKSPACE]}),RENAME:ze.createAndAdd({id:"FILE_EXPLORER.RENAME",name:"Rename",shortcut:[fe.ENTER],macShortcut:[fe.ENTER]})},gh={FILE_EXPLORER:XT};const fh=X.module("FileListItemEditor"),jT=({item:t,onCancel:e,onSubmit:n,validate:s=()=>Promise.resolve()})=>{const i=S.exports.useRef(null),[o,r]=S.exports.useState(t.basename),[l,a]=S.exports.useState(),[c,h]=S.exports.useState(Promise.resolve()),u=S.exports.useCallback(()=>{var C;(C=i.current)==null||C.focus()},[i]),m=S.exports.useCallback(C=>C.stopPropagation(),[]),p=S.exports.useCallback(()=>{c.then(()=>{n(o)}).catch(C=>fh.info("Unable to validate name",C))},[n,o,c]);S.exports.useEffect(function(){const v=Re.makeCancelable(s(o));return v.then(()=>a(void 0)).catch(T=>{Re.isCanceled(T)||a(T)}),h(v),()=>v.cancel()},[s,o]),S.exports.useEffect(function(){u()},[u]);const g=S.exports.useCallback(()=>{fh.debug2("handleBlur"),p()},[p]),f=S.exports.useCallback(C=>{const{value:v}=C.target;r(v)},[]),b=S.exports.useCallback(C=>{C.stopPropagation();const{key:v}=C;switch(v){case"Enter":{p();break}case"Escape":{e();break}}},[e,p]);return w("div",{className:"file-list-item-editor",children:[d("input",{type:"text",className:W("form-control file-list-item-editor-input",{"is-invalid":l}),value:o,ref:i,onBlur:g,onKeyDown:b,onChange:f,onClick:m,onDoubleClick:m,onMouseDown:m}),l&&d("div",{className:"invalid-feedback",children:`${l}`})]})},op=t=>{const{isMultiSelect:e=!1,focusedPath:n,showContextMenu:s=!1,onCreateFile:i,onCreateFolder:o,onCopy:r,onDelete:l,onMove:a=()=>{},onRename:c,onSelect:h,onSelectionChange:u,table:m,rowHeight:p=Uc,validateRename:g=()=>Promise.resolve()}=t,[f,b]=S.exports.useState(),[C,v]=S.exports.useState([]),[T,E]=S.exports.useState(),y=S.exports.useCallback(L=>{v(L),u==null||u(L)},[u]),I=S.exports.useCallback(L=>{E(L)},[]),D=S.exports.useCallback(()=>{T&&(r==null||r(T))},[T,r]),M=S.exports.useCallback(()=>{C.length>0&&(l==null||l(C))},[l,C]),x=S.exports.useCallback(()=>{i==null||i()},[i]),B=S.exports.useCallback(()=>{T&&(o==null||o(he.getPath(T.filename)))},[T,o]),$=S.exports.useCallback(()=>{T&&b(T)},[T]),k=S.exports.useCallback(()=>{b(void 0)},[]),H=S.exports.useCallback(L=>{f&&(c==null||c(f,L),b(void 0))},[c,f]),O=S.exports.useMemo(()=>{if(f)return[];const L=[];return i&&L.push({title:"New File",description:"Create new file",action:x,group:ie.groups.medium}),o&&L.push({title:"New Folder",description:"Create new folder",action:B,group:ie.groups.medium}),r&&L.push({title:"Copy",description:"Copy",action:D,group:ie.groups.low,disabled:T==null||Kn(T)}),l&&C.length>0&&L.push({title:"Delete",description:"Delete",shortcut:gh.FILE_EXPLORER.DELETE,action:M,group:ie.groups.low}),c&&L.push({title:"Rename",description:"Rename",shortcut:gh.FILE_EXPLORER.RENAME,action:$,group:ie.groups.low,disabled:T==null}),L},[D,M,x,B,$,T,r,i,o,l,c,C,f]),F=S.exports.useCallback(L=>f?g(f,L):Promise.reject(new Error("No rename item")),[f,g]),_=S.exports.useCallback(L=>{const{item:V}=L;return f&&f.filename===V.filename?_a({...L,children:d(jT,{item:V,validate:F,onSubmit:H,onCancel:k})}):_a(L)},[k,H,f,F]);return w("div",{className:"file-list-container",children:[m!=null&&d(YT,{onMove:a,onSelect:h,onSelectionChange:y,onFocusChange:I,renderItem:_,rowHeight:p,table:m,isMultiSelect:e,focusedPath:n}),s&&d(ie,{actions:O})]})};op.displayName="FileListContainer";class Ar extends Ui{constructor(e){super("Name already exists"),this.isExistingFile=!0,this.info=e}}class Bc extends Error{constructor(){super("No file exists at the path specified"),this.isFileNotFound=!0}}const Ks=X.module("FileExplorer"),$c=t=>{const{storage:e,isMultiSelect:n=!1,focusedPath:s,onDelete:i=()=>{},onRename:o=()=>{},onSelect:r,onSelectionChange:l,rowHeight:a=Uc}=t,[c,h]=S.exports.useState([]),[u,m]=S.exports.useState();S.exports.useEffect(function(){let D;async function M(){Ks.debug("initTable"),D=Re.makeCancelable(e.getTable(),x=>x.close());try{m(await D)}catch(x){Re.isCanceled(x)||Ks.error("Unable to initialize table",x)}}return M(),()=>{D.cancel()}},[e]);const p=S.exports.useCallback(I=>{Re.isCanceled(I)||Ks.error(I)},[]),g=S.exports.useCallback(I=>{Ks.debug("handleDelete, pending confirmation",I),h(I)},[]),f=S.exports.useCallback(()=>{Ks.debug("handleDeleteConfirm",c),c.forEach(I=>e.deleteFile(Kn(I)?he.makePath(I.filename):I.filename)),i(c),h([])},[c,i,e]),b=S.exports.useCallback(()=>{Ks.debug("handleDeleteCancel"),h([])},[]),C=S.exports.useCallback((I,D)=>{he.reducePaths(I.map(x=>Kn(x)?he.makePath(x.filename):x.filename)).forEach(x=>{const B=he.isPath(x)?`${D}${he.getBaseName(x.substring(0,x.length-1))}/`:`${D}${he.getBaseName(x)}`;e.moveFile(x,B).then(()=>{o(x,B)}).catch(p)})},[p,o,e]),v=S.exports.useCallback((I,D)=>{let M=I.filename;const x=Kn(I);x&&!M.endsWith("/")&&(M=`${M}/`);let B=`${he.getParent(M)}${D}`;x&&!B.endsWith("/")&&(B=`${B}/`),Ks.debug2("handleRename",M,B),e.moveFile(M,B).catch(p),o(M,B)},[p,o,e]),T=S.exports.useCallback(async(I,D)=>{if(D===I.basename)return;he.validateName(D);const M=`${he.getPath(I.filename)}${D}`;try{const x=await e.info(M);throw new Ar(x)}catch(x){if(!(x instanceof Bc))throw x}},[e]),E=c.length>0,y=S.exports.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 w("div",{className:"file-explorer",children:[u&&d(op,{isMultiSelect:n,focusedPath:s,showContextMenu:!0,onMove:C,onDelete:g,onRename:v,onSelect:r,onSelectionChange:l,rowHeight:a,table:u,validateRename:T}),d(Wi,{isOpen:E,headerText:y,bodyText:"You cannot undo this action.",onCancel:b,onConfirm:f,confirmButtonText:"Delete"})]})};$c.displayName="FileExplorer";const qs=X.module("NewItemModal"),Pr=class extends S.exports.PureComponent{constructor(t){super(t),this.inputRef=Y.createRef(),this.pending=new gs,this.pathMap=new Map,this.isInitialLoad=!0,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:e}=t,n=he.hasPath(e)?he.getPath(e):"/";this.state={isSubmitting:!1,path:n,prevExtension:he.getExtension(e),showExtensionChangeModal:!1,showOverwriteModal:!1,value:he.getBaseName(e)}}static getValidationMessage(t){return t instanceof Ar&&t.info.type==="directory"?"Error: Cannot overwrite existing directory":`${t}`}static handleError(t){Re.isCanceled(t)||qs.error(t)}componentDidUpdate(t,e){const{isOpen:n}=this.props,{isOpen:s}=t,{value:i,path:o}=this.state;!s&&n&&(this.resetValue(),this.isInitialLoad=!0),s&&n&&(!this.isInitialLoad&&(o!==e.path||i!==e.value)&&this.updateValidationStatus(o,i),this.isInitialLoad=!1)}componentWillUnmount(){this.pending.cancel(),this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableExistingItemPromise&&this.cancelableExistingItemPromise.cancel()}resetValue(){const{defaultValue:t}=this.props,e=he.hasPath(t)?he.getPath(t):"/";this.setState({path:e,value:he.getBaseName(t),validationError:void 0,prevExtension:he.getExtension(t),isSubmitting:!1})}getValidationPromise(t,e,n=!1){return this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableValidatePromise=Re.makeCancelable(this.validateName(t,e,n)),this.cancelableValidatePromise}async validateName(t,e,n){he.validateName(e);const{defaultValue:s,storage:i}=this.props;if(n){const o=`${t}${e}`;if(o!==s)try{const r=await i.info(o);throw new Ar(r)}catch(r){if(!(r instanceof Bc))throw r}}return e}updateValidationStatus(t,e){this.getValidationPromise(t,e).then(()=>{this.setState({validationError:void 0})}).catch(this.handleValidationError).catch(Pr.handleError)}handleModalOpened(){this.focusRenameInput()}handleModalSubmit(){this.submitModal()}handleChange(t){const{value:e}=t.target;this.setState({value:e})}handleSelect(t){if(qs.debug("handleSelect",t),t.type==="directory")this.setState({path:he.makePath(t.filename)});else{const e=t.basename,n=he.getPath(t.filename);this.setState({value:e,path:n},()=>{this.focusRenameInput()})}}handleKeyDown(t){const{key:e}=t;switch(t.stopPropagation(),e){case"Enter":{t.preventDefault(),this.submitModal();break}case"Escape":{t.preventDefault();const{onCancel:n}=this.props;n();break}}}handleValidationError(t){if(!(t instanceof Ui))throw t;qs.debug("Validation error",t),this.setState({validationError:t})}handleOverwriteCancel(){this.setState({showOverwriteModal:!1,isSubmitting:!1})}handleOverwriteConfirm(){this.setState({showOverwriteModal:!1});const{onSubmit:t}=this.props,{path:e,value:n}=this.state;qs.debug("handleOverwriteConfirm",e,n),t(`${e}${n}`)}handleExtensionChangeCancel(){qs.debug("handleExtensionChangeCancel"),this.setState(({value:t,prevExtension:e})=>{const n=he.replaceExtension(t,e);return{showExtensionChangeModal:!1,value:n}}),this.submitModal(!0)}handleExtensionChangeConfirm(){qs.debug("handleExtensionChangeConfirm"),this.setState({showExtensionChangeModal:!1}),this.submitModal(!0)}focusRenameInput(){const t=this.inputRef.current;if(t){const{type:e}=this.props,{value:n}=t,s=e==="directory"?n.length:n.lastIndexOf(".");t.focus(),t.setSelectionRange(0,s>0?s:n.length)}}submitModal(t=!1){this.setState(({prevExtension:e,value:n,path:s})=>{const{notifyOnExtensionChange:i,type:o}=this.props;qs.debug("submitModal",e,n);const r=he.getExtension(n);return i&&!t&&e!==null&&e!==r?{isSubmitting:!1,showExtensionChangeModal:!0,newExtension:r}:(this.getValidationPromise(s,n,!0).then(l=>{const{onSubmit:a}=this.props;a(`${s}${n}`)}).catch(l=>{if(l instanceof Ar&&o!=="directory"&&l.info.type!=="directory"){this.setState({showOverwriteModal:!0});return}throw l}).catch(l=>{throw Re.isCanceled(l)&&this.setState({isSubmitting:!1}),l}).catch(this.handleValidationError).catch(Pr.handleError),{isSubmitting:!0,showExtensionChangeModal:!1,newExtension:void 0})})}handleBreadcrumbSelect(t){this.setState({path:t})}renderPathButtons(t){const e=t.split("/");return e.pop(),e.map((n,s)=>{let i="";for(let o=0;o<s;o+=1)i+=`${e[o]}/`;return i+=`${n}/`,w(Y.Fragment,{children:[d(ce,{kind:"ghost",className:"directory-breadcrumbs",onClick:()=>this.handleBreadcrumbSelect(i),"aria-label":s===0?"Home":void 0,icon:s===0?d(z,{icon:Jg,transform:"right-1.6"}):void 0,tooltip:s===0?"Home":void 0,children:n}),"/"]},i)})}render(){const{storage:t,isOpen:e,onCancel:n,placeholder:s,title:i,type:o}=this.props,{isSubmitting:r,path:l,showExtensionChangeModal:a,showOverwriteModal:c,validationError:h,value:u,prevExtension:m,newExtension:p}=this.state,g=o==="directory",f=he.fileExtensionToString(m),b=he.fileExtensionToString(p),C=g?"Create":"Save",v=g?"New folder name":"Save file as";return w(ue,{children:[w(Vo,{isOpen:e,toggle:n,onOpened:this.handleModalOpened,className:"modal-dialog-centered new-file-modal theme-bg-dark",children:[d(Bo,{toggle:n,children:i}),d(Uo,{children:d("form",{children:w("div",{className:"d-flex flex-column new-file-modal-content",children:[w("div",{className:"flex-grow-0 mb-4",children:[d("label",{htmlFor:"file-name-input",children:v}),d("input",{id:"file-name-input",type:"text",autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:"false",className:W("form-control",{"is-invalid":h}),value:u,placeholder:s,ref:this.inputRef,onKeyDown:this.handleKeyDown,onChange:this.handleChange}),h&&d("div",{className:"invalid-feedback",children:Pr.getValidationMessage(h)})]}),w("div",{className:"flex-grow-0",children:[d("label",{children:"Directory: /"}),this.renderPathButtons(l)]}),d("div",{className:"flex-grow-1 file-explorer-container",children:d($c,{onSelect:this.handleSelect,storage:t,focusedPath:l})})]})})}),w(Ka,{children:[d(ce,{kind:"secondary",onClick:n,children:"Cancel"}),d(ce,{kind:"primary",disabled:r,onClick:this.handleModalSubmit,children:C})]})]}),d(Wi,{isOpen:c,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"}),d(Wi,{isOpen:a,headerText:"Confirm extension change",bodyText:`Are you sure you want to change extension from "${f}" to "${b}"?`,onCancel:this.handleExtensionChangeCancel,onConfirm:this.handleExtensionChangeConfirm,cancelButtonText:`Keep "${f}"`,confirmButtonText:`Use "${b}"`})]})}};let Al=Pr;Al.propTypes={isOpen:R.exports.bool,title:R.exports.string.isRequired,defaultValue:R.exports.string,type:R.exports.oneOf(["file","directory"]).isRequired,onSubmit:R.exports.func,onCancel:R.exports.func,placeholder:R.exports.string,storage:R.exports.shape({}).isRequired,notifyOnExtensionChange:R.exports.bool};Al.defaultProps={isOpen:!1,defaultValue:"/",notifyOnExtensionChange:!1,placeholder:"",onSubmit:t=>{},onCancel:()=>{}};const QT=({createFile:t,createFolder:e,onSearchChange:n,defaultSearchText:s=""})=>w("div",{className:"file-explorer-toolbar",children:[w("div",{className:"file-explorer-toolbar-buttons",children:[d(ce,{kind:"ghost",icon:Qh,tooltip:"New notebook",onClick:t,"aria-label":"New notebook"}),d(ce,{kind:"ghost",icon:af,tooltip:"New folder",onClick:e,"aria-label":"New folder"})]}),n&&d("div",{className:"file-explorer-toolbar-search",children:d(Cu,{value:s,onChange:n,placeholder:"Search by name"})})]});const Mi=X.module("FileExplorerPanel"),ZT=(t,e)=>{const n=Xu(t),s=Ci(t,e.localDashboardId),{session:i,config:o}=s!=null?s:{},r=o==null?void 0:o.type;return{fileStorage:n,language:r,session:i}},JT=xt(ZT,null,null,{forwardRef:!0});function eE(t){const e=t;return e!=null&&typeof e.button=="number"}const La=class extends Y.Component{static handleError(t){Mi.error(t)}static isFocusEvent(t){return eE(t)?t.detail>=2:!0}constructor(t){super(t),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:e,language:n}=t;this.state={isShown:!1,language:n,session:e,showCreateFolder:!1,focusedFilePath:"/"}}componentDidMount(){this.isHidden()||this.setState({isShown:!0})}handleCreateFile(){const{glEventHub:t}=this.props,{session:e,language:n}=this.state,s={language:n,value:""};Mi.debug("handleCreateFile",e,n,s),t.emit(Be.CREATE_NOTEBOOK,e,n,s)}handleCreateDirectory(t){this.setState({showCreateFolder:!0})}handleCreateDirectoryCancel(){Mi.debug("handleCreateDirectoryCancel"),this.setState({showCreateFolder:!1})}handleCreateDirectorySubmit(t){Mi.debug("handleCreateDirectorySubmit",t),this.setState({showCreateFolder:!1});const{fileStorage:e}=this.props;e.createDirectory(t).catch(La.handleError)}handleDelete(t){const{glEventHub:e}=this.props;t.forEach(n=>{e.emit(Be.CLOSE_FILE,{id:n.filename,itemName:n.filename})})}handleSelectionChange(t){let e="/";t.length===1&&(t[0].type==="directory"?e=he.makePath(t[0].filename):e=he.getPath(t[0].filename)),this.setState({focusedFilePath:e})}handleFileSelect(t,e){if(Mi.debug("fileSelect",t),t.type==="directory")return;const n=La.isFocusEvent(e),s={id:t.filename,itemName:t.filename},{glEventHub:i}=this.props,{session:o,language:r}=this.state,l={value:null,language:r};i.emit(Be.SELECT_NOTEBOOK,o,r,l,s,n)}handleRename(t,e){const{glEventHub:n}=this.props;Mi.debug("handleRename",t,e),n.emit(Be.RENAME_FILE,t,e)}handleSessionOpened(t,{language:e}){this.setState({session:t,language:e})}handleSessionClosed(){this.setState({session:void 0,language:void 0})}handleShow(){this.setState({isShown:!0})}isHidden(){const{glContainer:t}=this.props,{isHidden:e}=t;return e}render(){const{fileStorage:t,glContainer:e,glEventHub:n}=this.props,{isShown:s,showCreateFolder:i,focusedFilePath:o}=this.state;return w(Xn,{className:"file-explorer-panel",componentPanel:this,glContainer:e,glEventHub:n,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[d(QT,{createFile:this.handleCreateFile,createFolder:this.handleCreateDirectory}),s&&d($c,{isMultiSelect:!0,storage:t,onDelete:this.handleDelete,onRename:this.handleRename,onSelect:this.handleFileSelect,onSelectionChange:this.handleSelectionChange}),d(Al,{isOpen:i,type:"directory",title:"Create New Folder",storage:t,onSubmit:this.handleCreateDirectorySubmit,onCancel:this.handleCreateDirectoryCancel,defaultValue:o})]})}};let Wc=La;Wc.COMPONENT="FileExplorerPanel";Wc.TITLE="File Explorer";const Zr=JT(Wc);const at=X.module("FilterSetManager"),tE="Enter name...",Ch="No Available Filter Sets";class Jr extends S.exports.Component{constructor(e){super(e),this.renameInputRef=Y.createRef(),this.dropdownRef=Y.createRef(),this.editDropdownRef=Y.createRef(),this.isRenamingExistingSet=Ce((n,s)=>s!==void 0&&n.some(({id:i})=>i===s.id)),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}}static animateScreenFlash(){var n;const e=document.createElement("div");e.classList.add("screen-flash-overlay"),e.addEventListener("animationend",()=>{e.remove()}),(n=document.querySelector("body"))==null||n.appendChild(e)}componentDidMount(){const{isValueShown:e}=this.props;e?this.updateSelectedId():this.initSettingsScreen()}componentDidUpdate(e,n){const{isValueShown:s,filterSets:i}=this.props,{modifiedFilterSets:o}=this.state;if(e.isValueShown&&!s&&this.initSettingsScreen(),this.isNameInputScreen()&&!this.isNameInputScreen(n)&&this.focusRenameInput(),i!==e.filterSets)if(!s&&i.length>0&&e.filterSets.length===0&&o.length===0){const{onChange:r}=this.props;r({isValueShown:!0,selectedId:i[0].id})}else this.updateSelectedId()}initSettingsScreen(){const{filterSets:e,selectedId:n}=this.props;at.debug("initSettingsScreen",e,n),this.setState({modifiedFilterSets:[...e],editId:n})}updateSelectedId(){const{isValueShown:e,filterSets:n,selectedId:s,onChange:i}=this.props;if(at.debug("updateSelectedId",n,s),!!e&&!n.some(({id:o})=>o===s)){const o=n.length===0;i({isValueShown:!o,selectedId:o?void 0:n[0].id})}}handleEditDropdownChange(e){const{value:n}=e.target;this.setState({editId:n})}handleFilterChange(e){const{value:n}=e.target,{isValueShown:s,onChange:i}=this.props;this.applyFilterSet(n),i({isValueShown:s,selectedId:n})}handleFilterApply(){const{selectedId:e}=this.props;this.applyFilterSet(e)}handleSettingsCancel(){const{onChange:e,selectedId:n,filterSets:s}=this.props;this.setState({modifiedFilterSets:[]}),s.length>0&&e({isValueShown:!0,selectedId:n})}handleSettingsSave(){const{onChange:e,onUpdateSets:n}=this.props,{modifiedFilterSets:s,editId:i}=this.state;this.setState({modifiedFilterSets:[]}),at.debug("Update sets",s,i),n(s),s.length>0&&e({isValueShown:!0,selectedId:i})}handleCaptureNewSet(){const{getFilterState:e}=this.props;Jr.animateScreenFlash();const n=qe(),s=e(),i={id:n,title:"",panels:s};at.debug("handleSetCreate",i),this.setState({nameInputValue:"",nameInputError:void 0,renameSet:i})}handleRenameCancel(){this.setState({renameSet:void 0})}handleRestoreFullStateChange(e){this.setState({restoreFullState:e.target.value==="true"})}getNameError(e){var o;const{renameSet:n,modifiedFilterSets:s}=this.state,i=(o=e==null?void 0:e.trim())!=null?o:"";if(i.length===0)return at.debug("Name cannot be empty",i),"Name cannot be empty";if(n!==void 0&&s.some(({title:r,id:l})=>r===i&&l!==n.id))return at.debug("Set with this name already exists",i),"Set with this name already exists"}handleRenameConfirm(){var h;const{nameInputValue:e,renameSet:n,modifiedFilterSets:s,restoreFullState:i}=this.state;if(n===void 0){at.error("Renamed set undefined.");return}const o=this.getNameError(e);if(at.debug("handleRenameConfirm",e,o),o!==void 0){this.setState({nameInputError:o});return}const r=(h=e==null?void 0:e.trim())!=null?h:"",l={...n,title:r,restoreFullState:i},a=s.findIndex(({id:u})=>u===n.id),c=[...s];a>=0?(c[a]=l,at.debug("Renamed existing set",c)):(c.push(l),at.debug("Added new set to modified sets",c)),this.setState({editId:l.id,modifiedFilterSets:c,renameSet:void 0})}handleSetDelete(){this.setState(e=>{const{editId:n,modifiedFilterSets:s}=e,i=s.findIndex(({id:a})=>a===n);if(i<0)return at.error("Unable to find selected filterSet index",s,n),null;const o=s.filter(({id:a})=>a!==n),r=Math.max(0,Math.min(o.length-1,i-1)),l=o.length>0?o[r].id:void 0;return at.debug("Deleted selected set",n,s,o),at.debug("New selection",r,l),{modifiedFilterSets:o,editId:l}})}handleSetUpdate(){const{getFilterState:e}=this.props;Jr.animateScreenFlash();const n=e();this.setState(({modifiedFilterSets:s,editId:i})=>{if(i===void 0)return at.error("Filter for update not selected."),null;const o=[...s],r=o.findIndex(({id:l})=>l===i);return r<0?(at.error("Selected set for update not found."),null):(o[r]={...o[r],panels:n},at.debug("Update set",o,n),{modifiedFilterSets:o})})}handleSetEdit(){this.setState(({editId:e,modifiedFilterSets:n})=>{const s=n.find(({id:r})=>r===e);if(s===void 0)return at.error("Could not find selected set",e,n),null;const{title:i,restoreFullState:o=!1}=s;return{nameInputValue:i,nameInputError:void 0,renameSet:s,restoreFullState:o}})}handleSettingsClick(e){e.stopPropagation();const{onChange:n,selectedId:s}=this.props;n({isValueShown:!1,selectedId:s})}handleBackgroundClick(e){at.debug("handleBackgroundClick"),e.target!==this.dropdownRef.current&&this.focusInput()}handleNameInputChange(e){const{value:n}=e.target,s=this.getNameError(n);this.setState({nameInputValue:n,nameInputError:s})}handleNameInputKeyPress(e){const{key:n}=e;n==="Enter"&&(e.preventDefault(),this.handleRenameConfirm())}isNameInputScreen(e=this.state){const{renameSet:n}=e;return n!==void 0}applyFilterSet(e){const{onApply:n,filterSets:s}=this.props;if(e===void 0){at.debug("No filter selected");return}const i=s.find(({id:o})=>o===e);if(i===void 0){at.debug("Selected id not found in filterSets",e,s);return}at.debug("Apply filterSet",i),n(i)}focusInput(){var e;(e=this.dropdownRef.current)==null||e.focus()}focusRenameInput(){var e;(e=this.renameInputRef.current)==null||e.focus()}render(){const{nameInputValue:e,nameInputError:n,editId:s,renameSet:i,modifiedFilterSets:o,restoreFullState:r}=this.state,{isValueShown:l,filterSets:a,selectedId:c}=this.props,h=this.isNameInputScreen(),u=this.isRenamingExistingSet(o,i),m=o.length===0,p=!h&&m&&a.length===0,g=!h&&!p,f=w("div",{className:"fa-layers mr-3",children:[d(z,{icon:Oo,mask:wa,transform:"shrink-1 down-5 right-7"}),d(z,{icon:As,className:"text-primary",transform:"shrink-6 down-5 right-7"})]}),b=w("div",{className:"fa-layers",children:[d(z,{icon:Oo,mask:wa,transform:"shrink-1 down-5 right-7"}),d(z,{icon:Sa,transform:"shrink-1 down-5 right-7"})]});return d("div",{className:"filter-set-manager fill-parent-absolute",children:w(qa,{className:"w-100 h-100",isFlipped:l,children:[d("div",{className:"filter-set-manager-settings-card fill-parent-absolute",children:w("div",{className:"filter-set-manager-card-content",children:[p&&w("div",{children:[d(ce,{kind:"ghost",className:"btn btn-link no-underline",onClick:this.handleCaptureNewSet,icon:f,children:"Capture filter set"}),d("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&&w("div",{className:"d-flex flex-column justify-content-center","data-testid":"edit-filter-set-container",children:[w("div",{className:"form-group",children:[d("label",{children:u?"Edit set":"Name captured set"}),w("div",{className:"name-input-container",children:[d("input",{type:"text",className:"input-set-name form-control",placeholder:tE,value:e,ref:this.renameInputRef,onChange:this.handleNameInputChange,onKeyPress:this.handleNameInputKeyPress,spellCheck:"false"}),d(ce,{"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:Zh}),d(ce,{"data-testid":"rename-cancel-button",kind:"ghost",className:"btn btn-link no-underline pt-2 pb-2",onClick:this.handleRenameCancel,tooltip:"Cancel",icon:Kg})]}),n!==void 0&&d("div",{className:"error-message",children:n})]}),d("div",{className:"form-group",children:w(ml,{onChange:this.handleRestoreFullStateChange,value:`${r}`,children:[d(Mn,{value:"false",children:"Restore only filters"}),d(Mn,{value:"true",children:"Restore full table state"})]})})]}),g&&w("div",{className:"filter-set-manager-settings-grid-1",children:[w("div",{className:"form-group",children:[d("label",{children:"Edit filter sets"}),w("div",{className:"filter-select-container",children:[w("select",{"data-testid":"settings-card-filter-select",ref:this.editDropdownRef,value:s!=null?s:"-1",className:"custom-select filter-value-select",onChange:this.handleEditDropdownChange,disabled:m,children:[m&&d("option",{value:"-1",disabled:!0,children:Ch}),o.map(({id:C,title:v})=>d("option",{value:C,children:v},C))]}),d(ce,{kind:"ghost",onClick:this.handleSetUpdate,disabled:m,icon:b,tooltip:"Update"}),d(ce,{kind:"ghost",onClick:this.handleSetEdit,disabled:m,icon:rl,tooltip:"Edit"}),d(ce,{kind:"ghost",onClick:this.handleSetDelete,disabled:m,icon:_n,tooltip:"Delete"})]})]}),d("div",{children:d(ce,{kind:"ghost",className:"btn btn-link no-underline",onClick:this.handleCaptureNewSet,icon:f,children:"Capture new filter set"})}),w("div",{className:"py-3 text-right",children:[d(ce,{kind:"secondary",onClick:this.handleSettingsCancel,children:"Cancel"}),"\xA0",d(ce,{kind:"primary",onClick:this.handleSettingsSave,children:"Save"})]})]})]})},"front"),d("div",{className:"filter-set-manager-value-card fill-parent-absolute",onClick:this.handleBackgroundClick,children:w(ue,{children:[d("div",{className:"filter-set-manager-column",children:d("div",{className:"filter-set-manager-column-title",children:"Filter sets"})}),d("div",{className:"filter-set-manager-card-content",children:d("div",{className:"filter-set-manager-value-input",children:w("div",{className:"filter-select-container",children:[w("select",{"data-testid":"value-card-filter-select",ref:this.dropdownRef,value:c,className:"custom-select filter-value-select",onChange:this.handleFilterChange,children:[a.length===0&&d("option",{value:"-1",disabled:!0,children:Ch}),a.map(({id:C,title:v})=>d("option",{value:C,children:v},C))]}),d(ce,{"data-testid":"filter-apply-button",kind:"ghost",onClick:this.handleFilterApply,icon:Ja,tooltip:"Apply Filter Set"})]})})}),d("div",{className:"filter-set-manager-menu",children:d(ce,{kind:"ghost",className:"btn btn-link btn-link-icon m-2 px-2",onClick:this.handleSettingsClick,tooltip:"Settings",icon:d(z,{icon:Wo,transform:"grow-4"})})})]})},"back")]})})}}const Vn=X.module("IrisGridPanel"),nE=500,sE={IrisGrid:oo,IrisGridTableModel:jm,ContextMenuRoot:lu};class ji extends S.exports.PureComponent{constructor(e){super(e),this.getGridInputFilters=Ce((s,i)=>te.getInputFiltersForColumns(s,i.filter(({value:o,excludePanelIds:r})=>{const l=J.getIdFromPanel(this);return o!=null&&(r==null||l!=null&&!r.includes(l))}))),this.getAlwaysFetchColumns=Ce((s,i)=>{const o=J.getIdFromPanel(this),r=new Set(i);for(let l=0;l<s.length;l+=1){const{start:a}=s[l];a!=null&&a.panelId===o&&r.add(a.columnName)}return[...r]}),this.getPluginContent=Ce((s,i,o,r,l)=>!i||!ri(i)||s==null||i.table==null?null:d("div",{className:"iris-grid-plugin",children:d(s,{ref:this.pluginRef,filter:this.handlePluginFilter,onFilter:this.handlePluginFilter,fetchColumns:this.handlePluginFetchColumns,onFetchColumns:this.handlePluginFetchColumns,table:i.table,user:o,panel:this,workspace:r,components:sE,onStateChange:this.handlePluginStateChange,pluginState:l})})),this.getDehydratedIrisGridPanelState=Ce((s,i,o,r)=>te.dehydrateIrisGridPanelState(s,{isSelectingPartition:i,partition:o,partitionColumn:r})),this.getDehydratedIrisGridState=Ce((s,i,o,r,l,a,c,h,u,m,p,g,f,b,C,v,T,E,y,I)=>te.dehydrateIrisGridState(s,{advancedFilters:o,aggregationSettings:T,customColumnFormatMap:r,isFilterBarShown:l,metrics:{userColumnWidths:C,userRowHeights:v},quickFilters:a,customColumns:c,reverseType:h,rollupConfig:u,showSearchBar:m,searchValue:p,selectDistinctColumns:g,selectedSearchColumns:f,sorts:i,invertSearchColumns:b,pendingDataMap:E,frozenColumns:y,conditionalFormats:I})),this.getDehydratedGridState=Ce((s,i,o,r,l)=>te.dehydrateGridState(s,{isStuckToBottom:r,isStuckToRight:l,movedColumns:i,movedRows:o})),this.getCachedPanelState=Ce((s,i,o,r)=>({irisGridPanelState:s,irisGridState:i,gridState:o,pluginState:r})),this.savePanelState=Je(()=>{const{irisGridState:s,gridState:i,pluginState:o}=this;A(s);const{onPanelStateUpdate:r}=this.props,{model:l,panelState:a,isSelectingPartition:c,partition:h,partitionColumn:u}=this.state,{advancedFilters:m,aggregationSettings:p,customColumnFormatMap:g,isFilterBarShown:f,quickFilters:b,customColumns:C,reverseType:v,rollupConfig:T,showSearchBar:E,searchValue:y,selectDistinctColumns:I,selectedSearchColumns:D,sorts:M,invertSearchColumns:x,metrics:B,pendingDataMap:$,frozenColumns:k,conditionalFormats:H}=s;A(B);const{userColumnWidths:O,userRowHeights:F}=B;A(i);const{isStuckToBottom:_,isStuckToRight:L,movedColumns:V,movedRows:G}=i,j=this.getCachedPanelState(this.getDehydratedIrisGridPanelState(l,c,h,u),this.getDehydratedIrisGridState(l,M,m,g,f,b,C,v,T,E,y,I,D,x,O,F,p,$,k,H),this.getDehydratedGridState(l,V,G,_,L),o);j!==a&&(Vn.debug("Saving panel state",this,j),this.setState({panelState:j}),r==null||r(j))},nE),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=Y.createRef(),this.pluginRef=Y.createRef();const{panelState:n}=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(Ww.DEFAULTS),customColumns:[],customColumnFormatMap:new Map,isFilterBarShown:!1,quickFilters:new Map,sorts:[],userColumnWidths:new Map,userRowHeights:new Map,reverseType:P.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:n,irisGridStateOverrides:{},gridStateOverrides:{},isStuckToBottom:!1,isStuckToRight:!1,conditionalFormats:[],selectDistinctColumns:[]}}componentDidMount(){this.initModel()}componentDidUpdate(e,n){const{model:s}=this.state;s!==n.model&&(n.model!=null&&(this.stopModelListening(n.model),n.model.close()),s!=null&&this.startModelListening(s))}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())}getTableName(){const{metadata:e}=this.props;return e.table}initModel(){this.setState({isModelReady:!1,isLoading:!0,error:null});const{makeModel:e}=this.props;this.modelPromise!=null&&this.modelPromise.cancel(),this.modelPromise=Re.makeCancelable(e(),n=>n.close()),this.modelPromise.then(this.handleLoadSuccess).catch(this.handleLoadError)}handleLoadSuccess(e){const n=e,{panelState:s,irisGridStateOverrides:i}=this.state,o=[];if(s!=null){const{irisGridState:r}=s,{aggregationSettings:l,customColumns:a,selectDistinctColumns:c=[],rollupConfig:h}={...r,...i};a.length>0&&o.push(u=>{u.customColumns=a}),h!=null&&h.columns.length>0&&o.push(u=>{u.rollupConfig=te.getModelRollupConfig(u.originalColumns,h,l)}),c.length>0&&o.push(u=>{u.selectDistinctColumns=c})}this.setState({model:n,modelQueue:o}),this.initModelQueue(n,o)}initModelQueue(e,n){const s=e;if(n.length===0){this.modelInitialized(s);return}const i=n.shift();Vn.debug("initModelQueue",i),i&&i(s),this.setState({modelQueue:n})}handleAdvancedSettingsChange(e,n){Vn.debug("handleAdvancedSettingsChange",e,n),this.setState(({advancedSettings:s})=>s.get(e)===n?null:{advancedSettings:new Map(s).set(e,n)})}handlePluginFilter(e){const{model:n}=this.state;A(n);const{columns:s,formatter:i}=n,o=te.getFiltersFromInputFilters(s,e,i.timeZone);this.setState({pluginFilters:o})}handlePluginFetchColumns(e){this.setState({pluginFetchColumns:e})}handleContextMenu(e){var n,s,i;return(i=(s=(n=this.pluginRef.current)==null?void 0:n.getMenu)==null?void 0:s.call(n,e))!=null?i:[]}isColumnSelectionValid(e){const{columnSelectionValidator:n}=this.props;return n&&e?n(this,e):!1}handleGridStateChange(e,n){this.irisGridState=e,this.gridState=n,this.setState({isLoaded:!0,isLoading:!1}),this.savePanelState();const{glEventHub:s,onStateChange:i}=this.props;s.emit(yt.STATE_CHANGED,this),i==null||i(e,n)}handlePluginStateChange(e){const{irisGridState:n,gridState:s}=this;this.pluginState=e,n!==null&&s!==null&&this.savePanelState()}handleColumnsChanged(e){const{isModelReady:n,model:s,modelQueue:i}=this.state;n?this.sendColumnsChange(e.detail):(A(s),this.initModelQueue(s,i))}handleTableChanged(e){Vn.debug("handleTableChanged",e);const{glEventHub:n}=this.props,{detail:s}=e;n.emit(Ue.TABLE_CHANGED,this,s)}handlePartitionAppend(e,n){const{glEventHub:s}=this.props,{name:i}=e,o=this.getTableName(),r=`${o} = ${o}.where("${i}=\`${n}\`")`;s.emit(wt.SEND_COMMAND,r,!1,!0)}handleCreateChart(e,n){this.savePanelState.flush(),this.setState(()=>null,()=>{const{glEventHub:s,inputFilters:i,metadata:o}=this.props,{table:r}=o,{panelState:l}=this.state,a=J.getIdFromPanel(this);let c;l&&(c=te.extractTableSettings(l,i)),s.emit(yt.CREATE_CHART,{metadata:{settings:e,sourcePanelId:a,table:r,tableSettings:c},table:ri(n)?n.table:void 0})})}handleColumnSelected(e){const{glEventHub:n}=this.props;n.emit(yt.COLUMN_SELECTED,this,e)}handleDataSelected(e,n){const{glEventHub:s}=this.props;s.emit(yt.DATA_SELECTED,this,n)}handleResize(){this.updateGrid()}handleShow(){this.updateGrid()}handleTabClicked(){this.irisGrid.current&&this.irisGrid.current.focus()}handleError(e){Vn.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){Re.isCanceled(e)||this.handleError(e)}modelInitialized(e){const{glEventHub:n,loadPlugin:s}=this.props;if(this.modelPromise=void 0,this.loadPanelState(e),this.setState({isModelReady:!0}),ri(e)){const{table:i}=e,{pluginName:o}=i;if(o!==""&&s!=null&&o!=null){const r=s(o);this.setState({Plugin:r})}n.emit(Ue.TABLE_CHANGED,this,i)}this.sendColumnsChange(e.columns)}handleClearAllFilters(){const e=this.irisGrid.current,{isDisconnected:n}=this.state;e!=null&&!n&&e.clearAllFilters()}sendColumnsChange(e){Vn.debug2("sendColumnsChange",e);const{glEventHub:n}=this.props;n.emit(Ue.COLUMNS_CHANGED,this,e)}startModelListening(e){e.addEventListener(we.EVENT.DISCONNECT,this.handleDisconnect),e.addEventListener(we.EVENT.RECONNECT,this.handleReconnect),e.addEventListener(we.EVENT.COLUMNS_CHANGED,this.handleColumnsChanged),e.addEventListener(we.EVENT.TABLE_CHANGED,this.handleTableChanged)}stopModelListening(e){e.removeEventListener(we.EVENT.DISCONNECT,this.handleDisconnect),e.removeEventListener(we.EVENT.RECONNECT,this.handleReconnect),e.removeEventListener(we.EVENT.COLUMNS_CHANGED,this.handleColumnsChanged),e.removeEventListener(we.EVENT.TABLE_CHANGED,this.handleTableChanged)}getCoordinateForColumn(e){var v,T,E;const{model:n}=this.state;if(!n)return null;const s=this.irisGrid.current,{gridWrapper:i}=s||{},o=(v=i==null?void 0:i.getBoundingClientRect())!=null?v:null;if(o==null||o.width<=0||o.height<=0)return null;A(s);const{metrics:r}=s.state;A(r);const{columnHeaderHeight:l,visibleColumnXs:a,visibleColumnWidths:c,right:h,columnHeaderMaxDepth:u}=r,m=n.getColumnIndexByName(e);A(m);const p=s.getVisibleColumn(m),g=(T=a.get(p))!=null?T:0,f=(E=c.get(p))!=null?E:0,b=Math.max(o.left,Math.min(p>h?o.right:o.left+g+f*.5,o.right)),C=o.top+l*u;return[b,C]}setFilterMap(e){const n=this.irisGrid.current;n!=null&&n.setFilterMap(e)}setAdvancedFilterMap(e){const n=this.irisGrid.current;n!=null&&n.setAdvancedFilterMap(e)}setFilters({quickFilters:e,advancedFilters:n}){Vn.debug("setFilters",e,n);const{model:s,isDisconnected:i}=this.state,o=this.irisGrid.current;if(o==null||i){Vn.debug("Ignore setFilters, model disconnected");return}A(s);const{columns:r,formatter:l}=s,a=te.changeFilterColumnNamesToIndexes(s.columns,e).filter(([h])=>s.isFilterable(h)),c=te.changeFilterColumnNamesToIndexes(s.columns,n).filter(([h])=>s.isFilterable(h));o.clearAllFilters(),o.setFilters({quickFilters:te.hydrateQuickFilters(r,a,l.timeZone),advancedFilters:te.hydrateAdvancedFilters(r,c,l.timeZone)})}setStateOverrides(e){Vn.debug("setStateOverrides",e);const{irisGridState:n,gridState:s}=e;this.setState({irisGridStateOverrides:n,gridStateOverrides:s},()=>{this.initModel()})}unsetFilterValue(){}loadPanelState(e){const{panelState:n,irisGridStateOverrides:s,gridStateOverrides:i}=this.state;if(n!=null)try{const{gridState:o,irisGridState:r,irisGridPanelState:l}=n,a={...s},{quickFilters:c,advancedFilters:h}=a;c&&(a.quickFilters=te.changeFilterColumnNamesToIndexes(e.columns,c)),h&&(a.advancedFilters=te.changeFilterColumnNamesToIndexes(e.columns,h));const{isSelectingPartition:u,partition:m,partitionColumn:p}=te.hydrateIrisGridPanelState(e,l),{advancedFilters:g,customColumns:f,customColumnFormatMap:b,isFilterBarShown:C,quickFilters:v,reverseType:T,rollupConfig:E,aggregationSettings:y,sorts:I,userColumnWidths:D,userRowHeights:M,showSearchBar:x,searchValue:B,selectDistinctColumns:$,selectedSearchColumns:k,invertSearchColumns:H,pendingDataMap:O,frozenColumns:F,conditionalFormats:_}=te.hydrateIrisGridState(e,{...r,...a}),{isStuckToBottom:L,isStuckToRight:V,movedColumns:G,movedRows:j}=te.hydrateGridState(e,{...o,...i},r.customColumns);this.setState({advancedFilters:g,conditionalFormats:_,customColumns:f,customColumnFormatMap:b,isFilterBarShown:C,isSelectingPartition:u,movedColumns:G,movedRows:j,partition:m,partitionColumn:p,quickFilters:v,reverseType:T,rollupConfig:E,aggregationSettings:y,sorts:I,userColumnWidths:D,userRowHeights:M,showSearchBar:x,searchValue:B,selectDistinctColumns:$,selectedSearchColumns:k,invertSearchColumns:H,pendingDataMap:O,frozenColumns:F,isStuckToBottom:L,isStuckToRight:V})}catch(o){Vn.error("loadPanelState failed to load panelState",n,o)}}updateGrid(){var n,s;const e=(s=(n=this.irisGrid.current)==null?void 0:n.grid)!=null?s:null;!e||e.handleResize()}render(){var Bt,$t,kn;const{children:e,glContainer:n,glEventHub:s,columnSelectionValidator:i,getDownloadWorker:o,inputFilters:r,links:l,metadata:a,panelState:c,user:h,workspace:u,settings:m,theme:p}=this.props,{advancedFilters:g,aggregationSettings:f,advancedSettings:b,conditionalFormats:C,customColumns:v,customColumnFormatMap:T,error:E,isDisconnected:y,isFilterBarShown:I,isSelectingPartition:D,isStuckToBottom:M,isStuckToRight:x,isLoaded:B,isLoading:$,isModelReady:k,model:H,movedColumns:O,movedRows:F,partition:_,partitionColumn:L,quickFilters:V,reverseType:G,rollupConfig:j,sorts:ne,userColumnWidths:ye,userRowHeights:le,showSearchBar:Te,searchValue:He,selectDistinctColumns:Z,selectedSearchColumns:ge,invertSearchColumns:be,Plugin:Le,pluginFilters:Oe,pluginFetchColumns:gn,pendingDataMap:jn,frozenColumns:Tn}=this.state,vt=E!=null?`Unable to open table. ${E}`:void 0,{table:Ne}=a,rt=(Bt=H==null?void 0:H.description)!=null?Bt:void 0,lt=($t=c==null?void 0:c.pluginState)!=null?$t:null,_t=e!=null?e:this.getPluginContent(Le,H,h,u,lt),{permissions:Qt}=h,{canCopy:Zt,canDownloadCsv:Lt}=Qt,Qn=H==null?void 0:H.displayString((kn=H==null?void 0:H.rowCount)!=null?kn:0,"long");return w(Ll,{errorMessage:vt,isDisconnected:y,isLoading:$,isLoaded:B,className:"iris-grid-panel",glContainer:n,glEventHub:s,onClearAllFilters:this.handleClearAllFilters,onResize:this.handleResize,onShow:this.handleShow,onTabFocus:this.handleShow,onTabClicked:this.handleTabClicked,widgetName:Ne,widgetType:"Table",description:rt,componentPanel:this,renderTabTooltip:()=>d(_l,{widgetType:"Table",widgetName:Ne,glContainer:n,description:rt,children:w("div",{className:"column-statistics-grid",children:[d("span",{className:"column-statistic-operation",children:"Number of Rows"}),d("span",{className:"column-statistic-value",children:Qn})]})}),children:[k&&H&&d(oo,{advancedFilters:g,aggregationSettings:f,advancedSettings:b,alwaysFetchColumns:this.getAlwaysFetchColumns(l,gn),columnAllowedCursor:"linker",columnNotAllowedCursor:"not-allowed",customColumns:v,customColumnFormatMap:T,columnSelectionValidator:this.isColumnSelectionValid,conditionalFormats:C,inputFilters:this.getGridInputFilters(H.columns,r),applyInputFiltersOnInit:c==null,isFilterBarShown:I,isSelectingColumn:i!=null,isSelectingPartition:D,isStuckToBottom:M,isStuckToRight:x,movedColumns:O,movedRows:F,partition:_,partitionColumn:L,quickFilters:V,reverseType:G,rollupConfig:j,settings:m,sorts:ne,userColumnWidths:ye,userRowHeights:le,model:H,showSearchBar:Te,searchValue:He,selectedSearchColumns:ge,selectDistinctColumns:Z,invertSearchColumns:be,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:Oe,pendingDataMap:jn,canCopy:Zt,canDownloadCsv:Lt,ref:this.irisGrid,getDownloadWorker:o,frozenColumns:Tn,theme:p,children:_t}),!k&&d(ue,{})]})}}ji.defaultProps={onStateChange:()=>{},onPanelStateUpdate:()=>{}};ji.displayName="IrisGridPanel";ji.COMPONENT="IrisGridPanel";const iE=(t,{localDashboardId:e=Dn})=>({inputFilters:Lc(t,e),links:ro(t,e),columnSelectionValidator:Ac(t,e),user:qu(t),workspace:Sl(t),settings:Xt(t)}),hi=xt(iE,null,null,{forwardRef:!0})(ji);const bh=X.module("InputFilter"),oE=150,ka=class extends S.exports.Component{constructor(t){super(t),this.getItemLabel=Ie((i,o)=>{const{name:r,type:l}=i[o];if(o>0&&i[o-1].name===r||o<i.length-1&&i[o+1].name===r){const a=l.substring(l.lastIndexOf(".")+1);return`${r} (${a})`}return r}),this.sendUpdate=Je(()=>{const{onChange:i}=this.props,{column:o,value:r,isValueShown:l}=this.state;i({column:o,isValueShown:l,value:r})},oE),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=Y.createRef();const{column:e,isValueShown:n,value:s}=t;this.state={column:e,selectedColumn:e,value:s,isValueShown:n}}componentDidUpdate(t,e){const{column:n}=this.props,{column:s,value:i,isValueShown:o}=this.state;n!==t.column&&this.setState({column:n,selectedColumn:n}),o!==void 0&&o&&o!==e.isValueShown&&this.focusInput(),(s!==e.column||i!==e.value||o!==e.isValueShown)&&this.sendUpdate()}componentWillUnmount(){this.sendUpdate.flush()}handleColumnChange(t){const{columns:e}=this.props,{value:n}=t.target,s=e[parseInt(n,10)];bh.debug2("handleColumnChange",s),this.setState({selectedColumn:s,value:void 0})}handleInputKeyPress(t){t.key==="Enter"&&(t.preventDefault(),t.stopPropagation(),this.setState(({value:e})=>e==null?{value:""}:null,()=>{this.sendUpdate(),this.sendUpdate.flush()}))}handleValueChange(t){const{value:e}=t.target;bh.debug2("handleValueChange",e),this.setState({value:e})}handleSettingsCancel(){const{column:t}=this.state;this.setState({selectedColumn:t,isValueShown:!0})}handleSettingsSave(){const{selectedColumn:t}=this.state;this.setState({column:t,isValueShown:!0})}handleSettingsClick(t){const{column:e}=this.state;this.setState({selectedColumn:e,isValueShown:!1}),t.stopPropagation()}handleBackgroundClick(t){t.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:t,type:e,value:n,isValueShown:s}){const i=t!=null&&e!=null?{name:t,type:e}:void 0,o=s===void 0?{column:i,value:n}:{column:i,value:n,isValueShown:s};this.setState(o)}render(){const{columns:t}=this.props,{column:e,isValueShown:n,selectedColumn:s,value:i}=this.state,o=i==null||i.length===0?ka.PLACEHOLDER.length:i.length;let r=null;if(e!=null){const l=t.findIndex(a=>a.name===e.name&&a.type===e.type);r=l>=0?this.getItemLabel(t,l):e.name}return w(qa,{className:"input-filter fill-parent-absolute",isFlipped:n!=null?n:!1,children:[d("div",{className:"input-filter-settings-card",children:w("div",{className:"input-filter-settings-content",children:[w("div",{className:"input-filter-settings-grid",children:[d("label",{children:"Filter Column"}),w("select",{value:t.findIndex(l=>l.name===(s==null?void 0:s.name)&&l.type===(s==null?void 0:s.type)),className:"custom-select",onChange:this.handleColumnChange,children:[t.map((l,a)=>d("option",{value:a,children:this.getItemLabel(t,a)},`${l.name}/${l.type}`)),t.length===0&&d("option",{value:"-1",disabled:!0,children:"No Available Columns"})]}),d("div",{className:"text-muted small",children:"Input filter control will apply its filter to all columns matching this name in this dashboard."})]}),w("div",{className:"input-filter-settings-buttons",children:[d("button",{type:"button",className:"btn btn-outline-primary",onClick:this.handleSettingsCancel,disabled:e==null,children:"Cancel"}),d("button",{type:"button",className:"btn btn-primary ml-2",onClick:this.handleSettingsSave,disabled:s==null,children:"Save"})]})]})}),w("div",{className:"input-filter-value-card",onClick:this.handleBackgroundClick,children:[d("div",{className:"input-filter-column",children:w("div",{className:"input-filter-column-title",children:[r," Filter"]})}),d("div",{className:"d-flex justify-content-center align-items-center h-100 w-100",children:d("div",{className:"input-filter-value-input d-flex flex-column justify-content-center",children:d("input",{type:"text",ref:this.inputRef,placeholder:ka.PLACEHOLDER,value:i!=null?i:"",onChange:this.handleValueChange,onKeyPress:this.handleInputKeyPress,style:{width:`${o+3}ch`},spellCheck:"false"})})}),d("div",{className:"input-filter-menu",children:d("button",{type:"button",className:"btn btn-link btn-link-icon m-2 px-2",onClick:this.handleSettingsClick,children:d(z,{icon:Wo,transform:"grow-4"})})})]})]})}};let zc=ka;zc.PLACEHOLDER="Enter value...";zc.defaultProps={column:null,isValueShown:!1,value:null};const rE=250;class Pl extends S.exports.Component{constructor(e){super(e),this.handleChange=Je(this.handleChange.bind(this),rE),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.inputFilterRef=Y.createRef();const{panelState:n}=e,{value:s,isValueShown:i=!1,name:o,type:r,timestamp:l}=n!=null?n:{};this.state={columns:[],column:o!=null&&r!=null?{name:o,type:r}:void 0,value:s,timestamp:l,isValueShown:i,wasFlipped:!1,skipUpdate:!1,panelState:n}}componentDidMount(){this.updateColumns();const{column:e,value:n,timestamp:s}=this.state;if(e!=null){const{name:i,type:o}=e;this.sendUpdate(i,o,n,s)}}componentDidUpdate(e){const{columns:n}=this.props;n!==e.columns&&this.updateColumns()}handleChange({column:e,isValueShown:n,value:s}){let i,o;e!=null&&({name:i,type:o}=e);let r=!0,l=Date.now();this.setState(({panelState:a,timestamp:c,wasFlipped:h,skipUpdate:u})=>{var p;const m=a!=null&&n!==a.isValueShown&&i===a.name&&o===a.type&&s===a.value;return r=(p=!u&&n&&(!m||!h))!=null?p:!1,r||(l=c),{panelState:{isValueShown:n,name:i,type:o,value:s,timestamp:l},timestamp:l,wasFlipped:m,skipUpdate:!1}},()=>{r&&this.sendUpdate(i,o,s,l)})}handleClearAllFilters(){var e;(e=this.inputFilterRef.current)==null||e.clearFilter()}sendUpdate(e,n,s,i){const{glEventHub:o}=this.props;o.emit(Ue.FILTERS_CHANGED,this,{name:e,type:n,value:s,timestamp:i})}setPanelState(e,n=!1){var s;this.setState({skipUpdate:!n}),(s=this.inputFilterRef.current)==null||s.setFilterState(e)}updateColumns(){const{columns:e}=this.props;e!=null&&this.setState(n=>{const{column:s}=n;return s==null&&e.length>0?{columns:[...e],column:e[0]}:s!=null&&!e.find(({name:i,type:o})=>s.name===i&&s.type===o)?{columns:[...e,s]}:{columns:[...e]}})}render(){const{glContainer:e,glEventHub:n}=this.props,{column:s,columns:i,isValueShown:o,value:r}=this.state;return d(Xn,{className:"iris-input-filter-panel",componentPanel:this,glContainer:e,glEventHub:n,onClearAllFilters:this.handleClearAllFilters,isClonable:!0,isRenamable:!0,children:d(zc,{ref:this.inputFilterRef,column:s,columns:i,onChange:this.handleChange,isValueShown:o,value:r})})}}Pl.defaultProps={panelState:null};Pl.COMPONENT="InputFilterPanel";Pl.displayName="InputFilterPanel";const lE=(t,e)=>{const{localDashboardId:n}=e;return{columns:ep(t,n)}},xo=xt(lE,null,null,{forwardRef:!0})(Pl);const Mt=X.module("FilterSetManagerPanel");function aE(t){return t.setPanelState!=null}const Oa=class extends S.exports.Component{static changeFilterIndexesToColumnNames(t,e){return e.map(([n,s])=>{if(n>=t.columns.length)return null;const{name:i}=t.columns[n];return{name:i,filter:s}}).filter(n=>n!=null)}constructor(t){super(t),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:e,filterSets:n}=t,{selectedId:s=n.length>0?n[0].id:void 0,isValueShown:i=!1}=e!=null?e:{};this.state={selectedId:s,isValueShown:i,panelState:e}}getFilterState(){const{dashboardOpenedPanelMap:t}=this.props,e=[];return[...t.keys()].forEach(n=>{const s=t.get(n);if(s===void 0){Mt.error("Could not get panel",s);return}const i=J.getComponentNameFromPanel(s),o=J.getIdFromPanel(s);Mt.debug("Panel:",s,i);const{glContainer:r=null}=s.props;if(r==null){Mt.error("Could not get panel container",s);return}const l=J.getComponentConfigFromContainer(r);if(l==null){Mt.error("Could not get component config from container",r);return}const a=J.getPanelComponentState(l);if(a==null){Mt.debug(`Panel state is null ${o}`);return}switch(i){case J.getComponentName(ji):{let c;o!=null&&(c=this.getIrisGridPanelFilters(o,a)),c!=null&&e.push({panelId:o,type:i,state:c});break}case J.getComponentName(xo):case J.getComponentName(di):{const{isValueShown:c,name:h,type:u,value:m}=a;e.push({panelId:o,type:i,state:{isValueShown:c,name:h,type:u,value:m}});break}}}),e}getIrisGridPanelFilters(t,e){const{panelTableMap:n}=this.props,s=n.get(t);if(s==null)return Mt.error(`Unable to get table for panel ${t}.`),null;const{irisGridState:i={advancedFilters:void 0,quickFilters:void 0},gridState:o={}}=e,{advancedFilters:r,quickFilters:l}=i;let a;r&&(a=Oa.changeFilterIndexesToColumnNames(s,r));let c;return l&&(c=Oa.changeFilterIndexesToColumnNames(s,l)),{irisGridState:{...i,advancedFilters:a,quickFilters:c},gridState:{...o}}}handleGetFilterState(){return this.getFilterState()}handleChange({isValueShown:t,selectedId:e}){Mt.debug("handleChange",t,e),this.setState({isValueShown:t,selectedId:e}),this.updatePanelState()}handleFilterApply(t){const{dashboardOpenedPanelMap:e}=this.props,{panels:n,restoreFullState:s=!1}=t;Mt.debug("Apply filters from filter set",t),n.forEach(({panelId:i,type:o,state:r})=>{if(i==null){Mt.debug("panel is null",i);return}if(!e.has(i)){Mt.debug("Ignore closed panel",i);return}Mt.debug("Apply panel filters",i,o,r);const l=e.get(i);switch(o){case J.getComponentName(ji):this.restoreIrisGridFilters(l,r,s);break;case J.getComponentName(xo):case J.getComponentName(di):this.restoreInputFilterState(l,r);break}})}handleSetsUpdate(t){const{setDashboardFilterSets:e,localDashboardId:n}=this.props;Mt.debug("Saving updated sets",t),e(n,[...t])}updatePanelState(){this.setState(({selectedId:t,isValueShown:e})=>({panelState:{selectedId:t,isValueShown:e}}))}restoreIrisGridFilters(t,e,n){const{irisGridState:s={},advancedFilters:i=[],quickFilters:o=[]}=e,{advancedFilters:r=i,quickFilters:l=o}=s,{panelTableMap:a}=this.props,c=J.getIdFromPanel(t);if(c==null){Mt.error("Panel Id is null.");return}if(a.get(c)==null){Mt.error(`Unable to get table for panel ${c}.`);return}Mt.debug("restoreIrisGridFilters",c,e,n),n?t.setStateOverrides(e):t.setFilters({quickFilters:l,advancedFilters:r})}restoreInputFilterState(t,e){const n={...e};delete n.isValueShown,Mt.debug("restoreInputFilterState",t,n),t&&aE(t)&&t.setPanelState(n)}render(){const{glContainer:t,glEventHub:e,filterSets:n}=this.props,{isValueShown:s,selectedId:i}=this.state;return d(Xn,{className:"filter-set-manager-panel",componentPanel:this,glContainer:t,glEventHub:e,isClonable:!0,isRenamable:!0,children:d("div",{className:"input-filter-container h-100 w-100 container",children:d(Jr,{onChange:this.handleChange,onApply:this.handleFilterApply,onUpdateSets:this.handleSetsUpdate,isValueShown:s,filterSets:n,selectedId:i,getFilterState:this.handleGetFilterState})})})}};let Gc=Oa;Gc.defaultProps={panelState:null};Gc.COMPONENT="FilterSetManagerPanel";const cE=(t,e)=>{const{localDashboardId:n}=e;return{filterSets:RT(t,n),dashboardOpenedPanelMap:Em(t,n),dashboardInputFilters:Lc(t,n),panelTableMap:kc(t,n)}},ma=xt(cE,{setDashboardFilterSets:kT},null,{forwardRef:!0})(Gc);const Sh=X.module("LogPanel");class Hl extends S.exports.PureComponent{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:n}=this.props;this.state={session:n}}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){Sh.debug("Session opened",[e]),this.setState({session:e})}handleSessionClosed(e){Sh.debug("Session closed",e)}updateDimensions(){this.logView&&this.logView.updateDimensions()}render(){const{glContainer:e,glEventHub:n}=this.props,{session:s}=this.state;return w(Xn,{componentPanel:this,glContainer:e,glEventHub:n,onResize:this.handleResize,onHide:this.handleHide,onShow:this.handleShow,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,children:[s==null&&d("div",{className:"log-panel-disconnected-message",children:"Waiting for session connection"}),s!=null&&d(Ji,{session:s,ref:i=>{this.logView=i}})]})}}Hl.defaultProps={session:null};Hl.COMPONENT="LogPanel";Hl.TITLE="Log";const dE=(t,e)=>{var n;return{session:(n=Ci(t,e.localDashboardId))==null?void 0:n.session}},el=xt(dE,null,null,{forwardRef:!0})(Hl);class rp extends S.exports.PureComponent{render(){const{isEditing:e,children:n,onDoubleClick:s}=this.props;return w("div",{className:"markdown-editor-container h-100 w-100",onDoubleClick:s,children:[d("div",{className:W("text-muted","edit-hint",{viewing:e===void 0||!e}),children:w("span",{children:["double-click to edit ",d(z,{icon:rl})]})}),n]})}}rp.defaultProps={isEditing:!1};const hE=X.module("MarkdownStartPage");class lp extends S.exports.PureComponent{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(hE.debug("delete markdown: ",e),e!==void 0){const{onDelete:n}=this.props;n(e)}this.setState({isDeleteModalShown:!1,toBeDeleted:void 0})}render(){const{closedMarkdowns:e,onOpen:n,onCreate:s}=this.props,{isDeleteModalShown:i,toBeDeleted:o}=this.state;return d("div",{className:"markdown-panel-start-page h-100 w-100",children:w("div",{className:"markdown-panel-start-page-container",children:[w("div",{className:"markdown-panel-start-list",children:[d("h3",{className:"list-title",children:"Start"}),d("div",{className:"list-item",children:d("button",{className:"btn btn-link title",type:"button",onClick:s,children:"New Markdown Note"})})]}),w("div",{className:"markdown-panel-start-list",children:[d("h3",{className:"list-title",children:"Recently Closed from Dashboard"}),e.map(r=>w("div",{className:"list-item",children:[d("button",{className:"btn btn-link title",type:"button",onClick:()=>n(r),children:r.title}),d("button",{className:"btn-link icon",type:"button",onClick:()=>{this.handleDeleteButtonClick(r)},children:d(z,{icon:_n})})]},r.id)),w(Vo,{isOpen:i,toggle:this.handleDeleteModalClose,className:"modal-dialog-centered markdown-delete-modal theme-bg-light",children:[d(Bo,{children:"Are you sure you want to permanently delete this note?"}),d(Uo,{children:"You can't undo this action."}),w(Ka,{children:[d("button",{className:"btn btn-outline-primary",onClick:this.handleDeleteModalClose,type:"button",children:"Cancel"}),d("button",{className:"btn btn-danger",onClick:()=>{this.handleDeleteMarkdown(o)},type:"button",children:"Delete"})]})]})]})]})})}}lp.defaultProps={closedMarkdowns:[],onOpen:()=>{},onCreate:()=>{},onDelete:()=>{}};class ap extends S.exports.PureComponent{constructor(e){super(e),this.renderMarkdown=n=>{const{children:s,className:i}=n,o=i!==void 0&&(i==null?void 0:i.startsWith("language-"))?i.substring(9):"plaintext";return d("pre",{children:d("code",{children:d(fl,{language:o,children:Y.Children.map(s,r=>typeof r=="string"?r.trim():r)})})})},this.container=null}render(){const{isEditing:e,content:n,onEditorInitialized:s}=this.props;return d("div",{className:"markdown-editor-container",ref:i=>{this.container=i},children:e?d(Cl,{settings:{language:"markdown",value:n,lineNumbers:"off"},onEditorInitialized:s}):d(Vh,{components:{code:this.renderMarkdown},children:n})})}}ap.defaultProps={isEditing:!1,content:""};const Dr=X.module("MarkdownPanel");class Kc extends S.exports.Component{constructor(e){super(e),this.getClosedMarkdowns=Ce(i=>i.filter(o=>o.component==="MarkdownPanel").reverse()),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:n}=e;let s=null;n!=null&&n.content!=null&&({content:s}=n),this.state={isStartPageShown:s==null,isEditing:!1,content:s,panelState:n},this.markdownEditor=null}setEditorPosition(e){var s,i;A(this.markdownEditor);const{container:n}=this.markdownEditor;if(this.editor&&n){const o=n.getBoundingClientRect().top,r=n.scrollTop,l=n.scrollHeight,a=(i=(s=this.editor.getModel())==null?void 0:s.getLineCount())!=null?i:0;let c=Math.round((r+e-o)/l*a);c>a&&(c=a),this.editor.revealLine(c),this.editor.setPosition({lineNumber:c,column:1}),this.editor.focus()}}handleContainerDoubleClick(e){const{isEditing:n}=this.state,s=e.clientY;n||this.setState({isEditing:!0},()=>{this.setEditorPosition(s)})}handleEditorInitialized(e){Dr.debug("Markdown Editor Initialized..."),this.editor=e}handleCreateMarkdown(){Dr.debug("create markdown..."),this.setState({isStartPageShown:!1,content:"",isEditing:!0,panelState:{content:""}},()=>{this.editor!=null&&this.editor.focus!=null&&this.editor.focus()})}handleOpenMarkdown(e){Dr.debug("open markdown...",e);const{glContainer:n,glEventHub:s}=this.props,i=J.getComponentConfigFromContainer(n);s.emit(Fe.REOPEN,e,i)}handleDeleteMarkdown(e){const{glEventHub:n}=this.props;n.emit(Fe.DELETE,e)}handleEditorBlur(e){var i;Dr.debug("markdown content changed, saving...");const{isEditing:n}=this.state;if(!n||this.markdownEditor!=null&&this.markdownEditor.container!=null&&this.markdownEditor.container.contains(e.relatedTarget))return;const s=(i=this.editor)==null?void 0:i.getValue();this.setState({content:s,isEditing:!1,panelState:{content:s}})}handleEditorResize(){const{isEditing:e}=this.state;e&&this.editor&&this.editor.layout()}render(){const{glContainer:e,glEventHub:n,closedPanels:s}=this.props,{isEditing:i,isStartPageShown:o,content:r}=this.state,l=this.getClosedMarkdowns(s);return d(Xn,{glContainer:e,glEventHub:n,className:"markdown-panel",componentPanel:this,onResize:this.handleEditorResize,onBlur:this.handleEditorBlur,isClonable:!0,isRenamable:!0,children:o?d(lp,{closedMarkdowns:l,onCreate:this.handleCreateMarkdown,onOpen:this.handleOpenMarkdown,onDelete:this.handleDeleteMarkdown}):d(rp,{isEditing:i,onDoubleClick:this.handleContainerDoubleClick,children:d(ap,{ref:a=>{this.markdownEditor=a},isEditing:i,content:r!=null?r:void 0,onEditorInitialized:this.handleEditorInitialized})})})}}Kc.defaultProps={panelState:null};Kc.COMPONENT="MarkdownPanel";const uE=(t,e)=>{const{localDashboardId:n}=e;return{closedPanels:Aw(t,n)}},wo=xt(uE,null,null,{forwardRef:!0})(Kc);class cp extends S.exports.PureComponent{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=Y.createRef(),this.state={hasCode:!1,hasRunCode:!1,nextStartLine:null}}componentDidMount(){this.updateHasCode()}componentDidUpdate(){this.updateHasCode()}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 n=[...this.commands.keys()],s=n.findIndex(i=>i===e)+1;return s>=n.length?null:n[s]}handleRunSelected(e){var h,u,m;e.preventDefault(),e.stopPropagation();const{nextStartLine:n}=this.state,s=[...this.commands.keys()],i=s.findIndex(p=>p===n||n==null);if(i<0)return;const o=s[i],r=this.commands.get(o),l=this.getNextStartLine(o),a=(h=this.codeElements.get(o))==null?void 0:h.current,c=(u=a==null?void 0:a.parentElement)==null?void 0:u.nextElementSibling;if(c!=null){const{offsetTop:p}=c,g=p;(m=this.editorScrollView.current)==null||m.scroll({top:g,left:0})}this.runCode(r),this.setState({nextStartLine:l})}runCode(e){const{onRunCode:n}=this.props;n(e),this.setState({hasRunCode:!0})}renderCodeBlock(e){const{children:n,className:s,inline:i,node:o}=e,{hasRunCode:r,nextStartLine:l}=this.state,{children:a,position:c}=o;A(c);const{start:h}=c,{line:u}=h,m=a[0].value,p=Y.createRef(),g=this.commands.size===0,f=l===u||g&&l==null&&!r,b=s!==void 0&&s.startsWith("language-")?s.substring(9):"plaintext";return i!=null&&i?d("code",{className:s,children:n}):(this.commands.set(u,m),this.codeElements.set(u,p),w("div",{className:W("markdown-notebook-code-block",{"is-selected":f}),ref:p,onClick:()=>{this.setState({nextStartLine:u})},role:"presentation",children:[d(ce,{kind:"ghost",icon:$r,className:"btn-play-block",onClick:C=>{C.stopPropagation(),C.preventDefault(),this.runCode(m),this.setState({nextStartLine:u})},tooltip:"Run code"}),d("code",{children:d(fl,{language:b,children:Y.Children.map(n,C=>typeof C=="string"?C.trim():C)})})]}))}renderLink(e){const{onLinkClick:n}=this.props,{href:s,children:i,target:o}=e;return d("a",{href:s,onClick:n,target:o,children:i})}render(){const{content:e,transformImageUri:n,transformLinkUri:s}=this.props,{hasCode:i,hasRunCode:o,nextStartLine:r}=this.state;return w("div",{className:"markdown-notebook",children:[d("div",{className:"markdown-notebook-toolbar",children:d(ce,{className:W("btn-play-selected-cell",{flashing:i&&!o}),kind:"ghost",icon:$r,onClick:this.handleRunSelected,tooltip:"Run code and select next",disabled:o&&r==null||!i,children:"Run Selected Code"})}),d("div",{className:"markdown-notebook-content",ref:this.editorScrollView,children:d(Vh,{components:{code:this.renderCodeBlock,a:this.renderLink},linkTarget:"_blank",remarkPlugins:[Up],transformLinkUri:s,transformImageUri:n,includeElementIndex:!0,children:e})})]})}}cp.defaultProps={onRunCode:()=>{}};const Ge=X.module("NotebookPanel"),wh=400,Li=class extends S.exports.Component{constructor(t){super(t),this.getOverflowActions=Ce(()=>[{title:"Find",icon:Tf,action:this.handleFind,group:ie.groups.high,shortcut:Fn.NOTEBOOK.FIND,order:10}]),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.handleEditorChange=this.handleEditorChange.bind(this),this.handleFind=this.handleFind.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.handlePanelTabClick=this.handlePanelTabClick.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.pending=new gs,this.debouncedSavePanelState=Je(this.savePanelState.bind(this),wh),this.debouncedLoad=Je(this.load.bind(this),wh),this.notebook=null,this.tabTitleElement=null,this.tabInitOnce=!1,this.shouldPromptClose=!0;const{isDashboardActive:e,session:n,sessionLanguage:s,panelState:i}=t;let o={value:"",language:""},r=null,{isPreview:l}=t;i!=null&&({fileMetadata:r=r,isPreview:l=l,settings:o=o}=i);const a=r!=null&&he.hasPath(r.itemName),h=a===!0&&o.value!=null||!a&&o.value!=null&&o.value.length>0?1:0;this.state={error:void 0,isDashboardActive:e,isFocused:!1,isLoading:!0,isLoaded:!1,isPreview:l,savedChangeCount:0,changeCount:h,fileMetadata:r,settings:o,session:n,sessionLanguage:s,panelState:{fileMetadata:r,settings:o},showCloseModal:!1,showSaveAsModal:!1,scriptCode:""},Ge.debug("constructor",t,this.state)}static handleError(t){Re.isCanceled(t)||Ge.error(t)}static languageFromFileName(t){switch(he.getExtension(t).toLowerCase()){case"py":case"python":return"python";case"groovy":return"groovy";case"scala":return"scala";default:return null}}componentDidMount(){const{glContainer:t,glEventHub:e}=this.props,{tab:n}=t;n!=null&&this.initTab(n),this.initNotebookContent(),e.on(Be.RENAME_FILE,this.handleRenameFile),t.on("tabClicked",this.handlePanelTabClick)}componentDidUpdate(t,e){const{isPreview:n}=this.state;n!==e.isPreview&&this.setPreviewStatus()}componentWillUnmount(){this.debouncedSavePanelState.flush(),this.pending.cancel();const{glContainer:t,glEventHub:e}=this.props,{fileMetadata:n,isPreview:s}=this.state;e.off(Be.RENAME_FILE,this.handleRenameFile),t.off("tabClicked",this.handlePanelTabClick),e.emit(Be.UNREGISTER_FILE,n,s)}initTab(t){this.tabInitOnce||(this.tabInitOnce=!0,this.initTabCloseOverride()),this.initTabClasses(t)}initTabCloseOverride(){const{glContainer:t}=this.props,e=t.close.bind(t);t.close=()=>{const{changeCount:n,savedChangeCount:s}=this.state;return n!==s&&this.shouldPromptClose?this.setState({showCloseModal:!0}):e(),!0}}initTabClasses(t){const e=t.element.get(0);A(e);const n=e.querySelector(".lm_title");this.tabTitleElement=n,n==null||n.classList.add("notebook-title"),this.setPreviewStatus()}getNotebookValue(){const{changeCount:t,savedChangeCount:e,settings:n}=this.state,{value:s}=n;if(t!==e&&this.notebook){const i=this.notebook.getValue();return i!=null?i:s}return s}initNotebookContent(){const{fileMetadata:t,settings:e,isPreview:n}=this.state;if(t&&t.id){Ge.debug("Init content from file"),this.registerFileMetadata(t,n),this.load();return}if(e.value!=null){Ge.debug("Use content passed in the settings prop"),this.handleLoadSuccess();return}this.handleLoadError(new Error("Missing file metadata"))}closeFileTabById(t){const{glEventHub:e}=this.props;e.emit(Be.CLOSE_FILE,{id:t})}registerFileMetadata(t,e){const{glEventHub:n,metadata:s}=this.props,{id:i}=s;n.emit(Be.REGISTER_FILE,i,t,e)}renameTab(t,e){const{glEventHub:n}=this.props;n.emit(Be.RENAME,t,e)}load(){const{fileMetadata:t,settings:e}=this.state;A(t);const{id:n}=t,{fileStorage:s}=this.props;this.pending.add(s.loadFile(n)).then(i=>{var a;Ge.debug("Loaded file",i);const{filename:o}=i,{itemName:r}=this.state;if(o!==r){const{metadata:c}=this.props,{id:h}=c;this.renameTab(h,he.getBaseName(o))}const l={...e,language:(a=Li.languageFromFileName(o))!=null?a:""};e.value==null&&(l.value=i.content),this.setState({fileMetadata:{id:o,itemName:o},settings:l}),this.debouncedSavePanelState()}).then(this.handleLoadSuccess).catch(this.handleLoadError)}save(){const{fileMetadata:t}=this.state;if(t&&he.hasPath(t.itemName)){const e=this.getNotebookValue();return e!=null?(this.saveContent(t.itemName,e),!0):!1}return this.setState({showSaveAsModal:!0}),!1}saveContent(t,e){Ge.debug("saveContent",t,e),this.updateSavedChangeCount();const{fileStorage:n}=this.props;this.pending.add(n.saveFile({filename:t,content:e,basename:t})).then(this.handleSaveSuccess).catch(this.handleSaveError)}updateSavedChangeCount(){this.setState(({changeCount:t})=>({savedChangeCount:t}))}setPreviewStatus(){if(!this.tabTitleElement)return;const{isPreview:t}=this.state;Ge.debug("setPreviewStatus",this.tabTitleElement,t),t?this.tabTitleElement.classList.add("is-preview"):this.tabTitleElement.classList.remove("is-preview")}savePanelState(){this.setState(t=>{const{changeCount:e,savedChangeCount:n,fileMetadata:s,isPreview:i,settings:o}=t,r=this.getNotebookValue(),l=e!==n?r:null,a={...o,value:r},h={settings:{...o,value:l},fileMetadata:s,isPreview:i};return Ge.debug("Saving panel state",h),{settings:a,panelState:h}})}handleCloseDiscard(){this.shouldPromptClose=!1,this.setState({showCloseModal:!1});const{glContainer:t}=this.props;t.close()}handleCloseSave(){if(this.shouldPromptClose=!1,this.setState({showCloseModal:!1}),this.save()){const{glContainer:t}=this.props;t.close()}}handleCloseCancel(){this.shouldPromptClose=!0,this.setState({showCloseModal:!1})}handleCopy(){const{fileMetadata:t,settings:e}=this.state;A(t);const n=this.getNotebookValue(),{language:s}=e,{itemName:i}=t,o=he.getCopyFileName(i);Ge.debug("handleCopy",t,i,o),this.createNotebook(o,s,n!=null?n:void 0)}handleEditorChange(t){Ge.debug2("handleEditorChanged",t),this.removePreviewStatus(),this.setState(e=>{const{changeCount:n,savedChangeCount:s}=e,{isUndoing:i,isRedoing:o}=t;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()}handleBlur(){Ge.debug("handleBlur"),this.setState({isFocused:!1})}handleFocus(){Ge.debug("handleFocus"),this.setState({isFocused:!0})}handleLinkClick(t){const{notebooksUrl:e,session:n,sessionLanguage:s}=this.props,{href:i}=t.currentTarget;if(!i||!i.startsWith(e))return;t.stopPropagation(),t.preventDefault();const o=`/${i.substring(e.length)}`.replace(/%20/g," ");if(o==="/"){Ge.debug("Ignoring invalid notebook link",o);return}Ge.debug("Notebook link clicked, opening",o);const{glEventHub:r}=this.props,l={value:null,language:s},a={id:o,itemName:o};r.emit(Be.SELECT_NOTEBOOK,n,s,l,a)}handleLoadSuccess(){this.setState({error:void 0,isLoaded:!0,isLoading:!1})}handleLoadError(t){let e=t;Re.isCanceled(e)||(Re.isTimedOut(e)&&(e=new Error("File not found.")),Ge.error(e),this.setState({error:e,isLoading:!1}))}handleSave(){Ge.debug("handleSave"),this.save()}handleSaveSuccess(t){var i;const{fileStorage:e}=this.props,n={id:t.filename,itemName:t.filename},s=(i=Li.languageFromFileName(t.filename))!=null?i:"";this.setState(o=>{const{fileMetadata:r}=o,l={...o.settings,language:s};return Ge.debug("handleSaveSuccess",n,r,l),r&&he.hasPath(r.itemName)&&r.itemName!==n.itemName&&(Ge.debug("handleSaveSuccess deleting old file",r.itemName),e.deleteFile(r.itemName).catch(Li.handleError)),{fileMetadata:n,settings:l,isPreview:!1}}),this.debouncedSavePanelState(),this.registerFileMetadata(n,!1)}handleSaveError(t){Re.isCanceled(t)||(this.setState({savedChangeCount:0}),Ge.error(t))}handleSaveAsCancel(){this.setState({showSaveAsModal:!1})}handleSaveAsSubmit(t){var i;Ge.debug("handleSaveAsSubmit",t);const{fileMetadata:e}=this.state;if(!e)return;const{itemName:n}=e,s=(i=this.getNotebookValue())!=null?i:"";if(this.setState({showSaveAsModal:!1}),he.getBaseName(n)!==he.getBaseName(t)){const{metadata:o}=this.props,{id:r}=o;this.renameTab(r,he.getBaseName(t))}this.saveContent(t,s)}handleRenameFile(t,e){const{fileMetadata:n}=this.state;n&&n.id===t&&(this.setState({fileMetadata:{id:e,itemName:e}}),this.debouncedSavePanelState())}handleResize(){var t;(t=this.notebook)==null||t.updateDimensions()}handleRunCommand(t){this.runCommand(t)}handleRunAll(){var t;if(!this.notebook){Ge.error("Editor is not initialized.");return}this.runCommand((t=this.notebook.getValue())!=null?t:void 0)}handleRunSelected(){if(!this.notebook){Ge.error("Editor is not initialized.");return}this.runCommand(this.notebook.getSelectedCommand())}handleSessionOpened(t,{language:e}){this.setState({session:t,sessionLanguage:e})}handleSessionClosed(){this.setState({session:void 0,sessionLanguage:void 0})}handleShow(){var t;Ge.debug("handleShow"),(t=this.notebook)==null||t.updateDimensions()}handleShowRename(){this.setState({showSaveAsModal:!0})}handleTab(t){Ge.debug("NotebookPanel tab event",t),this.initTab(t)}handleTabFocus(...t){Ge.debug("handleTabFocus",...t);const{glContainer:e}=this.props;this.setState({isDashboardActive:!0}),this.notebook&&!e.isHidden&&this.notebook.updateDimensions()}handleTabBlur(){Ge.debug("handleTabBlur"),this.setState({isDashboardActive:!1})}handlePanelTabClick(){Ge.debug("handlePanelTabClick"),this.focus()}handleTransformLinkUri(t){const{notebooksUrl:e}=this.props,{fileMetadata:n}=this.state;if(t.endsWith("/"))return t;if(t.startsWith("/"))return`${e}${t.substring(1)}`;let s=n==null?void 0:n.itemName;if(s===void 0)return t;s.charAt(0)==="/"&&(s=s.substring(1));const i=new URL(s,e);return new URL(t,i).href}focus(){requestAnimationFrame(()=>{this.notebook&&this.notebook.focus()})}createNotebook(t,e,n=""){const{glEventHub:s}=this.props,{session:i,sessionLanguage:o,settings:r}=this.state,l={...r,language:e,value:n},a={id:null,itemName:t};Ge.debug("handleCreateNotebook",i,o,l,a),s.emit(Be.CREATE_NOTEBOOK,i,o,l,a)}runCommand(t){if(t===void 0){Ge.debug("Ignoring empty command.");return}this.removePreviewStatus();const{glEventHub:e}=this.props;e.emit(wt.SEND_COMMAND,t,!1,!0)}removePreviewStatus(){this.setState(({isPreview:t})=>{if(t){const{fileMetadata:e}=this.state;return e&&this.registerFileMetadata(e,!1),{isPreview:!1}}return null})}render(){var _,L;const{fileStorage:t,glContainer:e,glContainer:{tab:n},glEventHub:s}=this.props,{changeCount:i,savedChangeCount:o,error:r,isDashboardActive:l,isLoaded:a,isLoading:c,isPreview:h,fileMetadata:u,session:m,sessionLanguage:p,settings:g,showCloseModal:f,showSaveAsModal:b}=this.state,C=l&&!e.isHidden&&!h,v=(_=u==null?void 0:u.itemName)!=null?_:Li.DEFAULT_NAME,T=v.endsWith(".md"),E=(u==null?void 0:u.id)!=null,y=this.getOverflowActions(),I={...g},D=m!=null,M=p===I.language,x=!a||!D||!M,B=!a,$=[{action:this.handleSave,shortcut:Os.SAVE}],k=Ad.getDisabledRunTooltip(D,M,"Notebook extension","Run"),H=Ad.getDisabledRunTooltip(D,M,"Notebook extension","Run Selected"),O=[{title:E?"Rename":"Save As\u2026",order:10,group:ie.groups.high,action:this.handleShowRename},{title:"Copy File",action:this.handleCopy,group:ie.groups.high,order:20}],F=n==null?void 0:n.element.find(".lm_title_before").get(0);return w(ue,{children:[F&&ui.createPortal(d("span",{className:W("editor-unsaved-indicator",{"is-unsaved":i!==o})}),F),w(Xn,{className:"notebook-container",componentPanel:this,glContainer:e,glEventHub:s,onTab:this.handleTab,onResize:this.handleResize,onShow:this.handleShow,onTabFocus:this.handleTabFocus,onTabBlur:this.handleTabBlur,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onFocus:this.handleFocus,onBlur:this.handleBlur,additionalActions:O,renderTabTooltip:()=>v,children:[!T&&w(ue,{children:[w("div",{className:"notebook-toolbar",children:[w("span",{children:[w("button",{type:"button",className:"btn btn-link btn-link-icon btn-play",onClick:this.handleRunAll,disabled:x,children:[d(z,{icon:$r,transform:"grow-4"}),w(pe,{children:["Run ",Fn.NOTEBOOK.RUN.getDisplayText()]})]}),k!=null&&d(pe,{children:k})]}),w("span",{children:[w("button",{type:"button",className:"btn btn-link btn-link-icon btn-play",onClick:this.handleRunSelected,disabled:x,children:[d(z,{icon:Lf,transform:"grow-4"}),w(pe,{children:["Run Selected"," ",Fn.NOTEBOOK.RUN_SELECTED.getDisplayText()]})]}),H!=null&&d(pe,{children:H})]}),w("button",{type:"button",className:"btn btn-link btn-link-icon mr-auto",disabled:B,onClick:this.handleSave,children:[d(z,{icon:Zh}),d(pe,{children:"Save"})]}),w("button",{type:"button",className:"btn btn-link btn-overflow btn-link-icon",disabled:B,children:[d(z,{icon:Xh}),d(pe,{children:"More Actions..."}),d(zn,{actions:y,popperOptions:Li.POPPER_OPTIONS})]})]}),d(Vu,{isLoaded:a,isLoading:c,error:r,onChange:this.handleEditorChange,onRunCommand:this.handleRunCommand,session:m,sessionLanguage:p,settings:I,focusOnMount:C,ref:V=>{this.notebook=V}})]}),T&&d(cp,{content:(L=I.value)!=null?L:"",onLinkClick:this.handleLinkClick,onRunCode:this.handleRunCommand,transformImageUri:this.handleTransformLinkUri,transformLinkUri:this.handleTransformLinkUri}),d(Al,{isOpen:b,type:"file",defaultValue:v,title:E?"Rename":"Save file as",onSubmit:this.handleSaveAsSubmit,onCancel:this.handleSaveAsCancel,notifyOnExtensionChange:!0,storage:t}),d(Wi,{isOpen:f,headerText:`Do you want to save the changes you made to ${v}?`,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"}),d(ie,{actions:$})]})]})}};let Yo=Li;Yo.COMPONENT="NotebookPanel";Yo.POPPER_OPTIONS={placement:"bottom-end"};Yo.DEFAULT_NAME="Untitled";Yo.defaultProps={isDashboardActive:!0,isPreview:!1,session:null,sessionLanguage:null};const mE=(t,e)=>{const n=Xu(t),s=Ci(t,e.localDashboardId),{session:i,config:o}=s!=null?s:{},{type:r}=o!=null?o:{};return{fileStorage:n,session:i,sessionLanguage:r}},Ys=xt(mE,null,null,{forwardRef:!0})(Yo);class _o extends S.exports.Component{constructor(e){super(e),this.irisGridRef=Y.createRef(),this.buttonRef=Y.createRef(),this.handleReload=this.handleReload.bind(this),this.handleGridStateChange=this.handleGridStateChange.bind(this),this.handlePanelStateUpdate=this.handlePanelStateUpdate.bind(this);const{panelState:n}=e;this.state={shouldFocusGrid:!1,panelState:n}}handleReload(){var e,n;(e=this.irisGridRef.current)==null||e.initModel(),(n=this.buttonRef.current)==null||n.blur(),this.setState({shouldFocusGrid:!0})}handleGridStateChange(){var n,s,i;const{shouldFocusGrid:e}=this.state;e&&((i=(s=(n=this.irisGridRef.current)==null?void 0:n.irisGrid)==null?void 0:s.current)==null?void 0:i.grid)&&(this.irisGridRef.current.irisGrid.current.grid.focus(),this.setState({shouldFocusGrid:!1}))}handlePanelStateUpdate(e){this.setState({panelState:e})}render(){const{...e}=this.props;return d(hi,{ref:this.irisGridRef,onStateChange:this.handleGridStateChange,onPanelStateUpdate:this.handlePanelStateUpdate,...e,children:w("button",{ref:this.buttonRef,type:"button",className:"btn btn-primary btn-pandas",onClick:this.handleReload,children:["pandas dataframe",w("span",{children:[d(z,{icon:Ja,transform:"shrink-1",className:"mr-1"}),"Reload"]}),d(pe,{children:"Click to refresh pandas dataframe, updates do not occur automatically."})]})})}}_o.defaultProps={panelState:null};_o.COMPONENT="PandasPanel";const pE=t=>{Ps(t);const{id:e,layout:n,registerComponent:s,hydrate:i}=t,o=S.exports.useCallback(({dragEvent:r,fetch:l,panelId:a=qe.generate(),widget:c})=>{const{name:h,type:u}=c;if(u!==dh.VariableType.FIGURE)return;const m={name:h,figure:h},p=()=>l().then(b=>Ki.makeModel(void 0,b)),g={type:"react-component",component:$i.COMPONENT,props:{localDashboardId:e,id:a,metadata:m,makeModel:p},title:h,id:a},{root:f}=n;J.openComponent({root:f,config:g,dragEvent:r})},[e,n]);return S.exports.useEffect(function(){const l=[s($i.COMPONENT,$i,i)];return()=>{l.forEach(a=>a())}},[i,s]),Xe(n.eventHub,Fe.OPEN,o),d(ue,{})},gE=t=>{Ps(t);const{id:e,layout:n}=t,s=S.exports.useCallback(({metadata:i,panelId:o=qe.generate(),table:r})=>{const{settings:l}=i,a=()=>Ki.makeModelFromSettings(l,r),c=Pe.titleFromSettings(l),h={type:"react-component",component:$i.COMPONENT,props:{localDashboardId:e,id:o,metadata:i,makeModel:a},title:c,id:o},{root:u}=n;J.openComponent({root:u,config:h})},[e,n]);return Xe(n.eventHub,yt.CREATE_CHART,s),d(ue,{})},ut=X.module("ConsolePlugin");function vh(t){return t.notebook!==void 0}function fE(t){Ps(t)}const CE=t=>{fE(t);const{id:e,hydrateConsole:n,layout:s,panelManager:i,registerComponent:o,notebooksUrl:r}=t,l=S.exports.useRef(0),[a]=S.exports.useState(new Map),[c]=S.exports.useState(new Map),h=Wa(),u=S.exports.useCallback(()=>i.getLastUsedPanelOfType(Pi),[i]),m=S.exports.useCallback((F,_=!0,L=!0)=>{if(!(F&&F.trim()))ut.info("Ignoring empty code");else{const G=u();if(!G||!(G instanceof Pi.WrappedComponent)){ut.error("Console panel not found");return}ut.debug("Send command: ",F,_,L),G.addCommand(F,_,L)}},[u]),p=S.exports.useCallback(F=>{h(LT(e,F))},[h,e]),g=S.exports.useCallback(({language:F})=>{const _=F==="python"?"py":F;let L=null;return _==null?(ut.debug("No extension for language",F),L=`Untitled-${l.current}`):L=`Untitled-${l.current}.${_}`,l.current+=1,L},[]),f=S.exports.useCallback((F,_=!0)=>{const{id:L}=F;return L!=null&&a.has(L)?a.get(L):L!=null&&c.has(L)?c.get(L):_?qe.generate():null},[a,c]),b=S.exports.useCallback((F,_)=>{J.renameComponent(s.root,{id:F},_)},[s.root]),C=S.exports.useCallback((F,_)=>{ut.debug("Rename file panel",F,_);let L;if(a.has(F)&&(L=a.get(F),a.delete(F),L!=null&&a.set(_,L)),c.has(F)&&(L=c.get(F),c.delete(F),L!=null&&c.set(_,L)),L===void 0){ut.debug2(`File ${F} isn't open, no need to rename the tab`);return}b(L,he.getBaseName(_))},[a,c,b]),v=S.exports.useCallback(F=>{const _=f(F,!1);if(_==null){ut.error("Could not find panel id for file metadata",F);return}J.activateTab(s.root,{id:_})},[f,s.root]),T=S.exports.useCallback((F,_,L)=>{if(ut.debug("registerFilePanel",F,_,L),_==null||_.id==null){ut.debug("Ignore empty file id",_);return}const{id:V}=_;if(L){c.set(V,F);return}if(a.has(V)){const G=a.get(V);if(F===G){ut.debug(`Update tab title for file ${V}`);const{itemName:j}=_;C(V,he.getBaseName(j))}else ut.error(`File ${V} already associated with a different tab ${G}`);return}a.set(V,F),c.has(V)&&c.delete(V)},[a,c,C]),E=S.exports.useCallback((F,_)=>{if(ut.debug("unregisterFileTab",F,_),F==null||F.id==null){ut.debug("Ignore empty file id",F);return}const{id:L}=F;if(_){c.delete(L);return}a.delete(L)},[a,c]),y=S.exports.useCallback(F=>{ut.debug("closeFilePanel",F);const{id:_}=F;let L=null,V=!1;if(a.has(_))L=a.get(_);else if(c.has(_))L=c.get(_),V=!0;else{ut.debug(`File ${_} isn't open, ignore close event`);return}E(F,V),J.closeComponent(s.root,{id:L})},[s.root,a,c,E]),I=S.exports.useCallback(F=>{const{itemName:_}=F;return he.getBaseName(_)},[]),D=S.exports.useCallback(F=>{const{id:_}=F;return ut.debug("fileIsOpen",F,_,a),_!=null&&a.has(_)},[a]),M=S.exports.useCallback(F=>{const{id:_}=F;return ut.debug("fileIsOpenAsPreview",F,_,c),_!=null&&c.has(_)},[c]),x=S.exports.useCallback(F=>{if(F==null)return;const _=i.getOpenedPanelById(F);_&&vh(_)&&_.focus()},[i]),B=S.exports.useCallback(({id:F,settings:_,fileMetadata:L,session:V,sessionLanguage:G,isPreview:j=!1})=>{const ne={settings:_,fileMetadata:L},ye=I(L);return{type:"react-component",component:Ys.COMPONENT,isFocusOnShow:!1,props:{localDashboardId:e,metadata:{id:F},session:V,sessionLanguage:G,panelState:ne,isPreview:j,notebooksUrl:r},title:ye,id:F}},[I,e,r]),$=S.exports.useCallback((F,_,L,V={id:null,itemName:g(L)})=>{const G=f(V);if(D(V)&&G!=null){ut.debug("File is already open, focus panel"),v(V),x(G);return}const j=J.getStackForComponentTypes(s.root,[Ys.COMPONENT]),ne=B({id:G,settings:L,fileMetadata:V,session:F,sessionLanguage:_});ut.debug("createNotebook",ne,a),J.openComponentInStack(j,ne)},[D,x,g,f,s.root,B,a,v]),k=S.exports.useCallback((F,_,L,V,G=!1)=>{ut.debug("selectNotebook",V,G);const j=D(V),ne=M(V);if(j){if(v(V),G){const Z=f(V);x(Z)}return}if(ne&&!G){v(V);return}const[ye]=Array.from(c.values());let le=null,Te=null;ye!=null&&(le=ye,Te=J.getStackForConfig(s.root,{component:Ys.COMPONENT,id:le})),Te==null&&(le=f(V),Te=J.getStackForComponentTypes(s.root,[Ys.COMPONENT]));const He=B({id:le,settings:L,fileMetadata:V,session:F,sessionLanguage:_,isPreview:!G});J.openComponentInStack(Te,He),G&&x(le)},[v,D,M,x,f,s.root,B,c]),H=S.exports.useCallback((F,_,L={},V=!0)=>{const G=i.getLastUsedPanelOfType(Ys);G&&vh(G)?L!=null&&L.value!=null&&G.notebook!=null&&G.notebook.append(L.value):V&&$(F,_,L)},[$,i]),O=S.exports.useCallback((F,_)=>Ra.hydrate({...F,notebooksUrl:r},_),[r]);return S.exports.useEffect(function(){const _=[o(Pi.COMPONENT,Pi,n),o(Qr.COMPONENT,Qr),o(Zr.COMPONENT,Zr),o(el.COMPONENT,el),o(Ys.COMPONENT,Ys,O)];return()=>{_.forEach(L=>L())}},[o,n,O]),Xe(s.eventHub,wt.SEND_COMMAND,m),Xe(s.eventHub,wt.SETTINGS_CHANGED,p),Xe(s.eventHub,Be.CLOSE_FILE,y),Xe(s.eventHub,Be.CREATE_NOTEBOOK,$),Xe(s.eventHub,Be.SELECT_NOTEBOOK,k),Xe(s.eventHub,Be.RENAME,b),Xe(s.eventHub,Be.RENAME_FILE,C),Xe(s.eventHub,Be.SEND_TO_NOTEBOOK,H),Xe(s.eventHub,Be.REGISTER_FILE,T),Xe(s.eventHub,Be.UNREGISTER_FILE,E),d(ue,{})},vo=X.module("FilterPlugin");function Th(t,e){return t.concat(e)}const bE=t=>{Ps(t);const{id:e,layout:n,registerComponent:s}=t,i=Wa(),[o]=S.exports.useState(()=>new Map),[r]=S.exports.useState(()=>new Map),[l]=S.exports.useState(()=>new Map),a=S.exports.useCallback(()=>{const b=Array.from(o.values()).reduce(Th,[]).sort((T,E)=>{const y=on.toLower(T.name),I=on.toLower(E.name);if(y!==I)return y>I?1:-1;const D=on.toLower(T.type),M=on.toLower(E.type);return D!==M?D>M?1:-1:0}).reduce((T,E)=>((T.length===0||on.toLower(T[T.length-1].name)!==on.toLower(E.name)||on.toLower(T[T.length-1].type)!==on.toLower(E.type))&&T.push(E),T),[]),C=Array.from(r.values()).reduce(Th,[]).sort((T,E)=>T.timestamp-E.timestamp),v=new Map(l);vo.debug("sendUpdate",{columns:b,filters:C,tableMap:v}),i(Yn(e,{columns:b,filters:C,tableMap:v}))},[i,e,o,r,l]),c=S.exports.useCallback((b,C)=>{vo.debug2("handleColumnsChanged",b,C),o.set(b,[].concat(C)),a()},[o,a]),h=S.exports.useCallback((b,C)=>{vo.debug2("handleFiltersChanged",b,C),r.set(b,[].concat(C)),a()},[r,a]),u=S.exports.useCallback((b,C)=>{vo.debug2("handleTableChanged",b,C),l.set(J.getIdFromPanel(b),C),a()},[l,a]),m=S.exports.useCallback(b=>{vo.debug2("handlePanelUnmount",b),o.delete(b),r.delete(b),l.delete(J.getIdFromPanel(b)),a()},[o,r,l,a]),p=S.exports.useCallback(({title:b="DropdownFilter",metadata:C={},panelState:v=null,id:T=qe.generate(),focusElement:E=J.DEFAULT_FOCUS_SELECTOR,createNewStack:y=!1,dragEvent:I=null})=>{const D={type:"react-component",component:di.COMPONENT,props:{id:T,metadata:C,panelState:v,localDashboardId:e},title:b,id:T},{root:M}=n;J.openComponent({root:M,config:D,focusElement:E,createNewStack:y,dragEvent:I})},[n,e]),g=S.exports.useCallback(({title:b="InputFilter",metadata:C={},panelState:v=null,id:T=qe.generate(),focusElement:E=J.DEFAULT_FOCUS_SELECTOR,createNewStack:y=!1,dragEvent:I=null})=>{const D={type:"react-component",component:xo.COMPONENT,props:{id:T,metadata:C,panelState:v,localDashboardId:e},title:b,id:T},{root:M}=n;J.openComponent({root:M,config:D,focusElement:E,createNewStack:y,dragEvent:I})},[n,e]),f=S.exports.useCallback(({title:b="FilterSets",metadata:C={},panelState:v=null,id:T=qe.generate(),focusElement:E=J.DEFAULT_FOCUS_SELECTOR,createNewStack:y=!1,dragEvent:I=null})=>{const D={type:"react-component",component:ma.COMPONENT,props:{id:T,metadata:C,panelState:v,localDashboardId:e},title:b,id:T},{root:M}=n;J.openComponent({root:M,config:D,focusElement:E,createNewStack:y,dragEvent:I})},[n,e]);return S.exports.useEffect(function(){const C=[s(di.COMPONENT,di),s(xo.COMPONENT,xo),s(ma.COMPONENT,ma)];return()=>{C.forEach(v=>v())}},[s]),Xe(n.eventHub,Ue.COLUMNS_CHANGED,c),Xe(n.eventHub,Ue.FILTERS_CHANGED,h),Xe(n.eventHub,Ue.TABLE_CHANGED,u),Xe(n.eventHub,Ue.OPEN_DROPDOWN,p),Xe(n.eventHub,Ue.OPEN_INPUT,g),Xe(n.eventHub,Ue.OPEN_FILTER_SET_MANAGER,f),Xe(n.eventHub,Fe.UNMOUNT,m),d(ue,{})},SE=[dh.VariableType.TABLE,dh.VariableType.TREETABLE],wE=t=>{Ps(t);const{getDownloadWorker:e,loadPlugin:n,id:s,layout:i,registerComponent:o,hydrate:r,theme:l}=t,a=S.exports.useCallback(({dragEvent:c,fetch:h,panelId:u=qe.generate(),widget:m})=>{const{name:p,type:g}=m;if(!SE.includes(g))return;const f={name:p,table:p},b=()=>h().then(T=>_c.makeModel(T)),C={type:"react-component",component:hi.COMPONENT,props:{getDownloadWorker:e,loadPlugin:n,localDashboardId:s,id:u,metadata:f,makeModel:b,theme:l},title:p,id:u},{root:v}=i;J.openComponent({root:v,config:C,dragEvent:c})},[e,s,i,n,l]);return S.exports.useEffect(function(){const h=[o(hi.COMPONENT,hi,r)];return()=>{h.forEach(u=>u())}},[r,o]),Xe(i.eventHub,Fe.OPEN,a),d(ue,{})};function dp(t){return typeof t.getCoordinateForColumn=="function"}function Eh(t){const e=t;return dp(t)&&typeof e.setFilterMap=="function"&&typeof e.unsetFilterValue=="function"}const To=X.module("LinkerUtils"),hp=class{static getLinkType(t,e,n){var l;if((t==null?void 0:t.panelId)==null||(e==null?void 0:e.panelId)==null||t.panelId===e.panelId||n!=null&&n!==t.panelId&&n!==e.panelId)return To.debug2("Incompatible panel ids",t,e,n),"invalid";if(t.panelComponent==null||e.panelComponent==null)return To.error("PanelComponent should not be null",t,e),"invalid";const s=(l=hp.ALLOWED_LINKS.get(t.panelComponent))==null?void 0:l.includes(e.panelComponent);if(s===void 0||!s)return To.debug2("Incompatible panel components",t,e),"invalid";const{columnType:i}=t,{columnType:o}=e;if(!(o===null||P.isCompatibleType(i,o)))return To.debug2("Incompatible type",i,o),"invalid";switch(e.panelComponent){case J.getComponentName($i):case J.getComponentName(hi):return"tableLink";case J.getComponentName(di):return"filterSource"}return To.debug2("Incompatible target panel component",e.panelComponent),"invalid"}static findColumn(t,{columnName:e,columnType:n}){return t.find(({name:s,type:i})=>s===e&&i===n)}static cloneLinksForPanel(t,e,n){const s=[];return t.forEach(i=>{var o;i.start.panelId===e&&i.type!=="filterSource"?s.push({...i,id:qe.generate(),start:{...i.start,panelId:n}}):((o=i.end)==null?void 0:o.panelId)===e&&s.push({...i,id:qe.generate(),end:{...i.end,panelId:n}})}),s}};let si=hp;si.ALLOWED_LINKS=new Map([[J.getComponentName(hi),[J.getComponentName(hi),J.getComponentName($i),J.getComponentName(di)]]]);const yh=.015,Ih=1.5,up=12,mp=12,Rh=2,Nr=Math.sqrt((mp*.5)**2+up**2),Dh=Math.asin(mp*.5/up),Nh=15,Aa=class extends S.exports.PureComponent{static makeCirclePath(t,e,n){return`M ${t} ${e} m -${n},0 a ${n},${n} 0 1,0 ${n*2},0 a ${n},${n} 0 1,0 -${n*2},0 z`}constructor(t){super(t),this.handleClick=this.handleClick.bind(this)}handleClick(t){t.stopPropagation(),t.preventDefault();const{id:e,onClick:n}=this.props;n(e)}render(){const{className:t,x1:e,y1:n,x2:s,y2:i,id:o}=this.props,r=Math.sqrt((e-s)**2+(n-i)**2),l=Math.atan2(i-n,s-e),a=Math.sin(l),c=Math.cos(l)+2,h=window.innerWidth,u=window.innerHeight,m=0,p=0,g=Math.max(m,Math.min(e+(s-e)/2+a*(r*yh)**Ih,h)),f=Math.max(p,Math.min(n+(i-n)/2+c*(r*yh)**Ih,u)),b=`M ${e} ${n} Q ${g} ${f} ${s} ${i}`,C=`M ${m} ${p} L ${m} ${u} L ${h} ${u} L ${h} ${p} z
38
+ ${Aa.makeCirclePath(e,n,Nh)}
39
+ ${Aa.makeCirclePath(s,i,Nh)}`,v=`link-select-clip-${o}`,T=Math.atan2(i-f,s-g),E=T-Dh+Math.PI,y=T+Dh+Math.PI,I=s+Math.cos(T)*Rh,D=i+Math.sin(T)*Rh,M=I+Math.cos(E)*Nr,x=D+Math.sin(E)*Nr,B=I+Math.cos(y)*Nr,$=D+Math.sin(y)*Nr,k=`${I},${D} ${M},${x} ${B},${$}`;return w("svg",{className:t,children:[d("clipPath",{id:v,children:d("path",{d:C,clipRule:"evenodd"})}),d("path",{className:"link-select",d:b,onClick:this.handleClick,clipPath:`url(#${v})`}),d("path",{className:"link-background",d:b}),d("path",{className:"link-foreground",d:b}),d("circle",{className:"link-dot",cx:e,cy:n,r:"5"}),d("polygon",{className:"link-triangle",points:k})]})}};let pp=Aa;pp.defaultProps={className:"",onClick(){}};const pa=X.module("LinkerOverlayContent");class gp extends S.exports.Component{constructor(e){super(e),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleEscapePressed=this.handleEscapePressed.bind(this),this.state={mouseX:void 0,mouseY:void 0}}componentDidMount(){window.addEventListener("mousemove",this.handleMouseMove,!0)}componentDidCatch(e,n){pa.error("componentDidCatch",e,n)}componentWillUnmount(){window.removeEventListener("mousemove",this.handleMouseMove,!0)}getPointFromLinkPoint(e){const{panelManager:n}=this.props,{panelId:s,columnName:i}=e,o=n.getOpenedPanelById(s);if(o!=null){if(!dp(o))throw new Error(`Panel does not have getCoordinateForColumn method: ${s}`);try{const l=o.getCoordinateForColumn(i);if(l!=null)return l}catch{pa.error("Could not get coordinate for column",i,o)}}const r=n.getContainerByPanelId(s);if(r==null)throw new Error(`Unable to find panel container for id: ${s}`);return J.getTabPoint(r)}handleMouseMove(e){this.setState({mouseX:e.clientX,mouseY:e.clientY})}handleEscapePressed(){const{onCancel:e}=this.props;e()}render(){const{disabled:e,links:n,messageText:s,onLinkDeleted:i,onAllLinksDeleted:o,onDone:r}=this.props,{mouseX:l,mouseY:a}=this.state,c=n.map(h=>{try{const{id:u,type:m,isReversed:p,start:g,end:f}=h;let[b,C]=this.getPointFromLinkPoint(g),v=l!=null?l:b,T=a!=null?a:C;if(f!=null&&([v,T]=this.getPointFromLinkPoint(f)),p!=null&&p){const[y,I]=[b,C];[b,C]=[v,T],[v,T]=[y,I]}const E=W("linker-link",{disabled:e},{"link-filter-source":m==="filterSource"},{"link-invalid":m==="invalid"},{interactive:h.end==null});return{x1:b,y1:C,x2:v,y2:T,id:u,className:E}}catch(u){return pa.error("Unable to get point for link",h,u),null}}).filter(h=>h!=null);return w("div",{className:"linker-overlay",children:[d("svg",{children:c.map(({x1:h,y1:u,x2:m,y2:p,id:g,className:f})=>d(pp,{className:f,id:g,x1:h,y1:u,x2:m,y2:p,onClick:i},g))}),w("div",{className:"linker-toast-dialog",children:[d("div",{className:"toast-body",children:s}),w("div",{className:"toast-footer",children:[d("button",{className:"btn btn-outline-primary",onClick:o,type:"button",children:"Clear All"}),d("button",{className:"btn btn-primary",onClick:r,type:"button",children:"Done"})]})]}),d(ie,{actions:[{action:this.handleEscapePressed,shortcut:Os.LINKER_CLOSE,isGlobal:!0}]})]})}}gp.defaultProps={disabled:"false"};const zt=X.module("Linker"),vE=(t,e)=>({activeTool:vl(t),isolatedLinkerPanelId:Oc(t,e.localDashboardId),links:ro(t,e.localDashboardId),timeZone:wl(t)}),TE=xt(vE,{setActiveTool:Tl,setDashboardLinks:Pc,addDashboardLinks:FT,deleteDashboardLinks:xT,setDashboardIsolatedLinkerPanelId:tp,setDashboardColumnSelectionValidator:_T});class EE extends S.exports.Component{constructor(e){super(e),this.getCachedLinks=Ce((n,s,i)=>{const o=[...n];return s!=null&&s.start!=null&&o.push(s),i!==void 0?o.filter(r=>{var l,a;return((l=r==null?void 0:r.start)==null?void 0:l.panelId)===i||((a=r==null?void 0:r.end)==null?void 0:a.panelId)===i||(r==null?void 0:r.end)==null}):o}),this.handleCancel=this.handleCancel.bind(this),this.handleDone=this.handleDone.bind(this),this.handlePanelCloned=this.handlePanelCloned.bind(this),this.handleFilterColumnSelect=this.handleFilterColumnSelect.bind(this),this.handleColumnsChanged=this.handleColumnsChanged.bind(this),this.handlePanelClosed=this.handlePanelClosed.bind(this),this.handleLayoutStateChanged=this.handleLayoutStateChanged.bind(this),this.handleAllLinksDeleted=this.handleAllLinksDeleted.bind(this),this.handleLinkDeleted=this.handleLinkDeleted.bind(this),this.handleChartColumnSelect=this.handleChartColumnSelect.bind(this),this.handleGridColumnSelect=this.handleGridColumnSelect.bind(this),this.handleUpdateValues=this.handleUpdateValues.bind(this),this.handleStateChange=this.handleStateChange.bind(this),this.handleExited=this.handleExited.bind(this),this.isColumnSelectionValid=this.isColumnSelectionValid.bind(this),this.state={linkInProgress:void 0}}componentDidMount(){const{layout:e}=this.props;this.startListening(e),this.updateSelectionValidators()}componentDidUpdate(e){const{activeTool:n,layout:s}=this.props;s!==e.layout&&(this.stopListening(e.layout),this.startListening(s)),n!==e.activeTool&&this.updateSelectionValidators()}componentDidCatch(e,n){zt.error("componentDidCatch",e,n)}componentWillUnmount(){const{layout:e}=this.props;this.stopListening(e)}startListening(e){e.on("stateChanged",this.handleLayoutStateChanged);const{eventHub:n}=e;n.on(yt.COLUMN_SELECTED,this.handleGridColumnSelect),n.on(yt.DATA_SELECTED,this.handleUpdateValues),n.on(yt.STATE_CHANGED,this.handleStateChange),n.on(Yi.COLUMN_SELECTED,this.handleChartColumnSelect),n.on(Fe.CLONED,this.handlePanelCloned),n.on(Ue.COLUMN_SELECTED,this.handleFilterColumnSelect),n.on(Ue.COLUMNS_CHANGED,this.handleColumnsChanged),n.on(Fe.CLOSED,this.handlePanelClosed)}stopListening(e){e.off("stateChanged",this.handleLayoutStateChanged);const{eventHub:n}=e;n.off(yt.COLUMN_SELECTED,this.handleGridColumnSelect),n.off(yt.DATA_SELECTED,this.handleUpdateValues),n.off(yt.STATE_CHANGED,this.handleStateChange),n.off(Yi.COLUMN_SELECTED,this.handleChartColumnSelect),n.off(Fe.CLONED,this.handlePanelCloned),n.off(Ue.COLUMN_SELECTED,this.handleFilterColumnSelect),n.off(Ue.COLUMNS_CHANGED,this.handleColumnsChanged),n.off(Fe.CLOSED,this.handlePanelClosed)}handleCancel(){const{linkInProgress:e}=this.state;if(e==null){const{setActiveTool:n}=this.props;n(mn.DEFAULT)}this.setState({linkInProgress:void 0})}handleDone(){const{setActiveTool:e}=this.props;e(mn.DEFAULT),this.setState({linkInProgress:void 0})}handleChartColumnSelect(e,n){this.columnSelected(e,n,!0)}handleFilterColumnSelect(e,n){zt.debug("handleFilterColumnSelect",this.isOverlayShown());const{links:s,localDashboardId:i,setActiveTool:o,setDashboardIsolatedLinkerPanelId:r}=this.props,l=J.getIdFromPanel(e),a=s.filter(c=>{var h,u;return((h=c.start)==null?void 0:h.panelId)===l||((u=c.end)==null?void 0:u.panelId)===l});if(!this.isOverlayShown()&&l!=null){o(mn.LINKER),r(i,l),a.length===0&&this.columnSelected(e,n,!0,l);return}this.columnSelected(e,n,!0)}handleColumnsChanged(e,n){zt.debug("handleColumnsChanged",e,n);const{links:s}=this.props,i=J.getIdFromPanel(e);if(i==null){zt.error("Invalid panelId",e);return}const o=s.filter(({start:r,end:l})=>r.panelId===i&&si.findColumn(n,r)==null||l!=null&&l.panelId===i&&si.findColumn(n,l)==null);this.deleteLinks(o)}handleGridColumnSelect(e,n){this.columnSelected(e,n)}columnSelected(e,n,s=!1,i){if(i===void 0&&!this.isOverlayShown())return;const{isolatedLinkerPanelId:o}=this.props,{linkInProgress:r}=this.state,l=J.getIdFromPanel(e);if(l==null)return;const a=J.getComponentNameFromPanel(e),{name:c,type:h}=n;if(r==null||r.start==null){const u={id:qe.generate(),start:{panelId:l,panelComponent:a,columnName:c,columnType:h},type:"invalid",isReversed:s};zt.debug("starting link",u),this.setState({linkInProgress:u})}else{const{start:u,id:m,isReversed:p}=r,g={panelId:l,panelComponent:a,columnName:c,columnType:h},f=si.getLinkType(p!==void 0&&p?g:u,p!==void 0&&p?u:g,i!=null?i:o);switch(f){case"invalid":zt.debug("Ignore invalid link connection",r,g);return;case"filterSource":{const{links:C}=this.props,v=p!==void 0&&p?u.panelId:g.panelId,T=C.filter(({end:E})=>(E==null?void 0:E.panelId)===v);this.deleteLinks(T);break}}const b={start:p!==void 0&&p?g:u,end:p!==void 0&&p?u:g,id:m,type:f};zt.info("creating link",b),this.setState({linkInProgress:void 0},()=>{this.addLinks([b])})}}unsetFilterValueForLink(e){const{panelManager:n}=this.props;if(e.end){const{end:s}=e,{panelId:i,columnName:o,columnType:r}=s,l=n.getOpenedPanelById(i);l?Eh(l)?l.unsetFilterValue(o,r):zt.debug("endPanel.unsetFilterValue not implemented",l):zt.debug("endPanel no longer exists, ignoring unsetFilterValue",i)}}setPanelFilterMap(e,n){zt.debug("Set filter data for panel:",e,n);const{panelManager:s}=this.props,i=s.getOpenedPanelById(e);i?Eh(i)?i.setFilterMap(n):zt.debug("panel.setFilterMap not implemented",e,i):zt.debug("panel no longer exists, ignoring setFilterMap",e)}addLinks(e){const{addDashboardLinks:n,localDashboardId:s}=this.props;n(s,e)}deleteLinks(e,n=!1){const{localDashboardId:s}=this.props;if(e.forEach(i=>this.unsetFilterValueForLink(i)),n){const{setDashboardLinks:i}=this.props;i(s,[])}else if(e.length>0){const{deleteDashboardLinks:i}=this.props;i(s,e.map(({id:o})=>o))}}handleAllLinksDeleted(){const{links:e,isolatedLinkerPanelId:n}=this.props;if(n===void 0)this.deleteLinks(e,!0);else{const s=e.filter(i=>{var o,r;return((o=i==null?void 0:i.start)==null?void 0:o.panelId)===n||((r=i==null?void 0:i.end)==null?void 0:r.panelId)===n});this.deleteLinks(s)}this.setState({linkInProgress:void 0})}handleLinkDeleted(e){const{links:n}=this.props,s=n.find(i=>i.id===e);s?this.deleteLinks([s]):zt.error("Unable to find link to delete",e)}handleUpdateValues(e,n){const s=J.getIdFromPanel(e),{links:i,timeZone:o}=this.props,r=new Map;for(let l=0;l<i.length;l+=1){const{start:a,end:c}=i[l];if(a.panelId===s&&c!=null){const{panelId:h,columnName:u,columnType:m}=c,p=r.has(h)?r.get(h):new Map,{value:g}=n[a.columnName];let f=`${g}`;m!=null&&P.isDateType(m)&&(f=new ht({timeZone:o,showTimeZone:!1,showTSeparator:!0,defaultDateTimeFormatString:ms.FULL_DATE_FORMAT}).format(g)),p.set(u,{columnType:m,text:f,value:g}),r.set(h,p)}}r.forEach((l,a)=>{this.setPanelFilterMap(a,l)})}handlePanelCloned(e,n){const{links:s}=this.props,i=J.getIdFromPanel(e),o=n.id;if(i!=null){const r=si.cloneLinksForPanel(s,i,o);this.addLinks(r)}}handlePanelClosed(e){zt.debug(`Panel ${e} closed, deleting links.`),this.deleteLinksForPanelId(e)}handleLayoutStateChanged(){this.forceUpdate()}handleStateChange(){this.forceUpdate()}handleExited(){const{localDashboardId:e,setDashboardIsolatedLinkerPanelId:n}=this.props;n(e,void 0)}deleteLinksForPanelId(e){const{links:n}=this.props;for(let s=0;s<n.length;s+=1){const i=n[s],{start:o,end:r,id:l}=i;(o.panelId===e||(r==null?void 0:r.panelId)===e)&&this.handleLinkDeleted(l)}}isOverlayShown(){const{activeTool:e}=this.props;return e===mn.LINKER}updateSelectionValidators(){const{activeTool:e,setDashboardColumnSelectionValidator:n,localDashboardId:s}=this.props;switch(e){case mn.LINKER:n(s,this.isColumnSelectionValid);break;default:n(s,void 0);break}}updateLinkInProgressType(e,n="invalid"){this.setState({linkInProgress:{...e,type:n}})}isColumnSelectionValid(e,n){const{linkInProgress:s}=this.state,{isolatedLinkerPanelId:i}=this.props;if((s==null?void 0:s.start)==null)return!0;if(n==null)return this.updateLinkInProgressType(s),!1;const{isReversed:o,start:r}=s,l=J.getIdFromPanel(e);if(l==null)return!1;const a={panelId:l,panelComponent:J.getComponentNameFromPanel(e),columnName:n.name,columnType:n.type},c=o!==void 0&&o?si.getLinkType(a,r,i):si.getLinkType(r,a,i);return this.updateLinkInProgressType(s,c),c!=="invalid"}render(){const{links:e,isolatedLinkerPanelId:n,panelManager:s}=this.props,{linkInProgress:i}=this.state,o=this.isOverlayShown(),r=i!=null&&i.start!=null,l=n===void 0?"Click a column source, then click a column target to create a filter link. Remove a filter link by clicking again to erase. Click done when finished.":"Create a link between the source column button and a table column by clicking on one, then the other. Remove the link by clicking it directly. Click done when finished.";return d(ue,{children:d(gt,{in:o,timeout:It.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,onExited:this.handleExited,children:d(gp,{disabled:r,panelManager:s,links:this.getCachedLinks(e,i,n),messageText:l,onLinkDeleted:this.handleLinkDeleted,onAllLinksDeleted:this.handleAllLinksDeleted,onDone:this.handleDone,onCancel:this.handleCancel})})})}}const yE=TE(EE),IE=t=>{Ps(t);const{id:e,layout:n,panelManager:s}=t;return d(yE,{layout:n,localDashboardId:e,panelManager:s})},Pa=class{static getNewMarkdownTitle(t){let e=`${Pa.DEFAULT_TITLE}`,n=0;for(;t.indexOf(e)>=0;)n+=1,e=`${Pa.DEFAULT_TITLE}-${n}`;return e}};let Lo=Pa;Lo.DEFAULT_TITLE="Note";Lo.DEFAULT_CONTENT=`# Markdown Note
40
+
41
+ This note can be edited using **markdown** for styling.`;const RE=t=>{Ps(t);const{id:e,layout:n,panelManager:s,registerComponent:i}=t,o=S.exports.useCallback(l=>{const{title:a,componentState:c,props:h}=l;let{panelState:u=null}=h;return c!=null&&({panelState:u=null}=c),a==null||u==null||u.content==null||u.content.length===0||u.content===Lo.DEFAULT_CONTENT?null:Cc(l)},[]),r=S.exports.useCallback(({title:l="",metadata:a={},id:c=qe.generate(),focusElement:h=J.DEFAULT_FOCUS_SELECTOR,createNewStack:u=!1,dragEvent:m=null}={})=>{const p=s.getOpenedPanelConfigsOfType(wo.COMPONENT),g=s.getClosedPanelConfigsOfType(wo.COMPONENT),f=p.map(E=>{var y;return(y=E.title)!=null?y:""}),b=l!=null&&l!==""?l:Lo.getNewMarkdownTitle(f),C=g.length>0?null:Lo.DEFAULT_CONTENT,v={type:"react-component",component:wo.COMPONENT,props:{id:c,metadata:a,panelState:{content:C},localDashboardId:e},title:b,id:c},{root:T}=n;J.openComponent({root:T,config:v,focusElement:h,createNewStack:u,dragEvent:m})},[e,n,s]);return S.exports.useEffect(function(){const a=[i(wo.COMPONENT,wo,bc,o)];return()=>{a.forEach(c=>c())}},[o,i]),Xe(n.eventHub,Qm.OPEN,r),d(ue,{})},DE=t=>{Ps(t);const{hydrate:e,id:n,layout:s,registerComponent:i}=t,o=S.exports.useCallback(({dragEvent:r,fetch:l,panelId:a=qe.generate(),widget:c})=>{const{name:h,type:u}=c;if(u!==dh.VariableType.PANDAS)return;const m={name:h,table:h},p=()=>l().then(b=>_c.makeModel(b)),g={type:"react-component",component:_o.COMPONENT,props:{localDashboardId:n,id:a,metadata:m,makeModel:p},title:h,id:a},{root:f}=s;J.openComponent({root:f,config:g,dragEvent:r})},[n,s]);return S.exports.useEffect(function(){const l=[i(_o.COMPONENT,_o,e)];return()=>{l.forEach(a=>a())}},[e,i]),Xe(s.eventHub,Fe.OPEN,o),d(ue,{})};class wn{}wn.DROPDOWN_FILTER="ControlType.DROPDOWN_FILTER";wn.INPUT_FILTER="ControlType.INPUT_FILTER";wn.MARKDOWN="ControlType.MARKDOWN";wn.FILTER_SET_MANAGER="ControlType.FILTER_SET_MANAGER";const NE=R.exports.shape({state:R.exports.shape({panelState:R.exports.shape({})})}),ME=R.exports.shape({panelId:R.exports.string.isRequired,columnName:R.exports.string.isRequired,columnType:R.exports.string.isRequired}),Mh=R.exports.shape({panelId:R.exports.string.isRequired,columnName:R.exports.string.isRequired}),fp=R.exports.shape({start:Mh,end:Mh,id:R.exports.string,isReversed:R.exports.bool}),FE=R.exports.arrayOf(fp),xE=R.exports.shape({name:R.exports.string.isRequired,operateAs:R.exports.string.isRequired,groups:R.exports.arrayOf(R.exports.string).isRequired,permissions:R.exports.shape({isSuperUser:R.exports.bool.isRequired,isQueryViewOnly:R.exports.bool.isRequired,isNonInteractive:R.exports.bool.isRequired,canUsePanels:R.exports.bool.isRequired,canCreateDashboard:R.exports.bool.isRequired,canCreateCodeStudio:R.exports.bool.isRequired,canCreateQueryMonitor:R.exports.bool.isRequired,canCopy:R.exports.bool.isRequired,canDownloadCsv:R.exports.bool.isRequired}).isRequired});Object.freeze({LinkPoint:ME,Link:fp,Links:FE,Panel:NE,User:xE});const _E=(t,e)=>t[e]===null?null:R.exports.bool,LE=(t,e)=>t[e]===null?null:R.exports.string;Object.freeze({nullableBoolean:_E,nullableString:LE});const Cp="SET_LAYOUT_STORAGE",kE=t=>({type:Cp,payload:t}),bp="/ide/assets/community-wordmark-app.d2c5c1eb.svg";const Ns=X.module("FormattingSectionContent");function OE(t){return t.formatString!=null}const ct=class extends S.exports.PureComponent{constructor(t){super(t),this.getCachedColumnTypeOptions=Ie(()=>ct.renderColumnTypeOptions()),this.getCachedDateTimeFormatOptions=Ie((h,u,m,p=!1,g=null)=>{const{timestampAtMenuOpen:f}=this.state;return ct.renderDateTimeOptions(f,h,u,m,p,g)}),this.debouncedCommitChanges=Je(this.commitChanges.bind(this),ct.inputDebounceTime),this.handleDefaultDateTimeFormatChange=this.handleDefaultDateTimeFormatChange.bind(this),this.handleDefaultDecimalFormatChange=this.handleDefaultDecimalFormatChange.bind(this),this.handleDefaultIntegerFormatChange=this.handleDefaultIntegerFormatChange.bind(this),this.handleFormatRuleEntered=this.handleFormatRuleEntered.bind(this),this.handleFormatRuleChange=this.handleFormatRuleChange.bind(this),this.handleFormatRuleCreate=this.handleFormatRuleCreate.bind(this),this.handleFormatRuleDelete=this.handleFormatRuleDelete.bind(this),this.handleShowTimeZoneChange=this.handleShowTimeZoneChange.bind(this),this.handleShowTSeparatorChange=this.handleShowTSeparatorChange.bind(this),this.handleTimeZoneChange=this.handleTimeZoneChange.bind(this),this.handleResetDateTimeFormat=this.handleResetDateTimeFormat.bind(this),this.handleResetDecimalFormat=this.handleResetDecimalFormat.bind(this),this.handleResetIntegerFormat=this.handleResetIntegerFormat.bind(this),this.handleResetTimeZone=this.handleResetTimeZone.bind(this),this.handleTruncateNumbersWithPoundChange=this.handleTruncateNumbersWithPoundChange.bind(this);const{formatter:e,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,showTimeZone:o,showTSeparator:r,timeZone:l,truncateNumbersWithPound:a}=t,c=e.map((h,u)=>({...h,id:u}));this.containerRef=Y.createRef(),this.addFormatRuleButtonRef=Y.createRef(),this.lastFormatRuleIndex=c.length,this.state={formatSettings:c,formatRulesChanged:!1,showTimeZone:o,showTSeparator:r,timeZone:l,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,truncateNumbersWithPound:a,timestampAtMenuOpen:new Date}}static focusFirstInputInContainer(t){const e=t==null?void 0:t.querySelector("input, select, textarea");e&&e.focus()}static isSameOptions(t,e){return t.defaultFormatString===e.defaultFormatString}static isSameDecimalOptions(t,e){return ct.isSameOptions(t,e)}static isSameIntegerOptions(t,e){return ct.isSameOptions(t,e)}static isValidColumnName(t){return t!==""&&ps.isValidColumnName(t)}static isValidFormat(t,e){if(!t||e.formatString==null||!OE(e))return!1;switch(t){case"datetime":return ht.isValid(e);case"decimal":return We.isValid(e);case"int":return mt.isValid(e);default:return Ns.warn("Trying to validate format of unknown type"),!0}}static removeFormatRuleExtraProps(t){const{id:e,isNewRule:n,...s}=t;return s}static isFormatRuleValidForSave(t){return ct.isValidColumnName(t.columnName)&&ct.isValidFormat(t.columnType,t.format)}static renderTimeZoneOptions(){return Rn.TIME_ZONES.map(e=>{const{label:n,value:s}=e;return d("option",{value:s,children:n},s)})}static renderColumnTypeOptions(){const e=[{value:P.dataType.DATETIME,label:"DateTime"},{value:P.dataType.DECIMAL,label:"Decimal"},{value:P.dataType.INT,label:"Integer"}].map(n=>d("option",{value:n.value,children:n.label},`key-columnType-${n.value}`));return w(ue,{children:[d("option",{disabled:!0,value:"",children:"Select Type"},"key-columnType-placeholder"),e]})}static renderDateTimeOptions(t,e,n,s,i,o){const r=new pn([],{timeZone:e,showTimeZone:n,showTSeparator:s}),l=i?ht.getGlobalFormats(n,s):ht.getFormats(n,s);return o&&!l.includes(o)&&l.unshift(o),l.map(a=>{const c=ht.makeFormat("",a,ht.TYPE_GLOBAL);return d("option",{value:a,children:r.getFormattedString(t,P.dataType.DATETIME,"",c)},a)})}componentDidMount(){ct.focusFirstInputInContainer(this.containerRef.current)}componentWillUnmount(){this.debouncedCommitChanges.flush()}isDuplicateRule(t){var n;const{formatSettings:e}=this.state;return(n=e.some(s=>s.id!==t.id&&s.columnName===t.columnName&&s.columnType===t.columnType))!=null?n:!1}getAutoIncrementFormatRuleIndex(){const{lastFormatRuleIndex:t}=this;return this.lastFormatRuleIndex+=1,t}handleDefaultDateTimeFormatChange(t){Ns.debug("handleDefaultDateTimeFormatChange",t.target.value),this.setState({defaultDateTimeFormat:t.target.value},()=>{this.debouncedCommitChanges()})}handleDefaultDecimalFormatChange(t){Ns.debug("handleDefaultDecimalFormatChange",t.target.value),this.setState({defaultDecimalFormatOptions:{defaultFormatString:t.target.value}},()=>{this.debouncedCommitChanges()})}handleDefaultIntegerFormatChange(t){Ns.debug("handleDefaultIntegerFormatChange",t.target.value),this.setState({defaultIntegerFormatOptions:{defaultFormatString:t.target.value}},()=>{this.debouncedCommitChanges()})}handleFormatRuleChange(t,e,n){this.setState(s=>{const{formatSettings:i}=s;A(i);const o=[...i];let r={};e==="columnType"&&(r={format:""});const l={...o[t],...r,[e]:n};return o[t]=l,{formatSettings:o}},()=>{this.debouncedCommitChanges()})}handleFormatRuleCreate(){this.setState(t=>{const{formatSettings:e}=t,n={columnType:P.dataType.DATETIME,columnName:"",format:{},id:this.getAutoIncrementFormatRuleIndex(),isNewRule:!0};return{formatSettings:e!=null?[...e,n]:[n],formatRulesChanged:!0}})}handleFormatRuleDelete(t){this.setState(e=>{const{formatSettings:n}=e;return{formatSettings:n.filter((i,o)=>o!==t),formatRulesChanged:!0}},()=>{this.debouncedCommitChanges()})}handleShowTimeZoneChange(){this.setState(t=>({showTimeZone:!t.showTimeZone}),()=>{this.debouncedCommitChanges()})}handleShowTSeparatorChange(){this.setState(t=>({showTSeparator:!t.showTSeparator}),()=>{this.debouncedCommitChanges()})}handleTimeZoneChange(t){this.setState({timeZone:t.target.value},()=>{this.debouncedCommitChanges()})}handleResetDateTimeFormat(){const{defaults:t}=this.props,{defaultDateTimeFormat:e,showTimeZone:n,showTSeparator:s}=t;Ns.debug("handleResetDateTimeFormat"),this.setState({defaultDateTimeFormat:e,showTimeZone:n,showTSeparator:s},()=>{this.debouncedCommitChanges()})}handleResetTimeZone(){const{defaults:t}=this.props,{timeZone:e}=t;Ns.debug("handleResetTimeZone"),this.setState({timeZone:e},()=>{this.debouncedCommitChanges()})}handleResetDecimalFormat(){const{defaults:t}=this.props,{defaultDecimalFormatOptions:e}=t;Ns.debug("handleResetDecimalFormat"),this.setState({defaultDecimalFormatOptions:e},()=>{this.debouncedCommitChanges()})}handleResetIntegerFormat(){const{defaults:t}=this.props,{defaultIntegerFormatOptions:e}=t;Ns.debug("handleResetIntegerFormat"),this.setState({defaultIntegerFormatOptions:e},()=>{this.debouncedCommitChanges()})}handleTruncateNumbersWithPoundChange(){this.setState(t=>({truncateNumbersWithPound:!t.truncateNumbersWithPound}),()=>{this.debouncedCommitChanges()})}handleFormatRuleEntered(t){this.scrollToFormatBlockBottom(),ct.focusFirstInputInContainer(t)}commitChanges(){var m;const{formatSettings:t,defaultDateTimeFormat:e,showTimeZone:n,showTSeparator:s,timeZone:i,defaultDecimalFormatOptions:o,defaultIntegerFormatOptions:r,truncateNumbersWithPound:l}=this.state,a=(m=t.filter(ct.isFormatRuleValidForSave).map(ct.removeFormatRuleExtraProps))!=null?m:[],{settings:c,saveSettings:h}=this.props,u={...c,formatter:a,defaultDateTimeFormat:e,showTimeZone:n,showTSeparator:s,timeZone:i,truncateNumbersWithPound:l};ct.isValidFormat(P.dataType.DECIMAL,We.makeCustomFormat(o.defaultFormatString))&&(u.defaultDecimalFormatOptions=o),ct.isValidFormat(P.dataType.INT,mt.makeCustomFormat(r.defaultFormatString))&&(u.defaultIntegerFormatOptions=r),h(u)}scrollToFormatBlockBottom(){var e,n,s,i;const{scrollTo:t}=this.props;t(0,((n=(e=this.addFormatRuleButtonRef.current)==null?void 0:e.offsetHeight)!=null?n:0)+((i=(s=this.addFormatRuleButtonRef.current)==null?void 0:s.offsetTop)!=null?i:0))}getRuleError(t){const e={hasColumnNameError:!1,hasFormatError:!1,message:""},n=[];return t.isNewRule!==void 0&&t.isNewRule||(this.isDuplicateRule(t)&&(e.hasColumnNameError=!0,n.push("Duplicate column name/type combo.")),ct.isValidColumnName(t.columnName)||(e.hasColumnNameError=!0,n.push("Column names must start with a letter or underscore and contain only alphanumeric characters or underscores.")),t.format!=null?(e.hasFormatError=!0,n.push("Empty formatting rule.")):ct.isValidFormat(t.columnType,t.format)||(e.hasFormatError=!0,n.push("Invalid formatting rule.")),e.message=n.join(`
42
+ `)),e}renderFormatRule(t,e){const n=`input-${t}-columnName`,s=`input-${t}-columnType`,i=`input-${t}-format`,o=this.getCachedColumnTypeOptions(),r=h=>this.handleFormatRuleChange(t,"columnName",h.target.value),l=()=>this.handleFormatRuleChange(t,"isNewRule",!1),a=h=>this.handleFormatRuleChange(t,"columnType",h.target.value),c=this.getRuleError(e);return w("fieldset",{className:"container-fluid format-rule-container",children:[w("div",{className:"form-row",children:[w("div",{className:"form-group col-7 mb-2",children:[d("label",{htmlFor:n,children:"Column Name"}),d("input",{id:n,className:W("form-control",{"is-invalid":c.hasColumnNameError}),"data-lpignore":!0,type:"text",value:e.columnName,onChange:r,onBlur:l})]}),w("div",{className:"form-group col mb-2",children:[d("button",{type:"button",className:"btn btn-link btn-link-icon btn-delete-format-rule float-right",tabIndex:-1,onClick:()=>this.handleFormatRuleDelete(t),children:d(z,{icon:_n})}),d("label",{htmlFor:s,children:"Column Type"}),d("select",{id:s,className:"custom-select",value:e.columnType,onChange:a,children:o})]})]}),d("div",{className:"form-row",children:w("div",{className:"form-group col-12 d-flex mb-2",children:[d("label",{className:"flex-shrink-0 col-form-label mr-3",htmlFor:i,children:"Formatting Rule"}),this.renderFormatRuleInput(t,e.columnType,i,e.format,c.hasFormatError)]})}),d("div",{className:"form-row",children:d("div",{className:"form-group col-12 d-flex mb-2",children:c.message&&d("p",{className:"text-danger",children:c.message})})})]},t)}renderFormatRuleInput(t,e,n,s,i){switch(P.getNormalizedType(e)){case P.dataType.DATETIME:return this.renderDateTimeFormatRuleInput(t,n,s,i);case P.dataType.DECIMAL:return this.renderDecimalFormatRuleInput(t,n,s,i);case P.dataType.INT:return this.renderIntegerFormatRuleInput(t,n,s,i);default:return null}}renderDateTimeFormatRuleInput(t,e,n,s){const{showTimeZone:i,showTSeparator:o,timeZone:r}=this.state,l=n!=null&&n.formatString||"";return w("select",{className:W("custom-select",{"is-invalid":s}),value:l,id:e,onChange:a=>{const c=ht.makeFormat("",a.target.value,ht.TYPE_GLOBAL);this.handleFormatRuleChange(t,"format",c)},children:[d("option",{value:"",disabled:!0,children:"Select format"},"default"),this.getCachedDateTimeFormatOptions(r,i,o)]})}renderIntegerFormatRuleInput(t,e,n,s){const i=n!=null&&n.formatString||"";return d("input",{className:W("form-control","flex-grow-1",{"is-invalid":s}),"data-lpignore":!0,id:e,placeholder:mt.DEFAULT_FORMAT_STRING,type:"text",value:i,onChange:o=>{const r=mt.makeFormat("",o.target.value,mt.TYPE_GLOBAL,void 0);this.handleFormatRuleChange(t,"format",r)}})}renderDecimalFormatRuleInput(t,e,n,s){const i=n!=null&&n.formatString||"";return d("input",{className:W("form-control","flex-grow-1",{"is-invalid":s}),"data-lpignore":!0,id:e,placeholder:We.DEFAULT_FORMAT_STRING,type:"text",value:i,onChange:o=>{const r=We.makeFormat("",o.target.value,We.TYPE_GLOBAL,void 0);this.handleFormatRuleChange(t,"format",r)}})}render(){const{defaults:t}=this.props,{formatRulesChanged:e,formatSettings:n,defaultDateTimeFormat:s,defaultDecimalFormatOptions:i,defaultIntegerFormatOptions:o,timeZone:r,showTimeZone:l,showTSeparator:a,truncateNumbersWithPound:c}=this.state,{defaultFormatString:h=We.DEFAULT_FORMAT_STRING}=i!=null?i:{},{defaultFormatString:u=mt.DEFAULT_FORMAT_STRING}=o!=null?o:{},m=n.map((v,T)=>d(gt,{classNames:"fade",timeout:It.transitionMs,onEnter:this.handleFormatRuleEntered,children:this.renderFormatRule(T,v)},v.id)),p=w("button",{type:"button",className:"btn btn-link mb-3",onClick:this.handleFormatRuleCreate,ref:this.addFormatRuleButtonRef,children:[d(z,{icon:As}),"Add New Rule"]}),g=r===t.timeZone,f=a===t.showTSeparator&&l===t.showTimeZone&&s===t.defaultDateTimeFormat,b=ct.isSameDecimalOptions(i,t.defaultDecimalFormatOptions),C=ct.isSameIntegerOptions(o,t.defaultIntegerFormatOptions);return w("div",{className:"app-settings-formatting-section",ref:this.containerRef,children:[w("div",{className:"container-fluid p-0",children:[d("div",{children:"Default formatting for column types"}),d("div",{className:"app-settings-menu-description mb-3",children:"Applies a formatting rule to all columns of a set type."}),w("div",{className:"form-row mb-2",children:[d("label",{className:"col-form-label col-3",htmlFor:"select-reset-timezone",children:"Time zone"}),d("div",{className:"col pr-0",children:d("select",{className:"custom-select",value:r,onChange:this.handleTimeZoneChange,id:"select-reset-timezone",children:ct.renderTimeZoneOptions()})}),d("div",{className:"col-1 btn-col",children:d(ce,{kind:"ghost",icon:ki,onClick:this.handleResetTimeZone,tooltip:"Reset Time Zone",className:W("btn-reset","btn-reset-time-zone",{hidden:g})})})]}),w("div",{className:"form-row mb-2",children:[d("label",{className:"col-form-label col-3",htmlFor:"select-default-time-format",children:"DateTime"}),d("div",{className:"col pr-0",children:d("select",{className:"custom-select",value:s,onChange:this.handleDefaultDateTimeFormatChange,id:"select-default-time-format",children:this.getCachedDateTimeFormatOptions(r,l,a,!0,s)})}),d("div",{className:"col-1 btn-col",children:d(ce,{kind:"ghost",icon:ki,onClick:this.handleResetDateTimeFormat,tooltip:"Reset DateTime Options",className:W("btn-reset","btn-reset-date-time",{hidden:f})})})]}),d("div",{className:"form-row",children:d("div",{className:"offset-3 col-9",children:d(Ut,{checked:l!=null?l:null,onChange:this.handleShowTimeZoneChange,children:"Show time zone in dates"})})}),d("div",{className:"form-row mb-3",children:d("div",{className:"offset-3 col-9",children:d(Ut,{checked:a!=null?a:null,onChange:this.handleShowTSeparatorChange,children:"Show 'T' separator"})})}),w("div",{className:"form-row mb-2",children:[d("label",{className:"col-form-label col-3",htmlFor:"default-decimal-format-input",children:"Decimal"}),d("div",{className:"col pr-0",children:d("input",{className:W("form-control","flex-grow-1","default-decimal-format-input",{"is-invalid":!ct.isValidFormat(P.dataType.DECIMAL,We.makeCustomFormat(h))}),"data-lpignore":!0,placeholder:We.DEFAULT_FORMAT_STRING,type:"text",id:"default-decimal-format-input",value:h,onChange:this.handleDefaultDecimalFormatChange})}),d("div",{className:"col-1 btn-col",children:d(ce,{kind:"ghost",icon:ki,onClick:this.handleResetDecimalFormat,tooltip:"Reset Decimal Formatting",className:W("btn-reset","btn-reset-decimal",{hidden:b}),"data-testid":"btn-reset-decimal"})})]}),w("div",{className:"form-row mb-2",children:[d("label",{className:"col-form-label col-3",htmlFor:"default-integer-format-input",children:"Integer"}),d("div",{className:"col pr-0",children:d("input",{className:W("form-control","flex-grow-1","default-integer-format-input",{"is-invalid":!ct.isValidFormat(P.dataType.INT,mt.makeCustomFormat(u))}),"data-lpignore":!0,placeholder:mt.DEFAULT_FORMAT_STRING,type:"text",id:"default-integer-format-input",value:u,onChange:this.handleDefaultIntegerFormatChange})}),d("div",{className:"col-1 btn-col",children:d(ce,{kind:"ghost",icon:ki,onClick:this.handleResetIntegerFormat,tooltip:"Reset Integer Formatting",className:W("btn-reset","btn-reset-integer",{hidden:C}),"data-testid":"btn-reset-integer"})})]}),d("div",{className:"form-row mb-3",children:d("div",{className:"offset-3 col-9",children:d(Ut,{checked:c!=null?c:null,onChange:this.handleTruncateNumbersWithPoundChange,children:"Truncate numbers with #"})})})]}),d("div",{children:"Default formatting for matched column names"}),d("div",{className:"app-settings-menu-description mb-3",children:"Applies a formatting rule to all columns that match a specified name and type."}),d(Bp,{appear:e,enter:e,exit:e,children:m}),p]})}};let qc=ct;qc.defaultProps={scrollTo:()=>{},defaults:{defaultDateTimeFormat:ht.DEFAULT_DATETIME_FORMAT_STRING,defaultDecimalFormatOptions:{defaultFormatString:We.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:mt.DEFAULT_FORMAT_STRING},showTimeZone:!1,showTSeparator:!0,timeZone:ht.DEFAULT_TIME_ZONE_ID}};qc.inputDebounceTime=250;const AE=t=>({formatter:jb(t),defaultDateTimeFormat:qb(t),defaultDecimalFormatOptions:Yb(t),defaultIntegerFormatOptions:Xb(t),showTimeZone:Qb(t),showTSeparator:Zb(t),truncateNumbersWithPound:Jb(t),timeZone:wl(t),settings:Xt(t)}),PE=xt(AE,{saveSettings:om})(qc),HE=()=>{const[t,e]=S.exports.useState(!1),n=()=>{e(!t)};return w("button",{type:"button",className:"btn btn-link",onClick:n,children:[d(z,{icon:tf}),"Legal Notices",w(Vo,{isOpen:t,toggle:n,className:"theme-bg-light",children:[d(Bo,{toggle:n,children:"Legal Notice"}),w(Uo,{children:[d("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."}),w("p",{children:["\xA9 2016-",new Date().getFullYear()," Deephaven Data Labs LLC. Patent Pending."]})]})]})]})},tl=t=>{const{children:e,isExpanded:n,sectionKey:s,title:i,onToggle:o}=t;return w(ue,{children:[d("div",{children:w("button",{type:"button",className:"btn btn-link btn-collapse-trigger",onClick:()=>o(s),children:[d("div",{className:"flex-grow-1",children:i}),d("div",{className:"flex-shrink-0",children:d(z,{transform:n?"flip-v":"",icon:cs})})]})}),d(ic,{in:n,autoFocusOnShow:!0,children:e})]})};tl.propTypes={children:R.exports.node,isExpanded:R.exports.bool.isRequired,sectionKey:R.exports.string.isRequired,title:R.exports.node.isRequired,onToggle:R.exports.func};tl.defaultProps={children:null,onToggle:()=>{}};function VE({shortcut:t,displayText:e,categoryName:n,onChange:s}){const[i,o]=S.exports.useState(e),[r,l]=S.exports.useState(t.getKeyState()),[a,c]=S.exports.useState(!1),[h,u]=S.exports.useState("");S.exports.useEffect(function(){o(e),l(t.getKeyState())},[e,t]),S.exports.useEffect(function(){o(Kt.getDisplayText(r)),t.matchesKeyState(r)&&c(!1)},[r,t]),S.exports.useEffect(function(){if(a){if(!Kt.isValidKeyState(r)){Kt.isAllowedKey(r.keyValue)?u("Must contain a modifier key"):u("Must contain an allowed action key");return}const E=ze.getConflictingShortcuts(r).filter(y=>y.id.startsWith(n)&&y!==t).map(y=>y.name);if(E.length){u(`Conflicts with ${E.join(", ")}`);return}u("")}else u("")},[a,r,n,t]);function m(T){if(T.stopPropagation(),T.preventDefault(),t.isEditable&&!T.repeat){const E=Kt.getKeyStateFromEvent(T),y=Kt.createKeyState([fe.BACKSPACE]);Kt.doKeyStatesMatch(E,y)?l(Kt.NULL_KEY_STATE):l(E)}}function p(T){T.stopPropagation(),T.preventDefault(),t.matchesKeyState(r)||c(!0)}function g(){xe.disableAllActions()}function f(){xe.enableAllActions()}function b(){t.setKeyState(r),c(!1),s(t)}function C(){const T=t.getKeyState();l(T),c(!1)}function v(){c(!0),l(t.getDefaultKeyState())}return w(ue,{children:[w("div",{className:"shortcut-item-container",children:[w("label",{className:"shortcut-item-name",children:[t.name,t.tooltip!==void 0&&d(pe,{children:t.tooltip})]}),w("div",{className:"shortcut-item-input-container",children:[d("input",{className:W("form-control",{"is-invalid":h}),onKeyDown:m,onKeyUp:p,onFocus:g,onBlur:f,disabled:!t.isEditable,value:i,readOnly:!0}),!Kt.doKeyStatesMatch(r,t.getDefaultKeyState())&&!h&&d(ce,{className:"reset-to-default-button",kind:"ghost",icon:d(z,{icon:ki,transform:{rotate:90,flipX:!0}}),tooltip:"Reset to default",onClick:v})]})]}),a&&w("div",{className:W("shortcut-item-message-container",{"is-invalid":h}),children:[d("div",{className:"shortcut-item-message",children:h}),w("div",{className:"shortcut-item-message-buttons",children:[Kt.isValidKeyState(r)&&d(ce,{kind:"ghost",onClick:b,children:"Confirm"}),d(ce,{kind:"ghost",onClick:C,children:"Undo"})]})]})]})}function UE({shortcutOverrides:t={},settings:e,saveSettings:n}){const s=S.exports.useCallback(l=>{const a=Kt.isMacPlatform,c={mac:{...t.mac},windows:{...t.windows}},h=a?c.mac:c.windows;l.forEach(u=>{u.isDefault()?delete h[u.id]:h[u.id]=u.getKeyState()}),n({...e,shortcutOverrides:c})},[e,n,t]);let i=Array.from(ze.shortcutsByCategory.entries()).map(([l,a])=>({name:l,shortcuts:a}));const o=i.findIndex(l=>l.name.toUpperCase()==="GLOBAL"),r=i.splice(o,1);return i=i.concat(r),w(ue,{children:[d("div",{className:"app-settings-menu-description",children:"Customize shortcuts below. Assigning shortcuts that conflict with the browser or IDE shortcuts may cause unintended behavior"}),i.map(l=>d(BE,{name:l.name,shortcuts:l.shortcuts,saveShortcutOverrides:s},l.name))]})}function BE({name:t,shortcuts:e,saveShortcutOverrides:n}){function s(a){return a.split("_").map(c=>`${c[0].toUpperCase()}${c.slice(1).toLowerCase()}`).join(" ")}const[i,o]=S.exports.useState(e);function r(a){const c=i.filter(u=>u!==a&&!u.isNull()&&u.matchesKeyState(a.getKeyState()));c.forEach(u=>u.setToNull());const h=[a,...c];n(h),o(u=>[...u])}const l=S.exports.useMemo(()=>i.map(a=>a.getDisplayText()),[i]);return w("div",{className:"mt-3",children:[d("div",{className:"font-weight-bold",children:s(t)}),i.map((a,c)=>d(VE,{shortcut:a,displayText:l[c],categoryName:t,onChange:r},a.id))]})}const $E=t=>({settings:Xt(t),shortcutOverrides:eS(t)}),WE={saveSettings:om},zE=xt($E,WE)(UE),Ha=new xg,Va=new Ur(Ha);function GE(){X.setLogLevel(parseInt("2",10)),Ha.enable(),Va.enable(),window!=null&&(window.DHLog=X,window.DHLogProxy=Ha,window.DHLogHistory=Va)}const KE="yyyy-MM-dd-HHmmss";function Sp(t,e="root",n=new Map([[t,""]])){const s={};return Object.entries(t).forEach(([i,o])=>{try{JSON.stringify(o),s[i]=o}catch{const l=o;if(typeof o=="bigint")s[i]=o.toString();else if(n.has(l))s[i]=`Circular ref to ${n.get(l)}`;else{const a=`${e}.${i}`;n.set(l,a),s[i]=Sp(o,a,n)}}}),s}function qE(){const t=El.getState();return JSON.stringify(Sp(t),null,2)}function YE(){const t={uiVersion:"0.19.1",userAgent:navigator.userAgent};return JSON.stringify(t,null,2)}async function XE(t=`${N.i18n.DateTimeFormat.format(KE,new Date)}_support_logs`){const e=new Uh,n=e.folder(t);n.file("console.txt",Va.getFormattedHistory()),n.file("redux.json",qE()),n.file("metadata.json",YE());const s=await e.generateAsync({type:"blob"}),i=document.createElement("a");i.href=URL.createObjectURL(s),i.download=`${t}.zip`,i.click()}const xs=class extends S.exports.Component{constructor(t){super(t),this.handleClose=this.handleClose.bind(this),this.handleScrollTo=this.handleScrollTo.bind(this),this.handleSectionToggle=this.handleSectionToggle.bind(this),this.menuContentRef=Y.createRef(),this.state={expandedSectionKey:xs.FORMATTING_SECTION_KEY}}static focusFirstInputInContainer(t){const e=t==null?void 0:t.querySelector("input, select, textarea");e&&e.focus()}static handleExportSupportLogs(){XE()}componentDidMount(){xs.focusFirstInputInContainer(this.menuContentRef.current)}isSectionExpanded(t){const{expandedSectionKey:e}=this.state;return e===t}handleScrollTo(t,e){var n;(n=this.menuContentRef.current)==null||n.scrollTo(t,e)}handleSectionToggle(t){this.setState(e=>({expandedSectionKey:e.expandedSectionKey===t?void 0:t}))}handleClose(){const{onDone:t}=this.props;t()}render(){const t="0.19.1",e="https://github.com/deephaven/web-client-ui/",n="https://deephaven.io/core/docs/";return w("div",{className:"app-settings-menu",children:[w("header",{className:"app-settings-menu-header",children:[d("div",{className:"flex-spacer"}),d("button",{type:"button",className:"btn btn-link btn-link-icon btn-close-settings-menu",onClick:this.handleClose,children:d(z,{icon:$o,transform:"grow-4"})})]}),w("div",{className:"app-settings-menu-content",ref:this.menuContentRef,children:[d("h5",{children:"Settings"}),d("hr",{className:"my-0"}),d(tl,{sectionKey:xs.FORMATTING_SECTION_KEY,isExpanded:this.isSectionExpanded(xs.FORMATTING_SECTION_KEY),title:w(ue,{children:[d(z,{icon:gf,transform:"grow-4",className:"mr-2"}),"Formatting & Time zone"]}),onToggle:this.handleSectionToggle,children:d(PE,{scrollTo:this.handleScrollTo})}),d(tl,{sectionKey:xs.SHORTCUT_SECTION_KEY,isExpanded:this.isSectionExpanded(xs.SHORTCUT_SECTION_KEY),title:w(ue,{children:[d(z,{icon:cf,transform:"grow-2"})," ","Keyboard Shortcuts"]}),onToggle:this.handleSectionToggle,children:d(zE,{})}),w("div",{className:"app-settings-footer",children:[w("div",{className:"app-settings-footer-section",children:[w("div",{className:"app-settings-footer-item",children:[d("div",{className:"font-weight-bold",children:"Support"}),w("div",{children:["GitHub:\xA0",d("a",{href:e,className:"custom-link",target:"_blank",rel:"noopener noreferrer",children:e})]}),d("button",{type:"button",className:"btn btn-secondary mt-2 py-2",onClick:xs.handleExportSupportLogs,children:"Export Logs"})]}),w("div",{className:"app-settings-footer-item",children:[d("div",{className:"font-weight-bold",children:"Documentation"}),d("a",{target:"_blank",rel:"noreferrer noopener",href:n,className:"custom-link",children:n})]}),d("div",{className:"app-settings-footer-item",children:w("div",{className:"text-muted",children:["Version ",t]})}),d("div",{className:"app-settings-footer-item",children:d(HE,{})})]}),d("div",{className:"app-settings-footer-section",children:d("div",{className:"logo",children:d("a",{target:"_blank",rel:"noreferrer noopener",href:"https://deephaven.io",className:"d-inline-block custom-link p-1",children:d("img",{src:bp,alt:"Deephaven Data Labs",width:"230px"})})})})]})]})]})}};let Xo=xs;Xo.defaultProps={onDone:()=>{}};Xo.FORMATTING_SECTION_KEY="SettingsMenu.formatting";Xo.APPLICATION_SECTION_KEY="ApplicationMenu.settings";Xo.SHORTCUT_SECTION_KEY="SettingsMenu.shortcuts";const Fh=10,Hi=t=>{const{forwardedProps:{menuItem:{action:e,title:n,disabled:s},iconElement:i,displayShortcut:o,isMouseSelected:r,isKeyboardSelected:l,closeMenu:a}}=t,c=S.exports.useRef(),h=S.exports.useRef(),u=S.exports.useRef(null),[m,p]=S.exports.useState(!1),g=S.exports.useCallback(C=>{c.current!=null&&h.current!=null&&u.current&&(Math.abs(c.current-C.clientX)>=Fh||Math.abs(h.current-C.clientY)>=Fh)&&(p(!0),window.removeEventListener("mousemove",g),a(),e(C),u.current=null)},[e,a]);function f(C){c.current=C.clientX,h.current=C.clientY,u.current=C.target,window.addEventListener("mousemove",g)}function b(C){u.current===C.target&&(p(!0),a(),e(),window.removeEventListener("mousemove",g)),u.current=null}return S.exports.useEffect(function(){return function(){return window.removeEventListener("mousemove",g)}},[g]),w("button",{type:"button",className:W("btn-context-menu",{disabled:s},{active:r&&!s},{"keyboard-active":l&&!s}),onMouseDown:f,onMouseUp:b,disabled:m,children:[d("span",{className:W("icon"),children:i}),d("span",{className:"title",children:n}),d("span",{className:"shortcut",children:o})]})},Yc=t=>{const{handleControlSelect:e,handleToolSelect:n,onClearFilter:s}=t,i=S.exports.useMemo(()=>[{title:"Input Filter",icon:Nf,menuElement:d(Hi,{}),action:o=>{e(wn.INPUT_FILTER,o)},order:10},{title:"Dropdown Filter",icon:tu,menuElement:d(Hi,{}),action:o=>{e(wn.DROPDOWN_FILTER,o)},order:15},{title:"Markdown Widget",icon:rf,menuElement:d(Hi,{}),action:o=>{e(wn.MARKDOWN,o)},order:20},{title:"Filter Sets",icon:wa,menuElement:d(Hi,{}),action:o=>{e(wn.FILTER_SET_MANAGER,o)},order:25},{disabled:!0,menuElement:d("div",{className:"context-menu-group-header",children:"Tools"}),order:30},{title:"Linker",icon:Xa,action:()=>{n(mn.LINKER)},order:40,shortcut:Os.LINKER},{disabled:!0,menuElement:d("div",{className:"context-menu-group-header",children:"Actions"}),order:50},{title:"Clear All Filters",icon:yf,action:()=>{s()},order:60,shortcut:hn.TABLE.CLEAR_ALL_FILTERS}],[e,n,s]);return d(zn,{popperClassName:"controls-menu-popper",actions:i})};Yc.propTypes={handleControlSelect:R.exports.func,handleToolSelect:R.exports.func,onClearFilter:R.exports.func};Yc.defaultProps={handleControlSelect:()=>{},handleToolSelect:()=>{},onClearFilter:()=>{}};Hi.propTypes={forwardedProps:R.exports.shape({iconElement:R.exports.node,displayShortcut:R.exports.string,isMouseSelected:R.exports.bool.isRequired,isKeyboardSelected:R.exports.bool.isRequired,closeMenu:R.exports.func.isRequired,menuItem:R.exports.shape({action:R.exports.func,title:R.exports.string,disabled:R.exports.bool}).isRequired})};Hi.defaultProps={forwardedProps:null};const jE=bi(Cp,null),QE={layoutStorage:jE},ZE=t=>t.layoutStorage;Object.entries(QE).map(([t,e])=>eo.register(t,e));const xh=10,JE=t=>{const{onExportLayout:e,onImportLayout:n,onResetLayout:s,onSelect:i,widgets:o=[]}=t,[r,l]=S.exports.useState(!1),[a,c]=S.exports.useState(""),h=S.exports.useRef(null),u=S.exports.useRef(),m=S.exports.useCallback((E,y)=>{E!=null&&i(E,y)},[i]),p=S.exports.useCallback(E=>{c(E.target.value)},[]),g=S.exports.useCallback(E=>{u.current!=null&&(Math.abs(u.current.x-E.clientX)>=xh||Math.abs(u.current.y-E.clientY)>=xh)&&(l(!0),window.removeEventListener("mousemove",g),m(u.current.widget,E),u.current=void 0)},[u,m]),f=S.exports.useCallback((E,y)=>{u.current={x:E.clientX,y:E.clientY,widget:y},window.addEventListener("mousemove",g)},[g]),b=S.exports.useCallback((E,y)=>{var I;window.removeEventListener("mousemove",g),((I=u.current)==null?void 0:I.widget)===y&&(l(!0),m(y)),u.current=void 0},[g,u,m]),C=S.exports.useMemo(()=>o.filter(E=>{var y;return a?(y=E.name)==null?void 0:y.toLowerCase().includes(a.toLowerCase()):!0}),[a,o]).sort((E,y)=>{var I,D,M;return(M=(D=E.name)==null?void 0:D.localeCompare((I=y.name)!=null?I:""))!=null?M:0}),v=S.exports.useMemo(()=>C.map(E=>{var y,I;return d("li",{children:w("button",{type:"button",className:"btn btn-link","data-testid":`panel-list-item-${(y=E.name)!=null?y:""}-button`,onMouseDown:D=>{f(D,E)},onMouseUp:D=>{b(D,E)},onKeyDown:D=>{(D.key==="Enter"||D.key===" ")&&m(E)},disabled:r,children:[d(Iu,{type:E.type})," ",(I=E.name)!=null?I:""]})},E.name)}),[C,r,f,b,m]),T=S.exports.useMemo(()=>v.length===0?d("span",{children:"No bound variables found."}):null,[v]);return w("div",{className:"widget-list-container d-flex flex-column",children:[d("div",{className:"widget-list-header",children:d(fs,{value:a,placeholder:"Find Table, Plot or Widget",onChange:p,ref:h})}),w("ul",{className:"widget-list flex-grow-1",children:[T&&d("li",{className:"widget-list-message",children:T}),!T&&v]}),d("div",{children:d("hr",{})}),w("div",{className:"widget-list-footer",children:[w(ce,{kind:"ghost",onClick:e,children:[w("div",{className:"fa-md fa-layers",children:[d(z,{mask:va,icon:dd,transform:"right-5 down-5"}),d(z,{icon:dd,transform:"right-8 down-6"})]}),"Export Layout"]}),w(ce,{kind:"ghost",onClick:n,children:[w("div",{className:"fa-md fa-layers",children:[d(z,{mask:va,icon:Sa,transform:"right-5 down-5"}),d(z,{icon:Sa,transform:"right-8 down-6"})]}),"Import Layout"]}),d(ce,{kind:"ghost",icon:ki,onClick:s,tooltip:"Reset Layout"})]})]})},e1=async(t,e,n)=>{let s,i,o,r;if(kr(e)?(s=e.settings,i=e.table,o=void 0,r=e.tableSettings):(s={},i="",o=e.figure,r={}),n!==void 0&&(n.tableSettings!=null&&(r=n.tableSettings),n.table!=null&&(i=n.table),n.figure!=null&&(o=n.figure),n.settings!=null&&(s={...s,...n.settings})),o!==void 0){const c={title:o,name:o,type:N.VariableType.FIGURE},h=await t.getObject(c);return Ki.makeModel(s,h)}const l={title:o,name:i,type:N.VariableType.TABLE},a=await t.getObject(l);return te.applyTableSettings(a,r,wl(El.getState())),Ki.makeModelFromSettings(s,a)},t1=async(t,e,n=N.VariableType.TABLE)=>{const{table:s}=e,i={title:s,name:s,type:n},o=await t.getObject(i);return _c.makeModel(o)};const n1=({onAutoFillClick:t=()=>{}})=>w("div",{className:"empty-dashboard-container",children:[w("div",{className:"hint-container",children:[d(z,{icon:Bg})," ",d("br",{}),"Use the panel list to add objects from a query."]}),w("div",{className:"empty-dashboard",children:[d("div",{className:"add-panels-hint",children:"Drag Panels Here"}),d(ce,{kind:"tertiary",onClick:t,children:"Auto fill objects"})]})]});function s1(t){return t.version===2}function i1(t){return Array.isArray(t)}const Mr=X.module("UserLayoutUtils"),o1={layoutConfig:[{type:"column",content:[{type:"row",content:[{type:"stack",content:[{type:"react-component",component:Pi.COMPONENT,title:Pi.TITLE,isClosable:!1},{type:"react-component",component:el.COMPONENT,title:el.TITLE,isClosable:!1}]},{type:"stack",width:25,content:[{type:"react-component",component:Qr.COMPONENT,title:Qr.TITLE,isClosable:!1},{type:"react-component",component:Zr.COMPONENT,title:Zr.TITLE,isClosable:!1}]}]},{type:"row",content:[{type:"stack",title:"Notebooks",content:[]}]}]}],links:[],filterSets:[],version:2},r1={layoutConfig:[],links:[],filterSets:[],version:2};function wp(t){if(s1(t))return t;if(i1(t))return{layoutConfig:t,links:[],filterSets:[],version:2};throw new Error(`Unexpected layout import format: ${t}`)}async function l1(t,e=!0){try{const n=await t.getLayouts();if(n.length>0)try{const s=await t.getLayout(n[0]);return wp(s)}catch(s){Mr.error("Unable to load layout",n[0],":",s),Mr.warn("No valid layouts found, falling back to default layout")}}catch(n){Mr.error("Unable to fetch layout list",n),Mr.warn("Falling back to default layout")}return e?o1:r1}function a1(t){const{filterSets:e,layoutConfig:n,links:s}=t;return{filterSets:e,layoutConfig:n,links:s,version:2}}const Hr={exportLayout:a1,getDefaultLayout:l1,normalizeLayout:wp},Fr=X.module("DownloadServiceWorkerUtils"),vp=class{static registerOnLoaded(){new URL("/ide/",window.location.href).origin===window.location.origin&&("serviceWorker"in navigator?window.addEventListener("load",()=>{const e=new URL("/ide/download/serviceWorker.js",window.location.href);navigator.serviceWorker.register(e).then(n=>{n.update(),Fr.info("Registering service worker on ",e,n)}).catch(n=>{Fr.error("Failed to register service worker",n)})}):Fr.info("Service worker is not supported."))}static async getServiceWorker(){if("serviceWorker"in navigator){const e=(await navigator.serviceWorker.getRegistrations()).find(n=>n.scope.endsWith(vp.DOWNLOAD_PATH));if(e&&e.active)return Fr.info("Download service worker is active."),e.active;throw new Error("Can not find download service worker.")}throw new Error("Download service worker is not available.")}static unregisterSW(){}};let nl=vp;nl.DOWNLOAD_PATH="/download/";const Tp={react:Y},c1=$p(Tp),d1=Wp({requires:c1}),h1=zp.createRequires(Tp),u1=Gp({requires:h1}),m1=X.module("PluginUtils");class Ua{static loadComponentPlugin(e){if("".split(",").includes(e)){const o=Y.lazy(()=>Zp(()=>import(`./internal/${e}`),[])),r=Y.forwardRef((l,a)=>d(S.exports.Suspense,{fallback:d("div",{children:"Loading Plugin..."}),children:d(o,{ref:a,...l})}));return r.pluginName=e,r.displayName="Local Plugin",r}const n=new URL("/ide/plugins/",`${window.location}`),s=new URL(`${e}.js`,n),i=Y.forwardRef((o,r)=>d(d1,{url:s,render:({err:l,Component:a})=>{if(l!=null&&l!==""){const c=`Error loading plugin ${e} from ${s} due to ${l}`;return m1.error(c),d("div",{className:"error-message",children:`${c}`})}return d(a,{ref:r,...o})}}));return i.pluginName=e,i.displayName="Plugin",i}static async loadModulePlugin(e){return await u1(e)}static async loadJson(e){return new Promise((n,s)=>{const i=new XMLHttpRequest;i.addEventListener("load",()=>{try{const o=JSON.parse(i.responseText);n(o)}catch(o){s(o)}}),i.addEventListener("error",o=>{s(o)}),i.open("GET",e),i.send()})}}const Ot=X.module("AppMainContainer");class ko extends S.exports.Component{constructor(e){super(e),this.getDashboardPlugins=Ce(n=>[...n.entries()].filter(([,{DashboardPlugin:s}])=>s).map(([s,{DashboardPlugin:i}])=>d(i,{},s))),this.handleSettingsMenuHide=this.handleSettingsMenuHide.bind(this),this.handleSettingsMenuShow=this.handleSettingsMenuShow.bind(this),this.handleError=this.handleError.bind(this),this.handleControlSelect=this.handleControlSelect.bind(this),this.handleToolSelect=this.handleToolSelect.bind(this),this.handleClearFilter=this.handleClearFilter.bind(this),this.handleDataChange=this.handleDataChange.bind(this),this.handleAutoFillClick=this.handleAutoFillClick.bind(this),this.handleGoldenLayoutChange=this.handleGoldenLayoutChange.bind(this),this.handleLayoutConfigChange=this.handleLayoutConfigChange.bind(this),this.handleExportLayoutClick=this.handleExportLayoutClick.bind(this),this.handleImportLayoutClick=this.handleImportLayoutClick.bind(this),this.handleImportLayoutFiles=this.handleImportLayoutFiles.bind(this),this.handleLoadTablePlugin=this.handleLoadTablePlugin.bind(this),this.handleResetLayoutClick=this.handleResetLayoutClick.bind(this),this.handleWidgetMenuClick=this.handleWidgetMenuClick.bind(this),this.handleWidgetsMenuClose=this.handleWidgetsMenuClose.bind(this),this.handleWidgetSelect=this.handleWidgetSelect.bind(this),this.handlePaste=this.handlePaste.bind(this),this.hydrateChart=this.hydrateChart.bind(this),this.hydrateGrid=this.hydrateGrid.bind(this),this.hydratePandas=this.hydratePandas.bind(this),this.hydrateDefault=this.hydrateDefault.bind(this),this.openNotebookFromURL=this.openNotebookFromURL.bind(this),this.importElement=Y.createRef(),this.state={contextActions:[{action:()=>{this.handleToolSelect(mn.LINKER)},shortcut:Os.LINKER,isGlobal:!0},{action:()=>{this.sendClearFilter()},shortcut:hn.TABLE.CLEAR_ALL_FILTERS,isGlobal:!0},{action:()=>{Ot.debug("Consume unhandled save shortcut")},shortcut:Os.SAVE,isGlobal:!0}],isPanelsMenuShown:!1,isSettingsMenuShown:!1,widgets:[]}}static handleWindowBeforeUnload(e){e.preventDefault(),e.returnValue=""}static hydrateConsole(e,n){return Ra.hydrate({...e,unzip:s=>Uh.loadAsync(s).then(i=>Object.values(i.files))},n)}componentDidMount(){this.initWidgets(),window.addEventListener("beforeunload",ko.handleWindowBeforeUnload)}componentDidUpdate(e){const{dashboardData:n}=this.props;e.dashboardData!==n&&this.handleDataChange(n)}componentWillUnmount(){this.deinitWidgets(),window.removeEventListener("beforeunload",ko.handleWindowBeforeUnload)}initWidgets(){const{connection:e}=this.props;if(e.subscribeToFieldUpdates==null){Ot.warn("subscribeToFieldUpdates not supported, not initializing widgets");return}this.widgetListenerRemover=e.subscribeToFieldUpdates(n=>{Ot.debug("Got updates",n),this.setState(({widgets:s})=>{const{updated:i,created:o,removed:r}=n,l=[...i,...r],a=s.filter(h=>!l.some(u=>u.name===h.name));return[...i,...o].forEach(h=>{h.name!=null&&h.name!==""&&a.push(h)}),{widgets:a}})})}deinitWidgets(){var e;(e=this.widgetListenerRemover)==null||e.call(this)}openNotebookFromURL(){const{match:e}=this.props,{notebookPath:n}=e.params;if(n){const{session:s,sessionConfig:i}=this.props;if(s==null||i==null){Ot.error("No session available to open notebook URL",n);return}const o={id:`/${n}`,itemName:`/${n}`},r=i.type,l={value:null,language:r};this.emitLayoutEvent(Be.SELECT_NOTEBOOK,s,r,l,o,!0)}}sendClearFilter(){this.emitLayoutEvent(Ue.CLEAR_ALL_FILTERS)}emitLayoutEvent(e,...n){var s;(s=this.goldenLayout)==null||s.eventHub.emit(e,...n)}handleError(e){Re.isCanceled(e)||Ot.error(e)}handleSettingsMenuHide(){this.setState({isSettingsMenuShown:!1})}handleSettingsMenuShow(){this.setState({isSettingsMenuShown:!0})}handleControlSelect(e,n=null){switch(Ot.debug("handleControlSelect",e),e){case wn.DROPDOWN_FILTER:this.emitLayoutEvent(Ue.OPEN_DROPDOWN,{title:"DropdownFilter",type:e,createNewStack:!0,dragEvent:n});break;case wn.INPUT_FILTER:this.emitLayoutEvent(Ue.OPEN_INPUT,{title:"InputFilter",type:e,createNewStack:!0,dragEvent:n});break;case wn.MARKDOWN:this.emitLayoutEvent(Qm.OPEN,{title:"Markdown",type:e,dragEvent:n});break;case wn.FILTER_SET_MANAGER:this.emitLayoutEvent(Ue.OPEN_FILTER_SET_MANAGER,{title:"FilterSets",type:e,dragEvent:n});break;default:throw new Error(`Unrecognized control type ${e}`)}}handleToolSelect(e){Ot.debug("handleToolSelect",e);const{activeTool:n,setActiveTool:s}=this.props;s(n===e?mn.DEFAULT:e)}handleClearFilter(){this.sendClearFilter()}handleDataChange(e){const{updateWorkspaceData:n}=this.props,{closed:s,filterSets:i,links:o}=e;n({closed:s,filterSets:i,links:o})}handleGoldenLayoutChange(e){this.goldenLayout=e}handleLayoutConfigChange(e){const{updateWorkspaceData:n}=this.props;n({layoutConfig:e})}handleWidgetMenuClick(){this.setState(({isPanelsMenuShown:e})=>({isPanelsMenuShown:!e}))}handleWidgetSelect(e,n){this.setState({isPanelsMenuShown:!1}),Ot.debug("handleWidgetSelect",e,n),this.openWidget(e,n)}handleWidgetsMenuClose(){this.setState({isPanelsMenuShown:!1})}handleAutoFillClick(){const{widgets:e}=this.state;Ot.debug("handleAutoFillClick",e);const n=e.sort((s,i)=>s.title!=null&&i.title!=null?s.title.localeCompare(i.title):0);for(let s=0;s<n.length;s+=1)this.openWidget(n[s])}handleExportLayoutClick(){Ot.info("handleExportLayoutClick"),this.setState({isPanelsMenuShown:!1});try{const{workspace:e}=this.props,{data:n}=e,s=Hr.exportLayout(n);Ot.info("handleExportLayoutClick exportedConfig",s);const i=new Blob([JSON.stringify(s)],{type:"application/json"}),o=N.i18n.DateTimeFormat.format("yyyy-MM-dd-HHmmss",new Date),r=document.createElement("a");r.href=URL.createObjectURL(i),r.download=`deephaven-app-layout-${o}.json`,r.click()}catch(e){Ot.error("Unable to export layout",e)}}handleImportLayoutClick(){Ot.info("handleImportLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.importElement.current!=null&&(this.importElement.current.value="",this.importElement.current.click())}handleResetLayoutClick(){Ot.info("handleResetLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.resetLayout()}handleImportLayoutFiles(e){var n;e.stopPropagation(),e.preventDefault(),e.target.files!=null&&this.importLayoutFile((n=e.target.files)==null?void 0:n[0])}async importLayoutFile(e){try{const{updateDashboardData:n,updateWorkspaceData:s}=this.props,i=await e.text(),o=JSON.parse(i),{filterSets:r,layoutConfig:l,links:a}=Hr.normalizeLayout(o);s({layoutConfig:l}),n(Dn,{filterSets:r,links:a})}catch(n){Ot.error("Unable to import layout",n)}}async resetLayout(){const{layoutStorage:e,session:n}=this.props,{filterSets:s,layoutConfig:i,links:o}=await Hr.getDefaultLayout(e,n!==void 0),{updateDashboardData:r,updateWorkspaceData:l}=this.props;l({layoutConfig:i}),r(Dn,{filterSets:s,links:o})}handlePaste(e){let n=e.currentTarget.parentElement;for(;n!=null;){if(n.classList.contains("monaco-editor"))return;n=n.parentElement}const{clipboardData:s}=e,i=s.getData("Text"),o=/“|”/g;o.test(i)&&(e.preventDefault(),e.stopPropagation(),document.execCommand("insertText",!1,i.replace(o,'"')))}handleLoadTablePlugin(e){const{plugins:n}=this.props,s=n.get(e);return s!=null&&s.TablePlugin!=null?s.TablePlugin:Ua.loadComponentPlugin(e)}hydrateDefault(e,n){const{connection:s}=this.props,{metadata:i}=e;if((i==null?void 0:i.type)!=null&&((i==null?void 0:i.id)!=null||(i==null?void 0:i.name)!=null)){const o=i.id!=null?{type:i.type,id:i.id}:{type:i.type,name:i.name,title:i.name};return{fetch:()=>s.getObject(o),localDashboardId:n,...e}}return Ra.hydrate(e,n)}hydrateGrid(e,n){return this.hydrateTable(e,n,N.VariableType.TABLE)}hydratePandas(e,n){return this.hydrateTable(e,n,N.VariableType.PANDAS)}hydrateTable(e,n,s=N.VariableType.TABLE){const{connection:i}=this.props;return{...e,getDownloadWorker:nl.getServiceWorker,loadPlugin:this.handleLoadTablePlugin,localDashboardId:n,makeModel:()=>t1(i,e.metadata,s)}}hydrateChart(e,n){const{connection:s}=this.props;return{...e,localDashboardId:n,makeModel:()=>{const{metadata:i,panelState:o}=e;return e1(s,i,o)}}}openWidget(e,n){const{connection:s}=this.props;this.emitLayoutEvent(Fe.OPEN,{dragEvent:n,fetch:()=>s.getObject(e),widget:e})}render(){const{activeTool:e,plugins:n,user:s,workspace:i}=this.props,{data:o}=i,{layoutConfig:r}=o,{permissions:l}=s,{canUsePanels:a}=l,{contextActions:c,isPanelsMenuShown:h,isSettingsMenuShown:u,widgets:m}=this.state,p=this.getDashboardPlugins(n);return w("div",{className:W("app-main-tabs","w-100","h-100","d-flex","flex-column",e?`active-tool-${e.toLowerCase()}`:""),onPaste:this.handlePaste,tabIndex:-1,children:[d("nav",{className:"nav-container",children:w("div",{className:"app-main-top-nav-menus",children:[d("img",{src:bp,alt:"Deephaven Data Labs",width:"115px",className:"ml-1"}),w("div",{children:[w("button",{type:"button",className:"btn btn-link btn-panels-menu",children:[d(z,{icon:kf}),"Controls",d(Yc,{handleControlSelect:this.handleControlSelect,handleToolSelect:this.handleToolSelect,onClearFilter:this.handleClearFilter})]}),a&&w("button",{type:"button",className:"btn btn-link btn-panels-menu btn-show-panels","data-testid":"app-main-panels-button",onClick:this.handleWidgetMenuClick,children:[d(z,{icon:Ff}),"Panels",d(xn,{isShown:h,className:"panels-menu-popper",onExited:this.handleWidgetsMenuClose,closeOnBlur:!0,interactive:!0,children:d(JE,{widgets:m,onExportLayout:this.handleExportLayoutClick,onImportLayout:this.handleImportLayoutClick,onResetLayout:this.handleResetLayoutClick,onSelect:this.handleWidgetSelect})})]}),w("button",{type:"button",className:W("btn btn-link btn-link-icon btn-settings-menu",{"text-warning":s.operateAs!==s.name}),onClick:this.handleSettingsMenuShow,children:[d(z,{icon:Wo,transform:"grow-3 right-1 down-1"}),d(pe,{children:"User Settings"})]})]})]})}),w(Bw,{emptyDashboard:d(n1,{onAutoFillClick:this.handleAutoFillClick}),id:Dn,layoutConfig:r,onGoldenLayoutChange:this.handleGoldenLayoutChange,onLayoutConfigChange:this.handleLayoutConfigChange,onLayoutInitialized:this.openNotebookFromURL,hydrate:this.hydrateDefault,children:[d(wE,{hydrate:this.hydrateGrid,getDownloadWorker:nl.getServiceWorker,loadPlugin:this.handleLoadTablePlugin}),d(pE,{hydrate:this.hydrateChart}),d(gE,{}),d(CE,{hydrateConsole:ko.hydrateConsole,notebooksUrl:new URL("/notebooks/",`${window.location}`).href}),d(bE,{}),d(DE,{hydrate:this.hydratePandas}),d(RE,{}),d(IE,{}),p]}),d(gt,{in:u,timeout:It.transitionMidMs,classNames:"slide-left",mountOnEnter:!0,unmountOnExit:!0,children:d(Xo,{onDone:this.handleSettingsMenuHide})}),d(ie,{actions:c}),d("input",{ref:this.importElement,type:"file",accept:".json",style:{display:"none"},onChange:this.handleImportLayoutFiles})]})}}const p1=t=>{var e,n;return{activeTool:vl(t),dashboardData:jt(t,Dn),layoutStorage:ZE(t),plugins:tS(t),connection:DT(t,Dn),session:(e=Ci(t,Dn))==null?void 0:e.session,sessionConfig:(n=Ci(t,Dn))==null?void 0:n.config,user:qu(t),workspace:Sl(t)}},g1=xt(p1,{setActiveTool:Tl,updateDashboardData:Yn,updateWorkspaceData:im})(Kp(ko)),f1=()=>w("div",{className:"app",children:[d(g1,{}),d(lu,{})]});X.module("StorageTableViewportUpdater");class _h{static makeSortConfig(e,n){return{column:e,direction:n}}static makeFilterConfig(e){const n=[],s=[];return e.forEach((i,o)=>{n.push(i),o>0&&s.push(qt.and)}),{filterItems:n,filterOperators:s}}static combineFilterConfigs(e,n,s=qt.and){return{filterItems:[...e.filterItems,...n.filterItems],filterOperators:[...e.filterOperators,s,...n.filterOperators]}}static makeFilterItem(e,n,s){return{columnName:e,type:n,value:s}}}const ga=X.module("PouchStorageTable"),C1="Deephaven.";Bh.plugin(qp);function b1(t,e){switch(t){case q.in:case q.contains:return{$regex:new RegExp(`${e}`)};case q.inIgnoreCase:return{$regex:new RegExp(`${e}`,"i")};case q.eq:return{$eq:e};case q.notEq:return{$neq:e};case q.greaterThan:return{$gt:e};case q.greaterThanOrEqualTo:return{$gte:e};case q.lessThan:return{$lt:e};case q.lessThanOrEqualTo:return{$lte:e};case q.startsWith:return{$regex:new RegExp(`^(?${e}).*`)};default:throw new Error(`Unsupported type: ${t}`)}}function S1(t){const{filterItems:e,filterOperators:n}=t;let s=null;for(let i=0;i<e.length;i+=1){const o=e[i],{columnName:r,type:l,value:a}=o,c={[r]:b1(l,a)};if(i===0)s=c;else if(s!==null&&i-1<n.length){const h=n[i-1];if(h===qt.and)s={$and:[s,c]};else if(h===qt.or)s={$or:[s,c]};else throw new Error(`Unexpected filter operator ${h}, ${c}`)}}if(s==null)throw new Error(`Invalid filter config ${t}`);return s}function fa(t=[]){return{$and:[...t.map(e=>S1(e)),{name:{$gt:null}},{id:{$gt:null}}]}}function w1(t,e=!1){var n;return[{id:e?"desc":"asc"},...(n=t==null?void 0:t.map(s=>({[s.column]:s.direction})))!=null?n:[]]}class v1{constructor(e){this.listeners=[],this.itemListeners=new Map,this.currentSize=0,this.currentReverse=!1,this.currentFilter=null,this.currentSort=null,this.db=new Bh(`${C1}${e}`),this.db._remote=!1,this.db.changes({live:!0,since:"now",include_docs:!0}).on("change",this.dbUpdate.bind(this)),this.db.createIndex({index:{fields:["id","name"]}}),this.refreshInfo()}onUpdate(e){return this.listeners=[...this.listeners,e],()=>{this.listeners=this.listeners.filter(n=>n!==e)}}onItemUpdate(e,n){return this.itemListeners.has(e)||this.itemListeners.set(e,[]),this.itemListeners.set(e,[...this.itemListeners.get(e),n]),this.refreshItem(e),()=>{this.itemListeners.set(e,this.itemListeners.get(e).filter(s=>s!==n))}}close(){this.listeners=[]}get size(){return this.currentSize}get viewport(){return this.currentViewport}setReversed(e){this.currentReverse=e,this.currentViewportData=void 0,this.refreshData()}setViewport(e){this.currentViewport=e,this.refreshInfo(),this.refreshData()}setSorts(e){this.currentSort=e,this.currentViewportData=void 0,this.refreshData()}setFilters(e){this.currentFilter=e,this.currentViewportData=void 0,this.refreshInfo(),this.refreshData()}get data(){return this.currentViewportData}async getViewportData(){var e;return this.viewportUpdatePromise||this.refreshData(),(e=this.viewportUpdatePromise)!=null?e:Promise.resolve({items:[],offset:0})}async put(e){const n={...e,_id:e.id};return await this.db.put(n),n}sendUpdate(){var s;const{listeners:e}=this,n=(s=this.currentViewportData)!=null?s:{items:[],offset:0};for(let i=0;i<e.length;i+=1)e[i](n)}sendItemUpdate(e){const n=this.itemListeners.get(e.id);if(n!==void 0)for(let s=0;s<n.length;s+=1)n[s](e)}dbUpdate(e){ga.debug("Update received",e),this.refreshInfo(),e.doc!==void 0&&this.sendItemUpdate(e.doc),this.refreshData()}async refreshInfo(){var e,n;try{(e=this.infoUpdatePromise)==null||e.cancel(),this.infoUpdatePromise=Re.makeCancelable(this.db.find({selector:fa((n=this.currentFilter)!=null?n:[]),fields:[]}));const s=await this.infoUpdatePromise;this.currentSize=s.docs.length,this.sendUpdate()}catch(s){if(!Re.isCanceled(s))throw ga.error("Unable to refreshInfo",s),s}}async refreshData(){var e,n;if(!!this.currentViewport)try{const{currentViewport:s}=this,i=w1(this.currentSort,this.currentReverse);(e=this.viewportUpdatePromise)==null||e.cancel(),this.viewportUpdatePromise=Re.makeCancelable(this.db.find({selector:fa((n=this.currentFilter)!=null?n:[]),skip:s.top,limit:s.bottom-s.top+1,sort:i,fields:["id","name"]}).then(r=>({items:r.docs,offset:s.top})));const o=await this.viewportUpdatePromise;return this.currentViewportData=o,this.sendUpdate(),o}catch(s){if(!Re.isCanceled(s))throw ga.error("Unable to refreshData",s),s}}async refreshItem(e){const s=(await this.db.find({selector:{id:e},limit:1})).docs[0];return s!==void 0&&this.sendItemUpdate(s),s}async getSnapshot(e){const n=new Map,s=[{id:this.currentReverse?"desc":"asc"}];return await Promise.all(e.map(async([i,o])=>{var l;const r=o-i+1;return this.db.find({selector:fa((l=this.currentFilter)!=null?l:[]),skip:i,limit:r,sort:s,fields:["id","name"]}).then(a=>{for(let c=0;c<r;c+=1){const h=i+c;n.set(h,a.docs[c])}})})),n}}class Lh extends v1{constructor(e){super(`CommandHistoryStorage.${e}`)}setSearch(e){this.setFilters(e?[_h.makeFilterConfig([_h.makeFilterItem("name",q.contains,e)])]:[])}}const kh=X.module("PouchCommandHistoryStorage");class T1{constructor(){this.updateTableMap=new Map}getUpdateTable(e){return this.updateTableMap.has(e)||this.updateTableMap.set(e,new Lh(e)),this.updateTableMap.get(e)}async getTable(e){return new Lh(e)}async addItem(e,n,s,i){return this.updateItem(e,{id:`${new Date().getTime()}`,name:s,data:i})}async updateItem(e,n){const s=this.getUpdateTable(e),i=await s.refreshItem(n.id),o={...i!=null?i:{},...n};return kh.debug("Updating item",o),await s.put(o),kh.debug("Update saved"),n}listenItem(e,n,s){return this.getUpdateTable(e).onItemUpdate(n,s)}}const E1=X.module("LocalWorkspaceStorage"),No=class{static async makeDefaultWorkspaceData(t,e){const{filterSets:n,links:s,layoutConfig:i}=await Hr.getDefaultLayout(t,e==null?void 0:e.isConsoleAvailable);return{settings:{defaultDateTimeFormat:ht.DEFAULT_DATETIME_FORMAT_STRING,formatter:[],timeZone:ht.DEFAULT_TIME_ZONE_ID,showTimeZone:!1,showTSeparator:!0,disableMoveConfirmation:!1,defaultDecimalFormatOptions:{defaultFormatString:We.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:mt.DEFAULT_FORMAT_STRING},truncateNumbersWithPound:!1},layoutConfig:i,closed:[{}],links:s,filterSets:n}}static async makeDefaultWorkspace(t,e){return{data:await No.makeDefaultWorkspaceData(t,e)}}constructor(t){this.layoutStorage=t}async load(t){var e;try{return JSON.parse((e=localStorage.getItem(No.STORAGE_KEY))!=null?e:"")}catch{return E1.info("Unable to load workspace data, initializing to default data"),No.makeDefaultWorkspace(this.layoutStorage,t)}}async save(t){return localStorage.setItem(No.STORAGE_KEY,JSON.stringify(t)),t}};let Ep=No;Ep.STORAGE_KEY="deephaven.WorkspaceStorage";class y1 extends Error{constructor(){super(...arguments),this.isNoConsolesError=!0}}function I1(t){return t.isNoConsolesError}const Vi=X.module("SessionUtils");function R1(){return new URL("/jsapi",`${window.location}`)}function yp(){const t=R1();return`${t.protocol}//${t.host}`}function D1(){const t=yp();return Vi.info(`Starting connection to '${t}'...`),new N.IdeConnection(t)}async function N1(t){Vi.info("Getting console types...");const e=await t.getConsoleTypes();if(Vi.info("Available types:",e),e.length===0)throw new y1("No console types available");const n=e[0];Vi.info("Starting session with type",n);const s=await t.startSession(n),i={type:n,id:qe.generate()};return Vi.info("Console session established",i),{session:s,config:i,connection:t}}function M1(){const t=yp();return Vi.info("createCoreClient",t),new N.CoreClient(t)}class F1{constructor(e,n=""){this.storageService=e,this.root=n}async getLayouts(){return(await this.storageService.listItems(this.root,"*.json")).map(n=>n.basename)}async getLayout(e){const s=await(await this.storageService.loadFile(`${this.root}/${e}`)).text();return JSON.parse(s)}}const Eo=X.module("GrpcFileStorageTable"),Ba=class{constructor(t,e="",n=e){this.currentSize=0,this.listeners=[],this.childTables=new Map,this.storageService=t,this.baseRoot=e,this.root=n,n===e&&(this.doRefresh=Je(this.doRefresh.bind(this),Ba.REFRESH_DEBOUNCE))}removeBaseRoot(t){return he.removeRoot(this.baseRoot,t)}getViewportData(){var t;return this.viewportUpdatePromise||this.refreshInternal(),(t=this.viewportUpdatePromise)!=null?t:Promise.resolve({items:[],offset:0})}getSnapshot(t){throw new Error("Method not implemented.")}get size(){return this.currentSize}setExpanded(t,e){const n=t.split("/");let s=n.shift();if((s===void 0||s==="")&&(s=n.shift()),s===void 0||s==="")throw new Error(`Invalid path: ${t}`);const i=n.join("/");if(e){if(!this.childTables.has(s)){const o=new Ba(this.storageService,this.baseRoot,`${this.root}/${s}`);this.childTables.set(s,o)}if(i){const o=this.childTables.get(s);o==null||o.setExpanded(i,e)}}else if(this.childTables.has(s))if(i){const o=this.childTables.get(s);o==null||o.setExpanded(i,e)}else this.childTables.delete(s);this.currentViewport&&this.refreshInternal()}collapseAll(){this.childTables.clear(),this.currentViewport&&this.refreshInternal()}setSearch(t){throw new Error("Method not implemented.")}setViewport(t){this.currentViewport=t,this.refreshInternal()}setFilters(){throw new Error("Method not implemented.")}setSorts(){throw new Error("Method not implemented.")}setReversed(){throw new Error("Method not implemented.")}close(){this.listeners=[]}onUpdate(t){return this.listeners=[...this.listeners,t],()=>{this.listeners=this.listeners.filter(e=>e!==t)}}doRefresh(t){Eo.debug2("doRefresh",this.root),t(this.fetchData())}refresh(){var n;Eo.debug2("refresh",this.root),(n=this.viewportUpdatePromise)==null||n.cancel();const t=new Promise(s=>{this.doRefresh(s)}),e=Re.makeCancelable(t.then(s=>{if(this.viewportUpdatePromise!==e)throw new ci;return this.currentViewportData=s,this.sendUpdate(),s}));e.catch(s=>{Re.isCanceled(s)||Eo.error("Error updating viewport",s)}),this.viewportUpdatePromise=e}refreshInternal(){try{this.refresh()}catch(t){Re.isCanceled(t)||Eo.error("Unable to refresh data",t)}}async fetchData(){const{currentViewport:t}=this;if(!t)throw new Error("No viewport set");let n=(await this.storageService.listItems(this.root)).map(s=>({type:s.type,filename:this.removeBaseRoot(s.filename),basename:s.basename,id:this.removeBaseRoot(s.filename),isExpanded:s.type==="directory"?this.childTables.has(s.basename):void 0})).sort((s,i)=>s.type!==i.type?s.type==="directory"?-1:1:s.basename.localeCompare(i.basename));for(let s=0;s<n.length;s+=1){const i=n[s],{basename:o,filename:r}=i;if(r===this.removeBaseRoot(`${this.root}/${o}`)&&i.type==="directory"){const l=this.childTables.get(o);if(l!=null){l.setViewport({top:0,bottom:t.bottom-s});const a=await l.getViewportData();n.splice(s+1,0,...a.items)}}}return this.currentSize=n.length,Eo.debug2(this.root,"items",n,t),n=n.slice(t.top,t.bottom),{items:n,offset:t.top}}sendUpdate(){var n;const{listeners:t}=this,e=(n=this.currentViewportData)!=null?n:{items:[],offset:0};for(let s=0;s<t.length;s+=1)t[s](e)}};let Ip=Ba;Ip.REFRESH_DEBOUNCE=50;const x1=X.module("GrpcFileStorage"),Rp=class{constructor(t,e=""){this.tables=[],this.refreshTables=mi(()=>{this.tables.every(n=>n.refresh().catch(()=>{}))},Rp.REFRESH_THROTTLE),this.storageService=t,this.root=e}removeRoot(t){return he.removeRoot(this.root,t)}addRoot(t){return he.addRoot(this.root,t)}async createDirectory(t){return await this.storageService.createDirectory(this.addRoot(t)),this.refreshTables(),{type:"directory",id:t,filename:t,basename:he.getBaseName(t)}}async getTable(){const t=new Ip(this.storageService,this.root);return this.tables.push(t),t}async saveFile(t){const e=dh.storage.FileContents.text(t.content);return await this.storageService.saveFile(this.addRoot(t.filename),e,!0),this.refreshTables(),t}async loadFile(t){const n=await(await this.storageService.loadFile(this.addRoot(t))).text();return{filename:t,basename:he.getBaseName(t),content:n}}async deleteFile(t){await this.storageService.deleteItem(this.addRoot(t)),this.refreshTables()}async moveFile(t,e){await this.storageService.moveItem(this.addRoot(t),this.addRoot(e)),this.refreshTables()}async info(t){const e=await this.storageService.listItems(this.addRoot(he.getPath(t)),he.getBaseName(t));if(e.length===0)throw new Bc;if(e.length>1)throw x1.error("More than one matching file found, should never happen.",e),new Error("More than one matching file found");const n=e[0];return{filename:this.removeRoot(n.filename),basename:this.removeRoot(n.basename),id:this.removeRoot(n.filename),type:n.type}}};let Dp=Rp;Dp.REFRESH_THROTTLE=150;const li=X.module("AppInit");async function _1(){li.debug("Loading plugins...");try{const t=await Ua.loadJson("/js-plugins/manifest.json");li.debug("Plugin manifest loaded:",t);const e=[];for(let i=0;i<t.plugins.length;i+=1){const{name:o,main:r}=t.plugins[i],l=`/js-plugins/${o}/${r}`;e.push(Ua.loadModulePlugin(l))}const n=await Promise.all(e),s=new Map;for(let i=0;i<n.length;i+=1){const{name:o}=t.plugins[i];s.set(o,n[i])}return li.info("Plugins loaded:",s),s}catch(t){return li.error("Unable to load plugins:",t),new Map}}async function L1(t){let e;try{e=await N1(t)}catch(n){if(!I1(n))throw n}return e}const Xc=t=>{const{workspace:e,setActiveTool:n,setCommandHistoryStorage:s,setDashboardData:i,setFileStorage:o,setLayoutStorage:r,setDashboardConnection:l,setDashboardSessionWrapper:a,setPlugins:c,setUser:h,setWorkspace:u,setWorkspaceStorage:m}=t,[p,g]=S.exports.useState(),[f,b]=S.exports.useState(!0),C=S.exports.useCallback(async()=>{var I,D;try{li.info("Initializing Web UI","0.19.1",navigator.userAgent);const M=await _1(),x=D1(),B=await L1(x);x.addEventListener(N.IdeConnection.HACK_CONNECTION_FAILURE,Z=>{var be;const{detail:ge}=Z;li.error("Connection failure",ge),g(`Unable to connect: ${(be=ge.details)!=null?be:"Unknown Error"}`)});const $="user",k={name:$,operateAs:$,groups:[],permissions:{isSuperUser:!1,isQueryViewOnly:!1,isNonInteractive:!1,canUsePanels:!0,canCreateDashboard:!0,canCreateCodeStudio:!0,canCreateQueryMonitor:!0,canCopy:!0,canDownloadCsv:!0}},H=M1();await H.login({type:N.CoreClient.LOGIN_TYPE_ANONYMOUS});const O=H.getStorageService(),F=new F1(O,"/layouts"),_=new Dp(O,"/notebooks"),L=new Ep(F),V=new T1,G=await L.load({isConsoleAvailable:B!==void 0}),{data:j}=G,{settings:ne}=j;ne.defaultDecimalFormatOptions===void 0&&(ne.defaultDecimalFormatOptions={defaultFormatString:We.DEFAULT_FORMAT_STRING}),ne.defaultIntegerFormatOptions===void 0&&(ne.defaultIntegerFormatOptions={defaultFormatString:mt.DEFAULT_FORMAT_STRING}),ne.truncateNumbersWithPound===void 0&&(ne.truncateNumbersWithPound=!1);const{shortcutOverrides:ye={}}=ne,Te=Kt.isMacPlatform?(I=ye.mac)!=null?I:{}:(D=ye.windows)!=null?D:{};Object.entries(Te).forEach(([Z,ge])=>{var be;(be=ze.get(Z))==null||be.setKeyState(ge)});const He={filterSets:j.filterSets,links:j.links};n(mn.DEFAULT),s(V),i(Dn,He),o(_),r(F),l(Dn,x),B!==void 0&&a(Dn,B),c(M),h(k),m(L),u(G)}catch(M){li.error(M),g(M)}},[n,s,i,o,r,l,a,c,h,u,m]),v=S.exports.useCallback(()=>{document.fonts!=null?document.fonts.ready.then(()=>{b(!1)}):b(!1)},[]);S.exports.useEffect(function(){C(),v()},[C,v]);const T=e==null&&p==null||f,E=!T&&p==null,y=p!=null?`${p}`:null;return w(ue,{children:[E&&d(f1,{}),d(ul,{isLoading:T,isLoaded:E,errorMessage:y}),w("div",{id:"preload-fonts",style:{visibility:"hidden",position:"absolute",top:-1e4},children:[d("p",{className:"fira-sans-regular",children:"preload"}),d("p",{className:"fira-sans-semibold",children:"preload"}),d("p",{className:"fira-mono",children:"preload"})]})]})};Xc.propTypes={workspace:R.exports.shape({}),workspaceStorage:R.exports.shape({close:R.exports.func}),setActiveTool:R.exports.func.isRequired,setCommandHistoryStorage:R.exports.func.isRequired,setDashboardData:R.exports.func.isRequired,setFileStorage:R.exports.func.isRequired,setLayoutStorage:R.exports.func.isRequired,setDashboardConnection:R.exports.func.isRequired,setDashboardSessionWrapper:R.exports.func.isRequired,setPlugins:R.exports.func.isRequired,setUser:R.exports.func.isRequired,setWorkspace:R.exports.func.isRequired,setWorkspaceStorage:R.exports.func.isRequired};Xc.defaultProps={workspace:null,workspaceStorage:null};const k1=t=>({workspace:Sl(t),workspaceStorage:Kb(t)}),Oh=xt(k1,{setActiveTool:Tl,setCommandHistoryStorage:iS,setDashboardData:ym,setFileStorage:oS,setLayoutStorage:kE,setDashboardConnection:NT,setDashboardSessionWrapper:MT,setPlugins:lS,setUser:nS,setWorkspace:sm,setWorkspaceStorage:sS})(Xc),O1=()=>d(Yp,{basename:"/ide/",children:w(Xp,{children:[d(rd,{exact:!0,path:"/",component:Oh}),d(rd,{path:"/notebook/:notebookPath+",component:Oh}),d(jp,{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 A1(){"serviceWorker"in navigator&&navigator.serviceWorker.getRegistrations().then(t=>{t.forEach(e=>{e.scope.endsWith("/download/")||e.unregister()})})}GE();ui.render(d(Hh,{store:El,children:d(O1,{})}),document.getElementById("root"));A1();nl.registerOnLoaded();dt.init();window["__react-beautiful-dnd-disable-dev-warnings"]=!0;
43
+ //# sourceMappingURL=index.68e8cbc9.js.map