@deephaven/embed-chart 0.58.1-beta.5 → 0.58.1-beta.9
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-9bfcf714.js → App-d16b37d2.js} +2 -2
- package/build/assets/{App-9bfcf714.js.map → App-d16b37d2.js.map} +1 -1
- package/build/assets/index-a602fdca.js +17 -0
- package/build/assets/index-a602fdca.js.map +1 -0
- package/build/assets/index-d8dca39c.js +16 -0
- package/build/assets/index-d8dca39c.js.map +1 -0
- package/build/assets/useConnection-e65be642.js +3 -0
- package/build/assets/useConnection-e65be642.js.map +1 -0
- package/build/index.html +1 -1
- package/package.json +14 -14
- package/build/assets/index-b2c2fdc0.js +0 -16
- package/build/assets/index-b2c2fdc0.js.map +0 -1
- package/build/assets/index-f6b6fbaf.js +0 -17
- package/build/assets/index-f6b6fbaf.js.map +0 -1
- package/build/assets/useConnection-e17c41c4.js +0 -3
- package/build/assets/useConnection-e17c41c4.js.map +0 -1
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{r as C,G as _,aP as At,C as E,D as Ct,E as X,R as It,V as O,F as ke,aQ as xt,L as Lt,aR as Rt,a3 as ze,aS as bt,ac as ge,aj as kt,K as jt,U as ye}from"./vendor-7690fdaf.js";import{T as _t,L as G,k as Vt,u as $t,aQ as Ht,aR as Wt,E as Bt,H as qt,D as Kt,B as zt,I as Gt,y as Yt,P as Xt,V as Zt,n as Ee,af as Ge,aS as Qt,aT as Ut,r as Jt,F as er,Z as tr}from"./index-b2c2fdc0.js";import{c as Ie,P as wt,b as rr,h as nr,p as ir,o as ar,s as or,t as sr}from"./plotly-aa0963d0.js";var Ai=Object.freeze([]),Ci=new Map,Ii=()=>{};function xe(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return e.filter(r=>r!=null)}function lr(n,e,t){return e=ur(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ur(n){var e=cr(n,"string");return typeof e=="symbol"?e:String(e)}function cr(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class dr extends Error{constructor(){super(...arguments),lr(this,"isCanceled",!0)}}const Ye=dr;function hr(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,t=fr(n,e);t.forEach(r=>{n[r]=n[r].bind(n)})}function fr(n,e){for(var t=new Set,r=n,i=0;r!=null&&r!==Object.prototype&&(i<=1||e);){for(var a of Object.getOwnPropertyNames(r))a!=="constructor"&&typeof r[a]=="function"&&t.add(a);r=Object.getPrototypeOf(r),i+=1}return[...t.keys()]}function Xe(n,e,t,r,i,a,o){try{var s=n[a](o),l=s.value}catch(u){t(u);return}s.done?e(l):Promise.resolve(l).then(r,i)}function mr(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){Xe(a,r,i,o,s,"next",l)}function s(l){Xe(a,r,i,o,s,"throw",l)}o(void 0)})}}function pr(n){return je.apply(this,arguments)}function je(){return je=mr(function*(n){var{clipboard:e}=navigator;if(e!==void 0)try{return navigator.clipboard.writeText(n)}catch{return Ze(n)}Ze(n)}),je.apply(this,arguments)}function Ze(n){var e=document.activeElement,t=document.createElement("textarea");t.value=n,document.body.appendChild(t),t.focus(),t.select();var r=document.execCommand("copy");if(document.body.removeChild(t),e instanceof HTMLElement&&e.focus(),!r)throw new Error("Unable to execute copy command")}function vr(n,e,t){return e=gr(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function gr(n){var e=yr(n,"string");return typeof e=="symbol"?e:String(e)}function yr(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Er extends Error{constructor(){super(...arguments),vr(this,"isTimeout",!0)}}const Pt=Er;class _e{static makeCancelable(e,t){var r=!1,i,a,o=new Promise((s,l)=>{a=l,Promise.resolve(e).then(u=>{r?t&&t(u):(i=u,s(u))}).catch(u=>l(u))});return o.cancel=()=>{r=!0,a(new Ye),i!=null&&t&&t(i)},o}static isCanceled(e){return e instanceof Ye}static isTimedOut(e){return e instanceof Pt}static withTimeout(e,t){return new Promise((r,i)=>{setTimeout(()=>{try{r(t())}catch(a){i(a)}},e)})}}class Sr{static join(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"and";if(e==null||e.length===0)return"";if(e.length===1)return e[0];if(e.length===2)return"".concat(e[0]," ").concat(t," ").concat(e[1]);var r=e.slice(0,e.length-1).join(", "),i=e[e.length-1];return"".concat(r,", ").concat(t," ").concat(i)}static toLower(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e==null){if(t)return"";throw new Error("Null string passed in to TextUtils.toLower")}return e.toLowerCase()}static sort(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return e<t?r?-1:1:e>t?r?1:-1:0}}const Tr=Sr;function Qe(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function br(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Qe(Object(t),!0).forEach(function(r){pe(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Qe(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function pe(n,e,t){return e=wr(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function wr(n){var e=Pr(n,"string");return typeof e=="symbol"?e:String(e)}function Pr(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ve extends C.Component{constructor(e){super(e),pe(this,"element",void 0),pe(this,"container",void 0),pe(this,"rAF",void 0),this.handleEnter=this.handleEnter.bind(this),this.handleExit=this.handleExit.bind(this),this.handleBlur=this.handleBlur.bind(this),this.element=document.createElement("div"),this.element.className="popper-container",this.container=_.createRef(),this.rAF=0;var{isShown:t}=this.props;this.state={show:t,popper:null}}componentDidUpdate(e){var{isShown:t}=this.props;e.isShown!==t&&(t?(cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{this.show()})):this.hide())}componentWillUnmount(){this.destroyPopper(!1)}getVisibleElement(e){return e==null||e.clientHeight>0||e.clientWidth>0?e:this.getVisibleElement(e.parentElement)}initPopper(){var{popper:e}=this.state,{closeOnBlur:t,referenceObject:r}=this.props;if(!e&&this.container.current!==null){var{options:i}=this.props;i=br({placement:"auto",modifiers:{preventOverflow:{boundariesElement:"viewport"}}},i),document.body.appendChild(this.element);var a=this.getVisibleElement(this.container.current);a==null&&(a=this.container.current),e=new At(r||a,this.element,i),e.scheduleUpdate(),cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{if(t&&!this.element.contains(document.activeElement)){var o=this.element.firstElementChild;o instanceof HTMLElement&&o.focus()}}),this.setState({popper:e})}}destroyPopper(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;cancelAnimationFrame(this.rAF);var{popper:t}=this.state;t&&(t.destroy(),document.body.contains(this.element)&&document.body.removeChild(this.element),e&&this.setState({popper:null}))}show(){this.initPopper(),this.setState({show:!0})}hide(){this.setState({show:!1})}scheduleUpdate(){var{popper:e}=this.state;e&&e.scheduleUpdate()}handleBlur(e){e.relatedTarget instanceof HTMLElement&&(this.element.contains(e.relatedTarget)||this.hide())}handleEnter(){var{onEntered:e}=this.props;e()}handleExit(){var{onExited:e}=this.props,{show:t}=this.state;t||this.destroyPopper(),e()}renderContent(){var{className:e,children:t,timeout:r,interactive:i,closeOnBlur:a}=this.props,{show:o}=this.state;return E.jsx(Ct,{in:o,timeout:r,classNames:"popper-transition",onEntered:this.handleEnter,onExited:this.handleExit,children:E.jsx("div",{onClick:s=>{s.stopPropagation()},onKeyDown:s=>{s.key==="Escape"&&this.hide()},className:X("popper",{interactive:i},e),onBlur:a?this.handleBlur:void 0,tabIndex:a?-1:void 0,role:"presentation",children:E.jsxs("div",{className:"popper-content",children:[t,E.jsx("div",{className:"popper-arrow","x-arrow":""})]})})})}render(){var{popper:e}=this.state,{"data-testid":t}=this.props;return E.jsx("div",{className:"popper-parent-container",ref:this.container,style:{display:"none"},"data-testid":t,children:e&&It.createPortal(this.renderContent(),this.element)})}}pe(Ve,"propTypes",{children:O.node.isRequired,options:O.shape({}),className:O.string,timeout:O.number,onEntered:O.func,onExited:O.func,isShown:O.bool,closeOnBlur:O.bool,interactive:O.bool,referenceObject:O.shape({}),"data-testid":O.string});pe(Ve,"defaultProps",{options:{},className:"",timeout:_t.transitionMs,onEntered(){},onExited(){},isShown:!1,interactive:!1,closeOnBlur:!1,referenceObject:null,"data-testid":void 0});const Ft=Ve;function Ue(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Fr(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ue(Object(t),!0).forEach(function(r){Y(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ue(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Y(n,e,t){return e=Mr(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Mr(n){var e=Dr(n,"string");return typeof e=="symbol"?e:String(e)}function Dr(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Or=G.module("Tooltip");class x extends C.Component{static handleHidden(){x.shownTooltipCount-=1,x.shownTooltipCount===0&&(x.lastHiddenTime=Date.now())}static handleShown(){x.shownTooltipCount+=1}constructor(e){super(e),Y(this,"container",void 0),Y(this,"popper",void 0),Y(this,"parent",void 0),Y(this,"timer",void 0),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleWindowMouseMove=this.handleWindowMouseMove.bind(this),this.handleWheel=this.handleWheel.bind(this),this.handleTimeout=this.handleTimeout.bind(this),this.handleExited=this.handleExited.bind(this),this.stopShowingTooltip=this.stopShowingTooltip.bind(this),this.container=_.createRef(),this.popper=_.createRef(),this.parent=null,this.timer=null,this.state={isShown:!1}}componentDidMount(){this.startListening();var{timeout:e}=this.props;e===0&&this.show()}componentDidUpdate(e,t){var{isShown:r}=t,{isShown:i}=this.state;i!==r&&(i?x.handleShown():x.handleHidden())}componentWillUnmount(){this.stopListening(),this.stopListeningWindow(),this.stopTimer();var{isShown:e}=this.state;e&&x.handleHidden()}startListening(){if(!this.container.current||!this.container.current.parentElement){Or.error("Tooltip doesn't have a container or a parent set!");return}this.parent=this.container.current.parentElement,this.parent.addEventListener("mousemove",this.handleMouseMove),this.parent.addEventListener("mouseleave",this.handleMouseLeave),this.parent.addEventListener("mousedown",this.stopShowingTooltip)}stopListening(){this.parent&&(this.parent.removeEventListener("mousemove",this.handleMouseMove),this.parent.removeEventListener("mouseleave",this.handleMouseLeave),this.parent.removeEventListener("mousedown",this.stopShowingTooltip))}startListeningWindow(){window.addEventListener("mousemove",this.handleWindowMouseMove,!0),window.addEventListener("contextmenu",this.stopShowingTooltip,!0),window.addEventListener("wheel",this.handleWheel)}stopListeningWindow(){window.removeEventListener("mousemove",this.handleWindowMouseMove,!0),window.removeEventListener("contextmenu",this.stopShowingTooltip,!0),window.removeEventListener("wheel",this.handleWheel)}handleMouseMove(){this.startTimer()}handleWheel(){var{isShown:e}=this.state;this.popper.current&&this.parent&&e&&!this.popper.current.element.matches(":hover")&&!this.parent.matches(":hover")&&(this.stopTimer(),this.hide())}handleMouseLeave(){var{isShown:e}=this.state;this.stopTimer();var{interactive:t}=this.props;!t&&e&&this.hide()}handleTimeout(){this.show()}handleWindowMouseMove(e){var t=e.clientX,r=e.clientY,{isShown:i}=this.state;if(!(!this.popper.current||!this.parent)){var a=this.popper.current.element.getBoundingClientRect(),o=this.parent.getBoundingClientRect();t>=a.left&&t<=a.left+a.width&&r>=a.top&&r<=a.top+a.height?this.handleMouseMove():t>=o.left&&t<=o.left+o.width&&r>=o.top&&r<=o.top+o.height?this.handleMouseMove():i&&(this.stopTimer(),this.hide())}}startTimer(){this.stopTimer();var{timeout:e,reshowTimeout:t}=this.props,r=e;(x.shownTooltipCount>0||Date.now()-x.lastHiddenTime<x.triggerReshowThreshold)&&(r=t),this.timer=window.setTimeout(this.handleTimeout,r)}stopTimer(){this.timer!=null&&(clearTimeout(this.timer),this.timer=null)}show(){var{isShown:e}=this.state;if(this.stopTimer(),!e){var t;(t=this.popper.current)===null||t===void 0||t.show(),this.setState({isShown:!0});var{interactive:r}=this.props;r&&this.startListeningWindow()}}hide(){var e;(e=this.popper.current)===null||e===void 0||e.hide(),this.stopListeningWindow()}update(){var e;(e=this.popper.current)===null||e===void 0||e.scheduleUpdate()}handleExited(){this.setState({isShown:!1});var{onExited:e}=this.props;e()}stopShowingTooltip(){var{isShown:e}=this.state;this.stopTimer(),e&&this.hide()}render(){var{interactive:e,children:t,referenceObject:r,popperClassName:i,"data-testid":a,onEntered:o}=this.props,{isShown:s}=this.state,{options:l}=this.props;return l=Fr({placement:"bottom"},l),E.jsx("div",{ref:this.container,style:{display:"none"},"data-testid":a,children:E.jsx(Ft,{className:X(i,"popper-tooltip"),options:l,ref:this.popper,onEntered:o,onExited:this.handleExited,interactive:e,referenceObject:r,children:E.jsxs("div",{className:"tooltip-content",children:[" ",s&&t]})})})}}Y(x,"defaultTimeout",500);Y(x,"defaultReshowTimeout",100);Y(x,"triggerReshowThreshold",300);Y(x,"shownTooltipCount",0);Y(x,"lastHiddenTime",Date.now());Y(x,"defaultProps",{interactive:!1,options:{},popperClassName:"",reshowTimeout:x.defaultReshowTimeout,timeout:x.defaultTimeout,onEntered:()=>{},onExited:()=>{},"data-testid":void 0});const Nr=x;function Oe(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"No value available in context. Was code wrapped in a provider?",t=C.useContext(n);if(t==null)throw new Error(e);return t}var Ar=3500,Cr=G.module("useCopyToClipboard");function Ir(){var[n,e]=C.useState(!1),t=C.useRef(null),r=C.useCallback(i=>{pr(i).then(()=>{e(!0)}).catch(a=>Cr.error("Unable to copy ".concat(i),`
|
|
2
|
-
`,a))},[]);return C.useEffect(()=>(t.current&&clearTimeout(t.current),n&&(t.current=setTimeout(()=>{e(!1)},Ar)),()=>{t.current&&clearTimeout(t.current)}),[n]),[n,r]}var xr=["kind","variant","type","tooltip","icon","disabled","active","onClick","onContextMenu","onMouseDown","onMouseUp","onMouseEnter","onMouseLeave","onKeyDown","className","style","children","tabIndex","data-testid","aria-label"];function Je(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function et(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Je(Object(t),!0).forEach(function(r){Lr(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Je(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Lr(n,e,t){return e=Rr(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Rr(n){var e=kr(n,"string");return typeof e=="symbol"?e:String(e)}function kr(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function jr(n,e){if(n==null)return{};var t=_r(n,e),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(n);for(i=0;i<a.length;i++)r=a[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function _r(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,a;for(a=0;a<r.length;a++)i=r[a],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var Vr=["primary","secondary","tertiary","success","danger","inline","ghost"],$r=["group-end"];function Hr(n,e){switch(n){case"primary":return"btn-primary";case"secondary":return"btn-outline-primary";case"tertiary":return"btn-secondary";case"success":return"btn-success";case"danger":return"btn-danger";case"inline":return"btn-inline";case"ghost":return X("btn-link",{"btn-link-icon":e,"btn-link-icon-only":e})}}function Wr(n){switch(n){case"group-end":return X("pl-2","pr-3")}}var Ne=_.forwardRef((n,e)=>{var{kind:t,variant:r,type:i,tooltip:a,icon:o,disabled:s=!1,active:l,onClick:u,onContextMenu:c,onMouseDown:d,onMouseUp:h,onMouseEnter:g,onMouseLeave:p,onKeyDown:y,className:S,style:T,children:w,tabIndex:b,"data-testid":P,"aria-label":F}=n,V=jr(n,xr),N;r&&(N=Wr(r));var D;o&&(D=_.isValidElement(o)?o:E.jsx(ke,{icon:o}));var M=D!=null&&w==null;if(D!=null&&w!=null){var k=!1;M=!0,_.Children.forEach(w,U=>{typeof U=="string"?k=!0:_.isValidElement(U)&&_.Children.forEach(U.props.children,de=>{typeof de=="string"&&(k=!0)})}),k&&(M=!1,D=_.cloneElement(D,{className:X("mr-1",D.props.className)}))}var Z=Hr(t,M),K;a!==void 0&&(K=typeof a=="string"?E.jsx(Nr,{children:a}):a);var ne=F;F===void 0&&M&&a!=null&&typeof a=="string"&&(ne=a);var Q=E.jsxs("button",et(et({"data-testid":P,ref:e,type:i,className:X("btn",Z,N,{active:l},S),onClick:u,onContextMenu:c,onMouseUp:h,onMouseDown:d,onMouseEnter:g,onMouseLeave:p,onKeyDown:y,style:T,disabled:s,tabIndex:b,"aria-label":ne},V),{},{children:[o&&D,w,a!=null&&!s&&K]}));return s&&a!=null?E.jsxs("span",{className:"btn-disabled-wrapper",children:[Q,K]}):Q});Ne.displayName="Button";Ne.propTypes={kind:O.oneOf(Vr).isRequired,variant:O.oneOf($r),type:O.oneOf(["submit","reset","button"]),tooltip(n){var{tooltip:e,icon:t,children:r}=n;return e===void 0&&t!=null&&r==null?new Error("Tooltip is required for icon only buttons"):null},icon(n){var{children:e,icon:t}=n;return t==null&&e==null?new Error("Icon is required if no children are provided"):e==null&&!_.isValidElement(t)&&(t==null||t.iconName===""||t.iconName==null)?new Error("Icon must be react element or fontawesome IconDefinition"):null},disabled:O.bool,active:O.bool,onClick(n){var{onClick:e,type:t}=n;return t==="button"&&typeof e!="function"?new Error("type button requires an onClick function"):e!==void 0&&typeof e!="function"?new Error("onClick must be a function"):null},onContextMenu:O.func,onMouseUp:O.func,onMouseDown:O.func,onMouseEnter:O.func,onMouseLeave:O.func,onKeyDown:O.func,tabIndex:O.number,children:O.node,className:O.string,style:O.object,"data-testid":O.string};Ne.defaultProps={type:"button",onClick:void 0,onContextMenu:void 0,onMouseUp:void 0,onMouseDown:void 0,onMouseEnter:void 0,onMouseLeave:void 0,onKeyDown:void 0,variant:void 0,tooltip:void 0,icon:void 0,disabled:!1,active:void 0,tabIndex:void 0,children:void 0,className:void 0,style:{},"data-testid":void 0};const Br=Ne;function qr(n,e,t){return e=Kr(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Kr(n){var e=zr(n,"string");return typeof e=="symbol"?e:String(e)}function zr(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function xi(n){return n.then!==void 0}class ue{static disableAllActions(){ue.actionsDisabled=!0}static enableAllActions(){ue.actionsDisabled=!1}static isContextActionEvent(e){return Array.isArray(e.contextActions)}static compareActions(e,t){if(e.group!==t.group){var r,i;return((r=e.group)!==null&&r!==void 0?r:0)>((i=t.group)!==null&&i!==void 0?i:0)?1:-1}if(e.order!==t.order){var a,o;return((a=e.order)!==null&&a!==void 0?a:0)>((o=t.order)!==null&&o!==void 0?o:0)?1:-1}if(e.title!==t.title){var s,l;return((s=e.title)!==null&&s!==void 0?s:"")>((l=t.title)!==null&&l!==void 0?l:"")?1:-1}return e!==t?e>t?1:-1:0}static sortActions(e){if(e==null||!Array.isArray(e))return[];var t=e.slice();return t.sort(ue.compareActions),t}static isMacPlatform(){var{platform:e}=window.navigator;return e.startsWith("Mac")}static getModifierKey(){return ue.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(e){var t=ue.getModifierKey();return e[t]}static getMenuItems(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=[],i=e;Array.isArray(i)||(i=[i]);for(var a=0;a<i.length;a+=1){var o=i[a],s=void 0;typeof o=="function"?s=o():s=o,s!=null&&(s instanceof Promise?t&&r.push(s):Array.isArray(s)?r=r.concat(s):r.push(s))}return r=r.filter(l=>l.title!==void 0||l.then!=null||l.menuElement),r}static getNextMenuItem(e,t,r){var i=e;i<0&&t<0&&(i=r.length);for(var a=1;a<r.length+1;a+=1){var o=(i+t*a+r.length)%r.length,s=r[o];if(!(s instanceof Promise)&&s.disabled!==!0)return o}return e}}qr(ue,"actionsDisabled",!1);const he=ue;var $e=_.forwardRef((n,e)=>{var t,r;function i(N){var{menuItem:D,onMenuItemClick:M}=n;M(D,N)}function a(N){var{menuItem:D,onMenuItemMouseMove:M}=n;M(D,N)}function o(N){var{menuItem:D,onMenuItemContextMenu:M}=n;M(D,N)}function s(N,D,M){if(typeof N.type=="string")return N;var{closeMenu:k,menuItem:Z,isKeyboardSelected:K,isMouseSelected:ne,"data-testid":Q}=n,U={menuItem:Z,closeMenu:k,isKeyboardSelected:K,isMouseSelected:ne,iconElement:D,displayShortcut:M,"data-testid":Q};return _.cloneElement(N,{forwardedProps:U})}var{children:l,menuItem:u,isKeyboardSelected:c=!1,isMouseSelected:d=!1,"data-testid":h}=n,g=(t=u.shortcutText)!==null&&t!==void 0?t:(r=u.shortcut)===null||r===void 0?void 0:r.getDisplayText(),p=null;if(u.icon){var y=u.icon;if(_.isValidElement(y))p=y;else{var S;u.iconColor!=null&&(u.disabled===void 0||!u.disabled)&&(S={color:u.iconColor}),p=E.jsx(ke,{icon:y,style:S})}}var T=null,w=!!l;u.actions&&(T=E.jsx(ke,{icon:Vt}));var b=null;if(u.menuElement)b=E.jsx("div",{className:"custom-menu-item",onMouseMove:a,children:s(u.menuElement,p,g)});else{var P,F=u.disabled,V=u.iconOutline;b=E.jsx("button",{type:"button",className:X("btn-context-menu",{disabled:F},{active:(w||d)&&(F===void 0||!F)},{"keyboard-active":c&&(F===void 0||!F)}),onClick:i,onMouseMove:a,onContextMenu:o,title:(P=u.description)!==null&&P!==void 0?P:"",children:E.jsxs("div",{className:"btn-context-menu-wrapper",children:[E.jsx("span",{className:X("icon",{outline:V}),children:p}),E.jsx("span",{className:"title",children:u.title}),g!==void 0&&E.jsx("span",{className:"shortcut",children:g}),T&&E.jsx("span",{className:X("submenu-indicator",{disabled:F}),children:T})]})})}return E.jsxs("div",{className:"context-menu-item",ref:e,"data-testid":h,children:[l,b]})});$e.displayName="ContextMenuItem";$e.defaultProps={children:null,isKeyboardSelected:!1,isMouseSelected:!1,"data-testid":void 0};const Gr=$e;function tt(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Yr(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?tt(Object(t),!0).forEach(function(r){se(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):tt(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function se(n,e,t){return e=Xr(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Xr(n){var e=Zr(n,"string");return typeof e=="symbol"?e:String(e)}function Zr(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var rt=G.module("ContextMenu");class Te extends C.PureComponent{static handleContextMenu(e){e.metaKey||(e.stopPropagation(),e.preventDefault())}constructor(e){super(e),se(this,"container",void 0),se(this,"oldFocus",void 0),se(this,"activeSubMenuRef",void 0),se(this,"subMenuTimer",void 0),se(this,"rAF",void 0),se(this,"initialPosition",void 0),this.handleBlur=this.handleBlur.bind(this),this.handleCloseSubMenu=this.handleCloseSubMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMenuItemClick=this.handleMenuItemClick.bind(this),this.handleMenuItemContextMenu=this.handleMenuItemContextMenu.bind(this),this.handleMenuItemMouseMove=this.handleMenuItemMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleWindowResize=this.handleWindowResize.bind(this),this.container=_.createRef(),this.oldFocus=document.activeElement,this.activeSubMenuRef=_.createRef(),this.subMenuTimer=0,this.rAF=0,this.initialPosition={top:e.top,left:e.left},this.state={menuItems:[],pendingItems:[],activeSubMenu:null,hasOverflow:!1,subMenuTop:null,subMenuLeft:null,subMenuParentWidth:0,subMenuParentHeight:0,keyboardIndex:-1,mouseIndex:-1}}componentDidMount(){this.initMenu(),this.verifyPosition(),window.addEventListener("resize",this.handleWindowResize),this.rAF=window.requestAnimationFrame(()=>{var e;(e=this.container.current)===null||e===void 0||e.focus();var{onMenuOpened:t}=this.props;t(this)})}componentDidUpdate(e,t){var{actions:r}=this.props,{activeSubMenu:i}=this.state;if(i!==t.activeSubMenu)if(i==null){var a;(a=this.container.current)===null||a===void 0||a.focus()}else this.setActiveSubMenuPosition();if(e.actions!==r&&(this.initMenu(),this.container.current==null||!this.container.current.contains(document.activeElement))){var o;(o=this.container.current)===null||o===void 0||o.focus()}this.verifyPosition()}componentWillUnmount(){this.cancelPromises(),window.removeEventListener("resize",this.handleWindowResize),cancelAnimationFrame(this.rAF)}getKeyboardIndex(){var{options:e}=this.props;if(e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse){var{keyboardIndex:t}=this.state;return t}return this.getMouseIndex()}setKeyboardIndex(e){var{options:t}=this.props;t.separateKeyboardMouse!==void 0&&t.separateKeyboardMouse?this.setState({keyboardIndex:e}):this.setMouseIndex(e)}getMouseIndex(){var{mouseIndex:e}=this.state;return e}setMouseIndex(e){this.setState({mouseIndex:e})}initMenu(){this.cancelPromises(),cancelAnimationFrame(this.rAF);var{options:e}=this.props,t=e.initialKeyboardIndex;t===void 0&&(t=-1);for(var{actions:r}=this.props,i=he.getMenuItems(r),a=[],o=i.length-1;o>=0;o-=1){var s=i[o];s instanceof Promise?this.initMenuPromise(s):a.push(s)}this.setState({mouseIndex:-1,keyboardIndex:t,activeSubMenu:null,menuItems:he.sortActions(a)})}initMenuPromise(e){var t=_e.makeCancelable(e);this.setState(r=>({pendingItems:r.pendingItems.concat(t)})),t.then(r=>{this.setState(i=>{var a=i.pendingItems.indexOf(t);if(a>=0){var o=i.pendingItems.slice();return o.splice(a,1),{menuItems:he.sortActions(i.menuItems.concat(r)),pendingItems:o}}return null})},r=>{_e.isCanceled(r)||(this.setState(i=>{var a=i.pendingItems.indexOf(t);if(a>=0){var o=i.pendingItems.slice();return o.splice(a,1),{pendingItems:o}}return null}),rt.error(r))})}cancelPromises(){var{pendingItems:e}=this.state;e.map(t=>t.cancel())}setActiveSubMenuPosition(){if(this.activeSubMenuRef.current!==null){var e=this.activeSubMenuRef.current.getBoundingClientRect();this.setState({subMenuTop:e.top,subMenuLeft:e.right,subMenuParentHeight:e.height,subMenuParentWidth:e.width})}}verifyPosition(){var e,t,r,i,{options:a,updatePosition:o,subMenuParentWidth:s,subMenuParentHeight:l,top:u,left:c}=this.props;if(!(!this.container.current||a.doNotVerifyPosition!=null&&a.doNotVerifyPosition)){var{top:d,left:h}=this.initialPosition,{width:g,height:p}=(e=(t=this.container.current)===null||t===void 0?void 0:t.getBoundingClientRect())!==null&&e!==void 0?e:{width:0,height:0},y=((r=(i=this.container.current)===null||i===void 0?void 0:i.scrollHeight)!==null&&r!==void 0?r:0)>window.innerHeight;p===0||g===0||(d+p>window.innerHeight&&(d-p-l>0?d-=p-l:d=window.innerHeight-p),h+g>window.innerWidth&&(h=h-g-s),(c!==h||u!==d)&&(this.setState({hasOverflow:y}),o(d,h)))}}handleWindowResize(){this.container.current&&this.closeMenu(!0)}handleBlur(e){if(!this.container.current){rt.warn("Container is null!");return}if(!this.container.current.contains(e.relatedTarget)){for(var t=e.relatedTarget,r=!1;t&&!r;)r=t.hasAttribute("data-dh-context-menu"),t=t.parentElement;r||this.closeMenu(!0)}}isEscapeKey(e){var{left:t}=this.props;return e==="Escape"||t<0&&e==="ArrowRight"||e==="ArrowLeft"}handleKeyDown(e){var{menuItems:t}=this.state,r=this.getKeyboardIndex(),i=r,a=!1;if(e.key==="Enter"||e.key===" "){r>=0&&r<t.length&&this.handleMenuItemClick(t[r],e);return}if(e.key==="ArrowRight"?r>=0&&r<=t.length?a=!0:i=0:this.isEscapeKey(e.key)?i=null:e.key==="ArrowUp"||e.shiftKey&&e.key==="Tab"?i=he.getNextMenuItem(i,-1,t):(e.key==="ArrowDown"||e.key==="Tab")&&(i=he.getNextMenuItem(i,1,t)),a){this.openSubMenu(r),e.preventDefault(),e.stopPropagation();return}r!==i&&(i!==null?this.setKeyboardIndex(i):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}openSubMenu(e){var{menuItems:t,activeSubMenu:r}=this.state,i=t[e].actions?e:null;r!==i&&this.setState({activeSubMenu:i,subMenuTop:null,subMenuLeft:null})}closeMenu(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,{closeMenu:t,onMenuClosed:r}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t(e),r(this)})}closeSubMenu(){this.setState({activeSubMenu:null})}handleCloseSubMenu(e){e?this.closeMenu(!0):this.closeSubMenu()}handleMenuItemClick(e,t){t.preventDefault(),t.stopPropagation();var{menuItems:r}=this.state;e!=null&&(e.disabled===void 0||!e.disabled)&&(e.actions!=null?this.openSubMenu(r.indexOf(e)):e.action!=null&&(e.action(t.nativeEvent),this.closeMenu(!0)))}handleMenuItemContextMenu(e,t){t.metaKey||this.handleMenuItemClick(e,t)}handleMenuItemMouseMove(e){var{menuItems:t}=this.state,r=t.indexOf(e);this.setMouseIndex(r),r>=0&&r<t.length&&(e.disabled===void 0||!e.disabled)&&this.openSubMenu(r)}handleMouseLeave(){this.setMouseIndex(-1)}render(){for(var e=[],{top:t,left:r}=this.props,{activeSubMenu:i,hasOverflow:a,keyboardIndex:o,menuItems:s,mouseIndex:l,pendingItems:u,subMenuTop:c,subMenuLeft:d,subMenuParentWidth:h,subMenuParentHeight:g}=this.state,p=0;p<s.length;p+=1){var y=s[p];p>0&&y.group!==s[p-1].group&&e.push(E.jsx("hr",{},"".concat(p,".separator")));var S=E.jsx(Gr,{ref:i===p?this.activeSubMenuRef:null,isKeyboardSelected:o===p,isMouseSelected:l===p,menuItem:y,closeMenu:this.handleCloseSubMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:this.handleMenuItemContextMenu},p);e.push(S)}var T=null;u.length>0&&(T=E.jsx("div",{className:"loading",children:E.jsx($t,{className:"loading-spinner-vertical-align"})}));var{menuStyle:w,"data-testid":b}=this.props,P=i!==null&&c!==null&&d!==null;return E.jsxs(E.Fragment,{children:[E.jsxs("div",{className:X({"has-overflow":a},"context-menu-container"),style:Yr({top:t,left:r},w),ref:this.container,"data-dh-context-menu":!0,onBlur:this.handleBlur,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,onContextMenu:Te.handleContextMenu,role:"menuitem",tabIndex:0,"data-testid":b,children:[e,T]}),P&&i!==null&&c!==null&&d!==null&&E.jsx(Te,{actions:s[i].actions||[],closeMenu:this.handleCloseSubMenu,top:c,left:d,updatePosition:(F,V)=>{this.setState({subMenuTop:F,subMenuLeft:V})},subMenuParentWidth:h,subMenuParentHeight:g},"sub-".concat(i))]})}}se(Te,"defaultProps",{subMenuParentWidth:0,subMenuParentHeight:0,closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0});const Qr=Te;function nt(n,e,t){return e=Ur(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ur(n){var e=Jr(n,"string");return typeof e=="symbol"?e:String(e)}function Jr(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class en extends C.Component{constructor(e){super(e),nt(this,"container",void 0),nt(this,"openMenu",void 0),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.container=_.createRef(),this.openMenu=_.createRef(),this.state={actions:null,left:0,top:0}}componentDidMount(){var e;(e=this.container.current)!==null&&e!==void 0&&e.parentElement&&this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu)}componentWillUnmount(){var e;(e=this.container.current)!==null&&e!==void 0&&e.parentElement&&this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu)}handleContextMenu(e){if(this.container.current){var t=this.container.current.getBoundingClientRect(),r=e.clientY-t.top,i=e.clientX-t.left,{actions:a}=this.state;if(a!=null&&e.target===this.container.current){e.preventDefault(),this.setState({actions:null},()=>{var s=document.elementFromPoint(i,r),l=new MouseEvent("contextmenu",{clientX:e.clientX,clientY:e.clientY,bubbles:!0,cancelable:!0});s==null||s.dispatchEvent(l)});return}if(he.isContextActionEvent(e)&&!(e.metaKey||e.ctrlKey)){var o=he.getMenuItems(e.contextActions);o.length!==0&&(e.preventDefault(),this.setState({actions:o,top:r,left:i}))}}}handleMenuClose(e){e===this.openMenu.current&&this.setState({actions:null})}render(){var e=null,{"data-testid":t}=this.props,{actions:r,top:i,left:a}=this.state;return r&&(e=E.jsx(Qr,{ref:this.openMenu,actions:r,onMenuClosed:this.handleMenuClose,top:i,left:a,updatePosition:(o,s)=>{this.setState({top:o,left:s})},"data-testid":t})),E.jsx("div",{className:X("context-menu-root",{active:r}),ref:this.container,children:e})}}const Li=en;function tn(n){var{copy:e,kind:t="ghost",tooltip:r="Copy",className:i,style:a,"data-testid":o,children:s}=n,[l,u]=Ir();return E.jsx(Br,{kind:t,className:i,style:a,"data-testid":o,icon:l?Ht:Wt,tooltip:l?"Copied":r,onClick:()=>{u(typeof e=="function"?e():e)},children:s})}const rn={"dh-spectrum-palette":"_dh-spectrum-palette_1mcqx_1"},nn={"dh-spectrum-alias":"_dh-spectrum-alias_9ny19_1"};function it(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function at(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?it(Object(t),!0).forEach(function(r){an(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):it(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function an(n,e,t){return e=on(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function on(n){var e=sn(n,"string");return typeof e=="symbol"?e:String(e)}function sn(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ot=at(at({},rn),nn);function st(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Me(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?st(Object(t),!0).forEach(function(r){ln(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):st(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ln(n,e,t){return e=un(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function un(n){var e=cn(n,"string");return typeof e=="symbol"?e:String(e)}function cn(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var{global:dn,light:hn,dark:fn,medium:mn,large:pn}=xt,vn={global:dn,light:Me(Me({},hn),ot),dark:Me(Me({},fn),ot),medium:mn,large:pn};function gn(n){var{children:e,isPortal:t=!1,theme:r=vn,colorScheme:i}=n,[a]=C.useState(t?Lt():null);return E.jsx(Rt,{UNSAFE_className:"spectrum-theme-provider",theme:r,colorScheme:i,"data-unique-id":a,children:e})}var yn=G.module("ThemeProvider"),Mt=C.createContext(null);function Ri(n){var{themes:e,children:t}=n,r=C.useMemo(()=>Bt(),[]),[i,a]=C.useState(null),[o,s]=C.useState(()=>{var c,d;return(c=(d=qt())===null||d===void 0?void 0:d.themeKey)!==null&&c!==void 0?c:Kt}),l=C.useMemo(()=>e==null?null:zt(o,{base:r,custom:e??[]}),[r,o,e]),u=C.useMemo(()=>[...r,...e??[]],[r,e]);return C.useEffect(function(){if(!(l==null||e==null)){Gt();var d=Yt();yn.debug2("updateThemePreloadData:",{active:l.map(h=>h.themeKey),custom:e.map(h=>h.themeKey),preloadStyleContent:d,selectedThemeKey:o}),Xt({themeKey:o,preloadStyleContent:d})}},[l,o,e]),C.useEffect(()=>{a({activeThemes:l,selectedThemeKey:o,themes:u,setSelectedThemeKey:s})},[l,o,u]),E.jsxs(E.Fragment,{children:[l==null?null:E.jsx(E.Fragment,{children:l.map(c=>E.jsx("style",{"data-theme-key":c.themeKey,children:c.styleContent},c.themeKey))}),i==null?null:E.jsx(Mt.Provider,{value:i,children:E.jsx(gn,{children:t})})]})}function En(){return Oe(Mt,"No ThemeContext value found. Component must be wrapped in a ThemeContext.Provider")}function ki(){return Oe(Zt,"No API available in useApi. Was code wrapped in ApiBootstrap or ApiContext.Provider?")}function He(n,e,t){return e=Sn(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Sn(n){var e=Tn(n,"string");return typeof e=="symbol"?e:String(e)}function Tn(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ae{static isValid(e,t){return!0}static isSameFormat(e,t){throw new Error("isSameFormat not implemented")}static makeFormat(e,t,r){return{label:e,formatString:t,type:r}}format(e,t){return""}}He(Ae,"TYPE_GLOBAL","type-global");He(Ae,"TYPE_CONTEXT_PRESET","type-context-preset");He(Ae,"TYPE_CONTEXT_CUSTOM","type-context-custom");const B=Ae;class bn extends B{format(e){switch(e){case 1:case!0:return"true";case 0:case!1:return"false";default:return""}}}const wn=bn;class Pn extends B{format(e){return String.fromCharCode(e)}}const Fn=Pn;function le(n,e,t){return e=Mn(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Mn(n){var e=Dn(n,"string");return typeof e=="symbol"?e:String(e)}function Dn(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var lt=G.module("DateTimeColumnFormatter");class ee extends B{static isValid(e,t){try{return e.i18n.DateTimeFormat.format(t.formatString,new Date),!0}catch{return!1}}static makeFormat(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:B.TYPE_CONTEXT_PRESET;return{label:e,formatString:t,type:r}}static isSameFormat(e,t){return e===t||e!==null&&t!==null&&e.type===t.type&&e.formatString===t.formatString}static makeGlobalFormatStringMap(e,t){var r=t?"'T'":" ",i=e?" z":"";return new Map([["yyyy-MM-dd HH:mm:ss","yyyy-MM-dd".concat(r,"HH:mm:ss").concat(i)],["yyyy-MM-dd HH:mm:ss.SSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSS").concat(i)],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSSSSSSSS").concat(i)]])}static getGlobalFormats(e,t){var r=ee.makeGlobalFormatStringMap(e,t);return[...r.keys()]}static makeFormatStringMap(e,t){var r=t!==void 0&&t?"'T'":" ",i=e!==void 0&&e?" z":"";return new Map([["yyyy-MM-dd","yyyy-MM-dd".concat(i)],["MM-dd-yyyy","MM-dd-yyyy".concat(i)],["HH:mm:ss","HH:mm:ss".concat(i)],["HH:mm:ss.SSS","HH:mm:ss.SSS".concat(i)],["HH:mm:ss.SSSSSSSSS","HH:mm:ss.SSSSSSSSS".concat(i)],["yyyy-MM-dd HH:mm:ss","yyyy-MM-dd".concat(r,"HH:mm:ss").concat(i)],["yyyy-MM-dd HH:mm:ss.SSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSS").concat(i)],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSSSSSSSS").concat(i)]])}static getFormats(e,t){var r=ee.makeFormatStringMap(e,t);return[...r.keys()]}constructor(e){var{timeZone:t="",showTimeZone:r=!0,showTSeparator:i=!1,defaultDateTimeFormatString:a=ee.DEFAULT_DATETIME_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),le(this,"dh",void 0),le(this,"dhTimeZone",void 0),le(this,"defaultDateTimeFormatString",void 0),le(this,"showTimeZone",void 0),le(this,"showTSeparator",void 0),le(this,"formatStringMap",void 0);var o=t||ee.DEFAULT_TIME_ZONE_ID;try{this.dhTimeZone=e.i18n.TimeZone.getTimeZone(o)}catch{lt.error("Unsupported time zone id",o),this.dhTimeZone=e.i18n.TimeZone.getTimeZone(ee.DEFAULT_TIME_ZONE_ID)}this.dh=e,this.defaultDateTimeFormatString=a,this.showTimeZone=r,this.showTSeparator=i,this.formatStringMap=ee.makeFormatStringMap(r,i)}getEffectiveFormatString(e){var t;return(t=this.formatStringMap.get(e))!==null&&t!==void 0?t:e}format(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultDateTimeFormatString,i=this.getEffectiveFormatString(r);try{return this.dh.i18n.DateTimeFormat.format(i,e,this.dhTimeZone)}catch{lt.error("Invalid format arguments")}return""}}le(ee,"DEFAULT_DATETIME_FORMAT_STRING","yyyy-MM-dd HH:mm:ss.SSS");le(ee,"DEFAULT_TIME_ZONE_ID","America/New_York");function re(n,e,t){return e=On(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function On(n){var e=Nn(n,"string");return typeof e=="symbol"?e:String(e)}function Nn(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var An=G.module("DecimalColumnFormatter");class R extends B{static isValid(e,t){try{return e.i18n.NumberFormat.format(t.formatString,0),!0}catch{return!1}}static makeFormat(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:B.TYPE_CONTEXT_PRESET,i=arguments.length>3?arguments[3]:void 0;return{label:e,type:r,formatString:t,multiplier:i}}static makePresetFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0;return R.makeFormat(e,t,B.TYPE_CONTEXT_PRESET,r)}static makeCustomFormat(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return R.makeFormat("Custom Format",e,B.TYPE_CONTEXT_CUSTOM,t)}static isSameFormat(e,t){return e===t||e!=null&&t!=null&&e.type===t.type&&e.formatString===t.formatString&&e.multiplier===t.multiplier}constructor(e){var{defaultFormatString:t=R.DEFAULT_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),re(this,"defaultFormatString",void 0),re(this,"dh",void 0),this.dh=e,this.defaultFormatString=t}format(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,i=t.multiplier!=null&&t.multiplier!==0?e*t.multiplier:e;try{return this.dh.i18n.NumberFormat.format(r,i)}catch{An.error("Invalid format arguments")}return""}}re(R,"DEFAULT_FORMAT_STRING","###,##0.0000");re(R,"FORMAT_PERCENT",R.makePresetFormat("Percent","##0.00%"));re(R,"FORMAT_BASIS_POINTS",R.makePresetFormat("Basis Points","###,##0 bp",1e4));re(R,"FORMAT_MILLIONS",R.makePresetFormat("Millions","###,##0.000 mm",1e-6));re(R,"FORMAT_SCIENTIFIC_NOTATION",R.makePresetFormat("Scientific Notation","0.0000E0"));re(R,"FORMAT_ROUND",R.makePresetFormat("Round","###,##0"));re(R,"FORMAT_ROUND_TWO_DECIMALS",R.makePresetFormat("0.00","###,##0.00"));re(R,"FORMAT_ROUND_FOUR_DECIMALS",R.makePresetFormat("0.0000","###,##0.0000"));class Cn extends B{format(e){return"".concat(e)}}const In=Cn;function be(n,e,t){return e=xn(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function xn(n){var e=Ln(n,"string");return typeof e=="symbol"?e:String(e)}function Ln(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Rn=G.module("IntegerColumnFormatter");class te extends B{static isValid(e,t){try{return e.i18n.NumberFormat.format(t.formatString,0),!0}catch{return!1}}static makeFormat(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:B.TYPE_CONTEXT_PRESET,i=arguments.length>3?arguments[3]:void 0;return{label:e,type:r,formatString:t,multiplier:i}}static makePresetFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0;return te.makeFormat(e,t,B.TYPE_CONTEXT_PRESET,r)}static makeCustomFormat(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return te.makeFormat("Custom Format",e,B.TYPE_CONTEXT_CUSTOM,t)}static isSameFormat(e,t){return e===t||e!=null&&t!=null&&e.type===t.type&&e.formatString===t.formatString&&e.multiplier===t.multiplier}constructor(e){var{defaultFormatString:t=te.DEFAULT_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),be(this,"dh",void 0),be(this,"defaultFormatString",void 0),this.dh=e,this.defaultFormatString=t}format(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,i=t.multiplier!=null&&t.multiplier!==0?e*t.multiplier:e;try{return this.dh.i18n.NumberFormat.format(r,i)}catch{Rn.error("Invalid format arguments")}return""}}be(te,"DEFAULT_FORMAT_STRING","###,##0");be(te,"FORMAT_MILLIONS",te.makePresetFormat("Millions","###,##0.000 mm",1e-6));be(te,"FORMAT_SCIENTIFIC_NOTATION",te.makePresetFormat("Scientific Notation","0.0000E0"));class kn extends B{format(e){return e}}function Dt(n,e,t){return e=jn(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function jn(n){var e=_n(n,"string");return typeof e=="symbol"?e:String(e)}function _n(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class j{static makeDateWrapper(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:1,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0,s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:0,l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:0,u=arguments.length>8&&arguments[8]!==void 0?arguments[8]:0;if(!t)throw new Error("No timezone provided");var c="".concat(r).padStart(4,"0"),d="".concat(i+1).padStart(2,"0"),h="".concat(a).padStart(2,"0"),g="".concat(o).padStart(2,"0"),p="".concat(s).padStart(2,"0"),y="".concat(l).padStart(2,"0"),S="".concat(u).padStart(9,"0"),T="".concat(c,"-").concat(d,"-").concat(h," ").concat(g,":").concat(p,":").concat(y,".").concat(S);return e.i18n.DateTimeFormat.parse(j.FULL_DATE_FORMAT,T,e.i18n.TimeZone.getTimeZone(t))}static getNextNanos(e){var t=parseInt(e,10),r="0".repeat(9-e.length),i="".concat(t+1).concat(r);return parseInt(i,10)}static getNextDate(e,t,r,i){var{year:a,month:o,date:s,hours:l,minutes:u,seconds:c,nanos:d}=r;if(t.nanos!=null){if(t.nanos.length===9)return null;d=j.getNextNanos(t.nanos),d>999999999&&(c+=1,d=0)}else t.seconds!=null?c+=1:t.minutes!=null?u+=1:t.hours!=null?l+=1:t.date!=null?s+=1:t.month!=null?o+=1:a+=1;var h=new Date(a,o,s,l,u,c);return j.makeDateWrapper(e,i,h.getFullYear(),h.getMonth(),h.getDate(),h.getHours(),h.getMinutes(),h.getSeconds(),d)}static parseMonth(e){var t=parseInt(e,10);if(!Number.isNaN(t))return t>=1&&t<=12?t-1:NaN;var r=e.trim().toLowerCase();if(r.length>=3){for(var i=0;i<j.months.length;i+=1)if(j.months[i].startsWith(r))return i}return NaN}static parseDateValues(e,t,r,i,a,o,s){var l=parseInt(e,10),u=t!=null?this.parseMonth(t):0,c=r!=null?parseInt(r,10):1,d=i!=null?parseInt(i,10):0,h=a!=null?parseInt(a,10):0,g=o!=null?parseInt(o,10):0,p=s!=null?parseInt(s.padEnd(9,"0"),10):0;return Number.isNaN(l)||Number.isNaN(u)||Number.isNaN(c)||Number.isNaN(d)||Number.isNaN(h)||Number.isNaN(g)||Number.isNaN(p)?null:{year:l,month:u,date:c,hours:d,minutes:h,seconds:g,nanos:p}}static parseDateTimeString(e){var t=/\s*(\d{4})([-./]([\da-z]+))?([-./](\d{1,2}))?([tT\s](\d{2})([:](\d{2}))?([:](\d{2}))?([.](\d{1,9}))?)?(.*)/,r=t.exec(e);if(r==null)throw new Error("Unexpected date string: ".concat(e));var[,i,,a,,o,,s,,l,,u,,c,d]=r;if(d!=null&&d.length>0)throw new Error("Unexpected characters after date string '".concat(e,"': ").concat(d));return{year:i,month:a,date:o,hours:s,minutes:l,seconds:u,nanos:c}}static parseDateRange(e,t,r){var i=t.trim().toLowerCase();if(i.length===0)throw new Error("Cannot parse date range from empty string");if(i==="null")return[null,null];if(i==="today"){var a=new Date(Date.now()),o=j.makeDateWrapper(e,r,a.getFullYear(),a.getMonth(),a.getDate()),s=new Date(a.getFullYear(),a.getMonth(),a.getDate()+1),l=j.makeDateWrapper(e,r,s.getFullYear(),s.getMonth(),s.getDate());return[o,l]}if(i==="yesterday"){var u=new Date(Date.now()),c=new Date(u.getFullYear(),u.getMonth(),u.getDate()-1),d=j.makeDateWrapper(e,r,c.getFullYear(),c.getMonth(),c.getDate()),h=j.makeDateWrapper(e,r,u.getFullYear(),u.getMonth(),u.getDate());return[d,h]}if(i==="now"){var g=new Date(Date.now()),p=e.DateWrapper.ofJsDate(g);return[p,null]}var y=j.parseDateTimeString(i);if(y.year==null&&y.month==null&&y.date==null)throw new Error("Unable to extract year, month, or day ".concat(i));var S=j.parseDateValues(y.year,y.month,y.date,y.hours,y.minutes,y.seconds,y.nanos);if(S==null)throw new Error("Unable to extract date values from ".concat(y));var T=j.makeDateWrapper(e,r,S.year,S.month,S.date,S.hours,S.minutes,S.seconds,S.nanos),w=j.getNextDate(e,y,S,r);return[T,w]}static getJsDate(e){return typeof e=="number"?new Date(e):e.asDate()}}Dt(j,"FULL_DATE_FORMAT","yyyy-MM-dd HH:mm:ss.SSSSSSSSS");Dt(j,"months",["january","february","march","april","may","june","july","august","september","october","november","december"]);function ji(n,e){return n===e?{operator:"notEq",value:""}:{operator:"eq",value:n}}function _i(n,e,t){return function(i){var a=t.trim();if(a==="")return null;var o=Ot(e,s=>s.filter().containsIgnoreCase(n.makeFilterValue(s.type,a)),"or");return o(i)}}function Ot(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"or";return function(i){var a=i==null?void 0:i.findColumns(typeof n=="string"?[n]:n);if(a==null||a.length===0)return null;var o=a.map(e);return o.reduce((s,l)=>s[t](l))}}function Vn(n,e,t,r){return Ot(e,i=>i.filter()[r](n.makeFilterValue(i.type,t)),"or")}function Vi(n,e,t,r,i){return function(o){var s=o==null?void 0:o.findColumn(e),l=t==="all"||r&&t.size===0;return s==null||l?null:n.makeSelectValueFilter(s,[...t.keys()],i)}}function $i(n){return function(t){return t.filter().isNull().not().and(t.filter().notEq(n.makeFilterValue(t.type,"")))}}function Hi(n,e){return function(r){var i=r.filter(),a=n.makeFilterValue(r.type,""),o=i.eq(a);return e?i.isNull().or(o):o.or(i.notEq(a))}}function We(n,e,t){return e=$n(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function $n(n){var e=Hn(n,"string");return typeof e=="symbol"?e:String(e)}function Hn(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class we{}We(we,"not","not");We(we,"and","and");We(we,"or","or");function Wi(n){if(!(n==="not"||n==="and"||n==="or"))throw new Error("operator is not a valid FilterOperatorValue")}function I(n,e,t){return e=Wn(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Wn(n){var e=Bn(n,"string");return typeof e=="symbol"?e:String(e)}function Bn(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class m{}I(m,"eq","eq");I(m,"eqIgnoreCase","eqIgnoreCase");I(m,"notEq","notEq");I(m,"notEqIgnoreCase","notEqIgnoreCase");I(m,"greaterThan","greaterThan");I(m,"greaterThanOrEqualTo","greaterThanOrEqualTo");I(m,"lessThan","lessThan");I(m,"lessThanOrEqualTo","lessThanOrEqualTo");I(m,"in","in");I(m,"inIgnoreCase","inIgnoreCase");I(m,"notIn","notIn");I(m,"notInIgnoreCase","notInIgnoreCase");I(m,"isTrue","isTrue");I(m,"isFalse","isFalse");I(m,"isNull","isNull");I(m,"invoke","invoke");I(m,"contains","contains");I(m,"notContains","notContains");I(m,"containsIgnoreCase","containsIgnoreCase");I(m,"startsWith","startsWith");I(m,"endsWith","endsWith");I(m,"containsAny","containsAny");var ut=G.module("ViewportDataUtils");function qn(n,e){return String(n.offsetInSnapshot+e)}function Bi(n,e){var{bulkUpdate:t}=n;return function(i){var{columns:a,offset:o,rows:s}=i.detail;ut.debug("table updated",i.detail);var l=new Map;s.forEach(u=>{var c=e(u,a),d=qn(u,o);l.set(d,{key:d,item:c})}),ut.debug("update keys",l),t(l)}}function qi(n,e){return e.reduce((t,r)=>(t[r.name]=n.get(r),t),{})}function*Ki(n,e){for(var t=n;t<=e;++t)yield{key:String(t)}}function Kn(n){return n==null||zn(n)?0:n.size}function zn(n){return"isClosed"in n?n.isClosed:!1}function zi(n,e,t,r){var i=n+e-1,[a,o]=[0,r-1],s=ze(n-t,a,o),l=ze(i+t,a,o);return[s,l]}function ct(n,e,t,r,i,a,o){try{var s=n[a](o),l=s.value}catch(u){t(u);return}s.done?e(l):Promise.resolve(l).then(r,i)}function oe(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){ct(a,r,i,o,s,"next",l)}function s(l){ct(a,r,i,o,s,"throw",l)}o(void 0)})}}function fe(n,e,t){return e=Gn(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Gn(n){var e=Yn(n,"string");return typeof e=="symbol"?e:String(e)}function Yn(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ie=G.module("TableUtils");class f{static copyTableAndApplyFilters(e){var t=arguments;return oe(function*(){if(e==null)return null;for(var r=yield e.copy(),i=t.length,a=new Array(i>1?i-1:0),o=1;o<i;o++)a[o-1]=t[o];return r.applyFilter(xe(...a.map(s=>s(r)))),r})()}static getSortIndex(e,t){for(var r=0;r<e.length;r+=1){var i,a=e[r];if(((i=a.column)===null||i===void 0?void 0:i.name)===t)return r}return null}static getSortForColumn(e,t){var r=f.getSortIndex(e,t);return r!=null?e[r]:null}static getFilterText(e){return e?e.toString():null}static getFilterTypes(e){return f.isBooleanType(e)?[m.isTrue,m.isFalse,m.isNull]:f.isCharType(e)||f.isNumberType(e)||f.isDateType(e)?[m.eq,m.notEq,m.greaterThan,m.greaterThanOrEqualTo,m.lessThan,m.lessThanOrEqualTo]:f.isTextType(e)?[m.eq,m.eqIgnoreCase,m.notEq,m.notEqIgnoreCase,m.contains,m.notContains,m.startsWith,m.endsWith]:[]}static getNextSort(e,t,r){if(r<0||r>=e.length)return null;var i=f.getSortForColumn(t,e[r].name);return i===null?e[r].sort().asc():i.direction===f.sortDirection.ascending?i.desc():null}static makeColumnSort(e,t,r,i){if(t<0||t>=e.length||r===f.sortDirection.none)return null;var a=e[t].sort();switch(r){case f.sortDirection.ascending:a=a.asc();break;case f.sortDirection.descending:a=a.desc();break}return i&&(a=a.abs()),a}static toggleSortForColumn(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(r<0||r>=t.length)return[];var a=f.getNextSort(t,e,r);return f.setSortForColumn(e,t[r].name,a,i)}static sortColumn(e,t,r,i,a,o){if(r<0||r>=t.length)return[];var s=f.makeColumnSort(t,r,i,a);return f.setSortForColumn(e,t[r].name,s,o)}static setSortForColumn(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,a=f.getSortIndex(e,t),o=[];return i&&(o=o.concat(e.filter(s=>{var{direction:l}=s;return l!==f.sortDirection.reverse})),a!==null&&o.splice(a,1)),r!==null&&o.push(r),o}static getNormalizedType(e){switch(e){case"boolean":case"java.lang.Boolean":case f.dataType.BOOLEAN:return f.dataType.BOOLEAN;case"char":case"java.lang.Character":case f.dataType.CHAR:return f.dataType.CHAR;case"java.lang.String":case f.dataType.STRING:return f.dataType.STRING;case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":case"java.time.Instant":case"java.time.ZonedDateTime":case f.dataType.DATETIME:return f.dataType.DATETIME;case"double":case"java.lang.Double":case"float":case"java.lang.Float":case"java.math.BigDecimal":case f.dataType.DECIMAL:return f.dataType.DECIMAL;case"int":case"java.lang.Integer":case"long":case"java.lang.Long":case"short":case"java.lang.Short":case"byte":case"java.lang.Byte":case"java.math.BigInteger":case f.dataType.INT:return f.dataType.INT;default:return f.dataType.UNKNOWN}}static isLongType(e){switch(e){case"long":case"java.lang.Long":return!0;default:return!1}}static isDateType(e){switch(e){case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"java.time.Instant":case"java.time.ZonedDateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":return!0;default:return!1}}static isNumberType(e){return f.isIntegerType(e)||f.isDecimalType(e)}static isIntegerType(e){switch(e){case"int":case"java.lang.Integer":case"java.math.BigInteger":case"long":case"java.lang.Long":case"short":case"java.lang.Short":case"byte":case"java.lang.Byte":return!0;default:return!1}}static isDecimalType(e){switch(e){case"double":case"java.lang.Double":case"java.math.BigDecimal":case"float":case"java.lang.Float":return!0;default:return!1}}static isBigDecimalType(e){switch(e){case"java.math.BigDecimal":return!0;default:return!1}}static isBigIntegerType(e){switch(e){case"java.math.BigInteger":return!0;default:return!1}}static isBooleanType(e){switch(e){case"boolean":case"java.lang.Boolean":return!0;default:return!1}}static isCharType(e){switch(e){case"char":case"java.lang.Character":return!0;default:return!1}}static isStringType(e){switch(e){case"java.lang.String":return!0;default:return!1}}static isTextType(e){return this.isStringType(e)||this.isCharType(e)}static getBaseType(e){return e.split("[]")[0]}static isCompatibleType(e,t){return f.getNormalizedType(e)===f.getNormalizedType(t)}static quoteValue(e){return e.length>=2&&(e.charAt(0)==='"'&&e.charAt(e.length-1)==='"'||e.charAt(0)==="'"&&e.charAt(e.length-1)==="'")?e:'"'.concat(e,'"')}static isRangeOperation(e){switch(e){case"<":case"<=":case"=<":case">":case">=":case"=>":return!0;default:return!1}}static makeRangeFilterWithOperation(e,t,r){switch(t){case"=":return e.eq(r);case"<":return e.lessThan(r);case"<=":case"=<":return e.lessThanOrEqualTo(r);case">":return e.greaterThan(r);case">=":case"=>":return e.greaterThanOrEqualTo(r);case"!=":case"!":return e.notEq(r);default:return null}}static makeCancelableTablePromise(e){return _e.makeCancelable(e,t=>{t.close()})}static makeCancelableTableEventPromise(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,a,o,s=!0,l=new Promise((u,c)=>{o=setTimeout(()=>{a(),s=!1,c(new Pt('Event "'.concat(t,'" timed out.')))},r),a=e.addEventListener(t,d=>{if(i!=null&&!i(d)){ie.debug2("Event triggered, but matcher returned false.");return}ie.debug2("Event triggered, resolving."),a(),clearTimeout(o),s=!1,u(d)})});return l.cancel=()=>{if(s){ie.debug2("Pending promise cleanup."),a(),clearTimeout(o),s=!1;return}ie.debug2("Ignoring non-pending promise cancel.")},l}static removeCommas(e){return e.replace(/[\s|,]/g,"")}static makeBooleanValue(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(e===""&&t)return null;switch(e==null?void 0:e.toLowerCase()){case"null":return null;case"0":case"f":case"fa":case"fal":case"fals":case"false":case"n":case"no":return!1;case"1":case"t":case"tr":case"tru":case"true":case"y":case"ye":case"yes":return!0;default:throw new Error("Invalid boolean '".concat(e,"'"))}}static makeNumberValue(e){if(e==="null"||e==="")return null;var t=e.toLowerCase().trim();if(t==="∞"||t==="infinity"||t==="inf")return Number.POSITIVE_INFINITY;if(t==="-∞"||t==="-infinity"||t==="-inf")return Number.NEGATIVE_INFINITY;var r=f.removeCommas(t);if(f.NUMBER_REGEX.test(r))return parseFloat(r);throw new Error("Invalid number '".concat(e,"'"))}static getFilterOperatorString(e){switch(e){case m.eq:return"=";case m.notEq:return"!=";case m.greaterThan:return">";case m.greaterThanOrEqualTo:return">=";case m.lessThan:return"<";case m.lessThanOrEqualTo:return"<=";case m.contains:return"~";case m.notContains:return"!~";default:throw new Error("Unexpected filter type ".concat(e))}}static isTreeTable(e){return e!=null&&e.expand!==void 0&&e.collapse!==void 0}static sortColumns(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return[...e].sort((r,i)=>{var a=r.name.toUpperCase(),o=i.name.toUpperCase();return Tr.sort(a,o,t)})}constructor(e){fe(this,"dh",void 0),this.dh=e,hr(this)}createDistinctSortedColumnTable(e,t,r){var i=arguments,a=this;return oe(function*(){if(e==null)return null;for(var o=e,s=i.length,l=new Array(s>3?s-3:0),u=3;u<s;u++)l[u-3]=i[u];l.length>0&&(o=yield e.copy(),yield o.applyFilter(xe(...l.map(g=>g(o)))));var c=o.findColumn(t),d=yield o.selectDistinct([c]);o!==e&&o.close();var h=d.findColumn(t).sort()[r]();return a.applySort(d,[h])})()}doesColumnValueExist(e,t,r,i){var a=this;return oe(function*(){if(e==null)return null;var o=Vn(a,t,r,i?"eq":"eqIgnoreCase"),s=yield e.copy();yield a.applyFilter(s,xe(o(s)));var l=Kn(s);return s.close(),l>0})()}makeQuickFilter(e,t,r){for(var i=t.split("||"),a=null,o=0;o<i.length;o+=1){for(var s=i[o],l=s.split("&&"),u=null,c=0;c<l.length;c+=1){var d=l[c].trim();if(d.length>0){var h=this.makeQuickFilterFromComponent(e,d,r);if(h)u?u=u.and(h):u=h;else throw new Error("Unable to parse quick filter from text ".concat(t))}}a&&u?a=a.or(u):a=u}return a}makeQuickFilterFromComponent(e,t,r){var{type:i}=e;return f.isNumberType(i)?this.makeQuickNumberFilter(e,t):f.isBooleanType(i)?this.makeQuickBooleanFilter(e,t):r!=null&&f.isDateType(i)?this.makeQuickDateFilter(e,t,r):f.isCharType(i)?this.makeQuickCharFilter(e,t):this.makeQuickTextFilter(e,t)}makeQuickNumberFilter(e,t){var r=e.filter(),{dh:i}=this,a=null,o=/\s*(>=|<=|=>|=<|>|<|!=|=|!)?(\s*-\s*)?(\s*\d*(?:,\d{3})*(?:\.\d*)?\s*)?(null|nan|infinity|inf|\u221E)?(.*)/i,s=o.exec(t),l=null,u=null,c=null,d=null,h=null;if(s!==null&&s.length>3&&([,l,u,c,d,h]=s),h!=null&&h.trim().length>0)return null;if(l==null&&(l="="),d!=null){if(!(l==="="||l==="!"||l==="!="))return null;switch(d=d.trim().toLowerCase(),d){case"null":a=r.isNull();break;case"nan":a=i.FilterCondition.invoke("isNaN",r);break;case"infinity":case"inf":case"∞":u!=null?a=i.FilterCondition.invoke("isInf",r).and(r.lessThan(i.FilterValue.ofNumber(0))):a=i.FilterCondition.invoke("isInf",r).and(r.greaterThan(i.FilterValue.ofNumber(0)));break}return a!==null&&(l==="!"||l==="!=")&&(a=a.not()),a}if(c==null)return null;if(c=f.removeCommas(c),f.isLongType(e.type))try{c=i.FilterValue.ofNumber(i.LongWrapper.ofString("".concat(u!=null?"-":"").concat(c)))}catch(g){return ie.warn("Unable to create long filter",g),null}else{if(c=parseFloat(c),c==null||Number.isNaN(c))return null;c=i.FilterValue.ofNumber(u!=null?0-c:c)}return a=e.filter(),f.makeRangeFilterWithOperation(a,l,c)}static escapeQuickTextFilter(e){var t,r;if(e==null)return null;var i=/^(!~|!=|~|=|!)?(.*)/,a=/^\\*null$/,o=i.exec(e),s=null,l=null;if(o!==null&&o.length>2&&([,s,l]=o),s!=null){var u;return"\\".concat(s).concat((u=l)!==null&&u!==void 0?u:"")}return l!=null&&a.test(l.toLowerCase())||l!=null&&l.startsWith("*")?"\\".concat(l):l!=null&&l.endsWith("*")&&!l.endsWith("\\*")?(l=l.substring(0,l.length-1),"".concat(l,"\\*")):"".concat((t=s)!==null&&t!==void 0?t:"").concat((r=l)!==null&&r!==void 0?r:"")}static unescapeQuickTextFilter(e){var t,r,i=/^(\\!~|\\!=|\\~|\\=|\\!)?(.*)/,a=/^\\*null$/,o=i.exec(e),s=null,l=null;return o!==null&&o.length>2&&([,s,l]=o),s!=null&&(s=s.replace("\\","")),l!=null&&a.test(l.toLowerCase())&&(l=l.replace("\\","")),s==null&&l!=null&&l.startsWith("\\*")&&(l=l.substring(1)),s==null&&l!=null&&l.endsWith("\\*")?(l=l.substring(0,l.length-2),"".concat(l,"*")):"".concat((t=s)!==null&&t!==void 0?t:"").concat((r=l)!==null&&r!==void 0?r:"")}makeQuickTextFilter(e,t){var{dh:r}=this,i="".concat(t).trim(),a=/^(!~|!=|~|=|!)?(.*)/,o=a.exec(i),s=null,l=null;if(o!==null&&o.length>2&&([,s,l]=o,l!=null&&(l=l.trim())),l==null||l.length===0&&!(s==="="||s==="!="))return null;s==null&&(s="=");var u=e.filter();if(l.toLowerCase()==="null")switch(s){case"=":return u.isNull();case"!=":case"!":return u.isNull().not()}var c=null,d=null;switch(l.startsWith("*")?(c="*",l=l.substring(1)):l.endsWith("*")&&!l.endsWith("\\*")&&(d="*",l=l.substring(0,l.length-1)),l=f.unescapeQuickTextFilter(l),s){case"~":return u.isNull().not().and(u.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E.*"))));case"!~":return u.isNull().or(u.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E.*"))).not());case"!=":return c==="*"?u.isNull().or(u.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E$"))).not()):d==="*"?u.isNull().or(u.invoke("matches",r.FilterValue.ofString("(?s)(?i)^\\Q".concat(l,"\\E.*"))).not()):u.notEqIgnoreCase(r.FilterValue.ofString(l.toLowerCase()));case"=":return c==="*"?u.isNull().not().and(u.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E$")))):d==="*"?u.isNull().not().and(u.invoke("matches",r.FilterValue.ofString("(?s)(?i)^\\Q".concat(l,"\\E.*")))):u.eqIgnoreCase(r.FilterValue.ofString(l.toLowerCase()))}return null}makeQuickBooleanFilter(e,t){var r=/^(!=|=|!)?(.*)/,i=r.exec("".concat(t).trim());if(i===null)return null;var[,a,o]=i,s=a==="!"||a==="!=",l=o.trim().toLowerCase(),u=e.filter();try{var c=f.makeBooleanValue(l);return c!=null&&c?u=u.isTrue():c===null?u=u.isNull():u=u.isFalse(),s?u.not():u}catch{return null}}makeQuickDateFilter(e,t,r){var i=t.trim(),a=/\s*(>=|<=|=>|=<|>|<|!=|!|=)?(.*)/,o=a.exec(i);if(o==null||o.length<=2)throw new Error("Unable to parse date filter: ".concat(t));var s=null,l=null;[,s,l]=o;var u=m.eq;switch(s){case"<":u=m.lessThan;break;case"<=":case"=<":u=m.lessThanOrEqualTo;break;case">":u=m.greaterThan;break;case">=":case"=>":u=m.greaterThanOrEqualTo;break;case"!=":case"!":u=m.notEq;break;case"=":case"==":default:u=m.eq;break}return this.makeQuickDateFilterWithOperation(e,l,u,r)}makeQuickDateFilterWithOperation(e,t,r,i){var{dh:a}=this,[o,s]=j.parseDateRange(a,t,i),l=o!=null?a.FilterValue.ofNumber(o):null,u=s!=null?a.FilterValue.ofNumber(s):null,c=e.filter();if(l==null)return r===m.notEq?c.isNull().not():c.isNull();switch(r){case m.eq:{if(u!=null){var d=c.greaterThanOrEqualTo(l),h=c.lessThan(u);return d.and(h)}return c.eq(l)}case m.lessThan:return c.lessThan(l);case m.lessThanOrEqualTo:return u!=null?c.lessThan(u):c.lessThanOrEqualTo(l);case m.greaterThan:return u!=null?c.greaterThanOrEqualTo(u):c.greaterThan(l);case m.greaterThanOrEqualTo:return c.greaterThanOrEqualTo(l);case m.notEq:{if(u!=null){var g=c.lessThan(l),p=c.greaterThanOrEqualTo(u);return g.or(p)}return c.notEq(l)}default:throw new Error("Invalid operator: ".concat(r))}}makeQuickCharFilter(e,t){var{dh:r}=this,i="".concat(t).trim(),a=/^(>=|<=|=>|=<|>|<|!=|=|!)?(null|"."|'.'|.)?(.*)/,o=a.exec(i),s=null,l=null,u=null;if(o!==null&&o.length>3&&([,s,l,u]=o),u!=null&&u.trim().length>0||l==null||l.length===0)return null;s==null&&(s="=");var c=e.filter();if(l.toLowerCase()==="null")switch(s){case"=":return c.isNull();case"!=":case"!":return c.isNull().not();default:return null}var d=r.FilterValue.ofString(f.isRangeOperation(s)?f.quoteValue(l):l);return f.makeRangeFilterWithOperation(c,s,d)}makeAdvancedFilter(e,t,r){for(var{filterItems:i,filterOperators:a,invertSelection:o,selectedValues:s}=t,l=null,u=0;u<i.length;u+=1){var c=i[u],{selectedType:d,value:h}=c;if(d!=null&&d.length>0&&h!=null&&h.length>0)try{var g=this.makeAdvancedValueFilter(e,d,h,r);if(g!=null){if(u===0)l=g;else if(l!==null&&u-1<a.length){var p=a[u-1];if(p===we.and)l=l.and(g);else if(p===we.or)l=l.or(g);else{ie.error("Unexpected filter operator",p,g),l=null;break}}}else ie.debug2("Empty filter ignored for",d,h)}catch(S){ie.error("Unable to create filter",S),l=null;break}}var y=this.makeSelectValueFilter(e,s,o);return y!=null&&(l!=null?l=l.and(y):l=y),l}makeAdvancedValueFilter(e,t,r,i){var{dh:a}=this;if(f.isDateType(e.type))return this.makeQuickDateFilterWithOperation(e,r,t,i);if(f.isNumberType(e.type)||f.isCharType(e.type))return this.makeQuickFilter(e,"".concat(f.getFilterOperatorString(t)).concat(r));var o=this.makeFilterValue(e.type,r),s=e.filter();switch(t){case m.eq:return s.eq(o);case m.eqIgnoreCase:return s.eqIgnoreCase(o);case m.notEq:return s.notEq(o);case m.notEqIgnoreCase:return s.notEqIgnoreCase(o);case m.greaterThan:return s.greaterThan(o);case m.greaterThanOrEqualTo:return s.greaterThanOrEqualTo(o);case m.lessThan:return s.lessThan(o);case m.lessThanOrEqualTo:return s.lessThanOrEqualTo(o);case m.isTrue:return s.isTrue();case m.isFalse:return s.isFalse();case m.isNull:return s.isNull();case m.contains:return s.isNull().not().and(s.invoke("matches",a.FilterValue.ofString("(?s)(?i).*\\Q".concat(r,"\\E.*"))));case m.notContains:return s.isNull().or(s.invoke("matches",a.FilterValue.ofString("(?s)(?i).*\\Q".concat(r,"\\E.*"))).not());case m.startsWith:return s.isNull().not().and(s.invoke("matches",a.FilterValue.ofString("(?s)(?i)^\\Q".concat(r,"\\E.*"))));case m.endsWith:return s.isNull().not().and(s.invoke("matches",a.FilterValue.ofString("(?s)(?i).*\\Q".concat(r,"\\E$"))));case m.in:case m.inIgnoreCase:case m.notIn:case m.notInIgnoreCase:case m.invoke:default:throw new Error("Unexpected filter operation: ".concat(t))}}applyNeverFilter(e,t){var r=arguments,i=this;return oe(function*(){var a=r.length>2&&r[2]!==void 0?r[2]:f.APPLY_TABLE_CHANGE_TIMEOUT_MS;if(e==null)return null;var o=e.findColumn(t),s=[i.makeNeverFilter(o)];return yield i.applyFilter(e,s,a),e})()}applyCustomColumns(e,t){var r=arguments,i=this;return oe(function*(){var a=r.length>2&&r[2]!==void 0?r[2]:f.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:o}=i;return f.executeAndWaitForEvent(s=>s==null?void 0:s.applyCustomColumns(t),e,o.Table.EVENT_CUSTOMCOLUMNSCHANGED,a)})()}applyFilter(e,t){var r=arguments,i=this;return oe(function*(){var a=r.length>2&&r[2]!==void 0?r[2]:f.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:o}=i;return f.executeAndWaitForEvent(s=>s==null?void 0:s.applyFilter(t),e,o.Table.EVENT_FILTERCHANGED,a)})()}applySort(e,t){var r=arguments,i=this;return oe(function*(){var a=r.length>2&&r[2]!==void 0?r[2]:f.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:o}=i;return f.executeAndWaitForEvent(s=>s==null?void 0:s.applySort(t),e,o.Table.EVENT_SORTCHANGED,a)})()}makeNeverFilter(e){var{dh:t}=this,r=null;f.isTextType(e.type)?r=t.FilterValue.ofString("a"):f.isBooleanType(e.type)?r=t.FilterValue.ofBoolean(!0):f.isDateType(e.type)?r=t.FilterValue.ofNumber(t.DateWrapper.ofJsDate(new Date)):r=t.FilterValue.ofNumber(0);var i=e.filter().eq(r),a=e.filter().notEq(r);return i.and(a)}makeFilterValue(e,t){var{dh:r}=this,i=f.getBaseType(e);return f.isTextType(i)?r.FilterValue.ofString(t):f.isLongType(i)?r.FilterValue.ofNumber(r.LongWrapper.ofString(f.removeCommas(t))):r.FilterValue.ofNumber(f.removeCommas(t))}makeFilterRawValue(e,t){var{dh:r}=this;return f.isTextType(e)?r.FilterValue.ofString(t):f.isBooleanType(e)?r.FilterValue.ofBoolean(t):r.FilterValue.ofNumber(t)}makeValue(e,t,r){var{dh:i}=this;if(t==="null")return null;if(f.isTextType(e))return t;if(f.isLongType(e))return i.LongWrapper.ofString(f.removeCommas(t));if(f.isBooleanType(e))return f.makeBooleanValue(t,!0);if(f.isDateType(e)){var[a]=j.parseDateRange(i,t,r);return a}return f.isNumberType(e)?f.makeNumberValue(t):(ie.error("Unexpected column type",e),null)}makeSelectValueFilter(e,t,r){var{dh:i}=this;if(t.length===0)return r?null:this.makeNeverFilter(e);for(var a=[],o=!1,s=0;s<t.length;s+=1){var l=t[s];l==null?o=!0:f.isTextType(e.type)?a.push(i.FilterValue.ofString(typeof l=="number"?String.fromCharCode(l):l)):f.isBooleanType(e.type)?a.push(i.FilterValue.ofBoolean(!!l)):a.push(i.FilterValue.ofNumber(l))}return o?a.length>0?r?e.filter().isNull().not().and(e.filter().notIn(a)):e.filter().isNull().or(e.filter().in(a)):r?e.filter().isNull().not():e.filter().isNull():r?e.filter().notIn(a):e.filter().in(a)}}fe(f,"dataType",{BOOLEAN:"boolean",CHAR:"char",DATETIME:"datetime",DECIMAL:"decimal",INT:"int",STRING:"string",UNKNOWN:"unknown"});fe(f,"sortDirection",{ascending:"ASC",descending:"DESC",reverse:"REVERSE",none:null});fe(f,"APPLY_TABLE_CHANGE_TIMEOUT_MS",3e4);fe(f,"REVERSE_TYPE",Object.freeze({NONE:"none",PRE_SORT:"pre-sort",POST_SORT:"post-sort"}));fe(f,"NUMBER_REGEX",/^-?\d+(\.\d+)?$/);fe(f,"executeAndWaitForEvent",function(){var n=oe(function*(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:f.APPLY_TABLE_CHANGE_TIMEOUT_MS;if(t==null)return null;var a=f.makeCancelableTableEventPromise(t,r,i);return e(t),yield a,t});return function(e,t,r){return n.apply(this,arguments)}}());function De(n,e,t){return e=Xn(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Xn(n){var e=Zn(n,"string");return typeof e=="symbol"?e:String(e)}function Zn(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Be{static makeColumnFormatMap(e){return e==null?new Map:e.reduce((t,r)=>{var i=f.getNormalizedType(r.columnType);if(i===null)return t;t.has(i)||t.set(i,new Map);var a=t.get(i);return a==null||a.set(r.columnName,r.format),t},new Map)}static makeColumnFormattingRule(e,t,r){return{columnType:e,columnName:t,format:r}}constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!1;De(this,"defaultColumnFormatter",void 0),De(this,"typeFormatterMap",void 0),De(this,"columnFormatMap",void 0),De(this,"truncateNumbersWithPound",void 0),this.defaultColumnFormatter=new In,this.typeFormatterMap=new Map([[f.dataType.BOOLEAN,new wn],[f.dataType.CHAR,new Fn],[f.dataType.DATETIME,new ee(e,r)],[f.dataType.DECIMAL,new R(e,i)],[f.dataType.INT,new te(e,a)],[f.dataType.STRING,new kn]]),this.columnFormatMap=Be.makeColumnFormatMap(t),this.truncateNumbersWithPound=o}getColumnFormatMapForType(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=f.getNormalizedType(e);if(r!==null)return t&&!this.columnFormatMap.has(r)&&this.columnFormatMap.set(r,new Map),this.columnFormatMap.get(r)}getColumnFormat(e,t){var r,i=this.getColumnFormatMapForType(e);return(r=i==null?void 0:i.get(t))!==null&&r!==void 0?r:null}getColumnTypeFormatter(e){var t=f.getNormalizedType(e),r=this.defaultColumnFormatter;if(t){var i;r=(i=this.typeFormatterMap.get(t))!==null&&i!==void 0?i:r}return r}getFormattedString(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",i=arguments.length>3?arguments[3]:void 0;if(e==null)return"";var a=this.getColumnTypeFormatter(t),o=i||this.getColumnFormat(t,r);return a.format(e,o??void 0)}get timeZone(){var e,t=this.typeFormatterMap.get(f.dataType.DATETIME);return t==null||(e=t.dhTimeZone)===null||e===void 0?void 0:e.id}}function Qn(n){if(n&&n.formatter){var{formatter:e}=n;return e}}function Un(n){return{timeZone:n==null?void 0:n.timeZone,defaultDateTimeFormatString:n==null?void 0:n.defaultDateTimeFormat,showTimeZone:n==null?void 0:n.showTimeZone,showTSeparator:n==null?void 0:n.showTSeparator}}function Jn(n,e,t){var r=n.getColumnFormat(t,e);return r!=null&&(r.type===B.TYPE_CONTEXT_PRESET||r.type===B.TYPE_CONTEXT_CUSTOM)}const Le={getColumnFormats:Qn,getDateTimeFormatterOptions:Un,isCustomColumnFormatDefined:Jn},ei=typeof Ie=="function"?Ie:Ie.default;wt.register([rr,nr,ir,ar,or,sr]);function q(n,e,t){return e=ti(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ti(n){var e=ri(n,"string");return typeof e=="symbol"?e:String(e)}function ri(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class L{constructor(e){q(this,"dh",void 0),q(this,"listeners",void 0),q(this,"formatter",void 0),q(this,"rect",void 0),q(this,"isDownsamplingDisabled",void 0),q(this,"title",void 0),this.dh=e,this.listeners=[],this.isDownsamplingDisabled=!1}getData(){return[]}getDefaultTitle(){return""}getLayout(){return{}}getFilterColumnMap(){return new Map}isFilterRequired(){return!1}setFilter(e){}close(){}setFormatter(e){this.formatter=e}setDownsamplingDisabled(e){this.isDownsamplingDisabled=e}setDimensions(e){this.rect=e}setTitle(e){this.title=e}subscribe(e){this.listeners.push(e)}unsubscribe(e){this.listeners=this.listeners.filter(t=>t!==e)}fireEvent(e){for(var t=0;t<this.listeners.length;t+=1)this.listeners[t](e)}fireUpdate(e){this.fireEvent(new CustomEvent(L.EVENT_UPDATED,{detail:e}))}fireDisconnect(){this.fireEvent(new CustomEvent(L.EVENT_DISCONNECT))}fireReconnect(){this.fireEvent(new CustomEvent(L.EVENT_RECONNECT))}fireDownsampleStart(e){this.fireEvent(new CustomEvent(L.EVENT_DOWNSAMPLESTARTED,{detail:e}))}fireDownsampleFinish(e){this.fireEvent(new CustomEvent(L.EVENT_DOWNSAMPLEFINISHED,{detail:e}))}fireDownsampleFail(e){this.fireEvent(new CustomEvent(L.EVENT_DOWNSAMPLEFAILED,{detail:e}))}fireDownsampleNeeded(e){this.fireEvent(new CustomEvent(L.EVENT_DOWNSAMPLENEEDED,{detail:e}))}fireLoadFinished(){this.fireEvent(new CustomEvent(L.EVENT_LOADFINISHED))}fireError(e){this.fireEvent(new CustomEvent(L.EVENT_ERROR,{detail:e}))}}q(L,"EVENT_UPDATED","ChartModel.EVENT_UPDATED");q(L,"EVENT_DISCONNECT","ChartModel.EVENT_DISCONNECT");q(L,"EVENT_RECONNECT","ChartModel.EVENT_RECONNECT");q(L,"EVENT_DOWNSAMPLESTARTED","ChartModel.EVENT_DOWNSAMPLESTARTED");q(L,"EVENT_DOWNSAMPLEFINISHED","ChartModel.EVENT_DOWNSAMPLEFINISHED");q(L,"EVENT_DOWNSAMPLEFAILED","ChartModel.EVENT_DOWNSAMPLEFAILED");q(L,"EVENT_DOWNSAMPLENEEDED","ChartModel.EVENT_DOWNSAMPLENEEDED");q(L,"EVENT_LOADFINISHED","ChartModel.EVENT_LOADFINISHED");q(L,"EVENT_ERROR","ChartModel.EVENT_ERROR");const J=L;function dt(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function me(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?dt(Object(t),!0).forEach(function(r){H(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):dt(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function H(n,e,t){return e=ni(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ni(n){var e=ii(n,"string");return typeof e=="symbol"?e:String(e)}function ii(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Se=G.module("ChartUtils"),ht="io.deephaven.time.DateTime",ai=36e5,oi=1e6;function si(n){return n.asDate!==void 0}function li(n){return n.asNumber!==void 0}function ft(n){return n.dhTimeZone!==void 0}function ui(n){return n!=null&&n.range!=null&&(n.autorange===!1||n.autorange===void 0)}class v{static getPlotlyErrorBars(e,t,r,i){var a=r.map((s,l)=>s-e[l]),o=t.map((s,l)=>e[l]-s);return{type:"data",symmetric:!1,array:a,arrayminus:o,color:i.error_band_line_color}}static convertNumberPrefix(e){return e.replace(/\u00A4\u00A4/g,"USD").replace(/\u00A4/g,"$")}static getPlotlyNumberFormat(e,t,r){if(!r)return null;var i=r.split(";"),a=i[0].match(/^([^#,0.]*)([#,]*)([0,]*)(\.?)(0*)(#*)(E?0*)(%?)(.*)/);Ee(a);var[,o,s,l,,u,c,d,h,g]=a,p=l.replace(",","").length,y=s.indexOf(",")>=0||l.indexOf(",")>=0,S=y?",":"",T=d!=null&&d!==""?"e":"f",w=h!==""?h:T,b=u.length+c.length,P="",F="0".concat(p).concat(S,".").concat(b).concat(P).concat(w),V=v.convertNumberPrefix(o),N=v.convertNumberPrefix(g);return{tickformat:F,tickprefix:V,ticksuffix:N,automargin:!0}}static addTickSpacing(e,t,r){var{gapBetweenMajorTicks:i}=t;if(i>0){var a=e||{},o=i;return r&&(o=i/oi),t.log&&(o=Math.log(o)),a.tickmode="linear",a.dtick=o,a}return e}static getSourceForAxis(e,t){for(var r=0;r<e.series.length;r+=1)for(var i=e.series[r],a=0;a<i.sources.length;a+=1){var o=i.sources[a];if(o.axis===t)return o}return null}static getSeriesVisibility(e,t){return t!=null&&t.hiddenSeries!=null&&t.hiddenSeries.includes(e)?"legendonly":!0}static getHiddenLabels(e){return e!=null&&e.hiddenSeries?[...e.hiddenSeries]:[]}static makeSeriesData(e,t,r,i){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:v.ORIENTATION.VERTICAL;return{type:e,mode:t,name:r,orientation:a,showlegend:i??void 0}}static getMarkerSymbol(e){switch(e){case"SQUARE":return"square";case"CIRCLE":return"circle";case"DIAMOND":return"diamond";case"UP_TRIANGLE":return"triangle-up";case"DOWN_TRIANGLE":return"triangle-down";case"RIGHT_TRIANGLE":return"triangle-right";case"LEFT_TRIANGLE":return"triangle-left";case"ELLIPSE":case"HORIZONTAL_RECTANGLE":case"VERTICAL_RECTANGLE":default:throw new Error("Unrecognized shape ".concat(e))}}static getAllAxes(e){return e.charts.reduce((t,r)=>[...t,...r.axes],[])}static getAxisTypeMap(e){var t=v.getAllAxes(e);return v.groupArray(t,"type")}static getChartForSeries(e,t){for(var{charts:r}=e,i=0;i<r.length;i+=1)for(var a=r[i],o=0;o<a.series.length;o+=1)if(t===a.series[o])return a;return null}static getLayoutRanges(e){for(var t={},r=Object.keys(e).filter(s=>s.indexOf("axis")>=0),i=0;i<r.length;i+=1){var a=r[i],o=e[a];ui(o)&&(t[a]=[...o.range])}return t}static getAxisLayoutProperty(e,t){var r=t>0?"".concat(t+1):"";return"".concat(e??"","axis").concat(r)}static periodToDecimal(e){var t=e.split(":");return Number(t[0])+Number(t[1])/60}static groupArray(e,t){return e.reduce((r,i)=>{var a,o=i[t],s=(a=r.get(o))!==null&&a!==void 0?a:[];return s.push(i),r.set(o,s),r},new Map)}static getColorwayFromTheme(e){var t=[];return e.colorway&&(Array.isArray(e.colorway)?t=e.colorway:typeof e.colorway=="string"?t=e.colorway.split(" "):Se.warn("Unable to handle colorway property: ".concat(e.colorway))),t}static titleFromSettings(e){var{series:t,xAxis:r,title:i="".concat((t??[]).join(", ")," by ").concat(r)}=e;return i}constructor(e){H(this,"dh",void 0),H(this,"daysOfWeek",void 0),this.dh=e,this.daysOfWeek=Object.freeze(e.calendar.DayOfWeek.values())}getAxisFormats(e,t){for(var r=this,i=new Map,a={tickformat:null,ticksuffix:null},o=v.getAllAxes(e),s=v.groupArray(o,"type"),{charts:l}=e,u=0;u<l.length;u+=1)for(var c=l[u],d=0;d<c.series.length;d+=1)for(var h=c.series[d],{sources:g}=h,p=g.filter(w=>w.axis),y=function(){var b=p[S],{axis:P}=b,{type:F}=P,V=s.get(F);Ee(V);var N=V.indexOf(P),D=r.getAxisPropertyName(F);if(D!=null){var M=v.getAxisLayoutProperty(D,N);if(i.has(M))Se.debug("".concat(M," already added."));else{Se.debug("Adding ".concat(M," to axisFormats."));var k=r.getPlotlyAxisFormat(b,t);if(k===null)i.set(M,a);else{i.set(M,k);var{businessCalendar:Z}=P;if(Z!=null){var K=[],{businessPeriods:ne,businessDays:Q,holidays:U,timeZone:de}=Z,ve=t==null?void 0:t.getColumnTypeFormatter(ht),Pe;ft(ve)&&(Pe=ve.dhTimeZone);var Ke=Pe?(de.standardOffset-Pe.standardOffset)/60:0;U.length>0&&K.push(...r.createRangeBreakValuesFromHolidays(U,de,Pe)),ne.forEach(Fe=>K.push({pattern:"hour",bounds:[v.periodToDecimal(Fe.close)+Ke,v.periodToDecimal(Fe.open)+Ke]})),Q.length<r.daysOfWeek.length&&r.createBoundsFromDays(Q).forEach(Fe=>K.push({pattern:"day of week",bounds:Fe})),k.rangebreaks=K}if(i.size===c.axes.length)return{v:i}}}}},S=0;S<p.length;S+=1){var T=y();if(typeof T=="object")return T.v}return i}getPlotlyChartType(e,t){var{dh:r}=this;switch(e){case r.plot.SeriesPlotStyle.SCATTER:return t?"scatter":"scattergl";case r.plot.SeriesPlotStyle.LINE:return"scatter";case r.plot.SeriesPlotStyle.BAR:case r.plot.SeriesPlotStyle.STACKED_BAR:return"bar";case r.plot.SeriesPlotStyle.PIE:return"pie";case r.plot.SeriesPlotStyle.TREEMAP:return"treemap";case r.plot.SeriesPlotStyle.HISTOGRAM:return"histogram";case r.plot.SeriesPlotStyle.OHLC:return"ohlc";default:return}}getPlotlyChartMode(e,t,r){var{dh:i}=this,a=new Set;switch(e){case i.plot.SeriesPlotStyle.SCATTER:(t??!1)&&a.add(v.MODE_LINES),(r??!0)&&a.add(v.MODE_MARKERS);break;case i.plot.SeriesPlotStyle.LINE:(t??!0)&&a.add(v.MODE_LINES),(r??!1)&&a.add(v.MODE_MARKERS);break}return a.size>0?[...a].join("+"):void 0}getPlotlyProperty(e,t){var{dh:r}=this;switch(e){case r.plot.SeriesPlotStyle.PIE:switch(t){case r.plot.SourceType.X:return"labels";case r.plot.SourceType.Y:return"values"}break;case r.plot.SeriesPlotStyle.OHLC:switch(t){case r.plot.SourceType.TIME:return"x"}break;case r.plot.SeriesPlotStyle.TREEMAP:switch(t){case r.plot.SourceType.X:return"ids";case r.plot.SourceType.Y:return"values";case r.plot.SourceType.LABEL:return"labels";case r.plot.SourceType.PARENT:return"parents";case r.plot.SourceType.COLOR:return"marker.colors"}break}switch(t){case r.plot.SourceType.X:return"x";case r.plot.SourceType.Y:return"y";case r.plot.SourceType.Z:return"z";case r.plot.SourceType.X_LOW:return"xLow";case r.plot.SourceType.X_HIGH:return"xHigh";case r.plot.SourceType.Y_LOW:return"yLow";case r.plot.SourceType.Y_HIGH:return"yHigh";case r.plot.SourceType.TIME:return"time";case r.plot.SourceType.OPEN:return"open";case r.plot.SourceType.HIGH:return"high";case r.plot.SourceType.LOW:return"low";case r.plot.SourceType.CLOSE:return"close";case r.plot.SourceType.SHAPE:return"shape";case r.plot.SourceType.SIZE:return"size";case r.plot.SourceType.LABEL:return"label";case r.plot.SourceType.COLOR:return"color";case r.plot.SourceType.PARENT:return"parent";case r.plot.SourceType.HOVER_TEXT:return"hovertext";case r.plot.SourceType.TEXT:return"text";default:throw new Error("Unrecognized source type: ".concat(t))}}getPlotlySeriesOrientation(e){var t,r,{dh:i}=this,{sources:a}=e;return a.length===2&&((t=a[0])===null||t===void 0||(r=t.axis)===null||r===void 0?void 0:r.type)===i.plot.AxisType.Y?v.ORIENTATION.HORIZONTAL:v.ORIENTATION.VERTICAL}makeSeriesDataFromSeries(e,t,r,i){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:null,{name:o,isLinesVisible:s,isShapesVisible:l,plotStyle:u,lineColor:c,shapeColor:d,sources:h,shape:g,shapeSize:p}=e,y=h.some(P=>{var F;return(F=P.axis)===null||F===void 0?void 0:F.businessCalendar}),S=this.getChartType(u,y),T=this.getPlotlyChartMode(u,s??void 0,l??void 0),w=this.getPlotlySeriesOrientation(e),b=v.makeSeriesData(S,T,o,a,w);return this.addSourcesToSeriesData(b,u,h,t),this.addStylingToSeriesData(b,u,i,c,d,g,p,r),b}addSourcesToSeriesData(e,t,r,i){for(var a=e,o=0;o<r.length;o+=1){var s=r[o],{axis:l,type:u}=s,c=this.getPlotlyProperty(t,u);bt(a,c,[]);var d=l!=null?this.getAxisPropertyName(l.type):null;if(d!=null){var h=i.get(l.type);if(h){var g=h.indexOf(l),p=g>0?"".concat(g+1):"";a["".concat(d,"axis")]="".concat(d).concat(p)}}}}addStylingToSeriesData(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:null,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null,s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:null,l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:null,{dh:u}=this,c=e;if(c.marker={line:{}},c.line={width:1},t===u.plot.SeriesPlotStyle.AREA?c.fill="tozeroy":t===u.plot.SeriesPlotStyle.STACKED_AREA?c.stackgroup="stack":t===u.plot.SeriesPlotStyle.STEP?c.line.shape="hv":t===u.plot.SeriesPlotStyle.HISTOGRAM?(c.width=[],c.marker.line!==void 0&&Object.assign(c.marker.line,{color:r.paper_bgcolor,width:1})):t===u.plot.SeriesPlotStyle.OHLC?(c.increasing={line:{color:r.ohlc_increasing}},c.decreasing={line:{color:r.ohlc_decreasing}}):t===u.plot.SeriesPlotStyle.PIE?(c.textinfo="label+percent",c.outsidetextfont={color:r.title_color}):t===u.plot.SeriesPlotStyle.TREEMAP&&(c.hoverinfo="text",c.textinfo="label+text",c.tiling={packing:"squarify",pad:0},c.textposition="middle center",c.outsidetextfont={color:r.title_color}),i!=null&&(t===u.plot.SeriesPlotStyle.BAR?c.marker.color=i:c.line.color=i),a!=null&&(c.marker.color=a),o!=null&&o.length>0)try{c.marker.symbol=v.getMarkerSymbol(o)}catch(d){Se.warn("Unable to handle shape",o,":",d)}s!=null&&(c.marker.size=s*v.DEFAULT_MARKER_SIZE),l!=null&&t!==u.plot.SeriesPlotStyle.PIE&&(c.visible=l)}getChartType(e,t){var{dh:r}=this;switch(e){case r.plot.SeriesPlotStyle.HISTOGRAM:return"bar";default:return this.getPlotlyChartType(e,t)}}getAxisPropertyName(e){var{dh:t}=this;switch(e){case t.plot.AxisType.X:return"x";case t.plot.AxisType.Y:return"y";default:return null}}getAxisSide(e){var{dh:t}=this;switch(e){case t.plot.AxisPosition.BOTTOM:return"bottom";case t.plot.AxisPosition.TOP:return"top";case t.plot.AxisPosition.LEFT:return"left";case t.plot.AxisPosition.RIGHT:return"right";default:return}}updateFigureAxes(e,t,r,i){for(var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0,s=e,l=v.getAllAxes(t),u=0;u<t.charts.length;u+=1){var c=t.charts[u],d=i==null?void 0:i(c),h=this.getChartBounds(t,c,a,o);this.updateLayoutAxes(s,c.axes,l,r,a,o,h,d)}this.removeStaleAxes(s,l)}getChartBounds(e,t,r,i){var a,{dh:o}=this,{cols:s,rows:l}=e,{column:u,colspan:c,row:d,rowspan:h}=t,g=u+c,p=d+h,y=1/s,S=1/l,T=v.AXIS_SIZE_PX/r,w=v.AXIS_SIZE_PX/i,b={bottom:(l-p)*S+(p<l?w/2:0),top:(l-d)*S-(d>0?w/2:0),left:u*y+(u>0?T/2:0),right:g*y-(g<s?T/2:0)},P=v.groupArray(t.axes,"position"),F=(a=P.get(o.plot.AxisPosition.RIGHT))!==null&&a!==void 0?a:[];return F.length>0&&(r>0?b.right-=(b.right-b.left)*Math.max(0,Math.min(v.LEGEND_WIDTH_PX/r,v.MAX_LEGEND_SIZE)):b.right-=(b.right-b.left)*v.DEFAULT_AXIS_SIZE),b}getPlotlyDateFormat(e,t,r){var{dh:i}=this,a=r==null?void 0:r.replace("%","%%").replace(/S{9}/g,"%9f").replace(/S{8}/g,"%8f").replace(/S{7}/g,"%7f").replace(/S{6}/g,"%6f").replace(/S{5}/g,"%5f").replace(/S{4}/g,"%4f").replace(/S{3}/g,"%3f").replace(/S{2}/g,"%2f").replace(/S{1}/g,"%1f").replace(/y{4}/g,"%Y").replace(/y{2}/g,"%y").replace(/M{4}/g,"%B").replace(/M{3}/g,"%b").replace(/M{2}/g,"%m").replace(/M{1}/g,"%-m").replace(/E{4,}/g,"%A").replace(/E{1,}/g,"%a").replace(/d{2}/g,"%d").replace(/([^%]|^)d{1}/g,"$1%-d").replace(/H{2}/g,"%H").replace(/h{2}/g,"%I").replace(/h{1}/g,"%-I").replace(/m{2}/g,"%M").replace(/s{2}/g,"%S").replace("'T'","T").replace(" z",""),o,s=e==null?void 0:e.getColumnTypeFormatter(t);return s!=null&&ft(s)&&s.dhTimeZone!=null&&s.showTimeZone&&(o=i.i18n.DateTimeFormat.format(" z",new Date,s.dhTimeZone)),{tickformat:a,ticksuffix:o,automargin:!0}}getPlotlyAxisFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,{dh:r}=this,{axis:i,columnType:a}=e,{formatPattern:o}=i,s=null;return f.isDateType(a)?(s=this.getPlotlyDateFormat(t,a,o),s=v.addTickSpacing(s,i,!0)):f.isNumberType(a)&&(s=v.getPlotlyNumberFormat(t,a,o),s=v.addTickSpacing(s,i,!1)),i.formatType===r.plot.AxisFormatType.CATEGORY&&(s?s.type="category":s={type:"category",tickformat:void 0,ticksuffix:void 0}),s}updateLayoutAxes(e,t,r,i){for(var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0,s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:{left:0,top:0,right:1,bottom:1},l=arguments.length>7?arguments[7]:void 0,{dh:u}=this,c=a>0?Math.max(v.MIN_AXIS_SIZE,Math.min(v.AXIS_SIZE_PX/o,v.MAX_AXIS_SIZE)):v.DEFAULT_AXIS_SIZE,d=o>0?Math.max(v.MIN_AXIS_SIZE,Math.min(v.AXIS_SIZE_PX/a,v.MAX_AXIS_SIZE)):v.DEFAULT_AXIS_SIZE,h=e,g=v.groupArray(t,"position"),p=v.groupArray(t,"type"),y=[...p.keys()],S=v.groupArray(r,"type"),T=0;T<y.length;T+=1){var w=y[T],b=this.getAxisPropertyName(w);if(b!=null){var P=p.get(w),F=S.get(w),V=w===u.plot.AxisType.Y,N=V?o:a;Ee(P),Ee(F);for(var D=0;D<P.length;D+=1){var M=P[D],k=F.indexOf(M),Z=v.getAxisLayoutProperty(b,k);h[Z]==null&&(h[Z]=this.makeLayoutAxis(w,i));var K=h[Z];if(K!=null){this.updateLayoutAxis(K,M,D,g,c,d,s);var{range:ne,autorange:Q}=K;if(l!=null&&ne!==void 0&&(Q===void 0||Q===!1)){var U=l(M),[de,ve]=U(ne);Se.debug("Setting downsample range",N,de,ve),M.range(N,de,ve)}else M.range(N)}}}}}removeStaleAxes(e,t){for(var r=e,i=v.groupArray(t,"type"),a=[...i.keys()],o=0;o<a.length;o+=1){var s=a[o],l=i.get(s);Ee(l);var u=l.length,c=this.getAxisPropertyName(s);if(c!=null)for(var d=v.getAxisLayoutProperty(c,u);r[d]!=null;)delete r[d],u+=1,d=v.getAxisLayoutProperty(c,u)}}updateLayoutAxis(e,t,r,i,a,o,s){var l,{dh:u}=this,c=t.type===u.plot.AxisType.Y,d=c?o:a,h=e,g=(l=t.label)!==null&&l!==void 0?l:"";if(h.title!==void 0&&typeof h.title!="string"?h.title.text=g:h.title={text:g},t.log&&(h.type="log"),h.side=this.getAxisSide(t.position),r>0){var p,y;h.overlaying=(p=this.getAxisPropertyName(t.type))!==null&&p!==void 0?p:void 0;var S=(y=i.get(t.position))!==null&&y!==void 0?y:[],T=S.indexOf(t);T>0&&(h.anchor="free",t.position===u.plot.AxisPosition.RIGHT?h.position=s.right+(T-S.length+1)*d:t.position===u.plot.AxisPosition.TOP?h.position=s.top+(T-S.length+1)*d:t.position===u.plot.AxisPosition.BOTTOM?h.position=s.bottom+(S.length-T+1)*d:t.position===u.plot.AxisPosition.LEFT&&(h.position=s.left+(S.length-T+1)*d))}else if(t.type===u.plot.AxisType.X){var w=i.get(u.plot.AxisPosition.LEFT)||[],b=i.get(u.plot.AxisPosition.RIGHT)||[],P=Math.max(s.left,s.left+(w.length-1)*o),F=Math.min(s.right-(b.length-1)*o,s.right);h.domain=[P,F]}else if(t.type===u.plot.AxisType.Y){var V=i.get(u.plot.AxisPosition.BOTTOM)||[],N=i.get(u.plot.AxisPosition.TOP)||[],D=Math.max(s.bottom,s.bottom+(V.length-1)*a),M=Math.min(s.top-(N.length-1)*a,s.top);h.domain=[D,M]}}createBoundsFromDays(e){var t=e.map(o=>this.daysOfWeek.indexOf(o)),r=this.daysOfWeek.filter(o=>!e.includes(o)).map(o=>this.daysOfWeek.indexOf(o)),i=new Set;r.forEach(o=>{for(var s=o+1;s<o+this.daysOfWeek.length;s+=1){var l=s%this.daysOfWeek.length;if(t.includes(l)){i.add(l);break}}});var a=[];return i.forEach(o=>{for(var s=o-1;s>o-this.daysOfWeek.length;s-=1){var l=s<0?s+this.daysOfWeek.length:s;if(t.includes(l)){var u=(l+1)%7;a.push([u,o]);break}}}),a}createRangeBreakValuesFromHolidays(e,t,r){var i=[],a=[];return e.forEach(o=>{o.businessPeriods.length>0?a.push(...this.createPartialHoliday(o,t,r)):i.push(this.createFullHoliday(o,t,r))}),[{values:i},...a]}createFullHoliday(e,t,r){return this.adjustDateForTimeZone("".concat(e.date.toString()," 00:00:00.000000"),t,r)}createPartialHoliday(e,t,r){var i=e.date.toString(),a=["00:00"];e.businessPeriods.forEach(h=>{a.push(h.open),a.push(h.close)}),a.push("24:00");for(var o=[],s=0;s<a.length;s+=2){var l=a[s],u=a[s+1];if(l!==u){var c=[this.adjustDateForTimeZone("".concat(i," ").concat(l,":00.000000"),t,r)],d=ai*(v.periodToDecimal(u)-v.periodToDecimal(l));o.push({values:c,dvalue:d})}}return o}adjustDateForTimeZone(e,t,r){return r&&r.standardOffset!==t.standardOffset?this.unwrapValue(this.wrapValue(e,ht,t),r):e}makeFigureSettings(e,t){var{dh:r}=this,{series:i,xAxis:a,type:o}=e,s=v.titleFromSettings(e),l={formatType:"".concat(r.plot.AxisFormatType.NUMBER),type:"".concat(r.plot.AxisType.X),position:"".concat(r.plot.AxisPosition.BOTTOM)},u={formatType:"".concat(r.plot.AxisFormatType.NUMBER),type:"".concat(r.plot.AxisType.Y),position:"".concat(r.plot.AxisPosition.LEFT)};return{charts:[{chartType:"".concat(r.plot.ChartType.XY),axes:[l,u],series:(i??[]).map(c=>({plotStyle:"".concat(o),name:c,dataSources:[{type:"".concat(r.plot.SourceType.X),columnName:a??"",axis:l,table:t},{type:"".concat(r.plot.SourceType.Y),columnName:c,axis:u,table:t}]}))}],title:s}}unwrapValue(e,t){var{dh:r}=this;if(e!=null){if(si(e))return r.i18n.DateTimeFormat.format(v.DATE_FORMAT,e,t);if(li(e))return e.asNumber()}return e}wrapValue(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,{dh:i}=this;if(f.isDateType(t)&&typeof e=="string"){var a=e,o=v.DATE_FORMAT.substr(0,e.length),s=i.i18n.DateTimeFormat.parse(o,a);if(!r)return s;var l="".concat(o," Z"),u=i.i18n.DateTimeFormat.format("Z",s,r),c=i.i18n.DateTimeFormat.parse(l,"".concat(a," ").concat(u)),d=i.i18n.DateTimeFormat.format("Z",c,r);return i.i18n.DateTimeFormat.parse(l,"".concat(a," ").concat(d))}return e}makeLayoutAxis(e,t){var{dh:r}=this,i={automargin:!0,gridcolor:t.gridcolor,linecolor:t.linecolor,rangeslider:{visible:!1},showline:!0,ticklen:5,tickcolor:t.paper_bgcolor,tickfont:{color:t.zerolinecolor},title:{font:{color:t.title_color}}};return e===r.plot.AxisType.X?Object.assign(i,{showgrid:!0}):e===r.plot.AxisType.Y&&Object.assign(i,{zerolinecolor:t.zerolinecolor,zerolinewidth:2}),i}makeDefaultLayout(e){var{dh:t}=this,r=me(me({},e),{},{autosize:!0,colorway:v.getColorwayFromTheme(e),font:{family:"'Fira Sans', sans-serif",color:e.title_color},title:{font:{color:e.title_color},yanchor:"top",pad:me({},v.DEFAULT_TITLE_PADDING),y:1},legend:{font:{color:e.title_color}},margin:me({},v.DEFAULT_MARGIN),xaxis:this.makeLayoutAxis(t.plot.AxisType.X,e),yaxis:this.makeLayoutAxis(t.plot.AxisType.Y,e),polar:{angularaxis:this.makeLayoutAxis(t.plot.AxisType.SHAPE,e),radialaxis:this.makeLayoutAxis(t.plot.AxisType.SHAPE,e),bgcolor:e.plot_bgcolor},scene:{xaxis:this.makeLayoutAxis(t.plot.AxisType.X,e),yaxis:this.makeLayoutAxis(t.plot.AxisType.Y,e),zaxis:this.makeLayoutAxis(t.plot.AxisType.Z,e)}});return r.datarevision=0,r}hydrateSettings(e){var{dh:t}=this;return me(me({},e),{},{type:e.type!=null?t.plot.SeriesPlotStyle[e.type]:void 0})}}H(v,"DEFAULT_AXIS_SIZE",.15);H(v,"MIN_AXIS_SIZE",.025);H(v,"MAX_AXIS_SIZE",.2);H(v,"AXIS_SIZE_PX",75);H(v,"LEGEND_WIDTH_PX",50);H(v,"MAX_LEGEND_SIZE",.25);H(v,"ORIENTATION",Object.freeze({HORIZONTAL:"h",VERTICAL:"v"}));H(v,"DATE_FORMAT","yyyy-MM-dd HH:mm:ss.SSSSSS");H(v,"DEFAULT_MARGIN",Object.freeze({l:60,r:50,t:30,b:60,pad:0}));H(v,"DEFAULT_TITLE_PADDING",Object.freeze({t:8}));H(v,"SUBTITLE_LINE_HEIGHT",25);H(v,"DEFAULT_MARKER_SIZE",6);H(v,"MODE_MARKERS","markers");H(v,"MODE_LINES","lines");const z=v;function ci(n,e,t){return e=di(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function di(n){var e=hi(n,"string");return typeof e=="symbol"?e:String(e)}function hi(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class fi extends Error{constructor(){super(...arguments),ci(this,"isDownsamplingError",!0)}}const mi=fi;function mt(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function pt(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?mt(Object(t),!0).forEach(function(r){W(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):mt(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function W(n,e,t){return e=pi(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function pi(n){var e=vi(n,"string");return typeof e=="symbol"?e:String(e)}function vi(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ae=G.module("Chart");class ce extends C.Component{static convertIcon(e){var[t,,,,r]=e.icon,i="".concat(r);return{width:t,path:i,ascent:t,descent:0,transform:"matrix(1, 0, 0, 1, 0, 0)"}}static downsampleButtonTitle(e,t){return e?"Downsampling in progress...":t?"Downsampling disabled, click to enable":"Downsampling enabled, click to disable"}static downsampleButtonAttr(e,t){return e?"animation-spin":t?void 0:"fill-active"}constructor(e){var t;super(e),W(this,"currentSeries",void 0),W(this,"PlotComponent",void 0),W(this,"plot",void 0),W(this,"plotWrapper",void 0),W(this,"columnFormats",void 0),W(this,"dateTimeFormatterOptions",void 0),W(this,"decimalFormatOptions",void 0),W(this,"integerFormatOptions",void 0),W(this,"rect",void 0),W(this,"ranges",void 0),W(this,"isSubscribed",void 0),W(this,"isLoadedFired",void 0),W(this,"resizeObserver",void 0),W(this,"getCachedConfig",kt((r,i,a,o,s,l)=>{var u=[],c=!!r;c&&u.push({name:"Downsampling failed: ".concat(r),title:"Downsampling failed",click:()=>{this.toggleErrorMessage("".concat(r))},icon:ce.convertIcon(Ge),attr:"fill-warning"});var d=!!l;if(d&&u.push({name:"Error: ".concat(l),title:"Error",click:()=>{this.toggleErrorMessage("".concat(l))},icon:ce.convertIcon(Ge),attr:"fill-warning"}),i||a||o||c){var h=ce.downsampleButtonTitle(a,o),g=ce.downsampleButtonAttr(a,o),p=a?Qt:Ut;u.push({name:h,title:"Downsampling status",icon:ce.convertIcon(p),click:this.handleDownsampleClick,attr:g})}var y=s.some(b=>{var{type:P}=b;return P!=null&&!P.includes("3d")}),S=s.some(b=>{var{type:P}=b;return P!=null&&P.includes("3d")}),T=["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"],w=["orbitRotation","tableRotation","resetCameraDefault3d"];return{displaylogo:!1,displayModeBar:a||c||d?!0:"hover",modeBarButtons:[u,["toImage"],["zoom2d","pan2d"],[...y?T:[],...S?w:[]]]}})),this.handleAfterPlot=this.handleAfterPlot.bind(this),this.handleDownsampleClick=this.handleDownsampleClick.bind(this),this.handleErrorClose=this.handleErrorClose.bind(this),this.handleModelEvent=this.handleModelEvent.bind(this),this.handlePlotUpdate=this.handlePlotUpdate.bind(this),this.handleRelayout=this.handleRelayout.bind(this),this.handleResize=this.handleResize.bind(this),this.handleRestyle=this.handleRestyle.bind(this),this.PlotComponent=ei(e.Plotly),this.plot=_.createRef(),this.plotWrapper=(t=e.containerRef)!==null&&t!==void 0?t:_.createRef(),this.columnFormats=[],this.dateTimeFormatterOptions={},this.decimalFormatOptions={},this.integerFormatOptions={},this.isSubscribed=!1,this.isLoadedFired=!1,this.currentSeries=0,this.resizeObserver=new window.ResizeObserver(this.handleResize),this.state={data:null,downsamplingError:null,isDownsampleFinished:!1,isDownsampleInProgress:!1,isDownsamplingDisabled:!1,error:null,shownError:null,layout:{datarevision:0},revision:0}}componentDidMount(){this.updateDimensions(),this.updateModelDimensions(),this.initData(),this.initFormatter();var{isActive:e,model:t}=this.props;e&&this.subscribe(t),this.plotWrapper.current!=null&&this.resizeObserver.observe(this.plotWrapper.current)}componentDidUpdate(e){var{isActive:t,model:r,settings:i}=this.props;this.updateFormatterSettings(i),r!==e.model&&(this.unsubscribe(e.model),this.subscribe(r)),t!==e.isActive&&(t?(this.updateDimensions(),this.subscribe(r)):this.unsubscribe(r))}componentWillUnmount(){var{model:e}=this.props;this.unsubscribe(e),this.resizeObserver.disconnect()}getPlotRect(){var e,t;return(e=(t=this.plotWrapper.current)===null||t===void 0?void 0:t.getBoundingClientRect())!==null&&e!==void 0?e:null}initData(){var{model:e}=this.props,{layout:t}=this.state;this.setState({data:e.getData(),layout:pt(pt({},t),e.getLayout())})}subscribe(e){if(!this.isSubscribed){if(!this.rect||this.rect.width===0||this.rect.height===0){ae.debug2("Delaying subscription until model dimensions are set");return}e.subscribe(this.handleModelEvent),this.isSubscribed=!0}}unsubscribe(e){this.isSubscribed&&(e.unsubscribe(this.handleModelEvent),this.isSubscribed=!1)}handleAfterPlot(){this.plot.current!=null}handleDownsampleClick(){this.setState(e=>{var{isDownsamplingDisabled:t}=e;return{downsamplingError:null,isDownsampleInProgress:!1,isDownsampleFinished:!1,isDownsamplingDisabled:!t}},()=>{var{model:e}=this.props,{isDownsamplingDisabled:t}=this.state;e.setDownsamplingDisabled(t)})}handleErrorClose(){this.setState({shownError:null})}handleModelEvent(e){var{type:t,detail:r}=e;switch(ae.debug2("Received data update",t,r),t){case J.EVENT_UPDATED:{this.currentSeries+=1,this.setState(g=>{var{layout:p,revision:y}=g;return typeof p.datarevision=="number"&&(p.datarevision+=1),{data:r,layout:p,revision:y+1}});var{onUpdate:i}=this.props;i({isLoading:!this.isLoadedFired});break}case J.EVENT_LOADFINISHED:{var{onUpdate:a}=this.props;this.isLoadedFired=!0,a({isLoading:!1});break}case J.EVENT_DISCONNECT:{var{onDisconnect:o}=this.props;o();break}case J.EVENT_RECONNECT:{var{onReconnect:s}=this.props;s();break}case J.EVENT_DOWNSAMPLESTARTED:{this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!0,downsamplingError:null});break}case J.EVENT_DOWNSAMPLEFINISHED:{this.setState({isDownsampleFinished:!0,isDownsampleInProgress:!1,downsamplingError:null});break}case J.EVENT_DOWNSAMPLENEEDED:case J.EVENT_DOWNSAMPLEFAILED:{var l,u=(l=r.message)!==null&&l!==void 0?l:r;this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!1,isDownsamplingDisabled:!1,downsamplingError:u});var{onError:c}=this.props;c(new mi(u));break}case J.EVENT_ERROR:{var d="".concat(r);this.setState({error:d});var{onError:h}=this.props;h(new Error(d));break}default:ae.debug("Unknown event type",t,e)}}handlePlotUpdate(e){var{layout:t}=e,r=z.getLayoutRanges(t),i=!ge(r,this.ranges);i&&(this.ranges=r,this.updateModelDimensions(!0))}handleRelayout(e){if(ae.debug("handleRelayout",e),e.hiddenlabels!=null){var{onSettingsChanged:t}=this.props,r=[...e.hiddenlabels];t({hiddenSeries:r})}this.updateModelDimensions()}handleResize(){this.updateDimensions()}handleRestyle(e){var[t,r]=e;if(ae.debug("handleRestyle",t,r),Object.keys(t).includes("visible")){var{data:i}=this.state,{onSettingsChanged:a}=this.props;if(i!=null){var o=i.reduce((s,l)=>{var{name:u,visible:c}=l;return u!=null&&c==="legendonly"?[...s,u]:s},[]);a({hiddenSeries:o})}}}toggleErrorMessage(e){this.setState(t=>{var{shownError:r}=t;return{shownError:r===e?null:e}})}updateModelDimensions(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.getPlotRect();if(!t){ae.warn("Unable to get plotting rect");return}var r=!this.rect||this.rect.width!==t.width||this.rect.height!==t.height;if(r||e){this.rect=t;var{isActive:i,model:a}=this.props;a.setDimensions(t),i&&this.subscribe(a)}}initFormatter(){var{settings:e}=this.props;this.updateFormatterSettings(e)}updateFormatterSettings(e){var t=Le.getColumnFormats(e),r=Le.getDateTimeFormatterOptions(e),{decimalFormatOptions:i={},integerFormatOptions:a={}}=e;(!ge(this.columnFormats,t)||!ge(this.dateTimeFormatterOptions,r)||!ge(this.decimalFormatOptions,i)||!ge(this.integerFormatOptions,a))&&(this.columnFormats=Le.getColumnFormats(e),this.dateTimeFormatterOptions=r,this.decimalFormatOptions=i,this.integerFormatOptions=a,this.updateFormatter())}updateFormatter(){var{model:e}=this.props,t=new Be(e.dh,this.columnFormats,this.dateTimeFormatterOptions,this.decimalFormatOptions,this.integerFormatOptions);e.setFormatter(t)}updateDimensions(){var e=this.getPlotRect(),{Plotly:t}=this.props;this.plot.current!=null&&e!=null&&e.width>0&&e.height>0&&t.relayout(this.plot.current.el,{autosize:!0}).catch(r=>{ae.debug("Unable to resize, promise rejected",r)})}render(){var{PlotComponent:e}=this,{data:t,downsamplingError:r,isDownsampleFinished:i,isDownsampleInProgress:a,isDownsamplingDisabled:o,error:s,shownError:l,layout:u,revision:c}=this.state,d=this.getCachedConfig(r,i,a,o,t??[],s),h=t!=null;return E.jsxs("div",{className:"h-100 w-100 chart-wrapper",ref:this.plotWrapper,children:[h&&E.jsx(e,{ref:this.plot,data:t,layout:u,revision:c,config:d,onAfterPlot:this.handleAfterPlot,onError:ae.error,onRelayout:this.handleRelayout,onUpdate:this.handlePlotUpdate,onRestyle:this.handleRestyle,useResizeHandler:!0,style:{height:"100%",width:"100%"}}),E.jsx(Ft,{className:"chart-error-popper",options:{placement:"top"},isShown:l!=null,onExited:this.handleErrorClose,closeOnBlur:!0,interactive:!0,children:l!=null&&E.jsxs(E.Fragment,{children:[E.jsx("div",{className:"chart-error",children:l}),E.jsx(tn,{tooltip:"Copy Error",copy:l,children:"Copy Error"})]})})]})}}W(ce,"defaultProps",{isActive:!0,settings:{timeZone:"America/New_York",defaultDateTimeFormat:j.FULL_DATE_FORMAT,showTimeZone:!1,showTSeparator:!0,formatter:[]},Plotly:wt,onDisconnect:()=>{},onReconnect:()=>{},onUpdate:()=>{},onError:()=>{},onSettingsChanged:()=>{}});const Gi=ce;function vt(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function gt(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?vt(Object(t),!0).forEach(function(r){A(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):vt(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function A(n,e,t){return e=gi(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function gi(n){var e=yi(n,"string");return typeof e=="symbol"?e:String(e)}function yi(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var $=G.module("FigureChartModel");class Ce extends J{constructor(e,t,r){var i,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(e),i=this,A(this,"chartUtils",void 0),A(this,"dh",void 0),A(this,"figure",void 0),A(this,"settings",void 0),A(this,"theme",void 0),A(this,"data",void 0),A(this,"layout",void 0),A(this,"seriesDataMap",void 0),A(this,"pendingSeries",void 0),A(this,"oneClicks",void 0),A(this,"filterColumnMap",void 0),A(this,"lastFilter",void 0),A(this,"isConnected",void 0),A(this,"seriesToProcess",void 0),A(this,"addPendingSeries",jt(()=>{for(var s=z.getAxisTypeMap(this.figure),{pendingSeries:l}=this,u=function(){var h,g=l[c],p=i.figure.charts.find(y=>y.series.includes(g));i.addSeries(g,s,(h=p==null?void 0:p.showLegend)!==null&&h!==void 0?h:null),g.subscribe()},c=0;c<l.length;c+=1)u();this.pendingSeries=[]},Ce.ADD_SERIES_DEBOUNCE)),A(this,"getTimeZone",ye((s,l)=>{if(l!=null){var u=l.getColumnTypeFormatter(s);if(u!=null)return u.dhTimeZone}})),A(this,"getValueTranslator",ye((s,l)=>{var u=this.getTimeZone(s,l);return c=>this.chartUtils.unwrapValue(c,u)})),A(this,"getValueParser",ye((s,l)=>{var u=this.getTimeZone(s,l);return c=>this.chartUtils.wrapValue(c,s,u)})),A(this,"getRangeParser",ye((s,l)=>u=>{var[c,d]=u,h=this.getValueParser(s,l);return c=h(c),d=h(d),[c,d]})),A(this,"getAxisRangeParser",ye((s,l)=>u=>{var c=z.getSourceForAxis(s,u);return c!=null?this.getRangeParser(c.columnType,l):d=>d})),this.handleFigureUpdated=this.handleFigureUpdated.bind(this),this.handleFigureDisconnected=this.handleFigureDisconnected.bind(this),this.handleFigureReconnected=this.handleFigureReconnected.bind(this),this.handleFigureSeriesAdded=this.handleFigureSeriesAdded.bind(this),this.handleDownsampleStart=this.handleDownsampleStart.bind(this),this.handleDownsampleFinish=this.handleDownsampleFinish.bind(this),this.handleDownsampleFail=this.handleDownsampleFail.bind(this),this.handleDownsampleNeeded=this.handleDownsampleNeeded.bind(this),this.handleRequestFailed=this.handleRequestFailed.bind(this),this.dh=e,this.chartUtils=new z(e),this.figure=t,this.settings=a,this.theme=r,this.data=[];var o={data:{},layout:this.chartUtils.makeDefaultLayout(r)};this.layout={grid:{rows:t.rows,columns:t.cols,pattern:"independent"},template:o},this.seriesDataMap=new Map,this.pendingSeries=[],this.oneClicks=[],this.filterColumnMap=new Map,this.lastFilter=new Map,this.isConnected=!0,this.seriesToProcess=new Set,this.setTitle(this.getDefaultTitle()),this.initAllSeries(),this.updateAxisPositions(),this.startListeningFigure()}close(){this.figure.close(),this.addPendingSeries.cancel(),this.stopListeningFigure()}getDefaultTitle(){if(this.figure.title!=null&&this.figure.title.length>0)return this.figure.title;if(this.figure.charts.length===1){var e;return(e=this.figure.charts[0].title)!==null&&e!==void 0?e:""}return""}initAllSeries(){var e=this;this.oneClicks=[],this.filterColumnMap.clear();for(var{charts:t}=this.figure,r=z.getAxisTypeMap(this.figure),i=[],a=function(){for(var h=t[o],g=0;g<h.series.length;g+=1){var p=h.series[g];i.push(p.name),e.addSeries(p,r,h.showLegend)}var{axes:y,title:S}=h;if(S!=null&&S.length>0&&(t.length>1||e.figure.title!=null)){var T=y.find(k=>k.type===e.dh.plot.AxisType.X),w=y.find(k=>k.type===e.dh.plot.AxisType.Y);if(T==null||w==null)$.warn("Chart title provided, but unknown how to map to the correct axes for this chart type",h);else{var b,P,F,V,N=((b=(P=r.get(T.type))===null||P===void 0?void 0:P.findIndex(k=>k===T))!==null&&b!==void 0?b:0)+1,D=((F=(V=r.get(w.type))===null||V===void 0?void 0:V.findIndex(k=>k===w))!==null&&F!==void 0?F:0)+1,M={align:"center",x:.5,y:1,yshift:17,text:S,showarrow:!1,xref:"x".concat(N," domain"),yref:"y".concat(D," domain")};e.layout.annotations==null?e.layout.annotations=[M]:e.layout.annotations.push(M)}}},o=0;o<t.length;o+=1)a();for(var s=[...this.seriesDataMap.keys()],l=s.filter(d=>i.indexOf(d)<0),u=0;u<l.length;u+=1){var c=l[u];this.seriesDataMap.delete(c)}this.seriesToProcess=new Set([...this.seriesDataMap.keys()])}addSeries(e,t,r){var{dh:i}=this,a=this.chartUtils.makeSeriesDataFromSeries(e,t,z.getSeriesVisibility(e.name,this.settings),this.theme,r);if(this.seriesDataMap.set(e.name,a),this.data=[...this.seriesDataMap.values()],e.plotStyle===i.plot.SeriesPlotStyle.STACKED_BAR?this.layout.barmode="stack":e.plotStyle===i.plot.SeriesPlotStyle.PIE&&(this.layout.hiddenlabels=z.getHiddenLabels(this.settings)),this.layout.showlegend=this.data.length>1||e.plotStyle===i.plot.SeriesPlotStyle.PIE?r??void 0:!1,e.oneClick!=null){for(var{oneClick:o}=e,{columns:s}=o,l=0;l<s.length;l+=1)this.filterColumnMap.set(s[l].name,s[l]);this.oneClicks.push(o)}this.updateLayoutFormats()}subscribe(e){super.subscribe(e),this.listeners.length===1&&(this.initAllSeries(),this.subscribeFigure())}unsubscribe(e){super.unsubscribe(e),this.listeners.length===0&&this.unsubscribeFigure()}subscribeFigure(){if(!this.isConnected){$.debug("Ignoring subscribe when figure in disconnected state");return}this.figure.subscribe(this.isDownsamplingDisabled?this.dh.plot.DownsampleOptions.DISABLE:this.dh.plot.DownsampleOptions.DEFAULT),this.figure.errors.length>0&&($.error("Errors in figure",this.figure.errors),this.fireError(this.figure.errors))}unsubscribeFigure(){this.figure.unsubscribe()}startListeningFigure(){var{dh:e}=this;this.figure.addEventListener(e.plot.Figure.EVENT_UPDATED,this.handleFigureUpdated),this.figure.addEventListener(e.plot.Figure.EVENT_SERIES_ADDED,this.handleFigureSeriesAdded),this.figure.addEventListener(e.plot.Figure.EVENT_DISCONNECT,this.handleFigureDisconnected),this.figure.addEventListener(e.plot.Figure.EVENT_RECONNECT,this.handleFigureReconnected),this.figure.addEventListener(e.plot.Figure.EVENT_DOWNSAMPLESTARTED,this.handleDownsampleStart),this.figure.addEventListener(e.plot.Figure.EVENT_DOWNSAMPLEFINISHED,this.handleDownsampleFinish),this.figure.addEventListener(e.plot.Figure.EVENT_DOWNSAMPLEFAILED,this.handleDownsampleFail),this.figure.addEventListener(e.plot.Figure.EVENT_DOWNSAMPLENEEDED,this.handleDownsampleNeeded),this.figure.addEventListener(e.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed)}stopListeningFigure(){var{dh:e}=this;this.figure.removeEventListener(e.plot.Figure.EVENT_UPDATED,this.handleFigureUpdated),this.figure.removeEventListener(e.plot.Figure.EVENT_SERIES_ADDED,this.handleFigureSeriesAdded),this.figure.removeEventListener(e.plot.Figure.EVENT_DISCONNECT,this.handleFigureDisconnected),this.figure.removeEventListener(e.plot.Figure.EVENT_RECONNECT,this.handleFigureReconnected),this.figure.removeEventListener(e.plot.Figure.EVENT_DOWNSAMPLESTARTED,this.handleDownsampleStart),this.figure.removeEventListener(e.plot.Figure.EVENT_DOWNSAMPLEFINISHED,this.handleDownsampleFinish),this.figure.removeEventListener(e.plot.Figure.EVENT_DOWNSAMPLEFAILED,this.handleDownsampleFail),this.figure.removeEventListener(e.plot.Figure.EVENT_DOWNSAMPLENEEDED,this.handleDownsampleNeeded),this.figure.removeEventListener(e.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed)}handleDownsampleStart(e){$.debug("Downsample started",e),this.fireDownsampleStart(e.detail)}handleDownsampleFinish(e){$.debug("Downsample finished",e),this.fireDownsampleFinish(e.detail)}handleDownsampleFail(e){$.error("Downsample failed",e),this.fireDownsampleFail(e.detail)}handleDownsampleNeeded(e){$.info("Downsample needed",e),this.fireDownsampleNeeded(e.detail)}handleFigureUpdated(e){var{detail:t}=e,{series:r}=t;$.debug2("handleFigureUpdated",r);for(var i=0;i<r.length;i+=1){var a=r[i];$.debug2("handleFigureUpdated updating series",a.name);for(var{sources:o}=a,s=0;s<o.length;s+=1){var l=o[s],{columnType:u,type:c}=l,d=this.getValueTranslator(u,this.formatter),h=t.getArray(a,c,d);this.setDataArrayForSeries(a,c,h)}this.seriesToProcess.delete(a.name),this.cleanSeries(a)}this.seriesToProcess.size===0&&this.fireLoadFinished();var{data:g}=this;this.fireUpdate(g)}handleRequestFailed(e){$.error("Request failed",e),this.fireError(["".concat(e.detail)])}resubscribe(){this.listeners.length>0&&(this.unsubscribeFigure(),this.subscribeFigure())}setFormatter(e){super.setFormatter(e),this.updateLayoutFormats(),this.resubscribe()}setDownsamplingDisabled(e){super.setDownsamplingDisabled(e),this.resubscribe()}handleFigureDisconnected(e){$.debug("Figure disconnected",e),this.isConnected=!1,this.listeners.length>0&&this.unsubscribeFigure(),this.fireDisconnect()}handleFigureReconnected(e){$.debug("Figure reconnected",e),this.isConnected=!0,this.initAllSeries(),this.fireReconnect(),this.listeners.length>0&&this.subscribeFigure()}handleFigureSeriesAdded(e){var{detail:t}=e;$.debug("handleFigureSeriesAdded",t),this.pendingSeries.push(t),this.addPendingSeries()}setDimensions(e){super.setDimensions(e),this.updateAxisPositions()}setTitle(e){var t,r;super.setTitle(e);var i=(t=(r=(e??"").match(/<br>/g))===null||r===void 0?void 0:r.length)!==null&&t!==void 0?t:0,a=z.DEFAULT_MARGIN.t+i*z.SUBTITLE_LINE_HEIGHT;this.layout.margin?this.layout.margin.t=a:this.layout.margin={t:a},typeof this.layout.title=="string"?this.layout.title=e:(this.layout.title=gt({},this.layout.title),this.layout.title.text=e,this.layout.title.pad=gt({},this.layout.title.pad),this.layout.title.pad.t=z.DEFAULT_TITLE_PADDING.t+i*z.SUBTITLE_LINE_HEIGHT*.5)}getPlotWidth(){var e,t,r,i;return!this.rect||!this.rect.width?0:Math.max(this.rect.width-((e=(t=this.layout.margin)===null||t===void 0?void 0:t.l)!==null&&e!==void 0?e:0)-((r=(i=this.layout.margin)===null||i===void 0?void 0:i.r)!==null&&r!==void 0?r:0),0)}getPlotHeight(){var e,t,r,i;return!this.rect||!this.rect.height?0:Math.max(this.rect.height-((e=(t=this.layout.margin)===null||t===void 0?void 0:t.t)!==null&&e!==void 0?e:0)-((r=(i=this.layout.margin)===null||i===void 0?void 0:i.b)!==null&&r!==void 0?r:0),0)}updateAxisPositions(){var e=this.getPlotWidth(),t=this.getPlotHeight();this.chartUtils.updateFigureAxes(this.layout,this.figure,this.theme,r=>this.getAxisRangeParser(r,this.formatter),e,t)}updateLayoutFormats(){if(this.formatter){var e=this.chartUtils.getAxisFormats(this.figure,this.formatter);e.forEach((t,r)=>{$.debug("Assigning ".concat(r),this.layout[r],t);var i=this.layout[r];i!=null?Object.assign(i,t):$.debug("Ignoring null layout.".concat(r))})}}setDataArrayForSeries(e,t,r){var{name:i,plotStyle:a}=e,o=this.seriesDataMap.get(i),s=this.chartUtils.getPlotlyProperty(a,t);o&&bt(o,s,r)}cleanSeries(e){var{dh:t}=this,{name:r,plotStyle:i}=e,a=this.seriesDataMap.get(r);if(a!=null){if(i===t.plot.SeriesPlotStyle.HISTOGRAM){var{xLow:o,xHigh:s}=a;if(o&&s&&o.length===s.length){for(var l=[],u=0;u<o.length;u+=1)l.push(s[u]-o[u]);a.width=l}}else if(i===t.plot.SeriesPlotStyle.LINE||i===t.plot.SeriesPlotStyle.ERROR_BAR||i===t.plot.SeriesPlotStyle.BAR){var{x:c,xLow:d,xHigh:h,y:g,yLow:p,yHigh:y}=a;d&&h&&d!==c&&(a.error_x=z.getPlotlyErrorBars(c,d,h,this.theme)),p&&y&&p!==g&&(a.error_y=z.getPlotlyErrorBars(g,p,y,this.theme))}else if(i===t.plot.SeriesPlotStyle.TREEMAP){var{ids:S,labels:T}=a;S!==void 0&&T===void 0&&(a.labels=S)}}}getData(){return this.data}getLayout(){return this.layout}getFilterColumnMap(){return new Map(this.filterColumnMap)}isFilterRequired(){return this.oneClicks.find(e=>e.requireAllFiltersToDisplay)!=null}setFilter(e){var t=this;if(this.oneClicks.length===0){$.warn("Trying to set a filter, but no one click!");return}$.debug("setFilter",e);for(var r=function(){var o=t.oneClicks[i],{columns:s}=o,l=new Set([...e.keys(),...t.lastFilter.keys()]);l.forEach(u=>{var c=e.get(u);t.lastFilter.get(u)!==c&&s.find(d=>d.name===u)!=null&&o.setValueForColumn(u,c)})},i=0;i<this.oneClicks.length;i+=1)r();this.lastFilter=new Map(e)}setFigure(e){this.close(),this.figure=e,this.setTitle(this.getDefaultTitle()),this.initAllSeries(),this.updateAxisPositions(),this.startListeningFigure(),this.listeners.length>0&&this.subscribeFigure()}updateSettings(e){this.settings=e}}A(Ce,"ADD_SERIES_DEBOUNCE",50);const yt=Ce;function Et(n,e,t,r,i,a,o){try{var s=n[a](o),l=s.value}catch(u){t(u);return}s.done?e(l):Promise.resolve(l).then(r,i)}function Re(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){Et(a,r,i,o,s,"next",l)}function s(l){Et(a,r,i,o,s,"throw",l)}o(void 0)})}}class qe{static makeModelFromSettings(e,t,r,i){return Re(function*(){var a=yield qe.makeFigureFromSettings(e,t,r);return new yt(e,a,i,t)})()}static makeFigureFromSettings(e,t,r){return Re(function*(){var i=yield r.copy();return i.applyCustomColumns(r.customColumns),i.applyFilter(r.filter),i.applySort(r.sort),e.plot.Figure.create(new z(e).makeFigureSettings(t,i))})()}static makeModel(e,t,r,i){return Re(function*(){return new yt(e,r,i,t)})()}}const Yi=qe,Ei="var(--dh-color-chart-colorway)",Si="var(--dh-color-chart-grid)",Ti="var(--dh-color-chart-axis-line)",bi="var(--dh-color-chart-axis-line-zero)",wi="var(--dh-color-chart-active)",Pi="var(--dh-color-chart-range-bg)",St={"paper-bgcolor":"var(--dh-color-chart-bg)","plot-bgcolor":"var(--dh-color-chart-plot-bg)","title-color":"var(--dh-color-chart-title)",colorway:Ei,gridcolor:Si,linecolor:Ti,zerolinecolor:bi,activecolor:wi,rangebgcolor:Pi,"area-color":"var(--dh-color-chart-area)","trend-color":"var(--dh-color-chart-trend)","line-color":"var(--dh-color-chart-line-deprecated)","error-band-line-color":"var(--dh-color-chart-error-band-line)","error-band-fill-color":"var(--dh-color-chart-error-band-fill)","ohlc-increasing":"var(--dh-color-chart-ohlc-increase)","ohlc-decreasing":"var(--dh-color-chart-ohlc-decrease)"};var Tt=G.module("ChartTheme");function Fi(){var n,e=Jt(St);return e.colorway=er((n=e.colorway)!==null&&n!==void 0?n:"").map(t=>{var[r,i]=t;return tr.normalizeCssColor(e.colorway.substring(r,i+1))}).join(" "),Tt.debug2("Chart theme:",St),Tt.debug2("Chart theme derived:",e),Object.freeze({paper_bgcolor:e["paper-bgcolor"],plot_bgcolor:e["plot-bgcolor"],title_color:e["title-color"],colorway:e.colorway,gridcolor:e.gridcolor,linecolor:e.linecolor,zerolinecolor:e.zerolinecolor,activecolor:e.activecolor,rangebgcolor:e.rangebgcolor,area_color:e["area-color"],trend_color:e["trend-color"],line_color:e["line-color"],error_band_line_color:e["error-band-line-color"],error_band_fill_color:e["error-band-fill-color"],ohlc_increasing:e["ohlc-increasing"],ohlc_decreasing:e["ohlc-decreasing"]})}var Nt=C.createContext(null);function Xi(n){var{children:e}=n,{activeThemes:t}=En(),r=C.useMemo(Fi,[t]);return E.jsx(Nt.Provider,{value:r,children:e})}function Zi(){return Oe(Nt,"No ChartThemeContext value found.")}var Mi=C.createContext(null);function Qi(){return Oe(Mi,"No IdeConnection available in useConnection. Was code wrapped in ConnectionContext.Provider?")}export{z as $,ji as A,Br as B,Gi as C,ee as D,Ot as E,Be as F,qn as G,$i as H,te as I,Bi as J,_i as K,Vi as L,Hi as M,Vn as N,qi as O,_e as P,Ki as Q,Qn as R,kn as S,Nr as T,Un as U,Kn as V,zn as W,Jn as X,zi as Y,J as Z,Fi as _,ki as a,ei as a0,Nt as a1,Xi as a2,fi as a3,yt as a4,Ii as a5,xe as a6,Mi as a7,Ye as a8,Ai as a9,Ci as aa,pr as ab,we as ac,Wi as ad,Tr as ae,Zi as b,Li as c,Yi as d,Oe as e,Ir as f,Ft as g,he as h,xi as i,Gr as j,En as k,tn as l,Mt as m,Ri as n,Pt as o,m as p,wn as q,Fn as r,j as s,vn as t,Qi as u,R as v,In as w,Le as x,B as y,f as z};
|
|
3
|
-
//# sourceMappingURL=useConnection-e17c41c4.js.map
|