@deephaven/embed-chart 0.52.1-beta.0 → 0.52.1-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/assets/{App-6accb525.js → App-e073f2fb.js} +2 -2
- package/build/assets/{App-6accb525.js.map → App-e073f2fb.js.map} +1 -1
- package/build/assets/{index-a9260610.js → index-9e419f44.js} +2 -2
- package/build/assets/{index-a9260610.js.map → index-9e419f44.js.map} +1 -1
- package/build/assets/{index-9461f417.js → index-cc4e8650.js} +8 -8
- package/build/assets/{index-9461f417.js.map → index-cc4e8650.js.map} +1 -1
- package/build/assets/{useConnection-44ba675a.js → useConnection-405f8d74.js} +2 -2
- package/build/assets/{useConnection-44ba675a.js.map → useConnection-405f8d74.js.map} +1 -1
- package/build/index.html +1 -1
- package/package.json +14 -14
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as Ee,G as Y,C as M,E as ve,F as _e,a3 as Ve,aM as tt,ae as he,ad as ot,K as lt,W as me}from"./vendor-6502331b.js";import{m as ut,L as Z,B as ct,Q as dt,p as fe,a8 as ht,aI as mt,aJ as ft}from"./index-a9260610.js";import{P as rt,b as gt,h as vt,p as pt,o as yt,s as St,t as Et,c as Tt}from"./plotly-c75409ed.js";var Xr=Object.freeze([]),Yr=new Map,Zr=()=>{};function Ne(){for(var a=arguments.length,e=new Array(a),t=0;t<a;t++)e[t]=arguments[t];return e.filter(r=>r!=null)}function bt(a,e,t){return e=Ft(e),e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function Ft(a){var e=Dt(a,"string");return typeof e=="symbol"?e:String(e)}function Dt(a,e){if(typeof a!="object"||a===null)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var r=t.call(a,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}class Mt extends Error{constructor(){super(...arguments),bt(this,"isCanceled",!0)}}const He=Mt;function Pt(a){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,t=Nt(a,e);t.forEach(r=>{a[r]=a[r].bind(a)})}function Nt(a,e){for(var t=new Set,r=a,n=0;r!=null&&r!==Object.prototype&&(n<=1||e);){for(var i of Object.getOwnPropertyNames(r))i!=="constructor"&&typeof r[i]=="function"&&t.add(i);r=Object.getPrototypeOf(r),n+=1}return[...t.keys()]}function wt(a,e,t){return e=At(e),e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function At(a){var e=Ot(a,"string");return typeof e=="symbol"?e:String(e)}function Ot(a,e){if(typeof a!="object"||a===null)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var r=t.call(a,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}class It extends Error{constructor(){super(...arguments),wt(this,"isTimeout",!0)}}const nt=It;class Oe{static makeCancelable(e,t){var r=!1,n,i,l=new Promise((s,o)=>{i=o,Promise.resolve(e).then(u=>{r?t&&t(u):(n=u,s(u))}).catch(u=>o(u))});return l.cancel=()=>{r=!0,i(new He),n!=null&&t&&t(n)},l}static isCanceled(e){return e instanceof He}static isTimedOut(e){return e instanceof nt}static withTimeout(e,t){return new Promise((r,n)=>{setTimeout(()=>{try{r(t())}catch(i){n(i)}},e)})}}class Ct{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(", "),n=e[e.length-1];return"".concat(r,", ").concat(t," ").concat(n)}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 xt=Ct;function at(a){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"No value available in context. Was code wrapped in a provider?",t=Ee.useContext(a);if(t==null)throw new Error(e);return t}function Lt(a,e,t){return e=Rt(e),e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function Rt(a){var e=kt(a,"string");return typeof e=="symbol"?e:String(e)}function kt(a,e){if(typeof a!="object"||a===null)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var r=t.call(a,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}function Qr(a){return a.then!==void 0}class re{static disableAllActions(){re.actionsDisabled=!0}static enableAllActions(){re.actionsDisabled=!1}static isContextActionEvent(e){return Array.isArray(e.contextActions)}static compareActions(e,t){if(e.group!==t.group){var r,n;return((r=e.group)!==null&&r!==void 0?r:0)>((n=t.group)!==null&&n!==void 0?n:0)?1:-1}if(e.order!==t.order){var i,l;return((i=e.order)!==null&&i!==void 0?i:0)>((l=t.order)!==null&&l!==void 0?l:0)?1:-1}if(e.title!==t.title){var s,o;return((s=e.title)!==null&&s!==void 0?s:"")>((o=t.title)!==null&&o!==void 0?o:"")?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(re.compareActions),t}static isMacPlatform(){var{platform:e}=window.navigator;return e.startsWith("Mac")}static getModifierKey(){return re.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(e){var t=re.getModifierKey();return e[t]}static getMenuItems(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=[],n=e;Array.isArray(n)||(n=[n]);for(var i=0;i<n.length;i+=1){var l=n[i],s=void 0;typeof l=="function"?s=l():s=l,s!=null&&(s instanceof Promise?t&&r.push(s):Array.isArray(s)?r=r.concat(s):r.push(s))}return r=r.filter(o=>o.title!==void 0||o.then!=null||o.menuElement),r}static getNextMenuItem(e,t,r){var n=e;n<0&&t<0&&(n=r.length);for(var i=1;i<r.length+1;i+=1){var l=(n+t*i+r.length)%r.length,s=r[l];if(!(s instanceof Promise)&&s.disabled!==!0)return l}return e}}Lt(re,"actionsDisabled",!1);const ie=re;var Ie=Y.forwardRef((a,e)=>{var t;function r(N){var{menuItem:C,onMenuItemClick:x}=a;x(C,N)}function n(N){var{menuItem:C,onMenuItemMouseMove:x}=a;x(C,N)}function i(N){var{menuItem:C,onMenuItemContextMenu:x}=a;x(C,N)}function l(N,C,x){if(typeof N.type=="string")return N;var{closeMenu:_,menuItem:ne,isKeyboardSelected:Q,isMouseSelected:B,"data-testid":le}=a,ae={menuItem:ne,closeMenu:_,isKeyboardSelected:Q,isMouseSelected:B,iconElement:C,displayShortcut:x,"data-testid":le};return Y.cloneElement(N,{forwardedProps:ae})}var{children:s,menuItem:o,isKeyboardSelected:u=!1,isMouseSelected:c=!1,"data-testid":d}=a,m=(t=o.shortcut)===null||t===void 0?void 0:t.getDisplayText(),p=null;if(o.icon){var v=o.icon;if(Y.isValidElement(v))p=v;else{var y;o.iconColor!=null&&(o.disabled===void 0||!o.disabled)&&(y={color:o.iconColor}),p=M.jsx(_e,{icon:v,style:y})}}var S=null,E=!!s;o.actions&&(S=M.jsx(_e,{icon:ut}));var b=null;if(o.menuElement)b=M.jsx("div",{className:"custom-menu-item",onMouseMove:n,children:l(o.menuElement,p,m)});else{var T,F=o.disabled,A=o.iconOutline;b=M.jsx("button",{type:"button",className:ve("btn-context-menu",{disabled:F},{active:(E||c)&&(F===void 0||!F)},{"keyboard-active":u&&(F===void 0||!F)}),onClick:r,onMouseMove:n,onContextMenu:i,title:(T=o.description)!==null&&T!==void 0?T:"",children:M.jsxs("div",{className:"btn-context-menu-wrapper",children:[M.jsx("span",{className:ve("icon",{outline:A}),children:p}),M.jsx("span",{className:"title",children:o.title}),m!==void 0&&M.jsx("span",{className:"shortcut",children:m}),S&&M.jsx("span",{className:ve("submenu-indicator",{disabled:F}),children:S})]})})}return M.jsxs("div",{className:"context-menu-item",ref:e,"data-testid":d,children:[s,b]})});Ie.displayName="ContextMenuItem";Ie.defaultProps={children:null,isKeyboardSelected:!1,isMouseSelected:!1,"data-testid":void 0};const _t=Ie;function We(a,e){var t=Object.keys(a);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(a,n).enumerable})),t.push.apply(t,r)}return t}function Vt(a){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?We(Object(t),!0).forEach(function(r){ee(a,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(t)):We(Object(t)).forEach(function(r){Object.defineProperty(a,r,Object.getOwnPropertyDescriptor(t,r))})}return a}function ee(a,e,t){return e=Ht(e),e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function Ht(a){var e=Wt(a,"string");return typeof e=="symbol"?e:String(e)}function Wt(a,e){if(typeof a!="object"||a===null)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var r=t.call(a,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}var $e=Z.module("ContextMenu");class pe extends Ee.PureComponent{static handleContextMenu(e){e.metaKey||(e.stopPropagation(),e.preventDefault())}constructor(e){super(e),ee(this,"container",void 0),ee(this,"oldFocus",void 0),ee(this,"activeSubMenuRef",void 0),ee(this,"subMenuTimer",void 0),ee(this,"rAF",void 0),ee(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=Y.createRef(),this.oldFocus=document.activeElement,this.activeSubMenuRef=Y.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:n}=this.state;if(n!==t.activeSubMenu)if(n==null){var i;(i=this.container.current)===null||i===void 0||i.focus()}else this.setActiveSubMenuPosition();if(e.actions!==r&&(this.initMenu(),this.container.current==null||!this.container.current.contains(document.activeElement))){var l;(l=this.container.current)===null||l===void 0||l.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,n=ie.getMenuItems(r),i=[],l=n.length-1;l>=0;l-=1){var s=n[l];s instanceof Promise?this.initMenuPromise(s):i.push(s)}this.setState({mouseIndex:-1,keyboardIndex:t,activeSubMenu:null,menuItems:ie.sortActions(i)})}initMenuPromise(e){var t=Oe.makeCancelable(e);this.setState(r=>({pendingItems:r.pendingItems.concat(t)})),t.then(r=>{this.setState(n=>{var i=n.pendingItems.indexOf(t);if(i>=0){var l=n.pendingItems.slice();return l.splice(i,1),{menuItems:ie.sortActions(n.menuItems.concat(r)),pendingItems:l}}return null})},r=>{Oe.isCanceled(r)||(this.setState(n=>{var i=n.pendingItems.indexOf(t);if(i>=0){var l=n.pendingItems.slice();return l.splice(i,1),{pendingItems:l}}return null}),$e.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,n,{options:i,updatePosition:l,subMenuParentWidth:s,subMenuParentHeight:o,top:u,left:c}=this.props;if(!(!this.container.current||i.doNotVerifyPosition!=null&&i.doNotVerifyPosition)){var{top:d,left:m}=this.initialPosition,{width:p,height:v}=(e=(t=this.container.current)===null||t===void 0?void 0:t.getBoundingClientRect())!==null&&e!==void 0?e:{width:0,height:0},y=((r=(n=this.container.current)===null||n===void 0?void 0:n.scrollHeight)!==null&&r!==void 0?r:0)>window.innerHeight;v===0||p===0||(d+v>window.innerHeight&&(d-v-o>0?d-=v-o:d=window.innerHeight-v),m+p>window.innerWidth&&(m=m-p-s),(c!==m||u!==d)&&(this.setState({hasOverflow:y}),l(d,m)))}}handleWindowResize(){this.container.current&&this.closeMenu(!0)}handleBlur(e){if(!this.container.current){$e.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(),n=r,i=!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?i=!0:n=0:this.isEscapeKey(e.key)?n=null:e.key==="ArrowUp"||e.shiftKey&&e.key==="Tab"?n=ie.getNextMenuItem(n,-1,t):(e.key==="ArrowDown"||e.key==="Tab")&&(n=ie.getNextMenuItem(n,1,t)),i){this.openSubMenu(r),e.preventDefault(),e.stopPropagation();return}r!==n&&(n!==null?this.setKeyboardIndex(n):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}openSubMenu(e){var{menuItems:t,activeSubMenu:r}=this.state,n=t[e].actions?e:null;r!==n&&this.setState({activeSubMenu:n,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:n,hasOverflow:i,keyboardIndex:l,menuItems:s,mouseIndex:o,pendingItems:u,subMenuTop:c,subMenuLeft:d,subMenuParentWidth:m,subMenuParentHeight:p}=this.state,v=0;v<s.length;v+=1){var y=s[v];v>0&&y.group!==s[v-1].group&&e.push(M.jsx("hr",{},"".concat(v,".separator")));var S=M.jsx(_t,{ref:n===v?this.activeSubMenuRef:null,isKeyboardSelected:l===v,isMouseSelected:o===v,menuItem:y,closeMenu:this.handleCloseSubMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:this.handleMenuItemContextMenu},v);e.push(S)}var E=null;u.length>0&&(E=M.jsx("div",{className:"loading",children:M.jsx(ct,{className:"loading-spinner-vertical-align"})}));var{menuStyle:b,"data-testid":T}=this.props,F=n!==null&&c!==null&&d!==null;return M.jsxs(M.Fragment,{children:[M.jsxs("div",{className:ve({"has-overflow":i},"context-menu-container"),style:Vt({top:t,left:r},b),ref:this.container,"data-dh-context-menu":!0,onBlur:this.handleBlur,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,onContextMenu:pe.handleContextMenu,role:"menuitem",tabIndex:0,"data-testid":T,children:[e,E]}),F&&n!==null&&c!==null&&d!==null&&M.jsx(pe,{actions:s[n].actions||[],closeMenu:this.handleCloseSubMenu,top:c,left:d,updatePosition:(A,N)=>{this.setState({subMenuTop:A,subMenuLeft:N})},subMenuParentWidth:m,subMenuParentHeight:p},"sub-".concat(n))]})}}ee(pe,"defaultProps",{subMenuParentWidth:0,subMenuParentHeight:0,closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0});const $t=pe;function je(a,e,t){return e=jt(e),e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function jt(a){var e=Bt(a,"string");return typeof e=="symbol"?e:String(e)}function Bt(a,e){if(typeof a!="object"||a===null)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var r=t.call(a,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}class qt extends Ee.Component{constructor(e){super(e),je(this,"container",void 0),je(this,"openMenu",void 0),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.container=Y.createRef(),this.openMenu=Y.createRef(),this.state={actions:null,left:0,top:0}}componentDidMount(){var e;(e=this.container.current)!==null&&e!==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,n=e.clientX-t.left,{actions:i}=this.state;if(i!=null&&e.target===this.container.current){e.preventDefault(),this.setState({actions:null},()=>{var s=document.elementFromPoint(n,r),o=new MouseEvent("contextmenu",{clientX:e.clientX,clientY:e.clientY,bubbles:!0,cancelable:!0});s==null||s.dispatchEvent(o)});return}if(ie.isContextActionEvent(e)&&!(e.metaKey||e.ctrlKey)){var l=ie.getMenuItems(e.contextActions);l.length!==0&&(e.preventDefault(),this.setState({actions:l,top:r,left:n}))}}}handleMenuClose(e){e===this.openMenu.current&&this.setState({actions:null})}render(){var e=null,{"data-testid":t}=this.props,{actions:r,top:n,left:i}=this.state;return r&&(e=M.jsx($t,{ref:this.openMenu,actions:r,onMenuClosed:this.handleMenuClose,top:n,left:i,updatePosition:(l,s)=>{this.setState({top:l,left:s})},"data-testid":t})),M.jsx("div",{className:ve("context-menu-root",{active:r}),ref:this.container,children:e})}}const Jr=qt;function Ur(){return at(dt,"No API available in useApi. Was code wrapped in ApiBootstrap or ApiContext.Provider?")}function Ce(a,e,t){return e=Kt(e),e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function Kt(a){var e=zt(a,"string");return typeof e=="symbol"?e:String(e)}function zt(a,e){if(typeof a!="object"||a===null)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var r=t.call(a,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}class Me{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""}}Ce(Me,"TYPE_GLOBAL","type-global");Ce(Me,"TYPE_CONTEXT_PRESET","type-context-preset");Ce(Me,"TYPE_CONTEXT_CUSTOM","type-context-custom");const k=Me;class Gt extends k{format(e){switch(e){case 1:case!0:return"true";case 0:case!1:return"false";default:return""}}}const Xt=Gt;class Yt extends k{format(e){return String.fromCharCode(e)}}const Zt=Yt;function te(a,e,t){return e=Qt(e),e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function Qt(a){var e=Jt(a,"string");return typeof e=="symbol"?e:String(e)}function Jt(a,e){if(typeof a!="object"||a===null)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var r=t.call(a,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}var Be=Z.module("DateTimeColumnFormatter");class q extends k{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]:k.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'":" ",n=e?" z":"";return new Map([["yyyy-MM-dd HH:mm:ss","yyyy-MM-dd".concat(r,"HH:mm:ss").concat(n)],["yyyy-MM-dd HH:mm:ss.SSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSS").concat(n)],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSSSSSSSS").concat(n)]])}static getGlobalFormats(e,t){var r=q.makeGlobalFormatStringMap(e,t);return[...r.keys()]}static makeFormatStringMap(e,t){var r=t!==void 0&&t?"'T'":" ",n=e!==void 0&&e?" z":"";return new Map([["yyyy-MM-dd","yyyy-MM-dd".concat(n)],["MM-dd-yyyy","MM-dd-yyyy".concat(n)],["HH:mm:ss","HH:mm:ss".concat(n)],["HH:mm:ss.SSS","HH:mm:ss.SSS".concat(n)],["HH:mm:ss.SSSSSSSSS","HH:mm:ss.SSSSSSSSS".concat(n)],["yyyy-MM-dd HH:mm:ss","yyyy-MM-dd".concat(r,"HH:mm:ss").concat(n)],["yyyy-MM-dd HH:mm:ss.SSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSS").concat(n)],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSSSSSSSS").concat(n)]])}static getFormats(e,t){var r=q.makeFormatStringMap(e,t);return[...r.keys()]}constructor(e){var{timeZone:t="",showTimeZone:r=!0,showTSeparator:n=!1,defaultDateTimeFormatString:i=q.DEFAULT_DATETIME_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),te(this,"dh",void 0),te(this,"dhTimeZone",void 0),te(this,"defaultDateTimeFormatString",void 0),te(this,"showTimeZone",void 0),te(this,"showTSeparator",void 0),te(this,"formatStringMap",void 0);var l=t||q.DEFAULT_TIME_ZONE_ID;try{this.dhTimeZone=e.i18n.TimeZone.getTimeZone(l)}catch{Be.error("Unsupported time zone id",l),this.dhTimeZone=e.i18n.TimeZone.getTimeZone(q.DEFAULT_TIME_ZONE_ID)}this.dh=e,this.defaultDateTimeFormatString=i,this.showTimeZone=r,this.showTSeparator=n,this.formatStringMap=q.makeFormatStringMap(r,n)}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,n=this.getEffectiveFormatString(r);try{return this.dh.i18n.DateTimeFormat.format(n,e,this.dhTimeZone)}catch{Be.error("Invalid format arguments")}return""}}te(q,"DEFAULT_DATETIME_FORMAT_STRING","yyyy-MM-dd HH:mm:ss.SSS");te(q,"DEFAULT_TIME_ZONE_ID","America/New_York");function z(a,e,t){return e=Ut(e),e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function Ut(a){var e=er(a,"string");return typeof e=="symbol"?e:String(e)}function er(a,e){if(typeof a!="object"||a===null)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var r=t.call(a,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}var tr=Z.module("DecimalColumnFormatter");class w extends k{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]:k.TYPE_CONTEXT_PRESET,n=arguments.length>3?arguments[3]:void 0;return{label:e,type:r,formatString:t,multiplier:n}}static makePresetFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0;return w.makeFormat(e,t,k.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 w.makeFormat("Custom Format",e,k.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=w.DEFAULT_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),z(this,"defaultFormatString",void 0),z(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,n=t.multiplier!=null&&t.multiplier!==0?e*t.multiplier:e;try{return this.dh.i18n.NumberFormat.format(r,n)}catch{tr.error("Invalid format arguments")}return""}}z(w,"DEFAULT_FORMAT_STRING","###,##0.0000");z(w,"FORMAT_PERCENT",w.makePresetFormat("Percent","##0.00%"));z(w,"FORMAT_BASIS_POINTS",w.makePresetFormat("Basis Points","###,##0 bp",1e4));z(w,"FORMAT_MILLIONS",w.makePresetFormat("Millions","###,##0.000 mm",1e-6));z(w,"FORMAT_SCIENTIFIC_NOTATION",w.makePresetFormat("Scientific Notation","0.0000E0"));z(w,"FORMAT_ROUND",w.makePresetFormat("Round","###,##0"));z(w,"FORMAT_ROUND_TWO_DECIMALS",w.makePresetFormat("0.00","###,##0.00"));z(w,"FORMAT_ROUND_FOUR_DECIMALS",w.makePresetFormat("0.0000","###,##0.0000"));class rr extends k{format(e){return"".concat(e)}}const nr=rr;function ye(a,e,t){return e=ar(e),e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function ar(a){var e=ir(a,"string");return typeof e=="symbol"?e:String(e)}function ir(a,e){if(typeof a!="object"||a===null)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var r=t.call(a,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}var sr=Z.module("IntegerColumnFormatter");class K extends k{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]:k.TYPE_CONTEXT_PRESET,n=arguments.length>3?arguments[3]:void 0;return{label:e,type:r,formatString:t,multiplier:n}}static makePresetFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0;return K.makeFormat(e,t,k.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 K.makeFormat("Custom Format",e,k.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=K.DEFAULT_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),ye(this,"dh",void 0),ye(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,n=t.multiplier!=null&&t.multiplier!==0?e*t.multiplier:e;try{return this.dh.i18n.NumberFormat.format(r,n)}catch{sr.error("Invalid format arguments")}return""}}ye(K,"DEFAULT_FORMAT_STRING","###,##0");ye(K,"FORMAT_MILLIONS",K.makePresetFormat("Millions","###,##0.000 mm",1e-6));ye(K,"FORMAT_SCIENTIFIC_NOTATION",K.makePresetFormat("Scientific Notation","0.0000E0"));class or extends k{format(e){return e}}function it(a,e,t){return e=lr(e),e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function lr(a){var e=ur(a,"string");return typeof e=="symbol"?e:String(e)}function ur(a,e){if(typeof a!="object"||a===null)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var r=t.call(a,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}class O{static makeDateWrapper(e,t,r){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:1,l=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0,s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:0,o=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(n+1).padStart(2,"0"),m="".concat(i).padStart(2,"0"),p="".concat(l).padStart(2,"0"),v="".concat(s).padStart(2,"0"),y="".concat(o).padStart(2,"0"),S="".concat(u).padStart(9,"0"),E="".concat(c,"-").concat(d,"-").concat(m," ").concat(p,":").concat(v,":").concat(y,".").concat(S);return e.i18n.DateTimeFormat.parse(O.FULL_DATE_FORMAT,E,e.i18n.TimeZone.getTimeZone(t))}static getNextNanos(e){var t=parseInt(e,10),r="0".repeat(9-e.length),n="".concat(t+1).concat(r);return parseInt(n,10)}static getNextDate(e,t,r,n){var{year:i,month:l,date:s,hours:o,minutes:u,seconds:c,nanos:d}=r;if(t.nanos!=null){if(t.nanos.length===9)return null;d=O.getNextNanos(t.nanos),d>999999999&&(c+=1,d=0)}else t.seconds!=null?c+=1:t.minutes!=null?u+=1:t.hours!=null?o+=1:t.date!=null?s+=1:t.month!=null?l+=1:i+=1;var m=new Date(i,l,s,o,u,c);return O.makeDateWrapper(e,n,m.getFullYear(),m.getMonth(),m.getDate(),m.getHours(),m.getMinutes(),m.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 n=0;n<O.months.length;n+=1)if(O.months[n].startsWith(r))return n}return NaN}static parseDateValues(e,t,r,n,i,l,s){var o=parseInt(e,10),u=t!=null?this.parseMonth(t):0,c=r!=null?parseInt(r,10):1,d=n!=null?parseInt(n,10):0,m=i!=null?parseInt(i,10):0,p=l!=null?parseInt(l,10):0,v=s!=null?parseInt(s.padEnd(9,"0"),10):0;return Number.isNaN(o)||Number.isNaN(u)||Number.isNaN(c)||Number.isNaN(d)||Number.isNaN(m)||Number.isNaN(p)||Number.isNaN(v)?null:{year:o,month:u,date:c,hours:d,minutes:m,seconds:p,nanos:v}}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[,n,,i,,l,,s,,o,,u,,c,d]=r;if(d!=null&&d.length>0)throw new Error("Unexpected characters after date string '".concat(e,"': ").concat(d));return{year:n,month:i,date:l,hours:s,minutes:o,seconds:u,nanos:c}}static parseDateRange(e,t,r){var n=t.trim().toLowerCase();if(n.length===0)throw new Error("Cannot parse date range from empty string");if(n==="null")return[null,null];if(n==="today"){var i=new Date(Date.now()),l=O.makeDateWrapper(e,r,i.getFullYear(),i.getMonth(),i.getDate()),s=new Date(i.getFullYear(),i.getMonth(),i.getDate()+1),o=O.makeDateWrapper(e,r,s.getFullYear(),s.getMonth(),s.getDate());return[l,o]}if(n==="yesterday"){var u=new Date(Date.now()),c=new Date(u.getFullYear(),u.getMonth(),u.getDate()-1),d=O.makeDateWrapper(e,r,c.getFullYear(),c.getMonth(),c.getDate()),m=O.makeDateWrapper(e,r,u.getFullYear(),u.getMonth(),u.getDate());return[d,m]}if(n==="now"){var p=new Date(Date.now()),v=e.DateWrapper.ofJsDate(p);return[v,null]}var y=O.parseDateTimeString(n);if(y.year==null&&y.month==null&&y.date==null)throw new Error("Unable to extract year, month, or day ".concat(n));var S=O.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 E=O.makeDateWrapper(e,r,S.year,S.month,S.date,S.hours,S.minutes,S.seconds,S.nanos),b=O.getNextDate(e,y,S,r);return[E,b]}static getJsDate(e){return typeof e=="number"?new Date(e):e.asDate()}}it(O,"FULL_DATE_FORMAT","yyyy-MM-dd HH:mm:ss.SSSSSSSSS");it(O,"months",["january","february","march","april","may","june","july","august","september","october","november","december"]);function en(a,e){return a===e?{operator:"notEq",value:""}:{operator:"eq",value:a}}function tn(a,e,t){return function(n){var i=t.trim();if(i==="")return null;var l=st(e,s=>s.filter().containsIgnoreCase(a.makeFilterValue(s.type,i)),"or");return l(n)}}function st(a,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"or";return function(n){var i=n==null?void 0:n.findColumns(typeof a=="string"?[a]:a);if(i==null||i.length===0)return null;var l=i.map(e);return l.reduce((s,o)=>s[t](o))}}function cr(a,e,t,r){return st(e,n=>n.filter()[r](a.makeFilterValue(n.type,t)),"or")}function rn(a,e,t,r,n){return function(l){var s=l==null?void 0:l.findColumn(e),o=t==="all"||r&&t.size===0;return s==null||o?null:a.makeSelectValueFilter(s,[...t.keys()],n)}}function nn(a){return function(t){return t.filter().isNull().not().and(t.filter().notEq(a.makeFilterValue(t.type,"")))}}function an(a,e){return function(r){var n=r.filter(),i=a.makeFilterValue(r.type,""),l=n.eq(i);return e?n.isNull().or(l):l.or(n.notEq(i))}}function xe(a,e,t){return e=dr(e),e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function dr(a){var e=hr(a,"string");return typeof e=="symbol"?e:String(e)}function hr(a,e){if(typeof a!="object"||a===null)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var r=t.call(a,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}class Se{}xe(Se,"not","not");xe(Se,"and","and");xe(Se,"or","or");function sn(a){if(!(a==="not"||a==="and"||a==="or"))throw new Error("operator is not a valid FilterOperatorValue")}function P(a,e,t){return e=mr(e),e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function mr(a){var e=fr(a,"string");return typeof e=="symbol"?e:String(e)}function fr(a,e){if(typeof a!="object"||a===null)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var r=t.call(a,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}class f{}P(f,"eq","eq");P(f,"eqIgnoreCase","eqIgnoreCase");P(f,"notEq","notEq");P(f,"notEqIgnoreCase","notEqIgnoreCase");P(f,"greaterThan","greaterThan");P(f,"greaterThanOrEqualTo","greaterThanOrEqualTo");P(f,"lessThan","lessThan");P(f,"lessThanOrEqualTo","lessThanOrEqualTo");P(f,"in","in");P(f,"inIgnoreCase","inIgnoreCase");P(f,"notIn","notIn");P(f,"notInIgnoreCase","notInIgnoreCase");P(f,"isTrue","isTrue");P(f,"isFalse","isFalse");P(f,"isNull","isNull");P(f,"invoke","invoke");P(f,"contains","contains");P(f,"notContains","notContains");P(f,"containsIgnoreCase","containsIgnoreCase");P(f,"startsWith","startsWith");P(f,"endsWith","endsWith");P(f,"containsAny","containsAny");var qe=Z.module("ViewportDataUtils");function gr(a,e){return String(a.offsetInSnapshot+e)}function on(a,e){var{bulkUpdate:t}=a;return function(n){var{columns:i,offset:l,rows:s}=n.detail;qe.debug("table updated",n.detail);var o=new Map;s.forEach(u=>{var c=e(u,i),d=gr(u,l);o.set(d,{key:d,item:c})}),qe.debug("update keys",o),t(o)}}function ln(a,e){return e.reduce((t,r)=>(t[r.name]=a.get(r),t),{})}function*un(a,e){for(var t=a;t<=e;++t)yield{key:String(t)}}function vr(a){return a==null||pr(a)?0:a.size}function pr(a){return"isClosed"in a?a.isClosed:!1}function cn(a,e,t,r){var n=a+e-1,[i,l]=[0,r-1],s=Ve(a-t,i,l),o=Ve(n+t,i,l);return[s,o]}function Ke(a,e,t,r,n,i,l){try{var s=a[i](l),o=s.value}catch(u){t(u);return}s.done?e(o):Promise.resolve(o).then(r,n)}function U(a){return function(){var e=this,t=arguments;return new Promise(function(r,n){var i=a.apply(e,t);function l(o){Ke(i,r,n,l,s,"next",o)}function s(o){Ke(i,r,n,l,s,"throw",o)}l(void 0)})}}function oe(a,e,t){return e=yr(e),e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function yr(a){var e=Sr(a,"string");return typeof e=="symbol"?e:String(e)}function Sr(a,e){if(typeof a!="object"||a===null)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var r=t.call(a,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}var G=Z.module("TableUtils");class h{static copyTableAndApplyFilters(e){var t=arguments;return U(function*(){if(e==null)return null;for(var r=yield e.copy(),n=t.length,i=new Array(n>1?n-1:0),l=1;l<n;l++)i[l-1]=t[l];return r.applyFilter(Ne(...i.map(s=>s(r)))),r})()}static getSortIndex(e,t){for(var r=0;r<e.length;r+=1){var n,i=e[r];if(((n=i.column)===null||n===void 0?void 0:n.name)===t)return r}return null}static getSortForColumn(e,t){var r=h.getSortIndex(e,t);return r!=null?e[r]:null}static getFilterText(e){return e?e.toString():null}static getFilterTypes(e){return h.isBooleanType(e)?[f.isTrue,f.isFalse,f.isNull]:h.isCharType(e)||h.isNumberType(e)||h.isDateType(e)?[f.eq,f.notEq,f.greaterThan,f.greaterThanOrEqualTo,f.lessThan,f.lessThanOrEqualTo]:h.isTextType(e)?[f.eq,f.eqIgnoreCase,f.notEq,f.notEqIgnoreCase,f.contains,f.notContains,f.startsWith,f.endsWith]:[]}static getNextSort(e,t,r){if(r<0||r>=e.length)return null;var n=h.getSortForColumn(t,e[r].name);return n===null?e[r].sort().asc():n.direction===h.sortDirection.ascending?n.desc():null}static makeColumnSort(e,t,r,n){if(t<0||t>=e.length||r===h.sortDirection.none)return null;var i=e[t].sort();switch(r){case h.sortDirection.ascending:i=i.asc();break;case h.sortDirection.descending:i=i.desc();break}return n&&(i=i.abs()),i}static toggleSortForColumn(e,t,r){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(r<0||r>=t.length)return[];var i=h.getNextSort(t,e,r);return h.setSortForColumn(e,t[r].name,i,n)}static sortColumn(e,t,r,n,i,l){if(r<0||r>=t.length)return[];var s=h.makeColumnSort(t,r,n,i);return h.setSortForColumn(e,t[r].name,s,l)}static setSortForColumn(e,t,r){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,i=h.getSortIndex(e,t),l=[];return n&&(l=l.concat(e.filter(s=>{var{direction:o}=s;return o!==h.sortDirection.reverse})),i!==null&&l.splice(i,1)),r!==null&&l.push(r),l}static getNormalizedType(e){switch(e){case"boolean":case"java.lang.Boolean":case h.dataType.BOOLEAN:return h.dataType.BOOLEAN;case"char":case"java.lang.Character":case h.dataType.CHAR:return h.dataType.CHAR;case"java.lang.String":case h.dataType.STRING:return h.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 h.dataType.DATETIME:return h.dataType.DATETIME;case"double":case"java.lang.Double":case"float":case"java.lang.Float":case"java.math.BigDecimal":case h.dataType.DECIMAL:return h.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 h.dataType.INT:return h.dataType.INT;default:return h.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 h.isIntegerType(e)||h.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 h.getNormalizedType(e)===h.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 Oe.makeCancelable(e,t=>{t.close()})}static makeCancelableTableEventPromise(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,i,l,s=!0,o=new Promise((u,c)=>{l=setTimeout(()=>{i(),s=!1,c(new nt('Event "'.concat(t,'" timed out.')))},r),i=e.addEventListener(t,d=>{if(n!=null&&!n(d)){G.debug2("Event triggered, but matcher returned false.");return}G.debug2("Event triggered, resolving."),i(),clearTimeout(l),s=!1,u(d)})});return o.cancel=()=>{if(s){G.debug2("Pending promise cleanup."),i(),clearTimeout(l),s=!1;return}G.debug2("Ignoring non-pending promise cancel.")},o}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=h.removeCommas(t);if(h.NUMBER_REGEX.test(r))return parseFloat(r);throw new Error("Invalid number '".concat(e,"'"))}static getFilterOperatorString(e){switch(e){case f.eq:return"=";case f.notEq:return"!=";case f.greaterThan:return">";case f.greaterThanOrEqualTo:return">=";case f.lessThan:return"<";case f.lessThanOrEqualTo:return"<=";case f.contains:return"~";case f.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,n)=>{var i=r.name.toUpperCase(),l=n.name.toUpperCase();return xt.sort(i,l,t)})}constructor(e){oe(this,"dh",void 0),this.dh=e,Pt(this)}createDistinctSortedColumnTable(e,t,r){var n=arguments,i=this;return U(function*(){if(e==null)return null;for(var l=e,s=n.length,o=new Array(s>3?s-3:0),u=3;u<s;u++)o[u-3]=n[u];o.length>0&&(l=yield e.copy(),yield l.applyFilter(Ne(...o.map(p=>p(l)))));var c=l.findColumn(t),d=yield l.selectDistinct([c]);l!==e&&l.close();var m=d.findColumn(t).sort()[r]();return i.applySort(d,[m])})()}doesColumnValueExist(e,t,r,n){var i=this;return U(function*(){if(e==null)return null;var l=cr(i,t,r,n?"eq":"eqIgnoreCase"),s=yield e.copy();yield i.applyFilter(s,Ne(l(s)));var o=vr(s);return s.close(),o>0})()}makeQuickFilter(e,t,r){for(var n=t.split("||"),i=null,l=0;l<n.length;l+=1){for(var s=n[l],o=s.split("&&"),u=null,c=0;c<o.length;c+=1){var d=o[c].trim();if(d.length>0){var m=this.makeQuickFilterFromComponent(e,d,r);if(m)u?u=u.and(m):u=m;else throw new Error("Unable to parse quick filter from text ".concat(t))}}i&&u?i=i.or(u):i=u}return i}makeQuickFilterFromComponent(e,t,r){var{type:n}=e;return h.isNumberType(n)?this.makeQuickNumberFilter(e,t):h.isBooleanType(n)?this.makeQuickBooleanFilter(e,t):r!=null&&h.isDateType(n)?this.makeQuickDateFilter(e,t,r):h.isCharType(n)?this.makeQuickCharFilter(e,t):this.makeQuickTextFilter(e,t)}makeQuickNumberFilter(e,t){var r=e.filter(),{dh:n}=this,i=null,l=/\s*(>=|<=|=>|=<|>|<|!=|=|!)?(\s*-\s*)?(\s*\d*(?:,\d{3})*(?:\.\d*)?\s*)?(null|nan|infinity|inf|\u221E)?(.*)/i,s=l.exec(t),o=null,u=null,c=null,d=null,m=null;if(s!==null&&s.length>3&&([,o,u,c,d,m]=s),m!=null&&m.trim().length>0)return null;if(o==null&&(o="="),d!=null){if(!(o==="="||o==="!"||o==="!="))return null;switch(d=d.trim().toLowerCase(),d){case"null":i=r.isNull();break;case"nan":i=n.FilterCondition.invoke("isNaN",r);break;case"infinity":case"inf":case"∞":u!=null?i=n.FilterCondition.invoke("isInf",r).and(r.lessThan(n.FilterValue.ofNumber(0))):i=n.FilterCondition.invoke("isInf",r).and(r.greaterThan(n.FilterValue.ofNumber(0)));break}return i!==null&&(o==="!"||o==="!=")&&(i=i.not()),i}if(c==null)return null;if(c=h.removeCommas(c),h.isLongType(e.type))try{c=n.FilterValue.ofNumber(n.LongWrapper.ofString("".concat(u!=null?"-":"").concat(c)))}catch(p){return G.warn("Unable to create long filter",p),null}else{if(c=parseFloat(c),c==null||Number.isNaN(c))return null;c=n.FilterValue.ofNumber(u!=null?0-c:c)}return i=e.filter(),h.makeRangeFilterWithOperation(i,o,c)}static escapeQuickTextFilter(e){var t,r;if(e==null)return null;var n=/^(!~|!=|~|=|!)?(.*)/,i=/^\\*null$/,l=n.exec(e),s=null,o=null;if(l!==null&&l.length>2&&([,s,o]=l),s!=null){var u;return"\\".concat(s).concat((u=o)!==null&&u!==void 0?u:"")}return o!=null&&i.test(o.toLowerCase())||o!=null&&o.startsWith("*")?"\\".concat(o):o!=null&&o.endsWith("*")&&!o.endsWith("\\*")?(o=o.substring(0,o.length-1),"".concat(o,"\\*")):"".concat((t=s)!==null&&t!==void 0?t:"").concat((r=o)!==null&&r!==void 0?r:"")}static unescapeQuickTextFilter(e){var t,r,n=/^(\\!~|\\!=|\\~|\\=|\\!)?(.*)/,i=/^\\*null$/,l=n.exec(e),s=null,o=null;return l!==null&&l.length>2&&([,s,o]=l),s!=null&&(s=s.replace("\\","")),o!=null&&i.test(o.toLowerCase())&&(o=o.replace("\\","")),s==null&&o!=null&&o.startsWith("\\*")&&(o=o.substring(1)),s==null&&o!=null&&o.endsWith("\\*")?(o=o.substring(0,o.length-2),"".concat(o,"*")):"".concat((t=s)!==null&&t!==void 0?t:"").concat((r=o)!==null&&r!==void 0?r:"")}makeQuickTextFilter(e,t){var{dh:r}=this,n="".concat(t).trim(),i=/^(!~|!=|~|=|!)?(.*)/,l=i.exec(n),s=null,o=null;if(l!==null&&l.length>2&&([,s,o]=l,o!=null&&(o=o.trim())),o==null||o.length===0&&!(s==="="||s==="!="))return null;s==null&&(s="=");var u=e.filter();if(o.toLowerCase()==="null")switch(s){case"=":return u.isNull();case"!=":case"!":return u.isNull().not()}var c=null,d=null;switch(o.startsWith("*")?(c="*",o=o.substring(1)):o.endsWith("*")&&!o.endsWith("\\*")&&(d="*",o=o.substring(0,o.length-1)),o=h.unescapeQuickTextFilter(o),s){case"~":return u.isNull().not().and(u.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(o,"\\E.*"))));case"!~":return u.isNull().or(u.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(o,"\\E.*"))).not());case"!=":return c==="*"?u.isNull().or(u.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(o,"\\E$"))).not()):d==="*"?u.isNull().or(u.invoke("matches",r.FilterValue.ofString("(?s)(?i)^\\Q".concat(o,"\\E.*"))).not()):u.notEqIgnoreCase(r.FilterValue.ofString(o.toLowerCase()));case"=":return c==="*"?u.isNull().not().and(u.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(o,"\\E$")))):d==="*"?u.isNull().not().and(u.invoke("matches",r.FilterValue.ofString("(?s)(?i)^\\Q".concat(o,"\\E.*")))):u.eqIgnoreCase(r.FilterValue.ofString(o.toLowerCase()))}return null}makeQuickBooleanFilter(e,t){var r=/^(!=|=|!)?(.*)/,n=r.exec("".concat(t).trim());if(n===null)return null;var[,i,l]=n,s=i==="!"||i==="!=",o=l.trim().toLowerCase(),u=e.filter();try{var c=h.makeBooleanValue(o);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 n=t.trim(),i=/\s*(>=|<=|=>|=<|>|<|!=|!|=)?(.*)/,l=i.exec(n);if(l==null||l.length<=2)throw new Error("Unable to parse date filter: ".concat(t));var s=null,o=null;[,s,o]=l;var u=f.eq;switch(s){case"<":u=f.lessThan;break;case"<=":case"=<":u=f.lessThanOrEqualTo;break;case">":u=f.greaterThan;break;case">=":case"=>":u=f.greaterThanOrEqualTo;break;case"!=":case"!":u=f.notEq;break;case"=":case"==":default:u=f.eq;break}return this.makeQuickDateFilterWithOperation(e,o,u,r)}makeQuickDateFilterWithOperation(e,t,r,n){var{dh:i}=this,[l,s]=O.parseDateRange(i,t,n),o=l!=null?i.FilterValue.ofNumber(l):null,u=s!=null?i.FilterValue.ofNumber(s):null,c=e.filter();if(o==null)return r===f.notEq?c.isNull().not():c.isNull();switch(r){case f.eq:{if(u!=null){var d=c.greaterThanOrEqualTo(o),m=c.lessThan(u);return d.and(m)}return c.eq(o)}case f.lessThan:return c.lessThan(o);case f.lessThanOrEqualTo:return u!=null?c.lessThan(u):c.lessThanOrEqualTo(o);case f.greaterThan:return u!=null?c.greaterThanOrEqualTo(u):c.greaterThan(o);case f.greaterThanOrEqualTo:return c.greaterThanOrEqualTo(o);case f.notEq:{if(u!=null){var p=c.lessThan(o),v=c.greaterThanOrEqualTo(u);return p.or(v)}return c.notEq(o)}default:throw new Error("Invalid operator: ".concat(r))}}makeQuickCharFilter(e,t){var{dh:r}=this,n="".concat(t).trim(),i=/^(>=|<=|=>|=<|>|<|!=|=|!)?(null|"."|'.'|.)?(.*)/,l=i.exec(n),s=null,o=null,u=null;if(l!==null&&l.length>3&&([,s,o,u]=l),u!=null&&u.trim().length>0||o==null||o.length===0)return null;s==null&&(s="=");var c=e.filter();if(o.toLowerCase()==="null")switch(s){case"=":return c.isNull();case"!=":case"!":return c.isNull().not();default:return null}var d=r.FilterValue.ofString(h.isRangeOperation(s)?h.quoteValue(o):o);return h.makeRangeFilterWithOperation(c,s,d)}makeAdvancedFilter(e,t,r){for(var{filterItems:n,filterOperators:i,invertSelection:l,selectedValues:s}=t,o=null,u=0;u<n.length;u+=1){var c=n[u],{selectedType:d,value:m}=c;if(d!=null&&d.length>0&&m!=null&&m.length>0)try{var p=this.makeAdvancedValueFilter(e,d,m,r);if(p!=null){if(u===0)o=p;else if(o!==null&&u-1<i.length){var v=i[u-1];if(v===Se.and)o=o.and(p);else if(v===Se.or)o=o.or(p);else{G.error("Unexpected filter operator",v,p),o=null;break}}}else G.debug2("Empty filter ignored for",d,m)}catch(S){G.error("Unable to create filter",S),o=null;break}}var y=this.makeSelectValueFilter(e,s,l);return y!=null&&(o!=null?o=o.and(y):o=y),o}makeAdvancedValueFilter(e,t,r,n){var{dh:i}=this;if(h.isDateType(e.type))return this.makeQuickDateFilterWithOperation(e,r,t,n);if(h.isNumberType(e.type)||h.isCharType(e.type))return this.makeQuickFilter(e,"".concat(h.getFilterOperatorString(t)).concat(r));var l=this.makeFilterValue(e.type,r),s=e.filter();switch(t){case f.eq:return s.eq(l);case f.eqIgnoreCase:return s.eqIgnoreCase(l);case f.notEq:return s.notEq(l);case f.notEqIgnoreCase:return s.notEqIgnoreCase(l);case f.greaterThan:return s.greaterThan(l);case f.greaterThanOrEqualTo:return s.greaterThanOrEqualTo(l);case f.lessThan:return s.lessThan(l);case f.lessThanOrEqualTo:return s.lessThanOrEqualTo(l);case f.isTrue:return s.isTrue();case f.isFalse:return s.isFalse();case f.isNull:return s.isNull();case f.contains:return s.isNull().not().and(s.invoke("matches",i.FilterValue.ofString("(?s)(?i).*\\Q".concat(r,"\\E.*"))));case f.notContains:return s.isNull().or(s.invoke("matches",i.FilterValue.ofString("(?s)(?i).*\\Q".concat(r,"\\E.*"))).not());case f.startsWith:return s.isNull().not().and(s.invoke("matches",i.FilterValue.ofString("(?s)(?i)^\\Q".concat(r,"\\E.*"))));case f.endsWith:return s.isNull().not().and(s.invoke("matches",i.FilterValue.ofString("(?s)(?i).*\\Q".concat(r,"\\E$"))));case f.in:case f.inIgnoreCase:case f.notIn:case f.notInIgnoreCase:case f.invoke:default:throw new Error("Unexpected filter operation: ".concat(t))}}applyNeverFilter(e,t){var r=arguments,n=this;return U(function*(){var i=r.length>2&&r[2]!==void 0?r[2]:h.APPLY_TABLE_CHANGE_TIMEOUT_MS;if(e==null)return null;var l=e.findColumn(t),s=[n.makeNeverFilter(l)];return yield n.applyFilter(e,s,i),e})()}applyCustomColumns(e,t){var r=arguments,n=this;return U(function*(){var i=r.length>2&&r[2]!==void 0?r[2]:h.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:l}=n;return h.executeAndWaitForEvent(s=>s==null?void 0:s.applyCustomColumns(t),e,l.Table.EVENT_CUSTOMCOLUMNSCHANGED,i)})()}applyFilter(e,t){var r=arguments,n=this;return U(function*(){var i=r.length>2&&r[2]!==void 0?r[2]:h.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:l}=n;return h.executeAndWaitForEvent(s=>s==null?void 0:s.applyFilter(t),e,l.Table.EVENT_FILTERCHANGED,i)})()}applySort(e,t){var r=arguments,n=this;return U(function*(){var i=r.length>2&&r[2]!==void 0?r[2]:h.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:l}=n;return h.executeAndWaitForEvent(s=>s==null?void 0:s.applySort(t),e,l.Table.EVENT_SORTCHANGED,i)})()}makeNeverFilter(e){var{dh:t}=this,r=null;h.isTextType(e.type)?r=t.FilterValue.ofString("a"):h.isBooleanType(e.type)?r=t.FilterValue.ofBoolean(!0):h.isDateType(e.type)?r=t.FilterValue.ofNumber(t.DateWrapper.ofJsDate(new Date)):r=t.FilterValue.ofNumber(0);var n=e.filter().eq(r),i=e.filter().notEq(r);return n.and(i)}makeFilterValue(e,t){var{dh:r}=this,n=h.getBaseType(e);return h.isTextType(n)?r.FilterValue.ofString(t):h.isLongType(n)?r.FilterValue.ofNumber(r.LongWrapper.ofString(h.removeCommas(t))):r.FilterValue.ofNumber(h.removeCommas(t))}makeFilterRawValue(e,t){var{dh:r}=this;return h.isTextType(e)?r.FilterValue.ofString(t):h.isBooleanType(e)?r.FilterValue.ofBoolean(t):r.FilterValue.ofNumber(t)}makeValue(e,t,r){var{dh:n}=this;if(t==="null")return null;if(h.isTextType(e))return t;if(h.isLongType(e))return n.LongWrapper.ofString(h.removeCommas(t));if(h.isBooleanType(e))return h.makeBooleanValue(t,!0);if(h.isDateType(e)){var[i]=O.parseDateRange(n,t,r);return i}return h.isNumberType(e)?h.makeNumberValue(t):(G.error("Unexpected column type",e),null)}makeSelectValueFilter(e,t,r){var{dh:n}=this;if(t.length===0)return r?null:this.makeNeverFilter(e);for(var i=[],l=!1,s=0;s<t.length;s+=1){var o=t[s];o==null?l=!0:h.isTextType(e.type)?i.push(n.FilterValue.ofString(typeof o=="number"?String.fromCharCode(o):o)):h.isBooleanType(e.type)?i.push(n.FilterValue.ofBoolean(!!o)):i.push(n.FilterValue.ofNumber(o))}return l?i.length>0?r?e.filter().isNull().not().and(e.filter().notIn(i)):e.filter().isNull().or(e.filter().in(i)):r?e.filter().isNull().not():e.filter().isNull():r?e.filter().notIn(i):e.filter().in(i)}}oe(h,"dataType",{BOOLEAN:"boolean",CHAR:"char",DATETIME:"datetime",DECIMAL:"decimal",INT:"int",STRING:"string",UNKNOWN:"unknown"});oe(h,"sortDirection",{ascending:"ASC",descending:"DESC",reverse:"REVERSE",none:null});oe(h,"APPLY_TABLE_CHANGE_TIMEOUT_MS",3e4);oe(h,"REVERSE_TYPE",Object.freeze({NONE:"none",PRE_SORT:"pre-sort",POST_SORT:"post-sort"}));oe(h,"NUMBER_REGEX",/^-?\d+(\.\d+)?$/);oe(h,"executeAndWaitForEvent",function(){var a=U(function*(e,t,r){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:h.APPLY_TABLE_CHANGE_TIMEOUT_MS;if(t==null)return null;var i=h.makeCancelableTableEventPromise(t,r,n);return e(t),yield i,t});return function(e,t,r){return a.apply(this,arguments)}}());function De(a,e,t){return e=Er(e),e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function Er(a){var e=Tr(a,"string");return typeof e=="symbol"?e:String(e)}function Tr(a,e){if(typeof a!="object"||a===null)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var r=t.call(a,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}class Le{static makeColumnFormatMap(e){return e==null?new Map:e.reduce((t,r)=>{var n=h.getNormalizedType(r.columnType);if(n===null)return t;t.has(n)||t.set(n,new Map);var i=t.get(n);return i==null||i.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,n=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0,l=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 nr,this.typeFormatterMap=new Map([[h.dataType.BOOLEAN,new Xt],[h.dataType.CHAR,new Zt],[h.dataType.DATETIME,new q(e,r)],[h.dataType.DECIMAL,new w(e,n)],[h.dataType.INT,new K(e,i)],[h.dataType.STRING,new or]]),this.columnFormatMap=Le.makeColumnFormatMap(t),this.truncateNumbersWithPound=l}getColumnFormatMapForType(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=h.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,n=this.getColumnFormatMapForType(e);return(r=n==null?void 0:n.get(t))!==null&&r!==void 0?r:null}getColumnTypeFormatter(e){var t=h.getNormalizedType(e),r=this.defaultColumnFormatter;if(t){var n;r=(n=this.typeFormatterMap.get(t))!==null&&n!==void 0?n:r}return r}getFormattedString(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",n=arguments.length>3?arguments[3]:void 0;if(e==null)return"";var i=this.getColumnTypeFormatter(t),l=n||this.getColumnFormat(t,r);return i.format(e,l??void 0)}get timeZone(){var e,t=this.typeFormatterMap.get(h.dataType.DATETIME);return t==null||(e=t.dhTimeZone)===null||e===void 0?void 0:e.id}}function br(a){if(a&&a.formatter){var{formatter:e}=a;return e}}function Fr(a){return{timeZone:a==null?void 0:a.timeZone,defaultDateTimeFormatString:a==null?void 0:a.defaultDateTimeFormat,showTimeZone:a==null?void 0:a.showTimeZone,showTSeparator:a==null?void 0:a.showTSeparator}}function Dr(a,e,t){var r=a.getColumnFormat(t,e);return r!=null&&(r.type===k.TYPE_CONTEXT_PRESET||r.type===k.TYPE_CONTEXT_CUSTOM)}const we={getColumnFormats:br,getDateTimeFormatterOptions:Fr,isCustomColumnFormatDefined:Dr};rt.register([gt,vt,pt,yt,St,Et]);function $(a,e,t){return e=Mr(e),e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function Mr(a){var e=Pr(a,"string");return typeof e=="symbol"?e:String(e)}function Pr(a,e){if(typeof a!="object"||a===null)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var r=t.call(a,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}class I{constructor(e){$(this,"dh",void 0),$(this,"listeners",void 0),$(this,"formatter",void 0),$(this,"rect",void 0),$(this,"isDownsamplingDisabled",void 0),$(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(I.EVENT_UPDATED,{detail:e}))}fireDisconnect(){this.fireEvent(new CustomEvent(I.EVENT_DISCONNECT))}fireReconnect(){this.fireEvent(new CustomEvent(I.EVENT_RECONNECT))}fireDownsampleStart(e){this.fireEvent(new CustomEvent(I.EVENT_DOWNSAMPLESTARTED,{detail:e}))}fireDownsampleFinish(e){this.fireEvent(new CustomEvent(I.EVENT_DOWNSAMPLEFINISHED,{detail:e}))}fireDownsampleFail(e){this.fireEvent(new CustomEvent(I.EVENT_DOWNSAMPLEFAILED,{detail:e}))}fireDownsampleNeeded(e){this.fireEvent(new CustomEvent(I.EVENT_DOWNSAMPLENEEDED,{detail:e}))}fireLoadFinished(){this.fireEvent(new CustomEvent(I.EVENT_LOADFINISHED))}}$(I,"EVENT_UPDATED","ChartModel.EVENT_UPDATED");$(I,"EVENT_DISCONNECT","ChartModel.EVENT_DISCONNECT");$(I,"EVENT_RECONNECT","ChartModel.EVENT_RECONNECT");$(I,"EVENT_DOWNSAMPLESTARTED","ChartModel.EVENT_DOWNSAMPLESTARTED");$(I,"EVENT_DOWNSAMPLEFINISHED","ChartModel.EVENT_DOWNSAMPLEFINISHED");$(I,"EVENT_DOWNSAMPLEFAILED","ChartModel.EVENT_DOWNSAMPLEFAILED");$(I,"EVENT_DOWNSAMPLENEEDED","ChartModel.EVENT_DOWNSAMPLENEEDED");$(I,"EVENT_LOADFINISHED","ChartModel.EVENT_LOADFINISHED");const X=I,Nr="#76d9e4 #9edc6f #fcd65b #aa9af4 #f37e3f #f95d84 #f0f0ee",wr="#403e41",Ar="#5b5a5c",Or="#c0bfbf",Ir="#4878ea",Cr="rgba(91, 90, 92, 0.7)",R={"paper-bgcolor":"#2d2a2e","plot-bgcolor":"#322f33","title-color":"#f0f0ee",colorway:Nr,gridcolor:wr,linecolor:Ar,zerolinecolor:Or,activecolor:Ir,rangebgcolor:Cr,"area-color":"#76d9e4","trend-color":"#d5f0c1","line-color":"#9edc6f","error-band-line-color":"white","error-band-fill-color":"rgba(213, 240, 193, 0.1)","ohlc-increasing":"#9edc6f","ohlc-decreasing":"#f95d84"},j=Object.freeze({paper_bgcolor:R["paper-bgcolor"],plot_bgcolor:R["plot-bgcolor"],title_color:R["title-color"],colorway:R.colorway,gridcolor:R.gridcolor,linecolor:R.linecolor,zerolinecolor:R.zerolinecolor,activecolor:R.activecolor,rangebgcolor:R.rangebgcolor,area_color:R["area-color"],trend_color:R["trend-color"],line_color:R["line-color"],error_band_line_color:R["error-band-line-color"],error_band_fill_color:R["error-band-fill-color"],ohlc_increasing:R["ohlc-increasing"],ohlc_decreasing:R["ohlc-decreasing"]});function ze(a,e){var t=Object.keys(a);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(a,n).enumerable})),t.push.apply(t,r)}return t}function ue(a){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ze(Object(t),!0).forEach(function(r){L(a,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(t)):ze(Object(t)).forEach(function(r){Object.defineProperty(a,r,Object.getOwnPropertyDescriptor(t,r))})}return a}function L(a,e,t){return e=xr(e),e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function xr(a){var e=Lr(a,"string");return typeof e=="symbol"?e:String(e)}function Lr(a,e){if(typeof a!="object"||a===null)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var r=t.call(a,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}var ge=Z.module("ChartUtils"),Ge="io.deephaven.time.DateTime",Rr=36e5,kr=1e6;function _r(a){return a.asDate!==void 0}function Vr(a){return a.asNumber!==void 0}function Xe(a){return a.dhTimeZone!==void 0}function Hr(a){return a!=null&&a.range!=null&&(a.autorange===!1||a.autorange===void 0)}class g{static getPlotlyErrorBars(e,t,r){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:j,i=r.map((s,o)=>s-e[o]),l=t.map((s,o)=>e[o]-s);return{type:"data",symmetric:!1,array:i,arrayminus:l,color:n.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 n=r.split(";"),i=n[0].match(/^([^#,0.]*)([#,]*)([0,]*)(\.?)(0*)(#*)(E?0*)(%?)(.*)/);fe(i);var[,l,s,o,,u,c,d,m,p]=i,v=o.replace(",","").length,y=s.indexOf(",")>=0||o.indexOf(",")>=0,S=y?",":"",E=d!=null&&d!==""?"e":"f",b=m!==""?m:E,T=u.length+c.length,F="",A="0".concat(v).concat(S,".").concat(T).concat(F).concat(b),N=g.convertNumberPrefix(l),C=g.convertNumberPrefix(p);return{tickformat:A,tickprefix:N,ticksuffix:C,automargin:!0}}static addTickSpacing(e,t,r){var{gapBetweenMajorTicks:n}=t;if(n>0){var i=e||{},l=n;return r&&(l=n/kr),t.log&&(l=Math.log(l)),i.tickmode="linear",i.dtick=l,i}return e}static getSourceForAxis(e,t){for(var r=0;r<e.series.length;r+=1)for(var n=e.series[r],i=0;i<n.sources.length;i+=1){var l=n.sources[i];if(l.axis===t)return l}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,n){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:g.ORIENTATION.VERTICAL;return{type:e,mode:t,name:r,orientation:i,showlegend:n??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,n=0;n<r.length;n+=1)for(var i=r[n],l=0;l<i.series.length;l+=1)if(t===i.series[l])return i;return null}static getLayoutRanges(e){for(var t={},r=Object.keys(e).filter(s=>s.indexOf("axis")>=0),n=0;n<r.length;n+=1){var i=r[n],l=e[i];Hr(l)&&(t[i]=[...l.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,n)=>{var i,l=n[t],s=(i=r.get(l))!==null&&i!==void 0?i:[];return s.push(n),r.set(l,s),r},new Map)}static getColorwayFromTheme(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:j,t=[];return e.colorway&&(Array.isArray(e.colorway)?t=e.colorway:typeof e.colorway=="string"?t=e.colorway.split(" "):ge.warn("Unable to handle colorway property: ".concat(e.colorway))),t}static titleFromSettings(e){var{series:t,xAxis:r,title:n="".concat((t??[]).join(", ")," by ").concat(r)}=e;return n}constructor(e){L(this,"dh",void 0),L(this,"daysOfWeek",void 0),this.dh=e,this.daysOfWeek=Object.freeze(e.calendar.DayOfWeek.values())}getAxisFormats(e,t){for(var r=this,n=new Map,i={tickformat:null,ticksuffix:null},l=g.getAllAxes(e),s=g.groupArray(l,"type"),{charts:o}=e,u=0;u<o.length;u+=1)for(var c=o[u],d=0;d<c.series.length;d+=1)for(var m=c.series[d],{sources:p}=m,v=p.filter(b=>b.axis),y=function(){var T=v[S],{axis:F}=T,{type:A}=F,N=s.get(A);fe(N);var C=N.indexOf(F),x=r.getAxisPropertyName(A);if(x!=null){var _=g.getAxisLayoutProperty(x,C);if(n.has(_))ge.debug("".concat(_," already added."));else{ge.debug("Adding ".concat(_," to axisFormats."));var ne=r.getPlotlyAxisFormat(T,t);if(ne===null)n.set(_,i);else{n.set(_,ne);var{businessCalendar:Q}=F;if(Q!=null){var B=[],{businessPeriods:le,businessDays:ae,holidays:Te,timeZone:ce}=Q,de=t==null?void 0:t.getColumnTypeFormatter(Ge),be;Xe(de)&&(be=de.dhTimeZone);var ke=be?(ce.standardOffset-be.standardOffset)/60:0;Te.length>0&&B.push(...r.createRangeBreakValuesFromHolidays(Te,ce,be)),le.forEach(Fe=>B.push({pattern:"hour",bounds:[g.periodToDecimal(Fe.close)+ke,g.periodToDecimal(Fe.open)+ke]})),ae.length<r.daysOfWeek.length&&r.createBoundsFromDays(ae).forEach(Fe=>B.push({pattern:"day of week",bounds:Fe})),ne.rangebreaks=B}if(n.size===c.axes.length)return{v:n}}}}},S=0;S<v.length;S+=1){var E=y();if(typeof E=="object")return E.v}return n}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:n}=this,i=new Set;switch(e){case n.plot.SeriesPlotStyle.SCATTER:(t??!1)&&i.add(g.MODE_LINES),(r??!0)&&i.add(g.MODE_MARKERS);break;case n.plot.SeriesPlotStyle.LINE:(t??!0)&&i.add(g.MODE_LINES),(r??!1)&&i.add(g.MODE_MARKERS);break}return i.size>0?[...i].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:n}=this,{sources:i}=e;return i.length===2&&((t=i[0])===null||t===void 0||(r=t.axis)===null||r===void 0?void 0:r.type)===n.plot.AxisType.Y?g.ORIENTATION.HORIZONTAL:g.ORIENTATION.VERTICAL}makeSeriesDataFromSeries(e,t,r){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:j,{name:l,isLinesVisible:s,isShapesVisible:o,plotStyle:u,lineColor:c,shapeColor:d,sources:m,shape:p,shapeSize:v}=e,y=m.some(F=>{var A;return(A=F.axis)===null||A===void 0?void 0:A.businessCalendar}),S=this.getChartType(u,y),E=this.getPlotlyChartMode(u,s??void 0,o??void 0),b=this.getPlotlySeriesOrientation(e),T=g.makeSeriesData(S,E,l,n,b);return this.addSourcesToSeriesData(T,u,m,t),this.addStylingToSeriesData(T,u,i,c,d,p,v,r),T}addSourcesToSeriesData(e,t,r,n){for(var i=e,l=0;l<r.length;l+=1){var s=r[l],{axis:o,type:u}=s,c=this.getPlotlyProperty(t,u);tt(i,c,[]);var d=o!=null?this.getAxisPropertyName(o.type):null;if(d!=null){var m=n.get(o.type);if(m){var p=m.indexOf(o),v=p>0?"".concat(p+1):"";i["".concat(d,"axis")]="".concat(d).concat(v)}}}}addStylingToSeriesData(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:j,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:null,l=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null,s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:null,o=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}),n!=null&&(t===u.plot.SeriesPlotStyle.BAR?c.marker.color=n:c.line.color=n),i!=null&&(c.marker.color=i),l!=null&&l.length>0)try{c.marker.symbol=g.getMarkerSymbol(l)}catch(d){ge.warn("Unable to handle shape",l,":",d)}s!=null&&(c.marker.size=s*g.DEFAULT_MARKER_SIZE),o!=null&&t!==u.plot.SeriesPlotStyle.PIE&&(c.visible=o)}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){for(var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,l=arguments.length>5&&arguments[5]!==void 0?arguments[5]:j,s=e,o=g.getAllAxes(t),u=0;u<t.charts.length;u+=1){var c=t.charts[u],d=r==null?void 0:r(c),m=this.getChartBounds(t,c,n,i);this.updateLayoutAxes(s,c.axes,o,n,i,m,d,l)}this.removeStaleAxes(s,o)}getChartBounds(e,t,r,n){var i,{dh:l}=this,{cols:s,rows:o}=e,{column:u,colspan:c,row:d,rowspan:m}=t,p=u+c,v=d+m,y=1/s,S=1/o,E=g.AXIS_SIZE_PX/r,b=g.AXIS_SIZE_PX/n,T={bottom:(o-v)*S+(v<o?b/2:0),top:(o-d)*S-(d>0?b/2:0),left:u*y+(u>0?E/2:0),right:p*y-(p<s?E/2:0)},F=g.groupArray(t.axes,"position"),A=(i=F.get(l.plot.AxisPosition.RIGHT))!==null&&i!==void 0?i:[];return A.length>0&&(r>0?T.right-=(T.right-T.left)*Math.max(0,Math.min(g.LEGEND_WIDTH_PX/r,g.MAX_LEGEND_SIZE)):T.right-=(T.right-T.left)*g.DEFAULT_AXIS_SIZE),T}getPlotlyDateFormat(e,t,r){var{dh:n}=this,i=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",""),l,s=e==null?void 0:e.getColumnTypeFormatter(t);return s!=null&&Xe(s)&&s.dhTimeZone!=null&&s.showTimeZone&&(l=n.i18n.DateTimeFormat.format(" z",new Date,s.dhTimeZone)),{tickformat:i,ticksuffix:l,automargin:!0}}getPlotlyAxisFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,{dh:r}=this,{axis:n,columnType:i}=e,{formatPattern:l}=n,s=null;return h.isDateType(i)?(s=this.getPlotlyDateFormat(t,i,l),s=g.addTickSpacing(s,n,!0)):h.isNumberType(i)&&(s=g.getPlotlyNumberFormat(t,i,l),s=g.addTickSpacing(s,n,!1)),n.formatType===r.plot.AxisFormatType.CATEGORY&&(s?s.type="category":s={type:"category",tickformat:void 0,ticksuffix:void 0}),s}updateLayoutAxes(e,t,r){for(var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,l=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{left:0,top:0,right:1,bottom:1},s=arguments.length>6?arguments[6]:void 0,o=arguments.length>7&&arguments[7]!==void 0?arguments[7]:j,{dh:u}=this,c=n>0?Math.max(g.MIN_AXIS_SIZE,Math.min(g.AXIS_SIZE_PX/i,g.MAX_AXIS_SIZE)):g.DEFAULT_AXIS_SIZE,d=i>0?Math.max(g.MIN_AXIS_SIZE,Math.min(g.AXIS_SIZE_PX/n,g.MAX_AXIS_SIZE)):g.DEFAULT_AXIS_SIZE,m=e,p=g.groupArray(t,"position"),v=g.groupArray(t,"type"),y=[...v.keys()],S=g.groupArray(r,"type"),E=0;E<y.length;E+=1){var b=y[E],T=this.getAxisPropertyName(b);if(T!=null){var F=v.get(b),A=S.get(b),N=b===u.plot.AxisType.Y,C=N?i:n;fe(F),fe(A);for(var x=0;x<F.length;x+=1){var _=F[x],ne=A.indexOf(_),Q=g.getAxisLayoutProperty(T,ne);m[Q]==null&&(m[Q]=this.makeLayoutAxis(b,o));var B=m[Q];if(B!=null){this.updateLayoutAxis(B,_,x,p,c,d,l);var{range:le,autorange:ae}=B;if(s!=null&&le!==void 0&&(ae===void 0||ae===!1)){var Te=s(_),[ce,de]=Te(le);ge.debug("Setting downsample range",C,ce,de),_.range(C,ce,de)}else _.range(C)}}}}}removeStaleAxes(e,t){for(var r=e,n=g.groupArray(t,"type"),i=[...n.keys()],l=0;l<i.length;l+=1){var s=i[l],o=n.get(s);fe(o);var u=o.length,c=this.getAxisPropertyName(s);if(c!=null)for(var d=g.getAxisLayoutProperty(c,u);r[d]!=null;)delete r[d],u+=1,d=g.getAxisLayoutProperty(c,u)}}updateLayoutAxis(e,t,r,n,i,l,s){var o,{dh:u}=this,c=t.type===u.plot.AxisType.Y,d=c?l:i,m=e,p=(o=t.label)!==null&&o!==void 0?o:"";if(m.title!==void 0&&typeof m.title!="string"?m.title.text=p:m.title={text:p},t.log&&(m.type="log"),m.side=this.getAxisSide(t.position),r>0){var v,y;m.overlaying=(v=this.getAxisPropertyName(t.type))!==null&&v!==void 0?v:void 0;var S=(y=n.get(t.position))!==null&&y!==void 0?y:[],E=S.indexOf(t);E>0&&(m.anchor="free",t.position===u.plot.AxisPosition.RIGHT?m.position=s.right+(E-S.length+1)*d:t.position===u.plot.AxisPosition.TOP?m.position=s.top+(E-S.length+1)*d:t.position===u.plot.AxisPosition.BOTTOM?m.position=s.bottom+(S.length-E+1)*d:t.position===u.plot.AxisPosition.LEFT&&(m.position=s.left+(S.length-E+1)*d))}else if(t.type===u.plot.AxisType.X){var b=n.get(u.plot.AxisPosition.LEFT)||[],T=n.get(u.plot.AxisPosition.RIGHT)||[],F=Math.max(s.left,s.left+(b.length-1)*l),A=Math.min(s.right-(T.length-1)*l,s.right);m.domain=[F,A]}else if(t.type===u.plot.AxisType.Y){var N=n.get(u.plot.AxisPosition.BOTTOM)||[],C=n.get(u.plot.AxisPosition.TOP)||[],x=Math.max(s.bottom,s.bottom+(N.length-1)*i),_=Math.min(s.top-(C.length-1)*i,s.top);m.domain=[x,_]}}createBoundsFromDays(e){var t=e.map(l=>this.daysOfWeek.indexOf(l)),r=this.daysOfWeek.filter(l=>!e.includes(l)).map(l=>this.daysOfWeek.indexOf(l)),n=new Set;r.forEach(l=>{for(var s=l+1;s<l+this.daysOfWeek.length;s+=1){var o=s%this.daysOfWeek.length;if(t.includes(o)){n.add(o);break}}});var i=[];return n.forEach(l=>{for(var s=l-1;s>l-this.daysOfWeek.length;s-=1){var o=s<0?s+this.daysOfWeek.length:s;if(t.includes(o)){var u=(o+1)%7;i.push([u,l]);break}}}),i}createRangeBreakValuesFromHolidays(e,t,r){var n=[],i=[];return e.forEach(l=>{l.businessPeriods.length>0?i.push(...this.createPartialHoliday(l,t,r)):n.push(this.createFullHoliday(l,t,r))}),[{values:n},...i]}createFullHoliday(e,t,r){return this.adjustDateForTimeZone("".concat(e.date.toString()," 00:00:00.000000"),t,r)}createPartialHoliday(e,t,r){var n=e.date.toString(),i=["00:00"];e.businessPeriods.forEach(m=>{i.push(m.open),i.push(m.close)}),i.push("24:00");for(var l=[],s=0;s<i.length;s+=2){var o=i[s],u=i[s+1];if(o!==u){var c=[this.adjustDateForTimeZone("".concat(n," ").concat(o,":00.000000"),t,r)],d=Rr*(g.periodToDecimal(u)-g.periodToDecimal(o));l.push({values:c,dvalue:d})}}return l}adjustDateForTimeZone(e,t,r){return r&&r.standardOffset!==t.standardOffset?this.unwrapValue(this.wrapValue(e,Ge,t),r):e}makeFigureSettings(e,t){var{dh:r}=this,{series:n,xAxis:i,type:l}=e,s=g.titleFromSettings(e),o={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:[o,u],series:(n??[]).map(c=>({plotStyle:"".concat(l),name:c,dataSources:[{type:"".concat(r.plot.SourceType.X),columnName:i??"",axis:o,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(_r(e))return r.i18n.DateTimeFormat.format(g.DATE_FORMAT,e,t);if(Vr(e))return e.asNumber()}return e}wrapValue(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,{dh:n}=this;if(h.isDateType(t)&&typeof e=="string"){var i=e,l=g.DATE_FORMAT.substr(0,e.length),s=n.i18n.DateTimeFormat.parse(l,i);if(!r)return s;var o="".concat(l," Z"),u=n.i18n.DateTimeFormat.format("Z",s,r),c=n.i18n.DateTimeFormat.parse(o,"".concat(i," ").concat(u)),d=n.i18n.DateTimeFormat.format("Z",c,r);return n.i18n.DateTimeFormat.parse(o,"".concat(i," ").concat(d))}return e}makeLayoutAxis(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:j,{dh:r}=this,n={automargin:!0,gridcolor:t.gridcolor,linecolor:t.linecolor,rangeslider:{visible:!1},showline:!0,ticklen:5,tickcolor:t.paper_bgcolor,tickfont:{color:t.zerolinecolor},title:{font:{color:t.title_color}}};return e===r.plot.AxisType.X?Object.assign(n,{showgrid:!0}):e===r.plot.AxisType.Y&&Object.assign(n,{zerolinecolor:t.zerolinecolor,zerolinewidth:2}),n}makeDefaultLayout(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:j,{dh:t}=this,r=ue(ue({},e),{},{autosize:!0,colorway:g.getColorwayFromTheme(e),font:{family:"'Fira Sans', sans-serif",color:e.title_color},title:{font:{color:e.title_color},yanchor:"top",pad:ue({},g.DEFAULT_TITLE_PADDING),y:1},legend:{font:{color:e.title_color}},margin:ue({},g.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 ue(ue({},e),{},{type:e.type!=null?t.plot.SeriesPlotStyle[e.type]:void 0})}}L(g,"DEFAULT_AXIS_SIZE",.15);L(g,"MIN_AXIS_SIZE",.025);L(g,"MAX_AXIS_SIZE",.2);L(g,"AXIS_SIZE_PX",75);L(g,"LEGEND_WIDTH_PX",50);L(g,"MAX_LEGEND_SIZE",.25);L(g,"ORIENTATION",Object.freeze({HORIZONTAL:"h",VERTICAL:"v"}));L(g,"DATE_FORMAT","yyyy-MM-dd HH:mm:ss.SSSSSS");L(g,"DEFAULT_MARGIN",Object.freeze({l:60,r:50,t:30,b:60,pad:0}));L(g,"DEFAULT_TITLE_PADDING",Object.freeze({t:8}));L(g,"SUBTITLE_LINE_HEIGHT",25);L(g,"DEFAULT_MARKER_SIZE",6);L(g,"MODE_MARKERS","markers");L(g,"MODE_LINES","lines");const H=g;function Ye(a,e){var t=Object.keys(a);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(a,n).enumerable})),t.push.apply(t,r)}return t}function Ze(a){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ye(Object(t),!0).forEach(function(r){W(a,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(t)):Ye(Object(t)).forEach(function(r){Object.defineProperty(a,r,Object.getOwnPropertyDescriptor(t,r))})}return a}function W(a,e,t){return e=Wr(e),e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function Wr(a){var e=$r(a,"string");return typeof e=="symbol"?e:String(e)}function $r(a,e){if(typeof a!="object"||a===null)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var r=t.call(a,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}var J=Z.module("Chart");class se extends Ee.Component{static convertIcon(e){var[t,,,,r]=e.icon,n="".concat(r);return{width:t,path:n,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){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,"getCachedConfig",ot((t,r,n,i,l)=>{var s=[],o=!!t;if(o&&s.push({name:"Downsampling failed: ".concat(t),title:"Downsampling failed",click:()=>{},icon:se.convertIcon(ht),attr:"fill-warning"}),r||n||i||o){var u=se.downsampleButtonTitle(n,i),c=se.downsampleButtonAttr(n,i),d=n?mt:ft;s.push({name:u,title:"Downsampling status",icon:se.convertIcon(d),click:this.handleDownsampleClick,attr:c})}var m=l.some(S=>{var{type:E}=S;return E!=null&&!E.includes("3d")}),p=l.some(S=>{var{type:E}=S;return E!=null&&E.includes("3d")}),v=["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"],y=["orbitRotation","tableRotation","resetCameraDefault3d"];return{displaylogo:!1,displayModeBar:n||o?!0:"hover",modeBarButtons:[s,["toImage"],["zoom2d","pan2d"],[...m?v:[],...p?y:[]]]}})),this.handleAfterPlot=this.handleAfterPlot.bind(this),this.handleDownsampleClick=this.handleDownsampleClick.bind(this),this.handleModelEvent=this.handleModelEvent.bind(this),this.handlePlotUpdate=this.handlePlotUpdate.bind(this),this.handleRelayout=this.handleRelayout.bind(this),this.handleRestyle=this.handleRestyle.bind(this),this.PlotComponent=Tt(e.Plotly),this.plot=Y.createRef(),this.plotWrapper=Y.createRef(),this.columnFormats=[],this.dateTimeFormatterOptions={},this.decimalFormatOptions={},this.integerFormatOptions={},this.isSubscribed=!1,this.isLoadedFired=!1,this.currentSeries=0,this.state={data:null,downsamplingError:null,isDownsampleFinished:!1,isDownsampleInProgress:!1,isDownsamplingDisabled:!1,layout:{datarevision:0},revision:0}}componentDidMount(){this.updateDimensions(),this.updateModelDimensions(),this.initData(),this.initFormatter();var{isActive:e,model:t}=this.props;e&&this.subscribe(t)}componentDidUpdate(e){var{isActive:t,model:r,settings:n}=this.props;this.updateFormatterSettings(n),r!==e.model&&(this.unsubscribe(e.model),this.subscribe(r)),t!==e.isActive&&(t?this.subscribe(r):this.unsubscribe(r))}componentWillUnmount(){var{model:e}=this.props;this.unsubscribe(e)}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:Ze(Ze({},t),e.getLayout())})}subscribe(e){if(!this.isSubscribed){if(!this.rect||this.rect.width===0||this.rect.height===0){J.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)})}handleModelEvent(e){var{type:t,detail:r}=e;switch(J.debug2("Received data update",t,r),t){case X.EVENT_UPDATED:{this.currentSeries+=1,this.setState(d=>{var{layout:m,revision:p}=d;return typeof m.datarevision=="number"&&(m.datarevision+=1),{data:r,layout:m,revision:p+1}});var{onUpdate:n}=this.props;n({isLoading:!this.isLoadedFired});break}case X.EVENT_LOADFINISHED:{var{onUpdate:i}=this.props;this.isLoadedFired=!0,i({isLoading:!1});break}case X.EVENT_DISCONNECT:{var{onDisconnect:l}=this.props;l();break}case X.EVENT_RECONNECT:{var{onReconnect:s}=this.props;s();break}case X.EVENT_DOWNSAMPLESTARTED:{this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!0,downsamplingError:null});break}case X.EVENT_DOWNSAMPLEFINISHED:{this.setState({isDownsampleFinished:!0,isDownsampleInProgress:!1,downsamplingError:null});break}case X.EVENT_DOWNSAMPLENEEDED:case X.EVENT_DOWNSAMPLEFAILED:{var o,u=(o=r.message)!==null&&o!==void 0?o:r;this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!1,isDownsamplingDisabled:!1,downsamplingError:u});var{onError:c}=this.props;c(new Error(u));break}default:J.debug("Unknown event type",t,e)}}handlePlotUpdate(e){var{layout:t}=e,r=H.getLayoutRanges(t),n=!he(r,this.ranges);n&&(this.ranges=r,this.updateModelDimensions(!0))}handleRelayout(e){if(J.debug("handleRelayout",e),e.hiddenlabels!=null){var{onSettingsChanged:t}=this.props,r=[...e.hiddenlabels];t({hiddenSeries:r})}this.updateModelDimensions()}handleRestyle(e){var[t,r]=e;if(J.debug("handleRestyle",t,r),Object.keys(t).includes("visible")){var{data:n}=this.state,{onSettingsChanged:i}=this.props;if(n!=null){var l=n.reduce((s,o)=>{var{name:u,visible:c}=o;return u!=null&&c==="legendonly"?[...s,u]:s},[]);i({hiddenSeries:l})}}}updateModelDimensions(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.getPlotRect();if(!t){J.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:n,model:i}=this.props;i.setDimensions(t),n&&this.subscribe(i)}}initFormatter(){var{settings:e}=this.props;this.updateFormatterSettings(e)}updateFormatterSettings(e){var t=we.getColumnFormats(e),r=we.getDateTimeFormatterOptions(e),{decimalFormatOptions:n={},integerFormatOptions:i={}}=e;(!he(this.columnFormats,t)||!he(this.dateTimeFormatterOptions,r)||!he(this.decimalFormatOptions,n)||!he(this.integerFormatOptions,i))&&(this.columnFormats=we.getColumnFormats(e),this.dateTimeFormatterOptions=r,this.decimalFormatOptions=n,this.integerFormatOptions=i,this.updateFormatter())}updateFormatter(){var{model:e}=this.props,t=new Le(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=>{J.debug("Unable to resize, promise rejected",r)})}render(){var{PlotComponent:e}=this,{data:t,downsamplingError:r,isDownsampleFinished:n,isDownsampleInProgress:i,isDownsamplingDisabled:l,layout:s,revision:o}=this.state,u=this.getCachedConfig(r,n,i,l,t??[]),c=t!=null;return M.jsx("div",{className:"h-100 w-100 chart-wrapper",ref:this.plotWrapper,children:c&&M.jsx(e,{ref:this.plot,data:t,layout:s,revision:o,config:u,onAfterPlot:this.handleAfterPlot,onError:J.error,onRelayout:this.handleRelayout,onUpdate:this.handlePlotUpdate,onRestyle:this.handleRestyle,useResizeHandler:!0,style:{height:"100%",width:"100%"}})})}}W(se,"defaultProps",{isActive:!0,settings:{timeZone:"America/New_York",defaultDateTimeFormat:O.FULL_DATE_FORMAT,showTimeZone:!1,showTSeparator:!0,formatter:[]},Plotly:rt,onDisconnect:()=>{},onReconnect:()=>{},onUpdate:()=>{},onError:()=>{},onSettingsChanged:()=>{}});const dn=se;function Qe(a,e){var t=Object.keys(a);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(a,n).enumerable})),t.push.apply(t,r)}return t}function Je(a){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Qe(Object(t),!0).forEach(function(r){D(a,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(t)):Qe(Object(t)).forEach(function(r){Object.defineProperty(a,r,Object.getOwnPropertyDescriptor(t,r))})}return a}function D(a,e,t){return e=jr(e),e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function jr(a){var e=Br(a,"string");return typeof e=="symbol"?e:String(e)}function Br(a,e){if(typeof a!="object"||a===null)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var r=t.call(a,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}var V=Z.module("FigureChartModel");class Pe extends X{constructor(e,t){var r,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:j;super(e),r=this,D(this,"chartUtils",void 0),D(this,"dh",void 0),D(this,"figure",void 0),D(this,"settings",void 0),D(this,"theme",void 0),D(this,"data",void 0),D(this,"layout",void 0),D(this,"seriesDataMap",void 0),D(this,"pendingSeries",void 0),D(this,"oneClicks",void 0),D(this,"filterColumnMap",void 0),D(this,"lastFilter",void 0),D(this,"isConnected",void 0),D(this,"seriesToProcess",void 0),D(this,"addPendingSeries",lt(()=>{for(var s=H.getAllAxes(this.figure),{pendingSeries:o}=this,u=function(){var m,p=o[c],v=r.figure.charts.find(y=>y.series.includes(p));r.addSeries(p,s,(m=v==null?void 0:v.showLegend)!==null&&m!==void 0?m:null),p.subscribe()},c=0;c<o.length;c+=1)u();this.pendingSeries=[]},Pe.ADD_SERIES_DEBOUNCE)),D(this,"getTimeZone",me((s,o)=>{if(o!=null){var u=o.getColumnTypeFormatter(s);if(u!=null)return u.dhTimeZone}})),D(this,"getValueTranslator",me((s,o)=>{var u=this.getTimeZone(s,o);return c=>this.chartUtils.unwrapValue(c,u)})),D(this,"getValueParser",me((s,o)=>{var u=this.getTimeZone(s,o);return c=>this.chartUtils.wrapValue(c,s,u)})),D(this,"getRangeParser",me((s,o)=>u=>{var[c,d]=u,m=this.getValueParser(s,o);return c=m(c),d=m(d),[c,d]})),D(this,"getAxisRangeParser",me((s,o)=>u=>{var c=H.getSourceForAxis(s,u);return c!=null?this.getRangeParser(c.columnType,o):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 H(e),this.figure=t,this.settings=n,this.theme=i,this.data=[];var l={data:{},layout:this.chartUtils.makeDefaultLayout(i)};this.layout={grid:{rows:t.rows,columns:t.cols,pattern:"independent"},template:l},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=H.getAllAxes(this.figure),r=[],n=0;n<e.length;n+=1)for(var i=e[n],l=0;l<i.series.length;l+=1){var s=i.series[l];r.push(s.name),this.addSeries(s,t,i.showLegend)}for(var o=[...this.seriesDataMap.keys()],u=o.filter(m=>r.indexOf(m)<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:n}=this,i=H.groupArray(t,"type"),l=this.chartUtils.makeSeriesDataFromSeries(e,i,H.getSeriesVisibility(e.name,this.settings),r,this.theme);if(this.seriesDataMap.set(e.name,l),this.data=[...this.seriesDataMap.values()],e.plotStyle===n.plot.SeriesPlotStyle.STACKED_BAR?this.layout.barmode="stack":e.plotStyle===n.plot.SeriesPlotStyle.PIE&&(this.layout.hiddenlabels=H.getHiddenLabels(this.settings)),this.layout.showlegend=this.data.length>1||e.plotStyle===n.plot.SeriesPlotStyle.PIE?r??void 0:!1,e.oneClick!=null){for(var{oneClick:s}=e,{columns:o}=s,u=0;u<o.length;u+=1)this.filterColumnMap.set(o[u].name,o[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)}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 n=0;n<r.length;n+=1){var i=r[n];V.debug2("handleFigureUpdated updating series",i.name);for(var{sources:l}=i,s=0;s<l.length;s+=1){var o=l[s],{columnType:u,type:c}=o,d=this.getValueTranslator(u,this.formatter),m=t.getArray(i,c,d);this.setDataArrayForSeries(i,c,m)}this.seriesToProcess.delete(i.name),this.seriesToProcess.size===0&&this.fireLoadFinished(),this.cleanSeries(i)}var{data:p}=this;this.fireUpdate(p)}handleRequestFailed(e){V.error("Request failed",e)}resubscribe(){this.listeners.length>0&&(this.unsubscribeFigure(),this.subscribeFigure())}setFormatter(e){super.setFormatter(e),this.updateLayoutFormats(),this.resubscribe()}setDownsamplingDisabled(e){super.setDownsamplingDisabled(e),this.resubscribe()}handleFigureDisconnected(e){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 n=(t=(r=(e??"").match(/<br>/g))===null||r===void 0?void 0:r.length)!==null&&t!==void 0?t:0,i=H.DEFAULT_MARGIN.t+n*H.SUBTITLE_LINE_HEIGHT;this.layout.margin?this.layout.margin.t=i:this.layout.margin={t:i},typeof this.layout.title=="string"?this.layout.title=e:(this.layout.title=Je({},this.layout.title),this.layout.title.text=e,this.layout.title.pad=Je({},this.layout.title.pad),this.layout.title.pad.t=H.DEFAULT_TITLE_PADDING.t+n*H.SUBTITLE_LINE_HEIGHT*.5)}getPlotWidth(){var e,t,r,n;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=(n=this.layout.margin)===null||n===void 0?void 0:n.r)!==null&&r!==void 0?r:0),0)}getPlotHeight(){var e,t,r,n;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=(n=this.layout.margin)===null||n===void 0?void 0:n.b)!==null&&r!==void 0?r:0),0)}updateAxisPositions(){var e=this.getPlotWidth(),t=this.getPlotHeight();this.chartUtils.updateFigureAxes(this.layout,this.figure,r=>this.getAxisRangeParser(r,this.formatter),e,t,this.theme)}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 n=this.layout[r];n!=null?Object.assign(n,t):V.debug("Ignoring null layout.".concat(r))})}}setDataArrayForSeries(e,t,r){var{name:n,plotStyle:i}=e,l=this.seriesDataMap.get(n),s=this.chartUtils.getPlotlyProperty(i,t);l&&tt(l,s,r)}cleanSeries(e){var{dh:t}=this,{name:r,plotStyle:n}=e,i=this.seriesDataMap.get(r);if(i!=null){if(n===t.plot.SeriesPlotStyle.HISTOGRAM){var{xLow:l,xHigh:s}=i;if(l&&s&&l.length===s.length){for(var o=[],u=0;u<l.length;u+=1)o.push(s[u]-l[u]);i.width=o}}else if(n===t.plot.SeriesPlotStyle.LINE||n===t.plot.SeriesPlotStyle.ERROR_BAR||n===t.plot.SeriesPlotStyle.BAR){var{x:c,xLow:d,xHigh:m,y:p,yLow:v,yHigh:y}=i;d&&m&&d!==c&&(i.error_x=H.getPlotlyErrorBars(c,d,m)),v&&y&&v!==p&&(i.error_y=H.getPlotlyErrorBars(p,v,y))}else if(n===t.plot.SeriesPlotStyle.TREEMAP){var{ids:S,labels:E}=i;S!==void 0&&E===void 0&&(i.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 l=t.oneClicks[n],{columns:s}=l,o=new Set([...e.keys(),...t.lastFilter.keys()]);o.forEach(u=>{var c=e.get(u);t.lastFilter.get(u)!==c&&s.find(d=>d.name===u)!=null&&l.setValueForColumn(u,c)})},n=0;n<this.oneClicks.length;n+=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}}D(Pe,"ADD_SERIES_DEBOUNCE",50);const Ue=Pe;function et(a,e,t,r,n,i,l){try{var s=a[i](l),o=s.value}catch(u){t(u);return}s.done?e(o):Promise.resolve(o).then(r,n)}function Ae(a){return function(){var e=this,t=arguments;return new Promise(function(r,n){var i=a.apply(e,t);function l(o){et(i,r,n,l,s,"next",o)}function s(o){et(i,r,n,l,s,"throw",o)}l(void 0)})}}class Re{static makeModelFromSettings(e,t,r){var n=arguments;return Ae(function*(){var i=n.length>3&&n[3]!==void 0?n[3]:j,l=yield Re.makeFigureFromSettings(e,t,r);return new Ue(e,l,t,i)})()}static makeFigureFromSettings(e,t,r){return Ae(function*(){var n=yield r.copy();return n.applyCustomColumns(r.customColumns),n.applyFilter(r.filter),n.applySort(r.sort),e.plot.Figure.create(new H(e).makeFigureSettings(t,n))})()}static makeModel(e,t,r){var n=arguments;return Ae(function*(){var i=n.length>3&&n[3]!==void 0?n[3]:j;return new Ue(e,r,t,i)})()}}const hn=Re;var qr=Ee.createContext(null);function mn(){return at(qr,"No IdeConnection available in useConnection. Was code wrapped in ConnectionContext.Provider?")}export{xt as $,un as A,Xt as B,dn as C,q as D,br as E,Le as F,Fr as G,vr as H,K as I,pr as J,Dr as K,cn as L,X as M,j as N,H as O,Oe as P,Ue as Q,Zr as R,or as S,nt as T,Ne as U,qr as V,He as W,Xr as X,Yr as Y,Se as Z,sn as _,Ur as a,Jr as b,hn as c,at as d,ie as e,_t as f,f as g,Zt as h,Qr as i,O as j,w as k,nr as l,we as m,k as n,h as o,en as p,st as q,gr as r,nn as s,on as t,mn as u,tn as v,rn as w,an as x,cr as y,ln as z};
|
|
2
|
-
//# sourceMappingURL=useConnection-
|
|
1
|
+
import{r as Ee,G as Y,C as M,E as ve,F as _e,a3 as Ve,aM as tt,ae as he,ad as ot,K as lt,W as me}from"./vendor-6502331b.js";import{m as ut,L as Z,B as ct,Q as dt,p as fe,a8 as ht,aI as mt,aJ as ft}from"./index-9e419f44.js";import{P as rt,b as gt,h as vt,p as pt,o as yt,s as St,t as Et,c as Tt}from"./plotly-c75409ed.js";var Xr=Object.freeze([]),Yr=new Map,Zr=()=>{};function Ne(){for(var a=arguments.length,e=new Array(a),t=0;t<a;t++)e[t]=arguments[t];return e.filter(r=>r!=null)}function bt(a,e,t){return e=Ft(e),e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function Ft(a){var e=Dt(a,"string");return typeof e=="symbol"?e:String(e)}function Dt(a,e){if(typeof a!="object"||a===null)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var r=t.call(a,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}class Mt extends Error{constructor(){super(...arguments),bt(this,"isCanceled",!0)}}const He=Mt;function Pt(a){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,t=Nt(a,e);t.forEach(r=>{a[r]=a[r].bind(a)})}function Nt(a,e){for(var t=new Set,r=a,n=0;r!=null&&r!==Object.prototype&&(n<=1||e);){for(var i of Object.getOwnPropertyNames(r))i!=="constructor"&&typeof r[i]=="function"&&t.add(i);r=Object.getPrototypeOf(r),n+=1}return[...t.keys()]}function wt(a,e,t){return e=At(e),e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function At(a){var e=Ot(a,"string");return typeof e=="symbol"?e:String(e)}function Ot(a,e){if(typeof a!="object"||a===null)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var r=t.call(a,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}class It extends Error{constructor(){super(...arguments),wt(this,"isTimeout",!0)}}const nt=It;class Oe{static makeCancelable(e,t){var r=!1,n,i,l=new Promise((s,o)=>{i=o,Promise.resolve(e).then(u=>{r?t&&t(u):(n=u,s(u))}).catch(u=>o(u))});return l.cancel=()=>{r=!0,i(new He),n!=null&&t&&t(n)},l}static isCanceled(e){return e instanceof He}static isTimedOut(e){return e instanceof nt}static withTimeout(e,t){return new Promise((r,n)=>{setTimeout(()=>{try{r(t())}catch(i){n(i)}},e)})}}class Ct{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(", "),n=e[e.length-1];return"".concat(r,", ").concat(t," ").concat(n)}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 xt=Ct;function at(a){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"No value available in context. Was code wrapped in a provider?",t=Ee.useContext(a);if(t==null)throw new Error(e);return t}function Lt(a,e,t){return e=Rt(e),e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function Rt(a){var e=kt(a,"string");return typeof e=="symbol"?e:String(e)}function kt(a,e){if(typeof a!="object"||a===null)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var r=t.call(a,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}function Qr(a){return a.then!==void 0}class re{static disableAllActions(){re.actionsDisabled=!0}static enableAllActions(){re.actionsDisabled=!1}static isContextActionEvent(e){return Array.isArray(e.contextActions)}static compareActions(e,t){if(e.group!==t.group){var r,n;return((r=e.group)!==null&&r!==void 0?r:0)>((n=t.group)!==null&&n!==void 0?n:0)?1:-1}if(e.order!==t.order){var i,l;return((i=e.order)!==null&&i!==void 0?i:0)>((l=t.order)!==null&&l!==void 0?l:0)?1:-1}if(e.title!==t.title){var s,o;return((s=e.title)!==null&&s!==void 0?s:"")>((o=t.title)!==null&&o!==void 0?o:"")?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(re.compareActions),t}static isMacPlatform(){var{platform:e}=window.navigator;return e.startsWith("Mac")}static getModifierKey(){return re.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(e){var t=re.getModifierKey();return e[t]}static getMenuItems(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=[],n=e;Array.isArray(n)||(n=[n]);for(var i=0;i<n.length;i+=1){var l=n[i],s=void 0;typeof l=="function"?s=l():s=l,s!=null&&(s instanceof Promise?t&&r.push(s):Array.isArray(s)?r=r.concat(s):r.push(s))}return r=r.filter(o=>o.title!==void 0||o.then!=null||o.menuElement),r}static getNextMenuItem(e,t,r){var n=e;n<0&&t<0&&(n=r.length);for(var i=1;i<r.length+1;i+=1){var l=(n+t*i+r.length)%r.length,s=r[l];if(!(s instanceof Promise)&&s.disabled!==!0)return l}return e}}Lt(re,"actionsDisabled",!1);const ie=re;var Ie=Y.forwardRef((a,e)=>{var t;function r(N){var{menuItem:C,onMenuItemClick:x}=a;x(C,N)}function n(N){var{menuItem:C,onMenuItemMouseMove:x}=a;x(C,N)}function i(N){var{menuItem:C,onMenuItemContextMenu:x}=a;x(C,N)}function l(N,C,x){if(typeof N.type=="string")return N;var{closeMenu:_,menuItem:ne,isKeyboardSelected:Q,isMouseSelected:B,"data-testid":le}=a,ae={menuItem:ne,closeMenu:_,isKeyboardSelected:Q,isMouseSelected:B,iconElement:C,displayShortcut:x,"data-testid":le};return Y.cloneElement(N,{forwardedProps:ae})}var{children:s,menuItem:o,isKeyboardSelected:u=!1,isMouseSelected:c=!1,"data-testid":d}=a,m=(t=o.shortcut)===null||t===void 0?void 0:t.getDisplayText(),p=null;if(o.icon){var v=o.icon;if(Y.isValidElement(v))p=v;else{var y;o.iconColor!=null&&(o.disabled===void 0||!o.disabled)&&(y={color:o.iconColor}),p=M.jsx(_e,{icon:v,style:y})}}var S=null,E=!!s;o.actions&&(S=M.jsx(_e,{icon:ut}));var b=null;if(o.menuElement)b=M.jsx("div",{className:"custom-menu-item",onMouseMove:n,children:l(o.menuElement,p,m)});else{var T,F=o.disabled,A=o.iconOutline;b=M.jsx("button",{type:"button",className:ve("btn-context-menu",{disabled:F},{active:(E||c)&&(F===void 0||!F)},{"keyboard-active":u&&(F===void 0||!F)}),onClick:r,onMouseMove:n,onContextMenu:i,title:(T=o.description)!==null&&T!==void 0?T:"",children:M.jsxs("div",{className:"btn-context-menu-wrapper",children:[M.jsx("span",{className:ve("icon",{outline:A}),children:p}),M.jsx("span",{className:"title",children:o.title}),m!==void 0&&M.jsx("span",{className:"shortcut",children:m}),S&&M.jsx("span",{className:ve("submenu-indicator",{disabled:F}),children:S})]})})}return M.jsxs("div",{className:"context-menu-item",ref:e,"data-testid":d,children:[s,b]})});Ie.displayName="ContextMenuItem";Ie.defaultProps={children:null,isKeyboardSelected:!1,isMouseSelected:!1,"data-testid":void 0};const _t=Ie;function We(a,e){var t=Object.keys(a);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(a,n).enumerable})),t.push.apply(t,r)}return t}function Vt(a){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?We(Object(t),!0).forEach(function(r){ee(a,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(t)):We(Object(t)).forEach(function(r){Object.defineProperty(a,r,Object.getOwnPropertyDescriptor(t,r))})}return a}function ee(a,e,t){return e=Ht(e),e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function Ht(a){var e=Wt(a,"string");return typeof e=="symbol"?e:String(e)}function Wt(a,e){if(typeof a!="object"||a===null)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var r=t.call(a,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}var $e=Z.module("ContextMenu");class pe extends Ee.PureComponent{static handleContextMenu(e){e.metaKey||(e.stopPropagation(),e.preventDefault())}constructor(e){super(e),ee(this,"container",void 0),ee(this,"oldFocus",void 0),ee(this,"activeSubMenuRef",void 0),ee(this,"subMenuTimer",void 0),ee(this,"rAF",void 0),ee(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=Y.createRef(),this.oldFocus=document.activeElement,this.activeSubMenuRef=Y.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:n}=this.state;if(n!==t.activeSubMenu)if(n==null){var i;(i=this.container.current)===null||i===void 0||i.focus()}else this.setActiveSubMenuPosition();if(e.actions!==r&&(this.initMenu(),this.container.current==null||!this.container.current.contains(document.activeElement))){var l;(l=this.container.current)===null||l===void 0||l.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,n=ie.getMenuItems(r),i=[],l=n.length-1;l>=0;l-=1){var s=n[l];s instanceof Promise?this.initMenuPromise(s):i.push(s)}this.setState({mouseIndex:-1,keyboardIndex:t,activeSubMenu:null,menuItems:ie.sortActions(i)})}initMenuPromise(e){var t=Oe.makeCancelable(e);this.setState(r=>({pendingItems:r.pendingItems.concat(t)})),t.then(r=>{this.setState(n=>{var i=n.pendingItems.indexOf(t);if(i>=0){var l=n.pendingItems.slice();return l.splice(i,1),{menuItems:ie.sortActions(n.menuItems.concat(r)),pendingItems:l}}return null})},r=>{Oe.isCanceled(r)||(this.setState(n=>{var i=n.pendingItems.indexOf(t);if(i>=0){var l=n.pendingItems.slice();return l.splice(i,1),{pendingItems:l}}return null}),$e.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,n,{options:i,updatePosition:l,subMenuParentWidth:s,subMenuParentHeight:o,top:u,left:c}=this.props;if(!(!this.container.current||i.doNotVerifyPosition!=null&&i.doNotVerifyPosition)){var{top:d,left:m}=this.initialPosition,{width:p,height:v}=(e=(t=this.container.current)===null||t===void 0?void 0:t.getBoundingClientRect())!==null&&e!==void 0?e:{width:0,height:0},y=((r=(n=this.container.current)===null||n===void 0?void 0:n.scrollHeight)!==null&&r!==void 0?r:0)>window.innerHeight;v===0||p===0||(d+v>window.innerHeight&&(d-v-o>0?d-=v-o:d=window.innerHeight-v),m+p>window.innerWidth&&(m=m-p-s),(c!==m||u!==d)&&(this.setState({hasOverflow:y}),l(d,m)))}}handleWindowResize(){this.container.current&&this.closeMenu(!0)}handleBlur(e){if(!this.container.current){$e.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(),n=r,i=!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?i=!0:n=0:this.isEscapeKey(e.key)?n=null:e.key==="ArrowUp"||e.shiftKey&&e.key==="Tab"?n=ie.getNextMenuItem(n,-1,t):(e.key==="ArrowDown"||e.key==="Tab")&&(n=ie.getNextMenuItem(n,1,t)),i){this.openSubMenu(r),e.preventDefault(),e.stopPropagation();return}r!==n&&(n!==null?this.setKeyboardIndex(n):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}openSubMenu(e){var{menuItems:t,activeSubMenu:r}=this.state,n=t[e].actions?e:null;r!==n&&this.setState({activeSubMenu:n,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:n,hasOverflow:i,keyboardIndex:l,menuItems:s,mouseIndex:o,pendingItems:u,subMenuTop:c,subMenuLeft:d,subMenuParentWidth:m,subMenuParentHeight:p}=this.state,v=0;v<s.length;v+=1){var y=s[v];v>0&&y.group!==s[v-1].group&&e.push(M.jsx("hr",{},"".concat(v,".separator")));var S=M.jsx(_t,{ref:n===v?this.activeSubMenuRef:null,isKeyboardSelected:l===v,isMouseSelected:o===v,menuItem:y,closeMenu:this.handleCloseSubMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:this.handleMenuItemContextMenu},v);e.push(S)}var E=null;u.length>0&&(E=M.jsx("div",{className:"loading",children:M.jsx(ct,{className:"loading-spinner-vertical-align"})}));var{menuStyle:b,"data-testid":T}=this.props,F=n!==null&&c!==null&&d!==null;return M.jsxs(M.Fragment,{children:[M.jsxs("div",{className:ve({"has-overflow":i},"context-menu-container"),style:Vt({top:t,left:r},b),ref:this.container,"data-dh-context-menu":!0,onBlur:this.handleBlur,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,onContextMenu:pe.handleContextMenu,role:"menuitem",tabIndex:0,"data-testid":T,children:[e,E]}),F&&n!==null&&c!==null&&d!==null&&M.jsx(pe,{actions:s[n].actions||[],closeMenu:this.handleCloseSubMenu,top:c,left:d,updatePosition:(A,N)=>{this.setState({subMenuTop:A,subMenuLeft:N})},subMenuParentWidth:m,subMenuParentHeight:p},"sub-".concat(n))]})}}ee(pe,"defaultProps",{subMenuParentWidth:0,subMenuParentHeight:0,closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0});const $t=pe;function je(a,e,t){return e=jt(e),e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function jt(a){var e=Bt(a,"string");return typeof e=="symbol"?e:String(e)}function Bt(a,e){if(typeof a!="object"||a===null)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var r=t.call(a,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}class qt extends Ee.Component{constructor(e){super(e),je(this,"container",void 0),je(this,"openMenu",void 0),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.container=Y.createRef(),this.openMenu=Y.createRef(),this.state={actions:null,left:0,top:0}}componentDidMount(){var e;(e=this.container.current)!==null&&e!==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,n=e.clientX-t.left,{actions:i}=this.state;if(i!=null&&e.target===this.container.current){e.preventDefault(),this.setState({actions:null},()=>{var s=document.elementFromPoint(n,r),o=new MouseEvent("contextmenu",{clientX:e.clientX,clientY:e.clientY,bubbles:!0,cancelable:!0});s==null||s.dispatchEvent(o)});return}if(ie.isContextActionEvent(e)&&!(e.metaKey||e.ctrlKey)){var l=ie.getMenuItems(e.contextActions);l.length!==0&&(e.preventDefault(),this.setState({actions:l,top:r,left:n}))}}}handleMenuClose(e){e===this.openMenu.current&&this.setState({actions:null})}render(){var e=null,{"data-testid":t}=this.props,{actions:r,top:n,left:i}=this.state;return r&&(e=M.jsx($t,{ref:this.openMenu,actions:r,onMenuClosed:this.handleMenuClose,top:n,left:i,updatePosition:(l,s)=>{this.setState({top:l,left:s})},"data-testid":t})),M.jsx("div",{className:ve("context-menu-root",{active:r}),ref:this.container,children:e})}}const Jr=qt;function Ur(){return at(dt,"No API available in useApi. Was code wrapped in ApiBootstrap or ApiContext.Provider?")}function Ce(a,e,t){return e=Kt(e),e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function Kt(a){var e=zt(a,"string");return typeof e=="symbol"?e:String(e)}function zt(a,e){if(typeof a!="object"||a===null)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var r=t.call(a,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}class Me{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""}}Ce(Me,"TYPE_GLOBAL","type-global");Ce(Me,"TYPE_CONTEXT_PRESET","type-context-preset");Ce(Me,"TYPE_CONTEXT_CUSTOM","type-context-custom");const k=Me;class Gt extends k{format(e){switch(e){case 1:case!0:return"true";case 0:case!1:return"false";default:return""}}}const Xt=Gt;class Yt extends k{format(e){return String.fromCharCode(e)}}const Zt=Yt;function te(a,e,t){return e=Qt(e),e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function Qt(a){var e=Jt(a,"string");return typeof e=="symbol"?e:String(e)}function Jt(a,e){if(typeof a!="object"||a===null)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var r=t.call(a,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}var Be=Z.module("DateTimeColumnFormatter");class q extends k{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]:k.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'":" ",n=e?" z":"";return new Map([["yyyy-MM-dd HH:mm:ss","yyyy-MM-dd".concat(r,"HH:mm:ss").concat(n)],["yyyy-MM-dd HH:mm:ss.SSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSS").concat(n)],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSSSSSSSS").concat(n)]])}static getGlobalFormats(e,t){var r=q.makeGlobalFormatStringMap(e,t);return[...r.keys()]}static makeFormatStringMap(e,t){var r=t!==void 0&&t?"'T'":" ",n=e!==void 0&&e?" z":"";return new Map([["yyyy-MM-dd","yyyy-MM-dd".concat(n)],["MM-dd-yyyy","MM-dd-yyyy".concat(n)],["HH:mm:ss","HH:mm:ss".concat(n)],["HH:mm:ss.SSS","HH:mm:ss.SSS".concat(n)],["HH:mm:ss.SSSSSSSSS","HH:mm:ss.SSSSSSSSS".concat(n)],["yyyy-MM-dd HH:mm:ss","yyyy-MM-dd".concat(r,"HH:mm:ss").concat(n)],["yyyy-MM-dd HH:mm:ss.SSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSS").concat(n)],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSSSSSSSS").concat(n)]])}static getFormats(e,t){var r=q.makeFormatStringMap(e,t);return[...r.keys()]}constructor(e){var{timeZone:t="",showTimeZone:r=!0,showTSeparator:n=!1,defaultDateTimeFormatString:i=q.DEFAULT_DATETIME_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),te(this,"dh",void 0),te(this,"dhTimeZone",void 0),te(this,"defaultDateTimeFormatString",void 0),te(this,"showTimeZone",void 0),te(this,"showTSeparator",void 0),te(this,"formatStringMap",void 0);var l=t||q.DEFAULT_TIME_ZONE_ID;try{this.dhTimeZone=e.i18n.TimeZone.getTimeZone(l)}catch{Be.error("Unsupported time zone id",l),this.dhTimeZone=e.i18n.TimeZone.getTimeZone(q.DEFAULT_TIME_ZONE_ID)}this.dh=e,this.defaultDateTimeFormatString=i,this.showTimeZone=r,this.showTSeparator=n,this.formatStringMap=q.makeFormatStringMap(r,n)}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,n=this.getEffectiveFormatString(r);try{return this.dh.i18n.DateTimeFormat.format(n,e,this.dhTimeZone)}catch{Be.error("Invalid format arguments")}return""}}te(q,"DEFAULT_DATETIME_FORMAT_STRING","yyyy-MM-dd HH:mm:ss.SSS");te(q,"DEFAULT_TIME_ZONE_ID","America/New_York");function z(a,e,t){return e=Ut(e),e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function Ut(a){var e=er(a,"string");return typeof e=="symbol"?e:String(e)}function er(a,e){if(typeof a!="object"||a===null)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var r=t.call(a,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}var tr=Z.module("DecimalColumnFormatter");class w extends k{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]:k.TYPE_CONTEXT_PRESET,n=arguments.length>3?arguments[3]:void 0;return{label:e,type:r,formatString:t,multiplier:n}}static makePresetFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0;return w.makeFormat(e,t,k.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 w.makeFormat("Custom Format",e,k.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=w.DEFAULT_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),z(this,"defaultFormatString",void 0),z(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,n=t.multiplier!=null&&t.multiplier!==0?e*t.multiplier:e;try{return this.dh.i18n.NumberFormat.format(r,n)}catch{tr.error("Invalid format arguments")}return""}}z(w,"DEFAULT_FORMAT_STRING","###,##0.0000");z(w,"FORMAT_PERCENT",w.makePresetFormat("Percent","##0.00%"));z(w,"FORMAT_BASIS_POINTS",w.makePresetFormat("Basis Points","###,##0 bp",1e4));z(w,"FORMAT_MILLIONS",w.makePresetFormat("Millions","###,##0.000 mm",1e-6));z(w,"FORMAT_SCIENTIFIC_NOTATION",w.makePresetFormat("Scientific Notation","0.0000E0"));z(w,"FORMAT_ROUND",w.makePresetFormat("Round","###,##0"));z(w,"FORMAT_ROUND_TWO_DECIMALS",w.makePresetFormat("0.00","###,##0.00"));z(w,"FORMAT_ROUND_FOUR_DECIMALS",w.makePresetFormat("0.0000","###,##0.0000"));class rr extends k{format(e){return"".concat(e)}}const nr=rr;function ye(a,e,t){return e=ar(e),e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function ar(a){var e=ir(a,"string");return typeof e=="symbol"?e:String(e)}function ir(a,e){if(typeof a!="object"||a===null)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var r=t.call(a,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}var sr=Z.module("IntegerColumnFormatter");class K extends k{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]:k.TYPE_CONTEXT_PRESET,n=arguments.length>3?arguments[3]:void 0;return{label:e,type:r,formatString:t,multiplier:n}}static makePresetFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0;return K.makeFormat(e,t,k.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 K.makeFormat("Custom Format",e,k.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=K.DEFAULT_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),ye(this,"dh",void 0),ye(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,n=t.multiplier!=null&&t.multiplier!==0?e*t.multiplier:e;try{return this.dh.i18n.NumberFormat.format(r,n)}catch{sr.error("Invalid format arguments")}return""}}ye(K,"DEFAULT_FORMAT_STRING","###,##0");ye(K,"FORMAT_MILLIONS",K.makePresetFormat("Millions","###,##0.000 mm",1e-6));ye(K,"FORMAT_SCIENTIFIC_NOTATION",K.makePresetFormat("Scientific Notation","0.0000E0"));class or extends k{format(e){return e}}function it(a,e,t){return e=lr(e),e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function lr(a){var e=ur(a,"string");return typeof e=="symbol"?e:String(e)}function ur(a,e){if(typeof a!="object"||a===null)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var r=t.call(a,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}class O{static makeDateWrapper(e,t,r){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:1,l=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0,s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:0,o=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(n+1).padStart(2,"0"),m="".concat(i).padStart(2,"0"),p="".concat(l).padStart(2,"0"),v="".concat(s).padStart(2,"0"),y="".concat(o).padStart(2,"0"),S="".concat(u).padStart(9,"0"),E="".concat(c,"-").concat(d,"-").concat(m," ").concat(p,":").concat(v,":").concat(y,".").concat(S);return e.i18n.DateTimeFormat.parse(O.FULL_DATE_FORMAT,E,e.i18n.TimeZone.getTimeZone(t))}static getNextNanos(e){var t=parseInt(e,10),r="0".repeat(9-e.length),n="".concat(t+1).concat(r);return parseInt(n,10)}static getNextDate(e,t,r,n){var{year:i,month:l,date:s,hours:o,minutes:u,seconds:c,nanos:d}=r;if(t.nanos!=null){if(t.nanos.length===9)return null;d=O.getNextNanos(t.nanos),d>999999999&&(c+=1,d=0)}else t.seconds!=null?c+=1:t.minutes!=null?u+=1:t.hours!=null?o+=1:t.date!=null?s+=1:t.month!=null?l+=1:i+=1;var m=new Date(i,l,s,o,u,c);return O.makeDateWrapper(e,n,m.getFullYear(),m.getMonth(),m.getDate(),m.getHours(),m.getMinutes(),m.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 n=0;n<O.months.length;n+=1)if(O.months[n].startsWith(r))return n}return NaN}static parseDateValues(e,t,r,n,i,l,s){var o=parseInt(e,10),u=t!=null?this.parseMonth(t):0,c=r!=null?parseInt(r,10):1,d=n!=null?parseInt(n,10):0,m=i!=null?parseInt(i,10):0,p=l!=null?parseInt(l,10):0,v=s!=null?parseInt(s.padEnd(9,"0"),10):0;return Number.isNaN(o)||Number.isNaN(u)||Number.isNaN(c)||Number.isNaN(d)||Number.isNaN(m)||Number.isNaN(p)||Number.isNaN(v)?null:{year:o,month:u,date:c,hours:d,minutes:m,seconds:p,nanos:v}}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[,n,,i,,l,,s,,o,,u,,c,d]=r;if(d!=null&&d.length>0)throw new Error("Unexpected characters after date string '".concat(e,"': ").concat(d));return{year:n,month:i,date:l,hours:s,minutes:o,seconds:u,nanos:c}}static parseDateRange(e,t,r){var n=t.trim().toLowerCase();if(n.length===0)throw new Error("Cannot parse date range from empty string");if(n==="null")return[null,null];if(n==="today"){var i=new Date(Date.now()),l=O.makeDateWrapper(e,r,i.getFullYear(),i.getMonth(),i.getDate()),s=new Date(i.getFullYear(),i.getMonth(),i.getDate()+1),o=O.makeDateWrapper(e,r,s.getFullYear(),s.getMonth(),s.getDate());return[l,o]}if(n==="yesterday"){var u=new Date(Date.now()),c=new Date(u.getFullYear(),u.getMonth(),u.getDate()-1),d=O.makeDateWrapper(e,r,c.getFullYear(),c.getMonth(),c.getDate()),m=O.makeDateWrapper(e,r,u.getFullYear(),u.getMonth(),u.getDate());return[d,m]}if(n==="now"){var p=new Date(Date.now()),v=e.DateWrapper.ofJsDate(p);return[v,null]}var y=O.parseDateTimeString(n);if(y.year==null&&y.month==null&&y.date==null)throw new Error("Unable to extract year, month, or day ".concat(n));var S=O.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 E=O.makeDateWrapper(e,r,S.year,S.month,S.date,S.hours,S.minutes,S.seconds,S.nanos),b=O.getNextDate(e,y,S,r);return[E,b]}static getJsDate(e){return typeof e=="number"?new Date(e):e.asDate()}}it(O,"FULL_DATE_FORMAT","yyyy-MM-dd HH:mm:ss.SSSSSSSSS");it(O,"months",["january","february","march","april","may","june","july","august","september","october","november","december"]);function en(a,e){return a===e?{operator:"notEq",value:""}:{operator:"eq",value:a}}function tn(a,e,t){return function(n){var i=t.trim();if(i==="")return null;var l=st(e,s=>s.filter().containsIgnoreCase(a.makeFilterValue(s.type,i)),"or");return l(n)}}function st(a,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"or";return function(n){var i=n==null?void 0:n.findColumns(typeof a=="string"?[a]:a);if(i==null||i.length===0)return null;var l=i.map(e);return l.reduce((s,o)=>s[t](o))}}function cr(a,e,t,r){return st(e,n=>n.filter()[r](a.makeFilterValue(n.type,t)),"or")}function rn(a,e,t,r,n){return function(l){var s=l==null?void 0:l.findColumn(e),o=t==="all"||r&&t.size===0;return s==null||o?null:a.makeSelectValueFilter(s,[...t.keys()],n)}}function nn(a){return function(t){return t.filter().isNull().not().and(t.filter().notEq(a.makeFilterValue(t.type,"")))}}function an(a,e){return function(r){var n=r.filter(),i=a.makeFilterValue(r.type,""),l=n.eq(i);return e?n.isNull().or(l):l.or(n.notEq(i))}}function xe(a,e,t){return e=dr(e),e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function dr(a){var e=hr(a,"string");return typeof e=="symbol"?e:String(e)}function hr(a,e){if(typeof a!="object"||a===null)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var r=t.call(a,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}class Se{}xe(Se,"not","not");xe(Se,"and","and");xe(Se,"or","or");function sn(a){if(!(a==="not"||a==="and"||a==="or"))throw new Error("operator is not a valid FilterOperatorValue")}function P(a,e,t){return e=mr(e),e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function mr(a){var e=fr(a,"string");return typeof e=="symbol"?e:String(e)}function fr(a,e){if(typeof a!="object"||a===null)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var r=t.call(a,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}class f{}P(f,"eq","eq");P(f,"eqIgnoreCase","eqIgnoreCase");P(f,"notEq","notEq");P(f,"notEqIgnoreCase","notEqIgnoreCase");P(f,"greaterThan","greaterThan");P(f,"greaterThanOrEqualTo","greaterThanOrEqualTo");P(f,"lessThan","lessThan");P(f,"lessThanOrEqualTo","lessThanOrEqualTo");P(f,"in","in");P(f,"inIgnoreCase","inIgnoreCase");P(f,"notIn","notIn");P(f,"notInIgnoreCase","notInIgnoreCase");P(f,"isTrue","isTrue");P(f,"isFalse","isFalse");P(f,"isNull","isNull");P(f,"invoke","invoke");P(f,"contains","contains");P(f,"notContains","notContains");P(f,"containsIgnoreCase","containsIgnoreCase");P(f,"startsWith","startsWith");P(f,"endsWith","endsWith");P(f,"containsAny","containsAny");var qe=Z.module("ViewportDataUtils");function gr(a,e){return String(a.offsetInSnapshot+e)}function on(a,e){var{bulkUpdate:t}=a;return function(n){var{columns:i,offset:l,rows:s}=n.detail;qe.debug("table updated",n.detail);var o=new Map;s.forEach(u=>{var c=e(u,i),d=gr(u,l);o.set(d,{key:d,item:c})}),qe.debug("update keys",o),t(o)}}function ln(a,e){return e.reduce((t,r)=>(t[r.name]=a.get(r),t),{})}function*un(a,e){for(var t=a;t<=e;++t)yield{key:String(t)}}function vr(a){return a==null||pr(a)?0:a.size}function pr(a){return"isClosed"in a?a.isClosed:!1}function cn(a,e,t,r){var n=a+e-1,[i,l]=[0,r-1],s=Ve(a-t,i,l),o=Ve(n+t,i,l);return[s,o]}function Ke(a,e,t,r,n,i,l){try{var s=a[i](l),o=s.value}catch(u){t(u);return}s.done?e(o):Promise.resolve(o).then(r,n)}function U(a){return function(){var e=this,t=arguments;return new Promise(function(r,n){var i=a.apply(e,t);function l(o){Ke(i,r,n,l,s,"next",o)}function s(o){Ke(i,r,n,l,s,"throw",o)}l(void 0)})}}function oe(a,e,t){return e=yr(e),e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function yr(a){var e=Sr(a,"string");return typeof e=="symbol"?e:String(e)}function Sr(a,e){if(typeof a!="object"||a===null)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var r=t.call(a,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}var G=Z.module("TableUtils");class h{static copyTableAndApplyFilters(e){var t=arguments;return U(function*(){if(e==null)return null;for(var r=yield e.copy(),n=t.length,i=new Array(n>1?n-1:0),l=1;l<n;l++)i[l-1]=t[l];return r.applyFilter(Ne(...i.map(s=>s(r)))),r})()}static getSortIndex(e,t){for(var r=0;r<e.length;r+=1){var n,i=e[r];if(((n=i.column)===null||n===void 0?void 0:n.name)===t)return r}return null}static getSortForColumn(e,t){var r=h.getSortIndex(e,t);return r!=null?e[r]:null}static getFilterText(e){return e?e.toString():null}static getFilterTypes(e){return h.isBooleanType(e)?[f.isTrue,f.isFalse,f.isNull]:h.isCharType(e)||h.isNumberType(e)||h.isDateType(e)?[f.eq,f.notEq,f.greaterThan,f.greaterThanOrEqualTo,f.lessThan,f.lessThanOrEqualTo]:h.isTextType(e)?[f.eq,f.eqIgnoreCase,f.notEq,f.notEqIgnoreCase,f.contains,f.notContains,f.startsWith,f.endsWith]:[]}static getNextSort(e,t,r){if(r<0||r>=e.length)return null;var n=h.getSortForColumn(t,e[r].name);return n===null?e[r].sort().asc():n.direction===h.sortDirection.ascending?n.desc():null}static makeColumnSort(e,t,r,n){if(t<0||t>=e.length||r===h.sortDirection.none)return null;var i=e[t].sort();switch(r){case h.sortDirection.ascending:i=i.asc();break;case h.sortDirection.descending:i=i.desc();break}return n&&(i=i.abs()),i}static toggleSortForColumn(e,t,r){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(r<0||r>=t.length)return[];var i=h.getNextSort(t,e,r);return h.setSortForColumn(e,t[r].name,i,n)}static sortColumn(e,t,r,n,i,l){if(r<0||r>=t.length)return[];var s=h.makeColumnSort(t,r,n,i);return h.setSortForColumn(e,t[r].name,s,l)}static setSortForColumn(e,t,r){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,i=h.getSortIndex(e,t),l=[];return n&&(l=l.concat(e.filter(s=>{var{direction:o}=s;return o!==h.sortDirection.reverse})),i!==null&&l.splice(i,1)),r!==null&&l.push(r),l}static getNormalizedType(e){switch(e){case"boolean":case"java.lang.Boolean":case h.dataType.BOOLEAN:return h.dataType.BOOLEAN;case"char":case"java.lang.Character":case h.dataType.CHAR:return h.dataType.CHAR;case"java.lang.String":case h.dataType.STRING:return h.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 h.dataType.DATETIME:return h.dataType.DATETIME;case"double":case"java.lang.Double":case"float":case"java.lang.Float":case"java.math.BigDecimal":case h.dataType.DECIMAL:return h.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 h.dataType.INT:return h.dataType.INT;default:return h.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 h.isIntegerType(e)||h.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 h.getNormalizedType(e)===h.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 Oe.makeCancelable(e,t=>{t.close()})}static makeCancelableTableEventPromise(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,i,l,s=!0,o=new Promise((u,c)=>{l=setTimeout(()=>{i(),s=!1,c(new nt('Event "'.concat(t,'" timed out.')))},r),i=e.addEventListener(t,d=>{if(n!=null&&!n(d)){G.debug2("Event triggered, but matcher returned false.");return}G.debug2("Event triggered, resolving."),i(),clearTimeout(l),s=!1,u(d)})});return o.cancel=()=>{if(s){G.debug2("Pending promise cleanup."),i(),clearTimeout(l),s=!1;return}G.debug2("Ignoring non-pending promise cancel.")},o}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=h.removeCommas(t);if(h.NUMBER_REGEX.test(r))return parseFloat(r);throw new Error("Invalid number '".concat(e,"'"))}static getFilterOperatorString(e){switch(e){case f.eq:return"=";case f.notEq:return"!=";case f.greaterThan:return">";case f.greaterThanOrEqualTo:return">=";case f.lessThan:return"<";case f.lessThanOrEqualTo:return"<=";case f.contains:return"~";case f.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,n)=>{var i=r.name.toUpperCase(),l=n.name.toUpperCase();return xt.sort(i,l,t)})}constructor(e){oe(this,"dh",void 0),this.dh=e,Pt(this)}createDistinctSortedColumnTable(e,t,r){var n=arguments,i=this;return U(function*(){if(e==null)return null;for(var l=e,s=n.length,o=new Array(s>3?s-3:0),u=3;u<s;u++)o[u-3]=n[u];o.length>0&&(l=yield e.copy(),yield l.applyFilter(Ne(...o.map(p=>p(l)))));var c=l.findColumn(t),d=yield l.selectDistinct([c]);l!==e&&l.close();var m=d.findColumn(t).sort()[r]();return i.applySort(d,[m])})()}doesColumnValueExist(e,t,r,n){var i=this;return U(function*(){if(e==null)return null;var l=cr(i,t,r,n?"eq":"eqIgnoreCase"),s=yield e.copy();yield i.applyFilter(s,Ne(l(s)));var o=vr(s);return s.close(),o>0})()}makeQuickFilter(e,t,r){for(var n=t.split("||"),i=null,l=0;l<n.length;l+=1){for(var s=n[l],o=s.split("&&"),u=null,c=0;c<o.length;c+=1){var d=o[c].trim();if(d.length>0){var m=this.makeQuickFilterFromComponent(e,d,r);if(m)u?u=u.and(m):u=m;else throw new Error("Unable to parse quick filter from text ".concat(t))}}i&&u?i=i.or(u):i=u}return i}makeQuickFilterFromComponent(e,t,r){var{type:n}=e;return h.isNumberType(n)?this.makeQuickNumberFilter(e,t):h.isBooleanType(n)?this.makeQuickBooleanFilter(e,t):r!=null&&h.isDateType(n)?this.makeQuickDateFilter(e,t,r):h.isCharType(n)?this.makeQuickCharFilter(e,t):this.makeQuickTextFilter(e,t)}makeQuickNumberFilter(e,t){var r=e.filter(),{dh:n}=this,i=null,l=/\s*(>=|<=|=>|=<|>|<|!=|=|!)?(\s*-\s*)?(\s*\d*(?:,\d{3})*(?:\.\d*)?\s*)?(null|nan|infinity|inf|\u221E)?(.*)/i,s=l.exec(t),o=null,u=null,c=null,d=null,m=null;if(s!==null&&s.length>3&&([,o,u,c,d,m]=s),m!=null&&m.trim().length>0)return null;if(o==null&&(o="="),d!=null){if(!(o==="="||o==="!"||o==="!="))return null;switch(d=d.trim().toLowerCase(),d){case"null":i=r.isNull();break;case"nan":i=n.FilterCondition.invoke("isNaN",r);break;case"infinity":case"inf":case"∞":u!=null?i=n.FilterCondition.invoke("isInf",r).and(r.lessThan(n.FilterValue.ofNumber(0))):i=n.FilterCondition.invoke("isInf",r).and(r.greaterThan(n.FilterValue.ofNumber(0)));break}return i!==null&&(o==="!"||o==="!=")&&(i=i.not()),i}if(c==null)return null;if(c=h.removeCommas(c),h.isLongType(e.type))try{c=n.FilterValue.ofNumber(n.LongWrapper.ofString("".concat(u!=null?"-":"").concat(c)))}catch(p){return G.warn("Unable to create long filter",p),null}else{if(c=parseFloat(c),c==null||Number.isNaN(c))return null;c=n.FilterValue.ofNumber(u!=null?0-c:c)}return i=e.filter(),h.makeRangeFilterWithOperation(i,o,c)}static escapeQuickTextFilter(e){var t,r;if(e==null)return null;var n=/^(!~|!=|~|=|!)?(.*)/,i=/^\\*null$/,l=n.exec(e),s=null,o=null;if(l!==null&&l.length>2&&([,s,o]=l),s!=null){var u;return"\\".concat(s).concat((u=o)!==null&&u!==void 0?u:"")}return o!=null&&i.test(o.toLowerCase())||o!=null&&o.startsWith("*")?"\\".concat(o):o!=null&&o.endsWith("*")&&!o.endsWith("\\*")?(o=o.substring(0,o.length-1),"".concat(o,"\\*")):"".concat((t=s)!==null&&t!==void 0?t:"").concat((r=o)!==null&&r!==void 0?r:"")}static unescapeQuickTextFilter(e){var t,r,n=/^(\\!~|\\!=|\\~|\\=|\\!)?(.*)/,i=/^\\*null$/,l=n.exec(e),s=null,o=null;return l!==null&&l.length>2&&([,s,o]=l),s!=null&&(s=s.replace("\\","")),o!=null&&i.test(o.toLowerCase())&&(o=o.replace("\\","")),s==null&&o!=null&&o.startsWith("\\*")&&(o=o.substring(1)),s==null&&o!=null&&o.endsWith("\\*")?(o=o.substring(0,o.length-2),"".concat(o,"*")):"".concat((t=s)!==null&&t!==void 0?t:"").concat((r=o)!==null&&r!==void 0?r:"")}makeQuickTextFilter(e,t){var{dh:r}=this,n="".concat(t).trim(),i=/^(!~|!=|~|=|!)?(.*)/,l=i.exec(n),s=null,o=null;if(l!==null&&l.length>2&&([,s,o]=l,o!=null&&(o=o.trim())),o==null||o.length===0&&!(s==="="||s==="!="))return null;s==null&&(s="=");var u=e.filter();if(o.toLowerCase()==="null")switch(s){case"=":return u.isNull();case"!=":case"!":return u.isNull().not()}var c=null,d=null;switch(o.startsWith("*")?(c="*",o=o.substring(1)):o.endsWith("*")&&!o.endsWith("\\*")&&(d="*",o=o.substring(0,o.length-1)),o=h.unescapeQuickTextFilter(o),s){case"~":return u.isNull().not().and(u.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(o,"\\E.*"))));case"!~":return u.isNull().or(u.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(o,"\\E.*"))).not());case"!=":return c==="*"?u.isNull().or(u.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(o,"\\E$"))).not()):d==="*"?u.isNull().or(u.invoke("matches",r.FilterValue.ofString("(?s)(?i)^\\Q".concat(o,"\\E.*"))).not()):u.notEqIgnoreCase(r.FilterValue.ofString(o.toLowerCase()));case"=":return c==="*"?u.isNull().not().and(u.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(o,"\\E$")))):d==="*"?u.isNull().not().and(u.invoke("matches",r.FilterValue.ofString("(?s)(?i)^\\Q".concat(o,"\\E.*")))):u.eqIgnoreCase(r.FilterValue.ofString(o.toLowerCase()))}return null}makeQuickBooleanFilter(e,t){var r=/^(!=|=|!)?(.*)/,n=r.exec("".concat(t).trim());if(n===null)return null;var[,i,l]=n,s=i==="!"||i==="!=",o=l.trim().toLowerCase(),u=e.filter();try{var c=h.makeBooleanValue(o);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 n=t.trim(),i=/\s*(>=|<=|=>|=<|>|<|!=|!|=)?(.*)/,l=i.exec(n);if(l==null||l.length<=2)throw new Error("Unable to parse date filter: ".concat(t));var s=null,o=null;[,s,o]=l;var u=f.eq;switch(s){case"<":u=f.lessThan;break;case"<=":case"=<":u=f.lessThanOrEqualTo;break;case">":u=f.greaterThan;break;case">=":case"=>":u=f.greaterThanOrEqualTo;break;case"!=":case"!":u=f.notEq;break;case"=":case"==":default:u=f.eq;break}return this.makeQuickDateFilterWithOperation(e,o,u,r)}makeQuickDateFilterWithOperation(e,t,r,n){var{dh:i}=this,[l,s]=O.parseDateRange(i,t,n),o=l!=null?i.FilterValue.ofNumber(l):null,u=s!=null?i.FilterValue.ofNumber(s):null,c=e.filter();if(o==null)return r===f.notEq?c.isNull().not():c.isNull();switch(r){case f.eq:{if(u!=null){var d=c.greaterThanOrEqualTo(o),m=c.lessThan(u);return d.and(m)}return c.eq(o)}case f.lessThan:return c.lessThan(o);case f.lessThanOrEqualTo:return u!=null?c.lessThan(u):c.lessThanOrEqualTo(o);case f.greaterThan:return u!=null?c.greaterThanOrEqualTo(u):c.greaterThan(o);case f.greaterThanOrEqualTo:return c.greaterThanOrEqualTo(o);case f.notEq:{if(u!=null){var p=c.lessThan(o),v=c.greaterThanOrEqualTo(u);return p.or(v)}return c.notEq(o)}default:throw new Error("Invalid operator: ".concat(r))}}makeQuickCharFilter(e,t){var{dh:r}=this,n="".concat(t).trim(),i=/^(>=|<=|=>|=<|>|<|!=|=|!)?(null|"."|'.'|.)?(.*)/,l=i.exec(n),s=null,o=null,u=null;if(l!==null&&l.length>3&&([,s,o,u]=l),u!=null&&u.trim().length>0||o==null||o.length===0)return null;s==null&&(s="=");var c=e.filter();if(o.toLowerCase()==="null")switch(s){case"=":return c.isNull();case"!=":case"!":return c.isNull().not();default:return null}var d=r.FilterValue.ofString(h.isRangeOperation(s)?h.quoteValue(o):o);return h.makeRangeFilterWithOperation(c,s,d)}makeAdvancedFilter(e,t,r){for(var{filterItems:n,filterOperators:i,invertSelection:l,selectedValues:s}=t,o=null,u=0;u<n.length;u+=1){var c=n[u],{selectedType:d,value:m}=c;if(d!=null&&d.length>0&&m!=null&&m.length>0)try{var p=this.makeAdvancedValueFilter(e,d,m,r);if(p!=null){if(u===0)o=p;else if(o!==null&&u-1<i.length){var v=i[u-1];if(v===Se.and)o=o.and(p);else if(v===Se.or)o=o.or(p);else{G.error("Unexpected filter operator",v,p),o=null;break}}}else G.debug2("Empty filter ignored for",d,m)}catch(S){G.error("Unable to create filter",S),o=null;break}}var y=this.makeSelectValueFilter(e,s,l);return y!=null&&(o!=null?o=o.and(y):o=y),o}makeAdvancedValueFilter(e,t,r,n){var{dh:i}=this;if(h.isDateType(e.type))return this.makeQuickDateFilterWithOperation(e,r,t,n);if(h.isNumberType(e.type)||h.isCharType(e.type))return this.makeQuickFilter(e,"".concat(h.getFilterOperatorString(t)).concat(r));var l=this.makeFilterValue(e.type,r),s=e.filter();switch(t){case f.eq:return s.eq(l);case f.eqIgnoreCase:return s.eqIgnoreCase(l);case f.notEq:return s.notEq(l);case f.notEqIgnoreCase:return s.notEqIgnoreCase(l);case f.greaterThan:return s.greaterThan(l);case f.greaterThanOrEqualTo:return s.greaterThanOrEqualTo(l);case f.lessThan:return s.lessThan(l);case f.lessThanOrEqualTo:return s.lessThanOrEqualTo(l);case f.isTrue:return s.isTrue();case f.isFalse:return s.isFalse();case f.isNull:return s.isNull();case f.contains:return s.isNull().not().and(s.invoke("matches",i.FilterValue.ofString("(?s)(?i).*\\Q".concat(r,"\\E.*"))));case f.notContains:return s.isNull().or(s.invoke("matches",i.FilterValue.ofString("(?s)(?i).*\\Q".concat(r,"\\E.*"))).not());case f.startsWith:return s.isNull().not().and(s.invoke("matches",i.FilterValue.ofString("(?s)(?i)^\\Q".concat(r,"\\E.*"))));case f.endsWith:return s.isNull().not().and(s.invoke("matches",i.FilterValue.ofString("(?s)(?i).*\\Q".concat(r,"\\E$"))));case f.in:case f.inIgnoreCase:case f.notIn:case f.notInIgnoreCase:case f.invoke:default:throw new Error("Unexpected filter operation: ".concat(t))}}applyNeverFilter(e,t){var r=arguments,n=this;return U(function*(){var i=r.length>2&&r[2]!==void 0?r[2]:h.APPLY_TABLE_CHANGE_TIMEOUT_MS;if(e==null)return null;var l=e.findColumn(t),s=[n.makeNeverFilter(l)];return yield n.applyFilter(e,s,i),e})()}applyCustomColumns(e,t){var r=arguments,n=this;return U(function*(){var i=r.length>2&&r[2]!==void 0?r[2]:h.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:l}=n;return h.executeAndWaitForEvent(s=>s==null?void 0:s.applyCustomColumns(t),e,l.Table.EVENT_CUSTOMCOLUMNSCHANGED,i)})()}applyFilter(e,t){var r=arguments,n=this;return U(function*(){var i=r.length>2&&r[2]!==void 0?r[2]:h.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:l}=n;return h.executeAndWaitForEvent(s=>s==null?void 0:s.applyFilter(t),e,l.Table.EVENT_FILTERCHANGED,i)})()}applySort(e,t){var r=arguments,n=this;return U(function*(){var i=r.length>2&&r[2]!==void 0?r[2]:h.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:l}=n;return h.executeAndWaitForEvent(s=>s==null?void 0:s.applySort(t),e,l.Table.EVENT_SORTCHANGED,i)})()}makeNeverFilter(e){var{dh:t}=this,r=null;h.isTextType(e.type)?r=t.FilterValue.ofString("a"):h.isBooleanType(e.type)?r=t.FilterValue.ofBoolean(!0):h.isDateType(e.type)?r=t.FilterValue.ofNumber(t.DateWrapper.ofJsDate(new Date)):r=t.FilterValue.ofNumber(0);var n=e.filter().eq(r),i=e.filter().notEq(r);return n.and(i)}makeFilterValue(e,t){var{dh:r}=this,n=h.getBaseType(e);return h.isTextType(n)?r.FilterValue.ofString(t):h.isLongType(n)?r.FilterValue.ofNumber(r.LongWrapper.ofString(h.removeCommas(t))):r.FilterValue.ofNumber(h.removeCommas(t))}makeFilterRawValue(e,t){var{dh:r}=this;return h.isTextType(e)?r.FilterValue.ofString(t):h.isBooleanType(e)?r.FilterValue.ofBoolean(t):r.FilterValue.ofNumber(t)}makeValue(e,t,r){var{dh:n}=this;if(t==="null")return null;if(h.isTextType(e))return t;if(h.isLongType(e))return n.LongWrapper.ofString(h.removeCommas(t));if(h.isBooleanType(e))return h.makeBooleanValue(t,!0);if(h.isDateType(e)){var[i]=O.parseDateRange(n,t,r);return i}return h.isNumberType(e)?h.makeNumberValue(t):(G.error("Unexpected column type",e),null)}makeSelectValueFilter(e,t,r){var{dh:n}=this;if(t.length===0)return r?null:this.makeNeverFilter(e);for(var i=[],l=!1,s=0;s<t.length;s+=1){var o=t[s];o==null?l=!0:h.isTextType(e.type)?i.push(n.FilterValue.ofString(typeof o=="number"?String.fromCharCode(o):o)):h.isBooleanType(e.type)?i.push(n.FilterValue.ofBoolean(!!o)):i.push(n.FilterValue.ofNumber(o))}return l?i.length>0?r?e.filter().isNull().not().and(e.filter().notIn(i)):e.filter().isNull().or(e.filter().in(i)):r?e.filter().isNull().not():e.filter().isNull():r?e.filter().notIn(i):e.filter().in(i)}}oe(h,"dataType",{BOOLEAN:"boolean",CHAR:"char",DATETIME:"datetime",DECIMAL:"decimal",INT:"int",STRING:"string",UNKNOWN:"unknown"});oe(h,"sortDirection",{ascending:"ASC",descending:"DESC",reverse:"REVERSE",none:null});oe(h,"APPLY_TABLE_CHANGE_TIMEOUT_MS",3e4);oe(h,"REVERSE_TYPE",Object.freeze({NONE:"none",PRE_SORT:"pre-sort",POST_SORT:"post-sort"}));oe(h,"NUMBER_REGEX",/^-?\d+(\.\d+)?$/);oe(h,"executeAndWaitForEvent",function(){var a=U(function*(e,t,r){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:h.APPLY_TABLE_CHANGE_TIMEOUT_MS;if(t==null)return null;var i=h.makeCancelableTableEventPromise(t,r,n);return e(t),yield i,t});return function(e,t,r){return a.apply(this,arguments)}}());function De(a,e,t){return e=Er(e),e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function Er(a){var e=Tr(a,"string");return typeof e=="symbol"?e:String(e)}function Tr(a,e){if(typeof a!="object"||a===null)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var r=t.call(a,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}class Le{static makeColumnFormatMap(e){return e==null?new Map:e.reduce((t,r)=>{var n=h.getNormalizedType(r.columnType);if(n===null)return t;t.has(n)||t.set(n,new Map);var i=t.get(n);return i==null||i.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,n=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0,l=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 nr,this.typeFormatterMap=new Map([[h.dataType.BOOLEAN,new Xt],[h.dataType.CHAR,new Zt],[h.dataType.DATETIME,new q(e,r)],[h.dataType.DECIMAL,new w(e,n)],[h.dataType.INT,new K(e,i)],[h.dataType.STRING,new or]]),this.columnFormatMap=Le.makeColumnFormatMap(t),this.truncateNumbersWithPound=l}getColumnFormatMapForType(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=h.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,n=this.getColumnFormatMapForType(e);return(r=n==null?void 0:n.get(t))!==null&&r!==void 0?r:null}getColumnTypeFormatter(e){var t=h.getNormalizedType(e),r=this.defaultColumnFormatter;if(t){var n;r=(n=this.typeFormatterMap.get(t))!==null&&n!==void 0?n:r}return r}getFormattedString(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",n=arguments.length>3?arguments[3]:void 0;if(e==null)return"";var i=this.getColumnTypeFormatter(t),l=n||this.getColumnFormat(t,r);return i.format(e,l??void 0)}get timeZone(){var e,t=this.typeFormatterMap.get(h.dataType.DATETIME);return t==null||(e=t.dhTimeZone)===null||e===void 0?void 0:e.id}}function br(a){if(a&&a.formatter){var{formatter:e}=a;return e}}function Fr(a){return{timeZone:a==null?void 0:a.timeZone,defaultDateTimeFormatString:a==null?void 0:a.defaultDateTimeFormat,showTimeZone:a==null?void 0:a.showTimeZone,showTSeparator:a==null?void 0:a.showTSeparator}}function Dr(a,e,t){var r=a.getColumnFormat(t,e);return r!=null&&(r.type===k.TYPE_CONTEXT_PRESET||r.type===k.TYPE_CONTEXT_CUSTOM)}const we={getColumnFormats:br,getDateTimeFormatterOptions:Fr,isCustomColumnFormatDefined:Dr};rt.register([gt,vt,pt,yt,St,Et]);function $(a,e,t){return e=Mr(e),e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function Mr(a){var e=Pr(a,"string");return typeof e=="symbol"?e:String(e)}function Pr(a,e){if(typeof a!="object"||a===null)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var r=t.call(a,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}class I{constructor(e){$(this,"dh",void 0),$(this,"listeners",void 0),$(this,"formatter",void 0),$(this,"rect",void 0),$(this,"isDownsamplingDisabled",void 0),$(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(I.EVENT_UPDATED,{detail:e}))}fireDisconnect(){this.fireEvent(new CustomEvent(I.EVENT_DISCONNECT))}fireReconnect(){this.fireEvent(new CustomEvent(I.EVENT_RECONNECT))}fireDownsampleStart(e){this.fireEvent(new CustomEvent(I.EVENT_DOWNSAMPLESTARTED,{detail:e}))}fireDownsampleFinish(e){this.fireEvent(new CustomEvent(I.EVENT_DOWNSAMPLEFINISHED,{detail:e}))}fireDownsampleFail(e){this.fireEvent(new CustomEvent(I.EVENT_DOWNSAMPLEFAILED,{detail:e}))}fireDownsampleNeeded(e){this.fireEvent(new CustomEvent(I.EVENT_DOWNSAMPLENEEDED,{detail:e}))}fireLoadFinished(){this.fireEvent(new CustomEvent(I.EVENT_LOADFINISHED))}}$(I,"EVENT_UPDATED","ChartModel.EVENT_UPDATED");$(I,"EVENT_DISCONNECT","ChartModel.EVENT_DISCONNECT");$(I,"EVENT_RECONNECT","ChartModel.EVENT_RECONNECT");$(I,"EVENT_DOWNSAMPLESTARTED","ChartModel.EVENT_DOWNSAMPLESTARTED");$(I,"EVENT_DOWNSAMPLEFINISHED","ChartModel.EVENT_DOWNSAMPLEFINISHED");$(I,"EVENT_DOWNSAMPLEFAILED","ChartModel.EVENT_DOWNSAMPLEFAILED");$(I,"EVENT_DOWNSAMPLENEEDED","ChartModel.EVENT_DOWNSAMPLENEEDED");$(I,"EVENT_LOADFINISHED","ChartModel.EVENT_LOADFINISHED");const X=I,Nr="#76d9e4 #9edc6f #fcd65b #aa9af4 #f37e3f #f95d84 #f0f0ee",wr="#403e41",Ar="#5b5a5c",Or="#c0bfbf",Ir="#4878ea",Cr="rgba(91, 90, 92, 0.7)",R={"paper-bgcolor":"#2d2a2e","plot-bgcolor":"#322f33","title-color":"#f0f0ee",colorway:Nr,gridcolor:wr,linecolor:Ar,zerolinecolor:Or,activecolor:Ir,rangebgcolor:Cr,"area-color":"#76d9e4","trend-color":"#d5f0c1","line-color":"#9edc6f","error-band-line-color":"white","error-band-fill-color":"rgba(213, 240, 193, 0.1)","ohlc-increasing":"#9edc6f","ohlc-decreasing":"#f95d84"},j=Object.freeze({paper_bgcolor:R["paper-bgcolor"],plot_bgcolor:R["plot-bgcolor"],title_color:R["title-color"],colorway:R.colorway,gridcolor:R.gridcolor,linecolor:R.linecolor,zerolinecolor:R.zerolinecolor,activecolor:R.activecolor,rangebgcolor:R.rangebgcolor,area_color:R["area-color"],trend_color:R["trend-color"],line_color:R["line-color"],error_band_line_color:R["error-band-line-color"],error_band_fill_color:R["error-band-fill-color"],ohlc_increasing:R["ohlc-increasing"],ohlc_decreasing:R["ohlc-decreasing"]});function ze(a,e){var t=Object.keys(a);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(a,n).enumerable})),t.push.apply(t,r)}return t}function ue(a){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ze(Object(t),!0).forEach(function(r){L(a,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(t)):ze(Object(t)).forEach(function(r){Object.defineProperty(a,r,Object.getOwnPropertyDescriptor(t,r))})}return a}function L(a,e,t){return e=xr(e),e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function xr(a){var e=Lr(a,"string");return typeof e=="symbol"?e:String(e)}function Lr(a,e){if(typeof a!="object"||a===null)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var r=t.call(a,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}var ge=Z.module("ChartUtils"),Ge="io.deephaven.time.DateTime",Rr=36e5,kr=1e6;function _r(a){return a.asDate!==void 0}function Vr(a){return a.asNumber!==void 0}function Xe(a){return a.dhTimeZone!==void 0}function Hr(a){return a!=null&&a.range!=null&&(a.autorange===!1||a.autorange===void 0)}class g{static getPlotlyErrorBars(e,t,r){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:j,i=r.map((s,o)=>s-e[o]),l=t.map((s,o)=>e[o]-s);return{type:"data",symmetric:!1,array:i,arrayminus:l,color:n.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 n=r.split(";"),i=n[0].match(/^([^#,0.]*)([#,]*)([0,]*)(\.?)(0*)(#*)(E?0*)(%?)(.*)/);fe(i);var[,l,s,o,,u,c,d,m,p]=i,v=o.replace(",","").length,y=s.indexOf(",")>=0||o.indexOf(",")>=0,S=y?",":"",E=d!=null&&d!==""?"e":"f",b=m!==""?m:E,T=u.length+c.length,F="",A="0".concat(v).concat(S,".").concat(T).concat(F).concat(b),N=g.convertNumberPrefix(l),C=g.convertNumberPrefix(p);return{tickformat:A,tickprefix:N,ticksuffix:C,automargin:!0}}static addTickSpacing(e,t,r){var{gapBetweenMajorTicks:n}=t;if(n>0){var i=e||{},l=n;return r&&(l=n/kr),t.log&&(l=Math.log(l)),i.tickmode="linear",i.dtick=l,i}return e}static getSourceForAxis(e,t){for(var r=0;r<e.series.length;r+=1)for(var n=e.series[r],i=0;i<n.sources.length;i+=1){var l=n.sources[i];if(l.axis===t)return l}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,n){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:g.ORIENTATION.VERTICAL;return{type:e,mode:t,name:r,orientation:i,showlegend:n??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,n=0;n<r.length;n+=1)for(var i=r[n],l=0;l<i.series.length;l+=1)if(t===i.series[l])return i;return null}static getLayoutRanges(e){for(var t={},r=Object.keys(e).filter(s=>s.indexOf("axis")>=0),n=0;n<r.length;n+=1){var i=r[n],l=e[i];Hr(l)&&(t[i]=[...l.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,n)=>{var i,l=n[t],s=(i=r.get(l))!==null&&i!==void 0?i:[];return s.push(n),r.set(l,s),r},new Map)}static getColorwayFromTheme(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:j,t=[];return e.colorway&&(Array.isArray(e.colorway)?t=e.colorway:typeof e.colorway=="string"?t=e.colorway.split(" "):ge.warn("Unable to handle colorway property: ".concat(e.colorway))),t}static titleFromSettings(e){var{series:t,xAxis:r,title:n="".concat((t??[]).join(", ")," by ").concat(r)}=e;return n}constructor(e){L(this,"dh",void 0),L(this,"daysOfWeek",void 0),this.dh=e,this.daysOfWeek=Object.freeze(e.calendar.DayOfWeek.values())}getAxisFormats(e,t){for(var r=this,n=new Map,i={tickformat:null,ticksuffix:null},l=g.getAllAxes(e),s=g.groupArray(l,"type"),{charts:o}=e,u=0;u<o.length;u+=1)for(var c=o[u],d=0;d<c.series.length;d+=1)for(var m=c.series[d],{sources:p}=m,v=p.filter(b=>b.axis),y=function(){var T=v[S],{axis:F}=T,{type:A}=F,N=s.get(A);fe(N);var C=N.indexOf(F),x=r.getAxisPropertyName(A);if(x!=null){var _=g.getAxisLayoutProperty(x,C);if(n.has(_))ge.debug("".concat(_," already added."));else{ge.debug("Adding ".concat(_," to axisFormats."));var ne=r.getPlotlyAxisFormat(T,t);if(ne===null)n.set(_,i);else{n.set(_,ne);var{businessCalendar:Q}=F;if(Q!=null){var B=[],{businessPeriods:le,businessDays:ae,holidays:Te,timeZone:ce}=Q,de=t==null?void 0:t.getColumnTypeFormatter(Ge),be;Xe(de)&&(be=de.dhTimeZone);var ke=be?(ce.standardOffset-be.standardOffset)/60:0;Te.length>0&&B.push(...r.createRangeBreakValuesFromHolidays(Te,ce,be)),le.forEach(Fe=>B.push({pattern:"hour",bounds:[g.periodToDecimal(Fe.close)+ke,g.periodToDecimal(Fe.open)+ke]})),ae.length<r.daysOfWeek.length&&r.createBoundsFromDays(ae).forEach(Fe=>B.push({pattern:"day of week",bounds:Fe})),ne.rangebreaks=B}if(n.size===c.axes.length)return{v:n}}}}},S=0;S<v.length;S+=1){var E=y();if(typeof E=="object")return E.v}return n}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:n}=this,i=new Set;switch(e){case n.plot.SeriesPlotStyle.SCATTER:(t??!1)&&i.add(g.MODE_LINES),(r??!0)&&i.add(g.MODE_MARKERS);break;case n.plot.SeriesPlotStyle.LINE:(t??!0)&&i.add(g.MODE_LINES),(r??!1)&&i.add(g.MODE_MARKERS);break}return i.size>0?[...i].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:n}=this,{sources:i}=e;return i.length===2&&((t=i[0])===null||t===void 0||(r=t.axis)===null||r===void 0?void 0:r.type)===n.plot.AxisType.Y?g.ORIENTATION.HORIZONTAL:g.ORIENTATION.VERTICAL}makeSeriesDataFromSeries(e,t,r){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:j,{name:l,isLinesVisible:s,isShapesVisible:o,plotStyle:u,lineColor:c,shapeColor:d,sources:m,shape:p,shapeSize:v}=e,y=m.some(F=>{var A;return(A=F.axis)===null||A===void 0?void 0:A.businessCalendar}),S=this.getChartType(u,y),E=this.getPlotlyChartMode(u,s??void 0,o??void 0),b=this.getPlotlySeriesOrientation(e),T=g.makeSeriesData(S,E,l,n,b);return this.addSourcesToSeriesData(T,u,m,t),this.addStylingToSeriesData(T,u,i,c,d,p,v,r),T}addSourcesToSeriesData(e,t,r,n){for(var i=e,l=0;l<r.length;l+=1){var s=r[l],{axis:o,type:u}=s,c=this.getPlotlyProperty(t,u);tt(i,c,[]);var d=o!=null?this.getAxisPropertyName(o.type):null;if(d!=null){var m=n.get(o.type);if(m){var p=m.indexOf(o),v=p>0?"".concat(p+1):"";i["".concat(d,"axis")]="".concat(d).concat(v)}}}}addStylingToSeriesData(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:j,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:null,l=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null,s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:null,o=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}),n!=null&&(t===u.plot.SeriesPlotStyle.BAR?c.marker.color=n:c.line.color=n),i!=null&&(c.marker.color=i),l!=null&&l.length>0)try{c.marker.symbol=g.getMarkerSymbol(l)}catch(d){ge.warn("Unable to handle shape",l,":",d)}s!=null&&(c.marker.size=s*g.DEFAULT_MARKER_SIZE),o!=null&&t!==u.plot.SeriesPlotStyle.PIE&&(c.visible=o)}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){for(var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,l=arguments.length>5&&arguments[5]!==void 0?arguments[5]:j,s=e,o=g.getAllAxes(t),u=0;u<t.charts.length;u+=1){var c=t.charts[u],d=r==null?void 0:r(c),m=this.getChartBounds(t,c,n,i);this.updateLayoutAxes(s,c.axes,o,n,i,m,d,l)}this.removeStaleAxes(s,o)}getChartBounds(e,t,r,n){var i,{dh:l}=this,{cols:s,rows:o}=e,{column:u,colspan:c,row:d,rowspan:m}=t,p=u+c,v=d+m,y=1/s,S=1/o,E=g.AXIS_SIZE_PX/r,b=g.AXIS_SIZE_PX/n,T={bottom:(o-v)*S+(v<o?b/2:0),top:(o-d)*S-(d>0?b/2:0),left:u*y+(u>0?E/2:0),right:p*y-(p<s?E/2:0)},F=g.groupArray(t.axes,"position"),A=(i=F.get(l.plot.AxisPosition.RIGHT))!==null&&i!==void 0?i:[];return A.length>0&&(r>0?T.right-=(T.right-T.left)*Math.max(0,Math.min(g.LEGEND_WIDTH_PX/r,g.MAX_LEGEND_SIZE)):T.right-=(T.right-T.left)*g.DEFAULT_AXIS_SIZE),T}getPlotlyDateFormat(e,t,r){var{dh:n}=this,i=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",""),l,s=e==null?void 0:e.getColumnTypeFormatter(t);return s!=null&&Xe(s)&&s.dhTimeZone!=null&&s.showTimeZone&&(l=n.i18n.DateTimeFormat.format(" z",new Date,s.dhTimeZone)),{tickformat:i,ticksuffix:l,automargin:!0}}getPlotlyAxisFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,{dh:r}=this,{axis:n,columnType:i}=e,{formatPattern:l}=n,s=null;return h.isDateType(i)?(s=this.getPlotlyDateFormat(t,i,l),s=g.addTickSpacing(s,n,!0)):h.isNumberType(i)&&(s=g.getPlotlyNumberFormat(t,i,l),s=g.addTickSpacing(s,n,!1)),n.formatType===r.plot.AxisFormatType.CATEGORY&&(s?s.type="category":s={type:"category",tickformat:void 0,ticksuffix:void 0}),s}updateLayoutAxes(e,t,r){for(var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,l=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{left:0,top:0,right:1,bottom:1},s=arguments.length>6?arguments[6]:void 0,o=arguments.length>7&&arguments[7]!==void 0?arguments[7]:j,{dh:u}=this,c=n>0?Math.max(g.MIN_AXIS_SIZE,Math.min(g.AXIS_SIZE_PX/i,g.MAX_AXIS_SIZE)):g.DEFAULT_AXIS_SIZE,d=i>0?Math.max(g.MIN_AXIS_SIZE,Math.min(g.AXIS_SIZE_PX/n,g.MAX_AXIS_SIZE)):g.DEFAULT_AXIS_SIZE,m=e,p=g.groupArray(t,"position"),v=g.groupArray(t,"type"),y=[...v.keys()],S=g.groupArray(r,"type"),E=0;E<y.length;E+=1){var b=y[E],T=this.getAxisPropertyName(b);if(T!=null){var F=v.get(b),A=S.get(b),N=b===u.plot.AxisType.Y,C=N?i:n;fe(F),fe(A);for(var x=0;x<F.length;x+=1){var _=F[x],ne=A.indexOf(_),Q=g.getAxisLayoutProperty(T,ne);m[Q]==null&&(m[Q]=this.makeLayoutAxis(b,o));var B=m[Q];if(B!=null){this.updateLayoutAxis(B,_,x,p,c,d,l);var{range:le,autorange:ae}=B;if(s!=null&&le!==void 0&&(ae===void 0||ae===!1)){var Te=s(_),[ce,de]=Te(le);ge.debug("Setting downsample range",C,ce,de),_.range(C,ce,de)}else _.range(C)}}}}}removeStaleAxes(e,t){for(var r=e,n=g.groupArray(t,"type"),i=[...n.keys()],l=0;l<i.length;l+=1){var s=i[l],o=n.get(s);fe(o);var u=o.length,c=this.getAxisPropertyName(s);if(c!=null)for(var d=g.getAxisLayoutProperty(c,u);r[d]!=null;)delete r[d],u+=1,d=g.getAxisLayoutProperty(c,u)}}updateLayoutAxis(e,t,r,n,i,l,s){var o,{dh:u}=this,c=t.type===u.plot.AxisType.Y,d=c?l:i,m=e,p=(o=t.label)!==null&&o!==void 0?o:"";if(m.title!==void 0&&typeof m.title!="string"?m.title.text=p:m.title={text:p},t.log&&(m.type="log"),m.side=this.getAxisSide(t.position),r>0){var v,y;m.overlaying=(v=this.getAxisPropertyName(t.type))!==null&&v!==void 0?v:void 0;var S=(y=n.get(t.position))!==null&&y!==void 0?y:[],E=S.indexOf(t);E>0&&(m.anchor="free",t.position===u.plot.AxisPosition.RIGHT?m.position=s.right+(E-S.length+1)*d:t.position===u.plot.AxisPosition.TOP?m.position=s.top+(E-S.length+1)*d:t.position===u.plot.AxisPosition.BOTTOM?m.position=s.bottom+(S.length-E+1)*d:t.position===u.plot.AxisPosition.LEFT&&(m.position=s.left+(S.length-E+1)*d))}else if(t.type===u.plot.AxisType.X){var b=n.get(u.plot.AxisPosition.LEFT)||[],T=n.get(u.plot.AxisPosition.RIGHT)||[],F=Math.max(s.left,s.left+(b.length-1)*l),A=Math.min(s.right-(T.length-1)*l,s.right);m.domain=[F,A]}else if(t.type===u.plot.AxisType.Y){var N=n.get(u.plot.AxisPosition.BOTTOM)||[],C=n.get(u.plot.AxisPosition.TOP)||[],x=Math.max(s.bottom,s.bottom+(N.length-1)*i),_=Math.min(s.top-(C.length-1)*i,s.top);m.domain=[x,_]}}createBoundsFromDays(e){var t=e.map(l=>this.daysOfWeek.indexOf(l)),r=this.daysOfWeek.filter(l=>!e.includes(l)).map(l=>this.daysOfWeek.indexOf(l)),n=new Set;r.forEach(l=>{for(var s=l+1;s<l+this.daysOfWeek.length;s+=1){var o=s%this.daysOfWeek.length;if(t.includes(o)){n.add(o);break}}});var i=[];return n.forEach(l=>{for(var s=l-1;s>l-this.daysOfWeek.length;s-=1){var o=s<0?s+this.daysOfWeek.length:s;if(t.includes(o)){var u=(o+1)%7;i.push([u,l]);break}}}),i}createRangeBreakValuesFromHolidays(e,t,r){var n=[],i=[];return e.forEach(l=>{l.businessPeriods.length>0?i.push(...this.createPartialHoliday(l,t,r)):n.push(this.createFullHoliday(l,t,r))}),[{values:n},...i]}createFullHoliday(e,t,r){return this.adjustDateForTimeZone("".concat(e.date.toString()," 00:00:00.000000"),t,r)}createPartialHoliday(e,t,r){var n=e.date.toString(),i=["00:00"];e.businessPeriods.forEach(m=>{i.push(m.open),i.push(m.close)}),i.push("24:00");for(var l=[],s=0;s<i.length;s+=2){var o=i[s],u=i[s+1];if(o!==u){var c=[this.adjustDateForTimeZone("".concat(n," ").concat(o,":00.000000"),t,r)],d=Rr*(g.periodToDecimal(u)-g.periodToDecimal(o));l.push({values:c,dvalue:d})}}return l}adjustDateForTimeZone(e,t,r){return r&&r.standardOffset!==t.standardOffset?this.unwrapValue(this.wrapValue(e,Ge,t),r):e}makeFigureSettings(e,t){var{dh:r}=this,{series:n,xAxis:i,type:l}=e,s=g.titleFromSettings(e),o={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:[o,u],series:(n??[]).map(c=>({plotStyle:"".concat(l),name:c,dataSources:[{type:"".concat(r.plot.SourceType.X),columnName:i??"",axis:o,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(_r(e))return r.i18n.DateTimeFormat.format(g.DATE_FORMAT,e,t);if(Vr(e))return e.asNumber()}return e}wrapValue(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,{dh:n}=this;if(h.isDateType(t)&&typeof e=="string"){var i=e,l=g.DATE_FORMAT.substr(0,e.length),s=n.i18n.DateTimeFormat.parse(l,i);if(!r)return s;var o="".concat(l," Z"),u=n.i18n.DateTimeFormat.format("Z",s,r),c=n.i18n.DateTimeFormat.parse(o,"".concat(i," ").concat(u)),d=n.i18n.DateTimeFormat.format("Z",c,r);return n.i18n.DateTimeFormat.parse(o,"".concat(i," ").concat(d))}return e}makeLayoutAxis(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:j,{dh:r}=this,n={automargin:!0,gridcolor:t.gridcolor,linecolor:t.linecolor,rangeslider:{visible:!1},showline:!0,ticklen:5,tickcolor:t.paper_bgcolor,tickfont:{color:t.zerolinecolor},title:{font:{color:t.title_color}}};return e===r.plot.AxisType.X?Object.assign(n,{showgrid:!0}):e===r.plot.AxisType.Y&&Object.assign(n,{zerolinecolor:t.zerolinecolor,zerolinewidth:2}),n}makeDefaultLayout(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:j,{dh:t}=this,r=ue(ue({},e),{},{autosize:!0,colorway:g.getColorwayFromTheme(e),font:{family:"'Fira Sans', sans-serif",color:e.title_color},title:{font:{color:e.title_color},yanchor:"top",pad:ue({},g.DEFAULT_TITLE_PADDING),y:1},legend:{font:{color:e.title_color}},margin:ue({},g.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 ue(ue({},e),{},{type:e.type!=null?t.plot.SeriesPlotStyle[e.type]:void 0})}}L(g,"DEFAULT_AXIS_SIZE",.15);L(g,"MIN_AXIS_SIZE",.025);L(g,"MAX_AXIS_SIZE",.2);L(g,"AXIS_SIZE_PX",75);L(g,"LEGEND_WIDTH_PX",50);L(g,"MAX_LEGEND_SIZE",.25);L(g,"ORIENTATION",Object.freeze({HORIZONTAL:"h",VERTICAL:"v"}));L(g,"DATE_FORMAT","yyyy-MM-dd HH:mm:ss.SSSSSS");L(g,"DEFAULT_MARGIN",Object.freeze({l:60,r:50,t:30,b:60,pad:0}));L(g,"DEFAULT_TITLE_PADDING",Object.freeze({t:8}));L(g,"SUBTITLE_LINE_HEIGHT",25);L(g,"DEFAULT_MARKER_SIZE",6);L(g,"MODE_MARKERS","markers");L(g,"MODE_LINES","lines");const H=g;function Ye(a,e){var t=Object.keys(a);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(a,n).enumerable})),t.push.apply(t,r)}return t}function Ze(a){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ye(Object(t),!0).forEach(function(r){W(a,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(t)):Ye(Object(t)).forEach(function(r){Object.defineProperty(a,r,Object.getOwnPropertyDescriptor(t,r))})}return a}function W(a,e,t){return e=Wr(e),e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function Wr(a){var e=$r(a,"string");return typeof e=="symbol"?e:String(e)}function $r(a,e){if(typeof a!="object"||a===null)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var r=t.call(a,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}var J=Z.module("Chart");class se extends Ee.Component{static convertIcon(e){var[t,,,,r]=e.icon,n="".concat(r);return{width:t,path:n,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){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,"getCachedConfig",ot((t,r,n,i,l)=>{var s=[],o=!!t;if(o&&s.push({name:"Downsampling failed: ".concat(t),title:"Downsampling failed",click:()=>{},icon:se.convertIcon(ht),attr:"fill-warning"}),r||n||i||o){var u=se.downsampleButtonTitle(n,i),c=se.downsampleButtonAttr(n,i),d=n?mt:ft;s.push({name:u,title:"Downsampling status",icon:se.convertIcon(d),click:this.handleDownsampleClick,attr:c})}var m=l.some(S=>{var{type:E}=S;return E!=null&&!E.includes("3d")}),p=l.some(S=>{var{type:E}=S;return E!=null&&E.includes("3d")}),v=["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"],y=["orbitRotation","tableRotation","resetCameraDefault3d"];return{displaylogo:!1,displayModeBar:n||o?!0:"hover",modeBarButtons:[s,["toImage"],["zoom2d","pan2d"],[...m?v:[],...p?y:[]]]}})),this.handleAfterPlot=this.handleAfterPlot.bind(this),this.handleDownsampleClick=this.handleDownsampleClick.bind(this),this.handleModelEvent=this.handleModelEvent.bind(this),this.handlePlotUpdate=this.handlePlotUpdate.bind(this),this.handleRelayout=this.handleRelayout.bind(this),this.handleRestyle=this.handleRestyle.bind(this),this.PlotComponent=Tt(e.Plotly),this.plot=Y.createRef(),this.plotWrapper=Y.createRef(),this.columnFormats=[],this.dateTimeFormatterOptions={},this.decimalFormatOptions={},this.integerFormatOptions={},this.isSubscribed=!1,this.isLoadedFired=!1,this.currentSeries=0,this.state={data:null,downsamplingError:null,isDownsampleFinished:!1,isDownsampleInProgress:!1,isDownsamplingDisabled:!1,layout:{datarevision:0},revision:0}}componentDidMount(){this.updateDimensions(),this.updateModelDimensions(),this.initData(),this.initFormatter();var{isActive:e,model:t}=this.props;e&&this.subscribe(t)}componentDidUpdate(e){var{isActive:t,model:r,settings:n}=this.props;this.updateFormatterSettings(n),r!==e.model&&(this.unsubscribe(e.model),this.subscribe(r)),t!==e.isActive&&(t?this.subscribe(r):this.unsubscribe(r))}componentWillUnmount(){var{model:e}=this.props;this.unsubscribe(e)}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:Ze(Ze({},t),e.getLayout())})}subscribe(e){if(!this.isSubscribed){if(!this.rect||this.rect.width===0||this.rect.height===0){J.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)})}handleModelEvent(e){var{type:t,detail:r}=e;switch(J.debug2("Received data update",t,r),t){case X.EVENT_UPDATED:{this.currentSeries+=1,this.setState(d=>{var{layout:m,revision:p}=d;return typeof m.datarevision=="number"&&(m.datarevision+=1),{data:r,layout:m,revision:p+1}});var{onUpdate:n}=this.props;n({isLoading:!this.isLoadedFired});break}case X.EVENT_LOADFINISHED:{var{onUpdate:i}=this.props;this.isLoadedFired=!0,i({isLoading:!1});break}case X.EVENT_DISCONNECT:{var{onDisconnect:l}=this.props;l();break}case X.EVENT_RECONNECT:{var{onReconnect:s}=this.props;s();break}case X.EVENT_DOWNSAMPLESTARTED:{this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!0,downsamplingError:null});break}case X.EVENT_DOWNSAMPLEFINISHED:{this.setState({isDownsampleFinished:!0,isDownsampleInProgress:!1,downsamplingError:null});break}case X.EVENT_DOWNSAMPLENEEDED:case X.EVENT_DOWNSAMPLEFAILED:{var o,u=(o=r.message)!==null&&o!==void 0?o:r;this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!1,isDownsamplingDisabled:!1,downsamplingError:u});var{onError:c}=this.props;c(new Error(u));break}default:J.debug("Unknown event type",t,e)}}handlePlotUpdate(e){var{layout:t}=e,r=H.getLayoutRanges(t),n=!he(r,this.ranges);n&&(this.ranges=r,this.updateModelDimensions(!0))}handleRelayout(e){if(J.debug("handleRelayout",e),e.hiddenlabels!=null){var{onSettingsChanged:t}=this.props,r=[...e.hiddenlabels];t({hiddenSeries:r})}this.updateModelDimensions()}handleRestyle(e){var[t,r]=e;if(J.debug("handleRestyle",t,r),Object.keys(t).includes("visible")){var{data:n}=this.state,{onSettingsChanged:i}=this.props;if(n!=null){var l=n.reduce((s,o)=>{var{name:u,visible:c}=o;return u!=null&&c==="legendonly"?[...s,u]:s},[]);i({hiddenSeries:l})}}}updateModelDimensions(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.getPlotRect();if(!t){J.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:n,model:i}=this.props;i.setDimensions(t),n&&this.subscribe(i)}}initFormatter(){var{settings:e}=this.props;this.updateFormatterSettings(e)}updateFormatterSettings(e){var t=we.getColumnFormats(e),r=we.getDateTimeFormatterOptions(e),{decimalFormatOptions:n={},integerFormatOptions:i={}}=e;(!he(this.columnFormats,t)||!he(this.dateTimeFormatterOptions,r)||!he(this.decimalFormatOptions,n)||!he(this.integerFormatOptions,i))&&(this.columnFormats=we.getColumnFormats(e),this.dateTimeFormatterOptions=r,this.decimalFormatOptions=n,this.integerFormatOptions=i,this.updateFormatter())}updateFormatter(){var{model:e}=this.props,t=new Le(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=>{J.debug("Unable to resize, promise rejected",r)})}render(){var{PlotComponent:e}=this,{data:t,downsamplingError:r,isDownsampleFinished:n,isDownsampleInProgress:i,isDownsamplingDisabled:l,layout:s,revision:o}=this.state,u=this.getCachedConfig(r,n,i,l,t??[]),c=t!=null;return M.jsx("div",{className:"h-100 w-100 chart-wrapper",ref:this.plotWrapper,children:c&&M.jsx(e,{ref:this.plot,data:t,layout:s,revision:o,config:u,onAfterPlot:this.handleAfterPlot,onError:J.error,onRelayout:this.handleRelayout,onUpdate:this.handlePlotUpdate,onRestyle:this.handleRestyle,useResizeHandler:!0,style:{height:"100%",width:"100%"}})})}}W(se,"defaultProps",{isActive:!0,settings:{timeZone:"America/New_York",defaultDateTimeFormat:O.FULL_DATE_FORMAT,showTimeZone:!1,showTSeparator:!0,formatter:[]},Plotly:rt,onDisconnect:()=>{},onReconnect:()=>{},onUpdate:()=>{},onError:()=>{},onSettingsChanged:()=>{}});const dn=se;function Qe(a,e){var t=Object.keys(a);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(a,n).enumerable})),t.push.apply(t,r)}return t}function Je(a){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Qe(Object(t),!0).forEach(function(r){D(a,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(t)):Qe(Object(t)).forEach(function(r){Object.defineProperty(a,r,Object.getOwnPropertyDescriptor(t,r))})}return a}function D(a,e,t){return e=jr(e),e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function jr(a){var e=Br(a,"string");return typeof e=="symbol"?e:String(e)}function Br(a,e){if(typeof a!="object"||a===null)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var r=t.call(a,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}var V=Z.module("FigureChartModel");class Pe extends X{constructor(e,t){var r,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:j;super(e),r=this,D(this,"chartUtils",void 0),D(this,"dh",void 0),D(this,"figure",void 0),D(this,"settings",void 0),D(this,"theme",void 0),D(this,"data",void 0),D(this,"layout",void 0),D(this,"seriesDataMap",void 0),D(this,"pendingSeries",void 0),D(this,"oneClicks",void 0),D(this,"filterColumnMap",void 0),D(this,"lastFilter",void 0),D(this,"isConnected",void 0),D(this,"seriesToProcess",void 0),D(this,"addPendingSeries",lt(()=>{for(var s=H.getAllAxes(this.figure),{pendingSeries:o}=this,u=function(){var m,p=o[c],v=r.figure.charts.find(y=>y.series.includes(p));r.addSeries(p,s,(m=v==null?void 0:v.showLegend)!==null&&m!==void 0?m:null),p.subscribe()},c=0;c<o.length;c+=1)u();this.pendingSeries=[]},Pe.ADD_SERIES_DEBOUNCE)),D(this,"getTimeZone",me((s,o)=>{if(o!=null){var u=o.getColumnTypeFormatter(s);if(u!=null)return u.dhTimeZone}})),D(this,"getValueTranslator",me((s,o)=>{var u=this.getTimeZone(s,o);return c=>this.chartUtils.unwrapValue(c,u)})),D(this,"getValueParser",me((s,o)=>{var u=this.getTimeZone(s,o);return c=>this.chartUtils.wrapValue(c,s,u)})),D(this,"getRangeParser",me((s,o)=>u=>{var[c,d]=u,m=this.getValueParser(s,o);return c=m(c),d=m(d),[c,d]})),D(this,"getAxisRangeParser",me((s,o)=>u=>{var c=H.getSourceForAxis(s,u);return c!=null?this.getRangeParser(c.columnType,o):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 H(e),this.figure=t,this.settings=n,this.theme=i,this.data=[];var l={data:{},layout:this.chartUtils.makeDefaultLayout(i)};this.layout={grid:{rows:t.rows,columns:t.cols,pattern:"independent"},template:l},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=H.getAllAxes(this.figure),r=[],n=0;n<e.length;n+=1)for(var i=e[n],l=0;l<i.series.length;l+=1){var s=i.series[l];r.push(s.name),this.addSeries(s,t,i.showLegend)}for(var o=[...this.seriesDataMap.keys()],u=o.filter(m=>r.indexOf(m)<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:n}=this,i=H.groupArray(t,"type"),l=this.chartUtils.makeSeriesDataFromSeries(e,i,H.getSeriesVisibility(e.name,this.settings),r,this.theme);if(this.seriesDataMap.set(e.name,l),this.data=[...this.seriesDataMap.values()],e.plotStyle===n.plot.SeriesPlotStyle.STACKED_BAR?this.layout.barmode="stack":e.plotStyle===n.plot.SeriesPlotStyle.PIE&&(this.layout.hiddenlabels=H.getHiddenLabels(this.settings)),this.layout.showlegend=this.data.length>1||e.plotStyle===n.plot.SeriesPlotStyle.PIE?r??void 0:!1,e.oneClick!=null){for(var{oneClick:s}=e,{columns:o}=s,u=0;u<o.length;u+=1)this.filterColumnMap.set(o[u].name,o[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)}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 n=0;n<r.length;n+=1){var i=r[n];V.debug2("handleFigureUpdated updating series",i.name);for(var{sources:l}=i,s=0;s<l.length;s+=1){var o=l[s],{columnType:u,type:c}=o,d=this.getValueTranslator(u,this.formatter),m=t.getArray(i,c,d);this.setDataArrayForSeries(i,c,m)}this.seriesToProcess.delete(i.name),this.seriesToProcess.size===0&&this.fireLoadFinished(),this.cleanSeries(i)}var{data:p}=this;this.fireUpdate(p)}handleRequestFailed(e){V.error("Request failed",e)}resubscribe(){this.listeners.length>0&&(this.unsubscribeFigure(),this.subscribeFigure())}setFormatter(e){super.setFormatter(e),this.updateLayoutFormats(),this.resubscribe()}setDownsamplingDisabled(e){super.setDownsamplingDisabled(e),this.resubscribe()}handleFigureDisconnected(e){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 n=(t=(r=(e??"").match(/<br>/g))===null||r===void 0?void 0:r.length)!==null&&t!==void 0?t:0,i=H.DEFAULT_MARGIN.t+n*H.SUBTITLE_LINE_HEIGHT;this.layout.margin?this.layout.margin.t=i:this.layout.margin={t:i},typeof this.layout.title=="string"?this.layout.title=e:(this.layout.title=Je({},this.layout.title),this.layout.title.text=e,this.layout.title.pad=Je({},this.layout.title.pad),this.layout.title.pad.t=H.DEFAULT_TITLE_PADDING.t+n*H.SUBTITLE_LINE_HEIGHT*.5)}getPlotWidth(){var e,t,r,n;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=(n=this.layout.margin)===null||n===void 0?void 0:n.r)!==null&&r!==void 0?r:0),0)}getPlotHeight(){var e,t,r,n;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=(n=this.layout.margin)===null||n===void 0?void 0:n.b)!==null&&r!==void 0?r:0),0)}updateAxisPositions(){var e=this.getPlotWidth(),t=this.getPlotHeight();this.chartUtils.updateFigureAxes(this.layout,this.figure,r=>this.getAxisRangeParser(r,this.formatter),e,t,this.theme)}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 n=this.layout[r];n!=null?Object.assign(n,t):V.debug("Ignoring null layout.".concat(r))})}}setDataArrayForSeries(e,t,r){var{name:n,plotStyle:i}=e,l=this.seriesDataMap.get(n),s=this.chartUtils.getPlotlyProperty(i,t);l&&tt(l,s,r)}cleanSeries(e){var{dh:t}=this,{name:r,plotStyle:n}=e,i=this.seriesDataMap.get(r);if(i!=null){if(n===t.plot.SeriesPlotStyle.HISTOGRAM){var{xLow:l,xHigh:s}=i;if(l&&s&&l.length===s.length){for(var o=[],u=0;u<l.length;u+=1)o.push(s[u]-l[u]);i.width=o}}else if(n===t.plot.SeriesPlotStyle.LINE||n===t.plot.SeriesPlotStyle.ERROR_BAR||n===t.plot.SeriesPlotStyle.BAR){var{x:c,xLow:d,xHigh:m,y:p,yLow:v,yHigh:y}=i;d&&m&&d!==c&&(i.error_x=H.getPlotlyErrorBars(c,d,m)),v&&y&&v!==p&&(i.error_y=H.getPlotlyErrorBars(p,v,y))}else if(n===t.plot.SeriesPlotStyle.TREEMAP){var{ids:S,labels:E}=i;S!==void 0&&E===void 0&&(i.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 l=t.oneClicks[n],{columns:s}=l,o=new Set([...e.keys(),...t.lastFilter.keys()]);o.forEach(u=>{var c=e.get(u);t.lastFilter.get(u)!==c&&s.find(d=>d.name===u)!=null&&l.setValueForColumn(u,c)})},n=0;n<this.oneClicks.length;n+=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}}D(Pe,"ADD_SERIES_DEBOUNCE",50);const Ue=Pe;function et(a,e,t,r,n,i,l){try{var s=a[i](l),o=s.value}catch(u){t(u);return}s.done?e(o):Promise.resolve(o).then(r,n)}function Ae(a){return function(){var e=this,t=arguments;return new Promise(function(r,n){var i=a.apply(e,t);function l(o){et(i,r,n,l,s,"next",o)}function s(o){et(i,r,n,l,s,"throw",o)}l(void 0)})}}class Re{static makeModelFromSettings(e,t,r){var n=arguments;return Ae(function*(){var i=n.length>3&&n[3]!==void 0?n[3]:j,l=yield Re.makeFigureFromSettings(e,t,r);return new Ue(e,l,t,i)})()}static makeFigureFromSettings(e,t,r){return Ae(function*(){var n=yield r.copy();return n.applyCustomColumns(r.customColumns),n.applyFilter(r.filter),n.applySort(r.sort),e.plot.Figure.create(new H(e).makeFigureSettings(t,n))})()}static makeModel(e,t,r){var n=arguments;return Ae(function*(){var i=n.length>3&&n[3]!==void 0?n[3]:j;return new Ue(e,r,t,i)})()}}const hn=Re;var qr=Ee.createContext(null);function mn(){return at(qr,"No IdeConnection available in useConnection. Was code wrapped in ConnectionContext.Provider?")}export{xt as $,un as A,Xt as B,dn as C,q as D,br as E,Le as F,Fr as G,vr as H,K as I,pr as J,Dr as K,cn as L,X as M,j as N,H as O,Oe as P,Ue as Q,Zr as R,or as S,nt as T,Ne as U,qr as V,He as W,Xr as X,Yr as Y,Se as Z,sn as _,Ur as a,Jr as b,hn as c,at as d,ie as e,_t as f,f as g,Zt as h,Qr as i,O as j,w as k,nr as l,we as m,k as n,h as o,en as p,st as q,gr as r,nn as s,on as t,mn as u,tn as v,rn as w,an as x,cr as y,ln as z};
|
|
2
|
+
//# sourceMappingURL=useConnection-405f8d74.js.map
|