@deephaven/code-studio 0.40.0 → 0.40.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- import{r as d,P as g,H as E,aC as Ls,C as c,D as Te,F as I,R as yn,N as Re,O as ne,G as Z,Z as Se,aD as js,aE as $s,a4 as Vs,a5 as Bs,aF as Hs,a1 as gt,E as Tn,aG as _s,aH as De,aI as Us,aJ as Ks,aK as Ws,aL as En,aM as qs,aN as Gs}from"./vendor-aaea4a59.js";import{T as ce,g as V,aV as zs,aW as Zs,aX as Xs,aY as Qs,ad as It,ah as xt,ae as In,aZ as xn,L as wt,ar as Js,e as Ys,a_ as ei,a$ as ti,p as ni,ac as wn,X as si,a3 as ii,m as oi,b0 as ai,c as Nn,V as ri,b1 as li,q as Le,b2 as Nt,b3 as ci}from"./index-db040c26.js";class ui extends d.Component{static propTypes={children:g.node.isRequired,options:g.shape({}),className:g.string,timeout:g.number,onEntered:g.func,onExited:g.func,isShown:g.bool,closeOnBlur:g.bool,interactive:g.bool,referenceObject:g.shape({}),"data-testid":g.string};static defaultProps={options:{},className:"",timeout:ce.transitionMs,onEntered(){},onExited(){},isShown:!1,interactive:!1,closeOnBlur:!1,referenceObject:null,"data-testid":void 0};constructor(e){super(e),this.handleEnter=this.handleEnter.bind(this),this.handleExit=this.handleExit.bind(this),this.handleBlur=this.handleBlur.bind(this),this.element=document.createElement("div"),this.element.className="popper-container",this.container=E.createRef(),this.rAF=0;const{isShown:t}=this.props;this.state={show:t,popper:null}}componentDidUpdate(e){const{isShown:t}=this.props;e.isShown!==t&&(t?(cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{this.show()})):this.hide())}componentWillUnmount(){this.destroyPopper(!1)}element;container;rAF;getVisibleElement(e){return e==null||e.clientHeight>0||e.clientWidth>0?e:this.getVisibleElement(e.parentElement)}initPopper(){let{popper:e}=this.state;const{closeOnBlur:t,referenceObject:n}=this.props;if(e||this.container.current===null)return;let{options:s}=this.props;s={placement:"auto",modifiers:{preventOverflow:{boundariesElement:"viewport"}},...s},document.body.appendChild(this.element);let i=this.getVisibleElement(this.container.current);i==null&&(i=this.container.current),e=new Ls(n||i,this.element,s),e.scheduleUpdate(),cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{if(t&&!this.element.contains(document.activeElement)){const a=this.element.firstElementChild;a instanceof HTMLElement&&a.focus()}}),this.setState({popper:e})}destroyPopper(e=!0){cancelAnimationFrame(this.rAF);const{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(){const{popper:e}=this.state;e&&e.scheduleUpdate()}handleBlur(e){e.relatedTarget instanceof HTMLElement&&(this.element.contains(e.relatedTarget)||this.hide())}handleEnter(){const{onEntered:e}=this.props;e()}handleExit(){const{onExited:e}=this.props,{show:t}=this.state;t||this.destroyPopper(),e()}renderContent(){const{className:e,children:t,timeout:n,interactive:s,closeOnBlur:i}=this.props,{show:a}=this.state;return c.jsx(Te,{in:a,timeout:n,classNames:"popper-transition",onEntered:this.handleEnter,onExited:this.handleExit,children:c.jsx("div",{onClick:r=>{r.stopPropagation()},onKeyDown:r=>{r.key==="Escape"&&this.hide()},className:I("popper",{interactive:s},e),onBlur:i?this.handleBlur:void 0,tabIndex:i?-1:void 0,role:"presentation",children:c.jsxs("div",{className:"popper-content",children:[t,c.jsx("div",{className:"popper-arrow","x-arrow":""})]})})})}render(){const{popper:e}=this.state,{"data-testid":t}=this.props;return c.jsx("div",{className:"popper-parent-container",ref:this.container,style:{display:"none"},"data-testid":t,children:e&&yn.createPortal(this.renderContent(),this.element)})}}const Oe=ui,di=Object.freeze(Object.defineProperty({__proto__:null,Log:V,LogHistory:zs,LogProxy:Zs,Logger:Xs,LoggerLevel:Qs,default:V},Symbol.toStringTag,{value:"Module"})),hi=V.module("Tooltip");class Q extends d.Component{static defaultTimeout=500;static defaultReshowTimeout=100;static triggerReshowThreshold=300;static shownTooltipCount=0;static lastHiddenTime=Date.now();static defaultProps={interactive:!1,options:{},popperClassName:"",reshowTimeout:Q.defaultReshowTimeout,timeout:Q.defaultTimeout,onEntered:()=>{},onExited:()=>{},"data-testid":void 0};static handleHidden(){Q.shownTooltipCount-=1,Q.shownTooltipCount===0&&(Q.lastHiddenTime=Date.now())}static handleShown(){Q.shownTooltipCount+=1}constructor(e){super(e),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleWindowMouseMove=this.handleWindowMouseMove.bind(this),this.handleWheel=this.handleWheel.bind(this),this.handleTimeout=this.handleTimeout.bind(this),this.handleExited=this.handleExited.bind(this),this.stopShowingTooltip=this.stopShowingTooltip.bind(this),this.container=E.createRef(),this.popper=E.createRef(),this.parent=null,this.timer=null,this.state={isShown:!1}}componentDidMount(){this.startListening();const{timeout:e}=this.props;e===0&&this.show()}componentDidUpdate(e,t){const{isShown:n}=t,{isShown:s}=this.state;s!==n&&(s?Q.handleShown():Q.handleHidden())}componentWillUnmount(){this.stopListening(),this.stopListeningWindow(),this.stopTimer();const{isShown:e}=this.state;e&&Q.handleHidden()}container;popper;parent;timer;startListening(){if(!this.container.current||!this.container.current.parentElement){hi.error("Tooltip doesn't have a container or a parent set!");return}this.parent=this.container.current.parentElement,this.parent.addEventListener("mousemove",this.handleMouseMove),this.parent.addEventListener("mouseleave",this.handleMouseLeave),this.parent.addEventListener("mousedown",this.stopShowingTooltip)}stopListening(){this.parent&&(this.parent.removeEventListener("mousemove",this.handleMouseMove),this.parent.removeEventListener("mouseleave",this.handleMouseLeave),this.parent.removeEventListener("mousedown",this.stopShowingTooltip))}startListeningWindow(){window.addEventListener("mousemove",this.handleWindowMouseMove,!0),window.addEventListener("contextmenu",this.stopShowingTooltip,!0),window.addEventListener("wheel",this.handleWheel)}stopListeningWindow(){window.removeEventListener("mousemove",this.handleWindowMouseMove,!0),window.removeEventListener("contextmenu",this.stopShowingTooltip,!0),window.removeEventListener("wheel",this.handleWheel)}handleMouseMove(){this.startTimer()}handleWheel(){const{isShown:e}=this.state;this.popper.current&&this.parent&&e&&!this.popper.current.element.matches(":hover")&&!this.parent.matches(":hover")&&(this.stopTimer(),this.hide())}handleMouseLeave(){const{isShown:e}=this.state;this.stopTimer();const{interactive:t}=this.props;!t&&e&&this.hide()}handleTimeout(){this.show()}handleWindowMouseMove(e){const t=e.clientX,n=e.clientY,{isShown:s}=this.state;if(!this.popper.current||!this.parent)return;const i=this.popper.current.element.getBoundingClientRect(),a=this.parent.getBoundingClientRect();t>=i.left&&t<=i.left+i.width&&n>=i.top&&n<=i.top+i.height?this.handleMouseMove():t>=a.left&&t<=a.left+a.width&&n>=a.top&&n<=a.top+a.height?this.handleMouseMove():s&&(this.stopTimer(),this.hide())}startTimer(){this.stopTimer();const{timeout:e,reshowTimeout:t}=this.props;let n=e;(Q.shownTooltipCount>0||Date.now()-Q.lastHiddenTime<Q.triggerReshowThreshold)&&(n=t),this.timer=window.setTimeout(this.handleTimeout,n)}stopTimer(){this.timer!=null&&(clearTimeout(this.timer),this.timer=null)}show(){const{isShown:e}=this.state;if(this.stopTimer(),!e){this.popper.current?.show(),this.setState({isShown:!0});const{interactive:t}=this.props;t&&this.startListeningWindow()}}hide(){this.popper.current?.hide(),this.stopListeningWindow()}update(){this.popper.current?.scheduleUpdate()}handleExited(){this.setState({isShown:!1});const{onExited:e}=this.props;e()}stopShowingTooltip(){const{isShown:e}=this.state;this.stopTimer(),e&&this.hide()}render(){const{interactive:e,children:t,referenceObject:n,popperClassName:s,"data-testid":i,onEntered:a}=this.props,{isShown:r}=this.state;let{options:l}=this.props;return l={placement:"bottom",...l},c.jsx("div",{ref:this.container,style:{display:"none"},"data-testid":i,children:c.jsx(Oe,{className:I(s),options:l,ref:this.popper,onEntered:a,onExited:this.handleExited,interactive:e,referenceObject:n,children:c.jsxs("div",{className:"tooltip-content",children:[" ",r&&t]})})})}}const kt=Q;const pi=100;var kn=(o=>(o.UP="UP",o.DOWN="DOWN",o))(kn||{});class me extends d.Component{static propTypes={options:g.arrayOf(g.shape({title:g.string.isRequired,value:g.string.isRequired})).isRequired,popperOptions:g.shape({}),onChange:g.func,inputPlaceholder:g.string,disabled:g.bool,className:g.string,defaultTitle:g.string,spellCheck:g.bool,onEnter:g.func,noMatchText:g.string,"data-testid":g.string};static defaultProps={onChange(){},inputPlaceholder:"",disabled:!1,className:"",defaultTitle:"",popperOptions:null,spellCheck:!0,onEnter(){},noMatchText:"No matching items found","data-testid":void 0};static MENU_NAVIGATION_DIRECTION=kn;constructor(e){super(e);let{popperOptions:t}=this.props;t={placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}},...t},this.state={title:"",filteredOptions:[],keyboardOptionIndex:0,menuIsOpen:!1,inputWidth:100,invalid:!1,popperOptions:t},this.handleMenuKeyDown=this.handleMenuKeyDown.bind(this),this.handleMenuBlur=this.handleMenuBlur.bind(this),this.handleInputChange=this.handleInputChange.bind(this),this.handleInputKeyDown=this.handleInputKeyDown.bind(this),this.handleInputBlur=this.handleInputBlur.bind(this),this.handelInputFocus=this.handelInputFocus.bind(this),this.handleInputClick=this.handleInputClick.bind(this),this.updateInputValue=Re(this.updateInputValue,pi),this.handleOptionClick=this.handleOptionClick.bind(this),this.handleMenuOpened=this.handleMenuOpened.bind(this),this.handleMenuExited=this.handleMenuExited.bind(this),this.popper=E.createRef(),this.cbContainer=E.createRef(),this.menuContainer=E.createRef(),this.input=E.createRef()}popper;cbContainer;menuContainer;input;setInputWidth(){this.cbContainer.current&&this.setState({inputWidth:this.cbContainer.current.getBoundingClientRect().width})}getCachedFilteredOptions=ne((e,t)=>e.filter(n=>n.title.toLowerCase().indexOf(t.toLowerCase())>=0));getValueAndValidate(e){if(!e)return this.setState({invalid:!1}),{value:e,isValid:!1};const{options:t}=this.props,n=t.filter(s=>s.title.toLowerCase()===e.toLowerCase());return n.length<1?(this.setState({invalid:!0}),{value:e,isValid:!1}):(this.setState({invalid:!1}),{value:n[0].value,isValid:!0})}updateInputValue(e){const{menuIsOpen:t}=this.state,{value:n,isValid:s}=this.getValueAndValidate(e);t&&this.processFilterChange(e),this.fireOnChange(n,s)}fireOnChange(e,t=!0){const{onChange:n}=this.props;n(e,t)}processFilterChange(e){const{options:t}=this.props,{menuIsOpen:n}=this.state,s=e?this.getCachedFilteredOptions(t,e):t,i=s.length===1&&s[0].title===e;if(this.setState({filteredOptions:s,keyboardOptionIndex:0}),i&&n){this.closeMenu();return}this.popper.current?.scheduleUpdate()}resetValue(){this.setState({title:""}),this.fireOnChange("")}handleResize(){this.setInputWidth()}handleMenuKeyDown(e){const{filteredOptions:t,keyboardOptionIndex:n}=this.state,s=t[n];switch(e.key){case"Enter":case"ArrowRight":e.stopPropagation(),e.preventDefault(),s!=null&&(this.setState({title:s.title,invalid:!1}),this.fireOnChange(s.value)),this.closeMenu(),this.input.current?.focus();break;case"ArrowUp":e.stopPropagation(),e.preventDefault(),this.navigateMenu(me.MENU_NAVIGATION_DIRECTION.UP);break;case"ArrowDown":e.stopPropagation(),e.preventDefault(),this.navigateMenu(me.MENU_NAVIGATION_DIRECTION.DOWN);break;case"Tab":if(e.stopPropagation(),e.preventDefault(),e.shiftKey){this.navigateMenu(me.MENU_NAVIGATION_DIRECTION.UP);break}this.navigateMenu(me.MENU_NAVIGATION_DIRECTION.DOWN);break;case"Escape":e.preventDefault(),e.stopPropagation(),this.closeMenu();break}}navigateMenu(e){const{filteredOptions:t,keyboardOptionIndex:n}=this.state;let s=n;e===me.MENU_NAVIGATION_DIRECTION.UP?n>0?(s=(s-1)%t.length,this.setState({keyboardOptionIndex:s})):n===0&&(s=t.length-1,this.setState({keyboardOptionIndex:s})):e===me.MENU_NAVIGATION_DIRECTION.DOWN&&n<t.length&&(s=(s+1)%t.length,this.setState({keyboardOptionIndex:s})),this.scrollOptionIntoView(s)}handleInputKeyDown(e){const{onEnter:t}=this.props,{menuIsOpen:n}=this.state;n?this.handleMenuKeyDown(e):e.key==="Enter"?t():e.key==="Escape"?(this.resetValue(),e.preventDefault(),e.stopPropagation()):e.key==="ArrowRight"||e.key==="ArrowLeft"||e.key==="Tab"||e.key==="Shift"||this.openMenu()}handleInputChange(e){this.setState({title:e.target.value}),this.updateInputValue(e.target.value)}handleOptionClick(e){this.setState({title:e.title,invalid:!1}),this.fireOnChange(e.value),this.closeMenu(),this.input.current?.focus()}handelInputFocus(){const{menuIsOpen:e}=this.state;e||this.openMenu()}handleInputClick(){const{menuIsOpen:e}=this.state;e||this.openMenu()}handleInputBlur(e){const{menuIsOpen:t}=this.state;t&&e.relatedTarget instanceof Element&&this.popper.current!==null&&this.popper.current.element.contains(e.relatedTarget)||this.closeMenu(!1)}handleMenuBlur(e){e.relatedTarget===this.input.current||e.relatedTarget instanceof Element&&this.popper.current!==null&&this.popper.current.element.contains(e.relatedTarget)||this.closeMenu(!1)}handleMenuOpened(){this.input.current?.focus()}handleMenuExited(){const{menuIsOpen:e}=this.state;e&&this.setState({menuIsOpen:!1,keyboardOptionIndex:0})}openMenu(){const{title:e}=this.state;this.processFilterChange(e),this.setInputWidth(),this.setState({menuIsOpen:!0}),window.requestAnimationFrame(()=>{this.popper.current?.show()})}closeMenu(e=!0){this.setState({menuIsOpen:!1,keyboardOptionIndex:0}),e&&this.input.current?.focus(),this.popper.current?.hide()}scrollOptionIntoView(e){this.menuContainer.current&&this.menuContainer.current.children.item(e)?.scrollIntoView({behavior:"smooth",block:"nearest"})}renderMenuElement(){const{inputWidth:e}=this.state;return c.jsx("div",{className:I("aci-options"),ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,style:{width:e},onBlur:this.handleMenuBlur,children:this.renderOptions()})}renderOptions(){const{noMatchText:e}=this.props,{title:t,filteredOptions:n}=this.state;return t&&n.length===0?c.jsx("div",{className:"no-match",children:e}):n.map((s,i)=>this.renderOption(s,i))}renderOption(e,t){const{keyboardOptionIndex:n}=this.state,s=`option-${t}-${e.value}`;return c.jsx("button",{type:"button",className:I("aci-option-btn",{"keyboard-active":n===t}),onClick:()=>this.handleOptionClick(e),onFocus:()=>this.setState({keyboardOptionIndex:t}),children:e.title},s)}render(){const{options:e,inputPlaceholder:t,disabled:n,className:s,defaultTitle:i,spellCheck:a,"data-testid":r}=this.props,{title:l,menuIsOpen:u,popperOptions:h,invalid:p}=this.state;return c.jsxs("div",{className:"aci-container",ref:this.cbContainer,children:[c.jsx("input",{value:l||i,className:I("form-control",s,"aci-input",{"is-invalid":p&&!u}),ref:this.input,onChange:this.handleInputChange,placeholder:t||e[0].title,disabled:n,onFocus:this.handelInputFocus,onClick:this.handleInputClick,onBlur:this.handleInputBlur,onKeyDown:this.handleInputKeyDown,spellCheck:a,"data-testid":r}),c.jsx(Oe,{ref:this.popper,options:h,className:I("aci-options-popper interactive"),onEntered:this.handleMenuOpened,onExited:this.handleMenuExited,children:this.renderMenuElement()})]})}}const mi=me;function Dt({className:o="",value:e,onChange:t,spellCheck:n=!1,placeholder:s="",disabled:i=!1,delimiter:a="",id:r="","data-testid":l}){const[u,h]=d.useState(e),[p,m]=d.useState(!1),f=d.useRef(null);d.useEffect(function(){h(e)},[e]);function S(O){return O.trim().split(a).filter($=>$).join(`
1
+ import{r as d,P as g,H as E,aC as Ls,C as c,D as Te,F as I,R as yn,N as Re,O as ne,G as Z,Z as Se,aD as js,aE as $s,a4 as Vs,a5 as Bs,aF as Hs,a1 as gt,E as Tn,aG as _s,aH as De,aI as Us,aJ as Ks,aK as Ws,aL as En,aM as qs,aN as Gs}from"./vendor-aaea4a59.js";import{T as ce,g as V,aV as zs,aW as Zs,aX as Xs,aY as Qs,ad as It,ah as xt,ae as In,aZ as xn,L as wt,ar as Js,e as Ys,a_ as ei,a$ as ti,p as ni,ac as wn,X as si,a3 as ii,m as oi,b0 as ai,c as Nn,V as ri,b1 as li,q as Le,b2 as Nt,b3 as ci}from"./index-e5fe2591.js";class ui extends d.Component{static propTypes={children:g.node.isRequired,options:g.shape({}),className:g.string,timeout:g.number,onEntered:g.func,onExited:g.func,isShown:g.bool,closeOnBlur:g.bool,interactive:g.bool,referenceObject:g.shape({}),"data-testid":g.string};static defaultProps={options:{},className:"",timeout:ce.transitionMs,onEntered(){},onExited(){},isShown:!1,interactive:!1,closeOnBlur:!1,referenceObject:null,"data-testid":void 0};constructor(e){super(e),this.handleEnter=this.handleEnter.bind(this),this.handleExit=this.handleExit.bind(this),this.handleBlur=this.handleBlur.bind(this),this.element=document.createElement("div"),this.element.className="popper-container",this.container=E.createRef(),this.rAF=0;const{isShown:t}=this.props;this.state={show:t,popper:null}}componentDidUpdate(e){const{isShown:t}=this.props;e.isShown!==t&&(t?(cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{this.show()})):this.hide())}componentWillUnmount(){this.destroyPopper(!1)}element;container;rAF;getVisibleElement(e){return e==null||e.clientHeight>0||e.clientWidth>0?e:this.getVisibleElement(e.parentElement)}initPopper(){let{popper:e}=this.state;const{closeOnBlur:t,referenceObject:n}=this.props;if(e||this.container.current===null)return;let{options:s}=this.props;s={placement:"auto",modifiers:{preventOverflow:{boundariesElement:"viewport"}},...s},document.body.appendChild(this.element);let i=this.getVisibleElement(this.container.current);i==null&&(i=this.container.current),e=new Ls(n||i,this.element,s),e.scheduleUpdate(),cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{if(t&&!this.element.contains(document.activeElement)){const a=this.element.firstElementChild;a instanceof HTMLElement&&a.focus()}}),this.setState({popper:e})}destroyPopper(e=!0){cancelAnimationFrame(this.rAF);const{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(){const{popper:e}=this.state;e&&e.scheduleUpdate()}handleBlur(e){e.relatedTarget instanceof HTMLElement&&(this.element.contains(e.relatedTarget)||this.hide())}handleEnter(){const{onEntered:e}=this.props;e()}handleExit(){const{onExited:e}=this.props,{show:t}=this.state;t||this.destroyPopper(),e()}renderContent(){const{className:e,children:t,timeout:n,interactive:s,closeOnBlur:i}=this.props,{show:a}=this.state;return c.jsx(Te,{in:a,timeout:n,classNames:"popper-transition",onEntered:this.handleEnter,onExited:this.handleExit,children:c.jsx("div",{onClick:r=>{r.stopPropagation()},onKeyDown:r=>{r.key==="Escape"&&this.hide()},className:I("popper",{interactive:s},e),onBlur:i?this.handleBlur:void 0,tabIndex:i?-1:void 0,role:"presentation",children:c.jsxs("div",{className:"popper-content",children:[t,c.jsx("div",{className:"popper-arrow","x-arrow":""})]})})})}render(){const{popper:e}=this.state,{"data-testid":t}=this.props;return c.jsx("div",{className:"popper-parent-container",ref:this.container,style:{display:"none"},"data-testid":t,children:e&&yn.createPortal(this.renderContent(),this.element)})}}const Oe=ui,di=Object.freeze(Object.defineProperty({__proto__:null,Log:V,LogHistory:zs,LogProxy:Zs,Logger:Xs,LoggerLevel:Qs,default:V},Symbol.toStringTag,{value:"Module"})),hi=V.module("Tooltip");class Q extends d.Component{static defaultTimeout=500;static defaultReshowTimeout=100;static triggerReshowThreshold=300;static shownTooltipCount=0;static lastHiddenTime=Date.now();static defaultProps={interactive:!1,options:{},popperClassName:"",reshowTimeout:Q.defaultReshowTimeout,timeout:Q.defaultTimeout,onEntered:()=>{},onExited:()=>{},"data-testid":void 0};static handleHidden(){Q.shownTooltipCount-=1,Q.shownTooltipCount===0&&(Q.lastHiddenTime=Date.now())}static handleShown(){Q.shownTooltipCount+=1}constructor(e){super(e),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleWindowMouseMove=this.handleWindowMouseMove.bind(this),this.handleWheel=this.handleWheel.bind(this),this.handleTimeout=this.handleTimeout.bind(this),this.handleExited=this.handleExited.bind(this),this.stopShowingTooltip=this.stopShowingTooltip.bind(this),this.container=E.createRef(),this.popper=E.createRef(),this.parent=null,this.timer=null,this.state={isShown:!1}}componentDidMount(){this.startListening();const{timeout:e}=this.props;e===0&&this.show()}componentDidUpdate(e,t){const{isShown:n}=t,{isShown:s}=this.state;s!==n&&(s?Q.handleShown():Q.handleHidden())}componentWillUnmount(){this.stopListening(),this.stopListeningWindow(),this.stopTimer();const{isShown:e}=this.state;e&&Q.handleHidden()}container;popper;parent;timer;startListening(){if(!this.container.current||!this.container.current.parentElement){hi.error("Tooltip doesn't have a container or a parent set!");return}this.parent=this.container.current.parentElement,this.parent.addEventListener("mousemove",this.handleMouseMove),this.parent.addEventListener("mouseleave",this.handleMouseLeave),this.parent.addEventListener("mousedown",this.stopShowingTooltip)}stopListening(){this.parent&&(this.parent.removeEventListener("mousemove",this.handleMouseMove),this.parent.removeEventListener("mouseleave",this.handleMouseLeave),this.parent.removeEventListener("mousedown",this.stopShowingTooltip))}startListeningWindow(){window.addEventListener("mousemove",this.handleWindowMouseMove,!0),window.addEventListener("contextmenu",this.stopShowingTooltip,!0),window.addEventListener("wheel",this.handleWheel)}stopListeningWindow(){window.removeEventListener("mousemove",this.handleWindowMouseMove,!0),window.removeEventListener("contextmenu",this.stopShowingTooltip,!0),window.removeEventListener("wheel",this.handleWheel)}handleMouseMove(){this.startTimer()}handleWheel(){const{isShown:e}=this.state;this.popper.current&&this.parent&&e&&!this.popper.current.element.matches(":hover")&&!this.parent.matches(":hover")&&(this.stopTimer(),this.hide())}handleMouseLeave(){const{isShown:e}=this.state;this.stopTimer();const{interactive:t}=this.props;!t&&e&&this.hide()}handleTimeout(){this.show()}handleWindowMouseMove(e){const t=e.clientX,n=e.clientY,{isShown:s}=this.state;if(!this.popper.current||!this.parent)return;const i=this.popper.current.element.getBoundingClientRect(),a=this.parent.getBoundingClientRect();t>=i.left&&t<=i.left+i.width&&n>=i.top&&n<=i.top+i.height?this.handleMouseMove():t>=a.left&&t<=a.left+a.width&&n>=a.top&&n<=a.top+a.height?this.handleMouseMove():s&&(this.stopTimer(),this.hide())}startTimer(){this.stopTimer();const{timeout:e,reshowTimeout:t}=this.props;let n=e;(Q.shownTooltipCount>0||Date.now()-Q.lastHiddenTime<Q.triggerReshowThreshold)&&(n=t),this.timer=window.setTimeout(this.handleTimeout,n)}stopTimer(){this.timer!=null&&(clearTimeout(this.timer),this.timer=null)}show(){const{isShown:e}=this.state;if(this.stopTimer(),!e){this.popper.current?.show(),this.setState({isShown:!0});const{interactive:t}=this.props;t&&this.startListeningWindow()}}hide(){this.popper.current?.hide(),this.stopListeningWindow()}update(){this.popper.current?.scheduleUpdate()}handleExited(){this.setState({isShown:!1});const{onExited:e}=this.props;e()}stopShowingTooltip(){const{isShown:e}=this.state;this.stopTimer(),e&&this.hide()}render(){const{interactive:e,children:t,referenceObject:n,popperClassName:s,"data-testid":i,onEntered:a}=this.props,{isShown:r}=this.state;let{options:l}=this.props;return l={placement:"bottom",...l},c.jsx("div",{ref:this.container,style:{display:"none"},"data-testid":i,children:c.jsx(Oe,{className:I(s),options:l,ref:this.popper,onEntered:a,onExited:this.handleExited,interactive:e,referenceObject:n,children:c.jsxs("div",{className:"tooltip-content",children:[" ",r&&t]})})})}}const kt=Q;const pi=100;var kn=(o=>(o.UP="UP",o.DOWN="DOWN",o))(kn||{});class me extends d.Component{static propTypes={options:g.arrayOf(g.shape({title:g.string.isRequired,value:g.string.isRequired})).isRequired,popperOptions:g.shape({}),onChange:g.func,inputPlaceholder:g.string,disabled:g.bool,className:g.string,defaultTitle:g.string,spellCheck:g.bool,onEnter:g.func,noMatchText:g.string,"data-testid":g.string};static defaultProps={onChange(){},inputPlaceholder:"",disabled:!1,className:"",defaultTitle:"",popperOptions:null,spellCheck:!0,onEnter(){},noMatchText:"No matching items found","data-testid":void 0};static MENU_NAVIGATION_DIRECTION=kn;constructor(e){super(e);let{popperOptions:t}=this.props;t={placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}},...t},this.state={title:"",filteredOptions:[],keyboardOptionIndex:0,menuIsOpen:!1,inputWidth:100,invalid:!1,popperOptions:t},this.handleMenuKeyDown=this.handleMenuKeyDown.bind(this),this.handleMenuBlur=this.handleMenuBlur.bind(this),this.handleInputChange=this.handleInputChange.bind(this),this.handleInputKeyDown=this.handleInputKeyDown.bind(this),this.handleInputBlur=this.handleInputBlur.bind(this),this.handelInputFocus=this.handelInputFocus.bind(this),this.handleInputClick=this.handleInputClick.bind(this),this.updateInputValue=Re(this.updateInputValue,pi),this.handleOptionClick=this.handleOptionClick.bind(this),this.handleMenuOpened=this.handleMenuOpened.bind(this),this.handleMenuExited=this.handleMenuExited.bind(this),this.popper=E.createRef(),this.cbContainer=E.createRef(),this.menuContainer=E.createRef(),this.input=E.createRef()}popper;cbContainer;menuContainer;input;setInputWidth(){this.cbContainer.current&&this.setState({inputWidth:this.cbContainer.current.getBoundingClientRect().width})}getCachedFilteredOptions=ne((e,t)=>e.filter(n=>n.title.toLowerCase().indexOf(t.toLowerCase())>=0));getValueAndValidate(e){if(!e)return this.setState({invalid:!1}),{value:e,isValid:!1};const{options:t}=this.props,n=t.filter(s=>s.title.toLowerCase()===e.toLowerCase());return n.length<1?(this.setState({invalid:!0}),{value:e,isValid:!1}):(this.setState({invalid:!1}),{value:n[0].value,isValid:!0})}updateInputValue(e){const{menuIsOpen:t}=this.state,{value:n,isValid:s}=this.getValueAndValidate(e);t&&this.processFilterChange(e),this.fireOnChange(n,s)}fireOnChange(e,t=!0){const{onChange:n}=this.props;n(e,t)}processFilterChange(e){const{options:t}=this.props,{menuIsOpen:n}=this.state,s=e?this.getCachedFilteredOptions(t,e):t,i=s.length===1&&s[0].title===e;if(this.setState({filteredOptions:s,keyboardOptionIndex:0}),i&&n){this.closeMenu();return}this.popper.current?.scheduleUpdate()}resetValue(){this.setState({title:""}),this.fireOnChange("")}handleResize(){this.setInputWidth()}handleMenuKeyDown(e){const{filteredOptions:t,keyboardOptionIndex:n}=this.state,s=t[n];switch(e.key){case"Enter":case"ArrowRight":e.stopPropagation(),e.preventDefault(),s!=null&&(this.setState({title:s.title,invalid:!1}),this.fireOnChange(s.value)),this.closeMenu(),this.input.current?.focus();break;case"ArrowUp":e.stopPropagation(),e.preventDefault(),this.navigateMenu(me.MENU_NAVIGATION_DIRECTION.UP);break;case"ArrowDown":e.stopPropagation(),e.preventDefault(),this.navigateMenu(me.MENU_NAVIGATION_DIRECTION.DOWN);break;case"Tab":if(e.stopPropagation(),e.preventDefault(),e.shiftKey){this.navigateMenu(me.MENU_NAVIGATION_DIRECTION.UP);break}this.navigateMenu(me.MENU_NAVIGATION_DIRECTION.DOWN);break;case"Escape":e.preventDefault(),e.stopPropagation(),this.closeMenu();break}}navigateMenu(e){const{filteredOptions:t,keyboardOptionIndex:n}=this.state;let s=n;e===me.MENU_NAVIGATION_DIRECTION.UP?n>0?(s=(s-1)%t.length,this.setState({keyboardOptionIndex:s})):n===0&&(s=t.length-1,this.setState({keyboardOptionIndex:s})):e===me.MENU_NAVIGATION_DIRECTION.DOWN&&n<t.length&&(s=(s+1)%t.length,this.setState({keyboardOptionIndex:s})),this.scrollOptionIntoView(s)}handleInputKeyDown(e){const{onEnter:t}=this.props,{menuIsOpen:n}=this.state;n?this.handleMenuKeyDown(e):e.key==="Enter"?t():e.key==="Escape"?(this.resetValue(),e.preventDefault(),e.stopPropagation()):e.key==="ArrowRight"||e.key==="ArrowLeft"||e.key==="Tab"||e.key==="Shift"||this.openMenu()}handleInputChange(e){this.setState({title:e.target.value}),this.updateInputValue(e.target.value)}handleOptionClick(e){this.setState({title:e.title,invalid:!1}),this.fireOnChange(e.value),this.closeMenu(),this.input.current?.focus()}handelInputFocus(){const{menuIsOpen:e}=this.state;e||this.openMenu()}handleInputClick(){const{menuIsOpen:e}=this.state;e||this.openMenu()}handleInputBlur(e){const{menuIsOpen:t}=this.state;t&&e.relatedTarget instanceof Element&&this.popper.current!==null&&this.popper.current.element.contains(e.relatedTarget)||this.closeMenu(!1)}handleMenuBlur(e){e.relatedTarget===this.input.current||e.relatedTarget instanceof Element&&this.popper.current!==null&&this.popper.current.element.contains(e.relatedTarget)||this.closeMenu(!1)}handleMenuOpened(){this.input.current?.focus()}handleMenuExited(){const{menuIsOpen:e}=this.state;e&&this.setState({menuIsOpen:!1,keyboardOptionIndex:0})}openMenu(){const{title:e}=this.state;this.processFilterChange(e),this.setInputWidth(),this.setState({menuIsOpen:!0}),window.requestAnimationFrame(()=>{this.popper.current?.show()})}closeMenu(e=!0){this.setState({menuIsOpen:!1,keyboardOptionIndex:0}),e&&this.input.current?.focus(),this.popper.current?.hide()}scrollOptionIntoView(e){this.menuContainer.current&&this.menuContainer.current.children.item(e)?.scrollIntoView({behavior:"smooth",block:"nearest"})}renderMenuElement(){const{inputWidth:e}=this.state;return c.jsx("div",{className:I("aci-options"),ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,style:{width:e},onBlur:this.handleMenuBlur,children:this.renderOptions()})}renderOptions(){const{noMatchText:e}=this.props,{title:t,filteredOptions:n}=this.state;return t&&n.length===0?c.jsx("div",{className:"no-match",children:e}):n.map((s,i)=>this.renderOption(s,i))}renderOption(e,t){const{keyboardOptionIndex:n}=this.state,s=`option-${t}-${e.value}`;return c.jsx("button",{type:"button",className:I("aci-option-btn",{"keyboard-active":n===t}),onClick:()=>this.handleOptionClick(e),onFocus:()=>this.setState({keyboardOptionIndex:t}),children:e.title},s)}render(){const{options:e,inputPlaceholder:t,disabled:n,className:s,defaultTitle:i,spellCheck:a,"data-testid":r}=this.props,{title:l,menuIsOpen:u,popperOptions:h,invalid:p}=this.state;return c.jsxs("div",{className:"aci-container",ref:this.cbContainer,children:[c.jsx("input",{value:l||i,className:I("form-control",s,"aci-input",{"is-invalid":p&&!u}),ref:this.input,onChange:this.handleInputChange,placeholder:t||e[0].title,disabled:n,onFocus:this.handelInputFocus,onClick:this.handleInputClick,onBlur:this.handleInputBlur,onKeyDown:this.handleInputKeyDown,spellCheck:a,"data-testid":r}),c.jsx(Oe,{ref:this.popper,options:h,className:I("aci-options-popper interactive"),onEntered:this.handleMenuOpened,onExited:this.handleMenuExited,children:this.renderMenuElement()})]})}}const mi=me;function Dt({className:o="",value:e,onChange:t,spellCheck:n=!1,placeholder:s="",disabled:i=!1,delimiter:a="",id:r="","data-testid":l}){const[u,h]=d.useState(e),[p,m]=d.useState(!1),f=d.useRef(null);d.useEffect(function(){h(e)},[e]);function S(O){return O.trim().split(a).filter($=>$).join(`
2
2
  ${a.trim()}`)}function v(O){return O.split(`
3
3
  `).map($=>$.trim()).join(" ")}function C(){if(!f.current)return;f.current.style.height="0";const O=f.current.scrollHeight+(f.current.offsetHeight-f.current.clientHeight);O>0&&(f.current.style.height=`${O}px`)}function x(O){let $=O.target.value;p&&(a&&($=S($)),m(!1)),h($),t($)}function k(){f.current&&(a&&(h(S(u)),C()),f.current.scrollLeft=0)}function M(){f.current&&document.activeElement!==f.current&&f.current.focus()}function A(){a&&(h(v(u)),t(v(u)))}function F(){m(!0)}return d.useEffect(function(){C()},[u]),c.jsx("textarea",{ref:f,id:r,className:I(o,"auto-resize-textarea form-control"),placeholder:s,value:u,rows:1,onChange:x,onFocus:k,onMouseDown:M,onBlur:A,onPaste:F,spellCheck:n,disabled:i,"data-testid":l})}Dt.propTypes={value:g.string.isRequired,onChange:g.func.isRequired,className:g.string,placeholder:g.string,spellCheck:g.bool,disabled:g.bool,delimiter:g.string,id:g.string,"data-testid":g.string};Dt.defaultProps={className:"",id:"",placeholder:"",disabled:!1,spellCheck:!1,delimiter:"","data-testid":void 0};function je(o){const{children:e,className:t,style:n,"data-testid":s}=o;return c.jsx("div",{className:I("btn-group",t),style:n,role:"group","data-testid":s,children:e})}je.displayName="ButtonGroup";je.propTypes={children:g.node.isRequired,className:g.string,style:g.object,"data-testid":g.string};je.defaultProps={className:null,style:{},"data-testid":void 0};const fi=["primary","secondary","tertiary","success","danger","inline","ghost"],gi=["group-end"];function bi(o,e){switch(o){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 I("btn-link",{"btn-link-icon":e,"btn-link-icon-only":e})}}function Ci(o){switch(o){case"group-end":return I("pl-2","pr-3")}}const Je=E.forwardRef((o,e)=>{const{kind:t,variant:n,type:s,tooltip:i,icon:a,disabled:r=!1,active:l,onClick:u,onContextMenu:h,onMouseDown:p,onMouseUp:m,onMouseEnter:f,onMouseLeave:S,onKeyDown:v,className:C,style:x,children:k,tabIndex:M,"data-testid":A,"aria-label":F,...O}=o,$=!!(a&&k==null),B=bi(t,$);let ee;n&&(ee=Ci(n));let j;a&&(j=E.isValidElement(a)?a:c.jsx(Z,{icon:a}));let R;i!==void 0&&(R=typeof i=="string"?c.jsx(kt,{children:i}):i);let H=F;F===void 0&&$&&i!=null&&typeof i=="string"&&(H=i);const N=c.jsxs("button",{"data-testid":A,ref:e,type:s,className:I("btn",B,ee,{active:l},C),onClick:u,onContextMenu:h,onMouseUp:m,onMouseDown:p,onMouseEnter:f,onMouseLeave:S,onKeyDown:v,style:x,disabled:r,tabIndex:M,"aria-label":H,...O,children:[a&&j,k,i!=null&&!r&&R]});return r?c.jsxs("span",{className:"btn-disabled-wrapper",children:[N,i!==void 0&&R]}):N});Je.displayName="Button";Je.propTypes={kind:g.oneOf(fi).isRequired,variant:g.oneOf(gi),type:g.oneOf(["submit","reset","button"]),tooltip(o){const{tooltip:e,icon:t,children:n}=o;return e===void 0&&t!=null&&n==null?new Error("Tooltip is required for icon only buttons"):null},icon(o){const{children:e,icon:t}=o;return t==null&&e==null?new Error("Icon is required if no children are provided"):e==null&&!E.isValidElement(t)&&(t==null||t.iconName===""||t.iconName==null)?new Error("Icon must be react element or fontawesome IconDefinition"):null},disabled:g.bool,active:g.bool,onClick(o){const{onClick:e,type:t}=o;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:g.func,onMouseUp:g.func,onMouseDown:g.func,onMouseEnter:g.func,onMouseLeave:g.func,onKeyDown:g.func,tabIndex:g.number,children:g.node,className:g.string,style:g.object,"data-testid":g.string};Je.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 se=Je;function $e(o,e="No value available in context. Was code wrapped in a provider?"){const t=d.useContext(o);if(t==null)throw new Error(e);return t}function Ot(o){const e=d.useRef();return d.useEffect(function(){e.current=o}),e.current}function At(o){const e=d.useRef(null);return d.useEffect(function(){o&&(typeof o=="function"?o(e.current):o.current=e.current)}),e}const Tr=Object.freeze([]),Er=new Map,Si=()=>{};class vi extends Error{isCanceled=!0}const bt=vi;async function Mi(o){const{clipboard:e}=navigator;if(e!==void 0)try{return navigator.clipboard.writeText(o)}catch{return Yt(o)}Yt(o)}function Yt(o){const e=document.activeElement,t=document.createElement("textarea");t.value=o,document.body.appendChild(t),t.focus(),t.select();const n=document.execCommand("copy");if(document.body.removeChild(t),e instanceof HTMLElement&&e.focus(),!n)throw new Error("Unable to execute copy command")}class Dn extends CustomEvent{constructor(e,t){super(e,t)}}class yi extends Error{isTimeout=!0}const Ye=yi;class Pe{static makeCancelable(e,t){let n=!1,s,i;const a=new Promise((r,l)=>{i=l,Promise.resolve(e).then(u=>{n?t&&t(u):(s=u,r(u))}).catch(u=>l(u))});return a.cancel=()=>{n=!0,i(new bt),s!=null&&t&&t(s)},a}static isCanceled(e){return e instanceof bt}static isTimedOut(e){return e instanceof Ye}static withTimeout(e,t){return new Promise((n,s)=>{setTimeout(()=>{try{n(t())}catch(i){s(i)}},e)})}}function Ti(o){if(o==null)throw new Error("Value is null or undefined")}function Ir(o,e,t=void 0){const n=o.get(e)??t;if(n!==void 0)return n;throw new Error(`Missing value for key ${e}`)}function qe(o){let e=o;o instanceof CustomEvent&&(e=o.detail);let t="";if(e instanceof Error?t=e.message:e!=null&&(t=`${e}`),t=t.trim(),t.length>0)return t}class Ft{static isValidRange(e){return e!=null&&e.length===2&&Number.isInteger(e[0])&&Number.isInteger(e[1])&&e[0]<=e[1]}static validateRange(e){if(!Ft.isValidRange(e))throw new Error(`Invalid range! ${e}`)}static isSelected(e,t){for(let n=0;n<e.length;n+=1){const s=e[n],i=s[0],a=s[1];if(i<=t&&t<=a)return!0}return!1}static selectRange(e,t){let[n,s]=t;const i=[...e];for(let a=i.length-1;a>=0;a-=1){const r=i[a],l=r[0],u=r[1];if(l<=n&&s<=u)return i;n<=u&&l<=s&&(n=Math.min(n,l),s=Math.max(s,u),i.splice(a,1))}return i.push([n,s]),i}static deselectRange(e,t){const[n,s]=t,i=[...e];for(let a=i.length-1;a>=0;a-=1){const r=i[a],l=r[0],u=r[1];if(!(s<l||u<n))if(l<n&&s<u){i[a]=[l,n-1],i.splice(a+1,0,[s+1,u]);break}else n<=l&&u<=s?i.splice(a,1):l<n?i[a]=[l,n-1]:i[a]=[s+1,u]}return i}static count(e){return e.reduce((t,n)=>t+(n[1]-n[0]+1),0)}static getItemsInRanges(e,t){return t.reduce((n,s)=>{const i=[...n];for(let a=s[0];a<=s[1];a+=1)i.push(e[a]);return i},[])}}const le=Ft;class Ei{static join(e,t="and"){if(e==null||e.length===0)return"";if(e.length===1)return e[0];if(e.length===2)return`${e[0]} ${t} ${e[1]}`;const n=e.slice(0,e.length-1).join(", "),s=e[e.length-1];return`${n}, ${t} ${s}`}static toLower(e,t=!0){if(e==null){if(t)return"";throw new Error("Null string passed in to TextUtils.toLower")}return e.toLowerCase()}static sort(e,t,n=!0){return e<t?n?-1:1:e>t?n?1:-1:0}}const Ii=Ei;class Rt{static TIME_PATTERN="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]";static TIME_ZONES=Object.freeze([{label:"Tokyo UTC+9 No DST",value:"Asia/Tokyo"},{label:"Seoul UTC+9 No DST",value:"Asia/Seoul"},{label:"Hong Kong UTC+8 No DST",value:"Asia/Hong_Kong"},{label:"Singapore UTC+8 No DST",value:"Asia/Singapore"},{label:"Kolkata UTC+5:30 No DST",value:"Asia/Kolkata"},{label:"Berlin UTC+1",value:"Europe/Berlin"},{label:"UTC UTC±0 No DST",value:"UTC"},{label:"London UTC±0",value:"Europe/London"},{label:"Sao Paulo UTC-2",value:"America/Sao_Paulo"},{label:"Newfoundland UTC-3:30",value:"America/St_Johns"},{label:"Halifax UTC-4",value:"America/Halifax"},{label:"New York UTC−5",value:"America/New_York"},{label:"Chicago UTC-6",value:"America/Chicago"},{label:"Denver UTC-7",value:"America/Denver"},{label:"Los Angeles UTC-8",value:"America/Los_Angeles"},{label:"Anchorage UTC-9",value:"America/Anchorage"},{label:"Honolulu UTC-10 No DST",value:"Pacific/Honolulu"},{label:"Zurich UTC+1",value:"Europe/Zurich"},{label:"Amsterdam UTC+1",value:"Europe/Amsterdam"},{label:"Taipei UTC+8 No DST",value:"Asia/Taipei"},{label:"Sydney UTC+10",value:"Australia/Sydney"}]);static formatElapsedTime(e){if(typeof e!="number"||!Number.isInteger(e))throw new Error(`${e} is not a number that can be expressed as a formatted time`);const t=Math.floor(e/3600),n=Math.floor(e%3600/60),s=e%60;return`${t>0?`${t}h `:""}${n>0||t>0?`${n}m `:""}${e>=60?`${s}s`.padStart(3,"0"):`${s}s`}`}static formatTime(e){if(typeof e!="number"||!Number.isInteger(e)||e<0)throw new Error(`${e} is not a number that can be expressed as a formatted time`);const t=String(Math.floor(e/(60*60))).padStart(2,"0"),n=e%(60*60),s=String(Math.floor(n/60)).padStart(2,"0"),i=n%60,a=String(Math.ceil(i)).padStart(2,"0");return`${t}:${s}:${a}`}static isTimeString(e){return new RegExp(Rt.TIME_PATTERN).test(e)}static parseTime(e){if(e==null||typeof e!="string")throw new Error(`${e} is not a valid string`);const t=e.split(":");if(t.length!==3)throw new Error(`${e} is not a time string that can be parsed`);return Number(t[0])*60*60+Number(t[1])*60+Number(t[2])}}const Ae=Rt,xi=3500,wi=V.module("useCopyToClipboard");function On(){const[o,e]=d.useState(!1),t=d.useRef(null),n=d.useCallback(s=>{Mi(s).then(()=>{e(!0)}).catch(i=>wi.error(`Unable to copy ${s}`,`
4
4
  `,i))},[]);return d.useEffect(()=>(t.current&&clearTimeout(t.current),o&&(t.current=setTimeout(()=>{e(!1)},xi)),()=>{t.current&&clearTimeout(t.current)}),[o]),[o,n]}function Ni(o){o.preventDefault()}function ki(o=!1){const e=d.useMemo(()=>`useSubmitButtonRef-${Se()}`,[]),t=d.useCallback(i=>{i?.UNSAFE_getDOMNode().setAttribute("form",e)},[e]),n=d.useMemo(()=>({id:e,onSubmit:o?void 0:Ni}),[e,o]),s=d.useMemo(()=>({form:e,ref:t}),[e,t]);return{formProps:n,submitButtonProps:s}}function An(o,e,{autoLoad:t=!0}={}){const[n,s]=d.useState(null),[i,a]=d.useState(null),[r,l]=d.useState(!1),u=d.useCallback(async()=>{l(!0);try{const h=await o(...e);s(h),a(null)}catch(h){s(null),a(h)}finally{l(!1)}},[o,...e]);return d.useEffect(()=>{t&&u()},[t,u]),{data:n,error:i,isError:i!=null,isLoading:r,reload:u}}function Fn(o,e){const[t,n]=d.useState(o);return d.useEffect(()=>{const s=setTimeout(()=>{n(o)},e);return()=>{clearTimeout(s)}},[o,e]),t}const Di=Object.freeze(Object.defineProperty({__proto__:null,useContextOrThrow:$e,useCopyToClipboard:On,useDebouncedValue:Fn,useFormWithDetachedSubmitButton:ki,useForwardedRef:At,usePrevious:Ot,usePromiseFactory:An},Symbol.toStringTag,{value:"Module"}));function Oi({blockInteraction:o=!0,children:e,debounceMs:t,isOpen:n=!1}){const s=Fn(n,t);return c.jsxs(c.Fragment,{children:[o&&n&&c.jsx("div",{className:"modal-backdrop",style:{backgroundColor:"transparent"},"data-testid":"debounced-modal-backdrop"}),E.cloneElement(e,{isOpen:n&&s})]})}function Ai({className:o,icon:e,isOpen:t=!1,subtitle:n,title:s}){return c.jsx(It,{isOpen:t,className:o,children:c.jsx(xt,{children:c.jsxs("div",{className:"info-modal",children:[e!=null&&c.jsx("div",{className:"message-icon",children:c.jsx(Z,{icon:e})}),c.jsx("div",{className:"message-header",children:s}),n!=null&&c.jsx("div",{className:"message-content",children:n})]})})})}function Rn({className:o="modal-footer",children:e,"data-testid":t}){return c.jsx("div",{className:o,"data-testid":t,children:e})}function Pt(o){const{isOpen:e,headerText:t,bodyText:n,onCancel:s,onConfirm:i,onDiscard:a,onModalDisable:r,cancelButtonText:l="Cancel",confirmButtonText:u="Okay",discardButtonText:h="Discard",isConfirmDanger:p=!1,children:m,"data-testid":f}=o,S=d.useRef(null),v=d.useRef(null),C=d.useCallback(()=>{v.current!==null&&v.current.checked&&r&&r(),i()},[i,r]),x=d.useCallback(()=>{S.current?.focus()},[]);let k="";return e&&(k=typeof n=="function"?n():n),c.jsxs(It,{isOpen:e,className:"theme-bg-light",onOpened:x,children:[c.jsx(In,{closeButton:!1,children:t}),c.jsx(xt,{children:k}),c.jsxs(Rn,{children:[r&&c.jsxs("div",{className:"custom-control custom-checkbox form-group mr-auto",children:[c.jsx("input",{type:"checkbox",className:"custom-control-input",id:"move-confirmation-checkbox",defaultChecked:!1,ref:v,"data-testid":f!==void 0?`${f}-checkbox-confirm`:void 0}),c.jsx("label",{className:"custom-control-label",htmlFor:"move-confirmation-checkbox",children:"Don't ask me again"})]}),a&&c.jsx(se,{kind:"secondary",className:"mr-auto","data-dismiss":"modal",onClick:a,"data-testid":f!==void 0?`${f}-btn-discard`:void 0,children:h}),s&&c.jsx(se,{kind:"secondary","data-dismiss":"modal",onClick:s,"data-testid":f!==void 0?`${f}-btn-cancel`:void 0,children:l}),c.jsxs(je,{children:[c.jsx(se,{kind:p?"danger":"primary",onClick:C,ref:S,"data-testid":f!==void 0?`${f}-btn-confirm`:void 0,children:u}),m]})]})]})}Pt.propTypes={isOpen:g.bool.isRequired,headerText:g.string.isRequired,bodyText:g.oneOfType([g.string,g.func]).isRequired,onCancel:g.func,onConfirm:g.func.isRequired,onDiscard:g.func,onModalDisable:g.func,cancelButtonText:g.string,confirmButtonText:g.string,discardButtonText:g.string,children:g.node,"data-testid":g.string};Pt.defaultProps={children:void 0,cancelButtonText:"Cancel",confirmButtonText:"Okay",discardButtonText:"Discard",onCancel:void 0,onDiscard:void 0,onModalDisable:void 0,"data-testid":void 0};const et=E.forwardRef((o,e)=>{const{children:t,className:n,disabled:s,onClick:i,style:a,id:r}=o;return c.jsx("button",{ref:e,type:"button",className:I("btn",n),onClick:i,style:a,disabled:s,id:r,children:t})});et.displayName="Button";et.propTypes={children:g.node,className:g.string,disabled:g.bool,onClick:g.func,style:g.shape({}),id:g.string};et.defaultProps={children:null,className:"",disabled:!1,onClick:()=>null,style:{},id:""};const Fi=et;function Ri({className:o,isFlipped:e,children:t,"data-testid":n}){const s=l=>{if(t.length!==2)throw new Error("CardFlip requires 2 children to function");return t[l]},i=d.useRef(null),a=d.useCallback(l=>{l.target===l.currentTarget&&document.body.classList.add("card-flip--is-flipping")},[]),r=d.useCallback(l=>{l.target===l.currentTarget&&document.body.classList.remove("card-flip--is-flipping")},[]);return d.useEffect(function(){if(!i.current)throw Error("ref undefined");i.current.addEventListener("transitionstart",a);const u=i.current;return function(){if(u!=null)return u.removeEventListener("transitionstart",a)}},[a]),c.jsxs("div",{className:I(o,{"card-flip--show-front":e,"card-flip--show-back":!e}),"data-testid":n,children:[c.jsx("div",{className:"card-flip--back",children:s(0)}),c.jsx("div",{ref:i,className:"card-flip--front",onTransitionEnd:r,children:s(1)})]})}function dt(o){return o.then!==void 0}class ye{static actionsDisabled=!1;static disableAllActions(){ye.actionsDisabled=!0}static enableAllActions(){ye.actionsDisabled=!1}static isContextActionEvent(e){return Array.isArray(e.contextActions)}static compareActions(e,t){return e.group!==t.group?(e.group??0)>(t.group??0)?1:-1:e.order!==t.order?(e.order??0)>(t.order??0)?1:-1:e.title!==t.title?(e.title??"")>(t.title??"")?1:-1:e!==t?e>t?1:-1:0}static sortActions(e){if(e==null||!Array.isArray(e))return[];const t=e.slice();return t.sort(ye.compareActions),t}static isMacPlatform(){const{platform:e}=window.navigator;return e.startsWith("Mac")}static getModifierKey(){return ye.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(e){const t=ye.getModifierKey();return e[t]}static getMenuItems(e,t=!0){let n=[],s=e;Array.isArray(s)||(s=[s]);for(let i=0;i<s.length;i+=1){const a=s[i];let r;typeof a=="function"?r=a():r=a,r!=null&&(r instanceof Promise?t&&n.push(r):Array.isArray(r)?n=n.concat(r):n.push(r))}return n=n.filter(i=>i.title!==void 0||i.then!=null||i.menuElement),n}static getNextMenuItem(e,t,n){let s=e;s<0&&t<0&&(s=n.length);for(let i=1;i<n.length+1;i+=1){const a=(s+t*i+n.length)%n.length,r=n[a];if(!(r instanceof Promise)&&r.disabled!==!0)return a}return e}}const U=ye,en=V.module("GlobalContextAction");class Pi extends d.Component{constructor(e){super(e),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}componentDidMount(){document.body.addEventListener("contextmenu",this.handleContextMenu),document.body.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.body.removeEventListener("contextmenu",this.handleContextMenu),document.body.removeEventListener("keydown",this.handleKeyDown)}handleContextMenu(e){const t=e;t.contextActions==null&&(t.contextActions=[]);const{action:n}=this.props;n.title==null&&!n.menuElement||(t.contextActions==null&&(t.contextActions=[]),t.contextActions.push(n),en.debug("Received context menu event at global action! Menu items are now: ",t.contextActions))}handleKeyDown(e){const{action:t}=this.props;!U.actionsDisabled&&t.shortcut!==void 0&&t.shortcut.matchesEvent(e)&&(en.debug("Global hotkey matched!",e),t.action?.(e),e.preventDefault(),e.stopPropagation())}render(){return null}}const Li=Pi;class ji extends d.Component{render(){const{actions:e,"data-testid":t}=this.props,n=[];for(let s=0;s<e.length;s+=1){const i=e[s],{shortcut:a}=i;if(i.title!=null||i.menuElement||a){const r=c.jsx(Li,{action:i,"data-testid":t},`${i.title}.${a?.id}`);n.push(r)}}return n}}const $i=ji;const He=V.module("ContextActions");class Vi extends d.Component{static groups={default:null,high:100,medium:5e3,low:1e4,global:1e5,edit:100};static triggerMenu(e,t,n,s){if(s.length===0)return;const i=new MouseEvent("contextmenu",{clientX:t,clientY:n,bubbles:!0,cancelable:!0});i.contextActions=s,e.dispatchEvent(i)}constructor(e){super(e),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.container=E.createRef(),this.state={globalActions:[],keyboardActions:[]}}static getDerivedStateFromProps(e){if(e.actions==null||!Array.isArray(e.actions))return{globalActions:[],keyboardActions:[]};const t=e.actions.filter(s=>!dt(s)&&typeof s!="function"&&s.isGlobal),n=e.actions.filter(s=>!dt(s)&&typeof s!="function"&&(s.isGlobal===void 0||!s.isGlobal)&&s.shortcut!=null);return{globalActions:t,keyboardActions:n}}componentDidMount(){this.container.current?.parentElement&&(this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.addEventListener("keydown",this.handleKeyDown))}componentWillUnmount(){this.container.current?.parentElement&&(this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.removeEventListener("keydown",this.handleKeyDown))}container;handleContextMenu(e){const{ignoreClassNames:t=[]}=this.props;if(t.length>0){let s=e.target;for(;s!=null;){const{classList:i}=s,a=t.find(r=>i.contains(r));if(a!==void 0){He.debug2(`Contextmenu event ignored based on the target className "${a}"`);return}s=s.parentElement}}if(U.isContextActionEvent(e)||(e.contextActions=[]),!U.isContextActionEvent(e))return;const{actions:n}=this.props;if(n!=null){let s=n;Array.isArray(s)&&(s=s.filter(i=>dt(i)||typeof i=="function"||i.isGlobal===void 0||!i.isGlobal)),e.contextActions=e.contextActions.concat(s)}He.debug("Received context menu event! Menu items are now: ",e.contextActions)}handleKeyDown(e){const{keyboardActions:t}=this.state;for(let n=0;n<t.length;n+=1){const s=t[n];!U.actionsDisabled&&s.shortcut!=null&&s.shortcut.matchesEvent(e)&&(He.debug("Context hotkey matched!",e),s.action?.(e),e.stopPropagation(),e.preventDefault(),He.debug2("Matched hotkey returned false, key event not consumed"))}}render(){const{"data-testid":e}=this.props,{globalActions:t}=this.state;return c.jsx("div",{className:"context-actions-listener",ref:this.container,"data-testid":e,children:c.jsx($i,{actions:t})})}}const Bi=Vi,Lt=E.forwardRef((o,e)=>{function t(C){const{menuItem:x,onMenuItemClick:k}=o;k(x,C)}function n(C){const{menuItem:x,onMenuItemMouseMove:k}=o;k(x,C)}function s(C){const{menuItem:x,onMenuItemContextMenu:k}=o;k(x,C)}function i(C,x,k){if(typeof C.type=="string")return C;const{closeMenu:M,menuItem:A,isKeyboardSelected:F,isMouseSelected:O,"data-testid":$}=o,B={menuItem:A,closeMenu:M,isKeyboardSelected:F,isMouseSelected:O,iconElement:x,displayShortcut:k,"data-testid":$};return E.cloneElement(C,{forwardedProps:B})}const{children:a,menuItem:r,isKeyboardSelected:l=!1,isMouseSelected:u=!1,"data-testid":h}=o,p=r.shortcut?.getDisplayText();let m=null;if(r.icon){const C=r.icon;if(E.isValidElement(C))m=C;else{let x;r.iconColor!=null&&(r.disabled===void 0||!r.disabled)&&(x={color:r.iconColor}),m=c.jsx(Z,{icon:C,style:x})}}let f=null;const S=!!a;r.actions&&(f=c.jsx(Z,{icon:xn}));let v=null;if(r.menuElement)v=c.jsx("div",{className:"custom-menu-item",onMouseMove:n,children:i(r.menuElement,m,p)});else{const C=r.disabled,x=r.iconOutline;v=c.jsx("button",{type:"button",className:I("btn-context-menu",{disabled:C},{active:(S||u)&&(C===void 0||!C)},{"keyboard-active":l&&(C===void 0||!C)}),onClick:t,onMouseMove:n,onContextMenu:s,title:r.description??"",children:c.jsxs("div",{className:"btn-context-menu-wrapper",children:[c.jsx("span",{className:I("icon",{outline:x}),children:m}),c.jsx("span",{className:"title",children:r.title}),p!==void 0&&c.jsx("span",{className:"shortcut",children:p}),f&&c.jsx("span",{className:I("submenu-indicator",{disabled:C}),children:f})]})})}return c.jsxs("div",{className:"context-menu-item",ref:e,"data-testid":h,children:[a,v]})});Lt.displayName="ContextMenuItem";Lt.defaultProps={children:null,isKeyboardSelected:!1,isMouseSelected:!1,"data-testid":void 0};const jt=Lt,tn=V.module("ContextMenu");class Ge extends d.PureComponent{static defaultProps={subMenuParentWidth:0,subMenuParentHeight:0,closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0};static handleContextMenu(e){e.metaKey||(e.stopPropagation(),e.preventDefault())}constructor(e){super(e),this.handleBlur=this.handleBlur.bind(this),this.handleCloseSubMenu=this.handleCloseSubMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMenuItemClick=this.handleMenuItemClick.bind(this),this.handleMenuItemContextMenu=this.handleMenuItemContextMenu.bind(this),this.handleMenuItemMouseMove=this.handleMenuItemMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleWindowResize=this.handleWindowResize.bind(this),this.container=E.createRef(),this.oldFocus=document.activeElement,this.activeSubMenuRef=E.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(()=>{this.container.current?.focus();const{onMenuOpened:e}=this.props;e(this)})}componentDidUpdate(e,t){const{actions:n}=this.props,{activeSubMenu:s}=this.state;s!==t.activeSubMenu&&(s==null?this.container.current?.focus():this.setActiveSubMenuPosition()),e.actions!==n&&(this.initMenu(),(this.container.current==null||!this.container.current.contains(document.activeElement))&&this.container.current?.focus()),this.verifyPosition()}componentWillUnmount(){this.cancelPromises(),window.removeEventListener("resize",this.handleWindowResize),cancelAnimationFrame(this.rAF)}container;oldFocus;activeSubMenuRef;subMenuTimer;rAF;initialPosition;getKeyboardIndex(){const{options:e}=this.props;if(e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse){const{keyboardIndex:t}=this.state;return t}return this.getMouseIndex()}setKeyboardIndex(e){const{options:t}=this.props;t.separateKeyboardMouse!==void 0&&t.separateKeyboardMouse?this.setState({keyboardIndex:e}):this.setMouseIndex(e)}getMouseIndex(){const{mouseIndex:e}=this.state;return e}setMouseIndex(e){this.setState({mouseIndex:e})}initMenu(){this.cancelPromises(),cancelAnimationFrame(this.rAF);const{options:e}=this.props;let t=e.initialKeyboardIndex;t===void 0&&(t=-1);const{actions:n}=this.props,s=U.getMenuItems(n),i=[];for(let a=s.length-1;a>=0;a-=1){const r=s[a];r instanceof Promise?this.initMenuPromise(r):i.push(r)}this.setState({mouseIndex:-1,keyboardIndex:t,activeSubMenu:null,menuItems:U.sortActions(i)})}initMenuPromise(e){const t=Pe.makeCancelable(e);this.setState(n=>({pendingItems:n.pendingItems.concat(t)})),t.then(n=>{this.setState(s=>{const i=s.pendingItems.indexOf(t);if(i>=0){const a=s.pendingItems.slice();return a.splice(i,1),{menuItems:U.sortActions(s.menuItems.concat(n)),pendingItems:a}}return null})},n=>{Pe.isCanceled(n)||(this.setState(s=>{const i=s.pendingItems.indexOf(t);if(i>=0){const a=s.pendingItems.slice();return a.splice(i,1),{pendingItems:a}}return null}),tn.error(n))})}cancelPromises(){const{pendingItems:e}=this.state;e.map(t=>t.cancel())}setActiveSubMenuPosition(){if(this.activeSubMenuRef.current===null)return;const e=this.activeSubMenuRef.current.getBoundingClientRect();this.setState({subMenuTop:e.top,subMenuLeft:e.right,subMenuParentHeight:e.height,subMenuParentWidth:e.width})}verifyPosition(){const{options:e,updatePosition:t,subMenuParentWidth:n,subMenuParentHeight:s,top:i,left:a}=this.props;if(!this.container.current||e.doNotVerifyPosition!=null&&e.doNotVerifyPosition)return;let{top:r,left:l}=this.initialPosition;const{width:u,height:h}=this.container.current?.getBoundingClientRect()??{width:0,height:0},p=(this.container.current?.scrollHeight??0)>window.innerHeight;h===0||u===0||(r+h>window.innerHeight&&(r-h-s>0?r-=h-s:r=window.innerHeight-h),l+u>window.innerWidth&&(l=l-u-n),(a!==l||i!==r)&&(this.setState({hasOverflow:p}),t(r,l)))}handleWindowResize(){this.container.current&&this.closeMenu(!0)}handleBlur(e){if(!this.container.current){tn.warn("Container is null!");return}if(!this.container.current.contains(e.relatedTarget)){let t=e.relatedTarget,n=!1;for(;t&&!n;)n=t.hasAttribute("data-dh-context-menu"),t=t.parentElement;n||this.closeMenu(!0)}}isEscapeKey(e){const{left:t}=this.props;return e==="Escape"||t<0&&e==="ArrowRight"||e==="ArrowLeft"}handleKeyDown(e){const{menuItems:t}=this.state,n=this.getKeyboardIndex();let s=n,i=!1;if(e.key==="Enter"||e.key===" "){n>=0&&n<t.length&&this.handleMenuItemClick(t[n],e);return}if(e.key==="ArrowRight"?n>=0&&n<=t.length?i=!0:s=0:this.isEscapeKey(e.key)?s=null:e.key==="ArrowUp"||e.shiftKey&&e.key==="Tab"?s=U.getNextMenuItem(s,-1,t):(e.key==="ArrowDown"||e.key==="Tab")&&(s=U.getNextMenuItem(s,1,t)),i){this.openSubMenu(n),e.preventDefault(),e.stopPropagation();return}n!==s&&(s!==null?this.setKeyboardIndex(s):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}openSubMenu(e){const{menuItems:t,activeSubMenu:n}=this.state,s=t[e].actions?e:null;n!==s&&this.setState({activeSubMenu:s,subMenuTop:null,subMenuLeft:null})}closeMenu(e=!1){const{closeMenu:t,onMenuClosed:n}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t(e),n(this)})}closeSubMenu(){this.setState({activeSubMenu:null})}handleCloseSubMenu(e){e?this.closeMenu(!0):this.closeSubMenu()}handleMenuItemClick(e,t){t.preventDefault(),t.stopPropagation();const{menuItems:n}=this.state;e!=null&&(e.disabled===void 0||!e.disabled)&&(e.actions!=null?this.openSubMenu(n.indexOf(e)):e.action!=null&&(e.action(),this.closeMenu(!0)))}handleMenuItemContextMenu(e,t){t.metaKey||this.handleMenuItemClick(e,t)}handleMenuItemMouseMove(e){const{menuItems:t}=this.state,n=t.indexOf(e);this.setMouseIndex(n),n>=0&&n<t.length&&(e.disabled===void 0||!e.disabled)&&this.openSubMenu(n)}handleMouseLeave(){this.setMouseIndex(-1)}render(){const e=[],{top:t,left:n}=this.props,{activeSubMenu:s,hasOverflow:i,keyboardIndex:a,menuItems:r,mouseIndex:l,pendingItems:u,subMenuTop:h,subMenuLeft:p,subMenuParentWidth:m,subMenuParentHeight:f}=this.state;for(let k=0;k<r.length;k+=1){const M=r[k];k>0&&M.group!==r[k-1].group&&e.push(c.jsx("hr",{},`${k}.separator`));const A=c.jsx(jt,{ref:s===k?this.activeSubMenuRef:null,isKeyboardSelected:a===k,isMouseSelected:l===k,menuItem:M,closeMenu:this.handleCloseSubMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:this.handleMenuItemContextMenu},k);e.push(A)}let S=null;u.length>0&&(S=c.jsx("div",{className:"loading",children:c.jsx(wt,{})}));const{menuStyle:v,"data-testid":C}=this.props,x=s!==null&&h!==null&&p!==null;return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:I({"has-overflow":i},"context-menu-container"),style:{top:t,left:n,...v},ref:this.container,"data-dh-context-menu":!0,onBlur:this.handleBlur,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,onContextMenu:Ge.handleContextMenu,role:"menuitem",tabIndex:0,"data-testid":C,children:[e,S]}),x&&s!==null&&h!==null&&p!==null&&c.jsx(Ge,{actions:r[s].actions||[],closeMenu:this.handleCloseSubMenu,top:h,left:p,updatePosition:(k,M)=>{this.setState({subMenuTop:k,subMenuLeft:M})},subMenuParentWidth:m,subMenuParentHeight:f},`sub-${s}`)]})}}const Hi=Ge;class _i extends d.Component{constructor(e){super(e),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.container=E.createRef(),this.openMenu=E.createRef(),this.state={actions:null,left:0,top:0}}componentDidMount(){this.container.current?.parentElement&&this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu)}componentWillUnmount(){this.container.current?.parentElement&&this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu)}container;openMenu;handleContextMenu(e){if(!U.isContextActionEvent(e)||!this.container.current||e.metaKey||e.ctrlKey)return;const t=U.getMenuItems(e.contextActions),n=this.container.current.getBoundingClientRect(),s=e.clientY-n.top,i=e.clientX-n.left;if(t.length===0){if(e.target===this.container.current){e.preventDefault(),this.setState({actions:null},()=>{const a=document.elementFromPoint(i,s),r=new MouseEvent("contextmenu",{clientX:e.clientX,clientY:e.clientY,bubbles:!0,cancelable:!0});a?.dispatchEvent(r)});return}return}e.preventDefault(),this.setState({actions:t,top:s,left:i})}handleMenuClose(e){e===this.openMenu.current&&this.setState({actions:null})}render(){let e=null;const{"data-testid":t}=this.props,{actions:n,top:s,left:i}=this.state;return n&&(e=c.jsx(Hi,{ref:this.openMenu,actions:n,onMenuClosed:this.handleMenuClose,top:s,left:i,updatePosition:(a,r)=>{this.setState({top:a,left:r})},"data-testid":t})),c.jsx("div",{className:I("context-menu-root",{active:n}),ref:this.container,children:e})}}const Ui=_i;class fe extends d.Component{static propTypes={className:g.string,in:g.bool.isRequired,children:g.node.isRequired,autoFocusOnShow:g.bool,"data-testid":g.string};static defaultProps={className:"",autoFocusOnShow:!1,"data-testid":void 0};static handleEnter(e){const t=e;t.style.height="0"}static handleEntering(e){const t=e;t.style.height=`${fe.getHeight(t)}px`}static handleExiting(e){const t=e;t.style.height="0"}static handleExit(e){const t=e;t.style.height=`${fe.getHeight(t)}px`}static getHeight(e){const t=e.scrollWidth-e.clientWidth;return e.scrollHeight-t}constructor(e){super(e),this.handleEntered=this.handleEntered.bind(this)}handleEntered(e){const t=e;t.style.height="";const{autoFocusOnShow:n}=this.props;if(n!==void 0&&n){const s=t.querySelector("input, select, textarea");s?.focus()}}render(){const{children:e,className:t,in:n,"data-testid":s}=this.props;return c.jsx(Te,{in:n,classNames:{enterActive:"collapsing",enterDone:"collapse show",exitActive:"collapsing",exitDone:"collapse"},onEnter:fe.handleEnter,onEntering:fe.handleEntering,onEntered:this.handleEntered,onExit:fe.handleExit,onExiting:fe.handleExiting,timeout:350,children:i=>c.jsx("div",{className:I({collapse:i==="exited"},t),"data-testid":s,children:e})})}}const Ki=fe,tt=E.forwardRef((o,e)=>{const{checked:t=!1,children:n,className:s,disabled:i,inputClassName:a,isInvalid:r,labelClassName:l,name:u,onChange:h,"data-testid":p}=o,[m]=d.useState(Se()),f=At(e);d.useEffect(function(){f.current&&(f.current.indeterminate=t===null)},[f,t]);const S=d.useCallback(v=>{f.current&&(f.current.indeterminate=t===null),h&&h(v)},[f,t,h]);return c.jsxs("div",{className:I("custom-control custom-checkbox",s),children:[c.jsx("input",{type:"checkbox",ref:f,checked:t??!1,className:I("custom-control-input",a,{"is-invalid":r}),disabled:i,id:m,name:u,onChange:S,"data-testid":p}),c.jsx("label",{className:I("custom-control-label",l),htmlFor:m,children:n})]})});tt.displayName="Checkbox";tt.propTypes={checked:(o,e)=>{const{[e]:t}=o;return t!==null&&typeof t!="boolean"?new Error("Checked must be a boolean or null for indeterminate"):null},children:g.node.isRequired,className:g.string,disabled:g.bool,inputClassName:g.string,isInvalid:g.bool,labelClassName:g.string,name:g.string,onChange:g.func,"data-testid":g.string};tt.defaultProps={checked:!1,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};const ze=tt;class Wi extends d.PureComponent{static defaultProps={placeholder:"Search",className:"",matchCount:null,onKeyDown(){},id:"","data-testid":void 0};constructor(e){super(e),this.inputField=E.createRef()}inputField;focus(){this.inputField.current?.focus()}render(){const{value:e,placeholder:t,onBlur:n,onChange:s,className:i,disabled:a,matchCount:r,id:l,onKeyDown:u,"data-testid":h}=this.props;return c.jsxs("div",{className:I("search-group",i),children:[c.jsx("input",{type:"search",value:e,onBlur:n,onChange:s,onKeyDown:u,className:"form-control",disabled:a,placeholder:t,ref:this.inputField,id:l,"data-testid":h}),r!=null&&c.jsx("span",{className:"search-match",children:r}),c.jsx("span",{className:"search-icon",children:c.jsx(Z,{icon:Js})})]})}}const nt=Wi;var Pn=(o=>(o.UP="UP",o.DOWN="DOWN",o))(Pn||{});class xe extends d.Component{static MENU_NAVIGATION_DIRECTION=Pn;static DROP_DOWN_MENU_HEIGHT=200;static propTypes={options:g.arrayOf(g.shape({title:g.string.isRequired,value:g.string.isRequired})).isRequired,popperOptions:g.shape({title:g.string.isRequired,value:g.string.isRequired}),onChange:g.func,inputPlaceholder:g.string,searchPlaceholder:g.string,disabled:g.bool,className:g.string,defaultValue:g.string,spellCheck:g.bool,onEnter:g.func,"data-testid":g.string};static defaultProps={onChange(){},inputPlaceholder:"",searchPlaceholder:"Search",disabled:!1,className:"",defaultValue:"",popperOptions:null,spellCheck:!0,onEnter(){},"data-testid":void 0};constructor(e){super(e),this.state={value:"",filter:"",filteredOptions:e.options,keyboardOptionIndex:-1,menuIsOpen:!1,inputWidth:100},this.toggleMenu=this.toggleMenu.bind(this),this.handleMenuKeyDown=this.handleMenuKeyDown.bind(this),this.handleMenuBlur=this.handleMenuBlur.bind(this),this.closeMenu=this.closeMenu.bind(this),this.handleInputChange=this.handleInputChange.bind(this),this.handleInputKeyDown=this.handleInputKeyDown.bind(this),this.handleInputBlur=this.handleInputBlur.bind(this),this.handleFilterChange=this.handleFilterChange.bind(this),this.handleOptionClick=this.handleOptionClick.bind(this),this.handleOptionFocus=this.handleOptionFocus.bind(this),this.handleMenuOpened=this.handleMenuOpened.bind(this),this.handleMenuExited=this.handleMenuExited.bind(this),this.popper=E.createRef(),this.cbContainer=E.createRef(),this.toggleButton=E.createRef(),this.menuContainer=E.createRef(),this.input=E.createRef(),this.searchInput=E.createRef()}componentDidUpdate(){const{menuIsOpen:e,keyboardOptionIndex:t}=this.state;e&&t>=0&&this.scrollOptionIntoView()}popper;cbContainer;toggleButton;menuContainer;input;searchInput;setInputWidth(){this.cbContainer.current&&this.setState({inputWidth:this.cbContainer.current.getBoundingClientRect().width})}getCachedFilteredOptions=ne((e,t)=>e.filter(n=>n.title.toLowerCase().indexOf(t.toLowerCase())>=0||n.value.toLowerCase().indexOf(t.toLowerCase())>=0));focus(){this.input.current?.focus()}resetValue(){this.setState({value:""})}updateInputValue(e){const{onChange:t}=this.props;this.setState({value:e}),t(e)}handleResize(){this.setInputWidth()}handleMenuKeyDown(e){const{filter:t,filteredOptions:n,keyboardOptionIndex:s}=this.state,{options:i}=this.props,a=t?n:i;switch(e.key){case"Enter":a[s]?.value!=null&&this.updateInputValue(a[s].value),this.closeMenu(),this.input.current?.focus(),e.stopPropagation(),e.preventDefault();break;case"ArrowUp":this.handleMenuNavigation(xe.MENU_NAVIGATION_DIRECTION.UP),e.stopPropagation(),e.preventDefault();break;case"ArrowDown":this.handleMenuNavigation(xe.MENU_NAVIGATION_DIRECTION.DOWN),e.stopPropagation(),e.preventDefault();break;case"Escape":t!==""?(this.setState({filter:""}),e.stopPropagation()):this.closeMenu();break;case"Tab":!e.shiftKey&&s===a.length-1&&this.closeMenu();break}}handleMenuNavigation(e){const{filter:t,filteredOptions:n,keyboardOptionIndex:s}=this.state,{options:i}=this.props,r=(t?n:i).length;let l=0;switch(e){case xe.MENU_NAVIGATION_DIRECTION.UP:l=-1;break;case xe.MENU_NAVIGATION_DIRECTION.DOWN:l=1;break}l!==0&&this.setState({keyboardOptionIndex:(s+l+r)%r})}handleInputKeyDown(e){const{onEnter:t}=this.props,{menuIsOpen:n}=this.state;e.key==="ArrowDown"||e.key==="ArrowUp"?n||this.openMenu():e.key==="Enter"&&t()}handleInputChange(e){this.updateInputValue(e.target.value)}handleOptionClick(e){const t=Number(e.currentTarget.value),{filter:n,filteredOptions:s}=this.state,{options:i}=this.props,a=n?s:i;this.updateInputValue(a[t].value),this.closeMenu(),this.input.current?.focus()}handleOptionFocus(e){this.setState({keyboardOptionIndex:Number(e.target.value)})}handleFilterChange(e){const{options:t}=this.props,n=e.target.value,s=this.getCachedFilteredOptions(t,n);this.setState({filter:n,filteredOptions:s,keyboardOptionIndex:0}),this.popper.current?.scheduleUpdate()}handleMenuBlur(e){e.relatedTarget instanceof Element&&this.popper.current!=null&&this.popper.current.element.contains(e.relatedTarget)||e.relatedTarget===this.toggleButton.current||this.closeMenu(!1)}handleInputBlur(e){const{menuIsOpen:t}=this.state;t&&e.relatedTarget instanceof Element&&this.popper.current!=null&&this.popper.current.element.contains(e.relatedTarget)||this.closeMenu(!1)}handleMenuOpened(){this.scrollOptionIntoView(),this.searchInput.current?.focus()}handleMenuExited(){const{menuIsOpen:e}=this.state;e&&(this.setState({menuIsOpen:!1}),this.popper.current?.hide()),this.setState({filter:""})}toggleMenu(e){const{menuIsOpen:t}=this.state;t?this.closeMenu():this.openMenu(),e.stopPropagation()}openMenu(){this.updateKeyboardIndex(),this.setInputWidth(),this.setState({menuIsOpen:!0}),window.requestAnimationFrame(()=>{this.popper.current?.show()})}closeMenu(e=!0){this.setState({menuIsOpen:!1}),e&&this.input.current?.focus(),this.popper.current?.hide()}updateKeyboardIndex(){const{value:e,filter:t,filteredOptions:n}=this.state,{options:s}=this.props,a=(t?n:s).findIndex(r=>r.value===e);this.setState({keyboardOptionIndex:a})}scrollOptionIntoView(){const e=this.menuContainer.current?.querySelector(".cb-option-btn.keyboard-active");e instanceof HTMLElement&&e.scrollIntoView({block:"nearest",inline:"nearest"})}renderMenuElement(){const{searchPlaceholder:e}=this.props,{filter:t,inputWidth:n}=this.state;return c.jsxs("div",{className:"cb-menu-container",ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,onClick:s=>{s.stopPropagation()},style:{width:n},onBlur:this.handleMenuBlur,children:[c.jsx("div",{className:"cb-search-input-container",children:c.jsx(nt,{value:t,ref:this.searchInput,onChange:this.handleFilterChange,className:"cb-search-input",placeholder:e})}),c.jsx("div",{className:"cb-options-container",children:c.jsx("div",{className:"cb-options",children:this.renderOptions()})})]})}renderOptions(){const{options:e}=this.props,{keyboardOptionIndex:t,filter:n,filteredOptions:s}=this.state;return(n?s:e).map((a,r)=>{const l=`option-${r}-${a.value}`;return c.jsx("button",{type:"button",value:r,className:I("cb-option-btn",{"keyboard-active":t===r}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:a.title},l)})}render(){const{options:e,inputPlaceholder:t,disabled:n,className:s,defaultValue:i,spellCheck:a,"data-testid":r}=this.props,{value:l}=this.state;let{popperOptions:u}=this.props;return u={placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}},...u},c.jsxs("div",{className:"input-group cb-container",ref:this.cbContainer,children:[c.jsx("input",{value:l||i,className:I("form-control",s,"cb-input"),ref:this.input,onChange:this.handleInputChange,placeholder:t||(e[0]!=null?e[0].title:void 0),disabled:n,onBlur:this.handleInputBlur,onKeyDown:this.handleInputKeyDown,spellCheck:a,"data-testid":r!==void 0?`${r}-input`:void 0}),c.jsx("div",{className:"input-group-append cb-dropdown",children:c.jsxs("button",{type:"button",className:"btn cb-btn form-control",ref:this.toggleButton,onClick:this.toggleMenu,onKeyDown:this.handleInputKeyDown,disabled:n,"data-testid":r!==void 0?`${r}-btn`:void 0,children:[c.jsx(Z,{icon:Ys}),c.jsx(Oe,{ref:this.popper,options:u,className:I("combobox interactive"),onEntered:this.handleMenuOpened,onExited:this.handleMenuExited,children:this.renderMenuElement()})]})})]})}}const qi=xe;function Gi({copy:o,kind:e="ghost",tooltip:t="Copy",className:n,"data-testid":s,children:i}){const[a,r]=On();return c.jsx(se,{kind:e,className:n,"data-testid":s,icon:a?ei:ti,tooltip:a?"Copied":t,onClick:()=>{r(typeof o=="function"?o():o)},children:i})}function st(o,e,t){return o.substring(0,e)+t+o.substring(e+1)}function Ln(o,e,t){return o.length<t?`${o}${e.substring(o.length,t)}`:o}function Ct(o,e){let{length:t}=o;for(let n=o.length-1;n>=0&&e[n]===o[n];n-=1)t=n;return o.substring(0,t)}const ie=V.module("MaskedInput"),Ee={FORWARD:"forward",BACKWARD:"backward",NONE:"none"},_e=" ",jn=E.forwardRef((o,e)=>{const{className:t,example:n,getNextSegmentValue:s=(N,D,y)=>y,getPreferredReplacementString:i=st,onChange:a=()=>!1,onSelect:r=()=>!1,onSubmit:l,pattern:u,placeholder:h,selection:p,value:m,onFocus:f=()=>!1,onBlur:S=()=>!1,"data-testid":v}=o,C=At(e),x=d.useMemo(()=>Array.isArray(n)?n:[n],[n]),k=d.useMemo(()=>x[0].replace(/[a-zA-Z0-9]/g,_e),[x]);d.useEffect(function(){if(p!=null){ie.debug("setting selection...",p);const{selectionStart:D,selectionEnd:y,selectionDirection:P}=p;C.current?.setSelectionRange(D,y,P),ie.debug("selection set!")}},[p,C]);const M=d.useCallback(N=>{let D=N,y=N;const P=x.length>0?x[0]:m;for(let w=D-1;w>=0&&/[a-zA-Z0-9]/g.test(P.charAt(w));w-=1)D=w;for(let w=y;w<P.length&&/[a-zA-Z0-9]/g.test(P.charAt(w));w+=1)y=w+1;const _=D===y?Ee.NONE:Ee.BACKWARD;return{selectionStart:D,selectionEnd:y,selectionDirection:_}},[x,m]);function A(N,D,y=N.length){let P="";for(let _=0;_<y;_+=1)N.charAt(_)!==_e?P=P.concat(N[_]):P=P.concat(D[_]);return P=P.concat(D.substring(y)),P}function F(N,D=N.length){const y=new RegExp(`^${u}$`);if(y.test(N))return!0;for(let P=0;P<x.length;P+=1){const _=A(N,x[P],D);if(y.test(_))return!0}return!1}function O(N){const D=M(N),y=D.selectionEnd+1;return y>=m.length?D:M(y)}function $(N){const D=M(N),y=D.selectionStart-1;return y<=0?D:M(y)}function B(N,D){const y=M(N),P=m.substring(y.selectionStart,y.selectionEnd),_=s(y,D,P,m),w=m.substring(0,y.selectionStart)+_+m.substring(y.selectionEnd);F(w,y.selectionEnd)&&(a(w),r(y))}const ee=d.useCallback(N=>{const{selectionStart:D=0,selectionEnd:y=0,selectionDirection:P="none"}=N.target;if(D===null||y===null||P===null){ie.error("Selection attempted on non-text input element",N.target);return}if(ie.debug2("handleSelect",D,y,P),!(p!=null&&D===p.selectionStart&&y===p.selectionEnd)){if(p!=null&&D===m.length&&y===m.length&&N.nativeEvent.type!=="mouseup"){r({...p});return}if(D===y){const _=M(D);ie.debug("Selection segment from ",D,y,"=>",_),r(_)}else r({selectionStart:D,selectionEnd:y,selectionDirection:P})}},[M,r,p,m]),j=d.useCallback(N=>{if(!C.current)return;ie.debug("handleSelectCapture",N);const D=C.current.selectionStart??0;D===m.length&&p!=null&&D!==p.selectionStart&&(N.preventDefault(),N.stopPropagation())},[C,p,m]);function R(N){if(N.preventDefault(),N.stopPropagation(),!C.current)return;const{key:D}=N,{selectionStart:y=0,selectionEnd:P=0}=C.current;if(y===null||P===null){ie.error("Selection arrow nvaigation attempted on non-text input element",N.target);return}D==="ArrowLeft"?r($(y)):D==="ArrowRight"?r(O(P)):D==="ArrowUp"?B(y,-1):D==="ArrowDown"&&B(y,1)}function H(N){if(!C.current)return;ie.debug("handleKeyDown",N);const{key:D}=N,{selectionStart:y=0,selectionEnd:P=0}=C.current;if(y===null||P===null){ie.error("Selection key event on non-text input element",N.target);return}if(D==="Enter"){l?.(N);return}if(D.startsWith("Arrow")){R(N);return}if(D==="Delete"||D==="Backspace"){if(N.preventDefault(),N.stopPropagation(),P>=Ct(m,k).length){const w=m.substring(0,y===P?y-1:y),L=Ct(w,k);L!==m&&(a(L),r({selectionStart:L.length,selectionEnd:L.length,selectionDirection:Ee.NONE}));return}if(y!==P){const w=m.substring(0,y)+m.substring(y,P).replace(/[a-zA-Z0-9]/g,_e)+m.substring(P);ie.debug("Range ",y,P,"deleted, setting value",w),a(w),r({selectionStart:y,selectionEnd:y,selectionDirection:Ee.NONE})}else if(y>0)for(let w=y-1;w>=0;w-=1){const L=m.substring(0,w)+m.substring(w,y).replace(/[a-zA-Z0-9]/g,_e)+m.substring(y);if(L!==m){a(L),r({selectionStart:w,selectionEnd:w,selectionDirection:Ee.NONE});return}}return}if(N.altKey||N.metaKey||N.ctrlKey||D.length>1)return;N.preventDefault(),N.stopPropagation();const _=Array.from(new Set([D,D.toUpperCase(),D.toLowerCase()]));for(let w=0;w<_.length;w+=1){const L=_[w],K=/[a-zA-Z0-9]/g.test(L)?x[0].length-1:y;for(let q=y;q<=K;q+=1){const Be=Ln(m,x[0],q+1),lt=i(Be,q,L,y,P);if(F(lt,q+1)){const Qt=M(q),ct=q+1;let ut={selectionStart:ct,selectionEnd:ct,selectionDirection:Ee.NONE};if(ct>=Qt.selectionEnd){const Jt=O(q);Jt.selectionStart!==Qt.selectionStart&&(ut=Jt)}ie.debug("handleKeyDown",D,"=>",lt,ut),a(lt),r(ut);return}}}}return c.jsx("input",{ref:C,className:I("form-control masked-input",t),type:"text",pattern:u,placeholder:h,value:m,onChange:()=>{},onKeyDown:H,onSelect:ee,onSelectCapture:j,onFocus:f,onBlur:S,"data-testid":v})});jn.defaultProps={className:"",placeholder:void 0,onChange(){},onSelect(){},getNextSegmentValue:(o,e,t)=>t,getPreferredReplacementString:st,selection:void 0,onFocus(){},onBlur(){},"data-testid":void 0};const it=jn,zi=V.module("TimeInput"),Zi="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]",Xi=["00:00:00","12:34:56","23:59:59"],$n=E.forwardRef((o,e)=>{const{allowValueWrapping:t=!0,className:n="",onChange:s=()=>!1,value:i=0,onFocus:a=()=>!1,onBlur:r=()=>!1,onSelect:l=()=>!1,"data-testid":u}=o,[h,p]=d.useState(Ae.formatTime(i)),[m,f]=d.useState(),S=d.useRef(null);d.useImperativeHandle(e,()=>({focus:()=>{S.current?.focus()},setSelection:M=>{S.current?.focus(),f(M)}}),[]),d.useEffect(function(){p(Ae.formatTime(i))},[i]);function v(M,A,F){const O=M.selectionStart===0?24:60;let $=parseInt(F,10)-A;return Number.isNaN($)?$=0:t?$=($%O+O)%O:$=Math.min(Math.max(0,$),O-1),`${$}`.padStart(2,"0")}function C(M,A,F,O,$){return O===0&&$===2&&A===1&&parseInt(F,10)>1?`0${F}${M.substring(2)}`:st(M,A,F)}function x(M){zi.debug("handleChange",M),p(M),Ae.isTimeString(M)&&s(Ae.parseTime(M))}const k=d.useCallback(M=>{f(M),l(M)},[l]);return c.jsx(it,{ref:S,className:n,example:Xi,getNextSegmentValue:v,getPreferredReplacementString:C,onChange:x,onSelect:k,pattern:Zi,selection:m,value:h,onFocus:a,onBlur:r,"data-testid":u})});$n.defaultProps={allowValueWrapping:!0,className:"",onChange:()=>!1,onSelect:()=>!1,value:0,onFocus:()=>!1,onBlur:()=>!1,"data-testid":void 0};const Ze=$n;let Qi=class extends d.PureComponent{static defaultProps={closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0};constructor(e){super(e),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMenuItemClick=this.handleMenuItemClick.bind(this),this.handleMenuItemMouseMove=this.handleMenuItemMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.container=E.createRef(),this.oldFocus=document.activeElement,this.rAF=0;const{options:t}=e,n=t.initialKeyboardIndex??-1;this.state={menuItems:[],keyboardIndex:n,mouseIndex:-1}}componentDidMount(){this.initMenu(),this.rAF=window.requestAnimationFrame(()=>{this.container.current?.focus();const{onMenuOpened:e}=this.props;e(this)})}componentDidUpdate(e){const{actions:t}=this.props;e.actions!==t&&this.initMenu()}componentWillUnmount(){cancelAnimationFrame(this.rAF)}container;oldFocus;rAF;getKeyboardIndex(){const{options:e}=this.props;if(e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse){const{keyboardIndex:t}=this.state;return t}return this.getMouseIndex()}setKeyboardIndex(e){const{options:t}=this.props;t.separateKeyboardMouse!==void 0&&t.separateKeyboardMouse?this.setState({keyboardIndex:e}):this.setMouseIndex(e)}getMouseIndex(){const{mouseIndex:e}=this.state;return e}setMouseIndex(e){this.setState({mouseIndex:e})}initMenu(){cancelAnimationFrame(this.rAF),this.setState({menuItems:[]});const{actions:e}=this.props,t=U.getMenuItems(e,!1);t.length>0&&this.setState(n=>({menuItems:U.sortActions(n.menuItems.concat(t))}))}handleKeyDown(e){const{menuItems:t}=this.state,n=this.getKeyboardIndex();let s=n;if(e.key==="Enter"||e.key===" "){n!=null&&n>=0&&n<t.length&&this.handleMenuItemClick(t[n],e);return}e.key==="Escape"?s=null:e.key==="ArrowUp"||e.key==="Tab"&&e.shiftKey===!0?s=U.getNextMenuItem(s??0,-1,t):(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1)&&(s=U.getNextMenuItem(s??0,1,t)),n!==s&&(s!==null?this.setKeyboardIndex(s):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}closeMenu(e=!1){const{closeMenu:t,onMenuClosed:n}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t(e),n(this)})}handleCloseMenu(){this.closeMenu()}handleMenuItemClick(e,t){t.preventDefault(),t.stopPropagation(),e!=null&&(e.disabled===void 0||!e.disabled)&&e.action!=null&&(e.action(),this.closeMenu(!0))}handleMenuItemMouseMove(e){const{menuItems:t}=this.state,n=t.indexOf(e);this.setMouseIndex(n)}handleMouseLeave(){this.setMouseIndex(-1)}render(){const e=[],{"data-testid":t}=this.props,{keyboardIndex:n,menuItems:s,mouseIndex:i}=this.state;for(let r=0;r<s.length;r+=1){const l=s[r];r>0&&l.group!==s[r-1].group&&e.push(c.jsx("hr",{},`${r}.separator`));const u=c.jsx(jt,{isKeyboardSelected:n===r,isMouseSelected:i===r,menuItem:l,closeMenu:this.handleCloseMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:()=>!1},r);e.push(u)}const{menuStyle:a}=this.props;return c.jsx("div",{className:"context-menu-container",style:{...a},ref:this.container,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,role:"menuitem",tabIndex:0,"data-testid":t,children:e})}};const Ji=Qi;class Yi extends d.PureComponent{static defaultProps={isShown:null,onMenuClosed(){},onMenuOpened(){},options:{},popperOptions:{},popperClassName:"",menuStyle:{},"data-testid":void 0};constructor(e){super(e),this.handleClick=this.handleClick.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.handleExited=this.handleExited.bind(this),this.container=E.createRef(),this.parent=null,this.popper=E.createRef(),this.isOpen=!1}componentDidMount(){const{isShown:e}=this.props;e===null?this.container.current?.parentElement&&(this.parent=this.container.current.parentElement,this.parent.addEventListener("click",this.handleClick)):e&&this.openMenu()}componentDidUpdate(e){const{isShown:t}=this.props;e.isShown!==t&&(t!==null&&t?window.requestAnimationFrame(()=>{this.openMenu()}):this.closeMenu())}componentWillUnmount(){this.parent&&this.parent.removeEventListener("click",this.handleClick)}container;parent;popper;isOpen;closeMenu(){this.popper.current?.hide()}openMenu(){this.popper.current&&!this.isOpen&&(this.popper.current.show(),this.isOpen=!0)}scheduleUpdate(){this.popper.current?.scheduleUpdate()}handleClick(e){e.preventDefault(),e.stopPropagation(),this.openMenu()}handleCloseMenu(){this.closeMenu()}handleExited(){this.isOpen=!1;const{onMenuClosed:e}=this.props;e()}render(){const{actions:e,onMenuOpened:t,popperClassName:n,"data-testid":s}=this.props,{menuStyle:i}=this.props;let{options:a,popperOptions:r}=this.props;return r={placement:"bottom",...r},a={separateKeyboardMouse:!0,...a},c.jsx("div",{className:"menu-actions-listener",ref:this.container,"data-testid":s,children:c.jsx(Oe,{ref:this.popper,options:r,className:I("menu-popper",n),onExited:this.handleExited,closeOnBlur:!0,interactive:!0,children:c.jsx(Ji,{actions:e,closeMenu:this.handleCloseMenu,onMenuOpened:t,options:a,menuStyle:i})})})}}const Vn=Yi;const nn=-1;var Bn=(o=>(o.UP="UP",o.DOWN="DOWN",o))(Bn||{});class re extends d.Component{static MENU_NAVIGATION_DIRECTION=Bn;static DROP_DOWN_MENU_HEIGHT=125;static defaultProps={onChange(){},value:null,disabled:!1,popperOptions:{},icon:ni,customText:"Custom",placeholder:"Select a time",valueToTime:e=>e===null?0:Math.round(e/1e3),timeToValue:e=>e*1e3,invalid:!1,"data-testid":void 0};constructor(e){super(e);const{value:t,valueToTime:n}=e;this.toggleMenu=this.toggleMenu.bind(this),this.handleMenuKeyDown=this.handleMenuKeyDown.bind(this),this.closeMenu=this.closeMenu.bind(this),this.handleOptionClick=this.handleOptionClick.bind(this),this.handleOptionFocus=this.handleOptionFocus.bind(this),this.handleMenuOpened=this.handleMenuOpened.bind(this),this.handleMenuExited=this.handleMenuExited.bind(this),this.handleCustomInput=this.handleCustomInput.bind(this),this.csContainer=E.createRef(),this.menuContainer=E.createRef(),this.button=E.createRef(),this.input=E.createRef(),this.state={keyboardOptionIndex:0,menuIsOpen:!1,inputWidth:100,customTime:n(t),inputFocused:!1}}csContainer;menuContainer;button;input;getSelectedText(){const{options:e,value:t,placeholder:n}=this.props,{customTime:s}=this.state;if(t===null)return n;for(let i=0;i<e.length;i+=1){const a=e[i];if(a.value===t)return a.title}return Ae.formatTime(s)}setInputWidth(){this.csContainer.current&&this.setState({inputWidth:this.csContainer.current.getBoundingClientRect().width})}focus(){this.button.current?.focus()}updateInputValue(e){const{onChange:t}=this.props;t(e)}handleResize(){this.setInputWidth()}handleMenuKeyDown(e){const{keyboardOptionIndex:t,inputFocused:n}=this.state,{options:s}=this.props;switch(e.key){case"Enter":case" ":n?this.updateFromCustom():this.updateInputValue(s[t].value),this.closeMenu(),this.button.current?.focus(),e.stopPropagation(),e.preventDefault();break;case"Tab":e.shiftKey?this.handleMenuNavigation(re.MENU_NAVIGATION_DIRECTION.UP):this.handleMenuNavigation(re.MENU_NAVIGATION_DIRECTION.DOWN),e.stopPropagation(),e.preventDefault();break;case"ArrowUp":this.handleMenuNavigation(re.MENU_NAVIGATION_DIRECTION.UP),e.stopPropagation(),e.preventDefault();break;case"ArrowDown":this.handleMenuNavigation(re.MENU_NAVIGATION_DIRECTION.DOWN),e.stopPropagation(),e.preventDefault();break;case"Escape":this.closeMenu();break}}handleMenuNavigation(e){const{keyboardOptionIndex:t,inputFocused:n}=this.state,{options:s}=this.props,i=s.length;let a=t;switch(e){case re.MENU_NAVIGATION_DIRECTION.UP:if(!n&&t===0){this.focusInput();break}else n&&this.focusOption(t);t>0&&!n?(a=(a-1)%i,this.setState({keyboardOptionIndex:a})):t===0&&(a=i-1,this.setState({keyboardOptionIndex:a})),this.scrollOptionIntoView(a);break;case re.MENU_NAVIGATION_DIRECTION.DOWN:if(!n&&t===i-1){this.focusInput();break}else n&&this.focusOption(t);t<i&&!(n&&t===0)&&(a=(a+1)%i,this.setState({keyboardOptionIndex:a})),this.scrollOptionIntoView(a);break}}handleOptionClick(e){const t=Number(e.currentTarget.value),{options:n,timeToValue:s}=this.props,{customTime:i}=this.state;if(t===nn){const a=s(i);this.updateAndClose(a)}else this.updateAndClose(n[t].value)}updateAndClose(e){this.updateInputValue(e),this.closeMenu(),this.button.current?.focus()}handleOptionFocus(e){this.setState({keyboardOptionIndex:Number(e.target.value)})}handleMenuOpened(){const{options:e,value:t}=this.props,{keyboardOptionIndex:n}=this.state;this.scrollOptionIntoView(n);const s=this.menuContainer.current?.querySelector(".cs-option-btn.keyboard-active");if(s instanceof HTMLElement&&s.focus(),t===null)return;e.map(a=>a.value).indexOf(t)<0&&this.focusInput()}focusInput(){this.input.current?.focus()}focusOption(e){const t=this.menuContainer.current?.querySelector(".cs-options");if(t&&t.children!=null){const n=t.children.item(e);n instanceof HTMLElement&&n.focus()}}handleMenuExited(){const{menuIsOpen:e}=this.state;e&&this.setState({menuIsOpen:!1,keyboardOptionIndex:0})}handleCustomInput(e){const{timeToValue:t}=this.props,n=t(e);this.updateInputValue(n),this.setState({customTime:e})}updateFromCustom(){const{timeToValue:e}=this.props,{customTime:t}=this.state,n=e(t);this.updateInputValue(n)}toggleMenu(e){const{menuIsOpen:t}=this.state;t?this.closeMenu():this.openMenu(),e.stopPropagation()}openMenu(){this.updateKeyboardIndex(),this.setInputWidth(),this.setState({menuIsOpen:!0})}closeMenu(e=!0){this.setState({menuIsOpen:!1}),e&&this.button.current?.focus()}updateKeyboardIndex(){const{options:e,value:t}=this.props;if(t===null)return;const n=e.map(s=>s.value).indexOf(t);n>0&&this.setState({keyboardOptionIndex:n})}scrollOptionIntoView(e){const t=this.menuContainer.current?.querySelector(".cs-options");if(t&&t.children!=null){const n=t.children.item(e);n instanceof HTMLElement&&n.offsetTop>re.DROP_DOWN_MENU_HEIGHT?t.scrollTop=n.offsetTop-re.DROP_DOWN_MENU_HEIGHT:(n instanceof HTMLElement&&n.offsetTop<0||e===0)&&(t.scrollTop=0)}}renderMenuElement(){const{inputWidth:e}=this.state;return c.jsx("div",{className:"cs-menu-container",ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,onClick:t=>{t.stopPropagation()},style:{width:e},children:c.jsx("div",{className:"cs-options-container",children:c.jsx("div",{className:"cs-options",children:this.renderOptions()})})})}renderOptions(){const{options:e,value:t,icon:n,customText:s}=this.props,{keyboardOptionIndex:i,customTime:a,inputFocused:r}=this.state;let l=!1;const u=[];for(let h=0;h<e.length;h+=1){const p=e[h],m=`option-${h}-${p.value}`;l=l||p.value===t,u.push(c.jsxs("button",{type:"button",value:h,className:I("cs-option-btn",{"keyboard-active":i===h&&!r}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[p.value===t&&c.jsx(Z,{icon:n,className:"mr-2"}),p.value!==t&&c.jsx("span",{className:"mr-4"}),p.title]},m))}return u.push(c.jsx("hr",{className:"cs-divider"},"option-divider")),u.push(c.jsxs("button",{type:"button",value:nn,className:I("cs-option-btn",{"keyboard-active":r}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[!l&&t!==null?c.jsx(Z,{icon:n,className:"mr-2"}):c.jsx("span",{className:"mr-4"}),s]},"option-custom-label")),u.push(c.jsxs("div",{className:"cs-custom-container",children:[c.jsx("span",{className:"mr-2"}),c.jsx(Ze,{ref:this.input,onChange:this.handleCustomInput,value:a,onFocus:()=>this.setState({inputFocused:!0}),onBlur:()=>this.setState({inputFocused:!1})},"option-input"),c.jsx("span",{className:"ml-2"})]},"cs-custom-container")),u.push(c.jsx("hr",{className:"mb-2"},"option-end")),u}render(){const{disabled:e,invalid:t,value:n,"data-testid":s}=this.props,{menuIsOpen:i}=this.state;let{popperOptions:a}=this.props;return a={placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}},...a},c.jsx("div",{className:"input-group cs-container context-menu",ref:this.csContainer,"data-testid":s,children:c.jsx("div",{className:I("input-group-append cs-dropdown",{"cs-dropdown-invalid":t}),children:c.jsxs("button",{type:"button",className:I("btn cs-btn form-control",{"cs-btn-invalid":t}),ref:this.button,onClick:this.toggleMenu,disabled:e,children:[c.jsx("span",{className:I({"text-muted":n===null}),children:this.getSelectedText()}),c.jsx("span",{children:c.jsx(Z,{icon:wn,className:"cs-caret"})}),c.jsx(Vn,{isShown:i,actions:{menuElement:this.renderMenuElement()},popperOptions:a,popperClassName:"CustomTimeSelect",onMenuOpened:this.handleMenuOpened,onMenuClosed:this.handleMenuExited,menuStyle:{maxWidth:"100rem"}})]})})})}}const eo=re;function Ie(o,e,t,n,s){const i=n-t+1;return`${((parseInt(e,10)-o-t)%i+i)%i+t}`.padStart(s,"0")}function Hn(o,e,t){const{selectionStart:n}=o;return n===0?Ie(e,t,1900,2099,4):n===5?Ie(e,t,1,12,2):n===8?Ie(e,t,1,31,2):n===11?Ie(e,t,0,23,2):n===17||n===14?Ie(e,t,0,59,2):n===20||n===24||n===28?Ie(e,t,0,999,3):t}function St(o){const e=o.substring(0,23),t=o.substring(23,26),n=o.substring(26);return[e,t,n].filter(s=>s!=="").join("​")}const to=V.module("DateTimeInput"),no="[12][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])",so="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]\\.[0-9]{3}​[0-9]{3}​[0-9]{3}",io=`${no} ${so}`,We="2022-01-01",_n=`${We} 00:00:00.000000000`,oo="YYYY-MM-DD HH:MM:SS.SSSSSSSSS";function sn(o){return o!=null&&o.length>=We.length?`${o.substring(0,We.length)}${o.substring(We.length).replace(/\u2007/g,"0")}${_n.substring(o.length)}`:o}function on(o){return o.replace(/\u200B/g,"")}const ao=[St(_n)],$t=E.forwardRef((o,e)=>{const{className:t="",onChange:n=()=>{},defaultValue:s="",onFocus:i=()=>{},onBlur:a=()=>{},onSubmit:r,"data-testid":l}=o,[u,h]=d.useState(s.length>0?St(s):""),[p,m]=d.useState(),f=d.useCallback(v=>{to.debug("handleChange",v),h(v),n(sn(on(v)))},[n]),S=d.useCallback(()=>{const v=on(u),C=sn(v);C!==v&&h(St(C)),a()},[u,a]);return c.jsx("div",{className:"d-flex flex-row align-items-center",children:c.jsx(it,{ref:e,className:I(t),example:ao,getNextSegmentValue:Hn,onChange:f,onSelect:m,onSubmit:r,pattern:io,placeholder:oo,selection:p,value:u,onFocus:i,onBlur:S,"data-testid":l})})});$t.displayName="DateTimeInput";$t.defaultProps={className:"",onChange:()=>{},defaultValue:"",onFocus:()=>{},onBlur:()=>{},"data-testid":void 0};const ro=$t,lo=V.module("DateInput"),co="[12][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])",uo=["2000-01-01","2022-12-31"],ho="YYYY-MM-DD",Vt=E.forwardRef((o,e)=>{const{className:t="",onChange:n=()=>{},defaultValue:s="",onFocus:i=()=>{},onBlur:a=()=>{},"data-testid":r}=o,[l,u]=d.useState(s),[h,p]=d.useState(),m=d.useCallback(f=>{lo.debug("handleChange",f),u(f),n(f)},[n]);return c.jsx("div",{className:"d-flex flex-row align-items-center",children:c.jsx(it,{ref:e,className:I(t),example:uo,getNextSegmentValue:Hn,onChange:m,onSelect:p,pattern:co,placeholder:ho,selection:h,value:l,onFocus:i,onBlur:a,"data-testid":r})})});Vt.displayName="DateInput";Vt.defaultProps={className:"",onChange:()=>!1,defaultValue:"",onFocus:()=>!1,onBlur:()=>!1,"data-testid":void 0};const po=Vt;class mo extends d.PureComponent{static defaultProps={placeholder:"Search",className:"",matchCount:null,debounceMs:250,id:"","data-testid":void 0};constructor(e){super(e),this.searchInput=E.createRef(),this.handleChange=this.handleChange.bind(this),this.sendUpdate=Re(this.sendUpdate.bind(this),e.debounceMs),this.state={value:e.value}}componentDidUpdate(e){const{value:t}=this.props;e.value!==t&&this.setState({value:t})}searchInput;focus(){this.searchInput.current?.focus()}handleChange(e){this.setState({value:e.target.value},this.sendUpdate)}sendUpdate(){const{onChange:e}=this.props,{value:t}=this.state;e(t)}render(){const{placeholder:e,className:t,matchCount:n,id:s,"data-testid":i}=this.props,{value:a}=this.state;return c.jsx(nt,{value:a,placeholder:e,onChange:this.handleChange,className:t,matchCount:n,ref:this.searchInput,id:s,"data-testid":i})}}const fo=mo;const go=V.module("ItemListItem");class Bt extends d.Component{static defaultProps={children:null,isDraggable:!1,isFocused:!1,isSelected:!1,itemIndex:0,"data-testid":void 0,onBlur(){},onClick(){},onContextMenu(){},onDragStart(){},onDrag(){},onDragOver(){},onDragEnd(){},onDrop(){},onDoubleClick(){},onFocus(){},onMouseDown(){},onMouseMove(){},onMouseUp(){},style:{}};static handleKeyDown(){return go.log("ItemListItem.handleKeyDown false"),!1}constructor(e){super(e),this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleClick=this.handleClick.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleDragStart=this.handleDragStart.bind(this),this.handleDrag=this.handleDrag.bind(this),this.handleDragOver=this.handleDragOver.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleDrop=this.handleDrop.bind(this),this.handleDoubleClick=this.handleDoubleClick.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.itemRef=E.createRef()}itemRef;handleBlur(e){const{itemIndex:t,onBlur:n}=this.props;n(t,e)}handleFocus(e){const{itemIndex:t,onFocus:n}=this.props;n(t,e)}handleClick(e){const{itemIndex:t,onClick:n}=this.props;n(t,e)}handleContextMenu(e){const{itemIndex:t,onContextMenu:n}=this.props;n(t,e)}handleDragStart(e){const{itemIndex:t,onDragStart:n}=this.props;n(t,e)}handleDrag(e){const{itemIndex:t,onDrag:n}=this.props;n(t,e)}handleDragOver(e){e.preventDefault();const{itemIndex:t,onDragOver:n}=this.props;n(t,e)}handleDragEnd(e){const{itemIndex:t,onDragEnd:n}=this.props;n(t,e)}handleDrop(e){const{itemIndex:t,onDrop:n}=this.props;n(t,e)}handleDoubleClick(e){const{itemIndex:t,onDoubleClick:n}=this.props;n(t,e)}handleMouseMove(e){const{itemIndex:t,onMouseMove:n}=this.props;n(t,e)}handleMouseDown(e){const{itemIndex:t,onMouseDown:n}=this.props;n(t,e)}handleMouseUp(e){const{itemIndex:t,onMouseUp:n}=this.props;n(t,e)}render(){const{isDraggable:e,isFocused:t,isSelected:n,style:s,children:i,"data-testid":a}=this.props;return c.jsx("div",{className:I("item-list-item",{active:n},{"is-focused":t},{"is-draggable":e}),onKeyDown:Bt.handleKeyDown,onContextMenuCapture:this.handleContextMenu,onClick:this.handleClick,onDrag:this.handleDrag,onDragStart:this.handleDragStart,onDragOver:this.handleDragOver,onDragEnd:this.handleDragEnd,onDrop:this.handleDrop,onDoubleClick:this.handleDoubleClick,onMouseDown:this.handleMouseDown,onMouseMove:this.handleMouseMove,onMouseUp:this.handleMouseUp,tabIndex:-1,ref:this.itemRef,role:"listitem",style:s,onFocus:this.handleFocus,onBlur:this.handleBlur,draggable:e,"data-testid":a,children:i})}}const Un=Bt;const an=V.module("ItemList"),rn=5;class oe extends d.PureComponent{static CACHE_SIZE=1e3;static DEFAULT_ROW_HEIGHT=20;static DEFAULT_OVERSCAN=10;static defaultProps={offset:0,items:[],rowHeight:oe.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!1,isDragSelect:!0,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},overscanCount:oe.DEFAULT_OVERSCAN,renderItem:oe.renderItem,selectedRanges:[],focusSelector:".item-list-item","data-testid":void 0};static renderItem({item:e}){return c.jsx("div",{className:"item-list-item-content",children:e!=null&&(e.displayValue??e.value??`${e}`)})}constructor(e){super(e),this.handleItemBlur=this.handleItemBlur.bind(this),this.handleItemContextMenu=this.handleItemContextMenu.bind(this),this.handleItemFocus=this.handleItemFocus.bind(this),this.handleItemDoubleClick=this.handleItemDoubleClick.bind(this),this.handleItemMouseDown=this.handleItemMouseDown.bind(this),this.handleItemMouseMove=this.handleItemMouseMove.bind(this),this.handleItemMouseUp=this.handleItemMouseUp.bind(this),this.handleItemsRendered=this.handleItemsRendered.bind(this),this.handleWindowMouseUp=this.handleWindowMouseUp.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleScroll=this.handleScroll.bind(this),this.handleResize=this.handleResize.bind(this),this.renderInnerElement=this.renderInnerElement.bind(this),this.list=E.createRef(),this.listContainer=E.createRef();const{isStickyBottom:t,selectedRanges:n}=e;this.state={focusIndex:null,mouseDownIndex:null,selectedRanges:n,overscanStartIndex:0,height:null,isDragging:!1,isStuckToBottom:t,scrollOffset:null,mouseX:null,mouseY:null}}componentDidUpdate(e,t){const{selectedRanges:n,itemCount:s}=this.props,{focusIndex:i,isStuckToBottom:a,scrollOffset:r,height:l,selectedRanges:u}=this.state;if(a&&!this.isListAtBottom()&&s>0&&this.scrollToBottom(),(r!==t.scrollOffset||l!==t.height)&&this.sendViewportUpdate(),n!==e.selectedRanges&&n!==u)this.setSelectedRanges(n);else if(u!==t.selectedRanges){const{onSelectionChange:h}=this.props;h(u)}if(i!==t.focusIndex){const{onFocusChange:h}=this.props;h(i)}}componentWillUnmount(){window.removeEventListener("mouseup",this.handleWindowMouseUp)}list;listContainer;getItemSelected=ne((e,t)=>le.isSelected(t,e),{max:oe.CACHE_SIZE});getCachedItem=ne((e,t,n,s,i,a,r,l)=>{const u=a({item:n,itemIndex:e,isFocused:s,isSelected:i,style:r});return c.jsx(Un,{onContextMenu:this.handleItemContextMenu,onDoubleClick:this.handleItemDoubleClick,onMouseDown:this.handleItemMouseDown,onFocus:this.handleItemFocus,onBlur:this.handleItemBlur,disableSelect:l,onMouseMove:this.handleItemMouseMove,onMouseUp:this.handleItemMouseUp,isFocused:s,isSelected:i,itemIndex:e,style:r,children:u},t)},{max:oe.CACHE_SIZE});getOuterElement=ne(e=>{const t=E.forwardRef((n,s)=>c.jsx("div",{ref:s,tabIndex:-1,onKeyDown:e,role:"presentation",...n}));return t.displayName="ItemListOuterElement",t});getInnerElement=ne(()=>{const e=E.forwardRef((t,n)=>c.jsx("div",{className:"item-list-inner-element",ref:n,...t}));return e.displayName="ItemListInnerElement",e});getItemData=ne((e,t,n)=>({items:e,selectedRanges:t,renderItem:n}));focus(){this.listContainer.current?.focus()}restoreScrollPosition(){const{scrollOffset:e}=this.state;e!=null&&this.listContainer.current?.scrollTo(0,e)}getElement(e){if(this.listContainer.current==null)return null;const{focusSelector:t}=this.props,{overscanStartIndex:n}=this.state,s=this.listContainer.current.querySelectorAll(t),i=e-n;return s[i]}focusItem(e){const{disableSelect:t}=this.props;if(t)return;this.setState({focusIndex:e});const n=this.getElement(e);n instanceof HTMLElement&&n.focus()}scrollToItem(e){const t=this.getElement(e);t?.scrollIntoView({block:"center"})}handleItemContextMenu(e,t){const{selectedRanges:n}=this.state,i=le.isSelected(n,e)||U.isModifierKeyDown(t);this.toggleSelect(e,t.shiftKey,i,!1)}handleItemDoubleClick(e,t){const{isDoubleClickSelect:n,onSelect:s}=this.props;n&&this.setState(({selectedRanges:i})=>({selectedRanges:le.selectRange(i,[e,e])}),()=>{s(e,t)})}handleItemMouseDown(e,t){const{selectedRanges:n}=this.state;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(t.button===2&&n.length===0){this.focusItem(e),this.selectItem(e);return}t.button!=null&&t.button!==0||(this.setState({mouseDownIndex:e,mouseX:t.clientX,mouseY:t.clientY}),window.addEventListener("mouseup",this.handleWindowMouseUp))}}handleItemBlur(e,t){an.debug2("item blur",e,t.currentTarget,t.relatedTarget),(!t.relatedTarget||this.listContainer.current&&t.relatedTarget instanceof HTMLElement&&!this.listContainer.current.contains(t.relatedTarget))&&this.setState({focusIndex:null})}handleItemFocus(e,t){an.debug2("item focus",e,t.target),this.setState(n=>{const{focusIndex:s}=n;return s!==e?{focusIndex:e}:null})}handleItemMouseMove(e,t){const{isDragSelect:n,isMultiSelect:s,disableSelect:i}=this.props,{mouseDownIndex:a,selectedRanges:r,mouseX:l,mouseY:u}=this.state;if(a==null||i)return;const h=Math.abs(t.clientX-(l??0)),p=Math.abs(t.clientY-(u??0));h>rn&&p>rn&&this.setState({isDragging:!0}),(n||a===e)&&(this.focusItem(e),s?(!n&&!this.getItemSelected(e,r)&&!U.isModifierKeyDown(t)&&this.deselectAll(),this.selectRange([Math.min(a,e),Math.max(a,e)])):this.toggleSelect(e,t.shiftKey,U.isModifierKeyDown(t),!1))}handleItemMouseUp(e,t){const{isDeselectOnClick:n,isDoubleClickSelect:s,onSelect:i}=this.props,{mouseDownIndex:a,isDragging:r}=this.state;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(a===e&&!r){const l=t.shiftKey,u=U.isModifierKeyDown(t);this.focusItem(e),this.toggleSelect(e,l,u,n),!s&&!l&&!u&&i(e,t)}this.resetMouseState()}}handleItemsRendered({overscanStartIndex:e}){this.setState({overscanStartIndex:e})}handleResize({height:e}){this.setState({height:e})}handleMouseLeave(){this.setState({mouseDownIndex:null})}handleWindowMouseUp(){this.resetMouseState(),window.removeEventListener("mouseup",this.handleWindowMouseUp)}handleKeyDown(e){const{isMultiSelect:t,itemCount:n,onSelect:s}=this.props,{focusIndex:i}=this.state;let a=i;if(e.key==="Enter"||e.key===" "){!t&&a!=null&&this.setState({selectedRanges:[[a,a]]},()=>{a!=null&&s(a,e)});return}if(e.key==="ArrowUp")a!=null&&a>=0?a=Math.max(0,a-1):a=n-1;else if(e.key==="ArrowDown")a!=null&&a>=0?a=Math.min(a+1,n-1):a=0;else return;if(i!==a){e.stopPropagation(),e.preventDefault(),this.focusItem(a);const{selectedRanges:r}=this.state;if(e.shiftKey&&r.length>0){const l=r[r.length-1];this.selectRange([Math.min(a,l[0]),Math.max(a,l[1])])}else this.deselectAll(),a!==null?this.selectItem(a):this.listContainer.current?.focus();this.scrollIntoView(a)}}handleScroll({scrollUpdateWasRequested:e,scrollOffset:t}){this.setState(n=>{if(e)return{scrollOffset:t};const{isStickyBottom:s}=this.props,{height:i}=n;return{isStuckToBottom:s&&this.isListAtBottom({scrollOffset:t,height:i}),scrollOffset:t}})}resetMouseState(){this.setState({mouseDownIndex:null,isDragging:!1})}scrollToBottom(){const{itemCount:e}=this.props;this.list.current&&this.list.current.scrollToItem(e)}scrollIntoView(e){this.list.current&&this.list.current.scrollToItem(e)}toggleSelect(e,t,n,s=!0){const{isMultiSelect:i}=this.props,{selectedRanges:a}=this.state;if(i&&t&&a.length>0){const r=a[a.length-1];this.selectRange([Math.min(r[0],e),Math.max(e,r[1])])}else i&&a.length===1&&a[0][0]===e&&a[0][1]===e?s&&this.deselectItem(e):i&&n?this.getItemSelected(e,a)?s&&this.deselectItem(e):this.selectItem(e):(this.deselectAll(),this.selectItem(e))}deselectAll(){const{itemCount:e}=this.props;this.deselectRange([0,e])}deselectItem(e){this.deselectRange([e,e])}deselectRange(e){le.validateRange(e),this.setState(({selectedRanges:t})=>({selectedRanges:le.deselectRange(t,e)}))}selectItem(e){const{disableSelect:t}=this.props;t||this.selectRange([e,e])}selectRange(e){le.validateRange(e),this.setState(({selectedRanges:t})=>({selectedRanges:le.selectRange(t,e)}))}setSelectedRanges(e){this.setState({selectedRanges:e})}sendViewportUpdate(){const{scrollOffset:e,height:t}=this.state;if(e!=null&&t!=null){const{onViewportChange:n,rowHeight:s}=this.props,i=Math.floor(e/s),a=i+Math.ceil(t/s);n(i,a)}}isListAtBottom({scrollOffset:e,height:t}=this.state){if(t==null||e==null)return!1;const{itemCount:n,rowHeight:s}=this.props;return e+t>=n*s}renderInnerElement({index:e,style:t}){const{items:n,offset:s,renderItem:i,disableSelect:a}=this.props,{focusIndex:r,selectedRanges:l}=this.state;if(e<s||e>=s+n.length)return null;const u=n[e-s];return this.getCachedItem(e,e,u,e===r&&!a,this.getItemSelected(e,l),i,t,a)}render(){const{items:e,itemCount:t,overscanCount:n,renderItem:s,rowHeight:i,"data-testid":a}=this.props,{selectedRanges:r,isStuckToBottom:l}=this.state;return c.jsx(js,{className:"item-list-auto-sizer",onResize:this.handleResize,children:({width:u,height:h})=>c.jsx($s,{className:"item-list-scroll-pane",height:h,width:u,initialScrollOffset:l?t*i:0,itemCount:t,itemSize:i,itemData:this.getItemData(e,r,s),onScroll:this.handleScroll,onItemsRendered:this.handleItemsRendered,ref:this.list,outerElementType:this.getOuterElement(this.handleKeyDown),outerRef:this.listContainer,innerElementType:this.getInnerElement(),overscanCount:n,"data-testid":a,children:this.renderInnerElement})})}}class ge extends d.PureComponent{static DEFAULT_ROW_HEIGHT=30;static defaultProps={className:"",draggingItemClassName:"",offset:0,items:[],rowHeight:ge.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!0,isDropDisabled:!1,isDragDisabled:!1,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,style:null,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},renderItem:ge.renderItem,selectedRanges:[],draggablePrefix:"draggable-item",droppableId:"droppable-item-list","data-testid":void 0};static renderHandle(){return c.jsxs("div",{children:[c.jsx(kt,{children:"Drag to re-order"}),c.jsx(Z,{icon:si})]})}static renderBadge({text:e}){return e!=null&&e.length>0?c.jsx("span",{className:"number-badge",children:e}):null}static renderTextItem({text:e,badgeText:t="",className:n=""}){return c.jsxs("div",{className:I("item-list-item-content","draggable-item-list-item-content",n),children:[c.jsx("span",{className:"title",children:e}),ge.renderBadge({text:t}),ge.renderHandle()]})}static renderItem({item:e,isClone:t,selectedCount:n}){const s=e!=null?e.displayValue??e.value??`${e}`:"",i=t!==void 0&&t?`${n}`:"",a=t!==void 0&&t?"item-list-item-clone":"";return ge.renderTextItem({text:s,badgeText:i,className:a})}static getDraggableId(e,t){return`${e}/${t}`}static getDraggableIndex(e){const t=e.split("/").pop();return parseInt(t!==void 0?t:"",10)}constructor(e){super(e),this.handleSelectionChange=this.handleSelectionChange.bind(this),this.itemList=E.createRef(),this.state={selectedCount:0}}itemList;selectItem(e){this.itemList.current?.selectItem(e)}focusItem(e){this.itemList.current?.focusItem(e)}scrollToItem(e){this.itemList.current?.scrollToItem(e)}getCachedDraggableItem=ne((e,t,n,s,i,a,r,l)=>c.jsx(Vs,{draggableId:ge.getDraggableId(e,s),index:s,isDragDisabled:r,children:u=>c.jsx("div",{role:"menuitem",className:"draggable-item-list-item",ref:u.innerRef,tabIndex:-1,...u.draggableProps,...u.dragHandleProps,children:t({item:n,itemIndex:s,isFocused:i,isSelected:a,style:l,isClone:!1})})},s),{max:oe.CACHE_SIZE});handleSelectionChange(e){this.setState({selectedCount:le.count(e)});const{onSelectionChange:t}=this.props;t(e)}getCachedRenderDraggableItem=ne((e,t,n)=>({item:s,itemIndex:i,isFocused:a,isSelected:r,style:l})=>this.getCachedDraggableItem(e,n,s,i,a,r,t,l),{max:1});getCachedRenderClone=ne((e,t,n,s)=>(i,a,r)=>{const{selectedCount:l}=this.state,{draggableProps:u,dragHandleProps:h,innerRef:p}=i,{index:m}=r.source,f=t[m-n];return c.jsx("div",{className:I("draggable-item-list-dragging-item-container",e),...u,...h,ref:p,children:c.jsx("div",{className:I("draggable-item-list-dragging-item",{"two-dragged":l===2},{"multiple-dragged":l>2}),children:s({item:f,itemIndex:m,isFocused:!1,isSelected:!0,style:{},isClone:!0,selectedCount:l})})})},{max:1});render(){const{className:e,draggablePrefix:t,draggingItemClassName:n,droppableId:s,isDoubleClickSelect:i,isDragDisabled:a,isDropDisabled:r,isMultiSelect:l,isStickyBottom:u,itemCount:h,items:p,offset:m,onFocusChange:f,onSelect:S,onViewportChange:v,renderItem:C,rowHeight:x,selectedRanges:k,style:M,"data-testid":A}=this.props;return c.jsx(Bs,{isDropDisabled:r,droppableId:s,mode:"virtual",renderClone:this.getCachedRenderClone(n,p,m,C),"data-testid":A,children:(F,O)=>c.jsx("div",{role:"menu",className:I("draggable-item-list",e,{"is-drop-disabled":r,"is-drag-disabled":a,"is-dragging-from-this":O.draggingFromThisWith,"is-dragging-over":O.isDraggingOver,"is-dropping":O.draggingOverWith}),style:M,ref:F.innerRef,...F.droppableProps,children:c.jsx(oe,{focusSelector:".draggable-item-list-item",isDoubleClickSelect:i,isDragSelect:!1,isMultiSelect:l,isStickyBottom:u,itemCount:h,items:p,onFocusChange:f,onSelect:S,onSelectionChange:this.handleSelectionChange,onViewportChange:v,offset:m,ref:this.itemList,renderItem:this.getCachedRenderDraggableItem(t,a,C),rowHeight:x,selectedRanges:k})})})}}const bo=ge;class Xe{static reorder(e,t,n,s){const i=e===n?Xe.adjustDestinationIndex(s,t):s,a=Xe.removeItems(e,t);return n.splice(i,0,...a),a}static removeItems(e,t){const n=[],s=t.map((i,a)=>({range:i,index:a})).sort((i,a)=>a.range[0]-i.range[0]);for(let i=0;i<s.length;i+=1){const{range:a,index:r}=s[i],[l,u]=a;n[r]=e.splice(l,u-l+1)}return Hs(n)}static adjustDestinationIndex(e,t){let n=e;for(let s=0;s<t.length;s+=1){const[i,a]=t[s];if(i>e)break;n-=Math.min(a,e-1)-i+1}return n}static startDragging(){document.documentElement.classList.add("drag-pointer-events-none")}static stopDragging(){document.documentElement.classList.remove("drag-pointer-events-none")}}const Co=Xe;function So(o){const{isInvalid:e=!1,items:t,onAdd:n=()=>{},onDelete:s=()=>{},validate:i=()=>null}=o,[a,r]=d.useState(null),[l,u]=d.useState([]),[h,p]=d.useState(""),m=d.useCallback(M=>{u(M)},[]),f=d.useCallback(()=>{s(le.getItemsInRanges(t,l)),u([])},[t,l,s]),S=d.useCallback(()=>{if(h==="")return;const M=i(h);M==null?(n(h),p("")):r(M)},[h,n,i]),v=d.useCallback(M=>{const{value:A}=M.target;p(A),r(A===""?null:i(A))},[i]),C=d.useCallback(()=>{u([])},[]),x=d.useCallback(M=>{M.key==="Enter"&&S()},[S]),k=d.useMemo(()=>14+gt(t.length,1,6)*oe.DEFAULT_ROW_HEIGHT,[t.length]);return c.jsxs("div",{className:I("editable-item-list-container",{"is-invalid":e}),children:[c.jsx("div",{style:{height:k},children:c.jsx(oe,{itemCount:t.length,items:t.map((M,A)=>({value:M,isSelected:le.isSelected(l,A)})),offset:0,selectedRanges:l,onSelectionChange:m,isMultiSelect:!0})}),c.jsxs("div",{className:"d-flex flex-row pt-2",children:[c.jsx("div",{className:"d-flex flex-grow-1",children:c.jsx("input",{className:I("form-control",{"is-invalid":a!=null}),placeholder:"Enter value",type:"text",value:h,onChange:v,onFocus:C,onKeyDown:x})}),c.jsxs("div",{className:"d-flex align-items-start mt-1 ml-2",children:[c.jsx(se,{kind:"ghost",onClick:S,disabled:a!=null||h==="",icon:ii,tooltip:"Add new item","data-testid":"add-item-button"}),c.jsx(se,{kind:"ghost",onClick:f,disabled:l.length===0,icon:oi,tooltip:"Delete selected items","data-testid":"delete-item-button"})]})]})]})}class Fe extends d.Component{static defaultProps={className:"",icon:null,id:"","data-testid":void 0};static isParentSelected(e,t){const n=t.get(e);if(n===void 0)return!1;if(typeof n=="boolean")return n;const s=Array.from(n.values()).includes(!0),i=Array.from(n.values()).includes(!1);return s&&i?null:s}constructor(e){super(e),this.toggleMenu=this.toggleMenu.bind(this),this.toggleValueFor=this.toggleValueFor.bind(this),this.selectAll=this.selectAll.bind(this),this.clear=this.clear.bind(this),this.state={menuIsOpen:!1}}toggleMenu(e){e.stopPropagation(),e.preventDefault(),this.setState(t=>{const{menuIsOpen:n}=t;return{menuIsOpen:!n}})}toggleValueFor(e,t){const{valueMap:n,onUpdateValueMap:s}=this.props,i=new Map(n),a=i.get(e);if(a instanceof Map){const l=new Map(a);if(t!=null)l.set(t,a.get(t)===void 0);else{const u=Fe.isParentSelected(e,i),h=u==null||!u;a.forEach((p,m)=>l.set(m,h))}i.set(e,l)}else i.set(e,a==null||!a);const r=i.get(e);if(t===void 0&&r!==void 0&&typeof r!="boolean"){const l=Fe.isParentSelected(e,n);l!=null&&l?r.forEach((u,h)=>r.set(h,!1)):r.forEach((u,h)=>r.set(h,!0))}s(i)}setAllValues(e){const{valueMap:t,onUpdateValueMap:n}=this.props,s=new Map;t.forEach((i,a)=>{if(typeof i=="boolean")s.set(a,e);else{const r=new Map;i.forEach((l,u)=>r.set(u,e)),s.set(a,r)}}),n(s)}selectAll(){this.setAllValues(!0)}clear(){this.setAllValues(!1)}renderMenuElement(){const{valueMap:e,"data-testid":t}=this.props;return c.jsxs("div",{className:"hcm-menu-container",children:[Array.from(e.entries()).map(([n,s])=>c.jsxs("div",{children:[c.jsx(ze,{className:"hcm-parent",checked:Fe.isParentSelected(n,e),onChange:()=>this.toggleValueFor(n),children:n}),s!==void 0&&typeof s!="boolean"&&Array.from(s.entries()).map(([i,a])=>c.jsx(ze,{className:"hcm-child",checked:a,onChange:()=>this.toggleValueFor(n,i),children:i},i))]},n)),c.jsx(se,{kind:"ghost",onClick:this.selectAll,"data-testid":t!==void 0?`${t}-btn-select-all`:void 0,children:"Select All"}),c.jsx(se,{kind:"ghost",onClick:this.clear,"data-testid":t!==void 0?`${t}-btn-clear`:void 0,children:"Clear"})]})}render(){const{menuText:e,className:t,icon:n,id:s,"data-testid":i}=this.props,{menuIsOpen:a}=this.state;return c.jsxs("button",{type:"button",className:I("btn hcm-btn",t),onClick:this.toggleMenu,id:s,"data-testid":i,children:[c.jsxs("span",{children:[n&&c.jsx(Z,{icon:n,className:"hcm-icon mr-1"}),e]}),c.jsx(Z,{icon:wn,className:"hcm-icon ml-1"}),c.jsx(Oe,{options:{placement:"bottom"},isShown:a,onExited:()=>{this.setState({menuIsOpen:!1})},closeOnBlur:!0,interactive:!0,children:this.renderMenuElement()})]})}}const vo=Fe;function Kn({on:o,id:e,className:t,isInvalid:n,disabled:s=!1,onClick:i,"data-testid":a}){return c.jsx("button",{type:"button",className:I("btn","btn-switch",t,{active:o},{"is-invalid":n}),id:e,onClick:i,disabled:s,"data-testid":a,children:c.jsx("div",{className:"handle"})})}function ln(o){return o.isOn!==void 0}function Wn({item:o,onSelect:e=()=>{},"data-testid":t}){const{icon:n,subtitle:s,title:i}=o,a=d.useMemo(()=>ln(o)?()=>{o.onChange(!o.isOn)}:e,[o,e]);return c.jsxs("div",{className:"btn btn-navigation-menu-item","data-testid":`menu-item-${i}`,onClick:a,onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&a()},tabIndex:0,role:"menuitem",children:[n!==void 0&&c.jsx("div",{className:"icon",children:c.jsx(Z,{icon:n})}),c.jsx("div",{className:"title",children:i}),s!==void 0&&c.jsx("div",{className:"shortcut",children:s}),c.jsx("div",{className:"accessory","data-testid":t,children:ln(o)?c.jsx(Kn,{on:o.isOn,onClick:r=>{r.stopPropagation(),a()}}):c.jsx(Z,{icon:xn})})]})}function Mo({items:o,onSelect:e=()=>{},"data-testid":t}){return c.jsx("div",{className:"navigation-menu-view","data-testid":t,children:c.jsx("ul",{className:"navigation-menu-list",children:o.map((n,s)=>c.jsx("li",{children:c.jsx(Wn,{item:n,onSelect:()=>{e(s)}})},n.title))})})}function yo({children:o,onBack:e,onClose:t,title:n,"data-testid":s}){return c.jsxs("div",{className:"navigation-page","data-testid":s,children:[c.jsxs("div",{className:"navigation-title-bar",children:[c.jsx("div",{className:"navigation-left-buttons",children:e!==void 0&&c.jsx(se,{kind:"ghost",className:"btn-back","data-testid":"btn-page-back",onClick:e,icon:ai,children:"Back"})}),c.jsx("div",{className:"navigation-title",children:n}),c.jsx("div",{className:"navigation-right-buttons",children:t!==void 0&&c.jsx(se,{kind:"ghost",className:"btn-close px-2 m-1","data-testid":"btn-page-close",onClick:t,icon:Nn,tooltip:"Close"})})]}),c.jsx("div",{className:"navigation-content",children:o})]})}function To({children:o,"data-testid":e}){const t=d.useMemo(()=>E.Children.toArray(o),[o]),n=Ot(t),[s,i]=d.useState(t[t.length-1]),[a,r]=d.useState(null),[l,u]=d.useState(null);d.useEffect(function(){if(n===void 0||t===n)return;const f=t[t.length-1];t.length===n.length||n.length===0||a!==null||l!==null?a!==null&&f!==a?r(f):f!==l&&f!==s&&i(f):t.length>n.length?r(f):t.length<n.length&&(i(f),u(n[n.length-1]))},[t,n,a,l,s]);const h=d.useCallback(()=>{i(a),r(null)},[a]),p=d.useCallback(()=>{u(null)},[]);return c.jsxs("div",{className:"navigation-stack",children:[c.jsx("div",{className:"main-view","data-testid":e,children:s}),c.jsx(Te,{in:l!=null,timeout:ce.transitionMidMs,classNames:"slide-right",onEntered:p,children:c.jsx(c.Fragment,{children:l!=null&&c.jsx("div",{className:"popping-view",children:l})})}),c.jsx(Te,{in:a!=null,timeout:ce.transitionMidMs,classNames:"slide-left",onEntered:h,children:c.jsx(c.Fragment,{children:a!=null&&c.jsx("div",{className:"pushing-view",children:a})})})]})}function Eo({children:o,disabled:e,value:t,"data-testid":n}){return c.jsx("option",{value:t,disabled:e,"data-testid":n,children:o})}function Io(o){const{children:e,disabled:t=!1,name:n,onChange:s,value:i="","data-testid":a}=o,[r]=d.useState(n??Se());return c.jsx(c.Fragment,{children:E.Children.map(e,l=>l?E.cloneElement(l,{name:r,onChange:l.props.onChange??s,checked:i===l.props.value,disabled:l.props.disabled??t,"data-testid":a}):null)})}const Ht=E.forwardRef((o,e)=>{const{checked:t,children:n,className:s="",disabled:i=!1,inputClassName:a="",isInvalid:r=!1,labelClassName:l="",name:u,onChange:h,value:p,"data-testid":m}=o,[f]=d.useState(Se());return c.jsxs("div",{className:I("custom-control custom-radio",s),children:[c.jsx("input",{type:"radio",id:f,"data-testid":m,name:u,ref:e,className:I("custom-control-input",a,{"is-invalid":r}),checked:t,disabled:i,value:p,onChange:h}),c.jsx("label",{className:I("custom-control-label",l),htmlFor:f,children:n})]})});Ht.displayName="RadioItem";Ht.defaultProps={checked:void 0,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};const xo=Ht;const wo=.025,No=.9,ko=.1,Do=.618,ht=ce["primary-dark"],cn=80,Oo=ce["gray-800"],Ao=ce["gray-900"],ve={SIZE:8,DOT_SIZE:2,FILL_OPACITY:.25},pe=18,Fo=250,Ro=60*1e3,Po=E.memo(()=>{const o=d.useRef(null),e=d.useRef(null),[t,n]=d.useState(!1),s=window.devicePixelRatio;let i,a,r,l,u,h=null,p=[];function m(){e.current!=null&&(r=e.current.offsetWidth,l=e.current.offsetHeight),o.current!=null&&(o.current.style.width=`${r}px`,o.current.style.height=`${l}px`,o.current.width=r*s,o.current.height=l*s),i?.scale(s,s)}function f(){const j=document.createElement("canvas");j.width=ve.SIZE,j.height=ve.SIZE;const R=j.getContext("2d");return R!=null&&(R.fillStyle=ht,R.fillRect(0,0,ve.DOT_SIZE,ve.DOT_SIZE),R.fillStyle=ht+Math.round(255*ve.FILL_OPACITY).toString(16).padStart(2,"0"),R.fillRect(0,0,ve.SIZE,ve.SIZE)),R?.createPattern(j,"repeat")}function S(j){const R=Math.random()-.5;let H=wo*R;return j<ko?H=Math.abs(H):j>No&&(H=-Math.abs(H)),j+H}function v(){const j=[];let R=Do;for(let H=0;H<r+pe;H+=1)R=S(R),j.push(R);return j}function C(){for(;p.length>=r+pe;)p.pop();for(;p.length<r+pe;)p.push(S(p[p.length-1]))}function x(j,R){R.beginPath(),R.moveTo(-1,l+1),R.lineTo(-1,l*j[0]);for(let H=0;H<j.length;H+=1)R.lineTo(H,l*j[H]);R.lineTo(r+pe,l*j[j.length-1]),R.lineTo(r+pe,l+1),R.closePath()}function k(j){j.beginPath();for(let R=1;R<r;R+=cn)j.moveTo(R,0),j.lineTo(R,l);for(let R=1;R<l;R+=cn)j.moveTo(0,R),j.lineTo(r,R)}function M(j){h=h??j,Ti(i),i.fillStyle=Ao,i.fillRect(0,0,r,l),k(i),i.lineWidth=1,i.strokeStyle=Oo,i.stroke();const R=((h??0)-(j??0))/(1e3/pe);if(i.translate(R,0),x(p,i),i.lineWidth=2,i.strokeStyle=ht,i.stroke(),i.translate(-R,0),a!=null&&(i.fillStyle=a),i.fill(),i.setTransform(s,0,0,s,0,0),(j??0)-(h??0)>1e3/pe){const H=Math.floor(((j??0)-(h??0))/(1e3/pe));for(let N=0;N<H;N+=1)p.shift(),p.push(S(p[p.length-1]));h=j}u!=null&&cancelAnimationFrame(u),u=requestAnimationFrame(M)}const A=Re(()=>{u=requestAnimationFrame(j=>{m(),C(),n(!1),M(j)})},Fo,{leading:!0});function F(){n(!0),u!=null&&cancelAnimationFrame(u),u=null,h=null}const O=Re(()=>{F()},Ro);function $(){u==null&&(n(!1),m(),C(),u=requestAnimationFrame(M)),O()}function B(){document.hasFocus()&&$()}function ee(){u!=null&&cancelAnimationFrame(u),O(),A()}return d.useEffect(()=>(i=o.current?.getContext("2d",{alpha:!1}),m(),p=v(),a=f(),M(),O(),window.addEventListener("resize",ee),window.addEventListener("focus",$),window.addEventListener("blur",F),window.addEventListener("mousemove",B),window.addEventListener("keydown",B),()=>{u!=null&&cancelAnimationFrame(u),window.removeEventListener("resize",ee),window.removeEventListener("focus",$),window.removeEventListener("blur",F),window.removeEventListener("mousemove",B),window.removeEventListener("keydown",B),O.cancel(),A.cancel()}),[]),c.jsx("div",{className:"random-area-plot-animation-container",ref:e,children:c.jsx("canvas",{ref:o,className:t?"shade":""})})}),qn=Po;function Lo({children:o,onBlur:e,onChange:t,className:n,defaultValue:s,name:i,value:a,disabled:r,"data-testid":l}){const u=d.useCallback(h=>{t(h.target.value)},[t]);return c.jsx("select",{className:I("custom-select",n),onBlur:e,onChange:u,defaultValue:s,value:a,name:i,disabled:r,"data-testid":l,children:o})}class jo extends d.PureComponent{static defaultProps={disabled:!1,rowHeight:21,onBlur:()=>{},"data-testid":void 0};constructor(e){super(e),this.handleBlur=this.handleBlur.bind(this),this.handleScroll=this.handleScroll.bind(this),this.handleSelect=this.handleSelect.bind(this),this.list=E.createRef(),this.topRow=null,this.bottomRow=null}componentDidMount(){this.sendViewportUpdate()}componentDidUpdate(){this.sendViewportUpdate()}list;topRow;bottomRow;getCachedItem=ne((e,t,n,s,i,a,r)=>{const l={height:i},u=s??n;return c.jsx("li",{className:"value-list-item",style:l,tabIndex:-1,children:c.jsx(ze,{checked:a,disabled:r,onChange:()=>this.handleSelect(e),children:u})},t)},{max:1e3});getCachedItems=ne((e,t,n,s)=>{const i=[];for(let a=0;a<e.length;a+=1){const r=e[a],{value:l,displayValue:u,isSelected:h}=r,p=n+a,m=p,f=this.getCachedItem(p,m,l,u,t,h,s);i.push(f)}return i},{max:1});handleBlur(e){if(!e.relatedTarget||this.list.current&&e.relatedTarget instanceof HTMLElement&&!this.list.current.contains(e.relatedTarget)){const{onBlur:t}=this.props;t?.(e)}}handleScroll(){this.sendViewportUpdate()}handleSelect(e){const{items:t,offset:n,onSelect:s}=this.props,i=e-n;if(i>=0&&i<t.length){const a=t[i],{value:r}=a;s(e,r)}else s(e,null)}sendViewportUpdate(){if(!this.list.current||this.list.current.clientHeight===0)return;const{onViewportChange:e,rowHeight:t}=this.props,n=this.list.current.scrollTop,s=n+this.list.current.clientHeight,i=Math.floor(n/t),a=Math.ceil(s/t);(this.topRow!==i||this.bottomRow!==a)&&(this.topRow=i,this.bottomRow=a,e(i,a))}getElement(e){return this.list.current==null?null:this.list.current.querySelectorAll(".value-list-item")[e]}scrollIntoView(e){this.getElement(e)?.scrollIntoView({block:"center"})}render(){const{className:e,disabled:t,isInvalid:n,items:s,itemCount:i,offset:a,rowHeight:r,"data-testid":l}=this.props,u=this.getCachedItems(s,r,a,t);return c.jsx("div",{className:I("select-value-list-scroll-pane h-100 w-100",{"is-invalid":n},e),onBlur:this.handleBlur,onScroll:this.handleScroll,ref:this.list,"data-testid":l,children:c.jsx("div",{className:"select-value-list",style:{height:i*r},children:c.jsx("ol",{className:"select-value-list-content",style:{position:"absolute",height:s.length*r,top:a*r,left:0},children:u})})})}}const Gn=jo,un=V.module("Shortcut");var te=(o=>(o.CTRL="MODIFIER_CTRL",o.CMD="MODIFIER_CMD",o.ALT="MODIFIER_ALT",o.OPTION="MODIFIER_OPTION",o.SHIFT="MODIFIER_SHIFT",o))(te||{}),X=(o=>(o.A="A",o.B="B",o.C="C",o.D="D",o.E="E",o.F="F",o.G="G",o.H="H",o.I="I",o.J="J",o.K="K",o.L="L",o.M="M",o.N="N",o.O="O",o.P="P",o.Q="Q",o.R="R",o.S="S",o.T="T",o.U="U",o.V="V",o.W="W",o.X="X",o.Y="Y",o.Z="Z",o.ZERO="0",o.ONE="1",o.TWO="2",o.THREE="3",o.FOUR="4",o.FIVE="5",o.SIX="6",o.SEVEN="7",o.EIGHT="8",o.NINE="9",o.BACKSPACE="Backspace",o.ESCAPE="Escape",o.ENTER="Enter",o.DELETE="Delete",o.SLASH="/",o.QUESTION_MARK="?",o.BACKSLASH="\\",o.PIPE="|",o.MINUS="-",o.UNDERSCORE="_",o.EQUALS="=",o.PLUS="+",o.BACKTICK="`",o.TILDE="~",o.COMMA=",",o.LEFT_CHEVRON="<",o.PERIOD=".",o.RIGHT_CHEVRON=">",o.SEMICOLON=";",o.COLON=":",o.SINGLE_QUOTE="'",o.DOUBLE_QUOTE='"',o.LEFT_BRACKET="[",o.RIGHT_BRACKET="]",o.LEFT_CURLY="{",o.RIGHT_CURLY="}",o.F1="F1",o.F2="F2",o.F3="F3",o.F4="F4",o.F5="F5",o.F6="F6",o.F7="F7",o.F8="F8",o.F9="F9",o.F10="F10",o.F11="F11",o.F12="F12",o))(X||{});const $o=new Set(["Enter","Delete","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]);class W extends Tn{id;name;tooltip;isEditable;defaultKeyState;keyState;static NULL_KEY_STATE={metaKey:!1,shiftKey:!1,altKey:!1,ctrlKey:!1,keyValue:null};static isAllowedKey(e){return Object.values(X).includes(e)}static isValidKeyState(e){const{keyValue:t}=e;return t===null?!0:!W.isMacPlatform&&e.metaKey||!W.isAllowedKey(t)?!1:!(!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey)||$o.has(t)}static isMacPlatform=U.isMacPlatform();static createKeyState(e){const t={altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1,keyValue:e[e.length-1]};return e.forEach(n=>{switch(n){case"MODIFIER_CTRL":t.ctrlKey=!0;break;case"MODIFIER_ALT":case"MODIFIER_OPTION":t.altKey=!0;break;case"MODIFIER_CMD":t.metaKey=!0;break;case"MODIFIER_SHIFT":t.shiftKey=!0;break}}),t}static getKeyStateFromEvent(e){const{key:t,keyCode:n}=e;let s="";return t==="Shift"||t==="Meta"||t==="Control"||t==="Alt"?s="":!W.isAllowedKey(t)&&W.isAllowedKey(String.fromCharCode(n))?s=String.fromCharCode(n):s=t,{keyValue:s,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey}}static getWindowsDisplayText(e){let t="";return e.ctrlKey&&(t+="Ctrl+"),e.altKey&&(t+="Alt+"),e.shiftKey&&(t+="Shift+"),e.keyValue==="Escape"?t+="Esc":e.keyValue!==null&&(t+=e.keyValue),t}static getMacDisplayText(e){let t="";switch(e.ctrlKey&&(t+="⌃"),e.altKey&&(t+="⌥"),e.shiftKey&&(t+="⇧"),e.metaKey&&(t+="⌘"),e.keyValue){case"Enter":t+="⏎";break;case"Escape":t+="⎋";break;case"Backspace":t+="⌫";break;case"Delete":t+="⌦";break;case null:break;default:t+=e.keyValue}return t}static doKeyStatesMatch(e,t){return e.keyValue?.toUpperCase()===t.keyValue?.toUpperCase()&&e.altKey===t.altKey&&e.ctrlKey===t.ctrlKey&&e.metaKey===t.metaKey&&e.shiftKey===t.shiftKey}static getDisplayText(e){return e.keyValue===null?"":W.isMacPlatform?W.getMacDisplayText(e):W.getWindowsDisplayText(e)}constructor({id:e,shortcut:t,macShortcut:n,isEditable:s=!0,name:i,tooltip:a}){super(),this.id=e,this.name=i,this.tooltip=a,this.isEditable=s;const l=W.isMacPlatform?n:t;this.defaultKeyState=W.createKeyState(l),this.keyState=this.defaultKeyState}getDisplayText(){return W.getDisplayText(this.keyState)}getKeyState(){return this.keyState}setKeyState(e){W.isValidKeyState(e)?(un.debug2(`Shortcut ${this.id} updated to ${JSON.stringify(e)}`),this.keyState=e,this.dispatchEvent(new Dn("onUpdate",{detail:this}))):un.debug2(`Shortcut ${this.id} tried to update to invalid keyState ${JSON.stringify(e)}`)}getDefaultKeyState(){return this.defaultKeyState}isDefault(){return W.doKeyStatesMatch(this.getDefaultKeyState(),this.getKeyState())}setToNull(){this.setKeyState(W.NULL_KEY_STATE)}isNull(){return W.doKeyStatesMatch(this.keyState,W.NULL_KEY_STATE)}setToDefault(){this.setKeyState(this.defaultKeyState)}matchesKeyState(e){return W.doKeyStatesMatch(e,this.keyState)}matchesEvent(e){return this.matchesKeyState(W.getKeyStateFromEvent(e))}}const dn=V.module("ShortcutRegistry");class Vo extends Tn{shortcutMap=new Map;shortcutsByCategory=new Map;createAndAdd(e){const t=new W(e);return this.add(t)}add(e){const t=this.shortcutMap.get(e.id);if(t)return dn.warn(`Skipping attempt to add duplicate shortcut ID to registry: ${e.id}`),t;dn.debug2(`Adding shortcut to registry: ${e.id}`),e.addEventListener("onUpdate",({detail:s})=>this.dispatchEvent(new Dn("onUpdate",{detail:s})));const n=e.id.split(".")[0];return this.shortcutMap.set(e.id,e),this.shortcutsByCategory.has(n)?this.shortcutsByCategory.get(n)?.push(e):this.shortcutsByCategory.set(n,[e]),e}get(e){return this.shortcutMap.get(e)}getConflictingShortcuts(e){return Array.from(this.shortcutMap.values()).filter(t=>!t.isNull()&&t.matchesKeyState(e))}}const Bo=Object.freeze(new Vo),Me=Bo,Ho={COPY:Me.createAndAdd({id:"GLOBAL.COPY",name:"Copy",shortcut:[te.CTRL,X.C],macShortcut:[te.CMD,X.C],isEditable:!1}),PASTE:Me.createAndAdd({id:"GLOBAL.PASTE",name:"Paste",shortcut:[te.CTRL,X.V],macShortcut:[te.CMD,X.V],isEditable:!1}),SAVE:Me.createAndAdd({id:"GLOBAL.SAVE",name:"Save",shortcut:[te.CTRL,X.S],macShortcut:[te.CMD,X.S],isEditable:!1}),SELECT_ALL:Me.createAndAdd({id:"GLOBAL.SELECT_ALL",name:"Select All",shortcut:[te.CTRL,X.A],macShortcut:[te.CMD,X.A],isEditable:!1}),LINKER:Me.createAndAdd({id:"GLOBAL.LINKER",name:"Linker",shortcut:[te.CTRL,X.L],macShortcut:[te.CMD,X.L]}),LINKER_CLOSE:Me.createAndAdd({id:"GLOBAL.LINKER_CLOSE",name:"Close Linker Overlay",shortcut:[X.ESCAPE],macShortcut:[X.ESCAPE],isEditable:!1})},_o=Ho;const _t=E.forwardRef((o,e)=>{const{children:t,className:n,disabled:s,id:i,isLinked:a,isLinkedSource:r,isInvalid:l,onClick:u,onMouseEnter:h,onMouseLeave:p,style:m,"data-testid":f}=o;return c.jsxs("button",{ref:e,type:"button",className:I("btn-socketed",{"btn-socketed-linked":a!==void 0&&a||r},{"btn-socketed-linked-source":r},{"is-invalid":l},n),id:i,onClick:u,onMouseEnter:h,onMouseLeave:p,style:m,disabled:s,"data-testid":f,children:[t,c.jsx(Z,{icon:ri,className:"linked btn-socketed-icon",transform:"down-1"}),c.jsx(Z,{icon:li,className:"is-invalid btn-socketed-icon"})]})});_t.displayName="SocketedButton";_t.defaultProps={children:void 0,className:"",disabled:!1,id:void 0,isLinked:!1,isLinkedSource:!1,isInvalid:!1,onClick:void 0,onMouseEnter:void 0,onMouseLeave:void 0,style:void 0,"data-testid":void 0};const Uo=_t,Ko={"dh-spectrum-theme--dark":"_dh-spectrum-theme--dark_i6xja_5"},Wo={"dh-spectrum-theme--light":"_dh-spectrum-theme--light_16vb7_5"},{global:qo,light:Go,dark:zo,medium:Zo,large:Xo}=_s,Qo={global:qo,light:{...Go,...Wo},dark:{...zo,...Ko},medium:Zo,large:Xo},Jo="_track_535ju_30",Yo="_handle_535ju_13",ea="_ticks_535ju_98",zn={"handle-size":"15px","popover-width":"90px","time-slider":"_time-slider_535ju_3","time-slider-popovers":"_time-slider-popovers_535ju_8","handle-popper":"_handle-popper_535ju_13","flex-spacer":"_flex-spacer_535ju_26",track:Jo,"track-fills":"_track-fills_535ju_37","track-fill":"_track-fill_535ju_37","track-fill-start":"_track-fill-start_535ju_55","track-fill-middle":"_track-fill-middle_535ju_56","track-fill-end":"_track-fill-end_535ju_59","handle-track":"_handle-track_535ju_62",handle:Yo,ticks:ea,"tick-labels":"_tick-labels_535ju_116","tick-label":"_tick-label_535ju_116","tick-label-wrapper":"_tick-label-wrapper_535ju_132"};const Ue=parseInt(zn["handle-size"],10),hn=parseInt(zn["popover-width"],10),Y=24*60*60-1,pn=5*60;function ta({startTime:o,endTime:e,onChange:t,isStartModified:n=!1,isEndModified:s=!1,"data-testid":i}){const[a,r]=d.useState(o),[l,u]=d.useState(e),h=d.useRef(null);d.useEffect(function(){r(o),u(e)},[o,e]);const p=d.useCallback((S,v)=>{let C=S,x=v;C===x&&(x<Y?x+=1:C-=1),r(C),u(x),t({startTime:C,endTime:x})},[r,u,t]),m=d.useCallback(S=>{p(S,l)},[p,l]),f=d.useCallback(S=>{p(a,S)},[p,a]);return c.jsxs("div",{className:"time-slider","data-testid":i,children:[c.jsx(na,{startTime:a,endTime:l,onStartTimeChange:m,onEndTimeChange:f,isStartModified:n,isEndModified:s}),c.jsxs("div",{className:"track",ref:h,children:[c.jsx(sa,{startTime:a,endTime:l}),c.jsx("div",{className:"ticks",children:Array(24).fill(null).map((S,v)=>c.jsx("div",{className:"tick"},v))}),c.jsx(mn,{track:h,time:a,setTime:m}),c.jsx(mn,{track:h,time:l,setTime:f})]}),c.jsxs("div",{className:"tick-labels",children:[c.jsx("div",{className:"tick-label",children:"0:00"}),c.jsx("div",{className:"tick-label-wrapper",children:Array(24).fill(null).map((S,v)=>c.jsx("div",{className:"tick-label",children:`${v+1}:00`},v))})]})]})}function na(o){const{startTime:e,endTime:t,onStartTimeChange:n,onEndTimeChange:s,isStartModified:i,isEndModified:a,"data-testid":r}=o,l=e>t,[u,h]=d.useState(l?t:e),[p,m]=d.useState(l?e:t),f=d.useRef(null),S=d.useRef(null),v=d.useRef(null),C=d.useRef(null);d.useEffect(function(){h(e>t?t:e),m(e>t?e:t)},[e,t]),d.useEffect(function(){v.current!==null&&S.current?.setSelection(v.current),C.current!==null&&f.current?.setSelection(C.current)},[l]);function x(F){e<=t?n(F):s(F)}function k(F){e<=t?s(F):n(F)}const M=d.useCallback(F=>{v.current=F,C.current=null},[]),A=d.useCallback(F=>{v.current=null,C.current=F},[]);return c.jsxs("div",{className:"time-slider-popovers",children:[c.jsx("div",{className:"flex",style:{flexBasis:`calc(${u/Y*100}% - ${hn/2}px)`}}),c.jsxs("div",{className:"handle-popper",children:[c.jsx("label",{className:I({modified:l?a:i}),children:l?"End Time":"Start Time"}),c.jsx(Ze,{ref:f,allowValueWrapping:!1,value:u,onChange:x,onSelect:M,"data-testid":r!==void 0?`${r}-input-1`:void 0})]}),c.jsx("div",{className:"flex-spacer"}),c.jsxs("div",{className:"handle-popper",children:[c.jsx("label",{className:I({modified:l?i:a}),children:l?"Start Time":"End Time"}),c.jsx(Ze,{ref:S,allowValueWrapping:!1,value:p,onChange:k,onSelect:A,"data-testid":r!==void 0?`${r}-input-2`:void 0})]}),c.jsx("div",{className:"flex",style:{flexBasis:`calc(${(Y-p)/Y*100}% - ${hn/2}px)`}})]})}function sa(o){const{startTime:e,endTime:t,"data-testid":n}=o;return c.jsxs("div",{className:"track-fills","data-testid":n,children:[e>t&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"track-fill track-fill-start",style:{transform:`scaleX(${t/Y})`}}),c.jsx("div",{className:"track-fill track-fill-end",style:{transform:`scaleX(${(Y-e)/Y})`}})]}),e<t&&c.jsx("div",{className:"track-fill track-fill-middle",style:{transform:`translateX(${e/Y*100}%) scaleX(${(t-e)/Y})`}})]})}function mn(o){const{track:e,time:t,setTime:n,"data-testid":s}=o,i=d.useMemo(()=>{let f=Ue/2;return t<3600?f=t/3600*(Ue/2):t>23*3600&&(f=Ue/2+1/(Y-23*3600)*(t-23*3600)*(Ue/2)),`translateX(calc(${t/Y*100}% - ${f}px))`},[t]),a=d.useCallback(m=>{if(!e.current)return 0;const f=e.current.getBoundingClientRect(),S=Math.max(m-f.left,0),v=Y*Math.min(1,S/f.width),C=pn*Math.round(v/pn);return Math.min(Y,C)},[e]),r=d.useCallback(({clientX:m})=>{n(a(m))},[n,a]),l=d.useCallback(({clientX:m})=>{n(a(m)),window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",l),document.documentElement.classList.remove("drag-pointer-events-none")},[n,a,r]),u=d.useCallback(()=>{window.addEventListener("mousemove",r),window.addEventListener("mouseup",l),document.documentElement.classList.add("drag-pointer-events-none")},[r,l]),h=d.useCallback(()=>{window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",l),document.documentElement.classList.remove("drag-pointer-events-none")},[r,l]),p=d.useCallback(()=>{u()},[u]);return d.useEffect(function(){return()=>{h()}},[h]),c.jsx("div",{className:"handle-track",style:{transform:i},children:c.jsx("button",{className:"handle",type:"button","aria-label":"Change time",onMouseDown:p,"data-testid":s})})}function Zn({buttons:o,isShown:e=!1,classNames:t,message:n,type:s,onClick:i,onDismiss:a,"data-testid":r}){const l=o&&o.length!==0;return c.jsx(Te,{in:e,timeout:ce.transitionMs,classNames:"toast-notification-slide-up",mountOnEnter:!0,unmountOnExit:!0,children:c.jsxs("div",{className:I("toast-notification",t,s),role:"presentation",onClick:i,onKeyPress:i,"data-testid":r,children:[c.jsx("div",{className:"message-container",children:c.jsx("span",{className:"message",children:n})}),c.jsx(Te,{in:l,timeout:ce.transitionSlowMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:c.jsx("div",{className:"buttons-container",children:o})}),a&&c.jsx(se,{kind:"ghost",icon:Nn,tooltip:"Close notification",className:"my-2",onClick:a})]})})}Zn.TYPE=Object.freeze({ERROR:"error"});function ia(o){const{children:e,className:t,labelText:n,hintText:s,isModified:i,validationError:a,showValidationError:r=!0,"data-testid":l,id:u}=o,{current:h}=d.useRef(u??Se());return c.jsxs(c.Fragment,{children:[c.jsx("label",{className:I("validate-label",t,{modified:i}),htmlFor:h,"data-testid":l,children:n}),E.Children.toArray(e).map(p=>E.isValidElement(p)?E.cloneElement(p,{className:I(p.props.className,{"is-invalid":a})}):c.jsx("div",{className:I(t),children:p})),s!==void 0&&c.jsx("small",{className:"form-text text-muted",children:s}),a!==void 0&&r&&c.jsx("p",{className:"validate-label-error text-danger",children:a})]})}const oa=Object.freeze(Object.defineProperty({__proto__:null,AutoCompleteInput:mi,AutoResizeTextarea:Dt,BasicModal:Pt,Button:se,ButtonGroup:je,ButtonOld:Fi,CardFlip:Ri,Checkbox:ze,Collapse:Ki,ComboBox:qi,ContextActionUtils:U,ContextActions:Bi,ContextMenuItem:jt,ContextMenuRoot:Ui,CopyButton:Gi,CustomTimeSelect:eo,DEFAULT_GET_PREFERRED_REPLACEMENT_STRING:st,DateInput:po,DateTimeInput:ro,DebouncedModal:Oi,DebouncedSearchInput:fo,DragUtils:Co,DraggableItemList:bo,DropdownMenu:Vn,EditableItemList:So,GLOBAL_SHORTCUTS:_o,HierarchicalCheckboxMenu:vo,InfoModal:Ai,ItemList:oe,ItemListItem:Un,KEY:X,LoadingOverlay:Le,LoadingSpinner:wt,MODIFIER:te,MaskedInput:it,Menu:Mo,MenuItem:Wn,Modal:It,ModalBody:xt,ModalFooter:Rn,ModalHeader:In,Option:Eo,Page:yo,Popper:Oe,RadioGroup:Io,RadioItem:xo,RandomAreaPlotAnimation:qn,SearchInput:nt,Select:Lo,SelectValueList:Gn,Shortcut:W,ShortcutRegistry:Me,SocketedButton:Uo,Stack:To,ThemeExport:ce,TimeInput:Ze,TimeSlider:ta,ToastNotification:Zn,Tooltip:kt,UISwitch:Kn,ValidateLabelInput:ia,fillToLength:Ln,themeDHDefault:Qo,trimTrailingMask:Ct},Symbol.toStringTag,{value:"Module"}));function ae(){return $e(Nt,"No API available in useApi. Was code wrapped in ApiBootstrap or ApiContext.Provider?")}function aa(o,e){const t=ae(),n=d.useMemo(()=>new t.CoreClient(o,e),[t,o,e]);return d.useEffect(()=>()=>{n.disconnect()},[n]),n}const Ut=d.createContext(null);function ra({serverUrl:o,options:e,children:t}){const n=aa(o,e);return c.jsx(Ut.Provider,{value:n,children:t})}function Ve(){return $e(Ut,"No Client available in useClient. Was code wrapped in ClientBootstrap or ClientContext.Provider?")}const la=Object.freeze(Object.defineProperty({__proto__:null,ApiBootstrap:ci,ApiContext:Nt,ClientBootstrap:ra,ClientContext:Ut,useApi:ae,useClient:Ve},Symbol.toStringTag,{value:"Module"})),Xn=1e4;function ca(o,e,t=Xn){return new Promise((n,s)=>{let i;const a=setTimeout(()=>{i?.(),s(new Ye(`Variable ${e} not found`))},t);function r(l){const u=l.created.find(h=>h.title===e);u!=null&&(clearTimeout(a),i?.(),n(u))}i=o.subscribeToFieldUpdates(r)})}class ua{static TYPE_GLOBAL="type-global";static TYPE_CONTEXT_PRESET="type-context-preset";static TYPE_CONTEXT_CUSTOM="type-context-custom";static isValid(e,t){return!0}static isSameFormat(e,t){throw new Error("isSameFormat not implemented")}static makeFormat(e,t,n){return{label:e,formatString:t,type:n}}format(e,t){return""}}const z=ua;class da extends z{format(e){switch(e){case 1:case!0:return"true";case 0:case!1:return"false";default:return""}}}const Qn=da;class ha extends z{format(e){return String.fromCharCode(e)}}const Jn=ha,fn=V.module("DateTimeColumnFormatter");class he extends z{static isValid(e,t){try{return e.i18n.DateTimeFormat.format(t.formatString,new Date),!0}catch{return!1}}static makeFormat(e,t,n=z.TYPE_CONTEXT_PRESET){return{label:e,formatString:t,type:n}}static isSameFormat(e,t){return e===t||e!==null&&t!==null&&e.type===t.type&&e.formatString===t.formatString}static DEFAULT_DATETIME_FORMAT_STRING="yyyy-MM-dd HH:mm:ss.SSS";static DEFAULT_TIME_ZONE_ID="America/New_York";static makeGlobalFormatStringMap(e,t){const n=t?"'T'":" ",s=e?" z":"";return new Map([["yyyy-MM-dd HH:mm:ss",`yyyy-MM-dd${n}HH:mm:ss${s}`],["yyyy-MM-dd HH:mm:ss.SSS",`yyyy-MM-dd${n}HH:mm:ss.SSS${s}`],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS",`yyyy-MM-dd${n}HH:mm:ss.SSSSSSSSS${s}`]])}static getGlobalFormats(e,t){return[...he.makeGlobalFormatStringMap(e,t).keys()]}static makeFormatStringMap(e,t){const n=t!==void 0&&t?"'T'":" ",s=e!==void 0&&e?" z":"";return new Map([["yyyy-MM-dd",`yyyy-MM-dd${s}`],["MM-dd-yyyy",`MM-dd-yyyy${s}`],["HH:mm:ss",`HH:mm:ss${s}`],["HH:mm:ss.SSS",`HH:mm:ss.SSS${s}`],["HH:mm:ss.SSSSSSSSS",`HH:mm:ss.SSSSSSSSS${s}`],["yyyy-MM-dd HH:mm:ss",`yyyy-MM-dd${n}HH:mm:ss${s}`],["yyyy-MM-dd HH:mm:ss.SSS",`yyyy-MM-dd${n}HH:mm:ss.SSS${s}`],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS",`yyyy-MM-dd${n}HH:mm:ss.SSSSSSSSS${s}`]])}static getFormats(e,t){return[...he.makeFormatStringMap(e,t).keys()]}dh;dhTimeZone;defaultDateTimeFormatString;showTimeZone;showTSeparator;formatStringMap;constructor(e,{timeZone:t="",showTimeZone:n=!0,showTSeparator:s=!1,defaultDateTimeFormatString:i=he.DEFAULT_DATETIME_FORMAT_STRING}={}){super();const a=t||he.DEFAULT_TIME_ZONE_ID;try{this.dhTimeZone=e.i18n.TimeZone.getTimeZone(a)}catch{fn.error("Unsupported time zone id",a),this.dhTimeZone=e.i18n.TimeZone.getTimeZone(he.DEFAULT_TIME_ZONE_ID)}this.dh=e,this.defaultDateTimeFormatString=i,this.showTimeZone=n,this.showTSeparator=s,this.formatStringMap=he.makeFormatStringMap(n,s)}getEffectiveFormatString(e){return this.formatStringMap.get(e)??e}format(e,t={}){const n=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultDateTimeFormatString,s=this.getEffectiveFormatString(n);try{return this.dh.i18n.DateTimeFormat.format(s,e,this.dhTimeZone)}catch{fn.error("Invalid format arguments")}return""}}const pa=V.module("DecimalColumnFormatter");class J extends z{static isValid(e,t){try{return e.i18n.NumberFormat.format(t.formatString,0),!0}catch{return!1}}static makeFormat(e,t,n=z.TYPE_CONTEXT_PRESET,s){return{label:e,type:n,formatString:t,multiplier:s}}static makePresetFormat(e,t="",n){return J.makeFormat(e,t,z.TYPE_CONTEXT_PRESET,n)}static makeCustomFormat(e="",t){return J.makeFormat("Custom Format",e,z.TYPE_CONTEXT_CUSTOM,t)}static DEFAULT_FORMAT_STRING="###,##0.0000";static FORMAT_PERCENT=J.makePresetFormat("Percent","##0.00%");static FORMAT_BASIS_POINTS=J.makePresetFormat("Basis Points","###,##0 bp",1e4);static FORMAT_MILLIONS=J.makePresetFormat("Millions","###,##0.000 mm",1e-6);static FORMAT_SCIENTIFIC_NOTATION=J.makePresetFormat("Scientific Notation","0.0000E0");static FORMAT_ROUND=J.makePresetFormat("Round","###,##0");static FORMAT_ROUND_TWO_DECIMALS=J.makePresetFormat("0.00","###,##0.00");static FORMAT_ROUND_FOUR_DECIMALS=J.makePresetFormat("0.0000","###,##0.0000");static isSameFormat(e,t){return e===t||e!=null&&t!=null&&e.type===t.type&&e.formatString===t.formatString&&e.multiplier===t.multiplier}defaultFormatString;dh;constructor(e,{defaultFormatString:t=J.DEFAULT_FORMAT_STRING}={}){super(),this.dh=e,this.defaultFormatString=t}format(e,t={}){const n=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,s=t.multiplier!=null&&t.multiplier!==0?e*t.multiplier:e;try{return this.dh.i18n.NumberFormat.format(n,s)}catch{pa.error("Invalid format arguments")}return""}}class ma extends z{format(e){return`${e}`}}const Yn=ma,fa=V.module("IntegerColumnFormatter");class be extends z{static isValid(e,t){try{return e.i18n.NumberFormat.format(t.formatString,0),!0}catch{return!1}}static makeFormat(e,t,n=z.TYPE_CONTEXT_PRESET,s){return{label:e,type:n,formatString:t,multiplier:s}}static makePresetFormat(e,t="",n){return be.makeFormat(e,t,z.TYPE_CONTEXT_PRESET,n)}static makeCustomFormat(e="",t){return be.makeFormat("Custom Format",e,z.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}static DEFAULT_FORMAT_STRING="###,##0";static FORMAT_MILLIONS=be.makePresetFormat("Millions","###,##0.000 mm",1e-6);static FORMAT_SCIENTIFIC_NOTATION=be.makePresetFormat("Scientific Notation","0.0000E0");dh;defaultFormatString;constructor(e,{defaultFormatString:t=be.DEFAULT_FORMAT_STRING}={}){super(),this.dh=e,this.defaultFormatString=t}format(e,t={}){const n=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,s=t.multiplier!=null&&t.multiplier!==0?e*t.multiplier:e;try{return this.dh.i18n.NumberFormat.format(n,s)}catch{fa.error("Invalid format arguments")}return""}}class es extends z{format(e){return e}}class G{static FULL_DATE_FORMAT="yyyy-MM-dd HH:mm:ss.SSSSSSSSS";static months=["january","february","march","april","may","june","july","august","september","october","november","december"];static makeDateWrapper(e,t,n,s=0,i=1,a=0,r=0,l=0,u=0){if(!t)throw new Error("No timezone provided");const h=`${n}`.padStart(4,"0"),p=`${s+1}`.padStart(2,"0"),m=`${i}`.padStart(2,"0"),f=`${a}`.padStart(2,"0"),S=`${r}`.padStart(2,"0"),v=`${l}`.padStart(2,"0"),C=`${u}`.padStart(9,"0"),x=`${h}-${p}-${m} ${f}:${S}:${v}.${C}`;return e.i18n.DateTimeFormat.parse(G.FULL_DATE_FORMAT,x,e.i18n.TimeZone.getTimeZone(t))}static getNextNanos(e){const t=parseInt(e,10),n="0".repeat(9-e.length),s=`${t+1}${n}`;return parseInt(s,10)}static getNextDate(e,t,n,s){let{year:i,month:a,date:r,hours:l,minutes:u,seconds:h,nanos:p}=n;if(t.nanos!=null){if(t.nanos.length===9)return null;p=G.getNextNanos(t.nanos),p>999999999&&(h+=1,p=0)}else t.seconds!=null?h+=1:t.minutes!=null?u+=1:t.hours!=null?l+=1:t.date!=null?r+=1:t.month!=null?a+=1:i+=1;const m=new Date(i,a,r,l,u,h);return G.makeDateWrapper(e,s,m.getFullYear(),m.getMonth(),m.getDate(),m.getHours(),m.getMinutes(),m.getSeconds(),p)}static parseMonth(e){const t=parseInt(e,10);if(!Number.isNaN(t))return t>=1&&t<=12?t-1:NaN;const n=e.trim().toLowerCase();if(n.length>=3){for(let s=0;s<G.months.length;s+=1)if(G.months[s].startsWith(n))return s}return NaN}static parseDateValues(e,t,n,s,i,a,r){const l=parseInt(e,10),u=t!=null?this.parseMonth(t):0,h=n!=null?parseInt(n,10):1,p=s!=null?parseInt(s,10):0,m=i!=null?parseInt(i,10):0,f=a!=null?parseInt(a,10):0,S=r!=null?parseInt(r.padEnd(9,"0"),10):0;return Number.isNaN(l)||Number.isNaN(u)||Number.isNaN(h)||Number.isNaN(p)||Number.isNaN(m)||Number.isNaN(f)||Number.isNaN(S)?null:{year:l,month:u,date:h,hours:p,minutes:m,seconds:f,nanos:S}}static parseDateTimeString(e){const n=/\s*(\d{4})([-./]([\da-z]+))?([-./](\d{1,2}))?([tT\s](\d{2})([:](\d{2}))?([:](\d{2}))?([.](\d{1,9}))?)?(.*)/.exec(e);if(n==null)throw new Error(`Unexpected date string: ${e}`);const[,s,,i,,a,,r,,l,,u,,h,p]=n;if(p!=null&&p.length>0)throw new Error(`Unexpected characters after date string '${e}': ${p}`);return{year:s,month:i,date:a,hours:r,minutes:l,seconds:u,nanos:h}}static parseDateRange(e,t,n){const s=t.trim().toLowerCase();if(s.length===0)throw new Error("Cannot parse date range from empty string");if(s==="null")return[null,null];if(s==="today"){const u=new Date(Date.now()),h=G.makeDateWrapper(e,n,u.getFullYear(),u.getMonth(),u.getDate()),p=G.makeDateWrapper(e,n,u.getFullYear(),u.getMonth(),u.getDate()+1);return[h,p]}if(s==="yesterday"){const u=new Date(Date.now()),h=G.makeDateWrapper(e,n,u.getFullYear(),u.getMonth(),u.getDate()-1),p=G.makeDateWrapper(e,n,u.getFullYear(),u.getMonth(),u.getDate());return[h,p]}if(s==="now"){const u=new Date(Date.now());return[e.DateWrapper.ofJsDate(u),null]}const i=G.parseDateTimeString(s);if(i.year==null&&i.month==null&&i.date==null)throw new Error(`Unable to extract year, month, or day ${s}`);const a=G.parseDateValues(i.year,i.month,i.date,i.hours,i.minutes,i.seconds,i.nanos);if(a==null)throw new Error(`Unable to extract date values from ${i}`);const r=G.makeDateWrapper(e,n,a.year,a.month,a.date,a.hours,a.minutes,a.seconds,a.nanos),l=G.getNextDate(e,i,a,n);return[r,l]}static getJsDate(e){return typeof e=="number"?new Date(e):e.asDate()}}class gn{static not="not";static and="and";static or="or"}function wr(o){if(!(o==="not"||o==="and"||o==="or"))throw new Error("operator is not a valid FilterOperatorValue")}class T{static eq="eq";static eqIgnoreCase="eqIgnoreCase";static notEq="notEq";static notEqIgnoreCase="notEqIgnoreCase";static greaterThan="greaterThan";static greaterThanOrEqualTo="greaterThanOrEqualTo";static lessThan="lessThan";static lessThanOrEqualTo="lessThanOrEqualTo";static in="in";static inIgnoreCase="inIgnoreCase";static notIn="notIn";static notInIgnoreCase="notInIgnoreCase";static isTrue="isTrue";static isFalse="isFalse";static isNull="isNull";static invoke="invoke";static contains="contains";static notContains="notContains";static containsIgnoreCase="containsIgnoreCase";static startsWith="startsWith";static endsWith="endsWith";static containsAny="containsAny"}const ue=V.module("TableUtils");class b{static dataType={BOOLEAN:"boolean",CHAR:"char",DATETIME:"datetime",DECIMAL:"decimal",INT:"int",STRING:"string",UNKNOWN:"unknown"};static sortDirection={ascending:"ASC",descending:"DESC",reverse:"REVERSE",none:null};static APPLY_TABLE_CHANGE_TIMEOUT_MS=3e4;static REVERSE_TYPE=Object.freeze({NONE:"none",PRE_SORT:"pre-sort",POST_SORT:"post-sort"});static NUMBER_REGEX=/^-?\d+(\.\d+)?$/;static executeAndWaitForEvent=async(e,t,n,s=b.APPLY_TABLE_CHANGE_TIMEOUT_MS)=>{if(t==null)return null;const i=b.makeCancelableTableEventPromise(t,n,s);return e(t),await i,t};static getSortIndex(e,t){for(let n=0;n<e.length;n+=1)if(e[n].column?.name===t)return n;return null}static getSortForColumn(e,t){const n=b.getSortIndex(e,t);return n!=null?e[n]:null}static getFilterText(e){return e?e.toString():null}static getFilterTypes(e){return b.isBooleanType(e)?[T.isTrue,T.isFalse,T.isNull]:b.isCharType(e)||b.isNumberType(e)||b.isDateType(e)?[T.eq,T.notEq,T.greaterThan,T.greaterThanOrEqualTo,T.lessThan,T.lessThanOrEqualTo]:b.isTextType(e)?[T.eq,T.eqIgnoreCase,T.notEq,T.notEqIgnoreCase,T.contains,T.notContains,T.startsWith,T.endsWith]:[]}static getNextSort(e,t,n){if(n<0||n>=e.length)return null;const s=b.getSortForColumn(t,e[n].name);return s===null?e[n].sort().asc():s.direction===b.sortDirection.ascending?s.desc():null}static makeColumnSort(e,t,n,s){if(t<0||t>=e.length||n===b.sortDirection.none)return null;let i=e[t].sort();switch(n){case b.sortDirection.ascending:i=i.asc();break;case b.sortDirection.descending:i=i.desc();break}return s&&(i=i.abs()),i}static toggleSortForColumn(e,t,n,s=!1){if(n<0||n>=t.length)return[];const i=b.getNextSort(t,e,n);return b.setSortForColumn(e,t[n].name,i,s)}static sortColumn(e,t,n,s,i,a){if(n<0||n>=t.length)return[];const r=b.makeColumnSort(t,n,s,i);return b.setSortForColumn(e,t[n].name,r,a)}static setSortForColumn(e,t,n,s=!1){const i=b.getSortIndex(e,t);let a=[];return s&&(a=a.concat(e.filter(({direction:r})=>r!==b.sortDirection.reverse)),i!==null&&a.splice(i,1)),n!==null&&a.push(n),a}static getNormalizedType(e){switch(e){case"boolean":case"java.lang.Boolean":case b.dataType.BOOLEAN:return b.dataType.BOOLEAN;case"char":case"java.lang.Character":case b.dataType.CHAR:return b.dataType.CHAR;case"java.lang.String":case b.dataType.STRING:return b.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 b.dataType.DATETIME:return b.dataType.DATETIME;case"double":case"java.lang.Double":case"float":case"java.lang.Float":case"java.math.BigDecimal":case b.dataType.DECIMAL:return b.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 b.dataType.INT:return b.dataType.INT;default:return b.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 b.isIntegerType(e)||b.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 b.getNormalizedType(e)===b.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:`"${e}"`}static isRangeOperation(e){switch(e){case"<":case"<=":case"=<":case">":case">=":case"=>":return!0;default:return!1}}static makeRangeFilterWithOperation(e,t,n){switch(t){case"=":return e.eq(n);case"<":return e.lessThan(n);case"<=":case"=<":return e.lessThanOrEqualTo(n);case">":return e.greaterThan(n);case">=":case"=>":return e.greaterThanOrEqualTo(n);case"!=":case"!":return e.notEq(n);default:return null}}static makeCancelableTablePromise(e){return Pe.makeCancelable(e,t=>{t.close()})}static makeCancelableTableEventPromise(e,t,n=0,s=null){let i,a,r=!0;const l=new Promise((u,h)=>{a=setTimeout(()=>{i(),r=!1,h(new Ye(`Event "${t}" timed out.`))},n),i=e.addEventListener(t,p=>{if(s!=null&&!s(p)){ue.debug2("Event triggered, but matcher returned false.");return}ue.debug2("Event triggered, resolving."),i(),clearTimeout(a),r=!1,u(p)})});return l.cancel=()=>{if(r){ue.debug2("Pending promise cleanup."),i(),clearTimeout(a),r=!1;return}ue.debug2("Ignoring non-pending promise cancel.")},l}static removeCommas(e){return e.replace(/[\s|,]/g,"")}static makeBooleanValue(e,t=!1){if(e===""&&t)return null;switch(e?.toLowerCase()){case"null":return null;case"0":case"f":case"fa":case"fal":case"fals":case"false":case"n":case"no":return!1;case"1":case"t":case"tr":case"tru":case"true":case"y":case"ye":case"yes":return!0;default:throw new Error(`Invalid boolean '${e}'`)}}static makeNumberValue(e){if(e==="null"||e==="")return null;const t=e.toLowerCase().trim();if(t==="∞"||t==="infinity"||t==="inf")return Number.POSITIVE_INFINITY;if(t==="-∞"||t==="-infinity"||t==="-inf")return Number.NEGATIVE_INFINITY;const n=b.removeCommas(t);if(b.NUMBER_REGEX.test(n))return parseFloat(n);throw new Error(`Invalid number '${e}'`)}static getFilterOperatorString(e){switch(e){case T.eq:return"=";case T.notEq:return"!=";case T.greaterThan:return">";case T.greaterThanOrEqualTo:return">=";case T.lessThan:return"<";case T.lessThanOrEqualTo:return"<=";case T.contains:return"~";case T.notContains:return"!~";default:throw new Error(`Unexpected filter type ${e}`)}}static isTreeTable(e){return e!=null&&e.expand!==void 0&&e.collapse!==void 0}static sortColumns(e,t=!0){return[...e].sort((n,s)=>{const i=n.name.toUpperCase(),a=s.name.toUpperCase();return Ii.sort(i,a,t)})}dh;constructor(e){this.dh=e}makeQuickFilter(e,t,n){const s=t.split("||");let i=null;for(let a=0;a<s.length;a+=1){const l=s[a].split("&&");let u=null;for(let h=0;h<l.length;h+=1){const p=l[h].trim();if(p.length>0){const m=this.makeQuickFilterFromComponent(e,p,n);if(m)u?u=u.and(m):u=m;else throw new Error(`Unable to parse quick filter from text ${t}`)}}i&&u?i=i.or(u):i=u}return i}makeQuickFilterFromComponent(e,t,n){const{type:s}=e;return b.isNumberType(s)?this.makeQuickNumberFilter(e,t):b.isBooleanType(s)?this.makeQuickBooleanFilter(e,t):n!=null&&b.isDateType(s)?this.makeQuickDateFilter(e,t,n):b.isCharType(s)?this.makeQuickCharFilter(e,t):this.makeQuickTextFilter(e,t)}makeQuickNumberFilter(e,t){const n=e.filter(),{dh:s}=this;let i=null;const r=/\s*(>=|<=|=>|=<|>|<|!=|=|!)?(\s*-\s*)?(\s*\d*(?:,\d{3})*(?:\.\d*)?\s*)?(null|nan|infinity|inf|\u221E)?(.*)/i.exec(t);let l=null,u=null,h=null,p=null,m=null;if(r!==null&&r.length>3&&([,l,u,h,p,m]=r),m!=null&&m.trim().length>0)return null;if(l==null&&(l="="),p!=null){if(!(l==="="||l==="!"||l==="!="))return null;switch(p=p.trim().toLowerCase(),p){case"null":i=n.isNull();break;case"nan":i=s.FilterCondition.invoke("isNaN",n);break;case"infinity":case"inf":case"∞":u!=null?i=s.FilterCondition.invoke("isInf",n).and(n.lessThan(s.FilterValue.ofNumber(0))):i=s.FilterCondition.invoke("isInf",n).and(n.greaterThan(s.FilterValue.ofNumber(0)));break}return i!==null&&(l==="!"||l==="!=")&&(i=i.not()),i}if(h==null)return null;if(h=b.removeCommas(h),b.isLongType(e.type))try{h=s.FilterValue.ofNumber(s.LongWrapper.ofString(`${u!=null?"-":""}${h}`))}catch(f){return ue.warn("Unable to create long filter",f),null}else{if(h=parseFloat(h),h==null||Number.isNaN(h))return null;h=s.FilterValue.ofNumber(u!=null?0-h:h)}return i=e.filter(),b.makeRangeFilterWithOperation(i,l,h)}makeQuickTextFilter(e,t){const{dh:n}=this,s=`${t}`.trim(),a=/^(!~|!=|~|=|!)?(.*)/.exec(s);let r=null,l=null;if(a!==null&&a.length>2&&([,r,l]=a,l!=null&&(l=l.trim())),l==null||l.length===0)return null;r==null&&(r="=");const u=e.filter();if(l.toLowerCase()==="null")switch(r){case"=":return u.isNull();case"!=":case"!":return u.isNull().not()}let h=null,p=null;switch(l.startsWith("*")?(h="*",l=l.substring(1)):l.endsWith("*")&&!l.endsWith("\\*")&&(p="*",l=l.substring(0,l.length-1)),l=l.replace("\\",""),r){case"~":return u.isNull().not().and(u.invoke("matches",n.FilterValue.ofString(`(?s)(?i).*\\Q${l}\\E.*`)));case"!~":return u.isNull().or(u.invoke("matches",n.FilterValue.ofString(`(?s)(?i).*\\Q${l}\\E.*`)).not());case"!=":return h==="*"?u.isNull().or(u.invoke("matches",n.FilterValue.ofString(`(?s)(?i).*\\Q${l}\\E$`)).not()):p==="*"?u.isNull().or(u.invoke("matches",n.FilterValue.ofString(`(?s)(?i)^\\Q${l}\\E.*`)).not()):u.notEqIgnoreCase(n.FilterValue.ofString(l.toLowerCase()));case"=":return h==="*"?u.isNull().not().and(u.invoke("matches",n.FilterValue.ofString(`(?s)(?i).*\\Q${l}\\E$`))):p==="*"?u.isNull().not().and(u.invoke("matches",n.FilterValue.ofString(`(?s)(?i)^\\Q${l}\\E.*`))):u.eqIgnoreCase(n.FilterValue.ofString(l.toLowerCase()))}return null}makeQuickBooleanFilter(e,t){const s=/^(!=|=|!)?(.*)/.exec(`${t}`.trim());if(s===null)return null;const[,i,a]=s,r=i==="!"||i==="!=",l=a.trim().toLowerCase();let u=e.filter();try{const h=b.makeBooleanValue(l);return h!=null&&h?u=u.isTrue():h===null?u=u.isNull():u=u.isFalse(),r?u.not():u}catch{return null}}makeQuickDateFilter(e,t,n){const s=t.trim(),a=/\s*(>=|<=|=>|=<|>|<|!=|!|=)?(.*)/.exec(s);if(a==null||a.length<=2)throw new Error(`Unable to parse date filter: ${t}`);let r=null,l=null;[,r,l]=a;let u=T.eq;switch(r){case"<":u=T.lessThan;break;case"<=":case"=<":u=T.lessThanOrEqualTo;break;case">":u=T.greaterThan;break;case">=":case"=>":u=T.greaterThanOrEqualTo;break;case"!=":case"!":u=T.notEq;break;case"=":case"==":default:u=T.eq;break}return this.makeQuickDateFilterWithOperation(e,l,u,n)}makeQuickDateFilterWithOperation(e,t,n,s){const{dh:i}=this,[a,r]=G.parseDateRange(i,t,s),l=a!=null?i.FilterValue.ofNumber(a):null,u=r!=null?i.FilterValue.ofNumber(r):null,h=e.filter();if(l==null)return n===T.notEq?h.isNull().not():h.isNull();switch(n){case T.eq:{if(u!=null){const p=h.greaterThanOrEqualTo(l),m=h.lessThan(u);return p.and(m)}return h.eq(l)}case T.lessThan:return h.lessThan(l);case T.lessThanOrEqualTo:return u!=null?h.lessThan(u):h.lessThanOrEqualTo(l);case T.greaterThan:return u!=null?h.greaterThanOrEqualTo(u):h.greaterThan(l);case T.greaterThanOrEqualTo:return h.greaterThanOrEqualTo(l);case T.notEq:{if(u!=null){const p=h.lessThan(l),m=h.greaterThanOrEqualTo(u);return p.or(m)}return h.notEq(l)}default:throw new Error(`Invalid operator: ${n}`)}}makeQuickCharFilter(e,t){const{dh:n}=this,s=`${t}`.trim(),a=/^(>=|<=|=>|=<|>|<|!=|=|!)?(null|"."|'.'|.)?(.*)/.exec(s);let r=null,l=null,u=null;if(a!==null&&a.length>3&&([,r,l,u]=a),u!=null&&u.trim().length>0||l==null||l.length===0)return null;r==null&&(r="=");const h=e.filter();if(l.toLowerCase()==="null")switch(r){case"=":return h.isNull();case"!=":case"!":return h.isNull().not();default:return null}const p=n.FilterValue.ofString(b.isRangeOperation(r)?b.quoteValue(l):l);return b.makeRangeFilterWithOperation(h,r,p)}makeAdvancedFilter(e,t,n){const{filterItems:s,filterOperators:i,invertSelection:a,selectedValues:r}=t;let l=null;for(let h=0;h<s.length;h+=1){const p=s[h],{selectedType:m,value:f}=p;if(m!=null&&m.length>0&&f!=null&&f.length>0)try{const S=this.makeAdvancedValueFilter(e,m,f,n);if(S!=null){if(h===0)l=S;else if(l!==null&&h-1<i.length){const v=i[h-1];if(v===gn.and)l=l.and(S);else if(v===gn.or)l=l.or(S);else{ue.error("Unexpected filter operator",v,S),l=null;break}}}else ue.debug2("Empty filter ignored for",m,f)}catch(S){ue.error("Unable to create filter",S),l=null;break}}const u=this.makeSelectValueFilter(e,r,a);return u!=null&&(l!=null?l=l.and(u):l=u),l}makeAdvancedValueFilter(e,t,n,s){const{dh:i}=this;if(b.isDateType(e.type))return this.makeQuickDateFilterWithOperation(e,n,t,s);if(b.isNumberType(e.type)||b.isCharType(e.type))return this.makeQuickFilter(e,`${b.getFilterOperatorString(t)}${n}`);const a=this.makeFilterValue(e.type,n),r=e.filter();switch(t){case T.eq:return r.eq(a);case T.eqIgnoreCase:return r.eqIgnoreCase(a);case T.notEq:return r.notEq(a);case T.notEqIgnoreCase:return r.notEqIgnoreCase(a);case T.greaterThan:return r.greaterThan(a);case T.greaterThanOrEqualTo:return r.greaterThanOrEqualTo(a);case T.lessThan:return r.lessThan(a);case T.lessThanOrEqualTo:return r.lessThanOrEqualTo(a);case T.isTrue:return r.isTrue();case T.isFalse:return r.isFalse();case T.isNull:return r.isNull();case T.contains:return r.isNull().not().and(r.invoke("matches",i.FilterValue.ofString(`(?s)(?i).*\\Q${n}\\E.*`)));case T.notContains:return r.isNull().or(r.invoke("matches",i.FilterValue.ofString(`(?s)(?i).*\\Q${n}\\E.*`)).not());case T.startsWith:return r.isNull().not().and(r.invoke("matches",i.FilterValue.ofString(`(?s)(?i)^\\Q${n}\\E.*`)));case T.endsWith:return r.isNull().not().and(r.invoke("matches",i.FilterValue.ofString(`(?s)(?i).*\\Q${n}\\E$`)));case T.in:case T.inIgnoreCase:case T.notIn:case T.notInIgnoreCase:case T.invoke:default:throw new Error(`Unexpected filter operation: ${t}`)}}async applyNeverFilter(e,t,n=b.APPLY_TABLE_CHANGE_TIMEOUT_MS){if(e==null)return null;const s=e.findColumn(t),i=[this.makeNeverFilter(s)];return await this.applyFilter(e,i,n),e}async applyCustomColumns(e,t,n=b.APPLY_TABLE_CHANGE_TIMEOUT_MS){const{dh:s}=this;return b.executeAndWaitForEvent(i=>i?.applyCustomColumns(t),e,s.Table.EVENT_CUSTOMCOLUMNSCHANGED,n)}async applyFilter(e,t,n=b.APPLY_TABLE_CHANGE_TIMEOUT_MS){const{dh:s}=this;return b.executeAndWaitForEvent(i=>i?.applyFilter(t),e,s.Table.EVENT_FILTERCHANGED,n)}async applySort(e,t,n=b.APPLY_TABLE_CHANGE_TIMEOUT_MS){const{dh:s}=this;return b.executeAndWaitForEvent(i=>i?.applySort(t),e,s.Table.EVENT_SORTCHANGED,n)}makeNeverFilter(e){const{dh:t}=this;let n=null;b.isTextType(e.type)?n=t.FilterValue.ofString("a"):b.isBooleanType(e.type)?n=t.FilterValue.ofBoolean(!0):b.isDateType(e.type)?n=t.FilterValue.ofNumber(t.DateWrapper.ofJsDate(new Date)):n=t.FilterValue.ofNumber(0);const s=e.filter().eq(n),i=e.filter().notEq(n);return s.and(i)}makeFilterValue(e,t){const{dh:n}=this,s=b.getBaseType(e);return b.isTextType(s)?n.FilterValue.ofString(t):b.isLongType(s)?n.FilterValue.ofNumber(n.LongWrapper.ofString(b.removeCommas(t))):n.FilterValue.ofNumber(b.removeCommas(t))}makeFilterRawValue(e,t){const{dh:n}=this;return b.isTextType(e)?n.FilterValue.ofString(t):b.isBooleanType(e)?n.FilterValue.ofBoolean(t):n.FilterValue.ofNumber(t)}makeValue(e,t,n){const{dh:s}=this;if(t==="null")return null;if(b.isTextType(e))return t;if(b.isLongType(e))return s.LongWrapper.ofString(b.removeCommas(t));if(b.isBooleanType(e))return b.makeBooleanValue(t,!0);if(b.isDateType(e)){const[i]=G.parseDateRange(s,t,n);return i}return b.isNumberType(e)?b.makeNumberValue(t):(ue.error("Unexpected column type",e),null)}makeSelectValueFilter(e,t,n){const{dh:s}=this;if(t.length===0)return n?null:this.makeNeverFilter(e);const i=[];let a=!1;for(let r=0;r<t.length;r+=1){const l=t[r];l==null?a=!0:b.isTextType(e.type)?i.push(s.FilterValue.ofString(typeof l=="number"?String.fromCharCode(l):l)):b.isBooleanType(e.type)?i.push(s.FilterValue.ofBoolean(!!l)):i.push(s.FilterValue.ofNumber(l))}return a?i.length>0?n?e.filter().isNull().not().and(e.filter().notIn(i)):e.filter().isNull().or(e.filter().in(i)):n?e.filter().isNull().not():e.filter().isNull():n?e.filter().notIn(i):e.filter().in(i)}}class ot{static makeColumnFormatMap(e){return e==null?new Map:e.reduce((t,n)=>{const s=b.getNormalizedType(n.columnType);return s===null||(t.has(s)||t.set(s,new Map),t.get(s)?.set(n.columnName,n.format)),t},new Map)}static makeColumnFormattingRule(e,t,n){return{columnType:e,columnName:t,format:n}}constructor(e,t=[],n,s,i,a=!1){this.defaultColumnFormatter=new Yn,this.typeFormatterMap=new Map([[b.dataType.BOOLEAN,new Qn],[b.dataType.CHAR,new Jn],[b.dataType.DATETIME,new he(e,n)],[b.dataType.DECIMAL,new J(e,s)],[b.dataType.INT,new be(e,i)],[b.dataType.STRING,new es]]),this.columnFormatMap=ot.makeColumnFormatMap(t),this.truncateNumbersWithPound=a}defaultColumnFormatter;typeFormatterMap;columnFormatMap;truncateNumbersWithPound;getColumnFormatMapForType(e,t=!1){const n=b.getNormalizedType(e);if(n!==null)return t&&!this.columnFormatMap.has(n)&&this.columnFormatMap.set(n,new Map),this.columnFormatMap.get(n)}getColumnFormat(e,t){return this.getColumnFormatMapForType(e)?.get(t)??null}getColumnTypeFormatter(e){const t=b.getNormalizedType(e);let n=this.defaultColumnFormatter;return t&&(n=this.typeFormatterMap.get(t)??n),n}getFormattedString(e,t,n="",s){if(e==null)return"";const i=this.getColumnTypeFormatter(t),a=s||this.getColumnFormat(t,n);return i.format(e,a??void 0)}get timeZone(){return this.typeFormatterMap.get(b.dataType.DATETIME)?.dhTimeZone?.id}}function ts(o){if(o&&o.formatter){const{formatter:e}=o;return e}}function ns(o){return{timeZone:o?.timeZone,defaultDateTimeFormatString:o?.defaultDateTimeFormat,showTimeZone:o?.showTimeZone,showTSeparator:o?.showTSeparator}}function ss(o,e,t){const n=o.getColumnFormat(t,e);return n!=null&&(n.type===z.TYPE_CONTEXT_PRESET||n.type===z.TYPE_CONTEXT_CUSTOM)}const vt={getColumnFormats:ts,getDateTimeFormatterOptions:ns,isCustomColumnFormatDefined:ss},pt=V.module("MessageUtils"),is="io.deephaven.message.LoginOptions.request",os="io.deephaven.message.SessionDetails.request",as="io.deephaven.broadcast",rs="io.deephaven.broadcast.Login",ls="io.deephaven.broadcast.Logout";function at(o){const e=o;return e!=null&&typeof e.id=="string"&&typeof e.message=="string"}function cs(o){return at(o)&&o.message===rs}function us(o){return at(o)&&o.message===ls}function ds(o){const e=o;return e!=null&&typeof e.id=="string"}function hs(o,e=Se(),t){return{message:o,id:e,payload:t}}function ga(o,e){return{id:o,payload:e}}async function Kt(o,e=3e4){if(window.opener==null)throw new Error("window.opener is null, unable to send request.");return new Promise((t,n)=>{let s;const i=Se(),a=r=>{const{data:l}=r;if(!ds(l)){pt.debug("Ignoring non-deephaven response",l);return}if(pt.debug("Received message",l),l?.id!==i){pt.debug("Ignore message, id doesn't match",l);return}window.clearTimeout(s),window.removeEventListener("message",a),t(l.payload)};window.addEventListener("message",a),s=window.setTimeout(()=>{window.removeEventListener("message",a),n(new Ye("Request timed out"))},e),window.opener.postMessage(hs(o,i),"*")})}class ps extends Error{isNoConsolesError=!0}function ms(o){return o.isNoConsolesError}const we=V.module("SessionUtils");function ba(o,e){return we.info(`Starting connection to '${e}'...`),new o.IdeConnection(e)}async function fs(o,e,t){we.info("Getting console types...");const n=await e.getConsoleTypes();if(n.length===0)throw new ps("No console types available");we.info("Available types:",n);const s=n[0];we.info("Starting session with type",s);const i=await e.startSession(s),a={type:s,id:Se.generate()};return we.info("Console session established",a),{session:i,config:a,connection:e,details:t,dh:o}}function Ca(o,e,t){return we.info("createCoreClient",e),new o.CoreClient(e,t)}function Sa(o){return o!=null&&typeof o=="object"}async function va(){const o=await Kt(os);if(!Sa(o))throw new Error(`Unexpected session details response: ${o}`);return o}async function Ma(){switch(new URLSearchParams(window.location.search).get("authProvider")){case"parent":return va()}return{}}async function ya(o,e,t){let n;try{n=await fs(o,e,t)}catch(s){if(!ms(s))throw s}return n}const Ta=V.module("ViewportDataUtils");function gs(o,e){return String(o.offsetInSnapshot+e)}function bs(o,e){return function(n){const{columns:s,offset:i,rows:a}=n.detail;Ta.debug("table updated",n.detail),a.forEach(r=>{const l=e(r,s),u={key:gs(r,i),item:l};o.getItem(u.key)!=null?o.update(u.key,u):o.append(u)})}}function Cs(o,e){return e.reduce((t,n)=>(t[n.name]=o.get(n),t),{})}function*Ss(o,e){for(let t=o;t<=e;++t)yield{key:String(t)}}function Ea(o,...e){return e.map(t=>o.getItem(t))}function Wt(o){return o==null||rt(o)?0:o.size}function rt(o){return"isClosed"in o?o.isClosed:!1}function vs(o,e,t,n){const s=o+e-1,[i,a]=[0,n-1],r=gt(o-t,i,a),l=gt(s+t,i,a);return[r,l]}const Ia=Object.freeze(Object.defineProperty({__proto__:null,BROADCAST_CHANNEL_NAME:as,BROADCAST_LOGIN_MESSAGE:rs,BROADCAST_LOGOUT_MESSAGE:ls,BooleanColumnFormatter:Qn,CharColumnFormatter:Jn,DateTimeColumnFormatter:he,DateUtils:G,DecimalColumnFormatter:J,DefaultColumnFormatter:Yn,FETCH_TIMEOUT:Xn,Formatter:ot,FormatterUtils:vt,IntegerColumnFormatter:be,LOGIN_OPTIONS_REQUEST:is,NoConsolesError:ps,SESSION_DETAILS_REQUEST:os,StringColumnFormatter:es,TableColumnFormatter:z,TableUtils:b,createConnection:ba,createCoreClient:Ca,createKeyFromOffsetRow:gs,createOnTableUpdatedHandler:bs,createSessionWrapper:fs,defaultRowDeserializer:Cs,fetchVariableDefinition:ca,generateEmptyKeyedItems:Ss,getColumnFormats:ts,getDateTimeFormatterOptions:ns,getItemsFromListData:Ea,getSessionDetails:Ma,getSize:Wt,isBroadcastLoginMessage:cs,isBroadcastLogoutMessage:us,isClosed:rt,isCustomColumnFormatDefined:ss,isMessage:at,isNoConsolesError:ms,isResponse:ds,loadSessionWrapper:ya,makeMessage:hs,makeResponse:ga,padFirstAndLastRow:vs,requestParentResponse:Kt},Symbol.toStringTag,{value:"Module"}));function Ms(o){if(o==null)return!1;const e=o;return e.Component!==void 0&&typeof e.isAvailable=="function"}const ys="io.deephaven.auth.AnonymousAuthenticationHandler",xa="io.deephaven.authentication.psk.PskAuthenticationHandler";class wa extends Error{name="AuthenticationError";isAuthenticationError=!0}const Ts=wa,bn=V.module("AuthPluginBase");function qt({children:o,getLoginOptions:e}){const t=Ve(),[n,s]=d.useState(),[i,a]=d.useState(!1);return d.useEffect(()=>{let r=!1;function l(){if(r)throw new bt("Login canceled.")}async function u(){try{const h=await e();l(),bn.info("Logging in..."),await t.login(h),l(),a(!0)}catch(h){if(!r){bn.error("Unable to login:",h);const p=qe(h)??"Unable to login. Verify credentials.";s(new Ts(p)),a(!1)}}}return u(),()=>{r=!0}},[t,e]),i?c.jsx(c.Fragment,{children:o}):c.jsx(Le,{"data-testid":"auth-base-loading",isLoading:n==null,isLoaded:!1,errorMessage:qe(n)})}const Na=d.createContext({}),Gt=d.createContext({}),ka={canLogout:!1};function Da({children:o}){const e=ae(),t=d.useCallback(()=>({type:e.CoreClient.LOGIN_TYPE_ANONYMOUS}),[e]);return c.jsx(qt,{getLoginOptions:t,children:c.jsx(Gt.Provider,{value:ka,children:o})})}const Oa={Component:Da,isAvailable:o=>o.includes(ys)},Aa=Oa,Fa=V.module("AuthPluginParent"),Ra={canLogout:!1};function Pa(o){return o!=null&&typeof o.type=="string"}async function La(){Fa.info("Logging in by delegating to parent window...");const o=await Kt(is);if(!Pa(o))throw new Error(`Unexpected login options response: ${o}`);return o}function ja(){return new URLSearchParams(window.location.search).get("authProvider")??""}function $a({children:o}){return c.jsx(qt,{getLoginOptions:La,children:c.jsx(Gt.Provider,{value:Ra,children:o})})}const Va={Component:$a,isAvailable:()=>window.opener!=null&&ja()==="parent"},Ba=Va;function Ha(o){return function({children:t}){return c.jsx(Nt.Provider,{value:o,children:t})}}const Cn=V.module("useTableListener"),_a=(o,e,t)=>d.useEffect(function(){if(o==null){Cn.debug2("Emitter undefined, skipping addEventListener",e);return}return Cn.debug2("Adding listener",e),o.addEventListener(e,t)},[o,e,t]),ke=_a;class Ua extends Error{isColumnNameError=!0}const Ka=Ua;class Wa extends Error{isTableDisconnectError=!0}const qa=Wa,Ke=V.module("useTable"),Ga=(o,e,t,n)=>{const s=ae(),[i,a]=d.useState(void 0),[r,l]=d.useState([]),[u,h]=d.useState(null),[p,m]=d.useState(null);d.useEffect(()=>{if(n===void 0){a(o?.columns),h(null);return}try{a(o?.findColumns(n)),h(null)}catch(C){Ke.error("Column not found",C,n),h(new Ka("Invalid columnNames argument"))}},[o,n]),d.useEffect(()=>{if(!i||!o){Ke.debug2("Table or column not initialized, skip viewport update.");return}Ke.debug2("Setting viewport",e,t),o.setViewport(e,t,i)},[i,o,e,t]);const f=d.useCallback(({detail:C})=>{if(!i){Ke.error("Columns not initialized.");return}const x=i.map(k=>C.rows.map(M=>M.get(k)));l(x)},[i]),S=d.useCallback(()=>{m(new qa("Table disconnected"))},[]),v=d.useCallback(()=>{m(null)},[]);return ke(o,s.Table.EVENT_UPDATED,f),ke(o,s.Table.EVENT_DISCONNECT,S),ke(o,s.Table.EVENT_RECONNECT,v),{columns:i,data:r,error:p??u}},Es=Ga,za=(o,e,t,n)=>{const s=d.useMemo(()=>[n],[n]),{columns:i=[],data:a=[],error:r}=Es(o,e,t,s);return{column:i[0],data:a[0],error:r}},Is=za;const de=V.module("TableInput"),mt=250;function zt(o){const{className:e=void 0,columnName:t,settings:n,defaultValue:s=[],isInvalid:i=!1,onChange:a=()=>!1,onBlur:r=()=>!1,table:l}=o,u=d.useRef(null),h=ae(),p=d.useMemo(()=>{const w=vt.getColumnFormats(n),L=vt.getDateTimeFormatterOptions(n),{defaultDecimalFormatOptions:K={},defaultIntegerFormatOptions:q={}}=n;return new ot(h,w,L,K,q)},[h,n]),[m,f]=d.useState(""),[S,v]=d.useState(new Set(s)),[C,x]=d.useState(),k=d.useRef(null),M=Math.min(C?.size??0,mt),{column:A,data:F,error:O}=Is(C,0,mt-1,t),$=d.useCallback(w=>A?p.getFormattedString(w,A.type,A.name):`${w}`,[A,p]),[B,ee]=d.useMemo(()=>{const w=new Set(S),L=[];if(F==null)return[L,null];if(F.forEach(K=>{const q=`${K}`,Be=S.has(q);Be&&w.delete(q),L.push({value:q,displayValue:$(K),isSelected:Be})}),w.size>0){de.debug2("Selection has items that are missing from the viewport");const K=new Set(S);return Array.from(w).forEach(q=>{K.delete(q)}),[L,K]}return[L,null]},[F,S,$]);d.useEffect(()=>{ee!==null&&(v(ee),a(Array.from(ee)))},[a,ee]);const j=d.useCallback(async w=>{try{const L=await w;de.debug("Table resolved",L),x(L)}catch(L){if(Pe.isCanceled(L))return;de.error(L)}},[]);d.useEffect(()=>{const w=Pe.makeCancelable(l);return j(w),()=>{de.debug2("Cancel table promise"),w.cancel()}},[l,j]);const R=d.useCallback(w=>{const{value:L}=w.target;f(L);const K=B.findIndex(q=>q.displayValue.includes(L));K>-1?(de.debug2(`Found ${L} at index ${K}`),k.current?.scrollIntoView(K)):de.debug2(`${L} not found`)},[B,k]),H=d.useCallback(w=>{if(de.debug("handleSelect",w),w>=B.length){de.error("Invalid index",w);return}const L=B[w].value,K=new Set(S);B[w].isSelected?K.delete(L):K.add(L),v(K),a(Array.from(K))},[a,B,S]),N=d.useCallback(()=>{const w=B.map(K=>K.value),L=new Set(w);v(L),a(w)},[B,a]),D=d.useCallback(()=>{v(new Set),a([])},[a]),y=d.useCallback(()=>{},[]),P=d.useCallback(w=>{const{relatedTarget:L}=w;de.debug("handleChildBlur",L,L instanceof HTMLElement,u.current,u.current?.contains(L)),(!L||u.current&&L instanceof HTMLElement&&!u.current.contains(L))&&r()},[r]),_=B.length===0;return c.jsxs("div",{ref:u,className:I("table-input-container d-flex flex-column position-relative",e),children:[c.jsx(nt,{disabled:!!O||_,value:m,placeholder:"Search",onChange:R,className:"mb-2 d-flex",onBlur:P}),c.jsx(Gn,{className:"table-input-list",disabled:C===void 0||_,isInvalid:i,items:_?[{value:"Empty",isSelected:!1}]:B,itemCount:M,offset:0,onSelect:H,onViewportChange:y,ref:k,onBlur:P}),C&&c.jsxs("div",{className:"meta-row",children:[c.jsx("div",{className:"d-flex align-items-center text-muted small",children:C!=null&&C.size>M&&c.jsxs(c.Fragment,{children:["Table is too large, showing the first ",mt," items."]})}),c.jsxs("div",{children:[c.jsx("button",{type:"button",className:"btn btn-link",onBlur:P,onClick:N,children:"Select All"}),c.jsx("button",{type:"button",className:"btn btn-link mr-a",onBlur:P,onClick:D,children:"Clear"})]})]}),C==null||O&&c.jsx("div",{className:"h-100 w-100 position-absolute",children:c.jsx(Le,{isLoaded:C!=null,isLoading:C==null&&O==null,errorMessage:O?.message??null})})]})}zt.displayName="TableInput";zt.defaultProps={isInvalid:!1,className:void 0};const Sn=V.module("useBroadcastChannel");function xs(o=Si,e=as){const t=d.useMemo(()=>new BroadcastChannel(e),[e]);return d.useEffect(()=>()=>{t.close()},[t]),d.useEffect(()=>{function n(s){const{data:i}=s;if(!at(i)){Sn.debug("Ignoring non-deephaven message",i);return}Sn.debug("event received",i),o(s)}return t.addEventListener("message",n),()=>{t.removeEventListener("message",n)}},[t,o]),t}function Zt(o,e){const t=d.useCallback(n=>{cs(n.data)?o?.(n.data):us(n.data)&&e?.(n.data)},[o,e]);xs(t)}const Qe="io.deephaven.web.client.auth.refreshToken",ws=d.createContext(null),Za=V.module("RefreshTokenUtils");function Mt(){const o=De.get(Qe);try{if(o!=null)return JSON.parse(o)}catch(e){Za.error("Error parsing refresh token",o,e)}return null}function yt(o){if(o==null){De.remove(Qe);return}const e=JSON.stringify({bytes:o.bytes,expiry:o.expiry}),t=new Date(o.expiry);De.set(Qe,e,{secure:!0,sameSite:"strict",expires:t})}function Xa({children:o}){const e=ae(),t=Ve(),[n,s]=d.useState(Mt());d.useEffect(function(){return t.addEventListener(e.CoreClient.EVENT_REFRESH_TOKEN_UPDATED,u=>{const{detail:h}=u;yt(h),s(h)})},[e,t,n]);const i=d.useCallback(()=>{s(Mt())},[]),a=d.useCallback(()=>{yt(null),s(null)},[]);return Zt(i,a),c.jsx(ws.Provider,{value:n,children:o})}const vn=V.module("useDebouncedViewportSearch"),Qa=200;function Ja(o,e,t=Qa){const n=ae(),s=d.useMemo(()=>new b(n),[n]),{table:i,applyFiltersAndRefresh:a}=o,r=d.useMemo(()=>Re(l=>{if(vn.debug(`Applying debounced searchText '${l}'`),i==null)return;const u=l.trim();if(u===""){a([]);return}const h=i.findColumn(e),p=s.makeFilterValue(h.type,u),m=[h.filter().contains(p)];a(m)},t),[a,e,t,i,s]);return d.useEffect(()=>()=>{vn.debug("Cancelling debounced search function"),r.cancel()},[r]),r}function Xt(o){const[,e]=d.useState(0),t=ae();return ke(o,t.Table.EVENT_SIZECHANGED,()=>{e(n=>n+1)}),Wt(o)}function Ns(o){const e=Us({}),t=Ot(o),n=Math.max(0,Xt(o));return d.useEffect(()=>{let s=e.items.length;if(o!==t&&s&&(e.remove(...e.items.map(({key:i})=>i)),s=0),!!o){if(n>s)e.insert(s,...Ss(s,n-1));else if(n<s){const i=e.items.slice(n).map(({key:a})=>a);e.remove(...i)}}},[n,o]),e}function Ya(o,...e){const t=d.useCallback(async()=>o?.selectDistinct(o.findColumns(e))??null,[o,...e]),{data:n,error:s,isError:i,isLoading:a}=An(t,[]);return d.useEffect(()=>()=>{n?.close()},[n]),{distinctTable:n,error:s,isError:i,isLoading:a}}function ks(o,e,t){return d.useCallback(function(s){const[i,a]=vs(s,e,t,Wt(o));o?.setViewport(i,a)},[o,t,e])}function er(o){d.useEffect(()=>()=>{o!=null&&(rt(o)||o.close())},[o])}function tr(){const o=ae();return d.useMemo(()=>new b(o),[o])}function nr({table:o,viewportSize:e=10,viewportPadding:t=50,deserializeRow:n=Cs}){const s=Ns(o),i=ks(o,e,t),a=d.useCallback(u=>{o?.applyFilter(u),i(0)},[i,o]),r=ae();ke(o,r.Table.EVENT_UPDATED,bs(s,n));const l=Xt(o);return d.useEffect(()=>{o&&!rt(o)&&i(0)},[o,i,l]),{viewportData:s,size:l,table:o,applyFiltersAndRefresh:a,setViewport:i}}const sr=Object.freeze(Object.defineProperty({__proto__:null,REFRESH_TOKEN_KEY:Qe,RefreshTokenBootstrap:Xa,RefreshTokenContext:ws,TableInput:zt,makeApiContextWrapper:Ha,readRefreshToken:Mt,storeRefreshToken:yt,useBroadcastChannel:xs,useBroadcastLoginListener:Zt,useDebouncedViewportSearch:Ja,useInitializeViewportData:Ns,useSelectDistinctTable:Ya,useSetPaddedViewportCallback:ks,useTable:Es,useTableClose:er,useTableColumn:Is,useTableListener:ke,useTableSize:Xt,useTableUtils:tr,useViewportData:nr},Symbol.toStringTag,{value:"Module"}));function Ds({children:o,errorMessage:e,isLoggingIn:t=!1,onSubmit:n}){return c.jsxs("form",{className:"login-form",onSubmit:s=>{s.preventDefault(),s.stopPropagation(),n?.(s)},children:[c.jsx("div",{className:"flex-spacer"}),c.jsxs("div",{className:"flex-wrapper",children:[c.jsx("fieldset",{disabled:t,className:"container-fluid",children:o}),c.jsx("div",{className:"form-group d-flex justify-content-end align-items-center mb-0",children:c.jsxs("button",{type:"submit",className:I("btn btn-primary",{"btn-spinner":t},{"btn-cancelable":t}),"data-testid":"btn-login",children:[t&&c.jsxs("span",{children:[c.jsx(wt,{}),c.jsx("span",{className:"btn-normal-content",children:"Logging in"}),c.jsx("span",{className:"btn-hover-content",children:"Cancel"})]}),!t&&"Login"]})})]}),c.jsx("div",{className:"flex-spacer",children:e!=null&&c.jsx("p",{className:"error-message mb-0",role:"alert",children:`${e}`})})]})}function Os({children:o,logoPath:e="./logo.png"}){return c.jsxs("div",{className:"login-container",children:[c.jsx(qn,{}),c.jsxs("div",{className:"login-box",children:[c.jsx("div",{className:"logo",children:c.jsx("img",{src:e,alt:"Deephaven Data Labs"})}),o,c.jsxs("p",{className:"footer",children:["© 2016-",new Date().getFullYear()," Deephaven Data Labs LLC. Patent Pending."]})]})]})}const Tt="io.deephaven.authentication.psk.PskAuthenticationHandler",As="psk",Et="io.deephaven.web.client.auth.psk.token",Ne=V.module("AuthPluginPsk");function ir(){return new URLSearchParams(window.location.search).get(As)}function or(){Ne.debug2("clearWindowToken");const o=new URL(window.location.href);o.searchParams.delete(As),window.history.replaceState(null,"",o.href)}function Mn(){return De.get(Et)??null}function ft(o){Ne.debug2("Storing token in cookie",o),o!=null?De.set(Et,o,{secure:!0,sameSite:"strict"}):De.remove(Et)}function ar({children:o,logoPath:e}){const t=Ve(),n=d.useRef(null),s=d.useRef(null),[i,a]=d.useState(),[r,l]=d.useState(!1),[u,h]=d.useState(!1),[p,m]=d.useState(!1),[f,S]=d.useState(""),v=d.useCallback(async(A,F=!0)=>{Ne.info("Logging in..."),m(!0);let O=null;try{if(O=t.login({type:Tt,token:A}),s.current=O,await O,Ne.info("Logged in successfully"),s.current!==O)return;ft(A),h(!0)}catch($){if(s.current!==O)return;if(l(!0),F){Ne.error("Unable to login",$);const B=qe($)??"Unable to login: Verify credentials.";a(new Ts(B))}}m(!1)},[t]),C=d.useCallback(()=>{s.current=null,m(!1)},[]),x=d.useCallback(async()=>{Ne.debug("onLogin");const A=Mn();u||p||A==null||v(A,!1)},[u,p,v]),k=d.useCallback(()=>{ft(null)},[]);Zt(x,k),d.useEffect(()=>{let A=!1;async function F(){const O=ir()??Mn();if(or(),O==null){l(!0);return}m(!0);try{await t.login({type:Tt,token:O}),A||(ft(O),h(!0),m(!1))}catch{A||(l(!0),m(!1))}}return F(),()=>{A=!0}},[t]);const M=d.useCallback(()=>{p?C():v(f)},[C,p,v,f]);return d.useEffect(function(){n.current?.focus()},[n,r]),c.jsxs(c.Fragment,{children:[u&&o,r&&c.jsx(Te,{in:!u,timeout:ce.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:c.jsx(Os,{logoPath:e,children:c.jsx(Ds,{errorMessage:qe(i),isLoggingIn:p,onSubmit:M,children:c.jsxs("div",{className:"form-group",children:[c.jsx("label",{htmlFor:"auth-psk-token-input",children:"Token"}),c.jsx("input",{id:"auth-psk-token-input",name:"token",className:"input-token form-control",type:"text",autoComplete:"username",autoCapitalize:"none",autoCorrect:"off",spellCheck:"false",ref:n,value:f,onChange:A=>{a(void 0),S(A.target.value)}})]})})})}),c.jsx(Le,{"data-testid":"auth-psk-loading",isLoaded:u||r,isLoading:!u&&!r})]})}const rr={Component:ar,isAvailable:o=>o.includes(Tt)},lr=rr,cr=Object.freeze(Object.defineProperty({__proto__:null,AUTH_HANDLER_TYPE_ANONYMOUS:ys,AUTH_HANDLER_TYPE_PSK:xa,AuthPluginAnonymous:Aa,AuthPluginBase:qt,AuthPluginParent:Ba,AuthPluginPsk:lr,Login:Os,LoginForm:Ds,UserOverrideContext:Na,UserPermissionsOverrideContext:Gt,isAuthPlugin:Ms},Symbol.toStringTag,{value:"Module"})),Fs={react:E,"react-dom":yn,redux:Ks,"react-redux":Ws,"@deephaven/auth-plugins":cr,"@deephaven/components":oa,"@deephaven/jsapi-bootstrap":la,"@deephaven/jsapi-components":sr,"@deephaven/jsapi-utils":Ia,"@deephaven/log":di,"@deephaven/react-hooks":Di},ur=En.createRequires(()=>Fs),dr=En.createRemoteComponent({requires:ur}),hr=dr,pr=qs.createRequires(Fs),mr=Gs({requires:pr}),fr=mr,Ce=V.module("@deephaven/app-utils.PluginUtils");function Nr(o,e){const t=new URL(`${e}.js`,o),n=E.forwardRef((s,i)=>c.jsx(hr,{url:t.href,render:({err:a,Component:r})=>{if(a!=null&&a!==""){const l=`Error loading plugin ${e} from ${t} due to ${a}`;return Ce.error(l),c.jsx("div",{className:"error-message",children:`${l}`})}return c.jsx(r,{ref:i,...s})}}));return n.pluginName=e,n.displayName="Plugin",n}async function gr(o){return await fr(o)}async function br(o){const e=await fetch(o);if(!e.ok)throw new Error(e.statusText);try{return await e.json()}catch{throw new Error("Could not be parsed as JSON")}}async function Cr(o){Ce.debug("Loading plugins...");try{const e=await br(`${o}/manifest.json`);if(!Array.isArray(e.plugins))throw new Error("Plugin manifest JSON does not contain plugins array");Ce.debug("Plugin manifest loaded:",e);const t=[];for(let i=0;i<e.plugins.length;i+=1){const{name:a,main:r}=e.plugins[i],l=`${o}/${a}/${r}`;t.push(gr(l))}const n=await Promise.allSettled(t),s=new Map;for(let i=0;i<n.length;i+=1){const a=n[i],{name:r}=e.plugins[i];a.status==="fulfilled"?s.set(r,a.value):Ce.error(`Unable to load plugin ${r}`,a.reason)}return Ce.info("Plugins loaded:",s),s}catch(e){return Ce.error("Unable to load plugins:",e),new Map}}function Sr(o){return o.get("AuthHandlers")?.split(",")??[]}function kr(o,e,t){const n=Sr(e),s=[...o.entries()].filter(([,l])=>Ms(l.AuthPlugin)).map(([l,u])=>[l,u.AuthPlugin]);s.push(...t??[]);const i=s.filter(([l,u])=>u.isAvailable(n,e));if(i.length===0)throw new Error(`No login plugins found, please register a login plugin for auth handlers: ${n}`);i.length>1&&Ce.warn("More than one login plugin available, will use the first one: ",i.map(([l])=>l).join(", "));const[a,r]=i[0];return Ce.info("Using LoginPlugin",a),r.Component}const Rs=d.createContext(null);function Dr({pluginsUrl:o,children:e}){const[t,n]=d.useState(null);return d.useEffect(function(){let i=!1;async function a(){const r=await Cr(o);i||n(r)}return a(),()=>{i=!0}},[o]),c.jsx(Rs.Provider,{value:t,children:e})}const vr=V.module("@deephaven/jsapi-components.ConnectionBootstrap"),Ps=d.createContext(null);function Or({children:o}){const e=ae(),t=Ve(),[n,s]=d.useState(),[i,a]=d.useState();return d.useEffect(function(){let l=!1;async function u(){try{const h=await t.getAsIdeConnection();if(l)return;a(h)}catch(h){if(l)return;s(h)}}return u(),()=>{l=!0}},[e,t]),d.useEffect(function(){if(i==null)return;function l(h){const{detail:p}=h;vr.info("Shutdown",`${JSON.stringify(p)}`),s(`Server shutdown: ${p??"Unknown reason"}`)}return i.addEventListener(e.IdeConnection.EVENT_SHUTDOWN,l)},[e,i]),i==null||n!=null?c.jsx(Le,{"data-testid":"connection-bootstrap-loading",isLoading:i==null,errorMessage:n!=null?`${n}`:void 0}):c.jsx(Ps.Provider,{value:i,children:o})}function Ar(){return $e(Rs,"No Plugins available in usePlugins. Was code wrapped in PluginsBootstrap or PluginsContext.Provider?")}function Fr(){return $e(Ps,"No IdeConnection available in useConnection. Was code wrapped in ConnectionBootstrap or ConnectionContext.Provider?")}export{le as $,Eo as A,se as B,Bi as C,Vn as D,Tr as E,vt as F,_o as G,xo as H,oe as I,Oe as J,X as K,Mo as L,te as M,qi as N,gn as O,Pe as P,ro as Q,Io as R,Me as S,Ae as T,Kn as U,To as V,yo as W,Dn as X,Fi as Y,Uo as Z,Ri as _,Ti as a,Pt as a0,Rn as a1,fo as a2,Ui as a3,Ki as a4,W as a5,as as a6,hs as a7,ls as a8,Oi as a9,Cr as aA,Sr as aB,Ai as aa,Ve as ab,Fr as ac,Ar as ad,Na as ae,Gt as af,Ma as ag,ya as ah,xs as ai,rs as aj,Rs as ak,kr as al,qe as am,lr as an,Ba as ao,Aa as ap,Zt as aq,Dr as ar,ra as as,Xa as at,Or as au,Ps as av,hr as aw,Nr as ax,gr as ay,br as az,Ii as b,ze as c,nt as d,bt as e,kt as f,Mi as g,T as h,b as i,G as j,ot as k,Ot as l,Ir as m,Er as n,U as o,z as p,he as q,J as r,be as s,Gi as t,ae as u,Gn as v,wr as w,Co as x,bo as y,Lo as z};
5
- //# sourceMappingURL=useConnection-80b76cca.js.map
5
+ //# sourceMappingURL=useConnection-831c4fc5.js.map