@deephaven/embed-grid 0.24.1-hierarchical-table.0 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/assets/index.f14a859d.js +33 -0
- package/build/assets/index.f14a859d.js.map +1 -0
- package/build/assets/{index.546eb395.css → index.fca7a773.css} +1 -1
- package/build/assets/{plotly.7ae85f9d.js → plotly.88e53766.js} +2 -2
- package/build/assets/{plotly.7ae85f9d.js.map → plotly.88e53766.js.map} +1 -1
- package/build/assets/vendor.a5d0aea5.js +1242 -0
- package/build/assets/{vendor.c532306d.js.map → vendor.a5d0aea5.js.map} +1 -1
- package/build/index.html +5 -5
- package/package.json +12 -12
- package/build/assets/index.6e360c73.js +0 -33
- package/build/assets/index.6e360c73.js.map +0 -1
- package/build/assets/vendor.c532306d.js +0 -1238
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import{B as D,A as T,R as J,P as Ic,C as h,D as lt,E as G,F as R,G as nr,H as he,I as Et,J as Q,K as Fe,L as tn,M as Mc,N as Dc,O as sr,Q as io,S as Nc,T as ir,U as Ue,V as qo,W as Ee,X as ht,Y as oo,Z as qr,_ as Fc,$ as Zt,a0 as xc,a1 as Ac,a2 as Oc,a3 as kc,a4 as Ko,a5 as Lc,a6 as Pc,a7 as Hc,a8 as Kr,a9 as _c,aa as Vc,ab as Xr,ac as Uc,ad as Bc,ae as Gc,af as zc,ag as Wc,ah as Xn,ai as $c,aj as Xo,ak as $l}from"./vendor.a5d0aea5.js";import{e as bn,l as Ms,K as Dt,a as Yr,b as Qt}from"./monaco.b3653ac5.js";import{P as qi,b as qc,h as Kc,p as Xc,o as Yc,s as Qc,t as jc,c as xo}from"./plotly.88e53766.js";import"./helpers.162e09a8.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.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 Zc="#1a171a",Jc="#f0f0ee",ed="#fcd65b",td="#9edc6f",nd="#76d9e4",sd="#aa9af4",id="#f37e3f",od="#f95d84",rd="#4878ea",ld="#5b5a5c",ad="#9edc6f",cd="#fcd65b",dd="#f37e3f",ud="#f95d84",hd="#fcfcfa",md="#929192",pd="#373438",gd="#1a171a",fd="#f0f0ee",Cd="0.15s",wd={"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:Zc,white:Jc,yellow:ed,green:td,blue:nd,purple:sd,orange:id,red:od,primary:rd,"primary-hover":"#235de6","primary-dark":"#343e5d",secondary:ld,success:ad,info:cd,warning:dd,danger:ud,light:hd,mid:md,dark:pd,"text-muted":"#929192","content-bg":"#2d2a2e",background:gd,foreground:fd,transition:Cd},bd={transitionMs:150,transitionMidMs:200,transitionLongMs:300,transitionSlowMs:1e3},xe=Object.freeze({...bd,...wd});class vn extends T.exports.Component{constructor(t){super(t),this.handleEnter=this.handleEnter.bind(this),this.handleExit=this.handleExit.bind(this),this.handleBlur=this.handleBlur.bind(this),this.element=document.createElement("div"),this.element.className="popper-container",this.container=J.createRef(),this.rAF=0;const{isShown:n}=this.props;this.state={show:n,popper:null}}componentDidUpdate(t){const{isShown:n}=this.props;t.isShown!==n&&(n?(cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{this.show()})):this.hide())}componentWillUnmount(){this.destroyPopper(!1)}getVisibleElement(t){return t==null||t.clientHeight>0||t.clientWidth>0?t:this.getVisibleElement(t.parentElement)}initPopper(){let{popper:t}=this.state;const{closeOnBlur:n,referenceObject:s}=this.props;if(t||this.container.current===null)return;let{options:i}=this.props;i={placement:"auto",modifiers:{preventOverflow:{boundariesElement:"viewport"}},...i},document.body.appendChild(this.element);let o=this.getVisibleElement(this.container.current);o==null&&(o=this.container.current),t=new Ic(s||o,this.element,i),t.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:t})}destroyPopper(t=!0){cancelAnimationFrame(this.rAF);const{popper:n}=this.state;!n||(n.destroy(),document.body.contains(this.element)&&document.body.removeChild(this.element),t&&this.setState({popper:null}))}show(){this.initPopper(),this.setState({show:!0})}hide(){this.setState({show:!1})}scheduleUpdate(){const{popper:t}=this.state;t&&t.scheduleUpdate()}handleBlur(t){t.relatedTarget instanceof HTMLElement&&(this.element.contains(t.relatedTarget)||this.hide())}handleEnter(){const{onEntered:t}=this.props;t()}handleExit(){const{onExited:t}=this.props,{show:n}=this.state;n||this.destroyPopper(),t()}renderContent(){const{className:t,children:n,timeout:s,interactive:i,closeOnBlur:o}=this.props,{show:r}=this.state;return h(lt,{in:r,timeout:s,classNames:"popper-transition",onEntered:this.handleEnter,onExited:this.handleExit,children:h("div",{onClick:l=>{l.stopPropagation()},onKeyDown:l=>{l.key==="Escape"&&this.hide()},className:G("popper",{interactive:i},t),onBlur:o?this.handleBlur:void 0,tabIndex:o?-1:void 0,role:"presentation",children:R("div",{className:"popper-content",children:[n,h("div",{className:"popper-arrow","x-arrow":""})]})})})}render(){const{popper:t}=this.state,{"data-testid":n}=this.props;return h("div",{className:"popper-parent-container",ref:this.container,style:{display:"none"},"data-testid":n,children:t&&nr.createPortal(this.renderContent(),this.element)})}}vn.propTypes={children:D.exports.node.isRequired,options:D.exports.shape({}),className:D.exports.string,timeout:D.exports.number,onEntered:D.exports.func,onExited:D.exports.func,isShown:D.exports.bool,closeOnBlur:D.exports.bool,interactive:D.exports.bool,referenceObject:D.exports.shape({}),"data-testid":D.exports.string};vn.defaultProps={options:{},className:"",timeout:xe.transitionMs,onEntered(){},onExited(){},isShown:!1,interactive:!1,closeOnBlur:!1,referenceObject:null,"data-testid":void 0};const Sd=-1,ql=0,Kl=1,or=2,Xl=3,Yl=4;Object.freeze({SILENT:Sd,ERROR:ql,WARN:Kl,INFO:or,DEBUG:Xl,DEBUG2:Yl});const Ft=()=>{};class Qr{constructor(t,n){this.name=t,this.prefix=t!=null?`[${t}]`:"",this.error=Ft,this.warn=Ft,this.log=Ft,this.info=Ft,this.debug=Ft,this.debug2=Ft,this.level=n,this.setLogLevel(n)}setLogLevel(t){if(!Number.isFinite(t)){console.warn(`Expected a number for log level. Received: ${t}. Ignoring`);return}this.level=t,this.error=t>=ql?console.error.bind(console,this.prefix):Ft,this.warn=t>=Kl?console.warn.bind(console,this.prefix):Ft,this.log=t>=or?console.log.bind(console,this.prefix):Ft,this.info=this.log,this.debug=t>=Xl?console.debug.bind(console,this.prefix):Ft,this.debug2=t>=Yl?console.debug.bind(console,this.prefix):Ft}}class vd extends Qr{constructor(t=or){super(null,t),this.modules={}}module(t){return this.modules[t]==null&&(this.modules[t]=new Qr(t,this.level)),this.modules[t]}setLogLevel(t){if(super.setLogLevel(t),this.modules==null)return;const n=Object.keys(this.modules);for(let s=0;s<n.length;s+=1)this.modules[n[s]].setLogLevel(t)}}const ne=new vd,Td=ne.module("Tooltip"),Ct=class extends T.exports.Component{constructor(e){super(e),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleWindowMouseMove=this.handleWindowMouseMove.bind(this),this.handleWheel=this.handleWheel.bind(this),this.handleTimeout=this.handleTimeout.bind(this),this.handleExited=this.handleExited.bind(this),this.stopShowingTooltip=this.stopShowingTooltip.bind(this),this.container=J.createRef(),this.popper=J.createRef(),this.parent=null,this.timer=null,this.state={isShown:!1}}static handleHidden(){Ct.shownTooltipCount-=1,Ct.shownTooltipCount===0&&(Ct.lastHiddenTime=Date.now())}static handleShown(){Ct.shownTooltipCount+=1}componentDidMount(){this.startListening();const{timeout:e}=this.props;e===0&&this.show()}componentDidUpdate(e,t){const{isShown:n}=t,{isShown:s}=this.state;s!==n&&(s?Ct.handleShown():Ct.handleHidden())}componentWillUnmount(){this.stopListening(),this.stopListeningWindow(),this.stopTimer();const{isShown:e}=this.state;e&&Ct.handleHidden()}startListening(){if(!this.container.current||!this.container.current.parentElement){Td.error("Tooltip doesn't have a container or a parent set!");return}this.parent=this.container.current.parentElement,this.parent.addEventListener("mousemove",this.handleMouseMove),this.parent.addEventListener("mouseleave",this.handleMouseLeave),this.parent.addEventListener("mousedown",this.stopShowingTooltip)}stopListening(){!this.parent||(this.parent.removeEventListener("mousemove",this.handleMouseMove),this.parent.removeEventListener("mouseleave",this.handleMouseLeave),this.parent.removeEventListener("mousedown",this.stopShowingTooltip))}startListeningWindow(){window.addEventListener("mousemove",this.handleWindowMouseMove,!0),window.addEventListener("contextmenu",this.stopShowingTooltip,!0),window.addEventListener("wheel",this.handleWheel)}stopListeningWindow(){window.removeEventListener("mousemove",this.handleWindowMouseMove,!0),window.removeEventListener("contextmenu",this.stopShowingTooltip,!0),window.removeEventListener("wheel",this.handleWheel)}handleMouseMove(){this.startTimer()}handleWheel(){const{isShown:e}=this.state;this.popper.current&&this.parent&&e&&!this.popper.current.element.matches(":hover")&&!this.parent.matches(":hover")&&(this.stopTimer(),this.hide())}handleMouseLeave(){const{isShown:e}=this.state;this.stopTimer();const{interactive:t}=this.props;!t&&e&&this.hide()}handleTimeout(){this.show()}handleWindowMouseMove(e){const t=e.clientX,n=e.clientY,{isShown:s}=this.state;if(!this.popper.current||!this.parent)return;const i=this.popper.current.element.getBoundingClientRect(),o=this.parent.getBoundingClientRect();t>=i.left&&t<=i.left+i.width&&n>=i.top&&n<=i.top+i.height?this.handleMouseMove():t>=o.left&&t<=o.left+o.width&&n>=o.top&&n<=o.top+o.height?this.handleMouseMove():s&&(this.stopTimer(),this.hide())}startTimer(){this.stopTimer();const{timeout:e,reshowTimeout:t}=this.props;let n=e;(Ct.shownTooltipCount>0||Date.now()-Ct.lastHiddenTime<Ct.triggerReshowThreshold)&&(n=t),this.timer=window.setTimeout(this.handleTimeout,n)}stopTimer(){this.timer!=null&&(clearTimeout(this.timer),this.timer=null)}show(){var t;const{isShown:e}=this.state;if(this.stopTimer(),!e){(t=this.popper.current)==null||t.show(),this.setState({isShown:!0});const{interactive:n}=this.props;n&&this.startListeningWindow()}}hide(){var e;(e=this.popper.current)==null||e.hide(),this.stopListeningWindow()}update(){var e;(e=this.popper.current)==null||e.scheduleUpdate()}handleExited(){this.setState({isShown:!1});const{onExited:e}=this.props;e()}stopShowingTooltip(){const{isShown:e}=this.state;this.stopTimer(),e&&this.hide()}render(){const{interactive:e,children:t,referenceObject:n,popperClassName:s,"data-testid":i,onEntered:o}=this.props,{isShown:r}=this.state;let{options:l}=this.props;return l={placement:"bottom",...l},h("div",{ref:this.container,style:{display:"none"},"data-testid":i,children:h(vn,{className:G(s),options:l,ref:this.popper,onEntered:o,onExited:this.handleExited,interactive:e,referenceObject:n,children:R("div",{className:"tooltip-content",children:[" ",r&&t]})})})}};let Be=Ct;Be.defaultTimeout=500;Be.defaultReshowTimeout=100;Be.triggerReshowThreshold=300;Be.shownTooltipCount=0;Be.lastHiddenTime=Date.now();Be.defaultProps={interactive:!1,options:{},popperClassName:"",reshowTimeout:Ct.defaultReshowTimeout,timeout:Ct.defaultTimeout,onEntered:()=>{},onExited:()=>{},"data-testid":void 0};const Ed=100;var Ql=(e=>(e.UP="UP",e.DOWN="DOWN",e))(Ql||{});const ns=class extends T.exports.Component{constructor(e){super(e),this.getCachedFilteredOptions=he((n,s)=>n.filter(i=>i.title.toLowerCase().indexOf(s.toLowerCase())>=0));let{popperOptions:t}=this.props;t={placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}},...t},this.state={title:"",filteredOptions:[],keyboardOptionIndex:0,menuIsOpen:!1,inputWidth:100,invalid:!1,popperOptions:t},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=Et(this.updateInputValue,Ed),this.handleOptionClick=this.handleOptionClick.bind(this),this.handleMenuOpened=this.handleMenuOpened.bind(this),this.handleMenuExited=this.handleMenuExited.bind(this),this.popper=J.createRef(),this.cbContainer=J.createRef(),this.menuContainer=J.createRef(),this.input=J.createRef()}setInputWidth(){this.cbContainer.current&&this.setState({inputWidth:this.cbContainer.current.getBoundingClientRect().width})}getValueAndValidate(e){if(!e)return this.setState({invalid:!1}),{value:e,isValid:!1};const{options:t}=this.props,n=t.filter(s=>s.title.toLowerCase()===e.toLowerCase());return n.length<1?(this.setState({invalid:!0}),{value:e,isValid:!1}):(this.setState({invalid:!1}),{value:n[0].value,isValid:!0})}updateInputValue(e){const{menuIsOpen:t}=this.state,{value:n,isValid:s}=this.getValueAndValidate(e);t&&this.processFilterChange(e),this.fireOnChange(n,s)}fireOnChange(e,t=!0){const{onChange:n}=this.props;n(e,t)}processFilterChange(e){var o;const{options:t}=this.props,{menuIsOpen:n}=this.state,s=e?this.getCachedFilteredOptions(t,e):t,i=s.length===1&&s[0].title===e;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(e){var i;const{filteredOptions:t,keyboardOptionIndex:n}=this.state,s=t[n];switch(e.key){case"Enter":case"ArrowRight":e.stopPropagation(),e.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":e.stopPropagation(),e.preventDefault(),this.navigateMenu(ns.MENU_NAVIGATION_DIRECTION.UP);break;case"ArrowDown":e.stopPropagation(),e.preventDefault(),this.navigateMenu(ns.MENU_NAVIGATION_DIRECTION.DOWN);break;case"Tab":if(e.stopPropagation(),e.preventDefault(),e.shiftKey){this.navigateMenu(ns.MENU_NAVIGATION_DIRECTION.UP);break}this.navigateMenu(ns.MENU_NAVIGATION_DIRECTION.DOWN);break;case"Escape":e.preventDefault(),e.stopPropagation(),this.closeMenu();break}}navigateMenu(e){const{filteredOptions:t,keyboardOptionIndex:n}=this.state;let s=n;e===ns.MENU_NAVIGATION_DIRECTION.UP?n>0?(s=(s-1)%t.length,this.setState({keyboardOptionIndex:s})):n===0&&(s=t.length-1,this.setState({keyboardOptionIndex:s})):e===ns.MENU_NAVIGATION_DIRECTION.DOWN&&n<t.length&&(s=(s+1)%t.length,this.setState({keyboardOptionIndex:s})),this.scrollOptionIntoView(s)}handleInputKeyDown(e){const{onEnter:t}=this.props,{menuIsOpen:n}=this.state;n?this.handleMenuKeyDown(e):e.key==="Enter"?t():e.key==="Escape"?(this.resetValue(),e.preventDefault(),e.stopPropagation()):e.key==="ArrowRight"||e.key==="ArrowLeft"||e.key==="Tab"||e.key==="Shift"||this.openMenu()}handleInputChange(e){this.setState({title:e.target.value}),this.updateInputValue(e.target.value)}handleOptionClick(e){var t;this.setState({title:e.title,invalid:!1}),this.fireOnChange(e.value),this.closeMenu(),(t=this.input.current)==null||t.focus()}handelInputFocus(){const{menuIsOpen:e}=this.state;e||this.openMenu()}handleInputClick(){const{menuIsOpen:e}=this.state;e||this.openMenu()}handleInputBlur(e){const{menuIsOpen:t}=this.state;t&&e.relatedTarget instanceof Element&&this.popper.current!==null&&this.popper.current.element.contains(e.relatedTarget)||this.closeMenu(!1)}handleMenuBlur(e){e.relatedTarget===this.input.current||e.relatedTarget instanceof Element&&this.popper.current!==null&&this.popper.current.element.contains(e.relatedTarget)||this.closeMenu(!1)}handleMenuOpened(){var e;(e=this.input.current)==null||e.focus()}handleMenuExited(){const{menuIsOpen:e}=this.state;e&&this.setState({menuIsOpen:!1,keyboardOptionIndex:0})}openMenu(){const{title:e}=this.state;this.processFilterChange(e),this.setInputWidth(),this.setState({menuIsOpen:!0}),window.requestAnimationFrame(()=>{var t;(t=this.popper.current)==null||t.show()})}closeMenu(e=!0){var t,n;this.setState({menuIsOpen:!1,keyboardOptionIndex:0}),e&&((t=this.input.current)==null||t.focus()),(n=this.popper.current)==null||n.hide()}scrollOptionIntoView(e){var t;this.menuContainer.current&&((t=this.menuContainer.current.children.item(e))==null||t.scrollIntoView({behavior:"smooth",block:"nearest"}))}renderMenuElement(){const{inputWidth:e}=this.state;return h("div",{className:G("aci-options"),ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,style:{width:e},onBlur:this.handleMenuBlur,children:this.renderOptions()})}renderOptions(){const{noMatchText:e}=this.props,{title:t,filteredOptions:n}=this.state;return t&&n.length===0?h("div",{className:"no-match",children:e}):n.map((s,i)=>this.renderOption(s,i))}renderOption(e,t){const{keyboardOptionIndex:n}=this.state,s=`option-${t}-${e.value}`;return h("button",{type:"button",className:G("aci-option-btn",{"keyboard-active":n===t}),onClick:()=>this.handleOptionClick(e),onFocus:()=>this.setState({keyboardOptionIndex:t}),children:e.title},s)}render(){const{options:e,inputPlaceholder:t,disabled:n,className:s,defaultTitle:i,spellCheck:o,"data-testid":r}=this.props,{title:l,menuIsOpen:a,popperOptions:c,invalid:d}=this.state;return R("div",{className:"aci-container",ref:this.cbContainer,children:[h("input",{value:l||i,className:G("form-control",s,"aci-input",{"is-invalid":d&&!a}),ref:this.input,onChange:this.handleInputChange,placeholder:t||e[0].title,disabled:n,onFocus:this.handelInputFocus,onClick:this.handleInputClick,onBlur:this.handleInputBlur,onKeyDown:this.handleInputKeyDown,spellCheck:o,"data-testid":r}),h(vn,{ref:this.popper,options:c,className:G("aci-options-popper interactive"),onEntered:this.handleMenuOpened,onExited:this.handleMenuExited,children:this.renderMenuElement()})]})}};let rr=ns;rr.propTypes={options:D.exports.arrayOf(D.exports.shape({title:D.exports.string.isRequired,value:D.exports.string.isRequired})).isRequired,popperOptions:D.exports.shape({}),onChange:D.exports.func,inputPlaceholder:D.exports.string,disabled:D.exports.bool,className:D.exports.string,defaultTitle:D.exports.string,spellCheck:D.exports.bool,onEnter:D.exports.func,noMatchText:D.exports.string,"data-testid":D.exports.string};rr.defaultProps={onChange(){},inputPlaceholder:"",disabled:!1,className:"",defaultTitle:"",popperOptions:null,spellCheck:!0,onEnter(){},noMatchText:"No matching items found","data-testid":void 0};rr.MENU_NAVIGATION_DIRECTION=Ql;D.exports.string.isRequired,D.exports.func.isRequired,D.exports.string,D.exports.string,D.exports.bool,D.exports.bool,D.exports.string,D.exports.string,D.exports.string;D.exports.node.isRequired,D.exports.string,D.exports.object,D.exports.string;const yd=["primary","secondary","tertiary","success","danger","inline","ghost"],Rd=["group-end"];function Id(e,t){switch(e){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 G("btn-link",{"btn-link-icon":t,"btn-link-icon-only":t})}}function Md(e){switch(e){case"group-end":return G("pl-2","pr-3")}}const K=J.forwardRef((e,t)=>{const{kind:n,variant:s,type:i,tooltip:o,icon:r,disabled:l=!1,active:a,onClick:c,onContextMenu:d,onMouseDown:u,onMouseUp:m,onMouseEnter:p,onMouseLeave:g,onKeyDown:f,className:C,style:w,children:b,tabIndex:S,"data-testid":E,"aria-label":v}=e,y=Boolean(r&&b==null),M=Id(n,y);let F;s&&(F=Md(s));let x;r&&(x=J.isValidElement(r)?r:h(Q,{icon:r}));let U;o!==void 0&&(U=typeof o=="string"?h(Be,{children:o}):o);let V=v;v===void 0&&y&&o!=null&&typeof o=="string"&&(V=o);const N=R("button",{"data-testid":E,ref:t,type:i,className:G("btn",M,F,{active:a},C),onClick:c,onContextMenu:d,onMouseUp:m,onMouseDown:u,onMouseEnter:p,onMouseLeave:g,onKeyDown:f,style:w,disabled:l,tabIndex:S,"aria-label":V,children:[r&&x,b,o!=null&&!l&&U]});return l?R("span",{className:"btn-disabled-wrapper",children:[N,o!==void 0&&U]}):N});K.displayName="Button";K.propTypes={kind:D.exports.oneOf(yd).isRequired,variant:D.exports.oneOf(Rd),type:D.exports.oneOf(["submit","reset","button"]),tooltip(e){const{tooltip:t,icon:n,children:s}=e;return t===void 0&&n!=null&&s==null?new Error("Tooltip is required for icon only buttons"):null},icon(e){const{children:t,icon:n}=e;return n==null&&t==null?new Error("Icon is required if no children are provided"):t==null&&!J.isValidElement(n)&&(n==null||n.iconName===""||n.iconName==null)?new Error("Icon must be react element or fontawesome IconDefinition"):null},disabled:D.exports.bool,active:D.exports.bool,onClick(e){const{onClick:t,type:n}=e;return n==="button"&&typeof t!="function"?new Error("type button requires an onClick function"):t!==void 0&&typeof t!="function"?new Error("onClick must be a function"):null},onContextMenu:D.exports.func,onMouseUp:D.exports.func,onMouseDown:D.exports.func,onMouseEnter:D.exports.func,onMouseLeave:D.exports.func,onKeyDown:D.exports.func,tabIndex:D.exports.number,children:D.exports.node,className:D.exports.string,style:D.exports.object,"data-testid":D.exports.string};K.defaultProps={type:"button",onClick:void 0,onContextMenu:void 0,onMouseUp:void 0,onMouseDown:void 0,onMouseEnter:void 0,onMouseLeave:void 0,onKeyDown:void 0,variant:void 0,tooltip:void 0,icon:void 0,disabled:!1,active:void 0,tabIndex:void 0,children:void 0,className:void 0,style:{},"data-testid":void 0};function Dd({className:e="theme-bg-light",children:t,role:n="role",keyboard:s=!0,isOpen:i=!1,centered:o=!1,size:r,onOpened:l,onClosed:a,toggle:c,"data-testid":d}){const u=T.exports.useRef(),m=T.exports.useRef(null),[p,g]=T.exports.useState(!1),f=T.exports.useCallback(w=>{switch(w.key){case"Escape":c==null||c();break}},[c]);T.exports.useEffect(function(){if(i&&s)return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[f,i,s]),T.exports.useEffect(function(){i&&l&&l()},[l,i]),T.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 C=()=>{u.current&&(document.body.removeChild(u.current),u.current=void 0)};return u.current?nr.createPortal(R(Fe,{children:[h(lt,{appear:!0,mountOnEnter:!0,unmountOnExit:!0,in:i,classNames:{appearActive:"show",appearDone:"show"},timeout:xe.transitionMs,onExited:C,children:h("div",{className:G("modal-backdrop fade"),style:{zIndex:1050}})}),h(lt,{appear:!0,mountOnEnter:!0,unmountOnExit:!0,in:i,classNames:{appearDone:"show"},timeout:xe.transitionMs,onExited:C,children:h("div",{ref:m,className:"modal fade",onMouseDown:w=>{w.target===m.current?g(!0):g(!1)},onMouseUp:w=>{p&&w.target===m.current&&c!==void 0&&c()},role:"dialog",style:{display:"block"},children:h("div",{className:G(`modal-dialog ${e}`,{"modal-lg":r==="lg","modal-sm":r==="sm","modal-xl":r==="xl","modal-dialog-centered":o}),style:{zIndex:1040},children:h("div",{className:"modal-content",role:"presentation","data-testid":d,children:t})})})})]}),u.current):null}function Nd({className:e="modal-body",style:t,children:n,"data-testid":s}){return h("div",{className:e,"data-testid":s,style:t,children:n})}function Fd({className:e,children:t,closeButton:n=!0,style:s,toggle:i,"data-testid":o}){return R("div",{className:`modal-header ${e}`,style:s,children:[h("h5",{className:"modal-title",children:t}),n&&h("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":"Close",onClick:i,children:h("span",{"aria-hidden":"true",children:"\xD7"})})]})}D.exports.bool.isRequired,D.exports.string.isRequired,D.exports.oneOfType([D.exports.string,D.exports.func]).isRequired,D.exports.func,D.exports.func.isRequired,D.exports.func,D.exports.func,D.exports.string,D.exports.string,D.exports.string,D.exports.node,D.exports.string;const lr=J.forwardRef((e,t)=>{const{children:n,className:s,disabled:i,onClick:o,style:r,id:l}=e;return h("button",{ref:t,type:"button",className:G("btn",s),onClick:o,style:r,disabled:i,id:l,children:n})});lr.displayName="Button";lr.propTypes={children:D.exports.node,className:D.exports.string,disabled:D.exports.bool,onClick:D.exports.func,style:D.exports.shape({}),id:D.exports.string};lr.defaultProps={children:null,className:"",disabled:!1,onClick:()=>null,style:{},id:""};function Ao(e){return e.then!==void 0}const Ds=class{static disableAllActions(){Ds.actionsDisabled=!0}static enableAllActions(){Ds.actionsDisabled=!1}static isContextActionEvent(e){return Array.isArray(e.contextActions)}static compareActions(e,t){var n,s,i,o,r,l;return e.group!==t.group?((n=e.group)!=null?n:0)>((s=t.group)!=null?s:0)?1:-1:e.order!==t.order?((i=e.order)!=null?i:0)>((o=t.order)!=null?o:0)?1:-1:e.title!==t.title?((r=e.title)!=null?r:"")>((l=t.title)!=null?l:"")?1:-1:e!==t?e>t?1:-1:0}static sortActions(e){if(e==null||!Array.isArray(e))return[];const t=e.slice();return t.sort(Ds.compareActions),t}static isMacPlatform(){const{platform:e}=window.navigator;return e.startsWith("Mac")}static getModifierKey(){return Ds.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(e){const t=Ds.getModifierKey();return e[t]}static getMenuItems(e,t=!0){let n=[],s=e;Array.isArray(s)||(s=[s]);for(let i=0;i<s.length;i+=1){const o=s[i];let r;typeof o=="function"?r=o():r=o,r!=null&&(r instanceof Promise?t&&n.push(r):Array.isArray(r)?n=n.concat(r):n.push(r))}return n=n.filter(i=>i.title!==void 0||i.then!=null||i.menuElement),n}static getNextMenuItem(e,t,n){let s=e;s<0&&t<0&&(s=n.length);for(let i=1;i<n.length+1;i+=1){const o=(s+t*i+n.length)%n.length,r=n[o];if(!(r instanceof Promise)&&r.disabled!==!0)return o}return e}};let Ne=Ds;Ne.actionsDisabled=!1;const jr=ne.module("GlobalContextAction");class xd extends T.exports.Component{constructor(t){super(t),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(t){const n=t;n.contextActions==null&&(n.contextActions=[]);const{action:s}=this.props;s.title==null&&!s.menuElement||(n.contextActions==null&&(n.contextActions=[]),n.contextActions.push(s),jr.debug("Received context menu event at global action! Menu items are now: ",n.contextActions))}handleKeyDown(t){var s;const{action:n}=this.props;!Ne.actionsDisabled&&n.shortcut!==void 0&&n.shortcut.matchesEvent(t)&&(jr.debug("Global hotkey matched!",t),(s=n.action)==null||s.call(n,t),t.preventDefault(),t.stopPropagation())}render(){return null}}class Ad extends T.exports.Component{render(){const{actions:t,"data-testid":n}=this.props,s=[];for(let i=0;i<t.length;i+=1){const o=t[i],{shortcut:r}=o;if(o.title!=null||o.menuElement||r){const l=h(xd,{action:o,"data-testid":n},`${o.title}.${r==null?void 0:r.id}`);s.push(l)}}return s}}const xi=ne.module("ContextActions");class oe extends T.exports.Component{constructor(t){super(t),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.container=J.createRef(),this.state={globalActions:[],keyboardActions:[]}}static triggerMenu(t,n,s,i){if(i.length===0)return;const o=new MouseEvent("contextmenu",{clientX:n,clientY:s,bubbles:!0,cancelable:!0});o.contextActions=i,t.dispatchEvent(o)}static getDerivedStateFromProps(t){if(t.actions==null||!Array.isArray(t.actions))return{globalActions:[],keyboardActions:[]};const n=t.actions.filter(i=>!Ao(i)&&typeof i!="function"&&i.isGlobal),s=t.actions.filter(i=>!Ao(i)&&typeof i!="function"&&(i.isGlobal===void 0||!i.isGlobal)&&i.shortcut!=null);return{globalActions:n,keyboardActions:s}}componentDidMount(){var t;(t=this.container.current)!=null&&t.parentElement&&(this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.addEventListener("keydown",this.handleKeyDown))}componentWillUnmount(){var t;(t=this.container.current)!=null&&t.parentElement&&(this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.removeEventListener("keydown",this.handleKeyDown))}handleContextMenu(t){const{ignoreClassNames:n=[]}=this.props;if(n.length>0){let i=t.target;for(;i!=null;){const{classList:o}=i,r=n.find(l=>o.contains(l));if(r!==void 0){xi.debug2(`Contextmenu event ignored based on the target className "${r}"`);return}i=i.parentElement}}if(Ne.isContextActionEvent(t)||(t.contextActions=[]),!Ne.isContextActionEvent(t))return;const{actions:s}=this.props;if(s!=null){let i=s;Array.isArray(i)&&(i=i.filter(o=>Ao(o)||typeof o=="function"||o.isGlobal===void 0||!o.isGlobal)),t.contextActions=t.contextActions.concat(i)}xi.debug("Received context menu event! Menu items are now: ",t.contextActions)}handleKeyDown(t){var s;const{keyboardActions:n}=this.state;for(let i=0;i<n.length;i+=1){const o=n[i];!Ne.actionsDisabled&&o.shortcut!=null&&o.shortcut.matchesEvent(t)&&(xi.debug("Context hotkey matched!",t),(s=o.action)==null||s.call(o,t),t.stopPropagation(),t.preventDefault(),xi.debug2("Matched hotkey returned false, key event not consumed"))}}render(){const{"data-testid":t}=this.props,{globalActions:n}=this.state;return h("div",{className:"context-actions-listener",ref:this.container,"data-testid":t,children:h(Ad,{actions:n})})}}oe.groups={default:null,high:100,medium:5e3,low:1e4,global:1e5,edit:100};var Od={prefix:"vs",iconName:"add",icon:[512,512,[],"f000","M448 224v32H256v192H224V256H32V224h192V32h32v192h192z"]},kd={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"]},Wn={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"]},Ld={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"]},Pd={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"]},jl={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"]},Hd={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"]},_d={prefix:"vs",iconName:"chrome-close",icon:[512,512,[],"f000","m227.712 256 -145.856 145.856 28.288 28.288L256 284.288l145.856 145.856 28.288 -28.288L284.288 256l145.856 -145.856 -28.288 -28.288L256 227.712 110.144 81.856l-28.288 28.288L227.712 256z"]},ro={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"]},Vd={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"]},Zr={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"]},di={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"]},Ud={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"]},Bd={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"]},ar={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"]},Jr={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"]},Gd={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"]},zd={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"]},Ki={prefix:"vs",iconName:"filter",icon:[512,512,[],"f000","M480 64v53.44l-160 152.288V448H192V269.728l-160 -152.32V64h448zM224 256v160h64V256l160 -152.32V96H64v7.68L224 256z"]},Wd={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"]},Zl={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"]},lo={prefix:"vs",iconName:"gripper",icon:[512,512,[],"f000","M160 96h64v64H160zm0 128h64v64H160zm0 128h64v64H160zm128 -256h64v64H288zm0 128h64v64H288zm0 128h64v64H288z"]},$d={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"]},qd={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"]},Kd={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"]},Jl={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"]},Xd={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"]},ea={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"]},Yd={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"]},Qd={prefix:"vs",iconName:"menu",icon:[512,512,[],"f000","M512 160H0V128h512v32zm0 256H0v-32h512v32zm0 -128.256H0V256h512v31.744z"]},jd={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"]},Zd={prefix:"vs",iconName:"paintcan",icon:[512,512,[],"f000","m465.28 377.952 -36.48 -99.84v-1.92l-157.12 -157.12v-39.68a53.12 53.12 0 0 0 -3.52 -18.56 47.36 47.36 0 0 0 -26.56 -25.6 45.44 45.44 0 0 0 -18.56 -3.2 47.04 47.04 0 0 0 -47.36 47.36v104.32l-97.92 96a48.64 48.64 0 0 0 0 67.84l116.16 116.16c4.48 4.512 9.824 8.096 15.68 10.56a48.96 48.96 0 0 0 36.48 0 48.32 48.32 0 0 0 15.68 -10.56l157.76 -157.44 -21.12 70.4a38.08 38.08 0 0 0 0 14.72c1.056 4.864 3.136 9.472 6.08 13.44 3.136 3.872 6.912 7.136 11.2 9.6 4.48 2.24 9.408 3.52 14.4 3.84a32 32 0 0 0 15.36 -2.88 36.48 36.48 0 0 0 12.48 -9.28 31.36 31.36 0 0 0 7.04 -14.08c1.024 -4.64 1.12 -9.408 0.32 -14.08zm-256 -298.56a14.72 14.72 0 0 1 0 -6.4 16.64 16.64 0 0 1 3.84 -5.44 20.48 20.48 0 0 1 5.76 -3.2 16 16 0 0 1 6.72 0 16 16 0 0 1 10.24 4.8 16 16 0 0 1 3.84 10.56v40.32l-32 32 1.6 -72.64zm32 363.2a11.52 11.52 0 0 1 -5.12 3.52 15.04 15.04 0 0 1 -12.16 0 11.552 11.552 0 0 1 -5.12 -3.52l-116.16 -115.84a16 16 0 0 1 0 -22.72l139.2 -139.2v91.2a23.68 23.68 0 0 0 -7.68 17.6 24 24 0 1 0 37.44 -17.6v-90.56l123.2 123.84 -153.6 153.28z"]},Jd={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"]},ta={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"]},eu={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"]},tu={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"]},nu={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"]},cn={prefix:"vs",iconName:"remove",icon:[512,512,[],"f000","M480 256H32V224h448v32z"]},su={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"]},iu={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"]},na={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"]},ou={prefix:"vs",iconName:"split-horizontal",icon:[512,512,[],"f000","M448 32H96L64 64v352l32 32h352l32 -32V64l-32 -32zM256 416H96V64h160v352zm192 0H288V64h160v352z"]},ru={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"]},lu={prefix:"vs",iconName:"symbol-structure",icon:[512,512,[],"f000","M64 64 32 96v96l32 32h384l32 -32V96l-32 -32H64zm0 32h384v96H64V96zm-32 224 32 -32h96l32 32v96l-32 32H64l-32 -32v-96zm64 0H64v96h96v-96H96zm224 0 32 -32h96l32 32v96l-32 32h-96l-32 -32v-96zm64 0h-32v96h96v-96h-64z"]},el={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"]},au={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"]},Tn={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"]},Bn={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"]},sa={prefix:"vs",iconName:"triangle-right",icon:[512,512,[],"f000","M177.92 448 160 434.784V76.576L177.28 64 352 244.064v26.464L177.92 448z"]},$n={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"]},cu={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"]},du={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"]},uu={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"]},hu={prefix:"dh",iconName:"exclamation",icon:[512,512,[],"f000","M275.2 384v-32H236.8v32h38.4zm-38.4 -64V128h38.4v192H236.8z"]},ia={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"]},cr={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"]},mu={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"]},pu={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"]},gu={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"]},dr={prefix:"dh",iconName:"filter-filled",icon:[512,512,[],"f000","M480 64v54.4l-160 153.6V448H192V268.8L32 118.4V64h448z"]},fu={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"]},Oo={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"]},Cu={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"]},wu={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"]},Hs={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"]},bu={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"]},Su={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"]},vu={prefix:"dh",iconName:"remove-square-filled",icon:[512,512,[],"f000","M432 32h-384l-16 16v384l16 16h384l16 -16v-384l-16 -16zM352 256H128V224h224v32z"]},ur={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"]},hr={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"]},tl={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"]},Tu={prefix:"dh",iconName:"sort-down",icon:[512,512,[],"f000","m128 288 -12.8 25.6 128 118.4h25.6l128 -118.4L384 288H128z"]},Eu={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"]},mr={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"]},Xi={prefix:"dh",iconName:"square-filled",icon:[512,512,[],"f000","M432 32h-384l-16 16v384l16 16h384l16 -16v-384l-16 -16z"]},pr={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"]},yu={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"]},Ru={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"]},Iu={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"]},nl={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"]},oa={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 ao=J.forwardRef((e,t)=>{var C,w;function n(b){const{menuItem:S,onMenuItemClick:E}=e;E(S,b)}function s(b){const{menuItem:S,onMenuItemMouseMove:E}=e;E(S,b)}function i(b){const{menuItem:S,onMenuItemContextMenu:E}=e;E(S,b)}function o(b,S,E){if(typeof b.type=="string")return b;const{closeMenu:v,menuItem:y,isKeyboardSelected:M,isMouseSelected:F,"data-testid":x}=e,U={menuItem:y,closeMenu:v,isKeyboardSelected:M,isMouseSelected:F,iconElement:S,displayShortcut:E,"data-testid":x};return J.cloneElement(b,{forwardedProps:U})}const{children:r,menuItem:l,isKeyboardSelected:a=!1,isMouseSelected:c=!1,"data-testid":d}=e,u=(C=l.shortcut)==null?void 0:C.getDisplayText();let m=null;if(l.icon){const b=l.icon;if(J.isValidElement(b))m=b;else{let S;l.iconColor!=null&&(l.disabled===void 0||!l.disabled)&&(S={color:l.iconColor}),m=h(Q,{icon:b,style:S})}}let p=null;const g=Boolean(r);l.actions&&(p=h(Q,{icon:jl}));let f=null;if(l.menuElement)f=h("div",{className:"custom-menu-item",onMouseMove:s,children:o(l.menuElement,m,u)});else{const b=l.disabled,S=l.iconOutline;f=h("button",{type:"button",className:G("btn-context-menu",{disabled:b},{active:(g||c)&&(b===void 0||!b)},{"keyboard-active":a&&(b===void 0||!b)}),onClick:n,onMouseMove:s,onContextMenu:i,title:(w=l.description)!=null?w:"",children:R("div",{className:"btn-context-menu-wrapper",children:[h("span",{className:G("icon",{outline:S}),children:m}),h("span",{className:"title",children:l.title}),u!==void 0&&h("span",{className:"shortcut",children:u}),p&&h("span",{className:G("submenu-indicator",{disabled:b}),children:p})]})})}return R("div",{className:"context-menu-item",ref:t,"data-testid":d,children:[r,f]})});ao.displayName="ContextMenuItem";ao.defaultProps={children:null,isKeyboardSelected:!1,isMouseSelected:!1,"data-testid":void 0};class As extends Error{constructor(){super(...arguments),this.isCanceled=!0}}class co{static isDark(t){const n=document.createElement("div");n.style.display="none",n.style.color=t;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),co.getBrightness(o)<125}static getBrightness(t){return Math.round((t[0]*299+t[1]*587+t[2]*114)/1e3)}}async function ui(e){const{clipboard:t}=navigator;if(t!==void 0)try{return navigator.clipboard.writeText(e)}catch{return sl(e)}sl(e)}function sl(e){const t=document.activeElement,n=document.createElement("textarea");n.value=e,document.body.appendChild(n),n.focus(),n.select();const s=document.execCommand("copy");if(document.body.removeChild(n),t instanceof HTMLElement&&t.focus(),!s)throw new Error("Unable to execute copy command")}const Mu="table_",ra="column_",Du=new Set(["in","not","i","ii","k"]),Nu=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"]),Fu=/[^a-zA-Z0-9_$+@-]/g,xu=/[^A-Za-z0-9_$]/g,_s=class{};let En=_s;En.legalize=(e,t,n,s,i)=>{let o=e.trim().replace(/[- ]/g,"_");return s&&(Du.has(o)||Nu.has(o))&&(o=t+o),o=o.replace(n,""),o||(o=t+i),Number.isNaN(Number(o.charAt(0)))||(o=t+o),o};En.legalizeTableName=e=>_s.legalize(e,Mu,Fu,!1,0);En.legalizeColumnNames=e=>{const t=[];return e.forEach((n,s)=>{let i=_s.legalizeColumnName(n,s);t.includes(i)&&(i=ra+s),t.push(i)}),t};En.legalizeColumnName=(e,t=0)=>_s.legalize(e,ra,xu,!0,t);En.isValidTableName=e=>_s.legalizeTableName(e)===e;En.isValidColumnName=e=>_s.legalizeColumnName(e)===e;function Au(e,t){return e?e.closest(`.${t}`):null}const Ou={getClosestByClassName:Au};class Re extends CustomEvent{constructor(t,n){super(t,n)}}class gr extends Error{constructor(){super(...arguments),this.isTimeout=!0}}class Pe{static makeCancelable(t,n){let s=!1,i;const o=new Promise((r,l)=>{Promise.resolve(t).then(a=>{s?(n&&n(a),l(new As)):(i=a,r(a))},a=>l(s?new As:a))});return o.cancel=()=>{s=!0,i!=null&&n&&n(i)},o}static isCanceled(t){return t instanceof As}static isTimedOut(t){return t instanceof gr}}class uo{constructor(){this.pending=[],this.resolved=[]}add(t,n){const s=Pe.makeCancelable(t,n);return this.pending.push(s),s.then(()=>{this.resolve(s)},()=>{this.resolve(s)}),s}remove(t){for(let n=0;n<this.pending.length;n+=1)if(this.pending[n]===t){this.pending.splice(n,1);return}}resolve(t){this.remove(t),this.resolved.push(t)}cancel(){const t=[...this.pending,...this.resolved];for(let n=0;n<t.length;n+=1)t[n].cancel();this.pending=[],this.resolved=[]}}function O(e){if(e==null)throw new Error("Value is null or undefined")}class Xt{static isValidRange(t){return t!=null&&t.length===2&&Number.isInteger(t[0])&&Number.isInteger(t[1])&&t[0]<=t[1]}static validateRange(t){if(!Xt.isValidRange(t))throw new Error(`Invalid range! ${t}`)}static isSelected(t,n){for(let s=0;s<t.length;s+=1){const i=t[s],o=i[0],r=i[1];if(o<=n&&n<=r)return!0}return!1}static selectRange(t,n){let[s,i]=n;const o=[...t];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(t,n){const[s,i]=n,o=[...t];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(t){return t.reduce((n,s)=>n+(s[1]-s[0]+1),0)}static getItemsInRanges(t,n){return n.reduce((s,i)=>{const o=[...s];for(let r=i[0];r<=i[1];r+=1)o.push(t[r]);return o},[])}}class fr{static join(t,n="and"){if(t==null||t.length===0)return"";if(t.length===1)return t[0];if(t.length===2)return`${t[0]} ${n} ${t[1]}`;const s=t.slice(0,t.length-1).join(", "),i=t[t.length-1];return`${s}, ${n} ${i}`}static toLower(t,n=!0){if(t==null){if(n)return"";throw new Error("Null string passed in to TextUtils.toLower")}return t.toLowerCase()}static sort(t,n,s=!0){return t<n?s?-1:1:t>n?s?1:-1:0}}const la=class{static formatElapsedTime(e){if(typeof e!="number"||!Number.isInteger(e))throw new Error(`${e} is not a number that can be expressed as a formatted time`);const t=Math.floor(e/3600),n=Math.floor(e%3600/60),s=e%60;return`${t>0?`${t}h `:""}${n>0||t>0?`${n}m `:""}${e>=60?`${s}s`.padStart(3,"0"):`${s}s`}`}static formatTime(e){if(typeof e!="number"||!Number.isInteger(e)||e<0)throw new Error(`${e} is not a number that can be expressed as a formatted time`);const t=String(Math.floor(e/(60*60))).padStart(2,"0"),n=e%(60*60),s=String(Math.floor(n/60)).padStart(2,"0"),i=n%60,o=String(Math.ceil(i)).padStart(2,"0");return`${t}:${s}:${o}`}static isTimeString(e){return new RegExp(la.TIME_PATTERN).test(e)}static parseTime(e){if(e==null||typeof e!="string")throw new Error(`${e} is not a valid string`);const t=e.split(":");if(t.length!==3)throw new Error(`${e} is not a time string that can be parsed`);return Number(t[0])*60*60+Number(t[1])*60+Number(t[2])}};let Jt=la;Jt.TIME_PATTERN="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]";Jt.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 ku extends Error{constructor(){super(...arguments),this.isInvalid=!0}}function Ht({className:e="","data-testid":t}){return R("div",{className:G("loading-spinner fa-layers",e),"data-testid":t,children:[h(Q,{icon:Vd,className:"text-white-50"}),h(Q,{icon:ea,className:"text-primary",spin:!0})]})}const il=ne.module("ContextMenu"),Yo=class extends T.exports.PureComponent{constructor(e){super(e),this.handleBlur=this.handleBlur.bind(this),this.handleCloseSubMenu=this.handleCloseSubMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMenuItemClick=this.handleMenuItemClick.bind(this),this.handleMenuItemContextMenu=this.handleMenuItemContextMenu.bind(this),this.handleMenuItemMouseMove=this.handleMenuItemMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleWindowResize=this.handleWindowResize.bind(this),this.container=J.createRef(),this.oldFocus=document.activeElement,this.activeSubMenuRef=J.createRef(),this.subMenuTimer=0,this.rAF=0,this.initialPosition={top:e.top,left:e.left},this.state={menuItems:[],pendingItems:[],activeSubMenu:null,hasOverflow:!1,subMenuTop:null,subMenuLeft:null,subMenuParentWidth:0,subMenuParentHeight:0,keyboardIndex:-1,mouseIndex:-1}}static handleContextMenu(e){e.metaKey||(e.stopPropagation(),e.preventDefault())}componentDidMount(){this.initMenu(),this.verifyPosition(),window.addEventListener("resize",this.handleWindowResize),this.rAF=window.requestAnimationFrame(()=>{var t;(t=this.container.current)==null||t.focus();const{onMenuOpened:e}=this.props;e(this)})}componentDidUpdate(e,t){var i,o;const{actions:n}=this.props,{activeSubMenu:s}=this.state;s!==t.activeSubMenu&&(s==null?(i=this.container.current)==null||i.focus():this.setActiveSubMenuPosition()),e.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:e}=this.props;if(e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse){const{keyboardIndex:t}=this.state;return t}return this.getMouseIndex()}setKeyboardIndex(e){const{options:t}=this.props;t.separateKeyboardMouse!==void 0&&t.separateKeyboardMouse?this.setState({keyboardIndex:e}):this.setMouseIndex(e)}getMouseIndex(){const{mouseIndex:e}=this.state;return e}setMouseIndex(e){this.setState({mouseIndex:e})}initMenu(){this.cancelPromises(),cancelAnimationFrame(this.rAF);const{options:e}=this.props;let t=e.initialKeyboardIndex;t===void 0&&(t=-1);const{actions:n}=this.props,s=Ne.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:t,activeSubMenu:null,menuItems:Ne.sortActions(i)})}initMenuPromise(e){const t=Pe.makeCancelable(e);this.setState(n=>({pendingItems:n.pendingItems.concat(t)})),t.then(n=>{this.setState(s=>{const i=s.pendingItems.indexOf(t);if(i>=0){const o=s.pendingItems.slice();return o.splice(i,1),{menuItems:Ne.sortActions(s.menuItems.concat(n)),pendingItems:o}}return null})},n=>{Pe.isCanceled(n)||(this.setState(s=>{const i=s.pendingItems.indexOf(t);if(i>=0){const o=s.pendingItems.slice();return o.splice(i,1),{pendingItems:o}}return null}),il.error(n))})}cancelPromises(){const{pendingItems:e}=this.state;e.map(t=>t.cancel())}setActiveSubMenuPosition(){if(this.activeSubMenuRef.current===null)return;const e=this.activeSubMenuRef.current.getBoundingClientRect();this.setState({subMenuTop:e.top,subMenuLeft:e.right,subMenuParentHeight:e.height,subMenuParentWidth:e.width})}verifyPosition(){var u,m,p,g;const{options:e,updatePosition:t,subMenuParentWidth:n,subMenuParentHeight:s,top:i,left:o}=this.props;if(!this.container.current||e.doNotVerifyPosition!=null&&e.doNotVerifyPosition)return;let{top: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},d=((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:d}),t(r,l)))}handleWindowResize(){!this.container.current||this.closeMenu(!0)}handleBlur(e){if(!this.container.current){il.warn("Container is null!");return}if(!this.container.current.contains(e.relatedTarget)){let t=e.relatedTarget,n=!1;for(;t&&!n;)n=t.hasAttribute("data-dh-context-menu"),t=t.parentElement;n||this.closeMenu(!0)}}isEscapeKey(e){const{left:t}=this.props;return e==="Escape"||t<0&&e==="ArrowRight"||e==="ArrowLeft"}handleKeyDown(e){const{menuItems:t}=this.state,n=this.getKeyboardIndex();let s=n,i=!1;if(e.key==="Enter"||e.key===" "){n>=0&&n<t.length&&this.handleMenuItemClick(t[n],e);return}if(e.key==="ArrowRight"?n>=0&&n<=t.length?i=!0:s=0:this.isEscapeKey(e.key)?s=null:e.key==="ArrowUp"||e.shiftKey&&e.key==="Tab"?s=Ne.getNextMenuItem(s,-1,t):(e.key==="ArrowDown"||e.key==="Tab")&&(s=Ne.getNextMenuItem(s,1,t)),i){this.openSubMenu(n),e.preventDefault(),e.stopPropagation();return}n!==s&&(s!==null?this.setKeyboardIndex(s):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}openSubMenu(e){const{menuItems:t,activeSubMenu:n}=this.state,s=t[e].actions?e:null;n!==s&&this.setState({activeSubMenu:s,subMenuTop:null,subMenuLeft:null})}closeMenu(e=!1){const{closeMenu:t,onMenuClosed:n}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t(e),n(this)})}closeSubMenu(){this.setState({activeSubMenu:null})}handleCloseSubMenu(e){e?this.closeMenu(!0):this.closeSubMenu()}handleMenuItemClick(e,t){t.preventDefault(),t.stopPropagation();const{menuItems:n}=this.state;e!=null&&(e.disabled===void 0||!e.disabled)&&(e.actions!=null?this.openSubMenu(n.indexOf(e)):e.action!=null&&(e.action(),this.closeMenu(!0)))}handleMenuItemContextMenu(e,t){t.metaKey||this.handleMenuItemClick(e,t)}handleMenuItemMouseMove(e){const{menuItems:t}=this.state,n=t.indexOf(e);this.setMouseIndex(n),n>=0&&n<t.length&&(e.disabled===void 0||!e.disabled)&&this.openSubMenu(n)}handleMouseLeave(){this.setMouseIndex(-1)}render(){const e=[],{top:t,left:n}=this.props,{activeSubMenu:s,hasOverflow:i,keyboardIndex:o,menuItems:r,mouseIndex:l,pendingItems:a,subMenuTop:c,subMenuLeft:d,subMenuParentWidth:u,subMenuParentHeight:m}=this.state;for(let w=0;w<r.length;w+=1){const b=r[w];w>0&&b.group!==r[w-1].group&&e.push(h("hr",{},`${w}.separator`));const S=h(ao,{ref:s===w?this.activeSubMenuRef:null,isKeyboardSelected:o===w,isMouseSelected:l===w,menuItem:b,closeMenu:this.handleCloseSubMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:this.handleMenuItemContextMenu},w);e.push(S)}let p=null;a.length>0&&(p=h("div",{className:"loading",children:h(Ht,{})}));const{menuStyle:g,"data-testid":f}=this.props,C=s!==null&&c!==null&&d!==null;return R(Fe,{children:[R("div",{className:G({"has-overflow":i},"context-menu-container"),style:{top:t,left:n,...g},ref:this.container,"data-dh-context-menu":!0,onBlur:this.handleBlur,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,onContextMenu:Yo.handleContextMenu,role:"menuitem",tabIndex:0,"data-testid":f,children:[e,p]}),C&&s!==null&&c!==null&&d!==null&&h(Yo,{actions:r[s].actions||[],closeMenu:this.handleCloseSubMenu,top:c,left:d,updatePosition:(w,b)=>{this.setState({subMenuTop:w,subMenuLeft:b})},subMenuParentWidth:u,subMenuParentHeight:m},`sub-${s}`)]})}};let aa=Yo;aa.defaultProps={subMenuParentWidth:0,subMenuParentHeight:0,closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0};class Lu extends T.exports.Component{constructor(t){super(t),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.container=J.createRef(),this.openMenu=J.createRef(),this.state={actions:null,left:0,top:0}}componentDidMount(){var t;(t=this.container.current)!=null&&t.parentElement&&this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu)}componentWillUnmount(){var t;(t=this.container.current)!=null&&t.parentElement&&this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu)}handleContextMenu(t){if(!Ne.isContextActionEvent(t)||!this.container.current||t.metaKey||t.ctrlKey)return;const n=Ne.getMenuItems(t.contextActions),s=this.container.current.getBoundingClientRect(),i=t.clientY-s.top,o=t.clientX-s.left;if(n.length===0){if(t.target===this.container.current){t.preventDefault(),this.setState({actions:null},()=>{const r=document.elementFromPoint(o,i),l=new MouseEvent("contextmenu",{clientX:t.clientX,clientY:t.clientY,bubbles:!0,cancelable:!0});r==null||r.dispatchEvent(l)});return}return}t.preventDefault(),this.setState({actions:n,top:i,left:o})}handleMenuClose(t){t===this.openMenu.current&&this.setState({actions:null})}render(){let t=null;const{"data-testid":n}=this.props,{actions:s,top:i,left:o}=this.state;return s&&(t=h(aa,{ref:this.openMenu,actions:s,onMenuClosed:this.handleMenuClose,top:i,left:o,updatePosition:(r,l)=>{this.setState({top:r,left:l})},"data-testid":n})),h("div",{className:G("context-menu-root",{active:s}),ref:this.container,children:t})}}const ss=class extends T.exports.Component{static handleEnter(e){const t=e;t.style.height="0"}static handleEntering(e){const t=e;t.style.height=`${ss.getHeight(t)}px`}static handleExiting(e){const t=e;t.style.height="0"}static handleExit(e){const t=e;t.style.height=`${ss.getHeight(t)}px`}static getHeight(e){const t=e.scrollWidth-e.clientWidth;return e.scrollHeight-t}constructor(e){super(e),this.handleEntered=this.handleEntered.bind(this)}handleEntered(e){const t=e;t.style.height="";const{autoFocusOnShow:n}=this.props;if(n!==void 0&&n){const s=t.querySelector("input, select, textarea");s!=null&&s.focus()}}render(){const{children:e,className:t,in:n,"data-testid":s}=this.props;return h(lt,{in:n,classNames:{enterActive:"collapsing",enterDone:"collapse show",exitActive:"collapsing",exitDone:"collapse"},onEnter:ss.handleEnter,onEntering:ss.handleEntering,onEntered:this.handleEntered,onExit:ss.handleExit,onExiting:ss.handleExiting,timeout:350,children:i=>h("div",{className:G({collapse:i==="exited"},t),"data-testid":s,children:e})})}};let ca=ss;ca.propTypes={className:D.exports.string,in:D.exports.bool.isRequired,children:D.exports.node.isRequired,autoFocusOnShow:D.exports.bool,"data-testid":D.exports.string};ca.defaultProps={className:"",autoFocusOnShow:!1,"data-testid":void 0};function Cr(e){const t=T.exports.useRef();return T.exports.useEffect(function(){t.current=e}),t.current}function da(e){const t=T.exports.useRef(null);return T.exports.useEffect(function(){!e||(typeof e=="function"?e(t.current):e.current=t.current)}),t}const Pu=3500,Hu=ne.module("useCopyToClipboard");function _u(){const[e,t]=T.exports.useState(!1),n=T.exports.useRef(null),s=T.exports.useCallback(i=>{ui(i).then(()=>{t(!0)}).catch(o=>Hu.error(`Unable to copy ${i}`,`
|
|
2
|
+
`,o))},[]);return T.exports.useEffect(()=>(n.current&&clearTimeout(n.current),e&&(n.current=setTimeout(()=>{t(!1)},Pu)),()=>{n.current&&clearTimeout(n.current)}),[e]),[e,s]}const at=J.forwardRef((e,t)=>{const{checked:n=!1,children:s,className:i,disabled:o,inputClassName:r,isInvalid:l,labelClassName:a,name:c,onChange:d,"data-testid":u}=e,[m]=T.exports.useState(tn()),p=da(t);T.exports.useEffect(function(){p.current&&(p.current.indeterminate=n===null)},[p,n]);const g=T.exports.useCallback(f=>{p.current&&(p.current.indeterminate=n===null),d&&d(f)},[p,n,d]);return R("div",{className:G("custom-control custom-checkbox",i),children:[h("input",{type:"checkbox",ref:p,checked:n!=null?n:!1,className:G("custom-control-input",r,{"is-invalid":l}),disabled:o,id:m,name:c,onChange:g,"data-testid":u}),h("label",{className:G("custom-control-label",a),htmlFor:m,children:s})]})});at.displayName="Checkbox";at.propTypes={checked:(e,t)=>{const{[t]:n}=e;return n!==null&&typeof n!="boolean"?new Error("Checked must be a boolean or null for indeterminate"):null},children:D.exports.node.isRequired,className:D.exports.string,disabled:D.exports.bool,inputClassName:D.exports.string,isInvalid:D.exports.bool,labelClassName:D.exports.string,name:D.exports.string,onChange:D.exports.func,"data-testid":D.exports.string};at.defaultProps={checked:!1,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};class Qn extends T.exports.PureComponent{constructor(t){super(t),this.inputField=J.createRef()}focus(){var t;(t=this.inputField.current)==null||t.focus()}render(){const{value:t,placeholder:n,onBlur:s,onChange:i,className:o,disabled:r,matchCount:l,id:a,onKeyDown:c,"data-testid":d}=this.props;return R("div",{className:G("search-group",o),children:[h("input",{type:"search",value:t,onBlur:s,onChange:i,onKeyDown:c,className:"form-control",disabled:r,placeholder:n,ref:this.inputField,id:a,"data-testid":d}),l!=null&&h("span",{className:"search-match",children:l}),h("span",{className:"search-icon",children:h(Q,{icon:na})})]})}}Qn.defaultProps={placeholder:"Search",className:"",matchCount:null,onKeyDown(){},id:"","data-testid":void 0};var ua=(e=>(e.UP="UP",e.DOWN="DOWN",e))(ua||{});const si=class extends T.exports.Component{constructor(e){super(e),this.getCachedFilteredOptions=he((t,n)=>t.filter(s=>s.title.toLowerCase().indexOf(n.toLowerCase())>=0||s.value.toLowerCase().indexOf(n.toLowerCase())>=0)),this.state={value:"",filter:"",filteredOptions:e.options,keyboardOptionIndex:-1,menuIsOpen:!1,inputWidth:100},this.toggleMenu=this.toggleMenu.bind(this),this.handleMenuKeyDown=this.handleMenuKeyDown.bind(this),this.handleMenuBlur=this.handleMenuBlur.bind(this),this.closeMenu=this.closeMenu.bind(this),this.handleInputChange=this.handleInputChange.bind(this),this.handleInputKeyDown=this.handleInputKeyDown.bind(this),this.handleInputBlur=this.handleInputBlur.bind(this),this.handleFilterChange=this.handleFilterChange.bind(this),this.handleOptionClick=this.handleOptionClick.bind(this),this.handleOptionFocus=this.handleOptionFocus.bind(this),this.handleMenuOpened=this.handleMenuOpened.bind(this),this.handleMenuExited=this.handleMenuExited.bind(this),this.popper=J.createRef(),this.cbContainer=J.createRef(),this.toggleButton=J.createRef(),this.menuContainer=J.createRef(),this.input=J.createRef(),this.searchInput=J.createRef()}componentDidUpdate(){const{menuIsOpen:e,keyboardOptionIndex:t}=this.state;e&&t>=0&&this.scrollOptionIntoView()}setInputWidth(){this.cbContainer.current&&this.setState({inputWidth:this.cbContainer.current.getBoundingClientRect().width})}focus(){var e;(e=this.input.current)==null||e.focus()}resetValue(){this.setState({value:""})}updateInputValue(e){const{onChange:t}=this.props;this.setState({value:e}),t(e)}handleResize(){this.setInputWidth()}handleMenuKeyDown(e){var r,l;const{filter:t,filteredOptions:n,keyboardOptionIndex:s}=this.state,{options:i}=this.props,o=t?n:i;switch(e.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(),e.stopPropagation(),e.preventDefault();break;case"ArrowUp":this.handleMenuNavigation(si.MENU_NAVIGATION_DIRECTION.UP),e.stopPropagation(),e.preventDefault();break;case"ArrowDown":this.handleMenuNavigation(si.MENU_NAVIGATION_DIRECTION.DOWN),e.stopPropagation(),e.preventDefault();break;case"Escape":t!==""?(this.setState({filter:""}),e.stopPropagation()):this.closeMenu();break;case"Tab":!e.shiftKey&&s===o.length-1&&this.closeMenu();break}}handleMenuNavigation(e){const{filter:t,filteredOptions:n,keyboardOptionIndex:s}=this.state,{options:i}=this.props,r=(t?n:i).length;let l=0;switch(e){case si.MENU_NAVIGATION_DIRECTION.UP:l=-1;break;case si.MENU_NAVIGATION_DIRECTION.DOWN:l=1;break}l!==0&&this.setState({keyboardOptionIndex:(s+l+r)%r})}handleInputKeyDown(e){const{onEnter:t}=this.props,{menuIsOpen:n}=this.state;e.key==="ArrowDown"||e.key==="ArrowUp"?n||this.openMenu():e.key==="Enter"&&t()}handleInputChange(e){this.updateInputValue(e.target.value)}handleOptionClick(e){var r;const t=Number(e.currentTarget.value),{filter:n,filteredOptions:s}=this.state,{options:i}=this.props,o=n?s:i;this.updateInputValue(o[t].value),this.closeMenu(),(r=this.input.current)==null||r.focus()}handleOptionFocus(e){this.setState({keyboardOptionIndex:Number(e.target.value)})}handleFilterChange(e){var i;const{options:t}=this.props,n=e.target.value,s=this.getCachedFilteredOptions(t,n);this.setState({filter:n,filteredOptions:s,keyboardOptionIndex:0}),(i=this.popper.current)==null||i.scheduleUpdate()}handleMenuBlur(e){e.relatedTarget instanceof Element&&this.popper.current!=null&&this.popper.current.element.contains(e.relatedTarget)||e.relatedTarget===this.toggleButton.current||this.closeMenu(!1)}handleInputBlur(e){const{menuIsOpen:t}=this.state;t&&e.relatedTarget instanceof Element&&this.popper.current!=null&&this.popper.current.element.contains(e.relatedTarget)||this.closeMenu(!1)}handleMenuOpened(){var e;this.scrollOptionIntoView(),(e=this.searchInput.current)==null||e.focus()}handleMenuExited(){var t;const{menuIsOpen:e}=this.state;e&&(this.setState({menuIsOpen:!1}),(t=this.popper.current)==null||t.hide()),this.setState({filter:""})}toggleMenu(e){const{menuIsOpen:t}=this.state;t?this.closeMenu():this.openMenu(),e.stopPropagation()}openMenu(){this.updateKeyboardIndex(),this.setInputWidth(),this.setState({menuIsOpen:!0}),window.requestAnimationFrame(()=>{var e;(e=this.popper.current)==null||e.show()})}closeMenu(e=!0){var t,n;this.setState({menuIsOpen:!1}),e&&((t=this.input.current)==null||t.focus()),(n=this.popper.current)==null||n.hide()}updateKeyboardIndex(){const{value:e,filter:t,filteredOptions:n}=this.state,{options:s}=this.props,o=(t?n:s).findIndex(r=>r.value===e);this.setState({keyboardOptionIndex:o})}scrollOptionIntoView(){var t;const e=(t=this.menuContainer.current)==null?void 0:t.querySelector(".cb-option-btn.keyboard-active");e instanceof HTMLElement&&e.scrollIntoView({block:"nearest",inline:"nearest"})}renderMenuElement(){const{searchPlaceholder:e}=this.props,{filter:t,inputWidth:n}=this.state;return R("div",{className:"cb-menu-container",ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,onClick:s=>{s.stopPropagation()},style:{width:n},onBlur:this.handleMenuBlur,children:[h("div",{className:"cb-search-input-container",children:h(Qn,{value:t,ref:this.searchInput,onChange:this.handleFilterChange,className:"cb-search-input",placeholder:e})}),h("div",{className:"cb-options-container",children:h("div",{className:"cb-options",children:this.renderOptions()})})]})}renderOptions(){const{options:e}=this.props,{keyboardOptionIndex:t,filter:n,filteredOptions:s}=this.state;return(n?s:e).map((o,r)=>{const l=`option-${r}-${o.value}`;return h("button",{type:"button",value:r,className:G("cb-option-btn",{"keyboard-active":t===r}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:o.title},l)})}render(){const{options:e,inputPlaceholder:t,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},R("div",{className:"input-group cb-container",ref:this.cbContainer,children:[h("input",{value:l||i,className:G("form-control",s,"cb-input"),ref:this.input,onChange:this.handleInputChange,placeholder:t||(e[0]!=null?e[0].title:void 0),disabled:n,onBlur:this.handleInputBlur,onKeyDown:this.handleInputKeyDown,spellCheck:o,"data-testid":r!==void 0?`${r}-input`:void 0}),h("div",{className:"input-group-append cb-dropdown",children:R("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:[h(Q,{icon:Bn}),h(vn,{ref:this.popper,options:a,className:G("combobox interactive"),onEntered:this.handleMenuOpened,onExited:this.handleMenuExited,children:this.renderMenuElement()})]})})]})}};let Vs=si;Vs.MENU_NAVIGATION_DIRECTION=ua;Vs.DROP_DOWN_MENU_HEIGHT=200;Vs.propTypes={options:D.exports.arrayOf(D.exports.shape({title:D.exports.string.isRequired,value:D.exports.string.isRequired})).isRequired,popperOptions:D.exports.shape({title:D.exports.string.isRequired,value:D.exports.string.isRequired}),onChange:D.exports.func,inputPlaceholder:D.exports.string,searchPlaceholder:D.exports.string,disabled:D.exports.bool,className:D.exports.string,defaultValue:D.exports.string,spellCheck:D.exports.bool,onEnter:D.exports.func,"data-testid":D.exports.string};Vs.defaultProps={onChange(){},inputPlaceholder:"",searchPlaceholder:"Search",disabled:!1,className:"",defaultValue:"",popperOptions:null,spellCheck:!0,onEnter(){},"data-testid":void 0};function ha({copy:e,kind:t="ghost",tooltip:n="Copy",className:s,"data-testid":i,children:o}){const[r,l]=_u();return h(K,{kind:t,className:s,"data-testid":i,icon:r?Jd:Bd,tooltip:r?"Copied":n,onClick:()=>{l(typeof e=="function"?e():e)},children:o})}const xt=ne.module("MaskedInput"),vs={FORWARD:"forward",BACKWARD:"backward",NONE:"none"},Ai="\u2007";function wr(e,t,n){return e.substring(0,t)+n+e.substring(t+1)}function Vu(e,t,n){return e.length<n?`${e}${t.substring(e.length,n)}`:e}function ol(e,t){let{length:n}=e;for(let s=e.length-1;s>=0&&t[s]===e[s];s-=1)n=s;return e.substring(0,n)}const ho=J.forwardRef((e,t)=>{const{className:n,example:s,getNextSegmentValue:i=(N,H,k)=>k,getPreferredReplacementString:o=wr,onChange:r=()=>!1,onSelect:l=()=>!1,pattern:a,placeholder:c,selection:d,value:u,onFocus:m=()=>!1,onBlur:p=()=>!1,"data-testid":g}=e,f=da(t),C=T.exports.useMemo(()=>Array.isArray(s)?s:[s],[s]),w=T.exports.useMemo(()=>C[0].replace(/[a-zA-Z0-9]/g,Ai),[C]);T.exports.useEffect(function(){var H;if(d!=null){xt.debug("setting selection...",d);const{selectionStart:k,selectionEnd:z,selectionDirection:P}=d;(H=f.current)==null||H.setSelectionRange(k,z,P),xt.debug("selection set!")}},[d,f]);const b=T.exports.useCallback(N=>{let H=N,k=N;const z=C.length>0?C[0]:u;for(let _=H-1;_>=0&&/[a-zA-Z0-9]/g.test(z.charAt(_));_-=1)H=_;for(let _=k;_<z.length&&/[a-zA-Z0-9]/g.test(z.charAt(_));_+=1)k=_+1;const P=H===k?vs.NONE:vs.BACKWARD;return{selectionStart:H,selectionEnd:k,selectionDirection:P}},[C,u]);function S(N,H,k=N.length){let z="";for(let P=0;P<k;P+=1)N.charAt(P)!==Ai?z=z.concat(N[P]):z=z.concat(H[P]);return z=z.concat(H.substring(k)),z}function E(N,H=N.length){const k=new RegExp(`^${a}$`);if(k.test(N))return!0;for(let z=0;z<C.length;z+=1){const P=S(N,C[z],H);if(k.test(P))return!0}return!1}function v(N){const H=b(N),k=H.selectionEnd+1;return k>=u.length?H:b(k)}function y(N){const H=b(N),k=H.selectionStart-1;return k<=0?H:b(k)}function M(N,H){const k=b(N),z=u.substring(k.selectionStart,k.selectionEnd),P=i(k,H,z,u),_=u.substring(0,k.selectionStart)+P+u.substring(k.selectionEnd);E(_,k.selectionEnd)&&(r(_),l(k))}const F=T.exports.useCallback(N=>{const{selectionStart:H=0,selectionEnd:k=0,selectionDirection:z="none"}=N.target;if(H===null||k===null||z===null){xt.error("Selection attempted on non-text input element",N.target);return}if(xt.debug2("handleSelect",H,k,z),!(d!=null&&H===d.selectionStart&&k===d.selectionEnd)){if(d!=null&&H===u.length&&k===u.length&&N.nativeEvent.type!=="mouseup"){l({...d});return}if(H===k){const P=b(H);xt.debug("Selection segment from ",H,k,"=>",P),l(P)}else l({selectionStart:H,selectionEnd:k,selectionDirection:z})}},[b,l,d,u]),x=T.exports.useCallback(N=>{var k;if(!f.current)return;xt.debug("handleSelectCapture",N);const H=(k=f.current.selectionStart)!=null?k:0;H===u.length&&d!=null&&H!==d.selectionStart&&(N.preventDefault(),N.stopPropagation())},[f,d,u]);function U(N){if(N.preventDefault(),N.stopPropagation(),!f.current)return;const{key:H}=N,{selectionStart:k=0,selectionEnd:z=0}=f.current;if(k===null||z===null){xt.error("Selection arrow nvaigation attempted on non-text input element",N.target);return}H==="ArrowLeft"?l(y(k)):H==="ArrowRight"?l(v(z)):H==="ArrowUp"?M(k,-1):H==="ArrowDown"&&M(k,1)}function V(N){if(!f.current)return;xt.debug("handleKeyDown",N);const{key:H}=N,{selectionStart:k=0,selectionEnd:z=0}=f.current;if(k===null||z===null){xt.error("Selection key event on non-text input element",N.target);return}if(H.startsWith("Arrow")){U(N);return}if(H==="Delete"||H==="Backspace"){if(N.preventDefault(),N.stopPropagation(),z>=ol(u,w).length){const _=u.substring(0,k===z?k-1:k),$=ol(_,w);$!==u&&(r($),l({selectionStart:$.length,selectionEnd:$.length,selectionDirection:vs.NONE}));return}if(k!==z){const _=u.substring(0,k)+u.substring(k,z).replace(/[a-zA-Z0-9]/g,Ai)+u.substring(z);xt.debug("Range ",k,z,"deleted, setting value",_),r(_),l({selectionStart:k,selectionEnd:k,selectionDirection:vs.NONE})}else if(k>0)for(let _=k-1;_>=0;_-=1){const $=u.substring(0,_)+u.substring(_,k).replace(/[a-zA-Z0-9]/g,Ai)+u.substring(k);if($!==u){r($),l({selectionStart:_,selectionEnd:_,selectionDirection:vs.NONE});return}}return}if(N.altKey||N.metaKey||N.ctrlKey||H.length>1)return;N.preventDefault(),N.stopPropagation();const P=Array.from(new Set([H,H.toUpperCase(),H.toLowerCase()]));for(let _=0;_<P.length;_+=1){const $=P[_],X=/[a-zA-Z0-9]/g.test($)?C[0].length-1:k;for(let ee=k;ee<=X;ee+=1){const ae=Vu(u,C[0],ee+1),fe=o(ae,ee,$,k,z);if(E(fe,ee+1)){const Ce=b(ee),de=ee+1;let ye={selectionStart:de,selectionEnd:de,selectionDirection:vs.NONE};if(de>=Ce.selectionEnd){const Xe=v(ee);Xe.selectionStart!==Ce.selectionStart&&(ye=Xe)}xt.debug("handleKeyDown",H,"=>",fe,ye),r(fe),l(ye);return}}}}return h("input",{ref:f,className:G("form-control masked-input",n),type:"text",pattern:a,placeholder:c,value:u,onChange:()=>{},onKeyDown:V,onSelect:F,onSelectCapture:x,onFocus:m,onBlur:p,"data-testid":g})});ho.defaultProps={className:"",placeholder:void 0,onChange(){},onSelect(){},getNextSegmentValue:(e,t,n)=>n,getPreferredReplacementString:wr,selection:void 0,onFocus(){},onBlur(){},"data-testid":void 0};const Uu=ne.module("TimeInput"),Bu="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]",Gu=["00:00:00","12:34:56","23:59:59"],ma=J.forwardRef((e,t)=>{const{allowValueWrapping:n=!0,className:s="",onChange:i=()=>!1,value:o=0,onFocus:r=()=>!1,onBlur:l=()=>!1,onSelect:a=()=>!1,"data-testid":c}=e,[d,u]=T.exports.useState(Jt.formatTime(o)),[m,p]=T.exports.useState(),g=T.exports.useRef(null);T.exports.useImperativeHandle(t,()=>({focus:()=>{var S;(S=g.current)==null||S.focus()},setSelection:S=>{var E;(E=g.current)==null||E.focus(),p(S)}}),[]),T.exports.useEffect(function(){u(Jt.formatTime(o))},[o]);function f(S,E,v){const y=S.selectionStart===0?24:60;let M=parseInt(v,10)-E;return Number.isNaN(M)?M=0:n?M=(M%y+y)%y:M=Math.min(Math.max(0,M),y-1),`${M}`.padStart(2,"0")}function C(S,E,v,y,M){return y===0&&M===2&&E===1&&parseInt(v,10)>1?`0${v}${S.substring(2)}`:wr(S,E,v)}function w(S){Uu.debug("handleChange",S),u(S),Jt.isTimeString(S)&&i(Jt.parseTime(S))}const b=T.exports.useCallback(S=>{p(S),a(S)},[a]);return h(ho,{ref:g,className:s,example:Gu,getNextSegmentValue:f,getPreferredReplacementString:C,onChange:w,onSelect:b,pattern:Bu,selection:m,value:d,onFocus:r,onBlur:l,"data-testid":c})});ma.defaultProps={allowValueWrapping:!0,className:"",onChange:()=>!1,onSelect:()=>!1,value:0,onFocus:()=>!1,onBlur:()=>!1,"data-testid":void 0};class pa extends T.exports.PureComponent{constructor(t){var i;super(t),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMenuItemClick=this.handleMenuItemClick.bind(this),this.handleMenuItemMouseMove=this.handleMenuItemMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.container=J.createRef(),this.oldFocus=document.activeElement,this.rAF=0;const{options:n}=t,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:t}=this.props;t(this)})}componentDidUpdate(t){const{actions:n}=this.props;t.actions!==n&&this.initMenu()}componentWillUnmount(){cancelAnimationFrame(this.rAF)}getKeyboardIndex(){const{options:t}=this.props;if(t.separateKeyboardMouse!==void 0&&t.separateKeyboardMouse){const{keyboardIndex:n}=this.state;return n}return this.getMouseIndex()}setKeyboardIndex(t){const{options:n}=this.props;n.separateKeyboardMouse!==void 0&&n.separateKeyboardMouse?this.setState({keyboardIndex:t}):this.setMouseIndex(t)}getMouseIndex(){const{mouseIndex:t}=this.state;return t}setMouseIndex(t){this.setState({mouseIndex:t})}initMenu(){cancelAnimationFrame(this.rAF),this.setState({menuItems:[]});const{actions:t}=this.props,n=Ne.getMenuItems(t,!1);n.length>0&&this.setState(s=>({menuItems:Ne.sortActions(s.menuItems.concat(n))}))}handleKeyDown(t){const{menuItems:n}=this.state,s=this.getKeyboardIndex();let i=s;if(t.key==="Enter"||t.key===" "){s!=null&&s>=0&&s<n.length&&this.handleMenuItemClick(n[s],t);return}t.key==="Escape"?i=null:t.key==="ArrowUp"||t.key==="Tab"&&t.shiftKey===!0?i=Ne.getNextMenuItem(i!=null?i:0,-1,n):(t.key==="ArrowDown"||t.key==="Tab"&&t.shiftKey===!1)&&(i=Ne.getNextMenuItem(i!=null?i:0,1,n)),s!==i&&(i!==null?this.setKeyboardIndex(i):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),t.preventDefault(),t.stopPropagation())}closeMenu(t=!1){const{closeMenu:n,onMenuClosed:s}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{n(t),s(this)})}handleCloseMenu(){this.closeMenu()}handleMenuItemClick(t,n){n.preventDefault(),n.stopPropagation(),t!=null&&(t.disabled===void 0||!t.disabled)&&t.action!=null&&(t.action(),this.closeMenu(!0))}handleMenuItemMouseMove(t){const{menuItems:n}=this.state,s=n.indexOf(t);this.setMouseIndex(s)}handleMouseLeave(){this.setMouseIndex(-1)}render(){const t=[],{"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&&t.push(h("hr",{},`${l}.separator`));const c=h(ao,{isKeyboardSelected:s===l,isMouseSelected:o===l,menuItem:a,closeMenu:this.handleCloseMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:()=>!1},l);t.push(c)}const{menuStyle:r}=this.props;return h("div",{className:"context-menu-container",style:{...r},ref:this.container,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,role:"menuitem",tabIndex:0,"data-testid":n,children:t})}}pa.defaultProps={closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0};class qn extends T.exports.PureComponent{constructor(t){super(t),this.handleClick=this.handleClick.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.handleExited=this.handleExited.bind(this),this.container=J.createRef(),this.parent=null,this.popper=J.createRef(),this.isOpen=!1}componentDidMount(){var n;const{isShown:t}=this.props;t===null?(n=this.container.current)!=null&&n.parentElement&&(this.parent=this.container.current.parentElement,this.parent.addEventListener("click",this.handleClick)):t&&this.openMenu()}componentDidUpdate(t){const{isShown:n}=this.props;t.isShown!==n&&(n!==null&&n?window.requestAnimationFrame(()=>{this.openMenu()}):this.closeMenu())}componentWillUnmount(){this.parent&&this.parent.removeEventListener("click",this.handleClick)}closeMenu(){var t;(t=this.popper.current)==null||t.hide()}openMenu(){this.popper.current&&!this.isOpen&&(this.popper.current.show(),this.isOpen=!0)}scheduleUpdate(){var t;(t=this.popper.current)==null||t.scheduleUpdate()}handleClick(t){t.preventDefault(),t.stopPropagation(),this.openMenu()}handleCloseMenu(){this.closeMenu()}handleExited(){this.isOpen=!1;const{onMenuClosed:t}=this.props;t()}render(){const{actions:t,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},h("div",{className:"menu-actions-listener",ref:this.container,"data-testid":i,children:h(vn,{ref:this.popper,options:l,className:G("menu-popper",s),onExited:this.handleExited,closeOnBlur:!0,interactive:!0,children:h(pa,{actions:t,closeMenu:this.handleCloseMenu,onMenuOpened:n,options:r,menuStyle:o})})})}}qn.defaultProps={isShown:null,onMenuClosed(){},onMenuOpened(){},options:{},popperOptions:{},popperClassName:"",menuStyle:{},"data-testid":void 0};const rl=-1;var ga=(e=>(e.UP="UP",e.DOWN="DOWN",e))(ga||{});const pn=class extends T.exports.Component{constructor(e){super(e);const{value:t,valueToTime:n}=e;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=J.createRef(),this.menuContainer=J.createRef(),this.button=J.createRef(),this.input=J.createRef(),this.state={keyboardOptionIndex:0,menuIsOpen:!1,inputWidth:100,customTime:n(t),inputFocused:!1}}getSelectedText(){const{options:e,value:t,placeholder:n}=this.props,{customTime:s}=this.state;if(t===null)return n;for(let i=0;i<e.length;i+=1){const o=e[i];if(o.value===t)return o.title}return Jt.formatTime(s)}setInputWidth(){this.csContainer.current&&this.setState({inputWidth:this.csContainer.current.getBoundingClientRect().width})}focus(){var e;(e=this.button.current)==null||e.focus()}updateInputValue(e){const{onChange:t}=this.props;t(e)}handleResize(){this.setInputWidth()}handleMenuKeyDown(e){var i;const{keyboardOptionIndex:t,inputFocused:n}=this.state,{options:s}=this.props;switch(e.key){case"Enter":case" ":n?this.updateFromCustom():this.updateInputValue(s[t].value),this.closeMenu(),(i=this.button.current)==null||i.focus(),e.stopPropagation(),e.preventDefault();break;case"Tab":e.shiftKey?this.handleMenuNavigation(pn.MENU_NAVIGATION_DIRECTION.UP):this.handleMenuNavigation(pn.MENU_NAVIGATION_DIRECTION.DOWN),e.stopPropagation(),e.preventDefault();break;case"ArrowUp":this.handleMenuNavigation(pn.MENU_NAVIGATION_DIRECTION.UP),e.stopPropagation(),e.preventDefault();break;case"ArrowDown":this.handleMenuNavigation(pn.MENU_NAVIGATION_DIRECTION.DOWN),e.stopPropagation(),e.preventDefault();break;case"Escape":this.closeMenu();break}}handleMenuNavigation(e){const{keyboardOptionIndex:t,inputFocused:n}=this.state,{options:s}=this.props,i=s.length;let o=t;switch(e){case pn.MENU_NAVIGATION_DIRECTION.UP:if(!n&&t===0){this.focusInput();break}else n&&this.focusOption(t);t>0&&!n?(o=(o-1)%i,this.setState({keyboardOptionIndex:o})):t===0&&(o=i-1,this.setState({keyboardOptionIndex:o})),this.scrollOptionIntoView(o);break;case pn.MENU_NAVIGATION_DIRECTION.DOWN:if(!n&&t===i-1){this.focusInput();break}else n&&this.focusOption(t);t<i&&!(n&&t===0)&&(o=(o+1)%i,this.setState({keyboardOptionIndex:o})),this.scrollOptionIntoView(o);break}}handleOptionClick(e){const t=Number(e.currentTarget.value),{options:n,timeToValue:s}=this.props,{customTime:i}=this.state;if(t===rl){const o=s(i);this.updateAndClose(o)}else this.updateAndClose(n[t].value)}updateAndClose(e){var t;this.updateInputValue(e),this.closeMenu(),(t=this.button.current)==null||t.focus()}handleOptionFocus(e){this.setState({keyboardOptionIndex:Number(e.target.value)})}handleMenuOpened(){var o;const{options:e,value:t}=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(),t===null)return;e.map(r=>r.value).indexOf(t)<0&&this.focusInput()}focusInput(){var e;(e=this.input.current)==null||e.focus()}focusOption(e){var n;const t=(n=this.menuContainer.current)==null?void 0:n.querySelector(".cs-options");if(t&&t.children!=null){const s=t.children.item(e);s instanceof HTMLElement&&s.focus()}}handleMenuExited(){const{menuIsOpen:e}=this.state;e&&this.setState({menuIsOpen:!1,keyboardOptionIndex:0})}handleCustomInput(e){const{timeToValue:t}=this.props,n=t(e);this.updateInputValue(n),this.setState({customTime:e})}updateFromCustom(){const{timeToValue:e}=this.props,{customTime:t}=this.state,n=e(t);this.updateInputValue(n)}toggleMenu(e){const{menuIsOpen:t}=this.state;t?this.closeMenu():this.openMenu(),e.stopPropagation()}openMenu(){this.updateKeyboardIndex(),this.setInputWidth(),this.setState({menuIsOpen:!0})}closeMenu(e=!0){var t;this.setState({menuIsOpen:!1}),e&&((t=this.button.current)==null||t.focus())}updateKeyboardIndex(){const{options:e,value:t}=this.props;if(t===null)return;const n=e.map(s=>s.value).indexOf(t);n>0&&this.setState({keyboardOptionIndex:n})}scrollOptionIntoView(e){var n;const t=(n=this.menuContainer.current)==null?void 0:n.querySelector(".cs-options");if(t&&t.children!=null){const s=t.children.item(e);s instanceof HTMLElement&&s.offsetTop>pn.DROP_DOWN_MENU_HEIGHT?t.scrollTop=s.offsetTop-pn.DROP_DOWN_MENU_HEIGHT:(s instanceof HTMLElement&&s.offsetTop<0||e===0)&&(t.scrollTop=0)}}renderMenuElement(){const{inputWidth:e}=this.state;return h("div",{className:"cs-menu-container",ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,onClick:t=>{t.stopPropagation()},style:{width:e},children:h("div",{className:"cs-options-container",children:h("div",{className:"cs-options",children:this.renderOptions()})})})}renderOptions(){const{options:e,value:t,icon:n,customText:s}=this.props,{keyboardOptionIndex:i,customTime:o,inputFocused:r}=this.state;let l=!1;const a=[];for(let c=0;c<e.length;c+=1){const d=e[c],u=`option-${c}-${d.value}`;l=l||d.value===t,a.push(R("button",{type:"button",value:c,className:G("cs-option-btn",{"keyboard-active":i===c&&!r}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[d.value===t&&h(Q,{icon:n,className:"mr-2"}),d.value!==t&&h("span",{className:"mr-4"}),d.title]},u))}return a.push(h("hr",{className:"cs-divider"},"option-divider")),a.push(R("button",{type:"button",value:rl,className:G("cs-option-btn",{"keyboard-active":r}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[!l&&t!==null?h(Q,{icon:n,className:"mr-2"}):h("span",{className:"mr-4"}),s]},"option-custom-label")),a.push(R("div",{className:"cs-custom-container",children:[h("span",{className:"mr-2"}),h(ma,{ref:this.input,onChange:this.handleCustomInput,value:o,onFocus:()=>this.setState({inputFocused:!0}),onBlur:()=>this.setState({inputFocused:!1})},"option-input"),h("span",{className:"ml-2"})]},"cs-custom-container")),a.push(h("hr",{className:"mb-2"},"option-end")),a}render(){const{disabled:e,invalid:t,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},h("div",{className:"input-group cs-container context-menu",ref:this.csContainer,"data-testid":s,children:h("div",{className:G("input-group-append cs-dropdown",{"cs-dropdown-invalid":t}),children:R("button",{type:"button",className:G("btn cs-btn form-control",{"cs-btn-invalid":t}),ref:this.button,onClick:this.toggleMenu,disabled:e,children:[h("span",{className:G({"text-muted":n===null}),children:this.getSelectedText()}),h("span",{children:h(Q,{icon:mr,className:"cs-caret"})}),h(qn,{isShown:i,actions:{menuElement:this.renderMenuElement()},popperOptions:o,popperClassName:"CustomTimeSelect",onMenuOpened:this.handleMenuOpened,onMenuClosed:this.handleMenuExited,menuStyle:{maxWidth:"100rem"}})]})})})}};let br=pn;br.MENU_NAVIGATION_DIRECTION=ga;br.DROP_DOWN_MENU_HEIGHT=125;br.defaultProps={onChange(){},value:null,disabled:!1,popperOptions:{},icon:Wn,customText:"Custom",placeholder:"Select a time",valueToTime:e=>e===null?0:Math.round(e/1e3),timeToValue:e=>e*1e3,invalid:!1,"data-testid":void 0};function Ts(e,t,n,s,i){const o=s-n+1;return`${((parseInt(t,10)-e-n)%o+o)%o+n}`.padStart(i,"0")}function fa(e,t,n){const{selectionStart:s}=e;return s===0?Ts(t,n,1900,2099,4):s===5?Ts(t,n,1,12,2):s===8?Ts(t,n,1,31,2):s===11?Ts(t,n,0,23,2):s===17||s===14?Ts(t,n,0,59,2):s===20||s===24||s===28?Ts(t,n,0,999,3):n}const zu=ne.module("DateTimeInput"),Wu="[12][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])",$u="([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}",qu=`${Wu} ${$u}`,zi="2022-01-01",Ca=`${zi} 00:00:00.000000000`,Ku="YYYY-MM-DD HH:MM:SS.SSSSSSSSS";function ll(e){return e!=null&&e.length>=zi.length?`${e.substring(0,zi.length)}${e.substring(zi.length).replace(/\u2007/g,"0")}${Ca.substring(e.length)}`:e}function Qo(e){const t=e.substring(0,23),n=e.substring(23,26),s=e.substring(26);return[t,n,s].filter(i=>i!=="").join("\u200B")}const al=e=>e.replace(/\u200B/g,""),Xu=[Qo(Ca)],wa=J.forwardRef((e,t)=>{const{className:n="",onChange:s=()=>{},defaultValue:i="",onFocus:o=()=>{},onBlur:r=()=>{},"data-testid":l}=e,[a,c]=T.exports.useState(i.length>0?Qo(i):""),[d,u]=T.exports.useState(),m=T.exports.useCallback(g=>{zu.debug("handleChange",g),c(g),s(ll(al(g)))},[s]),p=T.exports.useCallback(()=>{const g=al(a),f=ll(g);f!==g&&c(Qo(f)),r()},[a,r]);return h("div",{className:"d-flex flex-row align-items-center",children:h(ho,{ref:t,className:G(n),example:Xu,getNextSegmentValue:fa,onChange:m,onSelect:u,pattern:qu,placeholder:Ku,selection:d,value:a,onFocus:o,onBlur:p,"data-testid":l})})});wa.displayName="DateTimeInput";wa.defaultProps={className:"",onChange:()=>{},defaultValue:"",onFocus:()=>{},onBlur:()=>{},"data-testid":void 0};const Yu=ne.module("DateInput"),Qu="[12][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])",ju=["2000-01-01","2022-12-31"],Zu="YYYY-MM-DD",ba=J.forwardRef((e,t)=>{const{className:n="",onChange:s=()=>{},defaultValue:i="",onFocus:o=()=>{},onBlur:r=()=>{},"data-testid":l}=e,[a,c]=T.exports.useState(i),[d,u]=T.exports.useState(),m=T.exports.useCallback(p=>{Yu.debug("handleChange",p),c(p),s(p)},[s]);return h("div",{className:"d-flex flex-row align-items-center",children:h(ho,{ref:t,className:G(n),example:ju,getNextSegmentValue:fa,onChange:m,onSelect:u,pattern:Qu,placeholder:Zu,selection:d,value:a,onFocus:o,onBlur:r,"data-testid":l})})});ba.displayName="DateInput";ba.defaultProps={className:"",onChange:()=>!1,defaultValue:"",onFocus:()=>!1,onBlur:()=>!1,"data-testid":void 0};class Ju extends T.exports.PureComponent{constructor(t){super(t),this.searchInput=J.createRef(),this.handleChange=this.handleChange.bind(this),this.sendUpdate=Et(this.sendUpdate.bind(this),t.debounceMs),this.state={value:t.value}}componentDidUpdate(t){const{value:n}=this.props;t.value!==n&&this.setState({value:n})}focus(){var t;(t=this.searchInput.current)==null||t.focus()}handleChange(t){this.setState({value:t.target.value},this.sendUpdate)}sendUpdate(){const{onChange:t}=this.props,{value:n}=this.state;t(n)}render(){const{placeholder:t,className:n,matchCount:s,id:i,"data-testid":o}=this.props,{value:r}=this.state;return h(Qn,{value:r,placeholder:t,onChange:this.handleChange,className:n,matchCount:s,ref:this.searchInput,id:i,"data-testid":o})}}Ju.defaultProps={placeholder:"Search",className:"",matchCount:null,debounceMs:250,id:"","data-testid":void 0};const eh=ne.module("ItemListItem"),Sa=class extends T.exports.Component{constructor(e){super(e),this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleClick=this.handleClick.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleDragStart=this.handleDragStart.bind(this),this.handleDrag=this.handleDrag.bind(this),this.handleDragOver=this.handleDragOver.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleDrop=this.handleDrop.bind(this),this.handleDoubleClick=this.handleDoubleClick.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.itemRef=J.createRef()}static handleKeyDown(){return eh.log("ItemListItem.handleKeyDown false"),!1}handleBlur(e){const{itemIndex:t,onBlur:n}=this.props;n(t,e)}handleFocus(e){const{itemIndex:t,onFocus:n}=this.props;n(t,e)}handleClick(e){const{itemIndex:t,onClick:n}=this.props;n(t,e)}handleContextMenu(e){const{itemIndex:t,onContextMenu:n}=this.props;n(t,e)}handleDragStart(e){const{itemIndex:t,onDragStart:n}=this.props;n(t,e)}handleDrag(e){const{itemIndex:t,onDrag:n}=this.props;n(t,e)}handleDragOver(e){e.preventDefault();const{itemIndex:t,onDragOver:n}=this.props;n(t,e)}handleDragEnd(e){const{itemIndex:t,onDragEnd:n}=this.props;n(t,e)}handleDrop(e){const{itemIndex:t,onDrop:n}=this.props;n(t,e)}handleDoubleClick(e){const{itemIndex:t,onDoubleClick:n}=this.props;n(t,e)}handleMouseMove(e){const{itemIndex:t,onMouseMove:n}=this.props;n(t,e)}handleMouseDown(e){const{itemIndex:t,onMouseDown:n}=this.props;n(t,e)}handleMouseUp(e){const{itemIndex:t,onMouseUp:n}=this.props;n(t,e)}render(){const{isDraggable:e,isFocused:t,isSelected:n,style:s,children:i,"data-testid":o}=this.props;return h("div",{className:G("item-list-item",{active:n},{"is-focused":t},{"is-draggable":e}),onKeyDown:Sa.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:e,"data-testid":o,children:i})}};let va=Sa;va.defaultProps={children:null,isDraggable:!1,isFocused:!1,isSelected:!1,itemIndex:0,"data-testid":void 0,onBlur(){},onClick(){},onContextMenu(){},onDragStart(){},onDrag(){},onDragOver(){},onDragEnd(){},onDrop(){},onDoubleClick(){},onFocus(){},onMouseDown(){},onMouseMove(){},onMouseUp(){},style:{}};const cl=ne.module("ItemList"),Os=class extends T.exports.PureComponent{constructor(e){super(e),this.getItemSelected=he((s,i)=>Xt.isSelected(i,s),{max:Os.CACHE_SIZE}),this.getCachedItem=he((s,i,o,r,l,a,c,d)=>{const u=a({item:o,itemIndex:s,isFocused:r,isSelected:l,style:c});return h(va,{onContextMenu:this.handleItemContextMenu,onDoubleClick:this.handleItemDoubleClick,onMouseDown:this.handleItemMouseDown,onFocus:this.handleItemFocus,onBlur:this.handleItemBlur,disableSelect:d,onMouseMove:this.handleItemMouseMove,onMouseUp:this.handleItemMouseUp,isFocused:r,isSelected:l,itemIndex:s,style:c,children:u},i)},{max:Os.CACHE_SIZE}),this.getOuterElement=he(s=>{const i=J.forwardRef((o,r)=>h("div",{ref:r,tabIndex:-1,onKeyDown:s,role:"presentation",...o}));return i.displayName="ItemListOuterElement",i}),this.getInnerElement=he(()=>{const s=J.forwardRef((i,o)=>h("div",{className:"item-list-inner-element",ref:o,...i}));return s.displayName="ItemListInnerElement",s}),this.getItemData=he((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=J.createRef(),this.listContainer=J.createRef();const{isStickyBottom:t,selectedRanges:n}=e;this.state={focusIndex:null,mouseDownIndex:null,selectedRanges:n,overscanStartIndex:0,height:null,isDragging:!1,isStuckToBottom:t,scrollOffset:null}}static renderItem({item:e}){var t,n;return h("div",{className:"item-list-item-content",children:e!=null&&((n=(t=e.displayValue)!=null?t:e.value)!=null?n:`${e}`)})}componentDidUpdate(e,t){const{selectedRanges:n,itemCount:s}=this.props,{focusIndex:i,isStuckToBottom:o,scrollOffset:r,height:l,selectedRanges:a}=this.state;if(o&&!this.isListAtBottom()&&s>0&&this.scrollToBottom(),(r!==t.scrollOffset||l!==t.height)&&this.sendViewportUpdate(),n!==e.selectedRanges&&n!==a)this.setSelectedRanges(n);else if(a!==t.selectedRanges){const{onSelectionChange:c}=this.props;c(a)}if(i!==t.focusIndex){const{onFocusChange:c}=this.props;c(i)}}componentWillUnmount(){window.removeEventListener("mouseup",this.handleWindowMouseUp)}focus(){var e;(e=this.listContainer.current)==null||e.focus()}restoreScrollPosition(){var t;const{scrollOffset:e}=this.state;e!=null&&((t=this.listContainer.current)==null||t.scrollTo(0,e))}getElement(e){if(this.listContainer.current==null)return null;const{focusSelector:t}=this.props,{overscanStartIndex:n}=this.state,s=this.listContainer.current.querySelectorAll(t),i=e-n;return s[i]}focusItem(e){const{disableSelect:t}=this.props;if(t)return;this.setState({focusIndex:e});const n=this.getElement(e);n instanceof HTMLElement&&n.focus()}scrollToItem(e){const t=this.getElement(e);t!=null&&t.scrollIntoView({block:"center"})}handleItemContextMenu(e,t){const{selectedRanges:n}=this.state,i=Xt.isSelected(n,e)||Ne.isModifierKeyDown(t);this.toggleSelect(e,t.shiftKey,i,!1)}handleItemDoubleClick(e,t){const{isDoubleClickSelect:n,onSelect:s}=this.props;n&&this.setState(({selectedRanges:i})=>({selectedRanges:Xt.selectRange(i,[e,e])}),()=>{s(e,t)})}handleItemMouseDown(e,t){const{selectedRanges:n}=this.state;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(t.button===2&&n.length===0){this.focusItem(e),this.selectItem(e);return}t.button!=null&&t.button!==0||(this.setState({mouseDownIndex:e}),window.addEventListener("mouseup",this.handleWindowMouseUp))}}handleItemBlur(e,t){cl.debug2("item blur",e,t.currentTarget,t.relatedTarget),(!t.relatedTarget||this.listContainer.current&&t.relatedTarget instanceof HTMLElement&&!this.listContainer.current.contains(t.relatedTarget))&&this.setState({focusIndex:null})}handleItemFocus(e,t){cl.debug2("item focus",e,t.target),this.setState(n=>{const{focusIndex:s}=n;return s!==e?{focusIndex:e}:null})}handleItemMouseMove(e,t){const{isDragSelect:n,isMultiSelect:s,disableSelect:i}=this.props,{mouseDownIndex:o,selectedRanges:r}=this.state;o==null||i||(this.setState({isDragging:!0}),(n||o===e)&&(this.focusItem(e),s?(!n&&!this.getItemSelected(e,r)&&!Ne.isModifierKeyDown(t)&&this.deselectAll(),this.selectRange([Math.min(o,e),Math.max(o,e)])):this.toggleSelect(e,t.shiftKey,Ne.isModifierKeyDown(t),!1)))}handleItemMouseUp(e,t){const{isDeselectOnClick:n,isDoubleClickSelect:s,onSelect:i}=this.props,{mouseDownIndex:o,isDragging:r}=this.state;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(o===e&&!r){const l=t.shiftKey,a=Ne.isModifierKeyDown(t);this.focusItem(e),this.toggleSelect(e,l,a,n),!s&&!l&&!a&&i(e,t)}this.resetMouseState()}}handleItemsRendered({overscanStartIndex:e}){this.setState({overscanStartIndex:e})}handleResize({height:e}){this.setState({height:e})}handleMouseLeave(){this.setState({mouseDownIndex:null})}handleWindowMouseUp(){this.resetMouseState(),window.removeEventListener("mouseup",this.handleWindowMouseUp)}handleKeyDown(e){var r;const{isMultiSelect:t,itemCount:n,onSelect:s}=this.props,{focusIndex:i}=this.state;let o=i;if(e.key==="Enter"||e.key===" "){!t&&o!=null&&this.setState({selectedRanges:[[o,o]]},()=>{o!=null&&s(o,e)});return}if(e.key==="ArrowUp")o!=null&&o>=0?o=Math.max(0,o-1):o=n-1;else if(e.key==="ArrowDown")o!=null&&o>=0?o=Math.min(o+1,n-1):o=0;else return;if(i!==o){e.stopPropagation(),e.preventDefault(),this.focusItem(o);const{selectedRanges:l}=this.state;if(e.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:e,scrollOffset:t}){this.setState(n=>{if(e)return{scrollOffset:t};const{isStickyBottom:s}=this.props,{height:i}=n;return{isStuckToBottom:s&&this.isListAtBottom({scrollOffset:t,height:i}),scrollOffset:t}})}resetMouseState(){this.setState({mouseDownIndex:null,isDragging:!1})}scrollToBottom(){const{itemCount:e}=this.props;this.list.current&&this.list.current.scrollToItem(e)}scrollIntoView(e){this.list.current&&this.list.current.scrollToItem(e)}toggleSelect(e,t,n,s=!0){const{isMultiSelect:i}=this.props,{selectedRanges:o}=this.state;if(i&&t&&o.length>0){const r=o[o.length-1];this.selectRange([Math.min(r[0],e),Math.max(e,r[1])])}else i&&o.length===1&&o[0][0]===e&&o[0][1]===e?s&&this.deselectItem(e):i&&n?this.getItemSelected(e,o)?s&&this.deselectItem(e):this.selectItem(e):(this.deselectAll(),this.selectItem(e))}deselectAll(){const{itemCount:e}=this.props;this.deselectRange([0,e])}deselectItem(e){this.deselectRange([e,e])}deselectRange(e){Xt.validateRange(e),this.setState(({selectedRanges:t})=>({selectedRanges:Xt.deselectRange(t,e)}))}selectItem(e){const{disableSelect:t}=this.props;t||this.selectRange([e,e])}selectRange(e){Xt.validateRange(e),this.setState(({selectedRanges:t})=>({selectedRanges:Xt.selectRange(t,e)}))}setSelectedRanges(e){this.setState({selectedRanges:e})}sendViewportUpdate(){const{scrollOffset:e,height:t}=this.state;if(e!=null&&t!=null){const{onViewportChange:n,rowHeight:s}=this.props,i=Math.floor(e/s),o=i+Math.ceil(t/s);n(i,o)}}isListAtBottom({scrollOffset:e,height:t}=this.state){if(t==null||e==null)return!1;const{itemCount:n,rowHeight:s}=this.props;return e+t>=n*s}renderInnerElement({index:e,style:t}){const{items:n,offset:s,renderItem:i,disableSelect:o}=this.props,{focusIndex:r,selectedRanges:l}=this.state;if(e<s||e>=s+n.length)return null;const a=n[e-s];return this.getCachedItem(e,e,a,e===r&&!o,this.getItemSelected(e,l),i,t,o)}render(){const{items:e,itemCount:t,overscanCount:n,renderItem:s,rowHeight:i,"data-testid":o}=this.props,{selectedRanges:r,isStuckToBottom:l}=this.state;return h(Mc,{className:"item-list-auto-sizer",onResize:this.handleResize,children:({width:a,height:c})=>h(Dc,{className:"item-list-scroll-pane",height:c,width:a,initialScrollOffset:l?t*i:0,itemCount:t,itemSize:i,itemData:this.getItemData(e,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 nn=Os;nn.CACHE_SIZE=1e3;nn.DEFAULT_ROW_HEIGHT=20;nn.DEFAULT_OVERSCAN=10;nn.defaultProps={offset:0,items:[],rowHeight:Os.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!1,isDragSelect:!0,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},overscanCount:Os.DEFAULT_OVERSCAN,renderItem:Os.renderItem,selectedRanges:[],focusSelector:".item-list-item","data-testid":void 0};const as=class extends T.exports.PureComponent{constructor(e){super(e),this.getCachedDraggableItem=he((t,n,s,i,o,r,l,a)=>h(sr,{draggableId:as.getDraggableId(t,i),index:i,isDragDisabled:l,children:c=>h("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:nn.CACHE_SIZE}),this.getCachedRenderDraggableItem=he((t,n,s)=>({item:i,itemIndex:o,isFocused:r,isSelected:l,style:a})=>this.getCachedDraggableItem(t,s,i,o,r,l,n,a),{max:1}),this.getCachedRenderClone=he((t,n,s,i)=>(o,r,l)=>{const{selectedCount:a}=this.state,{draggableProps:c,dragHandleProps:d,innerRef:u}=o,{index:m}=l.source,p=n[m-s];return h("div",{className:G("draggable-item-list-dragging-item-container",t),...c,...d,ref:u,children:h("div",{className:G("draggable-item-list-dragging-item",{"two-dragged":a===2},{"multiple-dragged":a>2}),children:i({item:p,itemIndex:m,isFocused:!1,isSelected:!0,style:{},isClone:!0,selectedCount:a})})})},{max:1}),this.handleSelectionChange=this.handleSelectionChange.bind(this),this.itemList=J.createRef(),this.state={selectedCount:0}}static renderHandle(){return R("div",{children:[h(Be,{children:"Drag to re-order"}),h(Q,{icon:lo})]})}static renderBadge({text:e}){return e!=null&&e.length>0?h("span",{className:"number-badge",children:e}):null}static renderTextItem({text:e,badgeText:t="",className:n=""}){return R("div",{className:G("item-list-item-content","draggable-item-list-item-content",n),children:[h("span",{className:"title",children:e}),as.renderBadge({text:t}),as.renderHandle()]})}static renderItem({item:e,isClone:t,selectedCount:n}){var r,l;const s=e!=null?(l=(r=e.displayValue)!=null?r:e.value)!=null?l:`${e}`:"",i=t!==void 0&&t?`${n}`:"",o=t!==void 0&&t?"item-list-item-clone":"";return as.renderTextItem({text:s,badgeText:i,className:o})}static getDraggableId(e,t){return`${e}/${t}`}static getDraggableIndex(e){const t=e.split("/").pop();return parseInt(t!==void 0?t:"",10)}selectItem(e){var t;(t=this.itemList.current)==null||t.selectItem(e)}focusItem(e){var t;(t=this.itemList.current)==null||t.focusItem(e)}scrollToItem(e){var t;(t=this.itemList.current)==null||t.scrollToItem(e)}handleSelectionChange(e){this.setState({selectedCount:Xt.count(e)});const{onSelectionChange:t}=this.props;t(e)}render(){const{className:e,draggablePrefix:t,draggingItemClassName:n,droppableId:s,isDoubleClickSelect:i,isDragDisabled:o,isDropDisabled:r,isMultiSelect:l,isStickyBottom:a,itemCount:c,items:d,offset:u,onFocusChange:m,onSelect:p,onViewportChange:g,renderItem:f,rowHeight:C,selectedRanges:w,style:b,"data-testid":S}=this.props;return h(io,{isDropDisabled:r,droppableId:s,mode:"virtual",renderClone:this.getCachedRenderClone(n,d,u,f),"data-testid":S,children:(E,v)=>h("div",{role:"menu",className:G("draggable-item-list",e,{"is-drop-disabled":r,"is-drag-disabled":o,"is-dragging-from-this":v.draggingFromThisWith,"is-dragging-over":v.isDraggingOver,"is-dropping":v.draggingOverWith}),style:b,ref:E.innerRef,...E.droppableProps,children:h(nn,{focusSelector:".draggable-item-list-item",isDoubleClickSelect:i,isDragSelect:!1,isMultiSelect:l,isStickyBottom:a,itemCount:c,items:d,onFocusChange:m,onSelect:p,onSelectionChange:this.handleSelectionChange,onViewportChange:g,offset:u,ref:this.itemList,renderItem:this.getCachedRenderDraggableItem(t,o,f),rowHeight:C,selectedRanges:w})})})}};let wt=as;wt.DEFAULT_ROW_HEIGHT=30;wt.defaultProps={className:"",draggingItemClassName:"",offset:0,items:[],rowHeight:as.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!0,isDropDisabled:!1,isDragDisabled:!1,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,style:null,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},renderItem:as.renderItem,selectedRanges:[],draggablePrefix:"draggable-item",droppableId:"droppable-item-list","data-testid":void 0};class mt{static reorder(t,n,s,i){const o=t===s?mt.adjustDestinationIndex(i,n):i,r=mt.removeItems(t,n);return s.splice(o,0,...r),r}static removeItems(t,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]=t.splice(a,c-a+1)}return Nc(s)}static adjustDestinationIndex(t,n){let s=t;for(let i=0;i<n.length;i+=1){const[o,r]=n[i];if(o>t)break;s-=Math.min(r,t-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 Wi=class extends T.exports.Component{static isParentSelected(e,t){const n=t.get(e);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(e){super(e),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(e){e.stopPropagation(),e.preventDefault(),this.setState(t=>{const{menuIsOpen:n}=t;return{menuIsOpen:!n}})}toggleValueFor(e,t){const{valueMap:n,onUpdateValueMap:s}=this.props,i=new Map(n),o=i.get(e);if(o instanceof Map){const l=new Map(o);if(t!=null)l.set(t,o.get(t)===void 0);else{const a=Wi.isParentSelected(e,i),c=a==null||!a;o.forEach((d,u)=>l.set(u,c))}i.set(e,l)}else i.set(e,o==null||!o);const r=i.get(e);if(t===void 0&&r!==void 0&&typeof r!="boolean"){const l=Wi.isParentSelected(e,n);l!=null&&l?r.forEach((a,c)=>r.set(c,!1)):r.forEach((a,c)=>r.set(c,!0))}s(i)}setAllValues(e){const{valueMap:t,onUpdateValueMap:n}=this.props,s=new Map;t.forEach((i,o)=>{if(typeof i=="boolean")s.set(o,e);else{const r=new Map;i.forEach((l,a)=>r.set(a,e)),s.set(o,r)}}),n(s)}selectAll(){this.setAllValues(!0)}clear(){this.setAllValues(!1)}renderMenuElement(){const{valueMap:e,"data-testid":t}=this.props;return R("div",{className:"hcm-menu-container",children:[Array.from(e.entries()).map(([n,s])=>R("div",{children:[h(at,{className:"hcm-parent",checked:Wi.isParentSelected(n,e),onChange:()=>this.toggleValueFor(n),children:n}),s!==void 0&&typeof s!="boolean"&&Array.from(s.entries()).map(([i,o])=>h(at,{className:"hcm-child",checked:o,onChange:()=>this.toggleValueFor(n,i),children:i},i))]},n)),h(K,{kind:"ghost",onClick:this.selectAll,"data-testid":t!==void 0?`${t}-btn-select-all`:void 0,children:"Select All"}),h(K,{kind:"ghost",onClick:this.clear,"data-testid":t!==void 0?`${t}-btn-clear`:void 0,children:"Clear"})]})}render(){const{menuText:e,className:t,icon:n,id:s,"data-testid":i}=this.props,{menuIsOpen:o}=this.state;return R("button",{type:"button",className:G("btn hcm-btn",t),onClick:this.toggleMenu,id:s,"data-testid":i,children:[R("span",{children:[n&&h(Q,{icon:n,className:"hcm-icon mr-1"}),e]}),h(Q,{icon:mr,className:"hcm-icon ml-1"}),h(vn,{options:{placement:"bottom"},isShown:o,onExited:()=>{this.setState({menuIsOpen:!1})},closeOnBlur:!0,interactive:!0,children:this.renderMenuElement()})]})}};let th=Wi;th.defaultProps={className:"",icon:null,id:"","data-testid":void 0};function Ta({isLoaded:e=!1,isLoading:t=!0,errorMessage:n=null,"data-testid":s}){return h(lt,{in:Boolean(n)||!e||t,timeout:xe.transitionMs,classNames:e?"fade":"",mountOnEnter:!0,unmountOnExit:!0,children:h("div",{className:"fill-parent-absolute","data-testid":s,children:h("div",{className:G("iris-panel-message-overlay","fill-parent-absolute",{"iris-panel-scrim-background":e}),children:R("div",{className:"message-content",children:[R("div",{className:"message-icon",children:[t&&h(Ht,{}),!t&&n!=null&&h(Q,{icon:$n})]}),h("div",{className:"message-text",children:n})]})})})})}function Ea({on:e,id:t,className:n,isInvalid:s,disabled:i=!1,onClick:o,"data-testid":r}){return h("button",{type:"button",className:G("btn","btn-switch",n,{active:e},{"is-invalid":s}),id:t,onClick:o,disabled:i,"data-testid":r,children:h("div",{className:"handle"})})}function dl(e){return e.isOn!==void 0}function nh({item:e,onSelect:t=()=>{},"data-testid":n}){const{icon:s,subtitle:i,title:o}=e,r=T.exports.useMemo(()=>dl(e)?()=>{e.onChange(!e.isOn)}:t,[e,t]);return R("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&&h("div",{className:"icon",children:h(Q,{icon:s})}),h("div",{className:"title",children:o}),i!==void 0&&h("div",{className:"shortcut",children:i}),h("div",{className:"accessory","data-testid":n,children:dl(e)?h(Ea,{on:e.isOn,onClick:l=>{l.stopPropagation(),r()}}):h(Q,{icon:jl})})]})}function ya({items:e,onSelect:t=()=>{},"data-testid":n}){return h("div",{className:"navigation-menu-view","data-testid":n,children:h("ul",{className:"navigation-menu-list",children:e.map((s,i)=>h("li",{children:h(nh,{item:s,onSelect:()=>{t(i)}})},s.title))})})}function ul({children:e,onBack:t,onClose:n,title:s,"data-testid":i}){return R("div",{className:"navigation-page","data-testid":i,children:[R("div",{className:"navigation-title-bar",children:[h("div",{className:"navigation-left-buttons",children:t!==void 0&&h(K,{kind:"ghost",className:"btn-back","data-testid":"btn-page-back",onClick:t,icon:Pd,children:"Back"})}),h("div",{className:"navigation-title",children:s}),h("div",{className:"navigation-right-buttons",children:n!==void 0&&h(K,{kind:"ghost",className:"btn-close px-2 m-1","data-testid":"btn-page-close",onClick:n,icon:di,tooltip:"Close"})})]}),h("div",{className:"navigation-content",children:e})]})}function sh({children:e,"data-testid":t}){const n=T.exports.useMemo(()=>J.Children.toArray(e),[e]),s=Cr(n),[i,o]=T.exports.useState(n[n.length-1]),[r,l]=T.exports.useState(null),[a,c]=T.exports.useState(null);T.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 d=T.exports.useCallback(()=>{o(r),l(null)},[r]),u=T.exports.useCallback(()=>{c(null)},[]);return R("div",{className:"navigation-stack",children:[h("div",{className:"main-view","data-testid":t,children:i}),h(lt,{in:a!=null,timeout:xe.transitionMidMs,classNames:"slide-right",onEntered:u,children:h(Fe,{children:a!=null&&h("div",{className:"popping-view",children:a})})}),h(lt,{in:r!=null,timeout:xe.transitionMidMs,classNames:"slide-left",onEntered:d,children:h(Fe,{children:r!=null&&h("div",{className:"pushing-view",children:r})})})]})}function ih({children:e,disabled:t,value:n,"data-testid":s}){return h("option",{value:n,disabled:t,"data-testid":s,children:e})}function Sr(e){const{children:t,disabled:n=!1,name:s,onChange:i,value:o="","data-testid":r}=e,[l]=T.exports.useState(s!=null?s:tn());return h(Fe,{children:J.Children.map(t,a=>{var c,d;return a?J.cloneElement(a,{name:l,onChange:(c=a.props.onChange)!=null?c:i,checked:o===a.props.value,disabled:(d=a.props.disabled)!=null?d:n,"data-testid":r}):null})})}const Sn=J.forwardRef((e,t)=>{const{checked:n,children:s,className:i="",disabled:o=!1,inputClassName:r="",isInvalid:l=!1,labelClassName:a="",name:c,onChange:d,value:u,"data-testid":m}=e,[p]=T.exports.useState(tn());return R("div",{className:G("custom-control custom-radio",i),children:[h("input",{type:"radio",id:p,"data-testid":m,name:c,ref:t,className:G("custom-control-input",r,{"is-invalid":l}),checked:n,disabled:o,value:u,onChange:d}),h("label",{className:G("custom-control-label",a),htmlFor:p,children:s})]})});Sn.displayName="RadioItem";Sn.defaultProps={checked:void 0,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};function oh({children:e,onBlur:t,onChange:n,className:s,defaultValue:i,name:o,value:r,disabled:l,"data-testid":a}){const c=T.exports.useCallback(d=>{n(d.target.value)},[n]);return h("select",{className:G("custom-select",s),onBlur:t,onChange:c,defaultValue:i,value:r,name:o,disabled:l,"data-testid":a,children:e})}class Ra extends T.exports.PureComponent{constructor(t){super(t),this.getCachedItem=he((n,s,i,o,r,l,a)=>{const c={height:r},d=o!=null?o:i;return h("li",{className:"value-list-item",style:c,tabIndex:-1,children:h(at,{checked:l,disabled:a,onChange:()=>this.handleSelect(n),children:d})},s)},{max:1e3}),this.getCachedItems=he((n,s,i,o)=>{const r=[];for(let l=0;l<n.length;l+=1){const a=n[l],{value:c,displayValue:d,isSelected:u}=a,m=i+l,p=m,g=this.getCachedItem(m,p,c,d,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=J.createRef(),this.topRow=null,this.bottomRow=null}componentDidMount(){this.sendViewportUpdate()}componentDidUpdate(){this.sendViewportUpdate()}handleBlur(t){if(!t.relatedTarget||this.list.current&&t.relatedTarget instanceof HTMLElement&&!this.list.current.contains(t.relatedTarget)){const{onBlur:n}=this.props;n==null||n(t)}}handleScroll(){this.sendViewportUpdate()}handleSelect(t){const{items:n,offset:s,onSelect:i}=this.props,o=t-s;if(o>=0&&o<n.length){const r=n[o],{value:l}=r;i(t,l)}else i(t,null)}sendViewportUpdate(){if(!this.list.current||this.list.current.clientHeight===0)return;const{onViewportChange:t,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,t(o,r))}getElement(t){return this.list.current==null?null:this.list.current.querySelectorAll(".value-list-item")[t]}scrollIntoView(t){const n=this.getElement(t);n==null||n.scrollIntoView({block:"center"})}render(){const{className:t,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 h("div",{className:G("select-value-list-scroll-pane h-100 w-100",{"is-invalid":s},t),onBlur:this.handleBlur,onScroll:this.handleScroll,ref:this.list,"data-testid":a,children:h("div",{className:"select-value-list",style:{height:o*l},children:h("ol",{className:"select-value-list-content",style:{position:"absolute",height:i.length*l,top:r*l,left:0},children:c})})})}}Ra.defaultProps={disabled:!1,rowHeight:21,onBlur:()=>{},"data-testid":void 0};const hl=ne.module("Shortcut");var ie=(e=>(e.CTRL="MODIFIER_CTRL",e.CMD="MODIFIER_CMD",e.ALT="MODIFIER_ALT",e.OPTION="MODIFIER_OPTION",e.SHIFT="MODIFIER_SHIFT",e))(ie||{}),le=(e=>(e.A="A",e.B="B",e.C="C",e.D="D",e.E="E",e.F="F",e.G="G",e.H="H",e.I="I",e.J="J",e.K="K",e.L="L",e.M="M",e.N="N",e.O="O",e.P="P",e.Q="Q",e.R="R",e.S="S",e.T="T",e.U="U",e.V="V",e.W="W",e.X="X",e.Y="Y",e.Z="Z",e.ZERO="0",e.ONE="1",e.TWO="2",e.THREE="3",e.FOUR="4",e.FIVE="5",e.SIX="6",e.SEVEN="7",e.EIGHT="8",e.NINE="9",e.BACKSPACE="Backspace",e.ESCAPE="Escape",e.ENTER="Enter",e.DELETE="Delete",e.SLASH="/",e.QUESTION_MARK="?",e.BACKSLASH="\\",e.PIPE="|",e.MINUS="-",e.UNDERSCORE="_",e.EQUALS="=",e.PLUS="+",e.BACKTICK="`",e.TILDE="~",e.COMMA=",",e.LEFT_CHEVRON="<",e.PERIOD=".",e.RIGHT_CHEVRON=">",e.SEMICOLON=";",e.COLON=":",e.SINGLE_QUOTE="'",e.DOUBLE_QUOTE='"',e.LEFT_BRACKET="[",e.RIGHT_BRACKET="]",e.LEFT_CURLY="{",e.RIGHT_CURLY="}",e.F1="F1",e.F2="F2",e.F3="F3",e.F4="F4",e.F5="F5",e.F6="F6",e.F7="F7",e.F8="F8",e.F9="F9",e.F10="F10",e.F11="F11",e.F12="F12",e))(le||{});const rh=new Set(["Enter","Delete","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]),qe=class extends ir{constructor({id:e,shortcut:t,macShortcut:n,isEditable:s=!0,name:i,tooltip:o}){super(),this.id=e,this.name=i,this.tooltip=o,this.isEditable=s;const l=qe.isMacPlatform?n:t;this.defaultKeyState=qe.createKeyState(l),this.keyState=this.defaultKeyState}static isAllowedKey(e){return Object.values(le).includes(e)}static isValidKeyState(e){const{keyValue:t}=e;return t===null?!0:!qe.isMacPlatform&&e.metaKey||!qe.isAllowedKey(t)?!1:!(!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey)||rh.has(t)}static createKeyState(e){const t={altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1,keyValue:e[e.length-1]};return e.forEach(n=>{switch(n){case"MODIFIER_CTRL":t.ctrlKey=!0;break;case"MODIFIER_ALT":case"MODIFIER_OPTION":t.altKey=!0;break;case"MODIFIER_CMD":t.metaKey=!0;break;case"MODIFIER_SHIFT":t.shiftKey=!0;break}}),t}static getKeyStateFromEvent(e){const{key:t,keyCode:n}=e;let s="";return t==="Shift"||t==="Meta"||t==="Control"||t==="Alt"?s="":!qe.isAllowedKey(t)&&qe.isAllowedKey(String.fromCharCode(n))?s=String.fromCharCode(n):s=t,{keyValue:s,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey}}static getWindowsDisplayText(e){let t="";return e.ctrlKey&&(t+="Ctrl+"),e.altKey&&(t+="Alt+"),e.shiftKey&&(t+="Shift+"),e.keyValue==="Escape"?t+="Esc":e.keyValue!==null&&(t+=e.keyValue),t}static getMacDisplayText(e){let t="";switch(e.ctrlKey&&(t+="\u2303"),e.altKey&&(t+="\u2325"),e.shiftKey&&(t+="\u21E7"),e.metaKey&&(t+="\u2318"),e.keyValue){case"Enter":t+="\u23CE";break;case"Escape":t+="\u238B";break;case"Backspace":t+="\u232B";break;case"Delete":t+="\u2326";break;case null:break;default:t+=e.keyValue}return t}static doKeyStatesMatch(e,t){var n,s;return((n=e.keyValue)==null?void 0:n.toUpperCase())===((s=t.keyValue)==null?void 0:s.toUpperCase())&&e.altKey===t.altKey&&e.ctrlKey===t.ctrlKey&&e.metaKey===t.metaKey&&e.shiftKey===t.shiftKey}static getDisplayText(e){return e.keyValue===null?"":qe.isMacPlatform?qe.getMacDisplayText(e):qe.getWindowsDisplayText(e)}getDisplayText(){return qe.getDisplayText(this.keyState)}getKeyState(){return this.keyState}setKeyState(e){qe.isValidKeyState(e)?(hl.debug2(`Shortcut ${this.id} updated to ${JSON.stringify(e)}`),this.keyState=e,this.dispatchEvent(new Re("onUpdate",{detail:this}))):hl.debug2(`Shortcut ${this.id} tried to update to invalid keyState ${JSON.stringify(e)}`)}getDefaultKeyState(){return this.defaultKeyState}isDefault(){return qe.doKeyStatesMatch(this.getDefaultKeyState(),this.getKeyState())}setToNull(){this.setKeyState(qe.NULL_KEY_STATE)}isNull(){return qe.doKeyStatesMatch(this.keyState,qe.NULL_KEY_STATE)}setToDefault(){this.setKeyState(this.defaultKeyState)}matchesKeyState(e){return qe.doKeyStatesMatch(e,this.keyState)}matchesEvent(e){return this.matchesKeyState(qe.getKeyStateFromEvent(e))}};let vr=qe;vr.NULL_KEY_STATE={metaKey:!1,shiftKey:!1,altKey:!1,ctrlKey:!1,keyValue:null};vr.isMacPlatform=Ne.isMacPlatform();const ml=ne.module("ShortcutRegistry");class lh extends ir{constructor(){super(...arguments),this.shortcutMap=new Map,this.shortcutsByCategory=new Map}createAndAdd(t){const n=new vr(t);return this.add(n)}add(t){var i;const n=this.shortcutMap.get(t.id);if(n)return ml.warn(`Skipping attempt to add duplicate shortcut ID to registry: ${t.id}`),n;ml.debug2(`Adding shortcut to registry: ${t.id}`),t.addEventListener("onUpdate",({detail:o})=>this.dispatchEvent(new Re("onUpdate",{detail:o})));const s=t.id.split(".")[0];return this.shortcutMap.set(t.id,t),this.shortcutsByCategory.has(s)?(i=this.shortcutsByCategory.get(s))==null||i.push(t):this.shortcutsByCategory.set(s,[t]),t}get(t){return this.shortcutMap.get(t)}getConflictingShortcuts(t){return Array.from(this.shortcutMap.values()).filter(n=>!n.isNull()&&n.matchesKeyState(t))}}const Ie=Object.freeze(new lh),Tr={COPY:Ie.createAndAdd({id:"GLOBAL.COPY",name:"Copy",shortcut:[ie.CTRL,le.C],macShortcut:[ie.CMD,le.C],isEditable:!1}),PASTE:Ie.createAndAdd({id:"GLOBAL.PASTE",name:"Paste",shortcut:[ie.CTRL,le.V],macShortcut:[ie.CMD,le.V],isEditable:!1}),SAVE:Ie.createAndAdd({id:"GLOBAL.SAVE",name:"Save",shortcut:[ie.CTRL,le.S],macShortcut:[ie.CMD,le.S],isEditable:!1}),SELECT_ALL:Ie.createAndAdd({id:"GLOBAL.SELECT_ALL",name:"Select All",shortcut:[ie.CTRL,le.A],macShortcut:[ie.CMD,le.A],isEditable:!1}),LINKER:Ie.createAndAdd({id:"GLOBAL.LINKER",name:"Linker",shortcut:[ie.CTRL,le.L],macShortcut:[ie.CMD,le.L]}),LINKER_CLOSE:Ie.createAndAdd({id:"GLOBAL.LINKER_CLOSE",name:"Close Linker Overlay",shortcut:[le.ESCAPE],macShortcut:[le.ESCAPE],isEditable:!1})};const Ia=J.forwardRef((e,t)=>{const{children:n,className:s,disabled:i,id:o,isLinked:r,isLinkedSource:l,isInvalid:a,onClick:c,onMouseEnter:d,onMouseLeave:u,style:m,"data-testid":p}=e;return R("button",{ref:t,type:"button",className:G("btn-socketed",{"btn-socketed-linked":r!==void 0&&r||l},{"btn-socketed-linked-source":l},{"is-invalid":a},s),id:o,onClick:c,onMouseEnter:d,onMouseLeave:u,style:m,disabled:i,"data-testid":p,children:[n,h(Q,{icon:Jl,className:"linked btn-socketed-icon",transform:"down-1"}),h(Q,{icon:hu,className:"is-invalid btn-socketed-icon"})]})});Ia.displayName="SocketedButton";Ia.defaultProps={children:void 0,className:"",disabled:!1,id:void 0,isLinked:!1,isLinkedSource:!1,isInvalid:!1,onClick:void 0,onMouseEnter:void 0,onMouseLeave:void 0,style:void 0,"data-testid":void 0};const ah="_track_535ju_30",ch="_handle_535ju_13",uh="_ticks_535ju_98",Ma={"handle-size":"15px","popover-width":"90px","time-slider":"_time-slider_535ju_3","time-slider-popovers":"_time-slider-popovers_535ju_8","handle-popper":"_handle-popper_535ju_13","flex-spacer":"_flex-spacer_535ju_26",track:ah,"track-fills":"_track-fills_535ju_37","track-fill":"_track-fill_535ju_37","track-fill-start":"_track-fill-start_535ju_55","track-fill-middle":"_track-fill-middle_535ju_56","track-fill-end":"_track-fill-end_535ju_59","handle-track":"_handle-track_535ju_62",handle:ch,ticks:uh,"tick-labels":"_tick-labels_535ju_116","tick-label":"_tick-label_535ju_116","tick-label-wrapper":"_tick-label-wrapper_535ju_132"};parseInt(Ma["handle-size"],10);parseInt(Ma["popover-width"],10);Object.freeze({ERROR:"error"});class Da extends Error{constructor(){super(...arguments),this.isAssertionFailed=!0}}function pl(e){if(e==null)throw new Da(`Expected 'val' to be defined, but received ${e}`)}class ko extends Error{constructor(){super(...arguments),this.isPasteError=!0}}function Oe(e){return(e==null?void 0:e.isEditable)!==void 0}function gl(e){if(!Oe(e))throw new Da(`Expected 'model' to be editable, but received ${e}`)}function We(e){return(e==null?void 0:e.hasExpandableRows)!==void 0}var Lt=(e=>(e.DOWN="DOWN",e.UP="UP",e.LEFT="LEFT",e.RIGHT="RIGHT",e))(Lt||{});const ue=class{static normalize(e,t,n,s){let i=e,o=t,r=n,l=s;return i!=null&&r!=null&&r<i&&(i=r,r=e),o!=null&&l!=null&&l<o&&(o=l,l=t),[i,o,r,l]}static makeNormalized(e,t,n,s){return new ue(...ue.normalize(e,t,n,s))}static makeCell(e,t){return new ue(e,t,e,t)}static makeColumn(e){return new ue(e,null,e,null)}static makeRow(e){return new ue(null,e,null,e)}static minOrNull(e,t){return e==null||t==null?null:Math.min(e,t)}static maxOrNull(e,t){return e==null||t==null?null:Math.max(e,t)}static consolidate(e){const t=e.slice();let n=!0;for(;n;){n=!1;for(let s=0;s<t.length&&!n;s+=1){const i=t[s];for(let o=t.length-1;o>s;o-=1){const r=t[o];if(i.contains(r))t.splice(o,1);else if(r.contains(i)){n=!0,t[s]=r,t.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=ue.minOrNull(i.startColumn,r.startColumn),d=ue.maxOrNull(i.endColumn,r.endColumn);n=!0,t[s]=new ue(c,l,d,a),t.splice(o,1);break}}else if(i.startColumn===r.startColumn&&i.endColumn===r.endColumn&&i.touches(r)){const{startColumn:l,endColumn:a}=i,c=ue.minOrNull(i.startRow,r.startRow),d=ue.maxOrNull(i.endRow,r.endRow);n=!0,t[s]=new ue(l,c,a,d),t.splice(o,1);break}}}}return t}static isAxisRangeTouching(e,t,n,s){return e==null?t==null||n==null?!0:n<=t+1:t==null?s==null?!0:s>=e-1:n==null?s==null?!0:e<=s+1:s==null?t>=n-1:n>=e-1?n<=t+1:s>=e-1}static rangeArraysEqual(e,t){if(e===t)return!0;if(e==null||t==null||e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(!e[n].equals(t[n]))return!1;return!0}static intersection(e,t){if(e.equals(t))return e;let{startColumn:n,startRow:s,endColumn:i,endRow:o}=e;return n=n!=null&&t.startColumn!=null?Math.max(n,t.startColumn):n!=null?n:t.startColumn,i=i!=null&&t.endColumn!=null?Math.min(i,t.endColumn):i!=null?i:t.endColumn,s=s!=null&&t.startRow!=null?Math.max(s,t.startRow):s!=null?s:t.startRow,o=o!=null&&t.endRow!=null?Math.min(o,t.endRow):o!=null?o:t.endRow,n!=null&&n>(i!=null?i:-1)||s!=null&&s>(o!=null?o:-1)?null:new ue(n,s,i,o)}static subtractFromRange(e,t){const n=[],s=ue.intersection(e,t);return s==null?[e]:(s.startRow!=null&&(e.startRow==null||e.startRow<s.startRow)&&n.push(new ue(e.startColumn,e.startRow,e.endColumn,s.startRow-1)),s.startColumn!=null&&(e.startColumn==null||e.startColumn<s.startColumn)&&n.push(new ue(e.startColumn,s.startRow,s.startColumn-1,s.endRow)),s.endColumn!=null&&(e.endColumn==null||e.endColumn>s.endColumn)&&n.push(new ue(s.endColumn+1,s.startRow,e.endColumn,s.endRow)),s.endRow!=null&&(e.endRow==null||e.endRow>s.endRow)&&n.push(new ue(e.startColumn,s.endRow+1,e.endColumn,e.endRow)),n)}static subtractFromRanges(e,t){const n=[];for(let s=0;s<e.length;s+=1)n.push(...ue.subtractFromRange(e[s],t));return n}static subtractRangesFromRanges(e,t){if(t==null||t.length===0)return e;let n=[...e];for(let s=0;s<t.length;s+=1)n=ue.subtractFromRanges(n,t[s]);return n}static isBounded(e){return e.startRow!=null&&e.startColumn!=null&&e.endRow!=null&&e.endColumn!=null}static boundedRange(e,t,n){var s,i,o,r;return ue.isBounded(e)?e:new ue((s=e.startColumn)!=null?s:0,(i=e.startRow)!=null?i:0,(o=e.endColumn)!=null?o:t-1,(r=e.endRow)!=null?r:n-1)}static boundedRanges(e,t,n){return e.map(s=>ue.boundedRange(s,t,n))}static offset(e,t,n){return new ue(e.startColumn!=null?e.startColumn+t:null,e.startRow!=null?e.startRow+n:null,e.endColumn!=null?e.endColumn+t:null,e.endRow!=null?e.endRow+n:null)}static nextCell(e,t=null,n=null,s=ue.SELECTION_DIRECTION.DOWN){if(e.length===0)return null;let i=-1;if(t!=null&&n!=null&&(i=e.findIndex(o=>o.containsCell(t,n)),i>=0)){const r=e[i].nextCell(t,n,s);if(r!=null)return r}switch(s){case ue.SELECTION_DIRECTION.DOWN:case ue.SELECTION_DIRECTION.RIGHT:{const o=i<e.length-1?i+1:0;return e[o].startCell(s)}case ue.SELECTION_DIRECTION.LEFT:case ue.SELECTION_DIRECTION.UP:{const o=i>0?i-1:e.length-1;return e[o].startCell(s)}default:throw new Error(`Invalid direction: ${s}`)}}static cellCount(e){return e.reduce((t,n)=>{var s,i,o,r;return t+(((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(e){return e.reduce((t,n)=>{var s,i;return t+((s=n.endRow)!=null?s:NaN)-((i=n.startRow)!=null?i:NaN)+1},0)}static columnCount(e){return e.reduce((t,n)=>{var s,i;return t+((s=n.endColumn)!=null?s:NaN)-((i=n.startColumn)!=null?i:NaN)+1},0)}static containsCell(e,t,n){for(let s=0;s<e.length;s+=1)if(e[s].containsCell(t,n))return!0;return!1}static forEachCell(e,t,n=ue.SELECTION_DIRECTION.RIGHT){for(let s=0;s<e.length;s+=1)e[s].forEach(t,n)}constructor(e,t,n,s){this.startColumn=e,this.startRow=t,this.endColumn=n,this.endRow=s}equals(e){return this.startColumn===e.startColumn&&this.startRow===e.startRow&&this.endColumn===e.endColumn&&this.endRow===e.endRow}contains(e){return(this.startColumn==null||e.startColumn!=null&&this.startColumn<=e.startColumn)&&(this.startRow==null||e.startRow!=null&&this.startRow<=e.startRow)&&(this.endColumn==null||e.endColumn!=null&&this.endColumn>=e.endColumn)&&(this.endRow==null||e.endRow!=null&&this.endRow>=e.endRow)}containsCell(e,t){return e==null||t==null?!1:(this.startColumn==null||this.startColumn<=e)&&(this.endColumn==null||this.endColumn>=e)&&(this.startRow==null||this.startRow<=t)&&(this.endRow==null||this.endRow>=t)}touches(e){return ue.isAxisRangeTouching(this.startRow,this.endRow,e.startRow,e.endRow)&&ue.isAxisRangeTouching(this.startColumn,this.endColumn,e.startColumn,e.endColumn)}subtract(e){return ue.subtractFromRange(this,e)}startCell(e=ue.SELECTION_DIRECTION.DOWN){if(!ue.isBounded(this))throw new Error("Cannot get the startCell of an unbounded range");switch(e){case ue.SELECTION_DIRECTION.DOWN:case ue.SELECTION_DIRECTION.RIGHT:return{column:this.startColumn,row:this.startRow};case ue.SELECTION_DIRECTION.LEFT:case ue.SELECTION_DIRECTION.UP:return{column:this.endColumn,row:this.endRow};default:throw new Error(`Invalid direction: ${e}`)}}nextCell(e,t,n){if(!ue.isBounded(this))throw new Error("Bounded range required");if(e==null||t==null)throw new Error("Require a non-null cursor");const{startColumn:s,endColumn:i,startRow:o,endRow:r}=this;switch(n){case ue.SELECTION_DIRECTION.DOWN:if(t<r)return{column:e,row:Math.max(t+1,o)};if(e<i)return{column:Math.max(e+1,s),row:o};break;case ue.SELECTION_DIRECTION.UP:if(t>o)return{column:e,row:Math.min(t-1,r)};if(e>s)return{column:Math.min(e-1,i),row:r};break;case ue.SELECTION_DIRECTION.RIGHT:if(e<i)return{column:Math.max(e+1,s),row:t};if(t<r)return{column:s,row:Math.max(t+1,o)};break;case ue.SELECTION_DIRECTION.LEFT:if(e>s)return{column:Math.min(e-1,i),row:t};if(t>o)return{column:i,row:Math.min(t-1,r)};break;default:throw new Error(`Invalid direction: ${n}`)}return null}forEach(e,t=ue.SELECTION_DIRECTION.RIGHT){var o;let n=0,{column:s,row:i}=this.startCell(t);for(;s!=null&&i!=null;)e(s,i,n),n+=1,{column:s,row:i}=(o=this.nextCell(s,i,t))!=null?o:{}}};let Z=ue;Z.SELECTION_DIRECTION=Lt;function hh(e){return Array.isArray(e)&&e.length===2&&(e[0]===null||typeof e[0]=="number")&&(e[1]===null||typeof e[1]=="number")}function Oi(e){return hh(e)&&e[0]!=null&&e[1]!=null}const pe=class{static getGridPointFromXY(e,t,n){const s=pe.getColumnAtX(e,n),i=pe.getRowAtY(t,n),o=pe.getColumnHeaderDepthAtY(t,n);return{x:e,y:t,row:i,column:s,columnHeaderDepth:o}}static getCellInfoFromXY(e,t,n){const{row:s,column:i}=pe.getGridPointFromXY(e,t,n),{visibleColumnWidths:o,visibleRowHeights:r,visibleColumnXs:l,visibleRowYs:a,modelColumns:c,modelRows:d}=n,u=s!==null?d.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,C=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:C!=null?C:null}}static getColumnHeaderDepthAtY(e,t){const n=pe.getRowAtY(e,t),{columnHeaderHeight:s,columnHeaderMaxDepth:i}=t;if(n===null&&e<=s*i)return Ue(i-Math.ceil(e/s),0,i-1)}static iterateFloatingStart(e,t,n){for(let s=0;s<e&&s<t;s+=1){const i=n(s);if(i!==void 0)return i}}static iterateFloatingEnd(e,t,n){for(let s=0;s<e&&t-(e-s)>=0;s+=1){const i=n(t-(e-s));if(i!==void 0)return i}}static iterateFloating(e,t,n,s){const i=pe.iterateFloatingStart(e,n,s);return i!==void 0?i:pe.iterateFloatingEnd(t,n,s)}static iterateAllItems(e,t,n,s,i,o){const r=Math.max(e,n),l=Math.min(t,i-s-1);let a=pe.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(e,t,n,s){var r,l;const i=(r=t.get(e))!=null?r:0,o=(l=n.get(e))!=null?l:0;return i<=s&&s<=i+o}static getItemAtOffset(e,t,n,s,i,o,r,l=!1){const a=l?void 0:pe.iterateFloating(n,s,t,c=>{if(pe.isInItem(c,o,r,e))return c});if(!l&&a!==void 0)return a;for(let c=0;c<i.length;c+=1){const d=i[c];if(pe.isInItem(d,o,r,e))return d}return null}static getColumnAtX(e,t,n=!1){const{columnCount:s,floatingLeftColumnCount:i,floatingRightColumnCount:o,visibleColumns:r,visibleColumnXs:l,visibleColumnWidths:a,gridX:c}=t;return e<c?null:this.getItemAtOffset(e-c,s,i,o,r,l,a,n)}static getRowAtY(e,t){const{floatingTopRowCount:n,floatingBottomRowCount:s,rowCount:i,visibleRows:o,visibleRowYs:r,visibleRowHeights:l,gridY:a}=t;return e<a?null:this.getItemAtOffset(e-a,i,n,s,o,r,l)}static getNextShownItem(e,t,n,s){let i=n.findIndex(o=>o===e)||0;for(i-=1;i!=null&&i>=0;){const o=n[i],r=t.get(o);if(r!=null&&s.get(r)!==0)return o;i-=1}return null}static getNextShownColumn(e,t){const{modelColumns:n,visibleColumns:s,userColumnWidths:i}=t;return pe.getNextShownItem(e,n,s,i)}static getNextShownRow(e,t){const{modelRows:n,visibleRows:s,userRowHeights:i}=t;return pe.getNextShownItem(e,n,s,i)}static getColumnSeparatorIndex(e,t,n,s){var w,b,S,E;const{rowHeaderWidth:i,columnHeaderHeight:o,floatingColumns:r,floatingLeftWidth:l,visibleColumns:a,visibleColumnXs:c,visibleColumnWidths:d,columnHeaderMaxDepth:u}=n,{allowColumnResize:m,headerSeparatorHandleSize:p}=s;if(u*o<t||!m||p<=0)return null;const g=e-i,f=p*.5;let C=!1;for(let v=r.length-1;v>=0;v-=1){const y=r[v],M=(w=c.get(y))!=null?w:0,F=(b=d.get(y))!=null?b:0,x=F===0;if(!C||!x){let U=M+F;x?U+=f:C&&(U-=f);const V=U-f,N=U+f;if(V<=g&&g<=N)return y;C=x}}C=!1;for(let v=a.length-1;v>=0;v-=1){const y=a[v],M=(S=c.get(y))!=null?S:0,F=(E=d.get(y))!=null?E:0,x=F===0;if(M<l-F)return null;if(!C||!x){let U=M+F;x?U+=f:C&&(U-=f);const V=U-f,N=U+f;if(V<=g&&g<=N)return y;C=x}}return null}static isItemHidden(e,t){return t.get(e)===0}static isColumnHidden(e,t){const{visibleColumnWidths:n}=t;return pe.isItemHidden(e,n)}static isFloatingRow(e,t){if(e==null)return!1;const{floatingTopRowCount:n,floatingBottomRowCount:s,rowCount:i}=t;return e<n||e>=i-s}static isFloatingColumn(e,t){if(e==null)return!1;const{floatingLeftColumnCount:n,floatingRightColumnCount:s,columnCount:i}=t;return e<n||e>=i-s}static getHiddenItems(e,t,n){if(!pe.isItemHidden(e,t))return[];const s=[e],i=n.findIndex(o=>o===e);for(let o=i-1;o>=0;o-=1){const r=n[o];if(!pe.isItemHidden(r,t))break;s.push(r)}return s}static getHiddenColumns(e,t){const{visibleColumns:n,visibleColumnWidths:s}=t;return pe.getHiddenItems(e,s,n)}static getRowSeparatorIndex(e,t,n,s){var g,f;const{rowHeaderWidth:i,columnHeaderHeight:o,visibleRows:r,visibleRowYs:l,visibleRowHeights:a}=n,{allowRowResize:c,headerSeparatorHandleSize:d}=s;if(i<e||!c||d<=0)return null;const u=t-o,m=d*.5;let p=!1;for(let C=r.length-1;C>=0;C-=1){const w=r[C],b=(g=l.get(w))!=null?g:0,S=(f=a.get(w))!=null?f:0,E=S===0;if(!p||!E){let v=b+S;E?v+=m:p&&(v-=m);const y=v-m,M=v+m;if(y<=u&&u<=M)return w;p=E}}return null}static isRowHidden(e,t){const{visibleRowHeights:n}=t;return pe.isItemHidden(e,n)}static getHiddenRows(e,t){const{visibleRows:n,visibleRowHeights:s}=t;return pe.getHiddenItems(e,s,n)}static moveItem(e,t,n){if(e===t)return n;const s=[...n],i=s[s.length-1];return i!=null&&!Oi(i.from)&&i.to===e?i.from===t?s.pop():s[s.length-1]={...i,to:t}:s.push({from:e,to:t}),s}static moveRange(e,t,n,s=!1){if(e[0]===e[1])return pe.moveItem(e[0],t,n);let i=t;if(s&&e[0]<t&&(i-=e[1]-e[0]),e[0]===i)return n;const o=[...n],r=o[o.length-1];r!=null&&Oi(r.from)&&r.from[1]-r.from[0]===e[1]-e[0]&&r.to===e[0]?o[o.length-1]={...r,to:i}:o.push({from:e,to:i});const l=o[o.length-1];return Oi(l.from)&&l.from[0]===l.to&&o.pop(),o}static moveItemOrRange(e,t,n,s=!1){return Array.isArray(e)?pe.moveRange(e,t,n,s):pe.moveItem(e,t,n)}static applyItemMoves(e,t,n,s=!1){var o,r;let i=[[e,t]];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 d=1,u;Oi(a)?(d=a[1]-a[0]+1,[u]=a):u=a;const m=s?c:u,p=m+d-1,g=s?u:c,f=g-m,C=[];for(let w=0;w<i.length;w+=1){const b=(o=i[w][0])!=null?o:Number.NEGATIVE_INFINITY,S=(r=i[w][1])!=null?r:Number.POSITIVE_INFINITY;let E;const v=[[b,m-1],[m,p],[p+1,S]].map(([y,M])=>[Math.max(y,b),Math.min(M,S)]).filter(([y,M])=>y<=M).map(y=>{const[M,F]=y;return m<=M&&p>=F?(E=[M+f,F+f],E):p<M?[M-d,F-d]:y}).map(y=>{const[M,F]=y;return g>M&&g<=F?[[M,g-1],[g+d,F+d]]:y===E?[y]:g<=M?[[M+d,F+d]]:[y]}).flat();C.push(...v)}i=C.map(([w,b])=>[Number.isFinite(w)?w:null,Number.isFinite(b)?b:null])}return i}static translateRange(e,t,n,s){const i=pe.applyItemMoves(e.startColumn,e.endColumn,t,s),o=pe.applyItemMoves(e.startRow,e.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 d=o[c];r.push(new Z(a[0],d[0],a[1],d[1]))}}return r}static getModelIndex(e,t){return pe.applyItemMoves(e,e,t,!0)[0][0]}static getModelIndexes(e,t){return e.map(n=>pe.getModelIndex(n,t))}static getModelRangeIndexes(e,t,n){return pe.applyItemMoves(e,t,n,!0)}static getModelRange(e,t=[],n=[]){return pe.translateRange(e,t,n,!0)}static getModelRanges(e,t=[],n=[]){const s=[];for(let i=0;i<e.length;i+=1)s.push(...pe.getModelRange(e[i],t,n));return s}static getVisibleRangeIndexes(e,t,n){return pe.applyItemMoves(e,t,n,!1)}static getVisibleRange(e,t=[],n=[]){return this.translateRange(e,t,n,!1)}static getVisibleRanges(e,t=[],n=[]){const s=[];for(let i=0;i<e.length;i+=1)s.push(...pe.getVisibleRange(e[i],t,n));return s}static getVisibleIndex(e,t){return pe.applyItemMoves(e,e,t)[0][0]}static getVisibleIndexes(e,t){return e.map(n=>pe.getVisibleIndex(n,t))}static isMacPlatform(){const{platform:e}=window.navigator;return e.startsWith("Mac")}static getModifierKey(){return pe.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(e){const t=pe.getModifierKey();return e[t]}static checkColumnHidden(e,t){return t.get(e)===0}static checkAllColumnsHidden(e,t){return t.size===0?!1:e.every(n=>t.get(n)===0)}static getScrollDragBounds(e,t,n){const{gridX:s,gridY:i,width:o,height:r,floatingTopRowCount:l,floatingBottomRowCount:a,floatingLeftColumnCount:c,floatingRightColumnCount:d,floatingLeftWidth:u,floatingRightWidth:m,floatingTopHeight:p,floatingBottomHeight:g,columnCount:f,rowCount:C}=e;let w=s,b=i,S=o,E=r;return n!=null&&(n>c&&(w+=u),n<f-d&&(S-=m)),t!=null&&(t>l&&(b+=p),t<C-a&&(E-=g)),{x1:w,y1:b,x2:S,y2:E}}static getScrollDelta(e,t=1024,n=768,s=20,i=20){let{deltaX:o,deltaY:r}=e;return!pe.isMacPlatform()&&e.shiftKey&&e.deltaX===0&&e.deltaY!==0&&(o=e.deltaY,r=e.deltaX),(e==null?void 0:e.deltaMode)===WheelEvent.DOM_DELTA_PAGE?(o*=t,r*=n):(e==null?void 0:e.deltaMode)===WheelEvent.DOM_DELTA_LINE&&(pe.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(e,t){return e[0]==null||e[1]==null||t[0]==null||t[1]==null?0:e[0]!==t[0]?e[0]-t[0]:e[1]-t[1]}static mergeSortedRanges(e){const t=[];for(let n=0;n<e.length;n+=1){const s=e[n],i=s[0],o=s[1];n===0?t.push([i,o]):i-1<=t[t.length-1][1]?t[t.length-1][1]=Math.max(t[t.length-1][1],o):t.push([i,o])}return t}};let B=pe;B.PIXELS_PER_LINE=100/3;function L(e,t,n=void 0){var i;const s=(i=e.get(t))!=null?i:n;if(s!==void 0)return s;throw new Error(`Missing value for key ${t}`)}function ki(e,t=hi.CACHE_SIZE,n=Math.floor(t/2)){if(e.size>t){const s=e.keys();for(;e.size>n;)e.delete(s.next().value)}}function fl(e,t,n,s,i){const o=new Map;let r=0;for(let l=0;l<e&&l<n;l+=1)o.set(l,r),r+=L(i,l);r=s;for(let l=0;l<t&&n-l-1>=0;l+=1)r-=L(i,n-l-1),o.set(n-l-1,r);return o}const Na=class{constructor({userColumnWidths:e=new Map,userRowHeights:t=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=e,this.userRowHeights=t,this.calculatedRowHeights=s,this.calculatedColumnWidths=n,this.fontWidths=i,this.modelRows=o,this.modelColumns=r,this.movedRows=l,this.movedColumns=a}getMetrics(e){const{left:t,top:n,leftOffset:s,topOffset:i,width:o,height:r,theme:l,model:a,movedRows:c,movedColumns:d,draggingColumn:u}=e,{rowHeight:m,rowHeaderWidth:p,rowFooterWidth:g,columnWidth:f,columnHeaderHeight:C,minScrollHandleSize:w,scrollBarSize:b}=l;c!==this.movedRows&&(this.movedRows=c,this.modelRows.clear()),d!==this.movedColumns&&(this.movedColumns=d,this.modelColumns.clear());const{columnCount:S,rowCount:E,floatingTopRowCount:v,floatingBottomRowCount:y,floatingLeftColumnCount:M,floatingRightColumnCount:F,columnHeaderMaxDepth:x}=a,U=this.getFirstRow(e),V=this.getFirstColumn(e),N=this.getGridX(e),H=this.getGridY(e),k=We(a)&&a.hasExpandableRows?this.calculateTreePaddingX(e):0,z=0;let P=this.getVisibleRowHeights(e),_=this.getVisibleColumnWidths(e,V,k);const $=Array.from(P.keys()),X=Array.from(_.keys());P=new Map([...P,...this.getFloatingRowHeights(e)]),_=new Map([..._,...this.getFloatingColumnWidths(e)]);let ee=this.getVisibleColumnXs(_,X,s),ae=this.getVisibleRowYs(P,$,i);const fe=$.length>0?$[$.length-1]:n,Ce=X.length>0?X[X.length-1]:t,de=this.getBottomViewport(e,$,ae,P),ye=this.getRightViewport(e,X,ee,_),Xe=this.getFloatingTopHeight(e,P),yt=this.getFloatingBottomHeight(e,P),Ye=this.getFloatingLeftWidth(e,_),et=this.getFloatingRightWidth(e,_),_t=Array.from(_.values()),Rt=Array.from(P.values()),He=_t.reduce((ze,fs)=>ze+fs,0)-s,on=Rt.reduce((ze,fs)=>ze+fs,0)-i,pt=s+He+g,ge=i+on,$e=o-N,Ge=r-H,Nt=this.getLastLeft(e,null,$e-g),rn=this.getLastLeft(e,null,$e-g-b),Rn=this.getLastTop(e,null,Ge-yt),Vt=this.getLastTop(e,null,Ge-yt-b);let ln=rn,ct=Vt;Nt===0&&Rn===0&&(ln=0,ct=0);const Ut=ln>0,zs=Ut?b:0,ps=ct>0,Ws=ps?b:0,jn=o-p-Ws,In=r-C-zs,So=p,vo=C,Ci=S===1?jn/pt:(S-ln)/S,To=E===1?In/ge:(E-ct)/E,wi=Ut?Ue(jn*Ci,w,jn-1):0,$s=ps?Ue(In*To,w,In-1):0,qs=L(_,t,0),bi=L(P,n,0),Eo=qs>0?s/qs:0,Zn=bi>0?i/bi:0,yo=S===1?s/(pt-$e):(t+Eo)/ln,Ks=E===1?i/(ge-Ge):(n+Zn)/ct,Ro=Ut?yo*(jn-wi):0,Io=ps?Ks*(In-$s):0;let Xs=[];(v>0||y>0)&&(Xs=[...Array(v).keys(),...[...Array(y).keys()].map(ze=>E-ze-1)],ae=new Map([...ae,...this.getFloatingRowYs(e,P,Math.floor(r-H-zs))]));let gs=[];(M>0||F>0)&&(gs=[...Array(M).keys(),...[...Array(F).keys()].map(ze=>S-ze-1)],ee=new Map([...ee,...this.getFloatingColumnXs(e,_,Math.floor(o-N-Ws))]));const Ys=[];if(u)for(let ze=u.range[0];ze<=u.range[1];ze+=1)Ys.push(ze),_.has(ze)||_.set(ze,this.getVisibleColumnWidth(ze,e)),ee.has(ze)||ee.set(ze,0);const Si=$.concat(Xs),vi=X.concat(gs).concat(Ys),Qs=this.getModelRows(Si,e),Mo=this.getModelColumns(vi,e),Ti=this.getVisibleRowTreeBoxes(P,Qs,e),Ei=this.getTopVisible(e,ae,P,$),yi=this.getLeftVisible(e,ee,_,X),Ri=ct>0?this.getBottomVisible(e,ae,P,$,H):fe,Ii=ln>0?this.getRightVisible(e,ee,_,X,N):Ce,{fontWidths:Do,userColumnWidths:No,userRowHeights:Mi,calculatedRowHeights:Di,calculatedColumnWidths:Ni}=this;return{rowHeight:m,rowHeaderWidth:p,rowFooterWidth:g,rowCount:E,columnWidth:f,columnCount:S,columnHeaderHeight:C,floatingTopRowCount:v,floatingBottomRowCount:y,floatingLeftColumnCount:M,floatingRightColumnCount:F,gridX:N,gridY:H,firstRow:U,firstColumn:V,treePaddingX:k,treePaddingY:z,left:t,top:n,bottom:fe,right:Ce,topOffset:i,leftOffset:s,topVisible:Ei,leftVisible:yi,bottomVisible:Ri,rightVisible:Ii,bottomViewport:de,rightViewport:ye,width:o,height:r,maxX:He,maxY:on,lastLeft:ln,lastTop:ct,barHeight:In,barTop:vo,barWidth:jn,barLeft:So,handleHeight:$s,handleWidth:wi,hasHorizontalBar:Ut,hasVerticalBar:ps,verticalBarWidth:Ws,horizontalBarHeight:zs,scrollX:Ro,scrollY:Io,scrollableContentWidth:pt,scrollableContentHeight:ge,scrollableViewportWidth:$e,scrollableViewportHeight:Ge,visibleRows:$,visibleColumns:X,floatingRows:Xs,floatingColumns:gs,allRows:Si,allColumns:vi,visibleRowHeights:P,visibleColumnWidths:_,floatingTopHeight:Xe,floatingBottomHeight:yt,floatingLeftWidth:Ye,floatingRightWidth:et,visibleRowYs:ae,visibleColumnXs:ee,visibleRowTreeBoxes:Ti,modelRows:Qs,modelColumns:Mo,movedRows:c,movedColumns:d,fontWidths:Do,userColumnWidths:No,userRowHeights:Mi,calculatedRowHeights:Di,calculatedColumnWidths:Ni,columnHeaderMaxDepth:x}}getGridX(e){const{theme:t}=e,{rowHeaderWidth:n}=t;return n}getGridY(e){const{theme:t,model:n}=e,{columnHeaderHeight:s}=t,{columnHeaderMaxDepth:i}=n;return i*s}getVisibleHeight(e,t=this.getFloatingRowHeights(e)){const{height:n,theme:s}=e,{scrollBarSize:i}=s,o=this.getGridY(e),r=this.getFloatingBottomHeight(e,t),l=this.getFloatingTopHeight(e,t);return n-r-l-o-i}getVisibleWidth(e,t=this.getFloatingColumnWidths(e)){const{width:n,theme:s}=e,{scrollBarSize:i,rowFooterWidth:o}=s,r=this.getGridX(e),l=this.getFloatingRightWidth(e,t),a=this.getFloatingLeftWidth(e,t);return n-a-l-r-i-o}getFirstIndex(e,t,n){const s=e.size+1;for(let i=0;i<s;i+=1){const o=t(i,n);if(e.get(o)!==0)return i}return 0}getFirstColumn(e){return this.getFirstIndex(this.userColumnWidths,this.getModelColumn.bind(this),e)}getFirstRow(e){return this.getFirstIndex(this.userRowHeights,this.getModelRow.bind(this),e)}getLastLeft(e,t,n){const{model:s}=e,{columnCount:i,floatingRightColumnCount:o}=s;let r=Math.max(0,i-o-1);t!=null&&(r=t);let l=0;for(;r>=0;){if(l+=this.getVisibleColumnWidth(r,e),l>=n)return Ue(r+1,0,t!=null?t:i-1);r-=1}return 0}getLastTop(e,t,n){const{model:s}=e,{rowCount:i,floatingBottomRowCount:o}=s;let r=Math.max(0,i-o-1);t!=null&&(r=t);let l=0;for(;r>=0;){if(l+=this.getVisibleRowHeight(r,e),l>=n)return Ue(r+1,0,i-1);r-=1}return 0}getTopForTopVisible(e,t){const n=this.getFloatingTopHeight(e);let s=t,i=0;for(;s>0&&i<n;)s-=1,i+=this.getVisibleRowHeight(s,e);return s}getTopForBottomVisible(e,t){const{height:n}=e,s=this.getGridY(e),i=this.getFloatingBottomHeight(e),o=n-s-i;return this.getLastTop(e,t,o)}getLeftForLeftVisible(e,t){const n=this.getFloatingLeftWidth(e);let s=t,i=0;for(;s>0&&i<n;)s-=1,i+=this.getVisibleColumnWidth(s,e);return s}getLeftForRightVisible(e,t){const{width:n}=e,s=this.getGridX(e),i=this.getFloatingRightWidth(e),o=n-s-i;return this.getLastLeft(e,t,o)}getFloatingRowHeights(e){const{model:t}=e,{floatingTopRowCount:n,floatingBottomRowCount:s,rowCount:i}=t,o=new Map;for(let r=0;r<n&&r<i;r+=1)o.set(r,this.getVisibleRowHeight(r,e));for(let r=0;r<s&&i-r-1>=0;r+=1){const l=i-r-1;o.set(l,this.getVisibleRowHeight(l,e))}return o}getVisibleRowHeights(e){const{top:t,topOffset:n,height:s,model:i}=e;let o=0,r=t;const l=new Map,{rowCount:a}=i;for(;o<s+n&&r<a;){const c=this.getVisibleRowHeight(r,e);l.set(r,c),o+=c,r+=1}return l}getFloatingColumnWidths(e,t=this.getFirstColumn(e),n=this.calculateTreePaddingX(e)){const{model:s}=e,{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,e,t,n));for(let a=0;a<r&&i-a-1>=0;a+=1){const c=i-a-1;l.set(c,this.getVisibleColumnWidth(c,e,t,n))}return l}getVisibleColumnWidths(e,t=this.getFirstColumn(e),n=this.calculateTreePaddingX(e)){const{left:s,leftOffset:i,width:o,model:r}=e;let l=0,a=s;const c=new Map,{columnCount:d}=r;for(;l<o+i&&a<d;){const u=this.getVisibleColumnWidth(a,e,t,n);c.set(a,u),l+=u,a+=1}return c}getFloatingColumnXs(e,t,n){const{model:s}=e,{columnCount:i,floatingLeftColumnCount:o,floatingRightColumnCount:r}=s;return fl(o,r,i,n,t)}getVisibleColumnXs(e,t,n){const s=new Map;let i=-n;for(let o=0;o<t.length;o+=1){const r=t[o],l=L(e,r);s.set(r,i),i+=l}return s}getFloatingRowYs(e,t,n){const{model:s}=e,{floatingTopRowCount:i,floatingBottomRowCount:o,rowCount:r}=s;return fl(i,o,r,n,t)}getVisibleRowYs(e,t,n){const s=new Map;let i=-n;for(let o=0;o<t.length;o+=1){const r=t[o],l=L(e,r);s.set(r,i),i+=l}return s}getVisibleRowTreeBoxes(e,t,n){const s=new Map,{model:i,theme:o}=n,{treeDepthIndent:r,treeHorizontalPadding:l}=o;return We(i)&&i.hasExpandableRows&&e.forEach((a,c)=>{const d=L(t,c);if(i.isRowExpandable(d)){const u=i.depthForRow(d),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(e,t=this.getFloatingColumnWidths(e)){const{model:n}=e,{floatingLeftColumnCount:s}=n;let i=0;for(let o=0;o<s;o+=1)i+=L(t,o);return i}getFloatingRightWidth(e,t=this.getFloatingColumnWidths(e)){const{model:n}=e,{floatingRightColumnCount:s,columnCount:i}=n;let o=0;for(let r=0;r<s;r+=1)o+=L(t,i-r-1);return o}getFloatingTopHeight(e,t=this.getFloatingRowHeights(e)){const{model:n}=e,{floatingTopRowCount:s}=n;let i=0;for(let o=0;o<s;o+=1)i+=L(t,o);return i}getFloatingBottomHeight(e,t=this.getFloatingRowHeights(e)){const{model:n}=e,{floatingBottomRowCount:s,rowCount:i}=n;let o=0;for(let r=0;r<s;r+=1)o+=L(t,i-r-1);return o}getTopVisible(e,t,n,s){const i=this.getFloatingTopHeight(e,n);for(let o=0;o<s.length;o+=1){const r=s[o];if(L(t,r)>=i)return r}return 0}getLeftVisible(e,t,n,s){const i=this.getFloatingLeftWidth(e,n);for(let o=0;o<s.length;o+=1){const r=s[o];if(L(t,r)>=i)return r}return 0}getBottomVisible(e,t,n,s,i){const{height:o,theme:r}=e,{scrollBarSize:l}=r,a=this.getFloatingBottomHeight(e,n),c=o-i-l-a;for(let d=s.length-1;d>=0;d-=1){const u=s[d],m=L(t,u),p=L(n,u);if(m+p<=c)return u}return 0}getRightVisible(e,t,n,s,i){const{width:o,theme:r}=e,{scrollBarSize:l}=r,a=this.getFloatingRightWidth(e,n),c=o-i-l-a;for(let d=s.length-1;d>=0;d-=1){const u=s[d],m=L(t,u),p=L(n,u);if(m+p<=c)return u}return 0}getBottomViewport(e,t,n,s){const{height:i,theme:o}=e,{rowHeight:r}=o;return this.getLastIndexViewport(t,n,s,i,r)}getRightViewport(e,t,n,s){const{width:i,theme:o}=e,{columnWidth:r}=o;return this.getLastIndexViewport(t,n,s,i,r)}getLastIndexViewport(e,t,n,s,i){let o=0,r=0;return e.length>0&&(o=e[e.length-1],r=L(t,o)+L(n,o)),r<s&&(o+=Math.ceil((s-r)/i)),o}getVisibleItemSize(e,t,n){var i;const s=n();return(i=t.get(e))!=null?i:s}getVisibleRowHeight(e,t){const n=this.getModelRow(e,t);return this.getVisibleItemSize(n,this.userRowHeights,()=>this.calculateRowHeight(e,n,t))}getVisibleColumnWidth(e,t,n=this.getFirstColumn(t),s=this.calculateTreePaddingX(t)){const i=this.getModelColumn(e,t);return this.getVisibleItemSize(i,this.userColumnWidths,()=>this.calculateColumnWidth(e,i,t,n,s))}getModelRows(e,t){const n=new Map;for(let s=0;s<e.length;s+=1){const i=e[s],o=this.getModelRow(i,t);n.set(i,o)}return n}getModelRow(e,t){if(this.modelRows.has(e))return L(this.modelRows,e);const{movedRows:n}=t,s=B.getModelIndex(e,n);return this.modelRows.set(e,s),s}getModelColumns(e,t){const n=new Map;for(let s=0;s<e.length;s+=1){const i=e[s],o=this.getModelColumn(i,t);n.set(i,o)}return n}getModelColumn(e,t){if(this.modelColumns.has(e))return L(this.modelColumns,e);const{movedColumns:s}=t,i=B.getModelIndex(e,s);return this.modelColumns.set(e,i),i}calculateRowHeight(e,t,n){const{theme:s}=n,{autoSizeRows:i,rowHeight:o}=s;if(!i)return o;const r=this.calculatedRowHeights.get(t);return r!=null?r:(this.calculatedRowHeights.set(t,Math.ceil(o)),ki(this.calculatedRowHeights),o)}calculateColumnWidth(e,t,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(t,n),c=this.calculateColumnDataWidth(t,n),d=this.calculatedColumnWidths.get(t);let u=Math.ceil(Math.max(a,c));return u=Math.max(l,u),d!=null&&d>u?u=d:(this.calculatedColumnWidths.set(t,u),ki(this.calculatedColumnWidths)),e===s&&(u+=i),u}calculateColumnHeaderWidth(e,t){const{model:n,theme:s}=t,{headerFont:i,headerHorizontalPadding:o}=s,r=n.textForColumnHeader(e,0);if(r!==void 0&&r!==""){const l=this.getWidthForFont(i,t);return r.length*l+o*2}return o*2}calculateColumnDataWidth(e,t){const{top:n,height:s,width:i,model:o,theme:r}=t,{floatingTopRowCount:l,floatingBottomRowCount:a,rowCount:c}=o,{font:d,cellHorizontalPadding:u,rowHeight:m,rowHeaderWidth:p,rowFooterWidth:g,scrollBarSize:f}=r;let C=0;const w=this.getWidthForFont(d,t),b=s/m,S=Math.ceil(n+b);return B.iterateAllItems(n,S,l,a,c,E=>{const v=this.getModelRow(E,t),y=o.textForCell(e,v);if(y){const M=u*2;C=Math.max(C,y.length*w+M)}}),C=Math.max(Math.min(C,(i-p-f-g)*Na.MAX_COLUMN_WIDTH),u*2),C}calculateTreePaddingX(e){const{top:t,height:n,model:s,theme:i}=e,{rowHeight:o,treeDepthIndent:r}=i;if(!We(s)||!s.hasExpandableRows)return 0;let l=0;const a=n/o,c=Math.ceil(t+a);for(let d=t;d<=c;d+=1){const u=this.getModelRow(d,e),m=s.depthForRow(u);l=Math.max(l,r*(m+1))}return l}getWidthForFont(e,t){if(this.fontWidths.has(e))return L(this.fontWidths,e);const{context:n}=t;n.font=e;const s=n.measureText("8"),{width:i}=s;return this.fontWidths.set(e,i),this.fontWidths.set(n.font,i),i}setColumnWidth(e,t){const n=new Map(this.userColumnWidths);n.set(e,Math.ceil(t)),ki(n),this.userColumnWidths=n}resetColumnWidth(e){const t=new Map(this.userColumnWidths);t.delete(e),this.userColumnWidths=t}setRowHeight(e,t){const n=new Map(this.userRowHeights);n.set(e,Math.ceil(t)),ki(n),this.userRowHeights=n}resetRowHeight(e){const t=new Map(this.userRowHeights);t.delete(e),this.userRowHeights=t,this.calculatedRowHeights.delete(e)}};let hi=Na;hi.CACHE_SIZE=1e4;hi.MAX_COLUMN_WIDTH=.8;const mh=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"}),vt=(e,t)=>{let n=!1;const s=he(e,{...t,dispose:()=>{n||(n=!0,s.clear(),n=!1)}});return s};function ph(e,t,n=6){const s=qo.hex.lab.raw(e);return s[0]=Math.max(s[0]-s[0]/n*t,0),`#${qo.lab.hex(s)}`}function gh(e,t){const[n,s,i]=qo.hex.rgb(e);return`rgba(${n}, ${s}, ${i}, ${t})`}const Cl={colorWithAlpha:gh,darkenForDepth:ph};class Je{constructor(t=5e3){this.cursor=null,this.order=t}onDown(t,n,s){return!1}onMove(t,n,s){return!1}onDrag(t,n,s){return!1}onLeave(t,n,s){return!1}onClick(t,n,s){return!1}onContextMenu(t,n,s){return!1}onDoubleClick(t,n,s){return!1}onUp(t,n,s){return!1}onWheel(t,n,s){return!1}}class Fa extends Je{constructor(){super(...arguments),this.resizingItems=[],this.hiddenItems=[],this.targetSizes=new Map,this.dragOffset=0}onDown(t,n){const{metrics:s}=n,{model:i}=n.props,o=n.getTheme();if(!s)throw new Error("metrics not set");const r=this.getSeparator(t,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(t,n){const{metrics:s}=n,{model:i}=n.props,o=n.getTheme();if(!s)throw new Error("metrics not set");const r=this.getSeparator(t,s,i,o);return r!=null?(this.updateCursor(s,r.index),!0):!1}onDrag(t,n){var f;if(this.draggingIndex==null)return!1;const s=t[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],d=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 C=L(l,g),w=s-a-C-this.dragOffset,b=L(d,g),S=this.targetSizes.get(b),E=this.resizingItems.length>1,v=this.hiddenItems.indexOf(g);let y=L(c,b);g===u&&(y+=m);let M=w;Math.abs(w-y)<=r.headerResizeSnapThreshold?M=null:S!==void 0&&w>S&&(E&&v!==0||v>0)?M=S:w<=r.headerResizeHiddenSnapThreshold&&(M=0),M!==y?p.set(b,M):p.set(b,null),w<-r.headerResizeSnapThreshold&&M===0?v>=0&&E?(this.resizingItems.pop(),this.removeTargetSize(o,g),g=this.resizingItems[this.resizingItems.length-1],this.dragOffset-=(f=this.targetSizes.get(L(d,g)))!=null?f:0):(g=this.getNextShownItem(g,o),g!==null&&(this.resizingItems.push(g),this.addTargetSize(o,g))):S!==void 0&&w>S+r.headerResizeSnapThreshold&&M===S?v>0?(this.dragOffset+=M,g=this.hiddenItems[v-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((C,w)=>{C!==null?this.setSize(i,w,C):this.resetSize(i,w)}),this.updateCursor(o,this.draggingIndex),!0}onUp(t,n){return this.draggingIndex!=null&&(this.draggingIndex=void 0,this.resizingItems=[],this.hiddenItems=[],this.targetSizes.clear(),this.updateSeparator(n,null)),!1}onDoubleClick(t,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(t,s,o,r);if(l!=null){const a=s[this.modelIndexesProperty],c=L(a,l.index);return this.resetSize(i,c),n.forceUpdate(),!0}return!1}updateCursor(t,n){const s=t[this.visibleSizesProperty];L(s,n)===0?this.cursor=this.hiddenCursor:this.cursor=this.defaultCursor}addTargetSize(t,n){const s=t[this.modelIndexesProperty],i=t[this.userSizesProperty],o=t[this.calculatedSizesProperty],r=n===0?t[this.treePaddingProperty]:0,l=L(s,n);let a=i.get(l);(a==null||a===0)&&(a=L(o,l)+r),this.targetSizes.set(l,a)}removeTargetSize(t,n){const s=t[this.modelIndexesProperty],i=L(s,n);this.targetSizes.delete(i)}}class mo extends Fa{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=B.getHiddenColumns,this.getNextShownItem=B.getNextShownColumn,this.getSeparator=mo.getColumnSeparator}static getColumnSeparator(t,n,s,i){if(!i.allowColumnResize)return null;const{x:o,y:r,columnHeaderDepth:l}=t,{modelColumns:a}=n,c=B.getColumnSeparatorIndex(o,r,n,i);return c==null||l==null||l>0?null:a.get(c)!=null?{index:c,depth:0}:null}setSize(t,n,s){t.setColumnWidth(n,s)}resetSize(t,n){t.resetColumnWidth(n)}updateSeparator(t,n){t.setState({draggingColumnSeparator:n,isDragging:n!==null})}}const gn=class{constructor(){this.getCachedTruncatedString=vt((e,t,n,s,i)=>gn.truncateToWidth(e,t,n,s,i),{max:1e4}),this.getCachedBackgroundColors=vt((e,t)=>e.split(" ").map(n=>{const s=[];for(let i=0;i<t;i+=1)s.push(Cl.darkenForDepth(n,i,t));return s}),{max:1e3}),this.getCachedColorWithAlpha=vt((e,t)=>Cl.colorWithAlpha(e,t),{max:1e3}),this.getCachedColorIsDark=vt(e=>co.isDark(e),{max:1e3})}static truncate(e,t){return t<e.length?e.substr(0,t)+"\u2026":e}static binaryTruncateToWidth(e,t,n,s=0,i=t.length,o){if(i>=t.length&&e.measureText(t).width<=n)return t;if(o!==void 0){const c=e.measureText(o).width;return o.repeat(Math.max(1,Math.floor(n/c)))}let r=s,l=Math.min(t.length-1,i),a=t;for(;l>=r;){const c=Math.ceil((l+r)/2),d=gn.truncate(t,c);if(e.measureText(d).width<=n){if(a=d,r===c)break;r=c}else if(c===0){a=d;break}else l=c-1}return a}static truncateToWidth(e,t,n,s=gn.DEFAULT_FONT_WIDTH,i){if(n<=0||t.length<=0)return"";const o=Math.min(Math.max(0,Math.floor(n/s/2)-5),t.length),r=Math.min(Math.ceil(n/s*2),t.length);return gn.binaryTruncateToWidth(e,t,n,o,r,i)}drawCanvas(e){const{context:t}=e;t.save(),this.configureContext(t,e),this.drawBackground(t,e),this.drawGrid(t,e),this.drawHeaders(t,e),this.drawFooters(t,e),this.drawDraggingColumn(t,e),this.drawDraggingRow(t,e),this.drawScrollBars(t,e),t.restore()}configureContext(e,t){const{theme:n}=t;e.font=n.font,e.textBaseline="middle",e.lineCap="butt"}drawBackground(e,t){const{theme:n,metrics:s}=t,{width:i,height:o}=s;e.fillStyle=n.backgroundColor,e.fillRect(0,0,i,o)}drawGrid(e,t){const{metrics:n,draggingRow:s,draggingColumn:i}=t,{gridX:o,gridY:r}=n;e.translate(o,r),this.drawGridBackground(e,t,s==null&&i==null),this.drawCellContents(e,t),this.drawFloatingRows(e,t),this.drawFloatingColumns(e,t),e.translate(-o,-r)}drawFloatingRows(e,t){const{draggingRow:n,draggingColumn:s,metrics:i,theme:o}=t,{floatingTopRowCount:r,floatingBottomRowCount:l,floatingRows:a,rowCount:c,visibleColumns:d,visibleRowYs:u,visibleRowHeights:m}=i;if(a.length!==0){o.floatingRowBackgroundColors&&this.drawRowStripesForRows(e,t,a,o.floatingRowBackgroundColors),n==null&&s==null&&this.drawFloatingMouseRowHover(e,t),this.drawGridLinesForItems(e,t,d,a,o.floatingGridColumnColor,o.floatingGridRowColor),this.drawCellBackgroundsForItems(e,t,d,a),this.drawFloatingBorders(e,t),r>0&&this.drawSelectedRanges(e,t,{top:0,bottom:r-1,maxY:L(u,r-1)+L(m,r-1)-.5}),l>0&&this.drawSelectedRanges(e,t,{top:c-l-1,bottom:c-1,minY:L(u,c-l)+.5,maxY:L(u,c-1)+L(m,c-1)-.5});for(let p=0;p<d.length;p+=1){const g=d[p];for(let f=0;f<a.length;f+=1){const C=a[f];this.drawCellContent(e,t,g,C)}}}}drawFloatingColumns(e,t){const{draggingRow:n,draggingColumn:s,metrics:i,theme:o}=t,{floatingLeftColumnCount:r,floatingRightColumnCount:l,floatingLeftWidth:a,floatingRightWidth:c,floatingColumns:d,gridX:u,maxX:m,columnCount:p,visibleRows:g,visibleColumnXs:f,visibleColumnWidths:C,width:w,height:b}=i;if(d.length!==0){o.floatingRowBackgroundColors&&(this.drawRowStripesForRows(e,t,g,o.floatingRowBackgroundColors,0,a),this.drawRowStripesForRows(e,t,g,o.floatingRowBackgroundColors,w-u-c,m)),n==null&&s==null&&this.drawFloatingMouseRowHover(e,t),e.save(),e.beginPath(),e.rect(0,0,a,b),e.clip(),this.drawGridLinesForItems(e,t,d,g,o.floatingGridColumnColor,o.floatingGridRowColor),e.restore(),this.drawCellBackgroundsForItems(e,t,d,g),this.drawFloatingBorders(e,t),r>0&&this.drawSelectedRanges(e,t,{left:0,maxX:L(f,r-1)+L(C,r-1)}),l>0&&this.drawSelectedRanges(e,t,{left:p-l,right:p-1,minX:L(f,p-l)+.5,maxX:L(f,p-1)+L(C,p-1)});for(let S=0;S<d.length;S+=1){const E=d[S];for(let v=0;v<g.length;v+=1){const y=g[v];this.drawCellContent(e,t,E,y)}}}}drawFloatingBorders(e,t){const{metrics:n,theme:s}=t,{floatingTopRowCount:i,floatingBottomRowCount:o,floatingLeftColumnCount:r,floatingRightColumnCount:l,rowCount:a,columnCount:c,visibleRowYs:d,visibleColumnXs:u,visibleRowHeights:m,visibleColumnWidths:p,maxX:g,maxY:f}=n,{floatingDividerOuterColor:C,floatingDividerInnerColor:w}=s;if(e.lineWidth=3,e.beginPath(),e.strokeStyle=C,i>0){const b=L(d,i-1)+L(m,i-1)+.5;e.moveTo(0,b),e.lineTo(g,b)}if(o>0){const b=L(d,a-o)-.5;e.moveTo(0,b),e.lineTo(g,b)}if(r>0){const b=L(u,r-1)+L(p,r-1)+.5;e.moveTo(b,0),e.lineTo(b,f)}if(l>0){const b=L(u,c-l)-.5;e.moveTo(b,0),e.lineTo(b,f)}if(e.stroke(),e.beginPath(),e.lineWidth=1,e.strokeStyle=w,i>0){const b=L(d,i-1)+L(m,i-1)+.5;e.moveTo(0,b),e.lineTo(g,b)}if(o>0){const b=L(d,a-o)-.5;e.moveTo(0,b),e.lineTo(g,b)}if(r>0){const b=L(u,r-1)+L(p,r-1)+.5;e.moveTo(b,0),e.lineTo(b,f)}if(l>0){const b=L(u,c-l)-.5;e.moveTo(b,0),e.lineTo(b,f)}e.stroke()}drawGridBackground(e,t,n=!1){this.drawRowStripes(e,t),n&&(this.drawMouseColumnHover(e,t),this.drawMouseRowHover(e,t)),this.drawGridLines(e,t),this.drawCellBackgrounds(e,t);const{metrics:s}=t,{bottom:i,right:o,floatingBottomRowCount:r,floatingLeftColumnCount:l,floatingRightColumnCount:a,floatingTopRowCount:c,columnCount:d,rowCount:u,visibleRowHeights:m,visibleRowYs:p,visibleColumnXs:g,visibleColumnWidths:f,width:C,height:w}=s;this.drawSelectedRanges(e,t,{bottom:Math.min(i,u-r-1),right:Math.min(o,d-a-1),minX:l>0&&g.has(l+1)?L(g,l+1):-10,minY:c>0&&p.has(c+1)?L(p,c+1):-10,maxX:a>0&&g.has(d-a-1)?L(g,d-a-1)+L(f,d-a-1)-.5:C+10,maxY:r>0&&p.has(u-r-1)?L(p,u-r-1)+L(m,u-r-1)-.5:w+10})}drawRowStripes(e,t){const{metrics:n,theme:s}=t,{visibleRows:i}=n,{rowBackgroundColors:o}=s;!o||this.drawRowStripesForRows(e,t,i,o)}drawRowStripesForRows(e,t,n,s,i=0,o=t.metrics.maxX){const{theme:r,metrics:l,model:a}=t,{maxDepth:c,shadowBlur:d,shadowColor:u}=r,m=this.getCachedBackgroundColors(s,c),{visibleRowYs:p,visibleRowHeights:g}=l,f=new Map,C=[],w=[],b=(S,E)=>{const v=We(a)?a.depthForRow(S):0,y=m[S%m.length],M=y[Math.min(v,y.length-1)];if(f.has(M)||f.set(M,[]),f.get(M).push(S),E!=null){const F=We(a)?a.depthForRow(E):0;F<v?C.push(S):F>v&&w.push(E)}};for(let S=0;S<n.length;S+=1){const E=n[S],v=S>0?n[S-1]:void 0;b(E,v)}if(f.forEach((S,E)=>{e.fillStyle=E,e.beginPath();for(let v=0;v<S.length;v+=1){const y=S[v],M=L(p,y),F=L(g,y);e.rect(i,M,o,F)}e.fill()}),C.length>0){e.save();const S=this.getCachedColorWithAlpha(u,.15),E=this.getCachedColorWithAlpha(u,0),v=e.createLinearGradient(0,0,0,d);v.addColorStop(0,S),v.addColorStop(1,E),e.fillStyle=v;for(let y=0;y<C.length;y+=1){const M=C[y],F=L(p,M);e.translate(0,F),e.fillRect(i,0,o,d),e.translate(0,-F)}e.restore()}if(w.length>0){e.save();const S=this.getCachedColorWithAlpha(u,0),E=this.getCachedColorWithAlpha(u,.15),v=e.createLinearGradient(0,0,0,d);v.addColorStop(0,S),v.addColorStop(1,E),e.fillStyle=v;for(let y=0;y<w.length;y+=1){const M=w[y],F=L(p,M),x=L(g,M),U=F+x-d;e.translate(0,U),e.fillRect(i,0,o,d),e.translate(0,-U)}e.restore()}}drawMouseColumnHover(e,t){const{mouseX:n,mouseY:s,theme:i,metrics:o}=t;if(n==null||s==null)return;const r=B.getColumnAtX(n,o);if(r==null||i.columnHoverBackgroundColor==null)return;const{visibleColumnWidths:l,visibleColumnXs:a,maxY:c}=o;if(s>c)return;const d=L(a,r),u=L(l,r);e.fillStyle=i.columnHoverBackgroundColor,e.fillRect(d,0,u,c)}drawMouseRowHover(e,t){const{mouseX:n,mouseY:s,theme:i,metrics:o}=t;if(n==null||s==null)return;const{maxX:r}=o;if(n>r||i.rowHoverBackgroundColor==null)return;const l=B.getRowAtY(s,o);l!=null&&this.drawMouseRowHoverForRow(e,t,l)}drawFloatingMouseRowHover(e,t){const{mouseX:n,mouseY:s,theme:i,metrics:o}=t,{maxX:r,floatingTopRowCount:l,floatingBottomRowCount:a,rowCount:c,rowFooterWidth:d}=o;if(n==null||s==null||n>r+d||i.rowHoverBackgroundColor==null)return;const u=B.getRowAtY(s,o);u!=null&&(u<l||c-a<=u)&&this.drawMouseRowHoverForRow(e,t,u)}drawMouseRowHoverForRow(e,t,n){const{metrics:s,selectedRanges:i,theme:o}=t,{visibleRowHeights:r,visibleRowYs:l,maxX:a}=s,c=L(l,n),d=L(r,n);o.rowHoverBackgroundColor!=null&&(e.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&&(e.fillStyle=o.selectedRowHoverBackgroundColor);break}}e.fillRect(0,c,a,d)}drawGridLines(e,t){const{metrics:n,theme:s}=t,{visibleColumns:i,visibleRows:o}=n;this.drawGridLinesForItems(e,t,i,o,s.gridColumnColor,s.gridRowColor)}drawGridLinesForItems(e,t,n,s,i,o){i==null&&o==null||(e.lineWidth=1,e.beginPath(),i!=null&&(e.strokeStyle=i,this.drawGridLinesForColumns(e,t,n)),o!=null&&(e.strokeStyle=o,this.drawGridLinesForRows(e,t,s)),e.stroke())}drawGridLinesForColumns(e,t,n){const{metrics:s}=t,{visibleColumnXs:i,maxY:o}=s;for(let r=0;r<n.length;r+=1){const l=n[r],a=L(i,l)+.5;e.moveTo(a,0),e.lineTo(a,o)}}drawGridLinesForRows(e,t,n){const{metrics:s}=t,{visibleRowYs:i,maxX:o}=s,r=o;for(let l=0;l<n.length;l+=1){const a=n[l],c=L(i,a)+.5;e.moveTo(.5,c),e.lineTo(r-.5,c)}}drawCellBackgrounds(e,t){const{metrics:n}=t,{visibleColumns:s,visibleRows:i}=n;this.drawCellBackgroundsForItems(e,t,s,i)}drawCellBackgroundsForItems(e,t,n,s){e.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(e,t,o,l,a)}}e.restore()}drawCellBackground(e,t,n,s,i){const{metrics:o,model:r,theme:l}=t,{firstColumn:a,modelColumns:c,modelRows:d,visibleColumnXs:u,visibleColumnWidths:m,visibleRowYs:p,visibleRowHeights:g}=o,f=L(d,s),C=L(c,n),w=r.backgroundColorForCell(C,f,l),b=n===a,S=We(r)&&r.hasExpandableRows;if(w!=null){const E=L(u,n)+1,v=L(p,s)+1,y=L(m,n)-1,M=L(g,s)-1;e.fillStyle=w,e.fillRect(E,v,y,M)}b&&S&&this.drawCellRowTreeDepthLines(e,t,s,i)}drawCellContents(e,t){const{metrics:n}=t,{visibleColumns:s}=n;for(let i=0;i<s.length;i+=1){const o=s[i];this.drawColumnCellContents(e,t,o)}}drawColumnCellContents(e,t,n){const{metrics:s}=t,{visibleColumnXs:i,visibleColumnWidths:o,visibleRows:r,height:l}=s,a=L(i,n),c=L(o,n);e.save(),e.beginPath(),e.rect(a,0,c,l),e.clip();for(let d=0;d<r.length;d+=1){const u=r[d];this.drawCellContent(e,t,n,u)}e.restore()}getTextRenderMetrics(e,t,n,s){const{textAlign:i}=e,{metrics:o,model:r,theme:l}=t,{firstColumn:a,visibleColumnXs:c,visibleColumnWidths:d,visibleRowYs:u,visibleRowHeights:m}=o,{cellHorizontalPadding:p,treeDepthIndent:g,treeHorizontalPadding:f}=l,C=L(c,n),w=L(u,s),b=L(d,n),S=L(m,s),E=n===a;let v=0;We(r)&&r.hasExpandableRows&&E&&(v=g*(r.depthForRow(s)+1)+f);const y=b-v;let M=C+p;const F=w+S*.5;return i==="right"?M=C+y-p:i==="center"&&(M=C+y*.5),M+=v,{width:y-p*2,x:M,y:F}}drawCellContent(e,t,n,s,i){var E;const{metrics:o,model:r,theme:l}=t,{firstColumn:a,fontWidths:c,modelColumns:d,modelRows:u,visibleRowHeights:m}=o,{textColor:p}=l,g=L(m,s),f=L(u,s),C=L(d,n),w=i!=null?i:r.textForCell(C,f),b=r.truncationCharForCell(C,f),S=n===a;if(w&&g>0){const v=r.textAlignForCell(C,f)||"left";e.textAlign=v;const y=r.colorForCell(C,f,l)||p;e.fillStyle=y;const{width:M,x:F,y:x}=this.getTextRenderMetrics(e,t,n,s),U=(E=c.get(e.font))!=null?E:gn.DEFAULT_FONT_WIDTH,V=this.getCachedTruncatedString(e,w,M,U,b);V&&e.fillText(V,F,x)}S&&We(r)&&r.hasExpandableRows&&this.drawCellRowTreeMarker(e,t,s)}drawCellRowTreeMarker(e,t,n){const{metrics:s,model:i,mouseX:o,mouseY:r,theme:l}=t,{firstColumn:a,gridX:c,gridY:d,visibleColumnXs:u,visibleColumnWidths:m,visibleRowYs:p,visibleRowHeights:g,visibleRowTreeBoxes:f}=s,{treeMarkerColor:C,treeMarkerHoverColor:w}=l,b=L(u,a),S=L(m,a),E=L(p,n),v=L(g,n);if(!We(i)||!i.isRowExpandable(n))return;const y=L(f,n),M=o!=null&&r!=null&&o>=c+b&&o<=c+b+S&&r>=d+E&&r<=d+E+v?w:C;this.drawTreeMarker(e,t,b,E,y,M,i.isRowExpanded(n))}drawTreeMarker(e,t,n,s,i,o,r){const{x1:l,y1:a,x2:c,y2:d}=i,u=r?"\u229F":"\u229E",m=n+(l+c)*.5+.5,p=s+(a+d)*.5+.5;e.fillStyle=o,e.textAlign="center",e.fillText(u,m,p)}drawCellRowTreeDepthLines(e,t,n,s){const{metrics:i,model:o,theme:r}=t;if(!We(o))return;const l=o.depthForRow(n);if(l===0)return;const{firstColumn:a,visibleColumnXs:c,visibleRowYs:d,visibleRowHeights:u}=i,{treeDepthIndent:m,treeHorizontalPadding:p,treeLineColor:g}=r,f=L(c,a),C=L(d,n),w=L(u,n),b=s!==void 0?o.depthForRow(s):0,S=l>b?l-b:0;if(e.strokeStyle=g,e.lineWidth=1,l-S>0){e.beginPath();for(let E=0;E<l-S;E+=1){const v=f+E*m+m*.5+p+.5;e.moveTo(v,C),e.lineTo(v,C+w)}e.stroke()}if(S>0){e.beginPath();for(let E=l-S;E<l;E+=1){const v=f+E*m+m*.5+p+.5;e.moveTo(v,C),e.lineTo(v,C+Math.ceil(w/2)),e.moveTo(v-.5,C+Math.ceil(w/2)+.5),e.lineTo(v+m-.5,C+Math.ceil(w/2)+.5)}e.stroke()}}drawHeaders(e,t){const{theme:n}=t;e.font=n.headerFont,this.drawColumnHeaders(e,t),this.drawRowHeaders(e,t)}drawFooters(e,t){const{theme:n}=t;e.font=n.headerFont,this.drawRowFooters(e,t)}drawColumnHeaders(e,t){const{mouseX:n,mouseY:s,theme:i,metrics:o,draggingColumnSeparator:r,isDragging:l,model:a}=t,{columnHeaderHeight:c,floatingColumns:d,gridX:u,width:m,visibleColumns:p,visibleColumnWidths:g,visibleColumnXs:f,floatingLeftColumnCount:C,floatingLeftWidth:w,floatingRightWidth:b,modelColumns:S,columnHeaderMaxDepth:E}=o;if(c<=0)return;const{headerHiddenSeparatorSize:v,headerHiddenSeparatorHoverColor:y,headerSeparatorColor:M,headerSeparatorHoverColor:F}=i,x=c*.5,U=c*(E-1)+c*.5-x*.5,V=C>0;if(e.save(),this.drawColumnHeadersForRange(e,t,[p[0],p[p.length-1]],{minX:u+w,maxX:m-b}),V&&this.drawColumnHeadersForRange(e,t,[d[0],d[d.length-1]],{minX:u,maxX:u+w}),M){e.strokeStyle=M;const N=[...g.entries()].filter(([H,k])=>k===0).map(([H])=>H);e.beginPath(),e.fillStyle=M;for(let H=0;H<N.length;H+=1){const k=N[H],z=L(f,k),P=L(g,k),_=u+z+P+.5-v*.5;e.rect(_,U,v,x)}e.fill()}if(F){let{index:N,depth:H}=r!=null?r:{};if(N==null&&n!=null&&s!=null){const z=mo.getColumnSeparator(B.getGridPointFromXY(n,s,o),o,a,i);N=z==null?void 0:z.index,H=z==null?void 0:z.depth}let k;if(N==null)k=!1;else{const z=S.get(N),P=S.get(N+1);z==null||P==null?k=!1:k=a.textForColumnHeader(z,H)!==a.textForColumnHeader(P,H)}if(k&&N!=null&&H!=null&&(!l||r!=null)){e.strokeStyle=F;const z=L(f,N),P=L(g,N),_=u+z+P+.5,$=p.indexOf(N),X=$<p.length-1?p[$+1]:null,ee=X!=null?g.get(X):null,ae=P===0,fe=ee!=null&&ee===0;ae?(e.strokeStyle=y,e.fillStyle=y,e.fillRect(_,U,v*.5,x)):fe&&(e.fillStyle=F,e.fillRect(_-v*.5,U,v*.5,x)),e.beginPath(),e.moveTo(_,(E-H-1)*c),e.lineTo(_,(E-H)*c-1),e.stroke()}}e.restore()}drawColumnHeadersForRange(e,t,n,s){const{model:i}=t,{columnHeaderMaxDepth:o}=i;if(o!==0)for(let r=0;r<=o;r+=1)this.drawColumnHeadersAtDepth(e,t,n,s,r)}drawColumnHeadersAtDepth(e,t,n,s,i){var M,F,x,U,V,N;const{metrics:o,model:r,theme:l}=t,{modelColumns:a,visibleColumnXs:c,gridX:d,calculatedColumnWidths:u,userColumnWidths:m,visibleColumnWidths:p,movedColumns:g}=o,{columnHeaderHeight:f,columnWidth:C}=l,{columnHeaderMaxDepth:w}=r,{minX:b,maxX:S}=s,E=S-b;if(w===0)return;const v=n[0],y=n[1];if(e.save(),e.translate(0,(w-i-1)*f),i===0){this.drawColumnHeader(e,t,"",b,S);for(let H=v;H<=y;H+=1)this.drawColumnHeaderAtIndex(e,t,H,s)}if(i>0){let H=v;for(;H<=y;){const{columnCount:k}=o,z=L(a,H),P=r.textForColumnHeader(z,i),_=r.colorForColumnHeader(z,i);let $=L(c,H)+d,X=$+L(p,H);if(P!=null){let ee=H-1;for(;ee>=0&&(X-$<E||$>b);){const de=(M=a.get(ee))!=null?M:B.getModelIndex(ee,g);if(de==null||r.textForColumnHeader(de,i)!==P)break;$-=(x=(F=m.get(de))!=null?F:u.get(de))!=null?x:C,ee-=1}let ae=H+1;for(;ae<k&&(X-$<E||X<S);){const de=(U=a.get(ae))!=null?U:B.getModelIndex(ae,g);if(r.textForColumnHeader(de,i)!==P)break;X+=(N=(V=m.get(de))!=null?V:u.get(de))!=null?N:C,ae+=1}H=ae-1;const fe=X-$>=E;let Ce=$;fe&&(X<S?Ce=X-E:$<b&&(Ce=b)),this.drawColumnHeader(e,t,P,Ce,Math.min(X-$,E),{backgroundColor:_!=null?_:void 0},s)}H+=1}}e.restore()}drawColumnHeaderAtIndex(e,t,n,s){var g;const{metrics:i,model:o}=t,{modelColumns:r,visibleColumnWidths:l,visibleColumnXs:a,gridX:c}=i,d=L(l,n),u=L(a,n)+c,m=L(r,n),p=o.textForColumnHeader(m);p!=null&&this.drawColumnHeader(e,t,p,u,d,{backgroundColor:(g=o.colorForColumnHeader(m))!=null?g:void 0},s)}drawColumnHeader(e,t,n,s,i,o,r){var ae;if(i<=0)return;const{metrics:l,theme:a}=t,{headerHorizontalPadding:c,columnHeaderHeight:d,headerBackgroundColor:u,headerColor:m,headerSeparatorColor:p,black:g,white:f}=a,{fontWidths:C,width:w}=l,b=(ae=C.get(e.font))!=null?ae:gn.DEFAULT_FONT_WIDTH,E=(i-c*2)/b,{backgroundColor:v=u,separatorColor:y=p}=o!=null?o:{};let{textColor:M=m}=o!=null?o:{};try{const fe=this.getCachedColorIsDark(v),Ce=this.getCachedColorIsDark(M);fe&&Ce?M=f:!fe&&!Ce&&(M=g)}catch{}let{minX:F=0,maxX:x=w}=r!=null?r:{};e.save(),e.rect(F,0,x-F,d),e.clip(),v!=null&&(e.fillStyle=v,e.fillRect(s,0,i,d)),y!=null&&(e.strokeStyle=y,e.beginPath(),s>0&&(e.moveTo(s+.5,0),e.lineTo(s+.5,d)),e.moveTo(s+i+.5,0),e.lineTo(s+i+.5,d),e.moveTo(s,d-.5),e.lineTo(s+i,d-.5),e.stroke()),e.beginPath(),e.rect(s,0,i,d),e.clip(),e.fillStyle=M;let U=n;E<=0?U="":U.length>E&&(U=`${U.substring(0,E-1)}\u2026`);const V=U.length*b;let N=s+i*.5;const H=d*.5;F+=c,x-=c;const k=s+c,z=Ue(k,F,x),P=s+i-c,$=Ue(P,F,x)-z,X=N-V*.5<F,ee=N+V*.5>x;X?V<$?N=F+V*.5:N=P-V*.5:ee&&(V<$?N=x-V*.5:N=k+V*.5),e.textAlign="center",e.fillText(U,N,H),e.restore()}drawRowHeaders(e,t){const{mouseX:n,mouseY:s,metrics:i,theme:o,draggingRowSeparator:r}=t,{gridY:l,rowHeaderWidth:a,height:c,visibleRows:d,visibleRowHeights:u,visibleRowYs:m}=i;if(a<=0)return;const{headerBackgroundColor:p,headerColor:g,headerHiddenSeparatorSize:f,headerHiddenSeparatorHoverColor:C,headerSeparatorColor:w,headerSeparatorHoverColor:b}=o,S=a*.5,E=a*.5-S*.5;if(e.save(),e.beginPath(),e.fillStyle=p,e.fillRect(0,0,a,c),w){e.strokeStyle=w,e.beginPath(),e.moveTo(0,l+.5),e.lineTo(a,l+.5);const v=[];let y=!1;for(let M=0;M<d.length;M+=1){const F=d[M],x=L(m,F),U=L(u,F);if(U>0){const V=l+x+U+.5;e.moveTo(0,V),e.lineTo(a,V),y=!1}else y||(y=!0,v.push(F))}e.moveTo(a-.5,0),e.lineTo(a-.5,c),e.stroke(),e.beginPath(),e.fillStyle=w;for(let M=0;M<v.length;M+=1){const F=v[M],x=L(m,F),U=L(u,F),V=l+x+U+.5-f*.5;e.rect(E,V,S,f)}e.fill()}if(b){let{index:v=null}=r!=null?r:{};if(v==null&&n!=null&&s!=null&&(v=B.getRowSeparatorIndex(n,s,i,o)),v!=null){e.strokeStyle=b;const y=L(m,v),M=L(u,v),F=l+y+M+.5,x=d.indexOf(v),U=x<d.length-1?d[x+1]:null,V=U!=null?u.get(U):null,N=M===0,H=V!=null&&V===0;N?(e.strokeStyle=C,e.fillStyle=C,e.fillRect(E,F,S,f*.5)):H&&(e.fillStyle=b,e.fillRect(E,F-f*.5,S,f*.5)),e.beginPath(),e.moveTo(.5,F),e.lineTo(a+.5,F),e.stroke()}}e.beginPath(),e.rect(0,l,a,c),e.clip(),e.fillStyle=g,e.textAlign="right";for(let v=0;v<d.length;v+=1){const y=d[v],M=L(u,y),F=L(m,y)+l;this.drawRowHeader(e,t,y,F,M)}e.restore()}drawRowHeader(e,t,n,s,i){if(i<=0)return;const{metrics:o,model:r,theme:l}=t,{modelRows:a,rowHeaderWidth:c}=o,d=L(a,n),u=c-l.cellHorizontalPadding,m=s+i*.5;e.fillText(r.textForRowHeader(d),u,m)}drawRowFooters(e,t){const{mouseX:n,mouseY:s,metrics:i,model:o,theme:r,draggingRowSeparator:l}=t,{gridY:a,gridX:c,maxX:d,modelRows:u,rowFooterWidth:m,height:p,verticalBarWidth:g,visibleRows:f,visibleRowHeights:C,visibleRowYs:w,width:b}=i;if(m<=0)return;const{cellHorizontalPadding:S,headerBackgroundColor:E,headerColor:v,headerHiddenSeparatorSize:y,headerHiddenSeparatorHoverColor:M,headerSeparatorColor:F,headerSeparatorHoverColor:x}=r,U=m*.5,V=m*.5-U*.5,N=Math.min(c+d,b-m-g);if(e.save(),e.beginPath(),e.fillStyle=E,e.fillRect(N,a,m,p),F){e.strokeStyle=F,e.beginPath(),e.moveTo(N,a+.5),e.lineTo(m,a+.5);const k=[];let z=!1;for(let P=0;P<f.length;P+=1){const _=f[P],$=L(w,_),X=L(C,_);if(X>0){const ee=a+$+X+.5;e.moveTo(N+.5,ee),e.lineTo(N+m-.5,ee),z=!1}else z||(z=!0,k.push(_))}e.moveTo(N+.5,a),e.lineTo(N+.5,p),e.stroke(),e.beginPath(),e.fillStyle=F;for(let P=0;P<k.length;P+=1){const _=k[P],$=L(w,_),X=L(C,_),ee=a+$+X+.5-y*.5;e.rect(N+V,ee,U,y)}e.fill()}if(x){let{index:k=null}=l!=null?l:{};if(k==null&&n!=null&&s!=null&&(k=B.getRowSeparatorIndex(n,s,i,r)),k!=null){e.strokeStyle=x;const z=L(w,k),P=L(C,k),_=a+z+P+.5,$=f.indexOf(k),X=$<f.length-1?f[$+1]:null,ee=X!=null?C.get(X):null,ae=P===0,fe=ee!=null&&ee===0;ae?(e.strokeStyle=M,e.fillStyle=M,e.fillRect(V,_,U,y*.5)):fe&&(e.fillStyle=x,e.fillRect(V,_-y*.5,U,y*.5)),e.beginPath(),e.moveTo(N+.5,_),e.lineTo(N+m+.5,_),e.stroke()}}e.beginPath(),e.rect(N,a,m,p),e.clip(),e.fillStyle=v,e.textAlign="left";const H=N+S;for(let k=0;k<f.length;k+=1){const z=f[k],P=L(C,z);if(P>0){const _=L(w,z)+a,$=L(u,z),X=_+P*.5;e.fillText(o.textForRowFooter($),H,X)}}e.restore()}drawSelectedRanges(e,t,n={}){const{cursorColumn:s,cursorRow:i,draggingRow:o,draggingColumn:r,editingCell:l,metrics:a,model:c,selectedRanges:d,theme:u}=t,{visibleColumnWidths:m,visibleColumnXs:p,visibleRowHeights:g,visibleRowYs:f,width:C,height:w}=a,{left:b=a.left,top:S=a.top,right:E=a.right,bottom:v=a.bottom,minY:y=-10,maxY:M=w+10,minX:F=-10,maxX:x=C+10}=n;if(d.length===0)return;const U=Oe(c)&&c.isEditable&&l==null&&o==null&&r==null&&s!=null&&i!=null&&p.has(s)&&f.has(i);if(U){const V=L(p,s),N=L(f,i),H=L(m,s),k=L(g,i);e.save(),e.beginPath(),e.rect(0,0,C,w),e.rect(V,N,H,k),e.clip("evenodd")}e.beginPath();for(let V=0;V<d.length;V+=1){const N=d[V],H=N.startColumn!==null?N.startColumn:b,k=N.startRow!==null?N.startRow:S,z=N.endColumn!==null?N.endColumn:E,P=N.endRow!==null?N.endRow:v;if(P>=S&&v>=k&&z>=b&&E>=H){const _=H>=b&&p.has(H)?Math.round(L(p,H))+.5:F,$=k>=S&&f.has(k)?Math.max(Math.round(L(f,k))+.5,.5):y,X=z<=E&&p.has(z)?Math.round(L(p,z)+L(m,z))-.5:x,ee=P<=v&&f.has(P)?Math.round(L(f,P)+L(g,P))-.5:M;e.rect(_,$,X-_,ee-$)}e.fillStyle=u.selectionColor,e.fill(),e.save(),e.clip(),e.strokeStyle=u.selectionOutlineCasingColor,e.lineWidth=3,e.stroke(),e.restore(),e.strokeStyle=u.selectionOutlineColor,e.lineWidth=1,e.stroke()}U&&s!=null&&i!=null&&(e.restore(),this.drawActiveCell(e,t,s,i))}drawActiveCell(e,t,n,s,i=gn.ACTIVE_CELL_BORDER_WIDTH){const{metrics:o,theme:r}=t,{visibleColumnWidths:l,visibleColumnXs:a,visibleRowHeights:c,visibleRowYs:d}=o,u=L(a,n),m=L(d,s),p=L(l,n),g=L(c,s);let f=u-i*.5,C=m-i*.5,w=p+i,b=g+i;f<=0&&(w+=f-1,f=1),C<=0&&(b+=C-1,C=1);const{lineWidth:S}=e;e.beginPath(),e.lineWidth=i,e.strokeStyle=r.selectionOutlineColor,this.drawRoundedRect(e,f,C,w,b),e.stroke(),e.lineWidth=S}drawRoundedRect(e,t,n,s,i,o=gn.DEFAULT_EDGE_RADIUS){e.beginPath(),e.moveTo(t+o,n),e.lineTo(t+s-o,n),e.quadraticCurveTo(t+s,n,t+s,n+o),e.lineTo(t+s,n+i-o),e.quadraticCurveTo(t+s,n+i,t+s-o,n+i),e.lineTo(t+o,n+i),e.quadraticCurveTo(t,n+i,t,n+i-o),e.lineTo(t,n+o),e.quadraticCurveTo(t,n,t+o,n),e.closePath()}drawDraggingColumn(e,t){var ee;const{draggingColumn:n,metrics:s,mouseX:i,theme:o,model:r}=t;if(n==null||i==null)return;const{range:l,depth:a}=n,{gridX:c,gridY:d,visibleColumnXs:u,visibleColumnWidths:m,height:p,width:g,columnHeaderMaxDepth:f,columnHeaderHeight:C,movedColumns:w,modelColumns:b,floatingLeftWidth:S}=s,E=(ee=b.get(l[0]))!=null?ee:B.getModelIndex(l[0],w),v=r.getColumnHeaderGroup(E,a);if(a>0&&!v)return;const[y,M]=l,F=L(u,y),U=L(u,M)+L(m,M)-F,V=n.left,{backgroundColor:N,font:H,headerFont:k,reorderOffset:z,shadowBlur:P,shadowColor:_}=o,$=(f-a-1)*C;e.save(),e.translate(c,0),e.save(),e.beginPath(),e.rect(S,0,g,p),e.clip(),e.fillStyle=N,e.fillRect(F,$,U,p),e.restore(),e.translate(0,z),e.save(),e.shadowColor=_,e.shadowBlur=P,e.fillStyle=N,e.fillRect(n.left,$+z,n.width,p),e.restore(),e.beginPath(),e.rect(n.left,$,n.width+1,p),e.clip(),e.translate(V-F,0),e.font=k;const X=[];for(let ae=n.range[0];ae<=n.range[1];ae+=1)X.push(ae);this.drawColumnHeaders(e,t),this.drawColumnHeadersForRange(e,t,[X[0],X[X.length-1]],{minX:F,maxX:g}),e.translate(0,d),e.font=H,this.drawGridBackground(e,t);for(let ae=y;ae<=M;ae+=1)this.drawColumnCellContents(e,t,ae);e.restore()}drawDraggingRow(e,t){const{draggingRow:n,draggingRowOffset:s,metrics:i,mouseY:o,theme:r}=t;if(n==null||o==null)return;const{gridX:l,gridY:a,visibleRowYs:c,visibleRowHeights:d,width:u}=i,m=L(c,n),p=L(d,n)+1,{backgroundColor:g,font:f,headerFont:C,reorderOffset:w,shadowBlur:b,shadowColor:S}=r;e.save(),e.translate(0,a),e.fillStyle=g,e.fillRect(0,m,u,p),e.translate(l+w,o-m-a-(s!=null?s:0)),e.save(),e.shadowColor=S,e.shadowBlur=b,e.fillStyle=g,e.fillRect(-l,m,u,p),e.restore(),e.beginPath(),e.rect(-l,m,u,p),e.clip(),e.font=f,this.drawGridBackground(e,t),this.drawCellContents(e,t),e.translate(-l,-a),e.font=C,this.drawRowHeaders(e,t),e.restore()}drawScrollBars(e,t){const{isDraggingHorizontalScrollBar:n,isDraggingVerticalScrollBar:s,isDragging:i,metrics:o,mouseX:r,mouseY:l,theme:a}=t;if(a.scrollBarSize<=0)return;const{rowHeaderWidth:c,columnHeaderHeight:d,width:u,height:m,handleHeight:p,handleWidth:g,scrollX:f,scrollY:C,hasHorizontalBar:w,hasVerticalBar:b,barWidth:S,barHeight:E}=o,{scrollBarBackgroundColor:v,scrollBarHoverBackgroundColor:y,scrollBarCasingColor:M,scrollBarCornerColor:F,scrollBarColor:x,scrollBarHoverColor:U,scrollBarActiveColor:V,scrollBarSize:N,scrollBarHoverSize:H,scrollBarCasingWidth:k,scrollBarSelectionTick:z,scrollBarSelectionTickColor:P,scrollBarActiveSelectionTickColor:_,autoSelectRow:$,autoSelectColumn:X}=a,ee=r!=null&&l!=null&&r<=u&&l<=m,ae=s||b&&!n&&!i&&r!=null&&l!=null&&r>=u-H&&l<=E+d&&ee,fe=n||w&&!s&&!i&&!ae&&r!=null&&l!=null&&l>=m-H&&r<=S-c&&ee,Ce=fe?H:N,de=ae?H:N;if(e.translate(c,d),w&&b&&(e.fillStyle=M,e.fillRect(u-c-N,m-d-N,N,N),e.fillStyle=F,e.fillRect(u-c-N+k,m-d-N+k,N-k,N-k)),w){const ye=f,Xe=m-d-Ce;if(e.fillStyle=M,e.fillRect(0,Xe,S,Ce-k),e.fillStyle=fe?y:v,e.fillRect(0,Xe+k,S,Ce-k),n?e.fillStyle=V:fe?e.fillStyle=U:e.fillStyle=x,e.fillRect(ye,Xe+k,g,Ce-k),!$&&z&&P!=null&&_!=null){e.fillStyle=P;const{selectedRanges:yt,cursorColumn:Ye}=t,{lastLeft:et,columnCount:_t}=o,He=[...yt].filter(ge=>ge.startColumn!=null&&ge.endColumn!=null).map(ge=>[ge.startColumn,ge.endColumn]).sort(B.compareRanges),on=B.mergeSortedRanges(He),pt=ge=>ge<=et?ge/et*(S-g):S-g+(ge-et)/(_t-et)*g;for(let ge=0;ge<on.length;ge+=1){const $e=on[ge],Ge=$e[0],Nt=$e[1];if(Ge!=null&&Nt!=null&&(Ge!==Ye||Nt!==Ye)){const rn=pt(Ge),Rn=Math.max(1,Math.round(pt(Nt+1)-rn)),Vt=Ce-k;e.fillRect(rn,Xe+k+Math.round(Vt/3),Rn,Math.round(Vt/3))}}if(Ye!=null){const ge=pt(Ye),$e=2,Ge=Ce-k;e.fillStyle=_,e.fillRect(ge,Xe+k,$e,Ge)}}}if(b){const ye=u-c-de,Xe=C;if(e.fillStyle=M,e.fillRect(ye,0,de-k,E),e.fillStyle=ae?y:v,e.fillRect(ye+k,0,de-k,E),s?e.fillStyle=V:ae?e.fillStyle=U:e.fillStyle=x,e.fillRect(ye+k,Xe,de-k,p),!X&&z&&P!=null&&_!=null){const{selectedRanges:yt,cursorRow:Ye}=t,{lastTop:et,rowCount:_t}=o,Rt=ge=>ge<=et?ge/et*(E-p):E-p+(ge-et)/(_t-et)*p;e.fillStyle=P;const on=[...yt].filter(ge=>ge.startRow!=null&&ge.endRow!=null).map(ge=>[ge.startRow,ge.endRow]).sort(B.compareRanges),pt=B.mergeSortedRanges(on);for(let ge=0;ge<pt.length;ge+=1){const $e=pt[ge],Ge=$e[0],Nt=$e[1];if(Ge!=null&&Nt!=null&&(Ge!==Ye||Nt!==Ye)){const rn=Rt(Ge),Rn=de-k,Vt=Math.max(1,Math.round(Rt(Nt+1)-rn));e.fillRect(ye+k+Math.round(Rn/3),rn,Math.round(Rn/3),Vt)}}if(Ye!=null){const ge=Math.round(Rt(Ye)),$e=de-k,Ge=2;e.fillStyle=_,e.fillRect(ye+k,ge,$e,Ge)}}}e.translate(-c,-d)}};let Ls=gn;Ls.DEFAULT_FONT_WIDTH=10;Ls.DEFAULT_EDGE_RADIUS=2;Ls.ACTIVE_CELL_BORDER_WIDTH=2;const wl=100;class fh extends Je{constructor(){super(...arguments),this.hasExtendedFloating=!1}onDown(t,n,s){const{x:i,y:o,column:r,row:l}=t,{metrics:a}=n;if(!a)throw new Error("metrics not set");const{gridX:c,gridY:d,maxX:u,maxY:m}=a,p=i-c,g=o-d;if(p<0||g<0||r==null&&p>u||l==null&&g>m)return!1;const f=B.isModifierKeyDown(s),C=s.shiftKey;f||(C?n.trimSelectedRanges():n.clearSelectedRanges());const w=n.getTheme(),{autoSelectRow:b,autoSelectColumn:S}=w;return(r!==null||!S)&&(l!==null||!b)&&(n.focus(),n.moveCursorToPosition(r,l,C,!1,C&&f)),this.startPoint=t,this.hasExtendedFloating=!1,this.dragBounds=B.getScrollDragBounds(a,l,r),!0}onDrag(t,n){if(this.startPoint===void 0)return!1;this.stopTimer();const{row:s,column:i}=this.startPoint,{x:o,y:r}=t;let{row:l,column:a}=t;const{metrics:c}=n;if(!c)throw new Error("metrics not set");const{left:d,lastLeft:u,top:m,lastTop:p,columnWidth:g,rowHeight:f}=c,C=B.getScrollDragBounds(c,s,i);let w=0,b=0;if(d<u&&(o<C.x1?w=o-C.x1:o>C.x2&&(w=o-C.x2)),m<p&&(r<C.y1?b=r-C.y1:r>C.y2&&(b=r-C.y2)),w!==0||b!==0)this.startTimer(n,t,w>0?Math.ceil(w/g):Math.floor(w/g),b>0?Math.ceil(b/f):Math.floor(b/f));else if(l!=null&&a!=null){const{floatingTopRowCount:S,floatingBottomRowCount:E,floatingLeftColumnCount:v,floatingRightColumnCount:y,columnCount:M,rowCount:F,bottom:x,right:U,topVisible:V,bottomVisible:N,leftVisible:H,rightVisible:k}=c;this.hasExtendedFloating||(s!==null&&s<S&&l>=S?(l=S,this.hasExtendedFloating=!0):s!==null&&s>=F-E&&l<F-E&&(l=F-E-1,this.hasExtendedFloating=!0),i!==null&&i<v&&a>=v?(a=v,this.hasExtendedFloating=!0):i!==null&&i>=M-y&&a<M-y&&(a=M-y-1,this.hasExtendedFloating=!0)),s!==null&&!B.isFloatingRow(s,c)&&B.isFloatingRow(l,c)&&(s>l&&l<m?l=V-1:s<l&&l>x&&(l=N+1)),i!==null&&!B.isFloatingColumn(i,c)&&B.isFloatingColumn(a,c)&&(i>a&&a<d?a=H-1:i<a&&a>U&&(a=k+1)),n.moveCursorToPosition(a,l,!0,!0)}return!0}onUp(t,n){return this.startPoint!==void 0&&(this.startPoint=void 0,this.dragBounds=void 0,this.stopTimer(),n.commitSelection()),!1}moveSelection(t,n,s,i){const{row:o,column:r}=n,{metrics:l}=t;if(!l)throw new Error("metrics not set");const{selectionEndRow:a,selectionEndColumn:c}=t.state;if(a==null||c==null)throw new Error("selection not set");const{rowCount:d,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:d-1;t.moveCursorToPosition(Math.min(Math.max(m,c+s),p),Math.min(Math.max(g,a+i),f),!0),this.lastTriggerTime=Date.now()}startTimer(t,n,s,i){this.stopTimer();const o=this.lastTriggerTime!=null?wl-Math.min(wl,Date.now()-this.lastTriggerTime):0;this.timer=setTimeout(()=>{this.moveSelection(t,n,s,i),this.startTimer(t,n,s,i)},o)}stopTimer(){this.timer!==void 0&&(clearTimeout(this.timer),this.timer=void 0)}}const bl=5,Ch=1e3/60,Li=10;function Nn(e,t,n,s){var S,E,v,y,M,F,x;const{modelColumns:i,movedColumns:o,visibleColumnXs:r,columnCount:l,visibleColumnWidths:a,userColumnWidths:c,calculatedColumnWidths:d,floatingLeftWidth:u,maxX:m}=n;if(t==null||e==null||e>l||e<0)return null;const p=(S=i.get(e))!=null?S:B.getModelIndex(e,o),g=s.getColumnHeaderGroup(p,t),f=g!=null;let C,w,b;if(g!=null){const[U,V]=g.getVisibleRange(o);C=(E=r.get(U))!=null?E:u,w=((v=r.get(V))!=null?v:m)+((y=a.get(V))!=null?y:0),b=[U,V]}else{const U=r.get(e);if(U==null)return null;C=U,w=C+((x=(F=(M=a.get(e))!=null?M:c.get(p))!=null?F:d.get(p))!=null?x:0),b=[e,e]}return{visibleIndex:e,modelIndex:p,left:C,right:w,width:w-C,isColumnGroup:f,range:b,depth:t}}class wh extends Je{constructor(){super(...arguments),this.cursor=null,this.draggingColumn=null}setScrollInterval(t,n){this.scrollingInterval!=null&&n===this.scrollingDirection||(this.scrollingDirection=n,this.scrollingInterval=window.setInterval(()=>{var f,C;const{metrics:s}=t;if(!s)return;const{left:i,lastLeft:o,leftOffset:r,userColumnWidths:l,calculatedColumnWidths:a,movedColumns:c,visibleColumnWidths:d}=s;let u=i,m=r;if(n==="left")for(m-=Li;m<0;){u-=1;const w=B.getModelIndex(i-1,c),b=(f=l.get(w))!=null?f:a.get(w);b===void 0?m=0:m+=b,u<0&&(m=0,u=0)}else{m+=Li;let w=d.get(i);for(;w!==void 0&&m>w;){u+=1,m-=w;const b=B.getModelIndex(i+1,c);w=(C=l.get(b))!=null?C:a.get(b),u>o&&(m=0,u=o)}}const{mouseX:p,mouseY:g}=t.state;s==null||p==null||g==null||(this.moveDraggingColumn(p,t,n==="left"?-Li:Li),t.setState({left:u,leftOffset:m}),(n==="left"&&u===0&&r===0||n==="right"&&u===o)&&this.clearScrollInterval())},Ch))}clearScrollInterval(){this.scrollingDirection=void 0,window.clearInterval(this.scrollingInterval),this.scrollingInterval=void 0}onLeave(){return this.clearScrollInterval(),!1}onDown(t,n){const{model:s}=n.props,{x:i,column:o,columnHeaderDepth:r}=t,{metrics:l}=n;if(!l)throw new Error("Metrics not set");const a=Nn(o,r,l,s);if(o==null||a==null||r==null||r>0&&!a.isColumnGroup)return!1;const{rowHeaderWidth:c}=l;return this.initialGridPoint=t,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(t,n,s){if(this.draggingOffset===void 0||this.initialGridPoint===void 0||this.initialOffset===void 0)return!1;const{x:i,y:o}=t,{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)<bl&&Math.abs(this.initialGridPoint.y-o)<bl)return!1;if(a==null){const d=Nn(this.initialGridPoint.column,r,c,l);if(!d||r==null||!l.isColumnMovable(d.modelIndex)||r>0&&!d.isColumnGroup||d.range[0]==null)return!1;a={range:d.range,depth:r,left:d.left,width:d.width};const u=Nn(a.range[0],0,c,l),m=Nn(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(t.x,n,s.movementX),!0}moveDraggingColumn(t,n,s){var M,F,x,U,V;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:t-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:d,visibleColumnXs:u}=l,m=s<0,p=Nn(this.draggingColumn.range[0],i,l,o);if(!p)return;const g=t-this.draggingOffset,f=g+p.width;this.draggingColumn={...this.draggingColumn,left:g},n.setState({draggingColumn:this.draggingColumn});const C=Nn(B.getColumnAtX(Ue(m?g:f,a,c),l,!0),i,l,o),w=o.getColumnHeaderParentGroup(p.modelIndex,p.depth);if(!C)return;if(w!==void 0){const N=w.getVisibleRange(r);if(C.visibleIndex<N[0]){const H=this.moveColumn(p,N[0],r);this.draggingOffset=t-((M=u.get(N[0]))!=null?M:0),this.draggingColumn={...this.draggingColumn,left:t-this.draggingOffset},this.clearScrollInterval(),n.setState({draggingColumn:this.draggingColumn,movedColumns:H});return}if(C.visibleIndex>N[1]){const H=this.moveColumn(p,N[1]-(p.range[1]-p.range[0]),r),{right:k=0}=(F=Nn(N[1],0,l,o))!=null?F:{};this.draggingOffset=t-(k-p.width),this.draggingColumn={...this.draggingColumn,left:t-this.draggingOffset},this.clearScrollInterval(),n.setState({draggingColumn:this.draggingColumn,movedColumns:H});return}}if(!o.isColumnMovable(C.modelIndex)){let N=C.visibleIndex;if(m)for(N+=1;N<p.visibleIndex&&!o.isColumnMovable(B.getModelIndex(N,r));)N+=1;else for(N-=1;N>p.visibleIndex&&!o.isColumnMovable(B.getModelIndex(N,r));)N-=1;if(N!==p.visibleIndex){m||(N-=p.range[1]-p.range[0]);const k=this.moveColumn(p,N,r);n.setState({movedColumns:k,draggingColumn:this.draggingColumn})}const H=Nn(N,0,l,o);m?this.draggingOffset=t-((x=H==null?void 0:H.left)!=null?x:0):this.draggingOffset=t-(((U=H==null?void 0:H.right)!=null?U:0)-p.width),this.draggingColumn={...this.draggingColumn,left:t-this.draggingOffset},n.setState({draggingColumn:this.draggingColumn});return}if(g<=a?this.setScrollInterval(n,"left"):f>c?this.setScrollInterval(n,"right"):this.clearScrollInterval(),C.visibleIndex===p.visibleIndex||m&&p.visibleIndex<C.visibleIndex||!m&&p.visibleIndex>C.visibleIndex)return;const b=C.left+C.width*.5,S=o.getColumnHeaderParentGroup(p.modelIndex,p.depth);let E,v=((V=S==null?void 0:S.depth)!=null?V:d)-1;for(;v>=0&&E===void 0;)E=o.getColumnHeaderGroup(C.modelIndex,v),v-=1;let y;m&&g<b&&(!E||C.visibleIndex===E.getVisibleRange(r)[0])&&(y=this.moveColumn(p,C.range[0],r)),!m&&f>b&&(!E||C.visibleIndex===E.getVisibleRange(r)[1])&&(y=this.moveColumn(p,C.range[1]-(p.range[1]-p.range[0]),r)),y&&(this.draggingColumn={...this.draggingColumn,left:g},n.setState({movedColumns:y,draggingColumn:this.draggingColumn}))}moveColumn(t,n,s){const i=t.isColumnGroup?B.moveRange(t.range,n,s):B.moveItem(t.visibleIndex,n,s),o=n-t.range[0],r=[t.range[0]+o,t.range[1]+o];return this.draggingColumn&&(this.draggingColumn={...this.draggingColumn,range:r}),i}onUp(t,n){return this.cursor=null,this.clearScrollInterval(),this.draggingOffset!=null?(this.draggingOffset=void 0,n.setState({draggingColumn:null,isDragging:!1}),!0):!1}}class Er extends Je{constructor(){super(...arguments),this.cursor="default"}static getLeftWithOffsetFromRawLeft(t,n){const s=t.getTheme(),{metrics:i,metricCalculator:o}=t;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 d=t.getMetricState();a=o.getVisibleColumnWidth(r,d)}const c=a*l;return{left:r,leftOffset:c}}isInScrollBar(t,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}=t,{barLeft:c,barWidth:d,height:u,hasHorizontalBar:m}=r;return m&&i>0&&a>=u-o&&a<u&&l>c&&l<c+d}getLeftWithOffset(t,n){var f;const{metrics:s}=n;if(!s)throw new Error("metrics not set");const{x:i}=t,{barWidth:o,handleWidth:r,lastLeft:l,barLeft:a,columnCount:c,scrollableContentWidth:d,scrollableViewportWidth:u}=s,m=i-a,p=Ue((m-((f=this.dragOffset)!=null?f:0))/(o-r),0,1);if(c===1)return{left:0,leftOffset:p*(d-u)};const g=p*l;return Er.getLeftWithOffsetFromRawLeft(n,g)}onDown(t,n){const{metrics:s}=n;if(!s)throw new Error("metrics not set");const{x:i}=t,{handleWidth:o,barLeft:r,scrollX:l}=s;if(!this.isInScrollBar(t,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:d}=this.getLeftWithOffset(t,n);n.setViewState({left:c,leftOffset:d,isDraggingHorizontalScrollBar:!0,isDragging:!0})}return!0}onDrag(t,n){if(this.dragOffset!=null){const{left:s,leftOffset:i}=this.getLeftWithOffset(t,n);return n.setViewState({left:s,leftOffset:i,isDraggingHorizontalScrollBar:!0,isDragging:!0}),!0}return!1}onMove(t,n){return this.isInScrollBar(t,n)}onUp(t,n){return this.dragOffset!==void 0&&(this.dragOffset=void 0,n.setState({isDraggingHorizontalScrollBar:!1,isDragging:!1})),this.isInScrollBar(t,n)}onClick(t,n){return this.isInScrollBar(t,n)}}class bh extends Je{constructor(){super(...arguments),this.cursor="move"}onDown(t,n){const{model:s}=n.props,{x:i,y:o,row:r}=t,{metrics:l}=n;if(!l)throw new Error("metrics not set");const{columnHeaderHeight:a,rowHeaderWidth:c,visibleRowYs:d}=l;if(i<=c&&r!==null&&s.isRowMovable(r)){const u=L(d,r);this.draggingOffset=o-u-a,n.setState({draggingRowOffset:this.draggingOffset})}return!1}onDrag(t,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:y}=n.getGridPointFromXY(o,r);if(y!=null&&!s.isRowMovable(y)||(i=y,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:d,bottomVisible:u,rowCount:m,columnHeaderHeight:p,visibleRowHeights:g,visibleRowYs:f,height:C}=l;let w=p;if(a<i){const y=i-1;w=L(f,y)+L(g,y)*.5+p}let b=C;if(i<d){const y=i+1;b=L(f,y)+L(g,y)*.5+p}let{movedRows:S}=n.state;r<w&&i>0&&s.isRowMovable(i-1)?(S=B.moveItem(i,i-1,S),i-=1):b<r&&i<m-1&&s.isRowMovable(i+1)&&(S=B.moveItem(i,i+1,S),i+=1),n.setState({movedRows:S,draggingRow:i});const E=p+L(g,a)*.5,v=p+L(f,u)+L(g,u)*.5;return r<E&&a>0?n.setState({top:a-1}):r>v&&a<c&&n.setState({top:a+1}),!0}onUp(t,n){return this.draggingOffset!==void 0?(this.draggingOffset=void 0,n.setState({draggingRowOffset:null,draggingRow:null,isDragging:!1}),!0):!1}}class yr extends Fa{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=B.getHiddenRows,this.getNextShownItem=B.getNextShownRow,this.getSeparator=yr.getRowSeparator}static getRowSeparator(t,n,s,i){if(!i.allowRowResize)return null;const{x:o,y:r}=t,l=B.getRowSeparatorIndex(o,r,n,i);return l!=null?{index:l,depth:0}:null}setSize(t,n,s){t.setRowHeight(n,s)}resetSize(t,n){t.resetRowHeight(n)}updateSeparator(t,n){t.setState({draggingRowSeparator:n,isDragging:n!==null})}}class Yi extends Je{static isInTreeBox(t,n){const{column:s,row:i,x:o,y:r}=t,{metrics:l}=n;if(!l)throw new Error("metrics not set");const{gridX:a,gridY:c,firstColumn:d,visibleColumnXs:u,visibleColumnWidths:m,visibleRowHeights:p,visibleRowYs:g,visibleRowTreeBoxes:f}=l;if(s===d&&i!=null&&f.get(i)!=null&&o>a&&r>c){const C=L(u,s),w=L(m,s),b=L(g,i),S=L(p,i);if(o>=a+C&&o<=a+C+w&&r>=c+b&&r<=c+b+S)return!0}return!1}onDown(t,n){return Yi.isInTreeBox(t,n)}onClick(t,n){if(Yi.isInTreeBox(t,n)){const{row:s}=t;if(s!==null)return n.toggleRowExpanded(s),!0}return!1}}class Sh extends Je{isInCorner(t,n){const s=n.getTheme(),{scrollBarSize:i}=s,{metrics:o}=n;if(!o)throw new Error("metrics not set");const{x:r,y:l}=t,{width:a,height:c,hasVerticalBar:d,hasHorizontalBar:u}=o;return i>0&&d&&u&&r>=a-i&&l>=c-i&&r<=a&&l<=c}onDown(t,n){return this.isInCorner(t,n)}onUp(t,n){return this.isInCorner(t,n)}onClick(t,n){return this.isInCorner(t,n)}}class Rr extends Je{constructor(){super(...arguments),this.cursor="default"}static getTopWithOffsetFromRawTop(t,n){const s=t.getTheme(),{metrics:i,metricCalculator:o}=t;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 d=t.getMetricState();a=o.getVisibleRowHeight(r,d)}const c=a*l;return{top:r,topOffset:c}}isInScrollBar(t,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}=t,{barTop:c,barHeight:d,width:u,hasVerticalBar:m}=r;return m&&i>0&&l>=u-o&&l<u&&a>c&&a<c+d}getTopWithOffset(t,n){var f;const{metrics:s}=n;if(!s)throw new Error("metrics not set");const{y:i}=t,{barHeight:o,handleHeight:r,lastTop:l,barTop:a,rowCount:c,scrollableContentHeight:d,scrollableViewportHeight:u}=s,m=i-a,p=Ue((m-((f=this.dragOffset)!=null?f:0))/(o-r),0,1);if(c===1)return{top:0,topOffset:p*(d-u)};const g=p*l;return Rr.getTopWithOffsetFromRawTop(n,g)}onDown(t,n){const{metrics:s}=n;if(!s)throw new Error("metrics not set");const{y:i}=t,{handleHeight:o,barTop:r,scrollY:l}=s;if(!this.isInScrollBar(t,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:d}=this.getTopWithOffset(t,n);n.setViewState({top:c,topOffset:d,isDraggingVerticalScrollBar:!0,isDragging:!0})}return!0}onMove(t,n){return this.isInScrollBar(t,n)}onDrag(t,n){if(this.dragOffset!=null){const{top:s,topOffset:i}=this.getTopWithOffset(t,n);return n.setViewState({top:s,topOffset:i,isDraggingVerticalScrollBar:!0,isDragging:!0}),!0}return!1}onUp(t,n){return this.dragOffset!==void 0&&(this.dragOffset=void 0,n.setState({isDraggingVerticalScrollBar:!1,isDragging:!1})),this.isInScrollBar(t,n)}onClick(t,n){return this.isInScrollBar(t,n)}}class vh extends Je{onDoubleClick({column:t,row:n},s){const{model:i}=s.props;return Oe(i)&&t!=null&&n!=null&&i.isEditableRange(Z.makeCell(t,n))?(s.startEditing(t,n),!0):!1}}class ms{constructor(t=5e3){this.order=t}onDown(t,n){return!1}}class Th extends ms{onDown(t,n){switch(t.key){case"a":if(B.isModifierKeyDown(t))return n.selectAll(),!0;break;case"ArrowUp":return this.handleArrowMove(0,-1,t,n);case"ArrowDown":return this.handleArrowMove(0,1,t,n);case"ArrowRight":return this.handleArrowMove(1,0,t,n);case"ArrowLeft":return this.handleArrowMove(-1,0,t,n);case"k":case"K":return B.isModifierKeyDown(t)?!1:this.handlePageUp(t,n);case"j":case"J":return B.isModifierKeyDown(t)?!1:this.handlePageDown(t,n);case"h":case"H":return B.isModifierKeyDown(t)?!1:(t.shiftKey||n.clearSelectedRanges(),n.moveCursorToPosition(0,n.state.cursorRow,t.shiftKey),!0);case"l":case"L":{if(B.isModifierKeyDown(t))return!1;const{model:s}=n.props,{columnCount:i}=s;return t.shiftKey||n.clearSelectedRanges(),n.moveCursorToPosition(i-1,n.state.cursorRow,t.shiftKey),!0}case"PageDown":return this.handlePageDown(t,n);case"PageUp":return this.handlePageUp(t,n);case"Home":return t.shiftKey||n.clearSelectedRanges(),n.moveCursorToPosition(B.isModifierKeyDown(t)?n.state.cursorColumn:0,B.isModifierKeyDown(t)?0:n.state.cursorRow,t.shiftKey,!0,!0),!0;case"End":{const{model:s}=n.props,{columnCount:i,rowCount:o}=s;return t.shiftKey||n.clearSelectedRanges(),n.moveCursorToPosition(B.isModifierKeyDown(t)?n.state.cursorColumn:i-1,B.isModifierKeyDown(t)?o-1:n.state.cursorRow,t.shiftKey,!0,!0),!0}case"Escape":return n.clearSelectedRanges(),{preventDefault:!1,stopPropagation:!1};case"Enter":if(n.state.selectedRanges.length>0)return n.moveCursorInDirection(t.shiftKey?Z.SELECTION_DIRECTION.UP:Z.SELECTION_DIRECTION.DOWN),!0;break;case"Tab":if(n.state.selectedRanges.length>0)return n.moveCursorInDirection(t.shiftKey?Z.SELECTION_DIRECTION.LEFT:Z.SELECTION_DIRECTION.RIGHT),!0;break}return!1}handleArrowMove(t,n,s,i){const o=s.shiftKey,r=B.isModifierKeyDown(s);o?i.trimSelectedRanges():i.clearSelectedRanges();const{cursorRow:l,cursorColumn:a,selectionEndColumn:c,selectionEndRow:d}=i.state,u=o?c:a,m=o?d:l;if(r){const{model:p}=i.props,{columnCount:g,rowCount:f}=p,C=r&&o;let w=null,b=null;t<0?(w=0,b=m):t>0?(w=g-1,b=m):n<0?(w=u,b=0):n>0&&(w=u,b=f-1),w!=null&&b!=null&&i.moveCursorToPosition(w,b,o,!0,C)}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&&t!==0){const{lastLeft:C}=i.metrics;let{left:w}=i.state;w=Ue(w+t,0,C),i.moveCursorToPosition(w,l,o,!1),i.setViewState({left:w})}else if(f&&n!==0){const{lastTop:C}=i.metrics;let{top:w}=i.state;w=Ue(w+n,0,C),i.moveCursorToPosition(w,a,o,!1),i.setViewState({top:w})}else i.moveCursor(t,n,o)}return!0}handlePageUp(t,n){const s=t.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:d,topVisible:u,hasHorizontalBar:m}=c.getMetrics(a);let p=r-(d-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(t,n){const s=t.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:d,topVisible:u,hasHorizontalBar:m,rowCount:p,lastTop:g}=c.getMetrics(a),f=p-1;let C=d-u+r;C+=m?0:1,C=Math.min(C,f);const w=Math.min(g,C-(r-u));return n.moveCursorToPosition(l,C,s,!1),n.setViewState({top:w}),!0}}class Eh extends ms{onDown(t,n){switch(t.key){case"Enter":case" ":return this.handleExpandKey(t,n)}return!1}handleExpandKey(t,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)&&We(o)&&o.isRowExpandable(a))return n.toggleRowExpanded(r),!0}}}return!1}}class yh extends ms{onDown(t,n){if(B.isModifierKeyDown(t))return!1;const{model:s}=n.props,{cursorColumn:i,cursorRow:o}=n.state;if(i==null||o==null||!Oe(s)||!s.isEditableRange(Z.makeCell(i,o)))return!1;const r=i,l=o;return r==null||l==null?!1:t.key.length===1?(n.startEditing(r,l,!0,[1,1],t.key),!0):t.key==="F2"?(n.startEditing(r,l),!0):t.key==="Backspace"?(n.startEditing(r,l,!0,void 0,""),!0):t.key==="Delete"?(n.setValueForCell(r,l,""),!0):!1}}function Rh(e){var s,i;const t=[],n=e.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 d=l[c];a.push((i=(s=d.textContent)==null?void 0:s.trim())!=null?i:"")}t.push(a)}return t}function Ih(e){const t=[];return e.forEach(n=>{var i;const s=(i=n.textContent)!=null?i:"";s.length>0&&t.push(s.split(/\t|\u00a0\u00a0 \u00a0/))}),t}function Mh(e){var s,i;const t=e.querySelector("table");if(t!=null)return Rh(t);const n=(i=(s=e.textContent)==null?void 0:s.trim())!=null?i:"";if(n.length>0){const{childNodes:o}=e,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(`
|
|
3
|
+
`).map(a=>a.split(" ")):o.length>1||l?Ih(e.childNodes):n}return null}class Dh extends ms{onDown(t,n){switch(t.key){case"v":if(B.isModifierKeyDown(t)){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=Mh(s);o!=null&&n.pasteValue(o)};return s.addEventListener("input",i),s.focus(),{preventDefault:!1,stopPropagation:!0}}break}return!1}}const Nh=e=>{switch(e){case"ArrowDown":return Lt.DOWN;case"ArrowUp":return Lt.UP;case"ArrowLeft":return Lt.LEFT;case"ArrowRight":return Lt.RIGHT;default:return}};function Ir({selectionRange:e=void 0,className:t="",disabled:n=!1,value:s="",isQuickEdit:i=!0,onChange:o=()=>{},onCancel:r=()=>{},onDone:l=()=>{},onContextMenu:a=()=>{},style:c={}}){const d=T.exports.useRef(null),u=T.exports.useRef(!1),[m]=T.exports.useState(s),[p,g]=T.exports.useState(!1),[f,C]=T.exports.useState(i),[w,b]=T.exports.useState(s);T.exports.useEffect(function(){const{current:N}=d;N!=null&&(N.focus(),e?N.setSelectionRange(e[0],e[1]):N.setSelectionRange(N.value.length,N.value.length))},[e]);const S=T.exports.useCallback(V=>{o(V)},[o]),E=T.exports.useCallback(V=>{const{value:N}=V.target;b(N),g(!0),S(N)},[S,b,g]),v=T.exports.useCallback(()=>{u.current=!0,p&&S(m),g(!1),r()},[m,p,r,S]),y=T.exports.useCallback(()=>{C(!1)},[C]),M=T.exports.useCallback((V,N=!1)=>{l(w,{direction:V,fillRange:N})},[l,w]),F=T.exports.useCallback(()=>{u.current||M(null)},[u,M]),x=T.exports.useCallback(V=>{switch(V.stopPropagation(),V.key){case"Escape":V.preventDefault(),v();break;case"Enter":if(V.preventDefault(),B.isModifierKeyDown(V))M(void 0,!0);else if(V.altKey){const N=`${w}
|
|
4
|
+
`;b(N),g(!0),S(N)}else M(V.shiftKey?Lt.UP:Lt.DOWN);break;case"Tab":V.preventDefault(),M(V.shiftKey?Lt.LEFT:Lt.RIGHT);break;case"ArrowDown":case"ArrowUp":case"ArrowLeft":case"ArrowRight":f&&(V.preventDefault(),M(Nh(V.key)));break}},[v,M,f,b,g,S,w]),U=T.exports.useCallback(V=>{a(V)},[a]);return h("textarea",{ref:d,className:G("grid-cell-input-field",t),value:w,onBlur:F,onChange:E,onKeyDown:x,onContextMenu:U,onClick:y,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:"false",disabled:n,style:c})}Ir.propTypes={selectionRange:D.exports.arrayOf(D.exports.number),className:D.exports.string,disabled:D.exports.bool,isQuickEdit:D.exports.bool,value:D.exports.string,onChange:D.exports.func,onCancel:D.exports.func,onDone:D.exports.func,onContextMenu:D.exports.func,style:D.exports.shape({})};Ir.defaultProps={selectionRange:null,className:"",disabled:!1,value:"",isQuickEdit:!0,onChange:()=>{},onCancel:()=>{},onDone:()=>{},onContextMenu:()=>{},style:{}};const Fh=J.createContext({}),is=class extends T.exports.PureComponent{constructor(e){super(e),this.getCachedKeyHandlers=Ee(l=>[...l,...this.keyHandlers].sort((a,c)=>a.order-c.order)),this.getCachedMouseHandlers=Ee(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:t,isStuckToRight:n,metricCalculator:s,movedColumns:i,movedRows:o,renderer:r}=e;this.renderer=r||new Ls,this.metricCalculator=s||new hi,this.canvas=null,this.canvasContext=null,this.animationFrame=null,this.prevMetrics=null,this.metrics=null,this.documentCursor=null,this.dragTimer=null,this.keyHandlers=[new yh(400),new Dh(450),new Th(500),new Eh(900)],this.mouseHandlers=[new yr(100),new mo(200),new bh(300),new wh(400),new vh(450),new Rr(500),new Er(600),new Sh(700),new Yi(800),new fh(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:t,isStuckToRight:n}}static getScale(e){var i,o,r,l,a;const t=window.devicePixelRatio||1,n=e,s=(a=(l=(r=(o=(i=n.webkitBackingStorePixelRatio)!=null?i:n.mozBackingStorePixelRatio)!=null?o:n.msBackingStorePixelRatio)!=null?r:n.oBackingStorePixelRatio)!=null?l:n.backingStorePixelRatio)!=null?a:1;return t/s}static getCursorClassName(e){return e!=null&&e!==""?`grid-cursor-${e}`:null}componentDidMount(){var n;this.initContext(),(n=this.canvas)==null||n.addEventListener("wheel",this.handleWheel,{passive:!1}),window.addEventListener("resize",this.handleResize),this.updateCanvasScale(),this.updateCanvas();const{isStuckToBottom:e,isStuckToRight:t}=this.props;e&&this.scrollToBottom(),t&&this.scrollToRight()}componentDidUpdate(e,t){const{isStickyBottom:n,isStickyRight:s,movedColumns:i,movedRows:o,onMovedColumnsChanged:r,onMoveColumnComplete:l,onMovedRowsChanged:a,onMoveRowComplete:c}=this.props,{isStickyBottom:d,isStickyRight:u,movedColumns:m,movedRows:p}=e,{movedColumns:g,movedRows:f}=t,{draggingColumn:C,draggingRow:w,movedColumns:b,movedRows:S}=this.state;if(m!==i&&this.setState({movedColumns:i}),p!==o&&this.setState({movedRows:o}),g!==b&&r(b),t.draggingColumn!=null&&C==null&&l(b),f!==S&&a(S),t.draggingRow!=null&&w==null&&c(S),n!==d&&this.setState({isStuckToBottom:!1}),s!==u&&this.setState({isStuckToRight:!1}),this.updateMetrics(),this.requestUpdateCanvas(),!this.metrics||!this.prevMetrics)return;const{rowCount:E,columnCount:v,height:y,width:M}=this.metrics,{rowCount:F,columnCount:x,height:U,width:V}=this.prevMetrics;if(F!==E||y!==U){const{isStuckToBottom:N}=this.state;N&&this.scrollToBottom()}if(x!==v||M!==V){const{isStuckToRight:N}=this.state;N&&this.scrollToRight()}this.validateSelection()&&this.checkSelectionChange(t)}componentWillUnmount(){var e;this.animationFrame!=null&&cancelAnimationFrame(this.animationFrame),(e=this.canvas)==null||e.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:e}=this.props;return is.getTheme(this.context,e)}getGridPointFromEvent(e){pl(this.canvas);const t=this.canvas.getBoundingClientRect(),n=e.clientX-t.left,s=e.clientY-t.top;return this.getGridPointFromXY(n,s)}getGridPointFromXY(e,t){if(!this.metrics)throw new Error("metrics must be set");return B.getGridPointFromXY(e,t,this.metrics)}getMetricState(e=this.state){const t=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:d,movedColumns:u,movedRows:m,isDraggingHorizontalScrollBar:p,isDraggingVerticalScrollBar:g,draggingColumn:f}=e;return{left:l,top:a,leftOffset:c,topOffset:d,width:o,height:r,context:i,theme:t,model:n,movedColumns:u,movedRows:m,isDraggingHorizontalScrollBar:p,isDraggingVerticalScrollBar:g,draggingColumn:f,...s}}getKeyHandlers(){const{keyHandlers:e}=this.props;return this.getCachedKeyHandlers(e)}getMouseHandlers(){const{mouseHandlers:e}=this.props;return this.getCachedMouseHandlers(e)}getModelColumn(e){var n,s;const t=(s=(n=this.metrics)==null?void 0:n.modelColumns)==null?void 0:s.get(e);if(t===void 0)throw new Error(`Unable to get ModelIndex for column ${e}`);return t}getModelRow(e){var n,s;const t=(s=(n=this.metrics)==null?void 0:n.modelRows)==null?void 0:s.get(e);if(t===void 0)throw new Error(`Unable to get ModelIndex for row ${e}`);return t}toggleRowExpanded(e){const t=this.getModelRow(e),{model:n}=this.props;We(n)&&n.isRowExpandable(t)&&n.setRowExpanded(t,!n.isRowExpanded(t)),this.clearSelectedRanges(),this.commitSelection(),this.moveCursorToPosition(0,e),this.commitSelection(),this.setState({isStuckToBottom:!1})}scrollToBottom(){if(!this.metrics)return;const{bottomVisible:e,rowCount:t,top:n,lastTop:s}=this.metrics;(e<t-1&&e>0||n>s)&&this.setState({top:s})}scrollToRight(){if(!this.metrics)return;const{rightVisible:e,columnCount:t,left:n,lastLeft:s}=this.metrics;(e<t-1&&e>0||n>s)&&this.setState({left:s})}setSelectedRanges(e){const{model:t}=this.props,{columnCount:n,rowCount:s}=t,{cursorRow:i,cursorColumn:o,selectedRanges:r}=this.state;if(this.setState({selectedRanges:e,lastSelectedRanges:r}),e.length>0){const l=Z.boundedRange(e[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:e}=this,{canvasOptions:t}=this.props;if(!e)throw new Error("Canvas not set");this.canvasContext=e.getContext("2d",t)}requestUpdateCanvas(){this.animationFrame==null&&(this.animationFrame=requestAnimationFrame(()=>{if(this.animationFrame=null,!this.metrics)throw new Error("Metrics not set");this.updateCanvas(this.metrics)}))}updateCanvas(e=this.updateMetrics()){this.updateCanvasScale();const{onViewChanged:t}=this.props;t(e),this.drawCanvas(e)}updateCanvasScale(){const{canvas:e,canvasContext:t}=this;if(!e)throw new Error("canvas not set");if(!t)throw new Error("canvasContext not set");if(!e.parentElement)throw new Error("Canvas has no parent element");const n=is.getScale(t),s=e.parentElement.getBoundingClientRect(),i=Math.floor(s.width),o=Math.floor(s.height);e.style.width=`${i}px`,e.style.height=`${o}px`,e.width=i*n,e.height=o*n,t.scale(n,n)}updateMetrics(e=this.state){this.prevMetrics=this.metrics;const{metricCalculator:t}=this,n=this.getMetricState(e);return this.metrics=t.getMetrics(n),this.metrics}checkSelectionChange(e){const{selectedRanges:t}=e,{selectedRanges:n}=this.state;if(n!==t){const{onSelectionChanged:s}=this.props;s(n)}}validateSelection(){const{model:e}=this.props,{selectedRanges:t}=this.state,{columnCount:n,rowCount:s}=e;for(let i=0;i<t.length;i+=1){const o=t[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:e}=this.state;this.setState({selectedRanges:[],lastSelectedRanges:e})}trimSelectedRanges(){const{selectedRanges:e}=this.state;e.length>0&&this.setState({selectedRanges:e.slice(e.length-1)})}beginSelection(e,t){this.setState({selectionStartColumn:e,selectionStartRow:t,selectionEndColumn:e,selectionEndRow:t,cursorColumn:e,cursorRow:t})}moveSelection(e,t,n=!1,s=!1){this.setState(i=>{var g,f,C,w;const{selectedRanges:o,selectionStartRow:r,selectionStartColumn:l}=i,{theme:a}=this.props,{autoSelectRow:c,autoSelectColumn:d}=a;if(n&&o.length>0){const b=o[o.length-1];let S=null,E=null,v=null,y=null;s?(S=c!==void 0&&c?null:Math.min(e!=null?e:0,(g=b.startColumn)!=null?g:0),E=d!==void 0&&d?null:Math.min(t!=null?t:0,(f=b.startRow)!=null?f:0),v=c!==void 0&&c?null:Math.max(e!=null?e:0,(C=b.endColumn)!=null?C:0),y=d!==void 0&&d?null:Math.max(t!=null?t:0,(w=b.endRow)!=null?w:0)):(S=b.startColumn,E=b.startRow,(l!=null||r!=null)&&((c===void 0||!c)&&(S=l),(d===void 0||!d)&&(E=r)),v=c!==void 0&&c?null:e,y=d!==void 0&&d?null:t);const M=Z.makeNormalized(S,E,v,y);if(b.equals(M))return null;const F=[...o];return F[F.length-1]=M,{selectedRanges:F,selectionEndColumn:e,selectionEndRow:t}}const u=[...o],m=c!==void 0&&c?null:e,p=d!==void 0&&d?null:t;return u.push(Z.makeNormalized(m,p,m,p)),{selectedRanges:u,selectionEndColumn:e,selectionEndRow:t}})}commitSelection(){this.setState(e=>{const{theme:t}=this.props,{autoSelectRow:n}=t,{selectedRanges:s,lastSelectedRanges:i,cursorRow:o,cursorColumn:r}=e;if(s.length===1&&(n!==void 0&&n?Z.rowCount(s)===1:Z.cellCount(s)===1)&&Z.rangeArraysEqual(s,i))return{selectedRanges:[],lastSelectedRanges:[],cursorColumn:r,cursorRow:o};let l=s.slice();if(l.length>1){const d=l[l.length-1];for(let u=0;u<l.length-1;u+=1){const m=l[u];if(m.contains(d)){const p=m.subtract(d);l.pop(),l.splice(u,1),l=l.concat(p);break}}l=Z.consolidate(l)}let a=r,c=o;if(!Z.containsCell(l,r,o)){const{model:d}=this.props,{columnCount:u,rowCount:m}=d,p=Z.nextCell(Z.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(e){var u;if(!this.metrics||!this.prevMetrics)return;const{gridY:t,height:n,lastTop:s,userRowHeights:i,rowHeight:o}=this.metrics,r=n-t,l=Math.round(r/2)+((u=i.get(e))!=null?u:o),a=this.getMetricState(),c=this.metricCalculator.getLastTop(a,e+1,l);this.setState({top:Math.min(s,c),selectedRanges:[new Z(null,e,null,e)]});const{cursorColumn:d}=this.state;this.moveCursorToPosition(d,e,!1,!1)}selectAll(){const{model:e,theme:t}=this.props,{autoSelectRow:n,autoSelectColumn:s}=t,i=s!==void 0&&s?null:0,o=s!==void 0&&s?null:e.rowCount-1,r=n!==void 0&&n?null:0,l=n!==void 0&&n?null:e.columnCount-1;this.setSelectedRanges([new Z(r,i,l,o)])}moveCursor(e,t,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:d}=this.state;this.moveCursorToPosition(c,d,n)}else{const{model:c}=this.props,{columnCount:d,rowCount:u}=c,m=Ue(l+e,0,d-1),p=Ue(a+t,0,u-1);this.moveCursorToPosition(m,p,n)}}moveCursorInDirection(e=Z.SELECTION_DIRECTION.DOWN){var c;const{model:t}=this.props,{columnCount:n,rowCount:s}=t,{cursorRow:i,cursorColumn:o,selectedRanges:r}=this.state,l=r.length>0?r:[Z.makeCell(o,i)];let a=null;if(l.length===1&&Z.cellCount(l)===1){const d=new Z(0,0,n-1,s-1);a=(c=d.nextCell(o,i,e))!=null?c:d.startCell(e)}else a=Z.nextCell(Z.boundedRanges(l,n,s),o,i,e);if(a!=null){const{column:d,row:u}=a;this.setState({cursorColumn:d,cursorRow:u}),Z.containsCell(r,d,u)||this.setState({selectedRanges:[Z.makeCell(d,u)],selectionStartColumn:d,selectionStartRow:u,selectionEndColumn:d,selectionEndRow:u}),this.moveViewToCell(a.column,a.row)}}moveCursorToPosition(e,t,n=!1,s=!0,i=!1){n||this.beginSelection(e,t),this.moveSelection(e,t,n,i),s&&this.moveViewToCell(e,t)}moveViewToCell(e,t){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:d,leftOffset:u}=this.state;t!=null&&!B.isFloatingRow(t,this.metrics)&&(t<o?(a=n.getTopForTopVisible(l,t),d=0):t>s&&(a=n.getTopForBottomVisible(l,t),d=0)),e!=null&&!B.isFloatingColumn(e,this.metrics)&&(e<r?(c=n.getLeftForLeftVisible(l,e),u=0):e>i&&(c=n.getLeftForRightVisible(l,e),u=0)),this.setViewState({top:a,left:c,topOffset:d,leftOffset:u})}setViewState(e,t=!1){if(!this.metrics)throw new Error("metrics not set");const{isStickyBottom:n,isStickyRight:s}=this.props,{top:i,left:o}=e,{lastTop:r,lastLeft:l}=this.metrics;i!=null&&this.setState({isStuckToBottom:n&&i>=r}),o!=null&&this.setState({isStuckToRight:s&&o>=l}),this.setState(e),t&&this.forceUpdate()}startEditing(e,t,n=!1,s,i){const{model:o}=this.props;if(!Oe(o))throw new Error("model is not editable");const r=this.getModelColumn(e),l=this.getModelRow(t),a={column:e,row:t,selectionRange:s,value:i!==void 0?i:o.editValueForCell(r,l),isQuickEdit:n};this.setState({editingCell:a,cursorColumn:e,cursorRow:t}),this.moveViewToCell(e,t)}isValidForCell(e,t,n){const{model:s}=this.props,i=this.getModelColumn(e),o=this.getModelRow(t);return Oe(s)&&s.isValidForCell(i,o,n)}async pasteValue(e){const{model:t}=this.props,{movedColumns:n,movedRows:s,selectedRanges:i}=this.state;try{if(gl(t),!t.isEditable||!i.every(u=>t.isEditableRange(u)))throw new ko("Can't paste in to read-only area.");if(i.length<=0)throw new ko("Select an area to paste to.");if(typeof e=="string"){const u=[],m=B.getModelRanges(i,n,s);Z.forEachCell(m,(p,g)=>{u.push({column:p,row:g,text:e})}),await t.setValues(u);return}const o=e.length,r=e[0].length,{columnCount:l,rowCount:a}=t;let c=i;if(c.every(u=>{var m,p;return Z.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 Z(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=>Z.rowCount([u])===o&&Z.columnCount([u])===r))throw new ko("Copy and paste area are not same size.");const d=[];c.forEach(u=>{var m,p;for(let g=0;g<r;g+=1)for(let f=0;f<o;f+=1)d.push({column:((m=u.startColumn)!=null?m:0)+g,row:((p=u.startRow)!=null?p:0)+f,text:e[f][g]})}),await t.setValues(d)}catch(o){const{onError:r}=this.props;r(o instanceof Error?o:new Error(`${o}`))}}setValueForCell(e,t,n){const{model:s}=this.props;gl(s);const i=this.getModelColumn(e),o=this.getModelRow(t);return s.isValidForCell(i,o,n)?(s.setValueForCell(i,o,n),!0):!1}setValueForRanges(e,t){const{model:n}=this.props,{movedColumns:s,movedRows:i}=this.state,o=B.getModelRanges(e,s,i);Oe(n)&&n.setValueForRanges(o,t)}isSelected(e,t){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<=e&&e<=((s=r.endRow)!=null?s:0),a=r.startColumn===null||r.startColumn<=t&&t<=((i=r.endColumn)!=null?i:0);if(l&&a)return!0}return!1}addDocumentCursor(e=null){this.documentCursor!==is.getCursorClassName(e)&&(this.documentCursor!=null&&document.documentElement.classList.remove(this.documentCursor),this.documentCursor=is.getCursorClassName(e),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(e){this.stopDragTimer();const t=new MouseEvent("custom",e.nativeEvent);this.dragTimer=setTimeout(()=>{this.handleMouseDrag(t)},is.dragTimeout)}stopDragTimer(){this.dragTimer&&(clearTimeout(this.dragTimer),this.dragTimer=null)}drawCanvas(e=this.updateMetrics()){if(!this.canvas)throw new Error("canvas is not set");if(!this.canvasContext)throw new Error("context not set");const{left:t,top:n,cursorColumn:s,cursorRow:i,draggingColumn:o,draggingColumnSeparator:r,draggingRow:l,draggingRowOffset:a,draggingRowSeparator:c,editingCell:d,isDraggingHorizontalScrollBar:u,isDraggingVerticalScrollBar:m,isDragging:p,mouseX:g,mouseY:f,selectedRanges:C}=this.state,{model:w,stateOverride:b}=this.props,{renderer:S}=this,E=this.canvasContext,v=this.getTheme(),y=this.canvas.clientWidth,M=this.canvas.clientHeight,F={left:t,top:n,width:y,height:M,context:E,theme:v,model:w,metrics:e,mouseX:g,mouseY:f,selectedRanges:C,draggingColumn:o,draggingColumnSeparator:r,draggingRow:l,draggingRowOffset:a,draggingRowSeparator:c,editingCell:d,isDraggingHorizontalScrollBar:u,isDraggingVerticalScrollBar:m,isDragging:p,cursorColumn:s,cursorRow:i,...b};E.save(),S.drawCanvas(F),E.restore()}focus(){var e;(e=this.canvas)==null||e.focus()}isFocused(){return document.activeElement===this.canvas}handleClick(e){var s;const t=this.getGridPointFromEvent(e),n=this.getMouseHandlers();for(let i=0;i<n.length;i+=1)if(n[i].onClick(t,this,e)!==!1){e.stopPropagation(),e.preventDefault();break}(s=this.canvas)==null||s.focus()}handleContextMenu(e){const t=this.getGridPointFromEvent(e),n=this.getMouseHandlers();for(let s=0;s<n.length;s+=1)if(n[s].onContextMenu(t,this,e)!==!1){e.stopPropagation(),e.preventDefault();break}}handleKeyDown(e){var n,s;const t=this.getKeyHandlers();for(let i=0;i<t.length;i+=1){const r=t[i].onDown(e,this);if(r!==!1){const l=r;((n=l==null?void 0:l.stopPropagation)==null||n)&&e.stopPropagation(),((s=l==null?void 0:l.preventDefault)==null||s)&&e.preventDefault();break}}}notifyMouseHandlers(e,t,n=!0,s=!1){var l,a;const i=this.getGridPointFromEvent(t),o=this.getMouseHandlers();let r=null;for(let c=0;c<o.length;c+=1){const d=o[c],u=d[e]!=null&&d[e](i,this,t);if(u!==!1){d.cursor!=null&&({cursor:r}=d,s&&this.addDocumentCursor(r));const m=u;((l=m==null?void 0:m.stopPropagation)==null||l)&&t.stopPropagation(),((a=m==null?void 0:m.preventDefault)==null||a)&&t.preventDefault();break}}if(this.setState({cursor:r}),n){const{x:c,y:d}=i;this.setState({mouseX:c,mouseY:d})}}handleMouseDown(e){window.addEventListener("mousemove",this.handleMouseDrag,!0),window.addEventListener("mouseup",this.handleMouseUp,!0),!(e.button!=null&&e.button!==0)&&(this.notifyMouseHandlers("onDown",e),this.startDragTimer(e))}handleDoubleClick(e){this.notifyMouseHandlers("onDoubleClick",e)}handleMouseMove(e){this.notifyMouseHandlers("onMove",e)}handleMouseLeave(e){this.notifyMouseHandlers("onLeave",e,!1),this.setState({mouseX:null,mouseY:null})}handleMouseDrag(e){this.setState({isDragging:!0}),this.notifyMouseHandlers("onDrag",e,!0,!0),this.stopDragTimer()}handleMouseUp(e){window.removeEventListener("mousemove",this.handleMouseDrag,!0),window.removeEventListener("mouseup",this.handleMouseUp,!0),!(e.button!=null&&e.button!==0)&&(this.notifyMouseHandlers("onUp",e,!1),this.stopDragTimer(),this.removeDocumentCursor())}handleResize(){if(this.updateCanvasScale(),this.updateCanvas(),!this.metrics)throw new Error("metrics not set");const{left:e,top:t}=this.state,{lastLeft:n,lastTop:s}=this.metrics;e>n&&this.setState({left:n,leftOffset:0}),t>s&&this.setState({top:s,topOffset:0}),this.forceUpdate()}handleWheel(e){var v,y,M,F;if(this.notifyMouseHandlers("onWheel",e),e.defaultPrevented)return;const{metricCalculator:t,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:d,scrollableViewportHeight:u,hasHorizontalBar:m,hasVerticalBar:p}=n;let{top:g,left:f,topOffset:C,leftOffset:w}=n;const b=this.getTheme();let{deltaX:S,deltaY:E}=B.getScrollDelta(e,n.barWidth,n.barHeight,n.rowHeight,n.rowHeight);for(;m&&S!==0;){if(w+=S,S=0,r>1){if(w>0&&f>=o||w<0&&f<=0){w=0;break}}else{if(w<=0){w=0;break}const x=a-c;if(w>=x){w=x;break}}if(w>0){const x=(v=n.visibleColumnWidths.get(f))!=null?v:t.getVisibleColumnWidth(f,s);w>=x?(S=w-x,w=0,f+=1):b.scrollSnapToColumn&&r>1&&(w=0,f+=1)}else if(w<0){const x=(y=n.visibleColumnWidths.get(f-1))!=null?y:t.getVisibleColumnWidth(f-1,s);Math.abs(w)<=x&&b.scrollSnapToColumn&&r>1?(w=0,f-=1):(S=w+x,w=0,f-=1)}}for(;p&&E!==0;){if(C+=E,E=0,l>1){if(C>0&&g>=i||C<0&&g<=0){C=0;break}}else{if(C<=0){C=0;break}const x=d-u;if(C>=x){C=x;break}}if(C>0){const x=(M=n.visibleRowHeights.get(g))!=null?M:t.getVisibleRowHeight(g,s);C>=x?(E=C-x,C=0,g+=1):b.scrollSnapToRow&&l>1&&(C=0,g+=1)}else if(C<0){const x=(F=n.visibleRowHeights.get(g-1))!=null?F:t.getVisibleRowHeight(g-1,s);Math.abs(C)<=x&&b.scrollSnapToRow&&l>1?(C=0,g-=1):(E=C+x,C=0,g-=1)}}this.setViewState({top:g,left:f,leftOffset:w,topOffset:C}),e.stopPropagation(),e.preventDefault()}handleEditCellCancel(){this.setState({editingCell:null}),this.focus()}handleEditCellChange(e){this.setState(({editingCell:t})=>{try{return pl(t),{editingCell:{...t,value:e}}}catch(n){const{onError:s}=this.props;return s(n instanceof Error?n:new Error(`${n}`)),null}})}handleEditCellCommit(e,{direction:t=Lt.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,e)){t===null&&this.setState({editingCell:null});return}n?this.setValueForRanges(i,e):this.setValueForCell(o,r,e),t!==null&&this.moveCursorInDirection(t),this.setState({editingCell:null}),this.focus()}renderInputField(){const{model:e}=this.props,{editingCell:t}=this.state,{metrics:n}=this;if(t==null||n==null||!Oe(e))return null;const{selectionRange:s,value:i,isQuickEdit:o}=t,{column:r,row:l}=t,{gridX:a,gridY:c,visibleColumnXs:d,visibleRowYs:u,visibleColumnWidths:m,visibleRowHeights:p}=n,g=d.get(r),f=u.get(l),C=m.get(r),w=p.get(l),b=g!=null&&f!=null&&C!=null&&w!=null?{position:"absolute",left:a+g,top:c+f,width:C,height:w}:{opacity:0},S=this.getModelColumn(r),E=this.getModelRow(l),v=S!=null&&E!=null?{textAlign:e.textAlignForCell(S,E)}:void 0,y=e.isValidForCell(S,E,i);return h("div",{style:b,children:h(Ir,{selectionRange:s,className:G({error:!y}),onCancel:this.handleEditCellCancel,onChange:this.handleEditCellChange,onDone:this.handleEditCellCommit,isQuickEdit:o,style:v,value:i},`${r},${l}`)})}render(){const{cursor:e}=this.state;return R(Fe,{children:[h("canvas",{className:G("grid-canvas",is.getCursorClassName(e)),ref:t=>{this.canvas=t},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 Us=is;Us.contextType=Fh;Us.defaultProps={canvasOptions:{alpha:!1},isStickyBottom:!1,isStickyRight:!1,isStuckToBottom:!1,isStuckToRight:!1,keyHandlers:[],mouseHandlers:[],movedColumns:[],movedRows:[],onError:()=>{},onSelectionChanged:()=>{},onMovedColumnsChanged:e=>{},onMoveColumnComplete:()=>{},onMovedRowsChanged:()=>{},onMoveRowComplete:()=>{},onViewChanged:()=>{},stateOverride:{},theme:{autoSelectColumn:!1,autoSelectRow:!1}};Us.pixelsPerLine=100/3;Us.dragTimeout=1e3;Us.getTheme=Ee((e,t)=>({...mh,...e,...t}));class xa extends ir{get floatingTopRowCount(){return 0}get floatingBottomRowCount(){return 0}get floatingLeftColumnCount(){return 0}get floatingRightColumnCount(){return 0}get columnHeaderMaxDepth(){return 1}truncationCharForCell(t,n){}textAlignForCell(t,n){return"left"}colorForCell(t,n,s){return s.textColor}backgroundColorForCell(t,n,s){return null}colorForColumnHeader(t,n=0){return null}textForRowHeader(t){return""}textForRowFooter(t){return""}isColumnMovable(t,n=0){return!0}isRowMovable(t){return!0}getColumnHeaderGroup(t,n){}getColumnHeaderParentGroup(t,n){}}class xh extends xa{constructor({rowCount:t=1e9,columnCount:n=100,floatingTopRowCount:s=0,floatingBottomRowCount:i=0,floatingLeftColumnCount:o=0,floatingRightColumnCount:r=0,isEditable:l=!1,editedData:a=[]}={}){super(),this.numRows=t,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(t,n){var s,i;return(i=(s=this.editedData[t])==null?void 0:s[n])!=null?i:`${t},${n}`}colorForCell(t,n,s){return s.textColor}textForColumnHeader(t,n=0){return`${t}`}textForRowHeader(t){return`${t}`}textForRowFooter(t){return`${t}`}async setValueForCell(t,n,s){this.editedData[t]==null&&(this.editedData[t]=[]),this.editedData[t][n]=`${s}`}async setValueForRanges(t,n){Z.forEachCell(t,(s,i)=>{this.setValueForCell(s,i,n)})}async setValues(t){var n,s;for(let i=0;i<t.length;i+=1){const o=t[i];this.setValueForCell((n=o.column)!=null?n:o.x,(s=o.row)!=null?s:o.y,o.text)}}editValueForCell(t,n){return this.textForCell(t,n)}isValidForCell(t,n,s){return!0}isEditableRange(t){return this.isEditable}delete(t){throw new Error("Method not implemented.")}}const os=class extends xh{constructor({rowCount:e=os.DEFAULT_ROW_COUNT,columnCount:t=os.DEFAULT_COLUMN_COUNT,children:n=new Map,childRowCount:s=Math.ceil(Math.max(os.MIN_CHILD_ROW_COUNT,e*os.DEFAULT_CHILD_ROW_COUNT_FACTOR)),maxDepth:i=os.MAX_DEPTH}={}){super({rowCount:e,columnCount:t}),this.getCachedModelRowOffset=vt((o,r)=>{let l=null,a=r;const c=[...o].sort((d,u)=>d[0]-u[0]);for(let d=0;d<c.length;d+=1){const[u,m]=c[d];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=vt((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=vt((o,r,l)=>{const{key:a,offsetRow:c}=this.getCachedModelRowOffset(o,l);if(a!=null){const d=o.get(a);if(d!==void 0)return`${a}.${d.textForCell(r,c)}`}return`${r},${c}`}),this.getCachedIsRowExpandable=vt((o,r,l)=>this.getCachedDepthForRow(o,r)<l),this.getCachedIsRowExpanded=vt((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=vt((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(e,t){return this.getCachedTextForCell(this.children,e,t)}textForRowHeader(e){return this.getCachedTextForRowHeader(this.children,e)}isRowMovable(e){return!1}get hasExpandableRows(){return!0}get floatingBottomRowCount(){return 0}isRowExpandable(e){return this.getCachedIsRowExpandable(this.children,e,this.maxDepth)}isRowExpanded(e){return this.getCachedIsRowExpanded(this.children,e)}setRowExpanded(e,t){const{key:n,offsetRow:s}=this.getCachedModelRowOffset(this.children,e),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,t),this.numRows+=o.rowCount-r}}else if(t){const o=new os({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(e){return this.getCachedDepthForRow(this.children,e)}};let mi=os;mi.DEFAULT_ROW_COUNT=1e9;mi.DEFAULT_COLUMN_COUNT=100;mi.DEFAULT_CHILD_ROW_COUNT_FACTOR=.01;mi.MIN_CHILD_ROW_COUNT=10;mi.MAX_DEPTH=10;const{dh:I}=globalThis,po=D.exports.shape({name:D.exports.string.isRequired,type:D.exports.string.isRequired,description:D.exports.string,constituentType:D.exports.string}),Aa=D.exports.shape({not:D.exports.func.isRequired,and:D.exports.func.isRequired,or:D.exports.func.isRequired}),Ah=D.exports.shape({asc:D.exports.func.isRequired,desc:D.exports.func.isRequired,abs:D.exports.func.isRequired,column:po.isRequired,direction:D.exports.string.isRequired,isAbs:D.exports.bool.isRequired}),Oh=D.exports.shape({columns:D.exports.arrayOf(po).isRequired,customColumns:D.exports.arrayOf(D.exports.string).isRequired,filter:D.exports.arrayOf(Aa),addEventListener:D.exports.func.isRequired,removeEventListener:D.exports.func.isRequired,size:D.exports.number.isRequired,sort:D.exports.arrayOf(D.exports.any),copy:D.exports.func.isRequired,applyFilter:D.exports.func.isRequired,applySort:D.exports.func.isRequired,applyCustomColumns:D.exports.func.isRequired,description:D.exports.string}),kh=D.exports.shape({columns:D.exports.arrayOf(po),filter:D.exports.arrayOf(D.exports.any),isExpanded:D.exports.func.isRequired,saveExpandedState:D.exports.func.isRequired,addEventListener:D.exports.func.isRequired,removeEventListener:D.exports.func.isRequired,size:D.exports.number.isRequired,sort:D.exports.arrayOf(D.exports.any),applyFilter:D.exports.func.isRequired,applySort:D.exports.func.isRequired}),$i=D.exports.shape({name:D.exports.string.isRequired,type:D.exports.string.isRequired}),Lh=D.exports.shape({created:D.exports.arrayOf($i).isRequired,updated:D.exports.arrayOf($i).isRequired,removed:D.exports.arrayOf($i).isRequired}),Ph=D.exports.shape({groupingColumns:D.exports.arrayOf(D.exports.string),aggregations:D.exports.shape({}),includeConstituents:D.exports.bool,includeOriginalColumns:D.exports.bool,includeDescriptions:D.exports.bool}),Hh=D.exports.shape({addEventListener:D.exports.func.isRequired,removeEventListener:D.exports.func.isRequired,onLogMessage:D.exports.func,getTable:D.exports.func.isRequired,runCode:D.exports.func.isRequired});Object.freeze({Column:po,FilterCondition:Aa,IdeSession:Hh,RollupConfig:Ph,Sort:Ah,Table:Oh,TreeTable:kh,VariableChanges:Lh,VariableDefinition:$i});const _h=1e4;function Vh(e,t,n=_h){return new Promise((s,i)=>{let o;const r=setTimeout(()=>{o==null||o(),i(new gr(`Variable ${t} not found`))},n);function l(a){const c=a.created.find(d=>d.title===t);c!=null&&(clearTimeout(r),o==null||o(),s(c))}o=e.subscribeToFieldUpdates(l)})}class ke{static isValid(t){return!0}static isSameFormat(t,n){throw new Error("isSameFormat not implemented")}static makeFormat(t,n,s){return{label:t,formatString:n,type:s}}format(t,n){return""}}ke.TYPE_GLOBAL="type-global";ke.TYPE_CONTEXT_PRESET="type-context-preset";ke.TYPE_CONTEXT_CUSTOM="type-context-custom";class Uh extends ke{format(t){switch(t){case 1:case!0:return"true";case 0:case!1:return"false";default:return""}}}class Bh extends ke{format(t){return String.fromCharCode(t)}}const Sl=ne.module("DateTimeColumnFormatter"),rs=class extends ke{constructor({timeZone:e="",showTimeZone:t=!0,showTSeparator:n=!1,defaultDateTimeFormatString:s=rs.DEFAULT_DATETIME_FORMAT_STRING}={}){super();const i=e||rs.DEFAULT_TIME_ZONE_ID;try{this.dhTimeZone=I.i18n.TimeZone.getTimeZone(i)}catch{Sl.error("Unsupported time zone id",i),this.dhTimeZone=I.i18n.TimeZone.getTimeZone(rs.DEFAULT_TIME_ZONE_ID)}this.defaultDateTimeFormatString=s,this.showTimeZone=t,this.showTSeparator=n,this.formatStringMap=rs.makeFormatStringMap(t,n)}static isValid(e){try{return I.i18n.DateTimeFormat.format(e.formatString,new Date),!0}catch{return!1}}static makeFormat(e,t,n=ke.TYPE_CONTEXT_PRESET){return{label:e,formatString:t,type:n}}static isSameFormat(e,t){return e===t||e!==null&&t!==null&&e.type===t.type&&e.formatString===t.formatString}static makeGlobalFormatStringMap(e,t){const n=t?"'T'":" ",s=e?" 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(e,t){return[...rs.makeGlobalFormatStringMap(e,t).keys()]}static makeFormatStringMap(e,t){const n=t!==void 0&&t?"'T'":" ",s=e!==void 0&&e?" 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(e,t){return[...rs.makeFormatStringMap(e,t).keys()]}getEffectiveFormatString(e){var t;return(t=this.formatStringMap.get(e))!=null?t:e}format(e,t={}){const n=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultDateTimeFormatString,s=this.getEffectiveFormatString(n);try{return I.i18n.DateTimeFormat.format(s,e,this.dhTimeZone)}catch{Sl.error("Invalid format arguments")}return""}};let Kn=rs;Kn.DEFAULT_DATETIME_FORMAT_STRING="yyyy-MM-dd HH:mm:ss.SSS";Kn.DEFAULT_TIME_ZONE_ID="America/New_York";const Gh=ne.module("DecimalColumnFormatter"),Pt=class extends ke{constructor({defaultFormatString:e=Pt.DEFAULT_FORMAT_STRING}={}){super(),this.defaultFormatString=e}static isValid(e){try{return I.i18n.NumberFormat.format(e.formatString,0),!0}catch{return!1}}static makeFormat(e,t,n=ke.TYPE_CONTEXT_PRESET,s){return{label:e,type:n,formatString:t,multiplier:s}}static makePresetFormat(e,t="",n){return Pt.makeFormat(e,t,ke.TYPE_CONTEXT_PRESET,n)}static makeCustomFormat(e="",t){return Pt.makeFormat("Custom Format",e,ke.TYPE_CONTEXT_CUSTOM,t)}static isSameFormat(e,t){return e===t||e!=null&&t!=null&&e.type===t.type&&e.formatString===t.formatString&&e.multiplier===t.multiplier}format(e,t={}){const n=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,s=t.multiplier!==void 0&&t.multiplier!==0?e*t.multiplier:e;try{return I.i18n.NumberFormat.format(n,s)}catch{Gh.error("Invalid format arguments")}return""}};let _e=Pt;_e.DEFAULT_FORMAT_STRING="###,##0.0000";_e.FORMAT_PERCENT=Pt.makePresetFormat("Percent","##0.00%");_e.FORMAT_BASIS_POINTS=Pt.makePresetFormat("Basis Points","###,##0 bp",1e4);_e.FORMAT_MILLIONS=Pt.makePresetFormat("Millions","###,##0.000 mm",1e-6);_e.FORMAT_SCIENTIFIC_NOTATION=Pt.makePresetFormat("Scientific Notation","0.0000E0");_e.FORMAT_ROUND=Pt.makePresetFormat("Round","###,##0");_e.FORMAT_ROUND_TWO_DECIMALS=Pt.makePresetFormat("0.00","###,##0.00");_e.FORMAT_ROUND_FOUR_DECIMALS=Pt.makePresetFormat("0.0000","###,##0.0000");class zh extends ke{format(t){return`${t}`}}const Wh=ne.module("IntegerColumnFormatter"),ks=class extends ke{constructor({defaultFormatString:e=ks.DEFAULT_FORMAT_STRING}={}){super(),this.defaultFormatString=e}static isValid(e){try{return I.i18n.NumberFormat.format(e.formatString,0),!0}catch{return!1}}static makeFormat(e,t,n=ke.TYPE_CONTEXT_PRESET,s){return{label:e,type:n,formatString:t,multiplier:s}}static makePresetFormat(e,t="",n){return ks.makeFormat(e,t,ke.TYPE_CONTEXT_PRESET,n)}static makeCustomFormat(e="",t){return ks.makeFormat("Custom Format",e,ke.TYPE_CONTEXT_CUSTOM,t)}static isSameFormat(e,t){return e===t||e!=null&&t!=null&&e.type===t.type&&e.formatString===t.formatString&&e.multiplier===t.multiplier}format(e,t={}){const n=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,s=t.multiplier!==void 0&&t.multiplier!==0?e*t.multiplier:e;try{return I.i18n.NumberFormat.format(n,s)}catch{Wh.error("Invalid format arguments")}return""}};let Ot=ks;Ot.DEFAULT_FORMAT_STRING="###,##0";Ot.FORMAT_MILLIONS=ks.makePresetFormat("Millions","###,##0.000 mm",1e-6);Ot.FORMAT_SCIENTIFIC_NOTATION=ks.makePresetFormat("Scientific Notation","0.0000E0");class $h extends ke{format(t){return t}}const ut=class{static makeDateWrapper(e,t,n=0,s=1,i=0,o=0,r=0,l=0){if(!e)throw new Error("No timezone provided");const a=`${t}`.padStart(4,"0"),c=`${n+1}`.padStart(2,"0"),d=`${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}-${d} ${u}:${m}:${p}.${g}`;return I.i18n.DateTimeFormat.parse(ut.FULL_DATE_FORMAT,f,I.i18n.TimeZone.getTimeZone(e))}static getNextNanos(e){const t=parseInt(e,10),n="0".repeat(9-e.length),s=`${t+1}${n}`;return parseInt(s,10)}static getNextDate(e,t,n){let{year:s,month:i,date:o,hours:r,minutes:l,seconds:a,nanos:c}=t;if(e.nanos!=null){if(e.nanos.length===9)return null;c=ut.getNextNanos(e.nanos),c>999999999&&(a+=1,c=0)}else e.seconds!=null?a+=1:e.minutes!=null?l+=1:e.hours!=null?r+=1:e.date!=null?o+=1:e.month!=null?i+=1:s+=1;const d=new Date(s,i,o,r,l,a);return ut.makeDateWrapper(n,d.getFullYear(),d.getMonth(),d.getDate(),d.getHours(),d.getMinutes(),d.getSeconds(),c)}static parseMonth(e){const t=parseInt(e,10);if(!Number.isNaN(t))return t>=1&&t<=12?t-1:NaN;const n=e.trim().toLowerCase();if(n.length>=3){for(let s=0;s<ut.months.length;s+=1)if(ut.months[s].startsWith(n))return s}return NaN}static parseDateValues(e,t,n,s,i,o,r){const l=parseInt(e,10),a=t!=null?this.parseMonth(t):0,c=n!=null?parseInt(n,10):1,d=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(d)||Number.isNaN(u)||Number.isNaN(m)||Number.isNaN(p)?null:{year:l,month:a,date:c,hours:d,minutes:u,seconds:m,nanos:p}}static parseDateTimeString(e){const n=/\s*(\d{4})([-./]([\da-z]+))?([-./](\d{1,2}))?([tT\s](\d{2})([:](\d{2}))?([:](\d{2}))?([.](\d{1,9}))?)?(.*)/.exec(e);if(n==null)throw new Error(`Unexpected date string: ${e}`);const[,s,,i,,o,,r,,l,,a,,c,d]=n;if(d!=null&&d.length>0)throw new Error(`Unexpected characters after date string '${e}': ${d}`);return{year:s,month:i,date:o,hours:r,minutes:l,seconds:a,nanos:c}}static parseDateRange(e,t){const n=e.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=ut.makeDateWrapper(t,l.getFullYear(),l.getMonth(),l.getDate()),c=ut.makeDateWrapper(t,l.getFullYear(),l.getMonth(),l.getDate()+1);return[a,c]}if(n==="yesterday"){const l=new Date(Date.now()),a=ut.makeDateWrapper(t,l.getFullYear(),l.getMonth(),l.getDate()-1),c=ut.makeDateWrapper(t,l.getFullYear(),l.getMonth(),l.getDate());return[a,c]}if(n==="now"){const l=new Date(Date.now());return[I.DateWrapper.ofJsDate(l),null]}const s=ut.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=ut.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=ut.makeDateWrapper(t,i.year,i.month,i.date,i.hours,i.minutes,i.seconds,i.nanos),r=ut.getNextDate(s,i,t);return[o,r]}static getJsDate(e){return typeof e=="number"?new Date(e):e.asDate()}};let Yn=ut;Yn.FULL_DATE_FORMAT="yyyy-MM-dd HH:mm:ss.SSSSSSSSS";Yn.months=["january","february","march","april","may","june","july","august","september","october","november","december"];class jt{}jt.not="not";jt.and="and";jt.or="or";function qh(e){if(!(e==="not"||e==="and"||e==="or"))throw new Error("operator is not a valid FilterOperatorValue")}class W{}W.eq="eq";W.eqIgnoreCase="eqIgnoreCase";W.notEq="notEq";W.notEqIgnoreCase="notEqIgnoreCase";W.greaterThan="greaterThan";W.greaterThanOrEqualTo="greaterThanOrEqualTo";W.lessThan="lessThan";W.lessThanOrEqualTo="lessThanOrEqualTo";W.in="in";W.inIgnoreCase="inIgnoreCase";W.notIn="notIn";W.notInIgnoreCase="notInIgnoreCase";W.isTrue="isTrue";W.isFalse="isFalse";W.isNull="isNull";W.invoke="invoke";W.contains="contains";W.notContains="notContains";W.startsWith="startsWith";W.endsWith="endsWith";W.containsAny="containsAny";function Kh(e){switch(e){case W.eq:return"is exactly";case W.eqIgnoreCase:return"is exactly (ignore case)";case W.notEq:return"is not exactly";case W.notEqIgnoreCase:return"is not exactly (ignore case)";case W.contains:return"contains";case W.notContains:return"does not contain";case W.startsWith:return"starts with";case W.endsWith:return"ends with";default:throw new Error(`Unrecognized text filter type ${e}`)}}function Xh(e){switch(e){case W.eq:return"is equal to";case W.notEq:return"is not equal to";case W.greaterThan:return"greater than";case W.greaterThanOrEqualTo:return"greater than or equal to";case W.lessThan:return"less than";case W.lessThanOrEqualTo:return"less than or equal to";default:throw new Error(`Unrecognized number filter type ${e}`)}}function Yh(e){switch(e){case W.eq:return"date is";case W.notEq:return"date is not";case W.notEqIgnoreCase:case W.greaterThan:return"date is after";case W.greaterThanOrEqualTo:return"date is after or equal";case W.lessThan:return"date is before";case W.lessThanOrEqualTo:return"date is before or equal";default:throw new Error(`Unrecognized date filter type ${e}`)}}function Qh(e){switch(e){case W.isTrue:return"Is True";case W.isFalse:return"Is False";case W.isNull:return"Is Null";default:throw new Error(`Unrecognized boolean filter type ${e}`)}}const dn=ne.module("TableUtils"),Y=class{static getSortIndex(e,t){var n;for(let s=0;s<e.length;s+=1)if(((n=e[s].column)==null?void 0:n.index)===t)return s;return null}static getSortForColumn(e,t){const n=Y.getSortIndex(e,t);return n!=null?e[n]:null}static getFilterText(e){return e?e.toString():null}static getFilterTypes(e){return Y.isBooleanType(e)?[W.isTrue,W.isFalse,W.isNull]:Y.isCharType(e)||Y.isNumberType(e)||Y.isDateType(e)?[W.eq,W.notEq,W.greaterThan,W.greaterThanOrEqualTo,W.lessThan,W.lessThanOrEqualTo]:Y.isTextType(e)?[W.eq,W.eqIgnoreCase,W.notEq,W.notEqIgnoreCase,W.contains,W.notContains,W.startsWith,W.endsWith]:[]}static getNextSort(e,t,n){if(e==null||n<0||n>=e.length)return null;const s=Y.getSortForColumn(t,n);return s===null?e[n].sort().asc():s.direction===Y.sortDirection.ascending?s.desc():null}static makeColumnSort(e,t,n,s){if(e==null||t<0||t>=e.length||n===Y.sortDirection.none)return null;let i=e[t].sort();switch(n){case Y.sortDirection.ascending:i=i.asc();break;case Y.sortDirection.descending:i=i.desc();break}return s&&(i=i.abs()),i}static toggleSortForColumn(e,t,n,s=!1){if(n<0||n>=t.length)return[];const i=Y.getNextSort(t,e,n);return Y.setSortForColumn(e,n,i,s)}static sortColumn(e,t,n,s,i,o){if(e==null||n<0||n>=t.length)return[];const r=Y.makeColumnSort(t,n,s,i);return Y.setSortForColumn(e,n,r,o)}static setSortForColumn(e,t,n,s=!1){const i=Y.getSortIndex(e,t);let o=[];return s&&(o=o.concat(e.filter(({direction:r})=>r!==Y.sortDirection.reverse)),i!==null&&o.splice(i,1)),n!==null&&o.push(n),o}static getNormalizedType(e){switch(e){case"boolean":case"java.lang.Boolean":case Y.dataType.BOOLEAN:return Y.dataType.BOOLEAN;case"char":case"java.lang.Character":case Y.dataType.CHAR:return Y.dataType.CHAR;case"java.lang.String":case Y.dataType.STRING:return Y.dataType.STRING;case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":case Y.dataType.DATETIME:return Y.dataType.DATETIME;case"double":case"java.lang.Double":case"float":case"java.lang.Float":case"java.math.BigDecimal":case Y.dataType.DECIMAL:return Y.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 Y.dataType.INT:return Y.dataType.INT;default:return Y.dataType.UNKNOWN}}static isLongType(e){switch(e){case"long":case"java.lang.Long":return!0;default:return!1}}static isDateType(e){switch(e){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(e){return Y.isIntegerType(e)||Y.isDecimalType(e)}static isIntegerType(e){switch(e){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(e){switch(e){case"double":case"java.lang.Double":case"java.math.BigDecimal":case"float":case"java.lang.Float":return!0;default:return!1}}static isBooleanType(e){switch(e){case"boolean":case"java.lang.Boolean":return!0;default:return!1}}static isCharType(e){switch(e){case"char":case"java.lang.Character":return!0;default:return!1}}static isStringType(e){switch(e){case"java.lang.String":return!0;default:return!1}}static isTextType(e){return this.isStringType(e)||this.isCharType(e)}static getBaseType(e){return e.split("[]")[0]}static isCompatibleType(e,t){return Y.getNormalizedType(e)===Y.getNormalizedType(t)}static makeQuickFilter(e,t,n){const s=t.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 d=l[c].trim();if(d.length>0){const u=Y.makeQuickFilterFromComponent(e,d,n);if(u)a?a=a.and(u):a=u;else throw new Error(`Unable to parse quick filter from text ${t}`)}}i&&a?i=i.or(a):i=a}return i}static makeQuickFilterFromComponent(e,t,n){const{type:s}=e;return Y.isNumberType(s)?this.makeQuickNumberFilter(e,t):Y.isBooleanType(s)?this.makeQuickBooleanFilter(e,t):n!=null&&Y.isDateType(s)?this.makeQuickDateFilter(e,t,n):Y.isCharType(s)?this.makeQuickCharFilter(e,t):this.makeQuickTextFilter(e,t)}static makeQuickNumberFilter(e,t){if(t==null)return null;const n=e.filter();let s=null;const o=/\s*(>=|<=|=>|=<|>|<|!=|=|!)?(\s*-\s*)?(\s*\d*(?:,\d{3})*(?:\.\d*)?\s*)?(null|nan|infinity|inf|\u221E)?(.*)/i.exec(t);let r=null,l=null,a=null,c=null,d=null;if(o!==null&&o.length>3&&([,r,l,a,c,d]=o),d!=null&&d.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=I.FilterCondition.invoke("isNaN",n);break;case"infinity":case"inf":case"\u221E":l!=null?s=I.FilterCondition.invoke("isInf",n).and(n.lessThan(I.FilterValue.ofNumber(0))):s=I.FilterCondition.invoke("isInf",n).and(n.greaterThan(I.FilterValue.ofNumber(0)));break}return s!==null&&(r==="!"||r==="!=")&&(s=s.not()),s}if(a==null)return null;if(a=Y.removeCommas(a),Y.isLongType(e.type))try{a=I.FilterValue.ofNumber(I.LongWrapper.ofString(`${l!=null?"-":""}${a}`))}catch(u){return dn.warn("Unable to create long filter",u),null}else{if(a=parseFloat(a),a==null||Number.isNaN(a))return null;a=I.FilterValue.ofNumber(l!=null?0-a:a)}return s=e.filter(),Y.makeRangeFilterWithOperation(s,r,a)}static makeQuickTextFilter(e,t){if(t==null)return null;const n=`${t}`.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=e.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",I.FilterValue.ofString(`(?s)(?i).*\\Q${r}\\E.*`)));case"!~":return l.isNull().or(l.invoke("matches",I.FilterValue.ofString(`(?s)(?i).*\\Q${r}\\E.*`)).not());case"!=":return a==="*"?l.isNull().or(l.invoke("matches",I.FilterValue.ofString(`(?s)(?i).*\\Q${r}\\E$`)).not()):c==="*"?l.isNull().or(l.invoke("matches",I.FilterValue.ofString(`(?s)(?i)^\\Q${r}\\E.*`)).not()):l.notEqIgnoreCase(I.FilterValue.ofString(r.toLowerCase()));case"=":return a==="*"?l.isNull().not().and(l.invoke("matches",I.FilterValue.ofString(`(?s)(?i).*\\Q${r}\\E$`))):c==="*"?l.isNull().not().and(l.invoke("matches",I.FilterValue.ofString(`(?s)(?i)^\\Q${r}\\E.*`))):l.eqIgnoreCase(I.FilterValue.ofString(r.toLowerCase()))}return null}static makeQuickBooleanFilter(e,t){if(t==null)return null;const s=/^(!=|=|!)?(.*)/.exec(`${t}`.trim());if(s===null)return null;const[,i,o]=s,r=i==="!"||i==="!=",l=o.trim().toLowerCase();let a=e.filter();try{const c=Y.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(e,t,n){const s=t.trim(),o=/\s*(>=|<=|=>|=<|>|<|!=|!|=)?(.*)/.exec(s);if(o==null||o.length<=2)throw new Error(`Unable to parse date filter: ${t}`);let r=null,l=null;[,r,l]=o;let a=W.eq;switch(r){case"<":a=W.lessThan;break;case"<=":case"=<":a=W.lessThanOrEqualTo;break;case">":a=W.greaterThan;break;case">=":case"=>":a=W.greaterThanOrEqualTo;break;case"!=":case"!":a=W.notEq;break;case"=":case"==":default:a=W.eq;break}return Y.makeQuickDateFilterWithOperation(e,l,a,n)}static makeQuickDateFilterWithOperation(e,t,n,s){if(e==null)throw new Error("Column is null");const[i,o]=Yn.parseDateRange(t,s),r=i!=null?I.FilterValue.ofNumber(i):null,l=o!=null?I.FilterValue.ofNumber(o):null,a=e.filter();if(r==null)return n===W.notEq?a.isNull().not():a.isNull();switch(n){case W.eq:{if(l!=null){const c=a.greaterThanOrEqualTo(r),d=a.lessThan(l);return c.and(d)}return a.eq(r)}case W.lessThan:return a.lessThan(r);case W.lessThanOrEqualTo:return l!=null?a.lessThan(l):a.lessThanOrEqualTo(r);case W.greaterThan:return l!=null?a.greaterThanOrEqualTo(l):a.greaterThan(r);case W.greaterThanOrEqualTo:return a.greaterThanOrEqualTo(r);case W.notEq:{if(l!=null){const c=a.lessThan(r),d=a.greaterThanOrEqualTo(l);return c.or(d)}return a.notEq(r)}default:throw new Error(`Invalid operator: ${n}`)}}static quoteValue(e){return e.length>=2&&(e.charAt(0)==='"'&&e.charAt(e.length-1)==='"'||e.charAt(0)==="'"&&e.charAt(e.length-1)==="'")?e:`"${e}"`}static isRangeOperation(e){switch(e){case"<":case"<=":case"=<":case">":case">=":case"=>":return!0;default:return!1}}static makeQuickCharFilter(e,t){if(t==null)return null;const n=`${t}`.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=e.filter();if(r.toLowerCase()==="null")switch(o){case"=":return a.isNull();case"!=":case"!":return a.isNull().not();default:return null}const c=I.FilterValue.ofString(Y.isRangeOperation(o)?Y.quoteValue(r):r);return Y.makeRangeFilterWithOperation(a,o,c)}static makeRangeFilterWithOperation(e,t,n){switch(t){case"=":return e.eq(n);case"<":return e.lessThan(n);case"<=":case"=<":return e.lessThanOrEqualTo(n);case">":return e.greaterThan(n);case">=":case"=>":return e.greaterThanOrEqualTo(n);case"!=":case"!":return e.notEq(n);default:return null}}static makeCancelableTablePromise(e){return Pe.makeCancelable(e,t=>{t.close()})}static makeCancelableTableEventPromise(e,t,n=0,s=null){let i,o,r=!0;const l=new Promise((a,c)=>{o=setTimeout(()=>{i(),r=!1,c(new gr(`Event "${t}" timed out.`))},n),i=e.addEventListener(t,d=>{if(s!=null&&!s(d)){dn.debug2("Event triggered, but matcher returned false.");return}dn.debug2("Event triggered, resolving."),i(),clearTimeout(o),r=!1,a(d)})});return l.cancel=()=>{if(r){dn.debug2("Pending promise cleanup."),i(),clearTimeout(o),r=!1;return}dn.debug2("Ignoring non-pending promise cancel.")},l}static makeAdvancedFilter(e,t,n){const{filterItems:s,filterOperators:i,invertSelection:o,selectedValues:r}=t;let l=null;for(let c=0;c<s.length;c+=1){const d=s[c],{selectedType:u,value:m}=d;if(u!=null&&u.length>0&&m!=null&&m.length>0)try{const p=Y.makeAdvancedValueFilter(e,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===jt.and)l=l.and(p);else if(g===jt.or)l=l.or(p);else{dn.error("Unexpected filter operator",g,p),l=null;break}}}else dn.debug2("Empty filter ignored for",u,m)}catch(p){dn.error("Unable to create filter",p),l=null;break}}const a=Y.makeSelectValueFilter(e,r,o);return a!=null&&(l!=null?l=l.and(a):l=a),l}static removeCommas(e){return e.replace(/[\s|,]/g,"")}static makeFilterValue(e,t){const n=Y.getBaseType(e);return Y.isTextType(n)?I.FilterValue.ofString(t):Y.isLongType(n)?I.FilterValue.ofNumber(I.LongWrapper.ofString(Y.removeCommas(t))):I.FilterValue.ofNumber(Y.removeCommas(t))}static makeFilterRawValue(e,t){return Y.isTextType(e)?I.FilterValue.ofString(t):Y.isBooleanType(e)?I.FilterValue.ofBoolean(t):I.FilterValue.ofNumber(t)}static makeValue(e,t,n){if(t==null||t==="null")return null;if(Y.isTextType(e))return t;if(Y.isLongType(e))return I.LongWrapper.ofString(Y.removeCommas(t));if(Y.isBooleanType(e))return Y.makeBooleanValue(t,!0);if(Y.isDateType(e)){const[s]=Yn.parseDateRange(t,n);return s}return Y.isNumberType(e)?Y.makeNumberValue(t):(dn.error("Unexpected column type",e),null)}static makeBooleanValue(e,t=!1){if(e===""&&t)return null;switch(e==null?void 0:e.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 '${e}'`)}}static makeNumberValue(e){if(e==null||e==="null"||e==="")return null;const t=e.toLowerCase().trim();if(t==="\u221E"||t==="infinity"||t==="inf")return Number.POSITIVE_INFINITY;if(t==="-\u221E"||t==="-infinity"||t==="-inf")return Number.NEGATIVE_INFINITY;const n=Y.removeCommas(t);if(Y.NUMBER_REGEX.test(n))return parseFloat(n);throw new Error(`Invalid number '${e}'`)}static getFilterOperatorString(e){switch(e){case W.eq:return"=";case W.notEq:return"!=";case W.greaterThan:return">";case W.greaterThanOrEqualTo:return">=";case W.lessThan:return"<";case W.lessThanOrEqualTo:return"<=";case W.contains:return"~";case W.notContains:return"!~";default:throw new Error(`Unexpected filter type ${e}`)}}static makeAdvancedValueFilter(e,t,n,s){if(Y.isDateType(e.type))return Y.makeQuickDateFilterWithOperation(e,n,t,s);if(Y.isNumberType(e.type)||Y.isCharType(e.type))return Y.makeQuickFilter(e,`${Y.getFilterOperatorString(t)}${n}`);const i=Y.makeFilterValue(e.type,n),o=e.filter();switch(t){case W.eq:return o.eq(i);case W.eqIgnoreCase:return o.eqIgnoreCase(i);case W.notEq:return o.notEq(i);case W.notEqIgnoreCase:return o.notEqIgnoreCase(i);case W.greaterThan:return o.greaterThan(i);case W.greaterThanOrEqualTo:return o.greaterThanOrEqualTo(i);case W.lessThan:return o.lessThan(i);case W.lessThanOrEqualTo:return o.lessThanOrEqualTo(i);case W.isTrue:return o.isTrue();case W.isFalse:return o.isFalse();case W.isNull:return o.isNull();case W.contains:return o.isNull().not().and(o.invoke("matches",I.FilterValue.ofString(`(?s)(?i).*\\Q${n}\\E.*`)));case W.notContains:return o.isNull().or(o.invoke("matches",I.FilterValue.ofString(`(?s)(?i).*\\Q${n}\\E.*`)).not());case W.startsWith:return o.isNull().not().and(o.invoke("matches",I.FilterValue.ofString(`(?s)(?i)^\\Q${n}\\E.*`)));case W.endsWith:return o.isNull().not().and(o.invoke("matches",I.FilterValue.ofString(`(?s)(?i).*\\Q${n}\\E$`)));case W.in:case W.inIgnoreCase:case W.notIn:case W.notInIgnoreCase:case W.invoke:default:throw new Error(`Unexpected filter operation: ${t}`)}}static makeSelectValueFilter(e,t,n){if(t.length===0){if(n)return null;let o=null;Y.isTextType(e.type)?o=I.FilterValue.ofString("a"):Y.isBooleanType(e.type)?o=I.FilterValue.ofBoolean(!0):Y.isDateType(e.type)?o=I.FilterValue.ofNumber(I.DateWrapper.ofJsDate(new Date)):o=I.FilterValue.ofNumber(0);const r=e.filter().eq(o),l=e.filter().notEq(o);return r.and(l)}const s=[];let i=!1;for(let o=0;o<t.length;o+=1){const r=t[o];r==null?i=!0:Y.isTextType(e.type)?s.push(I.FilterValue.ofString(typeof r=="number"?String.fromCharCode(r):r)):Y.isBooleanType(e.type)?s.push(I.FilterValue.ofBoolean(Boolean(r))):s.push(I.FilterValue.ofNumber(r))}return i?s.length>0?n?e.filter().isNull().not().and(e.filter().notIn(s)):e.filter().isNull().or(e.filter().in(s)):n?e.filter().isNull().not():e.filter().isNull():n?e.filter().notIn(s):e.filter().in(s)}static isTreeTable(e){return e!=null&&e.expand!==void 0&&e.collapse!==void 0}static sortColumns(e,t=!0){return[...e].sort((n,s)=>{const i=n.name.toUpperCase(),o=s.name.toUpperCase();return fr.sort(i,o,t)})}};let A=Y;A.dataType={BOOLEAN:"boolean",CHAR:"char",DATETIME:"datetime",DECIMAL:"decimal",INT:"int",STRING:"string",UNKNOWN:"unknown"};A.sortDirection={ascending:"ASC",descending:"DESC",reverse:"REVERSE",none:null};A.REVERSE_TYPE=Object.freeze({NONE:"none",PRE_SORT:"pre-sort",POST_SORT:"post-sort"});A.NUMBER_REGEX=/^-?\d+(\.\d+)?$/;class en{static makeColumnFormatMap(t){return t==null?new Map:t.reduce((n,s)=>{const i=A.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(t,n,s){return{columnType:t,columnName:n,format:s}}constructor(t=[],n,s,i,o=!1){this.defaultColumnFormatter=new zh,this.typeFormatterMap=new Map([[A.dataType.BOOLEAN,new Uh],[A.dataType.CHAR,new Bh],[A.dataType.DATETIME,new Kn(n)],[A.dataType.DECIMAL,new _e(s)],[A.dataType.INT,new Ot(i)],[A.dataType.STRING,new $h]]),this.columnFormatMap=en.makeColumnFormatMap(t),this.truncateNumbersWithPound=o}getColumnFormatMapForType(t,n=!1){const s=A.getNormalizedType(t);if(s!==null)return n&&!this.columnFormatMap.has(s)&&this.columnFormatMap.set(s,new Map),this.columnFormatMap.get(s)}getColumnFormat(t,n){var i;const s=this.getColumnFormatMapForType(t);return(i=s==null?void 0:s.get(n))!=null?i:null}getColumnTypeFormatter(t){var i;const n=A.getNormalizedType(t);let s=this.defaultColumnFormatter;return n&&(s=(i=this.typeFormatterMap.get(n))!=null?i:s),s}getFormattedString(t,n,s="",i){if(t==null)return"";const o=this.getColumnTypeFormatter(n),r=i||this.getColumnFormat(n,s);return o.format(t,r!=null?r:void 0)}get timeZone(){var n;const t=this.typeFormatterMap.get(A.dataType.DATETIME);return(n=t==null?void 0:t.dhTimeZone)==null?void 0:n.id}}function jh(e){if(e&&e.formatter){const{formatter:t}=e;return t}}function Zh(e){return{timeZone:e==null?void 0:e.timeZone,defaultDateTimeFormatString:e==null?void 0:e.defaultDateTimeFormat,showTimeZone:e==null?void 0:e.showTimeZone,showTSeparator:e==null?void 0:e.showTSeparator}}function Jh(e,t,n){const s=e.getColumnFormat(n,t);return s!=null&&(s.type===ke.TYPE_CONTEXT_PRESET||s.type===ke.TYPE_CONTEXT_CUSTOM)}const ds={getColumnFormats:jh,getDateTimeFormatterOptions:Zh,isCustomColumnFormatDefined:Jh};function em(e,t){const n=sm(e);return n===void 0?void 0:`${cm(e)} ? ${n} : ${t}`}function tm(e){return dh.Column.formatRowColor(e)}function nm(e,t){return e.formatColor(t)}const Lo=ne.module("ConditionalFormattingUtils");var sn=(e=>(e.CONDITIONAL="conditional",e.ROWS="rows",e))(sn||{}),De=(e=>(e.IS_EQUAL="is-equal",e.IS_NOT_EQUAL="is-not-equal",e.IS_BETWEEN="is-between",e.GREATER_THAN="greater-than",e.GREATER_THAN_OR_EQUAL="greater-than-or-equal",e.LESS_THAN="less-than",e.LESS_THAN_OR_EQUAL="less-than-or-equal",e.IS_NULL="is-null",e.IS_NOT_NULL="is-not-null",e))(De||{}),bt=(e=>(e.IS_EXACTLY="is-exactly",e.IS_NOT_EXACTLY="is-not-exactly",e.CONTAINS="contains",e.DOES_NOT_CONTAIN="does-not-contain",e.STARTS_WITH="starts-with",e.ENDS_WITH="ends-with",e.IS_NULL="is-null",e.IS_NOT_NULL="is-not-null",e))(bt||{}),rt=(e=>(e.IS_EXACTLY="is-exactly",e.IS_NOT_EXACTLY="is-not-exactly",e.IS_BEFORE="is-before",e.IS_BEFORE_OR_EQUAL="is-before-or-equal",e.IS_AFTER="is-after",e.IS_AFTER_OR_EQUAL="is-after-or-equal",e.IS_NULL="is-null",e.IS_NOT_NULL="is-not-null",e))(rt||{}),ii=(e=>(e.IS_TRUE="is-true",e.IS_FALSE="is-false",e.IS_NULL="is-null",e.IS_NOT_NULL="is-not-null",e))(ii||{}),cs=(e=>(e.IS_EQUAL="is-equal",e.IS_NOT_EQUAL="is-not-equal",e.IS_NULL="is-null",e.IS_NOT_NULL="is-not-null",e))(cs||{}),$t=(e=>(e.NO_FORMATTING="no-formatting",e.POSITIVE="positive",e.NEGATIVE="negative",e.WARN="warn",e.NEUTRAL="neutral",e.ACCENT_1="accent-1",e.ACCENT_2="accent-2",e.CUSTOM="custom",e))($t||{});function vl(e){switch(e){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 Qi(e){const{type:t,customConfig:n}=e;switch(t){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 ji(e){const{type:t,customConfig:n}=e;switch(t){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 sm(e){const t=ji(e.style),n=Qi(e.style);if(!(t===void 0||n===void 0))return`bgfg(\`${n}\`, \`${t}\`)`}function im(e){const{column:t,value:n,start:s,end:i}=e;return vm(t.name,e.condition,n,s,i)}function om(e){const{column:t,value:n}=e;return Tm(t.name,e.condition,n)}function rm(e){const{column:t,value:n}=e;return Em(t.name,e.condition,n)}function lm(e){const{column:t}=e;return ym(t.name,e.condition)}function am(e){const{column:t,value:n}=e;return Rm(t.name,e.condition,n)}function cm(e){const{column:t}=e;if(A.isNumberType(t.type))return im(e);if(A.isCharType(t.type))return am(e);if(A.isStringType(t.type))return om(e);if(A.isDateType(t.type))return rm(e);if(A.isBooleanType(t.type))return lm(e);throw new Error("Invalid column type")}function dm(e){switch(e){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 um(e){switch(e){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 hm(e){switch(e){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 mm(e){switch(e){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 pm(e){switch(e){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 Oa(e){if(A.isNumberType(e)||A.isCharType(e))return"is-equal";if(A.isStringType(e)||A.isDateType(e))return"is-exactly";if(A.isBooleanType(e))return"is-true";throw new Error("Invalid column type")}function gm(e){if(A.isCharType(e)||A.isStringType(e))return""}function ka(e){const{condition:t,value:n,start:s,end:i}=e;return{condition:t,value:n,start:s,end:i}}function go(e){return{condition:Oa(e),value:gm(e),start:void 0,end:void 0}}function La(){return{type:"no-formatting"}}function fm(e){switch(e){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 Cm(e){switch(e){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 wm(e){switch(e){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 bm(e){switch(e){case"is-equal":return"==";case"is-not-equal":return"!=";case"is-null":return"is null";case"is-not-null":return"is not null"}}function Sm(e){switch(e){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 vm(e,t,n,s,i){switch(t){case"is-equal":return`${e} == ${n}`;case"is-not-equal":return`${e} != ${n}`;case"is-between":return`${e} > ${s} && ${e} < ${i}`;case"greater-than":return`${e} > ${n}`;case"greater-than-or-equal":return`${e} >= ${n}`;case"less-than":return`${e} < ${n}`;case"less-than-or-equal":return`${e} <= ${n}`;case"is-null":return`${e} == null`;case"is-not-null":return`${e} != null`}}function Tm(e,t,n){switch(t){case"is-exactly":return`${e} == "${n}"`;case"is-not-exactly":return`${e} != "${n}"`;case"contains":return`${e} != null && ${e}.contains("${n}")`;case"does-not-contain":return`${e} != null && !${e}.contains("${n}")`;case"starts-with":return`${e} != null && ${e}.startsWith("${n}")`;case"ends-with":return`${e} != null && ${e}.endsWith("${n}")`;case"is-null":return`${e} == null`;case"is-not-null":return`${e} != null`}}function Em(e,t,n){switch(t){case"is-exactly":return`${e} == convertDateTime("${n}")`;case"is-not-exactly":return`${e} != convertDateTime(\`${n}\`)`;case"is-before":return`${e} < convertDateTime(\`${n}\`)`;case"is-before-or-equal":return`${e} <= convertDateTime("${n}")`;case"is-after":return`${e} > convertDateTime(\`${n}\`)`;case"is-after-or-equal":return`${e} >= convertDateTime(\`${n}\`)`;case"is-null":return`${e} == null`;case"is-not-null":return`${e} != null`}}function ym(e,t){switch(t){case"is-true":return`${e} == true`;case"is-false":return`${e} == false`;case"is-null":return`${e} == null`;case"is-not-null":return`${e} != null`}}function Rm(e,t,n){switch(t){case"is-equal":return`${e} == '${n}'`;case"is-not-equal":return`${e} != '${n}'`;case"is-null":return`isNull(${e})`;case"is-not-null":return`!isNull(${e})`}}function Im(e,t){if(A.isNumberType(e))return Sm(t);if(A.isCharType(e))return bm(t);if(A.isStringType(e))return fm(t);if(A.isDateType(e))return Cm(t);if(A.isBooleanType(e))return wm(t);throw new Error("Invalid column type")}function Mm(e,t){if(t===void 0)return Lo.debug("no rules passed."),[];const n=[];let s;const i=new Map;return t.forEach(({config:o,type:r})=>{var g;const{column:l}=o,a=e.find(({name:f,type:C})=>f===l.name&&C===l.type);if(a===void 0){Lo.debug(`Column ${l.name}:${l.type} not found. Ignoring format rule.`,o);return}const[c,d]=(g=r==="conditional"?i.get(a.name):s)!=null?g:["null",void 0],u=em(o,c);if(u===void 0){Lo.debug("Ignoring format rule.",o);return}const m=d===void 0?-1:n.indexOf(d);m>-1&&n.splice(m,1);const p=r==="conditional"?nm(a,u):tm(u);n.push(p),r==="conditional"?i.set(a.name,[u,p]):s=[u,p]}),n}function Dm({type:e}){return A.isNumberType(e)||A.isCharType(e)||A.isStringType(e)||A.isDateType(e)||A.isBooleanType(e)}function fo({animation:e="iris-grid-bottom-bar-slide-up",children:t,className:n,isShown:s,onClick:i,onEntering:o,onEntered:r,onExiting:l,onExited:a}){return h(lt,{in:s,timeout:xe.transitionMs,classNames:e,onEntering:o,onEntered:r,onExiting:l,onExited:a,mountOnEnter:!0,unmountOnExit:!0,children:h("div",{className:G("iris-grid-bottom-bar",n),role:"presentation",onClick:i,onKeyPress:i,children:t})})}const Nm=3e3,Fm=5;function xm({isSaving:e=!1,onSave:t,onDiscard:n,discardTooltip:s,saveTooltip:i,error:o,pendingDataErrors:r,pendingDataMap:l,onEntering:a,onEntered:c,onExiting:d,onExited:u}){const[m,p]=T.exports.useState(!1),[g,f]=T.exports.useState(!1),C=T.exports.useRef(),w=Cr(e),b=T.exports.useMemo(()=>r.size===0?o:r.size<=Fm?`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]);T.exports.useEffect(function(){w!=null&&w&&!e&&b==null&&(p(!0),f(!0),C.current=setTimeout(()=>{p(!1)},Nm))},[b,e,w]),T.exports.useEffect(function(){C.current&&l.size>0&&(clearTimeout(C.current),p(!1),f(!1))},[l]),T.exports.useEffect(function(){return()=>C.current?clearTimeout(C.current):void 0},[]);const S=l.size;let E;return e?E=h(Ht,{}):g&&(E=ta),R(fo,{className:"pending-data-bottom-bar",isShown:S>0||m||b!=null,onEntering:a,onEntered:c,onExiting:d,onExited:()=>{f(!1),u&&u()},children:[b!=null&&b!==""&&R("div",{className:"error-message",children:[h(Q,{icon:$n}),h("span",{children:`${b}`})]}),(b==null||b==="")&&h("div",{className:"status-message",children:S>0&&h("span",{children:`${S} row${S>1?"s":""} pending`})}),R("div",{className:"buttons-container",children:[!e&&!g&&h(K,{kind:"secondary",onClick:n,tooltip:s,children:"Discard"}),R(K,{kind:g?"success":"primary",onClick:t,icon:E,disabled:e||g||b!=null,tooltip:i,children:[e&&"Committing...",!e&&g&&"Success",!e&&!g&&"Commit"]})]})]})}var Se=(e=>(e.COUNT="Count",e.MIN="Min",e.MAX="Max",e.SUM="Sum",e.ABS_SUM="AbsSum",e.VAR="Var",e.AVG="Avg",e.STD="Std",e.FIRST="First",e.LAST="Last",e.SKIP="Skip",e.COUNT_DISTINCT="CountDistinct",e.DISTINCT="Distinct",e.UNIQUE="Unique",e))(Se||{});const Am=e=>{switch(e){default:return!1}},Om=(e,t)=>{switch(e){case Se.COUNT:case Se.FIRST:case Se.LAST:case Se.COUNT_DISTINCT:case Se.DISTINCT:case Se.UNIQUE:return!0;case Se.MIN:case Se.MAX:return A.isNumberType(t)||A.isDateType(t)||A.isTextType(t);case Se.SUM:case Se.ABS_SUM:case Se.VAR:case Se.AVG:case Se.STD:return A.isNumberType(t);case Se.SKIP:return!1}},Mr=(e,t)=>e.filter(n=>Om(t,n.type)),km=(e,t,n,s)=>Mr(e,t).map(({name:i})=>i).filter(i=>n.includes(i)?!s:s),Gn={isRollupOperation:Am,filterValidColumns:Mr,getOperationColumnNames:km};var hs=(e=>(e.FILTER_CONTROL_CHANGE_CLEARS_ALL_FILTERS="filter-control-change-clears-all-filters",e.LINK_CHANGE_CLEARS_ALL_FILTERS="link-change-clears-all-filters",e))(hs||{});const Lm=Object.freeze([[hs.FILTER_CONTROL_CHANGE_CLEARS_ALL_FILTERS,!1],[hs.LINK_CHANGE_CLEARS_ALL_FILTERS,!1]]),Pm={DEFAULTS:Lm},Hm=ne.module("ColumnHeaderGroup");function Po(e){return e instanceof Yt}const Pa=class{constructor({name:e,children:t,color:n,depth:s,childIndexes:i,parent:o}){this.getVisibleRange=Ee(r=>{const l=this.childIndexes.flat(),a=B.getVisibleIndexes(l,r),c=Math.min(...a),d=Math.max(...a);return d-c!==l.length-1&&Hm.warn(`Column header group ${this.name} is not contiguous`),[c,d]}),this.name=e,this.children=t,this.color=n,this.depth=s,this.childIndexes=i,this.parent=o}setParent(e){this.parent=e}addChildren(e){const t=new Set(this.children.concat(e));this.children=[...t]}removeChildren(e){const t=new Set(this.children);e.forEach(n=>t.delete(n)),this.children=[...t]}get isNew(){return this.name.startsWith(Pa.NEW_GROUP_PREFIX)}};let Yt=Pa;Yt.NEW_GROUP_PREFIX=":newGroup";const Zs=ne.module("IrisGridUtils");function Fn(e,t){return e>=0&&e<t.length}class te{static dehydrateGridState(t,n){const{isStuckToBottom:s,isStuckToRight:i,movedColumns:o,movedRows:r}=n,{columns:l}=t;return{isStuckToBottom:s,isStuckToRight:i,movedColumns:[...o].filter(({to:a,from:c})=>Fn(a,l)&&(typeof c=="number"&&Fn(c,l)||Array.isArray(c)&&Fn(c[0],l)&&Fn(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(t,n,s=[]){const{isStuckToBottom:i,isStuckToRight:o,movedColumns:r,movedRows:l}=n,{columns:a}=t,c=te.parseCustomColumnNames(s),d=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"?d.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})=>Fn(u,d)&&(typeof m=="number"&&Fn(m,d)||Array.isArray(m)&&Fn(m[0],d)&&Fn(m[1],d))),movedRows:[...l]}}static dehydrateIrisGridState(t,n){const{aggregationSettings:s={aggregations:[],showOnTop:!1},advancedFilters:i,customColumnFormatMap:o,isFilterBarShown:r,metrics:l,quickFilters:a,customColumns:c,conditionalFormats:d=[],reverseType:u,rollupConfig:m=void 0,showSearchBar:p,searchValue:g,selectDistinctColumns:f=[],selectedSearchColumns:C,sorts:w,invertSearchColumns:b,pendingDataMap:S=new Map,frozenColumns:E,columnHeaderGroups:v}=n;O(l);const{userColumnWidths:y,userRowHeights:M}=l,{columns:F}=t;return{advancedFilters:te.dehydrateAdvancedFilters(F,i),aggregationSettings:s,customColumnFormatMap:[...o],isFilterBarShown:r,quickFilters:te.dehydrateQuickFilters(a),sorts:te.dehydrateSort(w),userColumnWidths:[...y].filter(([x])=>x!=null&&x>=0&&x<F.length).map(([x,U])=>[F[x].name,U]),userRowHeights:[...M],customColumns:[...c],conditionalFormats:[...d],reverseType:u,rollupConfig:m,showSearchBar:p,searchValue:g,selectDistinctColumns:[...f],selectedSearchColumns:C,invertSearchColumns:b,pendingDataMap:te.dehydratePendingDataMap(F,S),frozenColumns:E,columnHeaderGroups:v==null?void 0:v.map(x=>({name:x.name,children:x.children,color:x.color}))}}static hydrateIrisGridState(t,n){var x,U;const{advancedFilters:s,aggregationSettings:i={aggregations:[],showOnTop:!1},customColumnFormatMap:o,isFilterBarShown:r,quickFilters:l,sorts:a,customColumns:c,conditionalFormats:d,userColumnWidths:u,userRowHeights:m,reverseType:p,rollupConfig:g=void 0,showSearchBar:f,searchValue:C,selectDistinctColumns:w,selectedSearchColumns:b,invertSearchColumns:S=!0,pendingDataMap:E=[],frozenColumns:v,columnHeaderGroups:y}=n,{columns:M,formatter:F}=t;return{advancedFilters:te.hydrateAdvancedFilters(M,s,F.timeZone),aggregationSettings:i,customColumnFormatMap:new Map(o),isFilterBarShown:r,quickFilters:te.hydrateQuickFilters(M,l,F.timeZone),sorts:te.hydrateSort(M,a),userColumnWidths:new Map(u.map(([V,N])=>typeof V=="string"||V instanceof String?[M.findIndex(({name:H})=>H===V),N]:[V,N]).filter(([V])=>V!=null&&V>=0&&V<M.length)),customColumns:c,conditionalFormats:d,userRowHeights:new Map(m),reverseType:p,rollupConfig:g,showSearchBar:f,searchValue:C,selectDistinctColumns:w,selectedSearchColumns:b,invertSearchColumns:S,pendingDataMap:te.hydratePendingDataMap(M,E),frozenColumns:v,columnHeaderGroups:te.parseColumnHeaderGroups(t,(U=y!=null?y:(x=t.layoutHints)==null?void 0:x.columnGroups)!=null?U:[]).groups}}static dehydrateIrisGridPanelState(t,n){const{isSelectingPartition:s,partition:i,partitionColumn:o,advancedSettings:r}=n;return{isSelectingPartition:s,partition:i,partitionColumn:o!=null?o.name:void 0,advancedSettings:[...r]}}static hydrateIrisGridPanelState(t,n){const{isSelectingPartition:s,partition:i,partitionColumn:o,advancedSettings:r}=n,{columns:l}=t;return{isSelectingPartition:s,partition:i,partitionColumn:o!=null?te.getColumnByName(l,o):void 0,advancedSettings:new Map([...Pm.DEFAULTS,...r])}}static dehydrateQuickFilters(t){return[...t].map(([n,s])=>{const{text:i}=s;return[n,{text:i}]})}static hydrateQuickFilters(t,n,s){const i=n.map(([o,r])=>{const{text:l}=r;let a=null;try{const c=te.getColumn(t,o);c!=null&&(a=A.makeQuickFilter(c,l,s))}catch(c){Zs.error("hydrateQuickFilters error with",l,c)}return[o,{text:l,filter:a}]});return new Map(i)}static dehydrateAdvancedFilters(t,n){return[...n].map(([s,i])=>{const o=te.getColumn(t,s);O(o);const r=te.dehydrateAdvancedFilterOptions(o,i.options);return[s,{options:r}]})}static hydrateAdvancedFilters(t,n,s){const i=n.map(([o,r])=>{const l=te.getColumn(t,o);O(l);const a=te.hydrateAdvancedFilterOptions(l,r.options);let c=null;try{te.getColumn(t,o)!=null&&(c=A.makeAdvancedFilter(l,a,s))}catch(d){Zs.error("hydrateAdvancedFilters error with",a,d)}return[o,{options:a,filter:c}]});return new Map(i)}static dehydrateAdvancedFilterOptions(t,n){const{selectedValues:s,...i}=n;return{selectedValues:s==null?void 0:s.map(o=>te.dehydrateValue(o,t==null?void 0:t.type)),...i}}static hydrateAdvancedFilterOptions(t,n){const{selectedValues:s,...i}=n;return{selectedValues:s==null?void 0:s.map(o=>te.hydrateValue(o,t==null?void 0:t.type)),...i}}static dehydratePendingDataMap(t,n){return[...n].map(([s,{data:i}])=>[s,{data:[...i].map(([o,r])=>[t[o].name,te.dehydrateValue(r,t[o].type)])}])}static hydratePendingDataMap(t,n){const s=new Map,i=o=>(s.has(o)||s.set(o,t.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 d;const c=i(l);return O(c),[(d=i(l))!=null?d:null,te.hydrateValue(a,t[c].type)]}))}]))}static dehydrateValue(t,n){return A.isDateType(n)?te.dehydrateDateTime(t):A.isLongType(n)?te.dehydrateLong(t):t}static hydrateValue(t,n){return A.isDateType(n)?te.hydrateDateTime(t):A.isLongType(n)?te.hydrateLong(t):t}static dehydrateDateTime(t){return t!=null?I.i18n.DateTimeFormat.format(Yn.FULL_DATE_FORMAT,t):null}static hydrateDateTime(t){return t!=null?I.i18n.DateTimeFormat.parse(Yn.FULL_DATE_FORMAT,t):null}static dehydrateLong(t){return t!=null?`${t}`:null}static hydrateLong(t){return t!=null?I.LongWrapper.ofString(t):null}static dehydrateSort(t){return t.map(n=>{const{column:s,isAbs:i,direction:o}=n;return{column:s.index,isAbs:i,direction:o}})}static hydrateSort(t,n){return n.map(s=>{const{column:i,isAbs:o,direction:r}=s;if(r===A.sortDirection.reverse)return I.Table.reverse();const l=te.getColumn(t,i);if(l!=null){let a=l.sort();return o&&(a=a.abs()),r===A.sortDirection.descending?a=a.desc():a=a.asc(),a}return null}).filter(s=>s!=null&&s.direction!==A.sortDirection.reverse)}static extractTableSettings(t,n=[]){const{irisGridPanelState:s,irisGridState:i}=t,{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(t,n,s){const{columns:i}=t;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:d,partitionColumn:u}=n;if(d!=null&&u!=null){const m=te.getColumnByName(i,u);m&&(c=[m.filter().eq(I.FilterValue.ofString(d)),...c])}c=[...l,...c],t.applyFilter(c),t.applySort(a)}static getInputFiltersForColumns(t,n=[]){return n.filter(({name:s,type:i})=>t.find(({name:o,type:r})=>o===s&&r===i))}static getFiltersFromInputFilters(t,n=[],s){return n.map(({name:i,type:o,value:r})=>{const l=t.find(({name:a,type:c})=>a===i&&c===o);if(l)try{return A.makeQuickFilter(l,r,s)}catch(a){Zs.debug("Unable to create input filter",a)}return null}).filter(i=>i!=null)}static getFiltersFromFilterMap(t){const n=[],s=Array.from(t.keys());for(let i=0;i<s.length;i+=1){const o=s[i],r=t.get(o);r&&r.filter!=null&&n.push(r.filter)}return n}static getHiddenColumns(t){return[...t.entries()].filter(([,n])=>n===0).map(([n])=>n)}static parseCustomColumnNames(t){return t.map(n=>n.split("=")[0])}static getRemovedCustomColumnNames(t,n){const s=te.parseCustomColumnNames(t),i=te.parseCustomColumnNames(n);return s.filter(o=>!i.includes(o))}static removeSortsInColumns(t,n){return t.filter(s=>!n.includes(s.column.name))}static removeFiltersInColumns(t,n,s){const i=t.map(({name:r})=>r),o=new Map(n);return s.forEach(r=>o.delete(i.indexOf(r))),o}static removeColumnFromMovedColumns(t,n,s){const i=t.map(({name:r})=>r);let o=[...n];for(let r=0;r<s.length;r+=1){const l=s[r];let a=i.findIndex(d=>d===l);const c=[];for(let d=0;d<o.length;d+=1){const u=o[d],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=B.applyItemMoves(a,a,[u])[0][0]}o=c,i.splice(i.findIndex(d=>d===l),1)}return o}static removeColumnsFromSelectDistinctColumns(t,n){return t.filter(s=>!n.includes(s))}static getVisibleColumnsInRange(t,n,s,i,o){const r=[];for(let l=n;l<=s;l+=1){const a=B.getModelIndex(l,i);a>=0&&a<t.length&&!o.includes(a)&&r.push(t[a])}return r}static getPrevVisibleColumns(t,n,s,i,o){const r=[];let l=n;for(;l>=0&&r.length<s;){const a=B.getModelIndex(l,i);a>=0&&a<t.length&&!o.includes(a)&&r.unshift(t[a]),l-=1}return r}static getNextVisibleColumns(t,n,s,i,o){const r=[];let l=n;for(;l<t.length&&r.length<s;){const a=B.getModelIndex(l,i);a>=0&&a<t.length&&!o.includes(a)&&r.push(t[a]),l+=1}return r}static getColumnsToFetch(t,n,s){const i=[...n];return s.forEach(o=>{const r=t.find(({name:l})=>l===o);r!=null&&!n.includes(r)&&i.push(r)}),i}static getModelViewportColumns(t,n,s,i,o=[],r=[],l=0){if(n==null||s==null)return null;const a=te.getVisibleColumnsInRange(t,n,s,i,o),c=a.length*l,d=te.getPrevVisibleColumns(t,n-1,c,i,o),u=te.getNextVisibleColumns(t,s+1,c,i,o),m=[...d,...a,...u];return te.getColumnsToFetch(t,m,r)}static rangeSetFromRanges(t){const n=t.slice().sort((s,i)=>(O(s.startRow),O(i.startRow),s.startRow-i.startRow)).map(s=>{const{startRow:i,endRow:o}=s;return O(i),O(o),I.RangeSet.ofRange(i,o)});return I.RangeSet.ofRanges(n)}static isValidSnapshotRanges(t){if(t==null||t.length===0)return!1;const n=new Map;for(let o=0;o<t.length;o+=1){const r=t[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(t){return!Number.isInteger(t)||typeof t!="number"?!1:t>=0}static columnsFromRanges(t,n){var i,o;if(t==null||t.length===0)return[];if(t[0].startColumn===null&&t[0].endColumn===null)return n;const s=new Set;for(let r=0;r<t.length;r+=1){const l=t[r];O(l.startColumn),O(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(t){const{columns:n,rows:s}=t,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],d=r.get(c);l.push(d)}i.push(l)}return i}static getModelRollupConfig(t,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:C})=>Gn.isRollupOperation(g)?[]:Gn.getOperationColumnNames(t,g,f,C)),d={};for(let g=0;g<a.length;g+=1)d[a[g].operation]=c[g];if(r){const g=new Set(t.map(f=>f.name).filter(f=>!i.includes(f)));if(c.forEach(f=>{f.forEach(C=>g.delete(C))}),g.size>0){const f=(p=d[Se.FIRST])!=null?p:[];d[Se.FIRST]=[...f,...g]}}return{groupingColumns:i,includeConstituents:o,includeDescriptions:l,aggregations:d}}static getPendingErrors(t){t.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(t,n){return n<t.length?t[n]:(Zs.error("Unable to retrieve column",n,">=",t.length),null)}static getColumnByName(t,n){const s=t.find(({name:i})=>i===n);return s==null&&Zs.error("Unable to retrieve column by name",n,t.map(({name:i})=>i)),s}static changeFilterColumnNamesToIndexes(t,n){return n.map(({name:s,filter:i})=>{const o=t.findIndex(r=>r.name===s);return o<0?null:[o,i]}).filter(s=>s!=null)}static combineFiltersFromList(t,n){n.sort((i,o)=>i.operator==="eq"&&o.operator!=="eq"?1:i.operator!=="eq"&&o.operator==="eq"?-1:i.startColumnIndex-o.startColumnIndex);let s="";for(let i=0;i<n.length;i+=1){const{text:o,value:r,operator:l}=n[i];if(r!==void 0){let a="";l!==void 0&&(r==null&&l==="eq"?a="=":l!=="eq"&&(l==="startsWith"||l==="endsWith"?a="*":a=A.getFilterOperatorString(l)));let c=`${a}${o}`;l==="startsWith"&&(c=`${o}${a}`),t!=null&&r!==null&&A.isCharType(t)&&(c=`${a}${String.fromCharCode(parseInt(o,10))}`),i!==0&&(s+=l==="eq"?" || ":" && "),s+=c}}return s}static parseColumnHeaderGroups(t,n){let s=1;const i=new Map,o=new Map,r=n==null?void 0:n.filter(({children:u})=>u.length>0);if(r.length===0)return{groups:[],maxDepth:s,parentMap:i,groupMap:o};const l=new Map(r.map(u=>[u.name,u])),a=new Set,c=u=>{const{name:m}=u;if(t.getColumnIndexByName(m)!=null)throw new Error(`Column header group has same name as column: ${m}`);const p=o.get(m);if(p)return p;const g=[];let f=1;u.children.forEach(w=>{if(a.has(w))throw new Error(`Column group child ${w} specified in multiple groups`);a.add(w);const b=l.get(w),S=t.getColumnIndexByName(w);if(b){const E=c(b);g.push(...E.childIndexes),f=Math.max(f,E.depth+1)}else if(S!=null)g.push(S),f=Math.max(f,1);else throw new Error(`Unknown child ${w} in group ${m}`)});const C=new Yt({...u,depth:f,childIndexes:g.flat()});return o.set(m,C),u.children.forEach(w=>i.set(w,C)),s=Math.max(s,C.depth+1),C},d=new Set;return r.forEach(u=>{const{name:m}=u;if(d.has(m))throw new Error(`Duplicate column group name: ${m}`);d.add(m),c(u)}),o.forEach(u=>{var m;u.setParent((m=i.get(u.name))==null?void 0:m.name)}),{groups:[...o.values()],maxDepth:s,groupMap:o,parentMap:i}}}const ft=ne.module("IrisGridCopyHandler"),Te=class extends T.exports.Component{constructor(e){super(e),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:Te.COPY_STATES.IDLE,buttonState:Te.BUTTON_STATES.COPY,isShown:!1,rowCount:0}}static getStatusMessageText(e,t){switch(e){case Te.COPY_STATES.CONFIRMATION_REQUIRED:return`Are you sure you want to copy ${t.toLocaleString()} rows to your clipboard?`;case Te.COPY_STATES.CLICK_REQUIRED:return`Fetched ${t.toLocaleString()} rows!`;case Te.COPY_STATES.FETCH_ERROR:return"Unable to copy data.";case Te.COPY_STATES.FETCH_IN_PROGRESS:return`Fetching ${t.toLocaleString()} rows for clipboard...`;case Te.COPY_STATES.DONE:return"Copied to Clipboard!";default:return""}}static getCopyButtonText(e){switch(e){case Te.BUTTON_STATES.FETCH_IN_PROGRESS:return"Fetching";case Te.BUTTON_STATES.CLICK_TO_COPY:return"Click to Copy";case Te.BUTTON_STATES.RETRY:return"Retry";default:return"Copy"}}componentDidMount(){const{copyOperation:e}=this.props;e!=null&&this.startCopy()}componentDidUpdate(e){const{copyOperation:t}=this.props;e.copyOperation!==t&&this.startCopy()}componentWillUnmount(){this.stopCopy()}startCopy(){ft.debug2("startCopy"),this.stopCopy();const{copyOperation:e}=this.props;if(e==null){ft.debug2("No copy operation set, cancelling out"),this.setState({isShown:!1});return}const{ranges:t,error:n}=e;if(n!=null){ft.debug("Showing copy error",n),this.setState({isShown:!0,copyState:Te.COPY_STATES.DONE,error:n}),this.startHideTimer();return}const s=Z.rowCount(t);this.setState({rowCount:s,isShown:!0,error:void 0}),s>Te.NO_PROMPT_THRESHOLD?this.setState({buttonState:Te.BUTTON_STATES.COPY,copyState:Te.COPY_STATES.CONFIRMATION_REQUIRED}):this.startFetch()}stopCopy(){this.textData=void 0,this.stopFetch(),this.stopHideTimer()}handleBackgroundClick(){ft.debug2("handleBackgroundClick");const{copyState:e}=this.state;e===Te.COPY_STATES.DONE&&this.setState({isShown:!1})}handleCancelClick(){ft.debug2("handleCancelClick"),this.stopFetch(),this.setState({isShown:!1})}handleCopyClick(){ft.debug2("handleCopyClick"),this.textData!=null?this.copyText(this.textData):this.startFetch()}handleHideTimeout(){ft.debug2("handleHideTimeout"),this.stopHideTimer(),this.setState({isShown:!1})}copyText(e){ft.debug2("copyText",e),this.textData=e,ui(e).then(()=>{this.setState({copyState:Te.COPY_STATES.DONE}),this.startHideTimer()},t=>{ft.error("copyText error",t),this.setState({buttonState:Te.BUTTON_STATES.CLICK_TO_COPY,copyState:Te.COPY_STATES.CLICK_REQUIRED})})}startFetch(){this.stopFetch(),this.setState({buttonState:Te.BUTTON_STATES.FETCH_IN_PROGRESS,copyState:Te.COPY_STATES.FETCH_IN_PROGRESS});const{model:e,copyOperation:t}=this.props,{ranges:n,includeHeaders:s,userColumnWidths:i,movedColumns:o,formatValues:r}=t;ft.debug("startFetch",n);const l=te.getHiddenColumns(i);let a=B.getModelRanges(n,o);if(l.length>0){const d=l.map(Z.makeColumn);a=Z.subtractRangesFromRanges(a,d)}const c=r!=null&&r?(d,u)=>e.displayString(d,u.type,u.name):d=>`${d}`;this.fetchPromise=Pe.makeCancelable(e.textSnapshot(a,s,c)),this.fetchPromise.then(d=>{this.fetchPromise=void 0,this.copyText(d)}).catch(d=>{d instanceof As?ft.debug("User cancelled copy."):(ft.error("Error fetching contents",d),this.fetchPromise=void 0,this.setState({buttonState:Te.BUTTON_STATES.RETRY,copyState:Te.COPY_STATES.FETCH_ERROR}))})}stopFetch(){this.fetchPromise&&(ft.debug2("stopFetch"),this.fetchPromise.cancel(),this.fetchPromise=void 0)}startHideTimer(){this.stopHideTimer(),this.hideTimer=setTimeout(this.handleHideTimeout,Te.HIDE_TIMEOUT)}stopHideTimer(){this.hideTimer!=null&&(clearTimeout(this.hideTimer),this.hideTimer=void 0)}render(){const{onEntering:e,onEntered:t,onExiting:n,onExited:s}=this.props,{buttonState:i,copyState:o,isShown:r,rowCount:l,error:a}=this.state,c=o===Te.COPY_STATES.DONE?"fade":"copy-slide-up",d=Te.getCopyButtonText(i),u=a!=null?a:Te.getStatusMessageText(o,l),m=o!==Te.COPY_STATES.DONE,p=i===Te.BUTTON_STATES.FETCH_IN_PROGRESS,g=o===Te.COPY_STATES.DONE;return R(fo,{animation:c,isShown:r,className:G("iris-grid-copy-handler",{"copy-done":g}),onClick:this.handleBackgroundClick,onEntering:e,onEntered:t,onExiting:n,onExited:s,children:[h("div",{className:"status-message",children:h("span",{children:u})}),h(lt,{in:m,timeout:xe.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:R("div",{className:"buttons-container",children:[h("button",{type:"button",className:"btn btn-outline-secondary btn-cancel",onClick:this.handleCancelClick,children:"Cancel"}),R(K,{kind:p?"tertiary":"primary",className:G("btn-copy",{"btn-spinner":p}),onClick:this.handleCopyClick,disabled:p,children:[p&&h(Ht,{}),d]})]})})]})}};let Bs=Te;Bs.NO_PROMPT_THRESHOLD=1e4;Bs.HIDE_TIMEOUT=3e3;Bs.COPY_STATES={IDLE:"IDLE",CONFIRMATION_REQUIRED:"CONFIRMATION_REQUIRED",FETCH_IN_PROGRESS:"FETCH_IN_PROGRESS",FETCH_ERROR:"FETCH_ERROR",CLICK_REQUIRED:"CLICK_REQUIRED",DONE:"DONE"};Bs.BUTTON_STATES={COPY:"COPY",FETCH_IN_PROGRESS:"FETCH_IN_PROGRESS",CLICK_TO_COPY:"CLICK_TO_COPY",RETRY:"RETRY"};Bs.defaultProps={copyOperation:null,onEntering:()=>{},onEntered:()=>{},onExiting:()=>{},onExited:()=>{}};class Ha extends T.exports.PureComponent{constructor(t){super(t);const{debounceMs:n}=t;this.debouncedSendUpdate=Et(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}=t;this.initialValue=s,this.state={isChanged:!1,value:s}}componentDidMount(){var t;(t=this.inputField)==null||t.focus()}componentDidUpdate(t){const{debounceMs:n}=this.props;t.debounceMs!==n&&(this.debouncedSendUpdate.flush(),this.debouncedSendUpdate=Et(this.sendUpdate.bind(this),n))}componentWillUnmount(){this.debouncedSendUpdate.cancel()}setValue(t){this.initialValue=t,this.setState({value:t})}focus(){var t;(t=this.inputField)==null||t.focus()}handleChange(t){const{value:n}=t.target;this.setState({value:n,isChanged:!0}),this.debouncedSendUpdate(n)}handleCancel(){this.debouncedSendUpdate.cancel();const{initialValue:t}=this,{isChanged:n}=this.state;n&&this.sendUpdate(t);const{onDone:s}=this.props;s()}handleCommit(t=!0,n=!0){this.debouncedSendUpdate.flush();const{onDone:s}=this.props;s(t,n)}handleFocus(){var t;(t=this.inputField)==null||t.select()}handleBlur(t){const{relatedTarget:n}=t;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(t=!1){this.debouncedSendUpdate.flush();const{onTab:n}=this.props;n(t)}handleKeyDown(t){switch(t.key){case"Escape":t.stopPropagation(),t.preventDefault(),this.handleCancel();break;case"Enter":t.stopPropagation(),t.preventDefault(),this.handleCommit();break;case"Tab":t.stopPropagation(),t.preventDefault(),this.handleTab(t.shiftKey);break}}handleContextMenu(t){const{onContextMenu:n}=this.props;n(t)}sendUpdate(t){const{onChange:n}=this.props;n(t)}render(){const{className:t,style:n,isAdvancedFilterSet:s,onAdvancedFiltersTriggered:i}=this.props,{value:o}=this.state;return R("div",{style:n,className:"iris-grid-input-autosized-wrapper","data-value":o,children:[h("input",{ref:r=>{this.inputField=r},className:G("iris-grid-input-field",t),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"}),h("div",{className:"advanced-filter-button-container",children:h(K,{kind:"ghost",className:G("btn-link-icon advanced-filter-button",{"filter-set":s}),onClick:i,onContextMenu:this.handleContextMenu,children:R("div",{className:"fa-layers ",children:[h(Q,{icon:dr,className:"filter-solid"}),h(Q,{icon:Ki,className:"filter-light"})]})})})]})}}Ha.defaultProps={style:{},className:"",value:"",isAdvancedFilterSet:!1,onAdvancedFiltersTriggered:()=>{},onChange:()=>{},onDone:()=>{},onTab:()=>{},onContextMenu:()=>{},debounceMs:150};class _m extends ms{constructor(t){super(),this.irisGrid=t}onDown(t){const{selectedRanges:n}=this.irisGrid.state;return t.key==="c"&&Ne.isModifierKeyDown(t)?(te.isValidSnapshotRanges(n)?this.irisGrid.copyRanges(n):this.irisGrid.copyRanges(n,!1,!1,"Invalid copy ranges"),!0):!1}}const Vm={TOGGLE_QUICK_FILTER:Ie.createAndAdd({id:"TABLE.TOGGLE_QUICK_FILTER",name:"Toggle Quick Filter",shortcut:[ie.CTRL,le.F],macShortcut:[ie.CMD,le.F]}),CLEAR_ALL_FILTERS:Ie.createAndAdd({id:"TABLE.CLEAR_ALL_FILTERS",name:"Clear All Table Filters",shortcut:[ie.CTRL,le.E],macShortcut:[ie.CMD,le.E]}),CLEAR_FILTERS:Ie.createAndAdd({id:"TABLE.CLEAR_FILTERS",name:"Clear Active Table Filters",shortcut:[ie.CTRL,ie.SHIFT,le.E],macShortcut:[ie.CMD,ie.SHIFT,le.E]}),REVERSE:Ie.createAndAdd({id:"TABLE.REVERSE",name:"Reverse",shortcut:[ie.CTRL,le.I],macShortcut:[ie.CMD,le.I]}),TOGGLE_SEARCH:Ie.createAndAdd({id:"TABLE.TOGGLE_SEARCH",name:"Toggle Search",shortcut:[ie.CTRL,ie.SHIFT,le.F],macShortcut:[ie.CMD,ie.SHIFT,le.F]}),GOTO_ROW:Ie.createAndAdd({id:"TABLE.GOTO_ROW",name:"Go to Row",shortcut:[ie.CTRL,le.G],macShortcut:[ie.CMD,le.G]})},Um={COMMIT:Ie.createAndAdd({id:"INPUT_TABLE.COMMIT",name:"Commit",shortcut:[ie.CTRL,le.S],macShortcut:[ie.CMD,le.S]}),DISCARD:Ie.createAndAdd({id:"INPUT_TABLE.DISCARD",name:"Discard",shortcut:[ie.CTRL,ie.ALT,le.S],macShortcut:[ie.CMD,ie.OPTION,le.S]})},kt={TABLE:Vm,INPUT_TABLE:Um};class Bm extends ms{constructor(t){super(),this.irisGrid=t}onDown(t){if(kt.TABLE.REVERSE.matchesEvent(t)){if(!this.irisGrid.isReversible())return!1;const{reverseType:n}=this.irisGrid.state;return n===A.REVERSE_TYPE.NONE?this.irisGrid.reverse(A.REVERSE_TYPE.POST_SORT):this.irisGrid.reverse(A.REVERSE_TYPE.NONE),!0}return!1}}class Gm extends ms{constructor(t){super(),this.irisGrid=t}onDown(t){return kt.TABLE.CLEAR_FILTERS.matchesEvent(t)?(this.irisGrid.clearAllFilters(),!0):!1}}class zm extends Je{constructor(t){super(850),this.irisGrid=t}destroyColumnTooltip(){this.irisGrid.setState({overflowButtonTooltipProps:null})}setCursor(t){return this.isHoveringOverflowButton(t)?(this.cursor="pointer",{stopPropagation:!1,preventDefault:!1}):(this.cursor=null,!1)}getButtonPosition({x:t,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:d}=a,{canvasContext:u}=r,m=r.getTheme(),p={context:u,mouseX:t,mouseY:n,metrics:c,model:d,theme:m},{left:g,top:f,width:C,height:w}=o.getCellOverflowButtonPosition(p);return g==null||C==null||f==null||w==null?null:{left:g,top:f,width:C,height:w}}isHoveringOverflowButton(t){var w;const{x:n,y:s}=t,{left:i,top:o,width:r,height:l}=(w=this.getButtonPosition(t))!=null?w:{};if(i==null||r==null||o==null||l==null)return!1;const{renderer:a,grid:c,state:d,props:u}=this.irisGrid;if(!c)return!1;const{metrics:m}=d,{model:p}=u,{canvasContext:g}=c,f=c.getTheme(),C={context:g,mouseX:n,mouseY:s,metrics:m,model:p,theme:f};return a.shouldRenderOverflowButton(C)&&n>=i&&n<=i+r&&s>=o&&s<=o+l}onMove(t){if(this.isHoveringOverflowButton(t)){const{overflowButtonTooltipProps:n}=this.irisGrid.state,s=this.getButtonPosition(t);ht(n,s)||this.irisGrid.setState({overflowButtonTooltipProps:s})}else this.destroyColumnTooltip();return this.setCursor(t)}onWheel(t){return this.destroyColumnTooltip(),this.onMove(t)}onDown(t){this.destroyColumnTooltip();const{column:n,row:s}=t;return this.isHoveringOverflowButton(t)&&this.irisGrid.setState({showOverflowModal:!0,overflowText:this.irisGrid.getValueForCell(n,s)}),!1}onContextMenu(){return this.destroyColumnTooltip(),!1}onLeave(){return this.destroyColumnTooltip(),!1}}class Wm extends Je{constructor(t){super(),this.irisGrid=t,this.cursor=null}isActive(){const{isSelectingColumn:t}=this.irisGrid.props;return t}isValidColumn(t){if(t==null)return!1;const{columnSelectionValidator:n}=this.irisGrid.props;return n!=null?n(t):!0}updateColumnSelectionStatus(){const{columnSelectionValidator:t}=this.irisGrid.props;t!=null&&t(null)}getTableColumn(t){if(t==null)return null;const{model:n}=this.irisGrid.props,s=this.irisGrid.getModelColumn(t);return s==null?null:n.columns[s]}onMove(t){if(!this.isActive())return!1;const{columnAllowedCursor:n,columnNotAllowedCursor:s}=this.irisGrid.props,{column:i}=t,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(t){if(!this.isActive())return!1;const{columnAllowedCursor:n,columnNotAllowedCursor:s}=this.irisGrid.props,{column:i}=t,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(t){if(!this.isActive())return!1;const{column:n}=t,s=this.getTableColumn(n);return s!=null&&this.isValidColumn(s)&&this.irisGrid.selectColumn(s),!0}}class $m extends Je{constructor(t){super(),this.irisGrid=t}hideColumnTooltip(){const{tooltip:t}=this.irisGrid;t&&(t.stopTimer(),t.hide())}onDown(){return this.hideColumnTooltip(),!1}onContextMenu(){return this.hideColumnTooltip(),!1}onWheel(){return this.hideColumnTooltip(),!1}onLeave(t,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(t){const{column:n,row:s,columnHeaderDepth:i}=t,{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 _a=class extends T.exports.Component{constructor(e=_a.defaultProps){super(e),this.handleInputChange=this.handleInputChange.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.inputRef=J.createRef()}handleInputChange(){const{onChange:e}=this.props;this.inputRef.current&&e(this.inputRef.current.value)}closeContextMenu(){const{forwardedProps:e}=this.props,{closeMenu:t}=e;t(!0)}revertToDefault(){const{onChange:e}=this.props;e(null)}returnFocusToContextMenu(){const e=Ou.getClosestByClassName(this.inputRef.current,"context-menu-container");e instanceof HTMLElement&&e.focus()}handleKeyDown(e){switch(e.key){case"Enter":e.stopPropagation(),this.closeContextMenu();break;case"Escape":e.stopPropagation(),this.revertToDefault(),this.closeContextMenu();break;case"ArrowRight":case"ArrowLeft":e.stopPropagation();break;case"ArrowUp":case"ArrowDown":this.returnFocusToContextMenu();break;default:e.stopPropagation()}}render(){const{formatString:e,forwardedProps:t,placeholder:n,title:s}=this.props,{menuItem:{description:i},iconElement:o}=t;return R("div",{className:"form-group flex-grow mb-0",children:[R("div",{className:"custom-format-title",children:[h("span",{className:"icon",children:o}),R("label",{className:"title mb-0",htmlFor:"custom-format-input",children:[s,i!=null&&h(Be,{children:i})]})]}),h("div",{className:"pl-2 pr-2 pb-2",children:h("input",{id:"custom-format-input",className:"form-control text-right mb-0",type:"text",defaultValue:e,ref:this.inputRef,placeholder:n,onKeyDown:this.handleKeyDown,onChange:this.handleInputChange,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:"false"})})]})}};let Va=_a;Va.defaultProps={formatString:"",forwardedProps:{menuItem:{},closeMenu(e){},iconElement:null},placeholder:"",title:"",onChange(e){}};class Tt{static isDefaultSelected(t){return!t||![ke.TYPE_CONTEXT_CUSTOM,ke.TYPE_CONTEXT_PRESET].includes(t.type)}static isCustomSelected(t){return t!=null&&t.type===ke.TYPE_CONTEXT_CUSTOM}static makeOption(t,n,s,i){return{title:t,description:t,group:s,format:n,isSelected:i}}static makeCustomFormatOption(t,n,s,i,o){return{title:t.label,description:t.label,format:t,group:n,isSelected:i,menuElement:h(Va,{formatString:t.formatString,title:t.label,placeholder:s,onChange:o})}}}const qt=class{static getOptions(e,t){const n=new Date,i=[{group:qt.dateGroup,formatString:"yyyy-MM-dd"},{group:qt.dateGroup,formatString:"MM-dd-yyyy"},{group:qt.timeGroup,formatString:"HH:mm:ss"},{group:qt.timeGroup,formatString:"HH:mm:ss.SSS"},{group:qt.timeGroup,formatString:"HH:mm:ss.SSSSSSSSS"},{group:qt.dateTimeGroup,formatString:"yyyy-MM-dd HH:mm:ss"},{group:qt.dateTimeGroup,formatString:"yyyy-MM-dd HH:mm:ss.SSS"},{group:qt.dateTimeGroup,formatString:"yyyy-MM-dd HH:mm:ss.SSSSSSSSS"}].map(r=>{const l=Kn.makeFormat("",r.formatString,Kn.TYPE_CONTEXT_PRESET),a=e.getFormattedString(n,A.dataType.DATETIME,"",l);return Tt.makeOption(a,l,r.group,Kn.isSameFormat(l,t))});return[Tt.makeOption("Default",null,qt.dateGroup,Tt.isDefaultSelected(t)),...i]}};let Co=qt;Co.dateGroup=10;Co.timeGroup=20;Co.dateTimeGroup=30;const Kt=class{static getOptions(e,t){const n=[{format:_e.FORMAT_PERCENT,group:Kt.presetGroup},{format:_e.FORMAT_BASIS_POINTS,group:Kt.presetGroup},{format:_e.FORMAT_MILLIONS,group:Kt.presetGroup},{format:_e.FORMAT_SCIENTIFIC_NOTATION,group:Kt.presetGroup},{format:_e.FORMAT_ROUND,group:Kt.presetRoundGroup},{format:_e.FORMAT_ROUND_TWO_DECIMALS,group:Kt.presetRoundGroup},{format:_e.FORMAT_ROUND_FOUR_DECIMALS,group:Kt.presetRoundGroup}],s=Tt.makeOption("Default",null,Kt.defaultGroup,Tt.isDefaultSelected(e)),i=n.map(a=>Tt.makeOption(a.format.label,a.format,a.group,_e.isSameFormat(a.format,e))),o=Tt.isCustomSelected(e),r=o?e:_e.makeCustomFormat(),l=Tt.makeCustomFormatOption(r,Kt.customGroup,_e.DEFAULT_FORMAT_STRING,o,a=>{if(a!=null){const c=_e.makeCustomFormat(a);_e.isValid(c)&&t(c)}else t(null)});return[s,...i,l]}};let pi=Kt;pi.defaultGroup=10;pi.presetGroup=20;pi.presetRoundGroup=30;pi.customGroup=40;const oi=class{static getOptions(e,t){const n=[{format:Ot.FORMAT_MILLIONS,group:oi.presetGroup},{format:Ot.FORMAT_SCIENTIFIC_NOTATION,group:oi.presetGroup}],s=Tt.makeOption("Default",null,oi.defaultGroup,Tt.isDefaultSelected(e)),i=n.map(a=>Tt.makeOption(a.format.label,a.format,a.group,Ot.isSameFormat(a.format,e))),o=Tt.isCustomSelected(e),r=o?e:Ot.makeCustomFormat(),l=Tt.makeCustomFormatOption(r,oi.customGroup,Ot.DEFAULT_FORMAT_STRING,o,a=>{if(a!=null){const c=Ot.makeCustomFormat(a);Ot.isValid(c)&&t(c)}else t(null)});return[s,...i,l]}};let wo=oi;wo.defaultGroup=10;wo.presetGroup=20;wo.customGroup=30;const Tl=ne.module("IrisGridContextMenuHandler"),qm=150,El="yyyy-MM-dd HH:mm:ss.SSSSSSSSS",q=class extends Je{constructor(e){super(),this.debouncedUpdateCustomFormat=Et(e.handleFormatSelection,qm),this.irisGrid=e}static getQuickFilterCondition(e,t,n){return e&&n==="&&"?e.and(t):e&&n==="||"?e.or(t):t}static getQuickFilterText(e,t,n){return n&&e!=null?`${e} ${n} ${t}`:t}static getOperatorAsText(e){return e==="&&"?"And":"Or"}static getNumberValueEqualsFilter(e,t){const n=e.filter();if(t===Number.POSITIVE_INFINITY)return I.FilterCondition.invoke("isInf",n).and(n.greaterThan(I.FilterValue.ofNumber(0)));if(t===Number.NEGATIVE_INFINITY)return I.FilterCondition.invoke("isInf",n).and(n.lessThan(I.FilterValue.ofNumber(0)));if(Number.isNaN(t))return I.FilterCondition.invoke("isNaN",n);const s=q.getFilterValueForNumberOrChar(e.type,t);return n.eq(s)}static getFilterValueForNumberOrChar(e,t){return A.isCharType(e)?I.FilterValue.ofString(String.fromCharCode(t)):I.FilterValue.ofNumber(t)}componentWillUnmount(){this.debouncedUpdateCustomFormat.flush()}getHeaderActions(e,t){var F;const{irisGrid:n}=this,{column:s}=t;O(s);const{model:i}=n.props,{columns:o}=i,r=o[e],l=[],{metrics:a,reverseType:c,quickFilters:d,advancedFilters:u,searchFilter:m}=n.state,p=n.getTheme();O(a);const{filterIconColor:g,filterBarActiveColor:f,contextMenuSortIconColor:C,contextMenuReverseIconColor:w}=p,b=i.sort,S=A.getSortForColumn(b,e),E=c!==A.REVERSE_TYPE.NONE,{userColumnWidths:v}=a,y=[...v.values()].some(x=>x===0),M=i.isColumnFrozen(s);return l.push({title:"Hide Column",group:q.GROUP_HIDE_COLUMNS,action:()=>{this.irisGrid.hideColumnByVisibleIndex(s)}}),l.push({title:M?"Unfreeze Column":"Freeze Column",group:q.GROUP_HIDE_COLUMNS,action:()=>{M?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:!y}),l.push({title:"Quick Filters",icon:cn,iconColor:f,shortcut:kt.TABLE.TOGGLE_QUICK_FILTER,group:q.GROUP_FILTER,order:10,action:()=>{this.irisGrid.toggleFilterBar(s)}}),l.push({title:"Advanced Filters",icon:u.get(e)?dr:Ki,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:kt.TABLE.CLEAR_FILTERS,action:()=>{this.irisGrid.clearAllFilters()},disabled:!(d.size>0||u.size>0||m!=null)}),l.push({title:"Sort by",icon:cn,iconColor:C,group:q.GROUP_SORT,order:10,actions:this.sortByActions(r,e,S)}),l.push({title:"Add Additional Sort",disabled:S&&b.length===1||E&&b.length===1||S&&E&&b.length===2||b.length===0,group:q.GROUP_SORT,order:20,actions:this.additionalSortActions(r,e)}),l.push({title:"Clear Table Sorting",disabled:b.length===0||E&&b.length===1,group:q.GROUP_SORT,action:()=>{this.irisGrid.sortColumn(s,q.COLUMN_SORT_DIRECTION.none)},order:30}),l.push({title:c===A.REVERSE_TYPE.NONE?"Reverse Table":"Clear Reverse Table",icon:cn,iconColor:w,group:q.GROUP_SORT,order:40,disabled:!i.isReversible,shortcut:kt.TABLE.REVERSE,action:()=>{c===A.REVERSE_TYPE.NONE?this.irisGrid.reverse(A.REVERSE_TYPE.POST_SORT):this.irisGrid.reverse(A.REVERSE_TYPE.NONE)}}),l.push({title:"Copy Column Name",group:q.GROUP_COPY,action:()=>{var x;ui((x=i.textForColumnHeader(e))!=null?x:"").catch(U=>Tl.error("Unable to copy header",U))}}),A.isDateType(r.type)?l.push({title:"Date/Time Format",group:q.GROUP_FORMAT,actions:this.dateFormatActions(r)}):A.isNumberType(r.type)&&l.push({title:"Number Format",group:q.GROUP_FORMAT,actions:(F=this.numberFormatActions(r))!=null?F:void 0}),l}getCellActions(e,t,n){O(e);const{irisGrid:s}=this,{column:i,row:o}=n,{model:r,canCopy:l}=s.props,{columns:a}=r,c=s.getModelRow(o);O(c);const d=r.valueForCell(e,c),u=r.textForCell(e,c),m=a[e],p=[],{quickFilters:g}=s.state,f=s.getTheme(),{filterIconColor:C}=f,{settings:w}=s.props,b=new Kn({timeZone:w==null?void 0:w.timeZone,showTimeZone:!1,showTSeparator:!0,defaultDateTimeFormatString:El}),S=new Kn({timeZone:w==null?void 0:w.timeZone,showTimeZone:w==null?void 0:w.showTimeZone,showTSeparator:w==null?void 0:w.showTSeparator,defaultDateTimeFormatString:El});if(m==null||o==null)return p;if(r.isFilterable(e)){const v={title:"Filter By Value",icon:cn,iconColor:C,group:q.GROUP_FILTER,order:10,actions:[]};if(d==null)g.get(e)&&v.actions.push({title:"And",actions:this.nullFilterActions(m,g.get(e),"&&"),order:2,group:oe.groups.high}),v.actions.push(...this.nullFilterActions(m));else if(A.isBooleanType(m.type))g.get(e)&&v.actions.push({title:"Or",actions:this.booleanFilterActions(m,u,g.get(e),"||"),order:2,group:oe.groups.high}),v.actions.push(...this.booleanFilterActions(m,u));else if(A.isNumberType(m.type)||A.isCharType(m.type)){O(e);const y=A.isCharType(m.type)?String.fromCharCode(d):`${d}`;g.get(e)&&v.actions.push({title:"And",actions:this.numberFilterActions(m,y,d,g.get(e),"&&"),order:2,group:oe.groups.high}),v.actions.push(...this.numberFilterActions(m,y,d,g.get(e)))}else if(A.isDateType(m.type)){const y=b.format(d),M=S.format(d);g.get(e)&&v.actions.push({title:"And",actions:this.dateFilterActions(m,y,M,d,g.get(e),"&&"),order:2,group:oe.groups.high}),v.actions.push(...this.dateFilterActions(m,y,M,d,g.get(e)))}else g.get(e)&&v.actions.push({title:"And",actions:this.stringFilterActions(m,u,d,g.get(e),"&&"),order:2,group:oe.groups.high}),v.actions.push(...this.stringFilterActions(m,u,d));v.actions!=null&&v.actions.length>0&&p.push(v)}const E={title:"Go to",iconColor:C,shortcut:kt.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(e,t,n){const{irisGrid:s}=this,{y:i,column:o,row:r,columnHeaderDepth:l}=e,a=s.getModelColumn(o),c=s.getModelRow(r),{model:d,canCopy:u}=s.props,{columns:m}=d,{metrics:p,isFilterBarShown:g,quickFilters:f,advancedFilters:C,selectedRanges:w}=s.state;O(p);const{columnHeaderHeight:b,gridY:S,columnHeaderMaxDepth:E}=p,v=[];if(a!=null&&c!=null){const y=d.valueForCell(a,c),M=d.textForCell(a,c),F=m[a],{onContextMenu:x}=s.props;F!=null&&v.push(x({model:d,value:y,valueText:M,column:F,rowIndex:r,columnIndex:o,modelRow:c,modelColumn:a}))}return a!=null&&d.isFilterable(a)&&v.push({title:"Clear Column Filter",group:q.GROUP_FILTER,order:30,action:()=>{this.irisGrid.removeColumnFilter(a)},disabled:!(f.has(a)||C.has(a))}),(g?i<=S:i<=b*E&&l===0)?a!=null&&v.push(...this.getHeaderActions(a,e)):(a!=null&&c!=null&&v.push(...this.getCellActions(a,t,e)),u&&w.length>0&&(v.push({title:"Copy Selection",shortcut:Tr.COPY,group:q.GROUP_COPY,order:30,action:()=>{s.copyRanges(w)}}),v.push({title:"Copy Selection w/ Headers",group:q.GROUP_COPY,order:40,action:()=>{s.copyRanges(w,!0)}})),Oe(d)&&d.isEditable&&w.length>0&&v.push({title:"Delete Selected Rows",group:q.GROUP_EDIT,order:50,action:()=>{this.irisGrid.deleteRanges(w)}})),v.length===0?!1:(O(s.gridWrapper),oe.triggerMenu(s.gridWrapper,n.pageX,n.pageY,v),!0)}dateFormatActions(e){const{model:t}=this.irisGrid.props,{formatter:n}=t,s=n.getColumnFormat(e.type,e.name),i=Co.getOptions(n,s),o=[];for(let r=0;r<i.length;r+=1){const{description:l,format:a,group:c,isSelected:d,title:u}=i[r];o.push({title:u,description:l,icon:d?Wn:void 0,group:c,order:r,action:()=>{const m=t.getColumnIndexByName(e.name);O(m),this.irisGrid.handleFormatSelection(m,a)}})}return o}numberFormatActions(e){const{model:t}=this.irisGrid.props,{formatter:n}=t,s=n.getColumnFormat(e.type,e.name);let i;const o=t.getColumnIndexByName(e.name);if(A.isDecimalType(e.type))i=pi.getOptions(s,l=>{O(o),this.debouncedUpdateCustomFormat(o,l)});else if(A.isIntegerType(e.type))i=wo.getOptions(s,l=>{O(o),this.debouncedUpdateCustomFormat(o,l)});else return Tl.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?Wn:void 0,order:l,action:()=>{o===void 0&&a&&a.type===ke.TYPE_CONTEXT_CUSTOM||(O(o),this.irisGrid.handleFormatSelection(o,a))}})}return r}stringFilterActions(e,t,n,s,i){const o=I.FilterValue.ofString(n);let r=s;r||(r={filter:null,text:null});const{filter:l,text:a}=r,c=[],{model:d}=this.irisGrid.props,u=d.getColumnIndexByName(e.name);return O(u),c.push({menuElement:R("div",{className:"iris-grid-filter-menu-item-value",children:[i?q.getOperatorAsText(i):""," ",'"',t,'"']}),order:1,group:oe.groups.high}),c.push({title:"text is exactly",description:`Show only rows where ${e.name} is ${n} (case sensitive)`,action:()=>{this.irisGrid.setQuickFilter(u,q.getQuickFilterCondition(l,e.filter().eq(o),i),q.getQuickFilterText(a,`=${t}`,i))},order:10,group:oe.groups.low}),c.push({title:"text is not exactly",description:`Show only rows where ${e.name} is not ${t} (case sensitive)`,action:()=>{this.irisGrid.setQuickFilter(u,q.getQuickFilterCondition(l,e.filter().notEq(o),i),q.getQuickFilterText(a,`!=${t}`,i))},order:20,group:oe.groups.low}),c.push({title:"text contains",description:`Show only rows where ${e.name} contains ${t}`,action:()=>{this.irisGrid.setQuickFilter(u,q.getQuickFilterCondition(l,e.filter().contains(o),i),q.getQuickFilterText(a,`~${t}`,i))},order:30,group:oe.groups.low}),c.push({title:"text does not contain",description:`Show only rows where ${e.name} does not contain ${n}`,action:()=>{this.irisGrid.setQuickFilter(u,q.getQuickFilterCondition(l,e.filter().contains(o).not(),i),q.getQuickFilterText(a,`!~${t}`,i))},order:40,group:oe.groups.low}),c.push({title:"text starts with",description:`Show only rows where ${e.name} starts with ${t}`,action:()=>{this.irisGrid.setQuickFilter(u,q.getQuickFilterCondition(l,e.filter().invoke("startsWith",o),i),q.getQuickFilterText(a,`${t}*`,i))},order:50,group:oe.groups.low}),c.push({title:"text ends with",description:`Show only rows where ${e.name} ends with ${t}`,action:()=>{this.irisGrid.setQuickFilter(u,q.getQuickFilterCondition(l,e.filter().invoke("endsWith",o),i),q.getQuickFilterText(a,`*${t}`,i))},order:60,group:oe.groups.low}),c}numberFilterActions(e,t,n,s,i){const o=q.getFilterValueForNumberOrChar(e.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:d}=this.irisGrid.props,u=d.getColumnIndexByName(e.name);return O(u),a.push({menuElement:R("div",{className:"iris-grid-filter-menu-item-value",children:[i?q.getOperatorAsText(i):""," ",'"',t,'"']}),order:1,group:oe.groups.high}),a.push({title:"is equal to",description:`Show only rows where ${e.name} is ${t}`,action:()=>{const m=q.getNumberValueEqualsFilter(e,n);this.irisGrid.setQuickFilter(u,q.getQuickFilterCondition(r,m,i),q.getQuickFilterText(l,`=${t}`,i))},order:10,group:oe.groups.low}),a.push({title:"is not equal to",description:`Show only rows where ${e.name} is not ${t}`,action:()=>{const m=q.getNumberValueEqualsFilter(e,n).not();this.irisGrid.setQuickFilter(u,q.getQuickFilterCondition(r,m,i),q.getQuickFilterText(l,`!=${t}`,i))},order:20,group:oe.groups.low}),c&&!A.isCharType(e.type)&&(a.push({title:"greater than",description:`Show only rows where ${e.name} is greater than ${t}`,action:()=>{this.irisGrid.setQuickFilter(u,q.getQuickFilterCondition(r,e.filter().greaterThan(o),i),q.getQuickFilterText(l,`>${t}`,i))},order:30,group:oe.groups.low}),a.push({title:"greater than or equal to",description:`Show only rows where ${e.name} is greater than or equal to ${t}`,action:()=>{this.irisGrid.setQuickFilter(u,q.getQuickFilterCondition(r,e.filter().greaterThanOrEqualTo(o),i),q.getQuickFilterText(l,`>=${t}`,i))},order:40,group:oe.groups.low}),a.push({title:"less than",description:`Show only rows where ${e.name} is less than ${t}`,action:()=>{this.irisGrid.setQuickFilter(u,q.getQuickFilterCondition(r,e.filter().lessThan(o),i),q.getQuickFilterText(l,`<${t}`,i))},order:50,group:oe.groups.low}),a.push({title:"less than or equal to",description:`Show only rows where ${e.name} is less than or equal to ${t}`,action:()=>{this.irisGrid.setQuickFilter(u,q.getQuickFilterCondition(r,e.filter().lessThanOrEqualTo(o),i),q.getQuickFilterText(l,`<=${t}`,i))},order:60,group:oe.groups.low})),a}booleanFilterActions(e,t,n,s){const i=[],{model:o}=this.irisGrid.props,{filter:r,text:l}=n||{},a=o.getColumnIndexByName(e.name);return O(a),i.push({menuElement:R("div",{className:"iris-grid-filter-menu-item-value",children:[s?q.getOperatorAsText(s):""," ",'"',t!=null?t:"null",'"']}),order:1,group:oe.groups.high}),i.push({title:"true",description:`Show only rows where ${e.name} is true`,action:()=>{this.irisGrid.setQuickFilter(a,q.getQuickFilterCondition(r,e.filter().isTrue(),s),q.getQuickFilterText(l,"true",s))},order:10,group:oe.groups.low}),i.push({title:"false",description:`Show only rows where ${e.name} is false`,action:()=>{this.irisGrid.setQuickFilter(a,q.getQuickFilterCondition(r,e.filter().isFalse(),s),q.getQuickFilterText(l,"false",s))},order:20,group:oe.groups.low}),i.push({title:"is null",description:`Show only rows where ${e.name} is null`,action:()=>{this.irisGrid.setQuickFilter(a,q.getQuickFilterCondition(r,e.filter().isNull(),s),q.getQuickFilterText(l,"null",s))},order:30,group:oe.groups.low}),i.push({title:"is not null",description:`Show only rows where ${e.name} is not null`,action:()=>{this.irisGrid.setQuickFilter(a,q.getQuickFilterCondition(r,e.filter().isNull().not(),s),q.getQuickFilterText(l,"!null",s))},order:40,group:oe.groups.low}),i}dateFilterActions(e,t,n,s,i,o){const r=I.FilterValue.ofNumber(s);let l=null,a=null;i&&(l=i.filter,a=i.text);const{model:c}=this.irisGrid.props,d=c.getColumnIndexByName(e.name);O(d);const u=[];return u.push({menuElement:R("div",{className:"iris-grid-filter-menu-item-value",children:[o?q.getOperatorAsText(o):""," ",'"',n,'"']}),order:1,group:oe.groups.high}),u.push({title:"date is",description:`Show only rows where ${e.name} is ${n}`,action:()=>{this.irisGrid.setQuickFilter(d,q.getQuickFilterCondition(l,e.filter().eq(r),o),q.getQuickFilterText(a,`=${t}`,o))},order:10,group:oe.groups.low}),u.push({title:"date is not",description:`Show only rows where ${e.name} is not ${n}`,action:()=>{this.irisGrid.setQuickFilter(d,q.getQuickFilterCondition(l,e.filter().notEq(r),o),q.getQuickFilterText(a,`!=${t}`,o))},order:20,group:oe.groups.low}),u.push({title:"date is before",description:`Show only rows where ${e.name} is before ${n}`,action:()=>{this.irisGrid.setQuickFilter(d,q.getQuickFilterCondition(l,e.filter().lessThan(r),o),q.getQuickFilterText(a,`<${t}`,o))},order:30,group:oe.groups.low}),u.push({title:"date is before or equal",description:`Show only rows where ${e.name} is before or equal to ${n}`,action:()=>{this.irisGrid.setQuickFilter(d,q.getQuickFilterCondition(l,e.filter().lessThanOrEqualTo(r),o),q.getQuickFilterText(a,`<=${t}`,o))},order:40,group:oe.groups.low}),u.push({title:"date is after",description:`Show only rows where ${e.name} is greater than ${n}`,action:()=>{this.irisGrid.setQuickFilter(d,q.getQuickFilterCondition(l,e.filter().greaterThan(r),o),q.getQuickFilterText(a,`>${t}`,o))},order:50,group:oe.groups.low}),u.push({title:"date is after or equal",description:`Show only rows where ${e.name} is after or equal to ${n}`,action:()=>{this.irisGrid.setQuickFilter(d,q.getQuickFilterCondition(l,e.filter().greaterThanOrEqualTo(r),o),q.getQuickFilterText(a,`>=${t}`,o))},order:60,group:oe.groups.low}),u}nullFilterActions(e,t,n){let s=null,i=null;t&&(s=t.filter,i=t.text);const o=[],{model:r}=this.irisGrid.props,l=r.getColumnIndexByName(e.name);return O(l),o.push({menuElement:R("div",{className:"iris-grid-filter-menu-item-value",children:[n?q.getOperatorAsText(n):""," ",'"null"']}),order:1,group:oe.groups.high}),o.push({title:"is null",description:`Show only rows where ${e.name} is null`,action:()=>{this.irisGrid.setQuickFilter(l,q.getQuickFilterCondition(s,e.filter().isNull(),n),q.getQuickFilterText(i,"null",n))},order:10,group:oe.groups.low}),o.push({title:"is not null",description:`Show only rows where ${e.name} is not null`,action:()=>{this.irisGrid.setQuickFilter(l,q.getQuickFilterCondition(s,e.filter().isNull().not(),n),q.getQuickFilterText(i,"!null",n))},order:20,group:oe.groups.low}),o}sortByActions(e,t,n){const s=this.irisGrid.getTheme(),{contextMenuSortIconColor:i}=s,o=[{title:`${e.name} Ascending`,order:10,action:()=>{this.irisGrid.sortColumn(t,q.COLUMN_SORT_DIRECTION.ascending)},icon:this.checkColumnSort(n,q.COLUMN_SORT_DIRECTION.ascending)?cn:void 0,iconColor:i},{title:`${e.name} Descending`,order:20,action:()=>{this.irisGrid.sortColumn(t,q.COLUMN_SORT_DIRECTION.descending)},icon:this.checkColumnSort(n,q.COLUMN_SORT_DIRECTION.descending)?cn:void 0,iconColor:i},{title:"Remove Sort",order:50,action:()=>{this.irisGrid.sortColumn(t,q.COLUMN_SORT_DIRECTION.none,!1,!0)},disabled:!n}];return A.isNumberType(e.type)&&(o.push({title:`ABS(${e.name}) Ascending`,order:30,action:()=>{this.irisGrid.sortColumn(t,q.COLUMN_SORT_DIRECTION.ascending,!0)},icon:this.checkColumnSort(n,q.COLUMN_SORT_DIRECTION.ascending,!0)?cn:void 0,iconColor:i}),o.push({title:`ABS(${e.name}) Descending`,order:40,action:()=>{this.irisGrid.sortColumn(t,q.COLUMN_SORT_DIRECTION.descending,!0)},icon:this.checkColumnSort(n,q.COLUMN_SORT_DIRECTION.descending,!0)?cn:void 0,iconColor:i})),o}additionalSortActions(e,t){const n=this.irisGrid.getTheme(),{contextMenuSortIconColor:s}=n,i=[{title:"Add Sort By",menuElement:R("div",{className:"btn-context-menu menu-title",children:[h("span",{className:"icon",children:h(Q,{icon:cn,style:{color:s!=null?s:void 0}})}),h("span",{className:"title",children:"Add Additional Sort"}),h("span",{className:"shortcut",children:Ne.isMacPlatform()?"\u2318Click":"^Click"})]}),order:1},{title:`${e.name} Ascending`,order:10,action:()=>{this.irisGrid.sortColumn(t,q.COLUMN_SORT_DIRECTION.ascending,!1,!0)}},{title:`${e.name} Descending`,order:20,action:()=>{this.irisGrid.sortColumn(t,q.COLUMN_SORT_DIRECTION.descending,!1,!0)}}];return A.isNumberType(e.type)&&(i.push({title:`ABS(${e.name}) Ascending`,order:30,action:()=>{this.irisGrid.sortColumn(t,q.COLUMN_SORT_DIRECTION.ascending,!0,!0)}}),i.push({title:`ABS(${e.name}) Descending`,order:40,action:()=>{this.irisGrid.sortColumn(t,q.COLUMN_SORT_DIRECTION.descending,!0,!0)}})),i}checkColumnSort(e,t=null,n=!1){return e?e.direction===t&&e.isAbs===n:!1}};let yn=q;yn.GROUP_EDIT=oe.groups.high+10;yn.GROUP_HIDE_COLUMNS=oe.groups.high+25;yn.GROUP_FILTER=oe.groups.high+50;yn.GROUP_GOTO=oe.groups.high+51;yn.GROUP_SORT=oe.groups.high+75;yn.GROUP_COPY=oe.groups.high+100;yn.GROUP_FORMAT=oe.groups.high+150;yn.COLUMN_SORT_DIRECTION={ascending:"ASC",descending:"DESC",none:null};class Km extends Je{constructor(t){super(),this.irisGrid=t}onDoubleClick(t){const{column:n,row:s}=t;return s==null||n==null?!1:(this.irisGrid.selectData(n,s),!0)}}class Xm extends Je{constructor(t){super(),this.irisGrid=t}onDown(t){const{y:n,column:s,row:i}=t;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(t){const{y:n,column:s}=t,{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(t){const{column:n}=t,{hoverAdvancedFilter:s}=this.irisGrid.state;return s!==null&&n!==s&&this.irisGrid.setState({hoverAdvancedFilter:null}),!1}}class Ym extends Je{constructor(t){super(),this.column=null,this.irisGrid=t}getColumnFromGridPoint(t){const{column:n,row:s,columnHeaderDepth:i}=t;return n!==null&&s===null&&i===0?n:null}onDown(t){return this.column=this.getColumnFromGridPoint(t),!1}onClick(t,n,s){const i=this.getColumnFromGridPoint(t);if(i!=null&&i===this.column){const o=Ne.isModifierKeyDown(s);return this.irisGrid.toggleSort(i,o),!0}return!1}}class Qm extends Je{constructor(t){super(),this.irisGrid=t}onWheel(t,n,s){const{irisGrid:i}=this,{model:o}=i.props,{metrics:r,pendingRowCount:l}=i.state;O(r);const{bottom:a,rowCount:c,rowHeight:d}=r,{deltaY:u}=B.getScrollDelta(s);return Oe(o)&&o.isEditable&&a>=c-1&&u>0&&i.setState({pendingRowCount:l+Math.ceil(u/d)}),!1}}const jm=3e3;function Zm({children:e=null,onEntering:t,onEntered:n,onExiting:s,onExited:i}){const[o,r]=T.exports.useState(!1),l=T.exports.useRef(),a=Cr(e),c=T.exports.useCallback(()=>{r(!0),l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{r(!1)},jm)},[r,l]);return T.exports.useEffect(()=>{a!==e&&e!=null&&c()},[e,a,r,c]),T.exports.useEffect(()=>()=>l.current?clearTimeout(l.current):void 0,[]),h(fo,{className:"toast-bottom-bar",isShown:o,onEntering:t,onEntered:n,onExiting:s,onExited:i,children:e})}class Jm extends hi{getVisibleColumnWidth(t,n,s=this.getFirstColumn(n),i=this.calculateTreePaddingX(n)){var d,u,m;const{model:o}=n,r=(u=(d=o.layoutHints)==null?void 0:d.hiddenColumns)!=null?u:[],l=this.getModelColumn(t,n),a=super.getVisibleColumnWidth(t,n,s,i);return!this.userColumnWidths.has(l)&&r.includes((m=o.columns[l])==null?void 0:m.name)?0:a}getGridY(t){let n=super.getGridY(t);const{isFilterBarShown:s,theme:i,advancedFilters:o,quickFilters:r,sorts:l,reverseType:a}=t;return s?n+=i.filterBarHeight:(r!=null&&r.size>0||o!=null&&o.size>0)&&(n+=i.filterBarCollapsedHeight),a!==A.REVERSE_TYPE.NONE&&l!=null&&l.length>0&&(n+=i.reverseHeaderBarHeight),n}getUserColumnWidths(){return this.userColumnWidths}}const ep=1,Ua=J.memo(({model:e,modelColumns:t,top:n,bottom:s,left:i,right:o,filter:r,formatter:l,reverseType:a=A.REVERSE_TYPE.NONE,sorts:c,customColumns:d,movedColumns:u,hiddenColumns:m,alwaysFetchColumns:p,rollupConfig:g=null,totalsConfig:f=null,selectDistinctColumns:C=[],pendingRowCount:w=0,pendingDataMap:b=new Map,frozenColumns:S,formatColumns:E,columnHeaderGroups:v})=>{const y=T.exports.useMemo(()=>te.getModelViewportColumns(t,i,o,u,m,p,ep),[t,i,o,u,m,p]);return T.exports.useEffect(function(){e.filter=r},[e,r]),T.exports.useEffect(function(){const F=[...c];a!==A.REVERSE_TYPE.NONE&&F.push(I.Table.reverse()),e.sort=F},[e,c,a]),T.exports.useEffect(function(){e.formatter=l},[e,l]),T.exports.useEffect(function(){e.isCustomColumnsAvailable&&(e.customColumns=d)},[e,d]),T.exports.useEffect(function(){e.isFormatColumnsAvailable&&(e.formatColumns=E)},[e,E]),T.exports.useEffect(function(){e.setViewport(n,s,y)},[e,n,s,y]),T.exports.useEffect(function(){e.isRollupAvailable&&(e.rollupConfig=g)},[e,e.isRollupAvailable,g]),T.exports.useEffect(function(){e.isSelectDistinctAvailable&&(e.selectDistinctColumns=C)},[e,C]),T.exports.useEffect(function(){e.isTotalsAvailable&&(e.totalsConfig=f)},[e,e.isTotalsAvailable,f]),T.exports.useEffect(function(){e.pendingRowCount=w},[e,w]),T.exports.useEffect(function(){e.pendingDataMap=b},[e,b]),T.exports.useEffect(function(){S&&e.updateFrozenColumns(S)},[e,S]),T.exports.useEffect(function(){e.columnHeaderGroups=v},[e,v]),null});Ua.displayName="IrisGridModelUpdater";const zt=Object.freeze({SORT_UP:"sortUp",SORT_DOWN:"sortDown",CARET_DOWN:"caretDown",CARET_RIGHT:"caretRight",CELL_OVERFLOW:"cellOverflow"}),Ho=16;class ci extends Ls{constructor(){super(),this.icons={},this.initIcons()}static isFilterValid(t,n){const s=t==null||t.filter!=null,i=n==null||n.filter!=null;return s&&i}initIcons(){this.setIcon(zt.SORT_UP,Eu),this.setIcon(zt.SORT_DOWN,Tu),this.setIcon(zt.CARET_DOWN,Bn),this.setIcon(zt.CARET_RIGHT,sa),this.setIcon(zt.CELL_OVERFLOW,Kd)}setIcon(t,n){const s=Array.isArray(n.icon[4])?n.icon[4][0]:n.icon[4],i=new Path2D(s),o=new Path2D,r={a:Ho/n.icon[0],d:Ho/n.icon[1]};o.addPath(i,r),this.icons[t]=o}getIcon(t){return this.icons[t]}getSortIcon(t){return t?t.direction===A.sortDirection.ascending?this.getIcon(zt.SORT_UP):t.direction===A.sortDirection.descending?this.getIcon(zt.SORT_DOWN):null:null}drawCanvas(t){super.drawCanvas(t),this.drawScrim(t)}drawGrid(t,n){super.drawGrid(t,n),this.drawCellOverflowButton(n)}drawGridLines(t,n){super.drawGridLines(t,n),this.drawGroupedColumnLine(t,n),this.drawPendingRowLine(t,n)}drawCellContent(t,n,s,i){var m;const{metrics:o,model:r}=n,{modelColumns:l,modelRows:a}=o,c=L(a,i),d=l.get(s);if(d===void 0)return;const u=r.valueForCell(d,c);if(A.isTextType((m=r.columns[d])==null?void 0:m.type)&&(u===null||u==="")){const p=t.font;t.font=`italic ${p}`;const g=u===null?"null":"empty";super.drawCellContent(t,n,s,i,g),t.font=p;return}super.drawCellContent(t,n,s,i)}drawGroupedColumnLine(t,n){const{metrics:s,model:i,theme:o}=n,{groupedColumns:r,columns:l}=i,{maxY:a,visibleColumnWidths:c,visibleColumnXs:d}=s;if(r.length===0||o.groupedColumnDividerColor==null)return;const u=r[r.length-1],m=l.findIndex(C=>C.name===u.name),p=d.get(m),g=c.get(m);if(p==null||g==null)return;const f=p+g+.5;t.strokeStyle=o.groupedColumnDividerColor,t.lineWidth=1,t.beginPath(),t.moveTo(f,0),t.lineTo(f,a),t.stroke()}drawPendingRowLine(t,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 d=r.get(c);d!=null&&(d-=.5,t.save(),t.setLineDash([4,2]),t.strokeStyle=o.pendingTextColor,t.lineWidth=1,t.beginPath(),t.moveTo(0,d),t.lineTo(l,d),t.stroke(),t.restore())}drawMouseColumnHover(t,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),d=r.get(o);O(c),O(d),t.fillStyle=s.linkerColumnHoverBackgroundColor,t.fillRect(c,0,d,a)}drawMouseRowHover(t,n){const{isSelectingColumn:s}=n;s||super.drawMouseRowHover(t,n)}drawScrim(t){const{context:n,loadingScrimProgress:s,metrics:i,theme:o}=t;if(s==null)return;const{width:r,height:l,gridY:a}=i,{scrimBlurSize:c,scrimColor:d}=o;n.save(),n.globalCompositeOperation="color",n.filter=`blur(${c}px)`,d!=null&&(n.fillStyle=d),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.globalCompositeOperation="overlay",n.filter=`blur(${c}px) opacity(15%)`,n.fillRect(-c,-c+a,c*2+r,(c*2+(l-a))*s),n.restore()}drawColumnHeaders(t,n){super.drawColumnHeaders(t,n);const{theme:s,metrics:i,model:o,reverseType:r}=n,{columnHeaderHeight:l}=i;if(this.drawFilterHeaders(t,n),l<=0)return;const{sort:a}=o;if(a.length===1){const c=r!==A.REVERSE_TYPE.NONE;let d;c?d=s.headerReverseBarColor:d=s.headerSortBarColor,this.drawHeaderBar(t,n,d,c?s.reverseHeaderBarHeight:s.sortHeaderBarHeight)}else a.length>1&&(r!==A.REVERSE_TYPE.NONE&&this.drawHeaderBar(t,n,s.headerReverseBarColor,s.reverseHeaderBarHeight,!1),this.drawHeaderBar(t,n,s.headerSortBarColor,s.sortHeaderBarHeight))}drawHeaderBar(t,n,s,i,o=!0){const{theme:r,metrics:l,model:a}=n,{columnHeaderHeight:c,width:d}=l;let u=0;o||(u=i),t.fillStyle=r.headerBarCasingColor,t.fillRect(0,a.columnHeaderMaxDepth*c-i-2+u,d,i+2),t.fillStyle=s,t.fillRect(0,a.columnHeaderMaxDepth*c-i-1+u,d,i)}drawColumnHeadersAtDepth(t,n,s,i,o){const{metrics:r,model:l,isMenuShown:a}=n,{columnHeaderMaxDepth:c}=l,{width:d}=r,u={...i,maxX:o===c-1&&i.maxX===d?d-(a?0:30):i.maxX};super.drawColumnHeadersAtDepth(t,n,s,u,o)}drawColumnHeaderAtIndex(t,n,s,i){var H;super.drawColumnHeaderAtIndex(t,n,s,i);const{metrics:o,model:r,theme:l}=n,{modelColumns:a,visibleColumnWidths:c,visibleColumnXs:d,gridX:u,columnHeaderHeight:m,fontWidths:p}=o,{headerHorizontalPadding:g}=l,f=L(c,s,0),C=L(d,s)+u,w=a.get(s);if(w==null)return;const b=A.getSortForColumn(r.sort,w);if(!b)return;const S=this.getSortIcon(b);if(!S)return;const E=r.textForColumnHeader(w);if(E===void 0)return;const v=(H=p.get(t.font))!=null?H:Ls.DEFAULT_FONT_WIDTH;O(v);const y=E.length*v,M=u+C+y+g;let{maxX:F}=i;F-=g;const x=u+C+f-g-1,U=M>F?M+1:Math.min(F,x),V=b.direction===A.sortDirection.ascending?-6:-12,N=m*.5+V;t.save(),t.beginPath(),t.rect(C,0,f,m),t.clip(),t.fillStyle=l.headerSortBarColor,t.translate(U,N),t.fill(S),t.restore()}drawFilterHeaders(t,n){const{isFilterBarShown:s,quickFilters:i,advancedFilters:o}=n;s?this.drawExpandedFilterHeaders(t,n):(i!=null&&i.size>0||o!=null&&o.size>0)&&this.drawCollapsedFilterHeaders(t,n)}drawExpandedFilterHeaders(t,n){const{metrics:s,model:i,theme:o,quickFilters:r,advancedFilters:l}=n,{filterBarHeight:a}=o;if(a<=0)return;const{gridX:c,gridY:d,maxX:u,modelColumns:m,visibleColumns:p,visibleColumnWidths:g,visibleColumnXs:f}=s,C=d-a;t.save(),t.font=o.font,t.textAlign="left",r!=null&&r.size>0||l!=null&&l.size>0?t.fillStyle=o.filterBarExpandedActiveBackgroundColor:t.fillStyle=o.filterBarExpandedBackgroundColor,t.fillRect(c,C,u,a-1),t.fillStyle=o.headerBarCasingColor,t.fillRect(c,C+a-1,u,1);const w=C;t.strokeStyle=o.filterBarSeparatorColor,t.beginPath();for(let b=0;b<p.length;b+=1){const S=p[b],E=L(m,S),v=L(f,S),y=L(g,S);if(i.isFilterable(E)&&y>0){const M=c+(v!=null?v:0);t.rect(M+.5,w+.5,y,a-2)}}t.stroke();for(let b=0;b<p.length;b+=1){const S=p[b],E=L(g,S),y=L(f,S)+c;this.drawExpandedFilterHeader(t,n,S,y,E)}t.restore()}drawExpandedFilterHeader(t,n,s,i,o){if(o<=0)return;const{metrics:r,theme:l,quickFilters:a,advancedFilters:c}=n,{modelColumns:d,gridY:u}=r,{filterBarHeight:m,filterBarExpandedActiveCellBackgroundColor:p,filterBarErrorColor:g,filterBarHorizontalPadding:f,headerColor:C}=l,w=u-m,b=d.get(s);if(b===void 0)return;const S=a.get(b),E=c.get(b);if(S==null&&E==null)return;let v=null;if(S!=null){const{text:M}=S;if(v=M,v||(v=A.getFilterText(S.filter)),v!=null){const{fontWidths:F}=r;let x=F.get(t.font);(x==null||x===0)&&(x=t.measureText("8").width,x||(x=10));const U=(o-f*2)/x;U<=0?v="":v.length>U&&(v=`${v.substring(0,U-1)}\u2026`)}}if(t.save(),ci.isFilterValid(E,S)&&p!=null)t.fillStyle=p,t.fillRect(i+1,w+1,o-1,m-3);else if(g!=null){t.fillStyle=g,t.lineWidth=2,t.strokeStyle=g;const M=i+2,F=w+2,x=o-3,U=m-5;t.strokeRect(M,F,x,U)}if(v!=null&&v!==""){const M=i+f,F=w+m*.5+1;t.fillStyle=C,t.fillText(v,M,F)}t.restore()}drawCollapsedFilterHeaders(t,n){const{metrics:s,theme:i}=n,{headerSeparatorColor:o,filterBarCollapsedHeight:r}=i;if(r<=0)return;const{gridX:l,gridY:a,maxX:c,visibleColumns:d,visibleColumnWidths:u,visibleColumnXs:m}=s,p=a-r;t.save(),t.fillStyle=o,t.fillRect(l,p,c,r);for(let g=0;g<d.length;g+=1){const f=d[g],C=u.get(f),w=m.get(f);if(w!=null&&C!=null){const b=w+l;this.drawCollapsedFilterHeader(t,n,f,b,C)}}t.restore()}drawCollapsedFilterHeader(t,n,s,i,o){if(o<=0)return;const{metrics:r,theme:l,quickFilters:a,advancedFilters:c}=n,{modelColumns:d,gridY:u}=r,m=d.get(s);if(m===void 0)return;const p=a.get(m),g=c.get(m),{filterBarCollapsedHeight:f,filterBarActiveColor:C,filterBarActiveBackgroundColor:w,filterBarErrorColor:b}=l;t.save();const S=ci.isFilterValid(g,p);w!=null&&p==null&&g==null?t.fillStyle=w:C!=null&&S?t.fillStyle=C:b!=null&&(t.fillStyle=b);const E=i+1,v=u-f,y=o-1,M=f-1;t.fillRect(E,v,y,M),t.restore()}drawTreeMarker(t,n,s,i,o,r,l){t.save();const{x1:a,y1:c}=o,d=l?this.getIcon(zt.CARET_DOWN):this.getIcon(zt.CARET_RIGHT),u=s+a-2,m=i+c+2.5;t.fillStyle=r,t.textAlign="center",t.translate(u,m),t.fill(d),t.restore()}drawRowFooters(t,n){const{metrics:s,model:i,mouseX:o,mouseY:r,theme:l}=n,{gridY:a,gridX:c,maxX:d,modelRows:u,floatingTopHeight:m,floatingBottomHeight:p,floatingRows:g,rowFooterWidth:f,height:C,horizontalBarHeight:w,verticalBarWidth:b,visibleRowHeights:S,visibleRowYs:E,width:v}=s;if(f<=0||g.length===0)return;const{cellHorizontalPadding:y,floatingGridRowColor:M,floatingRowBackgroundColors:F,headerColor:x,rowHoverBackgroundColor:U}=l;t.translate(c,a),t.beginPath();const V=Math.min(d,v-f-b-c);t.fillStyle=F,m>0&&t.rect(V,0,f,m),p>0&&t.rect(V,C-a-w-p,f,p),t.fill();const N=o!=null&&r!=null&&o>=c&&o<=d+f?B.getRowAtY(r,s):null;if(U!=null&&N!==null&&g.includes(N)){t.fillStyle=U;const k=E.get(N),z=S.get(N);O(k),O(z),t.fillRect(V,k,f,z)}if(t.beginPath(),M!=null&&(t.strokeStyle=M),m>0&&(t.moveTo(V+.5,.5),t.lineTo(V+.5,m-.5)),p>0){const k=C-a-w-p;t.moveTo(V-.5,k+.5),t.lineTo(V-.5,k+p-.5)}t.stroke(),t.fillStyle=x,t.textAlign="left";const H=V+y;for(let k=0;k<g.length;k+=1){const z=g[k],P=S.get(z),_=E.get(z),$=u.get(z);if(_!=null&&P!=null&&$!=null){const X=_+P*.5;t.fillText(i.textForRowFooter($),H,X)}}t.translate(-c,-a)}getTextRenderMetrics(t,n,s,i){const o=super.getTextRenderMetrics(t,n,s,i),{mouseX:r,mouseY:l,metrics:a}=n;if(r==null||l==null)return o;const{column:c,row:d}=B.getGridPointFromXY(r,l,a);if(s===c&&i===d){const{left:u}=this.getCellOverflowButtonPosition(n);this.shouldRenderOverflowButton(n)&&u!=null&&(o.width=u-a.gridX-o.x)}return o}shouldRenderOverflowButton(t){var C,w;const{context:n,mouseX:s,mouseY:i,metrics:o,model:r,theme:l}=t;if(s==null||i==null)return!1;const{row:a,column:c,modelRow:d,modelColumn:u}=B.getCellInfoFromXY(s,i,o);if(a==null||c==null||d==null||u==null||!A.isStringType(r.columns[u].type))return!1;const m=(C=r.textForCell(u,d))!=null?C:"",{width:p}=super.getTextRenderMetrics(n,t,c,a),g=(w=o.fontWidths.get(l.font))!=null?w:ci.DEFAULT_FONT_WIDTH;n.save(),n.font=l.font;const f=this.getCachedTruncatedString(n,m,p,g,r.truncationCharForCell(u,d));return n.restore(),m!==""&&f!==m}getCellOverflowButtonPosition({mouseX:t,mouseY:n,metrics:s,theme:i}){const o={left:null,top:null,width:null,height:null};if(t==null||n==null||!s)return o;const{rowHeight:r,columnWidth:l,left:a,top:c}=B.getCellInfoFromXY(t,n,s);O(a),O(l),O(c);const{width:d,verticalBarWidth:u}=s,{cellHorizontalPadding:m}=i,p=Ho+2*m,g=r,C=Math.min(s.gridX+a+l,d-u)-p,w=s.gridY+c;return{left:C,top:w,width:p,height:g}}drawCellOverflowButton(t){const{context:n,mouseX:s,mouseY:i,theme:o}=t;if(s==null||i==null||!this.shouldRenderOverflowButton(t))return;const{left:r,top:l,width:a,height:c}=this.getCellOverflowButtonPosition(t),{cellHorizontalPadding:d,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(zt.CELL_OVERFLOW);r!=null&&l!=null&&n.translate(r+d,l+2),n.fill(p),n.restore()}}const tp="12px Fira Sans, sans-serif",np="#f0f0ee",sp="#1a171a",se={"grid-bg":"#211f22",font:tp,white:np,black:sp,"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":"#211f22","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"},Ba=Object.freeze({backgroundColor:se["grid-bg"],white:se.white,black:se.black,font:se.font,headerBackgroundColor:se["header-bg"],headerColor:se["header-color"],headerSeparatorColor:se["header-separator-color"],headerSeparatorHoverColor:se["header-separator-hover-color"],headerHiddenSeparatorHoverColor:se["header-hidden-separator-hover-color"],headerSortBarColor:se["header-sort-bar-color"],headerReverseBarColor:se["header-reverse-bar-color"],headerBarCasingColor:se["header-bar-casing-color"],headerFont:se["header-font"],rowBackgroundColors:se["row-background-colors"],rowHoverBackgroundColor:se["row-hover-bg"],selectionColor:se["selection-color"],selectionOutlineColor:se["selection-outline-color"],selectionOutlineCasingColor:se["selection-outline-casing-color"],selectedRowHoverBackgroundColor:se["selected-row-hover-bg"],scrollBarBackgroundColor:se["scroll-bar-bg"],scrollBarHoverBackgroundColor:se["scroll-bar-hover-bg"],scrollBarCasingColor:se["scroll-bar-casing-color"],scrollBarCornerColor:se["scroll-bar-corner-color"],scrollBarColor:se["scroll-bar-color"],scrollBarHoverColor:se["scroll-bar-hover-color"],scrollBarActiveColor:se["scroll-bar-active-color"],scrollBarSelectionTickColor:se["selected-row-hover-bg"],scrollBarActiveSelectionTickColor:se["scroll-bar-active-selection-tick-color"],textColor:se["text-color"],positiveNumberColor:se["positive-number-color"],negativeNumberColor:se["negative-number-color"],zeroNumberColor:se["zero-number-color"],dateColor:se["date-color"],pendingTextColor:se["pending-text-color"],errorTextColor:se["error-text-color"],nullStringColor:se["null-string-color"],filterBarActiveBackgroundColor:se["filter-bar-active-bg"],filterBarExpandedBackgroundColor:se["filter-bar-expanded-bg"],filterBarExpandedActiveBackgroundColor:se["filter-bar-expanded-active-bg"],filterBarExpandedActiveCellBackgroundColor:se["filter-bar-expanded-active-cell-bg"],filterBarSeparatorColor:se["filter-bar-separator-color"],filterBarActiveColor:se["filter-bar-active-color"],filterBarErrorColor:se["filter-bar-error-color"],filterIconColor:se["filter-icon-color"],scrimColor:se["scrim-color"],contextMenuSortIconColor:se["context-menu-sort-icon-color"],contextMenuReverseIconColor:se["context-menu-reverse-icon-color"],allowRowResize:!1,autoSelectRow:!0,gridColumnColor:null,gridRowColor:null,groupedColumnDividerColor:se["grouped-column-divider-color"],columnHoverBackgroundColor:null,headerHorizontalPadding:12,scrollBarSize:13,scrollBarHoverSize:16,minScrollHandleSize:24,rowHeight:parseInt(se["row-height"],10)||19,columnWidth:100,rowHeaderWidth:0,rowFooterWidth:60,columnHeaderHeight:parseInt(se["header-height"],10)||30,filterBarHeight:30,filterBarCollapsedHeight:5,sortHeaderBarHeight:2,reverseHeaderBarHeight:4,filterBarHorizontalPadding:4,scrimBlurSize:25,minScrimTransitionTime:150,maxScrimTransitionTime:350,scrollSnapToRow:!0,linkerColumnHoverBackgroundColor:se["linker-column-hover-bg"],treeLineColor:se["tree-line-color"],treeMarkerColor:se["tree-marker-color"],treeMarkerHoverColor:se["tree-marker-hover-color"],floatingGridColumnColor:null,floatingGridRowColor:se["floating-grid-row-color"],floatingRowBackgroundColors:se["floating-row-background-colors"],floatingDividerInnerColor:se["floating-divider-inner-color"],floatingDividerOuterColor:se["floating-divider-outer-color"],overflowButtonColor:se["overflow-button-color"],overflowButtonHoverColor:se["overflow-button-hover-color"]});const _o=ne.module("ColumnStatistics"),ip={SIZE:"Number of Rows"},jo=class extends T.exports.Component{constructor(e){super(e),this.handleError=this.handleError.bind(this),this.handleGenerateStatistics=this.handleGenerateStatistics.bind(this),this.handleStatistics=this.handleStatistics.bind(this),this.cancelablePromise=null,this.state={error:null,loading:!1,statistics:null,numRows:0}}static getStatsLabel(e){var t;return(t=ip[e])!=null?t:e.split(" ").map(n=>n[0].toUpperCase()+n.substr(1).toLowerCase()).join(" ")}componentDidMount(){this.maybeGenerateStatistics()}componentWillUnmount(){this.cancelablePromise&&this.cancelablePromise.cancel()}maybeGenerateStatistics(){const{model:e}=this.props,t=e.rowCount-e.pendingRowCount;this.setState({numRows:t}),e.isColumnStatisticsAvailable?t<jo.AUTO_GENERATE_LIMIT&&this.handleGenerateStatistics():this.setState({loading:!1})}handleGenerateStatistics(){this.setState({loading:!0});const{column:e,model:t}=this.props;this.cancelablePromise=Pe.makeCancelable(t.columnStatistics(e)),this.cancelablePromise.then(this.handleStatistics).catch(this.handleError)}handleStatistics(e){_o.debug("Received statistics",e);const{model:t,onStatistics:n}=this.props,s=[];e.statisticsMap.forEach((i,o)=>{s.push({operation:jo.getStatsLabel(o),value:i,type:e.getType(o)})}),e.uniqueValues.forEach((i,o)=>{s.push({operation:o,className:"column-statistics-unique-value",value:i,type:"long"})}),this.setState({loading:!1,statistics:s,numRows:t.rowCount-t.pendingRowCount}),n()}handleError(e){if(e!=null&&Pe.isCanceled(e)){_o.debug("Called handleError on a cancelled promise result");return}_o.error("Error generating statistics",e),this.setState({error:e,loading:!1,statistics:null})}render(){const{column:e,model:t}=this.props,{error:n,loading:s,statistics:i,numRows:o}=this.state,r=!s&&n==null&&i==null&&t.isColumnStatisticsAvailable,l=[],a=e.type.substring(e.type.lastIndexOf(".")+1),c=e.description===null?null:e.description;if(i!=null)for(let p=0;p<i.length;p+=1){const{operation:g,className:f,value:C,type:w}=i[p],b=w?t.displayString(C,w):t.displayString(C,e.type,e.name),S=R(J.Fragment,{children:[h("div",{className:G("column-statistic-operation",f),children:g}),h("div",{className:"column-statistic-value",children:b})]},g);l.push(S)}const d=We(t)&&t.hasExpandableRows?"Expanded Rows":"Number of Rows",u=t.displayString(o,"long"),m=t.getColumnIndexByName(e.name);return R("div",{className:"column-statistics",children:[R("div",{className:"column-statistics-title",children:[e.name,R("span",{className:"column-statistics-type",children:["\xA0(",a,")"]}),h(ha,{className:"column-statistics-copy",tooltip:"Copy column name",copy:e.name})]}),c!=null&&h("div",{className:"column-statistics-description",children:c}),m!=null&&!t.isColumnMovable(m)&&R("div",{className:"column-statistics-status",children:[h(Q,{icon:t.isColumnFrozen(m)?fu:Yd,className:"mr-1"}),t.isColumnFrozen(m)?"Frozen":"Not movable"]}),R("div",{className:"column-statistics-grid",children:[i==null&&R(Fe,{children:[h("div",{className:"column-statistic-operation",children:d}),h("div",{className:"column-statistic-value",children:u})]}),l]}),r&&h(K,{kind:"ghost",className:"px-0",onClick:this.handleGenerateStatistics,children:"Generate Stats"}),n!=null&&h("div",{className:"error-message",children:`${n}`}),i&&!s&&h(K,{kind:"ghost",className:"px-0",onClick:this.handleGenerateStatistics,icon:h(Q,{icon:Su,className:"mr-1"}),children:"Refresh"}),s&&R("div",{className:"column-statistics-loading",children:[h(Ht,{className:"mr-2"}),"Calculating Stats..."]})]})}};let Ga=jo;Ga.AUTO_GENERATE_LIMIT=1e5;const Pi=ne.module("AdvancedFilterCreatorFilterItem");class Dr extends T.exports.PureComponent{constructor(t){super(t),this.getCachedIsValid=Ee((o,r,l,a)=>{try{return!l||A.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]}=t;this.state={selectedType:i,value:n}}static getLabelForFilter(t,n){try{if(A.isNumberType(t)||A.isCharType(t))return Xh(n);if(A.isTextType(t))return Kh(n);if(A.isDateType(t))return Yh(n);if(A.isBooleanType(t))return Qh(n);throw new Error(`Unrecognized column type: ${t}`)}catch(s){return Pi.warn(s),""}}componentDidMount(){var t;(t=this.typeDropdown)==null||t.focus()}componentDidUpdate(t){const{value:n,selectedType:s}=this.props;s!==void 0&&t.selectedType!==s&&this.setState({selectedType:s}),n!==void 0&&t.value!==n&&this.setState({value:n})}handleTypeChange(t){const n=t.target.value;Pi.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(t){Pi.debug2("valueChange");const{value:n}=t.target;this.setState({value:n});const{onChange:s}=this.props,{selectedType:i}=this.state;i!=null&&s(i,n)}handleDelete(){Pi.debug("delete");const{onDelete:t}=this.props;t()}render(){const{column:t,filterTypes:n,formatter:s}=this.props,{selectedType:i,value:o}=this.state,r=!A.isBooleanType(t.type),l=[],a=this.getCachedIsValid(t,i,o,s.timeZone);for(let c=0;c<n.length;c+=1){const d=n[c],u=Dr.getLabelForFilter(t.type,d),m=h("option",{value:d,children:u},d);l.push(m)}return h("div",{className:"advanced-filter-creator-filter-item",children:R("div",{className:"form-row",children:[h("div",{className:"form-group col",children:h("select",{className:"form-control custom-select",value:i,onChange:this.handleTypeChange,ref:c=>{this.typeDropdown=c},children:l})}),r&&h("div",{className:"form-group col",children:h("div",{className:"input-group",children:h("input",{type:"text",className:G("form-control",{error:!a}),placeholder:"Enter value",value:o,onChange:this.handleValueChange})})}),h("div",{className:"form-group col-1 px-0",children:h(K,{kind:"ghost",className:"w-100 h-100 p-0 m-0",onClick:this.handleDelete,icon:Tn,tooltip:"Remove Filter"})})]})})}}const yl=ne.module("AdvancedFilterCreatorSelectValueList"),Zo=class extends T.exports.PureComponent{constructor(e){super(e),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:t}=this.props;this.state={itemCount:0,items:[],offset:0,selectedValues:t,isLoading:!0}}static indexOf(e,t){for(let n=0;n<t.length;n+=1){const s=t[n];if(s===e||s!=null&&s.valueOf!=null&&e!=null&&e.valueOf!=null&&s.valueOf()===e.valueOf())return n}return-1}componentDidMount(){const{table:e}=this.props;e&&this.startListening(e)}componentDidUpdate(e){const{filters:t,invertSelection:n,selectedValues:s,table:i}=this.props;e.table!==i&&(e.table&&this.stopListening(e.table),i&&this.startListening(i),this.resetViewport()),e.invertSelection!==n&&this.setState({selectedValues:[]},this.handleSelectionUpdate),e.selectedValues!==s&&this.setState({selectedValues:s},this.handleSelectionUpdate),e.filters!==t&&(i==null||i.applyFilter(t),this.resetViewport())}componentWillUnmount(){const{table:e}=this.props;e&&this.stopListening(e)}handleSelect(e,t){const{invertSelection:n}=this.props;let{selectedValues:s}=this.state;s=[...s];const i=Zo.indexOf(t,s);i>=0?s.splice(i,1):s.push(t);let o=i<0;n&&(o=!o);const{offset:r}=this.state;let{items:l}=this.state;l=[...l];const a=e-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(e,t){this.updateViewport(e,t)}handleSelectionUpdate(){this.updateItemSelection()}handleTableUpdate(e){const{table:t,formatter:n}=this.props;if(!t)return;const s=e.detail,{offset:i}=s,o=[],r=t.columns[0];for(let a=0;a<s.rows.length;a+=1){const d=s.rows[a].get(r),u=n.getFormattedString(d,r.type,r.name),m=this.isValueSelected(d);o.push({displayValue:u,value:d,isSelected:m})}yl.debug2("Received table update:",i,o.length);const l=t.size;this.setState({itemCount:l,items:o,offset:i,isLoading:!1})}isValueSelected(e){const{invertSelection:t}=this.props,{selectedValues:n}=this.state,s=Zo.indexOf(e,n);return t?s<0:s>=0}startListening(e){e.addEventListener(I.Table.EVENT_UPDATED,this.handleTableUpdate)}stopListening(e){e.removeEventListener(I.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:e}=this.state;e=[...e];for(let t=0;t<e.length;t+=1){const n=e[t],{value:s}=n;n.isSelected=this.isValueSelected(s)}this.setState({items:e})}updateViewport(e,t,n=!1){const{table:s}=this.props;if(s==null)return;n&&this.setState({isLoading:!0});const i=t-e+1,o=Math.max(0,e-i*3),r=Math.max(o,t+i*3);yl.debug2("Setting viewport",o,",",r),s.setViewport(o,r)}render(){const{offset:e,isLoading:t,items:n,itemCount:s}=this.state;return R("div",{className:"select-value-list-wrapper",children:[h(Ra,{itemCount:s,items:n,offset:e,onSelect:this.handleSelect,onViewportChange:this.handleViewportChange,ref:i=>{this.list=i}}),h(lt,{in:t,timeout:250,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:h("div",{className:"loading-list",children:h(Ht,{className:"loading-spinner-large"})})})]})}};let za=Zo;za.defaultProps={invertSelection:!0,selectedValues:[],onChange:()=>{}};const Wa=class extends T.exports.PureComponent{constructor(e){super(e),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:t,selectedValues:n}=e;this.state={filters:[],invertSelection:t,selectedValues:n,searchText:""}}componentDidMount(){this.initSearchTable()}componentDidUpdate(e,t){const{invertSelection:n,selectedValues:s,table:i}=this.props;e.table!==i&&this.initSearchTable(),e.invertSelection!==n&&this.setState({invertSelection:n}),e.selectedValues!==s&&this.setState({selectedValues:s});const{table:o,searchText:r}=this.state;o!==t.table&&(t.table!=null&&t.table.close(),o!=null&&this.startUpdateFilterTimer()),r!==t.searchText&&this.startUpdateFilterTimer()}componentWillUnmount(){const{table:e}=this.state;e!=null&&e.close(),this.searchTablePromise=void 0,this.stopUpdateFilterTimer()}getColumnName(){const{table:e}=this.props;return e!=null?e.columns[0].name:""}getDisplayedValuesCount(){const{invertSelection:e,selectedValues:t,table:n}=this.state;return n==null?null:e?n.totalSize-t.length:t.length}getDisplayedValueText(){const e=this.getDisplayedValuesCount(),{table:t}=this.state,{formatter:n}=this.props;if(e!=null&&t!=null){const s=n.getFormattedString(e,"long"),i=n.getFormattedString(t.totalSize,"long");let o="";return e<1e6&&(o="Displaying "),`${o}${s} of ${i}`}return null}initSearchTable(){const{table:e}=this.props;if(e==null)return;const t=e.copy();this.searchTablePromise=t,this.searchTablePromise.then(n=>{this.searchTablePromise===t?(this.setState({table:n}),this.searchTablePromise=void 0):n.close()})}handleListChange(e,t){this.setState({selectedValues:e,invertSelection:t});const{onChange:n}=this.props;n(e,t)}handleSearchChange(e){const t=e.target.value;this.setState({searchText:t})}handleSelectAllClick(){this.resetSelection(!0)}handleClearAllClick(){this.resetSelection(!1)}handleUpdateFilterTimeout(){this.updateFilterTimer=void 0,this.updateTableFilter()}resetSelection(e){const t=[];this.setState({invertSelection:e,selectedValues:t});const{onChange:n}=this.props;n(t,e)}startUpdateFilterTimer(){this.stopUpdateFilterTimer(),this.updateFilterTimer=setTimeout(this.handleUpdateFilterTimeout,Wa.searchDebounceTime)}stopUpdateFilterTimer(){this.updateFilterTimer!=null&&(clearTimeout(this.updateFilterTimer),this.updateFilterTimer=void 0)}updateTableFilter(){const{table:e,searchText:t}=this.state,{timeZone:n}=this.props,s=e==null?void 0:e.columns[0],i=[];if(s==null)return;let o;if(t.length>0){let r=null;A.isCharType(s.type)?r=A.makeQuickFilter(s,t):A.isTextType(s.type)?r=A.makeQuickFilter(s,`~${t}`,n):r=A.makeQuickFilter(s,`>=${t}`,n),r!=null?i.push(r):o="Invalid search text"}this.setState({filters:i,error:o})}render(){const{error:e,filters:t,invertSelection:n,selectedValues:s,searchText:i,table:o}=this.state,{formatter:r,showSearch:l}=this.props,a=this.getColumnName(),c=this.getDisplayedValueText(),d=a?`Find ${a}...`:"";return R("div",{className:"advanced-filter-creator-select-value",children:[R("div",{className:l?"form-group":"",children:[h("label",{htmlFor:"advanced-filter-creator-select-value-input",children:"Select Values"}),l&&h("input",{type:"text",className:G("form-control",{"is-invalid":e!=null}),id:"advanced-filter-creator-select-value-input",placeholder:d,value:i,onChange:this.handleSearchChange})]}),h(za,{table:o,filters:t,invertSelection:n,selectedValues:s,formatter:r,onChange:this.handleListChange}),R("div",{className:"advanced-filter-creator-select-meta-row",children:[R("div",{children:[h(K,{kind:"ghost",onClick:this.handleSelectAllClick,children:"Select All"}),h(K,{kind:"ghost",onClick:this.handleClearAllClick,children:"Clear"})]}),h(lt,{in:c!=null,timeout:250,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:h("div",{className:"row-count-info",children:c})})]})]})}};let Nr=Wa;Nr.searchDebounceTime=250;Nr.defaultProps={invertSelection:!0,selectedValues:[],onChange:()=>{},showSearch:!0};const Js=ne.module("AdvancedFilterCreator"),ls=class extends T.exports.PureComponent{constructor(e){var r,l;super(e),this.getFilterTypes=Ee(a=>A.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=J.createRef();const{options:t}=e;let{filterOperators:n,invertSelection:s,selectedValues:i}=t;const o=(l=(r=t.filterItems)==null?void 0:r.map(({selectedType:a,value:c})=>({selectedType:a,value:c,key:tn()})))!=null?l:[];o.length===0&&o.push(ls.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:tn()}}componentDidMount(){this.initValuesTable()}componentWillUnmount(){this.debounceTimeout!=null&&(clearTimeout(this.debounceTimeout),this.sendUpdate()),this.valuesTablePromise!=null&&this.valuesTablePromise.cancel()}getFilterChangeHandler(e){return this.handleFilterChange.bind(this,e)}getFilterDeleteHandler(e){return this.handleFilterDelete.bind(this,e)}initValuesTable(){const{model:e,column:t}=this.props;if(!e.isValuesTableAvailable){Js.debug("No values table for this model, just ignore");return}this.valuesTablePromise=A.makeCancelableTablePromise(e.valuesTable(t)),this.valuesTablePromise.then(n=>{const s=n.columns[0].sort().asc();n.applySort([s]),this.setState({valuesTable:n})}).catch(n=>{Pe.isCanceled(n)||(Js.error("Unable to open values table",n),this.setState({valuesTableError:n}))})}handleFocusTrapEnd(){var e,t;((t=(e=this.focusTrapContainer)==null?void 0:e.current)==null?void 0:t.querySelector("button,select,input,textarea")).focus()}handleFocusTrapStart(){var t,n;const e=(n=(t=this.focusTrapContainer)==null?void 0:t.current)==null?void 0:n.querySelectorAll("button,select,input,textarea");e&&e.length>0&&e[e.length-1].focus()}handleAddAnd(){let{filterItems:e,filterOperators:t}=this.state;e=e.concat(ls.makeFilterItem()),t=t.concat(jt.and),this.setState({filterItems:e,filterOperators:t})}handleAddOr(){let{filterItems:e,filterOperators:t}=this.state;e=e.concat(ls.makeFilterItem()),t=t.concat(jt.or),this.setState({filterItems:e,filterOperators:t})}handleChangeFilterOperator(e,t){let{filterOperators:n}=this.state;n=[...n],qh(t),n[e]=t,this.setState({filterOperators:n}),this.startUpdateTimer()}handleFilterChange(e,t,n){let{filterItems:s}=this.state;s=[...s];const{key:i}=s[e];s[e]={key:i,selectedType:t,value:n},this.setState({filterItems:s}),this.startUpdateTimer()}handleFilterDelete(e){let{filterItems:t,filterOperators:n}=this.state;t=[...t],n=[...n],e<t.length&&t.splice(e,1),e<n.length?n.splice(e,1):e===n.length&&n.splice(n.length-1,1),t.length===0&&t.push(ls.makeFilterItem()),this.setState({filterItems:t,filterOperators:n}),this.startUpdateTimer()}handleSelectValueChange(e,t){this.setState({selectedValues:e,invertSelection:t}),this.startUpdateTimer()}handleReset(){Js.debug("Resetting Advanced Filter"),this.setState({filterItems:[ls.makeFilterItem()],filterOperators:[],selectedValues:[],invertSelection:!0}),this.startUpdateTimer()}handleSortDown(e){const t=Ne.isModifierKeyDown(e);this.sortTable(A.sortDirection.descending,t)}handleSortUp(e){const t=Ne.isModifierKeyDown(e);this.sortTable(A.sortDirection.ascending,t)}handleSubmit(e){Js.debug("Submitting Advanced Filter"),this.stopUpdateTimer(),this.sendUpdate(),e.preventDefault()}handleDone(e){Js.debug("Submitting and Closing Advanced Filter"),this.stopUpdateTimer(),this.sendUpdate();const{onDone:t}=this.props;t(),e.preventDefault()}handleUpdateTimeout(){this.debounceTimeout=void 0,this.sendUpdate()}shouldShowAddFilter(){const{filterItems:e}=this.state;if(e.length===0)return!1;const t=e[e.length-1],{selectedType:n,value:s}=t;return n!=null&&n.length>0&&s!=null&&s.length>0}sortTable(e,t=!1){const{column:n,onSortChange:s}=this.props;s(n,e,t)}startUpdateTimer(){this.stopUpdateTimer(),this.debounceTimeout=setTimeout(this.handleUpdateTimeout,ls.debounceFilterUpdate)}stopUpdateTimer(){this.debounceTimeout!==void 0&&(clearTimeout(this.debounceTimeout),this.debounceTimeout=void 0)}sendUpdate(){const{filterItems:e,filterOperators:t,invertSelection:n,selectedValues:s}=this.state,{column:i,onFilterChange:o,model:r}=this.props,{formatter:l}=r,a=e.filter(({selectedType:m,value:p})=>m!=null&&p!=null&&p!==""),c=t.filter((m,p)=>m!=null&&e[p].selectedType!=null&&e[p].value!=null&&e[p].value!=="").slice(0,a.length-1),d={filterItems:a,filterOperators:c,invertSelection:n,selectedValues:s},u=A.makeAdvancedFilter(i,d,l.timeZone);o(i,u,d)}render(){const{column:e,model:t,sortDirection:n,formatter:s}=this.props,{filterItems:i,filterOperators:o,invertSelection:r,selectedValues:l,valuesTable:a,valuesTableError:c}=this.state,{isValuesTableAvailable:d}=t,u=A.isBooleanType(e.type),m=A.isDateType(e.type),p=this.getFilterTypes(e.type),g=e.type.substring(e.type.lastIndexOf(".")+1),f=[];if(!u&&p.length)for(let b=0;b<i.length;b+=1){const S=i[b],{key:E,selectedType:v,value:y}=S,M=h(Dr,{column:e,filterTypes:p,onChange:this.getFilterChangeHandler(b),onDelete:this.getFilterDeleteHandler(b),selectedType:v,value:y,formatter:s},E);if(f.push(M),b<o.length){const x=o[b]===jt.and,U=R("div",{className:"form-row justify-content-end advanced-filter-creator-filter-operator",children:[h(K,{kind:"ghost",className:G("filter-operator",{active:x}),onClick:()=>this.handleChangeFilterOperator(b,jt.and),children:"AND"}),h(K,{kind:"ghost",className:G("filter-operator",{active:!x}),onClick:()=>this.handleChangeFilterOperator(b,jt.or),children:"OR"})]},`filterOperator${E}`);f.push(U)}}const C=this.shouldShowAddFilter(),w=R("div",{className:G("form-row justify-content-end add-filter-item",{hidden:!C}),children:[h("span",{className:"text-muted",children:h(Q,{icon:Hs})}),h(K,{kind:"ghost",className:"btn-filter-item",onClick:this.handleAddAnd,disabled:!C,tooltip:"Add filter with AND",children:"AND"}),h(K,{kind:"ghost",className:"btn-filter-item",onClick:this.handleAddOr,disabled:!C,tooltip:"Add filter with OR",children:"OR"})]},"addFilterItem");return f.push(w),R("div",{className:"advanced-filter-creator",role:"presentation",children:[h("div",{tabIndex:0,onFocus:this.handleFocusTrapStart}),R("form",{onSubmit:this.handleSubmit,ref:this.focusTrapContainer,children:[R("div",{className:"title-bar",children:[h("h6",{className:"advanced-filter-title",children:"Advanced Filters"}),R("div",{className:"advanced-filter-menu-buttons",children:[h(K,{kind:"ghost",className:G("sort-operator",{active:n===A.sortDirection.descending}),onClick:this.handleSortDown,icon:tl,tooltip:`Sort ${e.name} Descending`}),h(K,{kind:"ghost",className:G("sort-operator",{active:n===A.sortDirection.ascending}),onClick:this.handleSortUp,icon:h(Q,{icon:tl,rotation:180}),tooltip:`Sort ${e.name} Ascending`})]})]}),h("hr",{}),R("div",{className:"advanced-filter-column-name",children:[e.name,"\xA0",R("span",{className:"column-type",children:["(",g,")"]})]}),f,d&&c==null&&R(Fe,{children:[!u&&h("hr",{}),h("div",{className:"form-group",children:h(Nr,{table:a,onChange:this.handleSelectValueChange,invertSelection:r,selectedValues:l,formatter:s,showSearch:!m,timeZone:s.timeZone})})]}),R("div",{className:"form-row justify-content-end",children:[h(K,{kind:"secondary",className:"mr-2",onClick:this.handleReset,children:"Reset"}),h(K,{kind:"primary",onClick:this.handleDone,children:"Done"})]})]}),h("div",{tabIndex:0,onFocus:this.handleFocusTrapEnd})]})}};let Fr=ls;Fr.debounceFilterUpdate=250;Fr.defaultProps={options:{filterItems:null,filterOperators:null,invertSelection:!0,selectedValues:[]},sortDirection:null};const Rl=ne.module("Aggregations"),op=[Se.SUM,Se.ABS_SUM,Se.MIN,Se.MAX,Se.VAR,Se.AVG,Se.STD,Se.FIRST,Se.LAST,Se.COUNT_DISTINCT,Se.DISTINCT,Se.COUNT,Se.UNIQUE];function rp({isRollup:e,settings:t,onChange:n,onEdit:s}){const{aggregations:i,showOnTop:o}=t,r=T.exports.useMemo(()=>op.filter(x=>!i.some(U=>U.operation===x)),[i]),[l,a]=T.exports.useState(r[0]),[c,d]=T.exports.useState([]),u=T.exports.useCallback(x=>{n({...t,...x})},[n,t]),m=T.exports.useCallback(x=>{u({aggregations:x})},[u]),p=T.exports.useCallback(x=>{u({showOnTop:x})},[u]),g=T.exports.useCallback(()=>{Rl.debug("handleDragStart"),mt.startDragging()},[]),f=T.exports.useCallback(({destination:x,source:U})=>{if(Rl.debug("handleDragEnd",x,U),mt.stopDragging(),x===null)return;let V=x.index;U.index<x.index&&(V+=1);const N=[...i],H=mt.reorder(N,c,N,V),k=mt.adjustDestinationIndex(V,c),z=[[k,k+H.length-1]];m(N),d(z)},[m,i,c,d]),C=T.exports.useCallback(x=>{a(x)},[a]),w=T.exports.useCallback(()=>{m([...i,{operation:l,selected:[],invert:!0}])},[i,l,m]),b=T.exports.useCallback(x=>{m(i.filter((U,V)=>V!==x))},[i,m]),S=T.exports.useCallback(x=>{d(x)},[d]),E=T.exports.useCallback(x=>{const U=i[x];Gn.isRollupOperation(U.operation)||s(U)},[i,s]),v=T.exports.useCallback(x=>{p(x.target.value==="true")},[p]);T.exports.useEffect(function(){r.length>0&&!r.includes(l)&&a(r[0])},[r,l]);const y=T.exports.useCallback(({item:x,itemIndex:U,isClone:V=!1,selectedCount:N})=>{const H=x.operation,k=V?`${N}`:void 0,z=V?"item-list-item-clone":void 0,P=Gn.isRollupOperation(x.operation),_=!V&&!P;return R(Fe,{children:[R("div",{className:G("item-list-item-content","draggable-item-list-item-content",z),children:[R("span",{className:"title",children:[H,!e&&P&&R("span",{className:"small text-warning",children:[h(Q,{icon:oa})," Requires rollup"]})]}),wt.renderBadge({text:k}),wt.renderHandle()]}),!V&&R(Fe,{children:[h(K,{kind:"ghost",className:"btn-edit",icon:ar,tooltip:"Edit Columns",onClick:()=>s(x),disabled:!_}),h(K,{kind:"ghost",className:"btn-delete",icon:Tn,tooltip:"Delete Aggregation",onClick:()=>b(U)})]})]})},[b,s,e]),M=r.length>0,F=i.length>0;return R("div",{className:"aggregations",children:[M&&R("div",{className:"form-inline",children:[h(oh,{onChange:C,value:l,children:r.map(x=>h(ih,{value:x,children:x},x))}),R("button",{type:"button",className:"btn btn-link btn-add",onClick:w,children:[h(Q,{icon:Hs}),"Add Aggregation"]})]}),M&&F&&h("hr",{}),F&&R(Fe,{children:[!e&&R("div",{className:"form-inline",children:[h("label",{children:"Placement:\xA0"}),R(Sr,{onChange:v,value:`${o}`,children:[h(Sn,{value:"true",children:"Top"}),h(Sn,{value:"false",children:"Bottom"})]})]}),h(oo,{onDragStart:g,onDragEnd:f,children:h(wt,{className:"selected-aggregations",itemCount:i.length,items:i,renderItem:y,offset:0,onSelectionChange:S,onSelect:E,selectedRanges:c,isMultiSelect:!0})})]})]})}const lp=30;function ap({aggregation:e,columns:t,onChange:n}){const[s,i]=T.exports.useState(-1),[o,r]=T.exports.useState(-1),[l,a]=T.exports.useState(0),{invert:c,selected:d}=e,u=T.exports.useRef(null),m=T.exports.useCallback(v=>d.includes(v)?!c:c,[c,d]),p=T.exports.useMemo(()=>{let v=Mr(t,e.operation);return l!==0&&(v=A.sortColumns(v,l===1)),v},[t,e.operation,l]),g=T.exports.useMemo(()=>s>=0?p.slice(s,o+1).map(v=>({value:v.name,displayValue:v.name,isSelected:m(v.name)})):[],[p,m,o,s]),f=T.exports.useCallback(v=>{const{name:y}=p[v],M=d.indexOf(y);let F=[...d],x=c;M>=0?F.splice(M,1):(F.push(y),F.length===p.length&&(F=[],x=!c)),n({...e,selected:F,invert:x})},[e,c,p,d,n]),C=T.exports.useCallback(()=>{a(0),n({...e,selected:[],invert:!0})},[e,n]),w=T.exports.useCallback((v,y)=>{i(v),r(y)},[i,r]),b=T.exports.useCallback(()=>{d.length===0?n({...e,invert:!c}):n({...e,selected:[],invert:!0})},[e,c,n,d]),S=d.length===0?c:null,E=d.length!==0||!c||l!==0;return R("div",{role:"menu",className:"aggregation-edit",children:[h("div",{className:"top-menu",children:R("div",{className:"form-inline",children:[h(at,{checked:S,onChange:b,children:"Toggle All"}),h("div",{className:"spacer"}),h(lt,{in:E,timeout:xe.transitionSlowMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:h(K,{kind:"ghost",className:"btn-reset",onClick:C,children:"Reset"})}),h(K,{kind:"ghost",className:G({active:l===1}),icon:ur,tooltip:"Sort ascending",onClick:()=>a(1)}),h(K,{kind:"ghost",className:G({active:l===2}),icon:hr,tooltip:"Sort descending",onClick:()=>a(2)})]})}),h("div",{className:"aggregation-edit-item-list",children:h(nn,{itemCount:p.length,items:g,offset:s,renderItem:({item:v})=>h(at,{checked:m(v.value),children:v.displayValue}),onSelect:f,onViewportChange:w,rowHeight:lp,focusSelector:"input",ref:u})})]})}function cp(e){return h("svg",{width:48,height:48,xmlns:"http://www.w3.org/2000/svg",...e,children:R("g",{fill:"none",fillRule:"evenodd",children:[h("path",{fill:"#C1C0C0",d:"M44 43v1H4v-1z"}),h("path",{fill:"#7DA4FF",d:"M8 26h4v15H8zM15 17h4v24h-4zM22 21h4v20h-4zM29 17h4v24h-4zM36 11h4v30h-4z"})]})})}function dp(e){return h("svg",{width:48,height:48,xmlns:"http://www.w3.org/2000/svg",...e,children:R("g",{fill:"none",fillRule:"evenodd",children:[h("path",{fill:"#C1C0C0",d:"M44 43v1H4v-1z"}),h("path",{fill:"#7DA4FF",d:"M7 34h4v8H7zM12 31h4v11h-4zM17 27h4v15h-4zM22 22h4v20h-4zM27 27h4v15h-4zM32 29h4v13h-4zM37 31h4v11h-4z"})]})})}function up(e){return h("svg",{width:48,height:48,xmlns:"http://www.w3.org/2000/svg",...e,children:R("g",{fill:"none",fillRule:"evenodd",children:[h("path",{fill:"#C1C0C0",d:"M4 4h1v40H4zM44 43v1H5v-1z"}),h("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"}),h("path",{stroke:"#BECDEF",d:"M8.244 37.926L17 33.496l5 .87 10.637-10.35 10.615-1.381"})]})})}function hp(e){return h("svg",{width:48,height:48,xmlns:"http://www.w3.org/2000/svg",...e,children:R("g",{fill:"none",fillRule:"evenodd",children:[h("path",{d:"M24 10c7.732 0 14 6.268 14 14s-6.268 14-14 14-14-6.268-14-14h14V10z",fill:"#80A6FF"}),h("path",{d:"M10 24c0-7.732 6.268-14 14-14v14H10z",fill:"#C1C0C0"})]})})}function mp(e){return h("svg",{width:48,height:48,xmlns:"http://www.w3.org/2000/svg",...e,children:R("g",{fill:"none",fillRule:"evenodd",children:[h("path",{fill:"#C1C0C0",d:"M44 43v1H4v-1z"}),h("path",{fill:"#939293",d:"M44 34v1H4v-1zM44 25v1H4v-1zM44 16v1H4v-1z"}),h("circle",{fill:"#7DA4FF",cx:9.5,cy:37.5,r:1.5}),h("circle",{fill:"#7DA4FF",cx:16.5,cy:30.5,r:1.5}),h("circle",{fill:"#7DA4FF",cx:22.5,cy:36.5,r:1.5}),h("circle",{fill:"#7DA4FF",cx:28.5,cy:30.5,r:1.5}),h("circle",{fill:"#7DA4FF",cx:15.5,cy:38.5,r:1.5}),h("circle",{fill:"#7DA4FF",cx:23.5,cy:25.5,r:1.5}),h("circle",{fill:"#7DA4FF",cx:19.5,cy:19.5,r:1.5}),h("circle",{fill:"#7DA4FF",cx:29.5,cy:19.5,r:1.5}),h("circle",{fill:"#7DA4FF",cx:32.5,cy:26.5,r:1.5}),h("circle",{fill:"#7DA4FF",cx:36.5,cy:13.5,r:1.5})]})})}function pp(e){return R("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[h("rect",{width:"48",height:"48",fill:"none"}),h("rect",{x:"26",y:"10",width:"15",height:"4",fill:"#9FDE70"}),h("rect",{x:"26",y:"22",width:"15",height:"4",fill:"#9FDE70"}),h("rect",{x:"26",y:"28",width:"15",height:"4",fill:"#FFD95C"}),h("rect",{x:"26",y:"34",width:"15",height:"4",fill:"#9FDE70"})]})}function gp(e){return R("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[h("rect",{width:"48",height:"48",fill:"none"}),h("rect",{x:"4",y:"16",width:"40",height:"4",fill:"#FFD95C"}),h("rect",{x:"4",y:"10",width:"40",height:"4",fill:"#78DCE8"}),h("rect",{x:"4",y:"34",width:"40",height:"4",fill:"#78DCE8"})]})}const Il=ne.module("ChartBuilder"),Ke=class extends T.exports.PureComponent{static getTypeName(e){switch(e){case I.plot.SeriesPlotStyle.LINE:return"Line";case I.plot.SeriesPlotStyle.BAR:return"Bar";case I.plot.SeriesPlotStyle.SCATTER:return"Scatter";case I.plot.SeriesPlotStyle.PIE:return"Pie";case I.plot.SeriesPlotStyle.HISTOGRAM:return"Histogram";default:return e}}static getTypeIcon(e){switch(e){case I.plot.SeriesPlotStyle.LINE:return h(up,{});case I.plot.SeriesPlotStyle.BAR:return h(cp,{});case I.plot.SeriesPlotStyle.SCATTER:return h(mp,{});case I.plot.SeriesPlotStyle.PIE:return h(hp,{});case I.plot.SeriesPlotStyle.HISTOGRAM:return h(dp,{});default:return null}}static getMaxSeriesCount(e){switch(e){case I.plot.SeriesPlotStyle.PIE:return 1;case I.plot.SeriesPlotStyle.HISTOGRAM:return 0;default:return 100}}static getXAxisLabel(e){switch(e){case I.plot.SeriesPlotStyle.PIE:return"Labels";case I.plot.SeriesPlotStyle.HISTOGRAM:return"Data";default:return"X-Axis"}}static getSeriesLabel(e){switch(e){case I.plot.SeriesPlotStyle.PIE:return"Values";default:return"Series"}}static makeSeriesItem(e){return{id:tn.generate(),value:e}}static makeDefaultSeriesItems(e,t){if(Ke.getMaxSeriesCount(e)===0||t==null||t.length===0)return[];const s=t.length>1?t[1].name:t[0].name;return[Ke.makeSeriesItem(s)]}static getDefaultXAxis(e,t){return t!=null&&t.length>0?t[0].name:null}constructor(e){super(e),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:t}=e,{columns:n}=t,s=Ke.types[0],i=Ke.getDefaultXAxis(s,n),o=Ke.makeDefaultSeriesItems(s,n);this.state={type:s,seriesItems:o,xAxis:i,isLinked:!0}}handleAddSeries(){this.setState(e=>{let{seriesItems:t}=e;t=[...t];const{model:n}=this.props,{columns:s}=n;return t.push({id:tn.generate(),value:s[0].name}),{seriesItems:t}},this.sendChange)}handleLinkStateChange(e){this.setState({isLinked:e.target.value==="true"},this.sendChange)}handleReset(){const{model:e}=this.props,{columns:t}=e,n=Ke.types[0],s=Ke.getDefaultXAxis(n,t),i=Ke.makeDefaultSeriesItems(n,t),o=!0;this.setState({type:n,seriesItems:i,xAxis:s,isLinked:o},this.sendChange)}handleSeriesChange(e){const{value:t}=e.target,n=e.target.getAttribute("data-index"),s=parseInt(n,10);this.setState(i=>{let{seriesItems:o}=i;return o=[...o],o[s].value=t,{seriesItems:o}},this.sendChange)}handleSeriesDeleteClick(e){const n=e.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(e){e.preventDefault();const{onSubmit:t}=this.props,{type:n,seriesItems:s,xAxis:i,isLinked:o}=this.state,r=s.map(l=>l.value);t({type:`${n}`,series:r,xAxis:i,isLinked:o})}handleTypeClick(e){const n=e.target.getAttribute("data-index"),s=parseInt(n,10),i=Ke.types[s];Il.debug2("handleTypeSelect",i),this.setState(o=>{const r=Ke.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=Ke.makeDefaultSeriesItems(i,c)}return{type:i,seriesItems:l}},this.sendChange)}handleXAxisChange(e){const t=e.target.value;Il.debug2("x-axis change",t),this.setState({xAxis:t},this.sendChange)}sendChange(){const{onChange:e}=this.props,{isLinked:t,type:n,seriesItems:s,xAxis:i}=this.state,o=s.map(r=>r.value);e({type:n,series:o,xAxis:i,isLinked:t})}render(){const{model:e}=this.props,{columns:t}=e,{seriesItems:n,type:s,xAxis:i,isLinked:o}=this.state,r=Ke.getMaxSeriesCount(s),l=Ke.getXAxisLabel(s),a=Ke.getSeriesLabel(s),c=n.length>0,d=n.length<r;return h("div",{className:"chart-builder",children:R("form",{onSubmit:this.handleSubmit,children:[R("div",{className:"form-row",children:[h("label",{children:"Select Chart Type"}),h("div",{className:"form-row",children:Ke.types.map((u,m)=>{const p=u;return h("div",{className:"col col-chart-type",children:R("button",{type:"button",className:G("btn","btn-icon","btn-chart-type",{active:u===s}),"data-index":m,onClick:this.handleTypeClick,children:[Ke.getTypeIcon(u),Ke.getTypeName(u)]})},p)})})]}),h("hr",{}),R("div",{className:"form-row form-inline",children:[h("label",{className:"col-2 label-left",children:l}),h("select",{className:"form-control custom-select select-x-axis col",value:i,onChange:this.handleXAxisChange,children:t.map(u=>h("option",{value:u.name,children:u.name},u.name))})]}),c&&h("hr",{}),n.map((u,m)=>R("div",{className:"form-row form-inline form-series-item","data-testid":`form-series-item-${m}`,children:[h("label",{className:"col-2 label-left",children:m===0?a:""}),h("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:t.map(p=>h("option",{value:p.name,"data-index":m,children:p.name},p.name))}),n.length>1&&h(K,{kind:"ghost",className:"btn-delete-series ml-2 px-2","data-index":m,"data-testid":`delete-series-${m}`,onClick:this.handleSeriesDeleteClick,icon:Tn,tooltip:"Delete"})]},u.id)),d&&R("div",{className:"form-row",children:[h("div",{className:"col-2"}),h(K,{kind:"ghost",className:"btn-add-series mt-1",onClick:this.handleAddSeries,icon:Hs,children:"Add Series"})]}),R("div",{className:"form-row chart-builder-link",children:[h("label",{className:"col-2 label-right",children:R("div",{className:"fa-md fa-layers",children:[h(Q,{mask:pr,icon:ro,transform:"right-5 down-5"}),h(Q,{icon:o?Jl:Iu,transform:"grow-2 right-8 down-6"})]})}),R(Sr,{onChange:this.handleLinkStateChange,value:`${o}`,children:[h(Sn,{value:"true",children:"Sync State"}),h(Sn,{value:"false",children:"Freeze State"})]})]}),R("div",{className:"form-row",children:[h("div",{className:"col-2 label-right"}),h("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."})]}),R("div",{className:G("form-row","justify-content-end","my-3"),children:[h(K,{kind:"secondary",className:"btn-reset",onClick:this.handleReset,children:"Reset"}),h(K,{kind:"primary",type:"submit",className:"btn-submit",children:"Create"})]})]})})}};let $a=Ke;$a.types=[I.plot.SeriesPlotStyle.LINE,I.plot.SeriesPlotStyle.BAR,I.plot.SeriesPlotStyle.SCATTER,I.plot.SeriesPlotStyle.PIE];class qa extends T.exports.Component{constructor(t){super(t),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:t,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:t,wordWrap:"on",automaticLayout:!0,...n};if(!this.editorContainer)throw new Error("editorContainer is null");this.editor=bn.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 t;(t=this.editor)==null||t.dispose(),this.editor=void 0}handleContentChanged(){var s,i;const{onContentChanged:t}=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}),t(n)}handleEditorFocus(){this.setState({isEditorFocused:!0})}handleEditorBlur(){var n,s;const t=(s=(n=this.editor)==null?void 0:n.getModel())==null?void 0:s.getValue();if(t===void 0||t==="")throw new Error("value is undefined");this.setState({isEditorEmpty:t.length===0,isEditorFocused:!1})}handleContainerClick(){var n;const{isEditorFocused:t}=this.state;t||(n=this.editor)==null||n.focus()}handleKeyDown(t){const{onTab:n,editorIndex:s}=this.props;t.key==="Tab"&&n(s,t.shiftKey)}render(){const{value:t,invalid:n}=this.props,{isEditorFocused:s,isEditorEmpty:i}=this.state;return R("div",{className:G("input-editor-wrapper",{focused:s,invalid:n}),onKeyDown:this.handleKeyDown,role:"presentation",onClick:this.handleContainerClick,children:[h("div",{className:"editor-container",ref:o=>{this.editorContainer=o}}),i&&!t&&h("div",{className:"editor-placeholder text-muted",children:"Column Formula"})]})}}qa.defaultProps={value:"",onContentChanged:()=>{},editorSettings:{},editorIndex:0,onTab:()=>{},invalid:!1};const Jo=class extends T.exports.PureComponent{constructor(e){super(e),this.handleFormulaEditorContentChanged=this.handleFormulaEditorContentChanged.bind(this)}handleFormulaEditorContentChanged(e){const{onChange:t,eventKey:n}=this.props;e!==void 0&&e!==""&&(e.replace(/(\r\n|\n|\r)/gm,""),t(n,Jo.INPUT_TYPE.FORMULA,e))}render(){const{eventKey:e,name:t,formula:n,onChange:s,onDeleteColumn:i,inputIndex:o,onTabInEditor:r,invalid:l}=this.props;return h(sr,{draggableId:e,index:o,disableInteractiveElementBlocking:!0,children:(a,c)=>R("div",{className:G("draggable-container",{dragging:c.isDragging}),ref:a.innerRef,...a.draggableProps,children:[R("div",{className:"custom-column-input-container",children:[R("div",{className:"d-flex flex-row pb-3 custom-column-name",children:[h("input",{className:G("form-control custom-column-input",{"is-invalid":l}),placeholder:"Column Name",value:t,onChange:d=>{s(e,Jo.INPUT_TYPE.NAME,d.target.value)}}),h(K,{kind:"ghost",className:"ml-1 px-2",onClick:()=>{i(e)},icon:Tn,tooltip:"Delete custom column"}),R("button",{type:"button",className:"btn btn-link btn-link-icon px-2 btn-drag-handle",...a.dragHandleProps,children:[h(Be,{children:"Drag column to re-order"}),h(Q,{icon:lo})]})]}),h(qa,{editorSettings:{language:"deephavenDb"},editorIndex:o,value:n,onContentChanged:this.handleFormulaEditorContentChanged,onTab:r,invalid:l})]}),h("hr",{})]})})}};let xr=Jo;xr.INPUT_TYPE={NAME:"name",FORMULA:"formula"};xr.defaultProps={name:"",inputIndex:0,formula:"",onChange:()=>{},onDeleteColumn:()=>{},onTabInEditor:()=>{},invalid:!1};class me extends xa{constructor(){super(),this.listenerCount=0}addEventListener(t,n,s){super.addEventListener(t,n,s),this.listenerCount+=1,this.listenerCount===1&&this.startListening()}removeEventListener(t,n,s){super.removeEventListener(t,n,s),this.listenerCount-=1,this.listenerCount===0&&this.stopListening()}startListening(){}stopListening(){}get originalColumns(){return this.columns}get layoutHints(){return null}get frontColumns(){return[]}get backColumns(){return[]}get frozenColumns(){return[]}isColumnFrozen(t){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(t){return!1}close(){}isRowMovable(){return!1}}me.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 Ns=class extends T.exports.Component{constructor(e){super(e),this.getInput=Ee((t,n)=>t.find(s=>s.eventKey===n)),this.getInputIndex=Ee((t,n)=>t.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 tn.generate()}static createCustomColumnInput(){return{eventKey:tn.generate(),name:"",formula:""}}componentDidMount(){const{customColumns:e}=this.props;this.parseCustomColumns(e),this.startListening()}componentWillUnmount(){this.stopListening(),this.successButtonTimer&&clearTimeout(this.successButtonTimer)}resetErrorMessage(){this.setState({errorMessage:null})}startListening(){const{model:e}=this.props;e.addEventListener(me.EVENT.COLUMNS_CHANGED,this.handleCustomColumnUpdated),e.addEventListener(me.EVENT.UPDATED,this.handleCustomColumnUpdated),e.addEventListener(me.EVENT.REQUEST_FAILED,this.handleRequestFailed)}stopListening(){const{model:e}=this.props;e.removeEventListener(me.EVENT.COLUMNS_CHANGED,this.handleCustomColumnUpdated),e.removeEventListener(me.EVENT.UPDATED,this.handleCustomColumnUpdated),e.removeEventListener(me.EVENT.REQUEST_FAILED,this.handleRequestFailed)}parseCustomColumns(e){if(e.length>0){const t=e.map(n=>{const s=n.split(/=(.+)/,2);return{eventKey:Ns.makeCustomColumnInputEventKey(),name:s[0],formula:s[1]}});this.setState({inputs:t})}else this.setState({inputs:[Ns.createCustomColumnInput()]})}handleAddColumnClick(){const{inputs:e}=this.state,t=[...e];t.push(Ns.createCustomColumnInput()),this.setState({inputs:t})}handleDeleteColumn(e){const{inputs:t}=this.state,n=this.getInputIndex(t,e),s=[...t];s.splice(n,1),s.length===0&&s.push(Ns.createCustomColumnInput()),this.setState({inputs:s})}handleInputChange(e,t,n){const{inputs:s}=this.state,i=this.getInputIndex(s,e),r={...this.getInput(s,e)};r[t]=n;const l=[...s];l.splice(i,1,r),this.setState({inputs:l})}handleCustomColumnUpdated(){const{isCustomColumnApplying:e}=this.state;!e||this.setState({isCustomColumnApplying:!1,isSuccessShowing:!0},()=>{this.successButtonTimer=setTimeout(()=>this.setState({isSuccessShowing:!1}),Ns.SUCCESS_SHOW_DURATION)})}handleRequestFailed(e){const t=e,{isCustomColumnApplying:n}=this.state;!n||this.setState({isCustomColumnApplying:!1,errorMessage:R(Fe,{children:[R("p",{children:[h(Q,{icon:$n})," Failed to apply custom columns."]}),R("div",{className:"error-box",children:[t.detail.errorMessage,h("br",{}),"Table configuration:"," ",JSON.stringify(t.detail.configuration)]})]}),hasRequestFailed:!0})}handleDragEnd(e){if(mt.stopDragging(),!e.destination)return;const{inputs:t}=this.state,n=e.source.index,s=e.destination.index,i=[...t],o=t[n];i.splice(n,1),i.splice(s,0,o),this.setState({inputs:i})}handleEditorTabNavigation(e,t){var s,i,o;const{inputs:n}=this.state;if(t){((s=this.container)==null?void 0:s.querySelectorAll(".btn-drag-handle")[e]).focus();return}if(e===n.length-1)((i=this.container)==null?void 0:i.querySelectorAll(".btn-add-column")[e]).focus();else{const r=e+1;((o=this.container)==null?void 0:o.querySelectorAll(".custom-column-input")[r]).focus()}}handleSaveClick(){const{onSave:e}=this.props,{inputs:t,isCustomColumnApplying:n}=this.state;if(n)return;const s=[];t.forEach(i=>{const{name:o,formula:r}=i;o&&r&&s.push(`${o}=${r}`)}),this.resetErrorMessage(),this.setState({isCustomColumnApplying:!0}),e(s)}resetRequestFailed(){this.setState(({hasRequestFailed:e})=>e?{hasRequestFailed:!1}:null)}renderInputs(){const{inputs:e,hasRequestFailed:t}=this.state;return e.map((n,s)=>{const{eventKey:i,name:o,formula:r}=n;return h(xr,{inputIndex:s,eventKey:i,name:o,formula:r,onChange:this.handleInputChange,onDeleteColumn:this.handleDeleteColumn,onTabInEditor:this.handleEditorTabNavigation,invalid:t},i)})}renderSaveButton(){const{inputs:e,isCustomColumnApplying:t,isSuccessShowing:n}=this.state,s=e.length>1?"Save Columns":"Save Column";return R(K,{kind:n?"success":"primary",className:G("btn-apply",{"btn-spinner":t}),disabled:n||t,onClick:this.handleSaveClick,children:[t&&R("span",{children:[h(Ht,{}),h("span",{className:"btn-normal-content",children:"Applying"}),h("span",{className:"btn-hover-content",children:"Applying"})]}),!n&&!t&&s,n&&R(Fe,{children:[h(Q,{icon:ta})," Success"]})]})}render(){const{onCancel:e}=this.props,{errorMessage:t}=this.state;return R("div",{role:"presentation",className:"custom-column-builder-container",ref:n=>{this.container=n},onClick:this.resetRequestFailed,onFocus:this.resetRequestFailed,children:[h("hr",{}),h(oo,{onDragStart:mt.startDragging,onDragEnd:this.handleDragEnd,children:h(io,{droppableId:"droppable-custom-columns",children:(n,s)=>R("div",{ref:n.innerRef,...n.droppableProps,className:G("droppable-container",{dragging:s.draggingFromThisWith}),children:[this.renderInputs(),n.placeholder]})})}),h("div",{className:"pt-1 px-3",children:h(K,{kind:"ghost",className:"btn-add-column",onClick:this.handleAddColumnClick,icon:Hs,children:"Add Another Column"})}),R("div",{className:"custom-column-builder-footer",children:[t&&h("div",{className:"error-message",children:t}),R("div",{className:"d-flex justify-content-end",children:[h(K,{kind:"secondary",className:"mr-2",onClick:e,children:"Cancel"}),this.renderSaveButton()]})]})]})}};let Ar=Ns;Ar.SUCCESS_SHOW_DURATION=750;Ar.defaultProps={customColumns:[],onSave:()=>{},onCancel:()=>{}};var be=(e=>(e.ADVANCED_SETTINGS="ADVANCED_SETTINGS",e.AGGREGATIONS="AGGREGATIONS",e.AGGREGATION_EDIT="AGGREGATIONS_EDIT",e.CHART_BUILDER="CHART_BUILDER",e.CUSTOM_COLUMN_BUILDER="CUSTOM_COLUMN_BUILDER",e.QUICK_FILTERS="QUICK_FILTERS",e.ROLLUP_ROWS="ROLLUP_ROWS",e.SEARCH_BAR="SEARCH_BAR",e.SELECT_DISTINCT="SELECT_DISTINCT",e.TABLE_EXPORTER="TABLE_EXPORTER",e.VISIBILITY_ORDERING_BUILDER="VISIBILITY_ORDERING_BUILDER",e.CONDITIONAL_FORMATTING="CONDITIONAL_FORMATTING",e.CONDITIONAL_FORMATTING_EDIT="CONDITIONAL_FORMATTING_EDIT",e.GOTO="GOTO",e))(be||{});const ei=ne.module("RollupRows"),fp=150,Hi="grouped-rollup-rows",_i="ungrouped-rollup-rows",At=class extends T.exports.Component{constructor(e){super(e),this.search=Et(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]));O(a),this.setState({ungroupedSelectedRanges:l}),l.length>0&&this.ungroupedList.current&&this.ungroupedList.current.scrollToItem(a)},fp),this.getCachedUngroupedColumns=he((o,r)=>o.filter(l=>At.isGroupable(l)&&r.find(a=>a===l.name)==null)),this.getCachedSortedColumns=he((o,r)=>r==null?[...o]:A.sortColumns(o,r===At.SORT.ASCENDING)),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=J.createRef(),this.groupedList=J.createRef();const{config:t}=e,{columns:n=[],showConstituents:s=!0,showNonAggregatedColumns:i=!0}=t!=null?t:{};this.state={ungroupedSelectedRanges:[],columns:n,groupedSelectedRanges:[],searchFilter:"",showConstituents:s,showNonAggregatedColumns:i,dragSource:null,sort:null}}static renderColumn({item:e,isClone:t,selectedCount:n}){const s=e==null?void 0:e.name,i=t!==void 0&&t?`${n}`:void 0,o=t!==void 0&&t?"item-list-item-clone":"";return wt.renderTextItem({text:s,badgeText:i,className:o})}static addGroupings(e,t,n=e.length){if(t==null||t.length===0)return e;let s=n;const i=e.filter((o,r)=>t.includes(o)?(r<s&&(s-=1),!1):!0);return i.splice(s,0,...t),i}static isGroupable(e){return!A.isDecimalType(e.type)}componentDidUpdate(e,t){const{config:n}=this.props,{columns:s,showConstituents:i,showNonAggregatedColumns:o}=this.state;n!==e.config?this.updateFromConfig():(s!==t.columns||i!==t.showConstituents||o!==t.showNonAggregatedColumns)&&(n==null||s!==n.columns||i!==n.showConstituents||o!==n.showNonAggregatedColumns)&&this.sendChange()}componentWillUnmount(){this.search.cancel()}handleSearchChange(e){const t=e.target.value;if(this.setState({searchFilter:t}),!t){this.search.cancel(),this.resetSelection();return}this.search(t)}handleSortAscending(){this.setState(({sort:e})=>({sort:e===At.SORT.ASCENDING?null:At.SORT.ASCENDING}))}handleSortDescending(){this.setState(({sort:e})=>({sort:e===At.SORT.DESCENDING?null:At.SORT.DESCENDING}))}resetSelection(){this.setState({ungroupedSelectedRanges:[],groupedSelectedRanges:[]})}handleDragStart(e){ei.debug("handleDragStart",e),document.documentElement.classList.add("drag-pointer-events-none"),this.setState({dragSource:e.source})}handleDragEnd(e){ei.debug("handleDragEnd",e),document.documentElement.classList.remove("drag-pointer-events-none"),this.setState({dragSource:null});const{destination:t,source:n}=e;if(t==null||n==null)return;if(t.droppableId===_i){this.setState(({groupedSelectedRanges:o,columns:r})=>{const l=[...r];return mt.reorder(l,o,[],0),{columns:l,ungroupedSelectedRanges:[],groupedSelectedRanges:[]}});return}const s=n.droppableId===Hi;let i=t.index;s&&n.index<t.index&&(i+=1),this.setState(({columns:o,ungroupedSelectedRanges:r,groupedSelectedRanges:l})=>{const a=[...o],c=s?a:this.getSortedUngroupedColumns().map(g=>g.name),d=s?l:r,u=mt.reorder(c,d,a,i),m=s?mt.adjustDestinationIndex(i,l):i,p=[[m,m+u.length-1]];return{columns:a,ungroupedSelectedRanges:[],groupedSelectedRanges:p}}),this.resetSelection()}handleUngroupedSelect(e){ei.debug("handleUngroupedSelect"),this.setState(({columns:t})=>({columns:At.addGroupings(t,[this.getSortedUngroupedColumns()[e].name]),ungroupedSelectedRanges:[],groupedSelectedRanges:[]}))}handleUngroupedSelectionChange(e){ei.debug2("handleUngroupedSelectionChange",e),this.setState(({ungroupedSelectedRanges:t})=>e===t?null:{ungroupedSelectedRanges:e,groupedSelectedRanges:[]})}handleGroupedSelectionChange(e){ei.debug2("handleGroupedSelectedRanges",e),this.setState(({groupedSelectedRanges:t})=>e===t?null:{groupedSelectedRanges:e,ungroupedSelectedRanges:[]})}handleDeleteClicked(e){this.setState(({columns:t})=>{const n=t.slice();return n.splice(e,1),{columns:n}})}handleShowConstituentsChange(){this.setState(({showConstituents:e})=>({showConstituents:!e}))}handleShowNonAggregatedColumnsChange(){this.setState(({showNonAggregatedColumns:e})=>({showNonAggregatedColumns:!e}))}updateFromConfig(){const{config:e}=this.props,{columns:t=[],showConstituents:n=!0,showNonAggregatedColumns:s=!0}=e!=null?e:{};this.setState({columns:t,showConstituents:n,showNonAggregatedColumns:s})}sendChange(){const{onChange:e}=this.props,{columns:t,showConstituents:n,showNonAggregatedColumns:s}=this.state;e({columns:t,showConstituents:n,showNonAggregatedColumns:s})}getUngroupedColumns(){const{model:e}=this.props,{columns:t}=this.state,{originalColumns:n}=e;return this.getCachedUngroupedColumns(n,t)}getSortedUngroupedColumns(){const{sort:e}=this.state,t=this.getUngroupedColumns();return this.getCachedSortedColumns(t,e)}renderGroupedItem({item:e,itemIndex:t,isClone:n,selectedCount:s}){const o=`${n!==void 0&&n?"":"\xA0\xA0".repeat(t)}${e}`,r=n!==void 0&&n?`${s}`:void 0,l=n!==void 0&&n?"item-list-item-clone":"";return R(Fe,{children:[wt.renderTextItem({text:o,badgeText:r,className:l}),(n===void 0||!n)&&h(K,{kind:"ghost",className:"btn btn-link btn-link-icon btn-delete-grouping float-right",onClick:()=>this.handleDeleteClicked(t),children:h(Q,{icon:Tn})})]})}render(){const{columns:e,dragSource:t,searchFilter:n,groupedSelectedRanges:s,ungroupedSelectedRanges:i,showConstituents:o,showNonAggregatedColumns:r,sort:l}=this.state,a=this.getSortedUngroupedColumns();let c=e.length*wt.DEFAULT_ROW_HEIGHT;(t==null?void 0:t.droppableId)===_i&&(c+=wt.DEFAULT_ROW_HEIGHT);const d=a.length*wt.DEFAULT_ROW_HEIGHT+10,u=Math.min(3*wt.DEFAULT_ROW_HEIGHT,d);return h("div",{role:"menu",className:G("rollup-rows",{"is-dragging":t!=null}),tabIndex:0,children:R(oo,{onDragEnd:this.handleDragEnd,onDragStart:this.handleDragStart,children:[R("div",{className:"rollup-rows-group-by",children:[h("div",{className:"section-title",children:"Group By"}),e.length===0&&h(io,{droppableId:"placeholder",children:(m,p)=>h("div",{className:G("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."})}),e.length>0&&h(wt,{draggingItemClassName:"rollup-rows-dragging-grouped-item",draggablePrefix:Hi,droppableId:Hi,itemCount:e.length,items:e,offset:0,onSelectionChange:this.handleGroupedSelectionChange,ref:this.groupedList,renderItem:this.renderGroupedItem,selectedRanges:s,style:{height:c},isMultiSelect:!0})]}),R("div",{className:"rollup-rows-available-columns",children:[h("div",{className:"section-title",children:"Available Grouping Columns"}),R("div",{className:"top-menu",children:[h(Qn,{className:"w-100",value:n,matchCount:n?i.length:void 0,placeholder:"Find column...",onChange:this.handleSearchChange}),R(K,{kind:"ghost",className:G("btn-link btn-link-icon",{active:l===At.SORT.ASCENDING}),onClick:this.handleSortAscending,children:[h(Q,{icon:ur}),h(Be,{children:"Sort ascending"})]}),R(K,{kind:"ghost",className:G("btn-link btn-link-icon",{active:l===At.SORT.DESCENDING}),onClick:this.handleSortDescending,children:[h(Q,{icon:hr}),h(Be,{children:"Sort descending"})]})]}),h(wt,{className:"rollup-available-grouping-columns",draggablePrefix:_i,droppableId:_i,itemCount:a.length,items:a,renderItem:At.renderColumn,offset:0,onSelect:this.handleUngroupedSelect,onSelectionChange:this.handleUngroupedSelectionChange,ref:this.ungroupedList,selectedRanges:i,style:{maxHeight:d,minHeight:u},isDropDisabled:(t==null?void 0:t.droppableId)!==Hi,isMultiSelect:!0}),R("div",{className:"bottom-menu",children:[h("div",{className:"label",children:"Show:"}),h(at,{checked:o,onChange:this.handleShowConstituentsChange,children:"Constituents"}),h(at,{checked:r,onChange:this.handleShowNonAggregatedColumnsChange,children:"Non-Aggregated Columns"})]})]})]})})}};let Or=At;Or.SORT=Object.freeze({ASCENDING:"ASC",DESCENDING:"DESC"});Or.defaultProps={config:null,onChange:()=>{}};const Cp=ne.module("TableCsvExporter"),Me=class extends T.exports.Component{static getDateString(){return I.i18n.DateTimeFormat.format(Me.FILENAME_DATE_FORMAT,new Date)}constructor(e){super(e),this.handleDownloadClick=this.handleDownloadClick.bind(this),this.handleDownloadRowOptionChanged=this.handleDownloadRowOptionChanged.bind(this),this.handleCustomizedDownloadRowOptionChanged=this.handleCustomizedDownloadRowOptionChanged.bind(this),this.handleCustomizedDownloadRowsChanged=this.handleCustomizedDownloadRowsChanged.bind(this),this.handleIncludeColumnHeadersChanged=this.handleIncludeColumnHeadersChanged.bind(this),this.handleIncludeHiddenColumnsChanged=this.handleIncludeHiddenColumnsChanged.bind(this),this.handleUseUnformattedValuesChanged=this.handleUseUnformattedValuesChanged.bind(this);const{name:t}=e;this.state={fileName:`${t}-${Me.getDateString()}.csv`,downloadRowOption:Me.DOWNLOAD_ROW_OPTIONS.ALL_ROWS,customizedDownloadRowOption:Me.CUSTOMIZED_ROWS_OPTIONS.FIRST,customizedDownloadRows:Me.DEFAULT_DOWNLOAD_ROWS,includeColumnHeaders:!0,includeHiddenColumns:!1,useUnformattedValues:!1,errorMessage:null,id:tn.generate()}}getSnapshotRanges(){const{model:e,selectedRanges:t}=this.props,{downloadRowOption:n,customizedDownloadRowOption:s,customizedDownloadRows:i}=this.state,{rowCount:o,columnCount:r}=e;let l=[];switch(n){case Me.DOWNLOAD_ROW_OPTIONS.ALL_ROWS:l.push(new Z(0,0,r-1,o-1));break;case Me.DOWNLOAD_ROW_OPTIONS.SELECTED_ROWS:l=t.map(a=>({...a,startColumn:0,endColumn:r-1})).sort((a,c)=>a.startRow!=null&&c.startRow!=null?a.startRow-c.startRow:0);break;case Me.DOWNLOAD_ROW_OPTIONS.CUSTOMIZED_ROWS:switch(s){case Me.CUSTOMIZED_ROWS_OPTIONS.FIRST:l.push(new Z(0,0,r-1,Math.min(i-1,o-1)));break;case Me.CUSTOMIZED_ROWS_OPTIONS.LAST:l.push(new Z(0,Math.max(0,o-i),r-1,o-1));break}break}return l}getModelRanges(e){const{userColumnWidths:t,movedColumns:n}=this.props,{includeHiddenColumns:s}=this.state,i=te.getHiddenColumns(t);let o=B.getModelRanges(e,n);if(!s&&i.length>0){const r=i.map(Z.makeColumn);o=Z.subtractRangesFromRanges(o,r)}return o}resetDownloadState(){this.setState({errorMessage:null})}async handleDownloadClick(){const{model:e,isDownloading:t,onDownloadStart:n,onDownload:s,onCancel:i}=this.props,{fileName:o,includeColumnHeaders:r,useUnformattedValues:l}=this.state;if(t){i();return}this.resetDownloadState();const a=this.getSnapshotRanges(),c=this.getModelRanges(a);if(this.validateOptionInput()){n();try{const d=await e.export(),u=d.setViewport(0,0);await u.getViewportData(),s(o,d,u,a,c,r,l)}catch(d){Cp.error("CSV download failed",d),this.setState({errorMessage:R("p",{children:[h(Q,{icon:$n})," ",`${d}`]})}),i()}}}handleDownloadRowOptionChanged(e){this.setState({downloadRowOption:e.target.value})}handleCustomizedDownloadRowOptionChanged(e){this.setState({customizedDownloadRowOption:e.target.value})}handleCustomizedDownloadRowsChanged(e){this.setState({customizedDownloadRows:parseInt(e.target.value,10)})}handleIncludeColumnHeadersChanged(){this.setState(({includeColumnHeaders:e})=>({includeColumnHeaders:!e}))}handleIncludeHiddenColumnsChanged(){this.setState(({includeHiddenColumns:e})=>({includeHiddenColumns:!e}))}handleUseUnformattedValuesChanged(){this.setState(({useUnformattedValues:e})=>({useUnformattedValues:!e}))}validateOptionInput(){const{selectedRanges:e}=this.props,{downloadRowOption:t,customizedDownloadRows:n}=this.state;return t===Me.DOWNLOAD_ROW_OPTIONS.SELECTED_ROWS&&e.length===0?(this.setState({errorMessage:R("p",{children:[h(Q,{icon:$n})," No rows selected. Please select some rows in the table."]})}),!1):t===Me.DOWNLOAD_ROW_OPTIONS.CUSTOMIZED_ROWS&&n<=0?(this.setState({errorMessage:R("p",{children:[h(Q,{icon:$n})," Number of rows to output must be greater than 0"]})}),!1):!0}render(){const{model:e,isDownloading:t,tableDownloadProgress:n,tableDownloadEstimatedTime:s,selectedRanges:i,tableDownloadStatus:o}=this.props,{fileName:r,downloadRowOption:l,customizedDownloadRowOption:a,customizedDownloadRows:c,includeColumnHeaders:d,includeHiddenColumns:u,useUnformattedValues:m,errorMessage:p,id:g}=this.state,{rowCount:f}=e;return R("div",{className:"table-csv-exporter",children:[h("div",{className:"section-title",children:"Download Rows"}),h("div",{className:"form-group",children:R(Sr,{onChange:this.handleDownloadRowOptionChanged,value:l,disabled:t,children:[R(Sn,{value:Me.DOWNLOAD_ROW_OPTIONS.ALL_ROWS,"data-testid":"radio-csv-exporter-download-all",children:["All Rows",h("span",{className:"text-muted ml-2",children:`(${f.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,")} rows)`})]}),R(Sn,{value:Me.DOWNLOAD_ROW_OPTIONS.SELECTED_ROWS,"data-testid":"radio-csv-exporter-only-selected",children:["Only Selected Rows",h("span",{className:"text-muted ml-2",children:i.length>0?`(${Z.rowCount(i).toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,")} rows)`:null})]}),h(Sn,{value:Me.DOWNLOAD_ROW_OPTIONS.CUSTOMIZED_ROWS,"data-testid":"radio-csv-exporter-customized-rows",children:R("div",{className:"radio-input-row",role:"presentation",onClick:()=>{this.setState({downloadRowOption:Me.DOWNLOAD_ROW_OPTIONS.CUSTOMIZED_ROWS})},children:[R("select",{value:a,"data-testid":"select-csv-exporter-customized-rows",className:"custom-select",disabled:t,onChange:this.handleCustomizedDownloadRowOptionChanged,children:[h("option",{value:"FIRST",children:"First"}),h("option",{value:"LAST",children:"Last"})]}),h("input",{type:"number",className:"form-control",id:`customizedRows-${g}`,"data-testid":"input-csv-exporter-customized-rows",name:`customizedRows-${g}`,placeholder:"100",value:c,disabled:t,onChange:this.handleCustomizedDownloadRowsChanged}),h("div",{children:"Rows"})]})})]})}),R("div",{className:"form-group",children:[h("label",{htmlFor:`customizedRows-${g}`,children:"File Name"}),h("input",{type:"text",className:"form-control",id:`filename-${g}`,"data-testid":"input-csv-exporter-file-name",name:`filename-${g}`,value:r,onChange:C=>{this.setState({fileName:C.target.value})},disabled:t})]}),R("div",{className:"checkbox-options",children:[h(at,{checked:d,onChange:this.handleIncludeColumnHeadersChanged,children:"Include column headers"}),h(at,{checked:u,onChange:this.handleIncludeHiddenColumnsChanged,children:"Include hidden columns"}),h(at,{checked:m,onChange:this.handleUseUnformattedValuesChanged,children:"Use unformatted values"})]}),R("div",{className:"section-footer flex-column",children:[p!=null&&h("div",{className:"error-message",children:p}),o&&R("div",{className:"download-status",children:[(o===Me.DOWNLOAD_STATUS.DOWNLOADING||o===Me.DOWNLOAD_STATUS.INITIATING)&&R(Fe,{children:[o===Me.DOWNLOAD_STATUS.INITIATING&&h("div",{className:"text-muted",children:"Starting Download..."}),o===Me.DOWNLOAD_STATUS.DOWNLOADING&&R("div",{className:"text-muted d-flex justify-content-between",children:[h("span",{children:s||s===0?`Estimated time: ${Jt.formatElapsedTime(s)}`:null}),h("span",{children:`${n}%`})]})]}),o===Me.DOWNLOAD_STATUS.FINISHED&&h("div",{className:"text-muted text-right",children:"Download Completed"}),o===Me.DOWNLOAD_STATUS.CANCELED&&h("div",{className:"text-muted",children:"Download Canceled"}),(o===Me.DOWNLOAD_STATUS.DOWNLOADING||o===Me.DOWNLOAD_STATUS.INITIATING)&&h("div",{className:"progress",children:h("div",{className:"progress-bar progress-bar-striped progress-bar-animated",style:{width:`${n}%`}})}),o===Me.DOWNLOAD_STATUS.FINISHED&&h("div",{className:"progress",children:h("div",{className:"progress-bar bg-success",style:{width:`${n}%`}})})]}),R(K,{kind:"primary","data-testid":"btn-csv-exporter-download",className:G("btn-downloading",{"btn-spinner btn-cancelable":t}),onClick:this.handleDownloadClick,children:[t&&R("span",{children:[h(Ht,{}),h("span",{className:"btn-normal-content",children:"Downloading"}),h("span",{className:"btn-hover-content",children:"Cancel"})]}),!t&&"Download"]})]})]})}};let St=Me;St.FILENAME_DATE_FORMAT="yyyy-MM-dd-HHmmss";St.DOWNLOAD_STATUS={INITIATING:"INITIATING",DOWNLOADING:"DOWNLOADING",FINISHED:"FINISHED",CANCELED:"CANCELED"};St.DOWNLOAD_ROW_OPTIONS={ALL_ROWS:"ALL_ROWS",SELECTED_ROWS:"SELECTED_ROWS",CUSTOMIZED_ROWS:"CUSTOMIZED_ROWS"};St.CUSTOMIZED_ROWS_OPTIONS={FIRST:"FIRST",LAST:"LAST"};St.DEFAULT_DOWNLOAD_ROWS=100;St.defaultProps={onDownloadStart:()=>{},isDownloading:!1,tableDownloadStatus:"",tableDownloadProgress:0,tableDownloadEstimatedTime:null,selectedRanges:[]};const un=ne.module("TableSaver"),wp="yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSS z";function bp(e){return e.added!==void 0}function Sp(e){if(!bp(e))throw new Error("event is not UpdateEventData")}const Hn=class extends T.exports.PureComponent{constructor(e){var t,n;super(e),this.WritableStream=(t=window.WritableStream)!=null?t:qr,this.getCachedCustomColumnFormatFlag=vt(ds.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.includeColumnHeaders=!0,this.useUnformattedValues=!1,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:qr,this.iframes=[],this.useBlobFallback=!1}static csvEscapeString(e){return`"${e.replace(/"/g,'""')}"`}componentDidMount(){const{getDownloadWorker:e}=this.props;e().then(t=>{un.info("found active service worker"),this.sw=t,this.sw.postMessage("ping")}).catch(t=>{un.warn("Download csv is not optimized.",t),this.useBlobFallback=!0})}componentWillUnmount(){this.iframes.length>0&&this.iframes.forEach(e=>{e.remove()}),this.streamTimeout&&clearTimeout(this.streamTimeout),this.snapshotHandlerTimeout&&clearTimeout(this.snapshotHandlerTimeout)}createWriterStream(e){const t=this.useBlobFallback,n=[];let s=null;t&&(s=TextEncoder.prototype.encode.bind(new TextEncoder));const{fileName:i}=this,o={};return t?(o.write=r=>{O(s),r.header!==void 0&&n.push(s(r.header)),r.rows!==void 0&&n.push(s(r.rows))},o.close=()=>{O(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=()=>{e.postMessage({cancel:!0}),e.close()}):(o.write=r=>{e.postMessage(r)},o.close=()=>{e.postMessage({end:!0}),e.close()},o.abort=()=>{e.postMessage({cancel:!0}),e.close()}),new this.WritableStream(o)}startDownload(e,t,n,s,i,o,r){const{isDownloading:l}=this.props;if(l)return;this.downloadStartTime=Date.now(),un.info(`start downloading ${e}`),this.table=t,this.columns=te.columnsFromRanges(i,t.columns),this.tableSubscription=n,this.gridRanges=s,this.includeColumnHeaders=o,this.useUnformattedValues=r;const a=encodeURIComponent(e.replace(/\//g,":")).replace(/['()]/g,escape).replace(/\*/g,"%2A"),c=new MessageChannel;if(this.port=c.port1,this.fileName=e,this.fileWriter=this.createWriterStream(this.port).getWriter(),this.useBlobFallback){this.writeCsvTable(o);return}this.sw&&this.sw.postMessage({encodedFileName:a},[c.port2]),this.port.onmessage=this.handlePortMessage}finishDownload(){this.table&&this.table.close(),this.tableSubscription&&this.tableSubscription.close(),this.fileWriter&&this.fileWriter.close();const{onDownloadCompleted:e}=this.props;e(),this.resetTableSaver(),this.downloadStartTime!==void 0&&un.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(t=>{t&&(t.catch(()=>null),t.cancel())});const{onDownloadCanceled:e}=this.props;e(),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.includeColumnHeaders=!0,this.useUnformattedValues=!1,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(){un.info("download canceled"),this.cancelDownload()}writeTableHeader(){var t;let e="";if(this.columns)for(let n=0;n<this.columns.length;n+=1)e+=this.columns[n].name,e+=n===this.columns.length-1?`
|
|
5
|
+
`:",";(t=this.fileWriter)==null||t.write({header:e}).then(()=>null)}startWriteTableBody(){this.columns&&this.gridRanges!=null&&(this.chunkRows=Math.floor(Hn.DOWNLOAD_CELL_CHUNK/this.columns.length),this.rangedSnapshotsTotal=this.gridRanges.map(e=>(O(e.endRow),O(e.startRow),O(this.chunkRows),Math.ceil((e.endRow-e.startRow+1)/this.chunkRows))),this.snapshotsTotal=this.rangedSnapshotsTotal.reduce((e,t)=>e+t),un.info("start writing table, total snapshots: ",this.snapshotsTotal),this.makeSnapshot(Math.min(Hn.SNAPSHOT_BUFFER_SIZE,this.snapshotsTotal)))}writeCsvTable(e){e&&this.writeTableHeader(),this.startWriteTableBody()}writeSnapshot(e,t,n){if(this.currentSnapshotIndex===e&&this.fileWriter){for(;this.snapshotsBuffer.has(this.currentSnapshotIndex);){const s=this.snapshotsBuffer.get(this.currentSnapshotIndex);O(s),this.fileWriter.write({rows:this.convertSnapshotIntoCsv(s)}),this.snapshotsBuffer.delete(this.currentSnapshotIndex),this.currentSnapshotIndex+=1,this.updateDownloadProgress(e)}if(this.snapshotsTotal&&this.currentSnapshotIndex>=this.snapshotsTotal){this.finishDownload();return}}this.snapshotCounter&&this.snapshotsTotal&&this.snapshotCounter<this.snapshotsTotal&&(un.debug2(`
|
|
6
|
+
current range index: ${this.gridRangeCounter},
|
|
7
|
+
snapshotIndexCounter: ${this.snapshotCounter},
|
|
8
|
+
currentRangedSnapshotIndex : ${this.rangedSnapshotCounter},
|
|
9
|
+
snapshotpending: ${this.snapshotPending},
|
|
10
|
+
buffered ${this.snapshotsBuffer.size}
|
|
11
|
+
making ${Math.min(Hn.SNAPSHOT_BUFFER_SIZE-this.snapshotsBuffer.size-this.snapshotPending,this.snapshotsTotal-this.snapshotCounter)} more snapshots
|
|
12
|
+
`),this.makeSnapshot(Math.min(Hn.SNAPSHOT_BUFFER_SIZE-this.snapshotsBuffer.size-this.snapshotPending,this.snapshotsTotal-this.snapshotCounter)))}updateDownloadProgress(e){if(e!=null&&this.snapshotsTotal!=null&&this.downloadStartTime!=null){const{onDownloadProgressUpdate:t}=this.props,n=Math.floor(e*100/this.snapshotsTotal),s=e>1?Math.floor((Date.now()-this.downloadStartTime)*(this.snapshotsTotal-e)/e/1e3):null;t(n,s)}}convertSnapshotIntoCsv(e){var r;let t="";const n=e.added.iterator(),{formatter:s}=this.props,i=[];for(;n.hasNext();)i.push(n.next().value);O(this.columns);const{useUnformattedValues:o}=this;for(let l=0;l<i.length;l+=1){const a=i[l];for(let c=0;c<this.columns.length;c+=1){const{type:d,name:u}=this.columns[c];let m=null;if(o){let p=(r=e.getData(a,this.columns[c]))!=null?r:"";p!==""&&A.isDateType(d)&&(p=I.i18n.DateTimeFormat.format(wp,p,I.i18n.TimeZone.getTimeZone(s.timeZone))),m=p.toString()}else{const p=this.getCachedCustomColumnFormatFlag(s,u,d);let g=null;if(!p){const f=e.getFormat(a,this.columns[c]);g=(f==null?void 0:f.formatString)!=null?f:null}g?m=s.getFormattedString(e.getData(a,this.columns[c]),d,u,g):m=s.getFormattedString(e.getData(a,this.columns[c]),d,u)}t+=Hn.csvEscapeString(m),t+=c===this.columns.length-1?`
|
|
13
|
+
`:","}}return t}makeSnapshot(e){if(e<=0)return;O(this.gridRangeCounter);let t=0,n=this.gridRanges[this.gridRangeCounter];for(O(this.tableSubscription),O(this.columns);t<e;){O(n),O(n.startRow),O(n.endRow),O(this.rangedSnapshotCounter),O(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(Pe.makeCancelable(this.tableSubscription.snapshot(I.RangeSet.ofRange(s,i),this.columns).then(r=>(Sp(r),this.handleSnapshotResolved(r,o,s,i),o)).catch(r=>{un.error(r)}),r=>{un.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]),t+=1}}handlePortMessage({data:e}){const{download:t,readableStreamPulling:n}=e;if(!this.useBlobFallback){if(t!=null){const{includeColumnHeaders:s}=this;this.makeIframe(`${t}`),this.writeCsvTable(s)}n!=null&&(this.useBlobFallback||(this.streamTimeout!=null&&clearTimeout(this.streamTimeout),this.streamTimeout=setTimeout(this.handleDownloadTimeout,Hn.STREAM_TIMEOUT)))}}handleSnapshotResolved(e,t,n,s){this.snapshotHandlerTimeout=setTimeout(()=>{this.snapshotsBuffer.set(t,e),this.snapshotPending-=1,this.writeSnapshot(t,n,s),this.cancelableSnapshots[t]=null},Hn.SNAPSHOT_HANDLER_TIMEOUT)}makeIframe(e){const t=document.createElement("iframe");t.hidden=!0,t.src=`download/${e}`,t.name="iframe",document.body.appendChild(t),this.iframes.push(t)}render(){return null}};let Gs=Hn;Gs.DOWNLOAD_CELL_CHUNK=6e3;Gs.SNAPSHOT_BUFFER_SIZE=5;Gs.STREAM_TIMEOUT=8e3;Gs.SNAPSHOT_HANDLER_TIMEOUT=5;Gs.defaultProps={getDownloadWorker:()=>Promise.reject(new Error("Download worker not provided")),isDownloading:!1,onDownloadCompleted:()=>{},onDownloadCanceled:()=>{},onDownloadProgressUpdate:()=>{}};function vp(e){var v;const{group:t,onDelete:n,onColorChange:s,onNameChange:i,validateName:o}=e,{isNew:r}=t,l=T.exports.useRef(t),a=T.exports.useRef(null),c=T.exports.useRef(null),[d,u]=T.exports.useState(r?"":t.name),[m,p]=T.exports.useState(r),[g,f]=T.exports.useState(!1),C=d!==t.name?o(d):"",w=r&&!g||C==="";T.exports.useEffect(function(){m&&a.current&&(a.current.focus(),a.current.select())},[m]),T.exports.useEffect(function(){return()=>{l.current.isNew&&n(l.current)}},[n]);const b=()=>{w&&(i(t,d),p(!1))},S=()=>{if(r){n(t);return}u(t.name),p(!1)},E=y=>{f(!0),y.key==="Enter"&&(y.stopPropagation(),b()),y.key===" "&&y.stopPropagation(),y.key==="Escape"&&S()};return m?R(Fe,{children:[R("div",{className:"editing-container",children:[h("input",{ref:a,className:G("form-control",{"is-invalid":!w}),value:d,placeholder:"Group Name",onChange:y=>u(y.target.value),onKeyDown:E}),h(K,{kind:"ghost",icon:Wn,tooltip:"Confirm",onClick:b}),h(K,{kind:"ghost",icon:_d,tooltip:"Cancel",onClick:S})]}),!w&&h("p",{className:"mb-0 validate-label-error text-danger",children:C})]}):R("div",{className:"group-name-wrapper",children:[h("span",{className:"column-name",children:d}),h(K,{className:"p-1 mx-1",kind:"ghost",icon:ar,tooltip:"Edit",onClick:()=>{p(!0)}}),R("span",{className:"right-buttons",children:[h(K,{kind:"ghost",icon:Tn,tooltip:"Delete group",onClick:()=>n(t)}),h(K,{kind:"ghost",className:"color-swatch mr-1",icon:t.color!==void 0?R("span",{className:"fa-layers",children:[h(Q,{className:"color-swatch",icon:Xi,color:xe.white,transform:"down-1"}),h(Q,{className:"color-swatch",icon:Xi,color:t.color,transform:"shrink-2 down-1"})]}):Zd,tooltip:"Set color",onClick:()=>{var y,M;(y=c.current)==null||y.click(),(M=c.current)==null||M.focus()}}),h("input",{"aria-label":"Color input",ref:c,type:"color",list:"presetColors",value:(v=t.color)!=null?v:xe["content-bg"],style:{visibility:"hidden",width:0,height:0,padding:0,border:0},onChange:y=>{t.color=y.target.value,s(t,y.target.value)}}),R("datalist",{id:"presetColors",children:[h("option",{children:xe["content-bg"]}),h("option",{children:xe.primary}),h("option",{children:xe.foreground}),h("option",{children:xe.green}),h("option",{children:xe.yellow}),h("option",{children:xe.orange}),h("option",{children:xe.red}),h("option",{children:xe.purple}),h("option",{children:xe.blue}),h("option",{children:xe["gray-400"]})]})]})]})}function Tp(){}const Ep=T.exports.forwardRef(function(t,n){const{value:s,clone:i,childCount:o,item:r,onVisibilityChange:l,onClick:a,onGroupDelete:c,onGroupColorChange:d,onGroupNameChange:u,validateGroupName:m,handleProps:p}=t,{group:g,modelIndex:f,isVisible:C}=r.data,w=T.exports.useRef(null),b=T.exports.useCallback(E=>{var v;E.buttons===1&&(l([f].flat(),!C),(v=w.current)==null||v.focus())},[l,f,C]),S=T.exports.useCallback(E=>{a(s,E)},[a,s]);return R("div",{ref:n,className:G("tree-item",{isSelected:r.selected,"two-dragged":o===2,"multiple-dragged":o>2}),onClick:S,...p,children:[h(K,{ref:w,kind:"ghost",className:"px-1",onClick:Tp,onMouseDown:b,onMouseEnter:b,icon:C?cr:ia,tooltip:"Toggle visibility"}),h("span",{className:G("column-name",g&&"column-group"),children:g&&!i?h(vp,{group:g,onDelete:c,onColorChange:d,onNameChange:u,validateName:m}):s}),R("div",{children:[i&&o>1&&h("span",{className:"item-count",children:o}),h(Be,{children:"Drag to re-order"}),h(Q,{icon:lo})]})]})});function yp(e){return e.parentId!==void 0}function Rp(e,t){return Math.round(e/t)}function Ka(e,t,n,s,i,o){var l;const r=e.findIndex(a=>a.name===s);if(r===-1){const a=n.get(s);if(a==null)throw new Error(`Column or header group not found: ${s}`);const c=a.childIndexes.flat();return{id:s,selected:o.has(s),children:a.children.map(d=>Ka(e,t,n,d,i,o)).sort((d,u)=>{const m=Array.isArray(d.data.visibleIndex)?d.data.visibleIndex[0]:d.data.visibleIndex,p=Array.isArray(u.data.visibleIndex)?u.data.visibleIndex[0]:u.data.visibleIndex;return m-p}),data:{modelIndex:c,visibleIndex:a.getVisibleRange(t),group:a,isVisible:c.some(d=>{var u;return((u=i.get(d))!=null?u:1)>0})}}}return{id:s,children:[],selected:o.has(s),data:{modelIndex:r,visibleIndex:B.getVisibleIndex(r,t),isVisible:((l=i.get(r))!=null?l:1)>0}}}function Ip(e,t,n,s,i){const o=[],r=new Set(i),l=new Map(n.map(c=>[c.name,c]));let a=0;for(;a<e.length;){const c=B.getModelIndex(a,t),d=e[c].name;let u=n.find(({children:p})=>p.includes(d));for(;u!==void 0&&u.parent!==void 0;)u=l.get(u.parent);const m=Ka(e,t,l,u?u.name:d,s,r);o.push(m),Array.isArray(m.data.visibleIndex)?a+=m.data.visibleIndex[1]-m.data.visibleIndex[0]+1:a+=1}return o}function Zi(e,t,n,s,i){const o=e.findIndex(({id:w})=>w===n),r=e.findIndex(({id:w})=>w===t),l=e[r],a=Fc(e,r,o),c=a[o-1],d=a[o+1],u=Rp(s,i),m=l.depth+u,p=Mp({previousItem:c,nextItem:d}),g=Dp({nextItem:d});let f=m;return m>=p?f=p:m<g&&(f=g),{depth:f,maxDepth:p,minDepth:g,parentId:C()};function C(){var b;if(f===0||!c)return null;if(f===c.depth)return c.parentId;if(f>c.depth)return c.id;const w=(b=a.slice(0,o).reverse().find(S=>S.depth===f))==null?void 0:b.parentId;return w!=null?w:null}}function Mp({previousItem:e,nextItem:t}){var n,s;return Math.max((n=e==null?void 0:e.depth)!=null?n:0,(s=t==null?void 0:t.depth)!=null?s:0)}function Dp({nextItem:e}){return e?e.depth:0}function Xa(e,t=null,n=0){return e.reduce((s,i,o)=>[...s,{...i,parentId:t,depth:n,index:o},...Xa(i.children,i.id,n+1)],[])}function Mt(e){return e.every(yp)?e:Xa(e)}function Ya(e,t){for(let n=0;n<e.length;n+=1){const s=e[n],{id:i,children:o}=s;if(i===t)return s;if(o.length){const r=Ya(o,t);if(r)return r}}}function Qa(e,t=0){return e.reduce((n,{children:s})=>s.length?Qa(s,n+1):n+1,t)}function Np(e,t){const n=Ya(e,t);return n?Qa(n.children):0}const Fp=[Zt.Down,Zt.Right,Zt.Up,Zt.Left],xp=[Zt.Left,Zt.Right];function Ap(e,t,n){return(s,{currentCoordinates:i,context:{active:o,over:r,collisionRect:l,droppableRects:a,droppableContainers:c}})=>{if(Fp.includes(s.code)){if(!o||!l)return;s.preventDefault();const{current:{items:d,offset:u}}=e;if(xp.includes(s.code)&&(r==null?void 0:r.id)!=null){const{depth:f,maxDepth:C,minDepth:w}=Zi(d,o.id,r.id,u,n);switch(s.code){case Zt.Left:if(f>w)return{...i,x:i.x-n};break;case Zt.Right:if(f<C)return{...i,x:i.x+n};break}return}const m=[];c.forEach(f=>{if((f==null?void 0:f.disabled)||f.id===(r==null?void 0:r.id))return;const C=a.get(f.id);if(!!C)switch(s.code){case Zt.Down:l.top<C.top&&m.push(f);break;case Zt.Up:l.top>C.top&&m.push(f);break}});const p=xc({active:o,collisionRect:l,pointerCoordinates:null,droppableRects:a,droppableContainers:m});let g=Ac(p,"id");if(g===(r==null?void 0:r.id)&&p.length>1&&(g=p[1].id),g!=null&&(r==null?void 0:r.id)!=null){const f=a.get(o.id),C=a.get(g),w=c.get(g);if(f&&C&&w){const b=d.findIndex(({id:y})=>y===g),S=d[b],E=d.findIndex(({id:y})=>y===o.id),v=d[E];if(S!=null&&v!=null){const{depth:y}=Zi(d,o.id,g,(S.depth-v.depth)*n,n),F=b>E?1:-1,x=t?(l.height-f.height)/2:0;return{x:C.left+y*n,y:C.top+F*x}}}}}}}class ja extends Oc{}ja.activators=[{eventName:"onPointerDown",handler:({nativeEvent:e})=>!(!e.isPrimary||e.button!==0||kp(e.target))}];const Op=["button","input","textarea","select","option"];function kp(e){return!!((e==null?void 0:e.tagName)!=null&&Op.includes(e.tagName.toLowerCase()))}function Za(e){const{clone:t=!1,depth:n,disableInteraction:s=!1,ghost:i=!1,handleProps:o,value:r,dragRef:l=null,wrapperRef:a=null,renderItem:c,item:d,childCount:u}=e,m=T.exports.useMemo(()=>Array(n).fill(0).map((g,f)=>h("span",{className:"depth-line"},`depth-line-${f}`)),[n]),p=T.exports.useMemo(()=>({ref:l,clone:t,value:r,item:d,childCount:u,handleProps:o}),[l,t,r,d,u,o]);return R("li",{className:G("item-wrapper",{clone:t,ghost:i,disableInteraction:s}),ref:a,children:[!t&&m,c(p)]},r)}Za.displayName="TreeItem";const Lp=({isSorting:e,wasDragging:t})=>!(e||t);function Ml({id:e,depth:t,...n}){const{attributes:s,isDragging:i,isSorting:o,listeners:r,setDraggableNodeRef:l,setDroppableNodeRef:a,transform:c,transition:d}=kc({id:e,animateLayoutChanges:Lp}),u=Ko.Translate.toString(c),m=T.exports.useMemo(()=>({transform:u,transition:d}),[u,d]),p=T.exports.useMemo(()=>({...s,...r,style:m}),[s,r,m]);return h(Za,{dragRef:l,wrapperRef:a,depth:t,ghost:i,disableInteraction:o,handleProps:p,...n})}const Pp={keyframes({transform:e}){return[{opacity:1,transform:Ko.Transform.toString(e.initial)},{opacity:0,transform:Ko.Transform.toString({...e.final,x:e.final.x+5,y:e.final.y+5})}]},easing:"ease-out",sideEffects({active:e}){e.node.animate([{opacity:0},{opacity:1}],{duration:Kr.duration,easing:Kr.easing})}};let Es=null;function Hp(e){return Es==null&&e.activeNodeRect&&e.activatorEvent instanceof PointerEvent&&(Es=Math.floor((e.activatorEvent.clientY-e.activeNodeRect.top)/e.activeNodeRect.height)*e.activeNodeRect.height),e.activeNodeRect||(Es=null),{...e.transform,y:e.transform.y+(Es!=null?Es:0)}}function _p({items:e,renderItem:t,indentationWidth:n=30,indicator:s=!1,activeId:i,overId:o,offsetLeft:r}){const l=Lc(),a=T.exports.useRef(l);T.exports.useEffect(function(){a.current=l},[l]),T.exports.useEffect(function(){a.current.measureDroppableContainers(e.map(({id:p})=>p))},[e]);const c=i!=null&&o!=null?Zi(e,i,o,r,n):null,d=T.exports.useRef({items:e,offset:r}),u=i!=null?e.find(({id:m})=>m===i):null;return T.exports.useEffect(()=>{d.current={items:e,offset:r}},[e,r]),R(Fe,{children:[h("div",{className:G("tree-container",i!=null&&"marching-ants"),children:e.map(m=>{const{id:p,depth:g}=m;return h(Ml,{id:p,value:p,depth:p===i&&c?c.depth:g,item:m,renderItem:t},p)})}),Pc.exports.createPortal(h(Hc,{dropAnimation:Pp,modifiers:[Hp],className:"visibility-ordering-list",children:i!=null&&u?h(Ml,{id:i,depth:u.depth,clone:!0,childCount:Np(e,i)+1,value:i.toString(),renderItem:t,item:u}):null}),document.body)]})}const Vp={droppable:{strategy:_c.Always}},Up={activationConstraint:{distance:5}};function Bp({items:e,indicator:t=!1,indentationWidth:n=30,onDragStart:s,onDragEnd:i,renderItem:o}){const[r,l]=T.exports.useState(null),[a,c]=T.exports.useState(null),[d,u]=T.exports.useState(0),m=T.exports.useMemo(()=>{const F=Mt(e);return r!=null?F.filter(({id:x,selected:U})=>x===r||!U):F},[r,e]),p=r!=null&&a!=null?Zi(m,r,a,d,n):null,g=T.exports.useRef({items:m,offset:d}),f=T.exports.useMemo(()=>({coordinateGetter:Ap(g,t,n)}),[n,t]),C=Vc(Xr(ja,Up),Xr(Wc,f)),w=T.exports.useMemo(()=>m.map(({id:F})=>F),[m]);T.exports.useEffect(()=>{g.current={items:m,offset:d}},[m,d]);const b=T.exports.useCallback(({active:{id:F}})=>{l(F),c(F),s==null||s(F),document.body.style.setProperty("cursor","grabbing")},[s]),S=T.exports.useCallback(({delta:F})=>{u(F.x)},[]),E=T.exports.useCallback(({over:F})=>{var x;c((x=F==null?void 0:F.id)!=null?x:null)},[]),v=T.exports.useCallback(()=>{c(null),l(null),u(0),document.body.style.setProperty("cursor","")},[]),y=T.exports.useCallback(({active:F,over:x})=>{if(v(),p&&x){const{depth:U,parentId:V}=p,N=JSON.parse(JSON.stringify(Mt(e))),H=N.findIndex(({id:P})=>P===x.id),k=N.findIndex(({id:P})=>P===F.id),z=N[k];N[k]={...z,depth:U,parentId:V},i==null||i(z,{...N[H],parentId:p.parentId})}},[e,i,p,v]),M=T.exports.useCallback(()=>{v()},[v]);return h(Uc,{sensors:C,collisionDetection:Bc,measuring:Vp,onDragStart:b,onDragMove:S,onDragOver:E,onDragEnd:y,onDragCancel:M,children:h(Gc,{items:w,strategy:zc,children:h(_p,{items:m,renderItem:o,indicator:t,indentationWidth:n,activeId:r,overId:a,offsetLeft:d})})})}function Gp(e,t,n,s,i,o,r,l){const a=i.map((b,S)=>({...b,index:S}));let c=[],d=s;const u=o[0].data.visibleIndex,m=a.findIndex(({id:b})=>b===e.id),p=a.findIndex(({id:b})=>b===t.id);let g=Array.isArray(u)?u[1]+1:u+1;d=Un(o[0],t.parentId,d);for(let b=1;b<o.length;b+=1){const{data:{visibleIndex:S}}=o[b];c=B.moveItemOrRange(S,g,c,!0),g+=Array.isArray(S)?S[1]-S[0]+1:1,d=Un(o[b],t.parentId,d)}const f=[Array.isArray(u)?u[0]:u,g-1],C=Array.isArray(t.data.visibleIndex)?t.data.visibleIndex[0]:t.data.visibleIndex;let w=B.getVisibleIndex(C,c);return m>p&&w>C&&(w-=1),t.children.length>0&&(Array.isArray(u)?u[0]:u)<w&&(w-=1),f[0]<w&&(w-=f[1]-f[0]),c=B.moveItemOrRange(f,Ue(w,r,l),c),{groups:d,movedColumns:n.concat(c)}}function Un(e,t,n){var a;if(e.parentId===t)return n;let s=n.map(c=>new Yt(c));const i=new Map(s.map(c=>[c.name,c])),o=s.find(c=>c.name===e.parentId),r=s.find(c=>c.name===t),l=s.find(c=>c.name===e.id);if(o!=null&&(o.children=o.children.filter(c=>c!==e.id),o.children.length===0)){const c=new Set([o.name]),{parent:d=""}=o;let u=i.get(d);for(u==null||u.removeChildren([o.name]);u&&u.children.length===0;){c.add(u.name);const m=(a=u==null?void 0:u.parent)!=null?a:"",p=i.get(m);p==null||p.removeChildren([u.name]),u=p}s=s.filter(({name:m})=>!c.has(m))}return r!=null&&r.addChildren([e.id]),l==null||l.setParent(t!=null?t:void 0),s}const zp=150,Qe=class extends T.exports.Component{constructor(e){super(e),this.debouncedSearchColumns=Et(this.searchColumns,zp),this.handleGroupColorChange=Xn((t,n)=>{const{columnHeaderGroups:s,onColumnHeaderGroupChanged:i}=this.props,o=[...s],r=new Yt({...t,color:n});o.splice(o.findIndex(({name:l})=>l===t.name),1,r),i(o)},250),this.renderItem=he(({value:t,clone:n,item:s,ref:i,handleProps:o})=>{const{onColumnVisibilityChanged:r}=this.props,{selectedColumns:l}=this.state;let a=t;return n&&(a=this.getSelectedParentItems().map(({id:d})=>d).join(", ")),h(Ep,{ref:i,value:a,clone:n,item:s,childCount:l.size,onVisibilityChange:r,onClick:this.handleItemClick,onGroupDelete:this.handleGroupDelete,onGroupColorChange:this.handleGroupColorChange,onGroupNameChange:this.handleGroupNameChange,validateGroupName:this.validateGroupName,handleProps:o})}),this.getMemoizedFirstMovableIndex=he((t,n,s)=>{for(let i=0;i<n.length;i+=1){const o=B.getModelIndex(i,s);if(t.isColumnMovable(o))return i}return null}),this.getMemoizedLastMovableIndex=he((t,n,s)=>{for(let i=n.length-1;i>=0;i-=1){const o=B.getModelIndex(i,s);if(t.isColumnMovable(o))return i}return null}),this.memoizedGetTreeItems=he((t,n,s,i,o)=>Ip(t,n,s,i,[...o.values()])),this.makeVisibilityOrderingList=he((t,n)=>{const{movedColumns:s}=this.props,i=[],o=this.getFirstMovableIndex(),r=this.getLastMovableIndex(),l=n.findIndex(({data:d})=>Array.isArray(d.visibleIndex)?d.visibleIndex[0]===o:d.visibleIndex===o),a=n.findIndex(({data:d})=>Array.isArray(d.visibleIndex)?d.visibleIndex[1]===r:d.visibleIndex===r),c=n.slice(l,a+1);if(o==null||r===null){for(let d=0;d<t.length;d+=1){const u=B.getModelIndex(d,s),m=t[u];i.push(this.renderImmovableItem(m.name))}return i}for(let d=0;d<o;d+=1){const u=B.getModelIndex(d,s),m=t[u];i.push(this.renderImmovableItem(m.name))}o!==null&&o>0&&i.push(h("hr",{},"top-horizontal-divider")),i.push(h(Bp,{items:c,renderItem:this.renderItem,onDragStart:this.handleDragStart,onDragEnd:this.handleDragEnd},"movable-items")),r!=null&&r<t.length-1&&i.push(h("hr",{},"bottom-horizontal-divider"));for(let d=r+1;d<t.length;d+=1){const u=B.getModelIndex(d,s),m=t[u];i.push(this.renderImmovableItem(m.name))}return i}),this.renderImmovableItem=he(t=>h("div",{className:"visibility-ordering-list-item immovable",children:h("div",{className:"column-item",children:h("span",{className:"column-name",children:t})})},t)),this.handleSearchInputChange=this.handleSearchInputChange.bind(this),this.searchColumns=this.searchColumns.bind(this),this.handleItemClick=this.handleItemClick.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleGroupDelete=this.handleGroupDelete.bind(this),this.handleGroupNameChange=this.handleGroupNameChange.bind(this),this.handleGroupCreate=this.handleGroupCreate.bind(this),this.validateGroupName=this.validateGroupName.bind(this),this.addColumnToSelected=this.addColumnToSelected.bind(this),this.handleDragStart=this.handleDragStart.bind(this),this.state={selectedColumns:new Set,lastSelectedColumn:"",searchFilter:""},this.list=null}componentWillUnmount(){this.debouncedSearchColumns.cancel()}resetVisibilityOrdering(){const{model:e,onColumnVisibilityChanged:t,onMovedColumnsChanged:n,onColumnHeaderGroupChanged:s}=this.props,{columns:i}=e;t(i.map((o,r)=>r),!0),this.setState({selectedColumns:new Set,lastSelectedColumn:"",searchFilter:""}),s(e.initialColumnHeaderGroups),n(e.initialMovedColumns)}resetSelection(){this.setState({selectedColumns:new Set,lastSelectedColumn:""})}handleSearchInputChange(e){const t=e.target.value;if(this.setState({searchFilter:t}),!t){this.debouncedSearchColumns.cancel(),this.resetSelection();return}this.debouncedSearchColumns(t)}searchColumns(e){var o;const t=Mt(this.getTreeItems()),s=t.filter(({id:r})=>r.toLowerCase().includes(e.toLowerCase())).map(({id:r})=>r),i=t.findIndex(({id:r})=>r.toLowerCase().includes(e.toLowerCase()));if(this.addColumnToSelected(s,!1),s.length>0){const r=(o=this.list)==null?void 0:o.querySelectorAll(".item-wrapper")[i];r==null||r.scrollIntoView({block:"center"})}}moveSelectedColumns(e){var d;const{columnHeaderGroups:t}=this.props,{selectedColumns:n}=this.state,s=Mt(this.getTreeItems());let i=this.getFirstMovableIndex(),o=this.getLastMovableIndex();O(i),O(o);const r=this.getSelectedParentItems();e===Qe.MOVE_OPTIONS.UP||e===Qe.MOVE_OPTIONS.TOP||r.reverse();let a=[],c=t;for(let u=0;u<r.length;u+=1){const{id:m,parentId:p,depth:g,data:{visibleIndex:f}}=r[u];switch(e){case Qe.MOVE_OPTIONS.TOP:{a=B.moveItemOrRange(f,i,a,!0),i+=Array.isArray(f)?f[1]-f[0]+1:1,c=Un(r[u],null,c);break}case Qe.MOVE_OPTIONS.BOTTOM:{a=B.moveItemOrRange(f,o,a,!0),o-=Array.isArray(f)?f[1]-f[0]+1:1,c=Un(r[u],null,c);break}case Qe.MOVE_OPTIONS.UP:{const C=s.findIndex(S=>S.id===m),w=s.map((S,E)=>E<C&&!n.has(S.id)).lastIndexOf(!0),b=s[w];if(b!=null&&b.parentId!==p)if(Math.abs(b.depth-g)>1){const S=s.map((v,y)=>y<w&&v.depth===g).lastIndexOf(!0),E=s[S];c=Un(r[u],E.id,c)}else c=Un(r[u],b.parentId,c);else{const S=Ue(Array.isArray(f)?f[0]-1:f-1,i,o);a=B.moveItemOrRange(f,S,a,!1),i+=Array.isArray(f)?f[1]-f[0]+1:1}break}case Qe.MOVE_OPTIONS.DOWN:{const C=s.findIndex(E=>E.id===m),w=s.find((E,v)=>v>C&&!n.has(E.id));if((w==null?void 0:w.parentId)!==p){const E=s.find(v=>v.id===p);c=Un(r[u],(d=E==null?void 0:E.parentId)!=null?d:null,c);break}else if((w==null?void 0:w.children.length)>0){c=Un(r[u],w.id,c);break}const b=Ue(Array.isArray(f)?f[0]+1:f+1,i,o);a=B.moveItemOrRange(f,b,a,!1),o-=Array.isArray(f)?f[1]-f[0]+1:1;break}}}return{newMoves:a,groups:c}}handleMoveColumns(e){const{onMovedColumnsChanged:t,movedColumns:n,onColumnHeaderGroupChanged:s}=this.props,{newMoves:i,groups:o}=this.moveSelectedColumns(e);let r;e===Qe.MOVE_OPTIONS.TOP&&(r=()=>{var l,a;(a=(l=this.list)==null?void 0:l.parentElement)==null||a.scroll({top:0})}),e===Qe.MOVE_OPTIONS.BOTTOM&&(r=()=>{var l,a;(a=(l=this.list)==null?void 0:l.parentElement)==null||a.scroll({top:this.list.parentElement.scrollHeight})}),s(o),i.length>0&&t(n.concat(i),r)}getSortMoves(e,t,n){const s=[...e],i=t===Qe.SORTING_OPTIONS.ASC;s.sort((l,a)=>{const c=l.id.toUpperCase(),d=a.id.toUpperCase();return fr.sort(c,d,i)});let o=[...n],r=Math.min(...s.flatMap(l=>{const{modelIndex:a}=l.data;return Array.isArray(a)?B.getVisibleIndexes(a,o):B.getVisibleIndex(a,o)}));for(let l=0;l<s.length;l+=1){const a=s[l],{modelIndex:c}=a.data,d=Array.isArray(c)?B.getVisibleIndexes(c,o):B.getVisibleIndex(c,o);o=Array.isArray(d)?B.moveRange([Math.min(...d),Math.max(...d)],r,o,!0):B.moveItem(d,r,o),Array.isArray(d)&&(o=this.getSortMoves(a.children,t,o)),r+=Array.isArray(c)?c.length:1}return o}handleSortColumns(e){const{model:t,onMovedColumnsChanged:n}=this.props,s=this.getSortMoves(this.getTreeItems(),e,t.initialMovedColumns);n(s)}handleItemClick(e,t){if(t.stopPropagation(),t.target instanceof HTMLElement&&(t.target.tagName==="BUTTON"||t.target.tagName==="INPUT"))return;t.currentTarget.focus();const{selectedColumns:n,lastSelectedColumn:s}=this.state,i=B.isModifierKeyDown(t),o=t.shiftKey,r=n.has(e),l=[e];if(r&&i){this.removeColumnFromSelected(e);return}const a=Mt(this.getTreeItems());if(r&&!o&&s===e){const c=a.find(({id:u})=>u===e);if(O(c),Mt(c.children).length+1===n.size){this.resetSelection();return}}if(o){const c=a.findIndex(u=>u.id===e),d=a.findIndex(u=>u.id===s);l.push(...a.slice(Math.min(d,c),Math.max(d,c)+1).map(u=>u.id))}this.addColumnToSelected(l,i||o),this.setState({lastSelectedColumn:e})}addColumnToSelected(e,t){const{selectedColumns:n}=this.state,s=new Set(t?[...n.values()].concat(e):e);Mt(this.getTreeItems()).forEach(({id:o,children:r})=>{s.has(o)&&r.forEach(l=>s.add(l.id))}),this.setState({selectedColumns:s})}removeColumnFromSelected(e){const{selectedColumns:t}=this.state,n=Mt(this.getTreeItems()),s=n.find(({id:o})=>o===e);O(s);let i=n.find(({id:o})=>o===s.parentId);for(Mt(s==null?void 0:s.children).forEach(o=>t.delete(o.id));i!=null;){t.delete(i.id);const o=i.parentId;i=n.find(({id:r})=>r===o)}t.delete(e),this.setState({selectedColumns:new Set(t)})}handleDragStart(e){const{selectedColumns:t}=this.state;t.has(e)||this.addColumnToSelected([e],!1)}handleDragEnd(e,t){const{movedColumns:n,onMovedColumnsChanged:s,columnHeaderGroups:i,onColumnHeaderGroupChanged:o}=this.props,r=this.getSelectedParentItems(),l=Mt(this.getTreeItems()).map((m,p)=>({...m,index:p})),a=this.getFirstMovableIndex(),c=this.getLastMovableIndex();O(a),O(c);const{groups:d,movedColumns:u}=Gp(e,t,n,i,l,r,a,c);o(d),s(u)}handleGroupNameChange(e,t){const{columnHeaderGroups:n,onColumnHeaderGroupChanged:s}=this.props,i=[...n],o=e.name,r=i.findIndex(({name:d})=>d===o),l=i[r];O(l);const a=new Yt(l);a.name=t,i.splice(r,1,a);const c=i.findIndex(({name:d})=>d===a.parent);if(c>=0){const d=new Yt(i[c]);d.removeChildren([o]),d.addChildren([t]),i.splice(c,1,d)}s(i)}handleGroupDelete(e){const{columnHeaderGroups:t,onColumnHeaderGroupChanged:n}=this.props,s=t.filter(o=>o.name!==e.name),i=s.findIndex(o=>o.name===e.parent);if(i>=0){const o=new Yt(s[i]);o.addChildren(e.children),o.removeChildren([e.name]),s.splice(i,1,o)}n(s)}handleGroupCreate(){const{movedColumns:e,onMovedColumnsChanged:t,onColumnHeaderGroupChanged:n}=this.props,{newMoves:s,groups:i}=this.moveSelectedColumns(Qe.MOVE_OPTIONS.TOP),o=i.filter(d=>!d.isNew),r=this.getSelectedParentItems(),l=r.map(d=>d.data.modelIndex).flat().filter(d=>d>=0),a=`${Yt.NEW_GROUP_PREFIX}-${Date.now()}`,c=new Yt({name:a,children:r.map(({id:d})=>d),depth:0,childIndexes:[...new Set(l)]});t(e.concat(s),()=>{var d,u;(u=(d=this.list)==null?void 0:d.parentElement)==null||u.scroll({top:0})}),n(o.concat([c])),this.resetSelection()}validateGroupName(e){const{model:t,columnHeaderGroups:n}=this.props,{columns:s}=t;return En.isValidColumnName(e)?s.some(({name:i})=>i===e)||n.some(({name:i})=>i===e)?"Duplicate name":"":"Invalid name"}getFirstMovableIndex(){const{model:e,movedColumns:t}=this.props;return this.getMemoizedFirstMovableIndex(e,e.columns,t)}getLastMovableIndex(){const{model:e,movedColumns:t}=this.props;return this.getMemoizedLastMovableIndex(e,e.columns,t)}getTreeItems(){const{model:e,movedColumns:t,userColumnWidths:n,columnHeaderGroups:s}=this.props,{selectedColumns:i}=this.state;return this.memoizedGetTreeItems(e.columns,t,s,n,i)}getSelectedParentItems(){const{selectedColumns:e}=this.state;return Mt(this.getTreeItems()).filter(({id:n,parentId:s})=>e.has(n)&&!e.has(s!=null?s:""))}render(){const{model:e,userColumnWidths:t,onColumnVisibilityChanged:n}=this.props,{selectedColumns:s,searchFilter:i}=this.state,o=s.size>0,r=this.getTreeItems(),l=new Map(Mt(r).map(p=>[p.id,p.data.modelIndex])),a=[...new Set(o?[...s.values()].map(p=>l.get(p)).filter(p=>p!=null).flat():r.map(p=>p.data.modelIndex).flat())],c=!B.checkAllColumnsHidden(a,t),d=c?"Hide All":"Show All",u=c?"Hide Selected":"Show Selected",m=this.makeVisibilityOrderingList(e.columns,r);return R("div",{role:"menu",className:"visibility-ordering-builder",tabIndex:0,children:[R("div",{className:"top-menu",children:[h(K,{kind:"ghost",className:"toggle-visibility-btn",onClick:()=>{n(a,!c)},icon:c?cr:ia,tooltip:"Toggle column visibility",children:o?u:d}),h(Qn,{className:"visibility-search",value:i,matchCount:i?s.size:void 0,onChange:this.handleSearchInputChange})]}),R("div",{className:"top-menu",children:[h(K,{kind:"ghost",icon:nu,tooltip:"Reset to default",onClick:()=>{this.resetVisibilityOrdering()},children:"Reset"}),h("span",{className:"vertical-divider"}),h(K,{kind:"ghost",icon:ur,tooltip:"Sort ascending",onClick:()=>{this.handleSortColumns(Qe.SORTING_OPTIONS.ASC)}}),h(K,{kind:"ghost",icon:hr,tooltip:"Sort descending",onClick:()=>{this.handleSortColumns(Qe.SORTING_OPTIONS.DSC)}}),h("span",{className:"vertical-divider"}),R(K,{kind:"ghost",tooltip:"Create group from selection",disabled:!o,onClick:this.handleGroupCreate,children:[R("span",{className:"fa-layers",style:{marginRight:"0.75rem"},children:[h(Q,{mask:lu,icon:ro,transform:"right-7 down-5 shrink-6"}),h(Q,{icon:Od,transform:"right-8 down-6 shrink-8"})]}),"Group"]}),h("span",{className:"vertical-divider"}),h(K,{kind:"ghost",icon:Hd,tooltip:"Move selection up",onClick:()=>{this.handleMoveColumns(Qe.MOVE_OPTIONS.UP)},disabled:!o}),h(K,{kind:"ghost",icon:Ld,tooltip:"Move selection down",onClick:()=>{this.handleMoveColumns(Qe.MOVE_OPTIONS.DOWN)},disabled:!o}),h(K,{kind:"ghost",icon:du,tooltip:"Move selection to top",onClick:()=>{this.handleMoveColumns(Qe.MOVE_OPTIONS.TOP)},disabled:!o}),h(K,{kind:"ghost",icon:cu,tooltip:"Move selection to bottom",onClick:()=>{this.handleMoveColumns(Qe.MOVE_OPTIONS.BOTTOM)},disabled:!o})]}),h("div",{role:"menu",className:G("visibility-ordering-list"),children:h("div",{className:"column-list",ref:p=>{this.list=p},children:m})})]})}};let kr=Qe;kr.SORTING_OPTIONS={DSC:"DSC",ASC:"ASC"};kr.MOVE_OPTIONS={TOP:"TOP",BOTTOM:"BOTTOM",UP:"UP",DOWN:"DOWN"};class Vi extends T.exports.PureComponent{constructor(t){super(t),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=J.createRef(),this.state={isConfigureColumnsShown:!1}}static createSearchFilter(t,n,s,i){const o=i?s.filter(r=>!n.includes(r.name)).map(r=>r.name):n;if(t&&o.length>0){const r=I.FilterValue.ofString(t);return o.length===s.length?I.FilterCondition.search(r):I.FilterCondition.search(r,s.filter(a=>o.includes(a.name)).map(a=>a.filter()))}}focus(){var t;(t=this.searchField.current)==null||t.focus()}handleSearchValueChange(t){const{onChange:n,selectedColumns:s,invertSelection:i}=this.props;n(t.target.value,s,i)}sendColumnChange(t,n){const{onChange:s,value:i}=this.props;s(i,t,n)}setInvertSelection(t){const{onChange:n,value:s}=this.props;n(s,[],t)}toggleColumn(t){const{selectedColumns:n,invertSelection:s}=this.props;if(n.includes(t))this.sendColumnChange(n.filter(i=>i!==t),s);else{const i=n.slice();i.push(t),this.sendColumnChange(i,s)}}selectAll(){this.setInvertSelection(!0)}clear(){this.setInvertSelection(!1)}selectNumbers(){const{columns:t}=this.props;this.sendColumnChange(t.filter(n=>A.isNumberType(n.type)).map(n=>n.name),!1)}render(){const{value:t,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=R(Fe,{children:[h(Q,{icon:Xi,mask:Oo,transform:"shrink-2 down-5 right-7"}),h(Q,{icon:uu,className:"text-primary",transform:"shrink-4 down-5 right-7"})]}):l?a=R(Fe,{children:[h(Q,{icon:ro,mask:Oo,transform:"shrink-1 down-5 right-7"}),h(Q,{icon:nl,className:"text-danger",transform:"shrink-4 down-5 right-7"})]}):a=R(Fe,{children:[h(Q,{icon:Xi,mask:Oo,transform:"shrink-2 down-5 right-7"}),h(Q,{icon:vu,className:"text-primary",transform:"shrink-4 down-5 right-7"})]}),R("div",{className:"cross-column-container",children:[h(Qn,{className:"cross-column-search",placeholder:"Search Data...",value:t,onChange:this.handleSearchValueChange,ref:this.searchField}),R("button",{type:"button",className:"btn btn-link btn-link-icon px-2",onClick:()=>{o?this.setState({isConfigureColumnsShown:!1}):this.setState({isConfigureColumnsShown:!0})},children:[h("div",{className:"fa-layers",children:a}),h(Be,{children:"Configure Columns"}),h(vn,{isShown:o,className:"cross-column-popper",onExited:()=>{this.setState({isConfigureColumnsShown:!1})},closeOnBlur:!0,interactive:!0,children:R("div",{className:"cross-column-popup",children:["Searched Columns",h("div",{className:"cross-column-scroll",children:i.map(c=>R(J.Fragment,{children:[h(at,{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))}),R("div",{className:"cross-column-button-bar",children:[h("button",{type:"button",className:"btn btn-link",onClick:this.selectAll,children:"Select All"}),h("button",{type:"button",className:"btn btn-link",onClick:this.clear,children:"Clear"}),h("button",{type:"button",className:"btn btn-link",onClick:this.selectNumbers,children:"Numbers Only"})]}),l&&R("p",{className:"text-danger",children:[h(Q,{icon:nl})," Select at least one column to search."]})]})})]})]})}}const xn=ne.module("PartitionSelectorSearch"),Wp=150,Ja=class extends T.exports.Component{constructor(e){super(e),this.debounceUpdateFilter=Et(()=>{this.updateFilter()},Wp),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(e){e instanceof As||xn.error(e)}componentDidMount(){this.startListening()}componentDidUpdate(e,t){const{isLoading:n,itemCount:s}=this.state,{onListResized:i}=this.props;(s!==t.itemCount||n!==t.isLoading)&&i()}componentWillUnmount(){this.debounceUpdateFilter.cancel(),this.stopListening()}handleKeyDown(e){if(this.itemList==null)return!1;const{items:t,itemCount:n}=this.state;switch(e.key){case"Enter":{let s=null;if(t.length>0)s=t[0].value;else{const{text:i}=this.state;s=i.trim()}if(s.length>0){const{onSelect:i}=this.props;i(s)}return e.stopPropagation(),e.preventDefault(),!0}case"ArrowDown":return n>0&&this.itemList.focusItem(1),e.stopPropagation(),e.preventDefault(),!0;default:return!1}}handleListKeydown(e){switch(e.key){case"Escape":break;default:this.focus();break}}handleFilterChange(){xn.debug2("handleFilterChange");const{table:e}=this.props,t=e.size;this.setState({itemCount:t,isLoading:!0})}handleInputFocus(){this.itemList&&this.itemList.focusItem(0)}handleSelect(e){xn.debug2("handleSelect",e);const{onSelect:t}=this.props,{offset:n,items:s}=this.state,i=e-n;if(i<0||s.length<=i){xn.error("No data for item",e);return}const{value:o}=s[i];t(o)}handleTableUpdate(e){const t=e.detail,{offset:n}=t,s=[],{getFormattedString:i,table:o}=this.props,r=o.columns[0];for(let a=0;a<t.rows.length;a+=1){const d=t.rows[a].get(r),u=i(d,r.type,r.name);s.push({displayValue:u,value:d})}const l=o.size;xn.debug2("handleTableUpdate",l,n,s.length),this.setState({itemCount:l,items:s,offset:n,isLoading:!1})}handleTextChange(e){xn.debug2("handleTextChange");const{value:t}=e.target;this.setState({text:t}),this.debounceUpdateFilter()}handleViewportChange(e,t){xn.debug2("handleViewportChange",e,t);const n=Math.max(1,t-e),s=Math.max(0,e-n),i=t+n,{table:o}=this.props;o.setViewport(s,i)}focus(){this.searchInput&&this.searchInput.focus()}startListening(){const{initialPageSize:e,table:t}=this.props;t.addEventListener(I.Table.EVENT_UPDATED,this.handleTableUpdate),t.addEventListener(I.Table.EVENT_FILTERCHANGED,this.handleFilterChange),t.setViewport(0,e)}stopListening(){const{table:e}=this.props;e.removeEventListener(I.Table.EVENT_UPDATED,this.handleTableUpdate),e.removeEventListener(I.Table.EVENT_FILTERCHANGED,this.handleFilterChange)}updateFilter(){const{initialPageSize:e,table:t}=this.props,{text:n}=this.state,s=n.trim(),i=[];if(s.length>0){const r=t.columns[0].filter().invoke("matches",I.FilterValue.ofString(`(?s)(?i).*\\Q${s}\\E.*`));i.push(r)}xn.debug2("updateFilter",i),t.applyFilter(i),t.setViewport(0,e)}render(){const{isLoading:e,itemCount:t,items:n,offset:s,text:i}=this.state,o=Math.min(t,Ja.MAX_VISIBLE_ITEMS)*nn.DEFAULT_ROW_HEIGHT+11;return R("div",{className:"iris-grid-partition-selector-search",children:[h("div",{className:"search-container",children:h("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"})}),!e&&t>0&&h("div",{className:"iris-grid-partition-selector-search-list",onKeyDown:this.handleListKeydown,role:"presentation",style:{height:o},children:h(nn,{ref:r=>{this.itemList=r},itemCount:t,items:n,offset:s,onSelect:this.handleSelect,onViewportChange:this.handleViewportChange})}),!e&&t===0&&h("div",{className:"iris-grid-partition-selector-search-empty",children:"No results"}),e&&R("div",{className:"iris-grid-partition-selector-loading",children:[h(Ht,{}),"\xA0Loading..."]})]})}};let bo=Ja;bo.MAX_VISIBLE_ITEMS=12;bo.defaultProps={initialPageSize:100,onSelect:()=>{},onListResized:()=>{}};bo.propTypes={getFormattedString:D.exports.func.isRequired,table:D.exports.shape({addEventListener:D.exports.func.isRequired,removeEventListener:D.exports.func.isRequired,columns:D.exports.arrayOf(D.exports.shape({name:D.exports.string.isRequired,type:D.exports.string.isRequired,filter:D.exports.func.isRequired})),size:D.exports.number.isRequired,applyFilter:D.exports.func.isRequired,setViewport:D.exports.func.isRequired}).isRequired,initialPageSize:D.exports.number,onSelect:D.exports.func,onListResized:D.exports.func};const ys=ne.module("IrisGridPartitionSelector"),$p=250;class ec extends T.exports.Component{constructor(t){super(t),this.debounceUpdate=Et(()=>{this.sendUpdate()},$p),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}=t;this.state={partition:n}}componentWillUnmount(){this.debounceUpdate.cancel()}handleAppendClick(){ys.debug2("handleAppendClick");const{onAppend:t}=this.props,{partition:n}=this.state;t(n)}handleCloseClick(){ys.debug2("handleCloseClick"),this.sendDone()}handleIgnoreClick(){ys.debug2("handleIgnoreClick"),this.sendFetchAll()}handlePartitionChange(t){ys.debug2("handlePartitionChange");const{value:n}=t.target;this.setState({partition:n}),this.debounceUpdate()}handlePartitionSelect(t){this.searchMenu&&this.searchMenu.closeMenu(),this.setState({partition:t},()=>{this.sendUpdate()})}handlePartitionListResized(){this.searchMenu&&this.searchMenu.scheduleUpdate()}handleSearchClosed(){const{table:t}=this.props;t.applyFilter([])}handleSearchOpened(){this.selectorSearch&&this.selectorSearch.focus()}sendDone(){this.debounceUpdate.flush();const{onDone:t}=this.props;t()}sendUpdate(){ys.debug2("sendUpdate");const{onChange:t}=this.props,{partition:n}=this.state;t(n)}sendFetchAll(){ys.debug2("sendFetchAll"),this.debounceUpdate.cancel();const{onFetchAll:t}=this.props;t()}render(){const{columnName:t,getFormattedString:n,onDone:s,table:i}=this.props,{partition:o}=this.state,r=h(bo,{getFormattedString:n,table:i,onSelect:this.handlePartitionSelect,onListResized:this.handlePartitionListResized,ref:l=>{this.selectorSearch=l}},"search");return R("div",{className:"iris-grid-partition-selector",children:[h("div",{className:"status-message",children:R("span",{children:['Filtering "',t,'" partition to']})}),R("div",{className:"input-group",children:[h("input",{type:"text",value:o,onChange:this.handlePartitionChange,className:"form-control input-partition"}),h("div",{className:"input-group-append",children:R("button",{type:"button",className:"btn btn-outline-primary",children:[h(Q,{icon:Bn}),h(Be,{children:"Partitions"}),h(qn,{ref:l=>{this.searchMenu=l},actions:[{menuElement:r}],onMenuOpened:this.handleSearchOpened,onMenuClosed:this.handleSearchClosed})]})})]}),h("div",{className:"iris-grid-partition-selector-spacer"}),h("button",{type:"button",className:"btn btn-outline-primary btn-ignore",onClick:this.handleIgnoreClick,children:"Ignore & Fetch All"}),h("button",{type:"button",className:"btn btn-outline-primary btn-append",onClick:this.handleAppendClick,children:"Append Command"}),h("button",{type:"button",className:"btn btn-link btn-link-icon btn-close",onClick:s,children:h(Q,{icon:di})})]})}}ec.defaultProps={onAppend:()=>{},onChange:()=>{},onFetchAll:()=>{},onDone:()=>{},partition:""};const qp=ne.module("SelectDistinctBuilder");class tc extends T.exports.Component{constructor(t){super(t),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(t,n){const{inputs:s}=this.state,{onChange:i}=this.props;if(n.inputs!==s){const o=s.filter(r=>r!=="");ht(n.inputs.filter(r=>r!==""),o)||i(o)}}handleAddColumnClick(){this.setState(({inputs:t})=>({inputs:[...t,""]}))}handleDeleteColumn(t){this.setState(({inputs:n})=>({inputs:n.length===1&&t===0?[""]:n.filter((s,i)=>t!==i)}))}handleDropdownChanged(t,n){qp.debug("handleDropdownChanged",t,n);const{value:s}=n.target;this.setState(({inputs:i})=>{const o=[...i];return o[t]=s,{inputs:o}})}renderInputs(){const{columns:t,inputs:n}=this.state;return n.map((s,i)=>{const o=t.filter(({name:r})=>r===s||!n.includes(r)).map(({name:r})=>h("option",{value:r,children:r},r));return R("div",{className:"form-inline px-3 pb-3",children:[R("select",{className:"form-control custom-select col",value:s,onChange:r=>this.handleDropdownChanged(i,r),children:[h("option",{value:"",children:"Select a column"}),o]}),(n.length>1||s!=="")&&h(K,{kind:"ghost",className:"ml-1 px-2",onClick:()=>{this.handleDeleteColumn(i)},icon:h(Q,{icon:Tn,transform:"grow-3"}),tooltip:"Delete column"})]},i)})}render(){const{columns:t,inputs:n}=this.state,s=n.length>=t.length;return R("div",{role:"presentation",className:"select-distinct-builder-container h-100",children:[h("div",{className:"select-distinct-title",children:"Display Unique Values From"}),this.renderInputs(),h("hr",{}),h("div",{className:"pt-1 px-3",children:h(K,{kind:"ghost",className:"btn-add-column",onClick:this.handleAddColumnClick,disabled:s,icon:Hs,children:"Add Additional Column"})}),h("div",{className:"select-distinct-builder-footer",children:R("div",{className:"select-distinct-builder-hint",children:["Modifies a table to show unique value from a column, same as"," ",h("span",{className:"inline-code-snippet",children:'selectDistinct("Column")'}),". Filters will be reset and the resulting table will contain only the selected columns above."]})})]})}}tc.defaultProps={selectDistinctColumns:[],onChange:()=>{}};function Lr({items:e,onChange:t=()=>{}}){return h(ya,{items:Array.from(e.entries()).map(([n,s])=>({title:Lr.getAdvancedSettingsTitleForKey(n),isOn:s,onChange:i=>t(n,i)}))})}Lr.getAdvancedSettingsTitleForKey=e=>{switch(e){case hs.FILTER_CONTROL_CHANGE_CLEARS_ALL_FILTERS:return"Control filters clear existing table filters";case hs.LINK_CHANGE_CLEARS_ALL_FILTERS:return"Inbound links clear existing table filters"}};const Dl=ne.module("ConditionalFormattingMenu"),Vo=()=>{};function Kp(e){const{column:{type:t}}=e;if(A.isNumberType(t))return e.condition===De.IS_NULL||e.condition===De.IS_NOT_NULL?"":`${e.value}`;if(A.isCharType(t))return e.condition===rt.IS_NULL||e.condition===rt.IS_NOT_NULL?"":`${e.value}`;if(A.isStringType(t))return e.condition===bt.IS_NULL||e.condition===bt.IS_NOT_NULL?"":`"${e.value}"`;if(A.isDateType(t))return e.condition===rt.IS_NULL||e.condition===rt.IS_NOT_NULL?"":`${e.value}`;if(A.isBooleanType(t))return"";throw new Error(`Invalid column type ${t} in getRuleValue`)}function Xp(e){return A.isNumberType(e.column.type)&&e.condition===De.IS_BETWEEN?`${e.start} < ${e.column.name} < ${e.end}`:`${e.column.name} ${Im(e.column.type,e.condition)}
|
|
14
|
+
${Kp(e)}`}function Yp(e){const{rules:t=[],onChange:n=Vo,onCreate:s=Vo,onSelect:i=Vo}=e,o=T.exports.useCallback((c,d,u)=>{c.stopPropagation(),Dl.debug("Rule clicked",d,u),i(u)},[i]),r=T.exports.useCallback((c,d,u)=>{c.stopPropagation(),Dl.debug("Delete button clicked",d,u);const m=[...t];m.splice(u,1),n(m)},[n,t]),l=T.exports.useCallback(c=>{c.stopPropagation()},[]),a=T.exports.useCallback(c=>{if(mt.stopDragging(),c.destination==null)return;const d=c.source.index,u=c.destination.index,m=[...t],p=t[d];m.splice(d,1),m.splice(u,0,p),n(m)},[n,t]);return R("div",{className:"conditional-formatting-rules",children:[h(oo,{onDragStart:mt.startDragging,onDragEnd:a,children:h(io,{droppableId:"droppable-custom-columns",children:(c,d)=>R("div",{ref:c.innerRef,...c.droppableProps,className:G("droppable-container",{dragging:d.draggingFromThisWith}),children:[t.length===0&&h("div",{className:"text-muted pl-2",children:"No formats defined"}),t.map((u,m)=>h(sr,{draggableId:`${m}-${u.type}`,index:m,disableInteractiveElementBlocking:!0,children:(p,g)=>h("div",{role:"menuitem",tabIndex:0,onClick:f=>o(f,u,m),className:G("draggable-container",{dragging:g.isDragging}),ref:p.innerRef,...p.draggableProps,children:h("div",{className:"conditional-formatting-list-item",children:R("div",{className:"formatting-item",children:[h("div",{className:"rule-icon",children:h("span",{className:"rule-icon-bg",style:{backgroundColor:Qi(u.config.style),color:ji(u.config.style)},children:u.type===sn.ROWS?"row":"col"})}),h("div",{className:"rule-title",children:Xp(u.config)}),h(K,{kind:"ghost",className:"ml-1 px-2",onClick:f=>r(f,u,m),icon:Tn,tooltip:"Delete rule"}),R("button",{type:"button",className:"btn btn-link btn-link-icon px-2 btn-drag-handle",onClick:l,...p.dragHandleProps,children:[h(Be,{children:"Drag to re-order"}),h(Q,{icon:lo})]})]})})})},`${m}-${u.type}`)),c.placeholder]})})}),h("hr",{}),h(K,{kind:"ghost",onClick:s,icon:Hs,children:"Add New Rule"})]})}const Rs=ne.module("ConditionEditor"),Qp=()=>{},jp=[De.IS_EQUAL,De.IS_NOT_EQUAL,De.IS_BETWEEN,De.GREATER_THAN,De.GREATER_THAN_OR_EQUAL,De.LESS_THAN,De.LESS_THAN_OR_EQUAL,De.IS_NULL,De.IS_NOT_NULL].map(e=>h("option",{value:e,children:dm(e)},e)),Zp=[bt.IS_EXACTLY,bt.IS_NOT_EXACTLY,bt.CONTAINS,bt.DOES_NOT_CONTAIN,bt.STARTS_WITH,bt.ENDS_WITH,bt.IS_NULL,bt.IS_NOT_NULL].map(e=>h("option",{value:e,children:um(e)},e)),Jp=[rt.IS_EXACTLY,rt.IS_NOT_EXACTLY,rt.IS_BEFORE,rt.IS_BEFORE_OR_EQUAL,rt.IS_AFTER,rt.IS_AFTER_OR_EQUAL,rt.IS_NULL,rt.IS_NOT_NULL].map(e=>h("option",{value:e,children:hm(e)},e)),eg=[ii.IS_TRUE,ii.IS_FALSE,ii.IS_NULL,ii.IS_NOT_NULL].map(e=>h("option",{value:e,children:mm(e)},e)),tg=[cs.IS_EQUAL,cs.IS_NOT_EQUAL,cs.IS_NULL,cs.IS_NOT_NULL].map(e=>h("option",{value:e,children:pm(e)},e));function ng(e,t,n,s){return e===De.IS_NULL||e===De.IS_NOT_NULL||e===De.IS_BETWEEN&&n!=null&&n!==""&&!Number.isNaN(Number.parseFloat(n))&&s!=null&&s!==""&&!Number.isNaN(Number.parseFloat(s))||e!==De.IS_BETWEEN&&t!==void 0&&t!==""&&!Number.isNaN(Number.parseFloat(t))}function sg(e,t,n,s,i,o,r){switch(e){case De.IS_EQUAL:case De.IS_NOT_EQUAL:case De.GREATER_THAN:case De.GREATER_THAN_OR_EQUAL:case De.LESS_THAN:case De.LESS_THAN_OR_EQUAL:return h("input",{type:"number",className:"form-control",placeholder:"Enter value",value:i!=null?i:"",onChange:t});case De.IS_BETWEEN:return R("div",{className:"d-flex flex-row",children:[h("input",{type:"number",className:"form-control d-flex mr-2",placeholder:"Start value",value:o!=null?o:"",onChange:n}),h("input",{type:"number",className:"form-control d-flex",placeholder:"End value",value:r!=null?r:"",onChange:s})]});case De.IS_NULL:case De.IS_NOT_NULL:return null}}function ig(e,t,n){switch(e){case bt.IS_NULL:case bt.IS_NOT_NULL:return null;default:return h("input",{type:"text",className:"form-control",placeholder:"Enter value",value:n!=null?n:"",onChange:t})}}function og(e,t,n){switch(e){case rt.IS_NULL:case rt.IS_NOT_NULL:return null;default:return h("input",{type:"text",className:"form-control",placeholder:"Enter value",value:n!=null?n:"",onChange:t})}}function rg(){return null}function lg(e,t,n){switch(e){case cs.IS_NULL:case cs.IS_NOT_NULL:return null;default:return h("input",{type:"text",className:"form-control",maxLength:1,placeholder:"Enter value",value:n!=null?n:"",onChange:t})}}function nc(e){const{column:t,config:n,onChange:s=Qp}=e,i=t.type,[o,r]=T.exports.useState(i),[l,a]=T.exports.useState(n.condition),[c,d]=T.exports.useState(n.value),[u,m]=T.exports.useState(n.start),[p,g]=T.exports.useState(n.end);i!==o&&(a(Oa(i)),d(void 0),m(void 0),g(void 0),r(i));const f=T.exports.useMemo(()=>{if(i===void 0)return[];if(A.isNumberType(i))return jp;if(A.isCharType(i))return tg;if(A.isStringType(i))return Zp;if(A.isDateType(i))return Jp;if(A.isBooleanType(i))return eg},[i]),C=T.exports.useCallback(v=>{const{value:y}=v.target;Rs.debug("handleConditionChange",y),a(y)},[]),w=T.exports.useCallback(v=>{const{value:y}=v.target;Rs.debug("handleValueChange",y),d(y)},[]),b=T.exports.useCallback(v=>{const{value:y}=v.target;Rs.debug("handleStartValueChange",y),m(y)},[]),S=T.exports.useCallback(v=>{const{value:y}=v.target;Rs.debug("handleEndValueChange",y),g(y)},[]);T.exports.useEffect(function(){let y=!0;l===void 0&&(Rs.debug("Unable to create formatting rule. Condition is not selected."),y=!1),A.isNumberType(t.type)&&!ng(l,c,u,p)&&(Rs.debug("Unable to create formatting rule. Invalid value",c),y=!1),s({condition:l,value:c,start:u,end:p},y)},[s,t.type,l,c,u,p]);const E=T.exports.useMemo(()=>{if(i===void 0)return null;if(A.isNumberType(i))return sg(l,w,b,S,c,u,p);if(A.isCharType(i))return lg(l,w,c);if(A.isStringType(i))return ig(l,w,c);if(A.isDateType(i))return og(l,w,c);if(A.isBooleanType(i))return rg()},[i,l,c,u,p,w,b,S]);return R("div",{className:"condition-editor mb-2",children:[h("select",{value:l,id:"condition-select",className:"custom-select mb-2",onChange:C,children:f}),E]})}const ag=ne.module("StyleEditor"),cg="#fcfcfa",dg="#f0f0ee",ug="#1a171a",hg=200,mg=()=>{};function sc(e){var S,E;const{config:t,onChange:n=mg}=e,[s,i]=T.exports.useState(t.type),[o,r]=T.exports.useState((E=(S=t.customConfig)==null?void 0:S.background)!=null?E:cg),[l,a]=T.exports.useState(!1),[c,d]=T.exports.useState(hg),u=T.exports.useRef(null),m=T.exports.useCallback(v=>{const{value:y}=v.target;ag.debug("handleBackgroundChange",y),r(y)},[]),p=T.exports.useCallback(()=>{l&&a(!1)},[l]),g=T.exports.useCallback(()=>{l||C(),a(!l)},[l]),f=T.exports.useMemo(()=>[$t.NO_FORMATTING,$t.POSITIVE,$t.NEGATIVE,$t.WARN,$t.NEUTRAL,$t.ACCENT_1,$t.ACCENT_2,$t.CUSTOM],[]);function C(){u.current&&d(u.current.getBoundingClientRect().width)}T.exports.useEffect(function(){n({type:s,customConfig:{color:co.isDark(o)?dg:ug,background:o}})},[n,s,o]);const w=T.exports.useCallback(()=>{const v=[];for(let y=0;y<f.length;y+=1){const M=f[y],F=`option-${y}-${M}`;v.push(R(K,{kind:"inline",className:"style-option-btn",onClick:()=>{i(M),a(!1)},style:{color:ji({type:M}),background:Qi({type:M})},children:[M===s&&h(Q,{icon:Wn,className:"mr-2"}),M!==s&&h("span",{className:"mr-4"}),vl(M)]},F))}return v},[f,s]),b=T.exports.useCallback(()=>h("div",{className:"style-menu-container",role:"presentation",style:{width:c},children:h("div",{className:"style-options",children:w()})}),[c,w]);return R("div",{className:"style-editor",children:[R("div",{className:"mb-2",ref:u,children:[h("label",{className:"mb-0",children:"Style"}),R(K,{kind:"inline",className:"cs-dropdown",style:{color:ji({type:s}),background:Qi({type:s})},onClick:g,children:[vl(s),h("span",{children:h(Q,{icon:mr,className:"cs-caret"})}),h(qn,{isShown:l,actions:{menuElement:b()},popperOptions:{placement:"bottom-start"},popperClassName:"style-dropdown-menu",onMenuClosed:p,menuStyle:{maxWidth:"100rem"}})]})]}),s===$t.CUSTOM&&R("div",{className:"mb-2",children:[h("label",{className:"mb-0",children:"Background"}),h("input",{type:"color",value:o,className:"custom-select color-select",onChange:m})]})]})}const ti=ne.module("ColumnFormatEditor"),pg=()=>{};function gg(e){const{type:t,name:n}=e[0];return{column:{type:t,name:n},style:La(),...go(t)}}function fg(e){var C;const{columns:t,config:n=gg(t),onChange:s=pg}=e,[i,o]=T.exports.useState((C=t.find(w=>w.name===n.column.name&&w.type===n.column.type))!=null?C:t[0]),[r,l]=T.exports.useState(ka(n)),[a,c]=T.exports.useState(!1),[d,u]=T.exports.useState(n.style),m=T.exports.useCallback(w=>{const b=t.find(({name:S})=>S===w);b!==void 0?(o(b),i.type!==b.type&&(l(go(b.type)),c(!1))):ti.error(`Column ${w} not found.`)},[t,i]),p=T.exports.useCallback((w,b)=>{ti.debug("handleConditionChange",w,b),l(w),c(b)},[]),g=T.exports.useCallback(w=>{ti.debug("handleStyleChange",w),u(w)},[]);T.exports.useEffect(function(){if(i===void 0){ti.debug("Column is not selected, skip update.");return}if(d===void 0){ti.debug("Style is not selected, skip update.");return}const{type:b,name:S}=i;s({column:{type:b,name:S},style:d,...r},a)},[s,i,d,r,a]);const f=t.map(({name:w})=>({title:w,value:w}));return R("div",{className:"conditional-rule-editor form",children:[R("div",{className:"mb-2",children:[h("label",{className:"mb-0",children:"Format Cell If"}),h(Vs,{defaultValue:i==null?void 0:i.name,options:f,inputPlaceholder:"Select a column",spellCheck:!1,onChange:m,searchPlaceholder:"Filter columns"})]}),i!==void 0&&R(Fe,{children:[h(nc,{column:i,config:r,onChange:p}),h(sc,{config:d,onChange:g})]})]})}const ni=ne.module("RowFormatEditor"),Cg=()=>{};function wg(e){const{type:t,name:n}=e[0];return{column:{type:t,name:n},style:La(),...go(t)}}function bg(e){var C;const{columns:t,config:n=wg(t),onChange:s=Cg}=e,[i,o]=T.exports.useState((C=t.find(w=>w.name===n.column.name&&w.type===n.column.type))!=null?C:t[0]),[r,l]=T.exports.useState(ka(n)),[a,c]=T.exports.useState(!1),[d,u]=T.exports.useState(n.style),m=T.exports.useCallback(w=>{const b=t.find(({name:S})=>S===w);b!==void 0?(o(b),i.type!==b.type&&(l(go(b.type)),c(!1))):ni.error(`Column ${w} not found.`)},[t,i]),p=T.exports.useCallback((w,b)=>{ni.debug("handleConditionChange",w,b),l(w),c(b)},[]),g=T.exports.useCallback(w=>{ni.debug("handleStyleChange",w),u(w)},[]);T.exports.useEffect(function(){if(i===void 0){ni.debug("Column is not selected, skip update.");return}if(d===void 0){ni.debug("Style is not selected, skip update.");return}const{type:b,name:S}=i;s({column:{type:b,name:S},style:d,...r},a)},[s,i,d,r,a]);const f=t.map(({name:w})=>({title:w,value:w}));return R("div",{className:"conditional-rule-editor form",children:[R("div",{className:"mb-2",children:[h("label",{className:"mb-0",children:"Format Row If"}),h(Vs,{defaultValue:i==null?void 0:i.name,options:f,inputPlaceholder:"Select a column",spellCheck:!1,onChange:m,searchPlaceholder:"Filter columns"})]}),i!==void 0&&R(Fe,{children:[h(nc,{column:i,config:r,onChange:p}),h(sc,{config:d,onChange:g})]})]})}const Uo=ne.module("ConditionalFormatEditor"),Bo=()=>{};function Sg(e){switch(e){case sn.CONDITIONAL:return h(pp,{});case sn.ROWS:return h(gp,{})}}function vg(e){switch(e){case sn.CONDITIONAL:return"Conditional";case sn.ROWS:return"Rows"}}const Nl=[sn.CONDITIONAL,sn.ROWS];function Tg(e){var w;const{columns:t,onSave:n=Bo,onUpdate:s=Bo,onCancel:i=Bo,rule:o}=e,r=t.filter(Dm),[l,a]=T.exports.useState((w=o==null?void 0:o.type)!=null?w:Nl[0]),[c,d]=T.exports.useState(o),[u,m]=T.exports.useState(!1),p=T.exports.useCallback(()=>{i()},[i]),g=T.exports.useCallback(()=>{if(c===void 0){Uo.error("Rule is not defined.");return}n(c)},[n,c]),f=T.exports.useCallback(b=>{Uo.debug("handleFormatterChange",b),a(b)},[]),C=T.exports.useCallback((b,S)=>{Uo.debug("handleRuleChange",b,S,l);const E={type:l,config:b};d(E),m(S),s(S?E:void 0)},[s,l]);return R("div",{className:"conditional-format-editor form",children:[R("div",{className:"mb-2",children:[h("label",{className:"mb-0",htmlFor:"formatter-select",children:"Select Formatter"}),h("div",{className:"formatter-list",children:Nl.map((b,S)=>h("div",{className:"formatter-type",children:R("button",{type:"button",className:G("btn","btn-icon","btn-formatter-type",{active:b===l}),"data-index":S,onClick:()=>f(b),children:[Sg(b),vg(b)]})},b))})]}),l===sn.CONDITIONAL&&h(fg,{columns:r,config:c==null?void 0:c.config,onChange:C}),l===sn.ROWS&&h(bg,{columns:r,config:c==null?void 0:c.config,onChange:C}),h("hr",{}),R("div",{className:"d-flex justify-content-end my-3",children:[h(K,{kind:"secondary",onClick:p,className:"mr-2",children:"Cancel"}),h(K,{kind:"primary",onClick:g,disabled:c===void 0||!u,children:"Done"})]})]})}function Eg({type:e}){switch(e){case I.VariableType.TABLE:case I.VariableType.TABLEMAP:case I.VariableType.TREETABLE:return h(Q,{icon:pr});case I.VariableType.FIGURE:return h(Q,{icon:Zl});case I.VariableType.PANDAS:return h(Q,{icon:bu});default:return h(Q,{icon:tu})}}class ic extends T.exports.Component{constructor(t){super(t),this.container=null}componentDidMount(){this.colorize()}colorize(){const{children:t}=this.props;this.container&&t!=null&&bn.colorizeElement(this.container,{theme:"dh-dark"})}render(){const{children:t,language:n}=this.props;return h("div",{children:h("div",{"data-lang":n,ref:s=>{this.container=s},style:{pointerEvents:"none"},children:t})})}}class yg{static get LANGUAGE_MAP(){return new Map([["python","Python"],["groovy","Groovy"],["scala","Scala"]])}}class Ps{static hasComment(t){return t.comment!==void 0}static hasPattern(t){return t.pattern!==void 0}static hasOp(t){return t.op!==void 0}static parseArguments(t){return t==null||!(typeof t=="string"||t instanceof String)?[]:$c.parse(t).filter(n=>!this.hasComment(n)).map(n=>this.hasPattern(n)?n.pattern:this.hasOp(n)?n.op:`${n}`)}static formatTimestamp(t){if(t==null||!(t instanceof Date))return null;const n=`${t.getHours()}`.padStart(2,"0"),s=`${t.getMinutes()}`.padStart(2,"0"),i=`${t.getSeconds()}`.padStart(2,"0"),o=`${t.getMilliseconds()}`.padStart(3,"0");return`${n}:${s}:${i}.${o}`}static isTableType(t){return t===I.VariableType.TABLE||t===I.VariableType.TREETABLE}static isWidgetType(t){return t===I.VariableType.FIGURE||t===I.VariableType.OTHERWIDGET||t===I.VariableType.PANDAS}static isOpenableType(t){return Ps.isTableType(t)||Ps.isWidgetType(t)}static isFigureType(t){return t===I.VariableType.FIGURE}static isPandas(t){return t===I.VariableType.PANDAS}}function oc({children:e}){return R("div",{className:"console-history-item-result",children:[h("div",{className:"console-history-gutter",children:"-"}),h("div",{className:"console-history-content",children:e})]})}oc.propTypes={children:D.exports.node.isRequired};class rc extends T.exports.Component{constructor(t){super(t),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:t,onCancelClick:n}=this.props,{elapsed:s}=this.state;return h("div",{className:G("console-history-result-in-progress",{disabled:t}),children:R("span",{className:"badge",children:[h(Ht,{}),"\xA0Running... ",Jt.formatElapsedTime(s),"\xA0",h(K,{className:"console-history-result-in-progress-cancel",kind:"ghost",icon:di,tooltip:"Cancel",onClick:n,disabled:t})]})})}}rc.defaultProps={disabled:!1};const er=class extends T.exports.PureComponent{constructor(e){super(e),this.handleKeyPress=this.handleKeyPress.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.handleToggleError=this.handleToggleError.bind(this),this.handleMouseEnter=this.handleMouseEnter.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.mouseX=null,this.mouseY=null,this.isClicking=!1,this.state={isExpanded:!1,isTriggerHovered:!1}}handleKeyPress(e){switch(e.key){case"Enter":case" ":this.handleToggleError(),e.stopPropagation(),e.preventDefault();break}}handleMouseDown(e){this.mouseX=e.clientX,this.mouseY=e.clientY,this.isClicking=!0}handleMouseMove(e){this.mouseX!=null&&this.mouseY!=null?(Math.abs(e.clientX-this.mouseX)>=er.mouseDragThreshold||Math.abs(e.clientY-this.mouseY)>=er.mouseDragThreshold)&&(this.isClicking=!1):this.isClicking&&(this.isClicking=!1)}handleMouseUp(e){this.isClicking&&!e.shiftKey&&!e.metaKey&&!e.altKey&&this.handleToggleError(),this.mouseX=null,this.mouseY=null,this.isClicking=!1}handleToggleError(){this.setState(e=>({isExpanded:!e.isExpanded}))}handleMouseEnter(){this.setState({isTriggerHovered:!0})}handleMouseLeave(){this.setState({isTriggerHovered:!1})}render(){const{isExpanded:e,isTriggerHovered:t}=this.state,{message:n}=this.props;O(n);const s=n.indexOf(`
|
|
15
|
+
`),i=s>-1;let o=n;i&&(o=n.slice(0,s));const r=n.slice(s),l=t?"error-btn-link error-btn-link--active":"error-btn-link";return R("div",{className:G("error-message",{expanded:e}),children:[i&&R(Fe,{children:[h("div",{className:"error-gutter",children:h("button",{type:"button",onClick:this.handleToggleError,className:l,tabIndex:-1,children:h(Q,{icon:e?Bn:sa,transform:"left-3"})})}),R("div",{className:"error-content",children:[h("div",{className:"console-error-text-trigger",role:"button",tabIndex:0,onKeyPress:this.handleKeyPress,onMouseDown:this.handleMouseDown,onMouseMove:this.handleMouseMove,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,onMouseUp:this.handleMouseUp,children:o}),e?r:""]})]}),!i&&h("div",{className:"error-content",children:h("div",{className:"console-error-text",children:o})})]},"error")}};let Pr=er;Pr.defaultProps={message:""};Pr.mouseDragThreshold=5;const Fl=ne.module("ConsoleHistoryItem");class lc extends T.exports.PureComponent{constructor(t){super(t),this.handleCancelClick=this.handleCancelClick.bind(this),this.handleObjectClick=this.handleObjectClick.bind(this)}handleObjectClick(t){Fl.debug("handleObjectClick",t);const{openObject:n}=this.props;n(t)}handleCancelClick(){const{item:t}=this.props;t!=null&&t.cancelResult&&(Fl.debug(`Cancelling command: ${t.command}`),t.cancelResult())}render(){var d;const{disabled:t,item:n,language:s}=this.props,{disabledObjects:i,result:o}=n;let r=null;n.command!=null&&n.command!==""&&(r=R("div",{className:"console-history-item-command",children:[h("div",{className:"console-history-gutter",children:">"}),h("div",{className:"console-history-content",children:h(ic,{language:s,children:n.command})})]}));const l=[];let a=!1;if(o){const{error:u,message:m,changes:p}=o;if(p){const{created:g,updated:f}=p;[...g,...f].forEach(C=>{a=!0;const{title:w}=C,b=`${w}`,S=t===void 0||t||(i!=null?i:[]).indexOf(b)>=0,E=h(K,{kind:"primary",onClick:()=>this.handleObjectClick(C),className:"btn-console-object",disabled:S,icon:h(Eg,{type:C.type}),children:w},b);l.push(E)})}if(u!=null&&n.command==null){let g=`${(d=u.message)!=null?d:u}`;g||(g=u);const f=h(Pr,{message:g},"result-error");l.push(f)}if(m!==void 0&&m!==""){const g=h("div",{className:"log-message",children:m},"log-message");l.push(g)}}else{a=!0;const u=h(rc,{onCancelClick:this.handleCancelClick,disabled:t},"in_progress");l.push(u)}let c=null;return l.length>0&&(c=h(oc,{children:l})),R("div",{className:G("console-command-result",{"console-result-buttons":a}),children:[r,c]})}}lc.defaultProps={disabled:!1};const ac=class extends T.exports.Component{static itemKey(e,t){return`${e}.${t.command}.${t.result&&t.result.message}.${t.result&&t.result.error}`}render(){const{disabled:e,items:t,language:n,openObject:s}=this.props,i=[];for(let o=0;o<t.length;o+=1){const r=t[o],l=h(lc,{disabled:e,item:r,openObject:s,language:n},ac.itemKey(o,r));i.push(l)}return h("div",{className:"container-fluid console-history",children:i})}};let cc=ac;cc.defaultProps={disabled:!1};const Rg={name:"Console",CLEAR:Ie.createAndAdd({id:"CONSOLE.CLEAR",name:"Clear",shortcut:[ie.CTRL,le.L],macShortcut:[ie.CTRL,le.C]}),FOCUS_HISTORY:Ie.createAndAdd({id:"CONSOLE.FOCUS_HISTORY",name:"Focus History",shortcut:[ie.CTRL,le.H],macShortcut:[ie.CTRL,ie.OPTION,le.H]})},Ig={name:"Command History",FOCUS_HISTORY:Ie.createAndAdd({id:"COMMAND_HISTORY.FOCUS_HISTORY",name:"Focus History Search",shortcut:[ie.CTRL,le.H],macShortcut:[ie.CTRL,ie.OPTION,le.H]}),SEND_TO_CONSOLE:Ie.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_CONSOLE",name:"Send to Console",shortcut:[le.ENTER],macShortcut:[le.ENTER]}),SEND_TO_NOTEBOOK:Ie.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_NOTEBOOK",name:"Send to Notebook",shortcut:[ie.CTRL,le.ENTER],macShortcut:[ie.CMD,le.ENTER]}),RUN:Ie.createAndAdd({id:"COMMAND_HISTORY.RUN",name:"Run",shortcut:[ie.ALT,le.R],macShortcut:[ie.OPTION,le.R]})},Mg={name:"Notebook",RUN:Ie.createAndAdd({id:"NOTEBOOK.RUN",name:"Run",shortcut:[ie.ALT,le.R],macShortcut:[ie.OPTION,le.R]}),RUN_SELECTED:Ie.createAndAdd({id:"NOTEBOOK.RUN_SELECTED",name:"Run Selected",shortcut:[ie.ALT,ie.SHIFT,le.R],macShortcut:[ie.OPTION,ie.SHIFT,le.R]}),FIND:Ie.createAndAdd({id:"NOTEBOOK.FIND",name:"Find",shortcut:[ie.CTRL,le.F],macShortcut:[ie.CMD,le.F],isEditable:!1}),MINIMAP:Ie.createAndAdd({id:"NOTEBOOK.MINIMAP",name:"Show Minimap",shortcut:[ie.ALT,le.M],macShortcut:[ie.OPTION,le.M]}),WORDWRAP:Ie.createAndAdd({id:"NOTEBOOK.WORDWRAP",name:"Word Wrap",shortcut:[ie.ALT,le.Z],macShortcut:[ie.OPTION,le.Z]})},us={CONSOLE:Rg,COMMAND_HISTORY:Ig,NOTEBOOK:Mg},je=Object.freeze({FATAL:"FATAL",STDERR:"STDERR",ERROR:"ERROR",WARN:"WARN",STDOUT:"STDOUT",INFO:"INFO",DEBUG:"DEBUG",TRACE:"TRACE"}),Dg="#2d2a2e",Ng="#fcfcfa",Fg="#fcd65b",xg="#b2b1b2",Ag="#9edc6f",Og="#76d9e4",kg="#f95d84",Lg="#aa9af4",Pg="#f95d84",Hg="#fcfcfa",_g="#7c7b7c",ce={"error-foreground":"#f95d84",background:Dg,foreground:Ng,"line-height":"19px",string:Fg,"string-delim":"#929192",delimiter:xg,predefined:Ag,keyword:Og,storage:kg,number:Lg,operator:Pg,identifier:Hg,"namespace-identifier":"#f95d84","identifier-js":"#fcd65b",comment:_g,"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"},Vg="python",Ug={comments:{lineComment:"#",blockComment:["'''","'''"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:/^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/,action:{indentAction:1}}],folding:{offSide:!0,markers:{start:/^\s*#region\b/,end:/^\s*#endregion\b/}}},Bg={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"]]}},Gg={id:Vg,conf:Ug,language:Bg},zg="groovy",Wg={comments:{lineComment:"//",blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:/^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/,action:{indentAction:1}}],folding:{offSide:!0,markers:{start:/^\s*#region\b/,end:/^\s*#endregion\b/}}},$g={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"]]}},qg={id:zg,conf:Wg,language:$g},Kg="scala",Xg={wordPattern:/(unary_[@~!#%^&*()\-=+\\|:<>/?]+)|([a-zA-Z_$][\w$]*?_=)|(`[^`]+`)|([a-zA-Z_$][\w$]*)/g,comments:{lineComment:"//",blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],folding:{markers:{start:/^\s*\/\/\s*(?:(?:#?region\b)|(?:<editor-fold\b))/,end:/^\s*\/\/\s*(?:(?:#?endregion\b)|(?:<\/editor-fold>))/}}},Yg={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"]]}},Qg={id:Kg,conf:Xg,language:Yg},jg="deephavenDb",Zg={comments:{lineComment:"#",blockComment:["'''","'''"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:/^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/,action:{indentAction:1}}],folding:{offSide:!0,markers:{start:/^\s*#region\b/,end:/^\s*#endregion\b/}}},Jg={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"]]}},ef={id:jg,conf:Zg,language:Jg},tf="log",nf={},sf={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"}]]}},of={id:tf,conf:nf,language:sf},Wt=ne.module("MonacoUtils");class Ve{static init({getWorker:t}={}){Wt.debug("Initializing Monaco..."),t!==void 0&&Ve.registerGetWorker(t);const{registerLanguages:n,removeHashtag:s}=Ve,i=[{token:"",foreground:s(ce.foreground)},{token:"string",foreground:s(ce.string)},{token:"string.delim",foreground:s(ce["string-delim"])},{token:"keyword",foreground:s(ce.keyword)},{token:"identifier.js",foreground:s(ce["identifier-js"])},{token:"delimiter",foreground:s(ce.delimiter)},{token:"comment",foreground:s(ce.comment)},{token:"number",foreground:s(ce.number)},{token:"storage",foreground:s(ce.storage)},{token:"identifier",foreground:s(ce.identifier)},{token:"namespace.identifier",foreground:s(ce["namespace-identifier"])},{token:"operator",foreground:s(ce.operator)},{token:"predefined",foreground:s(ce.predefined)},{token:"error.log",foreground:ce["log-error"].substring(1)},{token:"warn.log",foreground:s(ce["log-warn"])},{token:"info.log",foreground:s(ce["log-info"])},{token:"stdout.log",foreground:s(ce["log-stdout"])},{token:"trace.log",foreground:s(ce["log-trace"])},{token:"debug.log",foreground:s(ce["log-debug"])},{token:"date.log",foreground:s(ce["log-date"])}],o={errorForeground:ce["error-foreground"],"inputOption.activeBorder":ce["input-option-active-border"],"editor.background":ce.background,"editor.foreground":ce.foreground,"editor.lineHighlightBackground":ce["editor-line-highlight-bg"],"editorLineNumber.foreground":ce["editor-line-number-foreground"],"editor.selectionBackground":ce["editor-selection-background"],"editor.findMatchBackground":ce["editor-find-match-background"],"editor.findMatchHighlightBackground":ce["editor-find-match-highlight-background"],"editorSuggestWidget.background":ce["editor-suggest-widget-background"],"editorSuggestWidget.border":ce["editor-suggest-widget-border"],"editorSuggestWidget.foreground":ce["editor-suggest-widget-foreground"],"editorSuggestWidget.selectedBackground":ce["editor-suggest-widget-selected-background"],"editorSuggestWidget.highlightForeground":ce["editor-suggest-widget-highlightForeground"],"list.hoverBackground":ce["list-hover-background"],"dropdown.background":ce["context-menu-background"],"dropdown.foreground":ce["context-menu-foreground"],"menu.selectionBackground":ce["menu-selection-background"],"list.focusBackground":ce["menu-selection-background"],"editorWidget.background":ce["editor-widget-background"],"inputOption.activeBackground":ce["input-option-active-background"],"inputOption.activeForeground":ce["input-option-active-foreground"],focusBorder:ce["focus-border"],"input.background":ce["input-background"],"input.foreground":ce["input-foreground"],"input.border":ce["input-border"]};bn.defineTheme("dh-dark",{base:"vs-dark",inherit:!0,rules:i,colors:o}),Wt.debug2("monaco theme: ",ce),bn.setTheme("dh-dark"),n([ef,Gg,qg,of,Qg]),Wt.debug("Monaco initialized.")}static registerGetWorker(t){window.MonacoEnvironment={...window.MonacoEnvironment,getWorker:t}}static removeHashtag(t){return t.substring(1)}static registerLanguages(t){const n=t.map(({id:s})=>s);Ms.getLanguages().filter(({id:s})=>n.includes(s)).forEach(s=>{const i=s;Wt.debug2("Overriding default language loader:",i.id)}),t.forEach(s=>{Ve.registerLanguage(s)})}static registerLanguage(t){Wt.debug2("Registering language: ",t.id),Ms.register(t),Ms.onLanguage(t.id,()=>{Ms.setLanguageConfiguration(t.id,t.conf),Ms.setMonarchTokensProvider(t.id,t.language)})}static setEOL(t,n=bn.EndOfLineSequence.LF){var s;(s=t.getModel())==null||s.setEOL(n)}static openDocument(t,n){const s=t.getModel();O(s);const i={textDocument:{uri:`${s.uri}`,languageId:s.getLanguageId(),version:s.getVersionId(),text:s.getValue()}};return Wt.debug2("didOpenDocumentParams: ",i),n.openDocument(i),t.onDidChangeModelContent(r=>{const{changes:l,versionId:a}=r,c=[];for(let d=0;d<l.length;d+=1){const u=l[d],{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 d={textDocument:{version:a,uri:`${s.uri}`},contentChanges:c};Wt.debug2("didChangeDocumentParams",d),n.changeDocument(d)}})}static closeDocument(t,n){const s=t.getModel();O(s);const i={textDocument:{uri:`${s.uri}`}};n.closeDocument(i)}static registerPasteHandler(t){t.onDidPaste(n=>{const s=/“|”/g,i=/\u200b/g,o=/\u00A0/g,r=t.getModel();O(r);const l=r.getValueInRange(n.range);(s.test(l)||i.test(l)||o.test(l))&&r.applyEdits([{range:n.range,text:l.replace(s,'"').replace(i,"").replace(o," ")}])})}static isMacPlatform(){const{platform:t}=window.navigator;return t.startsWith("Mac")}static removeConflictingKeybindings(t){const n=[{windows:"ctrl+D",mac:"meta+D"},{windows:"ctrl+H"}];try{n.forEach(s=>{Ve.isMacPlatform()&&s.mac===""||!Ve.isMacPlatform()&&s.windows===""||Ve.removeKeybinding(t,Ve.isMacPlatform()?s.mac:s.windows)})}catch(s){Wt.error(s)}}static removeKeybinding(t,n){if(n===void 0)return;const s=t._standaloneKeybindingService._getResolver()._map.get(n);s!=null?s.forEach(i=>{Wt.debug2(`Removing Monaco keybinding ${n} for ${i.command}`),t._standaloneKeybindingService.addDynamicKeybinding(`-${i.command}`,null,()=>{})}):Wt.warn(`Did not find any keybindings to remove for ${n}`)}static getMonacoKeyCodeFromShortcut(t){const{keyState:n}=t,{keyValue:s}=n;return s===null?0:Ve.isMacPlatform()?(n.metaKey?Dt.CtrlCmd:0)|(n.shiftKey?Dt.Shift:0)|(n.altKey?Dt.Alt:0)|(n.ctrlKey?Dt.WinCtrl:0)|Yr.fromString(s):(n.ctrlKey?Dt.CtrlCmd:0)|(n.shiftKey?Dt.Shift:0)|(n.altKey?Dt.Alt:0)|(n.metaKey?Dt.WinCtrl:0)|Yr.fromString(s)}}const xl=ne.module("MonacoCompletionProvider");class dc extends T.exports.PureComponent{constructor(t){super(t),this.handleCompletionRequest=this.handleCompletionRequest.bind(this)}componentDidMount(){const{language:t}=this.props;this.registeredCompletionProvider=Ms.registerCompletionItemProvider(t!=null?t:"",{provideCompletionItems:this.handleCompletionRequest,triggerCharacters:['"',".","'","(","[","{",","]})}componentWillUnmount(){var t;(t=this.registeredCompletionProvider)==null||t.dispose()}handleCompletionRequest(t,n,s){const{model:i,session:o}=this.props;if(t!==i)return null;const r={textDocument:{uri:`${t.uri}`,version:t.getVersionId()},position:{line:n.lineNumber-1,character:n.column-1},context:s},l=o.getCompletionItems(r);return xl.debug("Completion items received: ",r,l),l.then(c=>{const d=c.map(u=>{const{label:m,kind:p,detail:g,documentation:f,sortText:C,filterText:w,textEdit:b,insertTextFormat:S}=u,{start:E,end:v}=b.range,y={startLineNumber:E.line+1,startColumn:E.character+1,endLineNumber:v.line+1,endColumn:v.character+1};return{label:m,kind:p,detail:g,documentation:f,sortText:C,filterText:w,insertText:b.text,insertTextRules:S===2?4:S,range:y}});return{incomplete:!0,suggestions:d}}).catch(c=>(xl.error("There was an error retrieving completion items",c),{suggestions:[]}))}render(){return null}}const Go=ne.module("ConsoleInput"),Ji=parseInt(ce["line-height"],10),uc=6,hc=6,rf=Ji+uc+hc,zo=100,mc=class extends T.exports.PureComponent{constructor(e){super(e),this.handleWindowResize=this.handleWindowResize.bind(this),this.commandContainer=J.createRef(),this.commandHistoryIndex=null,this.timestamp=Date.now(),this.bufferIndex=0,this.history=[],this.modifiedCommands=new Map,this.state={commandEditorHeight:Ji,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(e,t=!0,n=!1){var s;!e||(Go.debug("Command received: ",e),n||(this.commandHistoryIndex=null,(s=this.commandEditor)==null||s.setValue(e)),t&&this.focusEnd(),this.updateDimensions(),n&&this.processCommand(e))}initCommandEditor(){const{language:e,session:t}=this.props,n={copyWithSyntaxHighlighting:!1,cursorStyle:"block",fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:e,lineHeight:Ji,lineDecorationsWidth:3,lineNumbers:"off",minimap:{enabled:!1},renderLineHighlight:"none",scrollBeyondLastLine:!1,scrollbar:{arrowSize:0,horizontal:"hidden",horizontalScrollbarSize:0},padding:{top:uc,bottom:hc},tabCompletion:"on",value:"",wordWrap:"on"},s=this.commandContainer.current;O(s),this.commandEditor=bn.create(s,n),Ve.setEOL(this.commandEditor),Ve.openDocument(this.commandEditor,t),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 d,u,m;const{commandEditor:o,commandHistoryIndex:r}=this,l=o==null?void 0:o.getPosition();O(l);const{lineNumber:a}=l,c=o==null?void 0:o.getModel();if(i.keyCode===Qt.UpArrow&&!this.isSuggestionMenuPopulated()&&a===1){r!=null?this.loadCommand(r+1):this.loadCommand(0),this.focusStart(),i.stopPropagation(),i.preventDefault();return}if(i.keyCode===Qt.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}if(!i.altKey&&!i.shiftKey&&!i.metaKey)if(i.keyCode===Qt.Enter){if(!this.isSuggestionMenuPopulated()){i.stopPropagation(),i.preventDefault();const p=(d=this.commandEditor)==null?void 0:d.getValue().trim();p!==void 0&&(this.processCommand(p),(u=this.commandEditor)==null||u.setValue(""))}}else i.keyCode===Qt.Tab&&(this.isSuggestionMenuActive()?this.isSuggestionMenuPopulated()||(i.stopPropagation(),i.preventDefault()):(i.stopPropagation(),i.preventDefault(),(m=this.commandEditor)==null||m.trigger("Tab key trigger suggestions","editor.action.triggerSuggest",{})))}),this.commandEditor.addCommand(Dt.CtrlCmd|Qt.KeyF,()=>{}),Ve.removeConflictingKeybindings(this.commandEditor),Ve.registerPasteHandler(this.commandEditor),this.commandEditor.focus(),this.updateDimensions(),this.setState({model:this.commandEditor.getModel()})}destroyCommandEditor(){const{session:e}=this.props;this.commandEditor&&(Ve.closeDocument(this.commandEditor,e),this.commandEditor.dispose(),this.commandEditor=void 0)}handleWindowResize(){this.updateDimensions()}isSuggestionMenuActive(){var e,t,n;return this.commandSuggestionContainer||(this.commandSuggestionContainer=(t=(e=this.commandEditor)==null?void 0:e.getDomNode())==null?void 0:t.querySelector(".suggest-widget")),(n=this.commandSuggestionContainer&&this.commandSuggestionContainer.classList.contains("visible"))!=null?n:!1}isSuggestionMenuPopulated(){var e,t,n;return this.isSuggestionMenuActive()&&((n=(t=(e=this.commandSuggestionContainer)==null?void 0:e.querySelector(".monaco-list-rows"))==null?void 0:t.childElementCount)!=null?n:0)>0}focus(){var e;(e=this.commandEditor)==null||e.focus()}focusStart(){var s,i,o,r,l;const e=(s=this.commandEditor)==null?void 0:s.getModel();O(e);const t=e.getLineLength(1)+1,n=(i=this.commandEditor)==null?void 0:i.getTopForPosition(1,t);O(n),(o=this.commandEditor)==null||o.setPosition({lineNumber:1,column:t}),(r=this.commandEditor)==null||r.setScrollTop(n),(l=this.commandEditor)==null||l.focus()}focusEnd(){var i,o,r,l,a;const e=(i=this.commandEditor)==null?void 0:i.getModel();O(e);const t=e.getLineCount(),n=e.getLineLength(t)+1,s=(o=this.commandEditor)==null?void 0:o.getTopForPosition(t,n);O(s),(r=this.commandEditor)==null||r.setPosition({lineNumber:t,column:n}),(l=this.commandEditor)==null||l.setScrollTop(s),(a=this.commandEditor)==null||a.focus()}clear(){var e,t,n;(e=this.commandEditor)==null||e.focus(),(n=(t=this.commandEditor)==null?void 0:t.getModel())==null||n.setValue(""),this.commandHistoryIndex=null}layoutEditor(){this.commandEditor&&this.commandEditor.layout()}loadCommand(e){var s,i;if(e===null||e>=this.history.length)return;const t=this.modifiedCommands.get(e),n=e===null?"":this.history[this.history.length-e-1];this.commandHistoryIndex=e,(i=(s=this.commandEditor)==null?void 0:s.getModel())==null||i.setValue(t!=null?t:n),e!==null&&e>this.history.length-zo&&this.loadMoreHistory()}async loadMoreHistory(){try{if(this.loadingPromise!=null||this.bufferIndex==null)return;const{commandHistoryStorage:e,language:t,scope:n}=this.props;this.loadingPromise=Pe.makeCancelable(e.getTable(t,n!=null?n:"",this.timestamp),o=>o.close());const s=await this.loadingPromise;s.setReversed(!0),s.setViewport({top:this.bufferIndex,bottom:this.bufferIndex+zo-1}),this.loadingPromise=Pe.makeCancelable(s.getViewportData(),()=>s.close());const i=await this.loadingPromise;this.bufferIndex+=zo,this.bufferIndex>=s.size&&(this.bufferIndex=null),this.history=[...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(e){if(this.loadingPromise=void 0,Pe.isCanceled(e)){Go.debug2("Promise canceled, not loading history");return}Go.error("Error fetching history",e)}}processCommand(e){this.commandHistoryIndex=null,this.modifiedCommands.clear(),O(e),e!==""&&(this.history.length===0||e!==this.history[this.history.length-1])&&this.history.push(e),this.updateDimensions();const{onSubmit:t}=this.props;t(e)}updateDimensions(){if(!this.commandEditor)return;const{maxHeight:e}=this.props;O(e);const t=this.commandEditor.getContentHeight(),n=Math.max(Math.min(t,e),rf),i={overviewRulerLanes:t>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:e,language:t,session:n}=this.props,{commandEditorHeight:s,isFocused:i,model:o}=this.state;return h("div",{className:G("console-input-wrapper",{disabled:e}),children:R("div",{className:G("console-input-inner-wrapper",{focus:i}),children:[h("div",{className:mc.INPUT_CLASS_NAME,ref:this.commandContainer,style:{height:s}}),o&&h(dc,{model:o,language:t,session:n})]})})}};let eo=mc;eo.defaultProps={maxHeight:Ji*10,scope:null,disabled:!1};eo.INPUT_CLASS_NAME="console-input";const Al="pasted values",lf=[/^audio.*/,/^font.*/,/^image.*/,/^video.*/],Wo=[".csv",".tsv",".tab",".psv",".dsv",".txt"],Ol=[".zip"],Fs=class extends T.exports.Component{constructor(e){super(e),this.getValidExtensions=Ee(t=>t?[...Wo,...Ol]:[...Wo]),this.getAcceptString=Ee(t=>this.getValidExtensions(t).join(", ")),this.getFileTypeErrorString=Ee(t=>fr.join(this.getValidExtensions(t),"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=J.createRef(),this.divElem=J.createRef(),this.state={selectedFileName:""}}static isValidDropItem(e){return e!=null&&e.kind==="file"&&!lf.find(t=>t.test(e.type))}static isValidExtension(e,t=!1){return Wo.some(n=>e.endsWith(n))||t&&Ol.some(n=>e.endsWith(n))}static handleDragOver(e){e.preventDefault(),e.stopPropagation()}static getIcon(e){return e===Al?Zr:e.endsWith(".csv")?mu:e.endsWith(".zip")?Gd:gu}componentDidMount(){var e,t;(e=this.divElem.current)==null||e.addEventListener("paste",this.handlePasteEvent),(t=this.divElem.current)==null||t.focus()}componentWillUnmount(){var e;(e=this.divElem.current)==null||e.removeEventListener("paste",this.handlePasteEvent)}handleSelectFile(){var e;this.fileElem.current&&(this.fileElem.current.value="",(e=this.fileElem.current)==null||e.click())}handleFiles(e){e.stopPropagation(),e.preventDefault();const{files:t}=e.target;t!=null&&this.handleFile(t[0])}handleDrop(e){const{allowZip:t,clearDragError:n,dragError:s}=this.props;if(e.preventDefault(),e.stopPropagation(),s!=null){n();return}if(e.dataTransfer==null||e.dataTransfer.items==null||e.dataTransfer.items.length===0)return;const i=e.dataTransfer.items[0].getAsFile();O(i),Fs.isValidExtension(i.name,t)?this.handleFile(i):this.setState({dropError:Fs.FILE_TYPE_ERROR})}unstageFile(e){const{onCancel:t}=this.props;e.stopPropagation(),e.preventDefault(),t(),this.setState({selectedFileName:"",dropError:void 0})}handleFile(e){const{onFileOpened:t}=this.props;t(e),this.setState({selectedFileName:e.name,dropError:void 0})}handleMenuPaste(){const{onPaste:e,onError:t,uploadInProgress:n}=this.props;n||navigator.clipboard.readText().then(s=>{e(s),this.setState({selectedFileName:Al,dropError:void 0})}).catch(s=>t(s))}handlePasteEvent(e){e.stopPropagation(),e.preventDefault(),this.handleMenuPaste()}makeContextMenuItems(){const{uploadInProgress:e}=this.props;return[{title:"Paste",icon:Zr,action:this.handleMenuPaste,shortcut:Tr.PASTE,disabled:e}]}render(){const{allowZip:e,dragError:t,uploadInProgress:n}=this.props,{selectedFileName:s,dropError:i}=this.state,o=t!=null?t:i,r=this.makeContextMenuItems();return R("div",{ref:this.divElem,className:"csv-overlay fill-parent-absolute",onDragOver:Fs.handleDragOver,onDrop:this.handleDrop,tabIndex:-1,children:[h(oe,{actions:r}),h("input",{ref:this.fileElem,type:"file",id:"fileElem",accept:this.getAcceptString(e),style:{display:"none"},onChange:this.handleFiles,"data-testid":"fileElem"}),!s&&(o===void 0||o==="")&&R("div",{className:"message-content",children:[h("div",{className:"message-icon",children:h(Q,{icon:pu})}),h("label",{children:"Drop file (or paste values) here to import"}),h("div",{className:"message-small",children:h("label",{children:"or"})}),h(K,{kind:"primary",onClick:this.handleSelectFile,children:"Select File..."})]}),s&&(o===void 0||o==="")&&R("div",{className:"selected-content",children:[h("div",{className:"selected-icon",children:h(Q,{icon:Fs.getIcon(s)})}),R("div",{className:"selected-text",children:[h("label",{children:"Selected File"}),R("label",{className:"selected-name",children:[s,!n&&h(K,{kind:"ghost",className:"ml-2",onClick:this.unstageFile,icon:Tn,tooltip:"Remove"})]})]})]}),Boolean(o)&&R("div",{className:"message-content",children:[h("div",{className:"message-icon",children:h(Q,{icon:$n})}),h("label",{children:o}),o===Fs.FILE_TYPE_ERROR&&h("div",{className:"message-small",children:h("label",{children:this.getFileTypeErrorString(e)})})]})]})}};let wn=Fs;wn.defaultProps={allowZip:!1,dragError:null};wn.MULTIPLE_FILE_ERROR="Please select only one file";wn.FILE_TYPE_ERROR="Filetype not supported.";class we{}we.INTEGER="int";we.LONG="long";we.DOUBLE="double";we.BOOLEAN="bool";we.STRING="string";we.DATE_TIME="datetime";we.LOCAL_TIME="localtime";const kl="unknown",af=2147483647,cf=-2147483648,Ll=/^[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]+)?$/,Pl=/^([0-9]+T)?([0-9]+):([0-9]+)(:[0-9]+)?(?:\.[0-9]{1,9})?$/;class nt{static determineType(t,n,s){if(!t||t===s)return n;switch(n){case we.STRING:return we.STRING;case we.INTEGER:return nt.checkInteger(t);case we.LONG:return nt.checkLong(t);case we.DOUBLE:return nt.checkDouble(t);case we.BOOLEAN:return nt.checkBoolean(t);case we.DATE_TIME:return nt.checkDateTime(t);case we.LOCAL_TIME:return nt.checkLocalTime(t);default:return nt.getTypeFromUnknown(t)}}static isNotParsableNumber(t){return isNaN(t)||t==="Infinity"||t==="-Infinity"}static checkInteger(t){const n=t.replace(/,/g,"");return nt.isNotParsableNumber(n)?we.STRING:nt.getNumberType(n)}static checkLong(t){const n=t.replace(/,/g,"");return nt.isNotParsableNumber(n)?we.STRING:n.includes(".")?we.DOUBLE:we.LONG}static checkDouble(t){const n=t.replace(/,/g,"");return nt.isNotParsableNumber(n)?we.STRING:we.DOUBLE}static checkBoolean(t){const n=t.toLowerCase();return n==="true"||n==="false"?we.BOOLEAN:we.STRING}static checkDateTime(t){return Ll.test(t)?we.DATE_TIME:we.STRING}static checkLocalTime(t){return Pl.test(t)?we.LOCAL_TIME:we.STRING}static getTypeFromUnknown(t){const n=t.replace(/,/g,"");if(nt.isNotParsableNumber(n)){const s=t.toLowerCase();return s==="true"||s==="false"?we.BOOLEAN:Ll.test(t)&&t.includes(":")?we.DATE_TIME:Pl.test(t)?we.LOCAL_TIME:we.STRING}return nt.getNumberType(n)}static getNumberType(t){if(t.includes("."))return we.DOUBLE;const n=t.startsWith("-")?11:10;if(t.length>n)return we.LONG;const s=parseInt(t,10);return s>af||s<cf?we.LONG:we.INTEGER}constructor(t,n,s,i,o,r,l,a,c,d){this.onFileCompleted=t,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=d,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 t=this.isZip?this.file.nodeStream("nodebuffer",this.handleNodeUpdate):this.file;Xo.parse(t,this.config)}handleChunk(t,n){let{data:s}=t;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(kl),this.readHeaders&&(s=s.slice(1))}O(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]=nt.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.
|
|
16
|
+
Expected length ${i.length} but found ${l.length}.
|
|
17
|
+
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(t){const{types:n,onFileCompleted:s}=this;O(n),(t==null||!t.meta.aborted)&&s(n.map(i=>i===kl?we.STRING:i))}handleError(t){const{onError:n}=this;n(t)}handleNodeUpdate(t){this.zipProgress=t.percent}}const Ui=ne.module("CsvParser"),df=650,to=class{static generateHeaderRecursive(e){let t="",n=e;return e>=26&&(t=t.concat(to.generateHeaderRecursive(Math.floor(e/26)-1)),n=e%26),t.concat(String.fromCharCode(65+n))}constructor({onFileCompleted:e,session:t,file:n,type:s,readHeaders:i=!0,onProgress:o,onError:r,timeZone:l,isZip:a}){this.onFileCompleted=e,this.session=t,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/Xo.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(e,t){const n=t.length,s=new Array(e).fill(null).map(()=>new Array(n));for(let i=0;i<n;i+=1){const o=t[i];if(o.length<e)throw new Error(`Insufficient columns. Expected ${e} but found ${o.length}
|
|
18
|
+
${o}`);for(let r=0;r<e;r+=1){const l=this.type.shouldTrim?t[i][r].trim():t[i][r];s[r][i]=this.nullCheck(l)}}return s}nullCheck(e){return e===this.type.nullString?"":e}parse(){const e=n=>{const s=this.isZip?this.file.nodeStream("nodebuffer",this.handleNodeUpdate):this.file;this.types=n,Xo.parse(s,this.config)};new nt(e,this.file,this.readHeaders,this.config,this.type.nullString,this.onProgress,this.onError,this.totalChunks,this.isZip,this.type.shouldTrim).parse()}handleChunk(e,t){const{readHeaders:n,onError:s,handleCreateTable:i,isZip:o,tables:r}=this;if(this.isCancelled){Ui.debug2("CSV parser cancelled."),t.abort(),r.forEach(c=>c.close());return}let{data:l}=e;this.headers||(n?(this.headers=En.legalizeColumnNames(l[0]),l=l.slice(1)):this.headers=to.generateHeaders(l[0].length));let a=[];try{if(a=this.transpose(this.headers.length,l),o)this.consolidateChunks(a,t);else{const c=this.chunks;this.chunks+=1,i(c,a,t)}}catch(c){s(c)}}consolidateChunks(e,t){if(!this.consolidatedChunks)this.consolidatedChunks=e.slice();else for(let n=0;n<e.length;n+=1)this.consolidatedChunks[n]=this.consolidatedChunks[n].concat(e[n]);this.numConsolidated+=1,(this.numConsolidated>=df||this.isComplete)&&this.uploadConsolidatedChunks(t)}uploadConsolidatedChunks(e){var i;const{handleCreateTable:t}=this,n=this.chunks;this.chunks+=1;const s=(i=this.consolidatedChunks)==null?void 0:i.slice();this.consolidatedChunks=void 0,this.numConsolidated=0,O(s),t(n,s,e)}handleCreateTable(e,t,n){const{session:s,tables:i,onFileCompleted:o,totalChunks:r,types:l,onProgress:a,onError:c}=this;n&&n.pause(),O(this.headers),O(l),s.newTable(this.headers,l,t,this.timeZone).then(d=>{if(this.isCancelled){Ui.debug2("CSV parser cancelled."),n&&n.abort(),i.forEach(m=>m.close());return}n&&n.resume(),i[e]=d;let u=0;r>0?u=Math.round(i.length/r*50)+50:u=Math.round(50+this.zipProgress/2),Ui.debug2(`CSV parser progress ${u}`),a(u),this.isComplete&&i.length===this.chunks&&(Ui.debug2("CSV parser complete."),o(i))}).catch(d=>{!this.isComplete&&n&&n.abort(),c(d)})}handleComplete(e){(e==null||e.meta.aborted==null)&&(this.isComplete=!0,this.consolidatedChunks&&this.uploadConsolidatedChunks(null))}handleError(e){const{onError:t}=this;t(e)}handleNodeUpdate(e){this.zipProgress=e.percent}};let pc=to;pc.generateHeaders=e=>{const t=[];for(let n=0;n<e;n+=1)t.push(to.generateHeaderRecursive(n));return t};class zn{static fromExtension(t){return t.endsWith(".csv")?"DEFAULT_CSV":t.endsWith(".tsv")||t.endsWith(".tab")?"TSV":t.endsWith(".psv")?"PIPE_SV":"AUTODETECT"}}zn.DEFAULT_TYPE="DEFAULT_CSV";zn.AUTO="AUTODETECT";zn.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
|
|
19
|
+
`,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:null},EXCEL_CSV:{name:"Excel csv (strict)",delimiter:",",newline:`\r
|
|
20
|
+
`,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!1,nullString:null},MY_SQL_CSV:{name:"MySQL csv",delimiter:" ",newline:`
|
|
21
|
+
`,escapeChar:"\\",shouldTrim:!0,skipEmptyLines:!1,nullString:"\\N"},RFC4180_CSV:{name:"RFC4180 csv",delimiter:",",newline:`\r
|
|
22
|
+
`,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 Hl=ne.module("CsvInputBar"),uf=Object.entries(zn.TYPES).map(([e,t])=>h("option",{value:e,children:t.name},e));class gc extends T.exports.Component{constructor(t){super(t),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=J.createRef(),this.state={tableName:"",tableNameSet:!1,isFirstRowHeaders:!0,showProgress:!1,progressValue:0,type:zn.DEFAULT_TYPE,parser:null}}componentDidUpdate(t){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=En.legalizeTableName(n.name.substring(0,l));this.setState({tableName:a,tableNameSet:!0}),(r=this.inputRef.current)==null||r.focus()}else(n==null&&t.file!=null||s==null&&t.paste!=null)&&this.setState({tableName:"",tableNameSet:!1});s!=null&&s!==""&&!i&&this.inputRef.current&&this.inputRef.current.focus(),n!=null&&n!==t.file?this.setState({type:zn.fromExtension(n.name)}):s!=null&&s!==""&&(t.paste===void 0||t.paste==="")&&this.setState({type:zn.AUTO})}componentWillUnmount(){const{parser:t}=this.state;t&&t.cancel()}handleCancel(){const{onClose:t}=this.props;t()}handleError(t){const{onClose:n,onError:s}=this.props;Hl.error(t),s(t),n()}handleTableName(t){this.setState({tableName:t.target.value,tableNameSet:!0})}toggleFirstRowHeaders(){const{isFirstRowHeaders:t}=this.state;this.setState({isFirstRowHeaders:!t})}handleUpload(t){t.stopPropagation(),t.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(t,n=!1){Hl.info(`Starting CSV parser for ${t instanceof File?t.name:"pasted values"} ${n?"":t.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))},d=new pc({onFileCompleted:c,session:s,file:t,type:zn.TYPES[a],readHeaders:l,onProgress:this.handleProgress,onError:this.handleError,timeZone:i,isZip:n});d.parse(),this.setState({showProgress:!0,parser:d}),o(!0)}handleZipFile(t){const{onUpdate:n,unzip:s}=this.props;if(s==null){this.handleError(new Error("No support for zip files available."));return}s(t).then(i=>{let o=!1;for(let r=0;r<i.length;r+=1){const l=i[r];if(wn.isValidExtension(l.name)){n(`Loading ${l.name} as csv from ${t.name}`),o=!0,this.handleFile(l,!0);break}}if(!o)throw new Error(`No csv file found in ${t.name}`)}).catch(i=>this.handleError(i))}handleProgress(t){const{showProgress:n}=this.state;return n&&this.setState({progressValue:t}),!n}handleCancelInProgress(){const{onInProgress:t}=this.props,{parser:n}=this.state;n&&n.cancel(),this.setState({showProgress:!1,progressValue:0}),t(!1)}openTable(){const{onOpenTable:t,onClose:n}=this.props,{tableName:s}=this.state;t(s),n()}handleQueryTypeChange(t){this.setState({type:t.target.value})}render(){const{file:t,paste:n}=this.props,{tableName:s,isFirstRowHeaders:i,showProgress:o,progressValue:r,type:l}=this.state,a=Boolean(n)&&!s;return R("div",{className:"csv-input-bar",children:[!o&&R("form",{onSubmit:this.handleUpload,className:"csv-input-bar-container form-inline",children:[R("div",{className:"form-group",children:[h("label",{htmlFor:"tableNameInput",children:"Table name"}),h("input",{ref:this.inputRef,id:"tableNameInput",type:"text",className:G("form-control",{"is-invalid":a}),value:s,onChange:this.handleTableName})]}),R("div",{className:"form-group",children:[h("label",{htmlFor:"formatSelect",children:"File format"}),h("select",{id:"formatSelect",className:"custom-select",value:l,onChange:this.handleQueryTypeChange,children:uf})]}),h(at,{className:"firstRowHeaders",checked:i,onChange:this.toggleFirstRowHeaders,children:"First row is column headers"}),R("div",{className:"csv-input-buttons form-group",children:[h(K,{kind:"secondary",onClick:this.handleCancel,children:"Cancel"}),h(K,{kind:"primary",type:"submit",disabled:!(t!==null||n!==void 0&&n!=="")||!s,children:"Upload"})]})]}),o&&R("div",{className:"csv-progress-container",children:[h("label",{children:"Uploading Table"}),h("div",{className:"progress",children:h("div",{className:"progress-bar bg-primary",style:{width:`${r}%`},"aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100})}),R("label",{children:[r,"%"]}),h(K,{kind:"primary",onClick:this.handleCancelInProgress,children:"Cancel"})]})]})}}gc.defaultProps={file:null,paste:null,unzip:null};const _l=ne.module("ConsoleMenu");class no extends T.exports.PureComponent{constructor(t){super(t),this.makeTableActions=Ee((n,s,i)=>{const o=n.filter(r=>Ps.isTableType(r.type));return no.makeItemActions(o,s,r=>{this.tableSearchField=r},this.handleTableFilterChange,i)}),this.makeWidgetActions=Ee((n,s,i)=>{const o=n.filter(r=>Ps.isWidgetType(r.type));return no.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(t,n,s,i,o){if(t.length===0)return[];const r={menuElement:h(Qn,{value:n,onChange:i,className:"console-menu",ref:s})};let l=t;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(t){_l.debug("filtering tables..."),this.setState({tableFilterText:t.target.value})}handleTableMenuClosed(){this.setState({tableFilterText:""})}handleTableMenuOpened(){var t;(t=this.tableSearchField)==null||t.focus()}handleWidgetFilterChange(t){_l.debug("filtering widgets..."),this.setState({widgetFilterText:t.target.value})}handleWidgetMenuClosed(){this.setState({widgetFilterText:""})}handleWidgetMenuOpened(){var t;(t=this.widgetSearchField)==null||t.focus()}render(){const{overflowActions:t,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"},c=r.length===0,d=l.length===0;return R("div",{className:"console-pane-menu",children:[R(K,{kind:"ghost",className:"btn-link-icon",disabled:c,onClick:()=>{},tooltip:c?"No tables available":"Tables",children:[R("div",{className:"fa-md fa-layers",children:[h(Q,{mask:pr,icon:Bn,transform:"right-5 down-5"}),h(Q,{icon:Bn,transform:"right-8 down-6"})]}),h(qn,{actions:r,onMenuOpened:this.handleTableMenuOpened,onMenuClosed:this.handleTableMenuClosed,options:{initialKeyboardIndex:1},popperOptions:a},"table-actions ")]}),R(K,{kind:"ghost",className:"btn-link-icon",disabled:l.length===0,onClick:()=>{},tooltip:d?"No widgets available":"Widgets",children:[R("div",{className:"fa-md fa-layers",children:[h(Q,{mask:Zl,icon:Bn,transform:"right-5 down-5"}),h(Q,{icon:Bn,transform:"right-8 down-6"})]}),h(qn,{actions:l,onMenuOpened:this.handleWidgetMenuOpened,onMenuClosed:this.handleWidgetMenuClosed,options:{initialKeyboardIndex:1},popperOptions:a},"table-actions")]}),h(K,{kind:"ghost",className:"btn-overflow btn-link-icon",icon:qd,tooltip:"More Actions...",onClick:()=>{},children:h(qn,{actions:t,popperOptions:a})})]})}}class fc extends T.exports.PureComponent{constructor(t){super(t),this.handleCommandStarted=this.handleCommandStarted.bind(this),this.handleCommandCompleted=this.handleCommandCompleted.bind(this),this.pending=new uo,this.state={isDisconnected:!1,isCommandRunning:!1}}componentDidMount(){this.startListening()}componentWillUnmount(){this.stopListening(),this.cancelPendingPromises()}startListening(){const{session:t}=this.props;t.addEventListener(I.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted)}stopListening(){const{session:t}=this.props;t.removeEventListener(I.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted)}cancelPendingPromises(){this.pending.cancel()}handleCommandStarted(t){const{result:n}=t.detail;this.pending.add(n).then(()=>this.handleCommandCompleted(null)).catch(s=>this.handleCommandCompleted(s)),this.setState({isCommandRunning:!0})}handleCommandCompleted(t){t instanceof As||this.setState({isCommandRunning:this.pending.pending.length>0})}render(){const{children:t,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"),R("div",{className:"console-pane-status-bar",children:[R("div",{children:[h("div",{className:G("console-status-icon",l)}),h(Be,{children:a})]}),t,h(no,{overflowActions:s,openObject:n,objects:i})]})}}fc.defaultProps={children:null};const hn=ne.module("Console"),Vl={isAutoLaunchPanelsEnabled:!0,isPrintStdOutEnabled:!0,isClosePanelsOnDisconnectEnabled:!0},ri=class extends T.exports.PureComponent{constructor(e){super(e),this.processLogMessageQueue=Xn(()=>{this.scrollConsoleHistoryToBottom(),this.setState(s=>{hn.debug2("processLogMessageQueue",this.queuedLogMessages.length," items");let{consoleHistory:i}=s;return i=i.concat(this.queuedLogMessages),this.queuedLogMessages=[],{consoleHistory:i}})},ri.LOG_THROTTLE),this.getObjects=Ee(s=>[...s.values()]),this.getContextActions=Ee(s=>[...s,{action:this.handleClearShortcut,shortcut:us.CONSOLE.CLEAR},{action:this.handleFocusHistory,shortcut:us.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=J.createRef(),this.consoleInput=J.createRef(),this.consoleHistoryScrollPane=J.createRef(),this.pending=new uo,this.queuedLogMessages=[];const{objectMap:t,settings:n}=this.props;this.state={consoleHistory:[],consoleHeight:0,isScrollDecorationShown:!1,objectHistoryMap:new Map,objectMap:new Map(t),showCsvOverlay:!1,csvFile:null,csvPaste:null,dragError:null,csvUploadInProgress:!1,...Vl,...n}}static isErrorLevel(e){return e===je.STDERR||e===je.ERROR||e===je.FATAL}static isOutputLevel(e){return e===je.STDOUT||ri.isErrorLevel(e)}componentDidMount(){this.initConsoleLogging();const{session:e}=this.props;e.addEventListener(I.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted),this.updateDimensions()}componentDidUpdate(e,t){const{props:n,state:s}=this;this.sendSettingsChange(t,s),n.objectMap!==e.objectMap&&this.updateObjectMap()}componentWillUnmount(){const{session:e}=this.props;e.removeEventListener(I.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted),this.pending.cancel(),this.processLogMessageQueue.cancel(),this.deinitConsoleLogging()}initConsoleLogging(){const{session:e}=this.props;this.cancelListener=e.onLogMessage(this.handleLogMessage)}deinitConsoleLogging(){this.cancelListener!=null&&(this.cancelListener(),this.cancelListener=void 0)}handleClearShortcut(e){var t;e.preventDefault(),e.stopPropagation(),(t=this.consoleInput.current)==null||t.clear()}handleCommandStarted(e){const{code:t,result:n}=e.detail,s=this.pending.add(n),i={command:t,disabledObjects:[],startTime:Date.now(),cancelResult:()=>{n.cancel()},wrappedResult:s},{commandHistoryStorage:o,language:r,scope:l}=this.props,a=o.addItem(r,l,t,{command:t,startTime:new Date().toJSON()});a.catch(c=>{hn.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(e,t,n){const s={...t,wrappedResult:void 0,cancelResult:void 0,result:e!=null?e:t.result};this.setState(({consoleHistory:i})=>{const o=i.lastIndexOf(t);if(o<0)return hn.error("historyItem not found in consoleHistory"),null;const r=i.concat();return r[o]=s,{consoleHistory:r}}),e&&(this.updateHistory(e,s),this.updateKnownObjects(s),this.updateWorkspaceHistoryItem({error:e.error},n),this.closeRemovedItems(e.changes),this.openUpdatedItems(e.changes))}handleCommandError(e,t,n){if(Pe.isCanceled(e)){hn.debug("Called handleCommandError on a cancelled promise result");return}this.updateWorkspaceHistoryItem({error:`${e}`},n),this.setState(s=>{const i=s.consoleHistory.concat(),o=i.lastIndexOf(t),r={...t};return r.wrappedResult=void 0,r.cancelResult=void 0,r.endTime=Date.now(),r.result={error:e},i[o]=r,{consoleHistory:i}})}handleFocusHistory(e){e.preventDefault(),e.stopPropagation();const{focusCommandHistory:t}=this.props;t()}handleLogMessage(e){const{isPrintStdOutEnabled:t}=this.state;!t||ri.isOutputLevel(e.logLevel)&&this.queueLogMessage(e.message,e.logLevel)}queueLogMessage(e,t){const n={};ri.isErrorLevel(t)?n.error=e:n.message=e;const s={command:void 0,result:n};this.queuedLogMessages.push(s),this.processLogMessageQueue()}openUpdatedItems(e){const{isAutoLaunchPanelsEnabled:t}=this.state;if(e==null||!t)return;const{openObject:n}=this.props;[...e.created,...e.updated].forEach(s=>n(s))}closeRemovedItems(e){if(e==null||e.removed==null||e.removed.length===0)return;const{closeObject:t}=this.props,{removed:n}=e;n.forEach(s=>t(s))}updateHistory(e,t){const n=t;e==null||e.changes==null||n==null||(n.endTime=Date.now(),this.scrollConsoleHistoryToBottom(),this.setState(s=>({consoleHistory:s.consoleHistory.concat()})))}updateKnownObjects(e){let t;if(e.result&&(t=e.result.changes),!t||(t.created==null||t.created.length===0)&&(t.updated==null||t.updated.length===0)&&(t.removed==null||t.removed.length===0)){hn.debug2("updateKnownObjects no changes");return}this.setState(n=>{let{consoleHistory:s}=n;const i=s.lastIndexOf(e);if(i<0)return hn.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:d}=a;O(d);const u=o.get(d);if(u!=null&&u>=0){s===n.consoleHistory&&(s=s.concat());const p={...s[u],disabledObjects:[...(m=s[u].disabledObjects)!=null?m:[],d]};s[u]=p}o.set(d,i),c?r.delete(d):r.set(d,a)};return t==null||t.updated.forEach(a=>l(a)),t==null||t.removed.forEach(a=>l(a,!0)),t==null||t.created.forEach(a=>{const{title:c}=a;O(c),o.set(c,i),r.set(c,a)}),{objectHistoryMap:o,objectMap:r,consoleHistory:s}})}updateObjectMap(){const{objectMap:e}=this.props;this.setState({objectMap:e})}updateWorkspaceHistoryItem(e,t){const n=this.pending.add(t),s=new Date().toJSON();n.then(i=>{const o={...i,data:{...i.data,endTime:s,result:e}},{commandHistoryStorage:r,language:l}=this.props;r.updateItem(l,o).catch(a=>{hn.warn("Error updating command history storage",a)})}).catch(i=>{hn.debug("Error updating workspace history item",i)})}scrollConsoleHistoryToBottom(e=!1){const t=this.consoleHistoryScrollPane.current;O(t),!(!e&&t.scrollTop<t.scrollHeight-t.offsetHeight)&&window.requestAnimationFrame(()=>{t.scrollTop=t.scrollHeight})}handleScrollPaneScroll(){const e=this.consoleHistoryScrollPane.current;O(e),e.scrollTop>0&&e.scrollHeight>e.clientHeight?this.setState({isScrollDecorationShown:!0}):this.setState({isScrollDecorationShown:!1})}handleToggleAutoLaunchPanels(){this.setState(e=>({isAutoLaunchPanelsEnabled:!e.isAutoLaunchPanelsEnabled}))}handleToggleClosePanelsOnDisconnect(){this.setState(e=>({isClosePanelsOnDisconnectEnabled:!e.isClosePanelsOnDisconnectEnabled}))}handleTogglePrintStdout(){this.setState(e=>({isPrintStdOutEnabled:!e.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(e){this.setState({csvFile:e,csvPaste:null})}handleCsvPaste(e){this.setState({csvFile:null,csvPaste:e})}handleDragEnter(e){if(e.dataTransfer==null||e.dataTransfer.items==null||e.dataTransfer.items.length===0||e.dataTransfer.items[0].kind==="string")return;e.preventDefault(),e.stopPropagation(),this.setState({showCsvOverlay:!0});const{items:t}=e.dataTransfer;if(t.length>1){this.setState({dragError:wn.MULTIPLE_FILE_ERROR});return}const n=t[0];wn.isValidDropItem(n)?this.setState({dragError:null}):this.setState({dragError:wn.FILE_TYPE_ERROR})}handleDragLeave(e){e.currentTarget==null||e.currentTarget instanceof Element&&e.relatedTarget instanceof Element&&e.currentTarget.contains(e.relatedTarget)||(e.preventDefault(),e.stopPropagation(),this.setState({showCsvOverlay:!1,dragError:null}))}handleClearDragError(){this.setState({dragError:null})}handleOpenCsvTable(e){const{openObject:t,commandHistoryStorage:n,language:s,scope:i}=this.props,{consoleHistory:o,objectMap:r}=this.state,l={name:e,title:e,type:I.VariableType.TABLE},a=r.has(e),c={startTime:Date.now(),endTime:Date.now(),disabledObjects:[],result:{changes:{created:[],updated:[],removed:[],[a?"updated":"created"]:[l]}}},d=o.concat(c);this.setState({consoleHistory:d}),this.scrollConsoleHistoryToBottom(!0),this.updateKnownObjects(c),t({name:e,title:e,type:I.VariableType.TABLE}),n.addItem(s,i,e,{command:e,startTime:new Date().toJSON(),endTime:new Date().toJSON()})}addConsoleHistoryMessage(e,t){const{consoleHistory:n}=this.state,s={command:"",startTime:Date.now(),endTime:Date.now(),result:{message:e,error:t}},i=n.concat(s);this.setState({consoleHistory:i})}handleCsvUpdate(e){this.addConsoleHistoryMessage(e)}handleCsvError(e){this.addConsoleHistoryMessage(void 0,e!=null?`${e}`:void 0)}handleCsvInProgress(e){this.setState({csvUploadInProgress:e})}handleOverflowActions(){const{isAutoLaunchPanelsEnabled:e,isClosePanelsOnDisconnectEnabled:t,isPrintStdOutEnabled:n}=this.state,{actions:s}=this.props;return[...s,{title:"Print Stdout",action:this.handleTogglePrintStdout,group:oe.groups.high,icon:n?Wn:void 0,order:10},{title:"Auto Launch Panels",action:this.handleToggleAutoLaunchPanels,group:oe.groups.high,icon:e?Wn:void 0,order:20},{title:"Close Panels on Disconnect",action:this.handleToggleClosePanelsOnDisconnect,group:oe.groups.high,icon:t?Wn:void 0,order:30},{title:"Upload Table from File",action:this.handleUploadCsv,group:oe.groups.high+10,order:40}]}handleCommandSubmit(e){if(e==="clear"||e==="cls")this.clearConsoleHistory();else if(e.length>0){const{session:t}=this.props;t.runCode(e).catch(n=>{hn.error("There was an error initiating the command",n)})}else{const t={command:" ",result:{},startTime:Date.now(),endTime:Date.now()};this.scrollConsoleHistoryToBottom(!0),this.setState(n=>({consoleHistory:n.consoleHistory.concat(t)}))}}clearConsoleHistory(){this.pending.cancel(),this.setState(e=>{const t=new Map([...e.objectHistoryMap.keys()].map(n=>[n,-1]));return{consoleHistory:[],objectHistoryMap:t}})}addCommand(e,t=!0,n=!1){!this.consoleInput.current||(this.consoleInput.current.setConsoleText(e,t,n),t&&this.scrollConsoleHistoryToBottom(!0))}focus(){var e;(e=this.consoleInput.current)==null||e.focus()}sendSettingsChange(e,t,n=!0){const s=Object.keys(Vl),i={};let o=!1;for(let l=0;l<s.length;l+=1){const a=s[l],{[a]:c}=t,{[a]:d}=e;c!==d&&(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:e,historyChildren:t,language:n,statusBarChildren:s,openObject:i,session:o,scope:r,commandHistoryStorage:l,timeZone:a,disabled:c,unzip:d}=this.props,{consoleHeight:u,consoleHistory:m,isScrollDecorationShown:p,objectMap:g,showCsvOverlay:f,csvFile:C,csvPaste:w,dragError:b,csvUploadInProgress:S}=this.state,E=this.getObjects(g),v=Math.round(u*.7),y=this.getContextActions(e);return R("div",{role:"presentation",className:G("iris-console","h-100","w-100",{disabled:c}),children:[R("div",{className:"console-pane",ref:this.consolePane,children:[h(fc,{session:o,overflowActions:this.handleOverflowActions,openObject:i,objects:E,children:s}),R("div",{className:"console-csv-container",onDragOver:wn.handleDragOver,onDragEnter:this.handleDragEnter,onDragLeave:this.handleDragLeave,children:[f&&h(wn,{onCancel:this.handleCsvFileCanceled,onFileOpened:this.handleCsvFileOpened,onPaste:this.handleCsvPaste,clearDragError:this.handleClearDragError,dragError:b,onError:this.handleCsvError,uploadInProgress:S,allowZip:d!=null}),R("div",{role:"presentation",className:G("scroll-pane no-scroll-x",{"scroll-decoration":p}),onScroll:this.handleScrollPaneScroll,ref:this.consoleHistoryScrollPane,children:[h(cc,{items:m,openObject:i,language:n,disabled:c}),t]})]}),!f&&h(eo,{ref:this.consoleInput,session:o,language:n,scope:r,onSubmit:this.handleCommandSubmit,maxHeight:v,commandHistoryStorage:l}),f&&h(gc,{session:o,onOpenTable:this.handleOpenCsvTable,onClose:this.handleHideCsv,onUpdate:this.handleCsvUpdate,onError:this.handleCsvError,file:C!=null?C:void 0,paste:w!=null?w:void 0,onInProgress:this.handleCsvInProgress,timeZone:a,unzip:d})]}),h(oe,{actions:y,ignoreClassNames:[eo.INPUT_CLASS_NAME]})]})}};let Cc=ri;Cc.defaultProps={statusBarChildren:null,settings:{},onSettingsChange:()=>{},scope:null,actions:[],historyChildren:null,timeZone:"America/New_York",objectMap:new Map,disabled:!1,unzip:null};Cc.LOG_THROTTLE=500;class Hr extends T.exports.Component{constructor(t){super(t),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(t){if(this.editor){const n=this.editor.getModel();O(n),bn.setModelLanguage(n,t)}}handleResize(){this.updateDimensions()}toggleFind(){this.editor&&(this.editor.focus(),this.editor.trigger("toggleFind","actions.find",void 0))}updateDimensions(){var t;(t=this.editor)==null||t.layout()}initEditor(){const{onEditorInitialized:t}=this.props;let{settings:n}=this.props;n={copyWithSyntaxHighlighting:!1,fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:"python",lineNumbersMinChars:3,minimap:{enabled:!1},scrollBeyondLastLine:!1,tabCompletion:"on",value:"",wordWrap:"off",...n},O(this.container),this.editor=bn.create(this.container,n),this.editor.addAction({id:"find",label:"Find",keybindings:[Dt.CtrlCmd|Qt.KeyF],precondition:void 0,keybindingContext:void 0,contextMenuGroupId:"navigation",contextMenuOrder:1,run:()=>{this.toggleFind()}}),this.editor.layout(),Ve.removeConflictingKeybindings(this.editor),t(this.editor)}destroyEditor(){const{onEditorWillDestroy:t}=this.props;O(this.editor),t(this.editor),this.editor.dispose(),this.editor=void 0}render(){const{className:t}=this.props;return h("div",{className:G("editor-container",t),ref:n=>{this.container=n}})}}Hr.defaultProps={className:"fill-parent-absolute",onEditorInitialized:()=>{},onEditorWillDestroy:()=>{},settings:{}};const It=ne.module("ScriptEditor");class hf extends T.exports.Component{constructor(t){super(t),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=J.createRef(),this.state={model:null}}componentDidMount(){Ie.addEventListener("onUpdate",this.updateShortcuts)}componentDidUpdate(t){var d,u;const{sessionLanguage:n,settings:s}=this.props,i=s==null?void 0:s.language;i!==((d=t.settings)==null?void 0:d.language)&&(It.debug("Set language",i),this.setLanguage(i));const r=n==null&&t.sessionLanguage!=null,l=i===n,a=((u=t.settings)==null?void 0:u.language)===t.sessionLanguage;(r||n!==void 0&&a&&!l)&&(It.debug("De-init completion and context actions"),this.deInitContextActions(),this.deInitCodeCompletion()),(n!=null&&t.sessionLanguage==null&&l||n!==void 0&&!a&&l)&&(It.debug("Init completion and context actions"),this.initContextActions(),this.initCodeCompletion())}componentWillUnmount(){Ie.removeEventListener("onUpdate",this.updateShortcuts)}getValue(){return this.editor?this.editor.getValue():(It.error("Editor not initialized"),null)}getSelectedCommand(){var c,d;const t=(c=this.editor)==null?void 0:c.getSelection();O(t);const n=(d=this.editor)==null?void 0:d.getModel();O(n);const{startLineNumber:s,endColumn:i}=t;let{endLineNumber:o}=t;i===1&&o>s&&(o-=1);const r=n==null?void 0:n.getLineMinColumn(s),l=n==null?void 0:n.getLineMaxColumn(o),a=t.setStartPosition(s,r).setEndPosition(o,l);return n==null?void 0:n.getValueInRange(a)}handleEditorInitialized(t){const{focusOnMount:n,onChange:s,onEditorInitialized:i,settings:o,session:r,sessionLanguage:l}=this.props;It.debug("handleEditorInitialized",l,r,o),this.editor=t,this.setState({model:this.editor.getModel()}),Ve.setEOL(t),Ve.registerPasteHandler(t),r!=null&&o&&l===o.language&&(this.initContextActions(),this.initCodeCompletion()),t.onDidChangeModelContent(s),n!=null&&n&&t.focus(),i(this.editor)}handleEditorWillDestroy(t){It.debug("handleEditorWillDestroy");const{onEditorWillDestroy:n}=this.props;n(t),this.deInitContextActions(),this.deInitCodeCompletion(),this.setState({model:null}),this.editor=void 0}handleRun(){const{onRunCommand:t}=this.props,n=this.getValue();n!=null&&t(n)}handleRunSelected(){const{onRunCommand:t}=this.props,n=this.getSelectedCommand();t(n)}initContextActions(){if(this.contextActionCleanups.length>0){It.error("Context actions already initialized.");return}if(!this.editor)return;const t=[];t.push(this.editor.addAction({id:"run-code",label:"Run",keybindings:[Ve.getMonacoKeyCodeFromShortcut(us.NOTEBOOK.RUN)],contextMenuGroupId:"navigation",contextMenuOrder:1.5,run:()=>{this.handleRun()}})),t.push(this.editor.addAction({id:"run-selected-code",label:"Run Selected",keybindings:[Ve.getMonacoKeyCodeFromShortcut(us.NOTEBOOK.RUN_SELECTED)],contextMenuGroupId:"navigation",contextMenuOrder:1.5,run:()=>{this.handleRunSelected()}})),this.contextActionCleanups=t}deInitContextActions(){this.contextActionCleanups.length>0&&(this.contextActionCleanups.forEach(t=>t.dispose()),this.contextActionCleanups=[])}updateShortcuts(){this.deInitContextActions(),this.initContextActions()}initCodeCompletion(){if(this.completionCleanup!=null){It.error("Code completion already initialized.");return}const{session:t}=this.props;It.debug("initCodeCompletion",this.editor,t),this.editor&&t!=null&&(this.completionCleanup=Ve.openDocument(this.editor,t))}deInitCodeCompletion(){const{session:t}=this.props;It.debug("deInitCodeCompletion",this.editor,t),this.completionCleanup&&(this.completionCleanup.dispose(),this.completionCleanup=void 0,this.editor&&t!=null&&Ve.closeDocument(this.editor,t))}append(t,n=!0){O(this.editor);const s=this.editor.getModel();O(s);const i=s.getValue();i?s.setValue(`${i}
|
|
23
|
+
${t}`):s.setValue(`${t}`);const o=s.getLineCount(),r=s.getLineLength(o)+1;this.editor.setPosition({lineNumber:o,column:r}),n&&this.editor.focus()}updateDimensions(){It.debug("updateDimensions"),this.editor&&this.editor.layout()}focus(){It.debug("focus"),this.editor&&this.editor.focus()}toggleFind(){this.editorComponent.current&&this.editorComponent.current.toggleFind()}setLanguage(t){this.editorComponent.current&&t!==void 0&&this.editorComponent.current.setLanguage(t)}render(){var u;const{error:t,isLoaded:n,isLoading:s,session:i,sessionLanguage:o,settings:r}=this.props,{model:l}=this.state,a=t?`Unable to open document. ${t}`:null,c=r&&(u=r.language)!=null?u:null,d=l&&i&&c===o;return R(Fe,{children:[(t||s)&&h("div",{className:"h-100 w-100 position-relative",children:h(Ta,{errorMessage:a,isLoading:s,isLoaded:n})}),n&&h("div",{className:"h-100 w-100 script-editor",children:r&&R(Fe,{children:[h(Hr,{ref:this.editorComponent,settings:r,onEditorInitialized:this.handleEditorInitialized,onEditorWillDestroy:this.handleEditorWillDestroy}),d!=null&&d&&h(dc,{model:l,language:c,session:i})]})})]})}}hf.defaultProps={error:null,isLoading:!1,isLoaded:!1,focusOnMount:!0,onChange:()=>{},onEditorInitialized:()=>{},onEditorWillDestroy:()=>{},session:null};const mf=250,pf=2500,wc=class extends T.exports.Component{constructor(e){super(e),this.loadData=Et(()=>{const{commandHistoryStorage:t,item:n,language:s}=this.props,{id:i}=n;this.cleanup=t.listenItem(s,i,this.handleUpdate,this.handleError)},mf),this.getPreviewText=he(t=>t.split(`
|
|
24
|
+
`,pf).join(`
|
|
25
|
+
`),{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(e,t){if(e==null||t===""||t===0)return null;const n=Math.round((new Date(t).valueOf()-new Date(e).valueOf())/1e3);return n<1?"<1s":Jt.formatElapsedTime(n)}componentDidMount(){this.loadData()}componentDidUpdate(e,t){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=t.data)!=null&&s.result)||Boolean(n==null?void 0:n.endTime)&&!(t.data==null||t.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(e){this.setState({error:`${e}`})}handleUpdate(e){const{data:t}=e!=null?e:{};this.setState({data:t});const{onUpdate:n}=this.props;n==null||n(t)}handleTimeout(){this.updateTime()}render(){var m;const{item:{name:e},language:t}=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=wc.getTimeString(r,l!=null?l:n),d=this.getPreviewText(e),u=Boolean(c);return R("div",{className:"command-history-item-tooltip",children:[R("div",{className:"scroll-container",children:[h(ic,{language:t,children:d}),d.length<e.length&&h("p",{children:"Preview Truncated..."})]}),R("div",{className:"result-info",children:[R("div",{className:"d-flex justify-content-between",children:[Boolean(a)&&R("div",{className:"text-danger mr-1",children:[h(Q,{icon:$n})," Executed with errors"]}),R("div",{className:"time-wrapper",children:["Elapsed time:"," ",u?h("span",{className:"time-string",children:c}):h(Ht,{})]})]}),Boolean(a)&&h("div",{className:"error-message",children:a})]})]})}};let bc=wc;bc.defaultProps={onUpdate:()=>{}};const gf=512;function Sc(e){const{item:t,language:n,isSelected:s,commandHistoryStorage:i}=e,o=t.name.substring(0,gf),r=T.exports.useRef(null),l=T.exports.useCallback(()=>{var a;(a=r.current)==null||a.update()},[r]);return R("div",{className:G("command-history-item",{selected:s}),children:[o,h(Be,{ref:r,interactive:!0,options:{placement:"left",modifiers:{preventOverflow:{enabled:!0,boundariesElement:"viewport",order:825}}},popperClassName:"command-history-item-popper",children:h(bc,{item:t,language:n,onUpdate:l,commandHistoryStorage:i})})]})}Sc.defaultProps={isSelected:!1};class so extends T.exports.Component{static itemKey(t,n){return`${n.title}`}static renderContent(t){return t.selectionRequired!==void 0&&t.selectionRequired?R("div",{className:"fa-md fa-layers",children:[h(Q,{icon:ro,mask:t.icon,transform:"right-5 down-5 shrink-4"}),h(Q,{icon:kd,transform:"shrink-3 right-7 down-6"})]}):h(Q,{icon:t.icon})}render(){const{actions:t,hasSelection:n}=this.props;return h("div",{className:"command-history-actions",children:t.map((s,i)=>h(K,{kind:"inline",className:G(s.className),onClick:s.action,tooltip:s.description,disabled:s.selectionRequired!==void 0&&s.selectionRequired&&!n,icon:so.renderContent(s)},so.itemKey(i,s)))})}}const ff=150,Ul=3,Bl=ne.module("CommandHistoryViewportUpdater");function Cf({table:e,columns:t,top:n=0,bottom:s=0,search:i,isReversed:o=!1,onUpdate:r}){const l=T.exports.useMemo(()=>Xn(a=>{const c=a.bottom-a.top,d=Math.max(0,a.top-c*Ul),u=a.bottom+c*Ul;e.setViewport({top:d,bottom:u,columns:a.columns})},ff),[e]);return T.exports.useEffect(function(){const c=e.onUpdate(d=>{var u,m;r({items:(u=d.items)!=null?u:[],offset:(m=d.offset)!=null?m:0})});return()=>{Bl.debug("onUpdate cleanup"),c()}},[e,r]),T.exports.useEffect(function(){e.setSearch(i!=null?i:"")},[e,i]),T.exports.useEffect(function(){l({top:n,bottom:s,columns:t})},[l,n,s,t,i,o]),T.exports.useEffect(()=>()=>{Bl.debug2("Cancel throttledUpdateViewport"),l.cancel()},[l]),null}const An=ne.module("CommandHistory"),fn=class extends T.exports.Component{constructor(e){super(e),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:zd,shortcut:Tr.COPY,action:this.copySelectedCommands,group:oe.groups.edit},{title:"Send to Console",description:"Open selected commands in the console",icon:el,shortcut:us.COMMAND_HISTORY.SEND_TO_CONSOLE,action:this.sendToConsole,group:fn.menuGroups.send,order:10},{title:"Run in Console",description:"Run selected commands in the console",icon:eu,shortcut:us.COMMAND_HISTORY.RUN,action:this.runInConsole,group:fn.menuGroups.send,order:10},{title:"Send to Active Notebook",description:"Open selected commands in a notebook",icon:Jr,shortcut:us.COMMAND_HISTORY.SEND_TO_NOTEBOOK,action:this.sendToNotebook,group:fn.menuGroups.send,order:20},{title:"Send to New Notebook",description:"Open selected commands in a new notebook",icon:jd,action:this.createNotebook,group:fn.menuGroups.send,order:30}],this.historyActions=[{title:"Send to Console",icon:el,selectionRequired:!0,description:"Open selected commands in the console",action:this.sendToConsole},{title:"Send to Notebook",icon:Jr,selectionRequired:!0,description:"Open selected commands in a notebook",action:this.sendToNotebook}],this.pending=new uo,this.searchInputRef=J.createRef(),this.itemListRef=J.createRef();const{table:t}=e;this.state={actions:[],historyActions:this.historyActions,top:0,bottom:0,itemCount:t.size,items:[],offset:0,selectedRanges:[],searchText:""}}static getCommandsFromViewport(e,t,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>=t&&r<t+e.length){const{name:l}=e[r-t];s.push(l)}}return s}static async getCommandsFromSnapshot(e,t){return[...(await e.getSnapshot(t)).values()].map(s=>s.name)}componentWillUnmount(){this.pending.cancel()}async getSelectedCommands(){const{items:e,offset:t,selectedRanges:n}=this.state,s=n.slice().sort((o,r)=>o[0]-r[0]);if(s.length===0)return[];if(s[0][0]>=t&&s[s.length-1][1]<t+e.length)return fn.getCommandsFromViewport(e,t,s);const{table:i}=this.props;return this.pending.add(fn.getCommandsFromSnapshot(i,s))}getSelectedCommandText(){return this.getSelectedCommands().then(e=>e.join(`
|
|
26
|
+
`))}updateActions(){this.setState(e=>{const{selectedRanges:t}=e,n=t.reduce((s,i)=>s+i[1]-i[0]+1,0);return n>0&&n<fn.MAX_SELECTION_COUNT?(An.debug("Updating actions",this.itemActions),{actions:this.itemActions}):(An.debug("Disabling actions",n),{actions:[]})})}copySelectedCommands(){this.getSelectedCommandText().then(ui).catch(An.error)}createNotebook(){this.getSelectedCommandText().then(e=>{const{language:t,sendToNotebook:n}=this.props;n({value:e,language:t},!0)}).catch(An.error)}sendToNotebook(){this.getSelectedCommandText().then(e=>{const{language:t,sendToNotebook:n}=this.props;n({value:e,language:t})}).catch(An.error)}sendToConsole(){const{sendToConsole:e}=this.props;this.getSelectedCommandText().then(e).catch(An.error)}runInConsole(){this.getSelectedCommandText().then(e=>{const{sendToConsole:t}=this.props;t(e,!0,!0)}).catch(An.error)}handleSelect(e){const{sendToConsole:t}=this.props,{items:n,offset:s}=this.state;if(e<s||e>=s+n.length){An.error("Invalid index!",e);return}const{name:i}=n[e-s];t(i)}handleSelectionChange(e){this.setState({selectedRanges:e}),this.updateActions()}handleViewportChange(e,t){this.setState({top:e,bottom:t})}handleSearchChange(e){this.setState({searchText:e.target.value,selectedRanges:[]})}handleViewportUpdate({items:e,offset:t}){const{table:n}=this.props,s=n.size;this.setState({items:e,itemCount:s,offset:t})}renderItem({item:e,itemIndex:t,isSelected:n}){const{language:s,commandHistoryStorage:i}=this.props;return h(Sc,{isSelected:n,item:e,language:s,commandHistoryStorage:i})}focus(){this.searchInputRef.current&&this.searchInputRef.current.focus()}restoreScrollPosition(){var e;(e=this.itemListRef.current)==null||e.restoreScrollPosition()}render(){var m;const{language:e,table:t}=this.props,{actions:n,historyActions:s,searchText:i,top:o,bottom:r,items:l,itemCount:a,offset:c,selectedRanges:d}=this.state,u=(m=yg.LANGUAGE_MAP.get(e))!=null?m:"";return R("div",{className:"command-history",children:[R("div",{className:"command-history-search-bar",children:[h(Qn,{ref:this.searchInputRef,value:i,placeholder:`${u} Command History`,onChange:this.handleSearchChange}),h(so,{actions:s,hasSelection:d.length>0})]}),R("div",{className:"command-history-list",children:[h(nn,{ref:this.itemListRef,itemCount:a,items:l,offset:c,selectedRanges:d,onSelect:this.handleSelect,onSelectionChange:this.handleSelectionChange,onViewportChange:this.handleViewportChange,renderItem:this.renderItem,rowHeight:fn.ITEM_HEIGHT,isDoubleClickSelect:!0,isMultiSelect:!0,isStickyBottom:!0}),h(Cf,{table:t,top:o,bottom:r,search:i,onUpdate:this.handleViewportUpdate}),h(oe,{actions:n})]})]})}};let _r=fn;_r.ITEM_HEIGHT=29;_r.MAX_SELECTION_COUNT=1e4;_r.menuGroups={send:oe.groups.medium+100};class wf extends T.exports.PureComponent{constructor(t){super(t),this.handleSwitchClick=this.handleSwitchClick.bind(this)}handleSwitchClick(){const{logLevel:t,onClick:n}=this.props;n(t)}render(){const{logLevel:t,on:n}=this.props;return R("div",{className:G("log-level-menu-item",t),children:[h(Ea,{on:n,onClick:this.handleSwitchClick}),t]})}}const ot=class extends T.exports.PureComponent{constructor(e){super(e),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(e){const t=new Date(e.micros/1e3);return`${Ps.formatTimestamp(t)} ${e.logLevel} ${e.message}`}componentDidMount(){this.resetLogLevels(),this.initMonaco(),this.startListening(),window.addEventListener("resize",this.handleResize)}componentDidUpdate(e,t){this.updateDimensions();const{shownLogLevels:n}=this.state;t.shownLogLevels!==n&&this.refreshLogText();const{session:s}=this.props;e.session!==s&&(this.stopListening(),this.startListening(),this.clearLogs())}componentWillUnmount(){this.stopFlushTimer(),this.stopListening(),this.destroyMonaco(),window.removeEventListener("resize",this.handleResize)}getMenuActions(e){const t=[];t.push({menuElement:h("div",{className:"log-level-menu-title",children:"Display Log Levels"}),group:1,order:10});for(let n=0;n<ot.AllLogLevels.length;n+=1){const s=ot.AllLogLevels[n],i=e[s]!=null?e[s]:!1;t.push({title:s,group:1,order:n+100,menuElement:h(wf,{logLevel:s,on:i,onClick:this.handleMenuItemClick,ref:o=>{o!=null&&(this.logLevelMenuItems[s]=o)}})})}return t.push({group:1,order:1e3,menuElement:R("div",{className:"log-level-menu-controls",children:[h(K,{kind:"ghost",className:"log-level-toggle-all",onClick:this.handleToggleAllClick,children:"Toggle All"}),h(K,{kind:"ghost",onClick:this.handleResetClick,children:"Reset"})]})}),t}resetLogLevels(){const e={};for(let t=0;t<ot.AllLogLevels.length;t+=1){const n=ot.AllLogLevels[t],s=ot.DefaultLogLevels.some(i=>i===n);e[n]=s}this.setState({shownLogLevels:e})}startListening(){const{session:e}=this.props;this.cancelListener=e.onLogMessage(this.handleLogMessage)}stopListening(){this.cancelListener!=null&&(this.cancelListener(),this.cancelListener=void 0)}initMonaco(){O(this.editorContainer),this.editor=bn.create(this.editorContainer,{copyWithSyntaxHighlighting:!1,fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:"log",lineDecorationsWidth:0,lineNumbers:"off",lineNumbersMinChars:0,minimap:{enabled:!1},readOnly:!0,renderLineHighlight:"none",scrollBeyondLastLine:!1,value:"",wordWrap:"on"}),this.editor.addCommand(Qt.Escape,()=>{}),this.editor.addCommand(Dt.Shift|Qt.Escape,()=>{}),this.editor.addCommand(Qt.Escape,()=>{var t,n;const e=(t=this.editor)==null?void 0:t.getPosition();O(e),(n=this.editor)==null||n.setPosition(e)},"findWidgetVisible && editorTextFocus"),this.editor.addCommand(Dt.Shift|Qt.Escape,()=>{var t,n;const e=(t=this.editor)==null?void 0:t.getPosition();O(e),(n=this.editor)==null||n.setPosition(e)},"findWidgetVisible && editorTextFocus")}destroyMonaco(){this.editor&&(this.editor.dispose(),this.editor=void 0)}triggerFindWidget(){var e,t;(e=this.editor)==null||e.focus(),(t=this.editor)==null||t.trigger("keyboard","actions.find",void 0)}toggleAll(){const{shownLogLevels:e}=this.state;let t=!0;for(let n=0;n<ot.AllLogLevels.length;n+=1){const s=ot.AllLogLevels[n];if(!e[s]){t=!1;break}}if(t)this.setState({shownLogLevels:{}});else{const n={};for(let s=0;s<ot.AllLogLevels.length;s+=1){const i=ot.AllLogLevels[s];n[i]=!0}this.setState({shownLogLevels:n})}}toggleLogLevel(e){const{shownLogLevels:t}=this.state,n=t[e],s={};s[e]=!n,this.updateLogLevels(s)}updateLogLevels(e){let{shownLogLevels:t}=this.state;t={...t,...e},this.setState({shownLogLevels:t})}appendLogText(e){if(!this.editor)return;const t=this.editor.getModel();let n=t==null?void 0:t.getLineCount();O(n);let s=t==null?void 0:t.getLineLength(n);O(s);const i=this.isBottomVisible(),o=[];if(s>0&&(o.push({range:{startLineNumber:n,startColumn:s+1,endLineNumber:n,endColumn:s+1},text:`
|
|
27
|
+
`,forceMoveMarkers:!0}),n+=1,s=0),o.push({range:{startLineNumber:n,startColumn:s,endLineNumber:n,endColumn:s},text:e,forceMoveMarkers:!0}),t==null||t.applyEdits(o),i){const r=t==null?void 0:t.getLineCount();O(r),this.editor.revealLine(r,1)}}refreshLogText(){var s;if(!this.editor)return;this.truncateLogIfNecessary();const{shownLogLevels:e}=this.state,t=this.isBottomVisible();let n="";for(let i=0;i<this.messages.length;i+=1){const o=this.messages[i];if(e[o.logLevel]){const r=ot.getLogText(o);r.length>0&&(n+=r,r.charAt(r.length-1)!==`
|
|
28
|
+
`&&(n+=`
|
|
29
|
+
`))}}if(n=n.trimRight(),this.editor.setValue(n),t){const i=(s=this.editor.getModel())==null?void 0:s.getLineCount();O(i),this.editor.revealLine(i,1)}this.stopFlushTimer(),this.bufferedMessages=[]}truncateLogIfNecessary(){this.messages.length>ot.maxLogSize&&(this.messages=this.messages.splice(this.messages.length-ot.truncateSize))}scrollToBottom(){var t,n,s;if(!this.editor)return;const e=(s=(n=(t=this.editor)==null?void 0:t.getModel)==null?void 0:n.call(t))==null?void 0:s.getLineCount();O(e),this.editor.revealLine(e,1)}isBottomVisible(){if(!this.editor)return!0;const e=this.editor.getModel(),t=e==null?void 0:e.getLineCount();return O(t),this.isLineVisible(t)}isLineVisible(e){var n;const t=(n=this.editor)==null?void 0:n.getVisibleRanges();if(t==null||t.length===0)return!1;for(let s=0;s<t.length;s+=1){const i=t[s];if(i.startLineNumber<=e&&e<=i.endLineNumber)return!0}return!1}isLogItemVisible(e){const{shownLogLevels:t}=this.state;return t[e.logLevel]}flush(){let e="";for(let t=0;t<this.bufferedMessages.length;t+=1){const n=this.bufferedMessages[t],s=ot.getLogText(n);e+=s,s.charAt(s.length-1)!==`
|
|
30
|
+
`&&(e+=`
|
|
31
|
+
`)}this.bufferedMessages=[],this.appendLogText(e)}queue(e){this.bufferedMessages.push(e),this.bufferedMessages.length===1&&(this.flushTimer=setTimeout(this.handleFlushTimeout,ot.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(e){this.messages.push(e),this.editor&&this.isLogItemVisible(e)&&this.queue(e)}handleMenuItemClick(e){this.toggleLogLevel(e)}handleResetClick(){this.resetLogLevels()}handleResize(){this.updateDimensions()}handleToggleAllClick(){this.toggleAll()}render(){const e={placement:"bottom-end"},{shownLogLevels:t}=this.state,n=this.getMenuActions(t);return R("div",{className:"log-pane h-100 w-100",children:[R("div",{className:"log-pane-menu",children:[h(K,{kind:"ghost",className:"btn-clear-logs",onClick:this.handleClearClick,icon:yu,tooltip:"Clear log"}),h(K,{kind:"ghost",className:"btn-link-icon btn-overflow",icon:Wd,tooltip:"Log Settings",onClick:()=>{},children:h(qn,{actions:n,popperClassName:"log-level-menu-popper",popperOptions:e})})]}),h("div",{className:"log-pane-editor h-100 w-100",ref:s=>{this.editorContainer=s}})]})}};let gi=ot;gi.DefaultLogLevels=[je.STDOUT,je.ERROR,je.FATAL,je.STDERR,je.WARN];gi.AllLogLevels=[je.INFO,je.STDOUT,je.ERROR,je.FATAL,je.STDERR,je.WARN,je.DEBUG,je.TRACE];gi.bufferTimeout=16;gi.maxLogSize=131072;gi.truncateSize=65536;qi.register([qc,Kc,Xc,Yc,Qc,jc]);const bf=typeof xo=="function"?xo(qi):xo.default(qi),Cn=class{constructor(){this.listeners=[],this.isDownsamplingDisabled=!1}getData(){return[]}getDefaultTitle(){return""}getLayout(){return{}}getFilterColumnMap(){return new Map}isFilterRequired(){return!1}setFilter(e){}close(){}setFormatter(e){this.formatter=e}setDownsamplingDisabled(e){this.isDownsamplingDisabled=e}setDimensions(e){this.rect=e}setTitle(e){this.title=e}subscribe(e){this.listeners.push(e)}unsubscribe(e){this.listeners=this.listeners.filter(t=>t!==e)}fireEvent(e){for(let t=0;t<this.listeners.length;t+=1)this.listeners[t](e)}fireUpdate(e){this.fireEvent(new CustomEvent(Cn.EVENT_UPDATED,{detail:e}))}fireDisconnect(){this.fireEvent(new CustomEvent(Cn.EVENT_DISCONNECT))}fireReconnect(){this.fireEvent(new CustomEvent(Cn.EVENT_RECONNECT))}fireDownsampleStart(e){this.fireEvent(new CustomEvent(Cn.EVENT_DOWNSAMPLESTARTED,{detail:e}))}fireDownsampleFinish(e){this.fireEvent(new CustomEvent(Cn.EVENT_DOWNSAMPLEFINISHED,{detail:e}))}fireDownsampleFail(e){this.fireEvent(new CustomEvent(Cn.EVENT_DOWNSAMPLEFAILED,{detail:e}))}fireDownsampleNeeded(e){this.fireEvent(new CustomEvent(Cn.EVENT_DOWNSAMPLENEEDED,{detail:e}))}fireLoadFinished(){this.fireEvent(new CustomEvent(Cn.EVENT_LOADFINISHED))}};let Ze=Cn;Ze.EVENT_UPDATED="ChartModel.EVENT_UPDATED";Ze.EVENT_DISCONNECT="ChartModel.EVENT_DISCONNECT";Ze.EVENT_RECONNECT="ChartModel.EVENT_RECONNECT";Ze.EVENT_DOWNSAMPLESTARTED="ChartModel.EVENT_DOWNSAMPLESTARTED";Ze.EVENT_DOWNSAMPLEFINISHED="ChartModel.EVENT_DOWNSAMPLEFINISHED";Ze.EVENT_DOWNSAMPLEFAILED="ChartModel.EVENT_DOWNSAMPLEFAILED";Ze.EVENT_DOWNSAMPLENEEDED="ChartModel.EVENT_DOWNSAMPLENEEDED";Ze.EVENT_LOADFINISHED="ChartModel.EVENT_LOADFINISHED";const Sf="#76d9e4 #9edc6f #fcd65b #aa9af4 #f37e3f #f95d84 #f0f0ee",vf="#403e41",Tf="#5b5a5c",Ef="#c0bfbf",yf="#4878ea",Rf="rgba(91, 90, 92, 0.7)",tt={"paper-bgcolor":"#2d2a2e","plot-bgcolor":"#322f33","title-color":"#f0f0ee",colorway:Sf,gridcolor:vf,linecolor:Tf,zerolinecolor:Ef,activecolor:yf,rangebgcolor:Rf,"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"},_n=Object.freeze({paper_bgcolor:tt["paper-bgcolor"],plot_bgcolor:tt["plot-bgcolor"],title_color:tt["title-color"],colorway:tt.colorway,gridcolor:tt.gridcolor,linecolor:tt.linecolor,zerolinecolor:tt.zerolinecolor,activecolor:tt.activecolor,rangebgcolor:tt.rangebgcolor,area_color:tt["area-color"],trend_color:tt["trend-color"],line_color:tt["line-color"],error_band_line_color:tt["error-band-line-color"],error_band_fill_color:tt["error-band-fill-color"],ohlc_increasing:tt["ohlc-increasing"],ohlc_decreasing:tt["ohlc-decreasing"]}),Bi=ne.module("ChartUtils"),On=Object.freeze(I.calendar.DayOfWeek.values()),Gl="io.deephaven.time.DateTime",If=36e5,Mf=1e6;function Df(e){return e.asDate!==void 0}function Nf(e){return e.asNumber!==void 0}function zl(e){return e.dhTimeZone!==void 0}function Ff(e){return e!=null&&e.range!=null&&(e.autorange===!1||e.autorange===void 0)}const j=class{static getPlotlyChartType(e,t){switch(e){case I.plot.SeriesPlotStyle.SCATTER:return t?"scatter":"scattergl";case I.plot.SeriesPlotStyle.LINE:return"scatter";case I.plot.SeriesPlotStyle.BAR:case I.plot.SeriesPlotStyle.STACKED_BAR:return"bar";case I.plot.SeriesPlotStyle.PIE:return"pie";case I.plot.SeriesPlotStyle.TREEMAP:return"treemap";case I.plot.SeriesPlotStyle.HISTOGRAM:return"histogram";case I.plot.SeriesPlotStyle.OHLC:return"ohlc";default:return}}static getPlotlyChartMode(e){switch(e){case I.plot.SeriesPlotStyle.SCATTER:return"markers";case I.plot.SeriesPlotStyle.LINE:return"lines";default:return}}static getPlotlyProperty(e,t){switch(e){case I.plot.SeriesPlotStyle.PIE:switch(t){case I.plot.SourceType.X:return"labels";case I.plot.SourceType.Y:return"values"}break;case I.plot.SeriesPlotStyle.OHLC:switch(t){case I.plot.SourceType.TIME:return"x"}break;case I.plot.SeriesPlotStyle.TREEMAP:switch(t){case I.plot.SourceType.X:return"ids";case I.plot.SourceType.Y:return"values";case I.plot.SourceType.LABEL:return"labels";case I.plot.SourceType.PARENT:return"parents";case I.plot.SourceType.COLOR:return"marker.colors"}break}switch(t){case I.plot.SourceType.X:return"x";case I.plot.SourceType.Y:return"y";case I.plot.SourceType.Z:return"z";case I.plot.SourceType.X_LOW:return"xLow";case I.plot.SourceType.X_HIGH:return"xHigh";case I.plot.SourceType.Y_LOW:return"yLow";case I.plot.SourceType.Y_HIGH:return"yHigh";case I.plot.SourceType.TIME:return"time";case I.plot.SourceType.OPEN:return"open";case I.plot.SourceType.HIGH:return"high";case I.plot.SourceType.LOW:return"low";case I.plot.SourceType.CLOSE:return"close";case I.plot.SourceType.SHAPE:return"shape";case I.plot.SourceType.SIZE:return"size";case I.plot.SourceType.LABEL:return"label";case I.plot.SourceType.COLOR:return"color";case I.plot.SourceType.PARENT:return"parent";case I.plot.SourceType.HOVER_TEXT:return"hovertext";case I.plot.SourceType.TEXT:return"text";default:throw new Error(`Unrecognized source type: ${t}`)}}static getPlotlySeriesOrientation(e){var n,s;const{sources:t}=e;return t.length===2&&((s=(n=t[0])==null?void 0:n.axis)==null?void 0:s.type)===I.plot.AxisType.Y?j.ORIENTATION.HORIZONTAL:j.ORIENTATION.VERTICAL}static getPlotlyErrorBars(e,t,n){const s=n.map((o,r)=>o-e[r]),i=t.map((o,r)=>e[r]-o);return{type:"data",symmetric:!1,array:s,arrayminus:i}}static getPlotlyDateFormat(e,t,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=e==null?void 0:e.getColumnTypeFormatter(t);return o!=null&&zl(o)&&o.dhTimeZone!=null&&o.showTimeZone&&(i=I.i18n.DateTimeFormat.format(" z",new Date,o.dhTimeZone)),{tickformat:s,ticksuffix:i,automargin:!0}}static convertNumberPrefix(e){return e.replace(/\u00A4\u00A4/g,"USD").replace(/\u00A4/g,"$")}static getPlotlyNumberFormat(e,t,n){if(!n)return null;const i=n.split(";")[0].match(/^([^#,0.]*)([#,]*)([0,]*)(\.?)(0*)(#*)(E?0*)(%?)(.*)/);O(i);const[,o,r,l,,a,c,d,u,m]=i,p=l.replace(",","").length,f=r.indexOf(",")>=0||l.indexOf(",")>=0?",":"",C=d!=null&&d!==""?"e":"f",w=u!==""?u:C,b=a.length+c.length,E=`0${p}${f}.${b}${w}`,v=j.convertNumberPrefix(o),y=j.convertNumberPrefix(m);return{tickformat:E,tickprefix:v,ticksuffix:y,automargin:!0}}static getPlotlyAxisFormat(e,t=null){const{axis:n,columnType:s}=e,{formatPattern:i}=n;let o=null;return A.isDateType(s)?(o=j.getPlotlyDateFormat(t,s,i),o=j.addTickSpacing(o,n,!0)):A.isNumberType(s)&&(o=j.getPlotlyNumberFormat(t,s,i),o=j.addTickSpacing(o,n,!1)),n.formatType===I.plot.AxisFormatType.CATEGORY&&(o?o.type="category":o={type:"category",tickformat:void 0,ticksuffix:void 0}),o}static addTickSpacing(e,t,n){const{gapBetweenMajorTicks:s}=t;if(s>0){const i=e||{};let o=s;return n&&(o=s/Mf),t.log&&(o=Math.log(o)),i.tickmode="linear",i.dtick=o,i}return e}static getSourceForAxis(e,t){for(let n=0;n<e.series.length;n+=1){const s=e.series[n];for(let i=0;i<s.sources.length;i+=1){const o=s.sources[i];if(o.axis===t)return o}}return null}static getSeriesVisibility(e,t){return t!=null&&t.hiddenSeries!=null&&t.hiddenSeries.includes(e)?"legendonly":!0}static getHiddenLabels(e){return e!=null&&e.hiddenSeries?[...e.hiddenSeries]:[]}static makeSeriesData(e,t,n,s,i=j.ORIENTATION.VERTICAL){return{type:e,mode:t,name:n,orientation:i,showlegend:s!=null?s:void 0}}static makeSeriesDataFromSeries(e,t,n,s=null,i=_n){const{name:o,plotStyle:r,lineColor:l,shapeColor:a,sources:c}=e,d=c.some(f=>{var C;return(C=f.axis)==null?void 0:C.businessCalendar}),u=j.getChartType(r,d),m=j.getPlotlyChartMode(r),p=j.getPlotlySeriesOrientation(e),g=j.makeSeriesData(u,m,o,s,p);return j.addSourcesToSeriesData(g,r,c,t),j.addStylingToSeriesData(g,r,i,l,a,n),g}static addSourcesToSeriesData(e,t,n,s){const i=e;for(let o=0;o<n.length;o+=1){const r=n[o],{axis:l,type:a}=r,c=j.getPlotlyProperty(t,a);$l(i,c,[]);const d=l!=null?j.getAxisPropertyName(l.type):null;if(d!=null){const u=s.get(l.type);if(u){const m=u.indexOf(l),p=m>0?`${m+1}`:"";i[`${d}axis`]=`${d}${p}`}}}}static addStylingToSeriesData(e,t,n=_n,s=null,i=null,o=null){const r=e;r.marker={line:{}},r.line={width:1},t===I.plot.SeriesPlotStyle.AREA?r.fill="tozeroy":t===I.plot.SeriesPlotStyle.STACKED_AREA?r.stackgroup="stack":t===I.plot.SeriesPlotStyle.STEP?r.line.shape="hv":t===I.plot.SeriesPlotStyle.HISTOGRAM?(r.width=[],r.marker.line!==void 0&&Object.assign(r.marker.line,{color:n.paper_bgcolor,width:1})):t===I.plot.SeriesPlotStyle.OHLC?(r.increasing={line:{color:n.ohlc_increasing}},r.decreasing={line:{color:n.ohlc_decreasing}}):t===I.plot.SeriesPlotStyle.PIE?(r.textinfo="label+percent",r.outsidetextfont={color:n.title_color}):t===I.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&&(t===I.plot.SeriesPlotStyle.BAR?r.marker.color=s:r.line.color=s),i!=null&&(r.marker.color=i),o!=null&&t!==I.plot.SeriesPlotStyle.PIE&&(r.visible=o)}static getAxisFormats(e,t){const n=new Map,s={tickformat:null,ticksuffix:null},i=j.getAllAxes(e),o=j.groupArray(i,"type"),{charts:r}=e;for(let l=0;l<r.length;l+=1){const a=r[l];for(let c=0;c<a.series.length;c+=1){const d=a.series[c],{sources:u}=d,m=u.filter(p=>p.axis);for(let p=0;p<m.length;p+=1){const g=m[p],{axis:f}=g,{type:C}=f,w=o.get(C);O(w);const b=w.indexOf(f),S=j.getAxisPropertyName(C);if(S!=null){const E=j.getAxisLayoutProperty(S,b);if(n.has(E))Bi.debug(`${E} already added.`);else{Bi.debug(`Adding ${E} to axisFormats.`);const v=j.getPlotlyAxisFormat(g,t);if(v===null)n.set(E,s);else{n.set(E,v);const{businessCalendar:y}=f;if(y!=null){const M=[],{businessPeriods:F,businessDays:x,holidays:U,timeZone:V}=y,N=t==null?void 0:t.getColumnTypeFormatter(Gl);let H;zl(N)&&(H=N.dhTimeZone);const k=H?(V.standardOffset-H.standardOffset)/60:0;U.length>0&&M.push(...j.createRangeBreakValuesFromHolidays(U,V,H)),F.forEach(z=>M.push({pattern:"hour",bounds:[j.periodToDecimal(z.close)+k,j.periodToDecimal(z.open)+k]})),x.length<On.length&&j.createBoundsFromDays(x).forEach(z=>M.push({pattern:"day of week",bounds:z})),v.rangebreaks=M}if(n.size===a.axes.length)return n}}}}}}return n}static getChartType(e,t){switch(e){case I.plot.SeriesPlotStyle.HISTOGRAM:return"bar";default:return j.getPlotlyChartType(e,t)}}static getAxisPropertyName(e){switch(e){case I.plot.AxisType.X:return"x";case I.plot.AxisType.Y:return"y";default:return null}}static getAxisSide(e){switch(e){case I.plot.AxisPosition.BOTTOM:return"bottom";case I.plot.AxisPosition.TOP:return"top";case I.plot.AxisPosition.LEFT:return"left";case I.plot.AxisPosition.RIGHT:return"right";default:return}}static getAllAxes(e){return e.charts.reduce((t,n)=>[...t,...n.axes],[])}static getChartForSeries(e,t){const{charts:n}=e;for(let s=0;s<n.length;s+=1){const i=n[s];for(let o=0;o<i.series.length;o+=1)if(t===i.series[o])return i}return null}static getLayoutRanges(e){const t={},n=Object.keys(e).filter(s=>s.indexOf("axis")>=0);for(let s=0;s<n.length;s+=1){const i=n[s],o=e[i];Ff(o)&&(t[i]=[...o.range])}return t}static updateFigureAxes(e,t,n,s=0,i=0,o=_n){const r=e,l=j.getAllAxes(t);for(let a=0;a<t.charts.length;a+=1){const c=t.charts[a],d=n==null?void 0:n(c),u=j.getChartBounds(t,c,s,i);j.updateLayoutAxes(r,c.axes,l,s,i,u,d,o)}j.removeStaleAxes(r,l)}static getChartBounds(e,t,n=0,s=0){var S;const{cols:i,rows:o}=e,{column:r,colspan:l,row:a,rowspan:c}=t,d=r+l,u=a+c,m=1/i,p=1/o,g=j.AXIS_SIZE_PX/n,f=j.AXIS_SIZE_PX/s,C={left:r*m+(r>0?g/2:0),bottom:a*p+(a>0?f/2:0),top:u*p-(u<o?f/2:0),right:d*m-(d<i?g/2:0)};return((S=j.groupArray(t.axes,"position").get(I.plot.AxisPosition.RIGHT))!=null?S:[]).length>0&&(n>0?C.right-=(C.right-C.left)*Math.max(0,Math.min(j.LEGEND_WIDTH_PX/n,j.MAX_LEGEND_SIZE)):C.right-=(C.right-C.left)*j.DEFAULT_AXIS_SIZE),C}static updateLayoutAxes(e,t,n,s=0,i=0,o={left:0,top:0,right:1,bottom:1},r,l=_n){const a=s>0?Math.max(j.MIN_AXIS_SIZE,Math.min(j.AXIS_SIZE_PX/i,j.MAX_AXIS_SIZE)):j.DEFAULT_AXIS_SIZE,c=i>0?Math.max(j.MIN_AXIS_SIZE,Math.min(j.AXIS_SIZE_PX/s,j.MAX_AXIS_SIZE)):j.DEFAULT_AXIS_SIZE,d=e,u=j.groupArray(t,"position"),m=j.groupArray(t,"type"),p=[...m.keys()],g=j.groupArray(n,"type");for(let f=0;f<p.length;f+=1){const C=p[f],w=j.getAxisPropertyName(C);if(w!=null){const b=m.get(C),S=g.get(C),v=C===I.plot.AxisType.Y?i:s;O(b),O(S);for(let y=0;y<b.length;y+=1){const M=b[y],F=S.indexOf(M),x=j.getAxisLayoutProperty(w,F);d[x]==null&&(d[x]=j.makeLayoutAxis(C,l));const U=d[x];if(U!=null){j.updateLayoutAxis(U,M,y,u,a,c,o);const{range:V,autorange:N}=U;if(r!=null&&V!==void 0&&(N===void 0||N===!1)){const H=r(M),[k,z]=H(V);Bi.debug("Setting downsample range",v,k,z),M.range(v,k,z)}else M.range(v)}}}}}static removeStaleAxes(e,t){const n=e,s=j.groupArray(t,"type"),i=[...s.keys()];for(let o=0;o<i.length;o+=1){const r=i[o],l=s.get(r);O(l);let a=l.length;const c=j.getAxisPropertyName(r);if(c!=null){let d=j.getAxisLayoutProperty(c,a);for(;n[d]!=null;)delete n[d],a+=1,d=j.getAxisLayoutProperty(c,a)}}}static getAxisLayoutProperty(e,t){const n=t>0?`${t+1}`:"";return`${e!=null?e:""}axis${n}`}static updateLayoutAxis(e,t,n,s,i,o,r){var u,m,p;const a=t.type===I.plot.AxisType.Y?o:i,c=e,d=(u=t.label)!=null?u:"";if(c.title!==void 0&&typeof c.title!="string"?c.title.text=d:c.title={text:d},t.log&&(c.type="log"),c.side=j.getAxisSide(t.position),n>0){c.overlaying=(m=j.getAxisPropertyName(t.type))!=null?m:void 0;const g=(p=s.get(t.position))!=null?p:[],f=g.indexOf(t);f>0&&(c.anchor="free",t.position===I.plot.AxisPosition.RIGHT?c.position=r.right+(f-g.length+1)*a:t.position===I.plot.AxisPosition.TOP?c.position=r.top+(f-g.length+1)*a:t.position===I.plot.AxisPosition.BOTTOM?c.position=r.bottom+(g.length-f+1)*a:t.position===I.plot.AxisPosition.LEFT&&(c.position=r.left+(g.length-f+1)*a))}else if(t.type===I.plot.AxisType.X){const g=s.get(I.plot.AxisPosition.LEFT)||[],f=s.get(I.plot.AxisPosition.RIGHT)||[],C=Math.max(r.left,r.left+(g.length-1)*o),w=Math.min(r.right-(f.length-1)*o,r.right);c.domain=[C,w]}else if(t.type===I.plot.AxisType.Y){const g=s.get(I.plot.AxisPosition.BOTTOM)||[],f=s.get(I.plot.AxisPosition.TOP)||[],C=Math.max(r.bottom,r.bottom+(g.length-1)*i),w=Math.min(r.top-(f.length-1)*i,r.top);c.domain=[C,w]}}static periodToDecimal(e){const t=e.split(":");return Number(t[0])+Number(t[1])/60}static createBoundsFromDays(e){const t=e.map(o=>On.indexOf(o)),n=On.filter(o=>!e.includes(o)).map(o=>On.indexOf(o)),s=new Set;n.forEach(o=>{for(let r=o+1;r<o+On.length;r+=1){const l=r%On.length;if(t.includes(l)){s.add(l);break}}});const i=[];return s.forEach(o=>{for(let r=o-1;r>o-On.length;r-=1){const l=r<0?r+On.length:r;if(t.includes(l)){const a=(l+1)%7;i.push([a,o]);break}}}),i}static createRangeBreakValuesFromHolidays(e,t,n){const s=[],i=[];return e.forEach(o=>{o.businessPeriods.length>0?i.push(...j.createPartialHoliday(o,t,n)):s.push(j.createFullHoliday(o,t,n))}),[{values:s},...i]}static createFullHoliday(e,t,n){return j.adjustDateForTimeZone(`${e.date.toString()} 00:00:00.000000`,t,n)}static createPartialHoliday(e,t,n){const s=e.date.toString(),i=["00:00"];e.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=[j.adjustDateForTimeZone(`${s} ${l}:00.000000`,t,n)],d=If*(j.periodToDecimal(a)-j.periodToDecimal(l));o.push({values:c,dvalue:d})}}return o}static adjustDateForTimeZone(e,t,n){return n&&n.standardOffset!==t.standardOffset?j.unwrapValue(j.wrapValue(e,Gl,t),n):e}static groupArray(e,t){return e.reduce((n,s)=>{var r;const i=s[t],o=(r=n.get(i))!=null?r:[];return o.push(s),n.set(i,o),n},new Map)}static unwrapValue(e,t){if(e!=null){if(Df(e))return I.i18n.DateTimeFormat.format(j.DATE_FORMAT,e,t);if(Nf(e))return e.asNumber()}return e}static wrapValue(e,t,n=null){if(A.isDateType(t)&&typeof e=="string"){const s=e,i=j.DATE_FORMAT.substr(0,e.length),o=I.i18n.DateTimeFormat.parse(i,s);if(!n)return o;const r=`${i} Z`,l=I.i18n.DateTimeFormat.format("Z",o,n),a=I.i18n.DateTimeFormat.parse(r,`${s} ${l}`),c=I.i18n.DateTimeFormat.format("Z",a,n);return I.i18n.DateTimeFormat.parse(r,`${s} ${c}`)}return e}static makeLayoutAxis(e,t=_n){const n={automargin:!0,gridcolor:t.gridcolor,linecolor:t.linecolor,rangeslider:{visible:!1},showline:!0,ticklen:5,tickcolor:t.paper_bgcolor,tickfont:{color:t.zerolinecolor},title:{font:{color:t.title_color}}};return e===I.plot.AxisType.X?Object.assign(n,{showgrid:!0}):e===I.plot.AxisType.Y&&Object.assign(n,{zerolinecolor:t.zerolinecolor,zerolinewidth:2}),n}static getColorwayFromTheme(e=_n){let t=[];return e.colorway&&(Array.isArray(e.colorway)?t=e.colorway:typeof e.colorway=="string"?t=e.colorway.split(" "):Bi.warn(`Unable to handle colorway property: ${e.colorway}`)),t}static makeDefaultLayout(e=_n){const t={...e,autosize:!0,colorway:j.getColorwayFromTheme(e),font:{family:"'Fira Sans', sans-serif"},title:{font:{color:e.title_color},yanchor:"top",pad:{...j.DEFAULT_TITLE_PADDING},y:1},legend:{font:{color:e.title_color}},margin:{...j.DEFAULT_MARGIN},xaxis:j.makeLayoutAxis(I.plot.AxisType.X,e),yaxis:j.makeLayoutAxis(I.plot.AxisType.Y,e)};return t.datarevision=0,t}static hydrateSettings(e){return{...e,type:I.plot.SeriesPlotStyle[e.type]}}static titleFromSettings(e){const{series:t,xAxis:n,title:s=`${t.join(", ")} by ${n}`}=e;return s}static makeFigureSettings(e,t){const{series:n,xAxis:s,type:i}=e,o=j.titleFromSettings(e),r={formatType:`${I.plot.AxisFormatType.NUMBER}`,type:`${I.plot.AxisType.X}`,position:`${I.plot.AxisPosition.BOTTOM}`},l={formatType:`${I.plot.AxisFormatType.NUMBER}`,type:`${I.plot.AxisType.Y}`,position:`${I.plot.AxisPosition.LEFT}`};return{charts:[{chartType:`${I.plot.ChartType.XY}`,axes:[r,l],series:n.map(a=>({plotStyle:`${i}`,name:a,dataSources:[{type:`${I.plot.SourceType.X}`,columnName:s,axis:r,table:t},{type:`${I.plot.SourceType.Y}`,columnName:a,axis:l,table:t}]}))}],title:o}}};let ve=j;ve.DEFAULT_AXIS_SIZE=.15;ve.MIN_AXIS_SIZE=.025;ve.MAX_AXIS_SIZE=.2;ve.AXIS_SIZE_PX=75;ve.LEGEND_WIDTH_PX=50;ve.MAX_LEGEND_SIZE=.25;ve.ORIENTATION=Object.freeze({HORIZONTAL:"h",VERTICAL:"v"});ve.DATE_FORMAT="yyyy-MM-dd HH:mm:ss.SSSSSS";ve.DEFAULT_MARGIN=Object.freeze({l:60,r:50,t:30,b:60,pad:0});ve.DEFAULT_TITLE_PADDING=Object.freeze({t:8});ve.SUBTITLE_LINE_HEIGHT=25;const kn=ne.module("Chart"),li=class extends T.exports.Component{constructor(e){super(e),this.getCachedConfig=Ee((t,n,s,i)=>{const o=[],r=Boolean(t);if(r&&o.push({name:`Downsampling failed: ${t}`,click:()=>{},icon:li.convertIcon(oa),attr:"fill-warning"}),n||s||i||r){const l=li.downsampleButtonTitle(s,i),a=li.downsampleButtonAttr(s,i),c=s?ea:Cu;o.push({name:l,icon:li.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=J.createRef(),this.plotWrapper=J.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(e){const[t,,,,n]=e.icon,s=`${n}`;return{width:t,path:s,ascent:t,descent:0,transform:"matrix(1, 0, 0, 1, 0, 0)"}}static downsampleButtonTitle(e,t){return e?"Downsampling in progress...":t?"Downsampling disabled, click to enable":"Downsampling enabled, click to disable"}static downsampleButtonAttr(e,t){return e?"animation-spin":t?void 0:"fill-active"}componentDidMount(){this.updateDimensions(),this.updateModelDimensions(),this.initData(),this.initFormatter();const{isActive:e}=this.props;e&&this.subscribe()}componentDidUpdate(e){const{isActive:t,settings:n}=this.props;this.updateFormatterSettings(n),t!==e.isActive&&(t?this.subscribe():this.unsubscribe())}componentWillUnmount(){this.unsubscribe()}getPlotRect(){var e,t;return(t=(e=this.plotWrapper.current)==null?void 0:e.getBoundingClientRect())!=null?t:null}initData(){const{model:e}=this.props,{layout:t}=this.state;this.setState({data:e.getData(),layout:{...t,...e.getLayout()}})}subscribe(){if(this.isSubscribed)return;const{model:e}=this.props;if(!this.rect||this.rect.width===0||this.rect.height===0){kn.debug2("Delaying subscription until model dimensions are set");return}e.subscribe(this.handleModelEvent),this.isSubscribed=!0}unsubscribe(){if(!this.isSubscribed)return;const{model:e}=this.props;e.unsubscribe(this.handleModelEvent),this.isSubscribed=!1}handleAfterPlot(){this.plot.current!=null}handleDownsampleClick(){this.setState(({isDownsamplingDisabled:e})=>({downsamplingError:null,isDownsampleInProgress:!1,isDownsampleFinished:!1,isDownsamplingDisabled:!e}),()=>{const{model:e}=this.props,{isDownsamplingDisabled:t}=this.state;e.setDownsamplingDisabled(t)})}handleModelEvent(e){var s;const{type:t,detail:n}=e;switch(kn.debug2("Received data update",t,n),t){case Ze.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 Ze.EVENT_LOADFINISHED:{const{onUpdate:i}=this.props;this.isLoadedFired=!0,i({isLoading:!1});break}case Ze.EVENT_DISCONNECT:{const{onDisconnect:i}=this.props;i();break}case Ze.EVENT_RECONNECT:{const{onReconnect:i}=this.props;i();break}case Ze.EVENT_DOWNSAMPLESTARTED:{this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!0,downsamplingError:null});break}case Ze.EVENT_DOWNSAMPLEFINISHED:{this.setState({isDownsampleFinished:!0,isDownsampleInProgress:!1,downsamplingError:null});break}case Ze.EVENT_DOWNSAMPLENEEDED:case Ze.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:kn.debug("Unknown event type",t,e)}}handlePlotUpdate(e){const{layout:t}=e,n=ve.getLayoutRanges(t);!ht(n,this.ranges)&&(this.ranges=n,this.updateModelDimensions(!0))}handleRelayout(e){if(kn.debug("handleRelayout",e),e.hiddenlabels!=null){const{onSettingsChanged:t}=this.props,n=[...e.hiddenlabels];t({hiddenSeries:n})}this.updateModelDimensions()}handleRestyle([e,t]){if(kn.debug("handleRestyle",e,t),Object.keys(e).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(e=!1){const t=this.getPlotRect();if(!t){kn.warn("Unable to get plotting rect");return}if(!this.rect||this.rect.width!==t.width||this.rect.height!==t.height||e){this.rect=t;const{isActive:s,model:i}=this.props;i.setDimensions(t),s&&this.subscribe()}}initFormatter(){const{settings:e}=this.props;this.updateFormatterSettings(e)}updateFormatterSettings(e){const t=ds.getColumnFormats(e),n=ds.getDateTimeFormatterOptions(e),{decimalFormatOptions:s={},integerFormatOptions:i={}}=e;(!ht(this.columnFormats,t)||!ht(this.dateTimeFormatterOptions,n)||!ht(this.decimalFormatOptions,s)||!ht(this.integerFormatOptions,i))&&(this.columnFormats=ds.getColumnFormats(e),this.dateTimeFormatterOptions=n,this.decimalFormatOptions=s,this.integerFormatOptions=i,this.updateFormatter())}updateFormatter(){const e=new en(this.columnFormats,this.dateTimeFormatterOptions,this.decimalFormatOptions,this.integerFormatOptions),{model:t}=this.props;t.setFormatter(e)}updateDimensions(){const e=this.getPlotRect();this.plot.current!=null&&e!=null&&e.width>0&&e.height>0&&qi.relayout(this.plot.current.el,{autosize:!0}).catch(t=>{kn.debug("Unable to resize, promise rejected",t)})}render(){const{data:e,downsamplingError:t,isDownsampleFinished:n,isDownsampleInProgress:s,isDownsamplingDisabled:i,layout:o,revision:r}=this.state,l=this.getCachedConfig(t,n,s,i),a=e!=null;return h("div",{className:"h-100 w-100 chart-wrapper",ref:this.plotWrapper,children:a&&h(bf,{ref:this.plot,data:e,layout:o,revision:r,config:l,onAfterPlot:this.handleAfterPlot,onError:kn.error,onRelayout:this.handleRelayout,onUpdate:this.handlePlotUpdate,onRestyle:this.handleRestyle,useResizeHandler:!0,style:{height:"100%",width:"100%"}})})}};let xf=li;xf.defaultProps={isActive:!0,settings:{timeZone:"America/New_York",defaultDateTimeFormat:Yn.FULL_DATE_FORMAT,showTimeZone:!1,showTSeparator:!0,formatter:[]},onDisconnect:()=>{},onReconnect:()=>{},onUpdate:()=>{},onError:()=>{},onSettingsChanged:()=>{}};const it=ne.module("FigureChartModel"),vc=class extends Ze{constructor(e,t={},n=_n){super(),this.addPendingSeries=Et(()=>{var r;const i=ve.getAllAxes(this.figure),{pendingSeries:o}=this;for(let l=0;l<o.length;l+=1){const a=o[l],c=this.figure.charts.find(d=>d.series.includes(a));this.addSeries(a,i,(r=c==null?void 0:c.showLegend)!=null?r:null),a.subscribe()}this.pendingSeries=[]},vc.ADD_SERIES_DEBOUNCE),this.getTimeZone=he((i,o)=>{if(o!=null){const r=o.getColumnTypeFormatter(i);if(r!=null)return r.dhTimeZone}}),this.getValueTranslator=he((i,o)=>{const r=this.getTimeZone(i,o);return l=>ve.unwrapValue(l,r)}),this.getValueParser=he((i,o)=>{const r=this.getTimeZone(i,o);return l=>ve.wrapValue(l,i,r)}),this.getRangeParser=he((i,o)=>r=>{let[l,a]=r;const c=this.getValueParser(i,o);return l=c(l),a=c(a),[l,a]}),this.getAxisRangeParser=he((i,o)=>r=>{const l=ve.getSourceForAxis(i,r);return l?this.getRangeParser(l.columnType,o):a=>a}),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=e,this.settings=t,this.theme=n,this.data=[];const s={data:{},layout:ve.makeDefaultLayout(n)};this.layout={grid:{rows:e.rows,columns:e.cols,pattern:"independent"},template:s},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:e}=this.figure,t=ve.getAllAxes(this.figure),n=[];for(let o=0;o<e.length;o+=1){const r=e[o];for(let l=0;l<r.series.length;l+=1){const a=r.series[l];n.push(a.name),this.addSeries(a,t,r.showLegend)}}const i=[...this.seriesDataMap.keys()].filter(o=>n.indexOf(o)<0);for(let o=0;o<i.length;o+=1){const r=i[o];this.seriesDataMap.delete(r)}this.seriesToProcess=new Set([...this.seriesDataMap.keys()])}addSeries(e,t,n){const s=ve.groupArray(t,"type"),i=ve.makeSeriesDataFromSeries(e,s,ve.getSeriesVisibility(e.name,this.settings),n,this.theme);if(this.seriesDataMap.set(e.name,i),this.data=[...this.seriesDataMap.values()],e.plotStyle===I.plot.SeriesPlotStyle.STACKED_BAR?this.layout.barmode="stack":e.plotStyle===I.plot.SeriesPlotStyle.PIE&&(this.layout.hiddenlabels=ve.getHiddenLabels(this.settings)),this.layout.showlegend=this.data.length>1||e.plotStyle===I.plot.SeriesPlotStyle.PIE?n!=null?n:void 0:!1,e.oneClick!=null){const{oneClick:o}=e,{columns:r}=o;for(let l=0;l<r.length;l+=1)this.filterColumnMap.set(r[l].name,r[l]);this.oneClicks.push(o)}this.updateLayoutFormats()}subscribe(e){super.subscribe(e),this.listeners.length===1&&(this.initAllSeries(),this.subscribeFigure())}unsubscribe(e){super.unsubscribe(e),this.listeners.length===0&&this.unsubscribeFigure()}subscribeFigure(){if(!this.isConnected){it.debug("Ignoring subscribe when figure in disconnected state");return}this.figure.subscribe(this.isDownsamplingDisabled?I.plot.DownsampleOptions.DISABLE:I.plot.DownsampleOptions.DEFAULT)}unsubscribeFigure(){this.figure.unsubscribe()}startListeningFigure(){this.figure.addEventListener(I.plot.Figure.EVENT_UPDATED,this.handleFigureUpdated),this.figure.addEventListener(I.plot.Figure.EVENT_SERIES_ADDED,this.handleFigureSeriesAdded),this.figure.addEventListener(I.plot.Figure.EVENT_DISCONNECT,this.handleFigureDisconnected),this.figure.addEventListener(I.plot.Figure.EVENT_RECONNECT,this.handleFigureReconnected),this.figure.addEventListener(I.plot.Figure.EVENT_DOWNSAMPLESTARTED,this.handleDownsampleStart),this.figure.addEventListener(I.plot.Figure.EVENT_DOWNSAMPLEFINISHED,this.handleDownsampleFinish),this.figure.addEventListener(I.plot.Figure.EVENT_DOWNSAMPLEFAILED,this.handleDownsampleFail),this.figure.addEventListener(I.plot.Figure.EVENT_DOWNSAMPLENEEDED,this.handleDownsampleNeeded),this.figure.addEventListener(I.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed)}stopListeningFigure(){this.figure.removeEventListener(I.plot.Figure.EVENT_UPDATED,this.handleFigureUpdated),this.figure.removeEventListener(I.plot.Figure.EVENT_SERIES_ADDED,this.handleFigureSeriesAdded),this.figure.removeEventListener(I.plot.Figure.EVENT_DISCONNECT,this.handleFigureDisconnected),this.figure.removeEventListener(I.plot.Figure.EVENT_RECONNECT,this.handleFigureReconnected),this.figure.removeEventListener(I.plot.Figure.EVENT_DOWNSAMPLESTARTED,this.handleDownsampleStart),this.figure.removeEventListener(I.plot.Figure.EVENT_DOWNSAMPLEFINISHED,this.handleDownsampleFinish),this.figure.removeEventListener(I.plot.Figure.EVENT_DOWNSAMPLEFAILED,this.handleDownsampleFail),this.figure.removeEventListener(I.plot.Figure.EVENT_DOWNSAMPLENEEDED,this.handleDownsampleNeeded),this.figure.removeEventListener(I.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed)}handleDownsampleStart(e){it.debug("Downsample started",e),this.fireDownsampleStart(e.detail)}handleDownsampleFinish(e){it.debug("Downsample finished",e),this.fireDownsampleFinish(e.detail)}handleDownsampleFail(e){it.error("Downsample failed",e),this.fireDownsampleFail(e.detail)}handleDownsampleNeeded(e){it.info("Downsample needed",e),this.fireDownsampleNeeded(e.detail)}handleFigureUpdated(e){const{detail:t}=e,{series:n}=t;it.debug2("handleFigureUpdated",n);for(let i=0;i<n.length;i+=1){const o=n[i];it.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:d}=a,u=this.getValueTranslator(c,this.formatter),m=t.getArray(o,d,u);this.setDataArrayForSeries(o,d,m)}this.seriesToProcess.delete(o.name),this.seriesToProcess.size===0&&this.fireLoadFinished(),this.cleanSeries(o)}const{data:s}=this;this.fireUpdate(s)}handleRequestFailed(e){it.error("Request failed",e)}resubscribe(){this.listeners.length>0&&(this.unsubscribeFigure(),this.subscribeFigure())}setFormatter(e){super.setFormatter(e),this.updateLayoutFormats(),this.resubscribe()}setDownsamplingDisabled(e){super.setDownsamplingDisabled(e),this.resubscribe()}handleFigureDisconnected(e){it.debug("Figure disconnected",e),this.isConnected=!1,this.listeners.length>0&&this.unsubscribeFigure(),this.fireDisconnect()}handleFigureReconnected(e){it.debug("Figure reconnected",e),this.isConnected=!0,this.initAllSeries(),this.fireReconnect(),this.listeners.length>0&&this.subscribeFigure()}handleFigureSeriesAdded(e){const{detail:t}=e;it.debug("handleFigureSeriesAdded",t),this.pendingSeries.push(t),this.addPendingSeries()}setDimensions(e){super.setDimensions(e),this.updateAxisPositions()}setTitle(e){var s,i;super.setTitle(e);const t=(i=(s=(e!=null?e:"").match(/<br>/g))==null?void 0:s.length)!=null?i:0,n=ve.DEFAULT_MARGIN.t+t*ve.SUBTITLE_LINE_HEIGHT;this.layout.margin?this.layout.margin.t=n:this.layout.margin={t:n},typeof this.layout.title=="string"?this.layout.title=e:(this.layout.title={...this.layout.title},this.layout.title.text=e,this.layout.title.pad={...this.layout.title.pad},this.layout.title.pad.t=ve.DEFAULT_TITLE_PADDING.t+t*ve.SUBTITLE_LINE_HEIGHT*.5)}getPlotWidth(){var e,t,n,s;return!this.rect||!this.rect.width?0:Math.max(this.rect.width-((t=(e=this.layout.margin)==null?void 0:e.l)!=null?t:0)-((s=(n=this.layout.margin)==null?void 0:n.r)!=null?s:0),0)}getPlotHeight(){var e,t,n,s;return!this.rect||!this.rect.height?0:Math.max(this.rect.height-((t=(e=this.layout.margin)==null?void 0:e.t)!=null?t:0)-((s=(n=this.layout.margin)==null?void 0:n.b)!=null?s:0),0)}updateAxisPositions(){const e=this.getPlotWidth(),t=this.getPlotHeight();ve.updateFigureAxes(this.layout,this.figure,n=>this.getAxisRangeParser(n,this.formatter),e,t,this.theme)}updateLayoutFormats(){if(!this.formatter)return;ve.getAxisFormats(this.figure,this.formatter).forEach((t,n)=>{it.debug(`Assigning ${n}`,this.layout[n],t);const s=this.layout[n];s!=null?Object.assign(s,t):it.debug(`Ignoring null layout.${n}`)})}setDataArrayForSeries(e,t,n){const{name:s,plotStyle:i}=e,o=this.seriesDataMap.get(s),r=ve.getPlotlyProperty(i,t);o&&$l(o,r,n)}cleanSeries(e){const{name:t,plotStyle:n}=e,s=this.seriesDataMap.get(t);if(s!=null){if(n===I.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===I.plot.SeriesPlotStyle.LINE){const{x:i,xLow:o,xHigh:r,y:l,yLow:a,yHigh:c}=s;o&&r&&o!==i&&(s.error_x=ve.getPlotlyErrorBars(i,o,r)),a&&c&&a!==l&&(s.error_y=ve.getPlotlyErrorBars(l,a,c))}else if(n===I.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(e=>e.requireAllFiltersToDisplay)!=null}setFilter(e){if(this.oneClicks.length===0){it.warn("Trying to set a filter, but no one click!");return}it.debug("setFilter",e);for(let t=0;t<this.oneClicks.length;t+=1){const n=this.oneClicks[t],{columns:s}=n;new Set([...e.keys(),...this.lastFilter.keys()]).forEach(o=>{const r=e.get(o);this.lastFilter.get(o)!==r&&s.find(l=>l.name===o)!=null&&n.setValueForColumn(o,r)})}this.lastFilter=new Map(e)}setFigure(e){this.close(),this.figure=e,this.setTitle(this.getDefaultTitle()),this.initAllSeries(),this.updateAxisPositions(),this.startListeningFigure(),this.listeners.length>0&&this.subscribeFigure()}updateSettings(e){this.settings=e}};let Af=vc;Af.ADD_SERIES_DEBOUNCE=50;function Of({text:e,isOpen:t,onClose:n}){var S,E;const[s,i]=T.exports.useState(!1),[o,r]=T.exports.useState(0),[l,a]=T.exports.useState(!1),[c,d]=T.exports.useState(!1),[u,m]=T.exports.useState(!1),p=T.exports.useRef();T.exports.useEffect(function(){if(!!t){try{JSON.parse(e),m(!0)}catch{m(!1)}d(!1)}},[t,e]),T.exports.useEffect(function(){p.current&&p.current.layout()},[o]),T.exports.useEffect(function(){p.current&&p.current.updateOptions({lineNumbers:l?"on":"off"})},[l]);function g(){a(!l)}function f(){var y;const v=(y=p.current)==null?void 0:y.getModel();!u||!v||(c?(v.setValue(e),d(!1)):(v.setValue(JSON.stringify(JSON.parse(e),void 0,2)),d(!0)),C())}function C(){var y,M;const v=p.current;!v||a(((M=(y=v.getModel())==null?void 0:y.getLineCount())!=null?M:0)>1)}function w(){s&&(p.current=void 0,n())}function b(v){p.current=v,v.onDidContentSizeChange(({contentHeight:y})=>r(y)),C()}return!t&&!s?null:R(Dd,{isOpen:t,centered:!0,keyboard:!0,toggle:w,onOpened:()=>i(!0),onClosed:()=>{i(!1),r(0)},className:"theme-bg-dark cell-overflow-modal",children:[R(Fd,{toggle:n,children:[h("h5",{className:"overflow-modal-title",children:"Cell Contents"}),h(ha,{kind:"inline",tooltip:"Copy cell contents",copy:(E=(S=p.current)==null?void 0:S.getValue())!=null?E:e}),h(K,{kind:"inline",active:l,icon:Xd,tooltip:"Toggle line numbers",onClick:g}),u&&h(K,{kind:"inline",icon:$d,active:c,tooltip:"Format as JSON",onClick:f})]}),h(Nd,{style:{height:o},children:h(Hr,{onEditorInitialized:b,settings:{value:e,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 kf="###,##0";function Lf({gotoRow:e,gotoRowError:t,onSubmit:n,isShown:s,onEntering:i,onEntered:o,onExiting:r,onExited:l,model:a,onGotoRowNumberChanged:c,onClose:d}){const u=T.exports.useRef(null),m="Row number",{rowCount:p}=a;return T.exports.useEffect(()=>{var g;document.activeElement!==u.current&&((g=u.current)==null||g.select())},[e]),h(fo,{isShown:s,className:G("goto-row"),onEntering:i,onEntered:()=>{var g;o(),(g=u.current)==null||g.select()},onExiting:r,onExited:l,children:R(Fe,{children:[R("div",{className:"goto-row-wrapper",children:[h("div",{className:"goto-row-text",children:"Go to row"}),h("div",{className:"goto-row-input",children:h("input",{ref:u,type:"number",onKeyDown:g=>{g.key==="Enter"&&(g.stopPropagation(),g.preventDefault(),n())},className:G("form-control",{"is-invalid":t!==""}),placeholder:m,onChange:g=>{c(g)},value:e})}),R("div",{className:"goto-row-text",children:["of ",dh.i18n.NumberFormat.format(kf,p)]}),t&&h("div",{className:"goto-row-error text-danger",children:t})]}),h("div",{className:"goto-row-close",children:h(K,{kind:"ghost",onClick:d,children:h(Q,{icon:di,style:{marginRight:"0"}})})})]})})}const re=ne.module("IrisGrid"),Pf=500,Hf=250,_f=250,Tc=Object.freeze({aggregations:[],showOnTop:!1}),Vf="yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSS z";function Wl({advancedFilters:e,aggregationSettings:t,customColumns:n,quickFilters:s,reverseType:i,rollupConfig:o,searchFilter:r,selectDistinctColumns:l,sorts:a}){return e.size===0&&t.aggregations.length===0&&n.length===0&&s.size===0&&i===A.REVERSE_TYPE.NONE&&o==null&&r==null&&l.length===0&&a.length===0}const Vn=class extends T.exports.Component{constructor(e){super(e),this.getAdvancedMenuOpenedHandler=he(P=>this.handleAdvancedMenuOpened.bind(this,P),{max:100}),this.getCachedAdvancedFilterMenuActions=he((P,_,$,X,ee)=>h(Fr,{model:P,column:_,onFilterChange:this.handleAdvancedFilterChange,onSortChange:this.handleAdvancedFilterSortChange,onDone:this.handleAdvancedFilterDone,options:$,sortDirection:X,formatter:ee}),{max:50}),this.getCachedOptionItems=he((P,_,$,X,ee,ae,fe,Ce,de,ye,Xe,yt,Ye,et,_t,Rt)=>{const He=[];return P&&He.push({type:be.CHART_BUILDER,title:"Chart Builder",icon:wu}),He.push({type:be.VISIBILITY_ORDERING_BUILDER,title:"Hide, Group, and Order Columns",icon:cr}),$&&He.push({type:be.CONDITIONAL_FORMATTING,title:"Conditional Formatting",icon:ar}),_&&He.push({type:be.CUSTOM_COLUMN_BUILDER,title:"Custom Columns",icon:ou}),X&&He.push({type:be.ROLLUP_ROWS,title:"Rollup Rows",icon:Ru}),ee&&He.push({type:be.AGGREGATIONS,title:"Aggregate Columns",icon:ru}),ae&&He.push({type:be.SELECT_DISTINCT,title:"Select Distinct Values",icon:iu}),fe&&Ye&&He.push({type:be.TABLE_EXPORTER,title:"Download CSV",icon:Ud}),Rt&&He.push({type:be.ADVANCED_SETTINGS,title:"Advanced Settings",icon:au}),He.push({type:be.QUICK_FILTERS,title:"Quick Filters",subtitle:Ce.shortcut.getDisplayText(),icon:Ki,isOn:Xe,onChange:Ce.action}),et&&He.push({type:be.SEARCH_BAR,title:"Search Bar",subtitle:de.shortcut.getDisplayText(),icon:na,isOn:yt,onChange:de.action}),He.push({type:be.GOTO,title:"Go to",subtitle:ye.shortcut.getDisplayText(),icon:su,isOn:_t,onChange:ye.action}),He},{max:1}),this.getCachedHiddenColumns=he(P=>P,{max:1,normalizer:([P])=>P.join()}),this.getAggregationMap=he((P,_)=>{const $={};return _.forEach(({operation:X,selected:ee,invert:ae})=>{$[X]=Gn.getOperationColumnNames(P,X,ee,ae)}),$}),this.getOperationMap=he((P,_)=>{const $={};return _.filter(X=>!Gn.isRollupOperation(X.operation)).forEach(({operation:X,selected:ee,invert:ae})=>{Gn.getOperationColumnNames(P,X,ee,ae).forEach(fe=>{var de;const Ce=[...(de=$[fe])!=null?de:[],X];$[fe]=Ce})}),$}),this.getOperationOrder=he(P=>P.map(_=>_.operation).filter(_=>!Gn.isRollupOperation(_))),this.getCachedFormatColumns=he((P,_)=>Mm(P,_)),this.getCachedModelColumns=he((P,_)=>P.columns),this.getCachedPreviewFormatColumns=he((P,_,$,X)=>{if(re.debug("getCachedPreviewFormatColumns",_,$,X),$!==void 0&&X!==void 0){const ee=[..._];return ee[X]=$,this.getCachedFormatColumns(P,ee)}return this.getCachedFormatColumns(P,_)}),this.getModelRollupConfig=he((P,_,$)=>te.getModelRollupConfig(P,_,$)),this.getModelTotalsConfig=he((P,_,$)=>{var Ce,de,ye;const{aggregations:X,showOnTop:ee}=$;if(((de=(Ce=_==null?void 0:_.columns)==null?void 0:Ce.length)!=null?de:0)>0||((ye=X==null?void 0:X.length)!=null?ye:0)===0)return null;const ae=this.getOperationMap(P,X),fe=this.getOperationOrder(X);return{operationMap:ae,operationOrder:fe,showOnTop:ee}}),this.getCachedStateOverride=he((P,_,$,X,ee,ae,fe,Ce,de,ye)=>({hoverSelectColumn:P,isFilterBarShown:_,isSelectingColumn:$,loadingScrimProgress:X,quickFilters:ee,advancedFilters:ae,sorts:fe,reverseType:Ce,rollupConfig:de,isMenuShown:ye}),{max:1}),this.getCachedFilter=he((P,_,$,X,ee)=>[...P!=null?P:[],...X!=null?X:[],...te.getFiltersFromFilterMap(_),...te.getFiltersFromFilterMap($),...ee!==void 0?[ee]:[]],{max:1}),this.getCachedTheme=he((P,_,$)=>({...Ba,...P,autoSelectRow:!_,rowFooterWidth:$>0?P.rowFooterWidth:0}),{max:1}),this.getAlwaysFetchColumns=he((P,_,$,X,ee,ae)=>{const fe=[];for(let de=0;de<X;de+=1)fe.push(_[B.getModelIndex(de,$)].name);for(let de=0;de<ee;de+=1)fe.push(_[B.getModelIndex(_.length-1-de,$)].name);if(ae)for(let de=ae[0];de<=ae[1];de+=1)fe.push(_[B.getModelIndex(de,$)].name);return[...new Set([...P,...fe])]}),this.updateSearchFilter=Et((P,_,$,X)=>{const ee=Vi.createSearchFilter(P,_,$,X);this.setState({searchFilter:ee})},Hf),this.handleConditionalFormatEditorUpdate=Et(P=>{this.setState({conditionalFormatPreview:P})},_f),this.handleDownloadProgressUpdate=Xn((P,_)=>{const{tableDownloadStatus:$}=this.state;$===St.DOWNLOAD_STATUS.DOWNLOADING&&this.setState({tableDownloadProgress:P,tableDownloadEstimatedTime:_})},Pf),this.getOverflowButtonTooltip=he(P=>{if(P==null)return null;const _={position:"absolute",...P,pointerEvents:"none"};return h("div",{style:_,children:h(Be,{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.handleHeaderGroupsChanged=this.handleHeaderGroupsChanged.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 uo,this.globalColumnFormats=[],this.decimalFormatOptions={},this.integerFormatOptions={},this.truncateNumbersWithPound=!1,this.renderer=new ci,this.tableSaver=null,this.crossColumnRef=J.createRef(),this.isAnimating=!1,this.filterInputRef=J.createRef(),this.toggleFilterBarAction={action:()=>this.toggleFilterBar(),shortcut:kt.TABLE.TOGGLE_QUICK_FILTER},this.toggleSearchBarAction={action:()=>this.toggleSearchBar(),shortcut:kt.TABLE.TOGGLE_SEARCH},this.toggleGotoRowAction={action:()=>this.toggleGotoRow(),shortcut:kt.TABLE.GOTO_ROW},this.discardAction={action:()=>{const{model:P}=this.props;Oe(P)&&P.isEditable&&P.pendingDataMap.size>0&&this.discardPending().catch(re.error)},shortcut:kt.INPUT_TABLE.DISCARD},this.commitAction={action:()=>{const{model:P}=this.props;Oe(P)&&P.isEditable&&P.pendingDataMap.size>0&&P.pendingDataErrors.size===0&&this.commitPending().catch(re.error)},shortcut:kt.INPUT_TABLE.COMMIT},this.contextActions=[this.toggleFilterBarAction,this.toggleSearchBarAction,this.toggleGotoRowAction,this.discardAction,this.commitAction];const{aggregationSettings:t,conditionalFormats:n,customColumnFormatMap:s,isFilterBarShown:i,isSelectingPartition:o,model:r,movedColumns:l,movedRows:a,partition:c,partitionColumn:d,rollupConfig:u,userColumnWidths:m,userRowHeights:p,showSearchBar:g,searchValue:f,selectedSearchColumns:C,invertSearchColumns:w,advancedFilters:b,quickFilters:S,selectDistinctColumns:E,pendingDataMap:v,canCopy:y,frozenColumns:M,columnHeaderGroups:F}=e,x=[new Bm(this),new Gm(this)];y&&x.push(new _m(this));const U=[new zm(this),new Wm(this),new $m(this),new Ym(this),new Xm(this),new yn(this),new Km(this),new Qm(this)],V=l.length>0?l:r.initialMovedColumns,N=a.length>0?a:r.initialMovedRows,H=new Jm({userColumnWidths:new Map(m),userRowHeights:new Map(p),movedColumns:V}),k=C!=null?C:[],z=Vi.createSearchFilter(f,k,r.columns,w);this.state={isFilterBarShown:i,isSelectingPartition:o,focusedFilterBarColumn:null,metricCalculator:H,metrics:void 0,keyHandlers:x,mouseHandlers:U,partition:c,partitionColumn:d,partitionTable:null,partitionFilters:[],quickFilters:S?new Map(S):new Map,advancedFilters:new Map(b),shownAdvancedFilter:null,hoverAdvancedFilter:null,sorts:[],reverseType:A.REVERSE_TYPE.NONE,customColumns:[],selectDistinctColumns:E,selectedRanges:[],copyOperation:null,loadingText:null,loadingScrimProgress:null,loadingSpinnerShown:!1,movedColumns:V,movedRows:N,shownColumnTooltip:null,formatter:new en,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:z,searchValue:f,selectedSearchColumns:k,invertSearchColumns:w,rollupConfig:u,rollupSelectedColumns:[],aggregationSettings:t,selectedAggregation:null,openOptions:[],pendingRowCount:0,pendingDataMap:v!=null?v:new Map,pendingDataErrors:new Map,pendingSavePromise:null,pendingSaveError:null,toastMessage:null,frozenColumns:M,showOverflowModal:!1,overflowText:"",overflowButtonTooltipProps:null,isGotoRowShown:!1,gotoRow:"",gotoRowError:"",columnHeaderGroups:F!=null?F:r.initialColumnHeaderGroups}}static makeQuickFilter(e,t,n){try{return A.makeQuickFilter(e,t,n)}catch(s){re.error("Error creating quick filter",s)}return null}componentDidMount(){const{partitionColumn:e,model:t}=this.props,n=e!=null?e:t.columns.find(s=>s.isPartitionColumn);t.isFilterRequired&&t.isValuesTableAvailable&&n!=null?this.loadPartitionsTable(n):this.initState(),this.startListening(t)}componentDidUpdate(e){var d;const{inputFilters:t,isSelectingColumn:n,settings:s,model:i,customFilters:o,sorts:r}=this.props;i!==e.model&&(this.stopListening(e.model),this.startListening(i));const l=t!==e.inputFilters?t.filter(u=>!e.inputFilters.includes(u)):[];if(l.length>0){const{advancedSettings:u}=this.props,m=(d=u.get(hs.FILTER_CONTROL_CHANGE_CLEARS_ALL_FILTERS))!=null?d:!1;m&&(this.clearGridInputField(),this.clearCrossColumSearch()),this.startLoading("Filtering...",!0),this.applyInputFilters(l,m)}n!==e.isSelectingColumn&&this.resetColumnSelection(),s!==e.settings&&this.updateFormatterSettings(s),o!==e.customFilters&&this.startLoading("Filtering...",!0),r!==e.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?(re.debug2("Ignoring scrim update because loading cancelled."),null):{loadingScrimProgress:g})}),this.sendStateChange()}componentWillUnmount(){const{model:e}=this.props;this.stopListening(e),this.pending.cancel(),this.updateSearchFilter.cancel(),this.loadingTimer&&clearTimeout(this.loadingTimer),this.handleDownloadProgressUpdate.cancel(),this.animationFrame!==void 0&&cancelAnimationFrame(this.animationFrame)}getValueForCell(e,t,n=!1){const{model:s}=this.props,i=this.getModelColumn(e),o=this.getModelRow(t);if(n&&i!=null&&o!=null){const r=s.valueForCell(i,o);if(A.isDateType(s.columns[i].type)){const{formatter:l}=s;return I.i18n.DateTimeFormat.format(Vf,r,I.i18n.TimeZone.getTimeZone(l.timeZone))}return r}return n?null:i!=null&&o!=null?s.textForCell(i,o):""}getModelColumn(e){const{metrics:t}=this.state;O(t);const{modelColumns:n}=t;return n==null?null:e!=null?n.get(e):null}getModelRow(e){const{metrics:t}=this.state;O(t);const{modelRows:n}=t;return n==null?null:e!=null?n.get(e):null}getTheme(){var n;const{model:e,theme:t}=this.props;return this.getCachedTheme(t,(n=Oe(e)&&e.isEditable)!=null?n:!1,e.floatingTopRowCount+e.floatingBottomRowCount)}getVisibleColumn(e){const{movedColumns:t}=this.state;return B.getVisibleIndex(e,t)}applyInputFilters(e,t=!1){const{model:n}=this.props,{advancedFilters:s,quickFilters:i}=this.state,o=t?new Map:new Map(s),r=t?new Map:new Map(i);let l=t&&s.size>0;e.forEach(({name:a,type:c,value:d})=>{const u=n.columns.findIndex(({name:m,type:p})=>m===a&&p===c);u>=0?(l=o.delete(u)||l,l=this.applyQuickFilter(u,d,r)||l):re.error("Unable to find column for inputFilter",a,c,d)}),l&&this.setState({quickFilters:r,advancedFilters:o})}applyQuickFilter(e,t,n){const{model:s}=this.props,{formatter:i}=s,o=s.columns[e];if(t!=null&&`${t}`.trim().length>0){const r=n.get(e);if(r!=null){const{text:l}=r;if(l===t)return re.debug2("Ignoring change to existing filter"),!1}return n.set(e,{text:t,filter:Vn.makeQuickFilter(o,t,i.timeZone)}),!0}return n.delete(e)}setAdvancedFilterMap(e){this.setState({advancedFilters:e})}setAdvancedFilter(e,t,n){re.debug("Setting advanced filter",e,t),this.startLoading("Filtering...",!0),this.setState(({advancedFilters:s})=>{const i=new Map(s);return t==null?i.delete(e):i.set(e,{filter:t,options:n}),{advancedFilters:i}})}setQuickFilter(e,t,n){re.debug("Setting quick filter",e,t,n),this.startLoading("Filtering...",!0),this.setState(({quickFilters:s})=>{const i=new Map(s);return i.set(e,{filter:t,text:n}),{quickFilters:i}})}setFilterMap(e){var i;re.debug("setFilterMap",e);const{advancedSettings:t}=this.props;((i=t.get(hs.LINK_CHANGE_CLEARS_ALL_FILTERS))!=null?i:!1)&&this.clearAllFilters();const{model:s}=this.props;e.forEach(({columnType:o,filterList:r},l)=>{const a=s.columns.find(u=>u.name===l&&u.type===o);if(a==null)return;const c=s.getColumnIndexByName(a.name);O(c);const d=te.combineFiltersFromList(o,r);if(d.length===0)this.removeQuickFilter(c);else{const{formatter:u}=s;this.setQuickFilter(c,Vn.makeQuickFilter(a,d,u.timeZone),`${d}`)}})}removeColumnFilter(e){this.startLoading("Filtering...",!0),this.setState(({advancedFilters:t,quickFilters:n})=>{const s=t?new Map(t):new Map,i=n?new Map(n):new Map;return i.delete(e),s.delete(e),{quickFilters:i,advancedFilters:s}})}removeQuickFilter(e){this.startLoading("Clearing Filter...",!0),this.setState(({quickFilters:t})=>{const n=new Map(t);return n.delete(e),{quickFilters:n}})}clearAllFilters(){re.debug("Clearing all filters");const{advancedFilters:e,quickFilters:t,searchFilter:n}=this.state;t.size===0&&e.size===0&&n===null||(this.clearGridInputField(),this.startLoading("Clearing Filters...",!0),this.setState({quickFilters:new Map,advancedFilters:new Map,searchValue:"",searchFilter:void 0}))}clearCrossColumSearch(){re.debug("Clearing cross-column search"),this.setState({searchValue:"",searchFilter:void 0})}clearGridInputField(){this.filterInputRef.current!=null&&this.filterInputRef.current.setValue("")}rebuildFilters(){re.debug("Rebuilding filters");const{model:e}=this.props,{advancedFilters:t,quickFilters:n}=this.state,{columns:s,formatter:i}=e,o=new Map,r=new Map;t.forEach((l,a)=>{const{options:c}=l,d=s[a],u=A.makeAdvancedFilter(d,c,i.timeZone);o.set(a,{options:c,filter:u})}),n.forEach((l,a)=>{const{text:c}=l,d=s[a];r.set(a,{text:c,filter:Vn.makeQuickFilter(d,c,i.timeZone)})}),this.startLoading("Rebuilding filters...",!0),this.setState({quickFilters:r,advancedFilters:o})}setFilters({quickFilters:e,advancedFilters:t}){this.setState({quickFilters:e,advancedFilters:t})}updateFormatterSettings(e,t=!0){var m,p,g;const n=ds.getColumnFormats(e),s=ds.getDateTimeFormatterOptions(e),i=(m=e==null?void 0:e.defaultDecimalFormatOptions)!=null?m:{},o=(p=e==null?void 0:e.defaultIntegerFormatOptions)!=null?p:{},r=(g=e==null?void 0:e.truncateNumbersWithPound)!=null?g:!1,l=!ht(this.globalColumnFormats,n),a=!ht(this.dateTimeFormatterOptions,s),c=!ht(this.decimalFormatOptions,e==null?void 0:e.defaultDecimalFormatOptions),d=!ht(this.integerFormatOptions,o),u=this.truncateNumbersWithPound!==r;(l||a||c||d||u)&&(this.globalColumnFormats=n,this.dateTimeFormatterOptions=s,this.decimalFormatOptions=i,this.integerFormatOptions=o,this.truncateNumbersWithPound=r,this.updateFormatter({},t),a&&t&&this.rebuildFilters())}updateFormatter(e,t=!0){var r;const{customColumnFormatMap:n}=this.state,s={customColumnFormatMap:n,...e},i=[...(r=this.globalColumnFormats)!=null?r:[],...s.customColumnFormatMap.values()],o=new en(i,this.dateTimeFormatterOptions,this.decimalFormatOptions,this.integerFormatOptions,this.truncateNumbersWithPound);re.debug("updateFormatter",this.globalColumnFormats,i),this.setState({...s,formatter:o},()=>{t&&this.grid&&this.grid.forceUpdate()})}initFormatter(){const{settings:e}=this.props;this.updateFormatterSettings(e)}initState(){const{applyInputFiltersOnInit:e,inputFilters:t,sorts:n,model:s,reverseType:i,customColumns:o,searchValue:r,selectedSearchColumns:l,invertSearchColumns:a}=this.props,c=l!=null?l:[],d=Vi.createSearchFilter(r,c,s.columns,a);if(e){const u=t.filter(m=>m.value!=null);this.applyInputFilters(u)}this.setState({sorts:n,reverseType:i,customColumns:o,isReady:!0,searchFilter:d}),this.initFormatter()}async loadPartitionsTable(e){const{model:t}=this.props;this.setState({isSelectingPartition:!0});try{const n=await this.pending.add(t.valuesTable(e),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,e),this.setState({isSelectingPartition:!0})}else re.info("Table does not have any data, just fetching all"),this.setState({isSelectingPartition:!1}),this.handlePartitionFetchAll();this.setState({partitionTable:n,partitionColumn:e},()=>{this.initState()})}catch(n){this.handleTableLoadError(n)}}updatePartition(e,t){const s=[t.filter().eq(I.FilterValue.ofString(e))];this.setState({partition:e,partitionFilters:s})}copyCell(e,t,n=!1){const{canCopy:s}=this.props;if(s){const i=String(this.getValueForCell(e,t,n));ui(i).catch(o=>re.error("Unable to copy cell",o))}else re.error("Attempted to copyCell for user without copy permission.")}copyRanges(e,t=!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:Z.boundedRanges(e,i.columnCount,i.rowCount),includeHeaders:t,formatValues:n,movedColumns:l,userColumnWidths:a,error:s};this.setState({copyOperation:c})}else re.error("Attempted copyRanges for user without copy permission.")}startLoading(e,t=!1){var s,i;this.setState({loadingText:e});const n=this.getTheme();if(t&&this.grid&&(this.grid.clearSelectedRanges(),this.grid.setViewState({top:0},!0)),this.loadingScrimStartTime==null){const{minScrimTransitionTime:o,maxScrimTransitionTime:r}=n;O(o),O(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})},Vn.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){re.debug("loading last loading config",this.lastLoadedConfig);const{advancedFilters:e,aggregationSettings:t,customColumns:n,quickFilters:s,reverseType:i,rollupConfig:o,searchFilter:r,selectDistinctColumns:l,sorts:a}=this.lastLoadedConfig;this.lastLoadedConfig=null,this.setState({advancedFilters:e,aggregationSettings:t,customColumns:n,quickFilters:s,reverseType:i,rollupConfig:o,searchFilter:r,selectDistinctColumns:l,sorts:a})}else re.debug("remove all sorts, filters, and custom columns"),this.setState({advancedFilters:new Map,aggregationSettings:Tc,customColumns:[],quickFilters:new Map,reverseType:A.REVERSE_TYPE.NONE,rollupConfig:void 0,selectDistinctColumns:[],sorts:[]})}canRollback(){return this.lastLoadedConfig!=null||!Wl(this.state)}startListening(e){e.addEventListener(me.EVENT.UPDATED,this.handleUpdate),e.addEventListener(me.EVENT.REQUEST_FAILED,this.handleRequestFailed),e.addEventListener(me.EVENT.COLUMNS_CHANGED,this.handleCustomColumnsChanged),e.addEventListener(me.EVENT.PENDING_DATA_UPDATED,this.handlePendingDataUpdated)}stopListening(e){e.removeEventListener(me.EVENT.UPDATED,this.handleUpdate),e.removeEventListener(me.EVENT.REQUEST_FAILED,this.handleRequestFailed),e.removeEventListener(me.EVENT.COLUMNS_CHANGED,this.handleCustomColumnsChanged),e.removeEventListener(me.EVENT.PENDING_DATA_UPDATED,this.handlePendingDataUpdated)}focus(){var e;(e=this.grid)==null||e.focus()}focusFilterBar(e){var d,u,m;const{movedColumns:t}=this.state,{model:n}=this.props,{columnCount:s}=n,i=B.getModelIndex(e,t);if(e==null||e<0||s<=e||!n.isFilterable(i)){this.setState({focusedFilterBarColumn:null});return}const{metricCalculator:o,metrics:r}=this.state;O(r);const{left:l,rightVisible:a,lastLeft:c}=r;if(e<l)(d=this.grid)==null||d.setViewState({left:e},!0);else if(a<e){const p=(u=this.grid)==null?void 0:u.getMetricState();O(p);const g=o.getLastLeft(p,e,o.getVisibleWidth(p));(m=this.grid)==null||m.setViewState({left:Math.min(g,c),leftOffset:0},!0)}this.lastFocusedFilterBarColumn=e,this.setState({focusedFilterBarColumn:e,isFilterBarShown:!0})}hideColumnByVisibleIndex(e){var s;const{metricCalculator:t,movedColumns:n}=this.state;t.setColumnWidth(B.getModelIndex(e,n),0),(s=this.grid)==null||s.forceUpdate()}freezeColumnByColumnName(e){const{frozenColumns:t,movedColumns:n}=this.state,{model:s}=this.props;re.debug2("freezing column",e);const i=t==null?new Set(s.frozenColumns):new Set(t);i.add(e);const o=s.getColumnIndexByName(e);O(o);const r=B.getVisibleIndex(o,n),l=B.moveItem(r,i.size-1,n);this.setState({frozenColumns:[...i],movedColumns:l})}unFreezeColumnByColumnName(e){const{frozenColumns:t,movedColumns:n}=this.state,{model:s}=this.props;re.debug2("unfreezing column",e);const i=t==null?new Set(s.frozenColumns):new Set(t);i.delete(e);const o=s.getColumnIndexByName(e);O(o);const r=B.getVisibleIndex(o,n),l=B.moveItem(r,i.size+s.frontColumns.length,n);this.setState({frozenColumns:[...i],movedColumns:l})}handleColumnVisibilityChanged(e,t){var s;const{metricCalculator:n}=this.state;t?e.forEach(i=>{n.resetColumnWidth(i)}):e.forEach(i=>{n.setColumnWidth(i,0)}),(s=this.grid)==null||s.forceUpdate()}handleCrossColumnSearch(e,t,n){const{model:s}=this.props;this.updateSearchFilter(e,t,s.columns,n),this.setState({searchValue:e,selectedSearchColumns:t,invertSearchColumns:n})}handleAnimationLoop(){var e,t;(e=this.grid)==null||e.updateCanvasScale(),(t=this.grid)==null||t.updateCanvas(),this.isAnimating&&(this.animationFrame=requestAnimationFrame(this.handleAnimationLoop))}handleAnimationStart(){re.debug2("handleAnimationStart"),this.isAnimating=!0,this.animationFrame=requestAnimationFrame(this.handleAnimationLoop)}handleAnimationEnd(){re.debug2("handleAnimationEnd"),this.isAnimating=!1}handlePartitionAppend(e){const{onPartitionAppend:t}=this.props,{partitionColumn:n}=this.state;!n||t(n,e)}handlePartitionChange(e){const{partitionColumn:t}=this.state;!t||this.updatePartition(e,t)}handlePartitionFetchAll(){this.setState({partitionFilters:[],isSelectingPartition:!1})}handlePartitionDone(){this.setState({isSelectingPartition:!1})}handleTableLoadError(e){if(Pe.isCanceled(e))return;re.error(e);const{onError:t}=this.props;t(e)}showAllColumns(){var s;const{metricCalculator:e}=this.state,n=[...e.getUserColumnWidths().entries()];for(let i=0;i<n.length;i+=1){const[o,r]=n[i];r===0&&e.resetColumnWidth(o)}(s=this.grid)==null||s.forceUpdate()}toggleSort(e,t){re.info("Toggling sort for column",e);const{model:n}=this.props,{sorts:s}=this.state,i=this.getModelColumn(e);O(i);const o=A.toggleSortForColumn(s,n.columns,i,t);this.updateSorts(o)}updateSorts(e){var t;this.startLoading("Sorting..."),this.setState({sorts:e}),(t=this.grid)==null||t.forceUpdate()}sortColumn(e,t=A.sortDirection.none,n=!1,s=!1){var r;O(e);const{model:i}=this.props,o=A.sortColumn(i.sort,i.columns,e,t,n,s);this.startLoading("Sorting..."),this.setState({sorts:o}),(r=this.grid)==null||r.forceUpdate()}reverse(e){var t;this.startLoading("Reversing..."),this.setState({reverseType:e}),(t=this.grid)==null||t.forceUpdate()}isReversible(){const{model:e}=this.props;return e.isReversible}toggleFilterBar(e=this.lastFocusedFilterBarColumn){var n;let{isFilterBarShown:t}=this.state;if(t=!t,this.setState({isFilterBarShown:t}),t)if(e!=null)this.focusFilterBar(e);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&&A.isTextType(a.type)){s=r;break}}}this.focusFilterBar(s)}else(n=this.grid)==null||n.focus()}isTableSearchAvailable(){var s,i,o;const{model:e,canToggleSearch:t}=this.props,n=(s=e==null?void 0:e.layoutHints)==null?void 0:s.searchDisplayMode;return n===((i=I.SearchDisplayMode)==null?void 0:i.SEARCH_DISPLAY_HIDE)?!1:n===((o=I.SearchDisplayMode)==null?void 0:o.SEARCH_DISPLAY_SHOW)?!0:t}toggleSearchBar(){const{showSearchBar:e}=this.state;if(!this.isTableSearchAvailable())return;const t=!e;this.setState({showSearchBar:t},()=>{var n,s,i;t&&((n=this.crossColumnRef)==null?void 0:n.current)?(s=this.crossColumnRef)==null||s.current.focus():(i=this.grid)==null||i.focus()})}toggleGotoRow(e=""){const{isGotoRowShown:t}=this.state;if(e){this.setState({isGotoRowShown:!0,gotoRow:e,gotoRowError:""});return}this.setState({isGotoRowShown:!t,gotoRow:"",gotoRowError:""})}async commitPending(){var i,o;const{model:e}=this.props;if(!Oe(e)||!e.isEditable)throw new Error("Cannot save, table is not editable");const{pendingSavePromise:t}=this.state;if(t!=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 ku("Current input is invalid");(o=this.grid)==null||o.focus()}const s=this.pending.add(e.commitPending()).then(()=>{this.setState({pendingSaveError:null,pendingSavePromise:null})}).catch(r=>{Pe.isCanceled(r)||this.setState({pendingSaveError:r,pendingSavePromise:null})});return this.setState({pendingSavePromise:s}),s}async discardPending(){const{pendingSavePromise:e}=this.state;if(e!=null)throw new Error("Cannot cancel a save in progress");this.setState({pendingSavePromise:null,pendingSaveError:null,pendingDataMap:new Map,pendingDataErrors:new Map})}selectColumn(e){const{onColumnSelected:t}=this.props;t(e)}selectData(e,t){const{model:n}=this.props,{columns:s,groupedColumns:i}=n,o={};for(let l=0;l<s.length;l+=1){const a=s[l],{name:c,type:d}=a,u=n.valueForCell(l,t),m=n.textForCell(l,t),p=this.getVisibleColumn(l),g=We(n)&&n.isRowExpandable(t),f=i.find(C=>C.name===c)!=null;o[c]={value:u,text:m,type:d,isGrouped:f,isExpandable:g,visibleIndex:p}}const{onDataSelected:r}=this.props;r(t,o)}handleAdvancedFilterChange(e,t,n){const{model:s}=this.props,i=s.getColumnIndexByName(e.name);O(i),this.setAdvancedFilter(i,t,n)}handleAdvancedFilterSortChange(e,t,n=!1){var a;const{model:s}=this.props,i=s.getColumnIndexByName(e.name);O(i);const o=A.getSortForColumn(s.sort,i);let r=null;(o==null||o.direction!==t)&&(t===A.sortDirection.descending?r=e.sort().desc():r=e.sort().asc());const l=A.setSortForColumn(s.sort,i,r,n);re.info("Setting table sorts",l),this.startLoading("Sorting..."),this.setState({sorts:l}),(a=this.grid)==null||a.forceUpdate()}handleAdvancedFilterDone(){var e;(e=this.grid)==null||e.focus()}handleAdvancedMenuOpened(e){this.setState({shownAdvancedFilter:e})}handleGotoRowOpened(){this.setState({isGotoRowShown:!0})}handleGotoRowClosed(){this.setState({isGotoRowShown:!1})}handleAdvancedMenuClosed(e){var s,i;const{focusedFilterBarColumn:t,isFilterBarShown:n}=this.state;n&&t===e&&((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(e){const{model:t,onCreateChart:n}=this.props;n(e,t)}handleGridError(e){re.warn("Grid Error",e),this.setState({toastMessage:h("div",{className:"error-message",children:`${e}`})})}handleFilterBarChange(e){this.startLoading("Filtering...",!0),this.setState(({focusedFilterBarColumn:t,quickFilters:n})=>{const s=new Map(n);if(t!=null){const i=this.getModelColumn(t);O(i),this.applyQuickFilter(i,e,s)}return{quickFilters:s}})}handleFilterBarDone(e=!0,t=!0){var n;e&&((n=this.grid)==null||n.focus()),t&&this.setState({focusedFilterBarColumn:null})}handleFilterBarTab(e){const{focusedFilterBarColumn:t}=this.state;O(t),e?this.focusFilterBar(t-1):this.focusFilterBar(t+1)}handleFormatSelection(e,t){const{model:n}=this.props,s=n.columns[e],{customColumnFormatMap:i}=this.state,o=new Map(i);if(t!=null){const r=A.getNormalizedType(s.type);O(r);const l=en.makeColumnFormattingRule(r,s.name,t);o.set(s.name,l)}else o.delete(s.name);this.updateFormatter({customColumnFormatMap:o})}handleMenu(e){e.stopPropagation(),this.setState({isMenuShown:!0})}handleMenuClose(){this.setState({isMenuShown:!1,openOptions:[]})}handleMenuBack(){this.setState(({openOptions:e})=>{const t=[...e];return t.pop(),{openOptions:t}})}handleMenuSelect(e){this.setState(({openOptions:t})=>({openOptions:[...t,e]}))}handleRequestFailed(e){const t=e;if(re.error("request failed:",t.detail),this.stopLoading(),this.canRollback())this.startLoading("Rolling back changes...",!0),this.rollback();else{re.error("Table failed and unable to rollback");const{onError:n}=this.props;n(new Error(`Error displaying table: ${t.detail}`))}}handleUpdate(){var d;this.stopLoading(),re.debug2("Received model update");const{advancedFilters:e,aggregationSettings:t,customColumns:n,quickFilters:s,reverseType:i,rollupConfig:o,searchFilter:r,selectDistinctColumns:l,sorts:a}=this.state,c={advancedFilters:e,aggregationSettings:t,customColumns:n,quickFilters:s,reverseType:i,rollupConfig:o,searchFilter:r,selectDistinctColumns:l,sorts:a};Wl(c)?this.lastLoadedConfig=null:this.lastLoadedConfig=c,(d=this.grid)==null||d.forceUpdate()}handleViewChanged(e){var i,o;const{model:t}=this.props,{selectionEndRow:n=0}=(o=(i=this.grid)==null?void 0:i.state)!=null?o:{};let s=0;if(Oe(t)&&t.isEditable){O(e);const{bottomViewport:r}=e,l=t.rowCount-t.floatingBottomRowCount;n===l-1?s=t.pendingRowCount+1:n===l-2?s=t.pendingRowCount:s=Math.max(0,r-(t.rowCount-t.pendingRowCount)-t.floatingTopRowCount-t.floatingBottomRowCount-1)}this.setState({metrics:e,pendingRowCount:s})}handleSelectionChanged(e){O(e);const{onSelectionChanged:t}=this.props,{copyOperation:n}=this.state;this.setState({selectedRanges:e}),n!=null&&this.setState({copyOperation:null}),t(e)}handleMovedColumnsChanged(e,t){this.setState({movedColumns:e},t)}handleHeaderGroupsChanged(e){const{model:t}=this.props;this.setState({columnHeaderGroups:te.parseColumnHeaderGroups(t,e).groups},()=>{var n;return(n=this.grid)==null?void 0:n.forceUpdate()})}handleTooltipRef(e){e!=null&&e.startTimer(),this.tooltip=e}handleConditionalFormatsChange(e){re.debug("Updated conditional formats",e),this.setState({conditionalFormats:e})}handleConditionalFormatCreate(){re.debug("Create new conditional format");const{openOptions:e,conditionalFormats:t}=this.state;this.setState({openOptions:[...e,{type:be.CONDITIONAL_FORMATTING_EDIT,title:"Create Formatting Rule"}],conditionalFormatEditIndex:t.length,conditionalFormatPreview:void 0})}handleConditionalFormatEdit(e){re.debug("Edit conditional format",e);const{openOptions:t,conditionalFormats:n}=this.state;this.setState({openOptions:[...t,{type:be.CONDITIONAL_FORMATTING_EDIT,title:"Edit Formatting Rule"}],conditionalFormatEditIndex:e,conditionalFormatPreview:{...n[e]}})}handleConditionalFormatEditorSave(e){re.debug("Save conditional format changes",e),this.setState(t=>{if(t.conditionalFormatEditIndex===null)return re.debug("Invalid format index"),null;const n=[...t.conditionalFormats];return n[t.conditionalFormatEditIndex]=e,{conditionalFormats:n}},()=>{this.handleMenuBack()})}handleConditionalFormatEditorCancel(){this.handleMenuBack(),this.setState({conditionalFormatEditIndex:null})}handleUpdateCustomColumns(e){re.info("handleUpdateCustomColumns:",e);const{model:t}=this.props,{movedColumns:n,sorts:s,quickFilters:i,advancedFilters:o,selectDistinctColumns:r}=this.state,{columns:l}=t,a=t.customColumns.map(d=>`${d}`),c=te.getRemovedCustomColumnNames(a,e);if(c.length>0){const d=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);d.length!==s.length&&(re.debug("removing sorts from removed custom columns..."),this.setState({sorts:d})),(u.size!==i.size||m.size!==o.size)&&(re.debug("removing filters from removed custom columns..."),this.setState({quickFilters:u,advancedFilters:m})),ht(n,p)||(re.debug("change moved columns for removed custom columns",p),this.setState({movedColumns:p})),ht(r,g)||(re.debug("change selectDistinct columns for removed custom columns",p),this.setState({selectDistinctColumns:g}))}this.setState({customColumns:e}),this.startLoading("Applying custom columns...")}handleCustomColumnsChanged(){var t;re.debug("custom columns changed");const{isReady:e}=this.state;e?(this.stopLoading(),(t=this.grid)==null||t.forceUpdate()):this.initState()}handlePendingCommitClicked(){return this.commitPending()}handlePendingDiscardClicked(){return this.discardPending()}handlePendingDataUpdated(){var s;re.debug("pending data updated");const{model:e}=this.props,{pendingDataMap:t,pendingDataErrors:n}=e;this.setState({pendingDataMap:t,pendingDataErrors:n,pendingSaveError:null}),(s=this.grid)==null||s.forceUpdate()}handleAggregationsChange(e){re.debug("handleAggregationsChange",e),this.startLoading(`Aggregating ${e.aggregations.map(t=>t.operation).join(", ")}...`),this.setState({aggregationSettings:e})}handleAggregationChange(e){re.debug("handleAggregationChange",e),this.startLoading(`Aggregating ${e.operation}...`),this.setState(({aggregationSettings:t})=>({selectedAggregation:e,aggregationSettings:{...t,aggregations:t.aggregations.map(n=>n.operation===e.operation?e:n)}}))}handleAggregationEdit(e){re.debug("handleAggregationEdit",e);const{openOptions:t}=this.state;this.setState({openOptions:[...t,{type:be.AGGREGATION_EDIT,title:`Edit Columns to ${e.operation}`}],selectedAggregation:e})}handleRollupChange(e){var t,n;re.info("Rollup change",e),this.resetGridViewState(),this.showAllColumns(),this.clearAllFilters(),this.startLoading(`Grouping by columns ${(n=(t=e==null?void 0:e.columns)==null?void 0:t.join(", "))!=null?n:""}...`),this.setState({rollupConfig:e,movedColumns:[],sorts:[],reverseType:A.REVERSE_TYPE.NONE,selectDistinctColumns:[]})}handleSelectDistinctChanged(e){re.debug("SelectDistinct change",e),this.resetGridViewState(),this.showAllColumns(),this.clearAllFilters(),this.startLoading(`Selecting distinct values in ${e.length>0?e.join(", "):""}...`),this.setState({selectDistinctColumns:e,movedColumns:[],sorts:[],reverseType:A.REVERSE_TYPE.NONE})}handleDownloadTableStart(){const{canDownloadCsv:e}=this.props;e?this.setState({isTableDownloading:!0,tableDownloadProgress:0,tableDownloadEstimatedTime:null,tableDownloadStatus:St.DOWNLOAD_STATUS.INITIATING}):re.error("Attempted to handleDownloadTableStart for user without download CSV permission.")}handleDownloadTable(e,t,n,s,i,o,r){const{canDownloadCsv:l}=this.props;l?(re.info("start table downloading",e,t,n,s,i,o,r),this.setState(()=>(this.tableSaver&&this.tableSaver.startDownload(e,t,n,s,i,o,r),{tableDownloadStatus:St.DOWNLOAD_STATUS.DOWNLOADING}))):re.error("Attempted to handleDownloadTable for user without download CSV permission.")}handleCancelDownloadTable(){var e;(e=this.tableSaver)==null||e.cancelDownload(),this.setState({isTableDownloading:!1})}handleDownloadCompleted(){this.setState({isTableDownloading:!1,tableDownloadProgress:100,tableDownloadStatus:St.DOWNLOAD_STATUS.FINISHED})}handleDownloadCanceled(){this.setState({isTableDownloading:!1,tableDownloadProgress:0,tableDownloadStatus:St.DOWNLOAD_STATUS.CANCELED})}deleteRanges(e){const{model:t}=this.props;this.pending.add(t.delete(e)).catch(n=>{Pe.isCanceled(n)||re.error("Unable to delete ranges",e,n)})}resetColumnSelection(){if(this.grid==null)return;const{isSelectingColumn:e}=this.props;if(e){const{columnAllowedCursor:t}=this.props;this.grid.setState({cursor:t})}else this.grid.setState({cursor:null}),this.setState({hoverSelectColumn:null})}resetGridViewState(e=!0){!this.grid||(this.grid.clearSelectedRanges(),this.grid.setViewState({left:0,top:0,topOffset:0,leftOffset:0},e))}sendStateChange(){if(!this.grid)return;const{state:e}=this,{state:t}=this.grid,{onStateChange:n}=this.props;n(e,t)}handleOverflowClose(){this.setState({showOverflowModal:!1})}getColumnBoundingRect(){var m;const{metrics:e,shownColumnTooltip:t}=this.state;O(e),O(t);const n=(m=this.gridWrapper)==null?void 0:m.getBoundingClientRect(),s=20;O(n);const{columnHeaderHeight:i,visibleColumnXs:o,visibleColumnWidths:r,width:l,columnHeaderMaxDepth:a}=e,c=o.get(t),d=r.get(t);O(c),O(d);const u=n.left+Ue(c+d/2,s,l-s);return{top:n.top+(a-1)*i,left:n.left+Ue(c+d/2,s,l-s),bottom:n.top+a*i,right:n.left+Ue(c+d/2,s,l-s)+1,width:1,height:i,x:u,y:n.top,toJSON:()=>{throw new Error("not implemented")}}}handleGotoRowSelectedRowNumberSubmit(){const{gotoRow:e}=this.state;this.focusRowInGrid(e)}focusRowInGrid(e){var i,o,r;const{model:t}=this.props,{rowCount:n}=t;if(this.setState({gotoRow:e}),e===""){this.setState({gotoRowError:""});return}const s=parseInt(e,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(e){const t=e.target.value;this.focusRowInGrid(t)}getColumnTooltip(e,t,n){const{columnHeaderHeight:s,columnHeaderMaxDepth:i,visibleColumnXs:o,visibleColumnWidths:r,width:l}=t,a=o.get(e),c=r.get(e);if(a==null||c==null)return null;const d=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:d,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(e);if(f==null)return null;const C=n.columns[f];return C==null?null:h("div",{style:m,children:h(Be,{timeout:400,interactive:!0,options:g,ref:this.handleTooltipRef,referenceObject:p,onExited:()=>{this.setState({shownColumnTooltip:null})},children:h(Ga,{model:n,column:C,onStatistics:()=>{var w;(w=this.tooltip)==null||w.update()}})},C.name)})}render(){var Mi,Di,Ni,ze,fs,Br,Gr,zr,Wr;const{children:e,customFilters:t,getDownloadWorker:n,isSelectingColumn:s,isStuckToBottom:i,isStuckToRight:o,model:r,name:l,onlyFetchVisibleColumns:a,alwaysFetchColumns:c,advancedSettings:d,onAdvancedSettingsChange:u,canDownloadCsv:m,onCreateChart:p}=this.props,{metricCalculator:g,metrics:f,isFilterBarShown:C,isSelectingPartition:w,isMenuShown:b,isReady:S,copyOperation:E,focusedFilterBarColumn:v,loadingText:y,loadingScrimProgress:M,loadingSpinnerShown:F,keyHandlers:x,mouseHandlers:U,shownColumnTooltip:V,hoverAdvancedFilter:N,shownAdvancedFilter:H,hoverSelectColumn:k,quickFilters:z,advancedFilters:P,partition:_,partitionFilters:$,partitionTable:X,partitionColumn:ee,searchFilter:ae,selectDistinctColumns:fe,movedColumns:Ce,movedRows:de,formatter:ye,conditionalFormats:Xe,conditionalFormatPreview:yt,conditionalFormatEditIndex:Ye,sorts:et,reverseType:_t,customColumns:Rt,selectedRanges:He,isTableDownloading:on,tableDownloadStatus:pt,tableDownloadProgress:ge,tableDownloadEstimatedTime:$e,showSearchBar:Ge,searchValue:Nt,selectedSearchColumns:rn,invertSearchColumns:Rn,aggregationSettings:Vt,selectedAggregation:ln,rollupConfig:ct,openOptions:Ut,pendingSavePromise:zs,pendingSaveError:ps,pendingRowCount:Ws,pendingDataErrors:jn,pendingDataMap:In,toastMessage:So,frozenColumns:vo,columnHeaderGroups:Ci,showOverflowModal:To,overflowText:wi,overflowButtonTooltipProps:$s,isGotoRowShown:qs,gotoRow:bi,gotoRowError:Eo}=this.state;if(!S)return null;const Zn=this.getTheme(),yo=this.getCachedFilter(t,z,P,$,ae),Ks=g.getUserColumnWidths(),Ro=this.getCachedStateOverride(k,C,s,M,z,P,et,_t,ct,b),Io=f?f.top:0,Xs=f?f.bottomViewport:0;let gs=null,Ys=null;a&&(gs=f?f.left:0,Ys=f?f.right:0);const Si=f!=null&&f.width>0&&f.height>0,vi=((Di=(Mi=ct==null?void 0:ct.columns)==null?void 0:Mi.length)!=null?Di:0)>0;let Qs=null;const Mo=f?Math.min(Math.max(Vn.minDebounce,Math.round(f.rowCount/200)),Vn.maxDebounce):Vn.maxDebounce;if(C&&v!=null&&f!=null){const{gridX:Ae,gridY:gt,visibleColumnXs:Mn,visibleColumnWidths:js,width:Cs}=f,Bt=Mn.get(v),dt=js.get(v);if(Bt!=null&&dt!=null){const st=Ae+Bt,an=gt-((Ni=Zn.filterBarHeight)!=null?Ni:0),Jn=dt+1,es=((ze=Zn.filterBarHeight)!=null?ze:0)-1,Fi={top:an,left:st,minWidth:Math.min(Jn,Cs-st),height:es};let Gt="",ws=!0;const ts=this.getModelColumn(v);O(ts);const bs=z.get(ts),Dn=P.get(ts);bs!=null&&(Gt=bs.text,ws=bs.filter!=null);const Ss=z.size!==0||P.size!==0;Qs=h(Ha,{ref:this.filterInputRef,style:Fi,className:G({error:!ws,active:Gt!==""||Dn!=null,"iris-grid-has-filter":Ss}),isAdvancedFilterSet:Dn!=null,onAdvancedFiltersTriggered:()=>{this.setState({shownAdvancedFilter:v})},onChange:this.handleFilterBarChange,onDone:this.handleFilterBarDone,onTab:this.handleFilterBarTab,onContextMenu:(fs=this.grid)==null?void 0:fs.handleContextMenu,debounceMs:Mo,value:Gt},v)}}let Ti=null;if(y!=null){const Ae=R("div",{className:"iris-grid-loading-status",children:[h("div",{className:G("iris-grid-loading-status-bar",{show:F}),children:y}),R("button",{type:"button",onClick:this.handleCancel,className:G("iris-grid-btn-cancel",{show:F}),children:[h(Q,{icon:di,transform:"down-1"}),"Cancel"]})]}),gt=f?f.gridY:0;Ti=h("div",{className:"iris-grid-loading",style:{top:gt},children:Ae})}let Ei=null;V!=null&&f&&(Ei=this.getColumnTooltip(V,f,r),(Br=this.tooltip)==null||Br.update());const yi=[];if(f&&C){const{gridX:Ae,gridY:gt,visibleColumns:Mn,visibleColumnXs:js,visibleColumnWidths:Cs}=f,{filterBarHeight:Bt}=Zn;for(let dt=0;dt<Mn.length;dt+=1){const st=Mn[dt],an=js.get(st),Jn=Cs.get(st),es=this.getModelColumn(st);if(es!=null&&r.isFilterable(es)&&an!=null&&Jn!=null&&Jn>0){const Gt=Ae+an+Jn-24,ws=gt-(Bt!=null?Bt:0)+2,ts={position:"absolute",top:ws,left:Gt},Dn=P.get(es)!=null,Ss=st===N||st===v||Dn,Fo=h("div",{className:G("advanced-filter-button-container",{hidden:!Ss}),style:ts,children:Ss&&h(K,{kind:"ghost",className:G("btn-link-icon advanced-filter-button",{"filter-set":Dn}),onClick:()=>{this.setState({shownAdvancedFilter:st})},onContextMenu:Rc=>{var $r;($r=this.grid)==null||$r.handleContextMenu(Rc)},onMouseEnter:()=>{this.setState({hoverAdvancedFilter:st})},onMouseLeave:()=>{this.setState({hoverAdvancedFilter:null})},children:R("div",{className:"fa-layers",children:[h(Q,{icon:dr,className:"filter-solid"}),h(Q,{icon:Ki,className:"filter-light"})]})})},st);yi.push(Fo)}}}const Ri=[];if(f){const{gridX:Ae,visibleColumns:gt,visibleColumnXs:Mn,visibleColumnWidths:js,columnHeaderHeight:Cs}=f;for(let Bt=0;Bt<gt.length;Bt+=1){const dt=gt[Bt],st=Mn.get(dt),an=js.get(dt);if(st!=null&&an!=null&&an>0){const Jn=Ae+st,es=Ae+st+an-20,Fi=C?{position:"absolute",top:Cs,left:es,width:20,height:Zn.filterBarHeight}:{position:"absolute",top:0,left:Jn,width:an,height:Cs},Gt=this.getModelColumn(dt);if(Gt!=null){const ws=r.columns[Gt],ts=P.get(Gt),{options:bs}=ts||{},Dn=A.getSortForColumn(r.sort,Gt),Ss=Dn?Dn.direction:null,Fo=h("div",{className:"advanced-filter-menu-container",style:Fi,children:h(vn,{className:"advanced-filter-menu-popper",onEntered:this.getAdvancedMenuOpenedHandler(dt),onExited:()=>{this.handleAdvancedMenuClosed(dt)},isShown:H===dt,interactive:!0,closeOnBlur:!0,options:{positionFixed:!0},children:this.getCachedAdvancedFilterMenuActions(r,ws,bs,Ss,ye)})},dt);Ri.push(Fo)}}}}const Ii=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,C,Ge,m,this.isTableSearchAvailable(),qs,d.size>0),Do=Ut.map(Ae=>{switch(Ae.type){case be.CHART_BUILDER:return h($a,{model:r,onChange:this.handleChartChange,onSubmit:this.handleChartCreate},be.CHART_BUILDER);case be.VISIBILITY_ORDERING_BUILDER:return h(kr,{model:r,movedColumns:Ce,userColumnWidths:Ks,columnHeaderGroups:Ci,onColumnVisibilityChanged:this.handleColumnVisibilityChanged,onMovedColumnsChanged:this.handleMovedColumnsChanged,onColumnHeaderGroupChanged:this.handleHeaderGroupsChanged},be.VISIBILITY_ORDERING_BUILDER);case be.CONDITIONAL_FORMATTING:return h(Yp,{rules:Xe,onChange:this.handleConditionalFormatsChange,onCreate:this.handleConditionalFormatCreate,onSelect:this.handleConditionalFormatEdit});case be.CONDITIONAL_FORMATTING_EDIT:return O(r.columns),O(this.handleConditionalFormatEditorUpdate),h(Tg,{columns:r.columns,rule:yt,onUpdate:this.handleConditionalFormatEditorUpdate,onSave:this.handleConditionalFormatEditorSave,onCancel:this.handleConditionalFormatEditorCancel});case be.CUSTOM_COLUMN_BUILDER:return h(Ar,{model:r,customColumns:Rt,onSave:this.handleUpdateCustomColumns,onCancel:this.handleMenuBack},be.CUSTOM_COLUMN_BUILDER);case be.ROLLUP_ROWS:return h(Or,{model:r,onChange:this.handleRollupChange,config:ct},be.ROLLUP_ROWS);case be.AGGREGATIONS:return h(rp,{settings:Vt,isRollup:vi,onChange:this.handleAggregationsChange,onEdit:this.handleAggregationEdit});case be.AGGREGATION_EDIT:return ln&&h(ap,{aggregation:ln,columns:r.originalColumns,onChange:this.handleAggregationChange});case be.TABLE_EXPORTER:return h(St,{model:r,name:l,userColumnWidths:Ks,movedColumns:Ce,isDownloading:on,tableDownloadStatus:pt,tableDownloadProgress:ge,tableDownloadEstimatedTime:$e!=null?$e:void 0,onDownload:this.handleDownloadTable,onDownloadStart:this.handleDownloadTableStart,onCancel:this.handleCancelDownloadTable,selectedRanges:He},be.TABLE_EXPORTER);case be.SELECT_DISTINCT:return h(tc,{model:r,selectDistinctColumns:fe,onChange:this.handleSelectDistinctChanged});case be.ADVANCED_SETTINGS:return h(Lr,{items:d,onChange:u});default:throw Error(`Unexpected option type ${Ae.type}`)}}),No=this.getCachedHiddenColumns(te.getHiddenColumns(Ks));return R("div",{className:"iris-grid",role:"presentation",children:[R("div",{className:"iris-grid-column",children:[e!=null&&h("div",{className:"iris-grid-bar",children:e}),h(lt,{in:w,timeout:xe.transitionSlowMs,classNames:"iris-grid-bar-horizontal",onEnter:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExit:this.handleAnimationStart,onExited:this.handleAnimationEnd,mountOnEnter:!0,unmountOnExit:!0,children:h("div",{className:"iris-grid-partition-selector-wrapper iris-grid-bar iris-grid-bar-primary",children:X&&ee&&_!=null&&h(ec,{table:X,getFormattedString:(Ae,gt,Mn)=>r.displayString(Ae,gt,Mn),columnName:ee.name,partition:_,onChange:this.handlePartitionChange,onFetchAll:this.handlePartitionFetchAll,onAppend:this.handlePartitionAppend,onDone:this.handlePartitionDone})})}),h(lt,{in:Ge,timeout:xe.transitionSlowMs,classNames:"iris-grid-bar-horizontal",onEnter:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExit:this.handleAnimationStart,onExited:this.handleAnimationEnd,mountOnEnter:!0,unmountOnExit:!0,children:h("div",{className:"iris-grid-bar",children:h(Vi,{value:Nt,selectedColumns:rn,invertSelection:Rn,onChange:this.handleCrossColumnSearch,columns:r.columns,ref:this.crossColumnRef})})}),R("div",{className:"grid-wrapper",ref:Ae=>{this.gridWrapper=Ae},children:[h(Us,{ref:Ae=>{this.grid=Ae},isStickyBottom:!Oe(r)||!r.isEditable,isStuckToBottom:i,isStuckToRight:o,metricCalculator:g,model:r,keyHandlers:x,mouseHandlers:U,movedColumns:Ce,movedRows:de,onError:this.handleGridError,onViewChanged:this.handleViewChanged,onSelectionChanged:this.handleSelectionChanged,onMovedColumnsChanged:this.handleMovedColumnsChanged,renderer:this.renderer,stateOverride:Ro,theme:Zn}),h(Of,{isOpen:To,text:wi,onClose:this.handleOverflowClose}),Si&&h(Ua,{model:r,modelColumns:r.columns,top:Io,bottom:Xs,left:gs,right:Ys,filter:yo,formatter:ye,sorts:et,reverseType:_t,movedColumns:Ce,customColumns:Rt,hiddenColumns:No,alwaysFetchColumns:this.getAlwaysFetchColumns(c,r.columns,Ce,r.floatingLeftColumnCount,r.floatingRightColumnCount,(zr=(Gr=this.grid)==null?void 0:Gr.state.draggingColumn)==null?void 0:zr.range),formatColumns:this.getCachedPreviewFormatColumns(this.getCachedModelColumns(r,Rt),Xe,yt,((Wr=Ut[Ut.length-1])==null?void 0:Wr.type)===be.CONDITIONAL_FORMATTING_EDIT&&Ye!=null?Ye:void 0),rollupConfig:this.getModelRollupConfig(r.originalColumns,ct,Vt),totalsConfig:this.getModelTotalsConfig(r.columns,ct,Vt),selectDistinctColumns:fe,pendingRowCount:Ws,pendingDataMap:In,frozenColumns:vo,columnHeaderGroups:Ci}),!b&&h("div",{className:"grid-settings-button",children:h(K,{kind:"ghost","data-testid":`btn-iris-grid-settings-button-${l}`,onClick:this.handleMenu,icon:h(Q,{icon:Qd,transform:"up-1"}),tooltip:"Table Options"})}),Qs,Ti,yi,Ei,Ri,$s&&this.getOverflowButtonTooltip($s)]}),h(Lf,{model:r,isShown:qs,gotoRow:bi,gotoRowError:Eo,onSubmit:this.handleGotoRowSelectedRowNumberSubmit,onGotoRowNumberChanged:this.handleGotoRowSelectedRowNumberChanged,onClose:this.handleGotoRowClosed,onEntering:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExiting:()=>{this.handleAnimationStart(),this.focus()},onExited:this.handleAnimationEnd}),h(xm,{error:ps,isSaving:zs!=null,saveTooltip:`Commit (${this.commitAction.shortcut.getDisplayText()})`,discardTooltip:`Discard (${this.discardAction.shortcut.getDisplayText()})`,pendingDataErrors:jn,pendingDataMap:In,onEntering:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExiting:this.handleAnimationStart,onExited:this.handleAnimationEnd,onSave:this.handlePendingCommitClicked,onDiscard:this.handlePendingDiscardClicked}),h(Zm,{children:So}),h(Bs,{model:r,copyOperation:E!=null?E:void 0,onEntering:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExiting:this.handleAnimationStart,onExited:this.handleAnimationEnd}),h(Gs,{ref:Ae=>{this.tableSaver=Ae},getDownloadWorker:n,onDownloadCompleted:this.handleDownloadCompleted,onDownloadCanceled:this.handleDownloadCanceled,onDownloadProgressUpdate:this.handleDownloadProgressUpdate,isDownloading:pt===St.DOWNLOAD_STATUS.DOWNLOADING,formatter:ye})]}),h(lt,{in:b,timeout:xe.transitionMidMs,classNames:"slide-left",onEntering:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExiting:this.handleAnimationStart,onExited:this.handleAnimationEnd,mountOnEnter:!0,unmountOnExit:!0,children:h("div",{className:"table-sidebar",children:R(sh,{children:[h(ul,{title:"Table Options",onClose:this.handleMenuClose,children:h(ya,{onSelect:Ae=>this.handleMenuSelect(Ii[Ae]),items:Ii})}),Do.map((Ae,gt)=>h(ul,{title:Ut[gt].title,onBack:this.handleMenuBack,onClose:this.handleMenuClose,children:Ae},Ut[gt].type))]})})}),h(oe,{actions:this.contextActions})]})}};let fi=Vn;fi.minDebounce=150;fi.maxDebounce=500;fi.loadingSpinnerDelay=800;fi.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:A.REVERSE_TYPE.NONE,customColumns:[],aggregationSettings:Tc,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:Yn.FULL_DATE_FORMAT,showTimeZone:!1,showTSeparator:!0,truncateNumbersWithPound:!1,formatter:[],decimalFormatOptions:D.exports.shape({defaultFormatString:D.exports.string}),integerFormatOptions:D.exports.shape({defaultFormatString:D.exports.string})},canCopy:!0,canDownloadCsv:!0,frozenColumns:null,theme:Ba,canToggleSearch:!0};class Uf extends Error{constructor(t,n){super(`${n} can't be empty (on pending row ${t+1})`),this.isMissingKey=!0,this.rowIndex=t,this.columnName=n}}const Le=ne.module("IrisGridTableModel"),Bf=150,Gf=0,zf=[];function Gi(e){return e.table!==void 0}const tr=class extends me{constructor(e,t=new en,n=null){var s,i;super(),this.pendingNewRowCount=0,this._columnHeaderGroupMap=new Map,this.columnHeaderParentMap=new Map,this._columnHeaderMaxDepth=null,this._columnHeaderGroups=[],this._movedColumns=null,this.getMemoizedInitialMovedColumns=Ee(o=>{var u;if(!o)return[];let r=[];const{groupMap:l}=te.parseColumnHeaderGroups(this,(u=o==null?void 0:o.columnGroups)!=null?u:[]),a=(m,p)=>{const g=this.getColumnIndexByName(m);if(g==null)throw new Error(`Unknown layout hint column: ${m}`);const f=B.getVisibleIndex(g,r);r=B.moveItem(f,p,r)},c=(m,p)=>{const g=l.get(m);if(g==null)throw new Error(`Unknown layout hint group: ${m}`);const f=g.getVisibleRange(r);r=B.moveRange(f,p,r)};if(this.frontColumns.length||this.backColumns.length||this.frozenColumns.length){const m=new Set;let p=0;this.frozenColumns.forEach(f=>{if(m.has(f))throw new Error(`Column specified in multiple layout hints: ${f}`);a(f,p),p+=1}),this.frontColumns.forEach(f=>{if(m.has(f))throw new Error(`Column specified in multiple layout hints: ${f}`);a(f,p),p+=1});let g=this.columnMap.size-1;this.backColumns.forEach(f=>{if(m.has(f))throw new Error(`Column specified in multiple layout hints: ${f}`);a(f,g),g-=1})}if(o==null?void 0:o.columnGroups){const m=[...l.values()];m.sort((p,g)=>p.depth-g.depth),m.forEach(p=>{const g=p.children[0],f=this.getColumnIndexByName(g);let C;if(f!=null)C=B.getVisibleIndex(f,r);else{const w=l.get(g);if(!w)throw new Error(`Unknown column ${g} in group ${p.name}`);[,C]=w.getVisibleRange(r)}for(let w=1;w<p.children.length;w+=1){const b=p.children[w],S=l.get(b),E=this.getColumnIndexByName(b);if(S){const y=S.getVisibleRange(r)[0]<C?C-S.childIndexes.length+1:C+1;c(b,y),C=y+S.childIndexes.length-1}else if(E!=null){const y=B.getVisibleIndex(E,r)<C?C:C+1;a(b,y),C=y}}})}return this._movedColumns=r,r}),this.getMemoizedInitialColumnHeaderGroups=Ee(o=>{var r;return te.parseColumnHeaderGroups(this,(r=o==null?void 0:o.columnGroups)!=null?r:[]).groups}),this.getMemoizedColumnMap=Ee(o=>{const r=new Map;return o.forEach(l=>r.set(l.name,l)),r}),this.getColumnIndicesByNameMap=Ee(o=>{const r=new Map;return o.forEach(({name:l},a)=>r.set(l,a)),r}),this.setViewport=Xn((o,r,l)=>{if(r<o){Le.error("Invalid viewport",o,r);return}const{viewport:a}=this;if(a!=null&&a.top===o&&a.bottom===r&&a.columns===l){Le.debug2("Ignoring duplicate viewport",a);return}this.viewport={top:o,bottom:r,columns:l},Le.debug2("setViewport",this.viewport),this.applyViewport()},Bf),this.applyViewport=Xn(()=>{if(!this.viewport)return;Le.debug2("applyViewport",this.viewport);const{top:o,bottom:r,columns:l}=this.viewport,[a,c]=this.getCachedViewportRowRange(o,r);this.applyBufferedViewport(a,c,l)},Gf,{leading:!1}),this.getCachedFormattedString=vt((o,r,l,a,c)=>o.getFormattedString(r,l,a,c),{max:1e4}),this.getCachedCustomColumnFormatFlag=vt(ds.isCustomColumnFormatDefined,{max:1e4}),this.getCachedViewportRowRange=Ee((o,r)=>{const l=r-o,a=Math.max(0,o-l*tr.ROW_BUFFER_PAGES),c=r+l*tr.ROW_BUFFER_PAGES;return[a,c]}),this.getCachedPendingErrors=Ee((o,r,l)=>{const a=new Map;return o.forEach((c,d)=>{var m;const{data:u}=c;for(let p=0;p<l;p+=1)u.has(p)||(a.has(d)||a.set(d,[]),(m=a.get(d))==null||m.push(new Uf(d,r[p].name)))}),a}),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=t,this.inputTable=n,this.subscription=null,this.table=e,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.pendingNewRowCount=0,this.columnHeaderGroups=te.parseColumnHeaderGroups(this,(i=(s=this.layoutHints)==null?void 0:s.columnGroups)!=null?i:[]).groups}export(){throw new Error("Method not implemented.")}columnStatistics(e){throw new Error("Method not implemented.")}get customColumns(){return[]}set customColumns(e){throw new Error("Method not implemented.")}get formatColumns(){return[]}set formatColumns(e){throw new Error("Method not implemented.")}updateFrozenColumns(e){throw new Error("Method not implemented.")}get rollupConfig(){throw new Error("Method not implemented.")}set rollupConfig(e){throw new Error("Method not implemented.")}get selectDistinctColumns(){throw new Error("Method not implemented.")}set selectDistinctColumns(e){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(I.Table.EVENT_DISCONNECT,this.handleTableDisconnect),this.table.addEventListener(I.Table.EVENT_RECONNECT,this.handleTableReconnect),this.table.addEventListener(I.Table.EVENT_UPDATED,this.handleTableUpdate),this.table.addEventListener(I.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed),this.table.addEventListener(I.Table.EVENT_CUSTOMCOLUMNSCHANGED,this.handleCustomColumnsChanged),this.totalsTable!=null&&this.addTotalsListeners(this.totalsTable),this.applyViewport()}stopListening(){super.stopListening(),this.table.removeEventListener(I.Table.EVENT_DISCONNECT,this.handleTableDisconnect),this.table.removeEventListener(I.Table.EVENT_RECONNECT,this.handleTableReconnect),this.table.removeEventListener(I.Table.EVENT_UPDATED,this.handleTableUpdate),this.table.removeEventListener(I.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed),this.table.removeEventListener(I.Table.EVENT_CUSTOMCOLUMNSCHANGED,this.handleCustomColumnsChanged),this.totalsTable!=null&&this.removeTotalsListeners(this.totalsTable),this.closeSubscription()}addTotalsListeners(e){e.addEventListener(I.Table.EVENT_UPDATED,this.handleTotalsUpdate),e.setViewport(0,0)}removeTotalsListeners(e){e.removeEventListener(I.Table.EVENT_UPDATED,this.handleTotalsUpdate)}handleTableDisconnect(){this.dispatchEvent(new Re(me.EVENT.DISCONNECT))}handleTableReconnect(){this.dispatchEvent(new Re(me.EVENT.RECONNECT))}handleTableUpdate(e){this.copyViewportData(e.detail),this.dispatchEvent(new Re(me.EVENT.UPDATED))}handleTotalsUpdate(e){this.copyTotalsData(e.detail),this.dispatchEvent(new Re(me.EVENT.UPDATED))}handleRequestFailed(e){this.dispatchEvent(new Re(me.EVENT.REQUEST_FAILED,e))}handleCustomColumnsChanged(){this.dispatchEvent(new Re(me.EVENT.COLUMNS_CHANGED,{detail:this.columns}))}get rowCount(){var e,t,n;return this.table.size+this.pendingNewRowCount+((n=(t=(e=this.totals)==null?void 0:e.operationOrder)==null?void 0:t.length)!=null?n:0)}get pendingDataErrors(){var e,t;return this.getCachedPendingErrors(this.pendingNewDataMap,this.columns,(t=(e=this.inputTable)==null?void 0:e.keyColumns.length)!=null?t:0)}get pendingDataMap(){return this.pendingNewDataMap}set pendingDataMap(e){e!==this.pendingNewDataMap&&(e.forEach((t,n)=>{if(!te.isValidIndex(n))throw new Error(`Invalid rowIndex ${n}`);const{data:s}=t;s.forEach((i,o)=>{if(!te.isValidIndex(o))throw new Error(`Invalid columnIndex ${o}`)})}),this.pendingNewDataMap=e,this.pendingNewRowCount=Math.max(this.pendingNewRowCount,this.maxPendingDataRow),this.formattedStringData=[],this.dispatchEvent(new Re(me.EVENT.PENDING_DATA_UPDATED)))}get pendingRowCount(){return this.pendingNewRowCount}set pendingRowCount(e){e!==this.pendingNewRowCount&&(this.pendingNewRowCount=Math.max(0,e,this.maxPendingDataRow),this.dispatchEvent(new Re(me.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 e,t,n;return this.totals!=null&&this.totals.showOnTop?0:(n=(t=(e=this.totals)==null?void 0:e.operationOrder)==null?void 0:t.length)!=null?n:0}get floatingTopRowCount(){var e,t,n;return this.totals!=null&&this.totals.showOnTop&&(n=(t=(e=this.totals)==null?void 0:e.operationOrder)==null?void 0:t.length)!=null?n:0}get isChartBuilderAvailable(){return!0}get isTotalsAvailable(){return this.table.getTotalsTable!=null}get isEditable(){return!this.isSaveInProgress&&this.inputTable!=null}cacheFormattedValue(e,t,n){this.formattedStringData[e]==null&&(this.formattedStringData[e]=[]),this.formattedStringData[e][t]=n}cachePendingValue(e,t,n){this.pendingStringData[e]==null&&(this.pendingStringData[e]=[]),this.pendingStringData[e][t]=n}clearPendingValue(e,t){const n=this.pendingStringData[e];n!=null&&delete n[t]}textValueForCell(e,t){var n,s,i;if(((n=this.pendingStringData[e])==null?void 0:n[t])!==void 0)return this.pendingStringData[e][t];if(((s=this.formattedStringData[e])==null?void 0:s[t])===void 0){const o=this.valueForCell(e,t);if(o==null)return null;const r=(i=this.totalsColumn(e,t))!=null?i:this.columns[e],l=this.getCachedCustomColumnFormatFlag(this.formatter,r.name,r.type);let a;if(!l){const d=this.formatForCell(e,t);(d==null?void 0:d.formatString)!=null&&(a=d)}const c=this.displayString(o,r.type,r.name,a);this.cacheFormattedValue(e,t,c)}return this.formattedStringData[e][t]}textForCell(e,t){const n=this.textValueForCell(e,t);if(n==null&&this.isKeyColumn(e)){const s=this.pendingRow(t);if(s!=null&&this.pendingDataMap.has(s))return"*"}return n!=null?n:""}truncationCharForCell(e){const t=this.columns[e],{type:n}=t;if(A.isNumberType(n)&&this.formatter.truncateNumbersWithPound)return"#"}colorForCell(e,t,n){var i;const s=this.dataForCell(e,t);if(s){const{format:o,value:r}=s;if(r==null||r==="")return O(n.nullStringColor),n.nullStringColor;if(o&&o.color)return o.color;if(this.isPendingRow(t))return O(n.pendingTextColor),n.pendingTextColor;if(r!=null){const l=(i=this.totalsColumn(e,t))!=null?i:this.columns[e];if(A.isDateType(l.type)||l.name==="Date")return O(n.dateColor),n.dateColor;if(A.isNumberType(l.type))return r>0?(O(n.positiveNumberColor),n.positiveNumberColor):r<0?(O(n.negativeNumberColor),n.negativeNumberColor):(O(n.zeroNumberColor),n.zeroNumberColor)}}else if(this.isPendingRow(t)&&this.isKeyColumn(e))return O(n.errorTextColor),n.errorTextColor;return n.textColor}backgroundColorForCell(e,t){var n,s;return(s=(n=this.formatForCell(e,t))==null?void 0:n.backgroundColor)!=null?s:null}textAlignForCell(e){const t=this.columns[e],{type:n}=t;return A.isNumberType(n)?"right":A.isDateType(n)||t.name==="Date"?"center":"left"}textForColumnHeader(e,t=0){const n=this.columnAtDepth(e,t);return Po(n)?n.isNew?"":n.name:n==null?void 0:n.name}colorForColumnHeader(e,t=0){var s;const n=this.columnAtDepth(e,t);return Po(n)&&(s=n.color)!=null?s:null}getColumnHeaderGroup(e,t){const n=this.columnAtDepth(e,t);if(Po(n))return n}getColumnHeaderParentGroup(e,t){var n,s;return this.columnHeaderParentMap.get((s=(n=this.columnAtDepth(e,t))==null?void 0:n.name)!=null?s:"")}columnAtDepth(e,t=0){var o;if(t===0)return this.columns[e];const n=(o=this.columns[e])==null?void 0:o.name;let s=this.columnHeaderParentMap.get(n);if(!s)return;let i=s.depth;for(;i<t;){if(s=this.columnHeaderParentMap.get(s.name),!s)return;i=s.depth}if(s.depth===t)return s}textForRowFooter(e){const t=this.totalsRow(e);return t!=null&&this.totals?this.totals.operationOrder[t]:""}get initialMovedColumns(){var e;return this.getMemoizedInitialMovedColumns((e=this.layoutHints)!=null?e:void 0)}get initialMovedRows(){return zf}get initialColumnHeaderGroups(){var e;return this.getMemoizedInitialColumnHeaderGroups((e=this.layoutHints)!=null?e:void 0)}get columnMap(){return this.getMemoizedColumnMap(this.table.columns)}get columnHeaderMaxDepth(){var e;return(e=this._columnHeaderMaxDepth)!=null?e:1}set columnHeaderMaxDepth(e){this._columnHeaderMaxDepth=e}get columnHeaderGroupMap(){return this._columnHeaderGroupMap}get columnHeaderGroups(){return this._columnHeaderGroups}set columnHeaderGroups(e){if(e===this._columnHeaderGroups)return;const{groups:t,maxDepth:n,parentMap:s,groupMap:i}=te.parseColumnHeaderGroups(this,e!=null?e:this.initialColumnHeaderGroups);this._columnHeaderGroups=t,this.columnHeaderMaxDepth=n,this.columnHeaderParentMap=s,this._columnHeaderGroupMap=i}get groupedColumns(){return[]}row(e){var l,a,c,d,u,m,p,g,f,C,w,b,S,E;const t=(c=(a=(l=this.totals)==null?void 0:l.operationOrder)==null?void 0:a.length)!=null?c:0,n=(u=(d=this.totals)==null?void 0:d.showOnTop)!=null?u:!1,s=this.totalsRow(e);if(s!=null){const v=(m=this.totals)==null?void 0:m.operationOrder[s];return O(v),(g=(p=this.totalsDataMap)==null?void 0:p.get(v))!=null?g:null}const i=this.pendingRow(e);if(i!=null)return(f=this.pendingNewDataMap.get(i))!=null?f:null;const o=(w=(C=this.viewportData)==null?void 0:C.offset)!=null?w:0,r=(n?e-t:e)-o;return(E=(S=(b=this.viewportData)==null?void 0:b.rows)==null?void 0:S[r])!=null?E:null}totalsColumn(e,t){var r,l,a,c;const n=this.totalsRow(t);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:Se.SUM,o=this.columns[e];return(c=this.totalsTable)==null?void 0:c.columns.find(d=>{var u;return d.name===`${o.name}__${s}`||(s===i||((u=this.totals)==null?void 0:u.operationOrder.length)===1)&&d.name===o.name})}totalsRow(e){var i,o,r,l,a;const t=(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)?e:e-this.table.size;return s>=0&&s<t?s:null}pendingRow(e){const t=e-this.floatingTopRowCount-this.table.size;return t>=0&&t<this.pendingNewRowCount?t:null}isTotalsRow(e){return this.totalsRow(e)!=null}isPendingRow(e){return this.pendingRow(e)!=null}dataForCell(e,t){var n;return(n=this.row(t))==null?void 0:n.data.get(e)}formatForCell(e,t){var n;return(n=this.dataForCell(e,t))==null?void 0:n.format}valueForCell(e,t){var s;const n=this.dataForCell(e,t);if(n)return(s=n.value)!=null?s:null}copyViewportData(e){if(e==null){Le.warn("invalid data!");return}this.viewportData=this.extractViewportData(e),this.formattedStringData=[]}copyTotalsData(e){var l,a,c,d,u;if(e==null){Le.warn("invalid data!");return}const{columns:t,rows:n}=e;if(n.length!==1){Le.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:Se.SUM,r=(c=this.totals)==null?void 0:c.operationMap;for(let m=0;m<t.length;m+=1){const p=t[m],[g,f=(u=(d=r==null?void 0:r[g])==null?void 0:d[0])!=null?u:o]=p.name.split("__");s.has(f)||s.set(f,{data:new Map});const{data:C}=s.get(f),w=this.columns.findIndex(b=>b.name===g);C.set(w,{value:i.get(p),format:i.getFormat(p)})}Le.debug2("copyTotalsData",s),this.totalsDataMap=s,this.formattedStringData=[]}getColumnIndexByName(e){return this.getColumnIndicesByNameMap(this.columns).get(e)}extractViewportData(e){const t={offset:e.offset,rows:[]},{columns:n}=e;for(let s=0;s<e.rows.length;s+=1){const i=e.rows[s],o=this.extractViewportRow(i,n);t.rows.push(o)}return t}extractViewportRow(e,t){const n=new Map;for(let s=0;s<t.length;s+=1){const i=t[s],o=this.getColumnIndexByName(i.name);O(o),n.set(o,{value:e.get(i),format:e.getFormat(i)})}return{data:n}}closeSubscription(){Le.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(e){this.closeSubscription(),this.table.applyFilter(e),this.applyViewport()}get formatter(){return this.irisFormatter}set formatter(e){this.irisFormatter=e,this.formattedStringData=[],this.dispatchEvent(new Re(me.EVENT.FORMATTER_UPDATED))}displayString(e,t,n="",s){return this.getCachedFormattedString(this.formatter,e,t,n,s)}get sort(){return this.table.sort}set sort(e){this.closeSubscription(),this.table.applySort(e),this.applyViewport()}set totalsConfig(e){if(Le.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 Re(me.EVENT.UPDATED));return}this.totalsTablePromise=Pe.makeCancelable(this.table.getTotalsTable(e),t=>t.close()),this.totalsTablePromise.then(t=>{this.totalsTablePromise=null,this.setTotalsTable(t)}).catch(t=>{Pe.isCanceled(t)||(Le.error("Unable to set next totalsTable",t),this.totalsTablePromise=null,this.dispatchEvent(new Re(me.EVENT.REQUEST_FAILED,{detail:t})))})}}setTotalsTable(e){Le.debug("setTotalsTable",e),this.totalsTable!==null&&(this.listenerCount>0&&this.removeTotalsListeners(this.totalsTable),this.totalsTable.close()),this.totalsTable=e,this.totalsDataMap=null,this.listenerCount>0&&this.totalsTable!=null&&this.addTotalsListeners(this.totalsTable)}applyBufferedViewport(e,t,n){Le.debug2("applyBufferedViewport",e,t,n),this.subscription==null?(Le.debug2("applyBufferedViewport creating new subscription"),this.subscription=this.table.setViewport(e,t,n)):(Le.debug2("applyBufferedViewport using existing subscription"),this.subscription.setViewport(e,t,n))}async snapshot(e,t=!1,n=i=>i,s=!0){if(this.subscription==null)throw new Error("No subscription available");const i=s?Z.consolidate(e):e;if(!te.isValidSnapshotRanges(i))throw new Error(`Invalid snapshot ranges ${e}`);const o=new Set,r=[],l=new Set;for(let m=0;m<i.length;m+=1){const p=i[m];O(p.endRow),O(p.startRow);for(let g=p.startRow;g<=p.endRow&&g<this.floatingTopRowCount;g+=1)o.add(g);p.endRow>=this.floatingTopRowCount&&p.startRow<=this.floatingTopRowCount+this.table.size&&r.push(new Z(p.startColumn,Math.min(Math.max(0,p.startRow-this.floatingTopRowCount)),p.endColumn,Math.min(Math.max(0,p.endRow-this.floatingTopRowCount),this.table.size-this.floatingTopRowCount)));for(let g=Math.max(p.startRow,this.floatingTopRowCount+this.table.size);g<=p.endRow&&g<this.floatingTopRowCount+this.table.size+this.floatingBottomRowCount;g+=1)l.add(g)}const a=te.columnsFromRanges(i,this.columns),c=[];t&&c.push(a.map(m=>m.name));const d=[...o].sort();for(let m=0;m<d.length;m+=1){const p=d[m],g=a.map(f=>{const C=this.getColumnIndexByName(f.name);return O(C),n(this.valueForCell(C,p),f)});t&&g.push(this.textForRowFooter(p)),c.push(g)}if(r.length>0){const m=te.rangeSetFromRanges(r),p=await this.subscription.snapshot(m,a);c.push(...p.rows.map(g=>a.map(f=>n(g.get(f),f))))}const u=[...l].sort();for(let m=0;m<u.length;m+=1){const p=u[m],g=a.map(f=>{const C=this.getColumnIndexByName(f.name);return O(C),n(this.valueForCell(C,p),f)});t&&g.push(this.textForRowFooter(p)),c.push(g)}return c}async textSnapshot(e,t=!1,n=s=>`${s}`){return Le.debug2("textSnapshot",e,t),(await this.snapshot(e,t,n,!1)).map(i=>i.join(" ")).join(`
|
|
32
|
+
`)}async valuesTable(e){let t=null;try{return t=await this.table.copy(),t.applyFilter([]),t.applySort([]),t.selectDistinct([e])}finally{t!=null&&t.close()}}isColumnMovable(e,t){if(e<0||e>=this.columnCount)return!1;if(t>0)return!0;const n=this.columns[e].name;return this.frontColumns.includes(n)||this.backColumns.includes(n)||this.frozenColumns.includes(n)||!n?!1:!this.isKeyColumn(e)}isKeyColumn(e){var t,n;return e<((n=(t=this.inputTable)==null?void 0:t.keyColumns.length)!=null?n:0)}isRowMovable(){return!1}isEditableRange(e){return this.inputTable!=null&&Z.isBounded(e)&&(this.isPendingRow(e.startRow)&&this.isPendingRow(e.endRow)||e.startColumn>=this.inputTable.keyColumns.length&&e.endColumn>=this.inputTable.keyColumns.length)&&e.startRow>=this.floatingTopRowCount&&e.startRow<this.floatingTopRowCount+this.table.size+this.pendingRowCount&&e.endRow<this.floatingTopRowCount+this.table.size+this.pendingRowCount}isDeletableRange(e){return this.inputTable!=null&&e.startRow!=null&&e.endRow!=null&&e.startRow>=this.floatingTopRowCount&&e.startRow<this.floatingTopRowCount+this.table.size+this.pendingRowCount&&e.endRow<this.floatingTopRowCount+this.table.size+this.pendingRowCount}isEditableRanges(e){return e.every(t=>this.isEditableRange(t))}isDeletableRanges(e){return e.every(t=>this.isDeletableRange(t))}getTableAreaRange(){return new Z(null,this.floatingTopRowCount,null,this.floatingTopRowCount+this.table.size-1)}getPendingAreaRange(){return new Z(null,this.floatingTopRowCount+this.table.size,null,this.floatingTopRowCount+this.table.size+this.pendingNewRowCount-1)}async setValueForCell(e,t,n){return this.setValueForRanges([new Z(e,t,e,t)],n)}async setValueForRanges(e,t){var n;if(!this.isEditableRanges(e))throw new Error(`Uneditable ranges ${e}`);try{const s=new Set,i=[];Z.forEachCell(e,(c,d)=>{const u=this.columns[c];if(s.add(u),i[c]===void 0){const m=A.makeValue(u.type,t,this.formatter.timeZone);i[c]=m!=null?this.displayString(m,u.type,u.name):null}this.cachePendingValue(c,d,i[c])});const o=this.getPendingAreaRange(),r=e.map(c=>Z.intersection(o,c)).filter(c=>c!=null).map(c=>(O(c),Z.offset(c,0,-(this.floatingTopRowCount+this.table.size))));if(r.length>0){const c=new Map(this.pendingNewDataMap);Z.forEachCell(r,(d,u)=>{c.has(u)||c.set(u,{data:new Map});const m=this.columns[d],p=c.get(u);O(p);const{data:g}=p,f=new Map(g),C=A.makeValue(m.type,t,this.formatter.timeZone);C!=null?f.set(d,{value:C}):f.delete(d),f.size>0?c.set(u,{...p,data:f}):c.delete(u)}),this.pendingDataMap=c}this.dispatchEvent(new Re(me.EVENT.UPDATED));const l=this.getTableAreaRange(),a=e.map(c=>Z.intersection(l,c)).filter(c=>c!=null);if(a.length>0){const d=(await this.snapshot(a.map(m=>{var p,g;return new Z(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]=A.makeValue(g.type,t,this.formatter.timeZone)}),p}),u=await((n=this.inputTable)==null?void 0:n.addRows(d));Le.debug("setValueForRanges(",e,",",t,") set tableRanges",a,"result",u)}Z.forEachCell(e,(c,d)=>{const u=i[c];O(u),this.cacheFormattedValue(c,d,u)})}catch(s){Le.error("Unable to set ranges",e,t,s)}finally{Z.forEachCell(e,(s,i)=>{this.clearPendingValue(s,i)})}}async setValues(e=[]){var t;if(Le.debug("setValues(",e,")"),!e.every(n=>{var s,i;return this.isEditableRange(Z.makeCell((s=n.column)!=null?s:n.x,(i=n.row)!=null?i:n.y))}))throw new Error(`Uneditable ranges ${e}`);try{const n=new Map(this.pendingNewDataMap);e.forEach(l=>{var f,C;const{text:a}=l,c=(f=l.column)!=null?f:l.x,d=(C=l.row)!=null?C:l.y,u=this.columns[c],m=A.makeValue(u.type,a,this.formatter.timeZone),p=m!=null?this.displayString(m,u.type,u.name):null;this.cachePendingValue(c,d,p);const g=this.pendingRow(d);if(g!=null){n.has(g)||n.set(g,{data:new Map});const w=n.get(g);O(w);const{data:b}=w,S=new Map(b);m!=null?S.set(c,{value:m}):S.delete(c),S.size>0?n.set(g,{...w,data:S}):n.delete(g)}}),this.pendingDataMap=n,this.dispatchEvent(new Re(me.EVENT.UPDATED));const s=e.reduce((l,a)=>{var d,u;const c=(d=a.row)!=null?d:a.y;return l.has(c)||l.set(c,[]),(u=l.get(c))==null||u.push(a),l},new Map),i=Z.consolidate(e.map(l=>{var a,c;return Z.makeCell((a=l.column)!=null?a:l.x,(c=l.row)!=null?c:l.y)})),o=this.getTableAreaRange(),r=i.map(l=>Z.intersection(o,l)).filter(l=>l!=null);if(r.length>0){const a=(await this.snapshot(r.map(d=>(O(d),new Z(null,d.startRow,null,d.endRow))))).map((d,u)=>{let m=null,p=u;for(let C=0;C<r.length;C+=1){const w=r[C];O(w);const b=Z.rowCount([w]);if(p<b){O(w.startRow),m=w.startRow+p;break}p-=b}const g={};for(let C=0;C<this.columns.length;C+=1)g[this.columns[C].name]=d[C];O(m);const f=s.get(m);return f!=null&&f.forEach(C=>{var b;const w=this.columns[(b=C.column)!=null?b:C.x];g[w.name]=A.makeValue(w.type,C.text,this.formatter.timeZone)}),g});Le.info("setValues setting tableRanges",r);const c=await((t=this.inputTable)==null?void 0:t.addRows(a));Le.info("setValues set tableRanges",r,"SUCCESS",c)}e.forEach(l=>{var g,f;const{text:a}=l,c=(g=l.column)!=null?g:l.x,d=(f=l.row)!=null?f:l.y,u=this.columns[c],m=A.makeValue(u.type,a,this.formatter.timeZone),p=m!=null?this.displayString(m,u.type,u.name):null;this.cacheFormattedValue(c,d,p)})}finally{e.forEach(n=>{this.clearPendingValue(n.column,n.row)})}}async commitPending(){var e,t,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((e=this.inputTable)==null?void 0:e.addRows(s));Le.debug("commitPending()",this.pendingNewDataMap,"result",i),this.pendingNewDataMap=new Map,this.pendingNewRowCount=Math.max(0,((n=(t=this.viewport)==null?void 0:t.bottom)!=null?n:0)-this.table.size),this.formattedStringData=[],this.dispatchEvent(new Re(me.EVENT.PENDING_DATA_UPDATED))}finally{this.isSaveInProgress=!1}}editValueForCell(e,t){return this.textValueForCell(e,t)}async delete(e){if(!this.isDeletableRanges(e))throw new Error(`Undeletable ranges ${e}`);O(this.inputTable);const{keyColumns:t}=this.inputTable;if(t.length===0)throw new Error("No key columns to allow deletion");const n=this.getPendingAreaRange(),s=e.map(d=>Z.intersection(n,d)).filter(d=>d!=null).map(d=>(O(d),Z.offset(d,0,-(this.floatingTopRowCount+this.table.size))));if(s.length>0){const d=new Map(this.pendingNewDataMap);for(let u=0;u<s.length;u+=1){const m=s[u];O(m.startRow),O(m.endRow);for(let p=m.startRow;p<=m.endRow;p+=1)d.delete(p)}this.pendingNewDataMap=d,this.formattedStringData=[],this.dispatchEvent(new Re(me.EVENT.PENDING_DATA_UPDATED)),this.dispatchEvent(new Re(me.EVENT.UPDATED))}const i=this.getTableAreaRange(),o=e.map(d=>Z.intersection(i,d)).filter(d=>d!=null);if(o.length<=0)return;const[r,l]=await Promise.all([this.snapshot(o.map(d=>(O(d),new Z(0,d.startRow,t.length-1,d.endRow)))),this.table.copy()]),c=r.map(d=>{const u=[];for(let m=0;m<t.length;m+=1){const p=t[m],g=d[m],f=A.makeFilterRawValue(p.type,g),C=p.filter().eq(f);u.push(C)}return u.reduce((m,p)=>{var g;return(g=m==null?void 0:m.and(p))!=null?g:p})}).reduce((d,u)=>{var m;return(m=d==null?void 0:d.or(u))!=null?m:u});l.applyFilter([c]),l.close()}isValidForCell(e,t,n){try{const s=this.columns[e];return A.makeValue(s.type,n,this.formatter.timeZone),!0}catch{return!1}}};let Vr=tr;Vr.ROW_BUFFER_PAGES=1;const Ln=ne.module("IrisGridTableModel");class Wf extends Vr{constructor(t,n=new en,s=null){super(t,n,s),this.getMemoizedFrontColumns=Ee(i=>i!=null?i:[]),this.getMemoizedBackColumns=Ee(i=>i!=null?i:[]),this.getMemoizedFrozenColumns=Ee((i,o)=>{var r;return(r=o!=null?o:i)!=null?r:[]}),this.getCachedFilterableColumnSet=Ee(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 t;return this.getMemoizedFrontColumns((t=this.layoutHints)==null?void 0:t.frontColumns)}get backColumns(){var t;return this.getMemoizedBackColumns((t=this.layoutHints)==null?void 0:t.backColumns)}get frozenColumns(){var t;return this.getMemoizedFrozenColumns((t=this.layoutHints)==null?void 0:t.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(t){if(Ln.debug2("set customColumns",t,this.customColumnList,t===this.customColumnList),this.customColumnList.length===0&&t.length===0){Ln.debug("Ignore empty initial customColumns"),this.customColumnList=t;return}if(this.customColumnList===t){Ln.debug("Ignore same customColumns");return}this.closeSubscription(),this.customColumnList=t,this.table.applyCustomColumns([...t,...this.formatColumns]),this.applyViewport()}get formatColumns(){return this.formatColumnList}set formatColumns(t){if(Ln.debug2("set formatColumns",t,this.formatColumnList,t===this.formatColumnList),this.formatColumnList.length===0&&t.length===0){Ln.debug("Ignore empty initial formatColumns"),this.formatColumnList=t;return}if(this.formatColumnList===t){Ln.debug("Ignore same formatColumns");return}this.closeSubscription(),this.formatColumnList=t,this.table.applyCustomColumns([...this.customColumns,...t]),this.applyViewport()}updateFrozenColumns(t){this.userFrozenColumns=t,this.dispatchEvent(new Re(me.EVENT.TABLE_CHANGED,{detail:this.table}))}set totalsConfig(t){if(Ln.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 Re(me.EVENT.UPDATED));return}this.totalsTablePromise=Pe.makeCancelable(this.table.getTotalsTable(t),n=>n.close()),this.totalsTablePromise.then(n=>{this.totalsTablePromise=null,this.setTotalsTable(n)}).catch(n=>{Pe.isCanceled(n)||(Ln.error("Unable to set next totalsTable",n),this.totalsTablePromise=null,this.dispatchEvent(new Re(me.EVENT.REQUEST_FAILED,{detail:n})))})}}get isFilterRequired(){return this.table.isUncoalesced}isFilterable(t){return this.getCachedFilterableColumnSet(this.columns).has(t)}async export(){return this.table.freeze()}columnStatistics(t){return this.table.getColumnStatistics(t)}isColumnMovable(t){const n=this.columns[t].name;return this.frontColumns.includes(n)||this.backColumns.includes(n)||this.frozenColumns.includes(n)?!1:!this.isKeyColumn(t)}isColumnFrozen(t){return this.frozenColumns.includes(this.columns[t].name)}async delete(t){var u;if(!this.isDeletableRanges(t))throw new Error(`Undeletable ranges ${t}`);O(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=t.map(m=>Z.intersection(s,m)).filter(m=>m!=null).map(m=>(O(m),Z.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];O(g.startRow),O(g.endRow);for(let f=g.startRow;f<=g.endRow;f+=1)m.delete(f)}super.pendingDataMap=m,this.formattedStringData=[],this.dispatchEvent(new Re(me.EVENT.PENDING_DATA_UPDATED)),this.dispatchEvent(new Re(me.EVENT.UPDATED))}const o=this.getTableAreaRange(),r=t.map(m=>Z.intersection(o,m)).filter(m=>m!=null);if(r.length<=0)return;const[l,a]=await Promise.all([this.snapshot(r.map(m=>(O(m),new Z(0,m.startRow,n.length-1,m.endRow)))),this.table.copy()]),d=l.map(m=>{const p=[];for(let g=0;g<n.length;g+=1){const f=n[g],C=m[g],w=A.makeFilterRawValue(f.type,C),b=f.filter().eq(w);p.push(b)}return p.reduce((g,f)=>{var C;return(C=g==null?void 0:g.and(f))!=null?C:f})}).reduce((m,p)=>{var g;return(g=m==null?void 0:m.or(p))!=null?g:p});a.applyFilter([d]),await((u=this.inputTable)==null?void 0:u.deleteTable(a)),a.close()}}class $f extends Vr{constructor(){super(...arguments),this.getCachedFilterableColumnSet=Ee((t,n)=>new Set(((n==null?void 0:n.length)>0?n:t).map(s=>t.findIndex(i=>s.name===i.name))))}applyBufferedViewport(t,n,s){this.table.setViewport(t,n,s)}textForCell(t,n){const s=this.columns[t],i=this.row(n);if(i!=null&&s!=null&&!i.hasChildren&&s.constituentType!=null){const o=this.valueForCell(t,n);return this.displayString(o,s.constituentType,s.name)}return super.textForCell(t,n)}extractViewportRow(t,n){const{isExpanded:s,hasChildren:i,depth:o}=t;return{...super.extractViewportRow(t,n),isExpanded:s,hasChildren:i,depth:o}}async snapshot(t,n,s){var l,a;O(this.viewport),O(this.viewportData);const{columns:i}=this.viewport,o=[];n!=null&&n&&o.push(i.map(c=>c.name));const r=new Z(0,(l=this.viewportData)==null?void 0:l.offset,i.length,this.viewportData.offset+this.viewportData.rows.length);for(let c=0;c<t.length;c+=1){const d=Z.intersection(r,t[c]);O(d),O(d.startRow),O(d.endRow);for(let u=d.startRow;u<=d.endRow;u+=1){const m=[],p=this.viewportData.rows[u-this.viewportData.offset];O(d.startColumn),O(d.endColumn);for(let g=d.startColumn;g<=d.endColumn;g+=1)O(s),m.push(s((a=p.data.get(g))==null?void 0:a.value,this.columns[g]));o.push(m)}}return o}get groupedColumns(){return[]}get hasExpandableRows(){return!0}get isChartBuilderAvailable(){return!1}get isSelectDistinctAvailable(){return!1}get isReversible(){return!1}isFilterable(t){return this.getCachedFilterableColumnSet(this.columns,this.groupedColumns).has(t)}isColumnMovable(t){return t>=this.groupedColumns.length}isRowExpandable(t){var s;const n=this.row(t);return(s=n==null?void 0:n.hasChildren)!=null?s:!1}isRowExpanded(t){var s;const n=this.row(t);return(s=n==null?void 0:n.isExpanded)!=null?s:!1}setRowExpanded(t,n){this.table.setExpanded(t,n)}depthForRow(t){var s;const n=this.row(t);return((s=n==null?void 0:n.depth)!=null?s:1)-1}}const Pn=ne.module("IrisGridProxyModel");function $o(e,t,n){return A.isTreeTable(e)?new $f(e,t):new Wf(e,t,n)}class qf extends me{constructor(t,n=new en,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)=>We(this.model)?this.model.isRowExpandable(...o):!1,this.isRowExpanded=(...o)=>We(this.model)?this.model.isRowExpanded(...o):!1,this.setRowExpanded=(...o)=>{if(We(this.model))return this.model.setRowExpanded(...o);throw Error("Function setRowExpanded does not exist on IrisGridTableModel")},this.depthForRow=(...o)=>We(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)=>Oe(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)=>(Oe(this.model)&&this.model.editValueForCell(...o),""),this.setValueForCell=(...o)=>Oe(this.model)?this.model.setValueForCell(...o):Promise.reject(new Error("Model is not editable")),this.setValueForRanges=(...o)=>Oe(this.model)?this.model.setValueForRanges(...o):Promise.reject(new Error("Model is not editable")),this.setValues=(...o)=>Oe(this.model)?this.model.setValues(...o):Promise.resolve(),this.isValidForCell=(...o)=>Oe(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=$o(t,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(t){Pn.debug2("handleModelEvent",t);const{detail:n,type:s}=t;this.dispatchEvent(new Re(s,{detail:n}))}setModel(t){Pn.debug("setModel",t);const n=this.model;n!==this.originalModel&&n.close(),this.model=t,this.listenerCount>0&&this.addListeners(t),this.dispatchEvent(new Re(me.EVENT.COLUMNS_CHANGED,{detail:t.columns})),Gi(t)&&this.dispatchEvent(new Re(me.EVENT.TABLE_CHANGED,{detail:t.table}))}setNextModel(t){Pn.debug2("setNextModel"),this.modelPromise&&this.modelPromise.cancel(),this.listenerCount>0&&this.removeListeners(this.model),this.modelPromise=Pe.makeCancelable(t,n=>n.close()),this.modelPromise.then(n=>{this.modelPromise=null,this.setModel(n)}).catch(n=>{if(Pe.isCanceled(n)){Pn.debug2("setNextModel cancelled");return}Pn.error("Unable to set next model",n),this.modelPromise=null,this.dispatchEvent(new Re(me.EVENT.REQUEST_FAILED,{detail:n}))})}startListening(){super.startListening(),this.addListeners(this.model)}stopListening(){super.stopListening(),this.removeListeners(this.model)}addListeners(t){const n=Object.keys(me.EVENT);for(let s=0;s<n.length;s+=1)t.addEventListener(n[s],this.handleModelEvent)}removeListeners(t){const n=Object.keys(me.EVENT);for(let s=0;s<n.length;s+=1)t.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(t){return this.model.isColumnFrozen(t)}get hasExpandableRows(){return We(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 initialMovedColumns(){return this.model.initialMovedColumns}get initialMovedRows(){return this.model.initialMovedRows}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 columnHeaderGroups(){return this.model.columnHeaderGroups}set columnHeaderGroups(t){this.model.columnHeaderGroups=t}get initialColumnHeaderGroups(){return this.model.initialColumnHeaderGroups}get columnHeaderGroupMap(){return this.model.columnHeaderGroupMap}get columnHeaderMaxDepth(){return this.model.columnHeaderMaxDepth}updateFrozenColumns(t){return this.model.updateFrozenColumns(t)}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(t){this.model.filter=t}get formatter(){return this.model.formatter}set formatter(t){this.model.formatter=t}get sort(){return this.model.sort}set sort(t){this.model.sort=t}get customColumns(){return this.model.customColumns}set customColumns(t){this.model.customColumns=t}get formatColumns(){return this.model.formatColumns}set formatColumns(t){this.model.formatColumns=t}get rollupConfig(){return this.rollup}set rollupConfig(t){if(Pn.debug("set rollupConfig",t),!this.isRollupAvailable)throw new Error("Rollup Rows are not available");if(ht(t,this.rollup))return;this.rollup=t;let n=Promise.resolve(this.originalModel);Gi(this.originalModel)&&t!=null&&(n=this.originalModel.table.rollup(t).then(s=>$o(s,this.formatter))),this.setNextModel(n)}get selectDistinctColumns(){return this.selectDistinct}set selectDistinctColumns(t){if(Pn.debug("set selectDistinctColumns",t),!this.isSelectDistinctAvailable)throw new Error("Select distinct is not available");if(t===this.selectDistinctColumns||t.length===0&&this.selectDistinctColumns.length===0){Pn.debug("Ignore same selectDistinctColumns",t);return}this.selectDistinct=t;const n=t.map(i=>this.originalColumns.find(o=>o.name===i)).filter(i=>i!=null);let s=Promise.resolve(this.originalModel);Gi(this.originalModel)&&n.length>0&&(s=this.originalModel.table.selectDistinct(n).then(i=>$o(i,this.formatter))),this.setNextModel(s)}get table(){if(Gi(this.model))return this.model.table}get totalsConfig(){return this.model.totalsConfig}set totalsConfig(t){this.model.totalsConfig=t}get isFilterRequired(){return this.model.isFilterRequired}get isEditable(){return Oe(this.model)&&this.model.isEditable}export(){if(A.isTreeTable(this.model))throw new Error("TreeTable has no 'export' property");return this.model.export()}columnStatistics(t){if(A.isTreeTable(this.model))throw new Error("TreeTable has no 'columnStatistics' function");return this.model.columnStatistics(t)}get pendingDataMap(){return this.model.pendingDataMap}set pendingDataMap(t){this.model.pendingDataMap=t}get pendingRowCount(){return this.model.pendingRowCount}set pendingRowCount(t){this.model.pendingRowCount=t}get pendingDataErrors(){return this.model.pendingDataErrors}getColumnIndexByName(t){return this.model.getColumnIndexByName(t)}}class Kf{static async makeModel(t,n=new en){let s=null;return!A.isTreeTable(t)&&t.hasInputTable&&(s=await t.inputTable()),new qf(t,n,s)}}const mn=ne.module("TableViewportUpdater"),Xf=150,ai=class extends T.exports.PureComponent{constructor(){super(...arguments),this.getViewportRowRange=Ee((e,t,n)=>{const s=n-t,i=Math.max(0,t-s*ai.ROW_BUFFER_PAGES),o=n+s*ai.ROW_BUFFER_PAGES;return[i,o]}),this.getViewportColumns=Ee((e,t,n,s)=>{if(t==null||n==null)return null;const i=n-t,o=Math.max(0,t-i*ai.COLUMN_BUFFER_PAGES),r=Math.min(n+i*ai.COLUMN_BUFFER_PAGES,e.columns.length-1),l=[];for(let a=o;a<=r;a+=1){const c=B.getModelIndex(a,s);l.push(e.columns[c])}return l}),this.updateViewport=Xn((e,t,n,s,i)=>{if(t<e){mn.error("Invalid viewport",e,t);return}if(e===0&&t===0){mn.debug2("Ignoring 0-0 viewport");return}const{movedColumns:o,table:r}=this.props,[l,a]=this.getViewportRowRange(r,e,t),c=i!=null?i:this.getViewportColumns(r,n,s,o);if(mn.debug2("Setting Viewport Top:",l,"Bottom:",a,"Columns:",c),this.subscription==null){mn.debug2("updateViewport creating new subscription"),this.subscription=r.setViewport(l,a,c);const{onSubscription:d}=this.props;d(this.subscription)}else mn.debug2("updateViewport using existing subscription"),this.subscription.setViewport(l,a,c)},Xf)}componentDidMount(){const{top:e,bottom:t,left:n,right:s,table:i,filters:o,sorts:r,columns:l,customColumns:a}=this.props;i.applyFilter(o),i.applySort(r),i.applyCustomColumns(a),this.updateViewport(e,t,n,s,l)}componentDidUpdate(e){const{top:t,bottom:n,left:s,right:i,table:o,filters:r,sorts:l,customColumns:a,columns:c}=this.props,d=r!==e.filters,u=l!==e.sorts,m=a!==e.customColumns,p=o!==e.table;(d||u||m||p)&&this.closeSubscription(),(d||p)&&(mn.debug("update table filter",r),o.applyFilter(r)),(u||p)&&(mn.debug("update table sort",l),o.applySort(l)),(m||p)&&(mn.debug("update table custom columns",a),o.applyCustomColumns(a)),this.updateViewport(t,n,s,i,c)}componentWillUnmount(){this.closeSubscription()}closeSubscription(){if(mn.debug2("closeSubscription",this.subscription),this.subscription){this.subscription.close(),this.subscription=void 0;const{onSubscription:e}=this.props;e()}this.updateViewport.cancel()}render(){return null}};let Ur=ai;Ur.ROW_BUFFER_PAGES=3;Ur.COLUMN_BUFFER_PAGES=1;Ur.defaultProps={top:0,bottom:0,left:null,right:null,columns:null,onSubscription:()=>{},filters:[],sorts:[],customColumns:[],movedColumns:[]};const Is=ne.module("TreeTableViewportUpdater"),Yf=150,Ec=class extends T.exports.PureComponent{constructor(e){super(e),this.updateViewport=Xn((t,n)=>{if(n<t){Is.error("Invalid viewport",t,n);return}if(t===0&&n===0){Is.debug2("Ignoring 0-0 viewport");return}const{table:s,updateInterval:i}=this.props,o=n-t,r=Math.max(0,t-o*3),l=n+o*3+1;if(Is.debug2("Setting Viewport Top:",r,"Bottom:",l,s),!this.listenerCleanup){const{onViewportUpdate:a}=this.props;this.listenerCleanup=s.addEventListener(I.TreeTable.EVENT_UPDATED,a)}s.setViewport(r,l,void 0,i)},Yf),this.listenerCleanup=null}componentDidMount(){const{top:e,bottom:t,table:n,filters:s,sorts:i}=this.props;Is.debug("componentDidMount",this.props),n.applyFilter(s),n.applySort(i),this.updateViewport(e,t)}componentDidUpdate(e){const{top:t,bottom:n,table:s,filters:i,sorts:o}=this.props;i!==e.filters&&(Is.debug("update table filter",i),s.applyFilter(i)),o!==e.sorts&&(Is.debug("update table sort",o),s.applySort(o)),this.updateViewport(t,n)}componentWillUnmount(){this.updateViewport.cancel(),this.listenerCleanup&&this.listenerCleanup()}render(){return null}};let yc=Ec;yc.UPDATE_INTERVAL=1e3;yc.defaultProps={top:0,bottom:0,onViewportUpdate:()=>{},filters:[],sorts:[],updateInterval:Ec.UPDATE_INTERVAL};ne.setLogLevel(parseInt("2",10));const xs=ne.module("EmbedGrid.App"),Qf=[I.VariableType.TABLE,I.VariableType.TREETABLE,I.VariableType.PANDAS];async function jf(e,t){xs.info(`Fetching table ${t}...`);const n=await Vh(e,t);if(!Qf.includes(n.type))throw new Error(`Unsupported type '${n.type}' for variable named '${t}'`);return await e.getObject(n)}function Zf(){const[e,t]=T.exports.useState(),[n,s]=T.exports.useState(),[i,o]=T.exports.useState(),[r,l]=T.exports.useState(),[a,c]=T.exports.useState(!0),d=T.exports.useMemo(()=>new URLSearchParams(window.location.search),[]),u=d.get("canCopy")!=null,m=d.get("canDownloadCsv")!=null;T.exports.useEffect(function(){async function f(){try{const C=d.get("name");if(C==null)throw new Error("No name param provided");const w=new URL("/jsapi",`${window.location}`),b=`${w.protocol}//${w.host}`;xs.debug("Starting connection...");const S=new I.IdeConnection(b);xs.debug("Loading table",C,"...");const E=await jf(S,C);xs.debug("Creating model...");const v=await Kf.makeModel(E);t(v),xs.debug("Table successfully loaded!")}catch(C){xs.error("Unable to load table",C),s(`${C}`)}c(!1)}f()},[d]),T.exports.useEffect(function(){function f(C){const{command:w,value:b}=C.data;switch(w){case"filter":{const E=b.map(({name:v,value:y})=>{const M=e==null?void 0:e.columns.find(F=>F.name===v);if(M==null)throw new Error(`Could not find column named ${v}`);return{name:v,value:y,type:A.getNormalizedType(M.type)}});o(E);break}case"sort":{const E=b.map(({name:v,direction:y})=>{const M=e==null?void 0:e.columns.find(F=>F.name===v);if(M==null)throw new Error(`Could not find column named ${v}`);return y==="DESC"?M.sort().desc():M.sort().asc()});l(E);break}}}return window.addEventListener("message",f),()=>{window.removeEventListener("message",f)}},[e]);const p=e!=null;return R("div",{className:"App",children:[p&&h(fi,{canCopy:u,canDownloadCsv:m,model:e,inputFilters:i,sorts:r}),!p&&h(Ta,{isLoaded:p,isLoading:a,errorMessage:n!=null?n:null}),h(Lu,{})]})}nr.render(h(Zf,{}),document.getElementById("root"));
|
|
33
|
+
//# sourceMappingURL=index.f14a859d.js.map
|