@deephaven/embed-chart 0.57.2-beta.0 → 0.57.2-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
- import{r as N,G as _,aP as At,C as E,D as Ct,E as Z,R as It,V as F,F as ke,aQ as xt,L as Lt,aR as Rt,a3 as ze,aS as bt,ab as ge,ai as kt,K as _t,U as ye}from"./vendor-93adb660.js";import{L as G,T as jt,k as $t,u as Vt,aP as Ht,aQ as Wt,E as Bt,H as qt,D as Kt,B as zt,I as Gt,y as Yt,P as Xt,U as Zt,n as Ee,ae as Ge,aR as Qt,aS as Ut,r as Jt,F as er,Y as tr}from"./index-026d4349.js";import{c as Ie,P as wt,b as rr,h as nr,p as ir,o as ar,s as sr,t as or}from"./plotly-3860fdef.js";var Ai=Object.freeze([]),Ci=new Map,Ii=()=>{};function xe(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return e.filter(r=>r!=null)}function lr(n,e,t){return e=ur(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ur(n){var e=cr(n,"string");return typeof e=="symbol"?e:String(e)}function cr(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class dr extends Error{constructor(){super(...arguments),lr(this,"isCanceled",!0)}}const Ye=dr;function hr(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,t=fr(n,e);t.forEach(r=>{n[r]=n[r].bind(n)})}function fr(n,e){for(var t=new Set,r=n,i=0;r!=null&&r!==Object.prototype&&(i<=1||e);){for(var a of Object.getOwnPropertyNames(r))a!=="constructor"&&typeof r[a]=="function"&&t.add(a);r=Object.getPrototypeOf(r),i+=1}return[...t.keys()]}function Xe(n,e,t,r,i,a,o){try{var s=n[a](o),l=s.value}catch(u){t(u);return}s.done?e(l):Promise.resolve(l).then(r,i)}function mr(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){Xe(a,r,i,o,s,"next",l)}function s(l){Xe(a,r,i,o,s,"throw",l)}o(void 0)})}}function pr(n){return _e.apply(this,arguments)}function _e(){return _e=mr(function*(n){var{clipboard:e}=navigator;if(e!==void 0)try{return navigator.clipboard.writeText(n)}catch{return Ze(n)}Ze(n)}),_e.apply(this,arguments)}function Ze(n){var e=document.activeElement,t=document.createElement("textarea");t.value=n,document.body.appendChild(t),t.focus(),t.select();var r=document.execCommand("copy");if(document.body.removeChild(t),e instanceof HTMLElement&&e.focus(),!r)throw new Error("Unable to execute copy command")}function vr(n,e,t){return e=gr(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function gr(n){var e=yr(n,"string");return typeof e=="symbol"?e:String(e)}function yr(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Er extends Error{constructor(){super(...arguments),vr(this,"isTimeout",!0)}}const Pt=Er;class je{static makeCancelable(e,t){var r=!1,i,a,o=new Promise((s,l)=>{a=l,Promise.resolve(e).then(u=>{r?t&&t(u):(i=u,s(u))}).catch(u=>l(u))});return o.cancel=()=>{r=!0,a(new Ye),i!=null&&t&&t(i)},o}static isCanceled(e){return e instanceof Ye}static isTimedOut(e){return e instanceof Pt}static withTimeout(e,t){return new Promise((r,i)=>{setTimeout(()=>{try{r(t())}catch(a){i(a)}},e)})}}class Sr{static join(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"and";if(e==null||e.length===0)return"";if(e.length===1)return e[0];if(e.length===2)return"".concat(e[0]," ").concat(t," ").concat(e[1]);var r=e.slice(0,e.length-1).join(", "),i=e[e.length-1];return"".concat(r,", ").concat(t," ").concat(i)}static toLower(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e==null){if(t)return"";throw new Error("Null string passed in to TextUtils.toLower")}return e.toLowerCase()}static sort(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return e<t?r?-1:1:e>t?r?1:-1:0}}const Tr=Sr;function Oe(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"No value available in context. Was code wrapped in a provider?",t=N.useContext(n);if(t==null)throw new Error(e);return t}var br=3500,wr=G.module("useCopyToClipboard");function Pr(){var[n,e]=N.useState(!1),t=N.useRef(null),r=N.useCallback(i=>{pr(i).then(()=>{e(!0)}).catch(a=>wr.error("Unable to copy ".concat(i),`
2
- `,a))},[]);return N.useEffect(()=>(t.current&&clearTimeout(t.current),n&&(t.current=setTimeout(()=>{e(!1)},br)),()=>{t.current&&clearTimeout(t.current)}),[n]),[n,r]}function Qe(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Fr(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Qe(Object(t),!0).forEach(function(r){pe(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Qe(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function pe(n,e,t){return e=Mr(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Mr(n){var e=Dr(n,"string");return typeof e=="symbol"?e:String(e)}function Dr(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class $e extends N.Component{constructor(e){super(e),pe(this,"element",void 0),pe(this,"container",void 0),pe(this,"rAF",void 0),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=_.createRef(),this.rAF=0;var{isShown:t}=this.props;this.state={show:t,popper:null}}componentDidUpdate(e){var{isShown:t}=this.props;e.isShown!==t&&(t?(cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{this.show()})):this.hide())}componentWillUnmount(){this.destroyPopper(!1)}getVisibleElement(e){return e==null||e.clientHeight>0||e.clientWidth>0?e:this.getVisibleElement(e.parentElement)}initPopper(){var{popper:e}=this.state,{closeOnBlur:t,referenceObject:r}=this.props;if(!e&&this.container.current!==null){var{options:i}=this.props;i=Fr({placement:"auto",modifiers:{preventOverflow:{boundariesElement:"viewport"}}},i),document.body.appendChild(this.element);var a=this.getVisibleElement(this.container.current);a==null&&(a=this.container.current),e=new At(r||a,this.element,i),e.scheduleUpdate(),cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{if(t&&!this.element.contains(document.activeElement)){var o=this.element.firstElementChild;o instanceof HTMLElement&&o.focus()}}),this.setState({popper:e})}}destroyPopper(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;cancelAnimationFrame(this.rAF);var{popper:t}=this.state;t&&(t.destroy(),document.body.contains(this.element)&&document.body.removeChild(this.element),e&&this.setState({popper:null}))}show(){this.initPopper(),this.setState({show:!0})}hide(){this.setState({show:!1})}scheduleUpdate(){var{popper:e}=this.state;e&&e.scheduleUpdate()}handleBlur(e){e.relatedTarget instanceof HTMLElement&&(this.element.contains(e.relatedTarget)||this.hide())}handleEnter(){var{onEntered:e}=this.props;e()}handleExit(){var{onExited:e}=this.props,{show:t}=this.state;t||this.destroyPopper(),e()}renderContent(){var{className:e,children:t,timeout:r,interactive:i,closeOnBlur:a}=this.props,{show:o}=this.state;return E.jsx(Ct,{in:o,timeout:r,classNames:"popper-transition",onEntered:this.handleEnter,onExited:this.handleExit,children:E.jsx("div",{onClick:s=>{s.stopPropagation()},onKeyDown:s=>{s.key==="Escape"&&this.hide()},className:Z("popper",{interactive:i},e),onBlur:a?this.handleBlur:void 0,tabIndex:a?-1:void 0,role:"presentation",children:E.jsxs("div",{className:"popper-content",children:[t,E.jsx("div",{className:"popper-arrow","x-arrow":""})]})})})}render(){var{popper:e}=this.state,{"data-testid":t}=this.props;return E.jsx("div",{className:"popper-parent-container",ref:this.container,style:{display:"none"},"data-testid":t,children:e&&It.createPortal(this.renderContent(),this.element)})}}pe($e,"propTypes",{children:F.node.isRequired,options:F.shape({}),className:F.string,timeout:F.number,onEntered:F.func,onExited:F.func,isShown:F.bool,closeOnBlur:F.bool,interactive:F.bool,referenceObject:F.shape({}),"data-testid":F.string});pe($e,"defaultProps",{options:{},className:"",timeout:jt.transitionMs,onEntered(){},onExited(){},isShown:!1,interactive:!1,closeOnBlur:!1,referenceObject:null,"data-testid":void 0});const Ft=$e;function Ue(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Or(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ue(Object(t),!0).forEach(function(r){X(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ue(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function X(n,e,t){return e=Nr(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Nr(n){var e=Ar(n,"string");return typeof e=="symbol"?e:String(e)}function Ar(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Cr=G.module("Tooltip");class I extends N.Component{static handleHidden(){I.shownTooltipCount-=1,I.shownTooltipCount===0&&(I.lastHiddenTime=Date.now())}static handleShown(){I.shownTooltipCount+=1}constructor(e){super(e),X(this,"container",void 0),X(this,"popper",void 0),X(this,"parent",void 0),X(this,"timer",void 0),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=_.createRef(),this.popper=_.createRef(),this.parent=null,this.timer=null,this.state={isShown:!1}}componentDidMount(){this.startListening();var{timeout:e}=this.props;e===0&&this.show()}componentDidUpdate(e,t){var{isShown:r}=t,{isShown:i}=this.state;i!==r&&(i?I.handleShown():I.handleHidden())}componentWillUnmount(){this.stopListening(),this.stopListeningWindow(),this.stopTimer();var{isShown:e}=this.state;e&&I.handleHidden()}startListening(){if(!this.container.current||!this.container.current.parentElement){Cr.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(){var{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(){var{isShown:e}=this.state;this.stopTimer();var{interactive:t}=this.props;!t&&e&&this.hide()}handleTimeout(){this.show()}handleWindowMouseMove(e){var t=e.clientX,r=e.clientY,{isShown:i}=this.state;if(!(!this.popper.current||!this.parent)){var a=this.popper.current.element.getBoundingClientRect(),o=this.parent.getBoundingClientRect();t>=a.left&&t<=a.left+a.width&&r>=a.top&&r<=a.top+a.height?this.handleMouseMove():t>=o.left&&t<=o.left+o.width&&r>=o.top&&r<=o.top+o.height?this.handleMouseMove():i&&(this.stopTimer(),this.hide())}}startTimer(){this.stopTimer();var{timeout:e,reshowTimeout:t}=this.props,r=e;(I.shownTooltipCount>0||Date.now()-I.lastHiddenTime<I.triggerReshowThreshold)&&(r=t),this.timer=window.setTimeout(this.handleTimeout,r)}stopTimer(){this.timer!=null&&(clearTimeout(this.timer),this.timer=null)}show(){var{isShown:e}=this.state;if(this.stopTimer(),!e){var t;(t=this.popper.current)===null||t===void 0||t.show(),this.setState({isShown:!0});var{interactive:r}=this.props;r&&this.startListeningWindow()}}hide(){var e;(e=this.popper.current)===null||e===void 0||e.hide(),this.stopListeningWindow()}update(){var e;(e=this.popper.current)===null||e===void 0||e.scheduleUpdate()}handleExited(){this.setState({isShown:!1});var{onExited:e}=this.props;e()}stopShowingTooltip(){var{isShown:e}=this.state;this.stopTimer(),e&&this.hide()}render(){var{interactive:e,children:t,referenceObject:r,popperClassName:i,"data-testid":a,onEntered:o}=this.props,{isShown:s}=this.state,{options:l}=this.props;return l=Or({placement:"bottom"},l),E.jsx("div",{ref:this.container,style:{display:"none"},"data-testid":a,children:E.jsx(Ft,{className:Z(i),options:l,ref:this.popper,onEntered:o,onExited:this.handleExited,interactive:e,referenceObject:r,children:E.jsxs("div",{className:"tooltip-content",children:[" ",s&&t]})})})}}X(I,"defaultTimeout",500);X(I,"defaultReshowTimeout",100);X(I,"triggerReshowThreshold",300);X(I,"shownTooltipCount",0);X(I,"lastHiddenTime",Date.now());X(I,"defaultProps",{interactive:!1,options:{},popperClassName:"",reshowTimeout:I.defaultReshowTimeout,timeout:I.defaultTimeout,onEntered:()=>{},onExited:()=>{},"data-testid":void 0});const Ir=I;var xr=["kind","variant","type","tooltip","icon","disabled","active","onClick","onContextMenu","onMouseDown","onMouseUp","onMouseEnter","onMouseLeave","onKeyDown","className","style","children","tabIndex","data-testid","aria-label"];function Je(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function et(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Je(Object(t),!0).forEach(function(r){Lr(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Je(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Lr(n,e,t){return e=Rr(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Rr(n){var e=kr(n,"string");return typeof e=="symbol"?e:String(e)}function kr(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function _r(n,e){if(n==null)return{};var t=jr(n,e),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(n);for(i=0;i<a.length;i++)r=a[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function jr(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,a;for(a=0;a<r.length;a++)i=r[a],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var $r=["primary","secondary","tertiary","success","danger","inline","ghost"],Vr=["group-end"];function Hr(n,e){switch(n){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 Z("btn-link",{"btn-link-icon":e,"btn-link-icon-only":e})}}function Wr(n){switch(n){case"group-end":return Z("pl-2","pr-3")}}var Ne=_.forwardRef((n,e)=>{var{kind:t,variant:r,type:i,tooltip:a,icon:o,disabled:s=!1,active:l,onClick:u,onContextMenu:c,onMouseDown:d,onMouseUp:h,onMouseEnter:g,onMouseLeave:p,onKeyDown:y,className:S,style:T,children:w,tabIndex:b,"data-testid":P,"aria-label":M}=n,D=_r(n,xr),C=!!(o&&w==null),R=Hr(t,C),j;r&&(j=Wr(r));var K;if(o&&(K=_.isValidElement(o)?o:E.jsx(ke,{icon:o})),K!=null&&w!=null){var Y=!1;_.Children.forEach(w,ie=>{typeof ie=="string"?Y=!0:_.isValidElement(ie)&&_.Children.forEach(ie.props.children,de=>{typeof de=="string"&&(Y=!0)})}),Y&&(K=_.cloneElement(K,{className:Z("mr-1",K.props.className)}))}var z;a!==void 0&&(z=typeof a=="string"?E.jsx(Ir,{children:a}):a);var re=M;M===void 0&&C&&a!=null&&typeof a=="string"&&(re=a);var Q=E.jsxs("button",et(et({"data-testid":P,ref:e,type:i,className:Z("btn",R,j,{active:l},S),onClick:u,onContextMenu:c,onMouseUp:h,onMouseDown:d,onMouseEnter:g,onMouseLeave:p,onKeyDown:y,style:T,disabled:s,tabIndex:b,"aria-label":re},D),{},{children:[o&&K,w,a!=null&&!s&&z]}));return s&&a!=null?E.jsxs("span",{className:"btn-disabled-wrapper",children:[Q,z]}):Q});Ne.displayName="Button";Ne.propTypes={kind:F.oneOf($r).isRequired,variant:F.oneOf(Vr),type:F.oneOf(["submit","reset","button"]),tooltip(n){var{tooltip:e,icon:t,children:r}=n;return e===void 0&&t!=null&&r==null?new Error("Tooltip is required for icon only buttons"):null},icon(n){var{children:e,icon:t}=n;return t==null&&e==null?new Error("Icon is required if no children are provided"):e==null&&!_.isValidElement(t)&&(t==null||t.iconName===""||t.iconName==null)?new Error("Icon must be react element or fontawesome IconDefinition"):null},disabled:F.bool,active:F.bool,onClick(n){var{onClick:e,type:t}=n;return t==="button"&&typeof e!="function"?new Error("type button requires an onClick function"):e!==void 0&&typeof e!="function"?new Error("onClick must be a function"):null},onContextMenu:F.func,onMouseUp:F.func,onMouseDown:F.func,onMouseEnter:F.func,onMouseLeave:F.func,onKeyDown:F.func,tabIndex:F.number,children:F.node,className:F.string,style:F.object,"data-testid":F.string};Ne.defaultProps={type:"button",onClick:void 0,onContextMenu:void 0,onMouseUp:void 0,onMouseDown:void 0,onMouseEnter:void 0,onMouseLeave:void 0,onKeyDown:void 0,variant:void 0,tooltip:void 0,icon:void 0,disabled:!1,active:void 0,tabIndex:void 0,children:void 0,className:void 0,style:{},"data-testid":void 0};const Br=Ne;function qr(n,e,t){return e=Kr(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Kr(n){var e=zr(n,"string");return typeof e=="symbol"?e:String(e)}function zr(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function xi(n){return n.then!==void 0}class ue{static disableAllActions(){ue.actionsDisabled=!0}static enableAllActions(){ue.actionsDisabled=!1}static isContextActionEvent(e){return Array.isArray(e.contextActions)}static compareActions(e,t){if(e.group!==t.group){var r,i;return((r=e.group)!==null&&r!==void 0?r:0)>((i=t.group)!==null&&i!==void 0?i:0)?1:-1}if(e.order!==t.order){var a,o;return((a=e.order)!==null&&a!==void 0?a:0)>((o=t.order)!==null&&o!==void 0?o:0)?1:-1}if(e.title!==t.title){var s,l;return((s=e.title)!==null&&s!==void 0?s:"")>((l=t.title)!==null&&l!==void 0?l:"")?1:-1}return e!==t?e>t?1:-1:0}static sortActions(e){if(e==null||!Array.isArray(e))return[];var t=e.slice();return t.sort(ue.compareActions),t}static isMacPlatform(){var{platform:e}=window.navigator;return e.startsWith("Mac")}static getModifierKey(){return ue.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(e){var t=ue.getModifierKey();return e[t]}static getMenuItems(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=[],i=e;Array.isArray(i)||(i=[i]);for(var a=0;a<i.length;a+=1){var o=i[a],s=void 0;typeof o=="function"?s=o():s=o,s!=null&&(s instanceof Promise?t&&r.push(s):Array.isArray(s)?r=r.concat(s):r.push(s))}return r=r.filter(l=>l.title!==void 0||l.then!=null||l.menuElement),r}static getNextMenuItem(e,t,r){var i=e;i<0&&t<0&&(i=r.length);for(var a=1;a<r.length+1;a+=1){var o=(i+t*a+r.length)%r.length,s=r[o];if(!(s instanceof Promise)&&s.disabled!==!0)return o}return e}}qr(ue,"actionsDisabled",!1);const he=ue;var Ve=_.forwardRef((n,e)=>{var t;function r(D){var{menuItem:C,onMenuItemClick:R}=n;R(C,D)}function i(D){var{menuItem:C,onMenuItemMouseMove:R}=n;R(C,D)}function a(D){var{menuItem:C,onMenuItemContextMenu:R}=n;R(C,D)}function o(D,C,R){if(typeof D.type=="string")return D;var{closeMenu:j,menuItem:K,isKeyboardSelected:Y,isMouseSelected:z,"data-testid":re}=n,Q={menuItem:K,closeMenu:j,isKeyboardSelected:Y,isMouseSelected:z,iconElement:C,displayShortcut:R,"data-testid":re};return _.cloneElement(D,{forwardedProps:Q})}var{children:s,menuItem:l,isKeyboardSelected:u=!1,isMouseSelected:c=!1,"data-testid":d}=n,h=(t=l.shortcut)===null||t===void 0?void 0:t.getDisplayText(),g=null;if(l.icon){var p=l.icon;if(_.isValidElement(p))g=p;else{var y;l.iconColor!=null&&(l.disabled===void 0||!l.disabled)&&(y={color:l.iconColor}),g=E.jsx(ke,{icon:p,style:y})}}var S=null,T=!!s;l.actions&&(S=E.jsx(ke,{icon:$t}));var w=null;if(l.menuElement)w=E.jsx("div",{className:"custom-menu-item",onMouseMove:i,children:o(l.menuElement,g,h)});else{var b,P=l.disabled,M=l.iconOutline;w=E.jsx("button",{type:"button",className:Z("btn-context-menu",{disabled:P},{active:(T||c)&&(P===void 0||!P)},{"keyboard-active":u&&(P===void 0||!P)}),onClick:r,onMouseMove:i,onContextMenu:a,title:(b=l.description)!==null&&b!==void 0?b:"",children:E.jsxs("div",{className:"btn-context-menu-wrapper",children:[E.jsx("span",{className:Z("icon",{outline:M}),children:g}),E.jsx("span",{className:"title",children:l.title}),h!==void 0&&E.jsx("span",{className:"shortcut",children:h}),S&&E.jsx("span",{className:Z("submenu-indicator",{disabled:P}),children:S})]})})}return E.jsxs("div",{className:"context-menu-item",ref:e,"data-testid":d,children:[s,w]})});Ve.displayName="ContextMenuItem";Ve.defaultProps={children:null,isKeyboardSelected:!1,isMouseSelected:!1,"data-testid":void 0};const Gr=Ve;function tt(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Yr(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?tt(Object(t),!0).forEach(function(r){oe(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):tt(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function oe(n,e,t){return e=Xr(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Xr(n){var e=Zr(n,"string");return typeof e=="symbol"?e:String(e)}function Zr(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var rt=G.module("ContextMenu");class Te extends N.PureComponent{static handleContextMenu(e){e.metaKey||(e.stopPropagation(),e.preventDefault())}constructor(e){super(e),oe(this,"container",void 0),oe(this,"oldFocus",void 0),oe(this,"activeSubMenuRef",void 0),oe(this,"subMenuTimer",void 0),oe(this,"rAF",void 0),oe(this,"initialPosition",void 0),this.handleBlur=this.handleBlur.bind(this),this.handleCloseSubMenu=this.handleCloseSubMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMenuItemClick=this.handleMenuItemClick.bind(this),this.handleMenuItemContextMenu=this.handleMenuItemContextMenu.bind(this),this.handleMenuItemMouseMove=this.handleMenuItemMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleWindowResize=this.handleWindowResize.bind(this),this.container=_.createRef(),this.oldFocus=document.activeElement,this.activeSubMenuRef=_.createRef(),this.subMenuTimer=0,this.rAF=0,this.initialPosition={top:e.top,left:e.left},this.state={menuItems:[],pendingItems:[],activeSubMenu:null,hasOverflow:!1,subMenuTop:null,subMenuLeft:null,subMenuParentWidth:0,subMenuParentHeight:0,keyboardIndex:-1,mouseIndex:-1}}componentDidMount(){this.initMenu(),this.verifyPosition(),window.addEventListener("resize",this.handleWindowResize),this.rAF=window.requestAnimationFrame(()=>{var e;(e=this.container.current)===null||e===void 0||e.focus();var{onMenuOpened:t}=this.props;t(this)})}componentDidUpdate(e,t){var{actions:r}=this.props,{activeSubMenu:i}=this.state;if(i!==t.activeSubMenu)if(i==null){var a;(a=this.container.current)===null||a===void 0||a.focus()}else this.setActiveSubMenuPosition();if(e.actions!==r&&(this.initMenu(),this.container.current==null||!this.container.current.contains(document.activeElement))){var o;(o=this.container.current)===null||o===void 0||o.focus()}this.verifyPosition()}componentWillUnmount(){this.cancelPromises(),window.removeEventListener("resize",this.handleWindowResize),cancelAnimationFrame(this.rAF)}getKeyboardIndex(){var{options:e}=this.props;if(e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse){var{keyboardIndex:t}=this.state;return t}return this.getMouseIndex()}setKeyboardIndex(e){var{options:t}=this.props;t.separateKeyboardMouse!==void 0&&t.separateKeyboardMouse?this.setState({keyboardIndex:e}):this.setMouseIndex(e)}getMouseIndex(){var{mouseIndex:e}=this.state;return e}setMouseIndex(e){this.setState({mouseIndex:e})}initMenu(){this.cancelPromises(),cancelAnimationFrame(this.rAF);var{options:e}=this.props,t=e.initialKeyboardIndex;t===void 0&&(t=-1);for(var{actions:r}=this.props,i=he.getMenuItems(r),a=[],o=i.length-1;o>=0;o-=1){var s=i[o];s instanceof Promise?this.initMenuPromise(s):a.push(s)}this.setState({mouseIndex:-1,keyboardIndex:t,activeSubMenu:null,menuItems:he.sortActions(a)})}initMenuPromise(e){var t=je.makeCancelable(e);this.setState(r=>({pendingItems:r.pendingItems.concat(t)})),t.then(r=>{this.setState(i=>{var a=i.pendingItems.indexOf(t);if(a>=0){var o=i.pendingItems.slice();return o.splice(a,1),{menuItems:he.sortActions(i.menuItems.concat(r)),pendingItems:o}}return null})},r=>{je.isCanceled(r)||(this.setState(i=>{var a=i.pendingItems.indexOf(t);if(a>=0){var o=i.pendingItems.slice();return o.splice(a,1),{pendingItems:o}}return null}),rt.error(r))})}cancelPromises(){var{pendingItems:e}=this.state;e.map(t=>t.cancel())}setActiveSubMenuPosition(){if(this.activeSubMenuRef.current!==null){var e=this.activeSubMenuRef.current.getBoundingClientRect();this.setState({subMenuTop:e.top,subMenuLeft:e.right,subMenuParentHeight:e.height,subMenuParentWidth:e.width})}}verifyPosition(){var e,t,r,i,{options:a,updatePosition:o,subMenuParentWidth:s,subMenuParentHeight:l,top:u,left:c}=this.props;if(!(!this.container.current||a.doNotVerifyPosition!=null&&a.doNotVerifyPosition)){var{top:d,left:h}=this.initialPosition,{width:g,height:p}=(e=(t=this.container.current)===null||t===void 0?void 0:t.getBoundingClientRect())!==null&&e!==void 0?e:{width:0,height:0},y=((r=(i=this.container.current)===null||i===void 0?void 0:i.scrollHeight)!==null&&r!==void 0?r:0)>window.innerHeight;p===0||g===0||(d+p>window.innerHeight&&(d-p-l>0?d-=p-l:d=window.innerHeight-p),h+g>window.innerWidth&&(h=h-g-s),(c!==h||u!==d)&&(this.setState({hasOverflow:y}),o(d,h)))}}handleWindowResize(){this.container.current&&this.closeMenu(!0)}handleBlur(e){if(!this.container.current){rt.warn("Container is null!");return}if(!this.container.current.contains(e.relatedTarget)){for(var t=e.relatedTarget,r=!1;t&&!r;)r=t.hasAttribute("data-dh-context-menu"),t=t.parentElement;r||this.closeMenu(!0)}}isEscapeKey(e){var{left:t}=this.props;return e==="Escape"||t<0&&e==="ArrowRight"||e==="ArrowLeft"}handleKeyDown(e){var{menuItems:t}=this.state,r=this.getKeyboardIndex(),i=r,a=!1;if(e.key==="Enter"||e.key===" "){r>=0&&r<t.length&&this.handleMenuItemClick(t[r],e);return}if(e.key==="ArrowRight"?r>=0&&r<=t.length?a=!0:i=0:this.isEscapeKey(e.key)?i=null:e.key==="ArrowUp"||e.shiftKey&&e.key==="Tab"?i=he.getNextMenuItem(i,-1,t):(e.key==="ArrowDown"||e.key==="Tab")&&(i=he.getNextMenuItem(i,1,t)),a){this.openSubMenu(r),e.preventDefault(),e.stopPropagation();return}r!==i&&(i!==null?this.setKeyboardIndex(i):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}openSubMenu(e){var{menuItems:t,activeSubMenu:r}=this.state,i=t[e].actions?e:null;r!==i&&this.setState({activeSubMenu:i,subMenuTop:null,subMenuLeft:null})}closeMenu(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,{closeMenu:t,onMenuClosed:r}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t(e),r(this)})}closeSubMenu(){this.setState({activeSubMenu:null})}handleCloseSubMenu(e){e?this.closeMenu(!0):this.closeSubMenu()}handleMenuItemClick(e,t){t.preventDefault(),t.stopPropagation();var{menuItems:r}=this.state;e!=null&&(e.disabled===void 0||!e.disabled)&&(e.actions!=null?this.openSubMenu(r.indexOf(e)):e.action!=null&&(e.action(t.nativeEvent),this.closeMenu(!0)))}handleMenuItemContextMenu(e,t){t.metaKey||this.handleMenuItemClick(e,t)}handleMenuItemMouseMove(e){var{menuItems:t}=this.state,r=t.indexOf(e);this.setMouseIndex(r),r>=0&&r<t.length&&(e.disabled===void 0||!e.disabled)&&this.openSubMenu(r)}handleMouseLeave(){this.setMouseIndex(-1)}render(){for(var e=[],{top:t,left:r}=this.props,{activeSubMenu:i,hasOverflow:a,keyboardIndex:o,menuItems:s,mouseIndex:l,pendingItems:u,subMenuTop:c,subMenuLeft:d,subMenuParentWidth:h,subMenuParentHeight:g}=this.state,p=0;p<s.length;p+=1){var y=s[p];p>0&&y.group!==s[p-1].group&&e.push(E.jsx("hr",{},"".concat(p,".separator")));var S=E.jsx(Gr,{ref:i===p?this.activeSubMenuRef:null,isKeyboardSelected:o===p,isMouseSelected:l===p,menuItem:y,closeMenu:this.handleCloseSubMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:this.handleMenuItemContextMenu},p);e.push(S)}var T=null;u.length>0&&(T=E.jsx("div",{className:"loading",children:E.jsx(Vt,{className:"loading-spinner-vertical-align"})}));var{menuStyle:w,"data-testid":b}=this.props,P=i!==null&&c!==null&&d!==null;return E.jsxs(E.Fragment,{children:[E.jsxs("div",{className:Z({"has-overflow":a},"context-menu-container"),style:Yr({top:t,left:r},w),ref:this.container,"data-dh-context-menu":!0,onBlur:this.handleBlur,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,onContextMenu:Te.handleContextMenu,role:"menuitem",tabIndex:0,"data-testid":b,children:[e,T]}),P&&i!==null&&c!==null&&d!==null&&E.jsx(Te,{actions:s[i].actions||[],closeMenu:this.handleCloseSubMenu,top:c,left:d,updatePosition:(M,D)=>{this.setState({subMenuTop:M,subMenuLeft:D})},subMenuParentWidth:h,subMenuParentHeight:g},"sub-".concat(i))]})}}oe(Te,"defaultProps",{subMenuParentWidth:0,subMenuParentHeight:0,closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0});const Qr=Te;function nt(n,e,t){return e=Ur(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ur(n){var e=Jr(n,"string");return typeof e=="symbol"?e:String(e)}function Jr(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class en extends N.Component{constructor(e){super(e),nt(this,"container",void 0),nt(this,"openMenu",void 0),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.container=_.createRef(),this.openMenu=_.createRef(),this.state={actions:null,left:0,top:0}}componentDidMount(){var e;(e=this.container.current)!==null&&e!==void 0&&e.parentElement&&this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu)}componentWillUnmount(){var e;(e=this.container.current)!==null&&e!==void 0&&e.parentElement&&this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu)}handleContextMenu(e){if(this.container.current){var t=this.container.current.getBoundingClientRect(),r=e.clientY-t.top,i=e.clientX-t.left,{actions:a}=this.state;if(a!=null&&e.target===this.container.current){e.preventDefault(),this.setState({actions:null},()=>{var s=document.elementFromPoint(i,r),l=new MouseEvent("contextmenu",{clientX:e.clientX,clientY:e.clientY,bubbles:!0,cancelable:!0});s==null||s.dispatchEvent(l)});return}if(he.isContextActionEvent(e)&&!(e.metaKey||e.ctrlKey)){var o=he.getMenuItems(e.contextActions);o.length!==0&&(e.preventDefault(),this.setState({actions:o,top:r,left:i}))}}}handleMenuClose(e){e===this.openMenu.current&&this.setState({actions:null})}render(){var e=null,{"data-testid":t}=this.props,{actions:r,top:i,left:a}=this.state;return r&&(e=E.jsx(Qr,{ref:this.openMenu,actions:r,onMenuClosed:this.handleMenuClose,top:i,left:a,updatePosition:(o,s)=>{this.setState({top:o,left:s})},"data-testid":t})),E.jsx("div",{className:Z("context-menu-root",{active:r}),ref:this.container,children:e})}}const Li=en;function tn(n){var{copy:e,kind:t="ghost",tooltip:r="Copy",className:i,"data-testid":a,children:o}=n,[s,l]=Pr();return E.jsx(Br,{kind:t,className:i,"data-testid":a,icon:s?Ht:Wt,tooltip:s?"Copied":r,onClick:()=>{l(typeof e=="function"?e():e)},children:o})}const rn={"dh-spectrum-palette":"_dh-spectrum-palette_1mcqx_1"},nn={"dh-spectrum-alias":"_dh-spectrum-alias_145ve_1"};function it(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function at(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?it(Object(t),!0).forEach(function(r){an(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):it(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function an(n,e,t){return e=sn(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function sn(n){var e=on(n,"string");return typeof e=="symbol"?e:String(e)}function on(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var st=at(at({},rn),nn);function ot(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Me(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ot(Object(t),!0).forEach(function(r){ln(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ot(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ln(n,e,t){return e=un(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function un(n){var e=cn(n,"string");return typeof e=="symbol"?e:String(e)}function cn(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var{global:dn,light:hn,dark:fn,medium:mn,large:pn}=xt,vn={global:dn,light:Me(Me({},hn),st),dark:Me(Me({},fn),st),medium:mn,large:pn};function gn(n){var{children:e,isPortal:t=!1,theme:r=vn,colorScheme:i}=n,[a]=N.useState(t?Lt():null);return E.jsx(Rt,{UNSAFE_className:"spectrum-theme-provider",theme:r,colorScheme:i,"data-unique-id":a,children:e})}var yn=G.module("ThemeProvider"),Mt=N.createContext(null);function Ri(n){var{themes:e,children:t}=n,r=N.useMemo(()=>Bt(),[]),[i,a]=N.useState(null),[o,s]=N.useState(()=>{var c,d;return(c=(d=qt())===null||d===void 0?void 0:d.themeKey)!==null&&c!==void 0?c:Kt}),l=N.useMemo(()=>e==null?null:zt(o,{base:r,custom:e??[]}),[r,o,e]),u=N.useMemo(()=>[...r,...e??[]],[r,e]);return N.useEffect(function(){if(!(l==null||e==null)){Gt();var d=Yt();yn.debug2("updateThemePreloadData:",{active:l.map(h=>h.themeKey),custom:e.map(h=>h.themeKey),preloadStyleContent:d,selectedThemeKey:o}),Xt({themeKey:o,preloadStyleContent:d})}},[l,o,e]),N.useEffect(()=>{a({activeThemes:l,selectedThemeKey:o,themes:u,setSelectedThemeKey:s})},[l,o,u]),E.jsxs(E.Fragment,{children:[l==null?null:E.jsx(E.Fragment,{children:l.map(c=>E.jsx("style",{"data-theme-key":c.themeKey,children:c.styleContent},c.themeKey))}),i==null?null:E.jsx(Mt.Provider,{value:i,children:E.jsx(gn,{children:t})})]})}function En(){return Oe(Mt,"No ThemeContext value found. Component must be wrapped in a ThemeContext.Provider")}function ki(){return Oe(Zt,"No API available in useApi. Was code wrapped in ApiBootstrap or ApiContext.Provider?")}function He(n,e,t){return e=Sn(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Sn(n){var e=Tn(n,"string");return typeof e=="symbol"?e:String(e)}function Tn(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ae{static isValid(e,t){return!0}static isSameFormat(e,t){throw new Error("isSameFormat not implemented")}static makeFormat(e,t,r){return{label:e,formatString:t,type:r}}format(e,t){return""}}He(Ae,"TYPE_GLOBAL","type-global");He(Ae,"TYPE_CONTEXT_PRESET","type-context-preset");He(Ae,"TYPE_CONTEXT_CUSTOM","type-context-custom");const W=Ae;class bn extends W{format(e){switch(e){case 1:case!0:return"true";case 0:case!1:return"false";default:return""}}}const wn=bn;class Pn extends W{format(e){return String.fromCharCode(e)}}const Fn=Pn;function le(n,e,t){return e=Mn(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Mn(n){var e=Dn(n,"string");return typeof e=="symbol"?e:String(e)}function Dn(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var lt=G.module("DateTimeColumnFormatter");class J extends W{static isValid(e,t){try{return e.i18n.DateTimeFormat.format(t.formatString,new Date),!0}catch{return!1}}static makeFormat(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:W.TYPE_CONTEXT_PRESET;return{label:e,formatString:t,type:r}}static isSameFormat(e,t){return e===t||e!==null&&t!==null&&e.type===t.type&&e.formatString===t.formatString}static makeGlobalFormatStringMap(e,t){var r=t?"'T'":" ",i=e?" z":"";return new Map([["yyyy-MM-dd HH:mm:ss","yyyy-MM-dd".concat(r,"HH:mm:ss").concat(i)],["yyyy-MM-dd HH:mm:ss.SSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSS").concat(i)],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSSSSSSSS").concat(i)]])}static getGlobalFormats(e,t){var r=J.makeGlobalFormatStringMap(e,t);return[...r.keys()]}static makeFormatStringMap(e,t){var r=t!==void 0&&t?"'T'":" ",i=e!==void 0&&e?" z":"";return new Map([["yyyy-MM-dd","yyyy-MM-dd".concat(i)],["MM-dd-yyyy","MM-dd-yyyy".concat(i)],["HH:mm:ss","HH:mm:ss".concat(i)],["HH:mm:ss.SSS","HH:mm:ss.SSS".concat(i)],["HH:mm:ss.SSSSSSSSS","HH:mm:ss.SSSSSSSSS".concat(i)],["yyyy-MM-dd HH:mm:ss","yyyy-MM-dd".concat(r,"HH:mm:ss").concat(i)],["yyyy-MM-dd HH:mm:ss.SSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSS").concat(i)],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSSSSSSSS").concat(i)]])}static getFormats(e,t){var r=J.makeFormatStringMap(e,t);return[...r.keys()]}constructor(e){var{timeZone:t="",showTimeZone:r=!0,showTSeparator:i=!1,defaultDateTimeFormatString:a=J.DEFAULT_DATETIME_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),le(this,"dh",void 0),le(this,"dhTimeZone",void 0),le(this,"defaultDateTimeFormatString",void 0),le(this,"showTimeZone",void 0),le(this,"showTSeparator",void 0),le(this,"formatStringMap",void 0);var o=t||J.DEFAULT_TIME_ZONE_ID;try{this.dhTimeZone=e.i18n.TimeZone.getTimeZone(o)}catch{lt.error("Unsupported time zone id",o),this.dhTimeZone=e.i18n.TimeZone.getTimeZone(J.DEFAULT_TIME_ZONE_ID)}this.dh=e,this.defaultDateTimeFormatString=a,this.showTimeZone=r,this.showTSeparator=i,this.formatStringMap=J.makeFormatStringMap(r,i)}getEffectiveFormatString(e){var t;return(t=this.formatStringMap.get(e))!==null&&t!==void 0?t:e}format(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultDateTimeFormatString,i=this.getEffectiveFormatString(r);try{return this.dh.i18n.DateTimeFormat.format(i,e,this.dhTimeZone)}catch{lt.error("Invalid format arguments")}return""}}le(J,"DEFAULT_DATETIME_FORMAT_STRING","yyyy-MM-dd HH:mm:ss.SSS");le(J,"DEFAULT_TIME_ZONE_ID","America/New_York");function te(n,e,t){return e=On(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function On(n){var e=Nn(n,"string");return typeof e=="symbol"?e:String(e)}function Nn(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var An=G.module("DecimalColumnFormatter");class L extends W{static isValid(e,t){try{return e.i18n.NumberFormat.format(t.formatString,0),!0}catch{return!1}}static makeFormat(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:W.TYPE_CONTEXT_PRESET,i=arguments.length>3?arguments[3]:void 0;return{label:e,type:r,formatString:t,multiplier:i}}static makePresetFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0;return L.makeFormat(e,t,W.TYPE_CONTEXT_PRESET,r)}static makeCustomFormat(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return L.makeFormat("Custom Format",e,W.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}constructor(e){var{defaultFormatString:t=L.DEFAULT_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),te(this,"defaultFormatString",void 0),te(this,"dh",void 0),this.dh=e,this.defaultFormatString=t}format(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,i=t.multiplier!=null&&t.multiplier!==0?e*t.multiplier:e;try{return this.dh.i18n.NumberFormat.format(r,i)}catch{An.error("Invalid format arguments")}return""}}te(L,"DEFAULT_FORMAT_STRING","###,##0.0000");te(L,"FORMAT_PERCENT",L.makePresetFormat("Percent","##0.00%"));te(L,"FORMAT_BASIS_POINTS",L.makePresetFormat("Basis Points","###,##0 bp",1e4));te(L,"FORMAT_MILLIONS",L.makePresetFormat("Millions","###,##0.000 mm",1e-6));te(L,"FORMAT_SCIENTIFIC_NOTATION",L.makePresetFormat("Scientific Notation","0.0000E0"));te(L,"FORMAT_ROUND",L.makePresetFormat("Round","###,##0"));te(L,"FORMAT_ROUND_TWO_DECIMALS",L.makePresetFormat("0.00","###,##0.00"));te(L,"FORMAT_ROUND_FOUR_DECIMALS",L.makePresetFormat("0.0000","###,##0.0000"));class Cn extends W{format(e){return"".concat(e)}}const In=Cn;function be(n,e,t){return e=xn(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function xn(n){var e=Ln(n,"string");return typeof e=="symbol"?e:String(e)}function Ln(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Rn=G.module("IntegerColumnFormatter");class ee extends W{static isValid(e,t){try{return e.i18n.NumberFormat.format(t.formatString,0),!0}catch{return!1}}static makeFormat(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:W.TYPE_CONTEXT_PRESET,i=arguments.length>3?arguments[3]:void 0;return{label:e,type:r,formatString:t,multiplier:i}}static makePresetFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0;return ee.makeFormat(e,t,W.TYPE_CONTEXT_PRESET,r)}static makeCustomFormat(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return ee.makeFormat("Custom Format",e,W.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}constructor(e){var{defaultFormatString:t=ee.DEFAULT_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),be(this,"dh",void 0),be(this,"defaultFormatString",void 0),this.dh=e,this.defaultFormatString=t}format(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,i=t.multiplier!=null&&t.multiplier!==0?e*t.multiplier:e;try{return this.dh.i18n.NumberFormat.format(r,i)}catch{Rn.error("Invalid format arguments")}return""}}be(ee,"DEFAULT_FORMAT_STRING","###,##0");be(ee,"FORMAT_MILLIONS",ee.makePresetFormat("Millions","###,##0.000 mm",1e-6));be(ee,"FORMAT_SCIENTIFIC_NOTATION",ee.makePresetFormat("Scientific Notation","0.0000E0"));class kn extends W{format(e){return e}}function Dt(n,e,t){return e=_n(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function _n(n){var e=jn(n,"string");return typeof e=="symbol"?e:String(e)}function jn(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class k{static makeDateWrapper(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:1,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0,s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:0,l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:0,u=arguments.length>8&&arguments[8]!==void 0?arguments[8]:0;if(!t)throw new Error("No timezone provided");var c="".concat(r).padStart(4,"0"),d="".concat(i+1).padStart(2,"0"),h="".concat(a).padStart(2,"0"),g="".concat(o).padStart(2,"0"),p="".concat(s).padStart(2,"0"),y="".concat(l).padStart(2,"0"),S="".concat(u).padStart(9,"0"),T="".concat(c,"-").concat(d,"-").concat(h," ").concat(g,":").concat(p,":").concat(y,".").concat(S);return e.i18n.DateTimeFormat.parse(k.FULL_DATE_FORMAT,T,e.i18n.TimeZone.getTimeZone(t))}static getNextNanos(e){var t=parseInt(e,10),r="0".repeat(9-e.length),i="".concat(t+1).concat(r);return parseInt(i,10)}static getNextDate(e,t,r,i){var{year:a,month:o,date:s,hours:l,minutes:u,seconds:c,nanos:d}=r;if(t.nanos!=null){if(t.nanos.length===9)return null;d=k.getNextNanos(t.nanos),d>999999999&&(c+=1,d=0)}else t.seconds!=null?c+=1:t.minutes!=null?u+=1:t.hours!=null?l+=1:t.date!=null?s+=1:t.month!=null?o+=1:a+=1;var h=new Date(a,o,s,l,u,c);return k.makeDateWrapper(e,i,h.getFullYear(),h.getMonth(),h.getDate(),h.getHours(),h.getMinutes(),h.getSeconds(),d)}static parseMonth(e){var t=parseInt(e,10);if(!Number.isNaN(t))return t>=1&&t<=12?t-1:NaN;var r=e.trim().toLowerCase();if(r.length>=3){for(var i=0;i<k.months.length;i+=1)if(k.months[i].startsWith(r))return i}return NaN}static parseDateValues(e,t,r,i,a,o,s){var l=parseInt(e,10),u=t!=null?this.parseMonth(t):0,c=r!=null?parseInt(r,10):1,d=i!=null?parseInt(i,10):0,h=a!=null?parseInt(a,10):0,g=o!=null?parseInt(o,10):0,p=s!=null?parseInt(s.padEnd(9,"0"),10):0;return Number.isNaN(l)||Number.isNaN(u)||Number.isNaN(c)||Number.isNaN(d)||Number.isNaN(h)||Number.isNaN(g)||Number.isNaN(p)?null:{year:l,month:u,date:c,hours:d,minutes:h,seconds:g,nanos:p}}static parseDateTimeString(e){var t=/\s*(\d{4})([-./]([\da-z]+))?([-./](\d{1,2}))?([tT\s](\d{2})([:](\d{2}))?([:](\d{2}))?([.](\d{1,9}))?)?(.*)/,r=t.exec(e);if(r==null)throw new Error("Unexpected date string: ".concat(e));var[,i,,a,,o,,s,,l,,u,,c,d]=r;if(d!=null&&d.length>0)throw new Error("Unexpected characters after date string '".concat(e,"': ").concat(d));return{year:i,month:a,date:o,hours:s,minutes:l,seconds:u,nanos:c}}static parseDateRange(e,t,r){var i=t.trim().toLowerCase();if(i.length===0)throw new Error("Cannot parse date range from empty string");if(i==="null")return[null,null];if(i==="today"){var a=new Date(Date.now()),o=k.makeDateWrapper(e,r,a.getFullYear(),a.getMonth(),a.getDate()),s=new Date(a.getFullYear(),a.getMonth(),a.getDate()+1),l=k.makeDateWrapper(e,r,s.getFullYear(),s.getMonth(),s.getDate());return[o,l]}if(i==="yesterday"){var u=new Date(Date.now()),c=new Date(u.getFullYear(),u.getMonth(),u.getDate()-1),d=k.makeDateWrapper(e,r,c.getFullYear(),c.getMonth(),c.getDate()),h=k.makeDateWrapper(e,r,u.getFullYear(),u.getMonth(),u.getDate());return[d,h]}if(i==="now"){var g=new Date(Date.now()),p=e.DateWrapper.ofJsDate(g);return[p,null]}var y=k.parseDateTimeString(i);if(y.year==null&&y.month==null&&y.date==null)throw new Error("Unable to extract year, month, or day ".concat(i));var S=k.parseDateValues(y.year,y.month,y.date,y.hours,y.minutes,y.seconds,y.nanos);if(S==null)throw new Error("Unable to extract date values from ".concat(y));var T=k.makeDateWrapper(e,r,S.year,S.month,S.date,S.hours,S.minutes,S.seconds,S.nanos),w=k.getNextDate(e,y,S,r);return[T,w]}static getJsDate(e){return typeof e=="number"?new Date(e):e.asDate()}}Dt(k,"FULL_DATE_FORMAT","yyyy-MM-dd HH:mm:ss.SSSSSSSSS");Dt(k,"months",["january","february","march","april","may","june","july","august","september","october","november","december"]);function _i(n,e){return n===e?{operator:"notEq",value:""}:{operator:"eq",value:n}}function ji(n,e,t){return function(i){var a=t.trim();if(a==="")return null;var o=Ot(e,s=>s.filter().containsIgnoreCase(n.makeFilterValue(s.type,a)),"or");return o(i)}}function Ot(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"or";return function(i){var a=i==null?void 0:i.findColumns(typeof n=="string"?[n]:n);if(a==null||a.length===0)return null;var o=a.map(e);return o.reduce((s,l)=>s[t](l))}}function $n(n,e,t,r){return Ot(e,i=>i.filter()[r](n.makeFilterValue(i.type,t)),"or")}function $i(n,e,t,r,i){return function(o){var s=o==null?void 0:o.findColumn(e),l=t==="all"||r&&t.size===0;return s==null||l?null:n.makeSelectValueFilter(s,[...t.keys()],i)}}function Vi(n){return function(t){return t.filter().isNull().not().and(t.filter().notEq(n.makeFilterValue(t.type,"")))}}function Hi(n,e){return function(r){var i=r.filter(),a=n.makeFilterValue(r.type,""),o=i.eq(a);return e?i.isNull().or(o):o.or(i.notEq(a))}}function We(n,e,t){return e=Vn(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Vn(n){var e=Hn(n,"string");return typeof e=="symbol"?e:String(e)}function Hn(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class we{}We(we,"not","not");We(we,"and","and");We(we,"or","or");function Wi(n){if(!(n==="not"||n==="and"||n==="or"))throw new Error("operator is not a valid FilterOperatorValue")}function A(n,e,t){return e=Wn(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Wn(n){var e=Bn(n,"string");return typeof e=="symbol"?e:String(e)}function Bn(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class m{}A(m,"eq","eq");A(m,"eqIgnoreCase","eqIgnoreCase");A(m,"notEq","notEq");A(m,"notEqIgnoreCase","notEqIgnoreCase");A(m,"greaterThan","greaterThan");A(m,"greaterThanOrEqualTo","greaterThanOrEqualTo");A(m,"lessThan","lessThan");A(m,"lessThanOrEqualTo","lessThanOrEqualTo");A(m,"in","in");A(m,"inIgnoreCase","inIgnoreCase");A(m,"notIn","notIn");A(m,"notInIgnoreCase","notInIgnoreCase");A(m,"isTrue","isTrue");A(m,"isFalse","isFalse");A(m,"isNull","isNull");A(m,"invoke","invoke");A(m,"contains","contains");A(m,"notContains","notContains");A(m,"containsIgnoreCase","containsIgnoreCase");A(m,"startsWith","startsWith");A(m,"endsWith","endsWith");A(m,"containsAny","containsAny");var ut=G.module("ViewportDataUtils");function qn(n,e){return String(n.offsetInSnapshot+e)}function Bi(n,e){var{bulkUpdate:t}=n;return function(i){var{columns:a,offset:o,rows:s}=i.detail;ut.debug("table updated",i.detail);var l=new Map;s.forEach(u=>{var c=e(u,a),d=qn(u,o);l.set(d,{key:d,item:c})}),ut.debug("update keys",l),t(l)}}function qi(n,e){return e.reduce((t,r)=>(t[r.name]=n.get(r),t),{})}function*Ki(n,e){for(var t=n;t<=e;++t)yield{key:String(t)}}function Kn(n){return n==null||zn(n)?0:n.size}function zn(n){return"isClosed"in n?n.isClosed:!1}function zi(n,e,t,r){var i=n+e-1,[a,o]=[0,r-1],s=ze(n-t,a,o),l=ze(i+t,a,o);return[s,l]}function ct(n,e,t,r,i,a,o){try{var s=n[a](o),l=s.value}catch(u){t(u);return}s.done?e(l):Promise.resolve(l).then(r,i)}function se(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){ct(a,r,i,o,s,"next",l)}function s(l){ct(a,r,i,o,s,"throw",l)}o(void 0)})}}function fe(n,e,t){return e=Gn(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Gn(n){var e=Yn(n,"string");return typeof e=="symbol"?e:String(e)}function Yn(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ne=G.module("TableUtils");class f{static copyTableAndApplyFilters(e){var t=arguments;return se(function*(){if(e==null)return null;for(var r=yield e.copy(),i=t.length,a=new Array(i>1?i-1:0),o=1;o<i;o++)a[o-1]=t[o];return r.applyFilter(xe(...a.map(s=>s(r)))),r})()}static getSortIndex(e,t){for(var r=0;r<e.length;r+=1){var i,a=e[r];if(((i=a.column)===null||i===void 0?void 0:i.name)===t)return r}return null}static getSortForColumn(e,t){var r=f.getSortIndex(e,t);return r!=null?e[r]:null}static getFilterText(e){return e?e.toString():null}static getFilterTypes(e){return f.isBooleanType(e)?[m.isTrue,m.isFalse,m.isNull]:f.isCharType(e)||f.isNumberType(e)||f.isDateType(e)?[m.eq,m.notEq,m.greaterThan,m.greaterThanOrEqualTo,m.lessThan,m.lessThanOrEqualTo]:f.isTextType(e)?[m.eq,m.eqIgnoreCase,m.notEq,m.notEqIgnoreCase,m.contains,m.notContains,m.startsWith,m.endsWith]:[]}static getNextSort(e,t,r){if(r<0||r>=e.length)return null;var i=f.getSortForColumn(t,e[r].name);return i===null?e[r].sort().asc():i.direction===f.sortDirection.ascending?i.desc():null}static makeColumnSort(e,t,r,i){if(t<0||t>=e.length||r===f.sortDirection.none)return null;var a=e[t].sort();switch(r){case f.sortDirection.ascending:a=a.asc();break;case f.sortDirection.descending:a=a.desc();break}return i&&(a=a.abs()),a}static toggleSortForColumn(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(r<0||r>=t.length)return[];var a=f.getNextSort(t,e,r);return f.setSortForColumn(e,t[r].name,a,i)}static sortColumn(e,t,r,i,a,o){if(r<0||r>=t.length)return[];var s=f.makeColumnSort(t,r,i,a);return f.setSortForColumn(e,t[r].name,s,o)}static setSortForColumn(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,a=f.getSortIndex(e,t),o=[];return i&&(o=o.concat(e.filter(s=>{var{direction:l}=s;return l!==f.sortDirection.reverse})),a!==null&&o.splice(a,1)),r!==null&&o.push(r),o}static getNormalizedType(e){switch(e){case"boolean":case"java.lang.Boolean":case f.dataType.BOOLEAN:return f.dataType.BOOLEAN;case"char":case"java.lang.Character":case f.dataType.CHAR:return f.dataType.CHAR;case"java.lang.String":case f.dataType.STRING:return f.dataType.STRING;case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":case"java.time.Instant":case"java.time.ZonedDateTime":case f.dataType.DATETIME:return f.dataType.DATETIME;case"double":case"java.lang.Double":case"float":case"java.lang.Float":case"java.math.BigDecimal":case f.dataType.DECIMAL:return f.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 f.dataType.INT:return f.dataType.INT;default:return f.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"java.time.Instant":case"java.time.ZonedDateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":return!0;default:return!1}}static isNumberType(e){return f.isIntegerType(e)||f.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 isBigDecimalType(e){switch(e){case"java.math.BigDecimal":return!0;default:return!1}}static isBigIntegerType(e){switch(e){case"java.math.BigInteger":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 f.getNormalizedType(e)===f.getNormalizedType(t)}static quoteValue(e){return e.length>=2&&(e.charAt(0)==='"'&&e.charAt(e.length-1)==='"'||e.charAt(0)==="'"&&e.charAt(e.length-1)==="'")?e:'"'.concat(e,'"')}static isRangeOperation(e){switch(e){case"<":case"<=":case"=<":case">":case">=":case"=>":return!0;default:return!1}}static makeRangeFilterWithOperation(e,t,r){switch(t){case"=":return e.eq(r);case"<":return e.lessThan(r);case"<=":case"=<":return e.lessThanOrEqualTo(r);case">":return e.greaterThan(r);case">=":case"=>":return e.greaterThanOrEqualTo(r);case"!=":case"!":return e.notEq(r);default:return null}}static makeCancelableTablePromise(e){return je.makeCancelable(e,t=>{t.close()})}static makeCancelableTableEventPromise(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,a,o,s=!0,l=new Promise((u,c)=>{o=setTimeout(()=>{a(),s=!1,c(new Pt('Event "'.concat(t,'" timed out.')))},r),a=e.addEventListener(t,d=>{if(i!=null&&!i(d)){ne.debug2("Event triggered, but matcher returned false.");return}ne.debug2("Event triggered, resolving."),a(),clearTimeout(o),s=!1,u(d)})});return l.cancel=()=>{if(s){ne.debug2("Pending promise cleanup."),a(),clearTimeout(o),s=!1;return}ne.debug2("Ignoring non-pending promise cancel.")},l}static removeCommas(e){return e.replace(/[\s|,]/g,"")}static makeBooleanValue(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!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 '".concat(e,"'"))}}static makeNumberValue(e){if(e==="null"||e==="")return null;var t=e.toLowerCase().trim();if(t==="∞"||t==="infinity"||t==="inf")return Number.POSITIVE_INFINITY;if(t==="-∞"||t==="-infinity"||t==="-inf")return Number.NEGATIVE_INFINITY;var r=f.removeCommas(t);if(f.NUMBER_REGEX.test(r))return parseFloat(r);throw new Error("Invalid number '".concat(e,"'"))}static getFilterOperatorString(e){switch(e){case m.eq:return"=";case m.notEq:return"!=";case m.greaterThan:return">";case m.greaterThanOrEqualTo:return">=";case m.lessThan:return"<";case m.lessThanOrEqualTo:return"<=";case m.contains:return"~";case m.notContains:return"!~";default:throw new Error("Unexpected filter type ".concat(e))}}static isTreeTable(e){return e!=null&&e.expand!==void 0&&e.collapse!==void 0}static sortColumns(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return[...e].sort((r,i)=>{var a=r.name.toUpperCase(),o=i.name.toUpperCase();return Tr.sort(a,o,t)})}constructor(e){fe(this,"dh",void 0),this.dh=e,hr(this)}createDistinctSortedColumnTable(e,t,r){var i=arguments,a=this;return se(function*(){if(e==null)return null;for(var o=e,s=i.length,l=new Array(s>3?s-3:0),u=3;u<s;u++)l[u-3]=i[u];l.length>0&&(o=yield e.copy(),yield o.applyFilter(xe(...l.map(g=>g(o)))));var c=o.findColumn(t),d=yield o.selectDistinct([c]);o!==e&&o.close();var h=d.findColumn(t).sort()[r]();return a.applySort(d,[h])})()}doesColumnValueExist(e,t,r,i){var a=this;return se(function*(){if(e==null)return null;var o=$n(a,t,r,i?"eq":"eqIgnoreCase"),s=yield e.copy();yield a.applyFilter(s,xe(o(s)));var l=Kn(s);return s.close(),l>0})()}makeQuickFilter(e,t,r){for(var i=t.split("||"),a=null,o=0;o<i.length;o+=1){for(var s=i[o],l=s.split("&&"),u=null,c=0;c<l.length;c+=1){var d=l[c].trim();if(d.length>0){var h=this.makeQuickFilterFromComponent(e,d,r);if(h)u?u=u.and(h):u=h;else throw new Error("Unable to parse quick filter from text ".concat(t))}}a&&u?a=a.or(u):a=u}return a}makeQuickFilterFromComponent(e,t,r){var{type:i}=e;return f.isNumberType(i)?this.makeQuickNumberFilter(e,t):f.isBooleanType(i)?this.makeQuickBooleanFilter(e,t):r!=null&&f.isDateType(i)?this.makeQuickDateFilter(e,t,r):f.isCharType(i)?this.makeQuickCharFilter(e,t):this.makeQuickTextFilter(e,t)}makeQuickNumberFilter(e,t){var r=e.filter(),{dh:i}=this,a=null,o=/\s*(>=|<=|=>|=<|>|<|!=|=|!)?(\s*-\s*)?(\s*\d*(?:,\d{3})*(?:\.\d*)?\s*)?(null|nan|infinity|inf|\u221E)?(.*)/i,s=o.exec(t),l=null,u=null,c=null,d=null,h=null;if(s!==null&&s.length>3&&([,l,u,c,d,h]=s),h!=null&&h.trim().length>0)return null;if(l==null&&(l="="),d!=null){if(!(l==="="||l==="!"||l==="!="))return null;switch(d=d.trim().toLowerCase(),d){case"null":a=r.isNull();break;case"nan":a=i.FilterCondition.invoke("isNaN",r);break;case"infinity":case"inf":case"∞":u!=null?a=i.FilterCondition.invoke("isInf",r).and(r.lessThan(i.FilterValue.ofNumber(0))):a=i.FilterCondition.invoke("isInf",r).and(r.greaterThan(i.FilterValue.ofNumber(0)));break}return a!==null&&(l==="!"||l==="!=")&&(a=a.not()),a}if(c==null)return null;if(c=f.removeCommas(c),f.isLongType(e.type))try{c=i.FilterValue.ofNumber(i.LongWrapper.ofString("".concat(u!=null?"-":"").concat(c)))}catch(g){return ne.warn("Unable to create long filter",g),null}else{if(c=parseFloat(c),c==null||Number.isNaN(c))return null;c=i.FilterValue.ofNumber(u!=null?0-c:c)}return a=e.filter(),f.makeRangeFilterWithOperation(a,l,c)}static escapeQuickTextFilter(e){var t,r;if(e==null)return null;var i=/^(!~|!=|~|=|!)?(.*)/,a=/^\\*null$/,o=i.exec(e),s=null,l=null;if(o!==null&&o.length>2&&([,s,l]=o),s!=null){var u;return"\\".concat(s).concat((u=l)!==null&&u!==void 0?u:"")}return l!=null&&a.test(l.toLowerCase())||l!=null&&l.startsWith("*")?"\\".concat(l):l!=null&&l.endsWith("*")&&!l.endsWith("\\*")?(l=l.substring(0,l.length-1),"".concat(l,"\\*")):"".concat((t=s)!==null&&t!==void 0?t:"").concat((r=l)!==null&&r!==void 0?r:"")}static unescapeQuickTextFilter(e){var t,r,i=/^(\\!~|\\!=|\\~|\\=|\\!)?(.*)/,a=/^\\*null$/,o=i.exec(e),s=null,l=null;return o!==null&&o.length>2&&([,s,l]=o),s!=null&&(s=s.replace("\\","")),l!=null&&a.test(l.toLowerCase())&&(l=l.replace("\\","")),s==null&&l!=null&&l.startsWith("\\*")&&(l=l.substring(1)),s==null&&l!=null&&l.endsWith("\\*")?(l=l.substring(0,l.length-2),"".concat(l,"*")):"".concat((t=s)!==null&&t!==void 0?t:"").concat((r=l)!==null&&r!==void 0?r:"")}makeQuickTextFilter(e,t){var{dh:r}=this,i="".concat(t).trim(),a=/^(!~|!=|~|=|!)?(.*)/,o=a.exec(i),s=null,l=null;if(o!==null&&o.length>2&&([,s,l]=o,l!=null&&(l=l.trim())),l==null||l.length===0&&!(s==="="||s==="!="))return null;s==null&&(s="=");var u=e.filter();if(l.toLowerCase()==="null")switch(s){case"=":return u.isNull();case"!=":case"!":return u.isNull().not()}var c=null,d=null;switch(l.startsWith("*")?(c="*",l=l.substring(1)):l.endsWith("*")&&!l.endsWith("\\*")&&(d="*",l=l.substring(0,l.length-1)),l=f.unescapeQuickTextFilter(l),s){case"~":return u.isNull().not().and(u.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E.*"))));case"!~":return u.isNull().or(u.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E.*"))).not());case"!=":return c==="*"?u.isNull().or(u.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E$"))).not()):d==="*"?u.isNull().or(u.invoke("matches",r.FilterValue.ofString("(?s)(?i)^\\Q".concat(l,"\\E.*"))).not()):u.notEqIgnoreCase(r.FilterValue.ofString(l.toLowerCase()));case"=":return c==="*"?u.isNull().not().and(u.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E$")))):d==="*"?u.isNull().not().and(u.invoke("matches",r.FilterValue.ofString("(?s)(?i)^\\Q".concat(l,"\\E.*")))):u.eqIgnoreCase(r.FilterValue.ofString(l.toLowerCase()))}return null}makeQuickBooleanFilter(e,t){var r=/^(!=|=|!)?(.*)/,i=r.exec("".concat(t).trim());if(i===null)return null;var[,a,o]=i,s=a==="!"||a==="!=",l=o.trim().toLowerCase(),u=e.filter();try{var c=f.makeBooleanValue(l);return c!=null&&c?u=u.isTrue():c===null?u=u.isNull():u=u.isFalse(),s?u.not():u}catch{return null}}makeQuickDateFilter(e,t,r){var i=t.trim(),a=/\s*(>=|<=|=>|=<|>|<|!=|!|=)?(.*)/,o=a.exec(i);if(o==null||o.length<=2)throw new Error("Unable to parse date filter: ".concat(t));var s=null,l=null;[,s,l]=o;var u=m.eq;switch(s){case"<":u=m.lessThan;break;case"<=":case"=<":u=m.lessThanOrEqualTo;break;case">":u=m.greaterThan;break;case">=":case"=>":u=m.greaterThanOrEqualTo;break;case"!=":case"!":u=m.notEq;break;case"=":case"==":default:u=m.eq;break}return this.makeQuickDateFilterWithOperation(e,l,u,r)}makeQuickDateFilterWithOperation(e,t,r,i){var{dh:a}=this,[o,s]=k.parseDateRange(a,t,i),l=o!=null?a.FilterValue.ofNumber(o):null,u=s!=null?a.FilterValue.ofNumber(s):null,c=e.filter();if(l==null)return r===m.notEq?c.isNull().not():c.isNull();switch(r){case m.eq:{if(u!=null){var d=c.greaterThanOrEqualTo(l),h=c.lessThan(u);return d.and(h)}return c.eq(l)}case m.lessThan:return c.lessThan(l);case m.lessThanOrEqualTo:return u!=null?c.lessThan(u):c.lessThanOrEqualTo(l);case m.greaterThan:return u!=null?c.greaterThanOrEqualTo(u):c.greaterThan(l);case m.greaterThanOrEqualTo:return c.greaterThanOrEqualTo(l);case m.notEq:{if(u!=null){var g=c.lessThan(l),p=c.greaterThanOrEqualTo(u);return g.or(p)}return c.notEq(l)}default:throw new Error("Invalid operator: ".concat(r))}}makeQuickCharFilter(e,t){var{dh:r}=this,i="".concat(t).trim(),a=/^(>=|<=|=>|=<|>|<|!=|=|!)?(null|"."|'.'|.)?(.*)/,o=a.exec(i),s=null,l=null,u=null;if(o!==null&&o.length>3&&([,s,l,u]=o),u!=null&&u.trim().length>0||l==null||l.length===0)return null;s==null&&(s="=");var c=e.filter();if(l.toLowerCase()==="null")switch(s){case"=":return c.isNull();case"!=":case"!":return c.isNull().not();default:return null}var d=r.FilterValue.ofString(f.isRangeOperation(s)?f.quoteValue(l):l);return f.makeRangeFilterWithOperation(c,s,d)}makeAdvancedFilter(e,t,r){for(var{filterItems:i,filterOperators:a,invertSelection:o,selectedValues:s}=t,l=null,u=0;u<i.length;u+=1){var c=i[u],{selectedType:d,value:h}=c;if(d!=null&&d.length>0&&h!=null&&h.length>0)try{var g=this.makeAdvancedValueFilter(e,d,h,r);if(g!=null){if(u===0)l=g;else if(l!==null&&u-1<a.length){var p=a[u-1];if(p===we.and)l=l.and(g);else if(p===we.or)l=l.or(g);else{ne.error("Unexpected filter operator",p,g),l=null;break}}}else ne.debug2("Empty filter ignored for",d,h)}catch(S){ne.error("Unable to create filter",S),l=null;break}}var y=this.makeSelectValueFilter(e,s,o);return y!=null&&(l!=null?l=l.and(y):l=y),l}makeAdvancedValueFilter(e,t,r,i){var{dh:a}=this;if(f.isDateType(e.type))return this.makeQuickDateFilterWithOperation(e,r,t,i);if(f.isNumberType(e.type)||f.isCharType(e.type))return this.makeQuickFilter(e,"".concat(f.getFilterOperatorString(t)).concat(r));var o=this.makeFilterValue(e.type,r),s=e.filter();switch(t){case m.eq:return s.eq(o);case m.eqIgnoreCase:return s.eqIgnoreCase(o);case m.notEq:return s.notEq(o);case m.notEqIgnoreCase:return s.notEqIgnoreCase(o);case m.greaterThan:return s.greaterThan(o);case m.greaterThanOrEqualTo:return s.greaterThanOrEqualTo(o);case m.lessThan:return s.lessThan(o);case m.lessThanOrEqualTo:return s.lessThanOrEqualTo(o);case m.isTrue:return s.isTrue();case m.isFalse:return s.isFalse();case m.isNull:return s.isNull();case m.contains:return s.isNull().not().and(s.invoke("matches",a.FilterValue.ofString("(?s)(?i).*\\Q".concat(r,"\\E.*"))));case m.notContains:return s.isNull().or(s.invoke("matches",a.FilterValue.ofString("(?s)(?i).*\\Q".concat(r,"\\E.*"))).not());case m.startsWith:return s.isNull().not().and(s.invoke("matches",a.FilterValue.ofString("(?s)(?i)^\\Q".concat(r,"\\E.*"))));case m.endsWith:return s.isNull().not().and(s.invoke("matches",a.FilterValue.ofString("(?s)(?i).*\\Q".concat(r,"\\E$"))));case m.in:case m.inIgnoreCase:case m.notIn:case m.notInIgnoreCase:case m.invoke:default:throw new Error("Unexpected filter operation: ".concat(t))}}applyNeverFilter(e,t){var r=arguments,i=this;return se(function*(){var a=r.length>2&&r[2]!==void 0?r[2]:f.APPLY_TABLE_CHANGE_TIMEOUT_MS;if(e==null)return null;var o=e.findColumn(t),s=[i.makeNeverFilter(o)];return yield i.applyFilter(e,s,a),e})()}applyCustomColumns(e,t){var r=arguments,i=this;return se(function*(){var a=r.length>2&&r[2]!==void 0?r[2]:f.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:o}=i;return f.executeAndWaitForEvent(s=>s==null?void 0:s.applyCustomColumns(t),e,o.Table.EVENT_CUSTOMCOLUMNSCHANGED,a)})()}applyFilter(e,t){var r=arguments,i=this;return se(function*(){var a=r.length>2&&r[2]!==void 0?r[2]:f.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:o}=i;return f.executeAndWaitForEvent(s=>s==null?void 0:s.applyFilter(t),e,o.Table.EVENT_FILTERCHANGED,a)})()}applySort(e,t){var r=arguments,i=this;return se(function*(){var a=r.length>2&&r[2]!==void 0?r[2]:f.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:o}=i;return f.executeAndWaitForEvent(s=>s==null?void 0:s.applySort(t),e,o.Table.EVENT_SORTCHANGED,a)})()}makeNeverFilter(e){var{dh:t}=this,r=null;f.isTextType(e.type)?r=t.FilterValue.ofString("a"):f.isBooleanType(e.type)?r=t.FilterValue.ofBoolean(!0):f.isDateType(e.type)?r=t.FilterValue.ofNumber(t.DateWrapper.ofJsDate(new Date)):r=t.FilterValue.ofNumber(0);var i=e.filter().eq(r),a=e.filter().notEq(r);return i.and(a)}makeFilterValue(e,t){var{dh:r}=this,i=f.getBaseType(e);return f.isTextType(i)?r.FilterValue.ofString(t):f.isLongType(i)?r.FilterValue.ofNumber(r.LongWrapper.ofString(f.removeCommas(t))):r.FilterValue.ofNumber(f.removeCommas(t))}makeFilterRawValue(e,t){var{dh:r}=this;return f.isTextType(e)?r.FilterValue.ofString(t):f.isBooleanType(e)?r.FilterValue.ofBoolean(t):r.FilterValue.ofNumber(t)}makeValue(e,t,r){var{dh:i}=this;if(t==="null")return null;if(f.isTextType(e))return t;if(f.isLongType(e))return i.LongWrapper.ofString(f.removeCommas(t));if(f.isBooleanType(e))return f.makeBooleanValue(t,!0);if(f.isDateType(e)){var[a]=k.parseDateRange(i,t,r);return a}return f.isNumberType(e)?f.makeNumberValue(t):(ne.error("Unexpected column type",e),null)}makeSelectValueFilter(e,t,r){var{dh:i}=this;if(t.length===0)return r?null:this.makeNeverFilter(e);for(var a=[],o=!1,s=0;s<t.length;s+=1){var l=t[s];l==null?o=!0:f.isTextType(e.type)?a.push(i.FilterValue.ofString(typeof l=="number"?String.fromCharCode(l):l)):f.isBooleanType(e.type)?a.push(i.FilterValue.ofBoolean(!!l)):a.push(i.FilterValue.ofNumber(l))}return o?a.length>0?r?e.filter().isNull().not().and(e.filter().notIn(a)):e.filter().isNull().or(e.filter().in(a)):r?e.filter().isNull().not():e.filter().isNull():r?e.filter().notIn(a):e.filter().in(a)}}fe(f,"dataType",{BOOLEAN:"boolean",CHAR:"char",DATETIME:"datetime",DECIMAL:"decimal",INT:"int",STRING:"string",UNKNOWN:"unknown"});fe(f,"sortDirection",{ascending:"ASC",descending:"DESC",reverse:"REVERSE",none:null});fe(f,"APPLY_TABLE_CHANGE_TIMEOUT_MS",3e4);fe(f,"REVERSE_TYPE",Object.freeze({NONE:"none",PRE_SORT:"pre-sort",POST_SORT:"post-sort"}));fe(f,"NUMBER_REGEX",/^-?\d+(\.\d+)?$/);fe(f,"executeAndWaitForEvent",function(){var n=se(function*(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:f.APPLY_TABLE_CHANGE_TIMEOUT_MS;if(t==null)return null;var a=f.makeCancelableTableEventPromise(t,r,i);return e(t),yield a,t});return function(e,t,r){return n.apply(this,arguments)}}());function De(n,e,t){return e=Xn(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Xn(n){var e=Zn(n,"string");return typeof e=="symbol"?e:String(e)}function Zn(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Be{static makeColumnFormatMap(e){return e==null?new Map:e.reduce((t,r)=>{var i=f.getNormalizedType(r.columnType);if(i===null)return t;t.has(i)||t.set(i,new Map);var a=t.get(i);return a==null||a.set(r.columnName,r.format),t},new Map)}static makeColumnFormattingRule(e,t,r){return{columnType:e,columnName:t,format:r}}constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!1;De(this,"defaultColumnFormatter",void 0),De(this,"typeFormatterMap",void 0),De(this,"columnFormatMap",void 0),De(this,"truncateNumbersWithPound",void 0),this.defaultColumnFormatter=new In,this.typeFormatterMap=new Map([[f.dataType.BOOLEAN,new wn],[f.dataType.CHAR,new Fn],[f.dataType.DATETIME,new J(e,r)],[f.dataType.DECIMAL,new L(e,i)],[f.dataType.INT,new ee(e,a)],[f.dataType.STRING,new kn]]),this.columnFormatMap=Be.makeColumnFormatMap(t),this.truncateNumbersWithPound=o}getColumnFormatMapForType(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=f.getNormalizedType(e);if(r!==null)return t&&!this.columnFormatMap.has(r)&&this.columnFormatMap.set(r,new Map),this.columnFormatMap.get(r)}getColumnFormat(e,t){var r,i=this.getColumnFormatMapForType(e);return(r=i==null?void 0:i.get(t))!==null&&r!==void 0?r:null}getColumnTypeFormatter(e){var t=f.getNormalizedType(e),r=this.defaultColumnFormatter;if(t){var i;r=(i=this.typeFormatterMap.get(t))!==null&&i!==void 0?i:r}return r}getFormattedString(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",i=arguments.length>3?arguments[3]:void 0;if(e==null)return"";var a=this.getColumnTypeFormatter(t),o=i||this.getColumnFormat(t,r);return a.format(e,o??void 0)}get timeZone(){var e,t=this.typeFormatterMap.get(f.dataType.DATETIME);return t==null||(e=t.dhTimeZone)===null||e===void 0?void 0:e.id}}function Qn(n){if(n&&n.formatter){var{formatter:e}=n;return e}}function Un(n){return{timeZone:n==null?void 0:n.timeZone,defaultDateTimeFormatString:n==null?void 0:n.defaultDateTimeFormat,showTimeZone:n==null?void 0:n.showTimeZone,showTSeparator:n==null?void 0:n.showTSeparator}}function Jn(n,e,t){var r=n.getColumnFormat(t,e);return r!=null&&(r.type===W.TYPE_CONTEXT_PRESET||r.type===W.TYPE_CONTEXT_CUSTOM)}const Le={getColumnFormats:Qn,getDateTimeFormatterOptions:Un,isCustomColumnFormatDefined:Jn},ei=typeof Ie=="function"?Ie:Ie.default;wt.register([rr,nr,ir,ar,sr,or]);function q(n,e,t){return e=ti(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ti(n){var e=ri(n,"string");return typeof e=="symbol"?e:String(e)}function ri(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class x{constructor(e){q(this,"dh",void 0),q(this,"listeners",void 0),q(this,"formatter",void 0),q(this,"rect",void 0),q(this,"isDownsamplingDisabled",void 0),q(this,"title",void 0),this.dh=e,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(var t=0;t<this.listeners.length;t+=1)this.listeners[t](e)}fireUpdate(e){this.fireEvent(new CustomEvent(x.EVENT_UPDATED,{detail:e}))}fireDisconnect(){this.fireEvent(new CustomEvent(x.EVENT_DISCONNECT))}fireReconnect(){this.fireEvent(new CustomEvent(x.EVENT_RECONNECT))}fireDownsampleStart(e){this.fireEvent(new CustomEvent(x.EVENT_DOWNSAMPLESTARTED,{detail:e}))}fireDownsampleFinish(e){this.fireEvent(new CustomEvent(x.EVENT_DOWNSAMPLEFINISHED,{detail:e}))}fireDownsampleFail(e){this.fireEvent(new CustomEvent(x.EVENT_DOWNSAMPLEFAILED,{detail:e}))}fireDownsampleNeeded(e){this.fireEvent(new CustomEvent(x.EVENT_DOWNSAMPLENEEDED,{detail:e}))}fireLoadFinished(){this.fireEvent(new CustomEvent(x.EVENT_LOADFINISHED))}fireError(e){this.fireEvent(new CustomEvent(x.EVENT_ERROR,{detail:e}))}}q(x,"EVENT_UPDATED","ChartModel.EVENT_UPDATED");q(x,"EVENT_DISCONNECT","ChartModel.EVENT_DISCONNECT");q(x,"EVENT_RECONNECT","ChartModel.EVENT_RECONNECT");q(x,"EVENT_DOWNSAMPLESTARTED","ChartModel.EVENT_DOWNSAMPLESTARTED");q(x,"EVENT_DOWNSAMPLEFINISHED","ChartModel.EVENT_DOWNSAMPLEFINISHED");q(x,"EVENT_DOWNSAMPLEFAILED","ChartModel.EVENT_DOWNSAMPLEFAILED");q(x,"EVENT_DOWNSAMPLENEEDED","ChartModel.EVENT_DOWNSAMPLENEEDED");q(x,"EVENT_LOADFINISHED","ChartModel.EVENT_LOADFINISHED");q(x,"EVENT_ERROR","ChartModel.EVENT_ERROR");const U=x;function dt(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function me(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?dt(Object(t),!0).forEach(function(r){$(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):dt(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function $(n,e,t){return e=ni(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ni(n){var e=ii(n,"string");return typeof e=="symbol"?e:String(e)}function ii(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Se=G.module("ChartUtils"),ht="io.deephaven.time.DateTime",ai=36e5,si=1e6;function oi(n){return n.asDate!==void 0}function li(n){return n.asNumber!==void 0}function ft(n){return n.dhTimeZone!==void 0}function ui(n){return n!=null&&n.range!=null&&(n.autorange===!1||n.autorange===void 0)}class v{static getPlotlyErrorBars(e,t,r,i){var a=r.map((s,l)=>s-e[l]),o=t.map((s,l)=>e[l]-s);return{type:"data",symmetric:!1,array:a,arrayminus:o,color:i.error_band_line_color}}static convertNumberPrefix(e){return e.replace(/\u00A4\u00A4/g,"USD").replace(/\u00A4/g,"$")}static getPlotlyNumberFormat(e,t,r){if(!r)return null;var i=r.split(";"),a=i[0].match(/^([^#,0.]*)([#,]*)([0,]*)(\.?)(0*)(#*)(E?0*)(%?)(.*)/);Ee(a);var[,o,s,l,,u,c,d,h,g]=a,p=l.replace(",","").length,y=s.indexOf(",")>=0||l.indexOf(",")>=0,S=y?",":"",T=d!=null&&d!==""?"e":"f",w=h!==""?h:T,b=u.length+c.length,P="",M="0".concat(p).concat(S,".").concat(b).concat(P).concat(w),D=v.convertNumberPrefix(o),C=v.convertNumberPrefix(g);return{tickformat:M,tickprefix:D,ticksuffix:C,automargin:!0}}static addTickSpacing(e,t,r){var{gapBetweenMajorTicks:i}=t;if(i>0){var a=e||{},o=i;return r&&(o=i/si),t.log&&(o=Math.log(o)),a.tickmode="linear",a.dtick=o,a}return e}static getSourceForAxis(e,t){for(var r=0;r<e.series.length;r+=1)for(var i=e.series[r],a=0;a<i.sources.length;a+=1){var o=i.sources[a];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,r,i){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:v.ORIENTATION.VERTICAL;return{type:e,mode:t,name:r,orientation:a,showlegend:i??void 0}}static getMarkerSymbol(e){switch(e){case"SQUARE":return"square";case"CIRCLE":return"circle";case"DIAMOND":return"diamond";case"UP_TRIANGLE":return"triangle-up";case"DOWN_TRIANGLE":return"triangle-down";case"RIGHT_TRIANGLE":return"triangle-right";case"LEFT_TRIANGLE":return"triangle-left";case"ELLIPSE":case"HORIZONTAL_RECTANGLE":case"VERTICAL_RECTANGLE":default:throw new Error("Unrecognized shape ".concat(e))}}static getAllAxes(e){return e.charts.reduce((t,r)=>[...t,...r.axes],[])}static getChartForSeries(e,t){for(var{charts:r}=e,i=0;i<r.length;i+=1)for(var a=r[i],o=0;o<a.series.length;o+=1)if(t===a.series[o])return a;return null}static getLayoutRanges(e){for(var t={},r=Object.keys(e).filter(s=>s.indexOf("axis")>=0),i=0;i<r.length;i+=1){var a=r[i],o=e[a];ui(o)&&(t[a]=[...o.range])}return t}static getAxisLayoutProperty(e,t){var r=t>0?"".concat(t+1):"";return"".concat(e??"","axis").concat(r)}static periodToDecimal(e){var t=e.split(":");return Number(t[0])+Number(t[1])/60}static groupArray(e,t){return e.reduce((r,i)=>{var a,o=i[t],s=(a=r.get(o))!==null&&a!==void 0?a:[];return s.push(i),r.set(o,s),r},new Map)}static getColorwayFromTheme(e){var t=[];return e.colorway&&(Array.isArray(e.colorway)?t=e.colorway:typeof e.colorway=="string"?t=e.colorway.split(" "):Se.warn("Unable to handle colorway property: ".concat(e.colorway))),t}static titleFromSettings(e){var{series:t,xAxis:r,title:i="".concat((t??[]).join(", ")," by ").concat(r)}=e;return i}constructor(e){$(this,"dh",void 0),$(this,"daysOfWeek",void 0),this.dh=e,this.daysOfWeek=Object.freeze(e.calendar.DayOfWeek.values())}getAxisFormats(e,t){for(var r=this,i=new Map,a={tickformat:null,ticksuffix:null},o=v.getAllAxes(e),s=v.groupArray(o,"type"),{charts:l}=e,u=0;u<l.length;u+=1)for(var c=l[u],d=0;d<c.series.length;d+=1)for(var h=c.series[d],{sources:g}=h,p=g.filter(w=>w.axis),y=function(){var b=p[S],{axis:P}=b,{type:M}=P,D=s.get(M);Ee(D);var C=D.indexOf(P),R=r.getAxisPropertyName(M);if(R!=null){var j=v.getAxisLayoutProperty(R,C);if(i.has(j))Se.debug("".concat(j," already added."));else{Se.debug("Adding ".concat(j," to axisFormats."));var K=r.getPlotlyAxisFormat(b,t);if(K===null)i.set(j,a);else{i.set(j,K);var{businessCalendar:Y}=P;if(Y!=null){var z=[],{businessPeriods:re,businessDays:Q,holidays:ie,timeZone:de}=Y,ve=t==null?void 0:t.getColumnTypeFormatter(ht),Pe;ft(ve)&&(Pe=ve.dhTimeZone);var Ke=Pe?(de.standardOffset-Pe.standardOffset)/60:0;ie.length>0&&z.push(...r.createRangeBreakValuesFromHolidays(ie,de,Pe)),re.forEach(Fe=>z.push({pattern:"hour",bounds:[v.periodToDecimal(Fe.close)+Ke,v.periodToDecimal(Fe.open)+Ke]})),Q.length<r.daysOfWeek.length&&r.createBoundsFromDays(Q).forEach(Fe=>z.push({pattern:"day of week",bounds:Fe})),K.rangebreaks=z}if(i.size===c.axes.length)return{v:i}}}}},S=0;S<p.length;S+=1){var T=y();if(typeof T=="object")return T.v}return i}getPlotlyChartType(e,t){var{dh:r}=this;switch(e){case r.plot.SeriesPlotStyle.SCATTER:return t?"scatter":"scattergl";case r.plot.SeriesPlotStyle.LINE:return"scatter";case r.plot.SeriesPlotStyle.BAR:case r.plot.SeriesPlotStyle.STACKED_BAR:return"bar";case r.plot.SeriesPlotStyle.PIE:return"pie";case r.plot.SeriesPlotStyle.TREEMAP:return"treemap";case r.plot.SeriesPlotStyle.HISTOGRAM:return"histogram";case r.plot.SeriesPlotStyle.OHLC:return"ohlc";default:return}}getPlotlyChartMode(e,t,r){var{dh:i}=this,a=new Set;switch(e){case i.plot.SeriesPlotStyle.SCATTER:(t??!1)&&a.add(v.MODE_LINES),(r??!0)&&a.add(v.MODE_MARKERS);break;case i.plot.SeriesPlotStyle.LINE:(t??!0)&&a.add(v.MODE_LINES),(r??!1)&&a.add(v.MODE_MARKERS);break}return a.size>0?[...a].join("+"):void 0}getPlotlyProperty(e,t){var{dh:r}=this;switch(e){case r.plot.SeriesPlotStyle.PIE:switch(t){case r.plot.SourceType.X:return"labels";case r.plot.SourceType.Y:return"values"}break;case r.plot.SeriesPlotStyle.OHLC:switch(t){case r.plot.SourceType.TIME:return"x"}break;case r.plot.SeriesPlotStyle.TREEMAP:switch(t){case r.plot.SourceType.X:return"ids";case r.plot.SourceType.Y:return"values";case r.plot.SourceType.LABEL:return"labels";case r.plot.SourceType.PARENT:return"parents";case r.plot.SourceType.COLOR:return"marker.colors"}break}switch(t){case r.plot.SourceType.X:return"x";case r.plot.SourceType.Y:return"y";case r.plot.SourceType.Z:return"z";case r.plot.SourceType.X_LOW:return"xLow";case r.plot.SourceType.X_HIGH:return"xHigh";case r.plot.SourceType.Y_LOW:return"yLow";case r.plot.SourceType.Y_HIGH:return"yHigh";case r.plot.SourceType.TIME:return"time";case r.plot.SourceType.OPEN:return"open";case r.plot.SourceType.HIGH:return"high";case r.plot.SourceType.LOW:return"low";case r.plot.SourceType.CLOSE:return"close";case r.plot.SourceType.SHAPE:return"shape";case r.plot.SourceType.SIZE:return"size";case r.plot.SourceType.LABEL:return"label";case r.plot.SourceType.COLOR:return"color";case r.plot.SourceType.PARENT:return"parent";case r.plot.SourceType.HOVER_TEXT:return"hovertext";case r.plot.SourceType.TEXT:return"text";default:throw new Error("Unrecognized source type: ".concat(t))}}getPlotlySeriesOrientation(e){var t,r,{dh:i}=this,{sources:a}=e;return a.length===2&&((t=a[0])===null||t===void 0||(r=t.axis)===null||r===void 0?void 0:r.type)===i.plot.AxisType.Y?v.ORIENTATION.HORIZONTAL:v.ORIENTATION.VERTICAL}makeSeriesDataFromSeries(e,t,r,i){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:null,{name:o,isLinesVisible:s,isShapesVisible:l,plotStyle:u,lineColor:c,shapeColor:d,sources:h,shape:g,shapeSize:p}=e,y=h.some(P=>{var M;return(M=P.axis)===null||M===void 0?void 0:M.businessCalendar}),S=this.getChartType(u,y),T=this.getPlotlyChartMode(u,s??void 0,l??void 0),w=this.getPlotlySeriesOrientation(e),b=v.makeSeriesData(S,T,o,a,w);return this.addSourcesToSeriesData(b,u,h,t),this.addStylingToSeriesData(b,u,i,c,d,g,p,r),b}addSourcesToSeriesData(e,t,r,i){for(var a=e,o=0;o<r.length;o+=1){var s=r[o],{axis:l,type:u}=s,c=this.getPlotlyProperty(t,u);bt(a,c,[]);var d=l!=null?this.getAxisPropertyName(l.type):null;if(d!=null){var h=i.get(l.type);if(h){var g=h.indexOf(l),p=g>0?"".concat(g+1):"";a["".concat(d,"axis")]="".concat(d).concat(p)}}}}addStylingToSeriesData(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:null,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null,s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:null,l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:null,{dh:u}=this,c=e;if(c.marker={line:{}},c.line={width:1},t===u.plot.SeriesPlotStyle.AREA?c.fill="tozeroy":t===u.plot.SeriesPlotStyle.STACKED_AREA?c.stackgroup="stack":t===u.plot.SeriesPlotStyle.STEP?c.line.shape="hv":t===u.plot.SeriesPlotStyle.HISTOGRAM?(c.width=[],c.marker.line!==void 0&&Object.assign(c.marker.line,{color:r.paper_bgcolor,width:1})):t===u.plot.SeriesPlotStyle.OHLC?(c.increasing={line:{color:r.ohlc_increasing}},c.decreasing={line:{color:r.ohlc_decreasing}}):t===u.plot.SeriesPlotStyle.PIE?(c.textinfo="label+percent",c.outsidetextfont={color:r.title_color}):t===u.plot.SeriesPlotStyle.TREEMAP&&(c.hoverinfo="text",c.textinfo="label+text",c.tiling={packing:"squarify",pad:0},c.textposition="middle center",c.outsidetextfont={color:r.title_color}),i!=null&&(t===u.plot.SeriesPlotStyle.BAR?c.marker.color=i:c.line.color=i),a!=null&&(c.marker.color=a),o!=null&&o.length>0)try{c.marker.symbol=v.getMarkerSymbol(o)}catch(d){Se.warn("Unable to handle shape",o,":",d)}s!=null&&(c.marker.size=s*v.DEFAULT_MARKER_SIZE),l!=null&&t!==u.plot.SeriesPlotStyle.PIE&&(c.visible=l)}getChartType(e,t){var{dh:r}=this;switch(e){case r.plot.SeriesPlotStyle.HISTOGRAM:return"bar";default:return this.getPlotlyChartType(e,t)}}getAxisPropertyName(e){var{dh:t}=this;switch(e){case t.plot.AxisType.X:return"x";case t.plot.AxisType.Y:return"y";default:return null}}getAxisSide(e){var{dh:t}=this;switch(e){case t.plot.AxisPosition.BOTTOM:return"bottom";case t.plot.AxisPosition.TOP:return"top";case t.plot.AxisPosition.LEFT:return"left";case t.plot.AxisPosition.RIGHT:return"right";default:return}}updateFigureAxes(e,t,r,i){for(var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0,s=e,l=v.getAllAxes(t),u=0;u<t.charts.length;u+=1){var c=t.charts[u],d=i==null?void 0:i(c),h=this.getChartBounds(t,c,a,o);this.updateLayoutAxes(s,c.axes,l,r,a,o,h,d)}this.removeStaleAxes(s,l)}getChartBounds(e,t,r,i){var a,{dh:o}=this,{cols:s,rows:l}=e,{column:u,colspan:c,row:d,rowspan:h}=t,g=u+c,p=d+h,y=1/s,S=1/l,T=v.AXIS_SIZE_PX/r,w=v.AXIS_SIZE_PX/i,b={bottom:(l-p)*S+(p<l?w/2:0),top:(l-d)*S-(d>0?w/2:0),left:u*y+(u>0?T/2:0),right:g*y-(g<s?T/2:0)},P=v.groupArray(t.axes,"position"),M=(a=P.get(o.plot.AxisPosition.RIGHT))!==null&&a!==void 0?a:[];return M.length>0&&(r>0?b.right-=(b.right-b.left)*Math.max(0,Math.min(v.LEGEND_WIDTH_PX/r,v.MAX_LEGEND_SIZE)):b.right-=(b.right-b.left)*v.DEFAULT_AXIS_SIZE),b}getPlotlyDateFormat(e,t,r){var{dh:i}=this,a=r==null?void 0:r.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",""),o,s=e==null?void 0:e.getColumnTypeFormatter(t);return s!=null&&ft(s)&&s.dhTimeZone!=null&&s.showTimeZone&&(o=i.i18n.DateTimeFormat.format(" z",new Date,s.dhTimeZone)),{tickformat:a,ticksuffix:o,automargin:!0}}getPlotlyAxisFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,{dh:r}=this,{axis:i,columnType:a}=e,{formatPattern:o}=i,s=null;return f.isDateType(a)?(s=this.getPlotlyDateFormat(t,a,o),s=v.addTickSpacing(s,i,!0)):f.isNumberType(a)&&(s=v.getPlotlyNumberFormat(t,a,o),s=v.addTickSpacing(s,i,!1)),i.formatType===r.plot.AxisFormatType.CATEGORY&&(s?s.type="category":s={type:"category",tickformat:void 0,ticksuffix:void 0}),s}updateLayoutAxes(e,t,r,i){for(var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0,s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:{left:0,top:0,right:1,bottom:1},l=arguments.length>7?arguments[7]:void 0,{dh:u}=this,c=a>0?Math.max(v.MIN_AXIS_SIZE,Math.min(v.AXIS_SIZE_PX/o,v.MAX_AXIS_SIZE)):v.DEFAULT_AXIS_SIZE,d=o>0?Math.max(v.MIN_AXIS_SIZE,Math.min(v.AXIS_SIZE_PX/a,v.MAX_AXIS_SIZE)):v.DEFAULT_AXIS_SIZE,h=e,g=v.groupArray(t,"position"),p=v.groupArray(t,"type"),y=[...p.keys()],S=v.groupArray(r,"type"),T=0;T<y.length;T+=1){var w=y[T],b=this.getAxisPropertyName(w);if(b!=null){var P=p.get(w),M=S.get(w),D=w===u.plot.AxisType.Y,C=D?o:a;Ee(P),Ee(M);for(var R=0;R<P.length;R+=1){var j=P[R],K=M.indexOf(j),Y=v.getAxisLayoutProperty(b,K);h[Y]==null&&(h[Y]=this.makeLayoutAxis(w,i));var z=h[Y];if(z!=null){this.updateLayoutAxis(z,j,R,g,c,d,s);var{range:re,autorange:Q}=z;if(l!=null&&re!==void 0&&(Q===void 0||Q===!1)){var ie=l(j),[de,ve]=ie(re);Se.debug("Setting downsample range",C,de,ve),j.range(C,de,ve)}else j.range(C)}}}}}removeStaleAxes(e,t){for(var r=e,i=v.groupArray(t,"type"),a=[...i.keys()],o=0;o<a.length;o+=1){var s=a[o],l=i.get(s);Ee(l);var u=l.length,c=this.getAxisPropertyName(s);if(c!=null)for(var d=v.getAxisLayoutProperty(c,u);r[d]!=null;)delete r[d],u+=1,d=v.getAxisLayoutProperty(c,u)}}updateLayoutAxis(e,t,r,i,a,o,s){var l,{dh:u}=this,c=t.type===u.plot.AxisType.Y,d=c?o:a,h=e,g=(l=t.label)!==null&&l!==void 0?l:"";if(h.title!==void 0&&typeof h.title!="string"?h.title.text=g:h.title={text:g},t.log&&(h.type="log"),h.side=this.getAxisSide(t.position),r>0){var p,y;h.overlaying=(p=this.getAxisPropertyName(t.type))!==null&&p!==void 0?p:void 0;var S=(y=i.get(t.position))!==null&&y!==void 0?y:[],T=S.indexOf(t);T>0&&(h.anchor="free",t.position===u.plot.AxisPosition.RIGHT?h.position=s.right+(T-S.length+1)*d:t.position===u.plot.AxisPosition.TOP?h.position=s.top+(T-S.length+1)*d:t.position===u.plot.AxisPosition.BOTTOM?h.position=s.bottom+(S.length-T+1)*d:t.position===u.plot.AxisPosition.LEFT&&(h.position=s.left+(S.length-T+1)*d))}else if(t.type===u.plot.AxisType.X){var w=i.get(u.plot.AxisPosition.LEFT)||[],b=i.get(u.plot.AxisPosition.RIGHT)||[],P=Math.max(s.left,s.left+(w.length-1)*o),M=Math.min(s.right-(b.length-1)*o,s.right);h.domain=[P,M]}else if(t.type===u.plot.AxisType.Y){var D=i.get(u.plot.AxisPosition.BOTTOM)||[],C=i.get(u.plot.AxisPosition.TOP)||[],R=Math.max(s.bottom,s.bottom+(D.length-1)*a),j=Math.min(s.top-(C.length-1)*a,s.top);h.domain=[R,j]}}createBoundsFromDays(e){var t=e.map(o=>this.daysOfWeek.indexOf(o)),r=this.daysOfWeek.filter(o=>!e.includes(o)).map(o=>this.daysOfWeek.indexOf(o)),i=new Set;r.forEach(o=>{for(var s=o+1;s<o+this.daysOfWeek.length;s+=1){var l=s%this.daysOfWeek.length;if(t.includes(l)){i.add(l);break}}});var a=[];return i.forEach(o=>{for(var s=o-1;s>o-this.daysOfWeek.length;s-=1){var l=s<0?s+this.daysOfWeek.length:s;if(t.includes(l)){var u=(l+1)%7;a.push([u,o]);break}}}),a}createRangeBreakValuesFromHolidays(e,t,r){var i=[],a=[];return e.forEach(o=>{o.businessPeriods.length>0?a.push(...this.createPartialHoliday(o,t,r)):i.push(this.createFullHoliday(o,t,r))}),[{values:i},...a]}createFullHoliday(e,t,r){return this.adjustDateForTimeZone("".concat(e.date.toString()," 00:00:00.000000"),t,r)}createPartialHoliday(e,t,r){var i=e.date.toString(),a=["00:00"];e.businessPeriods.forEach(h=>{a.push(h.open),a.push(h.close)}),a.push("24:00");for(var o=[],s=0;s<a.length;s+=2){var l=a[s],u=a[s+1];if(l!==u){var c=[this.adjustDateForTimeZone("".concat(i," ").concat(l,":00.000000"),t,r)],d=ai*(v.periodToDecimal(u)-v.periodToDecimal(l));o.push({values:c,dvalue:d})}}return o}adjustDateForTimeZone(e,t,r){return r&&r.standardOffset!==t.standardOffset?this.unwrapValue(this.wrapValue(e,ht,t),r):e}makeFigureSettings(e,t){var{dh:r}=this,{series:i,xAxis:a,type:o}=e,s=v.titleFromSettings(e),l={formatType:"".concat(r.plot.AxisFormatType.NUMBER),type:"".concat(r.plot.AxisType.X),position:"".concat(r.plot.AxisPosition.BOTTOM)},u={formatType:"".concat(r.plot.AxisFormatType.NUMBER),type:"".concat(r.plot.AxisType.Y),position:"".concat(r.plot.AxisPosition.LEFT)};return{charts:[{chartType:"".concat(r.plot.ChartType.XY),axes:[l,u],series:(i??[]).map(c=>({plotStyle:"".concat(o),name:c,dataSources:[{type:"".concat(r.plot.SourceType.X),columnName:a??"",axis:l,table:t},{type:"".concat(r.plot.SourceType.Y),columnName:c,axis:u,table:t}]}))}],title:s}}unwrapValue(e,t){var{dh:r}=this;if(e!=null){if(oi(e))return r.i18n.DateTimeFormat.format(v.DATE_FORMAT,e,t);if(li(e))return e.asNumber()}return e}wrapValue(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,{dh:i}=this;if(f.isDateType(t)&&typeof e=="string"){var a=e,o=v.DATE_FORMAT.substr(0,e.length),s=i.i18n.DateTimeFormat.parse(o,a);if(!r)return s;var l="".concat(o," Z"),u=i.i18n.DateTimeFormat.format("Z",s,r),c=i.i18n.DateTimeFormat.parse(l,"".concat(a," ").concat(u)),d=i.i18n.DateTimeFormat.format("Z",c,r);return i.i18n.DateTimeFormat.parse(l,"".concat(a," ").concat(d))}return e}makeLayoutAxis(e,t){var{dh:r}=this,i={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===r.plot.AxisType.X?Object.assign(i,{showgrid:!0}):e===r.plot.AxisType.Y&&Object.assign(i,{zerolinecolor:t.zerolinecolor,zerolinewidth:2}),i}makeDefaultLayout(e){var{dh:t}=this,r=me(me({},e),{},{autosize:!0,colorway:v.getColorwayFromTheme(e),font:{family:"'Fira Sans', sans-serif",color:e.title_color},title:{font:{color:e.title_color},yanchor:"top",pad:me({},v.DEFAULT_TITLE_PADDING),y:1},legend:{font:{color:e.title_color}},margin:me({},v.DEFAULT_MARGIN),xaxis:this.makeLayoutAxis(t.plot.AxisType.X,e),yaxis:this.makeLayoutAxis(t.plot.AxisType.Y,e),polar:{angularaxis:this.makeLayoutAxis(t.plot.AxisType.SHAPE,e),radialaxis:this.makeLayoutAxis(t.plot.AxisType.SHAPE,e),bgcolor:e.plot_bgcolor},scene:{xaxis:this.makeLayoutAxis(t.plot.AxisType.X,e),yaxis:this.makeLayoutAxis(t.plot.AxisType.Y,e),zaxis:this.makeLayoutAxis(t.plot.AxisType.Z,e)}});return r.datarevision=0,r}hydrateSettings(e){var{dh:t}=this;return me(me({},e),{},{type:e.type!=null?t.plot.SeriesPlotStyle[e.type]:void 0})}}$(v,"DEFAULT_AXIS_SIZE",.15);$(v,"MIN_AXIS_SIZE",.025);$(v,"MAX_AXIS_SIZE",.2);$(v,"AXIS_SIZE_PX",75);$(v,"LEGEND_WIDTH_PX",50);$(v,"MAX_LEGEND_SIZE",.25);$(v,"ORIENTATION",Object.freeze({HORIZONTAL:"h",VERTICAL:"v"}));$(v,"DATE_FORMAT","yyyy-MM-dd HH:mm:ss.SSSSSS");$(v,"DEFAULT_MARGIN",Object.freeze({l:60,r:50,t:30,b:60,pad:0}));$(v,"DEFAULT_TITLE_PADDING",Object.freeze({t:8}));$(v,"SUBTITLE_LINE_HEIGHT",25);$(v,"DEFAULT_MARKER_SIZE",6);$(v,"MODE_MARKERS","markers");$(v,"MODE_LINES","lines");const B=v;function ci(n,e,t){return e=di(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function di(n){var e=hi(n,"string");return typeof e=="symbol"?e:String(e)}function hi(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class fi extends Error{constructor(){super(...arguments),ci(this,"isDownsamplingError",!0)}}const mi=fi;function mt(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function pt(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?mt(Object(t),!0).forEach(function(r){H(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):mt(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function H(n,e,t){return e=pi(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function pi(n){var e=vi(n,"string");return typeof e=="symbol"?e:String(e)}function vi(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ae=G.module("Chart");class ce extends N.Component{static convertIcon(e){var[t,,,,r]=e.icon,i="".concat(r);return{width:t,path:i,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"}constructor(e){var t;super(e),H(this,"currentSeries",void 0),H(this,"PlotComponent",void 0),H(this,"plot",void 0),H(this,"plotWrapper",void 0),H(this,"columnFormats",void 0),H(this,"dateTimeFormatterOptions",void 0),H(this,"decimalFormatOptions",void 0),H(this,"integerFormatOptions",void 0),H(this,"rect",void 0),H(this,"ranges",void 0),H(this,"isSubscribed",void 0),H(this,"isLoadedFired",void 0),H(this,"resizeObserver",void 0),H(this,"getCachedConfig",kt((r,i,a,o,s,l)=>{var u=[],c=!!r;c&&u.push({name:"Downsampling failed: ".concat(r),title:"Downsampling failed",click:()=>{this.toggleErrorMessage("".concat(r))},icon:ce.convertIcon(Ge),attr:"fill-warning"});var d=!!l;if(d&&u.push({name:"Error: ".concat(l),title:"Error",click:()=>{this.toggleErrorMessage("".concat(l))},icon:ce.convertIcon(Ge),attr:"fill-warning"}),i||a||o||c){var h=ce.downsampleButtonTitle(a,o),g=ce.downsampleButtonAttr(a,o),p=a?Qt:Ut;u.push({name:h,title:"Downsampling status",icon:ce.convertIcon(p),click:this.handleDownsampleClick,attr:g})}var y=s.some(b=>{var{type:P}=b;return P!=null&&!P.includes("3d")}),S=s.some(b=>{var{type:P}=b;return P!=null&&P.includes("3d")}),T=["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"],w=["orbitRotation","tableRotation","resetCameraDefault3d"];return{displaylogo:!1,displayModeBar:a||c||d?!0:"hover",modeBarButtons:[u,["toImage"],["zoom2d","pan2d"],[...y?T:[],...S?w:[]]]}})),this.handleAfterPlot=this.handleAfterPlot.bind(this),this.handleDownsampleClick=this.handleDownsampleClick.bind(this),this.handleErrorClose=this.handleErrorClose.bind(this),this.handleModelEvent=this.handleModelEvent.bind(this),this.handlePlotUpdate=this.handlePlotUpdate.bind(this),this.handleRelayout=this.handleRelayout.bind(this),this.handleResize=this.handleResize.bind(this),this.handleRestyle=this.handleRestyle.bind(this),this.PlotComponent=ei(e.Plotly),this.plot=_.createRef(),this.plotWrapper=(t=e.containerRef)!==null&&t!==void 0?t:_.createRef(),this.columnFormats=[],this.dateTimeFormatterOptions={},this.decimalFormatOptions={},this.integerFormatOptions={},this.isSubscribed=!1,this.isLoadedFired=!1,this.currentSeries=0,this.resizeObserver=new window.ResizeObserver(this.handleResize),this.state={data:null,downsamplingError:null,isDownsampleFinished:!1,isDownsampleInProgress:!1,isDownsamplingDisabled:!1,error:null,shownError:null,layout:{datarevision:0},revision:0}}componentDidMount(){this.updateDimensions(),this.updateModelDimensions(),this.initData(),this.initFormatter();var{isActive:e,model:t}=this.props;e&&this.subscribe(t),this.plotWrapper.current!=null&&this.resizeObserver.observe(this.plotWrapper.current)}componentDidUpdate(e){var{isActive:t,model:r,settings:i}=this.props;this.updateFormatterSettings(i),r!==e.model&&(this.unsubscribe(e.model),this.subscribe(r)),t!==e.isActive&&(t?(this.updateDimensions(),this.subscribe(r)):this.unsubscribe(r))}componentWillUnmount(){var{model:e}=this.props;this.unsubscribe(e),this.resizeObserver.disconnect()}getPlotRect(){var e,t;return(e=(t=this.plotWrapper.current)===null||t===void 0?void 0:t.getBoundingClientRect())!==null&&e!==void 0?e:null}initData(){var{model:e}=this.props,{layout:t}=this.state;this.setState({data:e.getData(),layout:pt(pt({},t),e.getLayout())})}subscribe(e){if(!this.isSubscribed){if(!this.rect||this.rect.width===0||this.rect.height===0){ae.debug2("Delaying subscription until model dimensions are set");return}e.subscribe(this.handleModelEvent),this.isSubscribed=!0}}unsubscribe(e){this.isSubscribed&&(e.unsubscribe(this.handleModelEvent),this.isSubscribed=!1)}handleAfterPlot(){this.plot.current!=null}handleDownsampleClick(){this.setState(e=>{var{isDownsamplingDisabled:t}=e;return{downsamplingError:null,isDownsampleInProgress:!1,isDownsampleFinished:!1,isDownsamplingDisabled:!t}},()=>{var{model:e}=this.props,{isDownsamplingDisabled:t}=this.state;e.setDownsamplingDisabled(t)})}handleErrorClose(){this.setState({shownError:null})}handleModelEvent(e){var{type:t,detail:r}=e;switch(ae.debug2("Received data update",t,r),t){case U.EVENT_UPDATED:{this.currentSeries+=1,this.setState(g=>{var{layout:p,revision:y}=g;return typeof p.datarevision=="number"&&(p.datarevision+=1),{data:r,layout:p,revision:y+1}});var{onUpdate:i}=this.props;i({isLoading:!this.isLoadedFired});break}case U.EVENT_LOADFINISHED:{var{onUpdate:a}=this.props;this.isLoadedFired=!0,a({isLoading:!1});break}case U.EVENT_DISCONNECT:{var{onDisconnect:o}=this.props;o();break}case U.EVENT_RECONNECT:{var{onReconnect:s}=this.props;s();break}case U.EVENT_DOWNSAMPLESTARTED:{this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!0,downsamplingError:null});break}case U.EVENT_DOWNSAMPLEFINISHED:{this.setState({isDownsampleFinished:!0,isDownsampleInProgress:!1,downsamplingError:null});break}case U.EVENT_DOWNSAMPLENEEDED:case U.EVENT_DOWNSAMPLEFAILED:{var l,u=(l=r.message)!==null&&l!==void 0?l:r;this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!1,isDownsamplingDisabled:!1,downsamplingError:u});var{onError:c}=this.props;c(new mi(u));break}case U.EVENT_ERROR:{var d="".concat(r);this.setState({error:d});var{onError:h}=this.props;h(new Error(d));break}default:ae.debug("Unknown event type",t,e)}}handlePlotUpdate(e){var{layout:t}=e,r=B.getLayoutRanges(t),i=!ge(r,this.ranges);i&&(this.ranges=r,this.updateModelDimensions(!0))}handleRelayout(e){if(ae.debug("handleRelayout",e),e.hiddenlabels!=null){var{onSettingsChanged:t}=this.props,r=[...e.hiddenlabels];t({hiddenSeries:r})}this.updateModelDimensions()}handleResize(){this.updateDimensions()}handleRestyle(e){var[t,r]=e;if(ae.debug("handleRestyle",t,r),Object.keys(t).includes("visible")){var{data:i}=this.state,{onSettingsChanged:a}=this.props;if(i!=null){var o=i.reduce((s,l)=>{var{name:u,visible:c}=l;return u!=null&&c==="legendonly"?[...s,u]:s},[]);a({hiddenSeries:o})}}}toggleErrorMessage(e){this.setState(t=>{var{shownError:r}=t;return{shownError:r===e?null:e}})}updateModelDimensions(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.getPlotRect();if(!t){ae.warn("Unable to get plotting rect");return}var r=!this.rect||this.rect.width!==t.width||this.rect.height!==t.height;if(r||e){this.rect=t;var{isActive:i,model:a}=this.props;a.setDimensions(t),i&&this.subscribe(a)}}initFormatter(){var{settings:e}=this.props;this.updateFormatterSettings(e)}updateFormatterSettings(e){var t=Le.getColumnFormats(e),r=Le.getDateTimeFormatterOptions(e),{decimalFormatOptions:i={},integerFormatOptions:a={}}=e;(!ge(this.columnFormats,t)||!ge(this.dateTimeFormatterOptions,r)||!ge(this.decimalFormatOptions,i)||!ge(this.integerFormatOptions,a))&&(this.columnFormats=Le.getColumnFormats(e),this.dateTimeFormatterOptions=r,this.decimalFormatOptions=i,this.integerFormatOptions=a,this.updateFormatter())}updateFormatter(){var{model:e}=this.props,t=new Be(e.dh,this.columnFormats,this.dateTimeFormatterOptions,this.decimalFormatOptions,this.integerFormatOptions);e.setFormatter(t)}updateDimensions(){var e=this.getPlotRect(),{Plotly:t}=this.props;this.plot.current!=null&&e!=null&&e.width>0&&e.height>0&&t.relayout(this.plot.current.el,{autosize:!0}).catch(r=>{ae.debug("Unable to resize, promise rejected",r)})}render(){var{PlotComponent:e}=this,{data:t,downsamplingError:r,isDownsampleFinished:i,isDownsampleInProgress:a,isDownsamplingDisabled:o,error:s,shownError:l,layout:u,revision:c}=this.state,d=this.getCachedConfig(r,i,a,o,t??[],s),h=t!=null;return E.jsxs("div",{className:"h-100 w-100 chart-wrapper",ref:this.plotWrapper,children:[h&&E.jsx(e,{ref:this.plot,data:t,layout:u,revision:c,config:d,onAfterPlot:this.handleAfterPlot,onError:ae.error,onRelayout:this.handleRelayout,onUpdate:this.handlePlotUpdate,onRestyle:this.handleRestyle,useResizeHandler:!0,style:{height:"100%",width:"100%"}}),E.jsx(Ft,{className:"chart-error-popper",options:{placement:"top"},isShown:l!=null,onExited:this.handleErrorClose,closeOnBlur:!0,interactive:!0,children:l!=null&&E.jsxs(E.Fragment,{children:[E.jsx("div",{className:"chart-error",children:l}),E.jsx(tn,{tooltip:"Copy Error",copy:l,children:"Copy Error"})]})})]})}}H(ce,"defaultProps",{isActive:!0,settings:{timeZone:"America/New_York",defaultDateTimeFormat:k.FULL_DATE_FORMAT,showTimeZone:!1,showTSeparator:!0,formatter:[]},Plotly:wt,onDisconnect:()=>{},onReconnect:()=>{},onUpdate:()=>{},onError:()=>{},onSettingsChanged:()=>{}});const Gi=ce;function vt(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function gt(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?vt(Object(t),!0).forEach(function(r){O(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):vt(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function O(n,e,t){return e=gi(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function gi(n){var e=yi(n,"string");return typeof e=="symbol"?e:String(e)}function yi(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var V=G.module("FigureChartModel");class Ce extends U{constructor(e,t,r){var i,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(e),i=this,O(this,"chartUtils",void 0),O(this,"dh",void 0),O(this,"figure",void 0),O(this,"settings",void 0),O(this,"theme",void 0),O(this,"data",void 0),O(this,"layout",void 0),O(this,"seriesDataMap",void 0),O(this,"pendingSeries",void 0),O(this,"oneClicks",void 0),O(this,"filterColumnMap",void 0),O(this,"lastFilter",void 0),O(this,"isConnected",void 0),O(this,"seriesToProcess",void 0),O(this,"addPendingSeries",_t(()=>{for(var s=B.getAllAxes(this.figure),{pendingSeries:l}=this,u=function(){var h,g=l[c],p=i.figure.charts.find(y=>y.series.includes(g));i.addSeries(g,s,(h=p==null?void 0:p.showLegend)!==null&&h!==void 0?h:null),g.subscribe()},c=0;c<l.length;c+=1)u();this.pendingSeries=[]},Ce.ADD_SERIES_DEBOUNCE)),O(this,"getTimeZone",ye((s,l)=>{if(l!=null){var u=l.getColumnTypeFormatter(s);if(u!=null)return u.dhTimeZone}})),O(this,"getValueTranslator",ye((s,l)=>{var u=this.getTimeZone(s,l);return c=>this.chartUtils.unwrapValue(c,u)})),O(this,"getValueParser",ye((s,l)=>{var u=this.getTimeZone(s,l);return c=>this.chartUtils.wrapValue(c,s,u)})),O(this,"getRangeParser",ye((s,l)=>u=>{var[c,d]=u,h=this.getValueParser(s,l);return c=h(c),d=h(d),[c,d]})),O(this,"getAxisRangeParser",ye((s,l)=>u=>{var c=B.getSourceForAxis(s,u);return c!=null?this.getRangeParser(c.columnType,l):d=>d})),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.dh=e,this.chartUtils=new B(e),this.figure=t,this.settings=a,this.theme=r,this.data=[];var o={data:{},layout:this.chartUtils.makeDefaultLayout(r)};this.layout={grid:{rows:t.rows,columns:t.cols,pattern:"independent"},template:o},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(){if(this.figure.charts.length>0){var e=this.figure.charts[0];return e.title}return""}initAllSeries(){this.oneClicks=[],this.filterColumnMap.clear();for(var{charts:e}=this.figure,t=B.getAllAxes(this.figure),r=[],i=0;i<e.length;i+=1)for(var a=e[i],o=0;o<a.series.length;o+=1){var s=a.series[o];r.push(s.name),this.addSeries(s,t,a.showLegend)}for(var l=[...this.seriesDataMap.keys()],u=l.filter(h=>r.indexOf(h)<0),c=0;c<u.length;c+=1){var d=u[c];this.seriesDataMap.delete(d)}this.seriesToProcess=new Set([...this.seriesDataMap.keys()])}addSeries(e,t,r){var{dh:i}=this,a=B.groupArray(t,"type"),o=this.chartUtils.makeSeriesDataFromSeries(e,a,B.getSeriesVisibility(e.name,this.settings),this.theme,r);if(this.seriesDataMap.set(e.name,o),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=B.getHiddenLabels(this.settings)),this.layout.showlegend=this.data.length>1||e.plotStyle===i.plot.SeriesPlotStyle.PIE?r??void 0:!1,e.oneClick!=null){for(var{oneClick:s}=e,{columns:l}=s,u=0;u<l.length;u+=1)this.filterColumnMap.set(l[u].name,l[u]);this.oneClicks.push(s)}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){V.debug("Ignoring subscribe when figure in disconnected state");return}this.figure.subscribe(this.isDownsamplingDisabled?this.dh.plot.DownsampleOptions.DISABLE:this.dh.plot.DownsampleOptions.DEFAULT),this.figure.errors.length>0&&(V.error("Errors in figure",this.figure.errors),this.fireError(this.figure.errors))}unsubscribeFigure(){this.figure.unsubscribe()}startListeningFigure(){var{dh:e}=this;this.figure.addEventListener(e.plot.Figure.EVENT_UPDATED,this.handleFigureUpdated),this.figure.addEventListener(e.plot.Figure.EVENT_SERIES_ADDED,this.handleFigureSeriesAdded),this.figure.addEventListener(e.plot.Figure.EVENT_DISCONNECT,this.handleFigureDisconnected),this.figure.addEventListener(e.plot.Figure.EVENT_RECONNECT,this.handleFigureReconnected),this.figure.addEventListener(e.plot.Figure.EVENT_DOWNSAMPLESTARTED,this.handleDownsampleStart),this.figure.addEventListener(e.plot.Figure.EVENT_DOWNSAMPLEFINISHED,this.handleDownsampleFinish),this.figure.addEventListener(e.plot.Figure.EVENT_DOWNSAMPLEFAILED,this.handleDownsampleFail),this.figure.addEventListener(e.plot.Figure.EVENT_DOWNSAMPLENEEDED,this.handleDownsampleNeeded),this.figure.addEventListener(e.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed)}stopListeningFigure(){var{dh:e}=this;this.figure.removeEventListener(e.plot.Figure.EVENT_UPDATED,this.handleFigureUpdated),this.figure.removeEventListener(e.plot.Figure.EVENT_SERIES_ADDED,this.handleFigureSeriesAdded),this.figure.removeEventListener(e.plot.Figure.EVENT_DISCONNECT,this.handleFigureDisconnected),this.figure.removeEventListener(e.plot.Figure.EVENT_RECONNECT,this.handleFigureReconnected),this.figure.removeEventListener(e.plot.Figure.EVENT_DOWNSAMPLESTARTED,this.handleDownsampleStart),this.figure.removeEventListener(e.plot.Figure.EVENT_DOWNSAMPLEFINISHED,this.handleDownsampleFinish),this.figure.removeEventListener(e.plot.Figure.EVENT_DOWNSAMPLEFAILED,this.handleDownsampleFail),this.figure.removeEventListener(e.plot.Figure.EVENT_DOWNSAMPLENEEDED,this.handleDownsampleNeeded),this.figure.removeEventListener(e.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed)}handleDownsampleStart(e){V.debug("Downsample started",e),this.fireDownsampleStart(e.detail)}handleDownsampleFinish(e){V.debug("Downsample finished",e),this.fireDownsampleFinish(e.detail)}handleDownsampleFail(e){V.error("Downsample failed",e),this.fireDownsampleFail(e.detail)}handleDownsampleNeeded(e){V.info("Downsample needed",e),this.fireDownsampleNeeded(e.detail)}handleFigureUpdated(e){var{detail:t}=e,{series:r}=t;V.debug2("handleFigureUpdated",r);for(var i=0;i<r.length;i+=1){var a=r[i];V.debug2("handleFigureUpdated updating series",a.name);for(var{sources:o}=a,s=0;s<o.length;s+=1){var l=o[s],{columnType:u,type:c}=l,d=this.getValueTranslator(u,this.formatter),h=t.getArray(a,c,d);this.setDataArrayForSeries(a,c,h)}this.seriesToProcess.delete(a.name),this.cleanSeries(a)}this.seriesToProcess.size===0&&this.fireLoadFinished();var{data:g}=this;this.fireUpdate(g)}handleRequestFailed(e){V.error("Request failed",e),this.fireError(["".concat(e.detail)])}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){V.debug("Figure disconnected",e),this.isConnected=!1,this.listeners.length>0&&this.unsubscribeFigure(),this.fireDisconnect()}handleFigureReconnected(e){V.debug("Figure reconnected",e),this.isConnected=!0,this.initAllSeries(),this.fireReconnect(),this.listeners.length>0&&this.subscribeFigure()}handleFigureSeriesAdded(e){var{detail:t}=e;V.debug("handleFigureSeriesAdded",t),this.pendingSeries.push(t),this.addPendingSeries()}setDimensions(e){super.setDimensions(e),this.updateAxisPositions()}setTitle(e){var t,r;super.setTitle(e);var i=(t=(r=(e??"").match(/<br>/g))===null||r===void 0?void 0:r.length)!==null&&t!==void 0?t:0,a=B.DEFAULT_MARGIN.t+i*B.SUBTITLE_LINE_HEIGHT;this.layout.margin?this.layout.margin.t=a:this.layout.margin={t:a},typeof this.layout.title=="string"?this.layout.title=e:(this.layout.title=gt({},this.layout.title),this.layout.title.text=e,this.layout.title.pad=gt({},this.layout.title.pad),this.layout.title.pad.t=B.DEFAULT_TITLE_PADDING.t+i*B.SUBTITLE_LINE_HEIGHT*.5)}getPlotWidth(){var e,t,r,i;return!this.rect||!this.rect.width?0:Math.max(this.rect.width-((e=(t=this.layout.margin)===null||t===void 0?void 0:t.l)!==null&&e!==void 0?e:0)-((r=(i=this.layout.margin)===null||i===void 0?void 0:i.r)!==null&&r!==void 0?r:0),0)}getPlotHeight(){var e,t,r,i;return!this.rect||!this.rect.height?0:Math.max(this.rect.height-((e=(t=this.layout.margin)===null||t===void 0?void 0:t.t)!==null&&e!==void 0?e:0)-((r=(i=this.layout.margin)===null||i===void 0?void 0:i.b)!==null&&r!==void 0?r:0),0)}updateAxisPositions(){var e=this.getPlotWidth(),t=this.getPlotHeight();this.chartUtils.updateFigureAxes(this.layout,this.figure,this.theme,r=>this.getAxisRangeParser(r,this.formatter),e,t)}updateLayoutFormats(){if(this.formatter){var e=this.chartUtils.getAxisFormats(this.figure,this.formatter);e.forEach((t,r)=>{V.debug("Assigning ".concat(r),this.layout[r],t);var i=this.layout[r];i!=null?Object.assign(i,t):V.debug("Ignoring null layout.".concat(r))})}}setDataArrayForSeries(e,t,r){var{name:i,plotStyle:a}=e,o=this.seriesDataMap.get(i),s=this.chartUtils.getPlotlyProperty(a,t);o&&bt(o,s,r)}cleanSeries(e){var{dh:t}=this,{name:r,plotStyle:i}=e,a=this.seriesDataMap.get(r);if(a!=null){if(i===t.plot.SeriesPlotStyle.HISTOGRAM){var{xLow:o,xHigh:s}=a;if(o&&s&&o.length===s.length){for(var l=[],u=0;u<o.length;u+=1)l.push(s[u]-o[u]);a.width=l}}else if(i===t.plot.SeriesPlotStyle.LINE||i===t.plot.SeriesPlotStyle.ERROR_BAR||i===t.plot.SeriesPlotStyle.BAR){var{x:c,xLow:d,xHigh:h,y:g,yLow:p,yHigh:y}=a;d&&h&&d!==c&&(a.error_x=B.getPlotlyErrorBars(c,d,h,this.theme)),p&&y&&p!==g&&(a.error_y=B.getPlotlyErrorBars(g,p,y,this.theme))}else if(i===t.plot.SeriesPlotStyle.TREEMAP){var{ids:S,labels:T}=a;S!==void 0&&T===void 0&&(a.labels=S)}}}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){var t=this;if(this.oneClicks.length===0){V.warn("Trying to set a filter, but no one click!");return}V.debug("setFilter",e);for(var r=function(){var o=t.oneClicks[i],{columns:s}=o,l=new Set([...e.keys(),...t.lastFilter.keys()]);l.forEach(u=>{var c=e.get(u);t.lastFilter.get(u)!==c&&s.find(d=>d.name===u)!=null&&o.setValueForColumn(u,c)})},i=0;i<this.oneClicks.length;i+=1)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}}O(Ce,"ADD_SERIES_DEBOUNCE",50);const yt=Ce;function Et(n,e,t,r,i,a,o){try{var s=n[a](o),l=s.value}catch(u){t(u);return}s.done?e(l):Promise.resolve(l).then(r,i)}function Re(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){Et(a,r,i,o,s,"next",l)}function s(l){Et(a,r,i,o,s,"throw",l)}o(void 0)})}}class qe{static makeModelFromSettings(e,t,r,i){return Re(function*(){var a=yield qe.makeFigureFromSettings(e,t,r);return new yt(e,a,i,t)})()}static makeFigureFromSettings(e,t,r){return Re(function*(){var i=yield r.copy();return i.applyCustomColumns(r.customColumns),i.applyFilter(r.filter),i.applySort(r.sort),e.plot.Figure.create(new B(e).makeFigureSettings(t,i))})()}static makeModel(e,t,r,i){return Re(function*(){return new yt(e,r,i,t)})()}}const Yi=qe,Ei="var(--dh-color-chart-colorway)",Si="var(--dh-color-chart-grid)",Ti="var(--dh-color-chart-axis-line)",bi="var(--dh-color-chart-axis-line-zero)",wi="var(--dh-color-chart-active)",Pi="var(--dh-color-chart-range-bg)",St={"paper-bgcolor":"var(--dh-color-chart-bg)","plot-bgcolor":"var(--dh-color-chart-plot-bg)","title-color":"var(--dh-color-chart-title)",colorway:Ei,gridcolor:Si,linecolor:Ti,zerolinecolor:bi,activecolor:wi,rangebgcolor:Pi,"area-color":"var(--dh-color-chart-area)","trend-color":"var(--dh-color-chart-trend)","line-color":"var(--dh-color-chart-line-deprecated)","error-band-line-color":"var(--dh-color-chart-error-band-line)","error-band-fill-color":"var(--dh-color-chart-error-band-fill)","ohlc-increasing":"var(--dh-color-chart-ohlc-increase)","ohlc-decreasing":"var(--dh-color-chart-ohlc-decrease)"};var Tt=G.module("ChartTheme");function Fi(){var n,e=Jt(St);return e.colorway=er((n=e.colorway)!==null&&n!==void 0?n:"").map(t=>{var[r,i]=t;return tr.normalizeCssColor(e.colorway.substring(r,i+1))}).join(" "),Tt.debug2("Chart theme:",St),Tt.debug2("Chart theme derived:",e),Object.freeze({paper_bgcolor:e["paper-bgcolor"],plot_bgcolor:e["plot-bgcolor"],title_color:e["title-color"],colorway:e.colorway,gridcolor:e.gridcolor,linecolor:e.linecolor,zerolinecolor:e.zerolinecolor,activecolor:e.activecolor,rangebgcolor:e.rangebgcolor,area_color:e["area-color"],trend_color:e["trend-color"],line_color:e["line-color"],error_band_line_color:e["error-band-line-color"],error_band_fill_color:e["error-band-fill-color"],ohlc_increasing:e["ohlc-increasing"],ohlc_decreasing:e["ohlc-decreasing"]})}var Nt=N.createContext(null);function Xi(n){var{children:e}=n,{activeThemes:t}=En(),r=N.useMemo(Fi,[t]);return E.jsx(Nt.Provider,{value:r,children:e})}function Zi(){return Oe(Nt,"No ChartThemeContext value found.")}var Mi=N.createContext(null);function Qi(){return Oe(Mi,"No IdeConnection available in useConnection. Was code wrapped in ConnectionContext.Provider?")}export{B as $,_i as A,Br as B,Gi as C,J as D,Ot as E,Be as F,qn as G,Vi as H,ee as I,Bi as J,ji as K,$i as L,Hi as M,$n as N,qi as O,je as P,Ki as Q,Qn as R,kn as S,Ir as T,Un as U,Kn as V,zn as W,Jn as X,zi as Y,U as Z,Fi as _,ki as a,ei as a0,Nt as a1,Xi as a2,fi as a3,yt as a4,Ii as a5,xe as a6,Mi as a7,Ye as a8,Ai as a9,Ci as aa,pr as ab,we as ac,Wi as ad,Tr as ae,Zi as b,Li as c,Yi as d,Oe as e,Pr as f,Ft as g,he as h,xi as i,Gr as j,En as k,tn as l,Mt as m,Ri as n,Pt as o,m as p,wn as q,Fn as r,k as s,vn as t,Qi as u,L as v,In as w,Le as x,W as y,f as z};
3
- //# sourceMappingURL=useConnection-81aec73a.js.map
1
+ import{r as C,G as V,aP as At,C as S,D as Ct,E as Z,R as It,V as F,F as ke,aQ as xt,L as Lt,aR as Rt,a3 as ze,aS as bt,ab as ge,ai as kt,K as jt,U as ye}from"./vendor-93adb660.js";import{L as G,T as _t,k as Vt,u as Ht,aP as $t,aQ as Wt,E as Bt,H as qt,D as Kt,B as zt,I as Gt,y as Yt,P as Xt,U as Zt,n as Ee,ae as Ge,aR as Qt,aS as Ut,r as Jt,F as er,Y as tr}from"./index-a0e2a6af.js";import{c as Ie,P as wt,b as rr,h as nr,p as ir,o as ar,s as or,t as sr}from"./plotly-3860fdef.js";var Ai=Object.freeze([]),Ci=new Map,Ii=()=>{};function xe(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return e.filter(r=>r!=null)}function lr(n,e,t){return e=ur(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ur(n){var e=cr(n,"string");return typeof e=="symbol"?e:String(e)}function cr(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class dr extends Error{constructor(){super(...arguments),lr(this,"isCanceled",!0)}}const Ye=dr;function hr(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,t=fr(n,e);t.forEach(r=>{n[r]=n[r].bind(n)})}function fr(n,e){for(var t=new Set,r=n,i=0;r!=null&&r!==Object.prototype&&(i<=1||e);){for(var a of Object.getOwnPropertyNames(r))a!=="constructor"&&typeof r[a]=="function"&&t.add(a);r=Object.getPrototypeOf(r),i+=1}return[...t.keys()]}function Xe(n,e,t,r,i,a,s){try{var o=n[a](s),l=o.value}catch(u){t(u);return}o.done?e(l):Promise.resolve(l).then(r,i)}function mr(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function s(l){Xe(a,r,i,s,o,"next",l)}function o(l){Xe(a,r,i,s,o,"throw",l)}s(void 0)})}}function pr(n){return je.apply(this,arguments)}function je(){return je=mr(function*(n){var{clipboard:e}=navigator;if(e!==void 0)try{return navigator.clipboard.writeText(n)}catch{return Ze(n)}Ze(n)}),je.apply(this,arguments)}function Ze(n){var e=document.activeElement,t=document.createElement("textarea");t.value=n,document.body.appendChild(t),t.focus(),t.select();var r=document.execCommand("copy");if(document.body.removeChild(t),e instanceof HTMLElement&&e.focus(),!r)throw new Error("Unable to execute copy command")}function vr(n,e,t){return e=gr(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function gr(n){var e=yr(n,"string");return typeof e=="symbol"?e:String(e)}function yr(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Er extends Error{constructor(){super(...arguments),vr(this,"isTimeout",!0)}}const Pt=Er;class _e{static makeCancelable(e,t){var r=!1,i,a,s=new Promise((o,l)=>{a=l,Promise.resolve(e).then(u=>{r?t&&t(u):(i=u,o(u))}).catch(u=>l(u))});return s.cancel=()=>{r=!0,a(new Ye),i!=null&&t&&t(i)},s}static isCanceled(e){return e instanceof Ye}static isTimedOut(e){return e instanceof Pt}static withTimeout(e,t){return new Promise((r,i)=>{setTimeout(()=>{try{r(t())}catch(a){i(a)}},e)})}}class Sr{static join(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"and";if(e==null||e.length===0)return"";if(e.length===1)return e[0];if(e.length===2)return"".concat(e[0]," ").concat(t," ").concat(e[1]);var r=e.slice(0,e.length-1).join(", "),i=e[e.length-1];return"".concat(r,", ").concat(t," ").concat(i)}static toLower(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e==null){if(t)return"";throw new Error("Null string passed in to TextUtils.toLower")}return e.toLowerCase()}static sort(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return e<t?r?-1:1:e>t?r?1:-1:0}}const Tr=Sr;function Oe(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"No value available in context. Was code wrapped in a provider?",t=C.useContext(n);if(t==null)throw new Error(e);return t}var br=3500,wr=G.module("useCopyToClipboard");function Pr(){var[n,e]=C.useState(!1),t=C.useRef(null),r=C.useCallback(i=>{pr(i).then(()=>{e(!0)}).catch(a=>wr.error("Unable to copy ".concat(i),`
2
+ `,a))},[]);return C.useEffect(()=>(t.current&&clearTimeout(t.current),n&&(t.current=setTimeout(()=>{e(!1)},br)),()=>{t.current&&clearTimeout(t.current)}),[n]),[n,r]}function Qe(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Fr(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Qe(Object(t),!0).forEach(function(r){pe(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Qe(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function pe(n,e,t){return e=Mr(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Mr(n){var e=Dr(n,"string");return typeof e=="symbol"?e:String(e)}function Dr(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ve extends C.Component{constructor(e){super(e),pe(this,"element",void 0),pe(this,"container",void 0),pe(this,"rAF",void 0),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=V.createRef(),this.rAF=0;var{isShown:t}=this.props;this.state={show:t,popper:null}}componentDidUpdate(e){var{isShown:t}=this.props;e.isShown!==t&&(t?(cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{this.show()})):this.hide())}componentWillUnmount(){this.destroyPopper(!1)}getVisibleElement(e){return e==null||e.clientHeight>0||e.clientWidth>0?e:this.getVisibleElement(e.parentElement)}initPopper(){var{popper:e}=this.state,{closeOnBlur:t,referenceObject:r}=this.props;if(!e&&this.container.current!==null){var{options:i}=this.props;i=Fr({placement:"auto",modifiers:{preventOverflow:{boundariesElement:"viewport"}}},i),document.body.appendChild(this.element);var a=this.getVisibleElement(this.container.current);a==null&&(a=this.container.current),e=new At(r||a,this.element,i),e.scheduleUpdate(),cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{if(t&&!this.element.contains(document.activeElement)){var s=this.element.firstElementChild;s instanceof HTMLElement&&s.focus()}}),this.setState({popper:e})}}destroyPopper(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;cancelAnimationFrame(this.rAF);var{popper:t}=this.state;t&&(t.destroy(),document.body.contains(this.element)&&document.body.removeChild(this.element),e&&this.setState({popper:null}))}show(){this.initPopper(),this.setState({show:!0})}hide(){this.setState({show:!1})}scheduleUpdate(){var{popper:e}=this.state;e&&e.scheduleUpdate()}handleBlur(e){e.relatedTarget instanceof HTMLElement&&(this.element.contains(e.relatedTarget)||this.hide())}handleEnter(){var{onEntered:e}=this.props;e()}handleExit(){var{onExited:e}=this.props,{show:t}=this.state;t||this.destroyPopper(),e()}renderContent(){var{className:e,children:t,timeout:r,interactive:i,closeOnBlur:a}=this.props,{show:s}=this.state;return S.jsx(Ct,{in:s,timeout:r,classNames:"popper-transition",onEntered:this.handleEnter,onExited:this.handleExit,children:S.jsx("div",{onClick:o=>{o.stopPropagation()},onKeyDown:o=>{o.key==="Escape"&&this.hide()},className:Z("popper",{interactive:i},e),onBlur:a?this.handleBlur:void 0,tabIndex:a?-1:void 0,role:"presentation",children:S.jsxs("div",{className:"popper-content",children:[t,S.jsx("div",{className:"popper-arrow","x-arrow":""})]})})})}render(){var{popper:e}=this.state,{"data-testid":t}=this.props;return S.jsx("div",{className:"popper-parent-container",ref:this.container,style:{display:"none"},"data-testid":t,children:e&&It.createPortal(this.renderContent(),this.element)})}}pe(Ve,"propTypes",{children:F.node.isRequired,options:F.shape({}),className:F.string,timeout:F.number,onEntered:F.func,onExited:F.func,isShown:F.bool,closeOnBlur:F.bool,interactive:F.bool,referenceObject:F.shape({}),"data-testid":F.string});pe(Ve,"defaultProps",{options:{},className:"",timeout:_t.transitionMs,onEntered(){},onExited(){},isShown:!1,interactive:!1,closeOnBlur:!1,referenceObject:null,"data-testid":void 0});const Ft=Ve;function Ue(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Or(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ue(Object(t),!0).forEach(function(r){X(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ue(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function X(n,e,t){return e=Nr(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Nr(n){var e=Ar(n,"string");return typeof e=="symbol"?e:String(e)}function Ar(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Cr=G.module("Tooltip");class R extends C.Component{static handleHidden(){R.shownTooltipCount-=1,R.shownTooltipCount===0&&(R.lastHiddenTime=Date.now())}static handleShown(){R.shownTooltipCount+=1}constructor(e){super(e),X(this,"container",void 0),X(this,"popper",void 0),X(this,"parent",void 0),X(this,"timer",void 0),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=V.createRef(),this.popper=V.createRef(),this.parent=null,this.timer=null,this.state={isShown:!1}}componentDidMount(){this.startListening();var{timeout:e}=this.props;e===0&&this.show()}componentDidUpdate(e,t){var{isShown:r}=t,{isShown:i}=this.state;i!==r&&(i?R.handleShown():R.handleHidden())}componentWillUnmount(){this.stopListening(),this.stopListeningWindow(),this.stopTimer();var{isShown:e}=this.state;e&&R.handleHidden()}startListening(){if(!this.container.current||!this.container.current.parentElement){Cr.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(){var{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(){var{isShown:e}=this.state;this.stopTimer();var{interactive:t}=this.props;!t&&e&&this.hide()}handleTimeout(){this.show()}handleWindowMouseMove(e){var t=e.clientX,r=e.clientY,{isShown:i}=this.state;if(!(!this.popper.current||!this.parent)){var a=this.popper.current.element.getBoundingClientRect(),s=this.parent.getBoundingClientRect();t>=a.left&&t<=a.left+a.width&&r>=a.top&&r<=a.top+a.height?this.handleMouseMove():t>=s.left&&t<=s.left+s.width&&r>=s.top&&r<=s.top+s.height?this.handleMouseMove():i&&(this.stopTimer(),this.hide())}}startTimer(){this.stopTimer();var{timeout:e,reshowTimeout:t}=this.props,r=e;(R.shownTooltipCount>0||Date.now()-R.lastHiddenTime<R.triggerReshowThreshold)&&(r=t),this.timer=window.setTimeout(this.handleTimeout,r)}stopTimer(){this.timer!=null&&(clearTimeout(this.timer),this.timer=null)}show(){var{isShown:e}=this.state;if(this.stopTimer(),!e){var t;(t=this.popper.current)===null||t===void 0||t.show(),this.setState({isShown:!0});var{interactive:r}=this.props;r&&this.startListeningWindow()}}hide(){var e;(e=this.popper.current)===null||e===void 0||e.hide(),this.stopListeningWindow()}update(){var e;(e=this.popper.current)===null||e===void 0||e.scheduleUpdate()}handleExited(){this.setState({isShown:!1});var{onExited:e}=this.props;e()}stopShowingTooltip(){var{isShown:e}=this.state;this.stopTimer(),e&&this.hide()}render(){var{interactive:e,children:t,referenceObject:r,popperClassName:i,"data-testid":a,onEntered:s}=this.props,{isShown:o}=this.state,{options:l}=this.props;return l=Or({placement:"bottom"},l),S.jsx("div",{ref:this.container,style:{display:"none"},"data-testid":a,children:S.jsx(Ft,{className:Z(i),options:l,ref:this.popper,onEntered:s,onExited:this.handleExited,interactive:e,referenceObject:r,children:S.jsxs("div",{className:"tooltip-content",children:[" ",o&&t]})})})}}X(R,"defaultTimeout",500);X(R,"defaultReshowTimeout",100);X(R,"triggerReshowThreshold",300);X(R,"shownTooltipCount",0);X(R,"lastHiddenTime",Date.now());X(R,"defaultProps",{interactive:!1,options:{},popperClassName:"",reshowTimeout:R.defaultReshowTimeout,timeout:R.defaultTimeout,onEntered:()=>{},onExited:()=>{},"data-testid":void 0});const Ir=R;var xr=["kind","variant","type","tooltip","icon","disabled","active","onClick","onContextMenu","onMouseDown","onMouseUp","onMouseEnter","onMouseLeave","onKeyDown","className","style","children","tabIndex","data-testid","aria-label"];function Je(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function et(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Je(Object(t),!0).forEach(function(r){Lr(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Je(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Lr(n,e,t){return e=Rr(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Rr(n){var e=kr(n,"string");return typeof e=="symbol"?e:String(e)}function kr(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function jr(n,e){if(n==null)return{};var t=_r(n,e),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(n);for(i=0;i<a.length;i++)r=a[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function _r(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,a;for(a=0;a<r.length;a++)i=r[a],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var Vr=["primary","secondary","tertiary","success","danger","inline","ghost"],Hr=["group-end"];function $r(n,e){switch(n){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 Z("btn-link",{"btn-link-icon":e,"btn-link-icon-only":e})}}function Wr(n){switch(n){case"group-end":return Z("pl-2","pr-3")}}var Ne=V.forwardRef((n,e)=>{var{kind:t,variant:r,type:i,tooltip:a,icon:s,disabled:o=!1,active:l,onClick:u,onContextMenu:c,onMouseDown:d,onMouseUp:h,onMouseEnter:g,onMouseLeave:p,onKeyDown:y,className:E,style:T,children:w,tabIndex:b,"data-testid":P,"aria-label":M}=n,D=jr(n,xr),O=!!(s&&w==null),x=$r(t,O),L;r&&(L=Wr(r));var N;if(s&&(N=V.isValidElement(s)?s:S.jsx(ke,{icon:s})),N!=null&&w!=null){var Y=!1;V.Children.forEach(w,ie=>{typeof ie=="string"?Y=!0:V.isValidElement(ie)&&V.Children.forEach(ie.props.children,de=>{typeof de=="string"&&(Y=!0)})}),Y&&(N=V.cloneElement(N,{className:Z("mr-1",N.props.className)}))}var K;a!==void 0&&(K=typeof a=="string"?S.jsx(Ir,{children:a}):a);var re=M;M===void 0&&O&&a!=null&&typeof a=="string"&&(re=a);var Q=S.jsxs("button",et(et({"data-testid":P,ref:e,type:i,className:Z("btn",x,L,{active:l},E),onClick:u,onContextMenu:c,onMouseUp:h,onMouseDown:d,onMouseEnter:g,onMouseLeave:p,onKeyDown:y,style:T,disabled:o,tabIndex:b,"aria-label":re},D),{},{children:[s&&N,w,a!=null&&!o&&K]}));return o&&a!=null?S.jsxs("span",{className:"btn-disabled-wrapper",children:[Q,K]}):Q});Ne.displayName="Button";Ne.propTypes={kind:F.oneOf(Vr).isRequired,variant:F.oneOf(Hr),type:F.oneOf(["submit","reset","button"]),tooltip(n){var{tooltip:e,icon:t,children:r}=n;return e===void 0&&t!=null&&r==null?new Error("Tooltip is required for icon only buttons"):null},icon(n){var{children:e,icon:t}=n;return t==null&&e==null?new Error("Icon is required if no children are provided"):e==null&&!V.isValidElement(t)&&(t==null||t.iconName===""||t.iconName==null)?new Error("Icon must be react element or fontawesome IconDefinition"):null},disabled:F.bool,active:F.bool,onClick(n){var{onClick:e,type:t}=n;return t==="button"&&typeof e!="function"?new Error("type button requires an onClick function"):e!==void 0&&typeof e!="function"?new Error("onClick must be a function"):null},onContextMenu:F.func,onMouseUp:F.func,onMouseDown:F.func,onMouseEnter:F.func,onMouseLeave:F.func,onKeyDown:F.func,tabIndex:F.number,children:F.node,className:F.string,style:F.object,"data-testid":F.string};Ne.defaultProps={type:"button",onClick:void 0,onContextMenu:void 0,onMouseUp:void 0,onMouseDown:void 0,onMouseEnter:void 0,onMouseLeave:void 0,onKeyDown:void 0,variant:void 0,tooltip:void 0,icon:void 0,disabled:!1,active:void 0,tabIndex:void 0,children:void 0,className:void 0,style:{},"data-testid":void 0};const Br=Ne;function qr(n,e,t){return e=Kr(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Kr(n){var e=zr(n,"string");return typeof e=="symbol"?e:String(e)}function zr(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function xi(n){return n.then!==void 0}class ue{static disableAllActions(){ue.actionsDisabled=!0}static enableAllActions(){ue.actionsDisabled=!1}static isContextActionEvent(e){return Array.isArray(e.contextActions)}static compareActions(e,t){if(e.group!==t.group){var r,i;return((r=e.group)!==null&&r!==void 0?r:0)>((i=t.group)!==null&&i!==void 0?i:0)?1:-1}if(e.order!==t.order){var a,s;return((a=e.order)!==null&&a!==void 0?a:0)>((s=t.order)!==null&&s!==void 0?s:0)?1:-1}if(e.title!==t.title){var o,l;return((o=e.title)!==null&&o!==void 0?o:"")>((l=t.title)!==null&&l!==void 0?l:"")?1:-1}return e!==t?e>t?1:-1:0}static sortActions(e){if(e==null||!Array.isArray(e))return[];var t=e.slice();return t.sort(ue.compareActions),t}static isMacPlatform(){var{platform:e}=window.navigator;return e.startsWith("Mac")}static getModifierKey(){return ue.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(e){var t=ue.getModifierKey();return e[t]}static getMenuItems(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=[],i=e;Array.isArray(i)||(i=[i]);for(var a=0;a<i.length;a+=1){var s=i[a],o=void 0;typeof s=="function"?o=s():o=s,o!=null&&(o instanceof Promise?t&&r.push(o):Array.isArray(o)?r=r.concat(o):r.push(o))}return r=r.filter(l=>l.title!==void 0||l.then!=null||l.menuElement),r}static getNextMenuItem(e,t,r){var i=e;i<0&&t<0&&(i=r.length);for(var a=1;a<r.length+1;a+=1){var s=(i+t*a+r.length)%r.length,o=r[s];if(!(o instanceof Promise)&&o.disabled!==!0)return s}return e}}qr(ue,"actionsDisabled",!1);const he=ue;var He=V.forwardRef((n,e)=>{var t;function r(D){var{menuItem:O,onMenuItemClick:x}=n;x(O,D)}function i(D){var{menuItem:O,onMenuItemMouseMove:x}=n;x(O,D)}function a(D){var{menuItem:O,onMenuItemContextMenu:x}=n;x(O,D)}function s(D,O,x){if(typeof D.type=="string")return D;var{closeMenu:L,menuItem:N,isKeyboardSelected:Y,isMouseSelected:K,"data-testid":re}=n,Q={menuItem:N,closeMenu:L,isKeyboardSelected:Y,isMouseSelected:K,iconElement:O,displayShortcut:x,"data-testid":re};return V.cloneElement(D,{forwardedProps:Q})}var{children:o,menuItem:l,isKeyboardSelected:u=!1,isMouseSelected:c=!1,"data-testid":d}=n,h=(t=l.shortcut)===null||t===void 0?void 0:t.getDisplayText(),g=null;if(l.icon){var p=l.icon;if(V.isValidElement(p))g=p;else{var y;l.iconColor!=null&&(l.disabled===void 0||!l.disabled)&&(y={color:l.iconColor}),g=S.jsx(ke,{icon:p,style:y})}}var E=null,T=!!o;l.actions&&(E=S.jsx(ke,{icon:Vt}));var w=null;if(l.menuElement)w=S.jsx("div",{className:"custom-menu-item",onMouseMove:i,children:s(l.menuElement,g,h)});else{var b,P=l.disabled,M=l.iconOutline;w=S.jsx("button",{type:"button",className:Z("btn-context-menu",{disabled:P},{active:(T||c)&&(P===void 0||!P)},{"keyboard-active":u&&(P===void 0||!P)}),onClick:r,onMouseMove:i,onContextMenu:a,title:(b=l.description)!==null&&b!==void 0?b:"",children:S.jsxs("div",{className:"btn-context-menu-wrapper",children:[S.jsx("span",{className:Z("icon",{outline:M}),children:g}),S.jsx("span",{className:"title",children:l.title}),h!==void 0&&S.jsx("span",{className:"shortcut",children:h}),E&&S.jsx("span",{className:Z("submenu-indicator",{disabled:P}),children:E})]})})}return S.jsxs("div",{className:"context-menu-item",ref:e,"data-testid":d,children:[o,w]})});He.displayName="ContextMenuItem";He.defaultProps={children:null,isKeyboardSelected:!1,isMouseSelected:!1,"data-testid":void 0};const Gr=He;function tt(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Yr(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?tt(Object(t),!0).forEach(function(r){se(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):tt(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function se(n,e,t){return e=Xr(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Xr(n){var e=Zr(n,"string");return typeof e=="symbol"?e:String(e)}function Zr(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var rt=G.module("ContextMenu");class Te extends C.PureComponent{static handleContextMenu(e){e.metaKey||(e.stopPropagation(),e.preventDefault())}constructor(e){super(e),se(this,"container",void 0),se(this,"oldFocus",void 0),se(this,"activeSubMenuRef",void 0),se(this,"subMenuTimer",void 0),se(this,"rAF",void 0),se(this,"initialPosition",void 0),this.handleBlur=this.handleBlur.bind(this),this.handleCloseSubMenu=this.handleCloseSubMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMenuItemClick=this.handleMenuItemClick.bind(this),this.handleMenuItemContextMenu=this.handleMenuItemContextMenu.bind(this),this.handleMenuItemMouseMove=this.handleMenuItemMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleWindowResize=this.handleWindowResize.bind(this),this.container=V.createRef(),this.oldFocus=document.activeElement,this.activeSubMenuRef=V.createRef(),this.subMenuTimer=0,this.rAF=0,this.initialPosition={top:e.top,left:e.left},this.state={menuItems:[],pendingItems:[],activeSubMenu:null,hasOverflow:!1,subMenuTop:null,subMenuLeft:null,subMenuParentWidth:0,subMenuParentHeight:0,keyboardIndex:-1,mouseIndex:-1}}componentDidMount(){this.initMenu(),this.verifyPosition(),window.addEventListener("resize",this.handleWindowResize),this.rAF=window.requestAnimationFrame(()=>{var e;(e=this.container.current)===null||e===void 0||e.focus();var{onMenuOpened:t}=this.props;t(this)})}componentDidUpdate(e,t){var{actions:r}=this.props,{activeSubMenu:i}=this.state;if(i!==t.activeSubMenu)if(i==null){var a;(a=this.container.current)===null||a===void 0||a.focus()}else this.setActiveSubMenuPosition();if(e.actions!==r&&(this.initMenu(),this.container.current==null||!this.container.current.contains(document.activeElement))){var s;(s=this.container.current)===null||s===void 0||s.focus()}this.verifyPosition()}componentWillUnmount(){this.cancelPromises(),window.removeEventListener("resize",this.handleWindowResize),cancelAnimationFrame(this.rAF)}getKeyboardIndex(){var{options:e}=this.props;if(e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse){var{keyboardIndex:t}=this.state;return t}return this.getMouseIndex()}setKeyboardIndex(e){var{options:t}=this.props;t.separateKeyboardMouse!==void 0&&t.separateKeyboardMouse?this.setState({keyboardIndex:e}):this.setMouseIndex(e)}getMouseIndex(){var{mouseIndex:e}=this.state;return e}setMouseIndex(e){this.setState({mouseIndex:e})}initMenu(){this.cancelPromises(),cancelAnimationFrame(this.rAF);var{options:e}=this.props,t=e.initialKeyboardIndex;t===void 0&&(t=-1);for(var{actions:r}=this.props,i=he.getMenuItems(r),a=[],s=i.length-1;s>=0;s-=1){var o=i[s];o instanceof Promise?this.initMenuPromise(o):a.push(o)}this.setState({mouseIndex:-1,keyboardIndex:t,activeSubMenu:null,menuItems:he.sortActions(a)})}initMenuPromise(e){var t=_e.makeCancelable(e);this.setState(r=>({pendingItems:r.pendingItems.concat(t)})),t.then(r=>{this.setState(i=>{var a=i.pendingItems.indexOf(t);if(a>=0){var s=i.pendingItems.slice();return s.splice(a,1),{menuItems:he.sortActions(i.menuItems.concat(r)),pendingItems:s}}return null})},r=>{_e.isCanceled(r)||(this.setState(i=>{var a=i.pendingItems.indexOf(t);if(a>=0){var s=i.pendingItems.slice();return s.splice(a,1),{pendingItems:s}}return null}),rt.error(r))})}cancelPromises(){var{pendingItems:e}=this.state;e.map(t=>t.cancel())}setActiveSubMenuPosition(){if(this.activeSubMenuRef.current!==null){var e=this.activeSubMenuRef.current.getBoundingClientRect();this.setState({subMenuTop:e.top,subMenuLeft:e.right,subMenuParentHeight:e.height,subMenuParentWidth:e.width})}}verifyPosition(){var e,t,r,i,{options:a,updatePosition:s,subMenuParentWidth:o,subMenuParentHeight:l,top:u,left:c}=this.props;if(!(!this.container.current||a.doNotVerifyPosition!=null&&a.doNotVerifyPosition)){var{top:d,left:h}=this.initialPosition,{width:g,height:p}=(e=(t=this.container.current)===null||t===void 0?void 0:t.getBoundingClientRect())!==null&&e!==void 0?e:{width:0,height:0},y=((r=(i=this.container.current)===null||i===void 0?void 0:i.scrollHeight)!==null&&r!==void 0?r:0)>window.innerHeight;p===0||g===0||(d+p>window.innerHeight&&(d-p-l>0?d-=p-l:d=window.innerHeight-p),h+g>window.innerWidth&&(h=h-g-o),(c!==h||u!==d)&&(this.setState({hasOverflow:y}),s(d,h)))}}handleWindowResize(){this.container.current&&this.closeMenu(!0)}handleBlur(e){if(!this.container.current){rt.warn("Container is null!");return}if(!this.container.current.contains(e.relatedTarget)){for(var t=e.relatedTarget,r=!1;t&&!r;)r=t.hasAttribute("data-dh-context-menu"),t=t.parentElement;r||this.closeMenu(!0)}}isEscapeKey(e){var{left:t}=this.props;return e==="Escape"||t<0&&e==="ArrowRight"||e==="ArrowLeft"}handleKeyDown(e){var{menuItems:t}=this.state,r=this.getKeyboardIndex(),i=r,a=!1;if(e.key==="Enter"||e.key===" "){r>=0&&r<t.length&&this.handleMenuItemClick(t[r],e);return}if(e.key==="ArrowRight"?r>=0&&r<=t.length?a=!0:i=0:this.isEscapeKey(e.key)?i=null:e.key==="ArrowUp"||e.shiftKey&&e.key==="Tab"?i=he.getNextMenuItem(i,-1,t):(e.key==="ArrowDown"||e.key==="Tab")&&(i=he.getNextMenuItem(i,1,t)),a){this.openSubMenu(r),e.preventDefault(),e.stopPropagation();return}r!==i&&(i!==null?this.setKeyboardIndex(i):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}openSubMenu(e){var{menuItems:t,activeSubMenu:r}=this.state,i=t[e].actions?e:null;r!==i&&this.setState({activeSubMenu:i,subMenuTop:null,subMenuLeft:null})}closeMenu(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,{closeMenu:t,onMenuClosed:r}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t(e),r(this)})}closeSubMenu(){this.setState({activeSubMenu:null})}handleCloseSubMenu(e){e?this.closeMenu(!0):this.closeSubMenu()}handleMenuItemClick(e,t){t.preventDefault(),t.stopPropagation();var{menuItems:r}=this.state;e!=null&&(e.disabled===void 0||!e.disabled)&&(e.actions!=null?this.openSubMenu(r.indexOf(e)):e.action!=null&&(e.action(t.nativeEvent),this.closeMenu(!0)))}handleMenuItemContextMenu(e,t){t.metaKey||this.handleMenuItemClick(e,t)}handleMenuItemMouseMove(e){var{menuItems:t}=this.state,r=t.indexOf(e);this.setMouseIndex(r),r>=0&&r<t.length&&(e.disabled===void 0||!e.disabled)&&this.openSubMenu(r)}handleMouseLeave(){this.setMouseIndex(-1)}render(){for(var e=[],{top:t,left:r}=this.props,{activeSubMenu:i,hasOverflow:a,keyboardIndex:s,menuItems:o,mouseIndex:l,pendingItems:u,subMenuTop:c,subMenuLeft:d,subMenuParentWidth:h,subMenuParentHeight:g}=this.state,p=0;p<o.length;p+=1){var y=o[p];p>0&&y.group!==o[p-1].group&&e.push(S.jsx("hr",{},"".concat(p,".separator")));var E=S.jsx(Gr,{ref:i===p?this.activeSubMenuRef:null,isKeyboardSelected:s===p,isMouseSelected:l===p,menuItem:y,closeMenu:this.handleCloseSubMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:this.handleMenuItemContextMenu},p);e.push(E)}var T=null;u.length>0&&(T=S.jsx("div",{className:"loading",children:S.jsx(Ht,{className:"loading-spinner-vertical-align"})}));var{menuStyle:w,"data-testid":b}=this.props,P=i!==null&&c!==null&&d!==null;return S.jsxs(S.Fragment,{children:[S.jsxs("div",{className:Z({"has-overflow":a},"context-menu-container"),style:Yr({top:t,left:r},w),ref:this.container,"data-dh-context-menu":!0,onBlur:this.handleBlur,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,onContextMenu:Te.handleContextMenu,role:"menuitem",tabIndex:0,"data-testid":b,children:[e,T]}),P&&i!==null&&c!==null&&d!==null&&S.jsx(Te,{actions:o[i].actions||[],closeMenu:this.handleCloseSubMenu,top:c,left:d,updatePosition:(M,D)=>{this.setState({subMenuTop:M,subMenuLeft:D})},subMenuParentWidth:h,subMenuParentHeight:g},"sub-".concat(i))]})}}se(Te,"defaultProps",{subMenuParentWidth:0,subMenuParentHeight:0,closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0});const Qr=Te;function nt(n,e,t){return e=Ur(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ur(n){var e=Jr(n,"string");return typeof e=="symbol"?e:String(e)}function Jr(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class en extends C.Component{constructor(e){super(e),nt(this,"container",void 0),nt(this,"openMenu",void 0),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.container=V.createRef(),this.openMenu=V.createRef(),this.state={actions:null,left:0,top:0}}componentDidMount(){var e;(e=this.container.current)!==null&&e!==void 0&&e.parentElement&&this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu)}componentWillUnmount(){var e;(e=this.container.current)!==null&&e!==void 0&&e.parentElement&&this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu)}handleContextMenu(e){if(this.container.current){var t=this.container.current.getBoundingClientRect(),r=e.clientY-t.top,i=e.clientX-t.left,{actions:a}=this.state;if(a!=null&&e.target===this.container.current){e.preventDefault(),this.setState({actions:null},()=>{var o=document.elementFromPoint(i,r),l=new MouseEvent("contextmenu",{clientX:e.clientX,clientY:e.clientY,bubbles:!0,cancelable:!0});o==null||o.dispatchEvent(l)});return}if(he.isContextActionEvent(e)&&!(e.metaKey||e.ctrlKey)){var s=he.getMenuItems(e.contextActions);s.length!==0&&(e.preventDefault(),this.setState({actions:s,top:r,left:i}))}}}handleMenuClose(e){e===this.openMenu.current&&this.setState({actions:null})}render(){var e=null,{"data-testid":t}=this.props,{actions:r,top:i,left:a}=this.state;return r&&(e=S.jsx(Qr,{ref:this.openMenu,actions:r,onMenuClosed:this.handleMenuClose,top:i,left:a,updatePosition:(s,o)=>{this.setState({top:s,left:o})},"data-testid":t})),S.jsx("div",{className:Z("context-menu-root",{active:r}),ref:this.container,children:e})}}const Li=en;function tn(n){var{copy:e,kind:t="ghost",tooltip:r="Copy",className:i,"data-testid":a,children:s}=n,[o,l]=Pr();return S.jsx(Br,{kind:t,className:i,"data-testid":a,icon:o?$t:Wt,tooltip:o?"Copied":r,onClick:()=>{l(typeof e=="function"?e():e)},children:s})}const rn={"dh-spectrum-palette":"_dh-spectrum-palette_1mcqx_1"},nn={"dh-spectrum-alias":"_dh-spectrum-alias_145ve_1"};function it(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function at(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?it(Object(t),!0).forEach(function(r){an(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):it(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function an(n,e,t){return e=on(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function on(n){var e=sn(n,"string");return typeof e=="symbol"?e:String(e)}function sn(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ot=at(at({},rn),nn);function st(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Me(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?st(Object(t),!0).forEach(function(r){ln(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):st(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ln(n,e,t){return e=un(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function un(n){var e=cn(n,"string");return typeof e=="symbol"?e:String(e)}function cn(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var{global:dn,light:hn,dark:fn,medium:mn,large:pn}=xt,vn={global:dn,light:Me(Me({},hn),ot),dark:Me(Me({},fn),ot),medium:mn,large:pn};function gn(n){var{children:e,isPortal:t=!1,theme:r=vn,colorScheme:i}=n,[a]=C.useState(t?Lt():null);return S.jsx(Rt,{UNSAFE_className:"spectrum-theme-provider",theme:r,colorScheme:i,"data-unique-id":a,children:e})}var yn=G.module("ThemeProvider"),Mt=C.createContext(null);function Ri(n){var{themes:e,children:t}=n,r=C.useMemo(()=>Bt(),[]),[i,a]=C.useState(null),[s,o]=C.useState(()=>{var c,d;return(c=(d=qt())===null||d===void 0?void 0:d.themeKey)!==null&&c!==void 0?c:Kt}),l=C.useMemo(()=>e==null?null:zt(s,{base:r,custom:e??[]}),[r,s,e]),u=C.useMemo(()=>[...r,...e??[]],[r,e]);return C.useEffect(function(){if(!(l==null||e==null)){Gt();var d=Yt();yn.debug2("updateThemePreloadData:",{active:l.map(h=>h.themeKey),custom:e.map(h=>h.themeKey),preloadStyleContent:d,selectedThemeKey:s}),Xt({themeKey:s,preloadStyleContent:d})}},[l,s,e]),C.useEffect(()=>{a({activeThemes:l,selectedThemeKey:s,themes:u,setSelectedThemeKey:o})},[l,s,u]),S.jsxs(S.Fragment,{children:[l==null?null:S.jsx(S.Fragment,{children:l.map(c=>S.jsx("style",{"data-theme-key":c.themeKey,children:c.styleContent},c.themeKey))}),i==null?null:S.jsx(Mt.Provider,{value:i,children:S.jsx(gn,{children:t})})]})}function En(){return Oe(Mt,"No ThemeContext value found. Component must be wrapped in a ThemeContext.Provider")}function ki(){return Oe(Zt,"No API available in useApi. Was code wrapped in ApiBootstrap or ApiContext.Provider?")}function $e(n,e,t){return e=Sn(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Sn(n){var e=Tn(n,"string");return typeof e=="symbol"?e:String(e)}function Tn(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ae{static isValid(e,t){return!0}static isSameFormat(e,t){throw new Error("isSameFormat not implemented")}static makeFormat(e,t,r){return{label:e,formatString:t,type:r}}format(e,t){return""}}$e(Ae,"TYPE_GLOBAL","type-global");$e(Ae,"TYPE_CONTEXT_PRESET","type-context-preset");$e(Ae,"TYPE_CONTEXT_CUSTOM","type-context-custom");const B=Ae;class bn extends B{format(e){switch(e){case 1:case!0:return"true";case 0:case!1:return"false";default:return""}}}const wn=bn;class Pn extends B{format(e){return String.fromCharCode(e)}}const Fn=Pn;function le(n,e,t){return e=Mn(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Mn(n){var e=Dn(n,"string");return typeof e=="symbol"?e:String(e)}function Dn(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var lt=G.module("DateTimeColumnFormatter");class J extends B{static isValid(e,t){try{return e.i18n.DateTimeFormat.format(t.formatString,new Date),!0}catch{return!1}}static makeFormat(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:B.TYPE_CONTEXT_PRESET;return{label:e,formatString:t,type:r}}static isSameFormat(e,t){return e===t||e!==null&&t!==null&&e.type===t.type&&e.formatString===t.formatString}static makeGlobalFormatStringMap(e,t){var r=t?"'T'":" ",i=e?" z":"";return new Map([["yyyy-MM-dd HH:mm:ss","yyyy-MM-dd".concat(r,"HH:mm:ss").concat(i)],["yyyy-MM-dd HH:mm:ss.SSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSS").concat(i)],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSSSSSSSS").concat(i)]])}static getGlobalFormats(e,t){var r=J.makeGlobalFormatStringMap(e,t);return[...r.keys()]}static makeFormatStringMap(e,t){var r=t!==void 0&&t?"'T'":" ",i=e!==void 0&&e?" z":"";return new Map([["yyyy-MM-dd","yyyy-MM-dd".concat(i)],["MM-dd-yyyy","MM-dd-yyyy".concat(i)],["HH:mm:ss","HH:mm:ss".concat(i)],["HH:mm:ss.SSS","HH:mm:ss.SSS".concat(i)],["HH:mm:ss.SSSSSSSSS","HH:mm:ss.SSSSSSSSS".concat(i)],["yyyy-MM-dd HH:mm:ss","yyyy-MM-dd".concat(r,"HH:mm:ss").concat(i)],["yyyy-MM-dd HH:mm:ss.SSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSS").concat(i)],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSSSSSSSS").concat(i)]])}static getFormats(e,t){var r=J.makeFormatStringMap(e,t);return[...r.keys()]}constructor(e){var{timeZone:t="",showTimeZone:r=!0,showTSeparator:i=!1,defaultDateTimeFormatString:a=J.DEFAULT_DATETIME_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),le(this,"dh",void 0),le(this,"dhTimeZone",void 0),le(this,"defaultDateTimeFormatString",void 0),le(this,"showTimeZone",void 0),le(this,"showTSeparator",void 0),le(this,"formatStringMap",void 0);var s=t||J.DEFAULT_TIME_ZONE_ID;try{this.dhTimeZone=e.i18n.TimeZone.getTimeZone(s)}catch{lt.error("Unsupported time zone id",s),this.dhTimeZone=e.i18n.TimeZone.getTimeZone(J.DEFAULT_TIME_ZONE_ID)}this.dh=e,this.defaultDateTimeFormatString=a,this.showTimeZone=r,this.showTSeparator=i,this.formatStringMap=J.makeFormatStringMap(r,i)}getEffectiveFormatString(e){var t;return(t=this.formatStringMap.get(e))!==null&&t!==void 0?t:e}format(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultDateTimeFormatString,i=this.getEffectiveFormatString(r);try{return this.dh.i18n.DateTimeFormat.format(i,e,this.dhTimeZone)}catch{lt.error("Invalid format arguments")}return""}}le(J,"DEFAULT_DATETIME_FORMAT_STRING","yyyy-MM-dd HH:mm:ss.SSS");le(J,"DEFAULT_TIME_ZONE_ID","America/New_York");function te(n,e,t){return e=On(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function On(n){var e=Nn(n,"string");return typeof e=="symbol"?e:String(e)}function Nn(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var An=G.module("DecimalColumnFormatter");class j extends B{static isValid(e,t){try{return e.i18n.NumberFormat.format(t.formatString,0),!0}catch{return!1}}static makeFormat(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:B.TYPE_CONTEXT_PRESET,i=arguments.length>3?arguments[3]:void 0;return{label:e,type:r,formatString:t,multiplier:i}}static makePresetFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0;return j.makeFormat(e,t,B.TYPE_CONTEXT_PRESET,r)}static makeCustomFormat(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return j.makeFormat("Custom Format",e,B.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}constructor(e){var{defaultFormatString:t=j.DEFAULT_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),te(this,"defaultFormatString",void 0),te(this,"dh",void 0),this.dh=e,this.defaultFormatString=t}format(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,i=t.multiplier!=null&&t.multiplier!==0?e*t.multiplier:e;try{return this.dh.i18n.NumberFormat.format(r,i)}catch{An.error("Invalid format arguments")}return""}}te(j,"DEFAULT_FORMAT_STRING","###,##0.0000");te(j,"FORMAT_PERCENT",j.makePresetFormat("Percent","##0.00%"));te(j,"FORMAT_BASIS_POINTS",j.makePresetFormat("Basis Points","###,##0 bp",1e4));te(j,"FORMAT_MILLIONS",j.makePresetFormat("Millions","###,##0.000 mm",1e-6));te(j,"FORMAT_SCIENTIFIC_NOTATION",j.makePresetFormat("Scientific Notation","0.0000E0"));te(j,"FORMAT_ROUND",j.makePresetFormat("Round","###,##0"));te(j,"FORMAT_ROUND_TWO_DECIMALS",j.makePresetFormat("0.00","###,##0.00"));te(j,"FORMAT_ROUND_FOUR_DECIMALS",j.makePresetFormat("0.0000","###,##0.0000"));class Cn extends B{format(e){return"".concat(e)}}const In=Cn;function be(n,e,t){return e=xn(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function xn(n){var e=Ln(n,"string");return typeof e=="symbol"?e:String(e)}function Ln(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Rn=G.module("IntegerColumnFormatter");class ee extends B{static isValid(e,t){try{return e.i18n.NumberFormat.format(t.formatString,0),!0}catch{return!1}}static makeFormat(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:B.TYPE_CONTEXT_PRESET,i=arguments.length>3?arguments[3]:void 0;return{label:e,type:r,formatString:t,multiplier:i}}static makePresetFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0;return ee.makeFormat(e,t,B.TYPE_CONTEXT_PRESET,r)}static makeCustomFormat(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return ee.makeFormat("Custom Format",e,B.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}constructor(e){var{defaultFormatString:t=ee.DEFAULT_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),be(this,"dh",void 0),be(this,"defaultFormatString",void 0),this.dh=e,this.defaultFormatString=t}format(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,i=t.multiplier!=null&&t.multiplier!==0?e*t.multiplier:e;try{return this.dh.i18n.NumberFormat.format(r,i)}catch{Rn.error("Invalid format arguments")}return""}}be(ee,"DEFAULT_FORMAT_STRING","###,##0");be(ee,"FORMAT_MILLIONS",ee.makePresetFormat("Millions","###,##0.000 mm",1e-6));be(ee,"FORMAT_SCIENTIFIC_NOTATION",ee.makePresetFormat("Scientific Notation","0.0000E0"));class kn extends B{format(e){return e}}function Dt(n,e,t){return e=jn(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function jn(n){var e=_n(n,"string");return typeof e=="symbol"?e:String(e)}function _n(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class _{static makeDateWrapper(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:1,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0,o=arguments.length>6&&arguments[6]!==void 0?arguments[6]:0,l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:0,u=arguments.length>8&&arguments[8]!==void 0?arguments[8]:0;if(!t)throw new Error("No timezone provided");var c="".concat(r).padStart(4,"0"),d="".concat(i+1).padStart(2,"0"),h="".concat(a).padStart(2,"0"),g="".concat(s).padStart(2,"0"),p="".concat(o).padStart(2,"0"),y="".concat(l).padStart(2,"0"),E="".concat(u).padStart(9,"0"),T="".concat(c,"-").concat(d,"-").concat(h," ").concat(g,":").concat(p,":").concat(y,".").concat(E);return e.i18n.DateTimeFormat.parse(_.FULL_DATE_FORMAT,T,e.i18n.TimeZone.getTimeZone(t))}static getNextNanos(e){var t=parseInt(e,10),r="0".repeat(9-e.length),i="".concat(t+1).concat(r);return parseInt(i,10)}static getNextDate(e,t,r,i){var{year:a,month:s,date:o,hours:l,minutes:u,seconds:c,nanos:d}=r;if(t.nanos!=null){if(t.nanos.length===9)return null;d=_.getNextNanos(t.nanos),d>999999999&&(c+=1,d=0)}else t.seconds!=null?c+=1:t.minutes!=null?u+=1:t.hours!=null?l+=1:t.date!=null?o+=1:t.month!=null?s+=1:a+=1;var h=new Date(a,s,o,l,u,c);return _.makeDateWrapper(e,i,h.getFullYear(),h.getMonth(),h.getDate(),h.getHours(),h.getMinutes(),h.getSeconds(),d)}static parseMonth(e){var t=parseInt(e,10);if(!Number.isNaN(t))return t>=1&&t<=12?t-1:NaN;var r=e.trim().toLowerCase();if(r.length>=3){for(var i=0;i<_.months.length;i+=1)if(_.months[i].startsWith(r))return i}return NaN}static parseDateValues(e,t,r,i,a,s,o){var l=parseInt(e,10),u=t!=null?this.parseMonth(t):0,c=r!=null?parseInt(r,10):1,d=i!=null?parseInt(i,10):0,h=a!=null?parseInt(a,10):0,g=s!=null?parseInt(s,10):0,p=o!=null?parseInt(o.padEnd(9,"0"),10):0;return Number.isNaN(l)||Number.isNaN(u)||Number.isNaN(c)||Number.isNaN(d)||Number.isNaN(h)||Number.isNaN(g)||Number.isNaN(p)?null:{year:l,month:u,date:c,hours:d,minutes:h,seconds:g,nanos:p}}static parseDateTimeString(e){var t=/\s*(\d{4})([-./]([\da-z]+))?([-./](\d{1,2}))?([tT\s](\d{2})([:](\d{2}))?([:](\d{2}))?([.](\d{1,9}))?)?(.*)/,r=t.exec(e);if(r==null)throw new Error("Unexpected date string: ".concat(e));var[,i,,a,,s,,o,,l,,u,,c,d]=r;if(d!=null&&d.length>0)throw new Error("Unexpected characters after date string '".concat(e,"': ").concat(d));return{year:i,month:a,date:s,hours:o,minutes:l,seconds:u,nanos:c}}static parseDateRange(e,t,r){var i=t.trim().toLowerCase();if(i.length===0)throw new Error("Cannot parse date range from empty string");if(i==="null")return[null,null];if(i==="today"){var a=new Date(Date.now()),s=_.makeDateWrapper(e,r,a.getFullYear(),a.getMonth(),a.getDate()),o=new Date(a.getFullYear(),a.getMonth(),a.getDate()+1),l=_.makeDateWrapper(e,r,o.getFullYear(),o.getMonth(),o.getDate());return[s,l]}if(i==="yesterday"){var u=new Date(Date.now()),c=new Date(u.getFullYear(),u.getMonth(),u.getDate()-1),d=_.makeDateWrapper(e,r,c.getFullYear(),c.getMonth(),c.getDate()),h=_.makeDateWrapper(e,r,u.getFullYear(),u.getMonth(),u.getDate());return[d,h]}if(i==="now"){var g=new Date(Date.now()),p=e.DateWrapper.ofJsDate(g);return[p,null]}var y=_.parseDateTimeString(i);if(y.year==null&&y.month==null&&y.date==null)throw new Error("Unable to extract year, month, or day ".concat(i));var E=_.parseDateValues(y.year,y.month,y.date,y.hours,y.minutes,y.seconds,y.nanos);if(E==null)throw new Error("Unable to extract date values from ".concat(y));var T=_.makeDateWrapper(e,r,E.year,E.month,E.date,E.hours,E.minutes,E.seconds,E.nanos),w=_.getNextDate(e,y,E,r);return[T,w]}static getJsDate(e){return typeof e=="number"?new Date(e):e.asDate()}}Dt(_,"FULL_DATE_FORMAT","yyyy-MM-dd HH:mm:ss.SSSSSSSSS");Dt(_,"months",["january","february","march","april","may","june","july","august","september","october","november","december"]);function ji(n,e){return n===e?{operator:"notEq",value:""}:{operator:"eq",value:n}}function _i(n,e,t){return function(i){var a=t.trim();if(a==="")return null;var s=Ot(e,o=>o.filter().containsIgnoreCase(n.makeFilterValue(o.type,a)),"or");return s(i)}}function Ot(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"or";return function(i){var a=i==null?void 0:i.findColumns(typeof n=="string"?[n]:n);if(a==null||a.length===0)return null;var s=a.map(e);return s.reduce((o,l)=>o[t](l))}}function Vn(n,e,t,r){return Ot(e,i=>i.filter()[r](n.makeFilterValue(i.type,t)),"or")}function Vi(n,e,t,r,i){return function(s){var o=s==null?void 0:s.findColumn(e),l=t==="all"||r&&t.size===0;return o==null||l?null:n.makeSelectValueFilter(o,[...t.keys()],i)}}function Hi(n){return function(t){return t.filter().isNull().not().and(t.filter().notEq(n.makeFilterValue(t.type,"")))}}function $i(n,e){return function(r){var i=r.filter(),a=n.makeFilterValue(r.type,""),s=i.eq(a);return e?i.isNull().or(s):s.or(i.notEq(a))}}function We(n,e,t){return e=Hn(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Hn(n){var e=$n(n,"string");return typeof e=="symbol"?e:String(e)}function $n(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class we{}We(we,"not","not");We(we,"and","and");We(we,"or","or");function Wi(n){if(!(n==="not"||n==="and"||n==="or"))throw new Error("operator is not a valid FilterOperatorValue")}function I(n,e,t){return e=Wn(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Wn(n){var e=Bn(n,"string");return typeof e=="symbol"?e:String(e)}function Bn(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class m{}I(m,"eq","eq");I(m,"eqIgnoreCase","eqIgnoreCase");I(m,"notEq","notEq");I(m,"notEqIgnoreCase","notEqIgnoreCase");I(m,"greaterThan","greaterThan");I(m,"greaterThanOrEqualTo","greaterThanOrEqualTo");I(m,"lessThan","lessThan");I(m,"lessThanOrEqualTo","lessThanOrEqualTo");I(m,"in","in");I(m,"inIgnoreCase","inIgnoreCase");I(m,"notIn","notIn");I(m,"notInIgnoreCase","notInIgnoreCase");I(m,"isTrue","isTrue");I(m,"isFalse","isFalse");I(m,"isNull","isNull");I(m,"invoke","invoke");I(m,"contains","contains");I(m,"notContains","notContains");I(m,"containsIgnoreCase","containsIgnoreCase");I(m,"startsWith","startsWith");I(m,"endsWith","endsWith");I(m,"containsAny","containsAny");var ut=G.module("ViewportDataUtils");function qn(n,e){return String(n.offsetInSnapshot+e)}function Bi(n,e){var{bulkUpdate:t}=n;return function(i){var{columns:a,offset:s,rows:o}=i.detail;ut.debug("table updated",i.detail);var l=new Map;o.forEach(u=>{var c=e(u,a),d=qn(u,s);l.set(d,{key:d,item:c})}),ut.debug("update keys",l),t(l)}}function qi(n,e){return e.reduce((t,r)=>(t[r.name]=n.get(r),t),{})}function*Ki(n,e){for(var t=n;t<=e;++t)yield{key:String(t)}}function Kn(n){return n==null||zn(n)?0:n.size}function zn(n){return"isClosed"in n?n.isClosed:!1}function zi(n,e,t,r){var i=n+e-1,[a,s]=[0,r-1],o=ze(n-t,a,s),l=ze(i+t,a,s);return[o,l]}function ct(n,e,t,r,i,a,s){try{var o=n[a](s),l=o.value}catch(u){t(u);return}o.done?e(l):Promise.resolve(l).then(r,i)}function oe(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function s(l){ct(a,r,i,s,o,"next",l)}function o(l){ct(a,r,i,s,o,"throw",l)}s(void 0)})}}function fe(n,e,t){return e=Gn(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Gn(n){var e=Yn(n,"string");return typeof e=="symbol"?e:String(e)}function Yn(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ne=G.module("TableUtils");class f{static copyTableAndApplyFilters(e){var t=arguments;return oe(function*(){if(e==null)return null;for(var r=yield e.copy(),i=t.length,a=new Array(i>1?i-1:0),s=1;s<i;s++)a[s-1]=t[s];return r.applyFilter(xe(...a.map(o=>o(r)))),r})()}static getSortIndex(e,t){for(var r=0;r<e.length;r+=1){var i,a=e[r];if(((i=a.column)===null||i===void 0?void 0:i.name)===t)return r}return null}static getSortForColumn(e,t){var r=f.getSortIndex(e,t);return r!=null?e[r]:null}static getFilterText(e){return e?e.toString():null}static getFilterTypes(e){return f.isBooleanType(e)?[m.isTrue,m.isFalse,m.isNull]:f.isCharType(e)||f.isNumberType(e)||f.isDateType(e)?[m.eq,m.notEq,m.greaterThan,m.greaterThanOrEqualTo,m.lessThan,m.lessThanOrEqualTo]:f.isTextType(e)?[m.eq,m.eqIgnoreCase,m.notEq,m.notEqIgnoreCase,m.contains,m.notContains,m.startsWith,m.endsWith]:[]}static getNextSort(e,t,r){if(r<0||r>=e.length)return null;var i=f.getSortForColumn(t,e[r].name);return i===null?e[r].sort().asc():i.direction===f.sortDirection.ascending?i.desc():null}static makeColumnSort(e,t,r,i){if(t<0||t>=e.length||r===f.sortDirection.none)return null;var a=e[t].sort();switch(r){case f.sortDirection.ascending:a=a.asc();break;case f.sortDirection.descending:a=a.desc();break}return i&&(a=a.abs()),a}static toggleSortForColumn(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(r<0||r>=t.length)return[];var a=f.getNextSort(t,e,r);return f.setSortForColumn(e,t[r].name,a,i)}static sortColumn(e,t,r,i,a,s){if(r<0||r>=t.length)return[];var o=f.makeColumnSort(t,r,i,a);return f.setSortForColumn(e,t[r].name,o,s)}static setSortForColumn(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,a=f.getSortIndex(e,t),s=[];return i&&(s=s.concat(e.filter(o=>{var{direction:l}=o;return l!==f.sortDirection.reverse})),a!==null&&s.splice(a,1)),r!==null&&s.push(r),s}static getNormalizedType(e){switch(e){case"boolean":case"java.lang.Boolean":case f.dataType.BOOLEAN:return f.dataType.BOOLEAN;case"char":case"java.lang.Character":case f.dataType.CHAR:return f.dataType.CHAR;case"java.lang.String":case f.dataType.STRING:return f.dataType.STRING;case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":case"java.time.Instant":case"java.time.ZonedDateTime":case f.dataType.DATETIME:return f.dataType.DATETIME;case"double":case"java.lang.Double":case"float":case"java.lang.Float":case"java.math.BigDecimal":case f.dataType.DECIMAL:return f.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 f.dataType.INT:return f.dataType.INT;default:return f.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"java.time.Instant":case"java.time.ZonedDateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":return!0;default:return!1}}static isNumberType(e){return f.isIntegerType(e)||f.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 isBigDecimalType(e){switch(e){case"java.math.BigDecimal":return!0;default:return!1}}static isBigIntegerType(e){switch(e){case"java.math.BigInteger":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 f.getNormalizedType(e)===f.getNormalizedType(t)}static quoteValue(e){return e.length>=2&&(e.charAt(0)==='"'&&e.charAt(e.length-1)==='"'||e.charAt(0)==="'"&&e.charAt(e.length-1)==="'")?e:'"'.concat(e,'"')}static isRangeOperation(e){switch(e){case"<":case"<=":case"=<":case">":case">=":case"=>":return!0;default:return!1}}static makeRangeFilterWithOperation(e,t,r){switch(t){case"=":return e.eq(r);case"<":return e.lessThan(r);case"<=":case"=<":return e.lessThanOrEqualTo(r);case">":return e.greaterThan(r);case">=":case"=>":return e.greaterThanOrEqualTo(r);case"!=":case"!":return e.notEq(r);default:return null}}static makeCancelableTablePromise(e){return _e.makeCancelable(e,t=>{t.close()})}static makeCancelableTableEventPromise(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,a,s,o=!0,l=new Promise((u,c)=>{s=setTimeout(()=>{a(),o=!1,c(new Pt('Event "'.concat(t,'" timed out.')))},r),a=e.addEventListener(t,d=>{if(i!=null&&!i(d)){ne.debug2("Event triggered, but matcher returned false.");return}ne.debug2("Event triggered, resolving."),a(),clearTimeout(s),o=!1,u(d)})});return l.cancel=()=>{if(o){ne.debug2("Pending promise cleanup."),a(),clearTimeout(s),o=!1;return}ne.debug2("Ignoring non-pending promise cancel.")},l}static removeCommas(e){return e.replace(/[\s|,]/g,"")}static makeBooleanValue(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!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 '".concat(e,"'"))}}static makeNumberValue(e){if(e==="null"||e==="")return null;var t=e.toLowerCase().trim();if(t==="∞"||t==="infinity"||t==="inf")return Number.POSITIVE_INFINITY;if(t==="-∞"||t==="-infinity"||t==="-inf")return Number.NEGATIVE_INFINITY;var r=f.removeCommas(t);if(f.NUMBER_REGEX.test(r))return parseFloat(r);throw new Error("Invalid number '".concat(e,"'"))}static getFilterOperatorString(e){switch(e){case m.eq:return"=";case m.notEq:return"!=";case m.greaterThan:return">";case m.greaterThanOrEqualTo:return">=";case m.lessThan:return"<";case m.lessThanOrEqualTo:return"<=";case m.contains:return"~";case m.notContains:return"!~";default:throw new Error("Unexpected filter type ".concat(e))}}static isTreeTable(e){return e!=null&&e.expand!==void 0&&e.collapse!==void 0}static sortColumns(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return[...e].sort((r,i)=>{var a=r.name.toUpperCase(),s=i.name.toUpperCase();return Tr.sort(a,s,t)})}constructor(e){fe(this,"dh",void 0),this.dh=e,hr(this)}createDistinctSortedColumnTable(e,t,r){var i=arguments,a=this;return oe(function*(){if(e==null)return null;for(var s=e,o=i.length,l=new Array(o>3?o-3:0),u=3;u<o;u++)l[u-3]=i[u];l.length>0&&(s=yield e.copy(),yield s.applyFilter(xe(...l.map(g=>g(s)))));var c=s.findColumn(t),d=yield s.selectDistinct([c]);s!==e&&s.close();var h=d.findColumn(t).sort()[r]();return a.applySort(d,[h])})()}doesColumnValueExist(e,t,r,i){var a=this;return oe(function*(){if(e==null)return null;var s=Vn(a,t,r,i?"eq":"eqIgnoreCase"),o=yield e.copy();yield a.applyFilter(o,xe(s(o)));var l=Kn(o);return o.close(),l>0})()}makeQuickFilter(e,t,r){for(var i=t.split("||"),a=null,s=0;s<i.length;s+=1){for(var o=i[s],l=o.split("&&"),u=null,c=0;c<l.length;c+=1){var d=l[c].trim();if(d.length>0){var h=this.makeQuickFilterFromComponent(e,d,r);if(h)u?u=u.and(h):u=h;else throw new Error("Unable to parse quick filter from text ".concat(t))}}a&&u?a=a.or(u):a=u}return a}makeQuickFilterFromComponent(e,t,r){var{type:i}=e;return f.isNumberType(i)?this.makeQuickNumberFilter(e,t):f.isBooleanType(i)?this.makeQuickBooleanFilter(e,t):r!=null&&f.isDateType(i)?this.makeQuickDateFilter(e,t,r):f.isCharType(i)?this.makeQuickCharFilter(e,t):this.makeQuickTextFilter(e,t)}makeQuickNumberFilter(e,t){var r=e.filter(),{dh:i}=this,a=null,s=/\s*(>=|<=|=>|=<|>|<|!=|=|!)?(\s*-\s*)?(\s*\d*(?:,\d{3})*(?:\.\d*)?\s*)?(null|nan|infinity|inf|\u221E)?(.*)/i,o=s.exec(t),l=null,u=null,c=null,d=null,h=null;if(o!==null&&o.length>3&&([,l,u,c,d,h]=o),h!=null&&h.trim().length>0)return null;if(l==null&&(l="="),d!=null){if(!(l==="="||l==="!"||l==="!="))return null;switch(d=d.trim().toLowerCase(),d){case"null":a=r.isNull();break;case"nan":a=i.FilterCondition.invoke("isNaN",r);break;case"infinity":case"inf":case"∞":u!=null?a=i.FilterCondition.invoke("isInf",r).and(r.lessThan(i.FilterValue.ofNumber(0))):a=i.FilterCondition.invoke("isInf",r).and(r.greaterThan(i.FilterValue.ofNumber(0)));break}return a!==null&&(l==="!"||l==="!=")&&(a=a.not()),a}if(c==null)return null;if(c=f.removeCommas(c),f.isLongType(e.type))try{c=i.FilterValue.ofNumber(i.LongWrapper.ofString("".concat(u!=null?"-":"").concat(c)))}catch(g){return ne.warn("Unable to create long filter",g),null}else{if(c=parseFloat(c),c==null||Number.isNaN(c))return null;c=i.FilterValue.ofNumber(u!=null?0-c:c)}return a=e.filter(),f.makeRangeFilterWithOperation(a,l,c)}static escapeQuickTextFilter(e){var t,r;if(e==null)return null;var i=/^(!~|!=|~|=|!)?(.*)/,a=/^\\*null$/,s=i.exec(e),o=null,l=null;if(s!==null&&s.length>2&&([,o,l]=s),o!=null){var u;return"\\".concat(o).concat((u=l)!==null&&u!==void 0?u:"")}return l!=null&&a.test(l.toLowerCase())||l!=null&&l.startsWith("*")?"\\".concat(l):l!=null&&l.endsWith("*")&&!l.endsWith("\\*")?(l=l.substring(0,l.length-1),"".concat(l,"\\*")):"".concat((t=o)!==null&&t!==void 0?t:"").concat((r=l)!==null&&r!==void 0?r:"")}static unescapeQuickTextFilter(e){var t,r,i=/^(\\!~|\\!=|\\~|\\=|\\!)?(.*)/,a=/^\\*null$/,s=i.exec(e),o=null,l=null;return s!==null&&s.length>2&&([,o,l]=s),o!=null&&(o=o.replace("\\","")),l!=null&&a.test(l.toLowerCase())&&(l=l.replace("\\","")),o==null&&l!=null&&l.startsWith("\\*")&&(l=l.substring(1)),o==null&&l!=null&&l.endsWith("\\*")?(l=l.substring(0,l.length-2),"".concat(l,"*")):"".concat((t=o)!==null&&t!==void 0?t:"").concat((r=l)!==null&&r!==void 0?r:"")}makeQuickTextFilter(e,t){var{dh:r}=this,i="".concat(t).trim(),a=/^(!~|!=|~|=|!)?(.*)/,s=a.exec(i),o=null,l=null;if(s!==null&&s.length>2&&([,o,l]=s,l!=null&&(l=l.trim())),l==null||l.length===0&&!(o==="="||o==="!="))return null;o==null&&(o="=");var u=e.filter();if(l.toLowerCase()==="null")switch(o){case"=":return u.isNull();case"!=":case"!":return u.isNull().not()}var c=null,d=null;switch(l.startsWith("*")?(c="*",l=l.substring(1)):l.endsWith("*")&&!l.endsWith("\\*")&&(d="*",l=l.substring(0,l.length-1)),l=f.unescapeQuickTextFilter(l),o){case"~":return u.isNull().not().and(u.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E.*"))));case"!~":return u.isNull().or(u.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E.*"))).not());case"!=":return c==="*"?u.isNull().or(u.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E$"))).not()):d==="*"?u.isNull().or(u.invoke("matches",r.FilterValue.ofString("(?s)(?i)^\\Q".concat(l,"\\E.*"))).not()):u.notEqIgnoreCase(r.FilterValue.ofString(l.toLowerCase()));case"=":return c==="*"?u.isNull().not().and(u.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E$")))):d==="*"?u.isNull().not().and(u.invoke("matches",r.FilterValue.ofString("(?s)(?i)^\\Q".concat(l,"\\E.*")))):u.eqIgnoreCase(r.FilterValue.ofString(l.toLowerCase()))}return null}makeQuickBooleanFilter(e,t){var r=/^(!=|=|!)?(.*)/,i=r.exec("".concat(t).trim());if(i===null)return null;var[,a,s]=i,o=a==="!"||a==="!=",l=s.trim().toLowerCase(),u=e.filter();try{var c=f.makeBooleanValue(l);return c!=null&&c?u=u.isTrue():c===null?u=u.isNull():u=u.isFalse(),o?u.not():u}catch{return null}}makeQuickDateFilter(e,t,r){var i=t.trim(),a=/\s*(>=|<=|=>|=<|>|<|!=|!|=)?(.*)/,s=a.exec(i);if(s==null||s.length<=2)throw new Error("Unable to parse date filter: ".concat(t));var o=null,l=null;[,o,l]=s;var u=m.eq;switch(o){case"<":u=m.lessThan;break;case"<=":case"=<":u=m.lessThanOrEqualTo;break;case">":u=m.greaterThan;break;case">=":case"=>":u=m.greaterThanOrEqualTo;break;case"!=":case"!":u=m.notEq;break;case"=":case"==":default:u=m.eq;break}return this.makeQuickDateFilterWithOperation(e,l,u,r)}makeQuickDateFilterWithOperation(e,t,r,i){var{dh:a}=this,[s,o]=_.parseDateRange(a,t,i),l=s!=null?a.FilterValue.ofNumber(s):null,u=o!=null?a.FilterValue.ofNumber(o):null,c=e.filter();if(l==null)return r===m.notEq?c.isNull().not():c.isNull();switch(r){case m.eq:{if(u!=null){var d=c.greaterThanOrEqualTo(l),h=c.lessThan(u);return d.and(h)}return c.eq(l)}case m.lessThan:return c.lessThan(l);case m.lessThanOrEqualTo:return u!=null?c.lessThan(u):c.lessThanOrEqualTo(l);case m.greaterThan:return u!=null?c.greaterThanOrEqualTo(u):c.greaterThan(l);case m.greaterThanOrEqualTo:return c.greaterThanOrEqualTo(l);case m.notEq:{if(u!=null){var g=c.lessThan(l),p=c.greaterThanOrEqualTo(u);return g.or(p)}return c.notEq(l)}default:throw new Error("Invalid operator: ".concat(r))}}makeQuickCharFilter(e,t){var{dh:r}=this,i="".concat(t).trim(),a=/^(>=|<=|=>|=<|>|<|!=|=|!)?(null|"."|'.'|.)?(.*)/,s=a.exec(i),o=null,l=null,u=null;if(s!==null&&s.length>3&&([,o,l,u]=s),u!=null&&u.trim().length>0||l==null||l.length===0)return null;o==null&&(o="=");var c=e.filter();if(l.toLowerCase()==="null")switch(o){case"=":return c.isNull();case"!=":case"!":return c.isNull().not();default:return null}var d=r.FilterValue.ofString(f.isRangeOperation(o)?f.quoteValue(l):l);return f.makeRangeFilterWithOperation(c,o,d)}makeAdvancedFilter(e,t,r){for(var{filterItems:i,filterOperators:a,invertSelection:s,selectedValues:o}=t,l=null,u=0;u<i.length;u+=1){var c=i[u],{selectedType:d,value:h}=c;if(d!=null&&d.length>0&&h!=null&&h.length>0)try{var g=this.makeAdvancedValueFilter(e,d,h,r);if(g!=null){if(u===0)l=g;else if(l!==null&&u-1<a.length){var p=a[u-1];if(p===we.and)l=l.and(g);else if(p===we.or)l=l.or(g);else{ne.error("Unexpected filter operator",p,g),l=null;break}}}else ne.debug2("Empty filter ignored for",d,h)}catch(E){ne.error("Unable to create filter",E),l=null;break}}var y=this.makeSelectValueFilter(e,o,s);return y!=null&&(l!=null?l=l.and(y):l=y),l}makeAdvancedValueFilter(e,t,r,i){var{dh:a}=this;if(f.isDateType(e.type))return this.makeQuickDateFilterWithOperation(e,r,t,i);if(f.isNumberType(e.type)||f.isCharType(e.type))return this.makeQuickFilter(e,"".concat(f.getFilterOperatorString(t)).concat(r));var s=this.makeFilterValue(e.type,r),o=e.filter();switch(t){case m.eq:return o.eq(s);case m.eqIgnoreCase:return o.eqIgnoreCase(s);case m.notEq:return o.notEq(s);case m.notEqIgnoreCase:return o.notEqIgnoreCase(s);case m.greaterThan:return o.greaterThan(s);case m.greaterThanOrEqualTo:return o.greaterThanOrEqualTo(s);case m.lessThan:return o.lessThan(s);case m.lessThanOrEqualTo:return o.lessThanOrEqualTo(s);case m.isTrue:return o.isTrue();case m.isFalse:return o.isFalse();case m.isNull:return o.isNull();case m.contains:return o.isNull().not().and(o.invoke("matches",a.FilterValue.ofString("(?s)(?i).*\\Q".concat(r,"\\E.*"))));case m.notContains:return o.isNull().or(o.invoke("matches",a.FilterValue.ofString("(?s)(?i).*\\Q".concat(r,"\\E.*"))).not());case m.startsWith:return o.isNull().not().and(o.invoke("matches",a.FilterValue.ofString("(?s)(?i)^\\Q".concat(r,"\\E.*"))));case m.endsWith:return o.isNull().not().and(o.invoke("matches",a.FilterValue.ofString("(?s)(?i).*\\Q".concat(r,"\\E$"))));case m.in:case m.inIgnoreCase:case m.notIn:case m.notInIgnoreCase:case m.invoke:default:throw new Error("Unexpected filter operation: ".concat(t))}}applyNeverFilter(e,t){var r=arguments,i=this;return oe(function*(){var a=r.length>2&&r[2]!==void 0?r[2]:f.APPLY_TABLE_CHANGE_TIMEOUT_MS;if(e==null)return null;var s=e.findColumn(t),o=[i.makeNeverFilter(s)];return yield i.applyFilter(e,o,a),e})()}applyCustomColumns(e,t){var r=arguments,i=this;return oe(function*(){var a=r.length>2&&r[2]!==void 0?r[2]:f.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:s}=i;return f.executeAndWaitForEvent(o=>o==null?void 0:o.applyCustomColumns(t),e,s.Table.EVENT_CUSTOMCOLUMNSCHANGED,a)})()}applyFilter(e,t){var r=arguments,i=this;return oe(function*(){var a=r.length>2&&r[2]!==void 0?r[2]:f.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:s}=i;return f.executeAndWaitForEvent(o=>o==null?void 0:o.applyFilter(t),e,s.Table.EVENT_FILTERCHANGED,a)})()}applySort(e,t){var r=arguments,i=this;return oe(function*(){var a=r.length>2&&r[2]!==void 0?r[2]:f.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:s}=i;return f.executeAndWaitForEvent(o=>o==null?void 0:o.applySort(t),e,s.Table.EVENT_SORTCHANGED,a)})()}makeNeverFilter(e){var{dh:t}=this,r=null;f.isTextType(e.type)?r=t.FilterValue.ofString("a"):f.isBooleanType(e.type)?r=t.FilterValue.ofBoolean(!0):f.isDateType(e.type)?r=t.FilterValue.ofNumber(t.DateWrapper.ofJsDate(new Date)):r=t.FilterValue.ofNumber(0);var i=e.filter().eq(r),a=e.filter().notEq(r);return i.and(a)}makeFilterValue(e,t){var{dh:r}=this,i=f.getBaseType(e);return f.isTextType(i)?r.FilterValue.ofString(t):f.isLongType(i)?r.FilterValue.ofNumber(r.LongWrapper.ofString(f.removeCommas(t))):r.FilterValue.ofNumber(f.removeCommas(t))}makeFilterRawValue(e,t){var{dh:r}=this;return f.isTextType(e)?r.FilterValue.ofString(t):f.isBooleanType(e)?r.FilterValue.ofBoolean(t):r.FilterValue.ofNumber(t)}makeValue(e,t,r){var{dh:i}=this;if(t==="null")return null;if(f.isTextType(e))return t;if(f.isLongType(e))return i.LongWrapper.ofString(f.removeCommas(t));if(f.isBooleanType(e))return f.makeBooleanValue(t,!0);if(f.isDateType(e)){var[a]=_.parseDateRange(i,t,r);return a}return f.isNumberType(e)?f.makeNumberValue(t):(ne.error("Unexpected column type",e),null)}makeSelectValueFilter(e,t,r){var{dh:i}=this;if(t.length===0)return r?null:this.makeNeverFilter(e);for(var a=[],s=!1,o=0;o<t.length;o+=1){var l=t[o];l==null?s=!0:f.isTextType(e.type)?a.push(i.FilterValue.ofString(typeof l=="number"?String.fromCharCode(l):l)):f.isBooleanType(e.type)?a.push(i.FilterValue.ofBoolean(!!l)):a.push(i.FilterValue.ofNumber(l))}return s?a.length>0?r?e.filter().isNull().not().and(e.filter().notIn(a)):e.filter().isNull().or(e.filter().in(a)):r?e.filter().isNull().not():e.filter().isNull():r?e.filter().notIn(a):e.filter().in(a)}}fe(f,"dataType",{BOOLEAN:"boolean",CHAR:"char",DATETIME:"datetime",DECIMAL:"decimal",INT:"int",STRING:"string",UNKNOWN:"unknown"});fe(f,"sortDirection",{ascending:"ASC",descending:"DESC",reverse:"REVERSE",none:null});fe(f,"APPLY_TABLE_CHANGE_TIMEOUT_MS",3e4);fe(f,"REVERSE_TYPE",Object.freeze({NONE:"none",PRE_SORT:"pre-sort",POST_SORT:"post-sort"}));fe(f,"NUMBER_REGEX",/^-?\d+(\.\d+)?$/);fe(f,"executeAndWaitForEvent",function(){var n=oe(function*(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:f.APPLY_TABLE_CHANGE_TIMEOUT_MS;if(t==null)return null;var a=f.makeCancelableTableEventPromise(t,r,i);return e(t),yield a,t});return function(e,t,r){return n.apply(this,arguments)}}());function De(n,e,t){return e=Xn(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Xn(n){var e=Zn(n,"string");return typeof e=="symbol"?e:String(e)}function Zn(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Be{static makeColumnFormatMap(e){return e==null?new Map:e.reduce((t,r)=>{var i=f.getNormalizedType(r.columnType);if(i===null)return t;t.has(i)||t.set(i,new Map);var a=t.get(i);return a==null||a.set(r.columnName,r.format),t},new Map)}static makeColumnFormattingRule(e,t,r){return{columnType:e,columnName:t,format:r}}constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!1;De(this,"defaultColumnFormatter",void 0),De(this,"typeFormatterMap",void 0),De(this,"columnFormatMap",void 0),De(this,"truncateNumbersWithPound",void 0),this.defaultColumnFormatter=new In,this.typeFormatterMap=new Map([[f.dataType.BOOLEAN,new wn],[f.dataType.CHAR,new Fn],[f.dataType.DATETIME,new J(e,r)],[f.dataType.DECIMAL,new j(e,i)],[f.dataType.INT,new ee(e,a)],[f.dataType.STRING,new kn]]),this.columnFormatMap=Be.makeColumnFormatMap(t),this.truncateNumbersWithPound=s}getColumnFormatMapForType(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=f.getNormalizedType(e);if(r!==null)return t&&!this.columnFormatMap.has(r)&&this.columnFormatMap.set(r,new Map),this.columnFormatMap.get(r)}getColumnFormat(e,t){var r,i=this.getColumnFormatMapForType(e);return(r=i==null?void 0:i.get(t))!==null&&r!==void 0?r:null}getColumnTypeFormatter(e){var t=f.getNormalizedType(e),r=this.defaultColumnFormatter;if(t){var i;r=(i=this.typeFormatterMap.get(t))!==null&&i!==void 0?i:r}return r}getFormattedString(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",i=arguments.length>3?arguments[3]:void 0;if(e==null)return"";var a=this.getColumnTypeFormatter(t),s=i||this.getColumnFormat(t,r);return a.format(e,s??void 0)}get timeZone(){var e,t=this.typeFormatterMap.get(f.dataType.DATETIME);return t==null||(e=t.dhTimeZone)===null||e===void 0?void 0:e.id}}function Qn(n){if(n&&n.formatter){var{formatter:e}=n;return e}}function Un(n){return{timeZone:n==null?void 0:n.timeZone,defaultDateTimeFormatString:n==null?void 0:n.defaultDateTimeFormat,showTimeZone:n==null?void 0:n.showTimeZone,showTSeparator:n==null?void 0:n.showTSeparator}}function Jn(n,e,t){var r=n.getColumnFormat(t,e);return r!=null&&(r.type===B.TYPE_CONTEXT_PRESET||r.type===B.TYPE_CONTEXT_CUSTOM)}const Le={getColumnFormats:Qn,getDateTimeFormatterOptions:Un,isCustomColumnFormatDefined:Jn},ei=typeof Ie=="function"?Ie:Ie.default;wt.register([rr,nr,ir,ar,or,sr]);function q(n,e,t){return e=ti(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ti(n){var e=ri(n,"string");return typeof e=="symbol"?e:String(e)}function ri(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class k{constructor(e){q(this,"dh",void 0),q(this,"listeners",void 0),q(this,"formatter",void 0),q(this,"rect",void 0),q(this,"isDownsamplingDisabled",void 0),q(this,"title",void 0),this.dh=e,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(var t=0;t<this.listeners.length;t+=1)this.listeners[t](e)}fireUpdate(e){this.fireEvent(new CustomEvent(k.EVENT_UPDATED,{detail:e}))}fireDisconnect(){this.fireEvent(new CustomEvent(k.EVENT_DISCONNECT))}fireReconnect(){this.fireEvent(new CustomEvent(k.EVENT_RECONNECT))}fireDownsampleStart(e){this.fireEvent(new CustomEvent(k.EVENT_DOWNSAMPLESTARTED,{detail:e}))}fireDownsampleFinish(e){this.fireEvent(new CustomEvent(k.EVENT_DOWNSAMPLEFINISHED,{detail:e}))}fireDownsampleFail(e){this.fireEvent(new CustomEvent(k.EVENT_DOWNSAMPLEFAILED,{detail:e}))}fireDownsampleNeeded(e){this.fireEvent(new CustomEvent(k.EVENT_DOWNSAMPLENEEDED,{detail:e}))}fireLoadFinished(){this.fireEvent(new CustomEvent(k.EVENT_LOADFINISHED))}fireError(e){this.fireEvent(new CustomEvent(k.EVENT_ERROR,{detail:e}))}}q(k,"EVENT_UPDATED","ChartModel.EVENT_UPDATED");q(k,"EVENT_DISCONNECT","ChartModel.EVENT_DISCONNECT");q(k,"EVENT_RECONNECT","ChartModel.EVENT_RECONNECT");q(k,"EVENT_DOWNSAMPLESTARTED","ChartModel.EVENT_DOWNSAMPLESTARTED");q(k,"EVENT_DOWNSAMPLEFINISHED","ChartModel.EVENT_DOWNSAMPLEFINISHED");q(k,"EVENT_DOWNSAMPLEFAILED","ChartModel.EVENT_DOWNSAMPLEFAILED");q(k,"EVENT_DOWNSAMPLENEEDED","ChartModel.EVENT_DOWNSAMPLENEEDED");q(k,"EVENT_LOADFINISHED","ChartModel.EVENT_LOADFINISHED");q(k,"EVENT_ERROR","ChartModel.EVENT_ERROR");const U=k;function dt(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function me(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?dt(Object(t),!0).forEach(function(r){$(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):dt(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function $(n,e,t){return e=ni(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ni(n){var e=ii(n,"string");return typeof e=="symbol"?e:String(e)}function ii(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Se=G.module("ChartUtils"),ht="io.deephaven.time.DateTime",ai=36e5,oi=1e6;function si(n){return n.asDate!==void 0}function li(n){return n.asNumber!==void 0}function ft(n){return n.dhTimeZone!==void 0}function ui(n){return n!=null&&n.range!=null&&(n.autorange===!1||n.autorange===void 0)}class v{static getPlotlyErrorBars(e,t,r,i){var a=r.map((o,l)=>o-e[l]),s=t.map((o,l)=>e[l]-o);return{type:"data",symmetric:!1,array:a,arrayminus:s,color:i.error_band_line_color}}static convertNumberPrefix(e){return e.replace(/\u00A4\u00A4/g,"USD").replace(/\u00A4/g,"$")}static getPlotlyNumberFormat(e,t,r){if(!r)return null;var i=r.split(";"),a=i[0].match(/^([^#,0.]*)([#,]*)([0,]*)(\.?)(0*)(#*)(E?0*)(%?)(.*)/);Ee(a);var[,s,o,l,,u,c,d,h,g]=a,p=l.replace(",","").length,y=o.indexOf(",")>=0||l.indexOf(",")>=0,E=y?",":"",T=d!=null&&d!==""?"e":"f",w=h!==""?h:T,b=u.length+c.length,P="",M="0".concat(p).concat(E,".").concat(b).concat(P).concat(w),D=v.convertNumberPrefix(s),O=v.convertNumberPrefix(g);return{tickformat:M,tickprefix:D,ticksuffix:O,automargin:!0}}static addTickSpacing(e,t,r){var{gapBetweenMajorTicks:i}=t;if(i>0){var a=e||{},s=i;return r&&(s=i/oi),t.log&&(s=Math.log(s)),a.tickmode="linear",a.dtick=s,a}return e}static getSourceForAxis(e,t){for(var r=0;r<e.series.length;r+=1)for(var i=e.series[r],a=0;a<i.sources.length;a+=1){var s=i.sources[a];if(s.axis===t)return s}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,r,i){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:v.ORIENTATION.VERTICAL;return{type:e,mode:t,name:r,orientation:a,showlegend:i??void 0}}static getMarkerSymbol(e){switch(e){case"SQUARE":return"square";case"CIRCLE":return"circle";case"DIAMOND":return"diamond";case"UP_TRIANGLE":return"triangle-up";case"DOWN_TRIANGLE":return"triangle-down";case"RIGHT_TRIANGLE":return"triangle-right";case"LEFT_TRIANGLE":return"triangle-left";case"ELLIPSE":case"HORIZONTAL_RECTANGLE":case"VERTICAL_RECTANGLE":default:throw new Error("Unrecognized shape ".concat(e))}}static getAllAxes(e){return e.charts.reduce((t,r)=>[...t,...r.axes],[])}static getAxisTypeMap(e){var t=v.getAllAxes(e);return v.groupArray(t,"type")}static getChartForSeries(e,t){for(var{charts:r}=e,i=0;i<r.length;i+=1)for(var a=r[i],s=0;s<a.series.length;s+=1)if(t===a.series[s])return a;return null}static getLayoutRanges(e){for(var t={},r=Object.keys(e).filter(o=>o.indexOf("axis")>=0),i=0;i<r.length;i+=1){var a=r[i],s=e[a];ui(s)&&(t[a]=[...s.range])}return t}static getAxisLayoutProperty(e,t){var r=t>0?"".concat(t+1):"";return"".concat(e??"","axis").concat(r)}static periodToDecimal(e){var t=e.split(":");return Number(t[0])+Number(t[1])/60}static groupArray(e,t){return e.reduce((r,i)=>{var a,s=i[t],o=(a=r.get(s))!==null&&a!==void 0?a:[];return o.push(i),r.set(s,o),r},new Map)}static getColorwayFromTheme(e){var t=[];return e.colorway&&(Array.isArray(e.colorway)?t=e.colorway:typeof e.colorway=="string"?t=e.colorway.split(" "):Se.warn("Unable to handle colorway property: ".concat(e.colorway))),t}static titleFromSettings(e){var{series:t,xAxis:r,title:i="".concat((t??[]).join(", ")," by ").concat(r)}=e;return i}constructor(e){$(this,"dh",void 0),$(this,"daysOfWeek",void 0),this.dh=e,this.daysOfWeek=Object.freeze(e.calendar.DayOfWeek.values())}getAxisFormats(e,t){for(var r=this,i=new Map,a={tickformat:null,ticksuffix:null},s=v.getAllAxes(e),o=v.groupArray(s,"type"),{charts:l}=e,u=0;u<l.length;u+=1)for(var c=l[u],d=0;d<c.series.length;d+=1)for(var h=c.series[d],{sources:g}=h,p=g.filter(w=>w.axis),y=function(){var b=p[E],{axis:P}=b,{type:M}=P,D=o.get(M);Ee(D);var O=D.indexOf(P),x=r.getAxisPropertyName(M);if(x!=null){var L=v.getAxisLayoutProperty(x,O);if(i.has(L))Se.debug("".concat(L," already added."));else{Se.debug("Adding ".concat(L," to axisFormats."));var N=r.getPlotlyAxisFormat(b,t);if(N===null)i.set(L,a);else{i.set(L,N);var{businessCalendar:Y}=P;if(Y!=null){var K=[],{businessPeriods:re,businessDays:Q,holidays:ie,timeZone:de}=Y,ve=t==null?void 0:t.getColumnTypeFormatter(ht),Pe;ft(ve)&&(Pe=ve.dhTimeZone);var Ke=Pe?(de.standardOffset-Pe.standardOffset)/60:0;ie.length>0&&K.push(...r.createRangeBreakValuesFromHolidays(ie,de,Pe)),re.forEach(Fe=>K.push({pattern:"hour",bounds:[v.periodToDecimal(Fe.close)+Ke,v.periodToDecimal(Fe.open)+Ke]})),Q.length<r.daysOfWeek.length&&r.createBoundsFromDays(Q).forEach(Fe=>K.push({pattern:"day of week",bounds:Fe})),N.rangebreaks=K}if(i.size===c.axes.length)return{v:i}}}}},E=0;E<p.length;E+=1){var T=y();if(typeof T=="object")return T.v}return i}getPlotlyChartType(e,t){var{dh:r}=this;switch(e){case r.plot.SeriesPlotStyle.SCATTER:return t?"scatter":"scattergl";case r.plot.SeriesPlotStyle.LINE:return"scatter";case r.plot.SeriesPlotStyle.BAR:case r.plot.SeriesPlotStyle.STACKED_BAR:return"bar";case r.plot.SeriesPlotStyle.PIE:return"pie";case r.plot.SeriesPlotStyle.TREEMAP:return"treemap";case r.plot.SeriesPlotStyle.HISTOGRAM:return"histogram";case r.plot.SeriesPlotStyle.OHLC:return"ohlc";default:return}}getPlotlyChartMode(e,t,r){var{dh:i}=this,a=new Set;switch(e){case i.plot.SeriesPlotStyle.SCATTER:(t??!1)&&a.add(v.MODE_LINES),(r??!0)&&a.add(v.MODE_MARKERS);break;case i.plot.SeriesPlotStyle.LINE:(t??!0)&&a.add(v.MODE_LINES),(r??!1)&&a.add(v.MODE_MARKERS);break}return a.size>0?[...a].join("+"):void 0}getPlotlyProperty(e,t){var{dh:r}=this;switch(e){case r.plot.SeriesPlotStyle.PIE:switch(t){case r.plot.SourceType.X:return"labels";case r.plot.SourceType.Y:return"values"}break;case r.plot.SeriesPlotStyle.OHLC:switch(t){case r.plot.SourceType.TIME:return"x"}break;case r.plot.SeriesPlotStyle.TREEMAP:switch(t){case r.plot.SourceType.X:return"ids";case r.plot.SourceType.Y:return"values";case r.plot.SourceType.LABEL:return"labels";case r.plot.SourceType.PARENT:return"parents";case r.plot.SourceType.COLOR:return"marker.colors"}break}switch(t){case r.plot.SourceType.X:return"x";case r.plot.SourceType.Y:return"y";case r.plot.SourceType.Z:return"z";case r.plot.SourceType.X_LOW:return"xLow";case r.plot.SourceType.X_HIGH:return"xHigh";case r.plot.SourceType.Y_LOW:return"yLow";case r.plot.SourceType.Y_HIGH:return"yHigh";case r.plot.SourceType.TIME:return"time";case r.plot.SourceType.OPEN:return"open";case r.plot.SourceType.HIGH:return"high";case r.plot.SourceType.LOW:return"low";case r.plot.SourceType.CLOSE:return"close";case r.plot.SourceType.SHAPE:return"shape";case r.plot.SourceType.SIZE:return"size";case r.plot.SourceType.LABEL:return"label";case r.plot.SourceType.COLOR:return"color";case r.plot.SourceType.PARENT:return"parent";case r.plot.SourceType.HOVER_TEXT:return"hovertext";case r.plot.SourceType.TEXT:return"text";default:throw new Error("Unrecognized source type: ".concat(t))}}getPlotlySeriesOrientation(e){var t,r,{dh:i}=this,{sources:a}=e;return a.length===2&&((t=a[0])===null||t===void 0||(r=t.axis)===null||r===void 0?void 0:r.type)===i.plot.AxisType.Y?v.ORIENTATION.HORIZONTAL:v.ORIENTATION.VERTICAL}makeSeriesDataFromSeries(e,t,r,i){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:null,{name:s,isLinesVisible:o,isShapesVisible:l,plotStyle:u,lineColor:c,shapeColor:d,sources:h,shape:g,shapeSize:p}=e,y=h.some(P=>{var M;return(M=P.axis)===null||M===void 0?void 0:M.businessCalendar}),E=this.getChartType(u,y),T=this.getPlotlyChartMode(u,o??void 0,l??void 0),w=this.getPlotlySeriesOrientation(e),b=v.makeSeriesData(E,T,s,a,w);return this.addSourcesToSeriesData(b,u,h,t),this.addStylingToSeriesData(b,u,i,c,d,g,p,r),b}addSourcesToSeriesData(e,t,r,i){for(var a=e,s=0;s<r.length;s+=1){var o=r[s],{axis:l,type:u}=o,c=this.getPlotlyProperty(t,u);bt(a,c,[]);var d=l!=null?this.getAxisPropertyName(l.type):null;if(d!=null){var h=i.get(l.type);if(h){var g=h.indexOf(l),p=g>0?"".concat(g+1):"";a["".concat(d,"axis")]="".concat(d).concat(p)}}}}addStylingToSeriesData(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:null,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null,o=arguments.length>6&&arguments[6]!==void 0?arguments[6]:null,l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:null,{dh:u}=this,c=e;if(c.marker={line:{}},c.line={width:1},t===u.plot.SeriesPlotStyle.AREA?c.fill="tozeroy":t===u.plot.SeriesPlotStyle.STACKED_AREA?c.stackgroup="stack":t===u.plot.SeriesPlotStyle.STEP?c.line.shape="hv":t===u.plot.SeriesPlotStyle.HISTOGRAM?(c.width=[],c.marker.line!==void 0&&Object.assign(c.marker.line,{color:r.paper_bgcolor,width:1})):t===u.plot.SeriesPlotStyle.OHLC?(c.increasing={line:{color:r.ohlc_increasing}},c.decreasing={line:{color:r.ohlc_decreasing}}):t===u.plot.SeriesPlotStyle.PIE?(c.textinfo="label+percent",c.outsidetextfont={color:r.title_color}):t===u.plot.SeriesPlotStyle.TREEMAP&&(c.hoverinfo="text",c.textinfo="label+text",c.tiling={packing:"squarify",pad:0},c.textposition="middle center",c.outsidetextfont={color:r.title_color}),i!=null&&(t===u.plot.SeriesPlotStyle.BAR?c.marker.color=i:c.line.color=i),a!=null&&(c.marker.color=a),s!=null&&s.length>0)try{c.marker.symbol=v.getMarkerSymbol(s)}catch(d){Se.warn("Unable to handle shape",s,":",d)}o!=null&&(c.marker.size=o*v.DEFAULT_MARKER_SIZE),l!=null&&t!==u.plot.SeriesPlotStyle.PIE&&(c.visible=l)}getChartType(e,t){var{dh:r}=this;switch(e){case r.plot.SeriesPlotStyle.HISTOGRAM:return"bar";default:return this.getPlotlyChartType(e,t)}}getAxisPropertyName(e){var{dh:t}=this;switch(e){case t.plot.AxisType.X:return"x";case t.plot.AxisType.Y:return"y";default:return null}}getAxisSide(e){var{dh:t}=this;switch(e){case t.plot.AxisPosition.BOTTOM:return"bottom";case t.plot.AxisPosition.TOP:return"top";case t.plot.AxisPosition.LEFT:return"left";case t.plot.AxisPosition.RIGHT:return"right";default:return}}updateFigureAxes(e,t,r,i){for(var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0,o=e,l=v.getAllAxes(t),u=0;u<t.charts.length;u+=1){var c=t.charts[u],d=i==null?void 0:i(c),h=this.getChartBounds(t,c,a,s);this.updateLayoutAxes(o,c.axes,l,r,a,s,h,d)}this.removeStaleAxes(o,l)}getChartBounds(e,t,r,i){var a,{dh:s}=this,{cols:o,rows:l}=e,{column:u,colspan:c,row:d,rowspan:h}=t,g=u+c,p=d+h,y=1/o,E=1/l,T=v.AXIS_SIZE_PX/r,w=v.AXIS_SIZE_PX/i,b={bottom:(l-p)*E+(p<l?w/2:0),top:(l-d)*E-(d>0?w/2:0),left:u*y+(u>0?T/2:0),right:g*y-(g<o?T/2:0)},P=v.groupArray(t.axes,"position"),M=(a=P.get(s.plot.AxisPosition.RIGHT))!==null&&a!==void 0?a:[];return M.length>0&&(r>0?b.right-=(b.right-b.left)*Math.max(0,Math.min(v.LEGEND_WIDTH_PX/r,v.MAX_LEGEND_SIZE)):b.right-=(b.right-b.left)*v.DEFAULT_AXIS_SIZE),b}getPlotlyDateFormat(e,t,r){var{dh:i}=this,a=r==null?void 0:r.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",""),s,o=e==null?void 0:e.getColumnTypeFormatter(t);return o!=null&&ft(o)&&o.dhTimeZone!=null&&o.showTimeZone&&(s=i.i18n.DateTimeFormat.format(" z",new Date,o.dhTimeZone)),{tickformat:a,ticksuffix:s,automargin:!0}}getPlotlyAxisFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,{dh:r}=this,{axis:i,columnType:a}=e,{formatPattern:s}=i,o=null;return f.isDateType(a)?(o=this.getPlotlyDateFormat(t,a,s),o=v.addTickSpacing(o,i,!0)):f.isNumberType(a)&&(o=v.getPlotlyNumberFormat(t,a,s),o=v.addTickSpacing(o,i,!1)),i.formatType===r.plot.AxisFormatType.CATEGORY&&(o?o.type="category":o={type:"category",tickformat:void 0,ticksuffix:void 0}),o}updateLayoutAxes(e,t,r,i){for(var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0,o=arguments.length>6&&arguments[6]!==void 0?arguments[6]:{left:0,top:0,right:1,bottom:1},l=arguments.length>7?arguments[7]:void 0,{dh:u}=this,c=a>0?Math.max(v.MIN_AXIS_SIZE,Math.min(v.AXIS_SIZE_PX/s,v.MAX_AXIS_SIZE)):v.DEFAULT_AXIS_SIZE,d=s>0?Math.max(v.MIN_AXIS_SIZE,Math.min(v.AXIS_SIZE_PX/a,v.MAX_AXIS_SIZE)):v.DEFAULT_AXIS_SIZE,h=e,g=v.groupArray(t,"position"),p=v.groupArray(t,"type"),y=[...p.keys()],E=v.groupArray(r,"type"),T=0;T<y.length;T+=1){var w=y[T],b=this.getAxisPropertyName(w);if(b!=null){var P=p.get(w),M=E.get(w),D=w===u.plot.AxisType.Y,O=D?s:a;Ee(P),Ee(M);for(var x=0;x<P.length;x+=1){var L=P[x],N=M.indexOf(L),Y=v.getAxisLayoutProperty(b,N);h[Y]==null&&(h[Y]=this.makeLayoutAxis(w,i));var K=h[Y];if(K!=null){this.updateLayoutAxis(K,L,x,g,c,d,o);var{range:re,autorange:Q}=K;if(l!=null&&re!==void 0&&(Q===void 0||Q===!1)){var ie=l(L),[de,ve]=ie(re);Se.debug("Setting downsample range",O,de,ve),L.range(O,de,ve)}else L.range(O)}}}}}removeStaleAxes(e,t){for(var r=e,i=v.groupArray(t,"type"),a=[...i.keys()],s=0;s<a.length;s+=1){var o=a[s],l=i.get(o);Ee(l);var u=l.length,c=this.getAxisPropertyName(o);if(c!=null)for(var d=v.getAxisLayoutProperty(c,u);r[d]!=null;)delete r[d],u+=1,d=v.getAxisLayoutProperty(c,u)}}updateLayoutAxis(e,t,r,i,a,s,o){var l,{dh:u}=this,c=t.type===u.plot.AxisType.Y,d=c?s:a,h=e,g=(l=t.label)!==null&&l!==void 0?l:"";if(h.title!==void 0&&typeof h.title!="string"?h.title.text=g:h.title={text:g},t.log&&(h.type="log"),h.side=this.getAxisSide(t.position),r>0){var p,y;h.overlaying=(p=this.getAxisPropertyName(t.type))!==null&&p!==void 0?p:void 0;var E=(y=i.get(t.position))!==null&&y!==void 0?y:[],T=E.indexOf(t);T>0&&(h.anchor="free",t.position===u.plot.AxisPosition.RIGHT?h.position=o.right+(T-E.length+1)*d:t.position===u.plot.AxisPosition.TOP?h.position=o.top+(T-E.length+1)*d:t.position===u.plot.AxisPosition.BOTTOM?h.position=o.bottom+(E.length-T+1)*d:t.position===u.plot.AxisPosition.LEFT&&(h.position=o.left+(E.length-T+1)*d))}else if(t.type===u.plot.AxisType.X){var w=i.get(u.plot.AxisPosition.LEFT)||[],b=i.get(u.plot.AxisPosition.RIGHT)||[],P=Math.max(o.left,o.left+(w.length-1)*s),M=Math.min(o.right-(b.length-1)*s,o.right);h.domain=[P,M]}else if(t.type===u.plot.AxisType.Y){var D=i.get(u.plot.AxisPosition.BOTTOM)||[],O=i.get(u.plot.AxisPosition.TOP)||[],x=Math.max(o.bottom,o.bottom+(D.length-1)*a),L=Math.min(o.top-(O.length-1)*a,o.top);h.domain=[x,L]}}createBoundsFromDays(e){var t=e.map(s=>this.daysOfWeek.indexOf(s)),r=this.daysOfWeek.filter(s=>!e.includes(s)).map(s=>this.daysOfWeek.indexOf(s)),i=new Set;r.forEach(s=>{for(var o=s+1;o<s+this.daysOfWeek.length;o+=1){var l=o%this.daysOfWeek.length;if(t.includes(l)){i.add(l);break}}});var a=[];return i.forEach(s=>{for(var o=s-1;o>s-this.daysOfWeek.length;o-=1){var l=o<0?o+this.daysOfWeek.length:o;if(t.includes(l)){var u=(l+1)%7;a.push([u,s]);break}}}),a}createRangeBreakValuesFromHolidays(e,t,r){var i=[],a=[];return e.forEach(s=>{s.businessPeriods.length>0?a.push(...this.createPartialHoliday(s,t,r)):i.push(this.createFullHoliday(s,t,r))}),[{values:i},...a]}createFullHoliday(e,t,r){return this.adjustDateForTimeZone("".concat(e.date.toString()," 00:00:00.000000"),t,r)}createPartialHoliday(e,t,r){var i=e.date.toString(),a=["00:00"];e.businessPeriods.forEach(h=>{a.push(h.open),a.push(h.close)}),a.push("24:00");for(var s=[],o=0;o<a.length;o+=2){var l=a[o],u=a[o+1];if(l!==u){var c=[this.adjustDateForTimeZone("".concat(i," ").concat(l,":00.000000"),t,r)],d=ai*(v.periodToDecimal(u)-v.periodToDecimal(l));s.push({values:c,dvalue:d})}}return s}adjustDateForTimeZone(e,t,r){return r&&r.standardOffset!==t.standardOffset?this.unwrapValue(this.wrapValue(e,ht,t),r):e}makeFigureSettings(e,t){var{dh:r}=this,{series:i,xAxis:a,type:s}=e,o=v.titleFromSettings(e),l={formatType:"".concat(r.plot.AxisFormatType.NUMBER),type:"".concat(r.plot.AxisType.X),position:"".concat(r.plot.AxisPosition.BOTTOM)},u={formatType:"".concat(r.plot.AxisFormatType.NUMBER),type:"".concat(r.plot.AxisType.Y),position:"".concat(r.plot.AxisPosition.LEFT)};return{charts:[{chartType:"".concat(r.plot.ChartType.XY),axes:[l,u],series:(i??[]).map(c=>({plotStyle:"".concat(s),name:c,dataSources:[{type:"".concat(r.plot.SourceType.X),columnName:a??"",axis:l,table:t},{type:"".concat(r.plot.SourceType.Y),columnName:c,axis:u,table:t}]}))}],title:o}}unwrapValue(e,t){var{dh:r}=this;if(e!=null){if(si(e))return r.i18n.DateTimeFormat.format(v.DATE_FORMAT,e,t);if(li(e))return e.asNumber()}return e}wrapValue(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,{dh:i}=this;if(f.isDateType(t)&&typeof e=="string"){var a=e,s=v.DATE_FORMAT.substr(0,e.length),o=i.i18n.DateTimeFormat.parse(s,a);if(!r)return o;var l="".concat(s," Z"),u=i.i18n.DateTimeFormat.format("Z",o,r),c=i.i18n.DateTimeFormat.parse(l,"".concat(a," ").concat(u)),d=i.i18n.DateTimeFormat.format("Z",c,r);return i.i18n.DateTimeFormat.parse(l,"".concat(a," ").concat(d))}return e}makeLayoutAxis(e,t){var{dh:r}=this,i={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===r.plot.AxisType.X?Object.assign(i,{showgrid:!0}):e===r.plot.AxisType.Y&&Object.assign(i,{zerolinecolor:t.zerolinecolor,zerolinewidth:2}),i}makeDefaultLayout(e){var{dh:t}=this,r=me(me({},e),{},{autosize:!0,colorway:v.getColorwayFromTheme(e),font:{family:"'Fira Sans', sans-serif",color:e.title_color},title:{font:{color:e.title_color},yanchor:"top",pad:me({},v.DEFAULT_TITLE_PADDING),y:1},legend:{font:{color:e.title_color}},margin:me({},v.DEFAULT_MARGIN),xaxis:this.makeLayoutAxis(t.plot.AxisType.X,e),yaxis:this.makeLayoutAxis(t.plot.AxisType.Y,e),polar:{angularaxis:this.makeLayoutAxis(t.plot.AxisType.SHAPE,e),radialaxis:this.makeLayoutAxis(t.plot.AxisType.SHAPE,e),bgcolor:e.plot_bgcolor},scene:{xaxis:this.makeLayoutAxis(t.plot.AxisType.X,e),yaxis:this.makeLayoutAxis(t.plot.AxisType.Y,e),zaxis:this.makeLayoutAxis(t.plot.AxisType.Z,e)}});return r.datarevision=0,r}hydrateSettings(e){var{dh:t}=this;return me(me({},e),{},{type:e.type!=null?t.plot.SeriesPlotStyle[e.type]:void 0})}}$(v,"DEFAULT_AXIS_SIZE",.15);$(v,"MIN_AXIS_SIZE",.025);$(v,"MAX_AXIS_SIZE",.2);$(v,"AXIS_SIZE_PX",75);$(v,"LEGEND_WIDTH_PX",50);$(v,"MAX_LEGEND_SIZE",.25);$(v,"ORIENTATION",Object.freeze({HORIZONTAL:"h",VERTICAL:"v"}));$(v,"DATE_FORMAT","yyyy-MM-dd HH:mm:ss.SSSSSS");$(v,"DEFAULT_MARGIN",Object.freeze({l:60,r:50,t:30,b:60,pad:0}));$(v,"DEFAULT_TITLE_PADDING",Object.freeze({t:8}));$(v,"SUBTITLE_LINE_HEIGHT",25);$(v,"DEFAULT_MARKER_SIZE",6);$(v,"MODE_MARKERS","markers");$(v,"MODE_LINES","lines");const z=v;function ci(n,e,t){return e=di(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function di(n){var e=hi(n,"string");return typeof e=="symbol"?e:String(e)}function hi(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class fi extends Error{constructor(){super(...arguments),ci(this,"isDownsamplingError",!0)}}const mi=fi;function mt(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function pt(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?mt(Object(t),!0).forEach(function(r){W(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):mt(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function W(n,e,t){return e=pi(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function pi(n){var e=vi(n,"string");return typeof e=="symbol"?e:String(e)}function vi(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ae=G.module("Chart");class ce extends C.Component{static convertIcon(e){var[t,,,,r]=e.icon,i="".concat(r);return{width:t,path:i,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"}constructor(e){var t;super(e),W(this,"currentSeries",void 0),W(this,"PlotComponent",void 0),W(this,"plot",void 0),W(this,"plotWrapper",void 0),W(this,"columnFormats",void 0),W(this,"dateTimeFormatterOptions",void 0),W(this,"decimalFormatOptions",void 0),W(this,"integerFormatOptions",void 0),W(this,"rect",void 0),W(this,"ranges",void 0),W(this,"isSubscribed",void 0),W(this,"isLoadedFired",void 0),W(this,"resizeObserver",void 0),W(this,"getCachedConfig",kt((r,i,a,s,o,l)=>{var u=[],c=!!r;c&&u.push({name:"Downsampling failed: ".concat(r),title:"Downsampling failed",click:()=>{this.toggleErrorMessage("".concat(r))},icon:ce.convertIcon(Ge),attr:"fill-warning"});var d=!!l;if(d&&u.push({name:"Error: ".concat(l),title:"Error",click:()=>{this.toggleErrorMessage("".concat(l))},icon:ce.convertIcon(Ge),attr:"fill-warning"}),i||a||s||c){var h=ce.downsampleButtonTitle(a,s),g=ce.downsampleButtonAttr(a,s),p=a?Qt:Ut;u.push({name:h,title:"Downsampling status",icon:ce.convertIcon(p),click:this.handleDownsampleClick,attr:g})}var y=o.some(b=>{var{type:P}=b;return P!=null&&!P.includes("3d")}),E=o.some(b=>{var{type:P}=b;return P!=null&&P.includes("3d")}),T=["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"],w=["orbitRotation","tableRotation","resetCameraDefault3d"];return{displaylogo:!1,displayModeBar:a||c||d?!0:"hover",modeBarButtons:[u,["toImage"],["zoom2d","pan2d"],[...y?T:[],...E?w:[]]]}})),this.handleAfterPlot=this.handleAfterPlot.bind(this),this.handleDownsampleClick=this.handleDownsampleClick.bind(this),this.handleErrorClose=this.handleErrorClose.bind(this),this.handleModelEvent=this.handleModelEvent.bind(this),this.handlePlotUpdate=this.handlePlotUpdate.bind(this),this.handleRelayout=this.handleRelayout.bind(this),this.handleResize=this.handleResize.bind(this),this.handleRestyle=this.handleRestyle.bind(this),this.PlotComponent=ei(e.Plotly),this.plot=V.createRef(),this.plotWrapper=(t=e.containerRef)!==null&&t!==void 0?t:V.createRef(),this.columnFormats=[],this.dateTimeFormatterOptions={},this.decimalFormatOptions={},this.integerFormatOptions={},this.isSubscribed=!1,this.isLoadedFired=!1,this.currentSeries=0,this.resizeObserver=new window.ResizeObserver(this.handleResize),this.state={data:null,downsamplingError:null,isDownsampleFinished:!1,isDownsampleInProgress:!1,isDownsamplingDisabled:!1,error:null,shownError:null,layout:{datarevision:0},revision:0}}componentDidMount(){this.updateDimensions(),this.updateModelDimensions(),this.initData(),this.initFormatter();var{isActive:e,model:t}=this.props;e&&this.subscribe(t),this.plotWrapper.current!=null&&this.resizeObserver.observe(this.plotWrapper.current)}componentDidUpdate(e){var{isActive:t,model:r,settings:i}=this.props;this.updateFormatterSettings(i),r!==e.model&&(this.unsubscribe(e.model),this.subscribe(r)),t!==e.isActive&&(t?(this.updateDimensions(),this.subscribe(r)):this.unsubscribe(r))}componentWillUnmount(){var{model:e}=this.props;this.unsubscribe(e),this.resizeObserver.disconnect()}getPlotRect(){var e,t;return(e=(t=this.plotWrapper.current)===null||t===void 0?void 0:t.getBoundingClientRect())!==null&&e!==void 0?e:null}initData(){var{model:e}=this.props,{layout:t}=this.state;this.setState({data:e.getData(),layout:pt(pt({},t),e.getLayout())})}subscribe(e){if(!this.isSubscribed){if(!this.rect||this.rect.width===0||this.rect.height===0){ae.debug2("Delaying subscription until model dimensions are set");return}e.subscribe(this.handleModelEvent),this.isSubscribed=!0}}unsubscribe(e){this.isSubscribed&&(e.unsubscribe(this.handleModelEvent),this.isSubscribed=!1)}handleAfterPlot(){this.plot.current!=null}handleDownsampleClick(){this.setState(e=>{var{isDownsamplingDisabled:t}=e;return{downsamplingError:null,isDownsampleInProgress:!1,isDownsampleFinished:!1,isDownsamplingDisabled:!t}},()=>{var{model:e}=this.props,{isDownsamplingDisabled:t}=this.state;e.setDownsamplingDisabled(t)})}handleErrorClose(){this.setState({shownError:null})}handleModelEvent(e){var{type:t,detail:r}=e;switch(ae.debug2("Received data update",t,r),t){case U.EVENT_UPDATED:{this.currentSeries+=1,this.setState(g=>{var{layout:p,revision:y}=g;return typeof p.datarevision=="number"&&(p.datarevision+=1),{data:r,layout:p,revision:y+1}});var{onUpdate:i}=this.props;i({isLoading:!this.isLoadedFired});break}case U.EVENT_LOADFINISHED:{var{onUpdate:a}=this.props;this.isLoadedFired=!0,a({isLoading:!1});break}case U.EVENT_DISCONNECT:{var{onDisconnect:s}=this.props;s();break}case U.EVENT_RECONNECT:{var{onReconnect:o}=this.props;o();break}case U.EVENT_DOWNSAMPLESTARTED:{this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!0,downsamplingError:null});break}case U.EVENT_DOWNSAMPLEFINISHED:{this.setState({isDownsampleFinished:!0,isDownsampleInProgress:!1,downsamplingError:null});break}case U.EVENT_DOWNSAMPLENEEDED:case U.EVENT_DOWNSAMPLEFAILED:{var l,u=(l=r.message)!==null&&l!==void 0?l:r;this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!1,isDownsamplingDisabled:!1,downsamplingError:u});var{onError:c}=this.props;c(new mi(u));break}case U.EVENT_ERROR:{var d="".concat(r);this.setState({error:d});var{onError:h}=this.props;h(new Error(d));break}default:ae.debug("Unknown event type",t,e)}}handlePlotUpdate(e){var{layout:t}=e,r=z.getLayoutRanges(t),i=!ge(r,this.ranges);i&&(this.ranges=r,this.updateModelDimensions(!0))}handleRelayout(e){if(ae.debug("handleRelayout",e),e.hiddenlabels!=null){var{onSettingsChanged:t}=this.props,r=[...e.hiddenlabels];t({hiddenSeries:r})}this.updateModelDimensions()}handleResize(){this.updateDimensions()}handleRestyle(e){var[t,r]=e;if(ae.debug("handleRestyle",t,r),Object.keys(t).includes("visible")){var{data:i}=this.state,{onSettingsChanged:a}=this.props;if(i!=null){var s=i.reduce((o,l)=>{var{name:u,visible:c}=l;return u!=null&&c==="legendonly"?[...o,u]:o},[]);a({hiddenSeries:s})}}}toggleErrorMessage(e){this.setState(t=>{var{shownError:r}=t;return{shownError:r===e?null:e}})}updateModelDimensions(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.getPlotRect();if(!t){ae.warn("Unable to get plotting rect");return}var r=!this.rect||this.rect.width!==t.width||this.rect.height!==t.height;if(r||e){this.rect=t;var{isActive:i,model:a}=this.props;a.setDimensions(t),i&&this.subscribe(a)}}initFormatter(){var{settings:e}=this.props;this.updateFormatterSettings(e)}updateFormatterSettings(e){var t=Le.getColumnFormats(e),r=Le.getDateTimeFormatterOptions(e),{decimalFormatOptions:i={},integerFormatOptions:a={}}=e;(!ge(this.columnFormats,t)||!ge(this.dateTimeFormatterOptions,r)||!ge(this.decimalFormatOptions,i)||!ge(this.integerFormatOptions,a))&&(this.columnFormats=Le.getColumnFormats(e),this.dateTimeFormatterOptions=r,this.decimalFormatOptions=i,this.integerFormatOptions=a,this.updateFormatter())}updateFormatter(){var{model:e}=this.props,t=new Be(e.dh,this.columnFormats,this.dateTimeFormatterOptions,this.decimalFormatOptions,this.integerFormatOptions);e.setFormatter(t)}updateDimensions(){var e=this.getPlotRect(),{Plotly:t}=this.props;this.plot.current!=null&&e!=null&&e.width>0&&e.height>0&&t.relayout(this.plot.current.el,{autosize:!0}).catch(r=>{ae.debug("Unable to resize, promise rejected",r)})}render(){var{PlotComponent:e}=this,{data:t,downsamplingError:r,isDownsampleFinished:i,isDownsampleInProgress:a,isDownsamplingDisabled:s,error:o,shownError:l,layout:u,revision:c}=this.state,d=this.getCachedConfig(r,i,a,s,t??[],o),h=t!=null;return S.jsxs("div",{className:"h-100 w-100 chart-wrapper",ref:this.plotWrapper,children:[h&&S.jsx(e,{ref:this.plot,data:t,layout:u,revision:c,config:d,onAfterPlot:this.handleAfterPlot,onError:ae.error,onRelayout:this.handleRelayout,onUpdate:this.handlePlotUpdate,onRestyle:this.handleRestyle,useResizeHandler:!0,style:{height:"100%",width:"100%"}}),S.jsx(Ft,{className:"chart-error-popper",options:{placement:"top"},isShown:l!=null,onExited:this.handleErrorClose,closeOnBlur:!0,interactive:!0,children:l!=null&&S.jsxs(S.Fragment,{children:[S.jsx("div",{className:"chart-error",children:l}),S.jsx(tn,{tooltip:"Copy Error",copy:l,children:"Copy Error"})]})})]})}}W(ce,"defaultProps",{isActive:!0,settings:{timeZone:"America/New_York",defaultDateTimeFormat:_.FULL_DATE_FORMAT,showTimeZone:!1,showTSeparator:!0,formatter:[]},Plotly:wt,onDisconnect:()=>{},onReconnect:()=>{},onUpdate:()=>{},onError:()=>{},onSettingsChanged:()=>{}});const Gi=ce;function vt(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function gt(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?vt(Object(t),!0).forEach(function(r){A(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):vt(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function A(n,e,t){return e=gi(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function gi(n){var e=yi(n,"string");return typeof e=="symbol"?e:String(e)}function yi(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var H=G.module("FigureChartModel");class Ce extends U{constructor(e,t,r){var i,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(e),i=this,A(this,"chartUtils",void 0),A(this,"dh",void 0),A(this,"figure",void 0),A(this,"settings",void 0),A(this,"theme",void 0),A(this,"data",void 0),A(this,"layout",void 0),A(this,"seriesDataMap",void 0),A(this,"pendingSeries",void 0),A(this,"oneClicks",void 0),A(this,"filterColumnMap",void 0),A(this,"lastFilter",void 0),A(this,"isConnected",void 0),A(this,"seriesToProcess",void 0),A(this,"addPendingSeries",jt(()=>{for(var o=z.getAxisTypeMap(this.figure),{pendingSeries:l}=this,u=function(){var h,g=l[c],p=i.figure.charts.find(y=>y.series.includes(g));i.addSeries(g,o,(h=p==null?void 0:p.showLegend)!==null&&h!==void 0?h:null),g.subscribe()},c=0;c<l.length;c+=1)u();this.pendingSeries=[]},Ce.ADD_SERIES_DEBOUNCE)),A(this,"getTimeZone",ye((o,l)=>{if(l!=null){var u=l.getColumnTypeFormatter(o);if(u!=null)return u.dhTimeZone}})),A(this,"getValueTranslator",ye((o,l)=>{var u=this.getTimeZone(o,l);return c=>this.chartUtils.unwrapValue(c,u)})),A(this,"getValueParser",ye((o,l)=>{var u=this.getTimeZone(o,l);return c=>this.chartUtils.wrapValue(c,o,u)})),A(this,"getRangeParser",ye((o,l)=>u=>{var[c,d]=u,h=this.getValueParser(o,l);return c=h(c),d=h(d),[c,d]})),A(this,"getAxisRangeParser",ye((o,l)=>u=>{var c=z.getSourceForAxis(o,u);return c!=null?this.getRangeParser(c.columnType,l):d=>d})),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.dh=e,this.chartUtils=new z(e),this.figure=t,this.settings=a,this.theme=r,this.data=[];var s={data:{},layout:this.chartUtils.makeDefaultLayout(r)};this.layout={grid:{rows:t.rows,columns:t.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(){if(this.figure.title!=null&&this.figure.title.length>0)return this.figure.title;if(this.figure.charts.length===1){var e;return(e=this.figure.charts[0].title)!==null&&e!==void 0?e:""}return""}initAllSeries(){var e=this;this.oneClicks=[],this.filterColumnMap.clear();for(var{charts:t}=this.figure,r=z.getAxisTypeMap(this.figure),i=[],a=function(){for(var h=t[s],g=0;g<h.series.length;g+=1){var p=h.series[g];i.push(p.name),e.addSeries(p,r,h.showLegend)}var{axes:y,title:E}=h;if(E!=null&&E.length>0&&(t.length>1||e.figure.title!=null)){var T=y.find(N=>N.type===e.dh.plot.AxisType.X),w=y.find(N=>N.type===e.dh.plot.AxisType.Y);if(T==null||w==null)H.warn("Chart title provided, but unknown how to map to the correct axes for this chart type",h);else{var b,P,M,D,O=((b=(P=r.get(T.type))===null||P===void 0?void 0:P.findIndex(N=>N===T))!==null&&b!==void 0?b:0)+1,x=((M=(D=r.get(w.type))===null||D===void 0?void 0:D.findIndex(N=>N===w))!==null&&M!==void 0?M:0)+1,L={align:"center",x:.5,y:1,yshift:17,text:E,showarrow:!1,xref:"x".concat(O," domain"),yref:"y".concat(x," domain")};e.layout.annotations==null?e.layout.annotations=[L]:e.layout.annotations.push(L)}}},s=0;s<t.length;s+=1)a();for(var o=[...this.seriesDataMap.keys()],l=o.filter(d=>i.indexOf(d)<0),u=0;u<l.length;u+=1){var c=l[u];this.seriesDataMap.delete(c)}this.seriesToProcess=new Set([...this.seriesDataMap.keys()])}addSeries(e,t,r){var{dh:i}=this,a=this.chartUtils.makeSeriesDataFromSeries(e,t,z.getSeriesVisibility(e.name,this.settings),this.theme,r);if(this.seriesDataMap.set(e.name,a),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=z.getHiddenLabels(this.settings)),this.layout.showlegend=this.data.length>1||e.plotStyle===i.plot.SeriesPlotStyle.PIE?r??void 0:!1,e.oneClick!=null){for(var{oneClick:s}=e,{columns:o}=s,l=0;l<o.length;l+=1)this.filterColumnMap.set(o[l].name,o[l]);this.oneClicks.push(s)}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){H.debug("Ignoring subscribe when figure in disconnected state");return}this.figure.subscribe(this.isDownsamplingDisabled?this.dh.plot.DownsampleOptions.DISABLE:this.dh.plot.DownsampleOptions.DEFAULT),this.figure.errors.length>0&&(H.error("Errors in figure",this.figure.errors),this.fireError(this.figure.errors))}unsubscribeFigure(){this.figure.unsubscribe()}startListeningFigure(){var{dh:e}=this;this.figure.addEventListener(e.plot.Figure.EVENT_UPDATED,this.handleFigureUpdated),this.figure.addEventListener(e.plot.Figure.EVENT_SERIES_ADDED,this.handleFigureSeriesAdded),this.figure.addEventListener(e.plot.Figure.EVENT_DISCONNECT,this.handleFigureDisconnected),this.figure.addEventListener(e.plot.Figure.EVENT_RECONNECT,this.handleFigureReconnected),this.figure.addEventListener(e.plot.Figure.EVENT_DOWNSAMPLESTARTED,this.handleDownsampleStart),this.figure.addEventListener(e.plot.Figure.EVENT_DOWNSAMPLEFINISHED,this.handleDownsampleFinish),this.figure.addEventListener(e.plot.Figure.EVENT_DOWNSAMPLEFAILED,this.handleDownsampleFail),this.figure.addEventListener(e.plot.Figure.EVENT_DOWNSAMPLENEEDED,this.handleDownsampleNeeded),this.figure.addEventListener(e.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed)}stopListeningFigure(){var{dh:e}=this;this.figure.removeEventListener(e.plot.Figure.EVENT_UPDATED,this.handleFigureUpdated),this.figure.removeEventListener(e.plot.Figure.EVENT_SERIES_ADDED,this.handleFigureSeriesAdded),this.figure.removeEventListener(e.plot.Figure.EVENT_DISCONNECT,this.handleFigureDisconnected),this.figure.removeEventListener(e.plot.Figure.EVENT_RECONNECT,this.handleFigureReconnected),this.figure.removeEventListener(e.plot.Figure.EVENT_DOWNSAMPLESTARTED,this.handleDownsampleStart),this.figure.removeEventListener(e.plot.Figure.EVENT_DOWNSAMPLEFINISHED,this.handleDownsampleFinish),this.figure.removeEventListener(e.plot.Figure.EVENT_DOWNSAMPLEFAILED,this.handleDownsampleFail),this.figure.removeEventListener(e.plot.Figure.EVENT_DOWNSAMPLENEEDED,this.handleDownsampleNeeded),this.figure.removeEventListener(e.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed)}handleDownsampleStart(e){H.debug("Downsample started",e),this.fireDownsampleStart(e.detail)}handleDownsampleFinish(e){H.debug("Downsample finished",e),this.fireDownsampleFinish(e.detail)}handleDownsampleFail(e){H.error("Downsample failed",e),this.fireDownsampleFail(e.detail)}handleDownsampleNeeded(e){H.info("Downsample needed",e),this.fireDownsampleNeeded(e.detail)}handleFigureUpdated(e){var{detail:t}=e,{series:r}=t;H.debug2("handleFigureUpdated",r);for(var i=0;i<r.length;i+=1){var a=r[i];H.debug2("handleFigureUpdated updating series",a.name);for(var{sources:s}=a,o=0;o<s.length;o+=1){var l=s[o],{columnType:u,type:c}=l,d=this.getValueTranslator(u,this.formatter),h=t.getArray(a,c,d);this.setDataArrayForSeries(a,c,h)}this.seriesToProcess.delete(a.name),this.cleanSeries(a)}this.seriesToProcess.size===0&&this.fireLoadFinished();var{data:g}=this;this.fireUpdate(g)}handleRequestFailed(e){H.error("Request failed",e),this.fireError(["".concat(e.detail)])}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){H.debug("Figure disconnected",e),this.isConnected=!1,this.listeners.length>0&&this.unsubscribeFigure(),this.fireDisconnect()}handleFigureReconnected(e){H.debug("Figure reconnected",e),this.isConnected=!0,this.initAllSeries(),this.fireReconnect(),this.listeners.length>0&&this.subscribeFigure()}handleFigureSeriesAdded(e){var{detail:t}=e;H.debug("handleFigureSeriesAdded",t),this.pendingSeries.push(t),this.addPendingSeries()}setDimensions(e){super.setDimensions(e),this.updateAxisPositions()}setTitle(e){var t,r;super.setTitle(e);var i=(t=(r=(e??"").match(/<br>/g))===null||r===void 0?void 0:r.length)!==null&&t!==void 0?t:0,a=z.DEFAULT_MARGIN.t+i*z.SUBTITLE_LINE_HEIGHT;this.layout.margin?this.layout.margin.t=a:this.layout.margin={t:a},typeof this.layout.title=="string"?this.layout.title=e:(this.layout.title=gt({},this.layout.title),this.layout.title.text=e,this.layout.title.pad=gt({},this.layout.title.pad),this.layout.title.pad.t=z.DEFAULT_TITLE_PADDING.t+i*z.SUBTITLE_LINE_HEIGHT*.5)}getPlotWidth(){var e,t,r,i;return!this.rect||!this.rect.width?0:Math.max(this.rect.width-((e=(t=this.layout.margin)===null||t===void 0?void 0:t.l)!==null&&e!==void 0?e:0)-((r=(i=this.layout.margin)===null||i===void 0?void 0:i.r)!==null&&r!==void 0?r:0),0)}getPlotHeight(){var e,t,r,i;return!this.rect||!this.rect.height?0:Math.max(this.rect.height-((e=(t=this.layout.margin)===null||t===void 0?void 0:t.t)!==null&&e!==void 0?e:0)-((r=(i=this.layout.margin)===null||i===void 0?void 0:i.b)!==null&&r!==void 0?r:0),0)}updateAxisPositions(){var e=this.getPlotWidth(),t=this.getPlotHeight();this.chartUtils.updateFigureAxes(this.layout,this.figure,this.theme,r=>this.getAxisRangeParser(r,this.formatter),e,t)}updateLayoutFormats(){if(this.formatter){var e=this.chartUtils.getAxisFormats(this.figure,this.formatter);e.forEach((t,r)=>{H.debug("Assigning ".concat(r),this.layout[r],t);var i=this.layout[r];i!=null?Object.assign(i,t):H.debug("Ignoring null layout.".concat(r))})}}setDataArrayForSeries(e,t,r){var{name:i,plotStyle:a}=e,s=this.seriesDataMap.get(i),o=this.chartUtils.getPlotlyProperty(a,t);s&&bt(s,o,r)}cleanSeries(e){var{dh:t}=this,{name:r,plotStyle:i}=e,a=this.seriesDataMap.get(r);if(a!=null){if(i===t.plot.SeriesPlotStyle.HISTOGRAM){var{xLow:s,xHigh:o}=a;if(s&&o&&s.length===o.length){for(var l=[],u=0;u<s.length;u+=1)l.push(o[u]-s[u]);a.width=l}}else if(i===t.plot.SeriesPlotStyle.LINE||i===t.plot.SeriesPlotStyle.ERROR_BAR||i===t.plot.SeriesPlotStyle.BAR){var{x:c,xLow:d,xHigh:h,y:g,yLow:p,yHigh:y}=a;d&&h&&d!==c&&(a.error_x=z.getPlotlyErrorBars(c,d,h,this.theme)),p&&y&&p!==g&&(a.error_y=z.getPlotlyErrorBars(g,p,y,this.theme))}else if(i===t.plot.SeriesPlotStyle.TREEMAP){var{ids:E,labels:T}=a;E!==void 0&&T===void 0&&(a.labels=E)}}}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){var t=this;if(this.oneClicks.length===0){H.warn("Trying to set a filter, but no one click!");return}H.debug("setFilter",e);for(var r=function(){var s=t.oneClicks[i],{columns:o}=s,l=new Set([...e.keys(),...t.lastFilter.keys()]);l.forEach(u=>{var c=e.get(u);t.lastFilter.get(u)!==c&&o.find(d=>d.name===u)!=null&&s.setValueForColumn(u,c)})},i=0;i<this.oneClicks.length;i+=1)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}}A(Ce,"ADD_SERIES_DEBOUNCE",50);const yt=Ce;function Et(n,e,t,r,i,a,s){try{var o=n[a](s),l=o.value}catch(u){t(u);return}o.done?e(l):Promise.resolve(l).then(r,i)}function Re(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function s(l){Et(a,r,i,s,o,"next",l)}function o(l){Et(a,r,i,s,o,"throw",l)}s(void 0)})}}class qe{static makeModelFromSettings(e,t,r,i){return Re(function*(){var a=yield qe.makeFigureFromSettings(e,t,r);return new yt(e,a,i,t)})()}static makeFigureFromSettings(e,t,r){return Re(function*(){var i=yield r.copy();return i.applyCustomColumns(r.customColumns),i.applyFilter(r.filter),i.applySort(r.sort),e.plot.Figure.create(new z(e).makeFigureSettings(t,i))})()}static makeModel(e,t,r,i){return Re(function*(){return new yt(e,r,i,t)})()}}const Yi=qe,Ei="var(--dh-color-chart-colorway)",Si="var(--dh-color-chart-grid)",Ti="var(--dh-color-chart-axis-line)",bi="var(--dh-color-chart-axis-line-zero)",wi="var(--dh-color-chart-active)",Pi="var(--dh-color-chart-range-bg)",St={"paper-bgcolor":"var(--dh-color-chart-bg)","plot-bgcolor":"var(--dh-color-chart-plot-bg)","title-color":"var(--dh-color-chart-title)",colorway:Ei,gridcolor:Si,linecolor:Ti,zerolinecolor:bi,activecolor:wi,rangebgcolor:Pi,"area-color":"var(--dh-color-chart-area)","trend-color":"var(--dh-color-chart-trend)","line-color":"var(--dh-color-chart-line-deprecated)","error-band-line-color":"var(--dh-color-chart-error-band-line)","error-band-fill-color":"var(--dh-color-chart-error-band-fill)","ohlc-increasing":"var(--dh-color-chart-ohlc-increase)","ohlc-decreasing":"var(--dh-color-chart-ohlc-decrease)"};var Tt=G.module("ChartTheme");function Fi(){var n,e=Jt(St);return e.colorway=er((n=e.colorway)!==null&&n!==void 0?n:"").map(t=>{var[r,i]=t;return tr.normalizeCssColor(e.colorway.substring(r,i+1))}).join(" "),Tt.debug2("Chart theme:",St),Tt.debug2("Chart theme derived:",e),Object.freeze({paper_bgcolor:e["paper-bgcolor"],plot_bgcolor:e["plot-bgcolor"],title_color:e["title-color"],colorway:e.colorway,gridcolor:e.gridcolor,linecolor:e.linecolor,zerolinecolor:e.zerolinecolor,activecolor:e.activecolor,rangebgcolor:e.rangebgcolor,area_color:e["area-color"],trend_color:e["trend-color"],line_color:e["line-color"],error_band_line_color:e["error-band-line-color"],error_band_fill_color:e["error-band-fill-color"],ohlc_increasing:e["ohlc-increasing"],ohlc_decreasing:e["ohlc-decreasing"]})}var Nt=C.createContext(null);function Xi(n){var{children:e}=n,{activeThemes:t}=En(),r=C.useMemo(Fi,[t]);return S.jsx(Nt.Provider,{value:r,children:e})}function Zi(){return Oe(Nt,"No ChartThemeContext value found.")}var Mi=C.createContext(null);function Qi(){return Oe(Mi,"No IdeConnection available in useConnection. Was code wrapped in ConnectionContext.Provider?")}export{z as $,ji as A,Br as B,Gi as C,J as D,Ot as E,Be as F,qn as G,Hi as H,ee as I,Bi as J,_i as K,Vi as L,$i as M,Vn as N,qi as O,_e as P,Ki as Q,Qn as R,kn as S,Ir as T,Un as U,Kn as V,zn as W,Jn as X,zi as Y,U as Z,Fi as _,ki as a,ei as a0,Nt as a1,Xi as a2,fi as a3,yt as a4,Ii as a5,xe as a6,Mi as a7,Ye as a8,Ai as a9,Ci as aa,pr as ab,we as ac,Wi as ad,Tr as ae,Zi as b,Li as c,Yi as d,Oe as e,Pr as f,Ft as g,he as h,xi as i,Gr as j,En as k,tn as l,Mt as m,Ri as n,Pt as o,m as p,wn as q,Fn as r,_ as s,vn as t,Qi as u,j as v,In as w,Le as x,B as y,f as z};
3
+ //# sourceMappingURL=useConnection-320a0737.js.map